pax_global_header00006660000000000000000000000064122245300320014503gustar00rootroot0000000000000052 comment=7d6f37ec87b01b9d1c2dabe5b4078a36f7c06e98 basex-7.7.2/000077500000000000000000000000001222453003200126225ustar00rootroot00000000000000basex-7.7.2/.gitignore000066400000000000000000000001471222453003200146140ustar00rootroot00000000000000## generic files to ignore *~ *.lock *.DS_Store *.swp *.out org.maven.ide.eclipse.prefs .idea/ *.class basex-7.7.2/basex-api/000077500000000000000000000000001222453003200144735ustar00rootroot00000000000000basex-7.7.2/basex-api/.checkstyle000066400000000000000000000012361222453003200166340ustar00rootroot00000000000000 basex-7.7.2/basex-api/.classpath000066400000000000000000000014041222453003200164550ustar00rootroot00000000000000 basex-7.7.2/basex-api/.gitignore000066400000000000000000000000221222453003200164550ustar00rootroot00000000000000/doc /lib /target basex-7.7.2/basex-api/.project000066400000000000000000000016351222453003200161470ustar00rootroot00000000000000 basex-api org.eclipse.jdt.core.javabuilder net.sf.eclipsecs.core.CheckstyleBuilder org.maven.ide.eclipse.maven2Builder org.eclipse.m2e.core.maven2Builder org.eclipse.m2e.core.maven2Nature org.maven.ide.eclipse.maven2Nature org.eclipse.jdt.core.javanature net.sf.eclipsecs.core.CheckstyleNature basex-7.7.2/basex-api/.settings/000077500000000000000000000000001222453003200164115ustar00rootroot00000000000000basex-7.7.2/basex-api/.settings/checkstyle.xml000066400000000000000000000121161222453003200212720ustar00rootroot00000000000000 basex-7.7.2/basex-api/.settings/org.eclipse.core.resources.prefs000066400000000000000000000002711222453003200246240ustar00rootroot00000000000000eclipse.preferences.version=1 encoding//src/main/java=UTF-8 encoding//src/main/resources=UTF-8 encoding//src/test/java=UTF-8 encoding//src/test/resources=UTF-8 encoding/=UTF-8 basex-7.7.2/basex-api/.settings/org.eclipse.core.runtime.prefs000066400000000000000000000001211222453003200242670ustar00rootroot00000000000000#Mon Feb 14 18:03:25 CET 2011 eclipse.preferences.version=1 line.separator=\n basex-7.7.2/basex-api/.settings/org.eclipse.jdt.core.prefs000066400000000000000000000726701222453003200234070ustar00rootroot00000000000000eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.doc.comment.support=enabled org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning org.eclipse.jdt.core.compiler.problem.deadCode=warning org.eclipse.jdt.core.compiler.problem.deprecation=ignore org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled org.eclipse.jdt.core.compiler.problem.fieldHiding=warning org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=private org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=enabled org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error org.eclipse.jdt.core.compiler.problem.nullReference=warning org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=enabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning org.eclipse.jdt.core.compiler.problem.unclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled org.eclipse.jdt.core.compiler.problem.unusedImport=warning org.eclipse.jdt.core.compiler.problem.unusedLabel=warning org.eclipse.jdt.core.compiler.problem.unusedLocal=warning org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore org.eclipse.jdt.core.compiler.problem.unusedParameter=warning org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.compiler.taskCaseSensitive=disabled org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL org.eclipse.jdt.core.compiler.taskTags=TODO,[CG],[AH],[LK],[CG],[MS],[DP],[LW],[JE],[DK],[MSG] org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=90 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=0 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.comment.clear_blank_lines=true org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false org.eclipse.jdt.core.formatter.comment.format_block_comments=true org.eclipse.jdt.core.formatter.comment.format_comments=false org.eclipse.jdt.core.formatter.comment.format_header=true org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true org.eclipse.jdt.core.formatter.comment.format_line_comments=true org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=do not insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert org.eclipse.jdt.core.formatter.comment.line_length=96 org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=2 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true org.eclipse.jdt.core.formatter.lineSplit=96 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=space org.eclipse.jdt.core.formatter.tabulation.size=2 org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true basex-7.7.2/basex-api/.settings/org.eclipse.jdt.ui.prefs000066400000000000000000000053341222453003200230650ustar00rootroot00000000000000#Sat Feb 04 16:59:42 CET 2012 cleanup.add_default_serial_version_id=true cleanup.add_generated_serial_version_id=false cleanup.add_missing_annotations=true cleanup.add_missing_deprecated_annotations=true cleanup.add_missing_methods=false cleanup.add_missing_nls_tags=false cleanup.add_missing_override_annotations=true cleanup.add_missing_override_annotations_interface_methods=true cleanup.add_serial_version_id=false cleanup.always_use_blocks=true cleanup.always_use_parentheses_in_expressions=false cleanup.always_use_this_for_non_static_field_access=false cleanup.always_use_this_for_non_static_method_access=false cleanup.convert_to_enhanced_for_loop=true cleanup.correct_indentation=false cleanup.format_source_code=false cleanup.format_source_code_changes_only=false cleanup.make_local_variable_final=true cleanup.make_parameters_final=true cleanup.make_private_fields_final=true cleanup.make_type_abstract_if_missing_method=false cleanup.make_variable_declarations_final=true cleanup.never_use_blocks=false cleanup.never_use_parentheses_in_expressions=true cleanup.organize_imports=false cleanup.qualify_static_field_accesses_with_declaring_class=false cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true cleanup.qualify_static_member_accesses_with_declaring_class=true cleanup.qualify_static_method_accesses_with_declaring_class=false cleanup.remove_private_constructors=true cleanup.remove_trailing_whitespaces=false cleanup.remove_trailing_whitespaces_all=true cleanup.remove_trailing_whitespaces_ignore_empty=false cleanup.remove_unnecessary_casts=true cleanup.remove_unnecessary_nls_tags=true cleanup.remove_unused_imports=true cleanup.remove_unused_local_variables=false cleanup.remove_unused_private_fields=true cleanup.remove_unused_private_members=false cleanup.remove_unused_private_methods=true cleanup.remove_unused_private_types=true cleanup.sort_members=false cleanup.sort_members_all=false cleanup.use_blocks=false cleanup.use_blocks_only_for_return_and_throw=false cleanup.use_parentheses_in_expressions=true cleanup.use_this_for_non_static_field_access=false cleanup.use_this_for_non_static_field_access_only_if_necessary=true cleanup.use_this_for_non_static_method_access=false cleanup.use_this_for_non_static_method_access_only_if_necessary=true cleanup_profile=_BaseX cleanup_settings_version=2 eclipse.preferences.version=1 formatter_profile=_BaseX Formatter Profile formatter_settings_version=11 org.eclipse.jdt.ui.ignorelowercasenames=true org.eclipse.jdt.ui.importorder=java;javax;org;com; org.eclipse.jdt.ui.ondemandthreshold=1 org.eclipse.jdt.ui.staticondemandthreshold=1 basex-7.7.2/basex-api/.settings/org.eclipse.ltk.core.refactoring.prefs000066400000000000000000000002111222453003200257000ustar00rootroot00000000000000#Fri Mar 19 00:48:33 CET 2010 eclipse.preferences.version=1 org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false basex-7.7.2/basex-api/.settings/org.eclipse.m2e.core.prefs000066400000000000000000000001721222453003200232750ustar00rootroot00000000000000#Wed Aug 03 00:22:23 CEST 2011 activeProfiles= eclipse.preferences.version=1 resolveWorkspaceProjects=true version=1 basex-7.7.2/basex-api/.settings/org.maven.ide.eclipse.prefs000066400000000000000000000004171222453003200235330ustar00rootroot00000000000000#Fri Jan 29 18:36:39 CET 2010 activeProfiles= eclipse.preferences.version=1 fullBuildGoals=process-test-resources includeModules=false resolveWorkspaceProjects=true resourceFilterGoals=process-resources resources\:testResources skipCompilerPlugin=true version=1 basex-7.7.2/basex-api/basex-api.iml000066400000000000000000000075151222453003200170570ustar00rootroot00000000000000 basex-7.7.2/basex-api/etc/000077500000000000000000000000001222453003200152465ustar00rootroot00000000000000basex-7.7.2/basex-api/etc/basexhttp000077500000000000000000000014041222453003200171750ustar00rootroot00000000000000#!/usr/bin/env bash # Path to this script FILE="${BASH_SOURCE[0]}" while [ -h "$FILE" ] ; do SRC="$(readlink "$FILE")" FILE="$( cd -P "$(dirname "$FILE")" && \ cd -P "$(dirname "$SRC")" && pwd )/$(basename "$SRC")" done BX="$( cd -P "$(dirname "$FILE")/.." && pwd )" BXCORE="$( cd -P "$BX/../basex" && pwd )" # API, core, and library classes CP="$BX/target/classes$(printf ":%s" "$BX/BaseX.jar" "$BX/lib/"*.jar "$BXCORE/target/classes" "$BXCORE/lib/"*.jar)" # Options for virtual machine VM=-Xmx512m general_args=( ) vm_args=( ) while (( $# )) ; do if [[ $1 = "-X" ]] ; then vm_args+=( "$2" ) shift 2 else general_args+=( "$1" ) shift fi done # Run code java -cp "$CP" $VM "${vm_args[@]}" org.basex.BaseXHTTP "${general_args[@]}" basex-7.7.2/basex-api/etc/basexhttp.bat000066400000000000000000000006421222453003200177420ustar00rootroot00000000000000@echo off setLocal EnableDelayedExpansion REM Path to this script set PWD=%~dp0 REM Core and library classes set CP=%PWD%/../target/classes set LIB=%PWD%/../lib for /R "%LIB%" %%a in (*.jar) do set CP=!CP!;%%a set LIB=%PWD%/../../basex/lib for /R "%LIB%" %%a in (*.jar) do set CP=!CP!;%%a REM Options for virtual machine set VM=-Xmx512m REM Run code java -cp "%CP%;." %VM% org.basex.BaseXHTTP %* basex-7.7.2/basex-api/etc/basexhttpstop000077500000000000000000000014011222453003200201000ustar00rootroot00000000000000#!/usr/bin/env bash # Path to this script FILE="${BASH_SOURCE[0]}" while [ -h "$FILE" ] ; do SRC="$(readlink "$FILE")" FILE="$( cd -P "$(dirname "$FILE")" && \ cd -P "$(dirname "$SRC")" && pwd )/$(basename "$SRC")" done BX="$( cd -P "$(dirname "$FILE")/.." && pwd )" BXCORE="$( cd -P "$BX/../basex" && pwd )" # API, core, and library classes CP="$BX/target/classes$(printf ":%s" "$BX/BaseX.jar" "$BX/lib/"*.jar "$BXCORE/target/classes" "$BXCORE/lib/"*.jar)" # Options for virtual machine VM= general_args=( ) vm_args=( ) while (( $# )) ; do if [[ $1 = "-X" ]] ; then vm_args+=( "$2" ) shift 2 else general_args+=( "$1" ) shift fi done # Run code java -cp "$CP" $VM "${vm_args[@]}" org.basex.BaseXHTTP "${general_args[@]}" stop basex-7.7.2/basex-api/etc/basexhttpstop.bat000066400000000000000000000006411222453003200206470ustar00rootroot00000000000000@echo off setLocal EnableDelayedExpansion REM Path to this script set PWD=%~dp0 REM Core and library classes set CP=%PWD%/../target/classes set LIB=%PWD%/../lib for /R "%LIB%" %%a in (*.jar) do set CP=!CP!;%%a set LIB=%PWD%/../../basex/lib for /R "%LIB%" %%a in (*.jar) do set CP=!CP!;%%a REM Options for virtual machine set VM= REM Run code java -cp "%CP%;." %VM% org.basex.BaseXHTTP %* stop basex-7.7.2/basex-api/license.txt000066400000000000000000000031771222453003200166660ustar00rootroot00000000000000====================================================== BASEX LICENSE === Copyright (c) 2005-12 BaseX Team All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ======================================================================== basex-7.7.2/basex-api/pom.xml000066400000000000000000000073101222453003200160110ustar00rootroot00000000000000 4.0.0 basex-api org.basex basex-parent 7.7.2 .. BaseX API org.basex basex ${project.version} net.xqj basex-xqj org.xmldb xmldb-api org.eclipse.jetty jetty-server org.eclipse.jetty jetty-servlet org.eclipse.jetty jetty-webapp com.ettrema milton-api commons-fileupload commons-fileupload org.slf4j slf4j-nop junit junit com.vividsolutions jts ${project.artifactId}-${project.version} org.apache.maven.plugins maven-compiler-plugin false org.apache.maven.plugins maven-jar-plugin org.apache.maven.plugins maven-surefire-plugin org.apache.maven.plugins maven-source-plugin org.mortbay.jetty jetty-maven-plugin ${basedir}/src/main/webapp/WEB-INF/jetty.xml org.apache.maven.plugins maven-deploy-plugin org.apache.maven.plugins maven-dependency-plugin compile xstream basex-7.7.2/basex-api/src/000077500000000000000000000000001222453003200152625ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/000077500000000000000000000000001222453003200162065ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/as/000077500000000000000000000000001222453003200166115ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/as/Query.as000066400000000000000000000061611222453003200202470ustar00rootroot00000000000000/** * Language Binding for BaseX. * Works with BaseX 7.0 and later * * Documentation: http://docs.basex.org/wiki/Clients * * (C) Manfred Knobloch, BSD License * Institut für Wissensmedien IWM - Knowledge Media Research Center (KMRC) **/ package basexapi { import flash.utils.ByteArray; public class Query { public const NO_ID:int = 0; public const CLOSED:int = -1; public const PENDING_ID_REQUEST:int = 10; public const ID_RECEIVED:int = 20; public const PENDING_BIND_REQUEST:int = 30; public const BIND_RESPONSE:int = 40; public const EXECUTE_REQUEST:int = 50; protected var _session:Session; protected var _query:String; protected var _name:String; protected var _value:String; [Bindable] public var state:int=0; public var id:String = ""; protected var socketBuffer:ByteArray; public function Query(session:Session, query:String) { _session = session; _query = query; _name = ""; _value = ""; state = PENDING_ID_REQUEST; socketBuffer = new ByteArray(); socketBuffer.writeByte(0); socketBuffer.writeUTFBytes(_query); socketBuffer.writeByte(0); _session.sendBuffer(socketBuffer); } /** * detect bind indicator 'declare' in query * string **/ public function needBind():Boolean{ var _lowerq:String = _query.toLowerCase(); if ( _lowerq.indexOf('declare') > -1){ return true; } return false; } public function setBindParams(name:String, value:String):void{ _name = name; _value = value; } /** * send 2 \0 bytes at end, otherwise bind will fail for * the type parameter seems to be neccessary * ('\x03', '0\x00$name\x00number\x00\x00') **/ public function bind():void{ if (state > PENDING_ID_REQUEST){ state = PENDING_BIND_REQUEST; socketBuffer = new ByteArray(); socketBuffer.writeByte(3); socketBuffer.writeUTFBytes(id); socketBuffer.writeByte(0); socketBuffer.writeUTFBytes(_name); socketBuffer.writeByte(0); socketBuffer.writeUTFBytes(_value); socketBuffer.writeByte(0); // termination for value socketBuffer.writeByte(0); // termination for unused type socketBuffer.position = 0; _session.sendBuffer(socketBuffer); } } public function sendQuery(code:int, arg:String):void{ socketBuffer = new ByteArray(); socketBuffer.writeByte(code); socketBuffer.writeUTFBytes(this.id); socketBuffer.writeByte(0); _session.sendBuffer(socketBuffer); } public function execute():void{ sendQuery(0x05, id); } public function info():void{ exc(6, id); } public function options():void{ exc(7, id); } public function close():void{ exc(2, id); } public function exc(cmd:int, arg:String):void{ sendQuery(cmd, arg); } } }basex-7.7.2/basex-api/src/main/as/Session.as000066400000000000000000000140221222453003200205600ustar00rootroot00000000000000/** * Language Binding for BaseX. * Works with BaseX 7.0 and later * * Documentation: http://docs.basex.org/wiki/Clients * * (C) Manfred Knobloch, BSD License * Institut für Wissensmedien IWM - Knowledge Media Research Center (KMRC) **/ package basexapi { import com.adobe.crypto.MD5; import flash.errors.*; import flash.events.*; import flash.net.Socket; import flash.system.Security; import flash.utils.ByteArray; public class Session extends Object { public static const DISCONNECTED:int = 0; public static const CONNECTING:int = 1; public static const CONNECTED:int = 2; public static const AUTHENTICATING:int = 3; public static const AUTHENTICATED:int = 4; public static const OPERATING:int = 5; public static const RESULT:int = 6; [Bindable] public var response:String= ""; [Bindable] protected var _socket:Socket; [Bindable] public var state:int = DISCONNECTED; protected var _result:ByteArray; protected var user:String; protected var password:String; protected var _query:Query; public var socketBuffer:ByteArray; public function Session(h:String=null, p:uint=0, u:String=null, pass:String=null) { user = u; password = pass; _socket = new Socket(); _socket.addEventListener(Event.CLOSE, closeHandler); _socket.addEventListener(Event.CONNECT, connectHandler); _socket.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); _socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); _socket.addEventListener(ProgressEvent.SOCKET_DATA, socketDataHandler); state = CONNECTING; _socket.connect(h,p); socketBuffer = new ByteArray(); } public function execute(arg:String):void{ socketBuffer = new ByteArray(); socketBuffer.writeUTFBytes(arg); socketBuffer.writeByte(0); sendBuffer(socketBuffer); } public function close():void{ _socket.close(); } public function query(q:String):Query{ _query = new Query(this, q); return _query; } public function sendCommand(code:int, arg:String, input:String):void{ socketBuffer = new ByteArray(); socketBuffer.writeByte(code); socketBuffer.writeUTFBytes(arg); socketBuffer.writeByte(0); socketBuffer.writeUTFBytes(input); socketBuffer.writeByte(0); sendBuffer(socketBuffer); } public function sendBuffer(b:ByteArray):void{ response = ""; _socket.writeBytes(b); _socket.flush(); } protected function sendInput(code:int, arg:String):void{ var breakat:int = arg.indexOf(" "); if (breakat == -1){ return; } var arg1:String = arg.substr(0,breakat); var arg2:String = arg.substring(breakat); sendCommand(code,arg1,arg2); } public function create(input:String):void{ sendInput(8,input); } public function add(input:String):void{ sendInput(9, input); } public function replace(input:String):void{ sendInput(12, input); } public function store(input:String):void{ sendInput(13,input); } public function authenticate():void{ var md5pw:String = MD5.hash(password); var md5resp:String = MD5.hash(md5pw + response); socketBuffer = new ByteArray(); socketBuffer.writeUTFBytes(user); socketBuffer.writeByte(0); socketBuffer.writeUTFBytes(md5resp); socketBuffer.writeByte(0); response = ""; _socket.writeBytes(socketBuffer); _socket.flush(); state = AUTHENTICATING; } public function readIntoByteBuffer(buf:ByteArray):void{ _socket.readBytes(buf,0,_socket.bytesAvailable); } public function readstrings():String{ _result = new ByteArray(); var last:int = 0; var current:int = 0; var foundStrings:Vector. = new Vector.; _socket.readBytes(_result,0,_socket.bytesAvailable); //read to letter 0 or end of bytes while (_result.bytesAvailable > 0 ) { if(_result.readByte() == 0){ current = _result.position; if (current > last){ _result.position = last; foundStrings.push(_result.readUTFBytes(current-last)); last = current; } } } return foundStrings.join(""); } // wrapper for public public function readUTFBytes():String{ return _socket.readUTFBytes(_socket.bytesAvailable); } private function socketDataHandler(event:ProgressEvent):void { if (state == AUTHENTICATING){ if( _socket.readByte() == 0){ state = AUTHENTICATED; return; } } response = readstrings(); if(_query && (_query.state == _query.PENDING_ID_REQUEST)){ _query.id = response; _query.state = _query.ID_RECEIVED; if (!_query.needBind()){ _query.execute(); return; } _query.bind(); return; } if(_query && (_query.state == _query.PENDING_BIND_REQUEST)){ _query.state = _query.BIND_RESPONSE _query.execute(); return; } if (state < AUTHENTICATING){ authenticate(); state = AUTHENTICATING } } // some string representations public function get stateinfo():String{ var info:String = ""; switch (state) { case DISCONNECTED: info = "DISCONNECTED"; break; case CONNECTING: info = "CONNECTING"; break; case CONNECTED: info = "CONNECTED"; break; case AUTHENTICATING: info = "AUTHENTICATING"; break; case AUTHENTICATED: info = "AUTHENTICATED"; break; case OPERATING: info = "OPERATING"; break; } return info; } // handler functions private function closeHandler(event:Event):void { trace("closeHandler: " + event); } private function connectHandler(event:Event):void { state = CONNECTED; } private function ioErrorHandler(event:IOErrorEvent):void { trace("ioErrorHandler: " + event); } private function securityErrorHandler(event:SecurityErrorEvent):void { trace("securityErrorHandler: " + event); } } }basex-7.7.2/basex-api/src/main/c#/000077500000000000000000000000001222453003200164735ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/c#/AddExample.cs000066400000000000000000000027511222453003200210330ustar00rootroot00000000000000/* * This example shows how new documents can be added. * * Documentation: http://docs.basex.org/wiki/Clients * * (C) BaseX Team 2005-12, BSD License */ using System; using System.Diagnostics; using System.IO; namespace BaseXClient { public class AddExample { public static void Main(string[] args) { try { // create session Session session = new Session("localhost", 1984, "admin", "admin"); // create empty database session.Execute("create db database"); Console.WriteLine(session.Info); // define InputStream MemoryStream ms = new MemoryStream( System.Text.Encoding.UTF8.GetBytes("Hello World!")); // add document session.Add("world/world.xml", ms); Console.WriteLine(session.Info); // define InputStream ms = new MemoryStream( System.Text.Encoding.UTF8.GetBytes("Hello Universe!")); // add document session.Add("Universe.xml", ms); Console.WriteLine(session.Info); // run query on database Console.WriteLine(session.Execute("xquery /")); // drop database session.Execute("drop db database"); // close session session.Close(); } catch (IOException e) { // print exception Console.WriteLine(e.Message); } } } } basex-7.7.2/basex-api/src/main/c#/BaseXClient.cs000066400000000000000000000166111222453003200211700ustar00rootroot00000000000000/* * Language Binding for BaseX. * Works with BaseX 7.0 and later * * Documentation: http://docs.basex.org/wiki/Clients * * (C) BaseX Team 2005-12, BSD License */ using System; using System.Net.Sockets; using System.Security.Cryptography; using System.Text; using System.IO; using System.Threading; using System.Collections; using System.Collections.Generic; namespace BaseXClient { class Session { private byte[] cache = new byte[4096]; public NetworkStream stream; private TcpClient socket; private string info = ""; private string ehost; private int bpos; private int bsize; private TcpClient esocket; private NetworkStream estream; private Dictionary en; public Session(string host, int port, string username, string pw) { socket = new TcpClient(host, port); stream = socket.GetStream(); ehost = host; string ts = Receive(); Send(username); Send(MD5(MD5(pw) + ts)); if (stream.ReadByte() != 0) { throw new IOException("Access denied."); } } public void Execute(string com, Stream ms) { Send(com); Init(); Receive(ms); info = Receive(); if(!Ok()) { throw new IOException(info); } } public String Execute(string com) { MemoryStream ms = new MemoryStream(); Execute(com, ms); return System.Text.Encoding.UTF8.GetString(ms.ToArray()); } public Query Query(string q) { return new Query(this, q); } public void Create(string name, Stream s) { stream.WriteByte(8); Send(name); Send(s); } public void Add(string path, Stream s) { stream.WriteByte(9); Send(path); Send(s); } public void Replace(string path, Stream s) { stream.WriteByte(12); Send(path); Send(s); } public void Store(string path, Stream s) { stream.WriteByte(13); Send(path); Send(s); } /* Watches an event. */ public void Watch(string name, EventNotification notify) { stream.WriteByte(10); if(esocket == null) { int eport = Convert.ToInt32(Receive()); en = new Dictionary(); esocket = new TcpClient(ehost, eport); estream = esocket.GetStream(); string id = Receive(); byte[] msg = System.Text.Encoding.UTF8.GetBytes(id); estream.Write(msg, 0, msg.Length); estream.WriteByte(0); estream.ReadByte(); new Thread(Listen).Start(); } Send(name); info = Receive(); if(!Ok()) { throw new IOException(info); } en.Add(name, notify); } private void Listen() { while (true) { String name = readS(); String val = readS(); en[name].Update(val); } } private string readS() { MemoryStream ms = new MemoryStream(); while (true) { int b = estream.ReadByte(); if (b == 0) break; ms.WriteByte((byte) b); } return System.Text.Encoding.UTF8.GetString(ms.ToArray()); } /* Unwatches an event. */ public void Unwatch(string name) { stream.WriteByte(11); Send(name); info = Receive(); if(!Ok()) { throw new IOException(info); } en.Remove(name); } public string Info { get { return info; } } public void Close() { Send("exit"); if (esocket != null) { esocket.Close(); } socket.Close(); } private void Init() { bpos = 0; bsize = 0; } public byte Read() { if (bpos == bsize) { bsize = stream.Read(cache, 0, 4096); bpos = 0; } return cache[bpos++]; } private void Receive(Stream ms) { while (true) { byte b = Read(); if (b == 0) break; ms.WriteByte(b); } } public string Receive() { MemoryStream ms = new MemoryStream(); Receive(ms); return System.Text.Encoding.UTF8.GetString(ms.ToArray()); } public void Send(string message) { byte[] msg = System.Text.Encoding.UTF8.GetBytes(message); stream.Write(msg, 0, msg.Length); stream.WriteByte(0); } private void Send(Stream s) { while (true) { int t = s.ReadByte(); if (t == -1) break; if (t == 0x00 || t == 0xFF) stream.WriteByte(Convert.ToByte(0xFF)); stream.WriteByte(Convert.ToByte(t)); } stream.WriteByte(0); info = Receive(); if(!Ok()) { throw new IOException(info); } } public bool Ok() { return Read() == 0; } private string MD5(string input) { MD5CryptoServiceProvider MD5 = new MD5CryptoServiceProvider(); byte[] hash = MD5.ComputeHash(Encoding.UTF8.GetBytes(input)); StringBuilder sb = new StringBuilder(); foreach (byte h in hash) { sb.Append(h.ToString("x2")); } return sb.ToString(); } } class Query { private Session session; private string id; private ArrayList cache; private int pos; public Query(Session s, string query) { session = s; id = Exec(0, query); } public void Bind(string name, string value) { Bind(name, value, ""); } public void Bind(string name, string value, string type) { cache = null; Exec(3, id + '\0' + name + '\0' + value + '\0' + type); } public void Context(string value) { Context(value, ""); } public void Context(string value, string type) { cache = null; Exec(14, id + '\0' + value + '\0' + type); } public bool More() { if(cache == null) { session.stream.WriteByte(4); session.Send(id); cache = new ArrayList(); while (session.Read() > 0) { cache.Add(session.Receive()); } if(!session.Ok()) { throw new IOException(session.Receive()); } pos = 0; } if(pos < cache.Count) return true; cache = null; return false; } public string Next() { if(More()) { return cache[pos++] as string; } else { return null; } } public string Execute() { return Exec(5, id); } public string Info() { return Exec(6, id); } public string Options() { return Exec(7, id); } public void Close() { Exec(2, id); } private string Exec(byte cmd, string arg) { session.stream.WriteByte(cmd); session.Send(arg); string s = session.Receive(); bool ok = session.Ok(); if(!ok) { throw new IOException(session.Receive()); } return s; } } interface EventNotification { void Update(string data); } }basex-7.7.2/basex-api/src/main/c#/CreateExample.cs000066400000000000000000000021131222453003200215360ustar00rootroot00000000000000/* * This example shows how new databases can be created. * * Documentation: http://docs.basex.org/wiki/Clients * * (C) BaseX Team 2005-12, BSD License */ using System; using System.Diagnostics; using System.IO; namespace BaseXClient { public class CreateExample { public static void Main(string[] args) { try { // create session Session session = new Session("localhost", 1984, "admin", "admin"); // define InputStream MemoryStream ms = new MemoryStream( System.Text.Encoding.UTF8.GetBytes("Hello World!")); // create database session.Create("database", ms); Console.WriteLine(session.Info); // run query on database Console.WriteLine(session.Execute("xquery /")); // drop database session.Execute("drop db database"); // close session session.Close(); } catch (IOException e) { // print exception Console.WriteLine(e.Message); } } } } basex-7.7.2/basex-api/src/main/c#/EventExample.cs000066400000000000000000000024051222453003200214200ustar00rootroot00000000000000/* * This example shows how to use the event feature. * * Documentation: http://docs.basex.org/wiki/Clients * * (C) BaseX Team 2005-12, BSD License */ using System; using System.Diagnostics; using System.IO; namespace BaseXClient { public class EventExample { public static void Main(string[] args) { try { // create session Session session1 = new Session("localhost", 1984, "admin", "admin"); Session session2 = new Session("localhost", 1984, "admin", "admin"); session1.Execute("create event messenger"); session2.Watch("messenger", new Notification()); session2.Query("for $i in 1 to 1000000 where $i = 0 return $i").Execute(); session1.Query("db:event('messenger', 'Hello World!')").Execute(); session2.Unwatch("messenger"); session1.Execute("drop event messenger"); // close session session1.Close(); session2.Close(); } catch (IOException e) { // print exception Console.WriteLine(e.Message); } } } class Notification : EventNotification { public void Update (string data) { Console.WriteLine("Message received: " + data); } } }basex-7.7.2/basex-api/src/main/c#/Example.cs000066400000000000000000000022441222453003200204170ustar00rootroot00000000000000/* * This example shows how database commands can be executed. * * Documentation: http://docs.basex.org/wiki/Clients * * (C) BaseX Team 2005-12, BSD License */ using System; using System.Diagnostics; using System.IO; namespace BaseXClient { public class Example { public static void Main(string[] args) { try { // initialize timer Stopwatch watch = new Stopwatch(); watch.Start(); // create session Session session = new Session("localhost", 1984, "admin", "admin"); // version 1: perform command and print returned string Console.WriteLine(session.Execute("info")); // version 2 (faster): perform command and pass on result to output stream Stream stream = Console.OpenStandardOutput(); session.Execute("xquery 1 to 10", stream); // close session session.Close(); // print time needed Console.WriteLine("\n" + watch.ElapsedMilliseconds + " ms."); } catch (IOException e) { // print exception Console.WriteLine(e.Message); } } } } basex-7.7.2/basex-api/src/main/c#/QueryBindExample.cs000066400000000000000000000023651222453003200222460ustar00rootroot00000000000000/* * This example shows how external variables can be bound to XQuery expressions. * * Documentation: http://docs.basex.org/wiki/Clients * * (C) BaseX Team 2005-12, BSD License */ using System; using System.Diagnostics; using System.IO; namespace BaseXClient { public class QueryIteratorExample { public static void Main(string[] args) { try { // create session Session session = new Session("localhost", 1984, "admin", "admin"); try { // create query instance string input = "declare variable $name external;" + "for $i in 1 to 10 return element { $name } { $i }"; Query query = session.Query(input); // bind variable query.Bind("$name", "number"); // print result Console.WriteLine(query.Execute()); // close query query.Close(); } catch (IOException e) { // print exception Console.WriteLine(e.Message); } // close session session.Close(); } catch (IOException e) { // print exception Console.WriteLine(e.Message); } } } } basex-7.7.2/basex-api/src/main/c#/QueryExample.cs000066400000000000000000000024071222453003200214460ustar00rootroot00000000000000/* * This example shows how queries can be executed in an iterative manner. * Iterative evaluation will be slower, as more server requests are performed. * * Documentation: http://docs.basex.org/wiki/Clients * * (C) BaseX Team 2005-12, BSD License */ using System; using System.Diagnostics; using System.IO; namespace BaseXClient { public class QueryIteratorExample { public static void Main(string[] args) { try { // create session Session session = new Session("localhost", 1984, "admin", "admin"); try { // create query instance string input = "for $i in 1 to 10 return Text { $i }"; Query query = session.Query(input); // loop through all results while (query.More()) { Console.WriteLine(query.Next()); } // close query query.Close(); } catch (IOException e) { // print exception Console.WriteLine(e.Message); } // close session session.Close(); } catch (IOException e) { // print exception Console.WriteLine(e.Message); } } } } basex-7.7.2/basex-api/src/main/c/000077500000000000000000000000001222453003200164305ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/c/GNUmakefile000066400000000000000000000023221222453003200205010ustar00rootroot00000000000000.PHONY: all lib clean clean-depend clean-all include config.mk LIBNAME= basexdbc DBCLIB= lib$(LIBNAME).$(LIBSFX) VERSION= 0.1 FDEBUG= CC?= cc CFLAGS+= -DBUILD="\"$(VERSION)\"" -fPIC LDFLAGS+= -fPIC LIBS+= ifdef FDEBUG CFLAGS+= -g -ggdb -DDEBUG CFLAGS+= -Wno-long-long -Wall -W -Wnested-externs -Wformat=2 CFLAGS+= -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations CFLAGS+= -Wwrite-strings -Wshadow -Wpointer-arith -Wsign-compare CFLAGS+= -Wundef -Wbad-function-cast -Winline -Wcast-align endif SRCS= $(shell echo *.c) OBJS= $(patsubst %.c,%.o,$(SRCS)) all: lib example lib: $(DBCLIB) example: $(CC) -L. -l$(LIBNAME) example.c -o $@ $(DBCLIB): md5.o basexdbc.o readstring.o $(CC) $(LIBS) $(LDFLAGS) -shared -o $@ $+ depend: $(SRCS) $(CC) $(CFLAGS) -MM $(SRCS) >depend install: lib install -d -m555 /usr/lib/basex install -d -m555 /usr/include/basex install -m555 $(DBCLIB) /usr/lib/basex/ install -m444 basexdbc.h /usr/include/basex/ uninstall: rm -rf /usr/lib/basex/ rm -rf /usr/include/basex/ clean: rm -f $(DBCLIB) rm -f ${OBJS} rm -f example clean-config: rm -f config.mk clean-depend: rm -f depend clean-all: clean clean-config clean-depend uninstall include depend basex-7.7.2/basex-api/src/main/c/README000066400000000000000000000013611222453003200173110ustar00rootroot00000000000000BASEX DATABASE CLIENT FOR C ==================================================== Connect to running BaseX database server (basex.org) from C code. Compile dependencies: openssl debian: apt-get install libssl-dev Build (tested on Debian GNU/Linux unstable only): $ make [all|lib|example] # make install Inspect and test example: $ less example.c $ ./example (or, if lib is not installed, $ LD_LIBRARY_PATH=. ./example) Cleanup: $ make clean # make clean-all (removes 'make install'ed files as well) License: Copyright (c) 2005-12, Alexander Holupirek , BSD license Bug reports: https://github.com/holu/basexdbc/issues Have fun. Alex ================================================================================ basex-7.7.2/basex-api/src/main/c/basexdbc.c000066400000000000000000000226571222453003200203630ustar00rootroot00000000000000/** * basexdbc.c : communicate with BaseX database server * * Copyright (c) 2005-12, Alexander Holupirek , BSD license */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "basexdbc.h" #include "md5.h" #include "readstring.h" static int send_db(int sfd, const char *buf, size_t buf_len); static int basex_status(int sfd); /** * Connect to host on port using stream sockets. * * @param host string representing host to connect to * @param port string representing port on host to connect to * @return socket file descriptor or -1 in case of failure */ int basex_connect(const char *host, const char *port) { struct addrinfo hints; struct addrinfo *result = NULL, *rp; int sfd, rc; if (host == NULL || port == NULL) { #if DEBUG warnx("Missing hostname '%s' / port '%s'.", host, port); #endif return -1; } /* Obtain address(es) matching host/port */ memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = AF_UNSPEC; /* Allows IPv4 or IPv6 */ hints.ai_socktype = SOCK_STREAM; /* TCP socket */ hints.ai_flags = AI_NUMERICSERV; rc = getaddrinfo(host, port, &hints, &result); if (rc != 0) { #if DEBUG warnx("getaddrinfo: %s", gai_strerror(rc)); #endif return -1; } /* getaddrinfo() returns a list of address structures. * Try each address until we successfully connect(2). * If socket(2) (or connect(2)) fails, we (close the * socket and) try the next address. */ for (rp = result; rp != NULL; rp = rp->ai_next) { sfd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); if (sfd == -1) continue; /* On error, try next address */ if (connect(sfd, rp->ai_addr, rp->ai_addrlen) != -1) break; /* Success */ close(sfd); /* Connect failed: close socket, try next address */ } if (rp == NULL) { /* No address succeeded */ warnx("Can not connect to BaseX server."); warnx("Hostname '%s', port %s.", host, port); return -1; } freeaddrinfo(result); /* No longer needed */ return sfd; /* This file descriptor is ready for I/O. */ } /** * Authenticate against BaseX server connected on sfd using user and passwd. * * Authentication as defined by BaseX transfer protocol (BaseX 7.0 ff.): * https://github.com/BaseXdb/basex-api/blob/master/etc/readme.txt * {...} = string; \n = single byte * * 1. Client connects to server socket (basex_connect) * 2. Server sends timestamp: {timestamp} \0 * 3. Client sends username and hash: * {username} \0 {md5(md5(password) + timestamp)} \0 * 4. Server sends \0 (success) or \1 (error) * * @param sfd socket file descriptor successfully connected to BaseX server * @param user string with database username * @param passwd string with password for database username * @return 0 in case of success, -1 in case of failure */ int basex_authenticate(int sfd, const char *user, const char *passwd) { char ts[BUFSIZ]; /* timestamp returned by basex. */ char *md5_pwd; /* md5'ed passwd */ int ts_len, rc, i; /* Right after the first connect BaseX returns a nul-terminated * timestamp string. */ memset(ts, 0, BUFSIZ); rc = read(sfd, &ts, BUFSIZ); if (rc == -1) { warnx("Reading timestamp failed."); return -1; } ts_len = strlen(ts); #if DEBUG warnx("timestamp : %s (%d)", ts, strlen(ts)); #endif /* BaseX Server expects an authentification sequence: * {username}\0{md5(md5(password) + timestamp)}\0 */ /* Send {username}\0 */ int user_len = strlen(user) + 1; rc = write(sfd, user, user_len); if (rc == -1 || rc != user_len) { warnx("Sending username failed. %d != %d", rc, user_len); return -1; } /* Compute md5 for passwd. */ md5_pwd = md5(passwd); if (md5_pwd == NULL) { warnx("md5 computation for password failed."); return -1; } int md5_pwd_len = strlen(md5_pwd); #if DEBUG warnx("md5(pwd) : %s (%d)", md5_pwd, md5_pwd_len); #endif /* Concat md5'ed passwd string and timestamp string. */ int pwdts_len = md5_pwd_len + ts_len + 1; char pwdts[pwdts_len]; memset(pwdts, 0, sizeof(pwdts)); for (i = 0; i < md5_pwd_len; i++) pwdts[i] = md5_pwd[i]; int j = md5_pwd_len; for (i = 0; i < ts_len; i++,j++) pwdts[j] = ts[i]; pwdts[pwdts_len - 1] = '\0'; #if DEBUG warnx("md5(pwd)+ts : %s (%d)", pwdts, strlen(pwdts)); #endif /* Compute md5 for md5'ed password + timestamp */ char *md5_pwdts = md5(pwdts); if (md5_pwdts == NULL) { warnx("md5 computation for password + timestamp failed."); return -1; } int md5_pwdts_len = strlen(md5_pwdts); #if DEBUG warnx("md5(md5(pwd)+ts): %s (%d)", md5_pwdts, md5_pwdts_len); #endif /* Send md5'ed(md5'ed password + timestamp) to basex. */ rc = send_db(sfd, md5_pwdts, md5_pwdts_len + 1); // also send '\0' if (rc == -1) { warnx("Sending credentials failed."); return -1; } free(md5_pwd); free(md5_pwdts); /* Retrieve authentification status. */ rc = basex_status(sfd); if (rc == -1) { warnx("Reading authentification status failed."); return -1; } if (rc != 0) { warnx("Authentification failed"); return -1; } #if DEBUG warnx("Authentification succeded."); #endif return 0; } /** * Read status single byte from socket. */ int basex_status(int sfd) { char c; int b = read(sfd, &c, 1); if (b == -1) { warnx("Can not retrieve status code."); return -1; } return c; } /** * Executes a command and returns a result string and an info/error string. * * A database command is sent to BaseX server connected on sfd. * The result is a \0 terminated, dynamically allocated string, which is placed * at the given result address or NULL. The same holds for the processing * information stored at info. * * In either case it is the responsibility of the caller to free(3) those * strings. * * The returned int is 0 if the command could be processed successfully, in that * case the result contains the result string of the command and info holds * the processing information. * If a value >0 is returned, the command could not be processed successfully, * result contains NULL and info contains the database error message. * If -1 is interned, an error occurred, result and info are set to NULL. * * int | result* | info* | * -----+---------+-------| * -1 | NULL | NULL | * 0 | result | info | * >0 | NULL | error | * * * strings shall be free(3)'ed by caller * * BaseX C/S protocol: * * client sends: {command} \0 * server sends: {result} \0 {info} \0 \0 * or \0 {error} \0 \1 * * @param sfd socket file descriptor connected to BaseX server * @param command to be processed by BaseX server * @param result address at which result from BaseX server is placed * @param info address at which info/error message from BaseX server is placed * @return int 0 for success (result and info contain strings sent from BaseX) * -1 in case of failure (result and info are set to NULL), >0 an error occurred * while processing the command (result contains NULL, info contains error * message) */ int basex_execute(int sfd, const char *command, char **result, char **info) { int rc; /* Send {command}\0 to server. */ rc = send_db(sfd, command, strlen(command) + 1); if (rc == -1) { warnx("Can not send command '%s' to server.", command); goto err; } /* --- Receive from server: {result} \0 {info} \0 \0 * \0 {error} \0 \1 */ /* Receive {result} \0 */ rc = readstring(sfd, result); if (rc == -1) { warnx("Can not retrieve result for command '%s' from server.", command); goto err; } #if DEBUG warnx("[execute] result: '%s'\n", *result); #endif /* Receive {info/error} \0 .*/ rc = readstring(sfd, info); if (rc == -1) { warnx("Can not retrieve info for command '%s' from server.", *info); goto err; } #if DEBUG warnx("[execute] info/error: '%s'\n", *info); #endif /* Receive terminating \0 for success or \1 for error .*/ rc = basex_status(sfd); #if DEBUG warnx("[execute] status: '%d'\n", rc); #endif if (rc == -1) { warnx("Can not retrieve status."); goto err; } if (rc == 1) { warnx("BaseX error message : %s", *info); free(*result); *result = NULL; } assert(rc == 0 || rc == 1); return rc; err: *result = NULL; *info = NULL; return -1; } /** * Quits database session and closes stream connection to database server. * * @param socket file descriptor for database session. */ void basex_close(int sfd) { /* Send {exit}\0 to server. */ int rc = send_db(sfd, "exit", 4 + 1); if (rc != 0) warnx("Can not send 'exit' command to server."); /* Close socket. */ rc = shutdown(sfd, SHUT_RDWR); if (rc == -1) warn("Can not properly shutdown socket."); } /** * Writes buffer buf of buf_len to socket sfd. * * @param socket file descriptor for database session. * @param buf to be sent to server * @param buf_len # of bytes in buf * @return 0 if all data has successfully been written to server, * -1 in case of failure. */ static int send_db(int sfd, const char *buf, size_t buf_len) { ssize_t ret; while (buf_len != 0 && (ret = write(sfd, buf, buf_len)) != 0) { if (ret == -1) { if (errno == EINTR) continue; warn("Can not write to server"); return -1; } #if DEBUG int i; warnx("write: \n"); for (i = 0; i < ret; i++) warnx("[write] %3d : 0x%08x %4d %c", i, buf[i], buf[i], buf[i]); #endif /* DEBUG */ buf_len -= ret; buf += ret; } return 0; } basex-7.7.2/basex-api/src/main/c/basexdbc.h000066400000000000000000000017571222453003200203660ustar00rootroot00000000000000/** * basexdbc.h : communicate with BaseX database server * * Copyright (c) 2005-12, Alexander Holupirek , BSD license */ /* Connect to BaseX server and open session. Returns socket file descriptor. */ int basex_connect(const char *host, const char *port); /* Authenticate for this session (passing socket desc, db user, and passwd). */ int basex_authenticate(int sfd, const char *user, const char *passwd); /* Send database command to server. * Expect result and info to be filled (must be free(3)'ed afterwards). * * int | result | info | * -----+--------+-------| * -1 | NULL | NULL | general error (i/o and the like) * 0 | result | info | database command has been processed successfully * >0 | NULL | error | database command processing failed * * BaseX commands: http://docs.basex.org/wiki/Commands */ int basex_execute(int sfd, const char *command, char **result, char **info); /* Close session with descriptor sfd. */ void basex_close(int sfd); basex-7.7.2/basex-api/src/main/c/changelog000066400000000000000000000001561222453003200203040ustar00rootroot00000000000000basexdbc (0.1) * Initial release. -- Alexander Holupirek Sat May 14 16:59:07 CEST 2011 basex-7.7.2/basex-api/src/main/c/config.h000066400000000000000000000000151222453003200200420ustar00rootroot00000000000000/* Darwin */ basex-7.7.2/basex-api/src/main/c/configure000066400000000000000000000030351222453003200203350ustar00rootroot00000000000000#!/bin/sh # # Copyright (c) 2011 Alexander Holupirek # Copyright (c) 2009 Nicholas Marriott # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER # IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # DBC_PLATFORM=${DBC_PLATFORM:-`uname -s`} CONFIG_H=config.h rm -f $CONFIG_H echo "/* $DBC_PLATFORM */" >$CONFIG_H CONFIG_MK=config.mk rm -f $CONFIG_MK echo "# $DBC_PLATFORM" >$CONFIG_MK case $DBC_PLATFORM in # ------------------------------------------------------------------------------ Linux) cat <>$CONFIG_MK LIBSFX=so LIBS+= -lssl EOF ;; # ------------------------------------------------------------------------------ Darwin) cat <>$CONFIG_MK LIBSFX=dylib LIBS+= -lcrypto EOF ;; # ------------------------------------------------------------------------------ *) echo Unable to configure for $DBC_PLATFORM exit 1 esac echo Configured for $DBC_PLATFORM exit 0 basex-7.7.2/basex-api/src/main/c/example.c000066400000000000000000000031051222453003200202260ustar00rootroot00000000000000/* Copyright (c) 2005-12, Alexander Holupirek , BSD license */ #include #include #include #include #include "basexdbc.h" /* once libbasexdbc.so is installed in /usr/include/basex/ use: #include "basex/basexdbc.h" */ #define DBHOST "localhost" #define DBPORT "1984" #define DBUSER "admin" #define DBPASSWD "admin" /* * Example to demonstrate communication with running BaseX database server. * * $ cc -L. -lbasexdbc example.c -o example */ int main(void) { int sfd, rc; /* Connect to server and receive socket descriptor for this session. */ sfd = basex_connect(DBHOST, DBPORT); if (sfd == -1) { warnx("Can not connect to BaseX server."); return 0; } /* We are connected, let's authenticate for this session. */ rc = basex_authenticate(sfd, DBUSER, DBPASSWD); if (rc == -1) { warnx("Access to DB denied."); goto out; } /* Send command in default mode and receive the result string. */ const char *command = "xquery 1 + 1"; char *result; char *info; rc = basex_execute(sfd, command, &result, &info); if (rc == -1) { // general (i/o or the like) error warnx("An error occured during execution of '%s'.", command); goto free_and_out; } if (rc == 1) { // database error while processing command warnx("Processing of '%s' failed.", command); } /* print command, result and info/error */ printf("command: '%s'\n", command); printf("result : '%s'\n", result); printf("%s : '%s'\n", (rc == 1) ? "error" : "info", info); free_and_out: free(result); free(info); out: basex_close(sfd); return 0; } basex-7.7.2/basex-api/src/main/c/md5.c000066400000000000000000000040631222453003200172640ustar00rootroot00000000000000/* Copyright (c) 2005-12, Alexander Holupirek , BSD license */ #include #include #include #include #include "md5.h" /** * Print ascii hex representation of md5 value to newly allocated string. */ static int md5toa(unsigned char *md_value, unsigned int md_len, char **md5_string) { unsigned int i, j; int rc; int hex_len = 3; // hex length to be printed xx\0 unsigned int length = 32; // length of md5 ascii hex representation *md5_string = calloc(length + 1, sizeof(char)); if (*md5_string == NULL) { warnx("Can not allocate memory for md5 ascii hex string."); return -1; } for (i = 0, j = 0; i < md_len && j < length; i++, j += 2) { rc = snprintf((*md5_string) + j, hex_len, "%02x", md_value[i]); if (!(rc > -1 && rc < hex_len)) { warnx("Construction of md5 ascii hex string failed."); return -1; } } (*md5_string)[length] = '\0'; // is already \0, but we are defensive return 0; } /** * Consult EVP_DigestInit(3SSL) for details. */ static char * md5_digest(int n, ...) { EVP_MD_CTX mdctx; const EVP_MD *md; unsigned char md_value[EVP_MAX_MD_SIZE]; unsigned int md_len = 0; int i, rc; char *string; char *md5_result = NULL; OpenSSL_add_all_digests(); md = EVP_md5(); if(!md) err(1, "Unknown message digest"); EVP_MD_CTX_init(&mdctx); EVP_DigestInit_ex(&mdctx, md, NULL); va_list argPtr; va_start(argPtr, n); for (i = 0; i < n; i++) { string = va_arg(argPtr, char *); EVP_DigestUpdate(&mdctx, string, strlen(string)); } va_end(argPtr); EVP_DigestFinal_ex(&mdctx, md_value, &md_len); EVP_MD_CTX_cleanup(&mdctx); EVP_cleanup(); rc = md5toa(md_value, md_len, &md5_result); if (rc == -1) err(1, "md5 digest failure."); return md5_result; } /** * Compute 128bit MD5 digest for string. * * @param string from which digest shall be computed * @return Allocated C string containing the hex result representation is * returned. It should be passed to free(3). On failure NULL is returned. */ char * md5(const char *string) { return md5_digest(1, string); } basex-7.7.2/basex-api/src/main/c/md5.h000066400000000000000000000005571222453003200172750ustar00rootroot00000000000000/* Copyright (c) 2005-12, Alexander Holupirek , BSD license */ /** * Compute 128bit MD5 digest for string. * * @param string from which digest shall be computed * @return Allocated C string containing the hex result representation is * returned. It should be passed to free(3). On failure NULL is returned. */ char *md5(const char *string); basex-7.7.2/basex-api/src/main/c/readstring.c000066400000000000000000000042621222453003200207420ustar00rootroot00000000000000/* Copyright (c) 2005-12, Alexander Holupirek , BSD license */ #include #include #include #include #include #include #include #include #include "readstring.h" static size_t READSTRING_MAX = 1024 * 1024 * 10; // 10MB /** * Reads string from file descriptor into dynamically allocated string. * * A variable length of characters is read from fd until a \0 byte * is detected or a predefined maximum READSTRING_MAX is reached. * The read bytes are stored into a dynamically allocated buffer str. * It is the responsibility of the caller to free(3) str. * * @param fd file descriptor to read from * @param str address of the newly allocated c string * @return number of characters read or -1 in case of failure * in case of an error str is set to NULL */ ssize_t readstring(int fd, char **str) { char b; int rb; // # of read byte (-1, 0, or 1) size_t chars = 0; // # of stored chars in str size_t size = 32; // start capacity of alloc'ed string // allocate default capacity *str = calloc(size, sizeof(char)); if (str == NULL) { warn("malloc failed."); return -1; } // read until \0 is detected or predefined maximum is reached while(1) { if (!(chars < size - 1)) { // reallocate if (size && 2 > SIZE_MAX / size) { errno = ENOMEM; warn("overflow"); goto err; } size_t newsize = size * 2; if (newsize < READSTRING_MAX) { char *newstr; if ((newstr = realloc(*str, newsize)) == NULL) { warn("reallocation failed."); goto err; } *str = newstr; size = newsize; } else { errno = ENOBUFS; warn("variable string exceeds maximum of %d" , READSTRING_MAX); goto err; } } rb = read(fd, &b, 1); if (rb == -1) { if (rb == EINTR) // Interrupted, try again continue; else { warn("Can not read"); goto err; } } if (rb == 0) { // EOF warnx("Hmm, we expected a \\0 before EOF."); goto err; } // store another read char *((*str) + chars) = b; chars++; if (b == '\0') { // We are done. break; } } return chars; err: free(*str); *str = NULL; return -1; } basex-7.7.2/basex-api/src/main/c/readstring.h000066400000000000000000000001731222453003200207440ustar00rootroot00000000000000/* Copyright (c) 2005-12, Alexander Holupirek , BSD license */ ssize_t readstring(int fd, char **str); basex-7.7.2/basex-api/src/main/haskell/000077500000000000000000000000001222453003200176315ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/haskell/BaseXClient.hs000066400000000000000000000055161222453003200223350ustar00rootroot00000000000000------------------------------------------------------------------------------- -- | -- Module : BaseXClient -- Copyright : (C) BaseX Team 2005-12 -- License : BSD -- -- Maintainer : leo@woerteler.de -- Stability : experimental -- Portability : portable -- -- Haskell client for BaseX. -- Works with BaseX 6.1 -- -- It requires the PureMD5 package fom Hackage: 'cabal install PureMD5'. -- ------------------------------------------------------------------------------- -- -- Example: -- -- module Example where -- import BaseXClient -- import Network ( withSocketsDo ) -- main :: IO () -- main = withSocketsDo $ do -- (Just session) <- connect "localhost" 1984 "admin" "admin" -- execute session "xquery 1 to 10" >>= putStrLn . either id content -- close session -- ------------------------------------------------------------------------------- module BaseXClient ( connect, execute, close, Result(..) ) where import Network ( withSocketsDo, PortID(..), PortNumber(..), connectTo ) import Control.Applicative ( (<$>) ) import System.IO ( Handle, hGetChar, hPutChar, hPutStr, hClose, BufferMode(..), hSetBuffering, hFlush) import qualified Data.Digest.Pure.MD5 as MD5 ( md5 ) import Data.ByteString.Lazy.UTF8 ( fromString ) data Session = Session Handle deriving Show data Result = Result { info :: String, content :: String } deriving Show -- | Connects to the BaseX server at host:port and establishes a session -- with the given user name and password. connect :: String -- ^ host name / IP -> PortNumber -- ^ port -> String -- ^ user name -> String -- ^ password -> IO (Maybe Session) connect host port user pass = do h <- connectTo host (PortNumber port) hSetBuffering h (BlockBuffering $ Just 4096) ts <- readString h writeString h user writeString h $ md5 (md5 pass ++ ts) success <- ('\0' ==) <$> hGetChar h return $ if success then Just $ Session h else Nothing where md5 = show . MD5.md5 . fromString -- | Executes a database command on the server and returns the result. execute :: Session -- ^ BaseX session -> String -- ^ db command -> IO (Either String Result) execute (Session h) cmd = do writeString h cmd res <- readString h inf <- readString h success <- ('\0' ==) <$> hGetChar h return $ if success then Right Result { info = inf, content = res } else Left inf -- | Closes the connection. close :: Session -> IO () close (Session h) = writeString h "exit" >> hClose h readString :: Handle -> IO String readString h = do c <- hGetChar h if c /= '\0' then (c:) <$> readString h else return [] writeString :: Handle -> String -> IO () writeString h str = hPutStr h str >> hPutChar h '\0' >> hFlush h basex-7.7.2/basex-api/src/main/haskell/Example.hs000066400000000000000000000021621222453003200215610ustar00rootroot00000000000000------------------------------------------------------------------------------- -- | -- Module : Example -- Copyright : (C) BaseX Team 2005-12 -- License : BSD -- -- Maintainer : leo@woerteler.de -- Stability : experimental -- Portability : portable -- -- This example shows how database commands can be executed. -- -- Documentation: http://docs.basex.org/wiki/Clients -- ------------------------------------------------------------------------------- module Example where import BaseXClient import Network ( withSocketsDo ) import Data.Time.Clock ( getCurrentTime, diffUTCTime ) import Control.Applicative ( (<$>), (<*>), pure ) query :: String query = "xquery 1 to 10" main :: IO () main = withSocketsDo $ do -- start time start <- getCurrentTime -- connect to the server (Just session) <- connect "localhost" 1984 "admin" "admin" -- execute and print the query execute session query >>= putStrLn . either id content -- close the session close session -- print time difference (diffUTCTime <$> getCurrentTime <*> pure start) >>= print basex-7.7.2/basex-api/src/main/java/000077500000000000000000000000001222453003200171275ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/java/org/000077500000000000000000000000001222453003200177165ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/java/org/basex/000077500000000000000000000000001222453003200210205ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/java/org/basex/BaseXHTTP.java000066400000000000000000000311001222453003200233600ustar00rootroot00000000000000package org.basex; import static org.basex.core.Text.*; import static org.basex.http.HTTPText.*; import java.io.*; import java.net.*; import javax.net.ssl.*; import org.basex.core.*; import org.basex.http.*; import org.basex.io.*; import org.basex.server.*; import org.basex.util.*; import org.eclipse.jetty.server.*; import org.eclipse.jetty.server.nio.*; import org.eclipse.jetty.server.ssl.*; import org.eclipse.jetty.webapp.*; import org.eclipse.jetty.xml.*; /** * This is the main class for the starting the database HTTP services. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Dirk Kirsten */ public final class BaseXHTTP { /** Database context. */ private final Context context; /** HTTP port. */ private int httpPort; /** HTTP server. */ private final Server jetty; /** Start as daemon. */ private boolean service; /** Stopped flag. */ private boolean stopped; /** * Main method, launching the HTTP services. * Command-line arguments are listed with the {@code -h} argument. * @param args command-line arguments */ public static void main(final String... args) { try { new BaseXHTTP(args); } catch(final Exception ex) { Util.errln(ex); System.exit(1); } } /** * Constructor. * @param args command-line arguments * @throws Exception exception */ public BaseXHTTP(final String... args) throws Exception { parseArguments(args); // context must be initialized after parsing of arguments context = HTTPContext.init(); // create jetty instance and set default context to HTTP path final MainProp mprop = context.mprop; final String webapp = mprop.get(MainProp.WEBPATH); final WebAppContext wac = new WebAppContext(webapp, "/"); jetty = (Server) new XmlConfiguration(initJetty(webapp).inputStream()).configure(); jetty.setHandler(wac); // set the first http port (can also be https) to the port provided by command line if(httpPort != 0) { for(final Connector c : jetty.getConnectors()) { if(c instanceof SelectChannelConnector) { c.setPort(httpPort); break; } } } // stop server final String startX = HTTP + ' ' + SRV_STARTED_PORT_X; final String stopX = HTTP + ' ' + SRV_STOPPED_PORT_X; if(stopped) { stop(); for(final Connector c : jetty.getConnectors()) Util.outln(stopX, c.getPort()); // temporary console windows: keep the message visible for a while Performance.sleep(1000); return; } // start web server in a new process if(service) { final Connector connector = jetty.getConnectors()[0]; start(connector.getPort(), connector instanceof SslSelectChannelConnector, args); for(final Connector c : jetty.getConnectors()) { Util.outln(startX, c.getPort()); } // temporary console windows: keep the message visible for a while Performance.sleep(1000); return; } // request password on command line if only the user was specified if(!AProp.getSystem(MainProp.USER).isEmpty()) { while(AProp.getSystem(MainProp.PASSWORD).isEmpty()) { Util.out(PASSWORD + COLS); AProp.setSystem(MainProp.PASSWORD, Util.password()); } } // start web server jetty.start(); for(final Connector c : jetty.getConnectors()) { Util.outln(startX, c.getPort()); } // initialize web.xml settings, assign system properties and run database server // if not done so already. this must be called after starting jetty HTTPContext.init(wac.getServletContext()); // start daemon for stopping web server final int stop = mprop.num(MainProp.STOPPORT); if(stop >= 0) new StopServer(mprop.get(MainProp.SERVERHOST), stop).start(); // show info when HTTP server is aborted Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { for(final Connector c : jetty.getConnectors()) { Util.outln(stopX, c.getPort()); } final Log l = context.log; if(l != null) { for(final Connector c : jetty.getConnectors()) { l.writeServer(OK, Util.info(stopX, c.getPort())); } } context.close(); } }); // log server start at very end (logging flag could have been updated by web.xml) for(final Connector c : jetty.getConnectors()) { context.log.writeServer(OK, Util.info(startX, c.getPort())); } } /** * Stops the server. * @throws Exception exception */ public void stop() throws Exception { // notify the jetty monitor to stop final MainProp mprop = context.mprop; final int stop = num(MainProp.STOPPORT, mprop); if(stop >= 0) stop(stop); // server has been started in a separate process and needs to be stopped if(!bool(MainProp.HTTPLOCAL, mprop)) { final int port = num(MainProp.SERVERPORT, mprop); final int eport = num(MainProp.EVENTPORT, mprop); BaseXServer.stop(port, eport); } } /** * Returns a numeric value for the specified option. * @param option option to be retrieved * @param mprop main properties * @return numeric value */ private static int num(final Object[] option, final MainProp mprop) { final String val = AProp.getSystem(option); return val.isEmpty() ? mprop.num(option) : Token.toInt(val); } /** * Returns a boolean value for the specified option. * @param option option to be retrieved * @param mprop main properties * @return boolean value */ private static boolean bool(final Object[] option, final MainProp mprop) { final String val = AProp.getSystem(option); return val.isEmpty() ? mprop.is(option) : Boolean.parseBoolean(val); } /** * Returns a reference to the Jetty configuration file. * @param root target root directory * @return input stream * @throws IOException I/O exception */ private static IOFile initJetty(final String root) throws IOException { locate(WEBCONF, root); return locate(JETTYCONF, root); } /** * Locates the specified configuration file. * @param file file to be copied * @param root target root directory * @return reference to created file * @throws IOException I/O exception */ private static IOFile locate(final String file, final String root) throws IOException { final IOFile trg = new IOFile(root + '/' + file); final boolean create = !trg.exists(); // try to locate file from development branch final IO in = new IOFile("src/main/webapp/" + file); final byte[] data; if(in.exists()) { data = in.read(); // check if resource path exists IOFile res = new IOFile("src/main/resources/"); if(res.exists()) { res = new IOFile(res, file); // update file in resource path if it has changed if(!res.exists() || !Token.eq(data, res.read())) { Util.errln("Updating " + res); res.dir().md(); res.write(in.read()); } } } else if(create) { // try to locate file from resource path final InputStream is = BaseXHTTP.class.getResourceAsStream('/' + file); if(is == null) throw new BaseXException(in + " not found."); data = new IOStream(is).read(); } else { return trg; } if(create) { // create configuration file Util.errln("Creating " + trg); trg.dir().md(); trg.write(data); } return trg; } /** * Parses the command-line arguments, specified by the user. * @param args command-line arguments * @throws IOException I/O exception */ private void parseArguments(final String[] args) throws IOException { /* command-line properties not be stored in system properties (instead of * context.mprop). this way, they will not be overwritten by web.xml settings. */ final Args arg = new Args(args, this, HTTPINFO, Util.info(CONSOLE, HTTP)); boolean daemon = false; while(arg.more()) { if(arg.dash()) { switch(arg.next()) { case 'd': // activate debug mode AProp.setSystem(MainProp.DEBUG, true); Prop.debug = true; break; case 'D': // hidden flag: daemon mode daemon = true; break; case 'e': // parse event port AProp.setSystem(MainProp.EVENTPORT, arg.number()); break; case 'h': // parse HTTP port httpPort = arg.number(); break; case 'l': // use local mode AProp.setSystem(MainProp.HTTPLOCAL, true); break; case 'n': // parse host name AProp.setSystem(MainProp.HOST, arg.string()); break; case 'p': // parse server port final int p = arg.number(); AProp.setSystem(MainProp.PORT, p); AProp.setSystem(MainProp.SERVERPORT, p); break; case 'P': // specify password AProp.setSystem(MainProp.PASSWORD, arg.string()); break; case 's': // parse stop port AProp.setSystem(MainProp.STOPPORT, arg.number()); break; case 'S': // set service flag service = !daemon; break; case 'U': // specify user name AProp.setSystem(MainProp.USER, arg.string()); break; case 'z': // suppress logging AProp.setSystem(MainProp.LOG, false); break; default: arg.usage(); } } else { if(!arg.string().equalsIgnoreCase("stop")) arg.usage(); stopped = true; } } } // STATIC METHODS =========================================================== /** * Starts the HTTP server in a separate process. * @param port server port * @param ssl encryption via HTTPS * @param args command-line arguments * @throws BaseXException database exception */ private static void start(final int port, final boolean ssl, final String... args) throws BaseXException { Util.start(BaseXHTTP.class, args); // try to connect to the new server instance for(int c = 1; c < 10; ++c) { if(ping(LOCALHOST, port, ssl)) return; Performance.sleep(c * 100); } throw new BaseXException(CONNECTION_ERROR); } /** * Generates a stop file for the specified port. * @param port server port * @return stop file */ private static File stopFile(final int port) { return new File(Prop.TMP, Util.name(BaseXHTTP.class) + port); } /** * Stops the server. * @param port server port * @throws IOException I/O exception */ private static void stop(final int port) throws IOException { final File stop = stopFile(port); try { stop.createNewFile(); new Socket(LOCALHOST, port).close(); // give the notified process some time to quit Performance.sleep(100); } catch(final IOException ex) { stop.delete(); throw ex; } } /** * Checks if a server is running. * @param host host * @param port server port * @param ssl encryption via HTTPS * @return boolean success */ private static boolean ping(final String host, final int port, final boolean ssl) { try { // create connection final URL url = new URL((ssl ? "https://" : "http://") + host + ':' + port); url.openConnection().getInputStream(); return true; } catch(final IOException ex) { // if page is not found, server is running // if SSL handshake failed server is running, otherwise SSLException return ex instanceof FileNotFoundException || ex instanceof SSLHandshakeException; } } /** Monitor for stopping the Jetty server. */ @SuppressWarnings("synthetic-access") private final class StopServer extends Thread { /** Server socket. */ private final ServerSocket ss; /** Stop file. */ private final File stop; /** * Constructor. * @param host host address * @param port stop port * @throws IOException I/O exception */ StopServer(final String host, final int port) throws IOException { final InetAddress addr = host.isEmpty() ? null : InetAddress.getByName(host); ss = new ServerSocket(); ss.setReuseAddress(true); ss.bind(new InetSocketAddress(addr, port)); stop = stopFile(port); setDaemon(true); } @Override public void run() { try { while(true) { ss.accept().close(); if(stop.exists()) { ss.close(); stop.delete(); jetty.stop(); break; } } } catch(final Exception ex) { Util.errln(ex); } } } } basex-7.7.2/basex-api/src/main/java/org/basex/api/000077500000000000000000000000001222453003200215715ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/java/org/basex/api/xmldb/000077500000000000000000000000001222453003200226775ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/java/org/basex/api/xmldb/BXCollection.java000066400000000000000000000204101222453003200260640ustar00rootroot00000000000000package org.basex.api.xmldb; import static org.basex.core.Text.*; import java.io.*; import java.lang.reflect.*; import org.basex.build.*; import org.basex.build.xml.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.data.atomic.*; import org.basex.io.*; import org.basex.util.*; import org.basex.util.list.*; import org.w3c.dom.*; import org.xmldb.api.base.*; import org.xmldb.api.modules.*; /** * Implementation of the Collection Interface for the XMLDB:API. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BXCollection implements Collection, BXXMLDBText { /** Database context. */ final BXDatabase db; /** Database context. */ Context ctx; /** * Constructor to create/open a collection. * @param name name of the database * @param open open existing database * @param d database context * @throws XMLDBException exception */ public BXCollection(final String name, final boolean open, final Database d) throws XMLDBException { db = (BXDatabase) d; ctx = db.ctx; try { ctx.openDB(open ? Open.open(name, ctx) : CreateDB.create(name, Parser.emptyParser(ctx.prop), ctx)); } catch(final IOException ex) { throw new XMLDBException(ErrorCodes.VENDOR_ERROR, ex.getMessage()); } } @Override public String getName() { return ctx.data().meta.name; } @Override public Service[] getServices() throws XMLDBException { check(); return new Service[] { getService(BXQueryService.XPATH, "1.0"), getService(BXQueryService.XQUERY, "1.0"), getService(BXCollectionManagementService.MANAGEMENT, "1.0") }; } @Override public Service getService(final String nm, final String ver) throws XMLDBException { check(); if(ver.equals("1.0")) { if(Token.eq(nm, BXQueryService.XPATH, BXQueryService.XQUERY)) return new BXQueryService(this, nm, ver); if(nm.equals(BXCollectionManagementService.MANAGEMENT)) return new BXCollectionManagementService(this); } return null; } @Override public Collection getParentCollection() throws XMLDBException { check(); return null; } @Override public Collection getChildCollection(final String name) throws XMLDBException { check(); return null; } @Override public int getChildCollectionCount() throws XMLDBException { check(); return 0; } @Override public String[] listChildCollections() throws XMLDBException { check(); return new String[] {}; } @Override public int getResourceCount() throws XMLDBException { check(); return ctx.data().resources.docs().size(); } @Override public String[] listResources() throws XMLDBException { check(); final StringList sl = new StringList(); final Data data = ctx.data(); final IntList il = data.resources.docs(); final int is = il.size(); for(int i = 0; i < is; i++) sl.add(Token.string(data.text(il.get(i), true))); return sl.toArray(); } @Override public BXXMLResource createResource(final String id, final String type) throws XMLDBException { check(); if(type.equals(XMLResource.RESOURCE_TYPE)) { // create new id, if necessary final String uid = id == null || id.isEmpty() ? createId() : id; return new BXXMLResource(null, 0, uid, this); } // reject binary and other resources throw type.equals(BinaryResource.RESOURCE_TYPE) ? new XMLDBException(ErrorCodes.VENDOR_ERROR, ERR_BINARY) : new XMLDBException(ErrorCodes.UNKNOWN_RESOURCE_TYPE, ERR_TYPE + type); } @Override public void removeResource(final Resource res) throws XMLDBException { check(); // check if the resource is an xml resource final BXXMLResource del = checkXML(res); final Data data = ctx.data(); // check if data instance refers to another database if(del.data != data && del.data != null) throw new XMLDBException( ErrorCodes.NO_SUCH_RESOURCE, ERR_UNKNOWN + data.meta.name); if(!data.startUpdate()) throw new XMLDBException(ErrorCodes.VENDOR_ERROR, ERR_LOCK); data.delete(getResource(del.getId()).pos); ctx.update(); data.finishUpdate(); } @Override public void storeResource(final Resource res) throws XMLDBException { check(); // check if resource has any contents final BXXMLResource xml = checkXML(res); if(res.getContent() == null) throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, ERR_EMPTY); // disallow storage of resources without id final String id = res.getId(); if(id == null) throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, ERR_ID); // document exists - delete old one first final Resource old = getResource(id); if(old != null) removeResource(getResource(id)); // create parser, dependent on input type final Object cont = xml.content; // insert document final Data md; try { final Parser p = cont instanceof Document ? new DOMWrapper((Document) cont, id, ctx.prop) : Parser.singleParser(new IOContent((byte[]) cont, id), ctx.prop, ""); md = MemBuilder.build(id, p); } catch(final IOException ex) { throw new XMLDBException(ErrorCodes.INVALID_RESOURCE, ex.getMessage()); } final Data data = ctx.data(); if(!data.startUpdate()) throw new XMLDBException(ErrorCodes.VENDOR_ERROR, ERR_LOCK); data.insert(data.meta.size, -1, new DataClip(md)); ctx.update(); data.finishUpdate(); } @Override public BXXMLResource getResource(final String id) throws XMLDBException { check(); if(id == null) return null; final Data data = ctx.data(); final int pre = data.resources.doc(id); return pre == -1 ? null : new BXXMLResource(data, pre, id, this); } @Override public String createId() throws XMLDBException { final String[] res = listResources(); String id; do { id = Long.toString(System.currentTimeMillis()); } while(exists(res, id)); return id; } @Override public boolean isOpen() { return ctx != null; } @Override public void close() { if(ctx != null) ctx.close(); ctx = null; } @Override public String getProperty(final String key) throws XMLDBException { check(); try { return MetaData.class.getField(key).get(ctx.data().meta).toString(); } catch(final Exception ex) { return null; } } @Override public void setProperty(final String key, final String val) throws XMLDBException { check(); try { final MetaData md = ctx.data().meta; final Field f = MetaData.class.getField(key); final Object k = f.get(md); if(k instanceof Boolean) { final boolean b = val == null ? !(Boolean) k : val.equalsIgnoreCase(TRUE); f.setBoolean(md, b); } else if(k instanceof Integer) { f.setInt(md, Integer.parseInt(val)); } else { f.set(md, val); } } catch(final Exception ex) { throw new XMLDBException(ErrorCodes.VENDOR_ERROR, ERR_PROP + key); } } /** * Checks if the specified id exists in the specified id list. * @param list id list * @param id id to be found * @return result of check */ private static boolean exists(final String[] list, final String id) { for(final String l : list) if(l.equals(id)) return true; return false; } /** * Checks if the collection is currently open. * @throws XMLDBException exception */ private void check() throws XMLDBException { if(ctx == null) throw new XMLDBException(ErrorCodes.COLLECTION_CLOSED); } /** * Returns the specified resource as a project specific XML resource. * If that's not possible, throws an exception * @param res input resource * @return xml resource * @throws XMLDBException exception */ private static BXXMLResource checkXML(final Resource res) throws XMLDBException { if(!(res instanceof BXXMLResource)) { throw new XMLDBException(ErrorCodes.NO_SUCH_RESOURCE, ERR_UNKNOWN + res); } return (BXXMLResource) res; } } basex-7.7.2/basex-api/src/main/java/org/basex/api/xmldb/BXCollectionManagementService.java000066400000000000000000000036501222453003200314110ustar00rootroot00000000000000package org.basex.api.xmldb; import org.basex.core.*; import org.basex.core.cmd.*; import org.xmldb.api.base.*; import org.xmldb.api.modules.*; /** * Implementation of the CollectionManagementService Interface for the * XMLDB:API. Note that a database has one collection at a time, * so creating a new collection creates a new database as well, and the * specified collection reference is reset every time a database is created. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class BXCollectionManagementService implements CollectionManagementService, BXXMLDBText { /** Service constant. */ static final String MANAGEMENT = "CollectionManagementService"; /** Service constant. */ private static final String VERSION = "1.0"; /** Collection reference. */ private BXCollection coll; /** * Default constructor. * @param c collection reference */ BXCollectionManagementService(final BXCollection c) { coll = c; } @Override public Collection createCollection(final String name) throws XMLDBException { return new BXCollection(name, false, coll.db); } @Override public void removeCollection(final String name) throws XMLDBException { try { new DropDB(name).execute(coll.ctx); } catch(final BaseXException ex) { throw new XMLDBException(ErrorCodes.VENDOR_ERROR, ex.getMessage()); } } @Override public String getName() { return MANAGEMENT; } @Override public String getVersion() { return VERSION; } @Override public void setCollection(final Collection c) { coll = (BXCollection) c; } @Override public String getProperty(final String nm) { return null; } @Override public void setProperty(final String nm, final String value) throws XMLDBException { throw new XMLDBException(ErrorCodes.VENDOR_ERROR, ERR_PROP + nm); } } basex-7.7.2/basex-api/src/main/java/org/basex/api/xmldb/BXDatabase.java000066400000000000000000000046451222453003200255110ustar00rootroot00000000000000package org.basex.api.xmldb; import static org.basex.core.Text.*; import java.util.*; import org.basex.core.*; import org.basex.core.cmd.Set; import org.xmldb.api.base.*; import org.xmldb.api.base.Collection; /** * Implementation of the Database Interface for the XMLDB:API. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BXDatabase implements Database, BXXMLDBText { /** Database context. */ public final Context ctx = new Context(); @Override public boolean acceptsURI(final String uri) throws XMLDBException { getCollectionName(uri); return true; } @Override public Collection getCollection(final String uri, final String user, final String password) throws XMLDBException { // create database context final String name = getCollectionName(uri); final boolean exists = ctx.mprop.dbexists(name); return exists ? new BXCollection(name, true, this) : null; } @Override public String getConformanceLevel() { return CONFORMANCE_LEVEL; } @Override public String getName() { return NAMELC; } @Override public String getProperty(final String key) { try { final String prop = key.toUpperCase(Locale.ENGLISH); return ((Object[]) Prop.class.getField(prop).get(null))[1].toString(); } catch(final Exception ex) { return null; } } @Override public void setProperty(final String key, final String value) throws XMLDBException { try { new Set(key, value).execute(ctx); } catch(final BaseXException ex) { throw new XMLDBException(ErrorCodes.VENDOR_ERROR, ERR_PROP + key); } } /** * Returns the name of a collection. * @param uri input uri * @return collection name * @throws XMLDBException exception */ private String getCollectionName(final String uri) throws XMLDBException { // try to extract name of collection; otherwise, throw exception if(uri != null) { final String main = uri.startsWith(XMLDBC) ? uri : XMLDBC + uri; if(main.startsWith(XMLDBURI)) { final String host = main.substring(XMLDBURI.length()); final String lh = LOCALHOST + ':' + ctx.mprop.num(MainProp.SERVERPORT) + '/'; if(host.startsWith(lh)) return host.substring(lh.length()); } } throw new XMLDBException(ErrorCodes.INVALID_URI, ERR_URI + uri); } } basex-7.7.2/basex-api/src/main/java/org/basex/api/xmldb/BXQueryService.java000066400000000000000000000066701222453003200264330ustar00rootroot00000000000000package org.basex.api.xmldb; import static org.basex.util.Token.*; import java.util.*; import org.basex.data.*; import org.basex.query.*; import org.xmldb.api.base.*; import org.xmldb.api.base.Collection; import org.xmldb.api.modules.*; /** * Abstract QueryService definition for the XMLDB:API. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class BXQueryService implements XPathQueryService, BXXMLDBText { /** XPath service constant. */ static final String XPATH = "XPathQueryService"; /** XQuery service constant. */ static final String XQUERY = "XQueryQueryService"; /** Namespaces. */ private final HashMap ns = new HashMap(); /** Service name. */ private final String name; /** Service version. */ private final String version; /** Collection reference. */ private BXCollection coll; /** * Standard constructor. * @param c for collection reference * @param n service name * @param v version */ BXQueryService(final BXCollection c, final String n, final String v) { coll = c; name = n; version = v; } @Override public void setNamespace(final String pre, final String uri) throws XMLDBException { if(uri != null && !uri.isEmpty()) ns.put(pre == null ? "" : pre, uri); else throw new XMLDBException(ErrorCodes.VENDOR_ERROR, ERR_NSURI + pre); } @Override public String getNamespace(final String pre) { return ns.get(pre == null ? "" : pre); } @Override public void removeNamespace(final String pre) { ns.remove(pre == null ? "" : pre); } @Override public void clearNamespaces() { ns.clear(); } @Override public BXResourceSet query(final String query) throws XMLDBException { return query(coll.ctx.current(), query); } @Override public BXResourceSet queryResource(final String id, final String query) throws XMLDBException { final BXXMLResource xml = coll.getResource(id); if(xml != null) return query(new Nodes(xml.pos, xml.data), query); // throw exception if id was not found... throw new XMLDBException(ErrorCodes.VENDOR_ERROR, ERR_RES + id); } @Override public String getName() { return name; } @Override public String getVersion() { return version; } @Override public void setCollection(final Collection col) { coll = (BXCollection) col; } @Override public String getProperty(final String nm) { return null; } @Override public void setProperty(final String nm, final String value) throws XMLDBException { throw new XMLDBException(ErrorCodes.VENDOR_ERROR, ERR_PROP + nm); } /** * Method for both query actions. * @param nodes initial node set * @param query query string * @return resource set * @throws XMLDBException exception */ private BXResourceSet query(final Nodes nodes, final String query) throws XMLDBException { // creates a query instance final QueryProcessor qp = new QueryProcessor(query, coll.ctx).context(nodes); try { coll.ctx.register(qp); // add default namespaces for(final String n : ns.keySet()) { qp.ctx.sc.ns.add(token(n), token(ns.get(n)), null); } // perform query and return result return new BXResourceSet(qp.execute(), coll); } catch(final QueryException ex) { throw new XMLDBException(ErrorCodes.VENDOR_ERROR, ex.getMessage()); } finally { qp.close(); coll.ctx.unregister(qp); } } } basex-7.7.2/basex-api/src/main/java/org/basex/api/xmldb/BXResourceIterator.java000066400000000000000000000016531222453003200273020ustar00rootroot00000000000000package org.basex.api.xmldb; import java.util.*; import org.xmldb.api.base.*; /** * Implementation of the ResourceIterator Interface for the XMLDB:API. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class BXResourceIterator implements ResourceIterator, BXXMLDBText, Iterable { /** Resources. */ private final Iterator res; /** * Standard constructor with result. * @param r resources */ BXResourceIterator(final ArrayList r) { res = r.iterator(); } @Override public boolean hasMoreResources() { return res.hasNext(); } @Override public Resource nextResource() throws XMLDBException { if(!res.hasNext()) throw new XMLDBException(ErrorCodes.NO_SUCH_RESOURCE, ERR_ITER); return res.next(); } @Override public Iterator iterator() { return res; } } basex-7.7.2/basex-api/src/main/java/org/basex/api/xmldb/BXResourceSet.java000066400000000000000000000035031222453003200262400ustar00rootroot00000000000000package org.basex.api.xmldb; import java.util.*; import org.basex.data.*; import org.basex.util.*; import org.xmldb.api.base.*; import org.xmldb.api.base.Collection; /** * Implementation of the ResourceSet Interface for the XMLDB:API. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class BXResourceSet implements ResourceSet, BXXMLDBText { /** Resources. */ private final ArrayList res; /** Collection reference. */ private final Collection coll; /** * Default constructor with result. * @param r result * @param c collection */ BXResourceSet(final Result r, final Collection c) { // convert result into resource instances res = new ArrayList((int) r.size()); for(int s = 0; s < r.size(); ++s) res.add(new BXXMLResource(r, s, c)); coll = c; } @Override public Resource getResource(final long i) throws XMLDBException { if(i >= 0 && i < res.size()) return res.get((int) i); throw new XMLDBException(ErrorCodes.NO_SUCH_RESOURCE); } @Override public void addResource(final Resource r) { res.add(r); } @Override public void removeResource(final long index) { res.remove((int) index); } @Override public BXResourceIterator getIterator() { return new BXResourceIterator(res); } @Override public Resource getMembersAsResource() throws XMLDBException { final TokenBuilder tb = new TokenBuilder().add('<').add(XMLDB).add('>'); for(final Resource r : getIterator()) { tb.add(r.getContent().toString()); } return new BXXMLResource(tb.add('<').add('/').add(XMLDB).add('>').finish(), coll); } @Override public long getSize() { return res.size(); } @Override public void clear() { res.clear(); } } basex-7.7.2/basex-api/src/main/java/org/basex/api/xmldb/BXXMLDBText.java000066400000000000000000000027431222453003200255150ustar00rootroot00000000000000package org.basex.api.xmldb; import static org.basex.core.Text.*; /** * This class organizes textual information for the XMLDB API. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ interface BXXMLDBText { /** DB URI. */ String DBURI = NAMELC + "://"; /** XMLDB Prefix. */ String XMLDB = "xmldb"; /** XMLDB with colon. */ String XMLDBC = XMLDB + ':'; /** XMLDB URI. */ String XMLDBURI = XMLDBC + DBURI; /** Conformance level of the implementation. */ String CONFORMANCE_LEVEL = "0"; /** Error message. */ String ERR_URI = "Invalid URI: "; /** Error message. */ String ERR_PROP = "Property could not be set: "; /** Error message. */ String ERR_BINARY = "Binary resources not supported."; /** Error message. */ String ERR_TYPE = "Resource type is unknown: "; /** Error message. */ String ERR_EMPTY = "Resource has no contents."; /** Error message. */ String ERR_ID = "Resource has no ID."; /** Error message. */ String ERR_UNKNOWN = "Unknown Resource: "; /** Error message. */ String ERR_CONT = "Content cannot be set."; /** Error message. */ String ERR_NSURI = "Namespace URI is empty: "; /** Error message. */ String ERR_RES = "Resource not found: "; /** Error message. */ String ERR_ITER = "Resource pointer out of range."; /** Error message. */ String ERR_DOC = "Document ID cannot be retrieved from query result."; /** Error message. */ String ERR_LOCK = "Database cannot be marked as 'updating'."; } basex-7.7.2/basex-api/src/main/java/org/basex/api/xmldb/BXXMLResource.java000066400000000000000000000141421222453003200261460ustar00rootroot00000000000000package org.basex.api.xmldb; import static org.basex.util.Token.*; import java.io.*; import javax.xml.parsers.*; import org.basex.api.dom.*; import org.basex.build.*; import org.basex.build.Parser; import org.basex.build.xml.*; import org.basex.core.*; import org.basex.data.*; import org.basex.io.*; import org.basex.io.out.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.value.node.*; import org.w3c.dom.*; import org.xml.sax.*; import org.xmldb.api.base.*; import org.xmldb.api.modules.*; /** * Implementation of the XMLResource Interface for the XMLDB:API. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class BXXMLResource implements XMLResource, BXXMLDBText { /** Collection reference. */ private final Collection coll; /** String id. */ private String id; /** Query result. */ private Result result; /** Cached content. */ Object content; /** Data reference. */ Data data; /** Pre value or result position. */ int pos; /** * Constructor for generated results. * @param d content data * @param c Collection */ BXXMLResource(final byte[] d, final Collection c) { content = d; coll = c; } /** * Constructor for query results. * @param res query result * @param p query counter * @param c Collection */ BXXMLResource(final Result res, final int p, final Collection c) { result = res; coll = c; pos = p; } /** * Standard constructor. * @param d data reference * @param p pre value * @param i id * @param c collection */ BXXMLResource(final Data d, final int p, final String i, final Collection c) { id = i; coll = c; data = d; pos = p; } @Override public Collection getParentCollection() { return coll; } @Override public String getId() { return id; } @Override public String getResourceType() { return XMLResource.RESOURCE_TYPE; } @Override public Object getContent() throws XMLDBException { if(content == null) { try { // serialize and cache content final ArrayOutput ao = new ArrayOutput(); final Serializer ser = Serializer.get(ao); if(data != null) { ser.serialize(new DBNode(data, pos)); } else if(result != null) { result.serialize(ser, pos); } else { return null; } content = ao.toArray(); } catch(final IOException ex) { throw new XMLDBException(ErrorCodes.VENDOR_ERROR, ex.getMessage()); } } return content instanceof byte[] ? string((byte[]) content) : content; } @Override public void setContent(final Object value) throws XMLDBException { // allow only strings, byte arrays and {@link File} instances if(value instanceof byte[]) { content = value; } else if(value instanceof String) { content = token(value.toString()); } else if(value instanceof File) { try { content = new IOFile((File) value).read(); } catch(final IOException ex) { throw new XMLDBException(ErrorCodes.VENDOR_ERROR, ERR_CONT + '\n' + ex.getMessage()); } } else { throw new XMLDBException(ErrorCodes.VENDOR_ERROR, ERR_CONT); } } @Override public String getDocumentId() throws XMLDBException { // throw exception if resource result from query; does not conform to the // specs, but many query results are not related to a document anymore if(result != null) throw new XMLDBException(ErrorCodes.VENDOR_ERROR, ERR_DOC); // resource does not result from a query - return normal id if(id != null) return id; // get document root id int p = pos; while(p >= 0) { final int k = data.kind(p); if(k == Data.DOC) return string(data.text(p, true)); p = data.parent(p, k); } return null; } @Override public Node getContentAsDOM() { if(!(content instanceof Node)) content = new BXDoc(new DBNode(data, pos)); return (Node) content; } @Override public void setContentAsDOM(final Node cont) throws XMLDBException { // allow only document instances... if(cont == null) throw new XMLDBException(ErrorCodes.INVALID_RESOURCE); if(cont instanceof Document) content = cont; else throw new XMLDBException(ErrorCodes.WRONG_CONTENT_TYPE); } @Override public void getContentAsSAX(final ContentHandler handler) throws XMLDBException { if(handler == null) throw new XMLDBException(ErrorCodes.INVALID_RESOURCE); final SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setNamespaceAware(true); factory.setValidating(false); try { // caching should be avoided and replaced by a stream reader... final XMLReader reader = factory.newSAXParser().getXMLReader(); reader.setContentHandler(handler); reader.parse(new InputSource(new StringReader(getContent().toString()))); } catch(final Exception pce) { throw new XMLDBException(ErrorCodes.VENDOR_ERROR, pce.getMessage()); } } @Override public ContentHandler setContentAsSAX() throws XMLDBException { // ..might be replaced by a custom SAX content handler in future final MemBuilder mb = new MemBuilder("", Parser.emptyParser(new Prop())); mb.init(); return new BXSAXContentHandler(this, mb); } /** SAX parser. */ private static final class BXSAXContentHandler extends SAXHandler { /** XMLResource. */ private final BXXMLResource res; /** * Default constructor. * @param mb memory builder * @param r resource */ BXSAXContentHandler(final BXXMLResource r, final MemBuilder mb) { super(mb, false, false); res = r; } @Override public void endDocument() throws SAXException { try { res.content = new DBNode(((MemBuilder) builder).data()).serialize().toArray(); } catch(final QueryException ex) { error(new BaseXException(ex)); } } } } basex-7.7.2/basex-api/src/main/java/org/basex/api/xmldb/package.html000066400000000000000000000000641222453003200251600ustar00rootroot00000000000000 Implementation of the XML:DB API. basex-7.7.2/basex-api/src/main/java/org/basex/http/000077500000000000000000000000001222453003200217775ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/java/org/basex/http/BaseXServlet.java000066400000000000000000000055731222453003200252230ustar00rootroot00000000000000package org.basex.http; import static javax.servlet.http.HttpServletResponse.*; import static org.basex.http.HTTPText.*; import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; import org.basex.core.*; import org.basex.http.restxq.*; import org.basex.query.*; import org.basex.server.*; import org.basex.util.*; /** *

Base class for all servlets.

* * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class BaseXServlet extends HttpServlet { /** Servlet-specific user. */ protected String user; /** Servlet-specific password. */ protected String pass; @Override public void init(final ServletConfig config) throws ServletException { super.init(config); try { HTTPContext.init(config.getServletContext()); final Enumeration en = config.getInitParameterNames(); while(en.hasMoreElements()) { String key = en.nextElement().toLowerCase(Locale.ENGLISH); final String val = config.getInitParameter(key); if(key.startsWith(Prop.DBPREFIX)) key = key.substring(Prop.DBPREFIX.length()); if(key.equalsIgnoreCase(MainProp.USER[0].toString())) { user = val; } else if(key.equalsIgnoreCase(MainProp.PASSWORD[0].toString())) { pass = val; } } } catch(final IOException ex) { throw new ServletException(ex); } } @Override public final void service(final HttpServletRequest req, final HttpServletResponse res) throws IOException { final HTTPContext http = new HTTPContext(req, res, this); final boolean restxq = this instanceof RestXqServlet; try { run(http); http.log("", SC_OK); } catch(final HTTPException ex) { http.status(ex.getStatus(), Util.message(ex), restxq); } catch(final LoginException ex) { http.status(SC_UNAUTHORIZED, Util.message(ex), restxq); } catch(final IOException ex) { http.status(SC_BAD_REQUEST, Util.message(ex), restxq); } catch(final QueryException ex) { http.status(SC_BAD_REQUEST, Util.message(ex), restxq); } catch(final Exception ex) { final String msg = Util.bug(ex); Util.errln(msg); http.status(SC_INTERNAL_SERVER_ERROR, Util.info(UNEXPECTED, msg), restxq); } finally { if(Prop.debug) { Util.outln("_ REQUEST _________________________________" + Prop.NL + req); final Enumeration en = req.getHeaderNames(); while(en.hasMoreElements()) { final String key = en.nextElement(); Util.outln(Text.LI + key + Text.COLS + req.getHeader(key)); } Util.out("_ RESPONSE ________________________________" + Prop.NL + res); } http.close(); } } /** * Runs the code. * @param http HTTP context * @throws Exception any exception */ protected abstract void run(final HTTPContext http) throws Exception; } basex-7.7.2/basex-api/src/main/java/org/basex/http/HTTPContext.java000066400000000000000000000270461222453003200247770ustar00rootroot00000000000000package org.basex.http; import static javax.servlet.http.HttpServletResponse.*; import static org.basex.data.DataText.*; import static org.basex.http.HTTPText.*; import static org.basex.io.MimeTypes.*; import static org.basex.util.Token.*; import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; import org.basex.*; import org.basex.core.*; import org.basex.io.*; import org.basex.io.serial.*; import org.basex.server.*; import org.basex.util.*; import org.basex.util.list.*; /** * This class bundles context-based information on a single HTTP operation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class HTTPContext { /** Servlet request. */ public final HttpServletRequest req; /** Servlet response. */ public final HttpServletResponse res; /** Request method. */ public final HTTPMethod method; /** Serialization parameters. */ public String serialization = ""; /** Result wrapping. */ public boolean wrapping; /** User name. */ public String user; /** Singleton database context. */ private static Context context; /** Initialization flag. */ private static boolean init; /** Performance. */ private final Performance perf = new Performance(); /** Segments. */ private final String[] segments; /** Current user session. */ private LocalSession session; /** Password. */ private String pass; /** * Constructor. * @param rq request * @param rs response * @param servlet calling servlet instance * @throws IOException I/O exception */ public HTTPContext(final HttpServletRequest rq, final HttpServletResponse rs, final BaseXServlet servlet) throws IOException { req = rq; res = rs; final String mth = rq.getMethod(); method = HTTPMethod.get(mth); final StringBuilder uri = new StringBuilder(req.getRequestURL()); final String qs = req.getQueryString(); if(qs != null) uri.append('?').append(qs); log('[' + mth + "] " + uri, null); // set UTF8 as default encoding (can be overwritten) res.setCharacterEncoding(UTF8); segments = toSegments(req.getPathInfo()); // adopt servlet-specific credentials or use global ones final MainProp mprop = context().mprop; user = servlet.user != null ? servlet.user : mprop.get(MainProp.USER); pass = servlet.pass != null ? servlet.pass : mprop.get(MainProp.PASSWORD); // overwrite credentials with session-specific data final String auth = req.getHeader(AUTHORIZATION); if(auth != null) { final String[] values = auth.split(" "); if(values[0].equals(BASIC)) { final String[] cred = Base64.decode(values[1]).split(":", 2); if(cred.length != 2) throw new LoginException(NOPASSWD); user = cred[0]; pass = cred[1]; } else { throw new LoginException(WHICHAUTH, values[0]); } } } /** * Returns an immutable map with all query parameters. * @return parameters */ public Map params() { return req.getParameterMap(); } /** * Returns the content type of a request (without an optional encoding). * @return content type */ public String contentType() { final String ct = req.getContentType(); return ct != null ? ct.replaceFirst(";.*", "") : null; } /** * Returns the content type extension of a request (without an optional encoding). * @return content type */ public String contentTypeExt() { final String ct = req.getContentType(); return ct != null ? ct.replaceFirst("^.*?;\\s*", "") : null; } /** * Initializes the output. Sets the expected encoding and content type. * @param sprop serialization properties */ public void initResponse(final SerializerProp sprop) { // set content type and encoding final String enc = sprop.get(SerializerProp.S_ENCODING); res.setCharacterEncoding(enc); final String ct = mediaType(sprop); res.setContentType(new TokenBuilder(ct).add(CHARSET).add(enc).toString()); } /** * Returns the media type defined in the specified serialization properties. * @param sprop serialization properties * @return media type */ public static String mediaType(final SerializerProp sprop) { // set content type final String type = sprop.get(SerializerProp.S_MEDIA_TYPE); if(!type.isEmpty()) return type; // determine content type dependent on output method final String mt = sprop.get(SerializerProp.S_METHOD); if(mt.equals(M_RAW)) return APP_OCTET; if(mt.equals(M_XML)) return APP_XML; if(eq(mt, M_JSON, M_JSONML)) return APP_JSON; if(eq(mt, M_XHTML, M_HTML)) return TEXT_HTML; return TEXT_PLAIN; } /** * Returns the path depth. * @return path depth */ public int depth() { return segments.length; } /** * Returns a single path segment. * @param i index * @return segment */ public String segment(final int i) { return segments[i]; } /** * Returns the database path (i.e., all path entries except for the first). * @return path depth */ public String dbpath() { final TokenBuilder tb = new TokenBuilder(); for(int p = 1; p < segments.length; p++) { if(!tb.isEmpty()) tb.add('/'); tb.add(segments[p]); } return tb.toString(); } /** * Returns the addressed database (i.e., the first path entry), or {@code null} * if the root directory was specified. * @return database */ public String db() { return depth() == 0 ? null : segments[0]; } /** * Returns an array with all accepted content types. * if the root directory was specified. * @return database */ public String[] produces() { final String[] acc = req.getHeader("Accept").split("\\s*,\\s*"); for(int a = 0; a < acc.length; a++) { if(acc[a].indexOf(';') != -1) acc[a] = acc[a].replaceAll("\\w*;.*", ""); } return acc; } /** * Sets a status and sends an info message. * @param code status code * @param message info message * @param error treat as error (use web server standard output) * @throws IOException I/O exception */ public void status(final int code, final String message, final boolean error) throws IOException { try { log(message, code); res.resetBuffer(); if(code == SC_UNAUTHORIZED) res.setHeader(WWW_AUTHENTICATE, BASIC); if(error && code >= 400) { res.sendError(code, message); } else { res.setStatus(code); if(message != null) res.getOutputStream().write(token(message)); } } catch(final IllegalStateException ex) { log(Util.message(ex), SC_INTERNAL_SERVER_ERROR); } } /** * Updates the credentials. * @param u user * @param p password */ public void credentials(final String u, final String p) { user = u; pass = p; } /** * Creates a new {@link LocalSession} instance. * @return database session * @throws IOException I/O exception */ public LocalSession session() throws IOException { if(session == null) { final byte[] address = token(req.getRemoteAddr()); try { if(user == null || user.isEmpty() || pass == null || pass.isEmpty()) throw new LoginException(NOPASSWD); session = new LocalSession(context(), user, pass); context.blocker.remove(address); } catch(final LoginException ex) { // delay users with wrong passwords for(int d = context.blocker.delay(address); d > 0; d--) Performance.sleep(1000); throw ex; } } return session; } /** * Closes an open database session. */ public void close() { if(session != null) session.close(); } /** * Returns the database context. * @return context; */ public Context context() { return context; } /** * Writes a log message. * @param info message info * @param type message type (true/false/null: OK, ERROR, REQUEST, Error Code) */ public void log(final String info, final Object type) { // add evaluation time if any type is specified context.log.write(type != null ? new Object[] { address(), context.user.name, type, info, perf } : new Object[] { address(), context.user.name, null, info }); } // STATIC METHODS ===================================================================== /** * Initializes the HTTP context. * @return context; */ public static synchronized Context init() { if(context == null) context = new Context(); return context; } /** * Initializes the database context, based on the initial servlet context. * Parses all context parameters and passes them on to the database context. * @param sc servlet context * @throws IOException I/O exception */ public static synchronized void init(final ServletContext sc) throws IOException { // check if HTTP context has already been initialized if(init) return; init = true; // set web application path as home directory and HTTPPATH final String webapp = sc.getRealPath("/"); AProp.setSystem(Prop.PATH, webapp); AProp.setSystem(MainProp.WEBPATH, webapp); // bind all parameters that start with "org.basex." to system properties final Enumeration en = sc.getInitParameterNames(); while(en.hasMoreElements()) { final String key = en.nextElement(); if(!key.startsWith(Prop.DBPREFIX)) continue; // legacy: rewrite obsolete properties. will be removed some versions later final String val = sc.getInitParameter(key); String k = key; String v = val; if(key.equals(Prop.DBPREFIX + "httppath")) { k = Prop.DBPREFIX + MainProp.RESTXQPATH[0]; } else if(key.equals(Prop.DBPREFIX + "mode")) { k = Prop.DBPREFIX + MainProp.HTTPLOCAL[0]; v = Boolean.toString(v.equals("local")); } else if(key.equals(Prop.DBPREFIX + "server")) { k = Prop.DBPREFIX + MainProp.HTTPLOCAL[0]; v = Boolean.toString(!Boolean.parseBoolean(v)); } k = k.toLowerCase(Locale.ENGLISH); if(!k.equals(key) || !v.equals(val)) { Util.errln("Warning! Outdated property: " + key + '=' + val + " => " + k + '=' + v); } // prefix relative paths with absolute servlet path if(k.endsWith("path") && !new File(v).isAbsolute()) { Util.debug(k.toUpperCase(Locale.ENGLISH) + ": " + v); v = new IOFile(webapp, v).path(); } AProp.setSystem(k, v); } // create context, update property instances if(context == null) { context = new Context(false); } else { context.mprop.setSystem(); context.prop.setSystem(); } // start server instance if(!context.mprop.is(MainProp.HTTPLOCAL)) new BaseXServer(context); } /** * Converts the path to a string array, containing the single segments. * @param path path, or {@code null} * @return path depth */ public static String[] toSegments(final String path) { final StringList sl = new StringList(); if(path != null) { final TokenBuilder tb = new TokenBuilder(); for(int s = 0; s < path.length(); s++) { final char ch = path.charAt(s); if(ch == '/') { if(tb.isEmpty()) continue; sl.add(tb.toString()); tb.reset(); } else { tb.add(ch); } } if(!tb.isEmpty()) sl.add(tb.toString()); } return sl.toArray(); } // PRIVATE METHODS ==================================================================== /** * Returns a string with the remote user address. * @return user address */ private String address() { return req.getRemoteAddr() + ':' + req.getRemotePort(); } } basex-7.7.2/basex-api/src/main/java/org/basex/http/HTTPErr.java000066400000000000000000000034631222453003200241000ustar00rootroot00000000000000package org.basex.http; import static javax.servlet.http.HttpServletResponse.*; /** * This class contains all query error messages. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public enum HTTPErr { /** Error: 201 (created). */ CREATED_X(SC_CREATED, "%"), /** Error: 400 (bad request). */ BAD_REQUEST_X(SC_BAD_REQUEST, "%"), /** Error 400, "Only one operation can be specified". */ ONEOP(SC_BAD_REQUEST, "Only one operation can be specified."), /** Error 400, "Unknown parameter: '%'". */ UNKNOWN_PARAM_X(SC_BAD_REQUEST, "Unknown parameter: '%'."), /** Error 400, "Invalid parameters: '%'". */ INVALID_PARAM_X(SC_BAD_REQUEST, "Parameters cannot be decoded: %."), /** Error 400, "Multiple context items specified.". */ MULTIPLE_CONTEXT_X(SC_BAD_REQUEST, "Multiple context items specified."), /** Error: 404 (not found). */ NOT_FOUND_X(SC_NOT_FOUND, "%"), /** Error: 404, "No path specified.". */ NO_PATH(SC_NOT_FOUND, "No path specified."), /** Error: 404, "No function found to process the request.". */ NO_XQUERY(SC_NOT_FOUND, "No function found that matches the request."), /** Error 501, "Method not supported: %.". */ NOT_IMPLEMENTED_X(SC_NOT_IMPLEMENTED, "Method not supported: %."); /** Status code. */ final int code; /** Error description. */ final String desc; /** * Constructor. * @param c status code * @param d description */ private HTTPErr(final int c, final String d) { code = c; desc = d; } /** * Throws an HTTP exception. * @param ext extended info * @return HTTP exception * @throws HTTPException HTTP exception */ public HTTPException thrw(final Object... ext) throws HTTPException { throw new HTTPException(this, ext); } } basex-7.7.2/basex-api/src/main/java/org/basex/http/HTTPException.java000066400000000000000000000013521222453003200253010ustar00rootroot00000000000000package org.basex.http; import java.io.*; import org.basex.util.*; /** * HTTP exception. Also thrown to pass on correct status codes. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class HTTPException extends IOException { /** Status code. */ private final int status; /** * Constructs an exception with the specified message and extension. * @param err error * @param ext message extension */ public HTTPException(final HTTPErr err, final Object... ext) { //this(err.code, err.desc, ext); super(Util.info(err.desc, ext)); status = err.code; } /** * Returns the status code. * @return status code */ public int getStatus() { return status; } } basex-7.7.2/basex-api/src/main/java/org/basex/http/HTTPMethod.java000066400000000000000000000012041222453003200245570ustar00rootroot00000000000000package org.basex.http; /** * This enumeration contains the supported HTTP methods. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public enum HTTPMethod { /** GET method. */ GET, /** POST method. */ POST, /** PUT method. */ PUT, /** DELETE method. */ DELETE, /** HEAD method. */ HEAD, /** OPTIONS method. */ OPTIONS; /** * Finds the specified method, or returns {@code null}. * @param name method name * @return method */ public static HTTPMethod get(final String name) { for(final HTTPMethod m : values()) if(m.name().equals(name)) return m; return null; } } basex-7.7.2/basex-api/src/main/java/org/basex/http/HTTPText.java000066400000000000000000000020001222453003200242560ustar00rootroot00000000000000package org.basex.http; /** * This class assembles texts which are used in the HTTP classes. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public interface HTTPText { /** WWW-Authentication string. */ String WWW_AUTHENTICATE = "WWW-Authenticate"; /** HTTP header: Authorization. */ String AUTHORIZATION = "Authorization"; /** HTTP basic authentication. */ String BASIC = "Basic"; /** Location string. */ String LOCATION = "location"; /** HTTP String. */ String HTTP = "HTTP"; /** WEB-INF directory. */ String WEB_INF = "WEB-INF/"; /** Path to jetty configuration file. */ String JETTYCONF = WEB_INF + "jetty.xml"; /** Path to web configuration file. */ String WEBCONF = WEB_INF + "web.xml"; /** Error: no password. */ String NOPASSWD = "No username/password specified."; /** Error: unsupported authorization method. */ String WHICHAUTH = "Unsupported Authorization method: %."; /** Error message. */ String UNEXPECTED = "Unexpected error: %"; } basex-7.7.2/basex-api/src/main/java/org/basex/http/SessionListener.java000066400000000000000000000016231222453003200257750ustar00rootroot00000000000000package org.basex.http; import java.util.*; import javax.servlet.http.*; /** * This class bundles context-based information on a single HTTP operation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class SessionListener implements HttpSessionListener { /** Sessions. */ private static HashMap sessions; @Override public void sessionCreated(final HttpSessionEvent event) { final HttpSession sess = event.getSession(); sessions().put(sess.getId(), sess); } @Override public void sessionDestroyed(final HttpSessionEvent event) { sessions().remove(event.getSession().getId()); } /** * Initializes the HTTP context. * @return context; */ public static synchronized HashMap sessions() { if(sessions == null) sessions = new HashMap(); return sessions; } } basex-7.7.2/basex-api/src/main/java/org/basex/http/rest/000077500000000000000000000000001222453003200227545ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/java/org/basex/http/rest/RESTCode.java000066400000000000000000000075651222453003200252040ustar00rootroot00000000000000package org.basex.http.rest; import static org.basex.http.rest.RESTText.*; import static org.basex.query.func.Function.*; import java.io.*; import java.util.*; import java.util.Map.Entry; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.core.cmd.Set; import org.basex.http.*; import org.basex.io.serial.*; import org.basex.server.*; import org.basex.util.*; /** * Abstract class for performing REST operations. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class RESTCode { /** * Performs the REST operation. * @param http HTTP context * @throws IOException I/O exception */ abstract void run(final HTTPContext http) throws IOException; /** * Opens the addressed database. * @param http HTTP context * @throws HTTPException REST exception */ static void open(final HTTPContext http) throws HTTPException { final String db = http.db(); if(db == null) return; try { http.session().execute(new Open(db)); final String path = http.dbpath(); if(!path.isEmpty()) http.session().execute(new Cs(_DB_OPEN.args(db, path))); } catch(final IOException ex) { HTTPErr.NOT_FOUND_X.thrw(ex); } } /** * Sets the wrapping flag. * @param val value * @param http HTTP context * @throws HTTPException REST exception */ static void wrap(final String val, final HTTPContext http) throws HTTPException { http.wrapping = Util.yes(val); if(!http.wrapping && !Util.no(val)) { try { SerializerProp.error(WRAP, val, Text.YES, Text.NO); } catch(final SerializerException ex) { HTTPErr.BAD_REQUEST_X.thrw(ex); } } } /** * Checks if any resource with the specified name exists. * @param http HTTP context * @return number of documents * @throws IOException I/O exception */ protected static boolean exists(final HTTPContext http) throws IOException { final LocalQuery q = http.session().query(_DB_EXISTS.args("$d", "$p")); q.bind("d", http.db()); q.bind("p", http.dbpath()); return q.execute().equals(Text.TRUE); } /** * Checks if the specified path points to a binary resource. * @param http HTTP context * @return result of check * @throws IOException I/O exception */ protected static boolean isRaw(final HTTPContext http) throws IOException { final LocalQuery q = http.session().query(_DB_IS_RAW.args("$d", "$p")); q.bind("d", http.db()); q.bind("p", http.dbpath()); return q.execute().equals(Text.TRUE); } /** * Returns the content type of a database resource. * @param http HTTP context * @return content type * @throws IOException I/O exception */ protected static String contentType(final HTTPContext http) throws IOException { final LocalQuery q = http.session().query(_DB_CONTENT_TYPE.args("$d", "$p")); q.bind("d", http.db()); q.bind("p", http.dbpath()); return q.execute(); } /** * Parses and sets database options. * Throws an exception if an option is unknown. * @param http HTTP context * @throws IOException I/O exception */ static void parseOptions(final HTTPContext http) throws IOException { for(final Entry param : http.params().entrySet()) { parseOption(http, param, true); } } /** * Parses and sets a single database option. * @param http HTTP context * @param param current parameter * @param force force execution * @return success flag * @throws IOException I/O exception */ static boolean parseOption(final HTTPContext http, final Entry param, final boolean force) throws IOException { final String key = param.getKey().toUpperCase(Locale.ENGLISH); final boolean found = http.context().prop.get(key) != null; if(found || force) http.session().execute(new Set(key, param.getValue()[0])); return found; } } basex-7.7.2/basex-api/src/main/java/org/basex/http/rest/RESTCommand.java000066400000000000000000000017361222453003200257020ustar00rootroot00000000000000package org.basex.http.rest; import java.io.*; import org.basex.data.*; import org.basex.http.*; import org.basex.io.serial.*; import org.basex.server.*; /** * REST-based evaluation of database commands. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class RESTCommand extends RESTCode { /** Query input. */ protected final String input; /** * Constructor. * @param in command to be executed */ RESTCommand(final String in) { input = in; } @Override void run(final HTTPContext http) throws IOException { // open addressed database open(http); // set default content type to raw final String sprop = SerializerProp.S_METHOD[0] + "=" + DataText.M_TEXT + ',' + http.serialization; http.initResponse(new SerializerProp(sprop)); // perform command final LocalSession session = http.session(); session.setOutputStream(http.res.getOutputStream()); session.execute(input); } } basex-7.7.2/basex-api/src/main/java/org/basex/http/rest/RESTDelete.java000066400000000000000000000015361222453003200255240ustar00rootroot00000000000000package org.basex.http.rest; import static org.basex.util.Token.*; import java.io.*; import org.basex.core.cmd.*; import org.basex.http.*; import org.basex.server.*; /** * REST-based evaluation of DELETE operations. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class RESTDelete extends RESTCode { @Override void run(final HTTPContext http) throws IOException { // parse database options parseOptions(http); // open addressed database open(http); final LocalSession session = http.session(); if(http.depth() == 0) { HTTPErr.NO_PATH.thrw(); } else if(http.depth() == 1) { session.execute(new DropDB(http.db())); } else { session.execute(new Delete(http.dbpath())); } // return command info http.res.getOutputStream().write(token(session.info())); } } basex-7.7.2/basex-api/src/main/java/org/basex/http/rest/RESTGet.java000066400000000000000000000037771222453003200250520ustar00rootroot00000000000000package org.basex.http.rest; import static org.basex.http.rest.RESTText.*; import java.io.*; import java.util.*; import java.util.Map.Entry; import org.basex.http.*; import org.basex.io.serial.*; import org.basex.util.*; /** * This class processes GET requests sent to the REST server. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class RESTGet extends RESTCode { @Override void run(final HTTPContext http) throws IOException { final Map vars = new HashMap(); // handle query parameters String operation = null; String input = null; byte[] item = null; // parse database options final TokenBuilder ser = new TokenBuilder(); final SerializerProp sp = new SerializerProp(); for(final Entry param : http.params().entrySet()) { final String key = param.getKey(); final String[] vals = param.getValue(); final String val = vals[0]; if(Token.eqic(key, COMMAND, QUERY, RUN)) { if(operation != null || vals.length > 1) HTTPErr.ONEOP.thrw(); operation = key; input = val; } else if(key.equalsIgnoreCase(WRAP)) { // wrapping flag wrap(val, http); } else if(key.equalsIgnoreCase(CONTEXT)) { // context parameter item = Token.token(val); } else if(sp.get(key) != null) { // serialization parameters for(final String v : vals) ser.add(key).add('=').add(v).add(','); } else if(!parseOption(http, param, false)) { // external variables vars.put(key, new String[] { val }); } } http.serialization = ser.toString(); final RESTCode code; if(operation == null) { code = new RESTRetrieve(input, vars, item); } else if(operation.equals(QUERY)) { code = new RESTQuery(input, vars, item); } else if(operation.equals(RUN)) { code = new RESTRun(input, vars, item); } else { code = new RESTCommand(input); } code.run(http); } } basex-7.7.2/basex-api/src/main/java/org/basex/http/rest/RESTPost.java000066400000000000000000000112221222453003200252400ustar00rootroot00000000000000package org.basex.http.rest; import static org.basex.http.rest.RESTText.*; import java.io.*; import java.util.*; import javax.xml.parsers.*; import javax.xml.transform.dom.*; import org.basex.core.*; import org.basex.core.cmd.Set; import org.basex.http.*; import org.basex.io.*; import org.basex.io.in.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.util.*; /** * REST-based evaluation of POST operations. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class RESTPost extends RESTCode { @Override void run(final HTTPContext http) throws IOException { parseOptions(http); String enc = http.req.getCharacterEncoding(); if(enc == null) enc = Token.UTF8; // perform queries final byte[] in = new NewlineInput(http.req.getInputStream()).encoding(enc).content(); validate(in); final Context ctx = http.context(); DBNode doc; try { doc = new DBNode(new IOContent(in), ctx.prop); } catch(final IOException ex) { throw HTTPErr.BAD_REQUEST_X.thrw(ex); } final SerializerProp sp = new SerializerProp(); QueryProcessor qp; RESTCode code; try { // handle serialization parameters final TokenBuilder ser = new TokenBuilder(); qp = new QueryProcessor("*/*:parameter", ctx).context(doc); for(final Item param : qp.value()) { final String name = value("data(@name)", param, ctx); final String value = value("data(@value)", param, ctx); if(sp.get(name) != null) { ser.add(name).add('=').add(value).add(','); } else if(name.equals(WRAP)) { wrap(value, http); } else { HTTPErr.UNKNOWN_PARAM_X.thrw(name); } } http.serialization = ser.toString(); // handle database options qp = new QueryProcessor("*/*:option", ctx).context(doc); for(final Item it : qp.value()) { final String name = value("data(@name)", it, ctx); final String value = value("data(@value)", it, ctx); http.session().execute(new Set(name, value)); } // handle variables final Map vars = new HashMap(); qp = new QueryProcessor("*/*:variable", ctx).context(doc); for(final Item it : qp.value()) { final String name = value("data(@name)", it, ctx); final String value = value("data(@value)", it, ctx); final String type = value("data(@type)", it, ctx); vars.put(name, new String[] { value, type }); } // handle input byte[] item = null; qp = new QueryProcessor("*/*:context/node()", ctx).context(doc); for(final Item it : qp.value()) { if(item != null) HTTPErr.MULTIPLE_CONTEXT_X.thrw(); // create main memory instance of the specified node item = DataBuilder.stripNS((ANode) it, Token.token(RESTURI), ctx). serialize().toArray(); } // handle request final String request = value("local-name(*)", doc, ctx); final String text = value("*/*:text/text()", doc, ctx); if(request.equals(COMMAND)) { code = new RESTCommand(text); } else if(request.equals(RUN)) { code = new RESTRun(text, vars, item); } else { code = new RESTQuery(text, vars, item); } code.run(http); } catch(final QueryException ex) { HTTPErr.BAD_REQUEST_X.thrw(ex); } } /** * Returns the atomized item for the specified query. * @param query query * @param item context item * @param ctx database context * @return atomized item * @throws QueryException query exception */ private static String value(final String query, final Item item, final Context ctx) throws QueryException { final QueryProcessor qp = new QueryProcessor(query, ctx).context(item); final Item it = qp.iter().next(); return it == null ? null : Token.string(it.string(null)); } /** * Validates the specified XML input against the POST schema. * @param input input document * @throws HTTPException exception */ private static void validate(final byte[] input) throws HTTPException { try { final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); final DocumentBuilder db = dbf.newDocumentBuilder(); RESTSchema.newValidator().validate(new DOMSource(db.parse(new ArrayInput(input)))); } catch(final Exception ex) { Util.debug("Error while validating \"" + Token.string(input) + '"'); // validation fails HTTPErr.BAD_REQUEST_X.thrw(ex); } } } basex-7.7.2/basex-api/src/main/java/org/basex/http/rest/RESTPut.java000066400000000000000000000037051222453003200250720ustar00rootroot00000000000000package org.basex.http.rest; import static org.basex.io.MimeTypes.*; import java.io.*; import org.basex.core.cmd.*; import org.basex.http.*; import org.basex.io.*; import org.basex.io.in.*; import org.basex.server.*; /** * REST-based evaluation of PUT operations. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class RESTPut extends RESTCode { @Override void run(final HTTPContext http) throws IOException { // parse database options parseOptions(http); // create new database or update resource final LocalSession session = http.session(); if(http.depth() == 0) HTTPErr.NO_PATH.thrw(); boolean xml = true; final InputStream in = http.req.getInputStream(); final String ct = http.contentType(); // choose correct importer if(APP_JSON.equals(ct)) { session.execute("set parser json"); } else if(APP_JSONML.equals(ct)) { session.execute("set parser json"); session.execute("set parseropt jsonml=true"); } else if(TEXT_CSV.equals(ct)) { session.execute("set parser csv"); } else if(TEXT_HTML.equals(ct)) { session.execute("set parser html"); } else if(ct != null && MimeTypes.isText(ct)) { session.execute("set parser text"); } else if(ct != null && !MimeTypes.isXML(ct)) { xml = false; } if(http.depth() == 1) { // store data as XML or raw file, depending on content type if(xml) { session.create(http.db(), in); } else { session.create(http.db(), new ArrayInput("")); session.store(http.db(), in); } } else { open(http); // store data as XML or raw file, depending on content type if(xml) { session.replace(http.dbpath(), in); } else { session.execute(new Delete(http.dbpath())); session.store(http.dbpath(), in); } } // return correct status and command info throw HTTPErr.CREATED_X.thrw(session.info()); } } basex-7.7.2/basex-api/src/main/java/org/basex/http/rest/RESTQuery.java000066400000000000000000000064271222453003200254330ustar00rootroot00000000000000package org.basex.http.rest; import static org.basex.core.Text.*; import static org.basex.http.rest.RESTText.*; import java.io.*; import java.util.*; import java.util.Map.Entry; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.core.cmd.Set; import org.basex.http.*; import org.basex.io.in.*; import org.basex.io.serial.*; import org.basex.server.*; import org.basex.util.*; /** * REST-based evaluation of XQuery expressions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ class RESTQuery extends RESTCode { /** External variables. */ protected final Map variables; /** Query input. */ protected final String input; /** Optional context item. */ protected final byte[] item; /** * Constructor. * @param in query to be executed * @param vars external variables * @param it context item */ RESTQuery(final String in, final Map vars, final byte[] it) { input = in; variables = vars; item = it; } @Override void run(final HTTPContext http) throws IOException { query(input, http, http.context().mprop.get(MainProp.WEBPATH)); } /** * Evaluates the specified query. * @param in query input * @param http HTTP context * @param path set query path * @throws HTTPException REST exception * @throws IOException I/O exception */ protected void query(final String in, final HTTPContext http, final String path) throws IOException { final LocalSession session = http.session(); if(item != null) { // create main memory instance of the document specified as context node final boolean mm = session.execute( new Get(Prop.MAINMEM)).split(COLS)[1].equals(TRUE); session.execute(new Set(Prop.MAINMEM, true)); session.create(Util.name(RESTQuery.class), new ArrayInput(item)); if(!mm) session.execute(new Set(Prop.MAINMEM, false)); } else { // open addressed database open(http); } // send serialization options to the server session.execute(new Set(Prop.SERIALIZER, serial(http))); session.setOutputStream(http.res.getOutputStream()); // set base path to correctly resolve local references session.execute(new Set(Prop.QUERYPATH, path)); // create query instance and bind http context final Query qu = session.query(in); qu.context(http); // bind external variables for(final Entry e : variables.entrySet()) { final String[] val = e.getValue(); if(val.length == 2) qu.bind(e.getKey(), val[0], val[1]); if(val.length == 1) qu.bind(e.getKey(), val[0]); } // initializes the response with query serialization options http.initResponse(new SerializerProp(qu.options())); // run query qu.execute(); } /** * Returns a string representation of the used serialization parameters. * @param http HTTP context * @return serialization parameters */ static String serial(final HTTPContext http) { final TokenBuilder ser = new TokenBuilder(http.serialization); if(http.wrapping) { if(!ser.isEmpty()) ser.add(','); ser.addExt(SerializerProp.S_WRAP_PREFIX[0]).add('=').add(REST).add(','); ser.addExt(SerializerProp.S_WRAP_URI[0]).add('=').add(RESTURI); } return ser.toString(); } } basex-7.7.2/basex-api/src/main/java/org/basex/http/rest/RESTRetrieve.java000066400000000000000000000066601222453003200261120ustar00rootroot00000000000000package org.basex.http.rest; import static org.basex.http.rest.RESTText.*; import static org.basex.util.Token.*; import java.io.*; import java.util.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.core.cmd.List; import org.basex.core.cmd.Set; import org.basex.http.*; import org.basex.io.serial.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.server.*; import org.basex.util.*; import org.basex.util.list.*; /** * This class retrieves resources. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class RESTRetrieve extends RESTQuery { /** * Constructor. * @param in input file to be executed * @param vars external variables * @param it context item */ RESTRetrieve(final String in, final Map vars, final byte[] it) { super(in, vars, it); } @Override void run(final HTTPContext http) throws IOException { // open addressed database open(http); final LocalSession session = http.session(); if(http.depth() == 0) { // list databases final Table table = new Table(session.execute(new List())); final SerializerProp sprop = new SerializerProp(http.serialization); final Serializer ser = Serializer.get(http.res.getOutputStream(), sprop); http.initResponse(sprop); final FElem el = new FElem(Q_DATABASES).declareNS(); el.add(RESOURCES, token(table.contents.size())); list(table, el, Q_DATABASE, 1); ser.serialize(el); ser.close(); } else if(!exists(http)) { // list database resources final Table table = new Table(session.execute(new List(http.db(), http.dbpath()))); final String serial = http.serialization; final SerializerProp sprop = new SerializerProp(serial); final Serializer ser = Serializer.get(http.res.getOutputStream(), sprop); http.initResponse(sprop); final FElem el = new FElem(Q_DATABASE).declareNS(); el.add(NAME, http.db()); el.add(RESOURCES, token(table.contents.size())); list(table, el, Q_RESOURCE, 0); ser.serialize(el); ser.close(); } else if(isRaw(http)) { // retrieve raw file; prefix user parameters with media type final String ct = SerializerProp.S_MEDIA_TYPE[0] + "=" + contentType(http); http.initResponse(new SerializerProp(ct + ',' + http.serialization)); session.setOutputStream(http.res.getOutputStream()); session.execute(new Retrieve(http.dbpath())); } else { // retrieve xml file http.initResponse(new SerializerProp(http.serialization)); session.execute(new Set(Prop.SERIALIZER, serial(http))); session.setOutputStream(http.res.getOutputStream()); session.query(".").execute(); } } /** * Lists the table contents. * @param table table reference * @param root root node * @param header table header * @param skip number of columns to skip */ private static void list(final Table table, final FElem root, final QNm header, final int skip) { for(final TokenList l : table.contents) { final FElem el = new FElem(header); // don't show last attribute (input path) for(int i = 1; i < l.size() - skip; i++) { el.add(new QNm(lc(table.header.get(i))), l.get(i)); } el.add(l.get(0)); root.add(el); } } } basex-7.7.2/basex-api/src/main/java/org/basex/http/rest/RESTRun.java000066400000000000000000000021521222453003200250610ustar00rootroot00000000000000package org.basex.http.rest; import static org.basex.core.Text.*; import java.io.*; import java.util.*; import org.basex.core.*; import org.basex.http.*; import org.basex.io.*; import org.basex.util.*; /** * REST-based evaluation of XQuery files. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class RESTRun extends RESTQuery { /** * Constructor. * @param in input file to be executed * @param vars external variables * @param it context item */ RESTRun(final String in, final Map vars, final byte[] it) { super(in, vars, it); } @Override void run(final HTTPContext http) throws IOException { // get root directory for files final IOFile root = new IOFile(http.context().mprop.get(MainProp.WEBPATH)); // check if file is not found, is a folder or points to parent folder final IOFile io = new IOFile(root, input); if(!io.exists() || io.isDir() || !io.path().startsWith(root.path())) HTTPErr.NOT_FOUND_X.thrw(Util.info(RES_NOT_FOUND_X, input)); // perform query query(io.string(), http, io.path()); } } basex-7.7.2/basex-api/src/main/java/org/basex/http/rest/RESTSchema.java000066400000000000000000000066251222453003200255260ustar00rootroot00000000000000package org.basex.http.rest; import javax.xml.*; import javax.xml.transform.stream.*; import javax.xml.validation.*; import org.basex.io.in.*; import org.basex.util.*; import org.xml.sax.*; /** * XML Schemas for REST requests. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ enum RESTSchema { /** Single instance. */ INSTANCE; /** Validation schema. */ private final Schema schema; /** Constructor. */ private RESTSchema() { Schema s = null; try { s = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI). newSchema(new StreamSource(new ArrayInput(Token.token(SCHEMA_CONTENT)))); } catch(final SAXException ex) { Util.notexpected(ex); } schema = s; } /** * Create a new validator against the schema. * @return a new validator */ static Validator newValidator() { return INSTANCE.schema.newValidator(); } /** Post Schema. */ private static final String SCHEMA_CONTENT = "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + ""; } basex-7.7.2/basex-api/src/main/java/org/basex/http/rest/RESTServlet.java000066400000000000000000000016661222453003200257520ustar00rootroot00000000000000package org.basex.http.rest; import org.basex.http.*; /** *

This servlet receives and processes REST requests.

* * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class RESTServlet extends BaseXServlet { @Override protected void run(final HTTPContext http) throws Exception { code(http).run(http); } /** * Returns the correct code for the specified HTTP method, or an exception. * @param http HTTP method * @return code * @throws HTTPException HTTP exception */ private static RESTCode code(final HTTPContext http) throws HTTPException { final HTTPMethod mth = http.method; if(mth == HTTPMethod.GET) return new RESTGet(); if(mth == HTTPMethod.POST) return new RESTPost(); if(mth == HTTPMethod.PUT) return new RESTPut(); if(mth == HTTPMethod.DELETE) return new RESTDelete(); throw HTTPErr.NOT_IMPLEMENTED_X.thrw(http.req.getMethod()); } } basex-7.7.2/basex-api/src/main/java/org/basex/http/rest/RESTText.java000066400000000000000000000016721222453003200252470ustar00rootroot00000000000000package org.basex.http.rest; import org.basex.core.*; import org.basex.query.value.item.*; /** * This class assembles texts which are used in the HTTP classes. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public interface RESTText { /** REST string. */ String REST = "rest"; /** REST URI. */ String RESTURI = Text.URL + '/' + REST; /** Name. */ QNm Q_DATABASES = QNm.get(REST, "databases", RESTURI); /** Name. */ QNm Q_DATABASE = QNm.get(REST, "databases", RESTURI); /** Name. */ QNm Q_RESOURCE = QNm.get(REST, "resource", RESTURI); /** Attribute. */ String RESOURCES = "resources"; /** Attribute. */ String NAME = "name"; /** Command operation. */ String COMMAND = "command"; /** Run operation. */ String RUN = "run"; /** Query operation. */ String QUERY = "query"; /** Wrap parameter. */ String WRAP = "wrap"; /** Initial context. */ String CONTEXT = "context"; } basex-7.7.2/basex-api/src/main/java/org/basex/http/restxq/000077500000000000000000000000001222453003200233255ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/java/org/basex/http/restxq/RestXqError.java000066400000000000000000000016071222453003200264340ustar00rootroot00000000000000package org.basex.http.restxq; import org.basex.query.value.item.*; import org.basex.util.*; /** * This class contains a RESTXQ error. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class RestXqError implements Comparable { /** Error code ({@code null}: wildcard). */ final QNm code; /** * Constructor. * @param error error code ({@code null}: wildcard) */ RestXqError(final QNm error) { code = error; } /** * Checks if the specified name matches the test. * @param nm name * @return result of check */ boolean matches(final QNm nm) { return code == null || code.eq(nm); } @Override public int compareTo(final RestXqError rxe) { return code == null ? rxe.code == null ? 0 : -1 : 1; } @Override public String toString() { return code == null ? "*" : Token.string(code.string()); } } basex-7.7.2/basex-api/src/main/java/org/basex/http/restxq/RestXqFunction.java000066400000000000000000000452301222453003200271300ustar00rootroot00000000000000package org.basex.http.restxq; import static org.basex.http.HTTPMethod.*; import static org.basex.http.restxq.RestXqText.*; import static org.basex.util.Token.*; import java.io.*; import java.net.*; import java.util.*; import java.util.regex.*; import javax.servlet.http.*; import org.basex.core.*; import org.basex.http.*; import org.basex.io.*; import org.basex.io.in.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.func.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.util.http.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.list.*; /** * This class represents a single RESTXQ function. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class RestXqFunction implements Comparable { /** Pattern for a single template. */ private static final Pattern TEMPLATE = Pattern.compile("\\s*\\{\\s*\\$(.+?)\\s*\\}\\s*"); /** Supported methods. */ EnumSet methods = EnumSet.allOf(HTTPMethod.class); /** Serialization parameters. */ final SerializerProp output; /** Associated function. */ final StaticFunc function; /** Associated module. */ final RestXqModule module; /** Path. */ RestXqPath path; /** Error. */ RestXqError error; /** Query parameters. */ final ArrayList errorParams = new ArrayList(); /** Query parameters. */ final ArrayList queryParams = new ArrayList(); /** Form parameters. */ final ArrayList formParams = new ArrayList(); /** Header parameters. */ final ArrayList headerParams = new ArrayList(); /** Cookie parameters. */ final ArrayList cookieParams = new ArrayList(); /** Query context. */ private final QueryContext context; /** Consumed media types. */ private final StringList consumes = new StringList(); /** Returned media types. */ private final StringList produces = new StringList(); /** Post/Put variable. */ private QNm requestBody; /** * Constructor. * @param uf associated user function * @param qc query context * @param m associated module */ RestXqFunction(final StaticFunc uf, final QueryContext qc, final RestXqModule m) { function = uf; context = qc; module = m; output = qc.serParams(false); } /** * Processes the HTTP request. * Parses new modules and discards obsolete ones. * @param http HTTP context * @param exc optional query exception * @throws Exception exception */ void process(final HTTPContext http, final QueryException exc) throws Exception { try { module.process(http, this, exc); } catch(final QueryException ex) { if(ex.file() == null) ex.info(function.info); throw ex; } } /** * Checks a function for RESTFful annotations. * @return {@code true} if module contains relevant annotations * @throws QueryException query exception */ boolean parse() throws QueryException { // parse all annotations final EnumSet mth = EnumSet.noneOf(HTTPMethod.class); final boolean[] declared = new boolean[function.args.length]; boolean found = false; final int as = function.ann.size(); for(int a = 0; a < as; a++) { final QNm name = function.ann.names[a]; final Value value = function.ann.values[a]; final InputInfo info = function.ann.infos[a]; final byte[] local = name.local(); final byte[] uri = name.uri(); final boolean rexq = eq(uri, QueryText.RESTURI); if(rexq) { if(eq(PATH, local)) { // annotation "path" if(path != null) error(info, ANN_TWICE, "%", name.string()); path = new RestXqPath(toString(value, name)); for(final String s : path) { if(s.trim().startsWith("{")) checkVariable(s, AtomType.AAT, declared); } } else if(eq(ERROR, local)) { // annotation "error" if(error != null) error(info, ANN_TWICE, "%", name.string()); error = error(value, name); } else if(eq(CONSUMES, local)) { // annotation "consumes" strings(value, name, consumes); } else if(eq(PRODUCES, local)) { // annotation "produces" strings(value, name, produces); } else if(eq(QUERY_PARAM, local)) { // annotation "query-param" queryParams.add(param(value, name, declared)); } else if(eq(FORM_PARAM, local)) { // annotation "form-param" formParams.add(param(value, name, declared)); } else if(eq(HEADER_PARAM, local)) { // annotation "header-param" headerParams.add(param(value, name, declared)); } else if(eq(COOKIE_PARAM, local)) { // annotation "cookie-param" cookieParams.add(param(value, name, declared)); } else if(eq(ERROR_PARAM, local)) { // annotation "error-param" errorParams.add(param(value, name, declared)); } else { // method annotations final HTTPMethod m = HTTPMethod.get(string(local)); if(m == null) error(info, ANN_UNKNOWN, "%", name.string()); if(!value.isEmpty()) { // remember post/put variable if(requestBody != null) error(info, ANN_TWICE, "%", name.string()); if(m != POST && m != PUT) error(info, METHOD_VALUE, m); requestBody = checkVariable(toString(value, name), declared); } if(mth.contains(m)) error(info, ANN_TWICE, "%", name.string()); mth.add(m); } } else if(eq(uri, QueryText.OUTPUTURI)) { // serialization parameters final String key = string(local); final String val = toString(value, name); if(output.get(key) == null) error(info, UNKNOWN_SER, key); output.set(key, val); } found |= rexq; } if(!mth.isEmpty()) methods = mth; if(found) { if(path == null && error == null) error(function.info, ANN_MISSING, '%', PATH, '%', ERROR); for(int i = 0; i < declared.length; i++) { if(declared[i]) continue; error(function.info, VAR_UNDEFINED, function.args[i].name.string()); } } return found; } /** * Checks if an HTTP request matches this function and its constraints. * @param http http context * @param err error code * @return result of check */ boolean matches(final HTTPContext http, final QNm err) { // check method, consumed and produced media type, and path or error return methods.contains(http.method) && consumes(http) && produces(http) && (err == null ? path != null && path.matches(http) : error != null && error.matches(err)); } /** * Binds the annotated variables. * @param http http context * @param arg argument array * @param err optional query error * @throws QueryException query exception * @throws IOException I/O exception */ void bind(final HTTPContext http, final Expr[] arg, final QueryException err) throws QueryException, IOException { // bind variables from segments if(path != null) { for(int s = 0; s < path.size; s++) { final Matcher m = TEMPLATE.matcher(path.segment[s]); if(!m.find()) continue; final QNm qnm = new QNm(token(m.group(1)), context); bind(qnm, arg, new Atm(http.segment(s))); } } // cache request body final String ct = http.contentType(); IOContent body = null; if(requestBody != null) { // bind request body in the correct format body = cache(http, null); try { final String ext = http.contentTypeExt(); bind(requestBody, arg, HTTPPayload.value(body, context.context.prop, ct, ext)); } catch(final IOException ex) { error(INPUT_CONV, ex); } } // convert parameters to XQuery values final Map params = new HashMap(); for(final Map.Entry entry : http.params().entrySet()) { final String[] values = entry.getValue(); final ValueBuilder vb = new ValueBuilder(values.length); for(final String v : values) vb.add(new Atm(v)); params.put(entry.getKey(), vb.value()); } // bind query parameters for(final RestXqParam rxp : queryParams) bind(rxp, arg, params.get(rxp.key)); // bind form parameters if(!formParams.isEmpty()) { if(MimeTypes.MULTIPART_FORM_DATA.equals(ct)) { // convert multipart parameters encoded in a form addMultipart(cache(http, body), params, http.contentTypeExt()); } else if(MimeTypes.APP_FORM_URLENCODED.equals(ct)) { // convert URL-encoded parameters addURLEncoded(cache(http, body), params); } for(final RestXqParam rxp : formParams) bind(rxp, arg, params.get(rxp.key)); } // bind header parameters for(final RestXqParam rxp : headerParams) { final TokenList tl = new TokenList(); final Enumeration en = http.req.getHeaders(rxp.key); while(en.hasMoreElements()) { for(final String s : en.nextElement().toString().split(", *")) tl.add(s); } bind(rxp, arg, StrSeq.get(tl)); } // bind cookie parameters final Cookie[] ck = http.req.getCookies(); for(final RestXqParam rxp : cookieParams) { Value val = Empty.SEQ; if(ck != null) { for(final Cookie c : ck) { if(rxp.key.equals(c.getName())) val = Str.get(c.getValue()); } } bind(rxp, arg, val); } // bind errors final Map errs = new HashMap(); if(err != null) { final Value[] values = Catch.values(err); for(int v = 0; v < Catch.NAMES.length; v++) { errs.put(string(Catch.NAMES[v].local()), values[v]); } } for(final RestXqParam rxp : errorParams) bind(rxp, arg, errs.get(rxp.key)); } /** * Creates an exception with the specified message. * @param msg message * @param ext error extension * @return exception * @throws QueryException query exception */ QueryException error(final String msg, final Object... ext) throws QueryException { throw error(function.info, msg, ext); } /** * Creates an exception with the specified message. * @param info input info * @param msg message * @param ext error extension * @return exception * @throws QueryException query exception */ QueryException error(final InputInfo info, final String msg, final Object... ext) throws QueryException { throw new QueryException(info, Err.BASX_RESTXQ, Util.info(msg, ext)); } @Override public int compareTo(final RestXqFunction rxf) { return path == null ? error.compareTo(rxf.error) : path.compareTo(rxf.path); } // PRIVATE METHODS ==================================================================== /** * Checks the specified template and adds a variable. * @param tmp template string * @param declared variable declaration flags * @return resulting variable * @throws QueryException query exception */ private QNm checkVariable(final String tmp, final boolean[] declared) throws QueryException { return checkVariable(tmp, AtomType.ITEM, declared); } /** * Checks the specified template and adds a variable. * @param tmp template string * @param type allowed type * @param declared variable declaration flags * @return resulting variable * @throws QueryException query exception */ private QNm checkVariable(final String tmp, final Type type, final boolean[] declared) throws QueryException { final Var[] args = function.args; final Matcher m = TEMPLATE.matcher(tmp); if(!m.find()) error(INV_TEMPLATE, tmp); final byte[] vn = token(m.group(1)); if(!XMLToken.isQName(vn)) error(INV_VARNAME, vn); final QNm name = new QNm(vn); if(name.hasPrefix()) name.uri(context.sc.ns.uri(name.prefix())); int r = -1; while(++r < args.length && !args[r].name.eq(name)); if(r == args.length) error(UNKNOWN_VAR, vn); if(declared[r]) error(VAR_ASSIGNED, vn); final SeqType st = args[r].declaredType(); if(args[r].checksType() && !st.type.instanceOf(type)) error(INV_VARTYPE, vn, type); declared[r] = true; return name; } /** * Checks if the consumed content type matches. * @param http http context * @return result of check */ private boolean consumes(final HTTPContext http) { // return true if no type is given if(consumes.isEmpty()) return true; // return true if no content type is specified by the user final String ct = http.contentType(); if(ct == null) return true; // check if any combination matches for(final String c : consumes) { if(MimeTypes.matches(c, ct)) return true; } return false; } /** * Checks if the produced content type matches. * @param http http context * @return result of check */ private boolean produces(final HTTPContext http) { // return true if no type is given if(produces.isEmpty()) return true; // check if any combination matches for(final String pr : http.produces()) { for(final String p : produces) { if(MimeTypes.matches(p, pr)) return true; } } return false; } /** * Binds the specified parameter to a variable. * @param rxp parameter * @param args argument array * @param value values to be bound; the parameter's default value is assigned * if the argument is {@code null} or empty * @throws QueryException query exception */ private void bind(final RestXqParam rxp, final Expr[] args, final Value value) throws QueryException { bind(rxp.name, args, value == null || value.isEmpty() ? rxp.value : value); } /** * Binds the specified value to a variable. * @param name variable name * @param args argument array * @param value value to be bound * @throws QueryException query exception */ private void bind(final QNm name, final Expr[] args, final Value value) throws QueryException { // skip nulled values if(value == null) return; for(int i = 0; i < function.args.length; i++) { final Var var = function.args[i]; if(!var.name.eq(name)) continue; // casts and binds the value final SeqType decl = var.declaredType(); final Value val = value.type().instanceOf(decl) ? value : decl.cast(value, context, null, var); args[i] = var.checkType(val, context, null); break; } } /** * Returns the specified value as an atomic string. * @param value value * @param name name * @return string * @throws QueryException HTTP exception */ private String toString(final Value value, final QNm name) throws QueryException { if(!(value instanceof Str)) error(function.info, ANN_STRING, "%", name.string(), value); return ((Str) value).toJava(); } /** * Adds items to the specified list. * @param value value * @param name name * @param list list to add values to * @throws QueryException HTTP exception */ private void strings(final Value value, final QNm name, final StringList list) throws QueryException { final long vs = value.size(); for(int v = 0; v < vs; v++) list.add(toString(value.itemAt(v), name)); } /** * Returns a parameter. * @param value value * @param name name * @param declared variable declaration flags * @return parameter * @throws QueryException HTTP exception */ private RestXqParam param(final Value value, final QNm name, final boolean[] declared) throws QueryException { final long vs = value.size(); if(vs < 2) error(function.info, ANN_ATLEAST, "%", name.string(), 2); // name of parameter final String key = toString(value.itemAt(0), name); // variable template final QNm qnm = checkVariable(toString(value.itemAt(1), name), declared); // default value final ValueBuilder vb = new ValueBuilder(); for(int v = 2; v < vs; v++) vb.add(value.itemAt(v)); return new RestXqParam(qnm, key, vb.value()); } /** * Returns an error. * @param value value * @param name name * @return parameter * @throws QueryException HTTP exception */ private RestXqError error(final Value value, final QNm name) throws QueryException { if(value.size() != 1) error(function.info, ANN_EXACTLY, "%", name.string(), 1); // name of parameter final String err = toString(value.itemAt(0), name); QNm code = null; if(!err.equals("*")) { final byte[] c = token(err); if(!XMLToken.isQName(c)) error(INV_CODE, c); code = new QNm(c, context); if(!code.hasURI() && code.hasPrefix()) error(INV_NONS, code); } // message return new RestXqError(code); } /** * Adds multipart form-data from the passed on request body. * @param body request body * @param pars map parameters * @param ext content type extension (may be {@code null}) * @throws IOException I/O exception * @throws QueryException query exception */ private void addMultipart(final IOContent body, final Map pars, final String ext) throws IOException, QueryException { final Prop prop = context.context.prop; final HTTPPayload hp = new HTTPPayload(body.inputStream(), false, null, prop); final HashMap map = hp.multiForm(ext); for(final Map.Entry entry : map.entrySet()) { pars.put(entry.getKey(), entry.getValue()); } } // PRIVATE STATIC METHODS ============================================================= /** * Caches the request body, if not done yet. * @param http http context * @param cache cache existing cache reference * @return cache * @throws IOException I/O exception */ private static IOContent cache(final HTTPContext http, final IOContent cache) throws IOException { if(cache != null) return cache; final BufferInput bi = new BufferInput(http.req.getInputStream()); final IOContent io = new IOContent(bi.content()); io.name(http.method + IO.XMLSUFFIX); return io; } /** * Adds URL-encoded parameters from the passed on request body. * @param body request body * @param pars map parameters */ private static void addURLEncoded(final IOContent body, final Map pars) { for(final String nv : body.toString().split("&")) { final String[] parts = nv.split("=", 2); if(parts.length < 2) continue; try { pars.put(parts[0], Str.get(URLDecoder.decode(parts[1], Token.UTF8))); } catch(final Exception ex) { Util.notexpected(ex); } } } } basex-7.7.2/basex-api/src/main/java/org/basex/http/restxq/RestXqModule.java000066400000000000000000000070101222453003200265620ustar00rootroot00000000000000package org.basex.http.restxq; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.io.*; import java.util.*; import org.basex.http.*; import org.basex.io.*; import org.basex.query.*; import org.basex.query.func.*; /** * This class caches information on a single XQuery module with RESTXQ annotations. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class RestXqModule { /** Supported methods. */ private final ArrayList functions = new ArrayList(); /** File reference. */ private final IOFile file; /** Main module flag. */ private final boolean main; /** Parsing timestamp. */ private long time; /** * Constructor. * @param in xquery module * @param m main module flag */ RestXqModule(final IOFile in, final boolean m) { file = in; time = in.timeStamp(); main = m; } /** * Checks the module for RESTXQ annotations. * @param http http context * @return {@code true} if module contains relevant annotations * @throws QueryException query exception */ boolean parse(final HTTPContext http) throws QueryException { functions.clear(); // loop through all functions final QueryContext qc = parseModule(http); try { // loop through all functions for(final StaticFunc uf : qc.funcs.funcs()) { // consider only functions that are defined in this module if(!file.name().equals(new IOFile(uf.info.file()).name())) continue; final RestXqFunction rxf = new RestXqFunction(uf, qc, this); if(rxf.parse()) functions.add(rxf); } } finally { qc.close(); } return !functions.isEmpty(); } /** * Checks if the timestamp is still up-to-date. * @return result of check */ boolean uptodate() { return time == file.timeStamp(); } /** * Updates the timestamp. */ void touch() { time = file.timeStamp(); } /** * Returns all functions. * @return functions */ ArrayList functions() { return functions; } /** * Processes the HTTP request. * @param http HTTP context * @param func function to be processed * @param error optional error reference * @throws Exception exception */ void process(final HTTPContext http, final RestXqFunction func, final QueryException error) throws Exception { // create new XQuery instance final QueryContext qc = parseModule(http); try { // loop through all functions for(final StaticFunc uf : qc.funcs.funcs()) { // compare input info if(!func.function.info.equals(uf.info)) continue; final RestXqFunction rxf = new RestXqFunction(uf, qc, this); rxf.parse(); new RestXqResponse(rxf, qc, http, error).create(); break; } } finally { qc.close(); } } // PRIVATE METHODS ==================================================================== /** * Parses the module and returns the query context. * @param http http context * @return query context * @throws QueryException query exception */ private QueryContext parseModule(final HTTPContext http) throws QueryException { final QueryContext qc = new QueryContext(http.context()); try { final String cont = string(file.read()); final String path = file.path(); if(main) qc.parseMain(cont, path); else qc.parseLibrary(cont, path); return qc; } catch(final IOException ex) { throw IOERR.thrw(null, ex); } } } basex-7.7.2/basex-api/src/main/java/org/basex/http/restxq/RestXqModules.java000066400000000000000000000110121222453003200267420ustar00rootroot00000000000000package org.basex.http.restxq; import static org.basex.http.restxq.RestXqText.*; import java.io.*; import java.util.*; import org.basex.core.*; import org.basex.http.*; import org.basex.io.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.util.*; /** * This class caches RESTXQ modules found in the HTTP root directory. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class RestXqModules { /** Class instance. */ private static final RestXqModules INSTANCE = new RestXqModules(); /** Module cache. */ private HashMap modules = new HashMap(); /** RESTXQ path. */ private IOFile restxq; /** Private constructor. */ private RestXqModules() { } /** * Returns the singleton instance. * @return instance */ public static RestXqModules get() { return INSTANCE; } /** * Returns a WADL description for all available URIs. * @param http HTTP context * @return WADL description */ public FElem wadl(final HTTPContext http) { return new RestXqWadl(http).create(modules); } /** * Returns the function that matches the current request or the specified error code. * Returns {@code null} if no function matches. * @param http HTTP context * @param error error code (optional) * @throws QueryException query exception * @return function */ RestXqFunction find(final HTTPContext http, final QNm error) throws QueryException { cache(http); // collect all functions final ArrayList list = new ArrayList(); for(final RestXqModule mod : modules.values()) { for(final RestXqFunction rxf : mod.functions()) { if(rxf.matches(http, error)) list.add(rxf); } } // no path matches if(list.isEmpty()) return null; // choose most appropriate function RestXqFunction first = list.get(0); if(list.size() > 1) { // sort by specifity Collections.sort(list); first = list.get(0); // disallow more than one path with the same specifity if(first.compareTo(list.get(1)) == 0) { final TokenBuilder tb = new TokenBuilder(); for(final RestXqFunction rxf : list) { if(first.compareTo(rxf) != 0) break; tb.add(Prop.NL).add(rxf.function.info.toString()); } if(first.path != null) first.error(PATH_CONFLICT, first.path, tb); first.error(ERROR_CONFLICT, first.error, tb); } } // choose most specific function return first; } /** * Updates the module cache. Parses new modules and discards obsolete ones. * @param http http context * @throws QueryException query exception */ private synchronized void cache(final HTTPContext http) throws QueryException { // initialize RESTXQ directory (may be relative against WEBPATH) if(restxq == null) { final File fl = new File(http.context().mprop.get(MainProp.RESTXQPATH)); restxq = fl.isAbsolute() ? new IOFile(fl) : new IOFile(http.context().mprop.get(MainProp.WEBPATH), fl.getPath()); } // create new cache final HashMap cache = new HashMap(); cache(http, restxq, cache); modules = cache; } /** * Parses the specified path for RESTXQ modules and caches new entries. * @param root root path * @param http http context * @param cache cached modules * @throws QueryException query exception */ private synchronized void cache(final HTTPContext http, final IOFile root, final HashMap cache) throws QueryException { for(final IOFile file : root.children()) { if(file.isDir()) { cache(http, file, cache); } else { final String path = file.path(); final boolean main = path.endsWith(IO.XQSUFFIX); if(main || path.endsWith(IO.XQMSUFFIX)) { // all files with .xqm suffix will be parsed for RESTXQ annotations RestXqModule module = modules.get(path); boolean parsed = false; if(module != null) { // check if module has been modified parsed = module.uptodate(); } else { // create new module module = new RestXqModule(file, main); } // add module if it has been parsed, and if it contains annotations if(parsed || module.parse(http)) { module.touch(); cache.put(path, module); } } } } } } basex-7.7.2/basex-api/src/main/java/org/basex/http/restxq/RestXqParam.java000066400000000000000000000012021222453003200263720ustar00rootroot00000000000000package org.basex.http.restxq; import org.basex.query.value.*; import org.basex.query.value.item.*; /** * This class contains a single RESTXQ parameter. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class RestXqParam { /** Variable name. */ final QNm name; /** Name of parameter. */ final String key; /** Default value. */ final Value value; /** * Constructor. * @param nm variable name * @param param name of parameter * @param def default value */ RestXqParam(final QNm nm, final String param, final Value def) { name = nm; key = param; value = def; } } basex-7.7.2/basex-api/src/main/java/org/basex/http/restxq/RestXqPath.java000066400000000000000000000042161222453003200262360ustar00rootroot00000000000000package org.basex.http.restxq; import java.util.*; import org.basex.http.*; import org.basex.util.*; /** * This class represents the path of a RESTXQ function. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class RestXqPath implements Iterable, Comparable { /** Path segments. */ final String[] segment; /** Number of segments. */ final int size; /** * Constructor. * @param path path */ RestXqPath(final String path) { segment = HTTPContext.toSegments(path); size = segment.length; } /** * Checks if the path matches the HTTP request. * @param http http context * @return result of check */ boolean matches(final HTTPContext http) { // check if number of segments match if(size != http.depth()) return false; // check single segments for(int s = 0; s < size; s++) { if(!segment[s].equals(http.segment(s)) && !isTemplate(s)) return false; } return true; } /** * Checks if the specified path segment is a template. * @param s offset of segment * @return result of check */ private boolean isTemplate(final int s) { return segment[s].trim().startsWith("{"); } @Override public int compareTo(final RestXqPath rxs) { final int d = size - rxs.size; if(d != 0) return d; for(int s = 0; s < size; s++) { final boolean wc1 = isTemplate(s); final boolean wc2 = rxs.isTemplate(s); if(wc1 != wc2) return wc1 ? 1 : -1; } return 0; } @Override public Iterator iterator() { return new Iterator() { private int c; @Override public boolean hasNext() { return c < size; } @Override public String next() { return segment[c++]; } @Override public void remove() { Util.notexpected(); } }; } @Override public String toString() { // returns a schematic representation of the segments final StringBuilder sb = new StringBuilder("/"); for(int s = 0; s < size; s++) { sb.append(segment[s]).append('/'); //sb.append(isTemplate(s) ? "{...}" : segment[s]).append('/'); } return sb.toString(); } } basex-7.7.2/basex-api/src/main/java/org/basex/http/restxq/RestXqRespBuilder.java000066400000000000000000000066461222453003200275730ustar00rootroot00000000000000package org.basex.http.restxq; import static org.basex.http.restxq.RestXqText.*; import static org.basex.util.Token.*; import org.basex.http.*; import org.basex.io.*; import org.basex.io.out.*; import org.basex.io.serial.*; import org.basex.query.func.*; import org.basex.query.iter.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.util.hash.*; /** * This class holds information on a custom RESTXQ response. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class RestXqRespBuilder { /** Output cache. */ final ArrayOutput cache = new ArrayOutput();; /** Show error. */ boolean error; /** Status code. */ int status; /** Status message. */ String message; /** * Builds a response element and creates the serialization parameters. * @param response response element * @param func function * @param iter result iterator * @param http http context * @throws Exception exception (including unexpected ones) */ void build(final ANode response, final RestXqFunction func, final Iter iter, final HTTPContext http) throws Exception { // don't allow attributes for(final ANode a : response.attributes()) func.error(UNEXP_NODE, a); // parse response and serialization parameters SerializerProp sp = func.output; String cType = null; for(final ANode n : response.children()) { // process http:response element if(HTTP_RESPONSE.eq(n)) { // check status and reason byte[] sta = null, msg = null; for(final ANode a : n.attributes()) { final QNm qnm = a.qname(); if(qnm.eq(Q_STATUS)) sta = a.string(); else if(qnm.eq(Q_REASON) || qnm.eq(Q_MESSAGE)) msg = a.string(); else func.error(UNEXP_NODE, a); } if(sta != null) { status = toInt(sta); message = msg != null ? string(msg) : null; } for(final ANode c : n.children()) { // process http:header elements if(HTTP_HEADER.eq(c)) { final byte[] nam = c.attribute(Q_NAME); final byte[] val = c.attribute(Q_VALUE); if(nam != null && val != null) { final String key = string(nam); final String value = string(val); if(key.equals(MimeTypes.CONTENT_TYPE)) { cType = value; } else { http.res.setHeader(key, value); } } } else { func.error(UNEXP_NODE, c); } } } else if(OUTPUT_SERIAL.eq(n)) { // parse output:serialization-parameters sp = FuncParams.serializerProp(n, func.function.info); // loop through single values final TokenMap tm = FuncParams.serializerMap(n, func.function.info); for(final byte[] key : tm) func.output.set(string(key), string(tm.get(key))); } else { func.error(UNEXP_NODE, n); } } // set content type if(cType != null) sp.set(SerializerProp.S_MEDIA_TYPE, cType); // check next item Item item = iter.next(); if(item == null) { error = true; } else if(func.methods.size() == 1 && func.methods.contains(HTTPMethod.HEAD)) { func.error(HEAD_METHOD); } // cache result http.initResponse(sp); final Serializer ser = Serializer.get(cache, sp); for(; item != null; item = iter.next()) ser.serialize(item); ser.close(); } } basex-7.7.2/basex-api/src/main/java/org/basex/http/restxq/RestXqResponse.java000066400000000000000000000074651222453003200271510ustar00rootroot00000000000000package org.basex.http.restxq; import static org.basex.http.restxq.RestXqText.*; import static org.basex.util.Token.*; import org.basex.http.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.func.*; import org.basex.query.iter.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; /** * This class creates a new HTTP response. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class RestXqResponse { /** Function to be evaluated. */ private final RestXqFunction function; /** Query context. */ private final QueryContext query; /** HTTP context. */ private final HTTPContext http; /** Optional query error. */ private final QueryException error; /** * Constructor. * @param rxf function to be evaluated * @param ctx query context * @param hc HTTP context * @param err optional query error */ RestXqResponse(final RestXqFunction rxf, final QueryContext ctx, final HTTPContext hc, final QueryException err) { function = rxf; query = ctx; http = hc; error = err; } /** * Evaluates the specified function and creates a response. * @throws Exception exception (including unexpected ones) */ void create() throws Exception { String redirect = null, forward = null; RestXqRespBuilder resp = null; // bind variables final StaticFunc uf = function.function; final Expr[] args = new Expr[uf.args.length]; function.bind(http, args, error); // wrap function with a function call final StaticFuncCall sfc = new StaticFuncCall(uf.name, args, uf.sc, uf.info).init(uf); final MainModule mm = new MainModule(sfc, new VarScope(), null); // assign main module and http context and register process query.mainModule(mm); query.context(http, null); query.context.register(query); try { // compile and evaluate query query.compile(); final Iter iter = query.iter(); Item item = iter.next(); // handle response element if(item != null && item.type.isNode()) { final ANode node = (ANode) item; // send redirect to browser if(REST_REDIRECT.eq(node)) { final ANode ch = node.children().next(); if(ch == null || ch.type != NodeType.TXT) function.error(NO_VALUE, node.name()); redirect = string(ch.string()).trim(); return; } // server-side forwarding if(REST_FORWARD.eq(node)) { final ANode ch = node.children().next(); if(ch == null || ch.type != NodeType.TXT) function.error(NO_VALUE, node.name()); forward = string(ch.string()).trim(); return; } if(REST_RESPONSE.eq(node)) { resp = new RestXqRespBuilder(); resp.build(node, function, iter, http); return; } } // HEAD method must return a single response element if(function.methods.size() == 1 && function.methods.contains(HTTPMethod.HEAD)) function.error(HEAD_METHOD); // serialize result final SerializerProp sp = function.output; http.initResponse(sp); final Serializer ser = Serializer.get(http.res.getOutputStream(), sp); for(; item != null; item = iter.next()) ser.serialize(item); ser.close(); } finally { query.close(); query.context.unregister(query); if(redirect != null) { http.res.sendRedirect(redirect); } else if(forward != null) { http.req.getRequestDispatcher(forward).forward(http.req, http.res); } else if(resp != null) { if(resp.status != 0) http.status(resp.status, resp.message, resp.error); http.res.getOutputStream().write(resp.cache.toArray()); } } } } basex-7.7.2/basex-api/src/main/java/org/basex/http/restxq/RestXqServlet.java000066400000000000000000000023611222453003200267650ustar00rootroot00000000000000package org.basex.http.restxq; import org.basex.http.*; import org.basex.query.*; /** *

This servlet receives and processes REST requests. * The evaluated code is defined in XQuery modules, which are located in the web server's * root directory (specified by the {@code HTTPPATH} option), and decorated with RESTXQ * annotations.

* *

The implementation is based on Adam Retter's paper presented at XMLPrague 2012, * titled "RESTful XQuery - Standardised XQuery 3.0 Annotations for REST".

* * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class RestXqServlet extends BaseXServlet { @Override protected void run(final HTTPContext http) throws Exception { // authenticate user http.session(); // analyze input path final RestXqModules rxm = RestXqModules.get(); // select XQuery function RestXqFunction func = rxm.find(http, null); if(func == null) HTTPErr.NO_XQUERY.thrw(); try { // process function that matches the current request func.process(http, null); } catch(final QueryException ex) { // process optional error function func = rxm.find(http, ex.qname()); if(func == null) throw ex; func.process(http, ex); } } } basex-7.7.2/basex-api/src/main/java/org/basex/http/restxq/RestXqText.java000066400000000000000000000106601222453003200262660ustar00rootroot00000000000000package org.basex.http.restxq; import static org.basex.query.QueryText.*; import static org.basex.util.Token.*; import org.basex.query.func.*; import org.basex.query.path.*; import org.basex.query.value.item.*; /** * This class assembles texts which are used in the HTTP classes. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public interface RestXqText { /** Token "error". */ byte[] ERROR = token("error"); /** Token "path". */ byte[] PATH = token("path"); /** Token "produces". */ byte[] PRODUCES = token("produces"); /** Token "consumes". */ byte[] CONSUMES = token("consumes"); /** Token "query-param". */ byte[] QUERY_PARAM = token("query-param"); /** Token "form-param". */ byte[] FORM_PARAM = token("form-param"); /** Token "header-param". */ byte[] HEADER_PARAM = token("header-param"); /** Token "cookie-param". */ byte[] COOKIE_PARAM = token("cookie-param"); /** Token "query-param". */ byte[] ERROR_PARAM = token("error-param"); /** Token "header". */ byte[] HEADER = token("header"); /** Token "response". */ byte[] RESPONSE = token("response"); /** Token "status". */ byte[] STATUS = token("status"); /** Token "reason". */ byte[] REASON = token("reason"); /** Token "message". */ byte[] MESSAGE = token("message"); /** Token "name". */ byte[] NAME = token("name"); /** Token "value". */ byte[] VALUE = token("value"); /** Token "redirect". */ byte[] REDIRECT = token("redirect"); /** Token "forward". */ byte[] FORWARD = token("forward"); /** WADL prefix. */ String WADL = "wadl:"; /** WADL namespace. */ String WADL_URI = "http://wadl.dev.java.net/2009/02"; /** XHTML namespace. */ String XHTML_URL = "http://www.w3.org/1999/xhtml"; /** Error message. */ String ANN_MISSING = "Annotation %% or %% missing."; /** Error message. */ String ANN_TWICE = "Annotation %% is specified more than once."; /** Error message. */ String ANN_UNKNOWN = "Annotation %% is invalid or not supported."; /** Error message. */ String ANN_ATLEAST = "Annotation %% requires at least % parameter(s)."; /** Error message. */ String ANN_EXACTLY = "Annotation %% requires exactly % parameter(s)."; /** Error message. */ String ANN_STRING = "Single string expected for %%, found: %."; /** Error message. */ String INV_TEMPLATE = "Invalid path template: \"%\"."; /** Error message. */ String INV_VARNAME = "Invalid variable name: $%."; /** Error message. */ String INV_CODE = "Invalid error code: '%'."; /** Error message. */ String INV_NONS = "No namespace declared for '%'."; /** Error message. */ String INV_VARTYPE = "Variable $% must inherit from %."; /** Error message. */ String UNKNOWN_VAR = "Variable $% is not specified as argument."; /** Error message. */ String VAR_ASSIGNED = "Variable $% is specified more than once."; /** Error message. */ String VAR_UNDEFINED = "Variable $% is not assigned by the annotations."; /** Error message. */ String UNKNOWN_SER = "Unknown serialization parameter \"%\"."; /** Error message. */ String UNEXP_NODE = "Unexpected node: %."; /** Error message. */ String HEAD_METHOD = "HEAD method must return a single 'restxq:response' element."; /** Error message. */ String METHOD_VALUE = "Method % does not allow values."; /** Error message. */ String INPUT_CONV = "Input could not be converted: %"; /** Error message. */ String PATH_CONFLICT = "Several functions assigned to path \"%\":%"; /** Error message. */ String ERROR_CONFLICT = "Several functions assigned to error \"%\":%"; /** Error message. */ String NO_VALUE = "'%' element has no string value."; /** QName. */ QNm Q_STATUS = QNm.get(STATUS); /** QName. */ QNm Q_REASON = QNm.get(REASON); /** QName. */ QNm Q_MESSAGE = QNm.get(MESSAGE); /** QName. */ QNm Q_NAME = QNm.get(NAME); /** QName. */ QNm Q_VALUE = QNm.get(VALUE); /** Serializer node test. */ NodeTest OUTPUT_SERIAL = new NodeTest(FuncParams.Q_SPARAM); /** HTTP Response test. */ NodeTest HTTP_RESPONSE = new NodeTest(QNm.get(RESPONSE, HTTPURI)); /** RESTXQ Response test. */ NodeTest REST_RESPONSE = new NodeTest(QNm.get(RESPONSE, RESTURI)); /** RESTXQ Redirect test. */ NodeTest REST_REDIRECT = new NodeTest(QNm.get(REDIRECT, RESTURI)); /** RESTXQ Forward test. */ NodeTest REST_FORWARD = new NodeTest(QNm.get(FORWARD, RESTURI)); /** HTTP Header test. */ NodeTest HTTP_HEADER = new NodeTest(QNm.get(HEADER, HTTPURI)); } basex-7.7.2/basex-api/src/main/java/org/basex/http/restxq/RestXqWadl.java000066400000000000000000000110301222453003200262210ustar00rootroot00000000000000package org.basex.http.restxq; import static org.basex.http.restxq.RestXqText.*; import static org.basex.query.QueryText.*; import static org.basex.util.Token.*; import java.util.*; import java.util.regex.*; import org.basex.http.*; import org.basex.query.util.inspect.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * This class returns a Web Application Description Language (WADL) file, * listing all available RESTXQ services. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class RestXqWadl { /** HTTP context. */ private final HTTPContext http; /** * Constructor. * @param hc HTTP context */ RestXqWadl(final HTTPContext hc) { http = hc; } /** * Returns a WADL description for all available URIs. * @param modules available modules * @return WADL description */ synchronized FElem create(final HashMap modules) { // create root nodes final FElem application = new FElem(WADL + "application", WADL_URI).declareNS(); final String base = http.req.getRequestURL().toString(); final FElem resources = elem("resources", application).add("base", base); // create children final TreeMap map = new TreeMap(); for(final RestXqModule mod : modules.values()) { for(final RestXqFunction func : mod.functions()) { final TokenObjMap xqdoc = func.function.doc(); final String path = func.path.toString(); final String methods = func.methods.toString().replaceAll("[^A-Z ]", ""); // create resource final FElem resource = new FElem(WADL + "resource", WADL_URI).add("path", path); map.put(path + "?" + methods, resource); // add documentation for path variables final Matcher var = Pattern.compile("\\$[^}]*").matcher(path); while(var.find()) { addParam(var.group().substring(1), "template", resource, xqdoc, func); } // create method, add function documentation final FElem method = elem("method", resource).add("name", methods); final TokenList descs = xqdoc != null ? xqdoc.get(DOC_DESCRIPTION) : null; if(descs != null) for(final byte[] desc : descs) addDoc(desc, method); // create request final FElem request = elem("request", method); for(final RestXqParam rxp : func.queryParams) addParam(rxp.key, "query", request, xqdoc, func); for(final RestXqParam rxp : func.formParams) addParam(rxp.key, "query", request, xqdoc, func); for(final RestXqParam rxp : func.headerParams) addParam(rxp.key, "header", request, xqdoc, func); // create response final FElem response = elem("response", method); final FElem representation = elem("representation", response); representation.add("mediaType", HTTPContext.mediaType(func.output)); } } // add resources in sorted order for(final FElem elem : map.values()) resources.add(elem); return application; } /** * Adds a parameter and its documentation to the specified element. * @param name name of parameter * @param style style * @param root root element * @param xqdoc documentation * @param func function */ private void addParam(final String name, final String style, final FElem root, final TokenObjMap xqdoc, final RestXqFunction func) { final FElem param = elem("param", root); param.add("name", name).add("style", style); final QNm qn = new QNm(name); for(final Var var : func.function.args) { if(var.name.eq(qn) && var.declType != null) { param.add("type", var.declType.toString()); } } addDoc(Inspect.doc(xqdoc, token(name)), param); } /** * Creates an element. * @param name name of element * @param parent parent node * @return element node */ private FElem elem(final String name, final FElem parent) { final FElem elem = new FElem(WADL + name, WADL_URI); if(parent != null) parent.add(elem); return elem; } /** * Adds a documentation element to the specified element. * @param xqdoc documentation (may be {@code null}) * @param parent parent node */ private void addDoc(final byte[] xqdoc, final FElem parent) { if(xqdoc == null) return; final FElem doc = elem("doc", parent); doc.namespaces().add(EMPTY, token(XHTML_URL)); Inspect.add(xqdoc, http.context(), doc); } } basex-7.7.2/basex-api/src/main/java/org/basex/http/webdav/000077500000000000000000000000001222453003200232475ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/java/org/basex/http/webdav/BXAbstractResource.java000066400000000000000000000243451222453003200276270ustar00rootroot00000000000000package org.basex.http.webdav; import static org.basex.http.webdav.impl.Utils.*; import static com.bradmcevoy.http.LockResult.*; import java.io.*; import java.util.*; import org.basex.core.Prop; import org.basex.http.webdav.impl.ResourceMetaData; import org.basex.http.webdav.impl.WebDAVService; import org.basex.util.*; import com.bradmcevoy.http.*; import com.bradmcevoy.http.exceptions.*; import org.xml.sax.Attributes; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.DefaultHandler; import org.xml.sax.helpers.XMLReaderFactory; /** * WebDAV resource representing an abstract folder within a collection database. * * @author BaseX Team 2005-13, BSD License * @author Rositsa Shadura * @author Dimitar Popov */ public abstract class BXAbstractResource implements CopyableResource, DeletableResource, MoveableResource, LockableResource { /** Resource meta data. */ protected final ResourceMetaData meta; /** WebDAV service implementation. */ protected final WebDAVService service; /** * Constructor. * @param m resource meta data * @param s service */ protected BXAbstractResource(final ResourceMetaData m, final WebDAVService s) { meta = m; service = s; } @Override public Object authenticate(final String user, final String pass) { if(user != null) new BXCode(this) { @Override public void run() throws IOException { service.authenticate(user, pass); } }.evalNoEx(); return user; } @Override public boolean authorise(final Request request, final Request.Method method, final Auth auth) { return auth != null && auth.getTag() != null && service.authorize(auth.getUser(), "any", meta.db, meta.path); } @Override public String checkRedirect(final Request request) { return null; } @Override public String getRealm() { return Prop.NAME; } @Override public String getUniqueId() { return null; } @Override public String getName() { return name(meta.path); } @Override public Date getModifiedDate() { return meta.mdate; } @Override public void delete() throws BadRequestException { new BXCode(this) { @Override public void run() throws IOException { del(); } }.eval(); } @Override public void copyTo(final CollectionResource target, final String name) throws BadRequestException { new BXCode(this) { @Override public void run() throws IOException { if(target instanceof BXRoot) copyToRoot(name); else if(target instanceof BXFolder) copyTo((BXFolder) target, name); } }.eval(); } @Override public void moveTo(final CollectionResource target, final String name) throws BadRequestException { new BXCode(this) { @Override public void run() throws IOException { if(target instanceof BXRoot) moveToRoot(name); else if(target instanceof BXFolder) moveTo((BXFolder) target, name); } }.eval(); } /** * Lock this resource and return a token. * * @param timeout - in seconds, or null * @param lockInfo lock info * @return - a result containing the token representing the lock if successful, * otherwise a failure reason code */ @Override public LockResult lock(final LockTimeout timeout, final LockInfo lockInfo) throws NotAuthorizedException, PreConditionFailedException, LockedException { return new BXCode(this) { @Override public LockResult get() throws IOException { return lockResource(timeout, lockInfo); } }.evalNoEx(); } /** * Renew the lock and return new lock info. * * @param token lock token * @return lock result */ @Override public LockResult refreshLock(final String token) throws NotAuthorizedException, PreConditionFailedException { return new BXCode(this) { @Override public LockResult get() throws IOException { return refresh(token); } }.evalNoEx(); } /** * If the resource is currently locked, and the tokenId matches the current * one, unlock the resource. * * @param tokenId lock token */ @Override public void unlock(final String tokenId) throws NotAuthorizedException, PreConditionFailedException { new BXCode(this) { @Override public void run() throws IOException { service.locking.unlock(tokenId); } }.evalNoEx(); } /** * Get the active lock for the current resource. * @return - the current lock, if the resource is locked, or null */ @Override public LockToken getCurrentLock() { return new BXCode(this) { @Override public LockToken get() throws IOException { return getCurrentActiveLock(); } }.evalNoEx(); } /** * Delete document or folder. * @throws IOException I/O exception */ protected void del() throws IOException { service.delete(meta.db, meta.path); } /** * Rename document or folder. * @param n new name * @throws IOException I/O exception */ protected void rename(final String n) throws IOException { service.rename(meta.db, meta.path, n); } /** * Copy folder to the root, creating a new database. * @param n new name of the folder (database) * @throws IOException I/O exception */ protected abstract void copyToRoot(final String n) throws IOException; /** * Copy folder to another folder. * @param f target folder * @param n new name of the folder * @throws IOException I/O exception */ protected abstract void copyTo(final BXFolder f, final String n) throws IOException; /** * Move folder to the root, creating a new database. * @param n new name of the folder (database) * @throws IOException I/O exception */ protected void moveToRoot(final String n) throws IOException { // folder is moved to the root: create new database with it copyToRoot(n); del(); } /** * Move folder to another folder. * @param f target folder * @param n new name of the folder * @throws IOException I/O exception */ void moveTo(final BXFolder f, final String n) throws IOException { if(f.meta.db.equals(meta.db)) { // folder is moved to a folder in the same database rename(f.meta.path + SEP + n); } else { // folder is moved to a folder in another database copyTo(f, n); del(); } } /** * Lock the current resource. * @param timeout lock timeout * @param lockInfo lock info * @return lock result * @throws IOException I/O exception */ LockResult lockResource(final LockTimeout timeout, final LockInfo lockInfo) throws IOException { final String tokenId = service.locking.lock(meta.db, meta.path, lockInfo.scope.name().toLowerCase(Locale.ENGLISH), lockInfo.type.name().toLowerCase(Locale.ENGLISH), lockInfo.depth.name().toLowerCase(Locale.ENGLISH), lockInfo.lockedByUser, timeout.getSeconds()); // TODO failed(failureReason); return success(new LockToken(tokenId, lockInfo, timeout)); } /** * Get the active lock on the current resource. * @return the token of the active lock or {@code null} if resource is not locked * @throws IOException I/O exception */ LockToken getCurrentActiveLock() throws IOException { final String lockInfoStr = service.locking.lock(meta.db, meta.path); return lockInfoStr == null ? null : parseLockInfo(lockInfoStr); } /** * Renew a lock with the given token. * @param token lock token * @return lock result * @throws IOException I/O exception */ LockResult refresh(final String token) throws IOException { service.locking.refreshLock(token); final String lockInfoStr = service.locking.lock(token); final LockToken lockToken = lockInfoStr == null ? null : parseLockInfo(lockInfoStr); // TODO failed(failureReason); return success(lockToken); } /** * Parse the lock info. * @param lockInfo lock info as a string * @return parsed lock info bean * @throws IOException I/O exception */ private static LockToken parseLockInfo(final String lockInfo) throws IOException { try { final XMLReader reader = XMLReaderFactory.createXMLReader(); final LockTokenSaxHandler handler = new LockTokenSaxHandler(); reader.setContentHandler(handler); reader.parse(new InputSource(new StringReader(lockInfo))); return handler.lockToken; } catch(final SAXException ex) { Util.err("Error while parsing lock info", ex); return null; } } /** SAX handler for lock token. */ private static final class LockTokenSaxHandler extends DefaultHandler { /** Parsed lock token. */ public final LockToken lockToken = new LockToken(null, new LockInfo(), null); /** Current element name. */ private String elementName; @Override public void startElement(final String uri, final String localName, final String name, final Attributes attributes) throws SAXException { elementName = localName; super.startElement(uri, localName, name, attributes); } @Override public void endElement(final String uri, final String localName, final String qName) throws SAXException { elementName = null; super.endElement(uri, localName, qName); } @Override public void characters(final char[] ch, final int start, final int length) throws SAXException { final String v = String.valueOf(ch, start, length); if("token".equals(elementName)) lockToken.tokenId = v; else if("scope".equals(elementName)) lockToken.info.scope = LockInfo.LockScope.valueOf(v.toUpperCase(Locale.ENGLISH)); else if("type".equals(elementName)) lockToken.info.type = LockInfo.LockType.valueOf(v.toUpperCase(Locale.ENGLISH)); else if("depth".equals(elementName)) lockToken.info.depth = LockInfo.LockDepth.valueOf(v.toUpperCase(Locale.ENGLISH)); else if("owner".equals(elementName)) lockToken.info.lockedByUser = v; else if("timeout".equals(elementName)) lockToken.timeout = LockTimeout.parseTimeout(v); } } } basex-7.7.2/basex-api/src/main/java/org/basex/http/webdav/BXCode.java000066400000000000000000000026441222453003200252240ustar00rootroot00000000000000package org.basex.http.webdav; import java.io.*; import org.basex.util.*; import com.bradmcevoy.http.exceptions.*; /** * Code container. * @param return type * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public abstract class BXCode { /** Resource. */ private final BXAbstractResource resource; /** * Constructor. * @param res resource */ protected BXCode(final BXAbstractResource res) { resource = res; } /** * Runs the contained code. * @return result * @throws BadRequestException bad request exception */ public E eval() throws BadRequestException { try { final E ret = get(); if(ret == null) run(); return ret; } catch(final IOException ex) { Util.errln(ex); throw new BadRequestException(resource, ex.getMessage()); } } /** * Runs the contained code, throwing no exception. * @return result */ public E evalNoEx() { try { return eval(); } catch(final BadRequestException ex) { Util.errln(ex); return null; } } /** * Method to run, returning some output. * @return result * @throws IOException I/O exception */ @SuppressWarnings("unused") public E get() throws IOException { return null; } /** * Method to run. * @throws IOException I/O exception */ @SuppressWarnings("unused") public void run() throws IOException { } } basex-7.7.2/basex-api/src/main/java/org/basex/http/webdav/BXDatabase.java000066400000000000000000000020201222453003200260420ustar00rootroot00000000000000package org.basex.http.webdav; import java.io.*; import org.basex.http.webdav.impl.ResourceMetaData; import org.basex.http.webdav.impl.WebDAVService; /** * WebDAV resource representing a collection database. * * @author BaseX Team 2005-13, BSD License * @author Rositsa Shadura * @author Dimitar Popov */ public final class BXDatabase extends BXFolder { /** * Constructor. * @param d resource meta data * @param s service */ public BXDatabase(final ResourceMetaData d, final WebDAVService s) { super(d, s); } @Override public String getName() { return meta.db; } @Override protected void del() throws IOException { service.dropDb(meta.db); } @Override protected void rename(final String n) throws IOException { service.renameDb(meta.db, n); } @Override protected void copyToRoot(final String n) throws IOException { service.copyDb(meta.db, n); } @Override protected void moveToRoot(final String n) throws IOException { rename(n); } } basex-7.7.2/basex-api/src/main/java/org/basex/http/webdav/BXFile.java000066400000000000000000000041621222453003200252260ustar00rootroot00000000000000package org.basex.http.webdav; import static org.basex.http.webdav.impl.Utils.*; import java.io.*; import java.util.*; import org.basex.http.webdav.impl.ResourceMetaData; import org.basex.http.webdav.impl.WebDAVService; import com.bradmcevoy.http.*; import com.bradmcevoy.http.exceptions.*; /** * WebDAV resource representing a file. * * @author BaseX Team 2005-13, BSD License * @author Rositsa Shadura * @author Dimitar Popov */ public final class BXFile extends BXAbstractResource implements FileResource { /** * Constructor. * @param d resource meta data * @param s service implementation */ public BXFile(final ResourceMetaData d, final WebDAVService s) { super(d, s); } @Override public Long getContentLength() { return meta.size; } @Override public Date getCreateDate() { return null; } @Override public Long getMaxAgeSeconds(final Auth auth) { return null; } @Override public String processForm(final Map parameters, final Map files) throws BadRequestException { return null; } @Override public String getContentType(final String accepts) { return meta.ctype; } @Override public void sendContent(final OutputStream out, final Range range, final Map params, final String contentType) throws IOException, BadRequestException { new BXCode(this) { @Override public void run() throws IOException { service.retrieve(meta.db, meta.path, meta.raw, out); } }.eval(); } @Override protected void copyToRoot(final String name) throws IOException { // document is copied to the root: create new database with it final String nm = dbname(name); service.createDb(nm); service.copyDoc(meta.db, meta.path, nm, name); } @Override protected void copyTo(final BXFolder folder, final String name) throws IOException { // folder is copied to a folder in a database service.copyDoc(meta.db, meta.path, folder.meta.db, folder.meta.path + SEP + name); service.deleteDummy(folder.meta.db, folder.meta.path); } } basex-7.7.2/basex-api/src/main/java/org/basex/http/webdav/BXFolder.java000066400000000000000000000076241222453003200255700ustar00rootroot00000000000000package org.basex.http.webdav; import static org.basex.http.webdav.impl.Utils.*; import java.io.*; import java.util.*; import org.basex.util.*; import org.basex.http.webdav.impl.ResourceMetaData; import org.basex.http.webdav.impl.WebDAVService; import org.basex.io.in.*; import com.bradmcevoy.http.*; import com.bradmcevoy.http.exceptions.*; /** * WebDAV resource representing a folder within a collection database. * * @author BaseX Team 2005-13, BSD License * @author Rositsa Shadura * @author Dimitar Popov */ public class BXFolder extends BXAbstractResource implements FolderResource, DeletableCollectionResource, LockingCollectionResource { /** * Constructor. * @param d resource meta data * @param s service implementation */ public BXFolder(final ResourceMetaData d, final WebDAVService s) { super(d, s); } @Override public Long getContentLength() { return null; } @Override public String getContentType(final String accepts) { return null; } @Override public Date getCreateDate() { return null; } @Override public Long getMaxAgeSeconds(final Auth auth) { return null; } @Override public void sendContent(final OutputStream out, final Range range, final Map params, final String contentType) { } @Override public boolean isLockedOutRecursive(final Request request) { return new BXCode(this) { @Override public Boolean get() throws IOException { return service.locking.conflictingLocks(meta.db, meta.path); } }.evalNoEx(); } @Override public BXFolder createCollection(final String folder) throws BadRequestException { return new BXCode(this) { @Override public BXFolder get() throws IOException { return (BXFolder) service.createFolder(meta.db, meta.path, folder); } }.eval(); } @Override public BXAbstractResource child(final String childName) { return new BXCode(this) { @Override public BXAbstractResource get() throws IOException { return service.resource(meta.db, meta.path + SEP + childName); } }.evalNoEx(); } @Override public List getChildren() { return new BXCode>(this) { @Override public List get() throws IOException { return service.list(meta.db, meta.path); } }.evalNoEx(); } @Override public BXAbstractResource createNew(final String newName, final InputStream input, final Long length, final String contentType) throws BadRequestException { return new BXCode(this) { @Override public BXAbstractResource get() throws IOException { return service.createFile(meta.db, meta.path, newName, input); } }.eval(); } @Override public LockToken createAndLock(final String name, final LockTimeout timeout, final LockInfo lockInfo) throws NotAuthorizedException { try { final BXAbstractResource r = createNew(name, new ArrayInput(Token.EMPTY), 0L, null); final LockResult lockResult = r.lock(timeout, lockInfo); if(lockResult.isSuccessful()) return lockResult.getLockToken(); } catch(final Exception ex) { Util.debug("Cannot lock and create requested resource", ex); } return null; } @Override protected void copyToRoot(final String name) throws IOException { // folder is copied to the root: create new database with it final String dbname = dbname(name); service.createDb(dbname); service.copyAll(meta.db, meta.path, dbname, ""); } @Override protected void copyTo(final BXFolder folder, final String name) throws IOException { // folder is copied to a folder in a database service.copyAll(meta.db, meta.path, folder.meta.db, folder.meta.path + SEP + name); service.deleteDummy(folder.meta.db, folder.meta.path); } } basex-7.7.2/basex-api/src/main/java/org/basex/http/webdav/BXNotAuthorizedResource.java000066400000000000000000000044011222453003200306520ustar00rootroot00000000000000package org.basex.http.webdav; import java.io.*; import java.util.*; import com.bradmcevoy.http.*; import com.bradmcevoy.http.Request.Method; import org.basex.core.Prop; /** * Dummy resource to be returned when no authorization is provided. * * @author BaseX Team 2005-13, BSD License * @author Rositsa Shadura * @author Dimitar Popov */ public final class BXNotAuthorizedResource implements FolderResource { /** The only instance of this class. */ public static final Resource NOAUTH = new BXNotAuthorizedResource(); /** Constructor. */ private BXNotAuthorizedResource() { } @Override public String getRealm() { return Prop.NAME; } @Override public Date getModifiedDate() { return null; } @Override public String getUniqueId() { return null; } @Override public Object authenticate(final String u, final String p) { return null; } @Override public boolean authorise(final Request request, final Method method, final Auth auth) { return false; } @Override public String getName() { return null; } @Override public void sendContent(final OutputStream out, final Range range, final Map params, final String contentType) { } @Override public Long getMaxAgeSeconds(final Auth auth) { return null; } @Override public String getContentType(final String accepts) { return null; } @Override public Long getContentLength() { return null; } @Override public CollectionResource createCollection(final String newName) { return null; } @Override public Resource child(final String childName) { return null; } @Override public List getChildren() { return null; } @Override public Resource createNew(final String newName, final InputStream inputStream, final Long length, final String contentType) { return null; } @Override public void copyTo(final CollectionResource toCollection, final String name) { } @Override public void delete() { } @Override public void moveTo(final CollectionResource rDest, final String name) { } @Override public Date getCreateDate() { return null; } @Override public String checkRedirect(final Request request) { return null; } } basex-7.7.2/basex-api/src/main/java/org/basex/http/webdav/BXResourceFactory.java000066400000000000000000000045451222453003200274730ustar00rootroot00000000000000package org.basex.http.webdav; import static org.basex.http.webdav.BXServletRequest.*; import javax.servlet.http.*; import org.basex.http.*; import org.basex.http.webdav.impl.ResourceMetaData; import org.basex.http.webdav.impl.ResourceMetaDataFactory; import org.basex.http.webdav.impl.WebDAVService; import org.basex.server.*; import org.basex.util.*; import com.bradmcevoy.common.*; import com.bradmcevoy.http.*; /** * WebDAV resource factory. Main class for generating WebDAV resources. * * @author BaseX Team 2005-13, BSD License * @author Rositsa Shadura * @author Dimitar Popov */ public final class BXResourceFactory implements ResourceFactory, ResourceMetaDataFactory { /** HTTP Context. */ private final HTTPContext http; /** WebDAV service. */ private final WebDAVService service; /** * Constructor. * @param ht http context */ BXResourceFactory(final HTTPContext ht) { http = ht; service = new WebDAVService(this, http); } @Override public Resource getResource(final String host, final String dbpath) { final Auth a = HttpManager.request().getAuthorization(); if(a != null) http.credentials(a.getUser(), a.getPassword()); try { final HttpServletRequest r = getRequest(); Path p = Path.path(dbpath); if(!r.getContextPath().isEmpty()) p = p.getStripFirst(); if(!r.getServletPath().isEmpty()) p = p.getStripFirst(); if(p.isRoot()) return new BXRoot(service); final String db = p.getFirst(); return p.getLength() == 1 ? service.dbExists(db) ? new BXDatabase(new ResourceMetaData(db, service.timestamp(db)), service) : null : service.resource(db, p.getStripFirst().toString()); } catch(final LoginException ex) { return BXNotAuthorizedResource.NOAUTH; } catch(final Exception ex) { Util.errln(ex); } return null; } @Override public BXFile file(final WebDAVService s, final ResourceMetaData d) { return new BXFile(d, s); } @Override public BXFolder folder(final WebDAVService s, final ResourceMetaData d) { return new BXFolder(d, s); } @Override public BXDatabase database(final WebDAVService s, final ResourceMetaData d) { return new BXDatabase(d, s); } } basex-7.7.2/basex-api/src/main/java/org/basex/http/webdav/BXRoot.java000066400000000000000000000044711222453003200252750ustar00rootroot00000000000000package org.basex.http.webdav; import static org.basex.http.webdav.impl.Utils.*; import java.io.*; import java.util.List; import org.basex.http.webdav.impl.ResourceMetaData; import org.basex.http.webdav.impl.WebDAVService; import com.bradmcevoy.http.*; import com.bradmcevoy.http.exceptions.*; /** * WebDAV resource representing the list of all databases. * * @author BaseX Team 2005-13, BSD License * @author Rositsa Shadura * @author Dimitar Popov */ public final class BXRoot extends BXFolder { /** * Constructor. * @param s service */ public BXRoot(final WebDAVService s) { super(new ResourceMetaData(), s); } @Override public String getName() { return ""; } @Override public void copyTo(final CollectionResource toCollection, final String name) { // this method must do nothing } @Override public void delete() { // this method must do nothing } @Override public void moveTo(final CollectionResource rDest, final String name) { // this method must do nothing } @Override public BXAbstractResource child(final String name) { return new BXCode(this) { @Override public BXAbstractResource get() throws IOException { return service.dbExists(name) ? new BXDatabase(new ResourceMetaData(name, service.timestamp(name)), service) : null; } }.evalNoEx(); } @Override public List getChildren() { return new BXCode>(this) { @Override public List get() throws IOException { return service.listDbs(); } }.evalNoEx(); } @Override public BXDatabase createCollection(final String name) throws BadRequestException { return new BXCode(this) { @Override public BXDatabase get() throws IOException { return (BXDatabase) service.createDb(dbname(name)); } }.eval(); } @Override public BXAbstractResource createNew(final String name, final InputStream input, final Long length, final String contentType) throws BadRequestException { return new BXCode(this) { @Override public BXAbstractResource get() throws IOException { return service.createFile(name, input); } }.eval(); } } basex-7.7.2/basex-api/src/main/java/org/basex/http/webdav/BXServletCookie.java000066400000000000000000000034071222453003200271260ustar00rootroot00000000000000package org.basex.http.webdav; import com.bradmcevoy.http.*; /** * Wrapper around {@link javax.servlet.http.Cookie}, which in addition * implements {@link Cookie}.
* This implementation is the same as the implementation of * {@code ServletCookie} found in {@code milton-servlet}. Since this is one of * the few classes which is needed from that library, the source was integrated * into BaseX. * * @author Milton Development Team * @author BaseX Team 2005-13, BSD License * @author Rositsa Shadura * @author Dimitar Popov */ final class BXServletCookie implements Cookie { /** Wrapped instance. */ public final javax.servlet.http.Cookie cookie; /** * Constructor. * @param c servlet cookie */ public BXServletCookie(final javax.servlet.http.Cookie c) { cookie = c; } @Override public int getVersion() { return cookie.getVersion(); } @Override public void setVersion(final int version) { cookie.setVersion(version); } @Override public String getName() { return cookie.getName(); } @Override public String getValue() { return cookie.getValue(); } @Override public void setValue(final String value) { cookie.setValue(value); } @Override public boolean getSecure() { return cookie.getSecure(); } @Override public void setSecure(final boolean secure) { cookie.setSecure(secure); } @Override public int getExpiry() { return cookie.getMaxAge(); } @Override public void setExpiry(final int expiry) { cookie.setMaxAge(expiry); } @Override public String getPath() { return cookie.getPath(); } @Override public void setPath(final String path) { cookie.setPath(path); } @Override public String getDomain() { return cookie.getDomain(); } @Override public void setDomain(final String domain) { cookie.setDomain(domain); } } basex-7.7.2/basex-api/src/main/java/org/basex/http/webdav/BXServletRequest.java000066400000000000000000000177761222453003200273630ustar00rootroot00000000000000package org.basex.http.webdav; import java.io.*; import java.net.*; import java.util.*; import java.util.Map.Entry; import javax.servlet.http.*; import org.apache.commons.fileupload.*; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.servlet.*; import org.basex.util.*; import com.bradmcevoy.http.*; import com.bradmcevoy.http.Response.ContentType; import com.bradmcevoy.http.Cookie; /** * Wrapper around {@link HttpServletRequest}, which in addition implements * {@link Request}.
* This implementation is the same as the implementation of * {@code ServletRequest} found in {@code milton-servlet}. Since this is one of * the few classes which is needed from that library, the source is integrated * into BaseX. * * @author Milton Development Team * @author BaseX Team 2005-13, BSD License * @author Rositsa Shadura * @author Dimitar Popov */ public final class BXServletRequest extends AbstractRequest { /** HTTP servlet request. */ private final HttpServletRequest req; /** Request method. */ private final Method method; /** Request URL. */ private final String url; /** Authentication. */ private Auth auth; /** Content types map. */ private static final Map CONTENT_TYPES = new EnumMap(ContentType.class); /** Type contents map. */ private static final Map TYPE_CONTENTS = new HashMap(); static { CONTENT_TYPES.put(ContentType.HTTP, Response.HTTP); CONTENT_TYPES.put(ContentType.MULTIPART, Response.MULTIPART); CONTENT_TYPES.put(ContentType.XML, Response.XML); for(final Entry entry : CONTENT_TYPES.entrySet()) TYPE_CONTENTS.put(entry.getValue(), entry.getKey()); } /** Thread local variable to hold the current request. */ private static final ThreadLocal REQUEST = new ThreadLocal(); /** * Get the current request. * @return the current {@link HttpServletRequest} */ public static HttpServletRequest getRequest() { return REQUEST.get(); } /** * Constructor. * @param r HTTP servlet request */ public BXServletRequest(final HttpServletRequest r) { req = r; method = Method.valueOf(r.getMethod()); url = r.getRequestURL().toString(); // MiltonUtils.stripContext(r); REQUEST.set(r); } @Override public String getFromAddress() { return req.getRemoteHost(); } @Override public String getRequestHeader(final Header header) { return req.getHeader(header.code); } @Override public Method getMethod() { return method; } @Override public String getAbsoluteUrl() { return url; } @Override public String getRemoteAddr() { return req.getRemoteAddr(); } @Override public Auth getAuthorization() { if(auth != null) return auth; final String enc = getRequestHeader(Header.AUTHORIZATION); if(enc == null || enc.isEmpty()) return null; auth = new Auth(enc); return auth; } @Override public void setAuthorization(final Auth a) { auth = a; } @Override public InputStream getInputStream() throws IOException { return req.getInputStream(); } @Override public Map getHeaders() { final Map map = new HashMap(); final Enumeration en = req.getHeaderNames(); while(en.hasMoreElements()) { final String name = en.nextElement(); final String val = req.getHeader(name); map.put(name, val); } return map; } @Override public Cookie getCookie(final String name) { for(final javax.servlet.http.Cookie c : req.getCookies()) { if(c.getName().equals(name)) return new BXServletCookie(c); } return null; } @Override public List getCookies() { final List list = new ArrayList(); for(final javax.servlet.http.Cookie c : req.getCookies()) list.add(new BXServletCookie(c)); return list; } @Override public void parseRequestParameters(final Map params, final Map files) throws RequestParseException { try { if(isMultiPart()) { parseQueryString(params, req.getQueryString()); @SuppressWarnings("unchecked") final List items = new ServletFileUpload().parseRequest(req); for(final FileItem item : items) { if(item.isFormField()) params.put(item.getFieldName(), item.getString()); else files.put(item.getFieldName(), new FileItemWrapper(item)); } } else { final Enumeration en = req.getParameterNames(); while(en.hasMoreElements()) { final String nm = en.nextElement(); final String val = req.getParameter(nm); params.put(nm, val); } } } catch(final FileUploadException ex) { throw new RequestParseException("FileUploadException", ex); } catch(final Throwable ex) { throw new RequestParseException(ex.getMessage(), ex); } } /** * Parse the query string. * @param map parsed key-values will be stored here * @param qs query string */ private static void parseQueryString(final Map map, final String qs) { if(qs == null) return; for(final String nv : qs.split("&")) { final String[] parts = nv.split("="); final String key = parts[0]; String val = null; if(parts.length > 1) { val = parts[1]; if(val != null) { try { val = URLDecoder.decode(val, Token.UTF8); } catch(final UnsupportedEncodingException ex) { throw new RuntimeException(ex); } } } map.put(key, val); } } /** * Request content type. * @return the content type of the current request */ protected ContentType getRequestContentType() { final String s = req.getContentType(); if(s == null) return null; if(s.contains(Response.MULTIPART)) return ContentType.MULTIPART; return TYPE_CONTENTS.get(s); } /** * Is the content type of the request a multi-part? * @return {@code true} if the request is multi-part */ protected boolean isMultiPart() { return ContentType.MULTIPART.equals(getRequestContentType()); } } /** * Wrapper around {@link FileItem}, which in addition implements * {@link com.bradmcevoy.http.FileItem}.
* This implementation is the same as the implementation of * {@code FileItemWrapper} found in {@code milton-servlet}. Since this is one of * the few classes which is needed from that library, the source is integrated * into BaseX. * @author Milton Development Team * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura * @author Dimitar Popov */ class FileItemWrapper implements com.bradmcevoy.http.FileItem { /** Wrapped file item. */ private final FileItem wrapped; /** File name. */ private final String name; /** * Strip path information provided by IE. * @param s string * @return stripped string */ private static String fixIEFileName(final String s) { final int pos = s.lastIndexOf('\\'); return pos < 0 ? s : s.substring(pos + 1); } /** * Constructor. * @param f file item */ public FileItemWrapper(final FileItem f) { wrapped = f; name = fixIEFileName(wrapped.getName()); } @Override public String getContentType() { return wrapped.getContentType(); } @Override public String getFieldName() { return wrapped.getFieldName(); } @Override public InputStream getInputStream() { try { return wrapped.getInputStream(); } catch(final IOException ex) { throw new RuntimeException(ex); } } @Override public OutputStream getOutputStream() { try { return wrapped.getOutputStream(); } catch(final IOException ex) { throw new RuntimeException(ex); } } @Override public String getName() { return name; } @Override public long getSize() { return wrapped.getSize(); } } basex-7.7.2/basex-api/src/main/java/org/basex/http/webdav/BXServletResponse.java000066400000000000000000000066701222453003200275200ustar00rootroot00000000000000package org.basex.http.webdav; import java.io.*; import java.util.*; import javax.servlet.http.*; import com.bradmcevoy.http.*; import com.bradmcevoy.http.Cookie; /** * Wrapper around {@link HttpServletResponse}, which in addition implements * {@link Response}.
* This implementation is the same as the implementation of * {@code ServletResponse} found in {@code milton-servlet}. Since this is one of * the few classes which is needed from that library, the source was integrated * into BaseX. * * @author Milton Development Team * @author BaseX Team 2005-13, BSD License * @author Rositsa Shadura * @author Dimitar Popov */ public final class BXServletResponse extends AbstractResponse { /** Thread local variable to hold the current response. */ private static final ThreadLocal RESPONSE = new ThreadLocal(); /** HTTP servlet response. */ private final HttpServletResponse res; /** Response headers. */ private final Map headers = new HashMap(); /** Response status. */ private Status status; /** * Constructor. * @param r HTTP servlet response */ public BXServletResponse(final HttpServletResponse r) { res = r; RESPONSE.set(r); } @Override protected void setAnyDateHeader(final Header name, final Date date) { res.setDateHeader(name.code, date.getTime()); } @Override public String getNonStandardHeader(final String code) { return headers.get(code); } @Override public void setNonStandardHeader(final String name, final String value) { res.addHeader(name, value); headers.put(name, value); } @Override public void setStatus(final Status s) { res.setStatus(s.code); status = s; } @Override public Status getStatus() { return status; } @Override public OutputStream getOutputStream() { try { return res.getOutputStream(); } catch(final IOException ex) { throw new RuntimeException(ex); } } @Override public void close() { try { res.flushBuffer(); res.getOutputStream().flush(); } catch(final IOException ex) { throw new RuntimeException(ex); } } @Override public void sendRedirect(final String url) { try { res.sendRedirect(res.encodeRedirectURL(url)); } catch(final IOException ex) { throw new RuntimeException(ex); } } @Override public Map getHeaders() { return Collections.unmodifiableMap(headers); } @Override public void setAuthenticateHeader(final List challenges) { for(final String ch : challenges) { res.addHeader(Header.WWW_AUTHENTICATE.code, ch); } } @Override public Cookie setCookie(final Cookie cookie) { if(cookie instanceof BXServletCookie) { res.addCookie(((BXServletCookie) cookie).cookie); return cookie; } final javax.servlet.http.Cookie c = new javax.servlet.http.Cookie( cookie.getName(), cookie.getValue()); c.setDomain(cookie.getDomain()); c.setMaxAge(cookie.getExpiry()); c.setPath(cookie.getPath()); c.setSecure(cookie.getSecure()); c.setVersion(cookie.getVersion()); res.addCookie(c); return new BXServletCookie(c); } @Override public Cookie setCookie(final String name, final String value) { final javax.servlet.http.Cookie c = new javax.servlet.http.Cookie(name, value); res.addCookie(c); return new BXServletCookie(c); } } basex-7.7.2/basex-api/src/main/java/org/basex/http/webdav/WebDAVServlet.java000066400000000000000000000012661222453003200265340ustar00rootroot00000000000000package org.basex.http.webdav; import java.io.*; import org.basex.http.*; import com.bradmcevoy.http.*; /** * WebDAV servlet. * * @author BaseX Team 2005-13, BSD License * @author Dimitar Popov */ public final class WebDAVServlet extends BaseXServlet { @Override protected void run(final HTTPContext http) throws IOException { final HttpManager manager = new HttpManager(new BXResourceFactory(http)); final Request request = new BXServletRequest(http.req); final Response response = new BXServletResponse(http.res); try { manager.process(request, response); } finally { http.res.getOutputStream().flush(); http.res.flushBuffer(); } } } basex-7.7.2/basex-api/src/main/java/org/basex/http/webdav/impl/000077500000000000000000000000001222453003200242105ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/java/org/basex/http/webdav/impl/ResourceMetaData.java000066400000000000000000000045451222453003200302530ustar00rootroot00000000000000package org.basex.http.webdav.impl; import java.util.Date; import static org.basex.http.webdav.impl.Utils.stripLeadingSlash; /** * Resource meta data. * @author BaseX Team 2005-13, BSD License * @author Dimitar Popov */ public final class ResourceMetaData { /** Database owning the resource. */ public final String db; /** Resource path. */ public final String path; /** Resource last modification date in milliseconds. */ public final long mod; /** Resource last modification date. */ public final Date mdate; /** Raw binary file flag. */ public final boolean raw; /** Resource content type. */ public final String ctype; /** Resource size in bytes. */ public final Long size; /** Folder flag. */ public final boolean folder; /** Default constructor. */ public ResourceMetaData() { this(null, 0L); } /** * Constructor. * @param d database owning the resource * @param m resource last modification date in milliseconds */ public ResourceMetaData(final String d, final long m) { this(d, "", m); } /** * Constructor. * @param d database owning the resource * @param p resource path * @param m resource last modification date in milliseconds */ public ResourceMetaData(final String d, final String p, final long m) { this(d, p, m, false, null, null, true); } /** * Constructor. * @param d database owning the resource * @param p resource path * @param m resource last modification date in milliseconds * @param r raw binary file flag * @param c resource content type * @param s resource size in bytes */ public ResourceMetaData(final String d, final String p, final long m, final boolean r, final String c, final Long s) { this(d, p, m, r, c, s, false); } /** * Constructor. * @param d database owning the resource * @param p resource path * @param m resource last modification date in milliseconds * @param r raw binary file flag * @param c resource content type * @param s resource size in bytes * @param f folder flag */ public ResourceMetaData(final String d, final String p, final long m, final boolean r, final String c, final Long s, final boolean f) { db = d; path = stripLeadingSlash(p); mod = m; raw = r; ctype = c; size = s; folder = f; mdate = mod == -1 ? null : new Date(mod); } } basex-7.7.2/basex-api/src/main/java/org/basex/http/webdav/impl/ResourceMetaDataFactory.java000066400000000000000000000017041222453003200315750ustar00rootroot00000000000000package org.basex.http.webdav.impl; /** * Factory interface for generating different WebDAV resources. * @author BaseX Team 2005-13, BSD License * @author Dimitar Popov * @param generated resource type */ public interface ResourceMetaDataFactory { /** * Creates a new resource representing a file. * @param s service instance * @param d file meta data * @return object representing the file */ T file(final WebDAVService s, final ResourceMetaData d); /** * Creates a new resource representing a folder. * @param s service instance * @param d folder meta data * @return object representing the folder */ T folder(final WebDAVService s, final ResourceMetaData d); /** * Creates a new resource representing a database. * @param s service instance * @param d database meta data * @return object representing the database */ T database(final WebDAVService s, final ResourceMetaData d); } basex-7.7.2/basex-api/src/main/java/org/basex/http/webdav/impl/Utils.java000066400000000000000000000030011222453003200261450ustar00rootroot00000000000000package org.basex.http.webdav.impl; import java.io.*; import org.basex.io.*; import org.basex.io.in.*; /** * WebDAV utility methods. * @author BaseX Team 2005-13, BSD License * @author Dimitar Popov */ public final class Utils { /** File path separator. */ public static final char SEP = '/'; /** Dummy file for empty folder.*/ static final String DUMMY = ".empty"; /** Private constructor. */ private Utils() { } /** * Strips leading slash if available. * @param s string to modify * @return string without leading slash */ public static String stripLeadingSlash(final String s) { return s == null || s.isEmpty() || s.charAt(0) != SEP ? s : s.substring(1); } /** * Gets the name from the given path. * @param path path * @return name of the resource identified by the path */ public static String name(final String path) { return IO.get(path).name(); } /** * Gets a valid database name from a general file name. * @param db name of database * @return valid database name */ public static String dbname(final String db) { return IO.get(db).dbname(); } /** * Peeks the next byte in the given buffer. * @param bi buffer * @return the next byte in the buffer * @throws IOException I/O exception */ public static int peek(final BufferInput bi) throws IOException { final TextInput ti = new TextInput(bi); final int c = ti.read(); try { bi.reset(); } catch(final IOException ignore) { } return c; } } basex-7.7.2/basex-api/src/main/java/org/basex/http/webdav/impl/WebDAVLockService.java000066400000000000000000000151431222453003200302610ustar00rootroot00000000000000package org.basex.http.webdav.impl; import org.basex.core.BaseXException; import org.basex.data.Result; import org.basex.http.HTTPContext; import org.basex.io.IOStream; import org.basex.io.out.ArrayOutput; import org.basex.io.serial.Serializer; import org.basex.query.QueryException; import org.basex.query.QueryProcessor; import org.basex.util.Util; import org.basex.util.list.StringList; import java.io.IOException; import java.io.InputStream; import java.util.UUID; import static org.basex.http.webdav.impl.Utils.SEP; import static org.basex.util.Token.string; /** * Service managing the WebDAV locks. * @author BaseX Team 2005-13, BSD License * @author Dimitar Popov */ public final class WebDAVLockService { /** Name of the database with the WebDAV locks. */ static final String WEBDAV_LOCKS_DB = "~webdav"; /** HTTP context. */ private final HTTPContext http; /** * Constructor. * @param h HTTP context */ WebDAVLockService(final HTTPContext h) { http = h; } /** * Releases the lock for the given token. * @param token lock token * @throws java.io.IOException I/O exception */ public void unlock(final String token) throws IOException { new LockQuery(http, "w:delete-lock($lock-token)"). bind("lock-token", token). execute(); } /** * Renews the lock with the given token. * @param token lock token * @throws IOException I/O exception */ public void refreshLock(final String token) throws IOException { new LockQuery(http, "w:refresh-lock($lock-token)"). bind("lock-token", token). execute(); } /** * Creates a new lock for the specified resource. * @param db database * @param p path * @param scope lock scope * @param type lock type * @param depth lock depth * @param user lock user * @param timeout lock timeout * @return lock token * @throws IOException I/O exception */ public String lock(final String db, final String p, final String scope, final String type, final String depth, final String user, final Long timeout) throws IOException { initLockDb(); final String token = UUID.randomUUID().toString(); new LockQuery(http, "w:create-lock(" + "$path," + "$lock-token," + "$lock-scope," + "$lock-type," + "$lock-depth," + "$lock-owner," + "$lock-timeout)"). bind("path", db + SEP + p). bind("lock-token", token). bind("lock-scope", scope). bind("lock-type", type). bind("lock-depth", depth). bind("lock-owner", user). bind("lock-timeout", timeout == null ? Long.MAX_VALUE : timeout). execute(); return token; } /** * Gets lock with given token. * @param token lock token * @return lock * @throws IOException I/O exception */ public String lock(final String token) throws IOException { final StringList locks = new LockQuery(http, "w:lock($lock-token)"). bind("$lock-token", token). execute(); return locks.isEmpty() ? null : locks.get(0); } /** * Gets active locks for the given resource. * @param db database * @param p path * @return locks * @throws IOException I/O exception */ public String lock(final String db, final String p) throws IOException { final StringList locks = new LockQuery(http, "w:locks-on($path)"). bind("path", db + SEP + p). execute(); return locks.isEmpty() ? null : locks.get(0); } /** * Checks if there are active conflicting locks for the given resource. * @param db database * @param p path * @return {@code true} if there active conflicting locks * @throws IOException I/O exception */ public boolean conflictingLocks(final String db, final String p) throws IOException { return new LockQuery(http, "w:conflicting-locks(" + "" + "{ $path }" + "exclusive" + "infinite" + "{ $owner }" + ")"). bind("path", db + SEP + p). bind("owner", http.user). execute(). size() > 0; } /** * Creates the lock database, if it does not exist. * @throws IOException I/O exception */ private void initLockDb() throws IOException { new LockQuery(http, "w:init-lock-db()").execute(); } /** Class abstracting the underlying query mechanism. */ private static final class LockQuery { /** Query processor. */ private final QueryProcessor p; /** * Constructor. * @param h HTTP context * @param q query text */ LockQuery(final HTTPContext h, final String q) { p = new QueryProcessor(q, h.context()); } /** * Binds a new query parameter. * @param n parameter name * @param v parameter value * @return {@code this} * @throws IOException error during binding */ LockQuery bind(final String n, final Object v) throws IOException { try { p.bind(n, v); } catch(final QueryException ex) { throw new BaseXException(ex); } return this; } /** * Executes the query. * @return list of serialized result items * @throws IOException error during query execution */ StringList execute() throws IOException { registerModule(); try { final Result r = p.execute(); final int n = (int) r.size(); final StringList items = new StringList(n); for(int i = 0; i < n; i++) { final ArrayOutput o = new ArrayOutput(); r.serialize(Serializer.get(o), 0); items.add(o.toString()); } return items; } catch(final QueryException ex) { throw new BaseXException(ex); } catch(final Exception ex) { Util.debug(ex); throw new BaseXException(ex); } finally { p.close(); } } /** * Registers the WebDAV XQuery module. * @throws IOException error during parsing the module */ private void registerModule() throws IOException { try { p.ctx.parseLibrary(string(readModule()), null); } catch(final QueryException ex) { throw new BaseXException(ex); } } /** * Reads the WebDAV XQuery module from the classpath. * @return the content of the module * @throws IOException error during reading the module */ private byte[] readModule() throws IOException { final ClassLoader cl = getClass().getClassLoader(); final InputStream s = cl.getResourceAsStream("xquery/webdav.xqm"); if(s == null) throw new IOException("WebDAV module not found"); return new IOStream(s).read(); } } } basex-7.7.2/basex-api/src/main/java/org/basex/http/webdav/impl/WebDAVService.java000066400000000000000000000423151222453003200274510ustar00rootroot00000000000000package org.basex.http.webdav.impl; import org.basex.core.Prop; import org.basex.core.Text; import org.basex.core.cmd.*; import org.basex.http.HTTPContext; import org.basex.io.in.ArrayInput; import org.basex.io.in.BufferInput; import org.basex.query.func.*; import org.basex.server.Query; import org.basex.server.Session; import org.basex.util.DateTime; import org.basex.util.Token; import org.basex.util.Util; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import static org.basex.http.webdav.impl.WebDAVLockService.*; import static org.basex.http.webdav.impl.Utils.*; import static org.basex.io.MimeTypes.APP_XML; import static org.basex.query.func.Function.*; /** * Service handling the various WebDAV operations. * @author BaseX Team 2005-13, BSD License * @author Dimitar Popov * @param the type of resource */ public final class WebDAVService { /** HTTP context. */ private final HTTPContext http; /** Resource factory. */ private final ResourceMetaDataFactory factory; /** Locking service. */ public final WebDAVLockService locking; /** * Constructor. * @param f resource factory * @param h http context */ public WebDAVService(final ResourceMetaDataFactory f, final HTTPContext h) { factory = f; http = h; locking = new WebDAVLockService(http); } /** * Authenticates the user with the given password. * @param user user name * @param pass password * @throws IOException if the login is invalid */ public void authenticate(final String user, final String pass) throws IOException { http.credentials(user, pass); http.session().close(); } /** * Checks if the user is authorized to perform the given action. * @param user user name * @param action action * @param db database * @param p path * @return {@code true} if the user is authorized */ @SuppressWarnings("unused") public boolean authorize(final String user, final String action, final String db, final String p) { return !WEBDAV_LOCKS_DB.equals(db); } /** * Checks a folder for a dummy document and delete it. * @param db database * @param p path * @throws IOException I/O exception */ public void deleteDummy(final String db, final String p) throws IOException { final String dummy = p + SEP + DUMMY; if(!pathExists(db, dummy)) return; // path contains dummy document final Session session = http.session(); session.execute(new Open(db)); session.execute(new Delete(dummy)); } /** * Checks if the specified database exists. * @param db database to be found * @return result of check * @throws IOException I/O exception */ public boolean dbExists(final String db) throws IOException { final Query q = http.session().query(_DB_LIST.args() + "[. = $db]"); q.bind("db", db); try { return q.more(); } finally { q.close(); } } /** * Retrieves the last modified timestamp of a database. * @param db database * @return timestamp in milliseconds. * @throws IOException I/O exception */ public long timestamp(final String db) throws IOException { final String s = DATA.args(_DB_INFO.args("$p") + "/descendant::" + FNDb.toName(Text.TIMESTAMP) + "[1]"); final Query q = http.session().query(s); q.bind("p", db); try { // retrieve and parse timestamp return DateTime.parse(q.execute(), DateTime.DATETIME).getTime(); } catch(final Exception ex) { Util.errln(ex); return 0L; } } /** * Retrieves meta data about the resource at the given path. * @param db database * @param p resource path * @return resource meta data * @throws IOException I/O exception */ ResourceMetaData metaData(final String db, final String p) throws IOException { final Query q = http.session().query( "let $a := " + _DB_LIST_DETAILS.args("$d", "$p") + "return (" + "$a/@raw/data()," + "$a/@content-type/data()," + "$a/@modified-date/data()," + "$a/@size/data()," + "$a/text())"); q.bind("d", db); q.bind("p", p); try { final boolean raw = Boolean.parseBoolean(q.next()); final String ctype = q.next(); final long mod = DateTime.parse(q.next()); final Long size = raw ? Long.valueOf(q.next()) : null; final String path = stripLeadingSlash(q.next()); final boolean folder = path.lastIndexOf(SEP) <= 0; return new ResourceMetaData(db, path, mod, raw, ctype, size, folder); } finally { q.close(); } } /** * Deletes a document or folder. * @param db database * @param p path * @throws IOException I/O exception */ public void delete(final String db, final String p) throws IOException { final Session session = http.session(); session.execute(new Open(db)); session.execute(new Delete(p)); // create dummy, if parent is an empty folder final int ix = p.lastIndexOf(SEP); if(ix > 0) createDummy(db, p.substring(0, ix)); } /** * Renames a document or folder. * @param db database * @param p path * @param n new name * @throws IOException I/O exception */ public void rename(final String db, final String p, final String n) throws IOException { final Session session = http.session(); session.execute(new Open(db)); session.execute(new Rename(p, n)); // create dummy, if old parent is an empty folder final int i1 = p.lastIndexOf(SEP); if(i1 > 0) createDummy(db, p.substring(0, i1)); // delete dummy, if new parent is an empty folder final int i2 = n.lastIndexOf(SEP); if(i2 > 0) deleteDummy(db, n.substring(0, i2)); } /** * Copies a document to the specified target. * @param sdb source database * @param spath source path * @param tdb target database * @param tpath target path * @throws IOException I/O exception */ public void copyDoc(final String sdb, final String spath, final String tdb, final String tpath) throws IOException { final Query q = http.session().query( "declare option db:chop 'false'; " + "if(" + _DB_IS_RAW.args("$db", "$path") + ") " + " then " + _DB_STORE.args("$tdb", "$tpath", _DB_RETRIEVE.args("$db", "$path")) + " else " + _DB_ADD.args("$tdb", _DB_OPEN.args("$db", "$path"), "$tpath")); q.bind("db", sdb); q.bind("path", spath); q.bind("tdb", tdb); q.bind("tpath", tpath); q.execute(); } /** * Copies all documents in a folder to another folder. * @param sdb source database * @param spath source path * @param tdb target database * @param tpath target folder * @throws IOException I/O exception */ public void copyAll(final String sdb, final String spath, final String tdb, final String tpath) throws IOException { final Query q = http.session().query( "declare option db:chop 'false'; " + "for $d in " + _DB_LIST.args("$db", "$path") + "let $t := $tpath ||'/'|| substring($d, string-length($path) + 1) return " + "if(" + _DB_IS_RAW.args("$db", "$d") + ") " + "then " + _DB_STORE.args("$tdb", "$t", _DB_RETRIEVE.args("$db", "$d")) + " else " + _DB_ADD.args("$tdb", _DB_OPEN.args("$db", "$d"), "$t")); q.bind("db", sdb); q.bind("path", spath); q.bind("tdb", tdb); q.bind("tpath", tpath); q.execute(); } /** * Writes a file to the specified output stream. * @param db database * @param p path * @param raw is the file a raw file * @param out output stream * @throws IOException I/O exception */ public void retrieve(final String db, final String p, final boolean raw, final OutputStream out) throws IOException { final Session session = http.session(); session.setOutputStream(out); final Query q = session.query("declare option output:" + (raw ? "method 'raw'; " + _DB_RETRIEVE.args("$db", "$path") : "use-character-maps 'webdav'; " + _DB_OPEN.args("$db", "$path"))); q.bind("db", db); q.bind("path", p); q.execute(); } /** * Creates an empty database with the given name. * @param db database name * @return object representing the newly created database * @throws IOException I/O exception */ public T createDb(final String db) throws IOException { http.session().execute(new CreateDB(db)); return factory.database(this, new ResourceMetaData(db, timestamp(db))); } /** * Drops the database with the given name. * @param db database name * @throws IOException I/O exception */ public void dropDb(final String db) throws IOException { http.session().execute(new DropDB(db)); } /** * Renames the database with the given name. * @param db database name * @param n new name * @throws IOException I/O exception */ public void renameDb(final String db, final String n) throws IOException { http.session().execute(new AlterDB(db, n)); } /** * Copies the database with the given name. * @param db database name * @param n new database name * @throws IOException I/O exception */ public void copyDb(final String db, final String n) throws IOException { http.session().execute(new Copy(db, n)); } /** * Lists the direct children of a path. * @param db database * @param path path * @return children * @throws IOException I/O exception */ public List list(final String db, final String path) throws IOException { final List ch = new ArrayList(); final HashSet paths = new HashSet(); final Query q = http.session().query( "for $a in " + _DB_LIST_DETAILS.args("$d", "$p") + "return ($a/@raw/data()," + "$a/@content-type/data()," + "$a/@modified-date/data()," + "$a/@size/data()," + SUBSTRING_AFTER.args("$a/text()", "$p") + ')'); q.bind("d", db); q.bind("p", path); while(q.more()) { final boolean raw = Boolean.parseBoolean(q.next()); final String ctype = q.next(); final long mod = DateTime.parse(q.next()); final Long size = raw ? Long.valueOf(q.next()) : null; final String p = stripLeadingSlash(q.next()); final int ix = p.indexOf(SEP); // check if document or folder if(ix < 0) { if(!p.equals(DUMMY)) ch.add(factory.file(this, new ResourceMetaData(db, path + SEP + p, mod, raw, ctype, size))); } else { final String dir = path + SEP + p.substring(0, ix); if(paths.add(dir)) ch.add(factory.folder(this, new ResourceMetaData(db, dir, mod))); } } q.close(); return ch; } /** * Lists all databases. * @return a list of database resources. * @throws IOException I/O exception */ public List listDbs() throws IOException { final List dbs = new ArrayList(); final Query q = http.session().query( "for $d in " + _DB_LIST_DETAILS.args() + "where not($d/text() eq '" + WEBDAV_LOCKS_DB + "') " + "return ($d/text(), $d/@modified-date/data())"); try { while(q.more()) { final String name = q.next(); final long mod = DateTime.parse(q.next()); dbs.add(factory.database(this, new ResourceMetaData(name, mod))); } } catch(final Exception ex) { Util.errln(ex); } finally { q.close(); } return dbs; } /** * Creates a folder at the given path. * @param db database * @param p path * @param n new folder name * @return new folder resource * @throws IOException I/O exception */ public T createFolder(final String db, final String p, final String n) throws IOException { deleteDummy(db, p); final String newFolder = p + SEP + n; createDummy(db, newFolder); return factory.folder(this, new ResourceMetaData(db, newFolder, timestamp(db))); } /** * Gets the resource at the given path. * @param db database * @param p path * @return resource * @throws IOException I/O exception */ public T resource(final String db, final String p) throws IOException { return exists(db, p) ? factory.file(this, metaData(db, p)) : pathExists(db, p) ? factory.folder(this, new ResourceMetaData(db, p, timestamp(db))) : null; } /** * Adds the given file to the specified path. * @param db database * @param p path * @param n file name * @param in file content * @return object representing the newly added file * @throws IOException I/O exception */ public T createFile(final String db, final String p, final String n, final InputStream in) throws IOException { final Session session = http.session(); session.execute(new Open(db)); final String dbp = p.isEmpty() ? n : p + SEP + n; // delete old resource if it already exists if(pathExists(db, dbp)) session.execute(new Delete(dbp)); // otherwise, delete dummy file else deleteDummy(db, p); return addFile(db, dbp, in); } /** * Creates a new database from the given file. * @param n file name * @param in file content * @return object representing the newly created database * @throws IOException I/O exception */ public T createFile(final String n, final InputStream in) throws IOException { return addFile(null, n, in); } /** * Checks if any of the resources which start with the given path. * @param db name of database * @param p path * @return {@code true} if there are resources with the given prefix * @throws IOException I/O exception */ private boolean pathExists(final String db, final String p) throws IOException { final Query q = http.session().query(COUNT.args(_DB_LIST.args("$d", "$p"))); q.bind("d", db); q.bind("p", p); return !"0".equals(q.execute()); } /** * Checks if any resource with the specified name exists. * @param db name of database * @param p resource path * @return {@code true} if there are resources with the name * @throws IOException I/O exception */ private boolean exists(final String db, final String p) throws IOException { final Query q = http.session().query(_DB_EXISTS.args("$d", "$p")); q.bind("d", db); q.bind("p", p); return q.execute().equals(Text.TRUE); } /** * Creates a database with the given name and add the given document. * @param db database name * @param in data stream * @return object representing the newly created database * @throws IOException I/O exception */ private T createDb(final String db, final InputStream in) throws IOException { http.session().create(db, in); return factory.database(this, new ResourceMetaData(db, timestamp(db))); } /** * Adds a document with the specified name to the given path. * @param db database * @param p path where the document will be added * @param in data stream * @return object representing the newly added XML * @throws IOException I/O exception */ private T addXML(final String db, final String p, final InputStream in) throws IOException { final Session session = http.session(); session.execute(new Set(Prop.CHOP, false)); session.add(p, in); return factory.file(this, new ResourceMetaData(db, p, timestamp(db), false, APP_XML, null)); } /** * Adds a binary file with the specified name to the given path. * @param db database * @param p path where the file will be stored * @param in data stream * @return object representing the newly added file * @throws IOException I/O exception */ private T store(final String db, final String p, final InputStream in) throws IOException { http.session().store(p, in); return factory.file(this, metaData(db, p)); } /** * Adds a file in to the given path. * @param db database * @param p path * @param in file content * @return object representing the newly added file * @throws IOException I/O exception */ private T addFile(final String db, final String p, final InputStream in) throws IOException { // use 4MB as buffer input final BufferInput bi = new BufferInput(in, 1 << 22); try { // guess the content type from the first character if(peek(bi) == '<') { try { // add input as XML document return db == null ? createDb(dbname(p), bi) : addXML(db, p, bi); } catch(final IOException ex) { // reset stream if it did not work out try { bi.reset(); } catch(final IOException e) { // throw original exception if input cannot be reset throw ex; } } } // add input as raw file final String d; if(db == null) { d = dbname(p); createDb(d); } else { d = db; } return store(d, p, bi); } finally { bi.close(); } } /** * Checks if a folder is empty and create a dummy document. * @param db database * @param p path * @throws IOException I/O exception */ private void createDummy(final String db, final String p) throws IOException { // check if path is a folder and is empty if(p.matches("[^/]") || pathExists(db, p)) return; final Session session = http.session(); session.execute(new Open(db)); session.store(p + SEP + DUMMY, new ArrayInput(Token.EMPTY)); } } basex-7.7.2/basex-api/src/main/java/org/basex/modules/000077500000000000000000000000001222453003200224705ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/java/org/basex/modules/Session.java000066400000000000000000000073621222453003200247660ustar00rootroot00000000000000package org.basex.modules; import java.util.*; import javax.servlet.http.*; import org.basex.data.*; import org.basex.http.*; import org.basex.query.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.util.*; import org.basex.util.list.*; /** * This module contains functions for processing server-side session data. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Session extends QueryModule { /** * Returns the session ID. * @return session id * @throws QueryException query exception */ @Requires(Permission.NONE) public Str id() throws QueryException { return Str.get(session().getId()); } /** * Returns the creation time of the session. * @return creation time * @throws QueryException query exception */ @Requires(Permission.NONE) public Dtm created() throws QueryException { return new Dtm(session().getCreationTime(), null); } /** * Returns the last access time of the session. * @return creation time * @throws QueryException query exception */ @Requires(Permission.NONE) public Dtm accessed() throws QueryException { return new Dtm(session().getLastAccessedTime(), null); } /** * Returns all session attributes. * @return session attributes * @throws QueryException query exception */ @Requires(Permission.NONE) public Value names() throws QueryException { final TokenList tl = new TokenList(); final Enumeration en = session().getAttributeNames(); while(en.hasMoreElements()) tl.add(en.nextElement()); return StrSeq.get(tl); } /** * Returns a session attribute. * @param key key to be requested * @return session attribute * @throws QueryException query exception */ @Requires(Permission.NONE) public Item get(final Str key) throws QueryException { return get(key, null); } /** * Returns a session attribute. * @param key key to be requested * @param def default item * @return session attribute * @throws QueryException query exception */ @Requires(Permission.NONE) public Item get(final Str key, final Item def) throws QueryException { final Object o = session().getAttribute(key.toJava()); if(o == null) return def; if(o instanceof Item) return (Item) o; throw SessionErrors.noAttribute(Util.name(o)); } /** * Updates a session attribute. * @param key key of the attribute * @param item item to be stored * @throws QueryException query exception */ @Requires(Permission.NONE) public void set(final Str key, final Item item) throws QueryException { Item it = item; final Data d = it.data(); if(d != null && !d.inMemory()) { // convert database node to main memory data instance it = ((ANode) it).dbCopy(context.context.prop); } else if(it instanceof FItem) { throw SessionErrors.functionItem(); } session().setAttribute(key.toJava(), it); } /** * Removes a session attribute. * @param key key of the attribute * @throws QueryException query exception */ @Requires(Permission.NONE) public void delete(final Str key) throws QueryException { session().removeAttribute(key.toJava()); } /** * Invalidates a session. * @throws QueryException query exception */ @Requires(Permission.NONE) public void close() throws QueryException { session().invalidate(); } /** * Returns the session instance. * @return request * @throws QueryException query exception */ private HttpSession session() throws QueryException { if(context.http == null) throw SessionErrors.noContext(); return ((HTTPContext) context.http).req.getSession(); } } basex-7.7.2/basex-api/src/main/java/org/basex/modules/SessionErrors.java000066400000000000000000000034101222453003200261510ustar00rootroot00000000000000package org.basex.modules; import org.basex.query.*; import org.basex.query.value.item.*; /** * This module contains static error functions for the Session module. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class SessionErrors { /** Error namespace. */ private static final byte[] NS = QueryText.BXERRORS; /** Namespace and error code prefix. */ private static final String PREFIX = "bxerr:BXSE"; /** Private constructor, preventing instantiation. */ private SessionErrors() { } /** * BXSE0001: function items cannot be stored in sessions. * @return query exception */ static QueryException functionItem() { return thrw(1, "Function items cannot be stored in sessions."); } /** * BXSE0002: stored attribute cannot be retrieved. * @param name name of attribute * @return query exception */ static QueryException noAttribute(final Object name) { return thrw(2, "Stored attribute cannot be retrieved: %.", name); } /** * BXSE0003: servlet context required. * @return query exception */ static QueryException noContext() { return thrw(3, "Servlet context required."); } /** * BXSE0004: session not found. * @param id session id * @return query exception */ static QueryException whichSession(final Object id) { return thrw(4, "Session not found: %.", id); } /** * Creates a new exception. * @param code error code * @param msg error message * @param ext optional error extension * @return query exception */ private static QueryException thrw(final int code, final String msg, final Object... ext) { final QNm name = new QNm(String.format("%s%04d", PREFIX, code), NS); return new QueryException(null, name, msg, ext); } } basex-7.7.2/basex-api/src/main/java/org/basex/modules/Sessions.java000066400000000000000000000103411222453003200251400ustar00rootroot00000000000000package org.basex.modules; import java.util.*; import javax.servlet.http.*; import org.basex.data.*; import org.basex.http.*; import org.basex.query.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.util.*; import org.basex.util.list.*; /** * This module contains functions for processing global sessions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Sessions extends QueryModule { /** * Returns the ids of all registered sessions. * @return session ids */ public Value ids() { final HashMap http = SessionListener.sessions(); final TokenList tl = new TokenList(http.size()); for(final String s : http.keySet()) tl.add(s); return StrSeq.get(tl); } /** * Returns the creation time of the session. * @param id session id * @return creation time * @throws QueryException query exception */ @Requires(Permission.NONE) public Dtm created(final Str id) throws QueryException { return new Dtm(session(id).getCreationTime(), null); } /** * Returns the last access time of the session. * @param id session id * @return creation time * @throws QueryException query exception */ @Requires(Permission.NONE) public Dtm accessed(final Str id) throws QueryException { return new Dtm(session(id).getLastAccessedTime(), null); } /** * Returns all attributes of the specified session. * @param id session id * @return session attributes * @throws QueryException query exception */ public Value names(final Str id) throws QueryException { final TokenList tl = new TokenList(); final Enumeration en = session(id).getAttributeNames(); while(en.hasMoreElements()) tl.add(en.nextElement()); return StrSeq.get(tl); } /** * Returns the specified session attribute of a session. * @param id session id * @param key key to be requested * @return session attribute * @throws QueryException query exception */ public Item get(final Str id, final Str key) throws QueryException { return get(id, key, null); } /** * Returns the specified session attribute of a session. * @param id session id * @param key key to be requested * @param def default item * @return session attribute * @throws QueryException query exception */ public Item get(final Str id, final Str key, final Item def) throws QueryException { final Object o = session(id).getAttribute(key.toJava()); if(o == null) return def; if(o instanceof Item) return (Item) o; throw SessionErrors.noAttribute(Util.name(o)); } /** * Updates a session attribute. * @param id session id * @param key key of the attribute * @param item item to be stored * @throws QueryException query exception */ public void set(final Str id, final Str key, final Item item) throws QueryException { Item it = item; final Data d = it.data(); if(d != null && !d.inMemory()) { // convert database node to main memory data instance it = ((ANode) it).dbCopy(context.context.prop); } else if(it instanceof FItem) { throw SessionErrors.functionItem(); } session(id).setAttribute(key.toJava(), it); } /** * Removes a session attribute. * @param id session id * @param key key of the attribute * @throws QueryException query exception */ public void delete(final Str id, final Str key) throws QueryException { session(id).removeAttribute(key.toJava()); } /** * Invalidates a session. * @param id session id * @throws QueryException query exception */ public void close(final Str id) throws QueryException { session(id).invalidate(); } /** * Returns the specified session. * @param id ids * @return request * @throws QueryException query exception */ private HttpSession session(final Str id) throws QueryException { if(context.http == null) throw SessionErrors.noContext(); final HashMap http = SessionListener.sessions(); final HttpSession session = http.get(id.toJava()); if(session == null) throw SessionErrors.whichSession(id); return session; } } basex-7.7.2/basex-api/src/main/java/org/expath/000077500000000000000000000000001222453003200212075ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/java/org/expath/ns/000077500000000000000000000000001222453003200216275ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/java/org/expath/ns/Geo.java000066400000000000000000000626371222453003200232220ustar00rootroot00000000000000package org.expath.ns; import static org.basex.util.Token.*; import java.io.*; import org.basex.build.*; import org.basex.build.xml.*; import org.basex.io.*; import org.basex.query.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import com.vividsolutions.jts.geom.*; import com.vividsolutions.jts.io.*; import com.vividsolutions.jts.io.gml2.*; /** * This module contains geo spatial functions for the Geo module. * * @author BaseX Team 2005-12, BSD License * @author Masoumeh Seydi */ public class Geo extends QueryModule { /** GML URI. */ private static final byte[] URI = token("http://www.opengis.net/gml"); /** Prefix: "gml". */ private static final String GML = "gml"; /** QName gml:Point. */ private static final QNm Q_GML_POINT = QNm.get(GML, "Point", URI); /** QName gml:MultiPoint. */ private static final QNm Q_GML_MULTIPOINT = QNm.get(GML, "MultiPoint", URI); /** QName gml:LineString. */ private static final QNm Q_GML_LINESTRING = QNm.get(GML, "LineString", URI); /** QName gml:LinearRing. */ private static final QNm Q_GML_LINEARRING = QNm.get(GML, "LinearRing", URI); /** QName gml:Polygon. */ private static final QNm Q_GML_POLYGON = QNm.get(GML, "Polygon", URI); /** QName gml:MultiPolygon. */ private static final QNm Q_GML_MULTIPOLYGON = QNm.get(GML, "MultiPolygon", URI); /** QName gml:MultiLineString. */ private static final QNm Q_GML_MULTILINESTRING = QNm.get(GML, "MultiLineString", URI); /** Array containing all QNames. */ private static final QNm[] QNAMES = { Q_GML_POINT, Q_GML_LINESTRING, Q_GML_POLYGON, Q_GML_MULTIPOINT, Q_GML_MULTILINESTRING, Q_GML_MULTIPOLYGON, Q_GML_LINEARRING }; /** * Returns the dimension of an item. * @param node xml element containing gml object(s) * @return dimension * @throws QueryException query exception */ @Deterministic public Int dimension(final ANode node) throws QueryException { return Int.get(checkGeo(node).getDimension()); } /** * Returns the name of the geometry type in the GML namespace, or the empty sequence. * @param node xml element containing gml object(s) * @return geometry type * @throws QueryException query exception */ @Deterministic public QNm geometryType(final ANode node) throws QueryException { return new QNm(GML + ':' + checkGeo(node).getGeometryType(), URI); } /** * Returns the name of the geometry type in the GML namespace, or the empty sequence. * @param node xml element containing gml object(s) * @return integer value of CRS of the geometry * @throws QueryException query exception */ @Deterministic public Uri srid(final ANode node) throws QueryException { return Uri.uri(token(checkGeo(node).getSRID())); } /** * Returns the gml:Envelope of the specified geometry. * The envelope is the minimum bounding box of this geometry. * @param node xml element containing gml object(s) * @return envelop element * @throws QueryException query exception */ @Deterministic public ANode envelope(final ANode node) throws QueryException { return gmlWriter(checkGeo(node).getEnvelope()); } /** * Returns the WKT format of a geometry. * @param node xml element containing gml object(s) * @return Well-Known Text geometry representation * @throws QueryException query exception */ @Deterministic public Str asText(final ANode node) throws QueryException { return Str.get(new WKTWriter().write(checkGeo(node))); } /** * Returns the WKB format of a geometry. * @param node xml element containing gml object(s) * @return Well-Known Binary geometry representation * @throws QueryException query exception */ @Deterministic public B64 asBinary(final ANode node) throws QueryException { return new B64(new WKBWriter().write(checkGeo(node))); } /** * Returns a boolean value which shows if the specified geometry is empty or not. * @param node xml element containing gml object(s) * @return boolean value * @throws QueryException query exception */ @Deterministic public Bln isEmpty(final ANode node) throws QueryException { return Bln.get(node != null && checkGeo(node) != null); } /** * Returns a boolean value which shows if the specified geometry is simple or not, * which has no anomalous geometric points, such as self intersection or self tangency. * @param node xml element containing gml object(s) * @return boolean value * @throws QueryException query exception */ @Deterministic public Bln isSimple(final ANode node) throws QueryException { return Bln.get(checkGeo(node).isSimple()); } /** * Returns the boundary of the geometry, in GML. * The return value is a sequence of either gml:Point or gml:LinearRing elements. * @param node xml element containing gml object(s) * @return boundary element (geometry) * @throws QueryException query exception */ @Deterministic public ANode boundary(final ANode node) throws QueryException { return gmlWriter(checkGeo(node).getBoundary()); } /** * Returns a boolean value that shows if two geometries are equal or not. * @param node1 xml element containing gml object(s) * @param node2 xml element containing gml object(s) * @return boolean value * @throws QueryException query exception */ @Deterministic public Bln equals(final ANode node1, final ANode node2) throws QueryException { final Geometry geo1 = checkGeo(node1); final Geometry geo2 = checkGeo(node2); return Bln.get(geo1.equals(geo2)); } /** * Returns a boolean value that shows if this geometry is disjoint to another geometry. * @param node1 xml element containing gml object(s) * @param node2 xml element containing gml object(s) * @return boolean value * @throws QueryException query exception */ @Deterministic public Bln disjoint(final ANode node1, final ANode node2) throws QueryException { final Geometry geo1 = checkGeo(node1); final Geometry geo2 = checkGeo(node2); return Bln.get(geo1.disjoint(geo2)); } /** * Returns a boolean value that shows if this geometry intersects another geometry. * @param node1 xml element containing gml object(s) * @param node2 xml element containing gml object(s) * @return boolean value * @throws QueryException query exception */ @Deterministic public Bln intersects(final ANode node1, final ANode node2) throws QueryException { final Geometry geo1 = checkGeo(node1); final Geometry geo2 = checkGeo(node2); return Bln.get(geo1.intersects(geo2)); } /** * Returns a boolean value that shows if this geometry touches the specified geometry. * @param node1 xml element containing gml object(s) * @param node2 xml element containing gml object(s) * @return boolean value * @throws QueryException query exception */ @Deterministic public Bln touches(final ANode node1, final ANode node2) throws QueryException { final Geometry geo1 = checkGeo(node1); final Geometry geo2 = checkGeo(node2); return Bln.get(geo1.touches(geo2)); } /** * Returns a boolean value that shows if this geometry crosses the specified geometry. * @param node1 xml element containing gml object(s) * @param node2 xml element containing gml object(s) * @return boolean value * @throws QueryException query exception */ @Deterministic public Bln crosses(final ANode node1, final ANode node2) throws QueryException { final Geometry geo1 = checkGeo(node1); final Geometry geo2 = checkGeo(node2); return Bln.get(geo1.crosses(geo2)); } /** * Returns a boolean value that shows if this geometry is within the specified geometry. * @param node1 xml element containing gml object(s) * @param node2 xml element containing gml object(s) * @return boolean value * @throws QueryException query exception */ @Deterministic public Bln within(final ANode node1, final ANode node2) throws QueryException { final Geometry geo1 = checkGeo(node1); final Geometry geo2 = checkGeo(node2); return Bln.get(geo1.within(geo2)); } /** * Returns a boolean value that shows if this geometry contains the specified geometry. * @param node1 xml element containing gml object(s) * @param node2 xml element containing gml object(s) * @return boolean value * @throws QueryException query exception */ @Deterministic public Bln contains(final ANode node1, final ANode node2) throws QueryException { final Geometry geo1 = checkGeo(node1); final Geometry geo2 = checkGeo(node2); return Bln.get(geo1.contains(geo2)); } /** * Returns a boolean value that shows if this geometry overlaps the specified geometry. * @param node1 xml element containing gml object(s) * @param node2 xml element containing gml object(s) * @return boolean value * @throws QueryException query exception */ @Deterministic public Bln overlaps(final ANode node1, final ANode node2) throws QueryException { final Geometry geo1 = checkGeo(node1); final Geometry geo2 = checkGeo(node2); return Bln.get(geo1.overlaps(geo2)); } /** * Returns a boolean value that shows if whether relationships between the boundaries, * interiors and exteriors of two geometries match * the pattern specified in intersection-matrix-pattern. * @param node1 xml element containing gml object(s) * @param node2 xml element containing gml object(s) * @param intersectionMatrix intersection matrix for two geometries * @return boolean value * @throws QueryException query exception */ @Deterministic public Bln relate(final ANode node1, final ANode node2, final Str intersectionMatrix) throws QueryException { final Geometry geo1 = checkGeo(node1); final Geometry geo2 = checkGeo(node2); return Bln.get(geo1.relate(geo2, intersectionMatrix.toJava())); } /** * Returns the shortest distance in the units of the spatial reference system * of geometry, between the geometries. * The distance is the distance between a point on each of the geometries. * @param node1 xml element containing gml object(s) * @param node2 xml element containing gml object(s) * @return distance double value * @throws QueryException query exception */ @Deterministic public Dbl distance(final ANode node1, final ANode node2) throws QueryException { final Geometry geo1 = checkGeo(node1); final Geometry geo2 = checkGeo(node2); return Dbl.get(geo1.distance(geo2)); } /** * Returns a polygon that represents all Points whose distance from this * geometric object is less than or equal to distance. * The returned element must be either gml:Polygon, gml:LineString or gml:Point. * @param node xml element containing gml object(s) * @param distance specific distance from the $geometry (the buffer width) * @return buffer geometry as gml element * @throws QueryException query exception */ @Deterministic public ANode buffer(final ANode node, final Dbl distance) throws QueryException { return gmlWriter(checkGeo(node).buffer(distance.dbl())); } /** * Returns the convex hull geometry of a geometry in GML, or the empty sequence. * The returned element must be either gml:Polygon, gml:LineString or gml:Point. * @param node xml element containing gml object(s) * @return convex hull geometry as a gml element * @throws QueryException query exception */ @Deterministic public ANode convexHull(final ANode node) throws QueryException { return gmlWriter(checkGeo(node).convexHull()); } /** * Returns a geometric object representing the Point set intersection of two geometries. * @param node1 xml element containing gml object(s) * @param node2 xml element containing gml object(s) * @return intersection geometry as a gml element * @throws QueryException query exception */ @Deterministic public ANode intersection(final ANode node1, final ANode node2) throws QueryException { final Geometry geo1 = checkGeo(node1); final Geometry geo2 = checkGeo(node2); return gmlWriter(geo1.intersection(geo2)); } /** * Returns a geometric object that represents the Point set union of two geometries. * @param node1 xml element containing gml object(s) * @param node2 xml element containing gml object(s) * @return union geometry as a gml element * @throws QueryException query exception */ @Deterministic public ANode union(final ANode node1, final ANode node2) throws QueryException { final Geometry geo1 = checkGeo(node1); final Geometry geo2 = checkGeo(node2); return gmlWriter(geo1.union(geo2)); } /** * Returns a geometric object that represents the * Point set difference of two geometries. * @param node1 xml element containing gml object(s) * @param node2 xml element containing gml object(s) * @return difference geometry as a gml element * @throws QueryException query exception */ @Deterministic public ANode difference(final ANode node1, final ANode node2) throws QueryException { final Geometry geo1 = checkGeo(node1); final Geometry geo2 = checkGeo(node2); return gmlWriter(geo1.difference(geo2)); } /** * Returns a geometric object that represents the * Point set symmetric difference of two geometries. * @param node1 xml element containing gml object(s) * @param node2 xml element containing gml object(s) * @return symmetric difference geometry as a gml element * @throws QueryException query exception */ @Deterministic public ANode symDifference(final ANode node1, final ANode node2) throws QueryException { final Geometry geo1 = checkGeo(node1); final Geometry geo2 = checkGeo(node2); return gmlWriter(geo1.symDifference(geo2)); } /** * Returns number of geometries in a geometry collection, * or 1 if the input is not a collection. * @param node xml element containing gml object(s) * @return integer value of number of geometries * @throws QueryException query exception */ @Deterministic public Int numGeometries(final ANode node) throws QueryException { return Int.get(checkGeo(node).getNumGeometries()); } /** * Returns the nth geometry of a geometry collection, * or the geometry if the input is not a collection. * @param node xml element containing gml object(s) * @param number integer number as the index of nth geometry * @return geometry as a gml element * @throws QueryException query exception */ @Deterministic public ANode geometryN(final ANode node, final Int number) throws QueryException { final Geometry geo = checkGeo(node); final long n = number.itr(); if(n < 1 || n > geo.getNumGeometries()) throw GeoErrors.outOfRangeIdx(number); return gmlWriter(geo.getGeometryN((int) n - 1)); } /** * Returns the x-coordinate value for point. * @param node xml element containing gml object(s) * @return x double value * @throws QueryException query exception */ @Deterministic public Dbl x(final ANode node) throws QueryException { final Geometry geo = geo(node, Q_GML_POINT); if(geo == null && checkGeo(node) != null) throw GeoErrors.geoType(node.qname().local(), "Point"); return Dbl.get(geo.getCoordinate().x); } /** * Returns the y-coordinate value for point. * @param node xml element containing gml object(s) * @return y double value * @throws QueryException query exception */ @Deterministic public Dbl y(final ANode node) throws QueryException { final Geometry geo = geo(node, Q_GML_POINT); if(geo == null && checkGeo(node) != null) throw GeoErrors.geoType(node.qname().local(), "Point"); return Dbl.get(geo.getCoordinate().y); } /** * Returns the z-coordinate value for point. * @param node xml element containing gml object(s) * @return z double value * @throws QueryException query exception */ @Deterministic public Dbl z(final ANode node) throws QueryException { final Geometry geo = geo(node, Q_GML_POINT); if(geo == null && checkGeo(node) != null) throw GeoErrors.geoType(node.qname().local(), "Line"); return Dbl.get(geo.getCoordinate().z); } /** * Returns the length of this Geometry. Linear geometries return their length. * Areal geometries return their parameter. Others return 0.0 * @param node xml element containing gml object(s) * @return length double value * @throws QueryException query exception */ @Deterministic public Dbl length(final ANode node) throws QueryException { return Dbl.get(checkGeo(node).getLength()); } /** * Returns the start point of a line. * @param node xml element containing gml object(s) * @return start point geometry as a gml element * @throws QueryException query exception */ @Deterministic public ANode startPoint(final ANode node) throws QueryException { final Geometry geo = geo(node, Q_GML_LINEARRING, Q_GML_LINESTRING); if(geo == null && checkGeo(node) != null) throw GeoErrors.geoType(node.qname().local(), "Line"); return gmlWriter(geo instanceof LineString ? ((LineString) geo).getStartPoint() : ((LinearRing) geo).getStartPoint()); } /** * Returns the end point of a line. * @param node xml element containing gml object(s) * @return end point geometry as a gml element * @throws QueryException query exception */ @Deterministic public ANode endPoint(final ANode node) throws QueryException { final Geometry geo = geo(node, Q_GML_LINEARRING, Q_GML_LINESTRING); if(geo == null && checkGeo(node) != null) throw GeoErrors.geoType(node.qname().local(), "Line"); return gmlWriter(geo instanceof LineString ? ((LineString) geo).getEndPoint() : ((LinearRing) geo).getEndPoint()); } /** * Checks if the line is closed loop. * That is, if the start Point is same with end Point. * @param node xml element containing gml object(s) * @return boolean value * @throws QueryException query exception */ @Deterministic public Bln isClosed(final ANode node) throws QueryException { final Geometry geo = geo(node, Q_GML_LINEARRING, Q_GML_LINESTRING, Q_GML_MULTILINESTRING); if(geo == null && checkGeo(node) != null) throw GeoErrors.geoType(node.qname().local(), "Line"); return Bln.get(geo instanceof LineString ? ((LineString) geo).isClosed() : geo instanceof LinearRing ? ((LinearRing) geo).isClosed() : ((MultiLineString) geo).isClosed()); } /** * Return a boolean value that shows weather the line is a ring or not. * A line is a ring if it is closed and simple. * @param node xml element containing gml object(s) * @return boolean value * @throws QueryException query exception */ @Deterministic public Bln isRing(final ANode node) throws QueryException { final Geometry geo = geo(node, Q_GML_LINEARRING, Q_GML_LINESTRING); if(geo == null && checkGeo(node) != null) throw GeoErrors.geoType(node.qname().local(), "Line"); return Bln.get(geo instanceof LineString ? ((LineString) geo).isRing() : ((LinearRing) geo).isRing()); } /** * Returns the number of points in a geometry. * @param node xml element containing gml object(s) * @return number of points int value * @throws QueryException query exception */ @Deterministic public Int numPoints(final ANode node) throws QueryException { return Int.get(checkGeo(node).getNumPoints()); } /** * Returns the nth point of a line. * @param node xml element containing gml object(s) * @param number index of i-th point * @return n-th point as a gml element * @throws QueryException query exception */ @Deterministic public ANode pointN(final ANode node, final Int number) throws QueryException { final Geometry geo = geo(node, Q_GML_LINEARRING, Q_GML_LINESTRING); if(geo == null && checkGeo(node) != null) throw GeoErrors.geoType(node.qname().local(), "Line"); final int max = geo.getNumPoints(); final long n = number.itr(); if(n < 1 || n > max) throw GeoErrors.outOfRangeIdx(number); return gmlWriter(geo instanceof LineString ? ((LineString) geo).getPointN((int) n - 1) : ((LinearRing) geo).getPointN((int) n - 1)); } /** * Returns the area of a Geometry. Areal Geometries have a non-zero area. * Returns zero for Point and Lines. * @param node xml element containing gml object(s) * @return geometry area as a double vaue * @throws QueryException query exception */ @Deterministic public Dbl area(final ANode node) throws QueryException { return Dbl.get(checkGeo(node).getArea()); } /** * Returns the mathematical centroid of the geometry as a gml:Point. * The point is not guaranteed to be on the surface. * @param node xml element containing gml object(s) * @return centroid geometry as a gml element * @throws QueryException query exception */ @Deterministic public ANode centroid(final ANode node) throws QueryException { return gmlWriter(checkGeo(node).getCentroid()); } /** * Returns a gml:Point that is interior of this geometry. * If it cannot be inside the geometry, then it will be on the boundary. * @param node xml element containing gml object(s) * @return a point as a gml element * @throws QueryException query exception */ @Deterministic public ANode pointOnSurface(final ANode node) throws QueryException { return gmlWriter(checkGeo(node).getInteriorPoint()); } /** * Returns the outer ring of a polygon, in GML. * @param node xml element containing gml object(s) * @return exterior ring geometry (LineString) as a gml element * @throws QueryException query exception */ @Deterministic public ANode exteriorRing(final ANode node) throws QueryException { final Geometry geo = geo(node, Q_GML_POLYGON); if(geo == null && checkGeo(node) != null) throw GeoErrors.geoType(node.qname().local(), "Polygon"); return gmlWriter(((Polygon) geo).getExteriorRing()); } /** * Returns the number of interior rings in a polygon. * @param node xml element containing gml object(s) * @return integer number of interior rings * @throws QueryException query exception */ @Deterministic public Int numInteriorRing(final ANode node) throws QueryException { final Geometry geo = geo(node, Q_GML_POLYGON); if(geo == null && checkGeo(node) != null) throw GeoErrors.geoType(node.qname().local(), "Polygon"); return Int.get(((Polygon) geo).getNumInteriorRing()); } /** * Returns the nth geometry of a geometry collection. * @param node xml element containing gml object(s) * @param number index of i-th interior ring * @return n-th interior ring geometry (LineString) as a gml element * @throws QueryException query exception */ @Deterministic public ANode interiorRingN(final ANode node, final Int number) throws QueryException { final Geometry geo = geo(node, Q_GML_POLYGON); if(geo == null && checkGeo(node) != null) throw GeoErrors.geoType(node.qname().local(), "Polygon"); final long n = number.itr(); final int max = ((Polygon) geo).getNumInteriorRing(); if(n < 1 || n > max) throw GeoErrors.outOfRangeIdx(number); return gmlWriter(((Polygon) geo).getInteriorRingN((int) n - 1)); } // PRIVATE METHODS (hidden from user of module) ======================================== /** * Reads an element as a gml node. Returns a geometry element * or throws an exception if the element is of the wrong type. * @param node xml node containing gml object(s) * @return geometry * @throws QueryException query exception */ private Geometry checkGeo(final ANode node) throws QueryException { final Geometry geo = geo(node, QNAMES); if(geo == null) throw GeoErrors.unrecognizedGeo(node.qname().local()); return geo; } /** * Reads an element as a gml node. Returns a geometry element * or {@code null} if the element does not match one of the specified types. * @param node xml node containing gml object(s) * @param names allowed geometry types * @return geometry, or {@code null} * @throws QueryException query exception */ private Geometry geo(final ANode node, final QNm... names) throws QueryException { if(node.type != NodeType.ELM) Err.FUNCMP.thrw(null, this, NodeType.ELM, node.type); final QNm qname = node.qname(); for(final QNm geo : names) { if(!qname.eq(geo)) continue; // type found... create reader and geometry element try { final String input = node.serialize().toString(); final GMLReader gmlReader = new GMLReader(); final GeometryFactory geoFactory = new GeometryFactory(); return gmlReader.read(input, geoFactory); } catch (final Throwable e) { throw GeoErrors.gmlReaderErr(e); } } return null; } /** * Writes an geometry and returns a string representation of the geometry. * @param geometry geometry * @return DBNode database node * @throws QueryException exception */ private DBNode gmlWriter(final Geometry geometry) throws QueryException { String geo; try { // write geometry and add namespace declaration geo = new GMLWriter().write(geometry).replaceAll( "^", ""); } catch(final Exception ex) { throw GeoErrors.gmlWriterErr(ex); } try { final IO io = new IOContent(geo); return new DBNode(MemBuilder.build(new XMLParser(io, context.context.prop))); } catch(final IOException ex) { throw Err.IOERR.thrw(null, ex); } } }basex-7.7.2/basex-api/src/main/java/org/expath/ns/GeoErrors.java000066400000000000000000000045151222453003200244060ustar00rootroot00000000000000package org.expath.ns; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * This module contains static error functions for the Geo module. * * @author BaseX Team 2005-12, BSD License * @author Masoumeh Seydi */ public final class GeoErrors { /** Error namespace. */ private static final byte[] NS = QueryText.EXPERROR; /** Namespace and error code prefix. */ private static final String PREFIX = new TokenBuilder(QueryText.EXPERR).add(":GEO").toString(); /** Private constructor, preventing instantiation. */ private GeoErrors() { } /** * GEO0001: Unrecognized geo object. * @param element Geometry object * @return query exception */ static QueryException unrecognizedGeo(final Object element) { return thrw(1, "Unrecognized Geo type: %", element); } /** * GEO0002: gml reader error massage (JTS). * @param e error * @return query exception */ static QueryException gmlReaderErr(final Object e) { return thrw(2, "%", e); } /** * GEO0003: Inappropriate input geometry. * @param input Geometry object * @param geo exact Geometry object * @return query exception */ static QueryException geoType(final Object input, final String geo) { return thrw(3, "% is not an appropiate geometry for this function. " + "The input geometry should be a %.", input, geo); } /** * GEO0004: Out of range index. * @param geoNumber index * @return query exception */ static QueryException outOfRangeIdx(final Int geoNumber) { return thrw(4, "Out of range input index: %", geoNumber); } /** * GEO0005: gml writer error massage (JTS). * @param e error * @return query exception */ static QueryException gmlWriterErr(final Object e) { return thrw(5, "%", e); } /** * Returns a query exception. * @param code code * @param msg message * @param ext extension * @return query exception */ private static QueryException thrw(final int code, final String msg, final Object... ext) { return new QueryException(null, qname(code), msg, ext); } /** * Creates an error QName for the specified code. * @param code code * @return query exception */ public static QNm qname(final int code) { return new QNm(String.format("%s:GEO%04d", PREFIX, code), NS); } } basex-7.7.2/basex-api/src/main/java/org/exquery/000077500000000000000000000000001222453003200214205ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/java/org/exquery/ns/000077500000000000000000000000001222453003200220405ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/java/org/exquery/ns/Request.java000066400000000000000000000170341222453003200243400ustar00rootroot00000000000000package org.exquery.ns; import java.util.*; import javax.servlet.http.*; import org.basex.http.*; import org.basex.query.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.seq.*; import org.basex.util.list.*; /** * This module contains functions for handling servlet requests. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Request extends QueryModule { /** * Returns the method of a request. * @return path * @throws QueryException query exception */ @Deterministic @Requires(Permission.NONE) public Str method() throws QueryException { return Str.get(request().getMethod()); } /** * Returns the Scheme component of a request. * @return path * @throws QueryException query exception */ @Deterministic @Requires(Permission.NONE) public Str scheme() throws QueryException { return Str.get(request().getScheme()); } /** * Returns the Hostname fragment of a request. * @return path * @throws QueryException query exception */ @Deterministic @Requires(Permission.NONE) public Str hostname() throws QueryException { return Str.get(request().getServerName()); } /** * Returns the Port fragment of a request. * @return path * @throws QueryException query exception */ @Deterministic @Requires(Permission.NONE) public Int port() throws QueryException { return Int.get(request().getServerPort()); } /** * Returns the path of the request. * @return path * @throws QueryException query exception */ @Deterministic @Requires(Permission.NONE) public Str path() throws QueryException { return Str.get(request().getRequestURI()); } /** * Returns the query string of a request. * @return path * @throws QueryException query exception */ @Deterministic @Requires(Permission.NONE) public Str query() throws QueryException { final String query = request().getQueryString(); return query == null ? null : Str.get(query); } /** * Returns the URI of a request. * @return path * @throws QueryException query exception */ @Deterministic @Requires(Permission.NONE) public Uri uri() throws QueryException { return Uri.uri(request().getRequestURL().toString()); } /** * Returns the query string of a request. * @return path * @throws QueryException query exception */ @Deterministic @Requires(Permission.NONE) public Str address() throws QueryException { return Str.get(request().getLocalAddr()); } /** * Returns the remote host name of a request. * @return host name * @throws QueryException query exception */ @Deterministic @Requires(Permission.NONE) public Str remoteHostname() throws QueryException { return Str.get(request().getRemoteHost()); } /** * Returns the remote host name of a request. * @return host name * @throws QueryException query exception */ @Deterministic @Requires(Permission.NONE) public Str remoteAddress() throws QueryException { return Str.get(request().getRemoteAddr()); } /** * Returns the remote host name of a request. * @return host name * @throws QueryException query exception */ @Deterministic @Requires(Permission.NONE) public Int remotePort() throws QueryException { return Int.get(request().getRemotePort()); } /** * Returns the names of all query parameters. * @return parameter names * @throws QueryException query exception */ @Deterministic @Requires(Permission.NONE) public Value parameterNames() throws QueryException { final TokenList tl = new TokenList(); for(final String s : request().getParameterMap().keySet()) tl.add(s); return StrSeq.get(tl); } /** * Returns the value of a specific query parameter. * @param key key to be requested * @return parameter value * @throws QueryException query exception */ @Deterministic @Requires(Permission.NONE) public Value parameter(final Str key) throws QueryException { return parameter(key, null); } /** * Returns the value of a specific query parameter. * @param key key to be requested * @param def default value * @return parameter value * @throws QueryException query exception */ @Deterministic @Requires(Permission.NONE) public Value parameter(final Str key, final Value def) throws QueryException { final String[] val = request().getParameterValues(key.toJava()); if(val == null) return def; final TokenList tl = new TokenList(val.length); for(final String v : val) tl.add(v); return StrSeq.get(tl); } /** * Returns the names of all header parameters. * @return parameter names * @throws QueryException query exception */ @Deterministic @Requires(Permission.NONE) public Value headerNames() throws QueryException { final TokenList tl = new TokenList(); final Enumeration en = request().getHeaderNames(); while(en.hasMoreElements()) tl.add(en.nextElement()); return StrSeq.get(tl); } /** * Returns the value of a specific header parameter. * @param key key to be requested * @return parameter value * @throws QueryException query exception */ @Deterministic @Requires(Permission.NONE) public Str header(final Str key) throws QueryException { return header(key, null); } /** * Returns the value of a specific header parameter. * @param key key to be requested * @param def default value * @return parameter value * @throws QueryException query exception */ @Deterministic @Requires(Permission.NONE) public Str header(final Str key, final Str def) throws QueryException { final String val = request().getHeader(key.toJava()); return val == null ? def : Str.get(val); } /** * Returns all cookie names. * @return parameter names * @throws QueryException query exception */ @Deterministic @Requires(Permission.NONE) public Value cookieNames() throws QueryException { final TokenList tl = new TokenList(); for(final Cookie c : request().getCookies()) tl.add(c.getName()); return StrSeq.get(tl); } /** * Returns the value of a specific cookie. * @param key key to be requested * @return parameter value * @throws QueryException query exception */ @Deterministic @Requires(Permission.NONE) public Str cookie(final Str key) throws QueryException { return cookie(key, null); } /** * Returns the value of a specific cookie. * @param key key to be requested * @param def default value * @return parameter value * @throws QueryException query exception */ @Deterministic @Requires(Permission.NONE) public Str cookie(final Str key, final Str def) throws QueryException { final String k = key.toJava(); for(final Cookie c : request().getCookies()) { if(c.getName().equals(k)) return Str.get(c.getValue()); } return def; } /** * Returns the value of a specific attribute. * @param key key to be requested * @return attribute value * @throws QueryException query exception */ @Deterministic @Requires(Permission.NONE) public Str attribute(final Str key) throws QueryException { final Object query = request().getAttribute(key.toJava()); return query == null ? null : Str.get(query.toString()); } /** * Returns the servlet request instance. * @return request * @throws QueryException query exception */ private HttpServletRequest request() throws QueryException { if(context.http != null) return ((HTTPContext) context.http).req; throw new QueryException("Servlet context required."); } } basex-7.7.2/basex-api/src/main/java/org/exquery/ns/Response.java000066400000000000000000000003731222453003200245040ustar00rootroot00000000000000package org.exquery.ns; import org.basex.query.*; /** * This module contains functions for handling servlet responses. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Response extends QueryModule { } basex-7.7.2/basex-api/src/main/java/org/exquery/ns/Restxq.java000066400000000000000000000026641222453003200242010ustar00rootroot00000000000000package org.exquery.ns; import org.basex.http.*; import org.basex.http.restxq.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; /** * This module contains standard RESTXQ functions. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class Restxq extends QueryModule { /** * Returns an {Code application.wadl} description including all RESTXQ services. * @return wadl description * @throws QueryException query exception */ public FElem wadl() throws QueryException { return RestXqModules.get().wadl(http()); } /** * Returns the base URI of the resource function. * @return base uri * @throws QueryException query exception */ public Str baseUri() throws QueryException { final HTTPContext http = http(); return Uri.uri(http.req.getRequestURI().replaceAll(http.req.getPathInfo(), "")); } /** * Returns the base URI of the resource function. * @return base uri * @throws QueryException query exception */ public Str uri() throws QueryException { return Uri.uri(http().req.getRequestURI()); } /** * Returns the servlet request instance. * @return request * @throws QueryException query exception */ private HTTPContext http() throws QueryException { if(context.http != null) return (HTTPContext) context.http; throw new QueryException("Servlet context required."); } } basex-7.7.2/basex-api/src/main/lisp/000077500000000000000000000000001222453003200171555ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/lisp/BaseXClient.lisp000066400000000000000000000052641222453003200222160ustar00rootroot00000000000000; Lisp client for BaseX. ; Works with BaseX 6.1 ; ; Documentation: http://docs.basex.org/wiki/Clients ; ; (C) Andy Chambers, Formedix Ltd 2010, BSD License (defpackage :basex (:use :cl :usocket) (:export :session :execute :close-session :info :result)) (in-package :basex) (defconstant +null+ (code-char 0)) (defclass session () ((host :initarg :host :initform "localhost") (port :initarg :port :initform 1984) (user :initarg :user :initform "admin") (pw :initarg :pw :initform "admin") (sock :initform nil) (result :initform nil :accessor result) (info :initform nil :accessor info))) (defmethod initialize-instance :after ((self session) &key) (with-slots (host port user pw sock) self (setf sock (socket-connect host port :element-type '(unsigned-byte 8))) (unless (hand-shake self) (error "Could not initiate connection")))) (defun hand-shake (session) (declare (optimize debug)) (labels ((md5 (str) (string-downcase (with-output-to-string (s) (loop for hex across (sb-md5:md5sum-string str) do (format s "~2,'0x" hex))))) (auth-token (pw timestamp) (md5 (format nil "~a~a" (md5 pw) timestamp)))) (with-slots (user pw sock) session (let* ((ts (read-null-terminated (socket-stream sock))) (auth (auth-token pw ts))) (write-null-terminated user (socket-stream sock)) (write-null-terminated auth (socket-stream sock)) (force-output (socket-stream sock)) (eq 0 (read-byte (socket-stream sock))))))) (defun read-null-terminated (in) (with-output-to-string (s) (loop for char = (code-char (read-byte in)) until (char= char +null+) do (write-char char s)))) (defun write-null-terminated (string out) (loop for char across string do (write-byte (char-code char) out)) (write-byte (char-code +null+) out)) (defmethod execute ((self session) query) (with-slots (sock) self (let ((stream (socket-stream sock))) (write-null-terminated query stream) (force-output stream) (setf (result self) (read-null-terminated stream) (info self) (read-null-terminated stream)) (eq 0 (read-byte (socket-stream sock)))))) (defmethod open-session ((self session)) (unwind-protect (unless (hand-shake self) (error "Could not open session")) (close-session self))) (defmethod close-session ((self session)) (with-slots (sock) self (write-null-terminated "exit" (socket-stream sock)) (socket-close sock))) basex-7.7.2/basex-api/src/main/lisp/Example.lisp000066400000000000000000000006661222453003200214510ustar00rootroot00000000000000; This example shows how database commands can be executed. ; ; Documentation: http://docs.basex.org/wiki/Clients ; ; (C) Andy Chambers, Formedix Ltd 2010, BSD License (defpackage :basex-user (:use :cl :basex)) (in-package :basex-user) (time (let ((session (make-instance 'session))) (if (execute session "xquery 1 to 10") (print (result session)) (print (info session))) (close-session session))) basex-7.7.2/basex-api/src/main/perl/000077500000000000000000000000001222453003200171505ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/perl/AddExample.pl000066400000000000000000000015621222453003200215150ustar00rootroot00000000000000# This example shows how new documents can be added. # # Documentation: http://docs.basex.org/wiki/Clients # # (C) BaseX Team 2005-12, BSD License use BaseXClient; use warnings; use strict; eval { # create session my $session = Session->new("localhost", 1984, "admin", "admin"); # create empty database $session->execute("create db database"); print $session->info()."\n"; # add document $session->add("world/World.xml", "Hello World!"); print $session->info()."\n"; # add document $session->add("Universe.xml", "Hello Universe!"); print $session->info()."\n"; # run query on database print $session->execute("xquery collection('database')")."\n"; # drop database $session->execute("drop db database"); # close session $session->close(); }; # print exception print $@ if $@; basex-7.7.2/basex-api/src/main/perl/BaseXClient.pm000066400000000000000000000073631222453003200216600ustar00rootroot00000000000000# Perl client for BaseX. # Works with BaseX 7.0 and later # # Documentation: http://docs.basex.org/wiki/Clients # # (C) BaseX Team 2005-12, BSD License use Digest::MD5; use IO::Socket; use warnings; use strict; package Session; sub new { my $class = shift; my $host = shift; my $port = shift; my $user = shift; my $pw = shift; my $self = bless({}, $class); # create server connection $self->{sock} = IO::Socket::INET->new( PeerAddr => $host, PeerPort => $port, Proto => "tcp") or die "Can't communicate with the server."; # receive timestamp my $ts = $self->_receive(); # send username and hashed password/timestamp my $pwmd5 = Digest::MD5->new()->add($pw)->hexdigest(); my $complete = Digest::MD5->new()->add($pwmd5.$ts)->hexdigest(); $self->send($user.chr(0).$complete); # evaluate success flag return $self if !$self->_read() or die "Access denied."; } sub execute { my $self = shift; my $cmd = shift; # send command to server and receive result $self->send($cmd); $self->{result} = $self->_receive(); $self->{info} = $self->_receive(); die $self->{info} if !$self->ok(); return $self->{result}; } sub query { return Query->new(shift, shift); } sub create { shift->sendInput(8, shift, shift); } sub add { shift->sendInput(9, shift, shift); } sub replace { shift->sendInput(12, shift, shift); } sub store { shift->sendInput(13, shift, shift); } sub info { return shift->{info}; } sub close { my $self = shift; $self->send("exit"); close($self->{sock}); } # Receives a string from the socket. sub _receive { my $self = shift; my $data = ""; while($self->_read()) { $self->_read() if ord($_) == 255; $data .= $_; } return $data; } # Returns a single byte from the socket. sub _read { shift->{sock}->recv($_, 1); return ord(); } # Returns success check. sub ok { return !shift->_read(); } # Sends the specified string. sub send { shift->{sock}->send((shift).chr(0)); } # Sends the specified input. sub sendInput { my $self = shift; my $code = shift; my $str = shift; my $input = shift; $self->send(chr($code).$str); foreach my $b(unpack("C*", $input)) { if($b == 0xFF || $b == 0x00) { $self->{sock}->send(0xFF); } $self->{sock}->send(chr($b)); } $self->{sock}->send(chr(0)); $self->{info} = $self->_receive(); die $self->{info} if !$self->ok(); } 1; package Query; our $session; our @cache; our $pos; our $id; sub new { my $class = shift; $session = shift; my $cmd = shift; my $self = bless({}, $class); $id = exc(chr(0), $cmd); return $self; } sub bind { shift; my $name = shift; my $value = shift; my $type = shift; $type = "" if !$type; exc(chr(3), $id.chr(0).$name.chr(0).$value.chr(0).$type); undef @cache; } sub context { shift; my $value = shift; my $type = shift; $type = "" if !$type; exc(chr(14), $id.chr(0).$value.chr(0).$type); undef @cache; } sub execute { return exc(chr(5), $id); } sub more { if(!@cache) { $session->send(chr(4).$id.chr(0)); push(@cache, $session->_receive()) while $session->_read(); die $session->_receive() if !$session->ok(); $pos = 0; } my $more = $pos < @cache; undef @cache if !$more; return $more; } sub next { return more() && $cache[$pos++]; } sub info { return exc(chr(6), $id); } sub options { return exc(chr(7), $id); } sub close { exc(chr(2), $id); } sub exc { my $cmd = shift; my $arg = shift; $session->send($cmd.$arg); my $s = $session->_receive(); die $session->_receive() if !$session->ok(); return $s; } 1; basex-7.7.2/basex-api/src/main/perl/CreateExample.pl000066400000000000000000000012231222453003200222220ustar00rootroot00000000000000# This example shows how new databases can be created. # # Documentation: http://docs.basex.org/wiki/Clients # # (C) BaseX Team 2005-12, BSD License use BaseXClient; use warnings; use strict; eval { # create session my $session = Session->new("localhost", 1984, "admin", "admin"); # create new database $session->create("database", "Hello World!"); print $session->info()."\n"; # run query on database print $session->execute("xquery doc('database')")."\n"; # drop database $session->execute("drop db database"); # close session $session->close(); }; # print exception print $@ if $@; basex-7.7.2/basex-api/src/main/perl/Example.pl000066400000000000000000000012521222453003200211000ustar00rootroot00000000000000# This example shows how database commands can be executed. # # Documentation: http://docs.basex.org/wiki/Clients # # (C) BaseX Team 2005-12, BSD License use BaseXClient; use Time::HiRes; use warnings; use strict; eval { # initialize timer my $start = [ Time::HiRes::gettimeofday( ) ]; # create session my $session = Session->new("localhost", 1984, "admin", "admin"); # perform command and print returned string print $session->execute("xquery 1 to 10"); # close session $session->close(); # print time needed my $time = Time::HiRes::tv_interval($start) * 1000; print "\n$time ms.\n"; }; # print exception print $@ if $@; basex-7.7.2/basex-api/src/main/perl/QueryBindExample.pl000066400000000000000000000013741222453003200227300ustar00rootroot00000000000000# This example shows how external variables can be bound to XQuery expressions. # # Documentation: http://docs.basex.org/wiki/Clients # # (C) BaseX Team 2005-12, BSD License use BaseXClient; use Time::HiRes; use warnings; use strict; eval { # create session my $session = Session->new("localhost", 1984, "admin", "admin"); # create query instance my $input = "declare variable \$name external; ". "for \$i in 1 to 10 return element { \$name } { \$i }"; my $query = $session->query($input); # bind variable $query->bind("name", "number", ""); # print result print $query->execute()."\n"; # close query $query->close(); # close session $session->close(); }; # print exception print $@ if $@; basex-7.7.2/basex-api/src/main/perl/QueryExample.pl000066400000000000000000000012641222453003200221310ustar00rootroot00000000000000# This example shows how queries can be executed in an iterative manner. # # Documentation: http://docs.basex.org/wiki/Clients # # (C) BaseX Team 2005-12, BSD License use BaseXClient; use Time::HiRes; use warnings; use strict; eval { # create session my $session = Session->new("localhost", 1984, "admin", "admin"); # create query instance my $input = "for \$i in 1 to 10 return Text { \$i }"; my $query = $session->query($input); # loop through all results while ($query->more()) { print $query->next()."\n"; } # close query $query->close(); # close session $session->close(); }; # print exception print $@ if $@;basex-7.7.2/basex-api/src/main/php/000077500000000000000000000000001222453003200167755ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/php/AddExample.php000066400000000000000000000016151222453003200215150ustar00rootroot00000000000000execute("create db database"); print $session->info(); // add document $session->add("world/World.xml", "Hello World!"); print "
".$session->info(); // add document $session->add("Universe.xml", "Hello Universe!"); print "
".$session->info(); // run query on database print "
".$session->execute("xquery /"); // drop database $session->execute("drop db database"); // close session $session->close(); } catch (Exception $e) { // print exception print $e->getMessage(); } ?> basex-7.7.2/basex-api/src/main/php/BaseXClient.php000066400000000000000000000103501222453003200216460ustar00rootroot00000000000000socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); if(!socket_connect($this->socket, $h, $p)) { throw new Exception("Can't communicate with server."); } // receive timestamp $ts = $this->readString(); // send username and hashed password/timestamp $md5 = hash("md5", hash("md5", $pw).$ts); socket_write($this->socket, $user.chr(0).$md5.chr(0)); // receives success flag if(socket_read($this->socket, 1) != chr(0)) { throw new Exception("Access denied."); } } public function execute($com) { // send command to server socket_write($this->socket, $com.chr(0)); // receive result $result = $this->receive(); $this->info = $this->readString(); if($this->ok() != True) { throw new Exception($this->info); } return $result; } public function query($q) { return new Query($this, $q); } public function create($name, $input) { $this->sendCmd(8, $name, $input); } public function add($path, $input) { $this->sendCmd(9, $path, $input); } public function replace($path, $input) { $this->sendCmd(12, $path, $input); } public function store($path, $input) { $this->sendCmd(13, $path, $input); } public function info() { return $this->info; } public function close() { socket_write($this->socket, "exit".chr(0)); socket_close($this->socket); } private function init() { $this->bpos = 0; $this->bsize = 0; } public function readString() { $com = ""; while(($d = $this->read()) != chr(0)) { $com .= $d; } return $com; } private function read() { if($this->bpos == $this->bsize) { $this->bsize = socket_recv($this->socket, $this->buffer, 4096, 0); $this->bpos = 0; } return $this->buffer[$this->bpos++]; } private function sendCmd($code, $arg, $input) { socket_write($this->socket, chr($code).$arg.chr(0).$input.chr(0)); $this->info = $this->receive(); if($this->ok() != True) { throw new Exception($this->info); } } public function send($str) { socket_write($this->socket, $str.chr(0)); } public function ok() { return $this->read() == chr(0); } public function receive() { $this->init(); return $this->readString(); } } class Query { var $session, $id, $open, $cache; public function __construct($s, $q) { $this->session = $s; $this->id = $this->exec(chr(0), $q); } public function bind($name, $value, $type = "") { $this->exec(chr(3), $this->id.chr(0).$name.chr(0).$value.chr(0).$type); } public function context($value, $type = "") { $this->exec(chr(14), $this->id.chr(0).$value.chr(0).$type); } public function execute() { return $this->exec(chr(5), $this->id); } public function more() { if($this->cache == NULL) { $this->pos = 0; $this->session->send(chr(4).$this->id.chr(0)); while(!$this->session->ok()) { $this->cache[] = $this->session->readString(); } if(!$this->session->ok()) { throw new Exception($this->session->readString()); } } if($this->pos < count($this->cache)) return true; $this->cache = NULL; return false; } public function next() { if($this->more()) { return $this->cache[$this->pos++]; } } public function info() { return $this->exec(chr(6), $this->id); } public function options() { return $this->exec(chr(7), $this->id); } public function close() { $this->exec(chr(2), $this->id); } public function exec($cmd, $arg) { $this->session->send($cmd.$arg); $s = $this->session->receive(); if($this->session->ok() != True) { throw new Exception($this->session->readString()); } return $s; } } ?> basex-7.7.2/basex-api/src/main/php/CreateExample.php000066400000000000000000000012571222453003200222320ustar00rootroot00000000000000create("database", "Hello World!"); print $session->info(); // run query on database print "
".$session->execute("xquery /"); // drop database $session->execute("drop db database"); // close session $session->close(); } catch (Exception $e) { // print exception print $e->getMessage(); } ?> basex-7.7.2/basex-api/src/main/php/DOMExample.php000066400000000000000000000027261222453003200214500ustar00rootroot00000000000000execute("create db database Username1Password1 Username2Password2"); // perform command and print returned string $dom->loadXML($session->execute("xquery .")); // print nodes info getNodesInfo($dom->firstChild); // close session $session->close(); // print time needed $time = (microtime(true) - $start) * 1000; print "
$time ms\n"; } catch (Exception $e) { // print exception print $e->getMessage(); } // print info of node and subnodes function getNodesInfo($node) { if ($node->hasChildNodes()) { $subNodes = $node->childNodes; foreach ($subNodes as $subNode) { if (($subNode->nodeType != 3)&&($subNode->nodeType != 8)) { print "Node name: ".trim($subNode->nodeName)."
"; print "Node value: ".trim($subNode->nodeValue)."
"; } getNodesInfo($subNode); } } } ?> basex-7.7.2/basex-api/src/main/php/Example.php000066400000000000000000000012501222453003200210770ustar00rootroot00000000000000execute("xquery 1 to 10"); // close session $session->close(); // print time needed $time = (microtime(true) - $start) * 1000; print "\n$time ms\n"; } catch (Exception $e) { // print exception print $e->getMessage(); } ?> basex-7.7.2/basex-api/src/main/php/QueryBindExample.php000066400000000000000000000015761222453003200227350ustar00rootroot00000000000000query($input); // bind variable $query->bind("name", "number"); // print results print $query->execute()."\n"; // close query instance $query->close(); } catch (Exception $e) { // print exception print $e->getMessage(); } // close session $session->close(); } catch (Exception $e) { // print exception print $e->getMessage(); } ?> basex-7.7.2/basex-api/src/main/php/QueryExample.php000066400000000000000000000016251222453003200221330ustar00rootroot00000000000000Text { $i }'; $query = $session->query($input); // loop through all results while($query->more()) { print $query->next()."\n"; } // close query instance $query->close(); } catch (Exception $e) { // print exception print $e->getMessage(); } // close session $session->close(); } catch (Exception $e) { // print exception print $e->getMessage(); } ?> basex-7.7.2/basex-api/src/main/php/TableExample.php000066400000000000000000000040001222453003200220430ustar00rootroot00000000000000"; echo ""; echo "Country"; echo "Population"; try { $query = $session->query($cmd); $query2 = $session->query($cmd2); $count = 0; while($query->more()) { $next = $query->next(); $query2->more(); $next2 = $query2->next(); $count += 1; if($count%2) { echo " $count$next $next2"; } else { echo " $count$next $next2"; } } $query->close(); $query2->close(); } catch (Exception $e) { // print exception print $e->getMessage(); } echo ""; $query->close(); // close session $session->close(); } catch (Exception $e) { // print exception print $e->getMessage(); } ?> basex-7.7.2/basex-api/src/main/python/000077500000000000000000000000001222453003200175275ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/python/AddExample.py000066400000000000000000000014751222453003200221140ustar00rootroot00000000000000# This example shows how new documents can be added. # # Documentation: http://docs.basex.org/wiki/Clients # # (C) BaseX Team 2005-12, BSD License import BaseXClient try: # create session session = BaseXClient.Session('localhost', 1984, 'admin', 'admin') # create empty database session.execute("create db database") print session.info() # add document session.add("world/World.xml", "Hello World!") print session.info() # add document session.add("Universe.xml", "Hello Universe!") print session.info() # run query on database print "\n" + session.execute("xquery collection('database')") # drop database session.execute("drop db database") # close session session.close() except IOError as e: # print exception print e basex-7.7.2/basex-api/src/main/python/BaseXClient.py000066400000000000000000000164241222453003200222510ustar00rootroot00000000000000""" Python client for BaseX. Works with BaseX 7.0 and later Documentation: http://docs.basex.org/wiki/Clients (C) BaseX Team 2005-12, Arjen van Elteren BSD License """ import hashlib, socket, array import threading class SocketInputReader(object): def __init__(self, sock): self.__s = sock self.__buf = array.array('B', chr(0) * 0x1000) self.init() def init(self): self.__bpos = 0 self.__bsize = 0 # Returns a single byte from the socket. def read(self): # Cache next bytes if self.__bpos >= self.__bsize: self.__bsize = self.__s.recv_into(self.__buf) self.__bpos = 0 b = self.__buf[self.__bpos] self.__bpos += 1 return b # Reads until byte is found. def read_until(self, byte): # Cache next bytes if self.__bpos >= self.__bsize: self.__bsize = self.__s.recv_into(self.__buf) self.__bpos = 0 found = False substr = "" try: pos = self.__buf[self.__bpos:self.__bsize].index(byte) found = True substr = self.__buf[self.__bpos:pos+self.__bpos].tostring() self.__bpos = self.__bpos + pos + 1 except ValueError: substr = self.__buf[self.__bpos:self.__bsize].tostring() self.__bpos = self.__bsize return (found, substr) def readString(self): strings = [] found = False while not found: found, substr = self.read_until(0) strings.append(substr) return ''.join(strings) class Session(object): def __init__(self, host, port, user, pw): self.__info = None # create server connection self.__s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.__s.connect((host, port)) self.__sreader = SocketInputReader(self.__s) self.__event_socket = None self.__event_host = host self.__event_listening_thread = None self.__event_callbacks = {} # receive timestamp ts = self.readString() # send username and hashed password/timestamp m = hashlib.md5() m.update(hashlib.md5(pw).hexdigest()) m.update(ts) self.send(user + chr(0) + m.hexdigest()) # evaluate success flag if self.__s.recv(1) != chr(0): raise IOError('Access Denied.') def execute(self, com): # send command to server self.send(com) # receive result result = self.receive() self.__info = self.readString() if not self.ok(): raise IOError(self.__info) return result def query(self, q): return Query(self, q) def create(self, name, content): self.sendInput(8, name, content) def add(self, path, content): self.sendInput(9, path, content) def replace(self, path, content): self.sendInput(12, path, content) def store(self, path, content): self.sendInput(13, path, content) def info(self): return self.__info def close(self): self.send('exit') self.__s.close() if not self.__event_socket is None: self.__event_socket.close() def init(self): """Initialize byte transfer""" self.__sreader.init() def register_and_start_listener(self): self.__s.sendall(chr(10)) event_port = int(self.readString()) self.__event_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.__event_socket.settimeout(5000) self.__event_socket.connect((self.__event_host, event_port)) token = self.readString() self.__event_socket.sendall(token + chr(0)) if not self.__event_socket.recv(1) == chr(0): raise IOError("Could not register event listener") self.__event_listening_thread = threading.Thread( target=self.event_listening_loop ) self.__event_listening_thread.daemon = True self.__event_listening_thread.start() def event_listening_loop(self): reader = SocketInputReader(self.__event_socket) reader.init() while True: name = reader.readString() data = reader.readString() self.__event_callbacks[name](data) def is_listening(self): return not self.__event_socket is None def watch(self, name, callback): if not self.is_listening(): self.register_and_start_listener() else: self.__s.sendall(chr(10)) self.send(name) info = self.readString() if not self.ok(): raise IOError(info) self.__event_callbacks[name] = callback def unwatch(self, name): self.send(chr(11) + name) info = self.readString() if not self.ok(): raise IOError(info) del self.__event_callbacks[name] def readString(self): """Retrieve a string from the socket""" return self.__sreader.readString() def read(self): """Return a single byte from socket""" return self.__sreader.read() def read_until(self, byte): """Read until byte is found""" return self.__sreader.read_until(byte) def send(self, value): """Send the defined string""" self.__s.sendall(value + chr(0)) def sendInput(self, code, arg, content): self.__s.sendall(chr(code) + arg + chr(0) + content + chr(0)) self.__info = self.readString() if not self.ok(): raise IOError(self.info()) def ok(self): """Return success check""" return self.read() == 0 def receive(self): """Return received string""" self.init() return self.readString() def iter_receive(self): self.init() typecode = self.read() while typecode > 0: string = self.readString() yield string typecode = self.read() if not self.ok(): raise IOError(self.readString()) class Query(): def __init__(self, session, q): self.__session = session self.__id = self.exc(chr(0), q) def bind(self, name, value, datatype=''): self.exc(chr(3), self.__id + chr(0) + name + chr(0) + value + chr(0) + datatype) def context(self, value, datatype=''): self.exc(chr(14), self.__id + chr(0) + value + chr(0) + datatype) def iter(self): self.__session.send(chr(4) + self.__id) return self.__session.iter_receive() def execute(self): return self.exc(chr(5), self.__id) def info(self): return self.exc(chr(6), self.__id) def options(self): return self.exc(chr(7), self.__id) def close(self): self.exc(chr(2), self.__id) def exc(self, cmd, arg): self.__session.send(cmd + arg) s = self.__session.receive() if not self.__session.ok(): raise IOError(self.__session.readString()) return s basex-7.7.2/basex-api/src/main/python/CreateExample.py000066400000000000000000000011631222453003200226210ustar00rootroot00000000000000# This example shows how new databases can be created. # # Documentation: http://docs.basex.org/wiki/Clients # # (C) BaseX Team 2005-12, BSD License import BaseXClient try: # create session session = BaseXClient.Session('localhost', 1984, 'admin', 'admin') # create new database session.create("database", "Hello World!") print session.info() # run query on database print "\n" + session.execute("xquery doc('database')") # drop database session.execute("drop db database") # close session session.close() except IOError as e: # print exception print e basex-7.7.2/basex-api/src/main/python/Example.py000066400000000000000000000011371222453003200214760ustar00rootroot00000000000000# This example shows how database commands can be executed. # # Documentation: http://docs.basex.org/wiki/Clients # # (C) BaseX Team 2005-12, BSD License import BaseXClient, time try: # initialize timer start = time.clock() # create session session = BaseXClient.Session('localhost', 1984, 'admin', 'admin') # perform command and print returned string print session.execute("xquery 1 to 10") # close session session.close() # print time needed time = (time.clock() - start) * 1000 print time, "ms." except IOError as e: # print exception print e basex-7.7.2/basex-api/src/main/python/QueryBindExample.py000066400000000000000000000014401222453003200233160ustar00rootroot00000000000000# This example shows how external variables can be bound to XQuery expressions. # # Documentation: http://docs.basex.org/wiki/Clients # # (C) BaseX Team 2005-12, BSD License import BaseXClient, time try: # create session session = BaseXClient.Session('localhost', 1984, 'admin', 'admin') try: # create query instance input = "declare variable $name external; for $i in 1 to 10 return element { $name } { $i }" query = session.query(input) # bind variable query.bind("$name", "number") # print result print query.execute() # close query object query.close() except IOError as e: # print exception print e # close session session.close() except IOError as e: # print exception print e basex-7.7.2/basex-api/src/main/python/QueryExample.py000066400000000000000000000014571222453003200225310ustar00rootroot00000000000000# This example shows how queries can be executed in an iterative manner. # Iterative evaluation will be slower, as more server requests are performed. # # Documentation: http://docs.basex.org/wiki/Clients # # (C) BaseX Team 2005-12, BSD License import BaseXClient, time try: # create session session = BaseXClient.Session('localhost', 1984, 'admin', 'admin') try: # create query instance input = "for $i in 1 to 10 return Text { $i }" query = session.query(input) # loop through all results while query.more(): print query.next() # close query object query.close() except IOError as e: # print exception print e # close session session.close() except IOError as e: # print exception print e basex-7.7.2/basex-api/src/main/python3/000077500000000000000000000000001222453003200176125ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/python3/AddExample.py000066400000000000000000000014561222453003200221760ustar00rootroot00000000000000# -*- coding: utf-8 -*- # This example shows how new documents can be added. # # Documentation: http://docs.basex.org/wiki/Clients # # (C) BaseX Team 2005-12, BSD License import BaseXClient # create session session = BaseXClient.Session('localhost', 1984, 'admin', 'admin') try: # create empty database session.execute("create db database") print(session.info()) # add document session.add("world/World.xml", "Hello World!") print(session.info()) # add document session.add("Universe.xml", "Hello Universe!") print(session.info()) # run query on database print("\n" + session.execute("xquery collection('database')")) # drop database session.execute("drop db database") finally: # close session if session: session.close() basex-7.7.2/basex-api/src/main/python3/BaseXClient.py000066400000000000000000000313371222453003200223340ustar00rootroot00000000000000# -*- coding: utf-8 -*- """ Python 2.7.3 and 3.x client for BaseX. Works with BaseX 7.0 and later Requires Python 3.x or Python 2.x having some backports like bytearray. (I've tested Python 3.2.3, and Python 2.7.3 on Fedora 16 linux x86_64.) LIMITATIONS: * binary content would corrupt, maybe. (I didn't test it) * also, will fail to extract stored binary content, maybe. (both my code, and original don't care escaped 0xff.) Documentation: http://docs.basex.org/wiki/Clients (C) 2012, Hiroaki Itoh. BSD License """ import hashlib, socket import threading # --------------------------------- # class SocketWrapper(object): """a wrapper to python native socket module.""" def __init__(self, sock, receive_bytes_encoding='utf-8', send_bytes_encoding='utf-8'): self.receive_bytes_encoding = receive_bytes_encoding self.send_bytes_encoding = send_bytes_encoding self.terminator = bytearray(chr(0), self.receive_bytes_encoding) self.__s = sock self.__buf = bytearray(chr(0) * 0x1000, self.receive_bytes_encoding) self.__bpos = 0 self.__bsize = 0 def clear_buffer(self): """reset buffer status for next invocation ``recv_until_terminator()`` or ``recv_single_byte()``.""" self.__bpos = 0 self.__bsize = 0 def __fill_buffer(self): """cache next bytes""" if self.__bpos >= self.__bsize: self.__bsize = self.__s.recv_into(self.__buf) self.__bpos = 0 # Returns a single byte from the socket. def recv_single_byte(self): """recv a single byte from previously fetched buffer.""" self.__fill_buffer() result_byte = self.__buf[self.__bpos] self.__bpos += 1 return result_byte # Reads until terminator byte is found. def recv_until_terminator(self): """recv a nul(or specified as terminator_byte)-terminated whole string from previously fetched buffer.""" result_bytes = bytearray() while True: self.__fill_buffer() pos = self.__buf.find(self.terminator, self.__bpos, self.__bsize) if pos >= 0: result_bytes.extend(self.__buf[self.__bpos:pos]) self.__bpos = pos + 1 break else: result_bytes.extend(self.__buf[self.__bpos:self.__bsize]) self.__bpos = self.__bsize return result_bytes.decode(self.receive_bytes_encoding) def sendall(self, data): """sendall with specified byte encoding if data is not bytearray, bytes (maybe str). if data is bytearray or bytes, it will be passed to native sendall API directly.""" if isinstance(data, (bytearray, bytes)): return self.__s.sendall(data) return self.__s.sendall(bytearray(data, self.send_bytes_encoding)) def __getattr__(self, name): return lambda *arg, **kw: getattr(self.__s, name)(*arg, **kw) # --------------------------------- # class Session(object): """class Session. see http://docs.basex.org/wiki/Server_Protocol """ def __init__(self, host, port, user, password, receive_bytes_encoding='utf-8', send_bytes_encoding='utf-8'): """Create and return session with host, port, user name and password""" self.__info = None # create server connection self.__swrapper = SocketWrapper( socket.socket(socket.AF_INET, socket.SOCK_STREAM), receive_bytes_encoding=receive_bytes_encoding, send_bytes_encoding=send_bytes_encoding) self.__swrapper.connect((host, port)) self.__event_socket_wrapper = None self.__event_host = host self.__event_listening_thread = None self.__event_callbacks = {} # receive timestamp timestamp = self.recv_c_str() # send username and hashed password/timestamp hfun = hashlib.md5() #FIXME: should we allow to customize password encoding? hfun.update(hashlib.md5(password.encode('us-ascii')).hexdigest().encode('us-ascii')) hfun.update(timestamp.encode('us-ascii')) self.send(user + chr(0) + hfun.hexdigest()) # evaluate success flag if not self.server_response_success(): raise IOError('Access Denied.') def execute(self, com): """Execute a command and return the result""" # send command to server self.send(com) # receive result result = self.receive() self.__info = self.recv_c_str() if not self.server_response_success(): raise IOError(self.__info) return result def query(self, querytxt): """Creates a new query instance (having id returned from server).""" return Query(self, querytxt) def create(self, name, content): """Creates a new database with the specified input (may be empty).""" self.__send_input(8, name, content) def add(self, path, content): """Adds a new resource to the opened database.""" self.__send_input(9, path, content) def replace(self, path, content): """Replaces a resource with the specified input.""" self.__send_input(12, path, content) def store(self, path, content): """Stores a binary resource in the opened database. api won't escape 0x00, 0xff automatically, so you must do it yourself explicitly.""" # ------------------------------------------ # chr(13) + path + chr(0) + content + chr(0) self.__send_binary_input(13, path, content) # # ------------------------------------------ def info(self): """Return process information""" return self.__info def close(self): """Close the session""" self.send('exit') self.__swrapper.close() if not self.__event_socket_wrapper is None: self.__event_socket_wrapper.close() def __register_and_start_listener(self, receive_bytes_encoding=None, send_bytes_encoding=None): """register and start listener.""" if receive_bytes_encoding: receive_bytes_encoding_ = receive_bytes_encoding else: receive_bytes_encoding_ = self.__swrapper.receive_bytes_encoding if send_bytes_encoding: send_bytes_encoding_ = send_bytes_encoding else: send_bytes_encoding_ = self.__swrapper.send_bytes_encoding self.__swrapper.sendall(chr(10)) event_port = int(self.recv_c_str()) self.__event_socket_wrapper = SocketWrapper( socket.socket(socket.AF_INET, socket.SOCK_STREAM), receive_bytes_encoding=receive_bytes_encoding_, send_bytes_encoding=send_bytes_encoding_) self.__event_socket_wrapper.settimeout(5000) self.__event_socket_wrapper.connect((self.__event_host, event_port)) token = self.recv_c_str() self.__event_socket_wrapper.sendall(token + chr(0)) #if self.__event_socket_wrapper.recv_single_byte() != chr(0): # raise IOError("Could not register event listener") #java example client does skip next byte... ign = self.__event_socket_wrapper.recv_single_byte() self.__event_listening_thread = threading.Thread( target=self.__event_listening_loop ) self.__event_listening_thread.daemon = True self.__event_listening_thread.start() def __event_listening_loop(self): """event listening loop (in subthread)""" reader = self.__event_socket_wrapper reader.clear_buffer() while True: name = reader.recv_until_terminator() data = reader.recv_until_terminator() self.__event_callbacks[name](data) def is_listening(self): """true if registered and started listener, false otherwise""" return not self.__event_socket_wrapper is None def watch(self, name, callback): """Watch the specified event""" if not self.is_listening(): self.__register_and_start_listener() else: self.__swrapper.sendall(chr(10)) self.send(name) info = self.recv_c_str() if not self.server_response_success(): raise IOError(info) self.__event_callbacks[name] = callback def unwatch(self, name): """Unwatch the specified event""" self.send(chr(11) + name) info = self.recv_c_str() if not self.server_response_success(): raise IOError(info) del self.__event_callbacks[name] def recv_c_str(self): """Retrieve a string from the socket""" return self.__swrapper.recv_until_terminator() def send(self, value): """Send the defined string""" self.__swrapper.sendall(value + chr(0)) def __send_input(self, code, arg, content): """internal. don't care.""" self.__swrapper.sendall(chr(code) + arg + chr(0) + content + chr(0)) self.__info = self.recv_c_str() if not self.server_response_success(): raise IOError(self.info()) def __send_binary_input(self, code, path, content): """internal. don't care.""" #at this time, we can't use __send_input itself because of encoding #problem. we have to build bytearray directly. if not isinstance(content, (bytearray, bytes)): raise ValueError("Sorry, content must be bytearray or bytes, not " + str(type(content))) # ------------------------------------------ # chr(code) + path + chr(0) + content + chr(0) data = bytearray([code]) try: data.extend(path) except: data.extend(path.encode('utf-8')) data.extend([0]) data.extend(content) data.extend([0]) # # ------------------------------------------ self.__swrapper.sendall(data) self.__info = self.recv_c_str() if not self.server_response_success(): raise IOError(self.info()) def server_response_success(self): """Return success check""" return self.__swrapper.recv_single_byte() == 0 def receive(self): """Return received string""" self.__swrapper.clear_buffer() return self.recv_c_str() def iter_receive(self): """iter_receive() -> (typecode, item) iterate while the query returns items. typecode list is in http://docs.basex.org/wiki/Server_Protocol:_Types """ self.__swrapper.clear_buffer() typecode = self.__swrapper.recv_single_byte() while typecode > 0: string = self.recv_c_str() yield (typecode, string) typecode = self.__swrapper.recv_single_byte() if not self.server_response_success(): raise IOError(self.recv_c_str()) # --------------------------------- # class Query(): """class Query. see http://docs.basex.org/wiki/Server_Protocol """ def __init__(self, session, querytxt): """Create query object with session and query""" self.__session = session self.__id = self.__exc(chr(0), querytxt) def bind(self, name, value, datatype=''): """Binds a value to a variable. An empty string can be specified as data type.""" self.__exc(chr(3), self.__id + chr(0) + name + chr(0) + value + chr(0) + datatype) def context(self, value, datatype=''): """Bind the context item""" self.__exc(chr(14), self.__id + chr(0) + value + chr(0) + datatype) def iter(self): """iterate while the query returns items""" self.__session.send(chr(4) + self.__id) return self.__session.iter_receive() def execute(self): """Execute the query and return the result""" return self.__exc(chr(5), self.__id) def info(self): """Return query information""" return self.__exc(chr(6), self.__id) def options(self): """Return serialization parameters""" return self.__exc(chr(7), self.__id) def updating(self): """Returns true if the query may perform updates; false otherwise.""" return self.__exc(chr(30), self.__id) def full(self): """Returns all resulting items as strings, prefixed by XDM Meta Data.""" return self.__exc(chr(31), self.__id) def close(self): """Close the query""" self.__exc(chr(2), self.__id) def __exc(self, cmd, arg): """internal. don't care.""" #should we expose this? #(this makes sense only when mismatch between C/S is existing.) self.__session.send(cmd + arg) result = self.__session.receive() if not self.__session.server_response_success(): raise IOError(self.__session.recv_c_str()) return result basex-7.7.2/basex-api/src/main/python3/CreateExample.py000066400000000000000000000011741222453003200227060ustar00rootroot00000000000000# -*- coding: utf-8 -*- # This example shows how new databases can be created. # # Documentation: http://docs.basex.org/wiki/Clients # # (C) BaseX Team 2005-12, BSD License import BaseXClient # create session session = BaseXClient.Session('localhost', 1984, 'admin', 'admin') try: # create new database session.create("database", "Hello World!") print(session.info()) # run query on database print("\n" + session.execute("xquery doc('database')")) # drop database session.execute("drop db database") print(session.info()) finally: # close session if session: session.close() basex-7.7.2/basex-api/src/main/python3/Example.py000066400000000000000000000010231222453003200215530ustar00rootroot00000000000000# -*- coding: utf-8 -*- # This example shows how database commands can be executed. # # Documentation: http://docs.basex.org/wiki/Clients # # (C) BaseX Team 2005-12, BSD License import BaseXClient, time # initialize timer start = time.clock() # create session session = BaseXClient.Session('localhost', 1984, 'admin', 'admin') # perform command and print returned string print(session.execute("xquery 1 to 10")) # close session session.close() # print time needed time = (time.clock() - start) * 1000 print("%.2f ms" % time) basex-7.7.2/basex-api/src/main/python3/QueryBindExample.py000066400000000000000000000012531222453003200234030ustar00rootroot00000000000000# -*- coding: utf-8 -*- # This example shows how external variables can be bound to XQuery expressions. # # Documentation: http://docs.basex.org/wiki/Clients # # (C) BaseX Team 2005-12, BSD License import BaseXClient # create session session = BaseXClient.Session('localhost', 1984, 'admin', 'admin') try: # create query instance input = "declare variable $name external; for $i in 1 to 10 return element { $name } { $i }" query = session.query(input) # bind variable query.bind("$name", "number") # print result print(query.execute()) # close query object query.close() finally: # close session if session: session.close() basex-7.7.2/basex-api/src/main/python3/QueryExample.py000066400000000000000000000013751222453003200226130ustar00rootroot00000000000000# -*- coding: utf-8 -*- # This example shows how queries can be executed in an iterative manner. # Iterative evaluation will be slower, as more server requests are performed. # # Documentation: http://docs.basex.org/wiki/Clients # # (C) BaseX Team 2005-12, BSD License import BaseXClient # create session session = BaseXClient.Session('localhost', 1984, 'admin', 'admin') try: # create query instance input = "for $i in 1 to 10 return Text { $i }" query = session.query(input) # loop through all results for typecode, item in query.iter(): print("typecode=%d" % typecode) print("item=%s" % item) # close query object query.close() finally: # close session if session: session.close() basex-7.7.2/basex-api/src/main/python3/UTF16Example.py000066400000000000000000000025651222453003200223150ustar00rootroot00000000000000# -*- coding: utf-8 -*- # Documentation: http://docs.basex.org/wiki/Clients # # (C) BaseX Team 2005-12, BSD License import BaseXClient import sys if sys.version < '3': # i'm testing with Python 2.7.3 import codecs sys.stdout = codecs.getwriter('utf-8')(sys.stdout) import xml.dom.minidom # input encoding is utf-16le doc = xml.dom.minidom.parse("UTF16example.xml") # expat parser will decode it to real unicode, and rewrite processing instruction. # so, we can send this (->toxml()) as content for basex, safely. content = doc.toxml() # str if Python 3.x, unicode if Python 2.x. # (both are actually real unicode. (ucs2 or ucs4.)) print(type(content)) # create session session = BaseXClient.Session('localhost', 1984, 'admin', 'admin') try: # create empty database session.execute("create db py3clientexample") print(session.info()) # add document session.add("py3clientexample/originally_u16le.xml", content) print(session.info()) # run query on database query = session.query("""doc('py3clientexample')""") for typecode, item in query.iter(): print("typecode=%d" % typecode) print("item=%s" % item) # drop database session.execute("drop db py3clientexample") print(session.info()) except Exception as e: # print exception print(repr(e)) finally: # close session if session: session.close() basex-7.7.2/basex-api/src/main/python3/UTF16example.xml000066400000000000000000000005041222453003200225140ustar00rootroot00000000000000<?xml version="1.0" encoding="utf-16le"?> <document> <list> <item id="1">ñX</item> <item id="2">_</item> <item id="3">ÂS</item> </list> </document> basex-7.7.2/basex-api/src/main/python3/WatchEventExample.py000066400000000000000000000025731222453003200235570ustar00rootroot00000000000000# -*- coding: utf-8 -*- # Documentation: http://docs.basex.org/wiki/Events # # (C) BaseX Team 2005-12, BSD License import BaseXClient import time from datetime import datetime from multiprocessing import Process # event publisher process (child) def child(): # create session (listener) session = BaseXClient.Session('localhost', 1984, 'admin', 'admin') # trigger event (first) session.execute("""xquery db:event("MY_EVENT", "fired MY_EVENT from child, at %s")""" % str(datetime.now())) # Zzz... time.sleep(3) # trigger event (second) session.execute("""xquery db:event("MY_EVENT", "fired MY_EVENT from child, at %s")""" % str(datetime.now())) # close session session.close() # listener function def dump_my_event(data): print(data) # listener process main def main(): # create session (listener) session = BaseXClient.Session('localhost', 1984, 'admin', 'admin') # create event session.execute("create event MY_EVENT"); try: # register event watcher session.watch("MY_EVENT", dump_my_event) # fork child chp = Process(target=child, args=()) chp.start() chp.join() # unregister event watcher session.unwatch("MY_EVENT") finally: # drop event session.execute("drop event MY_EVENT"); # close session session.close() # test it! main() basex-7.7.2/basex-api/src/main/qt/000077500000000000000000000000001222453003200166325ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/qt/BaseX.pro000066400000000000000000000005711222453003200203610ustar00rootroot00000000000000#------------------------------------------------- # # Project created by QtCreator 2011-09-11T18:10:19 # #------------------------------------------------- QT += core gui network TARGET = BaseX TEMPLATE = app SOURCES += main.cpp\ mainwindow.cpp \ basexthread.cpp HEADERS += mainwindow.h \ basexthread.h FORMS += mainwindow.ui RESOURCES += basex-7.7.2/basex-api/src/main/qt/basexthread.cpp000066400000000000000000000076041222453003200216370ustar00rootroot00000000000000#include "basexthread.h" BaseXThread::BaseXThread(QString &host, quint16 port, QObject *parent) : QThread(parent), hostName(host),port(port), quit(false), Timeout(5*1000), dbuser("admin"), dbpasswd("admin"), firstRun(true) { END_RES = QByteArray::fromHex("0000"); RES_FAIL = QByteArray::fromHex("0001"); } BaseXThread::~BaseXThread(){ mutex.lock(); quit = true; cond.wakeOne(); mutex.unlock(); qDebug()<<"destroy"; wait(); } int BaseXThread::addRequest(QString request){ QMutexLocker locker(&mutex); requestQueue.enqueue(request); if (!isRunning()) start(); else cond.wakeOne(); return 1; } void BaseXThread::run(){ if (firstRun){ socket = new QTcpSocket(); firstRun=false; } while(!quit){ mutex.lock(); QString actualQuery = requestQueue.dequeue(); mutex.unlock(); if(!socket->isOpen()){ socket->connectToHost(hostName, port); if (!socket->waitForConnected(Timeout)) { emit socketError(socket->error(), socket->errorString()); return; } if(!connectToBasex()) { return; } } char* q = actualQuery.toUtf8().data(); QByteArray * ts = new QByteArray(); socket->write(q, strlen(q)+1); if (!socket->waitForBytesWritten(Timeout)) { emit socketError(socket->error(), socket->errorString()); //return false; }else{ bool leave = false; bool xqueryError = false; while (!leave) { if (!socket->waitForReadyRead(Timeout)) { emit socketError(socket->error(), socket->errorString()); }else{ ts->append(socket->readAll()); if (ts->endsWith(END_RES)) leave=true; if (ts->endsWith(RES_FAIL)){ leave=true; xqueryError=true; } } } // QString resString(*ts); // qDebug()<<"res: "<<(xqueryError?"error:":"")<isOpen()){ socket->write("exit",5); socket->flush(); } } } bool BaseXThread::connectToBasex(){ // wait for timestamp bool leave = false; QByteArray ts; while (!leave) { if (!socket->waitForReadyRead(Timeout)) { emit socketError(socket->error(), socket->errorString()); return false; }else{ ts = socket->readAll(); ts.chop(1); // skip NullTermintation leave = true; } } QByteArray codingArray; codingArray.append(QCryptographicHash::hash(dbpasswd.toUtf8(), QCryptographicHash::Md5).toHex()); codingArray.append(ts); codingArray = QCryptographicHash::hash(codingArray, QCryptographicHash::Md5).toHex(); QByteArray nameArray = dbuser.toUtf8(); //send name char* nameChar = nameArray.data(); qDebug()<< socket->write(nameChar,strlen(nameChar)+1); //send md(md(passwd) + timestamp) char* codeChar = codingArray.data(); qDebug()<< socket->write(codeChar,strlen(codeChar)+1); ts.clear(); if (!socket->waitForReadyRead(Timeout)) { emit socketError(socket->error(), socket->errorString()); return false; }else{ ts.append(socket->readAll()); if (ts.at(0)=='\0'){ qDebug()<<"connection ok"; }else{ emit socketError(1000, "BASEX user authentification failed."); return false; } } return true; } basex-7.7.2/basex-api/src/main/qt/basexthread.h000066400000000000000000000015401222453003200212750ustar00rootroot00000000000000#ifndef BASEXTHREAD_H #define BASEXTHREAD_H #include #include #include #include class BaseXThread : public QThread { Q_OBJECT public: explicit BaseXThread(QString &host, quint16 port, QObject *parent = 0); ~BaseXThread(); int addRequest(QString request); void run(); signals: void newResult(const QByteArray *res); void socketError(int socketError, const QString &message); void error(int error, const QString &message); private: QString hostName; quint16 port; QMutex mutex; QWaitCondition cond; bool quit; bool firstRun; QString dbuser; QString dbpasswd; QQueue requestQueue; QByteArray END_RES; QByteArray RES_FAIL; QTcpSocket *socket; bool connectToBasex(); const int Timeout; }; #endif // BASEXTHREAD_H basex-7.7.2/basex-api/src/main/qt/example.xml000066400000000000000000000107041222453003200210110ustar00rootroot00000000000000 Gambardella, Matthew XML Developer's Guide Computer 44.95 2000-10-01 An in-depth look at creating applications with XML. Ralls, Kim Midnight Rain Fantasy 5.95 2000-12-16 A former architect battles corporate zombies, an evil sorceress, and her own childhood to become queen of the world. Corets, Eva Maeve Ascendant Fantasy 5.95 2000-11-17 After the collapse of a nanotechnology society in England, the young survivors lay the foundation for a new society. Corets, Eva Oberon's Legacy Fantasy 5.95 2001-03-10 In post-apocalypse England, the mysterious agent known only as Oberon helps to create a new life for the inhabitants of London. Sequel to Maeve Ascendant. Corets, Eva The Sundered Grail Fantasy 5.95 2001-09-10 The two daughters of Maeve, half-sisters, battle one another for control of England. Sequel to Oberon's Legacy. Randall, Cynthia Lover Birds Romance 4.95 2000-09-02 When Carla meets Paul at an ornithology conference, tempers fly as feathers get ruffled. Thurman, Paula Splish Splash Romance 4.95 2000-11-02 A deep sea diver finds true love twenty thousand leagues beneath the sea. Knorr, Stefan Creepy Crawlies Horror 4.95 2000-12-06 An anthology of horror stories about roaches, centipedes, scorpions and other insects. Kress, Peter Paradox Lost Science Fiction 6.95 2000-11-02 After an inadvertant trip through a Heisenberg Uncertainty Device, James Salway discovers the problems of being quantum. O'Brien, Tim Microsoft .NET: The Programming Bible Computer 36.95 2000-12-09 Microsoft's .NET initiative is explored in detail in this deep programmer's reference. O'Brien, Tim MSXML3: A Comprehensive Guide Computer 36.95 2000-12-01 The Microsoft MSXML3 parser is covered in detail, with attention to XML DOM interfaces, XSLT processing, SAX and more. Galos, Mike Visual Studio 7: A Comprehensive Guide Computer 49.95 2001-04-16 Microsoft Visual Studio 7 is explored in depth, looking at how Visual Basic, Visual C++, C#, and ASP+ are integrated into a comprehensive development environment. basex-7.7.2/basex-api/src/main/qt/main.cpp000066400000000000000000000002621222453003200202620ustar00rootroot00000000000000#include #include "mainwindow.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); } basex-7.7.2/basex-api/src/main/qt/mainwindow.cpp000066400000000000000000000043171222453003200215170ustar00rootroot00000000000000#include "mainwindow.h" #include "ui_mainwindow.h" #include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); QString host("localhost"); bxth = new BaseXThread(host,1984, this); connect(bxth, SIGNAL(socketError(int,const QString&)), SLOT(displayError(int,const QString&))); connect(ui->doItButton, SIGNAL(clicked()), SLOT(buttonDo())); connect(bxth,SIGNAL(newResult(const QByteArray*)),SLOT(basexFeedBack(const QByteArray*))); } void MainWindow::displayError(int socketError, const QString &errorString) { switch (socketError) { case QAbstractSocket::RemoteHostClosedError: break; case QAbstractSocket::HostNotFoundError: QMessageBox::information(this, tr("BaseX Client"), tr("The host was not found. Please check the " "host name and port settings.")); break; case QAbstractSocket::ConnectionRefusedError: QMessageBox::information(this, tr("BaseX Client"), tr("The connection was refused by the peer. " "Make sure the BaseX server is running, " "and check that the host name and port " "settings are correct.")); break; default: QMessageBox::information(this, tr("BaseX Client"), tr("The following error occurred:\n %1.") .arg(errorString)); } } MainWindow::~MainWindow() { delete ui; } void MainWindow::basexFeedBack(const QByteArray *array) { QString abc(ui->report->toPlainText()); abc.append(*array); ui->report->setPlainText(abc); delete array; } void MainWindow::buttonDo() { QString fileName = QFileDialog::getOpenFileName(this, tr("Open example.xml"), ".", tr("Example File (*example.xml)")); qDebug()<0){ bxth->addRequest(QString("create db test0815 %1").arg(fileName)); bxth->addRequest("xquery //book"); bxth->addRequest("close"); bxth->addRequest("drop database test0815"); } } basex-7.7.2/basex-api/src/main/qt/mainwindow.h000066400000000000000000000010171222453003200211560ustar00rootroot00000000000000#ifndef MAINWINDOW_H #define MAINWINDOW_H #include #include #include "basexthread.h" namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private: Ui::MainWindow *ui; BaseXThread * bxth; private slots: void displayError(int socketError, const QString &errorString); void basexFeedBack(const QByteArray * array); void buttonDo(); }; #endif // MAINWINDOW_H basex-7.7.2/basex-api/src/main/qt/mainwindow.ui000066400000000000000000000033061222453003200213470ustar00rootroot00000000000000 MainWindow 0 0 931 833 MainWindow open example.xml and query Qt::Vertical 20 40 0 0 931 22 TopToolBarArea false basex-7.7.2/basex-api/src/main/readme.txt000066400000000000000000000007541222453003200202120ustar00rootroot00000000000000====================================================== BASEX CLIENTS === In this directory, you find clients to communicate with the database server in different programming languages. If your projects are based on other languages, or if you feel that the existing code could be improved: your feedback is welcome! More information is found at: http://docs.basex.org/wiki/Server_Protocol BaseX Team, 2013 ======================================================================== basex-7.7.2/basex-api/src/main/rebol/000077500000000000000000000000001222453003200173115ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/rebol/basexclient.r000066400000000000000000000111301222453003200217710ustar00rootroot00000000000000Rebol [ Title: "Rebol client for BaseX" Author: "Sabu Francis" Date: "March 10, 2010" LastUpdated: "June 5, 2010" Version: "0.1" Copyright: "Sabu Francis, Navi Mumbai, India" License: "Perl Artistic License 2.0" LicenseTextUrl: http://www.perlfoundation.org/artistic_license_2_0 Purpose: {"BaseX Rebol client; works with BaseX 6.1"} ;following data are for www.rebol.org library ;you can find a lot of rebol script there library: [ level: 'beginner platform: 'all type: [api library] domain: [console] tested-under: [windows linux] support: none license: [artistic_license_2_0] see-also: http://code.google.com/p/reb-basex ] ChangeHistory: { June 5, 2010: Created a Google Project space for it and uploaded it there. } ToDo: { a) Error reporting. } ] getmd5: func [ { An Md5 function, the way it is done in other languages. For some reason Rebol gives the MD5 in uppercase. This takes in a string and gives out its md5 hash } s [string!] ] [ lowercase replace/all replace/all mold checksum/method copy s 'md5 "#{" "" "}" "" ] gethashed: func[ { Two params: 1st is the password, 2nd the time stamp It concantenates the md5 hash of the password with the password and then make an md5 hash of the entire concatenation That is how BaseX likes it } passwd [string!] ts [string!] /local p5 ] [ getmd5 rejoin [ getmd5 passwd ts ] ] copyC: func [myport /local response data] [ wait myport ;;; waiting at the port is important!!! data: copy myport data ] execBaseX: func [ { 1st param: username 2nd: Password. 3rd: BaseX command Example of 3rd param: "XQUERY basex:db('test')//author" Refinement /p specifies port Refinement /w specifies timeout (not used in this version) This does complete execution of one BaseX command right from login to logout It has a refinement /p using which you can specify the port to which to write to } user [string!] passwd [string!] Xqs [string!] /p port [any-type!] /w waittime [number!] /local c ts r1 rslt] [ system/schemes/default/timeout: 0.1 either p [ c: open/no-wait port] ;;TCP Port should ONLY be opened using no-wait else it blocks! [ c: open/no-wait tcp://localhost:1984] ;print "Wokay, opened port" ts: copyC c ;print ["Timestamp: " ts] replace ts "^@" "" ;Remove the null character at end sent by BaseX insert c user insert c "^@" insert c gethashed passwd ts insert c "^@" rslt: copyC c ; At this point we should get an empty string if login successful ;print ["Result of login: " rslt ] insert c Xqs ;;Now we send the command to be executed to BaseX on this session ;"XQUERY basex:db('test')//author" insert c "^@" rslt: replace copyC c "^@" "" insert c "EXIT^@" ;This is the logout function in BaseX. It closes the session close c rslt;;; returns back the string that was result of the command given to the BaseX engine in this session ] BaseXLogin: func [ { 1st param: username 2nd: Password. Refinement /p specifies port Refinement /w specifies timeout (not used in this version) This returns a connection port that can be used later After you finish using the connection, make sure you do close it by using BaseXLogout } user [string!] passwd [string!] /p port [any-type!] /w waittime [number!] /local c ts r1 rslt] [ system/schemes/default/timeout: 0.1 either p [ c: open/no-wait port] ;;TCP Port should ONLY be opened using no-wait else it blocks! [ c: open/no-wait tcp://localhost:1984] ;print "Wokay, opened port" ts: copyC c ;print ["Timestamp: " ts] replace ts "^@" "" ;Remove the null character at end sent by BaseX insert c user insert c "^@" insert c gethashed passwd ts insert c "^@" rslt: copyC c ; At this point we should get an empty string if login successful ;print ["Result of login: " rslt ] return c ;;; return the Port for this session ] BaseXExecute: func [ { This takes two arguments. 1st one is a connection port, 2nd is the BaseX command to be executed Example: "XQUERY basex:db('test')//author" } c [any-type!] Xqs [string!] ] [ insert c Xqs ;;Now we send the command to be executed to BaseX on this session insert c "^@" rslt: replace copyC c "^@" "" return rslt ] BaseXLogout: func [ {This has to be called to close the BaseX connection} c [any-type!] ] [ insert c "EXIT^@" ;This is the logout function in BaseX. It closes the session close c ;;; and also closes the port! ]basex-7.7.2/basex-api/src/main/resources/000077500000000000000000000000001222453003200202205ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/resources/.gitignore000066400000000000000000000000121222453003200222010ustar00rootroot00000000000000/WEB-INF basex-7.7.2/basex-api/src/main/resources/xquery/000077500000000000000000000000001222453003200215555ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/resources/xquery/webdav.xqm000066400000000000000000000133321222453003200235560ustar00rootroot00000000000000(:~ : This module contains helper functions for locking documents in WebDAV. : : @author BaseX Team 2005-13, BSD License :) module namespace w = 'http://basex.org/modules/webdav'; (: Lock database name. :) declare variable $w:locks-db := '~webdav'; (: Lock error. :) declare variable $w:err-locked := QName('http://basex.org/modules/webdav', 'w:locked_423'); (:~ : Decomposes a path into segments. : @param $path path : @return segments :) declare function w:path-segments( $path as xs:string ) as xs:string* { tokenize($path, '/')[.] }; (:~ : Checks if the specified strings are equal. : @param $x first strings : @param $y second strings : @return result of check :) declare function w:is-prefix( $x as xs:string*, $y as xs:string* ) as xs:boolean { every $r in for-each-pair($x, $y, function($a, $b) { $a eq $b }) satisfies $r }; (:~ : Checks if a lock with the given path has locked : (possibly indirectly) another resource. : @param $ancestor ancestor resource : @param $descendant descendant resource : @param $depth depth : @return result of check :) declare function w:has-locked( $ancestor as xs:string, $descendant as xs:string, $depth as xs:string ) as xs:boolean { let $ancestor-segments := w:path-segments($ancestor), $descendant-segments := w:path-segments($descendant) return switch($depth) case '0' case '1' return count($ancestor-segments) + $depth eq count($descendant-segments) and w:is-prefix($ancestor-segments, $descendant-segments) case 'infinite' return w:is-prefix($ancestor-segments, $descendant-segments) default return false() }; (:~ : Calculates the lock expiration date-time given its timeout in seconds. : @param $timeout time out : @return lock expiration :) declare function w:expiry-dateTime( $timeout as xs:integer ) as xs:dateTime { current-dateTime() + xs:dayTimeDuration('PT' || $timeout || 'S') }; (:~ : Checks if the lock database exists. : @return result of check :) declare function w:lock-db-exists() as xs:boolean { db:exists($w:locks-db) }; (:~ : Creates the database for the WebDAV locks, if it does not exist. :) declare %updating function w:init-lock-db() { if (w:lock-db-exists()) then () else db:create($w:locks-db, , $w:locks-db) }; (:~ : Opens the lock database, if it exists; otherwise, returns an empty sequence. : @return database or empty sequence :) declare function w:open-lock-db() as document-node()? { if(w:lock-db-exists()) then db:open($w:locks-db) else () }; (:~ : Finds all active locks of the given path. : @param $path path to check : @return active lock info elements :) declare function w:locks-on( $path as xs:string ) as element(w:lockinfo)* { w:open-lock-db()/w:locks/w:lockinfo[ w:has-locked(w:path, $path, 'infinite') and xs:dateTime(w:expiry) gt current-dateTime() ] }; (:~ : Checks if two locks are in conflict. : @param $lock1 first lock : @param $lock2 second lock : @return result of check :) declare function w:in-conflict( $lock1 as element(w:lockinfo), $lock2 as element(w:lockinfo) ) as xs:boolean { (w:has-locked($lock1/w:path, $lock2/w:path, $lock1/w:depth) or w:has-locked($lock2/w:path, $lock1/w:path, $lock2/w:depth)) and (w:is-exclusive($lock1) or w:is-exclusive($lock2)) and $lock1/w:owner ne $lock2/w:owner }; (:~ : Checks if a lock is exclusive. : @param $lock lock to check : @return result of check :) declare function w:is-exclusive( $lock as element(w:lockinfo) ) as xs:boolean { $lock/w:scope eq 'exclusive' }; (:~ : Gets all locks which are in conflict with the given one. : @param $requested-lock requested lock : @return elements with conflicting locks :) declare function w:conflicting-locks( $requested-lock as element(w:lockinfo) ) as element(w:lockinfo)* { for $existing-lock in w:locks-on($requested-lock/w:path) where w:in-conflict($requested-lock, $existing-lock) return $existing-lock }; (:~ : Renews a lock with the given token. : @param $token lock token :) declare %updating function w:refresh-lock( $token as xs:string ) { for $lock in w:lock($token) return replace value of node $lock/w:expiry with w:expiry-dateTime($lock/w:timeout) }; (:~ : Returns the lock with the given token. : @param $token lock token : @return lock element :) declare function w:lock( $token as xs:string ) as element(w:lockinfo)* { w:open-lock-db()/w:locks/w:lockinfo[w:token eq $token] }; (:~ : Creates a new lock for a given path. : @param $path path : @param $token token : @param $scope scope : @param $type type : @param $depth depth : @param $owner owner : @param $timeout timeout :) declare %updating function w:create-lock( $path as xs:string, $token as xs:string, $scope as xs:string, $type as xs:string, $depth as xs:string, $owner as xs:string, $timeout as xs:integer ) { let $expiry := w:expiry-dateTime($timeout), $requested-lock := element w:lockinfo { element w:path { $path }, element w:token { $token }, element w:scope { $scope }, element w:type { $type }, element w:depth { $depth }, element w:owner { $owner }, element w:timeout { $timeout }, element w:expiry { $expiry } } return if(w:conflicting-locks($requested-lock)) then error($w:err-locked, 'Resource has a conflicting lock', $path) else insert node $requested-lock as last into w:open-lock-db()/w:locks }; (:~ : Removes a lock given its token. : @param $token lock token :) declare %updating function w:delete-lock( $token as xs:string ) { delete node w:lock($token) }; basex-7.7.2/basex-api/src/main/ruby/000077500000000000000000000000001222453003200171675ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/ruby/AddExample.rb000066400000000000000000000015621222453003200215240ustar00rootroot00000000000000# This example shows how new documents can be added. # # Documentation: http://docs.basex.org/wiki/Clients # # (C) BaseX Team 2005-12, BSD License require './BaseXClient.rb' begin # create session session = BaseXClient::Session.new("localhost", 1984, "admin", "admin") # create empty database session.execute("create db database") print "\n" + session.info() # add document session.add("world/World.xml", "Hello World!") print "\n" + session.info() # add document session.add("Universe.xml", "Hello Universe!") print "\n" + session.info() + "\n" # run query on database print "\n" + session.execute("xquery collection('database')") + "\n" # drop database session.execute("drop db database") # close session session.close rescue Exception => e # print exception puts e end basex-7.7.2/basex-api/src/main/ruby/BaseXClient.rb000066400000000000000000000065601222453003200216640ustar00rootroot00000000000000# Ruby client for BaseX. # Works with BaseX 7.0 and later # # Documentation: http://docs.basex.org/wiki/Clients # # (C) BaseX Team 2005-12, BSD License require 'socket' require 'digest/md5' module BaseXClient class Session def initialize(host, port, username, pw) # create server connection @socket = TCPSocket.open(host, port) # receive timestamp ts = receive hash = Digest::MD5.new hash.update(hash.hexdigest(pw)) hash.update(ts) # send username and hashed password/timestamp send(username) send(hash.hexdigest()) # evaluate success flag if read != 0.chr raise "Access denied." end @char_lead_byte = "\xFF" @char_lead_byte.force_encoding('ASCII-8BIT') end def execute(com) # send command to server send(com) # receive result result = receive @info = receive if !ok raise @info end return result end def query(cmd) return Query.new(self, cmd) end def create(name, input) sendCmd(8.chr, name, input) end def add(path, input) sendCmd(9.chr, path, input) end def replace(path, input) sendCmd(12.chr, path, input) end def store(path, input) sendCmd(13.chr, path, input) end def info() return @info end def close() send("exit") @socket.close end # Receives a string from the socket. def receive() complete = "" while (t = read) != 0.chr if t == @char_lead_byte then t = read end complete << t end return complete end # Sends the defined str. def send(str) @socket.write(str + 0.chr) end def sendCmd(cmd, arg, input) send(cmd + arg + 0.chr + input) @info = receive if !ok raise @info end end # Returns a single byte from the socket. def read() return @socket.read(1) end def write(i) @socket.write(i) end # Returns success check. def ok() return read == 0.chr end end class Query def initialize(s, q) @session = s @id = exec(0.chr, q) @cache = [] @pos = 0 end def bind(name, value, type="") exec(3.chr, @id + 0.chr + name + 0.chr + value + 0.chr + type) end def context(value, type="") exec(14.chr, @id + 0.chr + value + 0.chr + type) end def more() if @cache.length == 0 @session.write(4.chr) @session.send(@id) while @session.read > 0.chr @cache << @session.receive end if !@session.ok raise @session.receive end end return @pos < @cache.length end def next if more() @pos += 1 return @cache[@pos - 1] end end def execute() return exec(5.chr, @id) end def info() return exec(6.chr, @id) end def close() return exec(2.chr, @id) end def exec(cmd, arg) @session.send(cmd + arg) s = @session.receive if !@session.ok raise @session.receive end return s end end end basex-7.7.2/basex-api/src/main/ruby/CreateExample.rb000066400000000000000000000012211222453003200222270ustar00rootroot00000000000000# This example shows how new databases can be created. # Documentation: http://docs.basex.org/wiki/Clients # # (C) BaseX Team 2005-12, BSD License require './BaseXClient.rb' begin # create session session = BaseXClient::Session.new("localhost", 1984, "admin", "admin") # create new database session.create("database", "Hello World!") print "\n" + session.info() # run query on database print "\n" + session.execute("xquery doc('database')") + "\n" # drop database session.execute("drop db database") # close session session.close rescue Exception => e # print exception puts e end basex-7.7.2/basex-api/src/main/ruby/Example.rb000066400000000000000000000011531222453003200211070ustar00rootroot00000000000000# This example shows how database commands can be executed. # Documentation: http://docs.basex.org/wiki/Clients # # (C) BaseX Team 2005-12, BSD License require './BaseXClient.rb' begin # initialize timer start_time = Time.now # create session session = BaseXClient::Session.new("localhost", 1984, "admin", "admin") # perform command and print returned string print session.execute("xquery 1 to 10") # close session session.close # print time needed time = (Time.now - start_time) * 1000 puts " #{time} ms." rescue Exception => e # print exception puts e end basex-7.7.2/basex-api/src/main/ruby/QueryBindExample.rb000066400000000000000000000014671222453003200227420ustar00rootroot00000000000000# This example shows how external variables can be bound to XQuery expressions. # # Documentation: http://docs.basex.org/wiki/Clients # # (C) BaseX Team 2005-12, BSD License require './BaseXClient.rb' begin # create session session = BaseXClient::Session.new("localhost", 1984, "admin", "admin") begin # create query instance input = "declare variable $name external; for $i in 1 to 10 return element { $name } { $i }" query = session.query(input) # bind variable query.bind("$name", "number") # print result print query.execute # close query instance print query.close() rescue Exception => e # print exception puts e end # close session session.close rescue Exception => e # print exception puts e end basex-7.7.2/basex-api/src/main/ruby/QueryExample.rb000066400000000000000000000013711222453003200221370ustar00rootroot00000000000000# This example shows how queries can be executed in an iterative manner. # Documentation: http://docs.basex.org/wiki/Clients # # (C) BaseX Team 2005-12, BSD License require './BaseXClient.rb' begin # create session session = BaseXClient::Session.new("localhost", 1984, "admin", "admin") begin # create query instance input = "for $i in 1 to 10 return Text { $i }" query = session.query(input) # loop through all results while query.more do print query.next end # close query instance print query.close() rescue Exception => e # print exception puts e end # close session session.close rescue Exception => e # print exception puts e end basex-7.7.2/basex-api/src/main/scala/000077500000000000000000000000001222453003200172715ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/scala/addexample.scala000066400000000000000000000021551222453003200224050ustar00rootroot00000000000000import java.io._ /** * This example shows how documents can be added to databases. * Documentation: http://docs.basex.org/wiki/Clients * * @author BaseX Team 2005-12, BSD License */ object addexample { /** * Main method. * @param args command-line arguments */ def main(args: Array[String]) { // create session val session = new BaseXClient("localhost", 1984, "admin", "admin") // create empty database session.execute("create db database") println(session.info) // define input stream var bais = new ByteArrayInputStream("Hello World!".getBytes) // add document session.add("world/world.xml", bais) println(session.info) // define input stream bais = new ByteArrayInputStream("Hello Universe!".getBytes) // add document session.add("universe.xml", bais) println(session.info) // run query on database println println(session.execute("xquery collection('database')")) // drop database session.execute("drop db database") // close session session.close } } basex-7.7.2/basex-api/src/main/scala/basexclient.scala000066400000000000000000000157241222453003200226100ustar00rootroot00000000000000import java.io._ import java.net._ import java.security._ import java.util._ /** * Scala client for BaseX. * Works with BaseX 7.0 and later * Does not support all bindings yet; your extensions are welcome. * * Documentation: http://docs.basex.org/wiki/Clients * * (C) BaseX Team 2005-12, BSD License */ /** * Session constructor. * @param host server name * @param port server port * @param usern user name * @param pw password * @throws IOException I/O exception */ class BaseXClient(host: String, port: Int, usern: String, pw: String) { var inf = "" val socket = new Socket socket.connect(new InetSocketAddress(host, port), 5000) val in = new BufferedInputStream(socket.getInputStream) val out = socket.getOutputStream val ts = receive send(usern) send(md5(md5(pw) + ts)) if(!ok) throw new IOException("Access denied.") /** * Executes a command and serializes the result to an output stream. * @param cmd command * @param os output stream * @throws IOException I/O Exception */ def execute(cmd: String, os: OutputStream) { send(cmd) receive(in, os) inf = receive if(!ok) throw new IOException(inf) } /** * Executes a command and returns the result. * @param cmd command * @return result * @throws IOException I/O Exception */ def execute(cmd: String) : String = { val os = new ByteArrayOutputStream execute(cmd, os) os.toString("UTF-8") } /** * Creates a query object. * @param query query string * @return query * @throws IOException I/O Exception */ def query(query: String) : Query = { new Query(query) } /** * Creates a database. * @param name name of database * @param input xml input * @throws IOException I/O exception */ def create(name: String, input: InputStream) { out.write(8) send(name) send(input) } /** * Adds a database. * @param path source path * @param input xml input * @throws IOException I/O exception */ def add(path: String, input: InputStream) { out.write(9) send(path) send(input) } /** * Replaces a resource. * @param path source path * @param input xml input * @throws IOException I/O exception */ def replace(path: String, input: InputStream) { out.write(12) send(path) send(input) } /** * Stores a binary resource. * @param path source path * @param input binary input * @throws IOException I/O exception */ def store(path: String, input: InputStream) { out.write(13) send(path) send(input) } /** * Returns command information. * @return string info */ def info() : String = { inf } /** * Closes the session. * @throws IOException I/O Exception */ def close() { send("exit") out.flush socket.close } /** * Sends an input stream to the server. * @param input xml input * @throws IOException I/O exception */ private def send(input: InputStream) { val is = new BufferedInputStream(input) val os = new BufferedOutputStream(out) var b = 0 while({ b = is.read; b != -1 }) os.write(b) os.write(0) os.flush inf = receive if(!ok) throw new IOException(inf) } /** * Checks the next success flag. * @return value of check * @throws IOException I/O Exception */ private def ok() : Boolean = { out.flush in.read == 0 } /** * Returns the next received string. * @return String result or info * @throws IOException I/O exception */ private def receive() : String = { val os = new ByteArrayOutputStream receive(in, os) os.toString("UTF-8") } /** * Sends a string to the server. * @param s string to be sent * @throws IOException I/O exception */ private def send(s: String) { out.write((s + '\0').getBytes("UTF8")) } /** * Receives a string and writes it to the specified output stream. * @param bis input stream * @param o output stream * @throws IOException I/O exception */ private def receive(is: InputStream, os: OutputStream) { var b = 0 while({ b = is.read; b != 0 && b != -1 }) os.write(b) } /** * Returns an MD5 hash. * @param pw String * @return String */ private def md5(pw: String) : String = { val sb = new StringBuilder try { val md = MessageDigest.getInstance("MD5") md.update(pw.getBytes) for(b <- md.digest) { val s = Integer.toHexString(b & 0xFF) if(s.length == 1) sb.append('0') sb.append(s) } } catch { case ex: NoSuchAlgorithmException => ex.printStackTrace case ex : Exception => throw ex } sb.toString } /** * Query constructor. * @param query query string * @throws IOException I/O exception */ class Query(query: String) { val id = exec(0, query) /** * Binds a variable. * @param name name of variable * @param value value * @throws IOException I/O exception */ def bind(name: String, value: String) { bind(name, value, "") } /** * Binds a variable with a specific data type. * @param name name of variable * @param value value * @param type data type * @throws IOException I/O exception */ def bind(name: String, value: String, type: String) { exec(3, id + '\0' + name + '\0' + value + '\0') } /** * Binds the context item. * @param value value * @throws IOException I/O exception */ def context(value: String) { context(value, "") } /** * Binds the context item with a specific data type. * @param value value * @param type data type * @throws IOException I/O exception */ def context(value: String, type: String) { exec(14, id + '\0' + value + '\0') } /** * Returns the whole result of the query. * @return query result * @throws IOException I/O Exception */ def execute() : String = { exec(5, id) } /** * Returns query info as a string, regardless of whether an output stream * was specified. * @return query info * @throws IOException I/O exception */ def info() : String = { exec(6, id) } /** * Closes the query. * @return result footer * @throws IOException I/O exception */ def close() { exec(2, id) } /** * Executes the specified command. * @param cmd command * @param arg argument * @return resulting string * @throws IOException I/O exception */ private def exec(cmd: Int, arg: String) : String = { out.write(cmd) send(arg) val s = receive if(!ok) throw new IOException(receive) s } } } basex-7.7.2/basex-api/src/main/scala/createexample.scala000066400000000000000000000014671222453003200231250ustar00rootroot00000000000000import java.io._ /** * This example shows how new databases can be created. * Documentation: http://docs.basex.org/wiki/Clients * * @author BaseX Team 2005-12, BSD License */ object createexample { /** * Main method. * @param args command-line arguments */ def main(args: Array[String]) { // create session val session = new BaseXClient("localhost", 1984, "admin", "admin") // define input stream val bais = new ByteArrayInputStream("Hello World!".getBytes) // create new database session.create("database", bais) println(session.info) // run query on database println(session.execute("xquery doc('database')")) // drop database session.execute("drop db database") // close session session.close } } basex-7.7.2/basex-api/src/main/scala/example.scala000066400000000000000000000016161222453003200217350ustar00rootroot00000000000000import java.io._ /** * This example shows how commands can be executed via the server instance. * * Documentation: http://docs.basex.org/wiki/Clients * * @author BaseX Team 2005-12, BSD License */ object example { /** * Main method. * @param args command-line arguments */ def main(args: Array[String]) { // initialize timer val time = System.nanoTime // create session val session = new BaseXClient("localhost", 1984, "admin", "admin") // version 1: perform command and print returned string println(session.execute("info")) // version 2 (faster): perform command and pass on result to output stream val out = System.out session.execute("xquery 1 to 10", out) // close session session.close // print time needed val ms = (System.nanoTime - time) / 1000000d println("\n\n" + ms + " ms") } } basex-7.7.2/basex-api/src/main/scala/querybindexample.scala000066400000000000000000000015151222453003200236560ustar00rootroot00000000000000import java.io._ /** * This example shows how external variables can be bound to XQuery expressions. * * Documentation: http://docs.basex.org/wiki/Clients * * @author BaseX Team 2005-12, BSD License */ object querybindexample { /** * Main method. * @param args command-line arguments */ def main(args: Array[String]) { // create session val session = new BaseXClient("localhost", 1984, "admin", "admin") // create query instance val input = "declare variable $name external; " + "for $i in 1 to 10 return element { $name } { $i }" val query = session.query(input) // bind variable query.bind("$name", "number"); // print result println(query.execute) // close query instance query.close // close session session.close } } basex-7.7.2/basex-api/src/main/scala/queryexample.scala000066400000000000000000000015001222453003200230130ustar00rootroot00000000000000import java.io._ /** * This example shows how queries can be executed in an iterative manner. * Iterative evaluation will be slower, as more server requests are performed. * * Documentation: http://docs.basex.org/wiki/Clients * * @author BaseX Team 2005-12, BSD License */ object queryexample { /** * Main method. * @param args command-line arguments */ def main(args: Array[String]) { // create session val session = new BaseXClient("localhost", 1984, "admin", "admin") // create query instance val input = "for $i in 1 to 10 return Text { $i }" val query = session.query(input) // loop through all results while(query.more) println(query.next) // close query instance query.close // close session session.close } } basex-7.7.2/basex-api/src/main/vb/000077500000000000000000000000001222453003200166155ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/vb/AddExample.vb000066400000000000000000000023671222453003200211620ustar00rootroot00000000000000' This example shows how new documents can be added. ' ' Documentation: http://docs.basex.org/wiki/Clients ' ' (C) BaseX Team 2005-12, BSD License Imports System Imports System.IO Module CreateExample Sub Main() Try ' create session Dim session As New Session("localhost", 1984, "admin", "admin") ' create empty database session.Execute("create db database") Console.WriteLine(session.Info) ' define InputStream Dim ms As New MemoryStream(System.Text.Encoding.UTF8.GetBytes("Hello World!")) ' add document session.Add("world/World.xml", ms) Console.WriteLine(session.Info) ' define InputStream Dim ms As New MemoryStream(System.Text.Encoding.UTF8.GetBytes("Hello Universe!")) ' add document session.Add("Universe.xml", ms) Console.WriteLine(session.Info) ' run query on database Console.WriteLine(session.Execute("xquery /")) ' drop database session.Execute("drop db database") ' close session session.Close() Catch e As IOException ' print exception Console.WriteLine(e.Message) End Try End Sub End Modulebasex-7.7.2/basex-api/src/main/vb/BaseXClient.vb000066400000000000000000000137151222453003200213160ustar00rootroot00000000000000' Visual Basic client for BaseX. ' Works with BaseX 7.0 and later. ' Does not support all bindings yet; your extensions are welcome. ' ' Documentation: http://docs.basex.org/wiki/Clients ' ' (C) BaseX Team 2005-12, BSD License Imports System Imports System.Net.Sockets Imports System.Security.Cryptography Imports System.Text Imports System.Collections.Generic Imports System.IO Module BaseXClient Class Session Private cache As Byte() = New Byte(4096) {} Public stream As NetworkStream Private socket As TcpClient Private m_info As String = "" Private bpos As Integer Private bsize As Integer Public Sub New(host As String, port As Integer, username As String, pw As String) socket = New TcpClient(host, port) stream = socket.GetStream() Dim ts As String = Receive() Send(username) Dim tmp As String = MD5StringHash(pw) Send(MD5StringHash(tmp & ts)) If stream.ReadByte() <> 0 Then Throw New IOException("Access denied.") End If End Sub Public Sub Execute(com As String, ms As Stream) Send(com) Init() Receive(ms) m_info = Receive() If Not Ok() Then Throw New IOException(m_info) End If End Sub Public Function Execute(com As String) As [String] Dim ms As New MemoryStream() Execute(com, ms) Return System.Text.Encoding.UTF8.GetString(ms.ToArray()) End Function Public Sub Create(name As String, ms As Stream) stream.WriteByte(8) Send(name) While True: Dim t As Integer = ms.ReadByte() If t = -1 Then Exit While End If stream.WriteByte(Convert.ToByte(t)) End While stream.WriteByte(0) m_info = Receive() If Not Ok() Then Throw New IOException(m_info) End If End Sub Public Sub Create(name As String, target As String, ms As Stream) stream.WriteByte(9) Send(name) Send(target) While True: Dim t As Integer = ms.ReadByte() If t = -1 Then Exit While End If stream.WriteByte(Convert.ToByte(t)) End While stream.WriteByte(0) m_info = Receive() If Not Ok() Then Throw New IOException(m_info) End If End Sub Public Function Query(q As String) As Query Return New Query(Me, q) End Function Public ReadOnly Property Info() As String Get Return m_info End Get End Property Public Sub Close() Send("exit") socket.Close() End Sub ' Initializes the byte transfer. Private Sub Init() bpos = 0 bsize = 0 End Sub ' Returns a single byte from the socket. Private Function Read() As Byte If bpos = bsize Then bsize = stream.Read(cache, 0, 4096) bpos = 0 End If Dim b as Byte = cache(bpos) bpos += 1 Return b End Function ' Receives a string from the socket. Private Sub Receive(ms As Stream) While True Dim b As Byte = Read() If b = 0 Then Exit While End If ms.WriteByte(b) End While End Sub ' Receives a string from the socket. Public Function Receive() As String Dim ms As New MemoryStream() Receive(ms) Return System.Text.Encoding.UTF8.GetString(ms.ToArray()) End Function ' Sends strings to server. Public Sub Send(message As String) Dim msg As Byte() = System.Text.Encoding.UTF8.GetBytes(message) stream.Write(msg, 0, msg.Length) stream.WriteByte(0) End Sub ' Returns success check. Public Function Ok() As Boolean Return Read() = 0 End Function ' Returns the md5 hash of a string. Private Function MD5StringHash(ByVal strString As String) As String Dim MD5 As New MD5CryptoServiceProvider Dim Data As Byte() Dim Result As Byte() Dim Res As String = "" Dim Tmp As String = "" Data = Encoding.ASCII.GetBytes(strString) Result = MD5.ComputeHash(Data) For i As Integer = 0 To Result.Length - 1 Tmp = Hex(Result(i)) If Len(Tmp) = 1 Then Tmp = "0" & Tmp Res += Tmp Next Return Res.ToLower End Function End Class Class Query Private session As Session Private id As String Public Sub New(s As Session, query As String) session = s id = Exec(0, query) End Sub Public Sub Bind(name As String, value As String) Bind(name, value, "") End Sub Public Sub Bind(name As String, value As String, type As String) session.stream.WriteByte(3) session.Send(id) session.Send(name) session.Send(value) session.Send(type) Dim Res As String = session.Receive() If Not session.Ok() Then Throw New IOException(session.Receive()) End If End Sub Public Sub Context(value As String) Context(value, "") End Sub Public Sub Context(value As String, type As String) session.stream.WriteByte(14) session.Send(id) session.Send(value) session.Send(type) Dim Res As String = session.Receive() If Not session.Ok() Then Throw New IOException(session.Receive()) End If End Sub Public Function Execute() As String Return Exec(5, id) End Function Public Function Info() As String Return Exec(6, id) End Function Public Function Close() Exec(2, id) End Function Public Function Exec(cmd As Integer, arg As String) As String session.stream.WriteByte(cmd) session.Send(arg) Dim Res As String = session.Receive() If Not session.Ok() Then Throw New IOException(session.Receive()) End If Return Res End Function End Class End Module basex-7.7.2/basex-api/src/main/vb/CreateExample.vb000066400000000000000000000015731222453003200216730ustar00rootroot00000000000000' This example shows how new databases can be created. ' ' Documentation: http://docs.basex.org/wiki/Clients ' ' (C) BaseX Team 2005-12, BSD License Imports System Imports System.IO Module CreateExample Sub Main() Try ' create session Dim session As New Session("localhost", 1984, "admin", "admin") ' define InputStream Dim ms As New MemoryStream(System.Text.Encoding.UTF8.GetBytes("Hello World!")) ' create database session.Create("database", ms) Console.WriteLine(session.Info) ' run query on database Console.WriteLine(session.Execute("xquery /")) ' drop database session.Execute("drop db database") ' close session session.Close() Catch e As IOException ' print exception Console.WriteLine(e.Message) End Try End Sub End Modulebasex-7.7.2/basex-api/src/main/vb/Example.vb000066400000000000000000000020351222453003200205410ustar00rootroot00000000000000' This example shows how database commands can be executed. ' ' Documentation: http://docs.basex.org/wiki/Clients ' ' (C) BaseX Team 2005-12, BSD License Imports System Imports System.Diagnostics Imports System.IO Module Example Sub Main() Try ' initialize timer Dim watch As New Stopwatch() watch.Start() ' create session Dim session As New Session("localhost", 1984, "admin", "admin") ' version 1: perform command and print returned string Console.WriteLine(session.Execute("info")) ' version 2 (faster): perform command and pass on result to output stream Dim stream As Stream = Console.OpenStandardOutput() session.Execute("xquery 1 to 10", stream) ' close session session.Close() ' print time needed Console.WriteLine(vbLf & watch.ElapsedMilliseconds & " ms.") Catch e As IOException ' print exception Console.WriteLine(e.Message) Console.ReadLine() End Try End Sub End Modulebasex-7.7.2/basex-api/src/main/vb/QueryBindExample.vb000066400000000000000000000024241222453003200223660ustar00rootroot00000000000000' This example shows how external variables can be bound to XQuery expressions. ' ' Documentation: http://docs.basex.org/wiki/Clients ' ' (C) BaseX Team 2005-12, BSD License Imports System Imports System.Diagnostics Imports System.IO Module QueryExample Sub Main() Try ' initialize timer Dim watch As New Stopwatch() watch.Start() ' create session Dim session As New Session("localhost", 1984, "admin", "admin") Try ' create query instance Dim input As String = "declare variable $name external; for $i in 1 to 10 return element { $name } { $i }" Dim query As Query = session.Query(input) ' bind variable query.Bind("$name", "number") ' loop through all results Console.WriteLine(query.Execute()) ' close query instance query.Close() Catch e As IOException ' print exception Console.WriteLine(e.Message) End Try ' close session session.Close() ' print time needed Console.WriteLine(vbLf & watch.ElapsedMilliseconds & " ms.") Console.ReadLine() Catch e As IOException ' print exception Console.WriteLine(e.Message) End Try End Sub End Module basex-7.7.2/basex-api/src/main/vb/QueryExample.vb000066400000000000000000000024551222453003200215750ustar00rootroot00000000000000' This example shows how queries can be executed in an iterative manner. ' Iterative evaluation will be slower, as more server requests are performed. ' ' Documentation: http://docs.basex.org/wiki/Clients ' ' (C) BaseX Team 2005-12, BSD License Imports System Imports System.Diagnostics Imports System.IO Module QueryExample Sub Main() Try ' initialize timer Dim watch As New Stopwatch() watch.Start() ' create session Dim session As New Session("localhost", 1984, "admin", "admin") Try ' create query instance Dim input As String = "for $i in 1 to 10 return Text { $i }" Dim query As Query = session.Query(input) ' loop through all results While query.More() Console.WriteLine(query.Nexty()) End While ' close query instance query.Close() Catch e As IOException ' print exception Console.WriteLine(e.Message) End Try ' close session session.Close() ' print time needed Console.WriteLine(vbLf & watch.ElapsedMilliseconds & " ms.") Console.ReadLine() Catch e As IOException ' print exception Console.WriteLine(e.Message) End Try End Sub End Module basex-7.7.2/basex-api/src/main/webapp/000077500000000000000000000000001222453003200174645ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/webapp/.gitignore000066400000000000000000000000061222453003200214500ustar00rootroot00000000000000.basexbasex-7.7.2/basex-api/src/main/webapp/WEB-INF/000077500000000000000000000000001222453003200205135ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/webapp/WEB-INF/data/000077500000000000000000000000001222453003200214245ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/webapp/WEB-INF/data/.empty000066400000000000000000000000001222453003200225510ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/webapp/WEB-INF/data/.gitignore000066400000000000000000000000101222453003200234030ustar00rootroot00000000000000/.logs basex-7.7.2/basex-api/src/main/webapp/WEB-INF/jetty.xml000066400000000000000000000031031222453003200223710ustar00rootroot00000000000000 60000 true 2 basex-7.7.2/basex-api/src/main/webapp/WEB-INF/repo/000077500000000000000000000000001222453003200214605ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/webapp/WEB-INF/repo/.empty000066400000000000000000000000001222453003200226050ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/webapp/WEB-INF/web.xml000066400000000000000000000076371222453003200220270ustar00rootroot00000000000000 BaseX: The XML Database and XQuery Processor HTTP Services org.basex.user admin org.basex.password admin org.basex.http.SessionListener RESTXQ org.basex.http.restxq.RestXqServlet 1 RESTXQ /* REST org.basex.http.rest.RESTServlet REST /rest/* WebDAV org.basex.http.webdav.WebDAVServlet WebDAV /webdav/* default useFileMappedBuffer false default /static/* basex-7.7.2/basex-api/src/main/webapp/restxq.xqm000066400000000000000000000061501222453003200215430ustar00rootroot00000000000000(:~ : This module contains some basic examples for RESTXQ annotations : @author BaseX Team :) module namespace page = 'http://basex.org/modules/web-page'; (:~ : This function generates the welcome page. : @return HTML page :) declare %rest:path("") %output:method("xhtml") %output:omit-xml-declaration("no") %output:doctype-public("-//W3C//DTD XHTML 1.0 Transitional//EN") %output:doctype-system("http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd") function page:start() as element(Q{http://www.w3.org/1999/xhtml}html) { BaseX HTTP Services

BaseX HTTP Services

Welcome to the BaseX HTTP Services, which allow you to...
  • Query and modify databases via REST (try here)
  • Browse and update resources via WebDAV
  • Create web applications and services with RESTXQ

This page was generated by RESTXQ. It facilitates the use of XQuery as a server-side processing language for the Web.

Example 1

The following links return different results. Both are generated by the same RESTXQ function:

Example 2

The next example presents how form data is processed via RESTXQ and the POST method:

Your message:

Example 3

The source code of the file that created this page ({ static-base-uri() }) is shown below:

{ unparsed-text(static-base-uri()) }
}; (:~ : This function returns an XML response message. : @param $world string to be included in the response : @return response element :) declare %rest:path("/hello/{$world}") %rest:GET function page:hello( $world as xs:string) as element(response) { Hello { $world }! }; (:~ : This function returns the result of a form request. : @param $message message to be included in the response : @param $agent user agent string : @return response element :) declare %rest:path("/form") %rest:POST %rest:form-param("message","{$message}", "(no message)") %rest:header-param("User-Agent", "{$agent}") function page:hello-postman( $message as xs:string, $agent as xs:string*) as element(response) { { $message } { $agent } }; basex-7.7.2/basex-api/src/main/webapp/static/000077500000000000000000000000001222453003200207535ustar00rootroot00000000000000basex-7.7.2/basex-api/src/main/webapp/static/basex.svg000066400000000000000000000202421222453003200225760ustar00rootroot00000000000000 image/svg+xml basex-7.7.2/basex-api/src/main/webapp/static/style.css000066400000000000000000000016601222453003200226300ustar00rootroot00000000000000body, td { font-family: "Trebuchet MS","Droid sans", sans-serif; overflow-y: scroll; margin: 1.2em; border: 0; } ul, dd { padding-left: 1.2em; margin-left: 0; } dl { margin: 0; } dt { margin: 0.6em 0 0.6em 0; font-weight: bold; } th { text-align: left; color: #CC3333; padding: 0 1.5em 0 0; } td { border-top: 1px solid #CCC; padding: 0.3em 1.5em 0 0; vertical-align: top; } code { font-family: "Consolas", "Ubuntu Mono", monospace; border: 1px solid #E3E3FF; border-radius: 3px; padding: 0 4px 0 4px; margin: 0 2px 0 2px; font-size: 90%; } pre { font-family: "Consolas", "Ubuntu Mono", monospace; font-size: 90%; } h2 { color: #C00000; margin: 0 0 0.4em 0; } h3 { color: #C00000; margin: 1em 0 0.5em 0; } hr { height: 1px; border: 0px; background-color: #222222; } a { color: #C00000; text-decoration: none; } p { margin: 0 0 0.6em 0; } .right { float: right; } basex-7.7.2/basex-api/src/test/000077500000000000000000000000001222453003200162415ustar00rootroot00000000000000basex-7.7.2/basex-api/src/test/java/000077500000000000000000000000001222453003200171625ustar00rootroot00000000000000basex-7.7.2/basex-api/src/test/java/StartGUI.java000066400000000000000000000010311222453003200214620ustar00rootroot00000000000000import org.basex.*; /** * This class contains a main method for starting the GUI from the API package. * This way, all API dependencies will be available in the visual frontend. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class StartGUI { /** Private constructor. */ private StartGUI() { } /** * Main method. * @param args command-line arguments * @throws Exception exception */ public static void main(final String... args) throws Exception { new BaseXGUI(args); } } basex-7.7.2/basex-api/src/test/java/org/000077500000000000000000000000001222453003200177515ustar00rootroot00000000000000basex-7.7.2/basex-api/src/test/java/org/basex/000077500000000000000000000000001222453003200210535ustar00rootroot00000000000000basex-7.7.2/basex-api/src/test/java/org/basex/test/000077500000000000000000000000001222453003200220325ustar00rootroot00000000000000basex-7.7.2/basex-api/src/test/java/org/basex/test/AdvancedQueryTest.java000066400000000000000000000027061222453003200262750ustar00rootroot00000000000000package org.basex.test; import static org.junit.Assert.*; import org.basex.io.out.*; import org.basex.io.serial.*; import org.basex.query.*; /** * This class contains some methods for performing advanced query tests. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public abstract class AdvancedQueryTest extends SandboxTest { /** * Runs the specified query and normalizes newlines. * @param query query string * @return result */ protected static String query(final String query) { final QueryProcessor qp = new QueryProcessor(query, context); qp.ctx.sc.baseURI("."); try { final ArrayOutput ao = new ArrayOutput(); final Serializer ser = qp.getSerializer(ao); qp.execute().serialize(ser); ser.close(); return ao.toString().replaceAll("(\\r|\\n)+ *", ""); } catch(final Exception ex) { final AssertionError err = new AssertionError("Query failed:\n" + query); err.initCause(ex); throw err; } finally { qp.close(); } } /** * Checks if a query yields the specified string. * @param query query string * @param result query result */ protected static void query(final String query, final Object result) { final String res = query(query); final String exp = result.toString(); if(!res.equals(exp)) fail("Wrong result:\n[Q] " + query + "\n[E] \u00bb" + result + "\u00ab\n[F] \u00bb" + res + '\u00ab'); } } basex-7.7.2/basex-api/src/test/java/org/basex/test/GeoTest.java000066400000000000000000001202761222453003200242570ustar00rootroot00000000000000package org.basex.test; import static org.basex.query.util.Err.*; import static org.junit.Assert.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.expath.ns.*; import org.junit.*; /** * This class tests the XQuery Geo functions prefixed with "geo". * * @author BaseX Team 2005-12, BSD License * @author Masoumeh Seydi */ public final class GeoTest extends AdvancedQueryTest { /** Test method. */ @Test public void dimension() { runQuery("geo:dimension(" + "1,2)", "0"); runError("geo:dimension(text {'a'})", FUNCMP.qname()); runError("geo:dimension()", GeoErrors.qname(1)); runError("geo:dimension(" + "1 2)", GeoErrors.qname(2)); } /** Test method. */ @Test public void geometryType() { runQuery("geo:geometryType(" + "1,1" + "1,2" + ")", "gml:MultiPoint"); runError("geo:geometryType(text {'srsName'})", FUNCMP.qname()); runError("geo:geometryType()", GeoErrors.qname(1)); runError("geo:geometryType(1 2" + ")", GeoErrors.qname(2)); } /** Test method. */ @Test public void srid() { runQuery("geo:srid(" + "" + "-150,50 -150,60 -125,60 -125,50 -150,50" + ")", "0"); runError("geo:srid(text {'a'})", FUNCMP.qname()); runError("geo:srid()", GeoErrors.qname(1)); runError("geo:srid(1,1 20,1 50,30 1,1" + ")", GeoErrors.qname(2)); } /** Test method. */ @Test public void envelope() { runQuery("geo:envelope(1,1 20,1 50,30 1,1" + ")", "" + "" + "1.0,1.0 1.0,30.0 50.0,30.0 50.0,1.0 1.0,1.0" + ""); runError("geo:envelope(text {'a'})", FUNCMP.qname()); runError("geo:envelope()", GeoErrors.qname(1)); runError("geo:envelope(1,1 20,1 50,30 1,1" + ")", GeoErrors.qname(2)); } /** Test method. */ @Test public void asText() { runQuery("geo:asText(1,1 55,99 2,1" + ")", "LINESTRING (1 1, 55 99, 2 1)"); runError("geo:asText(text {'a'})", FUNCMP.qname()); runError("geo:asText()", GeoErrors.qname(1)); runError("geo:asText(1,1" + ")", GeoErrors.qname(2)); } /** Test method. */ @Test public void asBinary() { runQuery("geo:asBinary(1,1 55,99 2,1" + ")", "AAAAAAIAAAADP/AAAAAAAAA/8AAAAAAAAEBLgAAAAAAAQFjAAAAAAABAAAAAAAAAAD/wAAAAAAAA"); runError("geo:asBinary(text {'a'})", FUNCMP.qname()); runError("geo:asBinary()", GeoErrors.qname(1)); runError("geo:asBinary(1,1 55,99 2,1" + ")", GeoErrors.qname(2)); } /** Test method. */ @Test public void isSimple() { runQuery("geo:isSimple(1,1 20,1 10,4 20,-10" + ")", "false"); runError("geo:isSimple(text {'a'})", FUNCMP.qname()); runError("geo:isSimple()", GeoErrors.qname(1)); runError("geo:isSimple(1,1 55,99 2,1" + ")", GeoErrors.qname(2)); } /** Test method. */ @Test public void boundary() { runQuery("geo:boundary(" + "11,11 18,11 18,18 11,18 11,11" + ")", "" + "11.0,11.0 18.0,11.0 18.0,18.0 11.0,18.0 " + "11.0,11.0"); runQuery("geo:boundary(" + "2,3)", ""); runError("geo:boundary(text {'a'})", FUNCMP.qname()); runError("geo:boundary(a)", NOCTX.qname()); runError("geo:boundary()", GeoErrors.qname(1)); runError("geo:boundary(1 2)", GeoErrors.qname(2)); } /** Test method. */ @Test public void equals() { runQuery("geo:equals(1,1 2,1 5,3 1,1" + ", " + "" + "1,1 2,1 5,3 1,1" + ")", "false"); runError("geo:equals(text {'a'}, a)", NOCTX.qname()); runError("geo:equals(, " + "1,1 2,1 5,3 1,1)", GeoErrors.qname(1)); runError("geo:equals(1,1 55,99 2,1" + "," + "1,1 55,99 2,1" + ")", GeoErrors.qname(2)); } /** Test method. */ @Test public void disjoint() { runQuery("geo:disjoint(" + "1,1 0,0 2,1" + "2,1 3,3 4,4" + ", " + "0,0 2,1 3,3" + ")", "false"); runError("geo:disjoint(a, text {'a'})", NOCTX.qname()); runError("geo:disjoint(, " + "1,1 2,1 5,3 1,1" + ")", GeoErrors.qname(1)); runError("geo:disjoint(" + ")", FUNCARGSG.qname()); } /** Test method. */ @Test public void intersects() { runQuery("geo:intersects(" + "1,1 0,0 2,1" + "2,1 3,3 4,4" + ", 0,0 2,1 3,3" + ")", "true"); runError("geo:intersects(a, text {'a'})", NOCTX.qname()); runError("geo:intersects(10,10 12,11" + ", 1,1 2,1 5,3 1,1" + ")", GeoErrors.qname(2)); runError("geo:intersects(1,1" + ", 0,0 2,1 3,3" + ")", GeoErrors.qname(1)); } /** Test method. */ @Test public void touches() { runQuery("geo:touches(" + "1,1 0,0 2,1" + "2,1 3,3 4,4" + ", 0,0 2,1 3,3" + ")", "false"); runError("geo:touches(a, text {'a'})", NOCTX.qname()); runError("geo:touches(10,10 12,11" + ", 1,1 2,1 5,3 1,1" + ")", GeoErrors.qname(2)); runError("geo:touches(1,1" + ", 0,0 2,1 3,3" + ")", GeoErrors.qname(1)); } /** Test method. */ @Test public void crosses() { runQuery("geo:crosses(" + "10,11, " + "0,0 2,2)", "false"); runError("geo:crosses(a, text {'a'})", NOCTX.qname()); runError("geo:crosses(10,10 12,11" + ", " + "1,1 2,1 5,3 1,1" + ")", GeoErrors.qname(2)); runError("geo:crosses(1,1)", FUNCARGSG.qname()); } /** Test method. */ @Test public void within() { runQuery("geo:within(1,1 2,1 5,3 1,1" + ", " + "1,1 20,1 50,30 1,1" + ")", "false"); runError("geo:within()", FUNCARGSG.qname()); runError("geo:within(" + "1,1, " + "1,1 2,1 5,3 1,1" + ")", GeoErrors.qname(1)); runError("geo:within(1,1)", FUNCARGSG.qname()); } /** Test method. */ @Test public void contains() { runQuery("geo:contains(" + "1,1, " + "1.00,1.00)", "true"); runError("geo:contains()", FUNCARGSG.qname()); runError("geo:contains(" + "1,1, " + "1,1 2,1 5,3 1,1)", GeoErrors.qname(1)); runError("geo:contains(" + "1,1)", FUNCARGSG.qname()); } /** Test method. */ @Test public void overlaps() { runQuery("geo:overlaps(" + "1,1 55,99 2,1" + ", 1,1 55,0" + ")", "false"); runError("geo:overlaps()", FUNCARGSG.qname()); runError("geo:overlaps(1,1 55,99 2,1" + "," + ")", GeoErrors.qname(2)); runError("geo:overlaps(" + "1,1)", FUNCARGSG.qname()); } /** Test method. */ @Test public void relate() { runQuery("geo:relate(" + "18,11, " + "" + "10,10 20,10 30,40 20,40 10,10" + ", \"0********\")", "true"); runError("geo:relate(18,11," + "11,10 20,1 20,20" + ", \"0******\")", FUNCMP.qname()); runError("geo:relate(" + "18,11," + "11,10 20,1 20,20" + ", \"0*******12*F\")", FUNCMP.qname()); runError("geo:relate()", FUNCARGSG.qname()); runError("geo:relate(" + "1,1 55,99 2,1," + ", \"0********\")", GeoErrors.qname(1)); runError("geo:relate(" + "1,1," + " \"0********\")", FUNCARGSG.qname()); } /** Test method. */ @Test public void distance() { runQuery("geo:distance(10,400 20,200 30,100 " + "20,100 10,400, " + "" + "10,10 20,10 30,40 20,40 10,10" + ")", "60"); runError("geo:distance()", FUNCARGSG.qname()); runError("geo:distance(" + "1,1 55,99 2,1" + ", )", GeoErrors.qname(2)); runError("geo:distance(" + "1,1)", FUNCARGSG.qname()); } /** Test method. */ @Test public void buffer() { runQuery("geo:buffer(" + "10,10 20,10 30,40 20,40 10,10" + ",xs:double(0))", "" + "" + "10.0,10.0 20.0,40.0 30.0,40.0 20.0,10.0 10.0,10.0" + ""); runQuery("geo:buffer(1,1 5,9 2,1" + ", xs:double(0))", "" + "" + ""); runError("geo:buffer(" + "1,1 55,99 2,1" + ", xs:double(1))", GeoErrors.qname(2)); runError("geo:buffer(1,1 55,99 1,1" + ", 1)", FUNCMP.qname()); runError("geo:buffer(xs:double(1))", FUNCARGSG.qname()); } /** Test method. */ @Test public void convexHull() { runQuery("geo:convexHull(1,1 55,99 2,2 1,1" + ")", "" + "" + "1.0,1.0 55.0,99.0 2.0,2.0 1.0,1.0" + ""); runError("geo:convexHull(1,1 55,99 1,1" + ")", GeoErrors.qname(2)); runError("geo:convexHull()", FUNCARGSG.qname()); runError("geo:convexHull()", GeoErrors.qname(2)); } /** Test method. */ @Test public void intersection() { runQuery("geo:intersection(1,1 55,99 2,3 1,1" + "," + "" + "10,10 20,10 30,40 10,10" + ")", "" + ""); runQuery("geo:intersection(1,1 55,99 2,3 1,1" + "," + "2,3)", "" + "2.0,3.0"); runError("geo:intersection(" + ")", FUNCARGSG.qname()); runError("geo:intersection(2,3" + ",2,3)", GeoErrors.qname(1)); runError("geo:intersection(, )", GeoErrors.qname(2)); } /** Test method. */ @Test public void union() { runQuery("geo:union(2," + "2,3)", "" + "2.0,0.0" + "" + "2.0,3.0" + ""); runQuery("geo:union(2," + "3)", "" + "" + "2.0,0.0" + "3.0,0.0" + ""); runError("geo:union(," + "2,3)", GeoErrors.qname(2)); runError("geo:union(text {'a'}, 2,3" + ")", FUNCMP.qname()); } /** Test method. */ @Test public void difference() { runQuery("geo:difference(" + "20,1," + "0,0 20,20 20,30 0,20 0,0" + ")", "" + "20.0,1.0"); runError("geo:difference(" + "," + "2,3)", GeoErrors.qname(2)); runError("geo:difference(text {'a'}, 2,3" + ")", FUNCMP.qname()); } /** Test method. */ @Test public void symDifference() { runQuery("geo:symDifference(" + "20,1," + "0,0 20,20 20,30 0,20 0,0" + ")", "" + "" + "20.0,1.0" + "0.0,0.0 20.0,20.0" + " 20.0,30.0 0.0,20.0 0.0,0.0" + ""); runError("geo:symDifference(" + "1,1," + "2,3)", GeoErrors.qname(1)); runError("geo:symDifference(text {'a'}, 2,3" + ")", FUNCMP.qname()); } /** Test method. */ @Test public void geometryN() { runQuery("geo:geometryN(" + "2,1, 1)", "" + "2.0,1.0"); runError("geo:geometryN(" + "1,1,1)", GeoErrors.qname(1)); runError("geo:geometryN(" + "2,1, 0)", GeoErrors.qname(4)); runError("geo:geometryN(" + "2,1, 2)", GeoErrors.qname(4)); runError("geo:geometryN(text {'a'}, 2,3" + ")", FUNCMP.qname()); } /** Test method. */ @Test public void x() { runQuery("geo:x(2,1)", "2"); runError("geo:x(1,1" + "1,2" + ")", GeoErrors.qname(3)); runError("geo:x(" + "0,0 20,0 0,20 0,0" + ")", GeoErrors.qname(3)); runError("geo:x()", GeoErrors.qname(2)); runError("geo:x(2,1)", GeoErrors.qname(1)); runError("geo:x(text {'a'})", FUNCMP.qname()); } /** Test method. */ @Test public void y() { runQuery("geo:y(2,1)", "1"); runQuery("geo:y(2)", "0"); runError("geo:y(1,1" + "1,2" + ")", GeoErrors.qname(3)); runError("geo:y(" + "0,0 20,0 0,20 0,0" + ")", GeoErrors.qname(3)); runError("geo:y()", GeoErrors.qname(2)); runError("geo:y(2,1)", GeoErrors.qname(1)); runError("geo:y(a)", NOCTX.qname()); } /** Test method. */ @Test public void z() { runQuery("geo:z(2,1,3)", "3"); runQuery("geo:z(2)", "NaN"); runError("geo:z(1,1" + "1,2" + ")", GeoErrors.qname(3)); runError("geo:z(" + "0,0 20,0 0,20 0,0" + ")", GeoErrors.qname(3)); runError("geo:z()", GeoErrors.qname(2)); runError("geo:z(2,1)", GeoErrors.qname(1)); runError("geo:z(a)", NOCTX.qname()); } /** Test method. */ @Test public void length() { runQuery("geo:length(" + "2,1,3)", "0"); runQuery("geo:length(" + "1,1 2,1 5,3 1,1" + ")", "9.07768723046357"); runQuery("geo:length(1,1" + "1,2" + ")", "0"); runError("geo:length(0,0 0,20 0,0" + ")", GeoErrors.qname(2)); runError("geo:length()", GeoErrors.qname(2)); runError("geo:length(2,1)", GeoErrors.qname(1)); } /** Test method. */ @Test public void startPoint() { runQuery("geo:startPoint(1,1 20,1 20,20 1,1" + ")", "" + "1.0,1.0"); runQuery("geo:startPoint(1,1 20,1 20,20 1,1" + ")", "" + "1.0,1.0"); runError("geo:startPoint(" + "1,1 0,0 2,1" + "2,1 3,3 4,4" + ")", GeoErrors.qname(3)); runError("geo:startPoint(" + "1,1)", GeoErrors.qname(2)); runError("geo:startPoint()", FUNCARGSG.qname()); runError("geo:startPoint(text {'gml:Point'})", FUNCMP.qname()); runError("geo:startPoint(2,1)", GeoErrors.qname(1)); } /** Test method. */ @Test public void endPoint() { runQuery("geo:endPoint(2,3 20,1 20,20 2,3" + ")", "" + "2.0,3.0"); runQuery("geo:endPoint(11,10 20,1 20,20 12,13" + ")", "" + "12.0,13.0"); runError("geo:endPoint(" + "1,1 0,0 2,1" + "2,1 3,3 4,4" + ")", GeoErrors.qname(3)); runError("geo:endPoint(" + "1,1)", GeoErrors.qname(2)); runError("geo:endPoint()", FUNCARGSG.qname()); runError("geo:endPoint(text {'gml:Point'})", FUNCMP.qname()); runError("geo:endPoint(2,1)", GeoErrors.qname(1)); } /** Test method. */ @Test public void isClosed() { runQuery("geo:isClosed(2,3 20,1 20,20 2,3" + ")", "true"); runQuery("geo:isClosed(" + "1,1 0,0 2,1" + "2,1 3,3 4,4" + ")", "false"); runQuery("geo:isClosed(11,10 20,1 20,20 12,13" + ")", "false"); runError("geo:isClosed(" + "1,1 2,1 5,3 1,1" + ")", GeoErrors.qname(3)); runError("geo:isClosed(" + "1,1)", GeoErrors.qname(2)); runError("geo:isClosed()", FUNCARGSG.qname()); runError("geo:isClosed(text {'gml:Point'})", FUNCMP.qname()); runError("geo:isClosed(" + "2,1)", GeoErrors.qname(3)); } /** Test method. */ @Test public void isRing() { runQuery("geo:isRing(2,3 20,1 20,20 2,3" + ")", "true"); runQuery("geo:isRing(11,10 20,1 20,20 12,13" + ")", "false"); runError("geo:isRing(" + "1,1 0,0 2,1" + "2,1 3,3 4,4" + ")", GeoErrors.qname(3)); runError("geo:isClosed(" + "2,3)", GeoErrors.qname(3)); runError("geo:isRing(" + "1,1)", GeoErrors.qname(2)); runError("geo:isRing()", FUNCARGSG.qname()); runError("geo:isRing(text {'gml:Point'})", FUNCMP.qname()); runError("geo:isRing(2,1)", GeoErrors.qname(1)); } /** Test method. */ @Test public void numPoints() { runQuery("geo:numPoints(2,3 20,1 20,20 2,3" + ")", "4"); runQuery("geo:numPoints(11,10 20,1 20,20 12,13" + ")", "4"); runQuery("geo:numPoints(" + "1,1 0,0 2,1" + "2,1 3,3 4,4" + ")", "6"); runError("geo:numPoints(1,1" + ")", GeoErrors.qname(2)); runError("geo:numPoints()", FUNCARGSG.qname()); runError("geo:numPoints(text {'gml:Point'})", FUNCMP.qname()); runError("geo:numPoints(2,1)", GeoErrors.qname(1)); } /** Test method. */ @Test public void pointN() { runQuery("geo:pointN(2,3 20,1 20,20 2,3" + ", 1)", "" + "2.0,3.0"); runQuery("geo:pointN(11,10 20,1 20,20 12,13" + ", 4)", "" + "12.0,13.0"); runError("geo:pointN(" + "1,1 0,0 2,1" + "2,1 3,3 4,4" + ", 4)", GeoErrors.qname(3)); runError("geo:pointN(" + "1,1,1)", GeoErrors.qname(1)); runError("geo:pointN(11,10 20,1 20,20 12,13" + ", 5)", GeoErrors.qname(4)); runError("geo:pointN(11,10 20,1 20,20 12,13" + ", 0)", GeoErrors.qname(4)); runError("geo:pointN(text {'a'},3)", FUNCMP.qname()); } /** Test method. */ @Test public void area() { runQuery("geo:area(1,1" + "1,2" + ")", "0"); runQuery("geo:area(" + "11,11 18,11 18,18 11,18 11,11" + ")", "49"); runQuery("geo:area(" + "11,10 20,1 20,20)", "0"); runError("geo:area(0,0 0,20 0,0" + ")", GeoErrors.qname(2)); runError("geo:area()", FUNCARGSG.qname()); runError("geo:area(2,1)", GeoErrors.qname(1)); } /** Test method. */ @Test public void centroid() { runQuery("geo:centroid(" + "11,11 18,11 18,18 11,18 11,11" + ")", "" + "14.5,14.5"); runQuery("geo:centroid(" + "2.0,3.0)", "" + "2.0,3.0"); runQuery("geo:centroid(" + "1,1 0,0 2,1" + "2,1 3,3 4,4" + ")", "" + "1.8468564716806986,1.540569415042095" + ""); runError("geo:centroid(" + "1,1)", GeoErrors.qname(1)); runError("geo:centroid()", FUNCARGSG.qname()); runError("geo:centroid(text {'a'})", FUNCMP.qname()); } /** Test method. */ @Test public void pointOnSurface() { runQuery("geo:pointOnSurface(" + "11,11 18,11 18,18 11,18 11,11" + ")", "" + "14.5,14.5"); runQuery("geo:pointOnSurface(" + "2.0,3.0)", "" + "2.0,3.0"); runQuery("geo:pointOnSurface(" + "1,1 0,0 2,1" + "2,1 3,3 4,4" + ")", "" + "3.0,3.0"); runError("geo:pointOnSurface(" + "1,1)", GeoErrors.qname(1)); runError("geo:pointOnSurface()", FUNCARGSG.qname()); runError("geo:pointOnSurface(text {'a'})", FUNCMP.qname()); } /** Test method. */ @Test public void exteriorRing() { runQuery("geo:exteriorRing(" + "11,11 18,11 18,18 11,18 11,11" + ")", "" + "11.0,11.0 18.0,11.0 18.0,18.0 11.0,18.0 11.0,11.0" + ""); runError("geo:exteriorRing(" + "2.0,3.0)", GeoErrors.qname(3)); runError("geo:exteriorRing(" + "1,1)", GeoErrors.qname(1)); runError("geo:exteriorRing()", FUNCARGSG.qname()); runError("geo:exteriorRing(text {'a'})", FUNCMP.qname()); } /** Test method. */ @Test public void numInteriorRing() { runQuery("geo:numInteriorRing(" + "" + "11,11 18,11 18,18 11,18 11,11" + ")", "0"); runError("geo:numInteriorRing(" + "2.0,3.0)", GeoErrors.qname(3)); runError("geo:numInteriorRing(" + "1,1)", GeoErrors.qname(1)); runError("geo:numInteriorRing()", FUNCARGSG.qname()); runError("geo:numInteriorRing(text {'a'})", FUNCMP.qname()); } /** Test method. */ @Test public void interiorRingN() { runQuery("geo:interiorRingN(" + "11,11 18,11 18,18 11,18 11,11" + "" + "2,2 3,2 3,3 2,3 2,2" + "" + "" + "10,10 20,10 20,20 10,20 10,10" + ", 1)", "" + "2.0,2.0 3.0,2.0 3.0,3.0 2.0,3.0 2.0,2.0" + ""); runError("geo:interiorRingN(" + "11,11 18,11 18,18 11,18 11,11" + ", 1)", GeoErrors.qname(4)); runError("geo:interiorRingN(" + "11,11 18,11 18,18 11,18 11,11" + ", 0)", GeoErrors.qname(4)); runError("geo:interiorRingN(" + "2.0,3.0, 1)", GeoErrors.qname(3)); runError("geo:interiorRingN(text {' c = Class.forName(DRIVER); db = (Database) c.newInstance(); coll = db.getCollection(PATH, LOGIN, PW); serv = (CollectionManagementService) coll.getService(CMS, "1.0"); } @After public void tearDown() throws Exception { coll.close(); dropDB(); } @Test public void testCreateCollection() throws Exception { // create a collection final Collection coll1 = serv.createCollection(TEMP); assertNotSame(coll, coll1); // add a document final Resource res1 = coll.createResource(TEST, XMLResource.RESOURCE_TYPE); res1.setContent(""); coll1.storeResource(res1); coll1.close(); } @Test public void testRemoveCollection() throws Exception { serv.removeCollection(TEMP); assertNull("Collection was not removed.", db.getCollection(URL + TEMP, null, null)); } @Test public void testGetName() throws Exception { assertEquals(CMS, serv.getName()); } @Test public void testGetVersion() throws Exception { assertEquals("1.0", serv.getVersion()); } @Test public void testSetCollection() { // nothing serious to test... } } basex-7.7.2/basex-api/src/test/java/org/basex/test/api/xmldb/CollectionTest.java000066400000000000000000000253311222453003200275130ustar00rootroot00000000000000package org.basex.test.api.xmldb; import static org.junit.Assert.*; import java.io.*; import javax.xml.parsers.*; import org.junit.*; import org.w3c.dom.*; import org.xml.sax.*; import org.xml.sax.helpers.*; import org.xmldb.api.base.*; import org.xmldb.api.modules.*; /** * This class tests the XMLDB/API Collection implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ @SuppressWarnings("all") public class CollectionTest extends XMLDBBaseTest { /** Collection. */ Collection coll; @Before public void setUp() throws Exception { createDB(); final Class c = Class.forName(DRIVER); final Database database = (Database) c.newInstance(); coll = database.getCollection(PATH, LOGIN, PW); } @After public void tearDown() throws Exception { coll.close(); dropDB(); } @Test public void testGetName() throws Exception { assertEquals(COLL, coll.getName()); } @Test public void testGetServices() throws Exception { // get all services final Code code = new Code() { Object run() throws XMLDBException { return coll.getServices(); } }; // find XPath implementation boolean xpath = false; for(final Service s : (Service[]) code.run()) { xpath |= s instanceof XPathQueryService; } assertTrue("XPath Implementation expected.", xpath); checkClosed(code); } @Test public void testGetService() throws Exception { // assume existence of XPath service assertNotNull("XPath Implementation expected.", coll.getService("XPathQueryService", "1.0")); // assume null reference for unknown version assertNull("Unknown version.", coll.getService("XPathQueryService", "3.8")); // get unknown service final Code code = new Code() { Object run() throws XMLDBException { return coll.getService("Unknown", "0.0"); } }; assertNull("No 'Unknown' service expected.", code.run()); checkClosed(code); } @Test public void testGetParentCollection() throws Exception { // assume there's no parent collection final Code code = new Code() { Object run() throws XMLDBException { return coll.getParentCollection(); } }; assertNull("No parent collection expected.", code.run()); checkClosed(code); } @Test public void testGetChildCollectionCount() throws Exception { // assume there's no child collection final Code code = new Code() { Object run() throws XMLDBException { return coll.getChildCollectionCount(); } }; assertEquals("No child collection expected.", 0, code.num()); checkClosed(code); } @Test public void testListChildCollections() throws Exception { // assume there's no child collection final Code code = new Code() { Object run() throws XMLDBException { return coll.listChildCollections(); } }; assertEquals("No child collection expected.", 0, code.strings().length); checkClosed(code); } @Test public void testGetChildCollection() throws Exception { // assume there's no child collection final Code code = new Code() { Object run() throws XMLDBException { return coll.getChildCollection("X"); } }; assertNull("No child collection expected.", code.run()); checkClosed(code); } @Test public void testGetResourceCount() throws Exception { // tests could be added for here multiple documents final Code code = new Code() { Object run() throws XMLDBException { return coll.getResourceCount(); } }; assertEquals("One document expected.", 1, code.num()); checkClosed(code); } @Test public void testListResources() throws Exception { final Code code = new Code() { Object run() throws XMLDBException { return coll.listResources(); } }; final String[] res = code.strings(); assertEquals("One document expected.", 1, res.length); assertEquals("Wrong document name.", DOC1, res[0]); checkClosed(code); } @Test public void testCreateResource() throws Exception { // test unknown resource type try { coll.createResource("hans", "UnknownResource"); fail("Resource Type is expected to be unknown."); } catch(final XMLDBException ex) { } // test xml resource and ID creation Resource res = coll.createResource(null, XMLResource.RESOURCE_TYPE); assertTrue("XMLResource expected.", res instanceof XMLResource); assertNotNull("No ID was created.", res.getId()); // test adoption of specified id final String id = DOC2; res = coll.createResource(id, XMLResource.RESOURCE_TYPE); assertEquals("Resource has wrong ID.", id, res.getId()); // tests could be added for here multiple documents final Code code = new Code() { Object run() throws XMLDBException { return coll.createResource(null, BinaryResource.RESOURCE_TYPE); } }; // allow vendor error for binary resources try { code.run(); } catch(final XMLDBException ex) { checkCode(ErrorCodes.VENDOR_ERROR, ex); } checkClosed(code); } @Test public void testStoreResource() throws Exception { Resource res = coll.createResource("NoContent", XMLResource.RESOURCE_TYPE); // try to store resource with missing content try { coll.storeResource(res); fail("Resource has no contents."); } catch(final XMLDBException ex) { checkCode(ErrorCodes.INVALID_RESOURCE, ex); } // try to store erroneous content res = coll.createResource("Faulty", XMLResource.RESOURCE_TYPE); res.setContent(""); coll.storeResource(res); // store DOM instance final XMLResource xml1 = (XMLResource) coll.createResource( DOC2, XMLResource.RESOURCE_TYPE); final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); final DocumentBuilder builder = factory.newDocumentBuilder(); final Node node = builder.parse(new File(DOCPATH + DOC2)); xml1.setContentAsDOM(node); coll.storeResource(xml1); // store SAX stream final XMLResource xml2 = (XMLResource) coll.createResource( DOC3, XMLResource.RESOURCE_TYPE); final XMLReader reader = XMLReaderFactory.createXMLReader(); reader.setContentHandler(xml2.setContentAsSAX()); reader.parse(new InputSource(DOCPATH + DOC3)); coll.storeResource(xml2); // check number of documents assertEquals("Wrong number of documents.", 4, coll.getResourceCount()); // update document with known id res = coll.createResource("Correct", XMLResource.RESOURCE_TYPE); res.setContent(""); coll.storeResource(res); // check number of documents assertEquals("Wrong number of documents.", 4, coll.getResourceCount()); checkClosed(new Code() { Object run() throws XMLDBException { return coll.createResource("id", null); } }); } @Test public void testRemoveResource() throws Exception { final Resource res = coll.createResource("Correct", XMLResource.RESOURCE_TYPE); res.setContent(""); coll.storeResource(res); coll.removeResource(coll.getResource("Correct")); // check number of documents assertEquals("Wrong number of documents.", 1, coll.getResourceCount()); try { coll.removeResource(coll.getResource("test")); fail("Document does not exist."); } catch(final XMLDBException ex) { checkCode(ErrorCodes.NO_SUCH_RESOURCE, ex); } try { coll.removeResource(coll.getResource(null)); fail("Document does not exist."); } catch(final XMLDBException ex) { checkCode(ErrorCodes.NO_SUCH_RESOURCE, ex); } checkClosed(new Code() { Object run() throws XMLDBException { coll.removeResource(null); return null; } }); } @Test public void testCreateId() throws Exception { final Code code = new Code() { Object run() throws XMLDBException { return coll.createId(); } }; // check some ids for their uniqueness for(int i = 0; i < 10; ++i) { if(coll.getResource(code.run().toString()) != null) { fail("Returned ID not unique."); } } checkClosed(code); } @Test public void testIsOpen() throws Exception { assertTrue(coll.isOpen()); coll.close(); assertFalse(coll.isOpen()); } @Test public void testClose() throws Exception { coll.close(); coll.close(); assertFalse(coll.isOpen()); } @Test public void testGetProperty() throws Exception { assertNull(coll.getProperty("ProbablyUnknown")); // the following tests are database specific... assertEquals(COLL, coll.getProperty("name")); assertEquals("true", coll.getProperty("chop")); } @Test public void testSetProperty() throws Exception { try { coll.setProperty("ProbablyUnknown", "on"); fail("Invalid key was assigned."); } catch(final XMLDBException ex) { checkCode(ErrorCodes.VENDOR_ERROR, ex); } // the following tests are database specific... coll.setProperty("name", "NewName"); coll.setProperty("name", COLL); try { coll.setProperty("time", "ABC"); fail("Invalid value was assigned."); } catch(final XMLDBException ex) { checkCode(ErrorCodes.VENDOR_ERROR, ex); } } /** * Compares the expected error code with the specified exception. * @param exp expected error code * @param ex exception */ private static void checkCode(final int exp, final XMLDBException ex) { assertEquals("Wrong error code.", exp, ex.errorCode); } /** * Runs the specified code in a closed collection state. * @param code code to be executed */ private void checkClosed(final Code code) { try { coll.close(); code.run(); fail("Database was closed."); } catch(final XMLDBException ex) { checkCode(ErrorCodes.COLLECTION_CLOSED, ex); } } /** * Abstract class for defining arbitrary methods. */ abstract static class Code { /** * Method to be executed. * @return result * @throws XMLDBException exception */ abstract Object run() throws XMLDBException; /** * Returns the result of the method as integer. * @return integer result * @throws XMLDBException exception */ int num() throws XMLDBException { return (Integer) run(); } /** * Returns the result of the method as string array. * @return string array * @throws XMLDBException exception */ String[] strings() throws XMLDBException { return (String[]) run(); } } } basex-7.7.2/basex-api/src/test/java/org/basex/test/api/xmldb/DatabaseTest.java000066400000000000000000000053421222453003200271240ustar00rootroot00000000000000package org.basex.test.api.xmldb; import static org.junit.Assert.*; import org.junit.*; import org.xmldb.api.*; import org.xmldb.api.base.*; /** * This class tests the XMLDB/API Database implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ @SuppressWarnings("all") public class DatabaseTest extends XMLDBBaseTest { /** Database. */ private Database database; @Before public void setUp() throws Exception { createDB(); database = (Database) Class.forName(DRIVER).newInstance(); } @After public void tearDown() throws Exception { dropDB(); } @Test public void testAcceptsURI() throws Exception { database.acceptsURI(PATH); try { database.acceptsURI("bla"); fail("URI was invalid."); } catch(final XMLDBException ex) { checkCode(ErrorCodes.INVALID_URI, ex); } } @Test public void testGetCollection() throws Exception { // directly call and close database instance database.getCollection(PATH, LOGIN, PW).close(); try { database.getCollection("bla", LOGIN, PW); fail("URI was invalid."); } catch(final XMLDBException ex) { checkCode(ErrorCodes.INVALID_URI, ex); } // get database from database manager DatabaseManager.registerDatabase(database); final Collection coll = DatabaseManager.getCollection(PATH, LOGIN, PW); coll.close(); } @Test public void testGetConformanceLevel() throws Exception { assertEquals(database.getConformanceLevel(), "0"); } @Test public void testGetName() throws Exception { assertNotNull(database.getName()); } @Test public void testGetProperty() throws Exception { assertNull(database.getProperty("ProbablyUnknown")); // the following tests are database specific... assertEquals("false", database.getProperty("queryinfo")); assertEquals("1", database.getProperty("runs")); } @Test public void testSetProperty() throws Exception { try { database.setProperty("ProbablyUnknown", "on"); fail("Invalid key was assigned."); } catch(final XMLDBException ex) { checkCode(ErrorCodes.VENDOR_ERROR, ex); } // the following tests are database specific... database.setProperty("queryinfo", "on"); database.setProperty("queryinfo", "off"); try { database.setProperty("runs", "ABC"); fail("Invalid value was assigned."); } catch(final XMLDBException ex) { checkCode(ErrorCodes.VENDOR_ERROR, ex); } } /** * Compares the expected error code with the specified exception. * @param exp expected error code * @param ex exception */ static void checkCode(final int exp, final XMLDBException ex) { assertEquals("Wrong error code.", exp, ex.errorCode); } } basex-7.7.2/basex-api/src/test/java/org/basex/test/api/xmldb/ResourceIteratorTest.java000066400000000000000000000034751222453003200307260ustar00rootroot00000000000000package org.basex.test.api.xmldb; import static org.junit.Assert.*; import org.junit.*; import org.xmldb.api.base.*; import org.xmldb.api.modules.*; /** * This class tests the XMLDB/API ResourceIterator implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ @SuppressWarnings("all") public class ResourceIteratorTest extends XMLDBBaseTest { /** Collection. */ private Collection coll; /** Resource. */ private XPathQueryService serv; @Before public void setUp() throws Exception { createDB(); final Class c = Class.forName(DRIVER); final Database database = (Database) c.newInstance(); coll = database.getCollection(PATH, LOGIN, PW); serv = (XPathQueryService) coll.getService("XPathQueryService", "1.0"); } @After public void tearDown() throws Exception { coll.close(); dropDB(); } @Test public void testHasMoreResources() throws Exception { // test result ResourceIterator iter = serv.query("/").getIterator(); assertTrue("Result expected.", iter.hasMoreResources()); // test empty result iter = serv.query("//Unknown").getIterator(); assertFalse("Result expected.", iter.hasMoreResources()); } @Test public void testNextResource() throws Exception { // count down number of results final ResourceSet set = serv.query("//node()"); final ResourceIterator iter = set.getIterator(); long size = set.getSize(); while(iter.hasMoreResources()) { iter.nextResource(); --size; } assertEquals("Wrong result size.", 0, size); // test if iterator delivers more results try { iter.nextResource(); fail("No resources left."); } catch(final XMLDBException ex) { assertEquals("Wrong error code.", ErrorCodes.NO_SUCH_RESOURCE, ex.errorCode); } } } basex-7.7.2/basex-api/src/test/java/org/basex/test/api/xmldb/ResourceSetTest.java000066400000000000000000000060341222453003200276620ustar00rootroot00000000000000package org.basex.test.api.xmldb; import static org.junit.Assert.*; import org.junit.*; import org.xmldb.api.base.*; import org.xmldb.api.modules.*; /** * This class tests the XMLDB/API ResourceSet implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ @SuppressWarnings("all") public class ResourceSetTest extends XMLDBBaseTest { /** Collection. */ private Collection coll; /** Resource. */ private XPathQueryService serv; @Before public void setUp() throws Exception { createDB(); final Class c = Class.forName(DRIVER); final Database database = (Database) c.newInstance(); coll = database.getCollection(PATH, LOGIN, PW); serv = (XPathQueryService) coll.getService("XPathQueryService", "1.0"); } @After public void tearDown() throws Exception { coll.close(); dropDB(); } @Test public void testGetResource() throws Exception { // request resource final ResourceSet set = serv.query("//node()"); assertNotNull(set.getResource(0)); // specify invalid position try { set.getResource(-1); fail("Invalid index access."); } catch(final XMLDBException ex) { assertEquals("Wrong error code.", ErrorCodes.NO_SUCH_RESOURCE, ex.errorCode); } } @Test public void testAddResource() throws Exception { // perform two queries final ResourceSet set1 = serv.query("1"); final ResourceSet set2 = serv.query("2"); // add second to first result set final long size = set1.getSize(); set1.addResource(set2.getResource(0)); assertEquals("Wrong size of result set.", size + 1, set1.getSize()); } @Test public void testRemoveResource() throws Exception { // perform query and remove result final ResourceSet set = serv.query("1"); set.removeResource(0); assertEquals("Wrong size of result set.", 0, set.getSize()); } @Test public void testGetIterator() throws Exception { // test if iterator yields results final ResourceSet set = serv.query("1"); set.removeResource(0); final ResourceIterator iter = set.getIterator(); assertFalse("No results expected.", iter.hasMoreResources()); } @Test public void testGetMembersAsResource() throws Exception { // test created resource final ResourceSet set = serv.query("1"); final Resource res = set.getMembersAsResource(); assertNull("No ID expected.", res.getId()); assertEquals("Wrong result.", "1", res.getContent()); assertSame("Wrong collection reference.", res.getParentCollection(), coll); } @Test public void testGetSize() throws Exception { // test created resource final ResourceSet set = serv.query("1"); assertEquals("Wrong result size.", 1, set.getSize()); set.removeResource(0); assertEquals("Wrong result size.", 0, set.getSize()); } @Test public void testClear() throws Exception { // test created resource final ResourceSet set = serv.query("1"); set.clear(); assertEquals("Results were not deleted.", 0, set.getSize()); } } basex-7.7.2/basex-api/src/test/java/org/basex/test/api/xmldb/XMLDBBaseTest.java000066400000000000000000000042341222453003200270600ustar00rootroot00000000000000package org.basex.test.api.xmldb; import static org.basex.core.Text.*; import java.io.*; import org.basex.api.xmldb.*; import org.basex.core.*; import org.basex.core.cmd.*; /** * Base class for all XMLDB tests. * @author dimitar * */ public abstract class XMLDBBaseTest { /** Test document. */ protected static final String DOCPATH = "src/test/resources/"; /** XMLDB driver. */ protected static final String DRIVER = BXDatabase.class.getName(); /** Database/document path. */ protected static final String URL = "xmldb:" + NAMELC + "://" + LOCALHOST + ':' + MainProp.PORT[1] + '/'; /** Name of the collection. */ protected static final String COLL = "XMLDB"; /** Database/document path. */ protected static final String PATH = URL + COLL; /** Optional login. */ protected static final String LOGIN = ADMIN; /** Optional password. */ protected static final String PW = ADMIN; /** Test document. */ protected static final String DOC1 = "first.xml"; /** Test document. */ protected static final String DOC2 = "second.xml"; /** Test document. */ protected static final String DOC3 = "third.xml"; /** Context. */ private static Context context = new Context(); /** * Create XMLDB database. * @throws BaseXException exception during database create */ protected static void createDB() throws BaseXException { new CreateDB(COLL, DOCPATH + DOC1).execute(context); new Close().execute(context); } /** * Drop XMLDB database. * @throws BaseXException exception during database drop */ protected static void dropDB() throws BaseXException { new DropDB(COLL).execute(context); } /** * Convenience method for returning the contents of the specified file. * @param fn file name * @return contents as byte array * @throws IOException I/O exception */ protected static byte[] read(final String fn) throws IOException { final File file = new File(fn); final byte[] buffer = new byte[(int) file.length()]; final FileInputStream fis = new FileInputStream(file); final DataInputStream dis = new DataInputStream(fis); dis.readFully(buffer); dis.close(); return buffer; } } basex-7.7.2/basex-api/src/test/java/org/basex/test/api/xmldb/XMLResourceTest.java000066400000000000000000000115111222453003200275630ustar00rootroot00000000000000package org.basex.test.api.xmldb; import static org.junit.Assert.*; import java.io.*; import javax.xml.parsers.*; import org.junit.*; import org.w3c.dom.*; import org.xml.sax.*; import org.xml.sax.helpers.*; import org.xmldb.api.base.*; import org.xmldb.api.modules.*; /** * This class tests the XMLDB/API XMLResource implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ @SuppressWarnings("all") public class XMLResourceTest extends XMLDBBaseTest { /** Collection. */ private Collection coll; /** Resource. */ private XMLResource res; @Before public void setUp() throws Exception { createDB(); final Class c = Class.forName(DRIVER); final Database database = (Database) c.newInstance(); coll = database.getCollection(PATH, LOGIN, PW); res = (XMLResource) coll.getResource(DOC1); } @After public void tearDown() throws Exception { coll.close(); dropDB(); } @Test public void testParentCollection() throws Exception { assertEquals("Wrong collection name.", res.getParentCollection(), coll); } @Test public void testGetID() throws Exception { assertEquals("Wrong ID.", res.getId(), DOC1); } @Test public void testGetResourceType() throws Exception { assertEquals("Wrong resource type.", res.getResourceType(), XMLResource.RESOURCE_TYPE); } @Test public void testGetContent() throws Exception { compare(DOCPATH + DOC1, res); } @Test public void testGetDocumentID() throws Exception { // id and document id should be identical assertEquals("ID and DocumentID differ.", res.getId(), res.getDocumentId()); } @Test public void testGetContentAsDOM() throws Exception { final Node node = res.getContentAsDOM(); final String root = node.getChildNodes().item(0).getNodeName(); assertTrue("Document instance expected.", node instanceof Document); assertEquals("Wrong root tag.", root, "first"); } @Test public void testSetContentAsDOM() throws Exception { // store small document final XMLResource xml = (XMLResource) coll.createResource(DOC2, XMLResource.RESOURCE_TYPE); xml.setContent(""); coll.storeResource(xml); assertEquals("Wrong number of documents.", 2, coll.getResourceCount()); // overwrite document with DOM contents final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); final DocumentBuilder builder = factory.newDocumentBuilder(); final Document doc = builder.parse( new File(DOCPATH + DOC2)); xml.setContentAsDOM(doc); coll.storeResource(xml); assertEquals("Wrong number of documents.", 2, coll.getResourceCount()); // compare content type assertTrue("Document expected.", xml.getContent() instanceof Document); } @Test public void testGetContentAsSAX() throws Exception { final DefaultHandler ch = new DefaultHandler() { int count; @Override public void startElement(final String u, final String ln, final String qn, final Attributes a) { ++count; } @Override public void endDocument() { assertEquals("Wrong number of elements.", 2, count); } }; ((XMLResource) coll.getResource(DOC1)).getContentAsSAX(ch); } @Test public void testSetContentAsSAX() throws Exception { // store small document final XMLResource doc2 = (XMLResource) coll.createResource(DOC2, XMLResource.RESOURCE_TYPE); final XMLResource doc3 = (XMLResource) coll.createResource(DOC3, XMLResource.RESOURCE_TYPE); final XMLReader reader2 = XMLReaderFactory.createXMLReader(); reader2.setContentHandler(doc2.setContentAsSAX()); reader2.parse(new InputSource(DOCPATH + DOC2)); final XMLReader reader3 = XMLReaderFactory.createXMLReader(); reader3.setContentHandler(doc3.setContentAsSAX()); reader3.parse(new InputSource(DOCPATH + DOC3)); coll.storeResource(doc2); coll.storeResource(doc3); assertEquals("Wrong number of documents.", 3, coll.getResourceCount()); final Resource doc1 = coll.getResource(DOC1); compare(DOCPATH + DOC1, doc1); compare(DOCPATH + DOC2, doc2); compare(DOCPATH + DOC3, doc3); coll.removeResource(doc3); coll.removeResource(doc2); assertEquals("Wrong number of documents.", 1, coll.getResourceCount()); } /** * Compares an XML resource with a file on disk. * @param file file name * @param r resource * @throws XMLDBException exception * @throws IOException I/O exception */ private static void compare(final String file, final Resource r) throws XMLDBException, IOException { // compare serialized node with input file final String cont = r.getContent().toString().replaceAll("\\r?\\n *", ""); final String buffer = new String(read(file)).trim(); assertEquals("File content differs.", buffer, cont.trim()); } } basex-7.7.2/basex-api/src/test/java/org/basex/test/api/xmldb/XPathQueryServiceTest.java000066400000000000000000000072531222453003200310160ustar00rootroot00000000000000package org.basex.test.api.xmldb; import static org.junit.Assert.*; import org.junit.*; import org.xmldb.api.base.*; import org.xmldb.api.modules.*; /** * This class tests the XMLDB/API XPathQueryService implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ @SuppressWarnings("all") public class XPathQueryServiceTest extends XMLDBBaseTest { /** Collection. */ private Collection coll; /** Resource. */ private XPathQueryService serv; @Before public void setUp() throws Exception { createDB(); final Class c = Class.forName(DRIVER); final Database database = (Database) c.newInstance(); coll = database.getCollection(PATH, LOGIN, PW); serv = (XPathQueryService) coll.getService("XPathQueryService", "1.0"); } @After public void tearDown() throws Exception { coll.close(); dropDB(); } @Test public void testSetNamespace() throws Exception { // overwriting namespaces serv.setNamespace("hell", "a"); serv.setNamespace("hell", "o"); assertEquals("Namespace not found.", "o", serv.getNamespace("hell")); // testing invalid URIs try { serv.setNamespace("hell", null); fail("Null URIs are not allowed."); } catch(final XMLDBException ex) { } try { coll.createResource("hans", ""); fail("Empty URIs are not allowed."); } catch(final XMLDBException ex) { } } @Test public void testGetNamespace() throws Exception { // testing former namespace assertNull("Namespaces shouldn't be global.", serv.getNamespace("hell")); // setting and requesting default namespace serv.setNamespace(null, "def"); assertEquals("No default Namespace.", "def", serv.getNamespace(null)); assertEquals("No default Namespace.", "def", serv.getNamespace("")); } @Test public void testRemoveNamespace() throws Exception { // set and remove namespace serv.setNamespace("hell", "a"); serv.removeNamespace("hell"); assertNull("Namespace was not removed.", serv.getNamespace("hell")); // set and remove default namespace serv.setNamespace(null, "def"); serv.removeNamespace(""); assertNull("Namespace was not removed.", serv.getNamespace(null)); } @Test public void testClearNamespace() throws Exception { // set and clear namespace serv.setNamespace("hell", "a"); serv.clearNamespaces(); assertNull("Namespace was not removed.", serv.getNamespace("hell")); } @Test public void testQuery() throws Exception { // catch query errors try { serv.query("1+"); fail("Buggy query was accepted."); } catch(final XMLDBException ex) { } assertEquals("Wrong result size.", 1, serv.query("/").getSize()); // add second document final Resource res = coll.createResource(DOC2, XMLResource.RESOURCE_TYPE); res.setContent(read(DOCPATH + DOC2)); coll.storeResource(res); assertEquals("Wrong result size", 6, serv.query("//node()").getSize()); // remove second document coll.removeResource(res); } @Test public void testQueryResource() throws Exception { assertEquals("Wrong result size", 3, serv.queryResource(DOC1, "//node()").getSize()); // catch query errors try { serv.queryResource("UnknownDoc", "/"); fail("Query was executed on unknown document."); } catch(final XMLDBException ex) { /* ignored. */ } } @Test public void testGetName() throws Exception { assertEquals("XPathQueryService", serv.getName()); } @Test public void testGetVersion() throws Exception { assertEquals("1.0", serv.getVersion()); } @Test public void testSetCollection() throws Exception { // nothing serious to test... } } basex-7.7.2/basex-api/src/test/java/org/basex/test/api/xmldb/package.html000066400000000000000000000001131222453003200261650ustar00rootroot00000000000000 Contains classes for testing the XMLDB API project code. basex-7.7.2/basex-api/src/test/java/org/basex/test/http/000077500000000000000000000000001222453003200230115ustar00rootroot00000000000000basex-7.7.2/basex-api/src/test/java/org/basex/test/http/FnHttpTest.java000066400000000000000000001005551222453003200257250ustar00rootroot00000000000000package org.basex.test.http; import static org.basex.core.Text.*; import static org.basex.query.func.Function.*; import static org.basex.util.Token.*; import static org.junit.Assert.*; import java.io.*; import java.net.*; import java.nio.charset.*; import java.util.*; import java.util.List; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.io.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.util.Err.ErrType; import org.basex.query.util.http.*; import org.basex.query.util.http.HTTPRequest.Part; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.junit.*; /** * This class tests the server-based HTTP Client. * * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ public class FnHttpTest extends HTTPTest { /** Example url. */ static final String ROOT = "http://" + LOCALHOST + ":9998/rest/"; /** Example url. */ static final String RESTURL = ROOT + NAME; /** Status code. */ private static final byte[] STATUS = token("status"); /** Body attribute media-type. */ private static final byte[] MEDIATYPE = token("media-type"); /** Body attribute method. */ private static final byte[] METHOD = token("method"); /** Books document. */ private static final String BOOKS = "" + "" + "Sherlock Holmes" + "Doyle" + "" + "" + "Winnetou" + "May" + "" + "" + "Tom Sawyer" + "Twain" + "" + ""; /** Carriage return/line feed. */ private static final String CRLF = "\r\n"; /** Local database context. */ protected static Context ctx; /** * Start server. * @throws Exception exception */ @BeforeClass public static void start() throws Exception { init(RESTURL, true); ctx = new Context(); } /** * Test sending of HTTP PUT requests. * @throws Exception exception */ @Test public void put() throws Exception { final QueryProcessor qp = new QueryProcessor(_HTTP_SEND_REQUEST.args( "" + "" + BOOKS + "" + "", RESTURL), ctx); checkResponse(qp.execute(), HttpURLConnection.HTTP_CREATED, 1); qp.close(); } /** * Test sending of HTTP POST requests. * @throws Exception exception */ @Test public void post() throws Exception { // POST - query QueryProcessor qp = new QueryProcessor(_HTTP_SEND_REQUEST.args( "" + "" + "" + "1" + "" + "" + "" + "", RESTURL), ctx); checkResponse(qp.execute(), HttpURLConnection.HTTP_OK, 2); qp.close(); // Execute the same query but with content set from $bodies qp = new QueryProcessor(_HTTP_SEND_REQUEST.args( "" + "", RESTURL, "" + "1" + "" + ""), ctx); checkResponse(qp.execute(), HttpURLConnection.HTTP_OK, 2); qp.close(); } /** * Test sending of HTTP GET requests. * @throws Exception exception */ @Test public void postGet() throws Exception { // GET1 - just send a GET request QueryProcessor qp = new QueryProcessor(_HTTP_SEND_REQUEST.args( ""), ctx); Result r = qp.execute(); checkResponse(r, HttpURLConnection.HTTP_OK, 2); assertEquals(NodeType.DOC, ((ValueBuilder) r).item[1].type); qp.close(); // GET2 - with override-media-type='text/plain' qp = new QueryProcessor(_HTTP_SEND_REQUEST.args( "", ROOT), ctx); r = qp.execute(); checkResponse(r, HttpURLConnection.HTTP_OK, 2); assertEquals(AtomType.STR, ((ValueBuilder) r).item[1].type); qp.close(); // Get3 - with status-only='true' qp = new QueryProcessor(_HTTP_SEND_REQUEST.args( "", ROOT), ctx); checkResponse(qp.execute(), HttpURLConnection.HTTP_OK, 1); qp.close(); } /** * Test sending of HTTP DELETE requests. * @throws Exception exception */ @Test public void postDelete() throws Exception { // add document to be deleted QueryProcessor qp = new QueryProcessor(_HTTP_SEND_REQUEST.args( "" + "" + "", RESTURL), ctx); qp.execute(); qp.close(); // DELETE qp = new QueryProcessor(_HTTP_SEND_REQUEST.args( "", RESTURL), ctx); checkResponse(qp.execute(), HttpURLConnection.HTTP_OK, 1); qp.close(); } /** * Test sending of HTTP request without any attributes - error shall be thrown * that mandatory attributes are missing. */ @Test public void sendEmptyReq() { try { new XQuery(_HTTP_SEND_REQUEST.args("")).execute(ctx); } catch(final BaseXException ex) { assertTrue(contains(token(ex.getMessage()), token(ErrType.HC.toString()))); } } /** * Tests http:send-request((),()). */ @Test public void sendReqNoParams() { final Command c = new XQuery(_HTTP_SEND_REQUEST.args("()")); try { c.execute(ctx); } catch(final BaseXException ex) { assertTrue(contains(token(ex.getMessage()), token(ErrType.HC.toString()))); } } /** * Tests an erroneous query. * @throws QueryException query exception */ @Test public void error() throws QueryException { final QueryProcessor qp = new QueryProcessor(_HTTP_SEND_REQUEST.args( "", RESTURL + "unknown") + "[1]/@status/data()", ctx); assertEquals("404", qp.execute().toString()); qp.close(); } /** * Tests RequestParser.parse() with normal (not multipart) request. * @throws IOException I/O Exception * @throws QueryException query exception */ @Test public void parseRequest() throws IOException, QueryException { // Simple HTTP request with no errors final String req = "" + "" + "" + "" + "Test body content" + "" + ""; final DBNode dbNode = new DBNode(new IOContent(req), ctx.prop); final HTTPRequestParser rp = new HTTPRequestParser(null); final HTTPRequest r = rp.parse(dbNode.children().next(), null); assertEquals(2, r.attrs.size()); assertEquals(2, r.headers.size()); assertTrue(r.bodyContent.size() != 0); assertEquals(1, r.payloadAttrs.size()); } /** * Tests RequestParser.parse() with multipart request. * @throws IOException I/O Exception * @throws QueryException query exception */ @Test public void parseMultipartReq() throws IOException, QueryException { final String multiReq = "" + "" + "" + "" + "" + "" + "" + "Part1" + "" + "" + "" + "Part2" + "" + "" + "Part3" + "" + "" + ""; final DBNode dbNode1 = new DBNode(new IOContent(multiReq), ctx.prop); final HTTPRequestParser rp = new HTTPRequestParser(null); final HTTPRequest r = rp.parse(dbNode1.children().next(), null); assertEquals(2, r.attrs.size()); assertEquals(2, r.headers.size()); assertTrue(r.isMultipart); assertEquals(3, r.parts.size()); // check parts final Iterator i = r.parts.iterator(); Part part; part = i.next(); assertEquals(2, part.headers.size()); assertEquals(1, part.bodyContent.size()); assertEquals(1, part.bodyAttrs.size()); part = i.next(); assertEquals(1, part.headers.size()); assertEquals(1, part.bodyContent.size()); assertEquals(1, part.bodyAttrs.size()); part = i.next(); assertEquals(0, part.headers.size()); assertEquals(1, part.bodyContent.size()); assertEquals(1, part.bodyAttrs.size()); } /** * Tests parsing of multipart request when the contents for each part are set * from the $bodies parameter. * @throws IOException I/O Exception * @throws QueryException query exception */ @Test public void parseMultipartReqBodies() throws IOException, QueryException { final String multiReq = "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + ""; final DBNode dbNode1 = new DBNode(new IOContent(multiReq), ctx.prop); final ValueBuilder bodies = new ValueBuilder(); bodies.add(Str.get("Part1")); bodies.add(Str.get("Part2")); bodies.add(Str.get("Part3")); final HTTPRequestParser rp = new HTTPRequestParser(null); final HTTPRequest r = rp.parse(dbNode1.children().next(), bodies); assertEquals(2, r.attrs.size()); assertEquals(2, r.headers.size()); assertTrue(r.isMultipart); assertEquals(3, r.parts.size()); // check parts final Iterator i = r.parts.iterator(); Part part = i.next(); assertEquals(2, part.headers.size()); assertEquals(1, part.bodyContent.size()); assertEquals(1, part.bodyAttrs.size()); part = i.next(); assertEquals(1, part.headers.size()); assertEquals(1, part.bodyContent.size()); assertEquals(1, part.bodyAttrs.size()); part = i.next(); assertEquals(0, part.headers.size()); assertEquals(1, part.bodyContent.size()); assertEquals(1, part.bodyAttrs.size()); } /** * Tests if errors are thrown when some mandatory attributes are missing in a * , or . * @throws IOException I/O Exception */ @Test public void errors() throws IOException { // Incorrect requests final List falseReqs = new ArrayList(); // Request without method final byte[] falseReq1 = token(""); falseReqs.add(falseReq1); // Request with send-authorization and no credentials final byte[] falseReq2 = token(""); falseReqs.add(falseReq2); // Request with send-authorization and only username final byte[] falseReq3 = token(""); falseReqs.add(falseReq3); // Request with body that has no media-type final byte[] falseReq4 = token("" + "" + "" + ""); falseReqs.add(falseReq4); // Request with multipart that has no media-type final byte[] falseReq5 = token("" + "" + "" + ""); falseReqs.add(falseReq5); // Request with multipart with part that has a body without media-type final byte[] falseReq6 = token("" + "" + "" + "" + "Part1" + "" + "" + "" + "Part1" + "" + "" + ""); falseReqs.add(falseReq6); // Request with schema different from http final byte[] falseReq7 = token(""); falseReqs.add(falseReq7); // Request with content and method which must be empty final byte[] falseReq8 = token("" + "" + "" + ""); falseReqs.add(falseReq8); final Iterator i = falseReqs.iterator(); while(i.hasNext()) { final DBNode dbNode = new DBNode(new IOContent(i.next()), ctx.prop); try { final HTTPRequestParser rp = new HTTPRequestParser(null); rp.parse(dbNode.children().next(), null); fail("Exception not thrown"); } catch(final QueryException ex) { assertTrue(contains(token(ex.getMessage()), token(ErrType.HC.toString()))); } } } /** * Tests method setRequestContent of HttpClient. * @throws IOException I/O Exception * @throws QueryException query exception */ @Test public void writeMultipartMessage() throws IOException, QueryException { final String plain = "...plain text...."; final String rich = ".... richtext version..."; final String fancy = ".... fanciest formatted version..."; final HTTPRequest req = new HTTPRequest(); req.isMultipart = true; req.payloadAttrs.put(token("media-type"), token("multipart/alternative")); req.payloadAttrs.put(token("boundary"), token("boundary42")); final Part p1 = new Part(); p1.headers.put(token("Content-Type"), token("text/plain; charset=us-ascii")); p1.bodyAttrs.put(token("media-type"), token("text/plain")); p1.bodyContent.add(Str.get(plain + '\n')); final Part p2 = new Part(); p2.headers.put(token("Content-Type"), token("text/richtext")); p2.bodyAttrs.put(token("media-type"), token("text/richtext")); p2.bodyContent.add(Str.get(rich)); final Part p3 = new Part(); p3.headers.put(token("Content-Type"), token("text/x-whatever")); p3.bodyAttrs.put(token("media-type"), token("text/x-whatever")); p3.bodyContent.add(Str.get(fancy)); req.parts.add(p1); req.parts.add(p2); req.parts.add(p3); final FakeHttpConnection fakeConn = new FakeHttpConnection(new URL( "http://www.test.com")); final HTTPClient hc = new HTTPClient(null, ctx.prop); hc.setRequestContent(fakeConn.getOutputStream(), req); final String expResult = "--boundary42" + CRLF + "Content-Type: text/plain; charset=us-ascii" + CRLF + CRLF + plain + Prop.NL + CRLF + "--boundary42" + CRLF + "Content-Type: text/richtext" + CRLF + CRLF + rich + CRLF + "--boundary42" + CRLF + "Content-Type: text/x-whatever" + CRLF + CRLF + fancy + CRLF + "--boundary42--" + CRLF; // Compare results final String fake = fakeConn.getOutputStream().toString(); assertEquals(expResult, fake); } /** * Tests writing of request content with different combinations of the body * attributes media-type and method. * @throws IOException IO exception * @throws QueryException query exception */ @Test public void writeMessage() throws IOException, QueryException { // Case 1: No method, media-type='text/xml' final HTTPRequest req1 = new HTTPRequest(); final FakeHttpConnection fakeConn1 = new FakeHttpConnection(new URL( "http://www.test.com")); req1.payloadAttrs.put(MEDIATYPE, token("text/xml")); // Node child final FElem e1 = new FElem("a").add("a"); req1.bodyContent.add(e1); // String item child req1.bodyContent.add(Str.get("b")); HTTPClient hc = new HTTPClient(null, ctx.prop); hc.setRequestContent(fakeConn1.getOutputStream(), req1); assertEquals("a<b>b</b>", fakeConn1.out.toString()); // Case 2: No method, media-type='text/plain' final HTTPRequest req2 = new HTTPRequest(); final FakeHttpConnection fakeConn2 = new FakeHttpConnection(new URL( "http://www.test.com")); req2.payloadAttrs.put(MEDIATYPE, token("text/plain")); // Node child final FElem e2 = new FElem("a").add("a"); req2.bodyContent.add(e2); // String item child req2.bodyContent.add(Str.get("b")); hc = new HTTPClient(null, ctx.prop); hc.setRequestContent(fakeConn2.getOutputStream(), req2); assertEquals("ab", fakeConn2.out.toString()); // Case 3: method='text', media-type='text/xml' final HTTPRequest req3 = new HTTPRequest(); final FakeHttpConnection fakeConn3 = new FakeHttpConnection(new URL( "http://www.test.com")); req3.payloadAttrs.put(MEDIATYPE, token("text/xml")); req3.payloadAttrs.put(token("method"), token("text")); // Node child final FElem e3 = new FElem("a").add("a"); req3.bodyContent.add(e3); // String item child req3.bodyContent.add(Str.get("b")); hc = new HTTPClient(null, ctx.prop); hc.setRequestContent(fakeConn3.getOutputStream(), req3); assertEquals("ab", fakeConn3.out.toString()); } /** * Tests writing of body content when @method is http:base64Binary. * @throws QueryException query exception * @throws IOException I/O Exception */ @Test public void writeBase64() throws IOException, QueryException { // Case 1: content is xs:base64Binary final HTTPRequest req1 = new HTTPRequest(); req1.payloadAttrs.put(METHOD, token("http:base64Binary")); req1.bodyContent.add(new B64(token("dGVzdA=="))); final FakeHttpConnection fakeConn1 = new FakeHttpConnection(new URL( "http://www.test.com")); HTTPClient hc = new HTTPClient(null, ctx.prop); hc.setRequestContent(fakeConn1.getOutputStream(), req1); assertEquals(fakeConn1.out.toString(), "dGVzdA=="); // Case 2: content is a node final HTTPRequest req2 = new HTTPRequest(); req2.payloadAttrs.put(METHOD, token("http:base64Binary")); final FElem e3 = new FElem("a").add("dGVzdA=="); req2.bodyContent.add(e3); final FakeHttpConnection fakeConn2 = new FakeHttpConnection(new URL( "http://www.test.com")); hc = new HTTPClient(null, ctx.prop); hc.setRequestContent(fakeConn2.getOutputStream(), req2); assertEquals(fakeConn2.out.toString(), "dGVzdA=="); } /** * Tests writing of body content when @method is http:hexBinary. * @throws IOException I/O Exception * @throws QueryException query exception */ @Test public void writeHex() throws IOException, QueryException { // Case 1: content is xs:hexBinary final HTTPRequest req1 = new HTTPRequest(); req1.payloadAttrs.put(METHOD, token("http:hexBinary")); req1.bodyContent.add(new Hex(token("74657374"))); final FakeHttpConnection fakeConn1 = new FakeHttpConnection(new URL( "http://www.test.com")); HTTPClient hc = new HTTPClient(null, ctx.prop); hc.setRequestContent(fakeConn1.getOutputStream(), req1); assertEquals(fakeConn1.out.toString(), "74657374"); // Case 2: content is a node final HTTPRequest req2 = new HTTPRequest(); req2.payloadAttrs.put(METHOD, token("http:base64Binary")); final FElem e3 = new FElem("a").add("74657374"); req2.bodyContent.add(e3); final FakeHttpConnection fakeConn2 = new FakeHttpConnection(new URL( "http://www.test.com")); hc = new HTTPClient(null, ctx.prop); hc.setRequestContent(fakeConn2.getOutputStream(), req2); assertEquals(fakeConn2.out.toString(), "74657374"); } /** * Tests writing of request content when @src is set. * @throws QueryException query exception * @throws IOException I/O Exception */ @Test public void writeFromResource() throws IOException, QueryException { // Create a file form which will be read final File f = new File(Prop.TMP + Util.name(FnHttpTest.class)); final FileOutputStream out = new FileOutputStream(f); out.write(token("test")); out.close(); // Request final HTTPRequest req = new HTTPRequest(); req.payloadAttrs.put(token("src"), token("file:" + f.getPath())); // HTTP connection final FakeHttpConnection fakeConn = new FakeHttpConnection(new URL( "http://www.test.com")); final HTTPClient hc = new HTTPClient(null, ctx.prop); hc.setRequestContent(fakeConn.getOutputStream(), req); // Delete file f.delete(); assertEquals(fakeConn.out.toString(), "test"); } /** * Tests response handling with specified charset in the header * 'Content-Type'. * @throws IOException I/O Exception * @throws QueryException query exception */ @Test public void responseWithCharset() throws IOException, QueryException { // Create fake HTTP connection final FakeHttpConnection conn = new FakeHttpConnection(new URL( "http://www.test.com")); final String test = "\u0442\u0435\u0441\u0442"; // Set content type conn.contentType = "text/plain; charset=CP1251"; // set content encoded in CP1251 conn.content = Charset.forName("CP1251").encode(test).array(); final Iter i = new HTTPResponse(null, ctx.prop).getResponse( conn, Bln.FALSE.string(), null); // compare results assertEquals(test, string(i.get(1).string(null))); } /** * Tests ResponseHandler.getResponse() with multipart response. * @throws IOException I/O Exception * @throws QueryException query exception */ @Test public void multipartResponse() throws IOException, QueryException { // Create fake HTTP connection final FakeHttpConnection conn = new FakeHttpConnection(new URL( "http://www.test.com")); final Map> hdrs = new HashMap>(); final List fromVal = new ArrayList(); fromVal.add("Nathaniel Borenstein "); // From: Nathaniel Borenstein hdrs.put("From", fromVal); final List mimeVal = new ArrayList(); mimeVal.add("1.0"); // MIME-Version: 1.0 hdrs.put("MIME-version", mimeVal); final List subjVal = new ArrayList(); subjVal.add("Formatted text mail"); // Subject: Formatted text mail hdrs.put("Subject", subjVal); final List contTypeVal = new ArrayList(); contTypeVal.add("multipart/alternative"); contTypeVal.add("boundary=\"boundary42\""); // Content-Type: multipart/alternative; boundary=boundary42 hdrs.put("Content-Type", contTypeVal); conn.headers = hdrs; conn.contentType = "multipart/alternative; boundary=\"boundary42\""; conn.content = token("--boundary42" + CRLF + "Content-Type: text/plain; charset=us-ascii" + CRLF + CRLF + "...plain text version of message goes here...." + CRLF + CRLF + "--boundary42" + CRLF + "Content-Type: text/richtext" + CRLF + CRLF + ".... richtext version of same message goes here ..." + CRLF + "--boundary42" + CRLF + "Content-Type: text/x-whatever" + CRLF + CRLF + ".... fanciest formatted version of same " + "message goes here" + CRLF + "..." + CRLF + "--boundary42--"); final Iter i = new HTTPResponse(null, ctx.prop).getResponse( conn, Bln.FALSE.string(), null); // Construct expected result final ValueBuilder resultIter = new ValueBuilder(); final String reqItem = "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + " "; final DBNode dbNode = new DBNode(new IOContent(reqItem), ctx.prop); resultIter.add(dbNode.children().next()); resultIter.add(Str.get("...plain text version of message " + "goes here....\n\n")); resultIter.add(Str.get(".... richtext version of same message " + "goes here ...\n")); resultIter.add(Str.get(".... fanciest formatted version of same " + "message goes here\n...\n")); // Compare response with expected result assertTrue(Compare.deep(resultIter, i, null)); } /** * Tests ResponseHandler.getResponse() with multipart response having preamble * and epilogue. * @throws IOException I/O Exception * @throws QueryException query exception */ @Test public void multipartRespPreamble() throws IOException, QueryException { // Create fake HTTP connection final FakeHttpConnection conn = new FakeHttpConnection(new URL( "http://www.test.com")); final Map> hdrs = new HashMap>(); final List fromVal = new ArrayList(); fromVal.add("Nathaniel Borenstein "); // From: Nathaniel Borenstein hdrs.put("From", fromVal); final List mimeVal = new ArrayList(); mimeVal.add("1.0"); final List toVal = new ArrayList(); toVal.add("Ned Freed "); // To: Ned Freed hdrs.put("To", toVal); // MIME-Version: 1.0 hdrs.put("MIME-version", mimeVal); final List subjVal = new ArrayList(); subjVal.add("Formatted text mail"); // Subject: Formatted text mail hdrs.put("Subject", subjVal); final List contTypeVal = new ArrayList(); contTypeVal.add("multipart/mixed"); contTypeVal.add("boundary=\"simple boundary\""); // Content-Type: multipart/alternative; boundary=boundary42 hdrs.put("Content-Type", contTypeVal); conn.headers = hdrs; conn.contentType = "multipart/mixed; boundary=\"simple boundary\""; // Response to be read conn.content = token("This is the preamble. " + "It is to be ignored, though it" + NL + "is a handy place for mail composers to include an" + CRLF + "explanatory note to non-MIME compliant readers." + CRLF + "--simple boundary" + CRLF + CRLF + "This is implicitly typed plain ASCII text." + CRLF + "It does NOT end with a linebreak." + CRLF + "--simple boundary" + CRLF + "Content-type: text/plain; charset=us-ascii" + CRLF + CRLF + "This is explicitly typed plain ASCII text." + CRLF + "It DOES end with a linebreak." + CRLF + CRLF + "--simple boundary--" + CRLF + "This is the epilogue. It is also to be ignored."); // Get response as sequence of XQuery items final Iter i = new HTTPResponse(null, ctx.prop).getResponse( conn, Bln.FALSE.string(), null); // Construct expected result final ValueBuilder resultIter = new ValueBuilder(); final String reqItem = "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + ""; final DBNode dbNode = new DBNode(new IOContent(reqItem), ctx.prop); resultIter.add(dbNode.children().next()); resultIter.add(Str.get("This is implicitly typed plain ASCII text.\n" + "It does NOT end with a linebreak.\n")); resultIter.add(Str.get("This is explicitly typed plain ASCII text.\n" + "It DOES end with a linebreak.\n\n")); // Compare response with expected result assertTrue(Compare.deep(resultIter, i, null)); } /** * Checks the response to an HTTP request. * @param r query result * @param expStatus expected status * @param itemsCount expected number of items * @throws QueryException query exception */ static void checkResponse(final Result r, final int expStatus, final int itemsCount) throws QueryException { assertTrue(r instanceof Iter); final Iter res = (Iter) r; assertEquals(itemsCount, r.size()); assertTrue(res.get(0) instanceof FElem); final FElem response = (FElem) res.get(0); assertNotNull(response.attributes()); for(final ANode attr : response.attributes()) { if(eq(attr.name(), STATUS) && !eq(attr.string(), token(expStatus))) { fail("Expected: " + expStatus + "\nFound: " + string(attr.string())); } } } } /** * Fake HTTP connection. * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ final class FakeHttpConnection extends HttpURLConnection { /** Request headers. */ Map> headers; /** Content-type. */ String contentType; /** Content. */ byte[] content; /** Connection output stream. */ final ByteArrayOutputStream out; /** * Constructor. * @param u uri */ FakeHttpConnection(final URL u) { super(u); out = new ByteArrayOutputStream(); headers = new HashMap>(); } @Override public ByteArrayInputStream getInputStream() { return new ByteArrayInputStream(content); } @Override public String getContentType() { return contentType; } @Override public int getResponseCode() { return 200; } @Override public String getResponseMessage() { return "OK"; } @Override public Map> getHeaderFields() { return headers; } @Override public String getHeaderField(final String field) { final List values = headers.get(field); final StringBuilder sb = new StringBuilder(); for(final String v : values) sb.append(v).append(';'); return sb.substring(0, sb.length() - 1); } @Override public OutputStream getOutputStream() { return out; } @Override public void disconnect() { } @Override public boolean usingProxy() { return false; } @Override public void connect() { } } basex-7.7.2/basex-api/src/test/java/org/basex/test/http/HTTPTest.java000066400000000000000000000157301222453003200253010ustar00rootroot00000000000000package org.basex.test.http; import static org.basex.http.HTTPMethod.*; import static org.basex.util.Token.*; import static org.junit.Assert.*; import java.io.*; import java.net.*; import java.util.*; import org.basex.*; import org.basex.core.*; import org.basex.http.*; import org.basex.io.*; import org.basex.io.in.*; import org.basex.io.out.*; import org.basex.test.*; import org.basex.util.*; import org.basex.util.list.*; import org.junit.*; /** * This class contains common methods for the HTTP services. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class HTTPTest extends SandboxTest { /** Database context. */ protected static final Context CONTEXT = HTTPContext.init(); /** Start servers. */ private static BaseXHTTP http; /** Root path. */ private static String root; // INITIALIZATION ===================================================================== /** * Initializes the test. * @param rt root path * @param local local flag * @throws Exception exception */ protected static void init(final String rt, final boolean local) throws Exception { initContext(CONTEXT); assertTrue(new IOFile(CONTEXT.mprop.get(MainProp.WEBPATH)).md()); root = rt; final StringList sl = new StringList(); if(local) sl.add("-l"); sl.add("-p9996", "-e9997", "-h9998", "-s9999", "-z", "-U" + Text.ADMIN, "-P" + Text.ADMIN); System.setOut(NULL); try { http = new BaseXHTTP(sl.toArray()); } finally { System.setOut(OUT); } } /** * Finish test. * @throws Exception exception */ @AfterClass public static void stop() throws Exception { System.setOut(NULL); try { http.stop(); } finally { System.setOut(OUT); } // cleanup: remove project specific system properties final StringList sl = new StringList(); final Properties pr = System.getProperties(); for(final Object s : pr.keySet()) { final String st = s.toString(); if(st.startsWith(Prop.DBPREFIX)) sl.add(st); } for(final String s : sl) pr.remove(s); } // PROTECTED METHODS ================================================================== /** * Executes the specified GET request and returns the result. * @param query request * @return string result, or {@code null} for a failure. * @throws IOException I/O exception */ protected static String get(final String query) throws IOException { return request(query, GET); } /** * Executes the specified DELETE request. * @param query request * @return response code * @throws IOException I/O exception */ protected static String delete(final String query) throws IOException { return request(query, DELETE); } /** * Executes the specified HEAD request and returns the result. * @param query request * @return string result, or {@code null} for a failure. * @throws IOException I/O exception */ protected static String head(final String query) throws IOException { return request(query, HEAD); } /** * Executes the specified GET request and returns the result. * @param query request * @param method HTTP method * @return string result, or {@code null} for a failure. * @throws IOException I/O exception */ protected static String request(final String query, final HTTPMethod method) throws IOException { final URL url = new URL(root + query); final HttpURLConnection conn = (HttpURLConnection) url.openConnection(); try { conn.setRequestMethod(method.name()); return read(new BufferInput(conn.getInputStream())).replaceAll("\r?\n *", ""); } catch(final IOException ex) { throw error(conn, ex); } finally { conn.disconnect(); } } /** * Executes the specified PUT request. * @param query path * @param request request * @param type content type * @return string result, or {@code null} for a failure. * @throws IOException I/O exception */ protected static String post(final String query, final String request, final String type) throws IOException { // create connection final URL url = new URL(root + query); final HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setRequestMethod(POST.name()); conn.setRequestProperty(MimeTypes.CONTENT_TYPE, type); // basic authentication final String encoded = Base64.encode(Text.ADMIN + ':' + Text.ADMIN); conn.setRequestProperty(HTTPText.AUTHORIZATION, HTTPText.BASIC + ' ' + encoded); // send query final OutputStream out = conn.getOutputStream(); out.write(token(request)); out.close(); try { return read(conn.getInputStream()).replaceAll("\r?\n *", ""); } catch(final IOException ex) { throw error(conn, ex); } finally { conn.disconnect(); } } /** * Returns an exception with improved error message. * @param conn connection reference * @param ex exception * @return exception * @throws IOException I/O exception */ protected static IOException error(final HttpURLConnection conn, final IOException ex) throws IOException { final String msg = read(conn.getErrorStream()); throw new BaseXException(msg.isEmpty() ? ex.getMessage() : msg); } /** * Returns a string result from the specified input stream. * @param is input stream * @return string * @throws IOException I/O exception */ protected static String read(final InputStream is) throws IOException { final ArrayOutput ao = new ArrayOutput(); if(is != null) { final BufferInput bi = new BufferInput(is); for(int i; (i = bi.read()) != -1;) ao.write(i); bi.close(); } return ao.toString(); } /** * Executes the specified PUT request. * @param u url * @param is input stream * @throws IOException I/O exception */ protected static void put(final String u, final InputStream is) throws IOException { put(u, is, null); } /** * Executes the specified PUT request. * @param u url * @param is input stream * @param ctype content type (optional, may be {@code null}) * @throws IOException I/O exception */ protected static void put(final String u, final InputStream is, final String ctype) throws IOException { final URL url = new URL(u); final HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setRequestMethod(PUT.name()); if(ctype != null) conn.setRequestProperty(MimeTypes.CONTENT_TYPE, ctype); final OutputStream bos = new BufferedOutputStream(conn.getOutputStream()); if(is != null) { // send input stream if it not empty final BufferedInputStream bis = new BufferedInputStream(is); for(int i; (i = bis.read()) != -1;) bos.write(i); bis.close(); bos.close(); } try { read(conn.getInputStream()); } catch(final IOException ex) { throw error(conn, ex); } finally { conn.disconnect(); } } } basex-7.7.2/basex-api/src/test/java/org/basex/test/http/RESTConcurrencyTest.java000066400000000000000000000045021222453003200275050ustar00rootroot00000000000000package org.basex.test.http; import static org.junit.Assert.*; import java.io.*; import org.basex.core.*; import org.basex.http.rest.*; import org.junit.*; /** * This class sends parallel requests to the REST API. * * It currently fails when {@link #CLIENTS} is set to a value larger than 1, * because {@link RESTCode#open} performs separate transactions that may be intervened * by the updating transaction of another client. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class RESTConcurrencyTest extends HTTPTest { /** REST identifier. */ private static final String REST = "rest"; /** Root path. */ protected static final String ROOT = "http://" + Text.LOCALHOST + ":9998/" + REST + '/'; /** Client count. */ private static final int CLIENTS = 1; /** Runs per client. */ private static final int RUNS = 10; /** Control client sessions. */ private final Client[] clients = new Client[CLIENTS]; /** Failed flag. */ protected static boolean failed; // INITIALIZERS ============================================================= /** * Start server. * @throws Exception exception */ @BeforeClass public static void start() throws Exception { init(ROOT, true); } // TEST METHODS ============================================================= /** * Concurrency test. * @throws Exception exception */ @Test public void test() throws Exception { get("?command=create+db+" + REST + "+"); // start and join concurrent clients for(int i = 0; i < clients.length; i++) clients[i] = new Client(); for(final Client c : clients) c.start(); for(final Client c : clients) c.join(); get("?command=drop+db+" + REST); } /** Client class. */ static class Client extends Thread { @Override public void run() { try { for(int i = 0; i < RUNS && !failed; i++) { final double rnd = Math.random(); final boolean query = rnd < 1 / 3d; final boolean delete = rnd > 2 / 3d; if(query) get("/" + REST + "?query=count(.)"); else if(delete) get("/" + REST + "?query=db:delete('rest','/')"); else get("/" + REST + "?query=db:add('rest',,'x')"); } } catch(final IOException ex) { failed = true; fail(ex.getMessage()); } } } } basex-7.7.2/basex-api/src/test/java/org/basex/test/http/RESTTest.java000066400000000000000000000335161222453003200253010ustar00rootroot00000000000000package org.basex.test.http; import static org.basex.io.MimeTypes.*; import static org.basex.util.Token.*; import static org.junit.Assert.*; import java.io.*; import java.net.*; import org.basex.core.*; import org.basex.http.rest.*; import org.basex.io.in.*; import org.basex.query.func.*; import org.basex.util.*; import org.junit.*; /** * This class tests the embedded REST API. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class RESTTest extends HTTPTest { /** REST identifier. */ private static final String REST = "rest"; /** Root path. */ protected static final String ROOT = "http://" + Text.LOCALHOST + ":9998/" + REST + '/'; /** REST URI. */ private static final String URI = RESTText.RESTURI; /** Opening result. */ private static final String WRAP = '<' + REST + ":results xmlns:" + REST + "=\"" + URI + "\"/>"; /** Input file. */ private static final String FILE = "src/test/resources/input.xml"; // INITIALIZERS ============================================================= /** * Start server. * @throws Exception exception */ @BeforeClass public static void start() throws Exception { init(ROOT, true); } // TEST METHODS ============================================================= /** * GET Test. * @throws Exception exception */ @Test public void get0() throws Exception { assertEquals("1", get("?query=1")); } /** * GET Test. * @throws Exception exception */ @Test public void get() throws Exception { assertEquals("1 2 3", get("?query=1+to+3&wrap=no")); } /** * GET Test. * @throws Exception exception */ @Test public void get2() throws Exception { assertEquals(WRAP, get("?query=()&wrap=yes")); } /** * GET Test: returns a resource. * @throws IOException I/O exception */ @Test public void get3() throws IOException { put(ROOT + NAME, new ArrayInput("")); put(ROOT + NAME + "/raw", new ArrayInput("XXX"), APP_OCTET); assertEquals("", get(NAME + '/' + NAME + ".xml")); assertEquals("XXX", get(NAME + "/raw")); delete(NAME); } /** * GET Test. * @throws Exception exception */ @Test public void getInput() throws Exception { assertEquals("", get("?query=.&context=")); } /** * GET Test. */ @Test public void getInputError() { try { assertEquals("", get("?query=.&context=<")); fail("Error expected."); } catch(final IOException ex) { /** expected. */ } } /** * GET Test. * @throws IOException I/O exception */ @Test public void getBind() throws IOException { assertEquals("123", get('?' + "query=declare+variable+$x+as+xs:integer+external;$x&$x=123")); } /** * GET Test. * @throws IOException I/O exception */ @Test public void getBind2() throws IOException { assertEquals("124", get("?wrap=no&$x=123&" + "query=declare+variable+$x+as+xs:integer+external;$x%2b1")); } /** * GET Test. * @throws IOException I/O exception */ @Test public void getBind3() throws IOException { assertEquals("6", get("?wrap=no&" + "query=declare+variable+$a++as+xs:integer+external;" + "declare+variable+$b+as+xs:integer+external;" + "declare+variable+$c+as+xs:integer+external;" + "$a*$b*$c&" + "$a=1&$b=2&$c=3")); } /** GET Test. */ @Test public void getErr1() { try { get("?query=("); fail("Error expected."); } catch(final IOException ex) { assertContains(ex.getMessage(), "[XPST0003]"); } } /** GET Test. */ @Test public void getErr2() { try { get("?query=()&wrap=n"); fail("Error expected."); } catch(final IOException ex) { } } /** GET Test. */ @Test public void getErr3() { try { get("?query=()&method=xxx"); fail("Error expected."); } catch(final IOException ex) { } } /** * GET content types. * @throws Exception exception */ @Test public void getContentType() throws Exception { assertStartsWith(contentType("?query=1"), APP_XML); assertStartsWith(contentType("?command=info"), TEXT_PLAIN); assertStartsWith(contentType("?query=1&method=xml"), APP_XML); assertStartsWith(contentType("?query=1&method=xhtml"), TEXT_HTML); assertStartsWith(contentType("?query=1&method=html"), TEXT_HTML); assertStartsWith(contentType("?query=1&method=text"), TEXT_PLAIN); assertStartsWith(contentType("?query=1&method=raw"), APP_OCTET); assertStartsWith(contentType("?query=&method=json"), APP_JSON); assertStartsWith(contentType("?query=&method=jsonml"), APP_JSON); assertStartsWith(contentType("?query=1&media-type=application/xml"), APP_XML); assertStartsWith(contentType("?query=1&media-type=text/html"), TEXT_HTML); assertStartsWith(contentType("?query=1&media-type=xxx"), "xxx"); } /** * Compares two byte arrays for equality. * @param string full string * @param prefix prefix */ private static void assertStartsWith(final String string, final String prefix) { assertTrue("'" + string + "' does not start with '" + prefix + "'", string.startsWith(prefix)); } /** * GET Test: specify an option. * @throws IOException I/O exception */ @Test public void getOption() throws IOException { assertEquals("2", get("?query=switch(1)+case+1+return+2+default+return+3&" + Prop.XQUERY3[0] + "=true") ); try { get("?query=switch(1)+case+1+return+2+default+return+3&" + Prop.XQUERY3[0] + "=false"); fail("Error expected."); } catch(final IOException ex) { assertContains(ex.getMessage(), "[XPST0003]"); } } /** * POST Test: execute a query. * @throws IOException I/O exception */ @Test public void post1() throws IOException { assertEquals("123", post("", "" + "123", APP_XML)); } /** * POST Test: execute a query. * @throws IOException I/O exception */ @Test public void post2() throws IOException { assertEquals("", post("", "" + "()", APP_XML)); } /** * POST Test: execute a query. * @throws IOException I/O exception */ @Test public void post3() throws IOException { assertEquals( "123", post("", "" + "123" + "", APP_XML)); } /** * POST Test: execute a query and ignore/overwrite duplicates declarations. * @throws IOException I/O exception */ @Test public void post4() throws IOException { assertEquals("", post("", "" + "]]>" + "" + "" + "" + "" + "" + "", APP_XML)); } /** * POST Test: execute a query. * @throws IOException I/O exception */ @Test public void post5() throws IOException { assertEquals("123", post("", "" + "123" + "" + "" + "" + "", APP_XML)); } /** * POST Test: execute a query with an initial context. * @throws IOException I/O exception */ @Test public void post6() throws IOException { assertEquals("", post("", "" + "." + "" + "", APP_XML)); } /** * POST Test: specify an option. * @throws IOException I/O exception */ @Test public void postOption() throws IOException { assertEquals("2", post("", "" + "switch(1) case 1 return 2 default return 3" + "", APP_XML)); try { post("", "" + "switch(1) case 1 return 2 default return 3" + "", APP_XML); fail("Error expected."); } catch(final IOException ex) { assertContains(ex.getMessage(), "[XPST0003]"); } } /** POST Test: execute buggy query. */ @Test public void postErr() { try { assertEquals("", post("", "(", APP_XML)); } catch(final IOException ex) { assertContains(ex.getMessage(), "[XPST0003]"); } } /** * PUT Test: create empty database. * @throws IOException I/O exception */ @Test public void put1() throws IOException { put(ROOT + NAME, null); assertEquals("0", get(NAME + "?query=count(/)")); delete(NAME); } /** * PUT Test: create simple database. * @throws IOException I/O exception */ @Test public void put2() throws IOException { put(ROOT + NAME, new ArrayInput(token("A"))); assertEquals("A", get(NAME + "?query=/*/text()")); delete(NAME); } /** * PUT Test: create and overwrite database. * @throws IOException I/O exception */ @Test public void put3() throws IOException { put(ROOT + NAME, new FileInputStream(FILE)); put(ROOT + NAME, new FileInputStream(FILE)); assertEquals("XML", get(NAME + "?query=//title/text()")); delete(NAME); } /** * PUT Test: create two documents in a database. * @throws IOException I/O exception */ @Test public void put4() throws IOException { put(ROOT + NAME, null); put(ROOT + NAME + "/a", new ArrayInput(token("A"))); put(ROOT + NAME + "/b", new ArrayInput(token("B"))); assertEquals("2", get(NAME + "?query=count(//text())")); assertEquals("2", get("?query=count(" + Function._DB_OPEN.args(NAME) + "//text())")); assertEquals("1", get("?query=count(" + Function._DB_OPEN.args(NAME, "b") + "/*)")); delete(NAME); } /** * PUT Test: specify an option. * @throws IOException I/O exception */ @Test public void putOption() throws IOException { put(ROOT + NAME + "?" + Prop.CHOP[0] + "=true", new FileInputStream(FILE)); assertEquals("5", get(NAME + "?query=count(//text())")); put(ROOT + NAME + "?" + Prop.CHOP[0] + "=false", new FileInputStream(FILE)); assertEquals("22", get(NAME + "?query=count(//text())")); try { put(ROOT + NAME + "?xxx=yyy", new FileInputStream(FILE)); fail("Error expected."); } catch(final IOException ex) { } } /** * DELETE Test. * @throws IOException I/O exception */ @Test public void delete1() throws IOException { put(ROOT + NAME, new FileInputStream(FILE)); // delete database assertEquals(delete(NAME).trim(), Util.info(Text.DB_DROPPED_X, NAME)); try { // no database left delete(NAME); fail("Error expected."); } catch(final BaseXException ex) { } } /** * DELETE Test. * @throws IOException I/O exception */ @Test public void delete2() throws IOException { put(ROOT + NAME, null); put(ROOT + NAME + "/a", new ArrayInput(token(""))); put(ROOT + NAME + "/b", new ArrayInput(token(""))); // delete 'a' directory assertStartsWith(delete(NAME + "/a"), "1 "); // delete 'b' directory assertStartsWith(delete(NAME + "/b"), "1 "); // no 'b' directory left assertStartsWith(delete(NAME + "/b"), "0 "); // delete database assertEquals(delete(NAME).trim(), Util.info(Text.DB_DROPPED_X, NAME)); try { // no database left delete(NAME); fail("Error expected."); } catch(final BaseXException ex) { } } /** * DELETE Test: specify an option. * @throws IOException I/O exception */ @Test public void deleteOption() throws IOException { put(ROOT + NAME, null); delete(NAME + "/a?" + Prop.CHOP[0] + "=true"); try { delete(NAME + "/a?xxx=true"); fail("Error expected."); } catch(final IOException ex) { } } // PRIVATE METHODS ========================================================== /** * Checks if a string is contained in another string. * @param str string * @param sub sub string */ private static void assertContains(final String str, final String sub) { if(!str.contains(sub)) fail('\'' + sub + "' not contained in '" + str + "'."); } /** * Executes the specified GET request and returns the content type. * @param query request * @return string result, or {@code null} for a failure. * @throws IOException I/O exception */ private static String contentType(final String query) throws IOException { final URL url = new URL(ROOT + query); final HttpURLConnection conn = (HttpURLConnection) url.openConnection(); try { read(conn.getInputStream()); return conn.getContentType(); } catch(final IOException ex) { throw error(conn, ex); } finally { conn.disconnect(); } } } basex-7.7.2/basex-api/src/test/java/org/basex/test/http/RequestTest.java000066400000000000000000000100321222453003200261400ustar00rootroot00000000000000package org.basex.test.http; import static org.junit.Assert.*; import java.net.*; import org.basex.core.*; import org.basex.util.*; import org.junit.*; /** * This class tests the Request Module. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class RequestTest extends HTTPTest { /** Root path. */ protected static final String ROOT = "http://" + Text.LOCALHOST + ":9998/rest/"; /** * Start server. * @throws Exception exception */ @BeforeClass public static void start() throws Exception { init(ROOT, true); } /** * Function test. * @throws Exception exception */ @Test public void method() throws Exception { assertEquals("GET", get("?query=" + request("R:method()"))); } /** * Function test. * @throws Exception exception */ @Test public void scheme() throws Exception { assertEquals("http", get("?query=" + request("R:scheme()"))); } /** * Function test. * @throws Exception exception */ @Test public void port() throws Exception { assertEquals("9998", get("?query=" + request("R:port()"))); } /** * Function test. * @throws Exception exception */ @Test public void path() throws Exception { put(ROOT + NAME, null); assertEquals("/rest/", get("?query=" + request("R:path()"))); assertEquals("/rest/" + NAME, get(NAME + "?query=" + request("R:path()"))); } /** * Function test. * @throws Exception exception */ @Test public void query() throws Exception { assertEquals("true", get("?query=" + request("starts-with(R:query(), 'query')"))); } /** * Function test. * @throws Exception exception */ @Test public void uri() throws Exception { assertEquals("true", get("?query=" + request("starts-with(R:uri(), 'http')"))); } /** * Function test. * @throws Exception exception */ @Test public void parameterNames() throws Exception { final String query = "count(R:parameter-names())"; assertEquals("1", get("?query=" + request(query))); assertEquals("2", get("?query=" + request(query) + "&a=b")); assertEquals("2", get("?query=" + request(query) + "&a=b&a=b")); } /** * Function test. * @throws Exception exception */ @Test public void parameter() throws Exception { assertEquals("b", get("?query=" + request("R:parameter('a')") + "&a=b")); assertEquals("b c", get("?query=" + request("R:parameter('a')") + "&a=b&a=c")); assertEquals("b", get("?query=" + request("R:parameter('a','c')") + "&a=b")); assertEquals("c", get("?query=" + request("R:parameter('x','c')") + "&a=b")); } /** * Function test. * @throws Exception exception */ @Test public void headerNames() throws Exception { final String query = "R:header-names()"; assertEquals("Host Accept Connection User-Agent", get("?query=" + request(query))); } /** * Function test. * @throws Exception exception */ @Test public void header() throws Exception { assertEquals("localhost:9998", get("?query=" + request("R:header('Host')"))); assertEquals("def", get("?query=" + request("R:header('ABC', 'def')"))); } /** * Function test. * @throws Exception exception */ @Test public void cookieNames() throws Exception { final String query = "count(R:cookie-names())"; assertEquals("0", get("?query=" + request(query))); } /** * Function test. * @throws Exception exception */ @Test public void cookie() throws Exception { final String query = "count(R:cookie('x'))"; assertEquals("0", get("?query=" + request(query))); } // PRIVATE METHODS ==================================================================== /** * Returns an encoded version of the query, including a Request module import. * @param query query string * @return prepared query * @throws Exception exception */ private static String request(final String query) throws Exception { return URLEncoder.encode( "import module namespace R='http://exquery.org/ns/request';" + query, Token.UTF8); } } basex-7.7.2/basex-api/src/test/java/org/basex/test/http/RestXqTest.java000066400000000000000000000426411222453003200257510ustar00rootroot00000000000000package org.basex.test.http; import static org.basex.core.Text.*; import static org.basex.io.MimeTypes.*; import static org.junit.Assert.*; import java.io.*; import org.basex.core.*; import org.basex.io.*; import org.basex.util.*; import org.junit.*; /** * This class contains RESTXQ API tests. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class RestXqTest extends HTTPTest { /** Root path. */ private static final String ROOT = "http://" + LOCALHOST + ":9998/"; /** Query header. */ private static final String HEADER = "module namespace m = 'http://basex.org/modules/restxq/test';" + Prop.NL + "declare namespace R = 'http://exquery.org/ns/restxq';" + Prop.NL; /** Counter. */ private static int count; // INITIALIZERS ============================================================= /** * Start server. * @throws Exception exception */ @BeforeClass public static void start() throws Exception { init(ROOT, true); } // TEST METHODS ============================================================= /** Retrieve root. * @throws Exception exception */ @Test public void get() throws Exception { get("declare %R:path('') function m:f() { 'root' };", "", "root"); get("declare %R:path('') function m:f() { 'root' };", "/", "root"); // explicit GET method get("declare %R:GET %R:path('') function m:f() { 'root' };", "", "root"); // duplicate GET method getE("declare %R:GET %R:GET %R:path('') function m:f() { 'root' };", ""); } /** Retrieve path. * @throws Exception exception */ @Test public void getTest() throws Exception { get("declare %R:path('/test') function m:f() {'ok'};", "test", "ok"); } /** Retrieve path with variable. * @throws Exception exception */ @Test public void getVariable() throws Exception { final String f = "declare %R:path('/var/{$x}') function m:f($x) {$x};"; get(f, "var/x", "x"); get(f, "var/y", "y"); } /** Retrieve path with variable on root level. * @throws Exception exception */ @Test public void getRootVariable() throws Exception { final String f = "declare %R:path('{$x}/a/b/c') function m:f($x) {$x};"; get(f, "x/a/b/c", "x"); // wrong path getE(f, "x/a/b/d"); } /** Retrieve path with typed variable. * @throws Exception exception */ @Test public void getInteger() throws Exception { final String f = "declare %R:path('/{$x}') function m:f($x as xs:int) {$x};"; get(f, "2", "2"); getE(f, "StRiNg"); } /** Retrieve path with multiple variables. * @throws Exception exception */ @Test public void getMultiply() throws Exception { final String f = "declare %R:path('{$x}/{$y}') function " + "m:f($x as xs:integer,$y as xs:integer) {$x*$y};"; get(f, "2/3", "6"); getE(f, "2/x"); } /** Checks if undeclared functions are reported. */ @Test public void unknownFunction() { try { get("declare function m:foo($x) { $x };" + "declare %R:path('') function m:f() { m:foo() };", "", ""); fail("Unknown function 'm:foo()' should not be found."); } catch(final IOException ex) { assertTrue(ex.getMessage().contains("XPST0017")); } } /** Retrieve path with typed variable. * @throws Exception exception */ @Test public void post() throws Exception { String f = "declare %R:POST('{$x}') %R:path('') function m:f($x) {$x};"; post(f, "", "12", "12", TEXT_PLAIN); post(f, "", "A", "A", APP_XML); f = "declare %R:POST('{$x}') %R:path('') function m:f($x) {$x/json/*};"; post(f, "", "B", "{ \"A\":\"B\" }", APP_JSON); f = "declare %R:POST('{$x}') %R:path('') function m:f($x) {$x};"; post(f, "", "", "[\"A\"]", APP_JSONML); f = "declare %R:POST('{$x}') %R:path('') function m:f($x) {$x/csv/*/*};"; post(f, "", "A", "A", TEXT_CSV); f = "declare %R:POST('{$x}') %R:path('') function m:f($x) {$x};"; post(f, "", "QUFB", "AAA", APP_OCTET); post(f, "", "QUFB", "AAA", "whatever/type"); } /** * {@code %path} annotation. * @throws Exception exception */ @Test public void pathAnn() throws Exception { // correct syntax get("declare %R:path('') function m:f() {()};", "", ""); // no path annotation getE("declare %R:GET function m:f() {()};", ""); // no path argument getE("declare %R:path function m:f() {()};", ""); // empty path argument getE("declare %R:path() function m:f() {()};", ""); // two path arguments getE("declare %R:path('a', 'b') function m:f() {()};", "a"); getE("declare %R:path('a') %R:path('b') function m:f() {()};", "a"); // path not found getE("declare %R:path('') function m:f() { 1 };", "X"); getE("declare %R:path('a') function m:f() { 1 };", ""); } /** * {@code %path} segments. * @throws Exception exception */ @Test public void pathVar() throws Exception { // correct syntax get("declare %R:path('{$x}') function m:f($x) {$x};", "1", "1"); // invalid variable definitions getE("declare %R:path('{a}') function m:f() {()};", "a"); getE("declare %R:path('{ $a }') function m:f() {()};", "a"); // invalid variable name getE("declare %R:path('{$x::x}') function m:f() {()};", "a"); getE("declare %R:path('{$x x}') function m:f() {()};", "a"); // missing argument getE("declare %R:path('{$x}') function m:f() {()};", "a"); // variable in template specified twice getE("declare %R:path('{$x}/{$x}') function m:f($x) {()};", "a"); // variable in template missing getE("declare %R:path('') function m:f($x) {()};", ""); // variable must inherit xs:anyAtomicType getE("declare %R:path('{$x}') function m:f($x as node()) {$x};", "1"); } /** * Various annotations. * @throws Exception exception */ @Test public void various() throws Exception { // correct syntax get("declare %R:path('') function m:f() {'x'};", "", "x"); // invalid annotation getE("declare %R:path('') %R:xyz function m:f() {'x'};", ""); } /** * Serialization parameters and elements. * @throws Exception exception */ @Test public void output() throws Exception { // correct syntax get("declare %R:path('') %output:method('text') function m:f() {'9'};", "", "9"); // unknown serialization parameter getE("declare %R:path('') %output:xyz('abc') function m:f() {'9'};", ""); // parameter must contain single string getE("declare %R:path('') %output:method function m:f() {'9'};", ""); getE("declare %R:path('') %output:method('xml','html') function m:f() {'9'};", ""); get("declare %R:path('') function m:f() { " + "" + " " + " " + " " + "," + "1 };", "", "1"); get("declare %R:path('') %output:method('text') function m:f() {" + "" + " " + " " + " " + " " + "," + "1 };", "", "1"); } /** * {@code %consumes} annotation. * @throws Exception exception */ @Test public void consumes() throws Exception { // correct syntax get("declare %R:path('') %R:consumes('text/plain') function m:f() {1};", "", "1"); get("declare %R:path('') %R:consumes('*/*') function m:f() {1};", "", "1"); // duplicate annotations get("declare %R:path('') %R:consumes('text/plain','*/*') function m:f() {1};", "", "1"); get("declare %R:path('') %R:consumes('text/plain') %R:consumes('*/*') " + "function m:f() {1};", "", "1"); // invalid content type: ignored as no content type has been specified by user get("declare %R:path('') %R:consumes('X') function m:f() {1};", "", "1"); } /** * {@code %produces} annotation. * @throws Exception exception */ @Test public void produces() throws Exception { // correct syntax get("declare %R:path('') %R:produces('text/plain') function m:f() {1};", "", "1"); get("declare %R:path('') %R:produces('*/*') function m:f() {1};", "", "1"); // duplicate annotations get("declare %R:path('') %R:produces('text/plain','*/*') function m:f() {1};", "", "1"); get("declare %R:path('') %R:produces('text/plain') %R:produces('*/*') " + "function m:f() {1};", "", "1"); // invalid content type getE("declare %R:path('') %R:produces('X') function m:f() {1};", ""); } /** * {@code %HEAD} method. * @throws Exception exception */ @Test public void head() throws Exception { // correct return type head("declare %R:HEAD %R:path('') function m:f() { };", "", ""); head("declare %R:HEAD %R:path('') function m:f() as element(R:response) " + "{ };", "", ""); // wrong type headE("declare %R:HEAD %R:path('') function m:f() { () };", ""); headE("declare %R:HEAD %R:path('') function m:f() { };", ""); headE("declare %R:HEAD %R:path('') function m:f() as element(R:response)* {()};", ""); } /** * {@code } elements. * @throws Exception exception */ @Test public void response() throws Exception { get("declare %R:path('') function m:f() { , 1 };", "", "1"); get("declare %R:path('') function m:f() { };", "", ""); get("declare %R:path('') function m:f() {" + " };", "", ""); get("declare %R:path('') function m:f() {" + " };", "", ""); get("declare %R:path('') function m:f() {" + ", 'OK'};", "", "OKOK"); // wrong syntax getE("declare %R:path('') function m:f() {" + " };", ""); getE("declare %R:path('') function m:f() {" + "X };", ""); getE("declare %R:path('') function m:f() {" + " };", ""); getE("declare %R:path('') function m:f() {" + " };", ""); getE("declare %R:path('') function m:f() {" + "X };", ""); } /** * Query parameters. * @throws Exception exception */ @Test public void queryParams() throws Exception { // correct syntax get("declare %R:path('') %R:query-param('a','{$v}') " + "function m:f($v) {$v};", "?a=1", "1"); get("declare %R:path('') %R:query-param('a','{$a}') " + "function m:f($a) {$a*2};", "?a=1", "2"); get("declare %R:path('') %R:query-param('a','{$a}') " + "function m:f($a as xs:integer*) {count($a)};", "?a=4&a=8", "2"); get("declare %R:path('') %R:query-param('a','{$v}',3) " + "function m:f($v) {$v};", "", "3"); get("declare %R:path('') %R:query-param('a','{$v}',4,8) " + "function m:f($v) {count($v)};", "", "2"); get("declare %R:path('') %R:query-param('a','{$a}') %R:query-param('b','{$b}') " + "function m:f($a,$b) {$a*$b};", "?a=2&b=3", "6"); // missing assignment: default value is empty sequence get("declare %R:path('') %R:query-param('a','{$v}') " + "function m:f($v) {count($v)};", "", "0"); // missing variable declaration getE("declare %R:path('') %R:query-param('a','{$a}') function m:f() {1};", "?a=2"); // variable is specified more than once getE("declare %R:path('') %R:query-param('a','{$a}') %R:query-param('a','{$a}') " + "function m:f($a) {$a};", "?a=2"); // parameter is no string getE("declare %R:path('') %R:query-param(1,'{$a}') function m:f($a) {$a};", "?a=2"); // invalid path template getE("declare %R:path('') %R:query-param('a','$a') function m:f($a) {$a};", "?a=2"); // invalid type cardinality getE("declare %R:path('') %R:query-param('a','{$a}') " + "function m:f($a as item()) {()};", "?a=4&a=8"); } /** * Form parameters (same as %query-param if GET is used). * @throws Exception exception */ @Test public void formParams() throws Exception { // correct syntax get("declare %R:path('') %R:form-param('a','{$v}') " + "function m:f($v) {$v};", "?a=1", "1"); } /** * Redirect request. * @throws Exception exception */ @Test public void redirect() throws Exception { final String f = "declare %R:path('') function m:a() { element R:redirect { 'a' } };" + "declare %R:path('a') function m:b() { 'R' };"; get(f, "", "R"); } /** * Forward request. * @throws Exception exception */ @Test public void forward() throws Exception { final String f = "declare %R:path('') function m:a() { element R:forward { 'a' } };" + "declare %R:path('a') function m:b() { 'F' };"; get(f, "", "F"); } /** * Error. * @throws Exception exception */ @Test public void error() throws Exception { // catch errors get("declare %R:path('') function m:a() { error() };" + "declare %R:error('*') function m:b() { 'F' };", "", "F"); get("declare %R:path('') function m:a() { error(xs:QName('x')) };" + "declare %R:error('x') function m:b() { 'F' };", "", "F"); // error (no appropriate error annotation) getE("declare %R:path('') function m:a() { error(xs:QName('x')) };" + "declare %R:error('y') function m:b() { 'F' };", ""); // duplicate error annotations getE("declare %R:path('') function m:a() { () };" + "declare %R:error('*') function m:b() { 'F' };" + "declare %R:error('*') function m:b() { 'F' };", ""); // duplicate error annotations getE("declare %R:path('') function m:a() { () };" + "declare %R:error('*') %R:error('*') function m:b() { 'F' };", ""); } /** * Error. * @throws Exception exception */ @Test public void errorParam() throws Exception { // catch errors get("declare %R:path('') function m:a() { error() };" + "declare %R:error('*') %R:error-param('code','{$x}') " + "function m:b($x) { $x };", "", "err:FOER0000"); get("declare %R:path('') function m:a() { error(xs:QName('x')) };" + "declare %R:error('*') %R:error-param('code','{$x}') " + "function m:b($x) { $x };", "", "x"); get("declare %R:path('') function m:a() { error(xs:QName('x'), '!!!') };" + "declare %R:error('*') %R:error-param('description','{$x}') " + "function m:b($x) { $x };", "", "!!!"); } // PRIVATE METHODS ========================================================== /** * Executes the specified POST request and tests the result. * @param function function to test * @param query request * @param exp expected result * @param request request body * @param param post parameters * @throws IOException I/O exception */ private static void post(final String function, final String query, final String exp, final String request, final String param) throws IOException { install(function); assertEquals(exp, post(query, request, param)); } /** * Executes the specified GET request and tests the result. * @param function function to test * @param query request * @param exp expected result * @throws IOException I/O exception */ private static void get(final String function, final String query, final String exp) throws IOException { install(function); assertEquals(exp, get(query)); } /** * Executes the specified GET request and tests for an error. * @param function function to test * @param query request * @throws IOException I/O exception */ private static void getE(final String function, final String query) throws IOException { install(function); try { get(query); fail("Error expected: " + query); } catch(final BaseXException ex) { } } /** * Executes the specified HEAD request and tests the result. * @param function function to test * @param query request * @param exp expected result * @throws IOException I/O exception */ private static void head(final String function, final String query, final String exp) throws IOException { install(function); assertEquals(exp, head(query)); } /** * Executes the specified HEAD request and tests for an error. * @param function function to test * @param query request * @throws IOException I/O exception */ private static void headE(final String function, final String query) throws IOException { install(function); try { head(query); fail("Error expected: " + query); } catch(final BaseXException ex) { } } /** * Installs a new module and removes all others. * @param function function to be tested * @throws IOException I/O exception */ private static void install(final String function) throws IOException { // delete old module final String path = context.mprop.get(MainProp.WEBPATH); for(final IOFile f : new IOFile(path).children()) assertTrue(f.delete()); // create new module module().write(new TokenBuilder(HEADER).add(function).finish()); } /** * Returns the XQuery test module. * @return test module */ private static IOFile module() { final String path = context.mprop.get(MainProp.WEBPATH); return new IOFile(path, NAME + count++ + IO.XQMSUFFIX); } } basex-7.7.2/basex-api/src/test/java/org/basex/test/http/ServerFnHttpTest.java000066400000000000000000000006661222453003200271160ustar00rootroot00000000000000package org.basex.test.http; import org.basex.core.*; import org.junit.*; /** * This class tests the embedded HTTP Client. * * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ public class ServerFnHttpTest extends FnHttpTest { /** * Start server. * @throws Exception exception */ @BeforeClass public static void start() throws Exception { init(RESTURL, false); ctx = new Context(); } } basex-7.7.2/basex-api/src/test/java/org/basex/test/http/ServerRESTTest.java000066400000000000000000000005761222453003200264700ustar00rootroot00000000000000package org.basex.test.http; import org.junit.*; /** * This class tests the server-based REST API. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class ServerRESTTest extends RESTTest { /** * Start server. * @throws Exception exception */ @BeforeClass public static void start() throws Exception { init(ROOT, false); } } basex-7.7.2/basex-api/src/test/java/org/basex/test/http/SessionTest.java000066400000000000000000000037521222453003200261460ustar00rootroot00000000000000package org.basex.test.http; import static org.junit.Assert.*; import java.net.*; import org.basex.core.*; import org.basex.util.*; import org.junit.*; /** * This class tests the Request Module. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class SessionTest extends HTTPTest { /** Root path. */ protected static final String ROOT = "http://" + Text.LOCALHOST + ":9998/rest/"; /** * Start server. * @throws Exception exception */ @BeforeClass public static void start() throws Exception { init(ROOT, true); } /** * Function test. * @throws Exception exception */ @Test public void id() throws Exception { assertEquals("1", get("?query=" + request("count(S:id())"))); } /** * Function test. * @throws Exception exception */ @Test public void names() throws Exception { assertEquals("a", get("?query=" + request("S:set('a','b'), S:names()"))); } /** * Function test. * @throws Exception exception */ @Test public void get() throws Exception { assertEquals("", get("?query=" + request("S:get('a')"))); } /** * Function test. * @throws Exception exception */ @Test public void set() throws Exception { final String query = "S:set('a','b'), S:get('a')"; assertEquals("b", get("?query=" + request(query))); } /** * Function test. * @throws Exception exception */ @Test public void close() throws Exception { assertEquals("", get("?query=" + request("S:close()"))); } // PRIVATE METHODS ==================================================================== /** * Returns an encoded version of the query, including a Request module import. * @param query query string * @return prepared query * @throws Exception exception */ private static String request(final String query) throws Exception { return URLEncoder.encode("import module namespace " + "S='http://basex.org/modules/session';" + query, Token.UTF8); } } basex-7.7.2/basex-api/src/test/java/org/basex/test/package.html000066400000000000000000000001011222453003200243030ustar00rootroot00000000000000 Contains classes for testing the project code. basex-7.7.2/basex-api/src/test/resources/000077500000000000000000000000001222453003200202535ustar00rootroot00000000000000basex-7.7.2/basex-api/src/test/resources/.empty000066400000000000000000000000001222453003200214000ustar00rootroot00000000000000basex-7.7.2/basex-api/src/test/resources/.gitignore000066400000000000000000000000001222453003200222310ustar00rootroot00000000000000basex-7.7.2/basex-api/src/test/resources/bxq.properties000066400000000000000000000000701222453003200231600ustar00rootroot00000000000000XQDataSourceClassName = org.basex.api.xqj.BXQDataSource basex-7.7.2/basex-api/src/test/resources/first.xml000066400000000000000000000000561222453003200221250ustar00rootroot00000000000000First Document basex-7.7.2/basex-api/src/test/resources/input.xml000066400000000000000000000006471222453003200221430ustar00rootroot00000000000000 XML

Databases & XML

Assignments
  • Exercise 1
  • Exercise 2
basex-7.7.2/basex-api/src/test/resources/second.xml000066400000000000000000000000611222453003200222450ustar00rootroot00000000000000Second Document basex-7.7.2/basex-api/src/test/resources/third.xml000066400000000000000000000000561222453003200221100ustar00rootroot00000000000000Third Document basex-7.7.2/basex-core/000077500000000000000000000000001222453003200146525ustar00rootroot00000000000000basex-7.7.2/basex-core/.checkstyle000066400000000000000000000013431222453003200170120ustar00rootroot00000000000000 basex-7.7.2/basex-core/.classpath000066400000000000000000000014041222453003200166340ustar00rootroot00000000000000 basex-7.7.2/basex-core/.gitignore000066400000000000000000000000221222453003200166340ustar00rootroot00000000000000/doc /lib /target basex-7.7.2/basex-core/.project000066400000000000000000000016361222453003200163270ustar00rootroot00000000000000 basex-core org.eclipse.jdt.core.javabuilder org.maven.ide.eclipse.maven2Builder net.sf.eclipsecs.core.CheckstyleBuilder org.eclipse.m2e.core.maven2Builder org.eclipse.m2e.core.maven2Nature org.maven.ide.eclipse.maven2Nature org.eclipse.jdt.core.javanature net.sf.eclipsecs.core.CheckstyleNature basex-7.7.2/basex-core/.settings/000077500000000000000000000000001222453003200165705ustar00rootroot00000000000000basex-7.7.2/basex-core/.settings/checkstyle.xml000066400000000000000000000121051222453003200214470ustar00rootroot00000000000000 basex-7.7.2/basex-core/.settings/dict000066400000000000000000000056271222453003200174500ustar00rootroot00000000000000admin alexander alright andreas attlist auctions bastian blockwise bool charset checkbox checkboxes classpath clickable clipboard closable cmd codepoint codepoints colorize combo combobox comp conformance constr coords ctx damerau db dbname deactivate deactivates decompress decompressed decompresses dennis diacritics dir doctype download dublin editable eg egli endian erdal eval expr externalized filesystem fragmentation freq frontend fs ft ftcontains ftdata ftnot fullscreen fulltext gath gruen gui hannes hauser hidders highlighter holdability holupirek html idf idpos ids init inline inlined int io ip iter iterable jan javax jens joerg karaca kircher klinger konstanz launch lemke leo levenshtein lewandowski linux lithuanian localhost logarithmic logo lowercase lukas mac makoto markup materialization metadata michael michiels mille min monospace multimedia namespace namespaces nillable nmtoken nodeset nth num ok permille petrowsky philipp philippe placeholder poi popup pos pragma pragmas pre precalculates pred preds qizx qname realtime redo reparsed reversable rositsa sax schwarz scrollbar sebastian seiferle seq serializer shadura shneiderman snippet spannable specs squarified standalone stefan stopword stopwords str stratmann synchsafe teubner textfield tf thesaurus thumbnail thumbnails tim timestamp timezone tmp todo tokenize tokenizer tokenizers tokenizes toolbar tooltip treemap trie typeswitch ubuntu unicode unpin unpinned unpins unscanned uppercase uri url var warmups weiler whitespaces wildcard wildcards woerteler wolfgang workgroup xmark xml xmlns xpath xq xquery za ziemer zipped inlining accessor fallback orderedness glob castable erat stemmers dimitar popov tokenizable enum bulgarian czech danish persian finnish hungarian korean dutch norwegian portuguese romanian swedish turkish thai stemmer snowball tokenized multithreading curr lexer apache lucene lexing tokenization compressor util deselects snippets subtoken elmedin dedovic mnenomics mnemomic throwable lyubomyr havrylyuk todor grigoriev wiki multipart graf mutex deactivated zip href thrw cyrillic dmitry saxon incl arity malformed versioning validator zipping unzip payload credentials xslt unwatches unwatching unwatch username aaron donovan json lossless homepage milton rollbacks jetty servlet http mime clark streamable authentification optimizable stdin payloads keystore mnemomics ascii adam standardised infos proxy automagic servlets param urlencoded www sandbox sandboxed tabbed charles endpoint kronberg kirsten dirk gaussian specifity stockton rafael santos cookbook hedenus xqdoc flwor restxq downgrade downgrades unescape spec jsonml basex-7.7.2/basex-core/.settings/org.eclipse.core.resources.prefs000066400000000000000000000002711222453003200250030ustar00rootroot00000000000000eclipse.preferences.version=1 encoding//src/main/java=UTF-8 encoding//src/main/resources=UTF-8 encoding//src/test/java=UTF-8 encoding//src/test/resources=UTF-8 encoding/=UTF-8 basex-7.7.2/basex-core/.settings/org.eclipse.core.runtime.prefs000066400000000000000000000001211222453003200244460ustar00rootroot00000000000000#Mon Feb 14 18:03:25 CET 2011 eclipse.preferences.version=1 line.separator=\n basex-7.7.2/basex-core/.settings/org.eclipse.jdt.core.prefs000066400000000000000000000727011222453003200235610ustar00rootroot00000000000000eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.doc.comment.support=enabled org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning org.eclipse.jdt.core.compiler.problem.deadCode=warning org.eclipse.jdt.core.compiler.problem.deprecation=ignore org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled org.eclipse.jdt.core.compiler.problem.fieldHiding=warning org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=private org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=enabled org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error org.eclipse.jdt.core.compiler.problem.nullReference=warning org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=enabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning org.eclipse.jdt.core.compiler.problem.unclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled org.eclipse.jdt.core.compiler.problem.unusedImport=warning org.eclipse.jdt.core.compiler.problem.unusedLabel=warning org.eclipse.jdt.core.compiler.problem.unusedLocal=warning org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore org.eclipse.jdt.core.compiler.problem.unusedParameter=warning org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.compiler.taskCaseSensitive=disabled org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL org.eclipse.jdt.core.compiler.taskTags=TODO,[CG],[AH],[LK],[CG],[MS],[DP],[LW],[JE],[DK],[MSG] org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=90 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=0 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.comment.clear_blank_lines=true org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false org.eclipse.jdt.core.formatter.comment.format_block_comments=true org.eclipse.jdt.core.formatter.comment.format_comments=false org.eclipse.jdt.core.formatter.comment.format_header=true org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true org.eclipse.jdt.core.formatter.comment.format_line_comments=true org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=do not insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert org.eclipse.jdt.core.formatter.comment.line_length=96 org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=2 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true org.eclipse.jdt.core.formatter.lineSplit=96 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=space org.eclipse.jdt.core.formatter.tabulation.size=2 org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true basex-7.7.2/basex-core/.settings/org.eclipse.jdt.ui.prefs000066400000000000000000000053341222453003200232440ustar00rootroot00000000000000#Sat Feb 04 16:59:42 CET 2012 cleanup.add_default_serial_version_id=true cleanup.add_generated_serial_version_id=false cleanup.add_missing_annotations=true cleanup.add_missing_deprecated_annotations=true cleanup.add_missing_methods=false cleanup.add_missing_nls_tags=false cleanup.add_missing_override_annotations=true cleanup.add_missing_override_annotations_interface_methods=true cleanup.add_serial_version_id=false cleanup.always_use_blocks=true cleanup.always_use_parentheses_in_expressions=false cleanup.always_use_this_for_non_static_field_access=false cleanup.always_use_this_for_non_static_method_access=false cleanup.convert_to_enhanced_for_loop=true cleanup.correct_indentation=false cleanup.format_source_code=false cleanup.format_source_code_changes_only=false cleanup.make_local_variable_final=true cleanup.make_parameters_final=true cleanup.make_private_fields_final=true cleanup.make_type_abstract_if_missing_method=false cleanup.make_variable_declarations_final=true cleanup.never_use_blocks=false cleanup.never_use_parentheses_in_expressions=true cleanup.organize_imports=false cleanup.qualify_static_field_accesses_with_declaring_class=false cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true cleanup.qualify_static_member_accesses_with_declaring_class=true cleanup.qualify_static_method_accesses_with_declaring_class=false cleanup.remove_private_constructors=true cleanup.remove_trailing_whitespaces=false cleanup.remove_trailing_whitespaces_all=true cleanup.remove_trailing_whitespaces_ignore_empty=false cleanup.remove_unnecessary_casts=true cleanup.remove_unnecessary_nls_tags=true cleanup.remove_unused_imports=true cleanup.remove_unused_local_variables=false cleanup.remove_unused_private_fields=true cleanup.remove_unused_private_members=false cleanup.remove_unused_private_methods=true cleanup.remove_unused_private_types=true cleanup.sort_members=false cleanup.sort_members_all=false cleanup.use_blocks=false cleanup.use_blocks_only_for_return_and_throw=false cleanup.use_parentheses_in_expressions=true cleanup.use_this_for_non_static_field_access=false cleanup.use_this_for_non_static_field_access_only_if_necessary=true cleanup.use_this_for_non_static_method_access=false cleanup.use_this_for_non_static_method_access_only_if_necessary=true cleanup_profile=_BaseX cleanup_settings_version=2 eclipse.preferences.version=1 formatter_profile=_BaseX Formatter Profile formatter_settings_version=11 org.eclipse.jdt.ui.ignorelowercasenames=true org.eclipse.jdt.ui.importorder=java;javax;org;com; org.eclipse.jdt.ui.ondemandthreshold=1 org.eclipse.jdt.ui.staticondemandthreshold=1 basex-7.7.2/basex-core/.settings/org.eclipse.ltk.core.refactoring.prefs000066400000000000000000000002111222453003200260570ustar00rootroot00000000000000#Fri Mar 19 00:48:33 CET 2010 eclipse.preferences.version=1 org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false basex-7.7.2/basex-core/.settings/org.eclipse.m2e.core.prefs000066400000000000000000000001321222453003200234500ustar00rootroot00000000000000activeProfiles= eclipse.preferences.version=1 resolveWorkspaceProjects=true version=1 basex-7.7.2/basex-core/.settings/org.maven.ide.eclipse.prefs000066400000000000000000000004171222453003200237120ustar00rootroot00000000000000#Fri Jan 29 18:36:39 CET 2010 activeProfiles= eclipse.preferences.version=1 fullBuildGoals=process-test-resources includeModules=false resolveWorkspaceProjects=true resourceFilterGoals=process-resources resources\:testResources skipCompilerPlugin=true version=1 basex-7.7.2/basex-core/basex.iml000066400000000000000000000030661222453003200164640ustar00rootroot00000000000000 basex-7.7.2/basex-core/etc/000077500000000000000000000000001222453003200154255ustar00rootroot00000000000000basex-7.7.2/basex-core/etc/basex000077500000000000000000000012641222453003200164600ustar00rootroot00000000000000#!/usr/bin/env bash # Path to this script FILE="${BASH_SOURCE[0]}" while [ -h "$FILE" ] ; do SRC="$(readlink "$FILE")" FILE="$( cd -P "$(dirname "$FILE")" && \ cd -P "$(dirname "$SRC")" && pwd )/$(basename "$SRC")" done BX="$( cd -P "$(dirname "$FILE")/.." && pwd )" # Core and library classes CP="$BX/target/classes" CP="$CP$(for JAR in "$BX"/lib/*.jar; do echo -n ":$JAR"; done)" # Options for virtual machine VM=-Xmx512m general_args=( ) vm_args=( ) while (( $# )) ; do if [[ $1 = "-X" ]] ; then vm_args+=( "$2" ) shift 2 else general_args+=( "$1" ) shift fi done # Run code java -cp "$CP" $VM "${vm_args[@]}" org.basex.BaseX "${general_args[@]}" basex-7.7.2/basex-core/etc/basex.bat000066400000000000000000000005131222453003200172160ustar00rootroot00000000000000@echo off setLocal EnableDelayedExpansion REM Path to this script set PWD=%~dp0 REM Core and library classes set CP=%PWD%/../target/classes set LIB=%PWD%/../lib for /R "%LIB%" %%a in (*.jar) do set CP=!CP!;%%a REM Options for virtual machine set VM=-Xmx512m REM Run code java -cp "%CP%" %VM% org.basex.BaseX %* basex-7.7.2/basex-core/etc/basexclient000077500000000000000000000012621222453003200176550ustar00rootroot00000000000000#!/usr/bin/env bash # Path to this script FILE="${BASH_SOURCE[0]}" while [ -h "$FILE" ] ; do SRC="$(readlink "$FILE")" FILE="$( cd -P "$(dirname "$FILE")" && \ cd -P "$(dirname "$SRC")" && pwd )/$(basename "$SRC")" done BX="$( cd -P "$(dirname "$FILE")/.." && pwd )" # Core and library classes CP="$BX/target/classes" CP="$CP$(for JAR in "$BX"/lib/*.jar; do echo -n ":$JAR"; done)" general_args=( ) vm_args=( ) while (( $# )) ; do if [[ $1 = "-X" ]] ; then vm_args+=( "$2" ) shift 2 else general_args+=( "$1" ) shift fi done # Options for virtual machine VM= # Run code java -cp "$CP" $VM "${vm_args[@]}" org.basex.BaseXClient "${general_args[@]}" basex-7.7.2/basex-core/etc/basexclient.bat000066400000000000000000000005111222453003200204130ustar00rootroot00000000000000@echo off setLocal EnableDelayedExpansion REM Path to this script set PWD=%~dp0 REM Core and library classes set CP=%PWD%/../target/classes set LIB=%PWD%/../lib for /R "%LIB%" %%a in (*.jar) do set CP=!CP!;%%a REM Options for virtual machine set VM= REM Run code java -cp "%CP%" %VM% org.basex.BaseXClient %* basex-7.7.2/basex-core/etc/basexgui000077500000000000000000000012671222453003200171700ustar00rootroot00000000000000#!/usr/bin/env bash # Path to this script FILE="${BASH_SOURCE[0]}" while [ -h "$FILE" ] ; do SRC="$(readlink "$FILE")" FILE="$( cd -P "$(dirname "$FILE")" && \ cd -P "$(dirname "$SRC")" && pwd )/$(basename "$SRC")" done BX="$( cd -P "$(dirname "$FILE")/.." && pwd )" # Core and library classes CP="$BX/target/classes" CP="$CP$(for JAR in "$BX"/lib/*.jar; do echo -n ":$JAR"; done)" # Options for virtual machine VM=-Xmx512m general_args=( ) vm_args=( ) while (( $# )) ; do if [[ $1 = "-X" ]] ; then vm_args+=( "$2" ) shift 2 else general_args+=( "$1" ) shift fi done # Run code java -cp "$CP" $VM "${vm_args[@]}" org.basex.BaseXGUI "${general_args[@]}" basex-7.7.2/basex-core/etc/basexgui.bat000066400000000000000000000005251222453003200177260ustar00rootroot00000000000000@echo off setLocal EnableDelayedExpansion REM Path to this script set PWD=%~dp0 REM Core and library classes set CP=%PWD%/../target/classes set LIB=%PWD%/../lib for /R "%LIB%" %%a in (*.jar) do set CP=!CP!;%%a REM Options for virtual machine set VM=-Xmx512m REM Run code start javaw -cp "%CP%" %VM% org.basex.BaseXGUI %* basex-7.7.2/basex-core/etc/basexserver000077500000000000000000000012721222453003200177060ustar00rootroot00000000000000#!/usr/bin/env bash # Path to this script FILE="${BASH_SOURCE[0]}" while [ -h "$FILE" ] ; do SRC="$(readlink "$FILE")" FILE="$( cd -P "$(dirname "$FILE")" && \ cd -P "$(dirname "$SRC")" && pwd )/$(basename "$SRC")" done BX="$( cd -P "$(dirname "$FILE")/.." && pwd )" # Core and library classes CP="$BX/target/classes" CP="$CP$(for JAR in "$BX"/lib/*.jar; do echo -n ":$JAR"; done)" # Options for virtual machine VM=-Xmx512m general_args=( ) vm_args=( ) while (( $# )) ; do if [[ $1 = "-X" ]] ; then vm_args+=( "$2" ) shift 2 else general_args+=( "$1" ) shift fi done # Run code java -cp "$CP" $VM "${vm_args[@]}" org.basex.BaseXServer "${general_args[@]}" basex-7.7.2/basex-core/etc/basexserver.bat000066400000000000000000000005211222453003200204440ustar00rootroot00000000000000@echo off setLocal EnableDelayedExpansion REM Path to this script set PWD=%~dp0 REM Core and library classes set CP=%PWD%/../target/classes set LIB=%PWD%/../lib for /R "%LIB%" %%a in (*.jar) do set CP=!CP!;%%a REM Options for virtual machine set VM=-Xmx512m REM Run code java -cp "%CP%" %VM% org.basex.BaseXServer %* basex-7.7.2/basex-core/etc/basexserverstop000077500000000000000000000005761222453003200206220ustar00rootroot00000000000000#!/usr/bin/env bash # Path to this script FILE="${BASH_SOURCE[0]}" while [ -h "$FILE" ] ; do SRC="$(readlink "$FILE")" FILE="$( cd -P "$(dirname "$FILE")" && \ cd -P "$(dirname "$SRC")" && pwd )/$(basename "$SRC")" done BX="$( cd -P "$(dirname "$FILE")/.." && pwd )" # Core classes CP="$BX/target/classes" # Run code java -cp "$CP" org.basex.BaseXServer "$@" stop basex-7.7.2/basex-core/etc/basexserverstop.bat000066400000000000000000000005161222453003200213560ustar00rootroot00000000000000@echo off setLocal EnableDelayedExpansion REM Path to this script set PWD=%~dp0 REM Core and library classes set CP=%PWD%/../target/classes set LIB=%PWD%/../lib for /R "%LIB%" %%a in (*.jar) do set CP=!CP!;%%a REM Options for virtual machine set VM= REM Run code java -cp "%CP%" %VM% org.basex.BaseXServer %* stop basex-7.7.2/basex-core/pom.xml000066400000000000000000000072271222453003200161770ustar00rootroot00000000000000 4.0.0 basex org.basex basex-parent 7.7.2 .. BaseX Core junit junit jp.sourceforge.igo igo true org.apache lucene-stemmers true org.ccil.cowan.tagsoup tagsoup true xml-resolver xml-resolver true jline jline true ${project.artifactId}-${project.version} org.codehaus.mojo javacc-maven-plugin org.apache.maven.plugins maven-compiler-plugin false org.apache.maven.plugins maven-jar-plugin org.basex.BaseXGUI org.basex img/start.png org.apache.maven.plugins maven-surefire-plugin org.apache.maven.plugins maven-source-plugin org.apache.maven.plugins maven-dependency-plugin org.codehaus.mojo exec-maven-plugin org.basex.BaseXGUI org.apache.maven.plugins maven-deploy-plugin basex-7.7.2/basex-core/src/000077500000000000000000000000001222453003200154415ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/000077500000000000000000000000001222453003200163655ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/000077500000000000000000000000001222453003200173065ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/000077500000000000000000000000001222453003200200755ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/000077500000000000000000000000001222453003200211775ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/BaseX.java000066400000000000000000000171331222453003200230510ustar00rootroot00000000000000package org.basex; import static org.basex.core.Text.*; import java.io.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.io.*; import org.basex.io.out.*; import org.basex.io.serial.*; import org.basex.server.*; import org.basex.util.*; import org.basex.util.list.*; /** * This is the starter class for the stand-alone console mode. * It executes all commands locally. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class BaseX extends Main { /** Commands to be executed. */ private IntList ops; /** Command arguments. */ private StringList vals; /** Flag for writing properties to disk. */ private boolean writeProps; /** * Main method, launching the standalone mode. * Command-line arguments are listed with the {@code -h} argument. * @param args command-line arguments */ public static void main(final String... args) { try { new BaseX(args); } catch(final IOException ex) { Util.errln(ex); System.exit(1); } } /** * Constructor. * @param args command-line arguments * @throws IOException I/O exception */ public BaseX(final String... args) throws IOException { super(args); // create session to show optional login request session(); final StringBuilder serial = new StringBuilder(); final StringBuilder bind = new StringBuilder(); boolean v = false, qi = false, qp = false; console = true; try { // loop through all commands for(int i = 0; i < ops.size(); i++) { final int c = ops.get(i); String val = vals.get(i); Object[] prop = null; if(c == 'b') { // set/add variable binding if(bind.length() != 0) bind.append(','); // commas are escaped by a second comma val = bind.append(val.replaceAll(",", ",,")).toString(); prop = Prop.BINDINGS; } else if(c == 'c') { // evaluate commands final IO io = IO.get(val); String base = "."; if(io.exists() && !io.isDir()) { val = io.string(); base = io.path(); } execute(new Set(Prop.QUERYPATH, base), false); execute(val); execute(new Set(Prop.QUERYPATH, ""), false); console = false; } else if(c == 'd') { // toggle debug mode Prop.debug ^= true; } else if(c == 'D') { // hidden option: show/hide dot query graph prop = Prop.DOTPLAN; } else if(c == 'i') { // open database or create main memory representation execute(new Set(Prop.MAINMEM, true), false); execute(new Check(val), verbose); execute(new Set(Prop.MAINMEM, false), false); } else if(c == 'L') { // toggle newline separators newline ^= true; if(serial.length() != 0) serial.append(','); val = serial.append(SerializerProp.S_ITEM_SEPARATOR[0]).append("=\\n"). toString(); prop = Prop.SERIALIZER; } else if(c == 'o') { // change output stream if(out != System.out) out.close(); out = new PrintOutput(val); session().setOutputStream(out); } else if(c == 'q') { // evaluate query execute(new XQuery(val), verbose); console = false; } else if(c == 'Q') { // evaluate file contents or string as query final IO io = IO.get(val); String base = "."; if(io.exists() && !io.isDir()) { val = io.string(); base = io.path(); } execute(new Set(Prop.QUERYPATH, base), false); execute(new XQuery(val), verbose); execute(new Set(Prop.QUERYPATH, ""), false); console = false; } else if(c == 'r') { // hidden option: parse number of runs prop = Prop.RUNS; } else if(c == 's') { // set/add serialization parameter if(serial.length() != 0) serial.append(','); val = serial.append(val).toString(); prop = Prop.SERIALIZER; } else if(c == 'u') { // (de)activate write-back for updates prop = Prop.WRITEBACK; } else if(c == 'v') { // show/hide verbose mode v ^= true; } else if(c == 'V') { // show/hide query info qi ^= true; prop = Prop.QUERYINFO; } else if(c == 'w') { // toggle chopping of whitespaces prop = Prop.CHOP; } else if(c == 'W') { // hidden option: toggle writing of properties before exit writeProps ^= true; } else if(c == 'x') { // show/hide xml query plan prop = Prop.XMLPLAN; qp ^= true; } else if(c == 'X') { // hidden option: show query plan before/after query compilation prop = Prop.COMPPLAN; } else if(c == 'z') { // toggle result serialization prop = Prop.SERIALIZE; } if(prop != null) execute(new Set(prop, val), false); verbose = qi || qp || v; } if(console) { verbose = true; // enter interactive mode Util.outln(CONSOLE + TRY_MORE_X, sa() ? LOCALMODE : CLIENTMODE); console(); } if(writeProps) context.mprop.write(); } finally { quit(); } } /** * Tests if this client is stand-alone. * @return stand-alone flag */ protected boolean sa() { return true; } @Override protected Session session() throws IOException { if(session == null) session = new LocalSession(context, out); session.setOutputStream(out); return session; } @Override protected final void parseArguments(final String... args) throws IOException { ops = new IntList(); vals = new StringList(); final Args arg = new Args(args, this, sa() ? LOCALINFO : CLIENTINFO, Util.info(CONSOLE, sa() ? LOCALMODE : CLIENTMODE)); while(arg.more()) { final char c; String v = null; if(arg.dash()) { c = arg.next(); if(c == 'b' || c == 'c' || c == 'C' || c == 'i' || c == 'o' || c == 'q' || c == 'r' || c == 's') { // options followed by a string v = arg.string(); } else if(c == 'd' || c == 'D' && sa() || c == 'L' || c == 'u' || c == 'v' || c == 'V' || c == 'w' || c == 'W' || c == 'x' || c == 'X' || c == 'z') { // options to be toggled v = ""; } else if(!sa()) { // client options: need to be set before other options if(c == 'n') { // set server name context.mprop.set(MainProp.HOST, arg.string()); } else if(c == 'p') { // set server port context.mprop.set(MainProp.PORT, arg.number()); } else if(c == 'P') { // specify password context.mprop.set(MainProp.PASSWORD, arg.string()); } else if(c == 'U') { // specify user name context.mprop.set(MainProp.USER, arg.string()); } else { arg.usage(); } } else { arg.usage(); } } else { v = arg.string().trim(); // interpret as commands if input ends with command script suffix c = v.endsWith(IO.BXSSUFFIX) ? 'c' : 'Q'; } if(v != null) { ops.add(c); vals.add(v); } } } } basex-7.7.2/basex-core/src/main/java/org/basex/BaseXClient.java000066400000000000000000000030101222453003200241750ustar00rootroot00000000000000package org.basex; import static org.basex.core.Text.*; import java.io.*; import org.basex.core.*; import org.basex.server.*; import org.basex.util.*; /** * This is the starter class for the client console mode. * All input is sent to the server instance. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BaseXClient extends BaseX { /** * Main method of the database client, launching a client instance. * Command-line arguments are listed with the {@code -h} argument. * @param args command-line arguments */ public static void main(final String... args) { try { new BaseXClient(args); } catch(final IOException ex) { Util.errln(ex); System.exit(1); } } /** * Constructor. * @param args command-line arguments * @throws IOException I/O exception */ public BaseXClient(final String... args) throws IOException { super(args); } @Override protected boolean sa() { return false; } @Override protected Session session() throws IOException { if(session == null) { // user/password input String user = context.mprop.get(MainProp.USER); String pass = context.mprop.get(MainProp.PASSWORD); while(user.isEmpty()) { Util.out(USERNAME + COLS); user = Util.input(); } while(pass.isEmpty()) { Util.out(PASSWORD + COLS); pass = Util.password(); } session = new ClientSession(context, user, pass, out); } return session; } } basex-7.7.2/basex-core/src/main/java/org/basex/BaseXGUI.java000066400000000000000000000106061222453003200234140ustar00rootroot00000000000000package org.basex; import static org.basex.core.Text.*; import java.awt.*; import java.util.*; import javax.swing.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.gui.*; import org.basex.gui.dialog.*; import org.basex.io.*; import org.basex.util.*; import org.basex.util.list.*; /** * This is the starter class for the graphical frontend. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BaseXGUI { /** Database context. */ private final Context context = new Context(); /** Files, specified as arguments. */ private final StringList files = new StringList(); /** Mac OS X GUI optimizations. */ GUIMacOSX osxGUI; /** * Main method. * @param args text files to open: XML documents, queries, etc. */ public static void main(final String... args) { try { new BaseXGUI(args); } catch(final BaseXException ex) { Util.errln(ex); System.exit(1); } } /** * Constructor. * @param args command-line arguments * @throws BaseXException database exception */ public BaseXGUI(final String... args) throws BaseXException { parseArguments(args); // set mac specific properties if(Prop.MAC) { try { osxGUI = new GUIMacOSX(); } catch(final Exception ex) { throw new BaseXException("Failed to initialize native Mac OS X interface", ex); } } // read properties final GUIProp gprop = new GUIProp(); // cache results to pass them on to all visualizations context.prop.set(Prop.CACHEQUERY, true); // reduce number of results to save memory context.prop.set(Prop.MAXHITS, gprop.num(GUIProp.MAXHITS)); // initialize fonts and colors GUIConstants.init(gprop); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { // initialize look and feel init(gprop); // open main window final GUI gui = new GUI(context, gprop); if(osxGUI != null) osxGUI.init(gui); // open specified document or database boolean xml = false; for(final String file : files) { if(file.matches("^.*\\" + IO.BASEXSUFFIX + "[^.]*$")) continue; final IOFile io = new IOFile(file); boolean xq = file.endsWith(IO.BXSSUFFIX); for(final String suf : IO.XQSUFFIXES) xq |= file.endsWith(suf); if(xq) { gui.editor.open(io, true); } else if(!xml) { // only parse first xml file gprop.set(GUIProp.INPUTPATH, io.path()); gprop.set(GUIProp.DBNAME, io.dbname()); DialogProgress.execute(gui, new Check(file)); xml = true; } } } }); // guarantee correct shutdown of database context Runtime.getRuntime().addShutdownHook(new Thread() { @Override public synchronized void run() { context.close(); } }); } /** * Initializes the GUI. * @param prop gui properties */ static void init(final GUIProp prop) { try { // added to handle possible JDK 1.6 bug (thanks to Makoto Yui) UIManager.getInstalledLookAndFeels(); // refresh views when windows are resized Toolkit.getDefaultToolkit().setDynamicLayout(true); // set specified look & feel if(prop.is(GUIProp.JAVALOOK)) { // use non-bold fonts in Java's look & feel final UIDefaults def = UIManager.getDefaults(); final Enumeration en = def.keys(); while(en.hasMoreElements()) { final Object k = en.nextElement(); final Object v = def.get(k); if(v instanceof Font) def.put(k, ((Font) v).deriveFont(Font.PLAIN)); } } else { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } } catch(final Exception ex) { Util.stack(ex); } } /** * Parses the command-line arguments, specified by the user. * @param args command-line arguments * @throws BaseXException database exception */ private void parseArguments(final String[] args) throws BaseXException { final Args arg = new Args(args, this, GUIINFO, Util.info(CONSOLE, GUIMODE)); while(arg.more()) { if(arg.dash()) arg.usage(); files.add(arg.string()); } } } basex-7.7.2/basex-core/src/main/java/org/basex/BaseXServer.java000066400000000000000000000250601222453003200242360ustar00rootroot00000000000000package org.basex; import static org.basex.core.Text.*; import java.io.*; import java.net.*; import java.util.*; import org.basex.core.*; import org.basex.io.*; import org.basex.io.in.*; import org.basex.server.*; import org.basex.util.*; import org.basex.util.list.*; /** * This is the starter class for running the database server. It handles * concurrent requests from multiple users. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Andreas Weiler */ public final class BaseXServer extends Main implements Runnable { /** Flag for server activity. */ private volatile boolean running; /** Event server socket. */ private ServerSocket esocket; /** Stop file. */ private IOFile stop; /** New sessions. */ private final HashSet auth = new HashSet(); /** Stopped flag. */ private volatile boolean stopped; /** EventsListener. */ private EventListener events; /** Initial commands. */ private StringList commands; /** Server socket. */ private ServerSocket socket; /** Start as daemon. */ private boolean service; /** * Main method, launching the server process. * Command-line arguments are listed with the {@code -h} argument. * @param args command-line arguments */ public static void main(final String[] args) { try { new BaseXServer(args); } catch(final IOException ex) { Util.errln(ex); System.exit(1); } } /** * Constructor. * @param args command-line arguments * @throws IOException I/O exception */ public BaseXServer(final String... args) throws IOException { this(null, args); } /** * Constructor. * @param ctx database context * @param args command-line arguments * @throws IOException I/O exception */ public BaseXServer(final Context ctx, final String... args) throws IOException { super(args, ctx); final MainProp mprop = context.mprop; final int port = mprop.num(MainProp.SERVERPORT); final int eport = mprop.num(MainProp.EVENTPORT); // check if ports are distinct if(port == eport) throw new BaseXException(PORT_TWICE_X, port); final String host = mprop.get(MainProp.SERVERHOST); final InetAddress addr = host.isEmpty() ? null : InetAddress.getByName(host); if(service) { start(port, args); Util.outln(SRV_STARTED_PORT_X, port); Performance.sleep(1000); return; } if(stopped) { stop(port, eport); Util.outln(SRV_STOPPED_PORT_X, port); Performance.sleep(1000); return; } try { // execute command-line arguments for(final String c : commands) execute(c); socket = new ServerSocket(); // reuse address (on non-Windows machines: !Prop.WIN); socket.setReuseAddress(true); socket.bind(new InetSocketAddress(addr, port)); esocket = new ServerSocket(); esocket.setReuseAddress(true); esocket.bind(new InetSocketAddress(addr, eport)); stop = stopFile(port); // show info when server is aborted context.log.writeServer(OK, Util.info(SRV_STARTED_PORT_X, port)); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { context.log.writeServer(OK, Util.info(SRV_STOPPED_PORT_X, port)); Util.outln(SRV_STOPPED_PORT_X, port); } }); new Thread(this).start(); while(!running) Performance.sleep(10); Util.outln(CONSOLE + (console ? TRY_MORE_X : Util.info(SRV_STARTED_PORT_X, port)), SERVERMODE); if(console) { console(); quit(); } } catch(final IOException ex) { context.log.writeError(ex); throw ex; } } @Override public void run() { running = true; while(running) { try { final Socket s = socket.accept(); if(stop.exists()) { if(!stop.delete()) { context.log.writeServer(ERROR_C + Util.info(FILE_NOT_DELETED_X, stop)); } quit(); } else { // drop inactive connections final long ka = context.mprop.num(MainProp.KEEPALIVE) * 1000L; if(ka > 0) { final long ms = System.currentTimeMillis(); for(final ClientListener cs : context.sessions) { if(ms - cs.last > ka) cs.quit(); } } final ClientListener cl = new ClientListener(s, context, this); // start authentication timeout final long to = context.mprop.num(MainProp.KEEPALIVE) * 1000L; if(to > 0) { cl.auth.schedule(new TimerTask() { @Override public void run() { cl.quitAuth(); } }, to); auth.add(cl); } cl.start(); } } catch(final SocketException ex) { break; } catch(final Throwable ex) { // socket may have been unexpectedly closed Util.errln(ex); context.log.writeError(ex); break; } } } /** * Generates a stop file for the specified port. * @param port server port * @return stop file */ private static IOFile stopFile(final int port) { return new IOFile(Prop.TMP, Util.name(BaseXServer.class) + port); } @Override protected synchronized void quit() throws IOException { if(!running) return; running = false; for(final ClientListener cs : auth) { remove(cs); cs.quitAuth(); } for(final ClientListener cs : context.sessions) { cs.quit(); } super.quit(); try { // close interactive input if server was stopped by another process if(console) System.in.close(); esocket.close(); socket.close(); } catch(final IOException ex) { Util.errln(ex); context.log.writeError(ex); } console = false; } @Override protected Session session() { if(session == null) session = new LocalSession(context, out); return session; } @Override protected void parseArguments(final String... args) throws IOException { final Args arg = new Args(args, this, SERVERINFO, Util.info(CONSOLE, SERVERMODE)); commands = new StringList(); boolean daemon = false; while(arg.more()) { if(arg.dash()) { switch(arg.next()) { case 'c': // send database commands commands.add(arg.string()); break; case 'd': // activate debug mode Prop.debug = true; break; case 'D': // hidden flag: daemon mode daemon = true; break; case 'e': // parse event port context.mprop.set(MainProp.EVENTPORT, arg.number()); break; case 'i': // activate interactive mode console = true; break; case 'n': // parse host the server is bound to context.mprop.set(MainProp.SERVERHOST, arg.string()); break; case 'p': // parse server port context.mprop.set(MainProp.SERVERPORT, arg.number()); break; case 'S': // set service flag service = !daemon; break; case 'z': // suppress logging context.mprop.set(MainProp.LOG, false); break; default: arg.usage(); } } else { if(arg.string().equalsIgnoreCase("stop")) { stopped = true; } else { arg.usage(); } } } } /** * Stops the server of this instance. * @throws IOException I/O exception */ public void stop() throws IOException { final MainProp mprop = context.mprop; stop(mprop.num(MainProp.SERVERPORT), mprop.num(MainProp.EVENTPORT)); } // STATIC METHODS =========================================================== /** * Starts the database server in a separate process. * @param port server port * @param args command-line arguments * @throws BaseXException database exception */ public static void start(final int port, final String... args) throws BaseXException { // check if server is already running (needs some time) if(ping(LOCALHOST, port)) throw new BaseXException(SRV_RUNNING); Util.start(BaseXServer.class, args); // try to connect to the new server instance for(int c = 1; c < 10; ++c) { if(ping(LOCALHOST, port)) return; Performance.sleep(c * 100); } throw new BaseXException(CONNECTION_ERROR); } /** * Checks if a server is running. * @param host host * @param port server port * @return boolean success */ public static boolean ping(final String host, final int port) { try { // connect server with invalid login data new ClientSession(host, port, "", ""); return false; } catch(final LoginException ex) { // if login was checked, server is running return true; } catch(final IOException ex) { return false; } } /** * Stops the server. * @param port server port * @param eport event port * @throws IOException I/O exception */ public static void stop(final int port, final int eport) throws IOException { final IOFile stop = stopFile(port); try { stop.touch(); new Socket(LOCALHOST, eport).close(); new Socket(LOCALHOST, port).close(); // wait and check if server was really stopped do Performance.sleep(50); while(ping(LOCALHOST, port)); } catch(final IOException ex) { stop.delete(); throw ex; } } /** * Removes an authenticated session. * @param client client to be removed */ public void remove(final ClientListener client) { synchronized(auth) { auth.remove(client); client.auth.cancel(); } } /** * Initializes the event listener. */ public void initEvents() { if(events == null) { events = new EventListener(); events.start(); } } /** * Inner class to listen for event registrations. * * @author BaseX Team 2005-12, BSD License * @author Andreas Weiler */ final class EventListener extends Thread { @Override public void run() { while(running) { try { final Socket es = esocket.accept(); if(stop.exists()) { esocket.close(); break; } final BufferInput bi = new BufferInput(es.getInputStream()); final long id = Token.toLong(bi.readString()); for(final ClientListener s : context.sessions) { if(s.getId() == id) { s.register(es); break; } } } catch(final IOException ex) { break; } } } } } basex-7.7.2/basex-core/src/main/java/org/basex/api/000077500000000000000000000000001222453003200217505ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/api/dom/000077500000000000000000000000001222453003200225275ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/api/dom/BXAttr.java000066400000000000000000000037041222453003200245420ustar00rootroot00000000000000package org.basex.api.dom; import org.basex.query.util.*; import org.basex.query.value.node.*; import org.basex.util.*; import org.w3c.dom.*; /** * DOM - Attribute implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BXAttr extends BXNode implements Attr { /** * Constructor. * @param n node reference */ public BXAttr(final ANode n) { super(n); } @Override public String getNodeName() { return Token.string(node.name()); } @Override public String getLocalName() { return Token.string(Token.local(node.name())); } @Override public String getNodeValue() { return Token.string(node.string()); } @Override public String getName() { return getNodeName(); } @Override public String getNamespaceURI() { final byte[] uri = node.qname().uri(); return uri.length == 0 ? null : Token.string(uri); } @Override public BXNode getNextSibling() { return null; } @Override public BXNode getPreviousSibling() { return null; } @Override public BXElem getOwnerElement() { return (BXElem) getParentNode(); } @Override public String getValue() { return getNodeValue(); } @Override public boolean isId() { return false; } @Override public boolean getSpecified() { return false; } @Override public TypeInfo getSchemaTypeInfo() { throw Util.notimplemented(); } @Override public void setValue(final String value) { throw readOnly(); } @Override public BXText getFirstChild() { return new BXText(text()); } @Override public BXNList getChildNodes() { return new BXNList(new ANodeList(text())); } /** * Returns the attribute value as text node. * @return text node */ private FNode text() { return new FTxt(node.string()).parent(node); } } basex-7.7.2/basex-core/src/main/java/org/basex/api/dom/BXCData.java000066400000000000000000000007331222453003200246030ustar00rootroot00000000000000package org.basex.api.dom; import org.basex.query.value.node.*; import org.w3c.dom.*; /** * DOM - CData implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BXCData extends BXText implements CDATASection { /** * Constructor. * @param n node reference */ public BXCData(final ANode n) { super(n); } @Override protected int kind() { // type not specified in database return 6; } } basex-7.7.2/basex-core/src/main/java/org/basex/api/dom/BXChar.java000066400000000000000000000031371222453003200245050ustar00rootroot00000000000000package org.basex.api.dom; import org.basex.query.value.node.*; import org.basex.util.*; import org.w3c.dom.*; /** * DOM - Character data implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ abstract class BXChar extends BXNode implements CharacterData { /** * Constructor. * @param n node reference */ BXChar(final ANode n) { super(n); } @Override public final String getData() { return getNodeValue(); } @Override public final String getNodeValue() { return Token.string(node.string()); } @Override public final int getLength() { return node.string().length; } @Override public final String substringData(final int off, final int count) { final String val = getNodeValue(); if(count < 0 || off < 0 || off >= val.length()) throw new DOMException( DOMException.INDEX_SIZE_ERR, "Invalid size values."); return val.substring(off, Math.min(val.length(), off + count)); } @Override public final void appendData(final String value) { throw Util.notimplemented(); } @Override public final void deleteData(final int off, final int count) { throw Util.notimplemented(); } @Override public final void insertData(final int off, final String value) { throw Util.notimplemented(); } @Override public final void replaceData(final int off, final int count, final String value) { throw Util.notimplemented(); } @Override public final void setData(final String dat) { throw Util.notimplemented(); } } basex-7.7.2/basex-core/src/main/java/org/basex/api/dom/BXComm.java000066400000000000000000000006141222453003200245200ustar00rootroot00000000000000package org.basex.api.dom; import org.basex.query.value.node.*; import org.w3c.dom.*; /** * DOM - Comment implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BXComm extends BXChar implements Comment { /** * Constructor. * @param n node reference */ public BXComm(final ANode n) { super(n); } } basex-7.7.2/basex-core/src/main/java/org/basex/api/dom/BXDoc.java000066400000000000000000000101001222453003200243210ustar00rootroot00000000000000package org.basex.api.dom; import static org.basex.util.Token.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.util.*; import org.w3c.dom.*; /** * DOM - Document implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BXDoc extends BXNode implements Document { /** * Constructor. * @param n node reference */ public BXDoc(final ANode n) { super(n); } @Override public BXDoc getOwnerDocument() { return null; } @Override public BXNode adoptNode(final Node source) { throw readOnly(); } @Override public BXAttr createAttribute(final String nm) { return new BXAttr(new FAttr(new QNm(nm), EMPTY)); } @Override public BXAttr createAttributeNS(final String uri, final String qn) { return new BXAttr(new FAttr(new QNm(qn, uri), EMPTY)); } @Override public BXCData createCDATASection(final String dat) { return new BXCData(new FTxt(dat)); } @Override public BXComm createComment(final String dat) { return new BXComm(new FComm(dat)); } @Override public BXDocFrag createDocumentFragment() { return new BXDocFrag(new FDoc(node.baseURI())); } @Override public BXElem createElement(final String nm) { return new BXElem(new FElem(new QNm(nm))); } @Override public BXElem createElementNS(final String uri, final String qn) { return new BXElem(new FElem(new QNm(qn, uri))); } @Override public EntityReference createEntityReference(final String name) { throw readOnly(); } @Override public BXPI createProcessingInstruction(final String t, final String dat) { return new BXPI(new FPI(t, dat)); } @Override public BXText createTextNode(final String dat) { return new BXText(new FTxt(dat)); } @Override public DocumentType getDoctype() { return null; } @Override public BXElem getDocumentElement() { final BXNList list = getChildNodes(); for(int l = 0; l < list.getLength(); ++l) { final BXNode n = list.item(l); if(n.getNodeType() == Node.ELEMENT_NODE) return (BXElem) n; } throw Util.notexpected(); } @Override public String getDocumentURI() { return getBaseURI(); } @Override public DOMConfiguration getDomConfig() { throw Util.notimplemented(); } @Override public BXElem getElementById(final String elementId) { throw Util.notimplemented(); } @Override public BXNList getElementsByTagName(final String name) { return getElements(name); } @Override public BXNList getElementsByTagNameNS(final String namespaceURI, final String localName) { throw Util.notimplemented(); } @Override public DOMImplementation getImplementation() { return BXDomImpl.get(); } @Override public String getInputEncoding() { return UTF8; } @Override public boolean getStrictErrorChecking() { throw Util.notimplemented(); } @Override public String getXmlEncoding() { return UTF8; } @Override public boolean getXmlStandalone() { return false; } @Override public String getXmlVersion() { return "1.0"; } @Override public BXNode importNode(final Node importedNode, final boolean deep) { throw Util.notimplemented(); } @Override public void normalizeDocument() { throw readOnly(); } @Override public BXNode renameNode(final Node n, final String namespaceURI, final String qualifiedName) { throw readOnly(); } @Override public void setDocumentURI(final String documentURI) { throw readOnly(); } @Override public void setStrictErrorChecking(final boolean strictErrorChecking) { throw Util.notimplemented(); } @Override public void setXmlStandalone(final boolean xmlStandalone) { throw Util.notimplemented(); } @Override public void setXmlVersion(final String xmlVersion) { throw Util.notimplemented(); } } basex-7.7.2/basex-core/src/main/java/org/basex/api/dom/BXDocFrag.java000066400000000000000000000007111222453003200251300ustar00rootroot00000000000000package org.basex.api.dom; import org.basex.query.value.node.*; import org.w3c.dom.*; /** * DOM - Document fragment implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BXDocFrag extends BXNode implements DocumentFragment { /** * Constructor. * @param n node reference */ public BXDocFrag(final ANode n) { super(n); } @Override protected int kind() { return 7; } } basex-7.7.2/basex-core/src/main/java/org/basex/api/dom/BXDomImpl.java000066400000000000000000000020361222453003200251660ustar00rootroot00000000000000package org.basex.api.dom; import org.basex.util.*; import org.w3c.dom.*; /** * DOM - implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BXDomImpl implements DOMImplementation { /** Singleton instance. */ private static final BXDomImpl INSTANCE = new BXDomImpl(); /** * Returns the only instance of this class. * @return instance */ public static BXDomImpl get() { return INSTANCE; } @Override public BXDoc createDocument(final String nsURI, final String qn, final DocumentType doctype) { throw Util.notimplemented(); } @Override public DocumentType createDocumentType(final String qn, final String pid, final String sid) { throw Util.notimplemented(); } @Override public Object getFeature(final String f, final String v) { return null; } @Override public boolean hasFeature(final String f, final String v) { return "XML".equalsIgnoreCase(f) && (v == null || Token.eq(v, "", "1.0", "2.0", "3.0")); } } basex-7.7.2/basex-core/src/main/java/org/basex/api/dom/BXElem.java000066400000000000000000000067641222453003200245230ustar00rootroot00000000000000package org.basex.api.dom; import org.basex.query.iter.*; import org.basex.query.value.node.*; import org.basex.util.*; import org.w3c.dom.*; /** * DOM - Element implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BXElem extends BXNode implements Element { /** * Constructor. * @param n node reference */ public BXElem(final ANode n) { super(n); } @Override public String getNodeName() { return Token.string(node.name()); } @Override public String getLocalName() { return Token.string(Token.local(node.name())); } @Override public BXNNode getAttributes() { return new BXNNode(finish(node.attributes())); } @Override public String getAttribute(final String name) { final ANode n = attribute(name); return n != null ? Token.string(n.string()) : ""; } @Override public String getNamespaceURI() { final byte[] uri = node.qname().uri(); return uri.length == 0 ? null : Token.string(uri); } @Override public String getAttributeNS(final String uri, final String ln) { throw Util.notimplemented(); } @Override public BXAttr getAttributeNode(final String name) { return (BXAttr) get(attribute(name)); } @Override public BXAttr getAttributeNodeNS(final String uri, final String ln) { throw Util.notimplemented(); } @Override public BXNList getElementsByTagName(final String name) { return getElements(name); } @Override public BXNList getElementsByTagNameNS(final String uri, final String ln) { throw Util.notimplemented(); } @Override public TypeInfo getSchemaTypeInfo() { throw Util.notimplemented(); } @Override public String getTagName() { return getNodeName(); } @Override public boolean hasAttribute(final String name) { return attribute(name) != null; } @Override public boolean hasAttributeNS(final String uri, final String ln) { throw Util.notimplemented(); } @Override public void removeAttribute(final String name) { throw readOnly(); } @Override public void removeAttributeNS(final String uri, final String ln) { throw readOnly(); } @Override public BXAttr removeAttributeNode(final Attr oldAttr) { throw readOnly(); } @Override public void setAttribute(final String name, final String value) { throw readOnly(); } @Override public void setAttributeNS(final String uri, final String qn, final String value) { throw readOnly(); } @Override public BXAttr setAttributeNode(final Attr at) { throw readOnly(); } @Override public BXAttr setAttributeNodeNS(final Attr at) { throw readOnly(); } @Override public void setIdAttribute(final String name, final boolean isId) { throw readOnly(); } @Override public void setIdAttributeNS(final String uri, final String ln, final boolean isId) { throw readOnly(); } @Override public void setIdAttributeNode(final Attr at, final boolean isId) { throw readOnly(); } /** * Returns the specified attribute. * @param name attribute name * @return node, or {@code null} */ private ANode attribute(final String name) { final AxisIter ai = node.attributes(); final byte[] nm = Token.token(name); for(ANode n; (n = ai.next()) != null;) if(Token.eq(nm, n.name())) return n.finish(); return null; } } basex-7.7.2/basex-core/src/main/java/org/basex/api/dom/BXNList.java000066400000000000000000000012471222453003200246610ustar00rootroot00000000000000package org.basex.api.dom; import org.basex.query.util.*; import org.basex.query.value.node.*; import org.w3c.dom.*; /** * DOM - Node list implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ class BXNList implements NodeList { /** XQuery node set. */ final ANodeList nl; /** * Constructor. * @param nb nodes */ BXNList(final ANodeList nb) { nl = nb; } @Override public BXNode item(final int i) { ANode n = null; if(i < nl.size()) n = nl.get(i); return n != null ? BXNode.get(n) : null; } @Override public int getLength() { return nl.size(); } } basex-7.7.2/basex-core/src/main/java/org/basex/api/dom/BXNNode.java000066400000000000000000000023501222453003200246270ustar00rootroot00000000000000package org.basex.api.dom; import org.basex.query.util.*; import org.basex.util.*; import org.w3c.dom.*; /** * DOM - Named node map implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BXNNode extends BXNList implements NamedNodeMap { /** * Constructor. * @param nb nodes */ public BXNNode(final ANodeList nb) { super(nb); } @Override public BXNode getNamedItem(final String name) { final byte[] nm = Token.token(name); final int s = getLength(); for(int i = 0; i < s; ++i) { if(Token.eq(nl.get(i).name(), nm)) return item(i); } return null; } @Override public BXNode getNamedItemNS(final String uri, final String ln) { throw Util.notimplemented(); } @Override public BXNode setNamedItem(final Node node) { throw Util.notimplemented(); } @Override public BXNode removeNamedItem(final String name) { throw Util.notimplemented(); } @Override public BXNode setNamedItemNS(final Node node) { throw Util.notimplemented(); } @Override public BXNode removeNamedItemNS(final String uri, final String ln) { throw Util.notimplemented(); } } basex-7.7.2/basex-core/src/main/java/org/basex/api/dom/BXNode.java000066400000000000000000000162101222453003200245110ustar00rootroot00000000000000package org.basex.api.dom; import static org.basex.util.Token.*; import org.basex.data.*; import org.basex.io.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.w3c.dom.*; /** * DOM - Node implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class BXNode implements Node { /** Node type mapping (see {@link Data} interface). */ private static final short[] TYPES = { Node.DOCUMENT_NODE, Node.ELEMENT_NODE, Node.TEXT_NODE, Node.ATTRIBUTE_NODE, Node.COMMENT_NODE, Node.PROCESSING_INSTRUCTION_NODE, Node.CDATA_SECTION_NODE, Node.DOCUMENT_FRAGMENT_NODE }; /** Node name mapping (see {@link Data} interface). */ private static final String[] NAMES = { "#document", null, "#text", null, "#comment", null, "#cdata-section", "#document-fragment" }; /** Node reference. */ protected final ANode node; /** * Constructor. * @param n node reference */ protected BXNode(final ANode n) { node = n; } /** * Creates a new DOM node instance for the input node. Returns a {@code null} reference * if the input is also {@code null}. * @param node input node * @return DOM node */ public static final BXNode get(final ANode node) { if(node == null) return null; switch(node.nodeType()) { case DOC: return new BXDoc(node); case ELM: return new BXElem(node); case TXT: return new BXText(node); case ATT: return new BXAttr(node); case COM: return new BXComm(node); case PI : return new BXPI(node); default : return null; } } @Override public String getNodeName() { return NAMES[kind()]; } @Override public final short getNodeType() { return TYPES[kind()]; } /** * Returns a numeric value for the node kind. * @return node kind */ protected int kind() { return node.kind(); } @Override public String getNodeValue() { return null; } @Override public String getLocalName() { return null; } @Override public final BXNode cloneNode(final boolean deep) { return node.toJava(); } @Override public final short compareDocumentPosition(final Node other) { final int d = node.diff(((BXNode) other).node); return (short) (d < 0 ? -1 : d > 0 ? 1 : 0); } @Override public BXNNode getAttributes() { return null; } @Override public final String getBaseURI() { return IO.get(string(node.baseURI())).url(); } @Override public BXNList getChildNodes() { return new BXNList(finish(node.children())); } @Override public BXNode getFirstChild() { return get(node.children().next()); } @Override public final BXNode getLastChild() { ANode n = null; for(final ANode t : node.children()) n = t; return n != null ? get(n) : null; } @Override public String getNamespaceURI() { return null; } @Override public BXNode getNextSibling() { return get(node.followingSibling().next()); } @Override public BXNode getPreviousSibling() { return get(node.precedingSibling().next()); } @Override public final BXNode getParentNode() { return get(node.parent()); } @Override public final boolean hasChildNodes() { return getFirstChild() != null; } @Override public final boolean isSameNode(final Node other) { return other instanceof BXNode && ((BXNode) other).node.is(node); } @Override public BXDoc getOwnerDocument() { ANode n = node; for(ANode p; (p = n.parent()) != null;) n = p; return n.type == NodeType.DOC ? (BXDoc) BXNode.get(n) : null; } @Override public final boolean hasAttributes() { return getAttributes().getLength() != 0; } @Override public final Object getFeature(final String feature, final String version) { return null; } @Override public final String getPrefix() { return null; } @Override public final String getTextContent() { return string(node.string()); } @Override public final BXNode appendChild(final Node newChild) { throw readOnly(); } @Override public final Object getUserData(final String key) { return null; } @Override public final boolean isSupported(final String feature, final String version) { return false; } @Override public final BXNode insertBefore(final Node newChild, final Node refChild) { throw readOnly(); } @Override public final boolean isDefaultNamespace(final String namespaceURI) { throw Util.notimplemented(); } @Override public final boolean isEqualNode(final Node cmp) { throw Util.notimplemented(); } @Override public final String lookupNamespaceURI(final String prefix) { throw Util.notimplemented(); } @Override public final String lookupPrefix(final String namespaceURI) { throw Util.notimplemented(); } @Override public final void normalize() { throw readOnly(); } @Override public final BXNode removeChild(final Node oldChild) { throw readOnly(); } @Override public final BXNode replaceChild(final Node newChild, final Node oldChild) { throw readOnly(); } @Override public final void setNodeValue(final String nodeValue) { throw readOnly(); } @Override public final void setPrefix(final String prefix) { throw readOnly(); } @Override public final void setTextContent(final String textContent) { throw readOnly(); } @Override public final Object setUserData(final String key, final Object dat, final UserDataHandler handler) { throw readOnly(); } @Override public final String toString() { return '[' + getNodeName() + ": " + getNodeValue() + ']'; } /** * Returns all nodes with the given tag name. * @param tag tag name * @return nodes */ protected final BXNList getElements(final String tag) { final ANodeList nb = new ANodeList(); final AxisIter ai = node.descendant(); final byte[] nm = tag.equals("*") ? null : token(tag); for(ANode n; (n = ai.next()) != null;) { if(n.type == NodeType.ELM && (nm == null || eq(nm, n.name()))) nb.add(n.finish()); } return new BXNList(nb); } /** * Returns a node cache with the specified nodes. * @param ai axis iterator * @return node cache */ protected static ANodeList finish(final AxisIter ai) { final ANodeList nl = new ANodeList(); for(ANode n; (n = ai.next()) != null;) nl.add(n.finish()); return nl; } /** * Returns the internal node representation. * @return xquery node */ public final ANode getNode() { return node; } /** * Throws a DOM modification exception. * @return DOM exception */ protected static final DOMException readOnly() { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "DOM implementation is read-only."); } } basex-7.7.2/basex-core/src/main/java/org/basex/api/dom/BXPI.java000066400000000000000000000015531222453003200241400ustar00rootroot00000000000000package org.basex.api.dom; import org.basex.query.value.node.*; import org.basex.util.*; import org.w3c.dom.*; /** * DOM - Processing instruction implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BXPI extends BXNode implements ProcessingInstruction { /** * Constructor. * @param n node reference */ public BXPI(final ANode n) { super(n); } @Override public String getNodeValue() { return Token.string(node.string()); } @Override public String getNodeName() { return Token.string(node.name()); } @Override public String getData() { return getNodeValue(); } @Override public String getTarget() { return getNodeName(); } @Override public void setData(final String dat) { throw readOnly(); } } basex-7.7.2/basex-core/src/main/java/org/basex/api/dom/BXText.java000066400000000000000000000014221222453003200245470ustar00rootroot00000000000000package org.basex.api.dom; import org.basex.query.value.node.*; import org.basex.util.*; import org.w3c.dom.*; /** * DOM - Text implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class BXText extends BXChar implements Text { /** * Constructor. * @param n node reference */ public BXText(final ANode n) { super(n); } @Override public String getWholeText() { return getNodeValue(); } @Override public boolean isElementContentWhitespace() { return Token.ws(node.string()); } @Override public BXText replaceWholeText(final String content) { throw readOnly(); } @Override public BXText splitText(final int off) { throw readOnly(); } } basex-7.7.2/basex-core/src/main/java/org/basex/api/dom/package.html000066400000000000000000000000411222453003200250030ustar00rootroot00000000000000 Basic DOM API. basex-7.7.2/basex-core/src/main/java/org/basex/build/000077500000000000000000000000001222453003200222765ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/build/BuildException.java000066400000000000000000000007731222453003200260660ustar00rootroot00000000000000package org.basex.build; import java.io.*; import org.basex.util.*; /** * This class indicates building exceptions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BuildException extends IOException { /** * Constructs an exception with the specified message and extension. * @param s message * @param e message extension */ public BuildException(final String s, final Object... e) { super(Util.info(s, e)); } } basex-7.7.2/basex-core/src/main/java/org/basex/build/BuildText.java000066400000000000000000000155251222453003200250550ustar00rootroot00000000000000package org.basex.build; import static org.basex.util.Token.*; /** * This interface organizes textual information for the builder package. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public interface BuildText { /** Builder error. */ String LIMITNS = "%: Too many different namespaces (limit: %)."; /** Builder error. */ String LIMITRANGE = "%: Input is too large for a single database."; /** Builder error. */ String LIMITELEMS = "%: Too many different element names (limit: %)."; /** Builder error. */ String LIMITATTS = "%: Too many different attribute names (limit: %)."; /** Builder error. */ String WHICHNS = "%: Undeclared namespace prefix '%'."; /** Parser error. */ String PARSEINV = "%: % expected, % found."; /** Parser error. */ String CLOSINGELEM = "%: found, expected."; /** Parser error. */ String OPEN = "%: Opening element <%> expected."; /** Parser error. */ String DOCOPEN = "%: Closing element expected."; /** Parser error. */ String MOREROOTS = "%: No elements allowed after closed root element."; /** Scanner error. */ String BEFOREROOT = "No text allowed before root element."; /** Scanner error. */ String AFTERROOT = "No text allowed after closed root element."; /** Scanner error. */ String DOCEMPTY = "No input found."; /** Scanner error. */ String UNCLOSED = "Unclosed tokens found."; /** Scanner error. */ String CONTCDATA = "']]>' not allowed in content."; /** Scanner error. */ String CDATASEC = "Invalid CDATA section."; /** Scanner error. */ String CHARACTER = "Invalid character found: '%'"; /** Scanner error. */ String CLOSING = "Element was not properly closed."; /** Scanner error. */ String COMMDASH = "Comment or doctype declaration expected after '"); /** DTD: NOTATION. */ byte[] INCL = token("INCLUDE"); /** DTD: NOTATION. */ byte[] IGNO = token("IGNORE"); /** DTD: XML. */ byte[] XDECL = token("'"), /** Whitespace. */ WS("whitespace"), /** Attribute value. */ ATTVALUE("attribute value"), /** Empty bracket. */ L_BR_CLOSE("''"), /** Equal sign. */ EQ("'='"), /** End of input. */ EOF("end of input"), /** Quote. */ QUOTE("quote"); /** String representation of token type. */ public final String string; /** * Enumeration constructor. * @param s string representation */ Type(final String s) { string = s; } } } basex-7.7.2/basex-core/src/main/java/org/basex/build/Builder.java000066400000000000000000000230231222453003200245270ustar00rootroot00000000000000package org.basex.build; import static org.basex.build.BuildText.*; import static org.basex.core.Text.*; import static org.basex.util.Token.*; import java.io.*; import org.basex.core.*; import org.basex.data.*; import org.basex.index.name.*; import org.basex.index.path.*; import org.basex.io.*; import org.basex.util.*; import org.basex.util.list.*; /** * This class provides an interface for building database instances. * The specified {@link Parser} sends events to this class whenever nodes * are to be added or closed. The builder implementation decides whether * the nodes are stored on disk or kept in memory. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class Builder extends Proc { /** Tree structure. */ final PathSummary path = new PathSummary(); /** Namespace index. */ final Namespaces ns = new Namespaces(); /** Parser instance. */ final Parser parser; /** Database name. */ final String dbname; /** Number of cached size values. */ int ssize; /** Currently stored size value. */ int spos; /** Meta data on built database. */ MetaData meta; /** Tag name index. */ Names tags; /** Attribute name index. */ Names atts; /** Parent stack. */ private final IntList pstack = new IntList(); /** Tag stack. */ private final IntList tstack = new IntList(); /** Current tree height. */ private int level; /** * Constructor. * @param name name of database * @param parse parser */ Builder(final String name, final Parser parse) { parser = parse; dbname = name; } // PUBLIC METHODS =========================================================== /** * Parses the given input source and builds the database. * @throws IOException I/O exception */ final void parse() throws IOException { // add document node and parse document parser.parse(this); meta.lastid = meta.size - 1; } /** * Opens a document node. * @param value document name * @throws IOException I/O exception */ public final void openDoc(final byte[] value) throws IOException { path.put(0, Data.DOC, level); pstack.set(level++, meta.size); addDoc(value); ns.prepare(); } /** * Closes a document node. * @throws IOException I/O exception */ public final void closeDoc() throws IOException { final int pre = pstack.get(--level); setSize(pre, meta.size - pre); meta.ndocs++; ns.close(meta.size); } /** * Opens a new element node. * * @param nm tag name * @param att attributes * @param nsp namespaces * @throws IOException I/O exception */ public final void openElem(final byte[] nm, final Atts att, final Atts nsp) throws IOException { addElem(nm, att, nsp); ++level; } /** * Stores an empty element. * @param nm tag name * @param att attributes * @param nsp namespaces * @throws IOException I/O exception */ public final void emptyElem(final byte[] nm, final Atts att, final Atts nsp) throws IOException { addElem(nm, att, nsp); final int pre = pstack.get(level); ns.close(pre); if(att.size() > IO.MAXATTS) setSize(pre, meta.size - pre); } /** * Closes an element. * @throws IOException I/O exception */ public final void closeElem() throws IOException { checkStop(); --level; final int pre = pstack.get(level); setSize(pre, meta.size - pre); ns.close(pre); } /** * Stores a text node. * @param value text value * @throws IOException I/O exception */ public final void text(final byte[] value) throws IOException { if(value.length != 0) addText(value, Data.TEXT); } /** * Stores a comment. * @param value comment text * @throws IOException I/O exception */ public final void comment(final byte[] value) throws IOException { addText(value, Data.COMM); } /** * Stores a processing instruction. * @param pi processing instruction name and value * @throws IOException I/O exception */ public final void pi(final byte[] pi) throws IOException { addText(pi, Data.PI); } /** * Sets the document encoding. * @param enc encoding */ public final void encoding(final String enc) { meta.encoding = eq(enc, UTF8, UTF82) ? UTF8 : enc; } // PROGRESS INFORMATION ===================================================== @Override protected final String tit() { return CREATING_DB; } @Override public final String det() { return spos == 0 ? parser.detail() : FINISHING_D; } @Override public final double prog() { return spos == 0 ? parser.progress() : (double) spos / ssize; } // ABSTRACT METHODS ========================================================= /** * Builds the database. * @return data database instance * @throws IOException I/O exception */ public abstract Data build() throws IOException; /** * Closes open references. * @throws IOException I/O exception */ public abstract void close() throws IOException; /** * Adds a document node to the database. * @param value name of the document * @throws IOException I/O exception */ protected abstract void addDoc(byte[] value) throws IOException; /** * Adds an element node to the database. This method stores a preliminary * size value; if this node has further descendants, {@link #setSize} must * be called to set the final size value. * @param dist distance to parent * @param nm the tag name reference * @param asize number of attributes * @param uri namespace uri reference * @param ne namespace flag * @throws IOException I/O exception */ protected abstract void addElem(int dist, int nm, int asize, int uri, boolean ne) throws IOException; /** * Adds an attribute to the database. * @param nm attribute name * @param value attribute value * @param dist distance to parent * @param uri namespace uri reference * @throws IOException I/O exception */ protected abstract void addAttr(int nm, byte[] value, int dist, int uri) throws IOException; /** * Adds a text node to the database. * @param value the token to be added (tag name or content) * @param dist distance to parent * @param kind the node kind * @throws IOException I/O exception */ protected abstract void addText(byte[] value, int dist, byte kind) throws IOException; /** * Stores a size value to the specified table position. * @param pre pre reference * @param size value to be stored * @throws IOException I/O exception */ protected abstract void setSize(int pre, int size) throws IOException; // PRIVATE METHODS ========================================================== /** * Adds an element node to the storage. * @param name element name * @param att attributes * @param nsp namespaces * @throws IOException I/O exception */ private void addElem(final byte[] name, final Atts att, final Atts nsp) throws IOException { // get tag reference int n = tags.index(name, null, true); path.put(n, Data.ELEM, level); // cache pre value final int pre = meta.size; // remember tag id and parent reference tstack.set(level, n); pstack.set(level, pre); // parse namespaces ns.prepare(); final int nl = nsp.size(); for(int nx = 0; nx < nl; nx++) ns.add(nsp.name(nx), nsp.value(nx), meta.size); // get and store element references final int dis = level != 0 ? pre - pstack.get(level - 1) : 1; final int as = att.size(); int u = ns.uri(name, true); if(u == 0 && indexOf(name, ':') != -1 && !eq(prefix(name), XML)) throw new BuildException(WHICHNS, parser.detail(), prefix(name)); addElem(dis, n, Math.min(IO.MAXATTS, as + 1), u, nl != 0); // get and store attribute references for(int a = 0; a < as; ++a) { final byte[] av = att.value(a); final byte[] an = att.name(a); n = atts.index(an, av, true); u = ns.uri(an, false); if(u == 0 && indexOf(an, ':') != -1 && !eq(prefix(an), XML)) throw new BuildException(WHICHNS, parser.detail(), an); path.put(n, Data.ATTR, level + 1, av, meta); addAttr(n, av, Math.min(IO.MAXATTS, a + 1), u); } // set leaf node information in index if(level > 1) tags.stat(tstack.get(level - 1)).setLeaf(false); // check if data ranges exceed database limits, // based on the storage details in {@link Data} limit(tags.size(), 0x8000, LIMITELEMS); limit(atts.size(), 0x8000, LIMITATTS); limit(ns.size(), 0x100, LIMITNS); if(meta.size < 0) limit(0, 0, LIMITRANGE); } /** * Checks a value limit and optionally throws an exception. * @param value value * @param limit limit * @param msg message * @throws IOException I/O exception */ private void limit(final int value, final int limit, final String msg) throws IOException { if(value >= limit) throw new BuildException(msg, parser.detail(), limit); } /** * Adds a simple text, comment or processing instruction to the database. * @param value the value to be added * @param kind the node type * @throws IOException I/O exception */ private void addText(final byte[] value, final byte kind) throws IOException { final int l = level; if(l > 1) { final int tag = tstack.get(l - 1); // text node processing for statistics if(kind == Data.TEXT) tags.index(tag, value); // set leaf node information in index else tags.stat(tag).setLeaf(false); } path.put(0, kind, l, value, meta); addText(value, l == 0 ? 1 : meta.size - pstack.get(l - 1), kind); } } basex-7.7.2/basex-core/src/main/java/org/basex/build/DirParser.java000066400000000000000000000151021222453003200250330ustar00rootroot00000000000000package org.basex.build; import static org.basex.core.Text.*; import static org.basex.data.DataText.*; import java.io.*; import java.util.*; import java.util.regex.*; import java.util.zip.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.io.*; import org.basex.util.*; import org.basex.util.list.*; /** * This class recursively scans files and directories and parses all * relevant files. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DirParser extends Parser { /** Number of skipped files to log. */ private static final int SKIPLOG = 10; /** Skipped files. */ private final StringList skipped = new StringList(); /** File pattern. */ private final Pattern filter; /** Initial file path. */ private final String root; /** Parse archives in directories. */ private final boolean archives; /** Skip corrupt files in directories. */ private final boolean skipCorrupt; /** Add ignored files as raw files. */ private final boolean addRaw; /** DTD parsing. */ private final boolean dtd; /** Raw parsing. */ private final boolean rawParser; /** Database path for storing binary files. */ private final IOFile rawPath; /** Last source. */ private IO lastSrc; /** Parser reference. */ private Parser parser; /** Element counter. */ private int c; /** * Constructor. * @param source source path * @param pr database properties * @param path future database path */ public DirParser(final IO source, final Prop pr, final IOFile path) { super(source, pr); final String parent = source.dirPath(); root = parent.endsWith("/") ? parent : parent + '/'; skipCorrupt = prop.is(Prop.SKIPCORRUPT); archives = prop.is(Prop.ADDARCHIVES); addRaw = prop.is(Prop.ADDRAW); dtd = prop.is(Prop.DTD); rawParser = prop.get(Prop.PARSER).toLowerCase(Locale.ENGLISH).equals(DataText.M_RAW); filter = !source.isDir() && !source.isArchive() ? null : Pattern.compile(IOFile.regex(pr.get(Prop.CREATEFILTER))); // choose binary storage if (disk-based) database path is known and // if raw parser or "add raw" option were chosen rawPath = path != null && (addRaw || rawParser) ? new IOFile(path, M_RAW) : null; } @Override public void parse(final Builder build) throws IOException { build.meta.filesize = 0; build.meta.original = src.path(); parse(build, src); } /** * Parses the specified file or its children. * @param b builder * @param io current input * @throws IOException I/O exception */ private void parse(final Builder b, final IO io) throws IOException { if(io instanceof IOFile && io.isDir()) { for(final IO f : ((IOFile) io).children()) parse(b, f); } else if(archives && io.name().toLowerCase(Locale.ENGLISH).endsWith(IO.GZSUFFIX)) { // process GZIP archive final GZIPInputStream is = new GZIPInputStream(io.inputStream()); src = new IOStream(is, io.name().replaceAll("\\..*", IO.XMLSUFFIX)); parseResource(b); is.close(); } else if(archives && io.isArchive()) { // process ZIP archive final ZipInputStream is = new ZipInputStream(io.inputStream()); for(ZipEntry ze; (ze = is.getNextEntry()) != null;) { if(ze.isDirectory()) continue; src = new IOStream(is, ze.getName()); src.length(ze.getSize()); parseResource(b); } is.close(); } else { // process regular file src = io; parseResource(b); } } /** * Parses the current source. * @param b builder instance * @throws IOException I/O exception */ private void parseResource(final Builder b) throws IOException { b.checkStop(); // add file size for database meta information final long l = src.length(); if(l != -1) b.meta.filesize += l; // use global target as path prefix String targ = target; String path = src.path(); // add relative path without root (prefix) and file name (suffix) final String name = src.name(); if(path.endsWith('/' + name)) { path = path.substring(0, path.length() - name.length()); if(path.startsWith(root)) path = path.substring(root.length()); targ = (targ + path).replace("//", "/"); } // check if file passes the name filter pattern boolean exclude = false; if(filter != null) { final String nm = Prop.CASE ? src.name() : src.name().toLowerCase(Locale.ENGLISH); exclude = !filter.matcher(nm).matches(); } if(exclude) { // exclude file: check if will be added as raw file if(addRaw && rawPath != null) { Store.store(src.inputSource(), new IOFile(rawPath, targ + name)); } } else { if(rawParser) { // store input in raw format if database path is known if(rawPath != null) { Store.store(src.inputSource(), new IOFile(rawPath, targ + name)); } } else { // store input as XML boolean ok = true; IO in = src; if(skipCorrupt) { // parse file twice to ensure that it is well-formed try { // cache file contents to allow or speed up a second run if(!(src instanceof IOContent || dtd)) { in = new IOContent(src.read()); in.name(src.name()); } parser = Parser.singleParser(in, prop, targ); MemBuilder.build("", parser); } catch(final IOException ex) { Util.debug(ex); skipped.add(src.path()); ok = false; } } // parse file if(ok) { parser = Parser.singleParser(in, prop, targ); parser.parse(b); } parser = null; // dump debug data if(Prop.debug && (++c & 0x3FF) == 0) Util.err(";"); } } } @Override public String info() { final TokenBuilder tb = new TokenBuilder(); if(!skipped.isEmpty()) { tb.add(SKIPPED).add(COL).add(NL); final int s = skipped.size(); for(int i = 0; i < s && i < SKIPLOG; i++) { tb.add(LI).add(skipped.get(i)).add(NL); } if(s > SKIPLOG) { tb.add(LI).addExt(MORE_SKIPPED_X, s - SKIPLOG).add(NL); } } return tb.toString(); } @Override public String det() { return parser != null ? parser.detail() : src.path(); } @Override public double prog() { if(parser != null) return parser.progress(); if(lastSrc == src) return 1; lastSrc = src; return Math.random(); } @Override public void close() throws IOException { if(parser != null) parser.close(); } } basex-7.7.2/basex-core/src/main/java/org/basex/build/DiskBuilder.java000066400000000000000000000131541222453003200253460ustar00rootroot00000000000000package org.basex.build; import static org.basex.core.Text.*; import static org.basex.data.DataText.*; import java.io.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.index.name.*; import org.basex.io.*; import org.basex.io.in.DataInput; import org.basex.io.out.*; import org.basex.io.out.DataOutput; import org.basex.io.random.*; import org.basex.util.*; /** * This class creates a database instance on disk. * The storage layout is described in the {@link Data} class. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DiskBuilder extends Builder { /** Text compressor. */ private static final ThreadLocal COMP = new ThreadLocal() { @Override protected Compress initialValue() { return new Compress(); } }; /** Database table. */ private DataOutput tout; /** Database texts. */ private DataOutput xout; /** Database values. */ private DataOutput vout; /** Output stream for temporary values. */ private DataOutput sout; /** Database context. */ private final Context context; /** Debug counter. */ private int c; /** * Constructor. * @param nm name of database * @param parse parser * @param ctx database context */ public DiskBuilder(final String nm, final Parser parse, final Context ctx) { super(nm, parse); context = ctx; } @Override public DiskData build() throws IOException { final IO file = parser.src; final MetaData md = new MetaData(dbname, context); md.original = file != null ? file.path() : ""; md.filesize = file != null ? file.length() : 0; md.time = file != null ? file.timeStamp() : System.currentTimeMillis(); md.dirty = true; // calculate optimized output buffer sizes to reduce disk fragmentation final Runtime rt = Runtime.getRuntime(); int bs = (int) Math.min(md.filesize, Math.min(1 << 22, rt.maxMemory() - rt.freeMemory() >> 2)); bs = Math.max(IO.BLOCKSIZE, bs - bs % IO.BLOCKSIZE); // drop old database (if available) and create new one DropDB.drop(dbname, context); context.mprop.dbpath(dbname).md(); meta = md; tags = new Names(md); atts = new Names(md); try { tout = new DataOutput(new TableOutput(md, DATATBL)); xout = new DataOutput(md.dbfile(DATATXT), bs); vout = new DataOutput(md.dbfile(DATAATV), bs); sout = new DataOutput(md.dbfile(DATATMP), bs); final Performance perf = Prop.debug ? new Performance() : null; Util.debug(tit() + DOTS); parse(); if(Prop.debug) Util.errln(" " + perf + " (" + Performance.getMemory() + ')'); } catch(final IOException ex) { try { close(); } catch(final IOException ignored) { } throw ex; } close(); // copy temporary values into database table final DataInput in = new DataInput(md.dbfile(DATATMP)); final TableAccess ta = new TableDiskAccess(md, true); for(; spos < ssize; ++spos) ta.write4(in.readNum(), 8, in.readNum()); ta.close(); in.close(); md.dbfile(DATATMP).delete(); // return database instance final DiskData data = new DiskData(md, tags, atts, path, ns); data.finishUpdate(); return data; } @Override public void abort() { try { close(); } catch(final IOException ex) { Util.debug(ex); } if(meta != null) DropDB.drop(meta.name, context); } @Override public void close() throws IOException { if(tout != null) tout.close(); if(xout != null) xout.close(); if(vout != null) vout.close(); if(sout != null) sout.close(); parser.close(); tout = null; xout = null; vout = null; sout = null; } @Override protected void addDoc(final byte[] value) throws IOException { tout.write1(Data.DOC); tout.write2(0); tout.write5(textOff(value, true)); tout.write4(0); tout.write4(meta.size++); } @Override protected void addElem(final int dist, final int nm, final int asize, final int uri, final boolean ne) throws IOException { tout.write1(asize << 3 | Data.ELEM); tout.write2((ne ? 1 << 15 : 0) | nm); tout.write1(uri); tout.write4(dist); tout.write4(asize); tout.write4(meta.size++); if(Prop.debug && (c++ & 0x7FFFF) == 0) Util.err("."); } @Override protected void addAttr(final int nm, final byte[] value, final int dist, final int uri) throws IOException { tout.write1(dist << 3 | Data.ATTR); tout.write2(nm); tout.write5(textOff(value, false)); tout.write4(uri); tout.write4(meta.size++); } @Override protected void addText(final byte[] value, final int dist, final byte kind) throws IOException { tout.write1(kind); tout.write2(0); tout.write5(textOff(value, true)); tout.write4(dist); tout.write4(meta.size++); } @Override protected void setSize(final int pre, final int size) throws IOException { sout.writeNum(pre); sout.writeNum(size); ++ssize; } /** * Calculates the text offset and writes the text value. * @param value value to be inlined * @param text text/attribute flag * @return inline value or text position * @throws IOException I/O exception */ private long textOff(final byte[] value, final boolean text) throws IOException { // inline integer values... final long v = Token.toSimpleInt(value); if(v != Integer.MIN_VALUE) return v | IO.OFFNUM; // store text final DataOutput store = text ? xout : vout; final long off = store.size(); final byte[] val = COMP.get().pack(value); store.writeToken(val); return val == value ? off : off | IO.OFFCOMP; } } basex-7.7.2/basex-core/src/main/java/org/basex/build/EmptyBuilder.java000066400000000000000000000031171222453003200255500ustar00rootroot00000000000000package org.basex.build; import java.io.*; import org.basex.build.xml.*; import org.basex.core.*; import org.basex.data.*; import org.basex.index.name.*; import org.basex.io.*; /** * Dummy parser for parsing XML input. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class EmptyBuilder extends Builder { /** Context. */ private final Context context; /** * Constructor. * @param io input * @param ctx database context * @throws IOException I/O exception */ public EmptyBuilder(final IO io, final Context ctx) throws IOException { super("", new XMLParser(io, ctx.prop)); context = ctx; } @Override public Data build() throws IOException { meta = new MetaData(dbname, context); tags = new Names(meta); atts = new Names(meta); try { parse(); } finally { close(); } return null; } @Override public void close() throws IOException { parser.close(); } @Override protected void addDoc(final byte[] value) throws IOException { meta.size++; } @Override protected void addElem(final int dist, final int nm, final int asize, final int uri, final boolean ne) throws IOException { meta.size++; } @Override protected void addAttr(final int nm, final byte[] value, final int dist, final int uri) throws IOException { meta.size++; } @Override protected void addText(final byte[] value, final int dist, final byte kind) throws IOException { meta.size++; } @Override protected void setSize(final int pre, final int size) throws IOException { } } basex-7.7.2/basex-core/src/main/java/org/basex/build/MemBuilder.java000066400000000000000000000060431222453003200251710ustar00rootroot00000000000000package org.basex.build; import java.io.*; import org.basex.data.*; import org.basex.io.*; /** * This class creates a database instance in main memory. * The storage layout is described in the {@link Data} class. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class MemBuilder extends Builder { /** Data reference. */ private MemData data; /** * Constructor. * @param nm name of database * @param parse parser */ public MemBuilder(final String nm, final Parser parse) { super(nm, parse); } /** * Builds a main memory database instance. * @param parser parser * @return data database instance * @throws IOException I/O exception */ public static MemData build(final Parser parser) throws IOException { return build(parser.src.dbname(), parser); } /** * Builds a main memory database instance with the specified name. * @param name name of database * @param parser parser * @return data database instance * @throws IOException I/O exception */ public static MemData build(final String name, final Parser parser) throws IOException { return new MemBuilder(name, parser).build(); } @Override public MemData build() throws IOException { init(); try { parse(); } catch(final IOException ex) { try { close(); } catch(final IOException ignored) { } throw ex; } close(); return data; } /** * Initializes the builder. */ public void init() { data = new MemData(path, ns, parser.prop); final MetaData md = data.meta; md.name = dbname; // all contents will be indexed in main memory mode md.createtext = true; md.createattr = true; md.textindex = true; md.attrindex = true; final IO file = parser.src; md.original = file != null ? file.path() : ""; md.filesize = file != null ? file.length() : 0; md.time = file != null ? file.timeStamp() : System.currentTimeMillis(); meta = data.meta; tags = data.tagindex; atts = data.atnindex; path.data(data); } /** * Returns the data reference. * @return data reference */ public Data data() { return data; } @Override public void close() throws IOException { parser.close(); } @Override protected void addDoc(final byte[] value) { data.doc(meta.size, 0, value); data.insert(meta.size); } @Override protected void addElem(final int dist, final int nm, final int asize, final int uri, final boolean ne) { data.elem(dist, nm, asize, asize, uri, ne); data.insert(meta.size); } @Override protected void addAttr(final int nm, final byte[] value, final int dist, final int uri) { data.attr(meta.size, dist, nm, value, uri, false); data.insert(meta.size); } @Override protected void addText(final byte[] value, final int dist, final byte kind) { data.text(meta.size, dist, value, kind); data.insert(meta.size); } @Override protected void setSize(final int pre, final int size) { data.size(pre, Data.ELEM, size); } } basex-7.7.2/basex-core/src/main/java/org/basex/build/Parser.java000066400000000000000000000077371222453003200244130ustar00rootroot00000000000000package org.basex.build; import static org.basex.core.Text.*; import java.io.*; import java.util.*; import org.basex.build.file.*; import org.basex.build.xml.*; import org.basex.core.*; import org.basex.data.*; import org.basex.io.*; import org.basex.util.*; /** * This class defines a parser, which is used to create new databases instances. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class Parser extends Proc { /** Source document, or {@code null}. */ public IO src; /** Attributes of currently parsed element. */ protected final Atts atts = new Atts(); /** Namespaces of currently parsed element. */ protected final Atts nsp = new Atts(); /** Database properties. */ protected final Prop prop; /** Target path (empty, or suffixed with a single slash). */ String target = ""; /** * Constructor. * @param source document source, or {@code null} * @param pr database properties */ protected Parser(final String source, final Prop pr) { this(source == null ? null : IO.get(source), pr); } /** * Constructor. * @param source document source, or {@code null} * @param pr database properties */ protected Parser(final IO source, final Prop pr) { src = source; prop = pr; } /** * Parses all nodes and sends events to the specified builder. * @param build database builder * @throws IOException I/O exception */ public abstract void parse(final Builder build) throws IOException; /** * Closes the parser. * @throws IOException I/O exception */ @SuppressWarnings("unused") public void close() throws IOException { } /** * Returns parser information. * @return info string */ public String info() { return ""; } /** * Sets the target path. * @param path target path * @return self reference */ public Parser target(final String path) { target = path.isEmpty() ? "" : (path + '/').replaceAll("//+", "/"); return this; } // STATIC METHODS =========================================================== /** * Returns a parser instance for creating empty databases. * @param pr database properties * @return parser */ public static Parser emptyParser(final Prop pr) { return new Parser((IO) null, pr) { @Override public void parse(final Builder build) { /* empty */ } }; } /** * Returns an XML parser instance. * @param in input source * @param prop database properties * @return xml parser * @throws IOException I/O exception */ public static SingleParser xmlParser(final IO in, final Prop prop) throws IOException { // use internal or default XML parser return prop.is(Prop.INTPARSE) ? new XMLParser(in, prop) : new SAXWrapper(in, prop); } /** * Returns a parser instance, based on the current options. * @param in input source * @param prop database properties * @param target relative path reference * @return parser * @throws IOException I/O exception */ public static SingleParser singleParser(final IO in, final Prop prop, final String target) throws IOException { // use file specific parser final String parser = prop.get(Prop.PARSER).toLowerCase(Locale.ENGLISH); final SingleParser p; if(parser.equals(DataText.M_HTML)) { p = new HTMLParser(in, prop); } else if(parser.equals(DataText.M_TEXT)) { p = new TextParser(in, prop); } else if(parser.equals(DataText.M_MAB2)) { p = new MAB2Parser(in, prop); } else if(parser.equals(DataText.M_JSON)) { p = new JSONParser(in, prop); } else if(parser.equals(DataText.M_CSV)) { p = new CSVParser(in, prop); } else if(parser.equals(DataText.M_XML)) { p = xmlParser(in, prop); } else { throw new BuildException(UNKNOWN_PARSER_X, parser); } p.target(target); return p; } } basex-7.7.2/basex-core/src/main/java/org/basex/build/SingleParser.java000066400000000000000000000021651222453003200255430ustar00rootroot00000000000000package org.basex.build; import static org.basex.util.Token.*; import java.io.*; import org.basex.core.*; import org.basex.io.*; /** * This class defines an abstract parser for single resources. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class SingleParser extends Parser { /** Builder reference. */ protected Builder builder; /** * Constructor. * @param source input source * @param pr database properties */ protected SingleParser(final IO source, final Prop pr) { super(source, pr); } @Override public final void parse(final Builder build) throws IOException { builder = build; builder.openDoc(token(target + src.name())); parse(); builder.closeDoc(); } /** * Parses the current input. * @throws IOException I/O exception */ public abstract void parse() throws IOException; /** * Sets the database builder. * @param b builder instance * @return self reference */ public SingleParser builder(final Builder b) { builder = b; return this; } } basex-7.7.2/basex-core/src/main/java/org/basex/build/file/000077500000000000000000000000001222453003200232155ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/build/file/CSVParser.java000066400000000000000000000064471222453003200257030ustar00rootroot00000000000000package org.basex.build.file; import static org.basex.core.Text.*; import static org.basex.util.Token.*; import java.io.*; import java.util.*; import org.basex.build.xml.*; import org.basex.core.*; import org.basex.io.*; import org.basex.io.in.*; import org.basex.query.*; import org.basex.query.util.csv.*; import org.basex.query.value.node.*; /** * This class parses files in the CSV format * and sends events to the specified database builder. * *

The parser provides some options, which can be specified via * SET PARSEROPT ...:

* *
    *
  • separator defines the column separator, which can be * comma, semicolon, or tab * (default: comma).
  • *
  • header specifies if the input file contains a header. * Can be set to true or false * (default: true)
  • *
* *

All options are separated by commas, and the keys and values are * separated by equality sign (=).

* *

Example: * SET PARSEROPT separator=tab,format=simple,header=no; CREATE DB ... *
* Description: Use tabs as separator, choose simple XML format, * and indicate that the file contains no header.

* * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class CSVParser extends XMLParser { /** Separators. */ public static final String[] SEPARATORS = { "comma", "semicolon", "tab", "space" }; /** Separator mappings. */ private static final byte[] SEPMAPPINGS = { ',', ';', '\t', ' ' }; /** * Constructor. * @param source document source * @param pr database properties * @throws IOException I/O exception */ public CSVParser(final IO source, final Prop pr) throws IOException { super(toXML(source, pr.get(Prop.PARSEROPT)), pr); } /** * Converts a JSON document to XML. * @param io io reference * @param options parsing options * @return parser * @throws IOException I/O exception */ private static IO toXML(final IO io, final String options) throws IOException { // set parser properties final ParserProp props = new ParserProp(options); final boolean header = props.is(ParserProp.HEADER); // set separator final String val = props.get(ParserProp.SEPARATOR).toLowerCase(Locale.ENGLISH); int s = -1; for(int i = 0; i < SEPARATORS.length; i++) { if(val.equals(SEPARATORS[i])) s = SEPMAPPINGS[i]; } if(s == -1) { final int i = toInt(token(val)); if(i > 0) s = i; else throw new BaseXException(INVALID_VALUE_X_X, ParserProp.SEPARATOR[0], val); } final int separator = s; // retrieve content in correct encoding final String encoding = props.get(ParserProp.ENCODING); // parse input and convert to XML node try { final CsvParser conv = new CsvParser(separator, header); final ANode node = conv.convert(new NewlineInput(io).encoding(encoding)); // cache XML representation final IOContent xml = new IOContent(node.serialize().toArray()); xml.name(io.name()); return xml; } catch(final QueryException ex) { throw new BaseXException(ex); } } } basex-7.7.2/basex-core/src/main/java/org/basex/build/file/HTMLParser.java000066400000000000000000000143131222453003200260030ustar00rootroot00000000000000package org.basex.build.file; import static org.basex.util.Token.*; import java.io.*; import java.lang.reflect.*; import org.basex.build.xml.*; import org.basex.core.*; import org.basex.io.*; import org.basex.io.in.*; import org.basex.util.*; import org.xml.sax.*; /** * This class uses TagSoup to convert HTML input to well-formed XML. * If TagSoup is not found in the classpath, the original document is passed on. * * TagSoup was written by John Cowan and is based on the Apache 2.0 License: * {@code http://home.ccil.org/~cowan/XML/tagsoup/}. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class HTMLParser extends XMLParser { /** Name of HTML Parser. */ public static final String NAME = "TagSoup"; /** TagSoup URL. */ private static final String FEATURES = "http://www.ccil.org/~cowan/tagsoup/features/"; /** XML parser class string. */ private static final String PCLASS = "org.ccil.cowan.tagsoup.Parser"; /** XML writer class string. */ private static final String WCLASS = "org.ccil.cowan.tagsoup.XMLWriter"; /** HTML reader. */ private static final Class READER = Reflect.find(PCLASS); /** HTML writer. */ private static final Constructor WRITER = Reflect.find(Reflect.find(WCLASS), Writer.class); /** XML writer output property method. */ private static final Method METHOD = Reflect.method( Reflect.find(WCLASS), "setOutputProperty", new Class[] { String.class, String.class }); /** * Checks if a CatalogResolver is available. * @return result of check */ public static boolean available() { return READER != null; } /** * Returns the name of the parser, or an empty string. * @return name of parser */ public static String parser() { return available() ? NAME : ""; } /** * Constructor. * @param source document source * @param pr database properties * @throws IOException I/O exception */ public HTMLParser(final IO source, final Prop pr) throws IOException { this(source, pr.get(Prop.HTMLOPT), pr); } /** * Constructor. * @param source document source * @param options options * @param pr database properties * @throws IOException I/O exception */ public HTMLParser(final IO source, final String options, final Prop pr) throws IOException { super(toXML(source, options), pr); } /** * Converts an HTML document to XML. * @param io io reference * @param options parsing options * @return parser * @throws IOException I/O exception */ private static IO toXML(final IO io, final String options) throws IOException { // reader could not be initialized; fall back to XML if(READER == null) return io; try { // tries to extract the encoding from the input final TextInput ti = new TextInput(io); String enc = ti.encoding(); final byte[] content = ti.content(); // looks for a charset definition final byte[] encoding = token("charset="); int cs = indexOf(content, encoding); if(cs > 0) { // extracts the encoding string cs += encoding.length; int ce = cs; while(++ce < content.length && content[ce] > 0x28); enc = string(substring(content, cs, ce)); } // define input final InputSource is = new InputSource(new ArrayInput(content)); is.setEncoding(supported(enc) ? normEncoding(enc) : UTF8); // define output final StringWriter sw = new StringWriter(); final XMLReader reader = (XMLReader) Reflect.get(READER); final Object writer = Reflect.get(WRITER, sw); // set TagSoup options final HTMLProp props = new HTMLProp(options); String p; if(props.is(HTMLProp.HTML)) { reader.setFeature("http://xml.org/sax/features/namespaces", false); opt("method", "html"); opt("omit-xml-declaration", "yes"); } if(props.is(HTMLProp.NONS)) { reader.setFeature("http://xml.org/sax/features/namespaces", false); } if(props.is(HTMLProp.OMITXML)) { opt("omit-xml-declaration", "yes"); } if(!(p = props.get(HTMLProp.METHOD)).isEmpty()) { opt("method", p); } if(props.is(HTMLProp.NOBOGONS)) { reader.setFeature(FEATURES + "ignore-bogons", true); } if(props.is(HTMLProp.NODEFAULTS)) { reader.setFeature(FEATURES + "default-attributes", false); } if(props.is(HTMLProp.NOCOLONS)) { reader.setFeature(FEATURES + "translate-colons", true); } if(props.is(HTMLProp.NORESTART)) { reader.setFeature(FEATURES + "restart-elements", false); } if(props.is(HTMLProp.IGNORABLE)) { reader.setFeature(FEATURES + "ignorable-whitespace", true); } if(props.is(HTMLProp.EMPTYBOGONS)) { reader.setFeature(FEATURES + "bogons-empty", true); } if(props.is(HTMLProp.ANY)) { reader.setFeature(FEATURES + "bogons-empty", false); } if(props.is(HTMLProp.NOROOTBOGONS)) { reader.setFeature(FEATURES + "root-bogons", false); } if(props.is(HTMLProp.NOCDATA)) { reader.setFeature(FEATURES + "cdata-elements", false); } if(props.is(HTMLProp.LEXICAL)) { reader.setProperty("http://xml.org/sax/properties/lexical-handler", writer); } if(!(p = props.get(HTMLProp.DOCTYPESYS)).isEmpty()) { opt("doctype-system", p); } if(!(p = props.get(HTMLProp.DOCTYPEPUB)).isEmpty()) { opt("doctype-public", p); } if(!(p = props.get(HTMLProp.ENCODING)).isEmpty()) { is.setEncoding(p); } // end TagSoup options reader.setContentHandler((ContentHandler) writer); reader.parse(is); return new IOContent(token(sw.toString()), io.name()); } catch(final SAXException ex) { Util.errln(ex); return io; } } /** * Reflection invoke XMLWriter.setOutputProperty(). * @param p property * @param v value */ private static void opt(final String p, final String v) { Reflect.invoke(METHOD, WRITER, p, v); } } basex-7.7.2/basex-core/src/main/java/org/basex/build/file/HTMLProp.java000066400000000000000000000042131222453003200254650ustar00rootroot00000000000000package org.basex.build.file; import java.io.*; import org.basex.core.*; /** * This class contains HTML parsing properties for TagSoup. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class HTMLProp extends AProp { /** TagSoup option: html. */ public static final Object[] HTML = { "html", false }; /** TagSoup option: omit-xml-declaration. */ public static final Object[] OMITXML = { "omit-xml-declaration", false }; /** TagSoup option: method (html). */ public static final Object[] METHOD = { "method", "" }; /** TagSoup option: nons. */ public static final Object[] NONS = { "nons", true }; /** TagSoup option: nobogons. */ public static final Object[] NOBOGONS = { "nobogons", false }; /** TagSoup option: nodefaults. */ public static final Object[] NODEFAULTS = { "nodefaults", false }; /** TagSoup option: nocolons. */ public static final Object[] NOCOLONS = { "nocolons", false }; /** TagSoup option: norestart. */ public static final Object[] NORESTART = { "norestart", false }; /** TagSoup option: nobogons. */ public static final Object[] IGNORABLE = { "ignorable", false }; /** TagSoup option: emptybogons. */ public static final Object[] EMPTYBOGONS = { "emptybogons", false }; /** TagSoup option: any. */ public static final Object[] ANY = { "any", false }; /** TagSoup option: norootbogons. */ public static final Object[] NOROOTBOGONS = { "norootbogons", false }; /** TagSoup option: nocdata. */ public static final Object[] NOCDATA = { "nocdata", false }; /** TagSoup option: lexical. */ public static final Object[] LEXICAL = { "lexical", false }; /** TagSoup option: doctype-system=systemid. */ public static final Object[] DOCTYPESYS = { "doctype-system", "" }; /** TagSoup option: doctype-public=publicid. */ public static final Object[] DOCTYPEPUB = { "doctype-public", "" }; /** TagSoup option: encoding=encoding. */ public static final Object[] ENCODING = { "encoding", "" }; /** * Constructor. * @param s properties string * @throws IOException exception */ public HTMLProp(final String s) throws IOException { parse(s); } } basex-7.7.2/basex-core/src/main/java/org/basex/build/file/JSONParser.java000066400000000000000000000056061222453003200260150ustar00rootroot00000000000000package org.basex.build.file; import static org.basex.util.Token.*; import java.io.*; import org.basex.build.xml.*; import org.basex.core.*; import org.basex.io.*; import org.basex.io.in.*; import org.basex.query.*; import org.basex.query.util.json.*; import org.basex.query.util.json.JsonParser.Spec; import org.basex.query.value.item.*; /** * This class parses files in the JSON format * and sends events to the specified database builder. * *

The parser provides some options, which can be specified via * SET PARSEROPT ...:

* *
    *
  • jsonml specifies if the input is parsed in the JsonML * format (default: no).
  • *
* *

All options are separated by commas, and the keys and values are * separated by equality sign (=).

* *

Example: * SET PARSEROPT separator=tab,format=simple,header=no; CREATE DB ... *
* Description: Use tabs as separator, choose simple XML format, * and indicate that the file contains no header.

* * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class JSONParser extends XMLParser { /** * Constructor. * @param source document source * @param pr database properties * @throws IOException I/O exception */ public JSONParser(final IO source, final Prop pr) throws IOException { this(source, pr, pr.get(Prop.PARSEROPT)); } /** * Constructor. * @param source document source * @param pr database properties * @param options parser options * @throws IOException I/O exception */ public JSONParser(final IO source, final Prop pr, final String options) throws IOException { super(toXML(source, options), pr); } /** * Converts a JSON document to XML. * @param io io reference * @param options parsing options * @return parser * @throws IOException I/O exception */ private static IO toXML(final IO io, final String options) throws IOException { // set parser properties final ParserProp props = new ParserProp(options); final byte[] format = props.is(ParserProp.JSONML) ? JsonConverter.JSONML : JsonConverter.JSON; final String encoding = props.get(ParserProp.ENCODING); // parse input, using specified encoding final byte[] content = new NewlineInput(io).encoding(encoding).content(); // parse input and convert to XML node final Item node; try { final JsonConverter conv = JsonConverter.get(format, Spec.RFC4627, true, null); node = conv.convert(string(content)); // create XML input container from serialized node final IOContent xml = new IOContent(node.serialize().toArray()); xml.name(io.name()); return xml; } catch(final QueryException ex) { throw new BaseXException(ex); } } } basex-7.7.2/basex-core/src/main/java/org/basex/build/file/MAB2.java000066400000000000000000000031201222453003200245350ustar00rootroot00000000000000package org.basex.build.file; import static org.basex.util.Token.*; /** * MAB2 Fields, needed for importing MAB2 data as XML. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ interface MAB2 { /** Root tag. */ byte[] LIBRARY = token("Library"); /** Medium tag. */ byte[] MEDIUM = token("Medium"); /** ID Attribute. */ byte[] MV_ID = token("mv_id"); /** ID attribute. */ byte[] BIB_ID = token("bib_id"); /** Subordinate titles attribute. */ byte[] MAX = token("max"); /** Tag. */ byte[] DESCRIPTION = token("Desc"); /** Tag. */ byte[] DETAILS = token("Detail"); /** Tag. */ byte[] FORMAT = token("Format"); /** Tag. */ byte[] INSTITUTE = token("Institution"); /** Tag. */ byte[] ISBN = token("ISBN"); /** Tag. */ byte[] POSTER = token("Poster"); /** Tag. */ byte[] GENRE = token("Genre"); /** Tag. */ byte[] LANGUAGE = token("Language"); /** Tag. */ byte[] NOTE = token("Note"); /** Tag. */ byte[] ORIGINAL = token("Original"); /** Tag. */ byte[] AUTHOR = token("Author"); /** Tag. */ byte[] PUBLISHER = token("Publisher"); /** Tag. */ byte[] SIGNATURE = token("Signature"); /** Tag. */ byte[] SUBJECT = token("Subject"); /** Tag. */ byte[] SUBTITLE = token("Subtitle"); /** Tag. */ byte[] TITLE = token("Title"); /** Tag. */ byte[] TOWN = token("Town"); /** Tag. */ byte[] TYPE = token("Type"); /** Tag. */ byte[] YEAR = token("Year"); /** Tag. */ byte[] LENDINGS = token("Lendings"); /** Tag. */ byte[] STATUS = token("Status"); /** Semicolon. */ byte[] SEMI = token("; "); } basex-7.7.2/basex-core/src/main/java/org/basex/build/file/MAB2Parser.java000066400000000000000000000407001222453003200257170ustar00rootroot00000000000000package org.basex.build.file; import static org.basex.build.file.MAB2.*; import static org.basex.util.Token.*; import java.io.*; import java.util.*; import org.basex.build.*; import org.basex.core.*; import org.basex.io.*; import org.basex.io.out.*; import org.basex.io.random.*; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * This class parses files in the MAB2 format * and sends events to the specified database builder. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class MAB2Parser extends SingleParser { /** Encoding of MAB2 input. */ private static final String ENCODING = "iso-8859-1"; /** Temporary token builder. */ private final ByteList buffer = new ByteList(); /** Subject assignments. */ private final TokenMap subjects = new TokenMap(); /** Media type assignments. */ private final TokenMap mediatypes = new TokenMap(); /** Language assignments. */ private final TokenMap languages = new TokenMap(); /** MedioVis ID assignments. */ private final TokenMap mvids = new TokenMap(); /** Optional lending numbers. */ private final TokenMap lendings = new TokenMap(); /** Optional lending status. */ private final TokenMap status = new TokenMap(); /** Image assignments. */ private final TokenMap posters = new TokenMap(); /** Genre assignments. */ private final TokenMap genres = new TokenMap(); /** Temporary build data. */ private final byte[][] sig = new byte[500][]; /** Temporary build data. */ private final byte[][] auth = new byte[50][]; /** Temporary build data. */ private final byte[][] inst = new byte[50][]; /** Flat database creation. */ private final boolean flat; /** Input to be parsed. * DataAccess is not thread-safe, * which is no problem because parsers are also not thread-safe on the whole. */ private final DataAccess input; /** Temporary read position. */ private long off; /** Maximum id. */ private int maxid; /** * Constructor. * @param source source data * @param pr database properties * @throws IOException I/O exception */ public MAB2Parser(final IO source, final Prop pr) throws IOException { super(source, pr); // set parser properties final ParserProp props = new ParserProp(pr.get(Prop.PARSEROPT)); flat = props.is(ParserProp.FLAT); input = new DataAccess(new IOFile(source.path())); } @Override public void parse() throws IOException { // read in indexes index(mediatypes, "mediatypes"); index(subjects, "subjects"); index(languages, "lang"); index(mvids, "mvids"); index(lendings, "lendings"); index(status, "status"); index(posters, "posters"); index(genres, "genres"); // find maximum id for(final byte[] key : mvids) { final int id = toInt(mvids.get(key)); if(maxid < id) maxid = id; } // check beginning of input file if(input.read1() != '#' || input.read1() != '#' || input.read1() != '#') { throw new BuildException("Invalid MAB2 input (doesn't start with ###)"); } builder.openElem(LIBRARY, atts.clear(), nsp); // find file offsets of all titles final Performance p = new Performance(); // MAB2 entries final TokenObjMap ids = new TokenObjMap(); int i = 0; for(byte[] id; (id = id(input)) != null;) { final long pos = off; final byte[] par = par(input); final boolean child = par != null; final byte[] key = child ? par : id; MAB2Entry entry = ids.get(key); if(entry == null) { entry = new MAB2Entry(); ids.put(key, entry); } if(child) entry.add(pos); else entry.pos(pos); if(Prop.debug) { if((++i & 0x7FFF) == 0) Util.err(" " + i + '\n'); else if((i & 0xFFF) == 0) Util.err("!"); else if((i & 0x3FF) == 0) Util.err("."); } } if(Prop.debug) Util.err("\nParse Offsets (%): %/%\n", ids.size(), p, Performance.getMemory()); // create all titles for(final byte[] id : ids) { final MAB2Entry entry = ids.get(id); final long pos = entry.pos; // check if top entry exists... final byte[] l = pos != 0 ? addEntry(input, pos, entry.size, null) : null; // loop through all children... for(int j = 0; j < entry.size; ++j) { addEntry(input, entry.children[j], 0, l); } if(entry.size != 0 && pos != 0 && !flat) builder.closeElem(); } if(Prop.debug) Util.err("\nCreate Titles: %/%\n", p, Performance.getMemory()); builder.closeElem(); // write the mediovis ids back to disk final PrintOutput out = new PrintOutput("mvids.dat"); for(final byte[] id : mvids) { out.print(id); out.write('\t'); out.println(mvids.get(id)); } out.close(); } @Override public void close() throws IOException { input.close(); } /** * Returns the next id. * @param in input stream * @return id */ private byte[] id(final DataAccess in) { while(in.more()) { if(in.read1() != '\n') continue; final int n = in.read1(); if(n == '0' && in.read1() == '0' && in.read1() == '1') { off = in.cursor() - 3; return ident(in); } } return null; } /** * Returns the next parent id. * @param in input stream * @return id */ private static byte[] par(final DataAccess in) { while(in.more()) { if(in.read1() != '\n') continue; final int b1 = in.read1(); if(b1 == '#' || b1 == '\n') return null; if(b1 == '0' && in.read1() == '1' && in.read1() == '0' || b1 == '4' && in.read1() == '5' && in.read1() == '3') return ident(in); } return null; } /** * Returns the next text. * @param in input stream * @return next text */ private static byte[] ident(final DataAccess in) { in.read1(); int l = 0; for(byte b; (b = in.read1()) >= ' ';) CACHE[l++] = b; return Arrays.copyOf(CACHE, l); } /** Buffer. */ private static final byte[] CACHE = new byte[16]; /** * Gets all characters up to specified character. * @param in input stream * @param delim delimiter * @return byte array */ private byte[] find(final DataAccess in, final byte delim) { buffer.reset(); while(in.more()) { final byte c = in.read1(); if(c == delim) return buffer.toArray(); if(c < 0 || c >= ' ') buffer.add(c); } return null; } /** * Adds an entry. * @param in input stream * @param pos file offset to start from * @param sb number of subordinate titles * @param last last title * @return last title * @throws IOException I/O exception */ private byte[] addEntry(final DataAccess in, final long pos, final int sb, final byte[] last) throws IOException { /* Temporary build data. */ byte[] mvID = null; /* Temporary build data. */ byte[] bibID = null; /* Temporary build data. */ byte[] title = null; /* Temporary build data. */ byte[] description = null; /* Temporary build data. */ byte[] type = null; /* Temporary build data. */ byte[] language = null; /* Temporary build data. */ byte[] original = null; /* Temporary build data. */ byte[] subtitle = null; /* Temporary build data. */ byte[] town = null; /* Temporary build data. */ byte[] publisher = null; /* Temporary build data. */ byte[] year = null; /* Temporary build data. */ byte[] format = null; /* Temporary build data. */ byte[] details = null; /* Temporary build data. */ byte[] note = null; /* Temporary build data. */ byte[] isbn = null; /* Temporary build data. */ byte[] subject = null; /* Temporary build data. */ int nrSigs = 0; /* Temporary build data. */ int nrAuth = 0; /* Temporary build data. */ int nrInst = 0; /* Temporary build data. */ boolean shortTitle = false; // position disk cursor in.cursor(pos); // collect meta-data while(true) { final byte[] line = find(in, (byte) '\n'); final int l = line.length; if(l > 3) { if(line[0] == '#') continue; final int n = toInt(line, 0, 3); if(n == 1) { if(bibID == null) { bibID = string(line); mvID = mvids.get(bibID); if(mvID == null) { mvID = token(++maxid); mvids.put(bibID, mvID); } } } else if(n == 29) { type = mediatypes.get(num(line)); } else if(n == 37 && language == null) { language = language(line); } else if(n == 81) { title = string(line); shortTitle = true; } else if(n >= 100 && n < 200 && (n & 3) == 0) { auth[nrAuth++] = string(line); } else if(n >= 200 && n < 300 && (n & 3) == 0) { inst[nrInst++] = string(line); } else if(n == 304) { original = string(line); } else if(n == 310) { title = string(line); shortTitle = true; } else if(n == 331) { if(title == null) title = string(line); else if(shortTitle) description = string(line); } else if(n == 335) { subtitle = string(line); } else if(n == 340) { if(original == null) original = string(line); } else if(n == 359) { description = merge(description, string(line)); } else if(n == 410) { town = string(line); } else if(n == 412) { publisher = string(line); } else if(n == 425) { year = year(line); } else if(n == 433) { format = string(line); } else if(n == 501) { details = string(line); year = year2(details, year); } else if(n == 537) { note = string(line); } else if(n == 540) { isbn = string(line); } else if(n == 542) { isbn = string(line); } else if(n == 544) { sig[nrSigs++] = string(line); } else if(n == 700) { if(nrSigs == 0) sig[nrSigs++] = string(line); } } else { atts.clear(); atts.add(MV_ID, mvID); atts.add(BIB_ID, bibID); if(sb != 0 && !flat) atts.add(MAX, token(sb)); // merge super and sub titles if(last != null) { if(title == null) title = last; else if(!eq(last, title)) title = concat(last, SEMI, title); } // add line below to omit root nodes builder.openElem(MEDIUM, atts, nsp); add(TYPE, type); add(LANGUAGE, language); for(int s = 0; s < nrAuth; ++s) add(AUTHOR, auth[s]); for(int s = 0; s < nrInst; ++s) add(INSTITUTE, inst[s]); add(ORIGINAL, original); add(TITLE, title); add(SUBTITLE, subtitle); add(DESCRIPTION, description); add(TOWN, town); add(PUBLISHER, publisher); add(YEAR, year); add(FORMAT, format); add(DETAILS, details); add(NOTE, note); for(int s = 0; s < nrSigs; ++s) add(SIGNATURE, sig[s]); // actually: several subjects/lending numbers per medium.. for(int s = 0; s < nrSigs; ++s) { if(subject == null) subject = subjects.get(subject(sig[s])); } add(SUBJECT, subject); add(ISBN, isbn); add(POSTER, posters.get(bibID)); add(GENRE, genres.get(mvID)); add(STATUS, status.get(bibID)); add(LENDINGS, lendings.get(bibID)); if(sb == 0 || flat) builder.closeElem(); return title; } } } /** * Adds a tag and a content node. * @param tag tag to be added * @param cont content to be added * @throws IOException I/O exception */ private void add(final byte[] tag, final byte[] cont) throws IOException { if(cont == null) return; builder.openElem(tag, atts.clear(), nsp); builder.text(utf8(cont, ENCODING)); builder.closeElem(); } /** * Parses and returns a year. * @param line line to be parsed * @return byte array */ private static byte[] year(final byte[] line) { final byte[] n = new byte[4]; final int l = line.length; int c = 0; for(int i = 4; i < l; ++i) { final byte b = line[i]; if(b >= '0' && b <= '9') { n[c++] = b; if(c == 4) return n; } } return c != 0 ? Arrays.copyOf(n, c) : null; } /** * Looks up and returns four digits in the specified line * If no digits are found, the specified year is returned. * @param line line to be parsed * @param yr year * @return year */ private static byte[] year2(final byte[] line, final byte[] yr) { final int l = line.length; int i = -1; int j = -1; while(++i != l) { final byte b = line[i]; if(b < '0' || b > '9') { if(i - 5 == j) break; j = i; } } if(i - 5 != j) return yr; int oy = yr != null ? toInt(yr) : 0; if(oy >= 1400 && oy <= 1950) return yr; final byte[] y = Arrays.copyOfRange(line, j + 1, j + 5); oy = toInt(y); return oy >= 1500 && oy <= 2050 ? y : yr; } /** * Parses and returns a subject. * @param line line to be parsed * @return byte array */ private static byte[] subject(final byte[] line) { final byte[] n = new byte[3]; int i = -1; final int l = line.length; while(++i != l && line[i] < 'a'); int c = 0; while(i != l && line[i] >= 'a') { n[c++] = line[i++]; if(c == 3) return n; } return null; } /** * Corrects special characters in the language attribute. * @param token token to be corrected * @return corrected characters */ private byte[] language(final byte[] token) { final byte[] t = string(token); for(int i = 0; i < t.length; ++i) if(t[i] == '?' || t[i] == '$') t[i] = '+'; final TokenBuilder tb = new TokenBuilder(); for(final byte[] lang : split(t, '+')) { final byte[] l = languages.get(lang); if(!tb.isEmpty()) tb.add('+'); tb.add(l != null ? l : t); } return tb.finish(); } /** * Replaces some characters in the specified line. * @param line line to be modified * @return modified byte array */ private static byte[] string(final byte[] line) { final byte[] tmp = new byte[line.length - 4]; int c = 0; final int l = line.length; boolean space = false; for(int s = 4; s < l; ++s) { byte b = line[s]; // double cross if(b == -121) b = '+'; // delimiter else if(b == -84) b = ' '; else if(b == '<') b = '['; else if(b == '>') b = ']'; if(b == ' ' && (space || s == 4)) continue; space = b == ' '; tmp[c++] = b; } return c == tmp.length ? tmp : Arrays.copyOf(tmp, c); } /** * Replaces some characters in the specified line. * @param line line to be modified * @return modified byte array */ private static byte[] num(final byte[] line) { final int l = line.length; int s = 3; while(++s < l && line[s] == '0'); return Arrays.copyOfRange(line, s, line.length); } /** * Merges two byte arrays. * @param text1 first text * @param text2 second text * @return byte array */ private static byte[] merge(final byte[] text1, final byte[] text2) { return text1 == null ? text2 : concat(text1, token(". "), text2); } /** * Fills the specified hash with the file input. * @param hash hash to be filled * @param fn file to be read */ private void index(final TokenMap hash, final String fn) { try { final DataAccess in = new DataAccess(new IOFile(fn + ".dat")); while(true) { final byte[] key = find(in, (byte) '\t'); final byte[] val = find(in, (byte) '\n'); if(key == null) break; hash.put(key, val); } } catch(final IOException ex) { Util.debug(ex); } } /** * This is a simple data structure for storing MAB2 entries. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ static final class MAB2Entry { /** Children offsets. */ long[] children; /** File offset; 0 if no parent node exists. */ long pos; /** Number of children. */ int size; /** * Adds a child. * @param c child to be added */ void add(final long c) { if(children == null) children = new long[1]; else if(size == children.length) children = Arrays.copyOf(children, Array.newSize(size)); children[size++] = c; } /** * Sets the file offset. * @param p file offset */ void pos(final long p) { pos = p; } } } basex-7.7.2/basex-core/src/main/java/org/basex/build/file/ParserProp.java000066400000000000000000000025701222453003200261610ustar00rootroot00000000000000package org.basex.build.file; import java.io.*; import org.basex.core.*; import org.basex.util.*; /** * This class contains parser properties. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ParserProp extends AProp { /** Parser option: column separator. */ public static final Object[] SEPARATOR = { "separator", "comma" }; /** Parser option: header line. */ public static final Object[] HEADER = { "header", false }; /** Parser option: line. */ public static final Object[] LINES = { "lines", true }; /** Parser option: flat. */ public static final Object[] FLAT = { "flat", false }; /** Parser option: encoding. */ public static final Object[] ENCODING = { "encoding", Token.UTF8 }; /** Parser option: jsonml format. */ public static final Object[] JSONML = { "jsonml", false }; /** Parser option: format (obsolete). */ public static final Object[] FORMAT = { "format", "verbose" }; /** * Constructor. */ public ParserProp() { super(); } /** * Constructor, specifying initial properties. * @param s property string. Properties are separated with commas ({@code ,}), * key/values with the equality character ({@code =}). * @throws IOException I/O exception */ public ParserProp(final String s) throws IOException { parse(s); } } basex-7.7.2/basex-core/src/main/java/org/basex/build/file/TextParser.java000066400000000000000000000045641222453003200261720ustar00rootroot00000000000000package org.basex.build.file; import static org.basex.util.Token.*; import java.io.*; import org.basex.build.*; import org.basex.core.*; import org.basex.io.*; import org.basex.io.in.*; import org.basex.util.*; /** * This class parses files in the plain-text format * and sends events to the specified database builder. * *

The parser provides one option, which can be specified via * SET PARSEROPT ...:

* *
    *
  • encoding specifies the input encoding * (default: UTF-8).
  • *
  • lines specified if the resulting XML splits the input * into lines. Can be set to yes or no * (default: yes).
  • *
* *

Example: * SET PARSEROPT lines=no; CREATE DB ...
* Description: Puts complete input into one text node.

* * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class TextParser extends SingleParser { /** Text element. */ private static final byte[] TEXT = token("text"); /** Line element. */ private static final byte[] LINE = token("line"); /** Lines format. */ private final boolean lines; /** Encoding. */ private final String encoding; /** * Constructor. * @param source document source * @param pr database properties * @throws IOException I/O exception */ public TextParser(final IO source, final Prop pr) throws IOException { super(source, pr); // set parser properties final ParserProp props = new ParserProp(pr.get(Prop.PARSEROPT)); lines = props.is(ParserProp.LINES); encoding = props.get(ParserProp.ENCODING); } @Override public void parse() throws IOException { builder.openElem(TEXT, atts, nsp); final TokenBuilder tb = new TokenBuilder(); final NewlineInput nli = new NewlineInput(src).encoding(encoding); try { for(int ch; (ch = nli.read()) != -1;) { if(ch == '\n' && lines) { builder.openElem(LINE, atts, nsp); builder.text(tb.finish()); builder.closeElem(); tb.reset(); } else { tb.add(XMLToken.valid(ch) ? ch : '?'); } } } finally { nli.close(); } if(!lines) builder.text(tb.finish()); builder.closeElem(); } } basex-7.7.2/basex-core/src/main/java/org/basex/build/file/package.html000066400000000000000000000001111222453003200254670ustar00rootroot00000000000000 Classes for creating databases from different sources. basex-7.7.2/basex-core/src/main/java/org/basex/build/package.html000066400000000000000000000000771222453003200245630ustar00rootroot00000000000000 Classes for creating new database instances. basex-7.7.2/basex-core/src/main/java/org/basex/build/xml/000077500000000000000000000000001222453003200230765ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/build/xml/CatalogWrapper.java000066400000000000000000000036701222453003200266620ustar00rootroot00000000000000package org.basex.build.xml; import static org.basex.util.Reflect.*; import java.lang.reflect.*; import org.xml.sax.*; /** * Wraps the CatalogResolver object. * Searches for presence of one of the xml resolver packages * {@code org.apache.xml.resolver.tools.CatalogResolver} or * {@code code com.sun.org.apache.xml.internal.resolver.tools.CatalogResolver}. * * @author BaseX Team 2005-12, BSD License * @author Michael Seiferle */ public final class CatalogWrapper { /** Package declaration for CatalogManager. */ private static final Class CMP = find(new String[] { "org.apache.xml.resolver.CatalogManager", "com.sun.org.apache.xml.internal.resolver.CatalogManager" }); /** Package declaration for CatalogResolver constructor. */ private static final Constructor CRP = find(find(new String[] { "org.apache.xml.resolver.tools.CatalogResolver", "com.sun.org.apache.xml.internal.resolver.tools.CatalogResolver" }), CMP); /** Instance of catalog manager. */ private static final Object CM = get(CMP); /** Hidden constructor. */ private CatalogWrapper() { } /** * Checks if a CatalogResolver is available. * @return result of check */ public static boolean available() { return CM != null; } /** * Decorates the {@link XMLReader} with the catalog resolver if it is found * in the classpath. Does nothing otherwise. * @param reader XML reader * @param cat path to catalog file */ public static void set(final XMLReader reader, final String cat) { if(CM == null) return; invoke(method(CMP, "setIgnoreMissingProperties", boolean.class), CM, true); invoke(method(CMP, "setCatalogFiles", String.class), CM, cat); invoke(method(CMP, "setPreferPublic", boolean.class), CM, true); invoke(method(CMP, "setUseStaticCatalog", boolean.class), CM, false); invoke(method(CMP, "setVerbosity", int.class), CM, 0); reader.setEntityResolver((EntityResolver) get(CRP, CM)); } } basex-7.7.2/basex-core/src/main/java/org/basex/build/xml/DOMWrapper.java000066400000000000000000000066651222453003200257360ustar00rootroot00000000000000package org.basex.build.xml; import static org.basex.core.Text.*; import static org.basex.util.Token.*; import java.io.*; import java.util.*; import org.basex.build.*; import org.basex.core.*; import org.basex.util.*; import org.w3c.dom.*; import org.w3c.dom.Text; /** * This class converts an DOM document instance to a database representation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DOMWrapper extends Parser { /** Strip namespaces. */ private final boolean stripNS; /** Name of the document. */ private final String filename; /** Root document. */ private final Node root; /** Chop whitespaces. */ private final boolean chop; /** Element counter. */ private int nodes; /** * Constructor. * @param doc document instance * @param fn filename * @param pr database properties */ public DOMWrapper(final Document doc, final String fn, final Prop pr) { super(fn, pr); root = doc; filename = fn; chop = pr.is(Prop.CHOP); stripNS = pr.is(Prop.STRIPNS); } @Override public void parse(final Builder builder) throws IOException { builder.openDoc(token(filename)); final Stack stack = new Stack(); stack.push(new NodeIterator(root)); while(!stack.empty()) { final NodeIterator ni = stack.peek(); if(ni.more()) { final Node n = ni.curr(); if(n instanceof Element) { stack.push(new NodeIterator(n)); atts.clear(); nsp.clear(); final NamedNodeMap at = n.getAttributes(); final int as = at.getLength(); for(int a = 0; a < as; ++a) { final Attr att = (Attr) at.item(a); final byte[] an = token(att.getName()); final byte[] av = token(att.getValue()); if(eq(an, XMLNS)) { if(!stripNS) nsp.add(EMPTY, av); } else if(startsWith(an, XMLNSC)) { if(!stripNS) nsp.add(local(an), av); } else { atts.add(stripNS ? local(an) : an, av); } } final byte[] en = token(n.getNodeName()); builder.openElem(stripNS ? local(en) : en, atts, nsp); } else if(n instanceof Text) { final String s = n.getNodeValue(); builder.text(token(chop ? s.trim() : s)); } else if(n instanceof Comment) { builder.comment(token(n.getNodeValue())); } else if(n instanceof ProcessingInstruction) { builder.pi(token(n.getNodeName() + ' ' + n.getNodeValue())); } ++nodes; } else { stack.pop(); if(stack.empty()) break; builder.closeElem(); } } builder.closeDoc(); } @Override public String det() { return Util.info(NODES_PARSED_X, filename, nodes); } @Override public double prog() { return nodes / 1000000d % 1; } /** Node iterator. */ private static final class NodeIterator { /** Node list. */ private final NodeList nl; /** Position. */ private int i = -1; /** * Constructor. * @param n input node */ NodeIterator(final Node n) { nl = n.getChildNodes(); } /** * Checks if more nodes are found. * @return result of check */ boolean more() { return ++i < nl.getLength(); } /** * Returns the current node. * @return current node */ Node curr() { return nl.item(i); } } } basex-7.7.2/basex-core/src/main/java/org/basex/build/xml/SAXHandler.java000066400000000000000000000124161222453003200256760ustar00rootroot00000000000000package org.basex.build.xml; import static org.basex.util.Token.*; import java.io.*; import org.basex.build.*; import org.basex.core.*; import org.basex.data.*; import org.basex.util.*; import org.basex.util.list.*; import org.xml.sax.*; import org.xml.sax.ext.*; import org.xml.sax.helpers.*; /** * SAX Parser wrapper. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class SAXHandler extends DefaultHandler implements LexicalHandler { /** Builder reference. */ protected final Builder builder; /** Strip namespaces. */ private final boolean stripNS; /** Temporary attribute array. */ private final Atts atts = new Atts(); /** Temporary string builder for high surrogates. */ private final StringBuilder sb = new StringBuilder(); /** Temporary namespace array. */ private final Atts nsp = new Atts(); /** DTD flag. */ private boolean dtd; /** Whitespace handling. */ private final BoolList chops = new BoolList(); /** Whitespace chopping. */ private final boolean chop; /** Element counter. */ int nodes; static { // needed for XMLEntityManager: increase entity limit AProp.setSystem("entityExpansionLimit", "536870912"); // needed for frequently visited sites: modify user agent AProp.setSystem("http.agent", "sax"); } /** * Constructor. * @param build builder reference * @param ch chopping flag * @param sn strip namespaces */ public SAXHandler(final Builder build, final boolean ch, final boolean sn) { builder = build; stripNS = sn; chop = ch; chops.push(ch); } @Override public void startElement(final String uri, final String ln, final String qn, final Attributes at) throws SAXException { try { finishText(); final int as = at.getLength(); for(int a = 0; a < as; ++a) { final byte[] an = token(at.getQName(a)); final byte[] av = token(at.getValue(a)); atts.add(stripNS ? local(an) : an, av); } final byte[] en = token(qn); builder.openElem(stripNS ? local(en) : en, atts, nsp); boolean c = chops.peek(); if(chop) { final int a = atts.get(DataText.XML_SPACE); if(a != -1) { final byte[] s = atts.value(a); if(eq(s, DataText.DEFAULT)) c = true; else if(eq(s, DataText.PRESERVE)) c = false; } } chops.push(c); atts.clear(); nsp.clear(); ++nodes; } catch(final IOException ex) { error(ex); } } @Override public void endElement(final String uri, final String ln, final String qn) throws SAXException { try { finishText(); builder.closeElem(); chops.pop(); } catch(final IOException ex) { error(ex); } } @Override public void characters(final char[] ch, final int s, final int l) { sb.append(ch, s, l); } @Override public void processingInstruction(final String nm, final String cont) throws SAXException { if(dtd) return; try { finishText(); builder.pi(token(nm + ' ' + cont)); } catch(final IOException ex) { error(ex); } } @Override public void comment(final char[] ch, final int s, final int l) throws SAXException { if(dtd) return; try { finishText(); builder.comment(token(new String(ch, s, l))); } catch(final IOException ex) { error(ex); } } /** * Checks if a text node has to be written. * @throws IOException I/O exception */ private void finishText() throws IOException { if(sb.length() != 0) { final String s = sb.toString(); builder.text(token(chops.peek() ? s.trim() : s)); sb.setLength(0); } } /** * Creates and throws a SAX exception for the specified exception. * @param ex exception * @throws SAXException SAX exception */ protected static void error(final IOException ex) throws SAXException { final SAXException ioe = new SAXException(Util.message(ex)); ioe.setStackTrace(ex.getStackTrace()); throw ioe; } // EntityResolver /* public InputSource resolveEntity(String pub, String sys) { } */ // DTDHandler /* public void notationDecl(String name, String pub, String sys) { } */ /* public void unparsedEntityDecl(final String name, final String pub, final String sys, final String not) { } */ // ContentHandler /*public void setDocumentLocator(final Locator locator) { } */ @Override public void startPrefixMapping(final String prefix, final String uri) { if(!stripNS) nsp.add(token(prefix), token(uri)); } /*public void endPrefixMapping(final String prefix) { } */ /*public void ignorableWhitespace(char[] ch, int s, int l) { } */ /*public void skippedEntity(final String name) { } */ // ErrorHandler /* public void warning(final SAXParseException ex) { } */ /* public void fatalError(final SAXParseException ex) { } */ // LexicalHandler @Override public void startDTD(final String n, final String pid, final String sid) { dtd = true; } @Override public void endDTD() { dtd = false; } @Override public void endCDATA() { /* ignored. */ } @Override public void endEntity(final String n) { /* ignored. */ } @Override public void startCDATA() { /* ignored. */ } @Override public void startEntity(final String n) { /* ignored. */ } } basex-7.7.2/basex-core/src/main/java/org/basex/build/xml/SAXWrapper.java000066400000000000000000000117671222453003200257510ustar00rootroot00000000000000package org.basex.build.xml; import static org.basex.core.Text.*; import java.io.*; import javax.xml.parsers.*; import javax.xml.transform.sax.*; import org.basex.build.*; import org.basex.core.*; import org.basex.io.*; import org.basex.util.*; import org.xml.sax.*; /** * This class parses an XML document with Java's internal SAX parser. Note that * not all files cannot be parsed with the default parser; for example, the * DBLP documents contain too many entities and cause an out of memory error. * The internal {@link XMLParser} can be used as alternative. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class SAXWrapper extends SingleParser { /** External DTD parsing. */ private static final String EXTDTD = "http://apache.org/xml/features/nonvalidating/load-external-dtd"; /** Lexical handler. */ private static final String LEXHANDLER = "http://xml.org/sax/properties/lexical-handler"; /** File counter. */ long counter; /** Current line. */ int line = 1; /** SAX handler reference. */ private SAXHandler saxh; /** Optional XML reader. */ private final SAXSource saxs; /** File length. */ private long length; /** * Constructor. * @param source sax source * @param pr Properties */ public SAXWrapper(final IO source, final Prop pr) { super(source, pr); saxs = new SAXSource(source.inputSource()); } @Override public void parse() throws IOException { final InputSource is = wrap(saxs.getInputSource()); final String in = saxs.getSystemId() == null ? DOTS : saxs.getSystemId(); try { XMLReader r = saxs.getXMLReader(); if(r == null) { final SAXParserFactory f = SAXParserFactory.newInstance(); f.setFeature(EXTDTD, prop.is(Prop.DTD)); f.setFeature("http://xml.org/sax/features/use-entity-resolver2", false); f.setNamespaceAware(true); f.setValidating(false); f.setXIncludeAware(true); r = f.newSAXParser().getXMLReader(); } saxh = new SAXHandler(builder, prop.is(Prop.CHOP), prop.is(Prop.STRIPNS)); final String cat = prop.get(Prop.CATFILE); if(!cat.isEmpty()) CatalogWrapper.set(r, cat); r.setDTDHandler(saxh); r.setContentHandler(saxh); r.setProperty(LEXHANDLER, saxh); r.setErrorHandler(saxh); if(is != null) r.parse(is); else r.parse(saxs.getSystemId()); } catch(final SAXParseException ex) { final String msg = Util.info(SCANPOS_X_X, in, ex.getLineNumber(), ex.getColumnNumber()) + COLS + Util.message(ex); throw new IOException(msg, ex); } catch(final ProcException ex) { throw ex; } catch(final Exception ex) { // occurs, e.g. if document encoding is invalid: // prefix message with source id String msg = Util.message(ex); if(in != null) msg = '"' + in + '"' + COLS + msg; // wrap and return original message throw new IOException(msg, ex); } finally { if(is != null) { try { final Reader r = is.getCharacterStream(); if(r != null) r.close(); final InputStream ist = is.getByteStream(); if(ist != null) ist.close(); } catch(final IOException ex) { Util.debug(ex); } } } } /** * Wraps the input source with a stream which counts the number of read bytes * and parsed lines. * @param is input source * @return resulting stream * @throws IOException I/O exception */ private InputSource wrap(final InputSource is) throws IOException { if(is == null) return is; // choose input stream final InputStream in; if(is.getByteStream() != null) { in = is.getByteStream(); } else if(is.getSystemId() == null || is.getSystemId().isEmpty()) { return is; } else if(src instanceof IOFile) { in = new FileInputStream(src.path()); } else if(src instanceof IOContent) { in = new ByteArrayInputStream(src.read()); } else { return is; } // retrieve/estimate number of bytes to be read length = src.length(); try { if(length <= 0) length = in.available(); } catch(final IOException ex) { in.close(); throw ex; } // create wrapper final InputSource tmp = new InputSource(new InputStream() { final InputStream buffer = in instanceof ByteArrayInputStream ? in : new BufferedInputStream(in); @Override public int read() throws IOException { final int i = buffer.read(); if(i == '\n') ++line; ++counter; return i; } @Override public void close() throws IOException { buffer.close(); } }); saxs.setInputSource(tmp); saxs.setSystemId(is.getSystemId()); return tmp; } @Override public String det() { return length == 0 ? super.det() : Util.info(SCANPOS_X_X, src.name(), line); } @Override public double prog() { return length == 0 ? saxh == null ? 0 : saxh.nodes / 3000000d % 1 : (double) counter / length; } } basex-7.7.2/basex-core/src/main/java/org/basex/build/xml/XMLParser.java000066400000000000000000000146321222453003200255640ustar00rootroot00000000000000package org.basex.build.xml; import static org.basex.build.BuildText.*; import static org.basex.util.Token.*; import java.io.*; import org.basex.build.*; import org.basex.build.BuildText.Type; import org.basex.core.*; import org.basex.data.*; import org.basex.io.*; import org.basex.util.list.*; /** * This class parses the tokens that are delivered by the {@link XMLScanner} and * sends them to the specified database builder. This class offers a more * tolerant alternative to Java's internal SAX parser, which is used by the * {@link SAXWrapper} class. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class XMLParser extends SingleParser { /** Strip namespaces. */ private final boolean stripNS; /** Scanner reference. */ private final XMLScanner scanner; /** Names of opened elements. */ private final TokenList tags = new TokenList(); /** Whitespace handling. */ private final BoolList chops = new BoolList(); /** Chop whitespaces. */ private final boolean chop; /** Allow document fragment as input. */ private final boolean fragment; /** Closed root tag. */ private boolean closed; /** * Constructor. * @param source document source * @param pr database properties * @throws IOException I/O exception */ public XMLParser(final IO source, final Prop pr) throws IOException { this(source, pr, false); } /** * Constructor. * @param source document source * @param pr database properties * @param frag allow parsing of document fragment * @throws IOException I/O exception */ public XMLParser(final IO source, final Prop pr, final boolean frag) throws IOException { super(source, pr); scanner = new XMLScanner(source, pr, frag); stripNS = pr.is(Prop.STRIPNS); chop = pr.is(Prop.CHOP); chops.push(chop); fragment = frag; } @Override public final void parse() throws IOException { // loop until all tokens have been processed scanner.more(); while(true) { if(scanner.type == Type.TEXT) { final byte[] text = scanner.token.finish(); if(!tags.isEmpty() || fragment || !ws(text)) { if(chops.peek()) scanner.token.trim(); builder.text(scanner.token.finish()); } } else if(scanner.type == Type.COMMENT) { builder.comment(scanner.token.finish()); } else if(scanner.type == Type.PI) { builder.pi(scanner.token.finish()); } else if(scanner.type == Type.EOF) { break; } else if(scanner.type != Type.DTD) { // L_BR, L_BR_CLOSE if(!fragment && closed) throw new BuildException(MOREROOTS, det()); if(!parseTag()) break; continue; } if(!scanner.more()) break; } scanner.close(); builder.encoding(scanner.encoding); if(!tags.isEmpty()) throw new BuildException(DOCOPEN, det(), tags.pop()); } @Override public void close() throws IOException { scanner.close(); } /** * Parses an XML tag. * @throws IOException I/O exception * @return result of scanner step */ private boolean parseTag() throws IOException { // close element if(scanner.type == Type.L_BR_CLOSE) { scanner.more(); // get tag name byte[] tag = consumeToken(Type.ELEMNAME); if(stripNS) tag = local(tag); skipSpace(); if(tags.isEmpty()) throw new BuildException(OPEN, det(), tag); final byte[] open = tags.pop(); if(!eq(open, tag)) throw new BuildException(CLOSINGELEM, det(), tag, open); chops.pop(); builder.closeElem(); if(tags.isEmpty()) closed = true; return consume(Type.R_BR); } consume(Type.L_BR); atts.clear(); nsp.clear(); // get element name byte[] en = consumeToken(Type.ELEMNAME); if(stripNS) en = local(en); skipSpace(); // parse optional attributes while(scanner.type != Type.R_BR && scanner.type != Type.CLOSE_R_BR) { final byte[] an = consumeToken(Type.ATTNAME); skipSpace(); consume(Type.EQ); skipSpace(); consume(Type.QUOTE); byte[] av = EMPTY; if(scanner.type == Type.ATTVALUE) { av = scanner.token.finish(); scanner.more(); } consume(Type.QUOTE); if(startsWith(an, XMLNSC)) { // open namespace... if(!stripNS) nsp.add(local(an), av); } else if(eq(an, XMLNS)) { // open namespace... if(!stripNS) nsp.add(EMPTY, av); } else { // add attribute atts.add(stripNS ? local(an) : an, av); } if(scanner.type != Type.R_BR && scanner.type != Type.CLOSE_R_BR) { consume(Type.WS); } } // send empty element to builder if(scanner.type == Type.CLOSE_R_BR) { builder.emptyElem(en, atts, nsp); if(tags.isEmpty()) closed = true; return scanner.more(); } // send start element builder.openElem(en, atts, nsp); tags.push(en); boolean c = chops.peek(); if(chop) { final int a = atts.get(DataText.XML_SPACE); if(a != -1) { final byte[] s = atts.value(a); if(eq(s, DataText.DEFAULT)) c = true; else if(eq(s, DataText.PRESERVE)) c = false; } } chops.push(c); return consume(Type.R_BR); } /** * Checks if the current token matches the specified type. * @param t token type to be checked * @return result of scanner step * @throws IOException I/O exception */ private boolean consume(final Type t) throws IOException { if(scanner.type == t) return scanner.more(); throw new BuildException(PARSEINV, det(), t.string, scanner.type.string); } /** * Returns the token for the specified token type. If the current token type * is wrong, a {@code null} reference is returned. * @param t token type * @return token or {@code null} if the token type is wrong * @throws IOException I/O exception */ private byte[] consumeToken(final Type t) throws IOException { if(scanner.type == t) { final byte[] tok = scanner.token.finish(); scanner.more(); return tok; } throw new BuildException(PARSEINV, det(), t.string, scanner.type.string); } /** * Skips optional whitespaces. * @throws IOException I/O exception */ private void skipSpace() throws IOException { if(scanner.type == Type.WS) scanner.more(); } @Override protected final String det() { return scanner.det(); } @Override public final double prog() { return scanner.prog(); } } basex-7.7.2/basex-core/src/main/java/org/basex/build/xml/XMLScanner.java000066400000000000000000000734201222453003200257210ustar00rootroot00000000000000package org.basex.build.xml; import static org.basex.build.BuildText.*; import static org.basex.core.Text.*; import static org.basex.util.Token.*; import static org.basex.util.XMLToken.*; import java.io.*; import java.util.*; import org.basex.build.*; import org.basex.build.BuildText.Type; import org.basex.core.*; import org.basex.io.*; import org.basex.io.in.*; import org.basex.util.*; import org.basex.util.hash.*; /** * This class scans an XML document and creates atomic tokens. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Andreas Weiler */ final class XMLScanner extends Proc { /** Entities. */ private static final String[] ENTITIES = { "amp", "&", "apos", "'", "quot", "\"", "lt", "<", "gt", ">" }; /** PublicID characters. */ private static final byte[] PUBIDTOK = token(" \n'()+,/=?;!*#@$%"); /** Question mark. */ private static final byte[] QUESTION = { '?' }; /** Ampersand entity. */ private static final byte[] AMPER = { '&' }; /** Scanning states. */ private enum State { /** Content state. */ CONTENT, /** Tag state. */ TAG, /** Attribute state. */ ATT, /** Quoted state. */ QUOTE, } /** Character buffer for the current token. */ final TokenBuilder token = new TokenBuilder(); /** Document encoding. */ final String encoding; /** Current token type. */ Type type; /** Index for all entity names. */ private final TokenMap ents = new TokenMap(); /** Index for all PEReferences. */ private final TokenMap pents = new TokenMap(); /** DTD flag. */ private final boolean dtd; /** Allow document fragment as input. */ private final boolean fragment; /** Current scanner state. */ private State state = State.CONTENT; /** Scanning prolog (will be invalidated when root element is parsed). */ private boolean prolog = true; /** Parameter entity parsing. */ private boolean pe; /** Text mode. */ private boolean text = true; /** Current quote character. */ private int quote; /** XML input. */ private XMLInput input; /** * Initializes the scanner. * @param f input file * @param pr database properties * @param frag allow parsing of document fragment * @throws IOException I/O exception */ XMLScanner(final IO f, final Prop pr, final boolean frag) throws IOException { input = new XMLInput(f); fragment = frag; try { for(int e = 0; e < ENTITIES.length; e += 2) ents.put(ENTITIES[e], ENTITIES[e + 1]); dtd = pr.is(Prop.DTD); String enc = null; // process document declaration... if(consume(DOCDECL)) { if(s()) { if(!version()) error(DECLSTART); boolean s = s(); enc = encoding(); if(enc != null) { if(!s) error(WSERROR); s = s(); } if(sddecl() != null && !s) error(WSERROR); s(); int ch = nextChar(); if(ch != '?') error(WRONGCHAR, '?', (char) ch); ch = nextChar(); if(ch != '>') error(WRONGCHAR, '>', (char) ch); } else { prev(5); } } encoding = enc == null ? UTF8 : enc; if(!fragment) { final int n = consume(); if(!s(n)) { if(n != '<') error(n == 0 ? DOCEMPTY : BEFOREROOT); prev(1); } } } catch(final IOException ex) { input.close(); throw ex; } } /** * Reads and interprets the next token from the input stream. * @return true if the document scanning has been completed * @throws IOException I/O exception */ boolean more() throws IOException { // gets next character from the input stream token.reset(); final int ch = consume(); if(ch == 0) { type = Type.EOF; return false; } // checks the scanner state switch(state) { case CONTENT: scanCONTENT(ch); break; case TAG: case ATT: scanTAG(ch); break; case QUOTE: scanATTVALUE(ch); } return true; } /** * Finishes file scanning. * @throws IOException I/O exception */ void close() throws IOException { input.close(); if(!fragment && prolog) error(DOCEMPTY); } /** * Scans XML content. * @param ch current character * @throws IOException I/O exception */ private void scanCONTENT(final int ch) throws IOException { // parse TEXT if(text && (ch != '<' || isCDATA())) { content(ch); return; } // parse a TAG text = true; final int c = nextChar(); // parse comments etc... if(c == '!') { if(consume('-') && consume('-')) { type = Type.COMMENT; comment(); } else if(!fragment && consume(DOCTYPE)) { type = Type.DTD; dtd(); } else { error(COMMDASH); } return; } // checking a PI if(c == '?') { type = Type.PI; pi(); return; } prolog = false; state = State.TAG; // closing tag... if(c == '/') { type = Type.L_BR_CLOSE; return; } // opening tag... type = Type.L_BR; prev(1); } /** * Scans an XML tag. * @param ch current character * @throws IOException I/O exception */ private void scanTAG(final int ch) throws IOException { int c = ch; // scan tag end... if(c == '>') { type = Type.R_BR; state = State.CONTENT; } else if(c == '=') { // scan equal sign... type = Type.EQ; } else if(c == '\'' || c == '"') { // scan quote... type = Type.QUOTE; state = State.QUOTE; quote = c; } else if(c == '/') { // scan empty tag end... type = Type.CLOSE_R_BR; if((c = nextChar()) == '>') { state = State.CONTENT; } else { token.add(c); error(CLOSING); } } else if(s(c)) { // scan whitespace... type = Type.WS; } else if(isStartChar(c)) { // scan tag name... type = state == State.ATT ? Type.ATTNAME : Type.ELEMNAME; do token.add(c); while(isChar(c = nextChar())); prev(1); state = State.ATT; } else { // undefined character... error(CHARACTER, (char) c); } } /** * Scans a quoted token. * @param ch current character * @throws IOException I/O exception */ private void scanATTVALUE(final int ch) throws IOException { if(ch == quote) { type = Type.QUOTE; state = State.ATT; } else { type = Type.ATTVALUE; attValue(ch); prev(1); } } /** * Scans an attribute value. [10] * @param ch current character * @throws IOException I/O exception */ private void attValue(final int ch) throws IOException { boolean wrong = false; int c = ch; do { if(c == 0) error(ATTCLOSE, (char) c); wrong |= c == '\'' || c == '"'; if(c == '<') error(wrong ? ATTCLOSE : ATTCHAR, (char) c); if(c == 0x0A) c = ' '; if(c == '&') { // verify... final byte[] r = ref(true); if(r.length == 1) token.add(r); else if(!input.add(r, false)) error(RECENT); } else { token.add(c); } } while((c = consume()) != quote); } /** * Scans XML text. * @param ch current character * @throws IOException I/O exception */ private void content(final int ch) throws IOException { type = Type.TEXT; boolean f = true; int c = ch; while(c != 0) { if(c != '<') { if(c == '&') { // scan entity final byte[] r = ref(true); if(r.length == 1) token.add(r); else if(!input.add(r, false)) error(RECENT); } else { if(c == ']') { // ']]>' not allowed in content if(consume() == ']') { if(consume() == '>') error(CONTCDATA); prev(1); } prev(1); } // add character to cached content token.add(c); } } else { if(!f && !isCDATA()) { text = false; prev(1); return; } cDATA(); } c = consume(); f = false; } // end of file if(!fragment) { if(!ws(token.finish())) error(AFTERROOT); type = Type.EOF; } } /** * Checks input for CDATA section... <![DATA[...]]>. * @return true for CDATA * @throws IOException I/O exception */ private boolean isCDATA() throws IOException { if(!consume('!')) return false; if(!consume('[')) { prev(1); return false; } if(!consume(CDATA)) error(CDATASEC); return true; } /** * Scans CDATA. * @throws IOException I/O exception */ private void cDATA() throws IOException { int ch; while(true) { while((ch = nextChar()) != ']') token.add(ch); if(consume(']')) { if(consume('>')) return; prev(1); } token.add(ch); } } /** * Scans a comment. * @throws IOException I/O exception */ private void comment() throws IOException { do { final int ch = nextChar(); if(ch == '-' && consume('-')) { check('>'); return; } token.add(ch); } while(true); } /** * Scans a processing instruction. * @throws IOException I/O exception */ private void pi() throws IOException { final byte[] tok = name(true); if(eq(lc(tok), XML)) error(PIRES); token.add(tok); int ch = nextChar(); if(ch != '?' && !ws(ch)) error(PITEXT); do { while(ch != '?') { token.add(ch); ch = nextChar(); } if((ch = consume()) == '>') return; token.add('?'); } while(true); } /** * Scans whitespaces. * @return true for whitespaces * @throws IOException I/O exception */ private boolean s() throws IOException { final int ch = consume(); if(s(ch)) return true; prev(1); return false; } /** * Checks input for whitespaces; if none are found, throws an error. * @throws IOException I/O exception */ private void checkS() throws IOException { if(!s()) error(NOWS, (char) consume()); } /** * Checks input for the specified character. * @param ch character to be found * @throws IOException I/O exception */ private void check(final char ch) throws IOException { final int c = consume(); if(c != ch) error(WRONGCHAR, ch, (char) c); } /** * Checks input for the specified token. * @param tok token to be found * @throws IOException I/O exception */ private void check(final byte[] tok) throws IOException { if(!consume(tok)) error(WRONGCHAR, tok, (char) consume()); } /** * Scans whitespaces. * @param ch current character * @return true for whitespaces * @throws IOException I/O exception */ private boolean s(final int ch) throws IOException { int c = ch; if(ws(c)) { do c = consume(); while(ws(c)); prev(1); return true; } return false; } /** * Consumes a quote. * @return found quote * @throws IOException I/O exception */ private int qu() throws IOException { final int qu = consume(); if(qu != '\'' && qu != '"') error(SCANQUOTE, (char) qu); return qu; } /** * Scans a reference. [67] * @param f dissolve entities * @return entity * @throws IOException I/O exception */ private byte[] ref(final boolean f) throws IOException { // scans numeric entities if(consume('#')) { // [66] final TokenBuilder ent = new TokenBuilder(); int b = 10; int ch = nextChar(); ent.add(ch); if(ch == 'x') { b = 0x10; ent.add(ch = nextChar()); } int n = 0; do { final boolean m = ch >= '0' && ch <= '9'; final boolean h = b == 0x10 && (ch >= 'a' && ch <= 'f' || ch >= 'A' && ch <= 'F'); if(!m && !h) { completeRef(ent); return QUESTION; } n *= b; n += ch & 0x0F; if(!m) n += 9; ent.add(ch = nextChar()); } while(ch != ';'); if(!valid(n)) return QUESTION; ent.reset(); ent.add(n); return ent.finish(); } // scans predefined entities [68] final byte[] name = name(false); if(!consume(';')) return QUESTION; if(!f) return concat(AMPER, name, SEMI); byte[] en = ents.get(name); if(en == null) { // unknown entity: try HTML entities (lazy initialization) if(HTMLENTS.isEmpty()) { for(int s = 0; s < HTMLENTITIES.length; s += 2) { HTMLENTS.put(HTMLENTITIES[s], HTMLENTITIES[s + 1]); } } en = HTMLENTS.get(name); } return en == null ? QUESTION : en; } /** * Scans a PEReference. [69] * @return entity * @throws IOException I/O exception */ private byte[] peRef() throws IOException { // scans predefined entities final byte[] name = name(true); consume(';'); final byte[] en = pents.get(name); if(en != null) return en; return name; } /** * Adds some characters to the entity. * @param ent token builder * @throws IOException I/O exception */ private void completeRef(final TokenBuilder ent) throws IOException { int ch = consume(); while(ent.size() < 10 && ch >= ' ' && ch != ';') { ent.add(ch); ch = consume(); } } /** * Reads next character or throws an exception if all bytes have been read. * @return next character * @throws IOException I/O exception */ private int nextChar() throws IOException { final int ch = consume(); if(ch == 0) error(UNCLOSED, token); return ch; } /** * Jumps the specified number of characters back. * @param p number of characters */ private void prev(final int p) { input.prev(p); } /** * Reads next character or throws an exception if all bytes have been read. * @return next character * @throws IOException I/O exception */ private int consume() throws IOException { while(true) { final int ch = input.read(); if(ch == -1) return 0; if(ch == '%' && pe) { // [69] final byte[] key = name(true); final byte[] val = pents.get(key); if(val == null) error(UNKNOWNPE, key); check(';'); input.add(val, true); } else { return ch; } } } /** * Consumes the specified character. * @param ch character to be found * @return true if token was found * @throws IOException I/O exception */ private boolean consume(final char ch) throws IOException { if(consume() == ch) return true; prev(1); return false; } /** * Consumes the specified token. * @param tok token to be found * @return true if token was found * @throws IOException I/O exception */ private boolean consume(final byte[] tok) throws IOException { for(int t = 0; t < tok.length; ++t) { final int ch = consume(); if(ch != tok[t]) { prev(t + 1); return false; } } return true; } /** * Consumes an XML name. [5] * @param f force parsing * @return name * @throws IOException I/O exception */ private byte[] name(final boolean f) throws IOException { final TokenBuilder name = new TokenBuilder(); int c = consume(); if(!isStartChar(c)) { if(f) error(INVNAME); prev(1); return null; } do name.add(c); while(isChar(c = nextChar())); prev(1); return name.finish(); } /** * Consumes an Nmtoken. [7] * @throws IOException I/O exception */ private void nmtoken() throws IOException { final TokenBuilder name = new TokenBuilder(); int c; while(isChar(c = nextChar())) name.add(c); prev(1); if(name.isEmpty()) error(INVNAME); } /** * Scans doc type definitions. [28] * @throws IOException I/O exception */ private void dtd() throws IOException { if(!prolog) error(TYPEAFTER); if(!s()) error(ERRDT); name(true); // parse root tag s(); externalID(true, true); s(); while(consume('[')) { s(); while(markupDecl()); s(); check(']'); s(); } check('>'); } /** * Scans an external ID. * @param f full flag * @param r root flag * @return id * @throws IOException I/O exception */ private byte[] externalID(final boolean f, final boolean r) throws IOException { byte[] cont = null; final boolean pub = consume(PUBLIC); if(pub || consume(SYSTEM)) { checkS(); if(pub) { pubidLit(); if(f) checkS(); } final int qu = consume(); // [11] if(qu == '\'' || qu == '"') { int ch; final TokenBuilder tok = new TokenBuilder(); while((ch = nextChar()) != qu) tok.add(ch); if(!f) return null; final String name = string(tok.finish()); if(!dtd && r) return cont; final XMLInput tin = input; try { final IO file = input.io().merge(name); cont = file.read(); } catch(final IOException ex) { Util.debug(ex); // skip unknown DTDs/entities cont = new byte[] { '?' }; } input = new XMLInput(new IOContent(cont, name)); if(consume(XDECL)) { check(XML); s(); if(version()) checkS(); s(); if(encoding() == null) error(TEXTENC); ch = nextChar(); if(s(ch)) ch = nextChar(); if(ch != '?') error(WRONGCHAR, '?', ch); ch = nextChar(); if(ch != '>') error(WRONGCHAR, '>', ch); cont = Arrays.copyOfRange(cont, input.pos(), cont.length); } s(); if(r) { extSubsetDecl(); if(!consume((char) 0)) error(INVEND); } input = tin; } else { if(f) error(SCANQUOTE, (char) qu); prev(1); } } return cont; } /** * Scans an public ID literal. [12] * @throws IOException I/O exception */ private void pubidLit() throws IOException { final int qu = qu(); int ch; while((ch = nextChar()) != qu) { if(!isChar(ch) && !contains(PUBIDTOK, ch)) error(PUBID, (char) ch); } } /** * Scans an external subset declaration. [31] * @throws IOException I/O exception */ private void extSubsetDecl() throws IOException { while(true) { s(); if(markupDecl()) continue; if(!consume(COND)) return; s(); // [61] final boolean incl = consume(INCL); if(!incl) check(IGNO); s(); check('['); if(incl) { extSubsetDecl(); check(CONE); } else { int c = 1; while(c != 0) { if(consume(COND)) ++c; else if(consume(CONE)) --c; else if(consume() == 0) error(INVEND); } } } } /** * Scans a markup declaration. [29] * @return true if a declaration was found * @throws IOException I/O exception */ private boolean markupDecl() throws IOException { if(consume(ENT)) { // [70] checkS(); if(consume('%')) { // [72] PEDecl checkS(); final byte[] key = name(true); checkS(); byte[] val = entityValue(true); //[74] if(val == null) { val = externalID(true, false); if(val == null) error(INVEND); } s(); pents.put(key, val); } else { // [71] GEDecl final byte[] key = name(true); checkS(); byte[] val = entityValue(false); // [73] EntityDef if(val == null) { val = externalID(true, false); if(val == null) error(INVEND); if(s()) { check(ND); checkS(); name(true); } } s(); ents.put(key, val); } check('>'); pe = true; } else if(consume(ELEM)) { // [45] checkS(); name(true); checkS(); pe = true; if(!consume(EMP) && !consume(ANY)) { // [46] if(consume('(')) { s(); if(consume(PC)) { // [51] s(); boolean alt = false; while(consume('|')) { s(); name(true); s(); alt = true; } check(')'); if(!consume('*') && alt) error(INVEND); } else { cp(); s(); //check(')'); // to be fixed... while(!consume(')')) consume(); //input.prev(1); occ(); } } else { error(INVEND); } } s(); check('>'); } else if(consume(ATTL)) { // [52] pe = true; checkS(); name(true); s(); while(name(false) != null) { // [53] checkS(); if(!consume(CD) && !consume(IDRS) && !consume(IDR) && !consume(ID) && !consume(ENTS) && !consume(ENT1) && !consume(NMTS) && !consume(NMT)) { // [56] if(consume(NOT)) { // [57,58] checkS(); check('('); s(); name(true); s(); while(consume('|')) { s(); name(true); s(); } check(')'); } else { // [59] check('('); s(); nmtoken(); s(); while(consume('|')) { s(); nmtoken(); s(); } check(')'); } } // [54] pe = true; checkS(); if(!consume(REQ) && !consume(IMP)) { // [60] if(consume(FIX)) checkS(); quote = qu(); attValue(consume()); } s(); } check('>'); } else if(consume(NOTA)) { // [82] checkS(); name(true); s(); externalID(false, false); s(); check('>'); } else if(consume(COMS)) { comment(); } else if(consume(XML)) { pi(); } else { return false; } s(); pe = false; return true; } /** * Scans a mixed value and children. [47-50] * @throws IOException I/O exception */ private void cp() throws IOException { s(); final byte[] name = name(false); if(name == null) { check('('); s(); cp(); } else { occ(); } s(); if(consume('|') || consume(',')) { cp(); s(); } if(name == null) { check(')'); occ(); } } /** * Scans occurrences. * @throws IOException I/O exception */ private void occ() throws IOException { if(!consume('+') && !consume('?')) consume('*'); } /** * Scans an entity value. [9] * @param p pe reference flag * @return value * @throws IOException I/O exception */ private byte[] entityValue(final boolean p) throws IOException { final int qu = consume(); if(qu != '\'' && qu != '"') { prev(1); return null; } TokenBuilder tok = new TokenBuilder(); int ch; while((ch = nextChar()) != qu) { if(ch == '&') tok.add(ref(false)); else if(ch == '%') { if(!p) error(INVPE); tok.add(peRef()); } else { tok.add(ch); } } final XMLInput tmp = input; input = new XMLInput(new IOContent(tok.finish())); tok = new TokenBuilder(); while((ch = consume()) != 0) { if(ch == '&') tok.add(ref(false)); else tok.add(ch); } input = tmp; return tok.finish(); } /** * Scans a document version. * @return true if version was found * @throws IOException I/O exception */ private boolean version() throws IOException { if(!consume(VERS)) return false; s(); check('='); s(); final int d = qu(); if(!consume(VERS10) && !consume(VERS11)) error(DECLVERSION); check((char) d); return true; } /** * Scans a document encoding. * @return encoding * @throws IOException I/O exception */ private String encoding() throws IOException { if(!consume(ENCOD)) { if(fragment) error(TEXTENC); return null; } s(); check('='); s(); final TokenBuilder enc = new TokenBuilder(); final int d = qu(); int ch = nextChar(); if(letter(ch) && ch != '_') { while(letterOrDigit(ch) || ch == '.' || ch == '-') { enc.add(ch); ch = nextChar(); } prev(1); } check((char) d); if(enc.isEmpty()) error(DECLENCODE, enc); final String e = string(enc.finish()); input.encoding(e); return e; } /** * Scans a standalone flag. * @return flag * @throws IOException I/O exception */ private byte[] sddecl() throws IOException { if(!consume(STANDALONE)) return null; s(); check('='); s(); final int d = qu(); byte[] sd = token(NO); if(!consume(sd)) { sd = token(YES); if(!consume(sd) || fragment) error(DECLSTANDALONE); } check((char) d); return sd; } /** * Throws an error. * @param e error message * @param a error arguments * @return build exception (indicates that an error is raised) * @throws BuildException build exception */ private BuildException error(final String e, final Object... a) throws BuildException { throw new BuildException(det() + COLS + e, a); } @Override public String det() { final String path = input.io().path(); return path.isEmpty() ? Util.info(LINE_X, input.line()) : Util.info(SCANPOS_X_X, input.io().path(), input.line()); } @Override public double prog() { final double l = input.length(); return l <= 0 ? 0 : input.pos() / l; } /** Index for all HTML entities. */ private static final TokenMap HTMLENTS = new TokenMap(); /** HTML entities. */ private static final String[] HTMLENTITIES = { "Aacute", "\u00c1", "aacute", "\u00e1", "Acirc", "\u00c2", "acirc", "\u00e2", "acute", "\u00b4", "AElig", "\u00c6", "aelig", "\u00e6", "Agrave", "\u00c0", "agrave", "\u00e0", "alefsym", "\u2135", "Alpha", "\u0391", "alpha", "\u03b1", "and", "\u2227", "ang", "\u2220", "Aring", "\u00c5", "aring", "\u00e5", "asymp", "\u2248", "Atilde", "\u00c3", "atilde", "\u00e3", "Auml", "\u00c4", "auml", "\u00e4", "bdquo", "\u201e", "Beta", "\u0392", "beta", "\u03b2", "brvbar", "\u00a6", "bull", "\u2022", "cap", "\u2229", "Ccedil", "\u00c7", "ccedil", "\u00e7", "cedil", "\u00b8", "cent", "\u00a2", "Chi", "\u03a7", "chi", "\u03c7", "circ", "\u02c6", "clubs", "\u2663", "cong", "\u2245", "copy", "\u00a9", "crarr", "\u21b5", "cup", "\u222a", "curren", "\u00a4", "dagger", "\u2020", "Dagger", "\u2021", "darr", "\u2193", "dArr", "\u21d3", "deg", "\u00b0", "Delta", "\u0394", "delta", "\u03b4", "diams", "\u2666", "divide", "\u00f7", "Eacute", "\u00c9", "eacute", "\u00e9", "Ecirc", "\u00ca", "ecirc", "\u00ea", "Egrave", "\u00c8", "egrave", "\u00e8", "empty", "\u2205", "emsp", "\u2003", "ensp", "\u2002", "Epsilon", "\u0395", "epsilon", "\u03b5", "equiv", "\u2261", "Eta", "\u0397", "eta", "\u03b7", "ETH", "\u00d0", "eth", "\u00f0", "Euml", "\u00cb", "euml", "\u00eb", "euro", "\u20ac", "exist", "\u2203", "fnof", "\u0192", "forall", "\u2200", "frac12", "\u00bd", "frac14", "\u00bc", "frac34", "\u00be", "frasl", "\u2044", "Gamma", "\u0393", "gamma", "\u03b3", "ge", "\u2265", "harr", "\u2194", "hArr", "\u21d4", "hearts", "\u2665", "hellip", "\u2026", "Iacute", "\u00cd", "iacute", "\u00ed", "Icirc", "\u00ce", "icirc", "\u00ee", "iexcl", "\u00a1", "Igrave", "\u00cc", "igrave", "\u00ec", "image", "\u2111", "infin", "\u221e", "int", "\u222b", "Iota", "\u0399", "iota", "\u03b9", "iquest", "\u00bf", "isin", "\u2208", "Iuml", "\u00cf", "iuml", "\u00ef", "Kappa", "\u039a", "kappa", "\u03ba", "Lambda", "\u039b", "lambda", "\u03bb", "lang", "\u2329", "laquo", "\u00ab", "larr", "\u2190", "lArr", "\u21d0", "lceil", "\u2308", "ldquo", "\u201c", "le", "\u2264", "lfloor", "\u230a", "lowast", "\u2217", "loz", "\u25ca", "lrm", "\u200e", "lsaquo", "\u2039", "lsquo", "\u2018", "macr", "\u00af", "mdash", "\u2014", "micro", "\u00b5", "middot", "\u00b7", "minus", "\u2212", "Mu", "\u039c", "mu", "\u03bc", "nabla", "\u2207", "nbsp", "\u00a0", "ndash", "\u2013", "ne", "\u2260", "ni", "\u220b", "not", "\u00ac", "notin", "\u2209", "nsub", "\u2284", "Ntilde", "\u00d1", "ntilde", "\u00f1", "Nu", "\u039d", "nu", "\u03bd", "Oacute", "\u00d3", "oacute", "\u00f3", "Ocirc", "\u00d4", "ocirc", "\u00f4", "OElig", "\u0152", "oelig", "\u0153", "Ograve", "\u00d2", "ograve", "\u00f2", "oline", "\u203e", "Omega", "\u03a9", "omega", "\u03c9", "Omicron", "\u039f", "omicron", "\u03bf", "oplus", "\u2295", "or", "\u2228", "ordf", "\u00aa", "ordm", "\u00ba", "Oslash", "\u00d8", "oslash", "\u00f8", "Otilde", "\u00d5", "otilde", "\u00f5", "otimes", "\u2297", "Ouml", "\u00d6", "ouml", "\u00f6", "para", "\u00b6", "part", "\u2202", "permil", "\u2030", "perp", "\u22a5", "Phi", "\u03a6", "phi", "\u03c6", "Pi", "\u03a0", "pi", "\u03c0", "piv", "\u03d6", "plusmn", "\u00b1", "pound", "\u00a3", "prime", "\u2032", "Prime", "\u2033", "prod", "\u220f", "prop", "\u221d", "Psi", "\u03a8", "psi", "\u03c8", "radic", "\u221a", "rang", "\u232a", "raquo", "\u00bb", "rarr", "\u2192", "rArr", "\u21d2", "rceil", "\u2309", "rdquo", "\u201d", "real", "\u211c", "reg", "\u00ae", "rfloor", "\u230b", "Rho", "\u03a1", "rho", "\u03c1", "rlm", "\u200f", "rsaquo", "\u203a", "rsquo", "\u2019", "sbquo", "\u201a", "Scaron", "\u0160", "scaron", "\u0161", "sdot", "\u22c5", "sect", "\u00a7", "shy", "\u00ad", "Sigma", "\u03a3", "sigma", "\u03c3", "sigmaf", "\u03c2", "sim", "\u223c", "spades", "\u2660", "sub", "\u2282", "sube", "\u2286", "sum", "\u2211", "sup", "\u2283", "sup1", "\u00b9", "sup2", "\u00b2", "sup3", "\u00b3", "supe", "\u2287", "szlig", "\u00df", "Tau", "\u03a4", "tau", "\u03c4", "there4", "\u2234", "Theta", "\u0398", "theta", "\u03b8", "thetasym", "\u03d1", "thinsp", "\u2009", "THORN", "\u00de", "thorn", "\u00fe", "tilde", "\u02dc", "times", "\u00d7", "trade", "\u2122", "Uacute", "\u00da", "uacute", "\u00fa", "uarr", "\u2191", "uArr", "\u21d1", "Ucirc", "\u00db", "ucirc", "\u00fb", "Ugrave", "\u00d9", "ugrave", "\u00f9", "uml", "\u00a8", "upsih", "\u03d2", "Upsilon", "\u03a5", "upsilon", "\u03c5", "Uuml", "\u00dc", "uuml", "\u00fc", "weierp", "\u2118", "Xi", "\u039e", "xi", "\u03be", "Yacute", "\u00dd", "yacute", "\u00fd", "yen", "\u00a5", "yuml", "\u00ff", "Yuml", "\u0178", "Zeta", "\u0396", "zeta", "\u03b6", "zwj", "\u200d", "zwnj", "\u200c" }; } basex-7.7.2/basex-core/src/main/java/org/basex/build/xml/package.html000066400000000000000000000001051222453003200253530ustar00rootroot00000000000000 Classes for creating databases from XML documents. basex-7.7.2/basex-core/src/main/java/org/basex/core/000077500000000000000000000000001222453003200221275ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/core/AProp.java000066400000000000000000000373171222453003200240260ustar00rootroot00000000000000package org.basex.core; import static org.basex.core.Prop.*; import static org.basex.util.Token.*; import java.io.*; import java.lang.reflect.*; import java.util.*; import java.util.Map.Entry; import org.basex.io.*; import org.basex.util.*; import org.basex.util.list.*; /** * This class assembles properties which are used all around the project. They * are initially read from and finally written to disk. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class AProp implements Iterable { /** Cached user properties. */ private final StringBuilder user = new StringBuilder(); /** Properties. */ protected final TreeMap props = new TreeMap(); /** Property file. */ private IOFile file; /** * Constructor. */ public AProp() { this(null); } /** * Constructor, reading options from a configuration file. * @param suffix if {@code null}, file parsing will be skipped */ public AProp(final String suffix) { try { for(final Object[] arr : props(getClass())) { if(arr.length > 1) props.put(arr[0].toString(), arr[1]); } } catch(final Exception ex) { ex.printStackTrace(); Util.notexpected(ex); } if(suffix != null) read(suffix); // sets options stored in system properties setSystem(); } /** * Writes the properties to disk. */ public final synchronized void write() { BufferedWriter bw = null; try { bw = new BufferedWriter(new FileWriter(file.file())); bw.write(PROPHEADER); for(final Object[] arr : props(getClass())) { final String key = arr[0].toString(); if(arr.length == 1) { bw.write(NL + "# " + key + NL); continue; } final Object val = props.get(key); if(val instanceof String[]) { final String[] str = (String[]) val; bw.write(key + " = " + str.length + NL); final int is = str.length; for(int i = 0; i < is; ++i) { if(str[i] != null) bw.write(key + (i + 1) + " = " + str[i] + NL); } } else if(val instanceof int[]) { final int[] num = (int[]) val; final int ns = num.length; for(int i = 0; i < ns; ++i) { bw.write(key + i + " = " + num[i] + NL); } } else { bw.write(key + " = " + val + NL); } } bw.write(NL + PROPUSER + NL); bw.write(user.toString()); } catch(final Exception ex) { Util.errln("% could not be written.", file); Util.debug(ex); } finally { if(bw != null) try { bw.close(); } catch(final IOException ignored) { } } } /** * Returns the requested object, or {@code null}. * @param key key to be found * @return value */ public final synchronized Object get(final String key) { return props.get(key); } /** * Returns the requested string. * @param key key to be found * @return value */ public final synchronized String get(final Object[] key) { return get(key, String.class).toString(); } /** * Returns the requested integer. * @param key key to be found * @return value */ public final synchronized int num(final Object[] key) { return (Integer) get(key, Integer.class); } /** * Returns the requested boolean. * @param key key to be found * @return value */ public final synchronized boolean is(final Object[] key) { return (Boolean) get(key, Boolean.class); } /** * Returns the requested string array. * @param key key to be found * @return value */ public final synchronized String[] strings(final Object[] key) { return (String[]) get(key, String[].class); } /** * Returns the requested integer array. * @param key key to be found * @return value */ public final synchronized int[] nums(final Object[] key) { return (int[]) get(key, int[].class); } /** * Assigns the specified value for the specified key. * @param key key to be found * @param val value to be written */ public final synchronized void set(final Object[] key, final String val) { setObject(key[0].toString(), val); } /** * Assigns the specified integer for the specified key. * @param key key to be found * @param val value to be written */ public final synchronized void set(final Object[] key, final int val) { setObject(key[0].toString(), val); } /** * Assigns the specified boolean for the specified key. * @param key key to be found * @param val value to be written */ public final synchronized void set(final Object[] key, final boolean val) { setObject(key[0].toString(), val); } /** * Assigns the specified string array for the specified key. * @param key key to be found * @param val value to be written */ public final synchronized void set(final Object[] key, final String[] val) { setObject(key[0].toString(), val); } /** * Assigns the specified integer array for the specified key. * @param key key to be found * @param val value to be written */ public final synchronized void set(final Object[] key, final int[] val) { setObject(key[0].toString(), val); } /** * Assigns the specified object for the specified key. * @param key key to be found * @param val value to be written */ public final synchronized void setObject(final String key, final Object val) { props.put(key, val); } /** * Sets the specified value after casting it to the correct type. * @param key key * @param val value * @return final value, or {@code null} if the key has not been found */ public final synchronized String set(final String key, final String val) { final Object type = get(key); if(type == null) return null; String v = val; if(type instanceof Boolean) { final boolean b = val == null || val.isEmpty() ? !((Boolean) type) : Util.yes(val); setObject(key, b); v = Util.flag(b); } else if(type instanceof Integer) { setObject(key, Integer.parseInt(val)); v = String.valueOf(get(key)); } else if(type instanceof String) { setObject(key, val); } else { Util.notexpected("Unknown property type: " + type.getClass().getSimpleName()); } return v; } /** * Returns an error string for an unknown key. * @param key key * @return error string */ public final synchronized String unknown(final String key) { final String sim = similar(key); return Util.info(sim != null ? Text.UNKNOWN_OPT_SIMILAR_X_X : Text.UNKNOWN_OPTION_X, key, sim); } /** * Inverts a boolean property. * @param key key * @return new value */ public final synchronized boolean invert(final Object[] key) { final boolean val = !is(key); set(key, val); return val; } /** * Checks if the specified property has changed. * @param key key * @param val new value * @return result of check */ public final synchronized boolean sameAs(final Object[] key, final Object val) { return props.get(key[0].toString()).equals(val); } /** * Returns a key similar to the specified string, or {@code null}. * @param key key to be found * @return similar key */ public final synchronized String similar(final String key) { final byte[] name = token(key); final Levenshtein ls = new Levenshtein(); for(final String prop : props.keySet()) { if(ls.similar(name, token(prop))) return prop; } return null; } /** * Scans the system properties and initializes the project properties. * All properties starting with {@code org.basex.} will be assigned as properties * and removed from the global system properties. */ public final void setSystem() { // collect parameters that start with "org.basex." final StringList sl = new StringList(); final Properties pr = System.getProperties(); for(final Object key : pr.keySet()) { final String k = key.toString(); if(k.startsWith(Prop.DBPREFIX)) sl.add(k); } // assign properties for(final String key : sl) { final String k = key.substring(Prop.DBPREFIX.length()).toUpperCase(Locale.ENGLISH); set(k, System.getProperty(key)); } } @Override public final synchronized Iterator iterator() { return props.keySet().iterator(); } @Override public final synchronized String toString() { final TokenBuilder tb = new TokenBuilder(); for(final Entry e : props.entrySet()) { if(!tb.isEmpty()) tb.add(','); tb.add(e.getKey()).add('=').addExt(e.getValue()); } return tb.toString(); } // STATIC METHODS ===================================================================== /** * Returns a system property. * @param key {@link Prop} key * @return value, or empty string */ public static String getSystem(final Object[] key) { return key.length > 0 ? getSystem(key[0].toString()) : ""; } /** * Returns a system property. If necessary, the key will * be converted to lower-case and prefixed with {@link Prop#DBPREFIX}. * @param key {@link Prop} key * @return value, or empty string */ public static String getSystem(final String key) { final String k = (key.startsWith(DBPREFIX) ? key : DBPREFIX + key). toLowerCase(Locale.ENGLISH); final String v = System.getProperty(k); return v == null ? "" : v; } /** * Sets a system property if it has not been set before. * @param key {@link Prop} key * @param val value */ public static void setSystem(final Object[] key, final Object val) { if(key.length > 0) setSystem(key[0].toString(), val); } /** * Sets a system property if it has not been set before. If necessary, the key will * be converted to lower-case and prefixed with {@link Prop#DBPREFIX}. * @param key key * @param val value */ public static void setSystem(final String key, final Object val) { final String k = key.indexOf('.') != -1 ? key : DBPREFIX + key.toLowerCase(Locale.ENGLISH); if(System.getProperty(k) == null) System.setProperty(k, val.toString()); } /** * Returns all property objects from the specified property class. * @param clz property class * @return property objects * @throws IllegalAccessException exception */ public static final Object[][] props(final Class clz) throws IllegalAccessException { final ArrayList props = new ArrayList(); for(final Field f : clz.getFields()) { if(!Modifier.isStatic(f.getModifiers())) continue; final Object obj = f.get(null); if(obj instanceof Object[]) props.add((Object[]) obj); } return props.toArray(new Object[props.size()][]); }; // PROTECTED METHODS ================================================================== /** * Parses a property string and sets the properties accordingly. * @param s property string * @throws IOException io exception */ protected final synchronized void parse(final String s) throws IOException { for(final String ser : s.trim().split(",")) { if(ser.isEmpty()) continue; final String[] sprop = ser.split("=", 2); final String key = sprop[0].trim(); final String val = sprop.length < 2 ? "" : sprop[1]; try { if(set(key, val) != null) continue; } catch(final Exception ex) { throw new BaseXException(Text.INVALID_VALUE_X_X, key, val); } throw new BaseXException(unknown(key)); } } // PRIVATE METHODS ==================================================================== /** * Reads the configuration file and initializes the project properties. * The file is located in the project home directory. * @param prop property file extension */ private synchronized void read(final String prop) { file = new IOFile(HOME + IO.BASEXSUFFIX + prop); final StringList read = new StringList(); final TokenBuilder err = new TokenBuilder(); boolean local = false; if(!file.exists()) { err.addExt("Saving properties in \"%\"..." + NL, file); } else { BufferedReader br = null; try { br = new BufferedReader(new FileReader(file.file())); for(String line; (line = br.readLine()) != null;) { line = line.trim(); // start of local options if(line.equals(PROPUSER)) { local = true; continue; } if(local) user.append(line).append(NL); if(line.isEmpty() || line.charAt(0) == '#') continue; final int d = line.indexOf('='); if(d < 0) { err.addExt("%: \"%\" ignored. " + NL, file, line); continue; } final String val = line.substring(d + 1).trim(); String key = line.substring(0, d).trim(); // extract numeric value in key int num = 0; final int ss = key.length(); for(int s = 0; s < ss; ++s) { if(Character.isDigit(key.charAt(s))) { num = Integer.parseInt(key.substring(s)); key = key.substring(0, s); break; } } // cache local options as system properties if(local) { setSystem(key, val); continue; } final Object entry = props.get(key); if(entry == null) { err.addExt("%: \"%\" not found. " + NL, file, key); } else if(entry instanceof String) { props.put(key, val); } else if(entry instanceof Integer) { props.put(key, Integer.parseInt(val)); } else if(entry instanceof Boolean) { props.put(key, Boolean.parseBoolean(val)); } else if(entry instanceof String[]) { if(num == 0) { props.put(key, new String[Integer.parseInt(val)]); } else { ((String[]) entry)[num - 1] = val; } } else if(entry instanceof int[]) { ((int[]) entry)[num] = Integer.parseInt(val); } // add key for final check read.add(key); } } catch(final Exception ex) { err.addExt("% could not be parsed." + NL, file); Util.debug(ex); } finally { if(br != null) try { br.close(); } catch(final IOException ignored) { } } } // check if all mandatory files have been read try { if(err.isEmpty()) { boolean ok = true; for(final Object[] arr : props(getClass())) { if(arr.length > 1) ok &= read.contains(arr[0].toString()); } if(!ok) err.addExt("Saving properties in \"%\"..." + NL, file); } } catch(final IllegalAccessException ex) { Util.notexpected(ex); } if(!err.isEmpty()) { Util.err(err.toString()); write(); } } /** * Retrieves the specified value. Throws an error if value cannot be read. * @param key key * @param c expected type * @return result */ private Object get(final Object[] key, final Class c) { final Object entry = props.get(key[0].toString()); if(entry == null) Util.notexpected("Property " + key[0] + " not defined."); final Class cc = entry.getClass(); if(c != cc) Util.notexpected("Property '" + key[0] + "' is a " + Util.name(cc)); return entry; } } basex-7.7.2/basex-core/src/main/java/org/basex/core/BaseXException.java000066400000000000000000000030161222453003200256530ustar00rootroot00000000000000package org.basex.core; import java.io.*; import org.basex.util.*; /** * Database exception, extending the {@link IOException}. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BaseXException extends IOException { /** * Constructs an exception with the specified message and extension. * @param message message with optional placeholders * @param ext optional message extension */ public BaseXException(final String message, final Object... ext) { super(Util.info(message, ext)); for(final Object o : ext) { if(o instanceof Throwable) { initCause((Throwable) o); break; } } } /** * Constructs an exception from the specified exception instance. * @param ex exception */ public BaseXException(final Exception ex) { super(Util.message(ex)); initCause(ex); } /** * Creates the error message from the specified text and extension array. * @param text text message with optional placeholders * @param ext info extensions * @return argument */ public static String message(final String text, final Object[] ext) { final int es = ext.length; for(int e = 0; e < es; ++e) { if(ext[e] instanceof byte[]) { ext[e] = Token.string((byte[]) ext[e]); } else if(ext[e] instanceof Throwable) { ext[e] = Util.message((Throwable) ext[e]); } else if(!(ext[e] instanceof String)) { ext[e] = String.valueOf(ext[e]); } } return Util.info(text, ext); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/Command.java000066400000000000000000000235771222453003200243660ustar00rootroot00000000000000package org.basex.core; import static org.basex.core.Text.*; import java.io.*; import java.util.*; import org.basex.core.cmd.*; import org.basex.core.parse.*; import org.basex.data.*; import org.basex.io.out.*; import org.basex.util.*; import org.basex.util.list.*; import org.xml.sax.*; /** * This class provides the architecture for all internal command * implementations. It evaluates queries that are sent by the GUI, the client or * the standalone version. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class Command extends Proc { /** Command arguments. */ public final String[] args; /** Performance measurements. */ protected Performance perf; /** Database context. */ protected Context context; /** Output stream. */ protected PrintOutput out; /** Optional input source. */ protected InputSource in; /** Database properties. */ protected Prop prop; /** Main properties. */ protected MainProp mprop; /** Container for query information. */ private final TokenBuilder info = new TokenBuilder(); /** Permission required to execute this command. */ private final Perm perm; /** Indicates if the command requires an opened database. */ private final boolean data; /** * Constructor for commands requiring no opened database. * @param p required permission * @param arg arguments */ protected Command(final Perm p, final String... arg) { this(p, false, arg); } /** * Constructor. * @param p required permission * @param d requires opened database * @param arg arguments */ protected Command(final Perm p, final boolean d, final String... arg) { perm = p; data = d; args = arg; } /** * Executes the command and prints the result to the specified output * stream. If an exception occurs, a {@link BaseXException} is thrown. * @param ctx database context * @param os output stream reference * @throws BaseXException command exception */ public final void execute(final Context ctx, final OutputStream os) throws BaseXException { if(!exec(ctx, os)) throw new BaseXException(info()); } /** * Executes the command and returns the result as string. * If an exception occurs, a {@link BaseXException} is thrown. * @param ctx database context * @return string result * @throws BaseXException command exception */ public final String execute(final Context ctx) throws BaseXException { final ArrayOutput ao = new ArrayOutput(); execute(ctx, ao); return ao.toString(); } /** * Attaches an input stream. * @param is input stream */ public void setInput(final InputStream is) { in = new InputSource(is); } /** * Attaches an input source. * @param is input source */ public void setInput(final InputSource is) { in = is; } /** * Runs the command without permission, data and concurrency checks. * Should be called with care, and only by other database commands. * @param ctx database context * @return result of check */ public final boolean run(final Context ctx) { return run(ctx, new NullOutput()); } /** * Returns command information. * @return info string */ public final String info() { return info.toString(); } /** * Returns the result set, generated by a query command. Will only yield results if * {@link Prop#CACHEQUERY} is set, and can only be called once. * @return result set */ public Result result() { return null; } /** * Checks if the command performs updates/write operations. * @param ctx database context * @return result of check */ @SuppressWarnings("unused") public boolean updating(final Context ctx) { return createWrite(); } /** * Checks if the command has updated any data. * @param ctx database context * @return result of check */ public boolean updated(final Context ctx) { return updating(ctx); } /** * Closes an open data reference and returns {@code true} if this command will change * the {@link Context#data} reference. This method is required by the progress dialog * in the frontend. * @param ctx database context * @return result of check */ @SuppressWarnings("unused") public boolean newData(final Context ctx) { return false; } /** * Returns true if this command returns a progress value. * This method is required by the progress dialog in the frontend. * @return result of check */ public boolean supportsProg() { return false; } /** * Returns true if this command can be stopped. * This method is required by the progress dialog in the frontend. * @return result of check */ public boolean stoppable() { return false; } @Override public final String toString() { final CmdBuilder cb = new CmdBuilder(this); build(cb); return cb.toString(); } // PROTECTED METHODS ======================================================== /** * Executes the command and serializes the result (internal call). * @return success of operation * @throws IOException I/O exception */ protected abstract boolean run() throws IOException; /** * Builds a string representation from the command. This string must be * correctly built, as commands are sent to the server as strings. * @param cb command builder */ protected void build(final CmdBuilder cb) { cb.init().args(); } /** * Adds the error message to the message buffer {@link #info}. * @param msg error message * @param ext error extension * @return {@code false} */ protected final boolean error(final String msg, final Object... ext) { info.reset(); info.addExt(msg == null ? "" : msg, ext); return false; } /** * Adds information on command execution. * @param str information to be added * @param ext extended info * @return {@code true} */ protected final boolean info(final String str, final Object... ext) { if(!str.isEmpty()) info.addExt(str, ext).add(NL); return true; } /** * Returns the specified command option. * @param typ options enumeration * @param token type * @return option */ protected final > E getOption(final Class typ) { final E e = getOption(args[0], typ); if(e == null) error(UNKNOWN_TRY_X, args[0]); return e; } /** * Adds the names of the database that has been addressed by the argument index. * No databases will be added if the argument uses glob syntax. * @param db databases * @param a argument index * @return {@code false} if database cannot be determined due to glob syntax */ protected final boolean databases(final StringList db, final int a) { // return true if the addressed database argument does not exists if(args.length <= a || args[a] == null) return true; final boolean noglob = !args[a].matches(".*[\\?\\*,].*"); if(noglob) db.add(args[a]); return noglob; } /** * Returns the specified command option. * @param s string to be found * @param typ options enumeration * @param token type * @return option */ protected static > E getOption(final String s, final Class typ) { try { return Enum.valueOf(typ, s.toUpperCase(Locale.ENGLISH)); } catch(final Exception ex) { return null; } } /** * Closes the specified database if it is currently opened and only pinned once. * @param ctx database context * @param db database to be closed * @return closed flag */ protected static boolean close(final Context ctx, final String db) { final boolean close = ctx.data() != null && db.equals(ctx.data().meta.name) && ctx.dbs.pins(db) == 1; return close && new Close().run(ctx); } // PRIVATE METHODS ========================================================== /** * Checks if the command demands write or create permissions. * @return result of check */ private boolean createWrite() { return perm == Perm.CREATE || perm == Perm.WRITE; } /** * Executes the command, prints the result to the specified output stream * and returns a success flag. * @param ctx database context * @param os output stream * @return success flag. The {@link #info()} method returns information * on a potential exception */ private boolean exec(final Context ctx, final OutputStream os) { // check if data reference is available final Data dt = ctx.data(); if(dt == null && data) return error(NO_DB_OPENED); // check permissions if(!ctx.perm(perm, dt != null ? dt.meta : null)) return error(PERM_REQUIRED_X, perm); // set updating flag updating = updating(ctx); try { // register process ctx.register(this); // run command and return success flag return run(ctx, os); } catch(final RuntimeException th) { Util.stack(th); throw th; } finally { // guarantee that process will be unregistered ctx.unregister(this); } } /** * Runs the command without permission, data and concurrency checks. * @param ctx database context * @param os output stream * @return result of check */ public boolean run(final Context ctx, final OutputStream os) { perf = new Performance(); context = ctx; prop = ctx.prop; mprop = ctx.mprop; out = PrintOutput.get(os); try { return run(); } catch(final ProcException ex) { // process was interrupted by the user or server abort(); return error(INTERRUPTED); } catch(final Throwable ex) { // unexpected error Performance.gc(2); abort(); if(ex instanceof OutOfMemoryError) { Util.debug(ex); return error(OUT_OF_MEM + (createWrite() ? H_OUT_OF_MEM : "")); } return error(Util.bug(ex) + NL + info.toString()); } finally { // flushes the output try { if(out != null) out.flush(); } catch(final IOException ignored) { } } } } basex-7.7.2/basex-core/src/main/java/org/basex/core/Context.java000066400000000000000000000170041222453003200244200ustar00rootroot00000000000000package org.basex.core; import static org.basex.core.Text.*; import org.basex.data.*; import org.basex.io.random.*; import org.basex.query.util.pkg.*; import org.basex.server.*; import org.basex.util.*; import org.basex.util.list.*; /** * This class serves as a central database context. * It references the currently opened database, properties, client sessions, * users and other meta data. Next, the instance of this class will be passed on to * all operations, as it organizes concurrent data access, ensuring that no * process will concurrently write to the same data instances. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Context { /** Client listener. Set to {@code null} in standalone/server mode. */ public final ClientListener listener; /** Blocked clients. */ public final ClientBlocker blocker; /** Client-related properties. */ public final Prop prop = new Prop(); /** Main properties. */ public final MainProp mprop; /** Client connections. */ public final Sessions sessions; /** Event pool. */ public final Events events; /** Opened databases. */ public final Datas dbs; /** Users. */ public final Users users; /** Package repository. */ public final Repo repo; /** Databases list. */ public final Databases databases; /** User reference. */ public User user; /** Log. */ public final Log log; // GUI references /** Marked nodes. */ public Nodes marked; /** Copied nodes. */ public Nodes copied; /** Focused node. */ public int focused = -1; /** Node context. Set if it does not contain all documents of the current database. */ private Nodes current; /** Process locking. */ private final Locking locks; /** Data reference. */ private Data data; /** * Default constructor, which is usually called once in the lifetime of a project. */ public Context() { this(true); } /** * Default constructor, which is usually called once in the lifetime of a project. * @param file retrieve properties from disk */ public Context(final boolean file) { this(new MainProp(file)); } /** * Constructor, called by clients, and adopting the variables of the main process. * The {@link #user} reference must be set after calling this method. * @param ctx context of the main process * @param cl client listener */ public Context(final Context ctx, final ClientListener cl) { listener = cl; mprop = ctx.mprop; dbs = ctx.dbs; events = ctx.events; sessions = ctx.sessions; databases = ctx.databases; blocker = ctx.blocker; locks = ctx.locks; users = ctx.users; repo = ctx.repo; log = ctx.log; } /** * Private constructor. * @param mp main properties */ private Context(final MainProp mp) { mprop = mp; dbs = new Datas(); events = new Events(); sessions = new Sessions(); blocker = new ClientBlocker(); databases = new Databases(this); locks = mp.is(MainProp.GLOBALLOCK) || Prop.gui ? new ProcLocking(this) : new DBLocking(mp); users = new Users(this); repo = new Repo(this); log = new Log(this); user = users.get(ADMIN); listener = null; } /** * Closes the database context. Should only be called from the main context instance. */ public synchronized void close() { while(!sessions.isEmpty()) sessions.get(0).quit(); dbs.close(); log.close(); } /** * Returns {@code true} if a data reference exists and if the current node set contains * all documents. * @return result of check */ public boolean root() { return data != null && current == null; } /** * Returns the current data reference. * @return data reference */ public Data data() { return data; } /** * Returns the current node context. * @return node set */ public Nodes current() { if(current != null || data == null) return current; final Nodes n = new Nodes(data.resources.docs().toArray(), data); n.root = true; return n; } /** * Sets the current node context. Discards the input if it contains all document * nodes of the currently opened database. * @param curr node set */ public void current(final Nodes curr) { current = curr.checkRoot(); } /** * Sets the specified data instance as current database. * @param d data reference */ public void openDB(final Data d) { data = d; copied = null; set(null, new Nodes(d)); } /** * Closes the current database context. */ public void closeDB() { data = null; copied = null; set(null, null); } /** * Sets the current context and marked node set and resets the focus. * @param curr context set * @param mark marked nodes */ public void set(final Nodes curr, final Nodes mark) { current = curr; marked = mark; focused = -1; } /** * Invalidates the current node set. */ public void update() { current = null; } /** * Checks if the specified database is pinned. * @param db name of database * @return result of check */ public boolean pinned(final String db) { return dbs.pinned(db) || TableDiskAccess.locked(db, this); } /** * Checks if the current user has the specified permission. * @param p requested permission * @param md optional meta data reference * @return result of check */ public boolean perm(final Perm p, final MetaData md) { final User us = md == null || p == Perm.CREATE || p == Perm.ADMIN ? null : md.users.get(user.name); return (us == null ? user : us).has(p); } /** * Locks the specified process and starts a timeout thread. * @param pr process */ public void register(final Proc pr) { assert !pr.registered() : "Already registered:" + pr; pr.registered(true); // administrators will not be affected by the timeout if(!user.has(Perm.ADMIN)) pr.startTimeout(mprop.num(MainProp.TIMEOUT) * 1000L); // get touched databases final LockResult lr = new LockResult(); pr.databases(lr); final StringList read = prepareLock(lr.read, lr.readAll); final StringList write = prepareLock(lr.write, lr.writeAll); locks.acquire(pr, read, write); } /** * Downgrades locks. * @param pr process * @param write write locks to keep */ public void downgrade(final Proc pr, final StringList write) { // ignore downgrade call if process is not registered if(pr.registered()) locks.downgrade(prepareLock(write, false)); } /** * Unlocks the process and stops the timeout. * @param pr process */ public void unregister(final Proc pr) { assert pr.registered() : "Not registered:" + pr; pr.registered(false); locks.release(pr); pr.stopTimeout(); } /** * Prepares the string list for locking. * @param sl string list * @param all lock all databases * @return string list, or {@code null} */ private StringList prepareLock(final StringList sl, final boolean all) { if(all) return null; // replace empty string with currently opened database and return array for(int d = 0; d < sl.size(); d++) { if(Token.eq(sl.get(d), DBLocking.CTX, DBLocking.COLL)) { if(null == data) sl.deleteAt(d); else sl.set(d, data.meta.name); } } return sl; } } basex-7.7.2/basex-core/src/main/java/org/basex/core/DBLocking.java000066400000000000000000000310651222453003200245730ustar00rootroot00000000000000package org.basex.core; import static org.basex.core.Prop.*; import java.util.*; import java.util.concurrent.*; import java.util.concurrent.locks.*; import org.basex.util.list.*; /** * Manage read and write locks on arbitrary strings. Maximum of {@link MainProp#PARALLEL} * concurrent transactions are allowed, further will be queued. * * This class prevents locking deadlocks by sorting all all strings * * Locks can only be released and downgraded by the same thread which acquired it. * * Locking methods are not synchronized to each other. The user must make sure not to call * them in parallel by the same thread (it is fine to call arbitrary locking methods by * different threads at the same time). * * This locking can be deactivated by setting {@link MainProp#GLOBALLOCK} to {@code true}. * * @author BaseX Team 2005-12, BSD License * @author Jens Erat */ public final class DBLocking implements Locking { /** Fair scheduling; prevents starvation, but reduces parallelism. */ private static final boolean FAIR = true; /** Prefix for internal special locks. */ private static final String PREFIX = "%"; /** Special lock identifier for current document, will be substituted. */ public static final String COLL = PREFIX + "DOC"; /** Special lock identifier for current context, will be substituted. */ public static final String CTX = PREFIX + "CTX"; /** Special lock identifier for administrative commands. */ public static final String ADMIN = PREFIX + "ADMIN"; /** Special lock identifier for backup commands. */ public static final String BACKUP = PREFIX + "BACKUP"; /** Special lock identifier for event commands. */ public static final String EVENT = PREFIX + "EVENT"; /** Special lock identifier for repository commands. */ public static final String REPO = PREFIX + "REPO"; /** Prefix for user defined locks. */ public static final String USER_PREFIX = "+"; /** Lock for running thread counters. */ private final Object globalLock = new Object(); /** Number of running local writers. Guarded by {@code globalLock}. */ private int localWriters; /** Number of running local writers. Guarded by {@code globalLock}. */ private int globalReaders; /** * Lock for global write locking. * * Exclusive lock - if globally writing * Shared lock - else */ private final ReentrantReadWriteLock writeAll = new ReentrantReadWriteLock(); /** Stores one lock for each object used for locking. */ private final Map locks = new HashMap(); /** Stores lock usage counters for each object used for locking. */ private final Map lockUsage = new HashMap(); /** * Currently running transactions. * Used as monitor for atomizing access to {@link #queue}. */ private int transactions; /** * Queue for transactions waiting. * * Used as monitor for waiting threads in queue. */ private final Queue queue = new LinkedList(); /** * Stores a list of objects each transaction has write-locked. * Null means lock everything, an empty array lock nothing. */ private final ConcurrentMap writeLocked = new ConcurrentHashMap(); /** * Stores a list of objects each transaction has read-locked. Null means lock * everything, an empty array lock nothing. */ private final ConcurrentMap readLocked = new ConcurrentHashMap(); /** BaseX database context. */ private final MainProp mprop; /** * Initialize new Locking instance. * @param mp Main properties, used to read parallel transactions limit. */ public DBLocking(final MainProp mp) { mprop = mp; } @Override public void acquire(final Proc pr, final StringList read, final StringList write) { final Long thread = Thread.currentThread().getId(); if(writeLocked.containsKey(thread) || readLocked.containsKey(thread)) throw new IllegalMonitorStateException("Thread already holds one or more locks."); // Wait in queue if necessary synchronized(queue) { // Guard queue and transaction, monitor for waiting in queue queue.add(thread); while(transactions >= Math.max(mprop.num(MainProp.PARALLEL), 1) || queue.peek() != thread) { try { queue.wait(); } catch(final InterruptedException e) { Thread.currentThread().interrupt(); } } final int t = transactions++; assert t <= Math.max(mprop.num(MainProp.PARALLEL), 1); queue.remove(thread); } // Global write lock if write StringList is not set if(null == write) writeAll.writeLock().lock(); else writeAll.readLock().lock(); synchronized(globalLock) { // local write locking if(null != write && !write.isEmpty()) { while(globalReaders > 0) { try { globalLock.wait(); } catch(final InterruptedException e) { Thread.currentThread().interrupt(); } } localWriters++; } // global read locking if(null == read) { while(localWriters > 0) { try { globalLock.wait(); } catch(final InterruptedException e) { Thread.currentThread().interrupt(); } } globalReaders++; } } // Local locking final StringList writeObjects; if(null != write) { writeObjects = write.sort(true).unique(); writeLocked.put(thread, writeObjects); } else { writeObjects = new StringList(0); } final StringList readObjects; if(null != read) { readObjects = read.sort(true).unique(); readLocked.put(thread, readObjects); } else { readObjects = new StringList(0); } // Use pattern similar to merge sort int w = 0, r = 0; while(r < readObjects.size() || w < writeObjects.size()) { // Look what token comes earlier in alphabet, prefer writing against reading if(w < writeObjects.size() && (r >= readObjects.size() || writeObjects.get(w).compareTo(readObjects.get(r)) <= 0)) { final String writeObject = writeObjects.get(w++); setLockUsed(writeObject); getOrCreateLock(writeObject).writeLock().lock(); } else // Read lock only if not global write locking; otherwise no lock downgrading from // global write lock is possible if(null != write) { final String readObject = readObjects.get(r++); setLockUsed(readObject); getOrCreateLock(readObject).readLock().lock(); } } } /** * Only keeps given write locks, downgrades the others to read locks. * @param write write locks to keep */ @Override public void downgrade(final StringList write) { final Long thread = Thread.currentThread().getId(); if(null == write) throw new IllegalMonitorStateException("Cannot downgrade to global write lock."); write.sort(true).unique(); // Fetch current locking status final StringList writeObjects = writeLocked.remove(thread); final StringList readObjects = readLocked.remove(thread); final StringList newWriteObjects = new StringList(); StringList newReadObjects = new StringList(); if(null != readObjects) newReadObjects.add(readObjects); if(null != writeObjects) { if(!writeObjects.containsAll(write)) throw new IllegalMonitorStateException( "Cannot downgrade write lock that has not been acquired."); // Perform downgrades for(final String object : writeObjects) { if(write.contains(object)) { newWriteObjects.add(object); } else { final ReentrantReadWriteLock lock = getOrCreateLock(object); assert 1 == lock.getWriteHoldCount() : "Unexpected write lock count: " + lock.getWriteHoldCount(); lock.readLock().lock(); newReadObjects.add(object); lock.writeLock().unlock(); } } } // Downgrade from global write lock to global read lock if(writeAll.writeLock().isHeldByCurrentThread()) { for (final String object : write) { getOrCreateLock(object).writeLock().lock(); setLockUsed(object); } newWriteObjects.add(write); // Release all local read locks as we're fetching a global one for(final String object : readObjects) { getOrCreateLock(object).readLock().unlock(); unsetLockIfUnused(object); } newReadObjects = null; readLocked.remove(thread); writeAll.readLock().lock(); writeAll.writeLock().unlock(); synchronized(globalLock) { if(!write.isEmpty()) localWriters++; globalReaders++; globalLock.notifyAll(); } } // Write back new locking lists writeLocked.put(thread, newWriteObjects); if (null != newReadObjects) readLocked.put(thread, newReadObjects); } /** * Gets or creates lock on object. * @param object to fetch lock for * @return lock on object */ private ReentrantReadWriteLock getOrCreateLock(final String object) { ReentrantReadWriteLock lock; synchronized(locks) { // Make sure each object lock is a singleton lock = locks.get(object); if(null == lock) { // Create lock if needed lock = new ReentrantReadWriteLock(FAIR); locks.put(object, lock); } } return lock; } @Override public void release(final Proc pr) { // Release all write locks final Long thread = Thread.currentThread().getId(); final StringList writeObjects = writeLocked.remove(thread); if(null != writeObjects) for(final String object : writeObjects) { final ReentrantReadWriteLock lock = getOrCreateLock(object); assert 1 == lock.getWriteHoldCount() : "Unexpected write lock count: " + lock.getWriteHoldCount(); lock.writeLock().unlock(); unsetLockIfUnused(object); } // Release all read locks final StringList readObjects = readLocked.remove(thread); if(!writeAll.isWriteLocked() && null != readObjects) for(final String object : readObjects) { getOrCreateLock(object).readLock().unlock(); unsetLockIfUnused(object); } // Release global locks (writeAll.isWriteLocked() ? writeAll.writeLock() : writeAll.readLock()).unlock(); if(null != writeObjects && !writeObjects.isEmpty()) synchronized(globalLock) { localWriters--; globalLock.notifyAll(); } if(null == readObjects) synchronized(globalLock) { globalReaders--; globalLock.notifyAll(); } // Allow another transaction to run synchronized(queue) { transactions--; queue.notifyAll(); } } /** * Marks a lock as used. * @param lock Lock to set used */ private void setLockUsed(final String lock) { synchronized(lockUsage) { Integer usage = lockUsage.get(lock); if(null == usage) usage = 0; lockUsage.put(lock, ++usage); } } /** * Unsets lock if unused. * @param object Object to test */ private void unsetLockIfUnused(final String object) { synchronized(lockUsage) { Integer usage = lockUsage.get(object); assert null != usage; if (0 == --usage) { locks.remove(object); lockUsage.remove(object); } else lockUsage.put(object, usage); } } /** * Present current locking status. Not to be seen as a programming API but only for * debugging purposes. */ @Override public String toString() { final String ind = "| "; final StringBuilder sb = new StringBuilder(NL); sb.append("Locking" + NL); sb.append(ind + "Transactions running: " + transactions + NL); sb.append(ind + "Transaction queue: " + queue + NL); sb.append(ind + "Held locks by object:" + NL); for(final Object object : locks.keySet()) sb.append(ind + ind + object + " -> " + locks.get(object) + NL); sb.append(ind + "Held write locks by transaction:" + NL); for(final Long thread : writeLocked.keySet()) sb.append(ind + ind + thread + " -> " + writeLocked.get(thread) + NL); sb.append(ind + "Held read locks by transaction:" + NL); for(final Long thread : readLocked.keySet()) sb.append(ind + ind + thread + " -> " + readLocked.get(thread) + NL); return sb.toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/Databases.java000066400000000000000000000130321222453003200246600ustar00rootroot00000000000000package org.basex.core; import java.util.*; import java.util.regex.*; import org.basex.io.*; import org.basex.util.*; import org.basex.util.list.*; /** * Manages a two-way-map of all available databases and backups. Used for locking. * * @author BaseX Team 2005-12, BSD License * @author Jens Erat */ public final class Databases { /** Allowed characters for database names (additional to letters and digits). * The following characters are invalid: *
    *
  • {@code ,?*}" are used by the glob syntax
  • *
  • {@code ;} is reserved for separating commands.
  • *
  • {@code :*?\"<>\/|}" are used for filenames and paths
  • *
*/ public static final String DBCHARS = "-+=~!#$%^&()[]{}@'`"; /** Regex representation of allowed database characters. */ public static final String REGEXCHARS = DBCHARS.replaceAll("(.)", "\\\\$1"); /** Pattern to extract the database name from a backup file name. */ private static final Pattern ZIPPATTERN = Pattern.compile(DateTime.PATTERN + '\\' + IO.ZIPSUFFIX + '$'); /** Regex indicator. */ private static final Pattern REGEX = Pattern.compile(".*[*?,].*"); /** Main properties. */ final MainProp mprop; /** * Creates a new instance and loads available databases. * @param c Database context */ Databases(final Context c) { mprop = c.mprop; } /** * Lists all available databases and backups. * @return database and backup list */ public StringList list() { return list(true, true, null); } /** * Lists all available databases. * @return database list */ public StringList listDBs() { return list(true, false, null); } /** * Lists all available databases matching the given name. Supports glob patterns. * @param name database name, glob patterns allowed * @return database list */ public StringList listDBs(final String name) { return list(true, false, name); } /** * Lists all available backups matching the specified prefix. * @param prefix prefix (may be {@code null}) * @return database list */ public StringList backups(final String prefix) { final StringList list = new StringList(); for(final IOFile f : mprop.dbpath().children()) { final String name = f.name(); if(name.endsWith(IO.ZIPSUFFIX) && (prefix == null || name.startsWith(prefix))) { list.add(name.replaceFirst("\\..*", "")); } } return list; } /** * Returns the sorted names of all available databases and, optionally, backups. * Filters for {@code name} if not {@code null} with glob support. * @param db return databases? * @param backup return backups? * @param name name filter (may be {@code null}) * @return database and backups list */ private StringList list(final boolean db, final boolean backup, final String name) { final Pattern pt; if(name != null) { final String nm = REGEX.matcher(name).matches() ? IOFile.regex(name) : name.replaceAll("([" + REGEXCHARS + "])", "\\\\$1"); pt = Pattern.compile(nm, Prop.CASE ? 0 : Pattern.CASE_INSENSITIVE); } else { pt = null; } final IOFile[] children = mprop.dbpath().children(); final StringList list = new StringList(children.length); final HashSet map = new HashSet(children.length); for(final IOFile f : children) { final String fn = f.name(); String add = null; if(backup && fn.endsWith(IO.ZIPSUFFIX)) { final String nn = ZIPPATTERN.split(fn)[0]; if(!nn.equals(fn)) add = nn; } else if(db && f.isDir() && fn.indexOf('.') == -1) { add = fn; } // add entry if it matches the pattern, and has not already been added if(add != null && (pt == null || pt.matcher(add).matches()) && map.add(add)) { list.add(add); } } return list.sort(false); } /** * Returns the paths of all backups of the specified database. * @param db database * @param ctx database context * @return paths of available backups */ public static StringList backupPaths(final String db, final Context ctx) { final StringList sl = new StringList(); final String regex = db.replaceAll("([" + REGEXCHARS + "])", "\\\\$1") + DateTime.PATTERN + IO.ZIPSUFFIX; for(final IOFile f : ctx.mprop.dbpath().children()) { if(f.name().matches(regex)) sl.add(f.path()); } return sl; } /** * Checks if the specified character is a valid character for a database name. * @param ch the character to be checked * @return result of check */ public static boolean validChar(final int ch) { return Token.letterOrDigit(ch) || DBCHARS.indexOf(ch) != -1; } /** * Checks if the specified string is a valid database name. * @param name name to be checked * @return result of check */ public static boolean validName(final String name) { return validName(name, false); } /** * Checks if the specified string is a valid database name. * @param name name to be checked * @param glob allow glob syntax * @return result of check */ public static boolean validName(final String name, final boolean glob) { if(name == null) return false; final int nl = name.length(); for(int n = 0; n < nl; n++) { final char ch = name.charAt(n); if((!glob || ch != '?' && ch != '*' && ch != ',') && !validChar(ch)) return false; } return nl != 0; } } basex-7.7.2/basex-core/src/main/java/org/basex/core/Datas.java000066400000000000000000000043571222453003200240370ustar00rootroot00000000000000package org.basex.core; import java.util.*; import org.basex.data.*; /** * This class organizes all currently opened databases. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Datas { /** List of data references. */ private final ArrayList list = new ArrayList(); /** * Pins and returns an existing data reference for the specified database, or * returns {@code null}. * @param db name of the database * @return data reference */ public synchronized Data pin(final String db) { for(final Data d : list) { if(d.meta.name.equals(db)) { pin(d); return d; } } return null; } /** * Pins a data reference. * @param data data reference */ public synchronized void pin(final Data data) { data.pins++; } /** * Unpins a data reference. * @param data data reference * @return true if reference was removed from the pool */ public synchronized boolean unpin(final Data data) { for(int d = 0; d < list.size(); d++) { final Data dt = list.get(d); if(dt == data) { final boolean close = --data.pins == 0; if(close) list.remove(d); return close; } } return false; } /** * Adds an already pinned data reference to the pool. * @param d data reference */ public synchronized void add(final Data d) { list.add(d); } /** * Checks if the specified database is pinned. * @param db name of the database * @return result of check */ synchronized boolean pinned(final String db) { for(final Data d : list) if(d.meta.name.equals(db)) return true; return false; } /** * Closes all data references. */ synchronized void close() { for(final Data d : list) d.close(); list.clear(); } /** * Returns the number of pins for the specified database, * or {@code 0} if the database is not opened. * @param db name of the database * @return number of references */ public synchronized int pins(final String db) { for(final Data d : list) { if(d.meta.name.equals(db)) return d.pins; } return 0; } } basex-7.7.2/basex-core/src/main/java/org/basex/core/Events.java000066400000000000000000000060561222453003200242450ustar00rootroot00000000000000package org.basex.core; import static org.basex.core.Text.*; import static org.basex.util.Token.*; import java.io.*; import java.util.*; import org.basex.io.*; import org.basex.io.in.DataInput; import org.basex.io.out.DataOutput; import org.basex.server.*; import org.basex.util.*; /** * This class organizes all known events. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Roman Raedle * @author Andreas Weiler */ public final class Events extends HashMap { /** Event file. */ private final IOFile file = new IOFile(Prop.HOME, IO.BASEXSUFFIX + "events"); /** * Constructor. */ public Events() { if(!file.exists()) return; DataInput in = null; try { in = new DataInput(file); final int s = in.readNum(); for(int u = 0; u < s; ++u) put(string(in.readToken()), new Sessions()); } catch(final IOException ex) { Util.errln(ex); } finally { if(in != null) try { in.close(); } catch(final IOException ignored) { } } } /** * Creates an event. * @param name event name * @return success flag */ public synchronized boolean create(final String name) { final boolean b = put(name, new Sessions()) == null; if(b) write(); return b; } /** * Drops an event. * @param name event name * @return success flag */ public synchronized boolean drop(final String name) { final boolean b = remove(name) != null; if(b) write(); return b; } /** * Writes global permissions to disk. */ private void write() { try { final DataOutput out = new DataOutput(file); out.writeNum(size()); for(final String name : keySet()) out.writeToken(token(name)); out.close(); } catch(final IOException ex) { Util.debug(ex); } } /** * Returns information on all events. * @return information on all events. */ public synchronized String info() { final TokenBuilder tb = new TokenBuilder(); tb.addExt(EVENTS_X, size()).add(size() != 0 ? COL : DOT); final String[] names = keySet().toArray(new String[size()]); Arrays.sort(names); for(final String n : names) tb.add(NL).add(LI).add(n); return tb.toString(); } /** * Notifies the watching sessions about an event. * @param ctx database context * @param name name * @param msg message * @return success flag */ public synchronized boolean notify(final Context ctx, final byte[] name, final byte[] msg) { final Sessions sess = get(string(name)); // event was not found if(sess == null) return false; // refresh timestamp for last interaction for(final ClientListener srv : sess) { // ignore active client if(srv == ctx.listener) continue; try { srv.notify(name, msg); } catch(final IOException ex) { // remove client if event could not be delivered sess.remove(srv); } } return true; } } basex-7.7.2/basex-core/src/main/java/org/basex/core/InfoListener.java000066400000000000000000000006001222453003200253670ustar00rootroot00000000000000package org.basex.core; /** * Info listener, receiving and handling information generated during the evaluation * of a command or query. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public interface InfoListener { /** * Processes information generated by a process. * @param info info to be processed */ void info(final String info); } basex-7.7.2/basex-core/src/main/java/org/basex/core/Lang.java000066400000000000000000000134661222453003200236650ustar00rootroot00000000000000package org.basex.core; import java.io.*; import java.net.*; import java.util.*; import java.util.jar.*; import org.basex.io.*; import org.basex.io.in.*; import org.basex.util.*; import org.basex.util.list.*; /** * This class loads language specific texts when the {@link #lang} * method is called for the first time. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Andreas Weiler */ public final class Lang { /** Language suffix. */ private static final String SUFFIX = "lang"; /** Cached source files. */ private static final HashMap TEXTS = new HashMap(); /** Checks which strings have been applied. */ private static final HashMap CHECK = new HashMap(); /** Private constructor. */ private Lang() { } /** Reads the language file. */ static { read(Prop.language); } /** * Reads the specified language file. * @param lang language */ private static synchronized void read(final String lang) { TEXTS.clear(); CHECK.clear(); final String path = '/' + SUFFIX + '/' + lang + '.' + SUFFIX; final InputStream is = Lang.class.getResourceAsStream(path); if(is == null) { Util.errln(path + " not found."); } else { try { final NewlineInput nli = new NewlineInput(is); try { for(String line; (line = nli.readLine()) != null;) { final int i = line.indexOf('='); if(i == -1 || line.startsWith("#")) continue; final String key = line.substring(0, i).trim(); String val = line.substring(i + 1).trim(); if(key.equals("langright")) { Prop.langright = val.equals("true"); } else { if(val.contains("\\n")) val = val.replaceAll("\\\\n", Prop.NL); if(Prop.langkeys) val = '[' + key + ": " + val + ']'; if(TEXTS.put(key, val) != null) { Util.errln("%." + SUFFIX + ": '%' is declared twice", lang, key); } CHECK.put(key, true); } } } finally { nli.close(); } } catch(final IOException ex) { Util.errln(ex); } } } /** * Returns the specified string. * @param key key * @return string */ static synchronized String lang(final String key) { if(key == null) { for(final String s : CHECK.keySet()) { Util.errln("%." + SUFFIX + ": '%' can be removed", Prop.language, s); } return null; } final String val = TEXTS.get(key); if(val == null) { Util.errln("%." + SUFFIX + ": '%' is missing", Prop.language, key); return '[' + key + ']'; } CHECK.remove(key); return val; } /** * Returns the specified string with some text extensions included. * @param key key * @param e text text extensions * @return string */ static synchronized String lang(final String key, final Object... e) { return Util.info(lang(key), e); } /** * Parses all available language files and returns the names and credits. * @return language arrays */ public static synchronized String[][] parse() { final StringList langs = new StringList(); final StringList creds = new StringList(); try { // supported protocols: jar and file final URL url = Lang.class.getResource('/' + SUFFIX); if(url.getProtocol().equals("jar")) { final JarURLConnection conn = (JarURLConnection) url.openConnection(); final String pre = conn.getEntryName(); final JarFile jar = conn.getJarFile(); final Enumeration je = jar.entries(); while(je.hasMoreElements()) { final JarEntry entry = je.nextElement(); final String name = entry.getName(); if(!name.startsWith(pre) || !name.endsWith(SUFFIX)) continue; final byte[] cont = new IOStream(jar.getInputStream(entry)).read(); langs.add(name.replaceAll(".*/|." + SUFFIX, "")); creds.add(credits(cont)); } } else { for(final IO f : IOFile.get(url.toString()).children()) { langs.add(f.name().replaceAll('.' + SUFFIX, "")); creds.add(credits(f.read())); } } } catch(final IOException ex) { Util.errln(ex); } return new String[][] { langs.toArray(), creds.toArray() }; } /** * Returns the credits from the specified file. * @param cont content * @return credits */ private static synchronized String credits(final byte[] cont) { final StringTokenizer st = new StringTokenizer(Token.string(cont), "\n"); st.nextToken(); return st.nextToken().replaceAll("# ", ""); } /** * Checks the existing language files for correctness and completeness. */ public static void check() { read("English"); final StringBuilder sb = new StringBuilder(); final HashSet set = new HashSet(); for(final String s : TEXTS.keySet()) set.add(s); final IOFile[] files = new IOFile("src/main/resources/lang").children(); for(final IOFile f : files) { final String lang = f.name().replace('.' + SUFFIX, ""); if(lang.equals("English")) continue; read(lang); for(final Object o : set.toArray()) { if(TEXTS.remove(o) == null) sb.append("- ").append(o).append('\n'); } if(sb.length() != 0) { Util.err("Missing in %.lang:\n%", lang, sb); sb.setLength(0); } for(final String s : TEXTS.keySet()) { sb.append("- ").append(s).append('\n'); } if(sb.length() != 0) { Util.err("Not defined in %.lang:\n%", lang, sb); sb.setLength(0); } } } } basex-7.7.2/basex-core/src/main/java/org/basex/core/LockResult.java000066400000000000000000000007541222453003200250670ustar00rootroot00000000000000package org.basex.core; import org.basex.util.list.*; /** * Result object for databases function. * @see Proc#databases(LockResult) */ public class LockResult { /** Flag if global read lock is required. */ public boolean readAll; /** Flag if global write lock is required. */ public boolean writeAll; /** List of databases to read lock. */ public StringList read = new StringList(1); /** List of databases to write lock. */ public StringList write = new StringList(1); } basex-7.7.2/basex-core/src/main/java/org/basex/core/Locking.java000066400000000000000000000020011222453003200243510ustar00rootroot00000000000000package org.basex.core; import org.basex.util.list.*; /** * Lock interface; will get obsolete after database locking has been finalized. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public interface Locking { /** * Puts read and write locks the specified databases. * Store and return the {@code token} for unlocking these objects again. * * @param pr process * @param read names of databases to put read locks on. * Global locking is performed if the passed on reference is {@code null} * @param write names of databases to put write locks on. * Global locking is performed if the passed on reference is {@code null} */ void acquire(final Proc pr, final StringList read, final StringList write); /** * Unlock all string locked by a transaction. * @param write write locks to keep */ void downgrade(final StringList write); /** * Unlock all string locked by a transaction. * @param pr process */ void release(final Proc pr); } basex-7.7.2/basex-core/src/main/java/org/basex/core/Main.java000066400000000000000000000110721222453003200236570ustar00rootroot00000000000000package org.basex.core; import static org.basex.core.Text.*; import static org.basex.util.Token.*; import java.io.*; import java.util.*; import org.basex.core.cmd.*; import org.basex.core.parse.*; import org.basex.query.*; import org.basex.server.*; import org.basex.util.*; /** * This is the abstract main class for the starter classes. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class Main { /** Database context. */ public final Context context; /** Output file for queries. */ protected OutputStream out = System.out; /** Console mode. May be set to {@code false} during execution. */ protected boolean console; /** Session. */ protected Session session; /** Verbose mode. */ protected boolean verbose; /** Separate serialized items with newlines. */ protected boolean newline; /** Password reader. */ final PasswordReader pwReader = new PasswordReader() { @Override public String password() { Util.out(PASSWORD + COLS); return md5(Util.password()); } }; /** * Constructor. * @param args command-line arguments * @throws IOException I/O exception */ protected Main(final String[] args) throws IOException { this(args, null); } /** * Constructor. * @param args command-line arguments * @param ctx database context, or {@code null} * @throws IOException I/O exception */ protected Main(final String[] args, final Context ctx) throws IOException { context = ctx != null ? ctx : new Context(); parseArguments(args); // console: turn on verbose mode verbose |= console; // guarantee correct shutdown of database context Runtime.getRuntime().addShutdownHook(new Thread() { @Override public synchronized void run() { context.close(); } }); } /** * Launches the console mode, which reads and executes user input. */ protected final void console() { // create console reader final ConsoleReader cr = ConsoleReader.get(); // loop until console is set to false (may happen in server mode) while(console) { // get next line final String in = cr.readLine(); // end of input: break loop if(in == null) break; // skip empty lines if(in.isEmpty()) continue; try { if(!execute(new CommandParser(in, context).pwReader(cr.pwReader()))) { // show goodbye message if method returns false Util.outln(BYE[new Random().nextInt(4)]); return; } } catch(final IOException ex) { // output error messages Util.errln(ex); } } } /** * Quits the console mode. * @throws IOException I/O exception */ protected void quit() throws IOException { if(out == System.out || out == System.err) out.flush(); else out.close(); } /** * Parses and executes the input string. * @param in input commands * @throws IOException database exception */ protected final void execute(final String in) throws IOException { execute(new CommandParser(in, context).pwReader(pwReader)); } /** * Execute the commands from the given command parser. * @param parser command parser * @return {@code false} if the exit command was sent * @throws IOException database exception */ private boolean execute(final CommandParser parser) throws IOException { try { for(final Command cmd : parser.parse()) { if(cmd instanceof Exit) return false; execute(cmd, verbose); } } catch(final QueryException ex) { throw new BaseXException(ex); } return true; } /** * Executes the specified command and optionally prints some information. * @param cmd command to be run * @param info verbose flag * @throws IOException I/O exception */ protected final void execute(final Command cmd, final boolean info) throws IOException { final Session ss = session(); ss.execute(cmd); if(newline && cmd instanceof XQuery) out.write(token(NL)); if(info) Util.out(ss.info()); } /** * Returns the session. * @return session * @throws IOException I/O exception */ protected abstract Session session() throws IOException; /** * Parses the command-line arguments, specified by the user. * @param args command-line arguments * @throws IOException I/O exception */ protected abstract void parseArguments(final String... args) throws IOException; } basex-7.7.2/basex-core/src/main/java/org/basex/core/MainProp.java000066400000000000000000000123741222453003200245260ustar00rootroot00000000000000package org.basex.core; import java.util.*; import org.basex.io.*; /** * This class assembles admin properties which are used all around the project. * They are also stored in the project's home directory. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class MainProp extends AProp { /** Indicates if the user's home directory has been chosen as home directory. */ private static final boolean USERHOME = Prop.HOME.equals(Prop.USERHOME); /** Comment: written to property file. */ public static final Object[] C_GENERAL = { "General Options" }; /** Database path. */ public static final Object[] DBPATH = { "DBPATH", Prop.HOME + (USERHOME ? Prop.NAME + "Data" : "data") }; /** Package repository path. */ public static final Object[] REPOPATH = { "REPOPATH", Prop.HOME + (USERHOME ? Prop.NAME + "Repo" : "repo") }; /** Debug mode. */ public static final Object[] DEBUG = { "DEBUG", false }; /** Language name. */ public static final Object[] LANG = { "LANG", Prop.language }; /** Flag to include key names in the language strings. */ public static final Object[] LANGKEYS = { "LANGKEYS", false }; /** Applied locking algorithm: local (database) vs. global (process) locking. */ public static final Object[] GLOBALLOCK = { "GLOBALLOCK", false }; /** Comment: written to property file. */ public static final Object[] C_CLIENT = { "Client/Server Architecture" }; /** Server: host, used for connecting new clients. */ public static final Object[] HOST = { "HOST", Text.LOCALHOST }; /** Server: port, used for connecting new clients. */ public static final Object[] PORT = { "PORT", 1984 }; /** Server: port, used for binding the server. */ public static final Object[] SERVERPORT = { "SERVERPORT", 1984 }; /** Server: port, used for sending events. */ public static final Object[] EVENTPORT = { "EVENTPORT", 1985 }; /** Default user. */ public static final Object[] USER = { "USER", "" }; /** Default password. */ public static final Object[] PASSWORD = { "PASSWORD", "" }; /** Server: host, used for binding the server. Empty string for wildcard.*/ public static final Object[] SERVERHOST = { "SERVERHOST", "" }; /** Server: proxy host. */ public static final Object[] PROXYHOST = { "PROXYHOST", "" }; /** Server: proxy port. */ public static final Object[] PROXYPORT = { "PROXYPORT", 80 }; /** Server: non-proxy host. */ public static final Object[] NONPROXYHOSTS = { "NONPROXYHOSTS", "" }; /** Timeout (seconds) for processing client requests; deactivated if set to 0. */ public static final Object[] TIMEOUT = { "TIMEOUT", 30 }; /** Keep alive time of clients; deactivated if set to 0. */ public static final Object[] KEEPALIVE = { "KEEPALIVE", 600 }; /** Defines the number of parallel readers. */ public static final Object[] PARALLEL = { "PARALLEL", 8 }; /** Logging flag. */ public static final Object[] LOG = { "LOG", true }; /** Log message cut-off. */ public static final Object[] LOGMSGMAXLEN = { "LOGMSGMAXLEN", 1000 }; /** Comment: written to property file. */ public static final Object[] C_HTTP = { "HTTP Services" }; /** Web path. */ public static final Object[] WEBPATH = { "WEBPATH", Prop.HOME + (USERHOME ? Prop.NAME + "Web" : "webapp") }; /** RESTXQ path (relative to web path). */ public static final Object[] RESTXQPATH = { "RESTXQPATH", "" }; /** Local (embedded) mode. */ public static final Object[] HTTPLOCAL = { "HTTPLOCAL", false }; /** Port for stopping the web server. */ public static final Object[] STOPPORT = { "STOPPORT", 8985 }; /** * Constructor, adopting system properties starting with "org.basex.". * @param file if {@code true}, properties will also be read from disk */ MainProp(final boolean file) { super(file ? "" : null); // set some static properties Prop.language = get(LANG); Prop.langkeys = is(LANGKEYS); Prop.debug = is(DEBUG); final String ph = get(PROXYHOST); final String pp = Integer.toString(num(PROXYPORT)); AProp.setSystem("http.proxyHost", ph); AProp.setSystem("http.proxyPort", pp); AProp.setSystem("https.proxyHost", ph); AProp.setSystem("https.proxyPort", pp); AProp.setSystem("http.nonProxyHosts", get(NONPROXYHOSTS)); } /** * Returns a reference to a database directory. * @param db name of the database * @return database directory */ public IOFile dbpath(final String db) { return new IOFile(get(DBPATH), db); } /** * Returns a random temporary name for the specified database. * @param db name of database * @return random name */ public String random(final String db) { String nm; do { nm = db + '_' + new Random().nextInt(0x7FFFFFFF); } while(dbpath(nm).exists()); return nm; } /** * Returns the current database path. * @return database filename */ public IOFile dbpath() { return new IOFile(get(DBPATH)); } /** * Checks if the specified database exists. * @param db name of the database * @return result of check */ public boolean dbexists(final String db) { return !db.isEmpty() && dbpath(db).exists(); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/Perm.java000066400000000000000000000024551222453003200237030ustar00rootroot00000000000000package org.basex.core; /** * User permissions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public enum Perm { /** No permissions. */ NONE(0), /** Read permission (local+global). */ READ(1), /** Write permission (local+global). */ WRITE(2), /** Create permission (global). */ CREATE(4), /** Admin permission (global). */ ADMIN(8); /** Permission. */ public final int num; /** * Constructor. * @param n numeric representation */ Perm(final int n) { num = n; } /** * Returns the permission with less privileges. * @param p permission to be compared * @return permission */ Perm min(final Perm p) { return num < p.num ? this : p; } /** * Returns a permission matching the specified number. * @param n numeric representation * @return permission, or {@link #ADMIN} if no match is found */ static Perm get(final int n) { for(final Perm p : values()) if(p.num == n) return p; return ADMIN; } /** * Returns a permission matching the specified string. * @param s permission string * @return permission, or {@link #ADMIN} if no match is found */ public static Perm get(final String s) { for(final Perm p : values()) if(p.name().equalsIgnoreCase(s)) return p; return ADMIN; } } basex-7.7.2/basex-core/src/main/java/org/basex/core/Proc.java000066400000000000000000000103521222453003200236760ustar00rootroot00000000000000package org.basex.core; import static org.basex.core.Text.*; import org.basex.util.*; /** * This class is implemented by all kinds of processes. * It gives feedback on the current process. Moreover, it allows to * interrupt the process by calling the {@link #stop()} method. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class Proc { /** Listener, reacting on process information. */ public InfoListener listen; /** This flag indicates that a command may perform updates. */ public boolean updating; /** Indicates if a process is currently registered. */ boolean registered; /** Stopped flag. */ private boolean stopped; /** Timeout thread. */ private Thread timeout; /** Sub process. */ private Proc sub; /** * Returns short information on the current process or sub process. * @return header information */ public final String title() { return sub != null ? sub.title() : tit(); } /** * Returns detailed information on the current process or sub process. * Can be overwritten to give more detailed information. * @return information in detail */ public final String detail() { return sub != null ? sub.detail() : det(); } /** * Returns a progress value from the interval {@code [0, 1]}. * @return header information */ public final double progress() { return sub != null ? sub.progress() : prog(); } /** * Attaches the specified info listener. * @param il info listener */ public final void listen(final InfoListener il) { if(sub != null) sub.listen(il); listen = il; } /** * Sets a new sub process. * @param

process type * @param proc process * @return passed on process reference */ protected final

P proc(final P proc) { sub = proc; if(proc != null) { proc.listen = listen; proc.registered = registered; proc.proc(sub.sub); if(stopped) proc.stop(); } return proc; } /** * Stops a process or sub process. */ public final void stop() { if(sub != null) sub.stop(); stopped = true; stopTimeout(); } /** * Checks if the process was interrupted; if yes, sends a runtime exception. */ public final void checkStop() { if(stopped) throw new ProcException(); } /** * Aborts a failed or interrupted process. */ protected void abort() { if(sub != null) sub.abort(); } /** * Starts a timeout thread. * @param ms milliseconds to wait; deactivated if set to 0 */ public final void startTimeout(final long ms) { if(ms == 0) return; timeout = new Thread() { @Override public void run() { Performance.sleep(ms); Proc.this.stop(); } }; timeout.start(); } /** * Stops the timeout thread. */ public final void stopTimeout() { if(timeout != null) { timeout.interrupt(); timeout = null; } } /** * Adds the names of the databases that may be touched by the process. * @param lockResult Container for lock result to pass around */ public void databases(final LockResult lockResult) { lockResult.writeAll = true; } /** * Checks if the process is registered. * @return result of check */ public final boolean registered() { return sub != null ? sub.registered() : registered; } /** * Sets the registered state. * @param reg registered flag */ public final void registered(final boolean reg) { if(sub != null) sub.registered(reg); registered = reg; } /** * Returns short information on this process. * Can be overwritten to give more detailed information. * @return header information */ protected String tit() { return PLEASE_WAIT_D; } /** * Returns short information on this process. * @return header information */ protected String det() { return PLEASE_WAIT_D; } /** * Returns a progress value (0 - 1). * Can be overwritten to give more detailed information. * @return header information */ protected double prog() { return 0; } } basex-7.7.2/basex-core/src/main/java/org/basex/core/ProcException.java000066400000000000000000000003471222453003200255600ustar00rootroot00000000000000package org.basex.core; /** * This exception is called whenever a process is interrupted. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ProcException extends RuntimeException { } basex-7.7.2/basex-core/src/main/java/org/basex/core/ProcLocking.java000066400000000000000000000046201222453003200252060ustar00rootroot00000000000000package org.basex.core; import java.util.*; import org.basex.util.*; import org.basex.util.list.*; /** * Management of executing read/write processes. * Supports multiple readers, limited by {@link MainProp#PARALLEL}, * and a single writer (readers/writer lock). * * Since Version 7.6, this locking class has been replaced by {@link DBLocking}. * It can still be activated by setting {@link MainProp#GLOBALLOCK} to {@code true}. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class ProcLocking implements Locking { /** Queue for all waiting processes. */ private final LinkedList queue = new LinkedList(); /** Mutex object. */ private final Object mutex = new Object(); /** Database context. */ private final Context ctx; /** Number of active readers. */ private int readers; /** Writer flag. */ private boolean writer; /** * Default constructor. * @param c context */ ProcLocking(final Context c) { ctx = c; } @Override public void acquire(final Proc pr, final StringList read, final StringList write) { final Object o = new Object(); synchronized(mutex) { // add object to queue queue.add(o); // maximum number of readers final int maxReaders = Math.max(ctx.mprop.num(MainProp.PARALLEL), 1); while(true) { if(!writer && o == queue.get(0)) { if(pr.updating) { // check updating process if(readers == 0) { // start writing process writer = true; break; } } else if(readers < maxReaders) { // increase number of readers ++readers; break; } } // check if process has already been stopped pr.checkStop(); // wait for next process to be finalized try { mutex.wait(); } catch(final InterruptedException ex) { Util.stack(ex); } } // start process, remove from queue queue.remove(0); } } @Override public void downgrade(final StringList write) { } @Override public void release(final Proc pr) { synchronized(mutex) { if(pr.updating) { writer = false; } else { --readers; } mutex.notifyAll(); } } } basex-7.7.2/basex-core/src/main/java/org/basex/core/Prop.java000066400000000000000000000306541222453003200237220ustar00rootroot00000000000000package org.basex.core; import java.io.*; import java.net.*; import java.security.*; import org.basex.io.*; import org.basex.util.*; /** * This class assembles properties which are used all around the project. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Prop extends AProp { // CONSTANTS ========================================================================== /** Project name. */ public static final String NAME = "BaseX"; /** Code version (may contain major, minor and optional patch number). */ public static final String VERSION = "7.7.2"; /** Main author. */ public static final String AUTHOR = "Christian Gr\u00FCn"; /** Co-authors (1). */ public static final String TEAM1 = "Alexander Holupirek, Michael Seiferle"; /** Co-authors (2). */ public static final String TEAM2 = "Lukas Kircher, Leo W\u00F6rteler"; /** Entity. */ public static final String ENTITY = Prop.NAME + " Team"; /** New line string. */ public static final String NL = System.getProperty("line.separator"); /** Returns the system's default encoding. */ public static final String ENCODING = System.getProperty("file.encoding"); /** System's temporary directory. */ public static final String TMP = dir(System.getProperty("java.io.tmpdir")); /** OS flag (source: {@code http://lopica.sourceforge.net/os.html}). */ private static final String OS = System.getProperty("os.name"); /** Flag denoting if OS belongs to Mac family. */ public static final boolean MAC = OS.startsWith("Mac"); /** Flag denoting if OS belongs to Windows family. */ public static final boolean WIN = OS.startsWith("Windows"); /** Respect lower/upper case when doing file comparisons. */ public static final boolean CASE = !(MAC || WIN); /** Prefix for project specific properties. */ public static final String DBPREFIX = "org.basex."; /** System property for specifying database home directory. */ public static final String PATH = DBPREFIX + "path"; /** User's home directory. */ public static final String USERHOME = dir(System.getProperty("user.home")); /** Directory for storing the property files, database directory, etc. */ public static final String HOME = dir(homePath()); /** Comment in configuration file. */ static final String PROPHEADER = "# " + NAME + " Property File." + NL; /** Comment in configuration file. */ static final String PROPUSER = "# Local Options"; // STATIC OPTIONS ===================================================================== /** Language (applied after restart). */ public static String language = "English"; /** Flag for prefixing texts with their keys (helps while translating texts). */ public static boolean langkeys; /** Language direction (right vs. left). */ public static boolean langright; /** Debug mode. */ public static boolean debug; /** GUI mode. */ public static boolean gui; // OPTIONS ============================================================================ // General /** Flag for creating a main memory database. */ public static final Object[] MAINMEM = { "MAINMEM", false }; /** Flag for opening a database after creating it. */ public static final Object[] CREATEONLY = { "CREATEONLY", false }; // Parsing /** Path for filtering XML Documents. */ public static final Object[] CREATEFILTER = { "CREATEFILTER", "*.xml" }; /** Flag for adding archives to a database. */ public static final Object[] ADDARCHIVES = { "ADDARCHIVES", true }; /** Flag for skipping corrupt files. */ public static final Object[] SKIPCORRUPT = { "SKIPCORRUPT", false }; /** Flag for adding remaining files as raw files. */ public static final Object[] ADDRAW = { "ADDRAW", false }; /** Define import parser. */ public static final Object[] PARSER = { "PARSER", "xml" }; /** Define parser options. */ public static final Object[] PARSEROPT = { "PARSEROPT", "encoding=UTF-8,flat=false,header=false,jsonml=false," + "lines=true,separator=comma" }; /** Cache new documents before adding them to a database. */ public static final Object[] ADDCACHE = { "ADDCACHE", false }; /** Define TagSoup HTML options. */ public static final Object[] HTMLOPT = { "HTMLOPT", "html=false,omit-xml-declaration=false,method=xml,nons=false,nobogons=false," + "nodefaults=false,nocolons=false,norestart=false,ignorable=false,emptybogons=false," + "any=false,norootbogons=false,nocdata=false,lexical=false,encoding=utf-8" }; // XML Parsing /** Flag for whitespace chopping. */ public static final Object[] CHOP = { "CHOP", true }; /** Use internal XML parser. */ public static final Object[] INTPARSE = { "INTPARSE", true }; /** Strips namespaces. */ public static final Object[] STRIPNS = { "STRIPNS", false }; /** Flag for parsing DTDs in internal parser. */ public static final Object[] DTD = { "DTD", false }; /** Path to XML Catalog file. */ public static final Object[] CATFILE = { "CATFILE", "" }; // Indexing /** Flag for creating a text index. */ public static final Object[] TEXTINDEX = { "TEXTINDEX", true }; /** Flag for creating an attribute value index. */ public static final Object[] ATTRINDEX = { "ATTRINDEX", true }; /** Flag for creating a full-text index. */ public static final Object[] FTINDEX = { "FTINDEX", false }; /** Maximum number of text/attribute index entries * to keep in memory during index creation. */ public static final Object[] INDEXSPLITSIZE = { "INDEXSPLITSIZE", 0 }; /** Maximum number of fulltext index entries to keep in memory during index creation. */ public static final Object[] FTINDEXSPLITSIZE = { "FTINDEXSPLITSIZE", 0 }; /** Maximum length of index entries. */ public static final Object[] MAXLEN = { "MAXLEN", 96 }; /** Maximum number of name categories. */ public static final Object[] MAXCATS = { "MAXCATS", 100 }; /** Flag for automatic index update. */ public static final Object[] UPDINDEX = { "UPDINDEX", false }; // Full-Text /** Flag for full-text stemming. */ public static final Object[] STEMMING = { "STEMMING", false }; /** Flag for full-text case sensitivity. */ public static final Object[] CASESENS = { "CASESENS", false }; /** Flag for full-text diacritics sensitivity. */ public static final Object[] DIACRITICS = { "DIACRITICS", false }; /** Language for full-text search index. */ public static final Object[] LANGUAGE = { "LANGUAGE", "en" }; /** Path to full-text stopword list. */ public static final Object[] STOPWORDS = { "STOPWORDS", "" }; // Query Options /** Detailed query information. */ public static final Object[] QUERYINFO = { "QUERYINFO", false }; /** Default XQuery version. */ public static final Object[] XQUERY3 = { "XQUERY3", true }; /** External variables, separated by commas. */ public static final Object[] BINDINGS = { "BINDINGS", "" }; /** Path to current query. */ public static final Object[] QUERYPATH = { "QUERYPATH", "" }; /** Caches the query results. */ public static final Object[] CACHEQUERY = { "CACHEQUERY", false }; /** Forces database creation for unknown documents. */ public static final Object[] FORCECREATE = { "FORCECREATE", false }; /** Validate string inputs. */ public static final Object[] CHECKSTRINGS = { "CHECKSTRINGS", true }; /** Levenshtein default error. */ public static final Object[] LSERROR = { "LSERROR", 0 }; /** Number of query executions. */ public static final Object[] RUNS = { "RUNS", 1 }; // Serialize /** Flag for serializing query results. */ public static final Object[] SERIALIZE = { "SERIALIZE", true }; /** Serialization parameters, separated by commas. */ public static final Object[] SERIALIZER = { "SERIALIZER", "" }; /** Exporter serialization parameters. */ public static final Object[] EXPORTER = { "EXPORTER", "" }; /** Prints an XML plan. */ public static final Object[] XMLPLAN = { "XMLPLAN", false }; /** Creates the query plan before or after compilation. */ public static final Object[] COMPPLAN = { "COMPPLAN", true }; /** Dots the query plan. */ public static final Object[] DOTPLAN = { "DOTPLAN", false }; /** Compact dot representation. */ public static final Object[] DOTCOMPACT = { "DOTCOMPACT", false }; /** Display dot graph. */ public static final Object[] DOTDISPLAY = { "DOTDISPLAY", true }; /** Path to dotty. */ public static final Object[] DOTTY = { "DOTTY", "dotty" }; /** Flushes the database after each update. */ public static final Object[] AUTOFLUSH = { "AUTOFLUSH", true }; /** Writes original files back after updates. */ public static final Object[] WRITEBACK = { "WRITEBACK", false }; /** Maximum number of index occurrences to print. */ public static final Object[] MAXSTAT = { "MAXSTAT", 30 }; // Other /** Hidden: flag for tail-call optimization. */ public static final Object[] TAILCALLS = { "TAILCALLS", 256 }; /** Hidden: flag for the size limit on inlineable functions. */ public static final Object[] INLINELIMIT = { "INLINELIMIT", 0 }; /** Hidden: maximum number of hits to be displayed in the GUI (will be overwritten). */ public static final Object[] MAXHITS = { "MAXHITS", -1 }; /** *

Determines the project's home directory for storing property files * and directories. The directory is chosen as follows:

*
    *
  1. First, the system property {@code "org.basex.path"} is checked. * If it contains a value, it is adopted as home directory.
  2. *
  3. If not, the current working directory (defined by the system * property {@code "user.dir"}) is chosen if the file {@code .basex} or * {@code .basexhome} is found in this directory.
  4. *
  5. Otherwise, the files are searched in the application directory * (the folder in which the application code is located).
  6. *
  7. Otherwise, the user's home directory (defined in * {@code "user.home"}) is chosen.
  8. *
* @return home directory */ private static String homePath() { // check for system property String dir = System.getProperty(PATH); if(dir != null) return dir; // not found; check working directory for property file final String home = IO.BASEXSUFFIX + "home"; dir = System.getProperty("user.dir"); File file = new File(dir, home); if(!file.exists()) file = new File(dir, IO.BASEXSUFFIX); if(file.exists()) return file.getParent(); // not found; check application directory dir = applicationPath(); if(dir != null) { file = new File(dir); dir = file.isFile() ? file.getParent() : file.getPath(); file = new File(dir, home); if(!file.exists()) file = new File(dir, IO.BASEXSUFFIX); if(file.exists()) return file.getParent(); } // not found; choose user home directory as default return USERHOME; } /** * Returns the absolute path to this application, or {@code null} if the * path cannot be evaluated. * @return application path. */ private static String applicationPath() { final ProtectionDomain pd = Prop.class.getProtectionDomain(); if(pd == null) return null; // code source (may be null) final CodeSource cs = pd.getCodeSource(); if(cs == null) return null; // location (may be null) final URL url = cs.getLocation(); if(url == null) return null; final String path = url.getPath(); // decode path; URLDecode returns wrong results final TokenBuilder tb = new TokenBuilder(); final int pl = path.length(); for(int p = 0; p < pl; ++p) { final char ch = path.charAt(p); if(ch == '%' && p + 2 < pl) { tb.addByte((byte) Integer.parseInt(path.substring(p + 1, p + 3), 16)); p += 2; } else { tb.add(ch); } } try { // return path, using the correct encoding return new String(tb.finish(), ENCODING); } catch(final Exception ex) { // return default path; not expected to occur Util.stack(ex); return tb.toString(); } } /** * Attaches a directory separator to the specified directory string. * @param dir input string * @return directory string */ private static String dir(final String dir) { return dir.endsWith("\\") || dir.endsWith("/") ? dir : dir + File.separator; } } basex-7.7.2/basex-core/src/main/java/org/basex/core/Text.java000066400000000000000000001445361222453003200237330ustar00rootroot00000000000000package org.basex.core; import static org.basex.core.Lang.*; import java.util.*; import org.basex.core.parse.Commands.*; /** * This class contains internationalized text strings, which are used * throughout the project. If this class is called first, the Strings * are initialized by the {@link Lang} class. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public interface Text { // FREQUENTLY USED CHARACTERS =============================================== /** New line. */ String NL = Prop.NL; /** Colon. */ String COL = ":"; /** Colon/space. */ String COLS = ": "; /** Dot. */ String DOT = "."; /** Dots. */ String DOTS = "..."; /** List. */ String LI = "- "; /** Project namespace. */ String NAMELC = Prop.NAME.toLowerCase(Locale.ENGLISH); /** URL. */ String URL = "http://" + NAMELC + ".org"; /** URL of the community page. */ String COMMUNITY_URL = URL + "/community"; /** URL of the documentation. */ String DOC_URL = "http://docs." + NAMELC + ".org"; /** URL of the update page. */ String UPDATE_URL = URL + "/products/download/all-downloads/"; /** Version URL. */ String VERSION_URL = "http://files." + NAMELC + ".org/version.txt"; /** Mail. */ String MAIL = NAMELC + "-talk@mailman.uni-konstanz.de"; /** Title and version. */ String TITLE = Prop.NAME + ' ' + Prop.VERSION; // CONSOLE INFO ============================================================= /** Local (standalone) mode. */ String LOCALMODE = "Standalone"; /** Start information. */ String LOCALINFO = " [-bcdiLoqsuvVwxz] [input]" + NL + " [input] Execute input file or expression" + NL + " -b Bind external query variables" + NL + " -c Execute commands from file or string" + NL + " -d Activate debugging mode" + NL + " -i Open initial file or database" + NL + " -L Append newlines to query results" + NL + " -o Write output to file" + NL + " -q Execute XQuery expression" + NL + " -s Set serialization parameter(s)" + NL + " -u Write updates back to original files" + NL + " -v/V Show (all) process info" + NL + " -w Preserve whitespaces from input files" + NL + " -x Show query execution plan" + NL + " -z Skip output of results"; /** Client mode. */ String CLIENTMODE = "Client"; /** Client start information. */ String CLIENTINFO = " [-bcdiLnopPqsUvVwxz] [input]" + NL + " [input] Execute input file or expression" + NL + " -b Bind external query variables" + NL + " -c Execute commands from file or string" + NL + " -d Activate debugging mode" + NL + " -i Open initial file or database" + NL + " -L Append newlines to query results" + NL + " -n Set server (host) name" + NL + " -o Write output to file" + NL + " -p Set server port" + NL + " -P Specify user password" + NL + " -q Execute XQuery expression" + NL + " -s Set serialization parameter(s)" + NL + " -U Specify user name" + NL + " -v/V Show (all) process info" + NL + " -w Preserve whitespaces from input files" + NL + " -x Show query execution plan" + NL + " -z Skip output of results"; /** Server mode. */ String SERVERMODE = "Server"; /** Server start information. */ String SERVERINFO = " [-cdeinpSz] [stop]" + NL + " stop Stop running server" + NL + " -c Execute initial database commands" + NL + " -d Activate debugging mode" + NL + " -e Set event port" + NL + " -i Enter interactive mode" + NL + " -n Set host the server is bound to" + NL + " -p Set server port" + NL + " -S Start as service" + NL + " -z Suppress logging"; /** GUI mode. */ String GUIMODE = "GUI"; /** GUI start information. */ String GUIINFO = " [file]" + NL + " [file] Open specified XML or XQuery file"; /** HTTP information. */ String HTTPINFO = " [-dehlnpPsSUz] [stop]" + NL + " stop Stop running server" + NL + " -d Activate debugging mode" + NL + " -e Set event port" + NL + " -h Set port of HTTP server" + NL + " -l Start in local mode" + NL + " -n Set host name of database server" + NL + " -p Set port of database server" + NL + " -P Specify user password" + NL + " -s Specify port to stop HTTP server" + NL + " -S Start as service" + NL + " -U Specify user name" + NL + " -z Suppress logging"; /** Bug info. */ String BUGINFO = "Improper use? Potential bug? Your feedback is welcome:"; /** Console text. */ String CONSOLE = TITLE + " [%]" + NL; /** Console text. */ String TRY_MORE_X = lang("try_more_%", "help") + NL; /** Version information. */ String VERSINFO = lang("version"); /** Goodbye information. */ String[] BYE = { lang("bye1"), lang("bye2"), lang("bye3"), lang("bye4") }; // SERVER =================================================================== /** Server was started. */ String SRV_STARTED_PORT_X = lang("srv_started_port_%"); /** Server was stopped. */ String SRV_STOPPED_PORT_X = lang("srv_stopped_port_%"); /** Server is running or permission was denied. */ String SRV_RUNNING = lang("srv_running"); /** Ports was specified twice. */ String PORT_TWICE_X = lang("port_twice_%"); /** Unknown host. */ String UNKNOWN_HOST_X = lang("unknown_host_x"); /** Timeout exceeded. */ String TIMEOUT_EXCEEDED = lang("timeout_exceeded"); /** Connection error. */ String CONNECTION_ERROR = lang("connection_error"); /** Access denied. */ String ACCESS_DENIED = lang("access_denied"); /** User name. */ String USERNAME = lang("username"); /** Password. */ String PASSWORD = lang("password"); /** Localhost. */ String LOCALHOST = "localhost"; /** User name. */ String[] USERHEAD = { "Username", "Read", "Write", "Create", "Admin" }; /** Default admin user and password. */ String ADMIN = "admin"; /** Option flag. */ String INFOON = lang("ON"); /** Option flag. */ String INFOOFF = lang("OFF"); // COMMANDS ================================================================= /** OK Keyword. */ String OK = "OK"; /** ON flag. */ String ON = "ON"; /** OFF flag. */ String OFF = "OFF"; /** Yes flag. */ String YES = "yes"; /** No flag. */ String NO = "no"; /** True flag. */ String TRUE = "true"; /** False flag. */ String FALSE = "false"; /** Command keyword. */ String C_ALL = "ALL"; /** Command keyword. */ String C_TO = "TO"; /** Command keyword. */ String C_QUERY = "query"; /** Command keyword. */ String C_PATH = "path"; /** Command keyword. */ String C_INPUT = "input"; /** Command keyword. */ String C_NAME = "name"; /** Command keyword. */ String C_PW = "password"; /** Command keyword. */ String C_PKGPATH = "path"; /** Command keyword. */ String C_PKGNAME = "name"; /** Command keyword. */ String C_PKGDIR = "dir"; /** No help available. */ String NOHELP = lang("no_help"); /** Command help. */ String[] HELPCREATE = { "[" + CmdCreate.BACKUP + '|' + CmdCreate.DATABASE + '|' + CmdCreate.EVENT + '|' + CmdCreate.INDEX + '|' + CmdCreate.USER + "] [...]", lang("c_create1"), lang("c_create2") + NL + LI + CmdDrop.BACKUP + " [" + C_NAME + "]:" + NL + " " + lang("c_create4", C_NAME) + NL + LI + CmdCreate.DATABASE + " [" + C_NAME + "] ([" + C_INPUT + "]):" + NL + " " + lang("c_create3", C_NAME, C_INPUT) + NL + LI + CmdCreate.EVENT + " [" + C_NAME + "]: " + NL + " " + lang("c_create9") + NL + LI + CmdCreate.INDEX + " [" + CmdIndex.TEXT + '|' + CmdIndex.ATTRIBUTE + '|' + CmdIndex.FULLTEXT + "]:" + NL + " " + lang("c_create5") + NL + LI + CmdCreate.USER + " [" + C_NAME + "] ([" + C_PW + "]):" + NL + " " + lang("c_create8") }; /** Command help. */ String[] HELPCOPY = { '[' + C_NAME + "] [new" + C_NAME + ']', lang("c_copy1"), lang("c_copy2") }; /** Command help. */ String[] HELPCHECK = { '[' + C_INPUT + ']', lang("c_check1"), lang("c_check2") }; /** Command help. */ String[] HELPADD = { '(' + C_TO + " [" + C_PATH + "]) [" + C_INPUT + ']', lang("c_add1"), lang("c_add2", C_INPUT, C_PATH) }; /** Command help. */ String[] HELPSTORE = { '(' + C_TO + " [" + C_PATH + "]) [" + C_INPUT + ']', lang("c_store1"), lang("c_store2", C_PATH) }; /** Command help. */ String[] HELPRETRIEVE = { '[' + C_PATH + ']', lang("c_retrieve1"), lang("c_retrieve2", C_PATH) }; /** Command help. */ String[] HELPDELETE = { '[' + C_PATH + ']', lang("c_delete1"), lang("c_delete2") }; /** Command help. */ String[] HELPOPEN = { '[' + C_NAME + "] ([" + C_PATH + "])", lang("c_open1"), lang("c_open2", C_NAME, C_PATH) }; /** Command help. */ String[] HELPINFO = { "([" + CmdInfo.DATABASE + '|' + CmdInfo.INDEX + '|' + CmdInfo.STORAGE + "])", lang("c_info1"), lang("c_info21") + NL + LI + lang("c_info22") + NL + LI + CmdInfo.DATABASE + ": " + lang("c_info23") + NL + LI + CmdInfo.INDEX + ": " + lang("c_info24") + NL + LI + CmdInfo.STORAGE + " [start end] | [" + C_QUERY + "]: " + lang("c_info25") }; /** Command help. */ String[] HELPCLOSE = { "", lang("c_close1"), lang("c_close2") }; /** Command help. */ String[] HELPLIST = { "([" + C_NAME + "] ([" + C_PATH + "]))", lang("c_list1"), lang("c_list2", C_NAME, C_PATH) }; /** Command help. */ String[] HELPDROP = { "[" + CmdDrop.BACKUP + '|' + CmdDrop.DATABASE + '|' + CmdDrop.EVENT + '|' + CmdDrop.INDEX + '|' + CmdDrop.USER + "] [...]", lang("c_drop1"), lang("c_drop2") + NL + LI + CmdDrop.BACKUP + " [" + C_NAME + "]:" + NL + " " + lang("c_drop24", C_NAME) + NL + LI + CmdDrop.DATABASE + " [" + C_NAME + "]:" + NL + " " + lang("c_drop21") + NL + LI + CmdDrop.EVENT + " [" + C_NAME + "]:" + NL + " " + lang("c_drop25", C_NAME) + NL + LI + CmdDrop.INDEX + " [" + CmdIndex.TEXT + '|' + CmdIndex.ATTRIBUTE + '|' + CmdIndex.FULLTEXT + "]:" + NL + " " + lang("c_drop22") + NL + LI + CmdDrop.USER + " [" + C_NAME + "] (" + ON + " [database]): " + NL + " " + lang("c_drop23") }; /** Command help. */ String[] HELPEXPORT = { '[' + C_PATH + ']', lang("c_export1"), lang("c_export2", C_PATH) }; /** Command help. */ String[] HELPOPTIMIZE = { '(' + C_ALL + ')', lang("c_optimize1"), lang("c_optimize2", C_ALL) }; /** Command help. */ String[] HELPXQUERY = { '[' + C_QUERY + ']', lang("c_xquery1"), lang("c_xquery2") }; /** Command help. */ String[] HELPFIND = { "[keywords]", lang("c_find1"), lang("c_find2") }; /** Command help. */ String[] HELPFLUSH = { "", lang("c_flush1"), lang("c_flush2") }; /** Command help. */ String[] HELPRUN = { '[' + C_PATH + ']', lang("c_run1"), lang("c_run2", C_PATH) }; /** Command help. */ String[] HELPEXECUTE = { '[' + C_INPUT + ']', lang("c_execute1"), lang("c_execute2", C_PATH) }; /** Command help. */ String[] HELPCS = { '[' + C_QUERY + ']', lang("c_cs1"), lang("c_cs2") }; /** Command help. */ String[] HELPKILL = { '[' + C_NAME + ']', lang("c_kill1"), lang("c_kill2") }; /** Command help. */ String[] HELPRENAME = { '[' + C_PATH + "] [newpath]", lang("c_rename1"), lang("c_rename2") }; /** Command help. */ String[] HELPREPLACE = { '[' + C_PATH + "] [" + C_INPUT + ']', lang("c_replace1"), lang("c_replace2") }; /** Command help. */ String[] HELPRESTORE = { '[' + C_NAME + "-(date)]", lang("c_restore1"), lang("c_restore2") }; /** Command help. */ String[] HELPSHOW = { "[" + CmdShow.BACKUPS + '|' + CmdShow.EVENTS + '|' + CmdShow.SESSIONS + '|' + CmdShow.USERS + ']', lang("c_show1"), lang("c_show21") + NL + LI + CmdShow.EVENTS + ": " + lang("c_show26") + NL + LI + CmdShow.SESSIONS + ": " + lang("c_show23") + NL + LI + CmdShow.USERS + " (" + ON + " [database]): " + lang("c_show24") + NL + LI + CmdShow.BACKUPS + ": " + lang("c_show25") }; /** Command help. */ String[] HELPGRANT = { "[" + CmdPerm.NONE + '|' + CmdPerm.READ + '|' + CmdPerm.WRITE + '|' + CmdPerm.CREATE + '|' + CmdPerm.ADMIN + "] (" + ON + " [database]) " + C_TO + " [user]", lang("c_grant1"), lang("c_grant2") }; /** Command help. */ String[] HELPALTER = { "[" + CmdCreate.DATABASE + '|' + CmdCreate.USER + "] [...]", lang("c_alter1"), lang("c_alter2") + NL + LI + CmdCreate.DATABASE + " [" + C_NAME + "] [newname]" + NL + " " + lang("c_alterdb") + NL + LI + CmdCreate.USER + " [" + C_NAME + "] ([" + C_PW + "]):" + NL + " " + lang("c_alterpw") }; /** Command help. */ String[] HELPINSPECT = { "", lang("c_inspect1"), lang("c_inspect2") }; /** Command help. */ String[] HELPSET = { "[option] ([value])", lang("c_set1", "info"), lang("c_set2", "option", "value") }; /** Command help. */ String[] HELPGET = { "[option]", lang("c_get1", "info"), lang("c_get2", "option") }; /** Command help. */ String[] HELPPASSWORD = { "([" + C_PW + "])", lang("c_password1"), lang("c_password2") }; /** Command help. */ String[] HELPREPO = { "[" + CmdRepo.DELETE + '|' + CmdRepo.INSTALL + '|' + CmdRepo.LIST + ']', lang("c_repo1"), lang("c_repo2") + NL + LI + CmdRepo.DELETE + " [" + C_PKGNAME + '|' + C_PKGDIR + "]:" + NL + " " + lang("c_repo3", C_PKGNAME, C_PKGDIR) + NL + LI + CmdRepo.INSTALL + " [" + C_PKGPATH + "]:" + NL + " " + lang("c_repo4", C_PKGPATH) + NL + LI + CmdRepo.LIST + ':' + NL + " " + lang("c_repo5") }; /** Command help. */ String[] HELPHELP = { "([command])", lang("c_help1", Prop.NAME), lang("c_help2", "command") }; /** Command help. */ String[] HELPEXIT = { "", lang("c_exit1", Prop.NAME), lang("c_exit2", Prop.NAME) }; // COMMAND INFOS ============================================================ /** Command timing information. */ String TIME_NEEDED_X = lang("time_needed") + ": %"; /** Command syntax information. */ String SYNTAX_X = lang("syntax") + ": %"; /** Command execution error. */ String EXEC_ERROR = lang("exec_error_%") + COL + NL + '%'; /** No database error. */ String NO_DB_OPENED = lang("no_db_opened"); /** Main memory error. */ String NO_MAINMEM = lang("no_mainmem"); /** Out of memory error. */ String OUT_OF_MEM = lang("out_of_mem"); /** Progress exception. */ String INTERRUPTED = lang("interrupted"); /** Unknown command error. */ String EXPECTING_CMD = lang("expecting_cmd"); /** Unknown command error. */ String UNKNOWN_CMD_X = lang("unknown_cmd_%"); /** Command syntax information. */ String SINGLE_CMD = lang("single_cmd"); /** Unknown command error. */ String UNKNOWN_TRY_X = UNKNOWN_CMD_X + ' ' + lang("try_%", "HELP"); /** Try "help [...]" to get.. */ String TRY_SPECIFIC_X = lang("try_specific_%", "HELP [...]") + NL; /** Unknown command error. */ String UNKNOWN_SIMILAR_X = UNKNOWN_CMD_X + ' ' + lang("similar_cmd_%"); // CREATE COMMAND =========================================================== /** Create database information. */ String CREATING_DB = lang("creating_db"); /** Create index information. */ String CREATING_INDEXES = lang("creating_indexes"); /** Possible corruption. */ String DB_CORRUPT = lang("db_corrupt"); /** "Command was canceled". */ String COMMAND_CANCELED = lang("command_canceled"); /** Create database information. */ String NODES_PARSED_X = " \"%\" (" + lang("nodes_parsed_%") + ')'; /** Scanner position. */ String SCANPOS_X_X = "\"%\" (" + lang("line") + " %)"; /** Finish database creation. */ String FINISHING_D = lang("finishing") + DOTS; /** Create text index. */ String INDEX_TEXT_D = lang("index_text") + DOTS; /** Create attribute index. */ String INDEX_ATTRIBUTES_D = lang("index_attributes") + DOTS; /** Create full-text index. */ String INDEX_FULLTEXT_D = lang("index_fulltext") + DOTS; /** Database created. */ String DB_CREATED_X_X = lang("db_created_%_%"); /** Path added. */ String PATH_ADDED_X_X = lang("path_added_%_%"); /** Parse error. */ String NOT_PARSED_X = lang("not_parsed_%"); /** Resource not found. */ String RES_NOT_FOUND_X = lang("res_not_found_%"); /** Resource "%" not found. */ String RES_NOT_FOUND = lang("res_not_found"); /** Resource deleted. */ String RES_DELETED_X_X = lang("res_deleted_%_%"); /** Resource renamed. */ String RES_RENAMED_X_X = lang("res_renamed_%_%"); /** Resource replaced. */ String RES_REPLACED_X_X = lang("res_replaced_%_%"); /** "Resource Properties". */ String RES_PROPS = lang("res_props"); /** Skipped corrupt files. */ String SKIPPED = lang("skipped"); /** Info on skipped corrupt files. */ String MORE_SKIPPED_X = lang("more_skipped_%"); /** Missing database name. */ String ENTER_DB_NAME = lang("enter_db_name"); /** No tokenizer found. */ String NO_TOKENIZER_X = lang("no_tokenizer_%"); /** No stemmer found. */ String NO_STEMMER_X = lang("no_stemmer_%"); /** Points to a directory. */ String NO_DIR_ALLOWED_X = lang("no_dir_allowed_%"); // DATABASE COMMANDS ======================================================== /** Database not found. */ String DB_NOT_FOUND_X = lang("db_not_found_%"); /** Name invalid. */ String NAME_INVALID_X = lang("name_invalid_%"); /** Database pinned. */ String DB_PINNED_X = lang("db_pinned_%"); /** Database updated. */ String DB_UPDATED_X = lang("db_updated_%"); /** Database closed. */ String DB_CLOSED_X = lang("db_closed_%"); /** Database optimized. */ String DB_OPTIMIZED_X = lang("db_optimized_%"); /** Database dropped. */ String DB_DROPPED_X = lang("db_dropped_%"); /** Database not dropped. */ String NO_DB_DROPPED = lang("no_db_dropped"); /** Database not dropped. */ String DB_NOT_DROPPED_X = lang("db_not_dropped_%"); /** Database altered. */ String DB_RENAMED_X = lang("db_renamed_%"); /** Database not dropped. */ String DB_NOT_RENAMED_X = lang("db_not_renamed_%"); /** Database flushed. */ String DB_FLUSHED_X = lang("db_flushed_%"); /** Backup of database created. */ String DB_BACKUP_X = lang("db_backup_%"); /** Backup of database not created. */ String DB_NOT_BACKUP_X = lang("db_not_backup_%"); /** Copy of database created. */ String DB_COPIED_X = lang("db_copied_%"); /** Copy of database not created. */ String DB_NOT_COPIED_X = lang("db_not_copied_%"); /** Database restored. */ String DB_RESTORED_X = lang("db_restored_%"); /** Database not restored. */ String DB_NOT_RESTORED_X = lang("db_not_restored_%"); /** Database opened. */ String DB_OPENED_X = lang("db_opened_%"); /** Database exported. */ String DB_EXPORTED_X = lang("db_exported_%"); /** Database not deleted. */ String FILE_NOT_DELETED_X = lang("file_not_deleted_%"); /** Database already exists. */ String DB_EXISTS_X = lang("db_exists_%"); /** Database was dropped. */ String BACKUP_DROPPED_X = lang("backup_dropped_%"); /** Backup was not found. */ String BACKUP_NOT_FOUND_X = lang("backup_not_found_%"); /** File not stored. */ String FILE_NOT_STORED_X = lang("file_not_stored_%"); /** Index created. */ String INDEX_CREATED_X_X = lang("index_created_%_%"); /** Index dropped. */ String INDEX_DROPPED_X_X = lang("index_dropped_%_%"); /** Index not dropped. */ String INDEX_NOT_DROPPED_X = lang("index_not_dropped_%"); /** Index not available. */ String NOT_AVAILABLE = lang("not_available"); // DATABASE/INDEX INFORMATION =============================================== /** Index info. */ String LI_STRUCTURE = LI + "Structure: "; /** Index info. */ String LI_SIZE = LI + "Size: "; /** Index info. */ String LI_ENTRIES = LI + "Entries: "; /** Index info. */ String HASH = "Hash"; /** Index info. */ String FUZZY = "Fuzzy"; /** Index info. */ String SORTED_LIST = "Sorted List"; // XQUERY COMMAND =========================================================== /** Query info: query. */ String QUERY = lang("query"); /** Query info: optimized query. */ String OPTIMIZED_QUERY = lang("optimized_query"); /** Query info: compiling. */ String COMPILING = lang("compiling"); /** Query info: evaluating. */ String EVALUATING = lang("evaluating"); /** Query info: querying. */ String TIMING = lang("timing"); /** Query info: result . */ String RESULT = lang("result"); /** Query info: plan. */ String QUERY_PLAN = lang("query_plan"); /** "Query: ". */ String QUERY_CC = lang("query") + COLS; /** "Parsing: ". */ String PARSING_CC = lang("parsing") + COLS; /** "Compiling: ". */ String COMPILING_CC = lang("compiling") + COLS; /** "Evaluating: ". */ String EVALUATING_CC = lang("evaluating") + COLS; /** "Printing: ". */ String PRINTING_CC = lang("printing") + COLS; /** "Total time: ". */ String TOTAL_TIME_CC = lang("total_time") + COLS; /** "Read locking: ". */ String READ_LOCKING_CC = lang("read_locking") + COLS; /** "Write locking: ". */ String WRITE_LOCKING_CC = lang("write_locking") + COLS; /** "Hit(s): ". */ String HITS_X_CC = lang("hit_s") + COLS; /** "Updated: ". */ String UPDATED_CC = lang("updated") + COLS; /** "Printed: ". */ String PRINTED_CC = lang("printed") + COLS; /** "Results: %". */ String RESULTS_X = lang("results_%"); /** "Query executed in %". */ String QUERY_EXECUTED_X_X = lang("query_executed_%_%"); /** Stopped info. */ String STOPPED_AT = lang("stopped_at") + ' '; /** Line info. */ String LINE_X = lang("line_%"); /** Query hits. */ String ITEM = "Item"; /** Query hits. */ String ITEMS = "Items"; // ADMIN COMMANDS ========================================================== /** Show sessions. */ String SESSIONS_X = lang("sessions_%"); /** Show events. */ String EVENTS_X = lang("events_%"); /** Show packages. */ String PACKAGES_X = lang("packages_%"); /** Permission required. */ String PERM_REQUIRED_X = lang("perm_required_%"); /** Invalid permissions. */ String PERM_UNKNOWN_X = lang("perm_unknown_%"); /** Permission granted. */ String GRANTED_X_X = lang("granted_%_%"); /** Permission granted on database. */ String GRANTED_ON_X_X_X = lang("granted_%_%_%"); /** Unknown user. */ String UNKNOWN_USER_X = lang("unknown_user_%"); /** User dropped. */ String USER_DROPPED_X = lang("user_dropped_%"); /** User dropped from database. */ String USER_DROPPED_X_X = lang("user_dropped_%_%"); /** User is logged in. */ String USER_LOGGED_IN_X = lang("user_logged_in_%"); /** User added. */ String USER_CREATED_X = lang("user_created_%"); /** Password changed. */ String PW_CHANGED_X = lang("pw_changed_%"); /** User unknown. */ String USER_EXISTS_X = lang("user_exists_%"); /** Password is no valid MD5 hash. */ String PW_NOT_VALID = lang("pw_not_valid"); /** Admin user. */ String ADMIN_STATIC_X = lang("admin_static_%"); /** Killed sessions. */ String SESSIONS_KILLED_X = lang("sessions_killed_%"); /** User kills itself. */ String KILL_SELF_X = lang("kill_self_%"); /** Event dropped. */ String EVENT_DROPPED_X = lang("event_dropped_%"); /** Event added. */ String EVENT_CREATED_X = lang("event_created_%"); /** Event not found. */ String EVENT_UNKNOWN_X = lang("event_unknown_%"); /** Already watching the event. */ String EVENT_WATCHED_X = lang("event_watched_%"); /** Nothing to unwatch. */ String EVENT_NOT_WATCHED_X = lang("event_not_watched_%"); /** Event already exists. */ String EVENT_EXISTS_X = lang("event_exists_%"); /** Watch Event. */ String WATCHING_EVENT_X = lang("watching_event_%"); /** Unwatch Event. */ String UNWATCHING_EVENT_X = lang("unwatching_event_%"); /** Package deleted. */ String PKG_DELETED_X = lang("pkg_deleted_%"); /** Package installed. */ String PKG_INSTALLED_X_X = lang("pkg_installed_%_%"); /** Package replaced. */ String PKG_REPLACED_X_X = lang("pkg_replaced_%_%"); // GENERAL COMMANDS ========================================================= /** "Global option '%' cannot be set". */ String GLOBAL_OPTION_X = lang("global_option_%"); /** "Unknown option '%'". */ String UNKNOWN_OPTION_X = lang("unknown_option_%"); /** Unknown command error. */ String UNKNOWN_OPT_SIMILAR_X_X = lang("unknown_option_%") + ' ' + lang("similar_cmd_%"); /** "Unknown parser '%'". */ String UNKNOWN_PARSER_X = lang("unknown_parser_%"); /** Invalid value. */ String INVALID_VALUE_X_X = lang("invalid_value_%_%"); // INFO STRINGS ============================================================= /** Waiting information. */ String PLEASE_WAIT_D = lang("please_wait") + DOTS; /** Statistics information. */ String CREATE_STATS_D = lang("create_stats") + DOTS; /** "Name". */ String ALL = lang("all"); /** "Name". */ String NAME = lang("name"); /** "Size". */ String SIZE = lang("size"); /** "Type". */ String TYPE = lang("type"); /** "Input path". */ String INPUT_PATH = lang("input_path"); /** "Timestamp". */ String TIMESTAMP = lang("timestamp"); /** "Resources". */ String RESOURCES = lang("resources"); /** "Documents". */ String DOCUMENTS = lang("documents"); /** "Binaries". */ String BINARIES = lang("binaries"); /** "Input Size". */ String INPUT_SIZE = lang("input_size"); /** "Encoding". */ String ENCODING = lang("encoding"); /** "Method". */ String METHOD = lang("method"); /** "Parameters". */ String PARAMETERS = lang("parameters"); /** "Path". */ String PATH = lang("path"); /** Command info. */ String REPLACE_ALL = lang("replace_all"); /** Command info. */ String REPLACE_WITH = lang("replace_with"); /** "Match case". */ String MATCH_CASE = lang("match_case"); /** "Whole word". */ String WHOLE_WORD = lang("whole_word"); /** "Multi-line mode". */ String MULTI_LINE = lang("multi_line"); /** "Regular expression". */ String REGULAR_EXPR = lang("regular_expr"); /** "% string(s) found.". */ String STRINGS_FOUND_X = lang("strings_found_%"); /** "Strings were replaced.". */ String STRINGS_REPLACED = lang("strings_replaced"); /** Info on whitespace chopping. */ String WS_CHOPPING = lang("ws_chopping"); /** Info on text indexing. */ String TEXT_INDEX = lang("text_index"); /** Info on attribute indexing. */ String ATTRIBUTE_INDEX = lang("attribute_index"); /** Info on full-text indexing. */ String FULLTEXT_INDEX = lang("fulltext_index"); /** Info on path summary. */ String PATH_INDEX = lang("path_index"); /** Info on up-to-date. */ String UP_TO_DATE = lang("up_to_date"); /** Info on tags. */ String ELEMENTS = lang("elements"); /** Info on attributes. */ String ATTRIBUTES = lang("attributes"); /** Info on namespaces. */ String NAMESPACES = lang("namespaces"); /** Info on index. */ String OUT_OF_DATE = lang("out_of_date"); /** "Database Properties". */ String DB_PROPS = lang("db_props"); /** "General Information". */ String GENERAL_INFO = lang("general_info"); /** "Main Options". */ String MAIN_OPTIONS = lang("main_options"); /** "(chopped)". */ String CHOPPED = "(" + lang("chopped") + ") "; /** "(% entries)". */ String ENTRIES = '(' + lang("entries_%") + ')'; /** "Error". */ String ERROR = lang("error"); /** "Error:". */ String ERROR_C = ERROR + COLS; /** "Fatal:". */ String FATAL_C = "Fatal" + COLS; /** "Warning:". */ String WARNING_C = "Warning" + COLS; // MENU ENTRIES ============================================================= /** "Database". */ String DATABASE = lang("database"); /** "Editor". */ String EDITOR = lang("editor"); /** "View". */ String VIEW = lang("view"); /** "Nodes". */ String NODES = lang("nodes"); /** "Options". */ String OPTIONS = lang("options"); /** "Help". */ String HELP = lang("help"); // GUI COMMANDS ============================================================= /** Command info. */ String ABOUT = lang("about_%", Prop.NAME); /** Command info. */ String CLOSE = lang("close"); /** Command info. */ String GO_TO_LINE = lang("go_to_line"); /** Command info. */ String COLORS = lang("colors"); /** Command info. */ String CUT = lang("cut"); /** Command info. */ String COPY = lang("copy"); /** Command info. */ String SELECT_ALL = lang("select_all"); /** Command info. */ String COPY_PATH = lang("copy_path"); /** Command info. */ String NEW = lang("new"); /** Command info. */ String DELETE = lang("delete"); /** Command info. */ String INSTALL = lang("install"); /** Command info. */ String OPEN_MANAGE = lang("open_manage"); /** Command info. */ String EDIT = lang("edit"); /** Command info. */ String EXIT = lang("exit"); /** Command info. */ String EXPORT = lang("export"); /** Command info. */ String FILTER_SELECTED = lang("filter_selected"); /** Command info. */ String FULLSCREEN = lang("fullscreen"); /** Command info. */ String GO_BACK = lang("go_back"); /** Command info. */ String GO_FORWARD = lang("go_forward"); /** Command info. */ String GO_UP = lang("go_up"); /** Command info. */ String PROPERTIES = lang("properties"); /** Command info. */ String PASTE = lang("paste"); /** Command info. */ String PREFERENCES = lang("preferences"); /** Command info. */ String REDO = lang("redo"); /** Command info. */ String GO_HOME = lang("go_home"); /** Command info. */ String RT_EXECUCTION = lang("rt_execution"); /** Command info. */ String RT_FILTERING = lang("rt_filtering"); /** Command info. */ String BUTTONS = lang("buttons"); /** Command info. */ String EXPLORER = lang("explorer"); /** Command info. */ String FOLDER = lang("folder"); /** Command info. */ String COMMUNITY = lang("community"); /** Command info. */ String CHECK_FOR_UPDATES = lang("check_for_updates"); /** Command info. */ String QUERY_INFO = lang("query_info"); /** Command info. */ String INPUT_BAR = lang("input_bar"); /** Command info. */ String MAP = lang("map"); /** Command info. */ String PLOT = lang("plot"); /** Command info. */ String STATUS_BAR = lang("status_bar"); /** Command info. */ String TABLE = lang("table"); /** Command info. */ String TREE = lang("tree"); /** Command info. */ String UNDO = lang("undo"); /** Command info. */ String OPEN = lang("open"); /** Command info. */ String REOPEN = lang("reopen"); /** Command info. */ String SAVE = lang("save"); /** Command info. */ String SAVE_AS = lang("save_as"); /** Command info. */ String PACKAGES = lang("packages"); /** Command info. */ String FONTS_D = lang("fonts") + DOTS; /** Command info. */ String MAP_LAYOUT_D = lang("map_layout") + DOTS; /** Command info. */ String TREE_OPTIONS_D = lang("tree_options") + DOTS; // BUTTONS ================================================================== /** Button: " OK ". */ String B_OK = " " + lang("ok") + " "; /** Button: " yes ". */ String B_YES = " " + lang("yes") + " "; /** Button: " no ". */ String B_NO = " " + lang("no") + " "; /** Button: "cancel". */ String B_CANCEL = lang("cancel"); /** "Search". */ String SEARCH = lang("search"); /** "Command". */ String COMMAND = lang("command"); /** "XQuery". */ String XQUERY = lang("xquery"); /** "Backup". */ String BACKUP = lang("backup"); /** Button text for deleting files. */ String DROP = lang("drop"); /** Button text for optimization. */ String OPTIMIZE = lang("optimize"); /** Button text for renaming databases. */ String RENAME = lang("rename"); /** Button text for restoring databases. */ String RESTORE = lang("restore"); /** Button text for browsing files/directories. */ String BROWSE_D = lang("browse") + DOTS; /** Button text for creating things. */ String CREATE = lang("create"); /** Button for starting the server. */ String START = lang("start"); /** Button for starting the server. */ String STOP = lang("stop"); /** Button for connecting. */ String CONNECT = lang("connect"); /** Button for disconnecting. */ String DISCONNECT = lang("disconnect"); /** Button for refreshing. */ String REFRESH = lang("refresh"); /** Button for deleting all. */ String DELETE_ALL = lang("delete_all"); /** Button for adding. */ String ADD = lang("add"); /** Button for resetting options. */ String RESET = lang("reset"); /** Clear button. */ String CLEAR = lang("clear"); /** Filter button. */ String FILTER = lang("filter"); // VISUALIZATIONS =========================================================== /** "No data available.". */ String NO_DATA = lang("no_data"); /** "Not enough pixels". */ String NO_PIXELS = lang("no_pixels"); /** "file". */ String FILE = lang("file"); /** "log". */ String PLOTLOG = "log"; // DIALOG WINDOWS =========================================================== /** Open dialog - No database. */ String INFORMATION = lang("information"); /** Dialog title for choosing a directory. */ String CHOOSE_DIR = lang("choose_dir"); /** Dialog title for choosing a file. */ String FILE_OR_DIR = lang("file_or_dir"); /** Use Catalog file Checkbox. */ String USE_CATALOG_FILE = lang("use_catalog_file"); /** Use Catalog file not found on CP. */ String HELP1_USE_CATALOG = lang("help1_use_catalog"); /** Use Catalog file not found on CP. */ String HELP2_USE_CATALOG = lang("help2_use_catalog"); /** Database creation filter. */ String FILE_PATTERNS = lang("file_patterns"); /** Name of database. */ String NAME_OF_DB = lang("name_of_db"); /** Name of database copy. */ String NAME_OF_DB_COPY = lang("name_of_db_copy"); /** Target path. */ String TARGET_PATH = lang("target_path"); /** File description: XML Documents. */ String XML_DOCUMENTS = "XML Documents"; /** File description: XSL Documents. */ String XSL_DOCUMENTS = "XSL Documents"; /** File description: JSON Documents. */ String JSON_DOCUMENTS = "JSON Documents"; /** File description: HTML Documents. */ String HTML_DOCUMENTS = "HTML Documents"; /** File description: Comma-Separated Values. */ String CSV_DOCUMENTS = "Comma-Separated Values"; /** File description: Plain Text. */ String PLAIN_TEXT = "Plain Text"; /** File description: ZIP Archives. */ String ZIP_ARCHIVES = "ZIP Archives"; /** File description: XML Archives. */ String XML_ARCHIVES = "XML Archives"; /** File description: Java archives. */ String JAVA_ARCHIVES = "Java Archives"; /** File description: XQuery files. */ String XQUERY_FILES = "XQuery Files"; /** File description: Command scripts. */ String BXS_FILES = "Command Scripts"; /** "Stack Trace". */ String STACK_TRACE_C = "Stack Trace" + COL; /** Dialog title for database options. */ String CREATE_DATABASE = lang("create_database"); /** Chop whitespaces. */ String CHOP_WS = lang("chop_ws"); /** Strip namespaces. */ String STRIP_NS = lang("strip_ns"); /** DTD information. */ String PARSE_DTDS = lang("parse_dtds"); /** Internal parser. */ String INT_PARSER = lang("int_parser"); /** Parse files inside archives. */ String PARSE_ARCHIVES = lang("parse_archives"); /** Add remaining files as raw files. */ String ADD_RAW_FILES = lang("add_raw_files"); /** "Add Resources". */ String ADD_RESOURCES = lang("add_resources"); /** Skip corrupt files. */ String SKIP_CORRUPT_FILES = lang("skip_corrupt_files"); /** SAX parsing information. */ String INPUT_FORMAT = lang("input_format") + COLS; /** Full-text index information. */ String STEMMING = lang("stemming"); /** Full-text index information. */ String LANGUAGE = lang("language"); /** Full-text index information. */ String CASE_SENSITIVITY = lang("case_sensitivity"); /** Full-text index information. */ String DIACRITICS = lang("diacritics"); /** Full-text index using stopword list. */ String STOPWORD_LIST = lang("stopword_list"); /** JsonML information. */ String PARSE_AS_JSONML = lang("parse_as_jsonml"); /** TEXT Lines information. */ String SPLIT_INPUT_LINES = lang("split_input_lines"); /** CSV header information. */ String FIRST_LINE_HEADER = lang("first_line_header"); /** CSV Separator information. */ String SEPARATOR = lang("separator") + COL; /** General info. */ String GENERAL = lang("general"); /** General info. */ String PARSING = lang("parsing"); /** Name indexes. */ String NAMES = lang("names"); /** Value indexes. */ String INDEXES = lang("indexes"); /** Full-text index. */ String FULLTEXT = lang("fulltext"); /** General info. */ String PARSER_X = lang("parser_%"); /** Dialog asking if a new database should be be created. */ String NEW_DB_QUESTION = lang("no_db_found") + NL + lang("new_db_question"); /** File dialog error. */ String FILE_NOT_OPENED = lang("file_not_opened"); /** File dialog error. */ String FILE_NOT_SAVED = lang("file_not_saved"); /** File dialog replace information. */ String FILE_EXISTS_X = lang("file_exists_%"); /** Dir dialog replace information. */ String FILES_REPLACE_X = lang("files_replace_%"); /** Users. */ String USERS = lang("users"); /** Users. */ String USERS_X = lang("users_%"); /** Confirmation . */ String ARE_YOU_SURE = lang("are_you_sure"); /** Alter password. */ String ALTER_PW = lang("alter_pw"); /** Invalid. */ String INVALID_X = lang("invalid_%"); /** Databases. */ String DATABASES = lang("databases"); /** Databases. */ String DATABASES_X = lang("databases_%"); /** Backups. */ String BACKUPS = lang("backups"); /** Backup(s). */ String BACKUPS_X = lang("backups_%"); /** Line number. */ String LINE_NUMBER = lang("line_number"); /** Dialog title for renaming a database. */ String RENAME_DB = lang("rename_db"); /** Dialog title for copying a database. */ String COPY_DB = lang("copy_db"); /** Info for overwriting a database. */ String OVERWRITE_DB = lang("overwrite_db"); /** Info for creating an empty database. */ String EMPTY_DB = lang("empty_db"); /** Dialog title for managing databases. */ String MANAGE_DB = lang("manage_db"); /** Dialog text for dropping a database. */ String DROPPING_DB_X = lang("dropping_db_%") + NL + ARE_YOU_SURE; /** Database only available as backup. */ String ONLY_BACKUP = lang("only_backup"); /** Dialog text for dropping a backup. */ String DROP_BACKUPS_X = lang("drop_backups_%") + NL + ARE_YOU_SURE; /** Dialog text for dropping a package. */ String DELETE_PACKAGES_X = lang("delete_packages_%") + NL + ARE_YOU_SURE; /** Dialog text for overwriting a backup. */ String OVERWRITE_DB_QUESTION = OVERWRITE_DB + NL + ARE_YOU_SURE; /** Dialog title for deleting nodes. */ String DELETE_NODES = lang("delete_nodes"); /** Dialog title for closing a file. */ String CLOSE_FILE_X = lang("close_file_%"); /** Dialog title for reopening a file. */ String REOPEN_FILE_X = lang("reopen_file_%"); /** Dialog title for exporting nodes. */ String OUTPUT_DIR = lang("output_dir"); /** Dialog title for exporting nodes. */ String DIR_NOT_EMPTY = lang("dir_not_empty"); /** Database path. */ String DATABASE_PATH = lang("database_path"); /** Interactions. */ String GUI_INTERACTIONS = lang("gui_interactions"); /** Look and feel. */ String JAVA_LF = lang("java_lf") + " (" + lang("requires_restart") + ')'; /** Focus. */ String RT_FOCUS = lang("rt_focus"); /** Simple file dialog. */ String SIMPLE_FILE_CHOOSER = lang("simple_file_chooser"); /** Name display flag. */ String SHOW_NAME_ATTS = lang("show_name_atts"); /** Maximum number of hits. */ String MAX_NO_OF_HITS = lang("max_nr_of_hits"); /** Language preference. */ String LANGUAGE_RESTART = lang("language") + " (" + lang("requires_restart") + ')'; /** Dialog title for inserting new data. */ String INSERT_NEW_DATA = lang("insert_new_data"); /** Dialog title for updating document data. */ String EDIT_DATA = lang("edit_data"); /** Insert value. */ String VALUE = lang("value"); /** Dialog title for updating text. */ String EDIT_X = lang("edit_%"); /** Dialog title for updating text. */ String[] NODE_KINDS = { lang("document"), lang("element"), lang("text"), lang("attribute"), lang("comment"), lang("pi") }; /** Dialog title for choosing a font. */ String CHOOSE_FONT = lang("choose_font"); /** Predefined font types. */ String[] FONT_TYPES = { lang("standard"), lang("bold"), lang("italics") }; /** Dialog title for treemap color schema. */ String COLOR_SCHEMA = lang("color_schema"); /** Color schema information. */ String RED = lang("red"); /** Color schema information. */ String GREEN = lang("green"); /** Color schema information. */ String BLUE = lang("blue"); /** Dialog title for treemap design. */ String MAP_LAYOUT = lang("map_layout"); /** Show attributes. */ String SHOW_ATTS = lang("show_atts"); /** Algorithm. */ String ALGORITHM = lang("algorithm"); /** Predefined number of layouts. */ String[] MAP_CHOICES = { lang("map_choice1"), lang("map_choice2"), lang("map_choice3"), lang("map_choice4"), lang("map_choice5") }; /** Predefined number of layouts. */ String[] MAP_LAYOUTS = { "Split", "Strip", "Squarified", "Slice & Dice", "Binary" }; /** Map layout-algorithm. */ String OFFSETS = lang("offsets"); /** Size depending on... */ String RATIO = lang("ratio"); /** Size depending on... */ String CHILDREN_TEXT_LEN = lang("children_text_len"); /** Size depending on... */ String NUMBER_CHILDREN = lang("number_children"); /** Size depending on... */ String TEXT_LENGTH = lang("text_length"); /** Dialog title for tree view options. */ String TREE_OPTIONS = lang("tree_options"); /** Slim rectangles to text length. */ String ADJUST_NODES = lang("adjust_nodes"); /** Info on used main memory. */ String USED_MEM = lang("used_mem"); /** Memory information. */ String TOTAL_MEM_C = lang("total_mem") + COLS; /** Memory information. */ String RESERVED_MEM_C = lang("reserved_mem") + COLS; /** Memory information. */ String MEMUSED_C = USED_MEM + COLS; /** Copyright info. */ String COPYRIGHT = "\u00A9 2005-12 " + Prop.ENTITY; /** License info. */ String LICENSE = lang("license"); /** Developer info. */ String CHIEF_ARCHITECT = lang("chief_architect") + ": " + Prop.AUTHOR; /** Contributors info. */ String TEAM1 = lang("team") + ": " + Prop.TEAM1 + ','; /** Developer names. */ String TEAM2 = Prop.TEAM2; /** Developer names. */ String AND_OTHERS = lang("and_others"); /** Translation. */ String TRANSLATION = lang("translation"); // HELP TEXTS =============================================================== /** Memory help. */ String H_USED_MEM = lang("h_used_mem"); /** Out of memory error due to database creation. */ String H_OUT_OF_MEM = NL + lang("h_out_of_mem"); /** Help string. */ String H_EXECUTE_QUERY = lang("h_execute_query"); /** Help string. */ String H_STOP_PROCESS = lang("h_stop_process"); /** Help string. */ String H_SHOW_HISTORY = lang("h_show_history"); /** Help string. */ String H_SAVE_RESULT = lang("h_save_result"); /** Help string. */ String H_RECENTLY_OPEN = lang("h_recently_open"); /** Command info. */ String H_ABOUT = lang("h_about"); /** Command info. */ String H_CLOSE = lang("h_close"); /** Command info. */ String H_COLORS = lang("h_colors"); /** Command info. */ String H_COPY = lang("h_copy"); /** Command info. */ String H_CPPATH = lang("h_copy_path"); /** Command info. */ String H_NEW = lang("h_new"); /** Command info. */ String H_DELETE = lang("h_delete"); /** Command info. */ String H_OPEN_MANAGE = lang("h_open_manage"); /** Command info. */ String H_PACKAGES = lang("h_packages"); /** Command info. */ String H_EDIT = lang("h_edit"); /** Command info. */ String H_EXIT = lang("h_exit"); /** Command info. */ String H_EXPORT = lang("h_export"); /** Command info. */ String H_FILTER_SELECTED = lang("h_filter_selected"); /** Command info. */ String H_FONTS = lang("h_fonts"); /** Command info. */ String H_FULLSCREEN = lang("h_fullscreen"); /** Command info. */ String H_GO_UP = lang("h_go_up"); /** Command info. */ String H_PROPERTIES = lang("h_properties"); /** Command info. */ String H_NEW_NODE = lang("h_new_node"); /** Command info. */ String H_MAP_LAYOUT = lang("h_map_layout"); /** Command info. */ String H_TREE_OPTIONS = lang("h_tree_options"); /** Command info. */ String H_PASTE = lang("h_paste"); /** Command info. */ String H_PREFERENCES = lang("h_preferences"); /** Command info. */ String H_GO_HOME = lang("h_go_home"); /** Command info. */ String H_RT_EXECUTION = lang("h_rt_execution"); /** Command info. */ String H_RT_FILTERING = lang("h_rt_filtering"); /** Command info. */ String H_BUTTONS = lang("h_buttons"); /** Command info. */ String H_EXPLORER = lang("h_explorer"); /** Command info. */ String H_FOLDER = lang("h_folder"); /** Command info. */ String H_HELP = lang("h_help"); /** Command info. */ String H_COMMUNITY = lang("h_community"); /** Command info. */ String H_UPDATES = lang("h_updates"); /** Command info. */ String H_QUERY_INFO = lang("h_query_info"); /** Command info. */ String H_INPUT_BAR = lang("h_input_bar"); /** Command info. */ String H_MAP = lang("h_map"); /** Command info. */ String H_PLOT = lang("h_plot"); /** Command info. */ String H_STATUS_BAR = lang("h_status_bar"); /** Command info. */ String H_TABLE = lang("h_table"); /** Command info. */ String H_RESULT = lang("h_result"); /** Command info. */ String H_TREE = lang("h_tree"); /** Command info. */ String H_EDITOR = lang("h_editor"); /** Command info. */ String H_NEW_FILE = lang("h_new_file"); /** Command info. */ String H_OPEN_FILE = lang("h_open_file"); /** Command info. */ String H_REOPEN_FILE = lang("h_reopen_file"); /** Command info. */ String H_REPLACE = lang("h_replace"); /** Help string. */ String H_CLOSE_FILE = lang("h_close_file"); /** Help string. */ String H_GO_TO_LINE = lang("h_go_to_line"); /** Command info. */ String H_SAVE = lang("h_save"); /** Information on chopping whitespaces. */ String H_CHOP_WS = lang("h_chop_ws"); /** Internal parser information. */ String H_INT_PARSER = lang("h_int_parser"); /** Path summary information. */ String H_PATH_INDEX = lang("h_path_index"); /** Text index information. */ String H_TEXT_INDEX = lang("h_text_index"); /** Attribute value index information. */ String H_ATTR_INDEX = lang("h_attr_index"); /** Full-text index information. */ String H_FULLTEXT_INDEX = lang("h_fulltext_index"); /** Full-text index information. */ String H_STEMMING = lang("h_stemming"); /** Full-text index information. */ String H_LANGUAGE = lang("h_languauge"); /** Full-text index information. */ String H_CASE = lang("h_case"); /** Full-text index information. */ String H_DIACRITICS = lang("h_diacritics"); /** Full-text index information. */ String H_STOPWORDS = lang("h_stopwords"); /** "Failed to open a browser". */ String H_BROWSER_ERROR_X = lang("h_browser_error_%"); /** Database update. */ String H_DB_FORMAT = lang("h_db_format"); /** Index update. */ String H_INDEX_FORMAT = lang("h_index_format"); /** Dialog title for opening a large database. */ String H_LARGE_DB = lang("h_large_db") + NL + ' '; /** Dialog for downloading a new version. */ String H_NEW_VERSION = lang("h_new_version"); /** HTML Parser. */ String H_HTML_PARSER = lang("h_html_parser"); /** No HTML Parser. */ String H_NO_HTML_PARSER = lang("h_no_html_parser"); // SERVER TEXTS ============================================================= /** Server. */ String S_LOCALSERVER = lang("s_localserver"); /** Users. */ String S_CONNECT = lang("s_connect"); /** Host. */ String S_HOST = lang("s_host"); /** PORT. */ String S_PORT = lang("s_port"); /** Local. */ String S_LOCALPORT = lang("s_localport"); /** Create user. */ String S_CREATEU = lang("s_createu"); /** Global permissions. */ String S_GLOBPERM = lang("s_globperm") + COLS; /** Local permissions. */ String S_LOCPERM = lang("s_locperm") + COLS; /** Question for dropping user. */ String S_DRQUESTION = lang("s_drquestion") + NL + ARE_YOU_SURE; /** Question for revoking right from logged in user. */ String S_DBREVOKE = lang("s_dbrevoke") + NL + ARE_YOU_SURE; /** Login. */ String S_ADLOGIN = lang("s_adlogin"); /** Connected. */ String S_CONNECTED = lang("s_connected"); /** Disconnected. */ String S_DISCONNECTED = lang("s_disconnected"); /** Server information. */ String S_INFO1 = lang("s_info1"); /** Server information. */ String S_INFO2 = lang("s_info2"); /** Sessions. */ String S_SESSIONS = lang("s_sessions"); /** Logs. */ String S_LOCALLOGS = lang("s_locallogs"); /** Button text for altering password. */ String S_ALTER = lang("s_alter") + DOTS; /** Command info. */ String S_SERVER_ADMIN = lang("s_server_admin"); /** Command info. */ String S_H_SERVER_ADMIN = lang("s_h_server_admin"); /** Dummy string to check if all language strings have been assigned. */ String DUMMY = lang(null); } basex-7.7.2/basex-core/src/main/java/org/basex/core/User.java000066400000000000000000000017661222453003200237220ustar00rootroot00000000000000package org.basex.core; import java.util.*; /** * This class contains information on a single user. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class User { /** User name. */ public final String name; /** Password (md5-encoded, lower case). */ public String password; /** Permission. */ public Perm perm; /** * Constructor. * @param n user name * @param p password * @param r rights */ User(final String n, final String p, final Perm r) { name = n; password = p.toLowerCase(Locale.ENGLISH); perm = r; } /** * Tests if the user has the specified permission. * @param p permission to be checked * @return result of check */ public boolean has(final Perm p) { return perm.num >= p.num; } /** * Returns a local copy of this user. * @return user copy */ public User copy() { return new User(name, password, perm.min(Perm.WRITE)); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/Users.java000066400000000000000000000133141222453003200240750ustar00rootroot00000000000000package org.basex.core; import static org.basex.core.Text.*; import static org.basex.util.Token.*; import java.io.*; import java.util.*; import java.util.regex.*; import org.basex.io.*; import org.basex.io.in.DataInput; import org.basex.io.out.DataOutput; import org.basex.util.*; import org.basex.util.list.*; /** * This class organizes all users. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Users { /** User array. */ private final ArrayList list = new ArrayList(0); /** Filename; set to {@code null} if the instance handles local users. */ private IOFile file; /** * Constructor for global users. * @param ctx database context ({@code null} if instance is local) */ public Users(final Context ctx) { if(ctx == null) return; // try to find permission file in database and home directory final String perm = IO.BASEXSUFFIX + "perm"; file = new IOFile(ctx.mprop.dbpath(), perm); if(!file.exists()) file = new IOFile(Prop.HOME, perm); if(!file.exists()) { // define default admin user with all rights list.add(new User(ADMIN, md5(ADMIN), Perm.ADMIN)); } else { DataInput in = null; try { in = new DataInput(file); read(in); } catch(final IOException ex) { Util.errln(ex); } finally { if(in != null) try { in.close(); } catch(final IOException ignored) { } } } } /** * Reads users from disk. * @param in input stream * @throws IOException I/O exception */ public synchronized void read(final DataInput in) throws IOException { final int s = in.readNum(); for(int u = 0; u < s; ++u) { final User user = new User(string(in.readToken()), string(in.readToken()), Perm.get(in.readNum())); list.add(user); } } /** * Writes global permissions to disk. */ public synchronized void write() { if(file == null) return; try { final DataOutput out = new DataOutput(file); write(out); out.close(); } catch(final IOException ex) { Util.debug(ex); } } /** * Stores a user and encrypted password. * @param usern user name * @param pass password * @return success of operation */ public synchronized boolean create(final String usern, final String pass) { // check if user already exists return get(usern) == null && create(new User(usern, pass, Perm.NONE)); } /** * Adds the specified user. * @param user user to be added * @return success of operation */ public synchronized boolean create(final User user) { list.add(user); write(); return true; } /** * Changes the password of a user. * @param usern user name * @param pass password * @return success of operation */ public synchronized boolean alter(final String usern, final String pass) { // check if user already exists final User user = get(usern); if(user == null) return false; user.password = pass.toLowerCase(Locale.ENGLISH); write(); return true; } /** * Drops a user from the list. * @param user user reference * @return success flag */ public synchronized boolean drop(final User user) { if(!list.remove(user)) return false; write(); return true; } /** * Returns a user reference with the specified name. * @param usern user name * @return success of operation */ public synchronized User get(final String usern) { for(final User user : list) if(user.name.equals(usern)) return user; return null; } /** * Returns all users that match the specified pattern. * @param pattern user pattern * @return user list */ public synchronized String[] find(final Pattern pattern) { final StringList sl = new StringList(); for(final User u : list) { if(pattern.matcher(u.name).matches()) sl.add(u.name); } return sl.toArray(); } /** * Writes permissions to disk. * @param out output stream; if set to null, the global rights are written * @throws IOException I/O exception */ public synchronized void write(final DataOutput out) throws IOException { // skip writing of local rights out.writeNum(list.size()); for(final User user : list) { out.writeToken(token(user.name)); out.writeToken(token(user.password)); out.writeNum(user.perm.num); } } /** * Returns information on all users. * @param users optional global user list (for ignoring obsolete local users) * @return user information */ public synchronized Table info(final Users users) { final Table table = new Table(); table.description = USERS_X; final int sz = file == null ? 3 : 5; for(int u = 0; u < sz; ++u) table.header.add(USERHEAD[u]); for(final User user : users(users)) { final TokenList tl = new TokenList(); tl.add(user.name); tl.add(user.has(Perm.READ) ? "X" : ""); tl.add(user.has(Perm.WRITE) ? "X" : ""); if(sz == 5) { tl.add(user.has(Perm.CREATE) ? "X" : ""); tl.add(user.has(Perm.ADMIN) ? "X" : ""); } table.contents.add(tl); } return table.sort().toTop(token(ADMIN)); } /** * Returns all users. * @param users optional second list * @return user information */ public synchronized User[] users(final Users users) { final ArrayList al = new ArrayList(); for(final User user : list) { if(users == null || users.get(user.name) != null) al.add(user); } return al.toArray(new User[al.size()]); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/000077500000000000000000000000001222453003200226725ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/ABackup.java000066400000000000000000000007561222453003200250530ustar00rootroot00000000000000package org.basex.core.cmd; import org.basex.core.*; /** * Abstract class for database backup. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ abstract class ABackup extends Command { /** * Protected constructor. * @param a arguments */ protected ABackup(final String... a) { super(Perm.CREATE, false, a); } @Override public void databases(final LockResult lr) { lr.write.add(DBLocking.BACKUP); // No parallel backup operations } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/ACreate.java000066400000000000000000000100441222453003200250400ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import static org.basex.data.DataText.*; import java.io.*; import org.basex.core.*; import org.basex.data.*; import org.basex.index.*; import org.basex.index.ft.*; import org.basex.index.value.*; import org.basex.io.*; import org.basex.util.*; /** * Abstract class for database creation commands. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class ACreate extends Command { /** Flag for closing a data instances before executing the command. */ private boolean newData; /** * Protected constructor, specifying command arguments. * @param arg arguments */ protected ACreate(final String... arg) { this(Perm.CREATE, false, arg); newData = true; } /** * Protected constructor, specifying command flags and arguments. * @param p required permission * @param d requires opened database * @param arg arguments */ protected ACreate(final Perm p, final boolean d, final String... arg) { super(p, d, arg); } /** * Converts the input (second argument of {@link #args}, or {@link #in} reference) * to an {@link IO} reference. * @param name name of source * @return IO reference * @throws IOException I/O exception */ protected IO sourceToIO(final String name) throws IOException { IO io = null; if(args[1] != null && !args[1].isEmpty()) { io = IO.get(args[1]); } else if(in != null) { if(in.getCharacterStream() != null) { final Reader r = in.getCharacterStream(); final TokenBuilder tb = new TokenBuilder(); try { for(int c; (c = r.read()) != -1;) tb.add(c); } finally { r.close(); } io = new IOContent(tb.finish()); } else if(in.getByteStream() != null) { io = new IOStream(in.getByteStream()); } else if(in.getSystemId() != null) { io = IO.get(in.getSystemId()); } } // update name if not given by the IO reference anyway if(io instanceof IOContent || io instanceof IOStream) { if(name.endsWith("/")) throw new BaseXException(NAME_INVALID_X, name); io.name(name.isEmpty() ? "" : name + '.' + prop.get(Prop.PARSER)); } return io; } /** * Builds the specified index. * @param index index to be built * @param data data reference * @param cmd calling command * @throws IOException I/O exception */ protected static void create(final IndexType index, final Data data, final ACreate cmd) throws IOException { if(data.inMemory()) return; final IndexBuilder ib; switch(index) { case TEXT: ib = new ValueIndexBuilder(data, true); break; case ATTRIBUTE: ib = new ValueIndexBuilder(data, false); break; case FULLTEXT: ib = new FTBuilder(data); break; default: throw Util.notexpected(); } data.closeIndex(index); data.setIndex(index, (cmd == null ? ib : cmd.proc(ib)).build()); } /** * Drops the specified index. * @param index index type * @param data data reference * @return success of operation */ protected static boolean drop(final IndexType index, final Data data) { String pat = null; switch(index) { case TEXT: data.meta.textindex = false; pat = DATATXT; break; case ATTRIBUTE: data.meta.attrindex = false; pat = DATAATV; break; case FULLTEXT: data.meta.ftxtindex = false; pat = DATAFTX; break; default: } data.closeIndex(index); data.meta.dirty = true; return pat == null || data.meta.drop(pat + '.'); } @Override public boolean newData(final Context ctx) { if(newData) new Close().run(ctx); return newData; } @Override public void databases(final LockResult lr) { // default implementation for commands accessing (exclusively) the opened database lr.write.add(DBLocking.CTX); } @Override public final boolean supportsProg() { return true; } @Override public boolean stoppable() { return true; } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/AEvent.java000066400000000000000000000007531222453003200247240ustar00rootroot00000000000000package org.basex.core.cmd; import org.basex.core.*; /** * Abstract class for database events. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ abstract class AEvent extends Command { /** * Protected constructor. * @param a arguments */ protected AEvent(final String... a) { super(Perm.ADMIN, false, a); } @Override public void databases(final LockResult lr) { lr.write.add(DBLocking.EVENT); // Event operations are exclusive } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/AGet.java000066400000000000000000000007151222453003200243600ustar00rootroot00000000000000package org.basex.core.cmd; import org.basex.core.*; /** * Abstract class for option commands. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ abstract class AGet extends Command { /** * Default constructor. * @param p required permission * @param a arguments */ AGet(final Perm p, final String... a) { super(p, a); } @Override public void databases(final LockResult lr) { // No locks needed } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/AInfo.java000066400000000000000000000013371222453003200245350ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import org.basex.core.*; import org.basex.util.*; /** * Abstract class for database info. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ abstract class AInfo extends Command { /** * Protected constructor. * @param d requires opened database * @param a arguments */ AInfo(final boolean d, final String... a) { super(Perm.READ, d, a); } /** * Formats the specified input. * @param tb token builder * @param key key * @param val value */ static void info(final TokenBuilder tb, final Object key, final Object val) { tb.add(' ').add(key.toString()).add(COLS).add(val.toString()).add(NL); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/AQuery.java000066400000000000000000000153051222453003200247470ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import static org.basex.query.util.Err.*; import java.io.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.data.*; import org.basex.io.*; import org.basex.io.out.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * Abstract class for database queries. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class AQuery extends Command { /** Query result. */ protected Result result; /** Query info. */ private final QueryInfo qi = new QueryInfo(); /** Query processor. */ private QueryProcessor qp; /** Query exception. */ private QueryException qe; /** * Protected constructor. * @param p required permission * @param d requires opened database * @param arg arguments */ protected AQuery(final Perm p, final boolean d, final String... arg) { super(p, d, arg); } /** * Evaluates the specified query. * @param query query * @return success flag */ protected final boolean query(final String query) { final Performance p = new Performance(); String err; if(qe != null) { err = qe.getMessage(); } else { try { final boolean serial = prop.is(Prop.SERIALIZE); qi.runs = Math.max(1, prop.num(Prop.RUNS)); long hits = 0; for(int r = 0; r < qi.runs; ++r) { // reuse existing processor instance if(r != 0) qp = null; qp = queryProcessor(query, context); qp.parse(); qi.pars += p.time(); if(r == 0) plan(false); qp.compile(); qi.cmpl += p.time(); if(r == 0) plan(true); final PrintOutput po = r == 0 && serial ? out : new NullOutput(); final Serializer ser; if(prop.is(Prop.CACHEQUERY)) { result = qp.execute(); qi.evlt += p.time(); ser = qp.getSerializer(po); result.serialize(ser); hits = result.size(); } else { hits = 0; final Iter ir = qp.iter(); qi.evlt += p.time(); Item it = ir.next(); ser = qp.getSerializer(po); while(it != null) { checkStop(); ser.serialize(it); it = ir.next(); ++hits; } } ser.close(); qp.close(); qi.srlz += p.time(); } // dump some query info out.flush(); // remove string list if global locking is used and if query is updating if(mprop.is(MainProp.GLOBALLOCK) && qp.updating) qi.readLocked = qi.writeLocked = null; return info(qi.toString(qp, out, hits, prop.is(Prop.QUERYINFO))); } catch(final QueryException ex) { err = Util.message(ex); } catch(final IOException ex) { err = Util.message(ex); } catch(final ProcException ex) { err = INTERRUPTED; } catch(final StackOverflowError ex) { Util.debug(ex); err = BASX_STACKOVERFLOW.desc; } catch(final RuntimeException ex) { extError(""); Util.debug(info()); throw ex; } finally { // close processor after exceptions if(qp != null) qp.close(); } } return extError(err); } /** * Checks if the query might perform updates. * @param ctx database context * @param qu query * @return result of check */ protected final boolean updating(final Context ctx, final String qu) { // keyword found; parse query to get sure try { final Performance p = new Performance(); qp = queryProcessor(qu, ctx); qp.parse(); qi.pars = p.time(); return qp.updating; } catch(final QueryException ex) { Util.debug(ex); qe = ex; qp.close(); return false; } } /** * Performs the first argument as XQuery and returns a node set. */ protected final void queryNodes() { try { result = queryProcessor(args[0], context).queryNodes(); } catch(final QueryException ex) { qp = null; error(Util.message(ex)); } finally { qp.close(); } } /** * Returns a query processor instance. * @param query query string * @param ctx database context * @return query processor */ private QueryProcessor queryProcessor(final String query, final Context ctx) { if(qp == null) qp = proc(new QueryProcessor(query, ctx)); return qp; } /** * Returns an extended error message. * @param err error message * @return result of check */ private boolean extError(final String err) { // will only be evaluated when an error has occurred final StringBuilder sb = new StringBuilder(); if(prop.is(Prop.QUERYINFO)) { sb.append(info()).append(qp.info()).append(NL).append(ERROR_C).append(NL); } sb.append(err); return error(sb.toString()); } /** * Creates query plans. * @param c compiled flag */ private void plan(final boolean c) { if(c != prop.is(Prop.COMPPLAN)) return; // show dot plan BufferOutput bo = null; try { if(prop.is(Prop.DOTPLAN)) { final String path = context.prop.get(Prop.QUERYPATH); final String dot = path.isEmpty() ? "plan.dot" : new IOFile(path).name().replaceAll("\\..*?$", ".dot"); bo = new BufferOutput(dot); final DOTSerializer d = new DOTSerializer(bo, prop.is(Prop.DOTCOMPACT)); d.serialize(qp.plan()); d.close(); if(prop.is(Prop.DOTDISPLAY)) new ProcessBuilder(prop.get(Prop.DOTTY), dot).start(); } // show XML plan if(prop.is(Prop.XMLPLAN)) { info(NL + QUERY_PLAN + COL); info(qp.plan().serialize().toString()); } } catch(final Exception ex) { Util.stack(ex); } finally { if(bo != null) try { bo.close(); } catch(final IOException ignored) { } } } @Override public boolean updating(final Context ctx) { return args[0] != null && updating(ctx, args[0]); } @Override public boolean updated(final Context ctx) { return qp != null && qp.updates() != 0; } @Override public void databases(final LockResult lr) { if(null == qp) lr.writeAll = true; else { qp.databases(lr); qi.readLocked = lr.readAll ? null : lr.read; qi.writeLocked = lr.writeAll ? null : lr.write; } } @Override public void build(final CmdBuilder cb) { cb.init().xquery(0); } @Override public boolean stoppable() { return true; } @Override public final Result result() { final Result r = result; result = null; return r; } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/ARepo.java000066400000000000000000000010321222453003200245370ustar00rootroot00000000000000package org.basex.core.cmd; import org.basex.core.*; /** * Abstract class for repository commands. * * @author BaseX Team 2005-12, BSD License * @author Jens Erat */ abstract class ARepo extends Command { /** * Constructor for repository commands. * @param p required permission * @param arg arguments */ public ARepo(final Perm p, final String... arg) { super(p, arg); } @Override public void databases(final LockResult lr) { lr.write.add(DBLocking.REPO); // Repository commands are exclusive } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/AUser.java000066400000000000000000000057551222453003200245700ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import java.util.regex.*; import org.basex.core.*; import org.basex.io.*; import org.basex.util.list.*; /** * Abstract class for user commands. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ abstract class AUser extends Command { /** * Protected constructor, specifying command arguments. * @param p required permission * @param a arguments */ protected AUser(final Perm p, final String... a) { super(p, a); } /** * Protected constructor, specifying command arguments. * @param a arguments */ protected AUser(final String... a) { this(Perm.ADMIN, a); } /** * Runs the command for all users and databases. * @param off offset for users and optional databases ({@code off + 1}) * @param opt indicates if user/database argument is optional * @return success flag */ protected boolean run(final int off, final boolean opt) { final String u = args[off]; final String d = off + 1 < args.length ? args[off + 1] : null; if(!Databases.validName(u, true)) return error(NAME_INVALID_X, u); if(d != null && !Databases.validName(d, true)) return error(NAME_INVALID_X, d); // retrieve all users; stop if no user is found final String[] users = users(u); if(users.length == 0) return info(UNKNOWN_USER_X, u) && opt; // retrieve all databases StringList dbs = null; if(d != null) { dbs = context.databases.listDBs(d); if(dbs.isEmpty()) return info(DB_NOT_FOUND_X, d) && opt; } // loop through all users boolean ok = true; for(final String user : users) { if(dbs == null) { ok &= run(user, null); } else { for(final String db : dbs) ok &= run(user, db); } } return ok; } /** * Runs the command for the specified user and database. * @param user user to be modified * @param db database to be modified * @return success flag */ @SuppressWarnings("unused") protected boolean run(final String user, final String db) { return true; } /** * Checks if the specified string is a valid MD5 hash value. * @param md5 string to be checked * @return result of check */ protected static boolean isMD5(final String md5) { return md5 != null && md5.matches("[0-9a-fA-F]{32}"); } /** * Returns all users matching the specified glob pattern. * If the specified pattern does not contain any special characters, * it is treated as literal. * @param name user name pattern * @return array with database names */ private String[] users(final String name) { final String pat = name.matches(".*[*?,].*") ? IOFile.regex(name) : name.replaceAll("([" + Databases.REGEXCHARS + "])", "\\\\$1"); return context.users.find(Pattern.compile(pat, Prop.CASE ? 0 : Pattern.CASE_INSENSITIVE)); } @Override public void databases(final LockResult lr) { lr.write.add(DBLocking.ADMIN); // Admin operations are exclusive } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/Add.java000066400000000000000000000121711222453003200242270ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import java.io.*; import org.basex.build.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.data.*; import org.basex.data.atomic.*; import org.basex.io.*; import org.basex.util.*; /** * Evaluates the 'add' command and adds a document to a collection.
* Note that the constructors of this class have changed with Version 7.0: * the target path and file name have been merged and are now specified * as first argument. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Add extends ACreate { /** Builder. */ private Builder build; /** Indicates if database should be locked. */ boolean lock = true; /** * Constructor, specifying a target path. * The input needs to be set via {@link #setInput(InputStream)}. * Note that the constructors of this class have changed with Version 7.0: * the target path and file name have been merged and are now specified * as first argument. * @param path target path, optionally terminated by a new file name */ public Add(final String path) { this(path, null); } /** * Constructor, specifying a target path and an input. * Note that the constructors of this class have changed with Version 7.0: * the target path and file name have been merged and are now specified * as first argument. * @param path target path, optionally terminated by a new file name. * If {@code null}, the name of the input will be set as path. * @param input input file or XML string */ public Add(final String path, final String input) { super(Perm.WRITE, true, path == null ? "" : path, input); } @Override protected boolean run() { String name = MetaData.normPath(args[0]); if(name == null) return error(NAME_INVALID_X, args[0]); // retrieve input final IO io; try { io = sourceToIO(name); } catch(final IOException ex) { return error(Util.message(ex)); } // check if resource exists if(io == null) return error(RES_NOT_FOUND); if(!io.exists()) return in != null ? error(RES_NOT_FOUND) : error(RES_NOT_FOUND_X, context.user.has(Perm.CREATE) ? io : args[1]); if(!name.endsWith("/") && (io.isDir() || io.isArchive())) name += '/'; String target = ""; final int s = name.lastIndexOf('/'); if(s != -1) { target = name.substring(0, s); name = name.substring(s + 1); } final Data data = context.data(); final Parser parser; // set name of document if(!name.isEmpty()) io.name(name); // get name from io reference else name = io.name(); // ensure that the final name is not empty if(name.isEmpty()) return error(NAME_INVALID_X, name); parser = new DirParser(io, prop, data.meta.path); parser.target(target); // create random database name for disk-based creation final boolean cache = cache(parser); final String db = cache ? context.mprop.random(data.meta.name) : name; build = cache ? new DiskBuilder(db, parser, context) : new MemBuilder(db, parser); Data tmp = null; try { tmp = build.build(); // skip update if fragment is empty if(tmp.meta.size > 1) { if(lock && !data.startUpdate()) return error(DB_PINNED_X, data.meta.name); data.insert(data.meta.size, -1, new DataClip(tmp)); context.update(); if(lock) data.finishUpdate(); } // return info message return info(parser.info() + PATH_ADDED_X_X, name, perf); } catch(final IOException ex) { return error(Util.message(ex)); } finally { // close and drop intermediary database instance if(tmp != null) tmp.close(); if(cache) DropDB.drop(db, context); } } /** * Decides if the input should be cached before being written to the final database. * @param parser parser reference * @return result of check */ private boolean cache(final Parser parser) { // main memory mode: never write to disk if(prop.is(Prop.MAINMEM)) return false; // explicit caching if(prop.is(Prop.ADDCACHE)) return true; // create disk instances for large documents // (does not work for input streams and directories) long fl = parser.src.length(); if(parser.src instanceof IOFile) { final IOFile f = (IOFile) parser.src; if(f.isDir()) { for(final String d : f.descendants()) fl += new IOFile(f, d).length(); } } // check free memory final Runtime rt = Runtime.getRuntime(); final long max = rt.maxMemory(); if(fl < (max - rt.freeMemory()) / 2) return false; // if caching may be necessary, run garbage collection and try again Performance.gc(2); return fl > (max - rt.freeMemory()) / 2; } @Override public void build(final CmdBuilder cb) { cb.init().arg(C_TO, 0).arg(1); } @Override protected String tit() { return ADD; } @Override protected double prog() { return build != null ? build.prog() : 0; } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/AlterDB.java000066400000000000000000000044041222453003200250140ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.core.parse.Commands.Cmd; import org.basex.core.parse.Commands.CmdAlter; /** * Evaluates the 'alter database' command and renames a database. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class AlterDB extends ACreate { /** Indicates if current database was closed. */ private boolean closed; /** * Default constructor. * @param db database * @param name new name */ public AlterDB(final String db, final String name) { super(db, name); } @Override protected boolean run() { final String src = args[0]; final String trg = args[1]; // check if names are valid if(!Databases.validName(src)) return error(NAME_INVALID_X, src); if(!Databases.validName(trg)) return error(NAME_INVALID_X, trg); // database does not exist if(!mprop.dbexists(src)) return error(DB_NOT_FOUND_X, src); // target database already exists if(mprop.dbexists(trg)) return error(DB_EXISTS_X, trg); // close database if it's currently opened and not opened by others if(!closed) closed = close(context, src); // check if source database is still opened if(context.pinned(src)) return error(DB_PINNED_X, src); // try to alter database return alter(src, trg, context) && (!closed || new Open(trg).run(context)) ? info(DB_RENAMED_X, src, trg) : error(DB_NOT_RENAMED_X, src); } @Override public void databases(final LockResult lr) { lr.write.add(args); } /** * Renames the specified database. * @param source name of the existing database * @param target new database name * @param ctx database context * @return success flag */ public static synchronized boolean alter(final String source, final String target, final Context ctx) { return ctx.mprop.dbpath(source).rename(ctx.mprop.dbpath(target)); } @Override public boolean newData(final Context ctx) { closed = close(ctx, args[0]); return closed; } @Override public void build(final CmdBuilder cb) { cb.init(Cmd.ALTER + " " + CmdAlter.DB).args(); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/AlterUser.java000066400000000000000000000020511222453003200254410ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.core.parse.Commands.Cmd; import org.basex.core.parse.Commands.CmdAlter; /** * Evaluates the 'alter user' command and alters the password of a user. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class AlterUser extends AUser { /** * Default constructor. * @param name user name * @param pw password */ public AlterUser(final String name, final String pw) { super(name, pw); } @Override protected boolean run() { final String user = args[0]; final String pass = args[1]; if(!Databases.validName(user)) return error(NAME_INVALID_X, user); return !isMD5(pass) ? error(PW_NOT_VALID) : context.users.alter(user, pass) ? info(PW_CHANGED_X, user) : error(UNKNOWN_USER_X, user); } @Override public void build(final CmdBuilder cb) { cb.init(Cmd.ALTER + " " + CmdAlter.USER).args(); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/Check.java000066400000000000000000000044511222453003200245560ustar00rootroot00000000000000package org.basex.core.cmd; import java.io.*; import org.basex.core.*; import org.basex.data.*; import org.basex.io.*; /** * Evaluates the 'check' command: opens an existing database or * creates a new one. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Check extends Command { /** * Default constructor. * @param path file path */ public Check(final String path) { super(Perm.NONE, path); } @Override protected boolean run() { // close existing database new Close().run(context); // get path and database name final QueryInput qi = new QueryInput(args[0]); qi.db = qi.input.dbname(); // choose OPEN if user has no create permissions, or if database exists final Command cmd; if(open(qi)) { cmd = new Open(qi.db); } else { cmd = new CreateDB(qi.db, qi.input.exists() ? qi.original : null); } proc(cmd); // execute command final boolean ok = cmd.run(context); final String msg = cmd.info().trim(); return ok ? info(msg) : error(msg); } /** * Checks if the addressed database can simply be opened, or needs to be (re)built. * @param qi query input * @return result of check */ private boolean open(final QueryInput qi) { // minimum permissions: create if(!context.user.has(Perm.CREATE)) return true; // database with given name does not exist if(!mprop.dbpath(qi.db).exists()) return false; // open database if addressed file does not exist if(!qi.input.exists()) return true; // compare timestamp of database input and specified file final MetaData meta = new MetaData(qi.db, context); try { meta.read(); return meta.time == qi.input.timeStamp(); } catch(final IOException ex) { // rebuild database if it cannot be opened return false; } } @Override public boolean supportsProg() { return true; } @Override public boolean stoppable() { return true; } @Override public void databases(final LockResult lr) { lr.read.add(DBLocking.CTX).add(new QueryInput(args[0]).input.dbname()); } @Override public boolean newData(final Context ctx) { return new Close().run(ctx); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/Close.java000066400000000000000000000016711222453003200246070ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import org.basex.core.*; import org.basex.data.*; /** * Evaluates the 'close' command and closes the current database. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Close extends Command { /** * Default constructor. */ public Close() { super(Perm.NONE); } @Override protected boolean run() { final Data data = context.data(); if(data == null) return true; close(data, context); context.closeDB(); return info(DB_CLOSED_X, data.meta.name); } @Override public void databases(final LockResult lr) { lr.read.add(DBLocking.CTX); } /** * Closes the specified database. * @param data data reference * @param ctx database context */ public static void close(final Data data, final Context ctx) { synchronized(ctx.dbs) { if(ctx.dbs.unpin(data)) data.close(); } } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/Copy.java000066400000000000000000000050611222453003200244510ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import java.io.*; import java.util.regex.*; import org.basex.core.*; import org.basex.io.*; import org.basex.util.*; import org.basex.util.list.*; /** * Evaluates the 'copy' command and creates a copy of a database. * * @author BaseX Team 2005-12, BSD License * @author Andreas Weiler */ public final class Copy extends Command { /** Pattern to exclude locking files from database transfer operations. */ private static final Pattern FILES = Pattern.compile(".{3,5}" + IO.BASEXSUFFIX); /** Counter for outstanding files. */ private int of; /** Counter of total files. */ private int tf; /** * Default constructor. * @param db db name * @param newdb new db name */ public Copy(final String db, final String newdb) { super(Perm.CREATE, db, newdb); } @Override protected boolean run() { final String src = args[0]; final String trg = args[1]; // check if names are valid if(!Databases.validName(src)) return error(NAME_INVALID_X, src); if(!Databases.validName(trg)) return error(NAME_INVALID_X, trg); // source database does not exist if(!mprop.dbexists(src)) return error(DB_NOT_FOUND_X, src); // target database already exists if(mprop.dbexists(trg)) return error(DB_EXISTS_X, trg); // try to copy database return copy(src, trg) ? info(DB_COPIED_X, src, perf) : error(DB_NOT_COPIED_X, src); } /** * Copies the specified database. * @param source name of the database * @param target new database name * @return success flag */ private boolean copy(final String source, final String target) { final IOFile src = mprop.dbpath(source); final IOFile trg = mprop.dbpath(target); // return false if source cannot be opened, or target cannot be created final StringList files = src.descendants(); tf = files.size(); try { for(final String file : files) { if(FILES.matcher(file).matches()) { new IOFile(src, file).copyTo(new IOFile(trg, file)); } of++; } return true; } catch(final IOException ex) { // drop new database if error occurred Util.debug(ex); DropDB.drop(target, context); return false; } } @Override public void databases(final LockResult lr) { lr.read.add(args[0]); lr.write.add(args[1]); } @Override protected String tit() { return COPY; } @Override public boolean supportsProg() { return true; } @Override protected double prog() { return (double) of / tf; } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/CreateBackup.java000066400000000000000000000044111222453003200260660ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import java.io.*; import java.util.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.core.parse.Commands.Cmd; import org.basex.core.parse.Commands.CmdCreate; import org.basex.io.*; import org.basex.util.*; import org.basex.util.list.*; /** * Evaluates the 'backup' command and creates a backup of a database. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class CreateBackup extends ABackup { /** * Default constructor. * @param arg optional argument */ public CreateBackup(final String arg) { super(arg); } @Override protected boolean run() { final String name = args[0]; if(!Databases.validName(name, true)) return error(NAME_INVALID_X, name); // retrieve all databases final StringList dbs = context.databases.listDBs(name); if(dbs.isEmpty()) return error(DB_NOT_FOUND_X, name); // loop through all databases boolean ok = true; for(final String db : dbs) { if(!mprop.dbpath(db).isDir()) continue; if(backup(db)) { // backup was successful info(DB_BACKUP_X, db, perf); } else { info(DB_NOT_BACKUP_X, db); ok = false; } } return ok; } /** * Backups the specified database. * @param db name of the database * @return success flag */ private boolean backup(final String db) { final String backup = db + '-' + DateTime.format(new Date(), DateTime.DATETIME) + IO.ZIPSUFFIX; final IOFile zf = mprop.dbpath(backup); final Zip zip = proc(new Zip(zf)); try { final IOFile path = mprop.dbpath(db); zip.zip(path, path.descendants()); return true; } catch(final IOException ex) { Util.debug(ex); return false; } } @Override public void databases(final LockResult lr) { super.databases(lr); databases(lr.read, 0); } @Override protected String tit() { return BACKUP; } @Override public boolean supportsProg() { return true; } @Override public void build(final CmdBuilder cb) { cb.init(Cmd.CREATE + " " + CmdCreate.BACKUP).args(); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/CreateDB.java000066400000000000000000000157111222453003200251530ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import java.io.*; import org.basex.build.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.core.parse.Commands.*; import org.basex.data.*; import org.basex.index.*; import org.basex.index.ft.*; import org.basex.index.value.*; import org.basex.io.*; import org.basex.io.in.*; import org.basex.util.*; /** * Evaluates the 'create db' command and creates a new database. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class CreateDB extends ACreate { /** Parser instance. */ private Parser parser; /** * Default constructor. * Input can be set via {@link #setInput(InputStream)}. * @param name name of database */ public CreateDB(final String name) { this(name, null); } /** * Constructor, specifying an initial database input. * @param name name of database * @param input input reference (local/remote file or XML string) */ public CreateDB(final String name, final String input) { super(name, input); } /** * Attaches a parser. * @param p input parser */ public void setParser(final Parser p) { parser = p; } @Override protected boolean run() { final String name = args[0]; if(!Databases.validName(name)) return error(NAME_INVALID_X, name); // choose parser and input IO io; try { io = sourceToIO(name); if(in != null) { final LookupInput li = new LookupInput(io.inputStream()); io = li.lookup() == -1 ? null : new IOStream(li, io.name()); } } catch(final IOException ex) { return error(Util.message(ex)); } // create parser instance if(io != null) { if(!io.exists()) return error(RES_NOT_FOUND_X, io); parser = new DirParser(io, prop, mprop.dbpath(name)); } else if(parser == null) { parser = Parser.emptyParser(context.prop); } // close open database new Close().run(context); try { if(prop.is(Prop.MAINMEM)) { // create main memory instance final Data data = proc(new MemBuilder(name, parser)).build(); context.openDB(data); context.dbs.add(data); } else { if(context.pinned(name)) return error(DB_PINNED_X, name); // create disk-based instance proc(new DiskBuilder(name, parser, context)).build().close(); // second step: open database and create index structures final Open open = new Open(name); if(!open.run(context)) return error(open.info()); final Data data = context.data(); try { if(data.meta.createtext) create(IndexType.TEXT, data, this); if(data.meta.createattr) create(IndexType.ATTRIBUTE, data, this); if(data.meta.createftxt) create(IndexType.FULLTEXT, data, this); } finally { data.finishUpdate(); } } if(prop.is(Prop.CREATEONLY)) new Close().run(context); return info(parser.info() + DB_CREATED_X_X, name, perf); } catch(final ProcException ex) { throw ex; } catch(final IOException ex) { abort(); return error(Util.message(ex)); } catch(final Exception ex) { // known exceptions: // - IllegalArgumentException (UTF8, zip files) Util.debug(ex); abort(); return error(NOT_PARSED_X, parser.src); } } @Override public void databases(final LockResult lr) { lr.read.add(DBLocking.CTX); lr.write.add(args[0]); } /** * Returns a database instance from the specified parser. * @param name name of the database * @param parser input parser * @param ctx database context * @return new database instance * @throws IOException I/O exception */ public static synchronized Data create(final String name, final Parser parser, final Context ctx) throws IOException { // check permissions if(!ctx.user.has(Perm.CREATE)) throw new BaseXException(PERM_REQUIRED_X, Perm.CREATE); // create main memory database instance final Prop prop = ctx.prop; if(prop.is(Prop.MAINMEM)) return MemBuilder.build(name, parser); // database is currently locked by another process if(ctx.pinned(name)) throw new BaseXException(DB_PINNED_X, name); // create disk builder, set database path final DiskBuilder builder = new DiskBuilder(name, parser, ctx); // build database and index structures try { final Data data = builder.build(); if(data.meta.createtext) data.setIndex(IndexType.TEXT, new ValueIndexBuilder(data, true).build()); if(data.meta.createattr) data.setIndex(IndexType.ATTRIBUTE, new ValueIndexBuilder(data, false).build()); if(data.meta.createftxt) data.setIndex(IndexType.FULLTEXT, new FTBuilder(data).build()); data.close(); } finally { builder.close(); } return Open.open(name, ctx); } /** * Returns a main memory database instance from the specified parser. * @param parser input parser * @param ctx database context * @return new database instance * @throws IOException I/O exception */ public static synchronized MemData mainMem(final Parser parser, final Context ctx) throws IOException { if(ctx.user.has(Perm.CREATE)) return MemBuilder.build(parser); throw new BaseXException(PERM_REQUIRED_X, Perm.CREATE); } /** * Returns a main memory database instance for the specified input reference. * @param source document source * @param ctx database context * @return new database instance * @throws IOException I/O exception */ public static synchronized MemData mainMem(final IO source, final Context ctx) throws IOException { if(!source.exists()) throw new BaseXException(RES_NOT_FOUND_X, source); return mainMem(new DirParser(source, ctx.prop, null), ctx); } /** * Creates a new database if a valid path was specified. * @param source document source * @param single expect single document * @param ctx database context * @return data reference * @throws IOException I/O exception */ public static synchronized Data create(final IO source, final boolean single, final Context ctx) throws IOException { // check if input is an existing file if(!source.exists() || single && source.isDir()) throw new BaseXException(RES_NOT_FOUND_X, source); // default: create a main memory instance if(!ctx.prop.is(Prop.FORCECREATE)) return CreateDB.mainMem(source, ctx); // otherwise, create a persistent database instance final String nm = source.dbname(); final DirParser dp = new DirParser(source, ctx.prop, ctx.mprop.dbpath(nm)); return CreateDB.create(nm, dp, ctx); } @Override public void build(final CmdBuilder cb) { cb.init(Cmd.CREATE + " " + CmdCreate.DB).args(); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/CreateEvent.java000066400000000000000000000014241222453003200257430ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import org.basex.core.parse.*; import org.basex.core.parse.Commands.*; /** * Evaluates the 'create event' command and creates a new event. * * @author BaseX Team 2005-12, BSD License * @author Roman Raedle * @author Andreas Weiler */ public final class CreateEvent extends AEvent { /** * Default constructor. * @param name user name */ public CreateEvent(final String name) { super(name); } @Override protected boolean run() { final String name = args[0]; return context.events.create(name) ? info(EVENT_CREATED_X, name) : error(EVENT_EXISTS_X, name); } @Override public void build(final CmdBuilder cb) { cb.init(Cmd.CREATE + " " + CmdCreate.EVENT).args(); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/CreateIndex.java000066400000000000000000000037571222453003200257440ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import java.io.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.core.parse.Commands.*; import org.basex.data.*; import org.basex.index.*; import org.basex.util.*; import org.basex.util.ft.*; /** * Evaluates the 'create db' command and creates a new index. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class CreateIndex extends ACreate { /** * Default constructor. * @param type index type, defined in {@link CmdIndex} */ public CreateIndex(final Object type) { super(Perm.WRITE, true, type != null ? type.toString() : null); } @Override protected boolean run() { final Data data = context.data(); if(data.inMemory()) return error(NO_MAINMEM); final IndexType index; final CmdIndex ci = getOption(CmdIndex.class); if(ci == null) return error(UNKNOWN_CMD_X, this); switch(ci) { case TEXT: data.meta.createtext = true; index = IndexType.TEXT; break; case ATTRIBUTE: data.meta.createattr = true; index = IndexType.ATTRIBUTE; break; case FULLTEXT: data.meta.createftxt = true; data.meta.stemming = prop.is(Prop.STEMMING); data.meta.casesens = prop.is(Prop.CASESENS); data.meta.diacritics = prop.is(Prop.DIACRITICS); data.meta.language = Language.get(prop); data.meta.stopwords = prop.get(Prop.STOPWORDS); index = IndexType.FULLTEXT; break; default: return error(UNKNOWN_CMD_X, this); } if(!data.startUpdate()) return error(DB_PINNED_X, data.meta.name); try { create(index, data, this); return info(INDEX_CREATED_X_X, index, perf); } catch(final IOException ex) { return error(Util.message(ex)); } finally { data.finishUpdate(); } } @Override public void build(final CmdBuilder cb) { cb.init(Cmd.CREATE + " " + CmdCreate.INDEX).args(); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/CreateUser.java000066400000000000000000000027551222453003200256100ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.core.parse.Commands.Cmd; import org.basex.core.parse.Commands.CmdCreate; import org.basex.util.*; /** * Evaluates the 'create user' command and creates a new user. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class CreateUser extends AUser { /** * Default constructor. * @param name user name * @param pw password */ public CreateUser(final String name, final String pw) { super(name, pw); } @Override protected boolean run() { try { create(args[0], args[1], context); return info(USER_CREATED_X, args[0]); } catch(final BaseXException ex) { return error(Util.message(ex)); } } @Override public void build(final CmdBuilder cb) { cb.init(Cmd.CREATE + " " + CmdCreate.USER).args(); } /** * Creates a new user. * @param user user name * @param pass password * @param ctx database context * @throws BaseXException database exception */ public static void create(final String user, final String pass, final Context ctx) throws BaseXException { if(!Databases.validName(user)) throw new BaseXException(NAME_INVALID_X, user); if(!isMD5(pass)) throw new BaseXException(PW_NOT_VALID); if(!ctx.users.create(user, pass)) throw new BaseXException(USER_EXISTS_X, user); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/Cs.java000066400000000000000000000011041222453003200240760ustar00rootroot00000000000000package org.basex.core.cmd; import org.basex.core.*; import org.basex.data.*; /** * Evaluates the 'cs' command and sets a new initial context set. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Cs extends AQuery { /** * Default constructor. * @param query query */ public Cs(final String query) { super(Perm.READ, true, query); } @Override protected boolean run() { queryNodes(); if(result == null) return false; if(result.size() != 0) context.current((Nodes) result); return true; } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/Delete.java000066400000000000000000000032061222453003200247400ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import org.basex.core.*; import org.basex.data.*; import org.basex.data.atomic.*; import org.basex.io.*; import org.basex.util.list.*; /** * Evaluates the 'delete' command and deletes resources from a database. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Delete extends ACreate { /** * Default constructor. * @param target target to delete */ public Delete(final String target) { super(Perm.WRITE, true, target); } @Override protected boolean run() { final Data data = context.data(); final String target = args[0]; // start update if(!data.startUpdate()) return error(DB_PINNED_X, data.meta.name); // delete all documents final IntList docs = data.resources.docs(target); final AtomicUpdateList atomics = new AtomicUpdateList(data); for(int d = docs.size() - 1; d >= 0; d--) atomics.addDelete(docs.get(d)); atomics.execute(false); context.update(); // delete binaries final TokenList bins = data.resources.binaries(target); delete(data, target); // finish update data.finishUpdate(); // return info message return info(RES_DELETED_X_X, docs.size() + bins.size(), perf); } /** * Deletes the specified resources. * @param data data reference * @param res resource to be deleted */ public static void delete(final Data data, final String res) { if(data.inMemory()) return; final IOFile file = data.meta.binary(res); if(file != null) file.delete(); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/DropBackup.java000066400000000000000000000034341222453003200255730ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.core.parse.Commands.Cmd; import org.basex.core.parse.Commands.CmdDrop; import org.basex.io.*; import org.basex.util.list.*; /** * Evaluates the 'drop backup' command and deletes backups of a database. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class DropBackup extends ABackup { /** * Default constructor. * @param name name of database */ public DropBackup(final String name) { super(name); } @Override protected boolean run() { final String name = args[0]; if(!Databases.validName(name, true)) return error(NAME_INVALID_X, name); // retrieve all databases final StringList dbs = context.databases.listDBs(name); // loop through all databases and drop backups for(final String db : dbs) drop(db.contains("-") ? db : db + '-', context); // if the given argument is not a database name, it could be the name // of a backup file if(dbs.isEmpty()) drop(name, context); return info(BACKUP_DROPPED_X, name + '*' + IO.ZIPSUFFIX); } /** * Drops one or more backups of the specified database. * @param db database * @param ctx database context * @return number of dropped backups */ private static int drop(final String db, final Context ctx) { final IOFile dir = ctx.mprop.dbpath(); int c = 0; for(final IOFile f : dir.children()) { final String n = f.name(); if(n.startsWith(db) && n.endsWith(IO.ZIPSUFFIX) && f.delete()) c++; } return c; } @Override public void build(final CmdBuilder cb) { cb.init(Cmd.DROP + " " + CmdDrop.BACKUP).args(); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/DropDB.java000066400000000000000000000051701222453003200246520ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.core.parse.Commands.Cmd; import org.basex.core.parse.Commands.CmdDrop; import org.basex.io.*; import org.basex.util.list.*; /** * Evaluates the 'drop database' command and deletes a database. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DropDB extends ACreate { /** * Default constructor. * @param name name of database */ public DropDB(final String name) { super(name); } @Override protected boolean run() { if(!Databases.validName(args[0], true)) return error(NAME_INVALID_X, args[0]); // retrieve all databases; return true if no database is found (no error) final StringList dbs = context.databases.listDBs(args[0]); if(dbs.isEmpty()) return info(NO_DB_DROPPED, args[0]); // loop through all databases boolean ok = true; for(final String db : dbs) { // close database if it's currently opened close(context, db); // check if database is still pinned if(context.pinned(db)) { info(DB_PINNED_X, db); ok = false; } else if(!drop(db, context)) { // dropping was not successful info(DB_NOT_DROPPED_X, db); ok = false; } else { info(DB_DROPPED_X, db); } } return ok; } /** * Deletes the specified database. * @param db name of the database * @param ctx database context * @return success flag */ public static synchronized boolean drop(final String db, final Context ctx) { final IOFile dbpath = ctx.mprop.dbpath(db); return dbpath.exists() && drop(dbpath); } /** * Drops a database directory. * @param path database path * @return success of operation */ public static synchronized boolean drop(final IOFile path) { return path.exists() && path.delete(); } /** * Recursively drops files in database directory with the specified pattern. * @param path database path * @param pat file pattern * @return success of operation */ public static synchronized boolean drop(final IOFile path, final String pat) { boolean ok = true; for(final IOFile f : path.children()) ok &= !f.name().matches(pat) || f.delete(); return ok; } @Override public boolean newData(final Context ctx) { return close(ctx, args[0]); } @Override public void databases(final LockResult lr) { if (!databases(lr.write, 0)) lr.writeAll = true; } @Override public void build(final CmdBuilder cb) { cb.init(Cmd.DROP + " " + CmdDrop.DB).args(); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/DropEvent.java000066400000000000000000000014151222453003200254440ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import org.basex.core.parse.*; import org.basex.core.parse.Commands.*; /** * Evaluates the 'drop event' command and drops an existing event. * * @author BaseX Team 2005-12, BSD License * @author Roman Raedle * @author Andreas Weiler */ public final class DropEvent extends AEvent { /** * Default constructor. * @param name user name */ public DropEvent(final String name) { super(name); } @Override protected boolean run() { final String name = args[0]; return context.events.drop(name) ? info(EVENT_DROPPED_X, name) : error(EVENT_UNKNOWN_X, name); } @Override public void build(final CmdBuilder cb) { cb.init(Cmd.DROP + " " + CmdDrop.EVENT).args(); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/DropIndex.java000066400000000000000000000031431222453003200254320ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.core.parse.Commands.*; import org.basex.data.*; import org.basex.index.*; /** * Evaluates the 'drop index' command and deletes indexes in the currently * opened database. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DropIndex extends ACreate { /** * Constructor. * @param type index type, defined in {@link CmdIndex} */ public DropIndex(final Object type) { super(Perm.WRITE, true, type.toString()); } @Override protected boolean run() { final Data data = context.data(); if(data.inMemory()) return error(NO_MAINMEM); final CmdIndex ci = getOption(CmdIndex.class); if(ci == null) return error(UNKNOWN_CMD_X, this); final IndexType it; switch(ci) { case TEXT: data.meta.createtext = false; it = IndexType.TEXT; break; case ATTRIBUTE: data.meta.createattr = false; it = IndexType.ATTRIBUTE; break; case FULLTEXT: data.meta.createftxt = false; it = IndexType.FULLTEXT; break; default: return error(UNKNOWN_CMD_X, this); } if(!data.startUpdate()) return error(DB_PINNED_X, data.meta.name); try { return drop(it, context.data()) ? info(INDEX_DROPPED_X_X, it, perf) : error(INDEX_NOT_DROPPED_X, it); } finally { data.finishUpdate(); } } @Override public void build(final CmdBuilder cb) { cb.init(Cmd.DROP + " " + CmdDrop.INDEX).args(); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/DropUser.java000066400000000000000000000041311222453003200252770ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import java.io.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.core.parse.Commands.*; import org.basex.data.*; import org.basex.server.*; import org.basex.util.*; /** * Evaluates the 'drop user' command and drops a user. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DropUser extends AUser { /** * Default constructor. * @param name name of user */ public DropUser(final String name) { this(name, null); } /** * Constructor for dropping local database users. * @param name name of user * @param db database (may be {@code null}) */ public DropUser(final String name, final String db) { super(name, db); } @Override protected boolean run() { return run(0, true); } @Override protected boolean run(final String user, final String db) { // admin cannot be dropped if(user.equals(ADMIN)) return !info(ADMIN_STATIC_X); // drop global user if(db == null) { for(final ClientListener s : context.sessions) { if(s.context().user.name.equals(user)) return !info(USER_LOGGED_IN_X, user); } context.users.drop(context.users.get(user)); return info(USER_DROPPED_X, user); } final Data data; try { data = Open.open(db, context); } catch(final IOException ex) { return !info(Util.message(ex), db); } // try to lock database if(!data.startUpdate()) return !info(DB_PINNED_X, data.meta.name); // drop local user if(data.meta.users.drop(data.meta.users.get(user))) { info(USER_DROPPED_X_X, user, db); data.meta.dirty = true; } data.finishUpdate(); Close.close(data, context); return true; } @Override public void databases(final LockResult lr) { super.databases(lr); databases(lr.write, 1); } @Override public void build(final CmdBuilder cb) { cb.init(Cmd.DROP + " " + CmdDrop.USER).arg(0).arg(ON, 1); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/Execute.java000066400000000000000000000046351222453003200251470ustar00rootroot00000000000000package org.basex.core.cmd; import java.util.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.query.*; import org.basex.util.*; /** * Evaluates the 'execute' command and runs a command script. * This command can be used to run multiple commands as a single transaction. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class Execute extends Command { /** Commands to execute. */ protected final ArrayList list = new ArrayList(); /** Error message. */ protected String error; /** * Default constructor. * @param input user input */ public Execute(final String input) { super(Perm.ADMIN, false, input); } @Override public boolean newData(final Context ctx) { return new Close().run(ctx); } @Override public void databases(final LockResult lr) { lr.writeAll = true; } @Override protected boolean run() { try { if(!init(context)) return error(error); final StringBuilder sb = new StringBuilder(); for(final Command c : list) { final boolean ok = proc(c).run(context, out); proc(null); sb.append(c.info()); if(!ok) return error(sb.toString()); } return info(sb.toString().replaceAll("\r?\n?$", "")); } finally { finish(context); } } @Override public boolean updating(final Context ctx) { if(!init(ctx)) return true; for(final Command c : list) { if(!c.updating(ctx)) return true; } return false; } /** * Initializes the specified input. * @param ctx database context * @return success flag */ protected boolean init(final Context ctx) { return init(args[0], ctx); } /** * Initializes the specified input. * @param input command input * @param ctx database context * @return success flag */ protected final boolean init(final String input, final Context ctx) { if(list.isEmpty() && error == null) { try { Collections.addAll(list, new CommandParser(input, ctx).parse()); } catch(final QueryException ex) { error = Util.message(ex); return false; } } return error == null; } /** * Finalizes command execution. * @param ctx database context */ @SuppressWarnings("unused") protected void finish(final Context ctx) { } @Override public void build(final CmdBuilder cb) { cb.init().arg(0); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/Exit.java000066400000000000000000000007371222453003200244550ustar00rootroot00000000000000package org.basex.core.cmd; import org.basex.core.*; /** * Evaluates the 'exit' command and quits the console. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Exit extends Command { /** Constructor. */ public Exit() { super(Perm.NONE); } @Override protected boolean run() { return new Close().run(context); } @Override public void databases(final LockResult lr) { lr.read.add(DBLocking.CTX); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/Export.java000066400000000000000000000076741222453003200250340ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import java.io.*; import java.util.*; import org.basex.core.*; import org.basex.data.*; import org.basex.io.*; import org.basex.io.out.*; import org.basex.io.serial.*; import org.basex.query.value.node.*; import org.basex.util.*; import org.basex.util.list.*; /** * Evaluates the 'export' command and saves the currently opened database * to disk. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Export extends Command { /** Currently exported file. */ private IO progFile; /** Current number of exported file. */ private int progPos; /** Total number of files to be exported. */ private int progSize; /** * Default constructor, specifying a target path. * @param path export path */ public Export(final String path) { super(Perm.CREATE, true, path); } @Override protected boolean run() { try { final Data data = context.data(); export(data, args[0], new SerializerProp(data.meta.prop.get(Prop.EXPORTER)), this); return info(DB_EXPORTED_X, data.meta.name, perf); } catch(final IOException ex) { return error(Util.message(ex)); } } @Override public void databases(final LockResult lr) { lr.read.add(DBLocking.CTX); } /** * Exports the current database to the specified path. * Files and directories in {@code path} will be possibly overwritten. * @param data data reference * @param path directory * @param sp serialization properties * @param e calling instance * @throws IOException I/O exception */ public static void export(final Data data, final String path, final SerializerProp sp, final Export e) throws IOException { final IOFile root = new IOFile(path); root.md(); final HashSet exported = new HashSet(); // XML documents final IntList il = data.resources.docs(); // raw files final IOFile bin; final StringList desc; if(data.inMemory()) { bin = null; desc = new StringList(); } else { bin = data.meta.binaries(); desc = bin.descendants(); } if(e != null) { e.progPos = 0; e.progSize = il.size() + desc.size(); } // XML documents final int is = il.size(); for(int i = 0; i < is; i++) { final int pre = il.get(i); // create file path final IO f = root.merge(Token.string(data.text(pre, true))); if(e != null) { e.checkStop(); e.progFile = f; e.progPos++; } // create dir if necessary final IOFile dir = new IOFile(f.dirPath()); if(!dir.exists()) dir.md(); // serialize file final PrintOutput po = new PrintOutput(unique(exported, f.path())); final Serializer ser = Serializer.get(po, sp); ser.serialize(new DBNode(data, pre)); ser.close(); po.close(); } // export raw files for(final String s : desc) { final IOFile f = new IOFile(root.path(), s); if(e != null) { e.checkStop(); e.progFile = f; e.progPos++; } final String u = unique(exported, f.path()); new IOFile(bin, s).copyTo(new IOFile(u)); } } @Override public double prog() { return progSize == 0 ? 0 : (double) progPos / progSize; } @Override public boolean stoppable() { return true; } @Override public boolean supportsProg() { return true; } @Override public String det() { return progFile == null ? EXPORT : progFile.path(); } /** * Returns a unique file path. * @param exp exported names * @param fp file path * @return unique path */ private static String unique(final HashSet exp, final String fp) { int c = 1; String path = fp; while(exp.contains(path)) { path = fp.indexOf('.') == -1 ? fp + '(' + ++c + ')' : fp.replaceAll("(.*)\\.(.*)", "$1(" + ++c + ").$2"); } exp.add(path); return path; } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/Find.java000066400000000000000000000143741222453003200244260ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import static org.basex.util.Token.*; import org.basex.core.*; import org.basex.query.path.*; import org.basex.util.*; import org.basex.util.list.*; /** * Evaluates the 'find' command and processes a simplified request as XQuery. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Find extends AQuery { /** Start from root node. */ private final boolean root; /** * Default constructor. * @param query simplified query */ public Find(final String query) { this(query, false); } /** * Default constructor. * @param query simplified query * @param rt start from root node */ public Find(final String query, final boolean rt) { super(Perm.NONE, true, query); root = rt; } @Override protected boolean run() { final String query = find(args[0], context, root); final boolean ok = query(query); final StringBuilder sb = new StringBuilder(); if(prop.is(Prop.QUERYINFO)) { sb.append(NL).append(QUERY_CC).append(NL).append(query).append(NL); } sb.append(info()); error(sb.toString()); return ok; } @Override public boolean updating(final Context ctx) { return updating(ctx, find(args[0], ctx, root)); } @Override public void databases(final LockResult lr) { lr.read.add(DBLocking.CTX); } /** * Creates an XQuery representation for the specified query. * @param query query * @param ctx database context * @param root start from root node * @return query */ public static String find(final String query, final Context ctx, final boolean root) { // treat input as XQuery if(query.startsWith("/")) return query; final boolean r = root || ctx.root(); if(query.isEmpty()) return r ? "/" : "."; // parse user input final String qu = query.replaceAll(" \\+", " "); final String[] terms = split(qu); String pre = ""; String preds = ""; final String tag = "*"; for(String term : terms) { if(term.startsWith("@=")) { preds += "[@* = \"" + term.substring(2) + "\"]"; } else if(term.startsWith("=")) { preds += "[text() = \"" + term.substring(1) + "\"]"; } else if(term.startsWith("~")) { preds += "[text() contains text \"" + term.substring(1) + "\" using fuzzy]"; } else if(term.startsWith("@")) { if(term.length() == 1) continue; preds += "[@* contains text \"" + term.substring(1) + "\"]"; term = term.substring(1); // add valid name tests if(XMLToken.isName(token(term))) { pre += (r ? "" : ".") + "//@" + term + " | "; } } else { preds += "[text() contains text \"" + term + "\"]"; // add valid name tests if(XMLToken.isName(token(term))) { pre += (r ? "/" : "") + Axis.DESC + "::*:" + term + " | "; } } } if(pre.isEmpty() && preds.isEmpty()) return root ? "/" : "."; // create final string final TokenBuilder tb = new TokenBuilder(); tb.add(pre + (r ? "/" : "") + Axis.DESCORSELF + "::" + tag + preds); return tb.toString(); } /** * Creates an XQuery representation for the specified table query. * @param filter filter terms * @param cols filter columns * @param elem element flag * @param tag root tag * @param root root flag * @return query */ public static String findTable(final StringList filter, final TokenList cols, final BoolList elem, final byte[] tag, final boolean root) { final TokenBuilder tb = new TokenBuilder(); final int is = filter.size(); for(int i = 0; i < is; ++i) { final String[] spl = split(filter.get(i)); for(final String s : spl) { byte[] term = token(s); if(contains(term, '"')) term = replace(term, '"', ' '); term = trim(term); if(term.length == 0) continue; tb.add('['); final boolean elm = elem.get(i); tb.add(elm ? ".//" : "@"); tb.add("*:"); tb.add(cols.get(i)); if(term[0] == '<' || term[0] == '>') { tb.add(term[0]); tb.addLong(calcNum(substring(term, 1))); } else { tb.add(" contains text \""); tb.add(term); tb.add('"'); } tb.add(']'); } } return tb.isEmpty() ? "/" : (root ? "/" : "") + Axis.DESCORSELF + "::*:" + string(tag) + tb; } /** * Returns an long value for the specified token. The suffixes "kb", "mb" * and "gb" are considered in the calculation. * @param tok token to be converted * @return long */ private static long calcNum(final byte[] tok) { int tl = tok.length; final int s1 = tok.length < 1 ? 0 : lc(tok[tl - 1]); final int s2 = tok.length < 2 ? 0 : lc(tok[tl - 2]); int f = 0; // evaluate suffixes if(s1 == 'k') { tl -= 1; f = 10; } if(s1 == 'm') { tl -= 1; f = 20; } if(s1 == 'g') { tl -= 1; f = 30; } if(s1 == 'b' && s2 == 'k') { tl -= 2; f = 10; } if(s1 == 'b' && s2 == 'm') { tl -= 2; f = 20; } if(s1 == 'b' && s2 == 'g') { tl -= 2; f = 30; } final long i = toLong(tok, 0, tl) << f; return i == Long.MIN_VALUE ? 0 : i; } /** * Splits the string and returns an array. * @param str string to be split * @return array */ private static String[] split(final String str) { final int l = str.length(); final String[] split = new String[l]; int s = 0; char delim = 0; final StringBuilder sb = new StringBuilder(); for(int i = 0; i < l; ++i) { final char c = str.charAt(i); if(delim == 0) { if(c == '\'' || c == '"') { delim = c; } else if(!XMLToken.isChar(c) && c != '@' && c != '=' && c != '<' && c != '>' && c != '~') { if(sb.length() != 0) { split[s++] = sb.toString(); sb.setLength(0); } } else { sb.append(c); } } else { if(c == delim) { delim = 0; if(sb.length() != 0) { split[s++] = sb.toString(); sb.setLength(0); } } else { if(c != '\'' && c != '"') sb.append(c); } } } if(sb.length() != 0) split[s++] = sb.toString(); return Array.copyOf(split, s); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/Flush.java000066400000000000000000000014131222453003200246150ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import org.basex.core.*; import org.basex.data.*; /** * Evaluates the 'flush' command and flushes the database buffers. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Flush extends Command { /** * Default constructor. */ public Flush() { super(Perm.WRITE, true); } @Override protected boolean run() { final Data data = context.data(); if(!prop.is(Prop.AUTOFLUSH)) { prop.set(Prop.AUTOFLUSH, true); data.finishUpdate(); prop.set(Prop.AUTOFLUSH, false); } return info(DB_FLUSHED_X, data.meta.name, perf); } @Override public void databases(final LockResult lr) { lr.write.add(DBLocking.CTX); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/Get.java000066400000000000000000000026241222453003200242600ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import java.io.*; import java.util.*; import org.basex.core.*; /** * Evaluates the 'get' command and return the value of a database property. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Get extends AGet { /** * Empty constructor. */ public Get() { this(null); } /** * Default constructor. * @param key property */ public Get(final Object key) { super(Perm.NONE, key == null ? null : (key instanceof Object[] ? ((Object[]) key)[0] : key).toString() ); } @Override protected boolean run() throws IOException { if(args[0] == null) { // retrieve values of all options if(context.user.has(Perm.ADMIN)) { out.println(MAIN_OPTIONS + COL); for(final String s : mprop) out.println(s + COLS + mprop.get(s)); } out.println(NL + OPTIONS + COL); for(final String s : prop) out.println(s + COLS + prop.get(s)); } else { // retrieve value of specific option final String key = args[0].toUpperCase(Locale.ENGLISH); Object type = prop.get(key); if(type == null && context.user.has(Perm.ADMIN)) type = mprop.get(key); if(type == null) return error(prop.unknown(key)); out.println(key + COLS + type); } return true; } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/Grant.java000066400000000000000000000053621222453003200246160ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import java.io.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.core.parse.Commands.*; import org.basex.data.*; import org.basex.util.*; /** * Evaluates the 'grant' command and grants permissions to users. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Grant extends AUser { /** Permission. */ private Perm perm; /** * Default constructor. * @param permission permission * @param user user name */ public Grant(final Object permission, final String user) { this(permission, user, null); } /** * Constructor, specifying a database. * @param permission permission * @param user user name * @param db database */ public Grant(final Object permission, final String user, final String db) { super(permission.toString(), user, db); } @Override protected boolean run() { // find permission final CmdPerm cmd = getOption(CmdPerm.class); if(cmd == CmdPerm.NONE) { perm = Perm.NONE; } else if(cmd == CmdPerm.READ) { perm = Perm.READ; } else if(cmd == CmdPerm.WRITE) { perm = Perm.WRITE; } else if(cmd == CmdPerm.CREATE && args[2] == null) { perm = Perm.CREATE; } else if(cmd == CmdPerm.ADMIN && args[2] == null) { perm = Perm.ADMIN; } if(perm == null) return error(PERM_UNKNOWN_X, args[0]); return run(1, false); } @Override protected boolean run(final String user, final String db) { // admin cannot be modified if(user.equals(ADMIN)) return !info(ADMIN_STATIC_X); // set global permissions if(db == null) { context.users.get(user).perm = perm; context.users.write(); return info(GRANTED_X_X, args[0], user); } // set local permissions final Data data; try { data = Open.open(db, context); } catch(final IOException ex) { return !info(Util.message(ex)); } // try to lock database if(!data.startUpdate()) return !info(DB_PINNED_X, data.meta.name); User u = data.meta.users.get(user); // add local user reference if(u == null) { u = context.users.get(user).copy(); data.meta.users.create(u); } u.perm = perm; data.meta.dirty = true; data.finishUpdate(); Close.close(data, context); return info(GRANTED_ON_X_X_X, args[0], user, db); } @Override public void databases(final LockResult lr) { super.databases(lr); if (!databases(lr.write, 2)) lr.writeAll = true; } @Override public void build(final CmdBuilder cb) { cb.init().arg(0).arg(ON, 2).arg(C_TO, 1); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/Help.java000066400000000000000000000017341222453003200244320ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import java.io.*; import org.basex.core.*; import org.basex.core.parse.Commands.*; /** * Evaluates the 'help' command and returns help on the database commands. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Help extends Command { /** * Default constructor. * @param arg optional argument */ public Help(final String arg) { super(Perm.NONE, arg); } @Override protected boolean run() throws IOException { final String key = args[0]; if(key != null && !key.isEmpty()) { final Cmd cmd = getOption(key, Cmd.class); if(cmd == null) return error(UNKNOWN_CMD_X, this); out.println(cmd.help(true)); } else { out.println(TRY_SPECIFIC_X); for(final Cmd c : Cmd.values()) out.print(c.help(false)); } return true; } @Override public void databases(final LockResult lr) { // No locks needed } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/Info.java000066400000000000000000000026101222453003200244270ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import java.io.*; import org.basex.core.*; import org.basex.util.*; /** * Evaluates the 'info' command and returns general database information. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Info extends AInfo { /** * Default constructor. */ public Info() { super(false); } @Override protected boolean run() throws IOException { out.print(info(context)); return true; } @Override public void databases(final LockResult lr) { // No locks needed } /** * Creates a database information string. * @param context database context * @return info string */ public static String info(final Context context) { final TokenBuilder tb = new TokenBuilder(); tb.add(GENERAL_INFO + NL); info(tb, VERSINFO, Prop.VERSION); if(context.user.has(Perm.CREATE)) { Performance.gc(2); info(tb, USED_MEM, Performance.getMemory()); } if(context.user.has(Perm.ADMIN)) { final AProp prop = context.mprop; tb.add(NL + MAIN_OPTIONS + NL); for(final String s : prop) info(tb, s, prop.get(s)); } final AProp prop = context.prop; tb.add(NL + OPTIONS + NL); for(final String s : prop) info(tb, s, prop.get(s)); return tb.toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/InfoDB.java000066400000000000000000000056311222453003200246430ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import java.io.*; import java.util.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.core.parse.Commands.*; import org.basex.data.*; import org.basex.util.*; /** * Evaluates the 'info database' command and returns information on the * currently opened database. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class InfoDB extends AInfo { /** * Default constructor. */ public InfoDB() { super(true); } @Override protected boolean run() throws IOException { final boolean create = context.user.has(Perm.CREATE); out.print(db(context.data().meta, false, true, create)); return true; } @Override public void databases(final LockResult lr) { lr.read.add(DBLocking.CTX); } /** * Creates a database information string. * @param meta meta data * @param bold header bold header flag * @param index add index information * @param create create permissions * @return info string */ public static String db(final MetaData meta, final boolean bold, final boolean index, final boolean create) { final TokenBuilder tb = new TokenBuilder(); final String header = (bold ? new TokenBuilder().bold().add('%').norm().toString() : "%") + NL; tb.addExt(header, DB_PROPS); info(tb, NAME, meta.name); info(tb, SIZE, Performance.format(meta.dbsize())); info(tb, NODES, meta.size); // count number of raw files info(tb, DOCUMENTS, meta.ndocs); final int b = meta.path != null ? meta.binaries().descendants().size() : 0; info(tb, BINARIES, b); info(tb, TIMESTAMP, DateTime.format(new Date(meta.dbtime()), DateTime.DATETIME)); if(meta.corrupt) tb.add(' ' + DB_CORRUPT + NL); tb.add(NL).addExt(header, RES_PROPS); if(create && !meta.original.isEmpty()) info(tb, INPUT_PATH, meta.original); if(meta.filesize != 0) info(tb, INPUT_SIZE, Performance.format(meta.filesize)); info(tb, TIMESTAMP, DateTime.format(new Date(meta.time), DateTime.DATETIME)); info(tb, ENCODING, meta.encoding); info(tb, WS_CHOPPING, Util.flag(meta.chop)); if(index) { tb.add(NL).addExt(header, INDEXES); if(meta.oldindex()) { tb.add(' ' + H_INDEX_FORMAT + NL); } else { info(tb, UP_TO_DATE, meta.uptodate); info(tb, TEXT_INDEX, Util.flag(meta.textindex)); info(tb, ATTRIBUTE_INDEX, Util.flag(meta.attrindex)); info(tb, FULLTEXT_INDEX, Util.flag(meta.ftxtindex)); info(tb, Prop.UPDINDEX[0], Util.flag(meta.updindex)); info(tb, Prop.MAXCATS[0], meta.maxcats); info(tb, Prop.MAXLEN[0], meta.maxlen); } } return tb.toString(); } @Override public void build(final CmdBuilder cb) { cb.init(Cmd.INFO + " " + CmdInfo.DB); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/InfoIndex.java000066400000000000000000000060351222453003200254240ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import java.io.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.core.parse.Commands.*; import org.basex.data.*; import org.basex.index.*; import org.basex.util.*; /** * Evaluates the 'info index' command and returns information on the indexes * of the currently opened database. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class InfoIndex extends AInfo { /** * Default constructor. */ public InfoIndex() { this(null); } /** * Default constructor. * @param type optional index type, defined in {@link CmdIndexInfo} */ public InfoIndex(final Object type) { super(true, type != null && type != CmdIndexInfo.NULL ? type.toString() : null); } @Override protected boolean run() throws IOException { final Data data = context.data(); if(args[0] != null) { final CmdIndexInfo ci = getOption(CmdIndexInfo.class); if(ci == null) return error(UNKNOWN_CMD_X, this); final byte[] inf = info(ci, data); out.print(inf); return inf.length != 0; } final TokenBuilder tb = new TokenBuilder(); tb.add(info(CmdIndexInfo.TAG, data)); tb.add(info(CmdIndexInfo.ATTNAME, data)); tb.add(info(CmdIndexInfo.TEXT, data)); tb.add(info(CmdIndexInfo.ATTRIBUTE, data)); tb.add(info(CmdIndexInfo.FULLTEXT, data)); tb.add(info(CmdIndexInfo.PATH, data)); out.print(tb.finish()); return true; } @Override public void databases(final LockResult lr) { lr.read.add(DBLocking.CTX); } /** * Prints information on the specified index. * @param idx index type * @param data data reference * @return success flag */ private static byte[] info(final CmdIndexInfo idx, final Data data) { switch(idx) { case TAG: return info(ELEMENTS, IndexType.TAG, data, true); case ATTNAME: return info(ATTRIBUTES, IndexType.ATTNAME, data, true); case PATH: return info(PATH_INDEX, IndexType.PATH, data, true); case TEXT: return info(TEXT_INDEX, IndexType.TEXT, data, data.meta.textindex); case ATTRIBUTE: return info(ATTRIBUTE_INDEX, IndexType.ATTRIBUTE, data, data.meta.attrindex); case FULLTEXT: return info(FULLTEXT_INDEX, IndexType.FULLTEXT, data, data.meta.ftxtindex); default: return Token.token(LI + NOT_AVAILABLE); } } /** * Returns the specified index information. * @param ds index description * @param it index type * @param data data reference * @param avl states if index is available * @return information */ private static byte[] info(final String ds, final IndexType it, final Data data, final boolean avl) { final TokenBuilder tb = new TokenBuilder(ds).add(NL); if(avl) tb.add(data.info(it)); else tb.add(LI).addExt(NOT_AVAILABLE, it).add(NL); return tb.add(NL).finish(); } @Override public void build(final CmdBuilder cb) { cb.init(Cmd.INFO + " " + CmdInfo.INDEX).args(); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/InfoStorage.java000066400000000000000000000077551222453003200257730ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import static org.basex.data.DataText.*; import static org.basex.util.Token.*; import java.io.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.core.parse.Commands.*; import org.basex.data.*; import org.basex.util.*; import org.basex.util.list.*; /** * Evaluates the 'info storage' command and returns the table representation * of the currently opened database. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class InfoStorage extends AQuery { /** * Default constructor. * @param arg optional arguments */ public InfoStorage(final String... arg) { super(Perm.READ, true, arg.length > 0 && arg[0] != null && !arg[0].isEmpty() ? arg[0] : null, arg.length > 1 ? arg[1] : null); } @Override protected boolean run() throws IOException { // get arguments final String start = args[0]; final String end = args[1]; // evaluate input as number range or xquery if(start != null && toInt(start) == Integer.MIN_VALUE) { queryNodes(); if(result == null) return false; } final Data data = context.data(); if(result != null) { final Table table = th(); for(final int n : ((Nodes) result).pres) table(table, data, n); out.print(table.finish()); result = null; } else { int ps = 0; int pe = 1000; if(start != null) { if(end != null) { ps = toInt(start); pe = toInt(end) + 1; } else { ps = toInt(start); pe = ps + 1; } } out.print(table(data, ps, pe)); } return true; } @Override public void databases(final LockResult lr) { lr.read.add(DBLocking.CTX); } /** * Prints the specified range of the table. * @param data data reference * @param s first node to be printed * @param e last node to be printed * @return table */ public static byte[] table(final Data data, final int s, final int e) { final TokenBuilder tb = new TokenBuilder(); final int ps = Math.max(0, s); final int pe = Math.min(data.meta.size, e); final Table table = th(); for(int p = ps; p < pe; ++p) table(table, data, p); tb.add(table.finish()); final byte[] ns = data.nspaces.table(ps, pe); if(ns.length != 0) tb.add(NL).add(ns).add(data.nspaces.toString(ps, pe)).add(NL); return tb.finish(); } /** * Writes the header for the 'table' command. * @return table */ private static Table th() { final Table t = new Table(); t.header.add(TABLEPRE); t.header.add(TABLEDIST); t.header.add(TABLESIZE); t.header.add(TABLEATS); t.header.add(TABLEID); t.header.add(TABLENS); t.header.add(TABLEKND); t.header.add(TABLECON); for(int i = 0; i < 6; ++i) t.align.add(true); return t; } /** * Writes the entry for the specified pre value to the table. * @param t table reference * @param data data reference * @param p node to be printed */ private static void table(final Table t, final Data data, final int p) { final int k = data.kind(p); final TokenList tl = new TokenList(); tl.add(p); tl.add(p - data.parent(p, k)); tl.add(data.size(p, k)); tl.add(data.attSize(p, k)); tl.add(data.id(p)); final int u = data.uri(p, k); if(data.nsFlag(p)) tl.add("+" + u); else tl.add(u); tl.add(TABLEKINDS[k]); final byte[] cont; if(k == Data.ELEM) { cont = data.name(p, k); } else if(k == Data.ATTR) { cont = new TokenBuilder(data.name(p, k)).add(ATT1).add( data.text(p, false)).add(ATT2).finish(); } else { cont = data.text(p, true); } tl.add(replace(chop(cont, 64), '\n', ' ')); t.contents.add(tl); } @Override public void build(final CmdBuilder cb) { cb.init(Cmd.INFO + " " + CmdInfo.STORAGE); if(args[0] != null && toInt(args[0]) == Integer.MIN_VALUE) { cb.xquery(0); } else { cb.arg(0).arg(1); } } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/Inspect.java000066400000000000000000000061131222453003200251430ustar00rootroot00000000000000package org.basex.core.cmd; import java.io.*; import org.basex.core.*; import org.basex.data.*; import org.basex.util.*; /** * Evaluates the 'inspect' command: checks if the currently opened database has * inconsistent data structures. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Inspect extends Command { /** * Default constructor. */ public Inspect() { super(Perm.READ, true); } @Override protected boolean run() throws IOException { final Data data = context.data(); out.print(inspect(data)); return info("'%' inspected in %.", data.meta.name, perf); } @Override public void databases(final LockResult lr) { lr.read.add(DBLocking.CTX); } /** * Inspects the database structures. * @param data data * @return info string */ public static String inspect(final Data data) { final MetaData md = data.meta; final Check invKind = new Check(); final Check parRef = new Check(); final Check parChild = new Check(); final Check idPre = md.updindex ? new Check() : null; // loop through all database nodes for(int pre = 0; pre < md.size; pre++) { // check node kind final int kind = data.kind(pre); if(kind > 6) invKind.add(pre); // check parent reference final int par = data.parent(pre, kind); if(par >= 0) { final int parKind = data.kind(par); if(par >= pre || (kind == Data.DOC ? par != -1 : par < 0)) parRef.add(pre); // check if parent is no doc and no element, or if node is a descendant // of its parent node if(parKind != Data.DOC && parKind != Data.ELEM || par + data.size(par, parKind) < pre) parChild.add(pre); } // check if id/pre mapping is correct if(idPre != null && data.pre(data.id(pre)) != pre) idPre.add(pre); } final TokenBuilder info = new TokenBuilder(); info.addExt("Checking main table (% nodes):", md.size).add(Prop.NL); info.add(invKind.info("invalid node kinds")); info.add(parRef.info("invalid parent references")); info.add(parChild.info("wrong parent/descendant relationships")); if(idPre != null) info.add(idPre.info("wrong id/pre mappings")); if(invKind.invalid + parRef.invalid + parChild.invalid == 0) { info.add("No inconsistencies found.").add(Prop.NL); } else { info.add("Warning: Database is inconsistent.").add(Prop.NL); } return info.toString(); } /** Contains information on single check. */ static final class Check { /** Number of invalid. */ int invalid; /** First invalid hit. */ int first = -1; /** * Adds an entry. * @param pre pre value */ void add(final int pre) { invalid++; if(first == -1) first = pre; } /** * Prints check information. * @param info info label * @return info string */ String info(final String info) { final StringBuilder sb = new StringBuilder("- % " + info); if(invalid > 0) sb.append(" (pre: %,..)"); return Util.info(sb, invalid, first) + Prop.NL; } } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/Kill.java000066400000000000000000000032671222453003200244400ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import org.basex.core.*; import org.basex.server.*; /** * Evaluates the 'kill' command and stops user sessions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Kill extends AUser { /** Number of modifications. */ private int count; /** * Default constructor. * @param user user to kill */ public Kill(final String user) { super(user); } @Override protected boolean run() { if(!run(0, false) || count == 0) { error(DBLocking.CTX); // kill all sessions with the specified IP (and optional port) final Sessions ss = context.sessions; final String arg = args[0]; for(int s = ss.size() - 1; s >= 0; --s) { final ClientListener cl = ss.get(s); final String cs = cl.toString().replaceAll("\\[|\\]", ""); if(cl.context() == context) { // show error if own session is addressed if(cs.equals(arg)) return error(KILL_SELF_X, arg); } else if(cs.startsWith(arg)) { info(LI + cs); cl.quit(); count++; } } } return info(SESSIONS_KILLED_X, count); } @Override protected boolean run(final String user, final String db) { // kill all sessions of the specified user final Sessions ss = context.sessions; for(int s = ss.size() - 1; s >= 0; --s) { final ClientListener cl = ss.get(s); // don't kill own sessions if(cl.context() != context && user.equals(cl.context().user.name)) { cl.quit(); count++; } } return true; } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/List.java000066400000000000000000000107531222453003200244560ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import static org.basex.data.DataText.*; import static org.basex.util.Token.*; import java.io.*; import org.basex.core.*; import org.basex.data.*; import org.basex.index.resource.*; import org.basex.io.*; import org.basex.util.*; import org.basex.util.list.*; /** * Evaluates the 'list' command and shows all available databases. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class List extends Command { /** * Default constructor. */ public List() { this(null); } /** * Default constructor. * @param name database name */ public List(final String name) { this(name, null); } /** * Default constructor. * @param name database name * @param path database path */ public List(final String name, final String path) { super(Perm.NONE, name, path); } @Override protected boolean run() throws IOException { return args[0] == null || args[0].isEmpty() ? list() : listDB(); } @Override public void databases(final LockResult lr) { lr.readAll = true; } /** * Lists all databases. * @return success flag * @throws IOException I/O exception */ private boolean list() throws IOException { final Table table = new Table(); table.description = DATABASES_X; final boolean create = context.user.has(Perm.CREATE); table.header.add(T_NAME); table.header.add(RESOURCES); table.header.add(SIZE); if(create) table.header.add(INPUT_PATH); for(final String name : context.databases.listDBs()) { String file = null; long size = 0; int docs = 0; final MetaData meta = new MetaData(name, context); try { meta.read(); size = meta.dbsize(); docs = meta.ndocs; if(context.perm(Perm.READ, meta)) file = meta.original; } catch(final IOException ex) { file = ERROR; } // count number of raw files final IOFile dir = new IOFile(mprop.dbpath(name), M_RAW); final int bin = dir.descendants().size(); // create entry if(file != null) { final TokenList tl = new TokenList(4); tl.add(name); tl.add(docs + bin); tl.add(size); if(create) tl.add(file); table.contents.add(tl); } } out.println(table.sort().finish()); return true; } /** * Lists resources of the specified database. * @return success flag * @throws IOException I/O exception */ private boolean listDB() throws IOException { final String db = args[0]; final String path = args[1] != null ? args[1] : ""; if(!Databases.validName(db)) return error(NAME_INVALID_X, db); final Table table = new Table(); table.description = RESOURCES; table.header.add(INPUT_PATH); table.header.add(TYPE); table.header.add(MimeTypes.CONTENT_TYPE); table.header.add(SIZE); try { // add xml documents final Data data = Open.open(db, context); final Resources res = data.resources; final IntList il = res.docs(path); final int ds = il.size(); for(int i = 0; i < ds; i++) { final int pre = il.get(i); final TokenList tl = new TokenList(3); final byte[] file = data.text(pre, true); tl.add(file); tl.add(DataText.M_XML); tl.add(MimeTypes.APP_XML); tl.add(data.size(pre, Data.DOC)); table.contents.add(tl); } // add binary resources for(final byte[] file : res.binaries(path)) { final String f = string(file); final TokenList tl = new TokenList(3); tl.add(file); tl.add(DataText.M_RAW); tl.add(MimeTypes.get(f)); tl.add(data.meta.binary(f).length()); table.contents.add(tl); } Close.close(data, context); } catch(final IOException ex) { return error(Util.message(ex)); } out.println(table.sort().finish()); return true; } /** * Returns a list of all databases. * @param ctx database context * @return list of databases */ public static StringList list(final Context ctx) { final StringList db = new StringList(); for(final IOFile f : ctx.mprop.dbpath().children()) { final String name = f.name(); if(f.isDir() && !name.startsWith(".")) db.add(name); } return db.sort(false); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/Open.java000066400000000000000000000036361222453003200244460ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import java.io.*; import org.basex.core.*; import org.basex.data.*; import org.basex.util.*; /** * Evaluates the 'open' command and opens a database. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Open extends Command { /** * Default constructor. * @param name name of database */ public Open(final String name) { super(Perm.NONE, name); } @Override protected boolean run() { // close existing database new Close().run(context); final String db = args[0]; if(!Databases.validName(db)) return error(NAME_INVALID_X, db); try { final Data data = open(db, context); context.openDB(data); if(data.meta.oldindex()) info(H_INDEX_FORMAT); if(data.meta.corrupt) info(DB_CORRUPT); return info(DB_OPENED_X, db, perf); } catch(final IOException ex) { return error(Util.message(ex)); } } @Override public void databases(final LockResult lr) { lr.read.add(DBLocking.CTX).add(args[0]); } @Override public boolean newData(final Context ctx) { return new Close().run(ctx); } /** * Opens the specified database. * @param name name of database * @param ctx database context * @return data reference * @throws IOException I/O exception */ public static Data open(final String name, final Context ctx) throws IOException { synchronized(ctx.dbs) { Data data = ctx.dbs.pin(name); if(data == null) { // check if database exists if(!ctx.mprop.dbexists(name)) throw new BaseXException(DB_NOT_FOUND_X, name); data = new DiskData(name, ctx); ctx.dbs.add(data); } // check permissions if(!ctx.perm(Perm.READ, data.meta)) { Close.close(data, ctx); throw new BaseXException(PERM_REQUIRED_X, Perm.READ); } return data; } } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/Optimize.java000066400000000000000000000101751222453003200253410ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import java.io.*; import org.basex.core.*; import org.basex.data.*; import org.basex.index.*; import org.basex.util.*; import org.basex.util.list.*; /** * Evaluates the 'optimize' command and optimizes the data structures of * the currently opened database. Indexes and statistics are refreshed, * which is especially helpful after updates. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Optimize extends ACreate { /** Current pre value. */ private int pre; /** Data size. */ private int size; /** * Default constructor. */ public Optimize() { super(Perm.WRITE, true); } @Override protected boolean run() { final Data data = context.data(); final MetaData m = data.meta; size = m.size; if(!data.startUpdate()) return error(DB_PINNED_X, data.meta.name); try { optimize(data, false, this); return info(DB_OPTIMIZED_X, m.name, perf); } catch(final IOException ex) { return error(Util.message(ex)); } finally { data.finishUpdate(); } } @Override public double prog() { return (double) pre / size; } @Override public boolean stoppable() { return false; } @Override public String det() { return CREATE_STATS_D; } /** * Optimizes the structures of a database. * @param data data * @param rebuild rebuild all index structures * @param cmd calling command instance (can be {@code null}) * @throws IOException I/O Exception during index rebuild */ public static void optimize(final Data data, final boolean rebuild, final Optimize cmd) throws IOException { // initialize structural indexes final MetaData md = data.meta; if(!md.uptodate) { data.paths.init(); data.resources.init(); data.tagindex.init(); data.atnindex.init(); md.dirty = true; final IntList pars = new IntList(); final IntList tags = new IntList(); int n = 0; for(int pre = 0; pre < md.size; ++pre) { final byte kind = (byte) data.kind(pre); final int par = data.parent(pre, kind); while(!pars.isEmpty() && pars.peek() > par) { pars.pop(); tags.pop(); } final int level = pars.size(); if(kind == Data.DOC) { data.paths.put(0, kind, level); pars.push(pre); tags.push(0); ++n; } else if(kind == Data.ELEM) { final int id = data.name(pre); data.tagindex.index(data.tagindex.key(id), null, true); data.paths.put(id, kind, level); pars.push(pre); tags.push(id); } else if(kind == Data.ATTR) { final int id = data.name(pre); final byte[] val = data.text(pre, false); data.atnindex.index(data.atnindex.key(id), val, true); data.paths.put(id, kind, level, val, md); } else { final byte[] val = data.text(pre, true); if(kind == Data.TEXT && level > 1) data.tagindex.index(tags.peek(), val); data.paths.put(0, kind, level, val, md); } if(cmd != null) cmd.pre = pre; } md.ndocs = n; md.uptodate = true; } // rebuild value indexes optimize(IndexType.ATTRIBUTE, data, md.createattr, md.attrindex, rebuild, cmd); optimize(IndexType.TEXT, data, md.createtext, md.textindex, rebuild, cmd); optimize(IndexType.FULLTEXT, data, md.createftxt, md.ftxtindex, rebuild, cmd); } /** * Optimizes the specified index. * @param type index type * @param d data reference * @param create create flag * @param old old flag * @param rebuild rebuild all index structures * @param cmd calling command instance * @throws IOException I/O exception */ private static void optimize(final IndexType type, final Data d, final boolean create, final boolean old, final boolean rebuild, final Optimize cmd) throws IOException { // check if flags are nothing has changed if(!rebuild && create == old) return; // create or drop index if(create) create(type, d, cmd); else drop(type, d); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/OptimizeAll.java000066400000000000000000000132461222453003200257740ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import java.io.*; import org.basex.build.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.core.parse.Commands.*; import org.basex.data.*; import org.basex.index.*; import org.basex.io.*; import org.basex.io.serial.*; import org.basex.query.value.node.*; import org.basex.util.*; import org.basex.util.list.*; /** * Evaluates the 'optimize all' command and rebuilds all data structures of * the currently opened database. This effectively eliminates all fragmentation * and can lead to significant space savings after updates. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class OptimizeAll extends ACreate { /** Current pre value. */ int pre; /** Data size. */ private int size; /** * Default constructor. */ public OptimizeAll() { super(Perm.WRITE, true); } @Override protected boolean run() { final Data data = context.data(); try { optimizeAll(data, context, this); } catch(final IOException ex) { return error(Util.message(ex)); } finally { context.closeDB(); } final Open open = new Open(data.meta.name); return open.run(context) ? info(DB_OPTIMIZED_X, data.meta.name, perf) : error(open.info()); } @Override public boolean newData(final Context ctx) { return true; } @Override public void databases(final LockResult lr) { lr.write.add(DBLocking.CTX); } @Override public double prog() { return (double) pre / size; } @Override public boolean stoppable() { return false; } @Override public String det() { return CREATE_STATS_D; } @Override public void build(final CmdBuilder cb) { cb.init(Cmd.OPTIMIZE + " " + C_ALL); } /** * Optimizes all data structures and closes the database. * Recreates the database, drops the old instance and renames the recreated instance. * @param data disk data * @param ctx database context * @param cmd command reference, or {@code null} * @throws IOException I/O Exception during index rebuild * @throws BaseXException database exception */ public static void optimizeAll(final Data data, final Context ctx, final OptimizeAll cmd) throws IOException { if(data.inMemory()) throw new BaseXException(NO_MAINMEM); final DiskData old = (DiskData) data; final MetaData m = old.meta; if(cmd != null) cmd.size = m.size; // check if database is also pinned by other users if(ctx.dbs.pins(m.name) > 1) throw new BaseXException(DB_PINNED_X, m.name); // find unique temporary database name final String tname = ctx.mprop.random(m.name); // adopt original meta information ctx.prop.set(Prop.CHOP, m.chop); // adopt original index options ctx.prop.set(Prop.UPDINDEX, m.updindex); ctx.prop.set(Prop.MAXCATS, m.maxcats); ctx.prop.set(Prop.MAXLEN, m.maxlen); // adopt original full-text index options ctx.prop.set(Prop.STEMMING, m.stemming); ctx.prop.set(Prop.CASESENS, m.casesens); ctx.prop.set(Prop.DIACRITICS, m.diacritics); ctx.prop.set(Prop.LANGUAGE, m.language.toString()); ctx.prop.set(Prop.STOPWORDS, m.stopwords); // build database and index structures final DiskBuilder builder = new DiskBuilder(tname, new DBParser(old, cmd), ctx); try { final DiskData d = builder.build(); if(m.createtext) create(IndexType.TEXT, d, cmd); if(m.createattr) create(IndexType.ATTRIBUTE, d, cmd); if(m.createftxt) create(IndexType.FULLTEXT, d, cmd); // adopt original meta data d.meta.createtext = m.createtext; d.meta.createattr = m.createattr; d.meta.createftxt = m.createftxt; d.meta.filesize = m.filesize; d.meta.users = m.users; d.meta.dirty = true; // move binary files final IOFile bin = data.meta.binaries(); if(bin.exists()) bin.rename(d.meta.binaries()); final IOFile upd = old.updateFile(); if(upd.exists()) upd.copyTo(d.updateFile()); d.close(); } finally { try { builder.close(); } catch(final IOException ex) { Util.debug(ex); } } Close.close(data, ctx); // drop old database and rename temporary to final name if(!DropDB.drop(m.name, ctx)) throw new BaseXException(DB_NOT_DROPPED_X, m.name); if(!AlterDB.alter(tname, m.name, ctx)) throw new BaseXException(DB_NOT_RENAMED_X, tname); } /** * Parser for rebuilding existing databases. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ private static final class DBParser extends Parser { /** Disk data. */ private final DiskData data; /** Calling command (can be {@code null}). */ final OptimizeAll cmd; /** * Constructor. * @param d disk data * @param c calling command (can be {@code null}) */ DBParser(final DiskData d, final OptimizeAll c) { super(d.meta.original.isEmpty() ? null : IO.get(d.meta.original), d.meta.prop); data = d; cmd = c; } @Override public void parse(final Builder build) throws IOException { final Serializer ser = new BuilderSerializer(build) { @Override protected void startOpen(final byte[] t) throws IOException { super.startOpen(t); if(cmd != null) cmd.pre++; } @Override public void openDoc(final byte[] name) throws IOException { super.openDoc(name); if(cmd != null) cmd.pre++; } }; final IntList il = data.resources.docs(); final int is = il.size(); for(int i = 0; i < is; i++) ser.serialize(new DBNode(data, il.get(i))); } } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/Password.java000066400000000000000000000012531222453003200253400ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import org.basex.core.*; /** * Evaluates the 'password' command and alters the user's password. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Password extends AUser { /** * Default constructor. * @param pw password */ public Password(final String pw) { super(Perm.NONE, pw); } @Override protected boolean run() { final String user = context.user.name; final String pass = args[0]; return isMD5(pass) && context.users.alter(user, pass) ? info(PW_CHANGED_X, user) : error(PW_NOT_VALID); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/Rename.java000066400000000000000000000051221222453003200247440ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import static org.basex.util.Token.*; import org.basex.core.*; import org.basex.data.*; import org.basex.io.*; import org.basex.util.list.*; /** * Evaluates the 'rename' command and renames resources or directories * in a collection. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Rename extends ACreate { /** * Default constructor. * @param source source path * @param target target path */ public Rename(final String source, final String target) { super(Perm.WRITE, true, source, target); } @Override protected boolean run() { final Data data = context.data(); final String src = MetaData.normPath(args[0]); if(src == null) return error(NAME_INVALID_X, args[0]); final String trg = MetaData.normPath(args[1]); if(trg == null) return error(NAME_INVALID_X, args[1]); // start update if(!data.startUpdate()) return error(DB_PINNED_X, data.meta.name); boolean ok = true; int c = 0; final IntList docs = data.resources.docs(src); final int ds = docs.size(); for(int i = 0; i < ds; i++) { final int pre = docs.get(i); final String target = target(data, pre, src, trg); if(target.isEmpty()) { ok = !info(NAME_INVALID_X, target); } else { data.update(pre, Data.DOC, token(target)); c++; } } final IOFile file = data.meta.binary(src); if(file != null && file.exists()) { final IOFile target = data.meta.binary(trg); final IOFile trgdir = target.dir(); if(!trgdir.exists() && !trgdir.md() || !file.rename(target)) { ok = !info(NAME_INVALID_X, trg); } c++; } // finish update data.finishUpdate(); // return info message return info(RES_RENAMED_X_X, c, perf) && ok; } /** * Generates a target path for the specified document. * @param data data reference * @param pre pre value of the document * @param src source path * @param trg target path * @return new name */ public static String target(final Data data, final int pre, final String src, final String trg) { // source references a file final String path = string(data.text(pre, true)); if(Prop.CASE ? path.equals(src) : path.equalsIgnoreCase(src)) return trg; // source references a directory: merge target path and file name final String name = src.isEmpty() ? path : path.substring(src.length() + 1); if(trg.isEmpty()) return name; if(trg.endsWith("/")) return trg + name; return trg + '/' + name; } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/Replace.java000066400000000000000000000043641222453003200251170ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import java.io.*; import org.basex.core.*; import org.basex.data.*; import org.basex.data.atomic.*; import org.basex.io.*; import org.basex.util.list.*; /** * Evaluates the 'replace' command and replaces documents in a collection. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Replace extends ACreate { /** * Constructor. * The input needs to be set via {@link #setInput(InputStream)}. * @param path resource path */ public Replace(final String path) { super(Perm.WRITE, true, path); } /** * Constructor. * @param path resource path * @param input input file or XML string */ public Replace(final String path, final String input) { super(Perm.WRITE, true, path, input); } @Override protected boolean run() { // check if the input source has already been initialized if(in == null) { final IO io = IO.get(args[1]); if(!io.exists()) return error(RES_NOT_FOUND_X, io); in = io.inputSource(); } final String path = MetaData.normPath(args[0]); if(path == null || path.isEmpty()) return error(NO_DIR_ALLOWED_X, args[0]); final Data data = context.data(); final IntList pre = data.resources.docs(path, true); if(!data.startUpdate()) return error(DB_PINNED_X, data.meta.name); try { final boolean ok; final IOFile file = data.meta.binary(path); if(file != null && file.exists()) { // replace binary file if it already exists final Store store = new Store(path); store.setInput(in); ok = store.run(context) || error(store.info()); } else { // otherwise, add new document as xml final Add add = new Add(path); add.setInput(in); add.lock = false; ok = add.run(context) || error(add.info()); // delete old documents if addition was successful if(ok) { final AtomicUpdateList atomics = new AtomicUpdateList(data); for(int p = pre.size() - 1; p >= 0; p--) atomics.addDelete(pre.get(p)); atomics.execute(false); } } return ok && info(RES_REPLACED_X_X, 1, perf); } finally { data.finishUpdate(); } } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/RepoDelete.java000066400000000000000000000020161222453003200255640ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import java.io.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.core.parse.Commands.*; import org.basex.query.*; import org.basex.query.util.pkg.*; import org.basex.util.*; /** * Evaluates the 'repo delete' command. * * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ public final class RepoDelete extends ARepo { /** Input info. */ private final InputInfo info; /** * Constructor. * @param p package * @param i input info */ public RepoDelete(final String p, final InputInfo i) { super(Perm.CREATE, p); info = i; } @Override protected boolean run() throws IOException { try { new RepoManager(context, info).delete(args[0]); return info(PKG_DELETED_X, args[0]); } catch(final QueryException ex) { return error(Util.message(ex)); } } @Override public void build(final CmdBuilder cb) { cb.init(Cmd.REPO + " " + CmdRepo.DELETE).args(); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/RepoInstall.java000066400000000000000000000021201222453003200257640ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import java.io.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.core.parse.Commands.*; import org.basex.query.*; import org.basex.query.util.pkg.*; import org.basex.util.*; /** * Evaluates the 'repo install' command. * * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ public final class RepoInstall extends ARepo { /** Input info. */ private final InputInfo info; /** * Constructor. * @param p package * @param i input info */ public RepoInstall(final String p, final InputInfo i) { super(Perm.CREATE, p); info = i; } @Override protected boolean run() throws IOException { try { final boolean exists = new RepoManager(context, info).install(args[0]); return info(exists ? PKG_REPLACED_X_X : PKG_INSTALLED_X_X, args[0], perf); } catch(final QueryException ex) { return error(Util.message(ex)); } } @Override public void build(final CmdBuilder cb) { cb.init(Cmd.REPO + " " + CmdRepo.INSTALL).args(); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/RepoList.java000066400000000000000000000014011222453003200252720ustar00rootroot00000000000000package org.basex.core.cmd; import java.io.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.core.parse.Commands.*; import org.basex.query.util.pkg.*; /** * Evaluates the 'repo list' command. * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ public final class RepoList extends ARepo { /** * Constructor. */ public RepoList() { super(Perm.NONE); } @Override protected boolean run() throws IOException { out.println(new RepoManager(context).table().finish()); return true; } @Override public void databases(final LockResult lr) { lr.read.add(DBLocking.REPO); } @Override public void build(final CmdBuilder cb) { cb.init(Cmd.REPO + " " + CmdRepo.LIST).args(); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/Restore.java000066400000000000000000000050471222453003200251660ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import java.io.*; import java.util.regex.*; import org.basex.core.*; import org.basex.io.*; import org.basex.util.*; import org.basex.util.list.*; /** * Evaluates the 'restore' command and restores a backup of a database. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class Restore extends ABackup { /** States if current database was closed. */ private boolean closed; /** * Default constructor. * @param arg optional argument */ public Restore(final String arg) { super(arg); } @Override protected boolean run() { String db = args[0]; if(!Databases.validName(db)) return error(NAME_INVALID_X, db); // find backup file with or without date suffix IOFile file = mprop.dbpath(db + IO.ZIPSUFFIX); if(!file.exists()) { final StringList list = Databases.backupPaths(db, context).sort(Prop.CASE, false); if(!list.isEmpty()) file = new IOFile(list.get(0)); } else { // db is already the name of a backup -> extract db name db = Pattern.compile(DateTime.PATTERN + '$').split(db)[0]; } if(!file.exists()) return error(BACKUP_NOT_FOUND_X, db); // close database if it's currently opened and not opened by others if(!closed) closed = close(context, db); // check if database is still pinned if(context.pinned(db)) return error(DB_PINNED_X, db); // try to restore database return restore(file) && (!closed || new Open(db).run(context)) ? info(DB_RESTORED_X, file.name(), perf) : error(DB_NOT_RESTORED_X, db); } @Override public void databases(final LockResult lr) { super.databases(lr); final String name = args[0]; // Not sure whether database or backup name is provided, lock both final String dbName = Pattern.compile(DateTime.PATTERN + '$').split(name)[0]; lr.write.add(name).add(dbName); } /** * Restores the specified database. * @param file file * @return success flag */ private boolean restore(final IOFile file) { try { proc(new Zip(file)).unzip(mprop.dbpath()); return true; } catch(final IOException ex) { Util.debug(ex); return false; } } @Override protected String tit() { return RESTORE; } @Override public boolean newData(final Context ctx) { closed = close(ctx, args[0]); return closed; } @Override public boolean supportsProg() { return true; } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/Retrieve.java000066400000000000000000000023551222453003200253270ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import java.io.*; import org.basex.core.*; import org.basex.data.*; import org.basex.io.*; import org.basex.io.in.*; /** * Evaluates the 'retrieve' command and retrieves binary content. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Retrieve extends ACreate { /** * Default constructor. * @param path source path */ public Retrieve(final String path) { super(Perm.NONE, true, path); } @Override protected boolean run() throws IOException { final String path = MetaData.normPath(args[0]); if(path == null) return error(NAME_INVALID_X, args[0]); final IOFile bin = context.data().meta.binary(path); if(bin == null || !bin.exists() || bin.isDir()) return error(RES_NOT_FOUND_X, path); try { final BufferInput bi = new BufferInput(bin); try { for(int b; (b = bi.read()) != -1;) out.write(b); } finally { bi.close(); } return info(QUERY_EXECUTED_X_X, "", perf); } catch(final IOException ex) { return error(FILE_NOT_STORED_X, ex); } } @Override public void databases(final LockResult lr) { lr.read.add(DBLocking.CTX); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/Run.java000066400000000000000000000030501222453003200242770ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import java.io.*; import org.basex.core.*; import org.basex.io.*; import org.basex.util.*; /** * Evaluates the 'run' command and processes an input file. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Run extends Execute { /** Input reference. */ private IO file; /** * Default constructor. * @param fl input file */ public Run(final String fl) { super(fl); } /** * Initializes the specified input. * @param ctx database context * @return success flag */ @Override protected boolean init(final Context ctx) { if(file == null) { // check file reference file = IO.get(args[0]); if(!file.exists() || file.isDir()) { error = Util.info(RES_NOT_FOUND_X, ctx.user.has(Perm.CREATE) ? file : args[0]); } else { try { // retrieve file contents final String input = file.string(); // interpret as commands if input ends with command script suffix if(file.hasSuffix(IO.BXSSUFFIX)) return super.init(input, ctx); // otherwise, interpret input as xquery list.add(new XQuery(input)); } catch(final IOException ex) { error = Util.message(ex); } } } ctx.prop.set(Prop.QUERYPATH, file.path()); return error == null; } @Override protected void finish(final Context ctx) { ctx.prop.set(Prop.QUERYPATH, ""); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/Set.java000066400000000000000000000022631222453003200242730ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import java.util.*; import org.basex.core.*; import org.basex.util.*; /** * Evaluates the 'set' command and modifies database properties. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Set extends AGet { /** * Default constructor. * @param key property * @param value value to set (optional, depending on the property) */ public Set(final Object key, final Object value) { super(Perm.NONE, (key instanceof Object[] ? ((Object[]) key)[0] : key).toString(), value == null ? "" : value.toString()); } @Override protected boolean run() { final String key = args[0].toUpperCase(Locale.ENGLISH); final String val = args[1]; try { final String v = prop.set(key, val); if(v != null) return info(key + COLS + v); // retrieve values of all options if(context.user.has(Perm.ADMIN) && mprop.get(key) != null) { return error(Text.GLOBAL_OPTION_X, key); } return error(prop.unknown(key)); } catch(final Exception ex) { Util.debug(ex); return error(INVALID_VALUE_X_X, key, val); } } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/ShowBackups.java000066400000000000000000000025031222453003200257660ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import java.io.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.core.parse.Commands.*; import org.basex.io.*; import org.basex.util.*; import org.basex.util.list.*; /** * Evaluates the 'show backups' command and shows available backups. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ShowBackups extends ABackup { @Override protected boolean run() throws IOException { final Table table = new Table(); table.description = BACKUPS_X; table.header.add(NAME); table.header.add(SIZE); final StringList list = context.databases.backups(null); final IOFile dbpath = context.mprop.dbpath(); for(final String name : list) { final TokenList tl = new TokenList(); tl.add(name); tl.add(new IOFile(dbpath, name).length()); table.contents.add(tl); } out.println(table.sort().finish()); return true; } @Override public boolean updating(final Context ctx) { return false; } @Override public void build(final CmdBuilder cb) { cb.init(Cmd.SHOW + " " + CmdShow.BACKUPS); } @Override public void databases(final LockResult lr) { lr.read.add(DBLocking.BACKUP); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/ShowEvents.java000066400000000000000000000012731222453003200256450ustar00rootroot00000000000000package org.basex.core.cmd; import java.io.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.core.parse.Commands.*; /** * Evaluates the 'show events' command and lists all existing events. * * @author BaseX Team 2005-12, BSD License * @author Roman Raedle * @author Andreas Weiler */ public final class ShowEvents extends AEvent { @Override protected boolean run() throws IOException { out.println(context.events.info()); return true; } @Override public void build(final CmdBuilder cb) { cb.init(Cmd.SHOW + " " + CmdShow.EVENTS).args(); } @Override public void databases(final LockResult lr) { lr.read.add(DBLocking.EVENT); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/ShowSessions.java000066400000000000000000000014311222453003200262030ustar00rootroot00000000000000package org.basex.core.cmd; import java.io.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.core.parse.Commands.*; /** * Evaluates the 'show sessions' command and shows server sessions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ShowSessions extends Command { /** * Default constructor. */ public ShowSessions() { super(Perm.ADMIN); } @Override protected boolean run() throws IOException { out.println(context.sessions.info()); return true; } @Override public void databases(final LockResult lr) { // No locks needed } @Override public void build(final CmdBuilder cb) { cb.init(Cmd.SHOW + " " + CmdShow.SESSIONS); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/ShowUsers.java000066400000000000000000000031421222453003200254770ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import java.io.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.core.parse.Commands.*; import org.basex.data.*; import org.basex.util.*; /** * Evaluates the 'show users' command and shows existing users. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ShowUsers extends Command { /** * Default constructor. */ public ShowUsers() { this(null); } /** * Constructor, specifying a database. * @param db database (for showing users) */ public ShowUsers(final String db) { super(Perm.ADMIN, db); } @Override protected boolean run() throws IOException { final String name = args[0] == null || args[0].isEmpty() ? null : args[0]; if(name != null && !Databases.validName(name)) return error(NAME_INVALID_X, name); if(name == null) { out.println(context.users.info(null).finish()); } else { try { final Data data = Open.open(name, context); out.println(data.meta.users.info(context.users).finish()); Close.close(data, context); return true; } catch(final IOException ex) { return error(Util.message(ex)); } } return true; } @Override public void databases(final LockResult lr) { lr.read.add(DBLocking.ADMIN); if (null != args[0]) databases(lr.read, 0); } @Override public void build(final CmdBuilder cb) { cb.init(Cmd.SHOW + " " + CmdShow.USERS).arg(ON, 0); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/Store.java000066400000000000000000000064241222453003200246370ustar00rootroot00000000000000package org.basex.core.cmd; import static org.basex.core.Text.*; import java.io.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.data.*; import org.basex.io.*; import org.basex.io.in.*; import org.basex.io.out.*; import org.basex.util.*; import org.xml.sax.*; /** * Evaluates the 'store' command and stores binary content into the database. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Store extends ACreate { /** * Constructor, specifying a target path. * The input needs to be set via {@link #setInput(InputStream)}. * @param path target path */ public Store(final String path) { this(path, null); } /** * Constructor, specifying a target path and an input. * @param path target path * @param input input file */ public Store(final String path, final String input) { super(Perm.WRITE, true, path == null ? "" : path, input); } @Override protected boolean run() { final boolean create = context.user.has(Perm.CREATE); String path = MetaData.normPath(args[0]); if(path == null || path.endsWith(".")) return error(NAME_INVALID_X, args[0]); if(in == null) { final IO io = IO.get(args[1]); if(!io.exists() || io.isDir()) return error(RES_NOT_FOUND_X, create ? io : args[1]); in = io.inputSource(); // set/add name of document if((path.isEmpty() || path.endsWith("/")) && !(io instanceof IOContent)) path += io.name(); } // ensure that the final name is not empty if(path.isEmpty()) return error(NAME_INVALID_X, path); // ensure that the name is not empty and contains no trailing dots final Data data = context.data(); if(data.inMemory()) return error(NO_MAINMEM); final IOFile file = data.meta.binary(path); if(path.isEmpty() || path.endsWith(".") || file == null || file.isDir()) return error(NAME_INVALID_X, create ? path : args[0]); // start update if(!data.startUpdate()) return error(DB_PINNED_X, data.meta.name); try { store(in, file); return info(QUERY_EXECUTED_X_X, "", perf); } catch(final IOException ex) { return error(FILE_NOT_STORED_X, Util.message(ex)); } finally { data.finishUpdate(); } } /** * Stores the specified source to the specified file. * @param in input source * @param file target file * @throws IOException I/O exception */ public static void store(final InputSource in, final IOFile file) throws IOException { // add directory if it does not exist anyway file.dir().md(); final PrintOutput po = new PrintOutput(file.path()); try { final Reader r = in.getCharacterStream(); final InputStream is = in.getByteStream(); final String id = in.getSystemId(); if(r != null) { for(int c; (c = r.read()) != -1;) po.utf8(c); } else if(is != null) { for(int b; (b = is.read()) != -1;) po.write(b); } else if(id != null) { final BufferInput bi = new BufferInput(IO.get(id)); try { for(int b; (b = bi.read()) != -1;) po.write(b); } finally { bi.close(); } } } finally { po.close(); } } @Override public void build(final CmdBuilder cb) { cb.init().arg(C_TO, 0).arg(1); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/XQuery.java000066400000000000000000000007301222453003200247720ustar00rootroot00000000000000package org.basex.core.cmd; import org.basex.core.*; /** * Evaluates the 'xquery' command and processes an XQuery request. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class XQuery extends AQuery { /** * Default constructor. * @param query query to evaluate */ public XQuery(final String query) { super(Perm.NONE, false, query); } @Override protected boolean run() { return query(args[0]); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/cmd/package.html000066400000000000000000000000451222453003200251520ustar00rootroot00000000000000 Database commands. basex-7.7.2/basex-core/src/main/java/org/basex/core/package.html000066400000000000000000000000511222453003200244040ustar00rootroot00000000000000 Database core classes. basex-7.7.2/basex-core/src/main/java/org/basex/core/parse/000077500000000000000000000000001222453003200232415ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/core/parse/CmdBuilder.java000066400000000000000000000045551222453003200261270ustar00rootroot00000000000000package org.basex.core.parse; import java.util.*; import org.basex.core.*; import org.basex.util.*; /** * This class simplifies the composition of the string representation of * a database command. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class CmdBuilder { /** String representation of the database command. */ private final TokenBuilder tb = new TokenBuilder(); /** Command to be output. */ private final Command cmd; /** * Constructor. * @param c command */ public CmdBuilder(final Command c) { cmd = c; } /** * Initializes the builder with the class name of the command in upper case. * @return self instance */ public CmdBuilder init() { init(Util.name(cmd).toUpperCase(Locale.ENGLISH)); return this; } /** * Initializes the builder with the specified string. * @param s command string * @return self instance */ public CmdBuilder init(final String s) { tb.reset(); tb.add(s); return this; } /** * Returns a string representation of all arguments. * @return self instance */ public CmdBuilder args() { final int as = cmd.args.length; for(int a = 0; a < as; ++a) arg(a); return this; } /** * Adds the specified argument as XQuery string. * @param arg argument index * @return self instance */ public CmdBuilder xquery(final int arg) { tb.add(' ').add(cmd.args[arg]); return this; } /** * Adds the specified argument. * @param arg argument index * @return self instance */ public CmdBuilder arg(final int arg) { arg(null, arg); return this; } /** * Adds an argument with an optional prefix. * @param key optional keyword prefix * @param arg argument index * @return self instance */ public CmdBuilder arg(final String key, final int arg) { final String a = cmd.args.length > arg ? cmd.args[arg] : null; if(a != null && !a.isEmpty()) { if(key != null) tb.add(' ').add(key); tb.add(' '); if(a.indexOf(' ') != -1 || a.indexOf(';') != -1) { tb.add('"').add(a.replaceAll("\"", "\\\"")).add('"'); } else { tb.add(a); } } return this; } @Override public String toString() { return tb.toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/parse/CmdParser.java000066400000000000000000000023461222453003200257710ustar00rootroot00000000000000package org.basex.core.parse; import java.util.*; import org.basex.core.*; import org.basex.query.*; /** * This is an interface for parsing database commands. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ abstract class CmdParser { /** Suggest possible completions. */ protected boolean suggest; /** Single command flag. */ protected boolean single; /** Password reader. */ protected PasswordReader pwReader; /** * Attaches a password reader. * @param pr password reader */ final void pwReader(final PasswordReader pr) { pwReader = pr; } /** * Parses the input and returns a command list. * @param cmds container for created commands * @param sngl single command flag * @param sggst suggest flag * @throws QueryException query exception */ final void parse(final ArrayList cmds, final boolean sngl, final boolean sggst) throws QueryException { single = sngl; suggest = sggst; parse(cmds); } /** * Parses the input and fills the command list. * @param cmds container for created commands * @throws QueryException query exception */ protected abstract void parse(final ArrayList cmds) throws QueryException; } basex-7.7.2/basex-core/src/main/java/org/basex/core/parse/CommandParser.java000066400000000000000000000042661222453003200266470ustar00rootroot00000000000000package org.basex.core.parse; import java.util.*; import org.basex.core.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * This is a parser for command strings, creating {@link Command} instances. * Several commands can be formulated in one string and separated by semicolons. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class CommandParser extends InputParser { /** Context. */ public final CmdParser parser; /** * Constructor. * @param in input * @param c context */ public CommandParser(final String in, final Context c) { super(in); parser = in.startsWith("<") ? new XMLParser(in, c) : new StringParser(in, c); } /** * Attaches a password reader. * @param pr password reader * @return self reference */ public CommandParser pwReader(final PasswordReader pr) { parser.pwReader(pr); return this; } /** * Parses the input as single command and returns the resulting command. * @return command * @throws QueryException query exception */ public Command parseSingle() throws QueryException { return parse(true, false)[0]; } /** * Parses the input and returns a command list. * @return commands * @throws QueryException query exception */ public Command[] parse() throws QueryException { return parse(false, false); } /** * Parses the input and creates command completions on the way. * @return commands * @throws QueryException query exception */ public Command[] suggest() throws QueryException { return parse(false, true); } /** * Parses the input and returns a command list. * @param single input must only contain a single command * @param suggest suggest flag * @return commands * @throws QueryException query exception */ private Command[] parse(final boolean single, final boolean suggest) throws QueryException { final ArrayList cmds = new ArrayList(); parser.parse(cmds, single, suggest); if(!single || cmds.size() == 1) return cmds.toArray(new Command[cmds.size()]); throw new QueryException(null, new QNm(), Text.SINGLE_CMD); } } basex-7.7.2/basex-core/src/main/java/org/basex/core/parse/Commands.java000066400000000000000000000153251222453003200256530ustar00rootroot00000000000000package org.basex.core.parse; import static org.basex.core.Text.*; /** * This class defines the available command-line commands. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ @SuppressWarnings("all") public interface Commands { /** Root node of command scripts. */ String COMMANDS = "commands"; /** Command string: "add". */ String ADD = "add"; /** Command string: "alter-db". */ String ALTER_DB = "alter-db"; /** Command string: "alter-user". */ String ALTER_USER = "alter-user"; /** Command string: "check". */ String CHECK = "check"; /** Command string: "close". */ String CLOSE = "close"; /** Command string: "copy". */ String COPY = "copy"; /** Command string: "create-backup". */ String CREATE_BACKUP = "create-backup"; /** Command string: "create-db". */ String CREATE_DB = "create-db"; /** Command string: "create-event". */ String CREATE_EVENT = "create-event"; /** Command string: "create-index". */ String CREATE_INDEX = "create-index"; /** Command string: "create-user". */ String CREATE_USER = "create-user"; /** Command string: "cs". */ String CS = "cs"; /** Command string: "delete". */ String DELETE = "delete"; /** Command string: "drop-backup". */ String DROP_BACKUP = "drop-backup"; /** Command string: "drop-db". */ String DROP_DB = "drop-db"; /** Command string: "drop-event". */ String DROP_EVENT = "drop-event"; /** Command string: "drop-index". */ String DROP_INDEX = "drop-index"; /** Command string: "drop-user". */ String DROP_USER = "drop-user"; /** Command string: "execute". */ String EXECUTE = "execute"; /** Command string: "exit". */ String EXIT = "exit"; /** Command string: "export". */ String EXPORT = "export"; /** Command string: "find". */ String FIND = "find"; /** Command string: "flush". */ String FLUSH = "flush"; /** Command string: "get". */ String GET = "get"; /** Command string: "grant". */ String GRANT = "grant"; /** Command string: "help". */ String HELP = "help"; /** Command string: "info". */ String INFO = "info"; /** Command string: "info-db". */ String INFO_DB = "info-db"; /** Command string: "info-index". */ String INFO_INDEX = "info-index"; /** Command string: "info-storage". */ String INFO_STORAGE = "info-storage"; /** Command string: "kill". */ String KILL = "kill"; /** Command string: "list". */ String LIST = "list"; /** Command string: "open". */ String OPEN = "open"; /** Command string: "optimize". */ String OPTIMIZE = "optimize"; /** Command string: "optimize-all". */ String OPTIMIZE_ALL = "optimize-all"; /** Command string: "password". */ String PASSWORD = "password"; /** Command string: "rename". */ String RENAME = "rename"; /** Command string: "replace". */ String REPLACE = "replace"; /** Command string: "repo-delete". */ String REPO_DELETE = "repo-delete"; /** Command string: "repo-install". */ String REPO_INSTALL = "repo-install"; /** Command string: "repo-list". */ String REPO_LIST = "repo-list"; /** Command string: "restore". */ String RESTORE = "restore"; /** Command string: "retrieve". */ String RETRIEVE = "retrieve"; /** Command string: "run". */ String RUN = "run"; /** Command string: "inspect". */ String INSPECT = "inspect"; /** Command string: "set". */ String SET = "set"; /** Command string: "show-backups". */ String SHOW_BACKUPS = "show-backups"; /** Command string: "show-events". */ String SHOW_EVENTS = "show-events"; /** Command string: "show-sessions". */ String SHOW_SESSIONS = "show-sessions"; /** Command string: "show-users". */ String SHOW_USERS = "show-users"; /** Command string: "store". */ String STORE = "store"; /** Command string: "xquery". */ String XQUERY = "xquery"; /** Command attribute: "path". */ String PATH = "path"; /** Command attribute: "name". */ String NAME = "name"; /** Command attribute: "newname". */ String NEWNAME = "newname"; /** Command attribute: "input". */ String INPUT = "input"; /** Command attribute: "query". */ String QUERY = "query"; /** Command attribute: "type". */ String TYPE = "type"; /** Command attribute: "database". */ String DATABASE = "database"; /** Command attribute: "option". */ String OPTION = "option"; /** Command attribute: "permission". */ String PERMISSION = "permission"; /** Command attribute: "target". */ String TARGET = "target"; /** Command attribute: "newpath". */ String NEWPATH = "newpath"; /** Command attribute: "file". */ String FILE = "file"; /** Command attribute: "value". */ String VALUE = "value"; /** Command attribute: "command". */ String COMMAND = "command"; /** Create commands. */ enum CmdCreate { DATABASE, DB, INDEX, USER, BACKUP, EVENT } /** Info commands. */ enum CmdInfo { NULL, DATABASE, DB, INDEX, STORAGE } /** Drop commands. */ enum CmdDrop { DATABASE, DB, INDEX, USER, BACKUP, EVENT } /** Optimize commands. */ enum CmdOptimize { NULL, ALL } /** Show commands. */ enum CmdShow { SESSIONS, USERS, BACKUPS, EVENTS } /** Permission commands. */ enum CmdPerm { NONE, READ, WRITE, CREATE, ADMIN } /** Index types. */ enum CmdIndex { TEXT, ATTRIBUTE, FULLTEXT } /** Index types. */ enum CmdIndexInfo { NULL, TEXT, ATTRIBUTE, FULLTEXT, PATH, TAG, ATTNAME } /** Alter types. */ enum CmdAlter { DATABASE, DB, USER } /** Repo types. */ enum CmdRepo { INSTALL, DELETE, LIST } /** Command definitions. */ enum Cmd { ADD(HELPADD), ALTER(HELPALTER), CHECK(HELPCHECK), CLOSE(HELPCLOSE), COPY(HELPCOPY), CREATE(HELPCREATE), CS(HELPCS), DELETE(HELPDELETE), DROP(HELPDROP), EXIT(HELPEXIT), EXPORT(HELPEXPORT), FIND(HELPFIND), FLUSH(HELPFLUSH), GET(HELPGET), GRANT(HELPGRANT), HELP(HELPHELP), INFO(HELPINFO), INSPECT(HELPINSPECT), KILL(HELPKILL), LIST(HELPLIST), OPEN(HELPOPEN), OPTIMIZE(HELPOPTIMIZE), PASSWORD(HELPPASSWORD), RENAME(HELPRENAME), REPLACE(HELPREPLACE), REPO(HELPREPO), RESTORE(HELPRESTORE), RETRIEVE(HELPRETRIEVE), RUN(HELPRUN), EXECUTE(HELPEXECUTE), SET(HELPSET), SHOW(HELPSHOW), STORE(HELPSTORE), XQUERY(HELPXQUERY); /** Help texts. */ private final String[] help; /** * Default constructor. * @param h help texts, or {@code null} if command is hidden. */ Cmd(final String... h) { help = h; } /** * Returns a help string. * @param detail show details * @return string */ public final String help(final boolean detail) { final StringBuilder sb = new StringBuilder(); if(help == null) { if(detail) sb.append(NOHELP); } else { sb.append(this + " " + help[0] + NL + " " + help[1] + NL); if(detail) sb.append(NL + help[2]); } return sb.toString(); } } } basex-7.7.2/basex-core/src/main/java/org/basex/core/parse/PasswordReader.java000066400000000000000000000006651222453003200270400ustar00rootroot00000000000000package org.basex.core.parse; /** * Reads a password from a specified source (eg. command line or GUI). * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public interface PasswordReader { /** * Parses and returns a password. * In command line and server mode, read from stdin, on GUI command line * prompt using a password box. * @return password or empty string */ String password(); } basex-7.7.2/basex-core/src/main/java/org/basex/core/parse/StringParser.java000066400000000000000000000377231222453003200265430ustar00rootroot00000000000000package org.basex.core.parse; import static org.basex.core.Text.*; import static org.basex.util.Token.*; import java.util.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.core.cmd.List; import org.basex.core.cmd.Set; import org.basex.core.parse.Commands.Cmd; import org.basex.core.parse.Commands.CmdAlter; import org.basex.core.parse.Commands.CmdCreate; import org.basex.core.parse.Commands.CmdDrop; import org.basex.core.parse.Commands.CmdIndex; import org.basex.core.parse.Commands.CmdIndexInfo; import org.basex.core.parse.Commands.CmdInfo; import org.basex.core.parse.Commands.CmdOptimize; import org.basex.core.parse.Commands.CmdPerm; import org.basex.core.parse.Commands.CmdRepo; import org.basex.core.parse.Commands.CmdShow; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.util.*; import org.basex.util.list.*; /** * This is a parser for command strings, creating {@link Command} instances. * Several commands can be formulated in one string and separated by semicolons. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class StringParser extends CmdParser { /** Input lines. */ private final String in; /** Context. */ private final Context ctx; /** Current parser. */ private InputParser parser; /** * Constructor. * @param input input * @param context database context */ public StringParser(final String input, final Context context) { ctx = context; in = input; } @Override protected void parse(final ArrayList cmds) throws QueryException { final Scanner sc = new Scanner(in).useDelimiter(single ? "\0" : "\r\n?|\n"); while(sc.hasNext()) { final String line = sc.next().trim(); if(line.isEmpty() || line.startsWith("#")) continue; parser = new InputParser(line); while(parser.more()) { final Cmd cmd = consume(Cmd.class, null); if(cmd != null) cmds.add(parse(cmd)); if(parser.more() && !parser.consume(';')) throw help(null, cmd); } } } /** * Parses a single command. * @param cmd command definition * @return resulting command * @throws QueryException query exception */ private Command parse(final Cmd cmd) throws QueryException { switch(cmd) { case CREATE: switch(consume(CmdCreate.class, cmd)) { case BACKUP: return new CreateBackup(glob(cmd)); case DATABASE: case DB: return new CreateDB(name(cmd), single ? remaining(null) : string(null)); case INDEX: return new CreateIndex(consume(CmdIndex.class, cmd)); case USER: return new CreateUser(name(cmd), password()); case EVENT: return new CreateEvent(name(cmd)); } break; case COPY: return new Copy(name(cmd), name(cmd)); case ALTER: switch(consume(CmdAlter.class, cmd)) { case DATABASE: case DB: return new AlterDB(name(cmd), name(cmd)); case USER: return new AlterUser(name(cmd), password()); } break; case OPEN: return new Open(name(cmd)); case CHECK: return new Check(string(cmd)); case ADD: String arg = key(C_TO, null) ? string(cmd) : null; return new Add(arg, single ? remaining(cmd) : string(cmd)); case STORE: arg = key(C_TO, null) ? string(cmd) : null; return new Store(arg, single ? remaining(cmd) : string(cmd)); case RETRIEVE: return new Retrieve(string(cmd)); case DELETE: return new Delete(string(cmd)); case RENAME: return new Rename(string(cmd), string(cmd)); case REPLACE: return new Replace(string(cmd), single ? remaining(cmd) : string(cmd)); case INFO: switch(consume(CmdInfo.class, cmd)) { case NULL: return new Info(); case DATABASE: case DB: return new InfoDB(); case INDEX: return new InfoIndex(consume(CmdIndexInfo.class, null)); case STORAGE: String arg1 = number(null); final String arg2 = arg1 != null ? number(null) : null; if(arg1 == null) arg1 = xquery(null); return new InfoStorage(arg1, arg2); } break; case INSPECT: return new Inspect(); case CLOSE: return new Close(); case LIST: return new List(string(null), string(null)); case DROP: switch(consume(CmdDrop.class, cmd)) { case DATABASE: case DB: return new DropDB(glob(cmd)); case INDEX: return new DropIndex(consume(CmdIndex.class, cmd)); case USER: return new DropUser(glob(cmd), key(ON, null) ? glob(cmd) : null); case BACKUP: return new DropBackup(glob(cmd)); case EVENT: return new DropEvent(name(cmd)); } break; case OPTIMIZE: switch(consume(CmdOptimize.class, cmd)) { case NULL: return new Optimize(); case ALL: return new OptimizeAll(); } break; case EXPORT: return new Export(string(cmd)); case XQUERY: return new XQuery(xquery(cmd)); case RUN: return new Run(string(cmd)); case EXECUTE: return new Execute(string(cmd)); case FIND: return new Find(string(cmd)); case CS: return new Cs(xquery(cmd)); case GET: return new Get(name(null)); case SET: return new Set(name(cmd), string(null)); case PASSWORD: return new Password(password()); case HELP: return new Help(name(null)); case EXIT: return new Exit(); case FLUSH: return new Flush(); case KILL: return new Kill(string(cmd)); case RESTORE: return new Restore(name(cmd)); case SHOW: switch(consume(CmdShow.class, cmd)) { case SESSIONS: return new ShowSessions(); case USERS: return new ShowUsers(key(ON, null) ? name(cmd) : null); case BACKUPS: return new ShowBackups(); case EVENTS: return new ShowEvents(); default: } break; case GRANT: final CmdPerm perm = consume(CmdPerm.class, cmd); if(perm == null) throw help(null, cmd); final String db = key(ON, null) ? glob(cmd) : null; key(C_TO, cmd); return new Grant(perm, glob(cmd), db); case REPO: switch(consume(CmdRepo.class, cmd)) { case INSTALL: return new RepoInstall(string(cmd), new InputInfo(parser)); case DELETE: return new RepoDelete(string(cmd), new InputInfo(parser)); case LIST: return new RepoList(); default: } break; default: } throw Util.notexpected("command specified, but not implemented yet"); } /** * Parses and returns a string, delimited by a space or semicolon. * Quotes can be used to include spaces. * @param cmd referring command; if specified, the result must not be empty * @return string * @throws QueryException query exception */ private String string(final Cmd cmd) throws QueryException { final StringBuilder sb = new StringBuilder(); consumeWS(); boolean q = false; while(parser.more()) { final char c = parser.curr(); if(!q && (c <= ' ' || eoc())) break; if(c == '"') q ^= true; else sb.append(c); parser.consume(); } return finish(sb, cmd); } /** * Parses and returns the remaining string. Quotes at the beginning and end * of the argument will be stripped. * @param cmd referring command; if specified, the result must not be empty * @return remaining string * @throws QueryException query exception */ private String remaining(final Cmd cmd) throws QueryException { final StringBuilder sb = new StringBuilder(); consumeWS(); while(parser.more()) sb.append(parser.consume()); String arg = finish(sb, cmd); if(arg != null) { // chop quotes; substrings are faster than replaces... if(arg.startsWith("\"")) arg = arg.substring(1); if(arg.endsWith("\"")) arg = arg.substring(0, arg.length() - 1); } return arg; } /** * Parses and returns an xquery expression. * @param cmd referring command; if specified, the result must not be empty * @return path * @throws QueryException query exception */ private String xquery(final Cmd cmd) throws QueryException { consumeWS(); final StringBuilder sb = new StringBuilder(); if(!eoc()) { final QueryContext qc = new QueryContext(ctx); try { final QueryParser p = new QueryParser(parser.input, null, qc); p.pos = parser.pos; p.parseMain(); sb.append(parser.input.substring(parser.pos, p.pos)); parser.pos = p.pos; } finally { qc.close(); } } return finish(sb, cmd); } /** * Parses and returns a command. A command is limited to letters. * @param cmd referring command; if specified, the result must not be empty * @return name * @throws QueryException query exception */ private String command(final Cmd cmd) throws QueryException { consumeWS(); final StringBuilder sb = new StringBuilder(); while(!eoc() && !ws(parser.curr())) { sb.append(parser.consume()); } return finish(sb, cmd); } /** * Parses and returns a name. A name is limited to letters, digits, * underscores, dashes, and periods: {@code [A-Za-z0-9_-]+}. * @param cmd referring command; if specified, the result must not be empty * @return name * @throws QueryException query exception */ private String name(final Cmd cmd) throws QueryException { consumeWS(); final StringBuilder sb = new StringBuilder(); while(Databases.validChar(parser.curr())) sb.append(parser.consume()); return finish(eoc() || ws(parser.curr()) ? sb : null, cmd); } /** * Parses and returns a password string. * @return password string * @throws QueryException query exception */ private String password() throws QueryException { final String pw = string(null); return pw != null ? pw : pwReader == null ? "" : pwReader.password(); } /** * Parses and returns a glob expression, which extends {@link #name(Cmd)} function * with asterisks, question marks and commands. * @param cmd referring command; if specified, the result must not be empty * @return glob expression * @throws QueryException query exception */ private String glob(final Cmd cmd) throws QueryException { consumeWS(); final StringBuilder sb = new StringBuilder(); while(true) { final char ch = parser.curr(); if(!Databases.validChar(ch) && ch != '*' && ch != '?' && ch != ',') { return finish(eoc() || ws(ch) ? sb : null, cmd); } sb.append(parser.consume()); } } /** * Parses and returns the specified keyword. * @param key token to be parsed * @param cmd referring command; if specified, the keyword is mandatory * @return result of check * @throws QueryException query exception */ private boolean key(final String key, final Cmd cmd) throws QueryException { consumeWS(); final int p = parser.pos; final boolean ok = (parser.consume(key) || parser.consume( key.toLowerCase(Locale.ENGLISH))) && (parser.curr(0) || ws(parser.curr())); if(!ok) { parser.pos = p; if(cmd != null) throw help(null, cmd); } return ok; } /** * Parses and returns a string result. * @param s input string, or {@code null} if invalid * @param cmd referring command; if specified, the result must not be empty * @return string result, or {@code null} * @throws QueryException query exception */ private String finish(final StringBuilder s, final Cmd cmd) throws QueryException { if(s != null && s.length() != 0) return s.toString(); if(cmd != null) throw help(null, cmd); return null; } /** * Parses and returns a number. * @param cmd referring command; if specified, the result must not be empty * @return name * @throws QueryException query exception */ private String number(final Cmd cmd) throws QueryException { consumeWS(); final StringBuilder sb = new StringBuilder(); if(parser.curr() == '-') sb.append(parser.consume()); while(digit(parser.curr())) sb.append(parser.consume()); return finish(eoc() || ws(parser.curr()) ? sb : null, cmd); } /** * Consumes all whitespace characters from the beginning of the remaining * query. */ private void consumeWS() { while(parser.pos < parser.length && parser.input.charAt(parser.pos) <= ' ') ++parser.pos; parser.mark = parser.pos - 1; } /** * Returns the found command or throws an error. * @param cmp possible completions * @param par parent command * @param token type * @return index * @throws QueryException query exception */ private > E consume(final Class cmp, final Cmd par) throws QueryException { final String token = command(null); if(!suggest || token == null || !token.isEmpty()) { try { // return command reference; allow empty strings as input ("NULL") final String t = token == null ? "NULL" : token.toUpperCase(Locale.ENGLISH); return Enum.valueOf(cmp, t); } catch(final IllegalArgumentException ignore) { } } final Enum[] alt = startWith(cmp, token); // handle empty input if(token == null) { if(par != null) throw help(alt, par); if(suggest) throw error(alt, EXPECTING_CMD); return null; } // output error for similar commands final byte[] name = uc(token(token)); final Levenshtein ls = new Levenshtein(); for(final Enum s : startWith(cmp, null)) { final byte[] sm = uc(token(s.name())); if(ls.similar(name, sm) && Cmd.class.isInstance(s)) { throw error(alt, UNKNOWN_SIMILAR_X, name, sm); } } // show unknown command error or available command extensions throw par == null ? error(alt, UNKNOWN_TRY_X, token) : help(alt, par); } /** * Returns help output as query exception instance. * Prints some command info. * @param alt input alternatives * @param cmd input completions * @return QueryException query exception */ private QueryException help(final Enum[] alt, final Cmd cmd) { return error(alt, SYNTAX_X, cmd.help(true)); } /** * Returns all commands that start with the specified user input. * @param token type * @param en available commands * @param prefix user input * @return completions */ private static > Enum[] startWith(final Class en, final String prefix) { Enum[] list = new Enum[0]; final String t = prefix == null ? "" : prefix.toUpperCase(Locale.ENGLISH); for(final Enum e : en.getEnumConstants()) { if(e.name().startsWith(t)) { final int s = list.length; list = Array.copy(list, new Enum[s + 1]); list[s] = e; } } return list; } /** * Checks if the end of a command has been reached. * @return true if command has ended */ private boolean eoc() { return !parser.more() || parser.curr() == ';'; } /** * Returns a query exception instance. * @param comp input completions * @param m message * @param e extension * @return query exception */ private QueryException error(final Enum[] comp, final String m, final Object... e) { return new QueryException(parser.info(), new QNm(), m, e).suggest(parser, list(comp)); } /** * Converts the specified commands into a string list. * @param comp input completions * @return string list */ private static StringList list(final Enum[] comp) { final StringList list = new StringList(); if(comp != null) { for(final Enum c : comp) list.add(c.name().toLowerCase(Locale.ENGLISH)); } return list; } } basex-7.7.2/basex-core/src/main/java/org/basex/core/parse/XMLParser.java000066400000000000000000000273401222453003200257270ustar00rootroot00000000000000package org.basex.core.parse; import static org.basex.core.parse.Commands.*; import java.io.*; import java.util.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.core.cmd.List; import org.basex.core.cmd.Set; import org.basex.io.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.util.*; /** * This is a parser for XML input, creating {@link Command} instances. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class XMLParser extends CmdParser { /** Context. */ private final String input; /** Context. */ private final Context ctx; /** * Constructor. * @param in input * @param c context */ XMLParser(final String in, final Context c) { input = in; ctx = c; } @Override protected void parse(final ArrayList cmds) throws QueryException { try { final DBNode node = new DBNode(IO.get(input), ctx.prop); String query = "/*"; if(!execute(COMMANDS, node).isEmpty()) { query = COMMANDS + query; // ensure that the root contains no text nodes as children if(!execute(COMMANDS + "/text()/string()", node).trim().isEmpty()) throw error(Text.SYNTAX_X, '<' + COMMANDS + "><...>'); } final QueryProcessor qa = new QueryProcessor(query, ctx).context(node); for(final Item ia : qa.value()) cmds.add(command(ia)); } catch(final IOException ex) { throw error(Text.STOPPED_AT + '%', ex); } } /** * Returns a command. * @param root command node * @return command * @throws QueryException query exception */ private Command command(final Item root) throws QueryException { final String e = ((ANode) root).qname().toJava().toString(); if(e.equals(ADD) && check(root, PATH + '?', '<' + INPUT)) return new Add(value(root, PATH), xml(root)); if(e.equals(ALTER_DB) && check(root, NAME, NEWNAME)) return new AlterDB(value(root, NAME), value(root, NEWNAME)); if(e.equals(ALTER_USER) && check(root, NAME, '#' + PASSWORD + '?')) return new AlterUser(value(root, NAME), password(root)); if(e.equals(CHECK) && check(root, INPUT)) return new Check(value(root, INPUT)); if(e.equals(CLOSE) && check(root)) return new Close(); if(e.equals(COPY) && check(root, NAME, NEWNAME)) return new Copy(value(root, NAME), value(root, NEWNAME)); if(e.equals(CREATE_BACKUP) && check(root, NAME)) return new CreateBackup(value(root, NAME)); if(e.equals(CREATE_DB) && check(root, NAME, '<' + INPUT + '?')) return new CreateDB(value(root, NAME), xml(root)); if(e.equals(CREATE_EVENT) && check(root, NAME + '?')) return new CreateEvent(value(root, NAME)); if(e.equals(CREATE_INDEX) && check(root, TYPE)) return new CreateIndex(value(root, TYPE)); if(e.equals(CREATE_USER) && check(root, NAME, '#' + PASSWORD + '?')) return new CreateUser(value(root, NAME), password(root)); if(e.equals(CS) && check(root, '#' + QUERY)) return new Cs(value(root)); if(e.equals(DELETE) && check(root, PATH)) return new Delete(value(root, PATH)); if(e.equals(DROP_BACKUP) && check(root, NAME)) return new DropBackup(value(root, NAME)); if(e.equals(DROP_DB) && check(root, NAME)) return new DropDB(value(root, NAME)); if(e.equals(DROP_EVENT) && check(root, NAME)) return new DropEvent(value(root, NAME)); if(e.equals(DROP_INDEX) && check(root, TYPE)) return new DropIndex(value(root, TYPE)); if(e.equals(DROP_USER) && check(root, NAME, DATABASE + '?')) return new DropUser(value(root, NAME), value(root, DATABASE)); if(e.equals(EXIT) && check(root)) return new Exit(); if(e.equals(EXPORT) && check(root, PATH)) return new Export(value(root, PATH)); if(e.equals(FIND) && check(root, '#' + QUERY)) return new Find(value(root)); if(e.equals(FLUSH) && check(root)) return new Flush(); if(e.equals(GET) && check(root, OPTION + '?')) return new Get(value(root, OPTION)); if(e.equals(GRANT) && check(root, NAME, PERMISSION, DATABASE + '?')) return new Grant(value(root, PERMISSION), value(root, NAME), value(root, DATABASE)); if(e.equals(HELP) && check(root, '#' + COMMAND + '?')) return new Help(value(root)); if(e.equals(INFO) && check(root)) return new Info(); if(e.equals(INFO_DB) && check(root)) return new InfoDB(); if(e.equals(INFO_INDEX) && check(root, TYPE + '?')) return new InfoIndex(value(root, TYPE)); if(e.equals(INFO_STORAGE) && check(root, '#' + QUERY + '?')) return new InfoStorage(value(root)); if(e.equals(KILL) && check(root, TARGET + '?')) return new Kill(value(root, TARGET)); if(e.equals(LIST) && check(root, NAME + '?', PATH + '?')) return new List(value(root, NAME), value(root, PATH)); if(e.equals(OPEN) && check(root, NAME)) return new Open(value(root, NAME)); if(e.equals(OPTIMIZE) && check(root)) return new Optimize(); if(e.equals(OPTIMIZE_ALL) && check(root)) return new OptimizeAll(); if(e.equals(PASSWORD) && check(root, '#' + PASSWORD + '?')) return new Password(password(root)); if(e.equals(RENAME) && check(root, PATH, NEWPATH)) return new Rename(value(root, PATH), value(root, NEWPATH)); if(e.equals(REPLACE) && check(root, PATH, '<' + INPUT)) return new Replace(value(root, PATH), xml(root)); if(e.equals(REPO_DELETE) && check(root, NAME)) return new RepoDelete(value(root, NAME), null); if(e.equals(REPO_INSTALL) && check(root, PATH)) return new RepoInstall(value(root, PATH), null); if(e.equals(REPO_LIST) && check(root)) return new RepoList(); if(e.equals(RESTORE) && check(root, NAME)) return new Restore(value(root, NAME)); if(e.equals(RETRIEVE) && check(root, PATH)) return new Retrieve(value(root, PATH)); if(e.equals(RUN) && check(root, FILE)) return new Run(value(root, FILE)); if(e.equals(EXECUTE) && check(root, '<' + INPUT)) return new Execute(xml(root)); if(e.equals(INSPECT) && check(root)) return new Inspect(); if(e.equals(SET) && check(root, OPTION, '#' + VALUE + '?')) return new Set(value(root, OPTION), value(root)); if(e.equals(SHOW_BACKUPS) && check(root)) return new ShowBackups(); if(e.equals(SHOW_EVENTS) && check(root)) return new ShowEvents(); if(e.equals(SHOW_SESSIONS) && check(root)) return new ShowSessions(); if(e.equals(SHOW_USERS) && check(root, DATABASE + '?')) return new ShowUsers(value(root, DATABASE)); if(e.equals(STORE) && check(root, PATH + '?', '<' + INPUT)) return new Store(value(root, PATH), xml(root)); if(e.equals(XQUERY) && check(root, '#' + QUERY)) return new XQuery(value(root)); throw error(Text.UNKNOWN_CMD_X, '<' + e + "/>"); } /** * Returns the value of the specified attribute. * @param root root node * @param att name of attribute * @return query exception * @throws QueryException query exception */ private String value(final Item root, final String att) throws QueryException { return execute("string(@" + att + ')', root); } /** * Returns a string value (text node). * @param root root node * @return query exception * @throws QueryException query exception */ private String value(final Item root) throws QueryException { return execute("string(.)", root); } /** * Returns a password (text node). * @param root root node * @return query exception * @throws QueryException query exception */ private String password(final Item root) throws QueryException { final String pw = execute("string(.)", root); return pw.isEmpty() && pwReader != null ? pwReader.password() : ""; } /** * Returns an xml value (text node). * @param root root node * @return query exception * @throws QueryException query exception */ private String xml(final Item root) throws QueryException { return new QueryProcessor("node()", ctx).context(root).execute().toString().trim(); } /** * Executes the specified query and returns a string representation. * @param query query * @param context context node * @return query exception * @throws QueryException query exception */ private String execute(final String query, final Item context) throws QueryException { final QueryProcessor qp = new QueryProcessor(query, ctx).context(context); final Iter ir = qp.iter(); final Item it = ir.next(); return it == null ? "" : it.toJava().toString().trim(); } /** * Checks the syntax of the specified command. Returns an error with the expected * syntax if the check fails. The passed on strings describe the arguments of a * command. They may be: *
    *
  • attribute names
  • *
  • labels for text nodes, if prefixed with "#"
  • *
  • labels for text or descendant nodes, if prefixed with "<"
  • *
* Arguments are optional, if they suffixed with "?". Examples: *
    *
  • {"name","#input?"} indicates that the command must have one "name" * attribute and may have one text node, but nothing else
  • *
  • {} means that the command must not have any arguments }
  • *
* @param root root node * @param checks checks to be performed. * @return success flag * @throws QueryException query exception */ private boolean check(final Item root, final String... checks) throws QueryException { // prepare validating query final ValueBuilder ma = new ValueBuilder(); final ValueBuilder oa = new ValueBuilder(); String t = null; boolean ot = true; boolean n = false; for(String c : checks) { final boolean o = c.endsWith("?"); c = c.replace("?", ""); if(!c.isEmpty() && !Character.isLetter(c.charAt(0))) { // textual contents t = c.substring(1); ot = o; n = c.charAt(0) == '<'; } else { (o ? oa : ma).add(Str.get(c)); } } // build validating query final TokenBuilder tb = new TokenBuilder("."); // check existence of mandatory attributes tb.add("[every $e in $A satisfies @*/name() = $e]"); // check existence of unknown attributes tb.add("[every $e in @* satisfies $e/name() = ($A,$O)]"); // ensure that all values are non-empty tb.add("[every $e in @* satisfies data($e)]"); if(t == null) { // ensure that no children exist tb.add("[not(node())]"); } else if(!ot) { // ensure that children exist tb.add("[node()]"); if(!n) tb.add("[not(*)]"); } // run query final QueryProcessor qp = new QueryProcessor(tb.toString(), ctx).context(root); qp.bind("A", ma).bind("O", oa); if(!qp.execute().toString().isEmpty()) return true; // build error string final TokenBuilder syntax = new TokenBuilder(); final byte[] nm = ((ANode) root).qname().string(); syntax.reset().add('<').add(nm); for(final Item i : ma) { final byte[] a = i.string(null); syntax.add(' ').add(a).add("=\"...\""); } for(final Item i : oa) { final byte[] a = i.string(null); syntax.add(" (").add(a).add("=\"...\")"); } if(t != null) { syntax.add('>'); if(ot) syntax.add('('); syntax.add('[').add(t).add(']'); if(ot) syntax.add(')'); syntax.add("'); } else { syntax.add("/>"); } throw error(Text.SYNTAX_X, syntax); } /** * Returns a query exception instance. * @param msg message * @param ext message extension * @return query exception */ private static QueryException error(final String msg, final Object... ext) { return new QueryException(null, new QNm(), msg, ext); } } basex-7.7.2/basex-core/src/main/java/org/basex/data/000077500000000000000000000000001222453003200221105ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/data/Data.java000066400000000000000000001002701222453003200236240ustar00rootroot00000000000000package org.basex.data; import static org.basex.util.Token.*; import java.util.*; import org.basex.core.cmd.*; import org.basex.data.atomic.*; import org.basex.index.*; import org.basex.index.name.*; import org.basex.index.path.*; import org.basex.index.query.*; import org.basex.index.resource.*; import org.basex.io.*; import org.basex.io.random.*; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * This class represents a database instance. It provides low-level access to all * properties and values stored in a single database. * * An XML node is accessed by its {@code pre} value, which is not stored itself, but * given by the table position. The following restrictions are imposed on the data: *
    *
  • The table is limited to 2^31 entries (pre values are signed int's)
  • *
  • A maximum of 2^15 different tag and attribute names is allowed
  • *
  • A maximum of 2^8 different namespaces is allowed
  • *
* Each node occupies 128 bits. The current storage layout looks as follows: * *
 * COMMON ATTRIBUTES:
 * - Byte     0:  KIND: Node kind (bits: 2-0)
 * - Byte 12-15:  UNID: Unique Node ID
 * DOCUMENT NODES (kind = 0):
 * - Byte  3- 7:  TEXT: Text reference
 * - Byte  8-11:  SIZE: Number of descendants
 * ELEMENT NODES (kind = 1):
 * - Byte     0:  ATTS: Number of attributes (bits: 7-3).
 *                      Calculated in real-time, if bit range is too small
 * - Byte  1- 2:  NAME: Namespace Flag (bit: 15), Name (bits: 14-0)
 * - Byte     3:  NURI: Namespace URI
 * - Byte  4- 7:  DIST: Distance to parent node
 * - Byte  8-11:  SIZE: Number of descendants
 * TEXT, COMMENT, PI NODES (kind = 2, 4, 5):
 * - Byte  3- 7:  TEXT: Text reference
 * - Byte  8-11:  DIST: Distance to parent node
 * ATTRIBUTE NODES (kind = 3):
 * - Byte     0:  DIST: Distance to parent node (bits: 7-3)
 *                      Calculated in real-time, if bit range is too small
 * - Byte  1- 2:  NAME: Namespace Flag (bit: 15), Name (bits: 14-0)
 * - Byte  3- 7:  TEXT: Attribute value reference
 * - Byte    11:  NURI: Namespace (bits: 7-3)
 * 
* * As all methods of this class are optimized for performance, no checks are * performed on the arguments (e.g.: if the string value of a text node is * requested, the specified pre value must point to a text node). * * NOTE: the class is not thread-safe. It is imperative that all read/write accesses * are synchronized over a single context's read/write lock. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class Data { /** Node kind: document (code: {@code 0}). */ public static final byte DOC = 0x00; /** Node kind: element (code: {@code 1}). */ public static final byte ELEM = 0x01; /** Node kind: text (code: {@code 2}). */ public static final byte TEXT = 0x02; /** Node kind: attribute (code: {@code 3}). */ public static final byte ATTR = 0x03; /** Node kind: comment (code: {@code 4}). */ public static final byte COMM = 0x04; /** Node kind: processing instruction (code: {@code 5}). */ public static final byte PI = 0x05; /** Resource index. */ public final Resources resources = new Resources(this); /** Meta data. */ public MetaData meta; /** Tag index. */ public Names tagindex; /** Attribute name index. */ public Names atnindex; /** Namespace index. */ public Namespaces nspaces; /** Path summary index. */ public PathSummary paths; /** Text index. */ public Index txtindex; /** Attribute value index. */ public Index atvindex; /** Full-text index instance. */ public Index ftxindex; /** Number of current database users. */ public int pins = 1; /** Table access file. */ TableAccess table; /** ID->PRE mapping. */ IdPreMap idmap; /** States if distance caching is active. */ public boolean cache; /** * Closes the database. */ public abstract void close(); /** * Closes the specified index. * @param type index to be closed */ public abstract void closeIndex(IndexType type); /** * Assigns the specified index. * @param type index to be opened * @param index index instance */ public abstract void setIndex(IndexType type, Index index); /** * Starts an update operation: writes a file to disk to indicate that an update is * going on, and exclusively locks the table. * @return success flag */ public abstract boolean startUpdate(); /** * Finishes an update operation: removes the update file and the exclusive lock. */ public abstract void finishUpdate(); /** * Returns the indexed pre references for the specified token. * @param token index token reference * @return array of sorted pre values */ public final IndexIterator iter(final IndexToken token) { return index(token.type()).iter(token); } /** * Returns the number of indexed pre references for the specified token. * @param token text to be found * @return number of hits */ public final int count(final IndexToken token) { return index(token.type()).count(token); } /** * Returns info on the specified index structure. * @param type index type * @return info */ public final byte[] info(final IndexType type) { return index(type).info(); } /** * Returns the index reference for the specified index type. * @param type index type * @return index */ final Index index(final IndexType type) { switch(type) { case TAG: return tagindex; case ATTNAME: return atnindex; case TEXT: return txtindex; case ATTRIBUTE: return atvindex; case FULLTEXT: return ftxindex; case PATH: return paths; default: throw Util.notexpected(); } } /** * Returns an atomized content for any node kind. * The atomized value can be an attribute value or XML content. * @param pre pre value * @return atomized value */ public final byte[] atom(final int pre) { switch(kind(pre)) { case TEXT: case COMM: return text(pre, true); case ATTR: return text(pre, false); case PI: byte[] txt = text(pre, true); final int i = indexOf(txt, ' '); return i == -1 ? EMPTY : substring(txt, i + 1); default: // create atomized text node TokenBuilder tb = null; byte[] t = EMPTY; int p = pre; final int s = p + size(p, kind(p)); while(p != s) { final int k = kind(p); if(k == TEXT) { txt = text(p, true); if(t == EMPTY) { t = txt; } else { if(tb == null) tb = new TokenBuilder(t); tb.add(txt); } } p += attSize(p, k); } return tb == null ? t : tb.finish(); } } // RETRIEVING VALUES ======================================================== /** * Returns a pre value. * @param id unique node id * @return pre value or -1 if id was not found */ final int preold(final int id) { // find pre value in table for(int p = Math.max(0, id); p < meta.size; ++p) if(id == id(p)) return p; final int ps = Math.min(meta.size, id); for(int p = 0; p < ps; ++p) if(id == id(p)) return p; // id not found return -1; } /** * Returns a pre value. * @param id unique node id * @return pre value or -1 if id was not found */ public final int pre(final int id) { return meta.updindex ? idmap.pre(id) : preold(id); } /** * Returns pre values. * @param ids unique node ids * @param off start offset * @param len number of ids * @return sorted pre values */ public final int[] pre(final int[] ids, final int off, final int len) { if(meta.updindex) return idmap.pre(ids, off, len); final IntList p = new IntList(ids.length); for(int i = off; i < len; ++i) p.add(preold(ids[i])); return p.sort().toArray(); } /** * Returns a unique node id. * @param pre pre value * @return node id */ public final int id(final int pre) { return table.read4(pre, 12); } /** * Returns the node kind, which may be {@link #DOC}, {@link #ELEM}, {@link #TEXT}, * {@link #ATTR}, {@link #COMM} or {@link #PI}. * @param pre pre value * @return node kind */ public final int kind(final int pre) { return table.read1(pre, 0) & 0x07; } /** * Returns a pre value of the parent node. * @param pre pre value * @param kind node kind * @return pre value of the parent node */ public final int parent(final int pre, final int kind) { return pre - dist(pre, kind); } /** * Returns the distance of the specified node. * @param pre pre value * @param kind node kind * @return distance */ public int dist(final int pre, final int kind) { switch(kind) { case ELEM: return table.read4(pre, 4); case TEXT: case COMM: case PI: return table.read4(pre, 8); case ATTR: int d = table.read1(pre, 0) >> 3 & IO.MAXATTS; // skip additional attributes, if value is larger than maximum range if(d >= IO.MAXATTS) while(d < pre && kind(pre - d) == ATTR) d++; return d; default: return pre + 1; } } /** * Returns a size value (number of descendant table entries). * @param pre pre value * @param kind node kind * @return size value */ public final int size(final int pre, final int kind) { return kind == ELEM || kind == DOC ? table.read4(pre, 8) : 1; } /** * Returns a number of attributes. * @param pre pre value * @param kind node kind * @return number of attributes */ public final int attSize(final int pre, final int kind) { int s = kind == ELEM ? table.read1(pre, 0) >> 3 & IO.MAXATTS : 1; // skip additional attributes, if value is larger than maximum range if(s >= IO.MAXATTS) while(s < meta.size - pre && kind(pre + s) == ATTR) s++; return s; } /** * Finds the specified attribute and returns its value. * @param att the attribute id of the attribute to be found * @param pre pre value * @return attribute value */ public final byte[] attValue(final int att, final int pre) { final int a = pre + attSize(pre, kind(pre)); int p = pre; while(++p != a) if(name(p) == att) return text(p, false); return null; } /** * Returns a reference to the tag or attribute name id. * @param pre pre value * @return token reference */ public final int name(final int pre) { return table.read2(pre, 1) & 0x7FFF; } /** * Returns a tag, attribute or pi name. * @param pre pre value * @param kind node kind * @return name reference */ public final byte[] name(final int pre, final int kind) { if(kind == PI) { final byte[] name = text(pre, true); final int i = indexOf(name, ' '); return i == -1 ? name : substring(name, 0, i); } return (kind == ELEM ? tagindex : atnindex).key(name(pre)); } /** * Returns a reference to the namespace of the addressed element or attribute. * @param pre pre value * @param kind node kind * @return namespace URI */ public final int uri(final int pre, final int kind) { return kind == ELEM || kind == ATTR ? table.read1(pre, kind == ELEM ? 3 : 11) & 0xFF : 0; } /** * Returns the namespace flag of the addressed element. * @param pre pre value * @return namespace flag */ public final boolean nsFlag(final int pre) { return (table.read1(pre, 1) & 0x80) != 0; } /** * Returns all namespace keys and values. * Should be only called for element nodes. * @param pre pre value * @return key and value ids */ public final Atts ns(final int pre) { final Atts as = new Atts(); if(nsFlag(pre)) { final int[] nsp = nspaces.get(pre, this); for(int n = 0; n < nsp.length; n += 2) as.add(nspaces.prefix(nsp[n]), nspaces.uri(nsp[n + 1])); } return as; } /** * Returns the disk offset of a text (text, comment, pi) or attribute value. * @param pre pre value * @return disk offset */ final long textOff(final int pre) { return table.read5(pre, 3); } /** * Returns a text (text, comment, pi) or attribute value. * @param pre pre value * @param text text/attribute flag * @return atomized value */ public abstract byte[] text(int pre, boolean text); /** * Returns a text (text, comment, pi) or attribute value as integer value. * @param pre pre value * @param text text/attribute flag * @return numeric value */ public abstract long textItr(int pre, boolean text); /** * Returns a text (text, comment, pi) or attribute value as double value. * @param pre pre value * @param text text/attribute flag * @return numeric value */ public abstract double textDbl(int pre, boolean text); /** * Returns the byte length of a text (text, comment, pi). * @param pre pre value * @param text text/attribute flag * @return length */ public abstract int textLen(int pre, boolean text); // UPDATE OPERATIONS ======================================================== /** * Updates (renames) an element, attribute or pi name. * @param pre pre value * @param kind node kind * @param name new tag, attribute or pi name * @param uri uri */ public final void update(final int pre, final int kind, final byte[] name, final byte[] uri) { meta.update(); if(kind == PI) { updateText(pre, trim(concat(name, SPACE, atom(pre))), kind); } else { // update/set namespace reference final int ouri = nspaces.uri(name, pre, this); final boolean ne = ouri == 0 && uri.length != 0; final int npre = kind == ATTR ? parent(pre, kind) : pre; final int nuri = ne ? nspaces.add(npre, npre, prefix(name), uri, this) : ouri != 0 && eq(nspaces.uri(ouri), uri) ? ouri : 0; // write namespace uri reference table.write1(pre, kind == ELEM ? 3 : 11, nuri); // write name reference table.write2(pre, 1, (nsFlag(pre) ? 1 << 15 : 0) | (kind == ELEM ? tagindex : atnindex).index(name, null, false)); // write namespace flag table.write2(npre, 1, (ne || nsFlag(npre) ? 1 << 15 : 0) | name(npre)); } } /** * Updates (replaces) the value of a single document, text, comment, pi or * attribute node. * @param pre pre value to be replaced * @param kind node kind * @param value value to be updated (tag name, text, comment, pi) */ public final void update(final int pre, final int kind, final byte[] value) { final byte[] v = kind == PI ? trim(concat(name(pre, kind), SPACE, value)) : value; if(eq(v, text(pre, kind != ATTR))) return; meta.update(); updateText(pre, v, kind); if(kind == DOC) resources.rename(pre, value); } /** * Replaces parts of the database with the specified data instance. * @param tpre pre value of target node to be replaced * @param source clip with source data */ public final void replace(final int tpre, final DataClip source) { meta.update(); final int size = source.size(); final Data data = source.data; final int tkind = kind(tpre); final int tsize = size(tpre, tkind); final int tpar = parent(tpre, tkind); final int diff = size - tsize; buffer(size); resources.replace(tpre, tsize, source); if(meta.updindex) { // update index indexDelete(tpre, tsize); indexBegin(); } int sTopPre = source.start; for(int spre = sTopPre; spre < source.end; ++spre) { final int kind = data.kind(spre); // size and parent value of source node final int ssize = data.size(spre, kind); final int spar = data.parent(spre, kind); final int pre = tpre + spre - source.start; // calculate new distance value final int dist; if(spre == sTopPre) { // handle top level entry: calculate distance based on target database dist = pre - tpar; // calculate pre value of next top level entry sTopPre += ssize; } else { dist = spre - spar; } switch(kind) { case DOC: // add document doc(pre, ssize, data.text(spre, true)); meta.ndocs++; break; case ELEM: // add element byte[] nm = data.name(spre, kind); elem(dist, tagindex.index(nm, null, false), data.attSize(spre, kind), ssize, nspaces.uri(nm, true), false); break; case TEXT: case COMM: case PI: // add text text(pre, dist, data.text(spre, true), kind); break; case ATTR: // add attribute nm = data.name(spre, kind); attr(pre, dist, atnindex.index(nm, null, false), data.text(spre, false), nspaces.uri(nm, false), false); break; } } if(meta.updindex) { indexEnd(); // update ID -> PRE map: idmap.delete(tpre, id(tpre), -tsize); idmap.insert(tpre, meta.lastid - size + 1, size); } // update table: table.replace(tpre, buffer(), tsize); buffer(1); // no distance/size update if the two subtrees are of equal size if(diff == 0) return; // increase/decrease size of ancestors, adjust distances of siblings int p = tpar; while(p >= 0) { final int k = kind(p); size(p, k, size(p, k) + diff); p = parent(p, k); } if(!cache) updateDist(tpre + size, diff); // adjust attribute size of parent if attributes inserted. attribute size // of parent cannot be reduced via a replace expression. int spre = source.start; if(data.kind(spre) == ATTR) { int d = 0; while(spre < source.end && data.kind(spre++) == ATTR) d++; if(d > 1) attSize(tpar, kind(tpar), d + 1); } } /** * Deletes a node and its descendants. * @param pre pre value of the node to delete */ public final void delete(final int pre) { meta.update(); // size of the subtree to delete int k = kind(pre); final int s = size(pre, k); resources.delete(pre, s); if(meta.updindex) { // delete child records from indexes indexDelete(pre, s); } /// explicitly delete text or attribute value if(k != DOC && k != ELEM) delete(pre, k != ATTR); // reduce size of ancestors int par = pre; // check if we are an attribute (different size counters) if(k == ATTR) { par = parent(par, ATTR); attSize(par, ELEM, attSize(par, ELEM) - 1); size(par, ELEM, size(par, ELEM) - 1); k = kind(par); } // reduce size of ancestors while(par > 0 && k != DOC) { par = parent(par, k); k = kind(par); size(par, k, size(par, k) - s); } // preserve empty root node if(kind(pre) == DOC) --meta.ndocs; if(meta.updindex) { // delete node and descendants from ID -> PRE map: idmap.delete(pre, id(pre), -s); } // delete node from table structure and reduce document size table.delete(pre, s); if(!cache) updateDist(pre, -s); // propagate PRE value shifts to namespaces nspaces.delete(pre, s, this); } /** * Inserts attributes. * @param pre pre value * @param par parent of node * @param source clip with source data */ public final void insertAttr(final int pre, final int par, final DataClip source) { insert(pre, par, source); attSize(par, ELEM, attSize(par, ELEM) + source.size()); } /** * Inserts a data instance at the specified pre value. * Note that the specified data instance must differ from this instance. * @param tpre target pre value * @param tpar target parent pre value of node ({@code -1} if document is added) * @param source clip with source data */ public final void insert(final int tpre, final int tpar, final DataClip source) { meta.update(); // update value and document indexes if(meta.updindex) indexBegin(); resources.insert(tpre, source); final int size = source.size(); final int buf = Math.min(size, IO.BLOCKSIZE >> IO.NODEPOWER); // resize buffer to cache more entries buffer(buf); // find all namespaces in scope to avoid duplicate declarations final TokenMap nsScope = nspaces.scope(tpar, this); // loop through all entries final IntList preStack = new IntList(); final NSNode nsRoot = nspaces.current(); final HashSet newNodes = new HashSet(); final IntList flagPres = new IntList(); // indicates if database only contains a dummy node final Data data = source.data; int c = 0, sTopPre = source.start; for(int spre = sTopPre; spre < source.end; ++spre, ++c) { if(c != 0 && c % buf == 0) insert(tpre + c - buf); final int pre = tpre + c; final int kind = data.kind(spre); // size and parent value of source node final int ssize = data.size(spre, kind); final int spar = data.parent(spre, kind); // calculate new distance value final int dist; if(spre == sTopPre) { // handle top level entry: calculate distance based on target database dist = pre - tpar; // calculate pre value of next top level entry sTopPre += ssize; } else { // handle descendant node: calculate distance based on source database dist = spre - spar; } // documents: use -1 as namespace root final int nsPre = kind == Data.DOC ? -1 : pre - dist; if(c == 0) nspaces.root(nsPre, this); while(!preStack.isEmpty() && preStack.peek() > nsPre) nspaces.close(preStack.pop()); switch(kind) { case DOC: // add document nspaces.prepare(); doc(pre, ssize, data.text(spre, true)); meta.ndocs++; preStack.push(pre); break; case ELEM: // add element nspaces.prepare(); boolean ne = false; if(data.nsFlag(spre)) { final Atts at = data.ns(spre); for(int a = 0; a < at.size(); ++a) { // see if prefix has been declared/ is part of current ns scope final byte[] old = nsScope.get(at.name(a)); if(old == null || !eq(old, at.value(a))) { // we have to keep track of all new NSNodes that are added // to the Namespace structure, as their pre values must not // be updated. I.e. if an NSNode N with pre value 3 existed // prior to inserting and two new nodes are inserted at // location pre == 3 we have to make sure N and only N gets // updated. newNodes.add(nspaces.add(at.name(a), at.value(a), pre)); ne = true; } } } byte[] nm = data.name(spre, kind); elem(dist, tagindex.index(nm, null, false), data.attSize(spre, kind), ssize, nspaces.uri(nm, true), ne); preStack.push(pre); break; case TEXT: case COMM: case PI: // add text text(pre, dist, data.text(spre, true), kind); break; case ATTR: // add attribute nm = data.name(spre, kind); // check if prefix already in nsScope or not final byte[] attPref = prefix(nm); // check if prefix of attribute has already been declared, otherwise // add declaration to parent node if(data.nsFlag(spre) && nsScope.get(attPref) == null) { nspaces.add(nsPre, preStack.isEmpty() ? -1 : preStack.peek(), attPref, data.nspaces.uri(data.uri(spre, kind)), this); // save pre value to set ns flag later for this node. can't be done // here as direct table access would interfere with the buffer flagPres.add(nsPre); } attr(pre, dist, atnindex.index(nm, null, false), data.text(spre, false), nspaces.uri(nm, false), false); break; } } // finalize and update namespace structure while(!preStack.isEmpty()) nspaces.close(preStack.pop()); nspaces.root(nsRoot); if(bp != 0) insert(tpre + c - 1 - (c - 1) % buf); // reset buffer to old size buffer(1); // set ns flags for(int f = 0; f < flagPres.size(); f++) { final int fl = flagPres.get(f); table.write2(fl, 1, name(fl) | 1 << 15); } // increase size of ancestors int p = tpar; while(p >= 0) { final int k = kind(p); size(p, k, size(p, k) + size); p = parent(p, k); } if(meta.updindex) { // add the entries to the ID -> PRE mapping: idmap.insert(tpre, id(tpre), size); indexEnd(); } if(!cache) updateDist(tpre + size, size); // propagate PRE value shifts to namespaces if(tpar != -1) nspaces.insert(tpre, size, newNodes); } /** * This method updates the distance values of the specified pre value * and the following siblings of all ancestor-or-self nodes. * @param pre root node * @param size size to be added/removed */ private void updateDist(final int pre, final int size) { int p = pre; while(p < meta.size) { final int k = kind(p); if(k == DOC) break; dist(p, k, dist(p, k) + size); p += size(p, k); } } /** * Sets the size value. * @param pre pre reference * @param kind node kind * @param value value to be stored */ public final void size(final int pre, final int kind, final int value) { if(kind == ELEM || kind == DOC) table.write4(pre, 8, value); } /** * Sets the disk offset of a text/attribute value. * @param pre pre value * @param off offset */ final void textOff(final int pre, final long off) { table.write5(pre, 3, off); } /** * Updates the specified text or attribute value. * @param pre pre value * @param value content * @param kind node kind */ protected abstract void updateText(final int pre, final byte[] value, final int kind); /** * Sets the distance. * @param pre pre value * @param kind node kind * @param value value */ public void dist(final int pre, final int kind, final int value) { if(kind == ATTR) table.write1(pre, 0, value << 3 | ATTR); else if(kind != DOC) table.write4(pre, kind == ELEM ? 4 : 8, value); } /** * Sets the attribute size. * @param pre pre value * @param kind node kind * @param value value */ private void attSize(final int pre, final int kind, final int value) { // the magic value 31 is used to signal that there are 31 or more attributes if(kind == ELEM) table.write1(pre, 0, Math.min(value, IO.MAXATTS) << 3 | ELEM); } /** * Sets the namespace flag. * Should be only called for element nodes. * @param pre pre value * @param ne namespace flag */ public final void nsFlag(final int pre, final boolean ne) { table.write1(pre, 1, table.read1(pre, 1) & 0x7F | (ne ? 0x80 : 0)); } /** * Inserts the internal buffer to the storage * without updating the table structure. * @param pre insert position */ public final void insert(final int pre) { table.insert(pre, buffer()); } /** * Deletes the specified text entry. * @param pre pre value * @param text text (text, comment or pi) or attribute flag */ protected abstract void delete(final int pre, final boolean text); // INSERTS WITHOUT TABLE UPDATES ============================================ /** Buffer for caching new table entries. */ private byte[] b = new byte[IO.NODESIZE]; /** Buffer position. */ private int bp; /** * Sets the update buffer to a new size. * @param size number of table entries */ final void buffer(final int size) { final int bs = size << IO.NODEPOWER; if(b.length != bs) b = new byte[bs]; } /** * Adds a document entry to the internal update buffer. * @param pre pre value * @param size node size * @param value document name */ public final void doc(final int pre, final int size, final byte[] value) { final int i = newID(); final long v = index(pre, i, value, DOC); s(DOC); s(0); s(0); s(v >> 32); s(v >> 24); s(v >> 16); s(v >> 8); s(v); s(size >> 24); s(size >> 16); s(size >> 8); s(size); s(i >> 24); s(i >> 16); s(i >> 8); s(i); } /** * Adds an element entry to the internal update buffer. * @param dist parent distance * @param name tag name index * @param asize number of attributes * @param size node size * @param uri namespace uri reference * @param ne namespace flag */ public final void elem(final int dist, final int name, final int asize, final int size, final int uri, final boolean ne) { // build and insert new entry final int i = newID(); final int n = ne ? 1 << 7 : 0; s(Math.min(IO.MAXATTS, asize) << 3 | ELEM); s(n | (byte) (name >> 8)); s(name); s(uri); s(dist >> 24); s(dist >> 16); s(dist >> 8); s(dist); s(size >> 24); s(size >> 16); s(size >> 8); s(size); s(i >> 24); s(i >> 16); s(i >> 8); s(i); } /** * Adds a text entry to the internal update buffer. * @param pre pre value * @param dist parent distance * @param value string value * @param kind node kind */ public final void text(final int pre, final int dist, final byte[] value, final int kind) { // build and insert new entry final int i = newID(); final long v = index(pre, i, value, kind); s(kind); s(0); s(0); s(v >> 32); s(v >> 24); s(v >> 16); s(v >> 8); s(v); s(dist >> 24); s(dist >> 16); s(dist >> 8); s(dist); s(i >> 24); s(i >> 16); s(i >> 8); s(i); } /** * Adds an attribute entry to the internal update buffer. * @param pre pre value * @param dist parent distance * @param name attribute name * @param value attribute value * @param uri namespace uri reference * @param ne namespace flag (only {@code true} if this is a stand-alone attribute) */ public final void attr(final int pre, final int dist, final int name, final byte[] value, final int uri, final boolean ne) { // add attribute to text storage final int i = newID(); final long v = index(pre, i, value, ATTR); final int n = ne ? 1 << 7 : 0; s(Math.min(IO.MAXATTS, dist) << 3 | ATTR); s(n | (byte) (name >> 8)); s(name); s(v >> 32); s(v >> 24); s(v >> 16); s(v >> 8); s(v); s(0); s(0); s(0); s(uri); s(i >> 24); s(i >> 16); s(i >> 8); s(i); } /** * Stores the specified value in the update buffer. * @param value value to be stored */ private void s(final int value) { b[bp++] = (byte) value; } /** * Generates a new id. * @return id */ private int newID() { return ++meta.lastid; } /** * Stores the specified value in the update buffer. * @param value value to be stored */ private void s(final long value) { b[bp++] = (byte) value; } /** * Returns the byte buffer. * @return byte buffer */ private byte[] buffer() { final byte[] bb = bp == b.length ? b : Arrays.copyOf(b, bp); bp = 0; return bb; } /** * Indexes a text and returns the reference. * @param pre pre value * @param id id value * @param value text to be indexed * @param kind node kind * @return reference */ protected abstract long index(final int pre, final int id, final byte[] value, final int kind); /** Notify the index structures that an update operation is started. */ void indexBegin() { } /** Notify the index structures that an update operation is finished. */ void indexEnd() { } /** * Delete a node and its descendants from the corresponding indexes. * @param pre pre value of the node to delete * @param size number of descendants */ protected abstract void indexDelete(final int pre, final int size); // HELPER FUNCTIONS =================================================================== /** * Indicates if this data instance is in main memory or on disk. * @return result of check */ public final boolean inMemory() { return this instanceof MemData; } /** * Returns a string representation of the specified table range. Can be called * for debugging. * @param start start pre value * @param end end pre value * @return table */ final String toString(final int start, final int end) { return string(InfoStorage.table(this, start, end)); } @Override public final String toString() { final int max = 20; return meta.size > max ? toString(0, max) + "..." : toString(0, meta.size); } } basex-7.7.2/basex-core/src/main/java/org/basex/data/DataText.java000066400000000000000000000210621222453003200244720ustar00rootroot00000000000000package org.basex.data; import static org.basex.util.Token.*; /** * This class assembles texts which are used in the data classes. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public interface DataText { // META DATA ================================================================ /** Database version; if it's modified, old database instances can't * be parsed anymore. */ String STORAGE = "7.1"; /** Index version; if it's modified, new indexes can't be parsed anymore * by older versions. */ String ISTORAGE = "7.1"; /** Database version. */ String DBSTR = "STORAGE"; /** Database version. */ String IDBSTR = "ISTORAGE"; /** Last modification time. */ String DBTIME = "TIME"; /** Number of nodes. */ String DBSIZE = "SIZE"; /** Path to original document. */ String DBFNAME = "FNAME"; /** File size. */ String DBFSIZE = "FSIZE"; /** Number of documents. */ String DBNDOCS = "NDOCS"; /** Encoding. */ String DBENC = "ENCODING"; /** Whitespace chopping. */ String DBCHOP = "CHOPPED"; /** Path indexing. */ String DBPTHIDX = "PTHINDEX"; /** Automatic index update. */ String DBUPDIDX = "UPDINDEX"; /** Text indexing. */ String DBTXTIDX = "TXTINDEX"; /** Attribute indexing. */ String DBATVIDX = "ATVINDEX"; /** Full-text indexing. */ String DBFTXIDX = "FTXINDEX"; /** Full-text stemming. */ String DBFTST = "FTSTEM"; /** Full-text language. */ String DBFTLN = "FTLANG"; /** Full-text stopwords. */ String DBFTSW = "FTSTOP"; /** Full-text case sensitivity. */ String DBFTCS = "FTCS"; /** Full-text diacritics removal. */ String DBFTDC = "FTDC"; /** Maximum token length. */ String DBMAXLEN = "MAXLEN"; /** Maximum number of categories. */ String DBMAXCATS = "MAXCATS"; /** Up-to-date flag. */ String DBUPTODATE = "UPTODATE"; /** Last (highest) id. */ String DBLASTID = "LASTID"; /** Permissions. */ String DBPERM = "PERM"; /** Documents. */ String DBDOCS = "DOCS"; /** Text indexing. */ String DBCRTTXT = "CRTTXT"; /** Attribute indexing. */ String DBCRTATV = "CRTATV"; /** Full-text indexing. */ String DBCRTFTX = "CRTFTX"; /** Full-text wildcards indexing (legacy, obsolete). */ String DBWCIDX = "WCINDEX"; /** Scoring type (legacy, obsolete). */ String DBSCTYPE = "FTSCTYPE"; /** Tags. */ String DBTAGS = "TAGS"; /** Attributes. */ String DBATTS = "ATTS"; /** Path summary. */ String DBPATH = "PATH"; /** Namespace. */ String DBNS = "NS"; // DATABASE FILES =========================================================== /** Database - Info. */ String DATAINF = "inf"; /** Database - Tokens. */ String DATATBL = "tbl"; /** Database - Temporary Size References. */ String DATATMP = "tmp"; /** Database - Text index. */ String DATATXT = "txt"; /** Database - Attribute value index. */ String DATAATV = "atv"; /** Database - Full-text index. */ String DATAFTX = "ftx"; /** Database - Stopword list. */ String DATASWL = "swl"; /** Database - Updating flag. */ String DATAUPD = "upd"; // XML SERIALIZATION ======================================================== /** Omit flag. */ String OMIT = "omit"; /** NL flag. */ String S_NL = "\\n"; /** CR flag. */ String S_CR = "\\r"; /** CRNL flag. */ String S_CRNL = "\\r\\n"; /** Version. */ String V10 = "1.0"; /** Version. */ String V11 = "1.1"; /** Version. */ String V40 = "4.0"; /** Version. */ String V401 = "4.01"; /** Version. */ String V50 = "5.0"; /** Method. */ String M_CSV = "csv"; /** Method. */ String M_MAB2 = "mab2"; /** Method. */ String M_XML = "xml"; /** Method. */ String M_XHTML = "xhtml"; /** Method. */ String M_HTML = "html"; /** Method. */ String M_TEXT = "text"; /** Method. */ String M_JSON = "json"; /** Method. */ String M_JSONML = "jsonml"; /** Method. */ String M_RAW = "raw"; /** Methods. */ String[] METHODS = { M_XML, M_XHTML, M_HTML, M_TEXT, M_JSON, M_JSONML, M_CSV, M_RAW }; /** Normalization. */ String NFC = "NFC"; /** Normalization. */ String NONE = "none"; /** Document declaration. */ String DOCDECL1 = "xml version=\""; /** Document declaration. */ String DOCDECL2 = "\" encoding=\""; /** Document declaration. */ String DOCDECL3 = "\" standalone=\""; /** Doctype output. */ String DOCTYPE = ""); /** XQuery comment. */ byte[] XQCOMM_O = token("(:"); /** XQuery comment. */ byte[] XQCOMM_C = token(":)"); /** PI output. */ byte[] PI_O = token(""); /** Element output. */ byte[] ELEM_O = { '<' }; /** Element output. */ byte[] ELEM_C = { '>' }; /** Element output. */ byte[] ELEM_OS = token(""); /** Attribute output. */ byte[] ATT1 = token("=\""); /** Attribute output. */ byte[] ATT2 = token("\""); /** Document output. */ byte[] DOC = token("doc()"); /** Text output. */ byte[] TEXT = token("text()"); /** Comment output. */ byte[] COMM = token("comment()"); /** Processing instruction output. */ byte[] PI = token("processing-instruction()"); /** Attribute output. */ byte[] ATT = { '@' }; /** CDATA output. */ byte[] CDATA_O = token(""); /** XML spaces: element name. */ byte[] XML_SPACE = token("xml:space"); /** XML spaces: default. */ byte[] DEFAULT = token("default"); /** XML spaces: preserve. */ byte[] PRESERVE = token("preserve"); /** HTML: head element. */ byte[] HEAD = token("head"); /** HTML: meta element. */ byte[] META = token("meta"); /** HTML: http-equiv attribute. */ byte[] HTTPEQUIV = token("http-equiv"); /** HTML: content attribute. */ byte[] CONTENT = token("content"); /** HTML: charset attribute value. */ byte[] CHARSET = token("; charset="); // ERRORS =================================================================== /** Serialization error. */ String SERVAL = "Parameter '%' must be [%"; /** Serialization error. */ String SERVAL2 = "|%"; /** Serialization error. */ String SERVAL3 = "]; '%' found"; // TABLE SERIALIZATION ====================================================== /** First table Header. */ byte[] TABLEID = token("ID"); /** First table Header. */ byte[] TABLEPRE = token("PRE"); /** Second table Header. */ byte[] TABLEDIST = token("DIS"); /** Third table Header. */ byte[] TABLESIZE = token("SIZ"); /** Fourth table Header. */ byte[] TABLEATS = token("ATS"); /** Fifth table Header. */ byte[] TABLEKND = token("KIND"); /** Sixth table Header. */ byte[] TABLECON = token("CONTENT"); /** Namespace header. */ byte[] TABLENS = token("NS"); /** Prefix header. */ byte[] TABLEPREF = token("PREF"); /** URI header. */ byte[] TABLEURI = token("URI"); /** Table kinds. */ byte[][] TABLEKINDS = tokens("DOC ", "ELEM", "TEXT", "ATTR", "COMM", "PI "); /** Database - ID->PRE mapping. */ String DATAIDP = "idp"; } basex-7.7.2/basex-core/src/main/java/org/basex/data/DiskData.java000066400000000000000000000305311222453003200244410ustar00rootroot00000000000000package org.basex.data; import static org.basex.data.DataText.*; import static org.basex.util.Token.*; import java.io.*; import org.basex.build.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.index.*; import org.basex.index.ft.*; import org.basex.index.name.*; import org.basex.index.path.*; import org.basex.index.value.*; import org.basex.io.*; import org.basex.io.in.DataInput; import org.basex.io.out.DataOutput; import org.basex.io.random.*; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * This class stores and organizes the database table and the index structures * for textual content in a compressed disk structure. * The table mapping is documented in {@link Data}. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Tim Petrowsky */ public final class DiskData extends Data { /** Text compressor. */ private static final ThreadLocal COMP = new ThreadLocal() { @Override protected Compress initialValue() { return new Compress(); } }; /** Texts access file. */ private DataAccess texts; /** Values access file. */ private DataAccess values; /** Texts buffered for subsequent index updates. */ private TokenObjMap txts; /** Attribute values buffered for subsequent index updates. */ private TokenObjMap atvs; /** Closed flag. */ private boolean closed; /** * Default constructor, called from {@link Open#open}. * @param db name of database * @param ctx database context * @throws IOException I/O Exception */ public DiskData(final String db, final Context ctx) throws IOException { meta = new MetaData(db, ctx); // don't open databases marked as updating if(updateFile().exists()) throw new BaseXException(Text.DB_UPDATED_X, meta.name); final DataInput in = new DataInput(meta.dbfile(DATAINF)); try { // read meta data and indexes meta.read(in); while(true) { final String k = string(in.readToken()); if(k.isEmpty()) break; if(k.equals(DBTAGS)) tagindex = new Names(in, meta); else if(k.equals(DBATTS)) atnindex = new Names(in, meta); else if(k.equals(DBPATH)) paths = new PathSummary(this, in); else if(k.equals(DBNS)) nspaces = new Namespaces(in); else if(k.equals(DBDOCS)) resources.read(in); } } finally { in.close(); } // open data and indexes if(meta.updindex) { idmap = new IdPreMap(meta.dbfile(DATAIDP)); if(meta.textindex) txtindex = new UpdatableDiskValues(this, true); if(meta.attrindex) atvindex = new UpdatableDiskValues(this, false); } else { if(meta.textindex) txtindex = new DiskValues(this, true); if(meta.attrindex) atvindex = new DiskValues(this, false); } if(meta.ftxtindex) ftxindex = new FTIndex(this); init(); } /** * Internal database constructor, called from {@link DiskBuilder#build}. * @param md meta data * @param nm tags * @param at attributes * @param ps path summary * @param n namespaces * @throws IOException I/O Exception */ public DiskData(final MetaData md, final Names nm, final Names at, final PathSummary ps, final Namespaces n) throws IOException { meta = md; tagindex = nm; atnindex = at; paths = ps; paths.data(this); nspaces = n; if(meta.updindex) idmap = new IdPreMap(meta.lastid); init(); } /** * Initializes the database. * @throws IOException I/O exception */ public void init() throws IOException { table = new TableDiskAccess(meta, false); texts = new DataAccess(meta.dbfile(DATATXT)); values = new DataAccess(meta.dbfile(DATAATV)); } /** * Writes all meta data to disk. * @throws IOException I/O exception */ private void write() throws IOException { if(meta.dirty) { final DataOutput out = new DataOutput(meta.dbfile(DATAINF)); meta.write(out); out.writeToken(token(DBTAGS)); tagindex.write(out); out.writeToken(token(DBATTS)); atnindex.write(out); out.writeToken(token(DBPATH)); paths.write(out); out.writeToken(token(DBNS)); nspaces.write(out); out.writeToken(token(DBDOCS)); resources.write(out); out.write(0); out.close(); if(idmap != null) idmap.write(meta.dbfile(DATAIDP)); meta.dirty = false; } // in all cases, remove updating file updateFile().delete(); } @Override public synchronized void close() { if(closed) return; closed = true; try { write(); table.close(); texts.close(); values.close(); closeIndex(IndexType.TEXT); closeIndex(IndexType.ATTRIBUTE); closeIndex(IndexType.FULLTEXT); } catch(final IOException ex) { Util.stack(ex); } } @Override public synchronized void closeIndex(final IndexType type) { // close existing index final Index index = index(type); if(index == null) return; index.close(); // invalidate index reference meta.dirty = true; switch(type) { case TEXT: txtindex = null; break; case ATTRIBUTE: atvindex = null; break; case FULLTEXT: ftxindex = null; break; default: break; } } @Override public void setIndex(final IndexType type, final Index index) { meta.dirty = true; switch(type) { case TEXT: txtindex = index; break; case ATTRIBUTE: atvindex = index; break; case FULLTEXT: ftxindex = index; break; default: break; } } @Override public boolean startUpdate() { final IOFile uf = updateFile(); return (uf.exists() || uf.touch()) && table.lock(true); } @Override public synchronized void finishUpdate() { // skip all flush operations if auto flush is off, or file has already been closed if(!meta.prop.is(Prop.AUTOFLUSH) || closed) return; try { write(); table.flush(); texts.flush(); values.flush(); if(txtindex != null) ((DiskValues) txtindex).flush(); if(atvindex != null) ((DiskValues) atvindex).flush(); } catch(final IOException ex) { Util.stack(ex); } finally { table.lock(false); } } /** * Returns a file that indicates ongoing updates. * @return updating file */ public IOFile updateFile() { return meta.dbfile(DATAUPD); } @Override public byte[] text(final int pre, final boolean text) { final long o = textOff(pre); return num(o) ? token((int) o) : txt(o, text); } @Override public long textItr(final int pre, final boolean text) { final long o = textOff(pre); return num(o) ? o & IO.OFFNUM - 1 : toLong(txt(o, text)); } @Override public double textDbl(final int pre, final boolean text) { final long o = textOff(pre); return num(o) ? o & IO.OFFNUM - 1 : toDouble(txt(o, text)); } @Override public int textLen(final int pre, final boolean text) { final long o = textOff(pre); if(num(o)) return numDigits((int) o); final DataAccess da = text ? texts : values; final int l = da.readNum(o & IO.OFFCOMP - 1); // compressed: next number contains number of compressed bytes return cpr(o) ? da.readNum() : l; } /** * Returns a text (text, comment, pi) or attribute value. * @param o text offset * @param text text or attribute flag * @return text */ private byte[] txt(final long o, final boolean text) { final byte[] txt = (text ? texts : values).readToken(o & IO.OFFCOMP - 1); return cpr(o) ? COMP.get().unpack(txt) : txt; } /** * Returns true if the specified value contains a number. * @param o offset * @return result of check */ private static boolean num(final long o) { return (o & IO.OFFNUM) != 0; } /** * Returns true if the specified value references a compressed token. * @param o offset * @return result of check */ private static boolean cpr(final long o) { return (o & IO.OFFCOMP) != 0; } // UPDATE OPERATIONS ======================================================== @Override protected void delete(final int pre, final boolean text) { // old entry (offset or value) final long old = textOff(pre); // fill unused space with zero-bytes if(!num(old)) (text ? texts : values).free(old & IO.OFFCOMP - 1, 0); } @Override protected void updateText(final int pre, final byte[] value, final int kind) { final boolean text = kind != ATTR; if(meta.updindex) { // update indexes final int id = id(pre); final byte[] oldval = text(pre, text); final DiskValues index = (DiskValues) (text ? txtindex : atvindex); // don't index document names if(index != null && kind != DOC) index.replace(oldval, value, id); } // reference to text store final DataAccess store = text ? texts : values; // file length final long len = store.length(); // new entry (offset or value) final long v = toSimpleInt(value); // flag for inlining numeric value final boolean vn = v != Integer.MIN_VALUE; // text to be stored (null if value will be inlined) final byte[] vl = vn ? null : COMP.get().pack(value); // old entry (offset or value) final long old = textOff(pre); // find text store offset final long off; if(num(old)) { // numeric entry: append new entry at the end off = len; } else { // text size (0 if value will be inlined) final int l = vn ? 0 : vl.length + Num.length(vl.length); off = store.free(old & IO.OFFCOMP - 1, l); } // store new entry if(vn) { // inline integer value textOff(pre, v | IO.OFFNUM); } else { store.writeToken(off, vl); textOff(pre, vl == value ? off : off | IO.OFFCOMP); } } @Override protected void indexBegin() { txts = new TokenObjMap(); atvs = new TokenObjMap(); } @Override protected void indexEnd() { if(!txts.isEmpty()) ((DiskValues) txtindex).index(txts); if(!atvs.isEmpty()) ((DiskValues) atvindex).index(atvs); } @Override protected long index(final int pre, final int id, final byte[] value, final int kind) { final DataAccess store; final TokenObjMap m; if(kind == ATTR) { store = values; m = meta.attrindex ? atvs : null; } else { store = texts; // don't index document names m = meta.textindex && kind != DOC ? txts : null; } // add text to map to index later if(meta.updindex && m != null && value.length <= meta.maxlen) { IntList ids = m.get(value); if(ids == null) { ids = new IntList(1); m.put(value, ids); } ids.add(id); } // add text to text file // inline integer value... final long v = toSimpleInt(value); if(v != Integer.MIN_VALUE) return v | IO.OFFNUM; // store text final long off = store.length(); final byte[] val = COMP.get().pack(value); store.writeToken(off, val); return val == value ? off : off | IO.OFFCOMP; } @Override protected void indexDelete(final int pre, final int size) { if(!(meta.textindex || meta.attrindex)) return; // collect all keys and ids txts = new TokenObjMap(); atvs = new TokenObjMap(); final int l = pre + size; for(int p = pre; p < l; ++p) { final int k = kind(p); final boolean isAttr = k == ATTR; // consider nodes which are attribute, text, comment, or proc. instruction if(meta.attrindex && isAttr || meta.textindex && (k == TEXT || k == COMM || k == PI)) { final byte[] key = text(p, !isAttr); if(key.length <= meta.maxlen) { final TokenObjMap m = isAttr ? atvs : txts; IntList ids = m.get(key); if(ids == null) { ids = new IntList(1); m.put(key, ids); } ids.add(id(p)); } } } if(!txts.isEmpty()) ((DiskValues) txtindex).delete(txts); if(!atvs.isEmpty()) ((DiskValues) atvindex).delete(atvs); } } basex-7.7.2/basex-core/src/main/java/org/basex/data/ExprInfo.java000066400000000000000000000050331222453003200245060ustar00rootroot00000000000000package org.basex.data; import org.basex.query.value.node.*; import org.basex.util.*; /** * Expression information, used for debugging and logging. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class ExprInfo { /** * Returns a string description of the expression. This method is only * called by error messages. Contrary to the {@link #toString()} method, * arguments are not included in the output. * @return result of check */ public String description() { return Token.string(info()) + " expression"; } /** * Returns the simplified class name. * @return class name */ public byte[] info() { return Token.token(Util.name(this)); } @Override public abstract String toString(); /** * Creates an expression tree. * @param e root element */ public abstract void plan(FElem e); /** * Creates a new element node to be added to the expression tree. * @param atts optional attribute names and values * @return tree node */ protected FElem planElem(final Object... atts) { final FElem el = new FElem(info()); for(int a = 0; a < atts.length - 1; a += 2) { if(atts[a + 1] != null) el.add(planAttr(atts[a], atts[a + 1])); } return el; } /** * Adds trees of the specified expressions to the root node. * @param plan root node * @param el new element * @param expr expressions */ protected void addPlan(final FElem plan, final FElem el, final Object... expr) { plan.add(el); for(final Object o : expr) { if(o instanceof ExprInfo) { ((ExprInfo) o).plan(el); } else if(o instanceof ExprInfo[]) { for(final ExprInfo e : (ExprInfo[]) o) { if(e != null) e.plan(el); } } else if(o instanceof byte[]) { el.add((byte[]) o); } else if(o != null) { el.add(o.toString()); } } } /** * Adds trees of the specified expressions to the root node. * @param plan root node * @param el new element * @param expr expressions */ protected void addPlan(final FElem plan, final FElem el, final ExprInfo... expr) { addPlan(plan, el, (Object) expr); } /** * Creates a new attribute to be added to the expression tree. * @param n name of attribute * @param v value of attribute * @return tree node */ protected FAttr planAttr(final Object n, final Object v) { return new FAttr(Util.inf(n), Util.inf(v)); } } basex-7.7.2/basex-core/src/main/java/org/basex/data/FTMatch.java000066400000000000000000000050001222453003200242340ustar00rootroot00000000000000package org.basex.data; import java.util.*; import org.basex.util.*; import org.basex.util.list.*; /** * Match full-text container, referencing several {@link FTStringMatch} instances. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FTMatch extends ElementList implements Iterable { /** String matches. */ FTStringMatch[] match; /** * Constructor. */ public FTMatch() { this(0); } /** * Constructor, specifying an initial internal array size. * @param capacity initial array capacity */ public FTMatch(final int capacity) { match = new FTStringMatch[capacity]; } /** * Adds a all matches of a full-text match. * @param mtc match to be added * @return self reference */ public FTMatch add(final FTMatch mtc) { for(final FTStringMatch m : mtc) add(m); return this; } /** * Adds a string match. * @param m match to be added * @return self reference */ public FTMatch add(final FTStringMatch m) { if(size == match.length) match = Array.copy(match, new FTStringMatch[newSize()]); match[size++] = m; return this; } /** * Checks if the full-text match is not part of the specified match. * @param mtc match to be checked * @return result of check */ public boolean notin(final FTMatch mtc) { for(final FTStringMatch s : this) { for(final FTStringMatch m : mtc) if(!s.in(m)) return true; } return false; } /** * Checks if the match contains no string excludes. * @return result of check */ boolean match() { for(final FTStringMatch s : this) if(s.ex) return false; return true; } /** * Sorts the matches. */ public void sort() { Arrays.sort(match, 0, size, null); } /** * Creates a deep copy of this container. * @return copy */ protected FTMatch copy() { final FTMatch ftm = new FTMatch(); ftm.size = size; ftm.match = match.clone(); for(int i = 0; i < ftm.match.length; i++) if(ftm.match[i] != null) ftm.match[i] = ftm.match[i].copy(); return ftm; } @Override public Iterator iterator() { return new ArrayIterator(match, size); } @Override public String toString() { final StringBuilder sb = new StringBuilder(Util.name(this)); for(final FTStringMatch s : this) sb.append(' ').append(s); return sb.toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/data/FTMatches.java000066400000000000000000000063571222453003200246040ustar00rootroot00000000000000package org.basex.data; import java.util.*; import org.basex.util.*; import org.basex.util.list.*; /** * AllMatches full-text container, referencing several {@link FTMatch} instances. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FTMatches extends ElementList implements Iterable { /** Full-text matches. */ public FTMatch[] match = {}; /** Current number of tokens. */ public int sTokenNum; /** * Constructor. * @param s sets the token number */ public FTMatches(final int s) { reset(s); } /** * Resets the match counter. * @param s sets the token number */ public void reset(final int s) { sTokenNum = s; size = 0; } /** * Adds a match entry. * @param p position */ public void or(final int p) { or(p, p); } /** * Adds a match entry. * @param s start position * @param e end position */ public void or(final int s, final int e) { add(new FTMatch(1).add(new FTStringMatch(s, e, sTokenNum))); } /** * Adds a match entry. * @param s start position * @param e end position */ public void and(final int s, final int e) { final FTStringMatch sm = new FTStringMatch(s, e, sTokenNum); for(final FTMatch m : this) m.add(sm); } /** * Adds a match entry. * @param m match to be added */ public void add(final FTMatch m) { if(size == match.length) match = Array.copy(match, new FTMatch[Array.newSize(size)]); match[size++] = m; } /** * Removes the specified match. * @param i match offset */ public void delete(final int i) { Array.move(match, i + 1, -1, --size - i); } /** * Checks if at least one of the matches contains only includes. * @return result of check */ public boolean matches() { for(final FTMatch m : this) if(m.match()) return true; return false; } /** * Combines two matches as phrase. * @param all second match list * @param dis word distance * @return true if matches are left */ public boolean phrase(final FTMatches all, final int dis) { int a = 0, b = 0, c = 0; while(a < size && b < all.size) { final int e = all.match[b].match[0].s; final int d = e - match[a].match[0].e - dis; if(d == 0) { match[c] = match[a]; match[c++].match[0].e = e; } if(d >= 0) ++a; if(d <= 0) ++b; } size = c; return size != 0; } @Override public Iterator iterator() { return new ArrayIterator(match, size); } /** * Creates a deep copy of this container. * @return copy */ public FTMatches copy() { final FTMatches ftm = new FTMatches(sTokenNum); ftm.size = size; ftm.match = match.clone(); for(int i = 0; i < ftm.match.length; i++) if(ftm.match[i] != null) ftm.match[i] = ftm.match[i].copy(); return ftm; } @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append(Util.name(this)).append('[').append(sTokenNum).append(']'); for(final FTMatch m : this) sb.append("\n ").append(m); return sb.toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/data/FTPos.java000066400000000000000000000025741222453003200237560ustar00rootroot00000000000000package org.basex.data; import org.basex.util.hash.*; import org.basex.util.list.*; /** * This class contains full-text positions for a single database node. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FTPos { /** Pre value. */ final int pre; /** Positions. */ IntList pos; /** * Constructor. * @param p pre value * @param ps sorted positions */ FTPos(final int p, final IntList ps) { pre = p; pos = ps; } /** * Merges the specified position arrays. * @param ps sorted positions */ void union(final IntList ps) { final IntSet set = new IntSet(pos.size() + ps.size()); for(int p = 0, s = pos.size(); p < s; p++) set.add(pos.get(p)); for(int p = 0, s = ps.size(); p < s; p++) set.add(ps.get(p)); pos = new IntList(set.toArray()).sort(); } /** * Checks if the specified position is found. * @param p position to be found * @return result of check */ public boolean contains(final int p) { return pos.sortedIndexOf(p) >= 0; } /** * Returns the number of positions. * @return number of positions */ public int size() { return pos.size(); } /** * Creates a copy. * @return the copy */ public FTPos copy() { return new FTPos(pre, new IntList(pos.toArray())); } } basex-7.7.2/basex-core/src/main/java/org/basex/data/FTPosData.java000066400000000000000000000060751222453003200245500ustar00rootroot00000000000000package org.basex.data; import java.util.*; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * This class provides a container for query full-text positions, * which is evaluated by the visualizations. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Sebastian Gath */ public final class FTPosData { /** Position references. */ private FTPos[] pos = new FTPos[1]; /** Data reference. */ private Data data; /** Number of values. */ private int size; /** * Adds position data. * * @param d data reference * @param pre pre value * @param all full-text matches */ public void add(final Data d, final int pre, final FTMatches all) { if(data == null) data = d; else if(data != d) return; // cache all positions final IntSet set = new IntSet(); for(final FTMatch m : all) { for(final FTStringMatch sm : m) { for(int s = sm.s; s <= sm.e; ++s) set.add(s); } } // sort and store all positions final IntList il = new IntList(set.toArray()).sort(); int c = find(pre); if(c < 0) { c = -c - 1; if(size == pos.length) pos = Arrays.copyOf(pos, Array.newSize(size)); Array.move(pos, c, 1, size++ - c); pos[c] = new FTPos(pre, il); } else { pos[c].union(il); } } /** * Gets full-text data from the container. * If no data is stored for a pre value, {@code null} is returned. * int[0] : [pos0, ..., posn] * int[1] : [poi0, ..., poin] * @param d data reference * @param p int pre value * @return int[2][n] full-text data or {@code null} */ public FTPos get(final Data d, final int p) { final int i = find(p); return i < 0 || data != d ? null : pos[i]; } /** * Returns the number of entries. * @return size */ public int size() { int c = 0; for(int i = 0; i < size; ++i) c += pos[i].size(); return c; } /** * Compares full-text data for equality. * @param ft reference to compare to * @return boolean same() */ boolean sameAs(final FTPosData ft) { if(size != ft.size) return false; for(int i = 0; i < size; ++i) { if(pos[i].pre != ft.pos[i].pre || !Arrays.equals( pos[i].pos.toArray(), ft.pos[i].pos.toArray())) return false; } return true; } /** * Returns the index of the specified pre value. * @param p int pre value * @return index, or negative index - 1 if pre value is not found */ private int find(final int p) { // binary search int l = 0, h = size - 1; while(l <= h) { final int m = l + h >>> 1; final int c = pos[m].pre - p; if(c == 0) return m; if(c < 0) l = m + 1; else h = m - 1; } return -l - 1; } /** * Creates a copy. * @return copy */ public FTPosData copy() { final FTPosData ftpos = new FTPosData(); ftpos.data = data; ftpos.size = size; ftpos.pos = pos.clone(); for(int i = 0; i < ftpos.pos.length; i++) if(ftpos.pos[i] != null) ftpos.pos[i] = ftpos.pos[i].copy(); return ftpos; } } basex-7.7.2/basex-core/src/main/java/org/basex/data/FTStringMatch.java000066400000000000000000000034361222453003200254360ustar00rootroot00000000000000package org.basex.data; /** * Single full-text string match. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FTStringMatch implements Comparable { /** Query position. */ public final int q; /** Start position. */ public final int s; /** End position. */ public int e; /** Exclude flag. */ public boolean ex; /** Gaps (non-contiguous) flag. */ public boolean g; /** * Constructor. * @param st start position * @param en end position * @param qp query pos */ FTStringMatch(final int st, final int en, final int qp) { s = st; e = en; q = qp; } /** * Checks if the match is included in the specified match. * @param mtc match to be compared * @return result of check */ boolean in(final FTStringMatch mtc) { return s >= mtc.s && e <= mtc.e; } @Override public boolean equals(final Object o) { if(!(o instanceof FTStringMatch)) return false; final FTStringMatch sm = (FTStringMatch) o; return s == sm.s && e == sm.e; } @Override public int compareTo(final FTStringMatch sm) { final int st = s - sm.s; return st != 0 ? st : e - sm.e; } @Override public int hashCode() { return s * e; } @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append(ex ? "-" : "+").append('[').append(q).append(": "); sb.append(s == e ? String.valueOf(s) : s + "-" + e); return sb.append(']').toString(); } /** * Creates a copy of this string match. * @return copy */ protected FTStringMatch copy() { final FTStringMatch fts = new FTStringMatch(s, e, q); fts.ex = ex; fts.g = g; return fts; } } basex-7.7.2/basex-core/src/main/java/org/basex/data/MemData.java000066400000000000000000000103661222453003200242710ustar00rootroot00000000000000package org.basex.data; import org.basex.core.*; import org.basex.index.*; import org.basex.index.name.*; import org.basex.index.path.*; import org.basex.index.value.*; import org.basex.io.random.*; import org.basex.util.*; /** * This class stores and organizes the database table and the index structures * for textual content in a compressed memory structure. * The table mapping is documented in {@link Data}. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class MemData extends Data { /** * Constructor. * @param ps path summary * @param ns namespaces * @param pr database properties */ public MemData(final PathSummary ps, final Namespaces ns, final Prop pr) { this(null, null, ps, ns, pr, null, null); } /** * Constructor. * @param tag tag index * @param att attribute name index * @param ps path summary * @param ns namespaces * @param pr database properties * @param txt text index * @param atv attribute value index */ public MemData(final Names tag, final Names att, final PathSummary ps, final Namespaces ns, final Prop pr, final Index txt, final Index atv) { meta = new MetaData(pr); table = new TableMemAccess(meta); if(meta.updindex) { idmap = new IdPreMap(meta.lastid); txtindex = txt == null ? new UpdatableMemValues(this) : txt; atvindex = atv == null ? new UpdatableMemValues(this) : atv; } else { txtindex = txt == null ? new MemValues(this) : txt; atvindex = atv == null ? new MemValues(this) : atv; } tagindex = tag == null ? new Names(meta) : tag; atnindex = att == null ? new Names(meta) : att; paths = ps == null ? new PathSummary(this) : ps; nspaces = ns == null ? new Namespaces() : ns; } /** * Light-weight constructor, adopting data structures from the specified database. * @param data data reference */ public MemData(final Data data) { this(data.tagindex, data.atnindex, data.paths, null, data.meta.prop, data.txtindex, data.atvindex); } /** * Constructor, creating a new, empty database. * @param pr property reference */ public MemData(final Prop pr) { this(null, null, pr); } @Override public void close() { } @Override public void closeIndex(final IndexType type) { } @Override public void setIndex(final IndexType type, final Index index) { } @Override public boolean startUpdate() { return true; } @Override public void finishUpdate() { } @Override public byte[] text(final int pre, final boolean text) { return ((MemValues) (text ? txtindex : atvindex)).key((int) textOff(pre)); } @Override public long textItr(final int pre, final boolean text) { return Token.toLong(text(pre, text)); } @Override public double textDbl(final int pre, final boolean text) { return Token.toDouble(text(pre, text)); } @Override public int textLen(final int pre, final boolean text) { return text(pre, text).length; } // UPDATE OPERATIONS ======================================================== @Override protected void delete(final int pre, final boolean text) { } @Override public void updateText(final int pre, final byte[] val, final int kind) { final int id = id(pre); if(meta.updindex) { final boolean txt = kind != ATTR; ((MemValues) (txt ? txtindex : atvindex)).delete(text(pre, txt), id); } textOff(pre, index(pre, id, val, kind)); } @Override protected long index(final int pre, final int id, final byte[] txt, final int kind) { return ((MemValues) (kind == ATTR ? atvindex : txtindex)). put(txt, meta.updindex ? id : pre); } @Override protected void indexDelete(final int pre, final int size) { final int l = pre + size; for(int p = pre; p < l; ++p) { final int k = kind(p); final boolean isAttr = k == ATTR; // skip nodes which are not attribute, text, comment, or proc. instruction if(isAttr || k == TEXT || k == COMM || k == PI) { final byte[] key = text(p, !isAttr); ((MemValues) (isAttr ? atvindex : txtindex)).delete(key, id(p)); } } } } basex-7.7.2/basex-core/src/main/java/org/basex/data/MetaData.java000066400000000000000000000323331222453003200244370ustar00rootroot00000000000000package org.basex.data; import static org.basex.core.Text.*; import static org.basex.data.DataText.*; import static org.basex.util.Token.*; import java.io.*; import org.basex.build.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.io.*; import org.basex.io.in.DataInput; import org.basex.io.out.DataOutput; import org.basex.util.*; import org.basex.util.ft.*; /** * This class provides meta information on a database. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class MetaData { /** Database path. Set to {@code null} if database is in main memory. */ public final IOFile path; /** Properties. */ public final Prop prop; /** Database name. */ public volatile String name; /** Database users. */ public volatile Users users; /** Encoding of original document. */ public volatile String encoding = UTF8; /** Path to original document. */ public volatile String original = ""; /** Size of original document. */ public volatile long filesize; /** Number of stored documents. */ public volatile int ndocs; /** Timestamp of original document. */ public volatile long time; /** Flag for whitespace chopping. */ public volatile boolean chop; /** Flag for activated automatic index update. */ public volatile boolean updindex; /** Indicates if a text index exists. */ public volatile boolean textindex; /** Indicates if a attribute index exists. */ public volatile boolean attrindex; /** Indicates if a full-text index exists. */ public volatile boolean ftxtindex; /** Indicates if text index is to be recreated. */ public volatile boolean createtext; /** Indicates if attribute index is to be recreated. */ public volatile boolean createattr; /** Indicates if full-text index is to be recreated. */ public volatile boolean createftxt; /** Flag for full-text stemming. */ public volatile boolean stemming; /** Flag for full-text case sensitivity. */ public volatile boolean casesens; /** Flag for full-text diacritics removal. */ public volatile boolean diacritics; /** Full-text stopword file. */ public volatile String stopwords = ""; /** Maximum number of categories. */ public volatile int maxcats; /** Maximum token length. */ public volatile int maxlen; /** Language of full-text search index. */ public volatile Language language; /** Flag for out-of-date index structures. * Will be removed as soon as all indexes support updates. */ public volatile boolean uptodate = true; /** Flag to indicate possible corruption. */ public volatile boolean corrupt; /** Dirty flag. */ public volatile boolean dirty; /** Table size. */ public volatile int size; /** Last (highest) id assigned to a node. */ public volatile int lastid = -1; /** Flag for out-of-date indexes. */ private volatile boolean oldindex; /** Flag for out-of-date wildcard index (legacy, deprecated). */ private volatile boolean wcindex; /** Scoring mode (legacy, deprecated). */ private volatile int scoring; /** * Constructor, specifying the database properties. * @param pr database properties */ public MetaData(final Prop pr) { this("", pr, null); } /** * Constructor, specifying the database name and context. * @param db name of the database * @param ctx database context */ public MetaData(final String db, final Context ctx) { this(db, ctx.prop, ctx.mprop); } /** * Constructor, specifying the database name. * @param db name of the database * @param pr database properties * @param mprop main properties */ private MetaData(final String db, final Prop pr, final MainProp mprop) { path = mprop != null ? mprop.dbpath(db) : null; prop = pr; name = db; chop = prop.is(Prop.CHOP); createtext = prop.is(Prop.TEXTINDEX); createattr = prop.is(Prop.ATTRINDEX); createftxt = prop.is(Prop.FTINDEX); diacritics = prop.is(Prop.DIACRITICS); stemming = prop.is(Prop.STEMMING); casesens = prop.is(Prop.CASESENS); updindex = prop.is(Prop.UPDINDEX); maxlen = prop.num(Prop.MAXLEN); maxcats = prop.num(Prop.MAXCATS); stopwords = prop.get(Prop.STOPWORDS); language = Language.get(prop); users = new Users(null); } // STATIC METHODS ========================================================== /** * Normalizes a database path. Converts backslashes and * removes duplicate and leading slashes. * Returns {@code null} if the path contains invalid characters. * @param path input path * @return normalized path, or {@code null} */ public static String normPath(final String path) { final StringBuilder sb = new StringBuilder(); boolean slash = false; for(int p = 0; p < path.length(); p++) { final char c = path.charAt(p); if(c == '\\' || c == '/') { if(!slash && p != 0) sb.append('/'); slash = true; } else { if(Prop.WIN && ":*?\"<>\\|".indexOf(c) != -1) return null; if(slash) slash = false; sb.append(c); } } return sb.toString(); } /** * Calculates the database size. * @param io current file * @return file length */ private static long dbsize(final IOFile io) { long s = 0; if(io.isDir()) { for(final IOFile f : io.children()) s += dbsize(f); } else { s += io.length(); } return s; } /** * Creates a database file. * @param path database path * @param fn filename * @return database filename */ public static IOFile file(final IOFile path, final String fn) { return new IOFile(path, fn + IO.BASEXSUFFIX); } // PUBLIC METHODS =========================================================== /** * Returns true if the indexes need to be updated. * @return result of check */ public boolean oldindex() { return oldindex || wcindex || scoring != 0; } /** * Returns the disk size of the database. * @return database size */ public long dbsize() { return path != null ? dbsize(path) : 0; } /** * Returns the disk timestamp of the database. * @return database size */ public long dbtime() { return path != null ? path.timeStamp() : 0; } /** * Returns a file instance for the specified database file. * Should only be called if database is disk-based. * @param fn filename * @return database filename */ public IOFile dbfile(final String fn) { return file(path, fn); } /** * Returns the binary directory. * @return binary directory */ public IOFile binaries() { return new IOFile(path, M_RAW); } /** * Returns the specified binary file, or {@code null} if the resource * path cannot be resolved (e.g. if it points to a parent directory). * @param pth internal file path * @return binary directory */ public IOFile binary(final String pth) { if(path == null) return null; final IOFile dir = binaries(); final IOFile file = new IOFile(dir, pth); return file.path().startsWith(dir.path()) ? file : null; } /** * Drops the specified database files. * Should only be called if database is disk-based. * @param pat file pattern, or {@code null} if all files are to be deleted * @return result of check */ public synchronized boolean drop(final String pat) { return path != null && DropDB.drop(path, pat + IO.BASEXSUFFIX); } /** * Reads in all meta data. * @throws IOException exception */ public void read() throws IOException { DataInput di = null; try { di = new DataInput(dbfile(DATAINF)); read(di); } catch(final IOException ex) { throw ex; } finally { if(di != null) try { di.close(); } catch(final IOException ignored) { } } } /** * Reads in meta data from the specified stream. * @param in input stream * @throws IOException I/O exception */ public void read(final DataInput in) throws IOException { String storage = "", istorage = ""; while(true) { final String k = string(in.readToken()); if(k.isEmpty()) break; if(k.equals(DBPERM)) { users.read(in); } else { final String v = string(in.readToken()); if(k.equals(DBSTR)) storage = v; else if(k.equals(IDBSTR)) istorage = v; else if(k.equals(DBFNAME)) original = v; else if(k.equals(DBENC)) encoding = v; else if(k.equals(DBFTSW)) stopwords = v; else if(k.equals(DBFTLN)) language = Language.get(v); else if(k.equals(DBSIZE)) size = toInt(v); else if(k.equals(DBNDOCS)) ndocs = toInt(v); else if(k.equals(DBSCTYPE)) scoring = toInt(v); else if(k.equals(DBMAXLEN)) maxlen = toInt(v); else if(k.equals(DBMAXCATS)) maxcats = toInt(v); else if(k.equals(DBLASTID)) lastid = toInt(v); else if(k.equals(DBTIME)) time = toLong(v); else if(k.equals(DBFSIZE)) filesize = toLong(v); else if(k.equals(DBFTDC)) diacritics = toBool(v); else if(k.equals(DBCHOP)) chop = toBool(v); else if(k.equals(DBUPDIDX)) updindex = toBool(v); else if(k.equals(DBTXTIDX)) textindex = toBool(v); else if(k.equals(DBATVIDX)) attrindex = toBool(v); else if(k.equals(DBFTXIDX)) ftxtindex = toBool(v); else if(k.equals(DBCRTTXT)) createtext = toBool(v); else if(k.equals(DBCRTATV)) createattr = toBool(v); else if(k.equals(DBCRTFTX)) createftxt = toBool(v); else if(k.equals(DBWCIDX)) wcindex = toBool(v); else if(k.equals(DBFTST)) stemming = toBool(v); else if(k.equals(DBFTCS)) casesens = toBool(v); else if(k.equals(DBUPTODATE)) uptodate = toBool(v); // legacy: set up-to-date flag to false if path index does not exist else if(k.equals(DBPTHIDX) && !toBool(v)) uptodate = false; } } // check version of database storage if(!storage.equals(STORAGE) && new Version(storage).compareTo(new Version( STORAGE)) > 0) throw new BuildException(H_DB_FORMAT, storage); // check version of database indexes oldindex = !istorage.equals(ISTORAGE) && new Version(istorage).compareTo(new Version(ISTORAGE)) > 0; corrupt = dbfile(DATAUPD).exists(); // deactivate full-text index if obsolete trie structure was used if(wcindex) ftxtindex = false; } /** * Writes the meta data to the specified output stream. * @param out output stream * @throws IOException I/O Exception */ void write(final DataOutput out) throws IOException { writeInfo(out, DBSTR, STORAGE); writeInfo(out, DBFNAME, original); writeInfo(out, DBTIME, time); writeInfo(out, IDBSTR, ISTORAGE); writeInfo(out, DBFSIZE, filesize); writeInfo(out, DBNDOCS, ndocs); writeInfo(out, DBENC, encoding); writeInfo(out, DBSIZE, size); writeInfo(out, DBCHOP, chop); writeInfo(out, DBUPDIDX, updindex); writeInfo(out, DBTXTIDX, textindex); writeInfo(out, DBATVIDX, attrindex); writeInfo(out, DBFTXIDX, ftxtindex); writeInfo(out, DBCRTTXT, createtext); writeInfo(out, DBCRTATV, createattr); writeInfo(out, DBCRTFTX, createftxt); writeInfo(out, DBFTST, stemming); writeInfo(out, DBFTCS, casesens); writeInfo(out, DBFTDC, diacritics); writeInfo(out, DBFTSW, stopwords); writeInfo(out, DBMAXLEN, maxlen); writeInfo(out, DBMAXCATS, maxcats); writeInfo(out, DBUPTODATE, uptodate); writeInfo(out, DBLASTID, lastid); if(language != null) writeInfo(out, DBFTLN, language.toString()); out.writeToken(token(DBPERM)); users.write(out); out.write(0); } /** * Notifies the meta structures of an update and invalidates the indexes. */ void update() { // update database timestamp time = System.currentTimeMillis(); uptodate = false; dirty = true; if(!updindex) { textindex = false; attrindex = false; } ftxtindex = false; } // PRIVATE METHODS ========================================================== /** * Converts the specified string to a boolean value. * @param v value * @return result */ private static boolean toBool(final String v) { return v.equals("1"); } /** * Writes a boolean property to the specified output. * @param out output stream * @param k key * @param pr property to write * @throws IOException I/O exception */ private static void writeInfo(final DataOutput out, final String k, final boolean pr) throws IOException { writeInfo(out, k, pr ? "1" : "0"); } /** * Writes a numeric property to the specified output. * @param out output stream * @param k key * @param v value * @throws IOException I/O exception */ private static void writeInfo(final DataOutput out, final String k, final long v) throws IOException { writeInfo(out, k, Long.toString(v)); } /** * Writes a string property to the specified output. * @param out output stream * @param k key * @param v value * @throws IOException I/O exception */ private static void writeInfo(final DataOutput out, final String k, final String v) throws IOException { out.writeToken(token(k)); out.writeToken(token(v)); } } basex-7.7.2/basex-core/src/main/java/org/basex/data/NSNode.java000066400000000000000000000150751222453003200241110ustar00rootroot00000000000000package org.basex.data; import static org.basex.core.Text.*; import java.io.*; import java.util.*; import org.basex.io.in.DataInput; import org.basex.io.out.DataOutput; import org.basex.util.*; /** * This class stores a single namespace node. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class NSNode { /** Children. */ NSNode[] children; /** Number of children. */ int size; /** Parent node. */ NSNode parent; /** References to Prefix/URI pairs. */ int[] values; /** Pre value. */ int pre; /** * Default constructor. * @param p pre value */ NSNode(final int p) { values = new int[0]; children = new NSNode[0]; pre = p; } /** * Constructor, specifying an input stream. * @param in input stream * @param p parent reference * @throws IOException I/O exception */ NSNode(final DataInput in, final NSNode p) throws IOException { parent = p; pre = in.readNum(); values = in.readNums(); size = in.readNum(); children = new NSNode[size]; for(int c = 0; c < size; ++c) children[c] = new NSNode(in, this); } /** * Writes a single node to disk. * @param out output stream * @throws IOException I/O exception */ void write(final DataOutput out) throws IOException { out.writeNum(pre); out.writeNums(values); out.writeNum(size); for(int c = 0; c < size; ++c) children[c].write(out); } /** * Adds the specified node into the child array, which is sorted by pre values. * @param n child node */ void add(final NSNode n) { if(size == children.length) children = Array.copy(children, new NSNode[Array.newSize(size)]); // find inserting position int s = find(n.pre); if(s < 0 || n.pre != children[s].pre) s++; System.arraycopy(children, s, children, s + 1, size++ - s); children[s] = n; n.parent = this; } /** * Adds the specified prefix and URI reference. * @param p prefix reference * @param u uri reference */ void add(final int p, final int u) { final int s = values.length; values = Arrays.copyOf(values, s + 2); values[s] = p; values[s + 1] = u; } /** * Recursively deletes the specified namespace URI reference. * @param uri namespace URI reference */ void delete(final int uri) { for(int c = 0; c < size; ++c) children[c].delete(uri); final int vl = values.length; for(int v = 0; v < vl; v += 2) { if(values[v + 1] != uri) continue; final int[] vals = new int[vl - 2]; System.arraycopy(values, 0, vals, 0, v); System.arraycopy(values, v + 2, vals, v, vl - v - 2); values = vals; break; } } // Requesting Namespaces ==================================================== /** * Finds the closest namespace node for the specified pre value. * @param p pre value * @param d data reference * @return node */ NSNode find(final int p, final Data d) { final int s = find(p); // no match found: return current node if(s == -1) return this; final NSNode ch = children[s]; final int cp = ch.pre; // return exact hit if(cp == p) return ch; // found node is preceding sibling if(cp + d.size(cp, Data.ELEM) <= p) return this; // continue recursive search return children[s].find(p, d); } /** * Returns the namespace URI reference for the specified prefix. * @param p prefix reference * @return u uri reference or 0 */ int uri(final int p) { for(int v = 0; v < values.length; v += 2) if(values[v] == p) return values[v + 1]; return 0; } /** * Deletes nodes in the specified range (p .. p + sz - 1) and updates the * following pre values * @param p pre value * @param sz number of nodes to be deleted, or actually the size of the pre * value which is to be deleted */ void delete(final int p, final int sz) { // find the pre value which must be deleted int s = find(p); /* if the node is not directly contained as a child, either start at array * index 0 or proceed with the next node in the child array to search for * descendants of pre */ if(s == -1 || children[s].pre != p) ++s; // first pre value which is not deleted final int upper = p + sz; // number of nodes to be deleted int num = 0; // determine number of nodes to be deleted for(int i = s; i < size && children[i].pre < upper; ++i, ++num); // new size of child array size -= num; // if all nodes are deleted, just create an empty array if(size == 0) children = new NSNode[0]; // otherwise remove nodes from the child array else if(num > 0) System.arraycopy(children, s + num, children, s, size - s); } /** * Finds a specific pre value in the child array utilizing binary search * and returns its position. * @param p pre value * @return node */ int find(final int p) { int l = 0, h = size - 1; while(l <= h) { // binary search final int m = l + h >>> 1; final int v = children[m].pre; if(v == p) return m; if(v < p) l = m + 1; else h = m - 1; } return l - 1; } // Printing Namespaces ====================================================== /** * Prints the node structure for debugging purposes. * @param ns namespace reference * @param s start pre value * @param e end pre value * @return string */ String print(final Namespaces ns, final int s, final int e) { final TokenBuilder tb = new TokenBuilder(); print(tb, 0, ns, s, e); return tb.toString(); } /** * Prints the node structure for debugging purposes. * @param tb token builder * @param l level * @param ns namespace reference * @param s start pre value * @param e end pre value */ private void print(final TokenBuilder tb, final int l, final Namespaces ns, final int s, final int e) { if(pre >= s && pre <= e) { tb.add(NL); for(int i = 0; i < l; ++i) tb.add(" "); tb.add(toString() + ' '); for(int i = 0; i < values.length; i += 2) { tb.add("xmlns"); final byte[] p = ns.prefix(values[i]); if(p.length != 0) tb.add(':'); tb.add(p).add("=\"").add(ns.uri(values[i + 1])).add("\" "); } } for(int c = 0; c < size; ++c) children[c].print(tb, l + 1, ns, s, e); } @Override public String toString() { return "Pre[" + pre + ']'; } } basex-7.7.2/basex-core/src/main/java/org/basex/data/Namespaces.java000066400000000000000000000346621222453003200250450ustar00rootroot00000000000000package org.basex.data; import static org.basex.core.Text.*; import static org.basex.data.DataText.*; import java.io.*; import java.util.*; import org.basex.io.in.DataInput; import org.basex.io.out.DataOutput; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * This class organizes the namespaces of a database. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Namespaces { /** Stack with references to default namespaces. */ private final IntList defaults = new IntList(2); /** Namespace prefixes. */ private final TokenSet prefs; /** Namespace URIs. */ private final TokenSet uris; /** Root node. */ private final NSNode root; /** Indicates if new namespaces have been added for an XML node. */ private boolean newns; /** Current level. Index starts at 1 (required by XQUF operations). */ private int level = 1; /** Current namespace node. */ private NSNode current; // Building Namespaces ================================================================ /** * Empty constructor. */ public Namespaces() { prefs = new TokenSet(); uris = new TokenSet(); root = new NSNode(-1); current = root; } /** * Constructor, specifying an input stream. * @param in input stream * @throws IOException I/O exception */ Namespaces(final DataInput in) throws IOException { prefs = new TokenSet(in); uris = new TokenSet(in); root = new NSNode(in, null); current = root; } /** * Writes the namespaces to disk. * @param out output stream * @throws IOException I/O exception */ void write(final DataOutput out) throws IOException { prefs.write(out); uris.write(out); root.write(out); } /** * Prepares the generation of new namespaces. */ public void prepare() { final int nu = defaults.get(level); defaults.set(++level, nu); newns = false; } /** * Adds the specified namespace to the namespace structure of the current element. * @param pref prefix * @param uri uri * @param pre pre value * @return new NSNode if a new one has been created, {@code null} otherwise */ public NSNode add(final byte[] pref, final byte[] uri, final int pre) { NSNode node = null; if(!newns) { node = new NSNode(pre); current.add(node); current = node; newns = true; } final int k = prefs.put(pref); final int v = uris.put(uri); current.add(k, v); if(pref.length == 0) defaults.set(level, v); return node; } /** * Closes a namespace node. * @param pre current pre value */ public void close(final int pre) { while(current.pre >= pre && current.parent != null) current = current.parent; --level; } /** * Returns the namespace URI reference for the specified name, * or {@code 0} if no namespace is found. * @param name tag/attribute name * @param elem element flag * @return namespace */ public int uri(final byte[] name, final boolean elem) { if(uris.isEmpty()) return 0; final byte[] pref = Token.prefix(name); int nu = elem ? defaults.get(level) : 0; if(pref.length != 0) nu = uri(pref, current); return nu; } // Requesting Namespaces ============================================================== /** * Returns the size of the uri container. * Note that the container size does not change if namespaces are deleted. * This function is basically used to decide if there are any namespaces at all, * and if namespaces need to be considered in query optimizations. * @return number of uri references */ public int size() { return uris.size(); } /** * Returns the default namespace of the database, or {@code null} * if several (default or prefixed) namespaces are defined. * @return global default namespace */ public byte[] globalNS() { // no namespaces defined: default namespace is empty if(root.size == 0) return Token.EMPTY; // more than one namespace defined: skip test if(root.size > 1) return null; // check namespaces of first child final NSNode n = root.children[0]; // namespace has more children; skip traversal if(n.size != 0 || n.pre != 1 || n.values.length != 2) return null; // return default namespace or null return prefix(n.values[0]).length == 0 ? uri(n.values[1]) : null; } /** * Returns the specified namespace URI. * @param id namespace URI reference * @return prefix */ public byte[] uri(final int id) { return uris.key(id); } /** * Returns the namespace URI reference for the specified name and pre value, * or {@code 0} if namespace cannot be found. * @param name element/attribute name * @param pre pre value * @param data data reference * @return namespace URI reference */ public int uri(final byte[] name, final int pre, final Data data) { return uri(Token.prefix(name), current.find(pre, data)); } /** * Deletes the specified namespace URI from the root node. * @param uri namespace URI reference */ public void delete(final byte[] uri) { final int id = uris.id(uri); if(id != 0) current.delete(id); } /** * Returns the specified prefix. * @param id prefix reference * @return prefix */ byte[] prefix(final int id) { return prefs.key(id); } /** * Returns the prefix and URI references of all namespaces defined for the node with * the specified pre value. * @param pre pre value * @param data data reference * @return namespace references */ int[] get(final int pre, final Data data) { return current.find(pre, data).values; } /** * Returns a map with all namespaces that are valid for the specified pre value. * @param pre pre value * @param data data reference * @return scope */ TokenMap scope(final int pre, final Data data) { final TokenMap nsScope = new TokenMap(); NSNode node = current; do { for(int i = 0; i < node.values.length; i += 2) nsScope.put(prefix(node.values[i]), uri(node.values[i + 1])); final int pos = node.find(pre); if(pos < 0) break; node = node.children[pos]; } while(node.pre <= pre && pre < node.pre + data.size(node.pre, Data.ELEM)); return nsScope; } /** * Finds the nearest namespace node on the ancestor axis of the insert * location and sets it as new root. Possible candidates for this node are collected * and the match with the highest pre value between ancestors and candidates * is determined. * @param pre pre value * @param data data reference */ void root(final int pre, final Data data) { // collect possible candidates for namespace root final List cand = new LinkedList(); NSNode node = root; cand.add(node); for(int p; (p = node.find(pre)) > -1;) { // add candidate to stack node = node.children[p]; cand.add(0, node); } node = root; if(cand.size() > 1) { // compare candidates to ancestors of pre value int ancPre = pre; // take first candidate from stack NSNode curr = cand.remove(0); while(ancPre > -1 && node == root) { // this is the new root if(curr.pre == ancPre) node = curr; // if the current candidate's pre value is lower than the current // ancestor of par or par itself, we have to look for a potential // match for this candidate. therefore we iterate through ancestors // until we find one with a lower than or the same pre value as the // current candidate. else if(curr.pre < ancPre) { while((ancPre = data.parent(ancPre, data.kind(ancPre))) > curr.pre); if(curr.pre == ancPre) node = curr; } // no potential for infinite loop, because dummy root is always a match, // in this case ancPre ends iteration if(!cand.isEmpty()) curr = cand.remove(0); } } final int uri = uri(Token.EMPTY, pre, data); defaults.set(level, uri); // remind uri before insert of first node n to connect siblings of n to // according namespace defaults.set(level - 1, uri); current = node; } /** * Returns the namespace URI reference for the specified prefix and node, * or {@code 0} if no namespace is found. * @param pref prefix * @param node node to start with * @return namespace URI reference */ private int uri(final byte[] pref, final NSNode node) { final int id = prefs.id(pref); if(id == 0) return 0; NSNode n = node; while(n != null) { final int u = n.uri(id); if(u != 0) return u; n = n.parent; } return 0; } // Updating Namespaces ================================================================ /** * Deletes the specified number of entries from the namespace structure. * @param pre pre value of the first node to delete * @param data data reference * @param size number of entries to be deleted */ void delete(final int pre, final int size, final Data data) { NSNode nd = current.find(pre, data); if(nd.pre == pre) nd = nd.parent; while(nd != null) { nd.delete(pre, size); nd = nd.parent; } delete(root, pre, size); } /** * Recursive shifting of pre values after delete operations. * @param node current namespace node which is updated if necessary * @param pre update location * @param size size of inserted/deleted node */ private static void delete(final NSNode node, final int pre, final int size) { if(node.pre >= pre + size) node.pre -= size; for(int c = 0; c < node.size; c++) delete(node.children[c], pre, size); } /** * Updates the pre values of all nodes on the following axis after a * structural update at location pre. * @param pre update location * @param size size of inserted/deleted node * @param cache added nodes */ void insert(final int pre, final int size, final Set cache) { insert(root, pre, size, cache); } /** * Recursive shifting of pre values after insert operations. * @param node current namespace node * @param pre update location * @param size size of inserted/deleted node * @param cache added nodes */ private static void insert(final NSNode node, final int pre, final int size, final Set cache) { if(!cache.contains(node) && node.pre >= pre) node.pre += size; for(int c = 0; c < node.size; c++) insert(node.children[c], pre, size, cache); } /** * Adds a namespace for the specified pre value. * @param pre pre value * @param par parent value * @param pref prefix * @param uri uri * @param data data reference * @return uri reference */ public int add(final int pre, final int par, final byte[] pref, final byte[] uri, final Data data) { final NSNode nd = current.find(par, data); final NSNode t = new NSNode(pre); final int k = prefs.put(pref); final int v = uris.put(uri); if(nd.pre == pre) { nd.add(k, v); } else { t.add(k, v); nd.add(t); } return v; } /** * Returns a reference to the specified namespace URI, * or {@code 0} if the URI is empty or no namespace is found. * @param uri namespace URI * @return reference, or {@code 0} */ public int uri(final byte[] uri) { return uri.length != 0 ? uris.id(uri) : 0; } /** * Returns the current namespaces node. * @return current namespace node */ NSNode current() { return current; } /** * Setter for namespaces root node. * @param node new root */ void root(final NSNode node) { current = node; } // Printing Namespaces ================================================================ /** * Returns a tabular representation of the namespaces. * @param s start pre value * @param e end pre value * @return namespaces */ public byte[] table(final int s, final int e) { if(root.size == 0) return Token.EMPTY; final Table t = new Table(); t.header.add(TABLEID); t.header.add(TABLEPRE); t.header.add(TABLEDIST); t.header.add(TABLEPREF); t.header.add(TABLEURI); for(int i = 0; i < 3; ++i) t.align.add(true); table(t, root, s, e); return t.contents.isEmpty() ? Token.EMPTY : t.finish(); } /** * Adds the namespace structure for a node to the specified table. * @param t table * @param n namespace node * @param s start pre value * @param e end pre value */ private void table(final Table t, final NSNode n, final int s, final int e) { for(int i = 0; i < n.values.length; i += 2) { if(n.pre < s || n.pre > e) continue; final TokenList tl = new TokenList(); tl.add(n.values[i + 1]); tl.add(n.pre); tl.add(n.pre - n.parent.pre); tl.add(prefs.key(n.values[i])); tl.add(uris.key(n.values[i + 1])); t.contents.add(tl); } for(int i = 0; i < n.size; i++) table(t, n.children[i], s, e); } /** * Returns namespace information. * @return info string */ public byte[] info() { final TokenObjMap map = new TokenObjMap(); info(map, root); final TokenBuilder tb = new TokenBuilder(); for(final byte[] key : map) { tb.add(" "); final TokenList values = map.get(key); values.sort(false); final int ks = values.size(); if(ks > 1 || values.get(0).length != 0) { if(values.size() != 1) tb.add("("); for(int k = 0; k < ks; ++k) { if(k != 0) tb.add(", "); tb.add(values.get(k)); } if(ks != 1) tb.add(")"); tb.add(" = "); } tb.addExt("\"%\"" + NL, key); } return tb.finish(); } /** * Adds namespace information for the specified node to a map. * @param map namespace map * @param n namespace node */ private void info(final TokenObjMap map, final NSNode n) { for(int i = 0; i < n.values.length; i += 2) { final byte[] key = uris.key(n.values[i + 1]); final byte[] val = prefs.key(n.values[i]); TokenList old = map.get(key); if(old == null) { old = new TokenList(); map.put(key, old); } if(!old.contains(val)) old.add(val); } for(final NSNode c : n.children) info(map, c); } /** * Returns a string representation of the namespaces. * @param s start pre value * @param e end pre value * @return string */ public String toString(final int s, final int e) { return root.print(this, s, e); } @Override public String toString() { return toString(0, Integer.MAX_VALUE); } } basex-7.7.2/basex-core/src/main/java/org/basex/data/Nodes.java000066400000000000000000000147361222453003200240360ustar00rootroot00000000000000package org.basex.data; import java.io.*; import java.util.*; import org.basex.core.*; import org.basex.io.out.*; import org.basex.io.serial.*; import org.basex.query.value.node.*; import org.basex.util.*; import org.basex.util.list.*; /** * This class stores node references of a database in an ascending order. * Instances of this class are used in the {@link Context} class to * reference the currently used, marked, and copied nodes. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Nodes implements Result { /** Full-text position data (for visualization). */ public final FTPosData ftpos; /** Root flag (nodes represent all document nodes of the database). */ public boolean root; /** Root node. */ public Data data; /** Pre values container. */ public int[] pres; /** Sorted pre values. */ public int[] sorted; /** * Constructor, specifying a database instance. * @param d data reference */ public Nodes(final Data d) { this(new int[0], d); } /** * Constructor, specifying a single node and a database instance. * @param n single node * @param d data reference */ public Nodes(final int n, final Data d) { this(new int[] { n }, d); } /** * Constructor, specifying a node set and a database instance. * @param n node set * @param d data reference */ public Nodes(final int[] n, final Data d) { this(n, d, Prop.gui ? new FTPosData() : null); } /** * Constructor, specifying a node set, a database instance, and full-text * positions. * @param n node set * @param d data reference * @param ft ft position data */ public Nodes(final int[] n, final Data d, final FTPosData ft) { data = d; ftpos = ft; set(n); if(d == null) Util.notexpected("No data available"); } /** * Constructor, which should only used by test classes. * No database reference is specified. * @param n node set */ public Nodes(final int[] n) { pres = n; ftpos = null; } /** * Copy constructor. * @param nds nodes to copy */ public Nodes(final Nodes nds) { this(nds.pres.clone(), nds.data, nds.ftpos == null ? null : nds.ftpos.copy()); root = nds.root; if(nds.sorted != null) sorted = nds.sorted.clone(); } @Override public long size() { return pres.length; } @Override public boolean sameAs(final Result r) { final int s = pres.length; if(!(r instanceof Nodes) || r.size() != s) return false; final Nodes n = (Nodes) r; if(data != n.data) return false; for(int c = 0; c < s; ++c) if(n.pres[c] != pres[c]) return false; return ftpos == null || ftpos.sameAs(n.ftpos); } /** * Checks if the node set contains all root nodes of the data instance. * If yes, returns {@code null}. * @return self reference */ public Nodes checkRoot() { final IntList docs = data.resources.docs(); final int[] ps = pres; final int pl = ps.length; if(pl != docs.size()) return this; int c = -1; while(++c < pl && ps[c] == docs.get(c)); return c < pl ? this : null; } /** * Checks if the specified node is contained in the array. * @param p pre value * @return true if the node was found */ public boolean contains(final int p) { return find(p) >= 0; } /** * Returns the position of the specified node or the negative value - 1 of * the position where it should have been found. * @param p pre value * @return true if the node was found */ public int find(final int p) { sort(); return Arrays.binarySearch(sorted, p); } /** * Adds or removes the specified pre node. * @param p pre value */ public void toggle(final int p) { final int[] n = new int[] { p }; set(contains(p) ? except(pres, n) : union(pres, n)); } /** * Merges the specified array with the existing pre nodes. * @param p pre value */ public void union(final int[] p) { set(union(pres, p)); } /** * Merges two sorted integer arrays via union. * Note that the input arrays must be sorted. * @param ai first set * @param bi second set * @return resulting set */ private static int[] union(final int[] ai, final int[] bi) { final int al = ai.length, bl = bi.length; final IntList c = new IntList(); int a = 0, b = 0; while(a != al && b != bl) { final int d = ai[a] - bi[b]; c.add(d <= 0 ? ai[a++] : bi[b++]); if(d == 0) ++b; } while(a != al) c.add(ai[a++]); while(b != bl) c.add(bi[b++]); return c.toArray(); } /** * Subtracts the second from the first array. * Note that the input arrays must be sorted. * @param ai first set * @param bi second set * @return resulting set */ private static int[] except(final int[] ai, final int[] bi) { final int al = ai.length, bl = bi.length; final IntList c = new IntList(); int a = 0, b = 0; while(a != al && b != bl) { final int d = ai[a] - bi[b]; if(d < 0) c.add(ai[a]); else ++b; if(d <= 0) ++a; } while(a != al) c.add(ai[a++]); return c.toArray(); } /** * Sets the specified nodes. * @param n values */ private void set(final int[] n) { pres = n; sorted = null; } /** * Creates a sorted node array. If the original array is already sorted, * the same reference is used. */ private void sort() { if(sorted != null) return; int i = Integer.MIN_VALUE; for(final int n : pres) { if(i > n) { sorted = Arrays.copyOf(pres, pres.length); Arrays.sort(sorted); return; } i = n; } sorted = pres; } @Override public void serialize(final Serializer ser) throws IOException { for(int c = 0; c < pres.length && !ser.finished(); ++c) serialize(ser, c); } @Override public void serialize(final Serializer ser, final int n) throws IOException { ser.serialize(new FTPosNode(data, pres[n], ftpos)); } @Override public ArrayOutput serialize() throws IOException { final ArrayOutput ao = new ArrayOutput(); serialize(Serializer.get(ao)); return ao; } @Override public String toString() { try { return serialize().toString(); } catch(final IOException ex) { throw Util.notexpected(ex); } } } basex-7.7.2/basex-core/src/main/java/org/basex/data/Result.java000066400000000000000000000022341222453003200242320ustar00rootroot00000000000000package org.basex.data; import java.io.*; import org.basex.io.out.*; import org.basex.io.serial.*; /** * This is an interface for query results. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public interface Result { /** * Number of values, stored in the result instance. * @return number of values */ long size(); /** * Compares results for equality. * @param r result to be compared * @return true if results are equal */ boolean sameAs(Result r); /** * Serializes the result, using the standard serializer, * and returns the cached result. * @return serialized value * @throws IOException I/O exception */ ArrayOutput serialize() throws IOException; /** * Serializes the complete result. * @param ser serializer * @throws IOException I/O exception */ void serialize(Serializer ser) throws IOException; /** * Serializes the specified result. * @param ser serializer * @param n offset of result to serialize * @throws IOException I/O exception */ void serialize(Serializer ser, int n) throws IOException; } basex-7.7.2/basex-core/src/main/java/org/basex/data/atomic/000077500000000000000000000000001222453003200233645ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/data/atomic/AtomicUpdateList.java000066400000000000000000000447431222453003200274560ustar00rootroot00000000000000package org.basex.data.atomic; import java.util.*; import org.basex.data.*; import org.basex.util.*; import org.basex.util.hash.*; /** *

A container/list for atomic updates. Updates are then carried out in the same order * that they have been added. No reordering takes place. The user is responsible to add * them in the correct order.

* *

Updates must be strictly ordered from the highest to the lowest PRE value, otherwise * an exception is returned.

* *

If a collection of updates is carried out via this container there are several * benefits:

* *
    *
  1. Caching distance updates of the table due to structural changes and carrying * them out in an efficient manner.
  2. *
  3. Tree-Aware Updates: identification of superfluous updates (like updating the * descendants of a deleted node).
  4. *
  5. Merging of adjacent text nodes which are not allowed (see XDM).
  6. *
* *

Mind that two delete atomics on a list targeting the same PRE value location result * in two nodes A and B being deleted, due to PRE value shifts after the first delete, * where pre(B) = pre(A) + 1. If a list of atomic updates is prepared for execution it * should be ordered from the highest to the lowest PRE value.

* *

To avoid ambiguity it is not allowed to add:

*
    *
  • more than one destructive update like {@link Delete} or {@link Replace} operating * on the same node.
  • *
  • more than one {@link Rename} or {@link UpdateValue} operating * on the same node.
  • *
* * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class AtomicUpdateList { /** List of structural updates (nodes are inserted to / deleted from the table. */ private final List updStructural; /** List of value updates. */ private final List updValue; /** Target data reference. */ public final Data data; /** States if update constraints have been checked. */ private boolean ok; /** States if update haven been optimized. */ private boolean opt; /** States if this list has been merged, hence accumulations are invalid. */ private boolean dirty; /** * Constructor. * @param d target data reference */ public AtomicUpdateList(final Data d) { updStructural = new ArrayList(); updValue = new ArrayList(); data = d; } /** * Adds a delete atomic to the list. * @param pre PRE value of the target node/update location */ public void addDelete(final int pre) { final int k = data.kind(pre); final int s = data.size(pre, k); add(new Delete(pre, -s, pre + s), true); } /** * Adds an insert atomic to the list. * @param pre PRE value of the target node/update location * @param par new parent of the inserted nodes * @param clip insertion sequence data clip * @param attr insert attribute if true or a node of any other kind if false */ public void addInsert(final int pre, final int par, final DataClip clip, final boolean attr) { add(attr ? new InsertAttr(pre, par, clip) : new Insert(pre, par, clip), true); } /** * Adds a replace atomic to the list. * @param pre PRE value of the target node/update location * @param clip insertion sequence data clip */ public void addReplace(final int pre, final DataClip clip) { final int oldsize = data.size(pre, data.kind(pre)); final int newsize = clip.size(); add(new Replace(pre, newsize - oldsize, pre + oldsize, clip), true); } /** * Adds a rename atomic to the list. * @param pre PRE value of the target node/update location * @param k kind of the target node * @param n new name for the target node * @param u new uri for the target node */ public void addRename(final int pre, final int k, final byte[] n, final byte[] u) { add(new Rename(pre, k, n, u), false); } /** * Adds an updateValue atomic to the list. * @param pre PRE value of the target node/update location * @param k kind of the target node * @param v new value for the target node */ public void addUpdateValue(final int pre, final int k, final byte[] v) { add(new UpdateValue(pre, k, v), false); } /** * Returns the number of structural updates. * @return number of structural updates */ public int structuralUpdatesSize() { return updStructural.size(); } /** * Resets the list. */ public void clear() { updStructural.clear(); updValue.clear(); dirty(); } /** * Adds an update to the corresponding list. * @param u atomic update * @param s true if given update performs structural changes, false if update only * alters values */ private void add(final BasicUpdate u, final boolean s) { if(s) updStructural.add(u); else updValue.add(u); dirty(); } /** * Adds all updates in a given list B to the end of the updates in this list (A). * * As updates must be unambiguous and are ordered from the highest to the lowest PRE * value, make sure that all updates in B access PRE values smaller than any update * in A. * * Mainly used to resolve text node adjacency. * * @param toMerge given list that is appended to the end of this list */ private void merge(final AtomicUpdateList toMerge) { updStructural.addAll(toMerge.updStructural); updValue.addAll(toMerge.updValue); dirty(); } /** * Marks this list dirty. */ private void dirty() { ok = false; opt = false; dirty = true; } /** * Checks the list of updates for violations. Updates must be ordered strictly from * the highest to the lowest PRE value. * * A single node must not be affected by more than one {@link Rename}, * {@link UpdateValue} operation. * * A single node must not be affected by more than one destructive operation. These * operations include {@link Replace}, {@link Delete}. */ public void check() { if(ok || updStructural.size() < 2 && updValue.size() < 2) return; int i = 0; while(i + 1 < updStructural.size()) { final BasicUpdate current = updStructural.get(i); final BasicUpdate next = updStructural.get(++i); // check order of location PRE if(current.location < next.location) Util.notexpected("Invalid order at location " + current.location); // check multiple {@link Delete}, {@link Replace} if(current.location == next.location && current.destructive() && next.destructive()) Util.notexpected("Multiple deletes/replaces on node " + current.location); } i = 0; while(i + 1 < updValue.size()) { final BasicUpdate current = updValue.get(i++); final BasicUpdate next = updValue.get(i); // check order of location PRE if(current.location < next.location) Util.notexpected("Invalid order at location " + current.location); if(current.location == next.location) { // check multiple {@link Rename} if(current instanceof Rename && next instanceof Rename) Util.notexpected("Multiple renames on node " + current.location); // check multiple {@link UpdateValue} if(current instanceof UpdateValue && next instanceof UpdateValue) Util.notexpected("Multiple updates on node " + current.location); } } ok = true; } /** * Removes superfluous update operations. If a node T is deleted or replaced, all * updates on the descendant axis of T can be left out as they won't affect the database * after all. * * Superfluous updates can have a minimum PRE value of pre(T)+1 and a maximum PRE value * of pre(T)+size(T). * * An update with location pre(T)+size(T) can only be removed if the update is an * atomic insert and the inserted node is then part of the subtree of T. */ public void optimize() { if(opt) return; check(); // traverse from lowest to highest PRE value int i = updStructural.size() - 1; while(i >= 0) { final BasicUpdate u = updStructural.get(i); // If this update can lead to superfluous updates ... if(u.destructive()) { // we determine the lowest and highest PRE values of a superfluous update final int pre = u.location; final int fol = pre + data.size(pre, data.kind(pre)); i--; // and have a look at the next candidate while(i >= 0) { final BasicUpdate desc = updStructural.get(i); final int descpre = desc.location; // if the candidate operates on the subtree of T and inserts a node ... if(descpre <= fol && (desc instanceof Insert || desc instanceof InsertAttr) && desc.parent() >= pre && desc.parent() < fol) { // it is removed. updStructural.remove(i--); // Other updates (not inserting a node) that operate on the subtree of T can // only have a PRE value that is smaller than the following PRE of T } else if(descpre < fol) { // these we delete. updStructural.remove(i--); // Else there's nothing to delete } else break; } } else i--; } opt = true; } /** * Executes the updates. Resolving text node adjacency can be skipped if adjacent text * nodes are not to be expected. * @param mergeTexts adjacent text nodes are to be expected and must be merged */ public void execute(final boolean mergeTexts) { check(); optimize(); applyValueUpdates(); data.cache = true; applyStructuralUpdates(); updateDistances(); if(mergeTexts) resolveTextAdjacency(); data.cache = false; } /** * Carries out structural updates. */ public void applyStructuralUpdates() { accumulatePreValueShifts(); for(final BasicUpdate t : updStructural) t.apply(data); } /** * Carries out value updates. */ public void applyValueUpdates() { for(final BasicUpdate t : updValue) t.apply(data); } /** * Calculates the accumulated PRE value shifts for all updates on the list. */ private void accumulatePreValueShifts() { if(!dirty) return; int s = 0; for(int i = updStructural.size() - 1; i >= 0; i--) { final BasicUpdate t = updStructural.get(i); s += t.shifts; t.accumulatedShifts = s; } dirty = false; } /** * Updates distances to restore parent-child relationships that have been invalidated * by structural updates. * * Each structural update (insert/delete) leads to a shift of higher PRE values. This * invalidates parent-child relationships. Distances are only updated after all * structural updates have been carried out to make sure each node (that has to be * updated) is only touched once. */ private void updateDistances() { accumulatePreValueShifts(); final IntSet alreadyUpdatedNodes = new IntSet(); for(final BasicUpdate update : updStructural) { int newPreOfAffectedNode = update.preOfAffectedNode + update.accumulatedShifts; /* Update distance for the affected node and all following siblings of nodes * on the ancestor-or-self axis. */ while(newPreOfAffectedNode < data.meta.size) { if(alreadyUpdatedNodes.contains(newPreOfAffectedNode)) break; data.dist(newPreOfAffectedNode, data.kind(newPreOfAffectedNode), calculateNewDistance(newPreOfAffectedNode)); alreadyUpdatedNodes.add(newPreOfAffectedNode); newPreOfAffectedNode += data.size(newPreOfAffectedNode, data.kind(newPreOfAffectedNode)); } } } /** * Calculates the new distance value for the given node. * @param preAfter the current PRE value of the node (after structural updates have * been applied) * @return new distance for the given node */ private int calculateNewDistance(final int preAfter) { final int kind = data.kind(preAfter); final int distanceBefore = data.dist(preAfter, kind); final int preBefore = calculatePreValue(preAfter, true); final int parentBefore = preBefore - distanceBefore; final int parentAfter = calculatePreValue(parentBefore, false); return preAfter - parentAfter; } /** * Calculates the PRE value of a given node before/after updates. * * Finds all updates that affect the given node N. The result is than calculated based * on N and the accumulated PRE value shifts introduced by these updates. * * If a node has been inserted at position X and this method is used to calculate the * PRE value of X before updates, X is the result. As the node at position X has not * existed before the insertion, its PRE value is unchanged. If in contrast the PRE * value is calculated after updates, the result is X+1, as the node with the original * position X has been shifted by the insertion at position X. * * Make sure accumulated shifts have been calculated before calling this method! * * @param pre PRE value * @param beforeUpdates calculate PRE value before shifts/updates have been applied * @return index of update, or -1 */ public int calculatePreValue(final int pre, final boolean beforeUpdates) { int i = find(pre, beforeUpdates); // given PRE not changed by updates if(i == -1) return pre; i = refine(updStructural, i, beforeUpdates); final int acm = updStructural.get(i).accumulatedShifts; return beforeUpdates ? pre - acm : pre + acm; } /** * Finds the position of the update with the lowest index that affects the given PRE * value P. If there are multiple updates whose affected PRE value equals P, the search * has to be further refined as this method returns the first match. * @param pre given PRE value * @param beforeUpdates compare based on PRE values before/after updates * @return index of update */ private int find(final int pre, final boolean beforeUpdates) { int left = 0; int right = updStructural.size() - 1; while(left <= right) { if(left == right) { if(c(updStructural, left, beforeUpdates) <= pre) return left; return -1; } if(right - left == 1) { if(c(updStructural, left, beforeUpdates) <= pre) return left; if(c(updStructural, right, beforeUpdates) <= pre) return right; return -1; } final int middle = left + right >>> 1; final int value = c(updStructural, middle, beforeUpdates); if(value == pre) return middle; else if(value > pre) left = middle + 1; else right = middle; } // empty array return -1; } /** * Finds the update with the lowest index in the given list that affects the same * PRE value as the update with the given index. * @param l list of updates * @param index of update * @param beforeUpdates find update for PRE values before updates have been applied * @return update with the lowest index that invalidates the distance of the same node * as the given one */ private static int refine(final List l, final int index, final boolean beforeUpdates) { int i = index; final int value = c(l, i--, beforeUpdates); while(i >= 0 && c(l, i, beforeUpdates) == value) i--; return i + 1; } /** * Recalculates the PRE value of the first node whose distance is affected by the * given update. * @param l list of updates * @param index index of the update * @param beforeUpdates calculate PRE value before or after updates * @return PRE value */ private static int c(final List l, final int index, final boolean beforeUpdates) { final BasicUpdate u = l.get(index); return u.preOfAffectedNode + (beforeUpdates ? u.accumulatedShifts : 0); } /** * Resolves unwanted text node adjacency which can result from structural changes in * the database. Adjacent text nodes are two text nodes A and B, where * PRE(B)=PRE(A)+1 and PARENT(A)=PARENT(B). */ private void resolveTextAdjacency() { // Text node merges are also gathered on a separate list to leverage optimizations. final AtomicUpdateList allMerges = new AtomicUpdateList(data); // keep track of the visited locations to avoid superfluous checks final IntSet s = new IntSet(); // Text nodes have to be merged from the highest to the lowest pre value for(final BasicUpdate u : updStructural) { final DataClip insseq = u.getInsertionData(); // calculate the new location of the update, here we have to check for adjacency final int newLocation = u.location + u.accumulatedShifts - u.shifts; final int beforeNewLocation = newLocation - 1; // check surroundings of this location for adjacent text nodes depending on the // kind of update, first the one with higher PRE values (due to shifts!) // ... for insert/replace ... if(insseq != null) { // calculate the current following node final int followingNode = newLocation + insseq.size(); final int beforeFollowingNode = followingNode - 1; // check the nodes at the end of/after the insertion sequence if(!s.contains(beforeFollowingNode)) { final AtomicUpdateList merges = necessaryMerges(beforeFollowingNode); merges.mergeNodes(); allMerges.merge(merges); s.add(beforeFollowingNode); } } // check nodes for delete and for insert before the updated location if(!s.contains(beforeNewLocation)) { final AtomicUpdateList merges = necessaryMerges(beforeNewLocation); merges.mergeNodes(); allMerges.merge(merges); s.add(beforeNewLocation); } } allMerges.updateDistances(); allMerges.clear(); } /** * Applies text node merges. */ private void mergeNodes() { check(); applyValueUpdates(); applyStructuralUpdates(); } /** * Returns atomic text node merging operations if necessary for the given node PRE and * its right neighbor PRE+1. * @param a node PRE value * @return list of text merging operations */ private AtomicUpdateList necessaryMerges(final int a) { final AtomicUpdateList mergeTwoNodes = new AtomicUpdateList(data); final int s = data.meta.size; final int b = a + 1; // don't leave table if(a >= s || b >= s || a < 0 || b < 0) return mergeTwoNodes; // only merge texts if(data.kind(a) != Data.TEXT || data.kind(b) != Data.TEXT) return mergeTwoNodes; // only merge neighboring texts if(data.parent(a, Data.TEXT) != data.parent(b, Data.TEXT)) return mergeTwoNodes; mergeTwoNodes.addDelete(b); mergeTwoNodes.addUpdateValue(a, Data.TEXT, Token.concat(data.text(a, true), data.text(b, true))); return mergeTwoNodes; } }basex-7.7.2/basex-core/src/main/java/org/basex/data/atomic/BasicUpdate.java000066400000000000000000000035131222453003200264150ustar00rootroot00000000000000package org.basex.data.atomic; import org.basex.data.*; /** * Abstract atomic update. * Atomic updates can only be initialized via {@link AtomicUpdateList}. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public abstract class BasicUpdate { /** PRE value of the target node. */ final int location; /** PRE value shifts introduced by this atomic update due to structural changes. */ final int shifts; /** PRE value of the first node for which the distance must be updated due to PRE value * shifts introduced by this update. */ final int preOfAffectedNode; /** Total/accumulated number of shifts introduced by all updates on the list up to this * updates (inclusive). The number of total shifts is used to calculate PRE values * before/after updates. */ int accumulatedShifts; /** * Constructor. * @param l target node location PRE * @param s PRE value shifts introduced by update * @param f PRE value of the first node the distance of which has to be updated */ BasicUpdate(final int l, final int s, final int f) { location = l; shifts = s; preOfAffectedNode = f; } /** * Applies the update to the given data instance. * @param d data instance on which to execute the update */ abstract void apply(final Data d); /** * Returns the data to be inserted (for inserts,...). * @return Insertion sequence data instance */ abstract DataClip getInsertionData(); /** * Returns the parent of the update location, mostly important for inserts. * @return parent PRE value */ abstract int parent(); /** * Returns whether this updates destroys the target nodes identity. Used to determine * superfluous operations on the subtree of the target. * @return true, if target node identity destroyed */ abstract boolean destructive(); } basex-7.7.2/basex-core/src/main/java/org/basex/data/atomic/DataClip.java000066400000000000000000000015431222453003200257130ustar00rootroot00000000000000package org.basex.data.atomic; import org.basex.data.*; /** * Data container with start and end offset. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DataClip { /** Data reference. */ public final Data data; /** Start value. */ public final int start; /** End value (+1). */ public final int end; /** Number of contained fragments. */ public int fragments; /** * Constructor. * @param d data reference */ public DataClip(final Data d) { this(d, 0, d.meta.size); } /** * Constructor. * @param d data reference * @param s start * @param e end */ public DataClip(final Data d, final int s, final int e) { data = d; start = s; end = e; } /** * Returns the box size. * @return size */ public int size() { return end - start; } } basex-7.7.2/basex-core/src/main/java/org/basex/data/atomic/Delete.java000066400000000000000000000014671222453003200254410ustar00rootroot00000000000000package org.basex.data.atomic; import org.basex.data.*; /** * Atomic update operation that deletes a node. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ final class Delete extends BasicUpdate { /** * Constructor. * @param l target node location PRE * @param s PRE value shifts introduced by update * @param f PRE value of the first node which distance has to be updated */ Delete(final int l, final int s, final int f) { super(l, s, f); } @Override void apply(final Data d) { d.delete(location); } @Override DataClip getInsertionData() { return null; } @Override int parent() { return -1; } @Override boolean destructive() { return true; } @Override public String toString() { return "Delete: " + location; } } basex-7.7.2/basex-core/src/main/java/org/basex/data/atomic/Insert.java000066400000000000000000000020111222453003200254650ustar00rootroot00000000000000package org.basex.data.atomic; import org.basex.data.*; /** * Atomic insert that inserts a given insertion sequence data instance into a database. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ final class Insert extends BasicUpdate { /** Parent PRE of inserted nodes. */ final int parent; /** Insertion sequence. */ final DataClip insseq; /** * Constructor. * @param l PRE value of the target node location * @param par parent PRE value for the inserted nodes * @param c insertion sequence data clip */ Insert(final int l, final int par, final DataClip c) { super(l, c.size(), l); parent = par; insseq = c; } @Override void apply(final Data d) { d.insert(location, parent, insseq); } @Override DataClip getInsertionData() { return insseq; } @Override int parent() { return parent; } @Override boolean destructive() { return false; } @Override public String toString() { return "Insert: " + location; } } basex-7.7.2/basex-core/src/main/java/org/basex/data/atomic/InsertAttr.java000066400000000000000000000020031222453003200263210ustar00rootroot00000000000000package org.basex.data.atomic; import org.basex.data.*; /** * Atomic update operation that inserts an attribute into a database. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ final class InsertAttr extends BasicUpdate { /** Parent PRE of inserted nodes. */ final int parent; /** Insertion sequence. */ final DataClip insseq; /** * Constructor. * @param l PRE value of the target node location * @param par parent PRE value for the inserted node * @param c insert sequence data clip */ InsertAttr(final int l, final int par, final DataClip c) { super(l, c.size(), l); parent = par; insseq = c; } @Override void apply(final Data d) { d.insertAttr(location, parent, insseq); } @Override DataClip getInsertionData() { return insseq; } @Override int parent() { return parent; } @Override boolean destructive() { return false; } @Override public String toString() { return "InsertAttr: " + location; } } basex-7.7.2/basex-core/src/main/java/org/basex/data/atomic/Rename.java000066400000000000000000000023371222453003200254430ustar00rootroot00000000000000package org.basex.data.atomic; import org.basex.data.*; import org.basex.util.*; /** * Atomic update operation that renames a node. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ final class Rename extends BasicUpdate { /** Kind of updated node. */ final int targetkind; /** The new name of the node. */ final byte[] name; /** Name URI. */ final byte[] uri; /** * Constructor. * @param l PRE value of target node location * @param k target node kind * @param n new name for the target node * @param u new name uri for the target node */ Rename(final int l, final int k, final byte[] n, final byte[] u) { super(l, 0, -1); if(n.length == 0) Util.notexpected("New name must not be empty."); targetkind = k; name = n; uri = u; } @Override void apply(final Data d) { d.update(location, targetkind, name, uri); } @Override DataClip getInsertionData() { Util.notexpected("No insertion sequence needed for atomic rename operation."); return null; } @Override int parent() { return -1; } @Override boolean destructive() { return false; } @Override public String toString() { return "Rename: " + location; } } basex-7.7.2/basex-core/src/main/java/org/basex/data/atomic/Replace.java000066400000000000000000000034131222453003200256030ustar00rootroot00000000000000package org.basex.data.atomic; import org.basex.data.*; /** * Replaces a node in the database with an insertion sequence. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ final class Replace extends BasicUpdate { /** Insertion sequence. */ final DataClip insseq; /** * Constructor. * @param l PRE value of the target node location * @param c insertion sequence data clip * @param s PRE value shifts introduced by update * @param f PRE value of the first node which distance has to be updated */ Replace(final int l, final int s, final int f, final DataClip c) { super(l, s, f); insseq = c; } @Override void apply(final Data d) { if(fastReplace(d)) d.replace(location, insseq); else { final int targetKind = d.kind(location); final int targetParent = d.parent(location, targetKind); // delete first - otherwise insert must be at location+1 d.delete(location); if(targetKind == Data.ATTR) d.insertAttr(location, targetParent, insseq); else d.insert(location, targetParent, insseq); } } /** * Checks whether an optimization for a faster replace can be leveraged. Only available * if no {@link Namespaces} exist in both the target and the source database. * @param d target database * @return true if fast replace possible */ private boolean fastReplace(final Data d) { return d.nspaces.size() == 0 && insseq.data.nspaces.size() == 0 && d.kind(location) != Data.ATTR; } @Override DataClip getInsertionData() { return insseq; } @Override int parent() { return -1; } @Override boolean destructive() { return true; } @Override public String toString() { return "Replace: " + location; } } basex-7.7.2/basex-core/src/main/java/org/basex/data/atomic/UpdateValue.java000066400000000000000000000022161222453003200264470ustar00rootroot00000000000000package org.basex.data.atomic; import org.basex.data.*; import org.basex.util.*; /** * Atomic update operation that replaces the value of a single text, comment, pi or * attribute node. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ final class UpdateValue extends BasicUpdate { /** Target node kind. */ final int targetkind; /** New value for target node. */ final byte[] value; /** * Constructor. * @param l PRE value of the target node location * @param k node kind of the target node * @param v new value which is assigned to the target node */ UpdateValue(final int l, final int k, final byte[] v) { super(l, 0, -1); targetkind = k; value = v; } @Override void apply(final Data d) { d.update(location, targetkind, value); } @Override DataClip getInsertionData() { Util.notexpected("No insertion sequence needed for atomic value update operation."); return null; } @Override int parent() { return -1; } @Override boolean destructive() { return false; } @Override public String toString() { return "UpdateValue: " + location; } } basex-7.7.2/basex-core/src/main/java/org/basex/data/package.html000066400000000000000000000000471222453003200243720ustar00rootroot00000000000000 Database structures. basex-7.7.2/basex-core/src/main/java/org/basex/gui/000077500000000000000000000000001222453003200217635ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/gui/AGUI.java000066400000000000000000000025371222453003200233620ustar00rootroot00000000000000package org.basex.gui; import static org.basex.gui.GUIConstants.*; import java.awt.*; import javax.swing.*; import org.basex.core.*; import org.basex.gui.layout.*; /** * Abstract class for GUI windows. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class AGUI extends JFrame { /** Database Context. */ public final Context context; /** GUI properties. */ public final GUIProp gprop; /** * Default constructor. * @param ctx database context * @param gprops gui properties */ AGUI(final Context ctx, final GUIProp gprops) { setIconImage(BaseXLayout.image("icon")); setTitle(null); context = ctx; gprop = gprops; } @Override public final void setTitle(final String title) { final String t = title == null || title.isEmpty() ? "" : " - " + title; super.setTitle(Text.TITLE + t); } /** * Sets a cursor. * @param c cursor to be set */ public final void cursor(final Cursor c) { cursor(c, false); } /** * Sets a cursor, forcing a new look if necessary. * @param c cursor to be set * @param force new cursor */ public final void cursor(final Cursor c, final boolean force) { final Cursor cc = getCursor(); if(cc != c && (cc != CURSORWAIT || force)) setCursor(c); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/GUI.java000066400000000000000000000517441222453003200232650ustar00rootroot00000000000000package org.basex.gui; import static org.basex.core.Text.*; import static org.basex.gui.GUIConstants.*; import java.awt.*; import java.awt.event.*; import java.util.regex.*; import javax.swing.*; import javax.swing.border.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.core.parse.*; import org.basex.data.*; import org.basex.gui.dialog.*; import org.basex.gui.layout.*; import org.basex.gui.view.*; import org.basex.gui.view.editor.*; import org.basex.gui.view.explore.*; import org.basex.gui.view.folder.*; import org.basex.gui.view.info.*; import org.basex.gui.view.map.*; import org.basex.gui.view.plot.*; import org.basex.gui.view.table.*; import org.basex.gui.view.text.*; import org.basex.gui.view.tree.*; import org.basex.io.*; import org.basex.io.out.*; import org.basex.query.*; import org.basex.util.*; /** * This class is the main window of the GUI. It is the central instance * for user interactions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class GUI extends AGUI { /** View Manager. */ public final ViewNotifier notify; /** Status line. */ public final GUIStatus status; /** Input field. */ public final GUIInput input; /** Filter button. */ public final BaseXButton filter; /** Search view. */ public final EditorView editor; /** Info view. */ public final InfoView info; /** Painting flag; if activated, interactive operations are skipped. */ public boolean painting; /** Updating flag; if activated, operations accessing the data are skipped. */ public boolean updating; /** Fullscreen flag. */ public boolean fullscreen; /** Result panel. */ private final GUIMenu menu; /** Button panel. */ public final BaseXBack buttons; /** Navigation/input panel. */ public final BaseXBack nav; /** Content panel, containing all views. */ final ViewContainer views; /** History button. */ final BaseXButton hist; /** Current input Mode. */ final BaseXCombo mode; /** Text view. */ private final TextView text; /** Top panel. */ private final BaseXBack top; /** Execution Button. */ private final BaseXButton go; /** Control panel. */ private final BaseXBack control; /** Results label. */ private final BaseXLabel hits; /** Buttons. */ private final GUIToolBar toolbar; /** Current command. */ private Command command; /** Menu panel height. */ private int menuHeight; /** Fullscreen Window. */ private JFrame fullscr; /** Thread counter. */ private int threadID; /** Password reader. */ public static final PasswordReader READER = new PasswordReader() { @Override public String password() { final DialogPass dp = new DialogPass(); return dp.ok() ? Token.md5(dp.pass()) : ""; } }; /** Info listener. */ public final InfoListener infoListener = new InfoListener() { @Override public void info(final String inf) { info.setInfo(inf, null, true, false); } }; /** * Default constructor. * @param ctx database context * @param gprops gui properties */ public GUI(final Context ctx, final GUIProp gprops) { super(ctx, gprops); GUIMacOSX.enableOSXFullscreen(this); // set window size final Dimension scr = Toolkit.getDefaultToolkit().getScreenSize(); final int[] ps = gprop.nums(GUIProp.GUILOC); final int[] sz = gprop.nums(GUIProp.GUISIZE); final int x = Math.max(0, Math.min(scr.width - sz[0], ps[0])); final int y = Math.max(0, Math.min(scr.height - sz[1], ps[1])); setBounds(x, y, sz[0], sz[1]); if(gprop.is(GUIProp.MAXSTATE)) { setExtendedState(MAXIMIZED_HORIZ); setExtendedState(MAXIMIZED_VERT); setExtendedState(MAXIMIZED_BOTH); } top = new BaseXBack(new BorderLayout()); // add header control = new BaseXBack(new BorderLayout()); // add menu bar menu = new GUIMenu(this); setJMenuBar(menu); buttons = new BaseXBack(new BorderLayout()); toolbar = new GUIToolBar(TOOLBAR, this); buttons.add(toolbar, BorderLayout.WEST); hits = new BaseXLabel(" "); hits.setFont(hits.getFont().deriveFont(18f)); hits.setHorizontalAlignment(SwingConstants.RIGHT); BaseXBack b = new BaseXBack(); b.add(hits); buttons.add(b, BorderLayout.EAST); if(gprop.is(GUIProp.SHOWBUTTONS)) control.add(buttons, BorderLayout.CENTER); nav = new BaseXBack(new BorderLayout(5, 0)).border(2, 2, 0, 2); mode = new BaseXCombo(this, SEARCH, XQUERY, COMMAND); mode.setSelectedIndex(2); mode.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final int s = mode.getSelectedIndex(); if(s == gprop.num(GUIProp.SEARCHMODE) || !mode.isEnabled()) return; gprop.set(GUIProp.SEARCHMODE, s); input.setText(""); refreshControls(); } }); nav.add(mode, BorderLayout.WEST); input = new GUIInput(this); hist = new BaseXButton(this, "hist", H_SHOW_HISTORY); hist.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final JPopupMenu pop = new JPopupMenu(); final ActionListener al = new ActionListener() { @Override public void actionPerformed(final ActionEvent ac) { input.setText(ac.getActionCommand()); input.requestFocusInWindow(); pop.setVisible(false); } }; final int i = context.data() == null ? 2 : gprop.num(GUIProp.SEARCHMODE); final String[] hs = gprop.strings(i == 0 ? GUIProp.SEARCH : i == 1 ? GUIProp.XQUERY : GUIProp.COMMANDS); for(final String en : hs) { final JMenuItem jmi = new JMenuItem(en); jmi.addActionListener(al); pop.add(jmi); } pop.show(hist, 0, hist.getHeight()); } }); b = new BaseXBack(new BorderLayout(5, 0)); b.add(hist, BorderLayout.WEST); b.add(input, BorderLayout.CENTER); nav.add(b, BorderLayout.CENTER); go = new BaseXButton(this, "go", H_EXECUTE_QUERY); go.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { execute(); } }); filter = BaseXButton.command(GUICommands.C_FILTER, this); b = new BaseXBack(new TableLayout(1, 3)); b.add(go); b.add(Box.createHorizontalStrut(1)); b.add(filter); nav.add(b, BorderLayout.EAST); if(gprop.is(GUIProp.SHOWINPUT)) control.add(nav, BorderLayout.SOUTH); top.add(control, BorderLayout.NORTH); // create views notify = new ViewNotifier(this); text = new TextView(notify); editor = new EditorView(notify); info = new InfoView(notify); // create panels for closed and opened database mode views = new ViewContainer(this, text, editor, info, new FolderView(notify), new PlotView(notify), new TableView(notify), new MapView(notify), new TreeView(notify), new ExploreView(notify) ); top.add(views, BorderLayout.CENTER); setContentBorder(); // add status bar status = new GUIStatus(this); if(gprop.is(GUIProp.SHOWSTATUS)) top.add(status, BorderLayout.SOUTH); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); add(top); setVisible(true); views.updateViews(); refreshControls(); // start logo animation as thread new Thread() { @Override public void run() { checkVersion(); } }.start(); input.requestFocusInWindow(); } @Override public void dispose() { // close opened queries if(!editor.confirm()) return; final boolean max = getExtendedState() == MAXIMIZED_BOTH; gprop.set(GUIProp.MAXSTATE, max); if(!max) { gprop.set(GUIProp.GUILOC, new int[] { getX(), getY() }); gprop.set(GUIProp.GUISIZE, new int[] { getWidth(), getHeight() }); } super.dispose(); gprop.write(); context.close(); } /** * Executes the input of the {@link GUIInput} bar. */ void execute() { final String in = input.getText().trim(); final boolean cmd = mode.getSelectedIndex() == 2; // run as command: command mode or exclamation mark as first character final boolean exc = in.startsWith("!"); if(cmd || exc) { try { // parse and execute all commands final CommandParser cp = new CommandParser(in.substring(exc ? 1 : 0), context); cp.pwReader(READER); execute(false, cp.parse()); } catch(final QueryException ex) { if(!info.visible()) GUICommands.C_SHOWINFO.execute(this); info.setInfo(Util.message(ex), null, false, true); } } else if(gprop.num(GUIProp.SEARCHMODE) == 1 || in.startsWith("/")) { xquery(in, false); } else { execute(false, new Find(in, gprop.is(GUIProp.FILTERRT))); } } /** * Launches a query. Adds the default namespace, if available. * The command is ignored if an update operation takes place. * @param qu query to be run * @param edit editor panel */ public void xquery(final String qu, final boolean edit) { // check and add default namespace final Data data = context.data(); final Namespaces ns = data.nspaces; String in = qu.trim().isEmpty() ? "()" : qu; final int u = ns.uri(Token.EMPTY, 0, data); if(u != 0) in = Util.info("declare default element namespace \"%\"; %", ns.uri(u), in); execute(edit, new XQuery(in)); } /** * Launches the specified command in a separate thread. * The command is ignored if an update operation takes place. * @param cmd command to be launched */ public void execute(final Command cmd) { execute(false, cmd); } /** * Launches the specified commands in a separate thread. * The command is ignored if an update operation takes place. * @param edit call from editor view * @param cmd command to be launched */ public void execute(final boolean edit, final Command... cmd) { // ignore command if updates take place if(updating) return; new Thread() { @Override public void run() { if(cmd.length == 0) info.setInfo("", null, true, true); for(final Command c : cmd) if(!exec(c, edit)) break; } }.start(); } /** * Executes the specified command. * @param cmd command to be executed * @param edit call from editor panel * @return success flag */ boolean exec(final Command cmd, final boolean edit) { // wait when command is still running final int thread = ++threadID; while(true) { final Command c = command; if(c == null) break; c.stop(); Thread.yield(); if(threadID != thread) return true; } cursor(CURSORWAIT); boolean ok = true; try { final Performance perf = new Performance(); final Data data = context.data(); // reset current context if realtime filter is activated if(gprop.is(GUIProp.FILTERRT) && data != null && !context.root()) context.update(); // remember current command and context nodes final Nodes current = context.current(); command = cmd; // execute command and cache result final ArrayOutput ao = new ArrayOutput().max(gprop.num(GUIProp.MAXTEXT)); updating = cmd.updating(context); // updates the query editor if(edit) editor.start(); // reset visualizations if data reference will be changed if(cmd.newData(context)) notify.init(); // attaches the info listener to the command cmd.listen(infoListener); // evaluate command String inf = null; try { cmd.execute(context, ao); inf = cmd.info(); } catch(final BaseXException ex) { ok = false; inf = Util.message(ex); } finally { updating = false; } final String time = perf.getTime(); // show query info info.setInfo(inf, cmd, time, ok, true); // sends feedback to the query editor final boolean interrupted = inf.endsWith(INTERRUPTED); if(edit) { editor.info(interrupted ? INTERRUPTED : ok ? OK : inf, ok || interrupted, true); } // check if query feedback was evaluated in the query view if(!ok && !interrupted) { // display error in info view if((!edit || inf.startsWith(BUGINFO)) && !info.visible()) { GUICommands.C_SHOWINFO.execute(this); } } else { // get query result final Result result = cmd.result(); Nodes nodes = result instanceof Nodes && result.size() != 0 ? (Nodes) result : null; if(context.data() != data) { // database reference has changed - notify views notify.init(); } else if(cmd.updated(context)) { // update visualizations notify.update(); // adopt updated nodes as result set if(nodes == null) nodes = context.current(); } else if(result != null) { // check if result has changed final boolean flt = gprop.is(GUIProp.FILTERRT); final Nodes nd = context.current(); if(flt || nd != null && !nd.sameAs(current)) { // refresh context if at least one node was found if(nodes != null) notify.context((Nodes) result, flt, null); } else if(context.marked != null) { // refresh highlight Nodes m = context.marked; if(nodes != null) { // use query result m = nodes; } else if(m.size() != 0) { // remove old highlight m = new Nodes(data); } // refresh views if(context.marked != m) notify.mark(m, null); } } if(thread == threadID && !interrupted) { // show status info status.setText(Util.info(TIME_NEEDED_X, time)); // show number of hits if(result != null) setResults(result.size()); if(nodes == null) { // make text view visible if(!text.visible() && ao.size() != 0) GUICommands.C_SHOWRESULT.execute(this); // assign textual output if no node result was created text.setText(ao); } text.cacheText(ao, cmd, result); } } } catch(final Exception ex) { // unexpected error BaseXDialog.error(this, Util.info(EXEC_ERROR, cmd, Util.bug(ex))); updating = false; } cursor(CURSORARROW, true); command = null; return ok; } /** * Stops the current process. */ public void stop() { if(command != null) command.stop(); cursor(CURSORARROW, true); command = null; } /** * Sets a property and displays the command in the info view. * @param pr property to be set * @param val value */ public void set(final Object[] pr, final Object val) { set(context.prop, pr, val); } /** * Sets a property and displays the command in the info view. * @param prop property instance * @param pr property to be set * @param val value */ private void set(final AProp prop, final Object[] pr, final Object val) { if(!prop.sameAs(pr, val)) { final Set cmd = new Set(pr, val); cmd.run(context); info.setInfo(cmd.info(), cmd, true, false); } } /** * Sets the border of the content area. */ private void setContentBorder() { final int n = control.getComponentCount(); final int n2 = top.getComponentCount(); if(n == 0 && n2 == 2) { views.border(0); } else { views.setBorder(new CompoundBorder(new EmptyBorder(3, 1, 3, 1), new EtchedBorder())); } } /** * Refreshes the layout. */ public void updateLayout() { init(gprop); notify.layout(); views.repaint(); } /** * Updates the control panel. * @param comp component to be updated * @param show true if component is visible * @param layout component layout */ public void updateControl(final JComponent comp, final boolean show, final String layout) { if(comp == status) { if(!show) top.remove(comp); else top.add(comp, layout); } else if(comp == menu) { if(!show) menuHeight = menu.getHeight(); final int s = show ? menuHeight : 0; BaseXLayout.setHeight(menu, s); menu.setSize(menu.getWidth(), s); } else { // buttons, input if(!show) control.remove(comp); else control.add(comp, layout); } setContentBorder(); (fullscr == null ? getRootPane() : fullscr).validate(); refreshControls(); } /** * Updates the view layout. */ public void layoutViews() { views.updateViews(); refreshControls(); repaint(); } /** * Refreshes the menu and the buttons. */ public void refreshControls() { final Nodes marked = context.marked; if(marked != null) setResults(marked.size()); filter.setEnabled(marked != null && marked.size() != 0); final boolean inf = gprop.is(GUIProp.SHOWINFO); context.prop.set(Prop.QUERYINFO, inf); context.prop.set(Prop.XMLPLAN, inf); final Data data = context.data(); final int t = mode.getSelectedIndex(); final int s = data == null ? 2 : gprop.num(GUIProp.SEARCHMODE); mode.setEnabled(data != null); go.setEnabled(s == 2 || !gprop.is(GUIProp.EXECRT)); if(s != t) { mode.setSelectedIndex(s); input.setText(""); input.requestFocusInWindow(); } toolbar.refresh(); menu.refresh(); final int i = context.data() == null ? 2 : gprop.num(GUIProp.SEARCHMODE); final Object[] options = i == 0 ? GUIProp.SEARCH : i == 1 ? GUIProp.XQUERY : GUIProp.COMMANDS; hist.setEnabled(gprop.strings(options).length != 0); } /** * Sets results information. * @param n number of results */ private void setResults(final long n) { int mh = context.prop.num(Prop.MAXHITS); if(mh < 0) mh = Integer.MAX_VALUE; hits.setText(Util.info(RESULTS_X, (n >= mh ? "\u2265" : "") + n)); } /** * Turns fullscreen mode on/off. */ public void fullscreen() { fullscreen ^= true; fullscreen(fullscreen); } /** * Turns fullscreen mode on/off. * @param full fullscreen mode */ public void fullscreen(final boolean full) { if(full ^ fullscr == null) return; if(full) { control.remove(buttons); control.remove(nav); getRootPane().remove(menu); top.remove(status); remove(top); fullscr = new JFrame(); fullscr.setIconImage(getIconImage()); fullscr.setTitle(getTitle()); fullscr.setUndecorated(true); fullscr.setJMenuBar(menu); fullscr.add(top); fullscr.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); } else { fullscr.removeAll(); fullscr.dispose(); fullscr = null; if(!gprop.is(GUIProp.SHOWBUTTONS)) control.add(buttons, BorderLayout.CENTER); if(!gprop.is(GUIProp.SHOWINPUT)) control.add(nav, BorderLayout.SOUTH); if(!gprop.is(GUIProp.SHOWSTATUS)) top.add(status, BorderLayout.SOUTH); setJMenuBar(menu); add(top); } gprop.set(GUIProp.SHOWBUTTONS, !full); gprop.set(GUIProp.SHOWINPUT, !full); gprop.set(GUIProp.SHOWSTATUS, !full); fullscreen = full; GraphicsEnvironment.getLocalGraphicsEnvironment(). getDefaultScreenDevice().setFullScreenWindow(fullscr); setContentBorder(); refreshControls(); updateControl(menu, !full, BorderLayout.NORTH); setVisible(!full); } /** * Checks for a new version and shows a confirmation dialog. */ void checkVersion() { final Version disk = new Version(gprop.get(GUIProp.UPDATEVERSION)); final Version used = new Version(Prop.VERSION.replaceAll(" .*", "")); if(disk.compareTo(used) < 0) { // update version property to latest used version gprop.set(GUIProp.UPDATEVERSION, used.toString()); } else { try { final String page = Token.string(new IOUrl(VERSION_URL).read()); final Matcher m = Pattern.compile("^(Version )?([\\w\\d.]*?)( .*|$)", Pattern.DOTALL).matcher(page); if(m.matches()) { final Version latest = new Version(m.group(2)); if(disk.compareTo(latest) < 0 && BaseXDialog.confirm(this, Util.info(H_NEW_VERSION, Prop.NAME, latest))) { BaseXDialog.browse(this, UPDATE_URL); } else { // don't show update dialog anymore if it has been rejected once gprop.set(GUIProp.UPDATEVERSION, latest.toString()); } } } catch(final Exception ex) { // ignore connection failure } } } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/GUIBaseCmd.java000066400000000000000000000013101222453003200244640ustar00rootroot00000000000000package org.basex.gui; import javax.swing.*; /** * This class provides a default implementation for GUI commands. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class GUIBaseCmd implements GUICmd { /** Separator. */ public static final GUICmd SEPARATOR = new GUIBaseCmd() { @Override public void execute(final GUI gui) { } @Override public String label() { return null; } }; @Override public boolean checked() { return false; } @Override public String help() { return null; } @Override public String key() { return null; } @Override public void refresh(final GUI main, final AbstractButton button) { } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/GUICmd.java000066400000000000000000000016641222453003200237050ustar00rootroot00000000000000package org.basex.gui; import javax.swing.*; /** * This interface defines GUI command methods. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public interface GUICmd { /** * Executes the command. * @param gui reference to the main window */ void execute(final GUI gui); /** * Enables or disables the specified button, depending on the command properties. * @param gui reference to the main window * @param button button to be modified */ void refresh(final GUI gui, final AbstractButton button); /** * Tests if this command includes a menu checkbox. * @return result of check */ boolean checked(); /** * Returns the command label. * @return command label */ String label(); /** * Returns the command help. * @return command help */ String help(); /** * Returns the command shortcut. * @return command shortcut */ String key(); } basex-7.7.2/basex-core/src/main/java/org/basex/gui/GUICommands.java000066400000000000000000000605321222453003200247420ustar00rootroot00000000000000package org.basex.gui; import static org.basex.core.Text.*; import java.awt.*; import java.awt.datatransfer.*; import javax.swing.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.gui.dialog.*; import org.basex.gui.layout.*; import org.basex.gui.view.*; import org.basex.io.*; import org.basex.query.func.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.list.*; /** * This enumeration encapsulates all commands that are triggered by * GUI operations. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public enum GUICommands implements GUICmd { /* DATABASE MENU */ /** Opens a dialog to create a new database. */ C_CREATE(NEW + DOTS, "% N", H_NEW, false, false) { @Override public void execute(final GUI gui) { // open file chooser for XML creation final DialogNew dialog = new DialogNew(gui); if(!dialog.ok()) return; final String in = gui.gprop.get(GUIProp.INPUTPATH); final String db = gui.gprop.get(GUIProp.DBNAME); DialogProgress.execute(gui, new CreateDB(db, in.isEmpty() ? null : in)); } }, /** Opens a dialog to manage databases. */ C_OPEN_MANAGE(OPEN_MANAGE + DOTS, "% O", H_OPEN_MANAGE, false, false) { @Override public void execute(final GUI gui) { if(new DialogManage(gui).nodb() && BaseXDialog.confirm(gui, NEW_DB_QUESTION)) C_CREATE.execute(gui); } }, /** Shows database info. */ C_INFO(PROPERTIES + DOTS, "% D", H_PROPERTIES, true, false) { @Override public void execute(final GUI gui) { new DialogProps(gui); } }, /** Exports a database. */ C_EXPORT(EXPORT + DOTS, "% shift E", H_EXPORT, true, false) { @Override public void execute(final GUI gui) { final DialogExport dialog = new DialogExport(gui); if(!dialog.ok()) return; final IOFile root = new IOFile(dialog.path()); // check if existing files will be overwritten if(root.exists()) { IO file = null; boolean overwrite = false; final Data d = gui.context.data(); final IntList il = d.resources.docs(); final int is = il.size(); for(int i = 0; i < is; i++) { file = root.merge(Token.string(d.text(il.get(i), true))); if(file.exists()) { if(overwrite) { // more than one file will be overwritten; check remaining tests file = null; break; } overwrite = true; } } if(overwrite) { // show message for overwriting files or directories final String msg = file == null ? FILES_REPLACE_X : FILE_EXISTS_X; if(file == null) file = root; if(!BaseXDialog.confirm(gui, Util.info(msg, file))) return; } } DialogProgress.execute(gui, new Export(root.path())); } }, /** Closes the database. */ C_CLOSE(CLOSE, "% shift W", H_CLOSE, true, false) { @Override public void execute(final GUI gui) { gui.execute(new Close()); } }, /** Server Dialog. */ C_SERVER(S_SERVER_ADMIN + DOTS, null, S_H_SERVER_ADMIN, false, false) { @Override public void execute(final GUI gui) { // open file chooser for XML creation new DialogServer(gui); } }, /** Creates a new file in the editor. */ C_EDITNEW(NEW + DOTS, "% T", H_NEW_FILE, false, false) { @Override public void execute(final GUI gui) { gui.editor.newFile(); } }, /** Opens a new file in the editor. */ C_EDITOPEN(OPEN + DOTS, "% R", H_OPEN_FILE, false, false) { @Override public void execute(final GUI gui) { gui.editor.open(); } }, /** Reverts the current editor file. */ C_EDITREOPEN(REOPEN + DOTS, "% shift R", H_REOPEN_FILE, false, false) { @Override public void execute(final GUI gui) { gui.editor.reopen(); } @Override public void refresh(final GUI gui, final AbstractButton b) { b.setEnabled(gui.editor != null); } }, /** Saves the current file in the editor. */ C_EDITSAVE(SAVE, "% S", H_SAVE, false, false) { @Override public void execute(final GUI gui) { gui.editor.save(); } @Override public void refresh(final GUI gui, final AbstractButton b) { b.setEnabled(gui.editor != null && gui.editor.modified()); } }, /** Saves the current editor file under a new name. */ C_EDITSAVEAS(SAVE_AS + DOTS, "% shift S", H_SAVE, false, false) { @Override public void execute(final GUI gui) { gui.editor.saveAs(); } }, /** Closes the current editor file. */ C_EDITCLOSE(CLOSE, "% W", H_CLOSE_FILE, false, false) { @Override public void execute(final GUI gui) { gui.editor.close(null); } }, /** Jumps to a certain line. */ C_EDIT_GOTO(GO_TO_LINE + DOTS, "% L", H_GO_TO_LINE, false, false) { @Override public void execute(final GUI gui) { gui.editor.gotoLine(); } }, /** Exits the application. */ C_EXIT(EXIT, "% Q", H_EXIT, false, false) { @Override public void execute(final GUI gui) { gui.dispose(); } }, /* EDIT COMMANDS */ /** Copies the current path. */ C_COPYPATH(COPY_PATH, "% shift C", H_CPPATH, true, false) { @Override public void execute(final GUI gui) { final int pre = gui.context.marked.pres[0]; final byte[] txt = ViewData.path(gui.context.data(), pre); // copy path to clipboard final Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard(); clip.setContents(new StringSelection(Token.string(txt)), null); } @Override public void refresh(final GUI gui, final AbstractButton b) { // disallow copy of empty node set or root node final Nodes marked = gui.context.marked; b.setEnabled(marked != null && marked.size() != 0); } }, /** Copies the currently marked nodes. */ C_COPY(COPY, null, H_COPY, true, false) { @Override public void execute(final GUI gui) { final Context ctx = gui.context; final Nodes n = ctx.marked; ctx.copied = new Nodes(n.pres, n.data); } @Override public void refresh(final GUI gui, final AbstractButton b) { // disallow copy of empty node set or root node b.setEnabled(updatable(gui.context.marked)); } }, /** Pastes the copied nodes. */ C_PASTE(PASTE, null, H_PASTE, true, false) { @Override public void execute(final GUI gui) { final StringBuilder sb = new StringBuilder(); final Nodes n = gui.context.copied; for(int i = 0; i < n.size(); ++i) { if(i > 0) sb.append(','); sb.append(openPre(n, i)); } gui.context.copied = null; gui.execute(new XQuery("insert nodes (" + sb + ") into " + openPre(gui.context.marked, 0))); } @Override public void refresh(final GUI gui, final AbstractButton b) { final Context ctx = gui.context; // disallow copy of empty node set or root node b.setEnabled(updatable(ctx.marked, Data.DOC) && ctx.copied != null); } }, /** Deletes the currently marked nodes. */ C_DELETE(DELETE + DOTS, null, H_DELETE, true, false) { @Override public void execute(final GUI gui) { if(!BaseXDialog.confirm(gui, DELETE_NODES)) return; final StringBuilder sb = new StringBuilder(); final Nodes n = gui.context.marked; for(int i = 0; i < n.size(); ++i) { if(i > 0) sb.append(','); sb.append(openPre(n, i)); } gui.context.marked = new Nodes(n.data); gui.context.copied = null; gui.context.focused = -1; gui.execute(new XQuery("delete nodes (" + sb + ')')); } @Override public void refresh(final GUI gui, final AbstractButton b) { // disallow deletion of empty node set or root node b.setEnabled(updatable(gui.context.marked)); } }, /** Inserts new nodes. */ C_INSERT(NEW + DOTS, null, H_NEW_NODE, true, false) { @Override public void execute(final GUI gui) { final Nodes n = gui.context.marked; final DialogInsert insert = new DialogInsert(gui); if(!insert.ok()) return; final StringList sl = insert.result; final NodeType type = ANode.type(insert.kind); String item = Token.string(type.string()) + " { " + quote(sl.get(0)) + " }"; if(type == NodeType.ATT || type == NodeType.PI) { item += " { " + quote(sl.get(1)) + " }"; } else if(type == NodeType.ELM) { item += " { () }"; } gui.context.copied = null; gui.execute(new XQuery("insert node " + item + " into " + openPre(n, 0))); } @Override public void refresh(final GUI gui, final AbstractButton b) { b.setEnabled(updatable(gui.context.marked, Data.ATTR, Data.PI, Data.COMM, Data.TEXT)); } }, /** Opens a dialog to edit the currently marked nodes. */ C_EDIT(EDIT + DOTS, null, H_EDIT, true, false) { @Override public void execute(final GUI gui) { final Nodes n = gui.context.marked; final DialogEdit edit = new DialogEdit(gui, n.pres[0]); if(!edit.ok()) return; String rename = null; String replace = null; final int k = edit.kind; if(k == Data.ELEM || k == Data.PI || k == Data.ATTR) { rename = edit.result.get(0); if(k != Data.ELEM) replace = edit.result.get(1); } else { replace = edit.result.get(0); } if(rename != null) gui.execute(new XQuery("rename node " + openPre(n, 0) + " as " + quote(rename))); if(replace != null) gui.execute(new XQuery("replace value of node " + openPre(n, 0) + " with " + quote(replace))); } @Override public void refresh(final GUI gui, final AbstractButton b) { b.setEnabled(updatable(gui.context.marked, Data.DOC)); } }, /** Filters the currently marked nodes. */ C_FILTER(FILTER_SELECTED, "alt ENTER", H_FILTER_SELECTED, true, false) { @Override public void execute(final GUI gui) { final Context ctx = gui.context; Nodes marked = ctx.marked; if(marked.size() == 0) { final int pre = gui.context.focused; if(pre == -1) return; marked = new Nodes(pre, ctx.data()); } gui.notify.context(marked, false, null); } @Override public void refresh(final GUI gui, final AbstractButton b) { final Nodes marked = gui.context.marked; b.setEnabled(marked != null && marked.size() != 0); } }, /** Shows the XQuery view. */ C_SHOWEDITOR(EDITOR, "% E", H_EDITOR, false, true) { @Override public void execute(final GUI gui) { gui.gprop.invert(GUIProp.SHOWEDITOR); gui.layoutViews(); } @Override public void refresh(final GUI gui, final AbstractButton b) { super.refresh(gui, b); b.setSelected(gui.gprop.is(GUIProp.SHOWEDITOR)); } }, /** Shows info. */ C_SHOWINFO(QUERY_INFO, "% I", H_QUERY_INFO, false, true) { @Override public void execute(final GUI gui) { gui.gprop.invert(GUIProp.SHOWINFO); gui.layoutViews(); } @Override public void refresh(final GUI gui, final AbstractButton b) { super.refresh(gui, b); b.setSelected(gui.gprop.is(GUIProp.SHOWINFO)); } }, /** Repository manager. */ C_PACKAGES(PACKAGES + DOTS, null, H_PACKAGES, false, false) { @Override public void execute(final GUI gui) { new DialogPackages(gui); } }, /* VIEW MENU */ /** Shows the buttons. */ C_SHOWBUTTONS(BUTTONS, null, H_BUTTONS, false, true) { @Override public void execute(final GUI gui) { gui.gprop.invert(GUIProp.SHOWBUTTONS); gui.updateControl(gui.buttons, gui.gprop.is(GUIProp.SHOWBUTTONS), BorderLayout.CENTER); } @Override public void refresh(final GUI gui, final AbstractButton b) { super.refresh(gui, b); b.setSelected(gui.gprop.is(GUIProp.SHOWBUTTONS)); } }, /** Show Input Field. */ C_SHOWINPUT(INPUT_BAR, null, H_INPUT_BAR, false, true) { @Override public void execute(final GUI gui) { gui.updateControl(gui.nav, gui.gprop.invert(GUIProp.SHOWINPUT), BorderLayout.SOUTH); } @Override public void refresh(final GUI gui, final AbstractButton b) { super.refresh(gui, b); b.setSelected(gui.gprop.is(GUIProp.SHOWINPUT)); } }, /** Shows the status bar. */ C_SHOWSTATUS(STATUS_BAR, null, H_STATUS_BAR, false, true) { @Override public void execute(final GUI gui) { gui.updateControl(gui.status, gui.gprop.invert(GUIProp.SHOWSTATUS), BorderLayout.SOUTH); } @Override public void refresh(final GUI gui, final AbstractButton b) { super.refresh(gui, b); b.setSelected(gui.gprop.is(GUIProp.SHOWSTATUS)); } }, /** Shows the text view. */ C_SHOWRESULT(RESULT, "% 1", H_RESULT, false, true) { @Override public void execute(final GUI gui) { gui.gprop.invert(GUIProp.SHOWTEXT); gui.layoutViews(); } @Override public void refresh(final GUI gui, final AbstractButton b) { super.refresh(gui, b); b.setSelected(gui.gprop.is(GUIProp.SHOWTEXT)); } }, /** Shows the map. */ C_SHOWMAP(MAP, "% 2", H_MAP, true, true) { @Override public void execute(final GUI gui) { gui.gprop.invert(GUIProp.SHOWMAP); gui.layoutViews(); } @Override public void refresh(final GUI gui, final AbstractButton b) { super.refresh(gui, b); b.setSelected(gui.gprop.is(GUIProp.SHOWMAP)); } }, /** Shows the tree view. */ C_SHOWTREE(TREE, "% 3", H_TREE, true, true) { @Override public void execute(final GUI gui) { gui.gprop.invert(GUIProp.SHOWTREE); gui.layoutViews(); } @Override public void refresh(final GUI gui, final AbstractButton b) { super.refresh(gui, b); b.setSelected(gui.gprop.is(GUIProp.SHOWTREE)); } }, /** Shows the tree view. */ C_SHOWFOLDER(FOLDER, "% 4", H_FOLDER, true, true) { @Override public void execute(final GUI gui) { gui.gprop.invert(GUIProp.SHOWFOLDER); gui.layoutViews(); } @Override public void refresh(final GUI gui, final AbstractButton b) { super.refresh(gui, b); b.setSelected(gui.gprop.is(GUIProp.SHOWFOLDER)); } }, /** Shows the plot view. */ C_SHOWPLOT(PLOT, "% 5", H_PLOT, true, true) { @Override public void execute(final GUI gui) { gui.gprop.invert(GUIProp.SHOWPLOT); gui.layoutViews(); } @Override public void refresh(final GUI gui, final AbstractButton b) { super.refresh(gui, b); b.setSelected(gui.gprop.is(GUIProp.SHOWPLOT)); } }, /** Shows the table view. */ C_SHOWTABLE(TABLE, "% 6", H_TABLE, true, true) { @Override public void execute(final GUI gui) { gui.gprop.invert(GUIProp.SHOWTABLE); gui.layoutViews(); } @Override public void refresh(final GUI gui, final AbstractButton b) { super.refresh(gui, b); b.setSelected(gui.gprop.is(GUIProp.SHOWTABLE)); } }, /** Shows the explorer view. */ C_SHOWEXPLORE(EXPLORER, "% 7", H_EXPLORER, true, true) { @Override public void execute(final GUI gui) { gui.gprop.invert(GUIProp.SHOWEXPLORE); gui.layoutViews(); } @Override public void refresh(final GUI gui, final AbstractButton b) { super.refresh(gui, b); b.setSelected(gui.gprop.is(GUIProp.SHOWEXPLORE)); } }, /** Fullscreen mode. */ C_FULL(FULLSCREEN, Prop.MAC ? "% shift F" : "F11", H_FULLSCREEN, false, true) { @Override public void execute(final GUI gui) { gui.fullscreen(); } @Override public void refresh(final GUI gui, final AbstractButton b) { super.refresh(gui, b); b.setSelected(gui.fullscreen); } }, /* OPTION MENU */ /** Realtime execution on/off. */ C_RTEXEC(RT_EXECUCTION, null, H_RT_EXECUTION, false, true) { @Override public void execute(final GUI gui) { gui.gprop.invert(GUIProp.EXECRT); gui.stop(); // refresh buttons in input bar gui.refreshControls(); // refresh editor buttons gui.editor.refreshMark(); } @Override public void refresh(final GUI gui, final AbstractButton b) { super.refresh(gui, b); b.setSelected(gui.gprop.is(GUIProp.EXECRT)); } }, /** Realtime filtering on/off. */ C_RTFILTER(RT_FILTERING, null, H_RT_FILTERING, true, true) { @Override public void execute(final GUI gui) { final boolean rt = gui.gprop.invert(GUIProp.FILTERRT); gui.stop(); // refresh buttons in input bar gui.refreshControls(); // refresh editor buttons gui.editor.refreshMark(); final Context ctx = gui.context; final boolean root = ctx.root(); final Data data = ctx.data(); if(!rt) { if(!root) { gui.notify.context(new Nodes(0, data), true, null); gui.notify.mark(ctx.current(), null); } } else { if(root) { gui.notify.mark(new Nodes(data), null); } else { final Nodes mark = ctx.marked; ctx.marked = new Nodes(data); gui.notify.context(mark, true, null); } } } @Override public void refresh(final GUI gui, final AbstractButton b) { super.refresh(gui, b); b.setSelected(gui.gprop.is(GUIProp.FILTERRT)); } }, /** Color schema. */ C_COLOR(COLORS + DOTS, null, H_COLORS, false, false) { @Override public void execute(final GUI gui) { new DialogColors(gui); } }, /** Changes the fonts. */ C_FONTS(FONTS_D, null, H_FONTS, false, false) { @Override public void execute(final GUI gui) { new DialogFonts(gui); } }, /** Map layout. */ C_MAPLAYOUT(MAP_LAYOUT_D, null, H_MAP_LAYOUT, true, false) { @Override public void execute(final GUI gui) { new DialogMapLayout(gui); } }, /** TreeView options. */ C_TREEOPTIONS(TREE_OPTIONS_D, null, H_TREE_OPTIONS, true, false) { @Override public void execute(final GUI gui) { new DialogTreeOptions(gui); } }, /** Shows a preference dialog. */ C_PREFS(PREFERENCES + DOTS, Prop.MAC ? "% COMMA" : "% P", H_PREFERENCES, false, false) { @Override public void execute(final GUI gui) { new DialogPrefs(gui); } }, /* HELP MENU */ /** Shows the documentation web page. */ C_HELP(HELP, "F1", H_HELP, false, false) { @Override public void execute(final GUI gui) { BaseXDialog.browse(gui, DOC_URL); } }, /** Opens the community web page. */ C_COMMUNITY(COMMUNITY, null, H_COMMUNITY, false, false) { @Override public void execute(final GUI gui) { BaseXDialog.browse(gui, COMMUNITY_URL); } }, /** Opens the update web page. */ C_UPDATES(CHECK_FOR_UPDATES, null, H_UPDATES, false, false) { @Override public void execute(final GUI gui) { BaseXDialog.browse(gui, UPDATE_URL); } }, /** Shows the "about" information. */ C_ABOUT(ABOUT + DOTS, null, H_ABOUT, false, false) { @Override public void execute(final GUI gui) { new DialogAbout(gui); } }, /* BROWSE COMMANDS */ /** Goes one step back. */ C_GOBACK(GO_BACK, "alt LEFT", GO_BACK, true, false) { @Override public void execute(final GUI gui) { gui.notify.hist(false); } @Override public void refresh(final GUI gui, final AbstractButton b) { final String tt = gui.notify.query(true); b.setEnabled(tt != null); b.setToolTipText(tt != null && tt.isEmpty() ? C_GOBACK.help : tt); } }, /** Goes one step forward. */ C_GOFORWARD(GO_FORWARD, "alt RIGHT", GO_FORWARD, true, false) { @Override public void execute(final GUI gui) { gui.notify.hist(true); } @Override public void refresh(final GUI gui, final AbstractButton b) { final String tt = gui.notify.query(false); b.setEnabled(tt != null); b.setToolTipText(tt != null && tt.isEmpty() ? C_GOFORWARD.help : tt); } }, /** Goes one level up. */ C_GOUP(GO_UP, "alt UP", H_GO_UP, true, false) { @Override public void execute(final GUI gui) { // skip operation for root context final Context ctx = gui.context; if(ctx.root()) return; // check if all nodes are document nodes boolean doc = true; final Data data = ctx.data(); for(final int pre : ctx.current().pres) doc &= data.kind(pre) == Data.DOC; if(doc) { // if yes, jump to database root ctx.update(); gui.notify.context(ctx.current(), false, null); } else { // otherwise, jump to parent nodes gui.execute(new Cs("..")); } } @Override public void refresh(final GUI gui, final AbstractButton b) { b.setEnabled(!gui.gprop.is(GUIProp.FILTERRT) && gui.context.data() != null && !gui.context.root()); } }, /** Goes to the root node. */ C_GOHOME(GO_HOME, "alt HOME", H_GO_HOME, true, false) { @Override public void execute(final GUI gui) { // skip operation for root context final Context ctx = gui.context; if(ctx.root()) return; // jump to database root ctx.update(); gui.notify.context(ctx.current(), false, null); } @Override public void refresh(final GUI gui, final AbstractButton b) { b.setEnabled(gui.context.data() != null && !gui.context.root()); } }, /** Displays the root node in the text view. */ C_HOME(GO_HOME, null, H_GO_HOME, true, false) { @Override public void execute(final GUI gui) { gui.execute(new XQuery("/")); } }; /** States if the command needs a data reference. */ private final boolean data; /** Menu label. */ private final String label; /** Key shortcut. */ private final String key; /** Help string. */ private final String help; /** Displays a checkbox, indicating the current selection state. */ private final boolean checked; /** * Constructor. * @param l label of the menu item * @param k key shortcut * @param h help string * @param d requires a database to be opened * @param c displays a checkbox, indicating the current selection state */ GUICommands(final String l, final String k, final String h, final boolean d, final boolean c) { label = l; key = k; help = BaseXLayout.addShortcut(h, k); data = d; checked = c; } @Override public void refresh(final GUI gui, final AbstractButton b) { b.setEnabled(!data || gui.context.data() != null); } @Override public final boolean checked() { return checked; } @Override public String help() { return help; } @Override public String label() { return label; } @Override public String key() { return key; } // STATIC METHODS =========================================================== /** * Checks if data can be updated. * @param n node instance * @param no disallowed node types * @return result of check */ static boolean updatable(final Nodes n, final int... no) { if(n == null || (no.length == 0 ? n.size() < 1 : n.size() != 1)) return false; final int k = n.data.kind(n.pres[0]); for(final int i : no) if(k == i) return false; return true; } /** * Returns a quoted string. * @param s string to encode * @return quoted string */ static String quote(final String s) { return '"' + s.replaceAll("\"", """) + '"'; } /** * Returns a database function for the first node in a node set. * @param n node set * @param i offset * @return function string */ static String openPre(final Nodes n, final int i) { return Function._DB_OPEN_PRE.get(Str.get(n.data.meta.name), Int.get(n.pres[i])).toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/GUIConstants.java000066400000000000000000000311501222453003200251470ustar00rootroot00000000000000package org.basex.gui; import static org.basex.gui.GUIBaseCmd.*; import static org.basex.gui.GUICommands.*; import java.awt.*; import javax.swing.*; import org.basex.core.*; import org.basex.gui.layout.*; import org.basex.gui.view.*; import org.basex.gui.view.map.*; /** * GUI Constants used in different views. * * To add a new view, please proceed as follows:
*
* All views have unique names, which are defined below. * The following steps are necessary to add a new view * (the implementation of the existing views might help you): * *
    *
  • define a unique name for your view (e.g. {@code map})
  • *
  • add a string for your view, as shown below
  • *
  • add the string in the {@link #VIEWS} string below
  • *
  • create your view implementation in a new sub package * (e.g. {@link MapView}). *
  • add a new {@link View} instance in the {@link GUI} constructor.
  • *
* * Add some more code to allow switching on/off your view: * *
    *
  • add a boolean visibility flag with the view name included * in the {@link GUIProp} class {@link GUIProp#SHOWMAP})
  • *
  • add strings for the menu text and command description in the * {@link Text} class (e.g. {@link Text#MAP} an * {@link Text#H_MAP}). *
  • optionally add localized translations in the .lang files * (e.g. {@code c_showmap} and {@code c_showmaptt}) *
  • add a corresponding command in the {@link GUICommands} class * (e.g. {@link GUICommands#C_SHOWMAP})and add a reference in the * {@link #MENUITEMS} menu structure
  • *
* * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class GUIConstants { // VIEW NAMES =============================================================== /** Internal name of the Map View. */ public static final String MAPVIEW = "map"; /** Internal name of the Tree View. */ public static final String FOLDERVIEW = "folder"; /** Internal name of the Text View. */ public static final String TEXTVIEW = "text"; /** Internal name of the Table View. */ public static final String TABLEVIEW = "table"; /** Internal name of the Info View. */ public static final String INFOVIEW = "info"; /** Internal name of the Explore View. */ public static final String EXPLOREVIEW = "explore"; /** Internal name of the Plot View. */ public static final String PLOTVIEW = "plot"; /** Internal name of the Tree View. */ public static final String TREEVIEW = "tree"; /** Internal name of the Editor View. */ public static final String EDITORVIEW = "editor"; /** * Default GUI Layout. The layout is formatted as follows: * The character 'H' or 'V' adds a new horizontal or vertical level, * and a level is closed again with the '-' character. All views are * separated with spaces, and all views must be specified in this layout. * This layout is displayed as soon as a database is opened. */ public static final String VIEWS = "V H " + EDITORVIEW + ' ' + FOLDERVIEW + ' ' + MAPVIEW + ' ' + PLOTVIEW + ' ' + " - H " + TEXTVIEW + ' ' + INFOVIEW + ' ' + TABLEVIEW + ' ' + TREEVIEW + ' ' + EXPLOREVIEW + " - -"; // TOOLBAR ================================================================== /** Toolbar entries, containing the button commands. */ static final GUICommands[] TOOLBAR = { C_CREATE, C_OPEN_MANAGE, C_INFO, C_CLOSE, null, C_GOHOME, C_GOBACK, C_GOUP, C_GOFORWARD, null, C_SHOWEDITOR, C_SHOWINFO, null, C_SHOWRESULT, C_SHOWMAP, C_SHOWTREE, C_SHOWFOLDER, C_SHOWPLOT, C_SHOWTABLE, C_SHOWEXPLORE }; // MENUBARS ================================================================= /** Top menu entries. */ static final String[] MENUBAR = { Text.DATABASE, Text.EDITOR, Text.VIEW, Text.NODES, Text.OPTIONS, Text.HELP }; /** * Two-dimensional menu entries, containing the menu item commands. * {@link GUIBaseCmd#SEPARATOR} references serve as menu separators. */ static final GUICmd[][] MENUITEMS = { { C_CREATE, C_OPEN_MANAGE, SEPARATOR, C_INFO, C_EXPORT, C_CLOSE, SEPARATOR, C_SERVER, Prop.MAC ? null : SEPARATOR, Prop.MAC ? null : C_EXIT }, { C_EDITNEW, C_EDITOPEN, C_EDITREOPEN, C_EDITSAVE, C_EDITSAVEAS, C_EDITCLOSE, SEPARATOR, C_EDIT_GOTO, SEPARATOR, C_SHOWEDITOR, C_SHOWINFO }, { C_SHOWBUTTONS, C_SHOWINPUT, C_SHOWSTATUS, SEPARATOR, C_SHOWRESULT, C_SHOWMAP, C_SHOWTREE, C_SHOWFOLDER, C_SHOWPLOT, C_SHOWTABLE, C_SHOWEXPLORE, GUIMacOSX.nativeFullscreen() ? null : SEPARATOR, GUIMacOSX.nativeFullscreen() ? null : C_FULL }, { C_COPY, C_PASTE, C_DELETE, C_INSERT, C_EDIT, SEPARATOR, C_COPYPATH, C_FILTER }, { C_RTEXEC, C_RTFILTER, SEPARATOR, C_COLOR, C_FONTS, C_MAPLAYOUT, C_TREEOPTIONS, Prop.MAC ? null : SEPARATOR, C_PACKAGES, Prop.MAC ? null : C_PREFS }, { C_HELP, Prop.MAC ? null : SEPARATOR, C_COMMUNITY, C_UPDATES, Prop.MAC ? null : SEPARATOR, Prop.MAC ? null : C_ABOUT }}; /** Context menu entries. */ public static final GUICommands[] POPUP = { C_GOBACK, C_FILTER, null, C_COPY, C_PASTE, C_DELETE, C_INSERT, C_EDIT, null, C_COPYPATH }; // CURSORS ================================================================== /** Arrow cursor. */ public static final Cursor CURSORARROW = new Cursor(Cursor.DEFAULT_CURSOR); /** Hand cursor. */ public static final Cursor CURSORHAND = new Cursor(Cursor.HAND_CURSOR); /** Wait cursor. */ public static final Cursor CURSORWAIT = new Cursor(Cursor.WAIT_CURSOR); /** Left/Right arrow cursor. */ public static final Cursor CURSORMOVEH = new Cursor(Cursor.E_RESIZE_CURSOR); /** Move cursor. */ public static final Cursor CURSORMOVEV = new Cursor(Cursor.N_RESIZE_CURSOR); /** Text cursor. */ public static final Cursor CURSORTEXT = new Cursor(Cursor.TEXT_CURSOR); /** Move cursor. */ public static final Cursor CURSORMOVE = new Cursor(Cursor.MOVE_CURSOR); /** Icon type. */ public enum Msg { /** Warning message. */ WARN("warn", "warning"), /** Error message. */ ERROR("error", "error"), /** Success message. */ SUCCESS("ok", "information"), /** Question message. */ QUESTION("warn", "question"), /** Yes/no/cancel message. */ YESNOCANCEL("warn", "question"); /** Small icon. */ public final Icon small; /** Large icon. */ public final Icon large; /** * Constructor. * @param s small icon * @param l large icon */ Msg(final String s, final String l) { small = BaseXLayout.icon(s); large = UIManager.getIcon("OptionPane." + l + "Icon"); } } /** Background fill options. */ public enum Fill { /** Opaque fill mode. */ PLAIN, /** Transparent mode. */ NONE, /** Downward gradient. */ GRADIENT } // COLORS =================================================================== /** Cell color. */ public static final Color LGRAY = new Color(224, 224, 224); /** Button color. */ public static final Color GRAY = new Color(160, 160, 160); /** Background color. */ public static final Color DGRAY = new Color(64, 64, 64); /** Bright GUI color. */ public static final Color WHITE = Color.white; /** Color for control characters. */ public static final Color RED = new Color(208, 0, 0); /** Color for highlighting errors. */ public static final Color LRED = new Color(255, 216, 216); /** Color for highlighting full-text hits. */ public static final Color GREEN = new Color(0, 176, 0); /** Color for highlighting quotes. */ public static final Color BLUE = new Color(0, 64, 192); /** Second bright GUI color. */ public static Color color1; /** Middle color. */ public static Color color2; /** Middle color. */ public static Color color3; /** Dark color. */ public static Color color4; /** Mark color. */ public static Color colormark1; /** Second mark color. */ public static Color colormark2; /** Third mark color. */ public static Color colormark3; /** Fourth mark color. */ public static Color colormark4; /** Alpha color. */ public static Color color1A; /** Transparent background color. */ public static Color color2A; /** Transparent frame color. */ public static Color color3A; /** Mark color, custom alpha value. */ public static Color colormark1A; /** Second mark color, custom alpha value. */ public static Color colormark2A; /** Cached color gradient. */ private static final Color[] COLORS = new Color[100]; // FONTS ==================================================================== /** Font of text area. */ public static final Font TFONT = UIManager.getFont("TextArea.font"); /** Large font. */ public static Font lfont; /** Font. */ public static Font font; /** Bold Font. */ public static Font bfont; /** Monospace font. */ public static Font mfont; /** Default monospace font. */ public static Font dmfont; /** Current font size. */ public static int fontSize; /** Default monospace font widths. */ private static int[] dwidth; /** Character large character widths. */ private static int[] lwidth; /** Character widths. */ private static int[] fwidth; /** Bold character widths. */ private static int[] bwidth; /** Monospace character widths. */ public static int[] mfwidth; // KEYS ===================================================================== /** Shift key. */ public static final int SHF = Event.SHIFT_MASK; /** Alt key. */ public static final int ALT = Event.ALT_MASK; /** Control key. */ public static final int CTRL = Event.CTRL_MASK; /** Shortcut key (CTRL/META). */ public static final int SC = Prop.MAC ? Event.META_MASK : Event.CTRL_MASK; /** Private constructor, preventing class instantiation. */ private GUIConstants() { } /** * Initializes colors. * @param prop gui properties */ public static void init(final GUIProp prop) { final int r = prop.num(GUIProp.COLORRED); final int g = prop.num(GUIProp.COLORGREEN); final int b = prop.num(GUIProp.COLORBLUE); // calculate color c: // c = (255 - expectedColor) * 10 / factor (= GUIRED/BLUE/GREEN) color1 = new Color(col(r, 24), col(g, 25), col(b, 40)); color2 = new Color(col(r, 32), col(g, 32), col(b, 44)); color3 = new Color(col(r, 48), col(g, 50), col(b, 40)); color4 = new Color(col(r, 140), col(g, 100), col(b, 70)); color1A = new Color(col(r, 110), col(g, 150), col(b, 160), 100); colormark1A = new Color(col(r, 32), col(g, 160), col(b, 320), 100); colormark2A = new Color(col(r, 16), col(g, 80), col(b, 160), 100); colormark1 = new Color(col(r, 16), col(g, 120), col(b, 240)); colormark2 = new Color(col(r, 16), col(g, 80), col(b, 160)); colormark3 = new Color(col(r, 32), col(g, 160), col(b, 320)); colormark4 = new Color(col(r, 1), col(g, 40), col(b, 80)); // create color array for(int l = 1; l < COLORS.length + 1; ++l) { COLORS[l - 1] = new Color(Math.max(255 - l * r, 0), Math.max(255 - l * g, 0), Math.max(255 - l * b, 0)); } final Color c = COLORS[16]; color2A = new Color(c.getRed(), c.getGreen(), c.getBlue(), 40); color3A = new Color(c.getRed(), c.getGreen(), c.getBlue(), 100); final String f = prop.get(GUIProp.FONT); final int type = prop.num(GUIProp.FONTTYPE); fontSize = prop.num(GUIProp.FONTSIZE); font = new Font(f, type, fontSize); mfont = new Font(prop.get(GUIProp.MONOFONT), type, fontSize); bfont = new Font(f, Font.BOLD, fontSize); lfont = new Font(f, type, 18 + (fontSize >> 1)); dmfont = new Font(prop.get(GUIProp.MONOFONT), 0, TFONT.getSize() - 1); final Container comp = new Container(); dwidth = comp.getFontMetrics(dmfont).getWidths(); fwidth = comp.getFontMetrics(font).getWidths(); lwidth = comp.getFontMetrics(lfont).getWidths(); mfwidth = comp.getFontMetrics(mfont).getWidths(); bwidth = comp.getFontMetrics(bfont).getWidths(); } /** * Returns the specified color from the color gradient. * @param i color index * @return color */ public static Color color(final int i) { return COLORS[Math.min(COLORS.length - 1, i)]; } /** * Returns the character widths for the current font. * @param f font reference * @return character widths */ public static int[] fontWidths(final Font f) { if(f == font) return fwidth; if(f == mfont) return mfwidth; if(f == bfont) return bwidth; if(f == lfont) return lwidth; if(f == dmfont) return dwidth; return new Container().getFontMetrics(f).getWidths(); } /** * Converts color value with specified factor. * @param c color * @param f factor * @return converted color value */ private static int col(final int c, final int f) { return Math.max(0, 255 - c * f / 10); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/GUIInput.java000066400000000000000000000151251222453003200242760ustar00rootroot00000000000000package org.basex.gui; import static org.basex.gui.layout.BaseXKeys.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.plaf.basic.*; import org.basex.core.parse.*; import org.basex.data.*; import org.basex.gui.layout.*; import org.basex.query.*; import org.basex.util.list.*; /** * This class offers a text field for keyword and XQuery input. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Andreas Weiler */ public final class GUIInput extends BaseXTextField { /** Reference to main window. */ final GUI gui; /** JComboBox. */ final BaseXCombo box; /** BasicComboPopup Menu. */ ComboPopup pop; /** String for temporary input. */ private String pre = ""; /** * Default constructor. * @param main main window reference */ GUIInput(final GUI main) { super(main); gui = main; final Font f = getFont(); setFont(f.deriveFont((float) f.getSize() + 2)); box = new BaseXCombo(main); box.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { if(e.getModifiers() == InputEvent.BUTTON1_MASK) completeInput(); } }); pop = new ComboPopup(box); addKeyListener(new KeyAdapter() { @Override public void keyPressed(final KeyEvent e) { final int count = box.getItemCount(); if(ENTER.is(e)) { if(pop.isVisible()) { completeInput(); } else { // store current input in history final Data data = main.context.data(); final int i = data == null ? 2 : gui.gprop.num(GUIProp.SEARCHMODE); final Object[] options = i == 0 ? GUIProp.SEARCH : i == 1 ? GUIProp.XQUERY : GUIProp.COMMANDS; new BaseXHistory(main, options).store(getText()); // evaluate the input if(e.getModifiers() == 0) main.execute(); } return; } if(count == 0) return; int bi = box.getSelectedIndex(); if(NEXTLINE.is(e)) { if(!pop.isVisible()) { showPopup(); } else { if(++bi == count) bi = 0; } } else if(PREVLINE.is(e)) { if(!pop.isVisible()) { showPopup(); } else { if(--bi < 0) bi = count - 1; } } if(bi != box.getSelectedIndex()) box.setSelectedIndex(bi); } @Override public void keyReleased(final KeyEvent e) { if(ESCAPE.is(e)) { pop.setVisible(false); } else if(ENTER.is(e)) { pop.hide(); } else if(!NEXTLINE.is(e) && !PREVLINE.is(e)) { if(modifier(e) || control(e)) return; showPopup(); // skip commands if(gui.gprop.is(GUIProp.EXECRT) && !cmdMode()) main.execute(); } } }); } @Override public void setText(final String txt) { super.setText(txt); box.removeAllItems(); pop.setVisible(false); } /** * Checks if the query is a command. * @return result of check */ boolean cmdMode() { return gui.gprop.num(GUIProp.SEARCHMODE) == 2 || gui.context.data() == null || getText().startsWith("!"); } /** * Completes the input with the current combobox choice. */ void completeInput() { final Object sel = box.getSelectedItem(); if(sel == null) return; final String suf = sel.toString(); final int pl = pre.length(); final int ll = pl > 0 ? pre.charAt(pl - 1) : ' '; if(Character.isLetter(ll) && Character.isLetter(suf.charAt(0))) pre += " "; setText(pre + sel); showPopup(); if(gui.gprop.is(GUIProp.EXECRT) && !cmdMode()) gui.execute(); } /** * Shows the command popup menu. */ void showPopup() { final String query = getText(); final int mode = gui.gprop.num(GUIProp.SEARCHMODE); if(cmdMode()) { cmdPopup(query); } else if(mode == 1 || mode == 0 && query.startsWith("/")) { queryPopup(query); } else { pop.setVisible(false); } } /** * Shows the command popup menu. * @param query query input */ private void cmdPopup(final String query) { StringList sl = null; final boolean excl = query.startsWith("!"); try { pre = excl ? "!" : ""; final String suf = getText().substring(pre.length()); new CommandParser(suf, gui.context).suggest(); } catch(final QueryException ex) { sl = ex.suggest(); final int marked = ex.markedCol() + (excl ? 2 : 1); if(ex.markedCol() > -1 && marked <= query.length()) { pre = query.substring(0, marked); } } createCombo(sl); } /** * Shows the xpath popup menu. * @param query query input */ private void queryPopup(final String query) { final Data data = gui.context.data(); if(data == null) return; StringList sl; final QueryContext qc = new QueryContext(gui.context); try { final QuerySuggest qs = new QuerySuggest(query, qc, data); qs.parseMain(); sl = qs.complete(); pre = query.substring(0, qs.mark); } catch(final QueryException ex) { sl = ex.suggest(); pre = query.substring(0, ex.col() - (ex.col() == 1 ? 1 : 0)); } finally { qc.close(); } if(getCaretPosition() < pre.length()) sl = null; createCombo(sl); } /** * Creates and shows the combo box. * @param sl strings to be added */ private void createCombo(final StringList sl) { if(sl == null || sl.isEmpty()) { pop.setVisible(false); return; } if(comboChanged(sl)) { box.setModel(new DefaultComboBoxModel(sl.toArray())); box.setSelectedIndex(-1); pop = new ComboPopup(box); } final int w = getFontMetrics(getFont()).stringWidth(pre); pop.show(this, Math.min(getWidth(), w), getHeight()); } /** * Tests if the combo box entries have changed. * @param sl strings to be compared * @return result of check */ private boolean comboChanged(final StringList sl) { if(sl.size() != box.getItemCount()) return true; final int is = sl.size(); for(int i = 0; i < is; ++i) { if(!sl.get(i).equals(box.getItemAt(i))) return true; } return false; } /** Combo popup menu class, overriding the default constructor. */ private static final class ComboPopup extends BasicComboPopup { /** * Constructor. * @param combo combobox reference */ ComboPopup(final JComboBox combo) { super(combo); final int h = combo.getMaximumRowCount(); setPreferredSize(new Dimension(getPreferredSize().width, getPopupHeightForRowCount(h) + 2)); } } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/GUIMacOSX.java000066400000000000000000000221741222453003200242730ustar00rootroot00000000000000package org.basex.gui; import java.awt.*; import java.lang.reflect.*; import org.basex.core.*; import org.basex.gui.layout.*; /** * Sets some Mac OS X specific interface options. * * @author BaseX Team 2005-12, BSD License * @author Bastian Lemke */ public final class GUIMacOSX { /** Native class name. */ private static final String C_APPLICATION = "com.apple.eawt.Application"; /** Native class name. */ private static final String C_APPLICATION_LISTENER = "com.apple.eawt.ApplicationListener"; /** Native class name. */ private static final String C_APPLICATION_EVENT = "com.apple.eawt.ApplicationEvent"; /** System property identifier. */ private static final String P_ABOUT_NAME = "com.apple.mrj.application.apple.menu.about.name"; /** System property identifier. */ private static final String P_SCREEN_MENU_BAR = "apple.laf.useScreenMenuBar"; /** Empty class array. */ private static final Class[] EC = {}; /** Empty object array. */ private static final Object[] EO = {}; /** Reference to the main gui. */ GUI main; /** Instance of the 'Application' class. */ private final Object appObj; /** * Constructor. * @throws Exception if any error occurs. */ public GUIMacOSX() throws Exception { // name for the dock icon and the application menu System.setProperty(P_ABOUT_NAME, Prop.NAME); // show menu in the screen menu instead of inside the application window System.setProperty(P_SCREEN_MENU_BAR, "true"); // load native java classes... /* Reference to the loaded 'Application' class. */ final Class appClass = Class.forName(C_APPLICATION); appObj = invoke(appClass, null, "getApplication", EC, EO); Class.forName(C_APPLICATION_EVENT); if(appObj != null) { invoke(appObj, "addAboutMenuItem"); invoke(appObj, "setEnabledAboutMenu", true); invoke(appObj, "addPreferencesMenuItem"); invoke(appObj, "setEnabledPreferencesMenu", true); addDockIcon(); final Class alc = Class.forName(C_APPLICATION_LISTENER); final Object listener = Proxy.newProxyInstance( Thread.currentThread().getContextClassLoader(), new Class[] { alc}, new AppInvocationHandler()); invoke(appObj, "addApplicationListener", alc, listener); } } /** * Initializes this mac gui with the main gui. Has to be called * immediately after creating the gui. * @param gui main gui reference */ public void init(final GUI gui) { main = gui; } /** * Adds the project icon to the dock. * @throws Exception if any error occurs. */ private void addDockIcon() throws Exception { invoke(appObj, "setDockIconImage", Image.class, BaseXLayout.image("logo")); } /** * Sets a value for the badge in the dock. * @param value string value * @throws Exception if any error occurs */ public void setBadge(final String value) throws Exception { invoke(appObj, "setDockIconBadge", String.class, value); } /** * Handler for the native application events. * @author Bastian Lemke */ class AppInvocationHandler implements InvocationHandler { @Override public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable { final Object obj = args[0]; /* * Get the name of the method and call the method of this object that has * the same name with only the first argument. * This emulates the an implementation of the native 'ApplicationListener' * interface (@see com.apple.eawt.ApplicationListener on Mac OS X). * The argument is an instance of the 'ApplicationEvent' class * (@see com.apple.eawt.ApplicationEvent) */ Object result; try { result = GUIMacOSX.invoke(this, method.getName(), Object.class, obj); } catch(final NoSuchMethodException ex) { result = GUIMacOSX.invoke(this, method.getName()); } // mark the current event as 'handled' if handler doesn't return a false boolean GUIMacOSX.invoke(obj, "setHandled", null != result && Boolean.class.isInstance(result) ? (Boolean) result : true); return null; } /** Called when the user selects the About item in the application menu. */ public void handleAbout() { // explicit cast to circumvent Java compiler bug ((GUICmd) GUICommands.C_ABOUT).execute(main); } /** * Called when the application receives an Open Application event from the * Finder or another application. */ public void handleOpenApplication() { /* NOT IMPLEMENTED */ } /** * Called when the application receives an Open Document event from the * Finder or another application. * @param obj application event */ public void handleOpenFile(@SuppressWarnings("unused") final Object obj) { // get the associated filename: // final String name = (String) GUIMacOSX.invoke(obj, "getFilename"); } /** Called when the Preference item in the application menu is selected. */ public void handlePreferences() { // explicit cast to circumvent Java compiler bug ((GUICmd) GUICommands.C_PREFS).execute(main); } /** * Called when the application is sent a request to print a particular file * or files. */ public void handlePrintFile() { /* NOT IMPLEMENTED */ } /** * Called when the application is sent the Quit event. * * Unlike other handles, quit mustn't set {@code setHandled} or OS X will quit the * application. * * @see com.apple.eawt.ApplicationListener#handleQuit * @return always false */ @SuppressWarnings({ "all" }) // ApplicationListener is deprecated public boolean handleQuit() { // explicit cast to circumvent Java compiler bug ((GUICmd) GUICommands.C_EXIT).execute(main); return false; } /** * Called when the application receives a Reopen Application event from the * Finder or another application. */ public void handleReOpenApplication() { if(main != null) main.setVisible(true); } } /** * Returns true if the System has native Fullscreen support. * @return fullscreen support */ public static boolean nativeFullscreen() { try { Class.forName("com.apple.eawt.FullScreenUtilities"); return true; } catch(final ClassNotFoundException e) { return false; } } /** * Enables OSX Lion native fullscreen where available. * @param window the window */ public static void enableOSXFullscreen(final Window window) { if(null == window) return; try { final Class util = Class.forName("com.apple.eawt.FullScreenUtilities"); final Class[] params = { Window.class, Boolean.TYPE }; final Method method = util.getMethod("setWindowCanFullScreen", params); method.invoke(util, window, true); } catch(final Exception ignored) { } } /** * Invokes a method without arguments on the given object. * @param obj object on which the method should be invoked * @param method name of the method to invoke * @return return value of the method * @throws Exception if any error occurs. */ static Object invoke(final Object obj, final String method) throws Exception { return invoke(obj.getClass(), obj, method, EC, EO); } /** * Invokes a method on the given object that expects a single boolean value as * argument. * @param obj object on which the method should be invoked * @param method name of the method to invoke * @param arg boolean value that is passed as argument * @return return value of the method * @throws Exception if any error occurs. */ static Object invoke(final Object obj, final String method, final boolean arg) throws Exception { return invoke(obj, method, Boolean.TYPE, arg); } /** * Invokes a method on the given object that expects a single argument. * @param obj object on which the method should be invoked * @param method name of the method to invoke * @param argClass "type" of the argument * @param argObject argument value * @return return value of the method * @throws Exception if any error occurs */ static Object invoke(final Object obj, final String method, final Class argClass, final Object argObject) throws Exception { final Class[] argClasses = { argClass }; final Object[] argObjects = { argObject }; return invoke(obj.getClass(), obj, method, argClasses, argObjects); } /** * Invokes a method on the given object that expects multiple arguments. * @param clazz class object to get the method from * @param obj object on which the method should be invoked. Can be * {@code null} for static methods * @param method name of the method to invoke * @param argClasses "types" of the arguments * @param argObjects argument values * @return return value of the method * @throws Exception if any error occurs */ private static Object invoke(final Class clazz, final Object obj, final String method, final Class[] argClasses, final Object[] argObjects) throws Exception { return clazz.getMethod(method, argClasses).invoke(obj, argObjects); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/GUIMenu.java000066400000000000000000000062211222453003200241000ustar00rootroot00000000000000package org.basex.gui; import static org.basex.gui.GUIConstants.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import org.basex.core.*; import org.basex.gui.layout.*; import org.basex.util.*; /** * This is the menu bar of the main window. * The menu structure is defined in {@link GUIConstants#MENUBAR} and * {@link GUIConstants#MENUITEMS}. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class GUIMenu extends JMenuBar { /** Referenced menu items. */ private final JMenuItem[] items; /** Reference to main window. */ private final GUI gui; /** * Initializes the menu bar. * @param main reference to the main window */ GUIMenu(final GUI main) { gui = main; if(Prop.langright) setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); final String sm = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() == Event.META_MASK ? "meta" : "ctrl"; // create menu for each top level menu entries int c = 0; for(int b = 0; b < MENUBAR.length; ++b) { for(int i = 0; i < MENUITEMS[b].length; ++i) ++c; } items = new JMenuItem[c]; c = 0; // loop through all menu entries final StringBuilder gmnem = new StringBuilder(); for(int b = 0; b < MENUBAR.length; ++b) { final JMenu menu = new JMenu(MENUBAR[b]); BaseXLayout.setMnemonic(menu, gmnem); // create menu point for each sub menu entry final StringBuilder mnem = new StringBuilder(); for(int i = 0; i < MENUITEMS[b].length; ++i) { // add a separator final GUICmd cmd = MENUITEMS[b][i]; if(cmd == GUIBaseCmd.SEPARATOR) { menu.addSeparator(); } else if(cmd != null) { // add a menu entry final JMenuItem item = newItem(cmd, gui, mnem); final String sc = cmd.key(); if(sc != null) { item.setAccelerator(KeyStroke.getKeyStroke(Util.info(sc, sm))); } items[c++] = item; if(Prop.langright) { item.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); } menu.add(item); } } add(menu); } } /** * Creates a new menu item. * @param cmd command * @param gui gui reference * @param mnem assigned mnenomics * @return menu item */ public static JMenuItem newItem(final GUICmd cmd, final GUI gui, final StringBuilder mnem) { final String desc = cmd.label(); final JMenuItem item = cmd.checked() ? new JCheckBoxMenuItem(desc) : new JMenuItem(desc); item.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { cmd.execute(gui); } }); BaseXLayout.setMnemonic(item, mnem); item.setToolTipText(cmd.help()); return item; } /** * Refreshes the menu items. */ void refresh() { int c = 0; for(int b = 0; b < MENUBAR.length; ++b) { for(int i = 0; i < MENUITEMS[b].length; ++i) { final GUICmd item = MENUITEMS[b][i]; if(item != GUIBaseCmd.SEPARATOR && item != null) { item.refresh(gui, items[c++]); } } } } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/GUIProp.java000066400000000000000000000212151222453003200241140ustar00rootroot00000000000000package org.basex.gui; import java.awt.*; import org.basex.core.*; /** * This class contains properties which are used in the GUI. * They are also stored in the project's home directory. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class GUIProp extends AProp { // DATABASE & PROGRAM PATHS ================================================= /** Comment: written to property file. */ public static final Object[] C_PATHS = { "Paths" }; /** Path to database input. */ public static final Object[] INPUTPATH = { "INPUTPATH", Prop.HOME }; /** Path for additional material. */ public static final Object[] DATAPATH = { "DATAPATH", Prop.HOME }; /** Path to working directory. */ public static final Object[] WORKPATH = { "WORKPATH", Prop.HOME }; /** Last editor files. */ public static final Object[] EDITOR = { "EDITOR", new String[0] }; /** Input paths. */ public static final Object[] INPUTS = { "INPUTS", new String[0] }; /** Comment: written to property file. */ public static final Object[] C_LAYOUT = { "Layout" }; /** Default GUI Font. */ public static final Object[] FONT = { "FONT", Font.SANS_SERIF }; /** Default GUI Monospace Font. */ public static final Object[] MONOFONT = { "MONOFONT", Font.MONOSPACED }; /** Font TYPE = plain, bold, italics). */ public static final Object[] FONTTYPE = { "FONTTYPE", 0 }; /** Font size. */ public static final Object[] FONTSIZE = { "FONTSIZE", 13 }; /** Red GUI color factor. */ public static final Object[] COLORRED = { "COLORRED", 13 }; /** Green GUI color factor. */ public static final Object[] COLORGREEN = { "COLORGREEN", 11 }; /** Blue GUI color factor. */ public static final Object[] COLORBLUE = { "COLORBLUE", 6 }; /** Paint gradients as background. */ public static final Object[] GRADIENT = { "GRADIENT", true }; /** Comment: written to property file. */ public static final Object[] C_WINDOWS = { "Windows" }; /** Last updated version. */ public static final Object[] UPDATEVERSION = { "UPDATEVERSION", Prop.VERSION.replaceAll(" .*", "") }; /** GUI Layout. */ public static final Object[] VIEWS = { "VIEWS", GUIConstants.VIEWS }; /** GUI height. */ public static final Object[] GUISIZE = { "GUISIZE", new int[] { 1004, 748 } }; /** GUI position. */ public static final Object[] GUILOC = { "GUILOC", new int[] { 10, 10 } }; /** Flag for maximized GUI window. */ public static final Object[] MAXSTATE = { "MAXSTATE", false }; /** Flag for displaying buttons in the GUI window. */ public static final Object[] SHOWBUTTONS = { "SHOWBUTTONS", true }; /** Flag for displaying the text field in the GUI window. */ public static final Object[] SHOWINPUT = { "SHOWINPUT", true }; /** Flag for displaying the status bar in the GUI window. */ public static final Object[] SHOWSTATUS = { "SHOWSTATUS", true }; /** Flag for activated info view. */ public static final Object[] SHOWINFO = { "SHOWINFO", true }; /** Flag for activated map view. */ public static final Object[] SHOWMAP = { "SHOWMAP", true }; /** Flag for activated table view. */ public static final Object[] SHOWTABLE = { "SHOWTABLE", false }; /** Flag for activated result view. */ public static final Object[] SHOWTEXT = { "SHOWTEXT", true }; /** Flag for activated tree view. */ public static final Object[] SHOWFOLDER = { "SHOWFOLDER", false }; /** Flag for activated query view. */ public static final Object[] SHOWEXPLORE = { "SHOWEXPLORE", false }; /** Flag for activated plot view. */ public static final Object[] SHOWPLOT = { "SHOWPLOT", false }; /** Flag for activated xquery view. */ public static final Object[] SHOWEDITOR = { "SHOWEDITOR", true }; /** Flag for activated tree view. */ public static final Object[] SHOWTREE = { "SHOWTREE", false }; /** Dialog location. */ public static final Object[] MAPLAYOUTLOC = { "MAPLAYOUTLOC", new int[] { 790, 520 } }; /** Dialog location. */ public static final Object[] FONTSLOC = { "FONTSLOC", new int[] { 10, 530 } }; /** Dialog location. */ public static final Object[] COLORSLOC = { "COLORSLOC", new int[] { 530, 620 } }; /** Flag for Java look and feel. */ public static final Object[] JAVALOOK = { "JAVALOOK", false }; /** Flag for dissolving name attributes. */ public static final Object[] SHOWNAME = { "SHOWNAME", true }; /** Focus follows mouse. */ public static final Object[] MOUSEFOCUS = { "MOUSEFOCUS", false }; /** Flag for showing the simple file dialog. */ public static final Object[] SIMPLEFD = { "SIMPLEFD", false }; /** Current input mode in global text field (Search, XQuery, Command). */ public static final Object[] SEARCHMODE = { "SEARCHMODE", 0 }; /** Flag for realtime context filtering. */ public static final Object[] FILTERRT = { "FILTERRT", false }; /** Flag for realtime query execution. */ public static final Object[] EXECRT = { "EXECRT", false }; /** Name of new database. */ public static final Object[] DBNAME = { "CREATENAME", "" }; /** Last insertion type. */ public static final Object[] LASTINSERT = { "LASTINSERT", 1 }; /** Comment: written to property file. */ public static final Object[] C_SERVER = { "Server Dialog" }; /** Server: host, used for connecting new clients. */ public static final Object[] S_HOST = { "S_HOST", Text.LOCALHOST }; /** Server: port, used for connecting new clients. */ public static final Object[] S_PORT = { "S_PORT", 1984 }; /** Server: port, used for binding the server. */ public static final Object[] S_SERVERPORT = { "S_SERVERPORT", 1984 }; /** Server: port, used for sending events. */ public static final Object[] S_EVENTPORT = { "S_EVENTPORT", 1985 }; /** Default user. */ public static final Object[] S_USER = { "S_USER", "" }; /** Default password. */ public static final Object[] S_PASSWORD = { "S_PASSWORD", "" }; /** Comment: written to property file. */ public static final Object[] C_VISUALIZATIONS = { "Visualizations" }; /** Show attributes in treemap. */ public static final Object[] MAPATTS = { "MAPATTS", false }; /** Treemap Offsets. */ public static final Object[] MAPOFFSETS = { "MAPOFFSETS", 3 }; /** Map algorithm. */ public static final Object[] MAPALGO = { "MAPALGO", 0 }; /** number of children <-> size weight in (0;100). */ public static final Object[] MAPWEIGHT = { "MAPWEIGHT", 0 }; /** Slim rectangles to text length. */ public static final Object[] TREESLIMS = { "TREESLIM", true}; /** Show attributes in treeview. */ public static final Object[] TREEATTS = { "TREEATTS", false}; /** Dot sizes in plot. */ public static final Object[] PLOTDOTS = { "PLOTDOTS", 0 }; /** Logarithmic plot. */ public static final Object[] PLOTXLOG = { "PLOTXLOG", false }; /** Logarithmic plot. */ public static final Object[] PLOTYLOG = { "PLOTYLOG", false }; /** Maximum text size to be displayed. */ public static final Object[] MAXTEXT = { "MAXTEXT", 1 << 21 }; /** Maximum number of hits to be displayed (-1: return all hits; default: 250K). */ public static final Object[] MAXHITS = { "MAXHITS", 250000 }; /** Comment: written to property file. */ public static final Object[] C_SEARCH = { "Search" }; /** Search text. */ public static final Object[] SR_SEARCH = { "SR_SEARCH", "" }; /** Replace text. */ public static final Object[] SR_REPLACE = { "SR_REPLACE", "" }; /** Regular expressions. */ public static final Object[] SR_REGEX = { "SR_REGEX", false }; /** Match case. */ public static final Object[] SR_CASE = { "SR_CASE", false }; /** Whole word. */ public static final Object[] SR_WORD = { "SR_WORD", false }; /** Multi-line mode. */ public static final Object[] SR_MULTI = { "SR_MULTI", false }; /** Last searched strings. */ public static final Object[] SEARCHED = { "SEARCHED", new String[0] }; /** Last replaced strings. */ public static final Object[] REPLACED = { "REPLACED", new String[0] }; /** Comment: written to property file. */ public static final Object[] C_HISTORY = { "History" }; /** Last command inputs. */ public static final Object[] COMMANDS = { "COMMANDS", new String[0] }; /** Last keyword inputs. */ public static final Object[] SEARCH = { "SEARCH", new String[0] }; /** Last XQuery inputs. */ public static final Object[] XQUERY = { "XQUERY", new String[0] }; /** * Constructor. */ public GUIProp() { super("gui"); // reset realtime operations set(GUIProp.FILTERRT, false); set(GUIProp.EXECRT, false); Prop.gui = true; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/GUIStatus.java000066400000000000000000000023641222453003200244630ustar00rootroot00000000000000package org.basex.gui; import static org.basex.core.Text.*; import java.awt.*; import org.basex.gui.layout.*; /** * This is the status bar of the main window. It displays progress information * and includes a memory status. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class GUIStatus extends BaseXPanel { /** Status text. */ private final BaseXLabel label; /** * Constructor. * @param main reference to the main window */ GUIStatus(final AGUI main) { super(main); BaseXLayout.setHeight(this, getFont().getSize() + 6); addMouseListener(this); addMouseMotionListener(this); layout(new BorderLayout(4, 0)); label = new BaseXLabel(OK).border(0, 4, 0, 0); add(label, BorderLayout.CENTER); add(new BaseXMem(main, true), BorderLayout.EAST); } /** * Sets the status text. * @param txt the text to be set */ public void setText(final String txt) { label.setText(txt); label.setForeground(Color.BLACK); } /** * Sets the status text. * @param txt the text to be set */ public void setError(final String txt) { label.setText(txt); label.setForeground(GUIConstants.RED); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/GUIToolBar.java000066400000000000000000000021641222453003200245400ustar00rootroot00000000000000package org.basex.gui; import javax.swing.*; import org.basex.gui.layout.*; /** * This is the toolbar of the main window. * The toolbar contents are defined in {@link GUIConstants#TOOLBAR}. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class GUIToolBar extends JToolBar { /** Toolbar commands. */ private final GUICmd[] cmd; /** Reference to main window. */ private final GUI gui; /** * Default constructor. * @param tb toolbar commands * @param main reference to the main window */ public GUIToolBar(final GUICmd[] tb, final GUI main) { setFloatable(false); cmd = tb; gui = main; for(final GUICmd c : cmd) { if(c == null) { addSeparator(); } else { final BaseXButton button = BaseXButton.command(c, gui); button.setFocusable(false); add(button); } } } /** * Refreshes the buttons. */ void refresh() { for(int b = 0; b < cmd.length; ++b) { if(cmd[b] != null) cmd[b].refresh(gui, (BaseXButton) getComponent(b)); } } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/dialog/000077500000000000000000000000001222453003200232225ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/gui/dialog/DialogAbout.java000066400000000000000000000043431222453003200262630ustar00rootroot00000000000000package org.basex.gui.dialog; import static org.basex.core.Text.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.*; import org.basex.core.*; import org.basex.gui.*; import org.basex.gui.GUIConstants.Fill; import org.basex.gui.layout.*; /** * Dialog window for displaying information about the project. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DialogAbout extends BaseXDialog { /** * Default constructor. * @param main reference to the main window */ public DialogAbout(final GUI main) { super(main, ABOUT); BaseXBack p = new BaseXBack(new BorderLayout(12, 0)); p.setBackground(Color.white); p.setBorder(new CompoundBorder(new EtchedBorder(), new EmptyBorder(10, 10, 15, 22))); final BaseXLabel label = new BaseXLabel(); label.setIcon(BaseXLayout.icon("logo")); label.setVerticalAlignment(SwingConstants.TOP); p.add(label, BorderLayout.WEST); final BaseXBack pp = new BaseXBack(Fill.NONE).layout(new TableLayout(17, 1)); pp.add(new BaseXLabel(TITLE, false, true)); final BaseXLabel url = new BaseXLabel("" + URL + ""); url.setForeground(GUIConstants.BLUE); url.setCursor(GUIConstants.CURSORHAND); url.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(final MouseEvent e) { BaseXDialog.browse(gui, URL); } }); pp.add(url); pp.add(Box.createVerticalStrut(7)); pp.add(new BaseXLabel(COPYRIGHT)); pp.add(new BaseXLabel(LICENSE)); pp.add(Box.createVerticalStrut(7)); pp.add(new BaseXLabel(CHIEF_ARCHITECT)); pp.add(Box.createVerticalStrut(7)); pp.add(new BaseXLabel(TEAM1)); pp.add(new BaseXLabel(TEAM2)); pp.add(new BaseXLabel(AND_OTHERS)); pp.add(Box.createVerticalStrut(7)); final String lang = main.context.mprop.get(MainProp.LANG); pp.add(new BaseXLabel(TRANSLATION + " (" + lang + "): " + DialogPrefs.creds(lang))); p.add(pp, BorderLayout.EAST); add(p, BorderLayout.NORTH); p = new BaseXBack(); p.add(newButtons(B_OK)); add(p, BorderLayout.EAST); finish(null); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/dialog/DialogAdd.java000066400000000000000000000052461222453003200257040ustar00rootroot00000000000000package org.basex.gui.dialog; import static org.basex.core.Text.*; import java.awt.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.gui.GUIConstants.Msg; import org.basex.gui.layout.*; import org.basex.util.*; /** * Panel for adding new resources. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ class DialogAdd extends BaseXBack { /** Dialog reference. */ final DialogProps dialog; /** Target path. */ final BaseXTextField target; /** General options. */ private final DialogImport general; /** Add button. */ private final BaseXButton add; /** Optimize button. */ private final BaseXButton optimize; /** * Constructor. * @param d dialog reference */ public DialogAdd(final DialogProps d) { dialog = d; setLayout(new BorderLayout()); add(new BaseXLabel(ADD_RESOURCES).large().border(0, 0, 16, 0), BorderLayout.NORTH); target = new BaseXTextField("/", d); final BaseXBack pnl = new BaseXBack(new TableLayout(2, 1)); pnl.add(new BaseXLabel(TARGET_PATH + COLS, true, true).border(8, 0, 6, 0)); pnl.add(target); // option panels final BaseXTabs tabs = new BaseXTabs(d); final DialogParsing parsing = new DialogParsing(d, tabs); general = new DialogImport(d, pnl, parsing); tabs.addTab(GENERAL, general); tabs.addTab(PARSING, parsing); add(tabs, BorderLayout.CENTER); // buttons add = new BaseXButton(ADD + DOTS, d); optimize = new BaseXButton(OPTIMIZE + DOTS, d); add(d.newButtons(add, optimize), BorderLayout.SOUTH); action(general.parser); } /** * Reacts on user input. * @param comp the action component */ void action(final Object comp) { final String src = general.input(); final String trg = target.getText().trim(); if(comp == add) { general.setOptions(); final Runnable run = new Runnable() { @Override public void run() { dialog.resources.refreshNewFolder(trg); } }; DialogProgress.execute(dialog, run, new Add(trg, src)); } else if(comp == optimize) { DialogProgress.execute(dialog, new Optimize()); } else { boolean ok = general.action(comp, false); if(comp == general.browse || comp == general.input) target.setText(general.dbname); String inf = ok ? null : RES_NOT_FOUND; final Msg icon = Msg.ERROR; if(ok) { // check if target path is valid ok = MetaData.normPath(trg) != null; if(!ok) inf = Util.info(INVALID_X, TARGET_PATH); } general.info.setText(inf, icon); add.setEnabled(ok); optimize.setEnabled(!dialog.gui.context.data().meta.uptodate); } } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/dialog/DialogColors.java000066400000000000000000000043371222453003200264550ustar00rootroot00000000000000package org.basex.gui.dialog; import static org.basex.core.Text.*; import java.awt.*; import org.basex.gui.*; import org.basex.gui.layout.*; /** * Dialog window for changing the used colors. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DialogColors extends BaseXDialog { /** Maximum color range. */ private static final int MAXCOLOR = 32; /** Slider reference. */ private final BaseXSlider sliderRed; /** Slider reference. */ private final BaseXSlider sliderGreen; /** Slider reference. */ private final BaseXSlider sliderBlue; /** * Default constructor. * @param main reference to the main window */ public DialogColors(final GUI main) { super(main, COLOR_SCHEMA, false); final GUIProp gprop = gui.gprop; final BaseXBack p = new BaseXBack(new TableLayout(3, 2, 16, 8)); p.add(new BaseXLabel(RED)); sliderRed = newSlider(gprop.num(GUIProp.COLORRED)); p.add(sliderRed); p.add(new BaseXLabel(GREEN)); sliderGreen = newSlider(gprop.num(GUIProp.COLORGREEN)); p.add(sliderGreen); p.add(new BaseXLabel(BLUE)); sliderBlue = newSlider(gprop.num(GUIProp.COLORBLUE)); p.add(sliderBlue); set(p, BorderLayout.CENTER); set(newButtons(RESET), BorderLayout.SOUTH); finish(gprop.nums(GUIProp.COLORSLOC)); } /** * Creates a slider. * @param v initial value * @return slider reference */ private BaseXSlider newSlider(final int v) { final BaseXSlider slider = new BaseXSlider(0, MAXCOLOR, MAXCOLOR - v, this); BaseXLayout.setWidth(slider, 150); return slider; } @Override public void action(final Object comp) { final GUIProp gprop = gui.gprop; if(comp instanceof BaseXButton) { sliderRed.value(MAXCOLOR - (Integer) GUIProp.COLORRED[1]); sliderGreen.value(MAXCOLOR - (Integer) GUIProp.COLORGREEN[1]); sliderBlue.value(MAXCOLOR - (Integer) GUIProp.COLORBLUE[1]); } gprop.set(GUIProp.COLORRED, MAXCOLOR - sliderRed.value()); gprop.set(GUIProp.COLORGREEN, MAXCOLOR - sliderGreen.value()); gprop.set(GUIProp.COLORBLUE, MAXCOLOR - sliderBlue.value()); gui.updateLayout(); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/dialog/DialogEdit.java000066400000000000000000000075131222453003200261000ustar00rootroot00000000000000package org.basex.gui.dialog; import static org.basex.core.Text.*; import static org.basex.util.Token.*; import java.awt.*; import org.basex.core.*; import org.basex.data.*; import org.basex.gui.*; import org.basex.gui.GUIConstants.Msg; import org.basex.gui.editor.*; import org.basex.gui.layout.*; import org.basex.util.*; import org.basex.util.list.*; /** * Dialog window for editing XML nodes. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DialogEdit extends BaseXDialog { /** Resulting update arguments. */ public final StringList result = new StringList(); /** Node kind. */ public final int kind; /** Button panel. */ private final BaseXBack buttons; /** Info label. */ private final BaseXLabel info; /** Text area. */ private BaseXTextField input1; /** Text area. */ private BaseXTextField input2; /** Text area. */ private Editor input3; /** Old content. */ private String old1; /** Old content. */ private String old2; /** Old content. */ private byte[] old3; /** * Default constructor. * @param main reference to main frame * @param p pre value */ public DialogEdit(final GUI main, final int p) { super(main, EDIT_DATA); // create checkboxes BaseXBack pp = new BaseXBack(new BorderLayout()); final Context context = gui.context; final Data data = context.data(); kind = data.kind(p); final String title = Util.info(EDIT_X, NODE_KINDS[kind]); final BaseXLabel label = new BaseXLabel(title, true, true); pp.add(label, BorderLayout.NORTH); if(kind == Data.ELEM) { old1 = string(data.name(p, kind)); } else if(kind == Data.DOC) { old1 = string(data.text(p, true)); } else if(kind == Data.TEXT || kind == Data.COMM) { old3 = data.atom(p); } else if(kind == Data.ATTR) { old1 = string(data.name(p, kind)); old2 = string(data.atom(p)); } else { old1 = string(data.name(p, kind)); old3 = data.atom(p); } final BaseXBack b = new BaseXBack(new BorderLayout(0, 4)); if(old1 != null) { input1 = new BaseXTextField(old1, this); BaseXLayout.setWidth(input1, 500); b.add(input1, BorderLayout.NORTH); } if(old2 != null) { input2 = new BaseXTextField(old2, this); b.add(input2, BorderLayout.CENTER); } if(old3 != null) { input3 = new Editor(true, this, old3); input3.addKeyListener(keys); input3.setPreferredSize(new Dimension(500, 350)); b.add(new SearchEditor(main, input3), BorderLayout.CENTER); setResizable(true); } pp.add(b, BorderLayout.CENTER); set(pp, BorderLayout.CENTER); pp = new BaseXBack(new BorderLayout()); info = new BaseXLabel(" ").border(12, 0, 6, 0); pp.add(info, BorderLayout.WEST); // create buttons buttons = okCancel(); pp.add(buttons, BorderLayout.EAST); set(pp, BorderLayout.SOUTH); finish(null); } @Override public void action(final Object cmp) { String msg = null; ok = kind != Data.TEXT || input3.getText().length != 0; if(kind != Data.TEXT && kind != Data.COMM) { ok = XMLToken.isQName(token(input1.getText())); if(!ok && !input1.getText().isEmpty()) msg = Util.info(INVALID_X, NAME); } info.setText(msg, Msg.ERROR); enableOK(buttons, B_OK, ok); } @Override public void close() { super.close(); ok = false; if(old1 != null) { result.add(input1.getText()); ok |= !input1.getText().equals(old1); } if(old2 != null) { result.add(input2.getText()); ok |= !input2.getText().equals(old2); } if(old3 != null) { result.add(string(input3.getText())); ok |= !eq(input3.getText(), old3); } } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/dialog/DialogExport.java000066400000000000000000000152411222453003200264710ustar00rootroot00000000000000package org.basex.gui.dialog; import static org.basex.core.Text.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.nio.charset.*; import java.util.*; import org.basex.core.*; import org.basex.data.*; import org.basex.gui.*; import org.basex.gui.GUIConstants.Msg; import org.basex.gui.layout.*; import org.basex.gui.layout.BaseXFileChooser.Mode; import org.basex.io.*; import org.basex.io.out.*; import org.basex.io.serial.*; import org.basex.util.*; /** * Dialog window for changing some project's preferences. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DialogExport extends BaseXDialog { /** Available encodings. */ private static final String[] ENCODINGS; /** Directory path. */ private final BaseXTextField path; /** Database info. */ private final BaseXLabel info; /** Serialization method. */ private final BaseXCombo method; /** Encoding. */ private final BaseXCombo encoding; /** Buttons. */ private final BaseXBack buttons; /** Parameters. */ private final BaseXTextField params; // initialize encodings static { final SortedMap cs = Charset.availableCharsets(); ENCODINGS = cs.keySet().toArray(new String[cs.size()]); } /** * Default constructor. * @param main reference to the main window */ public DialogExport(final GUI main) { super(main, EXPORT); // create checkboxes final BaseXBack p = new BaseXBack(new TableLayout(4, 1, 0, 0)); p.add(new BaseXLabel(OUTPUT_DIR + COL, true, true).border(0, 0, 6, 0)); // output label BaseXBack pp = new BaseXBack(new TableLayout(1, 2, 8, 0)); path = new BaseXTextField(main.gprop.get(GUIProp.INPUTPATH), this); path.history(gui, GUIProp.INPUTS); pp.add(path); final BaseXButton browse = new BaseXButton(BROWSE_D, this); browse.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { choose(); } }); pp.add(browse); p.add(pp); // encoding final Prop prop = gui.context.prop; final String exporter = prop.get(Prop.EXPORTER); final SerializerProp sp = new SerializerProp(exporter); // encoding and method final String[] methods = new String[DataText.METHODS.length - 1]; for(int m = 0; m < methods.length; m++) { methods[m] = DataText.METHODS[m].toUpperCase(Locale.ENGLISH); } method = new BaseXCombo(this, methods); method.setSelectedItem(sp.get(SerializerProp.S_METHOD).toUpperCase(Locale.ENGLISH)); encoding = new BaseXCombo(this, ENCODINGS); String enc = sp.get(SerializerProp.S_ENCODING); boolean f = false; for(final String s : ENCODINGS) f |= s.equals(enc); if(!f) { enc = enc.toUpperCase(Locale.ENGLISH); for(final String s : ENCODINGS) f |= s.equals(enc); } encoding.setSelectedItem(f ? enc : sp.get(SerializerProp.S_ENCODING)); params = new BaseXTextField(parameters(sp, true), this); pp = new BaseXBack(new TableLayout(3, 2, 16, 6)).border(8, 0, 8, 0); pp.add(new BaseXLabel(METHOD + COL, true, true)); pp.add(method); pp.add(new BaseXLabel(ENCODING + COL, true, true)); pp.add(encoding); pp.add(new BaseXLabel(PARAMETERS + COL, true, true)); pp.add(params); p.add(pp); info = new BaseXLabel(" ").border(8, 0, 0, 0); p.add(info); // indentation set(p, BorderLayout.CENTER); // buttons pp = new BaseXBack(new BorderLayout()); buttons = okCancel(); pp.add(buttons, BorderLayout.EAST); set(pp, BorderLayout.SOUTH); action(method); finish(null); } /** * Creates an encoding combo box and selects the specified encoding. * @param dialog dialog reference * @param encoding original encoding * @return combo box */ static BaseXCombo encoding(final BaseXDialog dialog, final String encoding) { final BaseXCombo cb = new BaseXCombo(dialog, ENCODINGS); boolean f = false; String enc = encoding; for(final String s : ENCODINGS) f |= s.equals(enc); if(!f) { enc = enc.toUpperCase(Locale.ENGLISH); for(final String s : ENCODINGS) f |= s.equals(enc); } cb.setSelectedItem(enc); return cb; } /** * Opens a file dialog to choose an XML document or directory. */ void choose() { final IOFile io = new BaseXFileChooser(CHOOSE_DIR, path.getText(), gui). select(Mode.DOPEN); if(io != null) path.setText(io.path()); } /** * Returns the chosen XML file or directory path. * @return file or directory */ public String path() { return path.getText().trim(); } @Override public void action(final Object comp) { final String pth = path(); final IOFile io = new IOFile(pth); String inf = io.isDir() && io.children().length > 0 ? DIR_NOT_EMPTY : null; ok = !pth.isEmpty(); if(ok) { gui.gprop.set(GUIProp.INPUTPATH, pth); // validate serialization parameters try { final String par = params.getText(); Serializer.get(new ArrayOutput(), new SerializerProp(par)); gui.set(Prop.EXPORTER, par); } catch(final IOException ex) { ok = false; inf = ex.getLocalizedMessage(); } } info.setText(inf, ok ? Msg.WARN : Msg.ERROR); enableOK(buttons, B_OK, ok); } @Override public void close() { if(!ok) return; // remembers serialization parameters final String mth = method.getSelectedItem().toString().toLowerCase(Locale.ENGLISH); final String enc = encoding.getSelectedItem().toString(); final SerializerProp sp = new SerializerProp(params.getText()); sp.set(SerializerProp.S_METHOD, mth); sp.set(SerializerProp.S_ENCODING, enc); gui.set(Prop.EXPORTER, parameters(sp, false)); super.close(); path.store(); } /** * Create a serialization parameter string. * @param sp serialization properties * @param excl exclude method and encoding * @return result string */ private String parameters(final SerializerProp sp, final boolean excl) { final String[] ex = !excl ? new String[0] : new String[] { SerializerProp.S_METHOD[0].toString(), SerializerProp.S_ENCODING[0].toString() }; final StringBuilder sb = new StringBuilder(); for(final String key : sp) { if(Token.eq(key, ex)) continue; final Object val = sp.get(key); if(!Serializer.PROPS.get(key).equals(val)) { if(sb.length() != 0) sb.append(','); sb.append(key).append('=').append(val); } } return sb.toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/dialog/DialogFT.java000066400000000000000000000117441222453003200255250ustar00rootroot00000000000000package org.basex.gui.dialog; import static org.basex.core.Text.*; import java.awt.event.*; import javax.swing.*; import org.basex.core.*; import org.basex.gui.*; import org.basex.gui.layout.*; import org.basex.gui.layout.BaseXFileChooser.Mode; import org.basex.io.*; import org.basex.util.ft.*; import org.basex.util.list.*; /** * Full-text creation dialog. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class DialogFT extends BaseXBack { /** Language flag. */ private static final int F_LANG = 0; /** Stemming flag. */ private static final int F_STEM = 1; /** Case flag. */ private static final int F_CASE = 2; /** Diacritics flag. */ private static final int F_DIA = 3; /** Stopwords flag. */ private static final int F_STOP = 4; /** Number of flags. */ private static final int FLAGS = 5; /** Dialog reference. */ private final BaseXDialog dialog; /** Full-text indexing. */ private final BaseXCheckBox[] check = new BaseXCheckBox[FLAGS]; /** Full-text language. */ private final BaseXCombo language; /** Path for Full-text stopword list. */ private final BaseXTextField swpath; /** Path button for full-text stopword list path. */ private final BaseXButton swbrowse; /** * Constructor. * @param d dialog reference * @param create create dialog */ DialogFT(final BaseXDialog d, final boolean create) { dialog = d; layout(new TableLayout(create ? 9 : 15, 1)); final Prop prop = d.gui.context.prop; add(new BaseXLabel(H_FULLTEXT_INDEX, true, false).border(0, 0, 6, 0)); final String sw = prop.get(Prop.STOPWORDS); final String[] cb = { LANGUAGE, STEMMING, CASE_SENSITIVITY, DIACRITICS, STOPWORD_LIST }; final String[] desc = { H_LANGUAGE, H_STEMMING, H_CASE, H_DIACRITICS, H_STOPWORDS }; final boolean[] val = { !prop.get(Prop.LANGUAGE).isEmpty(), prop.is(Prop.STEMMING), prop.is(Prop.CASESENS), prop.is(Prop.DIACRITICS), !sw.isEmpty() }; final BaseXLabel[] labels = new BaseXLabel[FLAGS]; for(int f = 0; f < check.length; ++f) { check[f] = new BaseXCheckBox(cb[f], val[f], create ? 1 : 0, d); if(!create) { labels[f] = new BaseXLabel(desc[f], true, false); } else { check[f].setToolTipText(desc[f]); } } final BaseXBack b1 = new BaseXBack(new TableLayout(1, 2, 8, 0)); b1.add(check[F_LANG]); final StringList langs = FTLexer.languages(); language = new BaseXCombo(d, langs.toArray()); final Language ln = Language.get(prop); for(final String l : langs) { final String s = l.replaceFirst(" \\(.*", ""); if(s.equals(ln.toString())) language.setSelectedItem(l); } b1.add(language); add(b1); if(!create) add(labels[F_LANG]); for(int f = 1; f < F_STOP; ++f) { add(check[f]); if(!create) add(labels[f]); } add(check[F_STOP]); add(Box.createVerticalStrut(4)); final BaseXBack b3 = new BaseXBack(new TableLayout(1, 2, 8, 0)); swpath = new BaseXTextField(sw.isEmpty() ? d.gui.gprop.get(GUIProp.DATAPATH) : sw, d); b3.add(swpath); swbrowse = new BaseXButton(BROWSE_D, d); swbrowse.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { chooseStop(); } }); b3.add(swbrowse); add(b3); if(!create) add(labels[F_STOP]); } /** * Opens a file dialog to choose a stopword list. */ void chooseStop() { final GUIProp gprop = dialog.gui.gprop; final BaseXFileChooser fc = new BaseXFileChooser(FILE_OR_DIR, gprop.get(GUIProp.DATAPATH), dialog.gui); final IO file = fc.select(Mode.FOPEN); if(file != null) { swpath.setText(file.path()); gprop.set(GUIProp.DATAPATH, file.path()); } } /** * Reacts on user input. * @param enabled enabled flag */ void action(final boolean enabled) { for(final BaseXCheckBox c : check) c.setEnabled(enabled); language.setEnabled(enabled && check[F_LANG].isSelected()); swbrowse.setEnabled(enabled && check[F_STOP].isSelected()); swpath.setEnabled(enabled && check[F_STOP].isSelected()); final String sw = swpath.getText().trim(); final IO file = IO.get(sw); final boolean exists = !sw.isEmpty() && file.exists(); if(exists) dialog.gui.gprop.set(GUIProp.DATAPATH, sw); } /** * Sets the chosen options. */ void setOptions() { final GUI gui = dialog.gui; final String lang = language.getSelectedItem().toString(); gui.set(Prop.LANGUAGE, check[F_LANG].isSelected() ? Language.get(lang.replaceFirst(" \\(.*", "")).toString() : ""); gui.set(Prop.STEMMING, check[F_STEM].isSelected()); gui.set(Prop.CASESENS, check[F_CASE].isSelected()); gui.set(Prop.DIACRITICS, check[F_DIA].isSelected()); gui.set(Prop.STOPWORDS, check[F_STOP].isSelected() ? swpath.getText() : ""); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/dialog/DialogFonts.java000066400000000000000000000043001222453003200262730ustar00rootroot00000000000000package org.basex.gui.dialog; import static org.basex.core.Text.*; import java.awt.*; import org.basex.gui.*; import org.basex.gui.layout.*; /** * Dialog window for changing the used fonts. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DialogFonts extends BaseXDialog { /** Predefined font sizes. */ private static final String[] FTSZ = { "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "22", "24", "26", "28", "30", "33", "36", "40" }; /** Font name chooser. */ private final BaseXList font; /** Font name chooser. */ private final BaseXList font2; /** Font type chooser. */ private final BaseXList type; /** Font size chooser. */ private final BaseXList size; /** * Default constructor. * @param main reference to the main window */ public DialogFonts(final GUI main) { super(main, CHOOSE_FONT, false); final String[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment(). getAvailableFontFamilyNames(); final BaseXBack p = new BaseXBack(new TableLayout(1, 4, 8, 0)); font = new BaseXList(fonts, this); p.add(font); font2 = new BaseXList(fonts, this); p.add(font2); type = new BaseXList(FONT_TYPES, this); type.setWidth(90); p.add(type); size = new BaseXList(FTSZ, this); size.setWidth(50); p.add(size); final GUIProp gprop = gui.gprop; font.setValue(gprop.get(GUIProp.FONT)); font2.setValue(gprop.get(GUIProp.MONOFONT)); type.setValue(FONT_TYPES[gprop.num(GUIProp.FONTTYPE)]); size.setValue(Integer.toString(gui.gprop.num(GUIProp.FONTSIZE))); set(p, BorderLayout.CENTER); finish(gprop.nums(GUIProp.FONTSLOC)); } @Override public void action(final Object cmp) { final GUIProp gprop = gui.gprop; gprop.set(GUIProp.FONT, font.getValue()); gprop.set(GUIProp.MONOFONT, font2.getValue()); gprop.set(GUIProp.FONTTYPE, type.getIndex()); gprop.set(GUIProp.FONTSIZE, size.getNum()); font.setFont(font.getValue(), type.getIndex()); font2.setFont(font2.getValue(), type.getIndex()); gui.updateLayout(); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/dialog/DialogImport.java000066400000000000000000000203201222453003200264540ustar00rootroot00000000000000package org.basex.gui.dialog; import static org.basex.core.Text.*; import java.awt.event.*; import java.io.*; import java.util.*; import javax.swing.*; import org.basex.core.*; import org.basex.data.*; import org.basex.gui.*; import org.basex.gui.layout.*; import org.basex.gui.layout.BaseXFileChooser.Mode; import org.basex.io.*; import org.basex.io.in.*; import org.basex.util.*; import org.basex.util.list.*; /** * Panel for importing new database resources. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class DialogImport extends BaseXBack { /** Available parsers. */ private static final String[] PARSING = { DataText.M_XML, DataText.M_JSON, DataText.M_HTML, DataText.M_CSV, DataText.M_TEXT, DataText.M_RAW }; /** User feedback. */ final BaseXLabel info; /** Resource to add. */ final BaseXTextField input; /** Browse button. */ final BaseXButton browse; /** Parser. */ final BaseXCombo parser; /** DB name. */ String dbname; /** Dialog reference. */ private final GUI gui; /** Parsing options. */ private final DialogParsing parsing; /** Add contents of archives. */ private final BaseXCheckBox archives; /** Skip corrupt files. */ private final BaseXCheckBox skipCorrupt; /** Add remaining files as raw files. */ private final BaseXCheckBox addRaw; /** Document filter. */ private final BaseXTextField filter; /** * Constructor. * @param dial dialog reference * @param panel feature panel * @param parse parsing dialog */ public DialogImport(final BaseXDialog dial, final BaseXBack panel, final DialogParsing parse) { gui = dial.gui; parsing = parse; layout(new TableLayout(10, 1)); border(8); // add options add(new BaseXLabel(FILE_OR_DIR + COL, true, true).border(0, 0, 6, 0)); final String in = gui.gprop.get(GUIProp.INPUTPATH); input = new BaseXTextField(gui.gprop.get(GUIProp.INPUTPATH), dial); input.history(gui, GUIProp.INPUTS); final IO io = IO.get(in); if(io instanceof IOFile && !in.isEmpty()) dbname = io.dbname(); browse = new BaseXButton(BROWSE_D, dial); browse.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { choose(); } }); final BaseXBack b = new BaseXBack(new TableLayout(1, 2, 8, 0)); b.add(input); b.add(browse); add(b); // add additional options add(panel); add(Box.createVerticalStrut(12)); final Prop prop = gui.context.prop; final StringList parsers = new StringList(PARSING.length); for(final String p : PARSING) parsers.add(p.toUpperCase(Locale.ENGLISH)); parser = new BaseXCombo(dial, parsers.toArray()); parser.setSelectedItem(prop.get(Prop.PARSER).toUpperCase(Locale.ENGLISH)); filter = new BaseXTextField(prop.get(Prop.CREATEFILTER), dial); BaseXLayout.setWidth(filter, 200); addRaw = new BaseXCheckBox(ADD_RAW_FILES, prop.is(Prop.ADDRAW), dial); skipCorrupt = new BaseXCheckBox(SKIP_CORRUPT_FILES, prop.is(Prop.SKIPCORRUPT), dial); archives = new BaseXCheckBox(PARSE_ARCHIVES, prop.is(Prop.ADDARCHIVES), dial); final BaseXBack p = new BaseXBack(new TableLayout(2, 2, 20, 0)); p.add(new BaseXLabel(INPUT_FORMAT, false, true).border(0, 0, 6, 0)); p.add(new BaseXLabel(FILE_PATTERNS + COL, false, true).border(0, 0, 6, 0)); p.add(parser); p.add(filter); add(p); add(Box.createVerticalStrut(8)); add(addRaw); add(skipCorrupt); add(archives); // add info label info = new BaseXLabel(" ").border(24, 0, 6, 0); add(info); } /** * Returns the input field path string. * @return path */ String input() { return input.getText().trim(); } /** * Returns an XML file chosen by the user. * @return file chooser */ IOFile inputFile() { final String path = gui.gprop.get(GUIProp.INPUTPATH); final BaseXFileChooser fc = new BaseXFileChooser(FILE_OR_DIR, path, gui); fc.textFilters(); fc.filter(ZIP_ARCHIVES, IO.ZIPSUFFIXES); final IOFile file = fc.select(Mode.FDOPEN); if(file != null) gui.gprop.set(GUIProp.INPUTPATH, file.path()); return file; } /** * Updates the dialog window. * @param comp component * @param empty allow empty input * @return success flag, or {@code false} if specified input is not found */ boolean action(final Object comp, final boolean empty) { boolean ok = parsing.action(); final String in = input.getText().trim(); final IO io = IO.get(in); gui.gprop.set(GUIProp.INPUTPATH, in); boolean multi = io.isDir() || io.isArchive(); archives.setEnabled(multi); multi &= archives.isSelected(); filter.setEnabled(multi); final String type = parser(); final boolean raw = type.equals(DataText.M_RAW); addRaw.setEnabled(multi && !raw && !gui.context.prop.is(Prop.MAINMEM)); skipCorrupt.setEnabled(!raw); if(comp == parser) { parsing.updateType(type); if(multi) filter.setText(raw ? "*" : "*." + type); } ok &= empty ? in.isEmpty() || io.exists() : !in.isEmpty() && io.exists(); if(ok && comp == input) setType(in); info.setText(null, null); return ok; } /** * Sets the parsing options. */ void setOptions() { final String type = parser(); gui.set(Prop.PARSER, type); gui.set(Prop.CREATEFILTER, filter.getText()); gui.set(Prop.ADDARCHIVES, archives.isSelected()); gui.set(Prop.SKIPCORRUPT, skipCorrupt.isSelected()); gui.set(Prop.ADDRAW, addRaw.isSelected()); input.store(); parsing.setOptions(type); } /** * Opens a file dialog to choose an input file or directory, * and updates the panel. */ void choose() { // get user input (may be canceled) final IOFile in = inputFile(); if(in == null) return; input.setText(in.path()); setType(in.path()); } /** * Chooses the correct input type. * @param in input */ void setType(final String in) { // get file path, update input path and database name final IO io = IO.get(in); if(!in.isEmpty() && io instanceof IOFile) dbname = io.dbname(); final boolean dir = io.isDir(); final boolean archive = io.isArchive(); if(dir || archive) filter.setText('*' + IO.XMLSUFFIX); // evaluate input type String type = null; if(!dir && !archive) { // input type of single file final String path = io.path(); final int i = path.lastIndexOf('.'); if(i != -1) { // analyze file suffix final String suf = path.substring(i).toLowerCase(Locale.ENGLISH); if(Token.eq(suf, IO.XMLSUFFIXES)) type = DataText.M_XML; else if(Token.eq(suf, IO.XSLSUFFIXES)) type = DataText.M_XML; else if(Token.eq(suf, IO.HTMLSUFFIXES)) type = DataText.M_HTML; else if(Token.eq(suf, IO.CSVSUFFIX)) type = DataText.M_CSV; else if(Token.eq(suf, IO.TXTSUFFIXES)) type = DataText.M_TEXT; else if(Token.eq(suf, IO.JSONSUFFIX)) type = DataText.M_JSON; } // unknown suffix: analyze first bytes if(type == null) type = guess(io); } // default parser: XML if(type == null) type = DataText.M_XML; // choose correct parser (default: XML) parser.setSelectedItem(type.toUpperCase(Locale.ENGLISH)); parsing.updateType(type); } /** * Returns the parsing type. * @return type */ String parser() { return parser.getSelectedItem().toString().toLowerCase(Locale.ENGLISH); } /** * Guesses the content type of the specified input. * @param in input stream * @return type */ static String guess(final IO in) { if(!in.exists()) return null; BufferInput ti = null; try { ti = new BufferInput(in); int b = ti.read(); // input starts with opening bracket: may be xml if(b == '<') return DataText.M_XML; for(int c = 0; b >= 0 && ++c < IO.BLOCKSIZE;) { // treat as raw data if characters are no ascii if(b < ' ' && !Token.ws(b) || b >= 128) return DataText.M_RAW; b = ti.read(); } // all characters were of type ascii return DataText.M_TEXT; } catch(final IOException ignored) { } finally { if(ti != null) try { ti.close(); } catch(final IOException ignored) { } } // could not evaluate type return null; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/dialog/DialogInput.java000066400000000000000000000047261222453003200263150ustar00rootroot00000000000000package org.basex.gui.dialog; import static org.basex.core.Text.*; import java.awt.*; import org.basex.core.*; import org.basex.data.*; import org.basex.gui.GUIConstants.Msg; import org.basex.gui.layout.*; import org.basex.util.*; import org.basex.util.list.*; /** * Dialog with a single text field. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DialogInput extends BaseXDialog { /** User input. */ private final BaseXTextField input; /** Old input. */ private final String old; /** Buttons. */ private final BaseXBack buttons; /** Info label. */ private final BaseXLabel info; /** Available databases. */ private final StringList db; /** Rename/copy/delete dialog. */ private final int type; /** * Default constructor. * @param o old input * @param tit title string * @param d dialog window * @param t type of dialog: 0 = rename database, 1 = drop documents, 2 = copy database */ public DialogInput(final String o, final String tit, final BaseXDialog d, final int t) { super(d, tit); old = o; db = d.gui.context.databases.listDBs(); type = t; String title = ""; if(type == 0) { title = TARGET_PATH + COLS; } else if(type == 1) { title = NAME_OF_DB + COLS; } else if(type == 2) { title = NAME_OF_DB_COPY + COLS; } set(new BaseXLabel(title, false, true).border(0, 0, 6, 0), BorderLayout.NORTH); input = new BaseXTextField(o, this); info = new BaseXLabel(" "); final BaseXBack p = new BaseXBack(new BorderLayout(0, 8)); p.add(input, BorderLayout.NORTH); p.add(info, BorderLayout.CENTER); set(p, BorderLayout.CENTER); buttons = newButtons(B_OK, B_CANCEL); set(buttons, BorderLayout.SOUTH); action(null); finish(null); } /** * Returns the user input. * @return input */ public String input() { return input.getText().trim(); } @Override public void action(final Object cmp) { final String in = input(); String msg = null; ok = type != 0 && (db.contains(in) || in.equals(old)); if(ok) msg = Util.info(DB_EXISTS_X, in); if(!ok) { ok = type == 0 ? MetaData.normPath(in) != null : Databases.validName(in); if(!ok) msg = in.isEmpty() ? ENTER_DB_NAME : Util.info(INVALID_X, NAME); } info.setText(msg, type == 1 || type == 2 ? Msg.ERROR : Msg.WARN); enableOK(buttons, B_OK, ok); } @Override public void close() { if(ok) super.close(); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/dialog/DialogInsert.java000066400000000000000000000111631222453003200264530ustar00rootroot00000000000000package org.basex.gui.dialog; import static org.basex.core.Text.*; import static org.basex.util.Token.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import org.basex.data.*; import org.basex.gui.*; import org.basex.gui.GUIConstants.Msg; import org.basex.gui.editor.*; import org.basex.gui.layout.*; import org.basex.util.*; import org.basex.util.list.*; /** * Dialog window for inserting new database nodes. * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class DialogInsert extends BaseXDialog { /** Resulting update arguments. */ public final StringList result = new StringList(); /** Node kind. */ public int kind; /** Button panel. */ private final BaseXBack buttons; /** Background panel. */ private final BaseXBack back; /** Info label. */ private final BaseXLabel info; /** Text area. */ private final BaseXTextField input1; /** Text area. */ private final Editor input2; /** First label. */ private final BaseXLabel label1; /** Second label. */ private final BaseXLabel label2; /** Insert kind selection buttons. */ private final BaseXRadio[] radio; /** * Default constructor. * @param main reference to the main window */ public DialogInsert(final GUI main) { super(main, INSERT_NEW_DATA); label1 = new BaseXLabel(NAME + COLS, true, true).border(0, 0, 0, 0); label2 = new BaseXLabel(VALUE + COLS, true, true).border(0, 0, 0, 0); input1 = new BaseXTextField(this); BaseXLayout.setWidth(input1, 500); input2 = new Editor(true, this); input2.addKeyListener(keys); BaseXLayout.setWidth(input2, 500); final BaseXBack knd = new BaseXBack(new TableLayout(1, 5)); final ButtonGroup group = new ButtonGroup(); final ActionListener al = new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { change(e.getSource()); } }; final int lkind = gui.gprop.num(GUIProp.LASTINSERT); radio = new BaseXRadio[NODE_KINDS.length]; for(int i = 1; i < NODE_KINDS.length; ++i) { radio[i] = new BaseXRadio(NODE_KINDS[i], false, this); radio[i].addActionListener(al); radio[i].setSelected(i == lkind); radio[i].addKeyListener(keys); group.add(radio[i]); knd.add(radio[i]); } set(knd, BorderLayout.NORTH); back = new BaseXBack(10, 0, 0, 0); set(back, BorderLayout.CENTER); final BaseXBack pp = new BaseXBack(new BorderLayout()); info = new BaseXLabel(" ").border(12, 0, 6, 0); pp.add(info, BorderLayout.WEST); buttons = okCancel(); pp.add(buttons, BorderLayout.EAST); set(pp, BorderLayout.SOUTH); setResizable(true); change(radio[lkind]); action(null); finish(null); } /** * Activates the specified radio button. * @param src button reference */ void change(final Object src) { int n = 0; for(int r = 0; r < radio.length; ++r) if(src == radio[r]) n = r; BaseXLayout.setHeight(input2, n == Data.ATTR ? 25 : 350); back.removeAll(); back.layout(new BorderLayout(0, 4)); if(n != Data.TEXT && n != Data.COMM) { final BaseXBack b = new BaseXBack(new BorderLayout(0, 4)); b.add(label1, BorderLayout.NORTH); b.add(input1, BorderLayout.CENTER); back.add(b, BorderLayout.NORTH); } if(n != Data.ELEM) { final BaseXBack b = new BaseXBack(new BorderLayout(0, 4)); b.add(label2, BorderLayout.NORTH); b.add(new SearchEditor(gui, input2), BorderLayout.CENTER); back.add(b, BorderLayout.CENTER); } pack(); } @Override public void action(final Object cmp) { for(int i = 1; i < NODE_KINDS.length; ++i) { if(radio[i].isSelected()) kind = i; } gui.gprop.set(GUIProp.LASTINSERT, kind); String msg = null; ok = kind != Data.TEXT || input2.getText().length != 0; if(kind != Data.TEXT && kind != Data.COMM) { ok = XMLToken.isQName(token(input1.getText())); if(!ok && !input1.getText().isEmpty()) msg = Util.info(INVALID_X, NAME); } info.setText(msg, Msg.ERROR); enableOK(buttons, B_OK, ok); } @Override public void close() { super.close(); final String in1 = input1.getText(); final String in2 = string(input2.getText()); switch(kind) { case Data.ATTR: case Data.PI: result.add(in1).add(in2); break; case Data.ELEM: result.add(in1); break; case Data.TEXT: case Data.COMM: result.add(in2); break; } } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/dialog/DialogLine.java000066400000000000000000000033061222453003200260760ustar00rootroot00000000000000package org.basex.gui.dialog; import static org.basex.core.Text.*; import java.awt.*; import org.basex.gui.*; import org.basex.gui.GUIConstants.Msg; import org.basex.gui.layout.*; import org.basex.util.*; /** * Go to line dialog. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DialogLine extends BaseXDialog { /** New password. */ private final BaseXTextField line; /** Buttons. */ private final BaseXBack buttons; /** Info label. */ private final BaseXLabel info; /** * Default constructor. * @param main reference to the main window * @param curr current line */ public DialogLine(final GUI main, final int curr) { super(main, GO_TO_LINE); line = new BaseXTextField(Integer.toString(curr), this); line.addKeyListener(keys); info = new BaseXLabel(" "); final BaseXBack p = new BaseXBack(new BorderLayout(0, 8)); p.add(line, BorderLayout.NORTH); p.add(info, BorderLayout.CENTER); set(p, BorderLayout.CENTER); buttons = newButtons(B_OK, B_CANCEL); set(buttons, BorderLayout.SOUTH); action(null); finish(null); } @Override public void action(final Object cmp) { final int l = line(); ok = l >= 0; info.setText(ok || line.getText().isEmpty() ? null : Util.info(INVALID_X, LINE_NUMBER), Msg.ERROR); enableOK(buttons, B_OK, ok); } @Override public void close() { if(!ok) return; super.close(); } /** * Returns the entered line number. * @return line number, or {@code -1} or invalid values */ public int line() { try { return Integer.parseInt(line.getText()); } catch(final NumberFormatException ex) { return -1; } } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/dialog/DialogManage.java000066400000000000000000000172151222453003200264030ustar00rootroot00000000000000package org.basex.gui.dialog; import static org.basex.core.Text.*; import java.awt.*; import java.io.*; import java.util.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.gui.*; import org.basex.gui.editor.*; import org.basex.gui.layout.*; import org.basex.io.*; import org.basex.util.*; import org.basex.util.list.*; /** * Open database dialog. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DialogManage extends BaseXDialog { /** List of currently available databases. */ private final BaseXList choice; /** Name of current database. */ private final BaseXLabel doc1; /** Name of current database. */ private final BaseXLabel doc2; /** Information panel. */ private final Editor detail; /** Rename button. */ private final BaseXButton rename; /** Drop button. */ private final BaseXButton drop; /** Open button. */ private final BaseXButton open; /** Backup button. */ private final BaseXButton backup; /** Restore button. */ private final BaseXButton restore; /** Copy button. */ private final BaseXButton copy; /** Refresh list of databases. */ private boolean refresh; /** Combobox that lists available backups for a database. */ private final BaseXList backups; /** Delete button for backups. */ private final BaseXButton delete; /** Deletes all backups. */ private final BaseXButton deleteAll; /** * Default constructor. * @param main reference to the main window */ public DialogManage(final GUI main) { super(main, MANAGE_DB); panel.setLayout(new BorderLayout(4, 0)); // create database chooser final StringList dbs = main.context.databases.list(); choice = new BaseXList(dbs.toArray(), this, false); choice.setSize(200, 500); final Data data = main.context.data(); if(data != null) choice.setValue(data.meta.name); doc1 = new BaseXLabel(" ").large(); doc1.setSize(420, doc1.getHeight()); detail = new Editor(false, this); detail.setFont(panel.getFont()); // database buttons rename = new BaseXButton(RENAME + DOTS, this); copy = new BaseXButton(COPY + DOTS, this); open = new BaseXButton(OPEN, this); drop = new BaseXButton(DROP + DOTS, this); // first tab final BaseXBack tab1 = new BaseXBack(new BorderLayout(0, 8)).border(8); tab1.add(doc1, BorderLayout.NORTH); tab1.add(new SearchEditor(main, detail), BorderLayout.CENTER); tab1.add(newButtons(drop, rename, copy, open), BorderLayout.SOUTH); doc2 = new BaseXLabel(" ").border(0, 0, 6, 0); doc2.setFont(doc1.getFont()); backups = new BaseXList(new String[] { }, this); backups.setSize(400, 400); // backup buttons backup = new BaseXButton(BACKUP, this); restore = new BaseXButton(RESTORE, this); delete = new BaseXButton(DELETE, this); deleteAll = new BaseXButton(DELETE_ALL + DOTS, this); // second tab final BaseXBack tab2 = new BaseXBack(new BorderLayout(0, 8)).border(8); tab2.add(doc2, BorderLayout.NORTH); tab2.add(backups, BorderLayout.CENTER); tab2.add(newButtons(backup, restore, delete, deleteAll), BorderLayout.SOUTH); final BaseXTabs tabs = new BaseXTabs(this); tabs.addTab(INFORMATION, tab1); tabs.addTab(BACKUPS, tab2); BaseXLayout.setWidth(detail, 400); BaseXLayout.setWidth(doc1, 400); BaseXLayout.setWidth(doc2, 400); set(choice, BorderLayout.CENTER); set(tabs, BorderLayout.EAST); action(null); if(!dbs.isEmpty()) finish(null); } /** * Tests if no databases have been found. * @return result of check */ public boolean nodb() { return choice.getList().length == 0; } @Override public void action(final Object cmp) { final Context ctx = gui.context; if(refresh) { // rebuild databases and focus list chooser choice.setData(ctx.databases.list().toArray()); choice.requestFocusInWindow(); refresh = false; } final StringList dbs = choice.getValues(); final String db = choice.getValue(); final ArrayList cmds = new ArrayList(); if(cmp == open) { close(); } else if(cmp == drop) { for(final String s : dbs) { if(ctx.mprop.dbexists(s)) cmds.add(new DropDB(s)); } if(!BaseXDialog.confirm(gui, Util.info(DROPPING_DB_X, cmds.size()))) return; refresh = true; } else if(cmp == rename) { final DialogInput dr = new DialogInput(db, RENAME_DB, this, 1); if(!dr.ok() || dr.input().equals(db)) return; cmds.add(new AlterDB(db, dr.input())); refresh = true; } else if(cmp == copy) { final DialogInput dc = new DialogInput(db, COPY_DB, this, 2); if(!dc.ok() || dc.input().equals(db)) return; cmds.add(new Copy(db, dc.input())); refresh = true; } else if(cmp == backup) { for(final String s : dbs) cmds.add(new CreateBackup(s)); } else if(cmp == restore) { // show warning if existing database would be overwritten if(!gui.context.mprop.dbexists(db) || BaseXDialog.confirm(gui, OVERWRITE_DB_QUESTION)) cmds.add(new Restore(db)); } else if(cmp == backups) { // don't reset the combo box after selecting an item // no direct consequences if backup selection changes } else if(cmp == delete) { cmds.add(new DropBackup(backups.getValue())); refresh = backups.getList().length == 1; backups.requestFocusInWindow(); } else if(cmp == deleteAll) { final String[] back = backups.getList(); if(!BaseXDialog.confirm(gui, Util.info(DROP_BACKUPS_X, back.length))) return; for(final String b : back) cmds.add(new DropBackup(b)); refresh = true; } else if(cmp != backups) { final String title = dbs.size() == 1 ? db : dbs.size() + " " + DATABASES; doc1.setText(title); doc2.setText(BACKUPS + COLS + title); boolean active = ctx.mprop.dbexists(db); String info = ""; if(active) { // refresh info view final MetaData meta = new MetaData(db, ctx); try { meta.read(); info = InfoDB.db(meta, true, true, true); } catch(final IOException ex) { info = Util.message(ex); } } else if(dbs.size() == 1) { info = ONLY_BACKUP; } detail.setText(Token.token(info)); // enable or disable buttons rename.setEnabled(active); copy.setEnabled(active); open.setEnabled(active); restore.setEnabled(active); active = false; for(final String d : dbs) active |= ctx.mprop.dbexists(d); drop.setEnabled(active); backup.setEnabled(active); // enable/disable backup buttons final StringList back = Databases.backupPaths(db, ctx).sort(Prop.CASE, false); for(int b = 0; b < back.size(); b++) { final String n = new IOFile(back.get(b)).name(); back.set(b, n.substring(0, n.lastIndexOf('.'))); } active = !back.isEmpty(); backups.setData(back.toArray()); backups.setEnabled(active); restore.setEnabled(active); delete.setEnabled(active); deleteAll.setEnabled(active); } // run all commands if(!cmds.isEmpty()) { DialogProgress.execute(this, cmds.toArray(new Command[cmds.size()])); } } @Override public void close() { final String db = choice.getValue(); if(gui.context.mprop.dbexists(db)) { DialogProgress.execute(this, new Open(db)); dispose(); } } }basex-7.7.2/basex-core/src/main/java/org/basex/gui/dialog/DialogMapLayout.java000066400000000000000000000051071222453003200271230ustar00rootroot00000000000000package org.basex.gui.dialog; import static org.basex.core.Text.*; import java.awt.*; import org.basex.gui.*; import org.basex.gui.layout.*; /** * Dialog window for specifying the TreeMap layout. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DialogMapLayout extends BaseXDialog { /** Algorithm combobox. */ private final BaseXCombo algo; /** Layout slider. */ private final BaseXSlider sizeSlider; /** Show attributes. */ private final BaseXCheckBox atts; /** Select layout algorithm. */ private final BaseXCombo border; /** Size slider label. */ private final BaseXLabel sizeLabel; /** * Default constructor. * @param main reference to the main window */ public DialogMapLayout(final GUI main) { super(main, MAP_LAYOUT, false); final BaseXBack p = new BaseXBack(new TableLayout(4, 1, 0, 8)); // create list BaseXBack tmp = new BaseXBack(new TableLayout(1, 2, 8, 0)); tmp.add(new BaseXLabel(ALGORITHM + COL)); algo = new BaseXCombo(this, MAP_LAYOUTS); tmp.add(algo); p.add(tmp); // create drop down final GUIProp gprop = gui.gprop; border = new BaseXCombo(this, MAP_CHOICES); border.setSelectedIndex(gprop.num(GUIProp.MAPOFFSETS)); tmp = new BaseXBack(new TableLayout(1, 2, 8, 0)); tmp.add(new BaseXLabel(OFFSETS + COL)); tmp.add(border); p.add(tmp); algo.setSize(200, 100); // create slider sizeLabel = new BaseXLabel(RATIO + COLS); sizeSlider = new BaseXSlider(0, 100, gprop.num(GUIProp.MAPWEIGHT), this); BaseXLayout.setWidth(sizeSlider, p.getPreferredSize().width); tmp = new BaseXBack(new TableLayout(2, 1)); tmp.add(sizeLabel); tmp.add(sizeSlider); p.add(tmp); // create checkbox atts = new BaseXCheckBox(SHOW_ATTS, gprop.is(GUIProp.MAPATTS), this); p.add(atts); set(p, BorderLayout.CENTER); finish(gprop.nums(GUIProp.MAPLAYOUTLOC)); algo.setSelectedIndex(gprop.num(GUIProp.MAPALGO)); } @Override public void action(final Object cmp) { final GUIProp gprop = gui.gprop; gprop.set(GUIProp.MAPOFFSETS, border.getSelectedIndex()); gprop.set(GUIProp.MAPALGO, algo.getSelectedIndex()); gprop.set(GUIProp.MAPATTS, atts.isSelected()); final int sizeprp = sizeSlider.value(); gprop.set(GUIProp.MAPWEIGHT, sizeprp); sizeLabel.setText(RATIO + COLS + (sizeprp > 45 && sizeprp < 55 ? CHILDREN_TEXT_LEN : sizeprp < 45 ? NUMBER_CHILDREN : TEXT_LENGTH)); gui.notify.layout(); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/dialog/DialogMessage.java000066400000000000000000000043551222453003200266000ustar00rootroot00000000000000package org.basex.gui.dialog; import java.awt.*; import javax.swing.*; import org.basex.core.*; import org.basex.gui.*; import org.basex.gui.GUIConstants.Msg; import org.basex.gui.editor.*; import org.basex.gui.layout.*; import org.basex.util.*; /** * Dialog window for messages. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DialogMessage extends BaseXDialog { /** Ok/yes button. */ final BaseXButton yes; /** This flag indicates if the dialog was canceled. */ private boolean canceled = true; /** No button. */ private BaseXButton no; /** * Default constructor. * @param main reference to the main window * @param txt message text * @param ic message type */ public DialogMessage(final GUI main, final String txt, final Msg ic) { super(main, ic == Msg.ERROR ? Text.ERROR : Text.INFORMATION); panel.setLayout(new BorderLayout()); final BaseXBack back = new BaseXBack(new TableLayout(1, 2, 12, 0)); final BaseXLabel b = new BaseXLabel(); b.setIcon(ic.large); back.add(b); final Editor text = new Editor(false, this, Token.token(txt)); text.setFont(b.getFont()); back.add(text); set(back, BorderLayout.NORTH); final BaseXBack buttons; if(ic == Msg.QUESTION || ic == Msg.YESNOCANCEL) { yes = new BaseXButton(Text.B_YES, this); no = new BaseXButton(Text.B_NO, this); if(ic == Msg.QUESTION) { buttons = newButtons(yes, no); } else { buttons = newButtons(yes, no, new BaseXButton(Text.B_CANCEL, this)); } } else { yes = new BaseXButton(Text.B_OK, this); buttons = newButtons(yes); } set(buttons, BorderLayout.SOUTH); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { yes.requestFocusInWindow(); } }); finish(null); } @Override public void action(final Object cmp) { canceled = cmp != yes && cmp != no; if(cmp == yes) close(); else cancel(); } /** * States if the dialog window was canceled. * @return true when dialog was confirmed */ public boolean canceled() { return canceled; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/dialog/DialogNew.java000066400000000000000000000102041222453003200257330ustar00rootroot00000000000000package org.basex.gui.dialog; import static org.basex.core.Text.*; import java.awt.*; import org.basex.core.*; import org.basex.core.cmd.List; import org.basex.gui.*; import org.basex.gui.GUIConstants.Msg; import org.basex.gui.layout.*; import org.basex.util.*; import org.basex.util.list.*; /** * Dialog window for specifying options for creating a new database. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DialogNew extends BaseXDialog { /** General dialog. */ private final DialogImport general; /** Database name. */ private final BaseXTextField dbname; /** Buttons. */ private final BaseXBack buttons; /** Text index flag. */ private final BaseXCheckBox txtindex; /** Attribute value index flag. */ private final BaseXCheckBox atvindex; /** Full-text index flag. */ private final BaseXCheckBox ftxindex; /** Editable full-text options. */ private final DialogFT ft; /** Available databases. */ private final StringList db; /** * Default constructor. * @param main reference to the main window */ public DialogNew(final GUI main) { super(main, CREATE_DATABASE); // define buttons first to assign simplest mnemonics buttons = okCancel(); db = List.list(main.context); final Prop prop = gui.context.prop; final GUIProp gprop = main.gprop; dbname = new BaseXTextField(gprop.get(GUIProp.DBNAME), this); final BaseXBack pnl = new BaseXBack(new TableLayout(2, 1)); pnl.add(new BaseXLabel(NAME_OF_DB + COLS, false, true).border(8, 0, 6, 0)); pnl.add(dbname); // option panels final BaseXTabs tabs = new BaseXTabs(this); final DialogParsing parsing = new DialogParsing(this, tabs); general = new DialogImport(this, pnl, parsing); // index panel final BaseXBack indexes = new BaseXBack(new TableLayout(6, 1, 0, 0)).border(8); txtindex = new BaseXCheckBox(TEXT_INDEX, prop.is(Prop.TEXTINDEX), 0, this).large(); indexes.add(txtindex); indexes.add(new BaseXLabel(H_TEXT_INDEX, true, false)); atvindex = new BaseXCheckBox(ATTRIBUTE_INDEX, prop.is(Prop.ATTRINDEX), 0, this).large(); indexes.add(atvindex); indexes.add(new BaseXLabel(H_ATTR_INDEX, true, false)); // full-text panel //final BaseXBack fulltext = new BaseXBack(new TableLayout(2, 1, 0, 0)).border(8); ftxindex = new BaseXCheckBox(FULLTEXT_INDEX, prop.is(Prop.FTINDEX), 0, this).large(); indexes.add(ftxindex); ft = new DialogFT(this, true); indexes.add(ft); tabs.addTab(GENERAL, general); tabs.addTab(PARSING, parsing); tabs.addTab(INDEXES, indexes); set(tabs, BorderLayout.CENTER); set(buttons, BorderLayout.SOUTH); action(general.parser); finish(null); } @Override public void action(final Object comp) { final boolean valid = general.action(comp, true); ft.action(ftxindex.isSelected()); // ...must be located before remaining checks if(comp == general.browse || comp == general.input) dbname.setText(general.dbname); final String nm = dbname.getText().trim(); ok = valid && !nm.isEmpty(); String inf = !valid ? RES_NOT_FOUND : !ok ? ENTER_DB_NAME : null; Msg icon = Msg.ERROR; if(ok) { ok = Databases.validName(nm); if(ok) gui.gprop.set(GUIProp.DBNAME, nm); if(!ok) { // name of database is invalid inf = Util.info(INVALID_X, NAME); } else if(general.input.getText().trim().isEmpty()) { // database will be empty inf = EMPTY_DB; icon = Msg.WARN; } else if(db.contains(nm)) { // old database will be overwritten inf = OVERWRITE_DB; icon = Msg.WARN; } } general.info.setText(inf, icon); enableOK(buttons, B_OK, ok); } @Override public void close() { if(!ok) return; super.close(); gui.set(Prop.TEXTINDEX, txtindex.isSelected()); gui.set(Prop.ATTRINDEX, atvindex.isSelected()); gui.set(Prop.FTINDEX, ftxindex.isSelected()); general.setOptions(); ft.setOptions(); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/dialog/DialogPackages.java000066400000000000000000000116271222453003200267320ustar00rootroot00000000000000package org.basex.gui.dialog; import static org.basex.core.Text.*; import java.awt.*; import java.util.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.gui.*; import org.basex.gui.layout.*; import org.basex.gui.layout.BaseXFileChooser.Mode; import org.basex.io.*; import org.basex.query.util.pkg.*; import org.basex.query.util.pkg.Package; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * Open database dialog. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DialogPackages extends BaseXDialog { /** List of available packages. */ private final BaseXList packages; /** Title of package. */ private final BaseXLabel title; /** Install button. */ private final BaseXButton install; /** Delete button. */ private final BaseXButton delete; /** Name label. */ private final BaseXLabel name; /** Version label. */ private final BaseXLabel version; /** Type label. */ private final BaseXLabel type; /** Path label. */ private final BaseXLabel path; /** Refresh list of databases. */ private boolean refresh; /** * Default constructor. * @param main reference to the main window */ public DialogPackages(final GUI main) { super(main, PACKAGES); panel.setLayout(new BorderLayout(8, 0)); // create package chooser packages = new BaseXList(new String[] {}, this, false); packages.setSize(270, 220); title = new BaseXLabel(" ").large().border(0, 5, 5, 0); name = new BaseXLabel(" "); version = new BaseXLabel(" "); type = new BaseXLabel(" "); path = new BaseXLabel(" "); final BaseXBack table = new BaseXBack(new TableLayout(4, 2, 16, 0)).border(5); table.add(new BaseXLabel(NAME + COL, false, true)); table.add(name); table.add(new BaseXLabel(VERSINFO + COL, false, true)); table.add(version); table.add(new BaseXLabel(TYPE + COL, false, true)); table.add(type); table.add(new BaseXLabel(PATH + COL, false, true)); table.add(path); // database buttons install = new BaseXButton(INSTALL + DOTS, this); delete = new BaseXButton(DELETE + DOTS, this); BaseXBack p = new BaseXBack(new BorderLayout()); p.add(packages, BorderLayout.CENTER); final BaseXBack ss = new BaseXBack(new TableLayout(1, 2, 8, 0)).border(8, 0, 0, 0); ss.add(new BaseXLabel(PATH + COL, true, true), BorderLayout.NORTH); ss.add(new BaseXLabel(main.context.mprop.get(MainProp.REPOPATH))); p.add(ss, BorderLayout.SOUTH); set(p, BorderLayout.CENTER); p = new BaseXBack(new BorderLayout()); p.add(title, BorderLayout.NORTH); p.add(table, BorderLayout.CENTER); p.add(newButtons(install, delete), BorderLayout.SOUTH); BaseXLayout.setWidth(p, 430); set(p, BorderLayout.EAST); refresh = true; action(null); finish(null); } @Override public void action(final Object cmp) { final Context ctx = gui.context; if(refresh) { // rebuild databases and focus list chooser packages.setData(new RepoManager(ctx).list().toArray()); packages.requestFocusInWindow(); refresh = false; } final StringList pkgs = packages.getValues(); final ArrayList cmds = new ArrayList(); if(cmp == install) { final String pp = gui.gprop.get(GUIProp.WORKPATH); final BaseXFileChooser fc = new BaseXFileChooser(FILE_OR_DIR, pp, gui); fc.filter(XML_ARCHIVES, IO.XARSUFFIX); fc.filter(JAVA_ARCHIVES, IO.JARSUFFIX); fc.filter(XQUERY_FILES, IO.XQSUFFIXES); final IOFile file = fc.select(Mode.FDOPEN); if(file == null) return; gui.gprop.set(GUIProp.WORKPATH, file.path()); refresh = true; cmds.add(new RepoInstall(file.path(), null)); } else if(cmp == delete) { if(!BaseXDialog.confirm(gui, Util.info(DELETE_PACKAGES_X, pkgs.size()))) return; refresh = true; for(final String p : pkgs) cmds.add(new RepoDelete(p, null)); } else { final byte[] key = Token.token(packages.getValue()); final TokenMap pkg = ctx.repo.pkgDict(); if(pkg.get(key) != null) { title.setText(key.length == 0 ? DOTS : Token.string(key)); name.setText(Token.string(Package.name(key))); version.setText(Token.string(Package.version(key))); type.setText(PkgText.EXPATH); path.setText(Token.string(pkg.get(key))); } else { final String pp = Token.string(key); final IOFile file = RepoManager.file(pp, ctx.repo); title.setText(key.length == 0 ? DOTS : pp); name.setText(file != null ? file.name() : "-"); version.setText("-"); type.setText(PkgText.INTERNAL); path.setText(pp.replace('.', '/')); } // enable or disable buttons delete.setEnabled(pkgs.size() > 0); } // run all commands if(!cmds.isEmpty()) { DialogProgress.execute(this, cmds.toArray(new Command[cmds.size()])); } } }basex-7.7.2/basex-core/src/main/java/org/basex/gui/dialog/DialogParsing.java000066400000000000000000000231761222453003200266210ustar00rootroot00000000000000package org.basex.gui.dialog; import static org.basex.core.Text.*; import java.awt.event.*; import java.io.*; import java.util.*; import org.basex.build.file.*; import org.basex.build.xml.*; import org.basex.core.*; import org.basex.data.*; import org.basex.gui.*; import org.basex.gui.layout.*; import org.basex.gui.layout.BaseXFileChooser.Mode; import org.basex.io.*; import org.basex.util.*; import org.basex.util.list.*; /** * Parsing options dialog. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class DialogParsing extends BaseXBack { /** Format label. */ private final BaseXLabel label; /** Tabulators. */ private final BaseXTabs tabs; /** Internal XML parsing. */ private final BaseXCheckBox intparse; /** DTD mode. */ private final BaseXCheckBox dtd; /** Whitespace chopping. */ private final BaseXCheckBox chopWS; /** Namespace stripping. */ private final BaseXCheckBox stripNS; /** Use XML Catalog. */ private final BaseXCheckBox usecat; /** Catalog file. */ private final BaseXTextField cfile; /** Browse Catalog file. */ private final BaseXButton browsec; /** JSON options panel. */ private final BaseXBack jsonopts; /** JSON: Use JsonML format. */ private final BaseXCheckBox jsonml; /** JSON: encoding. */ private final BaseXCombo jencoding; /** HTML options panel. */ private final BaseXBack htmlopts; /** Parameters. */ private final BaseXTextField params; /** CSV options panel. */ private final BaseXBack csvopts; /** CSV: Use header. */ private final BaseXCheckBox header; /** CSV: Separator. */ private final BaseXBack separator; /** CSV: Separator. */ private final BaseXCombo sepcombo; /** CSV: Separator (numeric). */ private final BaseXTextField sepchar; /** CSV: encoding. */ private final BaseXCombo cencoding; /** Text options panel. */ private final BaseXBack textopts; /** Text: Use lines. */ private final BaseXCheckBox lines; /** Text: encoding. */ private final BaseXCombo tencoding; /** Main panel. */ private final BaseXBack main; /** Main window reference. */ private final GUI gui; /** Options panel. */ private BaseXBack parseropts; /** XML options panel. */ private final BaseXBack xmlopts; /** ParserProps. */ private ParserProp props; /** * Default constructor. * @param d dialog reference * @param t tabs */ public DialogParsing(final BaseXDialog d, final BaseXTabs t) { main = new BaseXBack(new TableLayout(2, 1)).border(8); gui = d.gui; tabs = t; label = new BaseXLabel(" ").border(0, 0, 12, 0).large(); final Prop prop = gui.context.prop; try { props = new ParserProp(prop.get(Prop.PARSEROPT)); } catch(final IOException ex) { props = new ParserProp(); } intparse = new BaseXCheckBox(INT_PARSER, prop.is(Prop.INTPARSE), 0, d); dtd = new BaseXCheckBox(PARSE_DTDS, prop.is(Prop.DTD), 0, d); chopWS = new BaseXCheckBox(CHOP_WS, prop.is(Prop.CHOP), 0, d); stripNS = new BaseXCheckBox(STRIP_NS, prop.is(Prop.STRIPNS), 0, d); cfile = new BaseXTextField(prop.get(Prop.CATFILE), d); browsec = new BaseXButton(BROWSE_D, d); usecat = new BaseXCheckBox(USE_CATALOG_FILE, !prop.get(Prop.CATFILE).isEmpty(), 0, d); jsonml = new BaseXCheckBox(PARSE_AS_JSONML, props.is(ParserProp.JSONML), 0, d); params = new BaseXTextField(prop.get(Prop.HTMLOPT), d); lines = new BaseXCheckBox(SPLIT_INPUT_LINES, props.is(ParserProp.LINES), 0, d); header = new BaseXCheckBox(FIRST_LINE_HEADER, props.is(ParserProp.HEADER), 0, d); separator = new BaseXBack().layout(new TableLayout(1, 2, 6, 0)); final StringList sl = new StringList(); sl.add(CSVParser.SEPARATORS).add(""); sepcombo = new BaseXCombo(d, sl.toArray()); separator.add(sepcombo); String f = ""; final String s = props.get(ParserProp.SEPARATOR); if(Token.eq(s, CSVParser.SEPARATORS)) { sepcombo.setSelectedItem(s); } else { sepcombo.setSelectedIndex(CSVParser.SEPARATORS.length); final int ch = Token.toInt(s); f = ch > 0 ? String.valueOf((char) ch) : ""; } sepchar = new BaseXTextField(f, d); separator.add(sepchar); BaseXLayout.setWidth(sepchar, 35); final String enc = props.get(ParserProp.ENCODING); cencoding = DialogExport.encoding(d, enc); tencoding = DialogExport.encoding(d, enc); jencoding = DialogExport.encoding(d, enc); xmlopts = new BaseXBack(new TableLayout(9, 1)); htmlopts = new BaseXBack(new TableLayout(2, 1, 0, 8)); jsonopts = new BaseXBack(new TableLayout(2, 1, 0, 8)); csvopts = new BaseXBack(new TableLayout(2, 1, 0, 8)); textopts = new BaseXBack(new TableLayout(2, 1, 0, 8)); createOptionsPanels(); setLayout(new TableLayout(1, 1)); add(main); } /** * Options panels. */ private void createOptionsPanels() { xmlopts.add(intparse); xmlopts.add(new BaseXLabel(H_INT_PARSER, true, false)); xmlopts.add(dtd); xmlopts.add(stripNS); xmlopts.add(chopWS); xmlopts.add(new BaseXLabel(H_CHOP_WS, false, false).border(0, 0, 8, 0)); xmlopts.add(new BaseXLabel()); // catalog resolver final boolean rsen = CatalogWrapper.available(); final BaseXBack fl = new BaseXBack(new TableLayout(2, 2, 8, 0)); usecat.setEnabled(rsen); fl.add(usecat); fl.add(new BaseXLabel()); cfile.setEnabled(rsen); fl.add(cfile); browsec.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { catchoose(); } }); browsec.setEnabled(rsen); fl.add(browsec); xmlopts.add(fl); if(!rsen) { final BaseXBack rs = new BaseXBack(new TableLayout(2, 1)); rs.add(new BaseXLabel(HELP1_USE_CATALOG).color(GUIConstants.DGRAY)); rs.add(new BaseXLabel(HELP2_USE_CATALOG).color(GUIConstants.DGRAY)); xmlopts.add(rs); } final boolean avl = HTMLParser.available(); htmlopts.add(new BaseXLabel(avl ? H_HTML_PARSER : H_NO_HTML_PARSER)); if(avl) { final BaseXBack p = new BaseXBack(new TableLayout(1, 2, 8, 0)); p.add(new BaseXLabel(PARAMETERS + COL, true, true)); p.add(params); htmlopts.add(p); } BaseXBack p = new BaseXBack(new TableLayout(1, 2, 8, 0)); p.add(new BaseXLabel(ENCODING + COL, true, true)); p.add(jencoding); jsonopts.add(p); jsonopts.add(jsonml); p = new BaseXBack(new TableLayout(2, 2, 8, 4)); p.add(new BaseXLabel(ENCODING + COL, true, true)); p.add(cencoding); p.add(new BaseXLabel(SEPARATOR, true, true)); p.add(separator); csvopts.add(p); csvopts.add(header); p = new BaseXBack(new TableLayout(1, 2, 8, 4)); p.add(new BaseXLabel(ENCODING + COL, true, true)); p.add(tencoding); textopts.add(p); textopts.add(lines); final boolean ip = intparse.isSelected(); final boolean uc = usecat.isSelected(); intparse.setEnabled(!uc); usecat.setEnabled(!ip && CatalogWrapper.available()); cfile.setEnabled(uc); browsec.setEnabled(uc); } /** * Opens a file dialog to choose an XML catalog or directory. */ void catchoose() { final GUIProp gprop = gui.gprop; final BaseXFileChooser fc = new BaseXFileChooser(FILE_OR_DIR, gprop.get(GUIProp.INPUTPATH), gui).filter(XML_DOCUMENTS, IO.XMLSUFFIX); final IO file = fc.select(Mode.FDOPEN); if(file != null) cfile.setText(file.path()); } /** * Updates the options, depending on the specific type. * @param type parsing type */ void updateType(final String type) { label.setText(Util.info(PARSER_X, type.toUpperCase(Locale.ENGLISH))); if(type.equals(DataText.M_XML)) { parseropts = xmlopts; } else if(type.equals(DataText.M_HTML)) { parseropts = htmlopts; } else if(type.equals(DataText.M_JSON)) { parseropts = jsonopts; } else if(type.equals(DataText.M_CSV)) { parseropts = csvopts; } else if(type.equals(DataText.M_TEXT)) { parseropts = textopts; } main.removeAll(); main.add(label); if(parseropts != null) main.add(parseropts); main.revalidate(); tabs.setEnabledAt(1, !type.equals(DataText.M_RAW)); } /** * Reacts on user input. * @return result of check */ boolean action() { final boolean ip = intparse.isSelected(); final boolean uc = usecat.isSelected(); intparse.setEnabled(!uc); usecat.setEnabled(!ip && CatalogWrapper.available()); cfile.setEnabled(uc); browsec.setEnabled(uc); final int s = sepcombo.getSelectedIndex(); final boolean customsep = s == CSVParser.SEPARATORS.length; sepchar.setEnabled(customsep); return !customsep || sepchar.getText().length() == 1; } /** * Sets the parsing options. * @param type parsing type */ public void setOptions(final String type) { final BaseXCombo cb = type.equals(DataText.M_TEXT) ? tencoding : type.equals(DataText.M_JSON) ? jencoding : cencoding; props.set(ParserProp.ENCODING, cb.getSelectedItem().toString()); props.set(ParserProp.HEADER, header.isSelected()); props.set(ParserProp.LINES, lines.isSelected()); props.set(ParserProp.JSONML, jsonml.isSelected()); props.set(ParserProp.SEPARATOR, sepcombo.getSelectedIndex() < CSVParser.SEPARATORS.length ? sepcombo.getSelectedItem().toString() : String.valueOf((int) sepchar.getText().charAt(0))); gui.set(Prop.PARSER, type); gui.set(Prop.PARSEROPT, props.toString()); gui.set(Prop.CHOP, chopWS.isSelected()); gui.set(Prop.STRIPNS, stripNS.isSelected()); gui.set(Prop.DTD, dtd.isSelected()); gui.set(Prop.INTPARSE, intparse.isSelected()); gui.set(Prop.CATFILE, usecat.isSelected() ? cfile.getText() : ""); gui.set(Prop.HTMLOPT, params.getText()); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/dialog/DialogPass.java000066400000000000000000000033141222453003200261140ustar00rootroot00000000000000package org.basex.gui.dialog; import static org.basex.core.Text.*; import java.awt.*; import org.basex.gui.*; import org.basex.gui.GUIConstants.Msg; import org.basex.gui.layout.*; import org.basex.util.*; /** * Password dialog. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DialogPass extends BaseXDialog { /** New password. */ private final BaseXPassword pass; /** Buttons. */ private final BaseXBack buttons; /** Info label. */ private final BaseXLabel info; /** * Default constructor creating invisible frame as main window. */ public DialogPass() { this(null); } /** * Default constructor. * @param main reference to the main window */ DialogPass(final GUI main) { super(main, ALTER_PW); pass = new BaseXPassword(this); pass.addKeyListener(keys); info = new BaseXLabel(" "); final BaseXBack p = new BaseXBack(new BorderLayout(0, 8)); p.add(pass, BorderLayout.NORTH); p.add(info, BorderLayout.CENTER); set(p, BorderLayout.CENTER); buttons = newButtons(B_OK, B_CANCEL); set(buttons, BorderLayout.SOUTH); action(null); finish(null); } @Override public void action(final Object cmp) { final String nm = pass(); ok = !nm.isEmpty() && nm.matches("[^ ;'\"]*"); info.setText(ok || nm.isEmpty() ? null : Util.info(INVALID_X, PASSWORD), Msg.ERROR); enableOK(buttons, B_OK, ok); } @Override public void close() { if(!ok) return; super.close(); } /** * Returns the password. * @return password */ public String pass() { return new String(pass.getPassword()); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/dialog/DialogPrefs.java000066400000000000000000000145201222453003200262660ustar00rootroot00000000000000package org.basex.gui.dialog; import static org.basex.core.Text.*; import java.awt.*; import java.awt.event.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.gui.*; import org.basex.gui.layout.*; import org.basex.gui.layout.BaseXFileChooser.Mode; import org.basex.gui.view.*; import org.basex.io.*; /** * Dialog window for changing some project's preferences. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DialogPrefs extends BaseXDialog { /** Information on available languages. */ private static final int[] HITS = { 10, 25, 100, 250, 1000, 2500, 10000, 25000, 100000, 250000, 1000000, -1 }; /** Information on available languages. */ private static final String[][] LANGS = Lang.parse(); /** Directory path. */ final BaseXTextField path; /** Number of hits. */ final BaseXSlider limit; /** Label for number of hits. */ final BaseXLabel label; /** Language label. */ private final BaseXLabel creds; /** Language combobox. */ private final BaseXCombo lang; /** Focus checkbox. */ private final BaseXCheckBox focus; /** Show names checkbox. */ private final BaseXCheckBox names; /** Simple file dialog checkbox. */ private final BaseXCheckBox simpfd; /** Simple file dialog checkbox. */ private final BaseXCheckBox javalook; /** Old value for show names flag. */ private final boolean oldShowNames; /** * Default constructor. * @param main reference to the main window */ public DialogPrefs(final GUI main) { super(main, PREFERENCES); // create checkboxes final BaseXBack pp = new BaseXBack(new TableLayout(12, 1)); pp.add(new BaseXLabel(DATABASE_PATH + COL, true, true)); BaseXBack p = new BaseXBack(new TableLayout(1, 2, 8, 0)); final MainProp mprop = gui.context.mprop; final GUIProp gprop = gui.gprop; path = new BaseXTextField(mprop.dbpath().path(), this); final BaseXButton button = new BaseXButton(BROWSE_D, this); button.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final IOFile file = new BaseXFileChooser(CHOOSE_DIR, path.getText(), gui).select(Mode.DOPEN); if(file != null) path.setText(file.dirPath()); } }); p.add(path); p.add(button); pp.add(p); pp.add(new BaseXLabel(GUI_INTERACTIONS + COL, true, true).border(12, 0, 6, 0)); // checkbox for Java look and feel javalook = new BaseXCheckBox(JAVA_LF, gprop.is(GUIProp.JAVALOOK), this); pp.add(javalook); // checkbox for realtime mouse focus focus = new BaseXCheckBox(RT_FOCUS, gprop.is(GUIProp.MOUSEFOCUS), this); pp.add(focus); // checkbox for simple file dialog simpfd = new BaseXCheckBox(SIMPLE_FILE_CHOOSER, gprop.is(GUIProp.SIMPLEFD), this); pp.add(simpfd); // enable only if current document contains name attributes final boolean sn = gprop.is(GUIProp.SHOWNAME); names = new BaseXCheckBox(SHOW_NAME_ATTS, sn, 6, this); final Data data = gui.context.data(); names.setEnabled(data != null && ViewData.nameID(data) != 0); oldShowNames = sn; pp.add(names); // maximum number of hits to be displayed final int mh = hitsForSlider(); limit = new BaseXSlider(0, HITS.length - 1, mh, this, new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { action(limit); } }); label = new BaseXLabel(" "); p = new BaseXBack(new TableLayout(1, 4, 12, 0)); p.add(new BaseXLabel(MAX_NO_OF_HITS + COL)); p.add(limit); p.add(label); pp.add(p); // checkbox for simple file dialog pp.add(new BaseXLabel(LANGUAGE_RESTART + COL, true, true).border(16, 0, 6, 0)); lang = new BaseXCombo(this, LANGS[0]); lang.setSelectedItem(mprop.get(MainProp.LANG)); creds = new BaseXLabel(" "); p = new BaseXBack(new TableLayout(1, 2, 12, 0)); p.add(lang); p.add(creds); pp.add(p); set(pp, BorderLayout.CENTER); set(okCancel(), BorderLayout.SOUTH); action(null); finish(null); } @Override public void action(final Object cmp) { creds.setText(TRANSLATION + COLS + creds(lang.getSelectedItem().toString())); if(cmp == names) { gui.gprop.set(GUIProp.SHOWNAME, names.isSelected()); gui.notify.layout(); } final int mh = hitsAsProperty(); label.setText(mh == -1 ? ALL : Integer.toString(mh)); } @Override public void close() { final MainProp mprop = gui.context.mprop; mprop.set(MainProp.LANG, lang.getSelectedItem().toString()); // new database path: close existing database final String dbpath = path.getText(); if(!mprop.get(MainProp.DBPATH).equals(dbpath)) gui.execute(new Close()); mprop.set(MainProp.DBPATH, dbpath); mprop.write(); final int mh = hitsAsProperty(); gui.context.prop.set(Prop.MAXHITS, mh); final GUIProp gprop = gui.gprop; gprop.set(GUIProp.MOUSEFOCUS, focus.isSelected()); gprop.set(GUIProp.SIMPLEFD, simpfd.isSelected()); gprop.set(GUIProp.JAVALOOK, javalook.isSelected()); gprop.set(GUIProp.MAXHITS, mh); gprop.write(); dispose(); } @Override public void cancel() { final boolean sn = gui.gprop.is(GUIProp.SHOWNAME); gui.gprop.set(GUIProp.SHOWNAME, oldShowNames); if(sn != oldShowNames) gui.notify.layout(); super.cancel(); } /** * Returns the selected maximum number of hits as property value. * @return maximum number of hits */ private int hitsAsProperty() { return HITS[limit.value()]; } /** * Returns the selected maximum number of hits as slider value. * @return maximum number of hits */ private int hitsForSlider() { int mh = gui.gprop.num(Prop.MAXHITS); if(mh == -1) mh = Integer.MAX_VALUE; final int hl = HITS.length - 1; int h = -1; while(++h < hl && HITS[h] < mh); return h; } /** * Returns the translation credits for the specified language. * @param lng language * @return credits */ static String creds(final String lng) { for(int i = 0; i < LANGS[0].length; ++i) { if(LANGS[0][i].equals(lng)) return LANGS[1][i]; } return ""; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/dialog/DialogProgress.java000066400000000000000000000140011222453003200270050ustar00rootroot00000000000000package org.basex.gui.dialog; import static org.basex.core.Text.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import org.basex.core.*; import org.basex.gui.*; import org.basex.gui.layout.*; import org.basex.util.*; /** * Dialog window for displaying the progress of a command execution. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DialogProgress extends BaseXDialog implements ActionListener { /** Maximum value of progress bar. */ private static final int MAX = 600; /** Refresh action. */ private final Timer timer = new Timer(100, this); /** Information label. */ private BaseXLabel info; /** Memory usage. */ private BaseXMem mem; /** Executed command. */ private Command command; /** Progress bar. */ private JProgressBar bar; /** * Default constructor. * @param main main window * @param cmd progress reference */ private DialogProgress(final GUI main, final Command cmd) { super(main, ""); init(main, cmd); } /** * Default constructor. * @param dialog dialog window * @param cmd progress reference */ private DialogProgress(final BaseXDialog dialog, final Command cmd) { super(dialog, ""); init(dialog, cmd); } /** * Initializes all components. * @param parent parent component * @param cmd progress reference */ private void init(final Component parent, final Command cmd) { info = new BaseXLabel(" ", true, true); set(info, BorderLayout.NORTH); if(cmd.supportsProg()) { bar = new JProgressBar(0, MAX); set(bar, BorderLayout.CENTER); } else { bar = null; } BaseXLayout.setWidth(info, MAX); final BaseXBack s = new BaseXBack(new BorderLayout()).border(10, 0, 0, 0); final BaseXBack m = new BaseXBack(new TableLayout(1, 2, 5, 0)); mem = new BaseXMem(this, false); m.add(new BaseXLabel(MEMUSED_C)); m.add(mem); s.add(m, BorderLayout.WEST); if(cmd.stoppable()) { final BaseXButton cancel = new BaseXButton(B_CANCEL, this); s.add(cancel, BorderLayout.EAST); } set(s, BorderLayout.SOUTH); command = cmd; timer.start(); pack(); setLocationRelativeTo(parent); } @Override public void cancel() { command.stop(); close(); } @Override public void close() { dispose(); } @Override public void dispose() { timer.stop(); super.dispose(); } @Override public void actionPerformed(final ActionEvent e) { setTitle(command.title()); final String detail = command.detail(); info.setText(detail.isEmpty() ? " " : detail); mem.repaint(); if(bar != null) bar.setValue((int) (command.progress() * MAX)); } /** * Runs the specified commands, decorated by a progress dialog, and * calls {@link BaseXDialog#action} if the dialog is closed. * @param dialog reference to the dialog window * @param cmds commands to be run */ public static void execute(final BaseXDialog dialog, final Command... cmds) { execute(dialog, null, cmds); } /** * Runs the specified commands, decorated by a progress dialog, and * calls {@link BaseXDialog#action} if the dialog is closed. * @param gui reference to the main window * @param cmds commands to be run */ public static void execute(final GUI gui, final Command... cmds) { execute(gui, null, null, cmds); } /** * Runs the specified commands, decorated by a progress dialog, and * calls {@link BaseXDialog#action} if the dialog is closed. * @param dialog reference to the calling dialog window * @param post post-processing step * @param cmds commands to be run */ public static void execute(final BaseXDialog dialog, final Runnable post, final Command... cmds) { execute(dialog.gui, dialog, post, cmds); } /** * Runs the specified commands, decorated by a progress dialog, and * calls {@link BaseXDialog#action} if the dialog is closed. * @param gui reference to the main window * @param dialog reference to the dialog window (may be {@code null}) * @param post post-processing step * @param cmds commands to be run */ public static void execute(final GUI gui, final BaseXDialog dialog, final Runnable post, final Command... cmds) { for(final Command cmd : cmds) { // reset views final boolean newData = cmd.newData(gui.context); if(newData) gui.notify.init(); // create wait dialog final DialogProgress wait = dialog != null ? new DialogProgress(dialog, cmd) : new DialogProgress(gui, cmd); // start command thread new Thread() { @Override public void run() { // execute command final Performance perf = new Performance(); gui.updating = cmd.updating(gui.context); boolean ok = true; String info; try { cmd.execute(gui.context); info = cmd.info(); } catch(final BaseXException ex) { ok = false; info = Util.message(ex); } finally { gui.updating = false; } // return status information final String time = perf.toString(); gui.info.setInfo(info, cmd, time, ok, true); gui.status.setText(Util.info(TIME_NEEDED_X, time)); // close progress window and show error if command failed wait.dispose(); if(!ok) BaseXDialog.error(gui, info.equals(INTERRUPTED) ? COMMAND_CANCELED : info); } }.start(); // show progress windows until being disposed wait.setVisible(true); // initialize views if database was closed before if(newData) gui.notify.init(); else if(cmd.updating(gui.context)) gui.notify.update(); } if(dialog != null) dialog.action(dialog); if(post != null) post.run(); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/dialog/DialogProps.java000066400000000000000000000200661222453003200263140ustar00rootroot00000000000000package org.basex.gui.dialog; import static org.basex.core.Text.*; import static org.basex.gui.GUIConstants.*; import java.awt.*; import javax.swing.event.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.gui.*; import org.basex.gui.editor.*; import org.basex.gui.layout.*; import org.basex.index.*; import org.basex.util.*; import org.basex.util.list.*; /** * Database properties dialog. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DialogProps extends BaseXDialog { /** Index types. */ static final String[] HELP = { "", "", H_PATH_INDEX, H_TEXT_INDEX, H_ATTR_INDEX, "" }; /** Index types. */ static final IndexType[] TYPES = { IndexType.TAG, IndexType.ATTNAME, IndexType.PATH, IndexType.TEXT, IndexType.ATTRIBUTE, IndexType.FULLTEXT }; /** Label strings. */ private static final String[] LABELS = { ELEMENTS, ATTRIBUTES, PATH_INDEX, TEXT_INDEX, ATTRIBUTE_INDEX, FULLTEXT_INDEX }; /** Full-text tab. */ final BaseXBack tabFT; /** Name tab. */ final BaseXBack tabNames; /** Name tab. */ final BaseXBack tabPath; /** Name tab. */ final BaseXBack tabValues; /** Contains the panels that are currently being updated. */ final IntList updated = new IntList(); /** Tabbed pane. */ final BaseXTabs tabs; /** Resource panel. */ final DialogResources resources; /** Add panel. */ final DialogAdd add; /** Index information. */ final Editor[] infos = new Editor[LABELS.length]; /** Index labels. */ private final BaseXLabel[] labels = new BaseXLabel[LABELS.length]; /** Index buttons. */ private final BaseXButton[] indxs = new BaseXButton[LABELS.length]; /** Index panels. */ private final BaseXBack[] panels = new BaseXBack[LABELS.length]; /** Editable full-text options. */ private final DialogFT ft; /** * Default constructor. * @param main reference to the main window */ public DialogProps(final GUI main) { super(main, DB_PROPS); main.setCursor(CURSORWAIT); panel.setLayout(new BorderLayout(5, 0)); // resource tree resources = new DialogResources(this); // tab: resources add = new DialogAdd(this); ft = new DialogFT(this, false); final BaseXBack tabRes = add.border(8); final Data data = main.context.data(); for(int i = 0; i < LABELS.length; ++i) { labels[i] = new BaseXLabel(LABELS[i]).large(); panels[i] = new BaseXBack(new BorderLayout(0, 4)); infos[i] = new Editor(false, this, Token.token(PLEASE_WAIT_D)); BaseXLayout.setHeight(infos[i], 200); if(i != 1) { indxs[i] = new BaseXButton(" ", this); indxs[i].setEnabled(!data.inMemory()); } } // tab: name indexes tabNames = new BaseXBack(new GridLayout(2, 1, 0, 8)).border(8); add(0, tabNames, null); add(1, tabNames, null); // tab: path index tabPath = new BaseXBack(new GridLayout(1, 1)).border(8); add(2, tabPath, null); // tab: value indexes tabValues = new BaseXBack(new GridLayout(2, 1, 0, 8)).border(8); add(3, tabValues, null); add(4, tabValues, null); // tab: full-text index tabFT = new BaseXBack(new GridLayout(1, 1)).border(8); add(5, tabFT, null); // tab: database info final BaseXBack tabGeneral = new BaseXBack(new BorderLayout(0, 8)).border(8); final Font f = tabGeneral.getFont(); final BaseXLabel doc = new BaseXLabel(data.meta.name).border(0, 0, 6, 0).large(); BaseXLayout.setWidth(doc, 400); tabGeneral.add(doc, BorderLayout.NORTH); final String db = InfoDB.db(data.meta, true, false, true); final TokenBuilder info = new TokenBuilder(db); if(data.nspaces.size() != 0) { info.bold().add(NL + NAMESPACES + NL).norm().add(data.nspaces.info()); } final Editor text = new Editor(false, this, info.finish()); text.setFont(f); BaseXLayout.setHeight(text, 200); tabGeneral.add(new SearchEditor(main, text), BorderLayout.CENTER); tabs = new BaseXTabs(this); tabs.addTab(RESOURCES, tabRes); tabs.addTab(NAMES, tabNames); tabs.addTab(PATH_INDEX, tabPath); tabs.addTab(INDEXES, tabValues); tabs.addTab(FULLTEXT, tabFT); tabs.addTab(GENERAL, tabGeneral); tabs.addChangeListener(new ChangeListener() { @Override public synchronized void stateChanged(final ChangeEvent evt) { updateInfo(); } }); set(resources, BorderLayout.WEST); set(tabs, BorderLayout.CENTER); action(this); setResizable(true); setMinimumSize(getPreferredSize()); main.setCursor(CURSORARROW); finish(null); } /** * Updates the currently visible index panel. */ synchronized void updateInfo() { final Object o = tabs.getSelectedComponent(); final IntList il = new IntList(); if(o == tabNames) { il.add(0); il.add(1); } else if(o == tabPath) { il.add(2); } else if(o == tabValues) { il.add(3); il.add(4); } else if(o == tabFT) { il.add(5); } final Data data = gui.context.data(); final boolean[] val = { true, true, true, data.meta.textindex, data.meta.attrindex, data.meta.ftxtindex }; for(int i = 0; i < il.size(); i++) { final int idx = il.get(i); if(updated.contains(idx)) continue; updated.add(idx); new Thread() { @Override public void run() { infos[idx].setText(val[idx] ? data.info(TYPES[idx]) : Token.token(HELP[idx])); updated.delete(idx); } }.start(); } } /** * Adds index information to the specified panel and tab. * @param i index offset * @param tab panel tab * @param info optional info to display */ private void add(final int i, final BaseXBack tab, final BaseXBack info) { final BaseXBack idx = new BaseXBack(new BorderLayout(8, 0)); idx.add(labels[i], BorderLayout.WEST); if(indxs[i] != null) idx.add(indxs[i], BorderLayout.EAST); panels[i].add(idx, BorderLayout.NORTH); final BaseXBack b = info != null ? info : new SearchEditor(gui, infos[i]); panels[i].add(b, BorderLayout.CENTER); tab.add(panels[i]); } @Override public void action(final Object cmp) { if(cmp != null) { for(int i = 0; i < LABELS.length; i++) { if(cmp != indxs[i]) continue; final String label = indxs[i].getText(); final Command cmd; if(label.equals(OPTIMIZE + DOTS)) { cmd = new Optimize(); } else if(label.equals(DROP + DOTS)) { cmd = new DropIndex(TYPES[i]); } else { cmd = new CreateIndex(TYPES[i]); ft.setOptions(); } infos[i].setText(Token.token(PLEASE_WAIT_D)); DialogProgress.execute(this, cmd); return; } } resources.action(cmp); add.action(cmp); final Data data = gui.context.data(); final boolean[] val = { true, true, true, data.meta.textindex, data.meta.attrindex, data.meta.ftxtindex }; if(cmp == this) { final boolean utd = data.meta.uptodate; for(int i = 0; i < LABELS.length; ++i) { // structural index/statistics? final boolean struct = i < 3; String lbl = LABELS[i]; if(struct && !utd) lbl += " (" + OUT_OF_DATE + ')'; // updates labels and infos labels[i].setText(lbl); // update button (label, disable/enable) if(indxs[i] != null) { indxs[i].setText((struct ? OPTIMIZE : val[i] ? DROP : CREATE) + DOTS); if(struct) indxs[i].setEnabled(!utd); } } // full-text options final int f = 5; tabFT.removeAll(); panels[f].removeAll(); add(f, tabFT, val[f] ? null : ft); panels[f].revalidate(); panels[f].repaint(); updateInfo(); } ft.action(true); } @Override public void close() { super.close(); ft.setOptions(); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/dialog/DialogResources.java000066400000000000000000000230311222453003200271560ustar00rootroot00000000000000package org.basex.gui.dialog; import static org.basex.core.Text.*; import static org.basex.gui.GUIConstants.*; import static org.basex.util.Token.*; import java.awt.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.tree.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.gui.*; import org.basex.gui.layout.*; import org.basex.gui.layout.TreeNode; /** * Combination of a JTree and a text field. The tree visualizes the database * content including raw files and documents. The search field allows to * quickly access specific files/documents. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public class DialogResources extends BaseXBack { /** Search text field. */ final BaseXTextField filterText; /** Database/root node. */ final TreeFolder root; /** Dialog reference. */ final BaseXDialog dialog; /** Resource tree. */ final BaseXTree tree; /** Filter button. */ final BaseXButton filter; /** Clear button. */ final BaseXButton clear; /** Avoids superfluous filtering steps. */ boolean filtered; /** * Constructor. * @param dp dialog reference */ DialogResources(final DialogProps dp) { setLayout(new BorderLayout(0, 5)); dialog = dp; // init tree - additional root node necessary to bypass // the egg/chicken dilemma final DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode(); tree = new BaseXTree(rootNode, dp).border(4, 4, 4, 4); tree.setRootVisible(false); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); final ImageIcon xml = BaseXLayout.icon("file_xml"); final ImageIcon raw = BaseXLayout.icon("file_raw"); tree.setCellRenderer(new TreeNodeRenderer(xml, raw)); tree.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(final TreeSelectionEvent e) { TreeNode n = (TreeNode) e.getPath().getLastPathComponent(); String filt = n.equals(root) ? "" : n.path(); String trgt = filt + '/'; if(n.isLeaf()) { n = (TreeNode) n.getParent(); trgt = (n == null || n.equals(root) ? "" : n.path()) + '/'; } else { filt = trgt; } filterText.setText(filt); dp.add.target.setText(trgt); filtered = false; } }); // add default children to tree final Data data = dp.gui.context.data(); final String label = data.meta.name + " (/)"; root = new TreeRootFolder(token(label), token("/"), tree, data); ((DefaultTreeModel) tree.getModel()).insertNodeInto(root, rootNode, 0); filter = new BaseXButton(FILTER, dp); clear = new BaseXButton(CLEAR, dp); filter.setEnabled(false); clear.setEnabled(false); // popup menu for node interaction new BaseXPopup(tree, dp.gui, new DeleteCmd(), new RenameCmd()); // button panel final BaseXBack buttons = new BaseXBack(); buttons.add(filter); buttons.add(clear); final BaseXBack btn = new BaseXBack().layout(new BorderLayout()); btn.add(buttons, BorderLayout.EAST); filterText = new BaseXTextField(PLEASE_WAIT_D, dp); filterText.setEnabled(false); BaseXLayout.setWidth(filterText, 250); // left panel final BaseXBack panel = new BaseXBack(new BorderLayout()); panel.add(filterText, BorderLayout.CENTER); panel.add(btn, BorderLayout.SOUTH); final JScrollPane sp = new JScrollPane(tree); BaseXLayout.setWidth(sp, 250); add(sp, BorderLayout.CENTER); add(panel, BorderLayout.SOUTH); new Thread() { @Override public void run() { tree.setCursor(CURSORWAIT); tree.expandPath(new TreePath(root.getPath())); filterText.setText("/"); filterText.setEnabled(true); tree.setCursor(CURSORARROW); filter.setEnabled(true); clear.setEnabled(true); } }.start(); } /** * Returns the current tree node selection. * @return selected node */ TreeNode selection() { final TreePath t = tree.getSelectionPath(); return t == null ? null : (TreeNode) t.getLastPathComponent(); } /** * Refreshes the given folder node. Removes all its children and reloads * it afterwards. * @param n folder */ private void refreshFolder(final TreeFolder n) { if(n == null) return; n.removeChildren(); final TreePath path = new TreePath(n.getPath()); tree.collapsePath(path); tree.expandPath(path); } /** * Reacts on user input. * @param comp the action component */ void action(final Object comp) { if(comp == filter && !filtered) { filter(); filtered = true; } else if(comp == clear) { filterText.setText("/"); filterText.requestFocus(); refreshFolder(root); filtered = false; } } /** * Searches the tree for nodes that match the given search text. */ private void filter() { final byte[] filterPath = TreeNode.preparePath(token(filterText.getText())); if(eq(filterPath, SLASH)) { refreshFolder(root); return; } final Data data = dialog.gui.context.data(); // clear tree to append filtered nodes root.removeAllChildren(); int cmax = TreeFolder.MAXC; // check if there's a directory // create a folder if there's either a raw or document folder if(data.resources.isDir(filterPath)) { root.add(new TreeFolder(TreeFolder.name(filterPath), TreeFolder.path(filterPath), tree, data)); cmax--; } // now add the actual files (if there are any) final byte[] name = TreeFolder.name(filterPath); final byte[] sub = TreeFolder.path(filterPath); final TreeFolder f = new TreeFolder(TreeFolder.name(sub), TreeFolder.path(sub), tree, data); cmax = f.addLeaves(name, cmax, root); // add dummy node if maximum number of nodes is exceeded if(cmax <= 0) root.add(new TreeLeaf(token(DOTS), sub, false, true, tree, data)); ((DefaultTreeModel) tree.getModel()).nodeStructureChanged(root); } /** * Expands the tree after a node with the given path has been inserted. * Due to lazy evaluation of the tree inserted documents/files are only * added to the tree after the parent folder has been reloaded. * @param p path of new node */ void refreshNewFolder(final String p) { final byte[][] pathComp = split(token(p), '/'); TreeNode n = root; for(final byte[] c : pathComp) { // make sure folder is reloaded if(n instanceof TreeFolder) ((TreeFolder) n).reload(); // find next child to continue with for(int i = 0; i < n.getChildCount(); i++) { final TreeNode ch = (TreeNode) n.getChildAt(i); if(eq(ch.name, c)) { // continue with the child if path component matches n = ch; break; } } } refreshFolder(n instanceof TreeFolder ? (TreeFolder) n : (TreeFolder) n.getParent()); } /** * Custom tree cell renderer to distinguish between raw and xml leaf nodes. * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ private static final class TreeNodeRenderer extends DefaultTreeCellRenderer { /** Icon for xml files. */ private final Icon xmlIcon; /** Icon for raw files. */ private final Icon rawIcon; /** * Constructor. * @param xml xml icon * @param raw raw icon */ TreeNodeRenderer(final Icon xml, final Icon raw) { xmlIcon = xml; rawIcon = raw; } @Override public Component getTreeCellRendererComponent(final JTree tree, final Object val, final boolean sel, final boolean exp, final boolean leaf, final int row, final boolean focus) { super.getTreeCellRendererComponent(tree, val, sel, exp, leaf, row, focus); if(leaf) { final TreeLeaf l = (TreeLeaf) val; setIcon(l.raw ? rawIcon : l.abbr ? null : xmlIcon); } return this; } } /** Delete command. */ final class DeleteCmd extends GUIBaseCmd { @Override public void execute(final GUI g) { final TreeNode n = selection(); if(n == null || !BaseXDialog.confirm(dialog.gui, DELETE_NODES)) return; final Runnable run = new Runnable() { @Override public void run() { refreshNewFolder(n.path()); } }; DialogProgress.execute(dialog, run, new Delete(n.path())); } @Override public String label() { return DELETE + DOTS; } @Override public void refresh(final GUI gui, final AbstractButton button) { final TreeNode n = selection(); if(n instanceof TreeLeaf) button.setEnabled(!((TreeLeaf) n).abbr); else button.setEnabled(n != null && !n.equals(root)); } } /** Rename command. */ final class RenameCmd extends GUIBaseCmd { @Override public void execute(final GUI g) { final TreeNode n = selection(); if(n == null) return; final DialogInput d = new DialogInput(n.path(), RENAME, dialog, 0); if(!d.ok()) return; final String p = string(TreeNode.preparePath(token(d.input()))); final Runnable run = new Runnable() { @Override public void run() { refreshNewFolder(p); } }; DialogProgress.execute(dialog, run, new Rename(n.path(), p)); } @Override public String label() { return RENAME + DOTS; } @Override public void refresh(final GUI gui, final AbstractButton button) { final TreeNode n = selection(); if(n instanceof TreeLeaf) button.setEnabled(!((TreeLeaf) n).abbr); else button.setEnabled(n != null && !n.equals(root)); } } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/dialog/DialogServer.java000066400000000000000000000346371222453003200264700ustar00rootroot00000000000000package org.basex.gui.dialog; import static org.basex.core.Text.*; import static org.basex.gui.GUIConstants.*; import java.awt.*; import java.awt.event.*; import java.io.*; import javax.swing.event.*; import org.basex.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.gui.*; import org.basex.gui.GUIConstants.Msg; import org.basex.gui.editor.*; import org.basex.gui.layout.*; import org.basex.io.*; import org.basex.server.*; import org.basex.util.*; import org.basex.util.list.*; /** * Dialog window for displaying information about the server. * * @author BaseX Team 2005-12, BSD License * @author Andreas Weiler */ public final class DialogServer extends BaseXDialog { /** Password textfield. */ private final BaseXPassword admpass; /** Tabulators. */ final BaseXTabs tabs; /** User panel. */ final DialogUser user = new DialogUser(true, this); /** Databases panel. */ final DialogUser dbsP = new DialogUser(false, this); /** Databases panel. */ final BaseXBack databases = dbsP.getTablePanel(); /** Sessions/Databases panel. */ final BaseXBack sess = new BaseXBack(); /** Log panel. */ final BaseXBack logs = new BaseXBack(); /** Username textfield. */ final BaseXTextField admuser; /** Disconnect button. */ final BaseXButton disconnect; /** Refresh button. */ final BaseXButton refreshSess; /** Connect button. */ final BaseXButton connect; /** Start button. */ final BaseXButton start; /** Indicates which tab is activated. */ int tab; /** Context. */ private final Context ctx = gui.context; /** Updates log file. */ private final BaseXButton refreshLog; /** Stop button. */ private final BaseXButton stop; /** Deletes log file. */ private final BaseXButton delete; /** Deletes all log files. */ private final BaseXButton deleteAll; /** Server host. */ private final BaseXTextField host; /** Local server port. */ private final BaseXTextField ports; /** Server port. */ private final BaseXTextField portc; /** Current sessions. */ private final Editor sese; /** Log text. */ private final Editor logt; /** Info label. */ private final BaseXLabel infoC; /** Info label. */ private final BaseXLabel infoL; /** Combobox for log files. */ private final BaseXCombo logc; /** String for log dir. */ private final IOFile logd = ctx.mprop.dbpath(".logs"); /** ClientSession. */ private ClientSession cs; /** Boolean for check is server is running. */ private boolean running; /** Boolean for check if client is connected. */ private boolean connected; /** * Default constructor. * @param main reference to the main window */ public DialogServer(final GUI main) { super(main, S_SERVER_ADMIN); databases.border(8); // connection tab final BaseXBack conn = new BaseXBack(new BorderLayout(0, 32)).border(8); start = new BaseXButton(START, this); stop = new BaseXButton(STOP, this); connect = new BaseXButton(CONNECT, this); disconnect = new BaseXButton(DISCONNECT, this); final GUIProp gprop = gui.gprop; host = new BaseXTextField(gprop.get(GUIProp.S_HOST), this); ports = new BaseXTextField(Integer.toString(gprop.num(GUIProp.S_SERVERPORT)), this); portc = new BaseXTextField(Integer.toString(gprop.num(GUIProp.S_PORT)), this); admuser = new BaseXTextField(gprop.get(GUIProp.S_USER), this); admpass = new BaseXPassword(this); infoC = new BaseXLabel(" ").border(12, 0, 0, 0); // local server panel BaseXBack p = new BaseXBack(new TableLayout(6, 1, 0, 0)); p.add(new BaseXLabel(S_LOCALSERVER + COLS, true, true)); BaseXBack pp = new BaseXBack(new TableLayout(2, 2, 8, 4)).border(0, 0, 0, 0); pp.add(new BaseXLabel(S_PORT + COLS)); pp.add(ports); pp.add(new BaseXLabel()); BaseXBack ppp = new BaseXBack(new TableLayout(1, 2, 5, 0)); ppp.add(start); ppp.add(stop); pp.add(ppp); p.add(pp); p.add(new BaseXLabel()); p.add(new BaseXLabel(S_ADLOGIN + COLS, true, true).border(12, 0, 6, 0)); // login panel pp = new BaseXBack(new TableLayout(5, 2, 8, 4)); pp.add(new BaseXLabel(USERNAME + COLS)); pp.add(admuser); pp.add(new BaseXLabel(PASSWORD + COLS)); pp.add(admpass); pp.add(new BaseXLabel(S_HOST + COLS)); pp.add(host); pp.add(new BaseXLabel(S_PORT + COLS)); pp.add(portc); pp.add(new BaseXLabel()); ppp = new BaseXBack(new TableLayout(1, 2, 5, 0)); ppp.add(connect); ppp.add(disconnect); pp.add(ppp); p.add(pp); p.add(infoC); conn.add(p, BorderLayout.CENTER); p = new BaseXBack(new TableLayout(2, 1)); BaseXLabel l = new BaseXLabel(S_INFO1); l.setForeground(GUIConstants.DGRAY); p.add(l); l = new BaseXLabel(S_INFO2); l.setForeground(GUIConstants.DGRAY); p.add(l); conn.add(p, BorderLayout.SOUTH); // session tab sess.border(8).layout(new BorderLayout()); sese = new Editor(false, this); sese.setFont(start.getFont()); refreshSess = new BaseXButton(REFRESH, this); pp = new BaseXBack(new BorderLayout()); pp.add(new BaseXLabel(S_SESSIONS + COLS, false, true), BorderLayout.NORTH); pp.add(new SearchEditor(main, sese), BorderLayout.CENTER); p.add(pp); sess.add(pp, BorderLayout.CENTER); p = new BaseXBack(new BorderLayout(0, 0)); p.add(refreshSess, BorderLayout.EAST); sess.add(p, BorderLayout.SOUTH); // logging tab logs.border(8).layout(new BorderLayout()); delete = new BaseXButton(DELETE, this); deleteAll = new BaseXButton(DELETE_ALL, this); logc = new BaseXCombo(this); logt = new Editor(false, this); logt.setFont(start.getFont()); BaseXLayout.setHeight(logt, 100); logt.border(5); infoL = new BaseXLabel(" ").border(12, 0, 0, 0); refreshLog = new BaseXButton(REFRESH, this); p = new BaseXBack(new BorderLayout()); pp = new BaseXBack(); pp.add(logc); pp.add(delete); pp.add(deleteAll); p.add(pp, BorderLayout.WEST); logs.add(p, BorderLayout.NORTH); logs.add(new SearchEditor(main, logt), BorderLayout.CENTER); p = new BaseXBack(new BorderLayout(8, 0)); p.add(infoL, BorderLayout.WEST); p.add(refreshLog, BorderLayout.EAST); logs.add(p, BorderLayout.SOUTH); tabs = new BaseXTabs(this); tabs.add(S_CONNECT, conn); tabs.add(USERS, user); tabs.add(DATABASES, databases); tabs.add(S_SESSIONS, sess); tabs.add(S_LOCALLOGS, logs); set(tabs, BorderLayout.CENTER); // test if server is running running = ping(true); tabs.addChangeListener(new ChangeListener() { @Override public void stateChanged(final ChangeEvent evt) { final BaseXTabs pane = (BaseXTabs) evt.getSource(); tab = pane.getSelectedIndex(); final Object o = pane.getSelectedComponent(); if(o == logs) refreshLog(); if(o == user) action(user); if(o == databases) action(dbsP); if(o == sess) action(refreshSess); } }); // start server: when enter key is pressed, the server will be started final KeyAdapter startListener = new KeyAdapter() { @Override public void keyPressed(final KeyEvent key) { if(key.getKeyCode() == KeyEvent.VK_ENTER) action(start); } }; ports.addKeyListener(startListener); // admin login: when enter key is pressed the connect button will be clicked final KeyAdapter connListener = new KeyAdapter() { @Override public void keyPressed(final KeyEvent key) { if(key.getKeyCode() == KeyEvent.VK_ENTER) action(connect); } }; admuser.addKeyListener(connListener); admpass.addKeyListener(connListener); host.addKeyListener(connListener); portc.addKeyListener(connListener); refreshLog(); action(null); setResizable(true); finish(null); } /** * Checks if a server is running, ping like. * @param local local/remote flag * @return boolean success */ private boolean ping(final boolean local) { final GUIProp gprop = gui.gprop; return BaseXServer.ping(local ? LOCALHOST : gprop.get(GUIProp.S_HOST), gprop.num(local ? GUIProp.S_SERVERPORT : GUIProp.S_PORT)); } @Override public void action(final Object cmp) { Msg icon = Msg.SUCCESS; String msg = null; String msg2 = null; final boolean wait = cmp == start || cmp == stop || cmp == connect; if(wait) setCursor(CURSORWAIT); try { if(cmp == start) { try { final int p = Integer.parseInt(ports.getText()); gui.gprop.set(GUIProp.S_SERVERPORT, p); if(host.getText().equals(LOCALHOST)) { gui.gprop.set(GUIProp.S_PORT, p); gui.gprop.set(GUIProp.S_EVENTPORT, p + 1); portc.setText(String.valueOf(p)); } BaseXServer.start(p, "-p", Integer.toString(p), "-e", Integer.toString(p + 1)); msg = Util.info(SRV_STARTED_PORT_X, p); running = true; } catch(final BaseXException ex) { msg = Util.message(ex); icon = Msg.ERROR; } } else if(cmp == stop) { final int p = gui.gprop.num(GUIProp.S_SERVERPORT); if(running) BaseXServer.stop(p, gui.gprop.num(GUIProp.S_EVENTPORT)); running = ping(true); connected = connected && ping(false); if(!connected) msg = Util.info(SRV_STOPPED_PORT_X, p); if(!connected) setTitle(S_SERVER_ADMIN); } else if(cmp == connect) { final String pw = new String(admpass.getPassword()); final String us = admuser.getText(); final String hs = host.getText(); final int pc = Integer.parseInt(portc.getText()); gui.gprop.set(GUIProp.S_HOST, hs); gui.gprop.set(GUIProp.S_PORT, pc); gui.gprop.set(GUIProp.S_USER, us); gui.gprop.set(GUIProp.S_PASSWORD, pw); cs = new ClientSession(hs, pc, us, pw); user.setSess(cs); dbsP.setSess(cs); connected = true; setTitle(S_SERVER_ADMIN + LI + us + '@' + hs + COL + pc); msg = Util.info(S_CONNECTED, hs, pc); refreshSess(); disconnect.requestFocusInWindow(); } else if(cmp == disconnect) { cs.execute(new Exit()); connected = false; setTitle(S_SERVER_ADMIN); msg = S_DISCONNECTED; } else if(cmp == refreshSess) { refreshSess(); } else if(cmp == refreshLog || cmp == logc) { byte[] cont = Token.EMPTY; if(logc.getSelectedIndex() != -1) { final IOFile f = new IOFile(logd, logc.getSelectedItem().toString()); cont = f.read(); } logt.setText(cont); logt.scrollToEnd(); } else if(cmp == delete) { final IOFile f = new IOFile(logd, logc.getSelectedItem().toString()); if(f.delete()) { logc.setSelectedIndex(-1); refreshLog(); } else { msg2 = Util.info(FILE_NOT_DELETED_X, f.name()); icon = Msg.ERROR; } } else if(cmp == deleteAll) { IOFile file = null; for(int i = 0; i < logc.getItemCount(); ++i) { final IOFile f = new IOFile(logd, logc.getItemAt(i).toString()); if(!f.delete()) file = f; } if(file != null) { msg2 = Util.info(FILE_NOT_DELETED_X, file.name()); icon = Msg.ERROR; } logc.setSelectedIndex(-1); refreshLog(); } else if(connected) { if(tab == 1) user.action(cmp); if(tab == 2) dbsP.action(cmp); } } catch(final Exception ex) { icon = Msg.ERROR; msg = Util.message(ex); if(msg.equals(Util.info(PERM_REQUIRED_X, Perm.ADMIN))) { try { cs.execute(new Exit()); } catch(final IOException exx) { Util.stack(exx); } } } if(wait) setCursor(CURSORARROW); final boolean valp = portc.getText().matches("[\\d]+") && Integer.parseInt(portc.getText()) <= 65535; final boolean valpl = ports.getText().matches("[\\d]+") && Integer.parseInt(ports.getText()) <= 65535; final boolean vallu = Databases.validName(admuser.getText()); final boolean vallp = new String(admpass.getPassword()).matches("[^ ;'\"]*"); final boolean valh = host.getText().matches("([\\w]+://)?[\\w.-]+"); if(msg == null && msg2 == null && !(valpl && valh && valp && vallu && vallp)) { msg = Util.info(INVALID_X, !valpl ? S_LOCALPORT : !valh ? S_HOST : !valp ? S_PORT : !vallu ? USERNAME : PASSWORD); icon = Msg.WARN; } infoC.setText(msg, icon); infoL.setText(msg2, icon); ports.setEnabled(!running); start.setEnabled(!running && valpl); stop.setEnabled(running); admuser.setEnabled(!connected); admpass.setEnabled(!connected); host.setEnabled(!connected); portc.setEnabled(!connected); connect.setEnabled(!connected && vallu && vallp && valh && valp && !admuser.getText().isEmpty() && admpass.getPassword().length != 0); disconnect.setEnabled(connected); tabs.setEnabledAt(1, connected); tabs.setEnabledAt(2, connected); tabs.setEnabledAt(3, connected); tabs.setEnabledAt(4, running || logc.getItemCount() > 0); refreshLog.setEnabled(logc.getSelectedIndex() != -1); delete.setEnabled(logc.getSelectedIndex() != -1); deleteAll.setEnabled(logc.getItemCount() > 0); if(admuser.hasFocus()) connect.setEnabled(false); } /** * Fills sessions/databases panel. * @throws IOException I/O exception */ private void refreshSess() throws IOException { sese.setText(Token.token(cs.execute(new ShowSessions()))); } /** * Refreshes the log panel. */ void refreshLog() { logc.removeAllItems(); final StringList sl = new StringList(); for(final IOFile s : logd.children()) { final String name = s.name(); if(name.endsWith(".log")) sl.add(name); } for(final String s : sl.sort(false, false)) logc.addItem(s); action(refreshLog); } @Override public void cancel() { try { if(connected) cs.execute(new Exit()); } catch(final IOException ex) { Util.debug(ex); } super.cancel(); } @Override public void close() { if(ok) super.close(); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/dialog/DialogTreeOptions.java000066400000000000000000000025041222453003200274610ustar00rootroot00000000000000package org.basex.gui.dialog; import static org.basex.core.Text.*; import java.awt.*; import org.basex.gui.*; import org.basex.gui.layout.*; /** * Dialog window for specifying the TreeMap layout. * * @author BaseX Team 2005-12, BSD License * @author Wolfgang Miller */ public final class DialogTreeOptions extends BaseXDialog { /** Slim rectangles to text length. */ private final BaseXCheckBox slim; /** Show attributes. */ private final BaseXCheckBox atts; /** * Default constructor. * @param main reference to the main window */ public DialogTreeOptions(final GUI main) { super(main, TREE_OPTIONS, false); final BaseXBack p = new BaseXBack(new TableLayout(2, 1, 0, 8)); final GUIProp gprop = gui.gprop; // create checkbox slim = new BaseXCheckBox(ADJUST_NODES, gprop.is(GUIProp.TREESLIMS), this); p.add(slim); // create checkbox atts = new BaseXCheckBox(SHOW_ATTS, gprop.is(GUIProp.TREEATTS), this); p.add(atts); set(p, BorderLayout.CENTER); finish(gprop.nums(GUIProp.MAPLAYOUTLOC)); } @Override public void action(final Object cmp) { final GUIProp gprop = gui.gprop; gprop.set(GUIProp.TREESLIMS, slim.isSelected()); gprop.set(GUIProp.TREEATTS, atts.isSelected()); gui.notify.layout(); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/dialog/DialogUser.java000066400000000000000000000231651222453003200261320ustar00rootroot00000000000000package org.basex.gui.dialog; import static org.basex.core.Text.*; import java.awt.*; import java.io.*; import javax.swing.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.core.cmd.List; import org.basex.gui.GUIConstants.Msg; import org.basex.gui.layout.*; import org.basex.server.*; import org.basex.util.*; import org.basex.util.list.*; /** * Panel for displaying information about global/local users. * * @author BaseX Team 2005-12, BSD License * @author Andreas Weiler */ final class DialogUser extends BaseXBack { /** Session. */ private Session sess; /** Global user table. */ private Table users = new Table(); /** Create button. */ private final BaseXButton create; /** Alter button. */ private final BaseXButton alter; /** Delete button. */ private final BaseXButton drop; /** Add button. */ private final BaseXButton add; /** Username textfield. */ private final BaseXTextField user; /** Password textfield. */ private final BaseXPassword pass; /** User columns. */ private final BaseXCombo addUser; /** Databases. */ private final BaseXCombo databases; /** User table. */ private final BaseXTable table; /** Info label. */ private final BaseXLabel info; /** Flag global/local. */ private final boolean global; /** Dialog. */ private final DialogServer dia; /** Table panel. */ private final BaseXBack tablePanel; /** * Constructor. * @param g global/local flag * @param d dialog window */ DialogUser(final boolean g, final DialogServer d) { global = g; dia = d; layout(new TableLayout(7, 1, 0, 4)).border(8); user = new BaseXTextField("", dia); BaseXLayout.setWidth(user, 100); create = new BaseXButton(CREATE, dia); pass = new BaseXPassword(dia); BaseXLayout.setWidth(pass, 100); alter = new BaseXButton(S_ALTER, dia); drop = new BaseXButton(DROP + DOTS, dia); info = new BaseXLabel(" "); add(new BaseXLabel(S_CREATEU + COLS, false, true)); BaseXBack p = new BaseXBack(new TableLayout(1, 5, 8, 0)).border(0, 0, 6, 0); p.add(new BaseXLabel(USERNAME + COLS)); p.add(user); p.add(new BaseXLabel(PASSWORD + COLS)); p.add(pass); p.add(create); add(p); tablePanel = new BaseXBack(new BorderLayout(0, 5)); databases = new BaseXCombo(dia); BaseXLayout.setWidth(databases, 210); addUser = new BaseXCombo(dia); add = new BaseXButton(ADD, dia); BaseXLayout.setWidth(addUser, 131); if(!global) { p = new BaseXBack(new TableLayout(2, 3, 8, 2)); p.add(new BaseXLabel(DATABASES + COL, false, true)); p.add(new BaseXLabel(ADD + COL, false, true)); p.add(new BaseXLabel()); p.add(databases); p.add(addUser); p.add(add); tablePanel.add(p, BorderLayout.NORTH); } p = new BaseXBack(new TableLayout(2, 2, 8, 5)); p.add(new BaseXLabel(global ? S_GLOBPERM : S_LOCPERM, false, true)); p.add(new BaseXLabel()); table = new BaseXTable(users, dia); final JScrollPane sp = new JScrollPane(table); sp.setPreferredSize(new Dimension(350, 220)); p.add(sp); final BaseXBack pp = new BaseXBack(new TableLayout(2, 1, 0, 5)); if(global) pp.add(alter); pp.add(drop); p.add(pp); tablePanel.add(p, BorderLayout.CENTER); tablePanel.add(info, BorderLayout.SOUTH); add(tablePanel); action(null); } /** * Reacts on user input. * @param cmp calling component */ void action(final Object cmp) { boolean ok = true; String msg = null; try { final Object di = databases.getSelectedItem(); final String db = di == null ? null : di.toString(); if(cmp instanceof Object[]) { final Object[] o = (Object[]) cmp; final boolean g = o[0] == Boolean.TRUE; final Perm perm = Perm.values()[(Integer) o[2] - (g ? 0 : 1)]; final String uname = table.getModel().getValueAt((Integer) o[1], 0).toString(); final boolean confirm = !g && uname.equals(dia.admuser.getText()); if(confirm && !BaseXDialog.confirm(dia.gui, Util.info(S_DBREVOKE))) return; sess.execute(new Grant(perm, uname, db)); msg = sess.info(); if(confirm) { if(perm == Perm.ADMIN) { dia.tabs.setSelectedIndex(0); dia.action(dia.disconnect); } else { setSess(sess); } } else { setData(); } } else if(cmp == this) { setSess(sess); } else if(cmp == databases) { setData(); } else if(cmp == create) { final String u = user.getText(); final String p = Token.md5(new String(pass.getPassword())); sess.execute(new CreateUser(u, p)); msg = sess.info(); setData(); user.setText(""); pass.setText(""); user.requestFocusInWindow(); } else if(cmp == drop) { String msg2 = ""; final int[] rows = table.getSelectedRows(); if(BaseXDialog.confirm(dia.gui, Util.info(S_DRQUESTION, rows.length))) { for(final int r : rows) { sess.execute(new DropUser(table.data.value(r, 0), db)); if(msg == null) msg = sess.info(); else if(msg2.isEmpty()) msg2 = " (...)"; if(!ok) break; } msg += msg2; setData(); } } else if(cmp == alter) { final DialogPass dp = new DialogPass(dia.gui); if(dp.ok()) { sess.execute(new AlterUser(table.getValueAt( table.getSelectedRow(), 0).toString(), Token.md5(dp.pass()))); msg = sess.info(); } } else if(cmp == add) { final String us = addUser.getSelectedItem().toString(); for(int r = 0; r < users.contents.size(); ++r) { if(!users.value(r, 0).equals(us)) continue; int c = 3; while(--c >= 0 && users.value(r, c).isEmpty()); final String perm = Perm.values()[c].toString(); sess.execute(new Grant(perm, us, db)); msg = sess.info(); if(!ok) break; } setData(); addUser.requestFocusInWindow(); } } catch(final IOException ex) { msg = Util.message(ex); ok = false; } final boolean valname = Databases.validName(user.getText()); final boolean valpass = new String(pass.getPassword()).matches("[^ ;'\"]*"); boolean newname = true; for(int r = 0; r < users.contents.size(); ++r) newname &= !users.value(r, 0).equals(user.getText()); alter.setEnabled(table.getSelectedRows().length == 1); create.setEnabled(valname && valpass && newname && !user.getText().isEmpty() && pass.getPassword().length != 0); add.setEnabled(addUser.getSelectedIndex() > 0); addUser.setEnabled(addUser.getSelectedIndex() > -1); boolean valdrop = true; for(final int r : table.getSelectedRows()) { valdrop &= !table.data.value(r, 0).equals(ADMIN); } drop.setEnabled(valdrop && table.getSelectedRows().length > 0); valdrop |= table.getSelectedRows().length == 1; Msg icon = ok ? Msg.SUCCESS : Msg.ERROR; if(msg == null && !(valname && valpass && newname && valdrop)) { msg = !newname ? Util.info(USER_EXISTS_X, user.getText()) : !valdrop ? ADMIN_STATIC_X : Util.info(INVALID_X, !valname ? USERNAME : PASSWORD); icon = Msg.WARN; } info.setText(msg, icon); } /** * Sets new data. * @throws IOException I/O exception */ void setData() throws IOException { users = table(null); if(global) { table.update(users); } else { addUser.removeAllItems(); final int i = databases.getSelectedIndex(); if(i == 0) table.update(new Table()); if(i <= 0) return; final Table data = table(databases.getSelectedItem().toString()); table.update(data); final StringList added = new StringList(); for(final TokenList l : data.contents) added.add(Token.string(l.get(0))); final StringList adding = new StringList(); for(final TokenList l : users.contents) { final String s = Token.string(l.get(0)); if(!s.equals(ADMIN) && !added.contains(s)) adding.add(s); } addUser.addItem(numberof(USERS, adding.size())); for(final String s : adding) addUser.addItem(s); addUser.setSelectedIndex(0); } } /** * Returns a global or local user table. * @param db database (optional) * @return table * @throws IOException I/O exception */ private Table table(final String db) throws IOException { return new Table(sess.execute(new ShowUsers(db))); } /** * Sets session. * @param s session * @throws IOException I/O exception */ public void setSess(final Session s) throws IOException { sess = s; if(!global) { final Table dbs = new Table(sess.execute(new List())); databases.removeAllItems(); databases.addItem(numberof(DATABASES, dbs.contents.size())); for(final TokenList l : dbs.contents) { databases.addItem(Token.string(l.get(0))); } databases.setSelectedIndex(0); } setData(); } /** * Returns the first entry of combo boxes. * @param w what * @param n number * @return String */ private static String numberof(final String w, final int n) { return "(" + n + ' ' + w + ')'; } /** * Returns table panel. * @return BaseXBack */ public BaseXBack getTablePanel() { return tablePanel; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/dialog/package.html000066400000000000000000000000441222453003200255010ustar00rootroot00000000000000 GUI Dialog Windows. basex-7.7.2/basex-core/src/main/java/org/basex/gui/editor/000077500000000000000000000000001222453003200232515ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/gui/editor/Editor.java000066400000000000000000000600201222453003200253400ustar00rootroot00000000000000package org.basex.gui.editor; import static org.basex.core.Text.*; import static org.basex.gui.layout.BaseXKeys.*; import static org.basex.util.Token.*; import java.awt.*; import java.awt.datatransfer.*; import java.awt.event.*; import java.util.*; import javax.swing.*; import javax.swing.Timer; import javax.swing.border.*; import org.basex.core.*; import org.basex.gui.*; import org.basex.gui.GUIConstants.Fill; import org.basex.gui.layout.*; import org.basex.io.*; import org.basex.util.*; /** * This class provides a text viewer and editor, using the * {@link Renderer} class to render the text. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class Editor extends BaseXPanel { /** Delay for highlighting an error. */ private static final int ERROR_DELAY = 500; /** Search direction. */ public enum SearchDir { /** Current hit. */ CURRENT, /** Next hit. */ FORWARD, /** Previous hit. */ BACKWARD, } /** Editor action. */ public enum Action { /** Check for changes; do nothing if input has not changed. */ CHECK, /** Enforce parsing of input. */ PARSE, /** Enforce execution of input. */ EXECUTE } /** Text array to be written. */ protected final transient EditorText text = new EditorText(EMPTY); /** Undo history. */ public transient History hist; /** Renderer reference. */ final Renderer rend; /** Scrollbar reference. */ final BaseXBar scroll; /** Editable flag. */ final boolean editable; /** Search bar. */ private SearchBar search; /** Link listener. */ private LinkListener linkListener; /** * Default constructor. * @param edit editable flag * @param win parent window */ public Editor(final boolean edit, final Window win) { this(edit, win, EMPTY); } /** * Default constructor. * @param edit editable flag * @param win parent window * @param txt initial text */ public Editor(final boolean edit, final Window win, final byte[] txt) { super(win); setFocusable(true); setFocusTraversalKeysEnabled(!edit); editable = edit; addMouseMotionListener(this); addMouseWheelListener(this); addComponentListener(this); addMouseListener(this); addKeyListener(this); addFocusListener(new FocusAdapter() { @Override public void focusGained(final FocusEvent e) { if(isEnabled()) cursor(true); } @Override public void focusLost(final FocusEvent e) { cursor(false); rend.cursor(false); } }); layout(new BorderLayout(4, 0)); scroll = new BaseXBar(this); rend = new Renderer(text, scroll); setFont(GUIConstants.dmfont); add(rend, BorderLayout.CENTER); add(scroll, BorderLayout.EAST); setText(txt); hist = new History(edit ? text.text() : null); if(edit) { setBackground(Color.white); setBorder(new MatteBorder(1, 1, 0, 0, GUIConstants.color(6))); } else { mode(Fill.NONE); } new BaseXPopup(this, edit ? new GUICmd[] { new UndoCmd(), new RedoCmd(), null, new CutCmd(), new CopyCmd(), new PasteCmd(), new DelCmd(), null, new AllCmd() } : new GUICmd[] { new CopyCmd(), null, new AllCmd() }); } /** * Sets the output text. * @param t output text */ public void setText(final byte[] t) { setText(t, t.length); resetError(); } /** * Returns the cursor coordinates. * @return line/column */ public final int[] pos() { return rend.pos(); } /** * Sets the output text. * @param t output text * @param s text size */ public final void setText(final byte[] t, final int s) { // remove invalid characters and compare old with new string int ns = 0; final int pc = text.getCaret(); final int ts = text.size(); final byte[] old = text.text(); boolean eq = true; for(int r = 0; r < s; ++r) { final byte b = t[r]; // ignore carriage return if(b != 0x0D) t[ns++] = t[r]; // support characters, highlighting codes, tabs and newlines //if(b >= ' ' || b <= TokenBuilder.ULINE || b == 0x09 || b == 0x0A) t[ns++] = t[r]; eq &= ns < ts && ns < s && t[ns] == old[ns]; } eq &= ns == ts; // new text is different... if(!eq) text.text(Arrays.copyOf(t, ns)); if(hist != null) hist.store(t.length != ns ? Arrays.copyOf(t, ns) : t, pc, 0); componentResized(null); } /** * Sets a syntax highlighter, based on the file format. * @param file file reference * @param opened indicates if file was opened from disk */ protected final void setSyntax(final IO file, final boolean opened) { setSyntax( !opened || file.hasSuffix(IO.XQSUFFIXES) ? new SyntaxXQuery() : file.hasSuffix(IO.JSONSUFFIX) ? new SyntaxJSON() : file.hasSuffix(IO.XMLSUFFIXES) || file.hasSuffix(IO.HTMLSUFFIXES) || file.hasSuffix(IO.XSLSUFFIXES) || file.hasSuffix(IO.BXSSUFFIX) ? new SyntaxXML() : Syntax.SIMPLE); } /** * Returns the editable flag. * @return boolean result */ public final boolean isEditable() { return editable; } /** * Sets a syntax highlighter. * @param s syntax reference */ public final void setSyntax(final Syntax s) { rend.setSyntax(s); } /** * Sets the text cursor to the specified position. A text selection will be removed. * @param p cursor position */ public final void setCaret(final int p) { text.setCaret(p); text.noSelect(); showCursor(1); cursor(true); } /** * Returns the current text cursor. * @return cursor position */ public final int getCaret() { return text.getCaret(); } /** * Jumps to the end of the text. */ public final void scrollToEnd() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { text.setCaret(text.size()); showCursor(2); } }); } /** * Returns the output text. * @return output text */ public final byte[] getText() { return text.text(); } @Override public final void setFont(final Font f) { super.setFont(f); if(rend != null) { rend.setFont(f); rend.repaint(); } } /** Thread counter. */ int errorID; /** * Removes the error marker. */ public final void resetError() { ++errorID; text.error(-1); rend.repaint(); } /** * Sets the error marker. * @param pos start of optional error mark */ public final void error(final int pos) { final int eid = ++errorID; text.error(pos); new Thread() { @Override public void run() { Performance.sleep(ERROR_DELAY); if(eid == errorID) rend.repaint(); } }.start(); } @Override public final void setEnabled(final boolean e) { super.setEnabled(e); rend.setEnabled(e); scroll.setEnabled(e); cursor(e); } /** * Selects the whole text. */ final void selectAll() { final int s = text.size(); text.select(0, s); text.setCaret(s); rend.repaint(); } // SEARCH OPERATIONS ================================================================== /** * Installs a link listener. * @param ll link listener */ public final void setLinkListener(final LinkListener ll) { linkListener = ll; } /** * Installs a search bar. * @param s search bar */ final void setSearch(final SearchBar s) { search = s; } /** * Returns the search bar. * @return search bar */ public final SearchBar getSearch() { return search; } /** * Performs a search. * @param sc search context * @param jump jump to next hit */ final void search(final SearchContext sc, final boolean jump) { try { rend.search(sc); gui.status.setText(sc.search.isEmpty() ? OK : Util.info(STRINGS_FOUND_X, sc.nr())); if(jump) jump(SearchDir.CURRENT, false); } catch(final Exception ex) { final String msg = Util.message(ex).replaceAll(Prop.NL + ".*", ""); gui.status.setError(REGULAR_EXPR + COLS + msg); } } /** * Replaces the text. * @param rc replace context */ final void replace(final ReplaceContext rc) { try { final int[] select = rend.replace(rc); if(rc.text != null) { final boolean sel = text.selected(); setText(rc.text); if(sel) text.select(select[0], select[1]); text.setCaret(select[0]); release(Action.CHECK); } gui.status.setText(Util.info(STRINGS_REPLACED)); } catch(final Exception ex) { final String msg = Util.message(ex).replaceAll(Prop.NL + ".*", ""); gui.status.setError(REGULAR_EXPR + COLS + msg); } } /** * Jumps to a search string. * @param dir search direction * @param select select hit */ final void jump(final SearchDir dir, final boolean select) { // updates the visible area final int y = rend.jump(dir, select); final int h = getHeight(); final int p = scroll.pos(); final int m = y + rend.fontH() * 3 - h; if(y != -1 && (p < m || p > y)) scroll.pos(y - h / 2); rend.repaint(); } // MOUSE INTERACTIONS ================================================================= @Override public final void mouseEntered(final MouseEvent e) { gui.cursor(GUIConstants.CURSORTEXT); } @Override public final void mouseExited(final MouseEvent e) { gui.cursor(GUIConstants.CURSORARROW); } @Override public final void mouseMoved(final MouseEvent e) { if(linkListener == null) return; final boolean link = rend.link(scroll.pos(), e.getPoint()); gui.cursor(link ? GUIConstants.CURSORHAND : GUIConstants.CURSORARROW); } @Override public void mouseReleased(final MouseEvent e) { if(SwingUtilities.isLeftMouseButton(e)) { text.checkSelect(); // evaluate link if(!text.selected() && rend.link(scroll.pos(), e.getPoint())) linkListener.linkClicked(rend.link()); } } @Override public void mouseClicked(final MouseEvent e) { if(!SwingUtilities.isMiddleMouseButton(e)) return; new PasteCmd().execute(gui); } @Override public final void mouseDragged(final MouseEvent e) { if(!SwingUtilities.isLeftMouseButton(e)) return; // selection mode rend.select(scroll.pos(), e.getPoint(), false); final int y = Math.max(20, Math.min(e.getY(), getHeight() - 20)); if(y != e.getY()) scroll.pos(scroll.pos() + e.getY() - y); } @Override public final void mousePressed(final MouseEvent e) { if(!isEnabled() || !isFocusable()) return; requestFocusInWindow(); cursor(true); if(SwingUtilities.isMiddleMouseButton(e)) copy(); final boolean marking = e.isShiftDown(); final boolean nomark = !text.selecting(); if(SwingUtilities.isLeftMouseButton(e)) { final int c = e.getClickCount(); if(c == 1) { // selection mode if(marking && nomark) text.startSelect(); rend.select(scroll.pos(), e.getPoint(), !marking); } else if(c == 2) { text.selectWord(); } else { text.selectLine(); } } else if(nomark) { rend.select(scroll.pos(), e.getPoint(), true); } } // KEY INTERACTIONS ======================================================= @Override public void keyPressed(final KeyEvent e) { // handle search operations if(search != null) { if(ESCAPE.is(e)) { search.deactivate(true); return; } if(FIND.is(e)) { search.activate(text.copy(), true); return; } if(FINDNEXT.is(e) || FINDNEXT2.is(e) || FINDPREV.is(e) || FINDPREV2.is(e)) { final boolean vis = search.isVisible(); search.activate(text.copy(), false); jump(vis ? FINDNEXT.is(e) || FINDNEXT2.is(e) ? SearchDir.FORWARD : SearchDir.BACKWARD : SearchDir.CURRENT, true); return; } } // ignore modifier keys if(modifier(e)) return; // operations that change the focus are put first.. if(PREVTAB.is(e)) { transferFocusBackward(); return; } if(NEXTTAB.is(e)) { transferFocus(); return; } // re-animate cursor cursor(true); // operations without cursor movement... final int fh = rend.fontH(); if(SCROLLDOWN.is(e)) { scroll.pos(scroll.pos() + fh); return; } if(SCROLLUP.is(e)) { scroll.pos(scroll.pos() - fh); return; } if(COPY1.is(e) || COPY2.is(e)) { copy(); return; } // set cursor position and reset last column final int pc = text.getCaret(); text.pos(pc); if(!PREVLINE.is(e) && !NEXTLINE.is(e)) lastCol = -1; if(SELECTALL.is(e)) { selectAll(); return; } // necessary on Macs as the shift button is pressed for REDO final boolean marking = e.isShiftDown() && !DELNEXT.is(e) && !DELPREV.is(e) && !PASTE2.is(e) && !COMMENT.is(e) && !DELLINE.is(e) && !REDOSTEP.is(e) && !PREVPAGE_RO.is(e); final boolean nomark = !text.selecting(); if(marking && nomark) text.startSelect(); boolean down = true; boolean consumed = true; // operations that consider the last text mark.. final byte[] txt = text.text(); if(NEXTWORD.is(e)) { text.nextToken(marking); } else if(PREVWORD.is(e)) { text.prevToken(marking); down = false; } else if(TEXTSTART.is(e)) { if(!marking) text.noSelect(); text.pos(0); down = false; } else if(TEXTEND.is(e)) { if(!marking) text.noSelect(); text.pos(text.size()); } else if(LINESTART.is(e)) { text.home(marking); down = false; } else if(LINEEND.is(e)) { text.eol(marking); } else if(PREVPAGE.is(e) || !hist.active() && PREVPAGE_RO.is(e)) { up(getHeight() / fh, marking); down = false; } else if(NEXTPAGE.is(e) || !hist.active() && NEXTPAGE_RO.is(e)) { down(getHeight() / fh, marking); } else if(NEXT.is(e)) { text.next(marking); } else if(PREV.is(e)) { text.prev(marking); down = false; } else if(PREVLINE.is(e)) { up(1, marking); down = false; } else if(NEXTLINE.is(e)) { down(1, marking); } else { consumed = false; } if(marking) { // refresh scroll position text.finishSelect(); } else if(hist.active()) { // edit operations... if(CUT1.is(e) || CUT2.is(e)) { if(copy()) text.delete(); } else if(PASTE1.is(e) || PASTE2.is(e)) { final String clip = clip(); if(clip != null) { if(text.selected()) text.delete(); text.add(clip); } } else if(UNDOSTEP.is(e)) { final byte[] t = hist.prev(); if(t != null) { text.text(t); text.pos(hist.cursor()); } } else if(REDOSTEP.is(e)) { final byte[] t = hist.next(); if(t != null) { text.text(t); text.pos(hist.cursor()); } } else if(COMMENT.is(e)) { text.comment(rend.getSyntax()); } else if(DELLINE.is(e)) { text.deleteLine(); } else if(DELLINEEND.is(e) || DELNEXTWORD.is(e) || DELNEXT.is(e)) { if(nomark) { if(text.pos() == text.size()) return; text.startSelect(); if(DELNEXTWORD.is(e)) { text.nextToken(true); } else if(DELLINEEND.is(e)) { text.eol(true); } else { text.next(true); } text.finishSelect(); } text.delete(); } else if(DELLINESTART.is(e) || DELPREVWORD.is(e) || DELPREV.is(e)) { if(nomark) { if(text.pos() == 0) return; text.startSelect(); if(DELPREVWORD.is(e)) { text.prevToken(true); } else if(DELLINESTART.is(e)) { text.bol(true); } else { text.prev(); } text.finishSelect(); } text.delete(); down = false; } else { consumed = false; } } if(consumed) e.consume(); text.setCaret(); final byte[] tmp = text.text(); if(txt != tmp) { hist.store(tmp, pc, text.getCaret()); calcCode.invokeLater(down); } else { showCursor(down ? 2 : 0); } } /** Thread counter. */ private final GUICode calcCode = new GUICode() { @Override public void eval(final Object arg) { rend.calc(); showCursor((Boolean) arg ? 2 : 0); } }; /** Thread counter. */ private final GUICode cursorCode = new GUICode() { @Override public void eval(final Object arg) { // updates the visible area final int p = scroll.pos(); final int y = rend.cursorY(); final int m = y + rend.fontH() * 3 - getHeight(); if(p < m || p > y) { final int align = (Integer) arg; scroll.pos(align == 0 ? y : align == 1 ? y - getHeight() / 2 : m); rend.repaint(); } } }; /** * Displays the currently edited text area. * @param align vertical alignment */ final void showCursor(final int align) { cursorCode.invokeLater(align); } /** * Moves the cursor down. The current column position is remembered in * {@link #lastCol} and, if possible, restored. * @param l number of lines to move cursor * @param mark mark flag */ private void down(final int l, final boolean mark) { if(!mark) text.noSelect(); final int x = text.bol(mark); if(lastCol == -1) lastCol = x; for(int i = 0; i < l; ++i) { text.eol(mark); text.next(mark); } text.forward(lastCol, mark); if(text.pos() == text.size()) lastCol = -1; } /** * Moves the cursor up. * @param l number of lines to move cursor * @param mark mark flag */ private void up(final int l, final boolean mark) { if(!mark) text.noSelect(); final int x = text.bol(mark); if(lastCol == -1) lastCol = x; if(text.pos() == 0) { lastCol = -1; return; } for(int i = 0; i < l; ++i) { text.prev(mark); text.bol(mark); } text.forward(lastCol, mark); } /** Last horizontal position. */ private int lastCol = -1; @Override public void keyTyped(final KeyEvent e) { if(!hist.active() || control(e) || DELNEXT.is(e) || DELPREV.is(e) || ESCAPE.is(e)) return; final int pc = text.getCaret(); text.pos(pc); // remember if marked text is to be deleted final StringBuilder sb = new StringBuilder(1).append(e.getKeyChar()); final boolean indent = TAB.is(e) && text.indent(sb, e.isShiftDown()); // delete marked text if(text.selected() && !indent) text.delete(); if(ENTER.is(e)) { text.open(sb); } else if(sb.length() != 0 && "}])".indexOf(sb.toString()) != -1) { text.close(); } if(sb.length() != 0) text.add(sb.toString()); text.setCaret(); hist.store(text.text(), pc, text.getCaret()); calcCode.invokeLater(true); e.consume(); } /** * Releases a key or mouse. Can be overwritten to react on events. * @param action action */ @SuppressWarnings("unused") protected void release(final Action action) { } // EDITOR COMMANDS ========================================================== /** * Copies the selected text to the clipboard. * @return true if text was copied */ final boolean copy() { final String txt = text.copy(); if(txt.isEmpty()) { text.noSelect(); return false; } // copy selection to clipboard final Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard(); clip.setContents(new StringSelection(txt), null); return true; } /** * Returns the clipboard text. * @return text */ static final String clip() { // copy selection to clipboard final Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard(); final Transferable tr = clip.getContents(null); if(tr != null) { for(final Object o : BaseXLayout.contents(tr)) return o.toString(); } return null; } /** * Finishes a command. * @param old old cursor position; store entry to history if position != -1 */ void finish(final int old) { text.setCaret(); if(old != -1) hist.store(text.text(), old, text.getCaret()); calcCode.invokeLater(true); release(Action.CHECK); } /** Cursor. */ private final Timer cursor = new Timer(500, new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { rend.cursor(!rend.cursor()); } }); /** * Stops an old cursor thread and, if requested, starts a new one. * @param start start/stop flag */ final void cursor(final boolean start) { cursor.stop(); if(start) cursor.start(); rend.cursor(start); } @Override public final void mouseWheelMoved(final MouseWheelEvent e) { scroll.pos(scroll.pos() + e.getUnitsToScroll() * 20); rend.repaint(); } /** Calculation counter. */ private final GUICode resizeCode = new GUICode() { @Override public void eval(final Object arg) { rend.calc(); // update scrollbar to display value within valid range scroll.pos(scroll.pos()); rend.repaint(); } }; @Override public final void componentResized(final ComponentEvent e) { resizeCode.invokeLater(); } /** Undo command. */ class UndoCmd extends GUIBaseCmd { @Override public void execute(final GUI main) { if(!hist.active()) return; final byte[] t = hist.prev(); if(t == null) return; text.text(t); text.pos(hist.cursor()); finish(-1); } @Override public void refresh(final GUI main, final AbstractButton button) { button.setEnabled(!hist.first()); } @Override public String label() { return UNDO; } } /** Redo command. */ class RedoCmd extends GUIBaseCmd { @Override public void execute(final GUI main) { if(!hist.active()) return; final byte[] t = hist.next(); if(t == null) return; text.text(t); text.pos(hist.cursor()); finish(-1); } @Override public void refresh(final GUI main, final AbstractButton button) { button.setEnabled(!hist.last()); } @Override public String label() { return REDO; } } /** Cut command. */ class CutCmd extends GUIBaseCmd { @Override public void execute(final GUI main) { if(!hist.active()) return; final int tc = text.getCaret(); text.pos(tc); if(!copy()) return; text.delete(); text.setCaret(); finish(tc); } @Override public void refresh(final GUI main, final AbstractButton button) { button.setEnabled(text.selected()); } @Override public String label() { return CUT; } } /** Copy command. */ class CopyCmd extends GUIBaseCmd { @Override public void execute(final GUI main) { copy(); } @Override public void refresh(final GUI main, final AbstractButton button) { button.setEnabled(text.selected()); } @Override public String label() { return COPY; } } /** Paste command. */ class PasteCmd extends GUIBaseCmd { @Override public void execute(final GUI main) { if(!hist.active()) return; final int tc = text.getCaret(); text.pos(tc); final String clip = clip(); if(clip == null) return; if(text.selected()) text.delete(); text.add(clip); finish(tc); } @Override public void refresh(final GUI main, final AbstractButton button) { button.setEnabled(clip() != null); } @Override public String label() { return PASTE; } } /** Delete command. */ class DelCmd extends GUIBaseCmd { @Override public void execute(final GUI main) { if(!hist.active()) return; final int tc = text.getCaret(); text.pos(tc); text.delete(); finish(tc); } @Override public void refresh(final GUI main, final AbstractButton button) { button.setEnabled(text.selected()); } @Override public String label() { return DELETE; } } /** Select all command. */ class AllCmd extends GUIBaseCmd { @Override public void execute(final GUI main) { selectAll(); } @Override public void refresh(final GUI main, final AbstractButton button) { } @Override public String label() { return SELECT_ALL; } } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/editor/EditorText.java000066400000000000000000000470741222453003200262230ustar00rootroot00000000000000package org.basex.gui.editor; import static org.basex.util.Token.*; import org.basex.gui.editor.Editor.SearchDir; import org.basex.util.*; import org.basex.util.list.*; /** * This class contains the rendered text. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class EditorText { /** Tab width. */ static final int TAB = 2; /** Search context. */ private SearchContext search; /** Start and end positions of search terms. */ IntList[] spos = { new IntList(), new IntList() }; /** Text array to be written. */ private byte[] text = EMPTY; /** Current cursor position. */ private int pc; /** Start position of a token. */ private int ps; /** End position of a token. */ private int pe; /** Start position of a text selection. */ private int ms = -1; /** End position of a text selection (+1). */ private int me = -1; /** Start position of an error highlighting. */ private int es = -1; /** Current search position. */ private int sp; /** * Constructor. * @param t text */ EditorText(final byte[] t) { text = t; } /** * Initializes the iterator. */ void init() { ps = 0; pe = 0; sp = 0; } /** * Sets a new text. * @param t new text */ void text(final byte[] t) { text = t; noSelect(); if(search != null) spos = search.search(t); } /** * Checks if the text contains more words. * @return result of check */ boolean moreTokens() { // quit if text has ended final byte[] txt = text; final int tl = txt.length; int ppe = pe; if(ppe >= tl) return false; ps = ppe; // find next token boundary int ch = cp(txt, ppe); ppe += cl(txt, ppe); if(ftChar(ch)) { while(ppe < tl) { ch = cp(txt, ppe); if(!ftChar(ch)) break; ppe += cl(txt, ppe); } } pe = ppe; return true; } /** * Returns the token as string. * @return string */ public String nextString() { final byte[] txt = text; final int ppe = pe; final int pps = ps; return ppe <= txt.length ? string(txt, pps, ppe - pps) : ""; } /** * Moves one character forward. * @param select selection flag * @return character */ int next(final boolean select) { return noSelect(select, true) ? curr() : next(); } /** * Sets a new search processor. * @param sc search processor */ void search(final SearchContext sc) { // skip search if criteria have not changed if(sc.equals(search)) { sc.nr = search.nr; sc.bar.refresh(sc); } else { spos = sc.search(text); search = sc; } } /** * Replaces the text. * @param rc replace context * @return selection offsets */ int[] replace(final ReplaceContext rc) { final int start = selected() ? Math.min(ms, me) : 0; final int end = selected() ? Math.max(ms, me) : text.length; return rc.replace(search, text, start, end); } /** * Moves one token forward. * @param select selection flag */ void nextToken(final boolean select) { int ch = next(select); if(ch == '\n') return; if(Character.isLetterOrDigit(ch)) { while(Character.isLetterOrDigit(ch)) ch = next(); while(ch != '\n' && Character.isWhitespace(ch)) ch = next(); } else if(Character.isWhitespace(ch)) { while(ch != '\n' && Character.isWhitespace(ch)) ch = next(); } else { while(ch != '\n' && !Character.isLetterOrDigit(ch) && !Character.isWhitespace(ch)) ch = next(); while(ch != '\n' && Character.isWhitespace(ch)) ch = next(); } if(ps != text.length) prev(); } /** * Moves one token back. * @param select selection flag */ void prevToken(final boolean select) { int ch = prev(select); if(ch == '\n') return; if(Character.isLetterOrDigit(ch)) { while(Character.isLetterOrDigit(ch)) ch = prev(); } else if(Character.isWhitespace(ch)) { while(ch != '\n' && Character.isWhitespace(ch)) ch = prev(); while(Character.isLetterOrDigit(ch)) ch = prev(); } else { while(ch != '\n' && !Character.isLetterOrDigit(ch) && !Character.isWhitespace(ch)) ch = prev(); } if(ps != 0) next(); } /** * Checks if the character position equals the word end. * @return result of check */ boolean more() { return ps < pe && ps < text.length; } /** * Returns the current character. * @return current character */ public int curr() { return ps < 0 || ps >= text.length ? '\n' : cp(text, ps); } /** * Returns the original text array. * @return text */ public byte[] text() { return text; } /** * Moves one character forward. * @return current character */ int next() { final int c = curr(); if(ps < text.length) ps += cl(text, ps); return c; } /** * Sets the iterator position. * @param p iterator position */ void pos(final int p) { ps = p; } /** * Returns the iterator position. * @return iterator position */ int pos() { return ps; } // POSITION =========================================================================== /** * Moves to the beginning of the line. * @param select selection flag * @return number of passed characters */ int bol(final boolean select) { if(ps == 0) return 0; int c = 0; do c += curr() == '\t' ? TAB : 1; while(prev(select) != '\n'); if(ps != 0 || curr() == '\n') next(select); return c; } /** * Moves to the first character or the beginning of the line. * @param select selection flag */ void home(final boolean select) { final int p = ps; boolean s = true; // find beginning of line while(prev(select) != '\n') s &= ws(curr()); if(ps != 0 || curr() == '\n') next(select); // move to first non-whitespace character if(p == ps || !s) while(ws(curr()) && curr() != '\n') next(select); } /** * Moves to the end of the line. * @param select selection flag */ void eol(final boolean select) { forward(Integer.MAX_VALUE, select); } /** * Moves one character back and returns the found character. * @param select selection flag * @return character */ int prev(final boolean select) { return noSelect(select, false) ? curr() : prev(); } /** * Moves one character back and returns the found character. A newline character is * returned if the cursor is placed at the beginning of the text. * @return character */ int prev() { if(ps == 0) return '\n'; while(--ps > 0 && text[ps] < -64 && text[ps] >= -128); return curr(); } /** * Moves to the specified position of to the of the line. * @param p position to move to * @param select selection flag */ void forward(final int p, final boolean select) { int nc = 0; while(curr() != '\n') { nc += curr() == '\t' ? TAB : 1; if(nc >= p) return; next(select); } } /** * Adds a string at the current position. * @param str string */ void add(final String str) { final TokenBuilder tb = new TokenBuilder(str.length() << 1); final int cl = str.length(); for(int c = 0; c < cl; ++c) { // ignore invalid characters int ch = str.charAt(c); if(ch == '\r') continue; if(ch < ' ' && !ws(ch)) { ch = '\n'; } else if(Character.isHighSurrogate((char) ch) && c + 1 < cl) { ch = Character.toCodePoint((char) ch, str.charAt(++c)); } tb.add(ch); } final int tl = text.length; final int ts = tb.size(); final byte[] tmp = new byte[tl + ts]; System.arraycopy(text, 0, tmp, 0, ps); System.arraycopy(tb.finish(), 0, tmp, ps, ts); System.arraycopy(text, ps, tmp, ps + ts, tl - ps); text(tmp); ps += ts; } /** * Indents lines. * @param s start position * @param e end position * @param sh shift flag */ void indent(final int s, final int e, final boolean sh) { // extend selection to match whole lines pos(s); bol(true); startSelect(); pos(e); forward(Integer.MAX_VALUE, true); next(true); finishSelect(); // decide if to use tab or spaces boolean tab = false; for(final byte t : text) tab |= t == '\t'; byte[] add = { '\t' }; if(!tab) { add = new byte[TAB]; for(int a = 0; a < TAB; a++) add[a] = ' '; } // build new text final TokenBuilder tb = new TokenBuilder(); tb.add(text, 0, ms); final int pl = text.length; for(int p = ms; p < ps; p += cl(text, p)) { if(p == 0 || text[p - 1] == '\n') { if(sh) { // remove indentation if(text[p] == '\t') { me--; continue; } if(text[p] == ' ') { me--; for(int i = 1; i < TAB && p + i < pl && text[p + i] == ' '; i++) { me--; p++; } continue; } } else { // add new indentation tb.add(add); me += add.length; } } tb.add(cp(text, p)); } tb.add(text, ps, text.length); ps = me; final int ss = ms; text(tb.finish()); ms = ss; me = ps; } /** * (Un)comments highlighted text or line. * @param syntax syntax highlighter */ void comment(final Syntax syntax) { final byte[] st = syntax.commentOpen(); final byte[] en = syntax.commentEnd(); boolean add = true; int min = ps; int max = ps; if(selected()) { min = ps < ms ? ps : ms; max = ps > ms ? ps : ms; if(max > min && text[max - 1] == '\n') max--; // selected final int mn = Math.max(min + st.length, max - en.length); // check if selected area already has a comment if(indexOf(text, st, min) == min && indexOf(text, en, mn) == mn) { final TokenBuilder tb = new TokenBuilder(); tb.add(text, 0, min); tb.add(text, min + st.length, max - en.length); tb.add(text, max, text.length); text(tb.finish()); ms = min; me = max - st.length - en.length; ps = me; add = false; } } else { while(min > 0 && text[min - 1] != '\n') --min; while(max < size() && text[max] != '\n') ++max; } if(add) { pos(max); add(string(en)); pos(min); add(string(st)); ms = min; me = max + st.length + en.length; ps = me; } } /** * Indents the current line or text. * @param sb typed in string * @param shift shift key * @return indentation flag */ boolean indent(final StringBuilder sb, final boolean shift) { // no selection, shift pressed: select current character if(!selected() && shift && text.length != 0) select(ps + 1, ps); // check if something is selected boolean i = false; if(selected()) { // check if lines are to be indented final int s = Math.min(ps, start()); final int l = Math.max(ps, start()) - 1; int p = s; for(; p <= l && p < text.length; p++) i |= text[p] != '\n'; i |= p == text.length; if(i) { indent(s, l, shift); sb.setLength(0); } } else { boolean c = ps > 0; for(int p = ps - 1; p >= 0 && c; p--) { final byte b = text[p]; c = ws(b); if(b == '\n') break; } if(c) { sb.setLength(0); sb.append(" "); } } return i; } /** * Processes the enter key and checks for opening brackets. * @param sb typed in string */ void open(final StringBuilder sb) { // adopt indentation from previous line int s = 0; for(int p = ps - 1; p >= 0; p--) { final byte b = text[p]; if(b == '\n') break; if(b == '\t') { s += EditorText.TAB; } else if(b == ' ') { s++; } else { s = 0; } } // indent after opening bracket if(ps > 0) { final int l = text[ps - 1]; if(l == '(' || l == '{' || l == '[') s += EditorText.TAB; } // unindent before closing bracket if(ps < text.length) { final int l = text[ps]; if(l == ')' || l == '}' || l == ']') s -= EditorText.TAB; } for(int p = 0; p < s; p++) sb.append(' '); } /** * Closes a bracket. */ void close() { int p = ps - 1; for(; p >= 0; p--) { final byte b = text[p]; if(b == '\n') break; if(!ws(b)) return; } if(++p >= ps) return; ms = Math.max(ps - TAB, p); me = Math.max(ps, p); if(ms != me) delete(); } /** * Deletes the current character or selection. * Assumes that the current position allows a deletion. */ void delete() { final int tl = text.length; if(tl == 0) return; final int s = selected() ? Math.min(ms, me) : ps; final int e = selected() ? Math.max(ms, me) : ps + cl(text, ps); final byte[] tmp = new byte[tl - e + s]; System.arraycopy(text, 0, tmp, 0, s); System.arraycopy(text, e, tmp, s, tl - e); text(tmp); ps = s; } /** * Deletes the current line. */ void deleteLine() { bol(false); startSelect(); eol(true); next(true); finishSelect(); delete(); } // TEXT SELECTION ===================================================================== /** * Jumps to the maximum/minimum position and resets the selection. * @param select selection flag * @param max maximum/minimum flag * @return true if selection was reset */ private boolean noSelect(final boolean select, final boolean max) { final boolean rs = !select && selected(); if(rs) { ps = max ^ ms < me ? ms : me; noSelect(); } return rs; } /** * Resets the selection. */ void noSelect() { ms = -1; me = -1; } /** * Sets the start of a text selection. */ void startSelect() { ms = ps; me = ps; } /** * Extends the text selection. */ void extendSelect() { me = ps; } /** * Finishes a text selection. */ void finishSelect() { me = ps; checkSelect(); } /** * Selects the specified area. * @param s start position * @param e end position */ void select(final int s, final int e) { ms = s; me = e; checkSelect(); } /** * Checks the validity of the selection. */ void checkSelect() { if(ms == me) noSelect(); } /** * Returns the start of the text selection. The value is {@code -1} if no * text is selected. * @return start selection */ int start() { return ms; } /** * Tests if text is currently being selected, or has already been selected. * @return result of check */ boolean selecting() { return ms != -1; } /** * Tests if text has been selected. * @return result of check */ boolean selected() { return ms != me; } /** * Tests if the current text position is selected. * @return result of check */ boolean selectStart() { return selected() && (inSelect() || (ms < me ? ms >= ps && ms < pe : me >= ps && me < pe)); } /** * Tests if the current position is selected. * @return result of check */ boolean inSelect() { return ms < me ? ps >= ms && ps < me : ps >= me && ps < ms; } /** * Returns the selected string. * @return string */ String copy() { final TokenBuilder tb = new TokenBuilder(); final int e = ms < me ? me : ms; for(int s = ms < me ? ms : me; s < e; s += cl(text, s)) { final int t = cp(text, s); if(t < 0 || t >= ' ' || t == 0x0A || t == 0x09) tb.add(t); } return tb.toString(); } /** * Selects the word at the cursor position. */ void selectWord() { pos(getCaret()); final boolean ch = ftChar(prev(true)); while(pos() > 0) { final int c = prev(true); if(c == '\n' || ch != ftChar(c)) break; } if(pos() != 0) next(true); startSelect(); while(pos() < size()) { final int c = curr(); if(c == '\n' || ch != ftChar(c)) break; next(true); } finishSelect(); } /** * Selects the word at the cursor position. */ void selectLine() { pos(getCaret()); bol(true); startSelect(); eol(true); finishSelect(); } // ERROR HIGHLIGHTING ================================================================= /** * Tests if the current token is erroneous. * @return result of check */ boolean erroneous() { return es >= ps && es < pe; } /** * Returns the error position. * @return error position */ public int error() { return es; } /** * Sets the error position. * @param s start position */ public void error(final int s) { es = s; } // SEARCH HIGHLIGHTING ================================================================ /** * Returns true if the cursor focuses a search string. * @return result of check */ boolean searchStart() { if(search == null) return false; final IntList[] sps = spos; if(sp == sps[0].size()) return false; while(ps > sps[1].get(sp)) { if(++sp == sps[0].size()) return false; } return pe > sps[0].get(sp); } /** * Tests if the current position is within a search term. * @return result of check */ boolean inSearch() { if(sp >= spos[0].size() || ps < spos[0].get(sp)) return false; final boolean in = ps < spos[1].get(sp); if(!in) sp++; return in; } /** * Selects a search string. * @param dir search direction * @param select select hit * @return new cursor position, or {@code -1} */ int jump(final SearchDir dir, final boolean select) { if(spos[0].isEmpty()) { if(select) noSelect(); return -1; } int s = spos[0].sortedIndexOf(!select || selected() ? pc : pc - 1); switch(dir) { case CURRENT: s = s < 0 ? -s - 1 : s; break; case FORWARD: s = s < 0 ? -s - 1 : s + 1; break; case BACKWARD: s = s < 0 ? -s - 2 : s - 1; break; } final int sl = spos[0].size(); if(s < 0) s = sl - 1; else if(s == sl) s = 0; final int pos = spos[0].get(s); if(select) { pc = pos; ms = pos; me = spos[1].get(s); } else { pc = pos; } return pos; } // CURSOR ============================================================================= /** * Checks if the text cursor moves over the current token. * @return result of check */ boolean edited() { return pc >= ps && pc < pe; } /** * Sets the text cursor to the specified position. * @param c cursor position */ void setCaret(final int c) { pc = c; ps = c; } /** * Sets the text cursor to the current position. */ void setCaret() { pc = ps; } /** * Returns the position of the text cursor. * @return cursor position */ int getCaret() { return pc; } /** * Returns the text size. * @return text size */ int size() { return text.length; } @Override public String toString() { return copy(); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/editor/LinkListener.java000066400000000000000000000004701222453003200265200ustar00rootroot00000000000000package org.basex.gui.editor; /** * Listener interface for handling link events. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public interface LinkListener { /** * Invoked when a link is pressed. * @param link pressed link */ void linkClicked(final String link); } basex-7.7.2/basex-core/src/main/java/org/basex/gui/editor/Renderer.java000066400000000000000000000326241222453003200256710ustar00rootroot00000000000000package org.basex.gui.editor; import java.awt.*; import org.basex.gui.*; import org.basex.gui.GUIConstants.Fill; import org.basex.gui.editor.Editor.SearchDir; import org.basex.gui.layout.*; import org.basex.util.*; import org.basex.util.list.*; /** * Efficient Text Editor and Renderer, supporting syntax highlighting and * text selections. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class Renderer extends BaseXBack { /** Vertical start position. */ private final BaseXBar bar; /** Font. */ private Font font; /** Default font. */ private Font dfont; /** Bold font. */ private Font bfont; /** Font height. */ private int fontH; /** Character widths. */ private int[] fwidth = GUIConstants.mfwidth; /** Color. */ private Color color; /** Color highlighting flag. */ private boolean high; /** Current link. */ private boolean link; /** Width of current word. */ private int wordW; /** Border offset. */ private int off; /** Current x coordinate. */ private int x; /** Current y coordinate. */ private int y; /** Current width. */ private int w; /** Current height. */ private int h; /** Current brackets. */ private final IntList pars = new IntList(); /** Text array to be written. */ private final EditorText text; /** Vertical start position. */ private transient Syntax syntax = Syntax.SIMPLE; /** Visibility of cursor. */ private boolean cursor; /** * Constructor. * @param t text to be drawn * @param b scrollbar reference */ Renderer(final EditorText t, final BaseXBar b) { mode(Fill.NONE); text = t; bar = b; } @Override public void setFont(final Font f) { dfont = f; bfont = f.deriveFont(Font.BOLD); font(f); } @Override public void paintComponent(final Graphics g) { super.paintComponent(g); pars.reset(); init(g, bar.pos()); while(more(g)) write(g); wordW = 0; final int s = text.size(); if(cursor && s == text.getCaret()) drawCursor(g, x); if(s == text.error()) drawError(g); } /** * Sets a new search context. * @param sc new search context */ void search(final SearchContext sc) { text.search(sc); } /** * Replaces the text. * @param rc replace context * @return selection offsets */ int[] replace(final ReplaceContext rc) { return text.replace(rc); } /** * Jumps to a search string. * @param dir search direction * @param select select hit * @return new vertical position, or {@code -1} */ int jump(final SearchDir dir, final boolean select) { final int pos = text.jump(dir, select); if(pos == -1) return -1; final int hh = h; h = Integer.MAX_VALUE; final Graphics g = getGraphics(); for(init(g); more(g) && text.pos() < pos; next()); h = hh; return y; } /** * Returns the cursor coordinates. * @return line/column */ int[] pos() { final int hh = h; h = Integer.MAX_VALUE; final Graphics g = getGraphics(); int col = 1; int line = 1; init(g); boolean more = true; while(more(g)) { final int p = text.pos(); while(text.more()) { more = text.pos() < text.getCaret(); if(!more) break; text.next(); col++; } if(!more) break; text.pos(p); if(next()) { line++; col = 1; } } h = hh; return new int[] { line, col }; } /** * Sets the current font. * @param f font */ private void font(final Font f) { font = f; off = f.getSize() + 1 >> 2; fontH = f.getSize() + off; fwidth = GUIConstants.fontWidths(f); } @Override public Dimension getPreferredSize() { final Graphics g = getGraphics(); w = Integer.MAX_VALUE; h = Integer.MAX_VALUE; init(g); int max = 0; while(more(g)) { if(text.curr() == 0x0A) max = Math.max(x, max); next(); } return new Dimension(Math.max(x, max) + fwidth[' '], y + fontH); } /** * Initializes the renderer. * @param g graphics reference */ private void init(final Graphics g) { init(g, 0); } /** * Initializes the renderer. * @param g graphics reference * @param pos current text position */ private void init(final Graphics g, final int pos) { font = dfont; color = Color.black; syntax.init(); text.init(); link = false; x = off; y = off + fontH - pos - 2; if(g != null) g.setFont(font); } /** * Calculates the text height. */ void calc() { w = getWidth() - (off >> 1); h = Integer.MAX_VALUE; final Graphics g = getGraphics(); init(g); while(more(g)) next(); h = getHeight() + fontH; bar.height(y + off); } /** * Returns the current vertical cursor position. * @return new position */ int cursorY() { final int hh = h; h = Integer.MAX_VALUE; final Graphics g = getGraphics(); init(g); while(more(g) && !text.edited()) next(); h = hh; return y - fontH; } /** * Checks if the text has more words to print. * @param g graphics reference * @return true if the text has more words */ private boolean more(final Graphics g) { // no more words found; quit if(!text.moreTokens()) return false; // calculate word width int ww = 0; final int p = text.pos(); while(text.more()) { final int ch = text.next(); // internal special codes... if(ch == TokenBuilder.BOLD) { font(bfont); } else if(ch == TokenBuilder.NORM) { font(dfont); } else if(ch == TokenBuilder.ULINE) { link ^= true; } else { ww += charW(g, ch); } } text.pos(p); // jump to new line if(x + ww > w) { x = off; y += fontH; } wordW = ww; // check if word has been found, and word is still visible return y < h; } /** * Finishes the current token. * @return true for new line */ private boolean next() { final int ch = text.curr(); if(ch == TokenBuilder.NLINE || ch == TokenBuilder.HLINE) { x = off; y += fontH >> (ch == TokenBuilder.NLINE ? 0 : 1); return true; } x += wordW; return false; } /** * Writes the current string to the graphics reference. * @param g graphics reference */ private void write(final Graphics g) { // choose color for enabled text, depending on highlighting, link, or current syntax color = isEnabled() ? high ? GUIConstants.GREEN : link ? GUIConstants.color4 : syntax.getColor(text) : Color.gray; high = false; // retrieve first character of current token final int ch = text.curr(); if(ch == TokenBuilder.MARK) high = true; final int cp = text.pos(); final int cc = text.getCaret(); if(y > 0 && y < h) { // mark selected text if(text.selectStart()) { int xx = x, cw = 0; while(!text.inSelect() && text.more()) xx += charW(g, text.next()); while(text.inSelect() && text.more()) cw += charW(g, text.next()); g.setColor(GUIConstants.color(3)); g.fillRect(xx, y - fontH * 4 / 5, cw, fontH); text.pos(cp); } // mark found text int xx = x; while(text.more() && text.searchStart()) { int cw = 0; while(!text.inSearch() && text.more()) xx += charW(g, text.next()); while(text.inSearch() && text.more()) cw += charW(g, text.next()); g.setColor(GUIConstants.color2A); g.fillRect(xx, y - fontH * 4 / 5, cw, fontH); xx += cw; } text.pos(cp); // retrieve first character of current token if(text.erroneous()) drawError(g); // don't write whitespaces if(ch >= ' ') { g.setColor(color); String n = text.nextString(); int ww = w - x; if(x + wordW > ww) { // shorten string if it cannot be completely shown (saves memory) int c = 0; for(final int nl = n.length(); c < nl && ww > 0; c++) { ww -= charW(g, n.charAt(c)); } n = n.substring(0, c); } if(ch != ' ') g.drawString(n, x, y); // underline linked text if(link) g.drawLine(x, y + 1, x + wordW, y + 1); } else if(ch <= TokenBuilder.ULINE) { g.setFont(font); } // show cursor if(cursor && text.edited()) { xx = x; while(text.more()) { if(cc == text.pos()) { drawCursor(g, xx); break; } xx += charW(g, text.next()); } text.pos(cp); } } // handle matching parentheses if(ch == '(' || ch == '[' || ch == '{') { pars.add(x); pars.add(y); pars.add(cp); pars.add(ch); } else if((ch == ')' || ch == ']' || ch == '}') && !pars.isEmpty()) { final int open = ch == ')' ? '(' : ch == ']' ? '[' : '{'; if(pars.peek() == open) { pars.pop(); final int cr = pars.pop(); final int yy = pars.pop(); final int xx = pars.pop(); if(cc == cp || cc == cr) { g.setColor(GUIConstants.color3); g.drawRect(xx, yy - fontH * 4 / 5, charW(g, open), fontH); g.drawRect(x, y - fontH * 4 / 5, charW(g, ch), fontH); } } } next(); } /** * Paints the text cursor. * @param g graphics reference * @param xx x position */ private void drawCursor(final Graphics g, final int xx) { g.setColor(GUIConstants.DGRAY); g.fillRect(xx, y - fontH * 4 / 5, 2, fontH); } /** * Draws an error marker. * @param g graphics reference */ private void drawError(final Graphics g) { final int ww = wordW != 0 ? wordW : charW(g, ' '); final int s = Math.max(1, fontH / 8); g.setColor(GUIConstants.LRED); g.fillRect(x, y + 2, ww, s); g.setColor(GUIConstants.RED); for(int xp = x; xp < x + ww; xp++) { if((xp & 1) == 0) g.drawLine(xp, y + 2, xp, y + s + 1); } } /** * Selects the text at the specified position. * @param pos current text position * @param p mouse position * @return {@code true} if mouse is placed over a link */ boolean link(final int pos, final Point p) { final int xx = p.x; final int yy = p.y - fontH / 5; final Graphics g = getGraphics(); init(g, pos); if(yy > y - fontH) { int s = text.pos(); while(true) { // end of line if(xx > x && yy < y - fontH) { text.pos(s); break; } // end of text - skip last characters if(!more(g)) { while(text.more()) text.next(); break; } // beginning of line if(xx <= x && yy < y) break; // middle of line if(xx > x && xx <= x + wordW && yy > y - fontH && yy <= y) { while(text.more()) { final int ww = charW(g, text.curr()); if(xx < x + ww) break; x += ww; text.next(); } break; } s = text.pos(); next(); } } return link; } /** * Selects the text at the specified position. * @param pos current text position * @param p mouse position * @param start states if selection has just been started * @return {@code true} if mouse is placed over a link */ boolean select(final int pos, final Point p, final boolean start) { if(start) text.noSelect(); link(pos, p); if(start) text.startSelect(); else text.extendSelect(); text.setCaret(); repaint(); return link; } /** * Retrieves the current link found via {@link #link(int, Point)} or * {@link #select(int, Point, boolean)}. * @return clicked link */ String link() { // find beginning and end of link final int s = text.size(); final byte[] txt = text.text(); int ls = text.pos(), le = ls; while(ls > 0 && txt[ls - 1] != TokenBuilder.ULINE) ls--; while(le < s && txt[le] != TokenBuilder.ULINE) le++; return Token.string(txt, ls, le - ls); } /** * Returns the width of the specified codepoint. * @param g graphics reference * @param cp character * @return width */ private int charW(final Graphics g, final int cp) { return cp < ' ' || g == null ? cp == '\t' ? fwidth[' '] * EditorText.TAB : 0 : cp < 256 ? fwidth[cp] : cp >= 0xD800 && cp <= 0xDC00 ? 0 : g.getFontMetrics().charWidth(cp); } /** * Returns the font height. * @return font height */ int fontH() { return fontH; } /** * Sets the cursor flag and repaints the panel. * @param c cursor flag */ void cursor(final boolean c) { cursor = c; repaint(); } /** * Returns the cursor flag. * @return cursor flag */ boolean cursor() { return cursor; } /** * Sets a syntax highlighter. * @param s syntax highlighter */ void setSyntax(final Syntax s) { syntax = s; } /** * Returns the syntax highlighter. * @return syntax highlighter */ Syntax getSyntax() { return syntax; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/editor/ReplaceContext.java000066400000000000000000000052251222453003200270400ustar00rootroot00000000000000package org.basex.gui.editor; import static org.basex.util.Token.*; import java.util.regex.*; import org.basex.util.*; /** * This class summarizes the result of a replacement. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class ReplaceContext { /** Replace string. */ final String replace; /** Search context. */ SearchContext search; /** Text. */ byte[] text; /** * Constructor. * @param rplc replacement text */ ReplaceContext(final String rplc) { replace = rplc; } /** * Replaces text. * @param sc search context * @param txt text * @param start start offset * @param end end offset * @return resulting end marker */ int[] replace(final SearchContext sc, final byte[] txt, final int start, final int end) { final int os = txt.length; search = sc; if(sc.search.isEmpty()) { text = txt; } else { final TokenBuilder tb = new TokenBuilder(os); tb.add(txt, 0, start); if(sc.regex) { // regular expressions, ignoring position arrays int flags = Pattern.DOTALL; if(!sc.mcase) flags |= Pattern.CASE_INSENSITIVE; final Pattern p = Pattern.compile(sc.search, flags); if(sc.multi) { tb.add(p.matcher(string(txt, start, end)).replaceAll(replace)); } else { for(int e = start, s = start; e <= end; e++) { if(e < end ? txt[e] == '\n' : e != s) { tb.add(p.matcher(string(txt, s, e - s)).replaceAll(replace)); if(e < end) tb.add('\n'); s = e + 1; } } } } else { final byte[] srch = token(sc.search); final byte[] rplc = token(replace); final int ss = srch.length; boolean s = true; int s1 = start; for(int o = start; o < end;) { int sp = 0; if(o + ss <= end && s) { if(sc.mcase) { while(sp < ss && txt[o + sp] == srch[sp]) sp++; } else { while(sp < ss && lc(cp(txt, o + sp)) == cp(srch, sp)) sp += cl(srch, sp); } } if(sp == ss && (!sc.word || o + ss == os || !Character.isLetterOrDigit(cp(txt, o + ss)))) { tb.add(txt, s1, o).add(rplc); o += ss; s1 = o; s = !sc.word; } else if(sc.word) { s = !Character.isLetterOrDigit(cp(txt, o)); o += cl(txt, o); } else { o++; } } tb.add(txt, s1, end); } tb.add(txt, end, os); text = tb.finish(); } return new int[] { start, end - os + text.length }; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/editor/SearchBar.java000066400000000000000000000215241222453003200257520ustar00rootroot00000000000000package org.basex.gui.editor; import static org.basex.core.Text.*; import static org.basex.gui.layout.BaseXKeys.*; import java.awt.*; import java.awt.event.*; import org.basex.gui.*; import org.basex.gui.GUIConstants.Fill; import org.basex.gui.editor.Editor.SearchDir; import org.basex.gui.layout.*; import org.basex.gui.layout.BaseXLayout.DropHandler; /** * This panel provides search and replace facilities. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class SearchBar extends BaseXBack { /** Escape key listener. */ private final KeyAdapter escape = new KeyAdapter() { @Override public void keyPressed(final KeyEvent e) { if(ESCAPE.is(e)) deactivate(true); } }; /** GUI reference. */ final GUI gui; /** Action: close panel. */ final BaseXButton cls; /** Search text. */ final BaseXTextField search; /** Replace text. */ final BaseXTextField replace; /** Mode: regular expression. */ final BaseXButton regex; /** Mode: match case. */ final BaseXButton mcase; /** Mode: whole word. */ final BaseXButton word; /** Mode: multi-line. */ final BaseXButton multi; /** Action: replace text. */ final BaseXButton rplc; /** Search button. */ BaseXButton button; /** Current editor reference. */ Editor editor; /** * Constructor. * @param main gui reference */ SearchBar(final GUI main) { layout(new BorderLayout(2, 0)); mode(Fill.NONE); setVisible(false); gui = main; search = new BaseXTextField(main); search.history(gui, GUIProp.SEARCHED); search.setToolTipText(SEARCH); search.setPreferredSize(null); replace = new BaseXTextField(main); replace.history(gui, GUIProp.REPLACED); replace.setToolTipText(REPLACE_WITH); replace.setPreferredSize(null); regex = onOffButton("s_regex", REGULAR_EXPR, GUIProp.SR_REGEX); mcase = onOffButton("s_case", MATCH_CASE, GUIProp.SR_CASE); word = onOffButton("s_word", WHOLE_WORD, GUIProp.SR_WORD); multi = onOffButton("s_multi", MULTI_LINE, GUIProp.SR_MULTI); rplc = new BaseXButton(main, "s_replace", REPLACE_ALL); cls = new BaseXButton(main, "s_close", CLOSE); multi.setEnabled(regex.isSelected()); word.setEnabled(!regex.isSelected()); // add interaction to search field search.addKeyListener(new KeyAdapter() { @Override public void keyPressed(final KeyEvent e) { if(FINDPREV.is(e) || FINDPREV2.is(e) || FINDNEXT.is(e) || FINDNEXT2.is(e)) { editor.text.noSelect(); deactivate(false); } else if(ESCAPE.is(e)) { deactivate(search.getText().isEmpty()); } else if(ENTER.is(e)) { editor.jump(e.isShiftDown() ? SearchDir.BACKWARD : SearchDir.FORWARD, true); } } @Override public void keyReleased(final KeyEvent e) { main.gprop.set(GUIProp.SR_SEARCH, search.getText()); search(); } }); BaseXLayout.addDrop(search, new DropHandler() { @Override public void drop(final Object object) { search.setText(object.toString()); search(); } }); replace.addKeyListener(escape); replace.addKeyListener(new KeyAdapter() { @Override public void keyReleased(final KeyEvent e) { main.gprop.set(GUIProp.SR_REPLACE, replace.getText()); } }); cls.addKeyListener(escape); cls.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { deactivate(true); } }); rplc.addKeyListener(escape); rplc.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { search.store(); replace.store(); final String in = replace.getText(); editor.replace(new ReplaceContext(regex.isSelected() ? decode(in) : in)); deactivate(true); } }); } /** * Sets the specified editor and updates the component layout. * @param e editor * @param srch triggers a search in the specified editor */ public void editor(final Editor e, final boolean srch) { final boolean ed = e.isEditable(); if(editor == null || ed != editor.isEditable()) { removeAll(); final BaseXBack wst = new BaseXBack(Fill.NONE).layout(new TableLayout(1, 4, 1, 0)); wst.add(mcase); wst.add(word); wst.add(regex); wst.add(multi); final BaseXBack ctr = new BaseXBack(Fill.NONE).layout(new GridLayout(1, 2, 2, 0)); ctr.add(search); if(ed) ctr.add(replace); final BaseXBack est = new BaseXBack(Fill.NONE).layout(new TableLayout(1, 3, 1, 0)); if(ed) est.add(rplc); est.add(cls); add(wst, BorderLayout.WEST); add(ctr, BorderLayout.CENTER); add(est, BorderLayout.EAST); } editor = e; refreshLayout(); e.setSearch(this); if(srch) search(false); } /** * Sets the search button. * @param b button */ public void setButton(final BaseXButton b) { button = b; button.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { if(isVisible()) deactivate(true); else activate(null, true); } }); } /** * Refreshes the layout. */ public void refreshLayout() { if(editor == null) return; final Font ef = GUIConstants.mfont.deriveFont(7f + (GUIConstants.fontSize >> 1)); search.setFont(ef); replace.setFont(ef); } /** * Activates the search bar. * @param string search string; triggers a new search if it differs from old string. * Will be ignored if set to {@code null} * @param focus indicates if text field should be focused */ public void activate(final String string, final boolean focus) { boolean action = !isVisible(); if(action) { setVisible(true); if(button != null) button.setSelected(true); } if(focus) search.requestFocusInWindow(); // set new, different search string if(string != null && !new SearchContext(this, search.getText()).matches(string)) { search.setText(string); regex.setSelected(false); action = true; } // search if string has changed, or if panel was hidden if(action) search(); } /** * Deactivates the search bar. * @param close close bar * @return {@code true} if panel was closed */ public boolean deactivate(final boolean close) { search.store(); editor.requestFocusInWindow(); if(!close || !isVisible()) return false; setVisible(false); if(button != null) button.setSelected(false); search(); return true; } /** * Searches text in the current editor. */ void search() { search(true); } /** * Searches text in the current editor. * @param jump jump to next hit */ void search(final boolean jump) { final String text = isVisible() ? search.getText() : ""; editor.search(new SearchContext(this, text), jump); } /** * Refreshes the panel for the specified context. * @param sc search context */ void refresh(final SearchContext sc) { final boolean nohits = sc.nr == 0; final boolean empty = sc.search.isEmpty(); rplc.setEnabled(!nohits && !empty); search.setBackground(nohits && !empty ? GUIConstants.LRED : GUIConstants.WHITE); } // PRIVATE METHODS ==================================================================== /** * Returns a button that can be switched on and off. * @param icon name of icon * @param help help text * @param option GUI option * @return button */ private BaseXButton onOffButton(final String icon, final String help, final Object[] option) { final BaseXButton b = new BaseXButton(gui, icon, help); b.setSelected(gui.gprop.is(option)); b.addKeyListener(escape); b.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final boolean sel = !b.isSelected(); b.setSelected(sel); gui.gprop.set(option, sel); if(b == regex) { multi.setEnabled(sel); word.setEnabled(!sel); } search(); } }); return b; } /** * Decodes the specified string and replaces backslashed n's and t's with * newlines and tab characters. * @param in input * @return decoded string */ static String decode(final String in) { final StringBuilder sb = new StringBuilder(); boolean bs = false; for(int i = 0; i < in.length(); i++) { final char ch = in.charAt(i); if(bs) { if(ch == 'n') { sb.append('\n'); } else if(ch == 't') { sb.append('\t'); } else { sb.append('\\'); if(ch != '\\') sb.append(ch); } bs = false; } else { if(ch == '\\') bs = true; else sb.append(ch); } } if(bs) sb.append('\\'); return sb.toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/editor/SearchContext.java000066400000000000000000000122061222453003200266670ustar00rootroot00000000000000package org.basex.gui.editor; import static org.basex.util.Token.*; import java.util.*; import java.util.regex.*; import org.basex.util.*; import org.basex.util.list.*; /** * This class summarizes the result of a search. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class SearchContext { /** Search bar. */ final SearchBar bar; /** Mode: match case. */ final boolean mcase; /** Mode: regular expression. */ final boolean regex; /** Mode: multi-line. */ final boolean multi; /** Mode: whole word. */ final boolean word; /** Search string. */ final String search; /** Number of results. */ int nr; /** * Constructor. * @param sb search bar * @param text search string */ SearchContext(final SearchBar sb, final String text) { bar = sb; mcase = sb.mcase.isSelected(); word = sb.word.isSelected(); regex = sb.regex.isSelected(); multi = sb.multi.isSelected(); String s = mcase ? text : text.toLowerCase(Locale.ENGLISH); // speed up regular expressions starting with wildcards if(regex && (s.startsWith(".*") || s.startsWith("(.*") || s.startsWith(".+") || s.startsWith("(.+"))) s = '^' + s; search = s; } /** * Performs the search. * @param txt text to be searched * @return result positions */ IntList[] search(final byte[] txt) { final IntList start = new IntList(); final IntList end = new IntList(); if(!search.isEmpty()) { if(regex) searchRegEx(start, end, txt); else searchSimple(start, end, txt); } nr = start.size(); bar.refresh(this); return new IntList[] { start, end }; } /** * Runs a query using regular expressions. * @param start start positions * @param end end positions * @param text text to be searched */ private void searchRegEx(final IntList start, final IntList end, final byte[] text) { int flags = Pattern.DOTALL; if(!mcase) flags |= Pattern.CASE_INSENSITIVE; final Pattern pattern = Pattern.compile(search, flags); if(multi) { int c = 0, p = 0; final Matcher m = pattern.matcher(string(text)); while(m.find()) { final int s = m.start(), e = m.end(); while(c < s) { p += cl(text, p); c++; } start.add(p); while(c < e) { p += cl(text, p); c++; } end.add(p); } } else { final int os = text.length; final TokenBuilder tb = new TokenBuilder(os); for(int t = 0, o = 0; o <= os; o++) { if(o < os ? text[o] == '\n' : o != t) { int c = 0, p = t; final Matcher m = pattern.matcher(string(text, t, o - t)); while(m.find()) { final int s = m.start(), e = m.end(); while(c < s) { p += cl(text, p); c++; } start.add(p); while(c < e) { p += cl(text, p); c++; } end.add(p); } if(o < os) tb.add('\n'); t = o + 1; } } } } /** * Runs a simple query. * @param start start positions * @param end end positions * @param text text to be searched */ private void searchSimple(final IntList start, final IntList end, final byte[] text) { final byte[] srch = token(search); final int ss = srch.length, os = text.length; boolean s = true; for(int o = 0; o < os;) { int sp = 0; if(o + ss <= os && s) { if(mcase) { while(sp < ss && text[o + sp] == srch[sp]) sp++; } else { while(sp < ss && lc(cp(text, o + sp)) == cp(srch, sp)) sp += cl(srch, sp); } } if(sp == ss && (!word || o + ss == os || !Character.isLetterOrDigit(cp(text, o + ss)))) { start.add(o); end.add(o + ss); o += ss; s = !word; } else if(word) { s = !Character.isLetterOrDigit(cp(text, o)); o += cl(text, o); } else { o++; } } } /** * Checks if the specified string matches the search string. * @param string string to be checked * @return result of check */ boolean matches(final String string) { // ignore empty strings and others that stretch over multiple lines if(string.isEmpty() || string.contains("\n")) return true; if(regex) { try { int flags = Pattern.DOTALL; if(!mcase) flags |= Pattern.CASE_INSENSITIVE; final Pattern pattern = Pattern.compile(search, flags); return pattern.matcher(string).matches(); } catch(final Exception ex) { return false; } } return mcase ? search.equals(string) : search.equalsIgnoreCase(string); } /** * Returns the number of results. * @return number of results */ int nr() { return nr; } @Override public boolean equals(final Object obj) { if(!(obj instanceof SearchContext)) return false; final SearchContext s = (SearchContext) obj; return mcase == s.mcase && word == s.word && regex == s.regex && multi == s.multi && eq(search, s.search); } @Override public int hashCode() { return super.hashCode(); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/editor/SearchEditor.java000066400000000000000000000025211222453003200264700ustar00rootroot00000000000000package org.basex.gui.editor; import java.awt.*; import javax.swing.*; import org.basex.gui.*; import org.basex.gui.GUIConstants.Fill; import org.basex.gui.layout.*; /** * This class displays editor components with an integrated search bar. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class SearchEditor extends BaseXBack { /** Search bar. */ final SearchBar search; /** * Constructor. * @param gui gui reference * @param editor editor */ public SearchEditor(final GUI gui, final Editor editor) { this(gui, editor, editor); } /** * Constructor. * @param gui gui reference * @param center centered component * @param editor editor (may be {@code null}) */ public SearchEditor(final GUI gui, final JComponent center, final Editor editor) { super(Fill.NONE); search = new SearchBar(gui); layout(new BorderLayout(0, 2)); add(center, BorderLayout.CENTER); add(search, BorderLayout.SOUTH); if(editor != null) search.editor(editor, false); } /** * Return search bar. * @return search bar */ public SearchBar bar() { return search; } /** * Sets the search button. * @param b button * @return self reference */ public SearchEditor button(final BaseXButton b) { search.setButton(b); return this; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/editor/Syntax.java000066400000000000000000000027651222453003200254140ustar00rootroot00000000000000package org.basex.gui.editor; import static org.basex.util.Token.*; import java.awt.*; import org.basex.gui.*; /** * This abstract class defines a framework for a simple syntax * highlighting in text panels. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ abstract class Syntax { /** Standard color. */ protected static final Color TEXT = Color.BLACK; /** Comment color. */ protected static final Color COMMENT = new Color(0, 160, 160); /** String color. */ protected static final Color STRING = GUIConstants.RED; /** Keyword color. */ protected static final Color KEYWORD = GUIConstants.BLUE; /** Function color. */ protected static final Color FUNCTION = new Color(160, 0, 160); /** Variable color. */ protected static final Color VARIABLE = GUIConstants.GREEN; /** Simple syntax. */ static final Syntax SIMPLE = new Syntax() { @Override public void init() { } @Override public Color getColor(final EditorText tokens) { return TEXT; } }; /** * Initializes the highlighter. */ public abstract void init(); /** * Returns the color for the current token. * @param tokens tokenizer * @return color */ public abstract Color getColor(final EditorText tokens); /** * Returns the start of a comment. * @return comment start */ public byte[] commentOpen() { return EMPTY; } /** * Returns the end of a comment. * @return comment end */ public byte[] commentEnd() { return EMPTY; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/editor/SyntaxJSON.java000066400000000000000000000013151222453003200260740ustar00rootroot00000000000000package org.basex.gui.editor; import java.awt.*; /** * This class defines syntax highlighting for JSON files. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class SyntaxJSON extends Syntax { /** Quoted flag. */ private boolean quoted; @Override public void init() { quoted = false; } @Override public Color getColor(final EditorText text) { final int ch = text.curr(); final boolean quote = text.curr() == '"'; Color color = quoted || quote ? KEYWORD : TEXT; if(!quoted) { if("{}[]".indexOf(ch) != -1) color = STRING; if(":,".indexOf(ch) != -1) color = FUNCTION; } if(quote) quoted ^= true; return color; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/editor/SyntaxXML.java000066400000000000000000000054131222453003200257660ustar00rootroot00000000000000package org.basex.gui.editor; import static org.basex.data.DataText.*; import java.awt.*; /** * This class defines syntax highlighting for XML files. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class SyntaxXML extends Syntax { /** Last quote. */ private int quote; /** Tag flag. */ private boolean tag; /** Flag for printing element name. */ private boolean elem; /** Current state of comment. */ private int comment; /** Current state of processing instruction. */ private int pi; @Override public void init() { quote = 0; tag = false; elem = false; comment = 0; pi = 0; } @Override public Color getColor(final EditorText text) { final int ch = text.curr(); if(comment > 0) return comment(ch); if(pi > 0) return pi(ch); // last token was an opening angle bracket (<) if(tag) { if(quote != 0) { if(quote == ch) quote = 0; return STRING; } if(ch == '"' || ch == '\'') { quote = ch; return STRING; } if(ch == '>') { tag = false; return KEYWORD; } if(ch == '=' || ch == '/') { return KEYWORD; } if(ch == '!') { comment = 1; tag = false; return COMMENT; } if(ch == '?') { pi = 1; tag = false; return FUNCTION; } if(elem) { if(ch <= ' ') elem = false; return KEYWORD; } return FUNCTION; } // start of a new element, comment or processing instruction if(ch == '<') { tag = true; elem = true; return KEYWORD; } return TEXT; } /** * Processes a comment or doctype declaration. * @param ch current character * @return color */ private Color comment(final int ch) { switch(comment) { // "' ? 0 : 3; break; // "" case 6: if(ch == '>') comment = 0; break; } return comment > 0 ? COMMENT : KEYWORD; } /** * Processes a processing instruction. * @param ch current character * @return color */ private Color pi(final int ch) { switch(pi) { // "' ? 0 : 1; break; } return pi > 0 ? FUNCTION : KEYWORD; } @Override public byte[] commentOpen() { return COMM_O; } @Override public byte[] commentEnd() { return COMM_C; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/editor/SyntaxXQuery.java000066400000000000000000000064641222453003200265720ustar00rootroot00000000000000package org.basex.gui.editor; import static org.basex.data.DataText.*; import java.awt.*; import java.lang.reflect.*; import java.util.*; import org.basex.core.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.func.*; import org.basex.util.*; /** * This class defines syntax highlighting for XQuery files. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class SyntaxXQuery extends Syntax { /** Error color. */ private static final HashSet KEYS = new HashSet(); /** Error color. */ private static final HashSet FUNC = new HashSet(); /** Comment. */ private int comment; /** Last quote. */ private int quote; /** Variable flag. */ private boolean var; /** Function flag. */ private boolean fun; // initialize xquery keys static { try { // add query tokens for(final Field f : QueryText.class.getFields()) { if(f.getName().equals("IGNORE")) break; final String s = (String) f.get(null); Collections.addAll(KEYS, s.split("-")); } // add function names for(final Function f : Function.values()) { final String s = f.toString(); Collections.addAll(FUNC, s.substring(0, s.indexOf('(')).split(":|-")); } // add serialization and database parameters addProps(SerializerProp.class); addProps(MainProp.class); addProps(Prop.class); } catch(final Exception ex) { Util.stack(ex); } } /** * Adds the specified properties. * @param props property class * @throws Exception exception */ private static void addProps(final Class props) throws Exception { for(final Object[] arr : AProp.props(props)) { if(arr.length < 2) continue; Collections.addAll(FUNC, arr[0].toString().toLowerCase(Locale.ENGLISH).split("-")); } } @Override public void init() { quote = 0; var = false; comment = 0; } @Override public Color getColor(final EditorText text) { final int ch = text.curr(); // opened quote if(quote != 0) { if(ch == quote) quote = 0; return STRING; } // comment if(comment == 0 && ch == '(') { comment++; } else if(comment == 1) { comment = ch == ':' ? 2 : 0; } else if(comment == 2 && ch == ':') { comment++; } else if(comment == 3 && ch != ':') { comment = ch == ')' ? 0 : 2; } if(comment != 0) return COMMENT; // quotes if(ch == '"' || ch == '\'') { quote = ch; return STRING; } // variables if(ch == '$') { var = true; return VARIABLE; } if(var) { var = XMLToken.isChar(ch); return VARIABLE; } // special characters if(!XMLToken.isNCChar(ch)) { fun = false; return COMMENT; } // check for keywords and function names final String word = text.nextString(); final boolean keys = KEYS.contains(word); final boolean func = FUNC.contains(word); if(fun && func) return FUNCTION; if(keys) return KEYWORD; if(func) { fun = true; return FUNCTION; } // letters and numbers return TEXT; } @Override public byte[] commentOpen() { return XQCOMM_O; } @Override public byte[] commentEnd() { return XQCOMM_C; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/000077500000000000000000000000001222453003200233005ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/BaseXBack.java000066400000000000000000000063741222453003200257400ustar00rootroot00000000000000package org.basex.gui.layout; import java.awt.*; import java.util.*; import javax.swing.*; import javax.swing.border.*; import org.basex.gui.*; import org.basex.gui.GUIConstants.Fill; import org.basex.util.*; /** * Panel background, extending the {@link JPanel}. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class BaseXBack extends JPanel { /** Desktop hints. */ private static final Map HINTS = (Map) Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints"); /** Flag for adding rendering hints. */ private static boolean hints = true; /** Fill mode. */ private Fill mode; /** * Default constructor. */ public BaseXBack() { this(Fill.PLAIN); } /** * Constructor, specifying the fill mode. * @param m visualization mode */ public BaseXBack(final Fill m) { mode(m); } /** * Constructor, specifying an empty border. * @param t top distance * @param l left distance * @param b bottom distance * @param r right distance */ public BaseXBack(final int t, final int l, final int b, final int r) { this(); border(t, l, b, r); } /** * Constructor, specifying a layout manager. * @param lm layout manager */ public BaseXBack(final LayoutManager lm) { this(); layout(lm); } /** * Sets the specified fill mode. * @param m visualization mode * @return self reference */ public final BaseXBack mode(final Fill m) { mode = m; final boolean o = mode != Fill.NONE; if(isOpaque() != o) setOpaque(o); return this; } @Override public void paintComponent(final Graphics g) { if(mode == Fill.GRADIENT) { final Color c1 = GUIConstants.WHITE; final Color c2 = GUIConstants.color1; BaseXLayout.fill(g, c1, c2, 0, 0, getWidth(), getHeight()); } else { super.paintComponent(g); } // rendering hints are not supported by all platforms if(hints) { try { ((Graphics2D) g).addRenderingHints(HINTS); } catch(final Exception ex) { Util.debug(ex); hints = false; } } } /** * Sets an empty border with the specified margins. * @param t top distance * @param l left distance * @param b bottom distance * @param r right distance * @return self reference */ public final BaseXBack border(final int t, final int l, final int b, final int r) { setBorder(new EmptyBorder(t, l, b, r)); return this; } /** * Sets an empty border with the specified margin. * @param m margin * @return self reference */ public final BaseXBack border(final int m) { return border(m, m, m, m); } /** * Sets the layout manager for this container. * @param lm layout manager * @return self reference */ public final BaseXBack layout(final LayoutManager lm) { setLayout(lm); return this; } /** * Activates graphics anti-aliasing. * @param g graphics reference */ protected static final void smooth(final Graphics g) { ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/BaseXBar.java000066400000000000000000000153011222453003200255720ustar00rootroot00000000000000package org.basex.gui.layout; import java.awt.*; import java.awt.event.*; import org.basex.gui.*; import org.basex.gui.GUIConstants.Fill; import org.basex.util.*; /** * This is a scrollbar implementation, supporting arbitrary * panel heights without increasing the memory consumption. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BaseXBar extends BaseXPanel { /** Scrollbar size. */ public static final int SIZE = 16; /** Maximum scrolling speed. */ private static final int MAXSTEP = 15; /** Animated scrollbar zooming steps. */ static final int[] STEPS = { -MAXSTEP, -14, -11, -8, -6, -4, -3, -2, -1, -1, 0, 0, 1, 1, 2, 3, 4, 6, 8, 11, 14, MAXSTEP }; /** Minimum size for the scrollbar slider. */ private static final int MINSIZE = 20; /** Reference to the scrolled component. */ final BaseXPanel comp; /** Scrollbar width. */ final int ww; /** Current scrolling speed. */ int step = STEPS.length / 2; /** Flag reporting if the scrollbar animation is running. */ boolean animated; /** Scrollbar height. */ int hh; /** Scrollbar slider position. */ int barPos; /** Scrollbar slider size. */ int barSize; /** Scrollbar dragging position. */ int dragPos; /** Flag for button clicks. */ boolean button; /** Flag for scrolling downward. */ boolean down; /** Flag for sliding the scrollbar. */ boolean sliding; /** Flag for moving upward. */ boolean moving; /** Current panel position. */ int pos; /** Current panel height. */ int height; /** Flag for scrolling upward. */ private boolean up; /** Scrollbar slider offset. */ private int barOffset; /** Flag for permanent scrollbar visibility. */ private final boolean visible; /** * Default constructor. By default, the scrollbar is switched off * if the component is completely displayed. * @param cmp reference to the scrolled component */ public BaseXBar(final BaseXPanel cmp) { this(cmp, false); } /** * Default constructor, allowing to modify the scrollbar visibility. * @param cmp reference to the scrolled component * @param vis states if scrollbar is always visible or hidden when * the displayed content needs no scrollbar */ private BaseXBar(final BaseXPanel cmp, final boolean vis) { super(cmp.gui); comp = cmp; visible = vis; addMouseListener(this); addKeyListener(this); addMouseMotionListener(this); mode(Fill.NONE); BaseXLayout.setWidth(this, SIZE); ww = SIZE; } /** * Sets the vertical scrollbar slider position. * @param p vertical position */ public void pos(final int p) { final int pp = Math.max(0, Math.min(height - getHeight(), p)); if(pos == pp) return; pos = pp; repaint(); } /** * Returns the vertical scrollbar slider position. * @return vertical position */ public int pos() { return pos; } /** * Sets the panel height. * @param h panel height */ public void height(final int h) { if(height != h) { height = h; repaint(); } } @Override public void paintComponent(final Graphics g) { hh = getHeight(); super.paintComponent(g); if(!visible && hh >= height) return; // calculate bar size final int barH = hh - ww * 2 + 4; final float factor = (barH - barOffset) / (float) height; int size = (int) (hh * factor); // define minimum size for scrollbar mover barOffset = size < MINSIZE ? MINSIZE - size : 0; size += barOffset; barSize = Math.min(size, barH - 1); barPos = (int) Math.max(0, Math.min(pos * factor, barH - barSize)); // paint scrollbar background g.setColor(GUIConstants.LGRAY); g.fillRect(0, 0, ww, hh); // draw scroll slider int bh = ww - 2 + barPos; BaseXLayout.drawCell(g, 0, ww, bh, bh + barSize, false); bh += barSize >> 1; g.setColor(GUIConstants.DGRAY); g.drawLine(5, bh, ww - 6, bh); g.drawLine(5, bh - 2, ww - 6, bh - 2); g.drawLine(5, bh + 2, ww - 6, bh + 2); smooth(g); // draw scroll buttons drawButton(g, new int[][] { { 0, 6, 3 }, { 6, 6, 0 } }, 0, button && up); drawButton(g, new int[][] { { 0, 6, 3 }, { 0, 0, 6 } }, Math.max(SIZE, hh - ww), button && down); // paint scrollbar lines g.setColor(GUIConstants.GRAY); g.drawLine(0, 0, 0, hh); g.drawLine(ww - 1, 0, ww - 1, hh); } /** * Draws the down/up button. * @param g graphics reference * @param pol polygons * @param y vertical start value * @param focus focus flag */ private void drawButton(final Graphics g, final int[][] pol, final int y, final boolean focus) { BaseXLayout.drawCell(g, 0, ww, y, y + ww, focus); for(int i = 0; i < pol[0].length; ++i) { pol[0][i] += SIZE / 2 - 3; pol[1][i] += y + SIZE / 2 - 3; } g.setColor(focus ? Color.black : GUIConstants.DGRAY); g.fillPolygon(pol[0], pol[1], 3); } @Override public void mousePressed(final MouseEvent e) { final int y = e.getY(); sliding = y > ww + barPos && y < ww + barPos + barSize; moving = !sliding; up = y < ww + barPos; down = y > ww + barPos + barSize; button = y < ww || y > hh - ww; if(sliding) dragPos = barPos - y; // start dragging if(sliding || animated) return; new Thread() { @Override public void run() { // scroll up/down/move slider animated = moving; while(animated) { if(moving) step = Math.max(0, Math.min(STEPS.length - 1, step + (down ? 1 : -1))); else step += step < STEPS.length / 2 ? 1 : -1; int offset = STEPS[step]; if(!button) offset = offset * hh / MAXSTEP / 4; pos = Math.max(0, Math.min(height - hh, pos + offset)); comp.repaint(); Performance.sleep(25); animated = step != STEPS.length / 2; if(y > ww + barPos && y < ww + barPos + barSize) { dragPos = barPos - y; animated = false; sliding = true; step = STEPS.length / 2; } } } }.start(); } @Override public void mouseReleased(final MouseEvent e) { up = false; down = false; moving = false; sliding = false; comp.repaint(); } @Override public void mouseDragged(final MouseEvent e) { // no dragging... if(!sliding) return; pos = (int) ((long) (e.getY() + dragPos) * height / (hh - ww * 2)); pos = Math.max(0, Math.min(height - hh, pos)); comp.repaint(); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/BaseXButton.java000066400000000000000000000054261222453003200263500ustar00rootroot00000000000000package org.basex.gui.layout; import static org.basex.core.Text.*; import static org.basex.gui.layout.BaseXKeys.*; import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; import javax.swing.border.*; import org.basex.gui.*; /** * Project specific button implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class BaseXButton extends JButton { /** * Constructor for text buttons. * @param l button title * @param win parent window */ public BaseXButton(final String l, final Window win) { super(l); BaseXLayout.addInteraction(this, win); if(!(win instanceof BaseXDialog)) return; final BaseXDialog d = (BaseXDialog) win; addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final String text = getText(); if(text.equals(B_CANCEL)) d.cancel(); else if(text.equals(B_OK)) d.close(); else d.action(e.getSource()); } }); addKeyListener(new KeyAdapter() { @Override public void keyPressed(final KeyEvent e) { if(ESCAPE.is(e)) d.cancel(); } }); BaseXLayout.setMnemonic(this, d.mnem); } /** * Constructor for image buttons. * @param gui main window * @param img image reference * @param hlp help text */ public BaseXButton(final Window gui, final String img, final String hlp) { super(BaseXLayout.icon(img)); BaseXLayout.addInteraction(this, gui); if(hlp != null) setToolTipText(hlp); setOpaque(false); // trim horizontal button margins final Insets in = getMargin(); in.left /= 4; in.right /= 4; if(in.top < in.left) setMargin(in); } /** * Sets the label borders. * @param t top distance * @param l left distance * @param b bottom distance * @param r right distance * @return self reference */ public BaseXButton border(final int t, final int l, final int b, final int r) { setBorder(new EmptyBorder(t, l, b, r)); return this; } /** * Creates a new image button for the specified command. * @param cmd command * @param gui reference to main window * @return button */ public static BaseXButton command(final GUICmd cmd, final GUI gui) { final BaseXButton button = new BaseXButton(gui, cmd.toString().toLowerCase(Locale.ENGLISH), cmd.help()); button.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { cmd.execute(gui); } }); return button; } @Override public void setEnabled(final boolean flag) { if(flag != isEnabled()) super.setEnabled(flag); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/BaseXCheckBox.java000066400000000000000000000030761222453003200265620ustar00rootroot00000000000000package org.basex.gui.layout; import java.awt.*; import java.awt.event.*; import javax.swing.*; /** * Project specific CheckBox implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BaseXCheckBox extends JCheckBox { /** * Checkbox. * @param txt checkbox text * @param sel initial selection state * @param win parent window */ public BaseXCheckBox(final String txt, final boolean sel, final Window win) { this(txt, sel, 1, win); } /** * Constructor. * @param label checkbox text * @param sel initial selection state * @param dist distance to next component * @param win parent window */ public BaseXCheckBox(final String label, final boolean sel, final int dist, final Window win) { super(label, sel); setOpaque(false); setMargin(new Insets(0, 0, dist, 0)); if(dist == 0) setFont(getFont().deriveFont(Font.BOLD)); BaseXLayout.addInteraction(this, win); if(!(win instanceof BaseXDialog)) return; final BaseXDialog dialog = (BaseXDialog) win; BaseXLayout.setMnemonic(this, dialog.mnem); addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { dialog.action(e.getSource()); } }); } /** * Chooses a large font. * @return self reference */ public BaseXCheckBox large() { final Font f = getFont(); setFont(new Font(f.getName(), Font.PLAIN, (int) f.getSize2D() + 4)); return this; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/BaseXCombo.java000066400000000000000000000015051222453003200261260ustar00rootroot00000000000000package org.basex.gui.layout; import java.awt.*; import java.awt.event.*; import javax.swing.*; /** * Project specific ComboBox implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BaseXCombo extends JComboBox { /** * Constructor. * @param ch combobox choices * @param win parent window */ public BaseXCombo(final Window win, final String... ch) { super(ch); BaseXLayout.addInteraction(this, win); if(!(win instanceof BaseXDialog)) return; addItemListener(new ItemListener() { @Override public void itemStateChanged(final ItemEvent ie) { if(isValid() && ie.getStateChange() == ItemEvent.SELECTED) { ((BaseXDialog) win).action(ie.getSource()); } } }); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/BaseXDSlider.java000066400000000000000000000207321222453003200264200ustar00rootroot00000000000000package org.basex.gui.layout; import static org.basex.gui.GUIConstants.*; import static org.basex.gui.layout.BaseXKeys.*; import java.awt.*; import java.awt.event.*; import org.basex.gui.GUIConstants.Fill; /** * DoubleSlider implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BaseXDSlider extends BaseXPanel { /** Slider width. */ private static final int ARROW = 17; /** Label space. */ public static final int LABELW = 300; /** Minimum slider value. */ public final double totMin; /** Maximum slider value. */ public final double totMax; /** Current slider value. */ public double min; /** Current slider value. */ public double max; /** Integer flag. */ public boolean itr; /** Listener. */ private final ActionListener listener; /** Cached slider value. */ private double oldMin; /** Cached slider value. */ private double oldMax; /** Mouse position for dragging operations. */ private int mouX; /** Left button flag. */ private boolean left; /** Right button flag. */ private boolean right; /** Right button flag. */ private boolean center; /** Logarithmic scale. */ private final boolean log; /** * Constructor. * @param mn min value * @param mx max value * @param main reference to the main window * @param list listener */ public BaseXDSlider(final double mn, final double mx, final Window main, final ActionListener list) { super(main); listener = list; totMin = mn; totMax = mx; min = mn; max = mx; // choose logarithmic scaling for larger ranges log = Math.log(totMax) - Math.log(totMin) > 5 && totMax - totMin > 100; mode(Fill.NONE).setFocusable(true); BaseXLayout.setHeight(this, getFont().getSize() + 9); BaseXLayout.setWidth(this, 200 + LABELW); addFocusListener(new FocusAdapter() { @Override public void focusGained(final FocusEvent e) { repaint(); } @Override public void focusLost(final FocusEvent e) { repaint(); } }); addKeyListener(this); addMouseListener(this); addMouseMotionListener(this); setToolTip(); } @Override public void mouseMoved(final MouseEvent e) { mouX = e.getX(); final Range r = new Range(this); left = mouX >= r.xs && mouX <= r.xs + ARROW; right = mouX >= r.xe && mouX <= r.xe + ARROW; center = mouX + ARROW > r.xs && mouX < r.xe; oldMin = encode(min); oldMax = encode(max); } @Override public void mousePressed(final MouseEvent e) { mouseMoved(e); } @Override public void mouseDragged(final MouseEvent e) { if(!left && !right && !center) return; final Range r = new Range(this); final double prop = r.dist * (mouX - e.getX()) / r.w; if(left) { min = limit(totMin, max, decode(oldMin - prop) - 1); } else if(right) { max = limit(min, totMax, decode(oldMax - prop) - 1); } else { min = limit(totMin, totMax, decode(oldMin - prop) - 1); max = limit(totMin, totMax, decode(oldMax - prop) - 1); } if(itr) { min = (long) min; max = (long) max; } listener.actionPerformed(null); setToolTip(); repaint(); } /** * Sets a new tooltip. */ private void setToolTip() { final double mn = (long) (min * 100) / 100.0; final double mx = (long) (max * 100) / 100.0; setToolTipText(BaseXLayout.value(mn) + " - " + BaseXLayout.value(mx)); } @Override public void mouseReleased(final MouseEvent e) { left = false; right = false; center = false; } @Override public void keyPressed(final KeyEvent e) { oldMin = min; oldMax = min; double diffMin = 0; double diffMax = 0; if(PREV.is(e)) { diffMin = -1; diffMax = -1; } else if(NEXT.is(e)) { diffMin = 1; diffMax = 1; } else if(PREVLINE.is(e)) { diffMin = -1; diffMax = 1; } else if(NEXTLINE.is(e)) { diffMin = 1; diffMax = -1; } else if(LINESTART.is(e)) { min = totMin; } else if(LINEEND.is(e)) { max = totMax; } if(e.isShiftDown()) { diffMin /= 10; diffMax /= 10; } final double dist = encode(totMax) - encode(totMin); diffMin = dist / 20 * diffMin; diffMax = dist / 20 * diffMax; if(diffMin != 0) { min = limit(totMin, max, decode(Math.max(0, encode(min) + diffMin))); } if(diffMax != 0) { max = limit(min, totMax, decode(Math.max(0, encode(max) + diffMax))); } if(min != oldMin || max != oldMax) { if(itr) { if(min != oldMin) min = min > oldMin ? Math.max(oldMin + 1, (long) min) : Math.min(oldMin - 1, (long) min); if(max != oldMax) max = max > oldMax ? Math.max(oldMax + 1, (long) max) : Math.min(oldMax - 1, (long) max); } listener.actionPerformed(null); repaint(); } } @Override public void paintComponent(final Graphics g) { super.paintComponent(g); final int w = getWidth() - LABELW; final int h = getHeight(); final int hh = h / 2; final boolean focus = hasFocus(); g.setColor(focus ? Color.white : WHITE); g.fillRect(0, hh - 4, w, 8); g.setColor(Color.black); g.drawLine(0, hh - 4, w - 1, hh - 4); g.drawLine(0, hh - 4, 0, hh + 4); g.setColor(color2); g.drawLine(w - 1, hh - 4, w - 1, hh + 4); g.drawLine(0, hh + 4, w, hh + 4); final Range r = new Range(this); BaseXLayout.drawCell(g, r.xs, r.xe + ARROW, 2, h - 2, false); if(r.xs + ARROW < r.xe) { g.setColor(color4); g.drawLine(r.xs + ARROW, 3, r.xs + ARROW, h - 4); g.drawLine(r.xe - 1, 3, r.xe - 1, h - 4); g.setColor(Color.white); if(r.xs + ARROW + 2 < r.xe) { g.drawLine(r.xs + ARROW + 1, 4, r.xs + ARROW + 1, h - 5); g.drawLine(r.xe, 4, r.xe, h - 5); } g.drawLine(r.xs + ARROW - 1, 4, r.xs + ARROW - 1, h - 5); g.drawLine(r.xe - 2, 4, r.xe - 2, h - 5); } // draw arrows final Polygon pol = new Polygon( new int[] { r.xs + 11, r.xs + 5, r.xs + 5, r.xs + 11 }, new int[] { hh - 5, hh - 1, hh, hh + 5 }, 4); g.setColor(focus ? color4 : GRAY); g.fillPolygon(pol); pol.xpoints = new int[] { r.xe + 5, r.xe + 12, r.xe + 12, r.xe + 5 }; g.fillPolygon(pol); g.setColor(focus ? Color.black : DGRAY); g.drawLine(r.xs + 11, hh - 5, r.xs + 11, hh + 4); g.drawLine(r.xs + 11, hh - 5, r.xs + 6, hh - 1); g.drawLine(r.xe + 5, hh - 5, r.xe + 5, hh + 4); g.drawLine(r.xe + 5, hh - 5, r.xe + 11, hh - 1); g.setColor(Color.white); g.drawLine(r.xs + 10, hh + 4, r.xs + 6, hh + 1); g.drawLine(r.xe + 6, hh + 4, r.xe + 11, hh + 1); // draw range info g.setColor(Color.black); final double mn = (long) (min * 100) / 100.0; final double mx = (long) (max * 100) / 100.0; g.drawString(BaseXLayout.value(mn) + " - " + BaseXLayout.value(mx), w + 15, h - (h - getFont().getSize()) / 2); } /** * Encodes the specified value. * @param v value to be normalized * @return new value */ double encode(final double v) { return log ? Math.log(v + 1) : v; } /** * Decodes the specified value. * @param v value to be normalized * @return new value */ private double decode(final double v) { return log ? Math.exp(v) - 1 : v; } /** * Returns a double in the specified minimum and maximum range. * @param mn minimum value * @param mx maximum value * @param val value * @return new value */ private static double limit(final double mn, final double mx, final double val) { return Math.max(mn, Math.min(mx, val)); } /** Range class. */ private static class Range { /** Range distance. */ final double dist; /** Start position. */ final int xs; /** End position. */ final int xe; /** Slider width. */ final int w; /** * Constructor. * @param s slider reference */ Range(final BaseXDSlider s) { w = s.getWidth() - LABELW - ARROW * 2; dist = s.encode(s.totMax - s.totMin); xs = (int) (s.encode(s.min - s.totMin) * w / dist); xe = (s.totMin == s.totMax ? w : (int) (s.encode(s.max - s.totMin) * w / dist)) + ARROW; } } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/BaseXDialog.java000066400000000000000000000161251222453003200262720ustar00rootroot00000000000000package org.basex.gui.layout; import static org.basex.core.Text.*; import static org.basex.gui.layout.BaseXKeys.*; import java.awt.*; import java.awt.event.*; import java.net.*; import javax.swing.*; import org.basex.gui.*; import org.basex.gui.GUIConstants.Fill; import org.basex.gui.GUIConstants.Msg; import org.basex.gui.dialog.*; import org.basex.util.*; /** * This superclass in inherited by all dialog windows. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class BaseXDialog extends JDialog { /** Used mnemonics. */ public final StringBuilder mnem = new StringBuilder(); /** Reference to main window. */ public GUI gui; /** Remembers if the window was correctly closed. */ public boolean ok; /** Reference to the root panel. */ public BaseXBack panel; /** Dialog position. */ private int[] loc; /** Key listener, triggering an action with each click. */ public final KeyAdapter keys = new KeyAdapter() { @Override public void keyReleased(final KeyEvent e) { // don't trigger any action for modifier keys if(!modifier(e)) action(e.getSource()); } }; /** * Constructor, called from a dialog window. * @param d calling dialog * @param title dialog title */ public BaseXDialog(final BaseXDialog d, final String title) { super(d, title, true); init(d.gui); } /** * Constructor, called from the main window. * @param main reference to main window * @param title dialog title */ public BaseXDialog(final GUI main, final String title) { this(main, title, true); } /** * Constructor, called from the main window. * @param main reference to the main window * @param title dialog title * @param modal modal flag */ public BaseXDialog(final GUI main, final String title, final boolean modal) { super(main, title, modal); init(main); } /** * Initializes the dialog. * @param main reference to the main window */ void init(final GUI main) { gui = main; panel = new BaseXBack(new BorderLayout()).border(10, 10, 10, 10); add(panel, BorderLayout.CENTER); setResizable(false); addWindowListener(new WindowAdapter() { @Override public void windowClosing(final WindowEvent e) { cancel(); } }); } /** * Sets a component at the specified {@link BorderLayout} position. * @param comp component to be added * @param pos layout position */ public final void set(final Component comp, final String pos) { panel.add(comp, pos); } /** * Finalizes the dialog layout and sets it visible. * @param l optional dialog location, relative to main window */ public final void finish(final int[] l) { pack(); if(l == null) setLocationRelativeTo(gui); else setLocation(gui.getX() + l[0], gui.getY() + l[1]); loc = l; setVisible(true); } @Override public void setLocation(final int x, final int y) { final Dimension scr = Toolkit.getDefaultToolkit().getScreenSize(); final int xx = Math.max(0, Math.min(scr.width - getWidth(), x)); final int yy = Math.max(0, Math.min(scr.height - getHeight(), y)); super.setLocation(xx, yy); } /** * Reacts on user input; can be overwritten. * @param comp the action component */ @SuppressWarnings("unused") public void action(final Object comp) { } /** * Cancels the dialog; can be overwritten. */ public void cancel() { ok = false; dispose(); } /** * Closes the dialog and stores the location of the dialog window; * can be overwritten. */ public void close() { ok = true; dispose(); } @Override public void dispose() { if(loc != null) { final Container par = getParent(); loc[0] = getX() - par.getX(); loc[1] = getY() - par.getY(); gui.gprop.write(); } super.dispose(); } /** * States if the dialog window was confirmed or canceled. * @return true when dialog was confirmed */ public final boolean ok() { return ok; } /** * Creates a OK and CANCEL button. * @return button list */ public BaseXBack okCancel() { return newButtons(B_OK, B_CANCEL); } /** * Creates a new button list. * @param buttons button names or objects * @return button list */ public BaseXBack newButtons(final Object... buttons) { // horizontal/vertical layout final BaseXBack pnl = new BaseXBack(Fill.NONE). border(12, 0, 0, 0).layout(new TableLayout(1, buttons.length, 8, 0)); for(final Object obj : buttons) { final BaseXButton b; if(obj instanceof BaseXButton) { b = (BaseXButton) obj; } else { b = new BaseXButton(obj.toString(), this); } pnl.add(b); } final BaseXBack but = new BaseXBack(Fill.NONE).layout(new BorderLayout()); but.add(pnl, BorderLayout.EAST); return but; } /** * Enables/disables a button in the specified panel. * @param panel button panel * @param label button label * @param enabled enabled/disabled */ public static void enableOK(final JComponent panel, final String label, final boolean enabled) { for(final Component c : panel.getComponents()) { if(!(c instanceof JComponent)) { } else if(c instanceof BaseXButton) { final BaseXButton b = (BaseXButton) c; if(b.getText().equals(label)) b.setEnabled(enabled); } else { enableOK((JComponent) c, label, enabled); } } } /** * Static yes/no dialog. Returns a {@code null} reference if the dialog * was canceled. * @param gui parent reference * @param text text * @return true if dialog was confirmed */ public static Boolean yesNoCancel(final GUI gui, final String text) { final DialogMessage msg = new DialogMessage(gui, text.trim(), Msg.YESNOCANCEL); return msg.canceled() ? null : msg.ok(); } /** * Static yes/no dialog. * @param gui parent reference * @param text text * @return true if dialog was confirmed */ public static boolean confirm(final GUI gui, final String text) { return new DialogMessage(gui, text.trim(), Msg.QUESTION).ok(); } /** * Static information dialog. * @param gui parent reference * @param text text */ public static void info(final GUI gui, final String text) { new DialogMessage(gui, text.trim(), Msg.SUCCESS); } /** * Static error dialog. * @param gui parent reference * @param text text */ public static void error(final GUI gui, final String text) { new DialogMessage(gui, text.trim(), Msg.ERROR); } /** * Browses the specified url. * @param gui parent reference * @param url url to be browsed */ public static void browse(final GUI gui, final String url) { try { Desktop.getDesktop().browse(new URI(url)); } catch(final Exception ex) { error(gui, Util.info(H_BROWSER_ERROR_X, URL)); } } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/BaseXFileChooser.java000066400000000000000000000144151222453003200272750ustar00rootroot00000000000000package org.basex.gui.layout; import static org.basex.core.Text.*; import java.awt.*; import java.io.*; import java.util.*; import javax.swing.*; import javax.swing.filechooser.FileFilter; import org.basex.gui.*; import org.basex.io.*; import org.basex.util.*; /** * Project specific File Chooser implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BaseXFileChooser { /** File dialog mode. */ public enum Mode { /** Open file. */ FOPEN, /** Open file or directory. */ FDOPEN, /** Open directory. */ DOPEN, /** Save file. */ FSAVE, /** Save file or directory. */ DSAVE, } /** Reference to main window. */ private GUI gui; /** Swing file chooser. */ private JFileChooser fc; /** Simple file dialog. */ private FileDialog fd; /** File suffix. */ private String suffix; /** * Default constructor. * @param title dialog title * @param path initial path * @param main reference to main window */ public BaseXFileChooser(final String title, final String path, final GUI main) { if(main.gprop.is(GUIProp.SIMPLEFD)) { fd = new FileDialog(main, title); fd.setDirectory(new File(path).getPath()); } else { fc = new JFileChooser(path); final File file = new File(path); if(!file.isDirectory()) fc.setSelectedFile(file); fc.setDialogTitle(title); gui = main; } } /** * Convenience method for setting textual filters. * @return self reference */ public BaseXFileChooser textFilters() { filter(XML_DOCUMENTS, IO.XMLSUFFIXES); filter(XSL_DOCUMENTS, IO.XSLSUFFIXES); filter(HTML_DOCUMENTS, IO.HTMLSUFFIXES); filter(JSON_DOCUMENTS, IO.JSONSUFFIX); filter(CSV_DOCUMENTS, IO.CSVSUFFIX); filter(PLAIN_TEXT, IO.TXTSUFFIXES); return this; } /** * Sets a file filter. * @param dsc description * @param suf suffix * @return self reference */ public BaseXFileChooser filter(final String dsc, final String... suf) { if(fc != null) { final FileFilter ff = fc.getFileFilter(); fc.addChoosableFileFilter(new Filter(suf, dsc)); fc.setFileFilter(ff); } return this; } /** * Sets a file suffix, which will be added if the typed in file has no suffix. * @param suf suffix * @return self reference */ public BaseXFileChooser suffix(final String suf) { suffix = suf; return this; } /** * Allow multiple choice. * @return self reference */ public BaseXFileChooser multi() { if(fc != null) fc.setMultiSelectionEnabled(true); return this; } /** * Selects a file or directory. * @param mode type defined by {@link Mode} * @return resulting input reference, or {@code null} if no file was selected */ public IOFile select(final Mode mode) { final IOFile[] files = selectAll(mode); return files.length == 0 ? null : files[0]; } /** * Selects a file or directory. * @param mode type defined by {@link Mode} * @return resulting input reference */ public IOFile[] selectAll(final Mode mode) { if(fd != null) { if(mode == Mode.FDOPEN) fd.setFile(" "); fd.setMode(mode == Mode.FSAVE || mode == Mode.DSAVE ? FileDialog.SAVE : FileDialog.LOAD); fd.setVisible(true); final String f = fd.getFile(); if(f == null) return new IOFile[0]; final String dir = fd.getDirectory(); return new IOFile[] { new IOFile(mode == Mode.DOPEN || mode == Mode.DSAVE ? dir : dir + '/' + fd.getFile()) }; } int state = 0; switch(mode) { case FOPEN: state = fc.showOpenDialog(gui); break; case FDOPEN: fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); state = fc.showOpenDialog(gui); break; case FSAVE: state = fc.showSaveDialog(gui); break; case DOPEN: case DSAVE: fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); state = fc.showDialog(gui, null); break; } if(state != JFileChooser.APPROVE_OPTION) return new IOFile[0]; final File[] fl = fc.isMultiSelectionEnabled() ? fc.getSelectedFiles() : new File[] { fc.getSelectedFile() }; final IOFile[] files = new IOFile[fl.length]; for(int f = 0; f < fl.length; f++) files[f] = new IOFile(fl[f].getPath()); if(mode == Mode.FSAVE) { // add file suffix to files final FileFilter ff = fc.getFileFilter(); if(suffix != null) { for(int f = 0; f < files.length; f++) { final String path = files[f].path(); if(!path.contains(".")) files[f] = new IOFile(path + suffix); } } else if(ff instanceof Filter) { final String[] sufs = ((Filter) ff).sufs; for(int f = 0; f < files.length && sufs.length != 0; f++) { final String path = files[f].path(); if(!path.contains(".")) files[f] = new IOFile(path + sufs[0]); } } // show replace dialog for(final IOFile io : files) { if(io.exists() && !BaseXDialog.confirm(gui, Util.info(FILE_EXISTS_X, io))) { return new IOFile[0]; } } } return files; } /** * Defines a file filter for a list of extensions. */ private static class Filter extends FileFilter { /** Suffixes. */ final String[] sufs; /** Description. */ final String desc; /** * Constructor. * @param s suffixes * @param d description */ Filter(final String[] s, final String d) { sufs = s; desc = d; } @Override public boolean accept(final File file) { if(file.isDirectory()) return true; final String name = file.getName().toLowerCase(Locale.ENGLISH); for(final String s : sufs) if(name.endsWith(s)) return true; return false; } @Override public String getDescription() { final StringBuilder sb = new StringBuilder(); for(final String s : sufs) { if(sb.length() != 0) sb.append(", "); sb.append('*').append(s); } return desc + " (" + sb + ')'; } } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/BaseXHistory.java000066400000000000000000000017511222453003200265330ustar00rootroot00000000000000package org.basex.gui.layout; import org.basex.gui.*; import org.basex.util.list.*; /** * This class remembers previous text inputs of a GUI component. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BaseXHistory { /** Maximum number of history entries. */ private static final int MAX = 12; /** GUI reference. */ final GUI gui; /** History object. */ final Object[] history; /** * Constructor. * @param main main window * @param option option */ public BaseXHistory(final GUI main, final Object[] option) { history = option; gui = main; } /** * Stores the current history. * @param input new input */ public void store(final String input) { if(input == null) return; final StringList sl = new StringList(MAX).add(input); for(final String s : gui.gprop.strings(history)) { if(sl.size() < MAX && !input.equals(s)) sl.add(s); } gui.gprop.set(history, sl.toArray()); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/BaseXKeys.java000066400000000000000000000147151222453003200260110ustar00rootroot00000000000000package org.basex.gui.layout; import static java.awt.event.KeyEvent.*; import static org.basex.core.Prop.MAC; import static org.basex.gui.GUIConstants.*; import java.awt.event.*; /** * This class offers system-dependent key mappings. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Leo Woerteler */ public enum BaseXKeys { // Cursor /** Left. */ PREV(VK_LEFT), /** Right. */ NEXT(VK_RIGHT), /** Word left. */ PREVWORD(MAC ? ALT : SC, VK_LEFT), /** Word right. */ NEXTWORD(MAC ? ALT : SC, VK_RIGHT), /** Beginning of line. */ LINESTART(MAC ? SC : 0, MAC ? VK_LEFT : VK_HOME), /** End of line. */ LINEEND(MAC ? SC : 0, MAC ? VK_RIGHT : VK_END), /** Up. */ PREVLINE(VK_UP), /** Down. */ NEXTLINE(VK_DOWN), /** Page up. */ PREVPAGE(VK_PAGE_UP), /** Page down. */ NEXTPAGE(VK_PAGE_DOWN), /** Page up (read-only). */ PREVPAGE_RO(SHF, VK_SPACE), /** Page down (read-only). */ NEXTPAGE_RO(VK_SPACE), /** Beginning of text. */ TEXTSTART(SC, MAC ? VK_UP : VK_HOME), /** End of text. */ TEXTEND(SC, MAC ? VK_DOWN : VK_END), /** Scroll up. */ SCROLLUP(MAC ? ALT : SC, VK_UP, true), /** Scroll down. */ SCROLLDOWN(MAC ? ALT : SC, VK_DOWN, true), // Find /** Find search term. */ FIND(SC, VK_F, true), /** Find next hit. */ FINDNEXT(SC, VK_G, true), /** Find next hit. */ FINDNEXT2(MAC ? SC : 0, VK_F3, true), /** Find previous hit. */ FINDPREV(SC | SHF, VK_G, true), /** Find previous hit. */ FINDPREV2(MAC ? SC | SHF : SHF, VK_F3, true), /** Jump to error. */ FINDERROR(SC, VK_PERIOD), // Editing /** Undo. */ UNDOSTEP(SC, VK_Z, true), /** Redo. */ REDOSTEP(MAC ? SC | SHF : SC, MAC ? VK_Z : VK_Y, true), /** Cut. */ CUT1(SC, VK_X, true), /** Cut. */ CUT2(SHF, VK_DELETE, true), /** Copy. */ COPY1(SC, VK_C, true), /** Copy. */ COPY2(SC, VK_INSERT, true), /** Paste. */ PASTE1(SC, VK_V, true), /** Paste. */ PASTE2(SHF, VK_INSERT, true), /** Select all. */ SELECTALL(SC, VK_A, true), /** Delete backwards. */ DELPREV(VK_BACK_SPACE), /** Delete. */ DELNEXT(VK_DELETE), /** Delete word backwards. */ DELPREVWORD(MAC ? ALT : SC, VK_BACK_SPACE, true), /** Delete word. */ DELNEXTWORD(MAC ? ALT : SC, VK_DELETE, true), /** Delete line to begin. */ DELLINESTART(SC | (MAC ? 0 : SHF), VK_BACK_SPACE, true), /** Delete line to end. */ DELLINEEND(SC | (MAC ? 0 : SHF), VK_DELETE, true), /** Delete complete line. */ DELLINE(SC | SHF, VK_D, true), /** (Un)comment. */ COMMENT(SC, VK_K, false), /** Execute. */ EXEC(SC, VK_ENTER, true), // Navigation /** Jump to input bar. */ INPUTBAR(MAC ? SC : 0, VK_F6, true), /** Next panel. */ NEXTTAB(CTRL, VK_TAB, true), /** Previous panel. */ PREVTAB(CTRL | SHF, VK_TAB, true), /** Browse back. */ GOBACK(MAC ? SC : ALT, VK_LEFT, true), /** Browse back. */ GOBACK2(VK_BACK_SPACE, true), /** Browse forward. */ GOFORWARD(MAC ? SC : ALT, VK_RIGHT, true), /** Browse up. */ GOUP(MAC ? SC : ALT, VK_UP, true), /** Browse home. */ GOHOME(MAC ? SC : ALT, VK_HOME, true), // Font /** Increment size. */ INCFONT1(SC, VK_PLUS, true), /** Increment size. */ INCFONT2(SC, VK_EQUALS, true), /** Decrease size. */ DECFONT(SC, VK_MINUS, true), /** Standard size. */ NORMFONT(SC, VK_0, true), // General /** Escape. */ ESCAPE(VK_ESCAPE), /** Context menu. */ CONTEXT(VK_CONTEXT_MENU), /** Space key. */ SPACE(VK_SPACE), /** Tab key. */ TAB(VK_TAB), /** Enter. */ ENTER(VK_ENTER); /** Modifiers. */ private final int mod; /** Key. */ private final int key; /** Exclusive modifiers flag. */ private final boolean excl; /** * Constructor. * @param m modifiers * @param k key code * @param ex modifiers exclusive */ BaseXKeys(final int m, final int k, final boolean ex) { mod = m; key = k; excl = ex; } /** * Constructor for non-exclusive modifiers. * @param m modifiers * @param k key code */ BaseXKeys(final int m, final int k) { this(m, k, false); } /** * Constructor for ignoring modifiers. * @param k key code * @param ig ignore modifiers */ BaseXKeys(final int k, final boolean ig) { this(0, k, ig); } /** * Constructor without modifiers. * @param k key code */ BaseXKeys(final int k) { this(0, k); } /** * Returns true if the specified key combination was pressed. * @param e key event * @return result of check */ public boolean is(final KeyEvent e) { final int c = e.getKeyCode(); int m = e.getModifiers(); if(!excl) m &= mod; return m == mod && (c == 0 ? e.getKeyChar() : c) == key; } /** * Returns true if the system's shortcut key was pressed. * @param e input event * @return result of check */ public static boolean sc(final InputEvent e) { return (SC & e.getModifiers()) == SC; } /** * Returns true if the pressed key includes a control key. * @param e key event * @return result of check */ public static boolean control(final KeyEvent e) { // With Mac, special characters are available via ALT return e.isControlDown() || e.isMetaDown() || !MAC && e.isAltDown(); } /** * Returns true if the pressed key is a modifier key * (including 'escape' and 'alt'-'tab'). * @param e key event * @return result of check */ public static boolean modifier(final KeyEvent e) { final int c = e.getKeyCode(); return c == VK_ALT || c == VK_SHIFT || c == VK_META || c == VK_CONTROL || c == VK_PAUSE || c == VK_CAPS_LOCK || c == VK_ESCAPE || c == VK_TAB && e.isAltDown(); } @Override public String toString() { final StringBuilder sb = new StringBuilder(KeyEvent.getKeyModifiersText(mod)); if(sb.length() != 0) sb.append('+'); return sb.append(KeyEvent.getKeyText(key)).toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/BaseXLabel.java000066400000000000000000000044621222453003200261130ustar00rootroot00000000000000package org.basex.gui.layout; import java.awt.*; import javax.swing.*; import javax.swing.border.*; import org.basex.gui.GUIConstants.Msg; /** * Project specific Label implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class BaseXLabel extends JLabel { /** * Constructor. */ public BaseXLabel() { this("", false, false); } /** * Constructor, specifying a label text. * @param txt label text */ public BaseXLabel(final String txt) { this(txt, false, false); } /** * Constructor, specifying a label text, vertical distance to the next * component, and a property for printing the label in bold. * @param txt label text * @param dist vertical distance to next component * @param bold bold flag */ public BaseXLabel(final String txt, final boolean dist, final boolean bold) { super(txt); if(dist) border(0, 0, 6, 0); setFont(getFont().deriveFont(bold ? Font.BOLD : Font.PLAIN)); } /** * Sets the label borders. * @param t top distance * @param l left distance * @param b bottom distance * @param r right distance * @return self reference */ public BaseXLabel border(final int t, final int l, final int b, final int r) { setBorder(new EmptyBorder(t, l, b, r)); return this; } /** * Sets the text color. * @param c color * @return self reference */ public BaseXLabel color(final Color c) { setForeground(c); return this; } /** * Shows an text, preceded by a state icon. * If the text is {@code null}, no text and icon is shown. * @param text warning text * @param icon flag for displaying a warning or error icon * @return self reference */ public BaseXLabel setText(final String text, final Msg icon) { setIcon(text == null ? null : icon.small); setText(text == null ? " " : text); return this; } /** * Chooses a large font. * @return self reference */ public BaseXLabel large() { final Font f = getFont(); setFont(new Font(f.getName(), Font.PLAIN, (int) f.getSize2D() + 7)); return this; } @Override public void setEnabled(final boolean flag) { if(flag != isEnabled()) super.setEnabled(flag); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/BaseXLayout.java000066400000000000000000000334351222453003200263530ustar00rootroot00000000000000package org.basex.gui.layout; import static org.basex.gui.GUIConstants.*; import static org.basex.gui.layout.BaseXKeys.*; import static org.basex.util.Token.*; import java.awt.*; import java.awt.datatransfer.*; import java.awt.dnd.*; import java.awt.event.*; import java.io.*; import java.net.*; import java.util.*; import java.util.List; import javax.swing.*; import org.basex.core.*; import org.basex.gui.*; import org.basex.gui.editor.*; import org.basex.util.*; /** * This class provides static layout and paint helper methods which are used all over * the GUI. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BaseXLayout { /** Cached images. */ private static final HashMap IMAGES = new HashMap(); /** Key listener for global shortcuts. */ private static KeyAdapter keys; /** Private constructor. */ private BaseXLayout() { } /** * Sets the help text for the specified component. * @param cont input container */ static void focus(final Component cont) { final GUI gui = gui(cont); if(gui == null) return; if(gui.gprop.is(GUIProp.MOUSEFOCUS) && cont.isEnabled()) cont.requestFocusInWindow(); } /** * Returns the GUI reference of the specified container. * @param cont input container * @return gui */ private static GUI gui(final Component cont) { final Container c = cont.getParent(); return c == null || c instanceof GUI ? (GUI) c : gui(c); } /** * Sets the component width, adopting the original component height. * @param comp component * @param w width */ public static void setWidth(final Component comp, final int w) { comp.setPreferredSize(new Dimension(w, comp.getPreferredSize().height)); } /** * Sets the component height, adopting the original component width. * @param comp component * @param h height */ public static void setHeight(final Component comp, final int h) { comp.setPreferredSize(new Dimension(comp.getPreferredSize().width, h)); } /** * Sets the component size. * @param comp component * @param w width * @param h height */ static void setSize(final Component comp, final int w, final int h) { comp.setPreferredSize(new Dimension(w, h)); } /** * Adds drag and drop functionality. * @param comp component * @param dnd drag and drop handler */ public static void addDrop(final JComponent comp, final DropHandler dnd) { comp.setDropTarget(new DropTarget(comp, DnDConstants.ACTION_COPY_OR_MOVE, null, true, null) { @Override public synchronized void drop(final DropTargetDropEvent dtde) { dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE); final Transferable tr = dtde.getTransferable(); for(final Object o : contents(tr)) dnd.drop(o); comp.requestFocusInWindow(); } }); } /** * Sets a mnemomic for the specified button. * @param b button * @param mnem mnemonics that have already been assigned */ public static void setMnemonic(final AbstractButton b, final StringBuilder mnem) { // do not set mnemonics for Mac! Alt+key used for special characters. if(Prop.MAC) return; // find and assign unused mnemomic final String label = b.getText(); for(int l = 0; l < label.length(); l++) { final char ch = Character.toLowerCase(label.charAt(l)); if(!Token.letter(ch) || mnem.indexOf(Character.toString(ch)) != -1) continue; b.setMnemonic(ch); mnem.append(ch); break; } } /** * Returns the contents of the specified transferable. * @param tr transferable * @return contents */ @SuppressWarnings("unchecked") public static ArrayList contents(final Transferable tr) { final ArrayList list = new ArrayList(); try { if(tr.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) { for(final File fl : (List) tr.getTransferData(DataFlavor.javaFileListFlavor)) list.add(fl); } else if(tr.isDataFlavorSupported(DataFlavor.stringFlavor)) { list.add(tr.getTransferData(DataFlavor.stringFlavor)); } } catch(final Exception ex) { Util.stack(ex); } return list; } /** * Drag and drop handler. * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public interface DropHandler { /** * Drops a file. * @param obj object to be dropped */ void drop(final Object obj); } /** * Adds default interactions to the specified component. * @param comp component * @param win parent window */ static void addInteraction(final Component comp, final Window win) { comp.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(final MouseEvent e) { focus(comp); } }); if(win instanceof BaseXDialog) { // add default keys final BaseXDialog d = (BaseXDialog) win; comp.addKeyListener(new KeyAdapter() { @Override public void keyPressed(final KeyEvent e) { final Object s = e.getSource(); if(s instanceof BaseXCombo && ((BaseXCombo) s).isPopupVisible()) return; // do not key close dialog of button or editor is focused if(ENTER.is(e) && !(s instanceof BaseXButton || s instanceof Editor)) { d.close(); } else if(ESCAPE.is(e)) { // do not cancel dialog if search bar is opened boolean close = true; if(s instanceof Editor) { final SearchBar bar = ((Editor) s).getSearch(); close = bar == null || !bar.deactivate(true); } if(close) d.cancel(); } } }); return; } if(win instanceof GUI) { comp.addKeyListener(globalShortcuts((GUI) win)); } else { Util.notexpected("Reference to main window expected."); } } /** * Returns or creates a new key listener for global shortcuts. * @param gui gui reference * @return key listener */ private static KeyAdapter globalShortcuts(final GUI gui) { if(keys == null) { keys = new KeyAdapter() { @Override public void keyPressed(final KeyEvent e) { // browse back/forward if(gui.context.data() != null) { if(GOBACK.is(e)) { GUICommands.C_GOBACK.execute(gui); } else if(GOFORWARD.is(e)) { GUICommands.C_GOFORWARD.execute(gui); } else if(GOUP.is(e)) { GUICommands.C_GOUP.execute(gui); } else if(GOHOME.is(e)) { GUICommands.C_GOHOME.execute(gui); } } // jump to input bar if(INPUTBAR.is(e)) gui.input.requestFocusInWindow(); // change font size final int fs = gui.gprop.num(GUIProp.FONTSIZE); int nfs = fs; if(INCFONT1.is(e) || INCFONT2.is(e)) { nfs = fs + 1; } else if(DECFONT.is(e)) { nfs = Math.max(1, fs - 1); } else if(NORMFONT.is(e)) { nfs = 13; } if(fs != nfs) { gui.gprop.set(GUIProp.FONTSIZE, nfs); gui.updateLayout(); } } }; } return keys; } /** * Adds human readable shortcuts to the specified string. * @param str text of tooltip * @param sc shortcut * @return tooltip */ public static String addShortcut(final String str, final String sc) { if(sc == null) return str; final StringBuilder sb = new StringBuilder(); for(final String s : sc.split(" ")) { String t = s.equals("%") ? Prop.MAC ? "meta" : "control" : s; if(t.length() != 1) t = Toolkit.getProperty("AWT." + t.toLowerCase(), t); sb.append('+').append(t); } int i = str.lastIndexOf('.'); if(i == -1) i = str.length(); return str.substring(0, i) + " (" + sb.substring(1) + ')' + str.substring(i); } /** * Returns the specified image as icon. * @param name name of icon * @return icon */ public static ImageIcon icon(final String name) { ImageIcon img = IMAGES.get(name); if(img != null) return img; img = new ImageIcon(image(name)); IMAGES.put(name, img); return img; } /** * Returns the specified image. * @param name name of image * @return image */ public static Image image(final String name) { return Toolkit.getDefaultToolkit().getImage(imageURL(name)); } /** * Returns the image url. * @param name name of image * @return url */ private static URL imageURL(final String name) { final String path = "/img/" + name + ".png"; URL url = GUI.class.getResource(path); if(url == null) { Util.errln("Not found: " + path); url = GUI.class.getResource("/img/" + Prop.NAME + ".png"); } return url; } /** * Returns the value of the specified pre value and attribute. * @param val value to be evaluated * @return value as string */ public static String value(final double val) { return string(chopNumber(token(val))); } /** * Fills the specified area with a color gradient. * @param gg graphics reference * @param c1 first color * @param c2 second color * @param xs horizontal start position * @param ys vertical start position * @param xe horizontal end position * @param ye vertical end position */ public static void fill(final Graphics gg, final Color c1, final Color c2, final int xs, final int ys, final int xe, final int ye) { final int w = xe - xs; final int h = ye - ys; final int r = c1.getRed(); final int g = c1.getGreen(); final int b = c1.getBlue(); final float rf = (c2.getRed() - r) / (float) h; final float gf = (c2.getGreen() - g) / (float) h; final float bf = (c2.getBlue() - b) / (float) h; int nr, ng, nb; int cr = 0, cg = 0, cb = 0; int hh = 0; for(int y = 0; y < h; ++y) { nr = r + (int) (rf * y); ng = g + (int) (gf * y); nb = b + (int) (bf * y); if(nr != cr || ng != cg || nb != cb) { gg.setColor(new Color(nr, ng, nb)); gg.fillRect(xs, ys + y - hh, w, hh); hh = 0; } cr = nr; cg = ng; cb = nb; ++hh; } gg.fillRect(xs, ys + h - hh, w, hh); } /** * Draws a colored cell. * @param g graphics reference * @param xs horizontal start position * @param xe horizontal end position * @param ys vertical start position * @param ye vertical end position * @param focus highlighting flag */ public static void drawCell(final Graphics g, final int xs, final int xe, final int ys, final int ye, final boolean focus) { g.setColor(GRAY); g.drawRect(xs, ys, xe - xs - 1, ye - ys - 1); g.setColor(Color.white); g.drawRect(xs + 1, ys + 1, xe - xs - 3, ye - ys - 3); fill(g, focus ? LGRAY : Color.white, LGRAY, xs + 2, ys + 2, xe - 1, ye - 1); } /** * Draws a centered string to the panel. * @param g graphics reference * @param text text to be painted * @param w panel width * @param y vertical position */ public static void drawCenter(final Graphics g, final String text, final int w, final int y) { g.drawString(text, (w - width(g, text)) / 2, y); } /** * Draws a visualization tooltip. * @param g graphics reference * @param tt tooltip label * @param x horizontal position * @param y vertical position * @param w width * @param c color color depth */ public static void drawTooltip(final Graphics g, final String tt, final int x, final int y, final int w, final int c) { final int tw = width(g, tt); final int th = g.getFontMetrics().getHeight(); final int xx = Math.min(w - tw - 8, x); g.setColor(color(c)); g.fillRect(xx - 1, y - th, tw + 4, th); g.setColor(WHITE); g.drawString(tt, xx, y - 4); } /** * Returns the width of the specified text. * @param g graphics reference * @param s string to be evaluated * @return string width */ public static int width(final Graphics g, final String s) { return g.getFontMetrics().stringWidth(s); } /** * Draws the specified string. * * @param g graphics reference * @param s text * @param x x coordinate * @param y y coordinate * @param w width * @param fs font size */ public static void chopString(final Graphics g, final byte[] s, final int x, final int y, final int w, final int fs) { if(w < 12) return; final int[] cw = fontWidths(g.getFont()); int j = s.length; int fw = 0; int l = 0; try { for(int k = 0; k < j; k += l) { final int ww = width(g, cw, cp(s, k)); if(fw + ww >= w - 4) { j = Math.max(1, k - l); if(k > 1) fw -= width(g, cw, cp(s, k - 1)); g.drawString("..", x + fw, y + fs); break; } fw += ww; l = cl(s, k); } } catch(final Exception ex) { Util.debug(ex); } g.drawString(string(s, 0, j), x, y + fs); } /** * Returns the width of the specified text. * Cached font widths are used to speed up calculation. * @param g graphics reference * @param s string to be evaluated * @return string width */ public static int width(final Graphics g, final byte[] s) { final int[] cw = fontWidths(g.getFont()); final int l = s.length; int fw = 0; try { // ignore faulty character sets for(int k = 0; k < l; k += cl(s, k)) fw += width(g, cw, cp(s, k)); } catch(final Exception ex) { Util.debug(ex); } return fw; } /** * Returns the character width of the specified character. * @param g graphics reference * @param cw array with character widths * @param c character * @return character width */ public static int width(final Graphics g, final int[] cw, final int c) { return c >= cw.length ? g.getFontMetrics().charWidth(c) : cw[c]; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/BaseXList.java000066400000000000000000000207341222453003200260070ustar00rootroot00000000000000package org.basex.gui.layout; import static org.basex.gui.layout.BaseXKeys.*; import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; import javax.swing.event.*; import org.basex.io.*; import org.basex.util.*; import org.basex.util.list.*; /** * Combination of text field and a list, communicating with each other. * List entries are automatically completed if they match the first characters * of the typed in text. Moreover, the cursor keys can be used to scroll * through the list, and list entries can be chosen with mouse clicks. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BaseXList extends BaseXBack { /** Single choice. */ final boolean single; /** Text field. */ final BaseXTextField text; /** List. */ final JList list; /** List values. */ String[] values; /** Numeric list. */ boolean num = true; /** Scroll pane. */ private final JScrollPane scroll; /** * Default constructor. * @param choice the input values for the list * @param d dialog reference */ public BaseXList(final String[] choice, final BaseXDialog d) { this(choice, d, true); } /** * Default constructor. * @param choice the input values for the list * @param d dialog reference * @param s only allow single choices */ public BaseXList(final String[] choice, final BaseXDialog d, final boolean s) { // cache list values values = choice.clone(); single = s; // checks if list is purely numeric for(final String v : values) num = num && v.matches("[0-9]+"); layout(new TableLayout(2, 1)); text = new BaseXTextField(d); text.addKeyListener(new KeyAdapter() { boolean multi, typed; String old = ""; @Override public void keyPressed(final KeyEvent e) { final int page = getHeight() / getFont().getSize(); final int[] inds = list.getSelectedIndices(); final int op1 = inds.length == 0 ? -1 : inds[0]; final int op2 = inds.length == 0 ? -1 : inds[inds.length - 1]; int np1 = op1, np2 = op2; if(NEXTLINE.is(e)) { np2 = Math.min(op2 + 1, values.length - 1); } else if(PREVLINE.is(e)) { np1 = Math.max(op1 - 1, 0); } else if(NEXTPAGE.is(e)) { np2 = Math.min(op2 + page, values.length - 1); } else if(PREVPAGE.is(e)) { np1 = Math.max(op1 - page, 0); } else if(TEXTSTART.is(e)) { np1 = 0; } else if(TEXTEND.is(e)) { np2 = values.length - 1; } else { return; } final IntList il = new IntList(); for(int n = np1; n <= np2; n++) il.add(n); // choose new list value final int nv = op2 != np2 ? np2 : np1; final String val = values[nv]; list.setSelectedValue(val, true); if(e.isShiftDown() && !single) { list.setSelectedIndices(il.toArray()); text.setText(""); } else { list.setSelectedIndex(nv); text.setText(val); text.selectAll(); } multi = il.size() > 1; } @Override public void keyTyped(final KeyEvent e) { final char ch = e.getKeyChar(); if(num) { typed = ch >= '0' && ch <= '9'; if(!typed) e.consume(); } else { typed = ch >= ' ' && ch != 127; } multi = false; } @Override public void keyReleased(final KeyEvent e) { String txt = text.getText().trim().toLowerCase(Locale.ENGLISH); if(!txt.equals(old) && !multi) { final boolean glob = txt.matches("^.*[*?,].*$"); final String regex = glob ? IOFile.regex(txt, false) : null; final IntList il = new IntList(); for(int v = 0; v < values.length; ++v) { final String value = values[v].trim().toLowerCase(Locale.ENGLISH); if(glob) { if(value.matches(regex)) il.add(v); } else if(value.startsWith(txt)) { if(typed) { final int c = text.getCaretPosition(); text.setText(values[v]); text.select(c, values[v].length()); txt = value; } il.add(v); break; } } if(il.size() > 0) { list.setSelectedValue(values[il.get(il.size() - 1)], true); } list.setSelectedIndices(il.toArray()); } d.action(BaseXList.this); typed = false; old = txt; } }); add(text); final MouseInputAdapter mouse = new MouseInputAdapter() { @Override public void mouseEntered(final MouseEvent e) { BaseXLayout.focus(text); } @Override public void mousePressed(final MouseEvent e) { final Object[] i = list.getSelectedValues(); text.setText(i.length == 1 ? i[0].toString() : ""); text.requestFocusInWindow(); text.selectAll(); d.action(BaseXList.this); } @Override public void mouseDragged(final MouseEvent e) { mousePressed(e); } @Override public void mouseClicked(final MouseEvent e) { if(e.getClickCount() == 2) { d.close(); } } }; list = new JList(choice); list.setFocusable(false); if(s) list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.addMouseListener(mouse); list.addMouseMotionListener(mouse); text.setFont(list.getFont()); BaseXLayout.setWidth(text, list.getWidth()); BaseXLayout.addInteraction(list, d); scroll = new JScrollPane(list); add(scroll); setIndex(0); } /** * Chooses the specified value in the text field and list. * @param value the value to be set */ public void setValue(final String value) { list.setSelectedValue(value, true); text.setText(value); } @Override public void setEnabled(final boolean en) { list.setEnabled(en); text.setEnabled(en); } /** * Sets the specified font. * @param font font name * @param style style */ public void setFont(final String font, final int style) { final Font f = text.getFont(); text.setFont(new Font(font, style, f.getSize())); } /** * Returns all list choices. * @return list index entry */ public String[] getList() { return values; } /** * Returns the selected value of the text field. * An empty string is returned if no or multiple values are selected. * @return text field value */ public String getValue() { final Object[] vals = list.getSelectedValues(); return vals.length == 1 ? vals[0].toString() : ""; } /** * Returns all selected values. * @return text field value */ public StringList getValues() { final StringList sl = new StringList(); for(final Object o : list.getSelectedValues()) sl.add(o.toString()); return sl; } /** * Returns the numeric representation of the user input. If the * text field is invalid, the list entry is returned. * @return numeric value */ public int getNum() { final int i = Token.toInt(text.getText()); if(i != Integer.MIN_VALUE) return i; final Object value = list.getSelectedValue(); return value != null ? Token.toInt(value.toString()) : 0; } /** * Returns the current list index. * @return list index entry */ public int getIndex() { return list.getSelectedIndex(); } /** * Sets the specified list index. * @param i list entry */ public void setIndex(final int i) { if(i < values.length) setValue(values[i]); else text.setText(""); } @Override public void setSize(final int w, final int h) { BaseXLayout.setWidth(text, w); BaseXLayout.setSize(scroll, w, h); } /** * Sets the width of the component. * @param w width */ public void setWidth(final int w) { BaseXLayout.setWidth(text, w); BaseXLayout.setWidth(scroll, w); } /** * Resets the data shown in the list. * @param data list data */ public void setData(final String[] data) { values = data.clone(); list.setListData(data); setIndex(0); } @Override public boolean requestFocusInWindow() { return text.requestFocusInWindow(); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/BaseXMem.java000066400000000000000000000055071222453003200256130ustar00rootroot00000000000000package org.basex.gui.layout; import static org.basex.core.Text.*; import static org.basex.gui.GUIConstants.*; import java.awt.*; import java.awt.event.*; import org.basex.util.*; /** * This component visualizes the current memory consumption. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BaseXMem extends BaseXPanel { /** Default width of the memory status box. */ private static final int DWIDTH = 70; /** * Constructor. * @param win parent reference * @param mouse mouse interaction */ public BaseXMem(final Window win, final boolean mouse) { super(win); BaseXLayout.setWidth(this, DWIDTH); BaseXLayout.setHeight(this, getFont().getSize() + 6); if(mouse) { setCursor(CURSORHAND); addMouseListener(this); addMouseMotionListener(this); } final Thread t = new Thread() { @Override public void run() { repaint(); Performance.sleep(500); } }; t.setDaemon(true); t.start(); } @Override public void paintComponent(final Graphics g) { super.paintComponent(g); final Runtime rt = Runtime.getRuntime(); final long max = rt.maxMemory(); final long total = rt.totalMemory(); final long used = total - rt.freeMemory(); final int ww = getWidth(); final int hh = getHeight(); // draw memory box g.setColor(Color.white); g.fillRect(0, 0, ww - 3, hh - 3); g.setColor(GRAY); g.drawLine(0, 0, ww - 4, 0); g.drawLine(0, 0, 0, hh - 4); g.drawLine(ww - 3, 0, ww - 3, hh - 3); g.drawLine(0, hh - 3, ww - 3, hh - 3); // show total memory usage g.setColor(color1); g.fillRect(2, 2, Math.max(1, (int) (total * (ww - 6) / max)), hh - 6); // show current memory usage final boolean full = used * 6 / 5 > max; g.setColor(full ? colormark4 : color3); g.fillRect(2, 2, Math.max(1, (int) (used * (ww - 6) / max)), hh - 6); // print current memory usage final FontMetrics fm = g.getFontMetrics(); final String mem = Performance.format(used, true); final int fw = (ww - fm.stringWidth(mem)) / 2; final int h = fm.getHeight() - 3; g.setColor(full ? colormark3 : DGRAY); g.drawString(mem, fw, h); } @Override public void mousePressed(final MouseEvent e) { Performance.gc(3); repaint(); final Runtime rt = Runtime.getRuntime(); final long max = rt.maxMemory(); final long total = rt.totalMemory(); final long used = total - rt.freeMemory(); final String inf = TOTAL_MEM_C + Performance.format(max, true) + NL + RESERVED_MEM_C + Performance.format(total, true) + NL + MEMUSED_C + Performance.format(used, true) + NL + NL + H_USED_MEM; BaseXDialog.info(gui, inf); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/BaseXPanel.java000066400000000000000000000034131222453003200261260ustar00rootroot00000000000000package org.basex.gui.layout; import java.awt.*; import java.awt.event.*; import org.basex.gui.*; /** * Abstract panel implementation with a number of predefined listeners. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class BaseXPanel extends BaseXBack implements MouseListener, MouseMotionListener, ComponentListener, KeyListener, MouseWheelListener { /** Reference to the main window. */ public final GUI gui; /** * Constructor, setting default interactions. * @param win parent reference, {@link BaseXDialog} or {@link GUI} instance */ protected BaseXPanel(final Window win) { gui = win instanceof GUI ? (GUI) win : ((BaseXDialog) win).gui; BaseXLayout.addInteraction(this, win); } @Override public void mouseEntered(final MouseEvent e) { } @Override public void mousePressed(final MouseEvent e) { } @Override public void mouseReleased(final MouseEvent e) { } @Override public void mouseClicked(final MouseEvent e) { } @Override public void mouseExited(final MouseEvent e) { } @Override public void mouseMoved(final MouseEvent e) { } @Override public void mouseDragged(final MouseEvent e) { } @Override public void keyPressed(final KeyEvent e) { } @Override public void keyTyped(final KeyEvent e) { } @Override public void keyReleased(final KeyEvent e) { } @Override public void componentResized(final ComponentEvent e) { } @Override public void componentHidden(final ComponentEvent e) { } @Override public void componentShown(final ComponentEvent e) { } @Override public void componentMoved(final ComponentEvent e) { } @Override public void mouseWheelMoved(final MouseWheelEvent e) { } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/BaseXPassword.java000066400000000000000000000014331222453003200266710ustar00rootroot00000000000000package org.basex.gui.layout; import java.awt.*; import java.awt.event.*; import javax.swing.*; /** * Project specific password field implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BaseXPassword extends JPasswordField { /** * Constructor. * @param win parent window */ public BaseXPassword(final Window win) { BaseXLayout.setWidth(this, BaseXTextField.DWIDTH); BaseXLayout.addInteraction(this, win); if(!(win instanceof BaseXDialog)) return; addKeyListener(((BaseXDialog) win).keys); addMouseListener(new MouseAdapter() { @Override public void mouseEntered(final MouseEvent e) { BaseXLayout.focus(e.getComponent()); } }); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/BaseXPopup.java000066400000000000000000000044311222453003200261730ustar00rootroot00000000000000package org.basex.gui.layout; import static org.basex.gui.layout.BaseXKeys.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import org.basex.gui.*; /** * Project specific Popup menu implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Lukas Kircher */ public final class BaseXPopup extends JPopupMenu { /** Reference to main window. */ final GUI gui; /** Popup reference. */ private final GUICmd[] popup; /** * Constructor. * @param comp component reference * @param pop popup reference */ public BaseXPopup(final BaseXPanel comp, final GUICmd... pop) { this(comp, comp.gui, pop); } /** * Constructor. * @param comp component reference * @param g gui reference * @param pop popup reference */ public BaseXPopup(final JComponent comp, final GUI g, final GUICmd... pop) { popup = pop; gui = g; // both listeners must be implemented to support different platforms comp.addMouseListener(new MouseAdapter() { @Override public void mousePressed(final MouseEvent e) { if(!gui.updating && e.isPopupTrigger()) show(e.getComponent(), e.getX() - 10, e.getY() - 15); } @Override public void mouseReleased(final MouseEvent e) { mousePressed(e); } }); comp.addKeyListener(new KeyAdapter() { @Override public void keyPressed(final KeyEvent e) { if(!gui.updating && CONTEXT.is(e)) show(e.getComponent(), 10, 10); } }); for(final GUICmd c : pop) { if(c == null) { addSeparator(); } else { final JMenuItem item = add(c.label()); item.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { if(!gui.updating) c.execute(gui); } }); item.setMnemonic(c.label().charAt(0)); item.setToolTipText(c.help()); } } } @Override public void show(final Component comp, final int x, final int y) { for(int b = 0; b < popup.length; ++b) { if(popup[b] != null) popup[b].refresh(gui, (JMenuItem) getComponent(b)); } super.show(comp, x, y); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/BaseXRadio.java000066400000000000000000000016471222453003200261340ustar00rootroot00000000000000package org.basex.gui.layout; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.*; /** * Project specific RadioButton implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BaseXRadio extends JRadioButton { /** * Default constructor. * @param label button title * @param sel initial selection state * @param win parent window */ public BaseXRadio(final String label, final boolean sel, final Window win) { super(label, sel); setOpaque(false); setBorder(new EmptyBorder(0, 0, 0, 16)); BaseXLayout.addInteraction(this, win); if(!(win instanceof BaseXDialog)) return; addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { ((BaseXDialog) win).action(e.getSource()); } }); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/BaseXSlider.java000066400000000000000000000110351222453003200263100ustar00rootroot00000000000000package org.basex.gui.layout; import static org.basex.gui.layout.BaseXKeys.*; import java.awt.*; import java.awt.event.*; import org.basex.gui.*; import org.basex.gui.GUIConstants.Fill; /** * Project specific slider implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BaseXSlider extends BaseXPanel { /** Default width of slider. */ private static final int DWIDTH = 120; /** Slider width. */ private static final double SLIDERW = 20; /** Listener. */ private final BaseXDialog dl; /** Minimum slider value. */ private final int min; /** Maximum slider value. */ private final int max; /** Listener. */ private final ActionListener al; /** Current slider value. */ private int curr; /** Current slider value. */ private int oldCurr = -1; /** Mouse position for dragging operations. */ private int mouseX; /** * Constructor. * @param mn min value * @param mx max value * @param i initial value * @param w parent window */ public BaseXSlider(final int mn, final int mx, final int i, final Window w) { this(mn, mx, i, w, null); } /** * Constructor. * @param mn min value * @param mx max value * @param i initial value * @param w reference to the main window * @param list listener */ public BaseXSlider(final int mn, final int mx, final int i, final Window w, final ActionListener list) { super(w); min = mn; max = mx; curr = i; dl = w instanceof BaseXDialog ? (BaseXDialog) w : null; al = list; mode(Fill.NONE).setFocusable(true); setPreferredSize(new Dimension(DWIDTH, getFont().getSize() + 3)); addFocusListener(new FocusAdapter() { @Override public void focusGained(final FocusEvent e) { repaint(); } @Override public void focusLost(final FocusEvent e) { repaint(); } }); addKeyListener(this); addMouseListener(this); addMouseMotionListener(this); } /** * Returns the current value. * @return current value */ public int value() { return curr; } /** * Sets a slider value. * @param v new value */ public void value(final int v) { curr = v; repaint(); } @Override public void paintComponent(final Graphics g) { super.paintComponent(g); final int w = getWidth(); final int h = getHeight(); final int hh = h / 2; g.setColor(hasFocus() ? Color.white : GUIConstants.LGRAY); g.fillRect(0, hh - 3, w, 4); g.setColor(Color.black); g.drawLine(0, hh - 3, w, hh - 3); g.drawLine(0, hh - 3, 0, hh + 2); g.setColor(GUIConstants.GRAY); g.drawLine(w - 1, hh - 3, w - 1, hh + 2); g.drawLine(0, hh + 2, w, hh + 2); final double x = (curr - min) * (w - SLIDERW) / (max - min); BaseXLayout.drawCell(g, (int) x, (int) (x + SLIDERW), hh - 6, hh + 6, oldCurr != -1); } @Override public void mouseMoved(final MouseEvent e) { mouseX = e.getX(); } @Override public void mousePressed(final MouseEvent e) { requestFocusInWindow(); mouseX = e.getX(); final double w = getWidth() - SLIDERW; final double r = max - min; final double x = (curr - min) * w / r; if(mouseX < x || mouseX >= x + SLIDERW) curr = (int) (mouseX * r / w + min); oldCurr = curr; repaint(); } @Override public void mouseReleased(final MouseEvent e) { oldCurr = -1; repaint(); } @Override public void mouseDragged(final MouseEvent e) { final double prop = (max - min) * (mouseX - e.getX()) / (getWidth() - SLIDERW); final int old = curr; curr = Math.max(min, Math.min(max, (int) (oldCurr - prop))); if(curr != old) { if(dl != null) dl.action(null); else al.actionPerformed(null); repaint(); } } @Override public void keyPressed(final KeyEvent e) { final int old = curr; if(PREV.is(e) || PREVLINE.is(e)) { curr = Math.max(min, curr - 1); } else if(NEXT.is(e) || NEXTLINE.is(e)) { curr = Math.min(max, curr + 1); } else if(NEXTPAGE.is(e)) { curr = Math.max(min, curr + 10); } else if(PREVPAGE.is(e)) { curr = Math.min(max, curr - 10); } else if(LINESTART.is(e)) { curr = min; } else if(LINEEND.is(e)) { curr = max; } if(curr != old) { if(dl != null) dl.action(null); else al.actionPerformed(null); repaint(); } } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/BaseXSplit.java000066400000000000000000000055411222453003200261660ustar00rootroot00000000000000package org.basex.gui.layout; import java.awt.*; /** * Project specific Split panel implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BaseXSplit extends BaseXBack implements LayoutManager { /** Layout: horizontal = true, vertical = false. */ private final boolean l; /** Panel positions. */ private double[] s; /** Temporary panel positions. */ private double[] t; /** Temporary drag position. */ private double d; /** * Constructor. * @param lay layout: horizontal = true, vertical = false */ public BaseXSplit(final boolean lay) { layout(this); l = lay; } @Override public Component add(final Component comp) { if(getComponentCount() != 0) super.add(new BaseXSplitSep(l)); super.add(comp); s = null; return comp; } @Override public void removeAll() { super.removeAll(); s = null; } /** * Starts split pane dragging. * @param p position */ void startDrag(final double p) { d = p; t = s.clone(); } /** * Reacts on splitter drags. * @param sep separator * @param p current position */ void drag(final BaseXSplitSep sep, final double p) { final Component[] m = getComponents(); final int r = s.length; int q = 0; for(int n = 0; n < r - 1; ++n) if(m[(n << 1) + 1] == sep) q = n + 1; final double v = (d - p) / (l ? getWidth() : getHeight()); for(int i = 0; i < q; ++i) if(t[i] - v / q < .0001) return; for(int i = q; i < r; ++i) if(t[i] + v / (r - q) < .0001) return; for(int i = 0; i < q; ++i) s[i] = t[i] - v / q; for(int i = q; i < r; ++i) s[i] = t[i] + v / (r - q); revalidate(); } @Override public void addLayoutComponent(final String name, final Component comp) { } @Override public void removeLayoutComponent(final Component comp) { } @Override public Dimension preferredLayoutSize(final Container parent) { return getSize(); } @Override public Dimension minimumLayoutSize(final Container parent) { return preferredLayoutSize(parent); } @Override public void layoutContainer(final Container parent) { final Component[] c = getComponents(); final int h = getHeight(); final int w = getWidth(); final int m = c.length + 1 >> 1; final double p = (l ? w : h) - (m - 1) * BaseXSplitSep.SIZE; final boolean a = s == null; if(a) s = new double[m]; double v = 0; for(int n = 0; n < c.length; ++n) { final boolean b = (n & 1) == 0; double z = BaseXSplitSep.SIZE; if(b) z = s[n >> 1] == 0 ? (int) (p / m) : s[n >> 1] * p; final int y = (int) v; c[n].setBounds(l ? y : 0, l ? 0 : y, l ? (int) z : w, l ? h : (int) z); if(a && b) s[n >> 1] = z / p; v += z; } } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/BaseXSplitSep.java000066400000000000000000000036021222453003200266320ustar00rootroot00000000000000package org.basex.gui.layout; import java.awt.*; import java.awt.event.*; import javax.swing.event.*; import org.basex.gui.*; /** * This separator splits several panels and allows panel resizing. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class BaseXSplitSep extends BaseXBack { /** Size of splitter. */ static final int SIZE = 6; /** Color foreground. */ private final Color fore; /** Color background. */ private final Color back; /** Layout: horizontal = true, vertical = false. */ private final boolean l; /** * Constructor. * @param lay layout: horizontal = true, vertical = false */ BaseXSplitSep(final boolean lay) { setCursor(lay ? GUIConstants.CURSORMOVEH : GUIConstants.CURSORMOVEV); fore = getBackground(); back = fore.darker(); final MouseInputAdapter mouse = new MouseInputAdapter() { @Override public void mousePressed(final MouseEvent e) { ((BaseXSplit) getParent()).startDrag(pos(e)); } @Override public void mouseDragged(final MouseEvent e) { ((BaseXSplit) getParent()).drag(BaseXSplitSep.this, pos(e)); } }; addMouseListener(mouse); addMouseMotionListener(mouse); l = lay; } @Override public void paintComponent(final Graphics g) { super.paintComponent(g); final int w = getWidth(); final int h = getHeight(); g.setColor(fore); g.fillRect(0, 0, w, h); g.setColor(back); g.drawLine(0, 0, l ? 0 : w, l ? h : 0); g.drawLine(l ? w - 1 : 0, l ? 0 : h - 1, l ? w - 1 : w, l ? h : h - 1); } /** * Returns absolute cursor position. * @param e mouse event * @return absolute cursor position */ double pos(final MouseEvent e) { final Point p = getLocationOnScreen(); return l ? p.x + e.getX() : p.y + e.getY(); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/BaseXTable.java000066400000000000000000000064011222453003200261160ustar00rootroot00000000000000package org.basex.gui.layout; import java.awt.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.table.*; import org.basex.util.*; /** * Project specific CheckBox implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BaseXTable extends JTable { /** Table data. */ public Table data; /** Dialog instance. */ final BaseXDialog dialog; /** Table model. */ private final TableModel model; /** * Default constructor. * @param t table input * @param d dialog reference */ public BaseXTable(final Table t, final BaseXDialog d) { data = t; dialog = d; model = new TableModel(); setDefaultRenderer(Boolean.class, new CellRenderer()); setModel(model); getTableHeader().setReorderingAllowed(false); getTableHeader().setResizingAllowed(false); BaseXLayout.addInteraction(this, d); getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(final ListSelectionEvent e) { if(!e.getValueIsAdjusting() && getSelectedColumn() != -1) { dialog.action(e.getSource()); } } }); } /** * Updates the table. * @param t table; */ public void update(final Table t) { data = t; model.fireTableChanged(null); for(int i = 1; i < data.cols(); ++i) { final TableColumn tc = getColumnModel().getColumn(i); tc.setResizable(false); tc.setPreferredWidth(30); } } /** * Dialog specific table model. */ final class TableModel extends AbstractTableModel { @Override public int getColumnCount() { return data.cols(); } @Override public int getRowCount() { return data.rows(); } @Override public String getColumnName(final int col) { return Token.string(data.header.get(col)); } @Override public Object getValueAt(final int row, final int col) { final String o = data.value(row, col); return o.isEmpty() ? Boolean.FALSE : o.equals("X") ? Boolean.TRUE : o; } @Override public Class getColumnClass(final int c) { return getValueAt(0, c).getClass(); } @Override public boolean isCellEditable(final int row, final int col) { return col != 0 && !data.value(row, 0).equals("admin"); } @Override public void setValueAt(final Object value, final int row, final int col) { dialog.action(new Object[] { value, row, col }); } } /** * Own Renderer for cells. */ final class CellRenderer extends DefaultTableCellRenderer { @Override public Component getTableCellRendererComponent(final JTable tab, final Object val, final boolean sel, final boolean foc, final int row, final int col) { if(val instanceof Boolean) { final JCheckBox box = new JCheckBox(); box.setHorizontalAlignment(SwingConstants.CENTER); box.setSelected((Boolean) val); box.setEnabled(isCellEditable(row, col)); box.setOpaque(false); return box; } return super.getTableCellRendererComponent(tab, val, sel, foc, row, col); } } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/BaseXTabs.java000066400000000000000000000014111222453003200257540ustar00rootroot00000000000000package org.basex.gui.layout; import java.awt.*; import javax.swing.*; /** * Project specific TabbedPane implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BaseXTabs extends JTabbedPane { /** * Default constructor. * @param win parent window */ public BaseXTabs(final Window win) { BaseXLayout.addInteraction(this, win); } /** * Adds the specified component. * @param content tab content * @param header tab header * @param index index */ public void add(final Component content, final Component header, final int index) { add(content, index); setSelectedComponent(content); setTabComponentAt(getSelectedIndex(), header); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/BaseXTextField.java000066400000000000000000000062001222453003200267540ustar00rootroot00000000000000package org.basex.gui.layout; import static org.basex.gui.layout.BaseXKeys.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import org.basex.gui.*; import org.basex.gui.layout.BaseXLayout.DropHandler; /** * Project specific text field implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class BaseXTextField extends JTextField { /** Default width of text fields. */ public static final int DWIDTH = 350; /** History. */ BaseXHistory history; /** Last input. */ String last = ""; /** History pointer. */ int hist; /** * Constructor. * @param gui main window */ public BaseXTextField(final GUI gui) { this(null, gui, null); } /** * Constructor. * @param dialog dialog window */ public BaseXTextField(final BaseXDialog dialog) { this(null, dialog, dialog); } /** * Constructor. * @param txt input text * @param dialog dialog window */ public BaseXTextField(final String txt, final BaseXDialog dialog) { this(txt, dialog, dialog); } /** * Constructor. * @param txt input text * @param win parent window * @param dialog dialog reference */ private BaseXTextField(final String txt, final Window win, final BaseXDialog dialog) { BaseXLayout.setWidth(this, DWIDTH); BaseXLayout.addInteraction(this, win); if(txt != null) setText(txt); addFocusListener(new FocusAdapter() { @Override public void focusGained(final FocusEvent e) { selectAll(); } }); addKeyListener(new KeyAdapter() { @Override public void keyPressed(final KeyEvent e) { if(UNDOSTEP.is(e) || REDOSTEP.is(e)) { final String t = getText(); setText(last); last = t; } } }); if(dialog != null) addKeyListener(dialog.keys); setDragEnabled(true); BaseXLayout.addDrop(this, new DropHandler() { @Override public void drop(final Object object) { setText(object.toString()); if(dialog != null) dialog.action(BaseXTextField.this); } }); } /** * Attaches a history. * @param gui gui reference * @param option option */ public void history(final GUI gui, final Object[] option) { history = new BaseXHistory(gui, option); addKeyListener(new KeyAdapter() { @Override public void keyPressed(final KeyEvent e) { if(ENTER.is(e)) { store(); } else if(NEXTLINE.is(e) || PREVLINE.is(e)) { final boolean next = NEXTLINE.is(e); final String[] qu = gui.gprop.strings(option); if(qu.length == 0) return; hist = next ? Math.min(qu.length - 1, hist + 1) : Math.max(0, hist - 1); setText(qu[hist]); } } }); } /** * Stores the current history. */ public void store() { if(history == null) return; history.store(getText()); hist = 0; } @Override public void setText(final String txt) { last = txt; super.setText(txt); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/BaseXTree.java000066400000000000000000000021361222453003200257670ustar00rootroot00000000000000package org.basex.gui.layout; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.*; import javax.swing.tree.*; /** * Project specific tree implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class BaseXTree extends JTree { /** * Constructor. * @param root root node * @param w window reference */ public BaseXTree(final DefaultMutableTreeNode root, final Window w) { super(root); BaseXLayout.addInteraction(this, w); addMouseListener(new MouseAdapter() { @Override public void mousePressed(final MouseEvent e) { if(SwingUtilities.isRightMouseButton(e)) setSelectionRow(getClosestRowForLocation(e.getX(), e.getY())); } }); } /** * Sets the label borders. * @param t top distance * @param l left distance * @param b bottom distance * @param r right distance * @return self reference */ public BaseXTree border(final int t, final int l, final int b, final int r) { setBorder(new EmptyBorder(t, l, b, r)); return this; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/GUICode.java000066400000000000000000000016151222453003200253650ustar00rootroot00000000000000package org.basex.gui.layout; import javax.swing.*; /** * This class can be overwritten to define code snippets that are to be evaluated * after all pending events. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class GUICode { /** Counter. */ int counter; /** * Code to be run. * @param arg argument (may be {@code null}) */ public abstract void eval(final Object arg); /** * Invokes the specified thread after all other threads. */ public final void invokeLater() { invokeLater(null); } /** * Invokes the specified thread after all other threads. * @param arg optional argument */ public final void invokeLater(final Object arg) { final int c = ++counter; SwingUtilities.invokeLater(new Runnable() { @Override public void run() { if(c == counter) eval(arg); } }); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/TableLayout.java000066400000000000000000000070261222453003200263750ustar00rootroot00000000000000package org.basex.gui.layout; import java.awt.*; /** * This LayoutManager is similar to the GridLayout. The added components * keep their minimum size even when the parent container is resized. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class TableLayout implements LayoutManager { /** Number of columns. */ private final int cols; /** Number of rows. */ private final int rows; /** Horizontal inset. */ private final int insetX; /** Vertical inset. */ private final int insetY; /** Panel width. */ private int width; /** Panel height. */ private int height; /** Horizontal position. */ private final int[] posX; /** Vertical position. */ private final int[] posY; /** * Creates a grid layout with the specified number of rows and columns. * When displayed, the grid has the minimum size. * @param r number of rows * @param c number of columns */ public TableLayout(final int r, final int c) { this(r, c, 0, 0); } /** * Creates a grid layout with the specified number of rows and columns. * When displayed, the grid has the minimum size. * @param r number of rows * @param c number of columns * @param ix horizontal gap * @param iy vertical gap */ public TableLayout(final int r, final int c, final int ix, final int iy) { rows = r; cols = c; insetX = ix; insetY = iy; posX = new int[c]; posY = new int[r]; } @Override public void addLayoutComponent(final String name, final Component comp) { } @Override public void removeLayoutComponent(final Component comp) { } @Override public Dimension preferredLayoutSize(final Container parent) { synchronized(parent.getTreeLock()) { final Insets in = parent.getInsets(); final int nr = parent.getComponentCount(); int maxW = 0; int maxH = 0; for(int i = 0; i < cols; ++i) { posX[i] = maxW; final int w = maxW; int h = 0; for(int j = 0; j < rows; ++j) { final int n = j * cols + i; if(n >= nr) break; final Component c = parent.getComponent(n); final Dimension d = c.getPreferredSize(); if(maxW < w + d.width) maxW = w + d.width; if(posY[j] < h) posY[j] = h; else h = posY[j]; h += d.height; } if(maxH < h) maxH = h; } width = in.left + maxW + (cols - 1) * insetX + in.right; height = in.top + maxH + (rows - 1) * insetY + in.bottom; return new Dimension(width, height); } } @Override public Dimension minimumLayoutSize(final Container parent) { return preferredLayoutSize(parent); } @Override public void layoutContainer(final Container p) { preferredLayoutSize(p); synchronized(p.getTreeLock()) { final Insets in = p.getInsets(); final int nr = p.getComponentCount(); for(int j = 0; j < rows; ++j) { for(int i = 0; i < cols; ++i) { final int n = j * cols + i; if(n >= nr) return; final Dimension cs = p.getComponent(n).getPreferredSize(); final int x = in.left + posX[i] + i * insetX; final int y = in.top + posY[j] + j * insetY; final int w = cs.width > 0 ? cs.width : width - in.left - in.right; final int h = cs.height > 0 ? cs.height : height - in.top - in.bottom; p.getComponent(n).setBounds(x, y, w, h); } } } } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/TreeFolder.java000066400000000000000000000074771222453003200262150ustar00rootroot00000000000000package org.basex.gui.layout; import static org.basex.util.Token.*; import java.util.*; import javax.swing.tree.*; import org.basex.core.*; import org.basex.data.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * JTree node which represents a folder. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public class TreeFolder extends TreeNode { /** Children of node have been loaded. */ private boolean loaded; /** Maximum number of displayed/processed children for a node. */ public static final int MAXC = 10000; /** * Constructor. * @param nm displayed node name * @param pth folder path * @param t tree reference * @param d data reference */ public TreeFolder(final byte[] nm, final byte[] pth, final BaseXTree t, final Data d) { super(nm, pth, t, d); } @Override void load() { if(loaded || updating) return; updating = true; int cmax = MAXC; // add folders final byte[] sub = subfolder(); final TokenSet set = data.resources.children(subfolder(), true); for(final byte[] f : new TokenList(set).sort(Prop.CASE)) { add(new TreeFolder(f, sub, tree, data)); if(--cmax == 0) break; } // add leaves cmax = addLeaves(EMPTY, cmax, this); // add dummy node if not all nodes are displayed if(cmax <= 0) add(new TreeLeaf(token(Text.DOTS), sub, false, true, tree, data)); loaded = true; ((DefaultTreeModel) tree.getModel()).nodeStructureChanged(this); updating = false; } /** * Filters child nodes by the given filter expression and adds the remaining children * to the given node. * @param filter filter expression * @param cmax counter for the maximum number of children to add * @param target node to append filtered nodes * @return number of remaining nodes that can be added */ public int addLeaves(final byte[] filter, final int cmax, final TreeFolder target) { final TokenBoolMap tbm = data.resources.children(subfolder(), false); final List keys = new ArrayList(tbm.size()); // get desired leaves, depending on the given filter for(final byte[] b : tbm) { if(filter.length == 0 || eq(b, filter)) keys.add(b); } Collections.sort(keys, new Comparator() { @Override public int compare(final byte[] o1, final byte[] o2) { return Prop.CASE ? diff(o1, o2) : diff(lc(o1), lc(o2)); } }); // finally add the necessary leaves final byte[] sub = subfolder(); int i = 0, m = cmax; while(i < keys.size() && m-- > 0) { final byte[] nm = keys.get(i++); target.add(new TreeLeaf(nm, sub, tbm.get(nm), false, tree, data)); } return m; } /** * Returns the path for a child node of this folder. * @return sub folder path */ byte[] subfolder() { return path.length > 1 ? concat(concat(path, SLASH), name) : concat(path, name); } /** * Extracts the file/document/folder name from the given path. * @param path path * @return name */ public static byte[] name(final byte[] path) { final byte[][] s = split(path, '/'); if(s.length == 0) return EMPTY; return s[s.length - 1]; } /** * Returns the path without folder/file name for the given path. * @param path path * @return path without file/folder name */ public static byte[] path(final byte[] path) { if(path.length == 0) return path; final byte[] r = substring(path, 0, lastIndexOf(path, '/')); return r.length == 0 ? SLASH : r; } /** * Removes all children from this node. */ public void removeChildren() { removeAllChildren(); loaded = false; } /** * Reloads this node without repainting the tree. */ public void reload() { removeChildren(); load(); } @Override public boolean isLeaf() { return false; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/TreeLeaf.java000066400000000000000000000020061222453003200256300ustar00rootroot00000000000000package org.basex.gui.layout; import org.basex.data.*; /** * JTree node which represents a leaf (which represents either a raw file * or a document). * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class TreeLeaf extends TreeNode { /** Represents raw file (true) or document (false). */ public final boolean raw; /** This leaf is a dummy node displaying that node listing is abbreviated. */ public final boolean abbr; /** * Constructor. * @param nm name of content node * @param pth node path * @param rw represented node is raw file * @param ab abbreviated node listing * @param bxt tree reference * @param d data reference */ public TreeLeaf(final byte[] nm, final byte[] pth, final boolean rw, final boolean ab, final BaseXTree bxt, final Data d) { super(nm, pth, bxt, d); raw = rw; abbr = ab; } @Override public boolean isLeaf() { return true; } @Override void load() { // leaves cannot be expanded } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/TreeNode.java000066400000000000000000000043621222453003200256550ustar00rootroot00000000000000package org.basex.gui.layout; import static org.basex.util.Token.*; import javax.swing.event.*; import javax.swing.tree.*; import org.basex.data.*; /** * JTree node for representing database content (raw files / documents). * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public abstract class TreeNode extends DefaultMutableTreeNode implements TreeWillExpandListener { /** Node name. */ public final byte[] name; /** Relative path to this node. Starts with one slash, no trailing slashes. * File / folder name is not part of the path. */ final byte[] path; /** Tree reference for lazy loading. */ final BaseXTree tree; /** Data reference. */ final Data data; /** Updating. */ boolean updating; /** * Constructor. * @param nm displayed node name * @param pth folder path * @param bxt tree reference * @param d data reference */ TreeNode(final byte[] nm, final byte[] pth, final BaseXTree bxt, final Data d) { name = nm; path = pth; tree = bxt; data = d; tree.addTreeWillExpandListener(this); } /** * Prepares the given path to be used as a tree node. * The returned path looks the following: *
    *
  1. The path is relative to the database root directory
  2. *
  3. It has one leading slash
  4. *
  5. It has no trailing slashes, no matter if it represents a folder or file
  6. *
* @param path path to be prepared * @return path */ public static byte[] preparePath(final byte[] path) { String p = MetaData.normPath(string(path)); if(p.endsWith("/")) p = p.substring(0, p.length() - 1); return concat(SLASH, token(p)); } /** * Returns the complete path (path + name) of this node as a string. * @return path string */ public String path() { return string(preparePath(concat(path, SLASH, name))); } /** * Lazy loading. */ abstract void load(); @Override public void treeWillExpand(final TreeExpansionEvent e) throws ExpandVetoException { if(equals(e.getPath().getLastPathComponent())) load(); } @Override public void treeWillCollapse(final TreeExpansionEvent e) throws ExpandVetoException { } @Override public String toString() { return string(name); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/TreeRootFolder.java000066400000000000000000000013171222453003200270440ustar00rootroot00000000000000package org.basex.gui.layout; import org.basex.data.*; /** * JTree node which represents the root folder. The root folder carries * the name of the database and has basically an artificial path ('/') * which leads to problems if treated like an ordinary folder node. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public class TreeRootFolder extends TreeFolder { /** * Constructor. * @param nm name * @param pth path * @param bxt tree reference * @param d data reference */ public TreeRootFolder(final byte[] nm, final byte[] pth, final BaseXTree bxt, final Data d) { super(nm, pth, bxt, d); } @Override byte[] subfolder() { return path; } }basex-7.7.2/basex-core/src/main/java/org/basex/gui/layout/package.html000066400000000000000000000000611222453003200255560ustar00rootroot00000000000000 Project specific GUI components. basex-7.7.2/basex-core/src/main/java/org/basex/gui/package.html000066400000000000000000000001261222453003200242430ustar00rootroot00000000000000 GUI Package. Can be completely removed if only the backend is needed. basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/000077500000000000000000000000001222453003200227355ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/View.java000066400000000000000000000060471222453003200245210ustar00rootroot00000000000000package org.basex.gui.view; import static org.basex.gui.layout.BaseXKeys.*; import java.awt.*; import java.awt.event.*; import org.basex.gui.*; import org.basex.gui.GUIConstants.Fill; import org.basex.gui.layout.*; /** * View observer pattern. All inheriting classes are attached to the * views array * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class View extends BaseXPanel { /** * Registers the specified view. * @param name name of view * @param man view manager */ protected View(final String name, final ViewNotifier man) { super(man.gui); mode(man.gui.gprop.is(GUIProp.GRADIENT) ? Fill.GRADIENT : Fill.PLAIN); setFocusable(true); setBackground(Color.white); setName(name); addMouseListener(this); addMouseMotionListener(this); addMouseWheelListener(this); addKeyListener(this); addComponentListener(this); man.add(this); } /** * Called when the data reference has changed. */ public abstract void refreshInit(); /** * Called when a new focus has been chosen. */ public abstract void refreshFocus(); /** * Called when a context set has been * marked. */ public abstract void refreshMark(); /** * Called when a new context set has been chosen. * @param more show more details * @param quick perform a quick context switch */ public abstract void refreshContext(boolean more, boolean quick); /** * Called when GUI design has changed. */ public abstract void refreshLayout(); /** * Called when updates have been done in the data structure. */ public abstract void refreshUpdate(); /** * Tests if this view is currently marked as visible. * @return result of check */ public abstract boolean visible(); /** * Sets a flag denoting the visibility of the view. * @param v visibility flag */ public abstract void visible(final boolean v); /** * Tests if this view relies on a database instance. * @return result of check */ protected abstract boolean db(); @Override public void mouseEntered(final MouseEvent e) { if(!gui.updating && gui.gprop.is(GUIProp.MOUSEFOCUS)) requestFocusInWindow(); } @Override public void mouseExited(final MouseEvent e) { if(!gui.updating) gui.cursor(GUIConstants.CURSORARROW); } @Override public void mousePressed(final MouseEvent e) { if(!gui.updating) requestFocusInWindow(); } @Override public void keyPressed(final KeyEvent e) { if(gui.updating) return; if(ESCAPE.is(e)) { gui.fullscreen(false); } if(gui.context.data() == null) return; if(SPACE.is(e)) { gui.notify.mark(sc(e) ? 2 : e.isShiftDown() ? 1 : 0, null); } else if(ENTER.is(e)) { GUICommands.C_FILTER.execute(gui); } else if(GOBACK2.is(e)) { GUICommands.C_GOBACK.execute(gui); } } @Override public final String toString() { return getName(); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/ViewAlignment.java000066400000000000000000000046251222453003200263600ustar00rootroot00000000000000package org.basex.gui.view; import org.basex.gui.layout.*; import org.basex.util.*; /** * Layout class. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class ViewAlignment implements ViewLayout { /** Alignment (horizontal/vertical). */ final boolean horiz; /** Layout Components. */ ViewLayout[] comp = {}; /** * Constructor. * @param h alignment (horizontal/vertical) */ ViewAlignment(final boolean h) { horiz = h; } /** * Adds a single object. * @param obj object to be added */ void add(final ViewLayout obj) { add(obj, comp.length); } /** * Adds a single object at the specified position. * @param obj object to insert * @param o index */ void add(final ViewLayout obj, final int o) { final int n = comp.length; final ViewLayout[] tmp = new ViewLayout[n + 1]; System.arraycopy(comp, 0, tmp, 0, o); System.arraycopy(comp, o, tmp, o + 1, n - o); comp = tmp; comp[o] = obj; } /** * Removes a single object. * @param o index */ private void remove(final int o) { comp = Array.delete(comp, o); } @Override public boolean isVisible() { for(final ViewLayout c : comp) if(c.isVisible()) return true; return false; } @Override public void setVisibility(final boolean db) { for(final ViewLayout c : comp) c.setVisibility(db); } @Override public boolean delete(final ViewPanel panel) { for(int o = 0; o < comp.length; ++o) { if(comp[o].delete(panel)) { if(comp[o] instanceof ViewPanel) { remove(o--); } else { comp[o] = ((ViewAlignment) comp[o]).comp[0]; } } } return comp.length < 2; } @Override public void createView(final BaseXBack panel) { // skip invisible layouts if(!isVisible()) return; final BaseXBack split = new BaseXSplit(horiz); for(final ViewLayout c : comp) c.createView(split); panel.add(split); } @Override public String layoutString(final boolean all) { final StringBuilder str = new StringBuilder(horiz ? "H " : "V "); for(final ViewLayout c : comp) str.append(c.layoutString(all)); str.append("- "); return str.toString(); } @Override public String toString() { return (horiz ? "Horizontal" : "Vertical") + " Layout"; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/ViewContainer.java000066400000000000000000000260101222453003200263540ustar00rootroot00000000000000package org.basex.gui.view; import static org.basex.core.Text.*; import static org.basex.gui.GUIConstants.*; import java.awt.*; import java.util.*; import org.basex.core.*; import org.basex.gui.*; import org.basex.gui.GUIConstants.Fill; import org.basex.gui.layout.*; import org.basex.util.*; /** * This class manages all visible and invisible views and allows drag and * drop operations inside the panel. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ViewContainer extends BaseXBack { /** Dragging stroke. */ private static final BasicStroke STROKE = new BasicStroke(2); /** Orientation enumerator. */ private enum Target { /** North orientation. */ NORTH, /** West orientation. */ WEST, /** East orientation. */ EAST, /** South orientation. */ SOUTH } /** Reference to main window. */ private final AGUI gui; /** View Layout. */ private ViewAlignment layout; /** Current layout string. */ private String layoutString; /** View panels. */ private final ViewPanel[] views; /** Source View. */ private ViewPanel source; /** Target View. */ private ViewPanel target; /** Logo reference. */ private final Image logo; /** Target orientation. */ private Target orient; /** Temporary mouse position. */ private Point sp; /** Temporary rectangle position. */ private final int[] pos = new int[4]; /** * Constructor. * @param main reference to the main window * @param v view panels */ public ViewContainer(final AGUI main, final View... v) { layout(new BorderLayout()).mode(Fill.PLAIN); logo = BaseXLayout.image("logo"); setBackground(Color.white); views = new ViewPanel[v.length]; for(int i = 0; i < v.length; ++i) views[i] = new ViewPanel(v[i]); gui = main; // build layout or use default if something goes wrong if(!buildLayout(gui.gprop.get(GUIProp.VIEWS)) && !buildLayout(VIEWS)) { Util.errln(Util.name(this) + ": could not build layout \"%\"", VIEWS); } } /** * Updates and validates the views. */ public void updateViews() { // update visibility of all components, dependent of the existence of a database layout.setVisibility(gui.context.data() != null); // check if the layout of visible components has changed final String ls = layout.layoutString(false); if(ls.equals(layoutString)) return; // rebuild views removeAll(); layout.createView(this); validate(); repaint(); gui.gprop.set(GUIProp.VIEWS, layout.layoutString(true)); layoutString = ls; } @Override public void paintComponent(final Graphics g) { super.paintComponent(g); if(getComponentCount() != 0) return; final int w = getWidth(); final int h = getHeight(); final int hh = Math.max(220, Math.min(700, h)); final Insets i = getInsets(); if(gui.gprop.is(GUIProp.GRADIENT)) { BaseXLayout.fill(g, WHITE, color1, i.left, i.top, w - i.right, h - i.bottom); } if(w < 150 || h < 160) return; final int lh = logo.getHeight(this); final int y = (hh - lh - 60) / 2; g.drawImage(logo, (w - logo.getWidth(this)) / 2, y, this); if(w < 200 || h < 200) return; g.setColor(GUIConstants.DGRAY); g.setFont(lfont); BaseXLayout.drawCenter(g, VERSINFO + ' ' + Prop.VERSION, w, y + 20 + lh); } /** * Drags the current view. * @param panel panel to be dragged * @param p absolute mouse position */ void dragPanel(final ViewPanel panel, final Point p) { source = panel; sp = p; calc(); repaint(); } /** * Drops a view and reorganizes the layout. */ void dropPanel() { if(source == null) return; if(orient != null) { if(layout.delete(source) && !(layout.comp[0] instanceof ViewPanel)) layout = (ViewAlignment) layout.comp[0]; if(target == null) layout = addView(layout); else add(layout); updateViews(); } source = null; repaint(); } /** * Adds the dragged view after if it has been removed. * @param lay layout instance * @return true if component was successfully added */ private boolean add(final ViewAlignment lay) { for(int o = 0; o < lay.comp.length; ++o) { final ViewLayout comp = lay.comp[o]; if(comp instanceof ViewAlignment) { if(add((ViewAlignment) comp)) return true; } else if(comp == target) { final boolean west = orient == Target.WEST; final boolean east = orient == Target.EAST; if(orient == Target.NORTH || west) { if(lay.horiz == west) { lay.add(source, o); } else { final ViewAlignment l = new ViewAlignment(west); l.add(source); l.add(target); lay.comp[o] = l; } } else if(orient == Target.SOUTH || east) { if(lay.horiz == east) { lay.add(source, o + 1); } else { final ViewAlignment l = new ViewAlignment(east); l.add(target); l.add(source); lay.comp[o] = l; } } return true; } } return false; } /** * Adds the dragged view into the specified layout instance. * @param lay layout instance * @return resulting layout */ private ViewAlignment addView(final ViewAlignment lay) { final boolean west = orient == Target.WEST; final boolean east = orient == Target.EAST; ViewAlignment l = lay; if(orient == Target.NORTH || west) { if(l.horiz == west) { l.add(source, 0); } else { final ViewAlignment ll = new ViewAlignment(west); ll.add(source); ll.add(l); l = ll; } } else if(orient == Target.SOUTH || east) { if(l.horiz == east) { l.add(source); } else { final ViewAlignment ll = new ViewAlignment(east); ll.add(l); ll.add(source); l = ll; } } return l; } /** * Finds the view under the mouse position and returns it as possible * target for dropping the dragged view. * @return view container */ private ViewPanel getTarget() { for(final ViewPanel v : views) { if(v.isVisible() && new Rectangle(absLoc(v), v.getSize()).contains(sp)) return v; } return null; } /** * Calculates the absolute location for the specified point and component. * @param comp component * @return absolute location */ private Point absLoc(final Component comp) { Component c = comp; final Point p = c.getLocation(); do { c = c.getParent(); p.x += c.getX(); p.y += c.getY(); } while(c.getParent() != this); return p; } @Override public void paint(final Graphics g) { super.paint(g); if(source == null) return; ((Graphics2D) g).setStroke(STROKE); final int ac = AlphaComposite.SRC_OVER; if(orient != null) { g.setColor(color(16)); g.drawRect(pos[0], pos[1], pos[2] - 1, pos[3] - 1); ((Graphics2D) g).setComposite(AlphaComposite.getInstance(ac, 0.3f)); g.setColor(color(8)); g.fillRect(pos[0], pos[1], pos[2], pos[3]); } } /** * Calculates the target position. */ private void calc() { final int hh = getHeight(); final int ww = getWidth(); pos[0] = 1; pos[1] = 1; pos[2] = ww - 2; pos[3] = hh - 2; orient = null; target = getTarget(); // paint panel which is currently moved somewhere else if(target != null && target != source) { final Rectangle tr = new Rectangle(absLoc(target), target.getSize()); final int minx = tr.width >> 1; final int miny = tr.height >> 1; if(Math.abs(tr.x + tr.width / 2 - sp.x) < tr.width / 3) { if(sp.y > tr.y && sp.y < tr.y + miny) { pos[0] = tr.x; pos[1] = tr.y; pos[2] = tr.width; pos[3] = miny; orient = Target.NORTH; } else if(sp.y > tr.y + tr.height - miny && sp.y < tr.y + tr.height) { pos[0] = tr.x; pos[1] = tr.y + tr.height - miny; pos[2] = tr.width; pos[3] = miny; orient = Target.SOUTH; } } else if(Math.abs(tr.y + tr.height / 2 - sp.y) < tr.height / 3) { if(sp.x > tr.x && sp.x < tr.x + minx) { pos[0] = tr.x; pos[1] = tr.y; pos[2] = minx; pos[3] = tr.height; orient = Target.WEST; } else if(sp.x > tr.x + tr.width - minx && sp.x < tr.x + tr.width) { pos[0] = tr.x + tr.width - minx; pos[1] = tr.y; pos[2] = minx; pos[3] = tr.height; orient = Target.EAST; } } } if(orient == null) { final int minx = ww >> 2; final int miny = hh >> 2; target = null; if(sp.y < miny) { pos[3] = miny; orient = Target.NORTH; } else if(sp.y > hh - miny) { pos[3] = miny; pos[1] = hh - miny; orient = Target.SOUTH; } else if(sp.x < minx) { pos[2] = minx; orient = Target.WEST; } else if(sp.x > ww - minx) { pos[2] = minx; pos[0] = ww - minx; orient = Target.EAST; } } } /** * Builds the view layout by parsing the layout string. * @param cnstr layout string * @return true if everything went alright */ private boolean buildLayout(final String cnstr) { try { int nv = 0; layout = null; int lvl = -1; final ViewAlignment[] l = new ViewAlignment[16]; final StringTokenizer st = new StringTokenizer(cnstr); while(st.hasMoreTokens()) { final String t = st.nextToken(); if(Token.eq(t, "H", "V")) { l[lvl + 1] = new ViewAlignment(t.equals("H")); if(layout == null) { layout = l[0]; } else { l[lvl].add(l[lvl + 1]); } ++lvl; } else if(t.equals("-")) { --lvl; } else { final ViewPanel view = getView(t); if(view == null) return false; l[lvl].add(view); ++nv; } } if(nv == views.length) return true; Util.errln(Util.name(this) + ": initializing views: " + cnstr); } catch(final Exception ex) { Util.debug(ex); Util.errln(Util.name(this) + ": could not build layout: " + cnstr); } return false; } /** * Returns the view specified by its internal name. The view names * are specified in the {@link GUIConstants} class. * @param name name of the view * @return found view container */ private ViewPanel getView(final String name) { for(final ViewPanel view : views) { if(view.toString().equals(name)) return view; } Util.debug(Util.name(this) + ": Unknown view \"%\"", name); return null; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/ViewData.java000066400000000000000000000106401222453003200253050ustar00rootroot00000000000000package org.basex.gui.view; import static org.basex.data.DataText.*; import org.basex.data.*; import org.basex.gui.*; import org.basex.query.func.*; import org.basex.util.*; import org.basex.util.list.*; /** * This class assembles some database access methods which are used * in the same way by different visualizations. If more specific database * access is needed, it is advisable to directly work on the {@link Data} * class. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ViewData { /** Preventing class instantiation. */ private ViewData() { } /** * Checks if the specified node is a leaf node * (text node or file element or file tag). * @param prop gui properties * @param d data reference * @param pre pre value * @return result of check */ public static boolean leaf(final GUIProp prop, final Data d, final int pre) { final int kind = d.kind(pre); if(kind == Data.ATTR) return true; final boolean atts = prop.is(GUIProp.MAPATTS); final int last = pre + (atts ? 1 : d.attSize(pre, kind)); return last == d.meta.size || d.parent(pre, kind) >= d.parent(last, d.kind(last)); } /** * Returns path for the specified pre value. * @param data data reference * @param pre pre value * @return current path */ public static byte[] path(final Data data, final int pre) { if(data == null || pre >= data.meta.size) return Token.EMPTY; int p = pre; int k = data.kind(p); final IntList il = new IntList(); while(k != Data.DOC) { il.add(p); p = data.parent(p, k); k = data.kind(p); } final byte[] doc = content(data, p, true); final TokenBuilder tb = new TokenBuilder(); tb.add(Function._DB_OPEN.args(data.meta.name, Token.string(doc))); for(int i = il.size() - 1; i >= 0; i--) { tb.add('/'); tb.add(content(data, il.get(i), true)); } return tb.finish(); } /** * Returns the contents of the specified node. * @param data data reference * @param p pre value * @param s if specified, a short representation is returned * (no full-text nodes, only attribute names) * @return name */ public static byte[] content(final Data data, final int p, final boolean s) { final int k = data.kind(p); switch(k) { case Data.ELEM: return data.name(p, k); case Data.DOC: return data.text(p, true); case Data.TEXT: return s ? TEXT : data.text(p, true); case Data.COMM: return s ? COMM : data.text(p, true); case Data.PI: return s ? PI : data.text(p, true); } final TokenBuilder tb = new TokenBuilder(); tb.add(ATT); tb.add(data.name(p, k)); if(!s) { tb.add(ATT1); tb.add(data.text(p, false)); tb.add(ATT2); } return tb.finish(); } /** * Returns the tag name of the specified node. * Note that the pre value must reference an element node. * @param prop gui properties * @param data data reference * @param pre pre value * @return name */ public static byte[] name(final GUIProp prop, final Data data, final int pre) { if(data.kind(pre) == Data.ELEM) { final int id = ViewData.nameID(data); if(id != 0 && prop.is(GUIProp.SHOWNAME)) { final byte[] att = data.attValue(id, pre); if(att != null) return att; } } return content(data, pre, true); } /** * Returns the name id of the specified node. * @param data data reference * @return name id */ public static int nameID(final Data data) { return data.atnindex.id(DataText.T_NAME); } /** * Returns the size id of the specified node. * @param data data reference * @return name id */ public static int sizeID(final Data data) { return data.atnindex.id(DataText.T_SIZE); } /** * Returns the parent for the specified node. * @param data data reference * @param pre child node * @return parent node */ public static int parent(final Data data, final int pre) { return data.parent(pre, data.kind(pre)); } /** * Returns the size for the specified node. * @param data data reference * @param pre child node * @return parent node */ public static int size(final Data data, final int pre) { return data.size(pre, data.kind(pre)); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/ViewLayout.java000066400000000000000000000016621222453003200257150ustar00rootroot00000000000000package org.basex.gui.view; import org.basex.gui.layout.*; /** * This is an interface for view layout components. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ interface ViewLayout { /** * Checks if the view layout is visible. * @return true if layout is visible */ boolean isVisible(); /** * Sets the visibility of the view layout. * @param db database flag */ void setVisibility(final boolean db); /** * Removes the specified panel. * @param panel panel to be removed * @return true if panel was removed */ boolean delete(ViewPanel panel); /** * Adds a layout to the specified panel. * @param panel current panel */ void createView(BaseXBack panel); /** * Constructs a build string. * @param all also include invisible components * @return build string */ String layoutString(boolean all); } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/ViewMover.java000066400000000000000000000056171222453003200255340ustar00rootroot00000000000000package org.basex.gui.view; import java.awt.*; import java.awt.event.*; import org.basex.core.*; import org.basex.gui.*; import org.basex.gui.layout.*; /** * This panel is added to each view to allow drag and drop operations. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class ViewMover extends BaseXPanel { /** Panel height. */ private int height; /** Flag if current mover is active. */ private boolean active; /** Indicates if cursor is placed inside the mover. */ private boolean in; /** * Constructor. * @param main reference to the main window */ ViewMover(final AGUI main) { super(main); setLayout(new BorderLayout()); addKeyListener(this); addMouseListener(this); addMouseMotionListener(this); setCursor(GUIConstants.CURSORMOVE); refreshLayout(); new BaseXPopup(this, new GUICmd[] { new GUIBaseCmd() { @Override public String label() { return Text.CLOSE; } @Override public void execute(final GUI g) { ((ViewPanel) getParent()).delete(); } }}); } @Override public void paintComponent(final Graphics g) { ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); final int w = getWidth(); final int h = getHeight(); g.setColor(GUIConstants.color(active ? 5 : in ? 3 : 1)); g.fillRect(0, 0, w, h); g.setColor(GUIConstants.color(active ? 16 : in ? 13 : 10)); final int d = height >> 1; for(int x = -d >> 1; x < w; x += 2 + (height >> 2)) g.drawLine(x + d, 0, x, h - 1); g.drawRect(0, 0, w - 1, h - 1); } @Override public void mouseDragged(final MouseEvent e) { final ViewPanel view = (ViewPanel) getParent(); Component comp = view; while(!((comp = comp.getParent()) instanceof ViewContainer)); final Point a = getLocationOnScreen(); final Point b = comp.getLocationOnScreen(); final Point c = new Point(a.x - b.x + e.getX(), a.y - b.y + e.getY()); ((ViewContainer) comp).dragPanel(view, c); active = true; } @Override public void mousePressed(final MouseEvent e) { active = true; repaint(); } @Override public void mouseReleased(final MouseEvent e) { if(!active) return; Component comp = this; while(!((comp = comp.getParent()) instanceof ViewContainer)); ((ViewContainer) comp).dropPanel(); active = false; repaint(); } @Override public void mouseEntered(final MouseEvent e) { in = true; repaint(); } @Override public void mouseExited(final MouseEvent e) { in = false; repaint(); } /** * Called when GUI design has changed. */ public void refreshLayout() { height = Math.max(10, 6 + (int) (GUIConstants.fontSize * 0.333)); BaseXLayout.setHeight(this, height); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/ViewNotifier.java000066400000000000000000000173701222453003200262220ustar00rootroot00000000000000package org.basex.gui.view; import static org.basex.core.Text.*; import java.awt.*; import org.basex.core.*; import org.basex.data.*; import org.basex.gui.*; import org.basex.gui.layout.*; import org.basex.util.*; /** * This class serves as a container for all existing views. The observer pattern * is used to inform all views on user interactions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ViewNotifier { /** Large database size (minimum database size to show warning). */ private static final long LARGEDB = 200000000; /** Maximum history size. */ public static final int MAXHIST = 20; /** History pointer. */ public int hist; /** Reference to main window. */ final GUI gui; /** Zoomed rectangle history. */ private final Nodes[] marked = new Nodes[MAXHIST]; /** Zoomed rectangle history. */ private final Nodes[] cont = new Nodes[MAXHIST]; /** Command history. */ private final String[] queries = new String[MAXHIST]; /** Attached views. */ private View[] view = new View[0]; /** Number of history entries. */ private int histsize; /** * Constructor. * @param main reference to the main window */ public ViewNotifier(final GUI main) { gui = main; } /** * Adds a new view. * @param v view to be added */ void add(final View v) { view = Array.add(view, v); } /** * Notifies all views of a data reference change. */ public void init() { final Data data = initHistory(gui.context); if(data != null) { // if a large database is opened, the user is asked if complex /// visualizations should be closed first final long size = data.meta.dbsize(); boolean open = false; for(final View v : view) open |= v.visible() && v.db(); if(open && size > LARGEDB && BaseXDialog.confirm(gui, Util.info(H_LARGE_DB, Performance.format(size)))) { for(final View v : view) if(v.visible() && v.db()) v.visible(false); } } else { // database closed: close open dialogs for(final Window w : gui.getOwnedWindows()) { if(w.isVisible() && w instanceof BaseXDialog) ((BaseXDialog) w).cancel(); } } gui.context.focused = -1; for(final View v : view) v.refreshInit(); gui.layoutViews(); gui.setTitle(data != null ? data.meta.name : null); } /** * Notifies all views of a focus change. * @param pre focused pre value * @param vw the calling view */ public void focus(final int pre, final View vw) { if(gui.context.focused == pre) return; gui.context.focused = pre; for(final View v : view) if(v != vw && v.visible()) v.refreshFocus(); if(pre != -1) { gui.status.setText(Token.string(ViewData.path(gui.context.data(), pre))); } } /** * Notifies all views of a selection change. * @param mark marked nodes * @param vw the calling view */ public void mark(final Nodes mark, final View vw) { final Context ctx = gui.context; ctx.marked = mark; for(final View v : view) if(v != vw && v.visible()) v.refreshMark(); gui.filter.setEnabled(mark.size() != 0); gui.refreshControls(); } /** * Notifies all views of a selection change. * The mode flag determines what happens: *
    *
  • 0: set currently focused node as marked node
  • *
  • 1: add currently focused node
  • *
  • 2: toggle currently focused node
  • *
* @param mode mark mode * @param vw the calling view */ public void mark(final int mode, final View vw) { final int f = gui.context.focused; if(f == -1) return; final Context ctx = gui.context; Nodes nodes = ctx.marked; if(mode == 0) { nodes = new Nodes(f, ctx.data()); } else if(mode == 1) { nodes.union(new int[] { f }); } else { nodes.toggle(f); } mark(nodes, vw); } /** * Moves around in the internal history and notifies all views of a context change. * @param forward move forward or backward */ public void hist(final boolean forward) { final Context ctx = gui.context; final String query; if(forward) { if(hist == histsize) return; query = queries[++hist]; } else { if(hist == 0) return; marked[hist] = ctx.marked; query = queries[--hist]; } ctx.set(cont[hist], marked[hist]); gui.input.setText(query); for(final View v : view) if(v.visible()) v.refreshContext(forward, false); gui.refreshControls(); } /** * Notifies all views of a context change. * @param nodes new context set (may be {@code null} if root nodes are addressed) * @param quick quick switch * @param vw the calling view */ public void context(final Nodes nodes, final boolean quick, final View vw) { final Context ctx = gui.context; // add new entry if current node set has not been cached yet final Nodes newn = nodes.checkRoot(); final Nodes empty = new Nodes(new int[0], ctx.data(), ctx.marked.ftpos); final Nodes curr = quick ? ctx.current() : null; final Nodes cmp = quick ? curr : ctx.marked; if(cont[hist] == null ? cmp != null : cmp == null || !cont[hist].sameAs(cmp)) { checkHist(); if(quick) { // store history entry queries[hist] = ""; marked[hist] = new Nodes(ctx.data()); // add current entry cont[++hist] = curr; } else { // store history entry final String in = gui.input.getText(); queries[hist] = in; marked[hist] = ctx.marked; // add current entry cont[++hist] = newn; queries[hist] = in; marked[hist] = empty; } histsize = hist; } ctx.set(newn, empty); for(final View v : view) if(v != vw && v.visible()) v.refreshContext(true, quick); gui.refreshControls(); } /** * Notifies all views of updates in the data structure. */ public void update() { final Data data = initHistory(gui.context); if(data == null) return; gui.context.marked = new Nodes(data); for(final View v : view) if(v.visible()) v.refreshUpdate(); gui.refreshControls(); } /** * Notifies all views of layout changes. */ public void layout() { for(final View v : view) { v.refreshLayout(); final ViewPanel vp = (ViewPanel) v.getParent(); final ViewMover vm = (ViewMover) vp.getComponent(0); vm.refreshLayout(); } } /** * Returns the last or next query string. * @param back back/forward flag * @return query string */ public String query(final boolean back) { return back ? hist > 0 ? hist > 1 ? queries[hist - 2] : "" : null : hist < histsize ? queries[hist + 1] : null; } // PRIVATE METHODS ========================================================== /** * Checks the history data arrays. */ private void checkHist() { final int hl = queries.length; if(hist + 1 == hl) { Array.move(queries, 1, 0, hl - 1); Array.move(cont, 1, 0, hl - 1); Array.move(marked, 1, 0, hl - 1); --hist; } } /** * Removes existing history entries and sets an initial entry. * @param ctx database context * @return {@link Data} reference, or {@code null} */ private Data initHistory(final Context ctx) { for(int h = 0; h < histsize; h++) { marked[h] = null; cont[h] = null; queries[h] = null; } hist = 0; histsize = 0; final Data data = ctx.data(); if(data != null) { // new database opened marked[0] = new Nodes(data); queries[0] = ""; } return data; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/ViewPanel.java000066400000000000000000000025501222453003200254740ustar00rootroot00000000000000package org.basex.gui.view; import java.awt.*; import java.util.*; import org.basex.gui.layout.*; /** * This class contains a view reference and adds a {@link ViewMover} * on top of the view. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class ViewPanel extends BaseXBack implements ViewLayout { /** View reference. */ private final View view; /** * Constructor. * @param v view to be stored */ ViewPanel(final View v) { layout(new BorderLayout()); add(new ViewMover(v.gui), BorderLayout.NORTH); add(v, BorderLayout.CENTER); view = v; } @Override public void setVisibility(final boolean db) { setVisible(view.visible() && (db || !view.db())); } @Override public boolean delete(final ViewPanel panel) { return this == panel; } @Override public void createView(final BaseXBack panel) { if(isVisible()) panel.add(this); } /** * Makes the view invisible. */ public void delete() { view.gui.gprop.setObject("SHOW" + view.getName().toUpperCase(Locale.ENGLISH), false); view.gui.layoutViews(); } @Override public String layoutString(final boolean all) { return all || isVisible() ? view.getName() + ' ' : ""; } @Override public String toString() { return view.getName(); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/ViewRect.java000066400000000000000000000024751222453003200253400ustar00rootroot00000000000000package org.basex.gui.view; import org.basex.util.*; /** * View rectangle. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class ViewRect { /** X position. */ public int x; /** Y position. */ public int y; /** Width. */ public int w; /** Height. */ public int h; /** Rectangle pre value. */ public int pre; /** Level. */ public int level; /** * Default constructor. */ public ViewRect() { } /** * Simple rectangle constructor. * @param xx x position * @param yy y position * @param ww width * @param hh height */ protected ViewRect(final int xx, final int yy, final int ww, final int hh) { x = xx; y = yy; w = ww; h = hh; } /** * Verifies if the specified coordinates are inside the rectangle. * @param xx x position * @param yy y position * @return result of check */ public final boolean contains(final int xx, final int yy) { return (xx >= x && xx <= x + w || xx >= x + w && xx <= x) && (yy >= y && yy <= y + h || yy >= y + h && yy <= y); } @Override public final String toString() { return Util.name(this) + "[x=" + x + ",y=" + y + ",h=" + h + ",w=" + w + ",h=" + h + ",pre=" + pre + ",level=" + level + ']'; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/editor/000077500000000000000000000000001222453003200242235ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/editor/EditorArea.java000066400000000000000000000142111222453003200271040ustar00rootroot00000000000000package org.basex.gui.view.editor; import static org.basex.core.Text.*; import static org.basex.gui.layout.BaseXKeys.*; import static org.basex.util.Token.*; import java.awt.event.*; import java.io.*; import javax.swing.*; import org.basex.build.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.core.parse.*; import org.basex.gui.*; import org.basex.gui.editor.*; import org.basex.gui.layout.*; import org.basex.io.*; import org.basex.query.*; import org.basex.util.*; /** * This class extends the text editor by XQuery features. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class EditorArea extends Editor { /** File label. */ final BaseXLabel label; /** File in tab. */ IO file; /** Flag for modified content. */ boolean modified; /** Last input. */ byte[] last; /** This flag indicates if the input is a command script. */ boolean script; /** View reference. */ private final EditorView view; /** Timestamp. */ private long tstamp; /** * Constructor. * @param v view reference * @param f file reference */ EditorArea(final EditorView v, final IOFile f) { super(true, v.gui); view = v; file = f; label = new BaseXLabel(f.name()); setSyntax(f, false); addFocusListener(new FocusAdapter() { @Override public void focusGained(final FocusEvent e) { // refresh query path and work directory final String path = file.path(); gui.context.prop.set(Prop.QUERYPATH, path); gui.gprop.set(GUIProp.WORKPATH, file.dirPath()); // reload file if it has been changed SwingUtilities.invokeLater(new Runnable() { @Override public void run() { if(reopen(false)) return; // skip parsing if editor contains file marked as erroneous if(view.errFile == null || file.eq(view.errFile)) release(Action.PARSE); } }); } }); } /** * Returns {@code true} if the file was opened from disk, or was saved to disk. * @return result of check */ boolean opened() { return tstamp != 0; } /** * Initializes the text. * @param t text to be set */ public void initText(final byte[] t) { last = t; super.setText(t); hist = new History(text.text()); } @Override public void setText(final byte[] t) { last = getText(); super.setText(t); } @Override public void mouseReleased(final MouseEvent e) { super.mouseReleased(e); view.posCode.invokeLater(); } @Override public void keyPressed(final KeyEvent e) { final byte[] t = text.text(); super.keyPressed(e); if(FINDERROR.is(e)) view.jumpToError(); if(t != text.text()) resetError(); view.posCode.invokeLater(); } @Override public void keyTyped(final KeyEvent e) { final byte[] t = text.text(); super.keyTyped(e); if(t != text.text()) resetError(); } @Override public void keyReleased(final KeyEvent e) { super.keyReleased(e); if(!e.isActionKey() && !modifier(e) && !FINDERROR.is(e)) { release(EXEC.is(e) ? Action.EXECUTE : Action.CHECK); } } @Override protected void release(final Action action) { view.refreshControls(false); final byte[] in = getText(); final boolean eq = eq(in, last); if(eq && action == Action.CHECK) return; last = in; final String path = file.path(); final boolean xquery = file.hasSuffix(IO.XQSUFFIXES) || !path.contains("."); script = !xquery && file.hasSuffix(IO.BXSSUFFIX); String input = string(in); if(action == Action.EXECUTE && script) { // execute query if forced, or if realtime execution is activated gui.execute(true, new Execute(input)); } else if(xquery || action == Action.EXECUTE) { // check if input is/might be an xquery main module if(input.isEmpty()) input = "()"; final boolean lib = QueryProcessor.isLibrary(string(in)); if(!lib && (action == Action.EXECUTE || gui.gprop.is(GUIProp.EXECRT))) { // execute query if forced, or if realtime execution is activated gui.execute(true, new XQuery(input)); } else { // parse query gui.context.prop.set(Prop.QUERYPATH, path); final QueryContext qc = new QueryContext(gui.context); try { if(lib) qc.parseLibrary(input, null); else qc.parseMain(input, null); view.info(OK, true, false); } catch(final QueryException ex) { view.info(Util.message(ex), false, false); } finally { qc.close(); } } } else if(script || file.hasSuffix(IO.XMLSUFFIXES) || file.hasSuffix(IO.XSLSUFFIXES) || file.hasSuffix(IO.HTMLSUFFIXES)) { try { if(!script || input.trim().startsWith("<")) new EmptyBuilder(new IOContent(in), gui.context).build(); if(script) new CommandParser(input, gui.context).parse(); view.info(OK, true, false); } catch(final Exception ex) { view.info(Util.message(ex), false, false); } } else if(action != Action.CHECK) { view.info(OK, true, false); } } /** * Reverts the contents of the currently opened editor. * @param enforce enforce reload * @return {@code true} if file was opened */ public boolean reopen(final boolean enforce) { if(opened()) { final long ts = file.timeStamp(); if((tstamp != ts || enforce) && (!modified || BaseXDialog.confirm(gui, Util.info(REOPEN_FILE_X, file.name())))) { try { setText(file.read()); file(file); release(Action.PARSE); return true; } catch(final IOException ex) { BaseXDialog.error(gui, FILE_NOT_OPENED); } } tstamp = ts; } return false; } /** * Updates the file reference, timestamp and history. * @param f file */ void file(final IO f) { file = f; tstamp = f.timeStamp(); setSyntax(file, true); hist.save(); view.refreshHistory(file); view.refreshControls(true); } /** * Highlights the error. * @param pos error position */ void jumpError(final int pos) { requestFocusInWindow(); setCaret(pos); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/editor/EditorView.java000066400000000000000000000552071222453003200271600ustar00rootroot00000000000000package org.basex.gui.view.editor; import static org.basex.core.Text.*; import static org.basex.gui.GUIConstants.*; import static org.basex.util.Token.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*; import java.util.regex.*; import javax.swing.*; import javax.swing.event.*; import org.basex.core.*; import org.basex.data.*; import org.basex.gui.*; import org.basex.gui.GUIConstants.Fill; import org.basex.gui.GUIConstants.Msg; import org.basex.gui.dialog.*; import org.basex.gui.editor.Editor.Action; import org.basex.gui.editor.*; import org.basex.gui.layout.*; import org.basex.gui.layout.BaseXFileChooser.Mode; import org.basex.gui.layout.BaseXLayout.DropHandler; import org.basex.gui.view.*; import org.basex.io.*; import org.basex.util.*; import org.basex.util.list.*; /** * This view allows the input and evaluation of queries and documents. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class EditorView extends View { /** Number of files in the history. */ private static final int HISTORY = 18; /** Number of files in the compact history. */ private static final int HISTCOMP = 7; /** XQuery error pattern. */ private static final Pattern XQERROR = Pattern.compile( "(.*?), ([0-9]+)/([0-9]+)" + COL); /** XML error pattern. */ private static final Pattern XMLERROR = Pattern.compile( LINE_X.replaceAll("%", "(.*?)") + COL + ".*"); /** Error information pattern. */ private static final Pattern ERRORINFO = Pattern.compile( "^.*\r?\n\\[.*?\\] |" + LINE_X.replaceAll("%", "\\d+") + COLS + "|\r?\n.*", Pattern.DOTALL); /** Error tooltip pattern. */ private static final Pattern ERRORTT = Pattern.compile( "^.*\r?\n" + STOPPED_AT + "|\r?\n" + STACK_TRACE_C + ".*", Pattern.DOTALL); /** Search bar. */ final SearchBar search; /** History Button. */ final BaseXButton hist; /** Execute Button. */ final BaseXButton stop; /** Info label. */ final BaseXLabel info; /** Position label. */ final BaseXLabel pos; /** Query area. */ final BaseXTabs tabs; /** Execute button. */ final BaseXButton go; /** Thread counter. */ int threadID; /** File in which the most recent error occurred. */ IO errFile; /** Last error message. */ private String errMsg; /** Most recent error position; used for clicking on error message. */ private int errPos; /** Header string. */ private final BaseXLabel label; /** Filter button. */ private final BaseXButton filter; /** * Default constructor. * @param man view manager */ public EditorView(final ViewNotifier man) { super(EDITORVIEW, man); border(5).layout(new BorderLayout()); label = new BaseXLabel(EDITOR, true, false); label.setForeground(GUIConstants.GRAY); final BaseXButton openB = BaseXButton.command(GUICommands.C_EDITOPEN, gui); final BaseXButton saveB = new BaseXButton(gui, "save", H_SAVE); hist = new BaseXButton(gui, "hist", H_RECENTLY_OPEN); final BaseXButton srch = new BaseXButton(gui, "search", BaseXLayout.addShortcut(H_REPLACE, BaseXKeys.FIND.toString())); stop = new BaseXButton(gui, "stop", H_STOP_PROCESS); stop.addKeyListener(this); stop.setEnabled(false); go = new BaseXButton(gui, "go", BaseXLayout.addShortcut(H_EXECUTE_QUERY, BaseXKeys.EXEC.toString())); go.addKeyListener(this); filter = BaseXButton.command(GUICommands.C_FILTER, gui); filter.addKeyListener(this); filter.setEnabled(false); final BaseXBack buttons = new BaseXBack(Fill.NONE); buttons.layout(new TableLayout(1, 8, 1, 0)).border(0, 0, 8, 0); buttons.add(openB); buttons.add(saveB); buttons.add(hist); buttons.add(srch); buttons.add(Box.createHorizontalStrut(6)); buttons.add(stop); buttons.add(go); buttons.add(filter); final BaseXBack b = new BaseXBack(Fill.NONE).layout(new BorderLayout()); b.add(buttons, BorderLayout.WEST); b.add(label, BorderLayout.EAST); add(b, BorderLayout.NORTH); tabs = new BaseXTabs(gui); tabs.setFocusable(Prop.MAC); final SearchEditor se = new SearchEditor(gui, tabs, null).button(srch); search = se.bar(); addCreateTab(); add(se, BorderLayout.CENTER); // status and query pane search.editor(addTab(), false); info = new BaseXLabel().setText(OK, Msg.SUCCESS); pos = new BaseXLabel(" "); posCode.invokeLater(); final BaseXBack south = new BaseXBack(Fill.NONE).border(10, 0, 2, 0); south.layout(new BorderLayout(4, 0)); south.add(info, BorderLayout.CENTER); south.add(pos, BorderLayout.EAST); add(south, BorderLayout.SOUTH); refreshLayout(); // add listeners saveB.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final JPopupMenu pop = new JPopupMenu(); final StringBuilder mnem = new StringBuilder(); final JMenuItem sa = GUIMenu.newItem(GUICommands.C_EDITSAVE, gui, mnem); final JMenuItem sas = GUIMenu.newItem(GUICommands.C_EDITSAVEAS, gui, mnem); GUICommands.C_EDITSAVE.refresh(gui, sa); GUICommands.C_EDITSAVEAS.refresh(gui, sas); pop.add(sa); pop.add(sas); pop.show(saveB, 0, saveB.getHeight()); } }); hist.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final JPopupMenu pm = new JPopupMenu(); ActionListener al = new ActionListener() { @Override public void actionPerformed(final ActionEvent ac) { // rewrite and open chosen file final String s = ac.getActionCommand().replaceAll("(.*) \\[(.*)\\]", "$2/$1"); open(new IOFile(s), true); } }; // create popup menu with of recently opened files final StringList opened = new StringList(); for(final EditorArea ea : editors()) opened.add(ea.file.path()); final StringList files = new StringList(HISTORY); final StringList all = new StringList(gui.gprop.strings(GUIProp.EDITOR)); final int fl = Math.min(all.size(), e == null ? HISTORY : HISTCOMP); for(int f = 0; f < fl; f++) files.add(all.get(f)); Font f = null; for(final String en : files.sort(Prop.CASE)) { // disable opened files final JMenuItem it = new JMenuItem(en.replaceAll("(.*)[/\\\\](.*)", "$2 [$1]")); if(opened.contains(en)) { if(f == null) f = it.getFont().deriveFont(Font.BOLD); it.setFont(f); } pm.add(it).addActionListener(al); } al = new ActionListener() { @Override public void actionPerformed(final ActionEvent ac) { hist.getActionListeners()[0].actionPerformed(null); } }; if(e != null && pm.getComponentCount() == HISTCOMP) { pm.add(new JMenuItem("...")).addActionListener(al); } pm.show(hist, 0, hist.getHeight()); } }); refreshHistory(null); info.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(final MouseEvent e) { jumpToError(); } }); stop.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { stop.setEnabled(false); go.setEnabled(false); gui.stop(); } }); go.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { getEditor().release(Action.EXECUTE); } }); tabs.addChangeListener(new ChangeListener() { @Override public void stateChanged(final ChangeEvent e) { final EditorArea ea = getEditor(); if(ea == null) return; search.editor(ea, true); gui.refreshControls(); posCode.invokeLater(); } }); BaseXLayout.addDrop(this, new DropHandler() { @Override public void drop(final Object file) { if(file instanceof File) open(new IOFile((File) file), true); } }); } @Override public void refreshInit() { } @Override public void refreshFocus() { } @Override public void refreshMark() { final EditorArea edit = getEditor(); go.setEnabled(edit.script || !gui.gprop.is(GUIProp.EXECRT)); final Nodes mrk = gui.context.marked; filter.setEnabled(!gui.gprop.is(GUIProp.FILTERRT) && mrk != null && mrk.size() != 0); } @Override public void refreshContext(final boolean more, final boolean quick) { } @Override public void refreshLayout() { label.border(-6, 0, 0, 2).setFont(GUIConstants.lfont); for(final EditorArea edit : editors()) edit.setFont(GUIConstants.mfont); search.refreshLayout(); final Font ef = GUIConstants.font.deriveFont(7f + (GUIConstants.fontSize >> 1)); info.setFont(ef); pos.setFont(ef); } @Override public void refreshUpdate() { } @Override public boolean visible() { return gui.gprop.is(GUIProp.SHOWEDITOR); } @Override public void visible(final boolean v) { gui.gprop.set(GUIProp.SHOWEDITOR, v); } @Override protected boolean db() { return false; } /** * Opens a new file. */ public void open() { // open file chooser for XML creation final BaseXFileChooser fc = new BaseXFileChooser(OPEN, gui.gprop.get(GUIProp.WORKPATH), gui); fc.filter(XQUERY_FILES, IO.XQSUFFIXES); fc.filter(BXS_FILES, IO.BXSSUFFIX); fc.textFilters(); final IOFile[] files = fc.multi().selectAll(Mode.FOPEN); for(final IOFile f : files) open(f, true); } /** * Reverts the contents of the currently opened editor. */ public void reopen() { getEditor().reopen(true); } /** * Saves the contents of the currently opened editor. * @return {@code false} if operation was canceled */ public boolean save() { final EditorArea edit = getEditor(); return edit.opened() ? save(edit.file) : saveAs(); } /** * Saves the contents of the currently opened editor under a new name. * @return {@code false} if operation was canceled */ public boolean saveAs() { // open file chooser for XML creation final EditorArea edit = getEditor(); final String path = edit.opened() ? edit.file.path() : gui.gprop.get(GUIProp.WORKPATH); final BaseXFileChooser fc = new BaseXFileChooser(SAVE_AS, path, gui); fc.filter(XQUERY_FILES, IO.XQSUFFIXES); fc.filter(BXS_FILES, IO.BXSSUFFIX); fc.textFilters(); fc.suffix(IO.XQSUFFIX); final IOFile file = fc.select(Mode.FSAVE); return file != null && save(file); } /** * Creates a new file. */ public void newFile() { addTab(); refreshControls(true); } /** * Opens the specified query file. * @param file query file * @param parse parse contents * @return opened editor, or {@code null} if file could not be opened */ public EditorArea open(final IO file, final boolean parse) { if(!visible()) GUICommands.C_SHOWEDITOR.execute(gui); EditorArea edit = find(file, true); if(edit != null) { // display open file tabs.setSelectedComponent(edit); edit.reopen(true); } else { try { final byte[] text = file.read(); // get current editor edit = getEditor(); // create new tab if current text is stored on disk or has been modified if(edit.opened() || edit.modified) edit = addTab(); edit.initText(text); edit.file(file); if(parse) edit.release(Action.PARSE); } catch(final IOException ex) { refreshHistory(null); BaseXDialog.error(gui, FILE_NOT_OPENED); return null; } } return edit; } /** * Refreshes the list of recent query files and updates the query path. * @param file new file */ void refreshHistory(final IO file) { final StringList paths = new StringList(); String path = null; if(file != null) { path = file.path(); gui.gprop.set(GUIProp.WORKPATH, file.dirPath()); paths.add(path); tabs.setToolTipTextAt(tabs.getSelectedIndex(), path); } final String[] old = gui.gprop.strings(GUIProp.EDITOR); for(int p = 0; paths.size() < HISTORY && p < old.length; p++) { final IO fl = IO.get(old[p]); if(fl.exists() && !fl.eq(file)) paths.add(fl.path()); } // store sorted history gui.gprop.set(GUIProp.EDITOR, paths.toArray()); hist.setEnabled(!paths.isEmpty()); } /** * Closes an editor. * @param edit editor to be closed. {@code null} closes the currently * opened editor. * @return {@code true} if editor was closed */ public boolean close(final EditorArea edit) { final EditorArea ea = edit != null ? edit : getEditor(); if(!confirm(ea)) return false; tabs.remove(ea); final int t = tabs.getTabCount(); final int i = tabs.getSelectedIndex(); if(t == 1) { // reopen single tab addTab(); } else if(i + 1 == t) { // if necessary, activate last editor tab tabs.setSelectedIndex(i - 1); } return true; } /** * Jumps to a specific line. */ public void gotoLine() { final EditorArea edit = getEditor(); final int ll = edit.last.length; final int cr = edit.getCaret(); int l = 1; for(int e = 0; e < ll && e < cr; e += cl(edit.last, e)) { if(edit.last[e] == '\n') ++l; } final DialogLine dl = new DialogLine(gui, l); if(!dl.ok()) return; final int el = dl.line(); int p = 0; l = 1; for(int e = 0; e < ll && l < el; e += cl(edit.last, e)) { if(edit.last[e] != '\n') continue; p = e + 1; ++l; } edit.setCaret(p); posCode.invokeLater(); } /** * Starts a thread, which shows a waiting info after a short timeout. */ public void start() { final int thread = threadID; new Thread() { @Override public void run() { Performance.sleep(200); if(thread == threadID) { info.setText(PLEASE_WAIT_D, Msg.SUCCESS).setToolTipText(null); stop.setEnabled(true); } } }.start(); } /** * Evaluates the info message resulting from a parsed or executed query. * @param msg info message * @param ok {@code true} if evaluation was successful * @param refresh refresh buttons */ public void info(final String msg, final boolean ok, final boolean refresh) { // do not refresh view when query is running if(!refresh && stop.isEnabled()) return; ++threadID; errPos = -1; errFile = null; errMsg = null; getEditor().resetError(); if(refresh) { stop.setEnabled(false); refreshMark(); } if(ok) { info.setCursor(GUIConstants.CURSORARROW); info.setText(msg, Msg.SUCCESS).setToolTipText(null); } else { error(msg, false); info.setCursor(GUIConstants.CURSORHAND); info.setText(ERRORINFO.matcher(msg).replaceAll(""), Msg.ERROR); final String tt = ERRORTT.matcher(msg).replaceAll(""). replace("<", "<").replace(">", ">"). replaceAll("\r?\n", "
").replaceAll("(
.*?)
.*", "$1"); info.setToolTipText("" + tt + ""); } } /** * Jumps to the current error. */ void jumpToError() { if(errMsg != null) error(true); } /** * Handles info messages resulting from a query execution. * @param jump jump to error position * @param msg info message */ public void error(final String msg, final boolean jump) { errMsg = msg; for(final String s : msg.split("\r?\n")) { if(XQERROR.matcher(s).matches()) { errMsg = s.replace(STOPPED_AT, ""); break; } } error(jump); } /** * Handles info messages resulting from a query execution. * @param jump jump to error position */ private void error(final boolean jump) { Matcher m = XQERROR.matcher(errMsg); int el, ec = 2; if(m.matches()) { errFile = new IOFile(m.group(1)); el = Token.toInt(m.group(2)); ec = Token.toInt(m.group(3)); } else { m = XMLERROR.matcher(errMsg); if(!m.matches()) return; el = Token.toInt(m.group(1)); errFile = getEditor().file; } EditorArea edit = find(errFile, false); if(jump) { if(edit == null) edit = open(errFile, false); if(edit != null) tabs.setSelectedComponent(edit); } if(edit == null) return; // find approximate error position final int ll = edit.last.length; int ep = ll; for(int p = 0, l = 1, c = 1; p < ll; ++c, p += cl(edit.last, p)) { if(l > el || l == el && c == ec) { ep = p; break; } if(edit.last[p] == '\n') { ++l; c = 0; } } if(ep < ll && Character.isLetterOrDigit(cp(edit.last, ep))) { while(ep > 0 && Character.isLetterOrDigit(cp(edit.last, ep - 1))) ep--; } edit.error(ep); errPos = ep; if(jump) { edit.jumpError(errPos); posCode.invokeLater(); } } /** * Shows a quit dialog for all modified query files. * @return {@code false} if confirmation was canceled */ public boolean confirm() { for(final EditorArea edit : editors()) { tabs.setSelectedComponent(edit); if(!close(edit)) return false; } return true; } /** * Checks if the current text can be saved or reverted. * @return result of check */ public boolean modified() { final EditorArea edit = getEditor(); return edit.modified || !edit.opened(); } /** * Returns the current editor. * @return editor */ public EditorArea getEditor() { final Component c = tabs.getSelectedComponent(); return c instanceof EditorArea ? (EditorArea) c : null; } /** * Refreshes the query modification flag. * @param force action */ void refreshControls(final boolean force) { // update modification flag final EditorArea edit = getEditor(); final boolean oe = edit.modified; edit.modified = edit.hist != null && edit.hist.modified(); if(edit.modified == oe && !force) return; // update tab title String title = edit.file.name(); if(edit.modified) title += '*'; edit.label.setText(title); // update components gui.refreshControls(); posCode.invokeLater(); } /** Code for setting cursor position. */ final GUICode posCode = new GUICode() { @Override public void eval(final Object arg) { final int[] lc = getEditor().pos(); pos.setText(lc[0] + " : " + lc[1]); } }; /** * Finds the editor that contains the specified file. * @param file file to be found * @param opened considers only opened files * @return editor */ EditorArea find(final IO file, final boolean opened) { for(final EditorArea edit : editors()) { if(edit.file.eq(file) && (!opened || edit.opened())) return edit; } return null; } /** * Saves the specified editor contents. * @param file file to write * @return {@code false} if confirmation was canceled */ private boolean save(final IO file) { try { final EditorArea edit = getEditor(); ((IOFile) file).write(edit.getText()); edit.file(file); return true; } catch(final Exception ex) { BaseXDialog.error(gui, FILE_NOT_SAVED); return false; } } /** * Choose a unique tab file. * @return io reference */ private IOFile newTabFile() { // collect numbers of existing files final BoolList bl = new BoolList(); for(final EditorArea edit : editors()) { if(edit.opened()) continue; final String n = edit.file.name().substring(FILE.length()); bl.set(n.isEmpty() ? 1 : Integer.parseInt(n), true); } // find first free file number int c = 0; while(++c < bl.size() && bl.get(c)); // create io reference return new IOFile(gui.gprop.get(GUIProp.WORKPATH), FILE + (c == 1 ? "" : c)); } /** * Adds a new editor tab. * @return editor reference */ EditorArea addTab() { final EditorArea edit = new EditorArea(this, newTabFile()); edit.setFont(GUIConstants.mfont); final BaseXBack tab = new BaseXBack(new BorderLayout(10, 0)).mode(Fill.NONE); tab.add(edit.label, BorderLayout.CENTER); final BaseXButton close = tabButton("e_close"); close.setRolloverIcon(BaseXLayout.icon("e_close2")); close.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { close(edit); } }); tab.add(close, BorderLayout.EAST); tabs.add(edit, tab, tabs.getComponentCount() - 2); return edit; } /** * Adds a tab for creating new tabs. */ private void addCreateTab() { final BaseXButton add = tabButton("e_new"); add.setRolloverIcon(BaseXLayout.icon("e_new2")); add.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { addTab(); refreshControls(true); } }); tabs.add(new BaseXBack(), add, 0); tabs.setEnabledAt(0, false); } /** * Adds a new tab button. * @param icon button icon * @return button */ private BaseXButton tabButton(final String icon) { final BaseXButton b = new BaseXButton(gui, icon, null); b.border(2, 2, 2, 2).setContentAreaFilled(false); b.setFocusable(false); return b; } /** * Shows a quit dialog for the specified editor. * @param edit editor to be saved * @return {@code false} if confirmation was canceled */ private boolean confirm(final EditorArea edit) { if(edit.modified && (edit.opened() || edit.getText().length != 0)) { final Boolean ok = BaseXDialog.yesNoCancel(gui, Util.info(CLOSE_FILE_X, edit.file.name())); if(ok == null || ok && !save()) return false; } return true; } /** * Returns all editors. * @return editors */ EditorArea[] editors() { final ArrayList edits = new ArrayList(); for(final Component c : tabs.getComponents()) { if(c instanceof EditorArea) edits.add((EditorArea) c); } return edits.toArray(new EditorArea[edits.size()]); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/editor/package.html000066400000000000000000000000411222453003200264770ustar00rootroot00000000000000 GUI XQuery View. basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/explore/000077500000000000000000000000001222453003200244135ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/explore/ExploreArea.java000066400000000000000000000222761222453003200274760ustar00rootroot00000000000000package org.basex.gui.view.explore; import static org.basex.core.Text.*; import java.awt.*; import java.awt.event.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.gui.GUIConstants.Fill; import org.basex.gui.*; import org.basex.gui.layout.*; import org.basex.index.name.*; import org.basex.index.stats.*; import org.basex.util.*; import org.basex.util.list.*; /** * This view provides standard GUI components to browse the currently opened database. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Bastian Lemke */ final class ExploreArea extends BaseXPanel implements ActionListener { /** Component width. */ private static final int COMPW = 150; /** Exact search pattern. */ private static final String PATEX = "[% = \"%\"]"; /** Substring search pattern. */ private static final String PATSUB = "[% contains text \"%\"]"; /** Numeric search pattern. */ private static final String PATNUM = "[% >= % and % <= %]"; /** Simple search pattern. */ private static final String PATSIMPLE = "[%]"; /** Main panel. */ private final ExploreView main; /** Main panel. */ private final BaseXBack panel; /** Query field. */ private final BaseXTextField all; /** Last Query. */ private String last = ""; /** * Default constructor. * @param m main panel */ ExploreArea(final ExploreView m) { super(m.gui); main = m; layout(new BorderLayout(0, 5)).mode(Fill.NONE); all = new BaseXTextField(gui); all.addKeyListener(main); all.addKeyListener(new KeyAdapter() { @Override public void keyReleased(final KeyEvent e) { query(false); } }); add(all, BorderLayout.NORTH); panel = new BaseXBack(Fill.NONE).layout(new TableLayout(32, 2, 10, 5)); add(panel, BorderLayout.CENTER); } /** * Initializes the panel. */ void init() { panel.removeAll(); panel.revalidate(); panel.repaint(); } @Override public void paintComponent(final Graphics g) { super.paintComponent(g); final Data data = gui.context.data(); if(!main.visible() || data == null || panel.getComponentCount() != 0) return; addKeys(gui.context.data()); panel.revalidate(); panel.repaint(); } /** * Adds a text field. * @param pos position */ private void addInput(final int pos) { final BaseXTextField txt = new BaseXTextField(gui); BaseXLayout.setWidth(txt, COMPW); BaseXLayout.setHeight(txt, txt.getFont().getSize() + 11); txt.setMargin(new Insets(0, 0, 0, 10)); txt.addKeyListener(new KeyAdapter() { @Override public void keyReleased(final KeyEvent e) { query(false); } }); txt.addKeyListener(main); panel.add(txt, pos); } /** * Adds a category combobox. * @param data data reference */ private void addKeys(final Data data) { final TokenList tl = new TokenList(); final int cs = panel.getComponentCount(); for(int c = 0; c < cs; c += 2) { final BaseXCombo combo = (BaseXCombo) panel.getComponent(c); if(combo.getSelectedIndex() == 0) continue; final String elem = combo.getSelectedItem().toString(); if(!elem.startsWith("@")) tl.add(Token.token(elem)); } final String[] keys = entries(data.paths.desc(tl, true, false)); final BaseXCombo cm = new BaseXCombo(gui, keys); cm.addActionListener(this); cm.addKeyListener(main); if(keys.length == 1) cm.setEnabled(false); panel.add(cm); panel.add(new BaseXLabel("")); } /** * Adds a combobox. * @param values combobox values * @param pos position */ private void addCombo(final String[] values, final int pos) { final BaseXCombo cm = new BaseXCombo(gui, values); BaseXLayout.setWidth(cm, COMPW); cm.addActionListener(this); cm.addKeyListener(main); panel.add(cm, pos); } /** * Adds a combobox. * @param min minimum value * @param max maximum value * @param pos position * @param itr integer flag */ private void addSlider(final double min, final double max, final int pos, final boolean itr) { final BaseXDSlider sl = new BaseXDSlider(min, max, gui, this); BaseXLayout.setWidth(sl, COMPW + BaseXDSlider.LABELW); sl.itr = itr; sl.addKeyListener(main); panel.add(sl, pos); } @Override public void actionPerformed(final ActionEvent e) { if(e != null) { final Object source = e.getSource(); // find modified component int cp = 0; final int cs = panel.getComponentCount(); for(int c = 0; c < cs; ++c) if(panel.getComponent(c) == source) cp = c; if((cp & 1) == 0) { // combo box with tags/attributes final BaseXCombo combo = (BaseXCombo) source; panel.remove(cp + 1); final Data data = gui.context.data(); final boolean selected = combo.getSelectedIndex() != 0; if(selected) { final String item = combo.getSelectedItem().toString(); final boolean att = item.startsWith("@"); final Names names = att ? data.atnindex : data.tagindex; final byte[] key = Token.token(att ? item.substring(1) : item); final Stats stat = names.stat(names.id(key)); switch(stat.type) { case INTEGER: addSlider(stat.min, stat.max, cp + 1, true); break; case DOUBLE: addSlider(stat.min, stat.max, cp + 1, false); break; case CATEGORY: addCombo(entries(new TokenList(stat.cats)), cp + 1); break; case TEXT: addInput(cp + 1); break; case NONE: panel.add(new BaseXLabel(""), cp + 1); break; } } else { panel.add(new BaseXLabel(""), cp + 1); } while(cp + 2 < panel.getComponentCount()) { panel.remove(cp + 2); panel.remove(cp + 2); } if(selected) addKeys(data); panel.revalidate(); panel.repaint(); } } query(false); } /** * Runs a query. * @param force force the execution of a new query */ void query(final boolean force) { final TokenBuilder tb = new TokenBuilder(); final Data data = gui.context.data(); final int cs = panel.getComponentCount(); for(int c = 0; c < cs; c += 2) { final BaseXCombo com = (BaseXCombo) panel.getComponent(c); final int k = com.getSelectedIndex(); if(k <= 0) continue; String key = com.getSelectedItem().toString().replaceAll("^(@?)(.*):", "$1*:"); final boolean attr = key.startsWith("@"); final Component comp = panel.getComponent(c + 1); String pattern = ""; String val1 = null; String val2 = null; if(comp instanceof BaseXTextField) { val1 = ((BaseXTextField) comp).getText(); if(!val1.isEmpty()) { if(val1.startsWith("\"")) { val1 = val1.replaceAll("\"", ""); pattern = PATEX; } else { pattern = attr && data.meta.attrindex || !attr && data.meta.textindex ? PATSUB : PATEX; } } } else if(comp instanceof BaseXCombo) { final BaseXCombo combo = (BaseXCombo) comp; if(combo.getSelectedIndex() != 0) { val1 = combo.getSelectedItem().toString(); pattern = PATEX; } } else if(comp instanceof BaseXDSlider) { final BaseXDSlider slider = (BaseXDSlider) comp; if(slider.min != slider.totMin || slider.max != slider.totMax) { final double m = slider.min; final double n = slider.max; val1 = (long) m == m ? Long.toString((long) m) : Double.toString(m); val2 = (long) n == n ? Long.toString((long) n) : Double.toString(n); pattern = PATNUM; } } if(attr) { key = "descendant-or-self::node()/" + key; if(tb.isEmpty()) tb.add("//*"); if(pattern.isEmpty()) pattern = PATSIMPLE; } else { tb.add("//" + key); key = "text()"; } tb.addExt(pattern, key, val1, key, val2); } String qu = tb.toString(); final boolean root = gui.context.root(); final boolean rt = gui.gprop.is(GUIProp.FILTERRT); if(!qu.isEmpty() && !rt && !root) qu = '.' + qu; String simple = all.getText().trim(); if(!simple.isEmpty()) { simple = Find.find(simple, gui.context, rt); qu = !qu.isEmpty() ? simple + " | " + qu : simple; } if(qu.isEmpty()) qu = rt || root ? "/" : "."; if(!force && last.equals(qu)) return; last = qu; gui.xquery(qu, false); } /** * Returns the combo box selections * and the keys of the specified set. * @param keys keys * @return key array */ private static String[] entries(final TokenList keys) { final StringList sl = new StringList(); sl.add(Util.info(ENTRIES, keys.size())); for(final byte[] k : keys) sl.add(Token.string(k)); return sl.sort(true, true, 1).toArray(); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/explore/ExploreView.java000066400000000000000000000047631222453003200275410ustar00rootroot00000000000000package org.basex.gui.view.explore; import static org.basex.core.Text.*; import static org.basex.gui.GUIConstants.*; import java.awt.*; import java.awt.event.*; import org.basex.data.*; import org.basex.gui.*; import org.basex.gui.GUIConstants.Fill; import org.basex.gui.layout.*; import org.basex.gui.view.*; /** * This view allows the input of database queries. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ExploreView extends View { /** Header string. */ private final BaseXLabel label; /** Current search panel. */ private final ExploreArea search; /** Filter button. */ private final BaseXButton filter; /** * Default constructor. * @param man view manager */ public ExploreView(final ViewNotifier man) { super(EXPLOREVIEW, man); border(5).layout(new BorderLayout(0, 4)); label = new BaseXLabel(EXPLORER, true, false); label.setForeground(GUIConstants.GRAY); filter = BaseXButton.command(GUICommands.C_FILTER, gui); filter.addKeyListener(this); final BaseXBack buttons = new BaseXBack(Fill.NONE); buttons.layout(new TableLayout(1, 1, 1, 0)).border(0, 0, 4, 0); buttons.add(filter); final BaseXBack b = new BaseXBack(Fill.NONE).layout(new BorderLayout()); b.add(buttons, BorderLayout.WEST); b.add(label, BorderLayout.EAST); add(b, BorderLayout.NORTH); search = new ExploreArea(this); add(search, BorderLayout.CENTER); refreshLayout(); } @Override public void refreshInit() { search.init(); } @Override public void refreshFocus() { } @Override public void refreshMark() { final Nodes marked = gui.context.marked; filter.setEnabled(!gui.gprop.is(GUIProp.FILTERRT) && marked != null && marked.size() != 0); } @Override public void refreshContext(final boolean more, final boolean quick) { refreshMark(); } @Override public void refreshUpdate() { } @Override public void refreshLayout() { label.border(-6, 0, 0, 2).setFont(GUIConstants.lfont); refreshMark(); } @Override public boolean visible() { return gui.gprop.is(GUIProp.SHOWEXPLORE); } @Override public void visible(final boolean v) { gui.gprop.set(GUIProp.SHOWEXPLORE, v); } @Override protected boolean db() { return true; } @Override public void keyPressed(final KeyEvent e) { // overwrite default interactions } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/explore/package.html000066400000000000000000000000421222453003200266700ustar00rootroot00000000000000 GUI Explorer View basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/folder/000077500000000000000000000000001222453003200242105ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/folder/FolderIterator.java000066400000000000000000000066241222453003200300100ustar00rootroot00000000000000package org.basex.gui.view.folder; import org.basex.data.*; import org.basex.util.list.*; /** * This is an iterator for the folder nodes. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class FolderIterator { /** Tree visualization reference. */ private final FolderView view; /** Current y position. */ int y; /** Current level. */ int level; /** Current pre value. */ int pre; /** Stack for parent nodes. */ private final IntList parents = new IntList(); /** Panel height. */ private final int height; /** Flag for a found context node. */ private boolean found; /** Current context set position. */ private int cp = -1; /** Current parent node. */ private int par; /** Current iterator mode. */ private int mode; /** Temporary level. */ private int ll; /** * Default constructor. * @param v view reference */ FolderIterator(final FolderView v) { this(v, 0, Integer.MAX_VALUE); } /** * Constructor, specifying the start y position and the maximum height. * @param v view reference * @param yy start y value * @param h panel height */ FolderIterator(final FolderView v, final int yy, final int h) { height = h; view = v; view.focusedPos = -1; y = yy; } /** * Returns the total view height. * @return view height */ int height() { while(more()); return y; } /** * Checks if there are more nodes to iterate. * @return true for more data */ boolean more() { if(view.opened == null) return false; if(!found) { view.focusedPos++; found = pre == view.gui.context.focused; } if(mode == 0) return moreCS(); y += view.lineH; if(y > height) return false; final Data data = view.gui.context.data(); if(data == null || pre >= data.meta.size) return false; final int kind = data.kind(pre); return mode == 2 || (kind == Data.ELEM || kind == Data.DOC) && view.opened[pre] ? moreData(data) : moreCS(); } /** * Checks if there are more context nodes to check. * @return true for more data */ private boolean moreCS() { final Nodes current = view.gui.context.current(); if(current == null || ++cp >= current.size()) return false; par = current.pres[cp]; pre = par; level = 0; ll = 0; mode = 1; return true; } /** * Checks if there are more data nodes to check. * @param data data reference * @return true for more data */ private boolean moreData(final Data data) { level = ll; int kind = data.kind(pre); final boolean[] open = view.opened; if(open == null) return false; pre += open[pre] ? 1 : data.size(pre, kind); while(pre < data.meta.size) { kind = data.kind(pre); final int p = data.parent(pre, kind); // search current root while(p < par && level > 0) par = parents.get(--level); if(p < par) break; if(p == par) { // store child as new root kind = data.kind(par); if((kind == Data.ELEM || kind == Data.DOC) && open[pre]) { parents.set(level++, par); par = pre; ll = level; } else { ll = level++; } mode = 2; return true; } pre += 1; } return moreCS(); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/folder/FolderView.java000066400000000000000000000312031222453003200271200ustar00rootroot00000000000000package org.basex.gui.view.folder; import static org.basex.gui.GUIConstants.*; import static org.basex.gui.layout.BaseXKeys.*; import java.awt.*; import java.awt.event.*; import java.awt.image.*; import java.util.*; import javax.swing.*; import org.basex.data.*; import org.basex.gui.*; import org.basex.gui.layout.*; import org.basex.gui.view.*; /** * This view offers a folder visualization of the database contents. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FolderView extends View { /** Horizontal offset. */ private static final int OFFX = 8; /** References closed nodes. */ boolean[] opened; /** Line Height. */ int lineH; /** Focused folder position. */ int focusedPos; /** Closed marker. */ private BufferedImage closedMarker; /** Opened marker. */ private BufferedImage openedMarker; /** Scroll Bar. */ private final BaseXBar scroll; /** Vertical mouse position. */ private int totalW; /** Start y value. */ private int startY; /** Total height. */ private int treeH; /** Box Size. */ private int boxW; /** Box Margin. */ private int boxMargin; /** * Default constructor. * @param man view manager */ public FolderView(final ViewNotifier man) { super(FOLDERVIEW, man); createBoxes(); layout(new BorderLayout()); scroll = new BaseXBar(this); add(scroll, BorderLayout.EAST); new BaseXPopup(this, POPUP); } @Override public void refreshInit() { scroll.pos(0); if(gui.context.data() == null) { opened = null; } else if(visible()) { refreshOpenedNodes(); refreshHeight(); repaint(); } } /** * Refreshes opened nodes. */ private void refreshOpenedNodes() { final Data data = gui.context.data(); opened = new boolean[data.meta.size]; final int is = data.meta.size; for(int pre = 0; pre < is; ++pre) { opened[pre] = data.parent(pre, data.kind(pre)) <= 0; } } @Override public void refreshFocus() { repaint(); } @Override public void refreshMark() { final int pre = gui.context.focused; if(pre == -1) return; // jump to the currently marked node final Data data = gui.context.data(); final int par = data.parent(pre, data.kind(pre)); // open node if it's not visible jumpTo(pre, par != -1 && !opened[par]); repaint(); } @Override public void refreshContext(final boolean more, final boolean quick) { startY = 0; scroll.pos(0); final Nodes curr = gui.context.current(); if(more && curr.size() != 0) jumpTo(curr.pres[0], true); refreshHeight(); repaint(); } @Override public void refreshLayout() { createBoxes(); if(opened == null) return; refreshOpenedNodes(); refreshHeight(); repaint(); } @Override public void refreshUpdate() { if(opened == null) return; final Data data = gui.context.data(); if(opened.length < data.meta.size) opened = Arrays.copyOf(opened, data.meta.size); startY = 0; scroll.pos(0); final Nodes marked = gui.context.marked; if(marked.size() != 0) jumpTo(marked.pres[0], true); refreshHeight(); repaint(); } @Override public boolean visible() { return gui.gprop.is(GUIProp.SHOWFOLDER); } @Override public void visible(final boolean v) { gui.gprop.set(GUIProp.SHOWFOLDER, v); } @Override protected boolean db() { return true; } /** * Refreshes tree height. */ private void refreshHeight() { if(opened == null) return; treeH = new FolderIterator(this).height(); scroll.height(treeH + 5); } @Override public void paintComponent(final Graphics g) { if(opened == null) { refreshInit(); return; } super.paintComponent(g); if(opened == null) return; gui.painting = true; startY = -scroll.pos(); totalW = getWidth() - (treeH > getHeight() ? scroll.getWidth() : 0); final FolderIterator it = new FolderIterator(this, startY + 5, getHeight()); final Data data = gui.context.data(); while(it.more()) { final int kind = data.kind(it.pre); final boolean elem = kind == Data.ELEM || kind == Data.DOC; final int x = OFFX + it.level * (lineH >> 1) + (elem ? lineH : boxW); drawString(g, it.pre, x, it.y + boxW); } gui.painting = false; } /** * Draws a string and checks mouse position. * @param g graphics reference * @param pre pre value * @param x horizontal coordinate * @param y vertical coordinate */ private void drawString(final Graphics g, final int pre, final int x, final int y) { final Data data = gui.context.data(); final Nodes marked = gui.context.marked; final int kind = data.kind(pre); final boolean elem = kind == Data.ELEM || kind == Data.DOC; Color col = Color.black; Font fnt = font; if(marked.find(pre) >= 0) { // mark node col = colormark3; fnt = bfont; } if(y < -lineH) return; g.setColor(color1); g.drawLine(2, y + boxMargin - 1, totalW - 5, y + boxMargin - 1); final byte[] name = ViewData.content(data, pre, false); int p = gui.context.focused; while(p > pre) p = ViewData.parent(data, p); if(pre == p) { g.setColor(color2); g.fillRect(0, y - boxW - boxMargin, totalW, lineH + 1); } final int fsz = fontSize; if(elem) { final int yy = y - boxW - (fsz > 20 ? 6 : 3); final Image marker = opened[pre] ? openedMarker : closedMarker; g.drawImage(marker, x - lineH, yy, this); } g.setFont(fnt); g.setColor(col); final int tw = totalW + 6; BaseXLayout.chopString(g, name, x, y - fsz, tw - x - 10, fsz); if(gui.context.focused == pre) { g.setColor(color4); g.drawRect(1, y - boxW - boxMargin, totalW - 3, lineH + 1); g.drawRect(2, y - boxW - boxMargin + 1, totalW - 5, lineH - 1); } } /** * Focuses the current pre value. * @param x x mouse position * @param y y mouse position * @return currently focused id */ private boolean focus(final int x, final int y) { if(opened == null) return false; final int fsz = fontSize; final FolderIterator it = new FolderIterator(this, startY + 3, getHeight()); final Data data = gui.context.data(); while(it.more()) { if(y > it.y && y <= it.y + lineH) { Cursor c = CURSORARROW; final int kind = data.kind(it.pre); if(kind == Data.ELEM || kind == Data.DOC) { // set cursor when moving over tree boxes final int xx = OFFX + it.level * (lineH >> 1) + lineH - 6; if(x > xx - fsz && x < xx) c = CURSORHAND; } gui.cursor(c); gui.notify.focus(it.pre, this); repaint(); return true; } } return false; } /** * Jumps to the specified pre value. * @param pre pre value to be found * @param open opened folder */ private void jumpTo(final int pre, final boolean open) { if(getWidth() == 0 || !visible()) return; if(open) { int p = pre; while(p > 0) { opened[p] = true; p = ViewData.parent(gui.context.data(), p); } refreshHeight(); } // find specified pre value final FolderIterator it = new FolderIterator(this); while(it.more() && pre != it.pre); // set new vertical position final int y = -it.y; final int h = getHeight(); if(y > startY || y + h < startY + lineH) { startY = Math.min(0, Math.max(-treeH + h - 5, y + lineH)); scroll.pos(-startY); } } /** * Creates click boxes. */ private void createBoxes() { final int s = fontSize; boxMargin = s >> 2; lineH = s + boxMargin; boxW = s - boxMargin; final int sp = Math.max(1, s >> 4); /* Empty Box. */ final BufferedImage emptyBox = new BufferedImage(boxW + 1, boxW + 1, BufferedImage.TYPE_INT_ARGB); Graphics2D g = emptyBox.createGraphics(); smooth(g); g.setColor(color4); g.fillOval((boxW >> 2) - 1, (boxW >> 2) + 1, boxW >> 1, boxW >> 1); g.setColor(color3); g.fillOval((boxW >> 2) - 2, boxW >> 2, boxW >> 1, boxW >> 1); openedMarker = new BufferedImage(boxW + 1, boxW + 1, BufferedImage.TYPE_INT_ARGB); g = openedMarker.createGraphics(); smooth(g); Polygon p = new Polygon(new int[] { 0, boxW, boxW >> 1 }, new int[] { boxW - sp >> 1, boxW - sp >> 1, boxW }, 3); p.translate(0, -1); g.setColor(color4); g.fillPolygon(p); p.translate(-1, -1); g.setColor(color3); g.fillPolygon(p); closedMarker = new BufferedImage(boxW + 1, boxW + 1, BufferedImage.TYPE_INT_ARGB); g = closedMarker.createGraphics(); smooth(g); p = new Polygon(new int[] { boxW - sp >> 1, boxW, boxW - sp >> 1 }, new int[] { 0, boxW >> 1, boxW }, 3); p.translate(-1, 1); g.setColor(color4); g.fillPolygon(p); p.translate(-1, -1); g.setColor(color3); g.fillPolygon(p); } @Override public void mouseMoved(final MouseEvent e) { if(gui.updating) return; super.mouseMoved(e); // set new focus focus(e.getX(), e.getY()); } @Override public void mousePressed(final MouseEvent e) { if(gui.updating || opened == null) return; super.mousePressed(e); if(!focus(e.getX(), e.getY())) return; // add or remove marked node final Nodes marked = gui.context.marked; if(e.getClickCount() == 2) { gui.notify.context(marked, false, null); } else if(e.isShiftDown()) { gui.notify.mark(1, null); } else if(sc(e) && SwingUtilities.isLeftMouseButton(e)) { gui.notify.mark(2, null); } else if(getCursor() != CURSORHAND) { if(!marked.contains(gui.context.focused)) gui.notify.mark(0, null); } else { // open/close entry opened[gui.context.focused] ^= true; refreshHeight(); repaint(); } } @Override public void mouseDragged(final MouseEvent e) { final boolean left = SwingUtilities.isLeftMouseButton(e); if(!left || gui.updating || opened == null) return; super.mouseDragged(e); // marks currently focused node if(focus(e.getX(), e.getY())) gui.notify.mark(1, null); } @Override public void mouseWheelMoved(final MouseWheelEvent e) { if(gui.updating) return; scroll.pos(scroll.pos() + e.getUnitsToScroll() * 20); repaint(); } @Override public void keyPressed(final KeyEvent e) { if(gui.updating || opened == null) return; super.keyPressed(e); int focus = focusedPos == -1 ? 0 : focusedPos; if(gui.context.focused == -1) gui.context.focused = 0; final int focusPre = gui.context.focused; final Data data = gui.context.data(); final int kind = data.kind(focusPre); final boolean right = NEXT.is(e); boolean down = NEXTLINE.is(e); boolean up = PREVLINE.is(e); if(right || PREV.is(e)) { // open/close subtree if(e.isShiftDown()) { opened[focusPre] = right; final int s = data.meta.size; for(int pre = focusPre + 1; pre != s && data.parent(pre, data.kind(pre)) >= focusPre; pre++) { opened[pre] = right; } refreshHeight(); repaint(); return; } if(right ^ opened[focusPre] && (!ViewData.leaf(gui.gprop, data, focusPre) || data.attSize(focusPre, kind) > 1)) { opened[focusPre] = right; refreshHeight(); repaint(); } else if(right) { down = true; } else { up = true; } } if(down) { focus = Math.min(data.meta.size - 1, focus + 1); } else if(up) { focus = Math.max(0, focus - 1); } else if(NEXTPAGE.is(e)) { focus = Math.min(data.meta.size - 1, focus + getHeight() / lineH); } else if(PREVPAGE.is(e)) { focus = Math.max(0, focus - getHeight() / lineH); } else if(TEXTSTART.is(e)) { focus = 0; } else if(TEXTEND.is(e)) { focus = data.meta.size - 1; } if(focus == focusedPos) return; // calculate new tree position gui.context.focused = -1; final Nodes curr = gui.context.current(); int pre = curr.pres[0]; final FolderIterator it = new FolderIterator(this); while(it.more() && focus-- != 0) pre = it.pre; if(pre == curr.pres[0] && down) ++pre; gui.notify.focus(pre, this); jumpTo(pre, false); repaint(); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/folder/package.html000066400000000000000000000000411222453003200264640ustar00rootroot00000000000000 GUI Folder View. basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/info/000077500000000000000000000000001222453003200236705ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/info/InfoView.java000066400000000000000000000251141222453003200262640ustar00rootroot00000000000000package org.basex.gui.view.info; import static org.basex.core.Text.*; import static org.basex.gui.GUIConstants.*; import java.awt.*; import java.awt.event.*; import java.util.regex.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.gui.*; import org.basex.gui.GUIConstants.Fill; import org.basex.gui.editor.*; import org.basex.gui.layout.*; import org.basex.gui.view.*; import org.basex.util.*; import org.basex.util.list.*; /** * This view displays query information. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class InfoView extends View implements LinkListener { /** Searchable editor. */ final SearchEditor editor; /** Current text. */ private final TokenBuilder text = new TokenBuilder(); /** Header label. */ private final BaseXLabel label; /** Timer label. */ private final BaseXLabel timer; /** Text Area. */ private final Editor area; /** Buttons. */ final BaseXBack buttons; /** Query statistics. */ private IntList stat = new IntList(4); /** Query statistics strings. */ private StringList strings = new StringList(4); /** Indicates if text has changed. */ private boolean changed; /** Clear text before adding new text. */ private boolean clear; /** Focused bar. */ private int focus = -1; /** Panel Width. */ private int w; /** Panel Height. */ private int h; /** Bar widths. */ private int bw; /** Bar size. */ private int bs; /** * Default constructor. * @param man view manager */ public InfoView(final ViewNotifier man) { super(INFOVIEW, man); border(5).layout(new BorderLayout(0, 5)); label = new BaseXLabel(QUERY_INFO); label.setForeground(GUIConstants.GRAY); timer = new BaseXLabel(" ", true, false); timer.setForeground(GUIConstants.DGRAY); final BaseXButton srch = new BaseXButton(gui, "search", BaseXLayout.addShortcut(SEARCH, BaseXKeys.FIND.toString())); buttons = new BaseXBack(Fill.NONE); buttons.layout(new TableLayout(1, 3, 8, 0)).border(0, 0, 4, 0); buttons.add(srch); buttons.add(timer); final BaseXBack b = new BaseXBack(Fill.NONE).layout(new BorderLayout()); b.add(buttons, BorderLayout.WEST); b.add(label, BorderLayout.EAST); add(b, BorderLayout.NORTH); final BaseXBack center = new BaseXBack(Fill.NONE).layout(new BorderLayout()); area = new Editor(false, gui); area.setLinkListener(this); editor = new SearchEditor(gui, area).button(srch); add(editor, BorderLayout.CENTER); center.add(area, BorderLayout.CENTER); center.add(editor, BorderLayout.SOUTH); add(center, BorderLayout.CENTER); refreshLayout(); } @Override public void refreshInit() { } @Override public void refreshFocus() { } @Override public void refreshMark() { } @Override public void refreshContext(final boolean more, final boolean quick) { } @Override public void refreshUpdate() { } @Override public void refreshLayout() { label.border(-6, 0, 0, 2).setFont(GUIConstants.lfont); timer.setFont(font); area.setFont(font); editor.bar().refreshLayout(); } @Override public boolean visible() { return gui.gprop.is(GUIProp.SHOWINFO); } @Override public void visible(final boolean v) { gui.gprop.set(GUIProp.SHOWINFO, v); } @Override protected boolean db() { return false; } /** * Displays the specified info string. * @param info string to be displayed * @param cmd command that created the output (may be {@code null}) * @param ok indicates if evaluation was successful * @param reset clear text area when method is called next time */ public void setInfo(final String info, final Command cmd, final boolean ok, final boolean reset) { setInfo(info, cmd, null, ok, reset); } /** * Displays the specified info string. * @param info string to be displayed * @param cmd command that created the output (may be {@code null}) * @param time time required for running the command * @param ok indicates if evaluation was successful * @param reset clear text area when method is called next time */ public void setInfo(final String info, final Command cmd, final String time, final boolean ok, final boolean reset) { final StringList eval = new StringList(1); final StringList comp = new StringList(1); final StringList plan = new StringList(1); final StringList result = new StringList(1); final StringList stack = new StringList(1); final StringList err = new StringList(1); final StringList origqu = new StringList(1); final StringList optqu = new StringList(1); final StringList command = new StringList(1); final StringList timings = new StringList(5); final IntList times = new IntList(5); final int runs = Math.max(1, gui.context.prop.num(Prop.RUNS)); final String[] split = info.split(NL); for(int i = 0; i < split.length; ++i) { final String line = split[i]; final int s = line.indexOf(':'); if(line.startsWith(PARSING_CC) || line.startsWith(COMPILING_CC) || line.startsWith(EVALUATING_CC) || line.startsWith(PRINTING_CC) || line.startsWith(TOTAL_TIME_CC)) { final int t = line.indexOf(" ms"); final int tm = (int) (Double.parseDouble(line.substring(s + 1, t)) * 100); times.add(tm); final String key = line.substring(0, s).trim(); final String val = Performance.getTime(tm * 10000L * runs, runs); timings.add(LI + key + COLS + val); } else if(line.startsWith(QUERY_PLAN)) { while(i + 1 < split.length && !split[++i].isEmpty()) plan.add(split[i]); } else if(line.startsWith(COMPILING)) { while(++i < split.length && !split[i].isEmpty()) comp.add(split[i]); } else if(line.startsWith(QUERY)) { while(i + 1 < split.length && !split[++i].isEmpty()) origqu.add(split[i]); } else if(line.startsWith(OPTIMIZED_QUERY)) { while(i + 1 < split.length && !split[++i].isEmpty()) optqu.add(split[i]); } else if(line.startsWith(EVALUATING)) { while(i + 1 < split.length && split[++i].startsWith(LI)) eval.add(split[i]); } else if(line.startsWith(HITS_X_CC) || line.startsWith(UPDATED_CC) || line.startsWith(PRINTED_CC) || line.startsWith(READ_LOCKING_CC) || line.startsWith(WRITE_LOCKING_CC)) { result.add(LI + line); } else if(line.startsWith(ERROR_C)) { while(i + 1 < split.length && !split[++i].isEmpty()) { final Pattern p = Pattern.compile(STOPPED_AT + "(.*)" + COL); final Matcher m = p.matcher(split[i]); if(m.find()) { final TokenBuilder tb = new TokenBuilder(); tb.add(STOPPED_AT).uline().add(m.group(1)).uline().add(COL); split[i] = tb.toString(); } err.add(split[i]); } } else if(line.startsWith(STACK_TRACE_C)) { while(i + 1 < split.length && !split[++i].isEmpty()) { final TokenBuilder tb = new TokenBuilder(); final String sp = split[i].replaceAll("<.*", ""); final boolean last = !sp.equals(split[i]); if(sp.startsWith(LI)) { tb.add(LI).uline().add(sp.substring(2)).uline(); } else { tb.add(sp); } stack.add(tb.toString()); if(last) break; } } else if(!ok && !line.isEmpty()) { err.add(line); } } stat = times; strings = timings; if(clear || !times.isEmpty() || !ok) text.reset(); String inf = null; if(!(cmd instanceof AQuery)) { if(cmd != null) command.add(cmd.toString()); if(ok && !info.isEmpty()) { if(reset) result.add(info.trim()); else if(cmd == null) inf = info.trim(); } } add(COMMAND + COL, command); add(ERROR_C, err); add(STACK_TRACE_C, stack); add(EVALUATING + COLS, eval); add(COMPILING + COLS, comp); add(QUERY + COLS, origqu); add(OPTIMIZED_QUERY + COLS, optqu); add(RESULT + COLS, result); add(TIMING + COLS, timings); add(QUERY_PLAN + COLS, plan); if(inf != null) text.add(inf).nline(); changed = true; clear = reset; // show total time required for running the process String total = time; if(!times.isEmpty()) { total = Performance.getTime(times.get(times.size() - 1) * 10000L * runs, runs); } if(total != null) timer.setText(TOTAL_TIME_CC + total); repaint(); } /** * Adds the specified strings. * @param head string header * @param list list reference */ private void add(final String head, final StringList list) { if(list.isEmpty()) return; text.bold().add(head).norm().nline(); for(final String s : list) text.add(s).nline(); text.hline(); } @Override public void linkClicked(final String link) { gui.editor.error(link + COL, true); } @Override public void mouseMoved(final MouseEvent e) { final int l = stat.size(); if(l == 0) return; focus = -1; if(e.getY() < h) { for(int i = 0; i < l; ++i) { final int bx = w - bw + bs * i; if(e.getX() >= bx && e.getX() < bx + bs) focus = i; } } final int f = focus == -1 ? l - 1 : focus; timer.setText(strings.get(f).replace(LI, "")); repaint(); } @Override public void paintComponent(final Graphics g) { if(changed) { area.setText(text.finish()); changed = false; } super.paintComponent(g); final int l = stat.size(); if(l == 0) return; final int fs = fontSize; h = label.getHeight() + 4; w = (int) (getWidth() * .98 - fs / 2 - label.getWidth()); bw = fs * 2 + w / 10; bs = bw / (l - 1); // find maximum value int m = 0; for(int i = 0; i < l - 1; ++i) m = Math.max(m, stat.get(i)); // draw focused bar final int by = 8; final int bh = h - by; for(int i = 0; i < l - 1; ++i) { if(i != focus) continue; final int bx = w - bw + bs * i; g.setColor(color3); g.fillRect(bx, by, bs + 1, bh); } // draw all bars for(int i = 0; i < l - 1; ++i) { final int bx = w - bw + bs * i; g.setColor(color((i == focus ? 3 : 2) + i * 2)); final int p = Math.max(1, stat.get(i) * bh / m); g.fillRect(bx, by + bh - p, bs, p); g.setColor(color(8)); g.drawRect(bx, by + bh - p, bs, p - 1); } } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/info/package.html000066400000000000000000000000361222453003200261500ustar00rootroot00000000000000 GUI Info View basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/map/000077500000000000000000000000001222453003200235125ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/map/BinaryAlgo.java000066400000000000000000000033721222453003200264110ustar00rootroot00000000000000package org.basex.gui.view.map; /** * Binary layout algorithm. * * @author BaseX Team 2005-12, BSD License * @author Joerg Hauser */ final class BinaryAlgo extends MapAlgo { @Override MapRects calcMap(final MapRect r, final MapList ml, final int ns, final int ne) { return calcMap(r, ml, ns, ne, 1); } /** * Uses recursive SplitLayout algorithm to divide rectangles on one level. * @param r parent rectangle * @param ml children array * @param ns start array position * @param ne end array position * @param sumweight weight of this recursion level * @return rectangles */ private static MapRects calcMap(final MapRect r, final MapList ml, final int ns, final int ne, final double sumweight) { if(ne - ns == 0) { final MapRects rects = new MapRects(); rects.add(new MapRect(r, ml.get(ns))); return rects; } final MapRects rects = new MapRects(); // setting middle of the list and calc weights double weight = 0; final int ni = ns + (ne - ns) / 2; for(int i = ns; i <= ni; ++i) { weight += ml.weight[i]; } int xx = r.x; int yy = r.y; int ww = !(r.w > r.h) ? r.w : (int) (r.w / sumweight * weight); int hh = r.w > r.h ? r.h : (int) (r.h / sumweight * weight); // paint both rectangles if enough space is left if(ww > 0 && hh > 0 && weight > 0) rects.add(calcMap( new MapRect(xx, yy, ww, hh, 0, r.level), ml, ns, ni, weight)); if(r.w > r.h) { xx += ww; ww = r.w - ww; } else { yy += hh; hh = r.h - hh; } if(ww > 0 && hh > 0 && sumweight - weight > 0 && ni + 1 <= ne) rects.add(calcMap(new MapRect(xx, yy, ww, hh, 0, r.level), ml, ni + 1, ne, sumweight - weight)); return rects; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/map/MapAlgo.java000066400000000000000000000020471222453003200257000ustar00rootroot00000000000000package org.basex.gui.view.map; /** * Interface MapAlgorithms need to implement. * * @author BaseX Team 2005-12, BSD License * @author Joerg Hauser */ abstract class MapAlgo { /** * Calculates the average aspect Ratios of rectangles given in the list. * @param r Array of rectangles * @return average aspect ratio */ static double lineRatio(final MapRects r) { if(r.size == 0) return Double.MAX_VALUE; double ar = 0; int dev = 0; for(final MapRect rect : r) { if(rect.w != 0 && rect.h != 0) { ++dev; if(rect.w > rect.h) { ar += (double) rect.w / rect.h; } else { ar += (double) rect.h / rect.w; } } } return ar / dev; } /** * Splits List nodes into Rectangles matching in given space. * @param r parent rectangle * @param l children array * @param ns start array position * @param ne end array position * @return rectangles */ abstract MapRects calcMap(final MapRect r, final MapList l, final int ns, final int ne); } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/map/MapDefault.java000066400000000000000000000063651222453003200264110ustar00rootroot00000000000000package org.basex.gui.view.map; import java.awt.*; import org.basex.data.*; import org.basex.gui.*; import org.basex.gui.layout.*; import org.basex.gui.view.*; /** * Adds default paint operations to TreeMap. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class MapDefault extends MapPainter { /** * Constructor. * @param m map reference * @param pr gui properties */ MapDefault(final MapView m, final GUIProp pr) { super(m, pr); } @Override void drawRectangles(final Graphics g, final MapRects rects, final float scale) { // some additions to set up borders final MapRect l = view.layout.layout; l.x = (int) scale * l.x; l.y = (int) scale * l.y; l.w = (int) scale * l.w; l.h = (int) scale * l.h; final int ww = view.getWidth(); final int hh = view.getWidth(); final Data data = view.gui.context.data(); final int fsz = GUIConstants.fontSize; final int off = prop.num(GUIProp.MAPOFFSETS); final int rs = rects.size; for(int ri = 0; ri < rs; ++ri) { // get rectangle information final MapRect r = rects.get(ri); final int pre = r.pre; // level 1: next context node, set marker pointer to 0 final int lvl = r.level; final boolean full = r.w == ww && r.h == hh; Color col = color(rects, ri); final boolean mark = col != null; r.pos = view.gui.context.marked.ftpos != null ? view.gui.context.marked.ftpos.get(data, pre) : null; g.setColor(mark ? col : GUIConstants.color(lvl)); if(r.w < l.x + l.w || r.h < l.y + l.h || off < 2 || ViewData.leaf(prop, data, pre)) { g.fillRect(r.x, r.y, r.w, r.h); } else { // painting only border for non-leaf nodes.. g.fillRect(r.x, r.y, l.x, r.h); g.fillRect(r.x, r.y, r.w, l.y); g.fillRect(r.x + r.w - l.w, r.y, l.w, r.h); g.fillRect(r.x, r.y + r.h - l.h, r.w, l.h); } if(!full) { col = mark ? GUIConstants.colormark3 : GUIConstants.color(lvl + 2); g.setColor(col); g.drawRect(r.x, r.y, r.w, r.h); col = mark ? GUIConstants.colormark4 : GUIConstants.color(Math.max(0, lvl - 2)); g.setColor(col); g.drawLine(r.x + r.w, r.y, r.x + r.w, r.y + r.h); g.drawLine(r.x, r.y + r.h, r.x + r.w, r.y + r.h); } // skip drawing of string if there is no space if(r.w <= 3 || r.h < GUIConstants.fontSize) continue; r.x += 3; r.w -= 3; final int kind = data.kind(pre); if(kind == Data.ELEM || kind == Data.DOC) { g.setColor(Color.black); g.setFont(GUIConstants.font); BaseXLayout.chopString(g, ViewData.name(prop, data, pre), r.x, r.y, r.w, fsz); } else { g.setColor(GUIConstants.color(r.level * 2 + 8)); g.setFont(GUIConstants.mfont); final byte[] text = ViewData.content(data, pre, false); r.thumb = MapRenderer.calcHeight(g, r, text, fsz) >= r.h; if(r.thumb) { MapRenderer.drawThumbnails(g, r, text, fsz); } else { MapRenderer.drawText(g, r, text, fsz); } } r.x -= 3; r.w += 3; } } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/map/MapLayout.java000066400000000000000000000100141222453003200262640ustar00rootroot00000000000000package org.basex.gui.view.map; import org.basex.data.*; import org.basex.gui.*; import org.basex.gui.view.*; /** * Defines shared things of TreeMap layout algorithms. * * @author BaseX Team 2005-12, BSD License * @author Joerg Hauser */ final class MapLayout { /** List of rectangles. */ final MapRects rectangles = new MapRects(); /** Font size. */ private final int off; /** Data reference. */ private final Data data; /** Map algorithm to use in this layout. */ private final MapAlgo algo; /** Text lengths. */ private final int[] textLen; /** Widow properties. */ private final GUIProp prop; /** Layout rectangle. */ final MapRect layout; /** * Constructor. * @param d data reference to use in this layout * @param tl text lengths array * @param pr gui properties */ MapLayout(final Data d, final int[] tl, final GUIProp pr) { data = d; textLen = tl; prop = pr; off = GUIConstants.fontSize + 4; switch(prop.num(GUIProp.MAPOFFSETS)) { // no title, small border case 1 : layout = new MapRect(0, 2, 0, 2); break; // title, no border case 2 : layout = new MapRect(0, off, 0, off); break; // title, border case 3 : layout = new MapRect(2, off - 1, 4, off + 1); break; // title, large border case 4 : layout = new MapRect(off >> 2, off, off >> 1, off + (off >> 2)); break; // no title, no border default: layout = new MapRect(0, 0, 0, 0); break; } switch(prop.num(GUIProp.MAPALGO)) { // select method to construct this treemap // may should be placed in makeMap to define different method for // different levels case 1 : algo = new StripAlgo(); break; case 2 : algo = new SquarifiedAlgo(); break; case 3 : algo = new SliceDiceAlgo(); break; case 4 : algo = new BinaryAlgo(); break; default: algo = new SplitAlgo(); break; } } /** * Returns all children of the specified node. * @param par parent node * @return children */ private MapList children(final int par) { final MapList list = new MapList(); final int last = par + ViewData.size(data, par); final boolean atts = prop.is(GUIProp.MAPATTS); int p = par + (atts ? 1 : data.attSize(par, data.kind(par))); while(p < last) { list.add(p); p += ViewData.size(data, p); } return list; } /** * Recursively splits rectangles. * @param r parent rectangle * @param l children array * @param ns start array position * @param ne end array position */ void makeMap(final MapRect r, final MapList l, final int ns, final int ne) { if(ne - ns == 0) { // one rectangle left, add it and go deeper r.pre = l.get(ns); putRect(r); } else { int nn = 0; if(r.level == 0) { final int is = l.size(); for(int i = 0; i < is; ++i) nn += ViewData.size(data, l.get(i)); } else { nn = l.get(ne) - l.get(ns) + ViewData.size(data, l.get(ne)); } l.initWeights(textLen, nn, data, prop.num(GUIProp.MAPWEIGHT)); // call recursion for next deeper levels final MapRects rects = algo.calcMap(r, l, ns, ne); for(final MapRect rect : rects) { if(rect.x + rect.w <= r.x + r.w && rect.y + rect.h <= r.y + r.h) putRect(rect); } } } /** * One rectangle left, add it and continue with its children. * @param r parent rectangle */ private void putRect(final MapRect r) { // position, with and height calculated using sizes of former level final int x = r.x + layout.x; final int y = r.y + layout.y; final int w = r.w - layout.w; final int h = r.h - layout.h; // skip too small rectangles and meta data in file systems if(w < off && h < off || w <= 2 || h <= 2) { rectangles.add(r); return; } rectangles.add(r); final MapList ch = children(r.pre); final int cs = ch.size(); if(cs != 0) { makeMap(new MapRect(x, y, w, h, r.pre, r.level + 1), ch, 0, cs - 1); } } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/map/MapList.java000066400000000000000000000051351222453003200257320ustar00rootroot00000000000000package org.basex.gui.view.map; import org.basex.data.*; import org.basex.gui.view.*; import org.basex.util.*; import org.basex.util.list.*; /** * Stores an integer array of pre values and their corresponding weights. * * @author BaseX Team 2005-12, BSD License * @author Joerg Hauser */ final class MapList extends IntList { /** Weights array. */ double[] weight; /** * Constructor. */ MapList() { } /** * Constructor, assigning the specified array. * @param v initial list values */ MapList(final int[] v) { super(v); } @Override public MapList sort() { sort(weight, false); return this; } /** * Initializes the weights of each list entry, using the text length of * nodes or (if the array reference is null) the size attributes. * @param textLen array holding pre values to text lengths * @param nchildren reference number of nodes * @param data reference * @param w weight */ void initWeights(final int[] textLen, final int nchildren, final Data data, final int w) { weight = new double[size]; // only children if(w == 0) { for(int i = 0; i < size; ++i) { weight[i] = (double) ViewData.size(data, list[i]) / nchildren; } return; } // summarize sizes final double sizeP = w / 100d; long sum = 0; for(int i = 0; i < size; ++i) sum += weight(textLen, data, i); // use #children and size for weight if(sizeP < 1) { for(int i = 0; i < size; ++i) { weight[i] = sizeP * weight(textLen, data, i) / sum + (1 - sizeP) * ViewData.size(data, list[i]) / nchildren; } // only sizes } else { for(int i = 0; i < size; ++i) { weight[i] = weight(textLen, data, i) / sum; } } } /** * Returns the numeric weight for the specified input, or 1 as minimum. * @param textLen array holding pre values to text lengths * @param data data reference * @param i array index * @return calculated weight */ private double weight(final int[] textLen, final Data data, final int i) { final double d; if(textLen != null) { d = textLen[list[i]]; } else { final byte[] val = data.attValue(ViewData.sizeID(data), list[i]); d = val != null ? Token.toLong(val) : 0; } return d > 1 ? d : 1; } @Override public String toString() { final StringBuilder sb = new StringBuilder(Util.name(this) + '['); for(int i = 0; i < size; ++i) { sb.append(i == 0 ? "" : ", ").append(list[i]); if(weight != null) sb.append('/').append(weight[i]); } return sb.append(']').toString(); } }basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/map/MapPainter.java000066400000000000000000000034141222453003200264170ustar00rootroot00000000000000package org.basex.gui.view.map; import java.awt.*; import org.basex.data.*; import org.basex.gui.*; import org.basex.gui.view.*; /** * Provides an interface for data specific TreeMap visualizations. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ abstract class MapPainter { /** Graphics reference. */ final MapView view; /** Window properties. */ final GUIProp prop; /** * Constructor. * @param m map reference * @param pr gui properties */ MapPainter(final MapView m, final GUIProp pr) { view = m; prop = pr; } /** * Returns next color mark. * @param rects rectangle array * @param ri current position * @return next color mark */ final Color color(final MapRects rects, final int ri) { // find marked node final Nodes marked = view.gui.context.marked; final int p = marked == null ? -1 : -marked.find(rects.get(ri).pre) - 1; if(p < 0) return GUIConstants.colormark1; // mark ancestor of invisible node; final int i = rects.find(rects.get(ri)); return p < marked.size() && i + 1 < rects.size && marked.sorted[p] < rects.sorted[i + 1].pre ? GUIConstants.colormark2 : null; } /** * Draws the specified rectangles. * @param g graphics reference * @param r rectangle array * @param scale scale boarders using this factor */ abstract void drawRectangles(final Graphics g, final MapRects r, final float scale); /** * Returns the content for the specified pre value. * @param data data reference * @param mr map rectangle * @return byte[] content */ static final byte[] content(final Data data, final MapRect mr) { return ViewData.content(data, mr.pre, false); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/map/MapRect.java000066400000000000000000000041641222453003200257150ustar00rootroot00000000000000package org.basex.gui.view.map; import org.basex.data.*; import org.basex.gui.view.*; /** * View rectangle. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class MapRect extends ViewRect implements Comparable { /** Thumbnail view. */ boolean thumb; /** Full-text position values. */ FTPos pos; /** Abstraction level for thumbnail. */ byte thumbal; /** Height of a thumbnail unit. */ byte thumbfh; /** Height of an empty line. */ byte thumblh; /** Width of a thumbnail unit. */ double thumbf; /** Width of a space between two thumbnails. */ double thumbsw; /** * Simple rectangle constructor. * @param xx x position * @param yy y position * @param ww width * @param hh height */ MapRect(final int xx, final int yy, final int ww, final int hh) { super(xx, yy, ww, hh); } /** * Default rectangle constructor, specifying additional rectangle * attributes such as id, level and orientation. * @param xx x position * @param yy y position * @param ww width * @param hh height * @param p rectangle pre value * @param l level */ MapRect(final int xx, final int yy, final int ww, final int hh, final int p, final int l) { this(xx, yy, ww, hh); pre = p; level = l; } /** * Constructor taking MapRect for position initialization. * @param r pos and dimension rectangle * @param p rectangle pre value */ MapRect(final ViewRect r, final int p) { this(r.x, r.y, r.w, r.h, p, r.level); } /** * Verifies if the specified rectangle is contained inside the rectangle. * @param r rectangle * @return result of check */ boolean contains(final MapRect r) { return r.x >= x && r.y >= y && r.x + r.w <= x + w && r.y + r.h <= y + h; } @Override public boolean equals(final Object o) { return o instanceof MapRect && ((MapRect) o).pre == pre; } @Override public int compareTo(final MapRect r) { return pre - r.pre; } @Override public int hashCode() { return pre; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/map/MapRects.java000066400000000000000000000047231222453003200261010ustar00rootroot00000000000000package org.basex.gui.view.map; import java.util.*; import org.basex.util.*; /** * This class organizes all map rectangles in a simple list. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class MapRects implements Iterable { /** Value array. */ MapRect[] list = new MapRect[8]; /** Sorted values. */ MapRect[] sorted; /** Number of entries. */ int size; /** * Default constructor. */ MapRects() { this(8); } /** * Constructor, specifying an initial list size. * @param is initial size of the list */ private MapRects(final int is) { list = new MapRect[is]; } /** * Adds a new value. * @param v value to be added */ void add(final MapRect v) { if(size == list.length) list = Array.copy(list, new MapRect[Array.newSize(size)]); list[size++] = v; } /** * Adds several new values. * @param v values to be added */ void add(final MapRects v) { for(final MapRect m : v) add(m); } /** * Returns the specified value. * @param i value index * @return value */ MapRect get(final int i) { return list[i]; } /** * Resets the integer list. */ void reset() { size = 0; } /** * Returns the position of the specified value or -1 if it has not been found. * @param r rectangle (pre value) to be found * @return rectangle position of -1 */ int find(final MapRect r) { if(sorted == null) sort(); final int p = r.pre; int l = 0; int h = size - 1; while(l <= h) { final int m = l + h >>> 1; final int c = sorted[m].pre - p; if(c == 0) return m; if(c < 0) l = m + 1; else h = m - 1; } return -1; } /** * Creates a sorted array. If the original array is already sorted, * the same reference is used. */ private void sort() { int i = Integer.MIN_VALUE; for(final MapRect r : this) { if(i > r.pre) { sorted = Arrays.copyOf(list, size); Arrays.sort(sorted); return; } i = r.pre; } sorted = list; } @Override public Iterator iterator() { return new ArrayIterator(list, size); } /** * Creates a copy of the rectangles. * @return copy */ MapRects copy() { final MapRects rects = new MapRects(size); rects.add(this); return rects; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/map/MapRenderer.java000066400000000000000000000523351222453003200265710ustar00rootroot00000000000000package org.basex.gui.view.map; import static org.basex.gui.GUIConstants.*; import static org.basex.util.Token.*; import java.awt.*; import java.util.*; import org.basex.core.*; import org.basex.data.*; import org.basex.gui.layout.*; import org.basex.util.ft.*; import org.basex.util.list.*; /** * This class assembles utility methods for painting rectangle contents. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Sebastian Gath */ final class MapRenderer { /** Color for each tooltip token. */ private static BoolList ttcol; /** Index of tooltip token to underline. */ private static int ul; /** Private constructor. */ private MapRenderer() { } /** * Calculates the height of the specified text. * @param g graphics reference * @param r rectangle * @param s text to be drawn * @param fs font size * @return last height that was occupied */ static int calcHeight(final Graphics g, final MapRect r, final byte[] s, final int fs) { return drawText(g, r, s, false, fs); } /** * Draws a text. * * @param g graphics reference * @param r rectangle * @param s text to be drawn * @param fs font size */ static void drawText(final Graphics g, final MapRect r, final byte[] s, final int fs) { drawText(g, r, s, true, fs); } /** * Draws a text. * @param g graphics reference * @param r rectangle * @param s text to be drawn * @param draw draw text (otherwise: just calculate space) * @param fs font size * @return height of the text */ private static int drawText(final Graphics g, final MapRect r, final byte[] s, final boolean draw, final int fs) { // limit string to given space final int[] cw = fontWidths(g.getFont()); final int fh = (int) (1.2 * fs); final Color textc = g.getColor(); int xx = r.x; int yy = r.y + fh; final int ww = r.w; // get index on first pre value int ll = 0; final FTLexer lex = new FTLexer().sc().init(s); while(lex.hasNext()) { final FTSpan span = lex.next(); byte[] tok = span.text; int wl = 0; for(int n = 0; n < tok.length; n += cl(tok, n)) wl += BaseXLayout.width(g, cw, cp(tok, n)); if(ll + wl >= ww) { xx = r.x; if(ll != 0) yy += fh; if(yy + fh > r.y + r.h) { // text to high, skip drawing if(draw) g.drawString(Text.DOTS, xx + ll, yy); return r.h; } ll = 0; if(draw && wl >= ww) { // single word is too long for the rectangle int twl = 2 * BaseXLayout.width(g, cw, '.'); if(twl >= ww) return Integer.MAX_VALUE; int n = 0; for(; n < tok.length; n += cl(tok, n)) { final int l = BaseXLayout.width(g, cw, cp(tok, n)); if(twl + l >= ww) break; twl += l; } tok = Arrays.copyOf(tok, n + 2); tok[n] = '.'; tok[n + 1] = '.'; } } if(draw) { // color each full-text hit g.setColor(r.pos != null && r.pos.contains(span.pos) && !span.special ? GREEN : textc); g.drawString(string(tok), xx + ll, yy); } ll += wl; if(lex.paragraph()) { // new paragraph ll = 0; yy += fh; if(yy + fh > r.y + r.h) { // text to high, skip drawing if(draw) g.drawString(Text.DOTS, xx + ll, yy); return r.h; } } } return yy - r.y; } /** * Draws a text using thumbnail visualization. * Calculates the needed space and chooses an abstraction level. * Token/Sentence/Paragraphs * @param g graphics reference * @param r rectangle * @param s text to be drawn * @param fs font size */ static void drawThumbnails(final Graphics g, final MapRect r, final byte[] s, final int fs) { // thumbnail width final double ffmax = 0.25; final double ffmin = 0.14; // thumbnail height final double ffhmax = 0.5; final double ffhmin = 0.28; // empty line height final double flhmax = 0.3; final double flhmin = 0.168; double ff = ffmax, ffh = ffhmax, flh = flhmax; double fftmin = ffmin, fftmax = ffmax, ffhtmin = ffhmin, ffhtmax = ffhmax, flhtmin = flhmin, flhtmax = flhmax; double bff = ffmax, bffh = ffhmax, bflh = flhmax; byte lhmi = (byte) Math.max(3, ffh * fs); byte fhmi = (byte) Math.max(6, (flh + ffh) * fs); int h = r.h; r.thumbf = ff * fs; r.thumbal = 0; final int[][] data = new FTLexer().init(s).info(); boolean l = false; while(r.thumbal < 2) { // find parameter setting for the available space ff = round(fftmax, fftmin); r.thumbf = ff * fs; ffh = round(ffhtmax, ffhtmin); r.thumbfh = (byte) Math.max(1, ffh * fs); flh = round(flhtmax, flhtmin); r.thumblh = (byte) Math.max(1, (flh + ffh) * fs); r.thumbsw = r.thumbf; switch(r.thumbal) { case 0: h = drawToken(g, r, data, false); break; case 1: case 2: h = drawSentence(g, r, data, false, r.h); break; } if(h >= r.h || le(ffmax, ff) || le(ffhmax, ffh) || le(flhmax, flh)) { if(l) { // use last setup to draw r.thumbf = bff * fs; r.thumbfh = (byte) Math.max(1, bffh * fs); r.thumblh = (byte) Math.max(1, (bflh + bffh) * fs); r.thumbsw = r.thumbf; switch(r.thumbal) { case 0: drawToken(g, r, data, true); return; case 1: case 2: drawSentence(g, r, data, true, r.h); return; } } if(le(ff, ffmin) || le(ffh, ffhmin) || le(flh, flhmin)) { // change abstraction level r.thumbal++; fhmi = r.thumbfh; lhmi = r.thumblh; fftmin = ffmin; fftmax = ffmax; ffhtmin = ffhmin; ffhtmax = ffhmax; flhtmin = flhmin; flhtmax = flhmax; } else { // shrink size fftmax = ff; ffhtmax = ffh; flhtmax = flh; } } else { l = true; // backup and try to enlarge bff = ff; bffh = ffh; bflh = flh; fftmin = ff; ffhtmin = ffh; flhtmin = flh; } } // calculate parameter setting // total number of bytes final double sum = data[3].length + data[4].length; // number of lines printable final double nl = (r.h - 3.0) / lhmi; // factor for the width of a thumbnail final double fnew = (nl * (r.w - 3) - data[4].length) / sum; r.thumbf = fnew; r.thumbfh = fhmi; r.thumblh = lhmi; r.thumbsw = Math.max(1, fnew); drawSentence(g, r, data, true, r.h); } /** * Checks if the first is smaller than the second value, ignoring a * small difference. * @param a double 1 * @param b double 2 * @return true if a < b */ private static boolean le(final double a, final double b) { return a < b || a / b < 1.05; } /** * Returns the rounded average of the specified values. * @param a first double * @param b second double * @return rounded double */ private static double round(final double a, final double b) { final double v = (a + b) / 2; final double d = v * 100000; final int i = (int) d; final double r = d - i >= 0.5 ? i + 1 : i; return r / 100000; } /** * Draws a text using thumbnail visualization, that represents a sentence * through a thumbnail. Sentences are separated through black thumbnails. * @param g graphics reference * @param r rectangle * @param data full-text to be drawn * @param draw boolean for drawing (used for calculating the height) * @param mh maximum height * @return height */ private static int drawSentence(final Graphics g, final MapRect r, final int[][] data, final boolean draw, final int mh) { final boolean sen = r.thumbal == 1; final FTPos ftp = r.pos; final int xx = r.x; final int ww = r.w; int yy = r.y + 3; int wl, ll = 0; // word and line length final Color textc = color(r.level + 4); g.setColor(textc); int lastl, count = -1; int ct, pp = 0, sl = 0, pl = 0; int psl = 0, ppl = 0; double error = 0; int i = 0; while(i < data[0].length) { wl = 0; ct = 0; g.setColor(textc); while(i < data[0].length && ppl < data[2].length && data[2][ppl] > pl && (psl < data[1].length && data[1][psl] > sl || psl >= data[1].length)) { sl += data[0][i]; pl += data[0][i]; lastl = (int) (data[0][i] * r.thumbf); error += data[0][i] * r.thumbf - lastl; if(error >= 1) { wl += (int) error; error -= (int) error; } wl += lastl; if(ftp != null && ftp.contains(count)) { ++ct; ++pp; } ++count; if(i < data[0].length) ++i; else break; } if(ct == 0) { while(ll + wl >= ww) { if(draw) g.fillRect(xx + ll, yy, ww - ll, r.thumbfh); wl -= ww - ll; ll = 0; yy += r.thumblh; if(yy + r.thumblh >= r.y + mh) { // height to big return r.h; } } if(draw) g.fillRect(xx + ll, yy, wl, r.thumbfh); ll += wl; } else { int cttmp = 0; int wltmp = wl / ct; while(cttmp < ct) { if(pp - ct + cttmp < ftp.size()) g.setColor(GREEN); while(ll + wltmp >= ww) { if(draw) g.fillRect(xx + ll, yy, ww - ll, r.thumbfh); wltmp -= ww - ll; ll = 0; yy += r.thumblh; // skip rest if no space is left if(yy + r.thumblh >= r.y + mh) return r.h; } if(draw) g.fillRect(xx + ll, yy, wltmp, r.thumbfh); ll += wltmp; wltmp = wl / ct + (cttmp == ct - 2 ? wl - wl / ct * ct : 0); ++cttmp; } } // new sentence if(psl < data[1].length && data[1][psl] == sl) { if(ll + r.thumbsw >= ww) { yy += r.thumblh; ll = 0; // skip rest if no space is left if(yy + r.thumblh >= r.y + mh) return r.h; } if(draw) { g.setColor(Color.black); g.fillRect(xx + ll, yy, (int) r.thumbsw, r.thumbfh); g.setColor(textc); } ll += r.thumbsw; sl = 0; ++psl; } // new paragraph if(ppl < data[2].length && data[2][ppl] == pl) { pl = 0; ++ppl; if(sen) { yy += r.thumblh; ll = 0; // skip rest if no space is left if(yy + r.thumblh >= r.y + mh) return r.h; } } } return yy - r.y + r.thumbfh; } /** * Draws a text using thumbnail visualization, that represents a token * through a thumbnail. * @param g graphics reference * @param r rectangle * @param data full-text to be drawn * @param draw boolean for drawing (used for calculating the height) * @return heights */ private static int drawToken(final Graphics g, final MapRect r, final int[][] data, final boolean draw) { final double xx = r.x; final double ww = r.w; final FTPos ftp = r.pos; int yy = r.y + 3; int wl; // word length double ll = 0; // line length double e = 0; final Color textc = color(r.level + 4); int count = 0; int sl = 0, pl = 0; int psl = 0, ppl = 0; for(int i = 0; i < data[0].length; ++i) { wl = (int) (data[0][i] * r.thumbf); e += data[0][i] * r.thumbf - wl; if(e >= 1) { wl += (int) e; e -= (int) e; } sl += data[0][i]; pl += data[0][i]; // check if rectangle fits in line - don't split token and dot if(ll + wl + r.thumbsw * (psl < data[1].length && sl == data[1][psl] ? 1 : 0) >= ww) { yy += r.thumblh; ll = 0; if(wl >= ww) return r.h + 3; } if(draw) { // draw word g.setColor(ftp != null && ftp.contains(count) ? GREEN : textc); g.fillRect((int) (xx + ll), yy, wl, r.thumbfh); } ll += wl; ++count; if(psl < data[1].length && sl == data[1][psl]) { // new sentence, draw dot if(draw) { g.setColor(Color.black); g.fillRect((int) (xx + ll), yy, (int) r.thumbsw, r.thumbfh); g.setColor(textc); } ll += r.thumbsw; ++psl; sl = 0; } ll += r.thumbf; if(ppl < data[2].length && pl == data[2][ppl]) { // new paragraph yy += r.thumblh; ll = 0; ++ppl; pl = 0; } } return yy - r.y + 3; } /** * Checks if cursor is inside the rect. * @param rx int x-value of the rect * @param ry int y-value of the rect * @param rw double width of the rect * @param rh int height of the rect * @param xx int x-value of the cursor * @param yy int y-value of the cursor * @return boolean */ private static boolean inRect(final double rx, final int ry, final double rw, final int rh, final int xx, final int yy) { return xx >= rx && xx <= rx + rw && yy >= ry && yy <= ry + rh; } /** * Calculates a the tooltip text for the thumbnail visualization. * @param r rectangle * @param data full-text to be drawn * @param x mouseX * @param y mouseY * @param w width of map view * @param g Graphics * @return token list */ static TokenList calculateToolTip(final MapRect r, final int[][] data, final int x, final int y, final int w, final Graphics g) { // rectangle is empty - don't need a tooltip if(r.thumbf == 0) return null; final boolean sen = r.thumbal < 2; final boolean ds = r.thumbal < 1; final FTPos ftp = r.pos; final int ww = r.w; int yy = r.y + 3; double ll = 0; // line length double error = 0; ul = -1; int psl = 0, ppl = 0, pl = 0, sl = 0, cc = 0; final TokenList tl = new TokenList(); ttcol = new BoolList(); for(int i = 0; i < data[0].length; ++i) { boolean ir = false; double wl = data[0][i] * r.thumbf; // sum up error, caused by int cast error += data[0][i] * r.thumbf - wl; if(error >= 1) { // adjust word length wl += error; error -= (int) error; } pl += data[0][i]; sl += data[0][i]; cc += data[0][i]; // find hovered thumbnail and corresponding text if(ll + wl + (ds && psl < data[1].length && data[1][psl] == sl ? r.thumbsw : 0) >= ww) { if(ds) { // do not split token yy += r.thumblh; ir = inRect(r.x, yy, wl, r.thumbfh, x, y); ll = wl + (psl < data[1].length && data[1][psl] == sl ? r.thumbsw : r.thumbf); } else { // split token to safe space yy += r.thumblh; wl -= ww - ll; ir = inRect(r.x, yy, wl, r.thumbfh, x, y); ll = wl + (psl < data[1].length && data[1][psl] == sl ? r.thumbsw : r.thumbf); } } else { ir |= inRect(r.x + ll, yy, wl, r.thumbfh, x, y); ll += wl + (ds ? r.thumbf : 0); } if(ir) { // go back and forward through the text, centralize the hovered token final int si = i; final int[] cw = fontWidths(g.getFont()); final int sp = BaseXLayout.width(g, cw, ' '); final int sd = BaseXLayout.width(g, cw, '.'); // go some tokens backwards form current token final int bpsl = data[1][psl] == sl ? psl + 1 : psl; final int bsl = data[1][psl] == sl ? 0 : sl; ll = sd * 2 + sp; int l; byte[] tok; int p = cc >= data[0][i] ? cc - data[0][i] : 0; boolean apm; while(p > -1 && i > -1) { // append punctuation mark apm = psl < data[1].length && data[1][psl] == sl; tok = new byte[data[0][i] + (apm ? 1 : 0)]; for(int k = 0; k < tok.length - (apm ? 1 : 0); ++k) { tok[k] = (byte) data[3][p + k]; } if(apm) { tok[tok.length - 1] = (byte) data[4][psl]; ++sl; } sl -= tok.length; if(sl == 0) { --psl; if(psl == -1) psl = data[1].length; else sl = data[1][psl]; } l = 0; for(int n = 0; n < tok.length; n += cl(tok, n)) l += BaseXLayout.width(g, cw, cp(tok, n)); if(si > i && ll + l + sp >= w / 2d) break; ll += l + sp; tl.add(tok); // find token color ttcol.add(ftp != null && ftp.contains(i)); if(i == 0) break; p -= data[0][i - 1]; --i; } if(i > 0) { tl.add(new byte[] { '.', '.' }); ttcol.add(false); } i = si + 1; p = cc; // invert tokens ul = tl.size() - 1; final byte[][] toks = tl.toArray(); final boolean[] tc = ttcol.toArray(); tl.reset(); ttcol.reset(); for(int j = toks.length - 1; j >= 0; j--) { tl.add(toks[j]); ttcol.add(tc[j]); } ll = 0; sl = bsl; psl = bpsl; // process tokens after current token while(p < data[3].length && i < data[0].length) { apm = false; if(psl < data[1].length && data[1][psl] == sl + data[0][i]) { apm = true; sl = 0; ++psl; } tok = new byte[data[0][i] + (apm ? 1 : 0)]; l = 0; for(int k = 0; k < tok.length - (apm ? 1 : 0); ++k) { tok[k] = (byte) data[3][p + k]; } if(apm) tok[tok.length - 1] = (byte) data[4][psl - 1]; sl += apm ? sl : tok.length; for(int n = 0; n < tok.length; n += cl(tok, n)) l += BaseXLayout.width(g, cw, cp(tok, n)); if(ll + l + sp + 2 * sd >= w / 2d) break; ll += l + sp; tl.add(tok); ttcol.add(ftp != null && ftp.contains(i)); p += tok.length - (apm ? 1 : 0); ++i; } if(i < data[0].length) { tl.add(new byte[] { '.', '.' }); ttcol.add(false); } return tl; } // new sentence if(ds && psl < data[1].length && data[1][psl] == sl) { if(ll + r.thumbsw >= ww) { yy += r.thumblh; ll -= ww; } ll += r.thumbsw; sl = 0; ++psl; } // new paragraph if(ppl < data[2].length && data[2][ppl] == pl) { pl = 0; ++ppl; if(sen) { yy += r.thumblh; ll = 0; } } } return tl; } /** * Draws pre-calculated tooltip. * @param g graphics reference * @param x x-value * @param y y-value * @param mr view rectangle * @param tl token list * @param fs font size */ static void drawToolTip(final Graphics g, final int x, final int y, final MapRect mr, final TokenList tl, final int fs) { if(tl == null || tl.isEmpty()) return; final int[] cw = fontWidths(g.getFont()); final int sw = BaseXLayout.width(g, cw, ' '); int wl = 0; int nl = 1; int wi = mr.w / 2; final IntList len = new IntList(); for(int i = 0; i < tl.size(); ++i) { int l = 0; final byte[] tok = tl.get(i); final int ns = tok.length; for(int n = 0; n < ns; n += cl(tok, n)) { l += BaseXLayout.width(g, cw, cp(tok, n)); } if(wl + l + sw < wi) { wl += l + sw; } else { ++nl; if(l > wi) wi = l; wl = l + sw; } len.add(l); } final int ww = nl == 1 && wl < wi ? wl : wi; // find optimal position for the tooltip final int xx = x + 10 + ww >= mr.x + mr.w ? mr.x + mr.w - ww - 2 : x + 10; int yy = y + 28 + fs * nl + 4 < mr.y + mr.h ? y + 28 : y - mr.y - 4 > fs * nl ? y - fs * nl : mr.y + mr.h - 4 - fs * nl; g.setColor(color(10)); g.drawRect(xx - 3, yy - fs - 1, ww + 3, fs * nl + 7); g.setColor(color(0)); g.fillRect(xx - 2, yy - fs, ww + 2, fs * nl + 6); g.setColor(color(20)); wl = 0; final int is = tl.size(); for(int i = 0; i < is; ++i) { final int l = len.get(i); if(wl + l + sw >= wi) { yy += fs + 1; wl = 0; } final boolean pm = !ftChar(tl.get(i)[tl.get(i).length - 1]); if(ttcol.get(i)) g.setColor(GREEN); g.drawString(string(tl.get(i)), xx + wl, yy); if(i == ul) { g.drawLine(xx + wl, yy + 1, xx + wl + (pm ? l - sw : l), yy + 1); } g.setColor(color(24)); wl += l + sw; } } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/map/MapView.java000066400000000000000000000426641222453003200257410ustar00rootroot00000000000000package org.basex.gui.view.map; import static org.basex.core.Text.*; import static org.basex.gui.GUIConstants.*; import static org.basex.gui.layout.BaseXKeys.*; import java.awt.*; import java.awt.event.*; import java.awt.image.*; import javax.swing.*; import org.basex.data.*; import org.basex.gui.*; import org.basex.gui.layout.*; import org.basex.gui.view.*; import org.basex.util.*; import org.basex.util.ft.*; import org.basex.util.list.*; /** * This view is a TreeMap implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Joerg Hauser * @author Bastian Lemke */ public final class MapView extends View implements Runnable { /** Dynamic zooming steps. */ private static final int[] ZS = { 0, 0, 0, 0, 20, 80, 180, 320, 540, 840, 1240, 1740, 2380, 3120, 4000, 4980, 5980, 6860, 7600, 8240, 8740, 9140, 9440, 9660, 9800, 9900, 9960, 9980, 9980, 9980, 10000 }; /** Number of zooming steps. */ private static final int ZOOMSIZE = ZS.length - 1; /** Maximum zooming step. */ private static final int MAXZS = ZS[ZOOMSIZE]; /** Array of current rectangles. */ private MapRects mainRects; /** Data specific map layout. */ private transient MapPainter painter; /** Text lengths. */ private int[] textLen; /** Rectangle history. */ private final MapRect[] rectHist = new MapRect[ViewNotifier.MAXHIST]; /** Current zooming Step (set to 0 when no zooming takes place). */ private int zoomStep; /** Main rectangle. */ private MapRect mainRect; /** Dragged rectangle. */ private MapRect selBox; /** Flag for zooming in/out. */ private boolean zoomIn; /** Zooming speed. */ private int zoomSpeed; /** Horizontal mouse position. */ private int mouseX = -1; /** Vertical mouse position. */ private int mouseY = -1; /** Drag tolerance. */ private int dragTol; /** Currently focused rectangle. */ private MapRect focused; /** TreeMap. */ private BufferedImage mainMap; /** Zoomed TreeMap. */ private BufferedImage zoomMap; /** Keeps the whole map layout. */ MapLayout layout; /** * Default constructor. * @param man view manager */ public MapView(final ViewNotifier man) { super(MAPVIEW, man); new BaseXPopup(this, POPUP); } /** * Creates a buffered image. * @return buffered image */ private BufferedImage createImage() { return new BufferedImage(Math.max(1, getWidth()), Math.max(1, getHeight()), BufferedImage.TYPE_INT_BGR); } @Override public void refreshInit() { painter = null; mainRects = null; focused = null; textLen = null; zoomStep = 0; final Data data = gui.context.data(); final GUIProp gprop = gui.gprop; if(data != null && visible()) { painter = new MapDefault(this, gprop); mainMap = createImage(); zoomMap = createImage(); refreshLayout(); } } @Override public void refreshFocus() { final int f = gui.context.focused; if(f == -1) focused = null; if(mainRects == null) return; final int ms = mainRects.size; for(int mi = 0; mi < ms; ++mi) { final MapRect rect = mainRects.get(mi); if(f == rect.pre || mi + 1 == ms || f < mainRects.get(mi + 1).pre) { focused = rect; repaint(); break; } } } @Override public void refreshMark() { drawMap(mainMap, mainRects, 1f); repaint(); } @Override public void refreshContext(final boolean more, final boolean quick) { // use simple zooming animation for result node filtering final Nodes context = gui.context.current(); final int hist = gui.notify.hist; final boolean page = !more && rectHist[hist + 1] != null && rectHist[hist + 1].pre == 0 || more && (context.size() != 1 || focused == null || context.pres[0] != focused.pre); if(page) focused = new MapRect(0, 0, getWidth(), 1); zoom(more, quick); } @Override public void refreshLayout() { if(painter == null) return; // calculate map final Nodes curr = gui.context.current(); calc(new MapRect(0, 0, getWidth(), getHeight(), 0, 0), curr, mainMap); repaint(); } @Override public void refreshUpdate() { textLen = null; refreshContext(false, true); } @Override public boolean visible() { return gui.gprop.is(GUIProp.SHOWMAP); } @Override public void visible(final boolean v) { gui.gprop.set(GUIProp.SHOWMAP, v); } @Override protected boolean db() { return true; } /** * Zooms the focused rectangle. * @param more show more * @param quick context switch (no animation) */ private void zoom(final boolean more, final boolean quick) { gui.updating = !quick; zoomIn = more; // choose zooming rectangle final int hist = gui.notify.hist; if(more) { rectHist[hist] = focused; mainRect = rectHist[hist]; } else { mainRect = rectHist[hist + 1]; } if(mainRect == null) mainRect = new MapRect(0, 0, getWidth(), getHeight()); // reset data & start zooming final BufferedImage tmpMap = zoomMap; zoomMap = mainMap; mainMap = tmpMap; focused = null; // create new context nodes refreshLayout(); // calculate zooming speed (slower for large zooming scales) if(mainRect.w > 0 && mainRect.h > 0) { zoomSpeed = (int) (Math.log(64d * getWidth() / mainRect.w) + Math.log(64d * getHeight() / mainRect.h)); } if(quick) { gui.updating = false; focus(); repaint(); } else { zoomStep = ZOOMSIZE; new Thread(this).start(); } } @Override public void run() { focused = null; // run zooming while(zoomStep > 1) { Performance.sleep(zoomSpeed); --zoomStep; repaint(); } // wait until current painting is finished while(gui.painting) Performance.sleep(zoomSpeed); // remove old rectangle and repaint map zoomStep = 0; gui.updating = false; focus(); repaint(); } /** * Finds the rectangle at the cursor position. * @return focused rectangle */ private boolean focus() { if(gui.updating || mainRects == null) return false; /* * Loop through all rectangles. As the rectangles are sorted by pre order * and small rectangles are descendants of bigger ones, the focused * rectangle can be found by simply parsing the array backwards. */ int r = mainRects.size; while(--r >= 0) { final MapRect rect = mainRects.get(r); if(rect.contains(mouseX, mouseY)) break; } // don't focus top rectangles final MapRect fr = r >= 0 ? mainRects.get(r) : null; // find focused rectangle final boolean nf = focused != fr || fr != null && fr.thumb; focused = fr; if(nf) gui.notify.focus(focused != null ? focused.pre : -1, this); return nf; } /** * Initializes the calculation of the main map. * @param rect initial space to layout rectangles in * @param nodes nodes to draw in the map * @param map image to draw rectangles on */ private void calc(final MapRect rect, final Nodes nodes, final BufferedImage map) { // calculate new main rectangles gui.cursor(CURSORWAIT); initLen(); layout = new MapLayout(nodes.data, textLen, gui.gprop); layout.makeMap(rect, new MapList(nodes.pres.clone()), 0, (int) nodes.size() - 1); // rectangles are copied to avoid synchronization issues mainRects = layout.rectangles.copy(); drawMap(map, mainRects, 1f); focus(); gui.cursor(CURSORARROW, true); } @Override public void paintComponent(final Graphics g) { final Data data = gui.context.data(); if(data == null) return; if(mainRects == null || mainRects.size == 0 || mainRects.get(0).w == 0) { super.paintComponent(g); if(mainRects == null || mainRects.size != 0) refreshInit(); return; } // calculate map gui.painting = true; // paint map final boolean in = zoomStep > 0 && zoomIn; final Image img1 = in ? zoomMap : mainMap; final Image img2 = in ? mainMap : zoomMap; if(zoomStep > 0) { drawImage(g, img1, -zoomStep); drawImage(g, img2, zoomStep); } else { drawImage(g, mainMap, zoomStep); } // check if focused rectangle is valid if(focused != null && focused.pre >= data.meta.size) focused = null; // skip node path view final MapRect f = focused; if(f == null || mainRects.size == 1 && f == mainRects.get(0)) { gui.painting = false; if(f == null || !f.thumb) return; } final GUIProp gprop = gui.gprop; if(gprop.num(GUIProp.MAPOFFSETS) == 0) { g.setColor(color(32)); int pre = mainRects.size; int par = ViewData.parent(data, f.pre); while(--pre >= 0) { final MapRect rect = mainRects.get(pre); if(rect.pre == par) { final int x = rect.x; final int y = rect.y; final int w = rect.w; final int h = rect.h; g.drawRect(x, y, w, h); g.drawRect(x - 1, y - 1, w + 2, h + 2); par = ViewData.parent(data, par); } } } if(selBox != null) { g.setColor(colormark3); g.drawRect(selBox.x, selBox.y, selBox.w, selBox.h); g.drawRect(selBox.x - 1, selBox.y - 1, selBox.w + 2, selBox.h + 2); } else { // paint focused rectangle final int x = f.x; final int y = f.y; final int w = f.w; final int h = f.h; g.setColor(color4); g.drawRect(x, y, w, h); g.drawRect(x + 1, y + 1, w - 2, h - 2); // draw tag label g.setFont(font); smooth(g); if(data.kind(f.pre) == Data.ELEM) { String tt = Token.string(ViewData.name(gprop, data, f.pre)); if(tt.length() > 32) tt = tt.substring(0, 30) + DOTS; BaseXLayout.drawTooltip(g, tt, x, y, getWidth(), f.level + 5); } if(f.thumb) { // draw tooltip for thumbnail f.x += 3; f.w -= 3; // read content from disk final byte[] text = MapPainter.content(data, f); // calculate tooltip final int[][] info = new FTLexer().init(text).info(); final TokenList tl = MapRenderer.calculateToolTip(f, info, mouseX, mouseY, getWidth(), g); final MapRect mr = new MapRect(getX(), getY(), getWidth(), getHeight()); // draw calculated tooltip MapRenderer.drawToolTip(g, mouseX, mouseY, mr, tl, fontSize); f.x -= 3; f.w += 3; } } gui.painting = false; } /** * Draws image with correct scaling. * @param g graphics reference * @param img image to be drawn * @param zi zooming factor */ private void drawImage(final Graphics g, final Image img, final int zi) { if(img == null) return; final MapRect r = new MapRect(0, 0, getWidth(), getHeight()); zoom(r, zi); g.drawImage(img, r.x, r.y, r.x + r.w, r.y + r.h, 0, 0, getWidth(), getHeight(), this); } /** * Zooms the coordinates of the specified rectangle. * @param r rectangle to be zoomed * @param zs zooming step */ private void zoom(final MapRect r, final int zs) { int xs = r.x; int ys = r.y; int xe = xs + r.w; int ye = ys + r.h; // calculate zooming rectangle // get window size if(zs != 0) { final MapRect zr = mainRect; final int tw = getWidth(); final int th = getHeight(); if(zs > 0) { final long s = zoomIn ? ZS[zs] : ZS[ZOOMSIZE - zs]; xs = (int) ((zr.x + xs * zr.w / tw - xs) * s / MAXZS); ys = (int) ((zr.y + ys * zr.h / th - ys) * s / MAXZS); xe += (int) ((zr.x + xe * zr.w / tw - xe) * s / MAXZS); ye += (int) ((zr.y + ye * zr.h / th - ye) * s / MAXZS); } else { final long s = 10000 - (zoomIn ? ZS[-zs] : ZS[ZOOMSIZE + zs]); if(zr.w == 0) zr.w = 1; if(zr.h == 0) zr.h = 1; xs = (int) (-xe * zr.x / zr.w * s / MAXZS); xe = (int) (xs + xe + xe * (xe - zr.w) / zr.w * s / MAXZS); ys = (int) (-ye * zr.y / zr.h * s / MAXZS); ye = (int) (ys + ye + ye * (ye - zr.h) / zr.h * s / MAXZS); } } r.x = xs; r.y = ys; r.w = xe - xs; r.h = ye - ys; } /** * Creates a buffered image for the treemap. * @param map Image to draw the map on * @param rects calculated rectangles * @param sc scale the rectangles */ private void drawMap(final BufferedImage map, final MapRects rects, final float sc) { final Graphics g = map.getGraphics(); smooth(g); painter.drawRectangles(g, rects, sc); } @Override public void mouseMoved(final MouseEvent e) { if(gui.updating) return; mouseX = e.getX(); mouseY = e.getY(); if(focus()) repaint(); } @Override public void mousePressed(final MouseEvent e) { if(gui.updating) return; super.mousePressed(e); mouseX = e.getX(); mouseY = e.getY(); dragTol = 0; if(!focus() && gui.context.focused == -1) return; // add or remove marked node final Nodes marked = gui.context.marked; if(e.getClickCount() == 2) { if(mainRects.size != 1) gui.notify.context(marked, false, null); } else if(e.isShiftDown()) { gui.notify.mark(1, null); } else if(sc(e) && SwingUtilities.isLeftMouseButton(e)) { gui.notify.mark(2, null); } else { if(!marked.contains(gui.context.focused)) gui.notify.mark(0, null); } } @Override public void mouseDragged(final MouseEvent e) { if(gui.updating || ++dragTol < 8 || mainRects.sorted != mainRects.list) return; // refresh mouse focus int mx = mouseX; int my = mouseY; int mw = e.getX() - mx; int mh = e.getY() - my; if(mw < 0) mx -= mw = -mw; if(mh < 0) my -= mh = -mh; selBox = new MapRect(mx, my, mw, mh); final Data data = gui.context.data(); final IntList il = new IntList(); int np = 0; final int rl = mainRects.size; for(int r = 0; r < rl; ++r) { final MapRect rect = mainRects.get(r); if(mainRects.get(r).pre < np) continue; if(selBox.contains(rect)) { il.add(rect.pre); np = rect.pre + ViewData.size(data, rect.pre); } } gui.notify.mark(new Nodes(il.toArray(), data), null); } @Override public void mouseReleased(final MouseEvent e) { if(gui.updating) return; if(selBox != null) { selBox = null; repaint(); } } @Override public void mouseWheelMoved(final MouseWheelEvent e) { if(gui.updating || gui.context.focused == -1) return; if(e.getWheelRotation() <= 0) { final Nodes m = new Nodes(gui.context.focused, gui.context.data()); gui.context.marked = m; gui.notify.context(m, false, null); } else { gui.notify.hist(false); } } @Override public void keyPressed(final KeyEvent e) { super.keyPressed(e); if(gui.updating || mainRects == null || control(e)) return; final boolean cursor = PREVLINE.is(e) || NEXTLINE.is(e) || PREV.is(e) || NEXT.is(e); if(!cursor) return; if(focused == null) focused = mainRects.get(0); final int fs = fontSize; int o = fs + 4; final boolean shift = e.isShiftDown(); if(PREVLINE.is(e)) { mouseY = focused.y + (shift ? focused.h - fs : 0) - 1; if(shift) mouseX = focused.x + (focused.w >> 1); } else if(NEXTLINE.is(e)) { mouseY = focused.y + (shift ? o : focused.h + 1); if(shift) mouseX = focused.x + (focused.w >> 1); } else if(PREV.is(e)) { mouseX = focused.x + (shift ? focused.w - fs : 0) - 1; if(shift) mouseY = focused.y + (focused.h >> 1); } else if(NEXT.is(e)) { mouseX = focused.x + (shift ? o : focused.w + 1); if(shift) mouseY = focused.y + (focused.h >> 1); } o = mainRects.get(0).w == getWidth() ? (o >> 1) + 1 : 0; mouseX = Math.max(o, Math.min(getWidth() - o - 1, mouseX)); mouseY = Math.max(o << 1, Math.min(getHeight() - o - 1, mouseY)); if(focus()) repaint(); } @Override public void componentResized(final ComponentEvent e) { if(gui.updating) return; focused = null; mainMap = createImage(); zoomMap = createImage(); refreshLayout(); } /** * Initializes the text lengths and stores them into an array. */ private void initLen() { final Data data = gui.context.data(); if(textLen != null || gui.gprop.num(GUIProp.MAPWEIGHT) == 0) return; final int size = data.meta.size; textLen = new int[size]; final IntList pars = new IntList(); int l = 0; for(int pre = 0; pre < size; ++pre) { final int kind = data.kind(pre); final int par = data.parent(pre, kind); final int ll = l; while(l > 0 && pars.get(l - 1) > par) { textLen[pars.get(l - 1)] += textLen[pars.get(l)]; --l; } if(l > 0 && ll != l) textLen[pars.get(l - 1)] += textLen[pars.get(l)]; pars.set(l, pre); if(kind == Data.DOC || kind == Data.ELEM) { pars.set(++l, 0); } else { textLen[pre] = data.textLen(pre, kind != Data.ATTR); } } while(--l >= 0) textLen[pars.get(l)] += textLen[pars.get(l + 1)]; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/map/SliceDiceAlgo.java000066400000000000000000000022031222453003200270010ustar00rootroot00000000000000package org.basex.gui.view.map; /** * Slice-and-Dice layout algorithm. * * @author BaseX Team 2005-12, BSD License * @author Joerg Hauser */ final class SliceDiceAlgo extends MapAlgo { @Override MapRects calcMap(final MapRect r, final MapList ml, final int ns, final int ne) { // setting initial proportions double xx = r.x; double yy = r.y; double ww = 0; double hh = 0; int tx = -1; int ty = -1; int th = -1; int tw = -1; final MapRects rects = new MapRects(); // calculate map for each rectangle on this level final int is = ml.size(); for(int i = 0; i < is; ++i) { if((r.level & 1) == 0) { yy += hh; hh = ml.weight[i] * r.h; ww = r.w; } else { xx += ww; ww = ml.weight[i] * r.w; hh = r.h; } if(ww > 0 && hh > 0 && (tx != (int) xx || ty != (int) yy || th != (int) hh || tw != (int) ww)) rects.add(new MapRect((int) xx, (int) yy, (int) ww, (int) hh, ml.get(i), r.level)); tx = (int) xx; ty = (int) yy; th = (int) hh; tw = (int) ww; } return rects; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/map/SplitAlgo.java000066400000000000000000000034051222453003200262550ustar00rootroot00000000000000package org.basex.gui.view.map; /** * SplitLayout algorithm. * * @author BaseX Team 2005-12, BSD License * @author Joerg Hauser */ final class SplitAlgo extends MapAlgo { @Override MapRects calcMap(final MapRect r, final MapList ml, final int ns, final int ne) { return calcMap(r, ml, ns, ne, 1); } /** * Uses recursive SplitLayout algorithm to divide rectangles on one level. * @param r parent rectangle * @param ml children array * @param ns start array position * @param ne end array position * @param sw weight of this recursion level * @return rectangles */ private static MapRects calcMap(final MapRect r, final MapList ml, final int ns, final int ne, final double sw) { if(ne - ns == 0) { final MapRects rects = new MapRects(); rects.add(new MapRect(r, ml.get(ns))); return rects; } final MapRects rects = new MapRects(); int ni = ns - 1; // increment pivot until left rectangle contains more or equal // than half the weight or leave with just setting it to ne - 1 double w = 0; while(ni < ne) { w += ml.weight[++ni]; if(w >= sw / 2 || ni == ne - 1) break; } int xx = r.x; int yy = r.y; int ww = !(r.w > r.h) ? r.w : (int) (r.w / sw * w); int hh = r.w > r.h ? r.h : (int) (r.h / sw * w); // paint both rectangles if enough space is left if(ww > 0 && hh > 0 && w > 0) rects.add(calcMap( new MapRect(xx, yy, ww, hh, 0, r.level), ml, ns, ni, w)); if(r.w > r.h) { xx += ww; ww = r.w - ww; } else { yy += hh; hh = r.h - hh; } if(ww > 0 && hh > 0 && sw - w > 0 && ni + 1 <= ne) rects.add(calcMap(new MapRect(xx, yy, ww, hh, 0, r.level), ml, ni + 1, ne, sw - w)); return rects; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/map/SquarifiedAlgo.java000066400000000000000000000071211222453003200272550ustar00rootroot00000000000000package org.basex.gui.view.map; /** * Squarified layout algorithm. * * @author BaseX Team 2005-12, BSD License * @author Joerg Hauser */ final class SquarifiedAlgo extends MapAlgo { @Override MapRects calcMap(final MapRect r, final MapList ml, final int ns, final int ne) { ml.sort(); final MapRects rects = new MapRects(); int ni = ns; // running start holding first element of current row int start = ns; // setting initial proportions double xx = r.x; double yy = r.y; double ww = r.w; double hh = r.h; MapRects row = new MapRects(); int height; int width; double weight = 0; double sumweight = 1; double tmpratio; double rowratio = Double.MAX_VALUE; while(ni <= ne && xx + ww <= r.x + r.w && yy + hh <= r.y + r.h) { if(ww < hh) { weight += ml.weight[ni]; height = (int) (weight / sumweight * hh); height = height > 0 ? height : 1; final MapRects tmp = new MapRects(); double x = xx; for(int i = start; i <= ni; ++i) { int w = i == ni ? (int) (xx + ww - x) : (int) (ml.weight[i] / weight * ww); w = w > 0 ? w : 1; if(x + w <= xx + ww) tmp.add(new MapRect((int) x, (int) yy, w, height, ml.get(i), r.level)); else break; x += w; } tmpratio = lineRatio(tmp); // if ar has increased discard tmp and add row if(tmpratio > rowratio) { // add rects of row to solution rects.add(row); rowratio = Double.MAX_VALUE; // preparing next line hh -= row.get(0).h; yy += row.get(0).h; tmp.reset(); row.reset(); start = ni; sumweight -= weight - ml.weight[ni]; weight = 0; // sometimes there has to be one rectangles to fill the left space if(ne == ni) { row.add(new MapRect((int) xx, (int) yy, (int) ww, (int) hh, ml.get(ni), r.level)); break; } } else { row = tmp; rowratio = tmpratio; ++ni; } } else { weight += ml.weight[ni]; width = (int) (weight / sumweight * ww); width = width > 0 ? width : 1; final MapRects tmp = new MapRects(); double y = yy; for(int i = start; i <= ni; ++i) { int h = i == ni ? (int) (yy + hh - y) : (int) (ml.weight[i] / weight * hh); h = h > 0 ? h : 1; if(y + h <= yy + hh) tmp.add(new MapRect((int) xx, (int) y, width, h, ml.get(i), r.level)); else break; y += h; } tmpratio = lineRatio(tmp); // if ar has increased discard tmp and add row if(tmpratio > rowratio) { // add rects of row to solution rects.add(row); rowratio = Double.MAX_VALUE; // preparing next line ww -= row.get(0).w; xx += row.get(0).w; tmp.reset(); row.reset(); start = ni; sumweight -= weight - ml.weight[ni]; weight = 0; // sometimes there has to be one rectangles to fill the left space if(ne == ni) { row.add(new MapRect((int) xx, (int) yy, (int) ww, (int) hh, ml.get(ni), r.level)); break; } } else { row = tmp; rowratio = tmpratio; ++ni; } } } for(final MapRect rect : row) rect.h = (int) hh; // adding last row rects.add(row); return rects; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/map/StripAlgo.java000066400000000000000000000042261222453003200262650ustar00rootroot00000000000000package org.basex.gui.view.map; /** * StripLayout algorithm. * * @author BaseX Team 2005-12, BSD License * @author Joerg Hauser */ final class StripAlgo extends MapAlgo { @Override MapRects calcMap(final MapRect r, final MapList ml, final int ns, final int ne) { // stores all calculated rectangles final MapRects rects = new MapRects(); // node iterator int ni = ns; // first node of current row int start = ns; // setting initial proportions final double yy = r.y; final double hh = r.h; double xx = r.x; double ww = r.w; MapRects row = new MapRects(); int width; double weight = 0; double sumweight = 1; double tmpratio; double rowratio = Double.MAX_VALUE; while(ni <= ne && xx + ww <= r.x + r.w && yy + hh <= r.y + r.h) { weight += ml.weight[ni]; width = (int) (weight / sumweight * ww); width = width > 0 ? width : 1; final MapRects tmp = new MapRects(); double y = yy; for(int i = start; i <= ni; ++i) { int h = i == ni ? (int) (yy + hh - y) : (int) (ml.weight[i] / weight * hh); h = h > 0 ? h : 1; if(yy <= yy + hh) tmp.add(new MapRect((int) xx, (int) y, width, h, ml.get(i), r.level)); else break; y += h; } tmpratio = lineRatio(tmp); // if ar has increased discard tmp and add row if(tmpratio > rowratio) { // add rects of row to solution rects.add(row); rowratio = Double.MAX_VALUE; // preparing next line ww -= row.get(0).w; xx += row.get(0).w; tmp.reset(); row.reset(); start = ni; sumweight -= weight - ml.weight[ni]; weight = 0; // sometimes there has to be one rectangles to fill the left space if(ne == ni) { row.add(new MapRect((int) xx, (int) yy, (int) ww, (int) hh, ml.get(ni), r.level)); break; } } else { row = tmp; rowratio = tmpratio; ++ni; } } // adding last row for(final MapRect rect : row) rect.w = (int) ww; rects.add(row); return rects; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/map/package.html000066400000000000000000000000361222453003200257720ustar00rootroot00000000000000 GUI Map View. basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/package.html000066400000000000000000000000741222453003200252170ustar00rootroot00000000000000 Visualizations and View Observer framework. basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/plot/000077500000000000000000000000001222453003200237135ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/plot/PlotAxis.java000066400000000000000000000256111222453003200263260ustar00rootroot00000000000000package org.basex.gui.view.plot; import static org.basex.util.Token.*; import org.basex.data.*; import org.basex.index.stats.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Axis component of the scatter plot visualization. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ final class PlotAxis { /** Text length limit for text to number transformation. */ private static final int TEXTLENGTH = 11; /** Plot data reference. */ private final PlotData plotData; /** Tag reference to selected attribute. */ int attrID; /** Number of different categories for x attribute. */ int nrCats; /** Data type. */ StatsType type; /** Coordinates of items. */ double[] co = {}; /** First label to be drawn after minimum label. */ double startvalue; /** The first category for text data. */ byte[] firstCat; /** The last category for text data. */ byte[] lastCat; /** Number of captions to display. */ int nrCaptions; /** Step for axis caption. */ double actlCaptionStep; /** Calculated caption step, view size not considered for calculation. */ private double calculatedCaptionStep; /** Minimum value in case selected attribute is numerical. */ double min; /** Maximum value in case selected attribute is numerical. */ double max; /** Axis uses logarithmic scale. */ boolean log; /** True if attribute is a tag, false if attribute. */ private boolean tag; /** Ln of min. */ private double logMin; /** Ln of max. */ private double logMax; /** * Constructor. * @param data plot data reference */ PlotAxis(final PlotData data) { plotData = data; } /** * (Re)Initializes axis. */ private void initialize() { tag = false; type = StatsType.INTEGER; co = new double[0]; nrCats = -1; firstCat = EMPTY; lastCat = EMPTY; nrCaptions = 0; actlCaptionStep = -1; calculatedCaptionStep = -1; min = Integer.MIN_VALUE; max = Integer.MAX_VALUE; startvalue = 0; } /** * Called if the user has changed the caption of the axis. If a new * attribute was selected the positions of the plot items are recalculated. * @param attribute attribute selected by the user * @return true if new attribute was selected */ boolean setAxis(final String attribute) { if(attribute == null) return false; initialize(); byte[] b = token(attribute); tag = !contains(b, '@'); b = delete(b, '@'); final Data data = plotData.context.data(); attrID = (tag ? data.tagindex : data.atnindex).id(b); refreshAxis(); return true; } /** * Refreshes item list and coordinates if the selection has changed. So far * only numerical data is considered for plotting. If the selected attribute * is of kind TEXT, it is treated as INT. */ void refreshAxis() { final Data data = plotData.context.data(); final Stats key = tag ? data.tagindex.stat(attrID) : data.atnindex.stat(attrID); if(key == null) return; type = key.type; if(type == null) return; if(type == StatsType.CATEGORY) type = StatsType.TEXT; final int[] items = plotData.pres; if(items.length < 1) return; co = new double[items.length]; final byte[][] vals = new byte[items.length][]; for(int i = 0; i < items.length; ++i) { byte[] value = getValue(items[i]); if(type == StatsType.TEXT && value.length > TEXTLENGTH) { value = substring(value, 0, TEXTLENGTH); } vals[i] = lc(value); } if(type == StatsType.TEXT) { textToNum(vals); } else { minMax(vals); // calculations for axis labeling if(!log) prepareLinAxis(); // coordinates for TEXT already calculated in textToNum() for(int i = 0; i < vals.length; ++i) co[i] = calcPosition(vals[i]); } } /** * TEXT data is transformed to categories, meaning each unique string forms * a category. The text values of the items are first sorted. The coordinate * for an item is then calculated as the position of the text value of this * item in the sorted category set. * @param vals item values */ private void textToNum(final byte[][] vals) { // get sorted indexes for values final int[] tmpI = Array.createOrder(vals, false, true); final int vl = vals.length; int i = 0; // find first non-empty value // empty string is treated as non existing value -> coordinate = -1 while(i < vl && vals[i].length == 0) co[tmpI[i++]] = -1; // count number of unique values nrCats = new TokenSet(vals).size(); if(i > 0) --nrCats; // get first/last category for axis caption firstCat = i < vl ? vals[i] : EMPTY; lastCat = i < vl ? vals[vl - 1] : EMPTY; // number of current category/position of item value in ordered text set int p = 0; while(i < vl) { // next string category to be tested final byte[] b = vals[i]; // l: highest index in sorted array for value b int l = i; // determining highest index of value/category b while(l < vl && eq(vals[l], b)) ++l; // calculating positions for all items with value b in current category while(i < l) { // centering items if only a single category exists (.5d) final double d = nrCats != 1 ? 1.0d / (nrCats - 1) * p : .5d; co[tmpI[i++]] = d; } ++p; } } /** * Calculates the relative position of an item in the plot for a given value. * The position for a TEXT value of an item is calculated in * {@link #textToNum}. * @param value item value * @return relative x or y value of the item */ private double calcPosition(final byte[] value) { if(value.length == 0) { return -1; } double range = max - min; if(range == 0) return 0.5d; final double d = toDouble(value); if(!log) return 1 / range * (d - min); // calculate position on a logarithmic scale. to display negative // values on a logarithmic scale, three cases are to be distinguished: // 0. both extreme values are greater or equal 0. // 1. the minimum value is smaller 0, hence the axis is 'mirrored' at 0. // 2. both extreme values are smaller 0; axis is also 'mirrored' and // values above the max value are not displayed. range = logMax - logMin; // case 1 if(min < 0 && max >= 0) { // p is the portion of the range between minimum value and zero compared // to the range between zero and the maximum value. // (needed for mirroring, s.a.) final double p = 1 / (logMin + logMax) * logMin; if(d == 0) return p; if(d < 0) return 1.0d - (1 - p) - 1.0d / logMin * ln(d) * p; return p + 1.0d / logMax * ln(d) * (1 - p); } // case 2 and 0 return 1 / range * (ln(d) - logMin); } /** * Calculates relative coordinate for a given value. * @param value given value * @return relative coordinate */ double calcPosition(final double value) { return calcPosition(token(value)); } /** * Calculates base e logarithm for the given value. * @param d value * @return base e logarithm for d */ private static double ln(final double d) { return d == 0 ? 0 : Math.log1p(Math.abs(d)); } /** * Returns the value for the specified pre value. * @param pre pre value * @return item value */ byte[] getValue(final int pre) { final Data data = plotData.context.data(); final int limit = pre + data.size(pre, Data.ELEM); for(int p = pre; p < limit; ++p) { final int kind = data.kind(p); if((kind == Data.ELEM && tag || kind == Data.ATTR && !tag) && attrID == data.name(p)) return data.atom(p); } return EMPTY; } /** * Determines the extreme values of the current data set. * @param vals values of plotted nodes */ private void minMax(final byte[][] vals) { min = Integer.MAX_VALUE; max = Integer.MIN_VALUE; int i = -1; boolean b = false; while(++i < vals.length) { if(vals[i].length > 0) { b = true; final double d = toDouble(vals[i]); if(d < min) min = d; if(d > max) max = d; } } if(!b) { min = 0; max = 0; } if(log) { logMin = ln(min); logMax = ln(max); } } /** * Executes some calculations to support a dynamic axis labeling for a * linear scale. */ private void prepareLinAxis() { // range as driving force for following calculations, no matter if INT // or DBL ... whatsoever double range = Math.abs(max - min); if(range == 0) return; // small ranges between min and max value if(range < 1) { final double dec = 1.0d / range; double pow = (int) (Math.floor(Math.log10(dec) + .5d) + 1) * 2; final double fac = (int) Math.pow(10, pow); final double tmin = min * fac; final double tmax = max * fac; range = Math.abs(tmax - tmin); pow = range < 10 ? 0 : (int) Math.floor(Math.log10(range) + .5d) - 1; calculatedCaptionStep = (int) Math.pow(10, pow); calculatedCaptionStep /= fac; return; } final int pow = range < 10 ? 0 : (int) Math.floor(Math.log10(range) + .5d) - 1; calculatedCaptionStep = (int) Math.pow(10, pow); } /** * Calculates axis caption depending on view width / height. * @param space space of view axis available for captions */ void calcCaption(final int space) { if(type == StatsType.DOUBLE || type == StatsType.INTEGER) { final double range = Math.abs(max - min); if(range == 0) { nrCaptions = 1; return; } // labeling for logarithmic scale if(log) { startvalue = min; nrCaptions = 3; return; } // labeling for linear scale final boolean dbl = type == StatsType.DOUBLE; actlCaptionStep = calculatedCaptionStep; nrCaptions = (int) (range / actlCaptionStep) + 1; while(2 * nrCaptions * PlotView.CAPTIONWHITESPACE * 3 < space && (dbl || actlCaptionStep % 2 == 0)) { actlCaptionStep /= 2; nrCaptions = (int) (range / actlCaptionStep); } while(nrCaptions * PlotView.CAPTIONWHITESPACE * 3 > space) { actlCaptionStep *= 2; nrCaptions = (int) (range / actlCaptionStep); } // calculate first value to be drawn startvalue = min + actlCaptionStep - min % actlCaptionStep; if(startvalue - min < actlCaptionStep / 4) startvalue += actlCaptionStep; // type == TEXT / CAT } else { nrCaptions = space / (PlotView.CAPTIONWHITESPACE * 3); if(nrCaptions > nrCats) nrCaptions = nrCats; actlCaptionStep = 1.0d / (nrCaptions - 1); } } }basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/plot/PlotData.java000066400000000000000000000071721222453003200262750ustar00rootroot00000000000000package org.basex.gui.view.plot; import static org.basex.util.Token.*; import java.util.*; import org.basex.core.*; import org.basex.data.*; import org.basex.index.name.*; import org.basex.index.stats.*; import org.basex.util.list.*; /** * An additional layer which prepares the data for the scatter plot. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ final class PlotData { /** Database context. */ final Context context; /** The x axis of the plot. */ final PlotAxis xAxis; /** The y axis of the plot. */ final PlotAxis yAxis; /** Items pre values. */ int[] pres; /** Item token selected by user. */ byte[] item = EMPTY; /** * Default constructor. * @param ctx database context */ PlotData(final Context ctx) { xAxis = new PlotAxis(this); yAxis = new PlotAxis(this); pres = new int[0]; context = ctx; } /** * Returns a string array with all top items * and the keys of the specified set. * @return key array */ TokenList getItems() { final Data data = context.data(); final TokenList tl = new TokenList(); for(final byte[] k : data.paths.desc(EMPTY, true, true)) { if(getCategories(k).size() > 1) tl.add(k); } return tl; } /** * Returns a string array with suitable categories for the specified item. * @param it top item * @return key array */ TokenList getCategories(final byte[] it) { final Data data = context.data(); final TokenList tl = new TokenList(); for(final byte[] k : data.paths.desc(it, true, false)) { final Names nm = startsWith(k, '@') ? data.atnindex : data.tagindex; if(nm.stat(nm.id(delete(k, '@'))).type != StatsType.NONE) tl.add(k); } return tl; } /** * Called if the user changes the item level displayed in the plot. If a new * item was selected the plot data is recalculated. * @param newItem item selected by the user * @return true if a new item was selected and the plot data has been * recalculated */ boolean setItem(final String newItem) { if(newItem == null) return false; final byte[] b = token(newItem); if(eq(b, item)) return false; item = b; refreshItems(context.current(), true); return true; } /** * Refreshes item list and coordinates if the selection has changed. So far * only numerical data is considered for plotting. * @param nodes nodes to be displayed * @param sub determine descendant nodes of given context nodes */ void refreshItems(final Nodes nodes, final boolean sub) { final Data data = context.data(); final IntList tmpPres = new IntList(); final int itmID = data.tagindex.id(item); if(!sub) { pres = nodes.pres; Arrays.sort(pres); return; } final int[] contextPres = nodes.pres; for(int p : contextPres) { if(p >= data.meta.size) break; final int nl = p + data.size(p, Data.ELEM); while(p < nl) { final int kind = data.kind(p); if(kind == Data.ELEM) { if(data.name(p) == itmID) tmpPres.add(p); p += data.attSize(p, kind); } else { ++p; } } } pres = tmpPres.toArray(); Arrays.sort(pres); } /** * Returns the array position of a given pre value by performing a binary * search on the sorted pre values array currently displayed in the plot. * @param pre pre value to be looked up * @return array index if found, -1 if not */ int findPre(final int pre) { return Arrays.binarySearch(pres, pre); } }basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/plot/PlotView.java000066400000000000000000001102601222453003200263270ustar00rootroot00000000000000package org.basex.gui.view.plot; import static org.basex.core.Text.*; import static org.basex.gui.GUIConstants.*; import static org.basex.util.Token.*; import java.awt.*; import java.awt.event.*; import java.awt.image.*; import java.util.*; import javax.swing.*; import org.basex.data.*; import org.basex.gui.GUIConstants.Fill; import org.basex.gui.*; import org.basex.gui.layout.*; import org.basex.gui.view.*; import org.basex.index.stats.*; import org.basex.util.list.*; /** * A scatter plot visualization of the database. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class PlotView extends View { /** Whitespace between captions. */ static final int CAPTIONWHITESPACE = 10; /** Rotate factor. */ private static final double ROTATE = Math.sin(30); /** Plot margin: top, left, bottom, right margin. */ private static final int[] MARGIN = new int[4]; /** Maximum length of axis caption text. */ private static final int MAXL = 11; /** Position where over-length text is cut off. */ private static final int CUTOFF = 10; /** X axis selector. */ final BaseXCombo xCombo; /** Y axis selector. */ final BaseXCombo yCombo; /** Item selector combo. */ final BaseXCombo itemCombo; /** Dot size in plot view. */ final BaseXSlider dots; /** Data reference. */ PlotData plotData; /** Keeps track of changes in the plot. */ boolean plotChanged; /** Indicates if global marked nodes should be drawn. */ boolean drawSubNodes; /** Indicates if the buffered image for marked nodes has to be redrawn. */ boolean markingChanged; /** Logarithmic display. */ private final BaseXCheckBox xLog; /** Logarithmic display. */ private final BaseXCheckBox yLog; /** Bounding box which supports selection of multiple items. */ private final ViewRect selectionBox; /** Item image. */ private BufferedImage itemImg; /** Marked item image. */ private BufferedImage itemImgMarked; /** Focused item image. */ private BufferedImage itemImgFocused; /** Child node of marked node. */ private BufferedImage itemImgSub; /** Buffered plot image. */ private BufferedImage plotImg; /** Buffered image of marked items. */ private BufferedImage markedImg; /** X coordinate of mouse pointer. */ private int mouseX; /** Y coordinate of mouse pointer. */ private int mouseY; /** Current plot height. */ private int plotHeight; /** Current plot width. */ private int plotWidth; /** Flag for mouse dragging actions. */ private boolean dragging; /** Indicates if a filter operation is self implied or was triggered by * another view. */ private boolean rightClick; /** Context which is displayed in the plot after a context change which was * triggered by the plot itself. */ private Nodes nextContext; /** * Default constructor. * @param man view manager */ public PlotView(final ViewNotifier man) { super(PLOTVIEW, man); border(5).layout(new BorderLayout()); final BaseXBack panel = new BaseXBack(Fill.NONE).layout(new BorderLayout()); Box box = new Box(BoxLayout.X_AXIS); xLog = new BaseXCheckBox(PLOTLOG, false, gui); xLog.setSelected(gui.gprop.is(GUIProp.PLOTXLOG)); xLog.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { gui.gprop.invert(GUIProp.PLOTXLOG); refreshUpdate(); } }); dots = new BaseXSlider(-6, 6, gui.gprop.num(GUIProp.PLOTDOTS), gui, new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { gui.gprop.set(GUIProp.PLOTDOTS, dots.value()); refreshLayout(); } }); BaseXLayout.setWidth(dots, 40); yLog = new BaseXCheckBox(PLOTLOG, false, gui); yLog.setSelected(gui.gprop.is(GUIProp.PLOTYLOG)); yLog.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { gui.gprop.invert(GUIProp.PLOTYLOG); refreshUpdate(); } }); box.add(yLog); box.add(Box.createHorizontalGlue()); box.add(dots); box.add(Box.createHorizontalGlue()); box.add(xLog); panel.add(box, BorderLayout.NORTH); box = new Box(BoxLayout.X_AXIS); xCombo = new BaseXCombo(gui); xCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { setAxis(plotData.xAxis, xCombo); } }); yCombo = new BaseXCombo(gui); yCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { setAxis(plotData.yAxis, yCombo); } }); itemCombo = new BaseXCombo(gui); itemCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final String item = (String) itemCombo.getSelectedItem(); plotData.xAxis.log = gui.gprop.is(GUIProp.PLOTXLOG); plotData.yAxis.log = gui.gprop.is(GUIProp.PLOTYLOG); if(plotData.setItem(item)) { plotChanged = true; markingChanged = true; final String[] keys = plotData.getCategories(token(item)).toStringArray(); xCombo.setModel(new DefaultComboBoxModel(keys)); yCombo.setModel(new DefaultComboBoxModel(keys)); if(keys.length > 0) { // choose name category as default for horizontal axis xCombo.setSelectedIndex(Math.min(1, keys.length)); yCombo.setSelectedIndex(0); } } drawSubNodes = true; markingChanged = true; repaint(); } }); box.add(yCombo); box.add(Box.createHorizontalStrut(3)); box.add(new BaseXLabel("Y")); box.add(Box.createHorizontalGlue()); box.add(itemCombo); box.add(Box.createHorizontalGlue()); box.add(new BaseXLabel("X")); box.add(Box.createHorizontalStrut(3)); box.add(xCombo); panel.add(box, BorderLayout.SOUTH); add(panel, BorderLayout.SOUTH); new BaseXPopup(this, POPUP); selectionBox = new ViewRect(); refreshLayout(); } /** * Changes the axis assignment. * @param ax plot axis * @param cb combo box */ void setAxis(final PlotAxis ax, final BaseXCombo cb) { final String cs = (String) cb.getSelectedItem(); if(!ax.setAxis(cs)) return; plotChanged = true; markingChanged = true; repaint(); // prevent both combo boxes to show the same category final BaseXCombo ocb = cb == xCombo ? yCombo : xCombo; if(cs.equals(ocb.getSelectedItem())) { final int i = ocb.getSelectedIndex(); ocb.setSelectedIndex(i > 0 ? i - 1 : i + 1); } } /** * Creates a buffered image for items. * @param focus create image of focused item if true * @param marked create image of marked item * @param markedSub child node of marked node * @return item image */ private BufferedImage itemImage(final boolean focus, final boolean marked, final boolean markedSub) { final int size = Math.max(1, fontSize + gui.gprop.num(GUIProp.PLOTDOTS) - (focus ? 2 : marked || markedSub ? 4 : 6)); final BufferedImage img = new BufferedImage(size, size, Transparency.TRANSLUCENT); final Graphics g = img.getGraphics(); smooth(g); Color c = color1A; if(marked) c = colormark1A; if(markedSub) c = colormark2A; if(focus) c = color4; g.setColor(c); g.fillOval(0, 0, size, size); return img; } /** * Precalculates the plot and returns the result as buffered image. */ private void createPlotImage() { plotImg = new BufferedImage(getWidth(), getHeight(), Transparency.BITMASK); final Graphics g = plotImg.getGraphics(); smooth(g); // draw axis and grid drawAxis(g, true); drawAxis(g, false); // draw items g.setColor(color4); for(int i = 0; i < plotData.pres.length; ++i) { drawItem(g, plotData.xAxis.co[i], plotData.yAxis.co[i], false, false, false); } } @Override public void paintComponent(final Graphics g) { super.paintComponent(g); if(plotData == null) { refreshInit(); return; } final int w = getWidth(); final int h = getHeight(); plotWidth = w - (MARGIN[1] + MARGIN[3]); plotHeight = h - (MARGIN[0] + MARGIN[2]); final int sz = sizeFactor(); g.setFont(font); g.setColor(Color.black); final Data data = gui.context.data(); final boolean nd = data == null; if(nd || plotWidth - sz < 0 || plotHeight - sz < 0) { BaseXLayout.drawCenter(g, nd ? NO_DATA : NO_PIXELS, w, h / 2 - MARGIN[0]); return; } // draw buffered plot image if(plotImg == null || plotChanged) createPlotImage(); g.drawImage(plotImg, 0, 0, this); // draw buffered image of marked items if(markingChanged || markedImg == null) createMarkedNodes(); g.drawImage(markedImg, 0, 0, this); if(plotData.pres.length < 1) return; gui.painting = true; /* * Possibly, the focused node is not shown in this view (if it was focused * in another view). In this case, the ancestor with the smallest distance * to the focused node is selected. */ int focused = gui.context.focused; if(focused != -1) { final int itmID = data.tagindex.id(plotData.item); int k = data.kind(focused); int name = data.name(focused); while(focused > 0 && itmID != name) { focused = data.parent(focused, k); if(focused > -1) { k = data.kind(focused); name = data.name(focused); } } } // draw focused item final int f = plotData.findPre(focused); if(f > -1) { // determine number of overlapping nodes (plotting second) final int ol = overlappingNodes(f).length; if(!dragging) { final double x1 = plotData.xAxis.co[f]; final double y1 = plotData.yAxis.co[f]; drawItem(g, x1, y1, true, false, false); // draw focused x and y value g.setFont(font); final int textH = g.getFontMetrics().getHeight(); final String x = formatString(true, focused); final String y = formatString(false, focused); String label = x.length() > 16 ? x.substring(0, 14) + ".." : x; if(!x.isEmpty() && !y.isEmpty()) label += " | "; label += y.length() > 16 ? y.substring(0, 14) + ".." : y; final int xa = calcCoordinate(true, x1) + 15; int ya = calcCoordinate(false, y1) + gui.gprop.num(GUIProp.PLOTDOTS); final int ww = getWidth(); final int id = ViewData.nameID(data); final byte[] nm = data.attValue(id, focused); String name = nm != null ? string(nm) : ""; if(!name.isEmpty() && plotData.xAxis.attrID != id && plotData.yAxis.attrID != id) { if(ol > 1) name = ol + "x: " + name + ", ..."; final int lw = BaseXLayout.width(g, label); if(ya < MARGIN[0] + textH && xa < w - lw) { ya += 2 * textH - gui.gprop.num(GUIProp.PLOTDOTS); } if(xa > w - lw) BaseXLayout.drawTooltip(g, name + COLS + label, xa, ya, ww, 10); else { BaseXLayout.drawTooltip(g, name, xa, ya - textH, ww, 10); BaseXLayout.drawTooltip(g, label, xa, ya, ww, 10); } } else { if(ol > 1) label = label.isEmpty() ? ol + "x" : ol + "x: " + label + ", ..."; BaseXLayout.drawTooltip(g, label, xa, ya, ww, 10); } } } // draw selection box if(dragging) { g.setColor(color2A); final int selW = selectionBox.w; final int selH = selectionBox.h; final int x1 = selectionBox.x; final int y1 = selectionBox.y; g.fillRect(selW > 0 ? x1 : x1 + selW, selH > 0 ? y1 : y1 + selH, Math.abs(selW), Math.abs(selH)); g.setColor(color3A); g.drawRect(selW > 0 ? x1 : x1 + selW, selH > 0 ? y1 : y1 + selH, Math.abs(selW), Math.abs(selH)); } markingChanged = false; plotChanged = false; gui.painting = false; } /** * Draws marked nodes. */ private void createMarkedNodes() { final Data data = gui.context.data(); markedImg = new BufferedImage(getWidth(), getHeight(), Transparency.BITMASK); final Graphics gi = markedImg.getGraphics(); smooth(gi); final Nodes marked = gui.context.marked; if(marked.size() == 0) return; final int[] m = Arrays.copyOf(marked.pres, marked.pres.length); int i = 0; // no child nodes of the marked context nodes are marked if(!drawSubNodes) { while(i < m.length) { final int pi = plotData.findPre(m[i]); if(pi > -1) drawItem(gi, plotData.xAxis.co[pi], plotData.yAxis.co[pi], false, true, false); ++i; } return; } // if nodes are marked in another view, the given nodes as well as their // descendants are checked for intersection with the nodes displayed in // the plot Arrays.sort(m); final int[] p = plotData.pres; int k = plotData.findPre(m[0]); if(k > -1) { drawItem(gi, plotData.xAxis.co[k], plotData.yAxis.co[k], false, true, false); ++k; } else { k = -k; --k; } // context change (triggered by another view). // descendants of marked node set are also checked for intersection // with currently plotted nodes while(i < m.length && k < p.length) { final int a = m[i]; final int b = p[k]; final int ns = data.size(a, data.kind(a)) - 1; if(a == b) { drawItem(gi, plotData.xAxis.co[k], plotData.yAxis.co[k], false, true, false); ++k; } else if(a + ns >= b) { if(a < b) drawItem(gi, plotData.xAxis.co[k], plotData.yAxis.co[k], false, false, true); ++k; } else { ++i; } } } /** * Draws a plot item at the given position. If the item to be drawn is * focused the focused item buffered image is used. * @param g graphics reference * @param x x coordinate * @param y y coordinate * @param focus a focused item is drawn * @param marked item is marked * @param sub item is a child of a marked node */ private void drawItem(final Graphics g, final double x, final double y, final boolean focus, final boolean marked, final boolean sub) { final int x1 = calcCoordinate(true, x); final int y1 = calcCoordinate(false, y); final BufferedImage img = focus ? itemImgFocused : marked ? itemImgMarked : sub ? itemImgSub : itemImg; final int size = img.getWidth() / 2; g.drawImage(img, x1 - size, y1 - size, this); } /** * Draws the x axis of the plot. * @param g graphics reference * @param drawX drawn axis is x axis */ private void drawAxis(final Graphics g, final boolean drawX) { g.setColor(color2A); final int sz = sizeFactor(); // the painting space provided for items which lack no value final int pWidth = plotWidth - sz; final int pHeight = plotHeight - sz; final PlotAxis axis = drawX ? plotData.xAxis : plotData.yAxis; // drawing horizontal axis line if(drawX) { if(plotChanged) { if(plotData.pres.length > 0) axis.calcCaption(pWidth); final StatsType type = plotData.xAxis.type; xLog.setEnabled((type == StatsType.DOUBLE || type == StatsType.INTEGER) && Math.abs(axis.min - axis.max) >= 1); } } else { // drawing vertical axis line if(plotChanged) { if(plotData.pres.length > 0) axis.calcCaption(pHeight); final StatsType type = plotData.yAxis.type; yLog.setEnabled((type == StatsType.DOUBLE || type == StatsType.INTEGER) && Math.abs(axis.min - axis.max) >= 1); } } if(plotData.pres.length < 1) { drawCaptionAndGrid(g, drawX, "", 0); drawCaptionAndGrid(g, drawX, "", 1); return; } // getting some axis specific data final StatsType type = axis.type; final int nrCaptions = axis.nrCaptions; final double step = axis.actlCaptionStep; final double capRange = 1.0d / (nrCaptions - 1); g.setFont(font); // draw axis and assignment for TEXT data if(type == StatsType.TEXT) { final int nrCats = axis.nrCats; final double[] coSorted = Arrays.copyOf(axis.co, axis.co.length); // draw min / max caption drawCaptionAndGrid(g, drawX, nrCats > 1 ? string(axis.firstCat) : "", 0); drawCaptionAndGrid(g, drawX, nrCats > 1 ? string(axis.lastCat) : "", 1); // return if insufficient plot space if(nrCaptions == 0) return; // get sorted axis item coordinates Arrays.sort(coSorted); // optimum caption position double op = capRange; final int cl = coSorted.length; int i = 0; // find first non .0d coordinate value while(i < cl && coSorted[i] == 0) ++i; // find nearest position for next axis caption while(i < cl && op < 1.0d - 0.4d * capRange) { if(coSorted[i] > op) { final double distL = Math.abs(coSorted[i - 1] - op); final double distG = Math.abs(coSorted[i] - op); op = distL < distG ? coSorted[i - 1] : coSorted[i]; int j = 0; // find value for given plot position while(j < axis.co.length && axis.co[j] != op) ++j; drawCaptionAndGrid(g, drawX, string(axis.getValue(plotData.pres[j])), op); // increase to next optimum caption position op += capRange; } ++i; } if(nrCats == 1) { op = .5d; int j = 0; // find value for given plot position while(j < axis.co.length && axis.co[j] != op) ++j; drawCaptionAndGrid(g, drawX, string(axis.getValue(plotData.pres[j])), op); } // axis is drawn for numerical data, type INT/DBL } else { final boolean noRange = axis.max - axis.min == 0; // draw min and max grid line drawIntermediateGridLine(g, drawX, 0, null); drawIntermediateGridLine(g, drawX, 1, null); // return if insufficient plot space if(nrCaptions == 0) return; // if min equal max, draw min in plot middle if(noRange) { drawCaptionAndGrid(g, drawX, BaseXLayout.value(axis.min), .5d); return; } int c = 0; // draw LOGARITHMIC SCALE if(axis.log) { int l; double a; double b; // draw labels for negative values if(axis.min < 0) { l = 0; a = -1; while(a >= axis.min) { if(a <= axis.max && adequateDistance(drawX, a, 0)) { drawCaptionAndGrid(g, drawX, BaseXLayout.value(a), axis.calcPosition(a)); } final int lim = (int) (-1 * Math.pow(10, l + 1)); double last = a; b = 2 * a; while(b > lim && b >= axis.min) { if(adequateDistance(drawX, last, b) && adequateDistance(drawX, lim, b) && b < axis.max) { drawIntermediateGridLine(g, drawX, axis.calcPosition(b), BaseXLayout.value(b)); last = b; } b += a; } ++l; a = -1 * Math.pow(10, l); } } // draw 0 label if necessary if(0 >= axis.min && 0 <= axis.max) drawCaptionAndGrid(g, drawX, BaseXLayout.value(0), axis.calcPosition(0)); // draw labels > 0 if(axis.max > 0) { l = 0; a = 1; while(a <= axis.max) { if(a >= axis.min && adequateDistance(drawX, a, 0)) { drawCaptionAndGrid(g, drawX, BaseXLayout.value(a), axis.calcPosition(a)); } final int lim = (int) Math.pow(10, l + 1); double last = a; b = 2 * a; while(b < lim && b <= axis.max) { if(adequateDistance(drawX, last, b) && adequateDistance(drawX, lim, b) && b > axis.min) { drawIntermediateGridLine(g, drawX, axis.calcPosition(b), BaseXLayout.value(b)); last = b; } b += a; } ++l; a = Math.pow(10, l); } } // draw LINEAR SCALE } else { // draw captions between min and max double d = axis.calcPosition(axis.startvalue); double f = axis.startvalue; while(d < 1.0d - .25d / nrCaptions) { ++c; drawCaptionAndGrid(g, drawX, BaseXLayout.value(f), d); f += step; d = axis.calcPosition(f); } // draw min/max labels if little space available if(c < 2) { drawCaptionAndGrid(g, drawX, BaseXLayout.value(axis.min), 0.0); drawCaptionAndGrid(g, drawX, BaseXLayout.value(axis.max), 1.0); } } } } /** * Determines if two points on the axis have an adequate distance. * @param drawX drawX * @param a first point * @param b second point * @return a and b have adequate distance */ private boolean adequateDistance(final boolean drawX, final double a, final double b) { final double t = drawX ? 1.8d : 1.3d; final PlotAxis axis = drawX ? plotData.xAxis : plotData.yAxis; return Math.abs(calcCoordinate(drawX, axis.calcPosition(a)) - calcCoordinate(drawX, axis.calcPosition(b))) >= sizeFactor() / t; } /** * Draws an axis caption to the specified position. * @param g graphics reference * @param drawX draw caption on x axis * @param caption given caption string * @param d relative position in plot view depending on axis */ private void drawCaptionAndGrid(final Graphics g, final boolean drawX, final String caption, final double d) { String cap = caption; // if label is too long, it is is chopped to the first characters if(cap.length() > MAXL) cap = cap.substring(0, CUTOFF) + ".."; final int pos = calcCoordinate(drawX, d); final int h = getHeight(); final int w = getWidth(); final int textH = g.getFontMetrics().getHeight(); final int fs = fontSize; final int imgW = BaseXLayout.width(g, cap) + fs; final BufferedImage img = createCaptionImage(g, cap, false, imgW); // ... after that // the image and the grid line are drawn beside x / y axis g.setColor(color2A); if(drawX) { final int y = h - MARGIN[2]; g.drawImage(img, pos - imgW + textH - fs + 3, y, this); g.drawLine(pos, MARGIN[0], pos, y + fs / 2); g.drawLine(pos - 1, MARGIN[0], pos - 1, y + fs / 2); } else { g.drawImage(img, MARGIN[1] - imgW - fs / 2, pos - fs, this); g.drawLine(MARGIN[1] - fs / 2, pos, w - MARGIN[3], pos); g.drawLine(MARGIN[1] - fs / 2, pos + 1, w - MARGIN[3], pos + 1); } } /** * Creates a buffered image for a given string which serves as axis caption. * @param g Graphics reference * @param caption caption string * @param im intermediate caption (lighter color) * @param imgW image width * @return buffered image */ private BufferedImage createCaptionImage(final Graphics g, final String caption, final boolean im, final int imgW) { final int textH = g.getFontMetrics().getHeight(); final int fs = fontSize; // caption labels are rotated, for both x and y axis. first a buffered // image is created which displays the rotated label ... final int imgH = 160; final BufferedImage img = new BufferedImage(imgW, imgH, Transparency.BITMASK); final Graphics2D g2d = img.createGraphics(); smooth(g2d); g2d.rotate(ROTATE, imgW, textH); g2d.setFont(font); g2d.setColor(im ? color3 : Color.black); g2d.drawString(caption, fs, fs); return img; } /** * Draws intermediate grid lines without caption. * @param g Graphics reference * @param drawX draw line for x axis * @param d relative position of grid line * @param caption caption to draw. if cap = null, no caption is drawn */ private void drawIntermediateGridLine(final Graphics g, final boolean drawX, final double d, final String caption) { String cap = caption; final int pos = calcCoordinate(drawX, d); final int h = getHeight(); final int w = getWidth(); final int fs = fontSize; final int sf = sizeFactor(); g.setColor(color2A); if(cap != null) { if(cap.length() > MAXL) cap = cap.substring(0, CUTOFF) + ".."; final int textH = g.getFontMetrics().getHeight(); final int imgW = BaseXLayout.width(g, cap) + fs; final BufferedImage img = createCaptionImage(g, cap, true, imgW); final int y = h - MARGIN[2]; if(drawX) { g.drawImage(img, pos - imgW + textH - fs + 3, y - textH / 3, this); g.drawLine(pos, MARGIN[0], pos, h - MARGIN[2]); } else { g.drawImage(img, MARGIN[1] - imgW - fs / 2, pos - fs, this); g.drawLine(MARGIN[1], pos, w - MARGIN[3], pos); } } else { if(drawX) { g.drawLine(pos, MARGIN[0], pos, h - MARGIN[2] - sf); } else { g.drawLine(MARGIN[1] + sf, pos, w - MARGIN[3], pos); } } } /** * Returns a coordinate for a specific double value of an item. * @param d relative coordinate of specific item * @param drawX calculated value is x value * @return absolute coordinate */ private int calcCoordinate(final boolean drawX, final double d) { final int sz = sizeFactor(); if(drawX) { // items with value -1 lack a value for the specific attribute if(d == -1) return (int) (MARGIN[1] + sz * .35d); final int width = getWidth(); final int xSpace = width - (MARGIN[1] + MARGIN[3]) - sz; return (int) (d * xSpace) + MARGIN[1] + sz; } final int height = getHeight(); if(d == -1) return height - MARGIN[2] - sz / 4; final int ySpace = height - (MARGIN[0] + MARGIN[2]) - sz; return ySpace - (int) (d * ySpace) + MARGIN[0]; } @Override public void refreshContext(final boolean more, final boolean quick) { // all plot data is recalculated, assignments stay the same plotData.refreshItems(nextContext != null && more && rightClick ? nextContext : gui.context.current(), !more || !rightClick); plotData.xAxis.log = gui.gprop.is(GUIProp.PLOTXLOG); plotData.xAxis.refreshAxis(); plotData.yAxis.log = gui.gprop.is(GUIProp.PLOTYLOG); plotData.yAxis.refreshAxis(); nextContext = null; drawSubNodes = !rightClick; rightClick = false; plotChanged = true; markingChanged = true; repaint(); } @Override public void refreshFocus() { repaint(); } @Override public void refreshInit() { plotData = null; final Data data = gui.context.data(); if(data == null || !visible()) return; plotData = new PlotData(gui.context); final String[] items = plotData.getItems().toStringArray(); itemCombo.setModel(new DefaultComboBoxModel(items)); // set first item and trigger assignment of axis assignments if(items.length > 0) itemCombo.setSelectedIndex(0); drawSubNodes = true; markingChanged = true; plotChanged = true; repaint(); } @Override public void refreshLayout() { itemImg = itemImage(false, false, false); itemImgMarked = itemImage(false, true, false); itemImgFocused = itemImage(true, false, false); itemImgSub = itemImage(false, false, true); final int sz = sizeFactor() / 2; MARGIN[0] = sz + 7; MARGIN[1] = sz * 6; MARGIN[2] = 55 + sz * 7; MARGIN[3] = sz + 3; plotChanged = true; markingChanged = true; if(plotData == null) return; repaint(); } @Override public void refreshMark() { drawSubNodes = true; markingChanged = true; repaint(); } @Override public void refreshUpdate() { refreshContext(false, true); } @Override public boolean visible() { return gui.gprop.is(GUIProp.SHOWPLOT); } @Override public void visible(final boolean v) { gui.gprop.set(GUIProp.SHOWPLOT, v); } @Override protected boolean db() { return true; } /** * Locates the nearest item to the mouse pointer. * @return item focused */ private boolean focus() { final int size = itemImg.getWidth() / 2; int focusedPre = gui.context.focused; // if mouse pointer is outside of the plot the focused item is set to -1, // focus may be refreshed, if necessary if(mouseX < MARGIN[1] || mouseX > getWidth() - MARGIN[3] + size || mouseY < MARGIN[0] - size || mouseY > getHeight() - MARGIN[2]) { // focused item already -1, no refresh needed if(focusedPre == -1) { return false; } gui.notify.focus(-1, this); return true; } // find focused item. focusedPre = -1; int dist = Integer.MAX_VALUE; // all displayed items are tested for focus for(int i = 0; i < plotData.pres.length && dist != 0; ++i) { // coordinates and distances for current tested item are calculated final int x = calcCoordinate(true, plotData.xAxis.co[i]); final int y = calcCoordinate(false, plotData.yAxis.co[i]); final int distX = Math.abs(mouseX - x); final int distY = Math.abs(mouseY - y); final int sz = sizeFactor() / 4; // if x and y distances are smaller than offset value and the // x and y distances combined is smaller than the actual minimal // distance of any item tested so far, the current item is considered // as a focus candidate if(distX < sz && distY < sz) { final int currDist = distX * distY; if(currDist < dist) { dist = currDist; focusedPre = plotData.pres[i]; } } } // if the focus changed, views are refreshed if(focusedPre != gui.context.focused) { gui.notify.focus(focusedPre, this); return true; } return false; } /** * Determines all nodes lying under the mouse cursor (or the currently * focused node). * @param pre position of pre value in the sorted array of plotted nodes * @return nodes */ private int[] overlappingNodes(final int pre) { final IntList il = new IntList(); // get coordinates for focused item final int mx = calcCoordinate(true, plotData.xAxis.co[pre]); final int my = calcCoordinate(false, plotData.yAxis.co[pre]); for(int i = 0; i < plotData.pres.length; ++i) { // get coordinates for current item final int x = calcCoordinate(true, plotData.xAxis.co[i]); final int y = calcCoordinate(false, plotData.yAxis.co[i]); if(mx == x && my == y) { il.add(plotData.pres[i]); } } return il.toArray(); } /** * Returns a standardized size factor for painting the plot. * @return size value */ private int sizeFactor() { return Math.max(2, fontSize << 1); } /** * Formats an axis caption. * @param drawX x/y axis flag * @param focused pre value of the focused node * @return formatted string */ private String formatString(final boolean drawX, final int focused) { final PlotAxis axis = drawX ? plotData.xAxis : plotData.yAxis; final byte[] val = axis.getValue(focused); if(val.length == 0) return ""; return axis.type == StatsType.TEXT || axis.type == StatsType.CATEGORY ? string(val) : BaseXLayout.value(toDouble(val)); } @Override public void mouseMoved(final MouseEvent e) { if(gui.updating || gui.painting) return; mouseX = e.getX(); mouseY = e.getY(); if(focus()) repaint(); } @Override public void mouseDragged(final MouseEvent e) { if(gui.updating || e.isShiftDown()) return; if(dragging) { // to avoid significant offset between coordinates of mouse click and the // start coordinates of the bounding box, mouseX and mouseY are determined // by mousePressed() mouseX = e.getX(); mouseY = e.getY(); } final int h = getHeight(); final int w = getWidth(); final int th = 14; final int lb = MARGIN[1] - th; final int rb = w - MARGIN[3] + th; final int tb = MARGIN[0] - th; final int bb = h - MARGIN[2] + th; // flag which indicates if mouse pointer is located on the plot inside final boolean inBox = mouseY > tb && mouseY < bb && mouseX > lb && mouseX < rb; if(!dragging && !inBox) return; // first time method is called when mouse dragged if(!dragging) { dragging = true; selectionBox.x = mouseX; selectionBox.y = mouseY; } // keeps selection box on the plot inside. if mouse pointer is outside box // the corners of the selection box are set to the predefined values s.a. int x = mouseX; int y = mouseY; if(!inBox) { if(mouseX < lb) { if(mouseY > bb) { x = lb; y = bb; } else if(mouseY < tb) { x = lb; y = tb; } else { x = lb; } } else if(mouseX > rb) { if(mouseY > bb) { x = rb; y = bb; } else if(mouseY < tb) { x = rb; y = tb; } else { x = rb; } } else if(mouseY < tb) { y = tb; } else { y = bb; } } selectionBox.w = x - selectionBox.x; selectionBox.h = y - selectionBox.y; // searches for items located in the selection box final IntList il = new IntList(); for(int i = 0; i < plotData.pres.length; ++i) { x = calcCoordinate(true, plotData.xAxis.co[i]); y = calcCoordinate(false, plotData.yAxis.co[i]); if(selectionBox.contains(x, y)) il.add(plotData.pres[i]); } gui.notify.mark(new Nodes(il.toArray(), gui.context.data()), this); nextContext = gui.context.marked; drawSubNodes = false; markingChanged = true; repaint(); } @Override public void mouseReleased(final MouseEvent e) { if(gui.updating || gui.painting) return; dragging = false; repaint(); } @Override public void mousePressed(final MouseEvent e) { if(gui.updating || gui.painting) return; markingChanged = true; mouseX = e.getX(); mouseY = e.getY(); focus(); // determine if a following context filter operation is possibly triggered // by popup menu final boolean r = !SwingUtilities.isLeftMouseButton(e); if(r) { rightClick = true; return; } // no item is focused. no nodes marked after mouse click if(gui.context.focused == -1) { gui.notify.mark(new Nodes(gui.context.data()), this); return; } // node marking if item focused. if more than one icon is in focus range // all of these are marked. focus range means exact same x AND y coordinate. final int pre = plotData.findPre(gui.context.focused); final int[] il = overlappingNodes(pre); // right mouse or shift down if(e.isShiftDown()) { final Nodes marked = gui.context.marked; marked.union(il); gui.notify.mark(marked, this); // double click } else if(e.getClickCount() == 2) { // context change also self implied, thus right click set to true rightClick = true; final Nodes marked = new Nodes(gui.context.data()); marked.union(il); gui.notify.context(marked, false, null); // simple mouse click } else { final Nodes marked = new Nodes(il, gui.context.data()); gui.notify.mark(marked, this); } nextContext = gui.context.marked; } @Override public void componentResized(final ComponentEvent e) { markingChanged = true; plotChanged = true; if(!gui.updating) repaint(); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/plot/package.html000066400000000000000000000000371222453003200261740ustar00rootroot00000000000000 GUI Plot View. basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/table/000077500000000000000000000000001222453003200240245ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/table/TableContent.java000066400000000000000000000117651222453003200272630ustar00rootroot00000000000000package org.basex.gui.view.table; import static org.basex.core.Text.*; import static org.basex.util.Token.*; import java.awt.*; import org.basex.core.*; import org.basex.data.*; import org.basex.gui.*; import org.basex.gui.GUIConstants.Fill; import org.basex.gui.layout.*; import org.basex.util.*; /** * This is the content area of the table view. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class TableContent extends BaseXBack { /** Scrollbar reference. */ private final BaseXBar scroll; /** View reference. */ private final TableData tdata; /** GUI reference. */ private final GUI gui; /** Currently focused string. */ String focusedString; /** * Default constructor. * @param d table data * @param scr scrollbar reference */ TableContent(final TableData d, final BaseXBar scr) { scroll = scr; tdata = d; gui = scr.gui; layout(new BorderLayout()); mode(gui.gprop.is(GUIProp.GRADIENT) ? Fill.GRADIENT : Fill.NONE); add(scroll, BorderLayout.EAST); } @Override public void paintComponent(final Graphics g) { super.paintComponent(g); // skip if view is unavailable if(tdata.rows == null) return; gui.painting = true; g.setFont(GUIConstants.font); final int w = getWidth() - scroll.getWidth(); final int h = getHeight(); final int fsz = GUIConstants.fontSize; final Context context = tdata.context; final Data data = context.data(); final int focus = gui.context.focused; final int rfocus = tdata.getRoot(data, focus); int mpos = 0; final int nCols = tdata.cols.length; final int nRows = tdata.rows.size(); final int rowH = tdata.rowH; final TableIterator ti = new TableIterator(data, tdata); final TokenBuilder[] tb = new TokenBuilder[nCols]; for(int i = 0; i < nCols; ++i) tb[i] = new TokenBuilder(); focusedString = null; final Nodes marked = context.marked; int l = scroll.pos() / rowH - 1; int posY = -scroll.pos() + l * rowH; while(++l < nRows && marked != null) { // skip when all visible rows have been painted or if data has changed if(posY > h || l >= tdata.rows.size()) break; posY += rowH; final int pre = tdata.rows.get(l); while(mpos < marked.size() && marked.pres[mpos] < pre) ++mpos; // draw line g.setColor(GUIConstants.color2); g.drawLine(0, posY + rowH - 1, w, posY + rowH - 1); g.setColor(Color.white); g.drawLine(0, posY + rowH, w, posY + rowH); // verify if current node is marked or focused final boolean rm = mpos < marked.size() && marked.pres[mpos] == pre; final boolean rf = pre == rfocus; final int col = rm ? rf ? 5 : 4 : 3; if(rm || rf) { g.setColor(GUIConstants.color(col)); g.fillRect(0, posY - 1, w, rowH); g.setColor(GUIConstants.color(col + 4)); g.drawLine(0, posY - 1, w, posY - 1); } g.setColor(Color.black); // skip drawing of text during animation if(rowH < fsz) continue; // find all row contents ti.init(pre); int fcol = -1; while(ti.more()) { final int c = ti.col; if(ti.pre == focus || data.parent(ti.pre, data.kind(ti.pre)) == focus) fcol = c; // add content to column (skip too long contents)... if(tb[c].size() < 100) { if(!tb[c].isEmpty()) tb[c].add("; "); tb[c].add(data.text(ti.pre, ti.text)); } } // add dots if content is too long for(final TokenBuilder t : tb) if(t.size() > 100) t.add(DOTS); // draw row contents byte[] focusStr = null; int fx = -1; double x = 1; for(int c = 0; c < nCols; ++c) { // draw single column final double cw = w * tdata.cols[c].width; final double ce = x + cw; if(ce != 0) { final byte[] str = tb[c].isEmpty() ? null : tb[c].finish(); if(str != null) { if(tdata.mouseX > x && tdata.mouseX < ce || fcol == c) { fx = (int) x; focusStr = str; } BaseXLayout.chopString(g, str, (int) x + 1, posY + 2, (int) cw - 4, fsz); tb[c].reset(); } } x = ce; } // highlight focused entry if((rf || fcol != -1) && focusStr != null) { final int sw = BaseXLayout.width(g, focusStr) + 8; if(fx > w - sw - 2) fx = w - sw - 2; g.setColor(GUIConstants.color(col + 2)); g.fillRect(fx - 2, posY, sw, rowH - 1); g.setColor(Color.black); BaseXLayout.chopString(g, focusStr, fx + 1, posY + 2, sw, fsz); // cache focused string focusedString = string(focusStr); final int i = focusedString.indexOf("; "); if(i != -1) focusedString = focusedString.substring(0, i); } } gui.painting = false; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/table/TableData.java000066400000000000000000000223661222453003200265210ustar00rootroot00000000000000package org.basex.gui.view.table; import static org.basex.util.Token.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.gui.*; import org.basex.index.name.*; import org.basex.index.stats.*; import org.basex.util.*; import org.basex.util.list.*; /** * This is a container for the table data. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class TableData { /** Number of rows which is parsed for a new document. */ private static final int MAXROWS = 1000; /** Maximum token for sorting data. */ private static final byte[] MAXTOK = { -1 }; /** Maximum number for sorting data. */ private static final byte[] MAXNUM = token(Double.MAX_VALUE); /** Database context. */ final Context context; /** Root nodes. */ TokenList roots; /** Rows of the main table. */ IntList rootRows; /** Pre values of the rows. */ IntList rows; /** Columns. */ TableCol[] cols; /** Row height. */ int rowH; /** Currently sorted column. */ int sortCol = -1; /** Sort order (ascending/descending). */ boolean asc; /** Mouse X position. */ int mouseX; /** Mouse Y position. */ int mouseY; /** ID of the table root tag. */ int root; /** Window properties. */ private final GUIProp gprop; /** Last query. */ private String last = ""; /** Table Column. */ static final class TableCol { /** Tag/Attribute flag. */ byte[] name; /** Column IDs. */ int id; /** Tag/Attribute flags. */ boolean elem; /** Column width. */ double width; /** Hidden Column width. */ double hwidth; /** Column filter. */ String filter = ""; } /** * Initializes the table data. * @param ctx database context * @param pr gui properties */ TableData(final Context ctx, final GUIProp pr) { context = ctx; gprop = pr; } /** * Initializes the table data. * @param data data reference */ void init(final Data data) { roots = new TokenList(); // sort keys by occurrence for(final byte[] k : data.paths.desc(EMPTY, true, true)) { int c = 0; for(final byte[] kk : data.paths.desc(k, true, false)) { final Names nm = startsWith(kk, '@') ? data.atnindex : data.tagindex; if(nm.stat(nm.id(delete(kk, '@'))).isLeaf()) ++c; } // add keys with a minimum of three columns if(c > 2) roots.add(k); } init(data, -1); } /** * Initializes the table data. * @param r optional root node (ignored if -1) * @param data data reference */ void init(final Data data, final int r) { cols = new TableCol[0]; root = r; sortCol = -1; last = ""; rowH = 1; if(r == -1 && roots.isEmpty()) return; if(root == -1) root = data.tagindex.id(roots.get(0)); for(final byte[] k : data.paths.desc(data.tagindex.key(root), true, true)) { final boolean elem = !startsWith(k, '@'); final byte[] key = delete(k, '@'); final Names index = elem ? data.tagindex : data.atnindex; if(index.stat(index.id(key)).isLeaf()) addCol(key, elem); } context(true); } /** * Initializes the table data. * @param create flag for creating new rows */ void context(final boolean create) { if(cols.length == 0) return; final boolean rt = context.root(); if(!create && rt && rootRows != null) { rows = rootRows; sortCol = -1; } else { createRows(); if(rt) rootRows = rows; } if(cols[0].width == 0 && cols[0].hwidth == 0) calcWidths(); } /** * Adds the specified tag or attribute as column if it exists in the data. * @param name tag/attribute to be added * @param elem element flag */ private void addCol(final byte[] name, final boolean elem) { final Data data = context.data(); final int id = (elem ? data.tagindex : data.atnindex).id(name); if(id == 0) return; final TableCol col = new TableCol(); col.id = id; col.elem = elem; col.name = name; cols = Array.add(cols, col); } /** * Creates the row list for the specified nodes. */ private void createRows() { final Data data = context.data(); rows = new IntList(); for(int p : context.current().pres) { if(p >= data.meta.size) break; final int s = p + data.size(p, data.kind(p)); // find first root tag do { if(data.kind(p) == Data.ELEM && data.name(p) == root) break; } while(++p < s); // parse whole document and collect root tags while(p < s) { final int k = data.kind(p); if(k == Data.ELEM && data.name(p) == root) rows.add(p); p += data.attSize(p, k); } } sort(); } /** * Calculates the column widths, based on the contents. */ private void calcWidths() { if(cols.length == 0) return; final Data data = context.data(); final int cs = cols.length; // scan first MAXROWS root tags final int nRows = rows.size(); final TableIterator ti = new TableIterator(data, this); final int ll = Math.min(nRows, MAXROWS); for(int l = 0; l < ll; ++l) { // find all row contents and add string lengths ti.init(rows.get(l)); while(ti.more()) cols[ti.col].width += data.textLen(ti.pre, ti.text); } // sort columns by string lengths final double[] widths = new double[cs]; for(int c = 0; c < cs; ++c) widths[c] = cols[c].width; final int[] il = Array.createOrder(widths, false); final TableCol[] cl = new TableCol[cs]; for(int c = 0; c < cs; ++c) cl[c] = cols[il[c]]; cols = cl; setWidths(false); } /** * Sets the column widths, based on the contents. * @param force force zero widths */ void setWidths(final boolean force) { // calculate width of each column double sum = 0; for(final TableCol col : cols) sum += col.width; // avoid too small columns final double min = force ? 0.0 : 0.5; final int cs = cols.length; for(final TableCol col : cols) col.width = Math.max(min / cs, col.width / sum); // recalculate column widths sum = 0; for(final TableCol col : cols) sum += col.width; // normalize widths for(final TableCol col : cols) col.width /= sum; } /** * Sorts column entries. */ void sort() { if(sortCol == -1) return; final int c = cols[sortCol].id; final boolean e = cols[sortCol].elem; final Data data = context.data(); final Names index = e ? data.tagindex : data.atnindex; final StatsType type = index.stat(c).type; final boolean num = type == StatsType.INTEGER || type == StatsType.DOUBLE; final byte[][] tokens = new byte[rows.size()][]; final int rs = rows.size(); for(int r = 0; r < rs; ++r) { int p = rows.get(r); final int s = p + data.size(p, data.kind(p)); while(p != s) { final int k = data.kind(p); if((e && k == Data.ELEM || !e && k == Data.ATTR) && data.name(p) == c) { tokens[r] = data.atom(p); break; } p += e ? data.attSize(p, k) : 1; } if(tokens[r] == null || tokens[r].length == 0) { tokens[r] = num ? MAXNUM : MAXTOK; } } rows.sort(tokens, num, asc); } /** * Returns possible root tag. * @param data data reference * @param pre pre value to start with * @return root */ int getRoot(final Data data, final int pre) { if(pre == -1) return -1; int p = pre; int k = data.kind(p); while(p != -1 && (k != Data.ELEM || data.name(p) != root)) { p = data.parent(p, k); k = p != -1 ? data.kind(p) : 0; } return p; } /** * Returns the column at the specified horizontal position. * @param w panel width * @param mx mouse position * @return column */ int column(final int w, final int mx) { double cs = 0; for(int i = 0; i < cols.length; ++i) { final double cw = w * cols[i].width; final double ce = cs + cw; if(mx > cs && mx < ce) return i; cs = ce; } return -1; } /** * Resets the filter entries. */ void resetFilter() { for(final TableCol col : cols) col.filter = ""; } /** * Builds and returns an XQuery for the filtered terms. * @return query */ String find() { final Data data = context.data(); final boolean r = rows == rootRows; final StringList filters = new StringList(); final TokenList names = new TokenList(); final BoolList elems = new BoolList(); for(final TableCol col : cols) { filters.add(col.filter); names.add(col.name); elems.add(col.elem); } final String query = Find.findTable(filters, names, elems, data.tagindex.key(root), gprop.is(GUIProp.FILTERRT) || r); if(query.equals(last)) return null; last = query; return query; } /** * Sets and returns the row height for the given factor. * @param f factor (1 = maximum/default) * @return row height */ int rowH(final double f) { rowH = Math.max(1, (int) (f * GUIConstants.fontSize * 7 / 4)); return rowH; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/table/TableHeader.java000066400000000000000000000265631222453003200270430ustar00rootroot00000000000000package org.basex.gui.view.table; import static org.basex.core.Text.*; import static org.basex.gui.GUIConstants.*; import static org.basex.gui.layout.BaseXKeys.*; import static org.basex.util.Token.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import org.basex.data.*; import org.basex.gui.GUIConstants.Fill; import org.basex.gui.*; import org.basex.gui.layout.*; import org.basex.gui.view.table.TableData.TableCol; /** * This is the header of the table view. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class TableHeader extends BaseXPanel { /** View reference. */ final TableView view; /** Table Data. */ final TableData tdata; /** Temporary Input Box. */ TableInput box; /** Current input column. */ int inputCol = -1; /** Header flag. */ private boolean header; /** Clicked column. */ private int clickCol = -1; /** Moved column. */ private int moveC = -1; /** Moved X position. */ private int mouseX = -1; /** * Constructor. * @param v view reference */ TableHeader(final TableView v) { super(v.gui); mode(Fill.NONE).setFocusable(true); tdata = v.tdata; view = v; BaseXLayout.setHeight(this, fontSize + 8 << 1); addMouseListener(this); addMouseMotionListener(this); addKeyListener(this); // restore default focus traversal with TAB key setFocusTraversalKeysEnabled(false); addFocusListener(new FocusAdapter() { @Override public void focusGained(final FocusEvent e) { filter(e.getOppositeComponent() instanceof TableView ? 0 : tdata.cols.length - 1); } @Override public void focusLost(final FocusEvent e) { // tab key pressed.. if(box != null) box.stop(); inputCol = -1; repaint(); } }); } @Override public void paintComponent(final Graphics g) { super.paintComponent(g); g.setFont(font); g.setColor(Color.black); if(tdata.rows == null) { BaseXLayout.drawCenter(g, NO_DATA, getWidth(), getHeight() / 2); return; } final int fsz = fontSize; final int bs = BaseXBar.SIZE; int w = getWidth(); final int h = getHeight(); final int hh = h >> 1; g.setColor(color2); g.drawLine(0, h - 1, w, h - 1); w -= bs; double x = 0; final int nc = tdata.cols.length; for(int n = 0; n < nc; ++n) { final double cw = w * tdata.cols[n].width; final double ce = x + cw; // header final boolean clicked = n == clickCol && moveC == -1 && header; BaseXLayout.drawCell(g, (int) x, (int) ce + 1, 0, hh, clicked); // input field g.setColor(Color.white); g.fillRect((int) x + 1, hh, (int) ce - (int) x - 2, hh - 2); g.drawLine((int) ce - 1, hh - 1, (int) ce - 1, h - 2); g.setColor(GRAY); g.drawLine((int) ce, hh - 1, (int) ce, h - 2); // draw headers g.setColor(Color.black); g.setFont(bfont); final int off = clicked ? 1 : 0; BaseXLayout.chopString(g, tdata.cols[n].name, (int) x + 4 + off, 2 + off, (int) cw, fsz); if(n == tdata.sortCol) { if(tdata.asc) g.fillPolygon(new int[] { (int) ce - 9 + off, (int) ce - 3 + off, (int) ce - 6 + off }, new int[] { 4 + off, 4 + off, 8 + off }, 3); else g.fillPolygon(new int[] { (int) ce - 9 + off, (int) ce - 3 + off, (int) ce - 6 + off }, new int[] { 8 + off, 8 + off, 4 + off }, 3); } // draw filter texts if(box != null && inputCol == n) { box.paint(g, (int) x, hh, (int) ce - (int) x, hh); } else { g.setColor(Color.black); g.setFont(font); g.drawString(tdata.cols[n].filter, (int) x + 5, h - 7); } x = ce; } final boolean clicked = nc == clickCol; BaseXLayout.drawCell(g, (int) x, w + bs, 0, hh, clicked && header); BaseXLayout.drawCell(g, (int) x, w + bs, hh - 1, h, clicked && !header); g.setColor(Color.black); g.setFont(bfont); smooth(g); int o = header && clicked ? 1 : 0; g.fillPolygon(new int[] { (int) x + o + 4, (int) x + o + bs - 4, (int) x + o + bs / 2 }, new int[] { o + 6, o + 6, o + bs - 3 }, 3); o = !header && clicked ? 1 : 0; final byte[] reset = { 'x' }; x += (bs - BaseXLayout.width(g, reset)) / 2d; BaseXLayout.chopString(g, reset, (int) x + o, hh + o + 1, w, fsz); } @Override public void mouseMoved(final MouseEvent e) { if(tdata.rows == null) return; Cursor cursor = CURSORARROW; mouseX = e.getX(); final int w = getWidth() - BaseXBar.SIZE; if(header(e.getY())) { moveC = colSep(w, mouseX); if(moveC != -1) cursor = CURSORMOVEH; } else { moveC = -1; if(mouseX < w) cursor = CURSORTEXT; if(gui.gprop.is(GUIProp.MOUSEFOCUS)) { final int c = tdata.column(w, mouseX); if(c != -1) filter(c); } } view.gui.cursor(cursor); } /** * Returns the column separator at the specified horizontal position. * @param w panel width * @param mx mouse position * @return column */ private int colSep(final int w, final int mx) { double x = 0; for(int i = 0; i < tdata.cols.length; ++i) { if(i > 0 && Math.abs(mx - x) < 3) return i; x += w * tdata.cols[i].width; } return -1; } @Override public void mouseDragged(final MouseEvent e) { if(tdata.rows == null) return; if(moveC != -1) { final int x = e.getX(); final double p = (double) (x - mouseX) / (getWidth() - BaseXBar.SIZE); final double[] ww = new double[tdata.cols.length]; for(int w = 0; w < ww.length; ++w) ww[w] = tdata.cols[w].width; if(e.isShiftDown()) { ww[moveC - 1] += p; ww[moveC] -= p; } else { for(int i = 0; i < moveC; ++i) ww[i] += p / moveC; for(int i = moveC; i < ww.length; ++i) ww[i] -= p / (ww.length - moveC); } for(final double w : ww) if(w < 0.0001) return; mouseX = x; for(int w = 0; w < ww.length; ++w) tdata.cols[w].width = ww[w]; } else if(clickCol != -1) { int c = tdata.column(getWidth() - BaseXBar.SIZE, e.getX()); if(c == -1) c = tdata.cols.length; if(c != clickCol || header != header(e.getY())) clickCol = -1; } view.repaint(); } @Override public void mouseExited(final MouseEvent e) { if(tdata.rows == null) return; view.gui.cursor(CURSORARROW); clickCol = -1; } @Override public void mousePressed(final MouseEvent e) { if(tdata.rows == null || !SwingUtilities.isLeftMouseButton(e)) return; clickCol = tdata.column(getWidth() - BaseXBar.SIZE, mouseX); if(clickCol == -1) clickCol = tdata.cols.length; header = header(e.getY()); repaint(); } @Override public void mouseReleased(final MouseEvent e) { if(tdata.rows == null) return; if(!SwingUtilities.isLeftMouseButton(e)) { chooseCols(e); } else { if(clickCol == -1) return; // header if(header(e.getY())) { if(moveC == -1) { if(clickCol == tdata.cols.length) { chooseRoot(e); } else { // sort data in current column view.gui.cursor(CURSORWAIT); tdata.asc = tdata.sortCol != clickCol || !tdata.asc; tdata.sortCol = clickCol; tdata.sort(); view.gui.cursor(CURSORARROW, true); } } } else { // activate table filter if(clickCol != tdata.cols.length) { filter(clickCol); } else { // reset table filter tdata.resetFilter(); view.query(); } } } clickCol = -1; view.repaint(); } /** * Shows a popup menu to choose main category to be displayed. * @param e event reference */ private void chooseRoot(final MouseEvent e) { if(tdata.roots.isEmpty()) return; final Data data = view.gui.context.data(); final JPopupMenu popup = new JPopupMenu(); final byte[] root = data.tagindex.key(tdata.root); for(final byte[] en : tdata.roots) { final int id = data.tagindex.id(en); final JMenuItem mi = new JRadioButtonMenuItem(string(en), eq(root, en)); mi.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent ac) { tdata.init(data, id); view.refreshContext(true, false); } }); popup.add(mi); } popup.show(this, e.getX(), e.getY()); } /** * Shows a popup menu to filter the visible columns. * @param e event reference */ private void chooseCols(final MouseEvent e) { final JPopupMenu popup = new JPopupMenu(); for(final TableCol col : tdata.cols) { final String item = (col.elem ? "" : "@") + string(col.name); final JMenuItem mi = new JCheckBoxMenuItem(item, col.width != 0); mi.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent ac) { final boolean sel = mi.isSelected(); boolean vis = sel; // disallow removal of last visible column for(final TableCol c : tdata.cols) vis |= c != col && c.width != 0; if(vis) { col.hwidth = sel ? 0 : col.width; col.width = sel ? col.hwidth : 0; } else { mi.setSelected(true); } popup.setVisible(true); tdata.setWidths(true); view.refreshContext(true, true); } }); popup.add(mi); } popup.show(this, e.getX(), e.getY()); } /** * Checks if specified y value lies in table header. * @param y position * @return true for table header, false for input field */ private boolean header(final int y) { return y < getHeight() >> 1; } /** * Handles the filter columns. * @param col current column */ void filter(final int col) { // activate table filter if(inputCol != col && tdata.cols.length != 0) { if(box != null) box.stop(); box = new TableInput(this, tdata.cols[col].filter); inputCol = col; } requestFocusInWindow(); } @Override public void keyPressed(final KeyEvent e) { if(tdata.roots.isEmpty() || box == null || control(e) || inputCol == -1) return; if(ENTER.is(e)) { box.stop(); inputCol = -1; final Nodes marked = view.gui.context.marked; if(marked.size() != 0) view.gui.notify.context(marked, false, null); } else if(TAB.is(e)) { tdata.cols[inputCol].filter = box.text; box.stop(); final int in = inputCol + (e.isShiftDown() ? -1 : 1); if(in < 0) { transferFocusBackward(); } else if(in == tdata.cols.length) { transferFocus(); } else { inputCol = in; box = new TableInput(this, tdata.cols[inputCol].filter); } } else { box.code(e); } repaint(); } @Override public void keyTyped(final KeyEvent e) { if(tdata.roots.isEmpty() || box == null || inputCol == -1 || control(e) || !box.add(e)) return; tdata.cols[inputCol].filter = box.text; view.query(); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/table/TableInput.java000066400000000000000000000054311222453003200267410ustar00rootroot00000000000000package org.basex.gui.view.table; import static org.basex.gui.layout.BaseXKeys.*; import java.awt.*; import java.awt.event.*; import org.basex.gui.*; import org.basex.gui.layout.*; import org.basex.util.*; /** * This class allows simple text input for the table headers. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class TableInput implements Runnable { /** Input text. */ String text; /** Panel reference. */ private final BaseXPanel panel; /** Flashing cursor. */ private boolean flashing; /** Flashing cursor. */ private int pos; /** * Constructor. * @param p panel reference * @param t text */ TableInput(final BaseXPanel p, final String t) { panel = p; text = t; pos = text.length(); new Thread(this).start(); } /** * Stops the box input. */ void stop() { text = null; } /** * Paints the input box. * @param g graphics reference * @param x x position * @param y y position * @param w width * @param h height */ void paint(final Graphics g, final int x, final int y, final int w, final int h) { g.setColor(GUIConstants.color4); g.drawRect(x, y - 1, w - 1, h); g.setColor(Color.black); g.setFont(GUIConstants.font); g.drawString(text, x + 5, y + h - 7); final int xx = x + BaseXLayout.width(g, text.substring(0, pos)) + 5; if(flashing) g.drawLine(xx, y + 1, xx, y + h - 5); } /** * Reacts on key codes. * @param e key event */ void code(final KeyEvent e) { if(ENTER.is(e) || text == null) stop(); flashing = true; if(LINESTART.is(e)) { pos = 0; } else if(LINEEND.is(e)) { pos = text.length(); } else if(PREV.is(e)) { pos = Math.max(0, pos - 1); } else if(NEXT.is(e)) { pos = Math.min(text.length(), pos + 1); } else if(DELPREV.is(e)) { if(pos > 0) text = text.substring(0, pos - 1) + text.substring(pos--); } else if(DELNEXT.is(e)) { if(pos < text.length()) { text = text.substring(0, pos) + text.substring(pos + 1); } } } /** * Adds a character. * @param e key event * @return true if input was modified */ boolean add(final KeyEvent e) { // backspace/delete... if(DELNEXT.is(e) || DELPREV.is(e)) return true; // skip other control chars final char ch = e.getKeyChar(); if(ch < ' ') return false; flashing = true; text = text.substring(0, pos) + ch + text.substring(pos); ++pos; return true; } @Override public void run() { while(text != null) { flashing ^= true; panel.repaint(); Performance.sleep(500); } flashing = false; panel.repaint(); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/table/TableIterator.java000066400000000000000000000033261222453003200274340ustar00rootroot00000000000000package org.basex.gui.view.table; import org.basex.data.*; /** * This is an iterator for parsing the rows' contents. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class TableIterator { /** Table data. */ private final TableData tdata; /** Data reference. */ private final Data data; /** Last pre value. */ private int last; /** Last tag. */ private int tag; /** Root tag. */ private int rootTag; /** Current pre value. */ int pre; /** Current column. */ int col; /** Element flag. */ boolean text; /** * Default constructor. * @param d data reference * @param td table data */ TableIterator(final Data d, final TableData td) { data = d; tdata = td; } /** * Initializes the iterator. * @param p pre value to start from (must be an element node) */ void init(final int p) { last = p + data.size(p, data.kind(p)); rootTag = data.name(p); pre = p; tag = -1; } /** * Checks if more values are found. * @return result of check */ boolean more() { while(++pre < last) { final int k = data.kind(pre); text = k == Data.TEXT; // content found... if(text || k == Data.ATTR) { final int id = text ? tag : data.name(pre); // find correct column... for(col = 0; col < tdata.cols.length; ++col) { if(tdata.cols[col].id == id && tdata.cols[col].elem == text) { return true; } } } else if(k == Data.ELEM) { // remember last tag tag = data.name(pre); if(tag == rootTag) return false; } } return false; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/table/TableView.java000066400000000000000000000201231222453003200265470ustar00rootroot00000000000000package org.basex.gui.view.table; import static org.basex.gui.GUIConstants.*; import static org.basex.gui.layout.BaseXKeys.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import org.basex.core.*; import org.basex.data.*; import org.basex.gui.*; import org.basex.gui.layout.*; import org.basex.gui.view.*; import org.basex.util.*; import org.basex.util.list.*; /** * This view creates a flat table view on the database contents. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class TableView extends View implements Runnable { /** Zoom table. */ private static final double[] ZOOM = { 1, .99, .98, .97, 1, 1.03, 1.05, .9, .8, .6, .35, .18, .13, .09, .05, .03 }; /** Table data. */ final TableData tdata; /** Table header. */ private final TableHeader header; /** Table content area. */ private final TableContent content; /** Table scrollbar. */ private final BaseXBar scroll; /** * Default constructor. * @param man view manager */ public TableView(final ViewNotifier man) { super(TABLEVIEW, man); tdata = new TableData(gui.context, gui.gprop); layout(new BorderLayout()); header = new TableHeader(this); add(header, BorderLayout.NORTH); scroll = new BaseXBar(this); content = new TableContent(tdata, scroll); add(content, BorderLayout.CENTER); new BaseXPopup(this, POPUP); } @Override public void refreshInit() { tdata.rootRows = null; tdata.rows = null; final Data data = gui.context.data(); if(!visible() || data == null) return; tdata.init(data); refreshContext(true, false); } @Override public void refreshContext(final boolean more, final boolean quick) { if(tdata.cols.length == 0) return; tdata.context(false); scroll.pos(0); if(tdata.rows == null) return; if(quick) { scroll.height(tdata.rows.size() * tdata.rowH(1)); focus(); repaint(); } else { if(!more) tdata.resetFilter(); gui.updating = true; new Thread(this).start(); } } @Override public void refreshFocus() { if(!visible() || tdata.rows == null) return; repaint(); } @Override public void refreshMark() { if(!visible() || tdata.rows == null) return; final Context context = gui.context; final Nodes marked = context.marked; if(marked.size() != 0) { final int p = tdata.getRoot(context.data(), marked.pres[0]); if(p != -1) setPos(p); } repaint(); } @Override public void refreshLayout() { if(!visible() || tdata.rows == null) return; scroll.height(tdata.rows.size() * tdata.rowH(1)); refreshContext(false, true); } @Override public void refreshUpdate() { tdata.rootRows = null; tdata.init(gui.context.data()); refreshContext(false, true); } @Override public boolean visible() { return gui.gprop.is(GUIProp.SHOWTABLE); } @Override public void visible(final boolean v) { gui.gprop.set(GUIProp.SHOWTABLE, v); } @Override protected boolean db() { return true; } @Override public void paintComponent(final Graphics g) { super.paintComponent(g); if(tdata.rows == null && visible()) refreshInit(); } @Override public void run() { /* Current zoom step. */ int zoomstep = ZOOM.length; while(--zoomstep >= 0) { scroll.height(tdata.rows.size() * tdata.rowH(ZOOM[zoomstep])); repaint(); Performance.sleep(25); } gui.updating = false; focus(); } /** * Sets scrollbar position for the specified pre value. * @param pre pre value */ private void setPos(final int pre) { final int off = getOff(pre); if(off == -1) return; final int h = getHeight() - header.getHeight() - 2 * tdata.rowH; final int y = (off - 1) * tdata.rowH; final int s = scroll.pos(); if(y < s || y > s + h) scroll.pos(y); } /** * Returns list offset for specified pre value. * @param pre pre value * @return offset */ private int getOff(final int pre) { final int ns = tdata.rows.size(); for(int n = 0; n < ns; ++n) { if(tdata.rows.get(n) == pre) return n; } return -1; } @Override public void mouseMoved(final MouseEvent e) { super.mouseMoved(e); if(!visible() || tdata.rows == null) return; tdata.mouseX = e.getX(); tdata.mouseY = e.getY(); focus(); } /** * Finds the current focus. */ private void focus() { final int y = tdata.mouseY - header.getHeight() + scroll.pos(); final int l = y / tdata.rowH; final boolean valid = y >= 0 && l < tdata.rows.size(); final Data data = gui.context.data(); int focused = -1; if(valid) { final int pre = tdata.rows.get(l); final TableIterator it = new TableIterator(data, tdata); final int c = tdata.column(getWidth() - BaseXBar.SIZE, tdata.mouseX); it.init(pre); while(it.more()) { if(it.col == c) { focused = it.pre; break; } } } gui.notify.focus(focused, this); content.repaint(); final String str = content.focusedString; gui.cursor(valid && str != null && str.length() <= data.meta.maxlen ? CURSORHAND : CURSORARROW); } @Override public void mouseExited(final MouseEvent e) { gui.cursor(CURSORARROW); gui.notify.focus(-1, null); } @Override public void mousePressed(final MouseEvent e) { final int pre = gui.context.focused; if(pre == -1) return; super.mousePressed(e); final Context context = gui.context; final Data data = gui.context.data(); if(tdata.rows == null) return; if(e.getY() < header.getHeight()) return; if(SwingUtilities.isLeftMouseButton(e)) { if(e.getClickCount() == 1) { final int c = tdata.column(getWidth() - BaseXBar.SIZE, e.getX()); final String str = content.focusedString; if(str == null || str.length() > data.meta.maxlen) return; if(!e.isShiftDown()) tdata.resetFilter(); tdata.cols[c].filter = str; query(); //repaint(); } else { Nodes nodes = context.marked; if(getCursor() == CURSORARROW) { nodes = new Nodes(tdata.getRoot(nodes.data, pre), nodes.data); } gui.notify.context(nodes, false, null); } } else { final TableIterator it = new TableIterator(data, tdata); final int c = tdata.column(getWidth() - BaseXBar.SIZE, e.getX()); it.init(pre); while(it.more()) { if(it.col == c) { gui.notify.mark(new Nodes(it.pre, data), null); return; } } } } /** * Performs a table query. */ void query() { final String query = tdata.find(); if(query != null) gui.xquery(query, false); } @Override public void mouseWheelMoved(final MouseWheelEvent e) { if(tdata.rows == null) return; scroll.pos(scroll.pos() + e.getUnitsToScroll() * tdata.rowH); mouseMoved(e); repaint(); } @Override public void keyPressed(final KeyEvent e) { super.keyPressed(e); if(tdata.rows == null) return; final int lines = (getHeight() - header.getHeight()) / tdata.rowH; final int oldPre = tdata.getRoot(gui.context.data(), gui.context.focused); int pre = oldPre; final IntList rows = tdata.rows; if(LINESTART.is(e)) { pre = rows.get(0); } else if(LINEEND.is(e)) { pre = rows.get(rows.size() - 1); } else if(PREVLINE.is(e)) { pre = rows.get(Math.max(0, getOff(pre) - 1)); } else if(NEXTLINE.is(e)) { pre = rows.get(Math.min(rows.size() - 1, getOff(pre) + 1)); } else if(PREVPAGE.is(e)) { pre = rows.get(Math.max(0, getOff(pre) - lines)); } else if(NEXTPAGE.is(e)) { pre = rows.get(Math.min(rows.size() - 1, getOff(pre) + lines)); } if(pre != oldPre) { setPos(pre); gui.notify.focus(pre, null); } } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/table/package.html000066400000000000000000000000401222453003200262770ustar00rootroot00000000000000 GUI Table View. basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/text/000077500000000000000000000000001222453003200237215ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/text/TextView.java000066400000000000000000000143641222453003200263530ustar00rootroot00000000000000package org.basex.gui.view.text; import static org.basex.core.Text.*; import static org.basex.gui.GUIConstants.*; import static org.basex.util.Token.*; import java.awt.*; import java.awt.event.*; import java.io.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.data.*; import org.basex.gui.*; import org.basex.gui.GUIConstants.Fill; import org.basex.gui.editor.*; import org.basex.gui.layout.*; import org.basex.gui.layout.BaseXFileChooser.Mode; import org.basex.gui.view.*; import org.basex.io.*; import org.basex.io.out.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.util.*; /** * This class offers a fast text view, using the {@link Editor} class. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class TextView extends View { /** Search editor. */ final SearchEditor search; /** Header string. */ private final BaseXLabel label; /** Home button. */ private final BaseXButton home; /** Text Area. */ private final Editor text; /** Result command. */ private Command cmd; /** Result nodes. */ private Nodes ns; /** * Default constructor. * @param man view manager */ public TextView(final ViewNotifier man) { super(TEXTVIEW, man); border(5).layout(new BorderLayout(0, 5)); label = new BaseXLabel(RESULT, true, false); label.setForeground(GUIConstants.GRAY); home = BaseXButton.command(GUICommands.C_HOME, gui); home.setEnabled(false); final BaseXButton save = new BaseXButton(gui, "save", H_SAVE_RESULT); final BaseXButton srch = new BaseXButton(gui, "search", BaseXLayout.addShortcut(SEARCH, BaseXKeys.FIND.toString())); final BaseXBack buttons = new BaseXBack(Fill.NONE); buttons.layout(new TableLayout(1, 3, 1, 0)).border(0, 0, 4, 0); buttons.add(save); buttons.add(home); buttons.add(srch); final BaseXBack b = new BaseXBack(Fill.NONE).layout(new BorderLayout()); b.add(buttons, BorderLayout.WEST); b.add(label, BorderLayout.EAST); add(b, BorderLayout.NORTH); text = new Editor(false, gui); text.setSyntax(new SyntaxXML()); search = new SearchEditor(gui, text).button(srch); add(search, BorderLayout.CENTER); save.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { save(); } }); refreshLayout(); } @Override public void refreshInit() { refreshContext(true, true); } @Override public void refreshFocus() { } @Override public void refreshMark() { setText(gui.context.marked); } @Override public void refreshContext(final boolean more, final boolean quick) { setText(gui.context.current()); } @Override public void refreshLayout() { label.border(-6, 0, 0, 2).setFont(GUIConstants.lfont); text.setFont(mfont); search.bar().refreshLayout(); } @Override public void refreshUpdate() { refreshContext(true, true); } @Override public boolean visible() { return gui.gprop.is(GUIProp.SHOWTEXT); } @Override public void visible(final boolean v) { gui.gprop.set(GUIProp.SHOWTEXT, v); } @Override protected boolean db() { return false; } /** * Serializes the specified nodes. * @param n nodes to display */ private void setText(final Nodes n) { if(visible()) { try { final ArrayOutput ao = new ArrayOutput().max(gui.gprop.num(GUIProp.MAXTEXT)); if(n != null) n.serialize(Serializer.get(ao)); setText(ao); cmd = null; ns = ao.finished() ? n : null; } catch(final IOException ex) { Util.debug(ex); } } else { home.setEnabled(gui.context.data() != null); } } /** * Caches the output. * @param out cached output * @param c command * @param r result * @throws QueryException query exception */ public void cacheText(final ArrayOutput out, final Command c, final Result r) throws QueryException { // cache command or node set cmd = null; ns = null; final int mh = gui.context.prop.num(Prop.MAXHITS); boolean parse = false; if(mh >= 0 && r != null && r.size() >= mh) { parse = true; } else if(out.finished()) { if(r instanceof Nodes) ns = (Nodes) r; else parse = true; } // create new command instance if(parse) cmd = new CommandParser(c.toString(), gui.context).parseSingle(); } /** * Sets the output text. * @param out cached output */ public void setText(final ArrayOutput out) { final byte[] buf = out.buffer(); final int size = (int) out.size(); final byte[] chop = token(DOTS); if(out.finished() && size >= chop.length) { System.arraycopy(chop, 0, buf, size - chop.length, chop.length); } text.setText(buf, size); label.setText((out.finished() ? CHOPPED : "") + RESULT); home.setEnabled(gui.context.data() != null); } /** * Saves the displayed text. */ void save() { final BaseXFileChooser fc = new BaseXFileChooser(SAVE_AS, gui.gprop.get(GUIProp.WORKPATH), gui).suffix(IO.XMLSUFFIX); final IO file = fc.select(Mode.FSAVE); if(file == null) return; gui.gprop.set(GUIProp.WORKPATH, file.path()); PrintOutput out = null; gui.cursor(CURSORWAIT, true); final Prop prop = gui.context.prop; final int mh = prop.num(Prop.MAXHITS); prop.set(Prop.MAXHITS, -1); prop.set(Prop.CACHEQUERY, false); try { out = new PrintOutput(file.toString()); if(cmd != null) { cmd.execute(gui.context, out); } else if(ns != null) { ns.serialize(Serializer.get(out)); } else { final byte[] txt = text.getText(); for(final byte t : txt) if(t < 0 || t > ' ' || ws(t)) out.write(t); } } catch(final IOException ex) { BaseXDialog.error(gui, FILE_NOT_SAVED); } finally { if(out != null) try { out.close(); } catch(final IOException ignored) { } prop.set(Prop.MAXHITS, mh); prop.set(Prop.CACHEQUERY, true); gui.cursor(CURSORARROW, true); } } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/text/package.html000066400000000000000000000000371222453003200262020ustar00rootroot00000000000000 GUI Text View. basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/tree/000077500000000000000000000000001222453003200236745ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/tree/TreeBorder.java000066400000000000000000000012201222453003200265670ustar00rootroot00000000000000package org.basex.gui.view.tree; /** * This class is used to store subtree borders. * * @author BaseX Team 2005-12, BSD License * @author Wolfgang Miller */ final class TreeBorder { /** Real Level. */ final int level; /** Start index. */ final int start; /** Size. */ final int size; /** * Stores subtree borders. * @param lv level * @param st start * @param si size */ TreeBorder(final int lv, final int st, final int si) { level = lv; start = st; size = si; } /** * Returns end index. * @return end */ int getEnd() { return start + size - 1; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/tree/TreeConstants.java000066400000000000000000000033301222453003200273320ustar00rootroot00000000000000package org.basex.gui.view.tree; import java.awt.*; /** * This interface contains tree view constants. * * @author BaseX Team 2005-12, BSD License * @author Wolfgang Miller */ interface TreeConstants { /** Border padding value. */ int BORDER_PADDING = 2; /** Margin to top. */ int TOP_MARGIN = 6; /** Margin to bottom. */ int BOTTOM_MARGIN = 9; /** Margin left and right. */ int LEFT_AND_RIGHT_MARGIN = 4; /** Changes Color until given level. */ int CHANGE_COLOR_TILL = 4; /** Highlight Color small space. */ Color SMALL_SPACE_COLOR = Color.GREEN; /** Minimum rectangle space for text. */ int MIN_TXT_SPACE = 4; /** Minimum space between the levels. */ int MIN_LEVEL_DISTANCE = 2; /** Optimal space between the levels. */ int BEST_LEVEL_DISTANCE = 16; /** Maximum level distance. */ int MAX_LEVEL_DISTANCE = 100; /** Best node height. */ int BEST_NODE_HEIGHT = 8; /** Minimum node height. */ int MIN_NODE_HEIGHT = 1; /** Maximum node height. */ int MAX_NODE_HEIGHT = 26; /** Minimum node distance to draw node connections. */ int MIN_NODE_DIST_CONN = 5; /** Refresh mode. */ enum Refresh { /** New initialization. */ INIT, /** New context. */ CONTEXT, /** New window-size. */ RESIZE, /** Void. */ VOID } /** Draw kinds. */ enum Draw { /** Rectangle. */ RECTANGLE, /** Highlighting. */ HIGHLIGHT, /** Mark. */ MARK, /** Descendants. */ DESCENDANTS, /** Parents. */ PARENT, /** Connections. */ CONNECTION } /** Show not enough space text. */ byte NOT_ENOUGH_SPACE = 0; /** Show no attributes text. */ byte NO_ATTS = 1; } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/tree/TreeNodeCache.java000066400000000000000000000116271222453003200271770ustar00rootroot00000000000000package org.basex.gui.view.tree; import java.util.*; import org.basex.data.*; import org.basex.util.list.*; /** * This class determines nodes per level and caches them. * * @author BaseX Team 2005-12, BSD License * @author Wolfgang Miller */ final class TreeNodeCache implements TreeConstants { /** Document depth. */ private final int maxLevel; /** All nodes document nodes per level. */ private final IntList[] nodes; /** * This constructor invokes methods to cache all document nodes. * @param data data reference * @param atts show attributes */ TreeNodeCache(final Data data, final boolean atts) { final ArrayList alil = new ArrayList(); final int ts = data.meta.size; final IntList roots = data.resources.docs(); alil.add(new IntList()); final int rs = roots.size(); for(int i = 0; i < rs; ++i) { final int root = roots.get(i); alil.get(0).add(root); final int sh = i + 1 == roots.size() ? ts : roots.get(i + 1); for(int p = root + 1; p < sh; ++p) { final int k = data.kind(p); if(!atts && k == Data.ATTR) continue; final int par = data.parent(p, k); int lv = -1; final int is = alil.size(); while(++lv < is && par != alil.get(lv).peek()); for(int j = is; j <= lv + 1; ++j) alil.add(new IntList()); alil.get(lv + 1).add(p); } } maxLevel = alil.size(); nodes = alil.toArray(new IntList[alil.size()]); } /** * Returns the lowest index value. * @param lv level * @param lp left pre * @param rp right pre * @return index */ private int getMinIndex(final int lv, final int lp, final int rp) { final int l = 0; final int r = nodes[lv].size() - 1; int min = searchPreIndex(lv, lp, rp, l, r); if(min == -1) return min; final int[] n = nodes[lv].toArray(); while(min-- > 0 && n[min] > lp); return min + 1; } /** * Generates subtree borders. * @param d data reference * @param pre pre value * @return borders array */ TreeBorder[] subtree(final Data d, final int pre) { final TreeBorder[] bo = new TreeBorder[maxLevel]; if(pre == 0 && d.resources.docs().size() == 1) { for(int i = 0; i < maxLevel; ++i) bo[i] = new TreeBorder(i, 0, nodes[i].size()); return bo; } final int[] rlp = findPre(pre); final int rl = rlp[0]; final int ri = rlp[1]; // level pair bo[rl] = new TreeBorder(rl, ri, 1); final int np = pre + d.size(pre, d.kind(pre)); int h = 1; for(int i = rl + 1; i < maxLevel; ++i) { final int min = getMinIndex(i, pre, np); if(min == -1) break; int c = 0; for(int j = min; j < nodes[i].size(); ++j) if(nodes[i].get(j) < np) ++c; else break; bo[i] = new TreeBorder(i, min, c); ++h; } final TreeBorder[] bon = new TreeBorder[h]; System.arraycopy(bo, rl, bon, 0, h); return bon; } /** * Finds pre value in cached nodes and returns level and index position. * @param pre pre value * @return level and position pair */ private int[] findPre(final int pre) { int pos = -1; int l; for(l = 0; l < maxLevel; ++l) { pos = searchPreArrayPos(l, 0, nodes[l].size() - 1, pre); if(pos > -1) break; } return pos > -1 ? new int[] { l, pos} : null; } /** * Determines the index position of given pre value. * @param lv level to be searched * @param l left array border * @param r right array border * @param pre pre value * @return the determined index position */ int searchPreArrayPos(final int lv, final int l, final int r, final int pre) { return searchPreIndex(lv, pre, pre, l, r); } /** * Returns pre by given index. * @param bo border * @param ix index * @return pre int getPrePerIndex(final TreeBorder bo, final int ix) { return * nodes[bo.level].get(bo.start + ix); } */ /** * Searches for pre value or pre range. * @param lv level * @param lb left TreeBorder * @param rb right TreeBorder * @param l left array TreeBorder * @param r right array TreeBorder * @return result index */ int searchPreIndex(final int lv, final int lb, final int rb, final int l, final int r) { int index = -1; int ll = l; int rr = r; while(rr >= ll && index == -1) { final int m = ll + (rr - ll) / 2; if(nodes[lv].get(m) < lb) { ll = m + 1; } else if(nodes[lv].get(m) > rb) { rr = m - 1; } else { index = m; } } return index; } /** * Returns pre value at given level and index. * @param lv level * @param i index * @return pre value */ int getPrePerLevelAndIndex(final int lv, final int i) { return nodes[lv].get(i); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/tree/TreeRect.java000066400000000000000000000016501222453003200262560ustar00rootroot00000000000000package org.basex.gui.view.tree; /** * This is class is used to handle rectangles. * @author BaseX Team 2005-12, BSD License * @author Wolfgang Miller */ final class TreeRect { /** X position. */ final int x; /** Width. */ final int w; /** * Initializes TreeRect. * @param xx x position * @param ww width */ TreeRect(final int xx, final int ww) { x = xx; w = ww; } /** * Verifies if the specified coordinates are inside the rectangle. * @param xx x position * @return result of check */ boolean contains(final int xx) { return xx >= x && xx <= x + w; } /** * Verifies if the specified coordinates are inside the rectangle. * @param xx x position * @param ww width * @return result of check */ boolean contains(final int xx, final int ww) { return xx <= x && xx + ww >= x || xx <= x + w && xx + ww >= x; } }basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/tree/TreeRects.java000066400000000000000000000132361222453003200264440ustar00rootroot00000000000000package org.basex.gui.view.tree; import java.awt.*; import org.basex.data.*; import org.basex.gui.layout.*; import org.basex.gui.view.*; /** * This class stores the rectangles. * * @author BaseX Team 2005-12, BSD License * @author Wolfgang Miller */ final class TreeRects implements TreeConstants { /** Saved rectangles. */ private TreeRect[][][] rects; /** View. */ final View view; /** Displayed nods. */ Nodes nodes; /** * Constructor. * @param v view */ TreeRects(final View v) { view = v; } /** * Create new rectangles and set subtree borders. * @param sub subtree * @param g graphics reference * @param ds draw start * @param dw draw width * @param slim slim to text * @return tree distance */ double generateRects(final TreeSubtree sub, final Graphics g, final int ds, final int dw, final boolean slim) { final int[] roots = nodes.pres; final int rl = roots.length; if(rl == 0) return 0; final double w = (dw - BORDER_PADDING - ds) / (double) rl; if(w < 2) return -1; rects = new TreeRect[rl][][]; for(int i = 0; i < rl; ++i) generateRects(sub, g, i, ds, w, slim); return w; } /** * Generates cached rectangles. * * @param sub subtree * @param g graphics reference * @param rn root number * @param ds draw start * @param dw draw width * @param slim slim to text */ private void generateRects(final TreeSubtree sub, final Graphics g, final int rn, final int ds, final double dw, final boolean slim) { final int h = sub.subtreeHeight(rn); rects[rn] = new TreeRect[h][]; for(int lv = 0; lv < h; ++lv) { final double w = dw / sub.levelSize(rn, lv); if(w < 2) { bigRectangle(rn, lv, ds, dw); } else { normalRectangle(sub, g, rn, lv, ds, w, slim); } } } /** * Invoked if not enough space for more than one big rectangle. * @param rn root * @param lv level * @param ds draw start * @param w the width */ private void bigRectangle(final int rn, final int lv, final int ds, final double w) { rects[rn][lv] = new TreeRect[1]; rects[rn][lv][0] = new TreeRect((int) (w * rn) + BORDER_PADDING + ds, (int) w - BORDER_PADDING); } /** * Creates normal rectangles. * @param sub subtree * @param g graphics reference * @param rn root * @param lv level * @param ds draw start * @param w width * @param slim slim to text */ private void normalRectangle(final TreeSubtree sub, final Graphics g, final int rn, final int lv, final int ds, final double w, final boolean slim) { final int subSi = sub.levelSize(rn, lv); // new array, to be filled with the rectangles of the current level rects[rn][lv] = new TreeRect[subSi]; double xx = rn * w * subSi + ds; double ww = w; for(int i = 0; i < subSi; ++i) { if(slim) { final double boxMiddle = xx + ww / 2f; final byte[] b = getText(sub.prePerIndex(rn, lv, i)); int o = calcOptimalRectWidth(g, b) + 10; if(o < MIN_TXT_SPACE) o = MIN_TXT_SPACE; if(w > o) { xx = boxMiddle - o / 2d; ww = o; } } rects[rn][lv][i] = new TreeRect((int) xx + BORDER_PADDING, (int) ww - BORDER_PADDING); xx += w; } } /** * Returns TreeRects in given level. * @param rn root number * @param lv level * @return TreeRect array */ TreeRect[] getTreeRectsPerLevel(final int rn, final int lv) { return rects[rn][lv]; } /** * Returns TreeRect at given index position. * @param rn root number * @param lv level * @param ix index * @return tree rectangle */ TreeRect getTreeRectPerIndex(final int rn, final int lv, final int ix) { return rects[rn][lv][ix]; } /** * Returns node text. * @param pre pre * @return text */ byte[] getText(final int pre) { return ViewData.name(view.gui.gprop, nodes.data, pre); } /** * Calculates optimal rectangle width. * @param g the graphics reference * @param b byte array * @return optimal rectangle width */ private static int calcOptimalRectWidth(final Graphics g, final byte[] b) { return BaseXLayout.width(g, b); } /** * Returns true if big rectangle, false else. * @param sub subtree * @param rn root * @param lv level * @return boolean */ boolean bigRect(final TreeSubtree sub, final int rn, final int lv) { return !(sub.levelSize(rn, lv) == rects[rn][lv].length); } /** * Returns pre value for given x position of a big rectangle. * @param sub subtree * @param rn root * @param lv level * @param x x position * @return pre value */ int getPrePerXPos(final TreeSubtree sub, final int rn, final int lv, final int x) { final TreeRect r = getTreeRectsPerLevel(rn, lv)[0]; final double ratio = (x - r.x) / (double) r.w; final int idx = (int) (ratio * sub.levelSize(rn, lv)); return sub.prePerIndex(rn, lv, idx); } /** * Uses binary search to find the rectangle with given pre value. * @param sub subtree * @param rn root number * @param lv level * @param pre the pre value to be found * @return the rectangle containing the given pre value, {@code null} else */ TreeRect searchRect(final TreeSubtree sub, final int rn, final int lv, final int pre) { final int i = sub.searchPreArrayPos(rn, lv, pre); return i < 0 ? null : bigRect(sub, rn, lv) ? rects[rn][lv][0] : rects[rn][lv][i]; } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/tree/TreeSubtree.java000066400000000000000000000071211222453003200267710ustar00rootroot00000000000000package org.basex.gui.view.tree; import org.basex.data.*; /** * This class stores the subtrees. * * @author BaseX Team 2005-12, BSD License * @author Wolfgang Miller */ final class TreeSubtree { /** TreeNodeCache Object, contains cached document. */ private final TreeNodeCache nc; /** Subtree borders. */ private TreeBorder[][] border; /** * Creates new subtree. * @param d data * @param atts show attributes */ TreeSubtree(final Data d, final boolean atts) { nc = new TreeNodeCache(d, atts); } /** * Generates subtree borders. * @param d data reference * @param roots root nodes */ void generateBorders(final Data d, final int[] roots) { final int rl = roots.length; if(rl == 0) return; border = new TreeBorder[rl][]; for(int i = 0; i < rl; ++i) { border[i] = nc.subtree(d, roots[i]); } } /** * Returns pre by given index. * @param rn root * @param lv level * @param ix index * @return pre */ int prePerIndex(final int rn, final int lv, final int ix) { return prePerIndex(treeBorder(rn, lv), ix); } /** * Returns pre by given index. * @param bo border * @param ix index * @return pre */ private int prePerIndex(final TreeBorder bo, final int ix) { final int start = bo.start + ix; if(start < 0) return -1; return nc.getPrePerLevelAndIndex(bo.level, start); } /** * Returns index of pre. * @param rn root * @param lv level * @param pre pre * @return index */ int preIndex(final int rn, final int lv, final int pre) { return preIndex(treeBorder(rn, lv), pre); } /** * Returns index of pre. * @param bo border * @param pre pre * @return index */ private int preIndex(final TreeBorder bo, final int pre) { return nc.searchPreIndex(bo.level, pre, pre, bo.start, bo.getEnd()) - bo.start; } /** * Returns level size. * @param rn root * @param lv level * @return size */ int levelSize(final int rn, final int lv) { return treeBorder(rn, lv).size; } /** * Returns TreeBorder. * @param rn root * @param lv level * @return TreeBorder */ TreeBorder treeBorder(final int rn, final int lv) { return border[rn][lv]; } /** * Returns subtree height. * @param rn root * @return height */ int subtreeHeight(final int rn) { return rn >= 0 && rn < border.length ? border[rn].length : -1; } /** * Returns maximum subtree height. * @return max height */ int maxSubtreeHeight() { int h = 0; for(final TreeBorder[] b : border) { final int hh = b.length; if(hh > h) h = hh; } return h; } /** * Determines the index position of given pre value. * @param rn root * @param lv level * @param pre pre value * @return the determined index position */ int searchPreArrayPos(final int rn, final int lv, final int pre) { return searchPreArrayPos(treeBorder(rn, lv), pre); } /** * Determines the index position of given pre value. * @param bo border * @param pre pre value * @return the determined index position */ private int searchPreArrayPos(final TreeBorder bo, final int pre) { return nc.searchPreArrayPos(bo.level, bo.start, bo.getEnd(), pre) - bo.start; } /** * Returns subtree borders. * @param d data * @param pre pre * @return subtree borders */ TreeBorder[] subtree(final Data d, final int pre) { return nc.subtree(d, pre); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/tree/TreeView.java000066400000000000000000001003611222453003200262720ustar00rootroot00000000000000package org.basex.gui.view.tree; import static org.basex.core.Text.*; import static org.basex.gui.GUIConstants.*; import java.awt.*; import java.awt.event.*; import java.awt.image.*; import java.util.*; import javax.swing.*; import org.basex.core.*; import org.basex.data.*; import org.basex.gui.*; import org.basex.gui.layout.*; import org.basex.gui.view.*; import org.basex.util.*; import org.basex.util.list.*; /** * This class offers a real tree view. * * @author BaseX Team 2005-12, BSD License * @author Wolfgang Miller */ public final class TreeView extends View implements TreeConstants { /** TreeBorders Object, contains cached pre values and borders. */ private TreeSubtree sub; /** TreeRects Object, contains cached rectangles. */ private TreeRects tr; /** Current font height. */ private int fontHeight; /** Current mouse position x. */ private int mousePosX = -1; /** Current mouse position y. */ private int mousePosY = -1; /** Window width. */ private int wwidth = -1; /** Window height. */ private int wheight = -1; /** Window start. */ private int wstart; /** Current Image of visualization. */ private BufferedImage treeImage; /** Notified focus flag. */ private boolean refreshedFocus; /** Distance between the levels. */ private int levelDistance; /** Image of the current marked nodes. */ private BufferedImage markedImage; /** If something is selected. */ private boolean selection; /** The selection rectangle. */ private ViewRect selectRect; /** The node height. */ private int nodeHeight; /** Top margin. */ private int topMargin; /** Distance between multiple trees. */ private double treedist; /** Currently focused rectangle. */ private TreeRect frect; /** Level of currently focused rectangle. */ private int flv = -1; /** Focused root number. */ private int frn; /** Focused pre. */ private int fpre; /** New tree initialization. */ private Refresh paintType = Refresh.INIT; /** Array with current root nodes. */ private int[] roots; /** Not enough space. */ private boolean nes; /** If something is in focus. */ private boolean inFocus; /** Show attributes. */ private boolean showAtts; /** Slim rectangles to text length. */ private boolean slimToText; /** * Default constructor. * @param man view manager */ public TreeView(final ViewNotifier man) { super(TREEVIEW, man); new BaseXPopup(this, POPUP); } @Override public void refreshContext(final boolean more, final boolean quick) { paintType = sub == null ? Refresh.INIT : Refresh.CONTEXT; repaint(); } @Override public void refreshFocus() { refreshedFocus = true; repaint(); } @Override public void refreshInit() { if(!visible()) return; paintType = Refresh.INIT; repaint(); } @Override public void refreshLayout() { paintType = Refresh.RESIZE; repaint(); } @Override public void refreshMark() { if(nes) return; markNodes(); repaint(); } @Override public void refreshUpdate() { paintType = Refresh.INIT; repaint(); } @Override public boolean visible() { final boolean v = gui.gprop.is(GUIProp.SHOWTREE); if(!v) { sub = null; tr = null; paintType = Refresh.INIT; } return v; } @Override public void visible(final boolean v) { gui.gprop.set(GUIProp.SHOWTREE, v); } @Override protected boolean db() { return true; } @Override public void paintComponent(final Graphics g) { final Context c = gui.context; final Data data = c.data(); if(data == null) return; if(showAttsChanged()) paintType = Refresh.INIT; if(slimToTextChanged() && paintType == Refresh.VOID) paintType = Refresh.RESIZE; super.paintComponent(g); gui.painting = true; final Nodes nodes = gui.context.current(); roots = nodes.pres; if(roots.length == 0) return; for(int i = 0; !showAtts && i < roots.length; ++i) { if(roots[i] >= data.meta.size) break; if(data.kind(roots[i]) == Data.ATTR) { drawMessage(g, NO_ATTS); return; } } smooth(g); g.setFont(font); fontHeight = g.getFontMetrics().getHeight(); if(paintType == Refresh.INIT) { sub = new TreeSubtree(data, showAtts); tr = new TreeRects(this); } tr.nodes = nodes; if(paintType == Refresh.INIT || paintType == Refresh.CONTEXT) { sub.generateBorders(data, roots); } // if window-size changed final boolean winChange = windowSizeChanged(); if(winChange && paintType == Refresh.VOID || paintType == Refresh.INIT || paintType == Refresh.CONTEXT || paintType == Refresh.RESIZE) { treedist = tr.generateRects(sub, g, wstart, wwidth, slimToText); nes = treedist == -1; if(!nes) { markedImage = null; setLevelDistance(); createMainImage(); if(gui.context.marked.size() > 0) markNodes(); } } if(nes) { drawMessage(g, NOT_ENOUGH_SPACE); return; } g.drawImage(treeImage, 0, 0, wwidth, wheight, this); if(selection) { if(selectRect != null) { // draw selection final int x = selectRect.w < 0 ? selectRect.x + selectRect.w : selectRect.x; final int y = selectRect.h < 0 ? selectRect.y + selectRect.h : selectRect.y; final int w = Math.abs(selectRect.w); final int h = Math.abs(selectRect.h); g.setColor(colormark1); g.drawRect(x, y, w, h); } markNodes(); } if(markedImage != null) g.drawImage(markedImage, 0, 0, wwidth, wheight, this); // highlights the focused node inFocus = paintType == Refresh.VOID && focus(); if(inFocus && !winChange) { if(!refreshedFocus && tr.bigRect(sub, frn, flv)) { final int f = getMostSizedNode(data, frn, flv, frect, fpre); if(f >= 0) fpre = f; } highlightNode(g, frn, flv, frect, fpre, -1, Draw.HIGHLIGHT); refreshedFocus = false; } paintType = Refresh.VOID; gui.painting = false; } /** * Creates new image and draws rectangles in it. */ private void createMainImage() { treeImage = createImage(); final Graphics tg = treeImage.getGraphics(); final int rl = roots.length; tg.setFont(font); smooth(tg); for(int rn = 0; rn < rl; ++rn) { final int h = sub.subtreeHeight(rn); for(int lv = 0; lv < h; ++lv) { final boolean br = tr.bigRect(sub, rn, lv); final TreeRect[] lr = tr.getTreeRectsPerLevel(rn, lv); for(int i = 0; i < lr.length; ++i) { final TreeRect r = lr[i]; final int pre = sub.prePerIndex(rn, lv, i); drawRectangle(tg, rn, lv, r, pre, Draw.RECTANGLE); } if(br) { final TreeRect r = lr[0]; final int ww = r.x + r.w - 1; final int x = r.x + 1; drawBigRectSquares(tg, lv, x, ww, 4); } } final TreeRect rr = tr.getTreeRectPerIndex(rn, 0, 0); highlightDescendants(tg, rn, 0, rr, roots[rn], getRectCenter(rr), Draw.CONNECTION); } } /** * Displays Message if there is not enough space to draw all roots or an * attribute-context but no attributes in cache. * @param g graphics reference * @param t type */ private void drawMessage(final Graphics g, final byte t) { final int mw = wwidth >> 1; final int mh = wheight >> 1; String message = ""; switch(t) { case NOT_ENOUGH_SPACE: message = NO_PIXELS; break; case NO_ATTS: message = "Enable attributes in Tree Options."; break; } final int x = mw - (BaseXLayout.width(g, message) >> 1); final int y = mh + fontHeight; g.setColor(Color.BLACK); g.drawString(message, x, y); } /** * Draws the squares inside big rectangles. * @param g graphics reference * @param lv level * @param x x-coordinate * @param w width * @param ss square-size */ private void drawBigRectSquares(final Graphics g, final int lv, final int x, final int w, final int ss) { int xx = x; final int y = getYperLevel(lv); int nh = nodeHeight; g.setColor(color2A); while(nh > 0) { nh -= ss; if(nh < 0) nh = 0; g.drawLine(xx, y + nh, w, y + nh); } while(xx < w) { xx = xx + ss - 1 < w ? xx + ss : xx + ss - 1; g.drawLine(xx, y, xx, y + nodeHeight); } } /** * Return boolean if position is marked or not. * @param x x-coordinate * @param y y-coordinate * @return position is marked or not */ private boolean marked(final int x, final int y) { if(markedImage != null) { final int h = markedImage.getHeight(); final int w = markedImage.getWidth(); if(y >= h || 0 > y || x >= w || 0 > x) return false; final Color markc = new Color(markedImage.getRGB(x, y)); return markc.getRed() > 0 && markc.getBlue() == 0 && markc.getGreen() == 0; } return false; } /** * Draws Rectangles. * @param g graphics reference * @param rn root * @param lv level * @param r rectangle * @param pre pre * @param t draw type */ private void drawRectangle(final Graphics g, final int rn, final int lv, final TreeRect r, final int pre, final Draw t) { final int y = getYperLevel(lv); final int h = nodeHeight; final boolean br = tr.bigRect(sub, rn, lv); boolean txt = !br && fontHeight <= h; final boolean fill; boolean border = false; final int xx = r.x; final int ww = r.w; final boolean marked = marked(xx, y); Color borderColor = null; Color fillColor; Color textColor = Color.BLACK; switch(t) { case RECTANGLE: borderColor = getColorPerLevel(lv, false); fillColor = getColorPerLevel(lv, true); border = true; fill = true; break; case HIGHLIGHT: borderColor = color4; final int alpha = 0xDD000000; final int rgb = GUIConstants.LGRAY.getRGB(); fillColor = new Color(rgb + alpha, true); if(h > 4) border = true; fill = !br && !marked; break; case MARK: borderColor = h > 2 && r.w > 4 ? colormark1A : colormark1; fillColor = colormark1; border = true; fill = true; break; case DESCENDANTS: final int alphaD = 0xDD000000; final int rgbD = color(6).getRGB(); fillColor = new Color(rgbD + alphaD, true); borderColor = color(8); textColor = Color.WHITE; fill = !marked; border = true; if(h < 4) { fillColor = SMALL_SPACE_COLOR; borderColor = fillColor; txt = false; } break; case PARENT: default: fillColor = color(6); textColor = Color.WHITE; fill = !br && !marked; border = !br; if(h < 4) { fillColor = SMALL_SPACE_COLOR; borderColor = color(8); txt = false; } break; } if(border) { g.setColor(borderColor); g.drawRect(xx, y, ww, h); } if(fill) { g.setColor(fillColor); g.fillRect(xx + 1, y + 1, ww - 1, h - 1); } if(txt && fill) { g.setColor(textColor); drawRectangleText(g, lv, r, pre); } } /** * Draws text into rectangle. * @param g graphics reference * @param lv level * @param r rectangle * @param pre pre */ private void drawRectangleText(final Graphics g, final int lv, final TreeRect r, final int pre) { String s = Token.string(tr.getText(pre)).trim(); if(r.w < BaseXLayout.width(g, s) && r.w < BaseXLayout.width( g, ".." + s.substring(s.length() - 1)) + MIN_TXT_SPACE) return; final int x = r.x; final int y = getYperLevel(lv); final int rm = x + (int) (r.w / 2f); int tw = BaseXLayout.width(g, s); if(tw > r.w) { s += ".."; while((tw = BaseXLayout.width(g, s)) + MIN_TXT_SPACE > r.w && s.length() > 3) { s = s.substring(0, (s.length() - 2) / 2) + ".."; } } final int yy = (int) (y + (nodeHeight + fontHeight - 4) / 2d); g.drawString(s, (int) (rm - tw / 2d + BORDER_PADDING), yy); } /** * Returns draw Color. * @param l the current level * @param fill if true it returns fill color, rectangle color else * @return draw color */ private static Color getColorPerLevel(final int l, final boolean fill) { final int till = l < CHANGE_COLOR_TILL ? l : CHANGE_COLOR_TILL; return fill ? color(till) : color(till + 2); } /** * Marks nodes inside the dragged selection. */ private void markSelectedNodes() { final int x = selectRect.w < 0 ? selectRect.x + selectRect.w : selectRect.x; final int y = selectRect.h < 0 ? selectRect.y + selectRect.h : selectRect.y; final int w = Math.abs(selectRect.w); final int h = Math.abs(selectRect.h); final int t = y + h; final int size = sub.maxSubtreeHeight(); final IntList list = new IntList(); final int rl = roots.length; final int rs = getTreePerX(x); final int re = getTreePerX(x + w); for(int r = rs < 0 ? 0 : rs; r <= re; ++r) { for(int i = 0; i < size; ++i) { final int yL = getYperLevel(i); if(i < sub.subtreeHeight(r) && (yL >= y || yL + nodeHeight >= y) && (yL <= t || yL + nodeHeight <= t)) { final TreeRect[] rlv = tr.getTreeRectsPerLevel(r, i); final int s = sub.levelSize(r, i); if(tr.bigRect(sub, r, i)) { if(rl > 1) { final TreeBorder tb = sub.treeBorder(r, i); final int si = tb.size; for(int n = 0; n < si; ++n) { list.add(sub.prePerIndex(r, i, n)); } } else { final int mw = rlv[0].w; int sPrePos = (int) (s * (x - wstart) / (double) mw); int ePrePos = (int) (s * (x - wstart + w) / (double) mw); if(sPrePos < 0) sPrePos = 0; if(ePrePos >= s) ePrePos = s - 1; do { list.add(sub.prePerIndex(r, i, sPrePos)); } while(sPrePos++ < ePrePos); } } else { for(int j = 0; j < s; ++j) { final TreeRect rect = rlv[j]; if(rect.contains(x, w)) list.add(sub.prePerIndex(r, i, j)); } } } } } gui.notify.mark(new Nodes(list.toArray(), gui.context.data()), this); } /** * Creates a new translucent BufferedImage. * @return new translucent BufferedImage */ private BufferedImage createImage() { return new BufferedImage(Math.max(1, wwidth), Math.max(1, wheight), Transparency.TRANSLUCENT); } /** * Highlights the marked nodes. */ private void markNodes() { markedImage = createImage(); final Graphics mg = markedImage.getGraphics(); smooth(mg); mg.setFont(font); final int[] mark = gui.context.marked.pres; if(mark.length == 0) return; int rn = 0; while(rn < roots.length) { final LinkedList marklink = new LinkedList(); for(int i = 0; i < mark.length; ++i) marklink.add(i, mark[i]); for(int lv = 0; lv < sub.subtreeHeight(rn); ++lv) { final int y = getYperLevel(lv); final ListIterator li = marklink.listIterator(); if(tr.bigRect(sub, rn, lv)) { while(li.hasNext()) { final int pre = li.next(); final TreeRect rect = tr.searchRect(sub, rn, lv, pre); final int ix = sub.preIndex(rn, lv, pre); if(ix > -1) { li.remove(); final int x = (int) (rect.w * ix / (double) sub.levelSize(rn, lv)); mg.setColor(colormark1); mg.fillRect(rect.x + x, y, 2, nodeHeight + 1); } } } else { while(li.hasNext()) { final int pre = li.next(); final TreeRect rect = tr.searchRect(sub, rn, lv, pre); if(rect != null) { li.remove(); drawRectangle(mg, rn, lv, rect, pre, Draw.MARK); } } } } ++rn; } } /** * Returns position inside big rectangle. * @param rn root * @param lv level * @param pre pre * @param r rectangle * @return position */ private int getBigRectPosition(final int rn, final int lv, final int pre, final TreeRect r) { final int idx = sub.preIndex(rn, lv, pre); final double ratio = idx / (double) sub.levelSize(rn, lv); return r.x + (int) Math.round(r.w * ratio) + 1; } /** * Draws node inside big rectangle. * @param g the graphics reference * @param rn root * @param lv level * @param r rectangle * @param pre pre * @return node center */ private int drawNodeInBigRectangle(final Graphics g, final int rn, final int lv, final TreeRect r, final int pre) { final int y = getYperLevel(lv); final int np = getBigRectPosition(rn, lv, pre, r); g.setColor(nodeHeight < 4 ? SMALL_SPACE_COLOR : color(7)); g.drawLine(np, y, np, y + nodeHeight); return np; } /** * Draws parent connection. * @param g the graphics reference * @param lv level * @param r rectangle * @param px parent x * @param brx bigrect x */ private void drawParentConnection(final Graphics g, final int lv, final TreeRect r, final int px, final int brx) { final int y = getYperLevel(lv); g.setColor(color(7)); g.drawLine(px, getYperLevel(lv + 1) - 1, brx == -1 ? (2 * r.x + r.w) / 2 : brx, y + nodeHeight + 1); } /** * Highlights nodes. * @param g the graphics reference * @param rn root * @param pre pre * @param r rectangle to highlight * @param lv level * @param px parent's x value * @param t highlight type */ private void highlightNode(final Graphics g, final int rn, final int lv, final TreeRect r, final int pre, final int px, final Draw t) { if(lv == -1) return; final boolean br = tr.bigRect(sub, rn, lv); final boolean root = roots[rn] == pre; final int height = sub.subtreeHeight(rn); final Data d = gui.context.data(); final int k = d.kind(pre); final int size = d.size(pre, k); // rectangle center final int rc; if(br) { rc = drawNodeInBigRectangle(g, rn, lv, r, pre); } else { drawRectangle(g, rn, lv, r, pre, t); rc = getRectCenter(r); } // draw parent node connection if(px > -1 && MIN_NODE_DIST_CONN <= levelDistance) drawParentConnection(g, lv, r, px, rc); // if there are ancestors draw them if(!root) { final int par = d.parent(pre, k); final int lvp = lv - 1; final TreeRect parRect = tr.searchRect(sub, rn, lvp, par); if(parRect == null) return; highlightNode(g, rn, lvp, parRect, par, rc, Draw.PARENT); } // if there are descendants draw them if((t == Draw.CONNECTION || t == Draw.HIGHLIGHT) && size > 1 && lv + 1 < height) highlightDescendants(g, rn, lv, r, pre, rc, t); // draws node text if(t == Draw.HIGHLIGHT) drawThumbnails(g, lv, pre, r, root); } /** * Draws thumbnails. * @param g the graphics reference * @param lv level * @param pre pre * @param r rectangle * @param root root flag */ private void drawThumbnails(final Graphics g, final int lv, final int pre, final TreeRect r, final boolean root) { final int x = r.x; final int y = getYperLevel(lv); final int h = nodeHeight; final String s = Token.string(tr.getText(pre)); final int w = BaseXLayout.width(g, s); g.setColor(color(8)); final int fh = fontHeight; if(root) { g.fillRect(x, y + h, w + 2, fh + 2); g.setColor(color(6)); g.drawRect(x - 1, y + h + 1, w + 3, fh + 1); g.setColor(Color.WHITE); g.drawString(s, r.x + 1, (int) (y + h + (float) fh) - 2); } else { g.fillRect(r.x, y - fh, w + 2, fh); g.setColor(color(6)); g.drawRect(r.x - 1, y - fh - 1, w + 3, fh + 1); g.setColor(Color.WHITE); g.drawString(s, r.x + 1, (int) (y - h / (float) fh) - 2); } } /** * Highlights descendants. * @param g the graphics reference * @param rn root * @param lv level * @param r rectangle to highlight * @param pre pre * @param px parent's x value * @param t draw type */ private void highlightDescendants(final Graphics g, final int rn, final int lv, final TreeRect r, final int pre, final int px, final Draw t) { final Data d = gui.context.data(); final boolean br = tr.bigRect(sub, rn, lv); if(!br && t != Draw.CONNECTION) drawRectangle(g, rn, lv, r, pre, t); final int lvd = lv + 1; final TreeBorder[] sbo = sub.subtree(d, pre); if(sub.subtreeHeight(rn) >= lvd && sbo.length >= 2) { final boolean brd = tr.bigRect(sub, rn, lvd); if(brd) { drawBigRectDescendants(g, rn, lvd, sbo, px, t); } else { final TreeBorder bo = sbo[1]; final TreeBorder bos = sub.treeBorder(rn, lvd); final int start = bo.start >= bos.start ? bo.start - bos.start : bo.start; for(int j = 0; j < bo.size; ++j) { final int dp = sub.prePerIndex(rn, lvd, j + start); final TreeRect dr = tr.getTreeRectPerIndex(rn, lvd, j + start); if(levelDistance >= MIN_NODE_DIST_CONN) drawDescendantsConn(g, lvd, dr, px, t); highlightDescendants(g, rn, lvd, dr, dp, getRectCenter(dr), t == Draw.CONNECTION ? Draw.CONNECTION : Draw.DESCENDANTS); } } } } /** * Returns rectangle center. * @param r TreeRect * @return center */ private static int getRectCenter(final TreeRect r) { return (2 * r.x + r.w) / 2; } /** * Draws descendants for big rectangles. * @param g graphics reference * @param rn root * @param lv level * @param subt subtree * @param parc parent center * @param t draw type */ private void drawBigRectDescendants(final Graphics g, final int rn, final int lv, final TreeBorder[] subt, final int parc, final Draw t) { int lvv = lv; int cen = parc; int i; for(i = 1; i < subt.length && tr.bigRect(sub, rn, lvv); ++i) { final TreeBorder bos = sub.treeBorder(rn, lvv); final TreeBorder bo = subt[i]; final TreeRect r = tr.getTreeRectPerIndex(rn, lvv, 0); final int start = bo.start - bos.start; final double sti = start / (double) bos.size; final double eni = (start + bo.size) / (double) bos.size; final int df = r.x + (int) (r.w * sti); final int dt = r.x + (int) (r.w * eni); final int ww = Math.max(dt - df, 2); if(MIN_NODE_DIST_CONN <= levelDistance) drawDescendantsConn(g, lvv, new TreeRect(df, ww), cen, t); cen = (2 * df + ww) / 2; switch(t) { case CONNECTION: break; default: final int rgb = color(7).getRGB(); final int alpha = 0x33000000; g.setColor(nodeHeight < 4 ? SMALL_SPACE_COLOR : new Color( rgb + alpha, false)); if(nodeHeight > 2) { g.drawRect(df, getYperLevel(lvv) + 1, ww, nodeHeight - 2); } else { g.drawRect(df, getYperLevel(lvv), ww, nodeHeight); } } if(lvv + 1 < sub.subtreeHeight(rn) && !tr.bigRect(sub, rn, lvv + 1)) { final Data d = gui.context.data(); for(int j = start; j < start + bo.size; ++j) { final int pre = sub.prePerIndex(rn, lvv, j); final int pos = getBigRectPosition(rn, lvv, pre, r); final int k = d.kind(pre); final int s = d.size(pre, k); if(s > 1) highlightDescendants(g, rn, lvv, r, pre, pos, t == Draw.HIGHLIGHT || t == Draw.DESCENDANTS ? Draw.DESCENDANTS : Draw.CONNECTION); } } ++lvv; } } /** * Returns connection color. * @param t draw type * @return color */ private static Color getConnectionColor(final Draw t) { final int alpha; final int rgb; switch(t) { case CONNECTION: alpha = 0x20000000; rgb = color(4).getRGB(); return new Color(rgb + alpha, true); default: alpha = 0x60000000; rgb = color(8).getRGB(); return new Color(rgb + alpha, true); } } /** * Draws descendants connection. * @param g graphics reference * @param lv level * @param r TreeRect * @param parc parent center * @param t draw type */ private void drawDescendantsConn(final Graphics g, final int lv, final TreeRect r, final int parc, final Draw t) { final int pary = getYperLevel(lv - 1) + nodeHeight; final int prey = getYperLevel(lv) - 1; final int boRight = r.x + r.w + BORDER_PADDING - 2; final int boLeft = r.x + BORDER_PADDING; final int boTop = prey + 1; final Color c = getConnectionColor(t); g.setColor(c); if(boRight - boLeft > 2) { g.fillPolygon(new int[] { parc, boRight, boLeft}, new int[] { pary, boTop, boTop}, 3); } else { g.drawLine((boRight + boLeft) / 2, boTop, parc, pary); } } /** * Finds rectangle at cursor position. * @return focused rectangle */ private boolean focus() { if(refreshedFocus) { fpre = gui.context.focused; for(int r = 0; r < roots.length; ++r) { for(int i = 0; i < sub.subtreeHeight(r); ++i) { if(tr.bigRect(sub, r, i)) { final int index = sub.preIndex(r, i, fpre); if(index > -1) { frn = r; frect = tr.getTreeRectsPerLevel(r, i)[0]; flv = i; return true; } } else { final TreeRect rect = tr.searchRect(sub, r, i, fpre); if(rect != null) { frn = r; frect = rect; flv = i; return true; } } } } } else { final int lv = getLevelPerY(mousePosY); if(lv < 0) return false; final int mx = mousePosX; final int rn = frn = getTreePerX(mx); final int h = sub.subtreeHeight(rn); if(h < 0 || lv >= h) return false; final TreeRect[] rL = tr.getTreeRectsPerLevel(rn, lv); for(int i = 0; i < rL.length; ++i) { final TreeRect r = rL[i]; if(r.contains(mx)) { frect = r; flv = lv; final int pre; // if multiple pre values, then approximate pre value if(tr.bigRect(sub, rn, lv)) { pre = tr.getPrePerXPos(sub, rn, lv, mx); } else { pre = sub.prePerIndex(rn, lv, i); } fpre = pre; gui.notify.focus(pre, this); refreshedFocus = false; return true; } } } refreshedFocus = false; return false; } /** * Returns the y-axis value for a given level. * @param level the level * @return the y-axis value */ private int getYperLevel(final int level) { return level * nodeHeight + level * levelDistance + topMargin; } /** * Determines tree number. * @param x x-axis value * @return tree number */ private int getTreePerX(final int x) { return (int) ((x - wstart) / treedist); } /** * Determines the level of a y-axis value. * @param y the y-axis value * @return the level if inside a node rectangle, -1 else */ private int getLevelPerY(final int y) { final double f = (y - topMargin) / ((float) levelDistance + nodeHeight); final double b = nodeHeight / (float) (levelDistance + nodeHeight); return f <= (int) f + b ? (int) f : -1; } /** * Sets optimal distance between levels. */ private void setLevelDistance() { final int h = wheight - BOTTOM_MARGIN; int lvs = 0; for(int i = 0; i < roots.length; ++i) { final int th = sub.subtreeHeight(i); if(th > lvs) lvs = th; } nodeHeight = MAX_NODE_HEIGHT; int lD; while((lD = (int) ((h - lvs * nodeHeight) / (double) (lvs - 1))) < (nodeHeight <= BEST_NODE_HEIGHT ? MIN_LEVEL_DISTANCE : BEST_LEVEL_DISTANCE) && nodeHeight >= MIN_NODE_HEIGHT) nodeHeight--; levelDistance = lD < MIN_LEVEL_DISTANCE ? MIN_LEVEL_DISTANCE : lD > MAX_LEVEL_DISTANCE ? MAX_LEVEL_DISTANCE : lD; final int ih = (int) ((h - (levelDistance * (lvs - 1) + lvs * nodeHeight)) / 2d); topMargin = ih < TOP_MARGIN ? TOP_MARGIN : ih; } /** * Returns true if show attributes has changed. * @return show attributes has changed */ private boolean showAttsChanged() { final GUIProp gprop = gui.gprop; if(gprop.is(GUIProp.TREEATTS) == showAtts) return false; showAtts = !showAtts; return true; } /** * Returns true if slim to text has changed. * @return slim to text has changed */ private boolean slimToTextChanged() { final GUIProp gprop = gui.gprop; if(gprop.is(GUIProp.TREESLIMS) == slimToText) return false; slimToText = !slimToText; return true; } /** * Returns true if window-size has changed. * @return window-size has changed */ private boolean windowSizeChanged() { if(wwidth > -1 && wheight > -1 && getHeight() == wheight && getWidth() == wwidth + 2 * LEFT_AND_RIGHT_MARGIN) return false; wheight = getHeight(); wstart = LEFT_AND_RIGHT_MARGIN; wwidth = getWidth() - 2 * LEFT_AND_RIGHT_MARGIN; return true; } /** * Returns number of hit nodes. * @param rn root * @param lv level * @param r rectangle * @return size */ private int getHitBigRectNodesNum(final int rn, final int lv, final TreeRect r) { final int w = r.w; final int ls = sub.levelSize(rn, lv); return Math.max(ls / Math.max(w, 1), 1); } /** * Returns most sized node. * @param d the data reference * @param rn root * @param lv level * @param r rectangle * @param p pre * @return deepest node pre */ private int getMostSizedNode(final Data d, final int rn, final int lv, final TreeRect r, final int p) { final int size = getHitBigRectNodesNum(rn, lv, r); final int idx = sub.preIndex(rn, lv, p); if(idx < 0) return -1; int dpre = -1; int si = 0; for(int i = 0; i < size; ++i) { final int pre = sub.prePerIndex(rn, lv, i + idx); final int k = d.kind(pre); final int s = d.size(pre, k); if(s > si) { si = s; dpre = pre; } } return dpre; } @Override public void mouseMoved(final MouseEvent e) { if(gui.updating) return; super.mouseMoved(e); // refresh mouse focus mousePosX = e.getX(); mousePosY = e.getY(); repaint(); } @Override public void mousePressed(final MouseEvent e) { if(!inFocus || frect == null) return; if(SwingUtilities.isLeftMouseButton(e)) { if(flv >= sub.subtreeHeight(frn)) return; if(tr.bigRect(sub, frn, flv)) { final Nodes ns = new Nodes(gui.context.data()); int sum = getHitBigRectNodesNum(frn, flv, frect); final int fix = sub.preIndex(frn, flv, fpre); if(fix + sum + 1 == sub.levelSize(frn, flv)) ++sum; final int[] m = new int[sum]; for(int i = 0; i < sum; ++i) { final int pre = sub.prePerIndex(frn, flv, i + fix); if(pre == -1) break; m[i] = pre; } ns.union(m); gui.notify.mark(ns, null); } else { gui.notify.mark(0, null); } if(e.getClickCount() > 1) { gui.notify.context(gui.context.marked, false, this); refreshContext(false, false); } } else { if(!marked(mousePosX, mousePosY)) { gui.notify.mark(0, null); } } } @Override public void mouseWheelMoved(final MouseWheelEvent e) { if(gui.updating || gui.context.focused == -1) return; if(e.getWheelRotation() <= 0) gui.notify.context(new Nodes( gui.context.focused, gui.context.data()), false, null); else gui.notify.hist(false); } @Override public void mouseDragged(final MouseEvent e) { if(gui.updating || e.isShiftDown()) return; if(!selection) { selection = true; selectRect = new ViewRect(); selectRect.x = e.getX(); selectRect.y = e.getY(); selectRect.h = 1; selectRect.w = 1; } else { final int x = e.getX(); final int y = e.getY(); selectRect.w = x - selectRect.x; selectRect.h = y - selectRect.y; } markSelectedNodes(); repaint(); } @Override public void mouseReleased(final MouseEvent e) { if(gui.updating || gui.painting) return; selection = false; repaint(); } } basex-7.7.2/basex-core/src/main/java/org/basex/gui/view/tree/package.html000066400000000000000000000000371222453003200261550ustar00rootroot00000000000000 GUI Tree View. basex-7.7.2/basex-core/src/main/java/org/basex/index/000077500000000000000000000000001222453003200223065ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/index/IdPreMap.java000066400000000000000000000256741222453003200246300ustar00rootroot00000000000000package org.basex.index; import java.io.*; import java.util.*; import org.basex.io.*; import org.basex.io.in.DataInput; import org.basex.io.out.DataOutput; import org.basex.util.*; import org.basex.util.list.*; /** * ID -> PRE mapping. * * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ public class IdPreMap { /** Invalid id-value. */ private static final int INV = -1; /** Base ID value. */ private int baseid; /** PRE values of the inserted/deleted IDs. */ private int[] pres; /** Inserted first ID values. */ private int[] fids; /** Inserted last ID values. */ private int[] nids; /** Increments showing how the PRE values have been modified. */ private int[] incs; /** ID values for the PRE, before inserting/deleting a record. */ private int[] oids; /** Number of records in the table. */ private int rows; /** * Constructor. * @param id last inserted ID */ public IdPreMap(final int id) { baseid = id; pres = new int[1]; fids = new int[pres.length]; nids = new int[pres.length]; incs = new int[pres.length]; oids = new int[pres.length]; } /** * Construct a map by reading it from a file. * @param f file to read from * @throws IOException I/O error while reading from the file */ public IdPreMap(final IOFile f) throws IOException { final DataInput in = new DataInput(f); try { baseid = in.readNum(); rows = in.readNum(); pres = in.readNums(); fids = in.readNums(); nids = in.readNums(); incs = in.readNums(); oids = in.readNums(); } finally { in.close(); } } /** * Write the map to the specified file. * @param f file to write to * @throws IOException I/O error while writing to the file */ public void write(final IOFile f) throws IOException { final DataOutput out = new DataOutput(f); try { out.writeNum(baseid); out.writeNum(rows); out.writeNums(pres); out.writeNums(fids); out.writeNums(nids); out.writeNums(incs); out.writeNums(oids); } finally { out.close(); } } /** * Find the PRE value of a given ID. * @param id ID * @return PRE or -1 if the ID is already deleted */ public int pre(final int id) { // no updates or id is not affected by updates if(rows == 0 || id < pres[0]) return id; if(id > baseid) { // id was inserted by update for(int i = 0; i < rows; ++i) { // if(fids[i] == id) return pres[i]; // is this optimization? if(fids[i] <= id && id <= nids[i]) return pres[i] + id - fids[i]; } } else { // id is affected by updates final int i = sortedLastIndexOf(oids, id); return id + incs[i < 0 ? -i - 2 : i]; } return -1; } /** * Find the PRE values of a given list of IDs. * @param ids IDs * @param off start position in ids (inclusive) * @param len number of ids * @return a sorted array of PRE values */ public int[] pre(final int[] ids, final int off, final int len) { final IntList p = new IntList(ids.length); for(int i = off; i < len; ++i) p.add(pre(ids[i])); return p.sort().toArray(); } /** * Insert new record. * @param pre record PRE * @param id record ID * @param c number of inserted records */ public void insert(final int pre, final int id, final int c) { if(rows == 0 && pre == id && id == baseid + 1) { // no mapping and we append at the end => nothing to do baseid += c; return; } int pos = 0; int inc = c; int oid = pre; if(rows > 0) { pos = Arrays.binarySearch(pres, 0, rows, pre); if(pos < 0) { pos = -pos - 1; if(pos != 0) { // check if inserting into an existing id interval final int prev = pos - 1; final int prevcnt = nids[prev] - fids[prev] + 1; final int prevpre = pres[prev]; if(pre < prevpre + prevcnt) { // split the id interval final int split = pre - prevpre; final int fid = fids[prev] + split; // add a new next interval add(pos, pre, fid, nids[prev], incs[prev], oids[prev]); // shrink the previous interval nids[prev] = fid - 1; incs[prev] -= prevcnt - split; oid = oids[prev]; inc += incs[prev]; } else { oid = pre - incs[prev]; inc += incs[prev]; } } } else if(pos > 0) { oid = oids[pos]; inc += incs[pos - 1]; } increment(pos, c); } // add the new interval add(pos, pre, id, id + c - 1, inc, oid); } /** * Delete records. * @param pre PRE of the first record * @param id ID of the first deleted record * @param c number of deleted records */ public void delete(final int pre, final int id, final int c) { if(rows == 0 && pre == id && id - c == baseid + 1) { // no mapping and we delete at the end => nothing to do baseid += c; return; } if(rows == 0) { // no previous updates: add a new record add(0, pre, INV, INV, c, id); return; } final int end = pre - c - 1; final int startIndex = findPre(pre); // remove all updates which has affected records which now have to be deleted final int removeStart = startIndex < rows && pres[startIndex] < pre ? startIndex + 1 : startIndex; int removeEnd = -1; for(int i = startIndex; i < rows; ++i) { if(end < pres[i] + nids[i] - fids[i]) break; removeEnd = i; } final int inc; final int oid; int endIndex; if(removeEnd >= 0) { inc = incs[removeEnd]; oid = oids[removeEnd]; endIndex = removeStart; remove(removeStart, removeEnd); } else { inc = 0 < startIndex ? incs[startIndex - 1] : 0; oid = id; endIndex = startIndex; } if(rows <= startIndex) { // the delete does not affect previous updates add(startIndex, pre, INV, INV, inc + c, oid); return; } final int min = pres[startIndex]; if(startIndex < endIndex) { if(endIndex < rows && pres[endIndex] <= end) { shrinkFromStart(endIndex, pre, c); shrinkFromEnd(startIndex, pre, inc + c); } else { --endIndex; // endIndex is not processed, so we let the increment do that shrinkFromEnd(startIndex, pre, inc + c); } } else if(min < pre) { add(++endIndex, pres[startIndex], fids[startIndex], nids[startIndex], incs[startIndex], oids[startIndex]); shrinkFromStart(endIndex, pre, c); shrinkFromEnd(startIndex, pre, inc + c); } else if(end < min) { add(endIndex, pre, INV, INV, inc + c, oid); } else { shrinkFromStart(startIndex, pre, c); } increment(endIndex + 1, c); } /** * Shrink the given tuple from the start. * @param i index of the tuple * @param pre pre-value * @param c number of deleted records (negative number) */ private void shrinkFromStart(final int i, final int pre, final int c) { incs[i] += c; fids[i] += pre - c - pres[i]; pres[i] = pre; } /** * Shrink the given tuple from the end. * @param i index of the tuple * @param pre pre-value * @param inc new inc-value */ private void shrinkFromEnd(final int i, final int pre, final int inc) { nids[i] = fids[i] + pre - pres[i] - 1; incs[i] = inc; } /** * Increment the pre- and inc-values of all tuples starting from the given index. * @param from start index * @param with increment value */ private void increment(final int from, final int with) { for(int i = from; i < rows; ++i) { pres[i] += with; incs[i] += with; } } @Override public String toString() { final StringBuilder b = new StringBuilder(); b.append("pres, fids, nids, incs, oids"); for(int i = 0; i < rows; i++) { b.append('\n'); b.append(pres[i]); b.append(", "); b.append(fids[i]); b.append(", "); b.append(nids[i]); b.append(", "); b.append(incs[i]); b.append(", "); b.append(oids[i]); } return b.toString(); } /** * Size of the map. * @return number of stored tuples. */ public int size() { return rows; } /** * Search for a given pre value. * @param pre pre value * @return index of the record where the pre is found, or the insertion point, if not * found */ private int findPre(final int pre) { int low = 0; int high = rows - 1; while(low <= high) { final int mid = low + high >>> 1; final int midValMin = pres[mid]; final int midValMax = midValMin + nids[mid] - fids[mid]; if(midValMax < pre) low = mid + 1; else if(midValMin > pre) high = mid - 1; else return mid; // key found } return low; // key not found. } /** * Binary search of a key in a list. If there are several hits the last one is returned. * @param a array to search into * @param e key to search for * @return index of the found hit or where the key ought to be inserted */ private int sortedLastIndexOf(final int[] a, final int e) { int i = Arrays.binarySearch(a, 0, rows, e); if(i >= 0) { while(++i < rows && a[i] == e); return i - 1; } return i; } /** * Add a record to the table and the ID index. * @param i index in the table where the record should be inserted * @param pre pre value * @param fid first ID value * @param nid last ID value * @param inc increment value * @param oid original ID value */ private void add(final int i, final int pre, final int fid, final int nid, final int inc, final int oid) { if(rows == pres.length) { final int s = Array.newSize(rows); pres = Arrays.copyOf(pres, s); fids = Arrays.copyOf(fids, s); nids = Arrays.copyOf(nids, s); incs = Arrays.copyOf(incs, s); oids = Arrays.copyOf(oids, s); } if(i < rows) { final int destPos = i + 1; final int length = rows - i; System.arraycopy(pres, i, pres, destPos, length); System.arraycopy(fids, i, fids, destPos, length); System.arraycopy(nids, i, nids, destPos, length); System.arraycopy(incs, i, incs, destPos, length); System.arraycopy(oids, i, oids, destPos, length); } pres[i] = pre; fids[i] = fid; nids[i] = nid; incs[i] = inc; oids[i] = oid; ++rows; } /** * Remove a records from the table and the ID index. * @param s start index of records in the table (inclusive) * @param e end index of records in the table (inclusive) */ private void remove(final int s, final int e) { if(s <= e) { final int last = e + 1; final int length = rows - last; System.arraycopy(pres, last, pres, s, length); System.arraycopy(fids, last, fids, s, length); System.arraycopy(nids, last, nids, s, length); System.arraycopy(incs, last, incs, s, length); System.arraycopy(oids, last, oids, s, length); rows -= last - s; } } } basex-7.7.2/basex-core/src/main/java/org/basex/index/Index.java000066400000000000000000000020621222453003200242200ustar00rootroot00000000000000package org.basex.index; import org.basex.index.query.*; /** * This interface defines the methods which have to be implemented * by an index structure. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public interface Index { /** * Initializes the index. */ void init(); /** * Returns information on the index structure. * @return info */ byte[] info(); /** * Returns all entries that match the specified token. * @param entries index entries * @return entries */ EntryIterator entries(final IndexEntries entries); /** * Returns an iterator for the index results. * @param token token to be found * @return sorted pre values for the token */ IndexIterator iter(final IndexToken token); /** * Returns the (approximate/estimated) number of hits for the specified token. * @param token token to be found * @return number of hits */ int count(final IndexToken token); /** * Closes the index. */ void close(); } basex-7.7.2/basex-core/src/main/java/org/basex/index/IndexBuilder.java000066400000000000000000000070641222453003200255360ustar00rootroot00000000000000package org.basex.index; import static org.basex.core.Text.*; import java.io.*; import org.basex.core.*; import org.basex.data.*; import org.basex.util.*; /** * This interface defines the functions which are needed for building * new index structures. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class IndexBuilder extends Proc { /** Data reference. */ protected final Data data; /** Total parsing value. */ protected final int size; /** Number of index operations to perform before writing a partial index to disk. */ protected final int splitSize; /** Runtime for memory consumption. */ private final Runtime rt = Runtime.getRuntime(); /** Maximum memory to consume. */ private final long maxMem = (long) (rt.maxMemory() * 0.8); /** Current pre value. */ protected int pre; /** Total number of index operations (may get pretty large). */ protected long count; /** Number of partial index structures. */ protected int splits; /** Threshold for freeing memory when estimating main memory consumption. */ private int gcCount; /** * Builds the index structure and returns an index instance. * @return index instance * @throws IOException I/O Exception */ public abstract Index build() throws IOException; /** * Checks if the command was interrupted, and prints some debug output. */ protected final void check() { checkStop(); if(Prop.debug && (pre & 0x1FFFFF) == 0) Util.err("."); } /** * Decides whether in-memory temporary index structures are so large * that we must flush them to disk before continuing. * @return true if structures shall be flushed to disk * @throws IOException I/O Exception */ protected final boolean split() throws IOException { // checks if a fixed split size has been specified final boolean split; if(splitSize > 0) { split = count >= (splits + 1L) * splitSize; } else { // if not, estimate how much main memory is left split = rt.totalMemory() - rt.freeMemory() >= maxMem; // stop operation if index splitting degenerates int gc = gcCount; if(split) { if(gc >= 0) throw new BaseXException(OUT_OF_MEM + H_OUT_OF_MEM); gc = 30; } else { gc = Math.max(-1, gc - 1); } gcCount = gc; } if(split && Prop.debug) Util.err("|"); return split; } /** * Performs memory cleanup after writing partial memory, if necessary. */ protected final void finishSplit() { if(splitSize <= 0) Performance.gc(1); } /** * Prints some final debugging information. * @param perf performance */ protected final void finishIndex(final Performance perf) { if(!Prop.debug) return; final StringBuilder sb = new StringBuilder(); if(splits > 1) sb.append(" " + splits + " splits,"); sb.append(" " + count + " operations, "); sb.append(perf + " (" + Performance.getMemory() + ')'); Util.errln(sb); } /** * Constructor. * @param d reference * @param max maximum number of operations per partial index */ protected IndexBuilder(final Data d, final int max) { data = d; size = data.meta.size; splitSize = max; if(rt.totalMemory() - rt.freeMemory() >= maxMem) Performance.gc(1); } @Override public final String tit() { return CREATING_INDEXES; } @Override public final double prog() { return (double) pre / (size + (splits > 0 ? size / 50 : 0)); } } basex-7.7.2/basex-core/src/main/java/org/basex/index/IndexCache.java000066400000000000000000000144531222453003200251530ustar00rootroot00000000000000package org.basex.index; import static org.basex.util.Token.*; import java.lang.ref.*; import java.util.concurrent.locks.*; import org.basex.util.*; /** * This class caches sizes and pointers from index results. * * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ public final class IndexCache { /** Queue used to collect unused keys. */ private final ReferenceQueue queue = new ReferenceQueue(); /** Read-write lock. */ private final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock(true); /** Hash table buckets. */ private BucketEntry[] buckets = new BucketEntry[Array.CAPACITY]; /** Number of entries in the cache. */ private int size; /** * Gets cached entry for the specified key. * @param key key * @return cached entry or {@code null} if the entry is stale */ public IndexEntry get(final byte[] key) { final int hash = hash(key); rwl.readLock().lock(); try { final int i = indexFor(hash, buckets.length); BucketEntry e = buckets[i]; while(e != null) { final IndexEntry entry = e.get(); if(entry != null && e.hash == hash && eq(entry.key, key)) return entry; e = e.next; } } finally { rwl.readLock().unlock(); } return null; } /** * Adds a new cache entry. If an entry with the specified key already exists, * it will be updated. * @param key key * @param s number of index hits * @param p pointer to id list * @return cache entry */ public IndexEntry add(final byte[] key, final int s, final long p) { final int hash = hash(key); rwl.writeLock().lock(); try { purge(); final int i = indexFor(hash, buckets.length); BucketEntry current = buckets[i]; BucketEntry prev = current; while(current != null) { final BucketEntry next = current.next; final IndexEntry entry = current.get(); if(entry == null) { delete(i, current, prev, next); } else if(current.hash == hash && eq(entry.key, key)) { update(entry, s, p); return entry; } prev = current; current = next; } final IndexEntry entry = new IndexEntry(key, s, p); add(i, hash, entry); return entry; } finally { rwl.writeLock().unlock(); } } /** * Deletes a cached entry. * @param key key */ public void delete(final byte[] key) { final int hash = hash(key); rwl.writeLock().lock(); try { purge(); final int i = indexFor(hash, buckets.length); BucketEntry e = buckets[i]; BucketEntry prev = e; while(e != null) { final BucketEntry next = e.next; final IndexEntry entry = e.get(); if(entry == null) { delete(i, e, prev, next); } else if(e.hash == hash && eq(entry.key, key)) { delete(i, e, prev, next); break; } prev = e; e = next; } } finally { rwl.writeLock().unlock(); } } /** * Purges stale entries from the cache. */ private void purge() { for(Object x; (x = queue.poll()) != null;) { final BucketEntry e = (BucketEntry) x; final int i = indexFor(e.hash, buckets.length); BucketEntry prev = buckets[i]; BucketEntry p = prev; while(p != null) { final BucketEntry next = p.next; if(p == e) { delete(i, e, prev, next); break; } prev = p; p = next; } } } /** * Add a new index entry to the bucket with the specified index. * @param i bucket index * @param hash hash of the new index key * @param entry index entry */ private void add(final int i, final int hash, final IndexEntry entry) { buckets[i] = new BucketEntry(hash, buckets[i], entry, queue); if(++size == buckets.length) rehash(); } /** * Update an existing index entry. * @param entry index entry to update * @param sz new size * @param poi new pointer */ private static void update(final IndexEntry entry, final int sz, final long poi) { entry.size = sz; entry.pointer = poi; } /** * Deletes a cached entry from the buckets with the specified index. * @param i buckets index * @param e cached entry to delete * @param p previous cache entry * @param n next cache entry */ private void delete(final int i, final BucketEntry e, final BucketEntry p, final BucketEntry n) { if(p == e) buckets[i] = n; else p.next = n; e.next = null; --size; } /** * Resizes the hash table. */ private void rehash() { purge(); final int s = size << 1; final BucketEntry[] tmp = new BucketEntry[s]; final int l = buckets.length; for(int i = 0; i < l; ++i) { BucketEntry e = buckets[i]; buckets[i] = null; while(e != null) { final BucketEntry next = e.next; final int p = indexFor(e.hash, tmp.length); e.next = tmp[p]; tmp[p] = e; e = next; } } buckets = tmp; } /** * Returns buckets index for a hash code. * @param h hash code * @param n number of available buckets * @return index of a buckets */ private static int indexFor(final int h, final int n) { return h & n - 1; } /** * Cache buckets entry. Used to implement a linked list of cache entries for * each buckets. It also stores the hash of the current entry for better * performance. */ private static class BucketEntry extends SoftReference { /** Hash code of the stored cache entry key. */ final int hash; /** Next buckets entry or {@code null} if the last one for this buckets. */ BucketEntry next; /** * Constructor. * @param h hash code of the cache entry key * @param n next buckets entry or {@code null} if the last one * @param v stored cache entry * @param rq reference queue */ public BucketEntry(final int h, final BucketEntry n, final IndexEntry v, final ReferenceQueue rq) { super(v, rq); hash = h; next = n; } } } basex-7.7.2/basex-core/src/main/java/org/basex/index/IndexEntry.java000066400000000000000000000011151222453003200252400ustar00rootroot00000000000000package org.basex.index; /** * This class provides a single index entry. * * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ public final class IndexEntry { /** Entry key. */ public final byte[] key; /** Number of index hits for the key. */ public int size; /** Pointer to the id list for the key. */ public long pointer; /** * Constructor. * @param k key * @param s number of hits * @param p pointer to the id list */ public IndexEntry(final byte[] k, final int s, final long p) { key = k; size = s; pointer = p; } } basex-7.7.2/basex-core/src/main/java/org/basex/index/IndexTree.java000066400000000000000000000153061222453003200250450ustar00rootroot00000000000000package org.basex.index; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * This class indexes keys in a balanced binary tree, including their id * values. Iterator methods are available to traverse through the tree. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Sebastian Gath */ public class IndexTree { /** Factor for resize. */ protected static final double FACTOR = 1.2; /** Keys saved in the tree. */ public final TokenList keys = new TokenList(FACTOR); /** Compressed id values. */ public TokenList values = new TokenList(FACTOR); /** Mapping for using existing tree. */ protected TokenIntMap maps = new TokenIntMap(); /** Current iterator node. */ protected int cn; /** Tree structure [left, right, parent]. */ private final IntList tree = new IntList(FACTOR); /** Flag if a node has been modified. */ private final BoolList mod = new BoolList(); /** Tree root node. */ private int root = -1; /** * Indexes the specified key and value. * * @param key key to be indexed * @param value value to be indexes */ public final void index(final byte[] key, final int value) { index(key, value, true); } /** * Indexes the specified key and value. If the key has already been * indexed, its value is added to the existing value array. * Otherwise, a new index entry is created. * @param key key to be indexed * @param value value to be indexed * @param exist flag for using existing index * @return int node */ protected final int index(final byte[] key, final int value, final boolean exist) { // index is empty.. create root node if(root == -1) { root = n(key, value, -1, exist); return root; } int n = root; while(true) { final int c = Token.diff(key, keys.get(n)); if(c == 0) { if(exist) { values.set(n, Num.add(values.get(n), value)); } else { final int i = maps.get(Num.num(n)); if(i < 0) { maps.put(Num.num(n), values.size()); values.add(Num.newNum(value)); } else { values.set(i, Num.add(values.get(i), value)); } } return n; } int ch = c < 0 ? l(n) : r(n); if(ch != -1) { n = ch; } else { ch = n(key, value, n, exist); if(c < 0) { l(n, ch); a(l(n)); } else { r(n, ch); a(r(n)); } return ch; } } } /** * Returns the number of entries. * @return number of entries */ public final int size() { return values.size(); } /** * Initializes the index iterator. * will be removed to save memory. */ public final void init() { cn = root; if(cn != -1) while(l(cn) != -1) cn = l(cn); } /** * Checks if the iterator returns more keys. * @return true if more keys exist */ public final boolean more() { return cn != -1; } /** * Returns the next pointer. * @return next pointer */ public final int next() { /* Last iterator node. */ final int ln = cn; if(r(cn) != -1) { cn = r(cn); while(l(cn) != -1) cn = l(cn); } else { int t = cn; cn = p(cn); while(cn != -1 && t == r(cn)) { t = cn; cn = p(cn); } } return ln; } // PRIVATE METHODS ========================================================== /** * Creates a new node. * @param key node key * @param value node value * @param par pointer on parent node * @param exist flag for reusing existing tree * @return pointer of the new node */ private int n(final byte[] key, final int value, final int par, final boolean exist) { tree.add(-1); // left node tree.add(-1); // right node tree.add(par); // parent node mod.add(false); keys.add(key); values.add(Num.newNum(value)); if(!exist) maps.put(Num.num(keys.size() - 1), values.size() - 1); return mod.size() - 1; } /** * Gets the left child. * @param nd current node * @return left node */ private int l(final int nd) { return tree.get((nd << 1) + nd); } /** * Gets the right child. * @param nd current node * @return right node */ private int r(final int nd) { return tree.get((nd << 1) + nd + 1); } /** * Gets the parent node. * @param nd current node * @return parent node */ private int p(final int nd) { return tree.get((nd << 1) + nd + 2); } /** * Sets the left child. * @param nd current node * @param val left node */ private void l(final int nd, final int val) { tree.set((nd << 1) + nd, val); } /** * Sets the right child. * @param nd current node * @param val right node */ private void r(final int nd, final int val) { tree.set((nd << 1) + nd + 1, val); } /** * Sets the parent node. * @param nd current node * @param val parent node */ private void p(final int nd, final int val) { tree.set((nd << 1) + nd + 2, val); } /** * Adjusts the tree balance. * @param nd node to be adjusted */ private void a(final int nd) { int n = nd; mod.set(n, true); while(n != -1 && n != root && mod.get(p(n))) { if(p(n) == l(p(p(n)))) { final int y = r(p(p(n))); if(y != -1 && mod.get(y)) { mod.set(p(n), false); mod.set(y, false); mod.set(p(p(n)), true); n = p(p(n)); } else { if(n == r(p(n))) { n = p(n); rl(n); } mod.set(p(n), false); mod.set(p(p(n)), true); if(p(p(n)) != -1) rr(p(p(n))); } } else { final int y = l(p(p(n))); if(y != -1 && mod.get(y)) { mod.set(p(n), false); mod.set(y, false); mod.set(p(p(n)), true); n = p(p(n)); } else { if(n == l(p(n))) { n = p(n); rr(n); } mod.set(p(n), false); mod.set(p(p(n)), true); if(p(p(n)) != -1) rl(p(p(n))); } } } mod.set(root, false); } /** * Left rotation. * @param n node to be rotated */ private void rl(final int n) { final int r = r(n); r(n, l(r)); if(l(r) != -1) p(l(r), n); p(r, p(n)); if(p(n) == -1) root = r; else if(l(p(n)) == n) l(p(n), r); else r(p(n), r); l(r, n); p(n, r); } /** * Right rotation. * @param n node to be rotated */ private void rr(final int n) { final int l = l(n); l(n, r(l)); if(r(l) != -1) p(r(l), n); p(l, p(n)); if(p(n) == -1) root = l; else if(r(p(n)) == n) r(p(n), l); else l(p(n), l); r(l, n); p(n, l); } } basex-7.7.2/basex-core/src/main/java/org/basex/index/IndexType.java000066400000000000000000000006001222453003200250560ustar00rootroot00000000000000package org.basex.index; /** * This enumeration lists available index types. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public enum IndexType { /** Attribute names. */ ATTNAME, /** Element names. */ TAG, /** Text index. */ TEXT, /** Attribute index. */ ATTRIBUTE, /** Full-text index. */ FULLTEXT, /** Path index. */ PATH } basex-7.7.2/basex-core/src/main/java/org/basex/index/ft/000077500000000000000000000000001222453003200227175ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/index/ft/FTBuilder.java000066400000000000000000000216721222453003200254120ustar00rootroot00000000000000package org.basex.index.ft; import static org.basex.core.Text.*; import static org.basex.data.DataText.*; import static org.basex.util.Token.*; import java.io.*; import org.basex.core.*; import org.basex.data.*; import org.basex.index.*; import org.basex.io.out.DataOutput; import org.basex.util.*; import org.basex.util.ft.*; import org.basex.util.list.*; /** * This class contains common methods for full-text index builders. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FTBuilder extends IndexBuilder { /** Value trees. */ private final FTIndexTrees tree; /** Word parser. */ private final FTLexer lex; /** Current lexer position. */ int pos; /** Number of indexed tokens. */ private long ntok; /** * Constructor. * @param d data reference * @throws IOException IOException */ public FTBuilder(final Data d) throws IOException { super(d, d.meta.prop.num(Prop.FTINDEXSPLITSIZE)); tree = new FTIndexTrees(d.meta.maxlen); final Prop prop = d.meta.prop; final FTOpt fto = new FTOpt(); fto.set(FTFlag.DC, prop.is(Prop.DIACRITICS)); fto.set(FTFlag.CS, prop.is(Prop.CASESENS)); fto.set(FTFlag.ST, prop.is(Prop.STEMMING)); fto.sw = new StopWords(d, prop.get(Prop.STOPWORDS)); fto.ln = Language.get(prop); if(!Tokenizer.supportFor(fto.ln)) throw new BaseXException(NO_TOKENIZER_X, fto.ln); if(prop.is(Prop.STEMMING) && !Stemmer.supportFor(fto.ln)) throw new BaseXException(NO_STEMMER_X, fto.ln); lex = new FTLexer(fto); } /** * Extracts and indexes words from the specified data reference. * @throws IOException I/O Exception */ private void index() throws IOException { // delete old index abort(); final Performance perf = Prop.debug ? new Performance() : null; Util.debug(det()); for(pre = 0; pre < size; ++pre) { if((pre & 0xFFFF) == 0) check(); final int k = data.kind(pre); if(k != Data.TEXT) continue; pos = -1; final StopWords sw = lex.ftOpt().sw; lex.init(data.text(pre, true)); while(lex.hasNext()) { final byte[] tok = lex.nextToken(); ++pos; // skip too long and stopword tokens if(tok.length <= data.meta.maxlen && (sw.isEmpty() || !sw.contains(tok))) { // check if main memory is exhausted if((ntok++ & 0x0FFF) == 0 && split()) { writeIndex(true); finishSplit(); } tree.index(tok, pre, pos, splits); count++; } } } // finalize partial or all index structures write(splits > 0); data.meta.ftxtindex = true; finishIndex(perf); } @Override public FTIndex build() throws IOException { index(); return new FTIndex(data); } /** * Writes the index data to disk. * @param partial write partial index * @throws IOException I/O exception */ private void write(final boolean partial) throws IOException { writeIndex(partial); if(!partial) return; // merges temporary index files final DataOutput outX = new DataOutput(data.meta.dbfile(DATAFTX + 'x')); final DataOutput outY = new DataOutput(data.meta.dbfile(DATAFTX + 'y')); final DataOutput outZ = new DataOutput(data.meta.dbfile(DATAFTX + 'z')); final IntList ind = new IntList(); // open all temporary sorted lists final FTList[] v = new FTList[splits]; for(int b = 0; b < splits; ++b) v[b] = new FTList(data, b); final IntList il = new IntList(); while(check(v)) { int m = 0; il.reset(); il.add(m); // find next token to write on disk for(int i = 0; i < splits; ++i) { if(m == i || v[i].tok.length == 0) continue; final int l = v[i].tok.length - v[m].tok.length; final int d = diff(v[m].tok, v[i].tok); if(l < 0 || l == 0 && d > 0 || v[m].tok.length == 0) { m = i; il.reset(); il.add(m); } else if(d == 0 && v[i].tok.length > 0) { il.add(i); } } if(ind.isEmpty() || ind.get(ind.size() - 2) < v[m].tok.length) { ind.add(v[m].tok.length); ind.add((int) outY.size()); } // write token outY.writeBytes(v[m].tok); // pointer on full-text data outY.write5(outZ.size()); // merge and write data size outY.write4(merge(outZ, il, v)); } writeInd(outX, ind, ind.get(ind.size() - 2) + 1, (int) outY.size()); outX.close(); outY.close(); outZ.close(); } /** * Writes the token length index to disk. * @param outX output * @param il token length and offsets * @param ls last token length * @param lp last offset * @throws IOException I/O exception */ private static void writeInd(final DataOutput outX, final IntList il, final int ls, final int lp) throws IOException { final int is = il.size(); outX.writeNum(is >> 1); for(int i = 0; i < is; i += 2) { outX.writeNum(il.get(i)); outX.write4(il.get(i + 1)); } outX.writeNum(ls); outX.write4(lp); } /** * Writes the current index to disk. * @param partial partial flag * @throws IOException I/O exception */ private void writeIndex(final boolean partial) throws IOException { final String name = DATAFTX + (partial ? splits : ""); final DataOutput outX = new DataOutput(data.meta.dbfile(name + 'x')); final DataOutput outY = new DataOutput(data.meta.dbfile(name + 'y')); final DataOutput outZ = new DataOutput(data.meta.dbfile(name + 'z')); final IntList ind = new IntList(); long dr = 0; int tr = 0; int j = 0; tree.init(); while(tree.more(splits)) { final FTIndexTree t = tree.nextTree(); t.next(); final byte[] key = t.nextTok(); if(j < key.length) { j = key.length; // write index and pointer on first token ind.add(j); ind.add(tr); } for(int i = 0; i < j; ++i) outY.write1(key[i]); // write pointer on full-text data outY.write5(dr); // write full-text data size (number of pre values) outY.write4(t.nextNumPre()); // write compressed pre and pos arrays writeFTData(outZ, t.nextPres(), t.nextPoss()); dr = outZ.size(); tr = (int) outY.size(); } writeInd(outX, ind, ++j, tr); outX.close(); outY.close(); outZ.close(); tree.initFT(); // increase split counter splits++; } /** * Merges temporary indexes for the current token. * @param out full-text data * @param il array mapping * @param v full-text list * @return written size * @throws IOException I/O exception */ private static int merge(final DataOutput out, final IntList il, final FTList[] v) throws IOException { int s = 0; final TokenBuilder tbp = new TokenBuilder(); final TokenBuilder tbo = new TokenBuilder(); tbp.add(new byte[4]); tbo.add(new byte[4]); // merge full-text data of all sorted lists with the same token for(int j = 0; j < il.size(); ++j) { final int m = il.get(j); for(final int p : v[m].prv) tbp.add(Num.num(p)); for(final int p : v[m].pov) tbo.add(Num.num(p)); s += v[m].size; v[m].next(); } // write compressed pre and pos arrays final byte[] pr = tbp.finish(); Num.size(pr, pr.length); final byte[] po = tbo.finish(); Num.size(po, po.length); // write full-text data writeFTData(out, pr, po); return s; } /** * Writes full-text data for a single token to disk.
* Format: {@code score? pre1 pos1 pre2 pos2 ... (0 score)? pre...} * @param out DataOutput for disk access * @param vpre compressed pre values * @param vpos compressed pos values * @throws IOException IOException */ private static void writeFTData(final DataOutput out, final byte[] vpre, final byte[] vpos) throws IOException { int np = 4, pp = 4; final int ns = Num.size(vpre); while(np < ns) { // full-text data is stored here, with -scoreU, pre1, pos1, ..., // -scoreU, preU, posU for(final int l = np + Num.length(vpre, np); np < l; ++np) out.write(vpre[np]); for(final int l = pp + Num.length(vpos, pp); pp < l; ++pp) out.write(vpos[pp]); } } /** * Checks if any unprocessed pre values are remaining. * @param lists lists * @return boolean */ private static boolean check(final FTList[] lists) { for(final FTList l : lists) if(l.tok.length > 0) return true; return false; } @Override public void abort() { data.meta.drop(DATAFTX + ".*"); data.meta.ftxtindex = false; } @Override protected String det() { return INDEX_FULLTEXT_D; } } basex-7.7.2/basex-core/src/main/java/org/basex/index/ft/FTIndex.java000066400000000000000000000334211222453003200250660ustar00rootroot00000000000000package org.basex.index.ft; import static org.basex.core.Text.*; import static org.basex.data.DataText.*; import static org.basex.util.Token.*; import static org.basex.util.ft.FTFlag.*; import java.io.*; import org.basex.core.*; import org.basex.data.*; import org.basex.index.*; import org.basex.index.query.*; import org.basex.index.stats.*; import org.basex.io.random.*; import org.basex.query.ft.*; import org.basex.util.*; import org.basex.util.ft.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** *

This class provides access to a fuzzy full-text index structure * stored on disk. Each token has an entry in sizes, saving its length and a * pointer on ftdata, where to find the token and its ftdata. * The three database index files start with the prefix * {@link DataText#DATAFTX} and have the following format:

* *
    *
  • File x contains an entry for each token length:
    * Structure: {@code [l, p] ...}
    * {@code l} is the length of a token [byte].
    * {@code p} is the pointer of the first token with length {@code l} [int]. *
  • *
  • File y contains the tokens and references:
    * Structure: {@code [t0, t1, ... tl, z, s]}
    * {@code t0, t1, ... tl-1} is the token [byte[l]]
    * {@code z} is the pointer on the data entries of the token [long]
    * {@code s} is the number of pre values, saved in data [int] *
  • *
  • File z contains the {@code id/pos} references. * The values are ordered, but not distinct:
    * {@code pre1/pos1, pre2/pos2, pre3/pos3, ...} [{@link Num}]
  • *
* * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FTIndex implements Index { /** Entry size. */ private static final int ENTRY = 9; /** Cached texts. Increases used memory, but speeds up repeated queries. */ private final IntObjMap ctext = new IntObjMap(); /** Levenshtein reference. */ private final Levenshtein ls = new Levenshtein(); /** Data reference. */ private final Data data; /** Index storing each unique token length and pointer * on the first token with this length. */ private final DataAccess inX; /** Index storing each token, its data size and pointer on the data. */ final DataAccess inY; /** Storing pre and pos values for each token. */ final DataAccess inZ; /** Cache for number of hits and data reference per token. */ final IndexCache cache = new IndexCache(); /** Token positions. */ final int[] tp; /** * Constructor, initializing the index structure. * @param d data reference * @throws IOException I/O Exception */ public FTIndex(final Data d) throws IOException { data = d; // cache token length index inY = new DataAccess(d.meta.dbfile(DATAFTX + 'y')); inZ = new DataAccess(d.meta.dbfile(DATAFTX + 'z')); inX = new DataAccess(d.meta.dbfile(DATAFTX + 'x')); tp = new int[d.meta.maxlen + 3]; for(int i = 0; i < tp.length; ++i) tp[i] = -1; int is = inX.readNum(); while(--is >= 0) { int p = inX.readNum(); final int r; if(p < tp.length) { r = inX.read4(); } else { // legacy issue (7.0.2 -> 7.1) r = p << 24 | (inX.read1() & 0xFF) << 16 | (inX.read1() & 0xFF) << 8 | inX.read1() & 0xFF; p = p >> 8 | 0x40; } tp[p] = r; } tp[tp.length - 1] = (int) inY.length(); } @Override public synchronized void init() { } @Override public synchronized int count(final IndexToken it) { final byte[] tok = it.get(); if(tok.length > data.meta.maxlen) return Integer.MAX_VALUE; // estimate costs for queries which stretch over multiple index entries final FTOpt opt = ((FTLexer) it).ftOpt(); if(opt.is(FZ) || opt.is(WC)) return Math.max(1, data.meta.size / 10); return entry(tok).size; } @Override public synchronized IndexIterator iter(final IndexToken it) { final byte[] tok = it.get(); // wildcard search final FTOpt opt = ((FTLexer) it).ftOpt(); if(opt.is(WC)) return wc(tok); // fuzzy search if(opt.is(FZ)) { final int k = data.meta.prop.num(Prop.LSERROR); return fuzzy(tok, k == 0 ? tok.length >> 2 : k); } // return cached or new result final IndexEntry e = entry(tok); return e.size > 0 ? iter(e.pointer, e.size, inZ) : FTIndexIterator.FTEMPTY; } /** * Returns a cache entry. * @param token token to be found or cached * @return cache entry */ private IndexEntry entry(final byte[] token) { final IndexEntry e = cache.get(token); if(e != null) return e; final long p = token(token); return p == -1 ? new IndexEntry(token, 0, 0) : cache.add(token, size(p, token.length), pointer(p, token.length)); } @Override public EntryIterator entries(final IndexEntries entries) { final byte[] prefix = entries.get(); return new EntryIterator() { int ti = prefix.length - 1, i, e, nr; boolean inner; @Override public synchronized byte[] next() { if(inner && i < e) { // loop through all entries with the same character length final byte[] entry = inY.readBytes(i, ti); if(startsWith(entry, prefix)) { final long poi = inY.read5(); nr = inY.read4(); if(prefix.length != 0) cache.add(entry, nr, poi); i += ti + ENTRY; return entry; } } // find next available entry group while(++ti < tp.length - 1) { i = tp[ti]; if(i == -1) continue; int c = ti + 1; do e = tp[c++]; while(e == -1); nr = 0; inner = true; i = find(prefix, i, e, ti); // jump to inner loop final byte[] n = next(); if(n != null) return n; } // all entries processed: return null return null; } @Override public int count() { return nr; } }; } /** * Binary search. * @param token token to look for * @param i start position * @param e end position * @param ti entry length * @return position where the key was found, or would have been found */ int find(final byte[] token, final int i, final int e, final int ti) { final int tl = ti + ENTRY; int l = 0, h = (e - i) / tl; while(l <= h) { final int m = l + h >>> 1; final int p = i + m * tl; byte[] txt = ctext.get(p); if(txt == null) { txt = inY.readBytes(p, ti); ctext.put(p, txt); } final int d = diff(txt, token); if(d == 0) return i + m * tl; if(d < 0) l = m + 1; else h = m - 1; } return i + l * tl; } @Override public synchronized byte[] info() { final TokenBuilder tb = new TokenBuilder(); tb.add(LI_STRUCTURE + FUZZY + NL); tb.addExt("- %: %" + NL, STEMMING, Util.flag(data.meta.stemming)); tb.addExt("- %: %" + NL, CASE_SENSITIVITY, Util.flag(data.meta.casesens)); tb.addExt("- %: %" + NL, DIACRITICS, Util.flag(data.meta.diacritics)); if(!data.meta.stopwords.isEmpty()) tb.addExt("- %: %" + NL, STOPWORD_LIST, data.meta.stopwords); if(data.meta.language != null) tb.addExt("- %: %" + NL, LANGUAGE, data.meta.language); final long l = inX.length() + inY.length() + inZ.length(); tb.add(LI_SIZE + Performance.format(l, true) + NL); final IndexStats stats = new IndexStats(data.meta.prop.num(Prop.MAXSTAT)); addOccs(stats); stats.print(tb); return tb.finish(); } @Override public synchronized void close() { inX.close(); inY.close(); inZ.close(); } /** * Determines the pointer on a token. * @param token token looking for * @return int pointer or {@code -1} if token was not found */ private int token(final byte[] token) { final int tl = token.length; // left limit int l = tp[tl]; if(l == -1) return -1; int i = 1; int r; // find right limit do r = tp[tl + i++]; while(r == -1); final int x = r; // binary search final int o = tl + ENTRY; while(l < r) { final int m = l + (r - l >> 1) / o * o; final int c = diff(inY.readBytes(m, tl), token); if(c == 0) return m; if(c < 0) l = m + o; else r = m - o; } // accept entry if pointer is inside relevant tokens return r != x && l == r && eq(inY.readBytes(l, tl), token) ? l : -1; } /** * Collects all tokens and their sizes found in the index structure. * @param stats statistics */ private void addOccs(final IndexStats stats) { int i = 0; while(i < tp.length && tp[i] == -1) ++i; int p = tp[i]; int j = i + 1; while(j < tp.length && tp[j] == -1) ++j; while(p < tp[tp.length - 1]) { if(stats.adding(size(p, i))) stats.add(inY.readBytes(p, i)); p += i + ENTRY; if(p == tp[j]) { i = j; while(j + 1 < tp.length && tp[++j] == -1); } } } /** * Gets the pointer on ftdata for a token. * @param pt pointer on token * @param lt length of the token * @return int pointer on ftdata */ private long pointer(final long pt, final int lt) { return inY.read5(pt + lt); } /** * Reads the size of ftdata from disk. * @param pt pointer on token * @param lt length of the token * @return size of the ftdata */ private int size(final long pt, final int lt) { return inY.read4(pt + lt + 5); } /** * Performs a fuzzy search for the specified token with a maximum number of errors. * @param token token to look for * @param k number of errors allowed * @return iterator */ private synchronized IndexIterator fuzzy(final byte[] token, final int k) { FTIndexIterator it = FTIndexIterator.FTEMPTY; final int tl = token.length; final int e = Math.min(tp.length - 1, tl + k); int s = Math.max(1, tl - k) - 1; while(++s <= e) { int p = tp[s]; if(p == -1) continue; int i = s + 1; int r = -1; while(i < tp.length && r == -1) r = tp[i++]; while(p < r) { if(ls.similar(inY.readBytes(p, s), token, k)) { it = FTIndexIterator.union(iter(pointer(p, s), size(p, s), inZ), it); } p += s + ENTRY; } } return it; } /** * Performs a wildcard search for the specified token. * @param token token to look for * @return iterator */ private synchronized IndexIterator wc(final byte[] token) { final FTIndexIterator it = FTIndexIterator.FTEMPTY; final FTWildcard wc = new FTWildcard(token); if(!wc.parse()) return it; final IntList pr = new IntList(); final IntList ps = new IntList(); final byte[] pref = wc.prefix(); final int l = Math.min(tp.length - 1, wc.max()); for(int ti = pref.length; ti <= l; ti++) { int i = tp[ti]; if(i == -1) continue; int c = ti + 1; int e = -1; while(c < tp.length && e == -1) e = tp[c++]; i = find(pref, i, e, ti); while(i < e) { final byte[] t = inY.readBytes(i, ti); if(!startsWith(t, pref)) break; if(wc.match(t)) { inZ.cursor(pointer(i, ti)); final int s = size(i, ti); for(int d = 0; d < s; d++) { pr.add(inZ.readNum()); ps.add(inZ.readNum()); } } i += ti + ENTRY; } } return iter(new FTCache(pr, ps)); } /** * Returns an iterator for an index entry. * @param off offset on entries * @param size number of id/pos entries * @param da data source * @return iterator */ private FTIndexIterator iter(final long off, final int size, final DataAccess da) { da.cursor(off); final IntList pr = new IntList(size); final IntList ps = new IntList(size); for(int c = 0; c < size; c++) { pr.add(da.readNum()); ps.add(da.readNum()); } return iter(new FTCache(pr, ps)); } /** * Returns an iterator for an index entry. * @param ftc id cache * @return iterator */ private synchronized FTIndexIterator iter(final FTCache ftc) { final int size = ftc.pre.size(); return new FTIndexIterator() { final FTMatches all = new FTMatches(toknum); int pre, c; @Override public synchronized boolean more() { if(c == size) return false; all.reset(toknum); pre = ftc.pre.get(ftc.order[c]); all.or(ftc.pos.get(ftc.order[c++])); while(c < size && pre == ftc.pre.get(ftc.order[c])) { all.or(ftc.pos.get(ftc.order[c++])); } return true; } @Override public synchronized FTMatches matches() { return all; } @Override public synchronized int next() { return pre; } @Override public synchronized int size() { return size; } @Override public String toString() { return Integer.toString(size); } }; } /** * Full-text cache. */ static final class FTCache { /** Order. */ final int[] order; /** Pre values. */ final IntList pre; /** Pos values. */ final IntList pos; /** * Constructor. * @param pr pre values * @param ps positions */ FTCache(final IntList pr, final IntList ps) { final int s = pr.size(); final double[] v = new double[s]; for(int i = 0; i < s; i++) v[i] = (long) pr.get(i) << 32 | ps.get(i); order = Array.createOrder(v, true); pre = pr; pos = ps; } } } basex-7.7.2/basex-core/src/main/java/org/basex/index/ft/FTIndexTree.java000066400000000000000000000052501222453003200257050ustar00rootroot00000000000000package org.basex.index.ft; import org.basex.index.*; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * This class indexes full-text tokens in a balanced binary tree, including * their pre and pos values. An iterator returns all compressed pre and pos * values in a sorted manner. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Sebastian Gath */ final class FTIndexTree extends IndexTree { /** Compressed pre values. */ private TokenList poss = new TokenList(FACTOR); /** Tree structure [left, right, parent]. */ private IntList numpre = new IntList(FACTOR); /** Current pointer on token in the index. */ private int lcn; /** Current pointer on ft data in the index. */ private int pft; /** * Checks if the specified token was already indexed. If yes, its pre * value is added to the existing values. Otherwise a new index entry * is created. * @param tok token to be indexed * @param pre pre value for the token * @param pos pos value of the token * @param cf current file id */ void index(final byte[] tok, final int pre, final int pos, final int cf) { final int os = keys.size(); final int n = index(tok, pre, cf == 0); if(os == keys.size()) { final int i = cf > 0 ? maps.get(Num.num(n)) : n; if(poss.size() > i && poss.get(i) != null) { poss.set(i, Num.add(poss.get(i), pos)); numpre.set(i, numpre.get(i) + 1); return; } } poss.add(Num.newNum(pos)); numpre.add(1); } /** * Initializes the tree for adding new full-text data. */ void initFT() { poss = new TokenList(FACTOR); values = new TokenList(FACTOR); numpre = new IntList(FACTOR); maps = new TokenIntMap(); } /** * Checks for more tokens. * @param cf current index split counter * @return boolean more */ boolean more(final int cf) { while(more()) { lcn = cn; // write compressed representation if the index has already been split pft = cf > 0 ? maps.get(Num.num(lcn)) : lcn; if(pft > -1) return true; next(); } return false; } /** * Returns the next token. * @return byte[] next token */ byte[] nextTok() { return keys.get(lcn); } /** * Returns the next pre values. * @return byte[] compressed pre values */ byte[] nextPres() { return values.get(pft); } /** * Returns the next pos values. * @return byte[] compressed pos values */ byte[] nextPoss() { return poss.get(pft); } /** * Returns the next number of pre values. * @return number of pre values */ int nextNumPre() { return numpre.get(pft); } } basex-7.7.2/basex-core/src/main/java/org/basex/index/ft/FTIndexTrees.java000066400000000000000000000033051222453003200260670ustar00rootroot00000000000000package org.basex.index.ft; /** * This class provides an array with several {@link FTIndexTree} instances, * one for each token length. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Sebastian Gath */ final class FTIndexTrees { /** For each key length, an extra tree is created. */ final FTIndexTree[] trees; /** Pointer on current tree. */ private int ctree; /** * Constructor. * @param size number of tree instances */ FTIndexTrees(final int size) { trees = new FTIndexTree[size + 1]; } /** * Indexes a token with full-text data. * @param tok token to be indexed * @param pre pre value for the token * @param pos pos value of the token * @param cf current file id */ void index(final byte[] tok, final int pre, final int pos, final int cf) { final int tl = tok.length; if(trees[tl] == null) trees[tl] = new FTIndexTree(); trees[tl].index(tok, pre, pos, cf); } /** * Initializes all trees for adding new full-text data. */ void initFT() { for(final FTIndexTree tree : trees) if(tree != null) tree.initFT(); } /** * Initializes all trees for iterative traversal. */ void init() { for(final FTIndexTree tree : trees) if(tree != null) tree.init(); ctree = -1; } /** * Checks for more tokens. * @param cf current index split counter * @return boolean more */ boolean more(final int cf) { if(ctree != -1 && trees[ctree].more(cf)) return true; while(++ctree < trees.length) if(trees[ctree] != null) return more(cf); return false; } /** * Returns the next token. * @return byte[] next token */ FTIndexTree nextTree() { return trees[ctree]; } } basex-7.7.2/basex-core/src/main/java/org/basex/index/ft/FTList.java000066400000000000000000000061261222453003200247340ustar00rootroot00000000000000package org.basex.index.ft; import static org.basex.data.DataText.*; import static org.basex.util.Token.*; import java.io.*; import org.basex.data.*; import org.basex.io.*; import org.basex.io.random.*; /** * This class provides temporary access to sorted list data. * * @author BaseX Team 2005-12, BSD License * @author Sebastian Gath */ final class FTList { /** Empty integer array. */ private static final int[] NOINTS = {}; /** Storing pre and pos values for each token. */ private final DataAccess dat; /** Structure file. */ private final IOFile files; /** Data file. */ private final IOFile filed; /** Wasted flag. */ private boolean wasted; /** Size file. */ private final IOFile sizes; /** Token positions. */ private final int[] tp; /** Pointer on current token length. */ private int ctl; /** Pointer on next token length. */ private int ntl; /** Number of written bytes for tokens. */ private int ptok; /** Indexed tokens. */ private final DataAccess str; /** Current data size. */ int size; /** Next token. */ byte[] tok; /** Next pre values. */ int[] prv; /** Next pos values. */ int[] pov; /** * Constructor, initializing the index structure. * @param d data * @param cf prefix * @throws IOException I/O exception */ FTList(final Data d, final int cf) throws IOException { files = d.meta.dbfile(DATAFTX + cf + 'y'); filed = d.meta.dbfile(DATAFTX + cf + 'z'); str = new DataAccess(files); dat = new DataAccess(filed); tp = new int[d.meta.maxlen + 3]; for(int i = 0; i < tp.length; ++i) tp[i] = -1; sizes = d.meta.dbfile(DATAFTX + cf + 'x'); final DataAccess li = new DataAccess(sizes); int is = li.readNum(); while(--is >= 0) { final int p = li.readNum(); tp[p] = li.read4(); } tp[tp.length - 1] = (int) str.length(); li.close(); next(); } /** * Checks if more tokens are found. */ void next() { if(wasted) return; tok = token(); if(tok.length == 0) { wasted = true; prv = NOINTS; pov = NOINTS; close(); } else { prv = new int[size]; pov = new int[size]; for(int j = 0; j < size; ++j) { prv[j] = dat.readNum(); pov[j] = dat.readNum(); } } } /** * Closes and deletes the input files. */ private void close() { str.close(); dat.close(); files.delete(); filed.delete(); sizes.delete(); } /** * Returns next token. * @return byte[] token */ private byte[] token() { if(tp[tp.length - 1] == ptok) return EMPTY; if(tp[ntl] == ptok || ntl == 0) { ++ctl; while(tp[ctl] == -1) ++ctl; ntl = ctl + 1; while(tp[ntl] == -1) ++ntl; } if(ctl == tp.length) return EMPTY; final byte[] t = str.readBytes(ptok, ctl); // skip pointer size = str.read4(str.cursor() + 5); // position will always fit in an integer... ptok = (int) str.cursor(); return t; } } basex-7.7.2/basex-core/src/main/java/org/basex/index/name/000077500000000000000000000000001222453003200232265ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/index/name/Names.java000066400000000000000000000100551222453003200251350ustar00rootroot00000000000000package org.basex.index.name; import java.io.*; import org.basex.core.*; import org.basex.data.*; import org.basex.index.*; import org.basex.index.query.*; import org.basex.index.stats.*; import org.basex.io.in.DataInput; import org.basex.io.out.DataOutput; import org.basex.util.*; import org.basex.util.hash.*; /** * This class indexes and organizes the tags or attribute names, * used in an XML document. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Lukas Kircher */ public final class Names extends TokenSet implements Index { /** Statistical information. */ Stats[] stats; /** Meta data. */ private final MetaData meta; /** * Default constructor. * @param md meta data */ public Names(final MetaData md) { stats = new Stats[Array.CAPACITY]; meta = md; } /** * Constructor, specifying an input file. * @param in input stream * @param md meta data * @throws IOException I/O exception */ public Names(final DataInput in, final MetaData md) throws IOException { super(in); stats = new Stats[keys.length]; meta = md; for(int s = 1; s < size; ++s) stats[s] = new Stats(in); } @Override public void init() { for(int s = 1; s < size; ++s) stats[s] = new Stats(); } /** * Indexes a name and returns its unique id. * @param n name to be added * @param v value, added to statistics * @param st statistics flag * @return name id */ public int index(final byte[] n, final byte[] v, final boolean st) { final int id = put(n); if(st) { if(stats[id] == null) stats[id] = new Stats(); final Stats stat = stats[id]; if(v != null) stat.add(v, meta); stat.count++; } return id; } /** * Adds a value to the statistics of the specified key. * Evaluates the value for the specified key id. * @param n name id * @param v value, added to statistics */ public void index(final int n, final byte[] v) { stats[n].add(v, meta); } @Override public void write(final DataOutput out) throws IOException { super.write(out); for(int s = 1; s < size; ++s) { if(stats[s] == null) stats[s] = new Stats(); stats[s].write(out); } } /** * Returns the statistics for the specified key id. * @param id id * @return statistics */ public Stats stat(final int id) { return stats[id]; } @Override public byte[] info() { final int[] tl = new int[size]; int len = 0; tl[0] = 0; for(int i = 1; i < size; ++i) { if(len < keys[i].length) len = keys[i].length; if(stats[i] == null) continue; tl[i] = stats[i].count; } len += 2; // print all entries in descending number of occurrences final int[] ids = Array.createOrder(tl, false); final TokenBuilder tb = new TokenBuilder(); tb.add(Text.LI_STRUCTURE + Text.HASH + Text.NL); tb.add(Text.LI_ENTRIES + (size - 1) + Text.NL); for(int i = 0; i < size - 1; ++i) { final int s = ids[i]; if(stats[s] == null) continue; final byte[] key = keys[s]; tb.add(" "); tb.add(key); for(int j = 0; j < len - key.length; ++j) tb.add(' '); tb.add(stats[s] + Text.NL); } return tb.finish(); } @Override public EntryIterator entries(final IndexEntries entries) { return new EntryIterator() { int c; @Override public byte[] next() { return ++c < size ? keys[c] : null; } @Override public int count() { return stats[c].count; } }; } @Override protected void rehash(final int s) { super.rehash(s); stats = Array.copy(stats, new Stats[s]); } @Override public void close() { } // Unsupported methods ====================================================== @Override public IndexIterator iter(final IndexToken token) { throw Util.notexpected(); } @Override public int count(final IndexToken token) { throw Util.notexpected(); } } basex-7.7.2/basex-core/src/main/java/org/basex/index/package.html000066400000000000000000000000531222453003200245650ustar00rootroot00000000000000 Database Index structures. basex-7.7.2/basex-core/src/main/java/org/basex/index/path/000077500000000000000000000000001222453003200232425ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/index/path/PathNode.java000066400000000000000000000126631222453003200256170ustar00rootroot00000000000000package org.basex.index.path; import static org.basex.data.DataText.*; import java.io.*; import java.util.*; import org.basex.core.*; import org.basex.data.*; import org.basex.index.stats.*; import org.basex.io.in.DataInput; import org.basex.io.out.DataOutput; import org.basex.util.*; /** * This class represents a node of the path summary. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class PathNode { /** Tag/attribute name id. */ public final short name; /** Node kind, defined in the {@link Data} class. */ public final byte kind; /** Parent. */ public final PathNode par; /** Children. */ public PathNode[] ch; /** Node kind. */ public final Stats stats; /** * Empty constructor. */ PathNode() { this(0, Data.DOC, null, 0); } /** * Default constructor. * @param n node name * @param k node kind * @param p parent node */ PathNode(final int n, final byte k, final PathNode p) { this(n, k, p, 1); } /** * Default constructor. * @param n node name * @param k node kind * @param p parent node * @param c counter */ PathNode(final int n, final byte k, final PathNode p, final int c) { ch = new PathNode[0]; name = (short) n; kind = k; par = p; stats = new Stats(); stats.count = c; } /** * Constructor, specifying an input stream. * @param in input stream * @param p parent node * @throws IOException I/O exception */ PathNode(final DataInput in, final PathNode p) throws IOException { name = (short) in.readNum(); kind = (byte) in.read(); final int s = in.readNum(); ch = new PathNode[in.readNum()]; if(in.readDouble() == 1) { // "1" indicates the format introduced with Version 7.1 stats = new Stats(in); } else { // create old format stats = new Stats(); stats.count = s; } par = p; for(int i = 0; i < ch.length; ++i) ch[i] = new PathNode(in, this); } /** * Indexes the specified name along with its kind. * @param n name id * @param k node kind * @param v value * @param md meta data * @return node reference */ PathNode index(final int n, final byte k, final byte[] v, final MetaData md) { for(final PathNode c : ch) { if(c.kind == k && c.name == n) { if(v != null) c.stats.add(v, md); c.stats.count++; return c; } } final PathNode pn = new PathNode(n, k, this); if(v != null) pn.stats.add(v, md); final int cs = ch.length; final PathNode[] tmp = new PathNode[cs + 1]; System.arraycopy(ch, 0, tmp, 0, cs); tmp[cs] = pn; ch = tmp; return pn; } /** * Writes the node to the specified output stream. * @param out output stream * @throws IOException I/O exception */ void write(final DataOutput out) throws IOException { out.writeNum(name); out.write1(kind); out.writeNum(0); out.writeNum(ch.length); out.writeDouble(1); // update leaf flag boolean leaf = stats.isLeaf(); for(final PathNode c : ch) { leaf &= c.kind == Data.TEXT || c.kind == Data.ATTR; } stats.setLeaf(leaf); stats.write(out); for(final PathNode c : ch) c.write(out); } /** * Recursively adds the node and its descendants to the specified list. * @param nodes node list */ void addDesc(final ArrayList nodes) { nodes.add(this); for(final PathNode n : ch) n.addDesc(nodes); } /** * Recursively adds the node and its descendants to the specified list * with the specified name. * @param nodes node list * @param n name id * @param k node kind */ void addDesc(final ArrayList nodes, final int n, final int k) { if(n == name && k == kind) nodes.add(this); for(final PathNode pn : ch) pn.addDesc(nodes, n, k); } /** * Returns a readable representation of this node. * @param data data reference * @return completions */ public byte[] token(final Data data) { switch(kind) { case Data.ELEM: return data.tagindex.key(name); case Data.ATTR: return Token.concat(ATT, data.atnindex.key(name)); case Data.TEXT: return TEXT; case Data.COMM: return COMM; case Data.PI: return PI; default: return Token.EMPTY; } } /** * Returns the level of the path node. * @return level */ public int level() { PathNode pn = par; int c = 0; while(pn != null) { pn = pn.par; ++c; } return c; } /** * Returns a string representation of a path summary node. * @param data data reference * @param l level * @return string representation */ byte[] info(final Data data, final int l) { final TokenBuilder tb = new TokenBuilder(); if(l != 0) tb.add(Text.NL); for(int i = 0; i < l << 1; ++i) tb.add(' '); switch(kind) { case Data.DOC: tb.add(DOC); break; case Data.ELEM: tb.add(data.tagindex.key(name)); break; case Data.TEXT: tb.add(TEXT); break; case Data.ATTR: tb.add(ATT); tb.add(data.atnindex.key(name)); break; case Data.COMM: tb.add(COMM); break; case Data.PI: tb.add(PI); break; } tb.add(": " + stats); for(final PathNode p : ch) tb.add(p.info(data, l + 1)); return tb.finish(); } } basex-7.7.2/basex-core/src/main/java/org/basex/index/path/PathSummary.java000066400000000000000000000157171222453003200263720ustar00rootroot00000000000000package org.basex.index.path; import static org.basex.util.Token.*; import java.io.*; import java.util.*; import org.basex.data.*; import org.basex.index.*; import org.basex.index.query.*; import org.basex.io.in.DataInput; import org.basex.io.out.DataOutput; import org.basex.util.*; import org.basex.util.list.*; /** * This class stores the path summary of a database. * It contains all unique location paths. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class PathSummary implements Index { /** Node stack for building the summary. */ private final ArrayList stack = new ArrayList(); /** Data reference. */ private Data data; /** Root node. */ private PathNode root; /** * Constructor. * The {@link Data} reference must be set in a second step via {@link #data(Data)}. */ public PathSummary() { init(); } /** * Constructor, specifying a data reference. * @param d data reference */ public PathSummary(final Data d) { this(); data = d; } /** * Constructor, specifying an input file. * @param d data reference * @param in input stream * @throws IOException I/O exception */ public PathSummary(final Data d, final DataInput in) throws IOException { root = in.readBool() ? new PathNode(in, null) : new PathNode(); data = d; } /** * Writes the path summary to the specified output. * @param out output stream * @throws IOException I/O exception */ public void write(final DataOutput out) throws IOException { out.writeBool(root != null); if(root != null) root.write(out); } /** * Sets the data reference. * @param d reference */ public void data(final Data d) { data = d; } @Override public void init() { root = new PathNode(); stack.clear(); stack.add(root); } @Override public void close() { } // Build Index ============================================================== /** * Adds an entry. * @param n name reference (0 for nodes other than element and attributes) * @param k node kind * @param l current level */ public void put(final int n, final byte k, final int l) { put(n, k, l, null, null); } /** * Adds an entry, including its value. * @param n name reference (0 for nodes other than element and attributes) * @param k node kind * @param l current level * @param v value * @param md meta data */ public void put(final int n, final byte k, final int l, final byte[] v, final MetaData md) { if(l == 0) { if(v != null) root.stats.add(v, md); root.stats.count++; } else { while(l >= stack.size()) stack.add(null); stack.set(l, stack.get(l - 1).index(n, k, v, md)); } } // Traverse Index =========================================================== /** * Returns the root node. * @return root node */ public ArrayList root() { final ArrayList out = new ArrayList(); out.add(root); return out; } /** * Returns all parents of the specified nodes. * Used by the query optimizers. * @param in input nodes * @return parent nodes */ public static ArrayList parent(final ArrayList in) { final ArrayList out = new ArrayList(); for(final PathNode n : in) if(!out.contains(n.par)) out.add(n.par); return out; } /** * Returns all children or descendants of the specified nodes. * Called from the query parser and optimizer. * @param in input nodes * @param desc if false, return only children * @return descendant nodes */ public static ArrayList desc(final ArrayList in, final boolean desc) { final ArrayList out = new ArrayList(); for(final PathNode n : in) { for(final PathNode c : n.ch) { if(desc) c.addDesc(out); else if(!out.contains(c)) out.add(c); } } return out; } /** * Returns all children or descendants of the specified nodes with the * specified tag or attribute value. Called from the query optimizer. * @param n name reference * @param k node kind * @return descendant nodes */ public ArrayList desc(final int n, final int k) { final ArrayList out = new ArrayList(); for(final PathNode c : root.ch) c.addDesc(out, n, k); return out; } /** * Returns descendant tags and attributes for the specified start key. * Used by the GUI. * @param k input key * @param d if false, return only children * @param o true/false: sort by occurrence/lexicographically * @return children */ public TokenList desc(final byte[] k, final boolean d, final boolean o) { final TokenList tl = new TokenList(); if(k.length != 0) tl.add(k); return desc(tl, d, o); } /** * Returns descendant tags and attributes for the specified descendant path. * Used by the GUI. * @param tl input steps * @param d if false, return only children * @param o true/false: sort by occurrence/lexicographically * @return children */ public TokenList desc(final TokenList tl, final boolean d, final boolean o) { // follow the specified descendant/child steps ArrayList in = desc(root(), true); for(final byte[] i : tl) { final boolean att = startsWith(i, '@'); final byte kind = att ? Data.ATTR : Data.ELEM; final int id = att ? data.atnindex.id(substring(i, 1)) : data.tagindex.id(i); final ArrayList out = new ArrayList(); for(final PathNode n : in) { if(n.name != id || n.kind != kind) continue; for(final PathNode c : n.ch) { if(d) c.addDesc(out); else out.add(c); } } in = out; } // sort by number of occurrences final int[] tmp = new int[in.size()]; for(int i = 0; i < in.size(); ++i) tmp[i] = in.get(i).stats.count; final int[] occ = Array.createOrder(tmp, false); // remove non-text/attribute nodes final TokenList out = new TokenList(); for(int i = 0; i < in.size(); ++i) { final PathNode r = in.get(o ? occ[i] : i); final byte[] name = r.token(data); if(name.length != 0 && !out.contains(name) && !contains(name, '(')) { out.add(name); } } if(!o) out.sort(false); return out; } // Info ===================================================================== @Override public byte[] info() { return root != null ? chop(root.info(data, 0), 1 << 20) : EMPTY; } // Unsupported methods ====================================================== @Override public IndexIterator iter(final IndexToken token) { throw Util.notexpected(); } @Override public int count(final IndexToken token) { throw Util.notexpected(); } @Override public EntryIterator entries(final IndexEntries entries) { throw Util.notexpected(); } @Override public String toString() { return string(info()); } } basex-7.7.2/basex-core/src/main/java/org/basex/index/query/000077500000000000000000000000001222453003200234535ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/index/query/EntryIterator.java000066400000000000000000000006721222453003200271360ustar00rootroot00000000000000package org.basex.index.query; /** * This interface provides methods for returning index entries. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class EntryIterator { /** * Returns the next index entry. * @return entry */ public abstract byte[] next(); /** * Returns the number of occurrences of the current token. * @return counter */ public abstract int count(); } basex-7.7.2/basex-core/src/main/java/org/basex/index/query/FTIndexIterator.java000066400000000000000000000066271222453003200273440ustar00rootroot00000000000000package org.basex.index.query; import org.basex.data.*; /** * This interface provides methods for returning index results. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class FTIndexIterator extends IndexIterator { /** Each token in the query has a number. */ public int toknum; /** Empty iterator. */ public static final FTIndexIterator FTEMPTY = new FTIndexIterator() { @Override public boolean more() { return false; } @Override public int next() { return 0; } @Override public FTMatches matches() { return null; } @Override public int size() { return 0; } }; /** * Returns the next match. * @return next match */ public abstract FTMatches matches(); /** * Sets the unique token number. Used for visualization. * @param tn number of tokens */ public void tokenNum(final byte tn) { toknum = tn; } /** * Merges two index array iterators. * @param i1 first index array iterator to merge * @param i2 second index array iterator to merge * @return IndexArrayIterator */ public static FTIndexIterator union(final FTIndexIterator i1, final FTIndexIterator i2) { return new FTIndexIterator() { FTIndexIterator n, r, s; int c; @Override public boolean more() { if(c <= 0) r = i1.more() ? i1 : null; if(c >= 0) s = i2.more() ? i2 : null; c = r != null && s != null ? r.next() - s.next() : r != null ? -1 : 1; n = c <= 0 ? r : s; return n != null; } @Override public FTMatches matches() { final FTMatches m = n.matches(); if(c == 0) for(final FTMatch sm : s.matches()) m.add(sm); return m; } @Override public int next() { return n.next(); } @Override public void tokenNum(final byte tn) { i1.toknum = tn; i2.toknum = tn; } @Override public synchronized int size() { return i1.size() + i2.size(); } @Override public String toString() { return "(" + i1 + " | " + i2 + ')'; } }; } /** * Merges two index array iterators. * @param i1 first index array iterator to merge * @param i2 second index array iterator to merge * @param dis word distance. Ignored if {@code 0} * @return IndexArrayIterator */ public static FTIndexIterator intersect(final FTIndexIterator i1, final FTIndexIterator i2, final int dis) { return new FTIndexIterator() { FTIndexIterator r, s; @Override public boolean more() { int c = 0; while(true) { if(c <= 0) r = i1.more() ? i1 : null; if(c >= 0) s = i2.more() ? i2 : null; if(r == null || s == null) return false; c = r.next() - s.next(); if(c == 0 && (dis == 0 || r.matches().phrase(s.matches(), dis))) return true; } } @Override public FTMatches matches() { return r.matches(); } @Override public int next() { return r.next(); } @Override public void tokenNum(final byte tn) { i1.toknum = tn; i2.toknum = tn; } @Override public synchronized int size() { return Math.min(i1.size(), i2.size()); } @Override public String toString() { return "(" + i1 + " & " + i2 + ')'; } }; } } basex-7.7.2/basex-core/src/main/java/org/basex/index/query/IndexEntries.java000066400000000000000000000024051222453003200267200ustar00rootroot00000000000000package org.basex.index.query; import org.basex.index.*; /** * This class contains information for returning index entries. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class IndexEntries implements IndexToken { /** Index type. */ private final IndexType type; /** Text. */ private final byte[] text; /** Ascending/descending traversal. */ public boolean descending; /** Prefix/traversal flag. */ public boolean prefix; /** * Private constructor. * @param it index type * @param tok token */ private IndexEntries(final IndexType it, final byte[] tok) { type = it; text = tok; } /** * Constructor for prefix search. * @param tok token * @param it index type */ public IndexEntries(final byte[] tok, final IndexType it) { this(it, tok); prefix = true; } /** * Constructor for traversing entries. * @param tok token to start with * @param asc return results in ascending order * @param it index type */ public IndexEntries(final byte[] tok, final boolean asc, final IndexType it) { this(it, tok); descending = !asc; } @Override public IndexType type() { return type; } @Override public byte[] get() { return text; } } basex-7.7.2/basex-core/src/main/java/org/basex/index/query/IndexIterator.java000066400000000000000000000016171222453003200271040ustar00rootroot00000000000000package org.basex.index.query; /** * This interface provides methods for returning index results. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class IndexIterator { /** Empty iterator. */ public static final IndexIterator EMPTY = new IndexIterator() { @Override public boolean more() { return false; } @Override public int next() { return 0; } @Override public int size() { return 0; } }; /** * Returns true if more results are found. * @return size */ public abstract boolean more(); /** * Returns the next result. * @return result */ public abstract int next(); /** * Returns the total number of index results. * The iterator may get exhausted by calling this method. * @return result number of results */ public int size() { int c = 0; while(more()) ++c; return c; } } basex-7.7.2/basex-core/src/main/java/org/basex/index/query/IndexToken.java000066400000000000000000000005711222453003200263710ustar00rootroot00000000000000package org.basex.index.query; import org.basex.index.*; /** * This class defines access to index tokens. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public interface IndexToken { /** * Returns the index type. * @return type */ IndexType type(); /** * Returns the current token. * @return token */ byte[] get(); } basex-7.7.2/basex-core/src/main/java/org/basex/index/query/NumericRange.java000066400000000000000000000014371222453003200267020ustar00rootroot00000000000000package org.basex.index.query; import org.basex.index.*; import org.basex.util.*; /** * This class stores a numeric range for index access. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class NumericRange implements IndexToken { /** Index type. */ public final IndexType type; /** Minimum value. */ public final double min; /** Maximum value. */ public final double max; /** * Constructor. * @param it index type * @param mn minimum value * @param mx maximum value */ public NumericRange(final IndexType it, final double mn, final double mx) { type = it; min = mn; max = mx; } @Override public IndexType type() { return type; } @Override public byte[] get() { return Token.EMPTY; } } basex-7.7.2/basex-core/src/main/java/org/basex/index/query/StringRange.java000066400000000000000000000020701222453003200265400ustar00rootroot00000000000000package org.basex.index.query; import org.basex.index.*; import org.basex.util.*; /** * This class stores a string range for index access. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class StringRange implements IndexToken { /** Index type. */ public final IndexType type; /** Minimum value. */ public final byte[] min; /** Include minimum value. */ public final boolean mni; /** Maximum value. */ public final byte[] max; /** Include maximum value. */ public final boolean mxi; /** * Constructor. * @param it index type (text or attribute) * @param mn minimum value * @param in include minimum value * @param mx maximum value * @param ix include maximum value */ public StringRange(final IndexType it, final byte[] mn, final boolean in, final byte[] mx, final boolean ix) { type = it; min = mn; mni = in; max = mx; mxi = ix; } @Override public IndexType type() { return type; } @Override public byte[] get() { return Token.EMPTY; } } basex-7.7.2/basex-core/src/main/java/org/basex/index/query/StringToken.java000066400000000000000000000012001222453003200265560ustar00rootroot00000000000000package org.basex.index.query; import org.basex.index.*; /** * This class defines access to index text tokens. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class StringToken implements IndexToken { /** Index type. */ private final IndexType type; /** Text. */ private final byte[] text; /** * Constructor. * @param it index type * @param tok token */ public StringToken(final IndexType it, final byte[] tok) { type = it; text = tok; } @Override public IndexType type() { return type; } @Override public byte[] get() { return text; } } basex-7.7.2/basex-core/src/main/java/org/basex/index/resource/000077500000000000000000000000001222453003200241355ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/index/resource/Binaries.java000066400000000000000000000042521222453003200265370ustar00rootroot00000000000000package org.basex.index.resource; import static org.basex.util.Token.*; import java.util.*; import org.basex.core.*; import org.basex.data.*; import org.basex.io.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** *

This index organizes binary files in a database.

* * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class Binaries { /** Data reference. */ private final Data data; /** * Constructor. * @param d data reference */ Binaries(final Data d) { data = d; } /** * Returns the database paths to all binary files that match the * specified path. All paths are relative to the filesystem. * @param path input path * @return root nodes */ synchronized TokenList bins(final String path) { final TokenList tl = new TokenList(); final String np = MetaData.normPath(path); if(np == null || data.inMemory()) return tl; final String exct = Prop.CASE ? np : np.toLowerCase(Locale.ENGLISH); final String pref = exct.endsWith("/") ? exct : exct + '/'; for(final String f : data.meta.binaries().descendants()) { final String lc = Prop.CASE ? f : f.toLowerCase(Locale.ENGLISH); if(exct.isEmpty() || lc.equals(exct) || lc.startsWith(pref)) tl.add(f); } return tl.sort(Prop.CASE); } /** * Adds the database paths for the binaries of the given path to * the given map. * @param path path * @param dir returns directories instead of files * @param tbm map; values will be {@code true} to indicate raw files */ synchronized void children(final byte[] path, final boolean dir, final TokenBoolMap tbm) { if(data.inMemory()) return; final IOFile file = data.meta.binary(string(path)); if(file == null) return; for(final IOFile f : file.children()) { if(!dir ^ f.isDir()) tbm.put(token(f.name()), true); } } /** * Determines whether the given path is the path to a directory. * @param path given path * @return result of check */ synchronized boolean isDir(final String path) { if(data.inMemory()) return false; final IOFile bin = data.meta.binary(path); return bin != null && bin.isDir(); } } basex-7.7.2/basex-core/src/main/java/org/basex/index/resource/Docs.java000066400000000000000000000243121222453003200256720ustar00rootroot00000000000000package org.basex.index.resource; import static org.basex.util.Token.*; import java.io.*; import org.basex.core.*; import org.basex.data.*; import org.basex.data.atomic.*; import org.basex.io.in.DataInput; import org.basex.io.out.DataOutput; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** *

This data structure contains references to all document nodes in a * database. The document nodes are incrementally updated.

* *

If updates are performed, the path order is discarded, as its continuous * update would be more expensive in some cases (e.g. when bulk insertions of * new documents are performed). A tree structure could be introduced to * offer better general performance.

* * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Lukas Kircher */ final class Docs { /** Data reference. */ private final Data data; /** Pre values of document nodes (can be {@code null}). * This variable should always be requested via {@link #docs()}. */ private IntList docList; /** Sorted document paths (can be {@code null}). * This variable should always be requested via {@link #paths()}. */ private TokenList pathList; /** Ordered path indexes (can be {@code null}). * This variable should always be requested via {@link #order()}. */ private int[] pathOrder; /** * Constructor. * @param d data reference */ Docs(final Data d) { data = d; } /** * Reads the document index. * @param in input stream * @throws IOException I/O exception */ synchronized void read(final DataInput in) throws IOException { docList = in.readDiffs(); } /** * Writes the document index. * @param out output stream * @throws IOException I/O exception */ void write(final DataOutput out) throws IOException { out.writeDiffs(docs()); } /** * Initializes the document index. Currently, will only be called if the database is * optimized, and the resource index will be rebuilt. */ synchronized void init() { docList = null; pathList = null; docs(); } /** * Returns the {@code pre} values of all document nodes. * @return document nodes */ synchronized IntList docs() { if(docList == null) { final IntList il = new IntList(); final int is = data.meta.size; for(int i = 0; i < is;) { final int k = data.kind(i); if(k == Data.DOC) il.add(i); i += data.size(i, k); } data.meta.dirty = true; docList = il; } return docList; } /** * Returns the document paths, and initializes them if necessary. * @return document paths */ private synchronized TokenList paths() { if(pathList == null) { final IntList docs = docs(); final int ds = docs.size(); final TokenList paths = new TokenList(ds); for(int d = 0; d < ds; d++) { paths.add(normalize(data.text(docs.get(d), true))); } pathList = paths; } return pathList; } /** * Returns the document path order, and initialize the array if necessary. * @return path order */ private synchronized int[] order() { if(pathOrder == null) { pathOrder = Array.createOrder(paths().toArray(), false, true); } return pathOrder; } /** * Adds entries to the index and updates subsequent nodes. * @param pre insertion position * @param clip data clip */ void insert(final int pre, final DataClip clip) { // find all document nodes in the given data instance final IntList pres = new IntList(); for(int dpre = clip.start; dpre < clip.end;) { final int k = clip.data.kind(dpre); if(k == Data.DOC) pres.add(pre + dpre); dpre += clip.data.size(dpre, k); } // insert DOC nodes and move pre values of following DOC nodes final int[] presA = pres.toArray(); final IntList docs = docs(); final TokenList paths = paths(); int i = docs.sortedIndexOf(pre); if(i < 0) i = -i - 1; docs.insert(i, presA); docs.move(clip.size(), i + pres.size()); final byte[][] t = new byte[presA.length][]; for(int j = 0; j < t.length; j++) { // subtract pre to retrieve paths from given data instance t[j] = normalize(clip.data.text(presA[j] - pre, true)); } paths.insert(i, t); pathOrder = null; } /** * Deletes the specified entry and updates subsequent nodes. * @param pre pre value * @param size number of deleted nodes */ void delete(final int pre, final int size) { final IntList docs = docs(); final TokenList paths = paths(); int i = docs.sortedIndexOf(pre); final boolean found = i >= 0; if(i < 0) i = -i - 1; else docs.deleteAt(i); docs.move(-size, i); if(!found) return; paths.deleteAt(i); pathOrder = null; } /** * Updates the index after a document has been renamed. * @param pre pre value of updated document * @param value new name */ void rename(final int pre, final byte[] value) { final IntList docs = docs(); final TokenList paths = paths(); paths.set(docs.sortedIndexOf(pre), normalize(value)); pathOrder = null; } /** * Replaces entries in the index. * @param pre insertion position * @param size number of deleted nodes * @param clip data clip */ void replace(final int pre, final int size, final DataClip clip) { delete(pre, size); insert(pre, clip); } /** * Returns the pre values of all document nodes matching the specified path. * @param path input path * @param exact exact (no prefix) matches * @return root nodes */ synchronized IntList docs(final String path, final boolean exact) { // invalid path, or no documents: return empty list final String pth = MetaData.normPath(path); if(pth == null) return new IntList(0); // empty path: return all documents final IntList docs = docs(); if(pth.isEmpty()) return docs; // normalize paths byte[] exct = EMPTY; byte[] pref = normalize(token(pth)); // check for explicit directory indicator if(!pth.endsWith("/")) { exct = pref; pref = concat(exct, SLASH); } // relevant paths: exact hits and prefixes final IntList il = new IntList(); /* could be optimized for future access by sorting the paths first * and then accessing only the relevant paths. Sorting might slow down * bulk operations like insert/delete/replace though. */ final TokenList paths = paths(); for(int p = 0; p < paths.size(); p++) { final byte[] b = paths.get(p); if(eq(b, exct) || !exact && startsWith(b, pref)) il.add(docs.get(p)); } return il.sort(); } /** * Returns the pre value of the document node matching the specified path. * Exact match! Document paths can be sorted for faster future access or * sorting can be disabled as it slows down bulk inserts/deletes/replaces. * @param path input path * @param sort sort paths before access * @return root nodes */ synchronized int doc(final String path, final boolean sort) { // invalid or empty path, or no documents: return -1 final String pth = MetaData.normPath(path); if(pth == null || pth.isEmpty()) return -1; // normalize paths final byte[] exct = normalize(token(pth)); // relevant paths: exact match final IntList docs = docs(); final TokenList paths = paths(); final int ts = paths.size(); if(sort) { final int[] order = order(); final int p = find(exct); return p > -1 && p < ts && eq(paths.get(order[p]), exct) ? docs.get(order[p]) : -1; } for(int t = 0; t < ts; t++) { if(eq(paths.get(t), exct)) return docs.get(t); } return -1; } /** * Determines whether the given path is the path to a document directory. * @param path given path (will be normalized by adding a trailing slash) * @return path to a directory or not */ synchronized boolean isDir(final byte[] path) { final byte[] pa = concat(path, SLASH); for(final byte[] b : paths()) if(startsWith(b, pa)) return true; return false; } /** * Adds the database paths for the child documents of the given path to the given map. * @param path path * @param dir returns directories instead of files * @param tbm map; values will be {@code false} to indicate documents */ synchronized void children(final byte[] path, final boolean dir, final TokenBoolMap tbm) { final String pth = MetaData.normPath(string(path)); if(pth == null) return; // normalize root path byte[] root = token(pth); if(root.length != 0) root = concat(root, SLASH); final IntList docs = docs(); final int ds = docs.size(); for(int d = 0; d < ds; d++) { byte[] np = data.text(docs.get(d), true); if(startsWith(np, root)) { np = substring(np, root.length, np.length); final int i = indexOf(np, SLASH); // no more slashes means this must be a leaf if(!dir && i == -1) tbm.put(np, false); else if(dir && i >= 0) tbm.put(substring(np, 0, i), false); } } } /** * Returns the first position matching the specified path * (might equal the array size). * @param v value to be found * @return position */ private int find(final byte[] v) { // binary search final TokenList paths = paths(); final int[] po = pathOrder; int l = 0, h = po.length - 1; while(l <= h) { int m = l + h >>> 1; final int c = diff(paths.get(po[m]), v); if(c == 0) { // find first entry while(m > 0 && eq(paths.get(po[m - 1]), v)) --m; return m; } if(c < 0) l = m + 1; else h = m - 1; } return l; } /** * Returns the normalized index path representation for the specified path. * @param path input path (without leading slash) * @return canonical path */ private static byte[] normalize(final byte[] path) { return concat(SLASH, Prop.CASE ? path : lc(path)); } } basex-7.7.2/basex-core/src/main/java/org/basex/index/resource/Resources.java000066400000000000000000000113401222453003200267510ustar00rootroot00000000000000package org.basex.index.resource; import java.io.*; import org.basex.data.*; import org.basex.data.atomic.*; import org.basex.index.*; import org.basex.index.query.*; import org.basex.io.in.DataInput; import org.basex.io.out.DataOutput; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** *

This index organizes the resources of a database (XML documents and raw files).

* * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Resources implements Index { /** Document references. */ private final Docs docs; /** Binary files. */ private final Binaries bins; /** * Constructor. * @param d data reference */ public Resources(final Data d) { docs = new Docs(d); bins = new Binaries(d); } /** * Reads information on database resources from disk. * @param in input stream * @throws IOException I/O exception */ public synchronized void read(final DataInput in) throws IOException { docs.read(in); } /** * Writes information on database resources to disk. * @param out output stream * @throws IOException I/O exception */ public void write(final DataOutput out) throws IOException { docs.write(out); } /** * Returns the {@code pre} values of all document nodes. * @return document nodes */ public synchronized IntList docs() { return docs.docs(); } @Override public synchronized void init() { docs.init(); } /** * Adds entries to the index and updates subsequent nodes. * @param pre insertion position * @param clip data clip */ public void insert(final int pre, final DataClip clip) { docs.insert(pre, clip); } /** * Deletes the specified entry and updates subsequent nodes. * @param pre pre value * @param size number of deleted nodes */ public void delete(final int pre, final int size) { docs.delete(pre, size); } /** * Updates the index after a document has been renamed. * @param pre pre value of updated document * @param value new name */ public void rename(final int pre, final byte[] value) { docs.rename(pre, value); } /** * Replaces entries in the index. * @param pre insertion position * @param size number of deleted nodes * @param clip data clip */ public void replace(final int pre, final int size, final DataClip clip) { docs.replace(pre, size, clip); } /** * Returns the pre values of all document nodes starting with the specified path. * @param path input path * @return root nodes */ public synchronized IntList docs(final String path) { return docs.docs(path, false); } /** * Returns the pre values of all document nodes matching the specified path. * @param path input path * @param exact exact (no prefix) matches * @return root nodes */ public synchronized IntList docs(final String path, final boolean exact) { return docs.docs(path, exact); } /** * Returns the pre value of the node that matches the specified path, or {@code -1}. * @param path input path * @return pre value */ public int doc(final String path) { return docs.doc(path, true); } /** * Returns the database paths to all binary files that match the * specified path. * @param path input path * @return root nodes */ public synchronized TokenList binaries(final String path) { return bins.bins(path); } /** * Determines whether the given path is the path to a directory. * @param path given path * @return result of check */ public synchronized boolean isDir(final byte[] path) { return docs.isDir(path) || bins.isDir(Token.string(path)); } /** * Returns the child resources for the given path. * @param path path * @param dir returns directories * @return paths; values of documents will be {@code false} */ public synchronized TokenBoolMap children(final byte[] path, final boolean dir) { final TokenBoolMap tbm = new TokenBoolMap(); docs.children(path, dir, tbm); bins.children(path, dir, tbm); return tbm; } // Inherited methods ======================================================== @Override public void close() { } @Override public IndexIterator iter(final IndexToken token) { throw Util.notexpected(); } @Override public int count(final IndexToken token) { throw Util.notexpected(); } @Override public byte[] info() { throw Util.notexpected(); } @Override public EntryIterator entries(final IndexEntries entries) { throw Util.notexpected(); } } basex-7.7.2/basex-core/src/main/java/org/basex/index/stats/000077500000000000000000000000001222453003200234445ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/index/stats/IndexStats.java000066400000000000000000000056171222453003200264060ustar00rootroot00000000000000package org.basex.index.stats; import static org.basex.core.Text.*; import org.basex.util.*; /** * This class assembles some index statistics. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class IndexStats { /** Number of entries to print. */ private final int max; /** Minimum occurrences. */ private final int[] occMin; /** Maximum occurrences. */ private final int[] occMax; /** Minimal occurring tokens. */ private final byte[][] txtMin; /** Maximal occurring tokens. */ private final byte[][] txtMax; /** Number of index entries. */ private int size; /** Current number of occurrence. */ private int co; /** * Default constructor. * @param maxstat maximum number of index occurrences to print */ public IndexStats(final int maxstat) { max = maxstat; occMin = new int[max]; occMax = new int[max]; txtMin = new byte[max][]; txtMax = new byte[max][]; for(int o = 0; o < txtMin.length; ++o) { txtMin[o] = Token.EMPTY; txtMax[o] = Token.EMPTY; occMin[o] = Integer.MAX_VALUE; } } /** * Checks if the specified number of occurrence will be remembered. * @param oc number of occurrences * @return result of check */ public boolean adding(final int oc) { co = oc; ++size; return oc > occMax[max - 1] || oc < occMin[max - 1]; } /** * Adds the specified token. * @param tx token to be added */ public void add(final byte[] tx) { final boolean dsc = co > occMax[max - 1]; final byte[][] txt = dsc ? txtMax : txtMin; final int[] ocs = dsc ? occMax : occMin; for(int a = max - 1; a >= 0; a--) { if(a == 0 || dsc && co < ocs[a - 1] || !dsc && co > ocs[a - 1]) { txt[a] = tx; ocs[a] = co; break; } txt[a] = txt[a - 1]; ocs[a] = ocs[a - 1]; } } /** * Prints the list to the specified token builder. * @param tb token builder reference */ public void print(final TokenBuilder tb) { tb.add(LI_ENTRIES + size + NL); int m = 0; int c = 0; for(int o = 0; o < max; ++o) { int tl = txtMin[o].length; if(tl == 0) ++c; else if(m < tl) m = tl; tl = txtMax[o].length; if(tl == 0) ++c; else if(m < tl) m = tl; } print(tb, txtMax, occMax, m + 2); if(c == 0) tb.add(" " + DOTS + NL); print(tb, txtMin, occMin, m + 2); } /** * Internal method for printing the list. * @param tb token builder reference * @param txt text reference * @param ocs occurrences * @param len text length */ private static void print(final TokenBuilder tb, final byte[][] txt, final int[] ocs, final int len) { for(int o = 0; o < ocs.length; ++o) { if(txt[o].length == 0) continue; tb.add(" ").add(txt[o]); for(int j = 0; j < len - txt[o].length; ++j) tb.add(' '); tb.addInt(ocs[o]).add('x').add(NL); } } } basex-7.7.2/basex-core/src/main/java/org/basex/index/stats/Stats.java000066400000000000000000000115151222453003200254100ustar00rootroot00000000000000package org.basex.index.stats; import static org.basex.util.Token.*; import java.io.*; import org.basex.data.*; import org.basex.io.in.DataInput; import org.basex.io.out.DataOutput; import org.basex.util.hash.*; /** * This class provides statistical data for an indexed node. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Stats { /** Categories. */ public TokenIntMap cats; /** Data type. */ public StatsType type; /** Minimum value. */ public double min; /** Maximum value. */ public double max; /** Number of occurrences. */ public int count; /** Leaf node flag. This flag indicates if a node has children other than * texts and attributes. */ private boolean leaf; /** * Default constructor. */ public Stats() { cats = new TokenIntMap(); type = StatsType.NONE; min = Double.MAX_VALUE; max = Double.MIN_VALUE; leaf = true; } /** * Getter for leaf. * @return leaf */ public boolean isLeaf() { return leaf; } /** * Setter for leaf. * @param l leaf or not */ public void setLeaf(final boolean l) { leaf = l; if(!l) type = StatsType.TEXT; } /** * Constructor, specifying an input stream. * @param in input stream * @throws IOException I/O exception */ public Stats(final DataInput in) throws IOException { // 0x10 indicates format introduced with Version 7.1 final int k = in.readNum(); type = StatsType.values()[k & 0xF]; if(type == StatsType.INTEGER || type == StatsType.DOUBLE) { min = in.readDouble(); max = in.readDouble(); } else if(type == StatsType.CATEGORY) { if(k > 0xF) { cats = new TokenIntMap(in); } else { cats = new TokenIntMap(); final int cl = in.readNum(); for(int i = 0; i < cl; ++i) cats.add(in.readToken()); } } count = in.readNum(); leaf = in.readBool(); in.readDouble(); } /** * Writes the key statistics to the specified output stream. * @param out output stream * @throws IOException I/O exception */ public void write(final DataOutput out) throws IOException { // 0x10 indicates format introduced with Version 7.1 out.writeNum(type.ordinal() | 0x10); if(type == StatsType.INTEGER || type == StatsType.DOUBLE) { out.writeDouble(min); out.writeDouble(max); } else if(type == StatsType.CATEGORY) { cats.write(out); } out.writeNum(count); out.writeBool(leaf); // legacy since version 7.1 out.writeDouble(0); } /** * Adds a value. All values are first treated as integer values. If a value * can't be converted to an integer, it is treated as double value. If * conversion fails again, it is handled as string category. Next, all values * are cached. As soon as their number exceeds a maximum, the cached * values are skipped, and contents are treated as arbitrary strings. * @param val value to be added * @param meta meta data */ public void add(final byte[] val, final MetaData meta) { final int vl = val.length; if(vl == 0 || type == StatsType.TEXT || ws(val)) return; StatsType t = type; if(t == StatsType.NONE) t = StatsType.INTEGER; if(cats != null && cats.size() <= meta.maxcats) { if(val.length > meta.maxlen) { t = StatsType.TEXT; cats = null; } else { cats.put(val, Math.max(1, cats.get(val) + 1)); } } if(t == StatsType.INTEGER) { final long d = toLong(val); if(d == Long.MIN_VALUE) { t = StatsType.DOUBLE; } else { if(min > d) min = d; if(max < d) max = d; } } if(t == StatsType.DOUBLE) { final double d = toDouble(val); if(Double.isNaN(d)) { t = cats.size() <= meta.maxcats ? StatsType.CATEGORY : StatsType.TEXT; } else { if(min > d) min = d; if(max < d) max = d; } } else if(t == StatsType.CATEGORY) { if(cats.size() > meta.maxcats) { t = StatsType.TEXT; cats = null; } } type = t; } @Override public String toString() { final StringBuilder sb = new StringBuilder(count + "x"); switch(type) { case CATEGORY: sb.append(", ").append(cats.size()).append(" values"); break; case DOUBLE: sb.append(", numeric(").append(min).append(" - ").append(max).append(')'); break; case INTEGER: sb.append(", numeric(").append((int) min).append(" - ").append((int) max). append(')'); break; case TEXT: sb.append(", strings"); break; default: break; } if(leaf) sb.append(", leaf"); return sb.toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/index/stats/StatsType.java000066400000000000000000000006061222453003200262510ustar00rootroot00000000000000package org.basex.index.stats; /** * Content types, used for index statistics. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public enum StatsType { // Don't change order (new items can be attached, however) /** Text. */ TEXT, /** Category. */ CATEGORY, /** Numeric. */ INTEGER, /** Numeric. */ DOUBLE, /** No values. */ NONE } basex-7.7.2/basex-core/src/main/java/org/basex/index/value/000077500000000000000000000000001222453003200234225ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/index/value/DiskValues.java000066400000000000000000000332531222453003200263450ustar00rootroot00000000000000package org.basex.index.value; import static org.basex.core.Text.*; import static org.basex.data.DataText.*; import static org.basex.util.Token.*; import java.io.*; import java.util.concurrent.atomic.*; import org.basex.core.*; import org.basex.data.*; import org.basex.index.*; import org.basex.index.query.*; import org.basex.index.stats.*; import org.basex.io.random.*; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * This class provides access to attribute values and text contents stored on * disk. The data structure is described in the {@link ValueIndexBuilder} class. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class DiskValues implements Index { /** ID references. */ protected final DataAccess idxr; /** ID lists. */ protected final DataAccess idxl; /** Value type (texts/attributes). */ protected final boolean text; /** Data reference. */ protected final Data data; /** Cached tokens. */ protected final IndexCache cache = new IndexCache(); /** Cached texts. Increases used memory, but speeds up repeated queries. */ protected final IntObjMap ctext = new IntObjMap(); /** Synchronization object. */ protected final Object monitor = new Object(); /** Number of current index entries. */ protected final AtomicInteger size = new AtomicInteger(); /** * Constructor, initializing the index structure. * @param d data reference * @param txt value type (texts/attributes) * @throws IOException I/O Exception */ public DiskValues(final Data d, final boolean txt) throws IOException { this(d, txt, txt ? DATATXT : DATAATV); } /** * Constructor, initializing the index structure. * @param d data reference * @param txt value type (texts/attributes) * @param pref file prefix * @throws IOException I/O Exception */ protected DiskValues(final Data d, final boolean txt, final String pref) throws IOException { data = d; text = txt; idxl = new DataAccess(d.meta.dbfile(pref + 'l')); idxr = new DataAccess(d.meta.dbfile(pref + 'r')); size.set(idxl.read4()); } @Override public void init() { } @Override public byte[] info() { final TokenBuilder tb = new TokenBuilder(); tb.add(LI_STRUCTURE + SORTED_LIST + NL); final IndexStats stats = new IndexStats(data.meta.prop.num(Prop.MAXSTAT)); synchronized(monitor) { final long l = idxl.length() + idxr.length(); tb.add(LI_SIZE + Performance.format(l, true) + NL); final int s = size.get(); for(int m = 0; m < s; ++m) { final long pos = idxr.read5(m * 5L); final int oc = idxl.readNum(pos); if(stats.adding(oc)) stats.add(data.text(pre(idxl.readNum()), text)); } } stats.print(tb); return tb.finish(); } @Override public int count(final IndexToken it) { if(it instanceof StringRange) return idRange((StringRange) it).size(); if(it instanceof NumericRange) return idRange((NumericRange) it).size(); final byte[] key = it.get(); return key.length <= data.meta.maxlen ? entry(key).size : Integer.MAX_VALUE; } @Override public IndexIterator iter(final IndexToken it) { if(it instanceof StringRange) return idRange((StringRange) it); if(it instanceof NumericRange) return idRange((NumericRange) it); final IndexEntry e = entry(it.get()); return iter(e.size, e.pointer); } /** * Returns a cache entry. *

Important: This method is thread-safe.

* @param tok token to be found or cached * @return cache entry */ private IndexEntry entry(final byte[] tok) { final IndexEntry e = cache.get(tok); if(e != null) return e; final long p = get(tok); if(p < 0) return new IndexEntry(tok, 0, 0); final int count; final long pointer; synchronized(monitor) { // get position in heap file final long pos = idxr.read5(p * 5L); // the first heap entry represents the number of hits count = idxl.readNum(pos); pointer = idxl.cursor(); } return cache.add(tok, count, pointer); } @Override public EntryIterator entries(final IndexEntries input) { final byte[] key = input.get(); if(key.length == 0) return allKeys(input.descending); if(input.prefix) return keysWithPrefix(key); return keysFrom(key, input.descending); } /** * Returns all index entries. * @param reverse return in a reverse order * @return entries */ private EntryIterator allKeys(final boolean reverse) { final int s = size.get() - 1; return reverse ? keysWithinReverse(0, s) : keysWithin(0, s); } /** * Returns all index entries, starting from the specified key. * @param key key * @param reverse return in a reverse order * @return entries */ private EntryIterator keysFrom(final byte[] key, final boolean reverse) { final int s = size.get() - 1; int i = get(key); if(i < 0) i = -i - 1; return reverse ? keysWithinReverse(0, i - 1) : keysWithin(i, s); } /** * Returns all index entries with the given prefix. * @param prefix prefix * @return entries */ private EntryIterator keysWithPrefix(final byte[] prefix) { final int i = get(prefix); return new EntryIterator() { final int s = size.get(); int ix = (i < 0 ? -i - 1 : i) - 1; // -1 in order to use the faster ++ix operator int count = -1; @Override public byte[] next() { if(++ix < s) { synchronized(monitor) { final IndexEntry entry = readKeyAt(ix); if(startsWith(entry.key, prefix)) { count = entry.size; return entry.key; } } } count = -1; return null; } @Override public int count() { return count; } }; } /** * Returns all index entries within the given range. * @param first first entry to be returned * @param last last entry to be returned * @return entries */ private EntryIterator keysWithin(final int first, final int last) { return new EntryIterator() { int ix = first - 1; int count = -1; @Override public byte[] next() { if(++ix <= last) { synchronized(monitor) { final IndexEntry entry = readKeyAt(ix); count = entry.size; return entry.key; } } count = -1; return null; } @Override public int count() { return count; } }; } /** * Returns all index entries within the given range in a reverse order. * @param first first entry to be returned * @param last last entry to be returned * @return entries */ private EntryIterator keysWithinReverse(final int first, final int last) { return new EntryIterator() { int ix = last + 1; int count = -1; @Override public byte[] next() { if(--ix >= first) { synchronized(monitor) { final IndexEntry entry = readKeyAt(ix); count = entry.size; return entry.key; } } count = -1; return null; } @Override public int count() { return count; } }; } /** * Read a key at the given position. *

Important: This method is NOT thread-safe, since it is used in loops.

* @param index key position * @return key */ IndexEntry readKeyAt(final int index) { // try the cache first byte[] key = ctext.get(index); if(key != null) { final IndexEntry entry = cache.get(key); if(entry != null) return entry; } final long pos = idxr.read5(index * 5L); // read and ignore the number of ids in the list final int cnt = idxl.readNum(pos); if(key == null) { final int id = idxl.readNum(); key = data.text(pre(id), text); } return cache.add(key, cnt, pos + Num.length(cnt)); } /** * Iterator method. *

Important: This method is thread-safe.

* @param s number of values * @param ps offset * @return iterator */ private IndexIterator iter(final int s, final long ps) { final IntList pres = new IntList(s); long p = ps; synchronized(monitor) { for(int i = 0, id = 0; i < s; i++) { id += idxl.readNum(p); p = idxl.cursor(); pres.add(pre(id)); } } return iter(pres.sort()); } /** * Performs a string-based range query. *

Important: This method is thread-safe.

* @param tok index term * @return results */ private IndexIterator idRange(final StringRange tok) { // check if min and max are positive integers with the same number of digits final IntList pres = new IntList(); synchronized(monitor) { final int i = get(tok.min); final int s = size.get(); for(int l = i < 0 ? -i - 1 : tok.mni ? i : i + 1; l < s; l++) { final int ps = idxl.readNum(idxr.read5(l * 5L)); int id = idxl.readNum(); final int pre = pre(id); // value is too large: skip traversal final int d = diff(data.text(pre, text), tok.max); if(d > 0 || !tok.mxi && d == 0) break; // add pre values for(int p = 0; p < ps; ++p) { pres.add(pre(id)); id += idxl.readNum(); } } } return iter(pres.sort()); } /** * Performs a range query. All index values must be numeric. *

Important: This method is thread-safe.

* @param tok index term * @return results */ protected final IndexIterator idRange(final NumericRange tok) { final double min = tok.min; final double max = tok.max; // check if min and max are positive integers with the same number of digits final int len = max > 0 && (long) max == max ? token(max).length : 0; final boolean simple = len != 0 && min > 0 && (long) min == min && token(min).length == len; final IntList pres = new IntList(); synchronized(monitor) { final int s = size.get(); for(int l = 0; l < s; ++l) { final int ds = idxl.readNum(idxr.read5(l * 5L)); int id = idxl.readNum(); final int pre = pre(id); final double v = data.textDbl(pre, text); if(v >= min && v <= max) { // value is in range for(int d = 0; d < ds; ++d) { pres.add(pre(id)); id += idxl.readNum(); } } else if(simple && v > max && data.textLen(pre, text) == len) { // if limits are integers, if min, max and current value have the same // string length, and if current value is larger than max, test can be // skipped, as all remaining values will be bigger break; } } } return iter(pres.sort()); } /** * Returns an iterator for the specified id list. * @param ids id list * @return iterator */ protected static IndexIterator iter(final IntList ids) { return new IndexIterator() { final int s = ids.size(); int p = -1; @Override public boolean more() { return ++p < s; } @Override public int next() { return ids.get(p); } @Override public int size() { return s; } }; } /** * Returns the {@code pre} value for the specified id. * @param id id value * @return pre value */ protected int pre(final int id) { return id; } /** * Binary search for key in the {@link #idxr}. *

Important: This method is thread-safe.

* @param key token to be found * @return if the key is found: index of the key else: (-(insertion point) - 1) */ protected int get(final byte[] key) { return get(key, 0, size.get() - 1); } /** * Binary search for key in the {@link #idxr}. *

Important: This method is thread-safe.

* @param key token to be found * @param first begin of the search interval (inclusive) * @param last end of the search interval (exclusive) * @return if the key is found: index of the key else: (-(insertion point) - 1) */ protected int get(final byte[] key, final int first, final int last) { int l = first, h = last; synchronized(monitor) { while(l <= h) { final int m = l + h >>> 1; final byte[] txt = readKeyAt(m).key; final int d = diff(txt, key); if(d == 0) return m; if(d < 0) l = m + 1; else h = m - 1; } } return -(l + 1); } /** * Flushes the buffered data. */ public void flush() { idxl.flush(); idxr.flush(); } @Override public void close() { synchronized(monitor) { flush(); idxl.close(); idxr.close(); } } /** * Add entries to the index. * @param m a set of pairs */ @SuppressWarnings("unused") public void index(final TokenObjMap m) { } /** * Delete records from the index. * @param m a set of pairs */ @SuppressWarnings("unused") public void delete(final TokenObjMap m) { } /** * Remove record from the index. * @param o old record key * @param n new record key * @param id record id */ @SuppressWarnings("unused") public void replace(final byte[] o, final byte[] n, final int id) { } } basex-7.7.2/basex-core/src/main/java/org/basex/index/value/MemValues.java000066400000000000000000000064101222453003200261640ustar00rootroot00000000000000package org.basex.index.value; import static org.basex.core.Text.*; import static org.basex.util.Token.*; import java.util.*; import org.basex.core.*; import org.basex.data.*; import org.basex.index.*; import org.basex.index.query.*; import org.basex.index.stats.*; import org.basex.util.*; import org.basex.util.hash.*; /** * This class provides a main memory access to attribute values and * text contents. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class MemValues extends TokenSet implements Index { /** IDs. */ int[][] ids = new int[Array.CAPACITY][]; /** ID array lengths. */ int[] len = new int[Array.CAPACITY]; /** Data instance. */ final Data data; /** * Constructor. * @param d data instance */ public MemValues(final Data d) { data = d; } @Override public synchronized void init() { } @Override public IndexIterator iter(final IndexToken tok) { final byte k = tok.type() == IndexType.TEXT ? Data.TEXT : Data.ATTR; final int i = id(tok.get()); if(i > 0) { final int[] pres = ids[i]; final int s = len[i]; if(s > 0) { return new IndexIterator() { int p; @Override public boolean more() { return p < s; } @Override public int next() { while(more() && data.kind(pres[p++]) != k); return pres[p - 1]; } }; } } return IndexIterator.EMPTY; } @Override public int count(final IndexToken it) { final int i = id(it.get()); return i == 0 ? 0 : len[i]; } @Override public EntryIterator entries(final IndexEntries entries) { final byte[] prefix = entries.get(); return new EntryIterator() { int c; @Override public byte[] next() { while(++c < size) { if(startsWith(keys[c], prefix)) return keys[c]; } return null; } @Override public int count() { return len[c]; } }; } @Override public byte[] info() { final TokenBuilder tb = new TokenBuilder(LI_STRUCTURE).add(SORTED_LIST).add(NL); final IndexStats stats = new IndexStats(data.meta.prop.num(Prop.MAXSTAT)); for(int m = 1; m < size; m++) { if(stats.adding(len[m])) stats.add(key(m)); } stats.print(tb); return tb.finish(); } @Override public void close() { } @Override public void rehash(final int s) { super.rehash(s); ids = Array.copyOf(ids, s); len = Arrays.copyOf(len, s); } /** * Stores the specified key and id. * @param key key * @param id id value * @return index id */ public final int put(final byte[] key, final int id) { final int i = put(key); int[] tmp = ids[i]; if(tmp == null) { tmp = new int[] { id }; } else { final int l = len[i]; if(l == tmp.length) tmp = Arrays.copyOf(tmp, Array.newSize(l)); tmp[l] = id; } ids[i] = tmp; len[i]++; return i; } /** * Removes a record from the index. * @param key record key * @param id record id */ @SuppressWarnings("unused") public void delete(final byte[] key, final int id) { } } basex-7.7.2/basex-core/src/main/java/org/basex/index/value/UpdatableDiskValues.java000066400000000000000000000203571222453003200301700ustar00rootroot00000000000000package org.basex.index.value; import static org.basex.data.DataText.*; import static org.basex.util.Token.*; import java.io.*; import org.basex.data.*; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * This class provides access to attribute values and text contents stored on * disk. The data structure is described in the {@link ValueIndexBuilder} class. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class UpdatableDiskValues extends DiskValues { /** * Constructor, initializing the index structure. * @param d data reference * @param txt value type (texts/attributes) * @throws IOException I/O Exception */ public UpdatableDiskValues(final Data d, final boolean txt) throws IOException { this(d, txt, txt ? DATATXT : DATAATV); } /** * Constructor, initializing the index structure. * @param d data reference * @param txt value type (texts/attributes) * @param pref file prefix * @throws IOException I/O Exception */ private UpdatableDiskValues(final Data d, final boolean txt, final String pref) throws IOException { super(d, txt, pref); } @Override protected int pre(final int id) { return data.pre(id); } @Override public synchronized void flush() { idxl.write4(0, size.get()); super.flush(); } @Override public synchronized void index(final TokenObjMap m) { final int s = size.get(); final int last = s - 1; // create a sorted list of all keys: allows faster binary search final TokenList allkeys = new TokenList(m).sort(true); // create a sorted list of the new keys and update the old keys final TokenList nkeys = new TokenList(m.size()); int p = 0; for(final byte[] key : allkeys) { p = get(key, p, s); if(p < 0) { p = -(p + 1); nkeys.add(key); } else { appendIds(p++, key, diffs(m.get(key))); } } // insert new keys, starting from the biggest one for(int j = nkeys.size() - 1, i = last, pos = s + j; j >= 0; --j) { final byte[] key = nkeys.get(j); final int in = -(1 + get(key, 0, i)); if(in < 0) throw new IllegalStateException("Key should not exist: '" + string(key) + "'"); // shift all bigger keys to the right while(i >= in) { idxr.write5(pos * 5L, idxr.read5(i * 5L)); ctext.put(pos--, ctext.get(i--)); } // add the new key and its ids idxr.write5(pos * 5L, idxl.appendNums(diffs(m.get(key)))); ctext.put(pos--, key); // [DP] should the entry be added to the cache? } size.set(s + nkeys.size()); } /** * Add record ids to an index entry. * @param ix index of the key * @param key key * @param nids sorted list of record ids to add: the first value is the * smallest id and all others are only difference to the previous one */ private void appendIds(final int ix, final byte[] key, final int[] nids) { final long oldpos = idxr.read5(ix * 5L); final int numold = idxl.readNum(oldpos); final int[] ids = new int[numold + nids.length]; // read the old ids for(int i = 0; i < numold; ++i) { final int v = idxl.readNum(); nids[0] -= v; // adjust the first new id ids[i] = v; } // append the new ids - they are bigger than the old ones System.arraycopy(nids, 0, ids, numold, nids.length); final long newpos = idxl.appendNums(ids); idxr.write5(ix * 5L, newpos); // update the cache entry cache.add(key, ids.length, newpos + Num.length(ids.length)); } @Override public synchronized void delete(final TokenObjMap m) { // create a sorted list of all keys: allows faster binary search final TokenList allkeys = new TokenList(m).sort(true); // delete ids and create a list of the key positions which should be deleted final IntList empty = new IntList(m.size()); int p = 0; final int s = size.get() - 1; for(final byte[] key : allkeys) { p = get(key, p, s); if(p < 0) p = -(p + 1); // should not occur, but anyway else if(deleteIds(p, key, m.get(key).sort().toArray()) == 0) empty.add(p); } // empty should contain sorted keys, since allkeys was sorted, too if(!empty.isEmpty()) deleteKeys(empty.toArray()); } /** * Remove record ids from the index. * @param ix index of the key * @param key record key * @param ids list of record ids to delete * @return number of remaining records */ private int deleteIds(final int ix, final byte[] key, final int[] ids) { final long pos = idxr.read5(ix * 5L); final int numold = idxl.readNum(pos); if(numold == ids.length) { // all ids should be detected: the key itself will be deleted, too cache.delete(key); return 0; } // read each id from the list and skip the ones which should be deleted // collect remaining values final int[] nids = new int[numold - ids.length]; for(int i = 0, j = 0, cid = 0, pid = 0; i < nids.length;) { cid += idxl.readNum(); if(j < ids.length && ids[j] == cid) ++j; else { nids[i++] = cid - pid; pid = cid; } } idxl.writeNums(pos, nids); // update the cache entry cache.add(key, nids.length, pos + Num.length(nids.length)); return nids.length; } /** * Delete keys from the index. * @param keys list of key positions to delete */ private void deleteKeys(final int[] keys) { // shift all keys to the left, skipping the ones which have to be deleted int j = 0; final int s = size.get(); for(int pos = keys[j++], i = pos + 1; i < s; ++i) { if(j < keys.length && i == keys[j]) ++j; else { idxr.write5(pos * 5L, idxr.read5(i * 5L)); ctext.put(pos++, ctext.get(i)); } } // reduce the size of the index size.set(s - j); } @Override public synchronized void replace(final byte[] o, final byte[] n, final int id) { // delete the id from the old key final int p = get(o); if(p >= 0) { final int[] tmp = new int[] { id}; if(deleteIds(p, o, tmp) == 0) { // the old key remains empty: delete it cache.delete(o); tmp[0] = p; deleteKeys(tmp); } } // add the id to the new key insertId(n, id); } /** * Add a text entry to the index. * @param key text to index * @param id id value */ private void insertId(final byte[] key, final int id) { int ix = get(key); if(ix < 0) { ix = -(ix + 1); // shift all entries with bigger keys to the right final int s = size.get(); for(int i = s; i > ix; --i) idxr.write5(i * 5L, idxr.read5((i - 1) * 5L)); // add the key and the id idxr.write5(ix * 5L, idxl.appendNums(new int[] { id})); ctext.put(ix, key); // [DP] should the entry be added to the cache? size.set(s + 1); } else { // add id to the list of ids in the index node final long pos = idxr.read5(ix * 5L); final int num = idxl.readNum(pos); final int[] ids = new int[num + 1]; boolean notadded = true; int cid = 0; for(int i = 0, j = -1; i < num; ++i) { int v = idxl.readNum(); if(notadded && id < cid + v) { // add the new id ids[++j] = id - cid; notadded = false; // decrement the difference to the next id v -= id - cid; cid = id; } ids[++j] = v; cid += v; } if(notadded) ids[ids.length - 1] = id - cid; final long newpos = idxl.appendNums(ids); idxr.write5(ix * 5L, newpos); // update the cache entry cache.add(key, ids.length, newpos + Num.length(ids.length)); } } /** * Sort and calculate the differences between a list of ids. * @param ids id list * @return differences */ private static int[] diffs(final IntList ids) { final int[] a = ids.sort().toArray(); for(int l = a.length - 1; l > 0; --l) a[l] -= a[l - 1]; return a; } } basex-7.7.2/basex-core/src/main/java/org/basex/index/value/UpdatableMemValues.java000066400000000000000000000037551222453003200300170ustar00rootroot00000000000000package org.basex.index.value; import static org.basex.core.Text.*; import org.basex.core.*; import org.basex.data.*; import org.basex.index.*; import org.basex.index.query.*; import org.basex.index.stats.*; import org.basex.util.*; /** * This class provides a main memory access to attribute values and * text contents. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class UpdatableMemValues extends MemValues { /** * Constructor. * @param d data instance */ public UpdatableMemValues(final MemData d) { super(d); } @Override public IndexIterator iter(final IndexToken tok) { final byte k = tok.type() == IndexType.TEXT ? Data.TEXT : Data.ATTR; final int i = id(tok.get()); if(i > 0) { final int[] pres = data.pre(ids[i], 0, len[i]); final int s = pres.length; if(s > 0) { return new IndexIterator() { int p; @Override public boolean more() { return p < s; } @Override public int next() { while(more() && data.kind(pres[p++]) != k); return pres[p - 1]; } }; } } return IndexIterator.EMPTY; } @Override public byte[] info() { final TokenBuilder tb = new TokenBuilder(LI_STRUCTURE).add(SORTED_LIST).add(NL); final IndexStats stats = new IndexStats(data.meta.prop.num(Prop.MAXSTAT)); for(int m = 1; m < size; ++m) { if(stats.adding(len[m])) stats.add(key(m)); } stats.print(tb); return tb.finish(); } @Override public void delete(final byte[] key, final int id) { final int i = id(key); if(i == 0 || len[i] == 0) return; // find the position where the id is stored int p = -1; while(++p < len[i]) if(ids[i][p] == id) break; // if not the last element, we need to shift forwards if(p < len[i] - 1) Array.move(ids[i], p + 1, -1, len[i] - (p + 1)); len[i]--; } } basex-7.7.2/basex-core/src/main/java/org/basex/index/value/ValueIndexBuilder.java000066400000000000000000000156771222453003200276600ustar00rootroot00000000000000package org.basex.index.value; import static org.basex.core.Text.*; import static org.basex.data.DataText.*; import static org.basex.util.Token.*; import java.io.*; import org.basex.core.*; import org.basex.data.*; import org.basex.index.*; import org.basex.io.out.DataOutput; import org.basex.io.random.*; import org.basex.util.*; import org.basex.util.list.*; /** *

This class builds an index for attribute values and text contents in a * tree structure and stores the result to disk.

* *

The data is stored on disk in the following format:

*
    *
  • {@code DATATXT/ATV + 'l'}: contains the index values, which are dense id * lists to all text nodes/attribute values, stored in the {@link Num} format: * [size0, id1, id2, ...]. The number of index keys is stored in the first 4 * bytes of the file.
  • *
  • {@code DATATXT/ATV + 'r'}: contains 5-byte references to the id lists * for all keys. To save space, the keys itself are not stored in the index * structure. Instead, they can be found by following the id references to * the main table. *
  • *
* * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ValueIndexBuilder extends IndexBuilder { /** Temporary value tree. */ private IndexTree index = new IndexTree(); /** Index type (attributes/texts). */ private final boolean text; /** * Constructor. * @param d data reference * @param txt value type (text/attribute) */ public ValueIndexBuilder(final Data d, final boolean txt) { super(d, d.meta.prop.num(Prop.INDEXSPLITSIZE)); text = txt; } @Override public DiskValues build() throws IOException { // delete old index abort(); final Performance perf = Prop.debug ? new Performance() : null; Util.debug(det()); final int k = text ? Data.TEXT : Data.ATTR; for(pre = 0; pre < size; ++pre) { if((pre & 0x0FFF) == 0) { check(); // check if main memory is exhausted if(split()) { writeIndex(true); index = new IndexTree(); finishSplit(); } } // skip too long values if(data.kind(pre) == k && data.textLen(pre, text) <= data.meta.maxlen) { index.index(data.text(pre, text), data.meta.updindex ? data.id(pre) : pre); count++; } } writeIndex(splits > 0); // merge partial index structures if(splits > 1) { index = null; Performance.gc(1); merge(); } if(text) data.meta.textindex = true; else data.meta.attrindex = true; finishIndex(perf); return data.meta.updindex ? new UpdatableDiskValues(data, text) : new DiskValues(data, text); } /** * Merges cached index files. * @throws IOException I/O exception */ private void merge() throws IOException { final String f = text ? DATATXT : DATAATV; final DataOutput outL = new DataOutput(data.meta.dbfile(f + 'l')); final DataOutput outR = new DataOutput(data.meta.dbfile(f + 'r')); outL.write4(0); // initialize cached index iterators final IntList ml = new IntList(); final IntList il = new IntList(); final ValueIndexMerger[] vm = new ValueIndexMerger[splits]; for(int i = 0; i < splits; ++i) vm[i] = new ValueIndexMerger(data, text, i); int sz = 0; // parse through all values while(true) { checkStop(); // find first index which is not completely parsed yet int min = -1; while(++min < splits && vm[min].values.length == 0); if(min == splits) break; // find index entry with smallest key ml.reset(); for(int i = min; i < splits; ++i) { if(vm[i].values.length == 0) continue; final int d = diff(vm[min].key, vm[i].key); if(d < 0) continue; if(d > 0) { min = i; ml.reset(); } ml.add(i); } // parse through all values, cache and sort id values final int ms = ml.size(); for(int m = 0; m < ms; ++m) { final ValueIndexMerger t = vm[ml.get(m)]; final int vl = t.values.length; for(int l = 4, v; l < vl; l += Num.length(v)) { v = Num.get(t.values, l); il.add(v); } t.next(); } // write final structure to disk write(outL, outR, il); ++sz; } // close index files outR.close(); outL.close(); // write number of entries to first position final DataAccess da = new DataAccess(data.meta.dbfile(f + 'l')); da.write4(sz); da.close(); } /** * Writes the current index tree to disk. * @param partial partial flag * @throws IOException I/O exception */ private void writeIndex(final boolean partial) throws IOException { // write id arrays and references final String name = (text ? DATATXT : DATAATV) + (partial ? splits : ""); final DataOutput outL = new DataOutput(data.meta.dbfile(name + 'l')); final DataOutput outR = new DataOutput(data.meta.dbfile(name + 'r')); outL.write4(index.size()); final IntList il = new IntList(); index.init(); while(index.more()) { final byte[] values = index.values.get(index.next()); final int vs = Num.size(values); if(partial) { // write temporary structure to disk: number of entries, absolute values outR.write5(outL.size()); outL.write(values, 0, vs); } else { // cache and sort all values for(int ip = 4; ip < vs; ip += Num.length(values, ip)) { il.add(Num.get(values, ip)); } // write final structure to disk write(outL, outR, il); } } outL.close(); outR.close(); // temporarily write texts if(partial) { final DataOutput outT = new DataOutput(data.meta.dbfile(name + 't')); index.init(); while(index.more()) outT.writeToken(index.keys.get(index.next())); outT.close(); } // increase split counter splits++; } /** * Writes the final value structure to disk. * @param outL index values * @param outR references * @param il values * @throws IOException I/O exception */ private static void write(final DataOutput outL, final DataOutput outR, final IntList il) throws IOException { // sort values before writing il.sort(); final int is = il.size(); outR.write5(outL.size()); outL.writeNum(is); for(int i = 0, o = 0; i < is; i++) { final int v = il.get(i); outL.writeNum(v - o); o = v; } il.reset(); } @Override public void abort() { data.meta.drop((text ? DATATXT : DATAATV) + ".+"); if(text) data.meta.textindex = false; else data.meta.attrindex = false; } @Override protected String det() { return text ? INDEX_TEXT_D : INDEX_ATTRIBUTES_D; } } basex-7.7.2/basex-core/src/main/java/org/basex/index/value/ValueIndexMerger.java000066400000000000000000000033341222453003200274760ustar00rootroot00000000000000package org.basex.index.value; import static org.basex.data.DataText.*; import static org.basex.util.Token.*; import java.io.*; import org.basex.data.*; import org.basex.io.in.DataInput; /** * This class provides data for merging temporary value indexes. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class ValueIndexMerger { /** Index instance. */ private final DiskValues dv; /** Index keys. */ private final DataInput dk; /** File prefix. */ private final String pref; /** Data reference. */ private final Data data; /** Current key. */ byte[] key; /** Current values. */ byte[] values; /** * Constructor. * @param d data reference * @param txt text flag * @param i merge id * @throws IOException I/O exception */ ValueIndexMerger(final Data d, final boolean txt, final int i) throws IOException { pref = (txt ? DATATXT : DATAATV) + i; dk = new DataInput(d.meta.dbfile(pref + 't')); dv = new DiskValues(d, txt, pref); data = d; next(); } /** * Jumps to the next value. {@link #values} will have 0 entries if the * end of file is reached. * @throws IOException I/O exception */ void next() throws IOException { values = nextValues(); if(values.length != 0) { key = dk.readToken(); } else { dv.close(); dk.close(); data.meta.drop(pref + '.'); } } /** * Returns next values. Called by the {@link ValueIndexBuilder}. * @return compressed values */ private byte[] nextValues() { return dv.idxr.cursor() >= dv.idxr.length() ? EMPTY : dv.idxl.readBytes(dv.idxr.read5(), dv.idxl.read4()); } } basex-7.7.2/basex-core/src/main/java/org/basex/io/000077500000000000000000000000001222453003200216065ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/io/IO.java000066400000000000000000000230061222453003200227610ustar00rootroot00000000000000package org.basex.io; import static org.basex.util.Token.*; import java.io.*; import java.util.*; import javax.xml.transform.stream.*; import org.basex.core.*; import org.basex.data.*; import org.basex.io.in.*; import org.basex.util.*; import org.xml.sax.*; /** * Generic representation for inputs and outputs. The underlying source can * be a local file ({@link IOFile}), a URL ({@link IOUrl}), a byte array * ({@link IOContent}), or a stream ({@link IOStream}). * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class IO { /** Database file suffix. */ public static final String BASEXSUFFIX = ".basex"; /** Command script suffix. */ public static final String BXSSUFFIX = ".bxs"; /** XQuery file suffix. */ public static final String XQSUFFIX = ".xq"; /** XQuery module suffix. */ public static final String XQMSUFFIX = ".xqm"; /** XML file suffix. */ public static final String XMLSUFFIX = ".xml"; /** ZIP file suffix. */ public static final String ZIPSUFFIX = ".zip"; /** CSV file suffix. */ public static final String CSVSUFFIX = ".csv"; /** JSON file suffix. */ public static final String JSONSUFFIX = ".json"; /** JAR file suffix. */ public static final String JARSUFFIX = ".jar"; /** GZIP file suffix. */ public static final String GZSUFFIX = ".gz"; /** XAR file suffix. */ public static final String XARSUFFIX = ".xar"; /** XQuery log suffix. */ public static final String LOGSUFFIX = ".log"; /** File prefix. */ public static final String FILEPREF = "file:"; /** XQuery suffixes. */ public static final String[] XQSUFFIXES = { XQSUFFIX, XQMSUFFIX, ".xqy", ".xql", ".xqu", ".xquery" }; /** ZIP suffixes. */ public static final String[] ZIPSUFFIXES = { ZIPSUFFIX, GZSUFFIX, XARSUFFIX, ".docx", ".pptx", ".xslx", ".odt", ".odp", ".ods" }; /** XML suffixes. */ public static final String[] XMLSUFFIXES = { XMLSUFFIX, ".xsd", ".svg", ".rdf", ".rss", ".rng", ".sch" }; /** XML suffixes. */ public static final String[] XSLSUFFIXES = { ".xsl", ".xslt", ".fo", ".fob" }; /** HTML suffixes. */ public static final String[] HTMLSUFFIXES = { ".xhtml", ".html", ".htm" }; /** Text suffixes. */ public static final String[] TXTSUFFIXES = { ".txt", ".text", ".ini", ".conf", ".md", ".log" }; /** Disk block/page size (4096). */ public static final int BLOCKSIZE = 1 << 12; /** Table node size power (4). */ public static final int NODEPOWER = 4; /** Table node size power (16). */ public static final int NODESIZE = 1 << NODEPOWER; /** Entries per block (256). */ public static final int ENTRIES = BLOCKSIZE >>> NODEPOWER; /** Maximum number of attributes (see bit layout in {@link Data} class). */ public static final int MAXATTS = 0x1F; /** Offset for inlining numbers (see bit layout in {@link Data} class). */ public static final long OFFNUM = 0x8000000000L; /** Offset for compressing texts (see bit layout in {@link Data} class). */ public static final long OFFCOMP = 0x4000000000L; /** File path. The path uses forward slashes, no matter which OS is used. */ String path; /** File name. */ String name; /** File length. */ long len = -1; /** * Protected constructor. * @param p path */ IO(final String p) { init(p); } /** * Sets the file path and name. * @param p file path */ final void init(final String p) { path = p; final String n = p.substring(p.lastIndexOf('/') + 1); // use current time if no name is given name = n.isEmpty() ? Long.toString(System.currentTimeMillis()) + IO.BASEXSUFFIX + IO.XMLSUFFIX : n; } /** *

Returns a class instance for the specified string. The type of the * returned instance depends on the string value:

*
    *
  • {@link IOFile}: if the string starts with file:, or if it * does not contain the substring ://, it is interpreted as * local file instance
  • *
  • {@link IOUrl}: if it starts with a valid scheme, it is handled as URL
  • *
  • {@link IOContent}: otherwise, it is interpreted as XML fragment and internally * represented as byte array
  • *
* If the content of the string value is known in advance, it is advisable * to call the direct constructors of the correspondent sub class. * * @param source source string * @return IO reference */ public static IO get(final String source) { if(source == null) return new IOContent(""); final String s = source.trim(); return s.indexOf('<') == 0 ? new IOContent(s) : IOUrl.isFileURL(s) ? IOFile.get(s) : IOFile.isValid(s) ? new IOFile(s) : IOUrl.isValid(s) ? new IOUrl(s) : new IOContent(s); } /** * Returns the binary contents. * @return binary contents * @throws IOException I/O exception */ public abstract byte[] read() throws IOException; /** * Returns the contents as string. The input encoding will be guessed by analyzing the * first bytes. UTF-8 will be used as fallback. * @return string contents * @throws IOException I/O exception */ public final String string() throws IOException { return new TextInput(this).cache().toString(); } /** * Tests if the reference exists. * Returns {@code true} for IO instances other than {@link IOFile}. * @return result of check */ public boolean exists() { return true; } /** * Tests if this is a directory instance. * Returns {@code false} for IO instances other than {@link IOFile}. * @return result of check */ public boolean isDir() { return false; } /** * Tests if the file suffix matches the specified suffixes. * @param suffixes suffixes to compare with * @return result of check */ public boolean hasSuffix(final String... suffixes) { final int i = path.lastIndexOf('.'); if(i == -1) return false; final String suf = path.substring(i).toLowerCase(Locale.ENGLISH); for(final String z : suffixes) if(suf.equals(z)) return true; return false; } /** * Returns the time stamp (modification date) of this file. * Returns the current time for IO instances other than {@link IOFile}. * @return time stamp */ public long timeStamp() { return System.currentTimeMillis(); } /** * Sets the input length. * @param l length */ public void length(final long l) { len = l; } /** * Returns the file length. * @return file length */ public long length() { return len; } /** * Returns an input source. * @return input source */ public abstract InputSource inputSource(); /** * Returns a stream source. * @return stream source */ public abstract StreamSource streamSource(); /** * Returns an input stream. * @return input stream * @throws IOException I/O exception */ public abstract InputStream inputStream() throws IOException; /** * Merges two paths. Returns the new specified path for {@link IOContent} and * {@link IOStream} instances. * @param in name/path to be appended * @return resulting reference */ public IO merge(final String in) { return IO.get(in); } /** * Checks if this file is an archive. * @return result of check */ public final boolean isArchive() { return hasSuffix(ZIPSUFFIXES); } /** * Chops the path and the file suffix of the specified filename * and returns the database name. * @return database name */ public final String dbname() { final TokenBuilder tb = new TokenBuilder(); final byte[] n = token(name()); int i = lastIndexOf(n, '.'); if(i == -1) i = n.length; for(int c = 0; c < i; c += cl(n, c)) { final int ch = norm(cp(n, c)); if(Databases.validChar(ch)) tb.add(ch); } return tb.toString(); } /** * Returns the name of the resource. * @return file name */ public final String name() { return name; } /** * Sets the name of the resource. * @param n file name */ public final void name(final String n) { name = n; if(path.isEmpty()) path = n; } /** * Returns the path. * The path uses forward slashes, no matter which OS is used. * @return path */ public final String path() { return path; } /** * Creates a URL from the specified path. * Returns the original path for IO instances other than {@link IOFile}. * @return URL */ public String url() { return path; } /** * Returns the directory path. * @return chopped filename */ public String dirPath() { return ""; } /** * Compares the filename of the specified IO reference. * @param io io reference * @return result of check */ public boolean eq(final IO io) { return path.equals(io.path); } @Override public String toString() { return path; } /** * Returns the suffix of the specified path in lower case. * An empty string is returned if the last path segment has no suffix. * @param path path to be checked * @return mime-type */ public static String suffix(final String path) { final int s = path.lastIndexOf('/'); final int d = path.lastIndexOf('.'); return d <= s ? "" : path.substring(d + 1).toLowerCase(Locale.ENGLISH); } } basex-7.7.2/basex-core/src/main/java/org/basex/io/IOContent.java000066400000000000000000000023631222453003200243170ustar00rootroot00000000000000package org.basex.io; import javax.xml.transform.stream.*; import org.basex.io.in.*; import org.basex.util.*; import org.xml.sax.*; /** * {@link IO} reference, representing a byte array. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class IOContent extends IO { /** Content. */ private final byte[] cont; /** * Constructor. * @param c contents */ public IOContent(final byte[] c) { this(c, ""); } /** * Constructor. * @param c contents */ public IOContent(final String c) { this(Token.token(c), ""); } /** * Constructor. * @param c contents * @param p content path */ public IOContent(final byte[] c, final String p) { super(p); cont = c; len = cont.length; } @Override public byte[] read() { return cont; } @Override public InputSource inputSource() { final InputSource is = new InputSource(inputStream()); is.setSystemId(path); return is; } @Override public StreamSource streamSource() { return new StreamSource(inputStream(), path); } @Override public ArrayInput inputStream() { return new ArrayInput(cont); } @Override public String toString() { return Token.string(cont); } } basex-7.7.2/basex-core/src/main/java/org/basex/io/IOFile.java000066400000000000000000000272301222453003200235640ustar00rootroot00000000000000package org.basex.io; import java.io.*; import java.net.*; import java.util.*; import java.util.regex.*; import javax.xml.transform.stream.*; import org.basex.core.*; import org.basex.io.in.*; import org.basex.io.out.*; import org.basex.util.*; import org.basex.util.list.*; import org.xml.sax.*; /** * {@link IO} reference, representing a local file or directory path. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class IOFile extends IO { /** File reference. */ private final File file; /** * Constructor. * @param f file path */ public IOFile(final String f) { this(new File(f)); } /** * Constructor. * @param f file reference */ public IOFile(final File f) { super(new PathList().create(f.getAbsolutePath())); file = f; } /** * Constructor. * @param dir directory * @param n file name */ public IOFile(final String dir, final String n) { this(new File(dir, n)); } /** * Constructor. * @param dir directory * @param n file name */ public IOFile(final IOFile dir, final String n) { this(new File(dir.file, n)); } /** * Returns the file reference. * @return file reference */ public File file() { return file; } /** * Creates a new instance of this file. * @return success flag */ public boolean touch() { // some file systems require several runs for(int i = 0; i < 5; i++) { try { if(file.createNewFile()) return true; } catch(final IOException ex) { Performance.sleep(i * 10l); Util.debug(ex); } } return false; } @Override public byte[] read() throws IOException { return new BufferInput(this).content(); } @Override public boolean exists() { return file.exists(); } @Override public boolean isDir() { return file.isDirectory(); } @Override public long timeStamp() { return file.lastModified(); } @Override public long length() { return file.length(); } @Override public InputSource inputSource() { return new InputSource(path); } @Override public StreamSource streamSource() { return new StreamSource(path); } @Override public InputStream inputStream() throws IOException { return new FileInputStream(file); } @Override public IO merge(final String f) { final IO io = IO.get(f); if(!(io instanceof IOFile) || f.contains(":") || f.startsWith("/")) return io; return new IOFile(dir(), f); } /** * Recursively creates the directory. * @return success flag */ public boolean md() { return !file.exists() && file.mkdirs(); } @Override public String dirPath() { return isDir() ? path : path.substring(0, path.lastIndexOf('/') + 1); } /** * Returns a directory reference. If the file points to a directory, a self reference * is returned * @return directory */ public IOFile dir() { return isDir() ? this : new IOFile(path.substring(0, path.lastIndexOf('/') + 1)); } /** * Returns the children of the path. * @return children */ public IOFile[] children() { return children(".*"); } /** * Returns the children of the path that match the specified regular * expression. * @param regex regular expression pattern * @return children */ public IOFile[] children(final String regex) { final File[] ch = file.listFiles(); if(ch == null) return new IOFile[] {}; final ArrayList io = new ArrayList(ch.length); final Pattern p = Pattern.compile(regex, Prop.CASE ? 0 : Pattern.CASE_INSENSITIVE); for(final File f : ch) { if(p.matcher(f.getName()).matches()) io.add(new IOFile(f)); } return io.toArray(new IOFile[io.size()]); } /** * Returns the relative paths of all descendant files. * @return relative paths */ public synchronized StringList descendants() { final StringList files = new StringList(); final File[] ch = file.listFiles(); if(ch == null) return files; if(exists()) add(this, files, path().length() + 1); return files; } /** * Adds the relative paths of all descendant files to the specified list. * @param io current file * @param files file list * @param off string length of root path */ private static void add(final IOFile io, final StringList files, final int off) { if(io.isDir()) { for(final IOFile f : io.children()) add(f, files, off); } else { files.add(io.path().substring(off).replace('\\', '/')); } } /** * Writes the specified byte array. * @param c contents * @throws IOException I/O exception */ public void write(final byte[] c) throws IOException { final FileOutputStream out = new FileOutputStream(path); try { out.write(c); } finally { out.close(); } } /** * Writes the specified input. The specified stream is eventually closed. * @param in input stream * @throws IOException I/O exception */ public void write(final InputStream in) throws IOException { try { final BufferOutput out = new BufferOutput(path); try { for(int i; (i = in.read()) != -1;) out.write(i); } finally { out.close(); } } finally { in.close(); } } /** * Deletes the IO reference. * @return success flag */ public boolean delete() { boolean ok = true; if(file.exists()) { if(isDir()) for(final IOFile ch : children()) ok &= ch.delete(); // some file systems require several runs for(int i = 0; i < 5; i++) { if(file.delete() && !file.exists()) return ok; Performance.sleep(i * 10l); } } return false; } /** * Renames the file to the specified name. * @param trg target reference * @return success flag */ public boolean rename(final IOFile trg) { return file.renameTo(trg.file); } /** * Copies a file to another target. * @param trg target * @throws IOException I/O exception */ public void copyTo(final IOFile trg) throws IOException { // optimize buffer size final int bsize = (int) Math.max(1, Math.min(length(), 1 << 22)); final byte[] buf = new byte[bsize]; // create parent directory of target file trg.dir().md(); final FileInputStream fis = new FileInputStream(file); try { final FileOutputStream fos = new FileOutputStream(trg.file); try { // copy file buffer by buffer for(int i; (i = fis.read(buf)) != -1;) fos.write(buf, 0, i); } finally { fos.close(); } } finally { fis.close(); } } @Override public boolean eq(final IO io) { if(!(io instanceof IOFile)) return false; return Prop.CASE ? path.equals(io.path) : path.equalsIgnoreCase(io.path); } @Override public String url() { final TokenBuilder tb = new TokenBuilder(FILEPREF); // add leading slash for Windows paths if(!path.startsWith("/")) tb.add("///"); for(int p = 0; p < path.length(); p++) { // replace spaces with %20 final char ch = path.charAt(p); if(ch == ' ') tb.add("%20"); else tb.add(ch); } if(isDir()) tb.add('/'); return tb.toString(); } /** * Checks if the specified string is a valid file reference. * @param s source * @return result of check */ public static boolean isValid(final String s) { // accept short strings, string without colons and strings with Windows drive letters return s.length() < 3 || s.indexOf(':') == -1 || Token.letter(s.charAt(0)) && s.charAt(1) == ':'; } /** * Converts a file filter (glob) to a regular expression. * @param glob filter * @return regular expression */ public static String regex(final String glob) { return regex(glob, true); } /** * Converts a file filter (glob) to a regular expression. A filter may * contain asterisks (*) and question marks (?); commas (,) are used to * separate multiple filters. * @param glob filter * @param sub accept substring in the result * @return regular expression */ public static String regex(final String glob, final boolean sub) { final StringBuilder sb = new StringBuilder(); for(final String g : glob.split(",")) { boolean suf = false; final String gl = g.trim(); if(sb.length() != 0) { if(suf) sb.append(".*"); suf = false; sb.append('|'); } // loop through single pattern for(int f = 0; f < gl.length(); f++) { char ch = gl.charAt(f); if(ch == '*') { // don't allow other dots if pattern ends with a dot suf = true; sb.append(gl.endsWith(".") ? "[^.]" : "."); } else if(ch == '?') { ch = '.'; suf = true; } else if(ch == '.') { suf = true; // last character is dot: disallow file suffix if(f + 1 == gl.length()) break; sb.append('\\'); } else if(!Character.isLetterOrDigit(ch)) { sb.append('\\'); } sb.append(ch); } if(!suf && sub) sb.append(".*"); } return Prop.CASE ? sb.toString() : sb.toString().toLowerCase(Locale.ENGLISH); } /** * Normalizes the specified URL and creates a new {@link IOFile} instance. * @param url url to be converted * @return file path */ public static IOFile get(final String url) { String file = url; try { if(file.indexOf('%') != -1) file = URLDecoder.decode(file, Prop.ENCODING); } catch(final Exception ex) { /* ignored. */ } // remove file scheme if(file.startsWith(FILEPREF)) file = file.substring(FILEPREF.length()); // remove duplicate slashes file = normSlashes(file); // remove leading slash from Windows paths if(file.length() > 2 && file.charAt(0) == '/' && file.charAt(2) == ':' && Token.letter(file.charAt(1))) file = file.substring(1); return new IOFile(file); } /** * Normalize slashes in the specified path. * @param path path to be normalized * @return normalized path */ private static String normSlashes(final String path) { boolean a = true; final StringBuilder sb = new StringBuilder(path.length()); final int pl = path.length(); for(int p = 0; p < pl; p++) { final char c = path.charAt(p); final boolean b = c != '/'; if(a || b) sb.append(c); a = b; } return sb.toString(); } /** * Path constructor. Resolves parent and self references and normalizes the * path. */ static class PathList extends StringList { /** * Creates a path. * @param path input path * @return path */ String create(final String path) { final TokenBuilder tb = new TokenBuilder(); final int l = path.length(); for(int i = 0; i < l; ++i) { final char ch = path.charAt(i); if(ch == '\\' || ch == '/') add(tb); else tb.add(ch); } add(tb); if(path.startsWith("\\\\") || path.startsWith("//")) tb.add("//"); for(int s = 0; s < size; ++s) { if(s != 0 || path.startsWith("/")) tb.add('/'); tb.add(list[s]); } return tb.toString(); } /** * Adds a directory/file to the path list. * @param tb entry to be added */ private void add(final TokenBuilder tb) { String s = tb.toString(); // switch first Windows letter to upper case if(s.length() > 1 && s.charAt(1) == ':' && size == 0) { s = Character.toUpperCase(s.charAt(0)) + s.substring(1); } if(s.equals("..") && size > 0) { // parent step if(list[size - 1].indexOf(':') == -1) deleteAt(size - 1); } else if(!s.equals(".") && !s.isEmpty()) { // skip self and empty steps add(s); } tb.reset(); } } } basex-7.7.2/basex-core/src/main/java/org/basex/io/IOStream.java000066400000000000000000000020541222453003200241350ustar00rootroot00000000000000package org.basex.io; import java.io.*; import javax.xml.transform.stream.*; import org.basex.io.in.*; import org.xml.sax.*; /** * {@link IO} stream. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class IOStream extends IO { /** Buffered input stream. */ private final BufferInput input; /** * Constructor. * @param is input stream */ public IOStream(final InputStream is) { this(is, ""); } /** * Constructor. * @param is input stream * @param p content path */ public IOStream(final InputStream is, final String p) { super(p); input = is instanceof BufferInput ? (BufferInput) is : new BufferInput(is); } @Override public byte[] read() throws IOException { return input.content(); } @Override public InputSource inputSource() { return new InputSource(input); } @Override public StreamSource streamSource() { return new StreamSource(input); } @Override public InputStream inputStream() throws IOException { return input; } } basex-7.7.2/basex-core/src/main/java/org/basex/io/IOUrl.java000066400000000000000000000064121222453003200234460ustar00rootroot00000000000000package org.basex.io; import static org.basex.core.Text.*; import java.io.*; import java.net.*; import javax.xml.transform.stream.*; import org.basex.core.*; import org.basex.io.in.*; import org.basex.util.*; import org.xml.sax.*; /** * {@link IO} reference, representing a URL. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class IOUrl extends IO { /** HTTP header: Authorization. */ private static final String AUTHORIZATION = "Authorization"; /** Timeout for connecting to a resource (seconds). */ private static final int TIMEOUT = 10; /** * Constructor. * @param u url */ public IOUrl(final String u) { super(u); } @Override public byte[] read() throws IOException { return new BufferInput(this).content(); } @Override public InputSource inputSource() { return new InputSource(path); } @Override public StreamSource streamSource() { return new StreamSource(path); } @Override public InputStream inputStream() throws IOException { final URL url = new URL(path); URLConnection conn = null; try { conn = url.openConnection(); conn.setConnectTimeout(TIMEOUT * 1000); // use basic authentication if credentials are contained in the url final String ui = url.getUserInfo(); if(ui != null) conn.setRequestProperty(AUTHORIZATION, "Basic " + Base64.encode(ui)); return conn.getInputStream(); } catch(final IOException ex) { final TokenBuilder msg = new TokenBuilder(Util.message(ex)); try { // try to retrieve more information on why the request failed if(conn instanceof HttpURLConnection) { final InputStream es = ((HttpURLConnection) conn).getErrorStream(); if(es != null) { final byte[] err = new IOStream(es).read(); if(err.length != 0) msg.add(NL).add(INFORMATION).add(COL).add(NL).add(err); } } } finally { /* ignored */ } final IOException io = new IOException(msg.toString()); io.setStackTrace(ex.getStackTrace()); throw io; } catch(final RuntimeException ex) { // catch unexpected runtime exceptions Util.debug(ex); throw new BaseXException(NOT_PARSED_X, path); } } @Override public String dirPath() { return path.endsWith("/") ? path : path.substring(0, path.lastIndexOf('/') + 1); } @Override public IO merge(final String f) { final IO io = IO.get(f); if(!(io instanceof IOFile) || f.contains(":") || f.startsWith("/")) return io; return IO.get((path.endsWith("/") ? path : path.replace("^(.*/).*", "$1")) + f); } /** * Checks if the specified uri starts with a valid scheme. * @param url url to be converted * @return file path */ static boolean isValid(final String url) { int u = -1; final int us = url.length(); while(++u < us) { final char c = url.charAt(u); if(!Token.letterOrDigit(c) && c != '+' && c != '-' && c != '.') break; } return u > 2 && u + 1 < us && url.charAt(u) == ':' && url.charAt(u + 1) == '/'; } /** * Checks if the specified string is a valid file URI. * @param s source * @return result of check */ public static boolean isFileURL(final String s) { return s.startsWith(FILEPREF + '/'); } } basex-7.7.2/basex-core/src/main/java/org/basex/io/MimeTypes.java000066400000000000000000000110761222453003200243720ustar00rootroot00000000000000package org.basex.io; import static org.basex.util.Token.*; import java.io.*; import java.util.*; import org.basex.io.in.*; import org.basex.util.*; /** * This class returns the mime types of a file, which is either dynamically * determined by Java, or statically resolved by requesting the mappings in * the {@code mime.txt} project file. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class MimeTypes { /** Content-Type. */ public static final String CONTENT_TYPE = "Content-Type"; /** Text type. */ public static final String TEXT = "text/"; /** Multipart type. */ public static final String MULTIPART = "multipart/"; /** Media type: multipart/form-data. */ public static final String MULTIPART_FORM_DATA = "multipart/form-data"; /** Media type: application/html+xml. */ public static final String APP_HTML_XML = "application/html+xml"; /** Media type: application/json. */ public static final String APP_JSON = "application/json"; /** Media type: application/jsonml+json. */ public static final String APP_JSONML = "application/jsonml+json"; /** Media type: text/plain. */ public static final String APP_OCTET = "application/octet-stream"; /** Media type: application/xml. */ public static final String APP_XML = "application/xml"; /** Media type: application/xml-external-parsed-entity. */ public static final String APP_XML_EXTERNAL = "application/xml-external-parsed-entity"; /** Media type: application/x-www-form-urlencoded. */ public static final String APP_FORM_URLENCODED = "application/x-www-form-urlencoded"; /** Media type: text/comma-separated-values. */ public static final String TEXT_CSV = "text/comma-separated-values"; /** Media type: text/html. */ public static final String TEXT_HTML = "text/html"; /** Media type: text/plain. */ public static final String TEXT_PLAIN = "text/plain"; /** Media type: text/xml. */ public static final String TEXT_XML = "text/xml"; /** XML media type. */ public static final String TEXT_XML_EXT = "text/xml-external-parsed-entity"; /** XML media types' suffix. */ public static final String XML_SUFFIX = "+xml"; /** Private constructor. */ private MimeTypes() { } /** * Returns the mime type for the suffix of the specified file path. * {@code application/octet-stream} is returned if no type is found. * @param path path to be checked * @return mime-type */ public static String get(final String path) { final String ct = TYPES.get(IO.suffix(path)); return ct != null ? ct : APP_OCTET; } /** * Checks if the content type is an XML content type. * @param type content type * @return result of check */ public static boolean isXML(final String type) { return eq(type, TEXT_XML, TEXT_XML_EXT, APP_XML, APP_XML_EXTERNAL) || type.endsWith(XML_SUFFIX); } /** * Checks if the main part of the content type is {@code "text"}. * @param type content type * @return result of check */ public static boolean isText(final String type) { return type.startsWith(TEXT); } /** * Checks if the content type is a multipart content type. * @param type content type * @return result of check */ public static boolean isMultipart(final String type) { return type.startsWith(MULTIPART); } /** * Checks if a content type is accepted by the specified pattern. * @param type content type * @param pattern pattern * @return result of check */ public static boolean matches(final String type, final String pattern) { final String[] t = type.split("/", 2); final String[] p = pattern.split("/", 2); return t.length == 2 && p.length == 2 && (p[0].equals("*") || p[0].equals(t[0])) && (p[1].equals("*") || p[1].equals(t[1])); } /** Hash map containing all assignments. */ private static final HashMap TYPES = new HashMap(); /** Reads in the mime-types. */ static { try { final String file = "/mime.properties"; final InputStream is = MimeTypes.class.getResourceAsStream(file); if(is == null) { Util.errln(file + " not found."); } else { final NewlineInput nli = new NewlineInput(is); try { for(String line; (line = nli.readLine()) != null;) { final int i = line.indexOf('='); if(i == -1 || line.startsWith("#")) continue; TYPES.put(line.substring(0, i), line.substring(i + 1)); } } finally { nli.close(); } } } catch(final IOException ex) { Util.errln(ex); } } } basex-7.7.2/basex-core/src/main/java/org/basex/io/QueryInput.java000066400000000000000000000020101222453003200245670ustar00rootroot00000000000000package org.basex.io; import org.basex.core.*; /** * This class references input passed on in a query. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class QueryInput { /** Original input string. */ public final String original; /** Input reference. */ public final IO input; /** Optional database path. */ public String path = ""; /** Optional database name. */ public String db; /** * Constructor. * @param in input path */ public QueryInput(final String in) { original = in; input = IO.get(in); // checks if the specified input reference is a valid database name if(Databases.validName(in)) { db = in; } else { final int s = in.indexOf('/'); if(s > 0 && in.indexOf(':') == -1) { final String n = in.substring(0, s); if(Databases.validName(n)) { path = in.substring(s + 1); db = n; } } } } @Override public String toString() { return original; } } basex-7.7.2/basex-core/src/main/java/org/basex/io/Zip.java000066400000000000000000000105601222453003200232150ustar00rootroot00000000000000package org.basex.io; import java.io.*; import java.util.zip.*; import org.basex.core.*; import org.basex.util.list.*; /** * Contains methods for zipping and unzipping archives. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Zip extends Proc { /** Archive. */ private final IO archive; /** Total files in a zip operation. */ private int total; /** Current file in a zip operation. */ private int curr; /** * Constructor. * @param file archive file */ public Zip(final IO file) { archive = file; } /** * Returns the number of entries in a zip archive. * @return number of entries * @throws IOException I/O exception */ private int size() throws IOException { int c = 0; final ZipInputStream in = new ZipInputStream(archive.inputStream()); try { while(in.getNextEntry() != null) c++; return c; } finally { in.close(); } } /** * Returns the contents of a zip file entry. * @param path file to be read * @return resulting byte array * @throws IOException I/O exception */ public byte[] read(final String path) throws IOException { final ZipInputStream in = new ZipInputStream(archive.inputStream()); try { final byte[] cont = getEntry(in, path); if(cont == null) throw new FileNotFoundException(path); return cont; } finally { in.close(); } } /** * Unzips the archive to the specified directory. * @param target target path * @throws IOException I/O exception */ public void unzip(final IOFile target) throws IOException { final byte[] data = new byte[IO.BLOCKSIZE]; final ZipInputStream in = new ZipInputStream(archive.inputStream()); total = size(); curr = 0; try { for(ZipEntry ze; (ze = in.getNextEntry()) != null;) { curr++; final IOFile trg = new IOFile(target, ze.getName()); if(ze.isDirectory()) { trg.md(); } else { trg.dir().md(); final OutputStream out = new FileOutputStream(trg.path()); try { for(int c; (c = in.read(data)) != -1;) out.write(data, 0, c); } finally { out.close(); } } } } finally { in.close(); } } /** * Zips the specified files. * @param root root directory * @param files files to add * @throws IOException I/O exception */ public void zip(final IOFile root, final StringList files) throws IOException { if(!(archive instanceof IOFile)) throw new FileNotFoundException(archive.path()); final byte[] data = new byte[IO.BLOCKSIZE]; final ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream( new FileOutputStream(archive.path()))); curr = 0; try { // use simple, fast compression out.setLevel(1); // loop through all files total = files.size(); for(final String file : files) { curr++; final FileInputStream in = new FileInputStream(new File(root.file(), file)); try { final String fl = Prop.WIN ? file.replace('\\', '/') : file; out.putNextEntry(new ZipEntry(root.name() + '/' + fl)); for(int c; (c = in.read(data)) != -1;) out.write(data, 0, c); out.closeEntry(); } finally { in.close(); } } } finally { out.close(); } } @Override protected double prog() { return (double) curr / total; } /** * Returns the contents of the specified entry, or {@code null}. * @param in input stream * @param entry entry to be found * @return entry * @throws IOException I/O exception */ public static byte[] getEntry(final ZipInputStream in, final String entry) throws IOException { for(ZipEntry ze; (ze = in.getNextEntry()) != null;) { if(!entry.equals(ze.getName())) continue; final int s = (int) ze.getSize(); if(s >= 0) { // known size: pre-allocate and fill array final byte[] data = new byte[s]; int c, o = 0; while(s - o != 0 && (c = in.read(data, o, s - o)) != -1) o += c; return data; } // unknown size: use byte list final byte[] data = new byte[IO.BLOCKSIZE]; final ByteList bl = new ByteList(); for(int c; (c = in.read(data)) != -1;) bl.add(data, 0, c); return bl.toArray(); } return null; } } basex-7.7.2/basex-core/src/main/java/org/basex/io/in/000077500000000000000000000000001222453003200222145ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/io/in/ArrayInput.java000066400000000000000000000012611222453003200251550ustar00rootroot00000000000000package org.basex.io.in; import org.basex.util.*; /** * This class allows reading from a cached byte array. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ArrayInput extends BufferInput { /** * Constructor, specifying the byte array to be read. * @param in input bytes */ public ArrayInput(final byte[] in) { super(in); } /** * Constructor, specifying the string to be read. * @param in input bytes */ public ArrayInput(final String in) { this(Token.token(in)); } @Override protected int readByte() { return bpos < bsize ? buffer[bpos++] & 0xFF : -1; } } basex-7.7.2/basex-core/src/main/java/org/basex/io/in/BufferInput.java000066400000000000000000000112741222453003200253150ustar00rootroot00000000000000package org.basex.io.in; import java.io.*; import java.util.zip.*; import org.basex.io.*; import org.basex.util.list.*; /** * This class uses an internal buffer to speed up input stream processing. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class BufferInput extends InputStream { /** Byte buffer. */ protected final byte[] buffer; /** Current buffer position. */ protected int bpos; /** Current buffer size. */ protected int bsize; /** Total length of input to be processed ({@code -1} if unknown). */ protected long length; /** Input file. */ protected IO input; /** Reference to the data input stream. */ private final InputStream in; /** Buffer marker to jump back ({@code -1} if not available). */ private int bmark; /** Number of read bytes. */ private int read; /** * Constructor. * @param io input to be read * @throws IOException I/O Exception */ public BufferInput(final IO io) throws IOException { this(io.inputStream()); length = io.length(); input = io; } /** * Constructor. * @param is input stream */ public BufferInput(final InputStream is) { this(is, IO.BLOCKSIZE); } /** * Initializes the file reader. * @param is input stream * @param bs buffer size */ public BufferInput(final InputStream is, final int bs) { buffer = new byte[bs]; length = -1; in = is; } /** * Empty constructor with fixed input. * @param array array input */ protected BufferInput(final byte[] array) { buffer = array; bsize = array.length; length = bsize; in = null; } /** * Returns the IO reference, or {@code null}. * @return file reference */ public IO io() { return input; } /** * Returns the next byte. By default, this method calls {@link #readByte()}; * {@code -1} is returned if all bytes have been read. * @return next byte * @throws IOException I/O exception * @see InputStream#read() */ @Override public int read() throws IOException { return readByte(); } /** * Returns the next unsigned byte. * {@code -1} is returned if all bytes have been read. * @return next unsigned byte * @throws IOException I/O exception * @see InputStream#read() */ protected int readByte() throws IOException { final int blen = buffer.length; final byte[] buf = buffer; if(bpos >= bsize) { read += bsize; if(bsize == blen) { // reset mark if buffer is full bmark = -1; bsize = 0; bpos = 0; } int r; while((r = in.read(buf, bsize, blen - bsize)) == 0); if(r < 0) return -1; bsize += r; } return buf[bpos++] & 0xFF; } /** * Reads a string from the input stream, suffixed by a {@code 0} byte. * @return string * @throws IOException I/O Exception */ public final String readString() throws IOException { final ByteList bl = new ByteList(); for(int l; (l = read()) > 0;) bl.add(l); return bl.toString(); } /** * Reads a byte array from the input stream, suffixed by a {@code 0} byte. * @return token * @throws IOException I/O Exception */ public final byte[] readBytes() throws IOException { final ByteList bl = new ByteList(); for(int l; (l = readByte()) > 0;) bl.add(l); return bl.toArray(); } @Override public final void close() throws IOException { if(in != null && !(in instanceof ZipInputStream)) in.close(); } /** * Returns the number of read bytes. * @return read bytes */ public final int size() { return read + bpos; } /** * Returns the input length (may be {@code -1}). * @return input length */ public final long length() { return length; } @Override public final boolean markSupported() { return true; } @Override public synchronized void mark(final int m) { bmark = bpos; } @Override public final synchronized void reset() throws IOException { if(bmark == -1) throw new IOException("Mark cannot be reset."); bpos = bmark; } /** * Retrieves and returns the whole data and closes the stream. * @return contents * @throws IOException I/O exception */ public byte[] content() throws IOException { try { if(length > -1) { // input length is known in advance final int sl = (int) Math.min(Integer.MAX_VALUE, length); final byte[] bytes = new byte[sl]; for(int c = 0; c < sl; c++) bytes[c] = (byte) readByte(); return bytes; } // parse until end of stream final ByteList bl = new ByteList(); for(int ch; (ch = readByte()) != -1;) bl.add(ch); return bl.toArray(); } finally { close(); } } } basex-7.7.2/basex-core/src/main/java/org/basex/io/in/DataInput.java000066400000000000000000000075011222453003200247530ustar00rootroot00000000000000package org.basex.io.in; import java.io.*; import org.basex.io.*; import org.basex.util.*; import org.basex.util.list.*; /** * This is an input stream for project specific data types. * It bears resemblance to Java's {@link DataInputStream}. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DataInput extends BufferInput { /** * Constructor. * @param io the input to be read * @throws IOException I/O Exception */ public DataInput(final IO io) throws IOException { super(io); } /** * Reads a boolean value. * @return boolean value * @throws IOException I/O Exception */ public boolean readBool() throws IOException { return read() == 1; } /** * Reads a token, represented by its compressed length and its byte array. * @return byte array * @throws IOException I/O Exception */ public byte[] readToken() throws IOException { final int l = readNum(); if(l == 0) return Token.EMPTY; final byte[] array = new byte[l]; for(int i = 0; i < l; ++i) array[i] = (byte) read(); return array; } /** * Reads a double value. * @return byte array * @throws IOException I/O Exception */ public double readDouble() throws IOException { return Token.toDouble(readToken()); } /** * Reads a distance-mapped integer array. * @return integer array * @throws IOException I/O Exception */ public IntList readDiffs() throws IOException { final int[] array = new int[readNum()]; for(int a = 0; a < array.length; ++a) { array[a] = (a == 0 ? 0 : array[a - 1]) + readNum(); } return new IntList(array); } /** * Reads a compressed integer array. * @return integer array * @throws IOException I/O Exception */ public int[] readNums() throws IOException { return readNums(readNum()); } /** * Reads compressed integer values of the specified size. * @param s array size * @return integer array * @throws IOException I/O Exception */ int[] readNums(final int s) throws IOException { final int[] array = new int[s]; for(int a = 0; a < s; ++a) array[a] = readNum(); return array; } /** * Reads a token array. * @return double array * @throws IOException I/O Exception */ public byte[][] readTokens() throws IOException { final int l = readNum(); final byte[][] array = new byte[l][]; for(int i = 0; i < l; ++i) array[i] = readToken(); return array; } /** * Reads a compressed integer value; see {@link Num} for more. * @return read value * @throws IOException I/O Exception */ public int readNum() throws IOException { final int v = read(); if(v == -1) return 0; switch((v & 0xC0) >>> 6) { case 0: return v; case 1: return ((v & 0x3F) << 8) + read(); case 2: return ((v & 0x3F) << 24) + (read() << 16) + (read() << 8) + read(); default: return (read() << 24) + (read() << 16) + (read() << 8) + read(); } } /** * Reads an array of long values. * @param s array size * @return array of longs * @throws IOException I/O Exception */ public long[] readLongs(final int s) throws IOException { final long[] array = new long[s]; for(int a = 0; a < s; ++a) array[a] = read8(); return array; } /** * Read a long value. * @return read value * @throws IOException I/O Exception */ long read8() throws IOException { return ((long) read() << 56) + ((long) (read() & 255) << 48) + ((long) (read() & 255) << 40) + ((long) (read() & 255) << 32) + ((long) (read() & 255) << 24) + ((read() & 255) << 16) + ((read() & 255) << 8) + (read() & 255); } } basex-7.7.2/basex-core/src/main/java/org/basex/io/in/DecodingInput.java000066400000000000000000000021601222453003200256120ustar00rootroot00000000000000package org.basex.io.in; import java.io.*; /** * This server-side class wraps an {@link InputStream} filled by a database * client. The incoming bytes are decoded: *
    *
  • {@code 0x00} is treated as end of stream, and -1 is returned
  • *
  • {@code 0xFF} is treated as encoding flag and skipped
  • *
* * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DecodingInput extends InputStream { /** Input stream. */ private final InputStream input; /** All bytes have been read. */ private boolean more = true; /** * Constructor. * @param in buffer input to be wrapped */ public DecodingInput(final InputStream in) { input = in; } @Override public int read() throws IOException { if(more) { final int b = input.read(); if(b != 0) return b == 0xFF ? input.read() : b; more = false; } return -1; } /** * Flushes the remaining client data. * @throws IOException I/O exception */ public void flush() throws IOException { while(read() != -1); } } basex-7.7.2/basex-core/src/main/java/org/basex/io/in/LookupInput.java000066400000000000000000000016501222453003200253520ustar00rootroot00000000000000package org.basex.io.in; import java.io.*; /** * This input stream allows a lookup of the next byte to be returned * by an {@link InputStream} reference. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class LookupInput extends InputStream { /** Input stream. */ private final InputStream input; /** Current value. */ private int curr; /** * Constructor. * @param in buffer input to be wrapped * @throws IOException I/O exception */ public LookupInput(final InputStream in) throws IOException { input = in; read(); } /** * Returns the current (next) value. * @return current value */ public int lookup() { return curr; } @Override public int read() throws IOException { final int v = curr; if(v != -1) curr = input.read(); return v; } @Override public void close() throws IOException { input.close(); } } basex-7.7.2/basex-core/src/main/java/org/basex/io/in/NewlineInput.java000066400000000000000000000037321222453003200255050ustar00rootroot00000000000000package org.basex.io.in; import java.io.*; import org.basex.io.*; import org.basex.util.*; /** * This class provides a convenient access to text input. System dependent * line breaks ({@code \r\n}, {@code \n}, {@code \r}) will be normalized to * newline characters {@code \n}, and the input encoding will be guessed by * analyzing the first bytes. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class NewlineInput extends TextInput { /** Next value ({@code -2} means no caching). */ private int next = -2; /** * Constructor. * @param is input stream * @throws IOException I/O exception */ public NewlineInput(final InputStream is) throws IOException { super(is); } /** * Constructor. * @param in input * @throws IOException I/O exception */ public NewlineInput(final IO in) throws IOException { super(in); } @Override public NewlineInput encoding(final String encoding) throws IOException { super.encoding(encoding); return this; } @Override public int read() throws IOException { int n = next; if(n != -2) { next = -2; } else { n = super.read(); } if(n != '\r') return n; n = super.read(); if(n != '\n') next = n; return '\n'; } /** * Reads and returns a single line. * @return line, or {@code null} * @throws IOException I/O exception */ public String readLine() throws IOException { final TokenBuilder tb = new TokenBuilder(); return readLine(tb) ? tb.toString() : null; } /** * Copies a single line to the specified token builder. * @param tb token builder to be filled. * @return {@code true} if more input was found * @throws IOException I/O exception */ public boolean readLine(final TokenBuilder tb) throws IOException { tb.reset(); while(true) { final int ch = read(); if(ch == -1) return !tb.isEmpty(); if(ch == '\n') return true; tb.add(ch); } } } basex-7.7.2/basex-core/src/main/java/org/basex/io/in/TextDecoder.java000066400000000000000000000106741222453003200253010ustar00rootroot00000000000000package org.basex.io.in; import static org.basex.util.Token.*; import java.io.*; import java.nio.*; import java.nio.charset.*; import org.basex.io.serial.*; /** * This abstract class specifies a single method for decoding input to UTF-8. * The inheriting classes are optimized for performance and faster than Java's * default decoders. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ abstract class TextDecoder { /** Encoding. */ String encoding; /** Indicates if input must be valid. */ boolean valid; /** * Returns the next character. * @param ti text input * @return next character * @throws IOException I/O exception */ abstract int read(final TextInput ti) throws IOException; /** * Returns a decoder for the specified encoding. * @param enc encoding * @return decoder * @throws IOException I/O exception */ static TextDecoder get(final String enc) throws IOException { final TextDecoder td; if(enc == UTF8) td = new TextDecoder.UTF8(); else if(enc == UTF32) td = new TextDecoder.UTF32(); else if(enc == UTF16LE) td = new TextDecoder.UTF16LE(); else if(enc == UTF16BE) td = new TextDecoder.UTF16BE(); else td = new TextDecoder.Generic(enc); td.encoding = enc; return td; } /** * Processes an invalid character. Throws an exception if input must be valid, * or returns a question mark as replacement. * @throws IOException I/O exception * @return question mark */ int invalid() throws IOException { if(valid) throw new InputException(); return '?'; } /** UTF8 Decoder. */ static class UTF8 extends TextDecoder { /** UTF8 cache. */ private final byte[] cache = new byte[4]; @Override int read(final TextInput ti) throws IOException { int ch = ti.readByte(); if(ch < 0x80) return ch; if(ch < 0xC0) return invalid(); cache[0] = (byte) ch; final int cl = cl((byte) ch); for(int c = 1; c < cl; ++c) { ch = ti.readByte(); if(ch < 0x80) return invalid(); cache[c] = (byte) ch; } return cp(cache, 0); } } /** UTF16LE Decoder. */ static class UTF16LE extends TextDecoder { @Override int read(final TextInput ti) throws IOException { final int a = ti.readByte(); if(a < 0) return a; final int b = ti.readByte(); if(b < 0) return invalid(); return a | b << 8; } } /** UTF16BE Decoder. */ static class UTF16BE extends TextDecoder { @Override int read(final TextInput ti) throws IOException { final int a = ti.readByte(); if(a < 0) return a; final int b = ti.readByte(); if(b < 0) return invalid(); return a << 8 | b; } } /** UTF32 Decoder. */ static class UTF32 extends TextDecoder { @Override int read(final TextInput ti) throws IOException { final int a = ti.readByte(); if(a < 0) return a; final int b = ti.readByte(); if(b < 0) return invalid(); final int c = ti.readByte(); if(c < 0) return invalid(); final int d = ti.readByte(); if(d < 0) return invalid(); return a << 24 | b << 16 | c << 8 | d; } } /** Generic Decoder. */ static class Generic extends TextDecoder { /** Input cache. */ private final byte[] cache = new byte[4]; /** Input buffer. */ private final ByteBuffer inc = ByteBuffer.wrap(cache); /** Output buffer. */ private final CharBuffer outc = CharBuffer.wrap(new char[4]); /** Charset decoder. */ private final CharsetDecoder csd; /** * Constructor. * @param enc encoding * @throws IOException I/O exception */ Generic(final String enc) throws IOException { try { csd = Charset.forName(enc).newDecoder(); } catch(final Exception ex) { throw new EncodingException(ex); } } @Override int read(final TextInput ti) throws IOException { int c = -1; while(++c < 4) { final int ch = ti.readByte(); if(ch < 0) break; cache[c] = (byte) ch; outc.position(0); inc.position(0); inc.limit(c + 1); csd.reset(); final CoderResult cr = csd.decode(inc, outc, true); if(cr.isMalformed()) continue; // return character int i = 0; final int os = outc.position(); for(int o = 0; o < os; ++o) i |= outc.get(o) << (o << 3); return i; } return c == 0 ? -1 : invalid(); } } } basex-7.7.2/basex-core/src/main/java/org/basex/io/in/TextInput.java000066400000000000000000000070401222453003200250240ustar00rootroot00000000000000package org.basex.io.in; import static org.basex.util.Token.*; import java.io.*; import org.basex.io.*; import org.basex.io.serial.*; import org.basex.util.*; /** * This class provides buffered access to textual input. * The input encoding will initially be guessed by analyzing the first bytes; * it can also be explicitly set by calling {@link #encoding()}. * UTF-8 will be used as default encoding. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class TextInput extends BufferInput { /** Decoder. */ private TextDecoder decoder; /** Indicates if the input is to be checked for valid XML 1.0.5 characters. */ private boolean valid; /** * Constructor. * @param is input stream * @throws IOException I/O exception */ public TextInput(final InputStream is) throws IOException { super(is); guess(); } /** * Constructor. * @param io input * @throws IOException I/O exception */ public TextInput(final IO io) throws IOException { super(io); guess(); } /** * Reads the first bytes of the input stream to guess the text encoding. * @throws IOException I/O exception */ private void guess() throws IOException { try { final int a = readByte(); final int b = readByte(); final int c = readByte(); final int d = readByte(); String e = null; int skip = 0; if(a == 0xFF && b == 0xFE) { // BOM: FF FE e = UTF16LE; skip = 2; } else if(a == 0xFE && b == 0xFF) { // BOM: FE FF e = UTF16BE; skip = 2; } else if(a == 0xEF && b == 0xBB && c == 0xBF) { // BOM: EF BB BF skip = 3; } else if(a == '<' && b == 0 && c == '?' && d == 0) { e = UTF16LE; } else if(a == 0 && b == '<' && c == 0 && d == '?') { e = UTF16BE; } reset(); for(int s = 0; s < skip; s++) readByte(); decoder = TextDecoder.get(normEncoding(e)); } catch(final IOException ex) { close(); throw ex; } } /** * Returns the encoding. * @return encoding */ public final String encoding() { return decoder.encoding; } /** * Checks the input for valid XML characters and throws an exception if invalid * characters are found. * @param v flag to be set * @return self reference */ public final TextInput validate(final boolean v) { valid = v; decoder.valid = v; return this; } /** * Sets a new encoding. * @param enc encoding * @return self reference * @throws IOException I/O Exception */ public TextInput encoding(final String enc) throws IOException { if(enc != null) { decoder = TextDecoder.get(normEncoding(enc, decoder.encoding)); decoder.valid = valid; } return this; } /** * Returns the next character. * @return next codepoint * @throws IOException I/O exception */ @Override public int read() throws IOException { final int ch = decoder.read(this); if(ch != -1 && valid && !XMLToken.valid(ch)) throw new EncodingException(ch); return ch; } @Override public final byte[] content() throws IOException { return cache().finish(); } /** * Retrieves the whole text and closes the stream. * @return token builder instance * @throws IOException I/O exception */ public final TokenBuilder cache() throws IOException { final TokenBuilder tb = new TokenBuilder(Math.max(Array.CAPACITY, (int) length)); try { for(int ch; (ch = read()) != -1;) tb.add(ch); } finally { close(); } return tb; } } basex-7.7.2/basex-core/src/main/java/org/basex/io/in/XMLInput.java000066400000000000000000000054441222453003200245460ustar00rootroot00000000000000package org.basex.io.in; import java.io.*; import org.basex.io.*; import org.basex.util.*; /** * This class provides methods for reading XML input and recursive entities. * The input encoding will be guessed by analyzing the first bytes. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class XMLInput extends InputStream { /** Input streams. */ private NewlineInput[] inputs = new NewlineInput[1]; /** Input pointer. */ private int ip; /** Current line. */ private int line = 1; /** Buffer with most recent characters. */ private final int[] last = new int[16]; /** Read position. */ private int lp; /** Backward pointer. */ private int pp; /** * Constructor. * @param io input reference * @throws IOException I/O exception */ public XMLInput(final IO io) throws IOException { inputs[0] = new NewlineInput(io); } /** * Sets a new encoding. * @param e encoding * @throws IOException I/O exception */ public void encoding(final String e) throws IOException { inputs[0].encoding(e); } /** * Returns the IO reference. * @return file reference */ public IO io() { return inputs[0].io(); } /** * Jumps the specified number of characters back. * @param p number of characters */ public void prev(final int p) { pp -= p; } @Override public int read() throws IOException { if(pp != 0) return last[lp + pp++ & 0x0F]; int ch = inputs[ip].read(); while(ch == -1 && ip != 0) ch = inputs[--ip].read(); last[lp++] = ch; lp &= 0x0F; if(ip == 0 && ch == '\n') ++line; return ch; } /** * Inserts some bytes in the input stream. * @param val values to insert * @param s add spaces * @return true if everything went alright * @throws IOException I/O exception */ public boolean add(final byte[] val, final boolean s) throws IOException { if(s) add(new NewlineInput(new ArrayInput(Token.SPACE))); add(new NewlineInput(new ArrayInput(val))); if(s) add(new NewlineInput(new ArrayInput(Token.SPACE))); return ip < 32; } /** * Inserts a cached input buffer. * @param ti buffer to be added */ private void add(final NewlineInput ti) { if(++ip == inputs.length) inputs = Array.copy(inputs, new NewlineInput[Array.newSize(ip)]); inputs[ip] = ti; } @Override public void close() throws IOException { inputs[0].close(); } /** * Returns the current file position. * @return file position */ public int pos() { return Math.max(ip, inputs[ip].size() + pp); } /** * Returns the current line. * @return line */ public int line() { return line; } /** * Returns the file length. * @return file position */ public long length() { return inputs[0].length(); } } basex-7.7.2/basex-core/src/main/java/org/basex/io/out/000077500000000000000000000000001222453003200224155ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/io/out/ArrayOutput.java000066400000000000000000000027301222453003200255610ustar00rootroot00000000000000package org.basex.io.out; import java.io.*; import java.util.*; import org.basex.util.*; /** * This class caches the output bytes in an array, similar to the * {@link ByteArrayOutputStream} class. Bytes that exceed an * optional maximum are ignored. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ArrayOutput extends PrintOutput { /** Byte buffer. */ private byte[] buf = new byte[8]; /** * Sets the maximum number of bytes to be written. * Note that the limit might break unicode characters. * @param m maximum * @return self reference */ public ArrayOutput max(final int m) { max = m; return this; } @Override public void write(final int b) { final int s = (int) size; if(s == max) return; if(s == buf.length) buf = Arrays.copyOf(buf, Array.newSize(s)); buf[s] = (byte) b; size = s + 1; } /** * Returns the output as byte array. * @return byte array */ public byte[] toArray() { return Arrays.copyOf(buf, (int) size); } @Override public boolean finished() { return size == max; } /** * Returns the internal buffer. * @return buffer */ public byte[] buffer() { return buf; } /** * Resets the internal buffer. */ public void reset() { size = 0; } @Override public String toString() { return Token.string(buf, 0, (int) size); } } basex-7.7.2/basex-core/src/main/java/org/basex/io/out/BufferOutput.java000066400000000000000000000030631222453003200257140ustar00rootroot00000000000000package org.basex.io.out; import java.io.*; import org.basex.io.*; /** * This class uses a byte buffer to speed up output stream processing. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Tim Petrowsky */ public final class BufferOutput extends OutputStream { /** Buffer size. */ private final int bufsize; /** Byte buffer. */ private final byte[] buffer; /** Reference to the data output stream. */ private final OutputStream os; /** Current buffer position. */ private int pos; /** * Constructor. * @param file target file * @throws IOException I/O exception */ public BufferOutput(final String file) throws IOException { this(new FileOutputStream(file), IO.BLOCKSIZE); } /** * Constructor with a default buffer size. * @param out the stream to write to */ public BufferOutput(final OutputStream out) { this(out, IO.BLOCKSIZE); } /** * Constructor with a specific buffer size. * @param out the stream to write to * @param bufs buffer size */ public BufferOutput(final OutputStream out, final int bufs) { os = out; buffer = new byte[bufs]; bufsize = bufs; } @Override public void write(final int b) throws IOException { if(pos == bufsize) flush(); buffer[pos++] = (byte) b; } @Override public void flush() throws IOException { os.write(buffer, 0, pos); pos = 0; } @Override public void close() throws IOException { flush(); os.close(); } } basex-7.7.2/basex-core/src/main/java/org/basex/io/out/DataOutput.java000066400000000000000000000142701222453003200253560ustar00rootroot00000000000000package org.basex.io.out; import java.io.*; import org.basex.io.*; import org.basex.util.*; import org.basex.util.list.*; /** * This is an output stream for project specific data types. * It bears resemblance to Java's {@link DataOutputStream}. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DataOutput extends OutputStream { /** The underlying output stream. */ private final OutputStream os; /** Number of written bytes. */ private long size; /** * Constructor, specifying an output stream. * @param out output stream to operate on */ public DataOutput(final OutputStream out) { os = out; } /** * Constructor, specifying a file. * @param db name of the database * @throws IOException I/O exception */ public DataOutput(final IOFile db) throws IOException { this(db, IO.BLOCKSIZE); } /** * Constructor, specifying a file and a buffer size. * The specified buffer size is used. * @param db name of the database * @param bufs size of the buffer to use * @throws IOException I/O exception */ public DataOutput(final IOFile db, final int bufs) throws IOException { os = new BufferOutput(new FileOutputStream(db.file()), bufs); } @Override public void write(final int b) throws IOException { os.write(b); ++size; } /** * Writes a boolean value. * @param b boolean value * @throws IOException I/O exception */ public void writeBool(final boolean b) throws IOException { write(b ? 1 : 0); } /** * Writes a token, represented by its compressed length and its byte array. * @param tok array to be written * @return number of written bytes * @throws IOException I/O exception */ public int writeToken(final byte[] tok) throws IOException { final int s = writeNum(tok.length); writeBytes(tok); return s + tok.length; } /** * Writes a double value. * @param num array to be written * @return number of written bytes * @throws IOException I/O exception */ public int writeDouble(final double num) throws IOException { return writeToken(Token.token(num)); } /** * Writes tokens. {@code null} references are replaced by an empty array. * @param array array to be written * @throws IOException I/O exception */ public void writeTokens(final byte[][] array) throws IOException { writeNum(array.length); for(final byte[] a : array) writeToken(a != null ? a : Token.EMPTY); } /** * Writes distances between integers. * @param array array to be written * @throws IOException I/O exception */ public void writeDiffs(final IntList array) throws IOException { final int al = array.size(); writeNum(al); int c = 0; for(int a = 0; a < al; a++) { final int t = array.get(a); writeNum(t - c); c = t; } } /** * Writes compressed numbers; see {@link Num} for more. * @param array array to be written * @throws IOException I/O exception */ public void writeNums(final int[] array) throws IOException { writeNum(array.length); for(final int a : array) writeNum(a); } /** * Writes a compressed integer value; see {@link Num} for more. * By compressing, the size of the database files is reduced. * @param v value to be written * @return number of written values * @throws IOException I/O exception */ public int writeNum(final int v) throws IOException { if(v < 0 || v > 0x3FFFFFFF) { write(0xC0); write(v >>> 24); write(v >>> 16); write(v >>> 8); write(v); return 5; } if(v > 0x3FFF) { write(v >>> 24 | 0x80); write(v >>> 16); write(v >>> 8); write(v); return 4; } if(v > 0x3F) { write(v >>> 8 | 0x40); write(v); return 2; } write(v); return 1; } /** * Writes long values. * NOTE: the long values are not compressed! * @param array array to be written * @throws IOException I/O exception */ public void writeLongs(final long[] array) throws IOException { writeNum(array.length); for(final long a : array) write8(a); } /** * Writes a byte value. * @param v value to be written * @throws IOException I/O exception */ public void write1(final int v) throws IOException { write(v); } /** * Writes a short value. * @param v value to be written * @throws IOException I/O exception */ public void write2(final int v) throws IOException { write(v >>> 8); write(v); } /** * Writes an integer value. * @param v value to be written * @throws IOException I/O exception */ public void write4(final int v) throws IOException { write(v >>> 24); write(v >>> 16); write(v >>> 8); write(v); } /** * Writes 5 bytes of a long value. * @param v value to be written * @throws IOException I/O exception */ public void write5(final long v) throws IOException { write((byte) (v >>> 32)); write((byte) (v >>> 24)); write((byte) (v >>> 16)); write((byte) (v >>> 8)); write((byte) v); } /** * Writes a long value. * @param v value to be written * @throws IOException I/O exception */ void write8(final long v) throws IOException { write((byte) (v >>> 56)); write((byte) (v >>> 48)); write((byte) (v >>> 40)); write((byte) (v >>> 32)); write((byte) (v >>> 24)); write((byte) (v >>> 16)); write((byte) (v >>> 8)); write((byte) v); } /** * Writes a byte array. * @param bytes array to be written * @throws IOException I/O exception */ public void writeBytes(final byte[] bytes) throws IOException { for(final byte b : bytes) write(b); } /** * Returns the number of written bytes. * This is not necessarily e.g. the file size. * @return number of written bytes */ public long size() { return size; } @Override public void flush() throws IOException { os.flush(); } @Override public void close() throws IOException { os.close(); } } basex-7.7.2/basex-core/src/main/java/org/basex/io/out/EncodingOutput.java000066400000000000000000000016741222453003200262370ustar00rootroot00000000000000package org.basex.io.out; import java.io.*; /** * This server-side class wraps an {@link InputStream} filled by a database * client. The incoming bytes are encoded: *
    *
  • {@code 0x00} and {@code 0xFF} are prefixed with {@code 0xFF}
  • *
  • {@code 0x00} is sent to indicate the end of a stream
  • *
* * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class EncodingOutput extends OutputStream { /** Output stream. */ private final OutputStream os; /** * Constructor. * @param out output stream to be wrapped */ public EncodingOutput(final OutputStream out) { os = out; } @Override public void write(final int b) throws IOException { if(b == 0x00 || (b & 0xFF) == 0xFF) os.write(0xFF); os.write(b); } @Override public void flush() throws IOException { os.flush(); } @Override public void close() throws IOException { os.close(); } } basex-7.7.2/basex-core/src/main/java/org/basex/io/out/NullOutput.java000066400000000000000000000004241222453003200254130ustar00rootroot00000000000000package org.basex.io.out; /** * This output stream swallows all data it receives. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class NullOutput extends PrintOutput { @Override public void write(final int b) { } } basex-7.7.2/basex-core/src/main/java/org/basex/io/out/PrintOutput.java000066400000000000000000000077621222453003200256110ustar00rootroot00000000000000package org.basex.io.out; import java.io.*; import org.basex.core.*; import org.basex.util.*; /** * This class is a stream-wrapper for textual data. Note that the internal * byte representation (usually UTF8) will be directly output without * further character conversion. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class PrintOutput extends OutputStream { /** Output stream reference. */ private final OutputStream os; /** Maximum numbers of bytes to write. */ long max = Long.MAX_VALUE; /** Number of bytes written. */ long size; /** Protected default constructor. */ PrintOutput() { this((OutputStream) null); } /** * Constructor, given a filename. * @param fn filename * @throws IOException I/O exception */ public PrintOutput(final String fn) throws IOException { this(new BufferOutput(fn)); } /** * Constructor, given an output stream. * @param out output stream reference */ private PrintOutput(final OutputStream out) { os = out; } /** * Returns a new instance for the given output stream. * @param out output stream reference * @return print output */ public static PrintOutput get(final OutputStream out) { return out instanceof PrintOutput ? (PrintOutput) out : new PrintOutput( out instanceof ByteArrayOutputStream || out instanceof BufferedOutputStream || out instanceof BufferOutput ? out : new BufferOutput(out)); } @Override public void write(final int b) throws IOException { if(size++ < max) os.write(b); } /** * Writes a character as UTF8. * @param ch character to be printed * @throws IOException I/O exception */ public void utf8(final int ch) throws IOException { if(ch <= 0x7F) { write(ch); } else if(ch <= 0x7FF) { write(ch >> 6 & 0x1F | 0xC0); write(ch & 0x3F | 0x80); } else if(ch <= 0xFFFF) { write(ch >> 12 & 0x0F | 0xE0); write(ch >> 6 & 0x3F | 0x80); write(ch & 0x3F | 0x80); } else { write(ch >> 18 & 0x07 | 0xF0); write(ch >> 12 & 0x3F | 0x80); write(ch >> 6 & 0x3F | 0x80); write(ch & 0x3F | 0x80); } } /** * Writes a string to the output stream, suffixed by a 0 byte. * @param str string to be written * @throws IOException I/O exception */ public final void writeString(final String str) throws IOException { print(Token.token(str)); write(0); } /** * Prints a string to the output stream. * @param str string to be written * @throws IOException I/O exception */ public final void print(final String str) throws IOException { print(Token.token(str)); } /** * Prints a string and newline to the output stream. * @param str string to be written * @throws IOException I/O exception */ public final void println(final String str) throws IOException { print(str); print(Prop.NL); } /** * Prints a token to the output stream. * @param token token to be written * @throws IOException I/O exception */ public final void print(final byte[] token) throws IOException { for(final byte t : token) write(t); } /** * Prints a token to the output stream. * @param token token to be written * @throws IOException I/O exception */ public final void println(final byte[] token) throws IOException { print(token); print(Prop.NL); } /** * Returns the number of written bytes. * @return number of written bytes */ public final long size() { return size; } @Override public final void flush() throws IOException { if(os != null) os.flush(); } @Override public final void close() throws IOException { if(os != null) { if(os == System.out || os == System.err) os.flush(); else os.close(); } } /** * Checks if stream can output more characters; can be overwritten to * interrupt streaming at some point. * @return result of check */ public boolean finished() { return false; } } basex-7.7.2/basex-core/src/main/java/org/basex/io/out/TableOutput.java000066400000000000000000000040431222453003200255310ustar00rootroot00000000000000package org.basex.io.out; import java.io.*; import org.basex.data.*; import org.basex.io.*; import org.basex.util.list.*; /** * This class allows a blockwise output of the database table. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Tim Petrowsky */ public final class TableOutput extends OutputStream { /** Buffer. */ private final byte[] buffer = new byte[IO.BLOCKSIZE]; /** Index entries. */ private final IntList fpres = new IntList(); /** Index entries. */ private final IntList pages = new IntList(); /** The underlying output stream. */ private final OutputStream os; /** Meta data. */ private final MetaData meta; /** Current filename. */ private final String file; /** Position inside buffer. */ private int pos; /** First pre value of current block. */ private int fpre; /** * Initializes the output. * The database suffix will be added to all filenames. * @param md meta data * @param fn the file to be written to * @throws IOException I/O exception */ public TableOutput(final MetaData md, final String fn) throws IOException { os = new FileOutputStream(md.dbfile(fn).file()); meta = md; file = fn; } @Override public void write(final int b) throws IOException { if(pos == IO.BLOCKSIZE) flush(); buffer[pos++] = (byte) b; } @Override public void flush() throws IOException { if(pos == 0) return; os.write(buffer); fpres.add(fpre); pages.add(pages.size()); fpre += pos >>> IO.NODEPOWER; pos = 0; } @Override public void close() throws IOException { final boolean empty = fpre + pos == 0; if(empty) pos++; flush(); os.close(); final DataOutput out = new DataOutput(meta.dbfile(file + 'i')); try { out.writeNum(pages.size()); out.writeNum(empty ? 0 : pages.size()); out.writeNums(fpres.toArray()); out.writeNums(pages.toArray()); } finally { out.close(); } } } basex-7.7.2/basex-core/src/main/java/org/basex/io/package.html000066400000000000000000000000541222453003200240660ustar00rootroot00000000000000 Input and Output classes. basex-7.7.2/basex-core/src/main/java/org/basex/io/random/000077500000000000000000000000001222453003200230665ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/io/random/Buffer.java000066400000000000000000000005761222453003200251520ustar00rootroot00000000000000package org.basex.io.random; import org.basex.io.*; /** * This class represents a simple buffer. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class Buffer { /** Buffer data. */ final byte[] data = new byte[IO.BLOCKSIZE]; /** Disk offset, or block position. */ long pos = -1; /** Dirty flag. */ boolean dirty; } basex-7.7.2/basex-core/src/main/java/org/basex/io/random/Buffers.java000066400000000000000000000021441222453003200253260ustar00rootroot00000000000000package org.basex.io.random; /** * This class provides a simple, clock-based buffer management. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class Buffers { /** Number of buffers (must be 1 << n). */ private static final int BUFFERS = 1 << 4; /** Buffers. */ private final Buffer[] buf = new Buffer[BUFFERS]; /** Current buffer offset. */ private int off; /** * Constructor. */ Buffers() { for(int b = 0; b < BUFFERS; ++b) buf[b] = new Buffer(); } /** * Returns all buffers. * @return buffers */ Buffer[] all() { return buf; } /** * Returns the current buffer. * @return current buffer */ Buffer current() { return buf[off]; } /** * Chooses a buffer and sets the offset. * @param p buffer pointer * @return true if cursor has changed */ boolean cursor(final long p) { final int o = off; do { if(buf[off].pos == p) return false; } while((off = off + 1 & BUFFERS - 1) != o); off = o + 1 & BUFFERS - 1; return true; } } basex-7.7.2/basex-core/src/main/java/org/basex/io/random/DataAccess.java000066400000000000000000000254611222453003200257340ustar00rootroot00000000000000package org.basex.io.random; import java.io.*; import org.basex.io.*; import org.basex.util.*; /** * This class allows positional read and write access to a database file. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DataAccess { /** Buffer manager. */ private final Buffers bm = new Buffers(); /** Reference to the data input stream. */ private final RandomAccessFile file; /** File length. */ private long len; /** Changed flag. */ private boolean changed; /** Offset. */ private int off; /** * Constructor, initializing the file reader. * @param f the file to be read * @throws IOException I/O Exception */ public DataAccess(final IOFile f) throws IOException { file = new RandomAccessFile(f.file(), "rw"); len = file.length(); cursor(0); } /** * Flushes the buffered data. */ public synchronized void flush() { try { for(final Buffer b : bm.all()) if(b.dirty) writeBlock(b); if(changed) { file.setLength(len); changed = false; } } catch(final IOException ex) { Util.stack(ex); } } /** * Closes the data access. */ public synchronized void close() { flush(); try { file.close(); } catch(final IOException ex) { Util.stack(ex); } } /** * Returns the current file position. * @return position in the file */ public long cursor() { return buffer(false).pos + off; } /** * Sets the file length. * @param l file length */ synchronized void length(final long l) { changed |= l != len; len = l; } /** * Returns the file length. * @return file length */ public long length() { return len; } /** * Checks if more bytes can be read. * @return result of check */ public boolean more() { return cursor() < len; } /** * Reads a byte value from the specified position. * @param p position * @return integer value */ public synchronized byte read1(final long p) { cursor(p); return read1(); } /** * Reads a byte value. * @return integer value */ public synchronized byte read1() { return (byte) read(); } /** * Reads an integer value from the specified position. * @param p position * @return integer value */ public synchronized int read4(final long p) { cursor(p); return read4(); } /** * Reads an integer value. * @return integer value */ public synchronized int read4() { return (read() << 24) + (read() << 16) + (read() << 8) + read(); } /** * Reads a 5-byte value from the specified file offset. * @param p position * @return long value */ public synchronized long read5(final long p) { cursor(p); return read5(); } /** * Reads a 5-byte value. * @return long value */ public synchronized long read5() { return ((long) read() << 32) + ((long) read() << 24) + (read() << 16) + (read() << 8) + read(); } /** * Reads a {@link Num} value from disk. * @param p text position * @return read num */ public synchronized int readNum(final long p) { cursor(p); return readNum(); } /** * Reads a token from disk. * @param p text position * @return text as byte array */ public synchronized byte[] readToken(final long p) { cursor(p); return readToken(); } /** * Reads the next token from disk. * @return text as byte array */ public synchronized byte[] readToken() { final int l = readNum(); return readBytes(l); } /** * Reads a number of bytes from the specified offset. * @param p position * @param l length * @return byte array */ public synchronized byte[] readBytes(final long p, final int l) { cursor(p); return readBytes(l); } /** * Reads a number of bytes. * @param n length * @return byte array */ public synchronized byte[] readBytes(final int n) { int l = n; int ll = IO.BLOCKSIZE - off; final byte[] b = new byte[l]; System.arraycopy(buffer(false).data, off, b, 0, Math.min(l, ll)); if(l > ll) { l -= ll; while(l > IO.BLOCKSIZE) { System.arraycopy(buffer(true).data, 0, b, ll, IO.BLOCKSIZE); ll += IO.BLOCKSIZE; l -= IO.BLOCKSIZE; } System.arraycopy(buffer(true).data, 0, b, ll, l); } off += l; return b; } /** * Sets the disk cursor. * @param p read position */ public void cursor(final long p) { off = (int) (p & IO.BLOCKSIZE - 1); final long b = p - off; if(!bm.cursor(b)) return; final Buffer bf = bm.current(); try { if(bf.dirty) writeBlock(bf); bf.pos = b; file.seek(bf.pos); if(bf.pos < file.length()) file.readFully(bf.data, 0, (int) Math.min(len - bf.pos, IO.BLOCKSIZE)); } catch(final IOException ex) { Util.stack(ex); } } /** * Reads the next compressed number and returns it as integer. * @return next integer */ public synchronized int readNum() { final int v = read(); switch(v & 0xC0) { case 0: return v; case 0x40: return (v - 0x40 << 8) + read(); case 0x80: return (v - 0x80 << 24) + (read() << 16) + (read() << 8) + read(); default: return (read() << 24) + (read() << 16) + (read() << 8) + read(); } } /** * Writes a 5-byte value to the specified position. * @param p position in the file * @param v value to be written */ public void write5(final long p, final long v) { cursor(p); write((byte) (v >>> 32)); write((byte) (v >>> 24)); write((byte) (v >>> 16)); write((byte) (v >>> 8)); write((byte) v); } /** * Writes an integer value to the specified position. * @param p write position * @param v byte array to be appended */ public void write4(final long p, final int v) { cursor(p); write4(v); } /** * Writes an integer value to the current position. * @param v value to be written */ public void write4(final int v) { write(v >>> 24); write(v >>> 16); write(v >>> 8); write(v); } /** * Write a value to the file. * @param p write position * @param v value to be written */ public void writeNum(final long p, final int v) { cursor(p); writeNum(v); } /** * Writes integers to the file in compressed form. * @param p write position * @param v integer values */ public void writeNums(final long p, final int[] v) { cursor(p); writeNum(v.length); for(final int n : v) writeNum(n); } /** * Appends integers to the file in compressed form. * @param v integer values * @return the position in the file where the values have been written */ public long appendNums(final int[] v) { final long end = len; writeNums(end, v); return end; } /** * Appends a value to the file and return it's offset. * @param p write position * @param v byte array to be appended */ public void writeToken(final long p, final byte[] v) { cursor(p); writeToken(v, 0, v.length); } /** * Write a token to the file. * @param buf buffer containing the token * @param offset offset in the buffer where the token starts * @param length token length */ public void writeToken(final byte[] buf, final int offset, final int length) { writeNum(length); final int last = offset + length; int o = offset; while(o < last) { final Buffer bf = buffer(off == IO.BLOCKSIZE); final int l = Math.min(last - o, IO.BLOCKSIZE - off); System.arraycopy(buf, o, bf.data, off, l); bf.dirty = true; off += l; o += l; } // adjust file size if needed final long nl = bm.current().pos + off; if(nl > len) length(nl); } /** * Appends a value to the file and return it's offset. * @param v number to be appended */ private void writeNum(final int v) { if(v < 0 || v > 0x3FFFFFFF) { write(0xC0); write(v >>> 24); write(v >>> 16); write(v >>> 8); write(v); } else if(v > 0x3FFF) { write(v >>> 24 | 0x80); write(v >>> 16); write(v >>> 8); write(v); } else if(v > 0x3F) { write(v >>> 8 | 0x40); write(v); } else { write(v); } } /** * Returns the offset to a free slot for writing an entry with the * specified length. Fills the original space with 0xFF to facilitate * future write operations. * @param pos original offset * @param size size of new text entry * @return new offset to store text */ public long free(final long pos, final int size) { // old text size (available space) int os = readNum(pos) + (int) (cursor() - pos); // extend available space by subsequent zero-bytes cursor(pos + os); for(; pos + os < len && os < size && read() == 0xFF; os++); long o = pos; if(pos + os == len) { // entry is placed last: reset file length (discard last entry) length(pos); } else { int t = size; if(os < size) { // gap is too small for new entry... // reset cursor to overwrite entry with zero-bytes cursor(pos); t = 0; // place new entry after last entry o = len; } else { // gap is large enough: set cursor to overwrite remaining bytes cursor(pos + size); } // fill gap with 0xFF for future updates while(t++ < os) write(0xFF); } return o; } // PRIVATE METHODS ========================================================== /** * Writes the specified block to disk. * @param bf buffer to write * @throws IOException I/O exception */ private void writeBlock(final Buffer bf) throws IOException { file.seek(bf.pos); file.write(bf.data); bf.dirty = false; } /** * Reads the next byte. * @return next byte */ private int read() { final Buffer bf = buffer(off == IO.BLOCKSIZE); return bf.data[off++] & 0xFF; } /** * Writes the next byte. * @param b byte to be written */ private void write(final int b) { final Buffer bf = buffer(off == IO.BLOCKSIZE); bf.dirty = true; bf.data[off++] = (byte) b; final long nl = bf.pos + off; if(nl > len) length(nl); } /** * Returns the current or next buffer. * @param next next block * @return buffer */ private Buffer buffer(final boolean next) { if(next) { cursor(bm.current().pos + IO.BLOCKSIZE); } return bm.current(); } } basex-7.7.2/basex-core/src/main/java/org/basex/io/random/TableAccess.java000066400000000000000000000106301222453003200261020ustar00rootroot00000000000000package org.basex.io.random; import java.io.*; import org.basex.data.*; import org.basex.io.*; /** * This abstract class defines the methods for accessing the * database table representation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class TableAccess { /** Meta data. */ protected final MetaData meta; /** Dirty index flag. */ protected boolean dirty; /** * Constructor. * @param md meta data */ TableAccess(final MetaData md) { meta = md; } /** * Flushes the table contents. * @throws IOException I/O exception */ public abstract void flush() throws IOException; /** * Closes the table access. * @throws IOException I/O exception */ public abstract void close() throws IOException; /** * Tries to acquires a lock on the table. If a lock exists, it is first released. * @param excl exclusive/shared lock * @return success flag */ public abstract boolean lock(final boolean excl); /** * Reads a byte value and returns it as an integer value. * @param p pre value * @param o offset * @return integer value */ public abstract int read1(int p, int o); /** * Reads a short value and returns it as an integer value. * @param p pre value * @param o offset * @return integer value */ public abstract int read2(int p, int o); /** * Reads an integer value. * @param p pre value * @param o offset * @return integer value */ public abstract int read4(int p, int o); /** * Reads a 5-byte value and returns it as a long value. * @param p pre value * @param o offset * @return integer value */ public abstract long read5(int p, int o); /** * Writes a byte value to the specified position. * @param p pre value * @param o offset * @param v value to be written */ public abstract void write1(int p, int o, int v); /** * Writes a short value to the specified position. * @param p pre value * @param o offset * @param v value to be written */ public abstract void write2(int p, int o, int v); /** * Writes an integer value to the specified position. * @param p pre value * @param o offset * @param v value to be written */ public abstract void write4(int p, int o, int v); /** * Writes a 5-byte value to the specified position. * @param p pre value * @param o offset * @param v value to be written */ public abstract void write5(int p, int o, long v); /** * Replaces entries in the database. * @param pre node to be replaced * @param entries new entries * @param sub size of the subtree that is replaced */ public final void replace(final int pre, final byte[] entries, final int sub) { dirty = true; final int nsize = entries.length >>> IO.NODEPOWER; final int diff = sub - nsize; final int last = diff <= 0 ? pre + nsize - Math.abs(diff) : pre + nsize; copy(entries, pre, last); final int off = last - pre << IO.NODEPOWER; // handle the remaining entries if the two subtrees are of different size if(diff < 0) { // case1: new subtree bigger than old one, insert remaining new nodes final byte[] tmp = new byte[entries.length - off]; System.arraycopy(entries, off, tmp, 0, tmp.length); insert(last, tmp); } else if(diff > 0) { // case2: old subtree bigger than new one, delete remaining old nodes delete(last, diff); } } /** * Copies the specified entries into the database. * @param pre pre value * @param entries array of bytes containing the entries to insert */ public final void set(final int pre, final byte[] entries) { dirty = true; copy(entries, pre, pre + (entries.length >>> IO.NODEPOWER)); } /** * Copies the specified values into the database. * @param entries entries to copy * @param pre first target pre value * @param last last pre value */ protected abstract void copy(final byte[] entries, final int pre, final int last); /** * Deletes the specified number of entries from the database. * @param pre pre value of the first node to delete * @param nr number of entries to be deleted */ public abstract void delete(int pre, int nr); /** * Inserts the specified entries into the database. * @param pre pre value * @param entries array of bytes containing the entries to insert */ public abstract void insert(int pre, byte[] entries); } basex-7.7.2/basex-core/src/main/java/org/basex/io/random/TableDiskAccess.java000066400000000000000000000423561222453003200267270ustar00rootroot00000000000000package org.basex.io.random; import static org.basex.data.DataText.*; import java.io.*; import java.nio.channels.*; import java.util.*; import org.basex.core.*; import org.basex.data.*; import org.basex.io.*; import org.basex.io.in.DataInput; import org.basex.io.out.DataOutput; import org.basex.util.*; /** * This class stores the table on disk and reads it block-wise. * * NOTE: this class is not thread-safe. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Tim Petrowsky */ public final class TableDiskAccess extends TableAccess { /** Buffer manager. */ private final Buffers bm = new Buffers(); /** File storing all blocks. */ private final RandomAccessFile file; /** Bitmap storing free (=0) and occupied (=1) pages. */ private final BitArray freePages; /** File lock. */ private FileLock fl; /** FirstPre values (sorted ascending; length: {@link #blocks}). */ private int[] fpres; /** Page index (length: {@link #blocks}). */ private int[] pages; /** Page index. */ private int page = -1; /** Pre value of the first entry in the current block. */ private int fpre = -1; /** First pre value of the next block. */ private int npre = -1; /** Total number of blocks. */ private int blocks; /** Number of used blocks. */ private int used; /** * Constructor. * @param md meta data * @param lock exclusive access * @throws IOException I/O exception */ public TableDiskAccess(final MetaData md, final boolean lock) throws IOException { super(md); // read meta and index data final DataInput in = new DataInput(meta.dbfile(DATATBL + 'i')); blocks = in.readNum(); used = in.readNum(); fpres = in.readNums(); pages = in.readNums(); final int psize = in.readNum(); // check if the page map has been stored if(psize == 0) { // init the map with empty pages freePages = new BitArray(blocks); for(final int p : pages) freePages.set(p); dirty = true; } else { freePages = new BitArray(in.readLongs(psize), blocks); } in.close(); // initialize data file file = new RandomAccessFile(meta.dbfile(DATATBL).file(), "rw"); if(lock) exclusiveLock(); else sharedLock(); if(fl == null) throw new BaseXException(Text.DB_PINNED_X, md.name); } /** * Checks if the table of the specified database is locked. * @param db name of database * @param ctx database context * @return result of check */ public static boolean locked(final String db, final Context ctx) { final IOFile table = MetaData.file(ctx.mprop.dbpath(db), DATATBL); if(!table.exists()) return false; try { final RandomAccessFile file = new RandomAccessFile(table.file(), "rw"); try { return file.getChannel().tryLock() == null; } finally { file.close(); } } catch(final OverlappingFileLockException ex) { return true; } catch(final ClosedChannelException ex) { return false; } catch(final IOException ex) { return true; } } @Override public synchronized void flush() throws IOException { for(final Buffer b : bm.all()) if(b.dirty) writeBlock(b); if(!dirty) return; final DataOutput out = new DataOutput(meta.dbfile(DATATBL + 'i')); out.writeNum(blocks); out.writeNum(used); // due to legacy issues, number of blocks is written several times out.writeNum(blocks); for(int a = 0; a < blocks; a++) out.writeNum(fpres[a]); out.writeNum(blocks); for(int a = 0; a < blocks; a++) out.writeNum(pages[a]); out.writeLongs(freePages.toArray()); out.close(); dirty = false; } @Override public synchronized void close() throws IOException { flush(); file.close(); } @Override public boolean lock(final boolean lock) { try { if(lock) { if(exclusiveLock()) return true; if(sharedLock()) return false; } else { if(sharedLock()) return true; } } catch(final IOException ex) { Util.stack(ex); } throw Util.notexpected((lock ? "Exclusive" : "Shared") + " lock could not be acquired."); } /** * Acquires an exclusive lock on the file. * @return success flag * @throws IOException I/O exception */ private boolean exclusiveLock() throws IOException { return lck(false); } /** * Acquires a shared lock on the file. * @return success flag * @throws IOException I/O exception */ private boolean sharedLock() throws IOException { return lck(true); } /** * Acquires a lock on the file. Does nothing if the correct lock has already been * acquired. Otherwise, releases an existing lock. * @param shared shared/exclusive lock * @return success flag * @throws IOException I/O exception */ private boolean lck(final boolean shared) throws IOException { if(fl != null && shared == fl.isShared()) return true; if(fl != null) fl.release(); fl = file.getChannel().tryLock(0, Long.MAX_VALUE, shared); return fl != null; } @Override public synchronized int read1(final int pre, final int off) { final int o = off + cursor(pre); final byte[] b = bm.current().data; return b[o] & 0xFF; } @Override public synchronized int read2(final int pre, final int off) { final int o = off + cursor(pre); final byte[] b = bm.current().data; return ((b[o] & 0xFF) << 8) + (b[o + 1] & 0xFF); } @Override public synchronized int read4(final int pre, final int off) { final int o = off + cursor(pre); final byte[] b = bm.current().data; return ((b[o] & 0xFF) << 24) + ((b[o + 1] & 0xFF) << 16) + ((b[o + 2] & 0xFF) << 8) + (b[o + 3] & 0xFF); } @Override public synchronized long read5(final int pre, final int off) { final int o = off + cursor(pre); final byte[] b = bm.current().data; return ((long) (b[o] & 0xFF) << 32) + ((long) (b[o + 1] & 0xFF) << 24) + ((b[o + 2] & 0xFF) << 16) + ((b[o + 3] & 0xFF) << 8) + (b[o + 4] & 0xFF); } @Override public void write1(final int pre, final int off, final int v) { final int o = off + cursor(pre); final Buffer bf = bm.current(); final byte[] b = bf.data; b[o] = (byte) v; bf.dirty = true; } @Override public void write2(final int pre, final int off, final int v) { final int o = off + cursor(pre); final Buffer bf = bm.current(); final byte[] b = bf.data; b[o] = (byte) (v >>> 8); b[o + 1] = (byte) v; bf.dirty = true; } @Override public void write4(final int pre, final int off, final int v) { final int o = off + cursor(pre); final Buffer bf = bm.current(); final byte[] b = bf.data; b[o] = (byte) (v >>> 24); b[o + 1] = (byte) (v >>> 16); b[o + 2] = (byte) (v >>> 8); b[o + 3] = (byte) v; bf.dirty = true; } @Override public void write5(final int pre, final int off, final long v) { final int o = off + cursor(pre); final Buffer bf = bm.current(); final byte[] b = bf.data; b[o] = (byte) (v >>> 32); b[o + 1] = (byte) (v >>> 24); b[o + 2] = (byte) (v >>> 16); b[o + 3] = (byte) (v >>> 8); b[o + 4] = (byte) v; bf.dirty = true; } @Override protected void copy(final byte[] entries, final int pre, final int last) { for(int o = 0, i = pre; i < last; ++i, o += IO.NODESIZE) { final int off = cursor(i); final Buffer bf = bm.current(); System.arraycopy(entries, o, bf.data, off, IO.NODESIZE); bf.dirty = true; } } @Override public void delete(final int pre, final int nr) { if(nr == 0) return; dirty = true; // get first block cursor(pre); // some useful variables to make code more readable int from = pre - fpre; final int last = pre + nr; // check if all entries are in current block: handle and return if(last - 1 < npre) { final Buffer bf = bm.current(); copy(bf.data, from + nr, bf.data, from, npre - last); updatePre(nr); // if whole block was deleted, remove it from the index if(npre == fpre) { // mark the block as empty freePages.clear(pages[page]); Array.move(fpres, page + 1, -1, used - page - 1); Array.move(pages, page + 1, -1, used - page - 1); --used; readPage(page); } return; } // handle blocks whose entries are to be deleted entirely // first count them int unused = 0; while(npre < last) { if(from == 0) { ++unused; // mark the blocks as empty; range clear cannot be used because the // blocks may not be consecutive freePages.clear(pages[page]); } setPage(page + 1); from = 0; } // if the last block is empty, clear the corresponding bit readBlock(pages[page]); final Buffer bf = bm.current(); if(npre == last) { freePages.clear((int) bf.pos); ++unused; if(page < used - 1) readPage(page + 1); else ++page; } else { // delete entries at beginning of current (last) block copy(bf.data, last - fpre, bf.data, 0, npre - last); } // now remove them from the index if(unused > 0) { Array.move(fpres, page, -unused, used - page); Array.move(pages, page, -unused, used - page); used -= unused; page -= unused; } // update index entry for this block fpres[page] = pre; fpre = pre; updatePre(nr); } @Override public void insert(final int pre, final byte[] entries) { final int nnew = entries.length; if(nnew == 0) return; dirty = true; // number of records to be inserted final int nr = nnew >>> IO.NODEPOWER; int split = 0; if(used == 0) { // special case: insert new data into first block if database is empty readPage(0); freePages.set(0); ++used; } else if(pre > 0) { // find the offset within the block where the new records will be inserted split = cursor(pre - 1) + IO.NODESIZE; } else { // all insert operations will add data after first node. // i.e., there is no "insert before first document" statement Util.notexpected("Insertion at beginning of populated table."); } // number of bytes occupied by old records in the current block final int nold = npre - fpre << IO.NODEPOWER; // number of bytes occupied by old records which will be moved at the end final int moved = nold - split; // special case: all entries fit in the current block Buffer bf = bm.current(); if(nold + nnew <= IO.BLOCKSIZE) { Array.move(bf.data, split, nnew, moved); System.arraycopy(entries, 0, bf.data, split, nnew); bf.dirty = true; // increment first pre-values of blocks after the last modified block for(int i = page + 1; i < used; ++i) fpres[i] += nr; // update cached variables (fpre is not changed) npre += nr; meta.size += nr; return; } // append old entries at the end of the new entries final byte[] all = new byte[nnew + moved]; System.arraycopy(entries, 0, all, 0, nnew); System.arraycopy(bf.data, split, all, nnew, moved); // fill in the current block with new entries // number of bytes which fit in the first block int nrem = IO.BLOCKSIZE - split; if(nrem > 0) { System.arraycopy(all, 0, bf.data, split, nrem); bf.dirty = true; } // number of new required blocks and remaining bytes final int req = all.length - nrem; int needed = req / IO.BLOCKSIZE; final int remain = req % IO.BLOCKSIZE; if(remain > 0) { // check if the last entries can fit in the block after the current one if(page + 1 < used) { final int o = occSpace(page + 1) << IO.NODEPOWER; if(remain <= IO.BLOCKSIZE - o) { // copy the last records readPage(page + 1); bf = bm.current(); System.arraycopy(bf.data, 0, bf.data, remain, o); System.arraycopy(all, all.length - remain, bf.data, 0, remain); bf.dirty = true; // reduce the pre value, since it will be later incremented with nr fpres[page] -= remain >>> IO.NODEPOWER; // go back to the previous block readPage(page - 1); } else { // there is not enough space in the block - allocate a new one ++needed; } } else { // this is the last block - allocate a new one ++needed; } } // number of expected blocks: existing blocks + needed block - empty blocks final int exp = blocks + needed - (blocks - used); if(exp > fpres.length) { // resize directory arrays if existing ones are too small final int ns = Math.max(fpres.length << 1, exp); fpres = Arrays.copyOf(fpres, ns); pages = Arrays.copyOf(pages, ns); } // make place for the blocks where the new entries will be written Array.move(fpres, page + 1, needed, used - page - 1); Array.move(pages, page + 1, needed, used - page - 1); // write the all remaining entries while(needed-- > 0) { freeBlock(); nrem += write(all, nrem); fpres[page] = fpres[page - 1] + IO.ENTRIES; pages[page] = (int) bm.current().pos; } // increment all fpre values after the last modified block for(int i = page + 1; i < used; ++i) fpres[i] += nr; meta.size += nr; // update cached variables fpre = fpres[page]; npre = page + 1 < used && fpres[page + 1] < meta.size ? fpres[page + 1] : meta.size; } // PRIVATE METHODS ========================================================== /** * Searches for the block containing the entry for the specified pre value. * Reads the block and returns its offset inside the block. * @param pre pre of the entry to search for * @return offset of the entry in the block */ private int cursor(final int pre) { int fp = fpre; int np = npre; if(pre < fp || pre >= np) { final int last = used - 1; int l = 0; int h = last; int m = page; while(l <= h) { if(pre < fp) h = m - 1; else if(pre >= np) l = m + 1; else break; m = h + l >>> 1; fp = fpres[m]; np = m == last ? meta.size : fpres[m + 1]; } if(l > h) Util.notexpected( "Data Access out of bounds:" + "\n- pre value: " + pre + "\n- #used blocks: " + used + "\n- #total locks: " + blocks + "\n- access: " + m + " (" + l + " > " + h + ']'); readPage(m); } return pre - fpre << IO.NODEPOWER; } /** * Updates the page pointers. * @param p page index */ private void setPage(final int p) { page = p; fpre = fpres[p]; npre = p + 1 >= used ? meta.size : fpres[p + 1]; } /** * Updates the index pointers and fetches the requested block. * @param p index of the block to fetch */ private void readPage(final int p) { setPage(p); readBlock(pages[p]); } /** * Reads a block from disk. * @param b block to fetch */ private void readBlock(final int b) { if(!bm.cursor(b)) return; final Buffer bf = bm.current(); try { if(bf.dirty) writeBlock(bf); bf.pos = b; if(b >= blocks) { blocks = b + 1; } else { file.seek(bf.pos * IO.BLOCKSIZE); file.readFully(bf.data); } } catch(final IOException ex) { Util.stack(ex); } } /** * Moves the cursor to a free block (either new or existing empty one). */ private void freeBlock() { final int b = freePages.nextFree(0); freePages.set(b); readBlock(b); ++used; ++page; } /** * Writes the specified block to disk and resets the dirty flag. * @param bf buffer to write * @throws IOException I/O exception */ private void writeBlock(final Buffer bf) throws IOException { file.seek(bf.pos * IO.BLOCKSIZE); file.write(bf.data); bf.dirty = false; } /** * Updates the firstPre index entries. * @param nr number of entries to move */ private void updatePre(final int nr) { // update index entries for all following blocks and reduce counter for(int i = page + 1; i < used; ++i) fpres[i] -= nr; meta.size -= nr; npre = page + 1 < used && fpres[page + 1] < meta.size ? fpres[page + 1] : meta.size; } /** * Convenience method for copying blocks. * @param s source array * @param sp source position * @param d destination array * @param dp destination position * @param l source length */ private void copy(final byte[] s, final int sp, final byte[] d, final int dp, final int l) { System.arraycopy(s, sp << IO.NODEPOWER, d, dp << IO.NODEPOWER, l << IO.NODEPOWER); bm.current().dirty = true; } /** * Fill the current buffer with bytes from the specified array from the * specified offset. * @param s source array * @param o offset from the beginning of the array * @return number of written bytes */ private int write(final byte[] s, final int o) { final Buffer bf = bm.current(); final int len = Math.min(IO.BLOCKSIZE, s.length - o); System.arraycopy(s, o, bf.data, 0, len); bf.dirty = true; return len; } /** * Calculate the occupied space in a block. * @param i index of the block * @return occupied space in number of records */ private int occSpace(final int i) { return (i + 1 < used ? fpres[i + 1] : meta.size) - fpres[i]; } } basex-7.7.2/basex-core/src/main/java/org/basex/io/random/TableMemAccess.java000066400000000000000000000101111222453003200265330ustar00rootroot00000000000000package org.basex.io.random; import java.io.*; import java.util.*; import org.basex.data.*; import org.basex.io.*; import org.basex.util.*; /** * This class allows main memory access to the database table representation. * * NOTE: this class is not thread-safe. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class TableMemAccess extends TableAccess { /** Long buffer array. */ private long[] buf1 = new long[Array.CAPACITY]; /** Long buffer array. */ private long[] buf2 = new long[Array.CAPACITY]; /** * Stores the table in long arrays. * @param md meta data */ public TableMemAccess(final MetaData md) { super(md); } @Override public void flush() { } @Override public void close() throws IOException { } @Override public boolean lock(final boolean lock) { return true; } @Override public int read1(final int p, final int o) { return (int) ((o < 8 ? buf1 : buf2)[p] >> ((o < 8 ? 7 : 15) - o << 3) & 0xFF); } @Override public int read2(final int p, final int o) { return (int) ((o < 8 ? buf1 : buf2)[p] >> ((o < 8 ? 6 : 14) - o << 3) & 0xFFFF); } @Override public int read4(final int p, final int o) { return (int) ((o < 8 ? buf1 : buf2)[p] >> ((o < 8 ? 4 : 12) - o << 3)); } @Override public long read5(final int p, final int o) { return (o < 8 ? buf1 : buf2)[p] >> ((o < 8 ? 3 : 11) - o << 3) & 0xFFFFFFFFFFL; } @Override public void write1(final int p, final int o, final int v) { dirty = true; final long[] buf = o < 8 ? buf1 : buf2; final long d = (o < 8 ? 7 : 15) - o << 3; buf[p] = buf[p] & ~(0xFFL << d) | (long) v << d; } @Override public void write2(final int p, final int o, final int v) { dirty = true; final long[] buf = o < 8 ? buf1 : buf2; final long d = (o < 8 ? 6 : 14) - o << 3; buf[p] = buf[p] & ~(0xFFFFL << d) | (long) v << d; } @Override public void write4(final int p, final int o, final int v) { dirty = true; final long[] buf = o < 8 ? buf1 : buf2; final long d = (o < 8 ? 4 : 12) - o << 3; buf[p] = buf[p] & ~(0xFFFFFFFFL << d) | (long) v << d; } @Override public void write5(final int p, final int o, final long v) { dirty = true; final long[] buf = o < 8 ? buf1 : buf2; final long d = (o < 8 ? 3 : 11) - o << 3; buf[p] = buf[p] & ~(0xFFFFFFFFFFL << d) | v << d; } @Override protected void copy(final byte[] entries, final int pre, final int last) { for(int o = 0, i = pre; i < last; ++i, o += IO.NODESIZE) { buf1[i] = getLong(entries, o); buf2[i] = getLong(entries, o + 8); } dirty = true; } @Override public void delete(final int pre, final int nr) { if(nr == 0) return; move(pre + nr, pre); } @Override public void insert(final int pre, final byte[] entries) { if(entries.length == 0) return; move(pre, pre + (entries.length >>> IO.NODEPOWER)); set(pre, entries); } // PRIVATE METHODS ========================================================== /** * Moves data inside the value arrays. * @param op source position * @param np destination position */ private void move(final int op, final int np) { dirty = true; final int l = meta.size - op; while(l + np >= buf1.length) { final int s = Array.newSize(buf1.length); buf1 = Arrays.copyOf(buf1, s); buf2 = Arrays.copyOf(buf2, s); } System.arraycopy(buf1, op, buf1, np, l); System.arraycopy(buf2, op, buf2, np, l); meta.size += np - op; } /** * Returns a long value from the specified array. * @param v array input * @param i index * @return long value */ private static long getLong(final byte[] v, final int i) { return (v[i] & 0xFFL) << 56 | (v[i + 1] & 0xFFL) << 48 | (v[i + 2] & 0xFFL) << 40 | (v[i + 3] & 0xFFL) << 32 | (v[i + 4] & 0xFFL) << 24 | (v[i + 5] & 0xFFL) << 16 | (v[i + 6] & 0xFFL) << 8 | v[i + 7] & 0xFFL; } } basex-7.7.2/basex-core/src/main/java/org/basex/io/serial/000077500000000000000000000000001222453003200230655ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/io/serial/BuilderSerializer.java000066400000000000000000000042011222453003200273450ustar00rootroot00000000000000package org.basex.io.serial; import static org.basex.util.Token.*; import java.io.*; import org.basex.build.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * A serializer that pipes the events directly through to a builder. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public class BuilderSerializer extends Serializer { /** Attribute cache. */ private final Atts atts = new Atts(); /** Namespace cache. */ private final Atts nsp = new Atts(); /** The builder. */ private final Builder build; /** * Constructor taking a Builder. * @param b builder to be used */ public BuilderSerializer(final Builder b) { build = b; } @Override protected final void finishText(final byte[] b) throws IOException { build.text(b); } @Override protected void startOpen(final byte[] t) throws IOException { } @Override protected final void finishPi(final byte[] n, final byte[] v) throws IOException { build.pi(concat(n, SPACE, v)); } @Override protected final void atomic(final Item b) throws IOException { Util.notexpected(); } @Override protected final void finishOpen() throws IOException { build.openElem(elem, atts, nsp); atts.clear(); nsp.clear(); } @Override protected void finishEmpty() throws IOException { build.emptyElem(elem, atts, nsp); atts.clear(); nsp.clear(); } @Override protected void finishClose() throws IOException { build.closeElem(); } @Override protected final void finishComment(final byte[] b) throws IOException { build.comment(b); } @Override protected final void attribute(final byte[] n, final byte[] v) throws IOException { if(startsWith(n, XMLNS)) { if(n.length == 5) { nsp.add(EMPTY, v); } else if(n[5] == ':') { nsp.add(substring(n, 6), v); } else { atts.add(n, v); } } else { atts.add(n, v); } } @Override protected void openDoc(final byte[] name) throws IOException { build.openDoc(name); } @Override protected final void closeDoc() throws IOException { build.closeDoc(); } } basex-7.7.2/basex-core/src/main/java/org/basex/io/serial/CsvSerializer.java000066400000000000000000000110471222453003200265200ustar00rootroot00000000000000package org.basex.io.serial; import static org.basex.io.serial.SerializerProp.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.io.*; import org.basex.query.value.item.*; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * This class serializes data as CSV. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class CsvSerializer extends OutputSerializer { /** Names of header elements. */ private final TokenList headers; /** Contents of current row. */ private TokenMap data; /** Separator. */ private final int separator; /** Header flag. */ private boolean header; /** * Constructor. * @param os output stream reference * @param props serialization properties * @throws IOException I/O exception */ public CsvSerializer(final OutputStream os, final SerializerProp props) throws IOException { super(os, props); final TokenParser tp = new TokenParser(token(props.get(S_CSV_SEPARATOR))); separator = tp.next(); if(separator == -1 || tp.next() != -1) BXCS_CONFIG.thrwSerial(); header = Util.yes(props.get(S_CSV_HEADER)); headers = header ? new TokenList() : null; } @Override protected void startOpen(final byte[] name) { if(level == 1) data = new TokenMap(); } @Override protected void finishOpen() throws IOException { } @Override protected void finishEmpty() throws IOException { finishOpen(); if(level == 2) cache(EMPTY); finishClose(); } @Override protected void finishText(final byte[] text) { if(level == 3) cache(text); } @Override protected void finishClose() throws IOException { if(level != 1) return; // print data if(headers != null) { final int s = headers.size(); // print header if(header) { final TokenList tl = new TokenList(); for(int i = 0; i < s; i++) tl.add(headers.get(i)); record(tl); header = false; } // print data, sorted by headers final TokenList tl = new TokenList(); for(int i = 0; i < s; i++) tl.add(data.get(headers.get(i))); record(tl); } else { // no headers available: print data final TokenList tl = new TokenList(); for(final byte[] v : data.values()) tl.add(v); record(tl); } } @Override protected void attribute(final byte[] n, final byte[] v) { } @Override protected void finishComment(final byte[] n) { } @Override protected void finishPi(final byte[] n, final byte[] v) { } @Override protected void atomic(final Item value) throws IOException { error("Atomic values cannot be serialized"); } @Override protected void code(final int ch) throws IOException { printChar(ch); } /** * Caches the specified text and its header. * @param text text to be cached */ private void cache(final byte[] text) { if(headers != null) { final byte[] name = XMLToken.decode(elem); if(!headers.contains(name)) headers.add(name); final byte[] old = data.get(name); final byte[] txt = old == null || old.length == 0 ? text : new TokenBuilder(old).add(',').add(text).finish(); data.put(name, txt); } else { data.put(token(data.size()), text); } } /** * Prints a record with the specified fields. * @param fields fields to be printed * @throws IOException I/O exception */ private void record(final TokenList fields) throws IOException { // check if all fields are empty int d = -1; final int fs = fields.size(); for(int i = 0; i < fs; i++) { final byte[] v = fields.get(i); if(v != null && v.length != 0) d = i; } if(d == -1) return; // print fields, skip trailing empty contents for(int i = 0; i <= d; i++) { final byte[] v = fields.get(i); if(i != 0) print(separator); if(v == null) continue; byte[] txt = v; if(contains(txt, separator) || contains(txt, '\n')) { final TokenBuilder tb = new TokenBuilder().add('"'); final int len = txt.length; for(int c = 0; c < len; c += cl(txt, c)) { final int cp = cp(txt, c); if(cp == '"') tb.add('"'); tb.add(cp); } txt = tb.add('"').finish(); } print(txt); } print(nl); } /** * Raises an error with the specified message. * @param msg error message * @throws IOException I/O exception */ private static void error(final String msg) throws IOException { throw BXCS_SERIAL.thrwSerial(msg); } } basex-7.7.2/basex-core/src/main/java/org/basex/io/serial/DOTData.java000066400000000000000000000066341222453003200251610ustar00rootroot00000000000000package org.basex.io.serial; import static org.basex.core.Text.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.ft.*; import org.basex.query.func.*; import org.basex.query.gflwor.*; import org.basex.query.path.*; import org.basex.query.value.item.*; import org.basex.query.value.seq.*; import org.basex.query.var.*; import org.basex.util.*; /** * This class contains formatting information for the DOT output. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class DOTData { /** Font. */ private static final String FONT = "Tahoma"; //"Charter BT"; /** Node entry. */ static final String HEADER = "digraph BaseXAlgebra {" + NL + "node [shape=box style=bold width=0 height=0];" + NL + "node [fontsize=12 fontname=\"" + FONT + "\"];"; /** Node entry. */ static final String FOOTER = "}"; /** Node entry. */ static final String DOTNODE = "node% [label=\"%\" color=\"#%\"];"; /** Link entry. */ static final String DOTLINK = "node% -> node%;"; /** Node entry. */ static final String DOTATTR = "\\n%: %"; /** Link entry. */ static final String ELEM1 = "303030"; /** Link entry. */ static final String ELEM2 = "909090"; /** Link entry. */ static final String ITEM = "3366CC"; /** Link entry. */ static final String TEXT = "6666FF"; /** Link entry. */ static final String COMM = "3366FF"; /** Link entry. */ static final String PI = "3399FF"; /** Private constructors. */ private DOTData() { } /** Hash map, caching colors for expressions. */ private static final Object[][] COLORS = { // blue { "6666FF", Item.class, Seq.class, Str.class, QNm.class, Uri.class, Int.class }, // violet { "9933FF", CAttr.class, CComm.class, CDoc.class, CElem.class, CNSpace.class, CPI.class, CTxt.class }, { "9933CC", And.class, Or.class, Union.class, InterSect.class, Except.class }, // pink { "CC3399", If.class, Quantifier.class, QueryText.WHR }, { "CC6699", OrderBy.class }, // red { "FF3333", Arith.class, CmpG.class, CmpN.class, CmpV.class, CmpR.class, Pos.class, FTContains.class }, { "FF6666", FTExpr.class, Try.class, Catch.class }, // orange { "AA9988", StaticFunc.class }, { "776655", StaticFuncs.class }, { "CC6600", Path.class }, { "FF9900", Preds.class }, // green { "009900", GFLWOR.class }, { "339933", VarStack.class }, { "33CC33", For.class, Let.class, List.class, Range.class, Context.class, QueryText.RET }, { "66CC66", Var.class, Cast.class }, // cyan { "009999", StaticFuncCall.class, StandardFunc.class, Root.class, VarRef.class, StaticVar.class, ValueAccess.class, RangeAccess.class, StringRangeAccess.class, FTIndexAccess.class }, }; /** * Returns the color for the specified string, or {@code null}. * @param s string string * @return color */ static String color(final byte[] s) { for(final Object[] color : COLORS) { for(int c = 1; c < color.length; c++) { final Object o = color[c]; final byte[] cl = o instanceof byte[] ? (byte[]) o : Token.token(o instanceof Class ? Util.name((Class) o) : o.toString()); if(Token.eq(cl, s)) return color[0].toString(); } } return null; } } basex-7.7.2/basex-core/src/main/java/org/basex/io/serial/DOTSerializer.java000066400000000000000000000070611222453003200264140ustar00rootroot00000000000000package org.basex.io.serial; import static org.basex.data.DataText.*; import static org.basex.io.serial.DOTData.*; import static org.basex.util.Token.*; import java.io.*; import java.util.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.util.*; import org.basex.util.list.*; /** * This class serializes data in the DOT syntax. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DOTSerializer extends OutputSerializer { /** Compact representation. */ private final boolean compact; /** Cached children. */ private final ArrayList children = new ArrayList(); /** Cached attributes. */ private final TokenBuilder tb = new TokenBuilder(); /** Cached nodes. */ private final IntList nodes = new IntList(); /** Node counter. */ private int count; /** * Constructor, defining colors for the dot output. * @param os output stream * @param c compact representation * @throws IOException I/O exception */ public DOTSerializer(final OutputStream os, final boolean c) throws IOException { super(os, PROPS); compact = c; print(HEADER); } @Override public void close() throws IOException { indent(); print(FOOTER); } @Override protected void startOpen(final byte[] t) { tb.reset(); } @Override protected void attribute(final byte[] n, final byte[] v) { tb.addExt(DOTATTR, n, v); } @Override protected void finishOpen() throws IOException { final byte[] attr = tb.finish(); String color = color(elem); if(color == null) color = attr.length == 0 ? ELEM1 : ELEM2; print(concat(elem, attr), color); } @Override protected void finishEmpty() throws IOException { finishOpen(); finishClose(); } @Override protected void finishClose() throws IOException { final int c = nodes.get(level); final IntList il = child(level); final int is = il.size(); for(int i = 0; i < is; ++i) { indent(); print(Util.info(DOTLINK, c, il.get(i))); } il.reset(); } @Override protected void finishText(final byte[] t) throws IOException { print(norm(t), DOTData.TEXT); } @Override protected void finishComment(final byte[] t) throws IOException { print(new TokenBuilder(COMM_O).add(norm(t)).add(COMM_C).finish(), DOTData.COMM); } @Override protected void finishPi(final byte[] n, final byte[] v) throws IOException { print(new TokenBuilder(PI_O).add(n).add(SPACE).add(v).add(PI_C).finish(), DOTData.PI); } @Override protected void atomic(final Item it) throws IOException { try { print(norm(it.string(null)), ITEM); } catch(final QueryException ex) { throw new SerializerException(ex); } } /** * Prints a single node. * @param t text * @param col color * @throws IOException I/O exception */ private void print(final byte[] t, final String col) throws IOException { String txt = string(chop(t, 60)).replaceAll("\"|\\r|\\n", "'"); if(compact) txt = txt.replaceAll("\\\\n\\w+:", "\\\\n"); indent(); print(Util.info(DOTNODE, count, txt, col)); nodes.set(level, count); if(level > 0) child(level - 1).add(count); ++count; } /** * Returns the children from the stack. * @param i index * @return children */ private IntList child(final int i) { while(i >= children.size()) children.add(new IntList()); return children.get(i); } } basex-7.7.2/basex-core/src/main/java/org/basex/io/serial/EncodingException.java000066400000000000000000000011241222453003200273330ustar00rootroot00000000000000package org.basex.io.serial; import org.basex.util.*; /** * This class indicates exceptions during the decoding of the input stream. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class EncodingException extends InputException { /** * Constructor. * @param cp code points */ public EncodingException(final int cp) { super("Invalid XML character (#" + cp + ')'); } /** * Constructor. * @param ex exception */ public EncodingException(final Exception ex) { super("Unsupported encoding: " + Util.message(ex)); } } basex-7.7.2/basex-core/src/main/java/org/basex/io/serial/HTMLSerializer.java000066400000000000000000000153151222453003200265330ustar00rootroot00000000000000package org.basex.io.serial; import static org.basex.data.DataText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.io.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * This class serializes data as HTML. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class HTMLSerializer extends OutputSerializer { /** (X)HTML: elements with an empty content model. */ static final TokenList EMPTIES = new TokenList(); /** HTML5: elements with an empty content model. */ static final TokenList EMPTIES5 = new TokenList(); /** (X)HTML: URI attributes. */ static final TokenSet URIS = new TokenSet(); /** HTML: script elements. */ private static final TokenList SCRIPTS = new TokenList(); /** HTML: boolean attributes. */ private static final TokenSet BOOLEAN = new TokenSet(); /** * Constructor, specifying serialization options. * @param os output stream reference * @param p serialization properties * @throws IOException I/O exception */ HTMLSerializer(final OutputStream os, final SerializerProp p) throws IOException { super(os, p, V40, V401, V50); } @Override protected void attribute(final byte[] n, final byte[] v) throws IOException { // don't append value for boolean attributes final byte[] tagatt = concat(lc(elem), COLON, lc(n)); if(BOOLEAN.contains(tagatt) && eq(n, v)) return; // escape URI attributes final byte[] val = escape && URIS.contains(tagatt) ? escape(v) : v; print(' '); print(n); print(ATT1); for(int k = 0; k < val.length; k += cl(val, k)) { final int ch = cp(val, k); if(ch == '<' || ch == '&' && val[Math.min(k + 1, val.length - 1)] == '{') { print(ch); } else if(ch == '"') { print(E_QU); } else if(ch == 0x9 || ch == 0xA) { hex(ch); } else { code(ch); } } print(ATT2); } @Override protected void finishComment(final byte[] n) throws IOException { if(sep) indent(); print(COMM_O); print(n); print(COMM_C); } @Override protected void finishPi(final byte[] n, final byte[] v) throws IOException { if(sep) indent(); if(contains(v, '>')) SERPI.thrwSerial(); print(PI_O); print(n); print(' '); print(v); print(ELEM_C); } @Override protected void code(final int ch) throws IOException { if(script) printChar(ch); else if(ch > 0x7F && ch < 0xA0 && !html5) SERILL.thrwSerial(Integer.toHexString(ch)); else if(ch == 0xA0) print(E_NBSP); else super.code(ch); } @Override protected void startOpen(final byte[] t) throws IOException { doctype(null); if(sep) indent(); print(ELEM_O); print(t); sep = indent; script = SCRIPTS.contains(lc(t)); if(content && eq(lc(elem), HEAD)) ct++; } @Override protected void finishOpen() throws IOException { super.finishOpen(); ct(false, true); } @Override protected void finishEmpty() throws IOException { if(ct(true, true)) return; print(ELEM_C); if(html5) { if(EMPTIES5.contains(lc(elem))) return; } else { if(EMPTIES.contains(lc(elem))) { final byte[] u = nsUri(EMPTY); if(u == null || u.length == 0) return; } } sep = false; finishClose(); } @Override protected void finishClose() throws IOException { super.finishClose(); script = script && !SCRIPTS.contains(lc(elem)); } @Override protected boolean doctype(final byte[] dt) throws IOException { if(level != 0) return false; if(!super.doctype(dt) && html5) { if(sep) indent(); print(DOCTYPE); if(dt == null) print(M_HTML); else print(dt); print(ELEM_C); if(indent) print(nl); } return true; } // HTML Serializer: cache elements static { // script elements SCRIPTS.add("script"); SCRIPTS.add("style"); // boolean attributes BOOLEAN.add("area:nohref"); BOOLEAN.add("button:disabled"); BOOLEAN.add("dir:compact"); BOOLEAN.add("dl:compact"); BOOLEAN.add("frame:noresize"); BOOLEAN.add("hr:noshade"); BOOLEAN.add("img:ismap"); BOOLEAN.add("input:checked"); BOOLEAN.add("input:disabled"); BOOLEAN.add("input:readonly"); BOOLEAN.add("menu:compact"); BOOLEAN.add("object:declare"); BOOLEAN.add("ol:compact"); BOOLEAN.add("optgroup:disabled"); BOOLEAN.add("option:selected"); BOOLEAN.add("option:disabled"); BOOLEAN.add("script:defer"); BOOLEAN.add("select:multiple"); BOOLEAN.add("select:disabled"); BOOLEAN.add("td:nowrap"); BOOLEAN.add("textarea:disabled"); BOOLEAN.add("textarea:readonly"); BOOLEAN.add("th:nowrap"); BOOLEAN.add("ul:compact"); // elements with an empty content model EMPTIES.add("area"); EMPTIES.add("base"); EMPTIES.add("br"); EMPTIES.add("col"); EMPTIES.add("embed"); EMPTIES.add("hr"); EMPTIES.add("img"); EMPTIES.add("input"); EMPTIES.add("link"); EMPTIES.add("meta"); EMPTIES.add("basefont"); EMPTIES.add("frame"); EMPTIES.add("isindex"); EMPTIES.add("param"); // elements with an empty content model EMPTIES5.add("area"); EMPTIES5.add("base"); EMPTIES5.add("br"); EMPTIES5.add("col"); EMPTIES5.add("command"); EMPTIES5.add("embed"); EMPTIES5.add("hr"); EMPTIES5.add("img"); EMPTIES5.add("input"); EMPTIES5.add("keygen"); EMPTIES5.add("link"); EMPTIES5.add("meta"); EMPTIES5.add("param"); EMPTIES5.add("source"); EMPTIES5.add("track"); EMPTIES5.add("wbr"); EMPTIES5.add("basefont"); EMPTIES5.add("frame"); EMPTIES5.add("isindex"); // URI attributes URIS.add("a:href"); URIS.add("a:name"); URIS.add("applet:codebase"); URIS.add("area:href"); URIS.add("base:href"); URIS.add("blockquote:cite"); URIS.add("body:background"); URIS.add("button:datasrc"); URIS.add("del:cite"); URIS.add("div:datasrc"); URIS.add("form:action"); URIS.add("frame:longdesc"); URIS.add("frame:src"); URIS.add("head:profile"); URIS.add("iframe:longdesc"); URIS.add("iframe:src"); URIS.add("img:longdesc"); URIS.add("img:src"); URIS.add("img:usemap"); URIS.add("input:datasrc"); URIS.add("input:src"); URIS.add("input:usemap"); URIS.add("ins:cite"); URIS.add("link:href"); URIS.add("object:archive"); URIS.add("object:classid"); URIS.add("object:codebase"); URIS.add("object:data"); URIS.add("object:datasrc"); URIS.add("object:usemap"); URIS.add("q:cite"); URIS.add("script:for"); URIS.add("script:src"); URIS.add("select:datasrc"); URIS.add("span:datasrc"); URIS.add("table:datasrc"); URIS.add("textarea:datasrc"); } } basex-7.7.2/basex-core/src/main/java/org/basex/io/serial/InputException.java000066400000000000000000000007541222453003200267140ustar00rootroot00000000000000package org.basex.io.serial; import java.io.*; /** * This class indicates exceptions during input stream processing. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class InputException extends IOException { /** * Constructor. */ public InputException() { this("Invalid input, or wrong encoding specified"); } /** * Constructor. * @param msg error message */ public InputException(final String msg) { super(msg); } } basex-7.7.2/basex-core/src/main/java/org/basex/io/serial/JsonCGSerializer.java000066400000000000000000000135401222453003200271100ustar00rootroot00000000000000package org.basex.io.serial; import static org.basex.data.DataText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.io.*; import org.basex.query.util.json.*; import org.basex.query.value.item.*; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * This class serializes data as JSON. The input must conform to the rules * defined in the {@link JsonCGConverter} class. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class JsonCGSerializer extends JsonSerializer { /** Plural. */ private static final byte[] S = { 's' }; /** Global data type attributes. */ private static final byte[][] ATTRS = { concat(T_BOOLEAN, S), concat(T_NUMBER, S), concat(NULL, S), concat(T_ARRAY, S), concat(T_OBJECT, S), concat(T_STRING, S) }; /** Supported data types. */ private static final byte[][] TYPES = { T_BOOLEAN, T_NUMBER, NULL, T_ARRAY, T_OBJECT, T_STRING }; /** Cached data types. */ private final TokenSet[] typeCache = new TokenSet[TYPES.length]; /** Comma flags. */ private final BoolList comma = new BoolList(); /** Types. */ private final TokenList types = new TokenList(); /** * Constructor. * @param os output stream reference * @param props serialization properties * @throws IOException I/O exception */ protected JsonCGSerializer(final OutputStream os, final SerializerProp props) throws IOException { super(os, props); for(int t = 0; t < typeCache.length; t++) typeCache[t] = new TokenMap(); } @Override protected void startOpen(final byte[] name) throws IOException { if(level == 0 && !eq(name, T_JSON)) error("<%> expected as root node", T_JSON); types.set(level, null); comma.set(level + 1, false); } @Override protected void attribute(final byte[] name, final byte[] value) throws IOException { if(level == 0) { final int tl = typeCache.length; for(int t = 0; t < tl; t++) { if(eq(name, ATTRS[t])) { for(final byte[] b : split(value, ' ')) typeCache[t].add(b); return; } } } if(eq(name, T_TYPE)) { if(!eq(value, TYPES)) error("Element <%> has invalid type \"%\"", elem, value); types.set(level, value); } else if(!eq(name, XMLNS) && !startsWith(name, XMLNSC)) { error("Element <%> has invalid attribute \"%\"", elem, name); } } @Override protected void finishOpen() throws IOException { if(comma.get(level)) print(','); else comma.set(level, true); if(level > 0) { indent(level); final byte[] par = types.get(level - 1); if(eq(par, T_OBJECT)) { print('"'); print(XMLToken.decode(elem)); print("\": "); } else if(!eq(par, T_ARRAY)) { error("Element <%> is typed as \"%\" and cannot be nested", tags.get(level - 1), par); } } byte[] type = types.get(level); if(type == null) { int t = -1; final int tl = typeCache.length; while(++t < tl && !typeCache[t].contains(elem)); if(t != tl) type = TYPES[t]; else type = T_STRING; types.set(level, type); } if(eq(type, T_OBJECT)) { print('{'); } else if(eq(type, T_ARRAY)) { print('['); } else if(level == 0) { error("Element <%> must be typed as \"%\" or \"%\"", T_JSON, T_OBJECT, T_ARRAY); } } @Override protected void finishText(final byte[] text) throws IOException { final byte[] type = types.get(level - 1); if(eq(type, T_STRING)) { print('"'); for(final byte ch : text) code(ch); print('"'); } else if(eq(type, T_BOOLEAN, T_NUMBER)) { print(text); } else if(trim(text).length != 0) { error("Element <%> is typed as \"%\" and cannot have a value", tags.get(level - 1), type); } } @Override protected void finishEmpty() throws IOException { finishOpen(); final byte[] type = types.get(level); if(eq(type, T_STRING)) { print("\"\""); } else if(eq(type, NULL)) { print(NULL); } else if(!eq(type, T_OBJECT, T_ARRAY)) { error("Value expected for type \"%\"", type); } finishClose(); } @Override protected void finishClose() throws IOException { final byte[] type = types.get(level); if(eq(type, T_ARRAY)) { indent(level); print(']'); } else if(eq(type, T_OBJECT)) { indent(level); print('}'); } } @Override protected void code(final int ch) throws IOException { switch(ch) { case '\b': print("\\b"); break; case '\f': print("\\f"); break; case '\n': print("\\n"); break; case '\r': print("\\r"); break; case '\t': print("\\t"); break; case '"': print("\\\""); break; case '/': print("\\/"); break; case '\\': print("\\\\"); break; default: print(ch); break; } } @Override protected void finishComment(final byte[] value) throws IOException { error("Comments cannot be serialized"); } @Override protected void finishPi(final byte[] name, final byte[] value) throws IOException { error("Processing instructions cannot be serialized"); } @Override protected void atomic(final Item value) throws IOException { error("Atomic values cannot be serialized"); } /** * Prints some indentation. * @param lvl level * @throws IOException I/O exception */ void indent(final int lvl) throws IOException { if(!indent) return; print(nl); final int ls = lvl * indents; for(int l = 0; l < ls; ++l) print(tab); } /** * Raises an error with the specified message. * @param msg error message * @param ext error details * @throws IOException I/O exception */ private static void error(final String msg, final Object... ext) throws IOException { throw BXJS_SERIAL.thrwSerial(Util.inf(msg, ext)); } } basex-7.7.2/basex-core/src/main/java/org/basex/io/serial/JsonMLSerializer.java000066400000000000000000000063271222453003200271340ustar00rootroot00000000000000package org.basex.io.serial; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.io.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * This class serializes data as described in the * JsonML specification. * JsonML can be used to transform any XML document to JSON and back. * Note, however, that namespaces, comments and processing instructions will be * discarded in the transformation process. More details are found in the * JsonML documentation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class JsonMLSerializer extends OutputSerializer { /** Indicates serialized attributes. */ private boolean att; /** * Constructor. * @param os output stream reference * @param props serialization properties * @throws IOException I/O exception */ protected JsonMLSerializer(final OutputStream os, final SerializerProp props) throws IOException { super(os, props); } @Override protected void startOpen(final byte[] name) throws IOException { if(level != 0) { print(','); indent(); } print('['); print('"'); for(final byte ch : local(name)) code(ch); print('"'); att = false; } @Override protected void attribute(final byte[] name, final byte[] value) throws IOException { print(", "); if(!att) { print("{"); att = true; } print('"'); for(final byte ch : name) code(ch); print("\":\""); for(final byte ch : value) code(ch); print("\""); } @Override protected void namespace(final byte[] n, final byte[] v) throws IOException { } @Override protected void finishOpen() throws IOException { if(att) print("}"); } @Override protected void finishText(final byte[] text) throws IOException { print(','); indent(); print('"'); for(final byte ch : text) code(ch); print('"'); } @Override protected void finishEmpty() throws IOException { finishOpen(); print(']'); } @Override protected void finishClose() throws IOException { print(']'); } @Override protected void code(final int ch) throws IOException { switch(ch) { case '\b': print("\\b"); break; case '\f': print("\\f"); break; case '\n': print("\\n"); break; case '\r': print("\\r"); break; case '\t': print("\\t"); break; case '"': print("\\\""); break; case '/': print("\\/"); break; case '\\': print("\\\\"); break; default: print(ch); break; } } @Override protected void finishComment(final byte[] value) throws IOException { } @Override protected void finishPi(final byte[] name, final byte[] value) throws IOException { } @Override protected void atomic(final Item value) throws IOException { error("Atomic values cannot be serialized"); } /** * Raises an error with the specified message. * @param msg error message * @param ext error details * @throws IOException I/O exception */ private static void error(final String msg, final Object... ext) throws IOException { throw BXJS_SERIAL.thrwSerial(Util.inf(msg, ext)); } } basex-7.7.2/basex-core/src/main/java/org/basex/io/serial/JsonSerializer.java000066400000000000000000000017761222453003200267060ustar00rootroot00000000000000package org.basex.io.serial; import static org.basex.io.serial.SerializerProp.*; import java.io.*; /** * Abstract JSON serializer class. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public abstract class JsonSerializer extends OutputSerializer { /** * Constructor. * @param os output stream reference * @param props serialization properties * @throws IOException I/O exception */ protected JsonSerializer(final OutputStream os, final SerializerProp props) throws IOException { super(os, props); } /** * Returns a specific serializer. * @param os output stream reference * @param props serialization properties (can be {@code null}) * @return serializer * @throws IOException I/O exception */ public static Serializer get(final OutputStream os, final SerializerProp props) throws IOException { return props.get(S_JSON_FORMAT).equals("json") ? new JsonCGSerializer(os, props) : new JsonMLSerializer(os, props); } } basex-7.7.2/basex-core/src/main/java/org/basex/io/serial/OutputSerializer.java000066400000000000000000000337101222453003200272660ustar00rootroot00000000000000package org.basex.io.serial; import static org.basex.core.Text.*; import static org.basex.data.DataText.*; import static org.basex.io.serial.SerializerProp.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.io.*; import java.nio.charset.*; import org.basex.data.*; import org.basex.io.*; import org.basex.io.out.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.util.*; import org.basex.util.ft.*; import org.basex.util.hash.*; /** * This class serializes data to an output stream. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class OutputSerializer extends Serializer { /** System document type. */ protected String docsys; /** Public document type. */ private String docpub; /** Flag for printing content type. */ protected int ct; /** Separator flag (used for formatting). */ protected boolean sep; /** Item separator flag (used for formatting). */ protected boolean isep; /** Script flag. */ protected boolean script; /** HTML5 flag. */ protected final boolean html5; /** URI escape flag. */ protected final boolean escape; /** Standalone 'omit' flag. */ protected final boolean saomit; /** Include content type flag. */ protected final boolean content; /** WebDAV flag. */ protected final boolean webdav; /** New line. */ protected final byte[] nl; /** Output stream. */ protected final PrintOutput out; /** Item flag (used for formatting). */ private boolean item; /** UTF8 flag. */ private final boolean utf8; /** CData elements. */ private final TokenSet cdata = new TokenSet(); /** Suppress indentation elements. */ private final TokenSet suppress = new TokenSet(); /** Media type. */ private final String media; /** Charset. */ private final Charset encoding; /** Item separator. */ private final byte[] itemsep; // project specific properties /** Number of spaces to indent. */ protected final int indents; /** Tabular character. */ protected final char tab; /** Format items. */ private final boolean format; /** Prefix for wrapped results. */ private final byte[] wPre; /** Wrapper flag. */ private final boolean wrap; /** * Constructor, specifying serialization options. * @param os output stream reference * @param props serialization properties * @param versions supported versions * @throws IOException I/O exception */ OutputSerializer(final OutputStream os, final SerializerProp props, final String... versions) throws IOException { final SerializerProp p = props == null ? PROPS : props; final String ver = p.supported(S_VERSION, versions); final String htmlver = p.supported(S_HTML_VERSION, V40, V401, V50); html5 = htmlver.equals(V50) || ver.equals(V50); final boolean omitDecl = p.yes(S_OMIT_XML_DECLARATION); final boolean bom = p.yes(S_BYTE_ORDER_MARK); final String sa = p.check(S_STANDALONE, YES, NO, OMIT); saomit = sa.equals(OMIT); p.check(S_NORMALIZATION_FORM, NFC, DataText.NONE); final String maps = p.get(S_USE_CHARACTER_MAPS); final String enc = normEncoding(p.get(S_ENCODING)); try { encoding = Charset.forName(enc); } catch(final Exception ex) { throw SERENCODING.thrwSerial(enc); } utf8 = enc == UTF8; // project specific properties indents = Math.max(0, toInt(p.get(S_INDENTS))); format = p.yes(S_FORMAT); tab = p.yes(S_TABULATOR) ? '\t' : ' '; wPre = token(p.get(S_WRAP_PREFIX)); wrap = wPre.length != 0; final String eol = p.check(S_NEWLINE, S_NL, S_CR, S_CRNL); nl = utf8(token(eol.equals(S_NL) ? "\n" : eol.equals(S_CR) ? "\r" : "\r\n"), enc); String s = p.get(S_ITEM_SEPARATOR); if(s.equals(UNDEFINED)) s = p.get(S_SEPARATOR); itemsep = s.equals(UNDEFINED) ? null : token(s.indexOf('\\') != -1 ? s.replace("\\n", "\n").replace("\\r", "\r").replace("\\t", "\t") : s); docsys = p.get(S_DOCTYPE_SYSTEM); docpub = p.get(S_DOCTYPE_PUBLIC); media = p.get(S_MEDIA_TYPE); escape = p.yes(S_ESCAPE_URI_ATTRIBUTES); content = p.yes(S_INCLUDE_CONTENT_TYPE); undecl = p.yes(S_UNDECLARE_PREFIXES); indent = p.yes(S_INDENT) && format; webdav = maps.equals("webdav"); if(!webdav && !maps.isEmpty()) SERMAP.thrwSerial(maps); if(docsys.isEmpty()) docsys = null; if(docpub.isEmpty()) docpub = null; // print byte-order-mark out = PrintOutput.get(os); if(bom) { // comparison by reference if(enc == UTF8) { out.write(0xEF); out.write(0xBB); out.write(0xBF); } else if(enc == UTF16LE) { out.write(0xFF); out.write(0xFE); } else if(enc == UTF16BE) { out.write(0xFE); out.write(0xFF); } } final String supp = p.get(S_SUPPRESS_INDENTATION); if(!supp.isEmpty()) { for(final String c : supp.split("\\s+")) { if(!c.isEmpty()) suppress.add(c); } } // collect CData elements final boolean html = this instanceof HTMLSerializer; final boolean xml = this instanceof XMLSerializer || this instanceof XHTMLSerializer; if(xml || html) { final String cdse = p.get(S_CDATA_SECTION_ELEMENTS); for(final String c : cdse.split("\\s+")) { if(c.isEmpty()) continue; if(!html || c.contains(":") && (!html5 || !c.contains("html:"))) cdata.add(c); } if(undecl && ver.equals(V10)) SERUNDECL.thrwSerial(); if(xml) { if(omitDecl) { if(!saomit || !ver.equals(V10) && docsys != null) SERSTAND.thrwSerial(); } else { print(PI_O); print(DOCDECL1); print(ver); print(DOCDECL2); print(p.get(S_ENCODING)); if(!saomit) { print(DOCDECL3); print(sa); } print(ATT2); print(PI_C); sep = true; } } } // open results element if(wrap) { startElement(concat(wPre, COLON, T_RESULTS)); namespace(wPre, token(p.get(S_WRAP_URI))); } } @Override public final void reset() { sep = false; item = false; isep = false; } @Override public void close() throws IOException { if(wrap) closeElement(); out.flush(); } @Override public final boolean finished() { return out.finished(); } // PROTECTED METHODS ================================================================== @Override protected void openResult() throws IOException { final byte[] sp = itemsep; if(sp != null) { if(isep) { final int sl = sp.length; if(sl == 1) { printChar(sp[0]); } else { for(int s = 0; s < sl; s += cl(sp, s)) printChar(cp(sp, s)); } sep = false; } else { isep = true; } } if(wrap) startElement(wPre.length != 0 ? concat(wPre, COLON, T_RESULT) : T_RESULT); } @Override protected void closeResult() throws IOException { if(wrap) closeElement(); } @Override protected void attribute(final byte[] n, final byte[] v) throws IOException { print(' '); print(n); print(ATT1); for(int k = 0; k < v.length; k += cl(v, k)) { final int ch = cp(v, k); if(!format) { printChar(ch); } else if(ch == '"') { print(E_QU); } else if(ch == 0x9 || ch == 0xA) { hex(ch); } else { code(ch); } } print(ATT2); } @Override protected void finishText(final byte[] b) throws IOException { if(cdata.isEmpty() || tags.isEmpty() || !cdata.contains(tags.peek())) { for(int k = 0; k < b.length; k += cl(b, k)) code(cp(b, k)); } else { print(CDATA_O); int c = 0; for(int k = 0; k < b.length; k += cl(b, k)) { final int ch = cp(b, k); if(ch == ']') { ++c; } else { if(c > 1 && ch == '>') { print(CDATA_C); print(CDATA_O); } c = 0; } printChar(ch); } print(CDATA_C); } sep = false; } @Override protected void finishText(final byte[] b, final FTPos ftp) throws IOException { final FTLexer lex = new FTLexer().sc().init(b); while(lex.hasNext()) { final FTSpan span = lex.next(); if(!span.special && ftp.contains(span.pos)) print((char) TokenBuilder.MARK); final byte[] t = span.text; for(int k = 0; k < t.length; k += cl(t, k)) code(cp(t, k)); } sep = false; } @Override protected void finishComment(final byte[] n) throws IOException { if(sep) indent(); print(COMM_O); print(n); print(COMM_C); sep = true; } @Override protected void finishPi(final byte[] n, final byte[] v) throws IOException { if(sep) indent(); print(PI_O); print(n); print(' '); print(v); print(PI_C); sep = true; } @Override protected void atomic(final Item it) throws IOException { if(sep && item) print(' '); try { if(it instanceof StrStream) { final InputStream ni = ((StrStream) it).input(null); try { for(int i; (i = ni.read()) != -1;) code(i); } finally { ni.close(); } } else { final byte[] atom = it.string(null); for(int a = 0; a < atom.length; a += cl(atom, a)) code(cp(atom, a)); } } catch(final QueryException ex) { throw new SerializerException(ex); } sep = true; item = true; } @Override protected void openDoc(final byte[] n) throws IOException { sep = false; } @Override protected void startOpen(final byte[] t) throws IOException { doctype(t); if(sep) indent(); print(ELEM_O); print(t); sep = true; } @Override protected void finishOpen() throws IOException { print(ELEM_C); } @Override protected void finishEmpty() throws IOException { print(ELEM_SC); } @Override protected void finishClose() throws IOException { if(sep) indent(); print(ELEM_OS); print(elem); print(ELEM_C); sep = true; } /** * Encodes the specified character before printing it. * @param ch character to be encoded and printed * @throws IOException I/O exception */ protected void code(final int ch) throws IOException { if(!format) { printChar(ch); } else if(ch < ' ' && ch != '\n' && ch != '\t' || ch >= 0x7F && ch < 0xA0 || webdav && ch == 0xA0) { hex(ch); } else if(ch == '&') { print(E_AMP); } else if(ch == '>') { print(E_GT); } else if(ch == '<') { print(E_LT); } else if(ch == 0x2028) { print(E_2028); } else { printChar(ch); } } /** * Prints the document type declaration. * @param dt document type, or {@code null} for html type * @return true if doctype was added * @throws IOException I/O exception */ protected boolean doctype(final byte[] dt) throws IOException { if(level != 0 || docsys == null && docpub == null) return false; if(sep) indent(); print(DOCTYPE); if(dt == null) print(M_HTML); else print(dt); if(docpub != null) print(' ' + PUBLIC + " \"" + docpub + '"'); else print(' ' + SYSTEM); if(docsys != null) print(" \"" + docsys + '"'); print(ELEM_C); sep = true; return true; } /** * Indents the next text. * @throws IOException I/O exception */ protected final void indent() throws IOException { if(item) { item = false; } else if(indent) { if(!suppress.isEmpty() && !tags.isEmpty()) { for(final byte[] t : tags) if(suppress.contains(t)) return; } print(nl); final int ls = level * indents; for(int l = 0; l < ls; ++l) print(tab); } } /** * Returns a hex entity for the specified character. * @param ch character * @throws IOException I/O exception */ protected final void hex(final int ch) throws IOException { print("&#x"); final int h = ch >> 4; if(h != 0) print(HEX[h]); print(HEX[ch & 15]); print(';'); } /** * Writes a character in the current encoding. * Converts newlines to the operating system default. * @param ch character to be printed * @throws IOException I/O exception */ protected final void printChar(final int ch) throws IOException { if(ch == '\n') out.write(nl); else print(ch); } /** * Writes a character in the current encoding. * @param ch character to be printed * @throws IOException I/O exception */ protected void print(final int ch) throws IOException { // comparison by reference if(utf8) out.utf8(ch); else out.write(new TokenBuilder(4).add(ch).toString().getBytes(encoding)); } /** * Writes a token in the current encoding. * @param token token to be printed * @throws IOException I/O exception */ protected final void print(final byte[] token) throws IOException { // comparison by reference if(utf8) { for(final byte b : token) out.write(b); } else { out.write(string(token).getBytes(encoding)); } } /** * Writes a string in the current encoding. * @param s string to be printed * @throws IOException I/O exception */ protected final void print(final String s) throws IOException { // comparison by reference if(utf8) { for(final byte b : token(s)) out.write(b); } else { out.write(s.getBytes(encoding)); } } /** * Prints the content type declaration. * @param empty empty flag * @param html method * @return {@code true} if declaration was printed * @throws IOException I/O exception */ protected boolean ct(final boolean empty, final boolean html) throws IOException { if(ct != 1) return false; ct++; if(empty) finishOpen(); level++; startOpen(META); attribute(HTTPEQUIV, token(MimeTypes.CONTENT_TYPE)); attribute(CONTENT, new TokenBuilder(media.isEmpty() ? MimeTypes.TEXT_HTML : media).add(CHARSET).addExt(encoding).finish()); if(html) { print(ELEM_C); } else { print(' '); print(ELEM_SC); } level--; if(empty) finishClose(); return true; } } basex-7.7.2/basex-core/src/main/java/org/basex/io/serial/RawSerializer.java000066400000000000000000000023131222453003200265120ustar00rootroot00000000000000package org.basex.io.serial; import java.io.*; import org.basex.io.out.*; import org.basex.query.*; import org.basex.query.value.item.*; /** * This class serializes data in its internal format: no indentation and entity * coding takes place, binary data is directly output as raw data, * and all nodes except for text nodes are skipped. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class RawSerializer extends TextSerializer { /** * Constructor, specifying serialization options. * @param os output stream reference * @param sp serialization properties * @throws IOException I/O exception */ RawSerializer(final OutputStream os, final SerializerProp sp) throws IOException { super(os, sp); } @Override protected void atomic(final Item it) throws IOException { try { final InputStream is = it.input(null); try { final PrintOutput po = out; for(int i; (i = is.read()) != -1;) po.write(i); } finally { is.close(); } } catch(final QueryException ex) { throw new SerializerException(ex); } } @Override protected void code(final int ch) throws IOException { print(ch); } } basex-7.7.2/basex-core/src/main/java/org/basex/io/serial/SAXSerializer.java000066400000000000000000000157341222453003200264270ustar00rootroot00000000000000package org.basex.io.serial; import static org.basex.util.Token.*; import java.io.*; import org.basex.query.value.item.*; import org.basex.util.*; import org.xml.sax.*; import org.xml.sax.ext.*; import org.xml.sax.helpers.*; /** * Bridge to translate XQuery items to SAX events. * The {@link #parse} methods do the following: *
    *
  1. notify startDocument()
  2. *
  3. serialize the item
  4. *
  5. notify endDocument()
  6. *
* * @author BaseX Team 2005-12, BSD License * @author Michael Hedenus */ public final class SAXSerializer extends Serializer implements XMLReader { /** Item to be serialized. */ private final Item item; /** Content handler. */ private ContentHandler contentHandler; /** Entity resolver. */ private EntityResolver entityResolver; /** DTD handler. */ private DTDHandler dtdHandler; /** Error handler. */ private ErrorHandler errorHandler; /** Lexical handler. */ private LexicalHandler lexicalHandler; /** * Constructor. * @param it item to be serialized */ public SAXSerializer(final Item it) { item = it; } // XMLReader ========================================================================== @Override public ContentHandler getContentHandler() { return contentHandler; } @Override public boolean getFeature(final String name) { return false; } @Override public Object getProperty(final String name) { return null; } @Override public void parse(final InputSource input) throws SAXException { parse(""); } @Override public void parse(final String id) throws SAXException { try { contentHandler.startDocument(); serialize(item); contentHandler.endDocument(); } catch(final Exception ex) { throw new SAXException(ex); } } @Override public void setContentHandler(final ContentHandler ch) { contentHandler = ch; } /** * Sets a lexical handler. * @param lh handler reference */ public void setLexicalHandler(final LexicalHandler lh) { lexicalHandler = lh; } @Override public void setEntityResolver(final EntityResolver er) { entityResolver = er; } @Override public EntityResolver getEntityResolver() { return entityResolver; } @Override public void setDTDHandler(final DTDHandler dtd) { dtdHandler = dtd; } @Override public DTDHandler getDTDHandler() { return dtdHandler; } @Override public void setErrorHandler(final ErrorHandler eh) { errorHandler = eh; } @Override public ErrorHandler getErrorHandler() { return errorHandler; } @Override public void setFeature(final String name, final boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { throw new SAXNotRecognizedException(); } @Override public void setProperty(final String name, final Object value) throws SAXNotRecognizedException, SAXNotSupportedException { throw new SAXNotRecognizedException(); } // Serializer ========================================================================= /** Map containing all attributes. */ private final Atts attributes = new Atts(); /** Map containing all attributes. */ private NSDecl namespaces; @Override protected void startOpen(final byte[] n) throws IOException { namespaces = new NSDecl(namespaces); attributes.clear(); } @Override protected void attribute(final byte[] n, final byte[] v) throws IOException { byte[] prefix = null; if(startsWith(n, XMLNS)) { if(n.length == 5) { prefix = EMPTY; } else if(n[5] == ':') { prefix = substring(n, 6); } } if(prefix != null) { namespaces.put(prefix, v); } else { attributes.add(n, v); } } @Override protected void finishOpen() throws IOException { try { final AttributesImpl attrs = new AttributesImpl(); final int as = attributes.size(); for(int a = 0; a < as; a++) { final byte[] name = attributes.name(a); final String uri = string(namespaces.get(prefix(name))); final String lname = string(local(name)); final String rname = string(name); final String value = string(attributes.value(a)); attrs.addAttribute(uri, lname, rname, null, value); } final String uri = string(namespaces.get(prefix(elem))); final String lname = string(local(elem)); final String rname = string(elem); contentHandler.startElement(uri, lname, rname, attrs); } catch(final SAXException ex) { throw new IOException(ex); } } @Override protected void finishEmpty() throws IOException { finishOpen(); finishClose(); } @Override protected void finishClose() throws IOException { try { final String name = string(elem); contentHandler.endElement("", name, name); namespaces = namespaces.getParent(); } catch(final SAXException ex) { throw new IOException(ex); } } @Override protected void finishText(final byte[] text) throws IOException { try { final String s = string(text); final char[] c = s.toCharArray(); contentHandler.characters(c, 0, c.length); } catch(final SAXException ex) { throw new IOException(ex); } } @Override protected void finishComment(final byte[] comment) throws IOException { if(lexicalHandler != null) { try { final String s = string(comment); final char[] c = s.toCharArray(); lexicalHandler.comment(c, 0, c.length); } catch(final SAXException ex) { throw new IOException(ex); } } } @Override protected void finishPi(final byte[] n, final byte[] v) throws IOException { try { contentHandler.processingInstruction(string(n), string(v)); } catch(final SAXException ex) { throw new IOException(ex); } } @Override protected void atomic(final Item i) throws IOException { // ignored } /** * Namespace declaration. */ static class NSDecl { /** Parent namespace declarations. */ private final NSDecl parent; /** Namespace declarations. */ private Atts decls; /** * Constructor. * @param par parent declarations */ NSDecl(final NSDecl par) { parent = par; } /** * Returns the parent declarations. * @return parent declarations */ NSDecl getParent() { return parent; } /** * Stores a new prefix and namespace. * @param prefix prefix * @param uri namespace uri */ void put(final byte[] prefix, final byte[] uri) { if(decls == null) decls = new Atts(); decls.add(prefix, uri); } /** * Retrieves the namespace uri for the given prefix. * @param prefix prefix to be found * @return namespace uri */ byte[] get(final byte[] prefix) { for(NSDecl c = this; c != null; c = c.parent) { if(c.decls != null) { final byte[] ns = c.decls.value(prefix); if(ns != null) return ns; } } return EMPTY; } } } basex-7.7.2/basex-core/src/main/java/org/basex/io/serial/Serializer.java000066400000000000000000000335741222453003200260550ustar00rootroot00000000000000package org.basex.io.serial; import static org.basex.data.DataText.*; import static org.basex.io.serial.SerializerProp.*; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.io.*; import org.basex.data.*; import org.basex.query.iter.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * This is an interface for serializing XQuery values. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class Serializer { /** Default serialization parameters. */ public static final SerializerProp PROPS = new SerializerProp(); /** Stack with opened tag names. */ protected final TokenList tags = new TokenList(); /** Current level. */ protected int level; /** Current tag. */ protected byte[] elem; /** Undeclare prefixes. */ protected boolean undecl; /** Indentation flag. */ protected boolean indent; /** Stack with currently available namespaces. */ private final Atts nspaces = new Atts(XML, XMLURI).add(EMPTY, EMPTY); /** Stack with namespace size pointers. */ private final IntList nstack = new IntList(); /** Indicates if an element is currently being opened. */ private boolean opening; /** * Returns an XML serializer. * @param os output stream reference * @return serializer * @throws IOException I/O exception */ public static XMLSerializer get(final OutputStream os) throws IOException { return new XMLSerializer(os, PROPS); } /** * Returns a specific serializer. * @param os output stream reference * @param props serialization properties (can be {@code null}) * @return serializer * @throws IOException I/O exception */ public static Serializer get(final OutputStream os, final SerializerProp props) throws IOException { if(props == null) return get(os); final String m = props.check(S_METHOD, METHODS); if(M_XHTML.equals(m)) return new XHTMLSerializer(os, props); if(M_HTML.equals(m)) return new HTMLSerializer(os, props); if(M_TEXT.equals(m)) return new TextSerializer(os, props); if(M_JSON.equals(m)) return new JsonCGSerializer(os, props); if(M_JSONML.equals(m)) return new JsonMLSerializer(os, props); if(M_CSV.equals(m)) return new CsvSerializer(os, props); if(M_RAW.equals(m)) return new RawSerializer(os, props); return new XMLSerializer(os, props); } // PUBLIC METHODS ===================================================================== /** * Serializes the specified item, which may be a node or an atomic value. * @param item item to be serialized * @throws IOException I/O exception */ public final void serialize(final Item item) throws IOException { openResult(); if(item instanceof ANode) { final Type type = item.type; if(type == NodeType.ATT) SERATTR.thrwSerial(item); if(type == NodeType.NSP) SERNS.thrwSerial(item); serialize((ANode) item); } else if(item instanceof FItem) { SERFUNC.thrwSerial(item.description()); } else { finishElement(); atomic(item); } closeResult(); } /** * Closes the serializer. * @throws IOException I/O exception */ @SuppressWarnings("unused") public void close() throws IOException { } /** * Tests if the serialization was interrupted. * @return result of check */ public boolean finished() { return false; } /** * Resets the serializer (indentation, etc). */ public void reset() { } // PROTECTED METHODS ================================================================== /** * Opens an element. * @param name element name * @throws IOException I/O exception */ protected final void startElement(final byte[] name) throws IOException { finishElement(); nstack.push(nspaces.size()); opening = true; elem = name; startOpen(name); } /** * Closes an element. * @throws IOException I/O exception */ protected final void closeElement() throws IOException { nspaces.size(nstack.pop()); if(opening) { finishEmpty(); opening = false; } else { elem = tags.pop(); level--; finishClose(); } } /** * Serializes a text. * @param value value * @param ftp full-text positions, used for visualization highlighting * @throws IOException I/O exception */ @SuppressWarnings("unused") protected void finishText(final byte[] value, final FTPos ftp) throws IOException { text(value); } /** * Gets the namespace URI currently bound by the given prefix. * @param pref namespace prefix * @return URI if found, {@code null} otherwise */ protected final byte[] nsUri(final byte[] pref) { for(int n = nspaces.size() - 1; n >= 0; n--) { if(eq(nspaces.name(n), pref)) return nspaces.value(n); } return null; } /** * Serializes a namespace if it has not been serialized by an ancestor yet. * @param pref prefix * @param uri URI * @throws IOException I/O exception */ protected void namespace(final byte[] pref, final byte[] uri) throws IOException { if(!undecl && pref.length != 0 && uri.length == 0) return; final byte[] u = nsUri(pref); if(u == null || !eq(u, uri)) { attribute(pref.length == 0 ? XMLNS : concat(XMLNSC, pref), uri); nspaces.add(pref, uri); } } /** * Starts a result. * @throws IOException I/O exception */ @SuppressWarnings("unused") protected void openResult() throws IOException { } /** * Closes a result. * @throws IOException I/O exception */ @SuppressWarnings("unused") protected void closeResult() throws IOException { } /** * Opens a document. * @param name name * @throws IOException I/O exception */ @SuppressWarnings("unused") protected void openDoc(final byte[] name) throws IOException { } /** * Closes a document. * @throws IOException I/O exception */ @SuppressWarnings("unused") protected void closeDoc() throws IOException { } /** * Serializes an attribute. * @param name name * @param value value * @throws IOException I/O exception */ protected abstract void attribute(final byte[] name, final byte[] value) throws IOException; /** * Starts an element. * @param name tag name * @throws IOException I/O exception */ protected abstract void startOpen(final byte[] name) throws IOException; /** * Finishes an opening element node. * @throws IOException I/O exception */ protected abstract void finishOpen() throws IOException; /** * Closes an empty element. * @throws IOException I/O exception */ protected abstract void finishEmpty() throws IOException; /** * Closes an element. * @throws IOException I/O exception */ protected abstract void finishClose() throws IOException; /** * Serializes a text. * @param value value * @throws IOException I/O exception */ protected abstract void finishText(final byte[] value) throws IOException; /** * Serializes a comment. * @param value value * @throws IOException I/O exception */ protected abstract void finishComment(final byte[] value) throws IOException; /** * Serializes a processing instruction. * @param name name * @param value value * @throws IOException I/O exception */ protected abstract void finishPi(final byte[] name, final byte[] value) throws IOException; /** * Serializes an atomic value. * @param item item * @throws IOException I/O exception */ protected abstract void atomic(final Item item) throws IOException; // PRIVATE METHODS ========================================================== /** * Serializes the specified node. * @param node node to be serialized * @throws IOException I/O exception */ private void serialize(final ANode node) throws IOException { if(node instanceof DBNode) { serialize((DBNode) node); } else { final Type type = node.type; if(type == NodeType.COM) { comment(node.string()); } else if(type == NodeType.TXT) { text(node.string()); } else if(type == NodeType.PI) { pi(node.name(), node.string()); } else if(type == NodeType.NSP) { namespace(node.name(), node.string()); } else if(type == NodeType.DOC) { openDoc(node.baseURI()); for(final ANode n : node.children()) serialize(n); closeDoc(); } else { // serialize elements (code will never be called for attributes) final QNm name = node.qname(); startElement(name.string()); // serialize declared namespaces final Atts nsp = node.namespaces(); for(int p = nsp.size() - 1; p >= 0; p--) { namespace(nsp.name(p), nsp.value(p)); } // add new or updated namespace namespace(name.prefix(), name.uri()); // serialize attributes final boolean i = indent; AxisMoreIter ai = node.attributes(); for(ANode nd; (nd = ai.next()) != null;) { final byte[] n = nd.name(); final byte[] v = nd.string(); attribute(n, v); if(eq(n, XML_SPACE)) indent &= eq(v, DataText.DEFAULT); } // serialize children ai = node.children(); for(ANode n; (n = ai.next()) != null;) serialize(n); indent = i; closeElement(); } } } /** * Serializes a node of the specified data reference. * @param node database node * @throws IOException I/O exception */ private void serialize(final DBNode node) throws IOException { final FTPosData ft = node instanceof FTPosNode ? ((FTPosNode) node).ft : null; final Data data = node.data; int p = node.pre; int k = data.kind(p); if(k == Data.ATTR) SERATTR.thrwSerial(node); boolean doc = false; final TokenSet nsp = data.nspaces.size() != 0 ? new TokenSet() : null; final IntList pars = new IntList(); final BoolList indt = new BoolList(); // loop through all table entries final int s = p + data.size(p, k); while(p < s && !finished()) { k = data.kind(p); final int r = data.parent(p, k); // close opened elements... while(!pars.isEmpty() && pars.peek() >= r) { closeElement(); indent = indt.pop(); pars.pop(); } if(k == Data.DOC) { if(doc) closeDoc(); openDoc(data.text(p++, true)); doc = true; } else if(k == Data.TEXT) { final FTPos ftd = ft != null ? ft.get(data, p) : null; if(ftd != null) text(data.text(p++, true), ftd); else text(data.text(p++, true)); } else if(k == Data.COMM) { comment(data.text(p++, true)); } else if(k == Data.PI) { pi(data.name(p, k), data.atom(p++)); } else { // add element node final byte[] name = data.name(p, k); startElement(name); // add namespace definitions if(nsp != null) { // add namespaces from database nsp.clear(); int pp = p; // check namespace of current element final byte[] u = data.nspaces.uri(data.uri(p, k)); namespace(prefix(name), u == null ? EMPTY : u); do { final Atts ns = data.ns(pp); for(int n = 0; n < ns.size(); ++n) { final byte[] pref = ns.name(n); if(nsp.add(pref)) namespace(pref, ns.value(n)); } // check ancestors only on top level if(level != 0) break; pp = data.parent(pp, data.kind(pp)); } while(pp >= 0 && data.kind(pp) == Data.ELEM); } // serialize attributes indt.push(indent); final int as = p + data.attSize(p, k); while(++p != as) { final byte[] n = data.name(p, Data.ATTR); final byte[] v = data.text(p, false); attribute(n, v); if(eq(n, XML_SPACE)) indent &= eq(v, DataText.DEFAULT); } pars.push(r); } } // process remaining elements... while(!pars.isEmpty()) { closeElement(); indent = indt.pop(); pars.pop(); } if(doc) closeDoc(); } /** * Serializes a text. * @param v text bytes * @param ftp full-text positions, used for visualization highlighting * @throws IOException I/O exception */ private void text(final byte[] v, final FTPos ftp) throws IOException { finishElement(); finishText(v, ftp); } /** * Serializes a comment. * @param value value * @throws IOException I/O exception */ private void comment(final byte[] value) throws IOException { finishElement(); finishComment(value); } /** * Serializes a text. * @param value text bytes * @throws IOException I/O exception */ private void text(final byte[] value) throws IOException { finishElement(); finishText(value); } /** * Serializes a processing instruction. * @param name name * @param value value * @throws IOException I/O exception */ private void pi(final byte[] name, final byte[] value) throws IOException { finishElement(); finishPi(name, value); } /** * Finishes an opening element node if necessary. * @throws IOException I/O exception */ private void finishElement() throws IOException { if(!opening) return; opening = false; finishOpen(); tags.push(elem); level++; } } basex-7.7.2/basex-core/src/main/java/org/basex/io/serial/SerializerException.java000066400000000000000000000021741222453003200277240ustar00rootroot00000000000000package org.basex.io.serial; import java.io.*; import org.basex.query.*; import org.basex.util.*; /** * This class indicates exceptions during the serialization of a query. * This exception contains a {@link QueryException}, which can later be * unwrapped. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class SerializerException extends IOException { /** Wrapped query exception. */ private final QueryException exception; /** * Default constructor. * @param qe query exception */ public SerializerException(final QueryException qe) { super(Util.message(qe)); exception = qe; } @Override public QueryException getCause() { return exception; } /** * Returns the query exception. * @param info input info * @return query exception */ public QueryException getCause(final InputInfo info) { if(info != null) exception.info(info); return exception; } @Override public String getLocalizedMessage() { return exception.getLocalizedMessage(); } @Override public String getMessage() { return exception.getMessage(); } } basex-7.7.2/basex-core/src/main/java/org/basex/io/serial/SerializerProp.java000066400000000000000000000175501222453003200267120ustar00rootroot00000000000000package org.basex.io.serial; import static org.basex.core.Text.*; import static org.basex.data.DataText.*; import static org.basex.query.util.Err.*; import org.basex.core.*; import org.basex.util.*; import org.basex.util.list.*; /** * This class defines all available serialization parameters. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class SerializerProp extends AProp { /** Undefined flag. */ static final String UNDEFINED = "\u0001"; /** Serialization parameter: yes/no. */ public static final Object[] S_BYTE_ORDER_MARK = { "byte-order-mark", NO }; /** Serialization parameter: list of QNames. */ public static final Object[] S_CDATA_SECTION_ELEMENTS = { "cdata-section-elements", "" }; /** Serialization parameter. */ public static final Object[] S_DOCTYPE_PUBLIC = { "doctype-public", "" }; /** Serialization parameter. */ public static final Object[] S_DOCTYPE_SYSTEM = { "doctype-system", "" }; /** Serialization parameter: valid encoding. */ public static final Object[] S_ENCODING = { "encoding", Token.UTF8 }; /** Serialization parameter: yes/no. */ public static final Object[] S_ESCAPE_URI_ATTRIBUTES = { "escape-uri-attributes", NO }; /** Serialization parameter: yes/no. */ public static final Object[] S_INCLUDE_CONTENT_TYPE = { "include-content-type", NO }; /** Serialization parameter: yes/no. */ public static final Object[] S_INDENT = { "indent", YES }; /** Serialization parameter. */ public static final Object[] S_SUPPRESS_INDENTATION = { "suppress-indentation", "" }; /** Serialization parameter. */ public static final Object[] S_MEDIA_TYPE = { "media-type", "" }; /** Serialization parameter: xml/xhtml/html/text. */ public static final Object[] S_METHOD = { "method", M_XML }; /** Serialization parameter: NFC/NFD/NFKC/NKFD/fully-normalized/none. */ public static final Object[] S_NORMALIZATION_FORM = { "normalization-form", NFC }; /** Serialization parameter: yes/no. */ public static final Object[] S_OMIT_XML_DECLARATION = { "omit-xml-declaration", YES }; /** Serialization parameter: yes/no/omit. */ public static final Object[] S_STANDALONE = { "standalone", OMIT }; /** Serialization parameter: yes/no. */ public static final Object[] S_UNDECLARE_PREFIXES = { "undeclare-prefixes", NO }; /** Serialization parameter. */ public static final Object[] S_USE_CHARACTER_MAPS = { "use-character-maps", "" }; /** Serialization parameter. */ public static final Object[] S_ITEM_SEPARATOR = { "item-separator", UNDEFINED }; /** Serialization parameter: 1.0/1.1. */ public static final Object[] S_VERSION = { "version", "" }; /** Serialization parameter: 4.0/4.01/5.0. */ public static final Object[] S_HTML_VERSION = { "html-version", "" }; /** Parameter document. */ public static final Object[] S_PARAMETER_DOCUMENT = { "parameter-document", "" }; /** Specific serialization parameter: newline. */ public static final Object[] S_NEWLINE = { "newline", Prop.NL.equals("\r") ? S_CR : Prop.NL.equals("\n") ? S_NL : S_CRNL }; /** Specific serialization parameter: formatting. */ public static final Object[] S_FORMAT = { "format", YES }; /** Specific serialization parameter: indent with spaces or tabs. */ public static final Object[] S_TABULATOR = { "tabulator", NO }; /** Specific serialization parameter: number of spaces to indent. */ public static final Object[] S_INDENTS = { "indents", "2" }; /** Specific serialization parameter: item separator. */ public static final Object[] S_SEPARATOR = { "separator", UNDEFINED }; /** Specific serialization parameter: prefix of result wrapper. */ public static final Object[] S_WRAP_PREFIX = { "wrap-prefix", "" }; /** Specific serialization parameter: URI of result wrapper. */ public static final Object[] S_WRAP_URI = { "wrap-uri", "" }; /** Specific serialization parameter. */ public static final Object[] S_CSV_SEPARATOR = { "csv-separator", "," }; /** Specific serialization parameter. */ public static final Object[] S_CSV_HEADER = { "csv-header", "false" }; /** Specific serialization parameter. */ public static final Object[] S_JSON_SPEC = { "json-spec", "RFC4672" }; /** Specific serialization parameter. */ public static final Object[] S_JSON_UNESCAPE = { "json-unescape", "true" }; /** Specific serialization parameter. */ public static final Object[] S_JSON_FORMAT = { "json-format", "json" }; /** Unknown properties. */ public final StringList unknown = new StringList(0); /** * Constructor. */ public SerializerProp() { super(); } /** * Constructor, specifying initial properties. * @param s property string. Properties are separated with commas ({@code ,}), * key/values with the equality character ({@code =}). */ public SerializerProp(final String s) { for(final String ser : s.trim().split(",")) { if(ser.isEmpty()) continue; final String[] sprop = ser.split("=", 2); final String key = sprop[0].trim(); final String value = set(key, sprop.length < 2 ? "" : sprop[1].trim()); if(value == null) unknown.add(key); } } /** * Retrieves a value from the specified property and checks allowed values. * @param key property key * @param allowed allowed values * @return value * @throws SerializerException serializer exception */ public String check(final Object[] key, final String... allowed) throws SerializerException { final String val = get(key); for(final String a : allowed) if(a.equals(val)) return val; throw error(key[0], val, allowed); } /** * Retrieves a value from the specified property and checks for supported values. * @param key property key * @param allowed allowed values * @return value * @throws SerializerException serializer exception */ public String supported(final Object[] key, final String... allowed) throws SerializerException { final String val = get(key); if(val.isEmpty()) return allowed.length > 0 ? allowed[0] : val; for(final String a : allowed) if(a.equals(val)) return val; throw SERNOTSUPP.thrwSerial(allowed(key[0], val, allowed)); } /** * Retrieves a value from the specified property and checks for its boolean * value. * @param key property key * @return value * @throws SerializerException serializer exception */ public boolean yes(final Object[] key) throws SerializerException { final String val = get(key); for(final String a : new String[] { YES, TRUE, ON }) { if(a.equals(val)) return true; } for(final String a : new String[] { NO, FALSE, OFF }) { if(a.equals(val)) return false; } throw error(key[0], val, YES, NO); } /** * Returns an exception string for a wrong key. * @param key property key * @param found found value * @param allowed allowed values * @return exception * @throws SerializerException serializer exception */ public static SerializerException error(final Object key, final String found, final String... allowed) throws SerializerException { throw SEROPT.thrwSerial(allowed(key, found, allowed)); } /** * Returns a list of allowed keys. * @param key property key * @param found found value * @param allowed allowed values * @return exception */ public static String allowed(final Object key, final String found, final String... allowed) { final TokenBuilder tb = new TokenBuilder(); tb.addExt(SERVAL, key, allowed[0]); for(int a = 1; a < allowed.length; ++a) tb.addExt(SERVAL2, allowed[a]); tb.addExt(SERVAL3, found); return tb.toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/io/serial/TextSerializer.java000066400000000000000000000022061222453003200267060ustar00rootroot00000000000000package org.basex.io.serial; import java.io.*; /** * This class serializes data as text. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class TextSerializer extends OutputSerializer { /** * Constructor, specifying serialization options. * @param os output stream reference * @param p serialization properties * @throws IOException I/O exception */ TextSerializer(final OutputStream os, final SerializerProp p) throws IOException { super(os, p); } @Override protected void attribute(final byte[] n, final byte[] v) throws IOException { } @Override protected void finishComment(final byte[] n) throws IOException { } @Override protected void finishPi(final byte[] n, final byte[] v) throws IOException { } @Override protected void startOpen(final byte[] t) throws IOException { } @Override protected void finishOpen() throws IOException { } @Override protected void finishEmpty() throws IOException { } @Override protected void finishClose() throws IOException { } @Override protected void code(final int ch) throws IOException { printChar(ch); } } basex-7.7.2/basex-core/src/main/java/org/basex/io/serial/XHTMLSerializer.java000066400000000000000000000034061222453003200266610ustar00rootroot00000000000000package org.basex.io.serial; import static org.basex.data.DataText.*; import static org.basex.util.Token.*; import java.io.*; /** * This class serializes data as XHTML. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class XHTMLSerializer extends OutputSerializer { /** * Constructor, specifying serialization options. * @param os output stream reference * @param p serialization properties * @throws IOException I/O exception */ XHTMLSerializer(final OutputStream os, final SerializerProp p) throws IOException { super(os, p, V10, V11); } @Override protected void attribute(final byte[] n, final byte[] v) throws IOException { // escape URI attributes final byte[] tagatt = concat(lc(elem), COLON, lc(n)); final byte[] val = escape && HTMLSerializer.URIS.contains(tagatt) ? escape(v) : v; super.attribute(n, val); } @Override protected void startOpen(final byte[] t) throws IOException { super.startOpen(t); if(content && eq(lc(elem), HEAD)) ct++; } @Override protected void finishOpen() throws IOException { super.finishOpen(); ct(false, false); } @Override protected void finishEmpty() throws IOException { if(ct(true, false)) return; if((html5 ? HTMLSerializer.EMPTIES5 : HTMLSerializer.EMPTIES).contains(lc(elem))) { print(' '); print(ELEM_SC); } else { print(ELEM_C); sep = false; finishClose(); } } @Override protected boolean doctype(final byte[] dt) throws IOException { if(level != 0) return false; if(!super.doctype(dt) && html5) { if(sep) indent(); print(DOCTYPE); if(dt == null) print(M_HTML); else print(dt); print(ELEM_C); print(nl); } return true; } } basex-7.7.2/basex-core/src/main/java/org/basex/io/serial/XMLSerializer.java000066400000000000000000000026501222453003200264250ustar00rootroot00000000000000package org.basex.io.serial; import static org.basex.data.DataText.*; import static org.basex.query.util.Err.*; import java.io.*; import org.basex.query.value.item.*; /** * This class serializes data as XML. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class XMLSerializer extends OutputSerializer { /** Root elements. */ private boolean root; /** * Constructor, specifying serialization options. * @param os output stream reference * @param p serialization properties * @throws IOException I/O exception */ XMLSerializer(final OutputStream os, final SerializerProp p) throws IOException { super(os, p, V10, V11); } @Override protected void startOpen(final byte[] t) throws IOException { if(tags.isEmpty()) { if(root) check(); root = true; } super.startOpen(t); } @Override protected void finishText(final byte[] v) throws IOException { if(tags.isEmpty()) check(); super.finishText(v); } @Override protected void atomic(final Item i) throws IOException { if(tags.isEmpty()) check(); super.atomic(i); } /** * Checks if document serialization is valid. * @throws SerializerException serializer exception */ private void check() throws SerializerException { if(!saomit) SERSA.thrwSerial(); if(docsys != null) SERDT.thrwSerial(); } } basex-7.7.2/basex-core/src/main/java/org/basex/package.html000066400000000000000000000001411222453003200234540ustar00rootroot00000000000000 Main package of the project, containing all starter classes with main methods. basex-7.7.2/basex-core/src/main/java/org/basex/query/000077500000000000000000000000001222453003200223445ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/LibraryModule.java000066400000000000000000000014631222453003200257650ustar00rootroot00000000000000package org.basex.query; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; /** * An XQuery main module. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public class LibraryModule extends StaticScope { /** Library name. */ public final QNm name; /** * Constructor. * @param nm of library * @param xqdoc documentation */ public LibraryModule(final QNm nm, final String xqdoc) { super(null, xqdoc, null); name = nm; } @Override public boolean visit(final ASTVisitor visitor) { return true; } @Override public void compile(final QueryContext ctx) throws QueryException { } @Override public String toString() { return ""; } @Override public void plan(final FElem e) { } } basex-7.7.2/basex-core/src/main/java/org/basex/query/MainModule.java000066400000000000000000000122041222453003200252400ustar00rootroot00000000000000package org.basex.query; import java.util.*; import org.basex.core.*; import org.basex.query.expr.*; import org.basex.query.func.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.list.*; /** * An XQuery main module. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public class MainModule extends StaticScope { /** Declared type, {@code null} if not specified. */ public final SeqType declType; /** * Constructor. * @param rt root expression * @param scp variable scope * @param xqdoc documentation */ public MainModule(final Expr rt, final VarScope scp, final String xqdoc) { this(rt, scp, null, xqdoc, null); } /** * Constructor. * @param rt root expression * @param scp variable scope * @param xqdoc documentation * @param type optional type * @param ii input info */ public MainModule(final Expr rt, final VarScope scp, final SeqType type, final String xqdoc, final InputInfo ii) { super(scp, xqdoc, ii); expr = rt; declType = type; } @Override public void compile(final QueryContext ctx) throws QueryException { if(compiled) return; try { compiled = true; scope.enter(ctx); expr = expr.compile(ctx, scope); scope.cleanUp(this); } finally { scope.exit(ctx, 0); } } /** * Evaluates this module and returns the result as a value. * @param ctx query context * @return result * @throws QueryException evaluation exception */ public Value value(final QueryContext ctx) throws QueryException { try { scope.enter(ctx); final Value v = ctx.value(expr); return declType != null ? declType.treat(v, info) : v; } finally { scope.exit(ctx, 0); } } /** * Creates a result iterator which lazily evaluates this module. * @param ctx query context * @return result iterator * @throws QueryException query exception */ public Iter iter(final QueryContext ctx) throws QueryException { if(declType != null) return value(ctx).iter(); scope.enter(ctx); final Iter iter = expr.iter(ctx); return new Iter() { @Override public Item next() throws QueryException { final Item it = iter.next(); if(it == null) scope.exit(ctx, 0); return it; } @Override public long size() { return iter.size(); } @Override public Item get(final long i) throws QueryException { return iter.get(i); } @Override public boolean reset() { return iter.reset(); } }; } @Override public String toString() { return expr.toString(); } @Override public void plan(final FElem e) { expr.plan(e); } @Override public boolean visit(final ASTVisitor visitor) { return expr.accept(visitor); } /** * Adds the names of the databases that may be touched by the module. * @param lr lock result * @param ctx query context * @return result of check * @see Proc#databases(LockResult) */ public boolean databases(final LockResult lr, final QueryContext ctx) { return expr.accept(new LockVisitor(lr, ctx)); } /** * Lock visitor. * @author Leo Woerteler */ static class LockVisitor extends ASTVisitor { /** Already visited scopes. */ private final IdentityHashMap funcs = new IdentityHashMap(); /** List of databases to be locked. */ private final StringList sl; /** Focus level. */ private int level; /** * Constructor. * @param lr lock result * @param ctx query context */ LockVisitor(final LockResult lr, final QueryContext ctx) { sl = ctx.updating ? lr.write : lr.read; level = ctx.ctxItem == null ? 0 : 1; } @Override public boolean lock(final String db) { if(db == null) return false; if(level == 0 || db != DBLocking.CTX) sl.add(db); return true; } @Override public void enterFocus() { level++; } @Override public void exitFocus() { level--; } @Override public boolean staticVar(final StaticVar var) { if(funcs.containsKey(var)) return true; funcs.put(var, null); return var.visit(this); } @Override public boolean funcCall(final StaticFuncCall call) { return func(call.func()); } @Override public boolean inlineFunc(final Scope sub) { enterFocus(); final boolean ac = sub.visit(this); exitFocus(); return ac; } @Override public boolean funcItem(final FuncItem func) { return func(func); } /** * Visits a scope. * @param scp scope * @return if more expressions should be visited */ private boolean func(final Scope scp) { if(funcs.containsKey(scp)) return true; funcs.put(scp, null); enterFocus(); final boolean ac = scp.visit(this); exitFocus(); return ac; } }; } basex-7.7.2/basex-core/src/main/java/org/basex/query/QueryCompiler.java000066400000000000000000000147761222453003200260260ustar00rootroot00000000000000package org.basex.query; import java.util.*; import org.basex.query.func.*; import org.basex.query.util.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.list.*; /** * This class compiles all components of the query that are needed in an order that * maximizes the amount of inlining possible. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class QueryCompiler { /** Number of scopes from which on linear search is replaced by a hash map. */ private static final int MAP_THRESHOLD = 16; /** Query context. */ private final QueryContext ctx; /** Result list. */ private final ArrayList result = new ArrayList(); /** Node stack. */ private final IntList stack = new IntList(); /** Index and lowlink list. */ private final IntList list = new IntList(); /** Counter for the next free index. */ private int next; /** Adjacency list. */ final ArrayList adjacent = new ArrayList(); /** Declaration list. */ final ArrayList scopes = new ArrayList(); /** Declaration list. */ private IdentityHashMap ids; /** * Constructor. * @param cx query context * @param root root expression */ private QueryCompiler(final QueryContext cx, final Scope root) { ctx = cx; add(root); } /** * Compiles all necessary parts of this query. * @param ctx query context * @param root root expression * @throws QueryException compilation errors */ public static void compile(final QueryContext ctx, final MainModule root) throws QueryException { if(!root.compiled()) new QueryCompiler(ctx, root).compile(); } /** * Compiles all necessary parts of this query. * @throws QueryException compilation errors */ private void compile() throws QueryException { // compile the used scopes only for(final Scope[] comp : components(0)) circCheck(comp).compile(ctx); // check for circular variable declarations without compiling the unused scopes for(final StaticVar v : ctx.vars) if(id(v) == -1) for(final Scope[] comp : components(add(v))) circCheck(comp); } /** * Checks if the given component contains a static variable that depends on itself. * @param comp component to check * @return scope to be compiled, the others are compiled recursively * @throws QueryException query exception */ private Scope circCheck(final Scope[] comp) throws QueryException { if(comp.length > 1) for(final Scope scp : comp) if(scp instanceof StaticVar) throw Err.circVar(ctx, (StaticVar) scp); return comp[0]; } /** * Returns the strongly connected components of the dependency graph. * @param p ID of the starting point * @return the components * @throws QueryException if a variable directly calls itself */ private Iterable components(final int p) throws QueryException { result.clear(); tarjan(p); return result; } /** * Algorithm of Tarjan for computing the strongly connected components of a graph. * @param v current node * @throws QueryException if a variable directly calls itself */ private void tarjan(final int v) throws QueryException { final int ixv = 2 * v, llv = ixv + 1, idx = next++; while(list.size() <= llv) list.add(-1); list.set(ixv, idx); list.set(llv, idx); stack.push(v); for(final int w : adjacentTo(v)) { final int ixw = 2 * w, llw = ixw + 1; if(list.size() <= ixw || list.get(ixw) < 0) { // Successor w has not yet been visited; recurse on it tarjan(w); list.set(llv, Math.min(list.get(llv), list.get(llw))); } else if(stack.contains(w)) { // Successor w is in stack S and hence in the current SCC list.set(llv, Math.min(list.get(llv), list.get(ixw))); } } // If v is a root node, pop the stack and generate an SCC if(list.get(llv) == list.get(ixv)) { int w; Scope[] out = null; do { w = stack.pop(); final Scope scp = scopes.get(w); out = out == null ? new Scope[] { scp } : Array.add(out, scp); } while(w != v); result.add(out); } } /** * Gets the ID of the given scope. * @param scp scope * @return id if existing, {@code null} otherwise */ int id(final Scope scp) { if(ids != null) { final Integer id = ids.get(scp); return id == null ? -1 : id; } for(int i = 0; i < scopes.size(); i++) if(scopes.get(i) == scp) return i; return -1; } /** * Adds a new scope and returns its ID. * @param scp scope to add * @return the scope's ID */ int add(final Scope scp) { final int id = scopes.size(); if(id == MAP_THRESHOLD) { ids = new IdentityHashMap(); for(final Scope s : scopes) ids.put(s, ids.size()); } scopes.add(scp); adjacent.add(null); if(ids != null) ids.put(scp, id); return id; } /** * Returns the indices of all scopes called by the given one. * @param node source node index * @return destination node indices * @throws QueryException if a variable directly calls itself */ private int[] adjacentTo(final int node) throws QueryException { int[] adj = adjacent.get(node); if(adj == null) { adj = neighbors(scopes.get(node)); adjacent.set(node, adj); } return adj; } /** * Fills in all used scopes of the given one. * @param curr current scope * @return IDs of all directly reachable scopes * @throws QueryException if a variable directly calls itself */ private int[] neighbors(final Scope curr) throws QueryException { final IntList adj = new IntList(); final boolean ok = curr.visit(new ASTVisitor() { @Override public boolean staticVar(final StaticVar var) { return var != curr && neighbor(var); } @Override public boolean funcCall(final StaticFuncCall call) { return neighbor(call.func()); } @Override public boolean inlineFunc(final Scope sub) { return sub.visit(this); } /** * Adds a neighbor of the currently inspected scope. * @param scp the neighbor * @return {@code true} for convenience */ private boolean neighbor(final Scope scp) { final int old = id(scp), id = old == -1 ? add(scp) : old; if(old == -1 || !adj.contains(id)) adj.add(id); return true; } }); if(!ok) throw Err.VARUNDEF.thrw(((StaticVar) curr).info, curr); return adj.toArray(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/QueryContext.java000066400000000000000000000505351222453003200256710ustar00rootroot00000000000000package org.basex.query; import static org.basex.core.Text.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.util.*; import java.util.Map.Entry; import java.util.regex.*; import org.basex.core.*; import org.basex.core.Context; import org.basex.data.*; import org.basex.io.*; import org.basex.io.serial.*; import org.basex.query.expr.*; import org.basex.query.expr.Expr.Flag; import org.basex.query.func.*; import org.basex.query.iter.*; import org.basex.query.up.*; import org.basex.query.util.*; import org.basex.query.util.json.*; import org.basex.query.util.json.JsonParser.Spec; import org.basex.query.util.pkg.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.ft.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * This class organizes both static and dynamic properties that are specific to a * single query. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class QueryContext extends Proc { /** URL pattern (matching Clark and EQName notation). */ private static final Pattern BIND = Pattern.compile("^((\"|')(.*?)\\2:|(\\{(.*?)\\}))(.+)$"); /** Static context of an expression. */ public StaticContext sc; /** Static variables. */ public final Variables vars = new Variables(); /** Functions. */ public final StaticFuncs funcs = new StaticFuncs(); /** Externally bound variables. */ public final HashMap bindings = new HashMap(); /** Query resources. */ public final QueryResources resource = new QueryResources(this); /** Database context. */ public final Context context; /** HTTP context. */ public Object http; /** Cached stop word files. */ public HashMap stop; /** Cached thesaurus files. */ public HashMap thes; /** Local options (key/value pairs), set by option declarations. */ public final StringList dbOptions = new StringList(); /** Global options (will be set after query execution). */ public final HashMap globalOpt = new HashMap(); /** Current context value. */ public Value value; /** Current context position. */ public long pos = 1; /** Current context size. */ public long size = 1; /** Optional initial context set. */ Nodes nodes; /** Available collations. */ public TokenObjMap collations; /** Current full-text token. */ public FTLexer fttoken; /** Current full-text options. */ private FTOpt ftOpt; /** Full-text position data (needed for highlighting of full-text results). */ public FTPosData ftpos; /** Full-text token counter (needed for highlighting of full-text results). */ public byte ftoknum; /** Current Date. */ public Item date; /** Current DateTime. */ public Item dtm; /** Current Time. */ public Item time; /** Current timezone. */ public Item zone; /** Strings to lock defined by lock:read option. */ public StringList readLocks = new StringList(0); /** Strings to lock defined by lock:write option. */ public StringList writeLocks = new StringList(0); /** Pending updates. */ public Updates updates; /** Pending output. */ public final ValueBuilder output = new ValueBuilder(); /** Compilation flag: current node has leaves. */ public boolean leaf; /** Number of successive tail calls. */ public int tailCalls; /** Maximum number of successive tail calls. */ public final int maxCalls; /** Counter for variable IDs. */ public int varIDs; /** Pre-declared modules, containing module uri and their file paths. */ final TokenMap modDeclared = new TokenMap(); /** Parsed modules, containing the file path and module uri. */ final TokenMap modParsed = new TokenMap(); /** Stack of module files that are currently parsed. */ final TokenList modStack = new TokenList(); /** Serializer options. */ SerializerProp serProp; /** Initial context value. */ public MainModule ctxItem; /** Module loader. */ public final ModuleLoader modules; /** Opened connections to relational databases. */ JDBCConnections jdbc; /** Opened connections to relational databases. */ ClientSessions sessions; /** Root expression of the query. */ MainModule root; /** Original query. */ String query; /** String container for verbose query info. */ private final TokenBuilder info = new TokenBuilder(); /** Indicates if verbose query info was requested. */ private final boolean inf; /** Indicates if some compilation info has been output. */ private boolean compInfo; /** Indicates if some evaluation info has been output. */ private boolean evalInfo; /** Indicates if the query context has been closed. */ private boolean closed; /** The evaluation stack. */ public final QueryStack stack = new QueryStack(); /** * Constructor. * @param ctx database context */ public QueryContext(final Context ctx) { context = ctx; nodes = ctx.current(); inf = ctx.prop.is(Prop.QUERYINFO) || Prop.debug; sc = new StaticContext(ctx.prop.is(Prop.XQUERY3)); maxCalls = ctx.prop.num(Prop.TAILCALLS); modules = new ModuleLoader(ctx); } /** * Parses the specified query. * @param qu input query * @param path file path (may be {@code null}) * @return main module * @throws QueryException query exception */ public MainModule parseMain(final String qu, final String path) throws QueryException { query = qu; root = new QueryParser(qu, path, this).parseMain(); return root; } /** * Parses the specified module. * @param qu input query * @param path file path (may be {@code null}) * @return name of module * @throws QueryException query exception */ public LibraryModule parseLibrary(final String qu, final String path) throws QueryException { query = qu; return new QueryParser(qu, path, this).parseLibrary(true); } /** * Sets the main module (root expression). * @param rt main module */ public void mainModule(final MainModule rt) { root = rt; updating = rt.expr.has(Flag.UPD); } /** * Compiles and optimizes the expression. * @throws QueryException query exception */ public void compile() throws QueryException { // set database options final StringList o = dbOptions; for(int s = 0; s < o.size(); s += 2) { try { context.prop.set(o.get(s).toUpperCase(Locale.ENGLISH), o.get(s + 1)); } catch(final Exception ex) { BASX_VALUE.thrw(null, o.get(s), o.get(s + 1)); } } // bind external variables vars.bindExternal(this, bindings); if(ctxItem != null) { // evaluate initial expression try { ctxItem.compile(this); value = ctxItem.value(this); } catch(final QueryException ex) { if(ex.err() != NOCTX) throw ex; // only {@link ParseExpr} instances may cause this error CIRCCTX.thrw(ctxItem.info); } } else if(nodes != null) { // add full-text container reference if(nodes.ftpos != null) ftpos = new FTPosData(); // cache the initial context nodes resource.compile(nodes); } // if specified, convert context item to specified type // [LW] should not be necessary if(value != null && sc.initType != null) { value = sc.initType.funcConvert(this, null, value); } // dynamic compilation analyze(); // dump resulting query if(inf) { info.add(NL).add(QUERY).add(COL).add(NL).add( QueryProcessor.removeComments(query, Integer.MAX_VALUE)).add(NL); if(compInfo) info.add(NL + OPTIMIZED_QUERY + COL + NL + funcs + root + NL); } } /** * Compiles all used functions and the root expression. * @throws QueryException query exception */ public void analyze() throws QueryException { try { // compile the expression if(root != null) QueryCompiler.compile(this, root); // compile global functions. else funcs.compile(this); } catch(final StackOverflowError ex) { Util.debug(ex); BASX_STACKOVERFLOW.thrw(null, ex); } } /** * Returns a result iterator. * @return result iterator * @throws QueryException query exception */ public Iter iter() throws QueryException { try { // evaluate lazily if query will perform no updates return updating ? value().iter() : root.iter(this); } catch(final StackOverflowError ex) { Util.debug(ex); throw BASX_STACKOVERFLOW.thrw(null); } } /** * Returns the result value. * @return result value * @throws QueryException query exception */ public Value value() throws QueryException { try { final Value v = root.value(this); final Value u = update(); return u != null ? u : v; } catch(final StackOverflowError ex) { Util.debug(ex); throw BASX_STACKOVERFLOW.thrw(null); } } /** * Performs updates. * @return resulting value * @throws QueryException query exception */ public Value update() throws QueryException { if(updating) { //context.downgrade(this, updates.databases()); updates.apply(); if(updates.size() != 0 && context.data() != null) context.update(); if(output.size() != 0) return output.value(); } return null; } /** * Evaluates the specified expression and returns an iterator. * @param e expression to be evaluated * @return iterator * @throws QueryException query exception */ public Iter iter(final Expr e) throws QueryException { checkStop(); return e.iter(this); } /** * Evaluates the specified expression and returns an iterator. * @param expr expression to be evaluated * @return iterator * @throws QueryException query exception */ public Value value(final Expr expr) throws QueryException { checkStop(); return expr.value(this); } /** * Returns the current data reference of the context value, or {@code null}. * @return data reference */ public Data data() { return value != null ? value.data() : null; } @Override public void databases(final LockResult lr) { lr.read.add(readLocks); lr.write.add(writeLocks); if(root == null || !root.databases(lr, this)) { if(updating) lr.writeAll = true; else lr.readAll = true; } } /** * Binds a value to the context item, using the same rules as for * {@link #bind binding variables}. * @param val value to be bound * @param type data type (may be {@code null}) * @throws QueryException query exception */ public void context(final Object val, final String type) throws QueryException { // bind http context to extra variable if(val.getClass().getName().equals("org.basex.http.HTTPContext")) { http = val; } else { ctxItem = new MainModule(cast(val, type), new VarScope(), null); } } /** * Binds a value to a global variable. The specified type is interpreted as follows: *
    *
  • If {@code "json"} is specified, the value is converted according to the rules * specified in {@link JsonMapConverter}.
  • *
  • If {@code "xml"} is specified, the value is converted to a document node.
  • *
  • Otherwise, the type is interpreted as atomic XDM data type.
  • *
* If the value is an XQuery value {@link Value}, it is directly assigned. * Otherwise, it is cast to the XQuery data model, using a Java/XQuery mapping. * @param name name of variable * @param val value to be bound * @param type data type (may be {@code null}) * @throws QueryException query exception */ public void bind(final String name, final Object val, final String type) throws QueryException { bind(name, cast(val, type)); } /** * Adds some compilation info. * @param string evaluation info * @param ext text text extensions */ public void compInfo(final String string, final Object... ext) { if(!inf) return; if(!compInfo) { info.add(NL).add(COMPILING).add(COL).add(NL); compInfo = true; } info.add(LI).addExt(string, ext).add(NL); } /** * Adds some evaluation info. * @param string evaluation info */ public void evalInfo(final String string) { if(!inf) return; if(!evalInfo) { info.add(NL).add(EVALUATING).add(COL).add(NL); evalInfo = true; } info.add(LI).add(string.replaceAll("\r?\n\\s*", " ")).add(NL); } /** * Returns info on query compilation and evaluation. * @return query info */ public String info() { return info.toString(); } /** * Returns JDBC connections. * @return jdbc connections */ public JDBCConnections jdbc() { if(jdbc == null) jdbc = new JDBCConnections(); return jdbc; } /** * Returns client sessions. * @return client session */ public ClientSessions sessions() { if(sessions == null) sessions = new ClientSessions(); return sessions; } /** * Returns the serialization parameters used for and specified by this query. * @param optional if {@code true}, a {@code null} reference is returned if no * parameters have been specified * @return serialization parameters */ public SerializerProp serParams(final boolean optional) { // if available, return parameters specified by the query if(serProp != null) return serProp; // retrieve global parameters final String serial = context.prop.get(Prop.SERIALIZER); if(optional && serial.isEmpty()) return null; // otherwise, if requested, return default parameters return new SerializerProp(serial); } /** * Returns the current full-text options. Creates a new instance if called first. * @return full-text options */ public FTOpt ftOpt() { if(ftOpt == null) ftOpt = new FTOpt(); return ftOpt; } /** * Sets full-text options. * @param opt full-text options */ public void ftOpt(final FTOpt opt) { ftOpt = opt; } /** * Sets the updating flag. * @param up updating flag */ public void updating(final boolean up) { if(updates == null) updates = new Updates(); updating = up; } /** * Closes the query context. */ public void close() { // close only once if(closed) return; closed = true; // reset database properties to initial value for(final Entry e : globalOpt.entrySet()) { context.prop.setObject(e.getKey(), e.getValue()); } // close database connections resource.close(); // close JDBC connections if(jdbc != null) jdbc.close(); // close client sessions if(sessions != null) sessions.close(); // close dynamically loaded JAR files modules.close(); } @Override public String tit() { return SAVE; } @Override public String det() { return PLEASE_WAIT_D; } @Override public double prog() { return 0; } // CLASS METHODS ====================================================================== /** * Evaluates the expression with the specified context set. * @return resulting value * @throws QueryException query exception */ Result execute() throws QueryException { // limit number of hits to be returned and displayed int max = context.prop.num(Prop.MAXHITS); if(max < 0) max = Integer.MAX_VALUE; // evaluates the query final Iter ir = iter(); final ValueBuilder vb = new ValueBuilder(); Item it; // check if all results belong to the database of the input context if(serProp == null && nodes != null) { final IntList pre = new IntList(); while((it = ir.next()) != null) { checkStop(); if(it.data() != nodes.data) break; if(pre.size() < max) pre.add(((DBNode) it).pre); } final int ps = pre.size(); if(it == null || ps == max) { // all nodes have been processed: return GUI-friendly nodeset return ps == 0 ? vb : new Nodes(pre.toArray(), nodes.data, ftpos); } // otherwise, add nodes to standard iterator for(int p = 0; p < ps; ++p) vb.add(new DBNode(nodes.data, pre.get(p))); vb.add(it); } // use standard iterator while((it = ir.next()) != null) { checkStop(); if(vb.size() < max) vb.add(it.materialize(null)); } return vb; } /** * Recursively builds a query plan. * @param doc root node */ void plan(final FDoc doc) { // only show root node if functions or variables exist final FElem e = new FElem(QueryText.PLAN); funcs.plan(e); vars.plan(e); root.plan(e); doc.add(e); } // PRIVATE METHODS ==================================================================== /** * Binds an expression to a global variable. * @param name name of variable * @param e value to be bound */ private void bind(final String name, final Expr e) { // remove optional $ prefix String nm = name.indexOf('$') == 0 ? name.substring(1) : name; byte[] uri = EMPTY; // check for namespace declaration final Matcher m = BIND.matcher(nm); if(m.find()) { String u = m.group(3); if(u == null) u = m.group(5); uri = token(u); nm = m.group(6); } final byte[] ln = token(nm); // [LW] better throw an error if(nm.isEmpty() || !XMLToken.isNCName(ln)) return; // bind variable bindings.put(uri.length == 0 ? new QNm(ln, this) : new QNm(ln, uri), e); } /** * Casts a value to the specified type. * See {@link #bind(String, Object, String)} for more infos. * @param val value to be cast * @param type data type (may be {@code null}) * @return cast value * @throws QueryException query exception */ private Expr cast(final Object val, final String type) throws QueryException { // return original value if(type == null || type.isEmpty()) { return val instanceof Expr ? (Expr) val : JavaMapping.toValue(val, this); } // convert to json if(type.equalsIgnoreCase(QueryText.JSONSTR)) { return new JsonMapConverter(Spec.ECMA_262, true, null).convert(val.toString()); } // convert to the specified type final QNm nm = new QNm(token(type.replaceAll("\\(.*?\\)$", "")), this); if(!nm.hasURI() && nm.hasPrefix()) NOURI.thrw(null, nm.string()); Type t = null; if(type.endsWith(")")) { t = NodeType.find(nm); } else { t = ListType.find(nm); if(t == null) t = AtomType.find(nm, false); } if(t == null) NOTYPE.thrw(null, type); return t.cast(val, this, null); } /** * Gets the value currently bound to the given variable. * @param var variable * @return bound value */ public Value get(final Var var) { return stack.get(var); } /** * Binds an expression to a local variable. * @param vr variable * @param vl expression to be bound * @param ii input info * @throws QueryException exception */ public void set(final Var vr, final Value vl, final InputInfo ii) throws QueryException { stack.set(vr, vl, this, ii); } /** * Initializes the static date and time context of a query if not done yet. * @return self reference * @throws QueryException query exception */ public QueryContext initDateTime() throws QueryException { if(time == null) { final Date d = Calendar.getInstance().getTime(); final String zon = DateTime.format(d, DateTime.ZONE); final String ymd = DateTime.format(d, DateTime.DATE); final String hms = DateTime.format(d, DateTime.TIME); final String zn = zon.substring(0, 3) + ':' + zon.substring(3); time = new Tim(Token.token(hms + zn), null); date = new Dat(Token.token(ymd + zn), null); dtm = new Dtm(Token.token(ymd + 'T' + hms + zn), null); zone = new DTDur(toInt(zon.substring(0, 3)), toInt(zon.substring(3))); } return this; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/QueryException.java000066400000000000000000000135631222453003200262030ustar00rootroot00000000000000package org.basex.query; import static org.basex.core.Text.*; import java.util.*; import org.basex.core.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.seq.*; import org.basex.util.*; import org.basex.util.list.*; /** * This class indicates exceptions during the parsing or evaluation of a query. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class QueryException extends Exception { /** Stack. */ private final ArrayList stack = new ArrayList(); /** Error QName. */ private final QNm name; /** Error value. */ private transient Value value = Empty.SEQ; /** Error reference. */ private Err err; /** Code suggestions. */ private StringList suggest; /** Error line and column. */ private InputInfo info; /** Marked error column. */ private int markedCol; /** Marks if this exception is catchable by a {@code try/catch} expression. */ private boolean catchable = true; /** * Constructor, specifying an exception or error. {@link Err#BASX_GENERIC} will be set * as error code. * @param th exception or error */ public QueryException(final Throwable th) { this(Util.message(th)); } /** * Constructor, specifying a simple error message. {@link Err#BASX_GENERIC} will be set * as error code. * @param msg error message */ public QueryException(final String msg) { this(null, Err.BASX_GENERIC, msg); } /** * Default constructor. * @param ii input info * @param er error reference * @param ext error extension */ public QueryException(final InputInfo ii, final Err er, final Object... ext) { this(ii, er.qname(), er.desc, ext); err = er; } /** * Constructor, specifying the error code and message as string. * @param ii input info * @param errc error code * @param msg error message * @param ext error extension */ public QueryException(final InputInfo ii, final QNm errc, final String msg, final Object... ext) { super(BaseXException.message(msg, ext)); name = errc; if(ii != null) info(ii); for(final Object o : ext) { if(o instanceof Throwable) { initCause((Throwable) o); break; } } } /** * Returns the error column. * @return error column */ public int col() { return info == null ? 0 : info.lineCol()[1]; } /** * Returns the marked error column. * @return marked error column */ public int markedCol() { return markedCol; } /** * Returns the error line. * @return error line */ public int line() { return info == null ? 0 : info.lineCol()[0]; } /** * Returns the file. * @return error line */ public String file() { return info == null ? null : info.file(); } /** * Returns suggestions for code suggestions. * @return suggestions */ public StringList suggest() { return suggest == null ? new StringList() : suggest; } /** * Sets code suggestions. * @param qp query parser * @param sug code suggestions * @return self reference */ public QueryException suggest(final InputParser qp, final StringList sug) { suggest = sug; pos(qp); return this; } /** * Adds an input info to the stack. * @param ii input info */ public void add(final InputInfo ii) { if(ii != null) stack.add(ii); } /** * Sets input info. * @param ii input info * @return self reference */ public QueryException info(final InputInfo ii) { info = ii; return this; } /** * Returns the input info. * @return input info */ public InputInfo info() { return info; } /** * Sets the error value. * @param v error value * @return self reference */ public QueryException value(final Value v) { value = v; return this; } /** * Sets an error. * @param e error * @return self reference */ public QueryException err(final Err e) { err = e; return this; } /** * Finds line and column for the specified query parser. * @param parser parser */ void pos(final InputParser parser) { markedCol = parser.mark; if(info != null) return; // check if line/column information has already been added parser.pos = Math.min(parser.mark, parser.length); info = new InputInfo(parser); } /** * Returns the error name. * @return error name */ public QNm qname() { return name; } /** * Returns the error. * @return error */ public Err err() { return err; } /** * Returns the error value. * @return error value */ public Value value() { return value; } @Override public String getLocalizedMessage() { return super.getMessage(); } @Override public String getMessage() { final TokenBuilder tb = new TokenBuilder(); if(info != null) tb.add(STOPPED_AT).add(info.toString()).add(COL).add(NL); final byte[] code = name.local(); if(code.length != 0) tb.add('[').add(code).add("] "); tb.add(getLocalizedMessage()); if(!stack.isEmpty()) { tb.add(NL).add(NL).add(STACK_TRACE_C); for(final InputInfo ii : stack) tb.add(NL).add(LI).add(ii.toString()); } return tb.toString(); } /** * Checks if this exception can be caught by a {@code try/catch} expression. * @return result of check */ public boolean isCatchable() { return catchable; } /** * Makes this exception uncatchable by a {@code try/catch} expression. * @return self reference for convenience */ public QueryException notCatchable() { catchable = false; return this; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/QueryInfo.java000066400000000000000000000047531222453003200251410ustar00rootroot00000000000000package org.basex.query; import static org.basex.core.Text.*; import java.util.*; import org.basex.io.*; import org.basex.io.out.*; import org.basex.util.*; import org.basex.util.list.*; /** * This class remembers descriptive query information sent back to the client. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class QueryInfo { /** Read locked databases. */ public StringList readLocked; /** Write locked databases. */ public StringList writeLocked; /** Parsing time. */ public long pars; /** Compilation time. */ public long cmpl; /** Evaluation time. */ public long evlt; /** Serialization time. */ public long srlz; /** Number of runs. */ public int runs = 1; /** * Returns detailed query information. * @param qp query processor * @param out output stream * @param hits number of returned hits * @param detailed return detailed query info * @return query string */ public String toString(final QueryProcessor qp, final PrintOutput out, final long hits, final boolean detailed) { final TokenBuilder tb = new TokenBuilder(); final long total = pars + cmpl + evlt + srlz; if(detailed) { final int up = qp.updates(); tb.add(qp.info()).add(NL); tb.add(PARSING_CC).add(Performance.getTime(pars, runs)).add(NL); tb.add(COMPILING_CC).add(Performance.getTime(cmpl, runs)).add(NL); tb.add(EVALUATING_CC).add(Performance.getTime(evlt, runs)).add(NL); tb.add(PRINTING_CC).add(Performance.getTime(srlz, runs)).add(NL); tb.add(TOTAL_TIME_CC).add(Performance.getTime(total, runs)).add(NL).add(NL); tb.add(HITS_X_CC + hits).add(' ').add(hits == 1 ? ITEM : ITEMS).add(NL); tb.add(UPDATED_CC + up).add(' ').add(up == 1 ? ITEM : ITEMS).add(NL); tb.add(PRINTED_CC).add(Performance.format(out.size())).add(NL); tb.add(READ_LOCKING_CC); if(readLocked == null) tb.add("global"); else if(readLocked.isEmpty()) tb.add("none"); else tb.add("local ").add(Arrays.toString(readLocked.toArray())); tb.add(NL).add(WRITE_LOCKING_CC); if(writeLocked == null) tb.add("global"); else if(writeLocked.isEmpty()) tb.add("none"); else tb.add("local ").add(Arrays.toString(writeLocked.toArray())); tb.add(NL); } final IO io = qp.ctx.sc.baseIO(); final String name = io == null ? "" : " \"" + io.name() + "\""; tb.addExt(NL + QUERY_EXECUTED_X_X, name, Performance.getTime(total, runs)); return tb.toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/QueryModule.java000066400000000000000000000074721222453003200254740ustar00rootroot00000000000000package org.basex.query; import java.lang.annotation.*; /** *

The XQuery {@code import module} statement can be used to import XQuery modules * as well as Java instances, which will be treated as modules. Any class with a public, * empty constructor can be imported as module.

* *

If a class extends the {@link QueryModule} class, it inherits the {@link #context} * variable, which provides access to all properties of the current query. E.g., it * provides access to the current {@link QueryContext#value context item} or the * {@link QueryContext#sc static context} of a query. Next, the following default * properties of functions can be changed via annotations:

*
    *
  • Java functions can only be executed by users with {@code ADMIN} permissions. * You may annotate a function with {@link Requires}({@link Permission}) to * also make it accessible to users with less privileges.
  • *
  • Java code is treated as "non-deterministic", as its behavior cannot * be predicted by the XQuery processor. You may annotate a function as * {@link Deterministic} if you know that it will have no side-effects and will * always yield the same result.
  • *
  • Java code is treated as "context-independent". If a function accesses * the specified {@link #context}, it should be annotated as * {@link ContextDependent}.
  • *
  • Java code is treated as "focus-independent". If a function accesses * the current context item, position or size, it should be annotated as * {@link FocusDependent}.
  • *
* *

Please visit our documentation to find more details on * Packaging, * Java Bindings and * User Management. * The XQuery 3.0 specification gives more insight into * function * properties.

* * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class QueryModule { /** * Permission required to call a function. */ public enum Permission { /** Admin permissions. */ ADMIN, /** Create permissions. */ CREATE, /** Write permissions. */ WRITE, /** Read permissions. */ READ, /** No permissions. */ NONE } /** * Java functions can only be executed by users with {@code ADMIN} permissions. * You may annotate a function with {@link Requires}({@link Permission}) to * also make it accessible to other users with less permissions. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface Requires { /** * Permission. * @return value */ Permission value(); } /** * Java code is treated as "non-deterministic", as its behavior cannot be predicted from * the XQuery processor. You may annotate a function as {@link Deterministic} if you * know that it will have no side-effects and will always yield the same result. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface Deterministic { } /** * Java code is treated as "context-independent". If a function accesses the specified * {@link #context}, it should be annotated as {@link ContextDependent}. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface ContextDependent { } /** * Java code is treated as "focus-independent". If a function accesses the current * context item, position or size, it should be annotated as {@link FocusDependent}. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) public @interface FocusDependent { } /** Query context. */ public QueryContext context; } basex-7.7.2/basex-core/src/main/java/org/basex/query/QueryParser.java000066400000000000000000003540151222453003200255010ustar00rootroot00000000000000package org.basex.query; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import static org.basex.util.ft.FTFlag.*; import java.io.*; import java.util.*; import org.basex.core.*; import org.basex.io.*; import org.basex.io.serial.*; import org.basex.query.expr.*; import org.basex.query.expr.CmpG.OpG; import org.basex.query.expr.CmpN.OpN; import org.basex.query.expr.CmpV.OpV; import org.basex.query.expr.Expr.Flag; import org.basex.query.expr.Context; import org.basex.query.expr.List; import org.basex.query.ft.*; import org.basex.query.func.*; import org.basex.query.gflwor.*; import org.basex.query.gflwor.GFLWOR.Clause; import org.basex.query.gflwor.Window.Condition; import org.basex.query.iter.*; import org.basex.query.path.*; import org.basex.query.up.expr.*; import org.basex.query.util.*; import org.basex.query.util.format.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.query.value.type.SeqType.Occ; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.ft.*; import org.basex.util.hash.*; /** * Parser for XQuery expressions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class QueryParser extends InputParser { /** QName check: URI is mandatory. */ private static final byte[] URICHECK = {}; /** QName check: skip namespace check. */ private static final byte[] SKIPCHECK = {}; /** Reserved function names (XQuery 1.0). */ private static final TokenSet KEYWORDS10 = new TokenSet(); /** Reserved function names (XQuery 3.0). */ private static final TokenSet KEYWORDS30 = new TokenSet(); static { final byte[][] keys = { NodeType.ATT.string(), NodeType.COM.string(), NodeType.DOC.string(), NodeType.ELM.string(), token(EMPTY_SEQUENCE), token(IF), AtomType.ITEM.string(), NodeType.NOD.string(), NodeType.PI.string(), token(SCHEMA_ATTRIBUTE), token(SCHEMA_ELEMENT), NodeType.TXT.string(), token(TYPESWITCH) }; for(final byte[] key : keys) { KEYWORDS10.add(key); KEYWORDS30.add(key); } KEYWORDS30.add(FuncType.ANY_FUN.string()); KEYWORDS30.add(NodeType.NSP.string()); KEYWORDS30.add(SWITCH); } /** Modules loaded by the current file. */ public final TokenSet modules = new TokenSet(); /** Parsed variables. */ public final ArrayList vars = new ArrayList(); /** Parsed functions. */ public final ArrayList funcs = new ArrayList(); /** Namespaces. */ public final TokenMap namespaces = new TokenMap(); /** Query context. */ final QueryContext ctx; /** Temporary token cache. */ private final TokenBuilder tok = new TokenBuilder(); /** XQDoc cache. */ private final StringBuilder currDoc = new StringBuilder(); /** Current XQDoc string. */ private String moduleDoc = ""; /** Name of current module. */ private QNm module; /** Alternative error output. */ private Err alter; /** Function name of alternative error. */ private QNm alterFunc; /** Alternative position. */ private int alterPos; /** Declared flags. */ private final HashSet decl = new HashSet(); /** Cached QNames. */ private final ArrayList names = new ArrayList(); /** Current variable scope. */ private VarScope scope; /** * Constructor. * @param in input * @param path file path (if {@code null}, {@link Prop#QUERYPATH} will be assigned) * @param c query context * @throws QueryException query exception */ public QueryParser(final String in, final String path, final QueryContext c) throws QueryException { super(in); ctx = c; // set path to query file final Prop prop = c.context.prop; final String bi = path != null ? path : prop.get(Prop.QUERYPATH); if(!bi.isEmpty()) c.sc.baseURI(bi); // parse pre-defined external variables final String bind = prop.get(Prop.BINDINGS).trim(); final StringBuilder key = new StringBuilder(); final StringBuilder val = new StringBuilder(); boolean first = true; final int sl = bind.length(); for(int s = 0; s < sl; s++) { final char ch = bind.charAt(s); if(first) { if(ch == '=') { first = false; } else { key.append(ch); } } else { if(ch == ',') { if(s + 1 == sl || bind.charAt(s + 1) != ',') { bind(key, val); key.setLength(0); val.setLength(0); first = true; continue; } // commas are escaped by a second comma s++; } val.append(ch); } } bind(key, val); } /** * Binds the specified variable. * If a URI is specified, the query is treated as a module. * @param key key * @param val value * @throws QueryException query exception */ private void bind(final StringBuilder key, final StringBuilder val) throws QueryException { final String k = key.toString().trim(); if(!k.isEmpty()) ctx.bind(k, new Atm(val.toString()), null); } /** * Parses a main module. * Parses the "MainModule" rule. * Parses the "Setter" rule. * Parses the "QueryBody (= Expr)" rule. * @return resulting root expression * @throws QueryException query exception */ public final MainModule parseMain() throws QueryException { file(ctx.sc.baseIO(), ctx.context); checkValidChars(); try { versionDecl(); final int i = pos; if(wsConsumeWs(MODULE, NSPACE, null)) error(MAINMOD); pos = i; prolog1(); prolog2(); scope = new VarScope(); final Expr e = expr(); if(e == null) { if(alter != null) error(); else error(EXPREMPTY); } final MainModule mm = new MainModule(e, scope, moduleDoc); scope = null; finish(mm, true); return mm; } catch(final QueryException ex) { mark(); ex.pos(this); throw ex; } } /** * Parses a library module. * Parses the "ModuleDecl" rule. * @param check if functions and variables should be checked * @return name of the module * @throws QueryException query exception */ public final LibraryModule parseLibrary(final boolean check) throws QueryException { file(ctx.sc.baseIO(), ctx.context); checkValidChars(); try { versionDecl(); wsCheck(MODULE); wsCheck(NSPACE); skipWS(); final byte[] pref = ncName(NONAME); wsCheck(IS); final byte[] uri = stringLiteral(); if(uri.length == 0) error(NSMODURI); module = new QNm(pref, uri); ctx.sc.ns.add(pref, uri, info()); namespaces.put(pref, uri); wsCheck(";"); // get absolute path final IO base = ctx.sc.baseIO(); final byte[] p = token(base == null ? "" : base.path()); ctx.modParsed.put(p, uri); ctx.modStack.push(p); prolog1(); prolog2(); finish(null, check); ctx.modStack.pop(); return new LibraryModule(module, moduleDoc); } catch(final QueryException ex) { mark(); ex.pos(this); throw ex; } } /** * Checks the input string for illegal characters. * @throws QueryException query exception */ private void checkValidChars() throws QueryException { if(!more()) error(QUERYEMPTY); // checks if the query string contains invalid characters for(int i = 0; i < length;) { // only retrieve code points for large character codes (faster) int cp = input.charAt(i); final boolean hs = cp >= Character.MIN_HIGH_SURROGATE; if(hs) cp = input.codePointAt(i); if(!XMLToken.valid(cp)) { pos = i; error(QUERYINV, cp); } i += hs ? Character.charCount(cp) : 1; } } /** * Finishes the parsing step. * @param mm main module, {@code null} for library modules * @param check if functions and variables should be checked * @throws QueryException query exception */ private void finish(final MainModule mm, final boolean check) throws QueryException { if(more()) { if(alter != null) error(); final String rest = rest(); pos++; if(mm == null) error(MODEXPR, rest); error(QUERYEND, rest); } // completes the parsing step assignURI(0); if(ctx.sc.elemNS != null) ctx.sc.ns.add(EMPTY, ctx.sc.elemNS, null); // set default decimal format final byte[] empty = new QNm(EMPTY).id(); if(ctx.sc.decFormats.get(empty) == null) { ctx.sc.decFormats.put(empty, new DecFormatter()); } if(check) { // check function calls and variable references ctx.funcs.check(ctx); ctx.vars.check(ctx); // check placement of updating expressions if any have been found if(ctx.updates != null) { ctx.funcs.checkUp(); ctx.vars.checkUp(); if(mm != null) mm.expr.checkUp(); } } } /** * Parses the "VersionDecl" rule. * @throws QueryException query exception */ private void versionDecl() throws QueryException { final int i = pos; if(!wsConsumeWs(XQUERY)) return; final boolean version = wsConsumeWs(VERSION); if(version) { // parse xquery version final String ver = string(stringLiteral()); if(ver.equals(XQ10)) ctx.sc.xquery3 = false; else if(eq(ver, XQ11, XQ30)) ctx.sc.xquery3 = true; else error(XQUERYVER, ver); } // parse xquery encoding (ignored, as input always comes in as string) if((version || ctx.sc.xquery3()) && wsConsumeWs(ENCODING)) { final String enc = string(stringLiteral()); if(!supported(enc)) error(XQUERYENC2, enc); } else if(!version) { pos = i; return; } wsCheck(";"); } /** * Parses the "Prolog" rule. * Parses the "Setter" rule. * @throws QueryException query exception */ private void prolog1() throws QueryException { while(true) { final int i = pos; if(wsConsumeWs(DECLARE)) { if(wsConsumeWs(DEFAULT)) { if(!defaultNamespaceDecl() && !defaultCollationDecl() && !emptyOrderDecl() && !(ctx.sc.xquery3() && decimalFormatDecl(true))) error(DECLINCOMPLETE); } else if(wsConsumeWs(BOUNDARY_SPACE)) { boundarySpaceDecl(); } else if(wsConsumeWs(BASE_URI)) { baseURIDecl(); } else if(wsConsumeWs(CONSTRUCTION)) { constructionDecl(); } else if(wsConsumeWs(ORDERING)) { orderingModeDecl(); } else if(wsConsumeWs(REVALIDATION)) { revalidationDecl(); } else if(wsConsumeWs(COPY_NAMESPACES)) { copyNamespacesDecl(); } else if(ctx.sc.xquery3() && wsConsumeWs(DECIMAL_FORMAT)) { decimalFormatDecl(false); } else if(wsConsumeWs(NSPACE)) { namespaceDecl(); } else if(wsConsumeWs(FT_OPTION)) { final FTOpt fto = new FTOpt(); while(ftMatchOption(fto)); ctx.ftOpt().copy(fto); } else { pos = i; return; } } else if(wsConsumeWs(IMPORT)) { if(wsConsumeWs(SCHEMA)) { schemaImport(); } else if(wsConsumeWs(MODULE)) { moduleImport(); } else { pos = i; return; } } else { return; } currDoc.setLength(0); skipWS(); check(';'); } } /** * Parses the "Prolog" rule. * @throws QueryException query exception */ private void prolog2() throws QueryException { while(true) { final int i = pos; if(!wsConsumeWs(DECLARE)) break; if(ctx.sc.xquery3() && wsConsumeWs(CONTEXT)) { contextItemDecl(); } else if(wsConsumeWs(OPTION)) { optionDecl(); } else if(wsConsumeWs(DEFAULT)) { error(PROLOGORDER); } else { final Ann ann = new Ann(); while(true) { if(wsConsumeWs(UPDATING)) { ann.add(Ann.Q_UPDATING, Empty.SEQ, info()); } else if(ctx.sc.xquery3() && consume('%')) { annotation(ann); } else { break; } } if(wsConsumeWs(VARIABLE)) { // variables cannot be updating if(ann.contains(Ann.Q_UPDATING)) error(UPDATINGVAR); ann.check(true); varDecl(ann); } else if(wsConsumeWs(FUNCTION)) { ann.check(false); functionDecl(ann); } else if(!ann.isEmpty()) { error(VARFUNC); } else { pos = i; break; } } currDoc.setLength(0); skipWS(); check(';'); } } /** * Parses the "Annotation" rule. * @return annotations * @throws QueryException query exception */ private Ann annotations() throws QueryException { final Ann ann = new Ann(); while(wsConsume("%")) annotation(ann); ann.check(false); skipWS(); return ann; } /** * Parses a single annotation. * @param ann annotations * @throws QueryException query exception */ private void annotation(final Ann ann) throws QueryException { skipWS(); final InputInfo info = info(); final QNm name = eQName(QNAMEINV, XQURI); final ValueBuilder vb = new ValueBuilder(); if(wsConsumeWs(PAR1)) { do { final Expr ex = literal(); if(ex == null || !(ex instanceof Item)) error(ANNVALUE); vb.add((Item) ex); } while(wsConsumeWs(COMMA)); wsCheck(PAR2); } skipWS(); ann.add(name, vb.value(), info); } /** * Parses the "NamespaceDecl" rule. * @throws QueryException query exception */ private void namespaceDecl() throws QueryException { final byte[] pref = ncName(NONAME); wsCheck(IS); final byte[] uri = stringLiteral(); if(ctx.sc.ns.staticURI(pref) != null) error(DUPLNSDECL, pref); ctx.sc.ns.add(pref, uri, info()); namespaces.put(pref, uri); } /** * Parses the "RevalidationDecl" rule. * @throws QueryException query exception */ private void revalidationDecl() throws QueryException { if(!decl.add(REVALIDATION)) error(DUPLREVAL); if(wsConsumeWs(STRICT) || wsConsumeWs(LAX)) error(NOREVAL); wsCheck(SKIP); } /** * Parses the "BoundarySpaceDecl" rule. * @throws QueryException query exception */ private void boundarySpaceDecl() throws QueryException { if(!decl.add(BOUNDARY_SPACE)) error(DUPLBOUND); final boolean spaces = wsConsumeWs(PRESERVE); if(!spaces) wsCheck(STRIP); ctx.sc.spaces = spaces; } /** * Parses the "DefaultNamespaceDecl" rule. * @return true if declaration was found * @throws QueryException query exception */ private boolean defaultNamespaceDecl() throws QueryException { final boolean elem = wsConsumeWs(ELEMENT); if(!elem && !wsConsumeWs(FUNCTION)) return false; wsCheck(NSPACE); final byte[] uri = stringLiteral(); if(eq(XMLURI, uri)) error(BINDXMLURI, uri, XML); if(eq(XMLNSURI, uri)) error(BINDXMLURI, uri, XMLNS); if(elem) { if(!decl.add(ELEMENT)) error(DUPLNS); ctx.sc.elemNS = uri.length == 0 ? null : uri; } else { if(!decl.add(FUNCTION)) error(DUPLNS); ctx.sc.funcNS = uri.length == 0 ? null : uri; } return true; } /** * Parses the "OptionDecl" rule. * @throws QueryException query exception */ private void optionDecl() throws QueryException { skipWS(); final QNm name = eQName(QNAMEINV, ctx.sc.xquery3() ? XQURI : URICHECK); final byte[] val = stringLiteral(); final String key = string(name.local()); if(ctx.sc.xquery3() && eq(name.uri(), OUTPUTURI)) { // output declaration if(module != null) error(MODOUT); if(ctx.serProp == null) { final Prop prop = ctx.context.prop; ctx.serProp = new SerializerProp(prop.get(Prop.SERIALIZER)); } if(ctx.serProp.get(key) == null) error(OUTWHICH, key); if(!decl.add("S " + key)) error(OUTDUPL, key); if(key.equals(SerializerProp.S_PARAMETER_DOCUMENT[0].toString())) { final IO io = IO.get(string(resolvedUri(val).string())); try { final ANode node = new DBNode(io, ctx.context.prop).children().next(); // check parameters and add values to properties final InputInfo info = info(); final TokenMap tm = FuncParams.serializerMap(node, info); FuncParams.serializerProp(tm, info); for(final byte[] sk : tm) ctx.serProp.set(string(sk), string(tm.get(sk))); } catch(final IOException ex) { error(OUTDOC, val); } } ctx.serProp.set(key, string(val)); } else if(ctx.sc.xquery3() && eq(name.uri(), XQURI)) { error(DECLOPTION, name); } else if(eq(name.uri(), DBURI)) { // project-specific declaration final String ukey = key.toUpperCase(Locale.ENGLISH); final Object obj = ctx.context.prop.get(ukey); if(obj == null) error(BASX_OPTIONS, ukey); // cache old value (to be reset after query evaluation) ctx.globalOpt.put(ukey, obj); ctx.dbOptions.add(key); ctx.dbOptions.add(string(val)); } else if(eq(name.uri(), QUERYURI)) { // Query-specific options if(key.equals(READ_LOCK)) { for(final byte[] lock : split(val, ',')) ctx.readLocks.add(DBLocking.USER_PREFIX + string(lock).trim()); } else if(key.equals(WRITE_LOCK)) { for(final byte[] lock : split(val, ',')) ctx.writeLocks.add(DBLocking.USER_PREFIX + string(lock).trim()); } else { error(BASX_OPTIONS, key); } } // ignore unknown options } /** * Parses the "OrderingModeDecl" rule. * @throws QueryException query exception */ private void orderingModeDecl() throws QueryException { if(!decl.add(ORDERING)) error(DUPLORD); ctx.sc.ordered = wsConsumeWs(ORDERED); if(!ctx.sc.ordered) wsCheck(UNORDERED); } /** * Parses the "emptyOrderDecl" rule. * @return true if declaration was found * @throws QueryException query exception */ private boolean emptyOrderDecl() throws QueryException { if(!wsConsumeWs(ORDER)) return false; wsCheck(EMPTYORD); if(!decl.add(EMPTYORD)) error(DUPLORDEMP); ctx.sc.orderGreatest = wsConsumeWs(GREATEST); if(!ctx.sc.orderGreatest) wsCheck(LEAST); return true; } /** * Parses the "copyNamespacesDecl" rule. * Parses the "PreserveMode" rule. * Parses the "InheritMode" rule. * @throws QueryException query exception */ private void copyNamespacesDecl() throws QueryException { if(!decl.add(COPY_NAMESPACES)) error(DUPLCOPYNS); ctx.sc.preserveNS = wsConsumeWs(PRESERVE); if(!ctx.sc.preserveNS) wsCheck(NO_PRESERVE); wsCheck(COMMA); ctx.sc.inheritNS = wsConsumeWs(INHERIT); if(!ctx.sc.inheritNS) wsCheck(NO_INHERIT); } /** * Parses the "DecimalFormatDecl" rule. * @param def default flag * @return true if declaration was found * @throws QueryException query exception */ private boolean decimalFormatDecl(final boolean def) throws QueryException { if(def && !wsConsumeWs(DECIMAL_FORMAT)) return false; // use empty name for default declaration final QNm name = def ? new QNm() : eQName(QNAMEINV, null); // check if format has already been declared if(ctx.sc.decFormats.get(name.id()) != null) error(DECDUPL); // create new format final TokenMap map = new TokenMap(); // collect all property declarations int n; do { n = map.size(); skipWS(); final byte[] prop = ncName(null); for(final byte[] s : DECFORMATS) { if(!eq(prop, s)) continue; if(map.get(s) != null) error(DECDUPLPROP, s); wsCheck(IS); map.put(s, stringLiteral()); break; } if(map.isEmpty()) error(NODECLFORM, prop); } while(n != map.size()); // completes the format declaration ctx.sc.decFormats.put(name.id(), new DecFormatter(info(), map)); return true; } /** * Parses the "DefaultCollationDecl" rule. * @return query expression * @throws QueryException query exception */ private boolean defaultCollationDecl() throws QueryException { if(!wsConsumeWs(COLLATION)) return false; if(!decl.add(COLLATION)) error(DUPLCOLL); ctx.sc.collation = Collation.get(stringLiteral(), ctx, info(), WHICHDEFCOLL); return true; } /** * Parses the "BaseURIDecl" rule. * @throws QueryException query exception */ private void baseURIDecl() throws QueryException { if(!decl.add(BASE_URI)) error(DUPLBASE); final byte[] base = stringLiteral(); if(base.length != 0) ctx.sc.baseURI(string(base)); } /** * Parses the "SchemaImport" rule. * Parses the "SchemaPrefix" rule. * @throws QueryException query exception */ private void schemaImport() throws QueryException { byte[] pref = null; if(wsConsumeWs(NSPACE)) { pref = ncName(NONAME); if(eq(pref, XML, XMLNS)) error(BINDXML, pref); wsCheck(IS); } else if(wsConsumeWs(DEFAULT)) { wsCheck(ELEMENT); wsCheck(NSPACE); } byte[] ns = stringLiteral(); if(pref != null && ns.length == 0) error(NSEMPTY); if(!Uri.uri(ns).isValid()) error(INVURI, ns); if(wsConsumeWs(AT)) { do { ns = stringLiteral(); if(!Uri.uri(ns).isValid()) error(INVURI, ns); } while(wsConsumeWs(COMMA)); } error(IMPLSCHEMA); } /** * Parses the "ModuleImport" rule. * @throws QueryException query exception */ private void moduleImport() throws QueryException { byte[] pref = EMPTY; if(wsConsumeWs(NSPACE)) { pref = ncName(NONAME); wsCheck(IS); } final byte[] uri = trim(stringLiteral()); if(uri.length == 0) error(NSMODURI); if(!Uri.uri(uri).isValid()) error(INVURI, uri); if(modules.contains(uri)) error(DUPLMODULE, uri); modules.add(uri); // add non-default namespace if(pref != EMPTY) { if(ctx.sc.ns.staticURI(pref) != null) error(DUPLNSDECL, pref); ctx.sc.ns.add(pref, uri, info()); namespaces.put(pref, uri); } // check modules at specified locations if(wsConsumeWs(AT)) { do { module(stringLiteral(), uri, true); } while(wsConsumeWs(COMMA)); return; } // check pre-declared module files final byte[] path = ctx.modDeclared.get(uri); if(path != null) { module(path, uri, true); return; } // check built-in modules for(final byte[] u : Function.URIS.values()) if(eq(uri, u)) return; // resolve module uri if(ctx.modules.addImport(uri, info(), this)) return; error(NOMODULE, uri); } /** * Parses the specified module. * @param path file path * @param uri module uri * @throws QueryException query exception */ public void module(final byte[] path, final byte[] uri) throws QueryException { module(path, uri, false); } /** * Parses the specified module, checking function and variable references at the end. * @param path file path * @param uri module uri * @param imprt if this is an imported module * @throws QueryException query exception */ private void module(final byte[] path, final byte[] uri, final boolean imprt) throws QueryException { // get absolute path final IO io = ctx.sc.io(string(path)); final byte[] p = token(io.path()); // check if module has already been parsed final byte[] u = ctx.modParsed.get(p); if(u != null) { if(!eq(uri, u)) error(WRONGMODULE, uri, ctx.context.user.has(Perm.ADMIN) ? io.path() : io.name()); if(!ctx.sc.xquery3() && ctx.modStack.contains(p)) error(CIRCMODULE); return; } ctx.modParsed.put(p, uri); // read module String qu = null; try { qu = string(io.read()); } catch(final IOException ex) { error(NOMODULEFILE, ctx.context.user.has(Perm.ADMIN) ? io.path() : io.name()); } ctx.modStack.push(p); final StaticContext sc = ctx.sc; ctx.sc = new StaticContext(sc.xquery3()); final LibraryModule lib = new QueryParser(qu, io.path(), ctx).parseLibrary(!imprt); final byte[] muri = lib.name.uri(); // check if import and declaration uri match if(!eq(uri, muri)) error(WRONGMODULE, muri, file); // check if context item declaration types are compatible to each other if(ctx.sc.initType != null) { if(sc.initType == null) { sc.initType = ctx.sc.initType; } else if(!ctx.sc.initType.eq(sc.initType)) { error(CITYPES, ctx.sc.initType, sc.initType); } } ctx.sc = sc; ctx.modStack.pop(); } /** * Parses the "ContextItemDecl" rule. * @throws QueryException query exception */ private void contextItemDecl() throws QueryException { wsCheck(ITEMM); if(!decl.add(ITEMM)) error(DUPLITEM); if(wsConsumeWs(AS)) { final SeqType type = itemType(); if(ctx.sc.initType == null) { ctx.sc.initType = type; } else if(!ctx.sc.initType.eq(type)) { error(CITYPES, ctx.sc.initType, type); } } if(!wsConsumeWs(EXTERNAL)) wsCheck(ASSIGN); else if(!wsConsumeWs(ASSIGN)) return; scope = new VarScope(); final Expr e = check(single(), NOVARDECL); final SeqType type = ctx.sc.initType == null ? SeqType.ITEM : ctx.sc.initType; ctx.ctxItem = new MainModule(e, scope, type, currDoc.toString(), info()); scope = null; if(module != null) error(DECITEM); if(e.has(Flag.UPD)) error(UPCTX, e); } /** * Parses the "VarDecl" rule. * @param ann annotations * @throws QueryException query exception */ private void varDecl(final Ann ann) throws QueryException { final QNm vn = varName(); final SeqType tp = optAsType(); if(module != null && !eq(vn.uri(), module.uri())) error(MODNS, vn); final Expr bind; scope = new VarScope(); final boolean external = wsConsumeWs(EXTERNAL); if(external) { bind = ctx.sc.xquery3() && wsConsumeWs(ASSIGN) ? check(single(), NOVARDECL) : null; } else { wsCheck(ASSIGN); bind = check(single(), NOVARDECL); } vars.add(ctx.vars.declare(vn, tp, ann, bind, external, ctx.sc, scope, currDoc.toString(), info())); scope = null; } /** * Creates and registers a new local variable in the current scope. * @param name variable name * @param tp variable type * @param prm if the variable is a function parameter * @return registered variable */ private Var addLocal(final QNm name, final SeqType tp, final boolean prm) { return scope.newLocal(ctx, name, tp, prm); } /** * Parses an optional SeqType declaration. * @return type if preceded by {@code as}, {@code null} otherwise * @throws QueryException query exception */ private SeqType optAsType() throws QueryException { return wsConsumeWs(AS) ? sequenceType() : null; } /** * Parses the "ConstructionDecl" rule. * @throws QueryException query exception */ private void constructionDecl() throws QueryException { if(!decl.add(CONSTRUCTION)) error(DUPLCONS); ctx.sc.strip = wsConsumeWs(STRIP); if(!ctx.sc.strip) wsCheck(PRESERVE); } /** * Parses the "FunctionDecl" rule. * @param ann annotations * @throws QueryException query exception */ private void functionDecl(final Ann ann) throws QueryException { final InputInfo ii = info(); final QNm name = eQName(FUNCNAME, ctx.sc.funcNS); if(ctx.sc.xquery3() && keyword(name)) error(RESERVED, name.local()); if(module != null && !eq(name.uri(), module.uri())) error(MODNS, name); wsCheck(PAR1); scope = new VarScope(); final Var[] args = paramList(); wsCheck(PAR2); final SeqType tp = optAsType(); if(ann.contains(Ann.Q_UPDATING)) ctx.updating(false); final Expr body = wsConsumeWs(EXTERNAL) ? null : enclosed(NOFUNBODY); funcs.add(ctx.funcs.declare(ann, name, args, tp, body, ctx.sc, scope, currDoc.toString(), ii)); scope = null; } /** * Checks if the specified name equals reserved function names. * @param name name to be checked * @return result of check */ private boolean keyword(final QNm name) { return !name.hasPrefix() && (ctx.sc.xquery3() ? KEYWORDS30 : KEYWORDS10).contains(name.string()); } /** * Parses a ParamList. * @return declared variables * @throws QueryException query exception */ private Var[] paramList() throws QueryException { Var[] args = { }; while(true) { skipWS(); if(curr() != '$') { if(args.length == 0) break; check('$'); } final Var var = addLocal(varName(), optAsType(), true); for(final Var v : args) if(v.name.eq(var.name)) error(FUNCDUPL, var); args = Array.add(args, var); if(!consume(',')) break; } return args; } /** * Parses the "EnclosedExpr" rule. * @param err error message * @return query expression * @throws QueryException query exception */ private Expr enclosed(final Err err) throws QueryException { wsCheck(BRACE1); final Expr e = check(expr(), err); wsCheck(BRACE2); return e; } /** * Parses the "Expr" rule. * @return query expression * @throws QueryException query exception */ private Expr expr() throws QueryException { final Expr e = single(); if(e == null) { if(more()) return null; if(alter != null) error(); else error(NOEXPR); } if(!wsConsume(COMMA)) return e; final ExprList el = new ExprList(e); do add(el, single()); while(wsConsume(COMMA)); return new List(info(), el.finish()); } /** * Parses the "ExprSingle" rule. * @return query expression * @throws QueryException query exception */ private Expr single() throws QueryException { alter = null; Expr e = flwor(); if(e == null) e = quantified(); if(e == null) e = switchh(); if(e == null) e = typeswitch(); if(e == null) e = iff(); if(e == null) e = tryCatch(); if(e == null) e = insert(); if(e == null) e = deletee(); if(e == null) e = rename(); if(e == null) e = replace(); if(e == null) e = transform(); if(e == null) e = or(); return e; } /** * Parses the "FLWORExpr" rule. * Parses the "WhereClause" rule. * Parses the "OrderByClause" rule. * Parses the "OrderSpecList" rule. * Parses the "GroupByClause" rule. * @return query expression * @throws QueryException query exception */ private Expr flwor() throws QueryException { final int s = scope.open(); final LinkedList clauses = initialClause(null); if(clauses == null) return null; final TokenObjMap curr = new TokenObjMap(); for(final Clause fl : clauses) for(final Var v : fl.vars()) curr.put(v.name.id(), v); int size; do { do { size = clauses.size(); initialClause(clauses); for(int i = size; i < clauses.size(); i++) for(final Var v : clauses.get(i).vars()) curr.put(v.name.id(), v); } while(size < clauses.size()); if(wsConsumeWs(WHERE)) { alterPos = pos; clauses.add(new Where(check(single(), NOWHERE), info())); alter = NOWHERE; } if(ctx.sc.xquery3() && wsConsumeWs(GROUP)) { wsCheck(BY); skipWS(); alterPos = pos; final GroupBy.Spec[] specs = groupSpecs(clauses); // find all non-grouping variables that aren't shadowed final ArrayList ng = new ArrayList(); for(final GroupBy.Spec spec : specs) curr.put(spec.var.name.id(), spec.var); vars: for(final Var v : curr.values()) { for(final GroupBy.Spec spec : specs) if(spec.var.is(v)) continue vars; ng.add(new VarRef(specs[0].info, v)); } // add new copies for all non-grouping variables final Var[] ngrp = new Var[ng.size()]; for(int i = ng.size(); --i >= 0;) { final VarRef v = ng.get(i); // if one groups variables such as $x as xs:integer, then the resulting // sequence isn't compatible with the type and can't be assigned final Var nv = addLocal(v.var.name, null, false); // [LW] should be done everywhere if(v.type().one()) nv.refineType(SeqType.get(v.type().type, Occ.ONE_MORE), ctx, info()); ngrp[i] = nv; curr.put(nv.name.id(), nv); } final VarRef[] pre = new VarRef[ng.size()]; clauses.add(new GroupBy(specs, ng.toArray(pre), ngrp, specs[0].info)); alter = GRPBY; } final boolean stable = wsConsumeWs(STABLE); if(stable) wsCheck(ORDER); if(stable || wsConsumeWs(ORDER)) { wsCheck(BY); alterPos = pos; OrderBy.Key[] ob = null; do { final OrderBy.Key key = orderSpec(); ob = ob == null ? new OrderBy.Key[] { key } : Array.add(ob, key); } while(wsConsume(COMMA)); final VarRef[] vs = new VarRef[curr.size()]; int i = 0; for(final Var v : curr.values()) vs[i++] = new VarRef(ob[0].info, v); clauses.add(new OrderBy(vs, ob, ob[0].info)); alter = ORDERBY; } if(ctx.sc.xquery3() && wsConsumeWs(COUNT, DOLLAR, NOCOUNT)) { final Var v = addLocal(varName(), SeqType.ITR, false); curr.put(v.name.id(), v); clauses.add(new Count(v, info())); } } while(ctx.sc.xquery3() && size < clauses.size()); if(!wsConsumeWs(RETURN)) throw alter != null ? error() : error(FLWORRETURN); final Expr ret = check(single(), NORETURN); scope.close(s); return new GFLWOR(clauses.get(0).info, clauses, ret); } /** * Parses the "InitialClause" rule. * @param clauses FLWOR clauses * @return query expression * @throws QueryException query exception */ private LinkedList initialClause(final LinkedList clauses) throws QueryException { LinkedList cls = clauses; // ForClause / LetClause final boolean let = wsConsumeWs(LET, SCORE, NOLET) || wsConsumeWs(LET, DOLLAR, NOLET); if(let || wsConsumeWs(FOR, DOLLAR, NOFOR)) { if(cls == null) cls = new LinkedList(); if(let) letClause(cls); else forClause(cls); } else if(ctx.sc.xquery3()) { // WindowClause final boolean slide = wsConsumeWs(FOR, SLIDING, NOWINDOW); if(slide || wsConsumeWs(FOR, TUMBLING, NOWINDOW)) { if(cls == null) cls = new LinkedList(); cls.add(windowClause(slide)); } } return cls; } /** * Parses the "ForClause" rule. * Parses the "PositionalVar" rule. * @param cls list of clauses * @throws QueryException parse exception */ private void forClause(final LinkedList cls) throws QueryException { do { final QNm nm = varName(); final SeqType tp = optAsType(); final boolean emp = ctx.sc.xquery3() && wsConsume(ALLOWING); if(emp) wsCheck(EMPTYORD); final QNm p = wsConsumeWs(AT) ? varName() : null; final QNm s = wsConsumeWs(SCORE) ? varName() : null; wsCheck(IN); final Expr e = check(single(), NOVARDECL); // declare late because otherwise it would shadow the wrong variables final Var var = addLocal(nm, tp, false); final Var ps = p != null ? addLocal(p, SeqType.ITR, false) : null; final Var sc = s != null ? addLocal(s, SeqType.DBL, false) : null; if(p != null) { if(nm.eq(p)) error(DUPLVAR, var); if(s != null && p.eq(s)) error(DUPLVAR, ps); } if(s != null && nm.eq(s)) error(DUPLVAR, var); cls.add(new For(var, ps, sc, e, emp, info())); } while(wsConsumeWs(COMMA)); } /** * Parses the "LetClause" rule. * Parses the "FTScoreVar" rule. * @param cls list of clauses * @throws QueryException parse exception */ private void letClause(final LinkedList cls) throws QueryException { do { final boolean score = wsConsumeWs(SCORE); final QNm nm = varName(); final SeqType tp = score ? SeqType.DBL : optAsType(); wsCheck(ASSIGN); final Expr e = check(single(), NOVARDECL); cls.add(new Let(addLocal(nm, tp, false), e, score, info())); } while(wsConsume(COMMA)); } /** * Parses the "TumblingWindowClause" rule. * Parses the "SlidingWindowClause" rule. * @param slide sliding window flag * @return the window clause * @throws QueryException parse exception */ private Window windowClause(final boolean slide) throws QueryException { wsCheck(slide ? SLIDING : TUMBLING); wsCheck(WINDOW); skipWS(); final QNm nm = varName(); final SeqType tp = optAsType(); wsCheck(IN); final Expr e = check(single(), NOVARDECL); // WindowStartCondition wsCheck(START); final Condition start = windowCond(true); // WindowEndCondition Condition end = null; final boolean only = wsConsume(ONLY), check = slide || only; if(check || wsConsume(END)) { if(check) wsCheck(END); end = windowCond(false); } return new Window(info(), slide, addLocal(nm, tp, false), e, start, only, end); } /** * Parses the "WindowVars" rule. * @param start start condition flag * @return an array containing the current, positional, previous and next variable name * @throws QueryException parse exception */ private Condition windowCond(final boolean start) throws QueryException { skipWS(); final InputInfo ii = info(); final Var var = curr('$') ? addLocal(varName(), null, false) : null, at = wsConsumeWs(AT) ? addLocal(varName(), null, false) : null, prv = wsConsumeWs(PREVIOUS) ? addLocal(varName(), null, false) : null, nxt = wsConsumeWs(NEXT) ? addLocal(varName(), null, false) : null; wsCheck(WHEN); return new Condition(start, var, at, prv, nxt, check(single(), NOEXPR), ii); } /** * Parses the "OrderSpec" rule. * Parses the "OrderModifier" rule. * * Empty order specs are ignored, {@code order} is then returned unchanged. * @return new order key * @throws QueryException query exception */ private OrderBy.Key orderSpec() throws QueryException { final Expr e = check(single(), ORDERBY); boolean desc = false; if(!wsConsumeWs(ASCENDING)) desc = wsConsumeWs(DESCENDING); boolean least = !ctx.sc.orderGreatest; if(wsConsumeWs(EMPTYORD)) { least = !wsConsumeWs(GREATEST); if(least) wsCheck(LEAST); } final Collation coll = !wsConsumeWs(COLLATION) ? ctx.sc.collation : Collation.get(stringLiteral(), ctx, info(), FLWORCOLL); return new OrderBy.Key(info(), e, desc, least, coll); } /** * Parses the "GroupingSpec" rule. * @param cl preceding clauses * @return new group specification * @throws QueryException query exception */ private GroupBy.Spec[] groupSpecs(final LinkedList cl) throws QueryException { GroupBy.Spec[] specs = null; do { final InputInfo ii = info(); final QNm name = varName(); final SeqType type = optAsType(); final Expr by; if(type != null || wsConsume(ASSIGN)) { if(type != null) wsCheck(ASSIGN); by = check(single(), NOVARDECL); } else { final VarRef vr = scope.resolve(name, ctx, ii); // the grouping variable has to be declared by the same FLWOR expression boolean dec = false; if(vr != null) { // check preceding clauses for(final Clause f : cl) { if(f.declares(vr.var)) { dec = true; break; } } // check other grouping variables if(!dec && specs != null) { for(final GroupBy.Spec spec : specs) { if(spec.var.is(vr.var)) { dec = true; break; } } } } if(!dec) error(GVARNOTDEFINED, '$' + string(name.string())); by = vr; } final Collation coll = !wsConsumeWs(COLLATION) ? ctx.sc.collation : Collation.get(stringLiteral(), ctx, info(), FLWORCOLL); final GroupBy.Spec spec = new GroupBy.Spec(ii, addLocal(name, type, false), by, coll); if(specs == null) { specs = new GroupBy.Spec[] { spec }; } else { for(int i = specs.length; --i >= 0;) { if(specs[i].var.name.eq(spec.var.name)) { specs[i].occluded = true; break; } } specs = Array.add(specs, spec); } } while(wsConsumeWs(COMMA)); return specs; } /** * Parses the "QuantifiedExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr quantified() throws QueryException { final boolean some = wsConsumeWs(SOME, DOLLAR, NOSOME); if(!some && !wsConsumeWs(EVERY, DOLLAR, NOSOME)) return null; final int s = scope.open(); For[] fl = { }; do { final QNm nm = varName(); final SeqType tp = optAsType(); wsCheck(IN); final Expr e = check(single(), NOSOME); fl = Array.add(fl, new For(addLocal(nm, tp, false), null, null, e, false, info())); } while(wsConsumeWs(COMMA)); wsCheck(SATISFIES); final Expr e = check(single(), NOSOME); scope.close(s); return new Quantifier(info(), fl, e, !some); } /** * Parses the "SwitchExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr switchh() throws QueryException { if(!ctx.sc.xquery3() || !wsConsumeWs(SWITCH, PAR1, TYPEPAR)) return null; wsCheck(PAR1); final Expr expr = check(expr(), NOSWITCH); SwitchCase[] exprs = { }; wsCheck(PAR2); // collect all cases ExprList cases; do { cases = new ExprList(null); while(wsConsumeWs(CASE)) add(cases, single()); if(cases.size() == 1) { // add default case if(exprs.length == 0) error(WRONGCHAR, CASE, found()); wsCheck(DEFAULT); } wsCheck(RETURN); cases.set(0, check(single(), NOSWITCH)); exprs = Array.add(exprs, new SwitchCase(info(), cases.finish())); } while(cases.size() != 1); return new Switch(info(), expr, exprs); } /** * Parses the "TypeswitchExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr typeswitch() throws QueryException { if(!wsConsumeWs(TYPESWITCH, PAR1, TYPEPAR)) return null; wsCheck(PAR1); final Expr ts = check(expr(), NOTYPESWITCH); wsCheck(PAR2); TypeCase[] cases = { }; final ArrayList types = new ArrayList(); final int s = scope.open(); boolean cs; do { types.clear(); cs = wsConsumeWs(CASE); if(!cs) { wsCheck(DEFAULT); skipWS(); } Var var = null; if(curr('$')) { var = addLocal(varName(), null, false); if(cs) wsCheck(AS); } if(cs) { do types.add(sequenceType()); while(ctx.sc.xquery3() && wsConsume(PIPE)); } wsCheck(RETURN); final Expr ret = check(single(), NOTYPESWITCH); cases = Array.add(cases, new TypeCase(info(), var, types.toArray(new SeqType[types.size()]), ret)); scope.close(s); } while(cs); if(cases.length == 1) error(NOTYPESWITCH); return new TypeSwitch(info(), ts, cases); } /** * Parses the "IfExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr iff() throws QueryException { if(!wsConsumeWs(IF, PAR1, IFPAR)) return null; wsCheck(PAR1); final Expr iff = check(expr(), NOIF); wsCheck(PAR2); if(!wsConsumeWs(THEN)) error(NOIF); final Expr thn = check(single(), NOIF); if(!wsConsumeWs(ELSE)) error(NOIF); final Expr els = check(single(), NOIF); return new If(info(), iff, thn, els); } /** * Parses the "OrExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr or() throws QueryException { final Expr e = and(); if(!wsConsumeWs(OR)) return e; final ExprList el = new ExprList(e); do add(el, and()); while(wsConsumeWs(OR)); return new Or(info(), el.finish()); } /** * Parses the "AndExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr and() throws QueryException { final Expr e = comparison(); if(!wsConsumeWs(AND)) return e; final ExprList el = new ExprList(e); do add(el, comparison()); while(wsConsumeWs(AND)); return new And(info(), el.finish()); } /** * Parses the "ComparisonExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr comparison() throws QueryException { final Expr e = ftContains(); if(e != null) { for(final OpV c : OpV.VALUES) if(wsConsumeWs(c.name)) return new CmpV(e, check(ftContains(), CMPEXPR), c, info()); for(final OpN c : OpN.VALUES) if(wsConsumeWs(c.name)) return new CmpN(e, check(ftContains(), CMPEXPR), c, info()); for(final OpG c : OpG.VALUES) if(wsConsumeWs(c.name)) return new CmpG(e, check(ftContains(), CMPEXPR), c, info()); } return e; } /** * Parses the "FTContainsExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr ftContains() throws QueryException { final Expr e = stringConcat(); final int i = pos; // extensions to the official extension: "=>" and "<-" if(consume('=') && consume('>') || consume('<') && consume('-')) { skipWS(); } else if(!wsConsumeWs(CONTAINS) || !wsConsumeWs(TEXT)) { pos = i; return e; } final FTExpr select = ftSelection(false); if(wsConsumeWs(WITHOUT)) { wsCheck(CONTENT); union(); error(FTIGNORE); } return new FTContainsExpr(e, select, info()); } /** * Parses the "StringConcatExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr stringConcat() throws QueryException { final Expr e = range(); if(e == null || !consume(CONCAT)) return e; final ExprList el = new ExprList(e); do add(el, range()); while(wsConsume(CONCAT)); return Function.CONCAT.get(info(), el.finish()); } /** * Parses the "RangeExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr range() throws QueryException { final Expr e = additive(); if(!wsConsumeWs(TO)) return e; return new Range(info(), e, check(additive(), INCOMPLETE)); } /** * Parses the "AdditiveExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr additive() throws QueryException { Expr e = multiplicative(); while(e != null) { final Calc c = consume('+') ? Calc.PLUS : consume('-') ? Calc.MINUS : null; if(c == null) break; e = new Arith(info(), e, check(multiplicative(), CALCEXPR), c); } return e; } /** * Parses the "MultiplicativeExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr multiplicative() throws QueryException { Expr e = union(); while(e != null) { final Calc c = consume('*') ? Calc.MULT : wsConsumeWs(DIV) ? Calc.DIV : wsConsumeWs(IDIV) ? Calc.IDIV : wsConsumeWs(MOD) ? Calc.MOD : null; if(c == null) break; e = new Arith(info(), e, check(union(), CALCEXPR), c); } return e; } /** * Parses the "UnionExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr union() throws QueryException { final Expr e = intersect(); if(e == null || !isUnion()) return e; final ExprList el = new ExprList(e); do add(el, intersect()); while(isUnion()); return new Union(info(), el.finish()); } /** * Checks if a union operator is found. * @return result of check * @throws QueryException query exception */ private boolean isUnion() throws QueryException { if(wsConsumeWs(UNION)) return true; final int i = pos; if(consume(PIPE) && !consume(PIPE)) return true; pos = i; return false; } /** * Parses the "IntersectExceptExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr intersect() throws QueryException { final Expr e = instanceoff(); if(wsConsumeWs(INTERSECT)) { final ExprList el = new ExprList(e); do add(el, instanceoff()); while(wsConsumeWs(INTERSECT)); return new InterSect(info(), el.finish()); } if(wsConsumeWs(EXCEPT)) { final ExprList el = new ExprList(e); do add(el, instanceoff()); while(wsConsumeWs(EXCEPT)); return new Except(info(), el.finish()); } return e; } /** * Parses the "InstanceofExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr instanceoff() throws QueryException { final Expr e = treat(); if(!wsConsumeWs(INSTANCE)) return e; wsCheck(OF); return new Instance(info(), e, sequenceType()); } /** * Parses the "TreatExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr treat() throws QueryException { final Expr e = castable(); if(!wsConsumeWs(TREAT)) return e; wsCheck(AS); return new Treat(info(), e, sequenceType()); } /** * Parses the "CastableExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr castable() throws QueryException { final Expr e = cast(); if(!wsConsumeWs(CASTABLE)) return e; wsCheck(AS); return new Castable(info(), e, simpleType()); } /** * Parses the "CastExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr cast() throws QueryException { final Expr e = unary(); if(!wsConsumeWs(CAST)) return e; wsCheck(AS); return new Cast(info(), e, simpleType()); } /** * Parses the "UnaryExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr unary() throws QueryException { boolean minus = false; boolean found = false; do { skipWS(); if(consume('-')) { minus ^= true; found = true; } else if(consume('+')) { found = true; } else { final Expr e = value(); return found ? new Unary(info(), check(e, EVALUNARY), minus) : e; } } while(true); } /** * Parses the "ValueExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr value() throws QueryException { validate(); final Expr e = path(); return e != null ? e : extension(); } /** * Parses the "ValidateExpr" rule. * @throws QueryException query exception */ private void validate() throws QueryException { final int i = pos; if(!wsConsumeWs(VALIDATE)) return; boolean brace = true; if(consume(BRACE1)) { brace = false; } else if(consume(TYPE)) { final QNm qnm = eQName(QNAMEINV, SKIPCHECK); names.add(new QNmCheck(qnm)); } else if(!consume(STRICT) && !consume(LAX)) { pos = i; return; } if(brace) wsCheck(BRACE1); check(single(), NOVALIDATE); wsCheck(BRACE2); error(IMPLVAL); } /** * Parses the "ExtensionExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr extension() throws QueryException { final Pragma[] pragmas = pragma(); if(pragmas == null) return null; final Expr expr = enclosed(NOPRAGMA); return pragmas.length == 0 ? expr : new Extension(info(), pragmas, expr); } /** * Parses the "Pragma" rule. * @return array of pragmas * @throws QueryException query exception */ private Pragma[] pragma() throws QueryException { if(!wsConsumeWs(PRAGMA)) return null; final ArrayList el = new ArrayList(); do { final QNm name = eQName(QNAMEINV, URICHECK); char c = curr(); if(c != '#' && !ws(c)) error(PRAGMAINV); tok.reset(); while(c != '#' || next() != ')') { if(c == 0) error(PRAGMAINV); tok.add(consume()); c = curr(); } final byte[] v = tok.trim().finish(); if(eq(name.prefix(), DB)) { // project-specific declaration final String key = string(uc(name.local())); final Object obj = ctx.context.prop.get(key); if(obj == null) error(BASX_OPTIONS, key); el.add(new DBPragma(name, v)); } pos += 2; } while(wsConsumeWs(PRAGMA)); return el.toArray(new Pragma[el.size()]); } /** * Parses the "PathExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr path() throws QueryException { checkInit(); final ExprList el; Expr root = null; if(consume('/')) { root = new Root(info()); el = new ExprList(); final Expr ex; if(consume('/')) { // two slashes: absolute descendant path checkAxis(Axis.DESC); add(el, descOrSelf()); mark(); ex = step(); if(ex == null) { // two slashes, but no following step: error if(more()) checkInit(); error(PATHMISS, found()); } } else { // one slash: absolute child path checkAxis(Axis.CHILD); mark(); ex = step(); // no more steps: return root expression if(ex == null) return root; } add(el, ex); relativePath(el); } else { // relative path (no preceding slash) mark(); final Expr ex = step(); if(ex == null) return null; // return non-step expression if no path or map operator follows final boolean nostep = curr() != '/' && (curr() != '!' || next() == '='); if(nostep && !(ex instanceof Step)) return ex; el = new ExprList(); if(ex instanceof Step) add(el, ex); else root = ex; relativePath(el); } return Path.get(info(), root, el.finish()); } /** * Parses the "RelativePathExpr" rule. * @param el expression list * @throws QueryException query exception */ void relativePath(final ExprList el) throws QueryException { while(true) { boolean b = false; if(consume('/')) { if(consume('/')) { add(el, descOrSelf()); checkAxis(Axis.DESC); } else { checkAxis(Axis.CHILD); } } else if(next() != '=' && consume('!')) { b = true; } else { return; } mark(); Expr st = step(); if(st == null) error(PATHMISS, found()); if(b) st = new Bang(info(), st); add(el, st); } } /** * Returns a standard descendant-or-self::node() step. * @return step */ private Step descOrSelf() { return Step.get(info(), Axis.DESCORSELF, Test.NOD); } // methods for query suggestions /** * Performs an optional check init. */ protected void checkInit() { } /** * Performs an optional axis check. * @param axis axis */ @SuppressWarnings("unused") protected void checkAxis(final Axis axis) { } /** * Performs an optional test check. * @param test node test * @param attr attribute flag */ @SuppressWarnings("unused") protected void checkTest(final Test test, final boolean attr) { } /** * Checks a predicate. * @param open open flag */ @SuppressWarnings("unused") protected void checkPred(final boolean open) { } /** * Parses the "StepExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr step() throws QueryException { final Expr e = postfix(); return e != null ? e : axisStep(); } /** * Parses the "AxisStep" rule. * @return query expression * @throws QueryException query exception */ private Step axisStep() throws QueryException { Axis ax = null; Test test = null; if(wsConsume(DOT2)) { ax = Axis.PARENT; test = Test.NOD; checkTest(test, false); } else if(consume('@')) { ax = Axis.ATTR; test = nodeTest(true, true); checkTest(test, true); if(test == null) { --pos; error(NOATTNAME); } } else { for(final Axis a : Axis.VALUES) { final int i = pos; if(!wsConsumeWs(a.name)) continue; alter = NOLOCSTEP; if(wsConsumeWs(COLS)) { alterPos = pos; ax = a; test = nodeTest(a == Axis.ATTR, true); checkTest(test, a == Axis.ATTR); break; } pos = i; } } if(ax == null) { ax = Axis.CHILD; test = nodeTest(false, true); if(test == Test.NSP) error(NSNOTALL); if(test != null && test.type == NodeType.ATT) ax = Axis.ATTR; checkTest(test, ax == Axis.ATTR); } if(test == null) return null; final ExprList el = new ExprList(); while(wsConsume(BR1)) { checkPred(true); add(el, expr()); wsCheck(BR2); checkPred(false); } return Step.get(info(), ax, test, el.finish()); } /** * Parses the "NodeTest" rule. * Parses the "NameTest" rule. * Parses the "KindTest" rule. * @param att attribute flag * @param all check all tests, or only names * @return query expression * @throws QueryException query exception */ private Test nodeTest(final boolean att, final boolean all) throws QueryException { final int i = pos; if(consume('*')) { // name test: * if(!consume(':')) return new NameTest(att); // name test: *:name return new NameTest(new QNm(ncName(QNAMEINV)), NameTest.Mode.LN, att); } if(ctx.sc.xquery3() && consume(EQNAME)) { // name test: Q{...}* final byte[] uri = bracedURILiteral(); if(consume('*')) { final QNm nm = new QNm(COLON, uri); return new NameTest(nm, NameTest.Mode.NS, att); } } pos = i; final QNm name = eQName(null, SKIPCHECK); if(name != null) { final int i2 = pos; if(all && wsConsumeWs(PAR1)) { final NodeType type = NodeType.find(name); if(type != null) return kindTest(type); } else { pos = i2; // name test: prefix:name, name if(name.hasPrefix() || !consume(':')) { skipWS(); names.add(new QNmCheck(name, !att)); return new NameTest(name, NameTest.Mode.STD, att); } // name test: prefix:* if(consume('*')) { final QNm nm = new QNm(concat(name.string(), COLON)); names.add(new QNmCheck(nm, !att)); return new NameTest(nm, NameTest.Mode.NS, att); } } } pos = i; return null; } /** * Parses the "FilterExpr" rule. * Parses the "Predicate" rule. * @return postfix expression * @throws QueryException query exception */ private Expr postfix() throws QueryException { Expr e = primary(), old; do { old = e; if(wsConsume(BR1)) { if(e == null) error(PREDMISSING); final ExprList el = new ExprList(); do { add(el, expr()); wsCheck(BR2); } while(wsConsume(BR1)); e = Filter.get(info(), e, el.finish()); } else if(e != null) { if(!wsConsume(PAR1)) break; final InputInfo ii = info(); final ExprList argList = new ExprList(); final int[] holes = argumentList(argList, e); final Expr[] args = argList.finish(); e = holes == null ? new DynFuncCall(ii, e, args) : new PartFunc(ii, e, args, holes); } } while(e != old); return e; } /** * Parses the "PrimaryExpr" rule. * Parses the "VarRef" rule. * Parses the "ContextItem" rule. * Parses the "Literal" rule. * @return query expression * @throws QueryException query exception */ private Expr primary() throws QueryException { skipWS(); final char c = curr(); // variables if(c == '$') return checkVar(varName()); // parentheses if(c == '(' && next() != '#') return parenthesized(); // direct constructor if(c == '<') return constructor(); // function item if(ctx.sc.xquery3()) { final Expr e = functionItem(); if(e != null) return e; } // function call Expr e = functionCall(); if(e != null) return e; // computed constructors e = compConstructor(); if(e != null) return e; // ordered expression if(wsConsumeWs(ORDERED, BRACE1, INCOMPLETE) || wsConsumeWs(UNORDERED, BRACE1, INCOMPLETE)) return enclosed(NOENCLEXPR); // map literal (old syntax) if(wsConsumeWs(MAPSTR, BRACE1, INCOMPLETE)) return mapLiteral(true); // map literal (new syntax) if(consume(BRACE1)) return mapLiteral(false); // context item if(c == '.' && !digit(next())) { if(next() == '.') return null; consume('.'); return new Context(info()); } // literals return literal(); } /** * Parses a literal map. * @param old old syntax * @return map literal * @throws QueryException query exception */ private Expr mapLiteral(final boolean old) throws QueryException { if(old) wsCheck(BRACE1); final ExprList el = new ExprList(); if(!wsConsume(BRACE2)) { do { add(el, check(single(), INVMAPKEY)); wsCheck(old ? ASSIGN : COL); add(el, check(single(), INVMAPVAL)); } while(wsConsume(COMMA)); wsCheck(BRACE2); } return new LitMap(info(), el.finish()); } /** * Parses the "FunctionItemExpr" rule. * Parses the "NamedFunctionRef" rule. * Parses the "LiteralFunctionItem" rule. * Parses the "InlineFunction" rule. * @return query expression, or {@code null} * @throws QueryException query exception */ private Expr functionItem() throws QueryException { skipWS(); final int ip = pos; // parse annotations; will only be visited for XQuery 3.0 expressions final Ann ann = curr('%') ? annotations() : null; // inline function if(wsConsume(FUNCTION) && wsConsume(PAR1)) { final VarScope inner = scope = scope.child(); final Var[] args = paramList(); wsCheck(PAR2); final SeqType type = optAsType(); if(ann != null && (ann.contains(Ann.Q_PRIVATE) || ann.contains(Ann.Q_PUBLIC))) error(INVISIBLE); final Expr body = enclosed(NOFUNBODY); scope = scope.parent(); return new InlineFunc(info(), type, args, body, ann, ctx.sc, inner); } // annotations not allowed here if(ann != null) error(NOANN); // named function reference pos = ip; final QNm name = eQName(null, ctx.sc.funcNS); if(name != null && consume('#')) { if(keyword(name)) error(RESERVED, name.local()); final Expr ex = numericLiteral(true); if(!(ex instanceof Int)) return ex; final long card = ex instanceof Int ? ((Int) ex).itr() : -1; if(card < 0 || card > Integer.MAX_VALUE) error(FUNCUNKNOWN, name); final Expr lit = Functions.getLiteral(name, (int) card, ctx, info()); return lit != null ? lit : FuncLit.unknown(name, card, ctx, info()); } pos = ip; return null; } /** * Parses the "Literal" rule. * @return query expression, or {@code null} * @throws QueryException query exception */ private Expr literal() throws QueryException { final char c = curr(); // literals if(digit(c) || c == '.') return numericLiteral(false); // strings return quote(c) ? Str.get(stringLiteral()) : null; } /** * Parses the "NumericLiteral" rule. * Parses the "DecimalLiteral" rule. * Parses the "IntegerLiteral" rule. * @param itr integer flag * @return query expression * @throws QueryException query exception */ private Expr numericLiteral(final boolean itr) throws QueryException { tok.reset(); while(digit(curr())) tok.add(consume()); final boolean dec = consume('.'); if(dec) { // decimal literal if(itr) error(NUMBERITR); tok.add('.'); while(digit(curr())) tok.add(consume()); } if(XMLToken.isNCStartChar(curr())) return checkDbl(); if(dec) return new Dec(tok.finish()); final long l = toLong(tok.finish()); if(l == Long.MIN_VALUE) return FNInfo.error(new QueryException(info(), RANGE, tok)); return Int.get(l); } /** * Parses the "DoubleLiteral" rule. Checks if a number is followed by a * whitespace. * @return expression * @throws QueryException query exception */ private Dbl checkDbl() throws QueryException { if(!consume('e') && !consume('E')) error(NUMBERWS); tok.add('e'); if(curr('+') || curr('-')) tok.add(consume()); final int s = tok.size(); while(digit(curr())) tok.add(consume()); if(s == tok.size()) error(NUMBERINC, tok); if(XMLToken.isNCStartChar(curr())) error(NUMBERWS); return Dbl.get(tok.finish(), info()); } /** * Parses the "StringLiteral" rule. * @return query expression * @throws QueryException query exception */ private byte[] stringLiteral() throws QueryException { skipWS(); final char del = curr(); if(!quote(del)) error(NOQUOTE, found()); consume(); tok.reset(); while(true) { while(!consume(del)) { if(!more()) error(NOQUOTE, found()); entity(tok); } if(!consume(del)) break; tok.add(del); } return tok.finish(); } /** * Resolves a relative URI literal against the base uri. * @param string uri string * @return resolved URI * @throws QueryException query exception */ private Uri resolvedUri(final byte[] string) throws QueryException { final Uri uri = Uri.uri(string); if(!uri.isValid()) error(INVURI, string); return uri.isAbsolute() ? uri : ctx.sc.baseURI().resolve(uri, info()); } /** * Parses the "BracedURILiteral" rule without the "Q{" prefix. * @return query expression * @throws QueryException query exception */ private byte[] bracedURILiteral() throws QueryException { tok.reset(); while(!consume('}')) { if(!more()) error(WRONGCHAR, BRACE2, found()); entity(tok); } return tok.finish(); } /** * Parses the "VarName" rule. * @return query expression * @throws QueryException query exception */ private QNm varName() throws QueryException { check('$'); skipWS(); return eQName(NOVARNAME, null); } /** * Parses the "ParenthesizedExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr parenthesized() throws QueryException { wsCheck(PAR1); final Expr e = expr(); wsCheck(PAR2); return e == null ? Empty.SEQ : e; } /** * Parses the "FunctionCall" rule. * @return query expression * @throws QueryException query exception */ private Expr functionCall() throws QueryException { final int i = pos; final QNm name = eQName(null, ctx.sc.funcNS); if(name != null && !keyword(name)) { if(wsConsume(PAR1)) { final InputInfo ii = info(); final ExprList argList = new ExprList(); final int[] holes = argumentList(argList, name.string()); final Expr[] args = argList.finish(); alter = FUNCUNKNOWN; alterFunc = name; alterPos = pos; final Expr ret; if(holes != null) { final int card = args.length + holes.length; final Expr lit = Functions.getLiteral(name, card, ctx, ii), f = lit != null ? lit : FuncLit.unknown(name, card, ctx, ii); ret = new PartFunc(ii, f, args, holes); } else { final TypedFunc f = Functions.get(name, args, false, ctx, ii); ret = f == null ? null : f.fun; } if(ret != null) { alter = null; return ret; } } } pos = i; return null; } /** * Parses the "ArgumentList" rule after the opening parenthesis was read. * @param args list to put the argument expressions into * @param name name of the function (item) * @return array of arguments, place-holders '?' are represented as {@code null} entries * @throws QueryException query exception */ private int[] argumentList(final ExprList args, final Object name) throws QueryException { int[] holes = null; if(!wsConsume(PAR2)) { int i = 0; do { if(wsConsume(PLHOLDER)) { holes = holes == null ? new int[] { i } : Array.add(holes, i); } else { final Expr e = single(); if(e == null) error(FUNCMISS, name); args.add(e); } i++; } while(wsConsume(COMMA)); if(!wsConsume(PAR2)) error(FUNCMISS, name); } return holes; } /** * Parses the "Constructor" rule. * Parses the "DirectConstructor" rule. * @return query expression * @throws QueryException query exception */ private Expr constructor() throws QueryException { check('<'); return consume('!') ? dirComment() : consume('?') ? dirPI() : dirElement(); } /** * Parses the "DirElemConstructor" rule. * Parses the "DirAttributeList" rules. * @return query expression * @throws QueryException query exception */ private Expr dirElement() throws QueryException { // cache namespace information final int s = ctx.sc.ns.size(); final byte[] nse = ctx.sc.elemNS; final int npos = names.size(); final QNm tag = new QNm(qName(TAGNAME)); names.add(new QNmCheck(tag)); consumeWS(); final Atts ns = new Atts(); final ExprList cont = new ExprList(); // parse attributes... boolean xmlDecl = false; // xml prefix explicitly declared? ArrayList atts = null; while(true) { final byte[] atn = qName(null); if(atn.length == 0) break; final ExprList attv = new ExprList(); consumeWS(); check('='); consumeWS(); final char delim = consume(); if(!quote(delim)) error(NOQUOTE, found()); final TokenBuilder tb = new TokenBuilder(); boolean simple = true; do { while(!consume(delim)) { final char ch = curr(); if(ch == '{') { if(next() == '{') { tb.add(consume()); consume(); } else { final byte[] text = tb.finish(); if(text.length != 0) { add(attv, Str.get(text)); } else { add(attv, enclosed(NOENCLEXPR)); simple = false; } tb.reset(); } } else if(ch == '}') { consume(); check('}'); tb.add('}'); } else if(ch == '<' || ch == 0) { error(NOQUOTE, found()); } else if(ch == '\n' || ch == '\t') { tb.add(' '); consume(); } else if(ch == '\r') { if(next() != '\n') tb.add(' '); consume(); } else { entity(tb); } } if(!consume(delim)) break; tb.add(delim); } while(true); if(!tb.isEmpty()) add(attv, Str.get(tb.finish())); // parse namespace declarations final boolean pr = startsWith(atn, XMLNSC); if(pr || eq(atn, XMLNS)) { if(!simple) error(NSCONS); final byte[] pref = pr ? local(atn) : EMPTY; final byte[] uri = attv.isEmpty() ? EMPTY : ((Str) attv.get(0)).string(); if(eq(pref, XML) && eq(uri, XMLURI)) { if(xmlDecl) error(DUPLNSDEF, XML); xmlDecl = true; } else { if(!Uri.uri(uri).isValid()) error(INVURI, uri); if(pr) { if(uri.length == 0) error(NSEMPTYURI); if(eq(pref, XML, XMLNS)) error(BINDXML, pref); if(eq(uri, XMLURI)) error(BINDXMLURI, uri, XML); if(eq(uri, XMLNSURI)) error(BINDXMLURI, uri, XMLNS); ctx.sc.ns.add(pref, uri); } else { if(eq(uri, XMLURI)) error(XMLNSDEF, uri); ctx.sc.elemNS = uri; } if(ns.contains(pref)) error(DUPLNSDEF, pref); ns.add(pref, uri); } } else { final QNm attn = new QNm(atn); if(atts == null) atts = new ArrayList(1); atts.add(attn); names.add(new QNmCheck(attn, false)); add(cont, new CAttr(info(), false, attn, attv.finish())); } if(!consumeWS()) break; } if(consume('/')) { check('>'); } else { check('>'); while(curr() != '<' || next() != '/') { final Expr e = dirElemContent(tag.string()); if(e == null) continue; add(cont, e); } pos += 2; final byte[] close = qName(TAGNAME); consumeWS(); check('>'); if(!eq(tag.string(), close)) error(TAGWRONG, tag.string(), close); } assignURI(npos); // check for duplicate attribute names if(atts != null) { final int as = atts.size(); for(int a = 0; a < as - 1; a++) { for(int b = a + 1; b < as; b++) { if(atts.get(a).eq(atts.get(b))) error(ATTDUPL, atts.get(a)); } } } ctx.sc.ns.size(s); ctx.sc.elemNS = nse; return new CElem(info(), tag, ns, cont.finish()); } /** * Parses the "DirElemContent" rule. * @param tag opening tag * @return query expression * @throws QueryException query exception */ private Expr dirElemContent(final byte[] tag) throws QueryException { final TokenBuilder tb = new TokenBuilder(); boolean strip = true; do { final char c = curr(); if(c == '<') { if(wsConsume(CDATA)) { tb.add(cDataSection()); strip = false; } else { final Str txt = text(tb, strip); return txt != null ? txt : next() == '/' ? null : constructor(); } } else if(c == '{') { if(next() == '{') { tb.add(consume()); consume(); } else { final Str txt = text(tb, strip); return txt != null ? txt : enclosed(NOENCLEXPR); } } else if(c == '}') { consume(); check('}'); tb.add('}'); } else if(c != 0) { strip &= !entity(tb); } else { error(NOCLOSING, tag); } } while(true); } /** * Returns a string item. * @param tb token builder * @param strip strip flag * @return text or {@code null} */ private Str text(final TokenBuilder tb, final boolean strip) { final byte[] t = tb.finish(); return t.length == 0 || strip && !ctx.sc.spaces && ws(t) ? null : Str.get(t); } /** * Parses the "DirCommentConstructor" rule. * @return query expression * @throws QueryException query exception */ private Expr dirComment() throws QueryException { check('-'); check('-'); final TokenBuilder tb = new TokenBuilder(); do { while(not('-')) tb.add(consume()); consume(); if(consume('-')) { check('>'); return new CComm(info(), Str.get(tb.finish())); } tb.add('-'); } while(true); } /** * Parses the "DirPIConstructor" rule. * Parses the "DirPIContents" rule. * @return query expression * @throws QueryException query exception */ private Expr dirPI() throws QueryException { final byte[] str = ncName(INVALPI); if(eq(lc(str), XML)) error(PIXML, str); final boolean space = skipWS(); final TokenBuilder tb = new TokenBuilder(); do { while(not('?')) { if(!space) error(PIWRONG); tb.add(consume()); } consume(); if(consume('>')) { return new CPI(info(), Str.get(str), Str.get(tb.finish())); } tb.add('?'); } while(true); } /** * Parses the "CDataSection" rule. * @return CData * @throws QueryException query exception */ private byte[] cDataSection() throws QueryException { final TokenBuilder tb = new TokenBuilder(); while(true) { while(not(']')) { char ch = consume(); if(ch == '\r') { ch = '\n'; if(curr(ch)) consume(); } tb.add(ch); } consume(); if(curr(']') && next() == '>') { pos += 2; return tb.finish(); } tb.add(']'); } } /** * Parses the "ComputedConstructor" rule. * @return query expression * @throws QueryException query exception */ private Expr compConstructor() throws QueryException { final int i = pos; if(wsConsumeWs(DOCUMENT)) return consume(compDoc(), i); if(wsConsumeWs(ELEMENT)) return consume(compElement(), i); if(wsConsumeWs(ATTRIBUTE)) return consume(compAttribute(), i); if(wsConsumeWs(NSPACE)) return consume(compNamespace(), i); if(wsConsumeWs(TEXT)) return consume(compText(), i); if(wsConsumeWs(COMMENT)) return consume(compComment(), i); if(wsConsumeWs(PI)) return consume(compPI(), i); return null; } /** * Consumes the specified expression or resets the query position. * @param expr expression * @param p query position * @return expression or {@code null} */ private Expr consume(final Expr expr, final int p) { if(expr == null) pos = p; return expr; } /** * Parses the "CompDocConstructor" rule. * @return query expression * @throws QueryException query exception */ private Expr compDoc() throws QueryException { if(!wsConsume(BRACE1)) return null; final Expr e = check(expr(), NODOCCONS); wsCheck(BRACE2); return new CDoc(info(), e); } /** * Parses the "CompElemConstructor" rule. * Parses the "ContextExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr compElement() throws QueryException { skipWS(); Expr name; final QNm qn = eQName(null, SKIPCHECK); if(qn != null) { name = qn; names.add(new QNmCheck(qn)); } else { if(!wsConsume(BRACE1)) return null; name = check(expr(), NOTAG); wsCheck(BRACE2); } if(!wsConsume(BRACE1)) return null; final Expr e = expr(); wsCheck(BRACE2); return new CElem(info(), name, null, e == null ? new Expr[0] : new Expr[] { e }); } /** * Parses the "CompAttrConstructor" rule. * @return query expression * @throws QueryException query exception */ private Expr compAttribute() throws QueryException { skipWS(); Expr name; final QNm qn = eQName(null, SKIPCHECK); if(qn != null) { name = qn; names.add(new QNmCheck(qn, false)); } else { if(!wsConsume(BRACE1)) return null; name = check(expr(), NOATTNAME); wsCheck(BRACE2); } if(!wsConsume(BRACE1)) return null; final Expr e = expr(); wsCheck(BRACE2); return new CAttr(info(), true, name, e == null ? Empty.SEQ : e); } /** * Parses the "CompNamespaceConstructor" rule. * @return query expression * @throws QueryException query exception */ private Expr compNamespace() throws QueryException { if(!ctx.sc.xquery3()) return null; skipWS(); Expr name; final byte[] str = ncName(null); if(str.length != 0) { name = Str.get(str); } else { if(!wsConsume(BRACE1)) return null; name = check(expr(), NSWRONG); wsCheck(BRACE2); } if(!wsConsume(BRACE1)) return null; final Expr e = expr(); wsCheck(BRACE2); return new CNSpace(info(), name, e == null ? Empty.SEQ : e); } /** * Parses the "CompTextConstructor" rule. * @return query expression * @throws QueryException query exception */ private Expr compText() throws QueryException { if(!wsConsume(BRACE1)) return null; final Expr e = check(expr(), NOTXTCONS); wsCheck(BRACE2); return new CTxt(info(), e); } /** * Parses the "CompCommentConstructor" rule. * @return query expression * @throws QueryException query exception */ private Expr compComment() throws QueryException { if(!wsConsume(BRACE1)) return null; final Expr e = check(expr(), NOCOMCONS); wsCheck(BRACE2); return new CComm(info(), e); } /** * Parses the "CompPIConstructor" rule. * @return query expression * @throws QueryException query exception */ private Expr compPI() throws QueryException { skipWS(); Expr name; final byte[] str = ncName(null); if(str.length != 0) { name = Str.get(str); } else { if(!wsConsume(BRACE1)) return null; name = check(expr(), PIWRONG); wsCheck(BRACE2); } if(!wsConsume(BRACE1)) return null; final Expr e = expr(); wsCheck(BRACE2); return new CPI(info(), name, e == null ? Empty.SEQ : e); } /** * Parses the "SimpleType" rule. * @return sequence type * @throws QueryException query exception */ private SeqType simpleType() throws QueryException { skipWS(); final QNm name = eQName(TYPEINVALID, ctx.sc.elemNS); Type t = ListType.find(name); if(t == null) { t = AtomType.find(name, false); if(t == null) { if(wsConsume(PAR1)) error(SIMPLETYPE, name); if(ctx.sc.xquery3) { if(!AtomType.AST.name.eq(name)) error(TYPEUNKNOWN30, name); t = AtomType.AST; } else { error(TYPEUNKNOWN, name); } } if(t == AtomType.AST || t == AtomType.AAT || t == AtomType.NOT) error(CASTUNKNOWN, name); } skipWS(); return SeqType.get(t, consume('?') ? Occ.ZERO_ONE : Occ.ONE); } /** * Parses the "SequenceType" rule. * Parses the "OccurrenceIndicator" rule. * Parses the "KindTest" rule. * @return sequence type * @throws QueryException query exception */ private SeqType sequenceType() throws QueryException { // empty sequence if(wsConsumeWs(EMPTY_SEQUENCE, PAR1, null)) { wsCheck(PAR1); wsCheck(PAR2); return SeqType.get(AtomType.ITEM, Occ.ZERO, null); } // parse item type and occurrence indicator final SeqType tw = itemType(); skipWS(); final Occ occ = consume('?') ? Occ.ZERO_ONE : consume('+') ? Occ.ONE_MORE : consume('*') ? Occ.ZERO_MORE : Occ.ONE; skipWS(); return tw.withOcc(occ); } /** * Parses the "ItemType" rule. * Parses the "ParenthesizedItemType" rule. * @return item type * @throws QueryException query exception */ private SeqType itemType() throws QueryException { skipWS(); // parenthesized item type if(consume(PAR1)) { final SeqType ret = itemType(); wsCheck(PAR2); return ret; } // parse optional annotation and type name final Ann ann = ctx.sc.xquery3() && curr('%') ? annotations() : null; final QNm name = eQName(TYPEINVALID, null); skipWS(); // check if name is followed by parentheses final boolean func = curr('('); // item type Type t = null; if(func) { consume(PAR1); // item type if(name.eq(AtomType.ITEM.name)) t = AtomType.ITEM; // node types if(t == null) t = NodeType.find(name); // function types if(t == null) { t = FuncType.find(name); if(t != null) return functionTest(ann, t).seqType(); } // no type found if(t == null) error(NOTYPE, name.string()); } else { // attach default element namespace if(!name.hasURI()) name.uri(ctx.sc.elemNS); // atomic types t = AtomType.find(name, false); // no type found if(t == null) error(TYPEUNKNOWN, name); } // annotations are not allowed for remaining types if(ann != null) error(NOANN); // atomic value, or closing parenthesis if(!func || wsConsume(PAR2)) return t.seqType(); // raise error if type different to node is not finalized by a parenthesis if(!(t instanceof NodeType)) wsCheck(PAR2); // return type with an optional kind test for node types return SeqType.get(t, SeqType.Occ.ONE, kindTest((NodeType) t)); } /** * Parses the "FunctionTest" rule. * @param ann annotations * @param t function type * @return resulting type * @throws QueryException query exception */ private Type functionTest(final Ann ann, final Type t) throws QueryException { // wildcard if(wsConsume(ASTERISK)) { wsCheck(PAR2); return t; } // map if(t instanceof MapType) { final Type key = itemType().type; if(!key.instanceOf(AtomType.AAT)) error(MAPTAAT, key); wsCheck(COMMA); final Type tp = MapType.get((AtomType) key, sequenceType()); wsCheck(PAR2); return tp; } // function type SeqType[] args = { }; if(!wsConsume(PAR2)) { // function has got arguments do args = Array.add(args, sequenceType()); while(wsConsume(COMMA)); wsCheck(PAR2); } wsCheck(AS); final SeqType st = sequenceType(); return FuncType.get(ann, st, args); } /** * Parses the "ElementTest" rule without the type name and the opening bracket. * @param t type * @return arguments * @throws QueryException query exception */ private Test kindTest(final NodeType t) throws QueryException { Test tp = null; switch(t) { case DOC: tp = documentTest(); break; case ELM: tp = elementTest(); break; case ATT: tp = attributeTest(); break; case PI: tp = piTest(); break; case SCE: case SCA: tp = schemaTest(); break; default: break; } wsCheck(PAR2); if(tp != null) return tp; tp = Test.get(t); if(tp == Test.NSP && !ctx.sc.xquery3) error(NSNOTALL); return tp; } /** * Parses the "DocumentTest" rule without the leading keyword and its brackets. * @return arguments * @throws QueryException query exception */ private Test documentTest() throws QueryException { final boolean elem = consume(ELEMENT); if(!elem && !consume(SCHEMA_ELEMENT)) return null; wsCheck(PAR1); final Test t = elem ? elementTest() : schemaTest(); wsCheck(PAR2); return new DocTest(t != null ? t : Test.ELM); } /** * Parses the "ElementTest" rule without the leading keyword and its brackets. * @return arguments * @throws QueryException query exception */ private Test elementTest() throws QueryException { final QNm name = eQName(null, ctx.sc.elemNS); if(name == null && !consume(ASTERISK)) return null; Type type = null; if(wsConsumeWs(COMMA)) { // parse type name final QNm tn = eQName(QNAMEINV, ctx.sc.elemNS); type = ListType.find(tn); if(type == null) type = AtomType.find(tn, true); if(type == null) error(TYPEUNDEF, tn); // parse optional question mark wsConsume(PLHOLDER); } return new NodeTest(NodeType.ELM, name, type, ctx.sc.strip); } /** * Parses the "ElementTest" rule without the leading keyword and its brackets. * @return arguments * @throws QueryException query exception */ private Test schemaTest() throws QueryException { final QNm name = eQName(QNAMEINV, ctx.sc.elemNS); throw error(SCHEMAINV, name); } /** * Parses the "AttributeTest" rule without the leading keyword and its brackets. * @return arguments * @throws QueryException query exception */ private Test attributeTest() throws QueryException { final QNm name = eQName(null, null); if(name == null && !consume(ASTERISK)) return null; Type type = null; if(wsConsumeWs(COMMA)) { // parse type name final QNm tn = eQName(QNAMEINV, ctx.sc.elemNS); type = ListType.find(tn); if(type == null) type = AtomType.find(tn, true); if(type == null) error(TYPEUNDEF, tn); } return new NodeTest(NodeType.ATT, name, type, ctx.sc.strip); } /** * Parses the "PITest" rule without the leading keyword and its brackets. * @return arguments * @throws QueryException query exception */ private Test piTest() throws QueryException { final byte[] nm; tok.reset(); if(quote(curr())) { nm = trim(stringLiteral()); if(!XMLToken.isNCName(nm)) error(INVNCNAME, nm); } else if(ncName()) { nm = tok.finish(); } else { return null; } return new NodeTest(NodeType.PI, new QNm(nm)); } /** * Parses the "TryCatch" rules. * @return query expression * @throws QueryException query exception */ private Expr tryCatch() throws QueryException { if(!ctx.sc.xquery3() || !wsConsumeWs(TRY)) return null; final Expr tr = enclosed(NOENCLEXPR); wsCheck(CATCH); Catch[] ct = { }; do { NameTest[] codes = { }; do { skipWS(); final NameTest test = (NameTest) nodeTest(false, false); if(test == null) error(NOCATCH); codes = Array.add(codes, test); } while(wsConsumeWs(PIPE)); final int s = scope.open(); final Catch c = new Catch(info(), codes, ctx, scope); c.expr = enclosed(NOENCLEXPR); scope.close(s); ct = Array.add(ct, c); } while(wsConsumeWs(CATCH)); return new Try(info(), tr, ct); } /** * Parses the "FTSelection" rules. * @param prg pragma flag * @return query expression * @throws QueryException query exception */ private FTExpr ftSelection(final boolean prg) throws QueryException { FTExpr expr = ftOr(prg); FTExpr old; FTExpr first = null; boolean ordered = false; do { old = expr; if(wsConsumeWs(ORDERED)) { ordered = true; old = null; } else if(wsConsumeWs(WINDOW)) { expr = new FTWindow(info(), expr, additive(), ftUnit()); } else if(wsConsumeWs(DISTANCE)) { final Expr[] rng = ftRange(false); if(rng == null) error(FTRANGE); expr = new FTDistance(info(), expr, rng, ftUnit()); } else if(wsConsumeWs(AT)) { final boolean start = wsConsumeWs(START); final boolean end = !start && wsConsumeWs(END); if(!start && !end) error(INCOMPLETE); expr = new FTContent(info(), expr, start, end); } else if(wsConsumeWs(ENTIRE)) { wsCheck(CONTENT); expr = new FTContent(info(), expr, false, false); } else { final boolean same = wsConsumeWs(SAME); final boolean diff = !same && wsConsumeWs(DIFFERENT); if(same || diff) { FTUnit unit = null; if(wsConsumeWs(SENTENCE)) unit = FTUnit.SENTENCE; else if(wsConsumeWs(PARAGRAPH)) unit = FTUnit.PARAGRAPH; else error(INCOMPLETE); expr = new FTScope(info(), expr, unit, same); } } if(first == null && old != null && old != expr) first = expr; } while(old != expr); if(ordered) { if(first == null) return new FTOrder(info(), expr); first.expr[0] = new FTOrder(info(), first.expr[0]); } return expr; } /** * Parses the "FTOr" rule. * @param prg pragma flag * @return query expression * @throws QueryException query exception */ private FTExpr ftOr(final boolean prg) throws QueryException { final FTExpr e = ftAnd(prg); if(!wsConsumeWs(FTOR)) return e; FTExpr[] list = { e }; do list = Array.add(list, ftAnd(prg)); while(wsConsumeWs(FTOR)); return new FTOr(info(), list); } /** * Parses the "FTAnd" rule. * @param prg pragma flag * @return query expression * @throws QueryException query exception */ private FTExpr ftAnd(final boolean prg) throws QueryException { final FTExpr e = ftMildNot(prg); if(!wsConsumeWs(FTAND)) return e; FTExpr[] list = { e }; do list = Array.add(list, ftMildNot(prg)); while(wsConsumeWs(FTAND)); return new FTAnd(info(), list); } /** * Parses the "FTMildNot" rule. * @param prg pragma flag * @return query expression * @throws QueryException query exception */ private FTExpr ftMildNot(final boolean prg) throws QueryException { final FTExpr e = ftUnaryNot(prg); if(!wsConsumeWs(NOT)) return e; FTExpr[] list = { }; do { wsCheck(IN); list = Array.add(list, ftUnaryNot(prg)); } while(wsConsumeWs(NOT)); // convert "A not in B not in ..." to "A not in(B or ...)" return new FTMildNot(info(), e, list.length == 1 ? list[0] : new FTOr( info(), list)); } /** * Parses the "FTUnaryNot" rule. * @param prg pragma flag * @return query expression * @throws QueryException query exception */ private FTExpr ftUnaryNot(final boolean prg) throws QueryException { final boolean not = wsConsumeWs(FTNOT); final FTExpr e = ftPrimaryWithOptions(prg); return not ? new FTNot(info(), e) : e; } /** * Parses the "FTPrimaryWithOptions" rule. * @param prg pragma flag * @return query expression * @throws QueryException query exception */ private FTExpr ftPrimaryWithOptions(final boolean prg) throws QueryException { FTExpr expr = ftPrimary(prg); final FTOpt fto = new FTOpt(); boolean found = false; while(ftMatchOption(fto)) found = true; // check if specified language is not available if(fto.ln == null) fto.ln = Language.def(); if(!Tokenizer.supportFor(fto.ln)) error(FTNOTOK, fto.ln); if(fto.is(ST) && fto.sd == null && !Stemmer.supportFor(fto.ln)) error(FTNOSTEM, fto.ln); // consume weight option if(wsConsumeWs(WEIGHT)) expr = new FTWeight(info(), expr, enclosed(NOENCLEXPR)); // skip options if none were specified... return found ? new FTOptions(info(), expr, fto) : expr; } /** * Parses the "FTPrimary" rule. * @param prg pragma flag * @return query expression * @throws QueryException query exception */ private FTExpr ftPrimary(final boolean prg) throws QueryException { final Pragma[] pragmas = pragma(); if(pragmas != null) { wsCheck(BRACE1); final FTExpr e = ftSelection(true); wsCheck(BRACE2); return new FTExtensionSelection(info(), pragmas, e); } if(wsConsumeWs(PAR1)) { final FTExpr e = ftSelection(false); wsCheck(PAR2); return e; } skipWS(); Expr e = null; if(quote(curr())) { e = Str.get(stringLiteral()); } else if(curr('{')) { e = enclosed(NOENCLEXPR); } else { error(prg ? NOPRAGMA : NOFTSELECT, found()); } // FTAnyAllOption FTMode mode = FTMode.ANY; if(wsConsumeWs(ALL)) { mode = wsConsumeWs(WORDS) ? FTMode.ALL_WORDS : FTMode.ALL; } else if(wsConsumeWs(ANY)) { mode = wsConsumeWs(WORD) ? FTMode.ANY_WORD : FTMode.ANY; } else if(wsConsumeWs(PHRASE)) { mode = FTMode.PHRASE; } // FTTimes Expr[] occ = null; if(wsConsumeWs(OCCURS)) { occ = ftRange(false); if(occ == null) error(FTRANGE); wsCheck(TIMES); } return new FTWords(info(), e, mode, occ); } /** * Parses the "FTRange" rule. * @param i accept only integers ("FTLiteralRange") * @return query expression * @throws QueryException query exception */ private Expr[] ftRange(final boolean i) throws QueryException { final Expr[] occ = { Int.get(1), Int.get(Long.MAX_VALUE)}; if(wsConsumeWs(EXACTLY)) { occ[0] = ftAdditive(i); occ[1] = occ[0]; } else if(wsConsumeWs(AT)) { if(wsConsumeWs(LEAST)) { occ[0] = ftAdditive(i); } else { wsCheck(MOST); occ[0] = Int.get(0); occ[1] = ftAdditive(i); } } else if(wsConsumeWs(FROM)) { occ[0] = ftAdditive(i); wsCheck(TO); occ[1] = ftAdditive(i); } else { return null; } return occ; } /** * Returns an argument of the "FTRange" rule. * @param i accept only integers * @return query expression * @throws QueryException query exception */ private Expr ftAdditive(final boolean i) throws QueryException { if(!i) return additive(); skipWS(); tok.reset(); while(digit(curr())) tok.add(consume()); if(tok.isEmpty()) error(INTEXP); return Int.get(toLong(tok.finish())); } /** * Parses the "FTUnit" rule. * @return query expression * @throws QueryException query exception */ private FTUnit ftUnit() throws QueryException { if(wsConsumeWs(WORDS)) return FTUnit.WORD; if(wsConsumeWs(SENTENCES)) return FTUnit.SENTENCE; if(wsConsumeWs(PARAGRAPHS)) return FTUnit.PARAGRAPH; error(INCOMPLETE); return null; } /** * Parses the "FTMatchOption" rule. * @param opt options instance * @return false if no options were found * @throws QueryException query exception */ private boolean ftMatchOption(final FTOpt opt) throws QueryException { if(!wsConsumeWs(USING)) return false; if(wsConsumeWs(LOWERCASE)) { if(opt.isSet(LC) || opt.isSet(UC) || opt.isSet(CS)) error(FTDUP, CASE); opt.set(CS, true); opt.set(LC, true); } else if(wsConsumeWs(UPPERCASE)) { if(opt.isSet(LC) || opt.isSet(UC) || opt.isSet(CS)) error(FTDUP, CASE); opt.set(CS, true); opt.set(UC, true); } else if(wsConsumeWs(CASE)) { if(opt.isSet(LC) || opt.isSet(UC) || opt.isSet(CS)) error(FTDUP, CASE); opt.set(CS, wsConsumeWs(SENSITIVE)); if(!opt.is(CS)) wsCheck(INSENSITIVE); } else if(wsConsumeWs(DIACRITICS)) { if(opt.isSet(DC)) error(FTDUP, DIACRITICS); opt.set(DC, wsConsumeWs(SENSITIVE)); if(!opt.is(DC)) wsCheck(INSENSITIVE); } else if(wsConsumeWs(LANGUAGE)) { if(opt.ln != null) error(FTDUP, LANGUAGE); final byte[] lan = stringLiteral(); opt.ln = Language.get(string(lan)); if(opt.ln == null) error(FTNOTOK, lan); } else if(wsConsumeWs(OPTION)) { optionDecl(); } else { final boolean using = !wsConsumeWs(NO); if(wsConsumeWs(STEMMING)) { if(opt.isSet(ST)) error(FTDUP, STEMMING); opt.set(ST, using); } else if(wsConsumeWs(THESAURUS)) { if(opt.th != null) error(FTDUP, THESAURUS); opt.th = new ThesQuery(); if(using) { final boolean par = wsConsume(PAR1); if(!wsConsumeWs(DEFAULT)) ftThesaurusID(opt.th); while(par && wsConsume(COMMA)) ftThesaurusID(opt.th); if(par) wsCheck(PAR2); } } else if(wsConsumeWs(STOP)) { // add union/except wsCheck(WORDS); if(opt.sw != null) error(FTDUP, STOP + ' ' + WORDS); opt.sw = new StopWords(); if(wsConsumeWs(DEFAULT)) { if(!using) error(FTSTOP); } else { boolean union = false; boolean except = false; while(using) { if(wsConsume(PAR1)) { do { final byte[] sl = stringLiteral(); if(except) opt.sw.delete(sl); else if(!union || !opt.sw.contains(sl)) opt.sw.add(sl); } while(wsConsume(COMMA)); wsCheck(PAR2); } else if(wsConsumeWs(AT)) { final String fn = string(stringLiteral()); // optional: resolve URI reference final IO fl = ctx.stop != null ? ctx.stop.get(fn) : ctx.sc.io(fn); if(!opt.sw.read(fl, except)) error(NOSTOPFILE, fl); } else if(!union && !except) { error(FTSTOP); } union = wsConsumeWs(UNION); except = !union && wsConsumeWs(EXCEPT); if(!union && !except) break; } } } else if(wsConsumeWs(WILDCARDS)) { if(opt.isSet(WC)) error(FTDUP, WILDCARDS); if(opt.is(FZ)) error(BXFT_MATCH); opt.set(WC, using); } else if(wsConsumeWs(FUZZY)) { // extension to the official extension: "using fuzzy" if(opt.isSet(FZ)) error(FTDUP, FUZZY); if(opt.is(WC)) error(BXFT_MATCH); opt.set(FZ, using); } else { error(FTMATCH, consume()); return false; } } return true; } /** * Parses the "FTThesaurusID" rule. * @param thes link to thesaurus * @throws QueryException query exception */ private void ftThesaurusID(final ThesQuery thes) throws QueryException { wsCheck(AT); final String fn = string(stringLiteral()); // optional: resolve URI reference final IO fl = ctx.thes != null ? ctx.thes.get(fn) : ctx.sc.io(fn); final byte[] rel = wsConsumeWs(RELATIONSHIP) ? stringLiteral() : EMPTY; final Expr[] range = ftRange(true); long min = 0; long max = Long.MAX_VALUE; if(range != null) { wsCheck(LEVELS); // values will always be integer instances min = ((Int) range[0]).itr(); max = ((Int) range[1]).itr(); } thes.add(new Thesaurus(fl, rel, min, max, ctx.context)); } /** * Parses the "InsertExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr insert() throws QueryException { final int i = pos; if(!wsConsumeWs(INSERT) || !wsConsumeWs(NODE) && !wsConsumeWs(NODES)) { pos = i; return null; } final Expr s = check(single(), INCOMPLETE); boolean first = false; boolean last = false; boolean before = false; boolean after = false; if(wsConsumeWs(AS)) { first = wsConsumeWs(FIRST); if(!first) { wsCheck(LAST); last = true; } wsCheck(INTO); } else if(!wsConsumeWs(INTO)) { after = wsConsumeWs(AFTER); before = !after && wsConsumeWs(BEFORE); if(!after && !before) error(INCOMPLETE); } final Expr trg = check(single(), INCOMPLETE); ctx.updating(true); return new Insert(info(), s, first, last, before, after, trg); } /** * Parses the "DeleteExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr deletee() throws QueryException { final int i = pos; if(!wsConsumeWs(DELETE) || !wsConsumeWs(NODES) && !wsConsumeWs(NODE)) { pos = i; return null; } ctx.updating(true); return new Delete(info(), check(single(), INCOMPLETE)); } /** * Parses the "RenameExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr rename() throws QueryException { final int i = pos; if(!wsConsumeWs(RENAME) || !wsConsumeWs(NODE)) { pos = i; return null; } final Expr trg = check(single(), INCOMPLETE); wsCheck(AS); final Expr n = check(single(), INCOMPLETE); ctx.updating(true); return new Rename(info(), trg, n); } /** * Parses the "ReplaceExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr replace() throws QueryException { final int i = pos; if(!wsConsumeWs(REPLACE)) return null; final boolean v = wsConsumeWs(VALUEE); if(v) { wsCheck(OF); wsCheck(NODE); } else if(!wsConsumeWs(NODE)) { pos = i; return null; } final Expr t = check(single(), INCOMPLETE); wsCheck(WITH); final Expr r = check(single(), INCOMPLETE); ctx.updating(true); return new Replace(info(), t, r, v); } /** * Parses the "TransformExpr" rule. * @return query expression * @throws QueryException query exception */ private Expr transform() throws QueryException { if(!wsConsumeWs(COPY, DOLLAR, INCOMPLETE)) return null; final int s = scope.open(); final boolean u = ctx.updating; ctx.updating(false); Let[] fl = { }; do { final QNm name = varName(); wsCheck(ASSIGN); final Expr e = check(single(), INCOMPLETE); fl = Array.add(fl, new Let(addLocal(name, SeqType.NOD, false), e, false, info())); } while(wsConsumeWs(COMMA)); wsCheck(MODIFY); final Expr m = check(single(), INCOMPLETE); wsCheck(RETURN); final Expr r = check(single(), INCOMPLETE); scope.close(s); ctx.updating = u; return new Transform(info(), fl, m, r); } /** * Parses the "NCName" rule. * @param err optional error message * @return string * @throws QueryException query exception */ private byte[] ncName(final Err err) throws QueryException { tok.reset(); if(ncName()) return tok.finish(); if(err != null) error(err, consume()); return EMPTY; } /** * Parses the "EQName" rule. * @param err optional error message. Will be thrown if no EQName is found, * or ignored if set to {@code null} * @param def default namespace, or operation mode * ({@link #URICHECK}, {@link #SKIPCHECK}) * @return string * @throws QueryException query exception */ private QNm eQName(final Err err, final byte[] def) throws QueryException { final int i = pos; if(ctx.sc.xquery3() && consume(EQNAME)) { final byte[] uri = bracedURILiteral(); final byte[] name = ncName(null); if(name.length != 0) { if(def == URICHECK && uri.length == 0) { pos = i; error(NOURI, name); } return new QNm(name, uri); } pos = i; } // parse QName final byte[] nm = qName(err); if(nm.length == 0) return null; if(def == SKIPCHECK) return new QNm(nm); // create new EQName and set namespace final QNm name = new QNm(nm, ctx); if(!name.hasURI()) { if(def == URICHECK) { pos = i; error(NSMISS, name); } if(name.hasPrefix()) { pos = i; error(NOURI, name); } name.uri(def); } return name; } /** * Parses the "QName" rule. * @param err optional error message. Will be thrown if no QName is found, and * ignored if set to {@code null} * @return string * @throws QueryException query exception */ private byte[] qName(final Err err) throws QueryException { tok.reset(); if(!ncName()) { if(err != null) error(err, consume()); } else if(consume(':')) { if(!XMLToken.isNCStartChar(curr())) { --pos; } else { tok.add(':'); do { tok.add(consume()); } while(XMLToken.isNCChar(curr())); } } return tok.finish(); } /** * Helper method for parsing NCNames. * @return true for success */ private boolean ncName() { if(!XMLToken.isNCStartChar(curr())) return false; do tok.add(consume()); while(XMLToken.isNCChar(curr())); return true; } /** * Parses and converts entities. * @param tb token builder * @return true if an entity was found * @throws QueryException query exception */ private boolean entity(final TokenBuilder tb) throws QueryException { final int i = pos; final boolean ent = consume('&'); if(ent) { if(consume('#')) { final int b = consume('x') ? 0x10 : 10; boolean ok = true; int n = 0; do { final char c = curr(); final boolean m = digit(c); final boolean h = b == 0x10 && (c >= 'a' && c <= 'f' || c >= 'A' && c <= 'F'); if(!m && !h) entityError(i, INVENTITY); final long nn = n; n = n * b + (consume() & 0xF); if(n < nn) ok = false; if(!m) n += 9; } while(!consume(';')); if(!ok) entityError(i, INVCHARREF); if(!XMLToken.valid(n)) entityError(i, INVCHARREF); tb.add(n); } else { if(consume("lt")) { tb.add('<'); } else if(consume("gt")) { tb.add('>'); } else if(consume("amp")) { tb.add('&'); } else if(consume("quot")) { tb.add('"'); } else if(consume("apos")) { tb.add('\''); } else { entityError(i, INVENTITY); } if(!consume(';')) entityError(i, INVENTITY); } } else { final char c = consume(); int ch = c; if(Character.isHighSurrogate(c) && curr() != 0 && Character.isLowSurrogate(curr())) { ch = Character.toCodePoint(c, consume()); } if(ch == '\r') { ch = '\n'; if(curr(ch)) consume(); } tb.add(ch); } return ent; } /** * Raises an entity error. * @param p start position * @param c error code * @throws QueryException query exception */ private void entityError(final int p, final Err c) throws QueryException { final String sub = input.substring(p, Math.min(p + 20, length)); final int sc = sub.indexOf(';'); final String ent = sc != -1 ? sub.substring(0, sc + 1) : sub + "..."; error(c, ent); } /** * Raises an error if the specified expression is empty. * @param expression type * @param expr expression * @param err error message * @return expression * @throws QueryException query exception */ private E check(final E expr, final Err err) throws QueryException { if(expr == null) error(err); return expr; } /** * Raises an error if the specified character cannot be consumed. * @param ch character to be found * @throws QueryException query exception */ private void check(final int ch) throws QueryException { if(!consume(ch)) error(WRONGCHAR, (char) ch, found()); } /** * Skips whitespaces, raises an error if the specified string cannot be * consumed. * @param s string to be found * @throws QueryException query exception */ private void wsCheck(final String s) throws QueryException { if(!wsConsume(s)) error(WRONGCHAR, s, found()); } /** * Checks if a referenced variable is defined and throws the specified error if not. * @param name variable name * @return referenced variable * @throws QueryException if the variable isn't defined */ private Expr checkVar(final QNm name) throws QueryException { // local variable final InputInfo ii = info(); final VarRef local = scope.resolve(name, ctx, ii); if(local != null) return local; // static variable final byte[] uri = name.uri(); // in XQuery 1.0 only forward declarations are allowed (except for implicit variables) final boolean main = module == null, implicit = main && uri.length == 0; if(!(ctx.sc.xquery3() || ctx.vars.declared(name) || implicit)) { error(VARUNDEF, '$' + string(name.string())); } // variable has to be declared by the same or a directly imported module if(!(main || eq(module.uri(), uri) || modules.contains(uri))) error(VARUNDEF, '$' + string(name.string())); return ctx.vars.newRef(name, ctx.sc, ii); } /** * Checks if the specified character is not found. An error is raised if the * input is exhausted. * @param ch character to be found * @return result of check * @throws QueryException query exception */ private boolean not(final char ch) throws QueryException { final char c = curr(); if(c == 0) error(WRONGCHAR, ch, found()); return c != ch; } /** * Consumes the specified token and surrounding whitespaces. * @param t token to consume * @return true if token was found * @throws QueryException query exception */ private boolean wsConsumeWs(final String t) throws QueryException { final int i = pos; if(!wsConsume(t)) return false; if(skipWS() || !XMLToken.isNCStartChar(t.charAt(0)) || !XMLToken.isNCChar(curr())) return true; pos = i; return false; } /** * Consumes the specified two strings or jumps back to the old query position. * If the strings are found, the cursor is placed after the first token. * @param s1 string to be consumed * @param s2 second string * @param expr alternative error message * @return result of check * @throws QueryException query exception */ private boolean wsConsumeWs(final String s1, final String s2, final Err expr) throws QueryException { final int i = pos; if(!wsConsumeWs(s1)) return false; alter = expr; alterPos = pos; final int i2 = pos; final boolean ok = wsConsume(s2); pos = ok ? i2 : i; return ok; } /** * Skips whitespaces, consumes the specified string and ignores trailing * characters. * @param str string to consume * @return true if string was found * @throws QueryException query exception */ private boolean wsConsume(final String str) throws QueryException { skipWS(); return consume(str); } /** * Consumes all whitespace characters from the remaining query. * @return true if whitespaces were found * @throws QueryException query exception */ private boolean skipWS() throws QueryException { final int i = pos; while(more()) { final int c = curr(); if(c == '(' && next() == ':') { comment(); } else { if(c <= 0 || c > ' ') return i != pos; ++pos; } } return i != pos; } /** * Consumes a comment. * @throws QueryException query exception */ private void comment() throws QueryException { ++pos; final boolean doc = next() == '~'; if(doc) { currDoc.setLength(0); ++pos; } while(++pos < length) { char curr = curr(); if(curr == '(' && next() == ':') { comment(); curr = curr(); } if(curr == ':' && next() == ')') { pos += 2; if(moduleDoc.isEmpty()) { moduleDoc = currDoc.toString().trim(); currDoc.setLength(0); } return; } if(doc) currDoc.append(curr); } error(COMCLOSE); } /** * Consumes all following whitespace characters. * @return true if whitespaces were found */ private boolean consumeWS() { final int i = pos; while(more()) { final int c = curr(); if(c <= 0 || c > ' ') return i != pos; ++pos; } return true; } /** * Throws the alternative error message. * @return never * @throws QueryException query exception */ private QueryException error() throws QueryException { pos = alterPos; if(alter != FUNCUNKNOWN) error(alter); ctx.funcs.errorIfSimilar(alterFunc, info()); throw error(alter, alterFunc.string()); } /** * Adds an expression to the specified array. * @param ar input array * @param e new expression * @throws QueryException query exception */ private void add(final ExprList ar, final Expr e) throws QueryException { if(e == null) error(INCOMPLETE); ar.add(e); } /** * Throws the specified error. * @param err error to be thrown * @param arg error arguments * @return never * @throws QueryException query exception */ public QueryException error(final Err err, final Object... arg) throws QueryException { throw err.thrw(info(), arg); } /** * Finalizes the QNames by assigning namespace URIs. * @param npos first entry to be checked * @throws QueryException query exception */ private void assignURI(final int npos) throws QueryException { for(int i = npos; i < names.size(); i++) { if(names.get(i).assign(npos == 0)) names.remove(i--); } } /** Cache for checking QNames after their construction. */ private class QNmCheck { /** QName to be checked. */ final QNm name; /** Flag for assigning default element namespace. */ final boolean nsElem; /** * Constructor. * @param nm qname */ QNmCheck(final QNm nm) { this(nm, true); } /** * Constructor. * @param nm qname * @param nse default check */ QNmCheck(final QNm nm, final boolean nse) { name = nm; nsElem = nse; } /** * Assigns the namespace URI that is currently in scope. * @param check check if prefix URI was assigned * @return true if URI has a URI * @throws QueryException query exception */ boolean assign(final boolean check) throws QueryException { if(name.hasURI()) return true; if(name.hasPrefix()) { name.uri(ctx.sc.ns.uri(name.prefix())); if(check && !name.hasURI()) error(NOURI, name.string()); } else if(nsElem) { name.uri(ctx.sc.elemNS); } return name.hasURI(); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/QueryProcessor.java000066400000000000000000000207721222453003200262240ustar00rootroot00000000000000package org.basex.query; import static org.basex.core.Text.*; import static org.basex.query.util.Err.*; import java.io.*; import java.util.regex.*; import org.basex.core.*; import org.basex.core.Context; import org.basex.data.*; import org.basex.io.serial.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.json.*; import org.basex.query.value.*; import org.basex.query.value.node.*; /** * This class is an entry point for evaluating XQuery implementations. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class QueryProcessor extends Proc { /** Pattern for detecting library modules. */ private static final Pattern LIBMOD_PATTERN = Pattern.compile( "^(xquery( version ['\"].*?['\"])?( encoding ['\"].*?['\"])? ?; ?)?module namespace.*"); /** Expression context. */ public final QueryContext ctx; /** Query. */ private final String query; /** Parsed flag. */ private boolean parsed; /** Compilation flag. */ private boolean compiled; /** * Default constructor. * @param qu query to process * @param cx database context */ public QueryProcessor(final String qu, final Context cx) { query = qu; ctx = proc(new QueryContext(cx)); } /** * Parses the query. * @throws QueryException query exception */ public void parse() throws QueryException { if(parsed) return; parsed = true; ctx.parseMain(query, null); updating = ctx.updating; } /** * Compiles the query. * @throws QueryException query exception */ public void compile() throws QueryException { if(compiled) return; compiled = true; parse(); ctx.compile(); } /** * Returns a result iterator. * @return result iterator * @throws QueryException query exception */ public Iter iter() throws QueryException { compile(); return ctx.iter(); } /** * Returns a result value. * @return result value * @throws QueryException query exception */ public Value value() throws QueryException { compile(); return ctx.value(); } /** * Evaluates the specified query and returns the result. * @return result of query * @throws QueryException query exception */ public Result execute() throws QueryException { compile(); return ctx.execute(); } /** * Binds a value with the specified data type to a global variable. * If the value is an {@link Expr} instance, it is directly assigned. * Otherwise, it is first cast to the appropriate XQuery type. If {@code "json"} * is specified as data type, the value is interpreted according to the rules * specified in {@link JsonMapConverter}. * @param name name of variable * @param value value to be bound * @param type data type (may be {@code null}) * @return self reference * @throws QueryException query exception */ public QueryProcessor bind(final String name, final Object value, final String type) throws QueryException { ctx.bind(name, value, type); return this; } /** * Binds a value to a global variable. * @param name name of variable * @param value value to be bound * @return self reference * @throws QueryException query exception */ public QueryProcessor bind(final String name, final Object value) throws QueryException { return bind(name, value, null); } /** * Binds a value to the context item. * @param value value to be bound * @return self reference * @throws QueryException query exception */ public QueryProcessor context(final Object value) throws QueryException { return context(value, null); } /** * Binds a value with the specified data type to the context item, * using the same rules as for {@link #bind binding variables}. * @param value value to be bound * @param type data type (may be {@code null}) * @return self reference * @throws QueryException query exception */ public QueryProcessor context(final Object value, final String type) throws QueryException { ctx.context(value, type); return this; } /** * Binds an initial nodeset to the context item. * @param nodes node set * @return self reference */ public QueryProcessor context(final Nodes nodes) { ctx.nodes = nodes; return this; } /** * Declares a namespace. * A namespace is undeclared if the {@code uri} is an empty string. * The default element namespaces is set if the {@code prefix} is empty. * @param prefix namespace prefix * @param uri namespace uri * @return self reference * @throws QueryException query exception */ public QueryProcessor namespace(final String prefix, final String uri) throws QueryException { ctx.sc.namespace(prefix, uri); return this; } /** * Returns a serializer for the given output stream. * Optional output declarations within the query will be included in the * serializer instance. * @param os output stream * @return serializer instance * @throws IOException query exception * @throws QueryException query exception */ public Serializer getSerializer(final OutputStream os) throws IOException, QueryException { compile(); try { return Serializer.get(os, ctx.serParams(true)); } catch(final SerializerException ex) { throw ex.getCause(); } } /** * Evaluates the specified query and returns the result nodes. * @return result nodes * @throws QueryException query exception */ public Nodes queryNodes() throws QueryException { final Result res = execute(); if(res instanceof Nodes) return (Nodes) res; // throw error if(res.size() != 0) BXDB_DBRETURN.thrw(null); // return empty result set return new Nodes(ctx.nodes.data); } /** * Adds a module reference. Only called from the test APIs. * @param uri module uri * @param file file name */ public void module(final String uri, final String file) { ctx.modDeclared.put(uri, file); } /** * Returns the query string. * @return query */ public String query() { return query; } /** * Closes the processor. */ public void close() { ctx.close(); } @Override public void databases(final LockResult lr) { ctx.databases(lr); } /** * Returns the number of performed updates after query execution, or {@code 0}. * @return number of updates */ public int updates() { return updating ? ctx.updates.size() : 0; } /** * Returns query background information. * @return background information */ public String info() { return ctx.info(); } /** * Checks if the specified XQuery string is a library module. * @param qu query string * @return result of check */ public static boolean isLibrary(final String qu) { return LIBMOD_PATTERN.matcher(removeComments(qu, 80)).matches(); } /** * Removes comments from the specified string and returns the first characters * of a query. * @param qu query string * @param max maximum length of string to return * @return result */ public static String removeComments(final String qu, final int max) { final StringBuilder sb = new StringBuilder(); int m = 0; boolean s = false; final int cl = qu.length(); for(int c = 0; c < cl && sb.length() < max; ++c) { final char ch = qu.charAt(c); if(ch == 0x0d) continue; if(ch == '(' && c + 1 < cl && qu.charAt(c + 1) == ':') { if(m == 0 && !s) { sb.append(' '); s = true; } ++m; ++c; } else if(m != 0 && ch == ':' && c + 1 < cl && qu.charAt(c + 1) == ')') { --m; ++c; } else if(m == 0) { if(ch > ' ') sb.append(ch); else if(!s) sb.append(' '); s = ch <= ' '; } } if(sb.length() >= max) sb.append("..."); return sb.toString().trim(); } /** * Returns a tree representation of the query plan. * @return root node */ public FDoc plan() { final FDoc doc = new FDoc(); ctx.plan(doc); return doc; } @Override public String tit() { return PLEASE_WAIT_D; } @Override public String det() { return PLEASE_WAIT_D; } @Override public String toString() { return query; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/QueryRTException.java000066400000000000000000000013061222453003200264410ustar00rootroot00000000000000package org.basex.query; /** * A runtime exception wrapping a {@link QueryException}, used for throwing those out of * methods whose interface doesn't allow it. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class QueryRTException extends RuntimeException { /** * Constructor. * * @param qe query exception to wrap */ public QueryRTException(final QueryException qe) { super(qe); } @Override public QueryException getCause() { return (QueryException) super.getCause(); } @Override public synchronized Throwable fillInStackTrace() { // do nothing for performance reasons, the stack's never used anyway return this; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/QueryResources.java000066400000000000000000000247121222453003200262150ustar00rootroot00000000000000package org.basex.query; import static org.basex.query.util.Err.*; import java.io.*; import java.util.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.io.*; import org.basex.query.value.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.list.*; /** * This class provides access to resources used by an XQuery expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class QueryResources { /** Resources. */ public final HashMap resources = new HashMap(); /** Database context. */ private final QueryContext ctx; /** Opened databases. */ private Data[] data = new Data[1]; /** Number of databases. */ private int datas; /** Collections: single nodes and sequences. */ private Value[] coll = new Value[1]; /** Names of collections. */ private String[] collName = new String[1]; /** Number of collections. */ private int colls; /** * Constructor. * @param qc query context */ QueryResources(final QueryContext qc) { ctx = qc; } /** * Compiles the resources. * @param nodes input node set * @throws QueryException query exception */ void compile(final Nodes nodes) throws QueryException { final Data d = nodes.data; if(!ctx.context.perm(Perm.READ, d.meta)) BASX_PERM.thrw(null, Perm.READ); // assign initial context value final boolean root = nodes.root; ctx.value = DBNodeSeq.get(new IntList(nodes.pres), d, root, root); // create default collection: use initial node set if it contains all // documents of the database. otherwise, create new node set addCollection(root ? ctx.value : DBNodeSeq.get(d.resources.docs(), d, true, true), d.meta.name); addData(d); synchronized(ctx.context.dbs) { ctx.context.dbs.pin(d); } } /** * Closes all opened data references that have not been added by the global context. */ void close() { for(int d = 0; d < datas; d++) Close.close(data[d], ctx.context); datas = 0; } /** * Opens a new database or returns a reference to an already opened database. * @param name name of database * @param info input info * @return database instance * @throws QueryException query exception */ public Data data(final String name, final InputInfo info) throws QueryException { // check if a database with the same name has already been opened for(int d = 0; d < datas; ++d) { final String n = data[d].meta.name; if(Prop.CASE ? n.equals(name) : n.equalsIgnoreCase(name)) return data[d]; } try { // open and add new data reference final Data d = Open.open(name, ctx.context); addData(d); return d; } catch(final IOException ex) { throw BXDB_OPEN.thrw(info, ex); } } /** * Evaluates {@code fn:doc()}: opens an existing database document, or creates a new * database and node. * @param qi query input * @param info input info * @return document * @throws QueryException query exception */ public DBNode doc(final QueryInput qi, final InputInfo info) throws QueryException { // check currently opened databases for(int d = 0; d < datas; ++d) { final Data dt = data[d]; // database has a single document, input paths are matching if(dt.resources.docs().size() == 1 && IO.get(dt.meta.original).eq(qi.input)) return new DBNode(dt, 0, Data.DOC); // database instance has same name as input path final String n = dt.meta.name; if(Prop.CASE ? n.equals(qi.db) : n.equalsIgnoreCase(qi.db)) return doc(dt, qi, info); } // open new database, or create new instance Data dt = open(qi); if(dt == null) dt = create(qi, true, info); return doc(dt, qi, info); } /** * Returns the default collection. * @param info input info * @return collection * @throws QueryException query exception */ public Value collection(final InputInfo info) throws QueryException { if(colls == 0) NODEFCOLL.thrw(info); return coll[0]; } /** * Evaluates {@code fn:collection()}: opens an existing database collection, or creates * a new data reference. * @param input collection path * @param info input info * @return collection * @throws QueryException query exception */ public Value collection(final String input, final InputInfo info) throws QueryException { // merge input with base directory final IO base = ctx.sc.baseIO(); final String in = base != null ? base.merge(input).path() : null; // check currently opened collections if(in != null) { final String[] names = { in, input }; for(int c = 0; c < colls; c++) { final String n = collName[c]; if(Prop.CASE ? Token.eq(n, names) : Token.eqic(n, names)) return coll[c]; } } // check currently opened databases final QueryInput qi = new QueryInput(input); Data dt = null; for(int i = 0; i < datas; ++i) { // return database instance with the same name or file path final Data d = data[i]; final String n = d.meta.name; if(Prop.CASE ? n.equals(qi.db) : n.equalsIgnoreCase(qi.db) || IO.get(d.meta.original).eq(qi.input)) { dt = d; break; } } // open new database, or create new instance if(dt == null) dt = open(qi); if(dt == null) dt = create(qi, false, info); return DBNodeSeq.get(dt.resources.docs(qi.path), dt, true, qi.path.isEmpty()); } /** * Adds a document with the specified path. Only called from the test APIs. * @param name document identifier (may be {@code null}) * @param path documents path * @throws QueryException query exception */ public void addDoc(final String name, final String path) throws QueryException { final QueryInput qi = new QueryInput(path); final Data d = create(qi, true, null); if(name != null) d.meta.original = name; } /** * Adds a resource with the specified path. Only called from the test APIs. * @param uri resource uri * @param strings resource strings (path, encoding) */ public void addResource(final String uri, final String... strings) { resources.put(uri, strings); } /** * Adds a collection with the specified paths. Only called from the test APIs. * @param name name of collection * @param paths documents paths * @throws QueryException query exception */ public void addCollection(final String name, final String[] paths) throws QueryException { final int ns = paths.length; final DBNode[] nodes = new DBNode[ns]; for(int n = 0; n < ns; n++) { final QueryInput qi = new QueryInput(paths[n]); nodes[n] = new DBNode(create(qi, true, null), 0, Data.DOC); } addCollection(Seq.get(nodes, ns, NodeType.DOC), name); } // PRIVATE METHODS ==================================================================== /** * Tries to open the addressed database, or returns {@code null}. * @param input query input * @return data reference */ private Data open(final QueryInput input) { if(input.db != null) { try { // try to open database final Data d = Open.open(input.db, ctx.context); addData(d); return d; } catch(final IOException ex) { /* ignored */ } } return null; } /** * Creates a new database instance. * @param input query input * @param single expect single document * @param info input info * @return data reference * @throws QueryException query exception */ private Data create(final QueryInput input, final boolean single, final InputInfo info) throws QueryException { try { final Data d = createDB(input, single, info); input.path = ""; addData(d); return d; } catch(final IOException ex) { throw IOERR.thrw(info, ex); } } /** * Creates a new database instance. * @param input query input * @param single expect single document * @param info input info * @return data reference * @throws QueryException query exception * @throws IOException I/O exception */ private Data createDB(final QueryInput input, final boolean single, final InputInfo info) throws QueryException, IOException { if(input.input.exists()) return CreateDB.create(input.input, single, ctx.context); // try to create database with path relative to base uri final IO base = ctx.sc.baseIO(); if(base != null) { final String in = base.merge(input.original).path(); if(!in.equals(input.original)) return CreateDB.create(IO.get(in), single, ctx.context); } throw WHICHRES.thrw(info, input.input); } /** * Returns a single document node for the specified data reference. * @param dt data reference * @param qi query input * @param info input info * @return document node * @throws QueryException query exception */ private static DBNode doc(final Data dt, final QueryInput qi, final InputInfo info) throws QueryException { // get all document nodes of the specified database final IntList docs = dt.resources.docs(qi.path); // ensure that a single document was filtered if(docs.size() != 1) (docs.isEmpty() ? BXDB_NODOC : BXDB_SINGLE).thrw(info, qi.original); return new DBNode(dt, docs.get(0), Data.DOC); } /** * Adds a data reference. * @param d data reference to be added */ public void addData(final Data d) { if(datas == data.length) data = Array.copy(data, new Data[Array.newSize(datas)]); data[datas++] = d; } /** * Removes and closes a database if it has not been added by the global context. * @param name name of database to be removed */ public void removeData(final String name) { for(int d = ctx.nodes != null ? 1 : 0; d < datas; d++) { if(data[d].meta.name.equals(name)) { Close.close(data[d], ctx.context); Array.move(data, d + 1, -1, --datas - d); data[datas] = null; break; } } } /** * Adds a collection to the global collection list. * @param nodes collection nodes * @param name collection name */ private void addCollection(final Value nodes, final String name) { if(colls == coll.length) { final int s = Array.newSize(colls); coll = Array.copy(coll, new Value[s]); collName = Array.copyOf(collName, s); } coll[colls] = nodes; collName[colls++] = name; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/QueryStack.java000066400000000000000000000054231222453003200253060ustar00rootroot00000000000000package org.basex.query; import org.basex.query.value.Value; import org.basex.query.var.Var; import org.basex.util.InputInfo; import org.basex.util.Util; /** * The query stack, containing local variable bindings of all active scopes. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public class QueryStack { /** Initial stack size. */ private static final int INIT = 1 << 5; /** The stack. */ private Value[] stack = new Value[INIT]; /** The frame pointer, marking the start of the current stack frame. */ private int fp; /** The stack limit, marking the end of the current stack frame. */ private int sl; /** * Enters a new stack frame. * @param size size of this frame * @return stack pointer of the old frame */ public int enterFrame(final int size) { final int nsl = sl + size; if(nsl > stack.length) { int len = stack.length; do len *= 2; while(nsl > len); final Value[] nst = new Value[len]; System.arraycopy(stack, 0, nst, 0, sl); stack = nst; } final int ret = fp; fp = sl; sl = nsl; return ret; } /** * Exits a stack frame and makes all bound variables eligible for garbage collection. * @param fpt frame pointer of the underlying stack frame */ public void exitFrame(final int fpt) { while(--sl >= fp) stack[sl] = null; sl = fp; fp = fpt; if(stack.length > INIT && sl <= stack.length / 4) { int len = stack.length; do len /= 2; while(len > INIT && sl <= len / 4); final Value[] nst = new Value[len]; System.arraycopy(stack, 0, nst, 0, sl); stack = nst; } } /** * Calculates the position of the given variable on the stack. * @param v variable * @return position */ private int pos(final Var v) { final int pos = fp + v.slot; if(pos < fp || sl <= pos) throw Util.notexpected(v); return pos; } /** * Gets the value bound to the given variable in the current stack frame. * @param var variable * @return bound value */ public Value get(final Var var) { return stack[pos(var)]; } /** * Sets the value of the given variable in the current stack frame. * @param var variable to bind the value to * @param val value to bind * @param ctx query context * @param ii input info * @throws QueryException if the value does not have the right type */ public void set(final Var var, final Value val, final QueryContext ctx, final InputInfo ii) throws QueryException { stack[pos(var)] = var.checkType(val, ctx, ii); } @Override public String toString() { final StringBuilder sb = new StringBuilder(Util.name(this)).append('['); for(int i = 0; i < sl; i++) sb.append(i == 0 ? "" : ", ").append(stack[i]); return sb.append(']').toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/QuerySuggest.java000066400000000000000000000065521222453003200256660ustar00rootroot00000000000000package org.basex.query; import static org.basex.util.Token.*; import java.util.*; import org.basex.data.*; import org.basex.index.path.*; import org.basex.query.path.*; import org.basex.query.util.*; import org.basex.util.*; import org.basex.util.list.*; /** * This class analyzes the current path and gives suggestions for code * completions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class QuerySuggest extends QueryParser { /** Data reference. */ private final Data data; /** All current path nodes. */ private Stack> stack; /** All current path nodes. */ private ArrayList all; /** Current path nodes. */ private ArrayList curr; /** Hide flag. */ private boolean show; /** Last tag name. */ private byte[] tag; /** * Constructor. * @param q query * @param c query context * @param d data reference * @throws QueryException query exception */ public QuerySuggest(final String q, final QueryContext c, final Data d) throws QueryException { super(q, null, c); data = d; checkInit(); } /** * Sorts and returns the query suggestions. * @return completions */ public StringList complete() { final StringList sl = new StringList(); if(show) { for(final PathNode n : curr) { final String nm = string(n.token(data)); if(!nm.isEmpty() && !sl.contains(nm)) sl.add(nm); } sl.sort(true); } return sl; } @Override protected void checkInit() { if(stack != null && !stack.empty()) return; all = data.paths.root(); curr = all; stack = new Stack>(); } @Override protected void checkAxis(final Axis axis) { all = axis != Axis.CHILD && axis != Axis.DESC ? new ArrayList() : PathSummary.desc(curr, axis == Axis.DESC); curr = all; show = true; } @Override protected void checkTest(final Test test, final boolean attr) { final TokenBuilder tb = new TokenBuilder(); if(attr) tb.add('@'); if(test != null) tb.add(test.toString().replaceAll("\\*:", "")); tag = tb.finish(); // use inexact matching only, if the tag is at the end: checkTest(pos < length); } /** * Checks the tag name. * @param eq equality test */ private void checkTest(final boolean eq) { if(tag == null) return; final ArrayList tmp = new ArrayList(); boolean s = false; for(final PathNode p : all) { final byte[] nm = p.token(data); if(startsWith(nm, tag)) { if(!eq || eq(nm, tag)) tmp.add(p); s |= !eq(tag, nm); } } show = tag.length == 0 || s; curr = tmp; } @Override protected void checkPred(final boolean open) { if(stack == null) return; if(open) { checkTest(true); final ArrayList tmp = new ArrayList(); for(final PathNode p : curr) tmp.add(p); stack.add(tmp); checkAxis(Axis.CHILD); } else { curr = stack.pop(); show = false; all = curr; } } @Override public QueryException error(final Err err, final Object... arg) throws QueryException { throw new QueryException(info(), err, arg).suggest(this, complete()); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/QueryText.java000066400000000000000000000565071222453003200251760ustar00rootroot00000000000000package org.basex.query; import static org.basex.util.Token.*; import org.basex.core.*; /** * This class assembles text string and tokens required by the XQuery processor * implementation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public interface QueryText { // FULL-TEXT TOKENS ========================================================= /** Parser token. */ String AFTER = "after"; /** Parser token. */ String ALL = "all"; /** Parser token. */ String ALLOWING = "allowing"; /** Parser token. */ String AND = "and"; /** Parser token. */ String ANY = "any"; /** Parser token. */ String AS = "as"; /** Parser token. */ String ASCENDING = "ascending"; /** Parser token. */ String AT = "at"; /** Parser token. */ String ATTRIBUTE = "attribute"; /** Parser token. */ String BASE_URI = "base-uri"; /** Parser token. */ String BEFORE = "before"; /** Parser token. */ String BOUNDARY_SPACE = "boundary-space"; /** Parser token. */ String BY = "by"; /** Parser token. */ String CASE = "case"; /** Parser token. */ String CAST = "cast"; /** Parser token. */ String CASTABLE = "castable"; /** Parser token. */ String CATCH = "catch"; /** Parser token. */ String COLLATION = "collation"; /** Parser token. */ String COMMENT = "comment"; /** Parser token. */ String CONSTRUCTION = "construction"; /** Parser token. */ String CONTAINS = "contains"; /** Parser token. */ String CONTENT = "content"; /** Parser token. */ String CONTEXT = "context"; /** Parser token. */ String COPY = "copy"; /** Parser token. */ String COPY_NAMESPACES = "copy-namespaces"; /** Parser token. */ String COUNT = "count"; /** Parser token. */ String DECIMAL_FORMAT = "decimal-format"; /** Parser token. */ String DECLARE = "declare"; /** Parser token. */ String DEFAULT = "default"; /** Parser token. */ String DELETE = "delete"; /** Parser token. */ String DESCENDING = "descending"; /** Parser token. */ String DIACRITICS = "diacritics"; /** Parser token. */ String DIFFERENT = "different"; /** Parser token. */ String DISTANCE = "distance"; /** Parser token. */ String DIV = "div"; /** Parser token. */ String DOCUMENT = "document"; /** Parser token. */ String ELEMENT = "element"; /** Parser token. */ String EMPTY_SEQUENCE = "empty-sequence"; /** Parser token. */ String ELSE = "else"; /** Parser token. */ String EMPTYORD = "empty"; /** Parser token. */ String ENCODING = "encoding"; /** Parser token. */ String END = "end"; /** Parser token. */ String ENTIRE = "entire"; /** Parser token. */ String EVERY = "every"; /** Parser token. */ String EXACTLY = "exactly"; /** Parser token. */ String EXCEPT = "except"; /** Parser token. */ String EXTERNAL = "external"; /** Parser token. */ String FIRST = "first"; /** Parser token. */ String FOR = "for"; /** Parser token. */ String FROM = "from"; /** Parser token. */ String FT_OPTION = "ft-option"; /** Parser token. */ String FTAND = "ftand"; /** Parser token. */ String FTNOT = "ftnot"; /** Parser token. */ String FTOR = "ftor"; /** Parser token. */ String FUZZY = "fuzzy"; /** Parser token. */ String FUNCTION = "function"; /** Parser token. */ String GREATEST = "greatest"; /** Parser token. */ String IDIV = "idiv"; /** Parser token. */ String IF = "if"; /** Parser token. */ String IMPORT = "import"; /** Parser token. */ String IN = "in"; /** Parser token. */ String INHERIT = "inherit"; /** Parser token. */ String INSENSITIVE = "insensitive"; /** Parser token. */ String INSERT = "insert"; /** Parser token. */ String INSTANCE = "instance"; /** Parser token. */ String INTERSECT = "intersect"; /** Parser token. */ String INTO = "into"; /** Parser token. */ String ITEMM = "item"; /** Parser token. */ String JSONSTR = "json"; /** Parser token. */ String LANGUAGE = "language"; /** Parser token. */ String LAST = "last"; /** Parser token. */ String LAX = "lax"; /** Parser token. */ String LAZY = "lazy"; /** Parser token. */ String LEAST = "least"; /** Parser token. */ String LET = "let"; /** Parser token. */ String LEVELS = "levels"; /** Parser token. */ String LOWERCASE = "lowercase"; /** Parser token. */ String MAPSTR = "map"; /** Parser token. */ String MOD = "mod"; /** Parser token. */ String MODIFY = "modify"; /** Parser token. */ String MODULE = "module"; /** Parser token. */ String MOST = "most"; /** Parser token. */ String NEXT = "next"; /** Parser token. */ String NSPACE = "namespace"; /** Parser token. */ String NO_INHERIT = "no-inherit"; /** Parser token. */ String NO_PRESERVE = "no-preserve"; /** Parser token. */ String NODE = "node"; /** Parser token. */ String NODES = "nodes"; /** Parser token. */ String NO = "no"; /** Parser token. */ String NOT = "not"; /** Parser token. */ String OCCURS = "occurs"; /** Parser token. */ String OF = "of"; /** Parser token. */ String ONLY = "only"; /** Parser token. */ String OPTION = "option"; /** Parser token. */ String OR = "or"; /** Parser token. */ String ORDER = "order"; /** Parser token. */ String ORDERED = "ordered"; /** Parser token. */ String ORDERING = "ordering"; /** Parser token. */ String PARAGRAPH = "paragraph"; /** Parser token. */ String PARAGRAPHS = "paragraphs"; /** Parser token. */ String PHRASE = "phrase"; /** Parser token. */ String PRESERVE = "preserve"; /** Parser token. */ String PREVIOUS = "previous"; /** Public token. */ String PRIVATE = "private"; /** Parser token. */ String PI = "processing-instruction"; /** Public token. */ String PUBLIC = "public"; /** Parser token. */ String RELATIONSHIP = "relationship"; /** Parser token. */ String RENAME = "rename"; /** Parser token. */ String REPLACE = "replace"; /** Parser token. */ String RETURN = "return"; /** Parser token. */ String REVALIDATION = "revalidation"; /** Parser token. */ String SAME = "same"; /** Parser token. */ String SATISFIES = "satisfies"; /** Parser token. */ String SCHEMA = "schema"; /** Parser token. */ String SCHEMA_ATTRIBUTE = "schema-attribute"; /** Parser token. */ String SCHEMA_ELEMENT = "schema-element"; /** Parser token. */ String SCORE = "score"; /** Parser token. */ String SENSITIVE = "sensitive"; /** Parser token. */ String SENTENCE = "sentence"; /** Parser token. */ String SENTENCES = "sentences"; /** Parser token. */ String SEQUENCE = "sequence"; /** Parser token. */ String SKIP = "skip"; /** Parser token. */ String SLIDING = "sliding"; /** Parser token. */ String SOME = "some"; /** Parser token. */ String STABLE = "stable"; /** Parser token. */ String START = "start"; /** Parser token. */ String STEMMING = "stemming"; /** Parser token. */ String STOP = "stop"; /** Parser token. */ String STRICT = "strict"; /** Parser token. */ String STRIP = "strip"; /** Parser token. */ String SWITCH = "switch"; /** Parser token. */ String THEN = "then"; /** Parser token. */ String TIMES = "times"; /** Parser token. */ String TEXT = "text"; /** Parser token. */ String THESAURUS = "thesaurus"; /** Parser token. */ String TO = "to"; /** Parser token. */ String TREAT = "treat"; /** Parser token. */ String TRY = "try"; /** Parser token. */ String TUMBLING = "tumbling"; /** Parser token. */ String TYPE = "type"; /** Parser token. */ String TYPESWITCH = "typeswitch"; /** Parser token. */ String UNION = "union"; /** Parser token. */ String UNORDERED = "unordered"; /** Parser token. */ String UPDATING = "updating"; /** Parser token. */ String UPPERCASE = "uppercase"; /** Parser token. */ String USING = "using"; /** Parser token. */ String VALIDATE = "validate"; /** Parser token. */ String VALUEE = "value"; /** Parser token. */ String VARIABLE = "variable"; /** Parser token. */ String VERSION = "version"; /** Parser token. */ String WEIGHT = "weight"; /** Parser token. */ String WHERE = "where"; /** Parser token. */ String GROUP = "group"; /** Parser token. */ String WILDCARDS = "wildcards"; /** Parser token. */ String WHEN = "when"; /** Parser token. */ String WINDOW = "window"; /** Parser token. */ String WITH = "with"; /** Parser token. */ String WITHOUT = "without"; /** Parser token. */ String WORD = "word"; /** Parser token. */ String WORDS = "words"; /** Parser token. */ String XQUERY = "xquery"; /** Parser token. */ String DF_DEC = "decimal-separator"; /** Parser token. */ String DF_DIG = "digit"; /** Parser token. */ String DF_GRP = "grouping-separator"; /** Parser token. */ String DF_INF = "infinity"; /** Parser token. */ String DF_MIN = "minus-sign"; /** Parser token. */ String DF_NAN = "NaN"; /** Parser token. */ String DF_PAT = "pattern-separator"; /** Parser token. */ String DF_PC = "percent"; /** Parser token. */ String DF_PM = "per-mille"; /** Parser token. */ String DF_ZG = "zero-digit"; /** Option: read-lock. */ String READ_LOCK = "read-lock"; /** Option: write-lock. */ String WRITE_LOCK = "write-lock"; // ERROR INFORMATION ======================================================== /** Skip flag for the syntax highlighter (don't remove!). */ String IGNORE = null; /** Decimal declarations. */ byte[][] DECFORMATS = tokens( DF_DEC, DF_DIG, DF_GRP, DF_INF, DF_MIN, DF_NAN, DF_PAT, DF_PC, DF_PM, DF_ZG ); /** Parser token. */ String CONCAT = "||"; /** Parser token. */ String ASSIGN = ":="; /** Parser token. */ String BR1 = "["; /** Parser token. */ String BR2 = "]"; /** Parser token. */ String EQNAME = "Q{"; /** Parser token. */ String BRACE1 = "{"; /** Parser token. */ String BRACE2 = "}"; /** Parser token. */ String CDATA = " decFormats = new TokenObjMap(); /** Static and dynamic namespaces. */ public final NSContext ns = new NSContext(); /** Default collation. */ public Collation collation; /** Default element/type namespace. */ public byte[] elemNS; /** Default function namespace. */ public byte[] funcNS = FNURI; /** Context item static type. */ public SeqType initType; /** Construction mode. */ public boolean strip; /** Ordering mode. */ public boolean ordered; /** Default order for empty sequences. */ public boolean orderGreatest; /** Boundary-space policy. */ public boolean spaces; /** Copy-namespaces mode: (no-)preserve. */ public boolean preserveNS = true; /** Copy-namespaces mode: (no-)inherit. */ public boolean inheritNS = true; /** XQuery version flag. */ boolean xquery3; /** Static Base URI. */ private Uri baseURI = Uri.EMPTY; /** * Constructor setting the XQuery version. * @param xq30 XQuery 3.0 flag */ public StaticContext(final boolean xq30) { xquery3 = xq30; } /** * Declares a namespace. * A namespace is undeclared if the specified URI is an empty string. * The default element namespaces is set if the specified prefix is empty. * @param prefix namespace prefix * @param uri namespace URI * @throws QueryException query exception */ public void namespace(final String prefix, final String uri) throws QueryException { if(prefix.isEmpty()) { elemNS = uri.isEmpty() ? null : token(uri); } else if(uri.isEmpty()) { ns.delete(token(prefix)); } else { ns.add(token(prefix), token(uri), null); } } /** * Returns an IO representation of the static base URI, or {@code null}. * @return IO reference */ public IO baseIO() { return baseURI == Uri.EMPTY ? null : IO.get(baseURI.toJava()); } /** * Returns an IO reference for the specified filename. * If a base URI exists, it is merged with the specified filename. * Otherwise, a plain reference is returned. * @param path file path * @return io reference */ public IO io(final String path) { final IO base = baseIO(); return base != null ? base.merge(path) : IO.get(path); } /** * Returns the static base URI. * @return base URI */ public Uri baseURI() { return baseURI; } /** * Sets the static base URI. * @param uri uri to be set */ public void baseURI(final String uri) { if(uri.length() == 0) { baseURI = Uri.EMPTY; } else { final IO io = IO.get(uri); baseURI = Uri.uri(io instanceof IOFile ? io.url() : uri); } } /** * Checks if XQuery 3.0 features are allowed. * @return {@code true} if XQuery 3.0 is allowed, {@code false} otherwise */ public boolean xquery3() { return xquery3; } @Override public String toString() { return Util.name(this) + '[' + baseIO() + ']'; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/StaticDecl.java000066400000000000000000000032511222453003200252270ustar00rootroot00000000000000package org.basex.query; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; /** * Common superclass for static functions and variables. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public abstract class StaticDecl extends StaticScope { /** Static context of this declaration. */ public final StaticContext sc; /** Annotations. */ public final Ann ann; /** This declaration's name. */ public final QNm name; /** Declared type, {@code null} if not specified. */ public final SeqType declType; /** Flag that is set during compilation and execution and prevents infinite loops. */ protected boolean dontEnter; /** * Constructor. * @param sctx static context * @param a annotations * @param nm name * @param t declared return type * @param scp variable scope * @param xqdoc documentation * @param ii input info */ public StaticDecl(final StaticContext sctx, final Ann a, final QNm nm, final SeqType t, final VarScope scp, final String xqdoc, final InputInfo ii) { super(scp, xqdoc, ii); sc = sctx; ann = a == null ? new Ann() : a; name = nm; declType = t; } /** * Returns a unique identifier for this declaration. * @return a byte sequence that uniquely identifies this declaration */ public abstract byte[] id(); /** * Returns the type of this expression. If no type has been declare in the expression, * it is derived from the expression type. * @return return type */ public SeqType type() { return declType != null ? declType : expr.type(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/StaticScope.java000066400000000000000000000053531222453003200254360ustar00rootroot00000000000000package org.basex.query; import static org.basex.query.QueryText.*; import java.io.*; import org.basex.data.*; import org.basex.io.*; import org.basex.io.in.*; import org.basex.query.expr.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * Superclass for static functions, variables and the main expression. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public abstract class StaticScope extends ExprInfo implements Scope { /** Variable scope. */ protected final VarScope scope; /** Input info. */ public final InputInfo info; /** Root expression of this declaration. */ public Expr expr; /** Compilation flag. */ protected boolean compiled; /** Documentation. */ private final byte[] doc; /** * Constructor. * @param scp variable scope * @param ii input info * @param xqdoc documentation (may be {@code null} or empty) */ public StaticScope(final VarScope scp, final String xqdoc, final InputInfo ii) { scope = scp; info = ii; doc = xqdoc != null && !xqdoc.isEmpty() ? Token.token(xqdoc) : null; } @Override public final boolean compiled() { return compiled; } /** * Returns a map with all documentation tags found for this scope, or {@code null} if * no documentation exists. The main description is flagged with the "description" key. * The supported tags are defined in {@link QueryText#DOC_TAGS} (other tags will be * included in the map, too). * @return documentation */ public TokenObjMap doc() { if(doc == null) return null; final TokenObjMap map = new TokenObjMap(); byte[] key = null; final TokenBuilder val = new TokenBuilder(); final TokenBuilder line = new TokenBuilder(); try { final NewlineInput nli = new NewlineInput(new IOContent(doc)); while(nli.readLine(line)) { String l = line.toString().replaceAll("^\\s*: ?", ""); if(l.startsWith("@")) { add(key, val, map); key = Token.token(l.replaceAll("^@(\\w*).*", "$1")); l = l.replaceAll("^@\\w+ *", ""); val.reset(); } val.add(l).add('\n'); } } catch(final IOException ex) { Util.notexpected(ex); } add(key, val, map); return map; } /** * Adds a key and a value to the specified map. * @param key key * @param val value * @param map map */ private void add(final byte[] key, final TokenBuilder val, final TokenObjMap map) { final byte[] k = key == null ? DOC_TAGS[0] : key; TokenList tl = map.get(k); if(tl == null) { tl = new TokenList(); map.put(k, tl); } tl.add(val.trim().finish()); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/000077500000000000000000000000001222453003200233225ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/And.java000066400000000000000000000074411222453003200246750ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.ft.*; import org.basex.util.hash.*; /** * And expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class And extends Logical { /** * Constructor. * @param ii input info * @param e expression list */ public And(final InputInfo ii, final Expr[] e) { super(ii, e); } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { // remove atomic values final Expr c = super.compile(ctx, scp); if(c != this) return c; // merge predicates if possible final int es = expr.length; final ExprList el = new ExprList(es); Pos ps = null; CmpR cr = null; CmpSR cs = null; for(final Expr e : expr) { Expr tmp = null; if(e instanceof Pos) { // merge numeric predicates tmp = ps == null ? e : ps.intersect((Pos) e, info); if(!(tmp instanceof Pos)) return tmp; ps = (Pos) tmp; } else if(e instanceof CmpR) { // merge comparisons tmp = cr == null ? e : cr.intersect((CmpR) e); if(tmp instanceof CmpR) cr = (CmpR) tmp; else if(tmp != null) return tmp; } else if(e instanceof CmpSR) { // merge comparisons tmp = cs == null ? e : cs.intersect((CmpSR) e); if(tmp instanceof CmpSR) cs = (CmpSR) tmp; else if(tmp != null) return tmp; } // no optimization found; add original expression if(tmp == null) el.add(e); } if(ps != null) el.add(ps); if(cr != null) el.add(cr); if(cs != null) el.add(cs); if(es != el.size()) ctx.compInfo(OPTWRITE, this); expr = el.finish(); compFlatten(ctx); // return single expression if it yields a boolean return expr.length == 1 ? compBln(expr[0], info) : this; } @Override public Bln item(final QueryContext ctx, final InputInfo ii) throws QueryException { double s = 0; for(final Expr e : expr) { final Item it = e.ebv(ctx, info); if(!it.bool(info)) return Bln.FALSE; s = Scoring.and(s, it.score()); } // no scoring - return default boolean return s == 0 ? Bln.TRUE : Bln.get(s); } @Override public And copy(final QueryContext ctx, final VarScope scp, final IntObjMap vars) { final int es = expr.length; final Expr[] ex = new Expr[es]; for(int i = 0; i < es; i++) ex[i] = expr[i].copy(ctx, scp, vars); return new And(info, ex); } @Override public boolean indexAccessible(final IndexCosts ic) throws QueryException { int is = 0; final int es = expr.length; final int[] ics = new int[es]; boolean ia = true; for(int e = 0; e < es; ++e) { if(expr[e].indexAccessible(ic) && !ic.seq) { // skip queries with no results if(ic.costs() == 0) return true; // summarize costs ics[e] = ic.costs(); if(is == 0 || ic.costs() < is) is = ic.costs(); } else { ia = false; } } if(ia) { // evaluate arguments with high selectivity first final int[] ord = Array.createOrder(ics, true); final Expr[] ex = new Expr[es]; for(int e = 0; e < es; ++e) ex[e] = expr[ord[e]]; expr = ex; } ic.costs(is); return ia; } @Override public Expr indexEquivalent(final IndexCosts ic) throws QueryException { super.indexEquivalent(ic); return new InterSect(info, expr); } @Override public String toString() { return toString(' ' + AND + ' '); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Arith.java000066400000000000000000000046421222453003200252420ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.value.type.SeqType.Occ; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Arithmetic expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Arith extends Arr { /** Calculation operator. */ private final Calc calc; /** * Constructor. * @param ii input info * @param e1 first expression * @param e2 second expression * @param c calculation operator */ public Arith(final InputInfo ii, final Expr e1, final Expr e2, final Calc c) { super(ii, e1, e2); calc = c; type = SeqType.ITEM_ZO; } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { super.compile(ctx, scp); return optimize(ctx, scp); } @Override public Expr optimize(final QueryContext ctx, final VarScope scp) throws QueryException { final SeqType s0 = expr[0].type(); final SeqType s1 = expr[1].type(); final Type t0 = s0.type; final Type t1 = s1.type; if(t0.isNumberOrUntyped() && t1.isNumberOrUntyped()) { final Occ occ = s0.one() && s1.one() ? Occ.ONE : Occ.ZERO_ONE; type = SeqType.get(Calc.type(t0, t1), occ); } else if(s0.one() && s1.one()) { type = SeqType.ITEM; } return optPre(oneIsEmpty() ? null : allAreValues() ? item(ctx, info) : this, ctx); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { final Item a = expr[0].item(ctx, info); if(a == null) return null; final Item b = expr[1].item(ctx, info); if(b == null) return null; return calc.ev(info, a, b); } @Override public Arith copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new Arith(info, expr[0].copy(ctx, scp, vs), expr[1].copy(ctx, scp, vs), calc); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(OP, calc.name), expr); } @Override public String description() { return '\'' + calc.name + "' expression"; } @Override public String toString() { return toString(' ' + calc.name + ' '); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Arr.java000066400000000000000000000071041222453003200247130ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.util.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Abstract array expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class Arr extends ParseExpr { /** Expression list. */ public Expr[] expr; /** * Constructor. * @param ii input info * @param e expression list */ protected Arr(final InputInfo ii, final Expr... e) { super(ii); expr = e; } @Override public void checkUp() throws QueryException { checkNoUp(); } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { final int es = expr.length; for(int e = 0; e < es; e++) expr[e] = expr[e].compile(ctx, scp); return this; } @Override public boolean has(final Flag flag) { for(final Expr e : expr) if(e.has(flag)) return true; return false; } @Override public boolean removable(final Var v) { for(final Expr e : expr) if(!e.removable(v)) return false; return true; } @Override public VarUsage count(final Var v) { return VarUsage.sum(v, expr); } @Override public Expr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { return inlineAll(ctx, scp, expr, v, e) ? optimize(ctx, scp) : null; } /** * Creates a deep copy of the given array. * @param element type * @param ctx query context * @param scp variable scope * @param vs variable mapping * @param arr array to copy * @return deep copy of the array */ @SuppressWarnings("unchecked") public static final T[] copyAll(final QueryContext ctx, final VarScope scp, final IntObjMap vs, final T[] arr) { final T[] copy = arr.clone(); for(int i = 0; i < copy.length; i++) copy[i] = (T) copy[i].copy(ctx, scp, vs); return copy; } @Override public Expr indexEquivalent(final IndexCosts ic) throws QueryException { final int es = expr.length; for(int e = 0; e < es; ++e) expr[e] = expr[e].indexEquivalent(ic); return this; } /** * Returns true if all arguments are values. * @return result of check */ protected final boolean allAreValues() { for(final Expr e : expr) if(!e.isValue()) return false; return true; } /** * Returns true if at least one argument is empty or will yield 0 results. * @return result of check */ final boolean oneIsEmpty() { for(final Expr e : expr) if(e.isEmpty()) return true; return false; } /** * Checks if none of the expressions are updating expressions. * @throws QueryException query exception */ public final void checkNoUp() throws QueryException { checkNoneUp(expr); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(), expr); } /** * Prints the array with the specified separator. * @param sep separator * @return string representation */ protected String toString(final String sep) { return new TokenBuilder(PAR1).addSep(expr, sep).add(PAR2).toString(); } @Override public boolean accept(final ASTVisitor visitor) { return visitAll(visitor, expr); } @Override public int exprSize() { int sz = 1; for(final Expr e : expr) sz += e.exprSize(); return sz; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/CAttr.java000066400000000000000000000037531222453003200252120ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Attribute constructor. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class CAttr extends CName { /** Generated namespace. */ private static final byte[] NS0 = token("ns0:"); /** Computed constructor. */ private final boolean comp; /** * Constructor. * @param ii input info * @param c computed construction flag * @param n name * @param v attribute values */ public CAttr(final InputInfo ii, final boolean c, final Expr n, final Expr... v) { super(ATTRIBUTE, ii, n, v); comp = c; type = SeqType.ATT; } @Override public FAttr item(final QueryContext ctx, final InputInfo ii) throws QueryException { QNm nm = qname(ctx, ii); final byte[] cp = nm.prefix(); if(comp) { final byte[] cu = nm.uri(); if(eq(cp, XML) ^ eq(cu, XMLURI)) CAXML.thrw(info); if(eq(cu, XMLNSURI)) CAINV.thrw(info, cu); if(eq(cp, XMLNS) || cp.length == 0 && eq(nm.string(), XMLNS)) CAINV.thrw(info, nm.string()); // create new standard namespace to cover most frequent cases if(eq(cp, EMPTY) && !eq(cu, EMPTY)) nm = new QNm(concat(NS0, nm.string()), cu); } if(!nm.hasURI() && nm.hasPrefix()) INVPREF.thrw(info, nm); byte[] val = value(ctx, ii); if(eq(cp, XML) && eq(nm.local(), ID)) val = norm(val); return new FAttr(nm, val); } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new CAttr(info, comp, name.copy(ctx, scp, vs), copyAll(ctx, scp, vs, expr)); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/CComm.java000066400000000000000000000026231222453003200251660ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Comment fragment. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class CComm extends CFrag { /** * Constructor. * @param ii input info * @param c comment */ public CComm(final InputInfo ii, final Expr c) { super(ii, c); type = SeqType.COM; } @Override public FComm item(final QueryContext ctx, final InputInfo ii) throws QueryException { final Iter iter = ctx.iter(expr[0]); final TokenBuilder tb = new TokenBuilder(); boolean more = false; for(Item it; (it = iter.next()) != null;) { if(more) tb.add(' '); tb.add(it.string(ii)); more = true; } return new FComm(FComm.parse(tb.finish(), info)); } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new CComm(info, expr[0].copy(ctx, scp, vs)); } @Override public String description() { return info(COMMENT); } @Override public String toString() { return toString(COMMENT); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/CDoc.java000066400000000000000000000025701222453003200250010ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import org.basex.query.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Document fragment. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class CDoc extends CFrag { /** * Constructor. * @param ii input info * @param e expression */ public CDoc(final InputInfo ii, final Expr e) { super(ii, e); type = SeqType.DOC_O; } @Override public FDoc item(final QueryContext ctx, final InputInfo ii) throws QueryException { // create node final Constr c = new Constr(ii, ctx); final FDoc doc = new FDoc(c.children, Token.EMPTY); // add child nodes c.add(expr); if(c.errAtt || !c.atts.isEmpty()) DOCATTS.thrw(ii); if(c.errNS || !c.nspaces.isEmpty()) DOCNS.thrw(ii); return doc.optimize(); } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new CDoc(info, expr[0].copy(ctx, scp, vs)); } @Override public String description() { return info(DOCUMENT); } @Override public String toString() { return toString(DOCUMENT); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/CElem.java000066400000000000000000000163551222453003200251640ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Element constructor. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class CElem extends CName { /** Namespaces. */ private final Atts nspaces; /** Computed constructor flag. */ private final boolean comp; /** * Constructor. * @param ii input info * @param t tag * @param ns namespaces, or {@code null} if this is a computed constructor. * @param cont element contents */ public CElem(final InputInfo ii, final Expr t, final Atts ns, final Expr... cont) { super(ELEMENT, ii, t, cont); nspaces = ns == null ? new Atts() : ns; comp = ns == null; type = SeqType.ELM; } @Override public CElem compile(final QueryContext ctx, final VarScope scp) throws QueryException { final int s = addNS(ctx); super.compile(ctx, scp); ctx.sc.ns.size(s); return this; } @Override public FElem item(final QueryContext ctx, final InputInfo ii) throws QueryException { final int s = addNS(ctx); try { // adds in-scope namespaces final Atts ns = new Atts(); for(int i = 0; i < nspaces.size(); ++i) { ns.add(nspaces.name(i), nspaces.value(i)); } // create and check QName final QNm nm = qname(ctx, ii); final byte[] cp = nm.prefix(), cu = nm.uri(); if(eq(cp, XML) ^ eq(cu, XMLURI)) CEXML.thrw(info, cu, cp); if(eq(cu, XMLNSURI)) CEINV.thrw(info, cu); if(eq(cp, XMLNS)) CEINV.thrw(info, cp); if(!nm.hasURI() && nm.hasPrefix()) INVPREF.thrw(info, nm); // analyze element namespace unless it is "xml" if(!eq(cp, XML)) { // request namespace for the specified uri final byte[] uri = ctx.sc.ns.uri(cp); // check if element has a namespace if(nm.hasURI()) { // add to statically known namespaces if(!comp && (uri == null || !eq(uri, cu))) ctx.sc.ns.add(cp, cu); // add to in-scope namespaces if(!ns.contains(cp)) ns.add(cp, cu); } else { // element has no namespace: assign default uri nm.uri(uri); } } // create node final Constr constr = new Constr(ii, ctx); final FElem node = new FElem(nm, ns, constr.children, constr.atts); // add child and attribute nodes constr.add(expr); if(constr.errAtt) NOATTALL.thrw(info); if(constr.errNS) NONSALL.thrw(info); if(constr.duplAtt != null) CATTDUPL.thrw(info, constr.duplAtt); if(constr.duplNS != null) DUPLNSCONS.thrw(info, constr.duplNS); // check namespaces if(constr.nspaces.contains(EMPTY) && !nm.hasURI()) DUPLNSCONS.thrw(info, EMPTY); // add namespaces from constructor final Atts cns = constr.nspaces; for(int a = 0; a < cns.size(); ++a) addNS(cns.name(a), cns.value(a), ns); // add namespaces for(int a = 0; a < constr.atts.size(); ++a) { final ANode att = constr.atts.get(a); final QNm qnm = att.qname(); // skip attributes without prefixes or URIs if(!qnm.hasPrefix() || !qnm.hasURI()) continue; // skip XML namespace final byte[] apref = qnm.prefix(); if(eq(apref, XML)) continue; final byte[] auri = qnm.uri(); final byte[] npref = addNS(apref, auri, ns); if(npref != null) { final QNm aname = new QNm(concat(npref, COLON, qnm.local()), auri); constr.atts.set(a, new FAttr(aname, att.string())); } } // add inherited namespaces final Atts stack = ctx.sc.ns.stack(); for(int a = stack.size() - 1; a >= 0; a--) { final byte[] pref = stack.name(a); if(!ns.contains(pref)) ns.add(pref, stack.value(a)); } // update parent references of children for(int c = 0; c < constr.children.size(); ++c) { final ANode child = constr.children.get(c); // add inherited and remove unused namespaces if(child.type == NodeType.ELM) { if(ctx.sc.inheritNS) inherit(child, ns); if(!ctx.sc.preserveNS) noPreserve(child); child.optimize(); } } // return generated and optimized node return node.optimize(); } finally { ctx.sc.ns.size(s); } } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new CElem(info, name.copy(ctx, scp, vs), comp ? null : nspaces.copy(), copyAll(ctx, scp, vs, expr)); } /** * Removes unused namespaces. * @param node to be modified */ private static void noPreserve(final ANode node) { final Atts ns = node.namespaces(); final byte[] pref = node.qname().prefix(); for(int i = ns.size() - 1; i >= 0; i--) { boolean f = eq(ns.name(i), pref); final AxisIter atts = node.attributes(); for(ANode it; !f && (it = atts.next()) != null;) { f |= eq(it.qname().prefix(), pref); } if(!f) ns.delete(i); } } /** * Inherits namespaces. * @param node to be modified * @param nsp in-scope namespaces */ private static void inherit(final ANode node, final Atts nsp) { final Atts ns = node.namespaces(); for(int a = nsp.size() - 1; a >= 0; a--) { final byte[] pref = nsp.name(a); if(!ns.contains(pref)) ns.add(pref, nsp.value(a)); } } /** * Adds the specified namespace to the namespace array. * If the prefix is already used for another URI, a new * name is generated. * @param pref prefix * @param uri uri * @param ns namespaces * @return resulting prefix */ private static byte[] addNS(final byte[] pref, final byte[] uri, final Atts ns) { final byte[] u = ns.value(pref); if(u == null) { // add undeclared namespace ns.add(pref, uri); } else if(!eq(u, uri)) { // prefixes with different URIs exist; new one must be replaced byte[] apref = null; // check if one of the existing prefixes can be adopted for(int c = 0; c < ns.size(); c++) { if(eq(ns.value(c), uri)) apref = ns.name(c); } // if negative, generate a new one that is not used yet if(apref == null) { int i = 1; do { apref = concat(pref, new byte[] { '_' }, token(i++)); } while(ns.contains(apref)); ns.add(apref, uri); } return apref; } return null; } /** * Adds namespaces to the namespace stack. * @param ctx query context * @return old position in namespace stack */ private int addNS(final QueryContext ctx) { final NSContext ns = ctx.sc.ns; final int s = ns.size(); for(int n = 0; n < nspaces.size(); n++) ns.add(nspaces.name(n), nspaces.value(n)); return s; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/CFrag.java000066400000000000000000000022241222453003200251470ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.value.node.*; import org.basex.util.*; /** * Fragment constructor. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class CFrag extends Arr { /** * Constructor. * @param ii input info * @param n name */ CFrag(final InputInfo ii, final Expr... n) { super(ii, n); size = 1; } @Override public abstract ANode item(final QueryContext ctx, final InputInfo ii) throws QueryException; @Override public boolean has(final Flag flag) { return flag == Flag.CNS || super.has(flag); } /** * Returns a string info for the expression. * @param pref info prefix * @return string */ static final String info(final String pref) { return pref + " constructor"; } @Override protected String toString(final String pref) { final StringBuilder sb = new StringBuilder(pref).append(" { "); sb.append(expr.length == 0 ? "()" : super.toString(SEP)); return sb.append(" }").toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/CNSpace.java000066400000000000000000000026561222453003200254520ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Namespace constructor. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class CNSpace extends CName { /** * Constructor. * @param ii input info * @param n name * @param v attribute values */ public CNSpace(final InputInfo ii, final Expr n, final Expr v) { super(NSPACE, ii, n, v); type = SeqType.NSP; } @Override public FNames item(final QueryContext ctx, final InputInfo ii) throws QueryException { final Item it = name.item(ctx, info); final byte[] cp = checkEStr(it); if(cp.length != 0 && !XMLToken.isNCName(cp)) INVNAME.thrw(info, expr[0]); final byte[] cu = trim(value(ctx, ii)); if(eq(cp, XML) ^ eq(cu, XMLURI)) CNXML.thrw(info); if(eq(cp, XMLNS)) CNINV.thrw(info, cp); if(eq(cu, XMLNSURI) || cu.length == 0) CNINV.thrw(info, cu); return new FNames(cp, cu); } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new CNSpace(info, name.copy(ctx, scp, vs), expr[0].copy(ctx, scp, vs)); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/CName.java000066400000000000000000000072421222453003200251550ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.util.Err.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; /** * Abstract fragment constructor with a QName argument. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class CName extends CFrag { /** Description. */ private final String desc; /** QName. */ Expr name; /** * Constructor. * @param d description * @param ii input info * @param n name * @param v attribute values */ CName(final String d, final InputInfo ii, final Expr n, final Expr... v) { super(ii, v); name = n; desc = d; } @Override public final void checkUp() throws QueryException { checkNoUp(name); super.checkUp(); } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { name = name.compile(ctx, scp); return super.compile(ctx, scp); } /** * Returns the atomized value of the constructor. * @param ctx query context * @param ii input info * @return resulting value * @throws QueryException query exception */ final byte[] value(final QueryContext ctx, final InputInfo ii) throws QueryException { final TokenBuilder tb = new TokenBuilder(); for(final Expr e : expr) { final Iter ir = ctx.iter(e); boolean m = false; for(Item it; (it = ir.next()) != null;) { if(m) tb.add(' '); tb.add(it.string(ii)); m = true; } } return tb.finish(); } /** * Returns an updated name expression. * @param ctx query context * @param ii input info * @return result * @throws QueryException query exception */ final QNm qname(final QueryContext ctx, final InputInfo ii) throws QueryException { final Item it = checkItem(name, ctx); final Type ip = it.type; if(ip == AtomType.QNM) return (QNm) it; final byte[] str = it.string(ii); if(!XMLToken.isQName(str)) { (ip.isStringOrUntyped() ? INVNAME : INVQNAME).thrw(info, str); } // create and update namespace return new QNm(str, ctx); } @Override public boolean removable(final Var v) { return name.removable(v) && super.removable(v); } @Override public final boolean has(final Flag flag) { return name.has(flag) || super.has(flag); } @Override public final void plan(final FElem plan) { addPlan(plan, planElem(), name, expr); } @Override public final String description() { return info(desc); } @Override public final String toString() { return toString(desc + (name.type().eq(SeqType.QNM) ? " " + name : " { " + name + " }")); } @Override public final boolean accept(final ASTVisitor visitor) { return name.accept(visitor) && visitAll(visitor, expr); } @Override public final VarUsage count(final Var v) { return name.count(v).plus(super.count(v)); } @Override public Expr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { final boolean ex = inlineAll(ctx, scp, expr, v, e); final Expr sub = name.inline(ctx, scp, v, e); if(sub != null) name = sub; return sub != null || ex ? optimize(ctx, scp) : null; } @Override public final int exprSize() { int sz = 1; for(final Expr e : expr) sz += e.exprSize(); return sz + name.exprSize(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/CPI.java000066400000000000000000000030141222453003200245760ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * PI fragment. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class CPI extends CName { /** * Constructor. * @param ii input info * @param n name * @param v value */ public CPI(final InputInfo ii, final Expr n, final Expr v) { super(PI, ii, n, v); type = SeqType.PI; } @Override public FPI item(final QueryContext ctx, final InputInfo ii) throws QueryException { final Item it = checkItem(name, ctx); final Type ip = it.type; if(!ip.isStringOrUntyped() && ip != AtomType.QNM) CPIWRONG.thrw(info, it); final byte[] nm = trim(it.string(ii)); if(eq(lc(nm), XML)) CPIXML.thrw(info, nm); if(!XMLToken.isNCName(nm)) CPIINVAL.thrw(info, nm); byte[] v = value(ctx, ii); int i = -1; while(++i != v.length && v[i] >= 0 && v[i] <= ' '); v = substring(v, i); return new FPI(new QNm(nm), FPI.parse(v, info)); } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new CPI(info, name.copy(ctx, scp, vs), expr[0].copy(ctx, scp, vs)); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/CTxt.java000066400000000000000000000031571222453003200250550ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Text fragment. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class CTxt extends CFrag { /** * Constructor. * @param ii input info * @param t text */ public CTxt(final InputInfo ii, final Expr t) { super(ii, t); type = SeqType.TXT_ZO; } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { super.compile(ctx, scp); return optPre(oneIsEmpty() ? null : this, ctx); } @Override public FTxt item(final QueryContext ctx, final InputInfo ii) throws QueryException { final Iter iter = ctx.iter(expr[0]); Item it = iter.next(); if(it == null) return null; final TokenBuilder tb = new TokenBuilder(); boolean more = false; do { if(more) tb.add(' '); tb.add(it.string(ii)); more = true; } while((it = iter.next()) != null); return new FTxt(tb.finish()); } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new CTxt(info, expr[0].copy(ctx, scp, vs)); } @Override public String description() { return info(TEXT); } @Override public String toString() { return toString(TEXT); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/CachedFilter.java000066400000000000000000000044041222453003200265040ustar00rootroot00000000000000package org.basex.query.expr; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Filter expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class CachedFilter extends Filter { /** * Constructor. * @param ii input info * @param r expression * @param p predicates */ public CachedFilter(final InputInfo ii, final Expr r, final Expr... p) { super(ii, r, p); } @Override public Iter iter(final QueryContext ctx) throws QueryException { Value val = root.value(ctx); final Value cv = ctx.value; final long cs = ctx.size; final long cp = ctx.pos; try { // evaluate first predicate, based on incoming value final ValueBuilder vb = new ValueBuilder(); Expr p = preds[0]; long is = val.size(); ctx.size = is; ctx.pos = 1; for(int s = 0; s < is; ++s) { final Item it = val.itemAt(s); ctx.value = it; if(p.test(ctx, info) != null) vb.add(it); ctx.pos++; } // save memory val = null; // evaluate remaining predicates, based on value builder final int pl = preds.length; for(int i = 1; i < pl; i++) { is = vb.size(); p = preds[i]; ctx.size = is; ctx.pos = 1; int c = 0; for(int s = 0; s < is; ++s) { final Item it = vb.get(s); ctx.value = it; if(p.test(ctx, info) != null) vb.set(it, c++); ctx.pos++; } vb.size(c); } // return resulting values return vb; } finally { ctx.value = cv; ctx.size = cs; ctx.pos = cp; } } @Override public Filter addPred(final QueryContext ctx, final VarScope scp, final Expr p) throws QueryException { preds = Array.add(preds, p); return this; } @Override public Filter copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final Filter f = new CachedFilter(info, root == null ? null : root.copy(ctx, scp, vs), Arr.copyAll(ctx, scp, vs, preds)); f.pos = pos; f.last = last; return f; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Calc.java000066400000000000000000000245201222453003200250320ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.util.Err.*; import static org.basex.query.value.type.AtomType.*; import java.math.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.query.value.item.ANum; import org.basex.query.value.type.*; import org.basex.util.*; /** * Calculation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public enum Calc { /** Addition. */ PLUS("+") { @Override public Item ev(final InputInfo ii, final Item a, final Item b) throws QueryException { final Type ta = a.type, tb = b.type; final boolean t1 = ta.isNumberOrUntyped(); final boolean t2 = tb.isNumberOrUntyped(); if(t1 ^ t2) errNum(ii, !t1 ? a : b); if(t1 && t2) { // numbers or untyped values final Type t = type(ta, tb); if(t == ITR) { final long l1 = a.itr(ii); final long l2 = b.itr(ii); checkRange(ii, l1 + (double) l2); return Int.get(l1 + l2); } if(t == DBL) return Dbl.get(a.dbl(ii) + b.dbl(ii)); if(t == FLT) return Flt.get(a.flt(ii) + b.flt(ii)); return Dec.get(a.dec(ii).add(b.dec(ii))); } // dates or durations if(ta == tb) { if(!(a instanceof Dur)) errNum(ii, !t1 ? a : b); if(ta == YMD) return new YMDur((YMDur) a, (YMDur) b, true, ii); if(ta == DTD) return new DTDur((DTDur) a, (DTDur) b, true, ii); } if(ta == DTM) return new Dtm((Dtm) a, checkDur(ii, b), true, ii); if(tb == DTM) return new Dtm((Dtm) b, checkDur(ii, a), true, ii); if(ta == DAT) return new Dat((Dat) a, checkDur(ii, b), true, ii); if(tb == DAT) return new Dat((Dat) b, checkDur(ii, a), true, ii); if(ta == TIM && tb == DTD) return new Tim((Tim) a, (DTDur) b, true); if(tb == TIM && ta == DTD) return new Tim((Tim) b, (DTDur) a, true); throw errType(ii, ta, tb); } }, /** Subtraction. */ MINUS("-") { @Override public Item ev(final InputInfo ii, final Item a, final Item b) throws QueryException { final Type ta = a.type, tb = b.type; final boolean t1 = ta.isNumberOrUntyped(); final boolean t2 = tb.isNumberOrUntyped(); if(t1 ^ t2) errNum(ii, !t1 ? a : b); if(t1 && t2) { // numbers or untyped values final Type t = type(ta, tb); if(t == ITR) { final long l1 = a.itr(ii); final long l2 = b.itr(ii); checkRange(ii, l1 - (double) l2); return Int.get(l1 - l2); } if(t == DBL) return Dbl.get(a.dbl(ii) - b.dbl(ii)); if(t == FLT) return Flt.get(a.flt(ii) - b.flt(ii)); return Dec.get(a.dec(ii).subtract(b.dec(ii))); } // dates or durations if(ta == tb) { if(ta == DTM || ta == DAT || ta == TIM) return new DTDur((ADate) a, (ADate) b, ii); if(ta == YMD) return new YMDur((YMDur) a, (YMDur) b, false, ii); if(ta == DTD) return new DTDur((DTDur) a, (DTDur) b, false, ii); errNum(ii, !t1 ? a : b); } if(ta == DTM) return new Dtm((Dtm) a, checkDur(ii, b), false, ii); if(ta == DAT) return new Dat((Dat) a, checkDur(ii, b), false, ii); if(ta == TIM && tb == DTD) return new Tim((Tim) a, (DTDur) b, false); throw errType(ii, ta, tb); } }, /** Multiplication. */ MULT("*") { @Override public Item ev(final InputInfo ii, final Item a, final Item b) throws QueryException { final Type ta = a.type, tb = b.type; if(ta == YMD) { if(b instanceof ANum) return new YMDur((Dur) a, b.dbl(ii), true, ii); errNum(ii, b); } if(tb == YMD) { if(a instanceof ANum) return new YMDur((Dur) b, a.dbl(ii), true, ii); errNum(ii, a); } if(ta == DTD) { if(b instanceof ANum) return new DTDur((Dur) a, b.dbl(ii), true, ii); errNum(ii, b); } if(tb == DTD) { if(a instanceof ANum) return new DTDur((Dur) b, a.dbl(ii), true, ii); errNum(ii, a); } final boolean t1 = ta.isNumberOrUntyped(); final boolean t2 = tb.isNumberOrUntyped(); if(t1 ^ t2) errType(ii, ta, tb); if(t1 && t2) { final Type t = type(ta, tb); if(t == ITR) { final long l1 = a.itr(ii); final long l2 = b.itr(ii); checkRange(ii, l1 * (double) l2); return Int.get(l1 * l2); } if(t == DBL) return Dbl.get(a.dbl(ii) * b.dbl(ii)); if(t == FLT) return Flt.get(a.flt(ii) * b.flt(ii)); return Dec.get(a.dec(ii).multiply(b.dec(ii))); } throw errNum(ii, !t1 ? a : b); } }, /** Division. */ DIV("div") { @Override public Item ev(final InputInfo ii, final Item a, final Item b) throws QueryException { final Type ta = a.type, tb = b.type; if(ta == tb) { if(ta == YMD) { final BigDecimal bd = BigDecimal.valueOf(((YMDur) b).ymd()); if(bd.doubleValue() == 0.0) DIVZERO.thrw(ii, a); return Dec.get(BigDecimal.valueOf(((YMDur) a).ymd()).divide( bd, 20, BigDecimal.ROUND_HALF_EVEN)); } if(ta == DTD) { final BigDecimal bd = ((DTDur) b).dtd(); if(bd.doubleValue() == 0.0) DIVZERO.thrw(ii, a); return Dec.get(((DTDur) a).dtd().divide(bd, 20, BigDecimal.ROUND_HALF_EVEN)); } } if(ta == YMD) { if(b instanceof ANum) return new YMDur((Dur) a, b.dbl(ii), false, ii); errNum(ii, b); } if(ta == DTD) { if(b instanceof ANum) return new DTDur((Dur) a, b.dbl(ii), false, ii); errNum(ii, b); } checkNum(ii, a, b); final Type t = type(ta, tb); if(t == DBL) return Dbl.get(a.dbl(ii) / b.dbl(ii)); if(t == FLT) return Flt.get(a.flt(ii) / b.flt(ii)); final BigDecimal b1 = a.dec(ii); final BigDecimal b2 = b.dec(ii); if(b2.signum() == 0) DIVZERO.thrw(ii, a); final int s = Math.max(18, Math.max(b1.scale(), b2.scale())); return Dec.get(b1.divide(b2, s, BigDecimal.ROUND_HALF_EVEN)); } }, /** Integer division. */ IDIV("idiv") { @Override public Item ev(final InputInfo ii, final Item a, final Item b) throws QueryException { checkNum(ii, a, b); final double d1 = a.dbl(ii); final double d2 = b.dbl(ii); if(d2 == 0) DIVZERO.thrw(ii, a); final double d = d1 / d2; if(Double.isNaN(d) || Double.isInfinite(d) || d > Long.MAX_VALUE) DIVFLOW.thrw(ii, d1, d2); return Int.get(type(a.type, b.type) == ITR ? a.itr(ii) / b.itr(ii) : (long) d); } }, /** Modulo. */ MOD("mod") { @Override public Item ev(final InputInfo ii, final Item a, final Item b) throws QueryException { checkNum(ii, a, b); final Type t = type(a.type, b.type); if(t == DBL) return Dbl.get(a.dbl(ii) % b.dbl(ii)); if(t == FLT) return Flt.get(a.flt(ii) % b.flt(ii)); if(t == ITR) { final long b1 = a.itr(ii); final long b2 = b.itr(ii); if(b2 == 0) DIVZERO.thrw(ii, a); return Int.get(b1 % b2); } final BigDecimal b1 = a.dec(ii); final BigDecimal b2 = b.dec(ii); if(b2.signum() == 0) DIVZERO.thrw(ii, a); final BigDecimal q = b1.divide(b2, 0, BigDecimal.ROUND_DOWN); return Dec.get(b1.subtract(q.multiply(b2))); } }; /** Name of operation. */ final String name; /** * Constructor. * @param n name */ Calc(final String n) { name = n; } /** * Performs the calculation. * @param ii input info * @param a first item * @param b second item * @return result type * @throws QueryException query exception */ public abstract Item ev(final InputInfo ii, final Item a, final Item b) throws QueryException; /** * Returns the numeric type with the highest precedence. * @param a first item type * @param b second item type * @return type */ static Type type(final Type a, final Type b) { if(a == DBL || b == DBL || a.isUntyped() || b.isUntyped()) return DBL; if(a == FLT || b == FLT) return FLT; if(a == DEC || b == DEC) return DEC; return ITR; } /** * Returns a type error. * @param ii input info * @param ta first type * @param tb second type * @return query exception * @throws QueryException query exception */ final QueryException errType(final InputInfo ii, final Type ta, final Type tb) throws QueryException { throw CALCTYPE.thrw(ii, info(), ta, tb); } /** * Returns a numeric type error. * @param ii input info * @param it item * @return query exception * @throws QueryException query exception */ final QueryException errNum(final InputInfo ii, final Item it) throws QueryException { throw NONUMBER.thrw(ii, info(), it.type); } /** * Returns a duration type error. * @param ii input info * @param it item * @return duration * @throws QueryException query exception */ final Dur checkDur(final InputInfo ii, final Item it) throws QueryException { final Type ip = it.type; if(!(it instanceof Dur)) NODUR.thrw(ii, info(), ip); if(ip == DUR) throw NOSUBDUR.thrw(ii, info(), it); return (Dur) it; } /** * Checks if the specified items are numeric or untyped. * @param ii input info * @param a first item * @param b second item * @throws QueryException query exception */ final void checkNum(final InputInfo ii, final Item a, final Item b) throws QueryException { if(!a.type.isNumberOrUntyped()) errNum(ii, a); if(!b.type.isNumberOrUntyped()) errNum(ii, b); } /** * Checks if the specified value is outside the integer range. * @param ii input info * @param d value to be checked * @throws QueryException query exception */ static final void checkRange(final InputInfo ii, final double d) throws QueryException { if(d < Long.MIN_VALUE || d > Long.MAX_VALUE) RANGE.thrw(ii, d); } /** * Returns a string representation of the operator. * @return string */ final String info() { return '\'' + name + "' operator"; } @Override public String toString() { return name; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Cast.java000066400000000000000000000040311222453003200250550ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.value.type.SeqType.Occ; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Cast expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Cast extends Single { /** * Function constructor. * @param ii input info * @param e expression * @param t data type */ public Cast(final InputInfo ii, final Expr e, final SeqType t) { super(ii, e); type = t; } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { super.compile(ctx, scp); if(expr.type().one()) type = SeqType.get(type.type, Occ.ONE); // pre-evaluate value if(expr.isValue()) return optPre(value(ctx), ctx); // skip cast if specified and return types are equal // (the following types will always be correct) final Type t = type.type; if((t == AtomType.BLN || t == AtomType.FLT || t == AtomType.DBL || t == AtomType.QNM || t == AtomType.URI) && type.eq(expr.type())) { optPre(expr, ctx); return expr; } return this; } @Override public Iter iter(final QueryContext ctx) throws QueryException { return value(ctx).iter(); } @Override public Value value(final QueryContext ctx) throws QueryException { return type.cast(expr.item(ctx, info), ctx, info, this); } @Override public Cast copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new Cast(info, expr.copy(ctx, scp, vs), type); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(TYP, type), expr); } @Override public String toString() { return expr + " " + CAST + ' ' + AS + ' ' + type; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Castable.java000066400000000000000000000030721222453003200257050ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Castable expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Castable extends Single { /** Instance. */ private final SeqType seq; /** * Constructor. * @param ii input info * @param e expression * @param s sequence type */ public Castable(final InputInfo ii, final Expr e, final SeqType s) { super(ii, e); seq = s; type = SeqType.BLN; } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { super.compile(ctx, scp); return expr.isValue() ? preEval(ctx) : this; } @Override public Bln item(final QueryContext ctx, final InputInfo ii) { try { seq.cast(expr.item(ctx, ii), ctx, ii, this); return Bln.TRUE; } catch(final QueryException ex) { return Bln.FALSE; } } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new Castable(info, expr.copy(ctx, scp, vs), seq); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(TYP, seq), expr); } @Override public String toString() { return expr + " " + CASTABLE + ' ' + AS + ' ' + seq; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Catch.java000066400000000000000000000126771222453003200252240ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import static org.basex.util.Token.*; import org.basex.query.*; import org.basex.query.func.*; import org.basex.query.path.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Catch clause. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Catch extends Single { /** Prefix wildcard. */ public static final byte[] WILDCARD = token("*"); /** Error QNames. */ public static final QNm[] NAMES = { create(E_CODE), create(E_DESCRIPTION), create(E_VALUE), create(E_MODULE), create(E_LINE_NUMBER), create(E_COLUM_NUMBER), create(E_ADDITIONAL) }; /** Error types. */ public static final SeqType[] TYPES = { SeqType.QNM, SeqType.STR_ZO, SeqType.ITEM_ZM, SeqType.STR_ZO, SeqType.ITR_ZO, SeqType.ITR_ZO, SeqType.ITEM_ZM }; /** Error variables. */ private final Var[] vars = new Var[NAMES.length]; /** Supported codes. */ private final NameTest[] codes; /** * Constructor. * @param ii input info * @param c supported error codes * @param ctx query context * @param scp variable scope */ public Catch(final InputInfo ii, final NameTest[] c, final QueryContext ctx, final VarScope scp) { super(ii, null); codes = c; for(int i = 0; i < NAMES.length; i++) vars[i] = scp.newLocal(ctx, NAMES[i], TYPES[i], false); } @Override public Catch compile(final QueryContext ctx, final VarScope scp) throws QueryException { try { expr = expr.compile(ctx, scp); type = expr.type(); } catch(final QueryException qe) { expr = FNInfo.error(qe); } return this; } /** * Returns the value of the caught expression. * @param ctx query context * @param ex thrown exception * @return resulting item * @throws QueryException query exception */ Value value(final QueryContext ctx, final QueryException ex) throws QueryException { int i = 0; final byte[] io = ex.file() == null ? EMPTY : token(ex.file()); final Value val = ex.value(); for(final Value v : new Value[] { ex.qname(), Str.get(ex.getLocalizedMessage()), val == null ? Empty.SEQ : val, Str.get(io), Int.get(ex.line()), Int.get(ex.col()), Str.get(ex.getMessage().replaceAll("\r\n?", "\n")) }) { ctx.set(vars[i++], v, info); } return ctx.value(expr); } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final Catch ctch = new Catch(info, codes.clone(), ctx, scp); for(int i = 0; i < vars.length; i++) vs.put(vars[i].id, ctch.vars[i]); ctch.expr = expr.copy(ctx, scp, vs); return ctch; } @Override public Catch inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { try { final Expr sub = expr.inline(ctx, scp, v, e); if(sub == null) return null; expr = sub; } catch(final QueryException qe) { expr = FNInfo.error(qe); } return this; } /** * Returns this clause as an inlineable expression. * @param ex caught exception * @param ctx query context * @param scp variable scope * @return equivalent expression * @throws QueryException query exception during inlining */ protected Expr asExpr(final QueryException ex, final QueryContext ctx, final VarScope scp) throws QueryException { if(expr.isValue()) return expr; int i = 0; Expr e = expr; for(final Value v : values(ex)) { final Expr e2 = e.inline(ctx, scp, vars[i++], v); if(e2 != null) e = e2; if(e.isValue()) break; } return e; } /** * Returns all error values. * @param ex exception * @return values */ public static Value[] values(final QueryException ex) { final byte[] io = ex.file() == null ? EMPTY : token(ex.file()); final Value val = ex.value(); return new Value[] { ex.qname(), Str.get(ex.getLocalizedMessage()), val == null ? Empty.SEQ : val, Str.get(io), Int.get(ex.line()), Int.get(ex.col()), Str.get(ex.getMessage().replaceAll("\r\n?", "\n")) }; } /** * Returns the variables used in the {@code catch} expression. * @return variables */ public Var[] vars() { return vars; } /** * Checks if one of the specified errors match the thrown error. * @param qe thrown error * @return result of check */ protected boolean matches(final QueryException qe) { final QNm code = qe.qname(); for(final NameTest c : codes) if(c.eq(code)) return true; return false; } @Override public String toString() { return "catch * { " + expr + " }"; } /** * Creates an error QName with the specified name. * @param n name * @return QName */ private static QNm create(final byte[] n) { return new QNm(concat(ERR, COLON, n), ERRORURI); } @Override public boolean accept(final ASTVisitor visitor) { for(final Var v : vars) if(!visitor.declared(v)) return false; return visitAll(visitor, expr); } @Override public int exprSize() { return expr.exprSize(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Cmp.java000066400000000000000000000052271222453003200247120ustar00rootroot00000000000000package org.basex.query.expr; import org.basex.query.*; import org.basex.query.expr.CmpV.OpV; import org.basex.query.func.*; import org.basex.query.path.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * Abstract comparison. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class Cmp extends Arr { /** * Constructor. * @param ii input info * @param e1 first expression * @param e2 second expression */ Cmp(final InputInfo ii, final Expr e1, final Expr e2) { super(ii, e1, e2); } /** * Swaps the operands of the expression if better performance is expected. * The operator itself needs to be swapped by the calling expression. * @return resulting expression */ final boolean swap() { // move value or path without root to second position final boolean swap = expr[0].isValue() && !expr[1].isValue() || expr[1] instanceof Path && ((Path) expr[1]).root == null && (!(expr[0] instanceof Path) || ((Path) expr[0]).root != null); if(swap) { final Expr tmp = expr[0]; expr[0] = expr[1]; expr[1] = tmp; } return swap; } /** * If possible, inverts the operands of the expression. * @return original or modified expression */ public abstract Cmp invert(); /** * This method is called if the first operand of the comparison * expression is a {@code count()} function. * @param o comparison operator * @return resulting expression * @throws QueryException query exception */ final Expr compCount(final OpV o) throws QueryException { // evaluate argument final Expr a = expr[1]; if(!a.isItem()) return this; final Item it = (Item) a; if(!it.type.isNumberOrUntyped()) return this; final double v = it.dbl(info); // TRUE: c > (v<0), c != (v<0), c >= (v<=0), c != not-int(v) if((o == OpV.GT || o == OpV.NE) && v < 0 || o == OpV.GE && v <= 0 || o == OpV.NE && v != (int) v) return Bln.TRUE; // FALSE: c < (v<=0), c <= (v<0), c = (v<0), c = not-int(v) if(o == OpV.LT && v <= 0 || (o == OpV.LE || o == OpV.EQ) && v < 0 || o == OpV.EQ && v != (int) v) return Bln.FALSE; // EXISTS: c > (v<1), c >= (v<=1), c != (v=0) if(o == OpV.GT && v < 1 || o == OpV.GE && v <= 1 || o == OpV.NE && v == 0) return Function.EXISTS.get(info, ((StandardFunc) expr[0]).expr); // EMPTY: c < (v<=1), c <= (v<1), c = (v=0) if(o == OpV.LT && v <= 1 || o == OpV.LE && v < 1 || o == OpV.EQ && v == 0) return Function.EMPTY.get(info, ((StandardFunc) expr[0]).expr); return this; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/CmpG.java000066400000000000000000000303311222453003200250130ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.data.*; import org.basex.index.*; import org.basex.index.query.*; import org.basex.query.*; import org.basex.query.expr.CmpV.OpV; import org.basex.query.func.*; import org.basex.query.iter.*; import org.basex.query.path.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * General comparison. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class CmpG extends Cmp { /** Comparators. */ public enum OpG { /** General comparison: less or equal. */ LE("<=", OpV.LE) { @Override public OpG swap() { return OpG.GE; } @Override public OpG invert() { return OpG.LT; } }, /** General comparison: less. */ LT("<", OpV.LT) { @Override public OpG swap() { return OpG.GT; } @Override public OpG invert() { return OpG.GE; } }, /** General comparison: greater of equal. */ GE(">=", OpV.GE) { @Override public OpG swap() { return OpG.LE; } @Override public OpG invert() { return OpG.LT; } }, /** General comparison: greater. */ GT(">", OpV.GT) { @Override public OpG swap() { return OpG.LT; } @Override public OpG invert() { return OpG.LE; } }, /** General comparison: equal. */ EQ("=", OpV.EQ) { @Override public OpG swap() { return OpG.EQ; } @Override public OpG invert() { return OpG.NE; } }, /** General comparison: not equal. */ NE("!=", OpV.NE) { @Override public OpG swap() { return OpG.NE; } @Override public OpG invert() { return OpG.EQ; } }; /** Cached enums (faster). */ public static final OpG[] VALUES = values(); /** String representation. */ public final String name; /** Comparator. */ final OpV op; /** * Constructor. * @param n string representation * @param c comparator */ OpG(final String n, final OpV c) { name = n; op = c; } /** * Swaps the comparator. * @return swapped comparator */ public abstract OpG swap(); /** * Inverts the comparator. * @return inverted comparator */ public abstract OpG invert(); @Override public String toString() { return name; } } /** Comparator. */ OpG op; /** Index expression. */ private ValueAccess[] va = {}; /** Flag for atomic evaluation. */ private boolean atomic; /** * Constructor. * @param e1 first expression * @param e2 second expression * @param o operator * @param ii input info */ public CmpG(final Expr e1, final Expr e2, final OpG o, final InputInfo ii) { super(ii, e1, e2); op = o; type = SeqType.BLN; } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { super.compile(ctx, scp); return optimize(ctx, scp); } @Override public Expr optimize(final QueryContext ctx, final VarScope scp) throws QueryException { // swap expressions; add text() to location paths to simplify optimizations if(swap()) { op = op.swap(); ctx.compInfo(OPTSWAP, this); } // do not add text() step if one of the strings to be compared is empty // example: //x[y == ''], //x[y == ('','a')] // [CG] XQuery, optimizations: do not add text() step for arguments that yield // empty strings. example: //x[y == $x/X] with $x/X = '' boolean add = true; if(expr[1].isValue() && ((Value) expr[1]).type.isStringOrUntyped()) { final Iter ir = expr[1].iter(ctx); for(Item it; add && (it = ir.next()) != null;) { add = it.string(info).length != 0; } } if(add) for(int e = 0; e != expr.length; ++e) expr[e] = expr[e].addText(ctx); final Expr e1 = expr[0]; final Expr e2 = expr[1]; Expr e = this; if(oneIsEmpty()) { e = optPre(Bln.FALSE, ctx); } else if(allAreValues()) { e = preEval(ctx); } else if(e1.isFunction(Function.COUNT)) { e = compCount(op.op); if(e != this) ctx.compInfo(e instanceof Bln ? OPTPRE : OPTWRITE, this); } else if(e1.isFunction(Function.POSITION)) { if(e2 instanceof RangeSeq && op.op == OpV.EQ) { // position() CMP range final long p1 = ((RangeSeq) e2).itemAt(0).itr(info); final long p2 = p1 + e2.size() - 1; e = Pos.get(p1, p2, info); } else { // position() CMP number e = Pos.get(op.op, e2, e, info); } if(e != this) ctx.compInfo(OPTWRITE, this); } else if(e1.type().eq(SeqType.BLN) && (op == OpG.EQ && e2 == Bln.FALSE || op == OpG.NE && e2 == Bln.TRUE)) { // (A = false()) -> not(A) e = Function.NOT.get(info, e1); ctx.compInfo(OPTWRITE, this); } else { // rewrite path CMP number e = CmpR.get(this); if(e == this) e = CmpSR.get(this); if(e != this) ctx.compInfo(OPTWRITE, this); } if(e != this) return e; // check if both arguments will always yield one result atomic = e1.type().zeroOrOne() && e2.type().zeroOrOne(); if(atomic) ctx.compInfo(OPTATOMIC, this); return this; } @Override public Expr compEbv(final QueryContext ctx) { // e.g.: exists(...) = true() -> exists(...) // checking one direction is sufficient, as operators may have been swapped return (op == OpG.EQ && expr[1] == Bln.TRUE || op == OpG.NE && expr[1] == Bln.FALSE) && expr[0].type().eq(SeqType.BLN) ? expr[0] : this; } @Override public Bln item(final QueryContext ctx, final InputInfo ii) throws QueryException { // atomic evaluation of arguments (faster) if(atomic) { final Item it1 = expr[0].item(ctx, info); if(it1 == null) return Bln.FALSE; final Item it2 = expr[1].item(ctx, info); if(it2 == null) return Bln.FALSE; return Bln.get(eval(it1, it2, ctx.sc.collation)); } final Iter ir1 = ctx.iter(expr[0]); final long is1 = ir1.size(); // skip empty result if(is1 == 0) return Bln.FALSE; final boolean s1 = is1 == 1; // evaluate single items if(s1 && expr[1].size() == 1) return Bln.get(eval(ir1.next(), expr[1].item(ctx, info), ctx.sc.collation)); Iter ir2 = ctx.iter(expr[1]); final long is2 = ir2.size(); // skip empty result if(is2 == 0) return Bln.FALSE; final boolean s2 = is2 == 1; // evaluate single items if(s1 && s2) return Bln.get(eval(ir1.next(), ir2.next(), ctx.sc.collation)); // evaluate iterator and single item Item it1, it2; if(s2) { it2 = ir2.next(); while((it1 = ir1.next()) != null) { if(eval(it1, it2, ctx.sc.collation)) return Bln.TRUE; } return Bln.FALSE; } // evaluate two iterators if(!ir2.reset()) { // cache items for next comparisons final ValueBuilder vb = new ValueBuilder(); if((it1 = ir1.next()) != null) { while((it2 = ir2.next()) != null) { if(eval(it1, it2, ctx.sc.collation)) return Bln.TRUE; vb.add(it2); } } ir2 = vb; } while((it1 = ir1.next()) != null) { ir2.reset(); while((it2 = ir2.next()) != null) { if(eval(it1, it2, ctx.sc.collation)) return Bln.TRUE; } } return Bln.FALSE; } /** * Compares a single item. * @param a first item to be compared * @param b second item to be compared * @param coll collation * @return result of check * @throws QueryException query exception */ private boolean eval(final Item a, final Item b, final Collation coll) throws QueryException { final Type ta = a.type, tb = b.type; if(!(a instanceof FItem || b instanceof FItem) && (ta == tb || ta.isUntyped() || tb.isUntyped() || a instanceof ANum && b instanceof ANum || a instanceof AStr && b instanceof AStr)) return op.op.eval(a, b, coll, info); throw Err.INVTYPECMP.thrw(info, ta, tb); } @Override public CmpG invert() { return expr[0].size() != 1 || expr[1].size() != 1 ? this : new CmpG(expr[0], expr[1], op.invert(), info); } /** * Creates a union of the existing and the specified expressions. * @param g general comparison * @param ctx query context * @param scp variable scope * @return true if union was successful * @throws QueryException query exception */ boolean union(final CmpG g, final QueryContext ctx, final VarScope scp) throws QueryException { if(op != g.op || !expr[0].sameAs(g.expr[0])) return false; expr[1] = new List(info, expr[1], g.expr[1]).compile(ctx, scp); atomic = atomic && expr[1].type().zeroOrOne(); return true; } @Override public boolean indexAccessible(final IndexCosts ic) throws QueryException { // accept only location path, string and equality expressions if(op != OpG.EQ) return false; final Step s = expr[0] instanceof Context ? ic.step : indexStep(expr[0]); if(s == null) return false; // check which index applies final Data data = ic.ictx.data; final boolean text = s.test.type == NodeType.TXT && data.meta.textindex; final boolean attr = s.test.type == NodeType.ATT && data.meta.attrindex; if(!text && !attr) return false; // support expressions final IndexType ind = text ? IndexType.TEXT : IndexType.ATTRIBUTE; final Expr arg = expr[1]; if(!arg.isValue()) { final SeqType t = arg.type(); /* index access is not possible if returned type is no string or not untyped, if expression depends on context, or if it is non-deterministic. examples: //*[text() = 1] //*[text() = .] //*[text() = (if(random:double() < .5) then 'X' else 'Y')] */ if(!t.type.isStringOrUntyped() || arg.has(Flag.CTX) || arg.has(Flag.NDT)) return false; ic.addCosts(data.meta.size / 10); va = Array.add(va, new ValueAccess(info, arg, ind, ic.ictx)); return true; } // loop through all items final Iter ir = arg.iter(ic.ctx); Item it; ic.costs(0); while((it = ir.next()) != null) { if(!it.type.isStringOrUntyped()) return false; final int is = data.count(new StringToken(ind, it.string(info))); // add only expressions that yield results if(is != 0) { va = Array.add(va, new ValueAccess(info, it, ind, ic.ictx)); ic.addCosts(is); } } return true; } @Override public Expr indexEquivalent(final IndexCosts ic) { // will only be called for costs != 0 final boolean text = va[0].itype == IndexType.TEXT; ic.ctx.compInfo(text ? OPTTXTINDEX : OPTATVINDEX); // more than one string - merge index results final ParseExpr root = va.length == 1 ? va[0] : new Union(info, va); return ic.invert(expr[0], root, text); } /** * If possible, returns the last location step of the specified expression. * @param expr expression * @return location step */ public static Step indexStep(final Expr expr) { // check if index can be applied if(!(expr instanceof AxisPath)) return null; // accept only single axis steps as first expression final AxisPath path = (AxisPath) expr; // path must contain no root node return path.root != null ? null : path.step(path.steps.length - 1); } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new CmpG(expr[0].copy(ctx, scp, vs), expr[1].copy(ctx, scp, vs), op, info); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(OP, op.name), expr); } @Override public String description() { return "'" + op + "' expression"; } @Override public String toString() { return toString(" " + op + ' '); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/CmpN.java000066400000000000000000000064351222453003200250320ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.value.type.SeqType.Occ; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Node comparison. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class CmpN extends Cmp { /** Comparators. */ public enum OpN { /** Node comparison: same. */ EQ("is") { @Override public boolean eval(final ANode a, final ANode b) { return a.is(b); } }, /** Node comparison: before. */ ET("<<") { @Override public boolean eval(final ANode a, final ANode b) { return a.diff(b) < 0; } }, /** Node comparison: after. */ GT(">>") { @Override public boolean eval(final ANode a, final ANode b) { return a.diff(b) > 0; } }; /** Cached enums (faster). */ public static final OpN[] VALUES = values(); /** String representation. */ public final String name; /** * Constructor. * @param n string representation */ OpN(final String n) { name = n; } /** * Evaluates the expression. * @param a first node * @param b second node * @return result */ public abstract boolean eval(ANode a, ANode b); @Override public String toString() { return name; } } /** Comparator. */ private final OpN op; /** * Constructor. * @param e1 first expression * @param e2 second expression * @param o comparator * @param ii input info */ public CmpN(final Expr e1, final Expr e2, final OpN o, final InputInfo ii) { super(ii, e1, e2); op = o; type = SeqType.BLN_ZO; } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { super.compile(ctx, scp); return optimize(ctx, scp); } @Override public Expr optimize(final QueryContext ctx, final VarScope scp) throws QueryException { type = SeqType.get(AtomType.BLN, expr[0].size() == 1 && expr[1].size() == 1 ? Occ.ONE : Occ.ZERO_ONE); return optPre(oneIsEmpty() ? null : allAreValues() ? item(ctx, info) : this, ctx); } @Override public Bln item(final QueryContext ctx, final InputInfo ii) throws QueryException { final Item a = expr[0].item(ctx, info); if(a == null) return null; final Item b = expr[1].item(ctx, info); if(b == null) return null; return Bln.get(op.eval(checkNode(a), checkNode(b))); } @Override public CmpN invert() { throw Util.notexpected(); } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new CmpN(expr[0].copy(ctx, scp, vs), expr[1].copy(ctx, scp, vs), op, info); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(OP, op.name), expr); } @Override public String description() { return "'" + op + "' operator"; } @Override public String toString() { return toString(" " + op + ' '); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/CmpR.java000066400000000000000000000152761222453003200250410ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.data.*; import org.basex.index.*; import org.basex.index.name.*; import org.basex.index.query.*; import org.basex.index.stats.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.path.*; import org.basex.query.path.Test.Mode; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Numeric range expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class CmpR extends Single { /** Minimum. */ private final double min; /** Include minimum value. */ private final boolean mni; /** Maximum. */ private final double max; /** Include maximum value. */ private final boolean mxi; /** Index container. */ private NumericRange rt; /** Flag for atomic evaluation. */ private final boolean atomic; /** * Constructor. * @param e (compiled) expression * @param mn minimum value * @param in include minimum value * @param mx maximum value * @param ix include maximum value * @param ii input info */ private CmpR(final Expr e, final double mn, final boolean in, final double mx, final boolean ix, final InputInfo ii) { super(ii, e); min = mn; mni = in; max = mx; mxi = ix; type = SeqType.BLN; atomic = e.type().zeroOrOne(); } /** * Tries to convert the specified expression into a range expression. * @param ex expression to be converted * @return new or original expression */ static Expr get(final CmpG ex) { if(!(ex.expr[1] instanceof ANum)) return ex; final double d = ((ANum) ex.expr[1]).dbl(); final Expr e = ex.expr[0]; switch(ex.op.op) { case GE: return new CmpR(e, d, true, Double.POSITIVE_INFINITY, true, ex.info); case GT: return new CmpR(e, d, false, Double.POSITIVE_INFINITY, true, ex.info); case LE: return new CmpR(e, Double.NEGATIVE_INFINITY, true, d, true, ex.info); case LT: return new CmpR(e, Double.NEGATIVE_INFINITY, true, d, false, ex.info); default: return ex; } } @Override public Bln item(final QueryContext ctx, final InputInfo ii) throws QueryException { // atomic evaluation of arguments (faster) if(atomic) { final Item it = expr.item(ctx, info); if(it == null) return Bln.FALSE; final double d = it.dbl(info); return Bln.get((mni ? d >= min : d > min) && (mxi ? d <= max : d < max)); } // iterative evaluation final Iter ir = ctx.iter(expr); for(Item it; (it = ir.next()) != null;) { final double d = it.dbl(info); if((mni ? d >= min : d > min) && (mxi ? d <= max : d < max)) return Bln.TRUE; } return Bln.FALSE; } /** * Creates an intersection of the existing and the specified expressions. * @param c range comparison * @return resulting expression or {@code null} */ Expr intersect(final CmpR c) { // skip intersection if expressions to be compared are different if(!c.expr.sameAs(expr)) return null; // find common minimum and maximum value final double mn = Math.max(min, c.min); final double mx = Math.min(max, c.max); // remove comparisons that will never yield results if(mn > mx) return Bln.FALSE; if(mn == mx) { // return simplified comparison for exact hit, or false if value is not included return mni && mxi ? new CmpG(expr, Dbl.get(mn), CmpG.OpG.EQ, info) : Bln.FALSE; } return new CmpR(c.expr, mn, mni && c.mni, mx, mxi && c.mxi, info); } @Override public boolean indexAccessible(final IndexCosts ic) { // accept only location path, string and equality expressions final Step s = CmpG.indexStep(expr); // sequential main memory is assumed to be faster than range index access final Data data = ic.ictx.data; if(s == null || data.inMemory()) return false; // check which index applies final boolean text = s.test.type == NodeType.TXT && data.meta.textindex; final boolean attr = s.test.type == NodeType.ATT && data.meta.attrindex; if(!text && !attr || !mni || !mxi) return false; final Stats key = key(ic, text); if(key == null) return false; // estimate costs for range access; all values out of range: no results rt = new NumericRange(text ? IndexType.TEXT : IndexType.ATTRIBUTE, Math.max(min, key.min), Math.min(max, key.max)); ic.costs(rt.min > rt.max || rt.max < key.min || rt.min > key.max ? 0 : Math.max(1, data.meta.size / 5)); // use index if costs are zero, or if min/max is not infinite return ic.costs() == 0 || min != Double.NEGATIVE_INFINITY && max != Double.POSITIVE_INFINITY; } @Override public Expr indexEquivalent(final IndexCosts ic) { final boolean text = rt.type() == IndexType.TEXT; ic.ctx.compInfo(OPTRNGINDEX); return ic.invert(expr, new RangeAccess(info, rt, ic.ictx), text); } /** * Retrieves the statistics key for the tag/attribute name. * @param ic index context * @param text text flag * @return key */ private Stats key(final IndexCosts ic, final boolean text) { // statistics are not up-to-date final Data data = ic.ictx.data; if(!data.meta.uptodate || data.nspaces.size() != 0) return null; final AxisPath path = (AxisPath) expr; final int st = path.steps.length; final Step step; if(text) { step = st == 1 ? ic.step : path.step(st - 2); if(!(step.test.mode == Mode.LN)) return null; } else { step = path.step(st - 1); if(!step.simple(Axis.ATTR, true)) return null; } final Names names = text ? data.tagindex : data.atnindex; final Stats key = names.stat(names.id(((NameTest) step.test).ln)); return key == null || key.type == StatsType.INTEGER || key.type == StatsType.DOUBLE ? key : null; } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new CmpR(expr.copy(ctx, scp, vs), min, mni, max, mxi, info); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(MIN, min, MAX, max), expr); } @Override public String toString() { final StringBuilder sb = new StringBuilder(); if(min != Double.NEGATIVE_INFINITY) sb.append(min).append(mni ? " <= " : " < "); sb.append(expr); if(max != Double.POSITIVE_INFINITY) sb.append(mxi ? " <= " : " < ").append(max); return sb.toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/CmpSR.java000066400000000000000000000133601222453003200251540ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import org.basex.data.*; import org.basex.index.*; import org.basex.index.query.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.path.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * String range expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class CmpSR extends Single { /** Minimum. */ private final byte[] min; /** Include minimum value. */ private final boolean mni; /** Maximum. */ private final byte[] max; /** Include maximum value. */ private final boolean mxi; /** Index container. */ private StringRange rt; /** Flag for atomic evaluation. */ private final boolean atomic; /** * Constructor. * @param e (compiled) expression * @param mn minimum value * @param in include minimum value * @param mx maximum value * @param ix include maximum value * @param ii input info */ private CmpSR(final Expr e, final byte[] mn, final boolean in, final byte[] mx, final boolean ix, final InputInfo ii) { super(ii, e); min = mn; mni = in; max = mx; mxi = ix; type = SeqType.BLN; atomic = e.type().zeroOrOne(); } /** * Tries to convert the specified expression into a range expression. * @param ex expression to be converted * @return new or original expression * @throws QueryException query exception */ static Expr get(final CmpG ex) throws QueryException { if(!(ex.expr[1] instanceof AStr)) return ex; final byte[] d = ((AStr) ex.expr[1]).string(ex.info); final Expr e = ex.expr[0]; switch(ex.op.op) { case GE: return new CmpSR(e, d, true, null, true, ex.info); case GT: return new CmpSR(e, d, false, null, true, ex.info); case LE: return new CmpSR(e, null, true, d, true, ex.info); case LT: return new CmpSR(e, null, true, d, false, ex.info); default: return ex; } } @Override public Bln item(final QueryContext ctx, final InputInfo ii) throws QueryException { // atomic evaluation of arguments (faster) if(atomic) { final Item it = expr.item(ctx, info); return Bln.get(it != null && eval(it)); } // iterative evaluation final Iter ir = ctx.iter(expr); for(Item it; (it = ir.next()) != null;) { if(eval(it)) return Bln.TRUE; } return Bln.FALSE; } /** * Evaluates the range for the specified item. * @param it item to be evaluated * @return result of check * @throws QueryException query exception */ private boolean eval(final Item it) throws QueryException { if(!it.type.isStringOrUntyped()) INVTYPECMP.thrw(info, it.type, AtomType.STR); final byte[] s = it.string(info); final int mn = min == null ? 1 : Token.diff(s, min); final int mx = max == null ? -1 : Token.diff(s, max); return (mni ? mn >= 0 : mn > 0) && (mxi ? mx <= 0 : mx < 0); } /** * Creates an intersection of the existing and the specified expressions. * @param c range comparison * @return resulting expression or {@code null} */ Expr intersect(final CmpSR c) { // skip intersection if expressions to be compared are different if(!c.expr.sameAs(expr)) return null; // find common minimum and maximum value final byte[] mn = min == null ? c.min : c.min == null ? min : Token.max(min, c.min); final byte[] mx = max == null ? c.max : c.max == null ? max : Token.min(max, c.max); if(mn != null && mx != null) { final int d = Token.diff(mn, mx); // remove comparisons that will never yield results if(d > 0) return Bln.FALSE; if(d == 0) { // return simplified comparison for exact hit, or false if value is not included return mni && mxi ? new CmpG(expr, Str.get(mn), CmpG.OpG.EQ, info) : Bln.FALSE; } } return new CmpSR(c.expr, mn, mni && c.mni, mx, mxi && c.mxi, info); } @Override public boolean indexAccessible(final IndexCosts ic) { // accept only location path, string and equality expressions final Step s = CmpG.indexStep(expr); // no range index support in main-memory index structures final Data data = ic.ictx.data; if(s == null || data.inMemory()) return false; // check which index applies final boolean text = s.test.type == NodeType.TXT && data.meta.textindex; final boolean attr = s.test.type == NodeType.ATT && data.meta.attrindex; if(!text && !attr || min == null || max == null) return false; // create range access rt = new StringRange(text ? IndexType.TEXT : IndexType.ATTRIBUTE, min, mni, max, mxi); ic.costs(Math.max(1, data.meta.size / 10)); return true; } @Override public Expr indexEquivalent(final IndexCosts ic) { final boolean text = rt.type() == IndexType.TEXT; ic.ctx.compInfo(OPTSRNGINDEX); return ic.invert(expr, new StringRangeAccess(info, rt, ic.ictx), text); } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final CmpSR res = new CmpSR(expr.copy(ctx, scp, vs), min, mni, max, mxi, info); res.rt = rt; return res; } @Override public void plan(final FElem plan) { addPlan(plan, planElem(MIN, min != null ? min : "", MAX, max != null ? max : ""), expr); } @Override public String toString() { final TokenBuilder tb = new TokenBuilder(); if(min != null) tb.add('"').add(min).add('"').add(mni ? " <= " : " < "); tb.addExt(expr); if(max != null) tb.add(mxi ? " <= " : " < ").add('"').add(max).add('"'); return tb.toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/CmpV.java000066400000000000000000000154361222453003200250430ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.func.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.value.type.SeqType.Occ; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Value comparison. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class CmpV extends Cmp { /** Comparators. */ public enum OpV { /** Item comparison:less or equal. */ LE("le") { @Override public boolean eval(final Item a, final Item b, final Collation coll, final InputInfo ii) throws QueryException { final int v = a.diff(b, coll, ii); return v != Item.UNDEF && v <= 0; } @Override public OpV swap() { return GE; } @Override public OpV invert() { return GT; } }, /** Item comparison:less. */ LT("lt") { @Override public boolean eval(final Item a, final Item b, final Collation coll, final InputInfo ii) throws QueryException { final int v = a.diff(b, coll, ii); return v != Item.UNDEF && v < 0; } @Override public OpV swap() { return GT; } @Override public OpV invert() { return GE; } }, /** Item comparison:greater of equal. */ GE("ge") { @Override public boolean eval(final Item a, final Item b, final Collation coll, final InputInfo ii) throws QueryException { final int v = a.diff(b, coll, ii); return v != Item.UNDEF && v >= 0; } @Override public OpV swap() { return LE; } @Override public OpV invert() { return LT; } }, /** Item comparison:greater. */ GT("gt") { @Override public boolean eval(final Item a, final Item b, final Collation coll, final InputInfo ii) throws QueryException { final int v = a.diff(b, coll, ii); return v != Item.UNDEF && v > 0; } @Override public OpV swap() { return LT; } @Override public OpV invert() { return LE; } }, /** Item comparison:equal. */ EQ("eq") { @Override public boolean eval(final Item a, final Item b, final Collation coll, final InputInfo ii) throws QueryException { return a.eq(b, coll, ii); } @Override public OpV swap() { return EQ; } @Override public OpV invert() { return NE; } }, /** Item comparison:not equal. */ NE("ne") { @Override public boolean eval(final Item a, final Item b, final Collation coll, final InputInfo ii) throws QueryException { return !a.eq(b, coll, ii); } @Override public OpV swap() { return NE; } @Override public OpV invert() { return EQ; } }; /** Cached enums (faster). */ public static final OpV[] VALUES = values(); /** String representation. */ public final String name; /** * Constructor. * @param n string representation */ OpV(final String n) { name = n; } /** * Evaluates the expression. * @param a first item * @param b second item * @param coll query context * @param ii input info * @return result * @throws QueryException query exception */ public abstract boolean eval(final Item a, final Item b, final Collation coll, final InputInfo ii) throws QueryException; /** * Swaps the comparator. * @return swapped comparator */ public abstract OpV swap(); /** * Inverts the comparator. * @return inverted comparator */ public abstract OpV invert(); @Override public String toString() { return name; } } /** Comparator. */ OpV op; /** * Constructor. * @param e1 first expression * @param e2 second expression * @param o operator * @param ii input info */ public CmpV(final Expr e1, final Expr e2, final OpV o, final InputInfo ii) { super(ii, e1, e2); op = o; } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { super.compile(ctx, scp); // swap expressions if(swap()) { op = op.swap(); ctx.compInfo(OPTSWAP, this); } final Expr e1 = expr[0]; final Expr e2 = expr[1]; type = SeqType.get(AtomType.BLN, e1.size() == 1 && e2.size() == 1 ? Occ.ONE : Occ.ZERO_ONE); Expr e = this; if(oneIsEmpty()) { e = optPre(null, ctx); } else if(allAreValues()) { e = preEval(ctx); } else if(e1.isFunction(Function.COUNT)) { e = compCount(op); if(e != this) ctx.compInfo(e instanceof Bln ? OPTPRE : OPTWRITE, this); } else if(e1.isFunction(Function.POSITION)) { // position() CMP number e = Pos.get(op, e2, e, info); if(e != this) ctx.compInfo(OPTWRITE, this); } else if(e1.type().eq(SeqType.BLN) && (op == OpV.EQ && e2 == Bln.FALSE || op == OpV.NE && e2 == Bln.TRUE)) { // (A eq false()) -> not(A) e = Function.NOT.get(info, e1); } return e; } @Override public Expr compEbv(final QueryContext ctx) { // e.g.: if($x eq true()) -> if($x) // checking one direction is sufficient, as operators may have been swapped return (op == OpV.EQ && expr[1] == Bln.TRUE || op == OpV.NE && expr[1] == Bln.FALSE) && expr[0].type().eq(SeqType.BLN) ? expr[0] : this; } @Override public Bln item(final QueryContext ctx, final InputInfo ii) throws QueryException { final Item a = expr[0].item(ctx, info); if(a == null) return null; final Item b = expr[1].item(ctx, info); if(b == null) return null; if(a.comparable(b)) return Bln.get(op.eval(a, b, ctx.sc.collation, info)); if(a instanceof FItem) Err.FIEQ.thrw(info, a); if(b instanceof FItem) Err.FIEQ.thrw(info, b); throw Err.INVTYPECMP.thrw(info, a.type, b.type); } @Override public CmpV invert() { return expr[0].size() != 1 || expr[1].size() != 1 ? this : new CmpV(expr[0], expr[1], op.invert(), info); } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new CmpV(expr[0].copy(ctx, scp, vs), expr[1].copy(ctx, scp, vs), op, info); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(OP, op.name), expr); } @Override public String description() { return "'" + op + "' expression"; } @Override public String toString() { return toString(" " + op + ' '); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Constr.java000066400000000000000000000111131222453003200254320ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.util.Err.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Element constructor. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Constr { /** Node array. */ public final ANodeList children = new ANodeList(); /** Attribute array. */ public final ANodeList atts = new ANodeList(); /** Namespace array. */ public final Atts nspaces = new Atts(); /** Error: attribute position. */ public boolean errAtt; /** Error: namespace position. */ public boolean errNS; /** Error: duplicate attribute. */ public byte[] duplAtt; /** Error: duplicate namespace. */ public byte[] duplNS; /** Query context. */ private final QueryContext ctx; /** Input information. */ private final InputInfo info; /** Text cache. */ private final TokenBuilder text = new TokenBuilder(); /** Space separator flag. */ private boolean more; /** * Creates the children of the constructor. * @param ii input info * @param qc query context */ public Constr(final InputInfo ii, final QueryContext qc) { info = ii; ctx = qc; } /** * Constructs child and attribute nodes. * @param expr input expressions * @return self reference * @throws QueryException query exception */ public Constr add(final Expr... expr) throws QueryException { final int s = ctx.sc.ns.size(); try { for(final Expr e : expr) { more = false; final Iter iter = ctx.iter(e); for(Item ch; (ch = iter.next()) != null && add(ch);); } if(!text.isEmpty()) children.add(new FTxt(text.finish())); return this; } finally { ctx.sc.ns.size(s); } } /** * Recursively adds nodes to the element arrays. Recursion is necessary * as documents are resolved to their child nodes. * @param it current item * @return true if item was added * @throws QueryException query exception */ private boolean add(final Item it) throws QueryException { if(it instanceof FItem) CONSFUNC.thrw(info, it); if(!(it instanceof ANode)) { // type: atomic value if(more) text.add(' '); text.add(it.string(info)); more = true; } else { // type: nodes ANode node = (ANode) it; final Type ip = it.type; if(ip == NodeType.TXT) { // type: text node text.add(node.string()); } else if(ip == NodeType.ATT) { // type: attribute node // no attribute allowed after texts or child nodes if(!text.isEmpty() || !children.isEmpty()) { errAtt = true; return false; } // check for duplicate attribute names final QNm name = node.qname(); for(int a = 0; a < atts.size(); ++a) { if(name.eq(atts.get(a).qname())) { duplAtt = name.string(); return false; } } // add attribute atts.add(new FAttr(name, node.string())); // add new namespace if(name.hasURI()) ctx.sc.ns.add(name.prefix(), name.uri()); } else if(ip == NodeType.NSP) { // type: namespace node // no attribute allowed after texts or child nodes if(!text.isEmpty() || !children.isEmpty()) { errNS = true; return false; } // add namespace final byte[] name = node.name(); final byte[] uri = node.string(); final byte[] u = nspaces.value(name); if(u == null) { nspaces.add(name, uri); } else if(!Token.eq(uri, u)) { // duplicate namespace (ignore duplicates with same uri) duplNS = name; return false; } } else if(ip == NodeType.DOC) { // type: document node final AxisIter ai = node.children(); for(ANode ch; (ch = ai.next()) != null && add(ch);); } else { // type: element/comment/processing instruction node // add text node if(!text.isEmpty()) { children.add(new FTxt(text.finish())); text.reset(); } // [CG] XQuery, element construction: avoid full copy of sub tree if not needed node = node.deepCopy(); children.add(node); } more = false; } return true; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Context.java000066400000000000000000000043131222453003200256120ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.core.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.path.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Context item. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Context extends Simple { /** * Constructor. * @param ii input info */ public Context(final InputInfo ii) { super(ii); type = SeqType.ITEM; size = 1; } @Override public Context compile(final QueryContext ctx, final VarScope scp) { if(ctx.value != null) { type = ctx.value.type(); size = ctx.value.size(); } return this; } @Override public Iter iter(final QueryContext ctx) throws QueryException { return checkCtx(ctx).iter(); } @Override public Value value(final QueryContext ctx) throws QueryException { return checkCtx(ctx); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { return checkCtx(ctx).item(ctx, info); } @Override public boolean has(final Flag flag) { return flag == Flag.CTX; } @Override public boolean removable(final Var v) { return false; } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return copyType(new Context(info)); } @Override public boolean accept(final ASTVisitor visitor) { return visitor.lock(DBLocking.CTX) && super.accept(visitor); } @Override public Expr addText(final QueryContext ctx) { // replacing context node with text() node to facilitate index rewritings if(!ctx.leaf) return this; ctx.compInfo(OPTTEXT); return Path.get(info, null, Step.get(info, Axis.CHILD, Test.TXT)); } @Override public boolean sameAs(final Expr cmp) { return cmp instanceof Context; } @Override public String toString() { return "."; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/DBPragma.java000066400000000000000000000021741222453003200256060ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.util.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * Pragma for database options. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class DBPragma extends Pragma { /** Option key. */ private final String key; /** Cached value. */ private Object old; /** * Constructor. * @param n name of pragma * @param v optional value */ public DBPragma(final QNm n, final byte[] v) { super(n, v); key = string(n.local()); } @Override void init(final QueryContext ctx, final InputInfo info) throws QueryException { old = ctx.context.prop.get(key); try { ctx.context.prop.set(key.toUpperCase(Locale.ENGLISH), string(value)); } catch(final Exception ex) { BASX_VALUE.thrw(info, ex.getMessage()); } } @Override void finish(final QueryContext ctx) { ctx.context.prop.setObject(key, old); } @Override public Pragma copy() { return new DBPragma(name, value); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Except.java000066400000000000000000000055411222453003200254220ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Except expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Except extends Set { /** * Constructor. * @param ii input info * @param e expression list */ public Except(final InputInfo ii, final Expr[] e) { super(ii, e); } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { super.compile(ctx, scp); final int es = expr.length; final ExprList el = new ExprList(es); for(final Expr ex : expr) { if(ex.isEmpty()) { // remove empty operands (return empty sequence if first value is empty) if(el.isEmpty()) return optPre(null, ctx); ctx.compInfo(OPTREMOVE, this, ex); } else { el.add(ex); } } // ensure that results are always sorted if(el.size() == 1 && iterable) return el.get(0); // replace expressions with optimized list if(el.size() != es) expr = el.finish(); return this; } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final Except ex = new Except(info, copyAll(ctx, scp, vs, expr)); ex.iterable = iterable; return copyType(ex); } @Override protected NodeSeqBuilder eval(final Iter[] iter) throws QueryException { final NodeSeqBuilder nc = new NodeSeqBuilder().check(); for(Item it; (it = iter[0].next()) != null;) nc.add(checkNode(it)); final boolean db = nc.dbnodes(); for(int e = 1; e != expr.length && nc.size() != 0; ++e) { final Iter ir = iter[e]; for(Item it; (it = ir.next()) != null;) { final int i = nc.indexOf(checkNode(it), db); if(i != -1) nc.delete(i); } } return nc; } @Override protected NodeIter iter(final Iter[] iter) { return new SetIter(iter) { @Override public ANode next() throws QueryException { if(item == null) { item = new ANode[iter.length]; for(int i = 0; i != iter.length; ++i) next(i); } for(int i = 1; i != item.length; ++i) { if(item[0] == null) return null; if(item[i] == null) continue; final int d = item[0].diff(item[i]); if(d < 0 && i + 1 == item.length) break; if(d == 0) { next(0); i = 0; } if(d > 0) next(i--); } final ANode temp = item[0]; next(0); return temp; } }; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Expr.java000066400000000000000000000324011222453003200251030ustar00rootroot00000000000000package org.basex.query.expr; import java.util.*; import org.basex.data.*; import org.basex.query.*; import org.basex.query.func.*; import org.basex.query.gflwor.*; import org.basex.query.iter.*; import org.basex.query.path.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Abstract class for representing XQuery expressions. * Expression are divided into {@link ParseExpr} and {@link Value} classes. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class Expr extends ExprInfo { /** Flags that influence query compilation. */ public enum Flag { /** Creates new fragments. Example: node constructor. */ CNS, /** Depends on context. Example: context node. */ CTX, /** Non-deterministic. Example: random:double(). */ NDT, /** Focus-dependent. Example: position(). */ FCS, /** Performs updates. Example: insert expression. */ UPD, /** XQuery 3.0 function. Example: has-children(). */ X30, } /** * Checks if all updating expressions are correctly placed. * This function is only called if any updating expression was found in the query. * @throws QueryException query exception */ public abstract void checkUp() throws QueryException; /** * Compiles and optimizes the expression, assigns data types and cardinalities. * @param ctx query context * @param scp variable scope * @return optimized expression * @throws QueryException query exception */ public abstract Expr compile(QueryContext ctx, VarScope scp) throws QueryException; /** * Optimizes an already compiled expression without recompiling its sub-expressions. * @param ctx query context * @param scp variable scope * @return optimized expression * @throws QueryException query exception */ @SuppressWarnings("unused") public Expr optimize(final QueryContext ctx, final VarScope scp) throws QueryException { return this; }; /** * Evaluates the expression and returns an iterator on the resulting items. * If this method is not overwritten, {@link #item} must be implemented * by an expression, as it may be called by this method. * @param ctx query context * @return resulting item * @throws QueryException query exception */ public abstract Iter iter(final QueryContext ctx) throws QueryException; /** * Evaluates the expression and returns the resulting item or * a {@code null} reference, if the expression yields an empty sequence. * If this method is not overwritten, {@link #iter} must be implemented * by an expression, as it may be called by this method. * @param ctx query context * @param ii input info * @return iterator * @throws QueryException query exception */ public abstract Item item(final QueryContext ctx, final InputInfo ii) throws QueryException; /** * Evaluates the expression and returns the resulting value. * @param ctx query context * @return iterator * @throws QueryException query exception */ public abstract Value value(final QueryContext ctx) throws QueryException; /** * Checks if the iterator can be dissolved into an effective boolean value. * If not, returns an error. If yes, returns the first value - which can be * also be e.g. an integer, which is later evaluated as numeric predicate. * @param ctx query context * @param ii input info * @return item * @throws QueryException query exception */ public abstract Item ebv(final QueryContext ctx, final InputInfo ii) throws QueryException; /** * Performs a predicate test and returns the item if test was successful. * @param ctx query context * @param ii input info * @return item * @throws QueryException query exception */ public abstract Item test(final QueryContext ctx, final InputInfo ii) throws QueryException; /** * Tests if this is an empty sequence. This function is only overwritten * by the {@link Empty} class, which represents the empty sequence. * @return result of check */ public boolean isEmpty() { return false; } /** * Tests if this is a vacuous expression (empty sequence or error function). * This check is needed for updating queries. * @return result of check */ public boolean isVacuous() { return false; } /** * Tests if this is a value. * @return result of check */ public boolean isValue() { return false; } /** * Tests if this is an item. * @return result of check */ public boolean isItem() { return false; } /** * Returns the sequence size or 1. * @return result of check */ public abstract long size(); /** * Indicates if an expression has the specified compiler property. This method is * called by numerous {@link #compile} methods to test properties of sub-expressions. * It returns {@code true} if at least one test is successful. * @param flag flag to be found * @return result of check */ public abstract boolean has(final Flag flag); /** * Checks if the given variable is used by this expression. * @param v variable to be checked * @return {@code true} if the variable is used, {@code false} otherwise */ public final boolean uses(final Var v) { // return true iff the the search was aborted, i.e. the variable is used return !accept(new ASTVisitor() { @Override public boolean used(final VarRef ref) { // abort when the variable is used return !ref.var.is(v); } }); } /** * Checks if the specified variable is replaceable by a context item. * The following tests might return false: *
    *
  • {@link Preds#removable}, if one of the variables is used within a predicate.
  • *
  • {@link MixedPath#removable}, if the variable occurs within the path.
  • *
* This method is called by {@link GFLWOR#compile} to rewrite where clauses * into predicates. * @param v variable to be replaced * @return result of check */ public abstract boolean removable(final Var v); /** * Checks how often a variable is used in this expression. * @param v variable to look for * @return how often the variable is used, see {@link VarUsage} */ public abstract VarUsage count(final Var v); /** * Inlines an expression into this one, replacing all references to the given variable. * @param ctx query context for recompilation * @param scp variable scope for recompilation * @param v variable to replace * @param e expression to inline * @return resulting expression in something changed, {@code null} otherwise * @throws QueryException query exception */ public abstract Expr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException; /** * Inlines the given expression into all elements of the given array. * @param ctx query context * @param scp variable scope * @param arr array * @param v variable to replace * @param e expression to inline * @return {@code true} if the array has changed, {@code false} otherwise * @throws QueryException query exception */ protected static boolean inlineAll(final QueryContext ctx, final VarScope scp, final Expr[] arr, final Var v, final Expr e) throws QueryException { boolean change = false; for(int i = 0; i < arr.length; i++) { final Expr nw = arr[i].inline(ctx, scp, v, e); if(nw != null) { arr[i] = nw; change = true; } } return change; } /** * Copies an expression. * Will be useful for inlining functions, or for copying static queries. * @param ctx query context * @param scp variable scope for creating new variables * @return copied expression */ public final Expr copy(final QueryContext ctx, final VarScope scp) { return copy(ctx, scp, new IntObjMap()); } /** * Copies an expression. * Will be useful for inlining functions, or for copying static queries. * @param ctx query context * @param scp variable scope for creating new variables * @param vs mapping from old variable IDs to new variable copies * @return copied expression */ public abstract Expr copy(QueryContext ctx, VarScope scp, IntObjMap vs); /** * Adds the names of the databases that will be touched by the query. * @param db set * @param rootContext is in root context * @return {@code false} if databases cannot be statically determined public abstract boolean databases(final StringList db, final boolean rootContext); */ /** *

This method is overwritten by {@link CmpG}, {@link CmpV} and {@link FNSimple}. * It is called at compile time by expressions that perform * effective boolean value tests (e.g. {@link If} or {@link Preds}). * If the arguments of the called expression return a boolean anyway, * the expression will be simplified.

*

Example in {@link CmpV}: * {@code if($x eq true())} is rewritten to {@code if($x)}, if {@code $x} * is known to return a single boolean.

* @param ctx query context * @return optimized expression */ @SuppressWarnings("unused") public Expr compEbv(final QueryContext ctx) { return this; } /** * Returns the static type of the evaluated value. For simplicity, some types have been * merged to super types. As an example, many numeric types are treated as integers. * @return result of check */ public abstract SeqType type(); /** * Indicates if the items returned by this expression are iterable, i.e., if returned * node are in document order and contain no duplicates. * It is e.g. called by {@link AxisPath}. * @return result of check */ public boolean iterable() { return type().zeroOrOne(); } /** * Checks if an expression can be rewritten to an index access. If this method is * implemented, {@link #indexEquivalent} must be implemented as well. * @param ic index costs analyzer * @return true if an index can be used * @throws QueryException query exception */ @SuppressWarnings("unused") public boolean indexAccessible(final IndexCosts ic) throws QueryException { return false; } /** * Returns an equivalent expression which accesses an index structure. Will be called * if {@link #indexAccessible} is returns true for an expression. * @param ic index costs analyzer * @return equivalent index-expression * @throws QueryException query exception */ @SuppressWarnings("unused") public Expr indexEquivalent(final IndexCosts ic) throws QueryException { return null; } /** * Compares the current and specified expression for equality. * @param cmp expression to be compared * @return result of check */ public boolean sameAs(final Expr cmp) { return this == cmp; } /** * Checks if this expression is a certain function. * @param f function definition * @return result of check */ @SuppressWarnings("unused") public boolean isFunction(final Function f) { return false; } /** * Optionally adds a text node to an expression for potential index rewriting. * @param ctx query context * @return expression */ @SuppressWarnings("unused") public Expr addText(final QueryContext ctx) { return this; } /** * Checks if this expression has free variables. * @return {@code true} if there are variables which are used but not declared * in this expression, {@code false} otherwise */ public boolean hasFreeVars() { final BitSet declared = new BitSet(); return !accept(new ASTVisitor() { @Override public boolean declared(final Var var) { declared.set(var.id); return true; } @Override public boolean used(final VarRef ref) { return declared.get(ref.var.id); } }); } /** Finds and marks tail calls, enabling TCO. */ public void markTailCalls() { } /** * Traverses this expression, notifying the visitor of declared and used variables, * and checking the tree for other recursive properties. * @param visitor visitor * @return if the walk should be continued */ public abstract boolean accept(final ASTVisitor visitor); /** * Visit all given expressions with the given visitor. * @param visitor visitor * @param exprs expressions to visit * @return success flag */ protected static final boolean visitAll(final ASTVisitor visitor, final Expr...exprs) { for(final Expr e : exprs) if(!e.accept(visitor)) return false; return true; } /** * Counts the number of expressions in this expression's sub-tree. * This method is e.g. called by {@link StaticFunc#inline} to check if an expression * is small enough to be inlined. * @return number of expressions */ public abstract int exprSize(); } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Extension.java000066400000000000000000000044151222453003200261450ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Pragma extension. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class Extension extends Single { /** Pragmas of the ExtensionExpression. */ private final Pragma[] pragmas; /** * Constructor. * @param ii input info * @param prag pragmas * @param e enclosed expression */ public Extension(final InputInfo ii, final Pragma[] prag, final Expr e) { super(ii, e); pragmas = prag; } @Override public void checkUp() throws QueryException { expr.checkUp(); } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { try { for(final Pragma p : pragmas) p.init(ctx, info); expr = expr.compile(ctx, scp); type = expr.type(); size = expr.size(); } finally { for(final Pragma p : pragmas) p.finish(ctx); } return this; } @Override public ValueIter iter(final QueryContext ctx) throws QueryException { return value(ctx).iter(ctx); } @Override public Value value(final QueryContext ctx) throws QueryException { try { for(final Pragma p : pragmas) p.init(ctx, info); return ctx.value(expr); } finally { for(final Pragma p : pragmas) p.finish(ctx); } } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final Pragma[] prag = pragmas.clone(); for(int i = 0; i < prag.length; i++) prag[i] = prag[i].copy(); return copyType(new Extension(info, prag, expr.copy(ctx, scp, vs))); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(), pragmas, expr); } @Override public String toString() { final StringBuilder sb = new StringBuilder(); for(final Pragma p : pragmas) sb.append(p).append(' '); return sb.append(BRACE1 + ' ' + expr + ' ' + BRACE2).toString(); } @Override public void markTailCalls() { // cannot be tail-call optimized because otherwise pragmas could be finished too early } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Filter.java000066400000000000000000000144601222453003200254170ustar00rootroot00000000000000package org.basex.query.expr; import org.basex.query.*; import org.basex.query.path.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.value.type.SeqType.Occ; import org.basex.query.var.*; import org.basex.util.*; /** * Abstract filter expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class Filter extends Preds { /** Expression. */ public Expr root; /** * Constructor. * @param ii input info * @param r expression * @param p predicates */ Filter(final InputInfo ii, final Expr r, final Expr... p) { super(ii, p); root = r; } /** * Creates a filter expression for the given root and predicates. * @param ii input info * @param r root expression * @param p predicate expressions * @return filter expression */ public static Filter get(final InputInfo ii, final Expr r, final Expr... p) { return new CachedFilter(ii, r, p); } @Override public void checkUp() throws QueryException { checkNoUp(root); super.checkUp(); } @Override public final Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { // invalidate current context value (will be overwritten by filter) final Value cv = ctx.value; try { root = root.compile(ctx, scp); // return empty root if(root.isEmpty()) return optPre(null, ctx); // convert filters without numeric predicates to axis paths if(root instanceof AxisPath && !super.has(Flag.FCS)) return ((AxisPath) root.copy(ctx, scp)).addPreds(ctx, scp, preds).compile(ctx, scp); // optimize filter expressions ctx.value = null; final Expr e = super.compile(ctx, scp); if(e != this) return e; // no predicates.. return root; otherwise, do some advanced compilations return preds.length == 0 ? root : opt(ctx); } finally { ctx.value = cv; } } /** * Compiles the filter expression, excluding the root node. * @param ctx query context * @return compiled expression */ private Expr opt(final QueryContext ctx) { // evaluate return type final SeqType t = root.type(); // determine number of results and type final long s = root.size(); if(s != -1) { if(pos != null) { size = Math.max(0, s + 1 - pos.min) - Math.max(0, s - pos.max); } else if(last) { size = s > 0 ? 1 : 0; } // no results will remain: return empty sequence if(size == 0) return optPre(null, ctx); type = SeqType.get(t.type, size); } else { type = SeqType.get(t.type, t.zeroOrOne() ? Occ.ZERO_ONE : Occ.ZERO_MORE); } // no numeric predicates.. use simple iterator if(!super.has(Flag.FCS)) return new IterFilter(this); // one single position() or last() function specified: return single value if(preds.length == 1 && (last || pos != null) && root.isValue() && t.one() && (last || pos.min == 1 && pos.max == 1)) return optPre(root, ctx); // only choose deterministic and context-independent offsets; e.g., skip: // (1 to 10)[random:integer(10)] or (1 to 10)[.] boolean off = false; if(preds.length == 1) { final Expr p = preds[0]; final SeqType st = p.type(); off = st.type.isNumber() && st.zeroOrOne() && !p.has(Flag.CTX) && !p.has(Flag.NDT); if(off) type = SeqType.get(type.type, Occ.ZERO_ONE); } // iterator for simple numeric predicate return off || useIterator() ? new IterPosFilter(this, off) : this; } /** * Adds a predicate to the filter. * @param ctx query context * @param scp variable scope * @param p predicate to be added * @return self reference * @throws QueryException query exception */ public abstract Filter addPred(final QueryContext ctx, final VarScope scp, final Expr p) throws QueryException; @Override public final Expr optimize(final QueryContext ctx, final VarScope scp) throws QueryException { // invalidate current context value (will be overwritten by filter) final Value cv = ctx.value; try { // return empty root if(root.isEmpty()) return optPre(null, ctx); // convert filters without numeric predicates to axis paths if(root instanceof AxisPath && !super.has(Flag.FCS)) return ((AxisPath) root.copy(ctx, scp)).addPreds(ctx, scp, preds); // no predicates.. return root; otherwise, do some advanced compilations return preds.length == 0 ? root : opt(ctx); } finally { ctx.value = cv; } } @Override public final boolean has(final Flag flag) { return root.has(flag) || flag != Flag.CTX && super.has(flag); } @Override public final boolean removable(final Var v) { return root.removable(v) && super.removable(v); } @Override public VarUsage count(final Var v) { final VarUsage inPreds = super.count(v), inRoot = root.count(v); if(inPreds == VarUsage.NEVER) return inRoot; final long sz = root.size(); return sz >= 0 && sz <= 1 || root.type().zeroOrOne() ? inRoot.plus(inPreds) : VarUsage.MORE_THAN_ONCE; } @Override public Expr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { final boolean pr = super.inline(ctx, scp, v, e) != null; final Expr rt = root == null ? null : root.inline(ctx, scp, v, e); if(rt != null) root = rt; return pr || rt != null ? optimize(ctx, scp) : null; } @Override public final void plan(final FElem plan) { final FElem el = planElem(); addPlan(plan, el, root); super.plan(el); } @Override public final String toString() { return root + super.toString(); } @Override public boolean accept(final ASTVisitor visitor) { for(final Expr e : preds) { visitor.enterFocus(); if(!e.accept(visitor)) return false; visitor.exitFocus(); } return root.accept(visitor); } @Override public final int exprSize() { int sz = 1; for(final Expr e : preds) sz += e.exprSize(); return sz + root.exprSize(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/If.java000066400000000000000000000125221222453003200245250ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.func.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * If expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class If extends Arr { /** If expression. */ private Expr cond; /** * Constructor. * @param ii input info * @param c condition * @param t then clause * @param e else clause */ public If(final InputInfo ii, final Expr c, final Expr t, final Expr e) { super(ii, t, e); cond = c; } @Override public void checkUp() throws QueryException { checkNoUp(cond); checkAllUp(expr); } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { cond = cond.compile(ctx, scp).compEbv(ctx); // static condition: return branch in question if(cond.isValue()) return optPre(eval(ctx).compile(ctx, scp), ctx); // compile and simplify branches final int es = expr.length; for(int e = 0; e < es; e++) { try { expr[e] = expr[e].compile(ctx, scp); } catch(final QueryException ex) { // replace original expression with error expr[e] = FNInfo.error(ex); } } // if A then B else B -> B (errors in A will be ignored) if(expr[0].sameAs(expr[1])) return optPre(expr[0], ctx); // if not(A) then B else C -> if A then C else B if(cond.isFunction(Function.NOT)) { ctx.compInfo(OPTWRITE, this); cond = ((StandardFunc) cond).expr[0]; final Expr tmp = expr[0]; expr[0] = expr[1]; expr[1] = tmp; } // if A then true() else false() -> boolean(A) if(expr[0] == Bln.TRUE && expr[1] == Bln.FALSE) { ctx.compInfo(OPTWRITE, this); return compBln(cond, info); } // if A then false() else true() -> not(A) // if A then B else true() -> not(A) or B if(expr[0].type().eq(SeqType.BLN) && expr[1] == Bln.TRUE) { ctx.compInfo(OPTWRITE, this); final Expr e = Function.NOT.get(info, cond); return expr[0] == Bln.FALSE ? e : new Or(info, e, expr[0]); } type = expr[0].type().union(expr[1].type()); return this; } @Override public Iter iter(final QueryContext ctx) throws QueryException { return ctx.iter(eval(ctx)); } @Override public Value value(final QueryContext ctx) throws QueryException { return ctx.value(eval(ctx)); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { return eval(ctx).item(ctx, info); } /** * Evaluates the condition and returns the matching expression. * @param ctx query context * @return resulting expression * @throws QueryException query exception */ private Expr eval(final QueryContext ctx) throws QueryException { return expr[cond.ebv(ctx, info).bool(info) ? 0 : 1]; } @Override public boolean has(final Flag flag) { return cond.has(flag) || super.has(flag); } @Override public boolean removable(final Var v) { return cond.removable(v) && super.removable(v); } @Override public VarUsage count(final Var v) { return cond.count(v).plus(VarUsage.maximum(v, expr)); } @Override public Expr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { final Expr sub = cond.inline(ctx, scp, v, e); if(sub != null) cond = sub; boolean te = false; final int es = expr.length; for(int i = 0; i < es; i++) { Expr nw; try { nw = expr[i].inline(ctx, scp, v, e); } catch(final QueryException qe) { nw = FNInfo.error(qe); } if(nw != null) { expr[i] = nw; te = true; } } return te || sub != null ? optimize(ctx, scp) : null; } @Override public If copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return copyType(new If(info, cond.copy(ctx, scp, vs), expr[0].copy(ctx, scp, vs), expr[1].copy(ctx, scp, vs))); } @Override public Expr indexEquivalent(final IndexCosts ic) throws QueryException { final int es = expr.length; for(int e = 0; e < es; ++e) expr[e] = expr[e].indexEquivalent(ic); return this; } @Override public boolean isVacuous() { return expr[0].isVacuous() && expr[1].isVacuous(); } @Override public void markTailCalls() { expr[0].markTailCalls(); expr[1].markTailCalls(); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(), cond, expr); } @Override public String toString() { return IF + '(' + cond + ") " + THEN + ' ' + expr[0] + ' ' + ELSE + ' ' + expr[1]; } @Override public boolean accept(final ASTVisitor visitor) { return cond.accept(visitor) && super.accept(visitor); } @Override public int exprSize() { int sz = 1; for(final Expr e : expr) sz += e.exprSize(); return sz + cond.exprSize(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/IndexAccess.java000066400000000000000000000014511222453003200263570ustar00rootroot00000000000000package org.basex.query.expr; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * This abstract class retrieves values from an index. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class IndexAccess extends Simple { /** Index context. */ final IndexContext ictx; /** * Constructor. * @param ic index context * @param ii input info */ protected IndexAccess(final IndexContext ic, final InputInfo ii) { super(ii); ictx = ic; type = SeqType.NOD_ZM; } @Override public abstract NodeIter iter(final QueryContext ctx) throws QueryException; @Override public final boolean iterable() { return ictx.iterable; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Instance.java000066400000000000000000000027371222453003200257420ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Instance test. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Instance extends Single { /** Sequence type. */ private final SeqType seq; /** * Constructor. * @param ii input info * @param e expression * @param s sequence type */ public Instance(final InputInfo ii, final Expr e, final SeqType s) { super(ii, e); seq = s; type = SeqType.BLN; } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { super.compile(ctx, scp); return expr.isValue() ? preEval(ctx) : this; } @Override public Bln item(final QueryContext ctx, final InputInfo ii) throws QueryException { return Bln.get(seq.instance(ctx.value(expr))); } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new Instance(info, expr.copy(ctx, scp, vs), seq); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(TYP, seq), expr); } @Override public String toString() { return Util.info("% instance of %", expr, seq); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/InterSect.java000066400000000000000000000043771222453003200261000ustar00rootroot00000000000000package org.basex.query.expr; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Intersect expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class InterSect extends Set { /** * Constructor. * @param ii input info * @param l expression list */ public InterSect(final InputInfo ii, final Expr[] l) { super(ii, l); } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { super.compile(ctx, scp); return oneIsEmpty() ? optPre(null, ctx) : this; } @Override protected NodeSeqBuilder eval(final Iter[] iter) throws QueryException { NodeSeqBuilder nc = new NodeSeqBuilder(); for(Item it; (it = iter[0].next()) != null;) nc.add(checkNode(it)); final boolean db = nc.dbnodes(); for(int e = 1; e != expr.length && nc.size() != 0; ++e) { final NodeSeqBuilder nt = new NodeSeqBuilder().check(); final Iter ir = iter[e]; for(Item it; (it = ir.next()) != null;) { final ANode n = checkNode(it); final int i = nc.indexOf(n, db); if(i != -1) nt.add(n); } nc = nt; } return nc; } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final InterSect is = new InterSect(info, copyAll(ctx, scp, vs, expr)); is.iterable = iterable; return copyType(is); } @Override protected NodeIter iter(final Iter[] iter) { return new SetIter(iter) { @Override public ANode next() throws QueryException { if(item == null) item = new ANode[iter.length]; for(int i = 0; i != iter.length; ++i) if(!next(i)) return null; for(int i = 1; i != item.length;) { final int d = item[0].diff(item[i]); if(d > 0) { if(!next(i)) return null; } else if(d < 0) { if(!next(0)) return null; i = 1; } else { ++i; } } return item[0]; } }; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/IterFilter.java000066400000000000000000000031001222453003200262300ustar00rootroot00000000000000package org.basex.query.expr; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.item.*; import org.basex.query.var.*; import org.basex.util.hash.*; /** * Iterative filter expression without numeric predicates. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class IterFilter extends Filter { /** * Constructor. * @param f original filter */ IterFilter(final Filter f) { super(f.info, f.root, f.preds); type = f.type; } @Override public Iter iter(final QueryContext ctx) { return new Iter() { /** Iterator. */ Iter iter; @Override public Item next() throws QueryException { // first call - initialize iterator if(iter == null) iter = ctx.iter(root); // filter sequence for(Item it; (it = iter.next()) != null;) { ctx.checkStop(); if(preds(it, ctx)) return it; } return null; } }; } @Override public Filter copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final Filter f = new CachedFilter(info, root == null ? null : root.copy(ctx, scp, vs), Arr.copyAll(ctx, scp, vs, preds)); return copy(new IterFilter(f)); } @Override public Filter addPred(final QueryContext ctx, final VarScope scp, final Expr p) throws QueryException { // [LW] should be fixed return ((Filter) new CachedFilter(info, root, preds).copy(ctx, scp) ).addPred(ctx, scp, p); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/IterPosFilter.java000066400000000000000000000071011222453003200267170ustar00rootroot00000000000000package org.basex.query.expr; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.item.*; import org.basex.query.var.*; import org.basex.util.hash.*; /** * Iterative filter expression with numeric predicates. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class IterPosFilter extends Filter { /** Offset flag. */ final boolean off; /** * Constructor. * @param f original filter * @param o offset flag */ IterPosFilter(final Filter f, final boolean o) { super(f.info, f.root, f.preds); off = o; type = f.type; last = f.last; size = f.size; pos = f.pos; } @Override public Iter iter(final QueryContext ctx) { return new Iter() { boolean skip, direct; Iter iter; long cpos; @Override public Item next() throws QueryException { if(skip) return null; // first call - initialize iterator if(iter == null) { if(off) { // evaluate offset and create position expression final Item it = preds[0].ebv(ctx, info); final long l = it.itr(info); final Expr e = Pos.get(l, l, info); // don't accept fractional numbers if(l != it.dbl(info) || !(e instanceof Pos)) return null; pos = (Pos) e; } iter = ctx.iter(root); cpos = 1; if(pos != null || last) { // runtime optimization: // items can be directly accessed if the iterator size is known final long s = iter.size(); if(s == 0) return null; if(s != -1) { cpos = last ? s : pos.min; if(cpos > s) return null; direct = preds.length == 1; } } } // cache context final long cp = ctx.pos; final long cs = ctx.size; try { Item item; if(direct) { // directly access relevant items item = iter.size() < cpos ? null : iter.get(cpos - 1); ctx.pos = cpos++; } else { // loop through all items Item lnode = null; while((item = iter.next()) != null) { // evaluate predicates ctx.checkStop(); ctx.size = 0; ctx.pos = cpos++; if(preds(item, ctx)) break; // remember last node lnode = item; ctx.pos = cp; ctx.size = cs; } // returns the last item if(last) item = lnode; } // check if more items can be expected skip = last || pos != null && pos.skip(ctx); if(skip && direct) iter.reset(); return item; } finally { // reset context and return result ctx.pos = cp; ctx.size = cs; } } }; } @Override public Filter copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final Filter f = new CachedFilter(info, root == null ? null : root.copy(ctx, scp, vs), Arr.copyAll(ctx, scp, vs, preds)); return copy(new IterPosFilter(f, off)); } @Override public Filter addPred(final QueryContext ctx, final VarScope scp, final Expr p) throws QueryException { // [LW] should be fixed return ((Filter) new CachedFilter(info, root, preds).copy(ctx, scp) ).addPred(ctx, scp, p); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/List.java000066400000000000000000000103741222453003200251050ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.query.value.type.SeqType.Occ; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Expression list. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class List extends Arr { /** Limit for the size of sequences that are materialized at compile time. */ private static final int MAX_MAT_SIZE = 1 << 20; /** * Constructor. * @param ii input info * @param l expression list */ public List(final InputInfo ii, final Expr... l) { super(ii, l); } @Override public void checkUp() throws QueryException { checkAllUp(expr); } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { final int es = expr.length; for(int e = 0; e < es; e++) expr[e] = expr[e].compile(ctx, scp); return optimize(ctx, scp); } @Override public Expr optimize(final QueryContext ctx, final VarScope scp) throws QueryException { // compute number of results size = 0; boolean ne = false; for(final Expr e : expr) { final long c = e.size(); ne |= c > 0 || e.type().occ.min == 1; if(c == -1) { size = -1; break; } else if(size >= 0) { size += c; } } if(size >= 0) { if(size == 0 && !has(Flag.NDT) && !has(Flag.UPD)) return optPre(null, ctx); if(allAreValues() && size <= MAX_MAT_SIZE) { Type all = null; final Value[] vs = new Value[expr.length]; int c = 0; for(final Expr e : expr) { final Value v = e.value(ctx); if(c == 0) all = v.type; else if(all != v.type) all = null; vs[c++] = v; } Value val = null; final int s = (int) size; if(all == AtomType.STR) val = StrSeq.get(vs, s); else if(all == AtomType.BLN) val = BlnSeq.get(vs, s); else if(all == AtomType.FLT) val = FltSeq.get(vs, s); else if(all == AtomType.DBL) val = DblSeq.get(vs, s); else if(all == AtomType.DEC) val = DecSeq.get(vs, s); else if(all == AtomType.BYT) val = BytSeq.get(vs, s); else if(all != null && all.instanceOf(AtomType.ITR)) { val = IntSeq.get(vs, s, all); } else { final ValueBuilder vb = new ValueBuilder(s); for(int i = 0; i < c; i++) vb.add(vs[i]); val = vb.value(); } return optPre(val, ctx); } } if(size == 0) { type = SeqType.EMP; } else { final Occ o = size == 1 ? Occ.ONE : size < 0 && !ne ? Occ.ZERO_MORE : Occ.ONE_MORE; SeqType t = null; for(final Expr e : expr) { final SeqType st = e.type(); if(e.size() != 0 && st.occ != Occ.ZERO) t = t == null ? st : t.union(st); } type = SeqType.get(t == null ? AtomType.ITEM : t.type, o); } return this; } @Override public Iter iter(final QueryContext ctx) { return new Iter() { Iter ir; int e; @Override public Item next() throws QueryException { while(true) { if(ir == null) { if(e == expr.length) return null; ir = ctx.iter(expr[e++]); } final Item it = ir.next(); if(it != null) return it; ir = null; } } }; } @Override public Value value(final QueryContext ctx) throws QueryException { final ValueBuilder vb = new ValueBuilder(); for(final Expr e : expr) vb.add(ctx.value(e)); return vb.value(); } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return copyType(new List(info, copyAll(ctx, scp, vs, expr))); } @Override public boolean isVacuous() { for(final Expr e : expr) if(!e.isVacuous()) return false; return true; } @Override public String toString() { return toString(SEP); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/LitMap.java000066400000000000000000000031221222453003200253510ustar00rootroot00000000000000package org.basex.query.expr; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.query.value.map.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * A literal map expression. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class LitMap extends Arr { /** * Constructor. * @param ii input info * @param e key and value expression, interleaved */ public LitMap(final InputInfo ii, final Expr[] e) { super(ii, e); type = SeqType.MAP_O; } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { super.compile(ctx, scp); return allAreValues() ? preEval(ctx) : this; } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { Map map = Map.EMPTY; final int es = expr.length; for(int i = 0; i < es; i++) { map = map.insert(checkItem(expr[i], ctx), ctx.value(expr[++i]), ii); } return map; } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new LitMap(info, copyAll(ctx, scp, vs, expr)); } @Override public String toString() { final TokenBuilder tb = new TokenBuilder("{ "); boolean key = true; for(final Expr e : expr) { tb.add(key ? tb.size() > 2 ? ", " : "" : ":").add(e.toString()); key ^= true; } return tb.add(" }").toString(); } @Override public String description() { return QueryText.MAPSTR; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Logical.java000066400000000000000000000037151222453003200255450ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; /** * Logical expression, extended by {@link And} and {@link Or}. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class Logical extends Arr { /** * Constructor. * @param ii input info * @param e expression list */ protected Logical(final InputInfo ii, final Expr[] e) { super(ii, e); type = SeqType.BLN; } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { super.compile(ctx, scp); final boolean and = this instanceof And; final int es = expr.length; final ExprList el = new ExprList(es); for(int e = 0; e < es; e++) { final Expr ex = expr[e].compEbv(ctx); if(ex.isValue()) { // atomic items can be pre-evaluated ctx.compInfo(OPTREMOVE, this, expr[e]); if(ex.ebv(ctx, info).bool(info) ^ and) return Bln.get(!and); } else { el.add(ex); } } if(el.isEmpty()) return Bln.get(and); expr = el.finish(); return this; } /** * Flattens nested logical expressions. * @param ctx query context */ protected final void compFlatten(final QueryContext ctx) { // flatten nested expressions final int es = expr.length; final ExprList tmp = new ExprList(es); final boolean and = this instanceof And; final boolean or = this instanceof Or; for(final Expr ex : expr) { if(and && ex instanceof And || or && ex instanceof Or) { for(final Expr e : ((Logical) ex).expr) tmp.add(e); ctx.compInfo(OPTFLAT, ex); } else { tmp.add(ex); } } if(es != tmp.size()) expr = tmp.finish(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Or.java000066400000000000000000000055151222453003200245530ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.ft.*; import org.basex.util.hash.*; /** * Or expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Or extends Logical { /** * Constructor. * @param ii input info * @param e expression list */ public Or(final InputInfo ii, final Expr... e) { super(ii, e); } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { // remove atomic values final Expr c = super.compile(ctx, scp); if(c != this) return c; // merge predicates if possible CmpG cmpg = null; final ExprList el = new ExprList(expr.length); for(final Expr e : expr) { Expr tmp = null; if(e instanceof CmpG) { // merge general comparisons final CmpG g = (CmpG) e; if(cmpg == null) cmpg = g; else if(cmpg.union(g, ctx, scp)) tmp = g; } // no optimization found; add original expression if(tmp == null) el.add(e); } if(expr.length != el.size()) { ctx.compInfo(OPTWRITE, this); expr = el.finish(); } compFlatten(ctx); // return single expression if it yields a boolean return expr.length == 1 ? compBln(expr[0], info) : this; } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { double d = 0; boolean f = false; for(final Expr e : expr) { final Item it = e.ebv(ctx, info); if(it.bool(info)) { final double s = it.score(); if(s == 0) return Bln.TRUE; d = Scoring.or(d, s); f = true; } } return d == 0 ? Bln.get(f) : Bln.get(d); } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new Or(info, copyAll(ctx, scp, vs, expr)); } @Override public boolean indexAccessible(final IndexCosts ic) throws QueryException { int is = 0; Expr[] exprs = {}; boolean ia = true; for(final Expr e : expr) { if(e.indexAccessible(ic) && !ic.seq) { // skip expressions without results if(ic.costs() == 0) continue; is += ic.costs(); } else { ia = false; } exprs = Array.add(exprs, e); } ic.costs(is); expr = exprs; return ia; } @Override public Expr indexEquivalent(final IndexCosts ic) throws QueryException { super.indexEquivalent(ic); return new Union(info, expr); } @Override public String toString() { return toString(' ' + OR + ' '); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/ParseExpr.java000066400000000000000000000421211222453003200260760ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import org.basex.core.*; import org.basex.data.*; import org.basex.query.*; import org.basex.query.func.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.map.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Abstract parse expression. All non-value expressions are derived from * this class. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class ParseExpr extends Expr { /** Input information. */ public InputInfo info; /** Cardinality of result; unknown if set to -1. */ public long size = -1; /** Static type. */ public SeqType type; /** * Constructor. * @param ii input info */ protected ParseExpr(final InputInfo ii) { info = ii; } @Override public Iter iter(final QueryContext ctx) throws QueryException { final Item it = item(ctx, info); return it != null ? it.iter() : Empty.ITER; } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { final Iter ir = iter(ctx); final Item it = ir.next(); if(it == null || ir.size() == 1) return it; Item n = ir.next(); if(n != null) { final ValueBuilder vb = new ValueBuilder().add(it).add(n); n = ir.next(); if(n != null) vb.add(Str.get("...")); SEQCAST.thrw(ii, vb.value()); } return it; } @Override public Value value(final QueryContext ctx) throws QueryException { if(type().zeroOrOne()) { final Value v = item(ctx, info); return v == null ? Empty.SEQ : v; } return ctx.iter(this).value(); } /** * Copies this expression's return type and size to the given expression. * @param expression type * @param e expression * @return the expression for convenience */ protected final T copyType(final T e) { e.type = type; e.size = size; return e; } @Override public final Item ebv(final QueryContext ctx, final InputInfo ii) throws QueryException { final Item it; if(type().zeroOrOne()) { it = item(ctx, info); } else { final Iter ir = iter(ctx); it = ir.next(); if(!(it == null || it instanceof ANode || ir.next() == null)) CONDTYPE.thrw(info, this); } return it == null ? Bln.FALSE : it; } @Override public final Item test(final QueryContext ctx, final InputInfo ii) throws QueryException { final Item it = ebv(ctx, info); return (it instanceof ANum ? it.dbl(info) == ctx.pos : it.bool(info)) ? it : null; } @Override public SeqType type() { return type != null ? type : SeqType.ITEM_ZM; } @Override public final long size() { return size == -1 ? type().occ() : size; } // OPTIMIZATIONS ============================================================ /** * Pre-evaluates the specified expression. * @param ctx query context * @return optimized expression * @throws QueryException query exception */ public final Expr preEval(final QueryContext ctx) throws QueryException { return optPre(item(ctx, info), ctx); } /** * Adds an optimization info for pre-evaluating the specified expression. * @param opt optimized expression * @param ctx query context * @return optimized expression */ protected final Expr optPre(final Expr opt, final QueryContext ctx) { if(opt != this) ctx.compInfo(OPTPRE, this); return opt == null ? Empty.SEQ : opt; } /** * Returns a boolean equivalent for the specified expression. * If the specified expression yields a boolean value anyway, it will be * returned as is. Otherwise, it will be wrapped into a boolean function. * @param e expression to be rewritten * @param ii input info * @return expression */ public static final Expr compBln(final Expr e, final InputInfo ii) { return e.type().eq(SeqType.BLN) ? e : Function.BOOLEAN.get(ii, e); } // VALIDITY CHECKS ========================================================== /** * Ensures that the specified expression performs no updates. * Otherwise, throws an exception. * @param e expression (may be {@code null}) * @throws QueryException query exception */ public void checkNoUp(final Expr e) throws QueryException { if(e != null && e.has(Flag.UPD)) UPNOT.thrw(info, description()); } /** * Ensures that none of the specified expressions performs an update. * Otherwise, throws an exception. * @param expr expressions (may contain {@code null} references) * @throws QueryException query exception */ public final void checkNoneUp(final Expr... expr) throws QueryException { if(expr != null) for(final Expr e : expr) checkNoUp(e); } /** * Ensures that all specified expressions are either updating and vacuous or * non-updating. Otherwise, throws an exception. * @param expr expressions to be checked * @throws QueryException query exception */ public void checkAllUp(final Expr... expr) throws QueryException { // updating state: 0 = initial state, 1 = updating, -1 = non-updating int s = 0; for(final Expr e : expr) { e.checkUp(); if(e.isVacuous()) continue; final boolean u = e.has(Flag.UPD); if(u && s == -1 || !u && s == 1) UPALL.thrw(info, description()); s = u ? 1 : -1; } } /** * Checks if the specified expression yields a boolean. * Returns the boolean or throws an exception. * @param e expression to be checked * @param ctx query context * @return boolean * @throws QueryException query exception */ public final boolean checkBln(final Expr e, final QueryContext ctx) throws QueryException { final Item it = checkNoEmpty(e.item(ctx, info), AtomType.BLN); final Type ip = it.type; if(ip == AtomType.BLN || ip.isUntyped()) return it.bool(info); throw Err.INVCAST.thrw(info, it.type, AtomType.BLN); } /** * Checks if the specified expression yields a double. * Returns the double or throws an exception. * @param e expression to be checked * @param ctx query context * @return double * @throws QueryException query exception */ public final double checkDbl(final Expr e, final QueryContext ctx) throws QueryException { final Item it = checkNoEmpty(e.item(ctx, info), AtomType.DBL); if(it.type.isNumberOrUntyped()) return it.dbl(info); throw number(this, it); } /** * Checks if the specified expression is an integer. * Returns a token representation or an exception. * @param e expression to be checked * @param ctx query context * @return integer value * @throws QueryException query exception */ public final long checkItr(final Expr e, final QueryContext ctx) throws QueryException { return checkItr(checkNoEmpty(e.item(ctx, info), AtomType.ITR)); } /** * Checks if the specified item is a number. * Returns a token representation or an exception. * @param it item to be checked * @return item * @throws QueryException query exception */ public final long checkItr(final Item it) throws QueryException { final Type ip = it.type; if(ip.instanceOf(AtomType.ITR) || ip.isUntyped()) return it.itr(info); throw Err.INVCAST.thrw(info, it.type, AtomType.ITR); } /** * Checks if the specified expression yields a node. * Returns the boolean or throws an exception. * @param e expression to be checked * @param ctx query context * @return boolean * @throws QueryException query exception */ public final ANode checkNode(final Expr e, final QueryContext ctx) throws QueryException { return checkNode(checkItem(e, ctx)); } /** * Checks if the specified item is a node. * Returns the node or an exception. * @param it item to be checked * @return item * @throws QueryException query exception */ public final ANode checkNode(final Item it) throws QueryException { if(it instanceof ANode) return (ANode) it; throw Err.INVCAST.thrw(info, it.type, NodeType.NOD); } /** * Checks if the specified expression is a database node. * Returns the node or an exception. * @param it item to be checked * @return item * @throws QueryException query exception */ public final DBNode checkDBNode(final Item it) throws QueryException { if(it instanceof DBNode) return (DBNode) it; throw BXDB_NODB.thrw(info, this); } /** * Checks if the specified collation is supported. * @param e expression to be checked * @param ctx query context * @return collator, or {@code null} (default collation) * @throws QueryException query exception */ public final Collation checkColl(final Expr e, final QueryContext ctx) throws QueryException { return Collation.get(e == null ? null : checkStr(e, ctx), ctx, info, WHICHCOLL); } /** * Checks if the specified expression yields a string. * Returns a token representation or an exception. * @param e expression to be evaluated * @param ctx query context * @return string representation * @throws QueryException query exception */ public final byte[] checkStr(final Expr e, final QueryContext ctx) throws QueryException { return checkStr(checkItem(e, ctx)); } /** * Checks if the specified item is a string. * Returns a token representation or an exception. * @param it item to be checked * @return string representation * @throws QueryException query exception */ public final byte[] checkStr(final Item it) throws QueryException { final Type ip = it.type; if(ip.isStringOrUntyped()) return it.string(info); throw Err.INVCAST.thrw(info, it.type, AtomType.STR); } /** * Checks if the specified item is a string or an empty sequence. * Returns a token representation or an exception. * @param it item to be checked * @return string representation * @throws QueryException query exception */ public final byte[] checkEStr(final Item it) throws QueryException { if(it == null) return EMPTY; final Type ip = it.type; if(ip.isStringOrUntyped()) return it.string(info); if(it instanceof FItem) FIATOM.thrw(info, this); throw Err.INVCAST.thrw(info, it.type, AtomType.STR); } /** * Throws an exception if the context value is not set. * @param ctx query context * @return context * @throws QueryException query exception */ public final Value checkCtx(final QueryContext ctx) throws QueryException { final Value v = ctx.value; if(v != null) return v; throw NOCTX.thrw(info, this); } /** * Throws an exception if the context value is not a node. * @param ctx query context * @return context * @throws QueryException query exception */ public final ANode checkNode(final QueryContext ctx) throws QueryException { final Value v = ctx.value; if(v == null) NOCTX.thrw(info, this); if(!(v instanceof ANode)) STEPNODE.thrw(info, this, v.type); return (ANode) v; } /** * Checks if the specified expression yields a non-empty item. * @param e expression to be evaluated * @param ctx query context * @return item * @throws QueryException query exception */ public final Item checkItem(final Expr e, final QueryContext ctx) throws QueryException { return checkNoEmpty(e.item(ctx, info)); } /** * Checks if the specified expression yields a binary item. * @param e expression to be evaluated * @param ctx query context * @return binary item * @throws QueryException query exception */ public final Bin checkBinary(final Expr e, final QueryContext ctx) throws QueryException { final Item it = checkItem(e, ctx); if(it instanceof Bin) return (Bin) it; throw BINARYTYPE.thrw(info, it.type); } /** * Checks if the specified expression yields a string or binary item. * @param it item to be checked * @return byte representation * @throws QueryException query exception */ public final byte[] checkStrBin(final Item it) throws QueryException { if(it instanceof AStr) return it.string(info); if(it instanceof Bin) return ((Bin) it).binary(info); throw STRBINTYPE.thrw(info, it.type); } /** * Checks if the specified expression has the specified type; if no, throws * an exception. * @param e expression to be checked * @param ctx query context * @return specified item * @throws QueryException query exception */ public final QNm checkQNm(final Expr e, final QueryContext ctx) throws QueryException { final Item it = checkItem(e, ctx); if(it.type == AtomType.QNM) return (QNm) it; if(it.type.isUntyped() && ctx.sc.xquery3()) NSSENS.thrw(info, it.type, AtomType.QNM); throw Err.INVCAST.thrw(info, it.type, AtomType.QNM); } /** * Checks if the specified expression yields a string or binary item. * Checks the type of the given function item. * @param e expression to be evaluated * @param ctx query context * @return function item * @throws QueryException query exception */ public FItem checkFunc(final Expr e, final QueryContext ctx) throws QueryException { return (FItem) checkType(checkItem(e, ctx), FuncType.ANY_FUN); } /** * Checks if the specified expression is an empty sequence; if yes, throws * an exception. * @param it item to be checked * @param t type to be checked * @return specified item * @throws QueryException query exception */ public final Item checkType(final Item it, final Type t) throws QueryException { if(checkNoEmpty(it, t).type.instanceOf(t)) return it; throw Err.INVCAST.thrw(info, it.type, t); } /** * Checks if the specified item is no empty sequence. * @param it item to be checked * @return specified item * @throws QueryException query exception */ public final Item checkNoEmpty(final Item it) throws QueryException { if(it != null) return it; throw INVEMPTY.thrw(info, description()); } /** * Checks if the specified item is no empty sequence. * @param it item to be checked * @param t expected type * @return specified item * @throws QueryException query exception */ private Item checkNoEmpty(final Item it, final Type t) throws QueryException { if(it != null) return it; throw INVEMPTYEX.thrw(info, description(), t); } /** * Checks if the specified expression yields a string or empty sequence. * Returns a token representation or an exception. * @param e expression to be evaluated * @param ctx query context * @return item * @throws QueryException query exception */ public final byte[] checkEStr(final Expr e, final QueryContext ctx) throws QueryException { return checkEStr(e.item(ctx, info)); } /** * Checks if the current user has create permissions. If negative, an * exception is thrown. * @param ctx query context * @throws QueryException query exception */ public final void checkAdmin(final QueryContext ctx) throws QueryException { checkPerm(ctx, Perm.ADMIN); } /** * Checks if the current user has create permissions. If negative, an * exception is thrown. * @param ctx query context * @throws QueryException query exception */ public final void checkCreate(final QueryContext ctx) throws QueryException { checkPerm(ctx, Perm.CREATE); } /** * Checks if the current user has write permissions for the specified database. * If negative, an exception is thrown. * @param data data reference * @param ctx query context * @return data reference * @throws QueryException query exception */ public final Data checkWrite(final Data data, final QueryContext ctx) throws QueryException { if(!ctx.context.perm(Perm.WRITE, data.meta)) BASX_PERM.thrw(info, Perm.WRITE); return data; } /** * Checks if the current user has given permissions. If negative, an * exception is thrown. * @param ctx query context * @param p permission * @throws QueryException query exception */ private void checkPerm(final QueryContext ctx, final Perm p) throws QueryException { if(!ctx.context.user.has(p)) throw BASX_PERM.thrw(info, p); } /** * Assures that the given (non-{@code null}) item is a map. * @param it item to check * @return the map * @throws QueryException if the item is not a map */ public Map checkMap(final Item it) throws QueryException { if(it instanceof Map) return (Map) it; throw Err.INVCAST.thrw(info, it.type, SeqType.ANY_MAP); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Pos.java000066400000000000000000000073211222453003200247310ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.expr.CmpV.OpV; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Pos expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Pos extends Simple { /** Minimum position. */ final long min; /** Maximum position. */ final long max; /** * Constructor. * @param mn minimum value * @param mx minimum value * @param ii input info */ private Pos(final long mn, final long mx, final InputInfo ii) { super(ii); min = mn; max = mx; type = SeqType.BLN; } /** * Returns a position expression, or an optimized boolean item. * @param mn minimum value * @param mx minimum value * @param ii input info * @return expression */ public static Expr get(final long mn, final long mx, final InputInfo ii) { // suppose that positions always fit in long values.. return mn > mx || mx < 1 ? Bln.FALSE : mn <= 1 && mx == Long.MAX_VALUE ? Bln.TRUE : new Pos(mn, mx, ii); } /** * Returns an instance of this class, if possible, and the input expression * otherwise. * @param cmp comparator * @param a argument * @param o original expression * @param ii input info * @return resulting expression, or {@code null} */ public static Expr get(final OpV cmp, final Expr a, final Expr o, final InputInfo ii) { if(a instanceof ANum) { final ANum it = (ANum) a; final long p = it.itr(); final boolean ex = p == it.dbl(); switch(cmp) { case EQ: return ex ? get(p, p, ii) : Bln.FALSE; case GE: return get(ex ? p : p + 1, Long.MAX_VALUE, ii); case GT: return get(p + 1, Long.MAX_VALUE, ii); case LE: return get(1, p, ii); case LT: return get(1, ex ? p - 1 : p, ii); default: } } return o; } @Override public Bln item(final QueryContext ctx, final InputInfo ii) throws QueryException { checkCtx(ctx); return Bln.get(ctx.pos >= min && ctx.pos <= max); } @Override public Pos copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new Pos(min, max, info); } /** * Returns false if no more results can be expected. * @param ctx query context * @return result of check */ public boolean skip(final QueryContext ctx) { return ctx.pos >= max; } /** * Creates an intersection of the existing and the specified position * expressions. * @param pos second position expression * @param ii input info * @return resulting expression */ Expr intersect(final Pos pos, final InputInfo ii) { return get(Math.max(min, pos.min), Math.min(max, pos.max), ii); } @Override public boolean has(final Flag flag) { return flag == Flag.FCS; } @Override public boolean sameAs(final Expr cmp) { if(!(cmp instanceof Pos)) return false; final Pos p = (Pos) cmp; return min == p.min && max == p.max; } @Override public void plan(final FElem plan) { addPlan(plan, planElem(MIN, min, MAX, max == Long.MAX_VALUE ? INF : max)); } @Override public String toString() { if(min == max) return Long.toString(min); final StringBuilder sb = new StringBuilder("position() "); if(max == Long.MAX_VALUE) sb.append('>'); sb.append("= ").append(min); if(max != Long.MAX_VALUE) sb.append(" to ").append(max); return sb.toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Pragma.java000066400000000000000000000026531222453003200254020ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.data.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.util.*; /** * Abstract pragma expression. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public abstract class Pragma extends ExprInfo { /** QName. */ protected final QNm name; /** Pragma value. */ protected final byte[] value; /** * Constructor. * @param n name of pragma * @param v optional value */ public Pragma(final QNm n, final byte[] v) { name = n; value = v; } @Override public final void plan(final FElem plan) { addPlan(plan, planElem(VAL, value), name); } /** * Initializes the pragma expression. * @param ctx query context * @param info input info * @throws QueryException query exception */ abstract void init(final QueryContext ctx, final InputInfo info) throws QueryException; /** * Finalizes the pragma expression. * @param ctx query context */ abstract void finish(final QueryContext ctx); @Override public final String toString() { final TokenBuilder tb = new TokenBuilder(PRAGMA + ' ' + name + ' '); if(value.length != 0) tb.add(value).add(' '); return tb.add(PRAGMA2).toString(); } /** * Creates a copy of this pragma. * @return copy */ public abstract Pragma copy(); } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Preds.java000066400000000000000000000127771222453003200252600ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import java.util.*; import org.basex.query.*; import org.basex.query.expr.CmpG.OpG; import org.basex.query.expr.CmpV.OpV; import org.basex.query.func.*; import org.basex.query.path.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.query.var.*; import org.basex.util.*; /** * Abstract predicate expression, implemented by {@link Filter} and * {@link Step}. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class Preds extends ParseExpr { /** Predicates. */ public Expr[] preds; /** Compilation: first predicate uses last function. */ public boolean last; /** Compilation: first predicate uses position. */ public Pos pos; /** * Constructor. * @param ii input info * @param p predicates */ protected Preds(final InputInfo ii, final Expr[] p) { super(ii); preds = p; } @Override public void checkUp() throws QueryException { checkNoneUp(preds); } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { for(int p = 0; p < preds.length; ++p) { Expr pr = preds[p].compile(ctx, scp).compEbv(ctx); pr = Pos.get(OpV.EQ, pr, pr, info); // position() = last() -> last() if(pr instanceof CmpG || pr instanceof CmpV) { final Cmp cmp = (Cmp) pr; if(cmp.expr[0].isFunction(Function.POSITION) && cmp.expr[1].isFunction(Function.LAST)) { if(cmp instanceof CmpG && ((CmpG) cmp).op == OpG.EQ || cmp instanceof CmpV && ((CmpV) cmp).op == OpV.EQ) { ctx.compInfo(OPTWRITE, pr); pr = cmp.expr[1]; } } } if(pr.isValue()) { if(!pr.ebv(ctx, info).bool(info)) { ctx.compInfo(OPTREMOVE, this, pr); return Empty.SEQ; } ctx.compInfo(OPTREMOVE, this, pr); preds = Array.delete(preds, p--); } else if(pr instanceof And && !pr.has(Flag.FCS)) { // replace AND expression with predicates (don't swap position tests) ctx.compInfo(OPTPRED, pr); final Expr[] and = ((And) pr).expr; final int m = and.length - 1; final ExprList tmp = new ExprList(preds.length + m); for(final Expr e : Arrays.asList(preds).subList(0, p)) tmp.add(e); for(final Expr a : and) { // wrap test with boolean() if the result is numeric tmp.add(Function.BOOLEAN.get(info, a).compEbv(ctx)); } for(final Expr e : Arrays.asList(preds).subList(p + 1, preds.length)) tmp.add(e); preds = tmp.finish(); } else { preds[p] = pr; } } return this; } /** * Checks if this expression can be evaluated in an iterative manner. * This is possible if no predicate, or only the first, is positional, or * if a single {@code last()} predicate is specified. * @return result of check */ protected boolean useIterator() { // numeric predicate pos = preds[0] instanceof Pos ? (Pos) preds[0] : null; last = preds[0].isFunction(Function.LAST); boolean np1 = true; boolean np2 = true; for(int p = 0; p < preds.length; p++) { final boolean np = !preds[p].type().mayBeNumber() && !preds[p].has(Flag.FCS); np1 &= np; if(p > 0) np2 &= np; } return np1 || pos != null && np2 || last && preds.length == 1; } /** * Checks if the predicates are successful for the specified item. * @param it item to be checked * @param ctx query context * @return result of check * @throws QueryException query exception */ public boolean preds(final Item it, final QueryContext ctx) throws QueryException { if(preds.length == 0) return true; // set context item and position Item i = null; final Value cv = ctx.value; try { for(final Expr p : preds) { ctx.value = it; i = p.test(ctx, info); if(i == null) return false; } // item accepted.. adopt last scoring value it.score(i.score()); return true; } finally { ctx.value = cv; } } @Override public boolean has(final Flag flag) { for(final Expr p : preds) { if(flag == Flag.FCS && p.type().mayBeNumber() || p.has(flag)) return true; } return false; } @Override public boolean removable(final Var v) { for(final Expr p : preds) if(p.uses(v)) return false; return true; } @Override public VarUsage count(final Var v) { return VarUsage.sum(v, preds); } @Override public Expr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { return inlineAll(ctx, scp, preds, v, e) ? optimize(ctx, scp) : null; } @Override public void plan(final FElem plan) { for(final Expr p : preds) p.plan(plan); } @Override public String toString() { final StringBuilder sb = new StringBuilder(); for(final Expr e : preds) sb.append("[" + e + ']'); return sb.toString(); } /** * Copies fields to the given object. * @param object type * @param p copy * @return the copy */ protected T copy(final T p) { p.last = last; p.pos = pos; return copyType(p); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Quantifier.java000066400000000000000000000046551222453003200263060ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import java.util.*; import org.basex.query.*; import org.basex.query.gflwor.*; import org.basex.query.iter.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Some/Every satisfier clause. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Quantifier extends Single { /** Every flag. */ private final boolean every; /** * Constructor. * @param ii input info * @param f variable inputs * @param s satisfier * @param e every flag */ public Quantifier(final InputInfo ii, final For[] f, final Expr s, final boolean e) { this(ii, new GFLWOR(ii, new LinkedList(Arrays.asList(f)), compBln(s, ii)), e); } /** * Copy constructor. * @param ii input info * @param tests expression * @param e every flag */ private Quantifier(final InputInfo ii, final Expr tests, final boolean e) { super(ii, tests); every = e; type = SeqType.BLN; } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { super.compile(ctx, scp); return optimize(ctx, scp); } @Override public Expr optimize(final QueryContext ctx, final VarScope scp) throws QueryException { // return pre-evaluated result return expr.isValue() ? optPre(item(ctx, info), ctx) : this; } @Override public Bln item(final QueryContext ctx, final InputInfo ii) throws QueryException { final Iter iter = expr.iter(ctx); for(Item it; (it = iter.next()) != null;) if(every ^ it.ebv(ctx, ii).bool(ii)) return Bln.get(!every); return Bln.get(every); } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new Quantifier(info, expr.copy(ctx, scp, vs), every); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(TYP, every ? EVERY : SOME), expr); } @Override public String toString() { final StringBuilder sb = new StringBuilder(every ? EVERY : SOME); return sb.append('(').append(expr).append(')').toString(); } @Override public int exprSize() { return expr.exprSize(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Range.java000066400000000000000000000042311222453003200252210ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Range expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Range extends Arr { /** * Constructor. * @param ii input info * @param e1 first expression * @param e2 second expression */ public Range(final InputInfo ii, final Expr e1, final Expr e2) { super(ii, e1, e2); type = SeqType.ITR_ZM; } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { super.compile(ctx, scp); Expr e = this; if(oneIsEmpty()) { e = Empty.SEQ; } else if(allAreValues()) { e = value(ctx); } return optPre(e, ctx); } @Override public Iter iter(final QueryContext ctx) throws QueryException { return value(ctx).iter(); } @Override public Value value(final QueryContext ctx) throws QueryException { final long[] v = rng(ctx); return v == null ? Empty.SEQ : RangeSeq.get(v[0], v[1] - v[0] + 1, true); } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new Range(info, expr[0].copy(ctx, scp, vs), expr[1].copy(ctx, scp, vs)); } /** * Returns the start and end value of the range operator, or {@code null} * if the range could not be evaluated. * @param ctx query context * @return value array * @throws QueryException query exception */ private long[] rng(final QueryContext ctx) throws QueryException { final Item a = expr[0].item(ctx, info); if(a == null) return null; final Item b = expr[1].item(ctx, info); if(b == null) return null; return new long[] { checkItr(a), checkItr(b) }; } @Override public String toString() { return toString(' ' + TO + ' '); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/RangeAccess.java000066400000000000000000000034561222453003200263530ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import java.util.*; import org.basex.data.*; import org.basex.index.*; import org.basex.index.query.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * This index class retrieves range values from the index. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class RangeAccess extends IndexAccess { /** Index type. */ final NumericRange ind; /** * Constructor. * @param ii input info * @param t index reference * @param ic index context */ RangeAccess(final InputInfo ii, final NumericRange t, final IndexContext ic) { super(ic, ii); ind = t; } @Override public AxisIter iter(final QueryContext ctx) { final byte kind = ind.type() == IndexType.TEXT ? Data.TEXT : Data.ATTR; return new AxisIter() { final IndexIterator it = ictx.data.iter(ind); @Override public ANode next() { return it.more() ? new DBNode(ictx.data, it.next(), kind) : null; } }; } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new RangeAccess(info, ind, ictx); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(DATA, ictx.data.meta.name, MIN, ind.min, MAX, ind.max, TYP, ind.type)); } @Override public String toString() { return new TokenBuilder(DB).add(':'). add(ind.type().toString().toLowerCase(Locale.ENGLISH)).add("-range("). addExt(ind.min).add(SEP).addExt(ind.max).add(')').toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Root.java000066400000000000000000000042321222453003200251110ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.util.Err.*; import org.basex.core.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Root node. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Root extends Simple { /** * Constructor. * @param ii input info */ public Root(final InputInfo ii) { super(ii); type = SeqType.DOC_ZM; } @Override public Expr compile(final QueryContext ctx, final VarScope scp) { return ctx.value != null && ctx.value.type == NodeType.DOC ? ctx.value : this; } @Override public Iter iter(final QueryContext ctx) throws QueryException { final Iter iter = checkCtx(ctx).iter(); final NodeSeqBuilder nc = new NodeSeqBuilder().check(); for(Item i; (i = iter.next()) != null;) { final ANode n = root(i); if(n == null || n.type != NodeType.DOC) CTXNODE.thrw(info); nc.add(n); } return nc; } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new Root(info); } /** * Returns the root node of the specified item. * @param v input node * @return root node */ public static ANode root(final Value v) { if(!(v instanceof ANode)) return null; ANode n = (ANode) v; while(true) { final ANode p = n.parent(); if(p == null) return n; n = p; } } @Override public boolean has(final Flag flag) { return flag == Flag.CTX; } @Override public boolean accept(final ASTVisitor visitor) { return visitor.lock(DBLocking.CTX); } @Override public boolean iterable() { return true; } @Override public boolean sameAs(final Expr cmp) { return cmp instanceof Root; } @Override public String toString() { return "root()"; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Set.java000066400000000000000000000051641222453003200247260ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import java.util.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; /** * Set expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ abstract class Set extends Arr { /** Iterable flag. */ boolean iterable = true; /** * Constructor. * @param ii input info * @param l expression list */ Set(final InputInfo ii, final Expr[] l) { super(ii, l); type = SeqType.NOD_ZM; } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { super.compile(ctx, scp); for(final Expr e : expr) { if(e.iterable()) continue; iterable = false; break; } return this; } @Override public final NodeIter iter(final QueryContext ctx) throws QueryException { final Iter[] iter = new Iter[expr.length]; for(int e = 0; e != expr.length; ++e) iter[e] = ctx.iter(expr[e]); return iterable ? iter(iter) : eval(iter).sort(); } /** * Evaluates the specified iterators. * @param iter iterators * @return resulting iterator * @throws QueryException query exception */ protected abstract NodeSeqBuilder eval(final Iter[] iter) throws QueryException; /** * Evaluates the specified iterators in an iterative manner. * @param iter iterators * @return resulting iterator */ protected abstract NodeIter iter(final Iter[] iter); @Override public boolean iterable() { return true; } /** * Abstract set iterator. */ abstract class SetIter extends NodeIter { /** Iterator. */ final Iter[] iter; /** Items. */ ANode[] item; /** * Constructor. * @param ir iterator */ SetIter(final Iter[] ir) { iter = ir; } @Override public abstract ANode next() throws QueryException; /** * Sets the next iterator item. * @param i index * @return true if another item was found * @throws QueryException query exception */ protected boolean next(final int i) throws QueryException { final Item it = iter[i].next(); item[i] = it == null ? null : checkNode(it); return it != null; } } @Override public final String toString() { return PAR1 + toString(' ' + Util.name(this).toLowerCase(Locale.ENGLISH) + ' ') + PAR2; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Simple.java000066400000000000000000000024341222453003200254210ustar00rootroot00000000000000package org.basex.query.expr; import org.basex.query.*; import org.basex.query.util.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; /** * Simple expression without arguments. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class Simple extends ParseExpr { /** * Constructor. * @param ii input info */ protected Simple(final InputInfo ii) { super(ii); } @Override public final void checkUp() { } @Override public Expr compile(final QueryContext ctx, final VarScope scp) { return this; } @Override public boolean has(final Flag flag) { return false; } @Override public boolean removable(final Var v) { return true; } @Override public VarUsage count(final Var v) { return VarUsage.NEVER; } @Override public Expr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { return null; } @Override public void plan(final FElem plan) { addPlan(plan, planElem()); } @Override public boolean accept(final ASTVisitor visitor) { return true; } @Override public int exprSize() { return 1; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Single.java000066400000000000000000000032101222453003200254020ustar00rootroot00000000000000package org.basex.query.expr; import org.basex.query.*; import org.basex.query.util.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; /** * Abstract single expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class Single extends ParseExpr { /** Expression. */ public Expr expr; /** * Constructor. * @param ii input info * @param e expression */ protected Single(final InputInfo ii, final Expr e) { super(ii); expr = e; } @Override public void checkUp() throws QueryException { checkNoUp(expr); } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { expr = expr.compile(ctx, scp); return this; } @Override public boolean has(final Flag flag) { return expr.has(flag); } @Override public boolean removable(final Var v) { return expr.removable(v); } @Override public VarUsage count(final Var v) { return expr.count(v); } @Override public Expr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { final Expr sub = expr.inline(ctx, scp, v, e); if(sub == null) return null; expr = sub; return optimize(ctx, scp); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(), expr); } @Override public boolean accept(final ASTVisitor visitor) { return expr.accept(visitor); } @Override public int exprSize() { return expr.exprSize() + 1; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/StringRangeAccess.java000066400000000000000000000054171222453003200275410ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.data.*; import org.basex.index.*; import org.basex.index.query.*; import org.basex.query.*; import org.basex.query.func.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * This index class retrieves ranges from a value index. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class StringRangeAccess extends IndexAccess { /** Index token. */ final StringRange sr; /** * Constructor. * @param ii input info * @param t index reference * @param ic index context */ public StringRangeAccess(final InputInfo ii, final StringRange t, final IndexContext ic) { super(ic, ii); sr = t; } @Override public AxisIter iter(final QueryContext ctx) { final boolean text = sr.type == IndexType.TEXT; final byte kind = text ? Data.TEXT : Data.ATTR; final Data data = ictx.data; final int ml = data.meta.maxlen; final IndexIterator ii = sr.min.length <= ml && sr.max.length <= ml && (text ? data.meta.textindex : data.meta.attrindex) ? data.iter(sr) : scan(); return new AxisIter() { @Override public ANode next() { return ii.more() ? new DBNode(data, ii.next(), kind) : null; } }; } /** * Returns scan-based iterator. * @return node iterator */ private IndexIterator scan() { return new IndexIterator() { final boolean text = sr.type == IndexType.TEXT; final byte kind = text ? Data.TEXT : Data.ATTR; int pre = -1; @Override public int next() { return pre; } @Override public boolean more() { final Data data = ictx.data; while(++pre < data.meta.size) { if(data.kind(pre) != kind) continue; final byte[] t = data.text(pre, text); final int mn = Token.diff(t, sr.min); final int mx = Token.diff(t, sr.max); if(mn >= (sr.mni ? 0 : 1) && mx <= (sr.mxi ? 0 : 1)) return true; } return false; } }; } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new StringRangeAccess(info, sr, ictx); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(DATA, ictx.data.meta.name, MIN, sr.min, MAX, sr.max, TYP, sr.type)); } @Override public String toString() { return (sr.type == IndexType.TEXT ? Function._DB_TEXT_RANGE : Function._DB_ATTRIBUTE_RANGE).get(info, Str.get(ictx.data.meta.name), Str.get(sr.min), Str.get(sr.max)).toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Switch.java000066400000000000000000000126201222453003200254270ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Switch expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Switch extends ParseExpr { /** Cases. */ private final SwitchCase[] cases; /** Condition. */ private Expr cond; /** * Constructor. * @param ii input info * @param c condition * @param sc cases (last one is default case) */ public Switch(final InputInfo ii, final Expr c, final SwitchCase[] sc) { super(ii); cases = sc; cond = c; } @Override public void checkUp() throws QueryException { checkNoUp(cond); for(final SwitchCase sc : cases) sc.checkUp(); // check if none or all return expressions are updating final Expr[] tmp = new Expr[cases.length]; for(int i = 0; i < tmp.length; ++i) tmp[i] = cases[i].expr[0]; checkAllUp(tmp); } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { cond = cond.compile(ctx, scp); for(final SwitchCase sc : cases) sc.compile(ctx, scp); // check if expression can be pre-evaluated Expr ex = this; if(cond.isValue()) { final Item it = cond.item(ctx, info); LOOP: for(final SwitchCase sc : cases) { final int sl = sc.expr.length; for(int e = 1; e < sl; e++) { if(!sc.expr[e].isValue()) break LOOP; // includes check for empty sequence (null reference) final Item cs = sc.expr[e].item(ctx, info); if(it == cs || cs != null && it != null && it.equiv(cs, null, info)) { ex = sc.expr[0]; break LOOP; } } if(sl == 1) ex = sc.expr[0]; } } if(ex != this) return optPre(ex, ctx); // expression could not be pre-evaluated type = cases[0].expr[0].type(); for(int c = 1; c < cases.length; c++) { type = type.union(cases[c].expr[0].type()); } return ex; } @Override public Iter iter(final QueryContext ctx) throws QueryException { return ctx.iter(getCase(ctx)); } @Override public Value value(final QueryContext ctx) throws QueryException { return ctx.value(getCase(ctx)); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { return getCase(ctx).item(ctx, ii); } @Override public boolean isVacuous() { for(final SwitchCase sc : cases) if(!sc.expr[0].isVacuous()) return false; return true; } @Override public boolean has(final Flag flag) { for(final SwitchCase sc : cases) if(sc.has(flag)) return true; return cond.has(flag); } @Override public boolean removable(final Var v) { for(final SwitchCase sc : cases) if(!sc.removable(v)) return false; return cond.removable(v); } @Override public VarUsage count(final Var v) { VarUsage max = VarUsage.NEVER, curr = VarUsage.NEVER; for(final SwitchCase cs : cases) { curr = curr.plus(cs.countCases(v)); max = max.max(curr.plus(cs.count(v))); } return max.plus(cond.count(v)); } @Override public Expr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { boolean change = inlineAll(ctx, scp, cases, v, e); final Expr cn = cond.inline(ctx, scp, v, e); if(cn != null) { change = true; cond = cn; } return change ? optimize(ctx, scp) : null; } /** * Chooses the selected {@code case} expression. * @param ctx query context * @return case expression * @throws QueryException query exception */ private Expr getCase(final QueryContext ctx) throws QueryException { final Item it = cond.item(ctx, info); for(final SwitchCase sc : cases) { final int sl = sc.expr.length; for(int e = 1; e < sl; e++) { // includes check for empty sequence (null reference) final Item cs = sc.expr[e].item(ctx, info); if(it == cs || it != null && cs != null && it.equiv(cs, null, info)) return sc.expr[0]; } if(sl == 1) return sc.expr[0]; } // will never be evaluated return null; } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new Switch(info, cond.copy(ctx, scp, vs), Arr.copyAll(ctx, scp, vs, cases)); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(), cond, cases); } @Override public String toString() { final StringBuilder sb = new StringBuilder(SWITCH + PAR1 + cond + PAR2); for(final SwitchCase sc : cases) sb.append(sc.toString()); return sb.toString(); } @Override public void markTailCalls() { for(final SwitchCase sc : cases) sc.markTailCalls(); } @Override public boolean accept(final ASTVisitor visitor) { return cond.accept(visitor) && visitAll(visitor, cases); } @Override public int exprSize() { int sz = 1; for(final Expr e : cases) sz += e.exprSize(); return sz; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/SwitchCase.java000066400000000000000000000055441222453003200262320ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.func.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Single case of a switch expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class SwitchCase extends Arr { /** * Constructor. * @param ii input info * @param e return expression (placed first) and cases */ public SwitchCase(final InputInfo ii, final Expr... e) { super(ii, e); } @Override public void checkUp() throws QueryException { final int es = expr.length; for(int e = 1; e < es; ++e) checkNoUp(expr[e]); } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { // compile and simplify branches final int es = expr.length; for(int e = 0; e < es; e++) { try { expr[e] = expr[e].compile(ctx, scp); } catch(final QueryException ex) { // replace original expression with error expr[e] = FNInfo.error(ex); } } return this; } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new SwitchCase(info, copyAll(ctx, scp, vs, expr)); } @Override public Expr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { boolean change = false; final int es = expr.length; for(int i = 0; i < es; i++) { Expr nw; try { nw = expr[i].inline(ctx, scp, v, e); } catch(final QueryException qe) { nw = FNInfo.error(qe); } if(nw != null) { expr[i] = nw; change = true; } } return change ? optimize(ctx, scp) : null; } @Override public String toString() { final StringBuilder sb = new StringBuilder(); final int es = expr.length; for(int e = 1; e < es; ++e) sb.append(' ' + CASE + ' ' + expr[e]); if(es == 1) sb.append(' ' + DEFAULT); sb.append(' ' + RETURN + ' ' + expr[0]); return sb.toString(); } /** * {@inheritDoc} * This method counts only the occurrences in the return expression. */ @Override public VarUsage count(final Var v) { return expr[0].count(v); } /** * Checks how often a variable is used in this expression. * This method counts only the occurrences in the case expressions. * @param v variable to look for * @return number of occurrences */ protected VarUsage countCases(final Var v) { VarUsage all = VarUsage.NEVER; final int es = expr.length; for(int i = 1; i < es; i++) if((all = all.plus(expr[i].count(v))) == VarUsage.MORE_THAN_ONCE) break; return all; } @Override public int exprSize() { int sz = 0; for(final Expr e : expr) sz += e.exprSize(); return sz; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Treat.java000066400000000000000000000066541222453003200252570ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.query.value.type.SeqType.Occ; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Treat as expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Treat extends Single { /** * Constructor. * @param ii input info * @param e expression * @param s sequence type */ public Treat(final InputInfo ii, final Expr e, final SeqType s) { super(ii, e); type = s; } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { super.compile(ctx, scp); return optimize(ctx, scp); } @Override public Expr optimize(final QueryContext ctx, final VarScope scp) throws QueryException { return expr.isValue() ? optPre(value(ctx), ctx) : this; } @Override public Iter iter(final QueryContext ctx) throws QueryException { final Iter iter = ctx.iter(expr); final Item it = iter.next(); // input is empty if(it == null) { if(type.mayBeZero()) return Empty.ITER; NOTREAT.thrw(info, description(), Empty.SEQ, type); } // treat as empty sequence if(type.occ == Occ.ZERO) NOTREAT.thrw(info, description(), it.type, type); if(type.zeroOrOne()) { if(iter.next() != null) NOTREATS.thrw(info, description(), type); if(!it.type.instanceOf(type.type)) NOTREAT.thrw(info, description(), it.type, type); return it.iter(); } return new Iter() { Item i = it; @Override public Item next() throws QueryException { if(i == null) return null; if(!i.type.instanceOf(type.type)) NOTREAT.thrw(info, description(), i.type, type); final Item ii = i; i = iter.next(); return ii; } }; } @Override public Value value(final QueryContext ctx) throws QueryException { final Value val = ctx.value(expr); final long len = val.size(); // input is empty if(len == 0) { if(type.mayBeZero()) return val; NOTREAT.thrw(info, description(), Empty.SEQ, type); } // treat as empty sequence if(type.occ == Occ.ZERO) NOTREAT.thrw(info, description(), val.type, type); if(type.zeroOrOne()) { if(len > 1) NOTREATS.thrw(info, description(), type); final Item it = val.itemAt(0); if(!it.type.instanceOf(type.type)) NOTREAT.thrw(info, description(), it.type, type); return it; } for(long i = 0; i < len; i++) { final Item it = val.itemAt(i); if(!it.type.instanceOf(type.type)) NOTREAT.thrw(info, description(), it.type, type); } return val; } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new Treat(info, expr.copy(ctx, scp, vs), type); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(TYP, type), expr); } @Override public String toString() { return '(' + expr.toString() + ") " + TREAT + ' ' + AS + ' ' + type; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Try.java000066400000000000000000000103201222453003200247370ustar00rootroot00000000000000package org.basex.query.expr; import org.basex.query.*; import org.basex.query.func.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Project specific try/catch expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Try extends Single { /** Catches. */ private final Catch[] ctch; /** * Constructor. * @param ii input info * @param t try expression * @param c catch expressions */ public Try(final InputInfo ii, final Expr t, final Catch[] c) { super(ii, t); ctch = c; } @Override public void checkUp() throws QueryException { // check if none or all try/catch expressions are updating final Expr[] tmp = new Expr[ctch.length + 1]; tmp[0] = expr; for(int c = 0; c < ctch.length; ++c) tmp[c + 1] = ctch[c].expr; checkAllUp(tmp); } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { try { super.compile(ctx, scp); if(expr.isValue()) return optPre(expr, ctx); } catch(final QueryException ex) { if(!ex.isCatchable()) throw ex; for(final Catch c : ctch) { if(c.matches(ex)) { // found a matching clause, compile and inline error message return optPre(c.compile(ctx, scp).asExpr(ex, ctx, scp), ctx); } } throw ex; } for(final Catch c : ctch) c.compile(ctx, scp); type = expr.type(); for(final Catch c : ctch) if(!c.expr.isFunction(Function.ERROR)) type = type.union(c.type()); return this; } @Override public Iter iter(final QueryContext ctx) throws QueryException { return value(ctx).iter(); } @Override public Value value(final QueryContext ctx) throws QueryException { // don't catch errors from error handlers try { return ctx.value(expr); } catch(final QueryException ex) { if(!ex.isCatchable()) throw ex; for(final Catch c : ctch) if(c.matches(ex)) return c.value(ctx, ex); throw ex; } } @Override public VarUsage count(final Var v) { return VarUsage.maximum(v, ctch).plus(expr.count(v)); } @Override public Expr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { boolean change = false; try { final Expr sub = expr.inline(ctx, scp, v, e); if(sub != null) { if(sub.isValue()) return optPre(sub, ctx); expr = sub; change = true; } } catch(final QueryException qe) { if(!qe.isCatchable()) throw qe; for(final Catch c : ctch) { if(c.matches(qe)) { // found a matching clause, inline variable and error message return optPre(c.inline(ctx, scp, v, e).asExpr(qe, ctx, scp), ctx); } } throw qe; } for(final Catch c : ctch) change |= c.inline(ctx, scp, v, e) != null; return change ? this : null; } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new Try(info, expr.copy(ctx, scp, vs), Arr.copyAll(ctx, scp, vs, ctch)); } @Override public boolean has(final Flag flag) { for(final Catch c : ctch) if(c.has(flag)) return true; return super.has(flag); } @Override public boolean removable(final Var v) { for(final Catch c : ctch) if(!c.removable(v)) return false; return super.removable(v); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(), expr, ctch); } @Override public String toString() { final StringBuilder sb = new StringBuilder("try { " + expr + " }"); for(final Catch c : ctch) sb.append(' ').append(c); return sb.toString(); } @Override public boolean accept(final ASTVisitor visitor) { return super.accept(visitor) && visitAll(visitor, ctch); } @Override public int exprSize() { int sz = 1; for(final Expr e : ctch) sz += e.exprSize(); return sz; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/TypeCase.java000066400000000000000000000111001222453003200256730ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.func.*; import org.basex.query.iter.Iter; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.InputInfo; import org.basex.util.Token; import org.basex.util.TokenBuilder; import org.basex.util.hash.*; import org.basex.util.list.*; /** * Case expression for typeswitch. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class TypeCase extends Single { /** Variable. */ final Var var; /** Matched sequence types. */ final SeqType[] types; /** * Constructor. * @param ii input info * @param v variable * @param ts sequence types this case matches, the empty array means {@code default} * @param r return expression */ public TypeCase(final InputInfo ii, final Var v, final SeqType[] ts, final Expr r) { super(ii, r); var = v; types = ts; } @Override public TypeCase compile(final QueryContext ctx, final VarScope scp) throws QueryException { return compile(ctx, scp, null); } /** * Compiles the expression. * @param ctx query context * @param scp variable scope * @param v value to be bound * @return resulting item * @throws QueryException query exception */ TypeCase compile(final QueryContext ctx, final VarScope scp, final Value v) throws QueryException { if(var != null && v != null) ctx.set(var, v, info); try { super.compile(ctx, scp); } catch(final QueryException ex) { // replace original expression with error expr = FNInfo.error(ex); } type = expr.type(); return this; } @Override public Expr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { try { return super.inline(ctx, scp, v, e); } catch(final QueryException qe) { expr = FNInfo.error(qe); return this; } } @Override public TypeCase copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final Var v = var == null ? null : scp.newCopyOf(ctx, var); if(var != null) vs.put(var.id, v); final TypeCase tc = new TypeCase(info, v, types.clone(), expr.copy(ctx, scp, vs)); return tc; } /** * Checks if the given value matches this case. * @param val value to be matched * @return {@code true} if it matches, {@code false} otherwise */ public boolean matches(final Value val) { if(types.length == 0) return true; for(final SeqType t : types) if(t.instance(val)) return true; return false; } /** * Evaluates the expression. * @param ctx query context * @param seq sequence to be checked * @return resulting item * @throws QueryException query exception */ Iter iter(final QueryContext ctx, final Value seq) throws QueryException { if(!matches(seq)) return null; if(var == null) return ctx.iter(expr); ctx.set(var, seq, info); return ctx.value(expr).iter(); } @Override public void plan(final FElem plan) { final FElem e = planElem(); if(types.length == 0) { e.add(planAttr(Token.token(DEFAULT), Token.TRUE)); } else { final byte[] or = new byte[] { ' ', '|', ' ' }; final ByteList bl = new ByteList(); for(final SeqType t : types) { if(bl.size() > 0) bl.add(or); bl.add(Token.token(t.toString())); } e.add(planAttr(Token.token(TYPE), bl.toArray())); } if(var != null) e.add(planAttr(VAR, Token.token(var.toString()))); expr.plan(e); plan.add(e); } @Override public String toString() { final TokenBuilder tb = new TokenBuilder(types.length == 0 ? DEFAULT : CASE); if(var != null) { tb.add(' ').add(var.toString()); if(types.length != 0) tb.add(' ').add(AS); } if(types.length != 0) { for(int i = 0; i < types.length; i++) { if(i > 0) tb.add(" |"); tb.add(' ').add(types[i].toString()); } } return tb.add(" " + RETURN + ' ' + expr).toString(); } @Override public void markTailCalls() { expr.markTailCalls(); } @Override public boolean accept(final ASTVisitor visitor) { return super.accept(visitor) && (var == null || visitor.declared(var)); } @Override public int exprSize() { return expr.exprSize(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/TypeCheck.java000066400000000000000000000052661222453003200260550ustar00rootroot00000000000000package org.basex.query.expr; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Checks the argument expression's result type. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class TypeCheck extends Single { /** Flag for function conversion. */ public final boolean promote; /** * Constructor. * @param ii input info * @param e expression to be promoted * @param to type to promote to * @param f flag for function conversion */ public TypeCheck(final InputInfo ii, final Expr e, final SeqType to, final boolean f) { super(ii, e); type = to; promote = f; } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { expr = expr.compile(ctx, scp); return optimize(ctx, scp); } @Override public Expr optimize(final QueryContext ctx, final VarScope scp) throws QueryException { if(expr.isValue()) return optPre(value(ctx), ctx); final SeqType argType = expr.type(); if(argType.instanceOf(type)) { ctx.compInfo(QueryText.OPTCAST, type); return expr; } if(argType.type.instanceOf(type.type)) { final SeqType.Occ occ = argType.occ.intersect(type.occ); if(occ == null) throw Err.INVCAST.thrw(info, argType, type); } return this; } @Override public Iter iter(final QueryContext ctx) throws QueryException { return value(ctx).iter(); } @Override public Value value(final QueryContext ctx) throws QueryException { final Value val = expr.value(ctx); if(type.instance(val)) return val; if(promote) return type.funcConvert(ctx, info, val); throw Err.INVCAST.thrw(info, val.type(), type); } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new TypeCheck(info, expr.copy(ctx, scp, vs), type, promote); } @Override public void plan(final FElem plan) { final FElem elem = planElem(QueryText.TYP, type); if(promote) elem.add(planAttr(QueryText.FUNCTION, Token.TRUE)); addPlan(plan, elem, expr); } @Override public String toString() { return "((: " + type + ", " + promote + " :) " + expr.toString() + ")"; } /** * Checks if this type check is redundant if the result is bound to the given variable. * @param var variable * @return result of check */ public boolean isRedundant(final Var var) { return (!promote || var.promotes()) && var.declaredType().instanceOf(type); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/TypeSwitch.java000066400000000000000000000102261222453003200262710ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Typeswitch expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class TypeSwitch extends ParseExpr { /** Cases. */ private final TypeCase[] cases; /** Condition. */ private Expr ts; /** * Constructor. * @param ii input info * @param t typeswitch expression * @param c case expressions */ public TypeSwitch(final InputInfo ii, final Expr t, final TypeCase[] c) { super(ii); ts = t; cases = c; } @Override public void checkUp() throws QueryException { checkNoUp(ts); final Expr[] tmp = new Expr[cases.length]; for(int i = 0; i < cases.length; ++i) tmp[i] = cases[i].expr; checkAllUp(tmp); } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { ts = ts.compile(ctx, scp); // static condition: return branch in question if(ts.isValue()) { final Value val = ts.value(ctx); for(final TypeCase tc : cases) { if(tc.matches(val)) return optPre(tc.compile(ctx, scp, (Value) ts).expr, ctx); } } // compile branches for(final TypeCase tc : cases) tc.compile(ctx, scp); // return first branch if all branches are equal (e.g., empty) and use no variables final TypeCase tc = cases[0]; boolean eq = tc.var == null; for(int c = 1; eq && c < cases.length; ++c) { eq = tc.expr.sameAs(cases[c].expr); } if(eq) return optPre(tc.expr, ctx); // combine return types type = cases[0].type(); for(int c = 1; c < cases.length; ++c) { type = type.union(cases[c].type()); } return this; } @Override public Iter iter(final QueryContext ctx) throws QueryException { final Value seq = ctx.value(ts); for(final TypeCase tc : cases) { final Iter iter = tc.iter(ctx, seq); if(iter != null) return iter; } // will never happen throw Util.notexpected(); } @Override public boolean isVacuous() { for(final TypeCase tc : cases) if(!tc.expr.isVacuous()) return false; return true; } @Override public boolean has(final Flag flag) { for(final TypeCase tc : cases) if(tc.has(flag)) return true; return ts.has(flag); } @Override public boolean removable(final Var v) { for(final TypeCase tc : cases) if(!tc.removable(v)) return false; return ts.removable(v); } @Override public VarUsage count(final Var v) { return ts.count(v).plus(VarUsage.maximum(v, cases)); } @Override public Expr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { boolean change = inlineAll(ctx, scp, cases, v, e); final Expr t = ts.inline(ctx, scp, v, e); if(t != null) { change = true; ts = t; } return change ? optimize(ctx, scp) : null; } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final TypeCase[] cs = new TypeCase[cases.length]; for(int i = 0; i < cs.length; i++) cs[i] = cases[i].copy(ctx, scp, vs); return new TypeSwitch(info, ts.copy(ctx, scp, vs), cs); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(), cases, ts); } @Override public String toString() { return new TokenBuilder(TYPESWITCH + PAR1 + ts + PAR2 + ' ').addSep( cases, " ").toString(); } @Override public void markTailCalls() { for(final TypeCase t : cases) t.markTailCalls(); } @Override public boolean accept(final ASTVisitor visitor) { return ts.accept(visitor) && visitAll(visitor, cases); } @Override public int exprSize() { int sz = 1; for(final Expr e : cases) sz += e.exprSize(); return sz + ts.exprSize(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Unary.java000066400000000000000000000043241222453003200252660ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Unary expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Unary extends Single { /** Minus flag. */ private final boolean minus; /** * Constructor. * @param ii input info * @param e expression * @param min minus flag */ public Unary(final InputInfo ii, final Expr e, final boolean min) { super(ii, e); minus = min; } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { super.compile(ctx, scp); type = expr.type(); if(!type.type.isNumber()) { // expression will always yield a number, empty sequence or error type = type.mayBeZero() ? SeqType.ITR_ZO : SeqType.ITR; } return expr.isValue() ? preEval(ctx) : this; } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { final Item it = expr.item(ctx, info); if(it == null) return null; final Type ip = it.type; if(!ip.isNumberOrUntyped()) Err.number(this, it); final double d = it.dbl(info); if(ip.isUntyped()) return Dbl.get(minus ? -d : d); if(!minus) return it; switch((AtomType) ip) { case DBL: return Dbl.get(-d); case FLT: return Flt.get(-it.flt(info)); case DEC: return Dec.get(it.dec(info).negate()); default: final long l = it.itr(info); if(l == Long.MIN_VALUE) Err.RANGE.thrw(info, l); return Int.get(-l); } } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return copyType(new Unary(info, expr.copy(ctx, scp, vs), minus)); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(VAL, minus), expr); } @Override public String toString() { return (minus ? "-" : "") + expr; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/Union.java000066400000000000000000000051271222453003200252620ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Union expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Union extends Set { /** * Constructor. * @param ii input info * @param e expression list */ public Union(final InputInfo ii, final Expr... e) { super(ii, e); } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { super.compile(ctx, scp); final int es = expr.length; final ExprList el = new ExprList(es); for(final Expr ex : expr) { if(ex.isEmpty()) { // remove empty operands ctx.compInfo(OPTREMOVE, this, ex); } else { el.add(ex); } } // no expressions: return empty sequence if(el.isEmpty()) return Empty.SEQ; // ensure that results are always sorted if(el.size() == 1 && iterable) return el.get(0); // replace expressions with optimized list if(el.size() != es) expr = el.finish(); return this; } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final Union un = new Union(info, copyAll(ctx, scp, vs, expr)); un.iterable = iterable; return copyType(un); } @Override protected NodeSeqBuilder eval(final Iter[] iter) throws QueryException { final NodeSeqBuilder nc = new NodeSeqBuilder().check(); for(final Iter ir : iter) { for(Item it; (it = ir.next()) != null;) nc.add(checkNode(it)); } return nc; } @Override protected NodeIter iter(final Iter[] iter) { return new SetIter(iter) { @Override public ANode next() throws QueryException { if(item == null) { item = new ANode[iter.length]; for(int i = 0; i != iter.length; ++i) next(i); } int m = -1; for(int i = 0; i != item.length; ++i) { if(item[i] == null) continue; final int d = m == -1 ? 1 : item[m].diff(item[i]); if(d == 0) { next(i--); } else if(d > 0) { m = i; } } if(m == -1) return null; final ANode it = item[m]; next(m); return it; } }; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/ValueAccess.java000066400000000000000000000103551222453003200263670ustar00rootroot00000000000000package org.basex.query.expr; import static org.basex.query.QueryText.*; import static org.basex.util.Token.*; import org.basex.data.*; import org.basex.index.*; import org.basex.index.query.*; import org.basex.query.*; import org.basex.query.func.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * This index class retrieves texts and attribute values from the index. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ValueAccess extends IndexAccess { /** Expression. */ private Expr expr; /** Index type. */ final IndexType itype; /** * Constructor. * @param ii input info * @param e index expression * @param t access type * @param ic index context */ public ValueAccess(final InputInfo ii, final Expr e, final IndexType t, final IndexContext ic) { super(ic, ii); expr = e; itype = t; } @Override public NodeIter iter(final QueryContext ctx) throws QueryException { NodeIter[] iter = {}; final Iter ir = ctx.iter(expr); for(Item it; (it = ir.next()) != null;) { final int s = iter.length; final NodeIter[] tmp = new NodeIter[s + 1]; System.arraycopy(iter, 0, tmp, 0, s); iter = tmp; iter[s] = index(it.string(info)); } return iter.length == 0 ? AxisMoreIter.EMPTY : iter.length == 1 ? iter[0] : new Union(info, expr).eval(iter); } /** * Returns an index iterator. * @param term term to be found * @return iterator */ private AxisIter index(final byte[] term) { // access index if term is not too long, and if index exists. // otherwise, scan data sequentially final Data data = ictx.data; final IndexIterator ii = term.length <= data.meta.maxlen && (itype == IndexType.TEXT ? data.meta.textindex : data.meta.attrindex) ? data.iter(new StringToken(itype, term)) : scan(term); return new AxisIter() { final byte kind = itype == IndexType.TEXT ? Data.TEXT : Data.ATTR; @Override public ANode next() { return ii.more() ? new DBNode(data, ii.next(), kind) : null; } }; } /** * Returns scan-based iterator. * @param val value to be found * @return node iterator */ private IndexIterator scan(final byte[] val) { return new IndexIterator() { final Data data = ictx.data; final boolean text = itype == IndexType.TEXT; final byte kind = text ? Data.TEXT : Data.ATTR; int pre = -1; @Override public int next() { return pre; } @Override public boolean more() { while(++pre < data.meta.size) { if(data.kind(pre) == kind && eq(data.text(pre, text), val)) return true; } return false; } }; } @Override public boolean has(final Flag flag) { return expr.has(flag); } @Override public boolean removable(final Var v) { return expr.removable(v); } @Override public VarUsage count(final Var v) { return expr.count(v); } @Override public Expr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { final Expr sub = expr.inline(ctx, scp, v, e); if(sub == null) return null; expr = sub; return optimize(ctx, scp); } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new ValueAccess(info, expr.copy(ctx, scp, vs), itype, ictx); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(DATA, ictx.data.meta.name, TYP, itype), expr); } @Override public String toString() { return (itype == IndexType.TEXT ? Function._DB_TEXT : Function._DB_ATTRIBUTE).get( info, Str.get(ictx.data.meta.name), expr).toString(); } @Override public boolean accept(final ASTVisitor visitor) { return expr.accept(visitor) && super.accept(visitor); } @Override public int exprSize() { return expr.exprSize() + 1; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/XQFunction.java000066400000000000000000000042551222453003200262310ustar00rootroot00000000000000package org.basex.query.expr; import org.basex.query.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Interface for XQuery functions. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public interface XQFunction { /** * Number of arguments this function takes. * @return function arity */ int arity(); /** * Name of this function, {@code null} means anonymous function. * @return name or {@code null} */ QNm fName(); /** * Type of this function. * @return this function's type */ FuncType funcType(); /** * Internally invokes this function with the given arguments. * This method does not deal with tail calls, so it is unsafe to call. * Use {@link #invokeValue(QueryContext, InputInfo, Value...)} instead. * @param ctx query context * @param ii input info * @param args arguments * @return resulting iterator * @throws QueryException query exception */ Value invValue(QueryContext ctx, InputInfo ii, Value... args) throws QueryException; /** * Internally invokes this function with the given arguments. * This method does not deal with tail calls, so it is unsafe to call. * Use {@link #invokeItem(QueryContext, InputInfo, Value...)} instead. * @param ctx query context * @param ii input info * @param args arguments * @return resulting item * @throws QueryException query exception */ Item invItem(QueryContext ctx, InputInfo ii, Value... args) throws QueryException; /** * Invokes this function with the given arguments. * @param ctx query context * @param ii input info * @param args arguments * @return resulting iterator * @throws QueryException query exception */ Value invokeValue(QueryContext ctx, InputInfo ii, Value... args) throws QueryException; /** * Invokes this function with the given arguments. * @param ctx query context * @param ii input info * @param args arguments * @return resulting item * @throws QueryException query exception */ Item invokeItem(QueryContext ctx, InputInfo ii, Value... args) throws QueryException; } basex-7.7.2/basex-core/src/main/java/org/basex/query/expr/package.html000066400000000000000000000000461222453003200256030ustar00rootroot00000000000000 XQuery expressions. basex-7.7.2/basex-core/src/main/java/org/basex/query/ft/000077500000000000000000000000001222453003200227555ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/ft/FTAnd.java000066400000000000000000000104201222453003200245510ustar00rootroot00000000000000package org.basex.query.ft; import static org.basex.query.QueryText.*; import org.basex.data.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.ft.*; import org.basex.util.hash.*; /** * FTAnd expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Sebastian Gath */ public final class FTAnd extends FTExpr { /** Flags for negative operators. */ boolean[] neg; /** * Constructor. * @param ii input info * @param e expression list */ public FTAnd(final InputInfo ii, final FTExpr[] e) { super(ii, e); } @Override public FTExpr compile(final QueryContext ctx, final VarScope scp) throws QueryException { super.compile(ctx, scp); boolean not = true; for(final FTExpr e : expr) not &= e instanceof FTNot; if(not) { // convert (!A and !B and ...) to !(A or B or ...) final int es = expr.length; for(int e = 0; e < es; ++e) expr[e] = expr[e].expr[0]; return new FTNot(info, new FTOr(info, expr)); } return this; } @Override public FTNode item(final QueryContext ctx, final InputInfo ii) throws QueryException { final FTNode item = expr[0].item(ctx, info); final int es = expr.length; for(int e = 1; e < es; ++e) and(item, expr[e].item(ctx, info)); return item; } @Override public FTIter iter(final QueryContext ctx) throws QueryException { // initialize iterators final int es = expr.length; final FTIter[] ir = new FTIter[es]; final FTNode[] it = new FTNode[es]; for(int e = 0; e < es; ++e) { ir[e] = expr[e].iter(ctx); it[e] = ir[e].next(); } return new FTIter() { @Override public FTNode next() throws QueryException { // find item with lowest pre value for(int i = 0; i < it.length; ++i) { if(it[i] == null) { if(neg[i]) continue; return null; } final int d = it[0].pre - it[i].pre; if(neg[i]) { if(d >= 0) { if(d == 0) it[0] = ir[0].next(); it[i] = ir[i].next(); i = -1; } } else { if(d != 0) { if(d < 0) i = 0; it[i] = ir[i].next(); i = -1; } } } // merge all matches final FTNode item = it[0]; for(int i = 1; i < it.length; ++i) { // [CG] XQFT: item.all = FTMatches.not(it[i].all, 0); if(neg[i]) continue; and(item, it[i]); it[i] = ir[i].next(); } it[0] = ir[0].next(); return item; } }; } /** * Merges two matches. * @param i1 first item * @param i2 second item */ static void and(final FTNode i1, final FTNode i2) { final FTMatches all = new FTMatches( (byte) Math.max(i1.all.sTokenNum, i2.all.sTokenNum)); for(final FTMatch s1 : i1.all) { for(final FTMatch s2 : i2.all) { all.add(new FTMatch(s1.size() + s2.size()).add(s1).add(s2)); } } i1.score(Scoring.and(i1.score(), i2.score())); i1.all = all; } @Override public boolean indexAccessible(final IndexCosts ic) throws QueryException { final int es = expr.length; neg = new boolean[es]; int is = 0; int n = 0; for(int i = 0; i < es; ++i) { if(!expr[i].indexAccessible(ic)) return false; neg[i] = ic.not; if(ic.not) ++n; ic.not = false; if(is == 0 || ic.costs() < is) is = ic.costs(); if(ic.costs() == 0) break; } ic.costs(is); // no index access if first or all operators are negative return !neg[0] && n < es; } @Override public FTExpr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final FTAnd copy = new FTAnd(info, Arr.copyAll(ctx, scp, vs, expr)); if(neg != null) copy.neg = neg.clone(); return copy; } @Override public String toString() { return PAR1 + toString(' ' + FTAND + ' ') + PAR2; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/ft/FTContains.java000066400000000000000000000050521222453003200256320ustar00rootroot00000000000000package org.basex.query.ft; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.ft.*; /** * Abstract FTContains expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class FTContains extends ParseExpr { /** Expression. */ Expr expr; /** Full-text expression. */ FTExpr ftexpr; /** Full-text parser. */ FTLexer lex; /** * Constructor. * @param e expression * @param fte full-text expression * @param ii input info */ public FTContains(final Expr e, final FTExpr fte, final InputInfo ii) { super(ii); expr = e; ftexpr = fte; type = SeqType.BLN; } @Override public final void checkUp() throws QueryException { checkNoUp(expr); } @Override public final Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { expr = expr.compile(ctx, scp).addText(ctx); ftexpr = ftexpr.compile(ctx, scp); if(lex == null) lex = new FTLexer(new FTOpt()); return expr.isEmpty() ? optPre(Bln.FALSE, ctx) : this; } @Override public final boolean has(final Flag flag) { return expr.has(flag) || ftexpr.has(flag); } @Override public final boolean removable(final Var v) { return expr.removable(v) && ftexpr.removable(v); } @Override public final VarUsage count(final Var v) { return expr.count(v).plus(ftexpr.count(v)); } @Override public final Expr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { final Expr ex = expr.inline(ctx, scp, v, e); if(ex != null) expr = ex; final FTExpr fte = ftexpr.inline(ctx, scp, v, e); if(fte != null) ftexpr = fte; return ex != null || fte != null ? optimize(ctx, scp) : null; } @Override public final void plan(final FElem plan) { addPlan(plan, planElem(), expr, ftexpr); } @Override public final boolean accept(final ASTVisitor visitor) { return expr.accept(visitor) && ftexpr.accept(visitor); } @Override public final int exprSize() { return expr.exprSize() + ftexpr.exprSize() + 1; } @Override public final String toString() { return expr + " " + CONTAINS + ' ' + TEXT + ' ' + ftexpr; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/ft/FTContainsExpr.java000066400000000000000000000055011222453003200264700ustar00rootroot00000000000000package org.basex.query.ft; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.path.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.ft.*; import org.basex.util.hash.*; /** * FTContains expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FTContainsExpr extends FTContains { /** * Constructor. * @param e expression * @param fte full-text expression * @param ii input info */ public FTContainsExpr(final Expr e, final FTExpr fte, final InputInfo ii) { super(e, fte, ii); } @Override public Bln item(final QueryContext ctx, final InputInfo ii) throws QueryException { final Iter iter = expr.iter(ctx); final FTLexer tmp = ctx.fttoken; double s = 0; ctx.fttoken = lex; for(Item it; (it = iter.next()) != null;) { lex.init(it.string(info)); final FTNode item = ftexpr.item(ctx, info); double d = 0; if(item.all.matches()) { d = item.score(); // no scoring found - use default value if(d == 0) d = 1; } s = Scoring.and(s, d); // cache entry for visualizations or ft:mark/ft:extract if(d > 0 && ctx.ftpos != null && it instanceof DBNode) { final DBNode node = (DBNode) it; ctx.ftpos.add(node.data, node.pre, item.all); } } ctx.fttoken = tmp; return Bln.get(s); } @Override public boolean indexAccessible(final IndexCosts ic) throws QueryException { // return if step is no text node, or if no index is available final Step s = expr instanceof Context ? ic.step : CmpG.indexStep(expr); final boolean ok = s != null && ic.ictx.data.meta.ftxtindex && s.test.type == NodeType.TXT && ftexpr.indexAccessible(ic); ic.seq |= ic.not; return ok; } @Override public Expr indexEquivalent(final IndexCosts ic) throws QueryException { ic.ctx.compInfo(OPTFTXINDEX); // sequential evaluation with index access final FTExpr ie = ftexpr.indexEquivalent(ic); if(ic.seq) return new FTContainsIndex(info, expr, ie, ic.not); // standard index evaluation; first expression will always be an axis path final FTIndexAccess rt = new FTIndexAccess(info, ie, ic.ictx); return expr instanceof Context ? rt : ((AxisPath) expr).invertPath(rt, ic.step); } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final FTContains ftc = new FTContainsExpr(expr.copy(ctx, scp, vs), ftexpr.copy(ctx, scp, vs), info); if(lex != null) ftc.lex = new FTLexer(new FTOpt()); return ftc; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/ft/FTContainsIndex.java000066400000000000000000000042471222453003200266270ustar00rootroot00000000000000package org.basex.query.ft; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.ft.*; import org.basex.util.hash.*; /** * Sequential FTContains expression with index access. * * @author BaseX Team 2005-12, BSD License * @author Sebastian Gath */ final class FTContainsIndex extends FTContains { /** Current node item. */ private FTNode ftn; /** Node iterator. */ private FTIter fti; /** {@code not} flag. */ private final boolean not; /** * Constructor. * @param ii input info * @param e contains, select and optional ignore expression * @param f full-text expression * @param nt {@code not} flag */ FTContainsIndex(final InputInfo ii, final Expr e, final FTExpr f, final boolean nt) { super(e, f, ii); not = nt; } @Override public Bln item(final QueryContext ctx, final InputInfo ii) throws QueryException { final Iter ir = expr.iter(ctx); final FTLexer tmp = ctx.fttoken; ctx.fttoken = lex; // create index iterator if(fti == null) { fti = ftexpr.iter(ctx); ftn = fti.next(); } // find next relevant index entry boolean found = false; DBNode n = null; while(!found && (n = (DBNode) ir.next()) != null) { // find entry with pre value equal to or larger than current node while(ftn != null && n.pre > ftn.pre) ftn = fti.next(); found = (ftn != null && n.pre == ftn.pre) ^ not; } // reset index iterator after all nodes have been processed if(n == null) fti = null; // cache entry for visualizations or ft:mark/ft:extract if(found && ctx.ftpos != null && !not) { ctx.ftpos.add(ftn.data, ftn.pre, ftn.all); } ctx.fttoken = tmp; return Bln.get(found ? 1 : 0); } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return copyType(new FTContainsIndex(info, expr.copy(ctx, scp, vs), ftexpr.copy(ctx, scp, vs), not)); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/ft/FTContent.java000066400000000000000000000041171222453003200254670ustar00rootroot00000000000000package org.basex.query.ft; import static org.basex.query.QueryText.*; import static org.basex.util.Token.*; import org.basex.data.*; import org.basex.query.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.ft.*; import org.basex.util.hash.*; /** * FTContent expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FTContent extends FTFilter { /** Start flag. */ private final boolean start; /** End flag. */ private final boolean end; /** * Constructor. * @param ii input info * @param ex expression * @param s start flag * @param e end flag */ public FTContent(final InputInfo ii, final FTExpr ex, final boolean s, final boolean e) { super(ii, ex); start = s; end = e; } @Override protected boolean filter(final QueryContext ctx, final FTMatch mtc, final FTLexer lex) { if(start) { for(final FTStringMatch sm : mtc) if(sm.s == 0) return true; } else if(end) { final int p = lex.count() - 1; for(final FTStringMatch sm : mtc) if(sm.e == p) return true; } else { final int s = lex.count(); final boolean[] bl = new boolean[s]; for(final FTStringMatch sm : mtc) { if(sm.g) continue; for(int p = sm.s; p <= sm.e; ++p) bl[p] = true; } for(final boolean b : bl) if(!b) return false; return true; } return false; } @Override protected boolean content() { return end || !start; } @Override public FTExpr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new FTContent(info, expr[0].copy(ctx, scp, vs), start, end); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(start ? START : end ? END : CONTENT, TRUE), expr); } @Override public String toString() { return super.toString() + (start || end ? AT + ' ' + (start ? START : END) : ENTIRE + ' ' + CONTENT); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/ft/FTDistance.java000066400000000000000000000066321222453003200256130ustar00rootroot00000000000000package org.basex.query.ft; import static org.basex.query.QueryText.*; import org.basex.data.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.util.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.ft.*; import org.basex.util.hash.*; /** * FTDistance expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FTDistance extends FTFilter { /** Distance. */ private final Expr[] dist; /** * Constructor. * @param ii input info * @param e expression * @param d distances * @param u unit */ public FTDistance(final InputInfo ii, final FTExpr e, final Expr[] d, final FTUnit u) { super(ii, e); dist = d; unit = u; } @Override public void checkUp() throws QueryException { checkNoneUp(dist); super.checkUp(); } @Override public FTExpr compile(final QueryContext ctx, final VarScope scp) throws QueryException { for(int d = 0; d < dist.length; d++) dist[d] = dist[d].compile(ctx, scp); return super.compile(ctx, scp); } @Override protected boolean filter(final QueryContext ctx, final FTMatch mtc, final FTLexer lex) throws QueryException { final long min = checkItr(dist[0], ctx); final long max = checkItr(dist[1], ctx); mtc.sort(); final FTMatch match = new FTMatch(); FTStringMatch sm = null; FTStringMatch f = null; for(final FTStringMatch m : mtc) { if(m.ex) { match.add(m); } else { if(sm != null) { final int d = pos(m.s, lex) - pos(sm.e, lex) - 1; if(d < min || d > max) return false; } else { f = m; } sm = m; } } f.e = sm.e; mtc.reset(); mtc.add(f); mtc.add(match); return true; } @Override public boolean has(final Flag flag) { for(final Expr d : dist) if(d.has(flag)) return true; return super.has(flag); } @Override public boolean removable(final Var v) { for(final Expr d : dist) if(!d.removable(v)) return false; return super.removable(v); } @Override public VarUsage count(final Var v) { return super.count(v).plus(VarUsage.sum(v, dist)); } @Override public FTExpr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { return inlineAll(ctx, scp, expr, v, e) | inlineAll(ctx, scp, dist, v, e) ? optimize(ctx, scp) : null; } @Override public FTExpr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new FTDistance(info, expr[0].copy(ctx, scp, vs), Arr.copyAll(ctx, scp, vs, dist), unit); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(DISTANCE, dist[0] + "-" + dist[1] + ' ' + unit), expr); } @Override public String toString() { return super.toString() + DISTANCE + PAR1 + dist[0] + '-' + dist[1] + ' ' + unit + PAR2; } @Override public boolean accept(final ASTVisitor visitor) { return super.accept(visitor) && visitAll(visitor, dist); } @Override public int exprSize() { int sz = 1; for(final FTExpr e : expr) sz += e.exprSize(); for(final Expr e : dist) sz += e.exprSize(); return sz; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/ft/FTExpr.java000066400000000000000000000070011222453003200247660ustar00rootroot00000000000000package org.basex.query.ft; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * This class defines is an abstract class for full-text expressions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class FTExpr extends ParseExpr { /** Expression list. */ public final FTExpr[] expr; /** * Constructor. * @param ii input info * @param e expression */ FTExpr(final InputInfo ii, final FTExpr... e) { super(ii); expr = e; type = SeqType.BLN; } @Override public void checkUp() throws QueryException { checkNoneUp(expr); } @Override public FTExpr compile(final QueryContext ctx, final VarScope scp) throws QueryException { final int es = expr.length; for(int e = 0; e < es; e++) expr[e] = expr[e].compile(ctx, scp); return this; } @Override public FTExpr optimize(final QueryContext ctx, final VarScope scp) throws QueryException { return this; } /** * This method is called by the sequential full-text evaluation. * @param ctx query context * @return resulting item * @throws QueryException query exception */ @Override public abstract FTNode item(final QueryContext ctx, final InputInfo ii) throws QueryException; /** * This method is called by the index-based full-text evaluation. * @param ctx query context * @return resulting item * @throws QueryException query exception */ @Override public abstract FTIter iter(final QueryContext ctx) throws QueryException; @Override public boolean has(final Flag flag) { for(final FTExpr e : expr) if(e.has(flag)) return true; return false; } @Override public boolean removable(final Var v) { for(final Expr e : expr) if(!e.removable(v)) return false; return true; } @Override public VarUsage count(final Var v) { return VarUsage.sum(v, expr); } @Override public FTExpr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { return inlineAll(ctx, scp, expr, v, e) ? optimize(ctx, scp) : null; } @Override public abstract FTExpr copy(QueryContext ctx, VarScope scp, IntObjMap vs); @Override public FTExpr indexEquivalent(final IndexCosts ic) throws QueryException { final int es = expr.length; for(int e = 0; e < es; e++) expr[e] = expr[e].indexEquivalent(ic); return this; } /** * Checks if sub expressions of a mild not operator violate the grammar. * @return result of check */ boolean usesExclude() { for(final FTExpr e : expr) if(e.usesExclude()) return true; return false; } @Override public void plan(final FElem plan) { addPlan(plan, planElem(), expr); } @Override public boolean accept(final ASTVisitor visitor) { return visitAll(visitor, expr); } /** * Prints the array with the specified separator. * @param sep separator * @return string representation */ final String toString(final Object sep) { final StringBuilder sb = new StringBuilder(); final int es = expr.length; for(int e = 0; e < es; e++) sb.append(e != 0 ? sep.toString() : "").append(expr[e]); return sb.toString(); } @Override public int exprSize() { int sz = 1; for(final Expr e : expr) sz += e.exprSize(); return sz; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/ft/FTExtensionSelection.java000066400000000000000000000031721222453003200276770ustar00rootroot00000000000000package org.basex.query.ft; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * FTExtensionSelection expression. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class FTExtensionSelection extends FTExpr { /** Pragmas. */ private final Pragma[] pragmas; /** * Constructor. * @param ii input info * @param prag pragmas * @param e enclosed FTSelection */ public FTExtensionSelection(final InputInfo ii, final Pragma[] prag, final FTExpr e) { super(ii, e); pragmas = prag; } @Override public FTNode item(final QueryContext ctx, final InputInfo ii) throws QueryException { return expr[0].item(ctx, info); } @Override public FTIter iter(final QueryContext ctx) throws QueryException { return expr[0].iter(ctx); } @Override public FTExpr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final Pragma[] prag = pragmas.clone(); for(int i = 0; i < prag.length; i++) prag[i] = prag[i].copy(); return copyType(new FTExtensionSelection(info, prag, expr[0].copy(ctx, scp, vs))); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(), pragmas, expr); } @Override public String toString() { final StringBuilder sb = new StringBuilder(); for(final Pragma p : pragmas) sb.append(p).append(' '); return sb.append(BRACE1 + ' ' + expr[0] + ' ' + BRACE2).toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/ft/FTFilter.java000066400000000000000000000056021222453003200253020ustar00rootroot00000000000000package org.basex.query.ft; import org.basex.data.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.node.*; import org.basex.util.*; import org.basex.util.ft.*; /** * Abstract FTFilter expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class FTFilter extends FTExpr { /** Optional unit. */ FTUnit unit = FTUnit.WORD; /** * Constructor. * @param ii input info * @param e expression */ FTFilter(final InputInfo ii, final FTExpr e) { super(ii, e); } @Override public final FTNode item(final QueryContext ctx, final InputInfo ii) throws QueryException { final FTNode it = expr[0].item(ctx, info); filter(ctx, it, ctx.fttoken); return it; } @Override public final FTIter iter(final QueryContext ctx) throws QueryException { final FTIter ir = expr[0].iter(ctx); return new FTIter() { @Override public FTNode next() throws QueryException { FTNode it; while((it = ir.next()) != null) { if(filter(ctx, it, content() ? new FTLexer().init(it.string(info)) : null)) break; } return it; } }; } /** * Evaluates the position filters. * @param ctx query context * @param item input node * @param lex tokenizer * @return result of check * @throws QueryException query exception */ final boolean filter(final QueryContext ctx, final FTNode item, final FTLexer lex) throws QueryException { final FTMatches all = item.all; for(int a = 0; a < all.size(); a++) { if(!filter(ctx, all.match[a], lex)) all.delete(a--); } return !all.isEmpty(); } /** * Evaluates the filter expression. * @param ctx query context * @param m full-text match * @param ft tokenizer * @return result of check * @throws QueryException query exception */ protected abstract boolean filter(final QueryContext ctx, final FTMatch m, final FTLexer ft) throws QueryException; /** * Checks if the filter requires the whole text node to be parsed. * Is overwritten by some filters to perform other checks. * @return result of check */ boolean content() { return unit != FTUnit.WORD; } /** * Calculates a position value, dependent on the specified unit. * @param p word position * @param ft tokenizer * @return new position */ final int pos(final int p, final FTLexer ft) { // ft can be zero if unit is WORD return unit == FTUnit.WORD ? p : ft.pos(p, unit); } @Override public final boolean indexAccessible(final IndexCosts ic) throws QueryException { return expr[0].indexAccessible(ic); } @Override public String toString() { return expr[0] + " "; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/ft/FTIndexAccess.java000066400000000000000000000057631222453003200262560ustar00rootroot00000000000000package org.basex.query.ft; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.func.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * FTContains expression with index access. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FTIndexAccess extends Simple { /** Full-text expression. */ private final FTExpr ftexpr; /** Database name. */ private final IndexContext ictx; /** * Constructor. * @param ii input info * @param ex contains, select and optional ignore expression * @param ic index context */ public FTIndexAccess(final InputInfo ii, final FTExpr ex, final IndexContext ic) { super(ii); ftexpr = ex; ictx = ic; } @Override public NodeIter iter(final QueryContext ctx) throws QueryException { final FTIter ir = ftexpr.iter(ctx); return new NodeIter() { @Override public ANode next() throws QueryException { final FTNode it = ir.next(); if(it != null) { // cache entry for visualizations or ft:mark/ft:extract if(ctx.ftpos != null) ctx.ftpos.add(it.data, it.pre, it.all); // assign scoring, if not done yet it.score(); // remove matches reference to save memory it.all = null; } return it; } }; } @Override public boolean has(final Flag flag) { return ftexpr.has(flag); } @Override public boolean removable(final Var v) { return ftexpr.removable(v); } @Override public VarUsage count(final Var v) { return ftexpr.count(v); } @Override public Expr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { return ftexpr.inline(ctx, scp, v, e) == null ? null : optimize(ctx, scp); } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new FTIndexAccess(info, ftexpr.copy(ctx, scp, vs), ictx); } @Override public boolean accept(final ASTVisitor visitor) { return visitor.lock(ictx.data.meta.name) && ftexpr.accept(visitor); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(DATA, ictx.data.meta.name), ftexpr); } @Override public boolean iterable() { return ictx.iterable; } @Override public String toString() { Expr e = ftexpr; if(ftexpr instanceof FTWords) { final FTWords f = (FTWords) ftexpr; if(f.mode == FTMode.ANY && f.occ == null) e = f.query; } return Function._DB_FULLTEXT.get(info, Str.get(ictx.data.meta.name), e).toString(); } @Override public int exprSize() { return ftexpr.exprSize() + 1; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/ft/FTMildNot.java000066400000000000000000000062511222453003200254240ustar00rootroot00000000000000package org.basex.query.ft; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import org.basex.data.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * FTMildnot expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FTMildNot extends FTExpr { /** * Constructor. * @param ii input info * @param e1 first expression * @param e2 second expression * @throws QueryException query exception */ public FTMildNot(final InputInfo ii, final FTExpr e1, final FTExpr e2) throws QueryException { super(ii, e1, e2); if(usesExclude()) FTMILD.thrw(info); } @Override public FTNode item(final QueryContext ctx, final InputInfo ii) throws QueryException { return mildnot(expr[0].item(ctx, info), expr[1].item(ctx, info)); } @Override public FTIter iter(final QueryContext ctx) throws QueryException { return new FTIter() { final FTIter i1 = expr[0].iter(ctx); final FTIter i2 = expr[1].iter(ctx); FTNode it1 = i1.next(); FTNode it2 = i2.next(); @Override public FTNode next() throws QueryException { while(it1 != null && it2 != null) { final int d = it1.pre - it2.pre; if(d < 0) break; if(d > 0) { it2 = i2.next(); } else { if(!mildnot(it1, it2).all.isEmpty()) break; it1 = i1.next(); } } final FTNode it = it1; it1 = i1.next(); return it; } }; } /** * Processes a hit. * @param it1 first item * @param it2 second item * @return specified item */ static FTNode mildnot(final FTNode it1, final FTNode it2) { it1.all = mildnot(it1.all, it2.all); return it1; } /** * Performs a mild not operation. * @param m1 first match list * @param m2 second match list * @return resulting match */ private static FTMatches mildnot(final FTMatches m1, final FTMatches m2) { final FTMatches all = new FTMatches(m1.sTokenNum); for(final FTMatch s1 : m1) { boolean n = true; for(final FTMatch s2 : m2) n &= s1.notin(s2); if(n) all.add(s1); } return all; } @Override public boolean indexAccessible(final IndexCosts ic) throws QueryException { int is = ic.costs(); for(final FTExpr e : expr) { if(!e.indexAccessible(ic)) return false; is = Math.min(Integer.MIN_VALUE, is + ic.costs()); } ic.costs(is); return true; } @Override public FTExpr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { try { return new FTMildNot(info, expr[0].copy(ctx, scp, vs), expr[1].copy(ctx, scp, vs)); } catch(final QueryException e) { // checks were already done throw Util.notexpected(e); } } @Override public String toString() { return toString(' ' + NOT + ' ' + IN + ' '); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/ft/FTMode.java000066400000000000000000000014121222453003200247340ustar00rootroot00000000000000package org.basex.query.ft; import java.util.*; import org.basex.util.*; /** * Search mode. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public enum FTMode { /** All option. */ ALL, /** All words option. */ ALL_WORDS, /** Any option. */ ANY, /** Any words option. */ ANY_WORD, /** Phrase search. */ PHRASE; /** * Returns the specified mode, or {@code null}. * @param mode mode * @return mode enumeration */ public static FTMode get(final byte[] mode) { final String md = Token.string(mode).toLowerCase(Locale.ENGLISH); for(final FTMode m : values()) { final String s = m.toString().replace('_', ' ').toLowerCase(Locale.ENGLISH); if(s.equals(md)) return m; } return null; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/ft/FTNot.java000066400000000000000000000055021222453003200246140ustar00rootroot00000000000000package org.basex.query.ft; import static org.basex.query.QueryText.*; import org.basex.data.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.ft.*; import org.basex.util.hash.*; /** * FTUnaryNot expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Sebastian Gath */ public final class FTNot extends FTExpr { /** * Constructor. * @param ii input info * @param e expression */ public FTNot(final InputInfo ii, final FTExpr e) { super(ii, e); } @Override public FTExpr compile(final QueryContext ctx, final VarScope scp) throws QueryException { super.compile(ctx, scp); return expr[0] instanceof FTNot ? expr[0].expr[0] : this; } @Override public FTNode item(final QueryContext ctx, final InputInfo ii) throws QueryException { return not(expr[0].item(ctx, info)); } @Override public FTIter iter(final QueryContext ctx) throws QueryException { return new FTIter() { final FTIter ir = expr[0].iter(ctx); @Override public FTNode next() throws QueryException { return not(ir.next()); } }; } /** * Negates a hit. * @param item item * @return specified item */ static FTNode not(final FTNode item) { if(item != null) { item.all = not(item.all); item.score(Scoring.not(item.score())); } return item; } /** * Negates the specified matches. * @param m match * @return resulting matches */ static FTMatches not(final FTMatches m) { return not(m, 0); } /** * Negates the specified matches. * @param m match * @param i position to start from * @return resulting match */ private static FTMatches not(final FTMatches m, final int i) { final FTMatches all = new FTMatches(m.sTokenNum); if(i == m.size()) { all.add(new FTMatch()); } else { for(final FTStringMatch s : m.match[i]) { s.ex ^= true; for(final FTMatch tmp : not(m, i + 1)) { all.add(new FTMatch(1 + tmp.size()).add(s).add(tmp)); } } } return all; } @Override public boolean indexAccessible(final IndexCosts ic) throws QueryException { final boolean ia = expr[0].indexAccessible(ic); ic.not ^= true; return ia; } @Override public FTExpr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new FTNot(info, expr[0].copy(ctx, scp, vs)); } @Override public boolean usesExclude() { return true; } @Override public String toString() { return FTNOT + ' ' + expr[0]; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/ft/FTOptions.java000066400000000000000000000034031222453003200255050ustar00rootroot00000000000000package org.basex.query.ft; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.ft.*; import org.basex.util.hash.*; /** * FTOptions expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FTOptions extends FTExpr { /** FTOptions. */ private final FTOpt opt; /** * Constructor. * @param ii input info * @param e expression * @param o ft options */ public FTOptions(final InputInfo ii, final FTExpr e, final FTOpt o) { super(ii, e); opt = o; } @Override public FTExpr compile(final QueryContext ctx, final VarScope scp) throws QueryException { final FTOpt tmp = ctx.ftOpt(); ctx.ftOpt(opt.copy(tmp)); if(opt.sw != null && ctx.value != null && ctx.value.data() != null) opt.sw.comp(ctx.value.data()); expr[0] = expr[0].compile(ctx, scp); ctx.ftOpt(tmp); return expr[0]; } @Override public void plan(final FElem plan) { addPlan(plan, planElem(), opt, expr[0]); } @Override public String toString() { return expr[0].toString() + opt; } @Override public FTNode item(final QueryContext ctx, final InputInfo ii) { // shouldn't be called, as compile returns argument throw Util.notexpected(); } @Override public FTIter iter(final QueryContext ctx) { // shouldn't be called, as compile returns argument throw Util.notexpected(); } @Override public FTExpr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new FTOptions(info, expr[0].copy(ctx, scp, vs), new FTOpt().copy(opt)); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/ft/FTOr.java000066400000000000000000000070701222453003200244360ustar00rootroot00000000000000package org.basex.query.ft; import static org.basex.query.QueryText.*; import org.basex.data.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.ft.*; import org.basex.util.hash.*; /** * FTOr expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Sebastian Gath */ public final class FTOr extends FTExpr { /** * Constructor. * @param ii input info * @param e expression list */ public FTOr(final InputInfo ii, final FTExpr[] e) { super(ii, e); } @Override public FTExpr compile(final QueryContext ctx, final VarScope scp) throws QueryException { super.compile(ctx, scp); boolean not = true; for(final FTExpr e : expr) not &= e instanceof FTNot; if(not) { // convert (!A or !B or ...) to !(A and B and ...) final int es = expr.length; for(int e = 0; e < es; e++) expr[e] = expr[e].expr[0]; return new FTNot(info, new FTAnd(info, expr)); } return this; } @Override public FTNode item(final QueryContext ctx, final InputInfo ii) throws QueryException { final FTNode item = expr[0].item(ctx, info); final int es = expr.length; for(int e = 1; e < es; e++) { or(item, expr[e].item(ctx, info)); } return item; } @Override public FTIter iter(final QueryContext ctx) throws QueryException { // initialize iterators final int es = expr.length; final FTIter[] ir = new FTIter[es]; final FTNode[] it = new FTNode[es]; for(int e = 0; e < es; e++) { ir[e] = expr[e].iter(ctx); it[e] = ir[e].next(); } return new FTIter() { @Override public FTNode next() throws QueryException { // find item with smallest pre value int p = -1; for(int i = 0; i < es; ++i) { if(it[i] != null && (p == -1 || it[p].pre > it[i].pre)) p = i; } // no items left - leave if(p == -1) return null; // merge all matches final FTNode item = it[p]; for(int i = 0; i < es; ++i) { if(it[i] != null && p != i && item.pre == it[i].pre) { or(item, it[i]); it[i] = ir[i].next(); } } it[p] = ir[p].next(); return item; } }; } /** * Merges two matches. * @param i1 first item * @param i2 second item */ static void or(final FTNode i1, final FTNode i2) { final FTMatches all = new FTMatches( (byte) Math.max(i1.all.sTokenNum, i2.all.sTokenNum)); for(final FTMatch m : i1.all) all.add(m); for(final FTMatch m : i2.all) all.add(m); i1.score(Scoring.or(i1.score(), i2.score())); i1.all = all; } @Override public boolean indexAccessible(final IndexCosts ic) throws QueryException { int is = 0; for(final FTExpr e : expr) { // no index access if negative operators is found if(!e.indexAccessible(ic) || ic.not) return false; ic.not = false; is = Math.min(Integer.MIN_VALUE, is + ic.costs()); } ic.costs(is); return true; } @Override public FTExpr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new FTOr(info, Arr.copyAll(ctx, scp, vs, expr)); } @Override public String toString() { return PAR1 + toString(' ' + FTOR + ' ') + PAR2; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/ft/FTOrder.java000066400000000000000000000025411222453003200251270ustar00rootroot00000000000000package org.basex.query.ft; import static org.basex.util.Token.*; import org.basex.data.*; import org.basex.query.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.ft.*; import org.basex.util.hash.*; /** * FTOrder expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FTOrder extends FTFilter { /** * Constructor. * @param ii input info * @param e expression */ public FTOrder(final InputInfo ii, final FTExpr e) { super(ii, e); } @Override protected boolean filter(final QueryContext ctx, final FTMatch mtc, final FTLexer lex) { int p = 0, s = 0; boolean f = true; for(final FTStringMatch sm : mtc) { if(sm.ex) continue; if(f) { if(p == sm.q) continue; p = sm.q; } f = s <= sm.s; if(f) s = sm.s; } return f; } @Override public FTExpr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new FTOrder(info, expr[0].copy(ctx, scp, vs)); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(QueryText.ORDERED, TRUE), expr); } @Override public String toString() { return super.toString() + QueryText.ORDERED; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/ft/FTScope.java000066400000000000000000000036341222453003200251310ustar00rootroot00000000000000package org.basex.query.ft; import static org.basex.query.QueryText.*; import org.basex.data.*; import org.basex.query.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.ft.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * FTScope expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FTScope extends FTFilter { /** Same/different flag. */ private final boolean same; /** * Constructor. * @param ii input info * @param e expression * @param u unit * @param s same flag */ public FTScope(final InputInfo ii, final FTExpr e, final FTUnit u, final boolean s) { super(ii, e); unit = u; same = s; } @Override protected boolean filter(final QueryContext ctx, final FTMatch mtc, final FTLexer lex) { if(same) { int s = -1; for(final FTStringMatch sm : mtc) { if(sm.ex) continue; final int p = pos(sm.s, lex); if(s == -1) s = p; else if(s != p) return false; } return true; } int c = 0; final BoolList bl = new BoolList(); for(final FTStringMatch sm : mtc) { if(sm.ex) continue; c++; final int p = pos(sm.s, lex); final int s = bl.size(); if(p < s && bl.get(p) && p == pos(sm.e, lex)) return false; bl.set(p, true); } return c > 1; } @Override public FTExpr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new FTScope(info, expr[0].copy(ctx, scp, vs), unit, same); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(same ? SAME : DIFFERENT, unit), expr); } @Override public String toString() { return super.toString() + (same ? SAME : DIFFERENT) + ' ' + unit; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/ft/FTTokenizer.java000066400000000000000000000104031222453003200260220ustar00rootroot00000000000000package org.basex.query.ft; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import static org.basex.util.ft.FTFlag.*; import org.basex.query.*; import org.basex.util.*; import org.basex.util.ft.*; import org.basex.util.ft.FTBitapSearch.TokenComparator; import org.basex.util.hash.*; import org.basex.util.list.*; /** * This class performs the full-text tokenization. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class FTTokenizer { /** Wildcard object cache. */ final TokenObjMap wcCache = new TokenObjMap(); /** Levenshtein reference. */ final Levenshtein ls = new Levenshtein(); /** Calling expression. */ final FTWords words; /** Full-text options. */ final FTOpt opt; /** Levenshtein error. */ final int lserr; /** Token comparator. */ private final TokenComparator cmp; /** Cache. */ private final TokenObjMap cache = new TokenObjMap(); /** * Constructor. * @param w full-text words * @param o full-text options * @param lsr Levenshtein error */ public FTTokenizer(final FTWords w, final FTOpt o, final int lsr) { words = w; opt = o; lserr = lsr; cmp = new TokenComparator() { @Override public boolean equal(final byte[] in, final byte[] qu) throws QueryException { FTWildcard ftw = null; if(opt.is(WC)) { ftw = wcCache.get(qu); if(ftw == null) { ftw = new FTWildcard(qu); if(!ftw.parse()) FTREG.thrw(words.info, qu); wcCache.put(qu, ftw); } } return // skip stop words, i. e. if the current query token is a stop word, // it is always equal to the corresponding input token: opt.sw != null && opt.sw.contains(qu) || // fuzzy search: (opt.is(FZ) ? ls.similar(in, qu, lserr) : // wild-card search: ftw != null ? ftw.match(in) : // simple search: eq(in, qu)); } }; } /** * Returns a new lexer, adopting the tokenizer options. * @param lex input lexer * @return lexer */ FTLexer lexer(final FTLexer lex) { // assign options to text: final FTOpt to = lex.ftOpt(); to.set(ST, opt.is(ST)); to.set(DC, opt.is(DC)); to.set(CS, opt.is(CS)); to.ln = opt.ln; to.th = opt.th; to.sd = opt.sd; return new FTLexer(to).init(lex.text()); } /** * Returns cached query tokens. * @param query query token * @return number of occurrences * @throws QueryException query exception */ FTTokens cache(final byte[] query) throws QueryException { FTTokens tokens = cache.get(query); if(tokens == null) { tokens = new FTTokens(); cache.put(query, tokens); // cache query tokens: final FTIterator quLex = new FTLexer(opt).init(query); final TokenList quList = new TokenList(1); while(quLex.hasNext()) quList.add(quLex.nextToken()); tokens.add(quList); // if thesaurus is required, add the terms which extend the query: if(opt.th != null) { for(final byte[] ext : opt.th.find(words.info, query)) { // parse each extension term to a set of tokens: final TokenList tl = new TokenList(1); quLex.init(ext); while(quLex.hasNext()) tl.add(quLex.nextToken()); // add each thesaurus term as an additional query term: tokens.add(tl); } } } return tokens; } /** * Checks if the first token contains the second full-text term. * @param query cached query tokens * @param input input text * @return number of occurrences * @throws QueryException query exception */ int contains(final FTTokens query, final FTLexer input) throws QueryException { input.init(); final FTBitapSearch bs = new FTBitapSearch(input, query, cmp); int c = 0; while(bs.hasNext()) { final int pos = bs.next(); words.add(pos, pos + query.length() - 1); ++c; } words.matches.sTokenNum++; words.first = false; return c; } /** * Copies this FTTokenizer. * @param ftw calling expression * @return copy */ protected FTTokenizer copy(final FTWords ftw) { return new FTTokenizer(ftw, opt, lserr); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/ft/FTTokens.java000066400000000000000000000016061222453003200253200ustar00rootroot00000000000000package org.basex.query.ft; import org.basex.util.*; import org.basex.util.list.*; /** * This is a container for full-text tokens. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FTTokens extends ElementList { /** Element container. */ private TokenList[] list = new TokenList[1]; /** * Adds an element. * @param e element to be added */ public void add(final TokenList e) { if(size == list.length) list = Array.copy(list, new TokenList[newSize()]); list[size++] = e; } /** * Returns the element at the specified index. * @param i index * @return element */ public TokenList get(final int i) { return list[i]; } /** * Returns the number of tokens of the first entry. * @return number of tokens */ int length() { return list[0].size(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/ft/FTWeight.java000066400000000000000000000070601222453003200253040ustar00rootroot00000000000000package org.basex.query.ft; import static org.basex.query.util.Err.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * FTOptions expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FTWeight extends FTExpr { /** Weight. */ private Expr weight; /** * Constructor. * @param ii input info * @param e expression * @param w weight */ public FTWeight(final InputInfo ii, final FTExpr e, final Expr w) { super(ii, e); weight = w; } @Override public void checkUp() throws QueryException { checkNoUp(weight); super.checkUp(); } @Override public FTExpr compile(final QueryContext ctx, final VarScope scp) throws QueryException { weight = weight.compile(ctx, scp); return super.compile(ctx, scp); } // called by sequential variant @Override public FTNode item(final QueryContext ctx, final InputInfo ii) throws QueryException { return weight(expr[0].item(ctx, info), ctx); } // called by index variant @Override public FTIter iter(final QueryContext ctx) { return new FTIter() { @Override public FTNode next() throws QueryException { return weight(expr[0].iter(ctx).next(), ctx); } }; } /** * Returns the item with weight calculation. * @param item input item * @param ctx query context * @return item * @throws QueryException query exception */ FTNode weight(final FTNode item, final QueryContext ctx) throws QueryException { // evaluate weight if(item == null) return null; final double d = checkDbl(weight, ctx); if(Math.abs(d) > 1000) FTWEIGHT.thrw(info, d); if(d == 0) item.all.size(0); item.score(item.score() * d); return item; } @Override public boolean indexAccessible(final IndexCosts ic) { // weight makes no sense as long as no index-based scoring exists return false; } @Override public boolean has(final Flag flag) { return weight.has(flag) || super.has(flag); } @Override public boolean removable(final Var v) { return weight.removable(v) && super.removable(v); } @Override public VarUsage count(final Var v) { return weight.count(v).plus(super.count(v)); } @Override public FTExpr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { boolean change = inlineAll(ctx, scp, expr, v, e); final Expr w = weight.inline(ctx, scp, v, e); if(w != null) { weight = w; change = true; } return change ? optimize(ctx, scp) : null; } @Override public FTExpr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new FTWeight(info, expr[0].copy(ctx, scp, vs), weight.copy(ctx, scp, vs)); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(), weight, expr[0]); } @Override public String toString() { return expr[0] + " " + QueryText.WEIGHT + ' ' + weight; } @Override public boolean accept(final ASTVisitor visitor) { return super.accept(visitor) && weight.accept(visitor); } @Override public int exprSize() { int sz = 1; for(final FTExpr e : expr) sz += e.exprSize(); return sz + weight.exprSize(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/ft/FTWildcard.java000066400000000000000000000074531222453003200256140ustar00rootroot00000000000000package org.basex.query.ft; import static org.basex.util.Token.*; import org.basex.util.*; /** * Wildcard expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Dimitar Popov */ public final class FTWildcard { /** Value encoding the wildcard dot. */ private static final int DOT = -1; /** Original query. */ private final byte[] query; /** Characters. */ private int[] wc; /** Minimum number of occurrence. */ private int[] min; /** Maximum number of occurrence. */ private int[] max; /** Array length. */ private int size; /** * Constructor. * @param qu query */ public FTWildcard(final byte[] qu) { query = qu; } /** * Parses and constructs a new wildcard expression. * @return success flag */ public boolean parse() { final int[] q = cps(query); wc = new int[q.length]; min = new int[q.length]; max = new int[q.length]; size = 0; final int ql = q.length; for(int qi = 0; qi < ql;) { int n = 1; int m = 1; // parse wildcards if(q[qi] == '.') { int c = ++qi < ql ? q[qi] : 0; // minimum/maximum number of occurrence if(c == '?') { // .? ++qi; n = 0; m = 1; } else if(c == '*') { // .* ++qi; n = 0; m = Integer.MAX_VALUE; } else if(c == '+') { // .+ ++qi; n = 1; m = Integer.MAX_VALUE; } else if(c == '{') { // .{m,n} n = 0; m = 0; boolean f = false; while(true) { c = ++qi < ql ? q[qi] : 0; if(digit(c)) n = (n << 3) + (n << 1) + c - '0'; else if(f && c == ',') break; else return false; f = true; } f = false; while(true) { c = ++qi < ql ? q[qi] : 0; if(digit(c)) m = (m << 3) + (m << 1) + c - '0'; else if(f && c == '}') break; else return false; f = true; } ++qi; if(n > m) return false; } wc[size] = DOT; } else { if(q[qi] == '\\' && ++qi == ql) return false; wc[size] = q[qi++]; } min[size] = n; max[size] = m; size++; } return true; } /** * Returns the maximum length of a potential match. * @return {@code true} if a match is found */ public int max() { int c = 0; for(int s = 0; s < size; s++) { final int m = max[s]; if(m == Integer.MAX_VALUE) return m; c += m; } return c; } /** * Returns the wildcard prefix, which is the same for all matches. * @return prefix */ public byte[] prefix() { final TokenBuilder tb = new TokenBuilder(); for(int s = 0; s < size && wc[s] != DOT; s++) tb.add(wc[s]); return tb.finish(); } /** * Checks if the wildcard can match a sub-string in a string. * @param t token to search for match * @return {@code true} if a match is found */ public boolean match(final byte[] t) { return match(cps(t), 0, 0); } /** * Checks if the wildcard can match a sub-string in a string. * @param t token to search for match * @param tp input position * @param qp query position * @return {@code true} if a match is found */ private boolean match(final int[] t, final int tp, final int qp) { int qi = qp; int ti = tp; final int tl = t.length; while(qi < size) { if(wc[qi] == DOT) { int n = min[qi]; final int m = max[qi++]; // recursively evaluates wildcards (non-greedy) while(!match(t, ti + n, qi)) if(ti + ++n > tl) return false; if(n > m) return false; ti += n; } else { if(ti >= tl || t[ti++] != wc[qi++]) return false; } } return ti == tl; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/ft/FTWindow.java000066400000000000000000000064531222453003200253310ustar00rootroot00000000000000package org.basex.query.ft; import org.basex.data.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.util.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.ft.*; import org.basex.util.hash.*; /** * FTWindow expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FTWindow extends FTFilter { /** Window. */ private Expr win; /** * Constructor. * @param ii input info * @param e expression * @param w window * @param u unit */ public FTWindow(final InputInfo ii, final FTExpr e, final Expr w, final FTUnit u) { super(ii, e); win = w; unit = u; } @Override public void checkUp() throws QueryException { checkNoUp(win); super.checkUp(); } @Override public FTExpr compile(final QueryContext ctx, final VarScope scp) throws QueryException { win = win.compile(ctx, scp); return super.compile(ctx, scp); } @Override protected boolean filter(final QueryContext ctx, final FTMatch mtc, final FTLexer lex) throws QueryException { final int n = (int) checkItr(win, ctx) - 1; mtc.sort(); FTStringMatch f = null; for(final FTStringMatch m : mtc) { if(m.ex) continue; if(f == null) f = m; f.g |= m.e - f.e > 1; f.e = m.e; if(pos(f.e, lex) - pos(f.s, lex) > n) return false; } if(f == null) return false; final int w = n - pos(f.e, lex) + pos(f.s, lex); for(int s = pos(f.s, lex) - w; s <= pos(f.s, lex); ++s) { boolean h = false; for(final FTStringMatch m : mtc) { h = m.ex && pos(m.s, lex) >= s && pos(m.e, lex) <= s + w; if(h) break; } if(!h) { mtc.reset(); mtc.add(f); return true; } } return false; } @Override public boolean has(final Flag flag) { return win.has(flag) || super.has(flag); } @Override public boolean removable(final Var v) { return win.removable(v) && super.removable(v); } @Override public VarUsage count(final Var v) { return win.count(v).plus(super.count(v)); } @Override public FTExpr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { final boolean ex = inlineAll(ctx, scp, expr, v, e); final Expr w = win.inline(ctx, scp, v, e); if(w != null) win = w; return ex || w != null ? optimize(ctx, scp) : null; } @Override public FTExpr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new FTWindow(info, expr[0].copy(ctx, scp, vs), win.copy(ctx, scp, vs), unit); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(QueryText.WINDOW, unit), win, expr); } @Override public String toString() { return super.toString() + QueryText.WINDOW + ' ' + win + ' ' + unit; } @Override public boolean accept(final ASTVisitor visitor) { return super.accept(visitor) && win.accept(visitor); } @Override public int exprSize() { int sz = 1; for(final FTExpr e : expr) sz += e.exprSize(); return sz + win.exprSize(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/ft/FTWords.java000066400000000000000000000345641222453003200251640ustar00rootroot00000000000000package org.basex.query.ft; import static org.basex.query.QueryText.*; import static org.basex.util.ft.FTFlag.*; import org.basex.core.*; import org.basex.data.*; import org.basex.index.query.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.ft.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * FTWords expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FTWords extends FTExpr { /** All matches. */ FTMatches matches = new FTMatches(0); /** Flag for first evaluation. */ boolean first; /** Search mode; default: {@link FTMode#ANY}. */ FTMode mode = FTMode.ANY; /** Query expression. */ Expr query; /** Minimum and maximum occurrences. */ Expr[] occ; /** Full-text tokenizer. */ private FTTokenizer ftt; /** Data reference. */ private IndexContext ictx; /** Single string. */ private TokenList txt; /** Current token number. */ private int tokNum; /** Fast evaluation. */ private boolean fast; /** * Constructor for scan-based evaluation. * @param ii input info * @param e expression * @param m search mode * @param o occurrences */ public FTWords(final InputInfo ii, final Expr e, final FTMode m, final Expr[] o) { super(ii); query = e; mode = m; occ = o; } /** * Constructor for index-based evaluation. * @param ii input info * @param ic index context * @param t query terms * @param m search mode * @param ctx query context * @throws QueryException query exception */ public FTWords(final InputInfo ii, final IndexContext ic, final Value t, final FTMode m, final QueryContext ctx) throws QueryException { super(ii); query = t; mode = m; ictx = ic; compile(ctx, null); } @Override public void checkUp() throws QueryException { checkNoneUp(occ); checkNoUp(query); } @Override public FTWords compile(final QueryContext ctx, final VarScope scp) throws QueryException { if(occ != null) for(int o = 0; o < occ.length; ++o) occ[o] = occ[o].compile(ctx, scp); // compile only once if(txt == null) { query = query.compile(ctx, scp); if(query.isValue()) txt = tokens(ctx); // choose fast evaluation for default settings fast = mode == FTMode.ANY && txt != null && occ == null; if(ftt == null) ftt = new FTTokenizer(this, ctx.ftOpt(), ctx.context.prop.num(Prop.LSERROR)); } return this; } @Override public FTNode item(final QueryContext ctx, final InputInfo ii) throws QueryException { if(tokNum == 0) tokNum = ++ctx.ftoknum; matches.reset(tokNum); final int c = contains(ctx); if(c == 0) matches.size(0); // scoring: include number of tokens for calculations return new FTNode(matches, c == 0 ? 0 : Scoring.word(c, ctx.fttoken.count())); } @Override public FTIter iter(final QueryContext ctx) { final Data data = ictx.data; return new FTIter() { /** Index iterator. */ FTIndexIterator iat; /** Text length. */ int len; @Override public FTNode next() throws QueryException { if(iat == null) { final FTLexer lex = new FTLexer(ftt.opt); // index iterator tree FTIndexIterator ia; // number of distinct tokens int t = 0; // loop through unique tokens final TokenSet ts = unique(txt != null ? txt : tokens(ctx)); for(final byte[] k : ts) { lex.init(k); ia = null; int d = 0; if(!lex.hasNext()) return null; do { final byte[] tok = lex.nextToken(); t += tok.length; if(ftt.opt.sw != null && ftt.opt.sw.contains(tok)) { ++d; } else { final FTIndexIterator ir = lex.get().length > data.meta.maxlen ? scan(lex) : (FTIndexIterator) data.iter(lex); if(ia == null) { ia = ir; } else { ia = FTIndexIterator.intersect(ia, ir, ++d); d = 0; } } } while(lex.hasNext()); // create or combine iterator if(iat == null) { len = t; iat = ia; } else if(mode == FTMode.ALL || mode == FTMode.ALL_WORDS) { if(ia.size() == 0) return null; len += t; iat = FTIndexIterator.intersect(ia, iat, 0); } else { if(ia.size() == 0) continue; len = Math.max(t, len); iat = FTIndexIterator.union(ia, iat); } iat.tokenNum(++ctx.ftoknum); } } // [CG] XQuery, Full-Text: check scoring in index-based model return iat == null || !iat.more() ? null : new FTNode(iat.matches(), data, iat.next(), len, iat.size(), -1); } }; } /** * Returns scan-based iterator. * @param lex lexer, including the queried value * @return node iterator * @throws QueryException query exception */ FTIndexIterator scan(final FTLexer lex) throws QueryException { final Data data = ictx.data; final FTLexer intok = new FTLexer(ftt.opt); final FTTokens qtok = ftt.cache(lex.get()); return new FTIndexIterator() { int pre = -1; @Override public int next() { return pre; } @Override public boolean more() { while(++pre < data.meta.size) { if(data.kind(pre) != Data.TEXT) continue; intok.init(data.text(pre, true)); matches.reset(0); try { if(ftt.contains(qtok, intok) != 0) return true; } catch(final QueryException ex) { // ignore exceptions } } return false; } @Override public FTMatches matches() { return matches; } @Override public int size() { // worst case return data.meta.size >>> 1; } }; } /** * Returns all tokens of the query. * @param ctx query context * @return token list * @throws QueryException query exception */ TokenList tokens(final QueryContext ctx) throws QueryException { final TokenList tl = new TokenList(); final Iter ir = ctx.iter(query); for(byte[] qu; (qu = nextToken(ir)) != null;) { // skip empty tokens if not all results are needed if(qu.length != 0 || mode == FTMode.ALL || mode == FTMode.ALL_WORDS) tl.add(qu); } return tl; } /** * Evaluates the full-text match. * @param ctx query context * @return number of tokens, used for scoring * @throws QueryException query exception */ private int contains(final QueryContext ctx) throws QueryException { first = true; final FTLexer lexer = ftt.lexer(ctx.fttoken); // use faster evaluation for default options int num = 0; if(fast) { for(final byte[] t : txt) { final FTTokens qtok = ftt.cache(t); num = Math.max(num, ftt.contains(qtok, lexer) * qtok.length()); } return num; } // find and count all occurrences final boolean all = mode == FTMode.ALL || mode == FTMode.ALL_WORDS; int oc = 0; for(final byte[] w : unique(tokens(ctx))) { final FTTokens qtok = ftt.cache(w); final int o = ftt.contains(qtok, lexer); if(all && o == 0) return 0; num = Math.max(num, o * qtok.length()); oc += o; } // check if occurrences are in valid range. if yes, return number of tokens final long mn = occ != null ? checkItr(occ[0], ctx) : 1; final long mx = occ != null ? checkItr(occ[1], ctx) : Long.MAX_VALUE; if(mn == 0 && oc == 0) matches = FTNot.not(matches); return oc >= mn && oc <= mx ? Math.max(1, num) : 0; } /** * Caches and returns all unique tokens specified in a query. * @param list token list * @return token set */ TokenSet unique(final TokenList list) { // cache all query tokens in a set (duplicates are removed) final TokenSet ts = new TokenSet(); switch(mode) { case ALL: case ANY: for(final byte[] t : list) ts.add(t); break; case ALL_WORDS: case ANY_WORD: final FTLexer l = new FTLexer(ftt.opt); for(final byte[] t : list) { l.init(t); while(l.hasNext()) ts.add(l.nextToken()); } break; case PHRASE: final TokenBuilder tb = new TokenBuilder(); for(final byte[] t : list) tb.add(t).add(' '); ts.add(tb.trim().finish()); } return ts; } /** * Returns the next token of the specified iterator, or {@code null}. * @param iter iterator to be checked * @return item * @throws QueryException query exception */ byte[] nextToken(final Iter iter) throws QueryException { final Item it = iter.next(); return it == null ? null : checkEStr(it); } /** * Adds a match. * @param s start position * @param e end position */ void add(final int s, final int e) { if(!first && (mode == FTMode.ALL || mode == FTMode.ALL_WORDS)) matches.and(s, e); else matches.or(s, e); } @Override public boolean indexAccessible(final IndexCosts ic) { /* If the following conditions yield true, the index is accessed: * - all query terms are statically available * - no FTTimes option is specified * - explicitly set case, diacritics and stemming match options do not * conflict with index options. */ final Data dt = ic.ictx.data; final MetaData md = dt.meta; final FTOpt fto = ftt.opt; /* Index will be applied if no explicit match options have been set * that conflict with the index options. As a consequence, though, index- * based querying might yield other results than sequential scanning. */ if(occ != null || fto.isSet(CS) && md.casesens != fto.is(CS) || fto.isSet(DC) && md.diacritics != fto.is(DC) || fto.isSet(ST) && md.stemming != fto.is(ST) || fto.ln != null && !fto.ln.equals(md.language)) return false; // estimate costs if text is not statically known if(txt == null) { ic.costs(Math.max(1, dt.meta.size >> 10)); return true; } // adopt database options to tokenizer fto.copy(md); // summarize number of hits; break loop if no hits are expected final FTLexer ft = new FTLexer(fto); ic.costs(0); for(byte[] t : txt) { ft.init(t); while(ft.hasNext()) { final byte[] tok = ft.nextToken(); if(fto.sw != null && fto.sw.contains(tok)) continue; if(fto.is(WC)) { // don't use index if one of the terms starts with a wildcard t = ft.get(); if(t[0] == '.') return false; // don't use index if certain characters or more than 1 dot are found int d = 0; for(final byte w : t) { if(w == '{' || w == '\\' || w == '.' && ++d > 1) return false; } } // reduce number of expected results to favor full-text index requests ic.addCosts(Math.max(1, dt.count(ft) >> 10)); } } return true; } @Override public FTExpr indexEquivalent(final IndexCosts ic) { ictx = ic.ictx; return this; } @Override public boolean usesExclude() { return occ != null; } @Override public boolean has(final Flag flag) { if(occ != null) for(final Expr o : occ) if(o.has(flag)) return true; return query.has(flag); } @Override public boolean removable(final Var v) { if(occ != null) for(final Expr o : occ) if(!o.removable(v)) return false; return query.removable(v); } @Override public VarUsage count(final Var v) { return occ != null ? VarUsage.sum(v, occ).plus(query.count(v)) : query.count(v); } @Override public FTExpr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { boolean change = occ != null && inlineAll(ctx, scp, occ, v, e); final Expr q = query.inline(ctx, scp, v, e); if(q != null) { query = q; change = true; } return change ? optimize(ctx, scp) : null; } @Override public FTExpr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final FTWords ftw = new FTWords(info, query.copy(ctx, scp, vs), mode, occ == null ? null : Arr.copyAll(ctx, scp, vs, occ)); if(ftt != null) ftw.ftt = ftt.copy(ftw); if(matches != null) ftw.matches = matches.copy(); if(txt != null) ftw.txt = txt.copy(); ftw.ictx = ictx; ftw.first = first; ftw.tokNum = tokNum; ftw.fast = fast; return ftw; } @Override public void plan(final FElem plan) { addPlan(plan, planElem(), occ, query); } @Override public String toString() { final StringBuilder sb = new StringBuilder(); final boolean str = query instanceof AStr; if(!str) sb.append("{ "); sb.append(query); if(!str) sb.append(" }"); switch(mode) { case ALL: sb.append(' ' + ALL); break; case ALL_WORDS: sb.append(' ' + ALL + ' ' + WORDS); break; case ANY_WORD: sb.append(' ' + ANY + ' ' + WORD); break; case PHRASE: sb.append(' ' + PHRASE); break; default: } if(occ != null) { sb.append(OCCURS + ' ' + occ[0] + ' ' + TO + ' ' + occ[1] + ' ' + TIMES); } return sb.toString(); } @Override public boolean accept(final ASTVisitor visitor) { return super.accept(visitor) && query.accept(visitor) && (occ == null || visitAll(visitor, occ)); } @Override public int exprSize() { int sz = 1; if(occ != null) for(final Expr o : occ) sz += o.exprSize(); for(final Expr e : expr) sz += e.exprSize(); return sz + query.exprSize(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/ft/ThesQuery.java000066400000000000000000000023341222453003200255530ustar00rootroot00000000000000package org.basex.query.ft; import java.util.*; import org.basex.query.*; import org.basex.util.*; import org.basex.util.list.*; /** * Simple Thesaurus entry for full-text requests. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ThesQuery { /** Thesaurus root references. */ private final ArrayList thes = new ArrayList(1); /** * Adds two thesaurus definitions. * @param th second thesaurus */ public void add(final Thesaurus th) { thes.add(th); } /** * Merges two thesaurus definitions. * @param th second thesaurus */ public void merge(final ThesQuery th) { for(final Thesaurus t : th.thes) { boolean f = false; for(final Thesaurus tt : thes) f |= tt.sameAs(t); if(!f) thes.add(t); } } /** * Finds a thesaurus term. * @param ii input info * @param ft token * @return result list * @throws QueryException query exception */ byte[][] find(final InputInfo ii, final byte[] ft) throws QueryException { final TokenList tl = new TokenList(); for(final Thesaurus th : thes) th.find(ii, tl, ft); return tl.toArray(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/ft/Thesaurus.java000066400000000000000000000135271222453003200256130ustar00rootroot00000000000000package org.basex.query.ft; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.io.*; import org.basex.build.*; import org.basex.core.*; import org.basex.data.*; import org.basex.io.*; import org.basex.query.*; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * Simple Thesaurus for full-text requests. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Thesaurus { /** Thesaurus root references. */ private final TokenObjMap nodes = new TokenObjMap(); /** Relationships. */ private static final TokenMap RSHIPS = new TokenMap(); /** Database properties. */ private final Context ctx; static { RSHIPS.put("NT", "BT"); RSHIPS.put("BT", "BT"); RSHIPS.put("BTG", "NTG"); RSHIPS.put("NTG", "BTG"); RSHIPS.put("BTP", "NTP"); RSHIPS.put("NTP", "BTP"); RSHIPS.put("USE", "UF"); RSHIPS.put("UF", "USE"); RSHIPS.put("RT", "RT"); } /** Thesaurus node. */ static class ThesNode { /** Related nodes. */ ThesNode[] nodes = new ThesNode[1]; /** Relationships. */ byte[][] rs = new byte[1][]; /** Term. */ byte[] term; /** Entries. */ int size; /** * Adds a relationship to the node. * @param n target node * @param r relationship */ void add(final ThesNode n, final byte[] r) { if(size == nodes.length) { final int s = Array.newSize(size); nodes = Array.copy(nodes, new ThesNode[s]); rs = Array.copyOf(rs, s); } nodes[size] = n; rs[size++] = r; } } /** Input file. */ private final IO file; /** Relationship. */ private final byte[] rel; /** Minimum level. */ private final long min; /** Maximum level. */ private final long max; /** * Constructor. * @param fl file reference * @param c database context */ public Thesaurus(final IO fl, final Context c) { this(fl, EMPTY, 0, Long.MAX_VALUE, c); } /** * Reads a thesaurus file. * @param fl file reference * @param rs relationship * @param mn minimum level * @param mx maximum level * @param c database context */ public Thesaurus(final IO fl, final byte[] rs, final long mn, final long mx, final Context c) { file = fl; rel = rs; min = mn; max = mx; ctx = c; } /** * Initializes the thesaurus. * @param ii input info * @throws QueryException query exception */ private void init(final InputInfo ii) throws QueryException { try { final Data data = MemBuilder.build(Parser.xmlParser(file, ctx.prop)); final Nodes result = nodes("//*:entry", new Nodes(0, data)); for(int n = 0; n < result.size(); ++n) { build(new Nodes(result.pres[n], data)); } } catch(final IOException ex) { NOTHES.thrw(ii, file); } } /** * Builds the thesaurus. * @param in input nodes * @throws QueryException query exception */ private void build(final Nodes in) throws QueryException { final Nodes sub = nodes("*:synonym", in); if(sub.size() == 0) return; final ThesNode node = node(text("*:term", in)); for(int n = 0; n < sub.size(); ++n) { final Nodes tmp = new Nodes(sub.pres[n], sub.data); final ThesNode snode = node(text("*:term", tmp)); final byte[] rs = text("*:relationship", tmp); node.add(snode, rs); final byte[] srs = RSHIPS.get(rs); if(srs != null) snode.add(node, srs); build(sub); } } /** * Returns a node for the specified term. * @param term term * @return node */ private ThesNode node(final byte[] term) { ThesNode node = nodes.get(term); if(node == null) { node = new ThesNode(); node.term = term; nodes.put(term, node); } return node; } /** * Performs a query and returns the result as nodes. * @param query query string * @param in input nodes * @return resulting nodes * @throws QueryException query exception */ private Nodes nodes(final String query, final Nodes in) throws QueryException { return new QueryProcessor(query, ctx).context(in).queryNodes(); } /** * Performs a query and returns the first result as text. * @param query query string * @param in input nodes * @return resulting text * @throws QueryException query exception */ private byte[] text(final String query, final Nodes in) throws QueryException { return new QueryProcessor(query, ctx).context(in).iter().next().string(null); } /** * Finds a thesaurus term. * @param ii input info * @param list result list * @param ft token * @throws QueryException query exception */ void find(final InputInfo ii, final TokenList list, final byte[] ft) throws QueryException { if(nodes.size() == 0) init(ii); find(list, nodes.get(ft), 1); } /** * Recursively collects relevant thesaurus terms. * @param list result list * @param node input node * @param lev current level */ private void find(final TokenList list, final ThesNode node, final long lev) { if(lev > max || node == null) return; for(int n = 0; n < node.size; ++n) { if(rel.length == 0 || eq(node.rs[n], rel)) { final byte[] term = node.nodes[n].term; if(!list.contains(term)) { list.add(term); find(list, node.nodes[n], lev + 1); } } } } /** * Compares two thesaurus instances. * @param th instance to be compared * @return result of check */ boolean sameAs(final Thesaurus th) { return file.eq(th.file) && min == th.min && max == th.max && eq(rel, th.rel); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/ft/package.html000066400000000000000000000000601222453003200252320ustar00rootroot00000000000000 XQuery Full Text expressions. basex-7.7.2/basex-core/src/main/java/org/basex/query/func/000077500000000000000000000000001222453003200232775ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/func/DynFuncCall.java000066400000000000000000000055451222453003200263150ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.util.Err.*; import java.util.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.map.Map; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Dynamic function call. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class DynFuncCall extends FuncCall { /** * Function constructor. * @param ii input info * @param fun function expression * @param arg arguments */ public DynFuncCall(final InputInfo ii, final Expr fun, final Expr[] arg) { super(ii, Array.add(arg, fun)); } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { super.compile(ctx, scp); final int ar = expr.length - 1; final Expr f = expr[ar]; final Type t = f.type().type; if(t instanceof FuncType) { final FuncType ft = (FuncType) t; if(ft.args != null && ft.args.length != ar) INVARITY.thrw(info, f, ar); if(ft.type != null) type = ft.type; } // maps can only contain fully evaluated Values, so this is safe return allAreValues() && f instanceof Map ? optPre(value(ctx), ctx) : this; } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final Expr[] copy = copyAll(ctx, scp, vs, expr); final int last = copy.length - 1; return copyType(new DynFuncCall(info, copy[last], Arrays.copyOf(copy, last))); } @Override public void plan(final FElem plan) { final FElem el = planElem(QueryText.TCL, tailCall); final int es = expr.length; addPlan(plan, el, expr[es - 1]); for(int e = 0; e < es - 1; e++) expr[e].plan(el); } @Override public String description() { return expr[expr.length - 1].description() + "(...)"; } @Override public String toString() { final int es = expr.length; final TokenBuilder tb = new TokenBuilder(expr[es - 1].toString()).add('('); for(int e = 0; e < es - 1; e++) { tb.add(expr[e].toString()); if(e < es - 2) tb.add(", "); } return tb.add(')').toString(); } @Override FItem evalFunc(final QueryContext ctx) throws QueryException { final int ar = expr.length - 1; final Item it = checkItem(expr[ar], ctx); if(!(it instanceof FItem)) INVCAST.thrw(info, it.type, "function item"); final FItem fit = (FItem) it; if(fit.arity() != ar) INVARITY.thrw(info, fit, ar); return fit; } @Override Value[] evalArgs(final QueryContext ctx) throws QueryException { final int al = expr.length - 1; final Value[] args = new Value[al]; for(int a = 0; a < al; ++a) args[a] = ctx.value(expr[a]); return args; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNAcc.java000066400000000000000000000060311222453003200250540ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.func.Function.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import org.basex.core.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Accessor functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNAcc extends StandardFunc { /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNAcc(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { final Expr e = expr.length != 0 ? expr[0] : checkCtx(ctx); switch(sig) { case POSITION: return Int.get(ctx.pos); case LAST: return Int.get(ctx.size); case STRING: return string(e, ii, ctx); case NUMBER: return number(ctx.iter(e), ctx); case STRING_LENGTH: return Int.get(len(checkEStr(expr.length == 0 ? string(e, ii, ctx) : e, ctx))); case NORMALIZE_SPACE: return Str.get(norm(checkEStr(e, ctx))); case NAMESPACE_URI_FROM_QNAME: final Item it = e.item(ctx, info); return it == null ? null : Uri.uri(checkQNm(it, ctx).uri()); default: return super.item(ctx, ii); } } /** * Converts the specified item to a string. * @param e expression * @param ii input info * @param ctx query context * @return double iterator * @throws QueryException query exception */ private Item string(final Expr e, final InputInfo ii, final QueryContext ctx) throws QueryException { final Item it = e.item(ctx, info); if(it == null) return Str.ZERO; if(it instanceof FItem) FISTR.thrw(ii, this); return it.type == AtomType.STR ? it : Str.get(it.string(ii)); } /** * Converts the specified item to a double. * @param ir iterator * @param ctx query context * @return double iterator * @throws QueryException query exception */ private Item number(final Iter ir, final QueryContext ctx) throws QueryException { final Item it = ir.next(); if(it == null || ir.next() != null) return Dbl.NAN; if(it instanceof FItem) FIATOM.thrw(info, this); try { return it.type == AtomType.DBL ? it : AtomType.DBL.cast(it, ctx, info); } catch(final QueryException ex) { return Dbl.NAN; } } @Override public boolean has(final Flag flag) { return flag == Flag.CTX && expr.length == 0 || super.has(flag); } @Override public boolean accept(final ASTVisitor visitor) { if(!oneOf(sig, POSITION, LAST) && 0 == expr.length && !visitor.lock(DBLocking.CTX)) return false; return super.accept(visitor); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNAdmin.java000066400000000000000000000121271222453003200254210ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.func.Function.*; import static org.basex.query.util.Err.*; import java.io.*; import java.util.*; import org.basex.core.*; import org.basex.data.*; import org.basex.io.*; import org.basex.io.in.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.node.*; import org.basex.server.*; import org.basex.util.*; /** * Admin functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNAdmin extends StandardFunc { /** QName: user. */ private static final String USER = "user"; /** QName: user. */ private static final String DATABASE = "database"; /** QName: user. */ private static final String SESSION = "session"; /** QName: permission. */ private static final String PERMISSION = "permission"; /** QName: entry. */ private static final String ENTRY = "entry"; /** Size element name. */ private static final String SIZE = "size"; /** QName: date. */ private static final String DATE = "date"; /** QName: time. */ private static final String TIME = "time"; /** QName: address. */ private static final String ADDRESS = "address"; /** QName: file. */ private static final String FILE = "file"; /** QName: type. */ private static final String TYPE = "type"; /** QName: ms. */ private static final String MS = "ms"; /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNAdmin(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Iter iter(final QueryContext ctx) throws QueryException { checkAdmin(ctx); switch(sig) { case _ADMIN_LOGS: return logs(ctx); case _ADMIN_USERS: return users(ctx); case _ADMIN_SESSIONS: return sessions(ctx); default: return super.iter(ctx); } } /** * Lists all log files. * @param ctx query context * @return users * @throws QueryException query exception */ private Iter logs(final QueryContext ctx) throws QueryException { final ValueBuilder vb = new ValueBuilder(); if(expr.length == 0) { // return list of all log files for(final IOFile f : ctx.context.log.files()) { final String date = f.name().replace(IO.LOGSUFFIX, ""); vb.add(new FElem(FILE).add(DATE, date).add(SIZE, Token.token(f.length()))); } } else { // return log file contents final String name = Token.string(checkStr(expr[0], ctx)) + IO.LOGSUFFIX; final IOFile file = new IOFile(ctx.context.log.dir(), name); if(file.exists()) { try { final NewlineInput nli = new NewlineInput(file); try { for(String l; (l = nli.readLine()) != null;) { final FElem elem = new FElem(ENTRY); final String[] cols = l.split("\t"); if(cols.length > 2 && (cols[1].matches(".*:\\d+") || cols[1].equals(Log.SERVER))) { // new format (more specific) elem.add(TIME, cols[0]).add(ADDRESS, cols[1]).add(USER, cols[2]); if(cols.length > 3) elem.add(TYPE, cols[3].toLowerCase(Locale.ENGLISH)); if(cols.length > 4) elem.add(cols[4]); if(cols.length > 5) elem.add(MS, cols[5].replace(" ms", "")); } else { elem.add(l); } vb.add(elem); } } finally { nli.close(); } } catch(final IOException ex) { IOERR.thrw(info, ex); } } } return vb; } /** * Lists all registered users. * @param ctx query context * @return users * @throws QueryException query exception */ private Iter users(final QueryContext ctx) throws QueryException { final ValueBuilder vb = new ValueBuilder(); for(final User u : expr.length == 0 ? ctx.context.users.users(null) : checkData(ctx).meta.users.users(ctx.context.users)) { vb.add(new FElem(USER).add(u.name).add(PERMISSION, u.perm.toString().toLowerCase(Locale.ENGLISH))); } return vb; } /** * Lists all open sessions. * @param ctx query context * @return users */ private static Iter sessions(final QueryContext ctx) { final ValueBuilder vb = new ValueBuilder(); synchronized(ctx.context.sessions) { for(final ClientListener sp : ctx.context.sessions) { final String user = sp.context().user.name; final String addr = sp.address(); final Data data = sp.context().data(); final FElem elem = new FElem(SESSION).add(USER, user).add(ADDRESS, addr); if(data != null) elem.add(DATABASE, data.meta.name); vb.add(elem); } } return vb; } @Override public boolean accept(final ASTVisitor visitor) { if(oneOf(sig, _ADMIN_USERS, _ADMIN_SESSIONS) && !visitor.lock(DBLocking.ADMIN)) return false; if(sig == _ADMIN_USERS && expr.length > 0 && !dataLock(visitor)) return false; return super.accept(visitor); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNAggr.java000066400000000000000000000123051222453003200252470ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.util.Err.*; import static org.basex.query.value.type.AtomType.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.expr.CmpV.OpV; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; /** * Aggregating functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNAggr extends StandardFunc { /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNAggr(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { final Iter iter = ctx.iter(expr[0]); switch(sig) { case COUNT: long c = iter.size(); if(c == -1) { do { ctx.checkStop(); ++c; } while(iter.next() != null); } return Int.get(c); case MIN: return minmax(iter, OpV.GT, ctx); case MAX: return minmax(iter, OpV.LT, ctx); case SUM: Item it = iter.next(); return it != null ? sum(iter, it, false) : expr.length == 2 ? expr[1].item(ctx, info) : Int.get(0); case AVG: it = iter.next(); return it == null ? null : sum(iter, it, true); default: return super.item(ctx, ii); } } @Override protected Expr opt(final QueryContext ctx) throws QueryException { // skip non-deterministic and variable expressions final Expr e = expr[0]; if(e.has(Flag.NDT) || e instanceof VarRef) return this; final long c = e.size(); switch(sig) { case COUNT: return c >= 0 ? Int.get(c) : this; case SUM: return c == 0 ? expr.length == 2 ? expr[1] : Int.get(0) : this; default: return this; } } /** * Sums up the specified item(s). * @param iter iterator * @param it first item * @param avg calculate average * @return summed up item * @throws QueryException query exception */ private Item sum(final Iter iter, final Item it, final boolean avg) throws QueryException { Item rs = it.type.isUntyped() ? Dbl.get(it.string(info), info) : it; final boolean n = rs instanceof ANum; final boolean dtd = !n && rs.type == AtomType.DTD; final boolean ymd = !n && !dtd && rs.type == AtomType.YMD; if(!n && (!(rs instanceof Dur) || rs.type == DUR)) SUMTYPE.thrw(info, this, rs.type); int c = 1; for(Item i; (i = iter.next()) != null;) { if(i.type.isNumberOrUntyped()) { if(!n) FUNDUR.thrw(info, this, i.type); } else { if(n) FUNNUM.thrw(info, this, i.type); if(dtd && i.type != AtomType.DTD || ymd && i.type != AtomType.YMD) FUNCMP.thrw(info, this, it.type, i.type); } rs = Calc.PLUS.ev(info, rs, i); ++c; } return avg ? Calc.DIV.ev(info, rs, Int.get(c)) : rs; } /** * Returns a minimum or maximum item. * @param iter values to be compared * @param cmp comparator * @param ctx query context * @return resulting item * @throws QueryException query exception */ private Item minmax(final Iter iter, final OpV cmp, final QueryContext ctx) throws QueryException { final Collation coll = checkColl(expr.length == 2 ? expr[1] : null, ctx); Item rs = iter.next(); if(rs == null) return null; // check if first item is comparable cmp.eval(rs, rs, coll, info); // strings if(rs instanceof AStr) { for(Item it; (it = iter.next()) != null;) { if(!(it instanceof AStr)) FUNCMP.thrw(info, this, rs.type, it.type); if(cmp.eval(rs, it, coll, info)) rs = it; } return rs; } // dates, durations and booleans if(rs instanceof ADate || rs instanceof Dur || rs.type == AtomType.BLN) { for(Item it; (it = iter.next()) != null;) { if(rs.type != it.type) FUNCMP.thrw(info, this, rs.type, it.type); if(cmp.eval(rs, it, coll, info)) rs = it; } return rs; } // numbers if(rs.type.isUntyped()) rs = DBL.cast(rs, ctx, info); for(Item it; (it = iter.next()) != null;) { final Type t = numType(rs, it); if(cmp.eval(rs, it, coll, info) || Double.isNaN(it.dbl(info))) rs = it; if(rs.type != t) rs = (Item) t.cast(rs, ctx, info); } return rs; } /** * Returns the numeric type with the highest precedence. * @param r result item * @param i new item * @return result * @throws QueryException query exception */ private Type numType(final Item r, final Item i) throws QueryException { final Type tr = r.type, ti = i.type; if(ti.isUntyped()) return DBL; if(!(i instanceof ANum)) FUNCMP.thrw(info, this, tr, ti); if(tr == ti) return tr; if(tr == DBL || ti == DBL) return DBL; if(tr == FLT || ti == FLT) return FLT; if(tr == DEC || ti == DEC) return DEC; return ITR; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNArchive.java000066400000000000000000000372421222453003200257570ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.io.*; import java.nio.charset.*; import java.util.*; import java.util.zip.*; import org.basex.core.*; import org.basex.io.*; import org.basex.io.in.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.path.*; import org.basex.query.util.archive.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * Functions on archives. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNArchive extends StandardFunc { /** Module prefix. */ private static final String PREFIX = "archive"; /** QName. */ private static final QNm Q_ENTRY = QNm.get(PREFIX, "entry", ARCHIVEURI); /** QName. */ private static final QNm Q_OPTIONS = QNm.get(PREFIX, "options", ARCHIVEURI); /** QName. */ private static final QNm Q_FORMAT = QNm.get(PREFIX, "format", ARCHIVEURI); /** QName. */ private static final QNm Q_ALGORITHM = QNm.get(PREFIX, "algorithm", ARCHIVEURI); /** Root node test. */ private static final NodeTest TEST = new NodeTest(Q_ENTRY); /** Level. */ private static final String LEVEL = "compression-level"; /** Encoding. */ private static final String ENCODING = "encoding"; /** Last modified. */ private static final String LAST_MOD = "last-modified"; /** Compressed size. */ private static final String COMP_SIZE = "compressed-size"; /** Uncompressed size. */ private static final String SIZE = "size"; /** Value. */ private static final String VALUE = "value"; /** Option: format. */ private static final byte[] FORMAT = token("format"); /** Option: algorithm. */ private static final byte[] ALGORITHM = token("algorithm"); /** Option: algorithm: deflate. */ private static final byte[] DEFLATE = token("deflate"); /** Option: algorithm: stored. */ private static final byte[] STORED = token("stored"); /** Option: algorithm: unknown. */ private static final byte[] UNKNOWN = token("unknown"); /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNArchive(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Iter iter(final QueryContext ctx) throws QueryException { switch(sig) { case _ARCHIVE_ENTRIES: return entries(ctx); case _ARCHIVE_EXTRACT_TEXT: return extractText(ctx); case _ARCHIVE_EXTRACT_BINARY: return extractBinary(ctx); default: return super.iter(ctx); } } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { checkCreate(ctx); switch(sig) { case _ARCHIVE_CREATE: return create(ctx); case _ARCHIVE_UPDATE: return update(ctx); case _ARCHIVE_DELETE: return delete(ctx); case _ARCHIVE_OPTIONS: return options(ctx); case _ARCHIVE_WRITE: return write(ctx); default: return super.item(ctx, ii); } } /** * Creates a new archive. * @param ctx query context * @return archive * @throws QueryException query exception */ private B64 create(final QueryContext ctx) throws QueryException { final Iter entr = ctx.iter(expr[0]); final Iter cont = ctx.iter(expr[1]); final Item opt = expr.length > 2 ? expr[2].item(ctx, info) : null; final TokenMap map = new FuncParams(Q_OPTIONS, info).parse(opt); final byte[] f = map.get(FORMAT); final String format = f != null ? string(lc(f)) : "zip"; final ArchiveOut out = ArchiveOut.get(format, info); // check algorithm final byte[] alg = map.get(ALGORITHM); int level = ZipEntry.DEFLATED; if(alg != null) { if(format.equals("zip") && !eq(alg, STORED, DEFLATE) || format.equals("gzip") && !eq(alg, DEFLATE)) { ARCH_SUPP.thrw(info, ALGORITHM, alg); } if(eq(alg, STORED)) level = ZipEntry.STORED; else if(eq(alg, DEFLATE)) level = ZipEntry.DEFLATED; } out.level(level); try { int e = 0; int c = 0; Item en, cn; while(true) { en = entr.next(); cn = cont.next(); if(en == null || cn == null) break; if(out instanceof GZIPOut && c > 0) ARCH_ONE.thrw(info, format.toUpperCase(Locale.ENGLISH)); add(checkElmStr(en), cn, out, level, ctx); e++; c++; } // count remaining entries if(cn != null) do c++; while(cont.next() != null); if(en != null) do e++; while(entr.next() != null); if(e != c) throw ARCH_DIFF.thrw(info, e, c); } catch(final IOException ex) { throw ARCH_FAIL.thrw(info, ex); } finally { out.close(); } return new B64(out.toArray()); } /** * Returns the options of an archive. * @param ctx query context * @return entries * @throws QueryException query exception */ private FElem options(final QueryContext ctx) throws QueryException { final B64 archive = (B64) checkType(checkItem(expr[0], ctx), AtomType.B64); String format = null; int level = -1; final ArchiveIn arch = ArchiveIn.get(archive.input(info), info); try { format = arch.format(); while(arch.more()) { final ZipEntry ze = arch.entry(); if(ze.isDirectory()) continue; level = ze.getMethod(); break; } } catch(final IOException ex) { ARCH_FAIL.thrw(info, ex); } finally { arch.close(); } // create result element final FElem e = new FElem(Q_OPTIONS).declareNS(); if(format != null) e.add(new FElem(Q_FORMAT).add(VALUE, format)); if(level >= 0) { final byte[] lvl = level == 8 ? DEFLATE : level == 0 ? STORED : UNKNOWN; e.add(new FElem(Q_ALGORITHM).add(VALUE, lvl)); } return e; } /** * Returns the entries of an archive. * @param ctx query context * @return entries * @throws QueryException query exception */ private Iter entries(final QueryContext ctx) throws QueryException { final B64 archive = (B64) checkType(checkItem(expr[0], ctx), AtomType.B64); final ValueBuilder vb = new ValueBuilder(); final ArchiveIn in = ArchiveIn.get(archive.input(info), info); try { while(in.more()) { final ZipEntry ze = in.entry(); if(ze.isDirectory()) continue; final FElem e = new FElem(Q_ENTRY).declareNS(); long s = ze.getSize(); if(s != -1) e.add(SIZE, token(s)); s = ze.getTime(); if(s != -1) e.add(LAST_MOD, new Dtm(s, info).string(info)); s = ze.getCompressedSize(); if(s != -1) e.add(COMP_SIZE, token(s)); e.add(ze.getName()); vb.add(e); } return vb; } catch(final IOException ex) { throw ARCH_FAIL.thrw(info, ex); } finally { in.close(); } } /** * Extracts text entries. * @param ctx query context * @return text entry * @throws QueryException query exception */ private ValueBuilder extractText(final QueryContext ctx) throws QueryException { final String enc = encoding(2, ARCH_ENCODING, ctx); final ValueBuilder vb = new ValueBuilder(); for(final byte[] b : extract(ctx)) vb.add(Str.get(encode(b, enc, ctx))); return vb; } /** * Extracts binary entries. * @param ctx query context * @return binary entry * @throws QueryException query exception */ private ValueBuilder extractBinary(final QueryContext ctx) throws QueryException { final ValueBuilder vb = new ValueBuilder(); for(final byte[] b : extract(ctx)) vb.add(new B64(b)); return vb; } /** * Updates an archive. * @param ctx query context * @return updated archive * @throws QueryException query exception */ private B64 update(final QueryContext ctx) throws QueryException { final B64 archive = (B64) checkType(checkItem(expr[0], ctx), AtomType.B64); // entries to be updated final TokenObjMap hm = new TokenObjMap(); final Iter entr = ctx.iter(expr[1]); final Iter cont = ctx.iter(expr[2]); int e = 0; int c = 0; Item en, cn; while(true) { en = entr.next(); cn = cont.next(); if(en == null || cn == null) break; hm.put(checkElmStr(en).string(info), new Item[] { en, cn }); e++; c++; } // count remaining entries if(cn != null) do c++; while(cont.next() != null); if(en != null) do e++; while(entr.next() != null); if(e != c) ARCH_DIFF.thrw(info, e, c); final ArchiveIn in = ArchiveIn.get(archive.input(info), info); final ArchiveOut out = ArchiveOut.get(in.format(), info); try { if(in instanceof GZIPIn) ARCH_MODIFY.thrw(info, in.format().toUpperCase(Locale.ENGLISH)); // delete entries to be updated while(in.more()) if(!hm.contains(token(in.entry().getName()))) out.write(in); // add new and updated entries for(final byte[] h : hm) { if(h == null) continue; final Item[] it = hm.get(h); add(it[0], it[1], out, ZipEntry.DEFLATED, ctx); } } catch(final IOException ex) { ARCH_FAIL.thrw(info, ex); } finally { in.close(); out.close(); } return new B64(out.toArray()); } /** * Deletes files from an archive. * @param ctx query context * @return updated archive * @throws QueryException query exception */ private B64 delete(final QueryContext ctx) throws QueryException { final B64 archive = (B64) checkType(checkItem(expr[0], ctx), AtomType.B64); // entries to be deleted final TokenObjMap hm = new TokenObjMap(); final Iter names = ctx.iter(expr[1]); for(Item en; (en = names.next()) != null;) { hm.put(checkElmStr(en).string(info), null); } final ArchiveIn in = ArchiveIn.get(archive.input(info), info); final ArchiveOut out = ArchiveOut.get(in.format(), info); try { if(in instanceof GZIPIn) ARCH_MODIFY.thrw(info, in.format().toUpperCase(Locale.ENGLISH)); while(in.more()) if(!hm.contains(token(in.entry().getName()))) out.write(in); } catch(final IOException ex) { ARCH_FAIL.thrw(info, ex); } finally { in.close(); out.close(); } return new B64(out.toArray()); } /** * Extracts entries from the archive. * @param ctx query context * @return text entries * @throws QueryException query exception */ private TokenList extract(final QueryContext ctx) throws QueryException { final B64 archive = (B64) checkType(checkItem(expr[0], ctx), AtomType.B64); final TokenSet hs = entries(1, ctx); final TokenList tl = new TokenList(); final ArchiveIn in = ArchiveIn.get(archive.input(info), info); try { while(in.more()) { final ZipEntry ze = in.entry(); if(!ze.isDirectory() && (hs == null || hs.delete(token(ze.getName())) != 0)) tl.add(in.read()); } } catch(final IOException ex) { ARCH_FAIL.thrw(info, ex); } finally { in.close(); } return tl; } /** * Writes entries from an archive to disk. * @param ctx query context * @return text entries * @throws QueryException query exception */ private Item write(final QueryContext ctx) throws QueryException { final File path = checkFile(0, ctx); final B64 archive = (B64) checkType(checkItem(expr[1], ctx), AtomType.B64); final TokenSet hs = entries(2, ctx); final ArchiveIn in = ArchiveIn.get(archive.input(info), info); try { while(in.more()) { final ZipEntry ze = in.entry(); final String name = ze.getName(); if(hs == null || hs.delete(token(name)) != 0) { final IOFile file = new IOFile(path.getPath(), name); if(ze.isDirectory()) { file.md(); } else { file.dir().md(); file.write(in.read()); } } } } catch(final IOException ex) { ARCH_FAIL.thrw(info, ex); } finally { in.close(); } return null; } /** * Returns all archive entries from the specified argument. * A {@code null} reference is returned if no entries are specified. * @param e argument index * @param ctx query context * @return set with all entries * @throws QueryException query exception */ private TokenSet entries(final int e, final QueryContext ctx) throws QueryException { TokenSet hs = null; if(e < expr.length) { // filter result to specified entries hs = new TokenSet(); final Iter names = ctx.iter(expr[e]); for(Item en; (en = names.next()) != null;) { hs.add(checkElmStr(en).string(info)); } } return hs; } /** * Adds the specified entry to the output stream. * @param entry entry descriptor * @param cont contents * @param out output archive * @param level default compression level * @param ctx query context * @throws QueryException query exception * @throws IOException I/O exception */ private void add(final Item entry, final Item cont, final ArchiveOut out, final int level, final QueryContext ctx) throws QueryException, IOException { // create new zip entry String name = string(entry.string(info)); if(name.isEmpty()) ARCH_EMPTY.thrw(info); if(Prop.WIN) name = name.replace('\\', '/'); final ZipEntry ze = new ZipEntry(name); String en = null; // compression level byte[] lvl = null; if(entry instanceof ANode) { final ANode el = (ANode) entry; lvl = el.attribute(LEVEL); // last modified final byte[] mod = el.attribute(LAST_MOD); if(mod != null) { try { ze.setTime(dateTimeToMs(new Dtm(mod, info), ctx)); } catch(final QueryException qe) { ARCH_DATETIME.thrw(info, mod); } } // encoding final byte[] enc = el.attribute(ENCODING); if(enc != null) { en = string(enc); if(!Charset.isSupported(en)) ARCH_ENCODING.thrw(info, enc); } } // data to be compressed byte[] val = checkStrBin(cont); if(cont instanceof AStr && en != null && en != UTF8) val = encode(val, en, ctx); try { out.level(lvl == null ? level : toInt(lvl)); } catch(final IllegalArgumentException ex) { ARCH_LEVEL.thrw(info, lvl); } out.write(ze, val); } /** * Encodes the specified string to another encoding. * @param val value to be encoded * @param en encoding * @param ctx query context * @return encoded string * @throws QueryException query exception */ private byte[] encode(final byte[] val, final String en, final QueryContext ctx) throws QueryException { try { return FNConvert.toString(new ArrayInput(val), en, ctx); } catch(final IOException ex) { throw ARCH_ENCODE.thrw(info, ex); } } /** * Checks if the specified item is a string or element. * @param it item to be checked * @return item * @throws QueryException query exception */ private Item checkElmStr(final Item it) throws QueryException { if(it instanceof AStr || TEST.eq(it)) return it; throw ELMSTRTYPE.thrw(info, Q_ENTRY.string(), it.type); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNClient.java000066400000000000000000000135651222453003200256160ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.util.Err.*; import java.io.*; import java.util.*; import java.util.regex.*; import org.basex.core.*; import org.basex.io.out.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.server.*; import org.basex.util.*; /** * Functions to connect remote database instances. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNClient extends StandardFunc { /** Query pattern. */ static final Pattern QUERYPAT = Pattern.compile("\\[(.*?)\\] (.*)", Pattern.MULTILINE); /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNClient(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Iter iter(final QueryContext ctx) throws QueryException { checkCreate(ctx); switch(sig) { case _CLIENT_QUERY: return query(ctx).iter(ctx); default: return super.iter(ctx); } } @Override public Value value(final QueryContext ctx) throws QueryException { switch(sig) { case _CLIENT_QUERY: return query(ctx); default: return super.value(ctx); } } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { checkCreate(ctx); switch(sig) { case _CLIENT_CONNECT: return connect(ctx); case _CLIENT_EXECUTE: return execute(ctx); case _CLIENT_INFO: return info(ctx); case _CLIENT_CLOSE: return close(ctx); default: return super.item(ctx, ii); } } /** * Establishes a connection to a remote database instance. * @param ctx query context * @return connection id * @throws QueryException query exception */ private Uri connect(final QueryContext ctx) throws QueryException { final String host = Token.string(checkStr(expr[0], ctx)); final String user = Token.string(checkStr(expr[2], ctx)); final String pass = Token.string(checkStr(expr[3], ctx)); final int port = (int) checkItr(expr[1], ctx); try { return ctx.sessions().add(new ClientSession(host, port, user, pass)); } catch(final IOException ex) { throw BXCL_CONN.thrw(info, ex); } } /** * Executes a command and returns the result as string. * @param ctx query context * @return result * @throws QueryException query exception */ private Str execute(final QueryContext ctx) throws QueryException { final ClientSession cs = session(ctx, false); final String cmd = Token.string(checkStr(expr[1], ctx)); try { final ArrayOutput ao = new ArrayOutput(); cs.setOutputStream(ao); cs.execute(cmd); cs.setOutputStream(null); return Str.get(ao.toArray()); } catch(final BaseXException ex) { throw BXCL_COMMAND.thrw(info, ex); } catch(final IOException ex) { throw BXCL_COMM.thrw(info, ex); } } /** * Executes a command and returns the result as string. * @param ctx query context * @return result * @throws QueryException query exception */ private Str info(final QueryContext ctx) throws QueryException { return Str.get(session(ctx, false).info().replaceAll("\r\n?", "\n").trim()); } /** * Executes a query and returns the result as sequence. * @param ctx query context * @return result * @throws QueryException query exception */ private Value query(final QueryContext ctx) throws QueryException { final ClientSession cs = session(ctx, false); final String query = Token.string(checkStr(expr[1], ctx)); final ValueBuilder vb = new ValueBuilder(); ClientQuery cq = null; try { cq = cs.query(query); // bind variables and context item for(final Map.Entry it : bindings(2, ctx).entrySet()) { final String k = it.getKey(); final Value v = it.getValue(); final ArrayOutput val = v.serialize(); if(!v.isItem()) BXCL_ITEM.thrw(info, v); final String t = v.type().toString(); if(k.isEmpty()) cq.context(val, t); else cq.bind(k, val, t); } // evaluate query while(cq.more()) { final String result = cq.next(); vb.add(cq.type().castString(result, ctx, info)); } return vb.value(); } catch(final BaseXException ex) { final Matcher m = QUERYPAT.matcher(ex.getMessage()); if(m.find()) { Err.thrw(m.group(1), info, m.group(2)); throw new QueryException(info, new QNm(m.group(1)), m.group(2)); } throw BXCL_QUERY.thrw(info, ex); } catch(final IOException ex) { throw BXCL_COMM.thrw(info, ex); } finally { if(cq != null) try { cq.close(); } catch(final IOException ex) { } } } /** * Establishes a connection to a remote database instance. * @param ctx query context * @return connection id * @throws QueryException query exception */ private Item close(final QueryContext ctx) throws QueryException { try { session(ctx, true).close(); return null; } catch(final IOException ex) { throw BXCL_COMMAND.thrw(info, ex); } } /** * Returns a connection and removes it from list with opened connections if * requested. * @param ctx query context * @param del flag indicating if connection has to be removed * @return connection * @throws QueryException query exception */ private ClientSession session(final QueryContext ctx, final boolean del) throws QueryException { final Uri id = (Uri) checkType(expr[0].item(ctx, info), AtomType.URI); final ClientSession cs = ctx.sessions().get(id); if(cs == null) BXCL_NOTAVL.thrw(info, id); if(del) ctx.sessions().remove(id); return cs; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNContext.java000066400000000000000000000024001222453003200260060ustar00rootroot00000000000000package org.basex.query.func; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * Context functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNContext extends StandardFunc { /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNContext(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { switch(sig) { case CURRENT_DATE: return ctx.initDateTime().date; case CURRENT_DATETIME: return ctx.initDateTime().dtm; case CURRENT_TIME: return ctx.initDateTime().time; case IMPLICIT_TIMEZONE: return ctx.initDateTime().zone; case DEFAULT_COLLATION: final Collation coll = ctx.sc.collation; return Uri.uri(coll == null ? QueryText.URLCOLL : coll.uri()); case STATIC_BASE_URI: final Uri uri = ctx.sc.baseURI(); return uri == Uri.EMPTY ? null : uri; default: return super.item(ctx, ii); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNConvert.java000066400000000000000000000234141222453003200260120ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.io.*; import java.math.*; import java.nio.*; import java.nio.charset.*; import org.basex.core.*; import org.basex.io.in.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.list.*; /** * Functions for converting data to other formats. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNConvert extends StandardFunc { /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNConvert(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Iter iter(final QueryContext ctx) throws QueryException { switch(sig) { case _CONVERT_BINARY_TO_BYTES: return binaryToBytes(ctx).iter(); default: return super.iter(ctx); } } @Override public Value value(final QueryContext ctx) throws QueryException { switch(sig) { case _CONVERT_BINARY_TO_BYTES: return binaryToBytes(ctx); default: return super.value(ctx); } } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { switch(sig) { case _CONVERT_INTEGER_FROM_BASE: return integerFromBase(ctx, ii); case _CONVERT_INTEGER_TO_BASE: return integerToBase(ctx, ii); case _CONVERT_BINARY_TO_STRING: return toString(ctx); case _CONVERT_STRING_TO_BASE64: return new B64(stringToBinary(ctx)); case _CONVERT_BYTES_TO_BASE64: return new B64(bytesToBinary(ctx)); case _CONVERT_STRING_TO_HEX: return new Hex(stringToBinary(ctx)); case _CONVERT_BYTES_TO_HEX: return new Hex(bytesToBinary(ctx)); case _CONVERT_DATETIME_TO_INTEGER: return dateTimeToInteger(ctx); case _CONVERT_INTEGER_TO_DATETIME: return integerToDateTime(ctx); case _CONVERT_DAYTIME_TO_INTEGER: return dayTimeToInteger(ctx); case _CONVERT_INTEGER_TO_DAYTIME: return integerToDayTime(ctx); default: return super.item(ctx, ii); } } /** Digits used in base conversion. */ private static final byte[] DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' }; /** * Converts the given number to a string, using base * 2shift. * @param num number item * @param shift number of bits to use for one digit * @return string representation of the given number */ private static Str toBaseFast(final long num, final int shift) { final byte[] bytes = new byte[(64 + shift - 1) / shift]; final int mask = (1 << shift) - 1; long n = num; int pos = bytes.length; do { bytes[--pos] = DIGITS[(int) (n & mask)]; n >>>= shift; } while(n != 0); return Str.get(substring(bytes, pos)); } /** BigInteger representing 2 * ({@link Long#MAX_VALUE} + 1). */ private static final BigInteger MAX_ULONG = BigInteger.ONE.shiftLeft(64); /** * Converts the given number to a string, using the given base. * @param ctx query context * @param ii input info * @return string representation of the given number * @throws QueryException query exception */ private Str integerToBase(final QueryContext ctx, final InputInfo ii) throws QueryException { final long num = checkItr(expr[0], ctx), base = checkItr(expr[1], ctx); if(base < 2 || base > 36) INVBASE.thrw(ii, base); // use fast variant for powers of two for(int i = 1, p = 2; i < 6; i++, p <<= 1) if(base == p) return toBaseFast(num, i); final ByteList tb = new ByteList(); long n = num; if(n < 0) { // unsigned value doesn't fit in any native type... final BigInteger[] dr = BigInteger.valueOf(n).add( MAX_ULONG).divideAndRemainder(BigInteger.valueOf(base)); n = dr[0].longValue(); tb.add(DIGITS[dr[1].intValue()]); } else { tb.add(DIGITS[(int) (n % base)]); n /= base; } while(n != 0) { tb.add(DIGITS[(int) (n % base)]); n /= base; } final byte[] res = tb.toArray(); Array.reverse(res); return Str.get(res); } /** * Converts the given string to a number, interpreting it as an xs:integer * encoded in the given base. * @param ctx query context * @param ii input info * @return read integer * @throws QueryException exception */ private Int integerFromBase(final QueryContext ctx, final InputInfo ii) throws QueryException { final byte[] str = checkStr(expr[0], ctx); final long base = checkItr(expr[1], ctx); if(base < 2 || base > 36) INVBASE.thrw(ii, base); long res = 0; for(final byte b : str) { final int num = b <= '9' ? b - 0x30 : (b & 0xDF) - 0x37; if(!(b >= '0' && b <= '9' || b >= 'a' && b <= 'z' || b >= 'A' && b <= 'Z') || num >= base) INVDIG.thrw(ii, base, (char) (b & 0xff)); res = res * base + num; } return Int.get(res); } /** * Extracts the bytes from a given item. * @param ctx query context * @return resulting value * @throws QueryException query exception */ private Value binaryToBytes(final QueryContext ctx) throws QueryException { try { return BytSeq.get(checkItem(expr[0], ctx).input(info).content()); } catch(final IOException ex) { throw BXCO_STRING.thrw(info, ex); } } /** * Converts the specified integer to a dateTime item. * @param ctx query context * @return resulting value * @throws QueryException query exception */ private Dtm integerToDateTime(final QueryContext ctx) throws QueryException { return new Dtm(checkItr(expr[0], ctx), info); } /** * Converts the specified dateTime to milliseconds. * @param ctx query context * @return resulting value * @throws QueryException query exception */ private Int dateTimeToInteger(final QueryContext ctx) throws QueryException { return Int.get(dateTimeToMs(expr[0], ctx)); } /** * Converts the specified integer to a dayTimeDuration item. * @param ctx query context * @return resulting value * @throws QueryException query exception */ private DTDur integerToDayTime(final QueryContext ctx) throws QueryException { return new DTDur(checkItr(expr[0], ctx)); } /** * Converts the specified dayTimeDuration to milliseconds. * @param ctx query context * @return resulting value * @throws QueryException query exception */ private Int dayTimeToInteger(final QueryContext ctx) throws QueryException { final DTDur dur = (DTDur) checkType(checkItem(expr[0], ctx), AtomType.DTD); final BigDecimal ms = dur.sec.multiply(BigDecimal.valueOf(1000)); if(ms.compareTo(ADateDur.BDMAXLONG) > 0) INTRANGE.thrw(info, dur); return Int.get(ms.longValue()); } /** * Converts the specified data to a string. * @param ctx query context * @return resulting value * @throws QueryException query exception */ private Str toString(final QueryContext ctx) throws QueryException { final Bin bin = checkBinary(expr[0], ctx); final String enc = encoding(1, BXCO_ENCODING, ctx); try { return Str.get(toString(bin.input(info), enc, ctx)); } catch(final IOException ex) { throw BXCO_STRING.thrw(info, ex); } } /** * Converts the specified input to a string in the specified encoding. * @param is input stream * @param enc encoding * @param ctx query context * @return resulting value * @throws IOException I/O exception */ public static byte[] toString(final InputStream is, final String enc, final QueryContext ctx) throws IOException { final boolean val = ctx.context.prop.is(Prop.CHECKSTRINGS); try { return new NewlineInput(is).encoding(enc).validate(val).content(); } finally { is.close(); } } /** * Converts the first argument from a string to a byte array. * @param ctx query context * @return resulting value * @throws QueryException query exception */ private byte[] stringToBinary(final QueryContext ctx) throws QueryException { final byte[] in = checkStr(expr[0], ctx); final String enc = encoding(1, BXCO_ENCODING, ctx); if(enc == null || enc == Token.UTF8) return in; try { final CharsetEncoder ce = Charset.forName(enc).newEncoder(); final CharBuffer cb = CharBuffer.wrap(Token.string(in)); return ce.encode(cb).array(); } catch(final CharacterCodingException ex) { throw BXCO_BASE64.thrw(info); } } /** * Converts the first argument from a byte sequence to a byte array. * @param ctx query context * @return resulting value * @throws QueryException query exception */ private byte[] bytesToBinary(final QueryContext ctx) throws QueryException { final Value v = expr[0].value(ctx); // directly pass on byte array if(v instanceof BytSeq) return ((BytSeq) v).toJava(); // check if all arguments are bytes final Iter ir = v.iter(); final ByteList bl = new ByteList(Math.max(Array.CAPACITY, (int) v.size())); for(Item it; (it = ir.next()) != null;) { bl.add((int) ((Int) checkType(it, AtomType.BYT)).itr()); } return bl.toArray(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNCrypto.java000066400000000000000000000046311222453003200256520ustar00rootroot00000000000000package org.basex.query.func; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.util.*; import org.basex.query.util.crypto.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * EXPath Cryptographic Module. * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class FNCrypto extends StandardFunc { /** * Constructor. * @param ii input info * @param fd function * @param args function arguments */ public FNCrypto(final InputInfo ii, final Function fd, final Expr[] args) { super(ii, fd, args); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { switch(sig) { case _CRYPTO_HMAC: return new Encryption(ii).hmac(checkStr(expr[0], ctx), checkStr(expr[1], ctx), checkStr(expr[2], ctx), expr.length == 4 ? checkStr(expr[3], ctx) : Token.EMPTY); case _CRYPTO_ENCRYPT: return new Encryption(ii).encryption(checkStr(expr[0], ctx), checkStr(expr[1], ctx), checkStr(expr[2], ctx), checkStr(expr[3], ctx), true); case _CRYPTO_DECRYPT: return new Encryption(ii).encryption(checkStr(expr[0], ctx), checkStr(expr[1], ctx), checkStr(expr[2], ctx), checkStr(expr[3], ctx), false); case _CRYPTO_GENERATE_SIGNATURE: // determine type of 7th argument Item arg6 = null; boolean arg6Str = false; if(expr.length > 6) { arg6 = checkItem(expr[6], ctx); if(arg6 instanceof AStr) arg6Str = true; else if(!(arg6 instanceof ANode)) Err.type(this, AtomType.STR, arg6); } return new DigitalSignature(ii).generateSignature( checkNode(expr[0].item(ctx, ii)), checkStr(expr[1], ctx), checkStr(expr[2], ctx), checkStr(expr[3], ctx), checkStr(expr[4], ctx), checkStr(expr[5], ctx), arg6Str ? arg6.string(ii) : Token.token(""), expr.length > 7 ? checkNode(expr[7].item(ctx, ii)) : expr.length == 7 && !arg6Str ? checkNode(expr[6].item(ctx, ii)) : null, ctx, info); case _CRYPTO_VALIDATE_SIGNATURE: return new DigitalSignature(ii). validateSignature(checkNode(expr[0].item(ctx, ii))); default: return super.item(ctx, ii); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNCsv.java000066400000000000000000000064371222453003200251330ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.io.serial.SerializerProp.*; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.io.*; import org.basex.io.out.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.util.csv.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Functions for parsing CSV input. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public class FNCsv extends StandardFunc { /** Element: options. */ private static final QNm Q_OPTIONS = QNm.get("options", CSVURI); /** The {@code header} key. */ private static final byte[] HEADER = token("header"); /** The {@code separator} key. */ private static final byte[] SEPARATOR = token("separator"); /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNCsv(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { switch(sig) { case _CSV_PARSE: return parse(ctx); case _CSV_SERIALIZE: return serialize(ctx); default: return super.item(ctx, ii); } } /** * Converts CSV input to an element node. * @param ctx query context * @return element node * @throws QueryException query exception */ private FElem parse(final QueryContext ctx) throws QueryException { final byte[] input = checkStr(expr[0], ctx); final Item opt = expr.length > 1 ? expr[1].item(ctx, info) : null; final TokenMap map = new FuncParams(Q_OPTIONS, info).parse(opt); final boolean header = map.contains(HEADER) && Util.yes(string(map.get(HEADER))); int sep = ','; final byte[] sp = map.get(SEPARATOR); if(sp != null) { final TokenParser tp = new TokenParser(sp); sep = tp.next(); if(sep == -1 || tp.next() != -1) BXCS_CONFIG.thrw(info); } try { return new CsvParser(sep, header).convert(input); } catch(final IOException ex) { throw BXCS_PARSE.thrw(info, ex); } } /** * Serializes the specified XML document as CSV. * @param ctx query context * @return string representation * @throws QueryException query exception */ private Str serialize(final QueryContext ctx) throws QueryException { final ANode node = checkNode(expr[0], ctx); final Item opt = expr.length > 1 ? expr[1].item(ctx, info) : null; final TokenMap map = new FuncParams(Q_OPTIONS, info).parse(opt); final ArrayOutput ao = new ArrayOutput(); final SerializerProp props = new SerializerProp(); if(map.contains(HEADER)) props.set(S_CSV_HEADER, string(map.get(HEADER))); if(map.contains(SEPARATOR)) props.set(S_CSV_SEPARATOR, string(map.get(SEPARATOR))); try { // run serialization final Serializer ser = new CsvSerializer(ao, props); ser.serialize(node); ser.close(); } catch(final SerializerException ex) { throw ex.getCause(info); } catch(final IOException ex) { SERANY.thrw(info, ex); } return Str.get(delete(ao.toArray(), '\r')); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNDate.java000066400000000000000000000131451222453003200252470ustar00rootroot00000000000000package org.basex.query.func; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Date functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNDate extends StandardFunc { /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNDate(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { final Item it = expr[0].item(ctx, info); if(it == null) return null; switch(sig) { case YEARS_FROM_DURATION: return Int.get(checkDur(it).yea()); case YEAR_FROM_DATETIME: return Int.get(checkDate(it, AtomType.DTM, ctx).yea()); case YEAR_FROM_DATE: return Int.get(checkDate(it, AtomType.DAT, ctx).yea()); case MONTHS_FROM_DURATION: return Int.get(checkDur(it).mon()); case MONTH_FROM_DATETIME: return Int.get(checkDate(it, AtomType.DTM, ctx).mon()); case MONTH_FROM_DATE: return Int.get(checkDate(it, AtomType.DAT, ctx).mon()); case DAYS_FROM_DURATION: return Int.get(checkDur(it).day()); case DAY_FROM_DATETIME: return Int.get(checkDate(it, AtomType.DTM, ctx).day()); case DAY_FROM_DATE: return Int.get(checkDate(it, AtomType.DAT, ctx).day()); case HOURS_FROM_DURATION: return Int.get(checkDur(it).hou()); case HOURS_FROM_DATETIME: return Int.get(checkDate(it, AtomType.DTM, ctx).hou()); case HOURS_FROM_TIME: return Int.get(checkDate(it, AtomType.TIM, ctx).hou()); case MINUTES_FROM_DURATION: return Int.get(checkDur(it).min()); case MINUTES_FROM_DATETIME: return Int.get(checkDate(it, AtomType.DTM, ctx).min()); case MINUTES_FROM_TIME: return Int.get(checkDate(it, AtomType.TIM, ctx).min()); case SECONDS_FROM_DURATION: return Dec.get(checkDur(it).sec()); case SECONDS_FROM_DATETIME: return Dec.get(checkDate(it, AtomType.DTM, ctx).sec()); case SECONDS_FROM_TIME: return Dec.get(checkDate(it, AtomType.TIM, ctx).sec()); case TIMEZONE_FROM_DATETIME: return zon(checkDate(it, AtomType.DTM, ctx)); case TIMEZONE_FROM_DATE: return zon(checkDate(it, AtomType.DAT, ctx)); case TIMEZONE_FROM_TIME: return zon(checkDate(it, AtomType.TIM, ctx)); case ADJUST_DATE_TO_TIMEZONE: return adjust(it, AtomType.DAT, ctx); case ADJUST_DATETIME_TO_TIMEZONE: return adjust(it, AtomType.DTM, ctx); case ADJUST_TIME_TO_TIMEZONE: return adjust(it, AtomType.TIM, ctx); case DATETIME: return dateTime(it, ctx); default: return super.item(ctx, ii); } } /** * Returns the timezone. * @param it input item * @return timezone */ private static DTDur zon(final ADate it) { final int tz = it.zon(); return tz == Short.MAX_VALUE ? null : new DTDur(0, tz); } /** * Checks if the specified item has the specified Date type. * If it is item, the specified Date is returned. * @param it item to be checked * @param t target type * @param ctx query context * @return date * @throws QueryException query exception */ private ADate checkDate(final Item it, final Type t, final QueryContext ctx) throws QueryException { return (ADate) (it.type.isUntyped() ? t.cast(it, ctx, info) : checkType(it, t)); } /** * Checks if the specified item is a Duration item. If it is untyped, * a duration is returned. * @param it item to be checked * @return duration * @throws QueryException query exception */ private Dur checkDur(final Item it) throws QueryException { if(it instanceof Dur) return (Dur) it; if(it.type.isUntyped()) return new Dur(it.string(info), info); throw Err.type(this, AtomType.DUR, it); } /** * Returns a DateTime item. * @param date item to be checked * @param ctx query context * @return duration * @throws QueryException query exception */ private ADate dateTime(final Item date, final QueryContext ctx) throws QueryException { final Item zon = expr.length == 2 ? expr[1].item(ctx, info) : null; if(zon == null) return null; final Dat d = date.type.isUntyped() ? new Dat(date.string(info), info) : (Dat) checkType(date, AtomType.DAT); final Tim t = zon.type.isUntyped() ? new Tim(zon.string(info), info) : (Tim) checkType(zon, AtomType.TIM); return new Dtm(d, t, info); } /** * Adjusts a Time item to the specified time zone. * @param it item * @param t target type * @param ctx query context * @return duration * @throws QueryException query exception */ private ADate adjust(final Item it, final Type t, final QueryContext ctx) throws QueryException { final ADate ad; if(it.type.isUntyped()) { ad = (ADate) t.cast(it, ctx, info); } else { // clone item final ADate a = (ADate) checkType(it, t); ad = t == AtomType.TIM ? new Tim(a) : t == AtomType.DAT ? new Dat(a) : new Dtm(a); } final boolean spec = expr.length == 2; final Item zon = spec ? expr[1].item(ctx, info) : null; ad.timeZone(zon == null ? null : (DTDur) checkType(zon, AtomType.DTD), spec, info); return ad; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNDb.java000066400000000000000000000746571222453003200247360ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.func.Function.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.io.*; import java.util.*; import java.util.List; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.index.*; import org.basex.index.query.*; import org.basex.index.resource.*; import org.basex.io.*; import org.basex.io.out.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.path.*; import org.basex.query.up.*; import org.basex.query.up.primitives.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * Database functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Dimitar Popov */ public final class FNDb extends StandardFunc { /** Element: parameters. */ private static final QNm Q_OPTIONS = QNm.get("options"); /** Resource element name. */ static final String SYSTEM = "system"; /** Resource element name. */ static final String DATABASE = "database"; /** Backup element name. */ static final String BACKUP = "backup"; /** Resource element name. */ static final String RESOURCE = "resource"; /** Resource element name. */ static final String RESOURCES = "resources"; /** Path element name. */ static final String PATH = "path"; /** Raw element name. */ static final String RAW = "raw"; /** Size element name. */ static final String SIZE = "size"; /** Content type element name. */ static final String CTYPE = "content-type"; /** Modified date element name. */ static final String MDATE = "modified-date"; /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNDb(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Iter iter(final QueryContext ctx) throws QueryException { switch(sig) { case _DB_OPEN: return open(ctx).iter(); case _DB_BACKUPS: return backups(ctx); case _DB_TEXT: return valueAccess(true, ctx).iter(ctx); case _DB_TEXT_RANGE: return rangeAccess(true, ctx).iter(ctx); case _DB_ATTRIBUTE: return attribute(valueAccess(false, ctx), ctx, 2); case _DB_ATTRIBUTE_RANGE: return attribute(rangeAccess(false, ctx), ctx, 3); case _DB_FULLTEXT: return fulltext(ctx); case _DB_LIST: return list(ctx); case _DB_LIST_DETAILS: return listDetails(ctx); case _DB_NODE_ID: return node(ctx, true); case _DB_NODE_PRE: return node(ctx, false); default: return super.iter(ctx); } } @Override public Value value(final QueryContext ctx) throws QueryException { switch(sig) { case _DB_OPEN: return open(ctx); default: return super.value(ctx); } } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { switch(sig) { case _DB_EVENT: return event(ctx); case _DB_OUTPUT: return output(ctx); case _DB_OPEN_ID: return open(ctx, true); case _DB_OPEN_PRE: return open(ctx, false); case _DB_SYSTEM: return system(ctx); case _DB_INFO: return info(ctx); case _DB_ADD: return add(ctx); case _DB_DELETE: return delete(ctx); case _DB_CREATE: return create(ctx); case _DB_DROP: return drop(ctx); case _DB_RENAME: return rename(ctx); case _DB_REPLACE: return replace(ctx); case _DB_OPTIMIZE: return optimize(ctx); case _DB_STORE: return store(ctx); case _DB_RETRIEVE: return retrieve(ctx); case _DB_FLUSH: return flush(ctx); case _DB_IS_RAW: return isRaw(ctx); case _DB_EXISTS: return exists(ctx); case _DB_IS_XML: return isXML(ctx); case _DB_CONTENT_TYPE: return contentType(ctx); case _DB_EXPORT: return export(ctx); case _DB_NAME: return name(ctx); case _DB_PATH: return path(ctx); default: return super.item(ctx, ii); } } /** * Performs the open function. * @param ctx query context * @return iterator * @throws QueryException query exception */ private Value open(final QueryContext ctx) throws QueryException { final Data data = checkData(ctx); final String path = expr.length < 2 ? "" : path(1, ctx); return DBNodeSeq.get(data.resources.docs(path), data, true, path.isEmpty()); } /** * Performs the open-id and open-pre function. * @param ctx query context * @param id id flag * @return result * @throws QueryException query exception */ private DBNode open(final QueryContext ctx, final boolean id) throws QueryException { final Data data = checkData(ctx); final int v = (int) checkItr(expr[1], ctx); final int pre = id ? data.pre(v) : v; if(pre < 0 || pre >= data.meta.size) BXDB_RANGE.thrw(info, this, v); return new DBNode(data, pre); } /** * Returns an index accessor. * @param text text/attribute flag * @param ctx query context * @return index accessor * @throws QueryException query exception */ private ValueAccess valueAccess(final boolean text, final QueryContext ctx) throws QueryException { final IndexType it = text ? IndexType.TEXT : IndexType.ATTRIBUTE; return new ValueAccess(info, expr[1], it, new IndexContext(checkData(ctx), false)); } /** * Returns a range index accessor. * @param text text/attribute flag * @param ctx query context * @return iterator * @throws QueryException query exception */ private StringRangeAccess rangeAccess(final boolean text, final QueryContext ctx) throws QueryException { final byte[] min = checkStr(expr[1], ctx); final byte[] max = checkStr(expr[2], ctx); final IndexType it = text ? IndexType.TEXT : IndexType.ATTRIBUTE; final StringRange sr = new StringRange(it, min, true, max, true); return new StringRangeAccess(info, sr, new IndexContext(checkData(ctx), false)); } /** * Performs the attribute function. * @param ia index access * @param ctx query context * @param a index of attribute argument * @return iterator * @throws QueryException query exception */ private Iter attribute(final IndexAccess ia, final QueryContext ctx, final int a) throws QueryException { // no attribute specified if(expr.length <= a) return ia.iter(ctx); // parse and compile the name test final QNm nm = new QNm(checkStr(expr[a], ctx), ctx); if(!nm.hasPrefix()) nm.uri(ctx.sc.ns.uri(Token.EMPTY)); final NameTest nt = new NameTest(nm, NameTest.Mode.STD, true); // return empty sequence if test will yield no results if(!nt.compile(ctx)) return Empty.ITER; // wrap iterator with name test return new NodeIter() { final NodeIter ir = ia.iter(ctx); @Override public ANode next() throws QueryException { ANode n; while((n = ir.next()) != null && !nt.eq(n)); return n; } }; } /** * Performs the fulltext function. * @param ctx query context * @return iterator * @throws QueryException query exception */ private Iter fulltext(final QueryContext ctx) throws QueryException { return FNFt.search(checkData(ctx), ctx.value(expr[1]), null, this, ctx); } /** * Performs the list function. * @param ctx query context * @return iterator * @throws QueryException query exception */ private Iter list(final QueryContext ctx) throws QueryException { final TokenList tl = new TokenList(); final int el = expr.length; if(el == 0) { for(final String s : ctx.context.databases.listDBs()) tl.add(s); } else { final Data data = checkData(ctx); final String path = string(el == 1 ? Token.EMPTY : checkStr(expr[1], ctx)); // add xml resources final Resources res = data.resources; final IntList il = res.docs(path); final int is = il.size(); for(int i = 0; i < is; i++) tl.add(data.text(il.get(i), true)); // add binary resources for(final byte[] file : res.binaries(path)) tl.add(file); } tl.sort(Prop.CASE); return new Iter() { int pos; @Override public Str get(final long i) { return Str.get(tl.get((int) i)); } @Override public Str next() { return pos < size() ? get(pos++) : null; } @Override public boolean reset() { pos = 0; return true; } @Override public long size() { return tl.size(); } }; } /** * Performs the backups function. * @param ctx query context * @return iterator * @throws QueryException query exception */ private Iter backups(final QueryContext ctx) throws QueryException { checkCreate(ctx); final String prefix = expr.length == 0 ? null : string(checkStr(expr[0], ctx)) + '-'; final StringList list = ctx.context.databases.backups(prefix); final IOFile dbpath = ctx.context.mprop.dbpath(); return new Iter() { int up = -1; @Override public Item next() throws QueryException { if(++up >= list.size()) return null; final String name = list.get(up); final long length = new IOFile(dbpath, name).length(); return new FElem(BACKUP).add(name).add(SIZE, token(length)); } }; } /** * Performs the list-details function. * @param ctx query context * @return iterator * @throws QueryException query exception */ private Iter listDetails(final QueryContext ctx) throws QueryException { if(expr.length == 0) return listDBs(ctx); final Data data = checkData(ctx); final String path = string(expr.length == 1 ? Token.EMPTY : checkStr(expr[1], ctx)); final IntList il = data.resources.docs(path); final TokenList tl = data.resources.binaries(path); return new Iter() { final int is = il.size(), ts = tl.size(); int ip, tp; @Override public ANode get(final long i) throws QueryException { if(i < is) { final byte[] pt = data.text(il.get((int) i), true); return resource(pt, false, 0, token(MimeTypes.APP_XML), data.meta.time); } if(i < is + ts) { final byte[] pt = tl.get((int) i - is); final IOFile io = data.meta.binary(string(pt)); return resource(pt, true, io.length(), token(MimeTypes.get(io.path())), io.timeStamp()); } return null; } @Override public ANode next() throws QueryException { return ip < is ? get(ip++) : tp < ts ? get(ip + tp++) : null; } @Override public boolean reset() { ip = 0; tp = 0; return true; } @Override public long size() { return ip + is; } }; } /** * Performs the list-details for databases function. * @param ctx query context * @return iterator */ private Iter listDBs(final QueryContext ctx) { final StringList sl = ctx.context.databases.listDBs(); return new Iter() { int pos; @Override public ANode get(final long i) throws QueryException { final String name = sl.get((int) i); final MetaData meta = new MetaData(name, ctx.context); try { meta.read(); } catch(final IOException ex) { BXDB_OPEN.thrw(info, ex); } final FElem res = new FElem(DATABASE); res.add(RESOURCES, token(meta.ndocs)); res.add(MDATE, DateTime.format(new Date(meta.dbtime()), DateTime.FULL)); if(ctx.context.perm(Perm.CREATE, meta)) res.add(PATH, meta.original); res.add(name); return res; } @Override public ANode next() throws QueryException { return pos < size() ? get(pos++) : null; } @Override public boolean reset() { pos = 0; return true; } @Override public long size() { return sl.size(); } }; } /** * Performs the is-raw function. * @param ctx query context * @return result * @throws QueryException query exception */ private Bln isRaw(final QueryContext ctx) throws QueryException { final Data data = checkData(ctx); final String path = path(1, ctx); if(data.inMemory()) return Bln.FALSE; final IOFile io = data.meta.binary(path); return Bln.get(io.exists() && !io.isDir()); } /** * Performs the exists function. * @param ctx query context * @return result * @throws QueryException query exception */ private Bln exists(final QueryContext ctx) throws QueryException { try { final Data data = checkData(ctx); if(expr.length == 1) return Bln.TRUE; // check if raw file or XML document exists final String path = path(1, ctx); boolean raw = false; if(!data.inMemory()) { final IOFile io = data.meta.binary(path); raw = io.exists() && !io.isDir(); } return Bln.get(raw || data.resources.doc(path) != -1); } catch(final QueryException ex) { if(ex.err() == BXDB_OPEN) return Bln.FALSE; throw ex; } } /** * Performs the is-xml function. * @param ctx query context * @return result * @throws QueryException query exception */ private Bln isXML(final QueryContext ctx) throws QueryException { final Data data = checkData(ctx); final String path = path(1, ctx); return Bln.get(data.resources.doc(path) != -1); } /** * Performs the content-type function. * @param ctx query context * @return result * @throws QueryException query exception */ private Str contentType(final QueryContext ctx) throws QueryException { final Data data = checkData(ctx); final String path = path(1, ctx); if(data.resources.doc(path) != -1) return Str.get(MimeTypes.APP_XML); if(!data.inMemory()) { final IOFile io = data.meta.binary(path); if(io.exists() && !io.isDir()) return Str.get(MimeTypes.get(path)); } throw WHICHRES.thrw(info, path); } /** * Performs the export function. * @param ctx query context * @return iterator * @throws QueryException query exception */ private Item export(final QueryContext ctx) throws QueryException { final Data data = checkData(ctx); final String path = string(checkStr(expr[1], ctx)); final Item it = expr.length > 2 ? expr[2].item(ctx, info) : null; final SerializerProp sp = FuncParams.serializerProp(it, info); try { Export.export(data, path, sp, null); } catch(final SerializerException ex) { throw ex.getCause(info); } catch(final IOException ex) { SERANY.thrw(info, ex); } return null; } /** * Performs the name function. * @param ctx query context * @return iterator * @throws QueryException query exception */ private Str name(final QueryContext ctx) throws QueryException { return Str.get(checkDBNode(checkItem(expr[0], ctx)).data.meta.name); } /** * Performs the path function. * @param ctx query context * @return iterator * @throws QueryException query exception */ private Str path(final QueryContext ctx) throws QueryException { ANode node, par = checkNode(expr[0], ctx); do { node = par; par = node.parent(); } while(par != null); final DBNode dbn = checkDBNode(node); return Str.get(dbn.data.text(dbn.pre, true)); } /** * Create a <resource/> node. * @param path path * @param raw is the resource a raw file * @param size size * @param ctype content type * @param mdate modified date * @return <resource/> node */ static FNode resource(final byte[] path, final boolean raw, final long size, final byte[] ctype, final long mdate) { final String tstamp = DateTime.format(new Date(mdate), DateTime.FULL); final FElem res = new FElem(RESOURCE).add(path). add(RAW, token(raw)).add(CTYPE, ctype).add(MDATE, tstamp); return raw ? res.add(SIZE, token(size)) : res; } /** * Performs the system function. * @param ctx query context * @return node */ private static ANode system(final QueryContext ctx) { return toNode(Info.info(ctx.context), SYSTEM); } /** * Performs the info function. * @param ctx query context * @return node * @throws QueryException query exception */ private ANode info(final QueryContext ctx) throws QueryException { final Data data = checkData(ctx); final boolean create = ctx.context.user.has(Perm.CREATE); return toNode(InfoDB.db(data.meta, false, true, create), DATABASE); } /** * Converts the specified info string to a node fragment. * @param root name of the root node * @param str string to be converted * @return node */ private static ANode toNode(final String str, final String root) { final FElem top = new FElem(root); FElem node = null; for(final String l : str.split("\r\n?|\n")) { final String[] cols = l.split(": ", 2); if(cols[0].isEmpty()) continue; final FElem n = new FElem(token(toName(cols[0]))); if(cols[0].startsWith(" ")) { if(node != null) node.add(n); if(!cols[1].isEmpty()) n.add(cols[1]); } else { node = n; top.add(n); } } return top; } /** * Converts the specified info key to an element name. * @param str string to be converted * @return resulting name */ public static String toName(final String str) { return str.replaceAll(" |-", "").toLowerCase(Locale.ENGLISH); } /** * Performs the add function. * @param ctx query context * @return {@code null} * @throws QueryException query exception */ private Item add(final QueryContext ctx) throws QueryException { final Data data = checkWrite(checkData(ctx), ctx); final byte[] path = expr.length < 3 ? Token.EMPTY : token(path(2, ctx)); final NewInput input = checkInput(checkItem(expr[1], ctx), path); ctx.updates.add(new DBAdd(data, input, ctx, info), ctx); return null; } /** * Performs the replace function. * @param ctx query context * @return {@code null} * @throws QueryException query exception */ private Item replace(final QueryContext ctx) throws QueryException { final Data data = checkWrite(checkData(ctx), ctx); final String path = path(1, ctx); final NewInput input = checkInput(checkItem(expr[2], ctx), token(path)); // remove old documents final Resources res = data.resources; final IntList pre = res.docs(path, true); for(int p = 0; p < pre.size(); p++) { ctx.updates.add(new DeleteNode(pre.get(p), data, info), ctx); } // delete binary resources final IOFile bin = data.inMemory() ? null : data.meta.binary(path); if(bin != null) { if(bin.exists()) { if(bin.isDir()) BXDB_DIR.thrw(info, path); ctx.updates.add(new DBStore(data, path, input, info), ctx); } else { ctx.updates.add(new DBAdd(data, input, ctx, info), ctx); } } return null; } /** * Performs the delete function. * @param ctx query context * @return {@code null} * @throws QueryException query exception */ private Item delete(final QueryContext ctx) throws QueryException { final Data data = checkWrite(checkData(ctx), ctx); final String path = path(1, ctx); // delete XML resources final IntList docs = data.resources.docs(path); final int is = docs.size(); for(int i = 0; i < is; i++) { ctx.updates.add(new DeleteNode(docs.get(i), data, info), ctx); } // delete raw resources if(!data.inMemory()) { final IOFile bin = data.meta.binary(path); if(bin == null) UPDBDELERR.thrw(info, path); ctx.updates.add(new DBDelete(data, path, info), ctx); } return null; } /** * Performs the create function. * @param ctx query context * @return {@code null} * @throws QueryException query exception */ private Item create(final QueryContext ctx) throws QueryException { final String name = string(checkStr(expr[0], ctx)); if(!Databases.validName(name)) BXDB_NAME.thrw(info, name); final TokenList paths = new TokenList(); if(expr.length > 2) { final Iter ir = ctx.iter(expr[2]); for(Item it; (it = ir.next()) != null;) { final String path = string(checkStr(it)); final String norm = MetaData.normPath(path); if(norm == null) RESINV.thrw(info, path); paths.add(norm); } } final int ps = paths.size(); final List inputs = new ArrayList(ps); if(expr.length > 1) { final Value val = ctx.value(expr[1]); // number of specified inputs and paths must be identical final long is = val.size(); if(ps != 0 && is != ps) BXDB_CREATEARGS.thrw(info, is, ps); for(int i = 0; i < is; i++) { final byte[] path = i < ps ? paths.get(i) : Token.EMPTY; inputs.add(checkInput(val.itemAt(i), path)); } } final Item opt = expr.length > 3 ? expr[3].item(ctx, info) : null; final TokenMap map = new FuncParams(Q_OPTIONS, info).parse(opt); ctx.updates.add(new DBCreate(info, name, inputs, map, ctx), ctx); return null; } /** * Performs the create function. * @param ctx query context * @return {@code null} * @throws QueryException query exception */ private Item drop(final QueryContext ctx) throws QueryException { checkAdmin(ctx); final Data data = checkWrite(checkData(ctx), ctx); ctx.updates.add(new DBDrop(data, info, ctx), ctx); return null; } /** * Performs the rename function. * @param ctx query context * @return {@code null} * @throws QueryException query exception */ private Item rename(final QueryContext ctx) throws QueryException { final Data data = checkWrite(checkData(ctx), ctx); final String source = path(1, ctx); final String target = path(2, ctx); // the first step of the path should be the database name final IntList il = data.resources.docs(source); final int is = il.size(); for(int i = 0; i < is; i++) { final int pre = il.get(i); final String trg = Rename.target(data, pre, source, target); if(trg.isEmpty() || trg.endsWith("/") || trg.endsWith(".")) BXDB_RENAME.thrw(info, this); ctx.updates.add(new ReplaceValue(pre, data, info, token(trg)), ctx); } // rename files if(!data.inMemory()) { final IOFile src = data.meta.binary(source); final IOFile trg = data.meta.binary(target); if(src == null || trg == null) UPDBRENAMEERR.thrw(info, src); ctx.updates.add(new DBRename(data, src.path(), trg.path(), info), ctx); } return null; } /** * Performs the optimize function. * @param ctx query context * @return {@code null} * @throws QueryException query exception */ private Item optimize(final QueryContext ctx) throws QueryException { final Data data = checkWrite(checkData(ctx), ctx); final boolean all = expr.length > 1 && checkBln(expr[1], ctx); final Item opt = expr.length > 2 ? expr[2].item(ctx, info) : null; final TokenMap map = new FuncParams(Q_OPTIONS, info).parse(opt); // check database options ctx.updates.add(new DBOptimize(data, ctx, all, map, info), ctx); return null; } /** * Performs the store function. * @param ctx query context * @return {@code null} * @throws QueryException query exception */ private Item store(final QueryContext ctx) throws QueryException { final Data data = checkWrite(checkData(ctx), ctx); final String path = path(1, ctx); if(data.inMemory()) BXDB_MEM.thrw(info, data.meta.name); final IOFile file = data.meta.binary(path); if(file == null || file.isDir()) RESINV.thrw(info, path); final Item it = checkItem(expr[2], ctx); ctx.updates.add(new DBStore(data, path, it, info), ctx); return null; } /** * Performs the flush function. * @param ctx query context * @return {@code null} * @throws QueryException query exception */ private Item flush(final QueryContext ctx) throws QueryException { ctx.updates.add(new DBFlush(checkWrite(checkData(ctx), ctx), info), ctx); return null; } /** * Performs the retrieve function. * @param ctx query context * @return {@code null} * @throws QueryException query exception */ private B64Stream retrieve(final QueryContext ctx) throws QueryException { final Data data = checkData(ctx); final String path = path(1, ctx); if(data.inMemory()) BXDB_MEM.thrw(info, data.meta.name); final IOFile file = data.meta.binary(path); if(file == null || !file.exists() || file.isDir()) WHICHRES.thrw(info, path); return new B64Stream(file, IOERR); } /** * Performs the node-pre and node-id function. * @param ctx query context * @param id id flag * @return iterator * @throws QueryException query exception */ private Iter node(final QueryContext ctx, final boolean id) throws QueryException { return new Iter() { final Iter ir = ctx.iter(expr[0]); @Override public Int next() throws QueryException { final Item it = ir.next(); if(it == null) return null; final DBNode node = checkDBNode(it); return Int.get(id ? node.data.id(node.pre) : node.pre); } }; } /** * Sends an event to the registered sessions. * @param ctx query context * @return event result * @throws QueryException query exception */ private Item event(final QueryContext ctx) throws QueryException { final byte[] name = checkStr(expr[0], ctx); final ArrayOutput ao = ctx.value(expr[1]).serialize(); // throw exception if event is unknown if(!ctx.context.events.notify(ctx.context, name, ao.toArray())) { BXDB_EVENT.thrw(info, name); } return null; } /** * Updating function: creates output which will be returned to the user after the * pending update list has been processed. * @param ctx query context * @return event result * @throws QueryException query exception */ private Item output(final QueryContext ctx) throws QueryException { if(ctx.updates.mod instanceof TransformModifier) BASX_DBTRANSFORM.thrw(info); cache(ctx.iter(expr[0]), ctx.output, ctx); return null; } /** * Creates a {@link Data} instance for the specified document. * @param in input item * @param path optional path argument * @return database instance * @throws QueryException query exception */ private NewInput checkInput(final Item in, final byte[] path) throws QueryException { final NewInput ni = new NewInput(); if(in.type.isNode()) { if(endsWith(path, '.') || endsWith(path, '/')) RESINV.thrw(info, path); // ensure that the final name is not empty ANode nd = (ANode) in; byte[] name = path; if(name.length == 0) { // adopt name from document node name = nd.baseURI(); final Data d = nd.data(); // adopt path if node is part of disk database. otherwise, only adopt file name final int i = d == null || d.inMemory() ? lastIndexOf(name, '/') : indexOf(name, '/'); if(i != -1) name = substring(name, i + 1); if(name.length == 0) RESINV.thrw(info, name); } // adding a document node if(nd.type != NodeType.DOC) { if(nd.type == NodeType.ATT) UPDOCTYPE.thrw(info, nd); nd = new FDoc(name).add(nd); } ni.node = nd; ni.path = name; return ni; } if(!in.type.isStringOrUntyped()) throw STRNODTYPE.thrw(info, this, in.type); final QueryInput qi = new QueryInput(string(in.string(info))); if(!qi.input.exists()) WHICHRES.thrw(info, qi.original); // add slash to the target if the addressed file is an archive or directory String name = string(path); if(name.endsWith(".")) RESINV.thrw(info, path); if(!name.endsWith("/") && (qi.input.isDir() || qi.input.isArchive())) name += "/"; String target = ""; final int s = name.lastIndexOf('/'); if(s != -1) { target = name.substring(0, s); name = name.substring(s + 1); } // set name of document if(!name.isEmpty()) qi.input.name(name); // get name from io reference else if(!(qi.input instanceof IOContent)) name = qi.input.name(); // ensure that the final name is not empty if(name.isEmpty()) RESINV.thrw(info, path); ni.io = qi.input; ni.dbname = token(name); ni.path = token(target); return ni; } @Override public boolean accept(final ASTVisitor visitor) { if(!oneOf(sig, _DB_BACKUPS, _DB_NODE_ID, _DB_NODE_PRE, _DB_EVENT, _DB_OUTPUT, _DB_SYSTEM)) { if(expr.length == 0) { if(!visitor.lock(null)) return false; } else { if(!dataLock(visitor)) return false; } } return super.accept(visitor); } @Override public boolean iterable() { // index functions will always yield ordered and duplicate-free results return oneOf(sig, _DB_OPEN, _DB_TEXT, _DB_ATTRIBUTE, _DB_FULLTEXT) || super.iterable(); } /** * Returns the specified expression as normalized database path. * Throws an exception if the path is invalid. * @param i index of argument * @param ctx query context * @return normalized path * @throws QueryException query exception */ private String path(final int i, final QueryContext ctx) throws QueryException { final String path = string(checkStr(expr[i], ctx)); final String norm = MetaData.normPath(path); if(norm == null) RESINV.thrw(info, path); return norm; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNFetch.java000066400000000000000000000052031222453003200254170ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.util.Err.*; import java.io.*; import java.net.*; import org.basex.io.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * Functions for fetching resources. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNFetch extends StandardFunc { /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNFetch(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { switch(sig) { case _FETCH_TEXT: return text(ctx); case _FETCH_BINARY: return binary(ctx); case _FETCH_CONTENT_TYPE: return contentType(ctx); default: return super.item(ctx, ii); } } /** * Fetches a resource identified by a URI and returns a string representation. * @param ctx query context * @return string * @throws QueryException query exception */ private StrStream text(final QueryContext ctx) throws QueryException { final byte[] uri = checkStr(expr[0], ctx); final String enc = encoding(1, BXFE_ENCODING, ctx); return new StrStream(IO.get(Token.string(uri)), enc, BXFE_IO, ctx); } /** * Fetches a resource identified by a URI and returns a binary representation. * @param ctx query context * @return Base64Binary * @throws QueryException query exception */ private B64Stream binary(final QueryContext ctx) throws QueryException { final byte[] uri = checkStr(expr[0], ctx); return new B64Stream(IO.get(Token.string(uri)), BXFE_IO); } /** * Fetches the content type of a resource. * @param ctx query context * @return content type * @throws QueryException query exception */ private Str contentType(final QueryContext ctx) throws QueryException { final byte[] uri = checkStr(expr[0], ctx); final IO io = IO.get(Token.string(uri)); final String path = io.path(); final String mt; if(io instanceof IOUrl) { try { final URL url = new URL(path); final URLConnection hc = url.openConnection(); mt = hc.getContentType(); } catch(final IOException ex) { throw BXFE_IO.thrw(info, ex); } } else if(io instanceof IOContent) { mt = MimeTypes.APP_XML; } else { mt = io.exists() ? MimeTypes.get(path) : null; } if(mt == null) throw BXFE_IO.thrw(info, new FileNotFoundException(path)); return Str.get(mt); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNFile.java000066400000000000000000000474721222453003200252630ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.io.*; import java.nio.charset.*; import java.util.*; import java.util.regex.*; import org.basex.core.*; import org.basex.io.*; import org.basex.io.out.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.list.*; /** * Functions on files and directories. * * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura * @author Christian Gruen */ public final class FNFile extends StandardFunc { /** Line separator. */ private static final byte[] NL = token(Prop.NL); /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNFile(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Iter iter(final QueryContext ctx) throws QueryException { checkCreate(ctx); switch(sig) { case _FILE_LIST: return list(ctx); case _FILE_READ_TEXT_LINES: return readTextLines(ctx); default: return super.iter(ctx); } } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { checkCreate(ctx); try { switch(sig) { case _FILE_APPEND: return write(true, ctx); case _FILE_APPEND_BINARY: return writeBinary(true, ctx); case _FILE_APPEND_TEXT: return writeText(true, ctx); case _FILE_APPEND_TEXT_LINES: return writeTextLines(true, ctx); case _FILE_BASE_NAME: return baseName(ctx); case _FILE_COPY: return relocate(true, ctx); case _FILE_CREATE_DIR: return createDir(ctx); case _FILE_CREATE_TEMP_DIR: return createTemp(true, ctx); case _FILE_CREATE_TEMP_FILE: return createTemp(false, ctx); case _FILE_DELETE: return delete(ctx); case _FILE_DIR_NAME: return dirName(ctx); case _FILE_DIR_SEPARATOR: return Str.get(File.separator); case _FILE_EXISTS: return Bln.get(checkFile(0, ctx).exists()); case _FILE_IS_DIR: return Bln.get(checkFile(0, ctx).isDirectory()); case _FILE_IS_FILE: return Bln.get(checkFile(0, ctx).isFile()); case _FILE_LAST_MODIFIED: return lastModified(ctx); case _FILE_LINE_SEPARATOR: return Str.get(NL); case _FILE_MOVE: return relocate(false, ctx); case _FILE_PATH_SEPARATOR: return Str.get(File.pathSeparator); case _FILE_PATH_TO_NATIVE: return pathToNative(ctx); case _FILE_PATH_TO_URI: return pathToUri(ctx); case _FILE_READ_BINARY: return readBinary(ctx); case _FILE_READ_TEXT: return readText(ctx); case _FILE_RESOLVE_PATH: return resolvePath(ctx); case _FILE_SIZE: return size(ctx); case _FILE_TEMP_DIR: return Str.get(Prop.TMP); case _FILE_WRITE: return write(false, ctx); case _FILE_WRITE_BINARY: return writeBinary(false, ctx); case _FILE_WRITE_TEXT: return writeText(false, ctx); case _FILE_WRITE_TEXT_LINES: return writeTextLines(false, ctx); default: return super.item(ctx, ii); } } catch(final IOException ex) { throw FILE_IO.thrw(info, ex); } } /** * Returns the last modified date of the specified path. * @param ctx query context * @return result * @throws QueryException query exception */ private Item lastModified(final QueryContext ctx) throws QueryException { final File path = checkFile(0, ctx); if(!path.exists()) FILE_WHICH.thrw(info, path.getAbsolutePath()); return new Dtm(path.lastModified(), info); } /** * Returns the size of the specified path. * @param ctx query context * @return result * @throws QueryException query exception */ private Item size(final QueryContext ctx) throws QueryException { final File path = checkFile(0, ctx); if(!path.exists()) FILE_WHICH.thrw(info, path.getAbsolutePath()); if(path.isDirectory()) FILE_DIR.thrw(info, path.getAbsolutePath()); return Int.get(path.length()); } /** * Returns the base name of the specified path. * @param ctx query context * @return result * @throws QueryException query exception */ private Str baseName(final QueryContext ctx) throws QueryException { final File path = checkFile(0, ctx); if(path.getPath().isEmpty()) return Str.get("."); final String suf = expr.length < 2 ? null : string(checkStr(expr[1], ctx)); String pth = path.getName(); if(suf != null && pth.endsWith(suf)) pth = pth.substring(0, pth.length() - suf.length()); return Str.get(pth); } /** * Returns the directory name of the specified path. * @param ctx query context * @return result * @throws QueryException query exception */ private Str dirName(final QueryContext ctx) throws QueryException { final File file = checkFile(0, ctx); String par = file.getParent(); if(par == null) par = file.toString().contains(File.separator) ? "" : "."; return Str.get(dir(par)); } /** * Returns the native name of the specified path. * @param ctx query context * @return result * @throws QueryException query exception */ private Str pathToNative(final QueryContext ctx) throws QueryException { final File path = checkFile(0, ctx); try { final String nat = path.getCanonicalFile().getPath(); return Str.get(path.isDirectory() ? dir(nat) : nat); } catch(final IOException ex) { throw FILE_PATH.thrw(info, path); } } /** * Transforms a file system path into a URI with the file:// scheme. * @param ctx query context * @return result * @throws QueryException query exception */ private Uri pathToUri(final QueryContext ctx) throws QueryException { return Uri.uri(checkFile(0, ctx).toURI().toString()); } /** * Returns an absolute file path. * @param ctx query context * @return result * @throws QueryException query exception */ private Str resolvePath(final QueryContext ctx) throws QueryException { final File path = checkFile(0, ctx); final String abs = path.getAbsolutePath(); return Str.get(path.isDirectory() ? dir(abs) : abs); } /** * Lists all files in a directory. * @param ctx query context * @return iterator * @throws QueryException query exception */ private Iter list(final QueryContext ctx) throws QueryException { // get canonical representation to resolve symbolic links File dir = checkFile(0, ctx); try { dir = new File(dir.getCanonicalPath()); } catch(final IOException ex) { throw FILE_PATH.thrw(info, dir); } // check if the addresses path is a directory if(!dir.isDirectory()) FILE_NODIR.thrw(info, dir); final boolean rec = optionalBool(1, ctx); final Pattern pat = expr.length != 3 ? null : Pattern.compile(IOFile.regex(string(checkStr(expr[2], ctx))), Prop.CASE ? 0 : Pattern.CASE_INSENSITIVE); final StringList list = new StringList(); final String p = dir.getPath(); final int l = p.length() + (p.endsWith(File.separator) ? 0 : 1); list(l, dir, list, rec, pat); return new Iter() { int c; @Override public Item next() { return c < list.size() ? Str.get(list.get(c++)) : null; } }; } /** * Collects the sub-directories and files of the specified directory. * @param root length of root path * @param dir root directory * @param list file list * @param rec recursive flag * @param pat file name pattern; ignored if {@code null} * @throws QueryException query exception */ private void list(final int root, final File dir, final StringList list, final boolean rec, final Pattern pat) throws QueryException { // skip invalid directories final File[] ch = dir.listFiles(); if(ch == null) return; // parse directories, do not follow links if(rec) { for(final File f : ch) { if(f.isDirectory() && !mayBeLink(f)) list(root, f, list, rec, pat); } } // parse files. ignore directories if a pattern is specified for(final File f : ch) { if(pat == null || pat.matcher(f.getName()).matches()) { final String file = f.getPath().substring(root); list.add(f.isDirectory() ? dir(file) : file); } } } /** * Checks if the specified file may be a symbolic link. * @param f file to check * @return result * @throws QueryException query exception */ private boolean mayBeLink(final File f) throws QueryException { try { final String p1 = f.getAbsolutePath(); final String p2 = f.getCanonicalPath(); return !(Prop.CASE ? p1.equals(p2) : p1.equalsIgnoreCase(p2)); } catch(final IOException ex) { throw FILE_PATH.thrw(info, f); } } /** * Creates a directory. * @param ctx query context * @return result * @throws QueryException query exception */ private synchronized Item createDir(final QueryContext ctx) throws QueryException { // resolve symbolic links final File path = checkFile(0, ctx); File f; try { f = path.getCanonicalFile(); } catch(final IOException ex) { throw FILE_PATH.thrw(info, path); } // find lowest existing path while(!f.exists()) { f = f.getParentFile(); if(f == null) throw FILE_PATH.thrw(info, path); } // warn if lowest path points to a file if(f.isFile()) FILE_EXISTS.thrw(info, path); // only create directories if path does not exist yet if(!path.exists() && !path.mkdirs()) FILE_CREATE.thrw(info, path); return null; } /** * Creates a temporary file or directory. * @param ctx query context * @param dir create a directory instead of a file * @return path of created file or directory * @throws QueryException query exception * @throws IOException I/O exception */ private synchronized Item createTemp(final boolean dir, final QueryContext ctx) throws QueryException, IOException { final String pref = string(checkStr(expr[0], ctx)); final String suf = string(checkStr(expr[1], ctx)); final File root; if(expr.length > 2) { root = checkFile(2, ctx); if(root.isFile()) FILE_NODIR.thrw(info, root); } else { root = new File(Prop.TMP); } // choose non-existing file path final Random rnd = new Random(); File file; do { file = new File(root, pref + rnd.nextLong() + suf); } while(file.exists()); // create directory or file String path = file.getPath(); if(dir) { if(!file.mkdirs()) FILE_CREATE.thrw(info, file); path = dir(path); } else { new IOFile(file).write(Token.EMPTY); } return Str.get(path); } /** * Deletes a file or directory. * @param ctx query context * @return result * @throws QueryException query exception */ private synchronized Item delete(final QueryContext ctx) throws QueryException { final File path = checkFile(0, ctx); if(!path.exists()) FILE_WHICH.thrw(info, path.getAbsolutePath()); if(optionalBool(1, ctx)) { deleteRec(path); } else if(!path.delete()) { throw (path.isDirectory() ? FILE_NEDIR : FILE_DEL).thrw(info, path); } return null; } /** * Recursively deletes a file path. * @param path path to be deleted * @throws QueryException query exception */ private synchronized void deleteRec(final File path) throws QueryException { final File[] ch = path.listFiles(); if(ch != null) for(final File f : ch) deleteRec(f); if(!path.delete()) FILE_DEL.thrw(info, path); } /** * Reads the contents of a binary file. * @param ctx query context * @return Base64Binary * @throws QueryException query exception */ private B64Stream readBinary(final QueryContext ctx) throws QueryException { final File path = checkFile(0, ctx); if(!path.exists()) FILE_WHICH.thrw(info, path.getAbsolutePath()); if(path.isDirectory()) FILE_DIR.thrw(info, path.getAbsolutePath()); return new B64Stream(new IOFile(path), FILE_IO); } /** * Reads the contents of a file. * @param ctx query context * @return string * @throws QueryException query exception */ private StrStream readText(final QueryContext ctx) throws QueryException { final File path = checkFile(0, ctx); final String enc = encoding(1, FILE_ENCODING, ctx); if(!path.exists()) FILE_WHICH.thrw(info, path.getAbsolutePath()); if(path.isDirectory()) FILE_DIR.thrw(info, path.getAbsolutePath()); return new StrStream(new IOFile(path), enc, FILE_IO, ctx); } /** * Returns the contents of a file line by line. * @param ctx query context * @return string * @throws QueryException query exception */ private Iter readTextLines(final QueryContext ctx) throws QueryException { return FNGen.textIter(readText(ctx).string(info)); } /** * Writes items to a file. * @param append append flag * @param ctx query context * @return true if file was successfully written * @throws QueryException query exception * @throws IOException I/O exception */ private synchronized Item write(final boolean append, final QueryContext ctx) throws QueryException, IOException { final File path = check(checkFile(0, ctx)); final Iter ir = expr[1].iter(ctx); final SerializerProp sp = FuncParams.serializerProp( expr.length > 2 ? expr[2].item(ctx, info) : null, info); final PrintOutput out = PrintOutput.get(new FileOutputStream(path, append)); try { final Serializer ser = Serializer.get(out, sp); for(Item it; (it = ir.next()) != null;) ser.serialize(it); ser.close(); } catch(final SerializerException ex) { throw ex.getCause(info); } finally { out.close(); } return null; } /** * Writes items to a file. * @param append append flag * @param ctx query context * @return true if file was successfully written * @throws QueryException query exception * @throws IOException I/O exception */ private synchronized Item writeText(final boolean append, final QueryContext ctx) throws QueryException, IOException { final File path = check(checkFile(0, ctx)); final byte[] s = checkStr(expr[1], ctx); final String enc = encoding(2, FILE_ENCODING, ctx); final Charset cs = enc == null || enc == UTF8 ? null : Charset.forName(enc); final PrintOutput out = PrintOutput.get(new FileOutputStream(path, append)); try { out.write(cs == null ? s : string(s).getBytes(cs)); } finally { out.close(); } return null; } /** * Writes items to a file. * @param append append flag * @param ctx query context * @return true if file was successfully written * @throws QueryException query exception * @throws IOException I/O exception */ private synchronized Item writeTextLines(final boolean append, final QueryContext ctx) throws QueryException, IOException { final File path = check(checkFile(0, ctx)); final Iter ir = expr[1].iter(ctx); final String enc = encoding(2, FILE_ENCODING, ctx); final Charset cs = enc == null || enc == UTF8 ? null : Charset.forName(enc); final PrintOutput out = PrintOutput.get(new FileOutputStream(path, append)); try { for(Item it; (it = ir.next()) != null;) { if(!it.type.isStringOrUntyped()) Err.type(this, AtomType.STR, it); final byte[] s = it.string(info); out.write(cs == null ? s : string(s).getBytes(cs)); out.write(cs == null ? NL : Prop.NL.getBytes(cs)); } } finally { out.close(); } return null; } /** * Writes binary items to a file. * @param append append flag * @param ctx query context * @return result * @throws QueryException query exception * @throws IOException I/O exception */ private synchronized Item writeBinary(final boolean append, final QueryContext ctx) throws QueryException, IOException { final File path = check(checkFile(0, ctx)); final Iter ir = expr[1].iter(ctx); final BufferOutput out = new BufferOutput(new FileOutputStream(path, append)); try { for(Item it; (it = ir.next()) != null;) { if(!(it instanceof Bin)) BINARYTYPE.thrw(info, it.type); final InputStream is = it.input(info); try { for(int i; (i = is.read()) != -1;) out.write(i); } finally { is.close(); } } } finally { out.close(); } return null; } /** * Checks the target directory of the specified file. * @param path file to be written * @return specified file * @throws QueryException query exception */ private File check(final File path) throws QueryException { final IOFile io = new IOFile(path); if(io.isDir()) FILE_DIR.thrw(info, io); final IOFile dir = io.dir(); if(!dir.exists()) FILE_NODIR.thrw(info, dir); return path; } /** * Transfers a file path, given a source and a target. * @param copy copy flag (no move) * @param ctx query context * @return result * @throws QueryException query exception * @throws IOException I/O exception */ private synchronized Item relocate(final boolean copy, final QueryContext ctx) throws QueryException, IOException { final File src = checkFile(0, ctx).getCanonicalFile(); File trg = checkFile(1, ctx).getCanonicalFile(); if(!src.exists()) FILE_WHICH.thrw(info, src.getAbsolutePath()); if(trg.isDirectory()) { // target is a directory: attach file name trg = new File(trg, src.getName()); if(trg.isDirectory()) FILE_DIR.thrw(info, trg); } else if(!trg.isFile()) { // target does not exist: ensure that parent exists if(!trg.getParentFile().isDirectory()) FILE_NODIR.thrw(info, trg); } else if(src.isDirectory()) { // if target is file, source cannot be a directory FILE_DIR.thrw(info, src); } // ignore operations on identical, canonical source and target path final String spath = src.getPath(); final String tpath = trg.getPath(); if(!spath.equals(tpath)) { if(copy) { copy(src, trg); } else { // delete target if it is different to source (case is ignored on Windows and Mac) if(trg.exists() && (Prop.CASE || !spath.equalsIgnoreCase(tpath)) && !trg.delete()) FILE_DEL.thrw(info, src, trg); if(!src.renameTo(trg)) FILE_MOVE.thrw(info, src, trg); } } return null; } /** * Recursively copies files. * @param src source path * @param trg target path * @throws QueryException query exception * @throws IOException I/O exception */ private synchronized void copy(final File src, final File trg) throws QueryException, IOException { if(src.isDirectory()) { if(!trg.mkdir()) FILE_CREATE.thrw(info, trg); final File[] files = src.listFiles(); if(files == null) FILE_LIST.thrw(info, src); for(final File f : files) copy(f, new File(trg, f.getName())); } else { new IOFile(src).copyTo(new IOFile(trg)); } } /** * Returns the value of an optional boolean. * @param i argument index * @param ctx query context * @return boolean value * @throws QueryException query exception */ private boolean optionalBool(final int i, final QueryContext ctx) throws QueryException { return i < expr.length && checkBln(expr[i], ctx); } /** * Attaches a directory separator to the specified directory string. * @param dir input string * @return directory string */ private static String dir(final String dir) { return dir.endsWith(File.separator) ? dir : dir + File.separator; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNFormat.java000066400000000000000000000067561222453003200256340ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.util.format.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Formatting functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNFormat extends StandardFunc { /** Pattern cache. */ private final TokenObjMap formats = new TokenObjMap(); /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNFormat(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { switch(sig) { case FORMAT_INTEGER: return formatInteger(ctx); case FORMAT_NUMBER: return formatNumber(ctx); case FORMAT_DATETIME: return formatDate(AtomType.DTM, ctx); case FORMAT_DATE: return formatDate(AtomType.DAT, ctx); case FORMAT_TIME: return formatDate(AtomType.TIM, ctx); default: return super.item(ctx, ii); } } /** * Returns a formatted integer. * @param ctx query context * @return string * @throws QueryException query exception */ private Str formatInteger(final QueryContext ctx) throws QueryException { final byte[] pic = checkStr(expr[1], ctx); final byte[] lng = expr.length == 2 ? EMPTY : checkStr(expr[2], ctx); if(expr[0].isEmpty()) return Str.ZERO; final long num = checkItr(expr[0], ctx); FormatParser fp = formats.get(pic); if(fp == null) { fp = new IntFormat(pic, info); formats.put(pic, fp); } return Str.get(Formatter.get(lng).formatInt(num, fp)); } /** * Returns a formatted number. * @param ctx query context * @return string * @throws QueryException query exception */ private Str formatNumber(final QueryContext ctx) throws QueryException { // evaluate arguments Item it = expr[0].item(ctx, info); if(it == null) it = Dbl.NAN; else if(!it.type.isNumberOrUntyped()) number(this, it); // retrieve picture final byte[] pic = checkStr(expr[1], ctx); // retrieve format declaration final QNm frm = expr.length == 3 ? new QNm(trim(checkEStr(expr[2], ctx)), ctx) : new QNm(EMPTY); final DecFormatter df = ctx.sc.decFormats.get(frm.id()); if(df == null) throw FORMNUM.thrw(info, frm); return Str.get(df.format(info, it, pic)); } /** * Returns a formatted number. * @param ctx query context * @param tp input type * @return string * @throws QueryException query exception */ private Item formatDate(final Type tp, final QueryContext ctx) throws QueryException { final Item it = expr[0].item(ctx, info); final byte[] pic = checkEStr(expr[1], ctx); final byte[] lng = expr.length == 5 ? checkEStr(expr[2], ctx) : EMPTY; final byte[] cal = expr.length == 5 ? checkEStr(expr[3], ctx) : EMPTY; final byte[] plc = expr.length == 5 ? checkEStr(expr[4], ctx) : EMPTY; if(it == null) return null; final ADate date = (ADate) checkType(it, tp); final Formatter form = Formatter.get(lng); return Str.get(form.formatDate(date, lng, pic, cal, plc, info)); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNFt.java000066400000000000000000000203561222453003200247450ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.func.Function.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import static org.basex.util.ft.FTFlag.*; import java.util.*; import org.basex.data.*; import org.basex.index.*; import org.basex.index.query.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.ft.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.ft.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * Full-text functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNFt extends StandardFunc { /** Element: options. */ private static final QNm Q_OPTIONS = QNm.get("options"); /** Marker element. */ private static final byte[] MARK = token("mark"); /** Fuzzy option. */ private static final byte[] FUZZY = token("fuzzy"); /** Wildcards option. */ private static final byte[] WILDCARDS = token("wildcards"); /** Search mode. */ private static final byte[] MODE = token("mode"); /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNFt(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { switch(sig) { case _FT_COUNT: return count(ctx); default: return super.item(ctx, ii); } } @Override public Iter iter(final QueryContext ctx) throws QueryException { switch(sig) { case _FT_SEARCH: return search(ctx); case _FT_SCORE: return score(ctx); case _FT_MARK: return mark(ctx, false); case _FT_EXTRACT: return mark(ctx, true); case _FT_TOKENS: return tokens(ctx); case _FT_TOKENIZE: return tokenize(ctx); default: return super.iter(ctx); } } /** * Performs the count function. * @param ctx query context * @return iterator * @throws QueryException query exception */ private Item count(final QueryContext ctx) throws QueryException { final FTPosData tmp = ctx.ftpos; ctx.ftpos = new FTPosData(); final Iter ir = ctx.iter(expr[0]); for(Item it; (it = ir.next()) != null;) checkDBNode(it); final int s = ctx.ftpos.size(); ctx.ftpos = tmp; return Int.get(s); } /** * Performs the mark function. * @param ctx query context * @param ex extract flag * @return iterator * @throws QueryException query exception */ private Iter mark(final QueryContext ctx, final boolean ex) throws QueryException { byte[] m = MARK; int l = ex ? 150 : Integer.MAX_VALUE; if(expr.length > 1) { // name of the marker element; default is m = checkStr(expr[1], ctx); if(!XMLToken.isQName(m)) Err.value(info, AtomType.QNM, m); } if(expr.length > 2) { l = (int) checkItr(expr[2], ctx); } final byte[] mark = m; final int len = l; return new Iter() { final FTPosData ftd = new FTPosData(); Iter ir; ValueIter vi; @Override public Item next() throws QueryException { while(true) { if(vi != null) { final Item it = vi.next(); if(it != null) return it; vi = null; } final FTPosData tmp = ctx.ftpos; try { ctx.ftpos = ftd; if(ir == null) ir = ctx.iter(expr[0]); final Item it = ir.next(); if(it == null) return null; // copy node to main memory data instance final MemData md = new MemData(ctx.context.prop); final DataBuilder db = new DataBuilder(md); db.ftpos(mark, ctx.ftpos, len).build(checkDBNode(it)); final IntList il = new IntList(); for(int p = 0; p < md.meta.size; p += md.size(p, md.kind(p))) il.add(p); vi = DBNodeSeq.get(il, md, false, false).iter(); } finally { ctx.ftpos = tmp; } } } }; } /** * Performs the score function. * @param ctx query context * @return iterator * @throws QueryException query exception */ private Iter score(final QueryContext ctx) throws QueryException { return new Iter() { final Iter iter = expr[0].iter(ctx); @Override public Dbl next() throws QueryException { final Item item = iter.next(); return item == null ? null : Dbl.get(item.score()); } }; } /** * Performs the search function. * @param ctx query context * @return iterator * @throws QueryException query exception */ private Iter search(final QueryContext ctx) throws QueryException { final Data data = checkData(ctx); final Value terms = ctx.value(expr[1]); final Item opt = expr.length > 2 ? expr[2].item(ctx, info) : null; final TokenMap tm = new FuncParams(Q_OPTIONS, info).parse(opt); return search(data, terms, tm, this, ctx); } /** * Performs an index-based search. * @param data data reference * @param terms query terms * @param map map with full-text options * @param fun calling function * @param ctx query context * @return iterator * @throws QueryException query exception */ static Iter search(final Data data, final Value terms, final TokenMap map, final StandardFunc fun, final QueryContext ctx) throws QueryException { final InputInfo info = fun.info; final IndexContext ic = new IndexContext(data, false); if(!data.meta.ftxtindex) BXDB_INDEX.thrw(info, data.meta.name, IndexType.FULLTEXT.toString().toLowerCase(Locale.ENGLISH)); final FTOpt tmp = ctx.ftOpt(); final FTOpt opt = new FTOpt().copy(data.meta); FTMode m = FTMode.ANY; if(map != null) { for(final byte[] k : map) { final byte[] v = map.get(k); if(eq(k, FUZZY)) { final boolean t = v.length == 0 || Util.yes(string(v)); opt.set(FZ, t); } else if(eq(k, WILDCARDS)) { final boolean t = v.length == 0 || Util.yes(string(v)); opt.set(WC, t); } else if(eq(k, MODE)) { m = FTMode.get(v); if(m == null) ELMOPTION.thrw(info, v); } else { ELMOPTION.thrw(info, k); } } } ctx.ftOpt(opt); final FTWords words = new FTWords(info, ic, terms, m, ctx); ctx.ftOpt(tmp); return new FTIndexAccess(info, words, ic).iter(ctx); } /** * Performs the tokens function. * @param ctx query context * @return iterator * @throws QueryException query exception */ private Iter tokens(final QueryContext ctx) throws QueryException { final Data data = checkData(ctx); byte[] entry = expr.length < 2 ? Token.EMPTY : checkStr(expr[1], ctx); if(entry.length != 0) { final FTLexer ftl = new FTLexer(new FTOpt().copy(data.meta)); ftl.init(entry); entry = ftl.nextToken(); } return FNIndex.entries(data, new IndexEntries(entry, IndexType.FULLTEXT), this); } /** * Performs the tokenize function. * @param ctx query context * @return iterator * @throws QueryException query exception */ private Iter tokenize(final QueryContext ctx) throws QueryException { final FTOpt opt = new FTOpt().copy(ctx.ftOpt()); final FTLexer ftl = new FTLexer(opt).init(checkStr(expr[0], ctx)); return new Iter() { @Override public Str next() { return ftl.hasNext() ? Str.get(ftl.nextToken()) : null; } }; } @Override public boolean iterable() { // index functions will always yield ordered and duplicate-free results return sig == Function._FT_SEARCH || super.iterable(); } @Override public boolean accept(final ASTVisitor visitor) { if(oneOf(sig, _FT_SEARCH, _FT_TOKENS) && !dataLock(visitor)) return false; return super.accept(visitor); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNFunc.java000066400000000000000000000142401222453003200252620ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.util.Err.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Functions on functions. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class FNFunc extends StandardFunc { /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNFunc(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Iter iter(final QueryContext ctx) throws QueryException { switch(sig) { case FOR_EACH: return forEach(ctx); case FILTER: return filter(ctx); case FOR_EACH_PAIR: return forEachPair(ctx); case FOLD_LEFT: return foldLeft(ctx); case FOLD_RIGHT: return foldRight(ctx); default: return super.iter(ctx); } } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { switch(sig) { case FUNCTION_ARITY: return Int.get(checkFunc(expr[0], ctx).arity()); case FUNCTION_NAME: return checkFunc(expr[0], ctx).fName(); case FUNCTION_LOOKUP: return lookup(ctx, ii); default: return super.item(ctx, ii); } } /** * Looks up the specified function item. * @param ctx query context * @param ii input info * @return function item * @throws QueryException query exception */ private Item lookup(final QueryContext ctx, final InputInfo ii) throws QueryException { final QNm name = checkQNm(expr[0], ctx); final long arity = checkItr(expr[1], ctx); if(arity < 0 || arity > Integer.MAX_VALUE) FUNCUNKNOWN.thrw(ii, name); try { final Expr lit = Functions.getLiteral(name, (int) arity, ctx, ii); return lit == null ? null : lit.item(ctx, ii); } catch(final QueryException e) { // function not found (in most cases: XPST0017) return null; } } /** * Maps a function onto a sequence of items. * @param ctx query context * @return sequence of results * @throws QueryException exception */ private Iter forEach(final QueryContext ctx) throws QueryException { final FItem f = withArity(1, 1, ctx); final Iter xs = expr[0].iter(ctx); return new Iter() { /** Results. */ Iter ys = Empty.ITER; @Override public Item next() throws QueryException { do { final Item it = ys.next(); if(it != null) return it; final Item x = xs.next(); if(x == null) return null; ys = f.invokeValue(ctx, info, x).iter(); } while(true); } }; } /** * Filters the given sequence with the given predicate. * @param ctx query context * @return filtered sequence * @throws QueryException query exception */ private Iter filter(final QueryContext ctx) throws QueryException { final FItem f = withArity(1, 1, ctx); final Iter xs = expr[0].iter(ctx); return new Iter() { @Override public Item next() throws QueryException { do { final Item it = xs.next(); if(it == null) return null; if(checkBln(checkNoEmpty(f.invokeItem(ctx, info, it)), ctx)) return it; } while(true); } }; } /** * Zips two sequences with the given zipper function. * @param ctx query context * @return sequence of results * @throws QueryException query exception */ private Iter forEachPair(final QueryContext ctx) throws QueryException { final FItem zipper = withArity(2, 2, ctx); final Iter xs = expr[0].iter(ctx); final Iter ys = expr[1].iter(ctx); return new Iter() { /** Results. */ Iter zs = Empty.ITER; @Override public Item next() throws QueryException { do { final Item it = zs.next(); if(it != null) return it; final Item x = xs.next(), y = ys.next(); if(x == null || y == null) return null; zs = zipper.invokeValue(ctx, info, x, y).iter(); } while(true); } }; } /** * Folds a sequence into a return value, starting from the left. * @param ctx query context * @return resulting sequence * @throws QueryException query exception */ private Iter foldLeft(final QueryContext ctx) throws QueryException { final FItem f = withArity(2, 2, ctx); final Iter xs = expr[0].iter(ctx); Item x = xs.next(); // don't convert to a value if not necessary if(x == null) return expr[1].iter(ctx); Value sum = ctx.value(expr[1]); do sum = f.invokeValue(ctx, info, sum, x); while((x = xs.next()) != null); return sum.iter(); } /** * Folds a sequence into a return value, starting from the left. * @param ctx query context * @return resulting sequence * @throws QueryException query exception */ private Iter foldRight(final QueryContext ctx) throws QueryException { final FItem f = withArity(2, 2, ctx); final Value xs = ctx.value(expr[0]); // evaluate start value lazily if it's passed straight through if(xs.isEmpty()) return expr[1].iter(ctx); Value res = ctx.value(expr[1]); for(long i = xs.size(); --i >= 0;) res = f.invokeValue(ctx, info, xs.itemAt(i), res); return res.iter(); } /** * Casts and checks the function item for its arity. * @param p position of the function * @param a arity * @param ctx query context * @return function item * @throws QueryException query exception */ private FItem withArity(final int p, final int a, final QueryContext ctx) throws QueryException { final Item it = checkItem(expr[p], ctx); if(it instanceof FItem) { final FItem fi = (FItem) it; if(fi.arity() == a) return fi; } throw Err.type(this, FuncType.arity(a), it); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNGen.java000066400000000000000000000274651222453003200251150ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.func.Function.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.io.*; import org.basex.build.xml.*; import org.basex.core.*; import org.basex.core.Context; import org.basex.io.*; import org.basex.io.in.*; import org.basex.io.out.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.up.primitives.*; import org.basex.query.util.*; import org.basex.query.util.Err.ErrType; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Generating functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNGen extends StandardFunc { /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNGen(final InputInfo ii, final Function f, final Expr[] e) { super(ii, f, e); } @Override public Iter iter(final QueryContext ctx) throws QueryException { switch(sig) { case DATA: return dataa(ctx); case COLLECTION: return collection(ctx).iter(); case URI_COLLECTION: return uriCollection(ctx); case UNPARSED_TEXT_LINES: return unparsedTextLines(ctx); default: return super.iter(ctx); } } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { switch(sig) { case DOC: return doc(ctx); case DOC_AVAILABLE: return docAvailable(ctx); case UNPARSED_TEXT: return unparsedText(ctx, false); case UNPARSED_TEXT_AVAILABLE: return unparsedText(ctx, true); case PUT: return put(ctx); case PARSE_XML: return parseXml(ctx, false); case PARSE_XML_FRAGMENT: return parseXml(ctx, true); case SERIALIZE: return serialize(ctx); default: return super.item(ctx, ii); } } @Override public Value value(final QueryContext ctx) throws QueryException { switch(sig) { case COLLECTION: return collection(ctx); default: return super.value(ctx); } } @Override protected Expr opt(final QueryContext ctx) throws QueryException { if(sig == Function.DATA && expr.length == 1) { final SeqType t = expr[0].type(); type = t.type.isNode() ? SeqType.get(AtomType.ATM, t.occ) : t; } return this; } /** * Performs the data function. * @param ctx query context * @return resulting iterator * @throws QueryException query exception */ private Iter dataa(final QueryContext ctx) throws QueryException { final Iter ir = ctx.iter(expr.length != 0 ? expr[0] : checkCtx(ctx)); return new Iter() { @Override public Item next() throws QueryException { final Item it = ir.next(); if(it == null) return null; if(it instanceof FItem) FIATOM.thrw(info, FNGen.this); return atom(it, info); } }; } /** * Performs the collection function. * @param ctx query context * @return result * @throws QueryException query exception */ private Value collection(final QueryContext ctx) throws QueryException { // return default collection if(expr.length == 0) return ctx.resource.collection(info); // check if reference is valid final byte[] in = checkEStr(expr[0].item(ctx, info)); if(!Uri.uri(in).isValid()) INVCOLL.thrw(info, in); return ctx.resource.collection(string(in), info); } /** * Performs the uri-collection function. * @param ctx query context * @return result * @throws QueryException query exception */ private Iter uriCollection(final QueryContext ctx) throws QueryException { final Iter coll = collection(ctx).iter(); return new Iter() { @Override public Item next() throws QueryException { final Item it = coll.next(); // all items will be nodes return it == null ? null : Uri.uri(((ANode) it).baseURI(), false); } }; } /** * Performs the put function. * @param ctx query context * @return result * @throws QueryException query exception */ private Item put(final QueryContext ctx) throws QueryException { checkCreate(ctx); final byte[] file = checkEStr(expr[1], ctx); final ANode nd = checkNode(expr[0], ctx); if(nd.type != NodeType.DOC && nd.type != NodeType.ELM) UPFOTYPE.thrw(info, expr[0]); final Uri u = Uri.uri(file); if(u == Uri.EMPTY || !u.isValid()) UPFOURI.thrw(info, file); final DBNode target = ctx.updates.determineDataRef(nd, ctx); final String uri = IO.get(u.toJava()).path(); // check if all target paths are unique if(!ctx.updates.putPaths.add(uri)) UPURIDUP.thrw(info, uri); ctx.updates.add(new Put(info, target.pre, target.data, uri), ctx); return null; } /** * Performs the doc function. * @param ctx query context * @return result * @throws QueryException query exception */ private ANode doc(final QueryContext ctx) throws QueryException { final Item it = expr[0].item(ctx, info); if(it == null) return null; final byte[] in = checkEStr(it); if(!Uri.uri(in).isValid()) INVDOC.thrw(info, in); return ctx.resource.doc(new QueryInput(string(in)), info); } /** * Performs the doc-available function. * @param ctx query context * @return result * @throws QueryException query exception */ private Bln docAvailable(final QueryContext ctx) throws QueryException { try { return Bln.get(doc(ctx) != null); } catch(final QueryException ex) { final Err err = ex.err(); if(err != null && err.type == ErrType.FODC && (err.num == 2 || err.num == 4)) return Bln.FALSE; throw ex; } } /** * Performs the unparsed-text function. * @param ctx query context * @param check only check if text is available * @return content * @throws QueryException query exception */ private Item unparsedText(final QueryContext ctx, final boolean check) throws QueryException { checkCreate(ctx); final byte[] path = checkStr(expr[0], ctx); final IO base = ctx.sc.baseIO(); if(base == null) throw STBASEURI.thrw(info); String enc = null; try { enc = encoding(1, WHICHENC, ctx); final String p = string(path); if(p.indexOf('#') != -1) FRAGID.thrw(info, p); if(!Uri.uri(p).isValid()) INVURL.thrw(info, p); IO io = base.merge(p); final String[] rp = ctx.resource.resources.get(io.path()); if(rp != null && rp.length > 0) { io = IO.get(rp[0]); if(rp.length > 1) enc = rp[1]; } if(!io.exists()) RESNF.thrw(info, p); final InputStream is = io.inputStream(); try { final TextInput ti = new TextInput(io).encoding(enc).validate(true); if(!check) return Str.get(ti.content()); while(ti.read() != -1); return Bln.TRUE; } finally { is.close(); } } catch(final QueryException ex) { if(check && ex.err().type != ErrType.XPTY) return Bln.FALSE; throw ex; } catch(final IOException ex) { if(check) return Bln.FALSE; if(ex instanceof InputException) { if(ex instanceof EncodingException || enc != null) INVCHARS.thrw(info, ex); else WHICHCHARS.thrw(info, ex); } throw RESNF.thrw(info, path); } } /** * Performs the unparsed-text-lines function. * @param ctx query context * @return result * @throws QueryException query exception */ Iter unparsedTextLines(final QueryContext ctx) throws QueryException { return textIter(unparsedText(ctx, false).string(info)); } /** * Returns the specified text as lines. * @param str text input * @return result */ static Iter textIter(final byte[] str) { // not I/O exception expected, as input is a main-memory array try { final NewlineInput nli = new NewlineInput(new ArrayInput(str)); final TokenBuilder tb = new TokenBuilder(); return new Iter() { @Override public Item next() { try { return nli.readLine(tb) ? Str.get(tb.finish()) : null; } catch(final IOException ex) { throw Util.notexpected(ex); } } }; } catch(final IOException ex) { throw Util.notexpected(ex); } } /** * Returns a document node for the parsed XML input. * @param ctx query context * @param frag parse fragment * @return result * @throws QueryException query exception */ private ANode parseXml(final QueryContext ctx, final boolean frag) throws QueryException { final Item item = expr[0].item(ctx, info); if(item == null) return null; try { final IO io = new IOContent(checkStr(item), string(ctx.sc.baseURI().string())); return parseXml(io, ctx.context, frag); } catch(final IOException ex) { throw SAXERR.thrw(info, ex); } } /** * Performs the serialize function. * @param ctx query context * @return result * @throws QueryException query exception */ private Str serialize(final QueryContext ctx) throws QueryException { final ArrayOutput ao = new ArrayOutput(); try { // run serialization Item it = expr.length > 1 ? expr[1].item(ctx, info) : null; final Serializer ser = Serializer.get(ao, FuncParams.serializerProp(it, info)); final Iter ir = expr[0].iter(ctx); while((it = ir.next()) != null) ser.serialize(it); ser.close(); } catch(final SerializerException ex) { throw ex.getCause(info); } catch(final IOException ex) { SERANY.thrw(info, ex); } return Str.get(ao.toArray()); } @Override public boolean has(final Flag flag) { return (flag == Flag.X30 || flag == Flag.CTX) && sig == DATA && expr.length == 0 || super.has(flag); } @Override public boolean accept(final ASTVisitor visitor) { if(oneOf(sig, DATA) && expr.length == 0) { if(!visitor.lock(DBLocking.CTX)) return false; } else if(oneOf(sig, DOC_AVAILABLE, DOC, COLLECTION, URI_COLLECTION)) { if(expr.length == 0) { if(oneOf(sig, COLLECTION, URI_COLLECTION) && !visitor.lock(DBLocking.COLL)) return false; } else if(!(expr[0] instanceof Str)) { if(!visitor.lock(null)) return false; } else { final QueryInput qi = new QueryInput(string(((Str) expr[0]).string())); if(qi.db == null && !visitor.lock(null)) return false; if(!visitor.lock(qi.db)) return false; } } return super.accept(visitor); } @Override public boolean iterable() { // collections will never yield duplicates return sig == COLLECTION || super.iterable(); } /** * Returns a document node for the parsed XML input. * @param input string to be parsed * @param ctx query context * @param frag parse fragment * @return result * @throws IOException I/O exception */ public static ANode parseXml(final IO input, final Context ctx, final boolean frag) throws IOException { final Prop prop = ctx.prop; final boolean chop = prop.is(Prop.CHOP); try { prop.set(Prop.CHOP, false); return new DBNode(frag || prop.is(Prop.INTPARSE) ? new XMLParser(input, ctx.prop, frag) : new SAXWrapper(input, ctx.prop)); } finally { prop.set(Prop.CHOP, chop); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNHash.java000066400000000000000000000042401222453003200252510ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.util.Err.*; import java.security.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * Hashing functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNHash extends StandardFunc { /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNHash(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { switch(sig) { case _HASH_MD5: return hash("MD5", ctx); case _HASH_SHA1: return hash("SHA", ctx); case _HASH_SHA256: return hash("SHA-256", ctx); case _HASH_HASH: return hash(ctx); default: return super.item(ctx, ii); } } /** * Creates the hash of the given xs:string. * @param ctx query context * @return xs:hexBinary instance containing the hash * @throws QueryException exception */ private B64 hash(final QueryContext ctx) throws QueryException { return hash(Token.string(checkStr(expr[1], ctx)), ctx); } /** * Creates the hash of a string, using the given algorithm. * @param algo hashing algorithm * @param ctx query context * @return xs:hexBinary instance containing the hash * @throws QueryException exception */ private B64 hash(final String algo, final QueryContext ctx) throws QueryException { return hashBinary(checkStrBin(checkItem(expr[0], ctx)), algo); } /** * Creates the hash of the given xs:string, using the algorithm {@code algo}. * @param val value to be hashed * @param algo hashing algorithm * @return xs:hexBinary instance containing the hash * @throws QueryException exception */ private B64 hashBinary(final byte[] val, final String algo) throws QueryException { try { return new B64(MessageDigest.getInstance(algo).digest(val)); } catch(final NoSuchAlgorithmException ex) { throw HASH_ALG.thrw(info, algo); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNHof.java000066400000000000000000000163041222453003200251060ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.func.Function.*; import java.util.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Implementation-specific functions on functions. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class FNHof extends StandardFunc { /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNHof(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Iter iter(final QueryContext ctx) throws QueryException { switch(sig) { case _HOF_SORT_WITH: return sortWith(ctx).iter(); case _HOF_ID: case _HOF_CONST: return ctx.iter(expr[0]); case _HOF_FOLD_LEFT1: return foldLeft1(ctx).iter(); case _HOF_UNTIL: return until(ctx).iter(); case _HOF_TOP_K_BY: return topKBy(ctx).iter(); case _HOF_TOP_K_WITH: return topKWith(ctx).iter(); default: return super.iter(ctx); } } @Override public Value value(final QueryContext ctx) throws QueryException { switch(sig) { case _HOF_SORT_WITH: return sortWith(ctx); case _HOF_FOLD_LEFT1: return foldLeft1(ctx); case _HOF_UNTIL: return until(ctx); case _HOF_ID: case _HOF_CONST: return ctx.value(expr[0]); case _HOF_TOP_K_BY: return topKBy(ctx); case _HOF_TOP_K_WITH: return topKWith(ctx); default: return super.value(ctx); } } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { switch(sig) { case _HOF_ID: case _HOF_CONST: return expr[0].item(ctx, ii); default: return super.item(ctx, ii); } } @Override protected Expr opt(final QueryContext ctx) throws QueryException { return oneOf(sig, _HOF_ID, _HOF_CONST) ? expr[0] : this; } /** * Folds a sequence into a return value, starting from the left and using the * leftmost item as start value. * @param ctx query context * @return resulting sequence * @throws QueryException query exception */ private Value foldLeft1(final QueryContext ctx) throws QueryException { final FItem f = withArity(1, 2, ctx); final Iter xs = expr[0].iter(ctx); Value sum = checkNoEmpty(xs.next()); for(Item x; (x = xs.next()) != null;) sum = f.invokeValue(ctx, info, sum, x); return sum; } /** * Sorts the input sequence according to the given relation. * @param ctx query context * @return sorted sequence * @throws QueryException query exception */ private Value sortWith(final QueryContext ctx) throws QueryException { final Value v = expr[0].value(ctx); final Comparator cmp = getComp(1, ctx); if(v.size() < 2) return v; final ValueBuilder vb = v.cache(); try { Arrays.sort(vb.item, 0, (int) vb.size(), cmp); } catch(final QueryRTException ex) { throw ex.getCause(); } return vb.value(); } /** * Applies a function to a start value until the given predicate holds. * @param ctx query context * @return accepted value * @throws QueryException exception */ private Value until(final QueryContext ctx) throws QueryException { final FItem pred = withArity(0, 1, ctx); final FItem fun = withArity(1, 1, ctx); Value v = ctx.value(expr[2]); while(!checkBln(checkNoEmpty(pred.invokeItem(ctx, info, v)), ctx)) { v = fun.invokeValue(ctx, info, v); } return v; } /** * The best k elements of the input sequence according to a sort key. * @param ctx query context * @return best k elements * @throws QueryException query exception */ private Value topKBy(final QueryContext ctx) throws QueryException { final FItem getKey = withArity(1, 1, ctx); final long k = checkItr(expr[2], ctx); if(k < 1 || k > Integer.MAX_VALUE / 2) return Empty.SEQ; final Iter iter = expr[0].iter(ctx); final MinHeap heap = new MinHeap((int) k, new Comparator() { @Override public int compare(final Item it1, final Item it2) { try { return CmpV.OpV.LT.eval(it1, it2, ctx.sc.collation, info) ? -1 : 1; } catch(final QueryException qe) { throw new QueryRTException(qe); } } }); try { for(Item it; (it = iter.next()) != null;) { heap.insert(checkNoEmpty(getKey.invokeItem(ctx, info, it)), it); if(heap.size() > k) heap.removeMin(); } } catch(final QueryRTException ex) { throw ex.getCause(); } final Item[] arr = new Item[heap.size()]; for(int i = arr.length; --i >= 0;) arr[i] = heap.removeMin(); return Seq.get(arr, arr.length); } /** * The best k elements of the input sequence according to a less-than predicate. * @param ctx query context * @return best k elements * @throws QueryException query exception */ private Value topKWith(final QueryContext ctx) throws QueryException { final Comparator cmp = getComp(1, ctx); final long k = checkItr(expr[2], ctx); if(k < 1 || k > Integer.MAX_VALUE / 2) return Empty.SEQ; final Iter iter = expr[0].iter(ctx); final MinHeap heap = new MinHeap((int) k, cmp); try { for(Item it; (it = iter.next()) != null;) { heap.insert(it, it); if(heap.size() > k) heap.removeMin(); } } catch(final QueryRTException ex) { throw ex.getCause(); } final Item[] arr = new Item[heap.size()]; for(int i = arr.length; --i >= 0;) arr[i] = heap.removeMin(); return Seq.get(arr, arr.length); } /** * Gets a comparator from a less-than predicate as function item. * The {@link Comparator#compare(Object, Object)} method throws a * {@link QueryRTException} if the comparison throws a {@link QueryException}. * @param pos argument position of the predicate * @param ctx query context * @return comparator * @throws QueryException exception */ private Comparator getComp(final int pos, final QueryContext ctx) throws QueryException { final FItem lt = withArity(pos, 2, ctx); return new Comparator() { @Override public int compare(final Item a, final Item b) { try { return checkType(lt.invokeItem(ctx, info, a == null ? Empty.SEQ : a, b == null ? Empty.SEQ : b), AtomType.BLN).bool(info) ? -1 : 1; } catch(final QueryException qe) { throw new QueryRTException(qe); } } }; } /** * Casts and checks the function item for its arity. * @param p position of the function * @param a arity * @param ctx query context * @return function item * @throws QueryException query exception */ private FItem withArity(final int p, final int a, final QueryContext ctx) throws QueryException { final Item f = checkItem(expr[p], ctx); if(!(f instanceof FItem) || ((FItem) f).arity() != a) Err.type(this, FuncType.arity(a), f); return (FItem) f; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNHtml.java000066400000000000000000000036501222453003200252760ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import java.io.*; import org.basex.build.file.*; import org.basex.io.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Functions for converting HTML to XML. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNHtml extends StandardFunc { /** QName. */ private static final QNm Q_OPTIONS = QNm.get("options", HTMLURI); /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNHtml(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { switch(sig) { case _HTML_PARSER: return Str.get(HTMLParser.parser()); case _HTML_PARSE: return parse(ctx); default: return super.item(ctx, ii); } } /** * Converts HTML input to XML and returns a document node. * @param ctx query context * @return document node * @throws QueryException query exception */ private DBNode parse(final QueryContext ctx) throws QueryException { final byte[] in = checkStrBin(checkItem(expr[0], ctx)); final IO io = new IOContent(in); // bind parameters final Item opt = expr.length > 1 ? expr[1].item(ctx, info) : null; final TokenMap map = new FuncParams(Q_OPTIONS, info).parse(opt); final TokenBuilder tb = new TokenBuilder(); for(final byte[] key : map) tb.add(key).add('=').add(map.get(key)).add(','); // convert html try { return new DBNode(new HTMLParser(io, tb.toString(), ctx.context.prop)); } catch(final IOException ex) { throw BXHL_IO.thrw(info, ex); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNHttp.java000066400000000000000000000024371222453003200253130ustar00rootroot00000000000000package org.basex.query.func; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.http.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.util.*; /** * HTTP Client Module. * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ public final class FNHttp extends StandardFunc { /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNHttp(final InputInfo ii, final Function f, final Expr[] e) { super(ii, f, e); } @Override public Iter iter(final QueryContext ctx) throws QueryException { checkCreate(ctx); // get request node final Item req = expr[0].item(ctx, info); final ANode request = req == null ? null : checkNode(req); // get HTTP URI final byte[] href = expr.length >= 2 ? checkEStr(expr[1].item(ctx, info)) : null; // get parameter $bodies ValueBuilder cache = null; if(expr.length == 3) { final Iter bodies = expr[2].iter(ctx); cache = new ValueBuilder(); for(Item i; (i = bodies.next()) != null;) cache.add(i); } // send HTTP request return new HTTPClient(info, ctx.context.prop).sendRequest(href, request, cache); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNId.java000066400000000000000000000137301222453003200247260ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.list.*; /** * ID functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNId extends StandardFunc { /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNId(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Iter iter(final QueryContext ctx) throws QueryException { // functions have 1 or 2 arguments... final ANode node = checkNode(expr.length == 2 ? expr[1] : checkCtx(ctx), ctx); switch(sig) { case ID: return id(ctx.iter(expr[0]), node); case IDREF: return idref(ctx.iter(expr[0]), node); case ELEMENT_WITH_ID: return elid(ctx.iter(expr[0]), node); default: return super.iter(ctx); } } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { // functions have 1 or 2 arguments... final ANode node = checkNode(expr.length == 2 ? expr[1] : checkCtx(ctx), ctx); switch(sig) { case LANG: return lang(lc(checkEStr(expr[0], ctx)), node); default: return super.item(ctx, ii); } } /** * Returns the parent result of the ID function. * @param it item ids to be found * @param node attribute * @return resulting node list * @throws QueryException query exception */ private Iter elid(final Iter it, final ANode node) throws QueryException { return id(it, node); /* final NodeCache nc = id(it, node); final NodeCache res = new NodeCache().random(); for(ANode n; (n = nc.next()) != null;) res.add(n.parent()); return res; */ } /** * Returns the result of the ID function. * @param it item ids to be found * @param node attribute * @return resulting node list * @throws QueryException query exception */ private NodeSeqBuilder id(final Iter it, final ANode node) throws QueryException { final NodeSeqBuilder nc = new NodeSeqBuilder().check(); add(ids(it), nc, checkRoot(node)); return nc; } /** * Returns the result of the IDREF function. * @param it item ids to be found * @param node attribute * @return resulting node list * @throws QueryException query exception */ private Iter idref(final Iter it, final ANode node) throws QueryException { final NodeSeqBuilder nb = new NodeSeqBuilder().check(); addRef(ids(it), nb, checkRoot(node)); return nb; } /** * Returns the result of the language function. * @param lang language to be found * @param node attribute * @return resulting node list */ private static Bln lang(final byte[] lang, final ANode node) { for(ANode n = node; n != null; n = n.parent()) { final AxisIter atts = n.attributes(); for(ANode at; (at = atts.next()) != null;) { if(eq(at.qname().string(), LANG)) { final byte[] ln = lc(norm(at.string())); return Bln.get(startsWith(ln, lang) && (lang.length == ln.length || ln[lang.length] == '-')); } } } return Bln.FALSE; } /** * Extracts the ids from the specified iterator. * @param iter iterator * @return ids * @throws QueryException query exception */ private byte[][] ids(final Iter iter) throws QueryException { final TokenList tl = new TokenList(); for(Item id; (id = iter.next()) != null;) { for(final byte[] i : split(norm(checkEStr(id)), ' ')) tl.add(i); } return tl.toArray(); } /** * Adds nodes with the specified id. * @param ids ids to be found * @param nc node cache * @param node node */ private static void add(final byte[][] ids, final NodeSeqBuilder nc, final ANode node) { AxisIter ai = node.attributes(); for(ANode at; (at = ai.next()) != null;) { final byte[] val = at.string(); // [CG] XQuery: ID-IDREF Parsing for(final byte[] id : ids) { if(!eq(val, id)) continue; final byte[] nm = lc(at.qname().string()); if(contains(nm, ID) && !contains(nm, IDREF)) nc.add(node); } } ai = node.children(); for(ANode att; (att = ai.next()) != null;) add(ids, nc, att.finish()); } /** * Adds nodes with the specified id. * @param ids ids to be found * @param nc node cache * @param node node */ private static void addRef(final byte[][] ids, final NodeSeqBuilder nc, final ANode node) { AxisIter ai = node.attributes(); for(ANode at; (at = ai.next()) != null;) { final byte[] val = at.string(); // [CG] XQuery: ID-IDREF Parsing for(final byte[] id : ids) { if(!eq(val, id)) continue; final byte[] nm = lc(at.qname().string()); if(contains(nm, IDREF)) nc.add(at.finish()); } } ai = node.children(); for(ANode att; (att = ai.next()) != null;) addRef(ids, nc, att.finish()); } /** * Checks if the specified node has a document node as root. * @param node input node * @return specified node * @throws QueryException query exception */ private ANode checkRoot(final ANode node) throws QueryException { if(node instanceof FNode) { ANode n = node; while(n.type != NodeType.DOC) { n = n.parent(); if(n == null) throw IDDOC.thrw(info); } } return node; } @Override public boolean has(final Flag flag) { return flag == Flag.CTX && expr.length == 1 || super.has(flag); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNIndex.java000066400000000000000000000161141222453003200254400ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.util.*; import org.basex.data.*; import org.basex.index.*; import org.basex.index.name.*; import org.basex.index.path.*; import org.basex.index.query.*; import org.basex.index.stats.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Index functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Andreas Weiler */ public final class FNIndex extends StandardFunc { /** Name: name. */ static final String NAME = "name"; /** Name: type. */ static final String TYPE = "type"; /** Name: count. */ static final String COUNT = "count"; /** Name: value. */ static final String ENTRY = "entry"; /** Name: min. */ static final String MIN = "min"; /** Name: max. */ static final String MAX = "max"; /** Name: elements. */ static final byte[] ELM = NodeType.ELM.string(); /** Name: attributes. */ static final byte[] ATT = NodeType.ATT.string(); /** Flag: flat output. */ static final byte[] FLAT = token("flat"); /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNIndex(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { switch(sig) { case _INDEX_FACETS: return facets(ctx); default: return super.item(ctx, ii); } } @Override public Iter iter(final QueryContext ctx) throws QueryException { switch(sig) { case _INDEX_TEXTS: return values(ctx, IndexType.TEXT); case _INDEX_ATTRIBUTES: return values(ctx, IndexType.ATTRIBUTE); case _INDEX_ELEMENT_NAMES: return names(ctx, IndexType.TAG); case _INDEX_ATTRIBUTE_NAMES: return names(ctx, IndexType.ATTNAME); default: return super.iter(ctx); } } /** * Returns facet information about a database. * @param ctx query context * @return facet information * @throws QueryException query exception */ private Item facets(final QueryContext ctx) throws QueryException { final Data data = checkData(ctx); final boolean flat = expr.length == 2 && eq(checkStr(expr[1], ctx), FLAT); return new FDoc().add(flat ? flat(data) : tree(data, data.paths.root().get(0))); } /** * Returns all entries of the specified value index. * @param ctx query context * @param it index type * @return text entries * @throws QueryException query exception */ private Iter values(final QueryContext ctx, final IndexType it) throws QueryException { final Data data = checkData(ctx); final byte[] entry = expr.length < 2 ? Token.EMPTY : checkStr(expr[1], ctx); if(data.inMemory()) BXDB_MEM.thrw(info, data.meta.name); final IndexEntries et = expr.length < 3 ? new IndexEntries(entry, it) : new IndexEntries(entry, checkBln(expr[2], ctx), it); return entries(data, et, this); } /** * Returns all entries of the specified value index. * @param data data reference * @param entries container for returning index entries * @param call calling function * @return text entries * @throws QueryException query exception */ static Iter entries(final Data data, final IndexEntries entries, final StandardFunc call) throws QueryException { final Index index; final boolean avl; final IndexType it = entries.type(); if(it == IndexType.TEXT) { index = data.txtindex; avl = data.meta.textindex; } else if(it == IndexType.ATTRIBUTE) { index = data.atvindex; avl = data.meta.attrindex; } else { index = data.ftxindex; avl = data.meta.ftxtindex; } if(!avl) BXDB_INDEX.thrw(call.info, data.meta.name, it.toString().toLowerCase(Locale.ENGLISH)); return entries(index, entries); } /** * Returns all entries of the specified name index. * @param ctx query context * @param it index type * @return text entries * @throws QueryException query exception */ private Iter names(final QueryContext ctx, final IndexType it) throws QueryException { final Data data = checkData(ctx); return entries(it == IndexType.TAG ? data.tagindex : data.atnindex, new IndexEntries(Token.EMPTY, it)); } /** * Returns all entries of the specified index. * @param index index * @param entries entries token * @return entry iterator */ private static Iter entries(final Index index, final IndexEntries entries) { return new Iter() { final EntryIterator ei = index.entries(entries); @Override public ANode next() { final byte[] token = ei.next(); return token == null ? null : new FElem(ENTRY).add(COUNT, token(ei.count())).add(token); } }; } /** * Returns a flat facet representation. * @param data data reference * @return element */ private static FElem flat(final Data data) { final FElem elem = new FElem(new QNm(NodeType.DOC.string())); index(data.tagindex, ELM, elem); index(data.atnindex, ATT, elem); return elem; } /** * Evaluates name index information. * @param names name index * @param name element name * @param root root node */ private static void index(final Names names, final byte[] name, final FElem root) { final int ns = names.size(); for(int n = 1; n <= ns; n++) { final FElem sub = new FElem(name).add(NAME, names.key(n)); stats(names.stat(n), sub); root.add(sub); } } /** * Returns tree facet representation. * @param data data reference * @param root root node * @return element */ private static FElem tree(final Data data, final PathNode root) { final FElem elem = new FElem(new QNm(ANode.type(root.kind).string())); final boolean elm = root.kind == Data.ELEM; final Names names = elm ? data.tagindex : data.atnindex; if(root.kind == Data.ATTR || elm) elem.add(NAME, names.key(root.name)); stats(root.stats, elem); for(final PathNode p : root.ch) elem.add(tree(data, p)); return elem; } /** * Attaches statistical information to the specified element. * @param stats statistics * @param elem element */ private static void stats(final Stats stats, final FElem elem) { final String k = stats.type.toString().toLowerCase(Locale.ENGLISH); elem.add(TYPE, k); elem.add(COUNT, token(stats.count)); switch(stats.type) { case CATEGORY: for(final byte[] c : stats.cats) { elem.add(new FElem(ENTRY).add(COUNT, token(stats.cats.get(c))).add(c)); } break; case DOUBLE: case INTEGER: elem.add(MIN, token(stats.min)); elem.add(MAX, token(stats.max)); break; default: break; } } @Override public boolean accept(final ASTVisitor visitor) { return dataLock(visitor) && super.accept(visitor); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNInfo.java000066400000000000000000000102621222453003200252620ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.func.Function.*; import static org.basex.query.util.Err.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * Info functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNInfo extends StandardFunc { /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNInfo(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Iter iter(final QueryContext ctx) throws QueryException { switch(sig) { case ERROR: return error(ctx); case TRACE: return trace(ctx); case AVAILABLE_ENVIRONMENT_VARIABLES: return avlEnvVars(); default: return super.iter(ctx); } } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { switch(sig) { case ENVIRONMENT_VARIABLE: return envVar(ctx); default: return super.item(ctx, ii); } } @Override protected Expr opt(final QueryContext ctx) throws QueryException { if(sig == Function.TRACE) type = expr[0].type(); return this; } /** * Performs the error function. * @param ctx query context * @return dummy iterator * @throws QueryException query exception */ private Iter error(final QueryContext ctx) throws QueryException { final int al = expr.length; if(al == 0) FUNERR1.thrw(info); QNm name = FUNERR1.qname(); String msg = FUNERR1.desc; final Item it = expr[0].item(ctx, info); if(it == null) { if(al == 1) INVEMPTY.thrw(info, description()); } else { name = checkQNm(it, ctx); } if(al > 1) msg = Token.string(checkEStr(expr[1], ctx)); final Value val = al > 2 ? ctx.value(expr[2]) : null; throw new QueryException(info, name, msg).value(val); } /** * Performs the trace function. * @param ctx query context * @return iterator * @throws QueryException query exception */ private Iter trace(final QueryContext ctx) throws QueryException { return new Iter() { final Iter ir = expr[0].iter(ctx); final byte[] s = checkStr(expr[1], ctx); @Override public Item next() throws QueryException { final Item it = ir.next(); if(it != null) dump(it.serialize().toArray(), s, ctx); return it; } }; } /** * Returns all environment variables. * @return iterator */ private static ValueIter avlEnvVars() { final ValueBuilder vb = new ValueBuilder(); for(final Object k : System.getenv().keySet()) vb.add(Str.get(k.toString())); return vb; } /** * Returns a environment variable. * @param ctx query context * @return iterator * @throws QueryException query exception */ private Str envVar(final QueryContext ctx) throws QueryException { final String e = System.getenv(Token.string(checkStr(expr[0], ctx))); return e != null ? Str.get(e) : null; } /** * Dumps the specified info to standard error or the info view of the GUI. * @param value traced value * @param label additional label to display (can be {@code null}) * @param ctx query context */ public static void dump(final byte[] value, final byte[] label, final QueryContext ctx) { final TokenBuilder tb = new TokenBuilder(); if(label != null) tb.add(label); tb.add(value); final String info = tb.toString(); // if GUI is used or client is calling, cache trace info if(ctx.listen != null || ctx.context.listener != null) { ctx.evalInfo(info); if(ctx.listen != null) ctx.listen.info(info); } else { Util.errln(info); } } /** * Creates an error function instance. * @param ex query exception * @return function */ public static FNInfo error(final QueryException ex) { return new FNInfo(ex.info(), ERROR, ex.qname(), Str.get(ex.getLocalizedMessage())); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNInspect.java000066400000000000000000000057411222453003200260020ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.util.Token.*; import org.basex.io.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.inspect.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * Inspect functions. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class FNInspect extends StandardFunc { /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNInspect(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Iter iter(final QueryContext ctx) throws QueryException { switch(sig) { case _INSPECT_FUNCTIONS: return contextFunctions(ctx); default: return super.iter(ctx); } } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { switch(sig) { case _INSPECT_FUNCTION: return function(ctx); case _INSPECT_MODULE: return module(ctx); case _INSPECT_CONTEXT: return context(ctx); case _INSPECT_XQDOC: return xqdoc(ctx); default: return super.item(ctx, ii); } } /** * Performs the function function. * @param ctx query context * @return resulting value * @throws QueryException query exception */ private Item function(final QueryContext ctx) throws QueryException { final FItem f = checkFunc(expr[0], ctx); final StaticFunc sf = f instanceof FuncItem ? ((FuncItem) f).func : null; return new PlainDoc(ctx, info).function(f.fName(), sf, f.funcType(), null); } /** * Performs the context function. * @param ctx query context * @return resulting value * @throws QueryException query exception */ private Item context(final QueryContext ctx) throws QueryException { return new PlainDoc(ctx, info).context(); } /** * Performs the module function. * @param ctx query context * @return resulting value * @throws QueryException query exception */ private Item module(final QueryContext ctx) throws QueryException { checkCreate(ctx); return new PlainDoc(ctx, info).parse(IO.get(string(checkStr(expr[0], ctx)))); } /** * Performs the xqdoc function. * @param ctx query context * @return resulting value * @throws QueryException query exception */ private Item xqdoc(final QueryContext ctx) throws QueryException { checkCreate(ctx); return new XQDoc(ctx, info).parse(IO.get(string(checkStr(expr[0], ctx)))); } /** * Performs the context-functions function. * @param ctx query context * @return resulting value * @throws QueryException query exception */ private ValueBuilder contextFunctions(final QueryContext ctx) throws QueryException { final ValueBuilder vb = new ValueBuilder(); for(final StaticFunc sf : ctx.funcs.funcs()) vb.add(Functions.getUser(sf, ctx, info)); return vb; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNJson.java000066400000000000000000000076061222453003200253100ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.io.serial.SerializerProp.*; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.io.*; import org.basex.io.out.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.util.json.*; import org.basex.query.util.json.JsonParser.Spec; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Functions for parsing and serializing JSON objects. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class FNJson extends StandardFunc { /** Element: options. */ private static final QNm Q_OPTIONS = QNm.get("options", JSONURI); /** The {@code unescape} key. */ private static final byte[] UNESCAPE = token("unescape"); /** The {@code spec} key. */ private static final byte[] SPEC = token("spec"); /** The {@code type} key. */ private static final byte[] FORMAT = token("format"); /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNJson(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { switch(sig) { case _JSON_PARSE: return parse(ctx); case _JSON_PARSE_ML: return new JsonMLConverter(info).convert(string(checkStr(expr[0], ctx))); case _JSON_SERIALIZE: return serialize(false, ctx); case _JSON_SERIALIZE_ML: return serialize(true, ctx); default: return super.item(ctx, ii); } } /** * Converts a JSON object to an item according to the given configuration. * @param ctx query context * @return item * @throws QueryException query exception */ private Item parse(final QueryContext ctx) throws QueryException { final byte[] input = checkStr(expr[0], ctx); final Item opt = expr.length > 1 ? expr[1].item(ctx, info) : null; final TokenMap map = new FuncParams(Q_OPTIONS, info).parse(opt); final boolean unesc = !map.contains(UNESCAPE) || eq(map.get(UNESCAPE), TRUE); final Spec spec; final byte[] sp = map.get(SPEC); if(sp != null) { Spec spc = null; for(final Spec s : Spec.values()) if(eq(sp, s.desc)) spc = s; if(spc == null) BXJS_CONFIG.thrw(info, "Unknown spec '" + string(sp) + "'"); spec = spc; } else { spec = Spec.RFC4627; } final byte[] form = map.get(FORMAT); final JsonConverter conv = JsonConverter.get(form, spec, unesc, info); return conv.convert(string(input)).item(ctx, info); } /** * Serializes the specified XML document to JSON/JsonML. * @param ml ml flag * @param ctx query context * @return string representation * @throws QueryException query exception */ private Str serialize(final boolean ml, final QueryContext ctx) throws QueryException { final ANode node = checkNode(expr[0], ctx); final Item opt = expr.length > 1 ? expr[1].item(ctx, info) : null; final TokenMap map = new FuncParams(Q_OPTIONS, info).parse(opt); final ArrayOutput ao = new ArrayOutput(); final SerializerProp props = new SerializerProp(); if(map.contains(UNESCAPE)) props.set(S_JSON_UNESCAPE, string(map.get(UNESCAPE))); if(map.contains(SPEC)) props.set(S_JSON_SPEC, string(map.get(SPEC))); props.set(S_JSON_FORMAT, map.contains(FORMAT) ? string(map.get(FORMAT)) : ml ? "jsonml" : "json"); try { final Serializer ser = JsonSerializer.get(ao, props); ser.serialize(node); ser.close(); } catch(final SerializerException ex) { throw ex.getCause(info); } catch(final IOException ex) { SERANY.thrw(info, ex); } return Str.get(delete(ao.toArray(), '\r')); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNMap.java000066400000000000000000000075001222453003200251050ustar00rootroot00000000000000package org.basex.query.func; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.map.*; import org.basex.util.*; /** * Functions on maps. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class FNMap extends StandardFunc { /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNMap(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Iter iter(final QueryContext ctx) throws QueryException { switch(sig) { case _MAP_GET: return get(ctx).iter(); case _MAP_KEYS: return map(ctx).keys().iter(); default: return super.iter(ctx); } } @Override public Value value(final QueryContext ctx) throws QueryException { switch(sig) { case _MAP_GET: return get(ctx); case _MAP_KEYS: return map(ctx).keys(); default: return super.value(ctx); } } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { switch(sig) { case _MAP_NEW: return newMap(ctx, ii); case _MAP_ENTRY: return entry(ctx, ii); case _MAP_CONTAINS: return Bln.get(contains(ctx, ii)); case _MAP_SIZE: return Int.get(map(ctx).mapSize()); case _MAP_REMOVE: return remove(ctx, ii); case _MAP_COLLATION: return map(ctx).collation(); default: return super.item(ctx, ii); } } /** * Removes a key from a map. * @param ctx query context * @param ii input info * @return new map with key removed from it * @throws QueryException query exception */ private Map remove(final QueryContext ctx, final InputInfo ii) throws QueryException { return map(ctx).delete(expr[1].item(ctx, ii), ii); } /** * Creates a new map containing the given key-value pair. * @param ctx query context * @param ii input info * @return the singleton map * @throws QueryException query exception */ private Map entry(final QueryContext ctx, final InputInfo ii) throws QueryException { return Map.EMPTY.insert(expr[0].item(ctx, ii), ctx.value(expr[1]), ii); } /** * Creates a new map from a list of old ones. * @param ctx query context * @param ii input info * @return new map * @throws QueryException query exception */ private Map newMap(final QueryContext ctx, final InputInfo ii) throws QueryException { if(expr.length == 0) return Map.EMPTY; // collations are ignored here as they may disappear in a future version checkColl(expr.length == 2 ? expr[1] : null, ctx); Map map = Map.EMPTY; final Iter maps = expr[0].iter(ctx); for(Item m; (m = maps.next()) != null;) map = map.addAll(checkMap(m), ii); return map; } /** * Looks up the given key in the given map. * @param ctx query context * @return bound value or empty sequence if none exists * @throws QueryException query exception */ private Value get(final QueryContext ctx) throws QueryException { return map(ctx).get(expr[1].item(ctx, info), info); } /** * Checks if the given key is contained in the given map. * @param ctx query context * @param ii input info * @return result of check * @throws QueryException query exception */ private boolean contains(final QueryContext ctx, final InputInfo ii) throws QueryException { return map(ctx).contains(expr[1].item(ctx, ii), ii); } /** * Gets the map at the first argument position. * @param ctx query context * @return map * @throws QueryException query exception */ private Map map(final QueryContext ctx) throws QueryException { return checkMap(checkItem(expr[0], ctx)); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNMath.java000066400000000000000000000054751222453003200252720ustar00rootroot00000000000000package org.basex.query.func; import static java.lang.StrictMath.*; import static org.basex.query.func.Function.*; import java.util.zip.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * Math functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNMath extends StandardFunc { /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNMath(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { double d = 0; if(expr.length > 0 && sig != _MATH_CRC32) { if(expr[0].isEmpty()) return null; d = checkDbl(expr[0], ctx); } final double e = expr.length == 2 ? checkDbl(expr[1], ctx) : 0; switch(sig) { case _MATH_PI: return Dbl.get(PI); case _MATH_E: return Dbl.get(E); case _MATH_SQRT: return Dbl.get(sqrt(d)); case _MATH_SIN: return Dbl.get(sin(d)); case _MATH_COS: return Dbl.get(cos(d)); case _MATH_TAN: return Dbl.get(tan(d)); case _MATH_ASIN: return Dbl.get(asin(d)); case _MATH_ACOS: return Dbl.get(acos(d)); case _MATH_ATAN: return Dbl.get(atan(d)); case _MATH_EXP: return Dbl.get(exp(d)); case _MATH_EXP10: return Dbl.get(pow(10, d)); case _MATH_LOG: return Dbl.get(log(d)); case _MATH_LOG10: return Dbl.get(log10(d)); case _MATH_ATAN2: return Dbl.get(atan2(d, e)); case _MATH_POW: return Dbl.get(power(d, e)); // project-specific case _MATH_SINH: return Dbl.get(sinh(d)); case _MATH_COSH: return Dbl.get(cosh(d)); case _MATH_TANH: return Dbl.get(tanh(d)); case _MATH_CRC32: return crc32(ctx); default: return super.item(ctx, ii); } } /** * Calculates the power. * @param b base * @param e exponent * @return power */ private static double power(final double b, final double e) { if(b == 1) return 1; if(b == -1) { if(Double.isNaN(e)) return b; if(Double.isInfinite(e)) return 1; } return pow(b, e); } /** * Creates the CRC32 hash of the given xs:string. * @param ctx query context * @return xs:hexBinary instance containing the hash * @throws QueryException exception */ private Hex crc32(final QueryContext ctx) throws QueryException { final CRC32 crc = new CRC32(); crc.update(checkStr(expr[0], ctx)); final byte[] r = new byte[4]; for(int i = r.length, c = (int) crc.getValue(); i-- > 0; c >>>= 8) r[i] = (byte) c; return new Hex(r); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNNode.java000066400000000000000000000127731222453003200252650ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.func.Function.*; import static org.basex.query.util.Err.*; import org.basex.core.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.list.*; /** * Node functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNNode extends StandardFunc { /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNNode(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { // functions have 0 or 1 arguments... final Item it = (expr.length != 0 ? expr[0] : checkCtx(ctx)).item(ctx, info); final ANode node = it == null ? null : checkNode(it); switch(sig) { case NODE_NAME: QNm qname = node != null ? node.qname() : null; return qname != null && qname.string().length != 0 ? qname : null; case DOCUMENT_URI: if(node == null || node.type != NodeType.DOC) return null; final byte[] uri = node.baseURI(); return uri.length == 0 ? null : Uri.uri(uri, false); case NILLED: // always false, as no schema information is given return node == null || node.type != NodeType.ELM ? null : Bln.FALSE; case BASE_URI: if(node == null) return null; if(node.type != NodeType.ELM && node.type != NodeType.DOC && node.parent() == null) return null; Uri base = Uri.EMPTY; ANode n = node; do { if(n == null) return ctx.sc.baseURI().resolve(base, info); final Uri bu = Uri.uri(n.baseURI(), false); if(!bu.isValid()) FUNCAST.thrw(ii, bu.type, bu); base = bu.resolve(base, info); if(n.type == NodeType.DOC && n instanceof DBNode) break; n = n.parent(); } while(!base.isAbsolute()); return base; case NAME: qname = node != null ? node.qname() : null; return qname != null ? Str.get(qname.string()) : Str.ZERO; case LOCAL_NAME: qname = node != null ? node.qname() : null; return qname != null ? Str.get(qname.local()) : Str.ZERO; case NAMESPACE_URI: qname = node != null ? node.qname() : null; return qname != null ? Uri.uri(qname.uri(), false) : Uri.EMPTY; case ROOT: n = node; while(n != null) { final ANode p = n.parent(); if(p == null) break; n = p; } return n; case GENERATE_ID: return node == null ? Str.ZERO : Str.get(new TokenBuilder(QueryText.ID).addInt(node.id).finish()); case HAS_CHILDREN: return Bln.get(node != null && node.hasChildren()); case PATH: return node != null ? path(node) : null; default: return super.item(ctx, ii); } } /** * Performs the path function. * @param node node to start from * @return resulting iterator */ private Str path(final ANode node) { ANode n = node; final TokenList tl = new TokenList(); while(n.parent() != null) { int i = 1; final TokenBuilder tb = new TokenBuilder(); if(n.type == NodeType.ATT) { tb.add('@'); final QNm qnm = n.qname(); final byte[] uri = qnm.uri(); if(uri.length != 0) tb.add("Q{").add(qnm.uri()).add('}'); tb.add(qnm.local()); } else if(n.type == NodeType.ELM) { final QNm qnm = n.qname(); final AxisIter ai = n.precedingSibling(); for(ANode fs; (fs = ai.next()) != null;) { final QNm q = fs.qname(); if(q != null && q.eq(qnm)) i++; } tb.add("Q{").add(qnm.uri()).add('}').add(qnm.local()); tb.add('[').add(Integer.toString(i)).add(']'); } else if(n.type == NodeType.COM || n.type == NodeType.TXT) { final AxisIter ai = n.precedingSibling(); for(ANode fs; (fs = ai.next()) != null;) if(fs.type == n.type) i++; tb.addExt(n.type() + "[%]", i); } else if(n.type == NodeType.PI) { final QNm qnm = n.qname(); final AxisIter ai = n.precedingSibling(); for(ANode fs; (fs = ai.next()) != null;) { if(fs.type == n.type && fs.qname().eq(qnm)) i++; } tb.add(n.type.string()).add('(').add(qnm.local()); tb.add(")[").add(Integer.toString(i)).add(']'); } tl.add(tb.finish()); n = n.parent(); } final TokenBuilder tb = new TokenBuilder(); // add root function if(n.type != NodeType.DOC) tb.add("Q{").add(QueryText.FNURI).add("}root()"); // add all steps in reverse order for(int i = tl.size() - 1; i >= 0; --i) tb.add('/').add(tl.get(i)); return Str.get(tb.isEmpty() ? Token.SLASH : tb.finish()); } @Override public boolean has(final Flag flag) { return flag == Flag.X30 && expr.length == 0 && oneOf(sig, DOCUMENT_URI, NODE_NAME, NILLED) || flag == Flag.CTX && expr.length == 0 || super.has(flag); } @Override public boolean accept(final ASTVisitor visitor) { return (expr.length != 0 || visitor.lock(DBLocking.CTX)) && super.accept(visitor); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNNum.java000066400000000000000000000117121222453003200251270ustar00rootroot00000000000000package org.basex.query.func; import java.math.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Numeric functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNNum extends StandardFunc { /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNNum(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { final Item it = expr[0].item(ctx, info); if(it == null) return null; final Type ip = it.type; if(!ip.isNumberOrUntyped()) Err.number(this, it); final double d = it.dbl(info); switch(sig) { case ABS: return abs(it, info); case CEILING: return num(it, d, StrictMath.ceil(d)); case FLOOR: return num(it, d, StrictMath.floor(d)); case ROUND: return rnd(it, d, false, ctx); case ROUND_HALF_TO_EVEN: return rnd(it, d, true, ctx); default: return super.item(ctx, ii); } } /** * Returns a rounded item. * @param it input item * @param d input double value * @param h2e half-to-even flag * @param ctx query context * @return absolute item * @throws QueryException query exception */ private Item rnd(final Item it, final double d, final boolean h2e, final QueryContext ctx) throws QueryException { final long p = expr.length == 1 ? 0 : checkItr(expr[1], ctx); return round(it, d, p, h2e, info); } /** * Returns an absolute number. * @param it input item * @param ii input info * @return absolute item * @throws QueryException query exception */ public static Item abs(final Item it, final InputInfo ii) throws QueryException { final double d = it.dbl(ii); final boolean s = d > 0d || 1 / d > 0; final Type ip = it.type; if(ip instanceof AtomType) { switch((AtomType) ip) { case DBL: return s ? it : Dbl.get(Math.abs(it.dbl(ii))); case FLT: return s ? it : Flt.get(Math.abs((float) it.dbl(ii))); case DEC: return s ? it : Dec.get(it.dec(ii).abs()); case ITR: return s ? it : Int.get(Math.abs(it.itr(ii))); default: break; } } return ip.instanceOf(AtomType.ITR) ? Int.get(Math.abs(it.itr(ii))) : Dec.get(it.dec(ii).abs()); } /** * Returns a rounded item. * @param it input item * @param d input double value * @param h2e half-to-even flag * @param prec precision * @param ii input info * @return absolute item * @throws QueryException query exception */ public static Item round(final Item it, final double d, final long prec, final boolean h2e, final InputInfo ii) throws QueryException { // take care of untyped items final Item num = it.type.isUntyped() ? Dbl.get(it.dbl(ii)) : it; if(num.type == AtomType.DEC && prec >= 0) { final BigDecimal bd = num.dec(ii); final int m = h2e ? BigDecimal.ROUND_HALF_EVEN : bd.signum() > 0 ? BigDecimal.ROUND_HALF_UP : BigDecimal.ROUND_HALF_DOWN; return Dec.get(prec > Integer.MAX_VALUE ? bd : bd.setScale((int) prec, m)); } double c = d; if(!Double.isNaN(c) && !Double.isInfinite(c) && prec < 32) { // calculate precision factor double p = 1; for(long i = prec; i > 0; --i) p *= 10; for(long i = prec; i < 0; ++i) p /= 10; if(h2e) { c *= p; if(d < 0) c = -c; final double r = c % 1; c += r == .5 ? c % 2 == 1.5 ? .5 : -.5 : r > .5 ? 1 - r : -r; c /= p; if(d < 0) c = -c; } else if(c >= Long.MIN_VALUE && c < Long.MAX_VALUE) { final double dp = d * p; c = (dp >= -.5d && dp < 0 ? -0d : StrictMath.round(dp)) / p; } } return num(it, d, c); } /** * Returns a numeric result with the correct data type. * @param it input item * @param n input double value * @param d calculated double value * @return numeric item */ private static Item num(final Item it, final double n, final double d) { final Type ip = it.type; final Item i = ip.isUntyped() ? Dbl.get(n) : it; if(n == d) return i; if(ip instanceof AtomType) { switch((AtomType) ip) { case DEC: return Dec.get(d); case DBL: return Dbl.get(d); case FLT: return Flt.get((float) d); case ITR: return Int.get((long) d); default: break; } } return Dbl.get(d); } @Override public boolean has(final Flag flag) { return flag == Flag.X30 && sig == Function.ROUND && expr.length == 2 || super.has(flag); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNOut.java000066400000000000000000000033201222453003200251330ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * Output functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNOut extends StandardFunc { /** Newline character. */ private static final Str NL = Str.get("\n"); /** Tab character. */ private static final Str TAB = Str.get("\t"); /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNOut(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { switch(sig) { case _OUT_NL: return NL; case _OUT_TAB: return TAB; case _OUT_FORMAT: return format(ctx); default: return super.item(ctx, ii); } } /** * Formats a string according to the specified format. * @param ctx query context * @return formatted string * @throws QueryException query exception */ private Str format(final QueryContext ctx) throws QueryException { final String form = string(checkStr(expr[0], ctx)); final int es = expr.length; final Object[] args = new Object[es - 1]; for(int e = 1; e < es; e++) { final Item it = expr[e].item(ctx, info); args[e - 1] = it.type.isUntyped() ? string(it.string(info)) : it.toJava(); } try { return Str.get(String.format(form, args)); } catch(final RuntimeException ex) { throw ERRFORM.thrw(info, Util.name(ex), ex); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNPat.java000066400000000000000000000171641222453003200251230ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.util.regex.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.regex.parse.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * String pattern functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNPat extends StandardFunc { /** Pattern cache. */ private final TokenObjMap patterns = new TokenObjMap(); /** Slash pattern. */ private static final Pattern SLASH = Pattern.compile("\\$"); /** Slash pattern. */ private static final Pattern BSLASH = Pattern.compile("\\\\"); /** Module prefix. */ private static final String PREFIX = "fn"; /** QName. */ private static final QNm Q_ANALYZE = QNm.get(PREFIX, "analyze-string-result", FNURI); /** QName. */ private static final QNm Q_MATCH = QNm.get(PREFIX, "match", FNURI); /** QName. */ private static final QNm Q_NONMATCH = QNm.get(PREFIX, "non-match", FNURI); /** QName. */ private static final QNm Q_MGROUP = QNm.get(PREFIX, "group", FNURI); /** Attribute for the analyze-string-result function. */ private static final String NR = "nr"; /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNPat(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Iter iter(final QueryContext ctx) throws QueryException { switch(sig) { case TOKENIZE: return tokenize(ctx).iter(); default: return super.iter(ctx); } } @Override public Value value(final QueryContext ctx) throws QueryException { switch(sig) { case TOKENIZE: return tokenize(ctx); default: return super.value(ctx); } } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { switch(sig) { case MATCHES: return matches(checkEStr(expr[0], ctx), ctx); case REPLACE: return replace(checkEStr(expr[0], ctx), ctx); case ANALYZE_STRING: return analyzeString(checkEStr(expr[0], ctx), ctx); default: return super.item(ctx, ii); } } /** * Evaluates the match function. * @param val input value * @param ctx query context * @return function result * @throws QueryException query exception */ private Item matches(final byte[] val, final QueryContext ctx) throws QueryException { final Pattern p = pattern(expr[1], expr.length == 3 ? expr[2] : null, ctx); return Bln.get(p.matcher(string(val)).find()); } /** * Evaluates the analyze-string function. * @param val input value * @param ctx query context * @return function result * @throws QueryException query exception */ private Item analyzeString(final byte[] val, final QueryContext ctx) throws QueryException { final Pattern p = pattern(expr[1], expr.length == 3 ? expr[2] : null, ctx); if(p.matcher("").matches()) REGROUP.thrw(info); final String str = string(val); final Matcher m = p.matcher(str); final FElem root = new FElem(Q_ANALYZE).declareNS(); int s = 0; while(m.find()) { if(s != m.start()) nonmatch(str.substring(s, m.start()), root); match(m, str, root, 0); s = m.end(); } if(s != str.length()) nonmatch(str.substring(s), root); return root; } /** * Processes a match. * @param m matcher * @param str string * @param par parent * @param g group number * @return next group number and position in string */ private static int[] match(final Matcher m, final String str, final FElem par, final int g) { final FElem nd = new FElem(g == 0 ? Q_MATCH : Q_MGROUP); if(g > 0) nd.add(NR, token(g)); final int start = m.start(g), end = m.end(g), gc = m.groupCount(); int[] pos = { g + 1, start }; // group and position in string while(pos[0] <= gc && m.end(pos[0]) <= end) { final int st = m.start(pos[0]); if(st >= 0) { // group matched if(pos[1] < st) nd.add(str.substring(pos[1], st)); pos = match(m, str, nd, pos[0]); } else pos[0]++; // skip it } if(pos[1] < end) { nd.add(str.substring(pos[1], end)); pos[1] = end; } par.add(nd); return pos; } /** * Processes a non-match. * @param text text * @param par root node */ private static void nonmatch(final String text, final FElem par) { par.add(new FElem(Q_NONMATCH).add(text)); } /** * Evaluates the replace function. * @param val input value * @param ctx query context * @return function result * @throws QueryException query exception */ private Item replace(final byte[] val, final QueryContext ctx) throws QueryException { final byte[] rep = checkStr(expr[2], ctx); for(int i = 0; i < rep.length; ++i) { if(rep[i] == '\\') { if(i + 1 == rep.length || rep[i + 1] != '\\' && rep[i + 1] != '$') FUNREPBS.thrw(info); ++i; } if(rep[i] == '$' && (i == 0 || rep[i - 1] != '\\') && (i + 1 == rep.length || !digit(rep[i + 1]))) FUNREPDOL.thrw(info); } final Pattern p = pattern(expr[1], expr.length == 4 ? expr[3] : null, ctx); if(p.pattern().isEmpty()) REGROUP.thrw(info); String r = string(rep); if((p.flags() & Pattern.LITERAL) != 0) { r = SLASH.matcher(BSLASH.matcher(r).replaceAll("\\\\\\\\")).replaceAll("\\\\\\$"); } try { return Str.get(p.matcher(string(val)).replaceAll(r)); } catch(final Exception ex) { if(ex.getMessage().contains("No group")) REGROUP.thrw(info); throw REGPAT.thrw(info, ex); } } /** * Evaluates the tokenize function. * @param ctx query context * @return function result * @throws QueryException query exception */ private Value tokenize(final QueryContext ctx) throws QueryException { final byte[] val = checkEStr(expr[0], ctx); final Pattern p = pattern(expr[1], expr.length == 3 ? expr[2] : null, ctx); if(p.matcher("").matches()) REGROUP.thrw(info); final TokenList tl = new TokenList(); final String str = string(val); if(!str.isEmpty()) { final Matcher m = p.matcher(str); int s = 0; while(m.find()) { tl.add(str.substring(s, m.start())); s = m.end(); } tl.add(str.substring(s, str.length())); } return StrSeq.get(tl); } /** * Returns a regular expression pattern. * @param pattern input pattern * @param modifier modifier item * @param ctx query context * @return pattern modifier * @throws QueryException query exception */ private Pattern pattern(final Expr pattern, final Expr modifier, final QueryContext ctx) throws QueryException { final byte[] pat = checkStr(pattern, ctx); final byte[] mod = modifier != null ? checkStr(modifier, ctx) : null; final TokenBuilder tb = new TokenBuilder(pat); if(mod != null) tb.add(0).add(mod); final byte[] key = tb.finish(); Pattern p = patterns.get(key); if(p == null) { p = RegExParser.parse(pat, mod, ctx.sc.xquery3(), info); patterns.put(key, p); } return p; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNProc.java000066400000000000000000000114371222453003200252770ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.io.*; import java.nio.charset.*; import org.basex.core.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.util.*; import org.basex.util.list.*; /** * Functions to execute system commands. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNProc extends StandardFunc { /** Name: result. */ private static final String RESULT = "result"; /** Name: standard output. */ private static final String OUTPUT = "output"; /** Name: standard error. */ private static final String ERROR = "error"; /** Name: code. */ private static final String CODE = "code"; /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNProc(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { checkCreate(ctx); final TokenList tl = new TokenList(); tl.add(checkStr(expr[0], ctx)); if(expr.length > 1) { final Iter ir = ctx.iter(expr[1]); for(Item it; (it = ir.next()) != null;) tl.add(checkStr(it)); } final String c = expr.length > 2 ? string(checkStr(expr[2], ctx)) : Prop.ENCODING; Charset cs = null; try { cs = Charset.forName(c); } catch(final Exception ex) { BXPR_ENC.thrw(info, c); } final String[] args = tl.toStringArray(); switch(sig) { case _PROC_SYSTEM: return system(args, cs); case _PROC_EXECUTE: return execute(args, cs); default: return super.item(ctx, ii); } } /** * Executes the specified command and returns the result as string. * @param args command and arguments * @param cs charset * @return result * @throws QueryException query exception */ private Str system(final String[] args, final Charset cs) throws QueryException { final Result result = exec(args, cs); if(result.code == 0) return Str.get(norm(result.output)); // create error message final QNm name = new QNm("PROC" + String.format("%04d", result.code)); throw new QueryException(info, name, string(norm(result.error))); } /** * Executes the specified command and returns the result as element. * @param args command and arguments * @param cs charset * @return result */ private static FElem execute(final String[] args, final Charset cs) { final Result result = exec(args, cs); final FElem root = new FElem(RESULT); root.add(new FElem(OUTPUT).add(norm(result.output))); root.add(new FElem(ERROR).add(norm(result.error))); root.add(new FElem(CODE).add(token(result.code))); return root; } /** * Returns the result of a command. * @param args command and arguments * @param cs charset * @return result */ private static Result exec(final String[] args, final Charset cs) { final Result result = new Result(); final Process proc; try { proc = new ProcessBuilder(args).start(); } catch(final IOException ex) { result.error.add(Util.message(ex)); result.code = 9999; return result; } try { final Thread outt = reader(proc.getInputStream(), result.output, cs); final Thread errt = reader(proc.getErrorStream(), result.error, cs); outt.start(); errt.start(); proc.waitFor(); outt.join(); errt.join(); } catch(final InterruptedException ex) { result.error.add(Util.message(ex)); } result.code = proc.exitValue(); return result; } /** * Creates a reader thread. * @param in input stream * @param tb cache * @param cs charset * @return result */ private static Thread reader(final InputStream in, final TokenBuilder tb, final Charset cs) { final InputStreamReader isr = new InputStreamReader(in, cs); final BufferedReader br = new BufferedReader(isr); return new Thread() { @Override public void run() { try { for(int b; (b = br.read()) != -1;) tb.add(b); } catch(final IOException ex) { Util.stack(ex); } } }; } /** * Returns a normalized token from the specified builder. * @param tb token builder * @return output */ private static byte[] norm(final TokenBuilder tb) { return delete(tb.finish(), '\r'); } /** * Error object. */ static class Result { /** Process output. */ final TokenBuilder output = new TokenBuilder(); /** Process error. */ final TokenBuilder error = new TokenBuilder(); /** Exit code. */ int code; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNProf.java000066400000000000000000000116661222453003200253060ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.util.Token.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * Profiling functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNProf extends StandardFunc { /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNProf(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Iter iter(final QueryContext ctx) throws QueryException { switch(sig) { case _PROF_MEM: return mem(ctx); case _PROF_TIME: return time(ctx); default: return super.iter(ctx); } } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { switch(sig) { case _PROF_SLEEP: return sleep(ctx); case _PROF_CURRENT_MS: return Int.get(System.currentTimeMillis()); case _PROF_CURRENT_NS: return Int.get(System.nanoTime()); case _PROF_DUMP: return dump(ctx); case _PROF_HUMAN: return human(ctx); case _PROF_VOID: return voidd(ctx); default: return super.item(ctx, ii); } } /** * Measures the memory consumption for the specified expression in MB. * @param ctx query context * @return memory consumption * @throws QueryException query exception */ private Iter mem(final QueryContext ctx) throws QueryException { // measure initial memory consumption Performance.gc(3); final long min = Performance.memory(); // optional message final byte[] msg = expr.length > 2 ? checkStr(expr[2], ctx) : null; // check caching flag if(expr.length > 1 && checkBln(expr[1], ctx)) { final Value v = ctx.value(expr[0]).cache().value(); dump(min, msg, ctx); return v.iter(); } return new Iter() { final Iter ir = expr[0].iter(ctx); @Override public Item next() throws QueryException { final Item it = ir.next(); if(it == null) dump(min, msg, ctx); return it; } }; } /** * Dumps the items of a sequence. * @param ctx query context * @return memory consumption * @throws QueryException query exception */ private Item dump(final QueryContext ctx) throws QueryException { final Iter ir = expr[0].iter(ctx); final byte[] s = expr.length > 1 ? checkStr(expr[1], ctx) : null; for(Item it; (it = ir.next()) != null;) { FNInfo.dump(it.serialize().toArray(), s, ctx); } return null; } /** * Materializes and swallows the input. * @param ctx query context * @return memory consumption * @throws QueryException query exception */ private Item voidd(final QueryContext ctx) throws QueryException { final Iter ir = expr[0].iter(ctx); for(Item it; (it = ir.next()) != null;) it.materialize(info); return null; } /** * Dumps the memory consumption. * @param min initial memory usage * @param msg message (can be {@code null}) * @param ctx query context */ static void dump(final long min, final byte[] msg, final QueryContext ctx) { Performance.gc(2); final long max = Performance.memory(); final long mb = Math.max(0, max - min); FNInfo.dump(token(Performance.format(mb)), msg, ctx); } /** * Returns a human-readable version of the specified integer. * @param ctx query context * @return memory consumption * @throws QueryException query exception */ private Item human(final QueryContext ctx) throws QueryException { return Str.get(Performance.format(checkItr(expr[0], ctx), true)); } /** * Measures the execution time for the specified expression in milliseconds. * @param ctx query context * @return time in milliseconds * @throws QueryException query exception */ private Iter time(final QueryContext ctx) throws QueryException { // create timer final Performance p = new Performance(); // optional message final byte[] msg = expr.length > 2 ? checkStr(expr[2], ctx) : null; // check caching flag if(expr.length > 1 && checkBln(expr[1], ctx)) { final Value v = ctx.value(expr[0]).cache().value(); FNInfo.dump(token(p.getTime()), msg, ctx); return v.iter(); } return new Iter() { final Iter ir = expr[0].iter(ctx); @Override public Item next() throws QueryException { final Item it = ir.next(); if(it == null) FNInfo.dump(token(p.getTime()), msg, ctx); return it; } }; } /** * Sleeps for the specified number of milliseconds. * @param ctx query context * @return {@code null} * @throws QueryException query exception */ private Item sleep(final QueryContext ctx) throws QueryException { Performance.sleep(checkItr(expr[0], ctx)); return null; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNQName.java000066400000000000000000000140371222453003200253740ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * QName functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNQName extends StandardFunc { /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNQName(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Iter iter(final QueryContext ctx) throws QueryException { switch(sig) { case IN_SCOPE_PREFIXES: return inscope(ctx); default: return super.iter(ctx); } } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { // functions have 1 or 2 arguments... final Item it = expr[0].item(ctx, info); final Item it2 = expr.length == 2 ? expr[1].item(ctx, info) : null; switch(sig) { case RESOLVE_QNAME: return resolveQName(ctx, it, it2); case QNAME: return qName(it, it2); case LOCAL_NAME_FROM_QNAME: return lnFromQName(ctx, it); case PREFIX_FROM_QNAME: return prefixFromQName(ctx, it); case NAMESPACE_URI_FOR_PREFIX: return nsUriForPrefix(it, it2); case RESOLVE_URI: return resolveUri(ctx, it, it2); default: return super.item(ctx, ii); } } /** * Returns the in-scope prefixes of the specified node. * @param ctx query context * @return prefix sequence * @throws QueryException query exception */ private Iter inscope(final QueryContext ctx) throws QueryException { final ANode node = (ANode) checkType(expr[0].item(ctx, info), NodeType.ELM); final Atts ns = node.nsScope().add(XML, XMLURI); final int as = ns.size(); final ValueBuilder vb = new ValueBuilder(as); for(int a = 0; a < as; ++a) { final byte[] key = ns.name(a); if(key.length + ns.value(a).length != 0) vb.add(Str.get(key)); } return vb; } /** * Resolves a QName. * @param it qname * @param it2 item * @return prefix sequence * @throws QueryException query exception */ private Item qName(final Item it, final Item it2) throws QueryException { final byte[] uri = checkEStr(it); if(it2 == null) INVEMPTYEX.thrw(info, description(), AtomType.STR); final byte[] name = checkEStr(it2); final byte[] str = !contains(name, ':') && eq(uri, XMLURI) ? concat(XMLC, name) : name; if(!XMLToken.isQName(str)) Err.value(info, AtomType.QNM, Str.get(name)); final QNm nm = new QNm(str, uri); if(nm.hasPrefix() && uri.length == 0) Err.value(info, AtomType.URI, Str.get(nm.uri())); return nm; } /** * Returns the local name of a QName. * @param ctx query context * @param it qname * @return prefix sequence * @throws QueryException query exception */ private Item lnFromQName(final QueryContext ctx, final Item it) throws QueryException { if(it == null) return null; final QNm nm = checkQNm(it, ctx); return AtomType.NCN.cast(Str.get(nm.local()), ctx, info); } /** * Returns the local name of a QName. * @param ctx query context * @param it qname * @return prefix sequence * @throws QueryException query exception */ private Item prefixFromQName(final QueryContext ctx, final Item it) throws QueryException { if(it == null) return null; final QNm nm = checkQNm(it, ctx); return nm.hasPrefix() ? AtomType.NCN.cast(Str.get(nm.prefix()), ctx, info) : null; } /** * Returns a new QName. * @param ctx query context * @param it qname * @param it2 item * @return prefix sequence * @throws QueryException query exception */ private Item resolveQName(final QueryContext ctx, final Item it, final Item it2) throws QueryException { final ANode base = (ANode) checkType(it2, NodeType.ELM); if(it == null) return null; final byte[] name = checkEStr(it); if(!XMLToken.isQName(name)) Err.value(info, AtomType.QNM, it); final QNm nm = new QNm(name); final byte[] pref = nm.prefix(); final byte[] uri = base.uri(pref, ctx); if(uri == null) NSDECL.thrw(info, pref); nm.uri(uri); return nm; } /** * Returns the namespace URI for a prefix. * @param it qname * @param it2 item * @return prefix sequence * @throws QueryException query exception */ private Item nsUriForPrefix(final Item it, final Item it2) throws QueryException { final byte[] pref = checkEStr(it); final ANode an = (ANode) checkType(it2, NodeType.ELM); if(eq(pref, XML)) return Uri.uri(XMLURI, false); final Atts at = an.nsScope(); final byte[] s = at.value(pref); return s == null || s.length == 0 ? null : Uri.uri(s, false); } /** * Resolves a URI. * @param ctx query context * @param it item * @param it2 second item * @return prefix sequence * @throws QueryException query exception */ private Item resolveUri(final QueryContext ctx, final Item it, final Item it2) throws QueryException { if(it == null) return null; // check relative uri final Uri rel = Uri.uri(checkEStr(it)); if(!rel.isValid()) URIINVRES.thrw(info, rel); if(rel.isAbsolute()) return rel; // check base uri final Uri base = it2 == null ? ctx.sc.baseURI() : Uri.uri(checkEStr(it2)); if(!base.isAbsolute()) URIABS.thrw(info, base); if(!base.isValid() || contains(base.string(), '#') || !contains(base.string(), '/')) URIINVRES.thrw(info, base); return base.resolve(rel, info); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNRandom.java000066400000000000000000000105341222453003200256110ustar00rootroot00000000000000package org.basex.query.func; import java.util.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * Random functions. * * @author BaseX Team 2005-12, BSD License * @author Dirk Kirsten */ public final class FNRandom extends StandardFunc { /** Random instance. */ static final Random RND = new Random(); /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNRandom(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { switch(sig) { case _RANDOM_DOUBLE: return Dbl.get(randomDouble()); case _RANDOM_INTEGER: return Int.get(randomInt(ctx)); case _RANDOM_UUID: return Str.get(UUID.randomUUID().toString()); default: return super.item(ctx, ii); } } @Override public Iter iter(final QueryContext ctx) throws QueryException { switch(sig) { case _RANDOM_SEEDED_DOUBLE: return randomSeededDouble(ctx); case _RANDOM_SEEDED_INTEGER: return randomSeededInt(ctx); case _RANDOM_GAUSSIAN: return randomGaussian(ctx); default: return super.iter(ctx); } } /** * Returns a random integer, either in the whole integer range or * if a maximum is given between 0 (inclusive) and the given maximum (exclusive). * @param ctx query context * @return random integer * @throws QueryException query exception */ private int randomInt(final QueryContext ctx) throws QueryException { if(expr.length == 0) return RND.nextInt(); final long s = checkItr(expr[0], ctx); return s < 1 || s > Integer.MAX_VALUE ? 0 : RND.nextInt((int) s); } /** * Returns a sequence of random integers with exactly $num items * using a seed for initializing the random function, either in the * whole integer range or if a maximum is given between 0 (inclusive) * and the given maximum (exclusive). * @param ctx query context * @return random integer * @throws QueryException query exception */ private Iter randomSeededInt(final QueryContext ctx) throws QueryException { return new Iter() { int count; final long seed = checkItr(expr[0], ctx); final int num = (int) checkItr(expr[1], ctx); final Random r = new Random(seed); @Override public Item next() throws QueryException { if(expr.length == 3) { // max defined final int max = (int) checkItr(expr[2], ctx); return ++count <= num ? Int.get(r.nextInt(max)) : null; } // no max given return ++count <= num ? Int.get(r.nextInt()) : null; } }; } /** * Returns a random double between 0.0 (inclusive) and 1.0 (exclusive). * @return random double */ private static double randomDouble() { return RND.nextDouble(); } /** * Returns a sequence of random double with exactly $num items * using a seed between 0.0 (inclusive) and 1.0 (exclusive). * @param ctx query context * @return random double * @throws QueryException query exception */ private Iter randomSeededDouble(final QueryContext ctx) throws QueryException { return new Iter() { int count; final long seed = checkItr(expr[0], ctx); final int num = (int) checkItr(expr[1], ctx); final Random r = new Random(seed); @Override public Item next() throws QueryException { return ++count <= num ? Dbl.get(r.nextDouble()) : null; } }; } /** * Returns a sequence of random doubles with exactly $num items * using a Gaussian (i.e. normal) distribution with a mean of 0.0 * and a derivation of 1.0 * @param ctx query context * @return random double * @throws QueryException query exception */ private Iter randomGaussian(final QueryContext ctx) throws QueryException { return new Iter() { final int num = (int) checkItr(expr[0], ctx); int count; @Override public Item next() throws QueryException { return ++count <= num ? Dbl.get(RND.nextGaussian()) : null; } }; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNRepo.java000066400000000000000000000056061222453003200253020ustar00rootroot00000000000000package org.basex.query.func; import org.basex.core.*; import org.basex.io.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.util.pkg.*; import org.basex.query.util.pkg.Package; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.util.*; /** * Functions on EXPath packages. * [JE] install() and delete() should be updating functions * * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ public final class FNRepo extends StandardFunc { /** Element name. */ private static final String PACKAGE = "package"; /** Header attribute: name. */ private static final String NAME = "name"; /** Header attribute: type. */ private static final String TYPE = "type"; /** Header attribute: version. */ private static final String VERSION = "version"; /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNRepo(final InputInfo ii, final Function f, final Expr[] e) { super(ii, f, e); } @Override public Iter iter(final QueryContext ctx) throws QueryException { switch(sig) { case _REPO_LIST: return list(ctx); default: return super.iter(ctx); } } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { checkCreate(ctx); final RepoManager rm = new RepoManager(ctx.context, ii); // either path to package or package name final String pkg = expr.length == 0 ? null : Token.string(checkStr(expr[0], ctx)); switch(sig) { case _REPO_INSTALL: rm.install(pkg); return null; case _REPO_DELETE: rm.delete(pkg); return null; default: return super.item(ctx, ii); } } /** * Performs the list function. * @param ctx query context * @return iterator */ private static Iter list(final QueryContext ctx) { final NodeSeqBuilder cache = new NodeSeqBuilder(); for(final byte[] p : ctx.context.repo.pkgDict()) { if(p == null) continue; final FElem elem = new FElem(PACKAGE); elem.add(NAME, Package.name(p)); elem.add(VERSION, Package.version(p)); elem.add(TYPE, PkgText.EXPATH); cache.add(elem); } // traverse all directories, ignore root entries with dashes for(final IOFile dir : ctx.context.repo.path().children()) { if(dir.name().indexOf('-') != -1) continue; for(final String s : dir.descendants()) { final FElem elem = new FElem(PACKAGE); elem.add(NAME, dir.name() + '.' + s.replaceAll("\\..*", "").replace('/', '.')); elem.add(TYPE, PkgText.INTERNAL); cache.add(elem); } } return cache; } @Override public boolean accept(final ASTVisitor visitor) { return visitor.lock(DBLocking.REPO) && super.accept(visitor); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNSeq.java000066400000000000000000000404641222453003200251260ustar00rootroot00000000000000package org.basex.query.func; import java.util.*; import org.basex.data.*; import org.basex.index.path.*; import org.basex.index.stats.*; import org.basex.query.*; import org.basex.query.expr.CmpV.OpV; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.path.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.query.value.type.SeqType.Occ; import org.basex.util.*; /** * Sequence functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNSeq extends StandardFunc { /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNSeq(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { switch(sig) { case HEAD: return head(ctx); default: return super.item(ctx, ii); } } @Override public Iter iter(final QueryContext ctx) throws QueryException { switch(sig) { case INDEX_OF: return indexOf(ctx); case DISTINCT_VALUES: return distinctValues(ctx); case INSERT_BEFORE: return insertBefore(ctx); case REVERSE: return reverse(ctx); case REMOVE: return remove(ctx); case SUBSEQUENCE: return subseqIter(ctx); case TAIL: return tail(ctx); case OUTERMOST: return most(ctx, true); case INNERMOST: return most(ctx, false); default: return super.iter(ctx); } } @Override public Value value(final QueryContext ctx) throws QueryException { switch(sig) { case SUBSEQUENCE: return subseqValue(ctx); case TAIL: final Value seq = ctx.value(expr[0]); return SubSeq.get(seq, 1, seq.size() - 1); default: return super.value(ctx); } } /** * Returns the outermost/innermost nodes of a node sequence, i.e. a node is * only contained, if none of its ancestors/descendants are. * @param ctx query context * @param outer outermost flag * @return outermost/innermost nodes * @throws QueryException exception */ private Iter most(final QueryContext ctx, final boolean outer) throws QueryException { final Iter iter = expr[0].iter(ctx); final NodeSeqBuilder nc = new NodeSeqBuilder().check(); for(Item it; (it = iter.next()) != null;) nc.add(checkNode(it)); final int len = (int) nc.size(); // only go further if there are at least two nodes if(len < 2) return nc; // after this, the iterator is sorted and duplicate free if(nc.dbnodes()) { // nodes are sorted, so ancestors always come before their descendants // the first/last node is thus always included in the output final DBNode fst = (DBNode) nc.get(outer ? 0 : len - 1); final Data data = fst.data; final ANode[] nodes = nc.nodes.clone(); if(outer) { // skip the subtree of the last added node nc.size(0); final DBNode dummy = new DBNode(fst.data); final NodeSeqBuilder src = new NodeSeqBuilder(nodes, len); for(int next = 0, p; next < len; next = p < 0 ? -p - 1 : p) { final DBNode nd = (DBNode) nodes[next]; dummy.pre = nd.pre + data.size(nd.pre, data.kind(nd.pre)); p = src.binarySearch(dummy, next + 1, len - next - 1); nc.add(nd); } } else { // skip ancestors of the last added node nc.nodes[0] = fst; nc.size(1); int before = fst.pre; for(int i = len - 1; i-- != 0;) { final DBNode nd = (DBNode) nodes[i]; if(nd.pre + data.size(nd.pre, data.kind(nd.pre)) <= before) { nc.add(nd); before = nd.pre; } } // nodes were added in reverse order, correct that Array.reverse(nc.nodes, 0, (int) nc.size()); } return nc; } // multiple documents and/or constructed fragments final NodeSeqBuilder out = new NodeSeqBuilder(new ANode[len], 0); OUTER: for(int i = 0; i < len; i++) { final ANode nd = nc.nodes[i]; final AxisIter ax = outer ? nd.ancestor() : nd.descendant(); for(ANode a; (a = ax.next()) != null;) if(nc.indexOf(a, false) != -1) continue OUTER; out.add(nc.nodes[i]); } return out; } @Override protected Expr opt(final QueryContext ctx) throws QueryException { // static typing: // index-of will create integers, insert-before might add new types if(sig == Function.INDEX_OF || sig == Function.INSERT_BEFORE) return this; // pre-evaluate distinct values final SeqType st = expr[0].type(); final Type t = st.type; if(sig == Function.DISTINCT_VALUES && expr.length == 1) { type = t.isNode() ? SeqType.get(AtomType.ATM, st.occ) : st; return cmpDist(ctx); } // all other types will return existing types Occ o = Occ.ZERO_MORE; // at most one returned item if(sig == Function.SUBSEQUENCE && st.one()) o = Occ.ZERO_ONE; // head will return at most one item else if(sig == Function.HEAD) o = Occ.ZERO_ONE; type = SeqType.get(t, o); return this; } /** * Pre-evaluates distinct-values() function, utilizing database statistics. * @param ctx query context * @return original or optimized expression * @throws QueryException query exception */ private Expr cmpDist(final QueryContext ctx) throws QueryException { // can only be performed on axis paths if(!(expr[0] instanceof AxisPath)) return this; // try to get statistics for resulting nodes final ArrayList nodes = ((AxisPath) expr[0]).nodes(ctx); if(nodes == null) return this; // loop through all nodes final HashItemSet is = new HashItemSet(); for(PathNode pn : nodes) { // retrieve text child if addressed node is an element if(pn.kind == Data.ELEM) { if(!pn.stats.isLeaf()) return this; for(final PathNode n : pn.ch) if(n.kind == Data.TEXT) pn = n; } // skip nodes others than texts and attributes if(pn.kind != Data.TEXT && pn.kind != Data.ATTR) return this; // check if distinct values are available if(pn.stats.type != StatsType.CATEGORY) return this; // if yes, add them to the item set for(final byte[] c : pn.stats.cats) is.put(new Atm(c), info); } // return resulting sequence final ValueBuilder vb = new ValueBuilder(is.size()); for(final Item i : is) vb.add(i); return vb.value(); } /** * Returns the first item in a sequence. * @param ctx query context * @return first item * @throws QueryException query exception */ private Item head(final QueryContext ctx) throws QueryException { final Expr e = expr[0]; return e.type().zeroOrOne() ? e.item(ctx, info) : e.iter(ctx).next(); } /** * Returns all but the first item in a sequence. * @param ctx query context * @return iterator * @throws QueryException query exception */ private Iter tail(final QueryContext ctx) throws QueryException { final Expr e = expr[0]; if(e.type().zeroOrOne()) return Empty.ITER; final Iter ir = e.iter(ctx); if(ir instanceof ValueIter) { final Value val = ir.value(); return SubSeq.get(val, 1, val.size() - 1).iter(); } if(ir.next() == null) return Empty.ITER; return new Iter() { @Override public Item next() throws QueryException { return ir.next(); } }; } /** * Returns the indexes of an item in a sequence. * @param ctx query context * @return position(s) of item * @throws QueryException query exception */ private Iter indexOf(final QueryContext ctx) throws QueryException { final Item it = checkItem(expr[1], ctx); final Collation coll = checkColl(expr.length == 3 ? expr[2] : null, ctx); return new Iter() { final Iter ir = expr[0].iter(ctx); int c; @Override public Item next() throws QueryException { while(true) { final Item i = ir.next(); if(i == null) return null; ++c; if(i.comparable(it) && OpV.EQ.eval(i, it, coll, info)) return Int.get(c); } } }; } /** * Returns all distinct values of a sequence. * @param ctx query context * @return distinct iterator * @throws QueryException query exception */ private Iter distinctValues(final QueryContext ctx) throws QueryException { final Collation coll = checkColl(expr.length == 2 ? expr[1] : null, ctx); if(expr[0] instanceof RangeSeq) return expr[0].iter(ctx); return new Iter() { final ItemSet set = coll == null ? new HashItemSet() : new CollationItemSet(coll); final Iter ir = expr[0].iter(ctx); @Override public Item next() throws QueryException { while(true) { Item i = ir.next(); if(i == null) return null; ctx.checkStop(); i = atom(i, info); if(set.add(i, info)) return i; } } }; } /** * Inserts items before the specified position. * @param ctx query context * @return iterator * @throws QueryException query exception */ private Iter insertBefore(final QueryContext ctx) throws QueryException { return new Iter() { final long pos = Math.max(1, checkItr(expr[1], ctx)); final Iter iter = expr[0].iter(ctx); final Iter ins = expr[2].iter(ctx); long p = pos; boolean last; @Override public Item next() throws QueryException { if(last) return p > 0 ? ins.next() : null; final boolean sub = p == 0 || --p == 0; final Item i = (sub ? ins : iter).next(); if(i != null) return i; if(sub) --p; else last = true; return next(); } }; } /** * Removes an item at a specified position in a sequence. * @param ctx query context * @return iterator without item * @throws QueryException query exception */ private Iter remove(final QueryContext ctx) throws QueryException { return new Iter() { final long pos = checkItr(expr[1], ctx); final Iter iter = expr[0].iter(ctx); long c; @Override public Item next() throws QueryException { return ++c != pos || iter.next() != null ? iter.next() : null; } }; } /** * Creates a subsequence out of a sequence, starting with start and * ending with end. * @param ctx query context * @return subsequence * @throws QueryException query exception */ private Iter subseqIter(final QueryContext ctx) throws QueryException { final double ds = checkDbl(expr[1], ctx); if(Double.isNaN(ds)) return Empty.ITER; final long s = StrictMath.round(ds); final boolean si = s == Long.MIN_VALUE; long l = Long.MAX_VALUE; if(expr.length > 2) { final double dl = checkDbl(expr[2], ctx); if(Double.isNaN(dl)) return Empty.ITER; if(si && dl == Double.POSITIVE_INFINITY) return Empty.ITER; l = StrictMath.round(dl); } final boolean li = l == Long.MAX_VALUE; if(si) return li ? expr[0].iter(ctx) : Empty.ITER; final Iter iter = ctx.iter(expr[0]); // optimization: return subsequence if(iter instanceof ValueIter) { final Value val = iter.value(); final long rs = val.size(); final long from = Math.max(1, s) - 1; final long len = Math.min(rs - from, l + Math.min(0, s - 1)); return SubSeq.get(val, from, len).iter(); } final long max = iter.size(); final long e = li ? l : s + l; // return iterator with all supported functions if number of returned values is known if(max != -1) return new Iter() { // directly access specified items final long m = Math.min(e, max + 1); long c = Math.max(1, s); @Override public Item next() throws QueryException { return c < m ? iter.get(c++ - 1) : null; } @Override public Item get(final long i) throws QueryException { return iter.get(c + i - 1); } @Override public long size() { return Math.max(0, m - c); } @Override public boolean reset() { c = Math.max(1, s); return true; } }; // return simple iterator if number of returned values is unknown return new Iter() { long c; @Override public Item next() throws QueryException { while(true) { final Item i = iter.next(); if(i == null || ++c >= e) return null; if(c >= s) return i; } } }; } /** * Evaluates the {@code subsequence} function strictly. * @param ctx query context * @return resulting value * @throws QueryException query exception */ private Value subseqValue(final QueryContext ctx) throws QueryException { final double dstart = checkDbl(expr[1], ctx); if(Double.isNaN(dstart)) return Empty.SEQ; final long start = StrictMath.round(dstart); final boolean sinf = start == Long.MIN_VALUE; long length = Long.MAX_VALUE; if(expr.length > 2) { final double dlength = checkDbl(expr[2], ctx); if(Double.isNaN(dlength)) return Empty.SEQ; if(sinf && dlength == Double.POSITIVE_INFINITY) return Empty.SEQ; length = StrictMath.round(dlength); } final boolean linf = length == Long.MAX_VALUE; if(sinf) return linf ? expr[0].value(ctx) : Empty.SEQ; final Iter iter = ctx.iter(expr[0]); // optimization: return subsequence if(iter instanceof ValueIter) { final Value val = iter.value(); final long rs = val.size(); final long from = Math.max(1, start) - 1; final long len = Math.min(rs - from, length + Math.min(0, start - 1)); return SubSeq.get(val, from, len); } // fast route if the size is known final long max = iter.size(); if(max >= 0) { final long from = Math.max(1, start) - 1; final long len = Math.min(max - from, length + Math.min(0, start - 1)); if(from >= max || len <= 0) return Empty.SEQ; final ValueBuilder vb = new ValueBuilder(Math.max((int) len, 1)); for(long i = 0; i < len; i++) vb.add(iter.get(from + i)); return vb.value(); } final long e = linf ? length : start + length; final ValueBuilder build = new ValueBuilder(); Item i; for(int c = 1; (i = iter.next()) != null; c++) { if(c >= e) { iter.reset(); break; } if(c >= start) build.add(i); } return build.value(); } /** * Reverses a sequence. * @param ctx query context * @return iterator * @throws QueryException query exception */ private Iter reverse(final QueryContext ctx) throws QueryException { // optimization: reverse sequence if(expr[0] instanceof Seq) return ((Seq) expr[0]).reverse().iter(); // materialize value if number of results is unknown final Iter iter = ctx.iter(expr[0]); final long s = iter.size(); if(s == -1) { // estimate result size (could be known in the original expression) final ValueBuilder vb = new ValueBuilder(Math.max((int) expr[0].size(), 1)); for(Item it; (it = iter.next()) != null;) vb.add(it); Array.reverse(vb.item, 0, (int) vb.size()); return vb; } // return iterator if only a single result will be returned return s == 0 ? Empty.ITER : s == 1 ? iter : new Iter() { long c = s; @Override public Item next() throws QueryException { return --c >= 0 ? iter.get(c) : null; } @Override public Item get(final long i) throws QueryException { return iter.get(s - i - 1); } @Override public long size() { return s; } @Override public boolean reset() { c = s; return iter.reset(); } }; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNSimple.java000066400000000000000000000151751222453003200256300ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.util.Compare.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.query.value.type.SeqType.Occ; import org.basex.util.*; /** * Simple functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNSimple extends StandardFunc { /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNSimple(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Iter iter(final QueryContext ctx) throws QueryException { switch(sig) { case ONE_OR_MORE: final Iter ir = expr[0].iter(ctx); final long len = ir.size(); if(len == 0) throw EXPECTOM.thrw(info); if(len > 0) return ir; return new Iter() { private boolean first = true; @Override public Item next() throws QueryException { final Item it = ir.next(); if(first) { if(it == null) throw EXPECTOM.thrw(info); first = false; } return it; } }; case UNORDERED: return ctx.iter(expr[0]); default: return super.iter(ctx); } } @Override public Value value(final QueryContext ctx) throws QueryException { switch(sig) { case ONE_OR_MORE: final Value val = ctx.value(expr[0]); if(val.isEmpty()) throw EXPECTOM.thrw(info); return val; case UNORDERED: return ctx.value(expr[0]); default: return super.value(ctx); } } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { final Expr e = expr.length == 1 ? expr[0] : null; switch(sig) { case FALSE: return Bln.FALSE; case TRUE: return Bln.TRUE; case EMPTY: return Bln.get(e.iter(ctx).next() == null); case EXISTS: return Bln.get(e.iter(ctx).next() != null); case BOOLEAN: return Bln.get(e.ebv(ctx, info).bool(info)); case NOT: return Bln.get(!e.ebv(ctx, info).bool(info)); case DEEP_EQUAL: return Bln.get(deep(ctx)); case DEEP_EQUAL_OPT: return Bln.get(deepOpt(ctx)); case ZERO_OR_ONE: Iter ir = e.iter(ctx); Item it = ir.next(); if(it != null && ir.next() != null) EXPECTZ0.thrw(info); return it; case EXACTLY_ONE: ir = e.iter(ctx); it = ir.next(); if(it == null || ir.next() != null) EXPECTO.thrw(info); return it; default: return super.item(ctx, ii); } } @Override protected Expr opt(final QueryContext ctx) throws QueryException { if(expr.length == 0) return this; final Expr e = expr[0]; switch(sig) { case EMPTY: case EXISTS: // ignore non-deterministic expressions (e.g.: error()) return e.size() == -1 || e.has(Flag.NDT) || e.has(Flag.CNS) ? this : Bln.get(sig == Function.EMPTY ^ e.size() != 0); case BOOLEAN: // simplify, e.g.: if(boolean(A)) -> if(A) return e.type().eq(SeqType.BLN) ? e : this; case NOT: if(e.isFunction(Function.EMPTY)) { // simplify: not(empty(A)) -> exists(A) ctx.compInfo(QueryText.OPTWRITE, this); expr = ((StandardFunc) e).expr; sig = Function.EXISTS; } else if(e.isFunction(Function.EXISTS)) { // simplify: not(exists(A)) -> empty(A) ctx.compInfo(QueryText.OPTWRITE, this); expr = ((StandardFunc) e).expr; sig = Function.EMPTY; } else if(e instanceof CmpV || e instanceof CmpG) { // simplify: not('a' = 'b') -> 'a' != 'b' final Cmp c = ((Cmp) e).invert(); return c == e ? this : c; } else if(e.isFunction(Function.NOT)) { // simplify: not(not(A)) -> boolean(A) return compBln(((StandardFunc) e).expr[0], info); } else { // simplify, e.g.: not(boolean(A)) -> not(A) expr[0] = e.compEbv(ctx); } return this; case ZERO_OR_ONE: type = SeqType.get(e.type().type, Occ.ZERO_ONE); return e.type().zeroOrOne() ? e : this; case EXACTLY_ONE: type = SeqType.get(e.type().type, Occ.ONE); return e.type().one() ? e : this; case ONE_OR_MORE: type = SeqType.get(e.type().type, Occ.ONE_MORE); return !e.type().mayBeZero() ? e : this; case UNORDERED: return e; default: return this; } } @Override public Expr compEbv(final QueryContext ctx) { if(expr.length == 0) return this; final Expr e = expr[0]; Expr ex = this; if(sig == Function.BOOLEAN) { // (test)[boolean(A)] -> (test)[A] if(!e.type().mayBeNumber()) ex = e; } else if(sig == Function.EXISTS) { // if(exists(node*)) -> if(node*) if(e.type().type.isNode()) ex = e; } if(ex != this) ctx.compInfo(QueryText.OPTWRITE, this); return ex; } /** * Checks items for deep equality. * @param ctx query context * @return result of check * @throws QueryException query exception */ private boolean deep(final QueryContext ctx) throws QueryException { final Collation coll = checkColl(expr.length == 3 ? expr[2] : null, ctx); return new Compare(info).collation(coll).deep(ctx.iter(expr[0]), ctx.iter(expr[1])); } /** * Checks items for deep equality. * @param ctx query context * @return result of check * @throws QueryException query exception */ private boolean deepOpt(final QueryContext ctx) throws QueryException { final Compare cmp = new Compare(info); final Mode[] modes = Mode.values(); if(expr.length == 3) { final Iter ir = expr[2].iter(ctx); for(Item it; (it = ir.next()) != null;) { final byte[] key = uc(checkEStr(it)); boolean found = false; for(final Mode m : modes) { found = eq(key, token(m.name())); if(found) { cmp.flag(m); break; } } if(!found) ELMOPTION.thrw(info, key); } } return cmp.deep(ctx.iter(expr[0]), ctx.iter(expr[1])); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNSql.java000066400000000000000000000350071222453003200251320ustar00rootroot00000000000000package org.basex.query.func; import static java.sql.DriverManager.*; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.sql.*; import java.sql.Date; import java.util.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Functions on relational databases. * * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ public final class FNSql extends StandardFunc { /** Module prefix. */ private static final String PREFIX = "zip"; /** QName. */ private static final QNm Q_ROW = QNm.get(PREFIX, "row", SQLURI); /** QName. */ private static final QNm Q_COLUMN = QNm.get(PREFIX, "column", SQLURI); /** QName. */ private static final QNm Q_OPTIONS = QNm.get(PREFIX, "options", SQLURI); /** QName. */ private static final QNm Q_PARAMETERS = QNm.get(PREFIX, "parameters", SQLURI); /** QName. */ private static final QNm Q_PARAMETER = QNm.get(PREFIX, "parameter", SQLURI); /** Type int. */ private static final byte[] INT = AtomType.INT.string(); /** Type string. */ private static final byte[] STRING = AtomType.STR.string(); /** Type boolean. */ private static final byte[] BOOL = AtomType.BLN.string(); /** Type date. */ private static final byte[] DATE = AtomType.DAT.string(); /** Type double. */ private static final byte[] DOUBLE = AtomType.DBL.string(); /** Type float. */ private static final byte[] FLOAT = AtomType.FLT.string(); /** Type short. */ private static final byte[] SHORT = AtomType.SHR.string(); /** Type time. */ private static final byte[] TIME = AtomType.TIM.string(); /** Type timestamp. */ private static final byte[] TIMESTAMP = token("timestamp"); /** Name. */ private static final String NAME = "name"; /** Auto-commit mode. */ private static final byte[] AUTO_COMM = token("autocommit"); /** User. */ private static final String USER = "user"; /** Password. */ private static final String PASS = "password"; /** Attribute "type" of . */ private static final byte[] TYPE = token("type"); /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNSql(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Iter iter(final QueryContext ctx) throws QueryException { checkCreate(ctx); switch(sig) { case _SQL_EXECUTE: return execute(ctx); case _SQL_EXECUTE_PREPARED: return executePrepared(ctx); default: return super.iter(ctx); } } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { checkCreate(ctx); switch(sig) { case _SQL_INIT: return init(ctx); case _SQL_CONNECT: return connect(ctx); case _SQL_PREPARE: return prepare(ctx); case _SQL_CLOSE: return close(ctx); case _SQL_COMMIT: return commit(ctx); case _SQL_ROLLBACK: return rollback(ctx); default: return super.item(ctx, ii); } } /** * Initializes JDBC with the specified driver. * @param ctx query context * @return {@code null} * @throws QueryException query exception */ private Item init(final QueryContext ctx) throws QueryException { final String driver = string(checkStr(expr[0], ctx)); if(Reflect.find(driver) == null) BXSQ_DRIVER.thrw(info, driver); return null; } /** * Establishes a connection to a relational database. * @param ctx query context * @return connection id * @throws QueryException query exception */ private Int connect(final QueryContext ctx) throws QueryException { // URL to relational database final String url = string(checkStr(expr[0], ctx)); try { if(expr.length > 2) { // credentials final String user = string(checkStr(expr[1], ctx)); final String pass = string(checkStr(expr[2], ctx)); if(expr.length == 4) { // connection options final Item opt = checkItem(expr[3], ctx); final TokenMap options = new FuncParams(Q_OPTIONS, info).parse(opt); // extract auto-commit mode from options boolean ac = true; final byte[] commit = options.get(AUTO_COMM); if(commit != null) { ac = eq(commit, TRUE); options.delete(AUTO_COMM); } // connection properties final Properties props = connProps(options); props.setProperty(USER, user); props.setProperty(PASS, pass); // open connection final Connection conn = getConnection(url, props); // set auto/commit mode conn.setAutoCommit(ac); return Int.get(ctx.jdbc().add(conn)); } return Int.get(ctx.jdbc().add(getConnection(url, user, pass))); } return Int.get(ctx.jdbc().add(getConnection(url))); } catch(final SQLException ex) { throw BXSQ_ERROR.thrw(info, ex); } } /** * Parses connection options. * @param options options * @return connection properties */ private static Properties connProps(final TokenMap options) { final Properties props = new Properties(); for(final byte[] next : options) { if(next != null) props.setProperty(string(next), string(options.get(next))); } return props; } /** * Prepares a statement and returns its id. * @param ctx query context * @return prepared statement id * @throws QueryException query exception */ private Int prepare(final QueryContext ctx) throws QueryException { final Connection conn = connection(ctx, false); // Prepared statement final byte[] prepStmt = checkStr(expr[1], ctx); try { // Keep prepared statement final PreparedStatement prep = conn.prepareStatement(string(prepStmt)); return Int.get(ctx.jdbc().add(prep)); } catch(final SQLException ex) { throw BXSQ_ERROR.thrw(info, ex); } } /** * Executes a query, update or prepared statement. * @param ctx query context * @return result * @throws QueryException query exception */ private NodeSeqBuilder execute(final QueryContext ctx) throws QueryException { final int id = (int) checkItr(expr[0], ctx); final Object obj = ctx.jdbc().get(id); if(!(obj instanceof Connection)) BXSQ_CONN.thrw(info, id); final String query = string(checkStr(expr[1], ctx)); Statement stmt = null; try { stmt = ((Connection) obj).createStatement(); final boolean result = stmt.execute(query); return result ? buildResult(stmt.getResultSet()) : new NodeSeqBuilder(); } catch(final SQLException ex) { throw BXSQ_ERROR.thrw(info, ex); } finally { if(stmt != null) try { stmt.close(); } catch(final SQLException ignored) { } } } /** * Executes a query, update or prepared statement. * @param ctx query context * @return result * @throws QueryException query exception */ private NodeSeqBuilder executePrepared(final QueryContext ctx) throws QueryException { final int id = (int) checkItr(expr[0], ctx); final Object obj = ctx.jdbc().get(id); if(!(obj instanceof PreparedStatement)) BXSQ_STATE.thrw(info, id); // Get parameters for prepared statement long c = 0; ANode params = null; if(expr.length > 1) { params = (ANode) checkType(checkItem(expr[1], ctx), NodeType.ELM); if(!params.qname().eq(Q_PARAMETERS)) ELMOPTION.thrw(info, params.qname()); c = countParams(params); } try { final PreparedStatement stmt = (PreparedStatement) obj; // Check if number of parameters equals number of place holders if(c != stmt.getParameterMetaData().getParameterCount()) BXSQ_PARAMS.thrw(info); if(params != null) setParameters(params.children(), stmt); return stmt.execute() ? buildResult(stmt.getResultSet()) : new NodeSeqBuilder(); } catch(final SQLException ex) { throw BXSQ_ERROR.thrw(info, ex); } } /** * Counts the numbers of elements. * @param params element * @return number of parameters */ private static long countParams(final ANode params) { final AxisIter ch = params.children(); long c = ch.size(); if(c == -1) do ++c; while(ch.next() != null); return c; } /** * Sets the parameters of a prepared statement. * @param params parameters * @param stmt prepared statement * @throws QueryException query exception */ private void setParameters(final AxisMoreIter params, final PreparedStatement stmt) throws QueryException { int i = 0; for(ANode next; (next = params.next()) != null;) { // Check name if(!next.qname().eq(Q_PARAMETER)) ELMOPTION.thrw(info, next.qname()); final AxisIter attrs = next.attributes(); byte[] paramType = null; boolean isNull = false; for(ANode attr; (attr = attrs.next()) != null;) { // Attribute "type" if(eq(attr.name(), TYPE)) paramType = attr.string(); // Attribute "null" else if(eq(attr.name(), NULL)) isNull = attr.string() != null && Bln.parse(attr.string(), info); // Not expected attribute else throw BXSQ_ATTR.thrw(info, string(attr.name())); } if(paramType == null) BXSQ_TYPE.thrw(info); final byte[] v = next.string(); setParam(++i, stmt, paramType, isNull ? null : string(v), isNull); } } /** * Sets the parameter with the given index in a prepared statement. * @param index parameter index * @param stmt prepared statement * @param paramType parameter type * @param value parameter value * @param isNull indicator if the parameter is null or not * @throws QueryException query exception */ private void setParam(final int index, final PreparedStatement stmt, final byte[] paramType, final String value, final boolean isNull) throws QueryException { try { if(eq(BOOL, paramType)) { if(isNull) stmt.setNull(index, Types.BOOLEAN); else stmt.setBoolean(index, Boolean.parseBoolean(value)); } else if(eq(DATE, paramType)) { if(isNull) stmt.setNull(index, Types.DATE); else stmt.setDate(index, Date.valueOf(value)); } else if(eq(DOUBLE, paramType)) { if(isNull) stmt.setNull(index, Types.DOUBLE); else stmt.setDouble(index, Double.parseDouble(value)); } else if(eq(FLOAT, paramType)) { if(isNull) stmt.setNull(index, Types.FLOAT); else stmt.setFloat(index, Float.parseFloat(value)); } else if(eq(INT, paramType)) { if(isNull) stmt.setNull(index, Types.INTEGER); else stmt.setInt(index, Integer.parseInt(value)); } else if(eq(SHORT, paramType)) { if(isNull) stmt.setNull(index, Types.SMALLINT); else stmt.setShort(index, Short.parseShort(value)); } else if(eq(STRING, paramType)) { if(isNull) stmt.setNull(index, Types.VARCHAR); else stmt.setString(index, value); } else if(eq(TIME, paramType)) { if(isNull) stmt.setNull(index, Types.TIME); else stmt.setTime(index, Time.valueOf(value)); } else if(eq(TIMESTAMP, paramType)) { if(isNull) stmt.setNull(index, Types.TIMESTAMP); else stmt.setTimestamp(index, Timestamp.valueOf(value)); } else { throw BXSQ_ERROR.thrw(info, "unsupported type: " + string(paramType)); } } catch(final SQLException ex) { throw BXSQ_ERROR.thrw(info, ex); } catch(final IllegalArgumentException ex) { throw BXSQ_FORMAT.thrw(info, string(paramType)); } } /** * Builds a sequence of elements from a query's result set. * @param rs result set * @return sequence of elements each of which represents a row from * the result set * @throws QueryException query exception */ private NodeSeqBuilder buildResult(final ResultSet rs) throws QueryException { try { final ResultSetMetaData metadata = rs.getMetaData(); final int cc = metadata.getColumnCount(); final NodeSeqBuilder rows = new NodeSeqBuilder(); while(rs.next()) { final FElem row = new FElem(Q_ROW); rows.add(row); for(int k = 1; k <= cc; k++) { // For each row add column values as children final String label = metadata.getColumnLabel(k); final Object value = rs.getObject(label); // Null values are ignored if(value == null) continue; // Element ... row.add(new FElem(Q_COLUMN).add(NAME, label).add(value.toString())); } } return rows; } catch(final SQLException ex) { throw BXSQ_ERROR.thrw(info, ex); } } /** * Closes a connection to a relational database. * @param ctx query context * @return {@code null} * @throws QueryException query exception */ private Item close(final QueryContext ctx) throws QueryException { try { connection(ctx, true).close(); return null; } catch(final SQLException ex) { throw BXSQ_ERROR.thrw(info, ex); } } /** * Commits all changes made during last transaction. * @param ctx query context * @return {@code null} * @throws QueryException query exception */ private Item commit(final QueryContext ctx) throws QueryException { try { connection(ctx, false).commit(); return null; } catch(final SQLException ex) { throw BXSQ_ERROR.thrw(info, ex); } } /** * Rollbacks all changes made during last transaction. * @param ctx query context * @return {@code null} * @throws QueryException query exception */ private Item rollback(final QueryContext ctx) throws QueryException { try { connection(ctx, false).rollback(); return null; } catch(final SQLException ex) { throw BXSQ_ERROR.thrw(info, ex); } } /** * Returns a connection and removes it from list with opened connections if * requested. * @param ctx query context * @param del flag indicating if connection has to be removed * @return connection * @throws QueryException query exception */ private Connection connection(final QueryContext ctx, final boolean del) throws QueryException { final int id = (int) checkItr(expr[0], ctx); final Object obj = ctx.jdbc().get(id); if(!(obj instanceof Connection)) BXSQ_CONN.thrw(info, id); if(del) ctx.jdbc().remove(id); return (Connection) obj; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNStr.java000066400000000000000000000233551222453003200251460ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.text.*; import java.text.Normalizer.Form; import java.util.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * String functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNStr extends StandardFunc { /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNStr(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Iter iter(final QueryContext ctx) throws QueryException { final Expr e = expr[0]; switch(sig) { case STRING_TO_CODEPOINTS: return str2cp(e.item(ctx, info)); default: return super.iter(ctx); } } @Override public Value value(final QueryContext ctx) throws QueryException { switch(sig) { case STRING_TO_CODEPOINTS: final int[] tmp = cps(checkEStr(expr[0], ctx)); final long[] vals = new long[tmp.length]; for(int i = 0; i < tmp.length; i++) vals[i] = tmp[i]; return IntSeq.get(vals, AtomType.ITR); default: return super.value(ctx); } } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { final Expr e = expr[0]; switch(sig) { case CODEPOINTS_TO_STRING: return cp2str(ctx.iter(e)); case COMPARE: Collation coll = checkColl(expr.length == 3 ? expr[2] : null, ctx); Item it1 = e.item(ctx, info); Item it2 = expr[1].item(ctx, info); if(it1 == null || it2 == null) return null; return Int.get(Math.max(-1, Math.min(1, coll == null ? diff(checkEStr(it1), checkEStr(it2)) : coll.compare(checkStr(it1), checkStr(it2))))); case CODEPOINT_EQUAL: it1 = e.item(ctx, info); it2 = expr[1].item(ctx, info); if(it1 == null || it2 == null) return null; return Bln.get(eq(checkEStr(it1), checkEStr(it2))); case STRING_JOIN: return strjoin(ctx); case SUBSTRING: return substr(ctx); case NORMALIZE_UNICODE: return normuni(ctx); case UPPER_CASE: return Str.get(uc(checkEStr(e, ctx))); case LOWER_CASE: return Str.get(lc(checkEStr(e, ctx))); case TRANSLATE: return trans(ctx); case ENCODE_FOR_URI: return Str.get(uri(checkEStr(e, ctx), false)); case IRI_TO_URI: return Str.get(uri(checkEStr(e, ctx), true)); case ESCAPE_HTML_URI: return Str.get(escape(checkEStr(e, ctx))); case CONCAT: return concat(ctx); case CONTAINS: coll = checkColl(expr.length == 3 ? expr[2] : null, ctx); byte[] ss = checkEStr(e, ctx); byte[] sb = checkEStr(expr[1], ctx); return Bln.get(coll == null ? contains(ss, sb) : coll.contains(ss, sb, info)); case STARTS_WITH: coll = checkColl(expr.length == 3 ? expr[2] : null, ctx); ss = checkEStr(e, ctx); sb = checkEStr(expr[1], ctx); return Bln.get(coll == null ? startsWith(ss, sb) : coll.startsWith(ss, sb, info)); case ENDS_WITH: coll = checkColl(expr.length == 3 ? expr[2] : null, ctx); ss = checkEStr(e, ctx); sb = checkEStr(expr[1], ctx); return Bln.get(coll == null ? endsWith(ss, sb) : coll.endsWith(ss, sb, info)); case SUBSTRING_AFTER: coll = checkColl(expr.length == 3 ? expr[2] : null, ctx); ss = checkEStr(e, ctx); sb = checkEStr(expr[1], ctx); if(coll == null) { final int p = indexOf(ss, sb); return p != -1 ? Str.get(substring(ss, p + sb.length)) : Str.ZERO; } return Str.get(coll.after(ss, sb, info)); case SUBSTRING_BEFORE: coll = checkColl(expr.length == 3 ? expr[2] : null, ctx); ss = checkEStr(e, ctx); sb = checkEStr(expr[1], ctx); if(coll == null) { final int p = indexOf(ss, sb); return p != -1 ? Str.get(substring(ss, 0, p)) : Str.ZERO; } return Str.get(coll.before(ss, sb, info)); default: return super.item(ctx, ii); } } /** * Converts codepoints to a string. * @param ir iterator * @return iterator * @throws QueryException query exception */ private Str cp2str(final Iter ir) throws QueryException { final TokenBuilder tb = new TokenBuilder(Math.max(8, (int) ir.size())); for(Item it; (it = ir.next()) != null;) { final long n = checkItr(it); final int i = (int) n; // check int boundaries before casting if(n < Integer.MIN_VALUE || n > Integer.MAX_VALUE || !XMLToken.valid(i)) INVCODE.thrw(info, Long.toHexString(n)); tb.add(i); } return Str.get(tb.finish()); } /** * Converts a string to code points, lazily. * @param it item * @return iterator * @throws QueryException query exception */ private Iter str2cp(final Item it) throws QueryException { if(it == null) return Empty.ITER; final byte[] s = checkEStr(it); return new Iter() { int l; @Override public Item next() { if(l >= s.length) return null; final int i = cp(s, l); l += cl(s, l); return Int.get(i); } }; } /** * Returns a substring. * @param ctx query context * @return iterator * @throws QueryException query exception */ private Str substr(final QueryContext ctx) throws QueryException { // normalize positions final byte[] str = checkEStr(expr[0], ctx); final Item is = checkItem(expr[1], ctx); int s; if(is instanceof Int) { s = (int) is.itr(info) - 1; } else { final double ds = is.dbl(info); if(Double.isNaN(ds)) return Str.ZERO; s = subPos(ds); } final boolean end = expr.length == 3, ascii = ascii(str); int l = ascii ? str.length : len(str); int e = l; if(end) { final Item ie = checkItem(expr[2], ctx); e = ie instanceof Int ? (int) ie.itr(info) : subPos(ie.dbl(info) + 1); } if(s < 0) { e += s; s = 0; } e = Math.min(l, end ? s + e : Integer.MAX_VALUE); if(s >= e) return Str.ZERO; if(ascii) return Str.get(substring(str, s, e)); int ss = s; int ee = e; int p = 0; for(l = 0; l < str.length; l += cl(str, l), ++p) { if(p == s) ss = l; if(p == e) ee = l; } if(p == e) ee = l; return Str.get(Arrays.copyOfRange(str, ss, ee)); } /** * Returns the specified substring position. * @param d double value * @return substring position */ private static int subPos(final double d) { final int i = (int) d; return d == i ? i - 1 : (int) StrictMath.floor(d - .5); } /** * Returns a translated string. * @param ctx query context * @return string * @throws QueryException query exception */ private Str trans(final QueryContext ctx) throws QueryException { final int[] tok = cps(checkEStr(expr[0], ctx)); final int[] srch = cps(checkStr(expr[1], ctx)); final int[] rep = cps(checkStr(expr[2], ctx)); final TokenBuilder tmp = new TokenBuilder(tok.length); for(final int t : tok) { int j = -1; while(++j < srch.length && t != srch[j]) ; if(j < srch.length) { if(j >= rep.length) continue; tmp.add(rep[j]); } else { tmp.add(t); } } return Str.get(tmp.finish()); } /** * Returns a joined string. * @param ctx query context * @return iterator * @throws QueryException query exception */ private Str strjoin(final QueryContext ctx) throws QueryException { final byte[] sep = expr.length == 2 ? checkStr(expr[1], ctx) : EMPTY; final TokenBuilder tb = new TokenBuilder(); final Iter iter = ctx.iter(expr[0]); int c = 0; for(Item i; (i = iter.next()) != null;) { tb.add(checkEStr(i)).add(sep); ++c; } final byte[] v = tb.finish(); return Str.get(c == 0 ? v : substring(v, 0, v.length - sep.length)); } /** * Returns normalized unicode. * @param ctx query context * @return string * @throws QueryException query exception */ private Str normuni(final QueryContext ctx) throws QueryException { final byte[] str = checkEStr(expr[0], ctx); Form form = Form.NFC; if(expr.length == 2) { final byte[] n = uc(trim(checkStr(expr[1], ctx))); if(n.length == 0) return Str.get(str); try { form = Form.valueOf(string(n)); } catch(final IllegalArgumentException ex) { NORMUNI.thrw(info, n); } } return ascii(str) ? Str.get(str) : Str.get(Normalizer.normalize(string(str), form)); } /** * Concatenates strings. * @param ctx query context * @return resulting item * @throws QueryException query exception */ private Str concat(final QueryContext ctx) throws QueryException { final TokenBuilder tb = new TokenBuilder(); for(final Expr a : expr) { final Item it = a.item(ctx, info); if(it != null) tb.add(it.string(info)); } return Str.get(tb.finish()); } @Override public boolean has(final Flag flag) { return flag == Flag.X30 && sig == Function.STRING_JOIN && expr.length == 1 || super.has(flag); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNStream.java000066400000000000000000000031561222453003200256260ustar00rootroot00000000000000package org.basex.query.func; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * Streaming functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNStream extends StandardFunc { /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNStream(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { switch(sig) { case _STREAM_MATERIALIZE: return materialize(ctx); case _STREAM_IS_STREAMABLE: return isStreamable(ctx); default: return super.item(ctx, ii); } } /** * Performs the materialize function. * @param ctx query context * @return resulting value * @throws QueryException query exception */ private Item materialize(final QueryContext ctx) throws QueryException { return checkItem(expr[0], ctx).materialize(info); } /** * Performs the is-streamable function. * @param ctx query context * @return resulting value * @throws QueryException query exception */ private Item isStreamable(final QueryContext ctx) throws QueryException { final Item it = checkItem(expr[0], ctx); return Bln.get(it instanceof StrStream || it instanceof B64Stream); } @Override protected Expr opt(final QueryContext ctx) throws QueryException { if(sig == Function._STREAM_MATERIALIZE) type = expr[0].type(); return this; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNUnit.java000066400000000000000000000053671222453003200253200ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.util.Err.*; import java.util.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.unit.*; import org.basex.query.value.item.*; import org.basex.util.*; import org.basex.util.list.*; /** * Unit functions. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class FNUnit extends StandardFunc { /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNUnit(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { switch(sig) { case _UNIT_ASSERT: return assrt(ctx); case _UNIT_FAIL: return fail(ctx); case _UNIT_TEST: return test(ctx); case _UNIT_TEST_URIS: return testUris(ctx); default: return super.item(ctx, ii); } } /** * Performs the assert function. * @param ctx query context * @return resulting value * @throws QueryException query exception */ private Item assrt(final QueryContext ctx) throws QueryException { final byte[] str = expr.length < 2 ? null : checkStr(expr[1], ctx); if(expr[0].ebv(ctx, info).bool(info)) return null; throw str == null ? UNIT_ASSERT.thrw(info) : UNIT_MESSAGE.thrw(info, str); } /** * Performs the fail function. * @param ctx query context * @return resulting value * @throws QueryException query exception */ private Item fail(final QueryContext ctx) throws QueryException { throw UNIT_MESSAGE.thrw(info, checkStr(expr[0], ctx)); } /** * Performs the test function. * @param ctx query context * @return resulting value * @throws QueryException query exception */ private Item test(final QueryContext ctx) throws QueryException { final Unit unit = new Unit(ctx, info); if(expr.length == 0) return unit.test(); final ArrayList funcs = new ArrayList(); final Iter ir = ctx.iter(expr[0]); for(Item it; (it = ir.next()) != null;) { final FItem fi = checkFunc(it, ctx); if(fi instanceof FuncItem) funcs.add(((FuncItem) fi).func); } return unit.test(funcs); } /** * Performs the test-uris function. * @param ctx query context * @return resulting value * @throws QueryException query exception */ private Item testUris(final QueryContext ctx) throws QueryException { checkCreate(ctx); final TokenList tl = new TokenList(); final Iter ir = ctx.iter(expr[0]); for(Item it; (it = ir.next()) != null;) tl.add(checkStr(it)); return new Suite(ctx, info).test(tl); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNValidate.java000066400000000000000000000273561222453003200261340ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.io.*; import java.net.*; import javax.xml.*; import javax.xml.parsers.*; import javax.xml.transform.stream.*; import javax.xml.validation.*; import org.basex.core.*; import org.basex.io.*; import org.basex.io.out.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.util.*; import org.basex.util.list.*; import org.xml.sax.*; import org.xml.sax.helpers.*; /** * Functions for validating documents. * * @author BaseX Team 2005-12, BSD License * @author Michael Seiferle * @author Marco Lettere (greedy/verbose validation) */ public final class FNValidate extends StandardFunc { /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNValidate(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Iter iter(final QueryContext ctx) throws QueryException { checkCreate(ctx); switch(sig) { case _VALIDATE_XSD_INFO: return xsdInfo(ctx).iter(); case _VALIDATE_DTD_INFO: return dtdInfo(ctx).iter(); default: return super.iter(ctx); } } @Override public Value value(final QueryContext ctx) throws QueryException { switch(sig) { case _VALIDATE_XSD_INFO: return xsdInfo(ctx); case _VALIDATE_DTD_INFO: return dtdInfo(ctx); default: return super.value(ctx); } } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { checkCreate(ctx); switch(sig) { case _VALIDATE_XSD: return xsd(ctx); case _VALIDATE_DTD: return dtd(ctx); default: return super.item(ctx, ii); } } /** * Validates a document against an XML Schema. * @param ctx query context * @return {@code null} * @throws QueryException query exception */ private Item xsd(final QueryContext ctx) throws QueryException { final Value seq = xsdInfo(ctx); if(seq == Empty.SEQ) return null; throw BXVA_FAIL.thrw(info, seq.iter().next()); } /** * Validates a document against an XML Schema. * The following two variants exist: * *
{@code validate:xsd($doc)}:
*
    *
  • Looks for {@code xsi:(noNamespace)schemaLocation} in {@code $doc} and * uses this schema for validation.
  • *
  • {@code $doc} must contain a schemaLocation declaration for validation * to work.
  • *
  • {@code $doc} is allowed to be either a {@code XML node} or a {@code * xs:string} pointing to an URL or a local file that will then be parsed * and validated.
  • *
*
{@code validate:xsd($doc, $schema)}:
*
    *
  • if {@code $doc} contains an {@code xsi:(noNamespace)schemaLocation} it * will be ignored.
  • *
  • {@code $doc} is allowed to be either a {@code XML node} or a {@code * xs:string} pointing to an URL or a local file
  • *
  • {@code $schema as xs:string} is expected to point to an URL or a local * file containing the schema definitions.
  • *
* * @param ctx query context * @return info string sequence, or null * @throws QueryException query exception */ private Value xsdInfo(final QueryContext ctx) throws QueryException { return process(new Validate() { @Override void process(final ErrorHandler handler) throws IOException, SAXException, QueryException { final IO in = read(checkItem(expr[0], ctx), ctx, null); final SchemaFactory sf = SchemaFactory.newInstance( XMLConstants.W3C_XML_SCHEMA_NS_URI); final Schema schema; if(expr.length < 2) { // assume that schema declaration is included in document schema = sf.newSchema(); } else { final Item it = checkItem(expr[1], ctx); // schema specified as string IO sc = read(it, ctx, null); if(!sc.exists()) WHICHRES.thrw(info, sc); tmp = createTmp(sc); if(tmp != null) sc = tmp; schema = sf.newSchema(new URL(sc.url())); } final Validator v = schema.newValidator(); v.setErrorHandler(handler); v.validate(new StreamSource(in.inputStream())); } }); } /** * Validates a document against a DTD. * @param ctx query context * @return {@code null} * @throws QueryException query exception */ private Item dtd(final QueryContext ctx) throws QueryException { final Value seq = dtdInfo(ctx); if(seq == Empty.SEQ) return null; throw BXVA_FAIL.thrw(info, seq.iter().next()); } /** * Validates a document against a DTD. * The following two variants exist: * *
    {@code validate:dtd($doc)} *
  • Looks for the document type declaration in {@code $doc} and * uses it for validation.
  • *
  • {@code $doc} must contain a DTD for this to work.
  • *
  • {@code $doc} is allowed to be either a {@code XML node} or a {@code * xs:string} pointing to an URL or a local file that will then be parsed * and validated.
  • *
*
    {@code validate:dtd($doc, $dtd)} *
  • {@code $doc} is allowed to be either a {@code XML node} or a {@code * xs:string} pointing to an URL or a local file
  • *
  • {@code $dtd as xs:string} is expected to point to an URL or a local * file containing the document type definitions.
  • *
* @param ctx query context * @return info string sequence, or null * @throws QueryException query exception */ private Value dtdInfo(final QueryContext ctx) throws QueryException { return process(new Validate() { @Override void process(final ErrorHandler handler) throws IOException, ParserConfigurationException, SAXException, QueryException { final Item it = checkItem(expr[0], ctx); SerializerProp sp = null; // integrate doctype declaration via serialization properties if(expr.length > 1) { sp = new SerializerProp(); final String dtd = string(checkStr(expr[1], ctx)); IO sc = IO.get(dtd); if(!sc.exists()) WHICHRES.thrw(info, dtd); tmp = createTmp(sc); if(tmp != null) sc = tmp; sp.set(SerializerProp.S_DOCTYPE_SYSTEM, sc.url()); } final IO in = read(it, ctx, sp); final SAXParserFactory sf = SAXParserFactory.newInstance(); sf.setValidating(true); sf.newSAXParser().parse(in.inputSource(), handler); } }); } /** * Runs the specified validator. * @param v validator code * @return string sequence with warnings and errors * @throws QueryException query exception */ private Value process(final Validate v) throws QueryException { final ErrorHandler handler = new ErrorHandler(); try { v.process(handler); } catch(final QueryException ex) { throw ex; } catch(final IOException ex) { throw BXVA_START.thrw(info, ex); } catch(final ParserConfigurationException ex) { throw BXVA_START.thrw(info, ex); } catch(final SAXException ex) { // fatal exception: get original message Throwable e = ex; while(e.getCause() != null) { Util.debug(e); e = e.getCause(); } return Str.get(Text.FATAL_C + ex.getLocalizedMessage()); } finally { if(v.tmp != null) v.tmp.delete(); } // return error strings return StrSeq.get(handler.getExceptions()); } /** * Creates a temporary file with the contents of the specified IO reference. * {@code null} is returned if the IO reference refers to an existing file. * @param in input file * @return resulting file * @throws IOException I/O exception */ static IOFile createTmp(final IO in) throws IOException { if(!(in instanceof IOContent || in instanceof IOStream)) return null; final IOFile tmp = new IOFile(File.createTempFile("validate", IO.BASEXSUFFIX)); tmp.write(in.read()); return tmp; } /** * Returns an input reference (possibly cached) to the first argument. * @param it item * @param ctx query context * @param sp serializer properties * @return item * @throws QueryException query exception * @throws IOException exception */ IO read(final Item it, final QueryContext ctx, final SerializerProp sp) throws QueryException, IOException { if(it.type.isNode()) { // return node in string representation final ArrayOutput ao = new ArrayOutput(); Serializer.get(ao, sp).serialize(it); final IOContent io = new IOContent(ao.toArray()); io.name(string(((ANode) it).baseURI())); return io; } if(it.type.isStringOrUntyped()) { final String path = string(it.string(info)); IO io = IO.get(path); if(!io.exists()) WHICHRES.thrw(info, path); if(sp != null) { // add doctype declaration if specified final ArrayOutput ao = new ArrayOutput(); Serializer.get(ao, sp).serialize(new DBNode(io, ctx.context.prop)); io = new IOContent(ao.toArray()); io.name(path); } return io; } throw STRNODTYPE.thrw(info, this, it.type); } /** Schema error handler. */ static class ErrorHandler extends DefaultHandler { /** Will contain all raised validation exception messages. */ private final TokenList exceptions = new TokenList(); @Override public void fatalError(final SAXParseException ex) { error(ex, Text.FATAL_C); } @Override public void error(final SAXParseException ex) { error(ex, Text.ERROR_C); } @Override public void warning(final SAXParseException ex) { error(ex, Text.WARNING_C); } /** * Adds an error message. * @param ex exception * @param type type of error */ private void error(final SAXParseException ex, final String type) { // may be recursively called if external validator (e.g. Saxon) is used String msg = ex.getMessage(); if(msg.contains("Exception:")) { Throwable e = ex; while(e.getCause() != null) e = e.getCause(); if(e instanceof SAXException) msg = e.getLocalizedMessage(); } else { final TokenBuilder report = new TokenBuilder(); final String id = ex.getSystemId(); if(id != null) report.add(IO.get(id).name()).add(", "); report.addExt(ex.getLineNumber()).add(Text.COL).addExt(ex.getColumnNumber()); report.add(": ").add(msg); msg = report.toString(); } exceptions.add(type + msg); } /** * Returns the exception messages. * @return exception messages */ protected TokenList getExceptions() { return exceptions; } } /** Abstract validator class. */ abstract static class Validate { /** Temporary file instance. */ IOFile tmp; /** * Starts the validation. * @param h error handler * @throws IOException I/O exception * @throws ParserConfigurationException parser configuration exception * @throws SAXException SAX exception * @throws QueryException query exception */ abstract void process(ErrorHandler h) throws IOException, ParserConfigurationException, SAXException, QueryException; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNXQuery.java000066400000000000000000000071071222453003200256300ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.func.Function.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.io.*; import java.util.*; import org.basex.io.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.util.*; /** * XQuery functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNXQuery extends StandardFunc { /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNXQuery(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Iter iter(final QueryContext ctx) throws QueryException { switch(sig) { case _XQUERY_EVAL: return eval(ctx); case _XQUERY_INVOKE: return invoke(ctx); case _XQUERY_TYPE: return value(ctx).iter(); default: return super.iter(ctx); } } @Override public Value value(final QueryContext ctx) throws QueryException { switch(sig) { case _XQUERY_EVAL: return eval(ctx).value(); case _XQUERY_INVOKE: return invoke(ctx).value(); case _XQUERY_TYPE: return opt(ctx).value(ctx); default: return super.value(ctx); } } @Override protected Expr opt(final QueryContext ctx) throws QueryException { if(sig == Function._XQUERY_TYPE) { FNInfo.dump(Util.inf("{ type: %, size: % }", expr[0].type(), expr[0].size()), Token.token(expr[0].toString()), ctx); return expr[0]; } return this; } /** * Performs the eval function. * @param ctx query context * @return resulting value * @throws QueryException query exception */ private ValueBuilder eval(final QueryContext ctx) throws QueryException { return eval(ctx, checkStr(expr[0], ctx), null); } /** * Evaluates the specified string. * @param ctx query context * @param qu query string * @param path path to query file (may be {@code null}) * @return resulting value * @throws QueryException query exception */ private ValueBuilder eval(final QueryContext ctx, final byte[] qu, final String path) throws QueryException { final QueryContext qc = new QueryContext(ctx.context); // bind variables and context item for(final Map.Entry it : bindings(1, ctx).entrySet()) { final String k = it.getKey(); final Value v = it.getValue(); if(k.isEmpty()) qc.context(v, null); else qc.bind(k, v, null); } // evaluate query try { qc.parseMain(string(qu), path); if(qc.updating) BXXQ_UPDATING.thrw(info); qc.compile(); final ValueBuilder vb = new ValueBuilder(); cache(qc.iter(), vb, ctx); return vb; } finally { qc.close(); } } /** * Performs the invoke function. * @param ctx query context * @return resulting value * @throws QueryException query exception */ private ValueBuilder invoke(final QueryContext ctx) throws QueryException { checkCreate(ctx); final String path = string(checkStr(expr[0], ctx)); final IO io = IO.get(path); if(!io.exists()) WHICHRES.thrw(info, path); try { return eval(ctx, io.read(), path); } catch(final IOException ex) { throw IOERR.thrw(info, ex); } } @Override public boolean accept(final ASTVisitor visitor) { if(oneOf(sig, _XQUERY_EVAL, _XQUERY_INVOKE) && !visitor.lock(null)) return false; return super.accept(visitor); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNXslt.java000066400000000000000000000124271222453003200253260ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Reflect.*; import static org.basex.util.Token.*; import java.io.*; import javax.xml.transform.*; import javax.xml.transform.stream.*; import org.basex.core.*; import org.basex.io.*; import org.basex.io.out.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Functions for performing XSLT transformations. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNXslt extends StandardFunc { /** Element: parameters. */ private static final QNm Q_PARAMETERS = QNm.get("parameters", XSLTURI); /** XSLT implementations. */ private static final String[] IMPL = { "", "Java", "1.0", "net.sf.saxon.TransformerFactoryImpl", "Saxon HE", "2.0", "com.saxonica.config.ProfessionalTransformerFactory", "Saxon PE", "2.0", "com.saxonica.config.EnterpriseTransformerFactory", "Saxon EE", "2.0" }; /** Implementation offset. */ private static final int OFFSET; static { final String fac = TransformerFactory.class.getName(); final String impl = System.getProperty(fac); // system property has already been set if(System.getProperty(fac) != null) { // modify processor and version IMPL[1] = impl; IMPL[2] = "Unknown"; OFFSET = 0; } else { // search for existing processors int s = IMPL.length - 3; while(s != 0 && find(IMPL[s]) == null) s -= 3; OFFSET = s; // set processor, or use default processor if(s != 0) System.setProperty(fac, IMPL[s]); } } /** * Returns details on the XSLT implementation. * @param name name flag * @return string */ static String get(final boolean name) { return IMPL[OFFSET + (name ? 1 : 2)]; } /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNXslt(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { switch(sig) { case _XSLT_PROCESSOR: return Str.get(get(true)); case _XSLT_VERSION: return Str.get(get(false)); case _XSLT_TRANSFORM: return transform(ctx, true); case _XSLT_TRANSFORM_TEXT: return transform(ctx, false); default: return super.item(ctx, ii); } } /** * Performs an XSL transformation. * @param ctx query context * @param node return result as node * @return item * @throws QueryException query exception */ private Item transform(final QueryContext ctx, final boolean node) throws QueryException { checkCreate(ctx); final IO in = read(checkItem(expr[0], ctx)); final IO xsl = read(checkItem(expr[1], ctx)); final Item opt = expr.length > 2 ? expr[2].item(ctx, info) : null; final TokenMap map = new FuncParams(Q_PARAMETERS, info).parse(opt); final PrintStream tmp = System.err; final ArrayOutput ao = new ArrayOutput(); try { System.setErr(new PrintStream(ao)); final byte[] result = transform(in, xsl, map); return node ? new DBNode(new IOContent(result), ctx.context.prop) : Str.get(result); } catch(final IOException ex) { System.setErr(tmp); throw IOERR.thrw(info, ex); } catch(final TransformerException ex) { System.setErr(tmp); throw BXSL_ERROR.thrw(info, Token.trim(Token.utf8(ao.toArray(), Prop.ENCODING))); } finally { System.setErr(tmp); } } /** * Returns an input reference (possibly cached) to the specified input. * @param it item to be evaluated * @return item * @throws QueryException query exception */ private IO read(final Item it) throws QueryException { if(it.type.isNode()) { final IO io = new IOContent(it.serialize().toArray()); io.name(string(((ANode) it).baseURI())); return io; } if(it.type.isStringOrUntyped()) { final String path = string(it.string(info)); final IO io = IO.get(path); if(!io.exists()) WHICHRES.thrw(info, path); return io; } throw STRNODTYPE.thrw(info, this, it.type); } /** * Uses Java's XSLT implementation to perform an XSL transformation. * @param in input * @param xsl style sheet * @param par parameters * @return transformed result * @throws TransformerException transformer exception */ private static byte[] transform(final IO in, final IO xsl, final TokenMap par) throws TransformerException { // create transformer final TransformerFactory tc = TransformerFactory.newInstance(); final Transformer tr = tc.newTransformer(xsl.streamSource()); // bind parameters for(final byte[] key : par) tr.setParameter(string(key), string(par.get(key))); // do transformation and return result final ArrayOutput ao = new ArrayOutput(); tr.transform(in.streamSource(), new StreamResult(ao)); return ao.toArray(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FNZip.java000066400000000000000000000361631222453003200251410ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.io.*; import java.util.*; import java.util.zip.*; import org.basex.build.*; import org.basex.build.file.*; import org.basex.core.*; import org.basex.io.*; import org.basex.io.in.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.list.*; /** * Functions on zip files. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNZip extends StandardFunc { /** Module prefix. */ private static final String PREFIX = "zip"; /** QName. */ private static final QNm Q_FILE = QNm.get(PREFIX, "file", ZIPURI); /** QName. */ private static final QNm Q_DIR = QNm.get(PREFIX, "dir", ZIPURI); /** QName. */ private static final QNm Q_ENTRY = QNm.get(PREFIX, "entry", ZIPURI); /** Attribute: href. */ private static final byte[] HREF = token("href"); /** Attribute: name. */ private static final byte[] NAME = token("name"); /** Attribute: src. */ private static final byte[] SRC = token("src"); /** Attribute: method. */ private static final byte[] METHOD = token("method"); /** Method "base64". */ private static final String M_BASE64 = "base64"; /** Method "hex". */ private static final String M_HEX = "hex"; /** * Constructor. * @param ii input info * @param f function definition * @param e arguments */ public FNZip(final InputInfo ii, final Function f, final Expr... e) { super(ii, f, e); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { checkCreate(ctx); switch(sig) { case _ZIP_BINARY_ENTRY: return binaryEntry(ctx); case _ZIP_TEXT_ENTRY: return textEntry(ctx); case _ZIP_HTML_ENTRY: return xmlEntry(ctx, true); case _ZIP_XML_ENTRY: return xmlEntry(ctx, false); case _ZIP_ENTRIES: return entries(ctx); case _ZIP_ZIP_FILE: return zipFile(ctx); case _ZIP_UPDATE_ENTRIES: return updateEntries(ctx); default: return super.item(ctx, ii); } } /** * Returns a xs:base64Binary item, created from a binary file. * Returns a binary entry. * @param ctx query context * @return binary result * @throws QueryException query exception */ private B64 binaryEntry(final QueryContext ctx) throws QueryException { return new B64(entry(ctx)); } /** * Returns a string, created from a text file. * @param ctx query context * @return binary result * @throws QueryException query exception */ private Str textEntry(final QueryContext ctx) throws QueryException { final String enc = expr.length < 3 ? null : string(checkStr(expr[2], ctx)); final IO io = new IOContent(entry(ctx)); final boolean val = ctx.context.prop.is(Prop.CHECKSTRINGS); try { return Str.get(new NewlineInput(io).encoding(enc).validate(val).content()); } catch(final IOException ex) { throw ZIP_FAIL.thrw(info, ex); } } /** * Returns a document node, created from an XML or HTML file. * @param ctx query context * @param html html flag * @return binary result * @throws QueryException query exception */ private ANode xmlEntry(final QueryContext ctx, final boolean html) throws QueryException { final Prop prop = ctx.context.prop; final IO io = new IOContent(entry(ctx)); try { return new DBNode(html ? new HTMLParser(io, prop) : Parser.xmlParser(io, prop)); } catch(final IOException ex) { throw SAXERR.thrw(info, ex); } } /** * Returns a zip archive description. * @param ctx query context * @return binary result * @throws QueryException query exception */ private ANode entries(final QueryContext ctx) throws QueryException { final String file = string(checkStr(expr[0], ctx)); // check file path final IOFile path = new IOFile(file); if(!path.exists()) ZIP_NOTFOUND.thrw(info, file); // loop through file ZipFile zf = null; try { zf = new ZipFile(file); // create result node final FElem root = new FElem(Q_FILE).declareNS().add(HREF, path.path()); createEntries(paths(zf).iterator(), root, ""); return root; } catch(final IOException ex) { throw ZIP_FAIL.thrw(info, ex); } finally { if(zf != null) try { zf.close(); } catch(final IOException ignored) { } } } /** * Creates the zip archive nodes in a recursive manner. * @param it iterator * @param par parent node * @param pref directory prefix * @return current prefix */ private static String createEntries(final Iterator it, final FElem par, final String pref) { String path = null; boolean curr = false; while(curr || it.hasNext()) { if(!curr) { path = it.next(); curr = true; } if(path == null) break; // current entry is located in a higher/other directory if(!path.startsWith(pref)) return path; // current file starts with new directory final int i = path.lastIndexOf('/'); final String dir = i == -1 ? path : path.substring(0, i); final String name = path.substring(i + 1); if(name.isEmpty()) { // path ends with slash: create directory path = createEntries(it, createDir(par, dir), dir); } else { // create file createFile(par, name); curr = false; } } return null; } /** * Creates a directory element. * @param par parent node * @param name name of directory * @return element */ private static FElem createDir(final FElem par, final String name) { final FElem e = new FElem(Q_DIR).add(NAME, name); par.add(e); return e; } /** * Creates a file element. * @param par parent node * @param name name of directory */ private static void createFile(final FElem par, final String name) { par.add(new FElem(Q_ENTRY).add(NAME, name)); } /** * Creates a new zip file. * @param ctx query context * @return binary result * @throws QueryException query exception */ private Item zipFile(final QueryContext ctx) throws QueryException { // check argument final ANode elm = (ANode) checkType(expr[0].item(ctx, info), NodeType.ELM); if(!elm.qname().eq(Q_FILE)) ZIP_UNKNOWN.thrw(info, elm.qname()); // get file final String file = attribute(elm, HREF, true); // write zip file FileOutputStream fos = null; boolean ok = true; try { fos = new FileOutputStream(file); final ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(fos)); create(zos, elm.children(), "", null, ctx); zos.close(); } catch(final IOException ex) { ok = false; ZIP_FAIL.thrw(info, ex); } finally { if(fos != null) { try { fos.close(); } catch(final IOException ignored) { } if(!ok) new IOFile(file).delete(); } } return null; } /** * Adds files to the specified zip output, or copies files from the * specified file. * @param zos output stream * @param ai axis iterator * @param root root path * @param ctx query context * @param zf original zip file (or {@code null}) * @throws QueryException query exception * @throws IOException I/O exception */ private void create(final ZipOutputStream zos, final AxisIter ai, final String root, final ZipFile zf, final QueryContext ctx) throws QueryException, IOException { final byte[] data = new byte[IO.BLOCKSIZE]; for(ANode node; (node = ai.next()) != null;) { // get entry type final QNm mode = node.qname(); final boolean dir = mode.eq(Q_DIR); if(!dir && !mode.eq(Q_ENTRY)) ZIP_UNKNOWN.thrw(info, mode); // file path: if null, the zip base name is used String name = attribute(node, NAME, false); // source: if null, the node's children are serialized String src = attribute(node, SRC, false); if(src != null) src = src.replaceAll("\\\\", "/"); if(name == null) { // throw exception if both attributes are null if(src == null) throw ZIP_INVALID.thrw(info, node.qname(), SRC); name = src; } name = name.replaceAll(".*/", ""); // add slash to directories if(dir) name += '/'; zos.putNextEntry(new ZipEntry(root + name)); if(dir) { create(zos, node.children(), root + name, zf, ctx); } else { if(src != null) { // write file to zip archive if(!new IOFile(src).exists()) ZIP_NOTFOUND.thrw(info, src); BufferedInputStream bis = null; try { bis = new BufferedInputStream(new FileInputStream(src)); for(int c; (c = bis.read(data)) != -1;) zos.write(data, 0, c); } finally { if(bis != null) try { bis.close(); } catch(final IOException ignored) { } } } else { // no source reference: the child nodes are treated as file contents final AxisIter ch = node.children(); final String m = attribute(node, METHOD, false); // retrieve first child (might be null) ANode n = ch.next(); // access original zip file if available, and if no children exist ZipEntry ze = null; if(zf != null && n == null) ze = zf.getEntry(root + name); if(ze != null) { // add old zip entry final InputStream zis = zf.getInputStream(ze); for(int c; (c = zis.read(data)) != -1;) zos.write(data, 0, c); } else if(n != null) { // write new binary content to archive final boolean hex = M_HEX.equals(m); if(hex || M_BASE64.equals(m)) { // treat children as base64/hex final ByteList bl = new ByteList(); do bl.add(n.string()); while((n = ch.next()) != null); final byte[] bytes = bl.toArray(); zos.write((hex ? new Hex(bytes) : new B64(bytes)).toJava()); } else { // serialize new nodes try { final Serializer ser = Serializer.get(zos, serPar(node)); do { ser.serialize(DataBuilder.stripNS(n, ZIPURI, ctx.context)); } while((n = ch.next()) != null); ser.close(); } catch(final SerializerException ex) { throw ex.getCause(info); } } } } zos.closeEntry(); } } } /** * Returns serialization parameters. * @param node node with parameters * @return properties */ private static SerializerProp serPar(final ANode node) { // interpret query parameters final TokenBuilder tb = new TokenBuilder(); final AxisIter ati = node.attributes(); for(ANode at; (at = ati.next()) != null;) { final byte[] name = at.qname().string(); if(Token.eq(name, NAME) || Token.eq(name, SRC)) continue; if(!tb.isEmpty()) tb.add(','); tb.add(name).add('=').add(at.string()); } return new SerializerProp(tb.toString()); } /** * Updates a zip archive. * @param ctx query context * @return empty result * @throws QueryException query exception */ private Item updateEntries(final QueryContext ctx) throws QueryException { // check argument final ANode elm = (ANode) checkType(expr[0].item(ctx, info), NodeType.ELM); if(!elm.qname().eq(Q_FILE)) ZIP_UNKNOWN.thrw(info, elm.qname()); // sorted paths in original file final String in = attribute(elm, HREF, true); // target and temporary output file final IOFile target = new IOFile(string(checkStr(expr[1], ctx))); IOFile out; do { out = new IOFile(target.path() + new Random().nextInt(0x7FFFFFFF)); } while(out.exists()); // open zip file if(!new IOFile(in).exists()) ZIP_NOTFOUND.thrw(info, in); ZipFile zf = null; boolean ok = true; try { zf = new ZipFile(in); // write zip file FileOutputStream fos = null; try { fos = new FileOutputStream(out.path()); final ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(fos)); // fill new zip file with entries from old file and description create(zos, elm.children(), "", zf, ctx); zos.close(); } catch(final IOException ex) { ok = false; ZIP_FAIL.thrw(info, ex); } finally { if(fos != null) try { fos.close(); } catch(final IOException ignored) { } } } catch(final IOException ex) { throw ZIP_FAIL.thrw(info, ex); } finally { if(zf != null) try { zf.close(); } catch(final IOException ignored) { } if(ok) { // rename temporary file to final target target.delete(); out.rename(target); } else { // remove temporary file out.delete(); } } return null; } /** * Returns a list of all file paths. * @param zf zip file file to be parsed * @return binary result */ private static StringList paths(final ZipFile zf) { // traverse all zip entries and create intermediate map, // as zip entries are not sorted //final StringList paths = new StringList(); final TreeSet paths = new TreeSet(); final Enumeration en = zf.entries(); // loop through all files while(en.hasMoreElements()) { final ZipEntry ze = en.nextElement(); final String name = ze.getName(); final int i = name.lastIndexOf('/'); // add directory if(i > -1 && i + 1 < name.length()) paths.add(name.substring(0, i + 1)); paths.add(name); } final StringList sl = new StringList(); for(final String path : paths) sl.add(path); return sl; } /** * Returns the value of the specified attribute. * @param elm element node * @param name attribute to be found * @param force if set to {@code true}, an exception is thrown if the * attribute is not found * @return attribute value * @throws QueryException query exception */ private String attribute(final ANode elm, final byte[] name, final boolean force) throws QueryException { final byte[] val = elm.attribute(name); if(val == null && force) throw ZIP_INVALID.thrw(info, elm.qname(), name); return val == null ? null : string(val); } /** * Returns an entry from a zip file. * @param ctx query context * @return binary result * @throws QueryException query exception */ private byte[] entry(final QueryContext ctx) throws QueryException { final IOFile file = new IOFile(string(checkStr(expr[0], ctx))); final String path = string(checkStr(expr[1], ctx)); if(!file.exists()) ZIP_NOTFOUND.thrw(info, file); try { return new Zip(file).read(path); } catch(final FileNotFoundException ex) { throw ZIP_NOTFOUND.thrw(info, file + "/" + path); } catch(final IOException ex) { throw ZIP_FAIL.thrw(info, ex); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FuncCall.java000066400000000000000000000115711222453003200256360ustar00rootroot00000000000000package org.basex.query.func; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * An XQuery function call, either static or dynamic. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public abstract class FuncCall extends Arr { /** Tail-call flag. */ protected boolean tailCall; /** * Constructor. * @param ii input info * @param e sub-expressions */ protected FuncCall(final InputInfo ii, final Expr[] e) { super(ii, e); } /** * Evaluates and returns the function to be called. * @param ctx query context * @return the function * @throws QueryException query exception */ abstract XQFunction evalFunc(final QueryContext ctx) throws QueryException; /** * Evaluates and returns the arguments for this call. * @param ctx query context * @return the function * @throws QueryException query exception */ abstract Value[] evalArgs(final QueryContext ctx) throws QueryException; @Override public final Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { return (Item) invoke(evalFunc(ctx), evalArgs(ctx), true, tailCall, ctx, info); } @Override public final Value value(final QueryContext ctx) throws QueryException { return invoke(evalFunc(ctx), evalArgs(ctx), false, tailCall, ctx, info); } @Override public final Iter iter(final QueryContext ctx) throws QueryException { return value(ctx).iter(); } @Override public final void markTailCalls() { tailCall = true; } /** * Calls the given function with the given arguments and takes care of tail-calls. * @param fun function to call * @param arg arguments for the call * @param ctx query context * @param itm flag for requesting a single item * @param tc flag for a tail call * @param ii input info * @return result of the function call * @throws QueryException query exception */ private static Value invoke(final XQFunction fun, final Value[] arg, final boolean itm, final boolean tc, final QueryContext ctx, final InputInfo ii) throws QueryException { final int calls = ctx.tailCalls, max = ctx.maxCalls; if(tc && max >= 0 && ++ctx.tailCalls >= max) { // there are at least `ctx.maxCalls` tail-calls on the stack, eliminate them throw new Continuation(fun, arg); } try { // tail-calls are evaluated immediately if(tc) return itm ? fun.invItem(ctx, ii, arg) : fun.invValue(ctx, ii, arg); // non-tail-calls have to catch the continuations and resume from there XQFunction func = fun; Value[] args = arg; for(;;) { try { return itm ? func.invItem(ctx, ii, args) : func.invValue(ctx, ii, args); } catch(final Continuation c) { func = c.func; args = c.args; ctx.tailCalls = calls; } } } catch(final QueryException ex) { ex.add(ii); throw ex; } finally { ctx.tailCalls = calls; } } /** * Calls the given function with the given arguments, returning zero or one item. * This method takes care of tail calls. * @param fun function to call * @param arg arguments to the function * @param ctx query context * @param ii input info * @return the resulting item * @throws QueryException query exception */ public static Item item(final XQFunction fun, final Value[] arg, final QueryContext ctx, final InputInfo ii) throws QueryException { return (Item) invoke(fun, arg, true, false, ctx, ii); } /** * Calls the given function with the given arguments, returning zero or more items. * This method takes care of tail calls. * @param fun function to call * @param arg arguments to the function * @param ctx query context * @param ii input info * @return the resulting value * @throws QueryException query exception */ public static Value value(final XQFunction fun, final Value[] arg, final QueryContext ctx, final InputInfo ii) throws QueryException { return invoke(fun, arg, false, false, ctx, ii); } /** * A continuation that's thrown to free stack frames. * @author Leo Woerteler */ private static final class Continuation extends RuntimeException { /** The function to call. */ private final XQFunction func; /** The arguments to call the function with. */ private final Value[] args; /** * Constructor. * @param fun function to call * @param arg arguments to the function */ private Continuation(final XQFunction fun, final Value[] arg) { func = fun; args = arg; } @Override public synchronized Continuation fillInStackTrace() { // ignore this for efficiency reasons return this; } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FuncLit.java000066400000000000000000000077701222453003200255210ustar00rootroot00000000000000package org.basex.query.func; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * A named function literal. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class FuncLit extends Single implements Scope { /** Variable scope. */ private final VarScope scope; /** Static context. */ private final StaticContext sc; /** Function name. */ private final QNm name; /** Formal parameters. */ private final Var[] args; /** If the function's type should be checked at compile time. */ private final boolean check; /** Compilation flag. */ private boolean compiled; /** * Constructor. * @param nm function name * @param arg formal parameters * @param fn function body * @param ft function type * @param scp variable scope * @param sctx static context * @param ii input info */ public FuncLit(final QNm nm, final Var[] arg, final Expr fn, final FuncType ft, final VarScope scp, final StaticContext sctx, final InputInfo ii) { super(ii, fn); name = nm; args = arg; check = ft == null; type = (ft == null ? FuncType.arity(args.length) : ft).seqType(); scope = scp; sc = sctx; } @Override public void compile(final QueryContext ctx) throws QueryException { if(compiled) return; compiled = true; if(check) { final StaticFunc sf = ctx.funcs.get(name, args.length, info); if(sf == null) throw Err.FUNCUNKNOWN.thrw(info, name.string()); type = sf.funcType().seqType(); } final int fp = scope.enter(ctx); try { expr = expr.compile(ctx, scope); expr.markTailCalls(); } finally { scope.cleanUp(this); scope.exit(ctx, fp); } } @Override public Expr compile(final QueryContext ctx, final VarScope o) throws QueryException { compile(ctx); return expr.isValue() ? preEval(ctx) : this; } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { return new FuncItem(name, args, expr, (FuncType) type.type, false, ctx.value, ctx.pos, ctx.size, null, scope, sc, null); } @Override public Expr copy(final QueryContext ctx, final VarScope o, final IntObjMap vs) { final VarScope scp = new VarScope(); final Var[] arg = new Var[args.length]; for(int i = 0; i < arg.length; i++) vs.put(args[i].id, arg[i] = scp.newCopyOf(ctx, args[i])); final Expr call = expr.copy(ctx, scp, vs); return new FuncLit(name, arg, call, (FuncType) type.type, scp, sc, info); } @Override public boolean has(final Flag flag) { return flag == Flag.CTX || flag == Flag.FCS; } /** * Creates a function literal for a function that was not yet encountered while parsing. * @param nm function name * @param ar function arity * @param ctx query context * @param ii input info * @return function literal * @throws QueryException query exception */ public static FuncLit unknown(final QNm nm, final long ar, final QueryContext ctx, final InputInfo ii) throws QueryException { final VarScope scp = new VarScope(); final FuncType temp = FuncType.arity((int) ar); final Var[] arg = new Var[(int) ar]; final Expr[] refs = temp.args(arg, ctx, scp, ii); final TypedFunc call = ctx.funcs.getFuncRef(nm, refs, ctx.sc, ii); return new FuncLit(nm, arg, call.fun, null, scp, ctx.sc, ii); } @Override public boolean visit(final ASTVisitor visitor) { for(final Var v : args) if(!visitor.declared(v)) return false; return expr.accept(visitor); } @Override public boolean accept(final ASTVisitor visitor) { return visitor.inlineFunc(this); } @Override public boolean compiled() { return compiled; } @Override public String toString() { return new TokenBuilder(name.string()).add('#').addExt(args.length).toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/FuncParams.java000066400000000000000000000102421222453003200262000ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.path.*; import org.basex.query.value.item.*; import org.basex.query.value.map.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.hash.*; /** * This class parses parameters specified in function arguments. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FuncParams { /** QName. */ public static final QNm Q_SPARAM = QNm.get("serialization-parameters", OUTPUTURI); /** Value. */ private static final String VALUE = "value"; /** Root element. */ private final QNm root; /** Root node test. */ private final NodeTest test; /** Input info. */ private final InputInfo info; /** * Constructor. * @param name name of root node * @param ii input info */ public FuncParams(final QNm name, final InputInfo ii) { test = new NodeTest(name); root = name; info = ii; } /** * Converts the parameters of the argument to a token map. * @param it item to be converted * @return map * @throws QueryException query exception */ public TokenMap parse(final Item it) throws QueryException { return parse(it, false); } /** * Converts the parameters of the argument to a token map. * @param it item to be converted * @param ignore ignore unknown parameters * @return map * @throws QueryException query exception */ public TokenMap parse(final Item it, final boolean ignore) throws QueryException { // XQuery map: convert to internal map if(it instanceof Map) return ((Map) it).tokenMap(info); // initialize token map final TokenMap tm = new TokenMap(); if(it == null) return tm; if(!test.eq(it)) ELMMAPTYPE.thrw(info, root, it.type); // interpret options final AxisIter ai = ((ANode) it).children(); for(ANode n; (n = ai.next()) != null;) { if(n.type != NodeType.ELM) continue; final QNm qn = n.qname(); if(!eq(qn.uri(), root.uri())) { if(ignore) continue; ELMOPTION.thrw(info, n); } // retrieve key from element name and value from "value" attribute or text node final byte[] key = qn.local(); byte[] val = n.attribute(VALUE); if(val == null) val = n.string(); // separate multiple entries with "," final byte[] o = tm.get(key); if(o != null) val = new TokenBuilder(o).add(',').add(val).finish(); tm.put(key, val); } return tm; } /** * Converts the specified parameters to serialization properties. * @param it input item * @param info input info * @return serialization string * @throws QueryException query exception */ public static SerializerProp serializerProp(final Item it, final InputInfo info) throws QueryException { return serializerProp(serializerMap(it, info), info); } /** * Converts the specified parameter item to a map. * @param it input item * @param info input info * @return serialization string * @throws QueryException query exception */ public static TokenMap serializerMap(final Item it, final InputInfo info) throws QueryException { return new FuncParams(Q_SPARAM, info).parse(it, true); } /** * Converts the specified parameters to serialization properties. * @param map map with serialization parameters * @param info input info * @return serialization string * @throws QueryException query exception */ public static SerializerProp serializerProp(final TokenMap map, final InputInfo info) throws QueryException { final TokenBuilder tb = new TokenBuilder(); for(final byte[] key : map) tb.add(key).add('=').add(map.get(key)).add(','); final SerializerProp sp = new SerializerProp(tb.toString()); if(!sp.unknown.isEmpty()) SERWHICH.thrw(info, sp.unknown.get(0)); final Object[] cm = SerializerProp.S_USE_CHARACTER_MAPS; if(!sp.get(cm).isEmpty()) SERWHICH.thrw(info, cm[0].toString()); return sp; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/Function.java000066400000000000000000001463101222453003200257340ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.expr.Expr.Flag.*; import static org.basex.query.QueryText.*; import static org.basex.query.value.type.SeqType.*; import java.util.*; import java.util.regex.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.expr.Expr.Flag; import org.basex.query.util.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Definitions of all built-in XQuery functions. * Namespace mappings for function prefixes and URIs are specified in the * static code in the {@code NSGlobal} class. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public enum Function { /* FNAcc functions. */ /** XQuery function. */ POSITION(FNAcc.class, "position()", arg(), ITR, flag(FCS)), /** XQuery function. */ LAST(FNAcc.class, "last()", arg(), ITR, flag(FCS)), /** XQuery function. */ STRING(FNAcc.class, "string([item])", arg(ITEM_ZO), STR), /** XQuery function. */ NUMBER(FNAcc.class, "number([item])", arg(AAT_ZO), DBL), /** XQuery function. */ STRING_LENGTH(FNAcc.class, "string-length([item])", arg(STR_ZO), ITR), /** XQuery function. */ NORMALIZE_SPACE(FNAcc.class, "normalize-space([string])", arg(STR_ZO), STR), /** XQuery function. */ NAMESPACE_URI_FROM_QNAME(FNAcc.class, "namespace-uri-from-QName(qname)", arg(QNM_ZO), URI_ZO), /* FNAggr functions. */ /** XQuery function. */ AVG(FNAggr.class, "avg(item)", arg(AAT_ZM), AAT_ZO), /** XQuery function. */ COUNT(FNAggr.class, "count(item)", arg(ITEM_ZM), ITR), /** XQuery function. */ MAX(FNAggr.class, "max(item[,coll])", arg(AAT_ZM, STR), AAT_ZO), /** XQuery function. */ MIN(FNAggr.class, "min(item[,coll])", arg(AAT_ZM, STR), AAT_ZO), /** XQuery function. */ SUM(FNAggr.class, "sum(item[,zero])", arg(AAT_ZM, AAT_ZO), AAT_ZO), /* FNContext functions. */ /** XQuery function. */ CURRENT_DATE(FNContext.class, "current-date()", arg(), DAT), /** XQuery function. */ CURRENT_DATETIME(FNContext.class, "current-dateTime()", arg(), DTM), /** XQuery function. */ CURRENT_TIME(FNContext.class, "current-time()", arg(), TIM), /** XQuery function. */ IMPLICIT_TIMEZONE(FNContext.class, "implicit-timezone()", arg(), DTD), /** XQuery function. */ DEFAULT_COLLATION(FNContext.class, "default-collation()", arg(), STR), /** XQuery function. */ STATIC_BASE_URI(FNContext.class, "static-base-uri()", arg(), URI_ZO), /* FNDate functions. */ /** XQuery function. */ DAY_FROM_DATE(FNDate.class, "day-from-date(item)", arg(DAT_ZO), ITR_ZO), /** XQuery function. */ DAY_FROM_DATETIME(FNDate.class, "day-from-dateTime(datetime)", arg(DTM_ZO), ITR_ZO), /** XQuery function. */ DAYS_FROM_DURATION(FNDate.class, "days-from-duration(duration)", arg(DUR_ZO), ITR_ZO), /** XQuery function. */ HOURS_FROM_DATETIME(FNDate.class, "hours-from-dateTime(datetime)", arg(DTM_ZO), ITR_ZO), /** XQuery function. */ HOURS_FROM_DURATION(FNDate.class, "hours-from-duration(duration)", arg(DUR_ZO), ITR_ZO), /** XQuery function. */ HOURS_FROM_TIME(FNDate.class, "hours-from-time(item)", arg(TIM_ZO), ITR_ZO), /** XQuery function. */ MINUTES_FROM_DATETIME(FNDate.class, "minutes-from-dateTime(datetime)", arg(DTM_ZO), ITR_ZO), /** XQuery function. */ MINUTES_FROM_DURATION(FNDate.class, "minutes-from-duration(duration)", arg(DUR_ZO), ITR_ZO), /** XQuery function. */ MINUTES_FROM_TIME(FNDate.class, "minutes-from-time(item)", arg(TIM_ZO), ITR_ZO), /** XQuery function. */ MONTH_FROM_DATE(FNDate.class, "month-from-date(item)", arg(DAT_ZO), ITR_ZO), /** XQuery function. */ MONTH_FROM_DATETIME(FNDate.class, "month-from-dateTime(datetime)", arg(DTM_ZO), ITR_ZO), /** XQuery function. */ MONTHS_FROM_DURATION(FNDate.class, "months-from-duration(duration)", arg(DUR_ZO), ITR_ZO), /** XQuery function. */ SECONDS_FROM_DATETIME(FNDate.class, "seconds-from-dateTime(datetime)", arg(DTM_ZO), DEC_ZO), /** XQuery function. */ SECONDS_FROM_DURATION(FNDate.class, "seconds-from-duration(duration)", arg(DUR_ZO), DEC_ZO), /** XQuery function. */ SECONDS_FROM_TIME(FNDate.class, "seconds-from-time(item)", arg(TIM_ZO), DEC_ZO), /** XQuery function. */ TIMEZONE_FROM_DATE(FNDate.class, "timezone-from-date(item)", arg(DAT_ZO), DTD_ZO), /** XQuery function. */ TIMEZONE_FROM_DATETIME(FNDate.class, "timezone-from-dateTime(item)", arg(DTM_ZO), DTD_ZO), /** XQuery function. */ TIMEZONE_FROM_TIME(FNDate.class, "timezone-from-time(item)", arg(TIM_ZO), DTD_ZO), /** XQuery function. */ YEAR_FROM_DATE(FNDate.class, "year-from-date(item)", arg(DAT_ZO), ITR_ZO), /** XQuery function. */ YEAR_FROM_DATETIME(FNDate.class, "year-from-dateTime(datetime)", arg(DTM_ZO), ITR_ZO), /** XQuery function. */ YEARS_FROM_DURATION(FNDate.class, "years-from-duration(duration)", arg(DUR_ZO), ITR_ZO), /** XQuery function. */ ADJUST_DATE_TO_TIMEZONE(FNDate.class, "adjust-date-to-timezone(date[,zone])", arg(DAT_ZO, DTD_ZO), DAT_ZO), /** XQuery function. */ ADJUST_DATETIME_TO_TIMEZONE(FNDate.class, "adjust-dateTime-to-timezone(date[,zone])", arg(DTM_ZO, DTD_ZO), DTM_ZO), /** XQuery function. */ ADJUST_TIME_TO_TIMEZONE(FNDate.class, "adjust-time-to-timezone(date[,zone])", arg(TIM_ZO, DTD_ZO), TIM_ZO), /** XQuery function. */ DATETIME(FNDate.class, "dateTime(date,time)", arg(DAT_ZO, TIM_ZO), DTM_ZO), /* FNFormat functions. */ /** XQuery function. */ FORMAT_INTEGER(FNFormat.class, "format-integer(number,picture[,language])", arg(ITR_ZO, STR, STR), STR, flag(X30)), /** XQuery function. */ FORMAT_NUMBER(FNFormat.class, "format-number(number,picture[,format])", arg(ITR_ZO, STR, STR_ZO), STR, flag(X30)), /** XQuery function. */ FORMAT_DATETIME(FNFormat.class, "format-dateTime(number,picture,[language,calendar,place])", arg(DTM_ZO, STR, STR_ZO, STR_ZO, STR_ZO), STR_ZO, flag(X30)), /** XQuery function. */ FORMAT_DATE(FNFormat.class, "format-date(date,picture,[language,calendar,place])", arg(DAT_ZO, STR, STR_ZO, STR_ZO, STR_ZO), STR_ZO, flag(X30)), /** XQuery function. */ FORMAT_TIME(FNFormat.class, "format-time(number,picture,[language,calendar,place])", arg(TIM_ZO, STR, STR_ZO, STR_ZO, STR_ZO), STR_ZO, flag(X30)), /* FNFunc functions. */ /** XQuery function. */ FILTER(FNFunc.class, "filter(seq,function)", arg(ITEM_ZM, FuncType.get(BLN, ITEM).seqType()), ITEM_ZM, flag(X30)), /** XQuery function. */ FUNCTION_NAME(FNFunc.class, "function-name(function)", arg(FUN_O), QNM_ZO, flag(X30)), /** XQuery function. */ FUNCTION_ARITY(FNFunc.class, "function-arity(function)", arg(FUN_O), ITR, flag(X30)), /** XQuery function. */ FUNCTION_LOOKUP(FNFunc.class, "function-lookup(name,arity)", arg(QNM, ITR), FUN_OZ, flag(CTX, FCS, NDT, X30)), /** XQuery function. */ FOR_EACH(FNFunc.class, "for-each(seq,function)", arg(ITEM_ZM, FuncType.get(ITEM_ZM, ITEM).seqType()), ITEM_ZM, flag(X30)), /** XQuery function. */ FOR_EACH_PAIR(FNFunc.class, "for-each-pair(seq1,seq2,function)", arg(ITEM_ZM, ITEM_ZM, FuncType.get(ITEM_ZM, ITEM, ITEM).seqType()), ITEM_ZM, flag(X30)), /** XQuery function. */ FOLD_LEFT(FNFunc.class, "fold-left(seq,zero,function)", arg(ITEM_ZM, ITEM_ZM, FuncType.get(ITEM_ZM, ITEM_ZM, ITEM).seqType()), ITEM_ZM, flag(X30)), /** XQuery function. */ FOLD_RIGHT(FNFunc.class, "fold-right(seq,zero,function)", arg(ITEM_ZM, ITEM_ZM, FuncType.get(ITEM_ZM, ITEM, ITEM_ZM).seqType()), ITEM_ZM, flag(X30)), /* FNGen functions. */ /** XQuery function. */ DATA(FNGen.class, "data([item])", arg(ITEM_ZM), AAT_ZM), /** XQuery function. */ COLLECTION(FNGen.class, "collection([uri])", arg(STR_ZO), NOD_ZM), /** XQuery function. */ DOC(FNGen.class, "doc(uri)", arg(STR_ZO), DOC_ZO), /** XQuery function. */ DOC_AVAILABLE(FNGen.class, "doc-available(uri)", arg(STR_ZO), BLN), /** XQuery function. */ PUT(FNGen.class, "put(node,uri)", arg(NOD, STR_ZO), EMP, flag(UPD, NDT)), /** XQuery function. */ UNPARSED_TEXT(FNGen.class, "unparsed-text(uri[,encoding])", arg(STR_ZO, STR), STR_ZO, flag(X30)), /** XQuery function. */ UNPARSED_TEXT_LINES(FNGen.class, "unparsed-text-lines(uri[,encoding])", arg(STR_ZO, STR), STR_ZM, flag(X30)), /** XQuery function. */ UNPARSED_TEXT_AVAILABLE(FNGen.class, "unparsed-text-available(uri[,encoding])", arg(STR_ZO, STR), BLN, flag(X30)), /** XQuery function. */ PARSE_XML(FNGen.class, "parse-xml(string)", arg(STR_ZO), DOC_O, flag(CNS, X30)), /** XQuery function. */ PARSE_XML_FRAGMENT(FNGen.class, "parse-xml-fragment(string)", arg(STR_ZO), DOC_ZO), /** XQuery function. */ URI_COLLECTION(FNGen.class, "uri-collection([uri])", arg(STR_ZO), URI_ZM, flag(X30)), /** XQuery function. */ SERIALIZE(FNGen.class, "serialize(items[,params])", arg(ITEM_ZM, ITEM_ZO), STR, flag(X30)), /* FNId functions. */ /** XQuery function. */ ID(FNId.class, "id(string[,item])", arg(STR_ZM, NOD), ELM_ZM), /** XQuery function. */ IDREF(FNId.class, "idref(string[,item])", arg(STR_ZM, NOD), NOD_ZM), /** XQuery function. */ LANG(FNId.class, "lang(string[,item])", arg(STR_ZO, NOD), BLN), /** XQuery function. */ ELEMENT_WITH_ID(FNId.class, "element-with-id(string[,item])", arg(STR_ZM, NOD), ELM_ZM, flag(X30)), /* FNInfo functions. */ /** XQuery function. */ ERROR(FNInfo.class, "error([code[,desc[,object]]])", arg(QNM_ZO, STR, ITEM_ZM), EMP, flag(NDT)), /** XQuery function. */ TRACE(FNInfo.class, "trace(value,label)", arg(ITEM_ZM, STR), ITEM_ZM, flag(NDT)), /** XQuery function. */ ENVIRONMENT_VARIABLE(FNInfo.class, "environment-variable(string)", arg(STR), STR_ZO, flag(X30)), /** XQuery function. */ AVAILABLE_ENVIRONMENT_VARIABLES(FNInfo.class, "available-environment-variables()", arg(), STR_ZM, flag(X30)), /* FNNode functions. */ /** XQuery function. */ DOCUMENT_URI(FNNode.class, "document-uri([node])", arg(NOD_ZO), URI_ZO), /** XQuery function. */ NILLED(FNNode.class, "nilled([node])", arg(NOD_ZO), BLN_ZO), /** XQuery function. */ NODE_NAME(FNNode.class, "node-name([node])", arg(NOD_ZO), QNM_ZO), /** XQuery function. */ LOCAL_NAME(FNNode.class, "local-name([node])", arg(NOD_ZO), STR), /** XQuery function. */ NAME(FNNode.class, "name([node])", arg(NOD_ZO), STR), /** XQuery function. */ NAMESPACE_URI(FNNode.class, "namespace-uri([node])", arg(NOD_ZO), URI), /** XQuery function. */ ROOT(FNNode.class, "root([node])", arg(NOD_ZO), NOD_ZO), /** XQuery function. */ BASE_URI(FNNode.class, "base-uri([node])", arg(NOD_ZO), URI_ZO), /** XQuery function. */ GENERATE_ID(FNNode.class, "generate-id([node])", arg(NOD_ZO), STR, flag(X30)), /** XQuery function. */ HAS_CHILDREN(FNNode.class, "has-children([node])", arg(NOD_ZM), BLN, flag(X30)), /** XQuery function. */ PATH(FNNode.class, "path([node])", arg(NOD_ZO), STR_ZO, flag(X30)), /* FNNum functions. */ /** XQuery function. */ ABS(FNNum.class, "abs(num)", arg(AAT_ZO), AAT_ZO), /** XQuery function. */ CEILING(FNNum.class, "ceiling(num)", arg(AAT_ZO), AAT_ZO), /** XQuery function. */ FLOOR(FNNum.class, "floor(num)", arg(AAT_ZO), AAT_ZO), /** XQuery function. */ ROUND(FNNum.class, "round(num[,prec])", arg(AAT_ZO, ITR), AAT_ZO), /** XQuery function. */ ROUND_HALF_TO_EVEN(FNNum.class, "round-half-to-even(num[,prec])", arg(AAT_ZO, ITR), AAT_ZO), /* FNPat functions. */ /** XQuery function. */ MATCHES(FNPat.class, "matches(item,pattern[,mod])", arg(STR_ZO, STR, STR), BLN), /** XQuery function. */ REPLACE(FNPat.class, "replace(item,pattern,replace[,mod])", arg(STR_ZO, STR, STR, STR), STR), /** XQuery function. */ TOKENIZE(FNPat.class, "tokenize(item,pattern[,mod])", arg(STR_ZO, STR, STR), STR_ZM), /** XQuery function. */ ANALYZE_STRING(FNPat.class, "analyze-string(input,pattern[,mod])", arg(STR_ZO, STR, STR), ELM, flag(X30, CNS)), /* FNQName functions. */ /** XQuery function. */ IN_SCOPE_PREFIXES(FNQName.class, "in-scope-prefixes(elem)", arg(ELM), STR_ZM), /** XQuery function. */ LOCAL_NAME_FROM_QNAME(FNQName.class, "local-name-from-QName(qname)", arg(QNM_ZO), NCN_ZO), /** XQuery function. */ NAMESPACE_URI_FOR_PREFIX(FNQName.class, "namespace-uri-for-prefix(pref,elem)", arg(STR_ZO, ELM), URI_ZO), /** XQuery function. */ QNAME(FNQName.class, "QName(uri,name)", arg(STR_ZO, STR), QNM), /** XQuery function. */ PREFIX_FROM_QNAME(FNQName.class, "prefix-from-QName(qname)", arg(QNM_ZO), NCN_ZO), /** XQuery function. */ RESOLVE_QNAME(FNQName.class, "resolve-QName(item,base)", arg(STR_ZO, ELM), QNM_ZO), /** XQuery function. */ RESOLVE_URI(FNQName.class, "resolve-uri(name[,elem])", arg(STR_ZO, STR), URI_ZO), /* FNSeq functions. */ /** XQuery function. */ DISTINCT_VALUES(FNSeq.class, "distinct-values(items[,coll])", arg(AAT_ZM, STR), AAT_ZM), /** XQuery function. */ INDEX_OF(FNSeq.class, "index-of(items,item[,coll])", arg(AAT_ZM, AAT, STR), ITR_ZM), /** XQuery function. */ INSERT_BEFORE(FNSeq.class, "insert-before(items,pos,insert)", arg(ITEM_ZM, ITR, ITEM_ZM), ITEM_ZM), /** XQuery function. */ REMOVE(FNSeq.class, "remove(items,pos)", arg(ITEM_ZM, ITR), ITEM_ZM), /** XQuery function. */ REVERSE(FNSeq.class, "reverse(items)", arg(ITEM_ZM), ITEM_ZM), /** XQuery function. */ SUBSEQUENCE(FNSeq.class, "subsequence(items,start[,len])", arg(ITEM_ZM, DBL, DBL), ITEM_ZM), /** XQuery function. */ HEAD(FNSeq.class, "head(items)", arg(ITEM_ZM), ITEM_ZO, flag(X30)), /** XQuery function. */ TAIL(FNSeq.class, "tail(items)", arg(ITEM_ZM), ITEM_ZM, flag(X30)), /** XQuery function. */ OUTERMOST(FNSeq.class, "outermost(nodes)", arg(NOD_ZM), NOD_ZM), /** XQuery function. */ INNERMOST(FNSeq.class, "innermost(nodes)", arg(NOD_ZM), NOD_ZM), /* FNSimple functions. */ /** XQuery function. */ FALSE(FNSimple.class, "false()", arg(), BLN), /** XQuery function. */ TRUE(FNSimple.class, "true()", arg(), BLN), /** XQuery function. */ BOOLEAN(FNSimple.class, "boolean(item)", arg(ITEM_ZM), BLN), /** XQuery function. */ NOT(FNSimple.class, "not(item)", arg(ITEM_ZM), BLN), /** XQuery function. */ EMPTY(FNSimple.class, "empty(item)", arg(ITEM_ZM), BLN), /** XQuery function. */ EXISTS(FNSimple.class, "exists(item)", arg(ITEM_ZM), BLN), /** XQuery function. */ UNORDERED(FNSimple.class, "unordered(item)", arg(ITEM_ZM), ITEM_ZM), /** XQuery function. */ ZERO_OR_ONE(FNSimple.class, "zero-or-one(item)", arg(ITEM_ZM), ITEM_ZO), /** XQuery function. */ EXACTLY_ONE(FNSimple.class, "exactly-one(item)", arg(ITEM_ZM), ITEM), /** XQuery function. */ ONE_OR_MORE(FNSimple.class, "one-or-more(item)", arg(ITEM_ZM), ITEM_OM), /** XQuery function. */ DEEP_EQUAL(FNSimple.class, "deep-equal(item,item[,coll])", arg(ITEM_ZM, ITEM_ZM, STR), BLN), /** XQuery function (project specific). */ DEEP_EQUAL_OPT(FNSimple.class, "deep-equal-opt(item,item[,options])", arg(ITEM_ZM, ITEM_ZM, ITEM), BLN), /* FNStr functions. */ /** XQuery function. */ CODEPOINT_EQUAL(FNStr.class, "codepoint-equal(string,string)", arg(STR_ZO, STR_ZO), BLN_ZO), /** XQuery function. */ CODEPOINTS_TO_STRING(FNStr.class, "codepoints-to-string(nums)", arg(ITR_ZM), STR), /** XQuery function. */ COMPARE(FNStr.class, "compare(first,second[,coll])", arg(STR_ZO, STR_ZO, STR), ITR_ZO), /** XQuery function. */ CONCAT(FNStr.class, "concat(atom,atom[,...])", arg(AAT_ZO, AAT_ZO), STR), /** XQuery function. */ CONTAINS(FNStr.class, "contains(string,sub[,coll])", arg(STR_ZO, STR_ZO, STR), BLN), /** XQuery function. */ ENCODE_FOR_URI(FNStr.class, "encode-for-uri(string)", arg(STR_ZO), STR), /** XQuery function. */ ENDS_WITH(FNStr.class, "ends-with(string,sub[,coll])", arg(STR_ZO, STR_ZO, STR), BLN), /** XQuery function. */ ESCAPE_HTML_URI(FNStr.class, "escape-html-uri(string)", arg(STR_ZO), STR), /** XQuery function. */ IRI_TO_URI(FNStr.class, "iri-to-uri(string)", arg(STR_ZO), STR), /** XQuery function. */ LOWER_CASE(FNStr.class, "lower-case(string)", arg(STR_ZO), STR), /** XQuery function. */ NORMALIZE_UNICODE(FNStr.class, "normalize-unicode(string[,form])", arg(STR_ZO, STR), STR), /** XQuery function. */ STARTS_WITH(FNStr.class, "starts-with(string,sub[,coll])", arg(STR_ZO, STR_ZO, STR), BLN), /** XQuery function. */ STRING_JOIN(FNStr.class, "string-join(strings[,sep])", arg(STR_ZM, STR), STR), /** XQuery function. */ STRING_TO_CODEPOINTS(FNStr.class, "string-to-codepoints(string)", arg(STR_ZO), ITR_ZM), /** XQuery function. */ SUBSTRING(FNStr.class, "substring(string,start[,len])", arg(STR_ZO, DBL, DBL), STR), /** XQuery function. */ SUBSTRING_AFTER(FNStr.class, "substring-after(string,sub[,coll])", arg(STR_ZO, STR_ZO, STR), STR), /** XQuery function. */ SUBSTRING_BEFORE(FNStr.class, "substring-before(string,sub[,coll])", arg(STR_ZO, STR_ZO, STR), STR), /** XQuery function. */ TRANSLATE(FNStr.class, "translate(string,map,trans)", arg(STR_ZO, STR, STR), STR), /** XQuery function. */ UPPER_CASE(FNStr.class, "upper-case(string)", arg(STR_ZO), STR), /* FNMap functions. */ /** XQuery function. */ _MAP_NEW(FNMap.class, "new([maps[,coll]])", arg(MAP_ZM, STR), MAP_O, flag(X30)), /** XQuery function. */ _MAP_ENTRY(FNMap.class, "entry(key,value)", arg(AAT, ITEM_ZM), MAP_O, flag(X30)), /** XQuery function. */ _MAP_GET(FNMap.class, "get(map,key)", arg(MAP_O, AAT), ITEM_ZM, flag(X30)), /** XQuery function. */ _MAP_CONTAINS(FNMap.class, "contains(map,key)", arg(MAP_O, AAT), BLN, flag(X30)), /** XQuery function. */ _MAP_REMOVE(FNMap.class, "remove(map,key)", arg(MAP_O, AAT), MAP_O, flag(X30)), /** XQuery function. */ _MAP_SIZE(FNMap.class, "size(map)", arg(MAP_O), ITR, flag(X30)), /** XQuery function. */ _MAP_KEYS(FNMap.class, "keys(map)", arg(MAP_O), AAT_ZM, flag(X30)), /** XQuery function. */ _MAP_COLLATION(FNMap.class, "collation(map)", arg(MAP_O), STR, flag(X30)), /* FNMath functions. */ /** XQuery function. */ _MATH_PI(FNMath.class, "pi()", arg(), DBL, flag(X30)), /** XQuery function. */ _MATH_SQRT(FNMath.class, "sqrt(number)", arg(DBL_ZO), DBL_ZO, flag(X30)), /** XQuery function. */ _MATH_SIN(FNMath.class, "sin(number)", arg(DBL_ZO), DBL_ZO, flag(X30)), /** XQuery function. */ _MATH_COS(FNMath.class, "cos(number)", arg(DBL_ZO), DBL_ZO, flag(X30)), /** XQuery function. */ _MATH_TAN(FNMath.class, "tan(number)", arg(DBL_ZO), DBL_ZO, flag(X30)), /** XQuery function. */ _MATH_ASIN(FNMath.class, "asin(number)", arg(DBL_ZO), DBL_ZO, flag(X30)), /** XQuery function. */ _MATH_ACOS(FNMath.class, "acos(number)", arg(DBL_ZO), DBL_ZO, flag(X30)), /** XQuery function. */ _MATH_ATAN(FNMath.class, "atan(number)", arg(DBL_ZO), DBL_ZO, flag(X30)), /** XQuery function. */ _MATH_ATAN2(FNMath.class, "atan2(number,number)", arg(DBL, DBL), DBL, flag(X30)), /** XQuery function. */ _MATH_POW(FNMath.class, "pow(number,number)", arg(DBL_ZO, ITR), DBL_ZO, flag(X30)), /** XQuery function. */ _MATH_EXP(FNMath.class, "exp(number)", arg(DBL_ZO), DBL_ZO, flag(X30)), /** XQuery function. */ _MATH_EXP10(FNMath.class, "exp10(number)", arg(DBL_ZO), DBL_ZO, flag(X30)), /** XQuery function. */ _MATH_LOG(FNMath.class, "log(number)", arg(DBL_ZO), DBL_ZO, flag(X30)), /** XQuery function. */ _MATH_LOG10(FNMath.class, "log10(number)", arg(DBL_ZO), DBL_ZO, flag(X30)), /** XQuery function. */ _MATH_E(FNMath.class, "e()", arg(), DBL), /** XQuery function. */ _MATH_SINH(FNMath.class, "sinh(number)", arg(DBL_ZO), DBL_ZO), /** XQuery function. */ _MATH_COSH(FNMath.class, "cosh(number)", arg(DBL_ZO), DBL_ZO), /** XQuery function. */ _MATH_TANH(FNMath.class, "tanh(number)", arg(DBL_ZO), DBL_ZO), /** XQuery function. */ _MATH_CRC32(FNMath.class, "crc32(string)", arg(STR), HEX), /* FNAdmin functions. */ /** XQuery function. */ _ADMIN_USERS(FNAdmin.class, "users([database])", arg(STR), ELM_ZM), /** XQuery function. */ _ADMIN_SESSIONS(FNAdmin.class, "sessions()", arg(), ELM_ZM), /** XQuery function. */ _ADMIN_LOGS(FNAdmin.class, "logs([date])", arg(STR), ELM_ZM), /* FNArchive functions. */ /** XQuery function. */ _ARCHIVE_CREATE(FNArchive.class, "create(entries,contents[,options])", arg(ITEM_ZM, ITEM_ZM, ITEM), B64), /** XQuery function. */ _ARCHIVE_ENTRIES(FNArchive.class, "entries(archive)", arg(B64), ELM_ZM), /** XQuery function. */ _ARCHIVE_EXTRACT_TEXT(FNArchive.class, "extract-text(archive[,entries[,encoding]])", arg(B64, ITEM_ZM, STR), STR_ZM), /** XQuery function. */ _ARCHIVE_EXTRACT_BINARY(FNArchive.class, "extract-binary(archive[,entries])", arg(B64, ITEM_ZM), B64_ZM), /** XQuery function. */ _ARCHIVE_UPDATE(FNArchive.class, "update(archive,entries,contents)", arg(B64, ITEM_ZM, ITEM_ZM), B64), /** XQuery function. */ _ARCHIVE_DELETE(FNArchive.class, "delete(archive,entries)", arg(B64, ITEM_ZM), B64), /** XQuery function. */ _ARCHIVE_OPTIONS(FNArchive.class, "options(archive)", arg(B64), ELM), /** XQuery function. */ _ARCHIVE_WRITE(FNArchive.class, "write(path,archive[,entries])", arg(STR, B64, ITEM_ZM), EMP), /* FNClient functions. */ /** XQuery function. */ _CLIENT_CONNECT(FNClient.class, "connect(url,port,user,password)", arg(STR, ITR, STR, STR), URI, flag(NDT)), /** XQuery function. */ _CLIENT_EXECUTE(FNClient.class, "execute(id,command)", arg(URI, STR), STR, flag(NDT)), /** XQuery function. */ _CLIENT_INFO(FNClient.class, "info(id)", arg(URI), STR, flag(NDT)), /** XQuery function. */ _CLIENT_QUERY(FNClient.class, "query(id,query[,bindings])", arg(URI, STR, ITEM), ITEM_ZO, flag(NDT)), /** XQuery function. */ _CLIENT_CLOSE(FNClient.class, "close(id)", arg(URI), EMP, flag(NDT)), /* FNConvert functions. */ /** XQuery function. */ _CONVERT_INTEGER_TO_BASE(FNConvert.class, "integer-to-base(number,base)", arg(ITR, ITR), STR), /** XQuery function. */ _CONVERT_INTEGER_FROM_BASE(FNConvert.class, "integer-from-base(string,base)", arg(STR, ITR), ITR), /** XQuery function. */ _CONVERT_BINARY_TO_BYTES(FNConvert.class, "binary-to-bytes(binary)", arg(ITEM), BYT_ZM), /** XQuery function. */ _CONVERT_BINARY_TO_STRING(FNConvert.class, "binary-to-string(binary[,encoding])", arg(ITEM, STR), STR), /** XQuery function. */ _CONVERT_BYTES_TO_HEX(FNConvert.class, "bytes-to-hex(bytes)", arg(BYT_ZM), HEX), /** XQuery function. */ _CONVERT_BYTES_TO_BASE64(FNConvert.class, "bytes-to-base64(bytes)", arg(BYT_ZM), B64), /** XQuery function. */ _CONVERT_STRING_TO_BASE64(FNConvert.class, "string-to-base64(string[,encoding])", arg(STR, STR), B64), /** XQuery function. */ _CONVERT_STRING_TO_HEX(FNConvert.class, "string-to-hex(string[,encoding])", arg(STR, STR), HEX), /** XQuery function. */ _CONVERT_INTEGER_TO_DATETIME(FNConvert.class, "integer-to-dateTime(ms)", arg(ITR), DTM), /** XQuery function. */ _CONVERT_DATETIME_TO_INTEGER(FNConvert.class, "dateTime-to-integer(date)", arg(DTM), ITR), /** XQuery function. */ _CONVERT_INTEGER_TO_DAYTIME(FNConvert.class, "integer-to-dayTime(ms)", arg(ITR), DTD), /** XQuery function. */ _CONVERT_DAYTIME_TO_INTEGER(FNConvert.class, "dayTime-to-integer(duration)", arg(DTD), ITR), /* FNCrypto functions (EXPath Cryptographic module). */ /** XQuery function. */ _CRYPTO_HMAC(FNCrypto.class, "hmac(string,string,string[,string])", arg(STR, STR, STR, STR_ZO), STR), /** XQuery function. */ _CRYPTO_ENCRYPT(FNCrypto.class, "encrypt(string,string,string,string)", arg(STR, STR, STR, STR), STR), /** XQuery function. */ _CRYPTO_DECRYPT(FNCrypto.class, "decrypt(string,string,string,string)", arg(STR, STR, STR, STR), STR), /** XQuery function. */ _CRYPTO_GENERATE_SIGNATURE(FNCrypto.class, "generate-signature" + "(node,string,string,string,string,string[,item][,item])", arg(NOD, STR, STR, STR, STR, STR, ITEM_ZO, ITEM_ZO), NOD), /** XQuery function. */ _CRYPTO_VALIDATE_SIGNATURE(FNCrypto.class, "validate-signature(node)", arg(NOD), BLN), /* FNCsv functions. */ /** XQuery function. */ _CSV_PARSE(FNCsv.class, "parse(string[,config])", arg(STR, MAP_O), ITEM_ZO), /** XQuery function. */ _CSV_SERIALIZE(FNCsv.class, "serialize(node[,params])", arg(NOD, ITEM_ZO), STR), /* FNDb functions. */ /** XQuery function. */ _DB_OPEN(FNDb.class, "open(database[,path])", arg(STR, STR), NOD_ZM), /** XQuery function. */ _DB_OPEN_PRE(FNDb.class, "open-pre(database,pre)", arg(STR, ITR), NOD_ZM), /** XQuery function. */ _DB_OPEN_ID(FNDb.class, "open-id(database,id)", arg(STR, ITR), NOD_ZM), /** XQuery function. */ _DB_TEXT(FNDb.class, "text(database,string)", arg(STR, ITEM), NOD_ZM, flag(NDT)), /** XQuery function. */ _DB_TEXT_RANGE(FNDb.class, "text-range(database,from,to)", arg(STR, ITEM, ITEM), NOD_ZM, flag(NDT)), /** XQuery function. */ _DB_ATTRIBUTE(FNDb.class, "attribute(database,string[,name])", arg(STR, ITEM, STR), NOD_ZM, flag(NDT)), /** XQuery function. */ _DB_ATTRIBUTE_RANGE(FNDb.class, "attribute-range(database,from,to[,name])", arg(STR, ITEM, ITEM, STR), NOD_ZM, flag(NDT)), /** XQuery function. */ _DB_FULLTEXT(FNDb.class, "fulltext(database,string)", arg(STR, STR), NOD_ZM, flag(NDT)), /** XQuery function. */ _DB_LIST(FNDb.class, "list([database[,path]])", arg(STR, STR), STR_ZM), /** XQuery function. */ _DB_LIST_DETAILS(FNDb.class, "list-details([database[,path]])", arg(STR, STR), ELM_ZM), /** XQuery function. */ _DB_BACKUPS(FNDb.class, "backups([database])", arg(ITEM), ELM_ZM), /** XQuery function. */ _DB_SYSTEM(FNDb.class, "system()", arg(), STR), /** XQuery function. */ _DB_INFO(FNDb.class, "info(database)", arg(ITEM), STR), /** XQuery function. */ _DB_NODE_ID(FNDb.class, "node-id(nodes)", arg(NOD_ZM), ITR_ZM), /** XQuery function. */ _DB_NODE_PRE(FNDb.class, "node-pre(nodes)", arg(NOD_ZM), ITR_ZM), /** XQuery function. */ _DB_EVENT(FNDb.class, "event(name,query)", arg(STR, ITEM_ZM), EMP, flag(NDT)), /** XQuery function. */ _DB_OUTPUT(FNDb.class, "output(result)", arg(ITEM_ZM), EMP, flag(UPD, NDT)), /** XQuery function. */ _DB_ADD(FNDb.class, "add(database,input[,path])", arg(STR, NOD, STR), EMP, flag(UPD, NDT)), /** XQuery function. */ _DB_DELETE(FNDb.class, "delete(database,path)", arg(STR, STR), EMP, flag(UPD, NDT)), /** XQuery function. */ _DB_CREATE(FNDb.class, "create(name[,inputs[,paths[,options]]])", arg(STR, ITEM_ZM, STR_ZM, ITEM), EMP, flag(UPD, NDT)), /** XQuery function. */ _DB_DROP(FNDb.class, "drop(database)", arg(ITEM), EMP, flag(UPD, NDT)), /** XQuery function. */ _DB_RENAME(FNDb.class, "rename(database,path,newpath)", arg(STR, STR, STR), EMP, flag(UPD, NDT)), /** XQuery function. */ _DB_REPLACE(FNDb.class, "replace(database,path,item)", arg(STR, STR, ITEM), EMP, flag(UPD, NDT)), /** XQuery function. */ _DB_OPTIMIZE(FNDb.class, "optimize(database[,all[,options]])", arg(STR, BLN, ITEM), EMP, flag(UPD, NDT)), /** XQuery function. */ _DB_RETRIEVE(FNDb.class, "retrieve(database,path)", arg(STR, STR), B64), /** XQuery function. */ _DB_STORE(FNDb.class, "store(database,path,input)", arg(STR, STR, ITEM), EMP, flag(UPD, NDT)), /** XQuery function. */ _DB_IS_XML(FNDb.class, "is-xml(database,path)", arg(STR, STR), BLN), /** XQuery function. */ _DB_IS_RAW(FNDb.class, "is-raw(database,path)", arg(STR, STR), BLN), /** XQuery function. */ _DB_EXISTS(FNDb.class, "exists(database[,path])", arg(STR, STR), BLN), /** XQuery function. */ _DB_CONTENT_TYPE(FNDb.class, "content-type(database,path)", arg(STR, STR), STR), /** XQuery function. */ _DB_FLUSH(FNDb.class, "flush(database)", arg(ITEM), EMP, flag(UPD, NDT)), /** XQuery function. */ _DB_EXPORT(FNDb.class, "export(database,path[,param]])", arg(STR, STR, ITEM), EMP), /** XQuery function. */ _DB_NAME(FNDb.class, "name(node)", arg(NOD), STR), /** XQuery function. */ _DB_PATH(FNDb.class, "path(node)", arg(NOD), STR), /* FNFetch functions. */ /** XQuery function. */ _FETCH_TEXT(FNFetch.class, "text(uri[,encoding)", arg(STR, STR), STR, flag(NDT)), /** XQuery function. */ _FETCH_BINARY(FNFetch.class, "binary(uri)", arg(STR), B64, flag(NDT)), /** XQuery function. */ _FETCH_CONTENT_TYPE(FNFetch.class, "content-type(uri)", arg(STR), STR, flag(NDT)), /* FNFile functions (EXPath). */ /** XQuery function. */ _FILE_PATH_SEPARATOR(FNFile.class, "path-separator()", arg(), STR), /** XQuery function. */ _FILE_DIR_SEPARATOR(FNFile.class, "dir-separator()", arg(), STR), /** XQuery function. */ _FILE_LINE_SEPARATOR(FNFile.class, "line-separator()", arg(), STR), /** XQuery function. */ _FILE_TEMP_DIR(FNFile.class, "temp-dir()", arg(), STR), /** XQuery function. */ _FILE_BASE_NAME(FNFile.class, "base-name(path[,suffix])", arg(STR, STR), STR), /** XQuery function. */ _FILE_DIR_NAME(FNFile.class, "dir-name(path)", arg(STR), STR), /** XQuery function. */ _FILE_PATH_TO_URI(FNFile.class, "path-to-uri(path)", arg(STR), URI), /** XQuery function. */ _FILE_EXISTS(FNFile.class, "exists(path)", arg(STR), BLN, flag(NDT)), /** XQuery function. */ _FILE_IS_DIR(FNFile.class, "is-dir(path)", arg(STR), BLN, flag(NDT)), /** XQuery function. */ _FILE_IS_FILE(FNFile.class, "is-file(path)", arg(STR), BLN, flag(NDT)), /** XQuery function. */ _FILE_LAST_MODIFIED(FNFile.class, "last-modified(path)", arg(STR), DTM, flag(NDT)), /** XQuery function. */ _FILE_SIZE(FNFile.class, "size(path)", arg(STR), ITR, flag(NDT)), /** XQuery function. */ _FILE_PATH_TO_NATIVE(FNFile.class, "path-to-native(path)", arg(STR), STR, flag(NDT)), /** XQuery function. */ _FILE_RESOLVE_PATH(FNFile.class, "resolve-path(path)", arg(STR), STR, flag(NDT)), /** XQuery function. */ _FILE_LIST(FNFile.class, "list(path[,recursive[,pattern]])", arg(STR, BLN, STR), STR_ZM, flag(NDT)), /** XQuery function. */ _FILE_CREATE_DIR(FNFile.class, "create-dir(path)", arg(STR), EMP, flag(NDT)), /** XQuery function. */ _FILE_CREATE_TEMP_DIR(FNFile.class, "create-temp-dir(prefix,suffix[,dir])", arg(STR, STR, STR), STR, flag(NDT)), /** XQuery function. */ _FILE_CREATE_TEMP_FILE(FNFile.class, "create-temp-file(prefix,suffix[,dir])", arg(STR, STR, STR), STR, flag(NDT)), /** XQuery function. */ _FILE_DELETE(FNFile.class, "delete(path[,recursive])", arg(STR, BLN), EMP, flag(NDT)), /** XQuery function. */ _FILE_READ_TEXT(FNFile.class, "read-text(path[,encoding])", arg(STR, STR), STR, flag(NDT)), /** XQuery function. */ _FILE_READ_TEXT_LINES(FNFile.class, "read-text-lines(path[,encoding])", arg(STR, STR), STR_ZM, flag(NDT)), /** XQuery function. */ _FILE_READ_BINARY(FNFile.class, "read-binary(path)", arg(STR), B64, flag(NDT)), /** XQuery function. */ _FILE_WRITE(FNFile.class, "write(path,data[,params])", arg(STR, ITEM_ZM, ITEM), EMP, flag(NDT)), /** XQuery function. */ _FILE_WRITE_BINARY(FNFile.class, "write-binary(path,item)", arg(STR, BIN), EMP, flag(NDT)), /** XQuery function. */ _FILE_WRITE_TEXT(FNFile.class, "write-text(path,text[,encoding])", arg(STR, STR, STR), EMP, flag(NDT)), /** XQuery function. */ _FILE_WRITE_TEXT_LINES(FNFile.class, "write-text-lines(path,texts[,encoding])", arg(STR, STR_ZM, STR), EMP, flag(NDT)), /** XQuery function. */ _FILE_APPEND(FNFile.class, "append(path,data[,params])", arg(STR, ITEM_ZM, ITEM), EMP, flag(NDT)), /** XQuery function. */ _FILE_APPEND_BINARY(FNFile.class, "append-binary(path,item)", arg(STR, BIN), EMP, flag(NDT)), /** XQuery function. */ _FILE_APPEND_TEXT(FNFile.class, "append-text(path,text[,encoding])", arg(STR, STR, STR), EMP, flag(NDT)), /** XQuery function. */ _FILE_APPEND_TEXT_LINES(FNFile.class, "append-text-lines(path,texts[,encoding])", arg(STR, STR_ZM, STR), EMP, flag(NDT)), /** XQuery function. */ _FILE_COPY(FNFile.class, "copy(source,target)", arg(STR, STR), EMP, flag(NDT)), /** XQuery function. */ _FILE_MOVE(FNFile.class, "move(source,target)", arg(STR, STR), EMP, flag(NDT)), /* FNFt functions. */ /** XQuery function. */ _FT_SEARCH(FNFt.class, "search(database,terms[,options])", arg(STR, ITEM_ZM, ITEM), NOD_ZM, flag(NDT)), /** XQuery function. */ _FT_COUNT(FNFt.class, "count(nodes)", arg(NOD_ZM), ITR), /** XQuery function. */ _FT_MARK(FNFt.class, "mark(nodes[,tag])", arg(NOD_ZM, STR), NOD_ZM), /** XQuery function. */ _FT_EXTRACT(FNFt.class, "extract(nodes[,tag[,length]])", arg(ITEM_ZM, STR, ITR), NOD_ZM), /** XQuery function. */ _FT_SCORE(FNFt.class, "score(items)", arg(ITEM_ZM), DBL_ZM), /** XQuery function. */ _FT_TOKENS(FNFt.class, "tokens(database[,prefix])", arg(STR, STR), ITEM_ZM, flag(NDT)), /** XQuery function. */ _FT_TOKENIZE(FNFt.class, "tokenize(string)", arg(STR), STR_ZM), /* FNHash functions. */ /** XQuery function. */ _HASH_MD5(FNHash.class, "md5(value)", arg(AAT), B64), /** XQuery function. */ _HASH_SHA1(FNHash.class, "sha1(value)", arg(AAT), B64), /** XQuery function. */ _HASH_SHA256(FNHash.class, "sha256(value)", arg(AAT), B64), /** XQuery function. */ _HASH_HASH(FNHash.class, "hash(value,algorithm)", arg(AAT, STR), B64), /* FNHof functions. */ /** XQuery function. */ _HOF_SORT_WITH(FNHof.class, "sort-with(seq,lt-fun)", arg(ITEM_ZM, FuncType.get(BLN, ITEM, ITEM).seqType()), ITEM_ZM), /** XQuery function. */ _HOF_ID(FNHof.class, "id(value)", arg(ITEM_ZM), ITEM_ZM), /** XQuery function. */ _HOF_CONST(FNHof.class, "const(return,ignore)", arg(ITEM_ZM, ITEM_ZM), ITEM_ZM), /** XQuery function. */ _HOF_UNTIL(FNHof.class, "until(pred,function,start)", arg(FuncType.get(BLN, ITEM_ZM).seqType(), FuncType.get(ITEM_ZM, ITEM_ZM).seqType(), ITEM_ZM), ITEM_ZM), /** XQuery function. */ _HOF_FOLD_LEFT1(FNHof.class, "fold-left1(non-empty-seq,function)", arg(ITEM_OM, FuncType.get(ITEM_ZM, ITEM_ZM, ITEM).seqType()), ITEM_ZM), /** XQuery function. */ _HOF_TOP_K_BY(FNHof.class, "top-k-by(seq,key-fun,k)", arg(ITEM_ZM, FuncType.arity(1).seqType(), ITR), ITEM_ZM), /** XQuery function. */ _HOF_TOP_K_WITH(FNHof.class, "top-k-with(seq,less-than,k)", arg(ITEM_ZM, FuncType.get(BLN, ITEM_ZO, ITEM_ZO).seqType(), ITR), ITEM_ZM), /* FNHtml functions. */ /** XQuery function. */ _HTML_PARSER(FNHtml.class, "parser()", arg(), STR), /** XQuery function. */ _HTML_PARSE(FNHtml.class, "parse(input[,options)", arg(STR, ITEM), DOC_O), /* FNHttp functions (EXPath). */ /** XQuery function. */ _HTTP_SEND_REQUEST(FNHttp.class, "send-request(request[,href,[bodies]])", arg(NOD, STR_ZO, ITEM_ZM), ITEM_ZM, flag(NDT)), /* FNIndex functions. */ /** XQuery function. */ _INDEX_FACETS(FNIndex.class, "facets(database[,type])", arg(STR, STR), DOC_O), /** XQuery function. */ _INDEX_TEXTS(FNIndex.class, "texts(database[,prefix[,ascending]])", arg(STR, STR, BLN), NOD_ZM, flag(NDT)), /** XQuery function. */ _INDEX_ATTRIBUTES(FNIndex.class, "attributes(database[,prefix[,ascending]])", arg(STR, STR, BLN), NOD_ZM, flag(NDT)), /** XQuery function. */ _INDEX_ELEMENT_NAMES(FNIndex.class, "element-names(database)", arg(STR), NOD_ZM), /** XQuery function. */ _INDEX_ATTRIBUTE_NAMES(FNIndex.class, "attribute-names(database)", arg(STR), NOD_ZM), /* FNInspect functions. */ /** XQuery function. */ _INSPECT_FUNCTION(FNInspect.class, "function(function)", arg(STR), ELM), /** XQuery function. */ _INSPECT_MODULE(FNInspect.class, "module(path)", arg(STR), ELM), /** XQuery function. */ _INSPECT_CONTEXT(FNInspect.class, "context()", arg(), ELM), /** XQuery function. */ _INSPECT_FUNCTIONS(FNInspect.class, "functions()", arg(), FUN_ZM), /** XQuery function. */ _INSPECT_XQDOC(FNInspect.class, "xqdoc(path)", arg(STR), ELM), /* FNJson functions. */ /** XQuery function. */ _JSON_PARSE(FNJson.class, "parse(string[,config])", arg(STR, MAP_O), ITEM_ZO), /** XQuery function. */ _JSON_PARSE_ML(FNJson.class, "parse-ml(string)", arg(STR), NOD), /** XQuery function. */ _JSON_SERIALIZE(FNJson.class, "serialize(node[,params])", arg(NOD, ITEM_ZO), STR), /** XQuery function. */ _JSON_SERIALIZE_ML(FNJson.class, "serialize-ml(node)", arg(NOD), STR), /* FNOut functions. */ /** XQuery function. */ _OUT_NL(FNOut.class, "nl()", arg(), STR), /** XQuery function. */ _OUT_TAB(FNOut.class, "tab()", arg(), STR), /** XQuery function. */ _OUT_FORMAT(FNOut.class, "format(format,item1[,...])", arg(STR, ITEM), STR), /* FNProc functions. */ /** XQuery function. */ _PROC_SYSTEM(FNProc.class, "system(command[,args[,encoding]])", arg(STR, STR_ZM, STR), STR, flag(NDT)), /** XQuery function. */ _PROC_EXECUTE(FNProc.class, "execute(command[,args[,encoding]]])", arg(STR, STR_ZM, STR), ELM, flag(NDT)), /* FNProf functions. */ /** XQuery function. */ _PROF_MEM(FNProf.class, "mem(value[,cache[,label]])", arg(ITEM_ZM, BLN, STR), ITEM_ZM, flag(NDT)), /** XQuery function. */ _PROF_TIME(FNProf.class, "time(value[,cache[,label]])", arg(ITEM_ZM, BLN, STR), ITEM_ZM, flag(NDT)), /** XQuery function. */ _PROF_SLEEP(FNProf.class, "sleep(ms)", arg(ITR), EMP, flag(NDT)), /** XQuery function. */ _PROF_CURRENT_MS(FNProf.class, "current-ms()", arg(), ITR, flag(NDT)), /** XQuery function. */ _PROF_CURRENT_NS(FNProf.class, "current-ns()", arg(), ITR, flag(NDT)), /** XQuery function. */ _PROF_DUMP(FNProf.class, "dump(value[,label])", arg(ITEM_ZM, STR), EMP, flag(NDT)), /** XQuery function. */ _PROF_HUMAN(FNProf.class, "human(integer)", arg(ITR), STR, flag(NDT)), /** XQuery function. */ _PROF_VOID(FNProf.class, "void(value)", arg(ITEM_ZM), EMP, flag(NDT)), /* FNRandom functions. */ /** XQuery function. */ _RANDOM_DOUBLE(FNRandom.class, "double()", arg(), DBL, flag(NDT)), /** XQuery function. */ _RANDOM_INTEGER(FNRandom.class, "integer([max])", arg(ITR), ITR, flag(NDT)), /** XQuery function. */ _RANDOM_SEEDED_DOUBLE(FNRandom.class, "seeded-double(seed,num)", arg(ITR, ITR), ITEM_ZM, flag(NDT)), /** XQuery function. */ _RANDOM_SEEDED_INTEGER(FNRandom.class, "seeded-integer(seed,num[,max])", arg(ITR, ITR, ITR), ITEM_ZM, flag(NDT)), /** XQuery function. */ _RANDOM_GAUSSIAN(FNRandom.class, "gaussian(num)", arg(ITR), ITEM_ZM, flag(NDT)), /** XQuery function. */ _RANDOM_UUID(FNRandom.class, "uuid()", arg(), STR, flag(NDT)), /* FNRepo functions. */ /** XQuery function. */ _REPO_INSTALL(FNRepo.class, "install(uri)", arg(STR), EMP, flag(NDT)), /** XQuery function. */ _REPO_DELETE(FNRepo.class, "delete(uri)", arg(STR), EMP, flag(NDT)), /** XQuery function. */ _REPO_LIST(FNRepo.class, "list()", arg(), STR_ZM, flag(NDT)), /* FNSql functions. */ /** XQuery function. */ _SQL_INIT(FNSql.class, "init(class)", arg(STR), EMP, flag(NDT)), /** XQuery function. */ _SQL_CONNECT(FNSql.class, "connect(url[,user[,pass[,options]]]]])", arg(STR, STR, STR, NOD_ZO), ITR, flag(NDT)), /** XQuery function. */ _SQL_PREPARE(FNSql.class, "prepare(id,statement)", arg(ITR, STR), ITR, flag(NDT)), /** XQuery function. */ _SQL_EXECUTE(FNSql.class, "execute(id,query)", arg(ITR, STR), ELM_ZM, flag(NDT)), /** XQuery function. */ _SQL_EXECUTE_PREPARED(FNSql.class, "execute-prepared(id[,params])", arg(ITR, ELM), ELM_ZM, flag(NDT)), /** XQuery function. */ _SQL_CLOSE(FNSql.class, "close(id)", arg(ITR), EMP, flag(NDT)), /** XQuery function. */ _SQL_COMMIT(FNSql.class, "commit(id)", arg(ITR), EMP, flag(NDT)), /** XQuery function. */ _SQL_ROLLBACK(FNSql.class, "rollback(id)", arg(ITR), EMP, flag(NDT)), /* FNStream functions. */ /** XQuery function. */ _STREAM_MATERIALIZE(FNStream.class, "materialize(item)", arg(ITEM), ITEM), /** XQuery function. */ _STREAM_IS_STREAMABLE(FNStream.class, "is-streamable(item)", arg(ITEM), BLN), /* FNUnit functions. */ /** XQuery function. */ _UNIT_ASSERT(FNUnit.class, "assert(test[,message])", arg(ITEM_ZM, STR), EMP, flag(NDT)), /** XQuery function. */ _UNIT_FAIL(FNUnit.class, "fail(message)", arg(STR), EMP, flag(NDT)), /** XQuery function. */ _UNIT_TEST(FNUnit.class, "test([functions])", arg(FUN_ZM), ELM, flag(NDT)), /** XQuery function. */ _UNIT_TEST_URIS(FNUnit.class, "test-uris(uris)", arg(STR_ZM), ELM, flag(NDT)), /* FNValidate functions. */ /** XQuery function. */ _VALIDATE_XSD(FNValidate.class, "xsd(input[,schema])", arg(ITEM, ITEM), EMP, flag(NDT)), /** XQuery function. */ _VALIDATE_XSD_INFO(FNValidate.class, "xsd-info(input[,schema])", arg(ITEM, ITEM), STR_ZM, flag(NDT)), /** XQuery function. */ _VALIDATE_DTD(FNValidate.class, "dtd(input[,schema])", arg(ITEM, ITEM), EMP, flag(NDT)), /** XQuery function. */ _VALIDATE_DTD_INFO(FNValidate.class, "dtd-info(input[,schema])", arg(ITEM, ITEM), STR_ZM, flag(NDT)), /* FNXQuery functions. */ /** XQuery function. */ _XQUERY_EVAL(FNXQuery.class, "eval(string[,bindings])", arg(STR, ITEM), ITEM_ZM, flag(NDT)), /** XQuery function. */ _XQUERY_INVOKE(FNXQuery.class, "invoke(uri[,bindings])", arg(STR, ITEM), ITEM_ZM, flag(NDT)), /** XQuery function. */ _XQUERY_TYPE(FNXQuery.class, "type(value)", arg(ITEM_ZM), ITEM_ZM), /* FNXslt functions. */ /** XQuery function. */ _XSLT_PROCESSOR(FNXslt.class, "processor()", arg(), STR), /** XQuery function. */ _XSLT_VERSION(FNXslt.class, "version()", arg(), STR), /** XQuery function. */ _XSLT_TRANSFORM(FNXslt.class, "transform(input,stylesheet[,params])", arg(ITEM, ITEM, ITEM), NOD, flag(NDT)), /** XQuery function. */ _XSLT_TRANSFORM_TEXT(FNXslt.class, "transform-text(input,stylesheet[,params])", arg(ITEM, ITEM, ITEM), STR, flag(NDT)), /* FNZip functions (EXPath). */ /** XQuery function. */ _ZIP_BINARY_ENTRY(FNZip.class, "binary-entry(path,entry)", arg(STR, STR), B64, flag(NDT)), /** XQuery function. */ _ZIP_TEXT_ENTRY(FNZip.class, "text-entry(path,entry[,encoding])", arg(STR, STR, STR), STR, flag(NDT)), /** XQuery function. */ _ZIP_HTML_ENTRY(FNZip.class, "html-entry(path,entry)", arg(STR, STR), NOD, flag(NDT)), /** XQuery function. */ _ZIP_XML_ENTRY(FNZip.class, "xml-entry(path,entry)", arg(STR, STR), NOD, flag(NDT)), /** XQuery function. */ _ZIP_ENTRIES(FNZip.class, "entries(path)", arg(STR), ELM, flag(NDT)), /** XQuery function. */ _ZIP_ZIP_FILE(FNZip.class, "zip-file(zip)", arg(ELM), EMP, flag(NDT)), /** XQuery function. */ _ZIP_UPDATE_ENTRIES(FNZip.class, "update-entries(zip,output)", arg(ELM, STR), EMP, flag(NDT)); /** * Mapping between function classes and namespace URIs. * If no mapping exists, {@link QueryText#FNURI} will be assumed as default mapping. */ public static final HashMap, byte[]> URIS = new HashMap, byte[]>(); // initialization of class/uri mappings and statically known modules static { // W3 functions URIS.put(FNMap.class, MAPURI); URIS.put(FNMath.class, MATHURI); // EXPath functions URIS.put(FNCrypto.class, CRYPTOURI); URIS.put(FNFile.class, FILEURI); URIS.put(FNHttp.class, HTTPURI); URIS.put(FNZip.class, ZIPURI); URIS.put(FNRepo.class, REPOURI); // internal functions URIS.put(FNAdmin.class, ADMINURI); URIS.put(FNArchive.class, ARCHIVEURI); URIS.put(FNClient.class, CLIENTURI); URIS.put(FNConvert.class, CONVERTURI); URIS.put(FNCsv.class, CSVURI); URIS.put(FNDb.class, DBURI); URIS.put(FNFetch.class, FETCHURI); URIS.put(FNFt.class, FTURI); URIS.put(FNHash.class, HASHURI); URIS.put(FNHof.class, HOFURI); URIS.put(FNHtml.class, HTMLURI); URIS.put(FNIndex.class, INDEXURI); URIS.put(FNInspect.class, INSPECTURI); URIS.put(FNJson.class, JSONURI); URIS.put(FNOut.class, OUTURI); URIS.put(FNProc.class, PROCURI); URIS.put(FNProf.class, PROFURI); URIS.put(FNRandom.class, RANDOMURI); URIS.put(FNSql.class, SQLURI); URIS.put(FNStream.class, STREAMURI); URIS.put(FNUnit.class, UNITURI); URIS.put(FNValidate.class, VALIDATEURI); URIS.put(FNXslt.class, XSLTURI); URIS.put(FNXQuery.class, XQUERYURI); } /** Argument pattern. */ private static final Pattern ARG = Pattern.compile( "^([-\\w_:\\.]*\\(|<|\"|\\$| ).*", Pattern.DOTALL); /** Cached enums (faster). */ public static final Function[] VALUES = values(); /** Minimum number of arguments. */ public final int min; /** Maximum number of arguments. */ public final int max; /** Argument types. */ public final SeqType[] args; /** Descriptions. */ final String desc; /** Return type. */ final SeqType ret; /** Compiler flags. */ final EnumSet flags; /** Function classes. */ private final Class func; /** * Constructs a function signature; calls * {@link #Function(Class, String, SeqType[], SeqType, EnumSet)}. * @param clz reference to the class containing the function implementation * @param dsc descriptive function string * @param typ types of the function arguments * @param rtn return type */ Function(final Class clz, final String dsc, final SeqType[] typ, final SeqType rtn) { this(clz, dsc, typ, rtn, EnumSet.noneOf(Flag.class)); } /** * Constructs a function signature. * @param clz reference to the class containing the function implementation * @param dsc descriptive function string, containing the function name and its * arguments in parentheses. Optional arguments are represented in nested * square brackets; three dots indicate that the number of arguments of a * function is not limited * @param typ types of the function arguments * @param rtn return type * @param flg static function properties */ Function(final Class clz, final String dsc, final SeqType[] typ, final SeqType rtn, final EnumSet flg) { func = clz; desc = dsc; ret = rtn; args = typ; flags = flg; // count number of minimum and maximum arguments by analyzing the function string final int b = dsc.indexOf('['); if(b != -1) { int c = b + 1 < dsc.length() && dsc.charAt(b + 1) == ',' ? 1 : 0; for(int i = 0; i < b; i++) if(dsc.charAt(i) == ',') c++; min = c; max = dsc.contains("...") ? Integer.MAX_VALUE : typ.length; } else { min = typ.length; max = typ.length; } } /** * Creates a new instance of the function. * @param arg arguments * @return function */ public StandardFunc get(final Expr... arg) { return get(null, arg); } /** * Creates a new instance of the function. * @param ii input info * @param arg arguments * @return function */ public StandardFunc get(final InputInfo ii, final Expr... arg) { return (StandardFunc) Reflect.get(Reflect.find( func, InputInfo.class, Function.class, Expr[].class), ii, this, arg); } /** * Returns the namespace URI of this function. * @return function */ final byte[] uri() { final byte[] u = URIS.get(func); return u == null ? FNURI : u; } /** * Indicates if an expression has the specified compiler property. * @param flag flag to be found * @return result of check * @see Expr#has(Flag) */ public boolean has(final Flag flag) { return flags.contains(flag); } /** * Returns the function type of this function with the given arity. * @param arity number of arguments * @return function type */ final FuncType type(final int arity) { final Ann ann = new Ann(); if(has(Flag.UPD)) ann.add(Ann.Q_UPDATING, Empty.SEQ, null); final SeqType[] arg = new SeqType[arity]; if(arity != 0 && max == Integer.MAX_VALUE) { System.arraycopy(args, 0, arg, 0, args.length); final SeqType var = args[args.length - 1]; for(int i = args.length; i < arg.length; i++) arg[i] = var; } else { System.arraycopy(args, 0, arg, 0, arity); } return FuncType.get(ann, ret, arg); } /** * Returns an array representation of the specified sequence types. * @param arg arguments * @return array */ private static SeqType[] arg(final SeqType... arg) { return arg; } /** * Returns a set representation of the specified compiler flags. * @param flags flags * @return set */ private static EnumSet flag(final Flag... flags) { final EnumSet set = EnumSet.noneOf(Flag.class); for(final Flag f : flags) set.add(f); return set; } /** * Returns a string representation of the function with the specified * arguments. All objects are wrapped with quotes, * except for the following ones: *
    *
  • integers
  • *
  • booleans (which will be suffixed with parentheses)
  • *
  • strings starting with an optional NCName and opening parenthesis
  • *
  • strings starting with angle bracket, quote, dollar sign, or space
  • *
* @param arg arguments * @return string representation */ public final String args(final Object... arg) { final TokenBuilder tb = new TokenBuilder(); for(final Object a : arg) { if(!tb.isEmpty()) tb.add(','); final String s = a.toString(); if(ARG.matcher(s).matches() || a instanceof Integer) { tb.add(s); } else if(a instanceof Boolean) { tb.add(s + "()"); } else { tb.add('"' + s.replaceAll("\"", "\"\"") + '"'); } } return toString().replaceAll("\\(.*", "(") + tb + ')'; } @Override public final String toString() { return new TokenBuilder(NSGlobal.prefix(uri())).add(':').add(desc).toString(); } /* * Returns the names of all functions. Used to update MediaWiki syntax highlighter. * All function names are listed in reverse order to give precedence to longer names. * @param args ignored public static void main(final String... args) { final StringList sl = new StringList(); for(Function f : VALUES) { sl.add(f.toString().replaceAll("^fn:|\\(.*", "")); } for(final String s : sl.sort(false, false)) { Util.out(s + ' '); } Util.outln("fn:"); } */ } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/Functions.java000066400000000000000000000230441222453003200261150ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.expr.Expr.Flag; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.query.value.type.SeqType.Occ; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * This class provides access to statically available functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Functions extends TokenSet { /** Singleton instance. */ private static final Functions INSTANCE = new Functions(); /** Function classes. */ private Function[] funcs = new Function[Array.CAPACITY]; /** * Returns the singleton instance. * @return instance */ public static Functions get() { return INSTANCE; } /** * Constructor, registering statically available XQuery functions. */ private Functions() { for(final Function def : Function.VALUES) { final String dsc = def.desc; final byte[] ln = token(dsc.substring(0, dsc.indexOf(PAR1))); final int i = put(new QNm(ln, def.uri()).id()); if(funcs[i] != null) Util.notexpected("Function defined twice:" + def); funcs[i] = def; } } /** * Tries to resolve the specified function with xs namespace as a cast. * @param arity number of arguments * @param name function name * @param ii input info * @return cast type if found, {@code null} otherwise * @throws QueryException query exception */ private static Type getCast(final QNm name, final long arity, final InputInfo ii) throws QueryException { final byte[] ln = name.local(); Type type = ListType.find(name); if(type == null) type = AtomType.find(name, false); // no constructor function found, or abstract type specified if(type != null && type != AtomType.NOT && type != AtomType.AAT) { if(arity == 1) return type; (arity == 1 ? FUNCTYPESG : FUNCTYPEPL).thrw(ii, name.string(), arity, 1); } // include similar function name in error message final Levenshtein ls = new Levenshtein(); for(final AtomType t : AtomType.VALUES) { if(t.par == null) continue; final byte[] u = t.name.uri(); if(eq(u, XSURI) && t != AtomType.NOT && t != AtomType.AAT && ls.similar( lc(ln), lc(t.string()))) FUNCSIMILAR.thrw(ii, name.string(), t.string()); } // no similar name: constructor function found, or abstract type specified throw FUNCUNKNOWN.thrw(ii, name.string()); } /** * Tries to resolve the specified function as a built-in one. * @param name function name * @param arity number of arguments * @param ii input info * @return function spec if found, {@code null} otherwise * @throws QueryException query exception */ private Function getBuiltIn(final QNm name, final long arity, final InputInfo ii) throws QueryException { final int id = id(name.id()); if(id == 0) return null; final Function fl = funcs[id]; if(!eq(fl.uri(), name.uri())) return null; // check number of arguments if(arity < fl.min || arity > fl.max) (arity == 1 ? FUNCARGSG : FUNCARGPL).thrw(ii, fl, arity); return fl; } /** * Returns the specified function. * @param name function qname * @param args optional arguments * @param ii input info * @return function instance * @throws QueryException query exception */ public StandardFunc get(final QNm name, final Expr[] args, final InputInfo ii) throws QueryException { final Function fl = getBuiltIn(name, args.length, ii); return fl == null ? null : fl.get(ii, args); } /** * Gets a function literal for a known function. * @param name function name * @param arity number of arguments * @param ctx query context * @param ii input info * @return function literal if found, {@code null} otherwise * @throws QueryException query exception */ public static Expr getLiteral(final QNm name, final int arity, final QueryContext ctx, final InputInfo ii) throws QueryException { // parse data type constructors if(eq(name.uri(), XSURI)) { final Type type = getCast(name, arity, ii); final VarScope scp = new VarScope(); final Var[] args = { scp.uniqueVar(ctx, SeqType.AAT_ZO, true) }; final Expr e = new Cast(ii, new VarRef(ii, args[0]), type.seqType()); final FuncType tp = FuncType.get(e.type(), SeqType.AAT_ZO); return new FuncItem(name, args, e, tp, scp, ctx.sc, null); } // pre-defined functions final Function fn = get().getBuiltIn(name, arity, ii); if(fn != null) { final VarScope scp = new VarScope(); final FuncType ft = fn.type(arity); final QNm[] names = new QNm[arity]; for(int a = 0; a < arity; a++) names[a] = new QNm("value" + (a + 1)); final Var[] args = new Var[arity]; final Expr[] calls = ft.args(args, ctx, scp, ii); final StandardFunc f = fn.get(calls); if(!f.has(Flag.CTX) && !f.has(Flag.FCS)) return new FuncItem(name, args, f, ft, scp, ctx.sc, null); return new FuncLit(name, args, f, ft, scp, ctx.sc, ii); } // user-defined function final StaticFunc sf = ctx.funcs.get(name, arity, ii); if(sf != null) return getUser(sf, ctx, ii); // Java function (only allowed with administrator permissions) final VarScope scp = new VarScope(); final FuncType jt = FuncType.arity(arity); final Var[] vs = new Var[arity]; final Expr[] refs = jt.args(vs, ctx, scp, ii); final Expr jm = JavaMapping.get(name, refs, ctx, ii); if(jm != null) return new FuncLit(name, vs, jm, jt, scp, ctx.sc, ii); return null; } /** * Returns a function item for a user-defined function. * @param sf static function * @param ctx query context * @param info input info * @return resulting value * @throws QueryException query exception */ public static FuncItem getUser(final StaticFunc sf, final QueryContext ctx, final InputInfo info) throws QueryException { final FuncType ft = sf.funcType(); final VarScope scp = new VarScope(); final int arity = sf.args.length; final QNm[] names = new QNm[arity]; for(int a = 0; a < arity; a++) names[a] = sf.args[a].name; final Var[] args = new Var[arity]; final Expr[] calls = ft.args(args, ctx, scp, info); final TypedFunc tf = ctx.funcs.getFuncRef(sf.name, calls, ctx.sc, info); return new FuncItem(sf.name, args, tf.fun, ft, scp, ctx.sc, sf); } /** * Returns an instance of a with the specified name and number of arguments, * or {@code null}. * @param name name of the function * @param args optional arguments * @param dyn compile-/run-time flag * @param ctx query context * @param ii input info * @return function instance * @throws QueryException query exception */ public static TypedFunc get(final QNm name, final Expr[] args, final boolean dyn, final QueryContext ctx, final InputInfo ii) throws QueryException { // get namespace and local name // parse data type constructors if(eq(name.uri(), XSURI)) { final Type type = getCast(name, args.length, ii); final SeqType to = SeqType.get(type, Occ.ZERO_ONE); return TypedFunc.constr(new Cast(ii, args[0], to), to); } // pre-defined functions final StandardFunc fun = Functions.get().get(name, args, ii); if(fun != null) { if(!ctx.sc.xquery3() && fun.has(Flag.X30)) FUNC30.thrw(ii); if(fun.sig.has(Flag.UPD)) ctx.updating(true); // [LW] correct annotations return new TypedFunc(fun, new Ann(), fun.sig.type(args.length)); } // user-defined function final TypedFunc tf = ctx.funcs.getRef(name, args, ctx.sc, ii); if(tf != null) return tf; // Java function (only allowed with administrator permissions) final JavaMapping jf = JavaMapping.get(name, args, ctx, ii); if(jf != null) return TypedFunc.java(jf); // add user-defined function that has not been declared yet if(!dyn && FuncType.find(name) == null) { return ctx.funcs.getFuncRef(name, args, ctx.sc, ii); } // no function found return null; } /** * Throws an error if the name of a pre-defined functions is similar to the * specified function name. * @param name function name * @param ii input info * @throws QueryException query exception */ void errorIfSimilar(final QNm name, final InputInfo ii) throws QueryException { // compare specified name with names of predefined functions final byte[] ln = name.local(); final Levenshtein ls = new Levenshtein(); for(int k = 1; k < size; ++k) { final int i = indexOf(keys[k], '}'); final byte[] u = substring(keys[k], 2, i); final byte[] l = substring(keys[k], i + 1); if(eq(ln, l)) { final byte[] ur = name.uri(); FUNCSIMILAR.thrw(ii, new TokenBuilder(NSGlobal.prefix(ur)).add(':').add(l), new TokenBuilder(NSGlobal.prefix(u)).add(':').add(l)); } else if(ls.similar(ln, l)) { FUNCSIMILAR.thrw(ii, name.string(), l); } } } @Override protected void rehash(final int s) { super.rehash(s); funcs = Array.copy(funcs, new Function[s]); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/InlineFunc.java000066400000000000000000000224041222453003200261760ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import java.util.*; import java.util.Map.Entry; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Inline function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class InlineFunc extends Single implements Scope { /** Function name. */ private final QNm name; /** Arguments. */ private final Var[] args; /** Return type. */ private final SeqType ret; /** Annotations. */ private final Ann ann; /** Updating flag. */ private final boolean updating; /** Map with requested function properties. */ private final EnumMap map = new EnumMap(Flag.class); /** Static context. */ private final StaticContext sc; /** Compilation flag. */ private boolean compiled; /** Local variables in the scope of this function. */ private final VarScope scope; /** * Constructor. * @param ii input info * @param r return type * @param v arguments * @param e function body * @param a annotations * @param stc static context * @param scp scope */ public InlineFunc(final InputInfo ii, final SeqType r, final Var[] v, final Expr e, final Ann a, final StaticContext stc, final VarScope scp) { this(ii, null, r, v, e, a, stc, scp); } /** * Package-private constructor allowing a name. * @param ii input info * @param nm name of the function * @param r return type * @param v argument variables * @param e function expression * @param a annotations * @param stc static context * @param scp variable scope */ InlineFunc(final InputInfo ii, final QNm nm, final SeqType r, final Var[] v, final Expr e, final Ann a, final StaticContext stc, final VarScope scp) { super(ii, e); name = nm; args = v; ret = r; ann = a == null ? new Ann() : a; updating = ann.contains(Ann.Q_UPDATING); scope = scp; sc = stc; } @Override public void compile(final QueryContext ctx) throws QueryException { compile(ctx, null); } /** * Removes and returns all static bindings from this function's closure. * @return static variable bindings */ private Collection> staticBindings() { Collection> propagate = null; final Iterator> cls = scope.closure().entrySet().iterator(); while(cls.hasNext()) { final Entry e = cls.next(); final Expr c = e.getValue(); if(c.isValue()) { if(propagate == null) propagate = new ArrayList>(); propagate.add(e); cls.remove(); } } return propagate == null ? Collections.>emptyList() : propagate; } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { if(compiled) return this; compiled = true; // compile closure for(final Entry e : scope.closure().entrySet()) e.setValue(e.getValue().compile(ctx, scp)); final StaticContext cs = ctx.sc; ctx.sc = sc; final int fp = scope.enter(ctx); try { // constant propagation for(final Entry e : staticBindings()) ctx.set(e.getKey(), e.getValue().value(ctx), info); expr = expr.compile(ctx, scope); } catch(final QueryException qe) { expr = FNInfo.error(qe); } finally { scope.cleanUp(this); scope.exit(ctx, fp); ctx.sc = cs; } // convert all function calls in tail position to proper tail calls ctx.compInfo(OPTTCE, this); expr.markTailCalls(); return optimize(ctx, scp); } @Override public Expr optimize(final QueryContext ctx, final VarScope scp) throws QueryException { type = FuncType.get(ann, args, ret).seqType(); size = 1; // only evaluate if the closure is empty, so we don't lose variables return scope.closure().isEmpty() ? preEval(ctx) : this; } @Override public VarUsage count(final Var v) { VarUsage all = VarUsage.NEVER; for(final Entry e : scope.closure().entrySet()) if((all = all.plus(e.getValue().count(v))) == VarUsage.MORE_THAN_ONCE) break; return all; } @Override public Expr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { boolean change = false, val = false; for(final Entry entry : scope.closure().entrySet()) { final Expr ex = entry.getValue().inline(ctx, scp, v, e); if(ex != null) { change = true; val |= ex.isValue(); entry.setValue(ex); } } final StaticContext cs = ctx.sc; ctx.sc = sc; if(val) { final int fp = scope.enter(ctx); try { for(final Entry entry : staticBindings()) { final Expr inl = expr.inline(ctx, scope, entry.getKey(), entry.getValue()); if(inl != null) expr = inl; } } catch(final QueryException qe) { expr = FNInfo.error(qe); } finally { scope.cleanUp(this); scope.exit(ctx, fp); ctx.sc = cs; } } return change ? optimize(ctx, scp) : null; } @Override public Expr copy(final QueryContext cx, final VarScope scp, final IntObjMap vs) { final VarScope v = scope.copy(cx, scp, vs); final Var[] a = args.clone(); for(int i = 0; i < a.length; i++) a[i] = vs.get(a[i].id); return copyType(new InlineFunc(info, name, ret, a, expr.copy(cx, v, vs), ann, sc, v)); } @Override public FuncItem item(final QueryContext ctx, final InputInfo ii) throws QueryException { final FuncType ft = FuncType.get(ann, args, ret); final boolean c = ft.type != null && !expr.type().instanceOf(ft.type); // collect closure final Map clos = new HashMap(); for(final Entry e : scope.closure().entrySet()) clos.put(e.getKey(), e.getValue().value(ctx)); return new FuncItem(args, expr, ft, clos, c, scope, ctx.sc); } @Override public Value value(final QueryContext ctx) throws QueryException { return item(ctx, info); } @Override public ValueIter iter(final QueryContext ctx) throws QueryException { return value(ctx).iter(); } @Override public boolean has(final Flag flag) { // handle recursive calls: set dummy value, eventually replace it with final value Boolean b = map.get(flag); if(b == null) { map.put(flag, false); b = expr == null || super.has(flag); map.put(flag, b); } return b; } @Override public boolean removable(final Var v) { // [LW] Variables are removable from the closure. return false; } @Override public void plan(final FElem plan) { final FElem el = planElem(); addPlan(plan, el, expr); for(int i = 0; i < args.length; ++i) { el.add(planAttr(ARG + i, args[i].name.string())); } } @Override public boolean visit(final ASTVisitor visitor) { final Map clos = scope.closure(); for(final Entry v : clos.entrySet()) if(!(v.getValue().accept(visitor) && visitor.declared(v.getKey()))) return false; for(final Var v : args) if(!visitor.declared(v)) return false; return expr.accept(visitor); } @Override public String toString() { final StringBuilder sb = new StringBuilder(FUNCTION).append(PAR1); for(int i = 0; i < args.length; i++) { if(i > 0) sb.append(", "); sb.append(args[i].toString()); } sb.append(PAR2).append(' '); if(ret != null) sb.append("as ").append(ret.toString()).append(' '); return sb.append("{ ").append(expr).append(" }").toString(); } @Override public void checkUp() throws QueryException { final boolean u = expr.has(Flag.UPD); if(u) expr.checkUp(); if(updating) { // updating function if(ret != null) UPFUNCTYPE.thrw(info); if(!u && !expr.isVacuous()) UPEXPECTF.thrw(info); } else if(u) { // uses updates, but is not declared as such UPNOT.thrw(info, description()); } } @Override public boolean isVacuous() { return !has(Flag.UPD) && ret != null && ret.eq(SeqType.EMP); } @Override public SeqType type() { return updating ? SeqType.EMP : super.type(); } @Override public boolean accept(final ASTVisitor visitor) { for(final Entry e : scope.closure().entrySet()) if(!e.getValue().accept(visitor)) return false; return visitor.inlineFunc(this); } @Override public int exprSize() { int sz = 1; for(final Entry e : scope.closure().entrySet()) sz += e.getValue().exprSize(); return sz + expr.exprSize(); } @Override public boolean compiled() { return compiled; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/JavaFunc.java000066400000000000000000000126661222453003200256520ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import java.lang.reflect.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.Type; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Java function binding. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class JavaFunc extends JavaMapping { /** Java class. */ private final Class cls; /** Java method. */ private final String mth; /** * Constructor. * @param ii input info * @param c Java class * @param m Java method/field * @param a arguments */ JavaFunc(final InputInfo ii, final Class c, final String m, final Expr[] a) { super(ii, a); cls = c; mth = m; } @Override protected Object eval(final Value[] args, final QueryContext ctx) throws QueryException { try { return mth.equals(NEW) ? constructor(args) : method(args, ctx); } catch(final InvocationTargetException ex) { final Throwable cause = ex.getCause(); throw cause instanceof QueryException ? ((QueryException) cause).info(info) : JAVAERR.thrw(info, cause); } catch(final QueryException ex) { throw ex; } catch(final Throwable ex) { Util.debug(ex); throw JAVAFUN.thrw(info, name(), foundArgs(args)); } } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new JavaFunc(info, cls, mth, copyAll(ctx, scp, vs, expr)); } /** * Calls a constructor. * @param ar arguments * @return resulting object * @throws Exception exception */ private Object constructor(final Value[] ar) throws Exception { for(final Constructor con : cls.getConstructors()) { final Object[] arg = args(con.getParameterTypes(), ar, true); if(arg != null) return con.newInstance(arg); } throw JAVACON.thrw(info, name(), foundArgs(ar)); } /** * Calls a method. * @param ar arguments * @param ctx query context * @return resulting object * @throws Exception exception */ private Object method(final Value[] ar, final QueryContext ctx) throws Exception { // check if a field with the specified name exists try { final Field f = cls.getField(mth); final boolean st = Modifier.isStatic(f.getModifiers()); if(ar.length == (st ? 0 : 1)) { return f.get(st ? null : instObj(ar[0])); } } catch(final NoSuchFieldException ex) { /* ignored */ } for(final Method meth : cls.getMethods()) { if(!meth.getName().equals(mth)) continue; final boolean st = Modifier.isStatic(meth.getModifiers()); final Object[] arg = args(meth.getParameterTypes(), ar, st); if(arg != null) { Object inst = null; if(!st) { inst = instObj(ar[0]); if(inst instanceof QueryModule) ((QueryModule) inst).context = ctx; } return meth.invoke(inst, arg); } } throw JAVAMTH.thrw(info, name(), foundArgs(ar)); } /** * Creates the instance on which a non-static field getter or method is * invoked. * @param v XQuery value * @return Java object * @throws QueryException query exception */ private Object instObj(final Value v) throws QueryException { return cls.isInstance(v) ? v : v.toJava(); } /** * Checks if the arguments conform with the specified parameters. * @param params parameters * @param args arguments * @param stat static flag * @return argument array or {@code null} * @throws QueryException query exception */ static Object[] args(final Class[] params, final Value[] args, final boolean stat) throws QueryException { final int s = stat ? 0 : 1; final int l = args.length - s; if(l != params.length) return null; // function arguments final Object[] val = new Object[l]; int a = 0; for(final Class par : params) { // check original type final Value arg = args[s + a]; if(par.isInstance(arg)) { val[a++] = arg; continue; } // check Java type if(arg instanceof Jav) { final Object jav = ((Jav) arg).toJava(); if(par.isInstance(jav)) { val[a++] = jav; continue; } } // check XQuery type final Type jtype = type(par); if(jtype == null || !arg.type.instanceOf(jtype) && !jtype.instanceOf(arg.type)) return null; val[a++] = arg.toJava(); } return val; } @Override public void plan(final FElem plan) { addPlan(plan, planElem(NAM, cls.getName() + "." + mth), expr); } @Override public String description() { final StringBuilder sb = new StringBuilder(); if(mth.equals(NEW)) sb.append(NEW).append(' ').append(cls.getSimpleName()); else sb.append(name()); return sb.append("(...)").toString(); } /** * Returns the function descriptor. * @return string */ private String name() { return cls.getSimpleName() + '.' + mth; } @Override public String toString() { return cls + "." + mth + PAR1 + toString(SEP) + PAR2; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/JavaMapping.java000066400000000000000000000266101222453003200263440ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.lang.reflect.*; import java.lang.reflect.Array; import java.math.*; import java.net.*; import javax.xml.datatype.*; import javax.xml.namespace.*; import org.basex.core.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.pkg.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.query.value.type.Type; import org.basex.util.*; import org.w3c.dom.*; import org.w3c.dom.Text; /** * This class contains common methods for executing Java code and mapping * Java objects to XQuery values. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class JavaMapping extends Arr { /** New keyword. */ static final String NEW = "new"; /** Input Java types. */ private static final Class[] JAVA = { String.class, boolean.class, Boolean.class, byte.class, Byte.class, short.class, Short.class, int.class, Integer.class, long.class, Long.class, float.class, Float.class, double.class, Double.class, BigDecimal.class, BigInteger.class, QName.class, char.class, Character.class, URI.class, URL.class }; /** Resulting XQuery types. */ private static final Type[] XQUERY = { AtomType.STR, AtomType.BLN, AtomType.BLN, AtomType.BYT, AtomType.BYT, AtomType.SHR, AtomType.SHR, AtomType.INT, AtomType.INT, AtomType.LNG, AtomType.LNG, AtomType.FLT, AtomType.FLT, AtomType.DBL, AtomType.DBL, AtomType.DEC, AtomType.ITR, AtomType.QNM, AtomType.STR, AtomType.STR, AtomType.URI, AtomType.URI }; /** * Constructor. * @param ii input info * @param a arguments */ JavaMapping(final InputInfo ii, final Expr[] a) { super(ii, a); } @Override public final Iter iter(final QueryContext ctx) throws QueryException { return value(ctx).iter(); } @Override public final Value value(final QueryContext ctx) throws QueryException { final int es = expr.length; final Value[] args = new Value[es]; for(int e = 0; e < es; ++e) args[e] = ctx.value(expr[e]); return toValue(eval(args, ctx), ctx); } /** * Returns the result of the evaluated Java function. * @param args arguments * @param ctx query context * @return arguments * @throws QueryException query exception */ protected abstract Object eval(final Value[] args, final QueryContext ctx) throws QueryException; /** * Converts the specified result to an XQuery value. * @param obj result object * @param ctx query context * @return value * @throws QueryException query exception */ public static Value toValue(final Object obj, final QueryContext ctx) throws QueryException { if(obj == null) return Empty.SEQ; if(obj instanceof Value) return (Value) obj; if(obj instanceof Iter) return ((Iter) obj).value(); // find XQuery mapping for specified type final Type type = type(obj); if(type != null) return type.cast(obj, ctx, null); // primitive arrays if(obj instanceof byte[]) return BytSeq.get((byte[]) obj); if(obj instanceof long[]) return IntSeq.get((long[]) obj, AtomType.ITR); if(obj instanceof char[]) return Str.get(new String((char[]) obj)); if(obj instanceof boolean[]) return BlnSeq.get((boolean[]) obj); if(obj instanceof double[]) return DblSeq.get((double[]) obj); if(obj instanceof float[]) return FltSeq.get((float[]) obj); // no array: return Java type if(!obj.getClass().isArray()) return new Jav(obj, ctx); final int s = Array.getLength(obj); // empty array if(s == 0) return Empty.SEQ; // string array if(obj instanceof String[]) { final String[] r = (String[]) obj; final byte[][] b = new byte[r.length][]; for(int v = 0; v < s; v++) b[v] = Token.token(r[v]); return StrSeq.get(b); } // character array if(obj instanceof char[][]) { final char[][] r = (char[][]) obj; final byte[][] b = new byte[r.length][]; for(int v = 0; v < s; v++) b[v] = Token.token(new String(r[v])); return StrSeq.get(b); } // short array if(obj instanceof short[]) { final short[] r = (short[]) obj; final long[] b = new long[r.length]; for(int v = 0; v < s; v++) b[v] = r[v]; return IntSeq.get(b, AtomType.SHR); } // integer array if(obj instanceof int[]) { final int[] r = (int[]) obj; final long[] b = new long[r.length]; for(int v = 0; v < s; v++) b[v] = r[v]; return IntSeq.get(b, AtomType.INT); } // any other array (also nested ones) final Object[] objs = (Object[]) obj; final ValueBuilder vb = new ValueBuilder(objs.length); for(final Object o : objs) vb.add(toValue(o, ctx)); return vb.value(); } /** * Gets the specified method from a query module. * @param mod query module object * @param path path of the module * @param name method name * @param arity number of arguments * @param ctx query context * @param ii input info * @return method if found, {@code null} otherwise * @throws QueryException query exception */ private static Method getModMethod(final Object mod, final String path, final String name, final long arity, final QueryContext ctx, final InputInfo ii) throws QueryException { // find method with identical name and arity Method meth = null; for(final Method m : mod.getClass().getMethods()) { if(m.getName().equals(name) && m.getParameterTypes().length == arity) { if(meth != null) throw JAVAAMBIG.thrw(ii, path + ':' + name); meth = m; } } if(meth == null) throw FUNCJAVA.thrw(ii, path + ':' + name); // check if user has sufficient permissions to call the function Perm perm = Perm.ADMIN; final QueryModule.Requires req = meth.getAnnotation(QueryModule.Requires.class); if(req != null) perm = Perm.get(req.value().name()); if(!ctx.context.user.has(perm)) return null; return meth; } /** * Converts a module URI to a path. * @param uri module URI * @return module path */ private static String toPath(final byte[] uri) { final String path = string(uri), p = ModuleLoader.uri2path(path); return p == null ? path : ModuleLoader.capitalize(p).replace("/", ".").substring(1); } /** * Converts the given name to camel case. * @param ln name to convert * @return resulting name */ private static String camelCase(final byte[] ln) { final TokenBuilder tb = new TokenBuilder(); boolean dash = false; for(int p = 0; p < ln.length; p += cl(ln, p)) { final int ch = cp(ln, p); if(dash) { tb.add(Character.toUpperCase(ch)); dash = false; } else { dash = ch == '-'; if(!dash) tb.add(ch); } } return tb.toString(); } /** * Returns a new Java function instance. * @param qname function name * @param args arguments * @param ctx query context * @param ii input info * @return Java function, or {@code null} * @throws QueryException query exception */ static JavaMapping get(final QNm qname, final Expr[] args, final QueryContext ctx, final InputInfo ii) throws QueryException { final byte[] uri = qname.uri(); // check if URI starts with "java:" prefix (if yes, module must be Java code) final boolean java = startsWith(uri, JAVAPREF); // rewrite function name: convert dashes to upper-case initials final String name = camelCase(qname.local()); // check imported Java modules final String path = toPath(java ? substring(uri, JAVAPREF.length) : uri); final Object jm = ctx.modules.findImport(path); if(jm != null) { final Method meth = getModMethod(jm, path, name, args.length, ctx, ii); if(meth != null) return new JavaModuleFunc(ii, jm, meth, args); } // only allowed with administrator permissions if(!ctx.context.user.has(Perm.ADMIN)) return null; // check addressed class try { final Class clz = ctx.modules.findClass(path); return new JavaFunc(ii, clz, name, args); } catch(final ClassNotFoundException ex) { // only throw exception if "java:" prefix was explicitly specified if(java) throw FUNCJAVA.thrw(ii, uri); } catch(final Throwable th) { throw JAVAINIT.thrw(ii, th); } // no function found return null; } /** * Returns an appropriate XQuery data type for the specified Java object. * @param o object * @return xquery type, or {@code null} if no appropriate type was found */ public static Type type(final Object o) { final Type t = type(o.getClass()); if(t != null) return t; if(o instanceof Element) return NodeType.ELM; if(o instanceof Document) return NodeType.DOC; if(o instanceof DocumentFragment) return NodeType.DOC; if(o instanceof Attr) return NodeType.ATT; if(o instanceof Comment) return NodeType.COM; if(o instanceof ProcessingInstruction) return NodeType.PI; if(o instanceof Text) return NodeType.TXT; if(o instanceof Duration) { final Duration d = (Duration) o; return !d.isSet(DatatypeConstants.YEARS) && !d.isSet(DatatypeConstants.MONTHS) ? AtomType.DTD : !d.isSet(DatatypeConstants.HOURS) && !d.isSet(DatatypeConstants.MINUTES) && !d.isSet(DatatypeConstants.SECONDS) ? AtomType.YMD : AtomType.DUR; } if(o instanceof XMLGregorianCalendar) { final QName type = ((XMLGregorianCalendar) o).getXMLSchemaType(); if(type == DatatypeConstants.DATE) return AtomType.DAT; if(type == DatatypeConstants.DATETIME) return AtomType.DTM; if(type == DatatypeConstants.TIME) return AtomType.TIM; if(type == DatatypeConstants.GYEARMONTH) return AtomType.YMO; if(type == DatatypeConstants.GMONTHDAY) return AtomType.MDA; if(type == DatatypeConstants.GYEAR) return AtomType.YEA; if(type == DatatypeConstants.GMONTH) return AtomType.MON; if(type == DatatypeConstants.GDAY) return AtomType.DAY; } return null; } /** * Returns an appropriate XQuery data type for the specified Java class. * @param type Java type * @return xquery type */ protected static Type type(final Class type) { for(int j = 0; j < JAVA.length; ++j) { if(JAVA[j].isAssignableFrom(type)) return XQUERY[j]; } return null; } /** * Returns a string representation of all found arguments. * @param args array with arguments * @return string representation */ protected static String foundArgs(final Value[] args) { // compose found arguments final StringBuilder sb = new StringBuilder(); for(final Value v : args) { if(sb.length() != 0) sb.append(", "); sb.append(v instanceof Jav ? ((Jav) v).toJava().getClass().getSimpleName() : v.type()); } return sb.toString(); } @Override public boolean has(final Flag flag) { return flag == Flag.NDT || super.has(flag); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/JavaModuleFunc.java000066400000000000000000000056221222453003200270120ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import java.lang.reflect.*; import org.basex.query.*; import org.basex.query.QueryModule.Deterministic; import org.basex.query.QueryModule.FocusDependent; import org.basex.query.expr.*; import org.basex.query.value.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Java function binding. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class JavaModuleFunc extends JavaMapping { /** Java module. */ private final Object module; /** Method to be called. */ private final Method mth; /** * Constructor. * @param ii input info * @param jm Java module * @param m Java method/field * @param a arguments */ JavaModuleFunc(final InputInfo ii, final Object jm, final Method m, final Expr[] a) { super(ii, a); module = jm; mth = m; } @Override protected Object eval(final Value[] vals, final QueryContext ctx) throws QueryException { // assign context if module is inheriting {@link QueryModule} if(module instanceof QueryModule) ((QueryModule) module).context = ctx; final Object[] args = JavaFunc.args(mth.getParameterTypes(), vals, true); if(args != null) { try { return mth.invoke(module, args); } catch(final Exception ex) { Throwable e = ex; if(e.getCause() != null) { Util.debug(e); e = e.getCause(); } throw e instanceof QueryException ? ((QueryException) e).info(info) : JAVAERR.thrw(info, e); } } // compose error message: expected arguments final TokenBuilder expect = new TokenBuilder(); for(final Class c : mth.getParameterTypes()) { if(!expect.isEmpty()) expect.add(", "); expect.add(c.getSimpleName()); } throw JAVAMOD.thrw(info, mth.getName() + '(' + expect + ')', mth.getName() + '(' + foundArgs(vals) + ')'); } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new JavaModuleFunc(info, module, mth, copyAll(ctx, scp, vs, expr)); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(NAM, name()), expr); } @Override public String description() { return name() + " method"; } /** * Returns the function descriptor. * @return string */ private String name() { return module.getClass().getSimpleName() + ':' + mth.getName(); } @Override public String toString() { return name() + PAR1 + toString(SEP) + PAR2; } @Override public boolean has(final Flag f) { return f == Flag.NDT && mth.getAnnotation(Deterministic.class) == null || (f == Flag.CTX || f == Flag.FCS) && mth.getAnnotation(FocusDependent.class) == null || super.has(f); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/PartFunc.java000066400000000000000000000101161222453003200256630ustar00rootroot00000000000000package org.basex.query.func; import java.util.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Partial function application. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class PartFunc extends Arr { /** Positions of the placeholders. */ private final int[] holes; /** * Constructor. * @param ii input info * @param fn function expression * @param arg argument expressions * @param hl positions of the placeholders */ public PartFunc(final InputInfo ii, final Expr fn, final Expr[] arg, final int[] hl) { super(ii, Array.add(arg, fn)); holes = hl; type = SeqType.FUN_O; } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { super.compile(ctx, scp); return optimize(ctx, scp); } @Override public Expr optimize(final QueryContext ctx, final VarScope scp) throws QueryException { final Expr f = expr[expr.length - 1]; if(allAreValues()) return preEval(ctx); final SeqType t = f.type(); if(t.instanceOf(SeqType.FUN_O) && t.type != FuncType.ANY_FUN) { final FuncType ft = (FuncType) t.type; final int arity = expr.length + holes.length - 1; if(ft.args.length != arity) Err.INVARITY.thrw(info, f, arity); final SeqType[] ar = new SeqType[holes.length]; for(int i = 0; i < holes.length; i++) ar[i] = ft.args[holes[i]]; type = FuncType.get(ft.type, ar).seqType(); } return this; } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { final Expr fn = expr[expr.length - 1]; final FItem f = (FItem) checkType(fn.item(ctx, ii), FuncType.ANY_FUN); final FuncType ft = (FuncType) f.type; final int arity = expr.length + holes.length - 1; if(f.arity() != arity) Err.INVARITY.thrw(ii, f, arity); final Expr[] args = new Expr[arity]; final VarScope scp = new VarScope(); final Var[] vars = new Var[holes.length]; int p = -1; for(int i = 0; i < holes.length; i++) { while(++p < holes[i]) args[p] = expr[p - i].value(ctx); vars[i] = scp.uniqueVar(ctx, ft.args[p], true); args[p] = new VarRef(info, vars[i]); } while(++p < args.length) args[p] = expr[p - holes.length].value(ctx); final Expr call = new DynFuncCall(info, f, args).optimize(ctx, scp); // [LW] introduce annotations final InlineFunc func = new InlineFunc( info, ft.type, vars, call, new Ann(), ctx.sc, scp); return func.optimize(ctx, null).item(ctx, ii); } @Override public Value value(final QueryContext ctx) throws QueryException { return item(ctx, info); } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new PartFunc(info, expr[expr.length - 1].copy(ctx, scp, vs), copyAll(ctx, scp, vs, Arrays.copyOf(expr, expr.length - 1)), holes.clone()); } @Override public void plan(final FElem plan) { final FElem e = planElem(); final int es = expr.length, hs = holes.length; expr[es - 1].plan(e); int p = -1; for(int i = 0; i < hs; i++) { while(++p < holes[i]) expr[p - i].plan(e); final FElem a = new FElem(QueryText.ARG); e.add(a.add(planAttr(QueryText.POS, Token.token(i)))); } while(++p < es + hs - 1) expr[p - hs].plan(e); plan.add(e); } @Override public String toString() { final TokenBuilder tb = new TokenBuilder(expr[expr.length - 1].toString()).add('('); int p = -1; final int es = expr.length, hs = holes.length; for(int i = 0; i < hs; i++) { while(++p < holes[i]) tb.add(p > 0 ? QueryText.SEP : "").add(expr[p - i].toString()); tb.add(p > 0 ? QueryText.SEP : "").add('?'); } while(++p < es + hs - 1) tb.add(QueryText.SEP).add(expr[p - hs].toString()); return tb.add(')').toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/StandardFunc.java000066400000000000000000000200421222453003200265140ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.io.*; import java.nio.charset.*; import java.util.*; import org.basex.core.*; import org.basex.data.*; import org.basex.io.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.map.Map; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Standard (built-in) functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class StandardFunc extends Arr { /** Function signature. */ Function sig; /** * Constructor. * @param ii input info * @param s function definition * @param args arguments */ protected StandardFunc(final InputInfo ii, final Function s, final Expr... args) { super(ii, args); sig = s; type = sig.ret; } @Override public final Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { // compile all arguments super.compile(ctx, scp); return optimize(ctx, scp); } @Override public final Expr optimize(final QueryContext ctx, final VarScope scp) throws QueryException { // skip context-based or non-deterministic functions, and non-values return optPre(has(Flag.CTX) || has(Flag.NDT) || !allAreValues() ? opt(ctx) : sig.ret.zeroOrOne() ? item(ctx, info) : value(ctx), ctx); } /** * Performs function specific optimizations. * @param ctx query context * @return evaluated item * @throws QueryException query exception */ @SuppressWarnings("unused") protected Expr opt(final QueryContext ctx) throws QueryException { return this; } @Override public final StandardFunc copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final int es = expr.length; final Expr[] arg = new Expr[es]; for(int e = 0; e < es; e++) arg[e] = expr[e].copy(ctx, scp, vs); return sig.get(info, arg); } /** * Atomizes the specified item. * @param it input item * @param ii input info * @return atomized item * @throws QueryException query exception */ public static final Item atom(final Item it, final InputInfo ii) throws QueryException { final Type ip = it.type; return it instanceof ANode ? ip == NodeType.PI || ip == NodeType.COM ? Str.get(it.string(ii)) : new Atm(it.string(ii)) : it.materialize(ii); } @Override public boolean has(final Flag flag) { return sig.has(flag) || flag != Flag.X30 && super.has(flag); } @Override public final boolean isFunction(final Function f) { return sig == f; } @Override public final boolean isVacuous() { return !has(Flag.UPD) && type.eq(SeqType.EMP); } @Override public final String description() { return sig.toString(); } @Override public final void plan(final FElem plan) { addPlan(plan, planElem(NAM, sig.desc), expr); } @Override public final String toString() { final String desc = sig.toString(); return new TokenBuilder(desc.substring(0, desc.indexOf('(') + 1)).addSep(expr, SEP).add(PAR2).toString(); } /** * Returns a data instance for the first string argument of the function. * This method assumes that the function has at least one argument. * @param ctx query context * @return data instance * @throws QueryException query exception */ protected final Data checkData(final QueryContext ctx) throws QueryException { final String name = string(checkStr(expr[0], ctx)); if(!Databases.validName(name)) INVDB.thrw(info, name); return ctx.resource.data(name, info); } /** * Converts the specified argument to a file instance. * @param i argument index * @param ctx query context * @return file instance * @throws QueryException query exception */ protected File checkFile(final int i, final QueryContext ctx) throws QueryException { if(i >= expr.length) return null; final String file = string(checkStr(expr[i], ctx)); return (IOUrl.isFileURL(file) ? IOFile.get(file) : new IOFile(file)).file(); } /** * Checks if the specified database can be detected for locking, i.e., if the * first argument of the tested function is a static string. * This method assumes that the function has at least one argument. * @param visitor visitor * @return result of check */ protected final boolean dataLock(final ASTVisitor visitor) { return visitor.lock(expr[0] instanceof Str ? string(((Str) expr[0]).string()) : null); } /** * Returns a normalized encoding representation. * @param i index of encoding argument * @param err error for invalid encoding * @param ctx query context * @return text entry * @throws QueryException query exception */ protected final String encoding(final int i, final Err err, final QueryContext ctx) throws QueryException { if(i >= expr.length) return null; final String enc = string(checkStr(expr[i], ctx)); try { if(Charset.isSupported(enc)) return normEncoding(enc); } catch(final IllegalArgumentException e) { /* character set is invalid or unknown (e.g. empty string) */ } throw err.thrw(info, enc); } /** * Converts the specified dateTime to milliseconds. * @param e expression * @param ctx query context * @return resulting value * @throws QueryException query exception */ protected final long dateTimeToMs(final Expr e, final QueryContext ctx) throws QueryException { final Dtm dtm = (Dtm) checkType(checkItem(e, ctx), AtomType.DTM); if(dtm.yea() > 292278993) INTRANGE.thrw(info, dtm); return dtm.toJava().toGregorianCalendar().getTimeInMillis(); } /** * Returns all keys and values of the specified binding argument. * @param i index of argument * @param ctx query context * @return resulting map * @throws QueryException query exception */ protected final HashMap bindings(final int i, final QueryContext ctx) throws QueryException { final HashMap hm = new HashMap(); final int es = expr.length; if(i < es) { final Map map = checkMap(expr[i].item(ctx, info)); for(final Item it : map.keys()) { final byte[] key; if(it instanceof Str) { key = it.string(null); } else { final QNm qnm = (QNm) checkType(it, AtomType.QNM); final TokenBuilder tb = new TokenBuilder(); if(qnm.uri() != null) tb.add('{').add(qnm.uri()).add('}'); key = tb.add(qnm.local()).finish(); } hm.put(string(key), map.get(it, info)); } } return hm; } /** * Caches and materializes all items of the specified iterator. * @param ir iterator * @param vb value builder * @param ctx query context * @throws QueryException query exception */ protected final void cache(final Iter ir, final ValueBuilder vb, final QueryContext ctx) throws QueryException { for(Item it; (it = ir.next()) != null;) { final Data d = it.data(); if(d != null && !d.inMemory()) { it = ((ANode) it).dbCopy(ctx.context.prop); } else if(it instanceof FItem) { FIVALUE.thrw(info, it); } vb.add(it.materialize(info)); } } /** * Compares several signatures for equality. * @param sig signature to be found * @param sigs signatures to be compared * @return result of check */ protected static boolean oneOf(final Function sig, final Function... sigs) { for(final Function s : sigs) if(sig == s) return true; return false; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/StaticFunc.java000066400000000000000000000174671222453003200262240ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import java.util.*; import org.basex.core.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.expr.Expr.Flag; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; /** * A static user-defined function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class StaticFunc extends StaticDecl implements XQFunction { /** Arguments. */ public final Var[] args; /** Updating flag. */ public final boolean updating; /** Cast flag. */ boolean cast; /** Map with requested function properties. */ private final EnumMap map = new EnumMap(Flag.class); /** Flag that is turned on during compilation and prevents premature inlining. */ private boolean compiling; /** * Function constructor. * @param a annotations * @param n function name * @param v arguments * @param r return type * @param e function body * @param stc static context * @param scp variable scope * @param xqdoc current xqdoc cache * @param ii input info */ public StaticFunc(final Ann a, final QNm n, final Var[] v, final SeqType r, final Expr e, final StaticContext stc, final VarScope scp, final String xqdoc, final InputInfo ii) { super(stc, a, n, r, scp, xqdoc, ii); args = v; expr = e; cast = r != null; updating = ann.contains(Ann.Q_UPDATING); } @Override public void compile(final QueryContext ctx) throws QueryException { if(compiled) return; compiling = compiled = true; final Value cv = ctx.value; final StaticContext cs = ctx.sc; ctx.sc = sc; ctx.value = null; final int fp = scope.enter(ctx); try { expr = expr.compile(ctx, scope); } catch(final QueryException qe) { expr = FNInfo.error(qe); } finally { scope.cleanUp(this); scope.exit(ctx, fp); ctx.value = cv; ctx.sc = cs; } // convert all function calls in tail position to proper tail calls ctx.compInfo(OPTTCE, name); expr.markTailCalls(); if(declType != null) { // remove redundant casts if((declType.type == AtomType.BLN || declType.type == AtomType.FLT || declType.type == AtomType.DBL || declType.type == AtomType.QNM || declType.type == AtomType.URI) && declType.eq(expr.type())) { ctx.compInfo(OPTCAST, declType); cast = false; } } compiling = false; } /** * Checks if this function can be inlined. * @param ctx query context * @return result of check */ boolean inline(final QueryContext ctx) { return expr.isValue() || expr.exprSize() < ctx.context.prop.num(Prop.INLINELIMIT) && !(compiling || has(Flag.NDT) || has(Flag.CTX) || selfRecursive()); } @Override public void plan(final FElem plan) { final FElem el = planElem(NAM, name.string()); addPlan(plan, el, expr); for(int i = 0; i < args.length; ++i) { el.add(planAttr(ARG + i, args[i].name.string())); } } @Override public String toString() { final TokenBuilder tb = new TokenBuilder(DECLARE).add(' ').addExt(ann); if(updating) tb.add(UPDATING).add(' '); tb.add(FUNCTION).add(' ').add(name.string()); tb.add(PAR1).addSep(args, SEP).add(PAR2); if(declType != null) tb.add(' ' + AS + ' ' + declType); if(expr != null) tb.add(" { ").addExt(expr).add(" }; "); else tb.add(" external; "); return tb.toString(); } /** * Checks if this function calls itself recursively. * @return result of check */ public boolean selfRecursive() { return !expr.accept(new ASTVisitor() { @Override public boolean funcCall(final StaticFuncCall call) { return call.func != StaticFunc.this; } @Override public boolean inlineFunc(final Scope sub) { return sub.visit(this); } }); } @Override public int arity() { return args.length; } @Override public QNm fName() { return name; } @Override public FuncType funcType() { return FuncType.get(ann, args, declType); } @Override public Item invItem(final QueryContext ctx, final InputInfo ii, final Value... arg) throws QueryException { // reset context and evaluate function final Value cv = ctx.value; final StaticContext cs = ctx.sc; ctx.sc = sc; ctx.value = null; final int fp = scope.enter(ctx); try { addArgs(ctx, ii, arg); final Item it = expr.item(ctx, ii); final Value v = it == null ? Empty.SEQ : it; // optionally promote return value to target type return cast ? declType.funcConvert(ctx, ii, v).item(ctx, ii) : it; } finally { scope.exit(ctx, fp); ctx.value = cv; ctx.sc = cs; } } @Override public Value invValue(final QueryContext ctx, final InputInfo ii, final Value... arg) throws QueryException { // reset context and evaluate function final Value cv = ctx.value; final StaticContext cs = ctx.sc; ctx.sc = sc; ctx.value = null; final int fp = scope.enter(ctx); try { addArgs(ctx, ii, arg); final Value v = ctx.value(expr); // optionally promote return value to target type return cast ? declType.funcConvert(ctx, info, v) : v; } finally { scope.exit(ctx, fp); ctx.value = cv; ctx.sc = cs; } } @Override public Value invokeValue(final QueryContext ctx, final InputInfo ii, final Value... arg) throws QueryException { return FuncCall.value(this, arg, ctx, ii); } @Override public Item invokeItem(final QueryContext ctx, final InputInfo ii, final Value... arg) throws QueryException { return FuncCall.item(this, arg, ctx, ii); } /** * Adds the given arguments to the variable stack. * @param ctx query context * @param ii input info * @param vals values to add * @throws QueryException if the arguments can't be bound */ private void addArgs(final QueryContext ctx, final InputInfo ii, final Value[] vals) throws QueryException { // move variables to stack for(int i = 0; i < args.length; i++) ctx.set(args[i], vals[i], ii); } /** * Checks if all updating expressions in the function are correctly declared and placed. * @throws QueryException query exception */ public void checkUp() throws QueryException { final boolean u = expr.has(Flag.UPD); if(u) expr.checkUp(); if(updating) { // updating function if(declType != null) UPFUNCTYPE.thrw(info); if(!u && !expr.isVacuous()) UPEXPECTF.thrw(info); } else if(u) { // uses updates, but is not declared as such UPNOT.thrw(info, description()); } } /** * Checks if this function returns vacuous results (see {@link Expr#isVacuous()}). * @return result of check */ public boolean isVacuous() { return !has(Flag.UPD) && declType != null && declType.eq(SeqType.EMP); } /** * Indicates if an expression has the specified compiler property. * @param flag feature * @return result of check * @see Expr#has(Flag) */ public boolean has(final Flag flag) { // handle recursive calls: set dummy value, eventually replace it with final value Boolean b = map.get(flag); if(b == null) { map.put(flag, false); b = expr == null || expr.has(flag); map.put(flag, b); } return b; } @Override public boolean visit(final ASTVisitor visitor) { for(final Var v : args) if(!visitor.declared(v)) return false; return expr.accept(visitor); } @Override public byte[] id() { return StaticFuncs.sig(name, args.length); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/StaticFuncCall.java000066400000000000000000000120061222453003200270000ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.QueryText.*; import java.util.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.gflwor.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Function call for user-defined functions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class StaticFuncCall extends FuncCall { /** Static context of this function call. */ protected final StaticContext sc; /** Function name. */ final QNm name; /** Function reference. */ StaticFunc func; /** * Function call constructor. * @param ii input info * @param nm function name * @param arg arguments * @param sctx static context */ public StaticFuncCall(final QNm nm, final Expr[] arg, final StaticContext sctx, final InputInfo ii) { this(nm, arg, sctx, null, false, ii); } /** * Copy constructor. * @param ii input info * @param nm function name * @param arg arguments * @param sctx static context * @param fun referenced function * @param tail tail-call flag */ private StaticFuncCall(final QNm nm, final Expr[] arg, final StaticContext sctx, final StaticFunc fun, final boolean tail, final InputInfo ii) { super(ii, arg); sc = sctx; name = nm; func = fun; tailCall = tail; } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { super.compile(ctx, scp); // disallow call of private functions from module with different uri if(func.ann.contains(Ann.Q_PRIVATE) && !Token.eq(func.sc.baseURI().string(), ctx.sc.baseURI().string())) throw Err.FUNCPRIV.thrw(info, name.string()); // compile mutually recursive functions func.compile(ctx); if(func.inline(ctx)) { // inline the function ctx.compInfo(OPTINLINEFN, func.name); // create let bindings for all variables final LinkedList cls = expr.length == 0 ? null : new LinkedList(); final IntObjMap vs = new IntObjMap(); for(int i = 0; i < func.args.length; i++) { final Var old = func.args[i], v = scp.newCopyOf(ctx, old); vs.put(old.id, v); cls.add(new Let(v, expr[i], false, func.info).optimize(ctx, scp)); } // copy the function body final Expr cpy = func.expr.copy(ctx, scp, vs), rt = !func.cast ? cpy : new TypeCheck(func.info, cpy, func.declType, true).optimize(ctx, scp); return cls == null ? rt : new GFLWOR(func.info, cls, rt).optimize(ctx, scp); } type = func.type(); return this; } @Override public StaticFuncCall copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final Expr[] arg = new Expr[expr.length]; for(int i = 0; i < arg.length; i++) arg[i] = expr[i].copy(ctx, scp, vs); final StaticFuncCall call = new StaticFuncCall(name, arg, sc, func, false, info); call.type = type; call.size = size; return call; } /** * Initializes the function and checks for visibility. * @param f function reference * @return self reference * @throws QueryException query exception */ public StaticFuncCall init(final StaticFunc f) throws QueryException { func = f; if(f.ann.contains(Ann.Q_PRIVATE) && !Token.eq(sc.baseURI().string(), f.sc.baseURI().string())) throw Err.FUNCPRIV.thrw(info, f.name.string()); return this; } /** * Returns the called function if already known, {@code false} otherwise. * @return the function */ public StaticFunc func() { return func; } @Override public boolean isVacuous() { return func != null && func.isVacuous(); } @Override public boolean has(final Flag flag) { // check arguments, which will be evaluated before running the function code if(super.has(flag)) return true; // function code: position or context references will have no effect on calling code if(flag == Flag.FCS || flag == Flag.CTX) return false; // pass on check to function code return func == null || (flag == Flag.UPD ? func.updating : func.has(flag)); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(NAM, this, TCL, tailCall), expr); } @Override public String description() { return FUNC; } @Override public String toString() { return new TokenBuilder(name.string()).add(toString(SEP)).toString(); } @Override public boolean accept(final ASTVisitor visitor) { return visitor.funcCall(this) && super.accept(visitor); } @Override public StaticFunc evalFunc(final QueryContext ctx) { return func; } @Override Value[] evalArgs(final QueryContext ctx) throws QueryException { final int al = expr.length; final Value[] args = new Value[al]; for(int a = 0; a < al; ++a) args[a] = ctx.value(expr[a]); return args; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/StaticFuncs.java000066400000000000000000000222201222453003200263660ustar00rootroot00000000000000package org.basex.query.func; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.util.*; import org.basex.core.*; import org.basex.data.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * Container for a user-defined function. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class StaticFuncs extends ExprInfo { /** User-defined functions. */ private final TokenObjMap funcs = new TokenObjMap(); /** * returns the signature of the function with the given name and arity. * @param name function name * @param arity function arity * @return the function's signature */ protected static byte[] sig(final QNm name, final long arity) { return new TokenBuilder(name.id()).add('#').add(Token.token(arity)).finish(); } /** * Declares a new user-defined function. * @param ann annotations * @param nm function name * @param args formal parameters * @param ret return type * @param body function body * @param sc static context * @param scp variable scope * @param xqdoc current xqdoc cache * @param ii input info * @return static function reference * @throws QueryException query exception */ public StaticFunc declare(final Ann ann, final QNm nm, final Var[] args, final SeqType ret, final Expr body, final StaticContext sc, final VarScope scp, final String xqdoc, final InputInfo ii) throws QueryException { final byte[] uri = nm.uri(); if(uri.length == 0) FUNNONS.thrw(ii, nm.string()); if(NSGlobal.reserved(uri)) NAMERES.thrw(ii, nm.string()); final StaticFunc fn = new StaticFunc(ann, nm, args, ret, body, sc, scp, xqdoc, ii); final byte[] sig = fn.id(); final FuncCache fc = funcs.get(sig); if(fc != null) fc.setFunc(fn); else funcs.put(sig, new FuncCache(fn)); return fn; } /** * Creates a reference to an already declared or referenced function. * @param name name of the function * @param args optional arguments * @param sc static context * @param ii input info * @return reference if the function is known, {@code false} otherwise * @throws QueryException query exception */ TypedFunc getRef(final QNm name, final Expr[] args, final StaticContext sc, final InputInfo ii) throws QueryException { // check if function has already been declared final FuncCache fc = funcs.get(sig(name, args.length)); return fc == null ? null : fc.newCall(name, args, sc, ii); } /** * Returns a new reference to the function with the given name and arity. * @param name function name * @param args argument expressions * @param sc static context of the function call * @param ii input info * @return function call * @throws QueryException query exception */ public TypedFunc getFuncRef(final QNm name, final Expr[] args, final StaticContext sc, final InputInfo ii) throws QueryException { if(NSGlobal.reserved(name.uri())) errorIfSimilar(name, ii); final byte[] sig = sig(name, args.length); if(!funcs.contains(sig)) funcs.put(sig, new FuncCache(null)); return getRef(name, args, sc, ii); } /** * Checks if all functions have been correctly declared, and initializes * all function calls. * @param qc query context * @throws QueryException query exception */ public void check(final QueryContext qc) throws QueryException { // initialize function calls int id = 0; for(final FuncCache fc : funcs.values()) { final StaticFuncCall call = fc.calls.isEmpty() ? null : fc.calls.get(0); if(fc.func == null) { // check if another function with same name exists int oid = 0; final IntList al = new IntList(); for(final FuncCache ofc : funcs.values()) { if(oid++ == id) continue; if(call.name.eq(ofc.name())) al.add(ofc.func.arity()); } if(!al.isEmpty()) { final StringBuilder exp = new StringBuilder(); final int as = al.size(); for(int a = 0; a < as; a++) { if(a != 0) exp.append(a + 1 < as ? "," : " or "); exp.append(al.get(a)); } final int a = call.expr.length; (a == 1 ? FUNCTYPESG : FUNCTYPEPL).thrw(call.info, call.name.string(), a, exp); } // if not, indicate that function is unknown FUNCUNKNOWN.thrw(call.info, call.name.string()); } if(call != null) { if(fc.func.expr == null) FUNCNOIMPL.thrw(call.info, call.name.string()); qc.updating |= fc.func.updating; } id++; } } /** * Checks if the functions perform updates. * @throws QueryException query exception */ public void checkUp() throws QueryException { for(final FuncCache fc : funcs.values()) fc.func.checkUp(); } /** * Compiles the functions. * @param ctx query context * @throws QueryException query exception */ public void compile(final QueryContext ctx) throws QueryException { // only compile those functions that are used for(final FuncCache fc : funcs.values()) { if(!fc.calls.isEmpty()) fc.func.compile(ctx); } } /** * Returns the function with the given name and arity. * @param name function name * @param arity function arity * @param ii input info * @return function if found, {@code null} otherwise * @throws QueryException query exception */ public StaticFunc get(final QNm name, final long arity, final InputInfo ii) throws QueryException { if(NSGlobal.reserved(name.uri())) errorIfSimilar(name, ii); final FuncCache fc = funcs.get(sig(name, arity)); return fc == null ? null : fc.func; } /** * Throws an error if the name of a function is similar to the specified function name. * @param name function name * @param ii input info * @throws QueryException query exception */ public void errorIfSimilar(final QNm name, final InputInfo ii) throws QueryException { // find global function Functions.get().errorIfSimilar(name, ii); // find local functions final Levenshtein ls = new Levenshtein(); final byte[] nm = lc(name.local()); for(final FuncCache fc : funcs.values()) { final StaticFunc sf = fc.func; if(sf != null && sf.expr != null && ls.similar(nm, lc(sf.name.local()))) { FUNCSIMILAR.thrw(ii, name.string(), sf.name.string()); } } } @Override public void plan(final FElem plan) { if(!funcs.isEmpty()) addPlan(plan, planElem(), funcs()); } /** * Returns all user-defined functions. * @return functions */ public StaticFunc[] funcs() { final int fs = funcs.size(); final StaticFunc[] sf = new StaticFunc[fs]; int i = 0; for(final FuncCache fc : funcs.values()) sf[i++] = fc.func; return sf; } @Override public String toString() { final StringBuilder sb = new StringBuilder(); for(final FuncCache fc : funcs.values()) { sb.append(fc.func.toString()).append(Text.NL); } return sb.toString(); } /** Function cache. */ private static class FuncCache { /** Function calls. */ ArrayList calls = new ArrayList(0); /** Function. */ StaticFunc func; /** * Constructor. * @param sf function */ FuncCache(final StaticFunc sf) { func = sf; } /** * Assigns the given function to all of its references and checks their visibility. * @param fn function to assign * @throws QueryException query exception */ public void setFunc(final StaticFunc fn) throws QueryException { if(func != null) throw FUNCDEFINED.thrw(fn.info, fn.name.string()); func = fn; for(final StaticFuncCall call : calls) call.init(fn); } /** * Creates a new call to this function. * @param nm function name * @param args argument expressions * @param sc static context * @param ii input info * @return function call * @throws QueryException query exception */ public TypedFunc newCall(final QNm nm, final Expr[] args, final StaticContext sc, final InputInfo ii) throws QueryException { final StaticFuncCall call = new StaticFuncCall(nm, args, sc, ii); calls.add(call); if(func == null) { // [LW] should be deferred until the actual types are known (i.e. compile time) return new TypedFunc(call, new Ann(), FuncType.arity(args.length)); } return new TypedFunc(call.init(func), func.ann, func.funcType()); } /** * Returns the function's name. * @return function name */ public QNm name() { return func != null ? func.name : calls.get(0).name; } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/XQueryFunction.java000066400000000000000000000003631222453003200271070ustar00rootroot00000000000000package org.basex.query.func; import java.lang.annotation.*; /** * Java module signature. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ @Retention(RetentionPolicy.RUNTIME) public @interface XQueryFunction { } basex-7.7.2/basex-core/src/main/java/org/basex/query/func/package.html000066400000000000000000000000441222453003200255560ustar00rootroot00000000000000 XQuery functions. basex-7.7.2/basex-core/src/main/java/org/basex/query/gflwor/000077500000000000000000000000001222453003200236445ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/gflwor/Count.java000066400000000000000000000051701222453003200256020ustar00rootroot00000000000000package org.basex.query.gflwor; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.gflwor.GFLWOR.Clause; import org.basex.query.gflwor.GFLWOR.Eval; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * GFLWOR {@code count} clause. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class Count extends GFLWOR.Clause { /** Count variable. */ final Var count; /** * Constructor. * @param v variable * @param ii input info */ public Count(final Var v, final InputInfo ii) { super(ii, v); count = v; } @Override Eval eval(final Eval sub) { return new Eval() { /** Counter. */ private long i = 1; @Override public boolean next(final QueryContext ctx) throws QueryException { if(!sub.next(ctx)) return false; ctx.set(count, Int.get(i++), info); return true; } }; } @Override boolean skippable(final Clause cl) { // the clause should not change tuple counts return super.skippable(cl) && cl.calcSize(1) == 1; } @Override public void plan(final FElem plan) { final FElem e = planElem(); count.plan(e); plan.add(e); } @Override public String toString() { return "count " + count; } @Override public boolean has(final Flag flag) { return false; } @Override public Count compile(final QueryContext ctx, final VarScope scp) throws QueryException { count.refineType(SeqType.ITR, ctx, info); return this; } @Override public Count optimize(final QueryContext ctx, final VarScope scp) throws QueryException { return this; } @Override public boolean removable(final Var v) { return true; } @Override public VarUsage count(final Var v) { return VarUsage.NEVER; } @Override public Clause inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { return null; } @Override public Count copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final Var v = scp.newCopyOf(ctx, count); vs.put(count.id, v); return new Count(v, info); } @Override public boolean accept(final ASTVisitor visitor) { return visitor.declared(count); } @Override public void checkUp() throws QueryException { // never } @Override long calcSize(final long cnt) { return cnt; } @Override public int exprSize() { return 0; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/gflwor/For.java000066400000000000000000000167441222453003200252510ustar00rootroot00000000000000package org.basex.query.gflwor; import static org.basex.query.QueryText.*; import java.util.List; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.func.*; import org.basex.query.gflwor.GFLWOR.Clause; import org.basex.query.gflwor.GFLWOR.Eval; import org.basex.query.iter.*; import org.basex.query.path.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.query.value.type.SeqType.Occ; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * FLWOR {@code for} clause, iterating over a sequence. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class For extends GFLWOR.Clause { /** Item variable. */ final Var var; /** Position variable. */ final Var pos; /** Score variable. */ final Var score; /** Bound expression. */ Expr expr; /** {@code allowing empty} flag. */ final boolean empty; /** * Constructor. * @param v item variable * @param p position variable or {@code null} * @param s score variable or {@code null} * @param e bound expression * @param emp {@code allowing empty} flag * @param ii input info */ public For(final Var v, final Var p, final Var s, final Expr e, final boolean emp, final InputInfo ii) { super(ii, vars(v, p, s)); var = v; pos = p; score = s; expr = e; empty = emp; } @Override Eval eval(final Eval sub) { return new Eval() { /** Expression iterator. */ private Iter iter; /** Current position. */ private long p; @Override public boolean next(final QueryContext ctx) throws QueryException { while(true) { final Item it = iter == null ? null : iter.next(); if(it != null) { // there's another item to serve ++p; ctx.set(var, it, info); if(pos != null) ctx.set(pos, Int.get(p), info); if(score != null) ctx.set(score, Dbl.get(it.score()), info); return true; } if(empty && iter != null && p == 0) { // expression yields no items, bind the empty sequence instead ctx.set(var, Empty.SEQ, info); if(pos != null) ctx.set(pos, Int.get(p), info); if(score != null) ctx.set(score, Dbl.get(0), info); iter = null; return true; } // no more iterations from above, we're done here if(!sub.next(ctx)) return false; // next iteration, reset iterator and counter iter = expr.iter(ctx); p = 0; } } }; } @Override public void plan(final FElem plan) { final FElem e = planElem(); if(empty) e.add(planAttr(Token.token(EMPTYORD), Token.TRUE)); var.plan(e); if(pos != null) { final FElem e2 = new FElem(QueryText.AT); pos.plan(e2); e.add(e2); } if(score != null) { final FElem e2 = new FElem(QueryText.SCORE); score.plan(e2); e.add(e2); } expr.plan(e); plan.add(e); } @Override public String toString() { final StringBuilder sb = new StringBuilder(FOR).append(' ').append(var); if(empty) sb.append(' ').append(ALLOWING).append(' ').append(EMPTYORD); if(pos != null) sb.append(' ').append(AT).append(' ').append(pos); if(score != null) sb.append(' ').append(SCORE).append(' ').append(score); return sb.append(' ').append(IN).append(' ').append(expr).toString(); } @Override public boolean has(final Flag flag) { return expr.has(flag); } @Override public For compile(final QueryContext ctx, final VarScope scp) throws QueryException { expr = expr.compile(ctx, scp); return optimize(ctx, scp); } @Override public For optimize(final QueryContext ctx, final VarScope scp) throws QueryException { final SeqType tp = expr.type(); final boolean emp = empty && tp.mayBeZero(); type = SeqType.get(tp.type, emp ? Occ.ZERO_ONE : Occ.ONE); var.refineType(type, ctx, info); if(pos != null) pos.refineType(SeqType.ITR, ctx, info); if(score != null) score.refineType(SeqType.DBL, ctx, info); size = emp ? -1 : 1; return this; } @Override public boolean removable(final Var v) { return expr.removable(v); } @Override public VarUsage count(final Var v) { return expr.count(v); } @Override public Clause inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { final Expr sub = expr.inline(ctx, scp, v, e); if(sub == null) return null; expr = sub; return optimize(ctx, scp); } @Override public For copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final Var v = scp.newCopyOf(ctx, var); vs.put(var.id, v); final Var p = pos == null ? null : scp.newCopyOf(ctx, pos); if(p != null) vs.put(pos.id, p); final Var s = score == null ? null : scp.newCopyOf(ctx, score); if(s != null) vs.put(score.id, s); return new For(v, p, s, expr.copy(ctx, scp, vs), empty, info); } @Override public boolean accept(final ASTVisitor visitor) { return expr.accept(visitor) && visitor.declared(var) && (pos == null || visitor.declared(pos)) && (score == null || visitor.declared(score)); } /** * Gathers all non-{@code null} variables. * @param v var * @param p pos * @param s scope * @return non-{@code null} variables */ private static Var[] vars(final Var v, final Var p, final Var s) { return p == null ? s == null ? new Var[] { v } : new Var[] { v, s } : s == null ? new Var[] { v, p } : new Var[] { v, p, s }; } @Override public void checkUp() throws QueryException { checkNoUp(expr); } /** * Tries to convert this for loop into a let binding. * @param clauses FLWOR clauses * @param p position * @return {@code true} if the clause was converted, {@code false} otherwise */ boolean asLet(final List clauses, final int p) { if(expr.size() != 1 && !expr.type().one()) return false; clauses.set(p, Let.fromFor(this)); if(score != null) clauses.add(p + 1, Let.fromForScore(this)); if(pos != null) clauses.add(p + 1, new Let(pos, Int.get(1), false, info)); return true; } /** * Tries to add the given expression as an attribute to this loop's sequence. * @param ctx query context * @param scp variable scope * @param p expression to add * @return success * @throws QueryException query exception */ boolean toPred(final QueryContext ctx, final VarScope scp, final Expr p) throws QueryException { if(empty || vars.length > 1 || !p.removable(var)) return false; final Expr r = p.inline(ctx, scp, var, new Context(info)), e = r == null ? p : r; // attach predicates to axis path or filter, or create a new filter final Expr a = e.type().mayBeNumber() ? Function.BOOLEAN.get(info, e) : e; // add to clause expression if(expr instanceof AxisPath) { expr = ((AxisPath) expr).addPreds(ctx, scp, a); } else if(expr instanceof Filter) { expr = ((Filter) expr).addPred(ctx, scp, a); } else { expr = Filter.get(info, expr, a).optimize(ctx, scp); } return true; } @Override long calcSize(final long count) { final long sz = expr.size(); return sz < 0 ? -1 : sz > 0 ? sz * count : empty ? 1 : 0; } @Override public int exprSize() { return expr.exprSize(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/gflwor/GFLWOR.java000066400000000000000000000576661222453003200255330ustar00rootroot00000000000000package org.basex.query.gflwor; import java.util.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.func.*; import org.basex.query.iter.*; import org.basex.query.path.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * General FLWOR expression. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class GFLWOR extends ParseExpr { /** Return expression. */ Expr ret; /** FLWOR clauses. */ private final LinkedList clauses; /** * Constructor. * @param ii input info * @param cls FLWOR clauses * @param rt return expression */ public GFLWOR(final InputInfo ii, final LinkedList cls, final Expr rt) { super(ii); clauses = cls; ret = rt; } @Override public Iter iter(final QueryContext ctx) throws QueryException { // Start evaluator, doing nothing, once. Eval e = new Eval() { /** First-evaluation flag. */ private boolean first = true; @Override public boolean next(final QueryContext c) { if(!first) return false; first = false; return true; } }; for(final Clause cls : clauses) e = cls.eval(e); final Eval ev = e; return new Iter() { /** Return iterator. */ private Iter sub = Empty.ITER; /** If the iterator has been emptied. */ private boolean drained; @Override public Item next() throws QueryException { if(drained) return null; while(true) { final Item it = sub.next(); if(it != null) return it; if(!ev.next(ctx)) { drained = true; return null; } sub = ret.iter(ctx); } } }; } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { int i = 0; try { for(final Clause c : clauses) { c.compile(ctx, scp); // the first round of constant propagation is free if(c instanceof Let) ((Let) c).bindConst(ctx); i++; } ret = ret.compile(ctx, scp); } catch(final QueryException qe) { clauseError(qe, i); } return optimize(ctx, scp); } @Override public Expr optimize(final QueryContext ctx, final VarScope scp) throws QueryException { // split combined where clauses final ListIterator iter = clauses.listIterator(); while(iter.hasNext()) { final Clause c = iter.next(); if(c instanceof Where) { final Where wh = (Where) c; if(wh.pred instanceof And) { iter.remove(); for(final Expr e : ((And) wh.pred).expr) iter.add(new Where(e, wh.info)); } } } // the other optimizations are applied until nothing changes any more boolean changed; do { // rewrite singleton for clauses to let changed = forToLet(ctx); // inline let expressions if they are used only once (and not in a loop) changed |= inlineLets(ctx, scp); // clean unused variables from group-by and order-by expression changed |= cleanDeadVars(ctx); // include the clauses of nested FLWR expressions into this one changed |= unnestFLWR(ctx, scp); // slide let clauses out to avoid repeated evaluation changed |= slideLetsOut(ctx); // float where expressions upwards to filter earlier changed |= optimizeWhere(ctx, scp); // remove FLWOR expressions when all clauses were removed if(clauses.isEmpty()) { ctx.compInfo(QueryText.OPTFLWOR, this); return ret; } if(clauses.getLast() instanceof For && ret instanceof VarRef) { final For last = (For) clauses.getLast(); // for $x in E return $x ==> return E if(!last.var.checksType() && last.var.is(((VarRef) ret).var)) { clauses.removeLast(); ret = last.expr; changed = true; } } if(!clauses.isEmpty() && clauses.getFirst() instanceof For) { final For fst = (For) clauses.getFirst(); if(!fst.empty && fst.expr instanceof GFLWOR) { ctx.compInfo(QueryText.OPTFLAT, fst); final GFLWOR sub = (GFLWOR) fst.expr; clauses.set(0, new For(fst.var, null, fst.score, sub.ret, false, fst.info)); if(fst.pos != null) clauses.add(1, new Count(fst.pos, fst.info)); clauses.addAll(0, sub.clauses); changed = true; } } if(!clauses.isEmpty() && ret instanceof GFLWOR) { final GFLWOR sub = (GFLWOR) ret; if(sub.isFLWR()) { // flatten nested FLWOR expressions ctx.compInfo(QueryText.OPTFLAT, this); clauses.addAll(sub.clauses); ret = sub.ret; changed = true; } else if(sub.clauses.getFirst() instanceof Let) { ctx.compInfo(QueryText.OPTFLAT, this); final LinkedList cls = sub.clauses; // propagate all leading let bindings into outer clauses do clauses.add(cls.removeFirst()); while(!cls.isEmpty() && cls.getFirst() instanceof Let); ret = ret.optimize(ctx, scp); changed = true; } } /* * [LW] not safe: * for $x in 1 to 4 return * for $y in 1 to 4 count $index return $index * */ } while(changed); mergeWheres(); size = calcSize(); if(size == 0 && !(has(Flag.NDT) || has(Flag.UPD))) { ctx.compInfo(QueryText.OPTWRITE, this); return Empty.SEQ; } type = SeqType.get(ret.type().type, size); if(clauses.getFirst() instanceof Where) { // where A <...> return B ===> if(A) then <...> return B else () final Where wh = (Where) clauses.removeFirst(); return new If(info, wh.pred, clauses.isEmpty() ? ret : this, Empty.SEQ); } return this; } /** * Pre-calculates the number of results of this FLWOR expression. * @return result size if statically computable, {@code -1} otherwise */ private long calcSize() { final long output = ret.size(); if(output == 0) return 0; long tuples = 1; for(final Clause c : clauses) if((tuples = c.calcSize(tuples)) <= 0) break; return tuples == 0 ? 0 : output < 0 || tuples < 0 ? -1 : tuples * output; } /** * Tries to convert for clauses that iterate ver a single item into let bindings. * @param ctx query context * @return change flag */ private boolean forToLet(final QueryContext ctx) { boolean change = false; for(int i = clauses.size(); --i >= 0;) { final Clause c = clauses.get(i); if(c instanceof For && ((For) c).asLet(clauses, i)) { ctx.compInfo(QueryText.OPTFORTOLET); change = true; } } return change; } /** * Inline let expressions if they are used only once (and not in a loop). * @param ctx query context * @param scp variable scope * @return change flag * @throws QueryException query exception */ private boolean inlineLets(final QueryContext ctx, final VarScope scp) throws QueryException { boolean change = false, thisRound; do { thisRound = false; final ListIterator iter = clauses.listIterator(); while(iter.hasNext()) { final Clause c = iter.next(); final int next = iter.nextIndex(); if(c instanceof Let) { final Let lt = (Let) c; final Expr expr = lt.expr; if(expr.has(Flag.NDT)) continue; final VarUsage use = count(lt.var, next); if(use == VarUsage.NEVER) { ctx.compInfo(QueryText.OPTVAR, lt.var); iter.remove(); change = true; } else if( // inline simple values expr.isValue() // inline variable references without type checks || expr instanceof VarRef && !lt.var.checksType() // inline expressions that occur once, but don't... // - access context (e.g. let $x:=. return [$x=1]), or // - construct nodes (e.g. let $x:= return {$x/self::X}) || use == VarUsage.ONCE && !expr.has(Flag.CTX) && !expr.has(Flag.CNS) // inline only cheap axis paths || expr instanceof AxisPath && ((AxisPath) expr).cheap()) { ctx.compInfo(QueryText.OPTINLINE, lt); inline(ctx, scp, lt.var, lt.inlineExpr(ctx, scp), next); thisRound = change = true; // continue from the beginning as clauses below could have been deleted break; } } } } while(thisRound); return change; } /** * Flattens FLWR expressions in for or let clauses by including their clauses in this * expression. * * @param ctx query context * @param scp variable scope * @return change flag * @throws QueryException query exception */ private boolean unnestFLWR(final QueryContext ctx, final VarScope scp) throws QueryException { boolean change = false, thisRound; do { thisRound = false; final ListIterator iter = clauses.listIterator(); while(iter.hasNext()) { final Clause cl = iter.next(); final boolean isFor = cl instanceof For; if(isFor) { // for $x in (for $y in A (...) return B) ===> for $y in A (...) for $x in B final For fr = (For) cl; if(!fr.empty && fr.pos == null && fr.expr instanceof GFLWOR) { final GFLWOR fl = (GFLWOR) fr.expr; if(fl.isFLWR()) { ctx.compInfo(QueryText.OPTFLAT, this); iter.remove(); for(final Clause c : fl.clauses) iter.add(c); fr.expr = fl.ret; iter.add(fr); thisRound = change = true; } } } if(!thisRound && (isFor || cl instanceof Let)) { // let $x := (let $y := E return F) ===> let $y := E let $x := F final Expr e = isFor ? ((For) cl).expr : ((Let) cl).expr; if(e instanceof GFLWOR) { final GFLWOR fl = (GFLWOR) e; final LinkedList cls = fl.clauses; if(cls.getFirst() instanceof Let) { // remove the binding from the outer clauses iter.remove(); // propagate all leading let bindings into outer clauses do iter.add(cls.removeFirst()); while(!cls.isEmpty() && cls.getFirst() instanceof Let); // re-add the binding with new, reduced expression at the end final Expr rest = fl.clauses.isEmpty() ? fl.ret : fl.optimize(ctx, scp); if(isFor) ((For) cl).expr = rest; else ((Let) cl).expr = rest; iter.add(cl); thisRound = change = true; } } } } } while(thisRound); return change; } /** * Cleans dead entries from the tuples that {@link GroupBy} and {@link OrderBy} handle. * @param ctx query context * @return change flag */ private boolean cleanDeadVars(final QueryContext ctx) { final IntObjMap decl = new IntObjMap(); final BitArray used = new BitArray(); for(final Clause cl : clauses) for(final Var v : cl.vars()) decl.put(v.id, v); final ASTVisitor marker = new ASTVisitor() { @Override public boolean used(final VarRef ref) { final int id = ref.var.id; if(decl.get(id) != null) used.set(id); return true; } }; ret.accept(marker); boolean change = false; for(int i = clauses.size(); --i >= 0;) { final Clause curr = clauses.get(i); change |= curr.clean(ctx, decl, used); curr.accept(marker); for(final Var v : curr.vars()) used.clear(v.id); } return change; } /** * Optimization pass which tries to slide let expressions out of loops. Care is taken * that no unnecessary relocations are done. * @param ctx query context * @return {@code true} if there were relocations, {@code false} otherwise */ private boolean slideLetsOut(final QueryContext ctx) { boolean change = false; for(int i = 1; i < clauses.size(); i++) { final Clause l = clauses.get(i); if(!(l instanceof Let) || l.has(Flag.NDT) || l.has(Flag.CNS)) continue; final Let let = (Let) l; // find insertion position int insert = -1; for(int j = i; --j >= 0;) { final Clause curr = clauses.get(j); if(!curr.skippable(let)) break; // insert directly above the highest skippable for or window clause // this guarantees that no unnecessary swaps occur if(curr instanceof For || curr instanceof Window) insert = j; } if(insert >= 0) { clauses.add(insert, clauses.remove(i)); if(!change) ctx.compInfo(QueryText.OPTFORLET); change = true; // it's safe to go on because clauses below the current one are never touched } } return change; } /** * Slides where clauses upwards and removes those that do not filter anything. * @param ctx query context * @param scp variable scope * @return change flag * @throws QueryException query exception */ private boolean optimizeWhere(final QueryContext ctx, final VarScope scp) throws QueryException { boolean change = false; for(int i = 0; i < clauses.size(); i++) { final Clause c = clauses.get(i); if(!(c instanceof Where) || c.has(Flag.NDT)) continue; final Where wh = (Where) c; if(wh.pred.isValue()) { if(!(wh.pred instanceof Bln)) wh.pred = Bln.get(wh.pred.ebv(ctx, wh.info).bool(wh.info)); // predicate is always false: no results possible if(!((Bln) wh.pred).bool(null)) break; // condition is always true clauses.remove(i--); change = true; } else { // find insertion position int insert = -1; for(int j = i; --j >= 0;) { final Clause curr = clauses.get(j); if(!curr.skippable(wh)) break; // where clauses are always moved to avoid unnecessary computations, // but skipping only other where clauses can cause infinite loops if(!(curr instanceof Where)) insert = j; } if(insert >= 0) { clauses.add(insert, clauses.remove(i)); change = true; // it's safe to go on because clauses below the current one are never touched } final int newPos = insert < 0 ? i : insert; for(int b4 = newPos; --b4 >= 0;) { final Clause before = clauses.get(b4); if(before instanceof For && ((For) before).toPred(ctx, scp, wh.pred)) { clauses.remove(newPos); i--; change = true; } else if(before instanceof Where) { continue; } break; } } } if(change) ctx.compInfo(QueryText.OPTWHERE2); return change; } /** Merges consecutive {@code where} clauses. */ private void mergeWheres() { Where before = null; final Iterator iter = clauses.iterator(); while(iter.hasNext()) { final Clause cl = iter.next(); if(cl instanceof Where) { final Where wh = (Where) cl; if(wh.pred == Bln.FALSE) return; if(before != null) { iter.remove(); final Expr e = before.pred; if(e instanceof And) { final And and = (And) e; and.expr = Array.add(and.expr, wh.pred); } else { before.pred = new And(before.info, new Expr[] { e, wh.pred }); } } else { before = wh; } } else { before = null; } } } @Override public boolean isVacuous() { return ret.isVacuous(); } @Override public boolean has(final Flag flag) { for(final Clause cls : clauses) if(cls.has(flag)) return true; return ret.has(flag); } @Override public boolean removable(final Var v) { for(final Clause cl : clauses) if(!cl.removable(v)) return false; return ret.removable(v); } @Override public VarUsage count(final Var v) { return count(v, 0); } /** * Counts the number of usages of the given variable starting from the given clause. * @param v variable * @param p start position * @return usage count */ private VarUsage count(final Var v, final int p) { long c = 1; VarUsage uses = VarUsage.NEVER; final ListIterator iter = clauses.listIterator(p); while(iter.hasNext()) { final Clause cl = iter.next(); uses = uses.plus(cl.count(v).times(c)); c = cl.calcSize(c); } return uses.plus(ret.count(v).times(c)); } @Override public Expr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { return inline(ctx, scp, v, e, 0) ? optimize(ctx, scp) : null; } /** * Inlines an expression bound to a given variable, starting at a specified clause. * @param ctx query context * @param scp variable scope * @param v variable * @param e expression to inline * @param p clause position * @return if changes occurred * @throws QueryException query exception */ private boolean inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e, final int p) throws QueryException { boolean change = false; final ListIterator iter = clauses.listIterator(p); while(iter.hasNext()) { final Clause cl = iter.next(); try { final Clause c = cl.inline(ctx, scp, v, e); if(c != null) { change = true; iter.set(c); } } catch(final QueryException qe) { return clauseError(qe, iter.previousIndex() + 1); } } try { final Expr rt = ret.inline(ctx, scp, v, e); if(rt != null) { change = true; ret = rt; } } catch(final QueryException qe) { return clauseError(qe, clauses.size()); } return change; } /** * Tries to recover from a compile-time exception inside a FLWOR clause. * @param qe thrown exception * @param idx index of the throwing clause, size of {@link #clauses} for return clause * @return {@code true} if the GFLWOR expression has to stay * @throws QueryException query exception if the whole expression fails */ private boolean clauseError(final QueryException qe, final int idx) throws QueryException { final ListIterator iter = clauses.listIterator(idx); while(iter.hasPrevious()) { final Clause b4 = iter.previous(); if(b4 instanceof For || b4 instanceof Window || b4 instanceof Where) { iter.next(); while(iter.hasNext()) { iter.next(); iter.remove(); } ret = FNInfo.error(qe); return true; } } throw qe; } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final LinkedList cls = new LinkedList(); for(final Clause cl : clauses) cls.add(cl.copy(ctx, scp, vs)); return copyType(new GFLWOR(info, cls, ret.copy(ctx, scp, vs))); } /** * Checks if this FLWOR expression only used for, let and where clauses. * @return result of check */ private boolean isFLWR() { for(final Clause cl : clauses) if(!(cl instanceof For || cl instanceof Let || cl instanceof Where)) return false; return true; } @Override public boolean accept(final ASTVisitor visitor) { for(final Clause cl : clauses) if(!cl.accept(visitor)) return false; return ret.accept(visitor); } @Override public void plan(final FElem plan) { final FElem e = planElem(); for(final Clause cl : clauses) cl.plan(e); ret.plan(e); plan.add(e); } @Override public String toString() { final StringBuilder sb = new StringBuilder(); for(final Clause cl : clauses) sb.append(cl).append(' '); return sb.append(QueryText.RETURN).append(' ').append(ret).toString(); } @Override public void checkUp() throws QueryException { for(final Clause cl : clauses) cl.checkUp(); ret.checkUp(); } @Override public void markTailCalls() { long n = 1; for(final Clause c : clauses) if((n = c.calcSize(n)) != 1) return; ret.markTailCalls(); } @Override public int exprSize() { int sz = 1; for(final Clause cl : clauses) sz += cl.exprSize(); return ret.exprSize() + sz; } /** * Evaluator for FLWOR clauses. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ interface Eval { /** * Makes the next evaluation step if available. This method is guaranteed * to not be called again if it has once returned {@code false}. * @param ctx query context * @return {@code true} if step was made, {@code false} if no more * results exist * @throws QueryException evaluation exception */ boolean next(final QueryContext ctx) throws QueryException; } /** * A FLWOR clause. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public abstract static class Clause extends ParseExpr { /** All variables declared in this clause. */ final Var[] vars; /** * Constructor. * @param ii input info * @param vs declared variables */ protected Clause(final InputInfo ii, final Var... vs) { super(ii); vars = vs; } /** * Cleans unused variables from this clause. * @param ctx query context * @param used list of the IDs of all variables used in the following clauses * @param decl variables declared by this FLWOR expression * @return {@code true} if something changed, {@code false} otherwise */ @SuppressWarnings("unused") boolean clean(final QueryContext ctx, final IntObjMap decl, final BitArray used) { return false; } /** * Evaluates the clause. * @param sub wrapped evaluator * @return evaluator */ abstract Eval eval(final Eval sub); @Override public abstract Clause compile(QueryContext ctx, final VarScope scp) throws QueryException; @Override public abstract Clause optimize(final QueryContext ctx, final VarScope scp) throws QueryException; @Override public abstract Clause inline(QueryContext ctx, VarScope scp, Var v, Expr e) throws QueryException; @Deprecated @Override public Iter iter(final QueryContext ctx) throws QueryException { throw Util.notexpected(); } @Deprecated @Override public Value value(final QueryContext ctx) throws QueryException { throw Util.notexpected(); } @Deprecated @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { throw Util.notexpected(); } @Override public abstract GFLWOR.Clause copy(QueryContext ctx, VarScope scp, IntObjMap vs); /** * Checks if the given clause can be slided over this clause. * @param cl clause * @return result of check */ boolean skippable(final Clause cl) { return cl.accept(new ASTVisitor() { @Override public boolean used(final VarRef ref) { for(final Var v : vars) if(v.is(ref.var)) return false; return true; } }); } /** * All declared variables of this clause. * @return declared variables */ public final Var[] vars() { return vars; } /** * Checks if the given variable is declared by this clause. * @param v variable * @return {code true} if the variable was declared here, {@code false} otherwise */ public final boolean declares(final Var v) { for(final Var decl : vars) if(v.is(decl)) return true; return false; } /** * Calculates the number of results. * @param count number of incoming tuples, must be greater than zero * @return number of outgoing tuples if known, {@code -1} otherwise */ abstract long calcSize(long count); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/gflwor/GroupBy.java000066400000000000000000000272101222453003200261000ustar00rootroot00000000000000package org.basex.query.gflwor; import static org.basex.query.QueryText.*; import java.util.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.func.*; import org.basex.query.gflwor.GFLWOR.Eval; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.query.value.type.SeqType.Occ; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * The GFLWOR {@code group by} expression. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class GroupBy extends GFLWOR.Clause { /** Grouping specs. */ final Spec[] specs; /** Non-grouping variable expressions. */ Expr[] preExpr; /** Non-grouping variables. */ Var[] post; /** Number of non-occluded grouping variables. */ final int nonOcc; /** * Constructor. * @param gs grouping specs * @param pr references to pre-grouping variables * @param pst post-grouping variables * @param ii input info */ public GroupBy(final Spec[] gs, final VarRef[] pr, final Var[] pst, final InputInfo ii) { super(ii, vars(gs, pst)); specs = gs; preExpr = new Expr[pr.length]; System.arraycopy(pr, 0, preExpr, 0, pr.length); post = pst; int n = 0; for(final Spec spec : specs) if(!spec.occluded) n++; nonOcc = n; } /** * Copy constructor. * @param gs grouping specs * @param pe pre-grouping expressions * @param pst post-grouping variables * @param no number of non-occluded grouping variables * @param ii input info */ private GroupBy(final Spec[] gs, final Expr[] pe, final Var[] pst, final int no, final InputInfo ii) { super(ii, vars(gs, pst)); specs = gs; preExpr = pe; post = pst; nonOcc = no; } /** * Gathers all declared variables. * @param gs grouping specs * @param vs non-grouping variables * @return declared variables */ private static Var[] vars(final Spec[] gs, final Var[] vs) { final Var[] res = new Var[gs.length + vs.length]; for(int i = 0; i < gs.length; i++) res[i] = gs[i].var; System.arraycopy(vs, 0, res, gs.length, vs.length); return res; } @Override Eval eval(final Eval sub) { return new Eval() { /** Groups to iterate over. */ private Group[] groups; /** Current position. */ private int pos; @Override public boolean next(final QueryContext ctx) throws QueryException { if(groups == null) groups = init(ctx); if(pos == groups.length) return false; final Group curr = groups[pos]; // be nice to the garbage collector groups[pos++] = null; int p = 0; for(final Spec spec : specs) { if(!spec.occluded) { final Item key = curr.key[p++]; ctx.set(spec.var, key == null ? Empty.SEQ : key, info); } } for(int i = 0; i < post.length; i++) ctx.set(post[i], curr.ngv[i].value(), info); return true; } /** * Builds up the groups. * @param ctx query context * @throws QueryException query exception */ private Group[] init(final QueryContext ctx) throws QueryException { final ArrayList grps = new ArrayList(); final IntObjMap map = new IntObjMap(); final Collation[] colls = new Collation[nonOcc]; for(int i = 0, p = 0; i < specs.length; i++) if(!specs[i].occluded) colls[p++] = specs[i].coll; while(sub.next(ctx)) { final Item[] key = new Item[nonOcc]; int p = 0, hash = 1; for(final Spec spec : specs) { final Item ki = spec.item(ctx, info), atom = ki == null ? null : StandardFunc.atom(ki, info); if(!spec.occluded) { key[p++] = atom; // If the values are compared using a special collation, we let them collide // here and let the comparison do all the work later. // This enables other non-collation specs to avoid the collision. hash = 31 * hash + (atom == null || spec.coll != null ? 0 : atom.hash(info)); } ctx.set(spec.var, atom == null ? Empty.SEQ : atom, info); } // find the group for this key Group fst = null, grp = null; // no collations, so we can use hashing for(Group g = fst = map.get(hash); g != null; g = g.next) { if(eq(key, g.key, colls)) { grp = g; break; } } if(grp == null) { // new group, add it to the list final ValueBuilder[] ngs = new ValueBuilder[preExpr.length]; for(int i = 0; i < ngs.length; i++) ngs[i] = new ValueBuilder(); grp = new Group(key, ngs); grps.add(grp); // insert the group into the hash table if(fst == null) { map.put(hash, grp); } else { final Group nxt = fst.next; fst.next = grp; grp.next = nxt; } } // add values of non-grouping variables to the group for(int j = 0; j < preExpr.length; j++) grp.ngv[j].add(preExpr[j].value(ctx)); } // we're finished, copy the array so the list can be garbage-collected return grps.toArray(new Group[grps.size()]); } }; } /** * Checks two keys for equality. * @param as first key * @param bs second key * @param coll collations * @return {@code true} if the compare as equal, {@code false} otherwise * @throws QueryException query exception */ boolean eq(final Item[] as, final Item[] bs, final Collation[] coll) throws QueryException { for(int i = 0; i < as.length; i++) { final Item a = as[i], b = bs[i]; if(a == null ^ b == null || a != null && !a.equiv(b, coll[i], info)) return false; } return true; } @Override public void plan(final FElem plan) { final FElem e = planElem(); for(final Spec spec : specs) spec.plan(e); plan.add(e); } @Override public String toString() { final StringBuilder sb = new StringBuilder(GROUP).append(' ').append(BY); for(int i = 0; i < specs.length; i++) sb.append(i == 0 ? " " : SEP).append(specs[i]); return sb.toString(); } @Override public boolean has(final Flag flag) { for(final Spec sp : specs) if(sp.has(flag)) return true; return false; } @Override public GroupBy compile(final QueryContext cx, final VarScope sc) throws QueryException { for(final Expr e : preExpr) e.compile(cx, sc); for(final Spec b : specs) b.compile(cx, sc); return optimize(cx, sc); } @Override public GroupBy optimize(final QueryContext ctx, final VarScope scp) throws QueryException { for(int i = 0; i < preExpr.length; i++) { final SeqType it = preExpr[i].type(); post[i].refineType(it.withOcc(it.mayBeZero() ? Occ.ZERO_MORE : Occ.ONE_MORE), ctx, info); } return this; } @Override public boolean removable(final Var v) { for(final Spec b : specs) if(!b.removable(v)) return false; return true; } @Override public VarUsage count(final Var v) { return VarUsage.sum(v, specs).plus(VarUsage.sum(v, preExpr)); } @Override public GFLWOR.Clause inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { final boolean b = inlineAll(ctx, scp, specs, v, e), p = inlineAll(ctx, scp, preExpr, v, e); return b || p ? optimize(ctx, scp) : null; } @Override public GroupBy copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { // copy the pre-grouping expressions final Expr[] pEx = Arr.copyAll(ctx, scp, vs, preExpr); // create fresh copies of the post-grouping variables final Var[] ps = new Var[post.length]; for(int i = 0; i < ps.length; i++) { final Var old = post[i]; ps[i] = scp.newCopyOf(ctx, old); vs.put(old.id, ps[i]); } // done return new GroupBy(Arr.copyAll(ctx, scp, vs, specs), pEx, ps, nonOcc, info); } @Override public boolean accept(final ASTVisitor visitor) { if(!visitAll(visitor, specs)) return false; for(final Expr ng : preExpr) if(!ng.accept(visitor)) return false; for(final Var ng : post) if(!visitor.declared(ng)) return false; return true; } @Override boolean clean(final QueryContext ctx, final IntObjMap decl, final BitArray used) { // [LW] does not fix {@link #vars} final int len = preExpr.length; for(int i = 0; i < post.length; i++) { if(!used.get(post[i].id)) { preExpr = Array.delete(preExpr, i); post = Array.delete(post, i--); } } return preExpr.length < len; } @Override boolean skippable(final GFLWOR.Clause cl) { return false; } @Override public void checkUp() throws QueryException { checkNoneUp(preExpr); checkNoneUp(specs); } @Override long calcSize(final long cnt) { return -1; } @Override public int exprSize() { int sz = 0; for(final Expr e : preExpr) sz += e.exprSize(); for(final Expr e : specs) sz += e.exprSize(); return sz; } /** * Grouping spec. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public static final class Spec extends Single { /** Grouping variable. */ public final Var var; /** Occlusion flag, {@code true} if another grouping variable shadows this one. */ public boolean occluded; /** Collation. */ public final Collation coll; /** * Constructor. * * @param ii input info * @param v grouping variable * @param e grouping expression * @param cl collation */ public Spec(final InputInfo ii, final Var v, final Expr e, final Collation cl) { super(ii, e); var = v; coll = cl; } @Override public void plan(final FElem plan) { final FElem e = planElem(); var.plan(e); expr.plan(e); plan.add(e); } @Override public String toString() { final StringBuilder sb = new StringBuilder().append(var).append(' ').append(ASSIGN); sb.append(' ').append(expr); if(coll != null) sb.append(' ').append(COLLATION).append(" \""). append(coll.uri()).append('"'); return sb.toString(); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { return expr.item(ctx, ii); } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final Var v = scp.newCopyOf(ctx, var); vs.put(var.id, v); final Spec spec = new Spec(info, v, expr.copy(ctx, scp, vs), coll); spec.occluded = occluded; return spec; } @Override public boolean accept(final ASTVisitor visitor) { return expr.accept(visitor) && visitor.declared(var); } @Override public int exprSize() { return expr.exprSize(); } } /** * A group of tuples of post-grouping variables. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ private static final class Group { /** Grouping key, may contain {@code null} values. */ final Item[] key; /** Non-grouping variables. */ final ValueBuilder[] ngv; /** Overflow list. */ Group next; /** * Constructor. * @param k grouping key * @param ng non-grouping variables */ Group(final Item[] k, final ValueBuilder[] ng) { key = k; ngv = ng; } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/gflwor/Let.java000066400000000000000000000125721222453003200252420ustar00rootroot00000000000000package org.basex.query.gflwor; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.func.*; import org.basex.query.gflwor.GFLWOR.Eval; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.ft.*; import org.basex.util.hash.*; /** * FLWOR {@code let} clause, binding an expression to a variable. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class Let extends GFLWOR.Clause { /** Variable. */ public final Var var; /** Bound expression. */ public Expr expr; /** Score flag. */ final boolean score; /** * Constructor. * @param v variable * @param e expression * @param scr score flag * @param ii input info */ public Let(final Var v, final Expr e, final boolean scr, final InputInfo ii) { super(ii, v); var = v; expr = e; score = scr; } /** * Creates a let expression from a for loop over a single item. * @param fr for loop * @return let binding */ static Let fromFor(final For fr) { final Let lt = new Let(fr.var, fr.expr, false, fr.info); lt.type = fr.expr.type(); return lt; } /** * Creates a let binding for the score variable of a for clause. * @param fr for clause * @return let binding for the score variable */ static Let fromForScore(final For fr) { final Expr varRef = new VarRef(fr.info, fr.var); return new Let(fr.score, varRef, true, fr.info); } @Override Eval eval(final Eval sub) { return new Eval() { @Override public boolean next(final QueryContext ctx) throws QueryException { if(!sub.next(ctx)) return false; ctx.set(var, score ? score(expr.iter(ctx)) : ctx.value(expr), info); return true; } }; } /** * Calculates the score of the given iterator. * @param iter iterator * @return score * @throws QueryException evaluation exception */ static Dbl score(final Iter iter) throws QueryException { double sum = 0; int sz = 0; for(Item it; (it = iter.next()) != null; sum += it.score(), sz++); return Dbl.get(Scoring.let(sum, sz)); } @Override public void plan(final FElem plan) { final FElem e = planElem(); if(score) e.add(planAttr(Token.token(SCORE), Token.TRUE)); var.plan(e); expr.plan(e); plan.add(e); } @Override public String toString() { return LET + ' ' + (score ? SCORE + ' ' : "") + var + ' ' + ASSIGN + ' ' + expr; } @Override public boolean has(final Flag flag) { return expr.has(flag); } @Override public Let compile(final QueryContext ctx, final VarScope scp) throws QueryException { expr = expr.compile(ctx, scp); return optimize(ctx, scp); } @Override public Let optimize(final QueryContext ctx, final VarScope scp) throws QueryException { if(!score && expr instanceof TypeCheck) { final TypeCheck tc = (TypeCheck) expr; if(tc.isRedundant(var) || var.adoptCheck(tc.type, tc.promote)) { ctx.compInfo(QueryText.OPTCAST, tc.type); expr = tc.expr; } } type = score ? SeqType.DBL : expr.type(); var.refineType(type, ctx, info); if(var.checksType() && expr.isValue()) { expr = var.checkType((Value) expr, ctx, info); var.refineType(expr.type(), ctx, info); } size = score ? 1 : expr.size(); return this; } /** * Binds the the value of this let clause to the context if it is statically known. * @param ctx query context * @throws QueryException evaluation exception */ void bindConst(final QueryContext ctx) throws QueryException { if(expr.isValue()) { ctx.compInfo(QueryText.OPTBIND, var); ctx.set(var, score ? score(expr.iter(ctx)) : (Value) expr, info); } } @Override public boolean removable(final Var v) { return expr.removable(v); } @Override public VarUsage count(final Var v) { return expr.count(v); } @Override public GFLWOR.Clause inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { final Expr sub = expr.inline(ctx, scp, v, e); if(sub == null) return null; expr = sub; return optimize(ctx, scp); } @Override public Let copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final Var v = scp.newCopyOf(ctx, var); vs.put(var.id, v); return new Let(v, expr.copy(ctx, scp, vs), score, info); } @Override public boolean accept(final ASTVisitor visitor) { return expr.accept(visitor) && visitor.declared(var); } @Override public void checkUp() throws QueryException { checkNoUp(expr); } @Override long calcSize(final long cnt) { return cnt; } /** * Returns an expression that is appropriate for inlining. * @param ctx query context * @param scp variable scope * @return inlineable expression * @throws QueryException query exception */ public Expr inlineExpr(final QueryContext ctx, final VarScope scp) throws QueryException { return score ? Function._FT_SCORE.get(expr).optimize(ctx, scp) : var.checked(expr, ctx, scp, info); } @Override public int exprSize() { return expr.exprSize(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/gflwor/OrderBy.java000066400000000000000000000202021222453003200260510ustar00rootroot00000000000000package org.basex.query.gflwor; import static org.basex.query.QueryText.*; import java.util.*; import java.util.List; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.gflwor.GFLWOR.Eval; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * FLWOR {@code order by}-expression. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class OrderBy extends GFLWOR.Clause { /** References to the variables to be sorted. */ VarRef[] refs; /** Sort keys. */ final Key[] keys; /** * Constructor. * @param vs variables to sort * @param ks sort keys * @param ii input info */ public OrderBy(final VarRef[] vs, final Key[] ks, final InputInfo ii) { super(ii); refs = vs; keys = ks; } @Override Eval eval(final Eval sub) { return new Eval() { /** Sorted output tuples. */ private Value[][] tpls; /** Permutation of the values. */ private Integer[] perm; /** Current position. */ int pos; @Override public boolean next(final QueryContext ctx) throws QueryException { if(tpls == null) sort(ctx); if(pos == tpls.length) return false; final int p = perm[pos++]; final Value[] tuple = tpls[p]; // free the space occupied by the tuple tpls[p] = null; for(int i = 0; i < refs.length; i++) ctx.set(refs[i].var, tuple[i], info); return true; } /** * Caches and sorts all incoming tuples. * @param ctx query context * @throws QueryException evaluation exception */ private void sort(final QueryContext ctx) throws QueryException { // keys are stored at odd positions, values at even ones List tuples = new ArrayList(); while(sub.next(ctx)) { final Item[] key = new Item[keys.length]; for(int i = 0; i < keys.length; i++) key[i] = keys[i].expr.item(ctx, keys[i].info); tuples.add(key); final Value[] vals = new Value[refs.length]; for(int i = 0; i < refs.length; i++) vals[i] = refs[i].value(ctx); tuples.add(vals); } final int len = tuples.size() >>> 1; final Item[][] ks = new Item[len][]; perm = new Integer[len]; tpls = new Value[len][]; for(int i = 0; i < len; i++) { perm[i] = i; tpls[i] = tuples.get(i << 1 | 1); ks[i] = (Item[]) tuples.get(i << 1); } // be nice to the garbage collector tuples = null; try { Arrays.sort(perm, new Comparator() { @Override public int compare(final Integer x, final Integer y) { try { final Item[] a = ks[x], b = ks[y]; for(int k = 0; k < keys.length; k++) { final Key or = keys[k]; Item m = a[k], n = b[k]; if(m == Dbl.NAN || m == Flt.NAN) m = null; if(n == Dbl.NAN || n == Flt.NAN) n = null; if(m != null && n != null && !m.comparable(n)) Err.cast(or.info, m.type, n); final int c = m == null ? n == null ? 0 : or.least ? -1 : 1 : n == null ? or.least ? 1 : -1 : m.diff(n, or.coll, or.info); if(c != 0) return or.desc ? -c : c; } return 0; } catch(final QueryException ex) { throw new QueryRTException(ex); } } }); } catch(final QueryRTException ex) { throw ex.getCause(); } } }; } @Override public void plan(final FElem plan) { final FElem e = planElem(); for(final Key k : keys) k.plan(e); plan.add(e); } @Override public String toString() { final StringBuilder sb = new StringBuilder(ORDER).append(' ').append(BY); for(int i = 0; i < keys.length; i++) sb.append(i == 0 ? " " : SEP).append(keys[i]); return sb.toString(); } @Override public boolean has(final Flag flag) { for(final Key k : keys) if(k.has(flag)) return true; return false; } @Override public OrderBy compile(final QueryContext cx, final VarScope sc) throws QueryException { for(final Key k : keys) k.compile(cx, sc); return this; } @Override public OrderBy optimize(final QueryContext ctx, final VarScope scp) throws QueryException { return this; } @Override public boolean removable(final Var v) { for(final Key k : keys) if(!k.removable(v)) return false; return true; } @Override public VarUsage count(final Var v) { return VarUsage.sum(v, keys); } @Override public GFLWOR.Clause inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { for(int i = refs.length; --i >= 0;) if(v.is(refs[i].var)) refs = Array.delete(refs, i); return inlineAll(ctx, scp, keys, v, e) ? optimize(ctx, scp) : null; } @Override public OrderBy copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new OrderBy(Arr.copyAll(ctx, scp, vs, refs), Arr.copyAll(ctx, scp, vs, keys), info); } @Override public boolean accept(final ASTVisitor visitor) { return visitAll(visitor, keys); } @Override boolean clean(final QueryContext ctx, final IntObjMap decl, final BitArray used) { // delete unused variables final int len = refs.length; for(int i = refs.length; --i >= 0;) if(!used.get(refs[i].var.id)) refs = Array.delete(refs, i); if(refs.length == used.cardinality()) return refs.length != len; // add new variables, possible when an expression is inlined below this clause outer: for(int id = used.nextSet(0); id >= 0; id = used.nextSet(id + 1)) { for(final VarRef ref : refs) if(ref.var.id == id) continue outer; refs = Array.add(refs, new VarRef(info, decl.get(id))); } return true; } @Override boolean skippable(final GFLWOR.Clause cl) { return cl instanceof Where; } @Override public void checkUp() throws QueryException { checkNoneUp(keys); } @Override long calcSize(final long cnt) { return cnt; } @Override public int exprSize() { int sz = 0; for(final Expr e : refs) sz += e.exprSize(); for(final Expr e : keys) sz += e.exprSize(); return sz; } /** * Sort key. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public static final class Key extends Single { /** Descending order flag. */ final boolean desc; /** Position of empty sort keys. */ final boolean least; /** Collation. */ final Collation coll; /** * Constructor. * @param ii input info * @param k sort key expression * @param dsc descending order * @param lst empty least * @param cl collation */ public Key(final InputInfo ii, final Expr k, final boolean dsc, final boolean lst, final Collation cl) { super(ii, k); desc = dsc; least = lst; coll = cl; } @Override public Key copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new Key(info, expr.copy(ctx, scp, vs), desc, least, coll); } @Override public void plan(final FElem plan) { final FElem e = planElem(DIR, Token.token(desc ? DESCENDING : ASCENDING), Token.token(EMPTYORD), Token.token(least ? LEAST : GREATEST)); expr.plan(e); plan.add(e); } @Override public String toString() { final StringBuilder sb = new StringBuilder(expr.toString()); if(desc) sb.append(' ').append(DESCENDING); sb.append(' ').append(EMPTYORD).append(' ').append(least ? LEAST : GREATEST); if(coll != null) sb.append(' ').append(COLLATION).append(" \""). append(coll.uri()).append('"'); return sb.toString(); } @Override public int exprSize() { return expr.exprSize(); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/gflwor/Where.java000066400000000000000000000052431222453003200255650ustar00rootroot00000000000000package org.basex.query.gflwor; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.gflwor.GFLWOR.Eval; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * GFLWOR {@code where} clause, filtering tuples not satisfying the predicate. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class Where extends GFLWOR.Clause { /** Predicate expression. */ Expr pred; /** * Constructor. * @param ii input info * @param e predicate expression */ public Where(final Expr e, final InputInfo ii) { super(ii); pred = e; } @Override Eval eval(final Eval sub) { return new Eval() { @Override public boolean next(final QueryContext ctx) throws QueryException { while(sub.next(ctx)) if(pred.ebv(ctx, info).bool(info)) return true; return false; } }; } @Override public void plan(final FElem plan) { final FElem e = planElem(); pred.plan(e); plan.add(e); } @Override public String toString() { return QueryText.WHERE + ' ' + pred; } @Override public boolean has(final Flag flag) { return pred.has(flag); } @Override public Where compile(final QueryContext ctx, final VarScope scp) throws QueryException { pred = pred.compile(ctx, scp).compEbv(ctx); return optimize(ctx, scp); } @Override public Where optimize(final QueryContext cx, final VarScope sc) throws QueryException { if(pred.isValue()) pred = pred.ebv(cx, info); return this; } @Override public boolean removable(final Var v) { return pred.removable(v); } @Override public VarUsage count(final Var v) { return pred.count(v); } @Override public GFLWOR.Clause inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { final Expr sub = pred.inline(ctx, scp, v, e); if(sub == null) return null; pred = sub; return optimize(ctx, scp); } @Override public Where copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new Where(pred.copy(ctx, scp, vs), info); } @Override public boolean accept(final ASTVisitor visitor) { return pred.accept(visitor); } @Override boolean skippable(final GFLWOR.Clause cl) { return true; } @Override public void checkUp() throws QueryException { checkNoUp(pred); } @Override long calcSize(final long cnt) { return pred == Bln.FALSE ? 0 : -1; } @Override public int exprSize() { return pred.exprSize(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/gflwor/Window.java000066400000000000000000000464401222453003200257660ustar00rootroot00000000000000package org.basex.query.gflwor; import static org.basex.query.QueryText.*; import static org.basex.util.Token.*; import java.util.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.gflwor.GFLWOR.Clause; import org.basex.query.gflwor.GFLWOR.Eval; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.query.value.type.SeqType.Occ; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * the GFLWOR {@code window} clause. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class Window extends GFLWOR.Clause { /** {@code sliding window} flag. */ final boolean sliding; /** The window variable. */ final Var var; /** The sequence. */ Expr expr; /** The start condition. */ Condition start; /** the {@code only} flag. */ final boolean only; /** The end condition, possibly {@code null}. */ Condition end; /** * Constructor. * @param ii input info * @param slide {@code sliding window} flag * @param v window variable * @param in sequence * @param st start condition * @param o {@code only} flag * @param nd end condition * @throws QueryException query exception */ public Window(final InputInfo ii, final boolean slide, final Var v, final Expr in, final Condition st, final boolean o, final Condition nd) throws QueryException { super(ii, vars(v, st, nd, ii)); sliding = slide; var = v; expr = in; start = st; only = o; end = nd; } /** * Gathers all non-{@code null} variables. * @param vr window variable * @param st start condition * @param nd end condition, might be {@code null} * @param ii input info for the error message * @return non-{@code null} variables * @throws QueryException query exception if the variable names aren't unique */ private static Var[] vars(final Var vr, final Condition st, final Condition nd, final InputInfo ii) throws QueryException { // determine the size of the array beforehand final int stn = st.nVars(); final Var[] vs = new Var[1 + stn + (nd == null ? 0 : nd.nVars())]; // write variables to the array st.writeVars(vs, 0); if(nd != null) nd.writeVars(vs, stn); vs[vs.length - 1] = vr; // check for duplicates for(int i = 0; i < vs.length; i++) { final Var v = vs[i]; for(int j = i; --j >= 0;) if(v.name.eq(vs[j].name)) throw Err.WINDOWUNIQ.thrw(ii, vs[j]); } return vs; } @Override Eval eval(final Eval sub) { return sliding ? slidingEval(sub) : end == null ? tumblingEval(sub) : tumblingEndEval(sub); } /** * Evaluator for tumbling windows. * @param sub wrapped evaluator * @return evaluator for tumbling windows */ private Eval tumblingEval(final Eval sub) { return new TumblingEval() { /** Values for the current start item. */ private Item[] vals; /** Position of the start item. */ private long spos; @Override public boolean next(final QueryContext ctx) throws QueryException { while(true) { // find first item final Item fst = vals != null ? vals[0] : findStart(ctx) ? curr : null; // find end item if(fst != null) { final ValueBuilder window = new ValueBuilder( new Item[] {fst, null, null, null}, 1); final Item[] st = vals == null ? new Item[] { curr, prev, next } : vals; final long ps = vals == null ? p : spos; vals = null; while(readNext()) { if(start.matches(ctx, curr, p, prev, next)) { vals = new Item[]{ curr, prev, next }; spos = p; break; } window.add(curr); } start.bind(ctx, st[0], ps, st[1], st[2]); ctx.set(var, window.value(), info); return true; } // no more iterations from above, we're done here if(!prepareNext(ctx, sub)) return false; vals = null; } } }; } /** * Evaluator for tumbling windows with an {@code end} condition. * @param sub wrapped evaluator * @return evaluator for tumbling windows */ private Eval tumblingEndEval(final Eval sub) { return new TumblingEval() { @Override public boolean next(final QueryContext ctx) throws QueryException { while(true) { if(findStart(ctx)) { // find end item final ValueBuilder window = new ValueBuilder(); boolean found = false; do { window.add(curr); if(end.matches(ctx, curr, p, prev, next)) { found = true; break; } } while(readNext()); // don't return dangling items if the {@code only} flag was specified if(found || !only) { ctx.set(var, window.value(), info); return true; } } // no more iterations from above, we're done here if(!prepareNext(ctx, sub)) return false; } } }; } /** * Evaluator for sliding windows. * @param sub wrapped evaluator * @return evaluator for tumbling windows */ private Eval slidingEval(final Eval sub) { return new WindowEval() { /** Queue holding the items of the current window. */ private final ArrayDeque queue = new ArrayDeque(); @Override public boolean next(final QueryContext ctx) throws QueryException { while(true) { Item curr, next = null; while((curr = advance()) != null) { next = queue.peekFirst(); if(next == null && (next = next()) != null) queue.addLast(next); if(start.matches(ctx, curr, p, prev, next)) break; prev = curr; } if(curr != null) { final ValueBuilder cache = new ValueBuilder(); final Iterator qiter = queue.iterator(); // the first element is already the {@code next} one if(qiter.hasNext()) qiter.next(); Item pr = prev, it = curr, nx = next; long ps = p; do { cache.add(it); if(end.matches(ctx, it, ps++, pr, nx)) break; pr = it; it = nx; if(qiter.hasNext()) { nx = qiter.next(); } else { nx = next(); if(nx != null) queue.addLast(nx); } } while(it != null); // return window if end was found or {@code only} isn't set if(!(it == null && only)) { start.bind(ctx, curr, p, prev, next); prev = curr; ctx.set(var, cache.value(), info); return true; } } // abort if no more tuples from above if(!prepareNext(ctx, sub)) return false; queue.clear(); } } /** * tries to advance the start of the queue by one element and returns the removed * element in case of success, {@code null} otherwise. * @return removed element or {@code null} * @throws QueryException evaluation exception */ private Item advance() throws QueryException { Item it = queue.pollFirst(); if(it == null) it = next(); if(it != null) p++; return it; } }; } @Override public Clause compile(final QueryContext cx, final VarScope scp) throws QueryException { expr = expr.compile(cx, scp); start.compile(cx, scp); if(end != null) end.compile(cx, scp); return optimize(cx, scp); } @Override public Clause optimize(final QueryContext cx, final VarScope sc) throws QueryException { final SeqType t = expr.type(); var.refineType(t.withOcc(Occ.ZERO_MORE), cx, info); return this; } @Override public boolean has(final Flag flag) { return expr.has(flag) || start.has(flag) || end != null && end.has(flag); } @Override public boolean removable(final Var v) { return expr.removable(v) && start.removable(v) && (end == null || end.removable(v)); } @Override public VarUsage count(final Var v) { final VarUsage us = end == null ? start.count(v) : start.count(v).plus(end.count(v)); return us != VarUsage.NEVER ? VarUsage.MORE_THAN_ONCE : expr.count(v); } @Override public GFLWOR.Clause inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { final Expr ex = expr.inline(ctx, scp, v, e); final Condition st = start.inline(ctx, scp, v, e), en = end == null ? null : end.inline(ctx, scp, v, e); if(ex != null) expr = ex; if(st != null) start = st; if(en != null) end = en; return ex != null || st != null || en != null ? optimize(ctx, scp) : null; } @Override public Window copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final Var v = scp.newCopyOf(ctx, var); vs.put(var.id, v); try { return new Window(info, sliding, v, expr.copy(ctx, scp, vs), start.copy(ctx, scp, vs), only, end != null ? end.copy(ctx, scp, vs) : null); } catch(final QueryException e) { // checks have already been done throw Util.notexpected(e); } } @Override public boolean accept(final ASTVisitor visitor) { return expr.accept(visitor) && start.accept(visitor) && (end == null || end.accept(visitor)) && visitor.declared(var); } @Override public void plan(final FElem plan) { final FElem e = planElem(token(SLIDING), token(sliding)); var.plan(e); expr.plan(e); start.plan(e); if(end != null) end.plan(e); plan.add(e); } @Override public String toString() { final StringBuilder sb = new StringBuilder(FOR).append(' ').append( sliding ? SLIDING : TUMBLING).append(' ').append(WINDOW).append(' ').append(var ).append(' ').append(IN).append(' ').append(expr).append(' ').append(start); if(end != null) { if(only) sb.append(' ').append(ONLY); sb.append(' ').append(end); } return sb.toString(); } @Override public void checkUp() throws QueryException { checkNoneUp(expr, start, end); } @Override long calcSize(final long cnt) { return expr.size() == 0 ? 0 : -1; } @Override public int exprSize() { return expr.exprSize() + start.exprSize() + (end == null ? 0 : end.exprSize()); } /** * A window {@code start} of {@code end} condition. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public static final class Condition extends Single { /** Start condition flag. */ private final boolean start; /** Item variable. */ private final Var item; /** Position variable. */ private final Var pos; /** Previous item. */ private final Var prev; /** Next item. */ private final Var next; /** * Constructor. * @param st start condition flag * @param it item variable * @param p position variable * @param pr previous variable * @param nx next variable * @param cond condition expression * @param ii input info */ public Condition(final boolean st, final Var it, final Var p, final Var pr, final Var nx, final Expr cond, final InputInfo ii) { super(ii, cond); start = st; item = it; pos = p; prev = pr; next = nx; } @Override public Expr compile(final QueryContext cx, final VarScope scp) throws QueryException { expr = expr.compile(cx, scp).compEbv(cx); return this; } @Override public Condition optimize(final QueryContext ctx, final VarScope scp) throws QueryException { return this; } @Override public Condition inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { return (Condition) super.inline(ctx, scp, v, e); } @Override public Condition copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final Var it = item == null ? null : scp.newCopyOf(ctx, item), ps = pos == null ? null : scp.newCopyOf(ctx, pos), pr = prev == null ? null : scp.newCopyOf(ctx, prev), nx = next == null ? null : scp.newCopyOf(ctx, next); if(it != null) vs.put(item.id, it); if(ps != null) vs.put(pos.id, ps); if(pr != null) vs.put(prev.id, pr); if(nx != null) vs.put(next.id, nx); return new Condition(start, it, ps, pr, nx, expr.copy(ctx, scp, vs), info); } /** * Number of non-{@code null} variables in this condition. * @return number of variables */ int nVars() { int i = 0; if(item != null) i++; if(pos != null) i++; if(prev != null) i++; if(next != null) i++; return i; } /** * Checks if this condition binds the item following the current one in the input. * @return result of check */ boolean usesNext() { return next != null; } /** * Write all non-{@code null} variables in this condition to the given array. * @param arr array to write to * @param p start position * @return the array for convenience */ Var[] writeVars(final Var[] arr, final int p) { int i = p; if(item != null) arr[i++] = item; if(pos != null) arr[i++] = pos; if(prev != null) arr[i++] = prev; if(next != null) arr[i++] = next; return arr; } /** * Binds the variables and checks if the item satisfies this condition. * @param ctx query context for variable binding * @param it current item * @param p position in the input sequence * @param pr previous item * @param nx next item * @return {@code true} if {@code it} matches the condition, {@code false} otherwise * @throws QueryException query exception */ boolean matches(final QueryContext ctx, final Item it, final long p, final Item pr, final Item nx) throws QueryException { // bind variables bind(ctx, it, p, pr, nx); // evaluate as effective boolean value return expr.ebv(ctx, info).bool(info); } /** * Binds this condition's variables to the given values. * @param ctx query context * @param it current item * @param p position * @param pr previous item * @param nx next item * @throws QueryException query exception */ void bind(final QueryContext ctx, final Item it, final long p, final Item pr, final Item nx) throws QueryException { if(item != null) ctx.set(item, it == null ? Empty.SEQ : it, info); if(pos != null) ctx.set(pos, Int.get(p), info); if(prev != null) ctx.set(prev, pr == null ? Empty.SEQ : pr, info); if(next != null) ctx.set(next, nx == null ? Empty.SEQ : nx, info); } @Override public String toString() { final StringBuilder sb = new StringBuilder(start ? START : END); if(item != null) sb.append(' ').append(item); if(pos != null) sb.append(' ').append(AT).append(' ').append(pos); if(prev != null) sb.append(' ').append(PREVIOUS).append(' ').append(prev); if(next != null) sb.append(' ').append(NEXT).append(' ').append(next); return sb.append(' ').append(WHEN).append(' ').append(expr).toString(); } @Override public void plan(final FElem plan) { final FElem e = new FElem(start ? START : END); // mapping variable names to roles if(item != null) e.add(planAttr(VAR, token(item.toString()))); if(pos != null) e.add(planAttr(token(AT), token(pos.toString()))); if(prev != null) e.add(planAttr(token(PREVIOUS), token(prev.toString()))); if(next != null) e.add(planAttr(token(NEXT), token(next.toString()))); // IDs and stack slots if(item != null) item.plan(e); if(pos != null) pos.plan(e); if(prev != null) prev.plan(e); if(next != null) next.plan(e); expr.plan(e); plan.add(e); } @Override public boolean accept(final ASTVisitor visitor) { return (item == null || visitor.declared(item)) && (pos == null || visitor.declared(pos)) && (prev == null || visitor.declared(prev)) && (next == null || visitor.declared(next)) && expr.accept(visitor); } @Override public int exprSize() { return expr.exprSize(); } } /** * Evaluator for the Window clause. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ abstract class WindowEval implements Eval { /** Expression iterator. */ Iter iter; /** Previous item. */ Item prev; /** Current position. */ long p; /** * Reads the next item from {@code iter} if it isn't {@code null} and sets it to * {@code null} if it's drained. * @return success flag * @throws QueryException evaluation exception */ final Item next() throws QueryException { if(iter == null) return null; final Item it = iter.next(); if(it == null) iter = null; return it; } /** * Tries to prepare the next round. * @param ctx query context * @param sub sub-evaluator * @return {@code true} if the next round could be prepared, {@code false} otherwise * @throws QueryException evaluation exception */ boolean prepareNext(final QueryContext ctx, final Eval sub) throws QueryException { if(!sub.next(ctx)) return false; iter = expr.iter(ctx); prev = null; p = 0; return true; } } /** * Evaluator for the Tumbling Window clause. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ abstract class TumblingEval extends WindowEval { /** Current item. */ Item curr; /** Next item. */ Item next; /** If the next item is used. */ final boolean popNext = start.usesNext() || end != null && end.usesNext(); /** * Reads a new current item and populates the {@code nxt} variable if it's used. * @return next item * @throws QueryException evaluation exception */ final boolean readNext() throws QueryException { prev = curr; p++; final Item n = next(); // serve the stored item if available if(next != null) { curr = next; next = n; } else if(n != null && popNext) { // only assign if necessary next = next(); curr = n; } else { curr = n; } return curr != null; } /** * Finds the next item in the sequence satisfying the start condition. * @param ctx query context * @return {@code true} if the current binding satisfies the start condition, * {@code false} otherwise * @throws QueryException evaluation exception */ final boolean findStart(final QueryContext ctx) throws QueryException { while(readNext()) if(start.matches(ctx, curr, p, prev, next)) return true; return false; } @Override boolean prepareNext(final QueryContext ctx, final Eval sub) throws QueryException { if(!super.prepareNext(ctx, sub)) return false; curr = null; next = null; return true; } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/iter/000077500000000000000000000000001222453003200233075ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/iter/AxisIter.java000066400000000000000000000024041222453003200257020ustar00rootroot00000000000000package org.basex.query.iter; import java.util.*; import org.basex.query.value.node.*; import org.basex.util.*; /** * Interface for light-weight axis iterators, throwing no exceptions. * * This class also implements the {@link Iterable} interface, which is why all of its * values can also be retrieved via enhanced for (for-each) loops. Note, however, that * using the {@link #next()} method will give you better performance. * * Important: to improve performance, this iterator may return the same node * instance with updated values. If resulting nodes are to be further processed, * they need to be finalized via {@link ANode#finish()}. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class AxisIter extends NodeIter implements Iterable { @Override public abstract ANode next(); @Override public final Iterator iterator() { return new Iterator() { /** Current node. */ private ANode n; @Override public boolean hasNext() { n = AxisIter.this.next(); return n != null; } @Override public ANode next() { return n; } @Override public void remove() { Util.notexpected(); } }; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/iter/AxisMoreIter.java000066400000000000000000000016761222453003200265370ustar00rootroot00000000000000package org.basex.query.iter; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; /** * Iterator interface, extending the default iterator with a {@link #more} * method. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class AxisMoreIter extends AxisIter { /** Empty iterator. */ public static final AxisMoreIter EMPTY = new AxisMoreIter() { @Override public boolean more() { return false; } @Override public ANode next() { return null; } @Override public Item get(final long i) { return null; } @Override public long size() { return 0; } @Override public boolean reset() { return true; } @Override public Value value() { return Empty.SEQ; } }; /** * Checks if more nodes are found. * @return temporary node */ public abstract boolean more(); } basex-7.7.2/basex-core/src/main/java/org/basex/query/iter/FTIter.java000066400000000000000000000005131222453003200253060ustar00rootroot00000000000000package org.basex.query.iter; import org.basex.query.*; import org.basex.query.value.node.*; /** * Node iterator interface. * * @author BaseX Team 2005-12, BSD License * @author Sebastian Gath */ public abstract class FTIter extends Iter { @Override public abstract FTNode next() throws QueryException; } basex-7.7.2/basex-core/src/main/java/org/basex/query/iter/Iter.java000066400000000000000000000050061222453003200250560ustar00rootroot00000000000000package org.basex.query.iter; import org.basex.query.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.seq.*; import org.basex.util.*; /** * Iterator interface. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class Iter { /** * Returns the next item or {@code null} if no other items are found. * @return resulting item or {@code null} * @throws QueryException query exception */ public abstract Item next() throws QueryException; /** * Returns the specified item, or an arbitrary item if the index is invalid. * This method needs to be implemented - and should only be called - if * {@link Iter#size()} returns the correct number of results. A calling method * should call {@link #reset} after the last items has been retrieved. * @param i value offset * @return specified item * @throws QueryException query exception */ @SuppressWarnings("unused") public Item get(final long i) throws QueryException { return null; } /** * Returns the iterator size. Note: {@code -1} is returned if the * result size is unknown. If this method is implemented by an iterator, * {@link #get} needs to be implemented as well. * @return number of entries */ public long size() { return -1; } /** * Resets the iterator and returns {@code true} if operation was successful. * {@code false} is returned if the iterator cannot be reset. * @return true if operator could be reset */ public boolean reset() { return false; } /** * Returns a sequence with all iterator values. * Must only be called if {@link #next} has not been called before. * @return sequence * @throws QueryException query exception */ public Value value() throws QueryException { // check if sequence is empty Item i = next(); if(i == null) return Empty.SEQ; // if possible, allocate array with final size, and add all single items Item[] item = new Item[Math.max(1, (int) size())]; int s = 0; do { if(s == item.length) item = extend(item); item[s++] = i; } while((i = next()) != null); // create final value return Seq.get(item, s); } /** * Doubles the size of an item array. * @param it item array * @return resulting array */ static Item[] extend(final Item[] it) { return Array.copy(it, new Item[Array.newSize(it.length)]); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/iter/NodeIter.java000066400000000000000000000005151222453003200256640ustar00rootroot00000000000000package org.basex.query.iter; import org.basex.query.*; import org.basex.query.value.node.*; /** * Node iterator interface. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class NodeIter extends Iter { @Override public abstract ANode next() throws QueryException; } basex-7.7.2/basex-core/src/main/java/org/basex/query/iter/NodeSeqBuilder.java000066400000000000000000000172321222453003200270240ustar00rootroot00000000000000package org.basex.query.iter; import java.util.*; import org.basex.data.*; import org.basex.query.value.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * This class can be used to build new node sequences. * At the same time, it serves as an iterator. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class NodeSeqBuilder extends AxisIter { /** Node container. */ public ANode[] nodes; /** Number of nodes. */ private int size; /** Current iterator position. */ private int pos = -1; /** Sort flag. */ private boolean sort; /** Check incoming nodes for potential duplicates and unsorted entries. */ private boolean check; /** * Constructor. */ public NodeSeqBuilder() { nodes = new ANode[1]; } /** * Lightweight constructor, assigning the specified array of sorted nodes. * @param it node array * @param s size */ public NodeSeqBuilder(final ANode[] it, final int s) { nodes = it; size = s; } /** * Checks all nodes for potential duplicates and their orderedness. * @return self reference */ public NodeSeqBuilder check() { check = true; return this; } /** * Returns the specified node. * @param i node offset * @return node */ public ANode get(final int i) { return nodes[i]; } /** * Deletes a value at the specified position. * @param p deletion position */ public void delete(final int p) { Array.move(nodes, p + 1, -1, --size - p); } /** * Adds a node. * @param n node to be added */ public void add(final ANode n) { if(size == nodes.length) nodes = Array.copy(nodes, new ANode[Array.newSize(size)]); if(check && !sort && size != 0) sort = nodes[size - 1].diff(n) > 0; nodes[size++] = n; } @Override public boolean reset() { pos = -1; return true; } @Override public ANode next() { if(check) sort(sort); return ++pos < size ? nodes[pos] : null; } @Override public ANode get(final long i) { return i < size ? nodes[(int) i] : null; } @Override public long size() { return size; } /** * Sets a new item size. * @param s size */ public void size(final int s) { size = s; } @Override public Value value() { if(check) sort(sort); return Seq.get(nodes, size, NodeType.NOD); } /** * Checks if binary search can be applied to this iterator, i.e. * if all nodes are {@link DBNode} references and refer to the same database. * @return result of check */ public boolean dbnodes() { if(check) sort(sort); final Data data = size > 0 ? nodes[0].data() : null; if(data == null) return false; for(int s = 1; s < size; ++s) if(data != nodes[s].data()) return false; return true; } /** * Checks if the iterator contains a database node with the specified pre value. * @param n node to be found * @param db indicates if all nodes are sorted {@link DBNode} references * @return position, or {@code -1} */ public int indexOf(final ANode n, final boolean db) { if(db) return n instanceof DBNode ? Math.max(binarySearch((DBNode) n, 0, size), -1) : -1; for(int s = 0; s < size(); ++s) if(nodes[s].is(n)) return s; return -1; } /** * Performs a binary search on the given range of this sequence iterator, * assuming that all nodes are {@link DBNode}s from the same {@link Data} * instance (i.e., {@link #dbnodes()} returns {@code true}). * @param n node to find * @param start start of the search interval * @param length length of the search interval * @return position of the item or {@code -insertPosition - 1} if not found */ public int binarySearch(final DBNode n, final int start, final int length) { if(size == 0 || n.data != nodes[0].data()) return -start - 1; int l = start, r = start + length - 1; while(l <= r) { final int m = l + r >>> 1; final int npre = ((DBNode) nodes[m]).pre; if(npre == n.pre) return m; if(npre < n.pre) l = m + 1; else r = m - 1; } return -(l + 1); } /** * Sorts the nodes, if necessary. * @return self reference */ public NodeSeqBuilder sort() { if(check) sort(sort); return this; } /** * Sorts the nodes. * @param force force sort */ private void sort(final boolean force) { check = false; if(size > 1) { // sort arrays and remove duplicates if(force) sort(0, size); // remove duplicates and merge scores int i = 1; for(int j = 1; j < size; ++j) { while(j < size && nodes[i - 1].is(nodes[j])) { nodes[i - 1].score(Math.max(nodes[j++].score(), nodes[i - 1].score())); } if(j == size) break; nodes[i++] = nodes[j]; } size = i; } } /** * Recursively sorts the specified items via QuickSort * (derived from Java's sort algorithms). * @param s start position * @param e end position */ private void sort(final int s, final int e) { if(e < 7) { for(int i = s; i < e + s; ++i) for(int j = i; j > s && nodes[j - 1].diff(nodes[j]) > 0; j--) s(j, j - 1); return; } int m = s + (e >> 1); if(e > 7) { int l = s; int n = s + e - 1; if(e > 40) { final int k = e >>> 3; l = m(l, l + k, l + (k << 1)); m = m(m - k, m, m + k); n = m(n - (k << 1), n - k, n); } m = m(l, m, n); } final ANode v = nodes[m]; int a = s, b = a, c = s + e - 1, d = c; while(true) { while(b <= c) { final int h = nodes[b].diff(v); if(h > 0) break; if(h == 0) s(a++, b); ++b; } while(c >= b) { final int h = nodes[c].diff(v); if(h < 0) break; if(h == 0) s(c, d--); --c; } if(b > c) break; s(b++, c--); } int k; final int n = s + e; k = Math.min(a - s, b - a); s(s, b - k, k); k = Math.min(d - c, n - d - 1); s(b, n - k, k); if((k = b - a) > 1) sort(s, k); if((k = d - c) > 1) sort(n - k, k); } /** * Swaps x[a .. (a+n-1)] with x[b .. (b+n-1)]. * @param a first offset * @param b second offset * @param n number of values */ private void s(final int a, final int b, final int n) { for(int i = 0; i < n; ++i) s(a + i, b + i); } /** * Returns the index of the median of the three indexed integers. * @param a first offset * @param b second offset * @param c thirst offset * @return median */ private int m(final int a, final int b, final int c) { return nodes[a].diff(nodes[b]) < 0 ? nodes[b].diff(nodes[c]) < 0 ? b : nodes[a].diff(nodes[c]) < 0 ? c : a : nodes[b].diff(nodes[c]) > 0 ? b : nodes[a].diff(nodes[c]) > 0 ? c : a; } /** * Swaps two entries. * @param a first position * @param b second position */ private void s(final int a, final int b) { final ANode tmp = nodes[a]; nodes[a] = nodes[b]; nodes[b] = tmp; } @Override public String toString() { return Util.name(this) + Arrays.toString(Arrays.copyOf(nodes, size)); } /** * Creates a copy of this sequence builder. * @return copy */ public NodeSeqBuilder copy() { final NodeSeqBuilder b = new NodeSeqBuilder(nodes.clone(), size); b.pos = pos; b.sort = sort; b.check = check; return b; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/iter/ValueBuilder.java000066400000000000000000000064211222453003200265400ustar00rootroot00000000000000package org.basex.query.iter; import java.io.*; import org.basex.data.*; import org.basex.io.out.*; import org.basex.io.serial.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.seq.*; import org.basex.util.*; /** * This class can be used to build new sequences. * At the same time, it serves as an iterator. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ValueBuilder extends ValueIter implements Result { /** Item container. */ public Item[] item; /** Number of items. */ private int size; /** Current iterator position. */ private int pos = -1; /** * Constructor. */ public ValueBuilder() { this(1); } /** * Constructor. * @param c initial capacity */ public ValueBuilder(final int c) { item = new Item[c]; } /** * Constructor. * @param arr initial array * @param s initial size */ public ValueBuilder(final Item[] arr, final int s) { item = arr; size = s; } /** * Adds the contents of a value. * @param val value to be added * @return self reference */ public ValueBuilder add(final Value val) { for(final long sz = val.size(); item.length - size < sz;) item = extend(item); size += val.writeTo(item, size); return this; } /** * Adds a single item. * @param it item to be added * @return self reference */ public ValueBuilder add(final Item it) { if(size == item.length) item = extend(item); item[size++] = it; return this; } @Override public boolean sameAs(final Result v) { if(!(v instanceof ValueBuilder)) return false; final ValueBuilder vb = (ValueBuilder) v; if(size != vb.size) return false; for(int i = 0; i < size; ++i) { if(item[i].type != vb.item[i].type || !item[i].sameAs(vb.item[i])) return false; } return true; } @Override public void serialize(final Serializer ser) throws IOException { for(int c = 0; c < size && !ser.finished(); ++c) serialize(ser, c); } @Override public void serialize(final Serializer ser, final int n) throws IOException { ser.serialize(item[n]); } @Override public Item next() { return ++pos < size ? item[pos] : null; } /** * Sets the iterator size. * @param s size */ public void size(final int s) { size = s; } @Override public boolean reset() { pos = -1; return true; } @Override public long size() { return size; } @Override public Item get(final long i) { return item[(int) i]; } /** * Sets an item to the specified position. * @param i item to be set * @param p position */ public void set(final Item i, final int p) { item[p] = i; } @Override public Value value() { return Seq.get(item, size); } @Override public ArrayOutput serialize() throws IOException { final ArrayOutput ao = new ArrayOutput(); serialize(Serializer.get(ao)); return ao; } @Override public String toString() { try { return serialize().toString(); } catch(final IOException ex) { throw Util.notexpected(ex); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/iter/ValueIter.java000066400000000000000000000024451222453003200260570ustar00rootroot00000000000000package org.basex.query.iter; import java.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * Value iterator interface, throwing no exceptions. * * This class also implements the {@link Iterable} interface, which is why all of its * values can also be retrieved via enhanced for (for-each) loops. Note, however, that * using the {@link #next()} method will give you better performance. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class ValueIter extends Iter implements Iterable { @Override public abstract Item next(); @Override public abstract Item get(final long i); @Override public abstract long size(); @Override public abstract boolean reset(); @Override public abstract Value value(); @Override public final Iterator iterator() { return new Iterator() { /** Current node. */ private Item n; @Override public boolean hasNext() { n = ValueIter.this.next(); return n != null; } @Override public Item next() { return n; } @Override public void remove() { Util.notexpected(); } }; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/iter/package.html000066400000000000000000000000441222453003200255660ustar00rootroot00000000000000 XQuery iterators. basex-7.7.2/basex-core/src/main/java/org/basex/query/package.html000066400000000000000000000000511222453003200246210ustar00rootroot00000000000000 XQuery implementation. basex-7.7.2/basex-core/src/main/java/org/basex/query/path/000077500000000000000000000000001222453003200233005ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/path/Axis.java000066400000000000000000000065211222453003200250530ustar00rootroot00000000000000package org.basex.query.path; import org.basex.query.iter.*; import org.basex.query.value.node.*; /** * XPath axes. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public enum Axis { // ...order is important here for parsing the Query; // axes with longer names are parsed first /** Ancestor-or-self axis. */ ANCORSELF("ancestor-or-self", false) { @Override AxisIter iter(final ANode n) { return n.ancestorOrSelf(); } }, /** Ancestor axis. */ ANC("ancestor", false) { @Override AxisIter iter(final ANode n) { return n.ancestor(); } }, /** Attribute axis. */ ATTR("attribute", true) { @Override AxisIter iter(final ANode n) { return n.attributes(); } }, /** Child Axis. */ CHILD("child", true) { @Override AxisIter iter(final ANode n) { return n.children(); } }, /** Descendant-or-self axis. */ DESCORSELF("descendant-or-self", true) { @Override AxisIter iter(final ANode n) { return n.descendantOrSelf(); } }, /** Descendant axis. */ DESC("descendant", true) { @Override AxisIter iter(final ANode n) { return n.descendant(); } }, /** Following-Sibling axis. */ FOLLSIBL("following-sibling", false) { @Override AxisIter iter(final ANode n) { return n.followingSibling(); } }, /** Following axis. */ FOLL("following", false) { @Override AxisIter iter(final ANode n) { return n.following(); } }, /** Parent axis. */ PARENT("parent", true) { @Override AxisIter iter(final ANode n) { return n.parentIter(); } }, /** Preceding-Sibling axis. */ PRECSIBL("preceding-sibling", false) { @Override AxisIter iter(final ANode n) { return n.precedingSibling(); } }, /** Preceding axis. */ PREC("preceding", false) { @Override AxisIter iter(final ANode n) { return n.preceding(); } }, /** Step axis. */ SELF("self", true) { @Override AxisIter iter(final ANode n) { return n.self(); } }; /** Cached enums (faster). */ public static final Axis[] VALUES = values(); /** Axis string. */ public final String name; /** Descendant axis flag. */ public final boolean down; /** * Constructor. * @param n axis string * @param d descendant flag */ Axis(final String n, final boolean d) { name = n; down = d; } /** * Returns a node iterator. * @param n input node * @return node iterator */ abstract AxisIter iter(final ANode n); @Override public String toString() { return name; } /** * Inverts the axis. * @return inverted axis */ final Axis invert() { switch(this) { case ANC: return DESC; case ANCORSELF: return DESCORSELF; case ATTR: case CHILD: return PARENT; case DESC: return ANC; case DESCORSELF: return ANCORSELF; case FOLLSIBL: return PRECSIBL; case FOLL: return PREC; case PARENT: return CHILD; case PRECSIBL: return FOLLSIBL; case PREC: return FOLL; case SELF: return SELF; default: return null; } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/path/AxisPath.java000066400000000000000000000276551222453003200257030ustar00rootroot00000000000000package org.basex.query.path; import static org.basex.query.QueryText.*; import java.util.*; import org.basex.data.*; import org.basex.index.path.*; import org.basex.index.stats.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.path.Test.Mode; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; /** * Abstract axis path expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class AxisPath extends Path { /** * Constructor. * @param ii input info * @param r root expression; can be a {@code null} reference * @param s axis steps */ AxisPath(final InputInfo ii, final Expr r, final Expr... s) { super(ii, r, s); } /** * If possible, converts this path expression to a path iterator. * @param ctx query context * @return resulting operator */ final AxisPath finish(final QueryContext ctx) { // evaluate number of results size = size(ctx); type = SeqType.get(steps[steps.length - 1].type().type, size); return useIterator() ? new IterPath(info, root, steps, type, size) : this; } /** * Checks if the path can be rewritten for iterative evaluation. * @return resulting operator */ private boolean useIterator() { if(root == null || root.hasFreeVars() || !root.iterable()) return false; final int sl = steps.length; for(int s = 0; s < sl; ++s) { switch(step(s).axis) { // reverse axes - don't iterate case ANC: case ANCORSELF: case PREC: case PRECSIBL: return false; // multiple, unsorted results - only iterate at last step, // or if last step uses attribute axis case DESC: case DESCORSELF: case FOLL: case FOLLSIBL: return s + 1 == sl || s + 2 == sl && step(s + 1).axis == Axis.ATTR; // allow iteration for CHILD, ATTR, PARENT and SELF axes default: } } return true; } @Override protected final Expr compilePath(final QueryContext ctx, final VarScope scp) throws QueryException { // merge two axis paths if(root instanceof AxisPath) { Expr[] st = ((AxisPath) root).steps; root = ((AxisPath) root).root; for(final Expr s : steps) st = Array.add(st, s); steps = st; // refresh root context ctx.compInfo(OPTMERGE); ctx.value = root(ctx); } voidStep(steps, ctx); for(int i = 0; i != steps.length; ++i) { final Expr e = steps[i].compile(ctx, scp); if(!(e instanceof Step)) return e; steps[i] = e; } optSteps(ctx); return optimize(ctx, scp); } @Override public Expr optimize(final QueryContext ctx, final VarScope scp) throws QueryException { super.optimize(ctx, scp); final Value v = ctx.value; try { ctx.value = root(ctx); // retrieve data reference final Data data = ctx.data(); if(data != null && ctx.value.type == NodeType.DOC) { // check index access Expr e = index(ctx, data); // check children path rewriting if(e == this) e = children(ctx, data); // return optimized expression if(e != this) return e.compile(ctx, scp); } // if applicable, use iterative evaluation return finish(ctx); } finally { ctx.value = v; } } /** * If possible, returns an expression which accesses the index. * Otherwise, returns the original expression. * @param ctx query context * @param data data reference * @return resulting expression * @throws QueryException query exception */ private Expr index(final QueryContext ctx, final Data data) throws QueryException { // disallow relative paths and numeric predicates if(root == null || has(Flag.FCS)) return this; // cache index access costs IndexCosts ics = null; // cheapest predicate and step int pmin = 0; int smin = 0; // check if path can be converted to an index access for(int s = 0; s < steps.length; ++s) { // find cheapest index access final Step stp = step(s); if(!stp.axis.down) break; // check if resulting index path will be duplicate free final boolean i = pathNodes(data, s) != null; final IndexContext ictx = new IndexContext(data, i); // choose cheapest index access for(int p = 0; p < stp.preds.length; ++p) { final IndexCosts ic = new IndexCosts(ictx, ctx, stp); if(!stp.preds[p].indexAccessible(ic)) continue; if(ic.costs() == 0) { if(ic.not) { // not operator... accept all results stp.preds[p] = Bln.TRUE; continue; } // no results... ctx.compInfo(OPTNOINDEX, this); return Empty.SEQ; } if(ics == null || ics.costs() > ic.costs()) { ics = ic; pmin = p; smin = s; } } } // skip if no index access is possible, or if it is too expensive if(ics == null || ics.costs() > data.meta.size) return this; // replace expressions for index access final Step stp = step(smin); final Expr ie = stp.preds[pmin].indexEquivalent(ics); if(ics.seq) { // sequential evaluation; do not invert path stp.preds[pmin] = ie; } else { // inverted path, which will be represented as predicate Step[] invSteps = {}; // collect remaining predicates final Expr[] newPreds = new Expr[stp.preds.length - 1]; int c = 0; for(int p = 0; p != stp.preds.length; ++p) { if(p != pmin) newPreds[c++] = stp.preds[p]; } // check if path before index step needs to be inverted and traversed final Test test = InvDocTest.get(ctx, data); boolean inv = true; if(test == Test.DOC && data.meta.uptodate) { int j = 0; for(; j <= smin; ++j) { final Step s = axisStep(j); // step must use child axis and name test, and have no predicates if(s == null || s.test.mode != Mode.LN || s.axis != Axis.CHILD || j != smin && s.preds.length > 0) break; // support only unique paths with nodes on the correct level final int name = data.tagindex.id(s.test.name.local()); final ArrayList pn = data.paths.desc(name, Data.ELEM); if(pn.size() != 1 || pn.get(0).level() != j + 1) break; } inv = j <= smin; } // invert path before index step if(inv) { for(int j = smin; j >= 0; --j) { final Axis ax = step(j).axis.invert(); if(ax == null) break; if(j != 0) { final Step prev = step(j - 1); invSteps = Array.add(invSteps, Step.get(info, ax, prev.test, prev.preds)); } else { // add document test for collections and axes other than ancestors if(test != Test.DOC || ax != Axis.ANC && ax != Axis.ANCORSELF) invSteps = Array.add(invSteps, Step.get(info, ax, test)); } } } // create resulting expression final AxisPath result; final boolean simple = invSteps.length == 0 && newPreds.length == 0; if(ie instanceof AxisPath) { result = (AxisPath) ie; } else if(smin + 1 < steps.length || !simple) { result = simple ? new CachedPath(info, ie) : new CachedPath(info, ie, Step.get(info, Axis.SELF, Test.NOD)); } else { return ie; } // add remaining predicates to last step final int ls = result.steps.length - 1; if(ls >= 0) { result.steps[ls] = result.step(ls).addPreds(newPreds); // add inverted path as predicate to last step if(invSteps.length != 0) result.steps[ls] = result.step(ls).addPreds(Path.get(info, null, invSteps)); } // add remaining steps for(int s = smin + 1; s < steps.length; ++s) { result.steps = Array.add(result.steps, steps[s]); } return result; } return this; } /** * Inverts a location path. * @param r new root node * @param curr current location step * @return inverted path */ public final AxisPath invertPath(final Expr r, final Step curr) { // hold the steps to the end of the inverted path int s = steps.length; final Expr[] e = new Expr[s--]; // add predicates of last step to new root node final Expr rt = step(s).preds.length != 0 ? Filter.get(info, r, step(s).preds) : r; // add inverted steps in a backward manner int c = 0; while(--s >= 0) { e[c++] = Step.get(info, step(s + 1).axis.invert(), step(s).test, step(s).preds); } e[c] = Step.get(info, step(s + 1).axis.invert(), curr.test); return new CachedPath(info, rt, e); } @Override public final Expr addText(final QueryContext ctx) { final Step s = step(steps.length - 1); if(s.preds.length != 0 || !s.axis.down || s.test.type == NodeType.ATT || s.test.mode != Mode.LN && s.test.mode != Mode.STD) return this; final Data data = ctx.data(); if(data == null || !data.meta.uptodate) return this; final Stats stats = data.tagindex.stat(data.tagindex.id(s.test.name.local())); if(stats != null && stats.isLeaf()) { steps = Array.add(steps, Step.get(info, Axis.CHILD, Test.TXT)); ctx.compInfo(OPTTEXT, this); } return this; } /** * Returns the specified axis step. * @param i index * @return step */ public final Step step(final int i) { return (Step) steps[i]; } /** * Returns the path nodes that will result from this path. * @param ctx query context * @return path nodes, or {@code null} if nodes cannot be evaluated */ public ArrayList nodes(final QueryContext ctx) { final Value rt = root(ctx); final Data data = rt != null && rt.type == NodeType.DOC ? rt.data() : null; if(data == null || !data.meta.uptodate) return null; ArrayList nodes = data.paths.root(); for(int s = 0; s < steps.length; s++) { final Step curr = axisStep(s); if(curr == null) return null; nodes = curr.nodes(nodes, data); if(nodes == null) return null; } return nodes; } @Override public final boolean removable(final Var v) { for(final Expr s : steps) if(!s.removable(v)) return false; return super.removable(v); } @Override public final boolean iterable() { return true; } /** * Guesses if the evaluation of this axis path is cheap. This is used to determine if it * can be inlined into a loop to enable index rewritings. * @return guess */ public boolean cheap() { if(!(root instanceof ANode) || ((ANode) root).type != NodeType.DOC) return false; final Axis[] expensive = { Axis.DESC, Axis.DESCORSELF, Axis.PREC, Axis.PRECSIBL, Axis.FOLL, Axis.FOLLSIBL }; for(int i = 0; i < steps.length; i++) { final Step s = step(i); if(i < 2) for(final Axis a : expensive) if(s.axis == a) return false; final Expr[] ps = s.preds; if(!(ps.length == 0 || ps.length == 1 && ps[0] instanceof Pos)) return false; } return true; } @Override public final boolean sameAs(final Expr cmp) { if(!(cmp instanceof AxisPath)) return false; final AxisPath ap = (AxisPath) cmp; if((root == null || ap.root == null) && root != ap.root || steps.length != ap.steps.length || root != null && !root.sameAs(ap.root)) return false; for(int s = 0; s < steps.length; ++s) { if(!steps[s].sameAs(ap.steps[s])) return false; } return true; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/path/AxisStep.java000066400000000000000000000032531222453003200257060ustar00rootroot00000000000000package org.basex.query.path; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Axis step expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class AxisStep extends Step { /** * Constructor. * @param ii input info * @param a axis * @param t node test * @param p predicates */ AxisStep(final InputInfo ii, final Axis a, final Test t, final Expr[] p) { super(ii, a, t, p); } @Override public NodeIter iter(final QueryContext ctx) throws QueryException { // evaluate step final AxisIter ai = axis.iter(checkNode(ctx)); final NodeSeqBuilder nc = new NodeSeqBuilder(); for(ANode n; (n = ai.next()) != null;) { if(test.eq(n)) nc.add(n.finish()); } // evaluate predicates for(final Expr p : preds) { ctx.size = nc.size(); ctx.pos = 1; int c = 0; for(int n = 0; n < nc.size(); ++n) { ctx.value = nc.get(n); final Item i = p.test(ctx, info); if(i != null) { // assign score value nc.get(n).score(i.score()); nc.nodes[c++] = nc.get(n); } ctx.pos++; } nc.size(c); } return nc; } @Override public Step copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final Expr[] pred = new Expr[preds.length]; for(int i = 0; i < pred.length; i++) pred[i] = preds[i].copy(ctx, scp, vs); return copy(new AxisStep(info, axis, test.copy(), pred)); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/path/Bang.java000066400000000000000000000023241222453003200250130ustar00rootroot00000000000000package org.basex.query.path; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.value.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Map ("bang") operator. Only occurs as argument of the {@link MixedPath} expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Bang extends Single { /** * Constructor. * @param ii input info * @param e expression */ public Bang(final InputInfo ii, final Expr e) { super(ii, e); } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { super.compile(ctx, scp); type = expr.type(); return this; } @Override public Iter iter(final QueryContext ctx) throws QueryException { return ctx.iter(expr); } @Override public Value value(final QueryContext ctx) throws QueryException { return ctx.value(expr); } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new Bang(info, expr.copy(ctx, scp, vs)); } @Override public String toString() { return expr.toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/path/CachedPath.java000066400000000000000000000070271222453003200261350ustar00rootroot00000000000000package org.basex.query.path; import static org.basex.query.util.Err.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Axis path expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class CachedPath extends AxisPath { /** Flag for result caching. */ private boolean cache; /** Cached result. */ private NodeSeqBuilder citer; /** Last visited item. */ private Value lvalue; /** * Constructor. * @param ii input info * @param r root expression; can be a {@code null} reference * @param s axis steps */ CachedPath(final InputInfo ii, final Expr r, final Expr... s) { super(ii, r, s); } @Override public Expr optimize(final QueryContext ctx, final VarScope scp) throws QueryException { final Expr e = super.optimize(ctx, scp); if(e != this) return e; // analyze if result set can be cached - no predicates/variables... cache = root != null && !hasFreeVars(); return this; } @Override public Iter iter(final QueryContext ctx) throws QueryException { final Value cv = ctx.value; final long cs = ctx.size; final long cp = ctx.pos; final Value r = root != null ? ctx.value(root) : cv; try { /* cache values if: * - caching is desirable * - the code is called for the first time * - the value has changed and the underlying node is not the same */ if(!cache || citer == null || lvalue != r && !(r instanceof ANode && lvalue instanceof ANode && ((ANode) lvalue).is((ANode) r))) { lvalue = r; citer = new NodeSeqBuilder().check(); if(r != null) { final Iter ir = ctx.iter(r); for(Item it; (it = ir.next()) != null;) { // ensure that root only returns nodes if(root != null && !(it instanceof ANode)) PATHNODE.thrw(info, it.type); ctx.value = it; iter(0, citer, ctx); } } else { ctx.value = null; iter(0, citer, ctx); } citer.sort(); } else { citer.reset(); } return citer; } finally { ctx.value = cv; ctx.size = cs; ctx.pos = cp; } } /** * Recursive step iterator. * @param l current step * @param nc node cache * @param ctx query context * @throws QueryException query exception */ private void iter(final int l, final NodeSeqBuilder nc, final QueryContext ctx) throws QueryException { // cast is safe (steps will always return a {@link NodeIter} instance final NodeIter ni = (NodeIter) ctx.iter(steps[l]); final boolean more = l + 1 != steps.length; for(ANode node; (node = ni.next()) != null;) { if(more) { ctx.value = node; iter(l + 1, nc, ctx); } else { ctx.checkStop(); nc.add(node); } } } @Override public AxisPath copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final Expr[] stps = new Expr[steps.length]; for(int s = 0; s < steps.length; ++s) stps[s] = step(s).copy(ctx, scp, vs); final CachedPath ap = copyType( new CachedPath(info, root == null ? null : root.copy(ctx, scp, vs), stps)); ap.cache = cache; if(citer != null) ap.citer = citer.copy(); if(lvalue != null) ap.lvalue = lvalue; return ap; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/path/DocTest.java000066400000000000000000000031011222453003200255030ustar00rootroot00000000000000package org.basex.query.path; import org.basex.query.iter.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; /** * Document kind test. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DocTest extends Test { /** Optional child test. */ private final Test test; /** * Constructor. * @param t child test (may be {@code null}) */ public DocTest(final Test t) { type = NodeType.DOC; test = t; } @Override public Test copy() { return new DocTest(test); } @Override public boolean eq(final ANode node) { if(node.type != NodeType.DOC) return false; final AxisMoreIter ai = node.children(); return ai.more() && test.eq(ai.next()) && !ai.more(); } @Override public String toString() { final StringBuilder sb = new StringBuilder().append(type).append('('); if(test != null) sb.append(test); return sb.append(')').toString(); } @Override public boolean nsSensitive() { return test != null && test.nsSensitive(); } @Override public Test intersect(final Test other) { if(other instanceof DocTest) { final DocTest o = (DocTest) other; if(test == null || o.test == null || test.sameAs(o.test)) return test != null ? this : other; final Test t = test.intersect(o.test); return t == null ? null : new DocTest(t); } else if(other instanceof KindTest) { return NodeType.DOC.instanceOf(other.type) ? this : null; } else if(other instanceof InvDocTest) { return this; } return null; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/path/InvDocTest.java000066400000000000000000000043451222453003200261730ustar00rootroot00000000000000package org.basex.query.path; import org.basex.data.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.list.*; /** * Document test for inverted location paths. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class InvDocTest extends Test { /** Database nodes. */ private final Nodes nodes; /** * Constructor. * @param n database document nodes */ private InvDocTest(final Nodes n) { type = NodeType.DOC; nodes = n; } /** * Returns a document test. This test will only be utilized by * {@link AxisPath#index} if all context values are database nodes. * @param ctx query context * @param data data reference * @return document test */ static Test get(final QueryContext ctx, final Data data) { // use simple test if database contains only one document if(data.resources.docs().size() == 1) return Test.DOC; // adopt nodes from existing sequence if(ctx.value instanceof DBNodeSeq) { final DBNodeSeq seq = (DBNodeSeq) ctx.value; return seq.complete ? Test.DOC : new InvDocTest(new Nodes(seq.pres, data)); } // loop through all documents and add pre values of documents // not more than 2^31 documents supported final IntList il = new IntList((int) ctx.value.size()); final ValueIter ir = ctx.value.iter(); for(Item it; (it = ir.next()) != null;) il.add(((DBNode) it).pre); return new InvDocTest(new Nodes(il.toArray(), data)); } @Override public boolean eq(final ANode node) { // no database node if(!(node instanceof DBNode)) return false; // ensure that the pre value is contained in the target documents final DBNode db = (DBNode) node; return nodes.data == db.data && nodes.contains(db.pre); } @Override public Test copy() { return new InvDocTest(new Nodes(nodes)); } @Override public String toString() { return new TokenBuilder(NodeType.DOC.string()).add("(...)").toString(); } @Override public Test intersect(final Test other) { throw Util.notexpected(this); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/path/IterPath.java000066400000000000000000000062261222453003200256710ustar00rootroot00000000000000package org.basex.query.path; import static org.basex.query.util.Err.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Iterative path expression for location paths which return sorted and * duplicate-free results. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class IterPath extends AxisPath { /** * Constructor. * @param ii input info * @param r root expression * @param s axis steps * @param t return type * @param c cardinality */ IterPath(final InputInfo ii, final Expr r, final Expr[] s, final SeqType t, final long c) { super(ii, r, s); type = t; size = c; } @Override public NodeIter iter(final QueryContext ctx) { return new NodeIter() { final boolean r = root != null; Expr[] expr; Iter[] iter; ANode node; int p; @Override public ANode next() throws QueryException { if(iter == null) { if(expr == null) { expr = steps; if(r) { // add root as first expression expr = new Expr[steps.length + 1]; expr[0] = root; System.arraycopy(steps, 0, expr, 1, steps.length); } } // create iterator array iter = new Iter[expr.length]; iter[0] = ctx.iter(expr[0]); } final Value cv = ctx.value; final long cp = ctx.pos; final long cs = ctx.size; try { while(true) { final Item it = iter[p].next(); if(it == null) { if(--p == -1) { node = null; break; } } else if(p < iter.length - 1) { // ensure that root only returns nodes if(r && p == 0 && !(it instanceof ANode)) PATHNODE.thrw(info, it.type); ctx.value = it; ++p; if(iter[p] == null || !iter[p].reset()) iter[p] = ctx.iter(expr[p]); } else { // remaining steps will always yield nodes final ANode n = (ANode) it; if(node == null || !node.is(n)) { node = n; break; } } } return node; } finally { // reset context and return result ctx.value = cv; ctx.pos = cp; ctx.size = cs; } } @Override public boolean reset() { iter = null; node = null; p = 0; return true; } }; } @Override public IterPath copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return copyType(new IterPath(info, root == null ? null : root.copy(ctx, scp, vs), Arr.copyAll(ctx, scp, vs, steps), type, size)); } }basex-7.7.2/basex-core/src/main/java/org/basex/query/path/IterPosStep.java000066400000000000000000000042331222453003200263660ustar00rootroot00000000000000package org.basex.query.path; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.hash.*; /** * Iterative step expression with numeric predicates. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class IterPosStep extends Step { /** * Constructor. * @param s step reference */ IterPosStep(final Step s) { super(s.info, s.axis, s.test, s.preds); last = s.last; pos = s.pos; } @Override public NodeIter iter(final QueryContext ctx) { return new NodeIter() { boolean skip; AxisIter ai; long cpos; @Override public ANode next() throws QueryException { if(skip) return null; if(ai == null) ai = axis.iter(checkNode(ctx)); ANode lnode = null, node; while(true) { ctx.checkStop(); node = ai.next(); if(node == null) { skip = last; return lnode; } // evaluate node test if(!test.eq(node)) continue; // evaluate predicates final long cp = ctx.pos; final long cs = ctx.size; ctx.size = 0; ctx.pos = ++cpos; final boolean p = preds(node, ctx); ctx.pos = cp; ctx.size = cs; if(p) { // check if more results can be expected skip = pos != null && pos.skip(ctx); return node.finish(); } // remember last node if(last) lnode = node.finish(); } } @Override public boolean reset() { ai = null; skip = false; cpos = 0; return true; } }; } @Override public Step copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final Expr[] pred = new Expr[preds.length]; for(int i = 0; i < pred.length; i++) pred[i] = preds[i].copy(ctx, scp, vs); return copy(new IterPosStep(new AxisStep(info, axis, test.copy(), pred))); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/path/IterStep.java000066400000000000000000000031211222453003200256770ustar00rootroot00000000000000package org.basex.query.path; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Iterative step expression without numeric predicates. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class IterStep extends Step { /** * Constructor. * @param ii input info * @param a axis * @param t node test * @param p predicates */ IterStep(final InputInfo ii, final Axis a, final Test t, final Expr[] p) { super(ii, a, t, p); } @Override public NodeIter iter(final QueryContext ctx) { return new NodeIter() { AxisIter ai; @Override public ANode next() throws QueryException { if(ai == null) ai = axis.iter(checkNode(ctx)); while(true) { ctx.checkStop(); final ANode node = ai.next(); if(node == null) return null; // evaluate node test and predicates if(test.eq(node) && preds(node, ctx)) return node.finish(); } } @Override public boolean reset() { ai = null; return true; } }; } @Override public IterStep copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final Expr[] pred = new Expr[preds.length]; for(int i = 0; i < pred.length; i++) pred[i] = preds[i].copy(ctx, scp, vs); return copy(new IterStep(info, axis, test.copy(), pred)); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/path/KindTest.java000066400000000000000000000020531222453003200256700ustar00rootroot00000000000000package org.basex.query.path; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Simple node kind test. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ class KindTest extends Test { /** * Constructor. * @param t node type */ KindTest(final NodeType t) { type = t; } @Override public Test copy() { return Test.get(type); } @Override public boolean eq(final ANode node) { return node.type == type; } @Override public String toString() { return String.valueOf(type); } @Override public Test intersect(final Test other) { if(other instanceof NodeTest || other instanceof DocTest) { return other.type.instanceOf(type) ? other : null; } else if(other instanceof KindTest) { return type.instanceOf(other.type) ? this : other.type.instanceOf(type) ? other : null; } else if(other instanceof NameTest || other instanceof InvDocTest) { throw Util.notexpected(other); } return null; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/path/MixedPath.java000066400000000000000000000076441222453003200260410ustar00rootroot00000000000000package org.basex.query.path; import static org.basex.query.util.Err.*; import org.basex.data.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Mixed path expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class MixedPath extends Path { /** * Constructor. * @param ii input info * @param r root expression; can be a {@code null} reference * @param s axis steps */ public MixedPath(final InputInfo ii, final Expr r, final Expr... s) { super(ii, r, s); } @Override protected Expr compilePath(final QueryContext ctx, final VarScope scp) throws QueryException { voidStep(steps, ctx); for(int s = 0; s != steps.length; ++s) { steps[s] = steps[s].compile(ctx, scp); if(steps[s].isEmpty()) return optPre(Empty.SEQ, ctx); } optSteps(ctx); // rewrite to child steps final Data data = ctx.data(); if(data != null && ctx.value.type == NodeType.DOC) { final Expr e = children(ctx, data); // return optimized expression if(e != this) return e.compile(ctx, scp); } size = size(ctx); type = SeqType.get(steps[steps.length - 1].type().type, size); return this; } @Override public Iter iter(final QueryContext ctx) throws QueryException { // creates an iterator from the root value final Value v = root != null ? ctx.value(root) : checkCtx(ctx); Iter res = v.iter(); final Value cv = ctx.value; final long cs = ctx.size; final long cp = ctx.pos; try { // loop through all expressions final int sl = steps.length; for(int s = 0; s < sl; s++) { final Expr e = steps[s]; final ValueBuilder vb = new ValueBuilder(); // map operator: don't remove duplicates and check for nodes final boolean path = !(e instanceof Bang); int nodes = 0; ctx.size = res.size(); ctx.pos = 1; // loop through all input items for(Item it; (it = res.next()) != null;) { if(path && !(it instanceof ANode)) PATHNODE.thrw(info, it.type); ctx.value = it; // loop through all resulting items final Iter ir = ctx.iter(e); for(Item i; (i = ir.next()) != null;) { if(i instanceof ANode) nodes++; vb.add(i); } ctx.pos++; } final long vs = vb.size(); if(nodes < vs) { // check if both nodes and atomic values occur in last result if(path && nodes > 0) EVALNODESVALS.thrw(info); // check if input for next axis step consists items other than nodes if(s + 1 < sl && !(steps[s + 1] instanceof Bang)) PATHNODE.thrw(info, vb.get(0).type); } if(path && nodes == vs) { // remove potential duplicates from node sets final NodeSeqBuilder nc = new NodeSeqBuilder().check(); for(Item it; (it = vb.next()) != null;) nc.add((ANode) it); res = nc.value().cache(); } else { res = vb; } } return res; } finally { ctx.value = cv; ctx.size = cs; ctx.pos = cp; } } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new MixedPath(info, root == null ? null : root.copy(ctx, scp, vs), Arr.copyAll(ctx, scp, vs, steps)); } @Override public boolean removable(final Var v) { for(final Expr e : steps) if(e.uses(v)) return false; return super.removable(v); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/path/NameTest.java000066400000000000000000000070531222453003200256700ustar00rootroot00000000000000package org.basex.query.path; import static org.basex.query.QueryText.*; import org.basex.data.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Name test. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class NameTest extends Test { /** Local name. */ public final byte[] ln; /** * Empty constructor ('*'). * @param att attribute flag */ public NameTest(final boolean att) { this(null, Mode.ALL, att); } /** * Constructor. * @param nm name * @param t type of name test * @param att attribute flag */ public NameTest(final QNm nm, final Mode t, final boolean att) { type = att ? NodeType.ATT : NodeType.ELM; ln = nm != null ? nm.local() : null; name = nm; mode = t; } @Override public boolean compile(final QueryContext ctx) { // skip optimizations if data reference cannot be determined statically final Data data = ctx.data(); if(data == null) return true; // skip optimizations if more than one namespace is defined in the database final byte[] dataNS = data.nspaces.globalNS(); if(dataNS == null) return true; // check if test may yield results boolean results = true; if(mode == Mode.STD && !name.hasURI()) { final byte[] elemNS = ctx.sc.elemNS != null ? ctx.sc.elemNS : Token.EMPTY; if(type == NodeType.ATT || Token.eq(dataNS, elemNS)) { // namespace is irrelevant/identical: only check local name mode = Mode.LN; } else { // element and db default namespaces are different: no results results = false; } } // check existence of tag/attribute names if(results) results = mode != Mode.LN || (type == NodeType.ELM ? data.tagindex : data.atnindex).contains(ln); if(!results) ctx.compInfo(OPTNAME, name); return results; } @Override public Test copy() { return this; } @Override public boolean eq(final ANode node) { // only elements and attributes will yield results if(node.type != type) return false; switch(mode) { // wildcard: accept all nodes case ALL: return true; // namespaces wildcard: only check local name case LN: return Token.eq(ln, Token.local(node.name())); // name wildcard: only check namespace case NS: return Token.eq(name.uri(), node.qname(tmpq).uri()); // check attributes, or check everything default: return type == NodeType.ATT && !name.hasURI() ? Token.eq(ln, node.name()) : name.eq(node.qname(tmpq)); } } /** * Checks if the specified name matches the test. * @param nm name * @return result of check */ public boolean eq(final QNm nm) { switch(mode) { // wildcard: accept all nodes case ALL: return true; // namespaces wildcard: only check local name case LN: return Token.eq(ln, nm.local()); // name wildcard: only check namespace case NS: return Token.eq(name.uri(), nm.uri()); // check everything default: return name.eq(nm); } } @Override public String toString() { if(mode == Mode.ALL) return "*"; if(mode == Mode.LN) return "*:" + Token.string(name.string()); final String uri = name.uri().length == 0 || name.hasPrefix() ? "" : '{' + Token.string(name.uri()) + '}'; return uri + (mode == Mode.NS ? "*" : Token.string(name.string())); } @Override public Test intersect(final Test other) { throw Util.notexpected(other); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/path/NodeTest.java000066400000000000000000000051531222453003200256740ustar00rootroot00000000000000package org.basex.query.path; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Extended node test. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class NodeTest extends Test { /** Extended type. */ private final Type ext; /** Strip flag (only relevant if specified type is {@code xs:untyped}). */ private final boolean strip; /** * Convenience constructor for element tests. * @param nm node name */ public NodeTest(final QNm nm) { this(NodeType.ELM, nm, null, false); } /** * Constructor. * @param nt node type * @param nm optional node name */ public NodeTest(final NodeType nt, final QNm nm) { this(nt, nm, null, false); } /** * Constructor. * @param nt node type * @param nm optional node name * @param et extended node type * @param st strip flag; only relevant if specified type is {@code xs:untyped} */ public NodeTest(final NodeType nt, final QNm nm, final Type et, final boolean st) { type = nt; name = nm; ext = et; strip = st; } @Override public Test copy() { return new NodeTest(type, name, ext, strip); } @Override public boolean eq(final ANode node) { return node.type == type && (name == null || node.qname(tmpq).eq(name)) && (ext == null || ext == AtomType.ATY || (node instanceof DBNode || strip) && ext == AtomType.UTY || type == NodeType.ATT && (ext == AtomType.AST || ext == AtomType.AAT || ext == AtomType.ATM)); } @Override public String toString() { final TokenBuilder tb = new TokenBuilder(); if(name == null) tb.add('*'); else tb.add(name.string()); if(ext != null) tb.add(',').addExt(ext); return tb.toString(); } @Override public Test intersect(final Test other) { if(other instanceof NodeTest) { final NodeTest o = (NodeTest) other; if(type != null && o.type != null && type != o.type) return null; final NodeType nt = type != null ? type : o.type; if(name != null && o.name != null && !name.eq(o.name)) return null; final QNm n = name != null ? name : o.name; final boolean both = ext != null && o.ext != null; final Type e = ext == null ? o.ext : o.ext == null ? ext : ext.intersect(o.ext); return both && e == null ? null : new NodeTest(nt, n, e, strip || o.strip); } else if(other instanceof KindTest) { return type.instanceOf(other.type) ? this : null; } else if(other instanceof NameTest) { throw Util.notexpected(other); } return null; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/path/Path.java000066400000000000000000000373241222453003200250500ustar00rootroot00000000000000package org.basex.query.path; import static org.basex.query.QueryText.*; import static org.basex.query.path.Axis.*; import java.util.*; import org.basex.core.*; import org.basex.data.*; import org.basex.index.path.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.expr.Context; import org.basex.query.path.Test.Mode; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; /** * Path expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class Path extends ParseExpr { /** Root expression. */ public Expr root; /** Path steps. */ public Expr[] steps; /** * Constructor. * @param ii input info * @param r root expression; can be a {@code null} reference * @param s axis steps */ Path(final InputInfo ii, final Expr r, final Expr[] s) { super(ii); root = r; steps = s; } /** * Returns a new path instance. * @param ii input info * @param r root expression; can be a {@code null} reference * @param path path steps * @return class instance */ public static Path get(final InputInfo ii, final Expr r, final Expr... path) { // check if all steps are axis steps boolean axes = true; for(int p = 0; p < path.length; p++) { Expr e = path[p]; if(e instanceof Context) { e = Step.get(((Context) e).info, Axis.SELF, Test.NOD); } else if(e instanceof Filter) { final Filter f = (Filter) e; if(f.root instanceof Context) { e = Step.get(f.info, Axis.SELF, Test.NOD, f.preds); } } axes &= e instanceof Step; path[p] = e; } return axes ? new CachedPath(ii, r, path).finish(null) : new MixedPath(ii, r, path); } @Override public final void checkUp() throws QueryException { checkNoUp(root); checkNoneUp(steps); } @Override public final Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { if(root != null) setRoot(ctx, root.compile(ctx, scp)); final Value v = ctx.value; try { ctx.value = root(ctx); return compilePath(ctx, scp); } finally { ctx.value = v; } } @Override public Expr optimize(final QueryContext ctx, final VarScope scp) throws QueryException { if(root instanceof Context) { ctx.compInfo(OPTREMCTX); root = null; } return this; } /** * Compiles the location path. * @param ctx query context * @param scp variable scope * @return optimized expression * @throws QueryException query exception */ protected abstract Expr compilePath(final QueryContext ctx, VarScope scp) throws QueryException; /** * Returns the root of the current context or {@code null}. * @param ctx query context * @return root */ final Value root(final QueryContext ctx) { final Value v = ctx != null ? ctx.value : null; // no root specified: return context, if it does not reference a document // as e.g. happens in //a(b|c) if(root == null) return v == null || v.type != NodeType.DOC ? v : null; // root is value: return root if(root.isValue()) return (Value) root; // no root reference, no context: return null if(!(root instanceof Root) || v == null) return null; // return context sequence or root of current context return v.size() != 1 ? v : Root.root(v); } /** * Sets a new root expression and eliminates a superfluous context item. * @param ctx query context * @param rt root expression */ private void setRoot(final QueryContext ctx, final Expr rt) { root = rt; if(root instanceof Context) { ctx.compInfo(OPTREMCTX); root = null; } } @Override public final boolean has(final Flag flag) { // first step or root expression will be used as context if(flag == Flag.CTX) return root == null || root.has(flag); for(final Expr s : steps) if(s.has(flag)) return true; return root != null && root.has(flag); } /** * Optimizes descendant-or-self steps and static types. * @param ctx query context */ void optSteps(final QueryContext ctx) { boolean opt = false; Expr[] st = steps; for(int l = 1; l < st.length; ++l) { if(!(st[l - 1] instanceof Step && st[l] instanceof Step)) continue; final Step prev = (Step) st[l - 1]; final Step curr = (Step) st[l]; if(!prev.simple(DESCORSELF, false)) continue; if(curr.axis == CHILD && !curr.has(Flag.FCS)) { // descendant-or-self::node()/child::X -> descendant::X final int sl = st.length; final Expr[] tmp = new Expr[sl - 1]; System.arraycopy(st, 0, tmp, 0, l - 1); System.arraycopy(st, l, tmp, l - 1, sl - l); st = tmp; curr.axis = DESC; opt = true; } else if(curr.axis == ATTR && !curr.has(Flag.FCS)) { // descendant-or-self::node()/@X -> descendant-or-self::*/@X prev.test = new NameTest(false); opt = true; } } if(opt) ctx.compInfo(OPTDESC); // set atomic type for single attribute steps to speedup predicate tests if(root == null && st.length == 1 && st[0] instanceof Step) { final Step curr = (Step) st[0]; if(curr.axis == ATTR && curr.test.mode == Mode.STD) curr.type = SeqType.NOD_ZO; } steps = st; } /** * Computes the number of results. * @param ctx query context * @return number of results */ long size(final QueryContext ctx) { final Value rt = root(ctx); // skip computation if value contains document nodes if(rt == null || rt.type != NodeType.DOC) return -1; final Data data = rt.data(); // skip computation if no database instance is available, is out-of-date or // if context does not contain all database nodes if(data == null || !data.meta.uptodate || data.resources.docs().size() != rt.size()) return -1; ArrayList nodes = data.paths.root(); long m = 1; for(int s = 0; s < steps.length; s++) { final Step curr = axisStep(s); if(curr != null) { nodes = curr.nodes(nodes, data); if(nodes == null) return -1; } else if(s + 1 == steps.length) { m = steps[s].size(); } else { // stop if a non-axis step is not placed last return -1; } } long sz = 0; for(final PathNode pn : nodes) sz += pn.stats.count; return sz * m; } /** * Checks if the location path contains steps that will never yield results. * @param stps step array * @param ctx query context */ void voidStep(final Expr[] stps, final QueryContext ctx) { for(int l = 0; l < stps.length; ++l) { final Step s = axisStep(l); if(s == null) continue; final Axis sa = s.axis; if(l == 0) { if(root instanceof CAttr) { // @.../child:: / @.../descendant:: if(sa == CHILD || sa == DESC) { ctx.compInfo(WARNDESC, root); return; } } else if(root instanceof Root || root instanceof Value && ((Value) root).type == NodeType.DOC || root instanceof CDoc) { if(sa != CHILD && sa != DESC && sa != DESCORSELF && (sa != SELF && sa != ANCORSELF || s.test != Test.NOD && s.test != Test.DOC)) { ctx.compInfo(WARNDOC, root, sa); return; } } } else { boolean warning = true; final Step ls = axisStep(l - 1); if(ls == null) continue; final Axis lsa = ls.axis; if(sa == SELF || sa == DESCORSELF) { // .../self:: / .../descendant-or-self:: if(s.test == Test.NOD) continue; // @.../..., text()/... warning = lsa == ATTR && s.test.type != NodeType.ATT || ls.test == Test.TXT && s.test != Test.TXT; if(!warning) { if(sa == DESCORSELF) continue; // .../self:: final QNm n0 = ls.test.name; final QNm n1 = s.test.name; if(n0 == null || n1 == null || n0.local().length == 0 || n1.local().length == 0) continue; // ...X/...Y warning = !n1.eq(n0); } } else if(sa == FOLLSIBL || sa == PRECSIBL) { // .../following-sibling:: / .../preceding-sibling:: warning = lsa == ATTR; } else if(sa == DESC || sa == CHILD || sa == ATTR) { // .../descendant:: / .../child:: / .../attribute:: warning = lsa == ATTR || ls.test == Test.TXT || ls.test == Test.COM || ls.test == Test.PI || sa == ATTR && s.test == Test.NSP; } else if(sa == PARENT || sa == ANC) { // .../parent:: / .../ancestor:: warning = ls.test == Test.DOC; } if(warning) { ctx.compInfo(WARNSELF, s); return; } } } } /** * Converts descendant to child steps. * @param ctx query context * @param data data reference * @return path */ Expr children(final QueryContext ctx, final Data data) { // skip path check if no path index exists, or if it is out-of-date if(!data.meta.uptodate || data.nspaces.globalNS() == null) return this; Path path = this; for(int s = 0; s < steps.length; ++s) { // don't allow predicates in preceding location steps final Step prev = s > 0 ? axisStep(s - 1) : null; if(prev != null && prev.preds.length != 0) break; // ignore axes other than descendant, or numeric predicates final Step curr = axisStep(s); if(curr == null || curr.axis != DESC || curr.has(Flag.FCS)) continue; // check if child steps can be retrieved for current step ArrayList pn = pathNodes(data, s); if(pn == null) continue; // cache child steps final ArrayList qnm = new ArrayList(); while(pn.get(0).par != null) { QNm nm = new QNm(data.tagindex.key(pn.get(0).name)); // skip children with prefixes if(nm.hasPrefix()) return this; for(final PathNode p : pn) { if(pn.get(0).name != p.name) nm = null; } qnm.add(nm); pn = PathSummary.parent(pn); } ctx.compInfo(OPTCHILD, steps[s]); // build new steps int ts = qnm.size(); final Expr[] stps = new Expr[ts + steps.length - s - 1]; for(int t = 0; t < ts; ++t) { final Expr[] preds = t == ts - 1 ? ((Step) steps[s]).preds : new Expr[0]; final QNm nm = qnm.get(ts - t - 1); final NameTest nt = nm == null ? new NameTest(false) : new NameTest(nm, Mode.LN, false); stps[t] = Step.get(info, CHILD, nt, preds); } while(++s < steps.length) stps[ts++] = steps[s]; path = get(info, root, stps); break; } // check if the all children in the path exist; don't test with namespaces if(data.nspaces.size() == 0) { LOOP: for(int s = 0; s < path.steps.length; ++s) { // only verify child steps; ignore namespaces final Step st = path.axisStep(s); if(st == null || st.axis != CHILD) break; if(st.test.mode == Mode.ALL || st.test.mode == null) continue; if(st.test.mode != Mode.LN) break; // check if one of the addressed nodes is on the correct level final int name = data.tagindex.id(st.test.name.local()); for(final PathNode pn : data.paths.desc(name, Data.ELEM)) { if(pn.level() == s + 1) continue LOOP; } ctx.compInfo(OPTPATH, path); return Empty.SEQ; } } return path; } /** * Casts the specified step into an axis step, or returns a {@code null} * reference. * @param i index * @return step */ Step axisStep(final int i) { return steps[i] instanceof Step ? (Step) steps[i] : null; } /** * Returns all summary path nodes for the specified location step or * {@code null} if nodes cannot be retrieved or are found on different levels. * @param data data reference * @param l last step to be checked * @return path nodes */ ArrayList pathNodes(final Data data, final int l) { // skip request if no path index exists or might be out-of-date if(!data.meta.uptodate) return null; ArrayList in = data.paths.root(); for(int s = 0; s <= l; ++s) { final Step curr = axisStep(s); if(curr == null) return null; final boolean desc = curr.axis == DESC; if(!desc && curr.axis != CHILD || curr.test.mode != Mode.LN) return null; final int name = data.tagindex.id(curr.test.name.local()); final ArrayList al = new ArrayList(); for(final PathNode pn : PathSummary.desc(in, desc)) { if(pn.kind == Data.ELEM && name == pn.name) { // skip test if a tag is found on different levels if(!al.isEmpty() && al.get(0).level() != pn.level()) return null; al.add(pn); } } if(al.isEmpty()) return null; in = al; } return in; } /** * Adds a predicate to the last step. * @param ctx query context * @param scp variable scope * @param pred predicate to be added * @return resulting path instance * @throws QueryException query exception */ public final Expr addPreds(final QueryContext ctx, final VarScope scp, final Expr... pred) throws QueryException { steps[steps.length - 1] = axisStep(steps.length - 1).addPreds(pred); return get(info, root, steps).optimize(ctx, scp); } @Override public boolean removable(final Var v) { return root == null || root.removable(v); } @Override public VarUsage count(final Var v) { final VarUsage inRoot = root == null ? VarUsage.NEVER : root.count(v); return VarUsage.sum(v, steps) == VarUsage.NEVER ? inRoot : VarUsage.MORE_THAN_ONCE; } @Override public final Expr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { final Value oldVal = ctx.value; try { ctx.value = root(ctx); final Expr rt = root == null ? null : root.inline(ctx, scp, v, e); if(rt != null) { setRoot(ctx, rt); ctx.value = oldVal; ctx.value = root(ctx); } return inlineAll(ctx, scp, steps, v, e) || rt != null ? optimize(ctx, scp) : null; } finally { ctx.value = oldVal; } } @Override public final void plan(final FElem plan) { addPlan(plan, planElem(), root, steps); } @Override public final String toString() { final StringBuilder sb = new StringBuilder(); if(root != null) sb.append(root); for(final Expr s : steps) { if(sb.length() != 0) sb.append(s instanceof Bang ? " ! " : "/"); if(s instanceof Step) sb.append(s); else sb.append(s); } return sb.toString(); } @Override public boolean accept(final ASTVisitor visitor) { if(root == null) { if(!visitor.lock(DBLocking.CTX)) return false; } else if(!root.accept(visitor)) { return false; } visitor.enterFocus(); if(!visitAll(visitor, steps)) return false; visitor.exitFocus(); return true; } @Override public final int exprSize() { int sz = 1; for(final Expr e : steps) sz += e.exprSize(); return root == null ? sz : sz + root.exprSize(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/path/Step.java000066400000000000000000000200731222453003200250600ustar00rootroot00000000000000package org.basex.query.path; import static org.basex.query.QueryText.*; import java.util.*; import org.basex.data.*; import org.basex.index.name.*; import org.basex.index.path.*; import org.basex.index.stats.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.path.Test.Mode; import org.basex.query.util.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Abstract axis step expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class Step extends Preds { /** Axis. */ Axis axis; /** Kind test. */ public Test test; /** * This method creates a step instance. * @param ii input info * @param a axis * @param t node test * @param p predicates * @return step */ public static Step get(final InputInfo ii, final Axis a, final Test t, final Expr... p) { boolean num = false; for(final Expr pr : p) num |= pr.type().mayBeNumber() || pr.has(Flag.FCS); return num ? new AxisStep(ii, a, t, p) : new IterStep(ii, a, t, p); } /** * Constructor. * @param ii input info * @param a axis * @param t node test * @param p predicates */ Step(final InputInfo ii, final Axis a, final Test t, final Expr... p) { super(ii, p); axis = a; test = t; type = SeqType.NOD_ZM; } @Override public final Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { // return empty sequence if test will yield no results if(!test.compile(ctx)) return Empty.SEQ; // leaf flag indicates that a context node can be replaced by a text() step final Type ct = ctx.value != null ? ctx.value.type : null; final boolean leaf = ctx.leaf; ctx.leaf = false; try { final Data data = ctx.data(); if(data != null && test.mode == Mode.LN && test.type != NodeType.ATT && axis.down && data.meta.uptodate && data.nspaces.size() == 0) { final Stats s = data.tagindex.stat(data.tagindex.id(((NameTest) test).ln)); ctx.leaf = s != null && s.isLeaf(); } // as predicates will not necessarily start from the document node, // the context item type is temporarily generalized if(ct == NodeType.DOC) ctx.value.type = NodeType.NOD; final Expr e = super.compile(ctx, scp); // return optimized step / don't re-optimize step if(e != this || e instanceof IterStep) return e; } finally { if(ct == NodeType.DOC) ctx.value.type = ct; ctx.leaf = leaf; } // no numeric predicates.. use simple iterator if(!has(Flag.FCS)) return new IterStep(info, axis, test, preds); // use iterator for simple numeric predicate return this instanceof IterPosStep || !useIterator() ? this : new IterPosStep(this); } @Override public abstract Step copy(QueryContext ctx, VarScope scp, IntObjMap vs); /** * Checks if this is a simple axis without predicates. * @param ax axis to be checked * @param name name/node test * @return result of check */ public final boolean simple(final Axis ax, final boolean name) { return axis == ax && preds.length == 0 && (name ? test.mode == Mode.LN : test == Test.NOD); } /** * Returns the path nodes that are the result of this step. * @param nodes initial path nodes * @param data data reference * @return resulting path nodes, or {@code null} if nodes cannot be evaluated */ final ArrayList nodes(final ArrayList nodes, final Data data) { // skip steps with predicates or different namespaces if(preds.length != 0 || data.nspaces.globalNS() == null) return null; // check restrictions on node type int kind = -1, name = 0; if(test.type != null) { kind = ANode.kind(test.type); if(kind == Data.PI) return null; if(test.mode == Mode.LN) { // element/attribute test (*:ln) final Names names = kind == Data.ATTR ? data.atnindex : data.tagindex; name = names.id(((NameTest) test).ln); } else if(test.mode != null && test.mode != Mode.ALL) { // skip namespace and standard tests return null; } } // skip axes other than descendant, child, and attribute if(axis != Axis.ATTR && axis != Axis.CHILD && axis != Axis.DESC && axis != Axis.DESCORSELF && axis != Axis.SELF) return null; final ArrayList tmp = new ArrayList(); for(final PathNode n : nodes) { if(axis == Axis.SELF || axis == Axis.DESCORSELF) { if(kind == -1 || kind == n.kind && (name == 0 || name == n.name)) { if(!tmp.contains(n)) tmp.add(n); } } if(axis != Axis.SELF) add(n, tmp, name, kind); } return tmp; } /** * Adds path nodes to the list if they comply with the given test conditions. * @param node root node * @param nodes output nodes * @param name name id, or {@code 0} as wildcard * @param kind node kind, or {@code -1} for all types */ private void add(final PathNode node, final ArrayList nodes, final int name, final int kind) { for(final PathNode n : node.ch) { if(axis == Axis.DESC || axis == Axis.DESCORSELF) { add(n, nodes, name, kind); } if(kind == -1 && n.kind != Data.ATTR ^ axis == Axis.ATTR || kind == n.kind && (name == 0 || name == n.name)) { if(!nodes.contains(n)) nodes.add(n); } } } /** * Adds predicates to the step. * @param prds predicates to be added * @return resulting step instance */ final Step addPreds(final Expr... prds) { for(final Expr p : prds) preds = Array.add(preds, p); return get(info, axis, test, preds); } @Override public final boolean sameAs(final Expr cmp) { if(!(cmp instanceof Step)) return false; final Step st = (Step) cmp; if(preds.length != st.preds.length || axis != st.axis || !test.sameAs(st.test)) return false; for(int p = 0; p < preds.length; ++p) { if(!preds[p].sameAs(st.preds[p])) return false; } return true; } @Override public VarUsage count(final Var v) { return super.count(v); } @Override public Expr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { // leaf flag indicates that a context node can be replaced by a text() step final Type ct = ctx.value != null ? ctx.value.type : null; final boolean leaf = ctx.leaf; ctx.leaf = false; try { // as predicates will not necessarily start from the document node, // the context item type is temporarily generalized if(ct == NodeType.DOC) ctx.value.type = NodeType.NOD; return super.inline(ctx, scp, v, e); } finally { if(ct == NodeType.DOC) ctx.value.type = ct; ctx.leaf = leaf; } } @Override public final void plan(final FElem plan) { final FElem el = planElem(AXIS, axis.name, TEST, test); addPlan(plan, el); super.plan(el); } @Override public final String toString() { final StringBuilder sb = new StringBuilder(); if(test == Test.NOD) { if(axis == Axis.PARENT) sb.append(".."); if(axis == Axis.SELF) sb.append('.'); } if(sb.length() == 0) { if(axis == Axis.ATTR && test instanceof NameTest) sb.append('@'); else if(axis != Axis.CHILD) sb.append(axis).append("::"); sb.append(test); } return sb.append(super.toString()).toString(); } @Override public boolean accept(final ASTVisitor visitor) { for(final Expr e : preds) { visitor.enterFocus(); if(!e.accept(visitor)) return false; visitor.exitFocus(); } return true; } @Override public int exprSize() { int sz = 1; for(final Expr e : preds) sz += e.exprSize(); return sz; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/path/Test.java000066400000000000000000000067621222453003200250750ustar00rootroot00000000000000package org.basex.query.path; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Abstract node test. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class Test { /** Static text node test. */ public static final KindTest TXT = new KindTest(NodeType.TXT); /** Static PI node test. */ public static final KindTest PI = new KindTest(NodeType.PI); /** Static element node test. */ public static final KindTest ELM = new KindTest(NodeType.ELM); /** Static document node test. */ public static final KindTest DOC = new KindTest(NodeType.DOC); /** Static attribute node test. */ public static final KindTest ATT = new KindTest(NodeType.ATT); /** Static comment node test. */ public static final KindTest COM = new KindTest(NodeType.COM); /** Static comment node test. */ public static final KindTest NSP = new KindTest(NodeType.NSP); /** Static node test. */ public static final Test NOD = new KindTest(NodeType.NOD) { @Override public boolean eq(final ANode it) { return true; } }; /** Name test types. */ public enum Mode { /** Accept all nodes (*). */ ALL, /** Test names (*:tag). */ LN, /** Test namespaces (pre:*). */ NS, /** Test all nodes (pre:tag). */ STD } /** Type of node test. */ public NodeType type; /** Type of name test. Set to {@code null} for other kind tests. */ public Mode mode; /** Name test. Set to {@code null} for other kind tests. */ public QNm name; /** Mutable QName instance. */ final QNm tmpq = new QNm(); /** * Returns a test instance. * @param t node type * @return kind test */ public static Test get(final NodeType t) { switch(t) { case TXT: return TXT; case PI: return PI; case ELM: return ELM; case DOC: return DOC; case ATT: return ATT; case COM: return COM; case NOD: return NOD; case NSP: return NSP; default: throw Util.notexpected(); } } /** * Optimizes and compiles the expression. * @param ctx query context * @return false if test always returns false */ @SuppressWarnings("unused") public boolean compile(final QueryContext ctx) { return true; } /** * Tests if the test yields true. * @param node node to be checked * @return result of check */ public abstract boolean eq(final ANode node); /** * Tests if the test yields true. * @param item item to be checked * @return result of check */ public boolean eq(final Item item) { return item instanceof ANode && eq((ANode) item); } /** * Checks the current and specified test for equality. * @param t test to be compared * @return result of check */ public final boolean sameAs(final Test t) { return mode == t.mode && type == t.type && (name == t.name || name.eq(t.name)); } /** * Copies this test. * @return deep copy */ public abstract Test copy(); /** * Checks if this test is namespace-sensitive. * @return result of check */ public boolean nsSensitive() { return name != null; } /** * Computes the intersection between two tests. * @param other other test * @return intersection if it exists, {@code null} otherwise */ public abstract Test intersect(final Test other); } basex-7.7.2/basex-core/src/main/java/org/basex/query/path/package.html000066400000000000000000000000531222453003200255570ustar00rootroot00000000000000 XQuery path expressions. basex-7.7.2/basex-core/src/main/java/org/basex/query/regex/000077500000000000000000000000001222453003200234565ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/regex/BackRef.java000066400000000000000000000007001222453003200256130ustar00rootroot00000000000000package org.basex.query.regex; /** * Back-reference. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public class BackRef extends RegExp { /** Capture group number. */ private final int num; /** * Constructor. * @param n capture group number */ public BackRef(final int n) { num = n; } @Override StringBuilder toRegEx(final StringBuilder sb) { return sb.append('\\').append(num); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/regex/Branch.java000066400000000000000000000007661222453003200255270ustar00rootroot00000000000000package org.basex.query.regex; /** * A branch of a regular expression. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public class Branch extends RegExp { /** Pieces of the regex. */ private final RegExp[] pieces; /** * Constructor. * @param pcs pieces */ public Branch(final RegExp[] pcs) { pieces = pcs; } @Override StringBuilder toRegEx(final StringBuilder sb) { for(final RegExp piece : pieces) piece.toRegEx(sb); return sb; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/regex/CharClass.java000066400000000000000000000015021222453003200261620ustar00rootroot00000000000000package org.basex.query.regex; /** * A character class. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public class CharClass extends RegExp { /** Char group of this class. */ private final CharGroup group; /** Excluded char class, possibly {@code null}. */ private final CharClass subtract; /** * Constructor. * @param grp char group * @param sub excluded char class, possibly {@code null} */ public CharClass(final CharGroup grp, final CharClass sub) { group = grp; subtract = sub; } @Override StringBuilder toRegEx(final StringBuilder sb) { group.toRegEx(sb.append('[')); if(subtract != null) { subtract.group.negative ^= true; subtract.toRegEx(sb.append("&&")); subtract.group.negative ^= true; } return sb.append(']'); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/regex/CharGroup.java000066400000000000000000000011111222453003200262050ustar00rootroot00000000000000package org.basex.query.regex; /** * Character group. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public class CharGroup extends RegExp { /** Negation flag, set after construction. */ public boolean negative; /** Sub-ranges. */ public final RegExp[] subs; /** * Constructor. * @param sub sub-ranges */ public CharGroup(final RegExp[] sub) { subs = sub; } @Override StringBuilder toRegEx(final StringBuilder sb) { sb.append(negative ? "^" : ""); for(final RegExp sub : subs) sub.toRegEx(sb); return sb; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/regex/CharRange.java000066400000000000000000000011301222453003200261460ustar00rootroot00000000000000package org.basex.query.regex; /** * A character range. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public class CharRange extends RegExp { /** Left character. */ private final int left; /** Right character. */ private final int right; /** * Constructor. * @param a left character * @param b right character */ public CharRange(final int a, final int b) { left = a; right = b; } @Override StringBuilder toRegEx(final StringBuilder sb) { return sb.append(Escape.escape(left)).append('-').append(Escape.escape(right)); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/regex/Disjunction.java000066400000000000000000000010501222453003200266060ustar00rootroot00000000000000package org.basex.query.regex; /** * A disjunction of branches. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public class Disjunction extends RegExp { /** Branches. */ private final RegExp[] branches; /** * Constructor. * @param br branches */ public Disjunction(final RegExp[] br) { branches = br; } @Override StringBuilder toRegEx(final StringBuilder sb) { branches[0].toRegEx(sb); for(int i = 1; i < branches.length; i++) branches[i].toRegEx(sb.append('|')); return sb; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/regex/Escape.java000066400000000000000000001071171222453003200255300ustar00rootroot00000000000000package org.basex.query.regex; import java.util.*; import java.util.Map.Entry; /** * Escape sequence. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class Escape extends RegExp { /** Comparator for int ranges. */ private static final Comparator CMP = new Comparator() { @Override public int compare(final int[] o1, final int[] o2) { return o1[0] - o2[0]; } }; /** Character classes. */ private static final Map MAP = new HashMap(); /** Initial name characters. */ private static final String INITIAL; /** Everything except initial name characters. */ private static final String NOT_INITIAL; /** Name characters. */ private static final String CHAR; /** Everything except name characters. */ private static final String NOT_CHAR; /** Word characters. */ private static final String WORD; /** Everything except word characters. */ private static final String NOT_WORD; /** Digits. */ private static final String DIGIT = "\\p{Nd}"; /** Everything except digits. */ private static final String NOT_DIGIT = "\\P{Nd}"; /** Image. */ final String img; /** * Constructor. * @param str image string */ private Escape(final String str) { img = str; } /** * Creates a regular expression from the given escape sequence. * @param esc escape sequence * @return regular expression */ public static RegExp get(final String esc) { if(esc.startsWith("\\p{Is") || esc.startsWith("\\P{Is")) { final CharRange[] rng = MAP.get(esc); return rng != null ? new CharClass(new CharGroup(rng), null) : null; } final String e; switch(esc.charAt(1)) { case 'i': e = '[' + INITIAL + ']'; break; case 'I': e = '[' + NOT_INITIAL + ']'; break; case 'c': e = '[' + CHAR + ']'; break; case 'C': e = '[' + NOT_CHAR + ']'; break; case 'd': e = DIGIT; break; case 'D': e = NOT_DIGIT; break; case 'w': e = '[' + WORD + ']'; break; case 'W': e = '[' + NOT_WORD + ']'; break; default: e = esc; } return new Escape(e); } /** * Gets the character escaped by the given single escape. * @param single single-char escape sequence * @return the escaped char */ public static char getCp(final String single) { switch(single.charAt(1)) { case 'n': return '\n'; case 'r': return '\r'; case 't': return '\t'; default: return single.charAt(1); } } /** * Translates the given escape into character ranges if possible. * @param esc escape sequence * @return array of regular expressions suitable for char groups */ public static RegExp[] inGroup(final String esc) { if(esc.startsWith("\\p{Is") || esc.startsWith("\\P{Is")) { final CharRange[] rng = MAP.get(esc); if(rng != null) return rng; } if(esc.length() > 2) return new RegExp[] { new Escape(esc) }; final String e; switch(esc.charAt(1)) { case 'i': e = INITIAL; break; case 'I': e = NOT_INITIAL; break; case 'c': e = CHAR; break; case 'C': e = NOT_CHAR; break; case 'd': e = DIGIT; break; case 'D': e = NOT_DIGIT; break; case 'w': e = WORD; break; case 'W': e = NOT_WORD; break; default: e = esc; } return new RegExp[] { new Escape(e) }; } @Override StringBuilder toRegEx(final StringBuilder sb) { return sb.append(img); } /** * Reads ranges from a string. * @param string input string * @return ranges */ private static int[][] read(final String string) { final ArrayList ranges = new ArrayList(); for(int i = 0; i < string.length();) { final int[] rng = new int[2]; i += Character.charCount(rng[0] = string.codePointAt(i)); i += Character.charCount(rng[1] = string.codePointAt(i)); ranges.add(rng); } return ranges.toArray(new int[ranges.size()][]); } /** * Merges codepoint ranges. * @param rss ranges * @return merged ranges */ private static int[][] merge(final int[][]... rss) { final ArrayList ranges = new ArrayList(); for(final int[][] rs : rss) Collections.addAll(ranges, rs); Collections.sort(ranges, CMP); for(int i = 0; i < ranges.size(); i++) { final int[] rng = ranges.get(i); while(i + 1 < ranges.size()) { final int[] rng2 = ranges.get(i + 1); if(rng2[0] - rng[1] > 1) break; rng[1] = rng2[1]; ranges.remove(i + 1); } } return ranges.toArray(new int[ranges.size()][]); } /** * Inverts code point ranges. * @param rng ranges * @return inverted ranges */ private static int[][] invert(final int[][] rng) { int start = Character.MIN_CODE_POINT; final ArrayList ranges = new ArrayList(); for(final int[] in : rng) { if(in[0] - 1 >= start) ranges.add(new int[] { start, in[0] - 1 }); start = in[1] + 1; } if(start <= Character.MAX_CODE_POINT) ranges.add(new int[] { start, Character.MAX_CODE_POINT }); return ranges.toArray(new int[ranges.size()][]); } /** * Serializes the given ranges to a string. * @param ranges ranges to serialize * @return resulting string */ private static String serialize(final int[][] ranges) { final StringBuilder sb = new StringBuilder(); for(final int[] rng : ranges) { sb.append(escape(rng[0])); if(rng[1] != rng[0]) sb.append('-').append(escape(rng[1])); } return sb.toString(); } /** * Escapes code points for use in character ranges. * @param cp code point * @return char representation */ public static char[] escape(final int cp) { switch(cp) { case '[': case ']': case '-': case '\\': case '^': return new char[] { '\\', (char) cp }; case '\n': return new char[] { '\\', 'n' }; case '\r': return new char[] { '\\', 'r' }; case '\t': return new char[] { '\\', 't' }; default: return Character.toChars(cp); } } /** * Adds a new named character range to the map. * @param m map * @param n name * @param r range */ private static void add(final Map m, final String n, final int[] r) { final int[][] old = m.get(n), nw = new int[][] { r }; m.put(n, old == null ? nw : merge(old, nw)); } static { // taken from http://www.w3.org/TR/2000/WD-xml-2e-20000814#NT-Letter final int[][] baseChar = read("\u0041\u005A\u0061\u007A\u00C0\u00D6\u00D8\u00F6" + "\u00F8\u00FF\u0100\u0131\u0134\u013E\u0141\u0148\u014A\u017E\u0180\u01C3\u01CD" + "\u01F0\u01F4\u01F5\u01FA\u0217\u0250\u02A8\u02BB\u02C1\u0386\u0386\u0388\u038A" + "\u038C\u038C\u038E\u03A1\u03A3\u03CE\u03D0\u03D6\u03DA\u03DA\u03DC\u03DC\u03DE" + "\u03DE\u03E0\u03E0\u03E2\u03F3\u0401\u040C\u040E\u044F\u0451\u045C\u045E\u0481" + "\u0490\u04C4\u04C7\u04C8\u04CB\u04CC\u04D0\u04EB\u04EE\u04F5\u04F8\u04F9\u0531" + "\u0556\u0559\u0559\u0561\u0586\u05D0\u05EA\u05F0\u05F2\u0621\u063A\u0641\u064A" + "\u0671\u06B7\u06BA\u06BE\u06C0\u06CE\u06D0\u06D3\u06D5\u06D5\u06E5\u06E6\u0905" + "\u0939\u093D\u093D\u0958\u0961\u0985\u098C\u098F\u0990\u0993\u09A8\u09AA\u09B0" + "\u09B2\u09B2\u09B6\u09B9\u09DC\u09DD\u09DF\u09E1\u09F0\u09F1\u0A05\u0A0A\u0A0F" + "\u0A10\u0A13\u0A28\u0A2A\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59\u0A5C" + "\u0A5E\u0A5E\u0A72\u0A74\u0A85\u0A8B\u0A8D\u0A8D\u0A8F\u0A91\u0A93\u0AA8\u0AAA" + "\u0AB0\u0AB2\u0AB3\u0AB5\u0AB9\u0ABD\u0ABD\u0AE0\u0AE0\u0B05\u0B0C\u0B0F\u0B10" + "\u0B13\u0B28\u0B2A\u0B30\u0B32\u0B33\u0B36\u0B39\u0B3D\u0B3D\u0B5C\u0B5D\u0B5F" + "\u0B61\u0B85\u0B8A\u0B8E\u0B90\u0B92\u0B95\u0B99\u0B9A\u0B9C\u0B9C\u0B9E\u0B9F" + "\u0BA3\u0BA4\u0BA8\u0BAA\u0BAE\u0BB5\u0BB7\u0BB9\u0C05\u0C0C\u0C0E\u0C10\u0C12" + "\u0C28\u0C2A\u0C33\u0C35\u0C39\u0C60\u0C61\u0C85\u0C8C\u0C8E\u0C90\u0C92\u0CA8" + "\u0CAA\u0CB3\u0CB5\u0CB9\u0CDE\u0CDE\u0CE0\u0CE1\u0D05\u0D0C\u0D0E\u0D10\u0D12" + "\u0D28\u0D2A\u0D39\u0D60\u0D61\u0E01\u0E2E\u0E30\u0E30\u0E32\u0E33\u0E40\u0E45" + "\u0E81\u0E82\u0E84\u0E84\u0E87\u0E88\u0E8A\u0E8A\u0E8D\u0E8D\u0E94\u0E97\u0E99" + "\u0E9F\u0EA1\u0EA3\u0EA5\u0EA5\u0EA7\u0EA7\u0EAA\u0EAB\u0EAD\u0EAE\u0EB0\u0EB0" + "\u0EB2\u0EB3\u0EBD\u0EBD\u0EC0\u0EC4\u0F40\u0F47\u0F49\u0F69\u10A0\u10C5\u10D0" + "\u10F6\u1100\u1100\u1102\u1103\u1105\u1107\u1109\u1109\u110B\u110C\u110E\u1112" + "\u113C\u113C\u113E\u113E\u1140\u1140\u114C\u114C\u114E\u114E\u1150\u1150\u1154" + "\u1155\u1159\u1159\u115F\u1161\u1163\u1163\u1165\u1165\u1167\u1167\u1169\u1169" + "\u116D\u116E\u1172\u1173\u1175\u1175\u119E\u119E\u11A8\u11A8\u11AB\u11AB\u11AE" + "\u11AF\u11B7\u11B8\u11BA\u11BA\u11BC\u11C2\u11EB\u11EB\u11F0\u11F0\u11F9\u11F9" + "\u1E00\u1E9B\u1EA0\u1EF9\u1F00\u1F15\u1F18\u1F1D\u1F20\u1F45\u1F48\u1F4D\u1F50" + "\u1F57\u1F59\u1F59\u1F5B\u1F5B\u1F5D\u1F5D\u1F5F\u1F7D\u1F80\u1FB4\u1FB6\u1FBC" + "\u1FBE\u1FBE\u1FC2\u1FC4\u1FC6\u1FCC\u1FD0\u1FD3\u1FD6\u1FDB\u1FE0\u1FEC\u1FF2" + "\u1FF4\u1FF6\u1FFC\u2126\u2126\u212A\u212B\u212E\u212E\u2180\u2182\u3041\u3094" + "\u30A1\u30FA\u3105\u312C\uAC00\uD7A3"); final int[][] ideographic = read("\u4E00\u9FA5\u3007\u3007\u3021\u3029"); final int[][] combiningChar = read("\u0300\u0345\u0360\u0361\u0483\u0486\u0591" + "\u05A1\u05A3\u05B9\u05BB\u05BD\u05BF\u05BF\u05C1\u05C2\u05C4\u05C4\u064B\u0652" + "\u0670\u0670\u06D6\u06DC\u06DD\u06DF\u06E0\u06E4\u06E7\u06E8\u06EA\u06ED\u0901" + "\u0903\u093C\u093C\u093E\u094C\u094D\u094D\u0951\u0954\u0962\u0963\u0981\u0983" + "\u09BC\u09BC\u09BE\u09BE\u09BF\u09BF\u09C0\u09C4\u09C7\u09C8\u09CB\u09CD\u09D7" + "\u09D7\u09E2\u09E3\u0A02\u0A02\u0A3C\u0A3C\u0A3E\u0A3E\u0A3F\u0A3F\u0A40\u0A42" + "\u0A47\u0A48\u0A4B\u0A4D\u0A70\u0A71\u0A81\u0A83\u0ABC\u0ABC\u0ABE\u0AC5\u0AC7" + "\u0AC9\u0ACB\u0ACD\u0B01\u0B03\u0B3C\u0B3C\u0B3E\u0B43\u0B47\u0B48\u0B4B\u0B4D" + "\u0B56\u0B57\u0B82\u0B83\u0BBE\u0BC2\u0BC6\u0BC8\u0BCA\u0BCD\u0BD7\u0BD7\u0C01" + "\u0C03\u0C3E\u0C44\u0C46\u0C48\u0C4A\u0C4D\u0C55\u0C56\u0C82\u0C83\u0CBE\u0CC4" + "\u0CC6\u0CC8\u0CCA\u0CCD\u0CD5\u0CD6\u0D02\u0D03\u0D3E\u0D43\u0D46\u0D48\u0D4A" + "\u0D4D\u0D57\u0D57\u0E31\u0E31\u0E34\u0E3A\u0E47\u0E4E\u0EB1\u0EB1\u0EB4\u0EB9" + "\u0EBB\u0EBC\u0EC8\u0ECD\u0F18\u0F19\u0F35\u0F35\u0F37\u0F37\u0F39\u0F39\u0F3E" + "\u0F3E\u0F3F\u0F3F\u0F71\u0F84\u0F86\u0F8B\u0F90\u0F95\u0F97\u0F97\u0F99\u0FAD" + "\u0FB1\u0FB7\u0FB9\u0FB9\u20D0\u20DC\u20E1\u20E1\u302A\u302F\u3099\u3099\u309A" + '\u309A'); final int[][] digit = read("\u0030\u0039\u0660\u0669\u06F0\u06F9\u0966\u096F\u09E6" + "\u09EF\u0A66\u0A6F\u0AE6\u0AEF\u0B66\u0B6F\u0BE7\u0BEF\u0C66\u0C6F\u0CE6\u0CEF" + "\u0D66\u0D6F\u0E50\u0E59\u0ED0\u0ED9\u0F20\u0F29"); final int[][] extender = read("\u00B7\u00B7\u02D0\u02D0\u02D1\u02D1\u0387\u0387" + "\u0640\u0640\u0E46\u0E46\u0EC6\u0EC6\u3005\u3005\u3031\u3035\u309D\u309E\u30FC" + '\u30FE'); final int[][] word = read("\u0024\u0024\u002b\u002b\u0030\u0039\u003c\u003e\u0041" + "\u005a\u005e\u005e\u0060\u007a\u007c\u007c\u007e\u007e\u00a2\u00aa\u00ac\u00ac" + "\u00ae\u00b6\u00b8\u00ba\u00bc\u00be\u00c0\u0377\u037a\u037d\u0384\u0386\u0388" + "\u038a\u038c\u038c\u038e\u03a1\u03a3\u0527\u0531\u0556\u0559\u0559\u0561\u0587" + "\u0591\u05bd\u05bf\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u05c7\u05d0\u05ea\u05f0" + "\u05f2\u0606\u0608\u060b\u060b\u060e\u061a\u0620\u0669\u066e\u06d3\u06d5\u06dc" + "\u06de\u06ff\u0710\u074a\u074d\u07b1\u07c0\u07f6\u07fa\u07fa\u0800\u082d\u0840" + "\u085b\u0900\u0963\u0966\u096f\u0971\u0977\u0979\u097f\u0981\u0983\u0985\u098c" + "\u098f\u0990\u0993\u09a8\u09aa\u09b0\u09b2\u09b2\u09b6\u09b9\u09bc\u09c4\u09c7" + "\u09c8\u09cb\u09ce\u09d7\u09d7\u09dc\u09dd\u09df\u09e3\u09e6\u09fb\u0a01\u0a03" + "\u0a05\u0a0a\u0a0f\u0a10\u0a13\u0a28\u0a2a\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38" + "\u0a39\u0a3c\u0a3c\u0a3e\u0a42\u0a47\u0a48\u0a4b\u0a4d\u0a51\u0a51\u0a59\u0a5c" + "\u0a5e\u0a5e\u0a66\u0a75\u0a81\u0a83\u0a85\u0a8d\u0a8f\u0a91\u0a93\u0aa8\u0aaa" + "\u0ab0\u0ab2\u0ab3\u0ab5\u0ab9\u0abc\u0ac5\u0ac7\u0ac9\u0acb\u0acd\u0ad0\u0ad0" + "\u0ae0\u0ae3\u0ae6\u0aef\u0af1\u0af1\u0b01\u0b03\u0b05\u0b0c\u0b0f\u0b10\u0b13" + "\u0b28\u0b2a\u0b30\u0b32\u0b33\u0b35\u0b39\u0b3c\u0b44\u0b47\u0b48\u0b4b\u0b4d" + "\u0b56\u0b57\u0b5c\u0b5d\u0b5f\u0b63\u0b66\u0b77\u0b82\u0b83\u0b85\u0b8a\u0b8e" + "\u0b90\u0b92\u0b95\u0b99\u0b9a\u0b9c\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8\u0baa" + "\u0bae\u0bb9\u0bbe\u0bc2\u0bc6\u0bc8\u0bca\u0bcd\u0bd0\u0bd0\u0bd7\u0bd7\u0be6" + "\u0bfa\u0c01\u0c03\u0c05\u0c0c\u0c0e\u0c10\u0c12\u0c28\u0c2a\u0c33\u0c35\u0c39" + "\u0c3d\u0c44\u0c46\u0c48\u0c4a\u0c4d\u0c55\u0c56\u0c58\u0c59\u0c60\u0c63\u0c66" + "\u0c6f\u0c78\u0c7f\u0c82\u0c83\u0c85\u0c8c\u0c8e\u0c90\u0c92\u0ca8\u0caa\u0cb3" + "\u0cb5\u0cb9\u0cbc\u0cc4\u0cc6\u0cc8\u0cca\u0ccd\u0cd5\u0cd6\u0cde\u0cde\u0ce0" + "\u0ce3\u0ce6\u0cef\u0cf1\u0cf2\u0d02\u0d03\u0d05\u0d0c\u0d0e\u0d10\u0d12\u0d3a" + "\u0d3d\u0d44\u0d46\u0d48\u0d4a\u0d4e\u0d57\u0d57\u0d60\u0d63\u0d66\u0d75\u0d79" + "\u0d7f\u0d82\u0d83\u0d85\u0d96\u0d9a\u0db1\u0db3\u0dbb\u0dbd\u0dbd\u0dc0\u0dc6" + "\u0dca\u0dca\u0dcf\u0dd4\u0dd6\u0dd6\u0dd8\u0ddf\u0df2\u0df3\u0e01\u0e3a\u0e3f" + "\u0e4e\u0e50\u0e59\u0e81\u0e82\u0e84\u0e84\u0e87\u0e88\u0e8a\u0e8a\u0e8d\u0e8d" + "\u0e94\u0e97\u0e99\u0e9f\u0ea1\u0ea3\u0ea5\u0ea5\u0ea7\u0ea7\u0eaa\u0eab\u0ead" + "\u0eb9\u0ebb\u0ebd\u0ec0\u0ec4\u0ec6\u0ec6\u0ec8\u0ecd\u0ed0\u0ed9\u0edc\u0edd" + "\u0f00\u0f03\u0f13\u0f39\u0f3e\u0f47\u0f49\u0f6c\u0f71\u0f84\u0f86\u0f97\u0f99" + "\u0fbc\u0fbe\u0fcc\u0fce\u0fcf\u0fd5\u0fd8\u1000\u1049\u1050\u10c5\u10d0\u10fa" + "\u10fc\u10fc\u1100\u1248\u124a\u124d\u1250\u1256\u1258\u1258\u125a\u125d\u1260" + "\u1288\u128a\u128d\u1290\u12b0\u12b2\u12b5\u12b8\u12be\u12c0\u12c0\u12c2\u12c5" + "\u12c8\u12d6\u12d8\u1310\u1312\u1315\u1318\u135a\u135d\u1360\u1369\u137c\u1380" + "\u1399\u13a0\u13f4\u1401\u166c\u166f\u167f\u1681\u169a\u16a0\u16ea\u16ee\u16f0" + "\u1700\u170c\u170e\u1714\u1720\u1734\u1740\u1753\u1760\u176c\u176e\u1770\u1772" + "\u1773\u1780\u17b3\u17b6\u17d3\u17d7\u17d7\u17db\u17dd\u17e0\u17e9\u17f0\u17f9" + "\u180b\u180d\u1810\u1819\u1820\u1877\u1880\u18aa\u18b0\u18f5\u1900\u191c\u1920" + "\u192b\u1930\u193b\u1940\u1940\u1946\u196d\u1970\u1974\u1980\u19ab\u19b0\u19c9" + "\u19d0\u19da\u19de\u1a1b\u1a20\u1a5e\u1a60\u1a7c\u1a7f\u1a89\u1a90\u1a99\u1aa7" + "\u1aa7\u1b00\u1b4b\u1b50\u1b59\u1b61\u1b7c\u1b80\u1baa\u1bae\u1bb9\u1bc0\u1bf3" + "\u1c00\u1c37\u1c40\u1c49\u1c4d\u1c7d\u1cd0\u1cd2\u1cd4\u1cf2\u1d00\u1de6\u1dfc" + "\u1f15\u1f18\u1f1d\u1f20\u1f45\u1f48\u1f4d\u1f50\u1f57\u1f59\u1f59\u1f5b\u1f5b" + "\u1f5d\u1f5d\u1f5f\u1f7d\u1f80\u1fb4\u1fb6\u1fc4\u1fc6\u1fd3\u1fd6\u1fdb\u1fdd" + "\u1fef\u1ff2\u1ff4\u1ff6\u1ffe\u2044\u2044\u2052\u2052\u2070\u2071\u2074\u207c" + "\u207f\u208c\u2090\u209c\u20a0\u20b9\u20d0\u20f0\u2100\u2189\u2190\u2328\u232b" + "\u23f3\u2400\u2426\u2440\u244a\u2460\u26ff\u2701\u2767\u2776\u27c4\u27c7\u27ca" + "\u27cc\u27cc\u27ce\u27e5\u27f0\u2982\u2999\u29d7\u29dc\u29fb\u29fe\u2b4c\u2b50" + "\u2b59\u2c00\u2c2e\u2c30\u2c5e\u2c60\u2cf1\u2cfd\u2cfd\u2d00\u2d25\u2d30\u2d65" + "\u2d6f\u2d6f\u2d7f\u2d96\u2da0\u2da6\u2da8\u2dae\u2db0\u2db6\u2db8\u2dbe\u2dc0" + "\u2dc6\u2dc8\u2dce\u2dd0\u2dd6\u2dd8\u2dde\u2de0\u2dff\u2e2f\u2e2f\u2e80\u2e99" + "\u2e9b\u2ef3\u2f00\u2fd5\u2ff0\u2ffb\u3004\u3007\u3012\u3013\u3020\u302f\u3031" + "\u303c\u303e\u303f\u3041\u3096\u3099\u309f\u30a1\u30fa\u30fc\u30ff\u3105\u312d" + "\u3131\u318e\u3190\u31ba\u31c0\u31e3\u31f0\u321e\u3220\u32fe\u3300\u4db5\u4dc0" + "\u9fcb\ua000\ua48c\ua490\ua4c6\ua4d0\ua4fd\ua500\ua60c\ua610\ua62b\ua640\ua672" + "\ua67c\ua67d\ua67f\ua697\ua6a0\ua6f1\ua700\ua78e\ua790\ua791\ua7a0\ua7a9\ua7fa" + "\ua82b\ua830\ua839\ua840\ua873\ua880\ua8c4\ua8d0\ua8d9\ua8e0\ua8f7\ua8fb\ua8fb" + "\ua900\ua92d\ua930\ua953\ua960\ua97c\ua980\ua9c0\ua9cf\ua9d9\uaa00\uaa36\uaa40" + "\uaa4d\uaa50\uaa59\uaa60\uaa7b\uaa80\uaac2\uaadb\uaadd\uab01\uab06\uab09\uab0e" + "\uab11\uab16\uab20\uab26\uab28\uab2e\uabc0\uabea\uabec\uabed\uabf0\uabf9\uac00" + "\ud7a3\ud7b0\ud7c6\ud7cb\ud7fb\uf900\ufa2d\ufa30\ufa6d\ufa70\ufad9\ufb00\ufb06" + "\ufb13\ufb17\ufb1d\ufb36\ufb38\ufb3c\ufb3e\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46" + "\ufbc1\ufbd3\ufd3d\ufd50\ufd8f\ufd92\ufdc7\ufdd0\ufdfd\ufe00\ufe0f\ufe20\ufe26" + "\ufe62\ufe62\ufe64\ufe66\ufe69\ufe69\ufe70\ufe74\ufe76\ufefc\uff04\uff04\uff0b" + "\uff0b\uff10\uff19\uff1c\uff1e\uff21\uff3a\uff3e\uff3e\uff40\uff5a\uff5c\uff5c" + "\uff5e\uff5e\uff66\uffbe\uffc2\uffc7\uffca\uffcf\uffd2\uffd7\uffda\uffdc\uffe0" + "\uffe6\uffe8\uffee\ufffc\ufffd\ud800\udc00\ud800\udc0b\ud800\udc0d\ud800\udc26" + "\ud800\udc28\ud800\udc3a\ud800\udc3c\ud800\udc3d\ud800\udc3f\ud800\udc4d\ud800" + "\udc50\ud800\udc5d\ud800\udc80\ud800\udcfa\ud800\udd02\ud800\udd02\ud800\udd07" + "\ud800\udd33\ud800\udd37\ud800\udd8a\ud800\udd90\ud800\udd9b\ud800\uddd0\ud800" + "\uddfd\ud800\ude80\ud800\ude9c\ud800\udea0\ud800\uded0\ud800\udf00\ud800\udf1e" + "\ud800\udf20\ud800\udf23\ud800\udf30\ud800\udf4a\ud800\udf80\ud800\udf9d\ud800" + "\udfa0\ud800\udfc3\ud800\udfc8\ud800\udfcf\ud800\udfd1\ud800\udfd5\ud801\udc00" + "\ud801\udc9d\ud801\udca0\ud801\udca9\ud802\udc00\ud802\udc05\ud802\udc08\ud802" + "\udc08\ud802\udc0a\ud802\udc35\ud802\udc37\ud802\udc38\ud802\udc3c\ud802\udc3c" + "\ud802\udc3f\ud802\udc55\ud802\udc58\ud802\udc5f\ud802\udd00\ud802\udd1b\ud802" + "\udd20\ud802\udd39\ud802\ude00\ud802\ude03\ud802\ude05\ud802\ude06\ud802\ude0c" + "\ud802\ude13\ud802\ude15\ud802\ude17\ud802\ude19\ud802\ude33\ud802\ude38\ud802" + "\ude3a\ud802\ude3f\ud802\ude47\ud802\ude60\ud802\ude7e\ud802\udf00\ud802\udf35" + "\ud802\udf40\ud802\udf55\ud802\udf58\ud802\udf72\ud802\udf78\ud802\udf7f\ud803" + "\udc00\ud803\udc48\ud803\ude60\ud803\ude7e\ud804\udc00\ud804\udc46\ud804\udc52" + "\ud804\udc6f\ud804\udc80\ud804\udcba\ud808\udc00\ud808\udf6e\ud809\udc00\ud809" + "\udc62\ud80c\udc00\ud80d\udc2e\ud81a\udc00\ud81a\ude38\ud82c\udc00\ud82c\udc01" + "\ud834\udc00\ud834\udcf5\ud834\udd00\ud834\udd26\ud834\udd29\ud834\udd72\ud834" + "\udd7b\ud834\udddd\ud834\ude00\ud834\ude45\ud834\udf00\ud834\udf56\ud834\udf60" + "\ud834\udf71\ud835\udc00\ud835\udc54\ud835\udc56\ud835\udc9c\ud835\udc9e\ud835" + "\udc9f\ud835\udca2\ud835\udca2\ud835\udca5\ud835\udca6\ud835\udca9\ud835\udcac" + "\ud835\udcae\ud835\udcb9\ud835\udcbb\ud835\udcbb\ud835\udcbd\ud835\udcc3\ud835" + "\udcc5\ud835\udd05\ud835\udd07\ud835\udd0a\ud835\udd0d\ud835\udd14\ud835\udd16" + "\ud835\udd1c\ud835\udd1e\ud835\udd39\ud835\udd3b\ud835\udd3e\ud835\udd40\ud835" + "\udd44\ud835\udd46\ud835\udd46\ud835\udd4a\ud835\udd50\ud835\udd52\ud835\udea5" + "\ud835\udea8\ud835\udfcb\ud835\udfce\ud835\udfff\ud83c\udc00\ud83c\udc2b\ud83c" + "\udc30\ud83c\udc93\ud83c\udca0\ud83c\udcae\ud83c\udcb1\ud83c\udcbe\ud83c\udcc1" + "\ud83c\udccf\ud83c\udcd1\ud83c\udcdf\ud83c\udd00\ud83c\udd0a\ud83c\udd10\ud83c" + "\udd2e\ud83c\udd30\ud83c\udd69\ud83c\udd70\ud83c\udd9a\ud83c\udde6\ud83c\ude02" + "\ud83c\ude10\ud83c\ude3a\ud83c\ude40\ud83c\ude48\ud83c\ude50\ud83c\ude51\ud83c" + "\udf00\ud83c\udf20\ud83c\udf30\ud83c\udf35\ud83c\udf37\ud83c\udf7c\ud83c\udf80" + "\ud83c\udf93\ud83c\udfa0\ud83c\udfc4\ud83c\udfc6\ud83c\udfca\ud83c\udfe0\ud83c" + "\udff0\ud83d\udc00\ud83d\udc3e\ud83d\udc40\ud83d\udc40\ud83d\udc42\ud83d\udcf7" + "\ud83d\udcf9\ud83d\udcfc\ud83d\udd00\ud83d\udd3d\ud83d\udd50\ud83d\udd67\ud83d" + "\uddfb\ud83d\uddff\ud83d\ude01\ud83d\ude10\ud83d\ude12\ud83d\ude14\ud83d\ude16" + "\ud83d\ude16\ud83d\ude18\ud83d\ude18\ud83d\ude1a\ud83d\ude1a\ud83d\ude1c\ud83d" + "\ude1e\ud83d\ude20\ud83d\ude25\ud83d\ude28\ud83d\ude2b\ud83d\ude2d\ud83d\ude2d" + "\ud83d\ude30\ud83d\ude33\ud83d\ude35\ud83d\ude40\ud83d\ude45\ud83d\ude4f\ud83d" + "\ude80\ud83d\udec5\ud83d\udf00\ud83d\udf73\ud83f\udffe\ud869\uded6\ud869\udf00" + "\ud86d\udf34\ud86d\udf40\ud86e\udc1d\ud87e\udc00\ud87e\ude1d\ud87f\udffe\ud87f" + "\udfff\ud8bf\udffe\ud8bf\udfff\ud8ff\udffe\ud8ff\udfff\ud93f\udffe\ud93f\udfff" + "\ud97f\udffe\ud97f\udfff\ud9bf\udffe\ud9bf\udfff\ud9ff\udffe\ud9ff\udfff\uda3f" + "\udffe\uda3f\udfff\uda7f\udffe\uda7f\udfff\udabf\udffe\udabf\udfff\udaff\udffe" + "\udaff\udfff\udb3f\udffe\udb3f\udfff\udb40\udd00\udb40\uddef\udb7f\udffe\udb7f" + "\udfff\udbbf\udffe\udbbf\udfff\udbff\udffe\udbff\udfff"); final int[][] letter = merge(baseChar, ideographic), initialNameChar = merge(letter, read("__::")), nameChar = merge(initialNameChar, digit, read("-."), combiningChar, extender); INITIAL = serialize(initialNameChar); NOT_INITIAL = serialize(invert(initialNameChar)); CHAR = serialize(nameChar); NOT_CHAR = serialize(invert(nameChar)); WORD = serialize(word); NOT_WORD = serialize(invert(word)); // easy to reproduce from http://www.w3.org/TR/xsd-unicode-blocknames/#blocks final HashMap m = new HashMap(); add(m, "BasicLatin", new int[] { 0x0000, 0x007F }); add(m, "Latin-1Supplement", new int[] { 0x0080, 0x00FF }); add(m, "LatinExtended-A", new int[] { 0x0100, 0x017F }); add(m, "LatinExtended-B", new int[] { 0x0180, 0x024F }); add(m, "IPAExtensions", new int[] { 0x0250, 0x02AF }); add(m, "SpacingModifierLetters", new int[] { 0x02B0, 0x02FF }); add(m, "CombiningDiacriticalMarks", new int[] { 0x0300, 0x036F }); add(m, "Greek", new int[] { 0x0370, 0x03FF }); add(m, "GreekandCoptic", new int[] { 0x0370, 0x03FF }); add(m, "Cyrillic", new int[] { 0x0400, 0x04FF }); add(m, "CyrillicSupplementary", new int[] { 0x0500, 0x052F }); add(m, "CyrillicSupplement", new int[] { 0x0500, 0x052F }); add(m, "Armenian", new int[] { 0x0530, 0x058F }); add(m, "Hebrew", new int[] { 0x0590, 0x05FF }); add(m, "Arabic", new int[] { 0x0600, 0x06FF }); add(m, "Syriac", new int[] { 0x0700, 0x074F }); add(m, "ArabicSupplement", new int[] { 0x0750, 0x077F }); add(m, "Thaana", new int[] { 0x0780, 0x07BF }); add(m, "NKo", new int[] { 0x07C0, 0x07FF }); add(m, "Samaritan", new int[] { 0x0800, 0x083F }); add(m, "Mandaic", new int[] { 0x0840, 0x085F }); add(m, "Devanagari", new int[] { 0x0900, 0x097F }); add(m, "Bengali", new int[] { 0x0980, 0x09FF }); add(m, "Gurmukhi", new int[] { 0x0A00, 0x0A7F }); add(m, "Gujarati", new int[] { 0x0A80, 0x0AFF }); add(m, "Oriya", new int[] { 0x0B00, 0x0B7F }); add(m, "Tamil", new int[] { 0x0B80, 0x0BFF }); add(m, "Telugu", new int[] { 0x0C00, 0x0C7F }); add(m, "Kannada", new int[] { 0x0C80, 0x0CFF }); add(m, "Malayalam", new int[] { 0x0D00, 0x0D7F }); add(m, "Sinhala", new int[] { 0x0D80, 0x0DFF }); add(m, "Thai", new int[] { 0x0E00, 0x0E7F }); add(m, "Lao", new int[] { 0x0E80, 0x0EFF }); add(m, "Tibetan", new int[] { 0x0F00, 0x0FBF }); add(m, "Tibetan", new int[] { 0x0F00, 0x0FFF }); add(m, "Myanmar", new int[] { 0x1000, 0x109F }); add(m, "Georgian", new int[] { 0x10A0, 0x10FF }); add(m, "HangulJamo", new int[] { 0x1100, 0x11FF }); add(m, "Ethiopic", new int[] { 0x1200, 0x137F }); add(m, "EthiopicSupplement", new int[] { 0x1380, 0x139F }); add(m, "Cherokee", new int[] { 0x13A0, 0x13FF }); add(m, "UnifiedCanadianAboriginalSyllabics", new int[] { 0x1400, 0x167F }); add(m, "Ogham", new int[] { 0x1680, 0x169F }); add(m, "Runic", new int[] { 0x16A0, 0x16FF }); add(m, "Tagalog", new int[] { 0x1700, 0x171F }); add(m, "Hanunoo", new int[] { 0x1720, 0x173F }); add(m, "Buhid", new int[] { 0x1740, 0x175F }); add(m, "Tagbanwa", new int[] { 0x1760, 0x177F }); add(m, "Khmer", new int[] { 0x1780, 0x17FF }); add(m, "Mongolian", new int[] { 0x1800, 0x18AF }); add(m, "UnifiedCanadianAboriginalSyllabicsExtended", new int[] { 0x18B0, 0x18FF }); add(m, "Limbu", new int[] { 0x1900, 0x194F }); add(m, "TaiLe", new int[] { 0x1950, 0x197F }); add(m, "NewTaiLue", new int[] { 0x1980, 0x19DF }); add(m, "KhmerSymbols", new int[] { 0x19E0, 0x19FF }); add(m, "Buginese", new int[] { 0x1A00, 0x1A1F }); add(m, "TaiTham", new int[] { 0x1A20, 0x1AAF }); add(m, "Balinese", new int[] { 0x1B00, 0x1B7F }); add(m, "Sundanese", new int[] { 0x1B80, 0x1BBF }); add(m, "Batak", new int[] { 0x1BC0, 0x1BFF }); add(m, "Lepcha", new int[] { 0x1C00, 0x1C4F }); add(m, "OlChiki", new int[] { 0x1C50, 0x1C7F }); add(m, "VedicExtensions", new int[] { 0x1CD0, 0x1CFF }); add(m, "PhoneticExtensions", new int[] { 0x1D00, 0x1D7F }); add(m, "PhoneticExtensionsSupplement", new int[] { 0x1D80, 0x1DBF }); add(m, "CombiningDiacriticalMarksSupplement", new int[] { 0x1DC0, 0x1DFF }); add(m, "LatinExtendedAdditional", new int[] { 0x1E00, 0x1EFF }); add(m, "GreekExtended", new int[] { 0x1F00, 0x1FFF }); add(m, "GeneralPunctuation", new int[] { 0x2000, 0x206F }); add(m, "SuperscriptsandSubscripts", new int[] { 0x2070, 0x209F }); add(m, "CurrencySymbols", new int[] { 0x20A0, 0x20CF }); add(m, "CombiningMarksforSymbols", new int[] { 0x20D0, 0x20FF }); add(m, "CombiningDiacriticalMarksforSymbols", new int[] { 0x20D0, 0x20FF }); add(m, "LetterlikeSymbols", new int[] { 0x2100, 0x214F }); add(m, "NumberForms", new int[] { 0x2150, 0x218F }); add(m, "Arrows", new int[] { 0x2190, 0x21FF }); add(m, "MathematicalOperators", new int[] { 0x2200, 0x22FF }); add(m, "MiscellaneousTechnical", new int[] { 0x2300, 0x23FF }); add(m, "ControlPictures", new int[] { 0x2400, 0x243F }); add(m, "OpticalCharacterRecognition", new int[] { 0x2440, 0x245F }); add(m, "EnclosedAlphanumerics", new int[] { 0x2460, 0x24FF }); add(m, "BoxDrawing", new int[] { 0x2500, 0x257F }); add(m, "BlockElements", new int[] { 0x2580, 0x259F }); add(m, "GeometricShapes", new int[] { 0x25A0, 0x25FF }); add(m, "MiscellaneousSymbols", new int[] { 0x2600, 0x26FF }); add(m, "Dingbats", new int[] { 0x2700, 0x27BF }); add(m, "MiscellaneousMathematicalSymbols-A", new int[] { 0x27C0, 0x27EF }); add(m, "SupplementalArrows-A", new int[] { 0x27F0, 0x27FF }); add(m, "BraillePatterns", new int[] { 0x2800, 0x28FF }); add(m, "SupplementalArrows-B", new int[] { 0x2900, 0x297F }); add(m, "MiscellaneousMathematicalSymbols-B", new int[] { 0x2980, 0x29FF }); add(m, "SupplementalMathematicalOperators", new int[] { 0x2A00, 0x2AFF }); add(m, "MiscellaneousSymbolsandArrows", new int[] { 0x2B00, 0x2BFF }); add(m, "Glagolitic", new int[] { 0x2C00, 0x2C5F }); add(m, "LatinExtended-C", new int[] { 0x2C60, 0x2C7F }); add(m, "Coptic", new int[] { 0x2C80, 0x2CFF }); add(m, "GeorgianSupplement", new int[] { 0x2D00, 0x2D2F }); add(m, "Tifinagh", new int[] { 0x2D30, 0x2D7F }); add(m, "EthiopicExtended", new int[] { 0x2D80, 0x2DDF }); add(m, "CyrillicExtended-A", new int[] { 0x2DE0, 0x2DFF }); add(m, "SupplementalPunctuation", new int[] { 0x2E00, 0x2E7F }); add(m, "CJKRadicalsSupplement", new int[] { 0x2E80, 0x2EFF }); add(m, "KangxiRadicals", new int[] { 0x2F00, 0x2FDF }); add(m, "IdeographicDescriptionCharacters", new int[] { 0x2FF0, 0x2FFF }); add(m, "CJKSymbolsandPunctuation", new int[] { 0x3000, 0x303F }); add(m, "Hiragana", new int[] { 0x3040, 0x309F }); add(m, "Katakana", new int[] { 0x30A0, 0x30FF }); add(m, "Bopomofo", new int[] { 0x3100, 0x312F }); add(m, "HangulCompatibilityJamo", new int[] { 0x3130, 0x318F }); add(m, "Kanbun", new int[] { 0x3190, 0x319F }); add(m, "BopomofoExtended", new int[] { 0x31A0, 0x31BF }); add(m, "CJKStrokes", new int[] { 0x31C0, 0x31EF }); add(m, "KatakanaPhoneticExtensions", new int[] { 0x31F0, 0x31FF }); add(m, "EnclosedCJKLettersandMonths", new int[] { 0x3200, 0x32FF }); add(m, "CJKCompatibility", new int[] { 0x3300, 0x33FF }); add(m, "CJKUnifiedIdeographsExtensionA", new int[] { 0x3400, 0x4DB5 }); add(m, "CJKUnifiedIdeographsExtensionA", new int[] { 0x3400, 0x4DBF }); add(m, "YijingHexagramSymbols", new int[] { 0x4DC0, 0x4DFF }); add(m, "CJKUnifiedIdeographs", new int[] { 0x4E00, 0x9FFF }); add(m, "YiSyllables", new int[] { 0xA000, 0xA48F }); add(m, "YiRadicals", new int[] { 0xA490, 0xA4CF }); add(m, "Lisu", new int[] { 0xA4D0, 0xA4FF }); add(m, "Vai", new int[] { 0xA500, 0xA63F }); add(m, "CyrillicExtended-B", new int[] { 0xA640, 0xA69F }); add(m, "Bamum", new int[] { 0xA6A0, 0xA6FF }); add(m, "ModifierToneLetters", new int[] { 0xA700, 0xA71F }); add(m, "LatinExtended-D", new int[] { 0xA720, 0xA7FF }); add(m, "SylotiNagri", new int[] { 0xA800, 0xA82F }); add(m, "CommonIndicNumberForms", new int[] { 0xA830, 0xA83F }); add(m, "Phags-pa", new int[] { 0xA840, 0xA87F }); add(m, "Saurashtra", new int[] { 0xA880, 0xA8DF }); add(m, "DevanagariExtended", new int[] { 0xA8E0, 0xA8FF }); add(m, "KayahLi", new int[] { 0xA900, 0xA92F }); add(m, "Rejang", new int[] { 0xA930, 0xA95F }); add(m, "HangulJamoExtended-A", new int[] { 0xA960, 0xA97F }); add(m, "Javanese", new int[] { 0xA980, 0xA9DF }); add(m, "Cham", new int[] { 0xAA00, 0xAA5F }); add(m, "MyanmarExtended-A", new int[] { 0xAA60, 0xAA7F }); add(m, "TaiViet", new int[] { 0xAA80, 0xAADF }); add(m, "EthiopicExtended-A", new int[] { 0xAB00, 0xAB2F }); add(m, "MeeteiMayek", new int[] { 0xABC0, 0xABFF }); add(m, "HangulSyllables", new int[] { 0xAC00, 0xD7A3 }); add(m, "HangulSyllables", new int[] { 0xAC00, 0xD7AF }); add(m, "HangulJamoExtended-B", new int[] { 0xD7B0, 0xD7FF }); add(m, "HighSurrogates", new int[] { 0xD800, 0xDB7F }); add(m, "HighPrivateUseSurrogates", new int[] { 0xDB80, 0xDBFF }); add(m, "LowSurrogates", new int[] { 0xDC00, 0xDFFF }); add(m, "PrivateUse", new int[] { 0xE000, 0xF8FF }); add(m, "PrivateUseArea", new int[] { 0xE000, 0xF8FF }); add(m, "CJKCompatibilityIdeographs", new int[] { 0xF900, 0xFAFF }); add(m, "AlphabeticPresentationForms", new int[] { 0xFB00, 0xFB4F }); add(m, "ArabicPresentationForms-A", new int[] { 0xFB50, 0xFDFF }); add(m, "VariationSelectors", new int[] { 0xFE00, 0xFE0F }); add(m, "VerticalForms", new int[] { 0xFE10, 0xFE1F }); add(m, "CombiningHalfMarks", new int[] { 0xFE20, 0xFE2F }); add(m, "CJKCompatibilityForms", new int[] { 0xFE30, 0xFE4F }); add(m, "SmallFormVariants", new int[] { 0xFE50, 0xFE6F }); add(m, "ArabicPresentationForms-B", new int[] { 0xFE70, 0xFEFE }); add(m, "ArabicPresentationForms-B", new int[] { 0xFE70, 0xFEFF }); add(m, "Specials", new int[] { 0xFEFF, 0xFEFF }); add(m, "HalfwidthandFullwidthForms", new int[] { 0xFF00, 0xFFEF }); add(m, "Specials", new int[] { 0xFFF0, 0xFFFD }); add(m, "Specials", new int[] { 0xFFF0, 0xFFFF }); add(m, "LinearBSyllabary", new int[] { 0x10000, 0x1007F }); add(m, "LinearBIdeograms", new int[] { 0x10080, 0x100FF }); add(m, "AegeanNumbers", new int[] { 0x10100, 0x1013F }); add(m, "AncientGreekNumbers", new int[] { 0x10140, 0x1018F }); add(m, "AncientSymbols", new int[] { 0x10190, 0x101CF }); add(m, "PhaistosDisc", new int[] { 0x101D0, 0x101FF }); add(m, "Lycian", new int[] { 0x10280, 0x1029F }); add(m, "Carian", new int[] { 0x102A0, 0x102DF }); add(m, "OldItalic", new int[] { 0x10300, 0x1032F }); add(m, "Gothic", new int[] { 0x10330, 0x1034F }); add(m, "Ugaritic", new int[] { 0x10380, 0x1039F }); add(m, "OldPersian", new int[] { 0x103A0, 0x103DF }); add(m, "Deseret", new int[] { 0x10400, 0x1044F }); add(m, "Shavian", new int[] { 0x10450, 0x1047F }); add(m, "Osmanya", new int[] { 0x10480, 0x104AF }); add(m, "CypriotSyllabary", new int[] { 0x10800, 0x1083F }); add(m, "ImperialAramaic", new int[] { 0x10840, 0x1085F }); add(m, "Phoenician", new int[] { 0x10900, 0x1091F }); add(m, "Lydian", new int[] { 0x10920, 0x1093F }); add(m, "Kharoshthi", new int[] { 0x10A00, 0x10A5F }); add(m, "OldSouthArabian", new int[] { 0x10A60, 0x10A7F }); add(m, "Avestan", new int[] { 0x10B00, 0x10B3F }); add(m, "InscriptionalParthian", new int[] { 0x10B40, 0x10B5F }); add(m, "InscriptionalPahlavi", new int[] { 0x10B60, 0x10B7F }); add(m, "OldTurkic", new int[] { 0x10C00, 0x10C4F }); add(m, "RumiNumeralSymbols", new int[] { 0x10E60, 0x10E7F }); add(m, "Brahmi", new int[] { 0x11000, 0x1107F }); add(m, "Kaithi", new int[] { 0x11080, 0x110CF }); add(m, "Cuneiform", new int[] { 0x12000, 0x123FF }); add(m, "CuneiformNumbersandPunctuation", new int[] { 0x12400, 0x1247F }); add(m, "EgyptianHieroglyphs", new int[] { 0x13000, 0x1342F }); add(m, "BamumSupplement", new int[] { 0x16800, 0x16A3F }); add(m, "KanaSupplement", new int[] { 0x1B000, 0x1B0FF }); add(m, "ByzantineMusicalSymbols", new int[] { 0x1D000, 0x1D0FF }); add(m, "MusicalSymbols", new int[] { 0x1D100, 0x1D1FF }); add(m, "AncientGreekMusicalNotation", new int[] { 0x1D200, 0x1D24F }); add(m, "TaiXuanJingSymbols", new int[] { 0x1D300, 0x1D35F }); add(m, "CountingRodNumerals", new int[] { 0x1D360, 0x1D37F }); add(m, "MathematicalAlphanumericSymbols", new int[] { 0x1D400, 0x1D7FF }); add(m, "MahjongTiles", new int[] { 0x1F000, 0x1F02F }); add(m, "DominoTiles", new int[] { 0x1F030, 0x1F09F }); add(m, "PlayingCards", new int[] { 0x1F0A0, 0x1F0FF }); add(m, "EnclosedAlphanumericSupplement", new int[] { 0x1F100, 0x1F1FF }); add(m, "EnclosedIdeographicSupplement", new int[] { 0x1F200, 0x1F2FF }); add(m, "MiscellaneousSymbolsAndPictographs", new int[] { 0x1F300, 0x1F5FF }); add(m, "Emoticons", new int[] { 0x1F600, 0x1F64F }); add(m, "TransportAndMapSymbols", new int[] { 0x1F680, 0x1F6FF }); add(m, "AlchemicalSymbols", new int[] { 0x1F700, 0x1F77F }); add(m, "CJKUnifiedIdeographsExtensionB", new int[] { 0x20000, 0x2A6D6 }); add(m, "CJKUnifiedIdeographsExtensionB", new int[] { 0x20000, 0x2A6DF }); add(m, "CJKUnifiedIdeographsExtensionC", new int[] { 0x2A700, 0x2B73F }); add(m, "CJKUnifiedIdeographsExtensionD", new int[] { 0x2B740, 0x2B81F }); add(m, "CJKCompatibilityIdeographsSupplement", new int[] { 0x2F800, 0x2FA1F }); add(m, "Tags", new int[] { 0xE0000, 0xE007F }); add(m, "VariationSelectorsSupplement", new int[] { 0xE0100, 0xE01EF }); add(m, "PrivateUse", new int[] { 0xF0000, 0xFFFFD }); add(m, "SupplementaryPrivateUseArea-A", new int[] { 0xF0000, 0xFFFFF }); add(m, "PrivateUse", new int[] { 0x100000, 0x10FFFD }); add(m, "SupplementaryPrivateUseArea-B", new int[] { 0x100000, 0x10FFFF }); // add entries for all known character classes for(final Entry e : m.entrySet()) { final int[][] v = e.getValue(); final CharRange[] rs = new CharRange[v.length]; for(int i = 0; i < v.length; i++) rs[i] = new CharRange(v[i][0], v[i][1]); MAP.put("\\p{Is" + e.getKey() + '}', rs); final int[][] not = invert(v); final CharRange[] nrs = new CharRange[not.length]; for(int i = 0; i < not.length; i++) nrs[i] = new CharRange(not[i][0], not[i][1]); MAP.put("\\P{Is" + e.getKey() + '}', nrs); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/regex/Group.java000066400000000000000000000011541222453003200254160ustar00rootroot00000000000000package org.basex.query.regex; /** * A parenthesized group. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public class Group extends RegExp { /** Enclosed expression. */ private final RegExp encl; /** Capture flag. */ private final boolean capture; /** * Constructor. * @param sub enclosed expression * @param capt capture flag */ public Group(final RegExp sub, final boolean capt) { encl = sub; capture = capt; } @Override StringBuilder toRegEx(final StringBuilder sb) { return encl.toRegEx(sb.append(capture ? "(" : "(?:")).append(')'); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/regex/LineBorder.java000066400000000000000000000022061222453003200263460ustar00rootroot00000000000000package org.basex.query.regex; /** * Line start ({@code ^}) or line end ({@code $}). * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class LineBorder extends RegExp { /** Start flag. */ private final boolean start; /** Multi-line flag. */ private final boolean multi; /** Cached instances. */ private static final LineBorder[] INSTANCES = new LineBorder[4]; /** * Constructor. * @param st start flag * @param mul multi-line flag */ private LineBorder(final boolean st, final boolean mul) { start = st; multi = mul; } /** * Getter for the cached LineBorder instance. * @param start {@code ^} if {@code true}, {@code $} otherwise * @param multi multi-line flag * @return the instance */ public static LineBorder get(final boolean start, final boolean multi) { final int pos = (start ? 2 : 0) + (multi ? 1 : 0); if(INSTANCES[pos] == null) INSTANCES[pos] = new LineBorder(start, multi); return INSTANCES[pos]; } @Override StringBuilder toRegEx(final StringBuilder sb) { return sb.append(start ? "^" : multi ? "$" : "(?:$(?!\\s))"); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/regex/Literal.java000066400000000000000000000023401222453003200257140ustar00rootroot00000000000000package org.basex.query.regex; /** * A character literal. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public class Literal extends RegExp { /** Code point. */ private final int codepoint; /** * Constructor. * @param cp Unicode code point */ public Literal(final int cp) { codepoint = cp; } @Override StringBuilder toRegEx(final StringBuilder sb) { return sb.append(escape(codepoint)); } /** * Escapes the given code point for a regular expression. * @param cp code point * @return string representation */ public static String escape(final int cp) { switch(cp) { case '\t': return "\\t"; case '\r': return "\\r"; case '\n': return "\\n"; case '\\': case '|': case '.': case '?': case '*': case '+': case '(': case ')': case '{': case '}': case '$': case '-': case '[': case ']': case '^': return "\\" + (char) cp; default: if(cp < 128 && !Character.isISOControl(cp)) return String.valueOf((char) cp); if(cp < 0x10000) return String.format("\\u%04x", cp); return String.valueOf(Character.toChars(cp)); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/regex/Piece.java000066400000000000000000000010761222453003200253520ustar00rootroot00000000000000package org.basex.query.regex; /** * An atom together with a quantifier. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public class Piece extends RegExp { /** Wrapped atom. */ private final RegExp atom; /** Quantifier. */ private final Quantifier quant; /** * Constructor. * @param at atom * @param qu quantifier */ public Piece(final RegExp at, final Quantifier qu) { atom = at; quant = qu; } @Override StringBuilder toRegEx(final StringBuilder sb) { return quant.toRegEx(atom.toRegEx(sb)); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/regex/Quantifier.java000066400000000000000000000021541222453003200264320ustar00rootroot00000000000000package org.basex.query.regex; /** * A quantifier, like {@code ?}, {@code *} or {@code {17,123}}. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public class Quantifier extends RegExp { /** Minimum occurrence. */ public final int min; /** Maximum occurrence, {@code -1} for infinity. */ public final int max; /** Reluctance flag. */ public final boolean lazy; /** * Constructor. * @param mn minimum occurrences * @param mx maximum occurrences * @param lzy reluctance flag */ public Quantifier(final int mn, final int mx, final boolean lzy) { min = mn; max = mx; lazy = lzy; } @Override StringBuilder toRegEx(final StringBuilder sb) { return sb.append(string()).append(lazy ? "?" : ""); } /** * Translates the occurrence bounds to a regex string. * @return regex representation */ private String string() { if(min == 0) { if(max == 1) return "?"; if(max == -1) return "*"; } else if(min == 1 && max == -1) return "+"; return "{" + min + (min == max ? "" : "," + (max == -1 ? "" : max)) + '}'; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/regex/RegExp.java000066400000000000000000000006541222453003200255200ustar00rootroot00000000000000package org.basex.query.regex; /** * A node of the regular expression AST. * @author Leo Woerteler */ public abstract class RegExp { @Override public String toString() { return toRegEx(new StringBuilder()).toString(); } /** * Recursive {@link RegExp#toString()} helper. * @param sb string builder * @return the string builder for convenience */ abstract StringBuilder toRegEx(StringBuilder sb); } basex-7.7.2/basex-core/src/main/java/org/basex/query/regex/Wildcard.java000066400000000000000000000017161222453003200260570ustar00rootroot00000000000000package org.basex.query.regex; /** * Wildcard for any character ({@code .}). * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class Wildcard extends RegExp { /** Instance for the dot matching all characters. */ private static final Wildcard ALL = new Wildcard(true); /** Instance for the dot matching everything except new-lines. */ private static final Wildcard NOLF = new Wildcard(true); /** If the {@code \n} character is matched. */ private final boolean nl; /** * Private constructor. * @param a match-all flag */ private Wildcard(final boolean a) { nl = a; } /** * Getter for the lazily initialized wildcard instances. * @param dotAll match-all flag * @return the instance */ public static Wildcard get(final boolean dotAll) { return dotAll ? ALL : NOLF; } @Override StringBuilder toRegEx(final StringBuilder sb) { return sb.append(nl ? "." : "[^\r\n]"); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/regex/parse/000077500000000000000000000000001222453003200245705ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/regex/parse/ParseException.java000066400000000000000000000136541222453003200303750ustar00rootroot00000000000000/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */ /* JavaCCOptions:KEEP_LINE_COL=null */ package org.basex.query.regex.parse; /** * This exception is thrown when parse errors are encountered. * You can explicitly create objects of this exception type by * calling the method generateParseException in the generated * parser. * * You can modify this class to customize your error reporting * mechanisms so long as you retain the public fields. */ public class ParseException extends Exception { /** * The version identifier for this Serializable class. * Increment only if the serialized form of the * class changes. */ private static final long serialVersionUID = 1L; /** * This constructor is used by the method "generateParseException" * in the generated parser. Calling this constructor generates * a new object of this type with the fields "currentToken", * "expectedTokenSequences", and "tokenImage" set. * @param curr current token * @param exps expected token sequences * @param imgs image strings */ public ParseException(final Token curr, final int[][] exps, final String[] imgs) { super(initialise(curr, exps, imgs)); currentToken = curr; expectedTokenSequences = exps; tokenImage = imgs; } /** * The following constructors are for use by you for whatever * purpose you can think of. Constructing the exception in this * manner makes the exception behave in the normal way - i.e., as * documented in the class "Throwable". The fields "errorToken", * "expectedTokenSequences", and "tokenImage" do not contain * relevant information. The JavaCC generated code does not use * these constructors. */ public ParseException() { super(); } /** Constructor with message. * @param message error message */ public ParseException(final String message) { super(message); } /** * This is the last token that has been consumed successfully. If * this object has been created due to a parse error, the token * followng this token will (therefore) be the first error token. */ public Token currentToken; /** * Each entry in this array is an array of integers. Each array * of integers represents a sequence of tokens (by their ordinal * values) that is expected at this point of the parse. */ public int[][] expectedTokenSequences; /** * This is a reference to the "tokenImage" array of the generated * parser within which the parse error occurred. This array is * defined in the generated ...Constants interface. */ public String[] tokenImage; /** * It uses "currentToken" and "expectedTokenSequences" to generate a parse * error message and returns it. If this object has been created * due to a parse error, and you do not catch it (it gets thrown * from the parser) the correct error message * gets displayed. * @param curr current token * @param exps expected token sequences * @param img token images * @return error description */ private static String initialise(final Token curr, final int[][] exps, final String[] img) { final String eol = System.getProperty("line.separator", "\n"); final StringBuilder expected = new StringBuilder(); int maxSize = 0; for(final int[] exp : exps) { if(maxSize < exp.length) { maxSize = exp.length; } for(final int e : exp) { expected.append(img[e]).append(' '); } if(exp[exp.length - 1] != 0) { expected.append("..."); } expected.append(eol).append(" "); } String retval = "Encountered \""; Token tok = curr.next; for (int i = 0; i < maxSize; i++) { if(i != 0) retval += " "; if(tok.kind == 0) { retval += img[0]; break; } retval += ' ' + img[tok.kind]; retval += " \""; retval += addEscapes(tok.image); retval += " \""; tok = tok.next; } retval += "\" at line " + curr.next.beginLine + ", column " + curr.next.beginColumn; retval += '.' + eol; if (exps.length == 1) { retval += "Was expecting:" + eol + " "; } else { retval += "Was expecting one of:" + eol + " "; } retval += expected.toString(); return retval; } /** * The end of line string for this machine. */ protected String eol = System.getProperty("line.separator", "\n"); /** * Used to convert raw characters to their escaped version * when these raw version cannot be used as part of an ASCII * string literal. * @param str string to escape * @return escaped string */ static String addEscapes(final String str) { final StringBuilder retval = new StringBuilder(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 0 : continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { final String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } } /* JavaCC - OriginalChecksum=82d3ef24b529ba07ce7fc2f9b7c8efa1 (do not edit this line) */ basex-7.7.2/basex-core/src/main/java/org/basex/query/regex/parse/RegExLexer.java000066400000000000000000000163311222453003200274510ustar00rootroot00000000000000package org.basex.query.regex.parse; import static org.basex.util.Token.*; import java.util.regex.*; import org.basex.util.*; import org.basex.util.list.*; /** * A simple lexer for XML Schema regular expressions. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public class RegExLexer implements TokenManager, RegExParserConstants { /** End-of-file token. */ private static final Token EOF_TOKEN = new Token(EOF); /** The input string. */ final byte[] input; /** Input position. */ int pos; /** Start-of-line marks, beginning with the second one. {@code null} if only one. */ final IntList lines; /** Number of nested character classes. */ private int state; /** Flag for first character in a character class. */ private byte first; /** Token builder. */ private final TokenBuilder tb = new TokenBuilder(); /** Token's payload. */ Object payload; /** Skip whitespace. */ private final boolean skipWs; /** Unicode category regex. */ private static final Pattern CAT_REGEX = Pattern.compile("^L[ultmo]?|M[nce]?|N[dlo]?" + "|P[cdseifo]?|Z[slp]?|S[mcko]?|C[cfon]?|Is[a-zA-Z0-9\\-]+$"); /** * Constructor. * @param regex input string * @param strip strip whitespace */ public RegExLexer(final byte[] regex, final boolean strip) { input = regex; IntList ls = null; for(int i = 0; i < input.length; i++) { final byte c = input[i]; if(c == '\r' || c == '\n') { i++; if(c == '\r' && i < input.length && input[i] == '\n') i++; if(i < input.length) { if(ls == null) ls = new IntList(); ls.add(i); } } } lines = ls; skipWs = strip; } /** * Consumes the next code point in the input sequence. * @return the code point */ private int next() { int cp; do { if(pos >= input.length) return -1; cp = cp(input, pos); pos += cl(input, pos); } while(skipWs && state <= 0 && ws(cp)); tb.add(cp); return cp; } /** * Default state. * @return token kind */ private int normal() { final int curr = next(); if(curr == -1) return 0; switch(curr) { case '^': return LINE_START; case '$': return LINE_END; case '?': return Q_MARK; case '*': return STAR; case '+': return PLUS; case '.': return WILDCARD; case '|': return OR; case '(': final int p = pos, ts = tb.size(); if(next() == '?' && next() == ':') return NPAR_OPEN; pos = p; tb.size(ts); return PAR_OPEN; case ')': return PAR_CLOSE; case '{': state = -1; return QUANT_OPEN; case '\\': return escape(); case '[': state++; first = 1; return BR_OPEN; case ']': case '}': throw error("", curr); } if(curr >= '0' && curr <= '9') return DIGIT; return CHAR; } /** * Escape sequence. * @return token kind */ private int escape() { final int curr = next(); switch(curr) { case 'n': case 'r': case 't': case '\\': case '|': case '.': case '?': case '*': case '+': case '(': case ')': case '{': case '}': case '$': case '-': case '[': case ']': case '^': return SINGLE_ESC; case 's': case 'S': case 'i': case 'I': case 'c': case 'C': case 'd': case 'D': case 'w': case 'W': return MULTI_ESC; case 'p': case 'P': final String p = "\\" + (char) curr; final int nxt = next(); if(nxt != '{') throw error(p, nxt); for(int cp = next(); cp != '}'; cp = next()) if(cp == -1) throw error(tb.toString(), cp); final String in = tb.toString().substring(3, tb.size() - 1); final Matcher m = CAT_REGEX.matcher(in); if(!m.matches()) throw error("{", nxt); payload = in; return CAT_ESC; default: if(curr < '0' || curr > '9') throw error("\\", (char) curr); return BACK_REF; } } /** * Creates an error with line and column information. * @param before description of preceding token * @param curr current character * @return error */ private TokenMgrError error(final String before, final int curr) { final int[] lc = lineCol(pos); return new TokenMgrError(curr < 0, state, lc[1], lc[3], before, (char) curr, TokenMgrError.LEXICAL_ERROR); } /** * Character-class state. * @return token kind */ private int inClass() { final byte fst = first; first = 0; final int curr = next(); switch(curr) { case '\\': return escape(); case '^': if(fst == 1) { first = -1; return NEG; } return CHAR; case '[': state++; first = 1; return BR_OPEN; case ']': state--; return BR_CLOSE; case '-': return pos < input.length && input[pos] == '[' ? TO : CHAR; } return CHAR; } /** * Quantifier state. * @return token kind */ private int inQuantifier() { final int curr = next(); if(curr == ',') return COMMA; if(curr == '}') { state = 0; return QUANT_CLOSE; } if(curr < '0' || curr > '9') throw error("{", curr); while(pos < input.length) { final byte b = input[pos]; if(b < '0' || b > '9') break; tb.add(b); pos++; } payload = tb.toString(); return NUMBER; } /** * Calculates line and column position of the current match. * @param start start position * @return line and column positions */ int[] lineCol(final int start) { final int[] lc = new int[4]; if(lines != null) { int ln = 0, st = 0; for(int i = 0; i < 2; i++) { final int curr = i == 0 ? start : pos; while(ln < lines.size() && lines.get(ln) < curr) { st = lines.get(ln); ln++; } lc[i] = ln + 1; lc[i + 2] = curr - st + 1; } } else { lc[0] = lc[1] = 1; lc[2] = start; lc[3] = pos; } return lc; } @Override public Token getNextToken() { if(pos >= input.length) return EOF_TOKEN; final int start = pos; payload = null; final int type = state > 0 ? inClass() : state < 0 ? inQuantifier() : normal(); final Token tok = new RegExToken(type, start, tb.toString()); tb.size(0); return tok; } /** * Parser token. * @author Leo Woerteler */ class RegExToken extends Token { /** the token's payload. */ private final Object obj = payload; /** * Constructor. * @param k token kind * @param start start of the token * @param img image string */ public RegExToken(final int k, final int start, final String img) { kind = k; image = img; final int[] lc = lineCol(start); beginLine = lc[0]; endLine = lc[1]; beginColumn = lc[2]; endColumn = lc[3]; } /** * Finds the name of this token's production. * @return token name */ public String getName() { return RegExParserConstants.tokenImage[kind]; } @Override public Object getValue() { return obj; } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/regex/parse/RegExParser.java000066400000000000000000000641451222453003200276340ustar00rootroot00000000000000/* Generated By:JavaCC: Do not edit this line. RegExParser.java */ package org.basex.query.regex.parse; import static org.basex.query.util.Err.*; import java.util.ArrayList; import java.util.regex.*; import org.basex.query.*; import org.basex.query.regex.*; import org.basex.query.util.*; import org.basex.util.*; import static org.basex.util.Token.*; import static java.util.regex.Pattern.*; /** * A parser for XSD regular expressions. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class RegExParser implements RegExParserConstants { /** Group counter. */ private int groups; /** Current backref's number. */ private int backref; /** Closed groups. */ private final BitArray closed = new BitArray(); /** If the wildcard {@code .} matches any character. */ private boolean dotAll; /** Multi-line matching mode, {@code ^} and {@code $} match on line bounds. */ private boolean multiLine; /** * Compiles this regular expression to a {@link Pattern}. * @param regex regular expression to parse * @param mod modifiers * @param ext XQuery 3.0 syntax * @param ii input info * @return the pattern * @throws QueryException query exception */ public static Pattern parse(final byte[] regex, final byte[] mod, final boolean ext, final InputInfo ii) throws QueryException { // process modifiers int m = 0; boolean strip = false; if(mod != null) { for(final byte b : mod) { if(b == 'i') m |= CASE_INSENSITIVE | UNICODE_CASE; else if(b == 'm') m |= MULTILINE; else if(b == 's') m |= DOTALL; else if(b == 'q' && ext) m |= LITERAL; else if(b == 'x') strip = true; else REGMOD.thrw(ii, (char) b); } } // no need to change anything if((m & LITERAL) != 0) return Pattern.compile(string(regex), m); try { final RegExParser parser = new RegExParser(regex, strip, (m & DOTALL) != 0, (m & MULTILINE) != 0); return Pattern.compile(parser.parse().toString(), m); } catch(final ParseException pe) { throw Err.REGPAT.thrw(ii, pe.getMessage()); } catch(final TokenMgrError err) { throw Err.REGPAT.thrw(ii, err.getMessage()); } } /** * Constructor. * @param regex regular expression to parse * @param strip strip whitespace while lexing * @param all dot matches all * @param multi multi line search */ public RegExParser(final byte[] regex, final boolean strip, final boolean all, final boolean multi) { this(new RegExLexer(regex, strip)); dotAll = all; multiLine = multi; } /** * Root production. * @return expression * @throws ParseException parsing exception */ final public RegExp parse() throws ParseException { RegExp regex; regex = regExp(); jj_consume_token(0); {if (true) return regex;} throw new Error("Missing return statement in function"); } /** * Parses the "regExp" rule. * @return expression * @throws ParseException parsing exception */ final public RegExp regExp() throws ParseException { RegExp nd; RegExp[] brs = null; nd = branch(); brs = new RegExp[] { nd }; label_1: while (true) { switch (jj_ntk==-1?jj_ntk():jj_ntk) { case OR: ; break; default: jj_la1[0] = jj_gen; break label_1; } jj_consume_token(OR); nd = branch(); final RegExp[] nw = new RegExp[brs.length + 1]; System.arraycopy(brs, 0, nw, 0, brs.length); nw[brs.length] = nd; brs = nw; } {if (true) return brs.length == 1 ? nd : new Disjunction(brs);} throw new Error("Missing return statement in function"); } /** * Parses the "branch" rule. * Parses the "piece" rule. * @return expression * @throws ParseException parsing exception */ final public RegExp branch() throws ParseException { RegExp atom; RegExp[] pieces = new RegExp[0]; Quantifier qu = null; label_2: while (true) { switch (jj_ntk==-1?jj_ntk():jj_ntk) { case NPAR_OPEN: case PAR_OPEN: case CHAR: case DIGIT: case BACK_REF: case WILDCARD: case LINE_START: case LINE_END: case SINGLE_ESC: case MULTI_ESC: case CAT_ESC: case BR_OPEN: ; break; default: jj_la1[1] = jj_gen; break label_2; } atom = atom(); switch (jj_ntk==-1?jj_ntk():jj_ntk) { case Q_MARK: case STAR: case PLUS: case QUANT_OPEN: qu = quantifier(); break; default: jj_la1[2] = jj_gen; ; } final RegExp[] nw = new RegExp[pieces.length + 1]; System.arraycopy(pieces, 0, nw, 0, pieces.length); nw[pieces.length] = qu == null ? atom : new Piece(atom, qu); pieces = nw; qu = null; } {if (true) return pieces.length == 1 ? pieces[0] : new Branch(pieces);} throw new Error("Missing return statement in function"); } /** * Parses the "quantifier" rule. * @return expression * @throws ParseException parsing exception */ final public Quantifier quantifier() throws ParseException { int min = 0, max = 0; boolean lazy = false; int[] qu = null; switch (jj_ntk==-1?jj_ntk():jj_ntk) { case Q_MARK: jj_consume_token(Q_MARK); max = 1; break; case STAR: jj_consume_token(STAR); max = -1; break; case PLUS: jj_consume_token(PLUS); min = 1; max = -1; break; case QUANT_OPEN: jj_consume_token(QUANT_OPEN); qu = quantity(); min = qu[0]; max = qu[1]; jj_consume_token(QUANT_CLOSE); break; default: jj_la1[3] = jj_gen; jj_consume_token(-1); throw new ParseException(); } switch (jj_ntk==-1?jj_ntk():jj_ntk) { case Q_MARK: jj_consume_token(Q_MARK); lazy = true; break; default: jj_la1[4] = jj_gen; ; } {if (true) return new Quantifier(min, max, lazy);} throw new Error("Missing return statement in function"); } /** * Parses the "quantity" rule. * Parses the "quantRange" rule. * Parses the "quantMin" rule. * Parses the "quantExact" rule. * @return quantity * @throws ParseException parsing exception */ final public int[] quantity() throws ParseException { final int[] qty = new int[2]; jj_consume_token(NUMBER); try { qty[0] = qty[1] = Integer.parseInt((String) token.getValue()); } catch(final NumberFormatException ex) { {if (true) throw new ParseException("Number in quantifier is too large");} } switch (jj_ntk==-1?jj_ntk():jj_ntk) { case COMMA: jj_consume_token(COMMA); qty[1] = -1; switch (jj_ntk==-1?jj_ntk():jj_ntk) { case NUMBER: jj_consume_token(NUMBER); try { qty[1] = Integer.parseInt((String) token.getValue()); } catch(final NumberFormatException ex) { {if (true) throw new ParseException("Number in quantifier is too large");} } if(qty[0] > qty[1]) {if (true) throw new ParseException("Illegal quantifier, " + "lower > upper bound: {" + qty[0] + "," + qty[1] + "}");} break; default: jj_la1[5] = jj_gen; ; } break; default: jj_la1[6] = jj_gen; ; } {if (true) return qty;} throw new Error("Missing return statement in function"); } /** * Parses the "atom" rule. * @return expression * @throws ParseException parsing exception */ final public RegExp atom() throws ParseException { RegExp nd = null; switch (jj_ntk==-1?jj_ntk():jj_ntk) { case CHAR: case DIGIT: nd = Char(); break; case WILDCARD: case LINE_START: case LINE_END: case SINGLE_ESC: case MULTI_ESC: case CAT_ESC: case BR_OPEN: nd = charClass(); break; case NPAR_OPEN: jj_consume_token(NPAR_OPEN); nd = regExp(); jj_consume_token(PAR_CLOSE); nd = new Group(nd, false); break; case PAR_OPEN: jj_consume_token(PAR_OPEN); final int grp = ++groups; nd = regExp(); jj_consume_token(PAR_CLOSE); closed.set(grp); nd = new Group(nd, true); break; case BACK_REF: nd = backReference(); break; default: jj_la1[7] = jj_gen; jj_consume_token(-1); throw new ParseException(); } {if (true) return nd;} throw new Error("Missing return statement in function"); } /** * Parses the "Char" rule. * @return expression * @throws ParseException parsing exception */ final public Literal Char() throws ParseException { switch (jj_ntk==-1?jj_ntk():jj_ntk) { case CHAR: jj_consume_token(CHAR); break; case DIGIT: jj_consume_token(DIGIT); break; default: jj_la1[8] = jj_gen; jj_consume_token(-1); throw new ParseException(); } {if (true) return new Literal(token.image.codePointAt(0));} throw new Error("Missing return statement in function"); } /** * Parses the "backReference" rule. * @return expression * @throws ParseException parsing exception */ final public BackRef backReference() throws ParseException { Token tok; tok = jj_consume_token(BACK_REF); backref = token.image.charAt(1) - '0'; label_3: while (true) { if (jj_2_1(1) && 10 * backref + token.next.image.charAt(0) - '0' <= groups) { ; } else { break label_3; } jj_consume_token(DIGIT); backref = 10 * backref + token.image.charAt(0) - '0'; } if(!closed.get(backref)) {if (true) throw new ParseException("Illegal back-reference: \u005c\u005c" + backref);} {if (true) return new BackRef(backref);} throw new Error("Missing return statement in function"); } /** * Parses the "charClass" rule. * @return expression * @throws ParseException parsing exception */ final public RegExp charClass() throws ParseException { RegExp nd = null; switch (jj_ntk==-1?jj_ntk():jj_ntk) { case SINGLE_ESC: case MULTI_ESC: case CAT_ESC: nd = charClassEsc(); break; case BR_OPEN: nd = charClassExpr(); break; case WILDCARD: jj_consume_token(WILDCARD); nd = Wildcard.get(dotAll); break; case LINE_START: jj_consume_token(LINE_START); nd = LineBorder.get(true, multiLine); break; case LINE_END: jj_consume_token(LINE_END); nd = LineBorder.get(false, multiLine); break; default: jj_la1[9] = jj_gen; jj_consume_token(-1); throw new ParseException(); } {if (true) return nd;} throw new Error("Missing return statement in function"); } /** * Parses the "charClassEsc" rule. * @return expression * @throws ParseException parsing exception */ final public RegExp charClassEsc() throws ParseException { switch (jj_ntk==-1?jj_ntk():jj_ntk) { case SINGLE_ESC: jj_consume_token(SINGLE_ESC); break; case MULTI_ESC: jj_consume_token(MULTI_ESC); break; case CAT_ESC: jj_consume_token(CAT_ESC); break; default: jj_la1[10] = jj_gen; jj_consume_token(-1); throw new ParseException(); } final RegExp esc = Escape.get(token.image); if(esc == null) {if (true) throw new ParseException("Unknown escape: " + token);} {if (true) return esc;} throw new Error("Missing return statement in function"); } /** * Parses the "charClassExpr" rule. * Parses the "charClassSub" rule. * @return character class * @throws ParseException parsing exception */ final public CharClass charClassExpr() throws ParseException { CharGroup group = null; CharClass sub = null; jj_consume_token(BR_OPEN); switch (jj_ntk==-1?jj_ntk():jj_ntk) { case NEG: jj_consume_token(NEG); group = posCharGroup(); group.negative = true; break; default: jj_la1[11] = jj_gen; if (jj_2_2(1)) { group = posCharGroup(); } else { jj_consume_token(-1); throw new ParseException(); } } switch (jj_ntk==-1?jj_ntk():jj_ntk) { case TO: jj_consume_token(TO); sub = charClassExpr(); break; default: jj_la1[12] = jj_gen; ; } jj_consume_token(BR_CLOSE); {if (true) return new CharClass(group, sub);} throw new Error("Missing return statement in function"); } /** * Parses the "posCharGroup" rule. * @return character group * @throws ParseException parsing exception */ final public CharGroup posCharGroup() throws ParseException { final ArrayList cg = new ArrayList(); RegExp sub = null; label_4: while (true) { if (jj_2_3(3)) { sub = charRange(); cg.add(sub); } else { switch (jj_ntk==-1?jj_ntk():jj_ntk) { case SINGLE_ESC: case MULTI_ESC: case CAT_ESC: switch (jj_ntk==-1?jj_ntk():jj_ntk) { case SINGLE_ESC: jj_consume_token(SINGLE_ESC); break; case MULTI_ESC: jj_consume_token(MULTI_ESC); break; case CAT_ESC: jj_consume_token(CAT_ESC); break; default: jj_la1[13] = jj_gen; jj_consume_token(-1); throw new ParseException(); } for(final RegExp re : Escape.inGroup(token.image)) cg.add(re); break; default: jj_la1[14] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } if (jj_2_4(1)) { ; } else { break label_4; } } {if (true) return new CharGroup(cg.toArray(new RegExp[cg.size()]));} throw new Error("Missing return statement in function"); } /** * Parses the "charRange" rule. * @return expression * @throws ParseException parsing exception */ final public RegExp charRange() throws ParseException { int a = -1, b = -1; if (getToken(2).kind == CHAR && "-".equals(getToken(2).image)) { a = charOrEsc(); jj_consume_token(CHAR); b = charOrEsc(); if(a > b) {if (true) throw new ParseException("Illegal range, " + "lower > upper bound: " + Literal.escape(a) + "-" + Literal.escape(b));} } else { switch (jj_ntk==-1?jj_ntk():jj_ntk) { case CHAR: case DIGIT: a = XmlChar(); break; default: jj_la1[15] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } {if (true) return b == -1 ? new Literal(a) : new CharRange(a, b);} throw new Error("Missing return statement in function"); } /** * Parses the "charOrEsc" rule. * @return character * @throws ParseException parsing exception */ final public int charOrEsc() throws ParseException { int cp = -1; switch (jj_ntk==-1?jj_ntk():jj_ntk) { case CHAR: case DIGIT: cp = XmlChar(); break; case SINGLE_ESC: jj_consume_token(SINGLE_ESC); cp = Escape.getCp(token.image); break; default: jj_la1[16] = jj_gen; jj_consume_token(-1); throw new ParseException(); } {if (true) return cp;} throw new Error("Missing return statement in function"); } /** * Parses the "XmlChar" rule. * @return character * @throws ParseException parsing exception */ final public int XmlChar() throws ParseException { switch (jj_ntk==-1?jj_ntk():jj_ntk) { case CHAR: jj_consume_token(CHAR); break; case DIGIT: jj_consume_token(DIGIT); break; default: jj_la1[17] = jj_gen; jj_consume_token(-1); throw new ParseException(); } {if (true) return token.image.codePointAt(0);} throw new Error("Missing return statement in function"); } private boolean jj_2_1(final int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_1(); } catch(final LookaheadSuccess ls) { return true; } finally { jj_save(0, xla); } } private boolean jj_2_2(final int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_2(); } catch(final LookaheadSuccess ls) { return true; } finally { jj_save(1, xla); } } private boolean jj_2_3(final int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_3(); } catch(final LookaheadSuccess ls) { return true; } finally { jj_save(2, xla); } } private boolean jj_2_4(final int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_4(); } catch(final LookaheadSuccess ls) { return true; } finally { jj_save(3, xla); } } private boolean jj_3R_6() { Token xsp; xsp = jj_scanpos; jj_lookingAhead = true; jj_semLA = getToken(2).kind == CHAR && "-".equals(getToken(2).image); jj_lookingAhead = false; if (!jj_semLA || jj_3R_8()) { jj_scanpos = xsp; if (jj_3R_9()) return true; } return false; } private boolean jj_3R_13() { if (jj_scan_token(SINGLE_ESC)) return true; return false; } private boolean jj_3R_12() { if (jj_3R_11()) return true; return false; } private boolean jj_3R_10() { Token xsp; xsp = jj_scanpos; if (jj_3R_12()) { jj_scanpos = xsp; if (jj_3R_13()) return true; } return false; } private boolean jj_3_2() { if (jj_3R_5()) return true; return false; } private boolean jj_3R_11() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(12)) { jj_scanpos = xsp; if (jj_scan_token(13)) return true; } return false; } private boolean jj_3R_7() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(18)) { jj_scanpos = xsp; if (jj_scan_token(19)) { jj_scanpos = xsp; if (jj_scan_token(20)) return true; } } return false; } private boolean jj_3_3() { if (jj_3R_6()) return true; return false; } private boolean jj_3_4() { Token xsp; xsp = jj_scanpos; if (jj_3_3()) { jj_scanpos = xsp; if (jj_3R_7()) return true; } return false; } private boolean jj_3R_9() { if (jj_3R_11()) return true; return false; } private boolean jj_3R_5() { Token xsp; if (jj_3_4()) return true; while (true) { xsp = jj_scanpos; if (jj_3_4()) { jj_scanpos = xsp; break; } } return false; } private boolean jj_3R_8() { if (jj_3R_10()) return true; if (jj_scan_token(CHAR)) return true; if (jj_3R_10()) return true; return false; } private boolean jj_3_1() { if (jj_scan_token(DIGIT)) return true; return false; } /** User defined Token Manager. */ public TokenManager token_source; /** Current token. */ public Token token; /** Next token. */ public Token jj_nt; private int jj_ntk; private Token jj_scanpos, jj_lastpos; private int jj_la; /** Whether we are looking ahead. */ private boolean jj_lookingAhead = false; private boolean jj_semLA; private int jj_gen; final private int[] jj_la1 = new int[18]; static private int[] jj_la1_0; static { jj_la1_init_0(); } private static void jj_la1_init_0() { jj_la1_0 = new int[] {0x2,0x3ffa00,0x3c,0x3c,0x4,0x80,0x100,0x3ffa00,0x3000,0x3f8000,0x1c0000,0x400000,0x800000,0x1c0000,0x1c0000,0x3000,0x43000,0x3000,}; } final private JJCalls[] jj_2_rtns = new JJCalls[4]; private boolean jj_rescan = false; private int jj_gc = 0; /** Constructor with user supplied Token Manager. */ public RegExParser(final TokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 18; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } /** Reinitialise. */ public void ReInit(final TokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 18; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } private Token jj_consume_token(final int kind) throws ParseException { Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; if (token.kind == kind) { jj_gen++; if (++jj_gc > 100) { jj_gc = 0; for(final JJCalls jj_2_rtn : jj_2_rtns) { JJCalls c = jj_2_rtn; while (c != null) { if (c.gen < jj_gen) c.first = null; c = c.next; } } } return token; } token = oldToken; jj_kind = kind; throw generateParseException(); } static private final class LookaheadSuccess extends java.lang.Error { } static final private LookaheadSuccess jj_ls = new LookaheadSuccess(); private boolean jj_scan_token(final int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); } else { jj_lastpos = jj_scanpos = jj_scanpos.next; } } else { jj_scanpos = jj_scanpos.next; } if (jj_rescan) { int i = 0; Token tok = token; while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } if (tok != null) jj_add_error_token(kind, i); } if (jj_scanpos.kind != kind) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; return false; } /** Get the next Token. */ final public Token getNextToken() { if (token.next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; jj_gen++; return token; } /** Get the specific Token. */ final public Token getToken(final int index) { Token t = jj_lookingAhead ? jj_scanpos : token; for (int i = 0; i < index; i++) { if (t.next != null) t = t.next; else t = t.next = token_source.getNextToken(); } return t; } private int jj_ntk() { if ((jj_nt=token.next) == null) return jj_ntk = (token.next=token_source.getNextToken()).kind; else return jj_ntk = jj_nt.kind; } private final java.util.List jj_expentries = new java.util.ArrayList(); private int[] jj_expentry; private int jj_kind = -1; private final int[] jj_lasttokens = new int[100]; private int jj_endpos; private void jj_add_error_token(final int kind, final int pos) { if (pos >= 100) return; if (pos == jj_endpos + 1) { jj_lasttokens[jj_endpos++] = kind; } else if (jj_endpos != 0) { jj_expentry = new int[jj_endpos]; for (int i = 0; i < jj_endpos; i++) { jj_expentry[i] = jj_lasttokens[i]; } jj_entries_loop: for(final Object name : jj_expentries) { final int[] oldentry = (int[])name; if (oldentry.length == jj_expentry.length) { for (int i = 0; i < jj_expentry.length; i++) { if (oldentry[i] != jj_expentry[i]) { continue jj_entries_loop; } } jj_expentries.add(jj_expentry); break jj_entries_loop; } } if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; } } /** Generate ParseException. */ public ParseException generateParseException() { jj_expentries.clear(); final boolean[] la1tokens = new boolean[25]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 18; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & 1< jj_gen) { jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; switch (i) { case 0: jj_3_1(); break; case 1: jj_3_2(); break; case 2: jj_3_3(); break; case 3: jj_3_4(); break; } } p = p.next; } while (p != null); } catch(final LookaheadSuccess ls) { } } jj_rescan = false; } private void jj_save(final int index, final int xla) { JJCalls p = jj_2_rtns[index]; while (p.gen > jj_gen) { if (p.next == null) { p = p.next = new JJCalls(); break; } p = p.next; } p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla; } static final class JJCalls { int gen; Token first; int arg; JJCalls next; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/regex/parse/RegExParserConstants.java000066400000000000000000000040371222453003200315230ustar00rootroot00000000000000/* Generated By:JavaCC: Do not edit this line. RegExParserConstants.java */ package org.basex.query.regex.parse; /** * Token literal values and constants. * Generated by org.javacc.parser.OtherFilesGen#start() */ public interface RegExParserConstants { /** End of File. */ int EOF = 0; /** RegularExpression Id. */ int OR = 1; /** RegularExpression Id. */ int Q_MARK = 2; /** RegularExpression Id. */ int STAR = 3; /** RegularExpression Id. */ int PLUS = 4; /** RegularExpression Id. */ int QUANT_OPEN = 5; /** RegularExpression Id. */ int QUANT_CLOSE = 6; /** RegularExpression Id. */ int NUMBER = 7; /** RegularExpression Id. */ int COMMA = 8; /** RegularExpression Id. */ int NPAR_OPEN = 9; /** RegularExpression Id. */ int PAR_CLOSE = 10; /** RegularExpression Id. */ int PAR_OPEN = 11; /** RegularExpression Id. */ int CHAR = 12; /** RegularExpression Id. */ int DIGIT = 13; /** RegularExpression Id. */ int BACK_REF = 14; /** RegularExpression Id. */ int WILDCARD = 15; /** RegularExpression Id. */ int LINE_START = 16; /** RegularExpression Id. */ int LINE_END = 17; /** RegularExpression Id. */ int SINGLE_ESC = 18; /** RegularExpression Id. */ int MULTI_ESC = 19; /** RegularExpression Id. */ int CAT_ESC = 20; /** RegularExpression Id. */ int BR_OPEN = 21; /** RegularExpression Id. */ int NEG = 22; /** RegularExpression Id. */ int TO = 23; /** RegularExpression Id. */ int BR_CLOSE = 24; /** Literal token values. */ String[] tokenImage = { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", }; } basex-7.7.2/basex-core/src/main/java/org/basex/query/regex/parse/Token.java000066400000000000000000000103721222453003200265160ustar00rootroot00000000000000/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */ /* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package org.basex.query.regex.parse; /** * Describes the input token stream. */ public class Token implements java.io.Serializable { /** * The version identifier for this Serializable class. * Increment only if the serialized form of the * class changes. */ private static final long serialVersionUID = 1L; /** * An integer that describes the kind of this token. This numbering * system is determined by JavaCCParser, and a table of these numbers is * stored in the file ...Constants.java. */ public int kind; /** The line number of the first character of this Token. */ public int beginLine; /** The column number of the first character of this Token. */ public int beginColumn; /** The line number of the last character of this Token. */ public int endLine; /** The column number of the last character of this Token. */ public int endColumn; /** * The string image of the token. */ public String image; /** * A reference to the next regular (non-special) token from the input * stream. If this is the last token from the input stream, or if the * token manager has not read tokens beyond this one, this field is * set to null. This is true only if this token is also a regular * token. Otherwise, see below for a description of the contents of * this field. */ public Token next; /** * This field is used to access special tokens that occur prior to this * token, but after the immediately preceding regular (non-special) token. * If there are no such special tokens, this field is set to null. * When there are more than one such special token, this field refers * to the last of these special tokens, which in turn refers to the next * previous special token through its specialToken field, and so on * until the first special token (whose specialToken field is null). * The next fields of special tokens refer to other special tokens that * immediately follow it (without an intervening regular token). If there * is no such token, this field is null. */ public Token specialToken; /** * An optional attribute value of the Token. * Tokens which are not used as syntactic sugar will often contain * meaningful values that will be used later on by the compiler or * interpreter. This attribute value is often different from the image. * Any subclass of Token that actually wants to return a non-null value can * override this method as appropriate. * @return attribute value */ public Object getValue() { return null; } /** * No-argument constructor. */ public Token() { /* empty */ } /** * Constructs a new token for the specified Image. * @param k token kind */ public Token(final int k) { this(k, null); } /** * Constructs a new token for the specified Image and Kind. * @param k token kind * @param img token image string */ public Token(final int k, final String img) { this.kind = k; this.image = img; } @Override public String toString() { return image; } /** * Returns a new Token object, by default. However, if you want, you * can create and return subclass objects based on the value of ofKind. * Simply add the cases to the switch for all those special cases. * For example, if you have a subclass of Token called IDToken that * you want to create if ofKind is ID, simply add something like : * * case MyParserConstants.ID : return new IDToken(ofKind, image); * * to the following switch statement. Then you can cast matchedToken * variable to the appropriate type and use sit in your lexical actions. * @param k token kind * @param img image string * @return token */ public static Token newToken(final int k, final String img) { switch(k) { default : return new Token(k, img); } } /** * Creates a token without image string. * @param k token kind * @return token */ public static Token newToken(final int k) { return newToken(k, null); } } /* JavaCC - OriginalChecksum=0e2bca851d2fd8bd770fe25aca90ec3a (do not edit this line) */ basex-7.7.2/basex-core/src/main/java/org/basex/query/regex/parse/TokenManager.java000066400000000000000000000011661222453003200300120ustar00rootroot00000000000000/* Generated By:JavaCC: Do not edit this line. TokenManager.java Version 5.0 */ /* JavaCCOptions:SUPPORT_CLASS_VISIBILITY_PUBLIC=true */ package org.basex.query.regex.parse; /** * An implementation for this interface is generated by * JavaCCParser. The user is free to use any implementation * of their choice. */ public interface TokenManager { /** * This gets the next token from the input stream. * A token of kind 0 (<EOF>) should be returned on EOF. * @return the next token */ public Token getNextToken(); } /* JavaCC - OriginalChecksum=06afe96651fae510c1b250bfb8f28360 (do not edit this line) */ basex-7.7.2/basex-core/src/main/java/org/basex/query/regex/parse/TokenMgrError.java000066400000000000000000000116651222453003200302040ustar00rootroot00000000000000/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */ /* JavaCCOptions: */ package org.basex.query.regex.parse; /** Token Manager Error. */ public class TokenMgrError extends Error { /** * The version identifier for this Serializable class. * Increment only if the serialized form of the * class changes. */ private static final long serialVersionUID = 1L; /* * Ordinals for various reasons why an Error of this type can be thrown. */ /** * Lexical error occurred. */ static final int LEXICAL_ERROR = 0; /** * An attempt was made to create a second instance of a static token manager. */ static final int STATIC_LEXER_ERROR = 1; /** * Tried to change to an invalid lexical state. */ static final int INVALID_LEXICAL_STATE = 2; /** * Detected (and bailed out of) an infinite loop in the token manager. */ static final int LOOP_DETECTED = 3; /** * Indicates the reason why the exception is thrown. It will have * one of the above 4 values. */ int errorCode; /** * Replaces unprintable characters by their escaped (or unicode escaped) * equivalents in the given string. * @param str string to be escaped * @return escaped string */ protected static final String addEscapes(final String str) { final StringBuilder retval = new StringBuilder(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 0 : continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { final String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } /** * Returns a detailed message for the Error when it is thrown by the * token manager to indicate a lexical error. * Note: You can customize the lexical error message by modifying this method. * @param eof indicates if EOF caused the lexical error * @param state lexical state in which this error occurred * @param line line number when the error occurred * @param col column number when the error occurred * @param after prefix that was seen before this error occurred * @param curr the offending character * @return error message */ @SuppressWarnings("unused") protected static String lexicalError(final boolean eof, final int state, final int line, final int col, final String after, final char curr) { return "Lexical error at line " + line + ", column " + col + ". Encountered: " + (eof ? " " : '"' + addEscapes(String.valueOf(curr)) + '"' + " (" + (int) curr + "), ") + "after : \"" + addEscapes(after) + '"'; } /** * You can also modify the body of this method to customize your error messages. * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not * of end-users concern, so you can return something like : * * "Internal Error : Please file a bug report .... " * * from this method for such cases in the release version of your parser. */ @Override public String getMessage() { return super.getMessage(); } /* * Constructors of various flavors follow. */ /** No arg constructor. */ public TokenMgrError() { } /** * Constructor with message and reason. * @param message error message * @param reason one of {@link #LEXICAL_ERROR}, {@link #INVALID_LEXICAL_STATE}, * {@link #STATIC_LEXER_ERROR}, {@link #LOOP_DETECTED} */ public TokenMgrError(final String message, final int reason) { super(message); errorCode = reason; } /** * Full Constructor. * @param eof end of file seen? * @param state lexer state * @param line error line * @param col error column * @param after string after which the error occured * @param curr current character * @param reason one of {@link #LEXICAL_ERROR}, {@link #INVALID_LEXICAL_STATE}, * {@link #STATIC_LEXER_ERROR}, {@link #LOOP_DETECTED} */ public TokenMgrError(final boolean eof, final int state, final int line, final int col, final String after, final char curr, final int reason) { this(lexicalError(eof, state, line, col, after, curr), reason); } } /* JavaCC - OriginalChecksum=ba630fd1bc74645b6bed17f33f702196 (do not edit this line) */ basex-7.7.2/basex-core/src/main/java/org/basex/query/regex/parse/package-info.java000066400000000000000000000004551222453003200277630ustar00rootroot00000000000000 /** * This module contains {@code JavaCC}-generated classes for parsing XSD regular * expressions. All files are under BSD license, although proper headers can't always be * guaranteed. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ package org.basex.query.regex.parse;basex-7.7.2/basex-core/src/main/java/org/basex/query/up/000077500000000000000000000000001222453003200227705ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/up/ContextModifier.java000066400000000000000000000073021222453003200267400ustar00rootroot00000000000000package org.basex.query.up; import java.util.*; import org.basex.data.*; import org.basex.query.*; import org.basex.query.up.primitives.*; import org.basex.util.list.*; /** * Base class for the different context modifiers. A context modifier aggregates * all updates for a specific context. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public abstract class ContextModifier { /** Update primitives, aggregated separately for each database which is * referenced during a snapshot. */ private final Map pendingUpdates = new HashMap(); /** Holds DBCreate primitives which are not associated with a database. */ private final Map dbCreates = new HashMap(); /** Temporary data reference, containing all XML fragments to be inserted. */ MemData tmp; /** * Adds an update primitive to this context modifier. * @param p update primitive * @param ctx query context * @throws QueryException query exception */ abstract void add(final Operation p, final QueryContext ctx) throws QueryException; /** * Adds an update primitive to this context modifier. * Will be called by {@link #add(Operation, QueryContext)}. * @param p update primitive * @throws QueryException query exception */ final void add(final Operation p) throws QueryException { if(p instanceof DBCreate) { final DBCreate c = (DBCreate) p; final DBCreate o = dbCreates.get(c.name); if(o != null) o.merge(c); dbCreates.put(c.name, c); return; } final Data data = p.getData(); DatabaseUpdates dbp = pendingUpdates.get(data); if(dbp == null) { dbp = new DatabaseUpdates(data); pendingUpdates.put(data, dbp); } // create temporary mem data instance if not available yet if(tmp == null) tmp = new MemData(data.meta.prop); dbp.add(p, tmp); } /** * Adds all databases to be updated to the specified list. * @param db databases */ void databases(final StringList db) { for(final DatabaseUpdates du : pendingUpdates.values()) { final Data d = du.data(); if(!d.inMemory()) db.add(d.meta.name); } for(final DBCreate dc : dbCreates.values()) db.add(dc.name); } /** * Checks constraints and applies all update primitives to the databases if * no constraints are hurt. * @throws QueryException query exception */ final void apply() throws QueryException { // checked constraints final Collection updates = pendingUpdates.values(); final Collection creates = dbCreates.values(); // create temporary mem data instance if not available yet if(tmp == null) { for(final DatabaseUpdates c : updates) { tmp = new MemData(c.data().meta.prop); break; } } for(final DatabaseUpdates c : updates) c.check(tmp); for(final DBCreate c : creates) c.prepare(null); int i = 0; try { // mark disk database instances as updating for(final DatabaseUpdates c : updates) { c.startUpdate(); i++; } // apply updates for(final DatabaseUpdates c : updates) c.apply(); } finally { // remove write locks and updating files for(final DatabaseUpdates c : updates) { if(i-- == 0) break; c.finishUpdate(); } } // create databases for(final DBCreate c : creates) c.apply(); } /** * Returns the total number of update operations. * @return number of updates */ final int size() { int s = 0; for(final DatabaseUpdates c : pendingUpdates.values()) s += c.size(); for(final DBCreate c : dbCreates.values()) s += c.size(); return s; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/DatabaseModifier.java000066400000000000000000000015321222453003200270170ustar00rootroot00000000000000package org.basex.query.up; import static org.basex.query.util.Err.*; import org.basex.core.*; import org.basex.query.*; import org.basex.query.up.primitives.*; /** * The database modifier holds all database updates during a snapshot. * Database permissions are checked to ensure that a user possesses enough * privileges to alter database contents. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ final class DatabaseModifier extends ContextModifier { @Override void add(final Operation o, final QueryContext ctx) throws QueryException { add(o); // check permissions if(o instanceof DBCreate) { if(!ctx.context.perm(Perm.CREATE, null)) BASX_PERM.thrw(o.getInfo(), Perm.CREATE); } else if(!ctx.context.perm(Perm.WRITE, o.getData().meta)) BASX_PERM.thrw(o.getInfo(), Perm.WRITE); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/DatabaseUpdates.java000066400000000000000000000215641222453003200266750ustar00rootroot00000000000000package org.basex.query.up; import static org.basex.query.util.Err.*; import java.io.*; import java.util.*; import java.util.List; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.data.atomic.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.up.primitives.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * This class 'caches' all updates, fn:put operations and other database related * operations that are initiated within a snapshot. Regarding the XQUF specification it * fulfills the purpose of a 'pending update list'. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ final class DatabaseUpdates { /** Data reference. */ private final Data data; /** Pre values of target nodes. */ private IntList nodes = new IntList(0); /** Mapping between pre values of the target nodes and all update primitives * which operate on this target. */ private IntObjMap updatePrimitives = new IntObjMap(); /** Database operations which are applied after all updates have been executed. */ private final List dbops = new LinkedList(); /** Put operations which reflect all changes made during the snapshot, hence executed * after updates have been carried out. */ private final IntObjMap puts = new IntObjMap(); /** Number of updates. */ private int size; /** * Constructor. * @param d data reference */ DatabaseUpdates(final Data d) { data = d; } /** * Adds an update primitive to the list. * @param o update primitive * @param tmp temporary mem data * @throws QueryException query exception */ void add(final Operation o, final MemData tmp) throws QueryException { if(o instanceof UpdatePrimitive) { for(final UpdatePrimitive subp : ((UpdatePrimitive) o).substitute(tmp)) { final int pre = subp.targetPre; NodeUpdates pc = updatePrimitives.get(pre); if(pc == null) { pc = new NodeUpdates(); updatePrimitives.put(pre, pc); } pc.add(subp); } } else if(o instanceof Put) { final Put p = (Put) o; final int id = p.nodeid; final Put old = puts.get(id); if(old == null) puts.put(id, p); else old.merge(p); } else { final BasicOperation oo = (BasicOperation) o; final BasicOperation d = find(oo); if(d == null) dbops.add(oo); else d.merge(oo); } } /** * Finds a {@link BasicOperation} of the same * {@link org.basex.query.up.primitives.BasicOperation.TYPE} in the operations list if * there is any. * @param oo DBOperation of a specific type * @return DBOperation of the same type, or null if there is none */ private BasicOperation find(final BasicOperation oo) { for(final BasicOperation o : dbops) if(o.type == oo.type) return o; return null; } /** * Checks updates for violations. If a violation is found the complete update * process is aborted. * @param tmp temporary mem data * @throws QueryException query exception */ void check(final MemData tmp) throws QueryException { // Prepare/check database operations for(final BasicOperation d : dbops) d.prepare(tmp); // Prepare/check XQUP primitives: final int s = updatePrimitives.size(); nodes = new IntList(s); for(int i = 1; i <= s; i++) nodes.add(updatePrimitives.key(i)); nodes.sort(); for(int i = 0; i < s; ++i) { final NodeUpdates ups = updatePrimitives.get(nodes.get(i)); for(final UpdatePrimitive p : ups.prim) { if(p instanceof NodeCopy) ((NodeCopy) p).prepare(tmp); } } // check attribute duplicates int p = nodes.size() - 1; int par = -1; while(p >= 0) { // parent of a previous attribute has already been checked if(par == nodes.get(p) && --p < 0) break; int pre = nodes.get(p); // catching optimize statements which have PRE == -1 as a target if(pre == -1) return; final int k = data.kind(pre); if(k == Data.ATTR) { par = data.parent(pre, k); final IntList il = new IntList(); while(p >= 0 && (pre = nodes.get(p)) > par) { il.add(pre); --p; } if(par != -1) il.add(par); checkNames(il.toArray()); } else { if(k == Data.ELEM) checkNames(pre); --p; } } } /** * Locks the database for write operations. * @throws QueryException query exception */ void startUpdate() throws QueryException { if(!data.startUpdate()) BXDB_OPENED.thrw(null, data.meta.name); } /** * Locks the database for write operations. */ void finishUpdate() { // may have been invalidated by db:drop if(data != null) data.finishUpdate(); } /** * Returns the data instance. * @return data data instance */ Data data() { return data; } /** * Applies all updates for this specific database. * @throws QueryException query exception */ void apply() throws QueryException { // execute database updates createAtomicUpdates(preparePrimitives()).execute(true); // execute database operations Collections.sort(dbops); for(final BasicOperation d : dbops) d.apply(); // execute fn:put operations for(final Put p : puts.values()) p.apply(); if(data.meta.prop.is(Prop.WRITEBACK) && !data.meta.original.isEmpty()) { try { final SerializerProp sp = new SerializerProp(data.meta.prop.get(Prop.EXPORTER)); Export.export(data, data.meta.original, sp, null); } catch(final IOException ex) { UPPUTERR.thrw(null, data.meta.original); } } } /** * Prepares the {@link UpdatePrimitive} for execution incl. ordering, * and removes the update primitive references to save memory. * @return ordered list of update primitives */ private List preparePrimitives() { final List upd = new ArrayList(); for(int i = nodes.size() - 1; i >= 0; i--) { final int pre = nodes.get(i); final NodeUpdates n = updatePrimitives.get(pre); for(final UpdatePrimitive p : n.finish()) { upd.add(p); size += p.size(); } } for(int i = dbops.size() - 1; i >= 0; i--) { size += dbops.get(i).size(); } updatePrimitives = null; nodes = null; Collections.sort(upd, new UpdatePrimitiveComparator()); return upd; } /** * Creates a list of atomic updates that can be applied to the database. * @param l list of ordered {@link UpdatePrimitive} * @return list of atomic updates ready for execution */ private AtomicUpdateList createAtomicUpdates(final List l) { final AtomicUpdateList atomics = new AtomicUpdateList(data); // from the highest to the lowest score for(int i = l.size() - 1; i >= 0; i--) { final UpdatePrimitive u = l.get(i); u.addAtomics(atomics); l.set(i, null); } return atomics; } /** * Returns the number of performed updates. * @return number of updates */ int size() { return size; } /** * Checks nodes for namespace conflicts and duplicate attributes. * @param pres pre values of nodes to check (in descending order) * @throws QueryException query exception */ private void checkNames(final int... pres) throws QueryException { // check for namespace conflicts final NamePool pool = new NamePool(); for(final int pre : pres) { final NodeUpdates ups = updatePrimitives.get(pre); // add changes introduced by updates to check namespaces and duplicate attributes if(ups != null) for(final UpdatePrimitive up : ups.prim) up.update(pool); } // check namespaces if(!pool.nsOK()) UPNSCONFL2.thrw(null); // add the already existing attributes to the name pool final IntSet il = new IntSet(); for(final int pre : pres) { // pre values consist exclusively of element and attribute nodes if(data.kind(pre) == Data.ATTR) { final byte[] nm = data.name(pre, Data.ATTR); final QNm name = new QNm(nm); final byte[] uri = data.nspaces.uri(data.nspaces.uri(nm, pre, data)); if(uri != null) name.uri(uri); pool.add(name, NodeType.ATT); il.add(pre); } else { final int ps = pre + data.attSize(pre, Data.ELEM); for(int p = pre + 1; p < ps; ++p) { final byte[] nm = data.name(p, Data.ATTR); if(!il.contains(p)) { final QNm name = new QNm(nm); final byte[] uri = data.nspaces.uri(data.nspaces.uri(nm, p, data)); if(uri != null) name.uri(uri); pool.add(name, NodeType.ATT); } } } } final QNm dup = pool.duplicate(); if(dup != null) UPATTDUPL.thrw(null, dup); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/NamePool.java000066400000000000000000000060461222453003200253530ustar00rootroot00000000000000package org.basex.query.up; import static org.basex.util.Token.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * This class serves as a container for updated names. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class NamePool { /** Name cache. */ private NameCache[] cache = new NameCache[1]; /** Number of entries. */ private int size; /** * Adds an entry to the pool and increases its number of occurrence. * @param name name * @param type node type */ public void add(final QNm name, final NodeType type) { if(type != NodeType.ATT && type != NodeType.ELM) return; final int i = index(name, type == NodeType.ATT); cache[i].add++; } /** * Adds an entry to the pool and decreases its number of occurrence. * @param node node */ public void remove(final ANode node) { if(node.type != NodeType.ATT && node.type != NodeType.ELM) return; final int i = index(node.qname(), node.type == NodeType.ATT); cache[i].del = true; } /** * Returns the name of a duplicate attribute, or {@code null}. * @return name of duplicate attribute */ QNm duplicate() { // if node has been deleted, overall count for duplicates must be bigger 2 for(int i = 0; i < size; ++i) { if(cache[i].attr && cache[i].add > (cache[i].del ? 2 : 1)) return cache[i].name; } return null; } /** * Checks if no namespace conflicts occur. * @return success flag */ boolean nsOK() { final Atts at = new Atts(); for(int i = 0; i < size; ++i) { if(cache[i].add <= (cache[i].del ? 1 : 0)) continue; final QNm nm = cache[i].name; final byte[] pref = nm.prefix(); final byte[] uri = nm.uri(); // attributes with empty URI don't conflict with anything if(cache[i].attr && uri.length == 0) continue; final byte[] u = at.value(pref); if(u == null) at.add(pref, uri); // check if only one uri is assigned to a prefix else if(!eq(uri, u)) return false; } return true; } /** * Returns an index to an existing entry. * @param name name to be found * @param at attribute/element flag * @return index offset, or -1 */ private int index(final QNm name, final boolean at) { for(int i = 0; i < size; ++i) { final NameCache nc = cache[i]; if(nc.name.eq(name) && nc.attr == at) return i; } if(size == cache.length) cache = Array.copy(cache, new NameCache[Array.newSize(size)]); final NameCache nc = new NameCache(); nc.name = name; nc.attr = at; cache[size] = nc; return size++; } /** Name cache. */ static final class NameCache { /** Name. */ QNm name; /** Attribute/element flag. */ boolean attr; /** Counts the number of times the name is added. */ int add; /** States if the name is deleted. */ boolean del; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/NodeUpdates.java000066400000000000000000000111371222453003200260510ustar00rootroot00000000000000package org.basex.query.up; import static org.basex.query.up.primitives.PrimitiveType.*; import java.util.*; import org.basex.query.*; import org.basex.query.up.primitives.*; /** * This container holds all update primitives for a specific database node. * It is identified by its target node's PRE value and data reference. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ final class NodeUpdates { /** Container for update primitives. */ List prim = new ArrayList(1); /** * Adds an update primitive to this container. * @param p primitive * @throws QueryException query exception */ void add(final UpdatePrimitive p) throws QueryException { // Primitives can be merged eventually ... final int typeIndex = index(p.type); if(typeIndex == -1) { prim.add(p); } else { final UpdatePrimitive up = prim.get(typeIndex); // but an insertInto could be part of a substitute of a replaceElementContent, // then we cannot merge them, as this would insert unwanted nodes if(up instanceof InsertInto) { final InsertInto oprim = (InsertInto) up; final InsertInto nprim = (InsertInto) p; // if the new primitive substitutes, than replace the old one with the new one if(nprim instanceof ReplaceContent) { prim.set(typeIndex, nprim); } else if(!(oprim instanceof ReplaceContent)) { // if neither substitutes, merge them. up.merge(p); } } else { // all other primitives can be merged regardless up.merge(p); } } } /** * Find the update primitive with the given type. In case there is no * primitive of the given type, null is returned. * @param t PrimitiveType * @return primitive of type t, null if not found */ private UpdatePrimitive find(final PrimitiveType t) { for(final UpdatePrimitive p : prim) { if(p.type == t) return p; } return null; } /** * Find the update primitive with the given {@link PrimitiveType} and returns its index. * @param t PrimitiveType * @return index of primitive with given type or -1 if not found */ private int index(final PrimitiveType t) { for(int i = 0; i < prim.size(); i++) { if(prim.get(i).type == t) return i; } return -1; } /** * Prepares the updates. Makes sure that ... * - replaceElementContent has the desired effect. * - a replace and a delete on a target T result in replacing the node. * @return list with update primitives * This method can only be once, as the internal update list will eventually be removed. */ List finish() { List primnew = new ArrayList(); /* Check if target node T is deleted and remove superfluous primitives. */ final DeleteNode del = (DeleteNode) find(DELETENODE); /* If T is deleted due to a substitution of a replaceElementContent * expression all other primitives operating on this node must be removed. According * to the XQUF, a target T of a replaceElementContent contains, after the end of the * snapshot, either a text node as a single child or no child node at all. */ if(del != null && del.rec) { primnew.add(del); prim = null; return primnew; } // If T is replaced, all primitives other than InsertBefore and InsertAfter can be // removed. final ReplaceNode replace = (ReplaceNode) find(REPLACENODE); if(replace != null) { for(final UpdatePrimitive p : prim) { if(p.type == REPLACENODE || p.type == INSERTBEFORE || p.type == INSERTAFTER) primnew.add(p); } prim = null; return primnew; } /* If the target T is affected by a replaceElementContent expression, all * primitives that insert any nodes into T have to be removed from the list. * An InsertInto which is part of the substitution of the replaceElementContent * expression forms the only exception. */ final ReplaceValue rec = (ReplaceValue) find(REPLACEVALUE); if(rec != null && rec.rec) { for(final UpdatePrimitive p : prim) { /* Add only InsertIntos that are part of the substitution and make sure no * other primitive is added, that adds nodes to the child axis of T. */ if(p.type != INSERTINTOFIRST && p.type != INSERTINTO && p.type != INSERTINTOLAST || p.type == INSERTINTO && p instanceof ReplaceContent) primnew.add(p); } prim = null; return primnew; } // otherwise, return old list primnew = prim; prim = null; return primnew; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/TransformModifier.java000066400000000000000000000033351222453003200272710ustar00rootroot00000000000000package org.basex.query.up; import static org.basex.query.util.Err.*; import java.util.*; import org.basex.data.*; import org.basex.query.*; import org.basex.query.up.primitives.*; /** * The Transform context modifier carries out updates of a single transform * expression. It especially keeps track of all nodes that are copied in the * 'copy' statement of a transform expression. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class TransformModifier extends ContextModifier { /** Holds all data references created by the copy clause of a transform * expression. Adding an update primitive that is declared within the modify * clause of this transform expression will cause a query exception * (XUDY0014) if the data reference of the corresponding target node is not * part of this set, hence the target node has not been copied. */ private final Set refs = new HashSet(); /** * Adds a data reference to list which keeps track of the nodes copied * within a transform expression. * @param d reference */ public void addData(final Data d) { refs.add(d); } @Override void add(final Operation o, final QueryContext ctx) throws QueryException { /* Disallow side-effecting updates within transform expressions. * Currently, also fn:put() is rejected * (future discussion: https://www.w3.org/Bugs/Public/show_bug.cgi?id=13970). */ if(o instanceof BasicOperation) BASX_DBTRANSFORM.thrw(o.getInfo()); add(o); /* check if the target node of the given primitive has been copied in the * 'copy' statement of this transform expression. */ if(!refs.contains(o.getData())) UPNOTCOPIED.thrw(o.getInfo(), o.getTargetNode()); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/UpdatePrimitiveComparator.java000066400000000000000000000137501222453003200310040ustar00rootroot00000000000000package org.basex.query.up; import static org.basex.query.up.primitives.PrimitiveType.*; import java.util.*; import org.basex.data.*; import org.basex.query.up.primitives.*; import org.basex.util.*; /** *

Comparator for {@link UpdatePrimitive}.

* *

In general, a list of updates is applied from the highest to the lowest PRE value in * BaseX. The higher the actual location of an update the sooner it is applied, hence * the 'greater' {@link UpdatePrimitive} is applied first. The order further relies on * the definition of {@link PrimitiveType}.

* *

{@link UpdatePrimitive}s are identified by their target node's PRE values (T). * Depending on the {@link PrimitiveType} of the update, a specific PRE value on the * table is affected (L). Hence it is not sufficient to order primitives based on T * (see case 2,3 below). It is also not sufficient to order them based on L (see case * 2,3 below).

* *

The first {@link UpdatePrimitive} is referred to as P1, the target node of P1 is * referred to as T1, the (optional) insertion sequence for P1 is S1, the actually * affected PRE value on disk is L1. For the second P2, T2, S2, L2.

* *

The result of the comparison depends on several things:

* *
    *
  1. The PRE values of T1 and T2. * Consider D the document . If P1 is a {@link DeleteNode} on N1 * and P2 is a {@link DeleteNode} on N2, it follows that T2>T1. P2 wins the comparison * and is therefore executed first.
  2. * *
  3. Whether the order of P1, P2 must be switched to get the desired result. * Consider D the document <\/N1>. If P1 is an {@link InsertInto} on * N1 and P2 is an {@link InsertInto} on N2, it follows that T2>T1. Yet, executing P2 * first would lead to the following problem:
    * * The actually affected PRE value location on disk for both updates is L1=L2=L=4. P2 * inserts a sequence of nodes S2 at L. After this P1 inserts a sequence of nodes S1 at * the same location L and shifts S2 further back on disk. S1 and S2 are now ordered * incorrectly (S1,S2) and invalidate the document.
    * * Hence the correct order (S2,S1) can only be achieved if P1 is executed first and S1 * subsequently shifted by inserting S2.
    * * The problem can exist if P1 and/or P2 are of the kind {@link InsertInto} or * {@link InsertAfter} and T1+size(T1) is equal T2+size(T2), hence T1 and T2 have the * same following node. The correct order is realized by executing the update first, that * is on the ancestor axis of the other. In this case P1>P2.
    * * Another case similar to this is if P1 is an {@link InsertIntoAsFirst} on an element * T1 and P2 is i.e. a {@link ReplaceNode} on an attribute T2 of T1. To get the desired * order of insertion sequences (S2,S1) P1 must be executed first, hence P1>P2.
  4. * *
  5. The {@link PrimitiveType} of P1, P2. * Consider D the document with T=N1. P1 is an {@link InsertBefore} * on T and P2 is an {@link InsertIntoAsFirst} on the same target T. As they both operate * on the same target, both have not to be re-located because of their type (see case 2), * hence only differ in their {@link PrimitiveType}, it follows that P2>P1 as nodes * S2 are to be inserted on the following axis of S1.
    * * Another case: P2 a {@link DeleteNode} on T and P1 an {@link InsertBefore} on T. As * L2=L1, P2, the execution sequence must be (P2,P1). For (P1,P2) S1 would be deleted by * P2. The correct order is also determined by the order of {@link PrimitiveType}. Here * we see that ordering updates simply by the actually affected PRE value L is not * sufficient.
  6. *
* * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public class UpdatePrimitiveComparator implements Comparator { @Override public int compare(final UpdatePrimitive a, final UpdatePrimitive b) { // data the same for both primitives final Data data = a.data; /* Step 1: Calculate actual locations correctly. Location is only changed for * - InsertInto, InsertAfter, as they must be executed before anything on the * descendant axis of T * - InsertIntoAsFirst, as this must be executed before anything on the attribute * axis of T */ final boolean aIsInsertInto = a.type == INSERTINTO || a.type == INSERTINTOLAST || a.type == INSERTAFTER; final boolean bIsInsertInto = b.type == INSERTINTO || b.type == INSERTINTOLAST || b.type == INSERTAFTER; final boolean aIsInsertIntoAsFirst = a.type == INSERTINTOFIRST; final boolean bIsInsertIntoAsFirst = b.type == INSERTINTOFIRST; final int aPre = a.targetPre; final int bPre = b.targetPre; final int aKind = data.kind(aPre); final int bKind = data.kind(bPre); final int aSize = data.size(aPre, aKind); final int bSize = data.size(bPre, bKind); final int aActualLocation = aPre + (aIsInsertInto ? aSize : 0) + (aIsInsertIntoAsFirst ? data.attSize(aPre, aKind) : 0); final int bActualLocation = bPre + (bIsInsertInto ? bSize : 0) + (bIsInsertIntoAsFirst ? data.attSize(bPre, bKind) : 0); // Step 2: Compare Locations. if(aActualLocation > bActualLocation) return 1; if(bActualLocation > aActualLocation) return -1; /* Step 3: Subtree check. If one update A adds a node to the end of its subtree and * the other update takes place in this subtree of A, A wins. */ if(aActualLocation > bPre && aPre < bPre) return 1; if(bActualLocation > aPre && bPre < aPre) return -1; /* Step 4: Compare target PRE values if the actual locations are equal and the * subtree check yields no decision. */ if(aPre > bPre) return 1; if(bPre > aPre) return -1; // Step 5: Compare type of primitives for a final decision. if(a.type.ordinal() > b.type.ordinal()) return 1; if(b.type.ordinal() > a.type.ordinal()) return -1; // Two UpdatePrimitives cannot be equal! Util.notexpected("Ambiguous order of UpdatePrimitives: " + a + ", " + b); return 0; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/Updates.java000066400000000000000000000136241222453003200252460ustar00rootroot00000000000000package org.basex.query.up; import org.basex.data.*; import org.basex.data.atomic.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.up.primitives.*; import org.basex.query.value.node.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** *

Implementation of the W3C XQUERY UPDATE FACILITY 1.0.

* *

Holds all update operations and primitives a snapshot contains, checks * constraints and finally executes the updates.

* *

Fragment updates are treated like database updates. An artificial data * instance is created for each fragment. Ultimately the updating process for * a fragment is the same as for a database node.

* *

The complete updating process is custom-tailored to the * sequential table encoding of BaseX. As a general rule, all updates are * collected and applied for each database from bottom to top, regarding the * PRE values of the corresponding target nodes. Updates on the highest PRE * values are applied first.

* *

Updates work like the following:

* *
    *
  1. Each call of an updating expression creates an {@link UpdatePrimitive}.
  2. *
  3. All update primitives for a snapshot/query are collected here.
  4. *
  5. Primitives are kept separately for each database that is addressed. This * way we can operate on PRE values instead of node IDs, skip mapping * overhead and further optimize the process. * {@link DatabaseUpdates}
  6. *
  7. Primitives are further kept separately for each database node - each * individual target PRE value. There's a specific container for this: * {@link NodeUpdates}
  8. *
  9. Transform expressions are executed in an 'isolated' updating environment, * see {@link TransformModifier}. All the other updates are executed by * a {@link DatabaseModifier}.
  10. *
  11. After the query has been parsed and all update primitives have been added * to the list, constraints, which cannot be taken care of on the fly, are * checked. If no problems occur, updates are TO BE carried out.
  12. *
  13. Before applying the updates the {@link UpdatePrimitiveComparator} helps to order * {@link UpdatePrimitive} for execution. Each primitive then creates a sequence of * {@link BasicUpdate} which are passed to the {@link Data} layer via an * {@link AtomicUpdateList}. This list takes care of optimization and also text node * merging.
  14. *
* * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class Updates { /** Current context modifier. */ public ContextModifier mod; /** All file paths that are targeted during a snapshot by an fn:put expression. */ public final TokenSet putPaths = new TokenSet(); /** Mapping between fragment IDs and the temporary data instances * to apply updates on the corresponding fragments. */ private final IntObjMap fragmentIDs = new IntObjMap(); /** * Adds an update primitive to the current context modifier. * @param up update primitive * @param ctx query context * @throws QueryException query exception */ public void add(final Operation up, final QueryContext ctx) throws QueryException { if(mod == null) mod = new DatabaseModifier(); mod.add(up, ctx); } /** * Determines the data reference and pre value for an update primitive * which has a fragment as a target node. If an ancestor of the given target * node has already been added to the pending update list, the corresponding * data reference and the pre value of the given target node within this * database table are calculated. Otherwise a new data instance is created. * * @param target target fragment * @param ctx query context * @return database node created from input fragment */ public DBNode determineDataRef(final ANode target, final QueryContext ctx) { if(target instanceof DBNode) return (DBNode) target; // determine highest ancestor node ANode anc = target; final AxisIter it = target.ancestor(); for(ANode p; (p = it.next()) != null;) anc = p; /* See if this ancestor has already been added to the pending update list. * In this case a database has already been created. */ final int ancID = anc.id; MemData data = fragmentIDs.get(ancID); // if data doesn't exist, create a new one if(data == null) { data = (MemData) anc.dbCopy(ctx.context.prop).data; // create a mapping between the fragment id and the data reference fragmentIDs.put(ancID, data); } // determine the pre value of the target node within its database final int trgID = target.id; final int pre = preSteps(anc, trgID); return new DBNode(data, pre); } /** * Executes all updates. * @throws QueryException query exception */ public void apply() throws QueryException { if(mod != null) mod.apply(); } /** * Adds all databases to be updated to the specified list. * @return databases */ public StringList databases() { final StringList sl = new StringList(1); if(mod != null) mod.databases(sl); return sl; } /** * Number of updates on the pending update list. * @return #updates */ public int size() { return mod == null ? 0 : mod.size(); } /** * Recursively determines the pre value for a given fragment node within the * corresponding data reference. * @param node current * @param trgID ID of fragment for which we calculate the pre value * @return pre value */ private static int preSteps(final ANode node, final int trgID) { if(node.id == trgID) return 0; int s = 1; AxisIter it = node.attributes(); for(ANode n; (n = it.next()) != null;) { final int st = preSteps(n, trgID); if(st == 0) return s; s += st; } it = node.children(); for(ANode n; (n = it.next()) != null && n.id <= trgID;) { s += preSteps(n, trgID); } return s; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/expr/000077500000000000000000000000001222453003200237465ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/up/expr/Delete.java000066400000000000000000000027171222453003200260220ustar00rootroot00000000000000package org.basex.query.up.expr; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.up.primitives.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Delete expression. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class Delete extends Update { /** * Constructor. * @param ii input info * @param r return expression */ public Delete(final InputInfo ii, final Expr r) { super(ii, r); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { final Iter t = ctx.iter(expr[0]); for(Item i; (i = t.next()) != null;) { if(!(i instanceof ANode)) UPTRGDELEMPT.thrw(info); final ANode n = (ANode) i; // nodes without parents are ignored if(n.parent() == null) continue; final DBNode dbn = ctx.updates.determineDataRef(n, ctx); ctx.updates.add(new DeleteNode(dbn.pre, dbn.data, info), ctx); } return null; } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new Delete(info, expr[0].copy(ctx, scp, vs)); } @Override public String toString() { return DELETE + ' ' + NODES + ' ' + expr[0]; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/expr/Insert.java000066400000000000000000000067771222453003200260760ustar00rootroot00000000000000package org.basex.query.up.expr; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.up.primitives.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Insert expression. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class Insert extends Update { /** First flag. */ private final boolean first; /** Last flag. */ private final boolean last; /** Before flag. */ private final boolean before; /** After flag. */ private final boolean after; /** * Constructor. * @param ii input info * @param src source expression * @param f first flag * @param l last * @param b before * @param a after * @param trg target expression */ public Insert(final InputInfo ii, final Expr src, final boolean f, final boolean l, final boolean b, final boolean a, final Expr trg) { super(ii, trg, src); first = f; last = l; before = b; after = a; } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { final Constr c = new Constr(ii, ctx).add(expr[1]); final ANodeList cList = c.children; final ANodeList aList = c.atts; if(c.errAtt) UPNOATTRPER.thrw(info); if(c.duplAtt != null) UPATTDUPL.thrw(info, new QNm(c.duplAtt)); // check target constraints final Iter t = ctx.iter(expr[0]); final Item i = t.next(); if(i == null) UPSEQEMP.thrw(info, Util.name(this)); if(!(i instanceof ANode) || t.next() != null) (before || after ? UPTRGTYP2 : UPTRGTYP).thrw(info); final ANode n = (ANode) i; final ANode par = n.parent(); if(before || after) { if(n.type == NodeType.ATT || n.type == NodeType.DOC) UPTRGTYP2.thrw(info); if(par == null) UPPAREMPTY.thrw(info); } else { if(n.type != NodeType.ELM && n.type != NodeType.DOC) UPTRGTYP.thrw(info); } UpdatePrimitive up; DBNode dbn; // no update primitive is created if node list is empty if(aList.size() > 0) { final ANode targ = before || after ? par : n; if(targ.type != NodeType.ELM) (before || after ? UPATTELM : UPATTELM2).thrw(info); dbn = ctx.updates.determineDataRef(targ, ctx); up = new InsertAttribute(dbn.pre, dbn.data, info, checkNS(aList, targ, ctx)); ctx.updates.add(up, ctx); } // no update primitive is created if node list is empty if(cList.size() > 0) { dbn = ctx.updates.determineDataRef(n, ctx); if(before) up = new InsertBefore(dbn.pre, dbn.data, info, cList); else if(after) up = new InsertAfter(dbn.pre, dbn.data, info, cList); else if(first) up = new InsertIntoAsFirst(dbn.pre, dbn.data, info, cList); else if(last) up = new InsertIntoAsLast(dbn.pre, dbn.data, info, cList); else up = new InsertInto(dbn.pre, dbn.data, info, cList); ctx.updates.add(up, ctx); } return null; } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new Insert(info, expr[1].copy(ctx, scp, vs), first, last, before, after, expr[0].copy(ctx, scp, vs)); } @Override public String toString() { return INSERT + ' ' + NODE + ' ' + expr[1] + ' ' + INTO + ' ' + expr[0]; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/expr/Rename.java000066400000000000000000000046341222453003200260270ustar00rootroot00000000000000package org.basex.query.up.expr; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.up.primitives.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Rename expression. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class Rename extends Update { /** * Constructor. * @param ii input info * @param tg target expression * @param n new name expression */ public Rename(final InputInfo ii, final Expr tg, final Expr n) { super(ii, tg, n); } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { final Iter t = ctx.iter(expr[0]); final Item i = t.next(); // check target constraints if(i == null) throw UPSEQEMP.thrw(info, Util.name(this)); if(t.next() != null) UPWRTRGTYP.thrw(info); final CFrag ex; if(i.type == NodeType.ELM) { ex = new CElem(info, expr[1], null); } else if(i.type == NodeType.ATT) { ex = new CAttr(info, false, expr[1], Empty.SEQ); } else if(i.type == NodeType.PI) { ex = new CPI(info, expr[1], Empty.SEQ); } else { throw UPWRTRGTYP.thrw(info); } final QNm rename = ex.item(ctx, info).qname(); final ANode targ = (ANode) i; // check namespace conflicts... if(targ.type == NodeType.ELM || targ.type == NodeType.ATT) { final byte[] rp = rename.prefix(); final byte[] ru = rename.uri(); final Atts at = targ.nsScope(); final int as = at.size(); for(int a = 0; a < as; a++) { if(eq(at.name(a), rp) && !eq(at.value(a), ru)) UPNSCONFL.thrw(info); } } final DBNode dbn = ctx.updates.determineDataRef(targ, ctx); ctx.updates.add(new RenameNode(dbn.pre, dbn.data, info, rename), ctx); return null; } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new Rename(info, expr[0].copy(ctx, scp, vs), expr[1].copy(ctx, scp, vs)); } @Override public String toString() { return RENAME + ' ' + NODE + ' ' + expr[0] + ' ' + AS + ' ' + expr[1]; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/expr/Replace.java000066400000000000000000000057601222453003200261740ustar00rootroot00000000000000package org.basex.query.up.expr; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.up.primitives.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Replace expression. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class Replace extends Update { /** 'Value of' flag. */ private final boolean value; /** * Constructor. * @param ii input info * @param t target expression * @param r source expression * @param v replace value of */ public Replace(final InputInfo ii, final Expr t, final Expr r, final boolean v) { super(ii, t, r); value = v; } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { final Constr c = new Constr(ii, ctx).add(expr[1]); if(c.errAtt) UPNOATTRPER.thrw(info); if(c.duplAtt != null) UPATTDUPL.thrw(info, new QNm(c.duplAtt)); final Iter t = ctx.iter(expr[0]); final Item i = t.next(); // check target constraints if(i == null) throw UPSEQEMP.thrw(info, Util.name(this)); final Type tp = i.type; if(!(i instanceof ANode) || tp == NodeType.DOC || t.next() != null) UPTRGMULT.thrw(info); final ANode targ = (ANode) i; final DBNode dbn = ctx.updates.determineDataRef(targ, ctx); // replace node final ANodeList aList = c.atts; ANodeList list = c.children; if(value) { // replace value of node final byte[] txt = list.size() < 1 ? aList.size() < 1 ? EMPTY : aList.get(0).string() : list.get(0).string(); // check validity of future comments or PIs if(tp == NodeType.COM) FComm.parse(txt, info); if(tp == NodeType.PI) FPI.parse(txt, info); ctx.updates.add(new ReplaceValue(dbn.pre, dbn.data, info, txt), ctx); } else { final ANode par = targ.parent(); if(par == null) UPNOPAR.thrw(info, i); if(tp == NodeType.ATT) { // replace attribute node if(list.size() > 0) UPWRATTR.thrw(info); list = checkNS(aList, par, ctx); } else { // replace non-attribute node if(aList.size() > 0) UPWRELM.thrw(info); } // conforms to specification: insertion sequence may be empty ctx.updates.add(new ReplaceNode(dbn.pre, dbn.data, info, list), ctx); } return null; } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new Replace(info, expr[0].copy(ctx, scp, vs), expr[1].copy(ctx, scp, vs), value); } @Override public String toString() { return REPLACE + (value ? ' ' + VALUEE + ' ' + OF : "") + ' ' + NODE + ' ' + expr[0] + ' ' + WITH + ' ' + expr[1]; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/expr/Transform.java000066400000000000000000000101601222453003200265620ustar00rootroot00000000000000package org.basex.query.up.expr; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.gflwor.*; import org.basex.query.iter.*; import org.basex.query.up.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Transform expression. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class Transform extends Arr { /** Variable bindings created by copy clause. */ private final Let[] copies; /** * Constructor. * @param ii input info * @param c copy expressions * @param m modify expression * @param r return expression */ public Transform(final InputInfo ii, final Let[] c, final Expr m, final Expr r) { super(ii, m, r); copies = c; } @Override public void checkUp() throws QueryException { for(final Let c : copies) c.checkUp(); final Expr m = expr[0]; m.checkUp(); if(!m.isVacuous() && !m.has(Flag.UPD)) UPMODIFY.thrw(info); checkNoUp(expr[1]); } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { for(final Let c : copies) c.expr = c.expr.compile(ctx, scp); super.compile(ctx, scp); return this; } @Override public ValueIter iter(final QueryContext ctx) throws QueryException { return value(ctx).iter(); } @Override public Value value(final QueryContext ctx) throws QueryException { final int o = (int) ctx.output.size(); if(ctx.updates == null) ctx.updates = new Updates(); final ContextModifier tmp = ctx.updates.mod; final TransformModifier pu = new TransformModifier(); ctx.updates.mod = pu; try { for(final Let fo : copies) { final Iter ir = ctx.iter(fo.expr); Item i = ir.next(); if(!(i instanceof ANode) || ir.next() != null) UPCOPYMULT.thrw(fo.info, fo.var.name); // copy node to main memory data instance i = ((ANode) i).dbCopy(ctx.context.prop); // add resulting node to variable ctx.set(fo.var, i, info); pu.addData(i.data()); } ctx.value(expr[0]); ctx.updates.apply(); return ctx.value(expr[1]); } finally { ctx.output.size(o); ctx.updates.mod = tmp; } } @Override public boolean has(final Flag flag) { return flag != Flag.UPD && super.has(flag); } @Override public boolean removable(final Var v) { for(final Let c : copies) if(!c.removable(v)) return false; return super.removable(v); } @Override public VarUsage count(final Var v) { return VarUsage.sum(v, copies).plus(super.count(v)); } @Override public Expr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { final boolean cp = inlineAll(ctx, scp, copies, v, e); return inlineAll(ctx, scp, expr, v, e) || cp ? optimize(ctx, scp) : null; } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return new Transform(info, copyAll(ctx, scp, vs, copies), expr[0].copy(ctx, scp, vs), expr[1].copy(ctx, scp, vs)); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(), copies, expr); } @Override public String toString() { final StringBuilder sb = new StringBuilder(COPY + ' '); for(final Let t : copies) sb.append(t.var + " " + ASSIGN + ' ' + t.expr + ' '); return sb.append(MODIFY + ' ' + expr[0] + ' ' + RETURN + ' ' + expr[1]).toString(); } @Override public boolean accept(final ASTVisitor visitor) { return visitAll(visitor, copies) && super.accept(visitor); } @Override public int exprSize() { int sz = 1; for(final Let lt : copies) sz += lt.exprSize(); for(final Expr e : expr) sz += e.exprSize(); return sz; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/expr/Update.java000066400000000000000000000030661222453003200260400ustar00rootroot00000000000000package org.basex.query.up.expr; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Abstract update expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ abstract class Update extends Arr { /** * Constructor. * @param ii input info * @param e expressions */ Update(final InputInfo ii, final Expr... e) { super(ii, e); type = SeqType.EMP; } @Override public boolean has(final Flag flag) { return flag == Flag.UPD || super.has(flag); } /** * Checks if the new namespaces have conflicting namespaces. * @param list node list * @param targ target node * @param ctx query context * @throws QueryException query exception * @return specified node list */ final ANodeList checkNS(final ANodeList list, final ANode targ, final QueryContext ctx) throws QueryException { for(final ANode n : list) { final QNm name = n.qname(); final byte[] pref = name.prefix(); // attributes without prefix have no namespace if(pref.length == 0) continue; // check if attribute and target have the same namespace final byte[] uri = targ.uri(pref, ctx); if(uri != null && !eq(name.uri(), uri)) UPNSCONFL.thrw(info); } return list; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/000077500000000000000000000000001222453003200251635ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/BasicOperation.java000066400000000000000000000042001222453003200307240ustar00rootroot00000000000000package org.basex.query.up.primitives; import org.basex.data.*; import org.basex.query.*; import org.basex.query.value.node.*; import org.basex.util.*; /** * Basic task that operates on the database but is not an update primitive. This task * is carried out after all updates on the database have been made effective in the order * of the {@link TYPE}. Hence changes made during a snapshot will be reflected by this * task. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public abstract class BasicOperation extends Operation implements Comparable { /** Basic Operation types. Carried out in the given order. */ public static enum TYPE { /** DBAdd. */ DBADD, /** DBStore. */ DBSTORE, /** DBRename. */ DBRENAME, /** DBDelete. */ DBDELETE, /** DBOptimize. */ DBOPTIMIZE, /** DBFlush. */ DBFLUSH, /** FnPut. */ FNPUT, /** DBDrop. */ DBDROP, /** DBCreate. */ DBCREATE, } /** Type of this operation. */ public final TYPE type; /** * Constructor. * @param t type of this operation * @param d target data reference * @param ii input info */ public BasicOperation(final TYPE t, final Data d, final InputInfo ii) { super(d, ii); type = t; } @Override public final int compareTo(final BasicOperation o) { return type.ordinal() - o.type.ordinal(); } @Override public DBNode getTargetNode() { return new DBNode(data, -1); } @Override public final InputInfo getInfo() { return info; } @Override public final Data getData() { return data; } /** * Merges this operation with the given one. * @param o operation to merge into this one * @throws QueryException exception */ public abstract void merge(final BasicOperation o) throws QueryException; /** * Applies this operation. * @throws QueryException exception */ public abstract void apply() throws QueryException; /** * Prepares this operation. * @param tmp temporary mem data * @throws QueryException exception */ public abstract void prepare(final MemData tmp) throws QueryException; } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/DBAdd.java000066400000000000000000000024341222453003200267270ustar00rootroot00000000000000package org.basex.query.up.primitives; import java.util.*; import org.basex.data.*; import org.basex.data.atomic.*; import org.basex.query.*; import org.basex.util.*; /** * Add primitive. * * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ public final class DBAdd extends DBNew { /** Size. */ private int size; /** * Constructor. * @param d target database * @param it document to add (IO or ANode instance) * @param c database context * @param ii input info */ public DBAdd(final Data d, final NewInput it, final QueryContext c, final InputInfo ii) { super(TYPE.DBADD, d, c, ii); inputs = new ArrayList(); inputs.add(it); } @Override public void merge(final BasicOperation o) { final DBAdd a = (DBAdd) o; final Iterator d = a.inputs.iterator(); while(d.hasNext()) inputs.add(d.next()); } @Override public void apply() { data.insert(data.meta.size, -1, new DataClip(md)); } @Override public void prepare(final MemData tmp) throws QueryException { size = inputs.size(); addDocs(new MemData(tmp), data.meta.name); } @Override public int size() { return size; } @Override public String toString() { return Util.name(this) + '[' + inputs + ']'; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/DBCreate.java000066400000000000000000000050461222453003200274440ustar00rootroot00000000000000package org.basex.query.up.primitives; import static org.basex.query.util.Err.*; import java.io.*; import java.util.List; import org.basex.build.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.data.atomic.*; import org.basex.query.*; import org.basex.query.func.*; import org.basex.query.value.node.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Update primitive for the {@link Function#_DB_CREATE} function. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class DBCreate extends DBNew { /** Name of new database. */ public final String name; /** * Constructor. * @param ii input info * @param nm name for created database * @param in input (ANode and QueryInput references) * @param map index options * @param c query context * @throws QueryException query exception */ public DBCreate(final InputInfo ii, final String nm, final List in, final TokenMap map, final QueryContext c) throws QueryException { super(TYPE.DBCREATE, null, c, ii); inputs = in; name = nm; options = map; check(true); } @Override public DBNode getTargetNode() { return null; } @Override public void merge(final BasicOperation o) throws QueryException { BXDB_CREATE.thrw(info, ((DBCreate) o).name); } @Override public void prepare(final MemData tmp) throws QueryException { if(inputs != null && !inputs.isEmpty()) addDocs(new MemData(qc.context.prop), name); } @Override public void apply() throws QueryException { // remove data instance from list of opened resources qc.resource.removeData(name); // check if addressed database is still pinned by any other process if(qc.context.pinned(name)) BXDB_OPENED.thrw(info, name); initOptions(); assignOptions(); try { data = CreateDB.create(name, Parser.emptyParser(qc.context.prop), qc.context); } catch(final IOException ex) { UPDBOPTERR.thrw(info, ex); } finally { resetOptions(); } qc.resource.addData(data); // add initial documents if(md != null) { if(!data.startUpdate()) BXDB_OPENED.thrw(null, data.meta.name); data.insert(data.meta.size, -1, new DataClip(md)); try { Optimize.optimize(data, false, null); } catch(final IOException ex) { data.finishUpdate(); UPDBOPTERR.thrw(info, ex); } } } @Override public int size() { return 1; } @Override public String toString() { return Util.name(this) + '[' + inputs + ']'; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/DBDelete.java000066400000000000000000000022531222453003200274400ustar00rootroot00000000000000package org.basex.query.up.primitives; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.query.*; import org.basex.query.func.*; import org.basex.util.*; import org.basex.util.list.*; /** * Update primitive for the {@link Function#_DB_DELETE} function. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DBDelete extends BasicOperation { /** Keys. */ private final StringList paths = new StringList(1); /** Number of keys. */ private int size; /** * Constructor. * @param d data * @param p entries to be deleted * @param ii input info */ public DBDelete(final Data d, final String p, final InputInfo ii) { super(TYPE.DBDELETE, d, ii); paths.add(p); size = d.resources.binaries(p).size(); } @Override public void merge(final BasicOperation o) { for(final String path : ((DBDelete) o).paths) paths.add(path); size += o.size(); } @Override public void apply() { for(final String path : paths) Delete.delete(data, path); } @Override public int size() { return size; } @Override public void prepare(final MemData tmp) throws QueryException { } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/DBDrop.java000066400000000000000000000027561222453003200271520ustar00rootroot00000000000000package org.basex.query.up.primitives; import static org.basex.query.util.Err.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.query.*; import org.basex.query.func.*; import org.basex.util.*; /** * Update primitive for the {@link Function#_DB_DROP} function. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class DBDrop extends BasicOperation { /** Query Context. */ private final QueryContext ctx; /** * Constructor. * @param d target data reference * @param ii input info * @param c query context */ public DBDrop(final Data d, final InputInfo ii, final QueryContext c) { super(TYPE.DBDROP, d, ii); ctx = c; } @Override public void merge(final BasicOperation o) throws QueryException { } @Override public void prepare(final MemData tmp) throws QueryException { } @Override public void apply() throws QueryException { // trigger early removal of database locks data.finishUpdate(); // close data instance in query processor final String name = data.meta.name; ctx.resource.removeData(name); // invalidate data instance to avoid repeated removal of locks data = null; // check if database is stilled pinned by another process if(ctx.context.pinned(name)) BXDB_OPENED.thrw(info, name); // check if database files can be safely removed if(!DropDB.drop(name, ctx.context)) UPDBDROP.thrw(info, name); } @Override public int size() { return 1; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/DBFlush.java000066400000000000000000000016641222453003200273240ustar00rootroot00000000000000package org.basex.query.up.primitives; import org.basex.core.*; import org.basex.data.*; import org.basex.query.*; import org.basex.query.func.*; import org.basex.util.*; /** * Update primitive for the {@link Function#_DB_FLUSH} function. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DBFlush extends BasicOperation { /** * Constructor. * @param d data * @param ii input info */ public DBFlush(final Data d, final InputInfo ii) { super(TYPE.DBFLUSH, d, ii); } @Override public void merge(final BasicOperation o) { } @Override public void apply() { final Prop prop = data.meta.prop; if(prop.is(Prop.AUTOFLUSH)) return; prop.set(Prop.AUTOFLUSH, true); data.finishUpdate(); prop.set(Prop.AUTOFLUSH, false); } @Override public int size() { return 1; } @Override public void prepare(final MemData tmp) throws QueryException { } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/DBNew.java000066400000000000000000000133671222453003200267770ustar00rootroot00000000000000package org.basex.query.up.primitives; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.io.*; import java.util.*; import org.basex.build.*; import org.basex.core.*; import org.basex.data.*; import org.basex.data.atomic.*; import org.basex.io.*; import org.basex.query.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Update primitive for adding documents to databases. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class DBNew extends BasicOperation { /** Numeric index options. */ protected static final Object[][] N_OPT = { Prop.MAXCATS, Prop.MAXLEN, Prop.INDEXSPLITSIZE, Prop.FTINDEXSPLITSIZE }; /** Boolean index options. */ protected static final Object[][] B_OPT = { Prop.TEXTINDEX, Prop.ATTRINDEX, Prop.FTINDEX, Prop.STEMMING, Prop.CASESENS, Prop.DIACRITICS, Prop.UPDINDEX }; /** String index options. */ protected static final Object[][] S_OPT = { Prop.LANGUAGE, Prop.STOPWORDS }; /** Keys of numeric index options. */ protected static final byte[][] K_N_OPT = new byte[N_OPT.length][]; /** Keys of boolean index options. */ protected static final byte[][] K_B_OPT = new byte[B_OPT.length][]; /** Keys of numeric index options. */ protected static final byte[][] K_S_OPT = new byte[S_OPT.length][]; static { // initialize options arrays final int n = N_OPT.length, b = B_OPT.length, s = S_OPT.length; for(int o = 0; o < n; o++) K_N_OPT[o] = lc(token(N_OPT[o][0].toString())); for(int o = 0; o < b; o++) K_B_OPT[o] = lc(token(B_OPT[o][0].toString())); for(int o = 0; o < s; o++) K_S_OPT[o] = lc(token(S_OPT[o][0].toString())); } /** Query context. */ protected final QueryContext qc; /** Inputs to add. */ protected List inputs; /** Optimization options. */ protected TokenMap options; /** Insertion sequence. */ protected Data md; /** Original options. */ protected final HashMap oprops = new HashMap(); /** New options. */ protected final HashMap nprops = new HashMap(); /** * Constructor. * @param t type of update * @param d target database * @param c query context * @param ii input info */ public DBNew(final TYPE t, final Data d, final QueryContext c, final InputInfo ii) { super(t, d, ii); qc = c; } /** * Inserts all documents to be added to a temporary database. * @param dt target database * @param name name of database * @throws QueryException query exception */ protected final void addDocs(final MemData dt, final String name) throws QueryException { md = dt; final long ds = inputs.size(); for(int i = 0; i < ds; i++) { md.insert(md.meta.size, -1, data(inputs.get(i), name)); // clear list to recover memory inputs.set(i, null); } inputs = null; } /** * Creates a {@link DataClip} instance for the specified document. * @param ni new database input * @param dbname name of database * @return database clip * @throws QueryException query exception */ private DataClip data(final NewInput ni, final String dbname) throws QueryException { // add document node final Context ctx = qc.context; if(ni.node != null) { final MemData mdata = (MemData) ni.node.dbCopy(ctx.prop).data; mdata.update(0, Data.DOC, ni.path); return new DataClip(mdata); } // add input final IOFile dbpath = ctx.mprop.dbpath(string(ni.dbname)); final Parser p = new DirParser(ni.io, ctx.prop, dbpath).target(string(ni.path)); final MemBuilder b = new MemBuilder(dbname, p); try { return new DataClip(b.build()); } catch(final IOException ex) { throw IOERR.thrw(info, ex); } } /** * Checks the validity of the assigned database options. * @param create create or optimize database * @throws QueryException query exception */ protected final void check(final boolean create) throws QueryException { for(final byte[] key : options) { if(!eq(key, K_N_OPT) && !eq(key, K_B_OPT) && !eq(key, K_S_OPT) || !create && eq(key, K_B_OPT[K_B_OPT.length - 1])) BASX_OPTIONS.thrw(info, key); final String v = string(options.get(key)); if(eq(key, K_N_OPT)) { if(toInt(v) < 0) BASX_VALUE.thrw(info, key, v); } else if(eq(key, K_B_OPT)) { if(eqic(v, Text.YES, Text.TRUE, Text.ON)) options.put(key, Token.TRUE); else if(eqic(v, Text.NO, Text.FALSE, Text.OFF)) options.put(key, Token.FALSE); else BASX_VALUE.thrw(info, key, v); } } } /** * Assigns indexing options. */ protected void initOptions() { for(int o = 0; o < K_N_OPT.length; o++) if(options.contains(K_N_OPT[o])) nprops.put(N_OPT[o], toInt(options.get(K_N_OPT[o]))); for(int o = 0; o < K_B_OPT.length; o++) if(options.contains(K_B_OPT[o])) nprops.put(B_OPT[o], eq(options.get(K_B_OPT[o]), TRUE)); for(int o = 0; o < K_S_OPT.length; o++) if(options.contains(K_S_OPT[o])) nprops.put(S_OPT[o], string(options.get(K_S_OPT[o]))); } /** * Caches original options and assigns cached options. */ protected void assignOptions() { final Prop prop = qc.context.prop; for(final Object[] key : nprops.keySet()) { oprops.put(key, prop.get(key[0].toString())); } setProps(nprops); } /** * Restores original options. */ protected void resetOptions() { setProps(oprops); } /** * Assigns the specified options. * @param props property map */ private void setProps(final HashMap props) { final Prop prop = qc.context.prop; for(final Map.Entry e : props.entrySet()) { prop.setObject(e.getKey()[0].toString(), e.getValue()); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/DBOptimize.java000066400000000000000000000042411222453003200300350ustar00rootroot00000000000000package org.basex.query.up.primitives; import static org.basex.query.util.Err.*; import java.io.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.query.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Update primitive for the optimize function. * * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ public final class DBOptimize extends DBNew { /** Flag to optimize all database structures. */ private boolean all; /** * Constructor. * @param dt data * @param ctx database context * @param al optimize all database structures flag * @param map index options * @param ii input info * @throws QueryException query exception */ public DBOptimize(final Data dt, final QueryContext ctx, final boolean al, final TokenMap map, final InputInfo ii) throws QueryException { super(TYPE.DBOPTIMIZE, dt, ctx, ii); all = al; options = map; check(false); } @Override public void merge(final BasicOperation o) { all |= ((DBOptimize) o).all; } @Override public void prepare(final MemData tmp) throws QueryException { } @Override public void apply() throws QueryException { final MetaData meta = data.meta; final Prop prop = meta.prop; nprops.put(Prop.TEXTINDEX, meta.createtext); nprops.put(Prop.ATTRINDEX, meta.createattr); nprops.put(Prop.FTINDEX, meta.createftxt); initOptions(); assignOptions(); final boolean rebuild = prop.num(Prop.MAXCATS) != meta.maxcats || prop.num(Prop.MAXLEN) != meta.maxlen; meta.maxcats = prop.num(Prop.MAXCATS); meta.maxlen = prop.num(Prop.MAXLEN); meta.createtext = prop.is(Prop.TEXTINDEX); meta.createattr = prop.is(Prop.ATTRINDEX); meta.createftxt = prop.is(Prop.FTINDEX); try { if(all) OptimizeAll.optimizeAll(data, qc.context, null); else Optimize.optimize(data, rebuild, null); } catch(final IOException ex) { UPDBOPTERR.thrw(info, ex); } finally { resetOptions(); } // remove old database reference if(all) qc.resource.removeData(data.meta.name); } @Override public int size() { return 1; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/DBRename.java000066400000000000000000000030141222453003200274410ustar00rootroot00000000000000package org.basex.query.up.primitives; import static org.basex.query.util.Err.*; import java.util.*; import java.util.Map.Entry; import org.basex.data.*; import org.basex.io.*; import org.basex.query.*; import org.basex.query.func.*; import org.basex.util.*; /** * Update primitive for the {@link Function#_DB_RENAME} function. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DBRename extends BasicOperation { /** Source and target paths. */ private final HashMap map = new HashMap(); /** * Constructor. * @param d target data * @param src source path * @param trg target path * @param ii input info */ public DBRename(final Data d, final String src, final String trg, final InputInfo ii) { super(TYPE.DBRENAME, d, ii); map.put(src, trg); } @Override public void merge(final BasicOperation o) throws QueryException { for(final Entry e : ((DBRename) o).map.entrySet()) { final String src = e.getKey(); if(map.containsKey(src)) UPPATHREN.thrw(info, src); map.put(src, e.getValue()); } } @Override public void apply() { for(final Entry op : map.entrySet()) { final IOFile src = new IOFile(op.getKey()); final IOFile trg = new IOFile(op.getValue()); if(src.exists()) src.rename(trg); } } @Override public int size() { return map.size(); } @Override public void prepare(final MemData tmp) throws QueryException { } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/DBStore.java000066400000000000000000000033511222453003200273320ustar00rootroot00000000000000package org.basex.query.up.primitives; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.io.*; import org.basex.data.*; import org.basex.io.*; import org.basex.query.*; import org.basex.query.func.*; import org.basex.query.value.item.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Update primitive for the {@link Function#_DB_STORE} function. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DBStore extends BasicOperation { /** Keys. */ private final TokenObjMap map = new TokenObjMap(); /** * Constructor. * @param d data * @param path target path * @param it item to be stored * @param ii input info */ public DBStore(final Data d, final String path, final Object it, final InputInfo ii) { super(TYPE.DBSTORE, d, ii); map.put(token(path), it); } @Override public void merge(final BasicOperation o) { final DBStore put = (DBStore) o; for(final byte[] path : put.map) { map.put(path, put.map.get(path)); } } @Override public void apply() throws QueryException { for(final byte[] path : map) { try { final IOFile file = data.meta.binary(string(path)); if(file == null) UPDBPUTERR.thrw(info, path); file.dir().md(); final Object item = map.get(path); file.write(item instanceof Item ? ((Item) item).input(info) : ((QueryInput) item).input.inputStream()); } catch(final IOException ex) { Util.debug(ex); UPDBPUTERR.thrw(info, path); } } } @Override public int size() { return map.size(); } @Override public void prepare(final MemData tmp) throws QueryException { } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/DeleteNode.java000066400000000000000000000034361222453003200300440ustar00rootroot00000000000000package org.basex.query.up.primitives; import org.basex.data.*; import org.basex.data.atomic.*; import org.basex.query.up.*; import org.basex.query.value.node.*; import org.basex.util.*; /** * Delete primitive. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class DeleteNode extends UpdatePrimitive { /** States if the deletion of the target node T is part of a replaceElementContent * call on the parent of T, see {@link ReplaceValue}. */ public final boolean rec; /** * Constructor. * @param p target node PRE value * @param d target data reference * @param i input info */ public DeleteNode(final int p, final Data d, final InputInfo i) { this(p, d, i, false); } /** * Constructor for a delete primitive that is a product of a replaceElementContent * substitution. * @param p target node PRE value * @param d target data reference * @param i input info * @param r this delete is a product of a replaceElementContent substitution */ public DeleteNode(final int p, final Data d, final InputInfo i, final boolean r) { super(PrimitiveType.DELETENODE, p, d, i); rec = r; } @Override public void merge(final UpdatePrimitive p) { /* Multiple delete primitives can operate on the same * target node, see XQUF. */ } @Override public void update(final NamePool pool) { pool.remove(new DBNode(data, targetPre)); } @Override public String toString() { return Util.name(this) + '[' + getTargetNode() + ']'; } @Override public int size() { return 1; } @Override public UpdatePrimitive[] substitute(final MemData tmp) { return new UpdatePrimitive[] { this }; } @Override public void addAtomics(final AtomicUpdateList l) { l.addDelete(targetPre); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/InsertAfter.java000066400000000000000000000024351222453003200302600ustar00rootroot00000000000000package org.basex.query.up.primitives; import org.basex.data.*; import org.basex.data.atomic.*; import org.basex.query.*; import org.basex.query.up.*; import org.basex.query.util.*; import org.basex.query.value.node.*; import org.basex.util.*; /** * Insert after primitive. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class InsertAfter extends NodeCopy { /** * Constructor. * @param p target pre value * @param d target data instance * @param i input info * @param c node copy insertion sequence */ public InsertAfter(final int p, final Data d, final InputInfo i, final ANodeList c) { super(PrimitiveType.INSERTAFTER, p, d, i, c); } @Override public void merge(final UpdatePrimitive p) throws QueryException { final ANodeList newInsert = ((InsertAfter) p).insert; for(final ANode n : newInsert) insert.add(n); } @Override public void addAtomics(final AtomicUpdateList l) { final int k = data.kind(targetPre); final int s = data.size(targetPre, k); l.addInsert(targetPre + s, data.parent(targetPre, k), insseq, false); } @Override public UpdatePrimitive[] substitute(final MemData tmp) { return new UpdatePrimitive[] { this }; } @Override public void update(final NamePool pool) { } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/InsertAttribute.java000066400000000000000000000023161222453003200311600ustar00rootroot00000000000000package org.basex.query.up.primitives; import org.basex.data.*; import org.basex.data.atomic.*; import org.basex.query.*; import org.basex.query.up.*; import org.basex.query.util.*; import org.basex.query.value.node.*; import org.basex.util.*; /** * Insert attribute primitive. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class InsertAttribute extends NodeCopy { /** * Constructor. * @param p pre * @param d data * @param i input info * @param c node copy */ public InsertAttribute(final int p, final Data d, final InputInfo i, final ANodeList c) { super(PrimitiveType.INSERTATTR, p, d, i, c); } @Override public void update(final NamePool pool) { if(insseq == null) return; add(pool); } @Override public void merge(final UpdatePrimitive p) throws QueryException { final ANodeList newInsert = ((InsertAttribute) p).insert; for(final ANode n : newInsert) insert.add(n); } @Override public void addAtomics(final AtomicUpdateList l) { l.addInsert(targetPre + 1, targetPre, insseq, true); } @Override public UpdatePrimitive[] substitute(final MemData tmp) { return new UpdatePrimitive[] { this }; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/InsertBefore.java000066400000000000000000000023241222453003200304160ustar00rootroot00000000000000package org.basex.query.up.primitives; import org.basex.data.*; import org.basex.data.atomic.*; import org.basex.query.*; import org.basex.query.up.*; import org.basex.query.util.*; import org.basex.query.value.node.*; import org.basex.util.*; /** * Insert before primitive. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class InsertBefore extends NodeCopy { /** * Constructor. * @param p pre * @param d data * @param i input info * @param c node copy */ public InsertBefore(final int p, final Data d, final InputInfo i, final ANodeList c) { super(PrimitiveType.INSERTBEFORE, p, d, i, c); } @Override public void merge(final UpdatePrimitive p) throws QueryException { final InsertBefore newOne = (InsertBefore) p; final ANodeList newInsert = newOne.insert; for(final ANode n : newInsert) insert.add(n); } @Override public void addAtomics(final AtomicUpdateList l) { l.addInsert(targetPre, data.parent(targetPre, data.kind(targetPre)), insseq, false); } @Override public UpdatePrimitive[] substitute(final MemData tmp) { return new UpdatePrimitive[] { this }; } @Override public void update(final NamePool pool) { } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/InsertInto.java000066400000000000000000000023451222453003200301300ustar00rootroot00000000000000package org.basex.query.up.primitives; import org.basex.data.*; import org.basex.data.atomic.*; import org.basex.query.up.*; import org.basex.query.util.*; import org.basex.query.value.node.*; import org.basex.util.*; /** * Insert into primitive. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public class InsertInto extends NodeCopy { /** * Constructor for an insertInto. * @param p target pre value * @param d target data instance * @param i input info * @param n node copy insertion sequence */ public InsertInto(final int p, final Data d, final InputInfo i, final ANodeList n) { super(PrimitiveType.INSERTINTO, p, d, i, n); } @Override public final void merge(final UpdatePrimitive p) { final ANodeList newInsert = ((NodeCopy) p).insert; for(final ANode n : newInsert) insert.add(n); } @Override public final void addAtomics(final AtomicUpdateList l) { final int s = data.size(targetPre, data.kind(targetPre)); l.addInsert(targetPre + s, targetPre, insseq, false); } @Override public final UpdatePrimitive[] substitute(final MemData tmp) { return new UpdatePrimitive[] { this }; } @Override public final void update(final NamePool pool) { } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/InsertIntoAsFirst.java000066400000000000000000000024171222453003200314240ustar00rootroot00000000000000package org.basex.query.up.primitives; import org.basex.data.*; import org.basex.data.atomic.*; import org.basex.query.*; import org.basex.query.up.*; import org.basex.query.util.*; import org.basex.query.value.node.*; import org.basex.util.*; /** * Insert into as first primitive. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class InsertIntoAsFirst extends NodeCopy { /** * Constructor. * @param p target node pre value * @param d target data reference * @param i input info * @param c insertion sequence node list */ public InsertIntoAsFirst(final int p, final Data d, final InputInfo i, final ANodeList c) { super(PrimitiveType.INSERTINTOFIRST, p, d, i, c); } @Override public void merge(final UpdatePrimitive p) throws QueryException { final ANodeList newInsert = ((NodeCopy) p).insert; for(final ANode n : newInsert) insert.add(n); } @Override public void addAtomics(final AtomicUpdateList l) { l.addInsert(targetPre + data.attSize(targetPre, data.kind(targetPre)), targetPre, insseq, false); } @Override public UpdatePrimitive[] substitute(final MemData tmp) { return new UpdatePrimitive[] { this }; } @Override public void update(final NamePool pool) { } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/InsertIntoAsLast.java000066400000000000000000000024411222453003200312350ustar00rootroot00000000000000package org.basex.query.up.primitives; import org.basex.data.*; import org.basex.data.atomic.*; import org.basex.query.up.*; import org.basex.query.util.*; import org.basex.query.value.node.*; import org.basex.util.*; /** * Insert into as last primitive. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public class InsertIntoAsLast extends NodeCopy { /** * Constructor for an insertInto which is part of a replaceElementContent substitution. * @param p target pre value * @param d target data instance * @param i input info * @param n node copy insertion sequence */ public InsertIntoAsLast(final int p, final Data d, final InputInfo i, final ANodeList n) { super(PrimitiveType.INSERTINTOLAST, p, d, i, n); } @Override public void merge(final UpdatePrimitive p) { final ANodeList newInsert = ((NodeCopy) p).insert; for(final ANode n : newInsert) insert.add(n); } @Override public void addAtomics(final AtomicUpdateList l) { final int s = data.size(targetPre, data.kind(targetPre)); l.addInsert(targetPre + s, targetPre, insseq, false); } @Override public UpdatePrimitive[] substitute(final MemData tmp) { return new UpdatePrimitive[] { this }; } @Override public void update(final NamePool pool) { } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/NewInput.java000066400000000000000000000007131222453003200276000ustar00rootroot00000000000000package org.basex.query.up.primitives; import org.basex.io.*; import org.basex.query.value.node.*; /** * Container for inputs that are to be added to a database. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class NewInput { /** Node to be added. */ public ANode node; /** Input reference. */ public IO io; /** Target path. */ public byte[] path; /** Target database. */ public byte[] dbname; } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/NodeCopy.java000066400000000000000000000061361222453003200275540ustar00rootroot00000000000000package org.basex.query.up.primitives; import org.basex.data.*; import org.basex.data.atomic.*; import org.basex.query.up.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Abstract update primitive which holds a copy of nodes to be inserted. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public abstract class NodeCopy extends UpdatePrimitive { /** Nodes to be inserted. */ ANodeList insert; /** Insertion sequence data clip. */ DataClip insseq; /** * Constructor. * @param t type * @param p target node pre value * @param d data * @param i input info * @param n node copy */ NodeCopy(final PrimitiveType t, final int p, final Data d, final InputInfo i, final ANodeList n) { super(t, p, d, i); insert = n; } /** * Prepares this update primitive before execution. This includes e.g. the * preparation of insertion sequences. * @param tmp temporary database */ public final void prepare(final MemData tmp) { // merge texts. after that, text nodes still need to be merged, // as two adjacent iterators may lead to two adjacent text nodes final ANodeList list = mergeNodeCacheText(insert); insert = null; // build main memory representation of nodes to be copied final int start = tmp.meta.size; new DataBuilder(tmp).build(list); insseq = new DataClip(tmp, start, tmp.meta.size); insseq.fragments = list.size(); } /** * Adds top entries from the temporary data instance to the name pool, * which is used for finding duplicate attributes and namespace conflicts. * @param pool name pool */ final void add(final NamePool pool) { final Data d = insseq.data; final int ps = insseq.start; final int pe = insseq.end; for(int p = ps; p < pe; ++p) { final int k = d.kind(p); if(k != Data.ATTR && k != Data.ELEM) continue; if(p > ps && d.parent(p, k) >= ps) break; final int u = d.uri(p, k); final QNm qnm = new QNm(d.name(p, k)); if(u != 0) qnm.uri(d.nspaces.uri(u)); pool.add(qnm, ANode.type(k)); } } /** * Merges all adjacent text nodes in the given sequence. * @param nl iterator * @return iterator with merged text nodes */ private static ANodeList mergeNodeCacheText(final ANodeList nl) { final int ns = nl.size(); if(ns == 0) return nl; final ANodeList s = new ANodeList(ns); ANode n = nl.get(0); for(int c = 0; c < ns;) { if(n.type == NodeType.TXT) { final TokenBuilder tb = new TokenBuilder(); while(n.type == NodeType.TXT) { tb.add(n.string()); if(++c == ns) break; n = nl.get(c); } s.add(new FTxt(tb.finish())); } else { s.add(n); if(++c < ns) n = nl.get(c); } } return s; } @Override public final int size() { return insseq.fragments; } @Override public final String toString() { return Util.name(this) + '[' + getTargetNode() + ", " + size() + " ops]"; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/Operation.java000066400000000000000000000020011222453003200277570ustar00rootroot00000000000000package org.basex.query.up.primitives; import org.basex.data.*; import org.basex.query.value.node.*; import org.basex.util.*; /** * Abstract class for update operations. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public abstract class Operation { /** Input info. */ protected final InputInfo info; /** Target data reference. */ public Data data; /** * Constructor. * @param d target data reference * @param ii input info */ protected Operation(final Data d, final InputInfo ii) { data = d; info = ii; } /** * Returns the total number of node operations. * @return number of updates */ public abstract int size(); /** * Returns the target data reference. * @return data */ public abstract Data getData(); /** * Input info. * @return input info */ public abstract InputInfo getInfo(); /** * Returns the target node of this operation. * @return target node */ public abstract DBNode getTargetNode(); } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/PrimitiveType.java000066400000000000000000000022631222453003200306430ustar00rootroot00000000000000package org.basex.query.up.primitives; import org.basex.query.up.*; /** * {@link UpdatePrimitive} types. Do not change the order as this affects * {@link UpdatePrimitiveComparator} and will most likely lead to weird results. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public enum PrimitiveType { /* DO NOT CHANGE ORDER OF PRIMITIVES. * * Primitive types help to create an order on update primitives. * * If more than one update primitive is targeted at a node T: * - INSERTAFTER has to be carried out first, as it accesses * the highest PRE value (T+size(T)). Hence it's ranked highest. * - INSERTBEFORE v.v. (as it accesses the lowest PRE value equal T). */ /** Insert before. */ INSERTBEFORE, /** Delete. */ DELETENODE, /** Replace node. */ REPLACENODE, /** Rename. */ RENAMENODE, /** Replace value. */ REPLACEVALUE, /** Insert attribute. */ INSERTATTR, /** Insert into as first. */ INSERTINTOFIRST, /** Insert into. */ INSERTINTO, /** Insert into as last. */ INSERTINTOLAST, /** Insert after. */ INSERTAFTER, } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/Put.java000066400000000000000000000047721222453003200266100ustar00rootroot00000000000000package org.basex.query.up.primitives; import static org.basex.query.util.Err.*; import static org.basex.core.Text.*; import java.io.*; import org.basex.data.*; import org.basex.io.out.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.value.node.*; import org.basex.util.*; import org.basex.util.list.*; /** * Fn:put operation primitive. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class Put extends BasicOperation { /** Target paths. The same node can be stored in multiple locations. */ private final StringList paths = new StringList(1); /** Node id of the target node. Target nodes are identified via their ID, as structural * changes (delete/insert) during the snapshot lead to PRE value shifts on disk. * In addition, deleted/replaced nodes will not be serialized by fn:put as the * identity of these nodes is gone - which is easier to track operating on IDs. */ public final int nodeid; /** * Constructor. * @param i input info * @param id target node id * @param d target data reference * @param u location path URI */ public Put(final InputInfo i, final int id, final Data d, final String u) { super(BasicOperation.TYPE.FNPUT, d, i); nodeid = id; paths.add(u); } @Override public void apply() throws QueryException { for(final String u : paths) { final int pre = data.pre(nodeid); if(pre == -1) return; final DBNode node = new DBNode(data, pre); try { final PrintOutput po = new PrintOutput(u); try { final SerializerProp pr = new SerializerProp(); // try to reproduce non-chopped documents correctly pr.set(SerializerProp.S_INDENT, node.data.meta.chop ? YES : NO); final Serializer ser = Serializer.get(po, pr); ser.serialize(node); ser.close(); } finally { po.close(); } } catch(final IOException ex) { UPPUTERR.thrw(info, u); } } } @Override public void merge(final BasicOperation o) throws QueryException { for(final String u : ((Put) o).paths) paths.add(u); } @Override public int size() { return paths.size(); } @Override public String toString() { return Util.name(this) + '[' + getTargetNode() + ", " + paths.get(0) + ']'; } @Override public void prepare(final MemData tmp) throws QueryException { } @Override public DBNode getTargetNode() { return new DBNode(data, data.pre(nodeid)); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/RenameNode.java000066400000000000000000000030221222453003200300400ustar00rootroot00000000000000package org.basex.query.up.primitives; import static org.basex.query.util.Err.*; import org.basex.data.*; import org.basex.data.atomic.*; import org.basex.query.*; import org.basex.query.up.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.util.*; /** * Rename node primitive. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class RenameNode extends UpdatePrimitive { /** New name. */ private final QNm name; /** * Constructor. * @param p target node pre value * @param d target data reference * @param i input info * @param nm new QName / new name value */ public RenameNode(final int p, final Data d, final InputInfo i, final QNm nm) { super(PrimitiveType.RENAMENODE, p, d, i); name = nm; } @Override public void merge(final UpdatePrimitive p) throws QueryException { UPMULTREN.thrw(info, getTargetNode()); } @Override public void update(final NamePool pool) { final DBNode node = getTargetNode(); pool.add(name, node.nodeType()); pool.remove(node); } @Override public String toString() { return Util.name(this) + '[' + getTargetNode() + ", " + name + ']'; } @Override public int size() { return 1; } @Override public void addAtomics(final AtomicUpdateList l) { l.addRename(targetPre, data.kind(targetPre), name.string(), name.uri()); } @Override public UpdatePrimitive[] substitute(final MemData tmp) { return new UpdatePrimitive[] { this }; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/ReplaceContent.java000066400000000000000000000011431222453003200307330ustar00rootroot00000000000000package org.basex.query.up.primitives; import org.basex.data.*; import org.basex.query.util.*; import org.basex.util.*; /** * Replace element content primitive, extending insert into primitive. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class ReplaceContent extends InsertInto { /** * Constructor. * @param p target pre value * @param d target data instance * @param i input info * @param n node copy insertion sequence */ public ReplaceContent(final int p, final Data d, final InputInfo i, final ANodeList n) { super(p, d, i, n); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/ReplaceNode.java000066400000000000000000000023021222453003200302040ustar00rootroot00000000000000package org.basex.query.up.primitives; import static org.basex.query.util.Err.*; import org.basex.data.*; import org.basex.data.atomic.*; import org.basex.query.*; import org.basex.query.up.*; import org.basex.query.util.*; import org.basex.util.*; /** * Replace node primitive. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class ReplaceNode extends NodeCopy { /** * Constructor. * @param p target node pre value * @param d target data instance * @param i input info * @param c node copy insertion sequence */ public ReplaceNode(final int p, final Data d, final InputInfo i, final ANodeList c) { super(PrimitiveType.REPLACENODE, p, d, i, c); } @Override public void update(final NamePool pool) { if(insseq == null) return; add(pool); pool.remove(getTargetNode()); } @Override public void merge(final UpdatePrimitive p) throws QueryException { UPMULTREPL.thrw(info, getTargetNode()); } @Override public void addAtomics(final AtomicUpdateList l) { l.addReplace(targetPre, insseq); } @Override public UpdatePrimitive[] substitute(final MemData tmp) { return new UpdatePrimitive[] { this }; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/ReplaceValue.java000066400000000000000000000111561222453003200304020ustar00rootroot00000000000000package org.basex.query.up.primitives; import static org.basex.query.util.Err.*; import java.util.*; import org.basex.data.*; import org.basex.data.atomic.*; import org.basex.query.*; import org.basex.query.up.*; import org.basex.query.util.*; import org.basex.query.value.node.*; import org.basex.util.*; /** *

ReplaceValue primitive. Replaces the value of a node.

* *

If the target T is an element node this primitive represents a replaceElementContent * expression (see XQUF). The children of T are deleted and a single (optional) text node * is inserted as the only child of T. The primitive for replaceElementContent is * substituted by .

* *

After the end of the snapshot, T has either no child node at all (if the given text * node has been empty), or the given (non-empty) text node as a single child. Attributes * of T are not affected by a replaceElementContent expression.

* *

If T is a text node and the new text value is empty, T is deleted.

* * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class ReplaceValue extends UpdatePrimitive { /** New value. */ public final byte[] value; /** States if this primitive represents a replaceElementContent expression. */ public final boolean rec; /** * Constructor. * @param p target node PRE value * @param d target data reference * @param i input info * @param v new value */ public ReplaceValue(final int p, final Data d, final InputInfo i, final byte[] v) { super(PrimitiveType.REPLACEVALUE, p, d, i); value = v; rec = d.kind(targetPre) == Data.ELEM; } @Override public void merge(final UpdatePrimitive p) throws QueryException { UPMULTREPV.thrw(info, getTargetNode()); } @Override public int size() { return 1; } @Override public String toString() { return Util.info("%[%, %]", Util.name(this), getTargetNode(), value); } /** * Checks if this primitive leads to an empty text node. * @return true if application of primitive results in empty text node */ private boolean deleteText() { return value.length == 0 && data.kind(targetPre) == Data.TEXT; } /** * Checks if this primitive is substituted. * * If target T is an element node, the primitive is substituted by a sequence of * . * If T is a text node and the new value is empty, the primitive is substituted by * , as empty text nodes are not allowed, see XDM. * * @return true if primitive is substituted */ private boolean substituted() { return rec || deleteText(); } @Override public void addAtomics(final AtomicUpdateList l) { if(!substituted()) l.addUpdateValue(targetPre, data.kind(targetPre), value); } @Override public UpdatePrimitive[] substitute(final MemData tmp) { final int k = data.kind(targetPre); // else substitute if target is an element if(rec) { final List l = new LinkedList(); // add the primitive to catch forbidden primitive merges (same target node) l.add(this); // add the delete primitives for the child nodes of the target // ... child axis boundaries final int firstChild = targetPre + data.attSize(targetPre, k); final int followingNode = targetPre + data.size(targetPre, k); int runner = firstChild; // while runner is child of target while(runner < followingNode) { l.add(new DeleteNode(runner, data, info, true)); // set runner to following node runner += data.size(runner, data.kind(runner)); } // add the insert for the optional text node, this is done by using an // insertIntoAsFirst primitive on the same target if(value.length > 0) { // create Data instance for insertion sequence // copy all nodes into a single database instance final int pre = tmp.meta.size; tmp.text(pre, 1, value, Data.TEXT); tmp.insert(pre); // add the substituting insertInto statement to the list final ANodeList nl = new ANodeList(new DBNode(tmp, pre)); l.add(new ReplaceContent(targetPre, data, info, nl)); } return l.toArray(new UpdatePrimitive[l.size()]); } // or a text node has to be deleted if(deleteText()) { // don't forget to add this primitive to catch forbidden primitive merges return new UpdatePrimitive[] { this, new DeleteNode(targetPre, data, info, false) }; } // no substitution return new UpdatePrimitive[] { this }; } @Override public void update(final NamePool pool) { } } basex-7.7.2/basex-core/src/main/java/org/basex/query/up/primitives/UpdatePrimitive.java000066400000000000000000000052221222453003200311420ustar00rootroot00000000000000package org.basex.query.up.primitives; import org.basex.data.*; import org.basex.data.atomic.*; import org.basex.query.*; import org.basex.query.up.*; import org.basex.query.value.node.*; import org.basex.util.*; /** * Base class for all update primitives. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public abstract class UpdatePrimitive extends Operation { /** Target node pre value. */ public final int targetPre; /** Primitive Type. */ public final PrimitiveType type; /** * Constructor. * @param t primitive type * @param p target node pre value * @param d target data reference * @param ii input info */ UpdatePrimitive(final PrimitiveType t, final int p, final Data d, final InputInfo ii) { super(d, ii); targetPre = p; type = t; } /** * Creates a {@link DBNode} instance from the target node information. * @return DBNode */ @Override public final DBNode getTargetNode() { return new DBNode(data, targetPre); } @Override public Data getData() { return data; } @Override public InputInfo getInfo() { return info; } /** * Merges two update primitives, as they have the same target node. * @param p primitive to merge with * @throws QueryException exception */ public abstract void merge(final UpdatePrimitive p) throws QueryException; /** * Updates the name pool, which is used to find duplicate attributes * and namespace conflicts. * @param pool name pool */ public abstract void update(final NamePool pool); /** * Adds the atomic update operations for this update primitive to the given list. * @param l list of atomic updates */ public abstract void addAtomics(final AtomicUpdateList l); /** * Substitutes the update primitive if necessary. For instance a 'Replace Value * of' primitive called on a target T with T being an element results in a 'Replace * Element Content' primitive with target T. As this is ugly to process it is * substituted by delete primitives for every child of T and an 'Insert into' primitive * if the length of the (optional!) text node is greater zero. * * When a primitive is substituted it is still added to the list itself to be able to * throw exceptions when necessary. I.e. for multiple replaces on the same target node. * These update primitives don't produce atomic updates, hence this won't affect the * database. * * @param tmp temporary mem data * @return An array that contains the substituting primitives or this update primitive * if no substitution is necessary. */ public abstract UpdatePrimitive[] substitute(final MemData tmp); } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/000077500000000000000000000000001222453003200233215ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/util/ANodeList.java000066400000000000000000000036531222453003200260150ustar00rootroot00000000000000package org.basex.query.util; import java.util.*; import org.basex.query.value.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.list.*; /** * This is a light-weight container for XML nodes. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ANodeList extends ElementList implements Iterable { /** Element container. */ ANode[] list; /** * Constructor. */ public ANodeList() { this(1); } /** * Constructor, specifying an initial array capacity. * @param c array capacity */ public ANodeList(final int c) { list = new ANode[c]; } /** * Constructor, specifying initial nodes. * @param n initial nodes */ public ANodeList(final ANode... n) { list = n; size = n.length; } /** * Adds an element to the array. * @param e element to be added */ public void add(final ANode e) { if(size == list.length) copyOf(newSize()); list[size++] = e; } /** * Sets an element at the specified index position. * @param i index * @param e element to be set */ public void set(final int i, final ANode e) { if(i >= list.length) copyOf(newSize(i + 1)); list[i] = e; size = Math.max(size, i + 1); } /** * Returns the specified element. * @param p position * @return value */ public ANode get(final int p) { return list[p]; } /** * Returns an array with all elements. * @return array */ public Value value() { return Seq.get(list, size, NodeType.NOD); } /** * Resizes the array. * @param s new size */ private void copyOf(final int s) { final ANode[] tmp = new ANode[s]; System.arraycopy(list, 0, tmp, 0, size); list = tmp; } @Override public Iterator iterator() { return new ArrayIterator(list, size); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/ASTVisitor.java000066400000000000000000000041321222453003200261730ustar00rootroot00000000000000package org.basex.query.util; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.func.*; import org.basex.query.value.item.*; import org.basex.query.var.*; /** * A visitor for all sub-expressions in an {@link Expr}. All methods return a * {@code boolean} which signals if the tree walk should be continued. * * @author Leo Woerteler */ @SuppressWarnings("unused") public abstract class ASTVisitor { /** * Notifies the visitor of a variable declaration. * @param count declared variable * @return if more expressions should be visited */ public boolean declared(final Var count) { return true; } /** * Notifies the visitor of a variable reference. * @param ref used variable * @return if more expressions should be visited */ public boolean used(final VarRef ref) { return true; } /** * Notifies the visitor of a reference t oa static variable. * @param var static variable * @return if more expressions should be visited */ public boolean staticVar(final StaticVar var) { return true; } /** * Notifies the visitor of a sub-scope. * @param sub scope * @return if more expressions should be visited */ public boolean inlineFunc(final Scope sub) { return true; } /** * Notifies the visitor of a function call. * @param call function call * @return if more expressions should be visited */ public boolean funcCall(final StaticFuncCall call) { return true; } /** * Notifies the visitor of a function item. * @param func the function item * @return if more expressions should be visited */ public boolean funcItem(final FuncItem func) { return true; } /** * Notifies the visitor of a database lock. * @param db database to be locked * @return if more expressions should be visited */ public boolean lock(final String db) { return true; } /** * Notifies the visitor of an expression entering a focus. */ public void enterFocus() { } /** * Notifies the visitor of an expression leaving a focus. */ public void exitFocus() { } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/Ann.java000066400000000000000000000141461222453003200247060ustar00rootroot00000000000000package org.basex.query.util; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.util.*; import org.basex.util.list.*; /** * Annotations. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Ann extends ElementList { /** Annotation "private". */ public static final QNm Q_PRIVATE = new QNm(QueryText.PRIVATE, XQURI); /** Annotation "public". */ public static final QNm Q_PUBLIC = new QNm(QueryText.PUBLIC, XQURI); /** Annotation "updating". */ public static final QNm Q_UPDATING = new QNm(QueryText.UPDATING, XQURI); /** Supported REST annotations. */ private static final byte[][] ANN_REST = tokens("error", "path", "produces", "consumes", "query-param", "form-param", "header-param", "cookie-param", "error-param", "GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS"); /** Supported UNIT annotations. */ private static final byte[][] ANN_UNIT = tokens("test", "ignore", "before", "after", "before-module", "after-module", "expected"); /** Input Info. */ public InputInfo[] infos = new InputInfo[1]; /** QNames. */ public QNm[] names = new QNm[1]; /** Values. */ public Value[] values = new Value[1]; /** * Adds a QName/value pair. * @param name QName * @param value value * @param info input info */ public void add(final QNm name, final Value value, final InputInfo info) { // create new entry if(size == names.length) { final int s = newSize(); names = Array.copy(names, new QNm[s]); values = Array.copy(values, new Value[s]); infos = Array.copy(infos, new InputInfo[s]); } names[size] = name; values[size] = value; infos[size] = info; size++; } /** * Checks if the specified element is found in the list. * @param e element to be found * @return result of check */ public boolean contains(final QNm e) { for(int i = 0; i < size; ++i) if(names[i].eq(e)) return true; return false; } /** * Checks if the specified key/value pair is found in the list. * @param k name of the entry * @param v value of the entry * @return result of check */ public boolean contains(final QNm k, final Value v) { try { for(int i = 0; i < size; ++i) { if(names[i].eq(k) && Compare.deep(v, values[i], null)) return true; } return false; } catch(final QueryException e) { // should never happen because annotations can only contain simple literals throw Util.notexpected(e); } } /** * Returns the union of these annotations and the given ones. * @param ann other annotations * @return a n {@link Ann} instance containing all annotations */ public Ann union(final Ann ann) { final Ann o = new Ann(); boolean pub = false, priv = false, up = false; for(int i = 0; i < size; i++) { if(names[i].eq(Ann.Q_PUBLIC)) pub = true; else if(names[i].eq(Ann.Q_PRIVATE)) priv = true; else if(names[i].eq(Ann.Q_UPDATING)) up = true; o.add(names[i], values[i], infos[i]); } for(int i = 0; i < ann.size; i++) { final QNm name = ann.names[i]; if(name.eq(Ann.Q_PUBLIC)) { if(pub) continue; if(priv) return null; } else if(name.eq(Ann.Q_PRIVATE)) { if(pub) return null; if(priv) continue; } else if(name.eq(Ann.Q_UPDATING) && up) { continue; } o.add(ann.names[i], ann.values[i], ann.infos[i]); } return o; } /** * Returns the intersection of these annotations and the given ones. * @param ann annotations * @return those annotations that are present in both collections */ public Ann intersect(final Ann ann) { final Ann o = new Ann(); for(int i = 0; i < size; i++) { final QNm name = names[i]; final Value val = values[i]; try { for(int j = 0; j < ann.size; j++) { if(name.eq(ann.names[j]) && Compare.deep(val, ann.values[j], null)) o.add(name, val, infos[i]); } } catch(final QueryException ex) { // should never happen because annotations can only contain simple literals Util.notexpected(ex); } } return o; } /** * Checks all annotations for parsing errors. * @param var variable flag * @throws QueryException query exception */ public void check(final boolean var) throws QueryException { boolean up = false, vis = false; for(int a = 0; a < size(); a++) { final QNm name = names[a]; final byte[] local = name.local(); final byte[] uri = name.uri(); if(name.eq(Q_UPDATING)) { if(up) DUPLUPD.thrw(infos[a]); up = true; } else if(name.eq(Q_PUBLIC) || name.eq(Q_PRIVATE)) { // only one visibility modifier allowed if(vis) (var ? DUPLVARVIS : DUPLVIS).thrw(infos[a]); vis = true; } else if(NSGlobal.reserved(name.uri())) { // no global namespaces allowed ANNRES.thrw(infos[a], '%', name.string()); } else if(eq(uri, OUTPUTURI)) { if(Serializer.PROPS.get(string(local)) == null) BASX_ANNOT.thrw(infos[a], '%', name.string()); if(values[a].size() != 1 || !values[a].itemAt(0).type.isStringOrUntyped()) { BASX_ANNOTARGS.thrw(infos[a], '%', name.string()); } } else if(eq(uri, RESTURI)) { if(!eq(local, ANN_REST)) BASX_ANNOT.thrw(infos[a], '%', name.string()); } else if(eq(uri, UNITURI)) { if(!eq(local, ANN_UNIT)) BASX_ANNOT.thrw(infos[a], '%', name.string()); } } } @Override public String toString() { final TokenBuilder tb = new TokenBuilder(); for(int i = 0; i < size; ++i) { tb.add('%').add(names[i].string()); final long s = values[i].size(); if(s != 0) { tb.add('('); for(int a = 0; a < s; a++) { if(a != 0) tb.add(','); tb.add(values[i].itemAt(a).toString()); } tb.add(')'); } tb.add(' '); } return tb.toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/ClientSessions.java000066400000000000000000000025641222453003200271400ustar00rootroot00000000000000package org.basex.query.util; import java.io.*; import org.basex.core.*; import org.basex.query.value.item.*; import org.basex.server.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Opened database client sessions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ClientSessions { /** Last inserted id. */ private int lastId = -1; /** Map with all open sessions and their ids. */ private final TokenObjMap conns = new TokenObjMap(); /** * Adds a session. * @param cs client session * @return session id */ public Uri add(final ClientSession cs) { final byte[] uri = Token.token(Text.NAMELC + "://" + cs + '/' + ++lastId); conns.put(uri, cs); return Uri.uri(uri); } /** * Returns a session. * @param id session id * @return session */ public ClientSession get(final Uri id) { return conns.get(id.string()); } /** * Removes a session. * @param id session id */ public void remove(final Uri id) { conns.delete(id.string()); } /** * Closes all opened sessions. */ public void close() { for(final byte[] c : conns) { final ClientSession cs = conns.get(c); if(cs == null) continue; try { cs.close(); } catch(final IOException ex) { Util.debug(ex); } } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/Collation.java000066400000000000000000000222431222453003200261130ustar00rootroot00000000000000package org.basex.query.util; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.text.*; import java.util.*; import org.basex.core.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.util.*; import org.basex.util.hash.*; /** * This class organizes collations. * Some of the core functions have been inspired by the Saxon HE source code. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Collation { /** Implementation-defined collation URL. */ private static final byte[] URL = token(Text.URL + "/collation"); /** Available locales, indexed by language code. */ private static final HashMap LOCALES = new HashMap(); /** Strengths. */ private static final byte[][] STRENGTHS = tokens( "primary", "secondary", "tertiary", "identical"); /** Decompositions. */ private static final byte[][] DECOMPOSITIONS = tokens("none", "full", "standard"); /** Language string. */ private static final byte[] LANG = token("lang"); /** Strength string. */ private static final byte[] STRENGTH = token("strength"); /** Decomposition string. */ private static final byte[] DECOMPOSITION = token("decomposition"); static { for(final Locale l : Locale.getAvailableLocales()) LOCALES.put(l.toString().replace('_', '-'), l); } /** Collator. */ private final Collator coll; /** Collation URI. */ private final byte[] uri; /** * Private Constructor. * @param cl collator instance * @param u uri */ private Collation(final Collator cl, final byte[] u) { coll = cl; uri = u; } /** * Returns a collation instance for the specified uri. * @param uri collation uri * @param ctx query context * @param info input info * @param err error code for unknown collation uris * @return collator instance or {@code null} for unicode point collation * @throws QueryException query exception */ public static Collation get(final byte[] uri, final QueryContext ctx, final InputInfo info, final Err err) throws QueryException { // return default collation if(uri == null) return ctx.sc.collation; byte[] args = uri; final Uri u = Uri.uri(args); if(!u.isValid()) INVURI.thrw(info, args); if(!u.isAbsolute() && !Token.startsWith(args, '?')) { args = ctx.sc.baseURI().resolve(u, info).string(); } // return unicode point collation if(eq(URLCOLL, args)) return null; // normalize arguments if(Token.startsWith(args, URL)) args = substring(args, URL.length); if(Token.startsWith(args, '?')) args = substring(args, 1); args = replace(args, '&', ';'); // create new collation or return cached instance final byte[] full = new TokenBuilder(URL).add('?').add(args).finish(); if(ctx.collations == null) ctx.collations = new TokenObjMap(); Collation coll = ctx.collations.get(full); if(coll == null) { final Collator cl = get(args); if(cl == null) err.thrw(info, uri); coll = new Collation(cl, full); ctx.collations.put(full, coll); } return coll; } /** * Returns a collator instance for the specified uri. * @param args arguments * @return collator instance or {@code null} if uri is invalid. */ private static Collator get(final byte[] args) { Locale locale = Locale.getDefault(); int strngth = -1; int dcmpstn = -1; for(final byte[] param : split(args, ';')) { final byte[][] kv = split(param, '='); if(kv.length != 2) return null; final byte[] key = kv[0]; final byte[] val = kv[1]; if(eq(key, LANG)) { locale = LOCALES.get(string(val)); if(locale == null) return null; } else if(eq(key, STRENGTH)) { final int ss = STRENGTHS.length; int s = -1; while(++s < ss && !eq(val, STRENGTHS[s])); if(s == ss) return null; strngth = s; } else if(eq(key, DECOMPOSITION)) { final int ss = DECOMPOSITIONS.length; int s = -1; while(++s < ss && !eq(val, DECOMPOSITIONS[s])); if(s == ss) return null; dcmpstn = s; } else { return null; } } final Collator coll = Collator.getInstance(locale); if(strngth != -1) coll.setStrength(strngth); if(dcmpstn != -1) coll.setDecomposition(dcmpstn); return coll; } /** * Compares two strings. * @param string string * @param compare string to be compared * @return result of check */ public int compare(final byte[] string, final byte[] compare) { return coll.compare(string(string), string(compare)); } /** * Checks if a string is contained in another. * @param string string * @param sub substring to be found * @param info input info * @return result of check * @throws QueryException query exception */ public boolean contains(final byte[] string, final byte[] sub, final InputInfo info) throws QueryException { return indexOf(string(string), string(sub), false, false, info) != -1; } /** * Checks if a string starts with another. * @param string string * @param sub substring to be found * @param info input info * @return result of check * @throws QueryException query exception */ public boolean startsWith(final byte[] string, final byte[] sub, final InputInfo info) throws QueryException { final RuleBasedCollator rbc = rbc(info); return startsWith(rbc.getCollationElementIterator(string(string)), rbc.getCollationElementIterator(string(sub))); } /** * Checks if a string ends with another. * @param string string * @param sub substring to be found * @param info input info * @return result of check * @throws QueryException query exception */ public boolean endsWith(final byte[] string, final byte[] sub, final InputInfo info) throws QueryException { return indexOf(string(string), string(sub), false, true, info) != -1; } /** * Returns the substring after a specified string. * @param string string * @param sub substring to be found * @param info input info * @return substring * @throws QueryException query exception */ public byte[] after(final byte[] string, final byte[] sub, final InputInfo info) throws QueryException { final String st = string(string); final int i = indexOf(st, string(sub), false, false, info); return i == -1 ? EMPTY : token(st.substring(i)); } /** * Returns the substring before a specified string. * @param string string * @param sub substring to be found * @param info input info * @return substring * @throws QueryException query exception */ public byte[] before(final byte[] string, final byte[] sub, final InputInfo info) throws QueryException { final String st = string(string); final int i = indexOf(st, string(sub), true, false, info); return i == -1 ? EMPTY : token(st.substring(0, i)); } /** * Returns the collation URI. * @return uri */ public byte[] uri() { return uri; } /** * Returns the start or end position of the specified substring. * @param string string * @param sub substring to be found * @param start return start or end position * @param ends checks if string ends with substring * @param info input info * @return result of check * @throws QueryException query exception */ private int indexOf(final String string, final String sub, final boolean start, final boolean ends, final InputInfo info) throws QueryException { final RuleBasedCollator rbc = rbc(info); final CollationElementIterator i = rbc.getCollationElementIterator(string); final CollationElementIterator is = rbc.getCollationElementIterator(sub); do { final int cs = next(is); if(cs == -1) return 0; do { final int c = next(i); if(c == -1) return -1; if(c == cs) break; } while(true); final int s = i.getOffset(); if(startsWith(i, is) && (!ends || next(i) == -1)) return start ? s - 1 : i.getOffset(); i.setOffset(s); is.reset(); } while(true); } /** * Determine whether one string starts with another. * @param i string iterator * @param is substring iterator * @return result of check */ private static boolean startsWith(final CollationElementIterator i, final CollationElementIterator is) { do { final int cs = next(is); if(cs == -1) return true; if(cs != next(i)) return false; } while(true); } /** * Returns the next element from an iterator. * @param i iterator * @return next element, or {@code -1} */ private static int next(final CollationElementIterator i) { do { final int c = i.next(); if(c != 0) return c; } while(true); } /** * Converts the collator to a rule-based collator, or raises an error. * @param info input info * @return rule-based collator * @throws QueryException query exception */ private RuleBasedCollator rbc(final InputInfo info) throws QueryException { if(coll instanceof RuleBasedCollator) return (RuleBasedCollator) coll; throw CHARCOLL.thrw(info); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/CollationItemSet.java000066400000000000000000000017241222453003200274070ustar00rootroot00000000000000package org.basex.query.util; import java.util.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * This set indexes items under the terms of a collation. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class CollationItemSet implements ItemSet { /** Items. */ private final ValueBuilder items = new ValueBuilder(); /** Collation. */ private final Collation coll; /** * Constructor. * @param cl collation */ public CollationItemSet(final Collation cl) { coll = cl; } @Override public boolean add(final Item item, final InputInfo ii) throws QueryException { final int is = (int) items.size(); for(int id = 0; id < is; id++) { if(items.get(id).equiv(item, coll, ii)) return false; } items.add(item); return true; } @Override public Iterator iterator() { return items.iterator(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/Compare.java000066400000000000000000000145271222453003200255630ustar00rootroot00000000000000package org.basex.query.util; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.util.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.map.Map; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Utility class for comparing XQuery values. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Compare { /** Flags. */ public enum Mode { /** Compare all node types. */ ALLNODES, /** Compare namespaces. */ NAMESPACES, } /** Input info. */ private final InputInfo info; /** Flag values. */ private final EnumSet flags = EnumSet.noneOf(Mode.class); /** Collation. */ private Collation coll; /** * Constructor. * @param ii input info */ public Compare(final InputInfo ii) { info = ii; } /** * Sets the specified flag. * @param f flag * @return self reference */ public Compare flag(final Mode f) { flags.add(f); return this; } /** * Sets a collation. * @param c collation * @return self reference */ public Compare collation(final Collation c) { coll = c; return this; } /** * Checks items for deep equality. * @param val1 first value * @param val2 second value * @param info input info * @return result of check * @throws QueryException query exception */ public static boolean deep(final Value val1, final Value val2, final InputInfo info) throws QueryException { return deep(val1.iter(), val2.iter(), info); } /** * Checks items for deep equality. * @param iter1 first iterator * @param iter2 second iterator * @param info input info * @return result of check * @throws QueryException query exception */ public static boolean deep(final Iter iter1, final Iter iter2, final InputInfo info) throws QueryException { return new Compare(info).deep(iter1, iter2); } /** * Checks values for deep equality. * @param iter1 first iterator * @param iter2 second iterator * @return result of check * @throws QueryException query exception */ public boolean deep(final Iter iter1, final Iter iter2) throws QueryException { while(true) { // check if one or both iterators are exhausted final Item it1 = iter1.next(), it2 = iter2.next(); if(it1 == null || it2 == null) return it1 == null && it2 == null; // check functions if(it1 instanceof FItem || it2 instanceof FItem) { // maps are functions but have a defined deep-equality if(it1 instanceof Map && it2 instanceof Map) { if(!((Map) it1).deep(info, (Map) it2)) return false; continue; } FICMP.thrw(info, it1 instanceof FItem ? it1 : it2); } // identical items are also equal if(it1 == it2) continue; // check atomic values if(!(it1 instanceof ANode || it2 instanceof ANode)) { if(!it1.equiv(it2, coll, info)) return false; continue; } // node types must be equal Type t1 = it1.type, t2 = it2.type; if(t1 != t2) return false; ANode s1 = (ANode) it1, s2 = (ANode) it2; if(s1.is(s2)) continue; AxisIter ch1 = s1.children(), ch2 = s2.children(); final Stack stack = new Stack(); stack.push(ch1); stack.push(ch2); boolean skip = false; do { t1 = s1 != null ? s1.type : null; t2 = s2 != null ? s2.type : null; // skip comparison of descendant comments and processing instructions if(skip) { if(t1 == NodeType.COM || t1 == NodeType.PI) { s1 = ch1.next(); continue; } if(t2 == NodeType.COM || t2 == NodeType.PI) { s2 = ch2.next(); continue; } } if(s1 == null || s2 == null) { if(s1 != s2) return false; ch2 = stack.pop(); ch1 = stack.pop(); } else { // ensure that nodes have same type if(t1 != t2) return false; // compare names QNm n1 = s1.qname(), n2 = s2.qname(); if(n1 != null && (!n1.eq(n2) || flags.contains(Mode.NAMESPACES) && !eq(n1.prefix(), n2.prefix()))) return false; if(t1 == NodeType.TXT || t1 == NodeType.ATT || t1 == NodeType.COM || t1 == NodeType.PI || t1 == NodeType.NSP) { // compare string values if(!eq(s1.string(), s2.string())) return false; } else if(t1 == NodeType.ELM) { // compare attributes if(s1.attributes().value().size() != s2.attributes().value().size()) return false; // compare names, values and prefixes final AxisIter ai1 = s1.attributes(); LOOP: for(ANode a1; (a1 = ai1.next()) != null;) { n1 = a1.qname(); final AxisIter ai2 = s2.attributes(); for(ANode a2; (a2 = ai2.next()) != null;) { n2 = a2.qname(); if(!n1.eq(n2)) continue; if(flags.contains(Mode.NAMESPACES) && !eq(n1.prefix(), n2.prefix()) || !eq(a1.string(), a2.string())) return false; continue LOOP; } return false; } // compare namespaces if(flags.contains(Mode.NAMESPACES)) { final Atts ns1 = s1.namespaces(); final Atts ns2 = s2.namespaces(); if(ns1.size() != ns2.size()) return false; LOOP: for(int i1 = 0; i1 < ns1.size(); i1++) { for(int i2 = 0; i2 < ns2.size(); i2++) { if(!eq(ns1.name(i1), ns2.name(i2))) continue; if(!eq(ns1.value(i1), ns2.value(i2))) return false; continue LOOP; } return false; } } // check children stack.push(ch1); stack.push(ch2); ch1 = s1.children(); ch2 = s2.children(); } } // check next child s1 = ch1.next(); s2 = ch2.next(); skip = !flags.contains(Mode.ALLNODES); } while(!stack.isEmpty()); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/DataBuilder.java000066400000000000000000000223541222453003200263520ustar00rootroot00000000000000package org.basex.query.util; import static org.basex.util.Token.*; import org.basex.core.*; import org.basex.data.*; import org.basex.query.iter.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.list.*; /** * Class for building memory-based database nodes. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DataBuilder { /** Target data instance. */ private final MemData data; /** Full-text position data. */ private DataFTBuilder ftbuilder; /** Index reference of marker tag. */ private int marker; /** * Constructor. * @param md target data */ public DataBuilder(final MemData md) { data = md; } /** * Attaches full-text position data. * @param tag name of marker tag * @param pos full-text position data * @param len length of extract * @return self reference */ public DataBuilder ftpos(final byte[] tag, final FTPosData pos, final int len) { ftbuilder = new DataFTBuilder(pos, len); marker = data.tagindex.index(tag, null, false); return this; } /** * Fills the data instance with the specified node. * @param node node */ public void build(final ANode node) { build(new ANodeList(node)); } /** * Fills the data instance with the specified nodes. * @param nodes node list */ public void build(final ANodeList nodes) { int ds = data.meta.size; for(final ANode n : nodes) ds = addNode(n, ds, -1, null); } /** * Adds a fragment to a database instance. * Document nodes are ignored. * @param node node to be added * @param pre node position * @param par node parent * @param pNode parent of node to be added * @return pre value of next node */ private int addNode(final ANode node, final int pre, final int par, final ANode pNode) { switch(node.nodeType()) { case DOC: return addDoc(node, pre); case ELM: return addElem(node, pre, par); case TXT: return addText(node, pre, par, pNode); case ATT: return addAttr(node, pre, par); case COM: return addComm(node, pre, par); // will always be processing instruction default: return addPI(node, pre, par); } } /** * Adds a document node. * @param node node to be added * @param pre pre reference * @return pre value of next node */ private int addDoc(final ANode node, final int pre) { final int ds = data.meta.size; final int s = size(node, false); data.doc(ds, s, node.baseURI()); data.insert(ds); int p = pre + 1; final AxisIter ai = node.children(); for(ANode ch; (ch = ai.next()) != null;) p = addNode(ch, p, pre, null); if(s != p - pre) data.size(ds, Data.DOC, p - pre); return p; } /** * Adds an attribute. * @param node node to be added * @param pre pre reference * @param par parent reference * @return number of added nodes */ private int addAttr(final ANode node, final int pre, final int par) { final int ds = data.meta.size; final QNm q = node.qname(); final byte[] uri = q.uri(); int u = 0; if(uri.length != 0) { if(par == -1) data.nspaces.add(ds, pre - par, q.prefix(), uri, data); u = data.nspaces.uri(uri); } final int n = data.atnindex.index(q.string(), null, false); // usually, attributes don't have a namespace flag. // this is different here, because as a stand-alone attribute has no parent element. data.attr(ds, pre - par, n, node.string(), u, u != 0); data.insert(ds); return pre + 1; } /** * Adds a text node. * @param node node to be added * @param pre pre reference * @param par parent reference * @param pNode parent node * @return pre value of next node */ private int addText(final ANode node, final int pre, final int par, final ANode pNode) { // check full-text mode final int dist = pre - par; final TokenList tl = ftbuilder != null ? ftbuilder.build(node) : null; if(tl == null) return pre + addText(node.string(), dist); // adopt namespace from parent int u = 0; ANode p = pNode; while(p != null) { final QNm n = p.qname(); if(n != null && !n.hasPrefix()) break; p = p.parent(); } if(p != null) u = data.nspaces.uri(p.name(), true); final int ts = tl.size(); for(int t = 0; t < ts; t++) { byte[] text = tl.get(t); final boolean elem = text == null; if(elem) { // open element data.elem(dist + t, marker, 1, 2, u, false); data.insert(data.meta.size); text = tl.get(++t); } addText(text, elem ? 1 : dist + t); } return pre + ts; } /** * Adds a text. * @param text text node * @param dist distance * @return number of added nodes */ private int addText(final byte[] text, final int dist) { final int ds = data.meta.size; data.text(ds, dist, text, Data.TEXT); data.insert(ds); return 1; } /** * Adds a processing instruction. * @param node node to be added * @param pre pre reference * @param par parent reference * @return number of added nodes */ private int addPI(final ANode node, final int pre, final int par) { final int ds = data.meta.size; final byte[] v = trim(concat(node.name(), SPACE, node.string())); data.text(ds, pre - par, v, Data.PI); data.insert(ds); return pre + 1; } /** * Adds a comment. * @param node node to be added * @param pre pre reference * @param par parent reference * @return number of added nodes */ private int addComm(final ANode node, final int pre, final int par) { final int ds = data.meta.size; data.text(ds, pre - par, node.string(), Data.COMM); data.insert(ds); return pre + 1; } /** * Adds an element node. * @param node node to be added * @param pre pre reference * @param par parent reference * @return pre value of next node */ private int addElem(final ANode node, final int pre, final int par) { final int ds = data.meta.size; // add new namespaces data.nspaces.prepare(); final Atts ns = node.nsScope(); final int nl = ns.size(); for(int n = 0; n < nl; n++) data.nspaces.add(ns.name(n), ns.value(n), ds); // analyze node name final QNm name = node.qname(); final int tn = data.tagindex.index(name.string(), null, false); final int s = size(node, false); final int u = data.nspaces.uri(name.uri()); // add element node data.elem(pre - par, tn, size(node, true), s, u, nl != 0); data.insert(ds); // add attributes and children int p = pre + 1; AxisIter ai = node.attributes(); for(ANode ch; (ch = ai.next()) != null;) p = addAttr(ch, p, pre); ai = node.children(); for(ANode ch; (ch = ai.next()) != null;) p = addNode(ch, p, pre, node); data.nspaces.close(ds); // update size if additional nodes have been added by the descendants if(s != p - pre) data.size(ds, Data.ELEM, p - pre); return p; } /** * Determines the number of descendants of a fragment. * @param node fragment node * @param att count attributes instead of elements * @return number of descendants + 1 or attribute size + 1 */ private static int size(final ANode node, final boolean att) { if(node instanceof DBNode) { final DBNode dbn = (DBNode) node; final int k = node.kind(); return att ? dbn.data.attSize(dbn.pre, k) : dbn.data.size(dbn.pre, k); } int s = 1; AxisIter ai = node.attributes(); while(ai.next() != null) ++s; if(!att) { ai = node.children(); for(ANode i; (i = ai.next()) != null;) s += size(i, att); } return s; } /** * Returns a new node without the specified namespace. * @param node node to be copied * @param ns namespace to be stripped * @param ctx database context * @return new node */ public static ANode stripNS(final ANode node, final byte[] ns, final Context ctx) { if(node.type != NodeType.ELM) return node; final MemData md = new MemData(ctx.prop); final DataBuilder db = new DataBuilder(md); db.build(node); // flag indicating if namespace should be completely removed boolean del = true; // loop through all nodes for(int pre = 0; pre < md.meta.size; pre++) { // only check elements and attributes final int kind = md.kind(pre); if(kind != Data.ELEM && kind != Data.ATTR) continue; // check if namespace is referenced final byte[] uri = md.nspaces.uri(md.uri(pre, kind)); if(uri == null || !eq(uri, ns)) continue; final byte[] name = md.name(pre, kind); if(prefix(name).length == 0) { // no prefix: remove namespace from element if(kind == Data.ELEM) { md.update(pre, kind, name, EMPTY); md.nsFlag(pre, false); } } else { // prefix: retain namespace del = false; } } if(del) md.nspaces.delete(ns); return new DBNode(md); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/DataFTBuilder.java000066400000000000000000000072001222453003200265750ustar00rootroot00000000000000package org.basex.query.util; import static org.basex.util.Token.*; import org.basex.core.*; import org.basex.data.*; import org.basex.query.value.node.*; import org.basex.util.*; import org.basex.util.ft.*; import org.basex.util.list.*; /** * Class for constructing decorated full-text nodes. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class DataFTBuilder { /** Dots. */ private static final byte[] DOTS = token(Text.DOTS); /** Full-text position data. */ private final FTPosData ftpos; /** Length of full-text extract. */ private final int ftlen; /** * Constructor. * @param pos full-text position data * @param len length of extract */ public DataFTBuilder(final FTPosData pos, final int len) { ftpos = pos; ftlen = len; } /** * Builds full-text information. * @param nd node to be added * @return number of added nodes */ TokenList build(final ANode nd) { // check full-text mode if(!(nd instanceof DBNode)) return null; // check if full-text data exists for the current node final DBNode node = (DBNode) nd; return build(node.data, node.pre, nd.string()); } /** * Builds full-text information. * @param d data reference * @param p pre value * @param str string value * @return number of added nodes */ TokenList build(final Data d, final int p, final byte[] str) { final FTPos ftp = ftpos.get(d, p); if(ftp == null) return null; boolean marked = false; final TokenList tl = new TokenList(); final TokenBuilder tb = new TokenBuilder(); final FTLexer lex = new FTLexer().sc().init(str); int len = -ftlen; while(lex.hasNext()) { final FTSpan span = lex.next(); // check if current text is still to be marked or already marked if(ftp.contains(span.pos) || marked) { if(!tb.isEmpty()) { // write current text node tl.add(tb.finish()); len += tb.size(); tb.reset(); // skip construction if(len >= 0 && tl.size() > 1 && !marked) break; } if(!marked) tl.add((byte[]) null); marked ^= true; } // add span tb.add(span.text); } // write last text node if(!tb.isEmpty()) { tl.add(tb.finish()); len += tb.size(); } // chop first and last text if(len > 0) { final int ts = tl.size(); // get first text (empty if it is a full-text match) final byte[] first = tl.get(0) != null ? tl.get(0) : EMPTY; // get last text (empty if it is a full-text match) final byte[] last = tl.get(ts - 2) != null ? tl.get(ts - 1) : EMPTY; if(first != EMPTY) { // remove leading characters of first text final double l = first.length + last.length; final int ll = Math.min(first.length, (int) (first.length / l * len)); tl.set(0, concat(DOTS, subtoken(first, ll))); len -= ll; } if(last != EMPTY && len > 0) { // remove trailing characters of last text final int ll = Math.min(last.length, len); tl.set(ts - 1, concat(subtoken(last, 0, last.length - ll), DOTS)); len -= ll; } // still too much text: shorten inner texts for(int t = ts - 2; t > 0 && len > 0; t--) { final byte[] txt = tl.get(t); // skip elements, marked texts and too short text snippets if(txt == null || tl.get(t - 1) == null) continue; final int ll = Math.min(txt.length, len); tl.set(t, concat(subtoken(txt, 0, (txt.length - ll) / 2), DOTS, subtoken(txt, (txt.length + ll) / 2))); len -= ll; } } return tl; } }basex-7.7.2/basex-core/src/main/java/org/basex/query/util/Err.java000066400000000000000000001364531222453003200247300ustar00rootroot00000000000000 package org.basex.query.util; import static org.basex.query.util.Err.ErrType.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; /** * This class contains all query error messages. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public enum Err { // General errors /** BASX0000. */ BASX_GENERIC(BASX, 0, "%"), /** BASX0001. */ BASX_PERM(BASX, 1, "% permission required."), /** BASX0002. */ BASX_OPTIONS(BASX, 2, "Unknown database option '%'."), /** BASX0002. */ BASX_VALUE(BASX, 2, "Database option '%' has invalid value '%'."), /** BASX0003. */ BASX_RESTXQ(BASX, 3, "%"), /** BASX0004. */ BASX_DBTRANSFORM(BASX, 4, "No database updates allowed within transform expression."), /** BASX0005. */ BASX_STACKOVERFLOW(BASX, 5, "Stack Overflow: Try tail recursion?"), /** BASX0006. */ BASX_ANNOT(BASX, 6, "Annotation %% is invalid or not supported."), /** BASX0006. */ BASX_ANNOTARGS(BASX, 6, "Annotation %% has invalid arguments."), // Client module /** BXCL0001. */ BXCL_CONN(BXCL, 1, "Connection failed: %"), /** BXCL0002. */ BXCL_NOTAVL(BXCL, 2, "Session is not available or has already been closed: %"), /** BXCL0003. */ BXCL_COMM(BXCL, 3, "An error occurred: %"), /** BXCL0004. */ BXCL_COMMAND(BXCL, 4, "Command could not be executed: %"), /** BXCL0005. */ BXCL_QUERY(BXCL, 5, "Query could not be executed: %"), /** BXCL0006. */ BXCL_ITEM(BXCL, 6, "Value to be bound is no single item: %"), // Conversion module /** BXCO0001. */ BXCO_STRING(BXCO, 1, "String conversion: %."), /** BXCO0001. */ BXCO_BASE64(BXCO, 1, "String cannot be converted to the supplied encoding."), /** BXCO0002. */ BXCO_ENCODING(BXCO, 2, "Encoding '%' is not supported."), // CSV module /** BXCS0001. */ BXCS_PARSE(BXCS, 1, "CSV parser: %."), /** BXCS0002. */ BXCS_SERIAL(BXCS, 2, "CSV serializer: %."), /** BXCS0003. */ BXCS_CONFIG(BXCS, 3, "CSV configuration: separator must be single character."), // Database module /** BXDB0001. */ BXDB_NODB(BXDB, 1, "%: database node expected."), /** BXDB0002. */ BXDB_OPEN(BXDB, 2, "%"), /** BXDB0003. */ BXDB_MEM(BXDB, 3, "Operation requires database '%' to be persistent."), /** BXDB0004. */ BXDB_INDEX(BXDB, 4, "Database '%' has no % index."), /** BXDB0005. */ BXDB_DBRETURN(BXDB, 5, "Query must yield database nodes."), /** BXDB0006. */ BXDB_NODOC(BXDB, 6, "Database path '%' yields no documents."), /** BXDB0006. */ BXDB_SINGLE(BXDB, 6, "Database path '%' points to more than one document."), /** BXDB0007. */ BXDB_OPENED(BXDB, 7, "Database '%' cannot be updated, as it is opened by another process."), /** BXDB0008. */ BXDB_RENAME(BXDB, 8, "%: Invalid target path."), /** BXDB0009. */ BXDB_RANGE(BXDB, 9, "%: value '%' is out of range."), /** BXDB0010. */ BXDB_EVENT(BXDB, 10, "Event '%' is unknown."), /** BXDB0011. */ BXDB_NAME(BXDB, 11, "Invalid database name: '%'."), /** BXDB0012. */ BXDB_CREATE(BXDB, 12, "Database '%' can only be created once."), /** BXDB0013. */ BXDB_CREATEARGS(BXDB, 13, "Number of specified inputs and paths differs: % vs. %."), /** BXDB0014. */ BXDB_DIR(BXDB, 14, "Database path '%' points to a directory."), // Fetch module /** BXFE0001. */ BXFE_IO(BXFE, 1, "%"), /** BXFE0002. */ BXFE_ENCODING(BXFE, 2, "Encoding not supported: '%'."), // Fulltext module /** BXFT0001. */ BXFT_MATCH(BXFT, 1, "Either wildcards or fuzzy search supported."), // HTML module /** BXHL0001. */ BXHL_IO(BXHL, 1, "%"), // JSON module /** BXJS0001. */ BXJS_PARSE(BXJS, 1, "JSON parser (%:%): %."), /** BXJS0001. */ BXJS_PARSEML(BXJS, 1, "JsonML parser: %."), /** BXJS0002. */ BXJS_SERIAL(BXJS, 2, "JSON serializer: %."), /** BXJS0003. */ BXJS_CONFIG(BXJS, 3, "JSON parser configuration: %."), // Process module /** BXPR9999. */ BXPR_ENC(BXPR, 9999, "Encoding not supported: '%'."), // Repository module /** BXRE0001. */ BXRE_WHICH(BXRE, 1, "Package '%' does not exist."), /** BXRE0002. */ BXRE_URI(BXRE, 2, "Namespace URI is invalid: '%'."), /** BXRE0003. */ BXRE_NOTINST(BXRE, 3, "Required package '%' is not installed."), /** BXRE0004. */ BXRE_DESC(BXRE, 4, "Package descriptor: %."), /** BXRE0005. */ BXRE_INST(BXRE, 5, "Module % is already installed within another package."), /** BXRE0006. */ BXRE_PARSE(BXRE, 6, "Package '%' could not be parsed: %."), /** BXRE0007. */ BXRE_DELETE(BXRE, 7, "File '%' could not be deleted."), /** BXRE0008. */ BXRE_DEP(BXRE, 8, "Package '%' depends on package '%'."), /** BXRE0009. */ BXRE_VERSION(BXRE, 9, "Package version is not supported."), /** BXRE0010. */ BXRE_JARDESC(BXRE, 10, "JAR descriptor: %."), /** BXRE0011. */ BXRE_JARFAIL(BXRE, 11, "Reading JAR descriptor failed: %."), // XSLT module /** BXSL0001. */ BXSL_ERROR(BXSL, 1, "%"), // SQL module /** BXSQ0001. */ BXSQ_ERROR(BXSQ, 1, "An SQL exception occurred: '%'"), /** BXSQ0002. */ BXSQ_CONN(BXSQ, 2, "No opened connection with id %"), /** BXSQ0002. */ BXSQ_STATE(BXSQ, 2, "No prepared statement with id %"), /** BXSQ0003. */ BXSQ_PARAMS(BXSQ, 3, "Number of parameters differs from number of placeholders"), /** BXSQ0004. */ BXSQ_TYPE(BXSQ, 4, "No parameter type supplied."), /** BXSQ0005. */ BXSQ_ATTR(BXSQ, 5, "Not expected attribute: %"), /** BXSQ0006. */ BXSQ_FORMAT(BXSQ, 6, "Illegal % format"), /** BXSQ0007. */ BXSQ_DRIVER(BXSQ, 7, "Could not initialize supplied driver: '%'"), // Validation module /** BXVA0001. */ BXVA_FAIL(BXVA, 1, "Validation failed. %"), /** BXVA0002. */ BXVA_START(BXVA, 2, "Validation could not be started. %"), // XQuery module /** BXXQ0001. */ BXXQ_UPDATING(BXXQ, 1, "No updating expression allowed."), // Unit module /** UNIT0001. */ UNIT_ASSERT(UNIT, 1, "Assertion failed."), /** UNIT0001. */ UNIT_MESSAGE(UNIT, 1, "%"), /** UNIT0002. */ UNIT_ARGS(UNIT, 2, "Test function '%' must have no arguments."), /** UNIT0003. */ UNIT_UPDATE(UNIT, 3, "Function '%' is updating."), /** UNIT0004. */ UNIT_TWICE(UNIT, 4, "Annotation %:% was declare twice."), /** UNIT0005. */ UNIT_ANN(UNIT, 5, "Annotation '%%' has invalid arguments."), // EXPath modules /** ARCH0001. */ ARCH_DIFF(ARCH, 1, "Number of supplied entries and contents differs: % vs. %."), /** ARCH0002. */ ARCH_UNKNOWN(ARCH, 2, "Packing format not supported."), /** ARCH0002. */ ARCH_SUPP(ARCH, 2, "% not supported: '%'."), /** ARCH0003. */ ARCH_EMPTY(ARCH, 3, "Name of ZIP entry must not be empty."), /** ARCH0003. */ ARCH_LEVEL(ARCH, 3, "Invalid compression level: '%'."), /** ARCH0003. */ ARCH_DATETIME(ARCH, 3, "xs:dateTime value is invalid : '%'."), /** ARCH0004. */ ARCH_ENCODING(ARCH, 4, "Encoding is not supported: '%'."), /** ARCH0004. */ ARCH_ENCODE(ARCH, 4, "String conversion: %."), /** ARCH0005. */ ARCH_MODIFY(ARCH, 5, "Entries of % archive cannot be modified."), /** ARCH0006. */ ARCH_ONE(ARCH, 6, "% archives are limited to a single entry."), /** ARCH9999. */ ARCH_FAIL(ARCH, 9999, "Operation failed: %."), /** CX0001. */ CX_CANINV(CX, 1, "Canonicalization algorithm is not supported."), /** CX0002. */ CX_DIGINV(CX, 2, "Digest algorithm is not supported."), /** CX0003. */ CX_SIGINV(CX, 3, "Signature algorithm is not supported."), /** CX0004. */ CX_XPINV(CX, 4, "XPath expression is invalid."), /** CX0005. */ CX_INVNM(CX, 5, "Invalid name for $digital-certificate root."), /** CX0007. */ CX_KSNULL(CX, 7, "Key store is null: %"), /** CX0012. */ CX_NOKEY(CX, 12, "Cannot find key for alias in given keystore."), /** CX0013. */ CX_INVHASH(CX, 13, "Hashing algorithm is not supported."), /** CX0014. */ CX_ENC(CX, 14, "The encoding method is not supported."), /** CX0015. */ CX_NOSIG(CX, 15, "Cannot find signature element."), /** CX0016. */ CX_NOPAD(CX, 16, "No such padding."), /** CX0017. */ CX_BADPAD(CX, 17, "Incorrect padding."), /** CX0018. */ CX_ENCTYP(CX, 18, "Encryption type is not supported."), /** CX0019. */ CX_KEYINV(CX, 19, "Secret key is invalid."), /** CX0020. */ CX_ILLBLO(CX, 20, "Illegal block size."), /** CX0021. */ CX_INVALGO(CX, 21, "Algorithm is not supported."), /** CX0023. */ CX_ALINV(CX, 23, "Invalid certificate alias %."), /** CX0024. */ CX_ALGEXC(CX, 24, "Invalid algorithm."), /** CX0025. */ CX_IOEXC(CX, 25, "IO Exception."), /** CX0026. */ CX_KSEXC(CX, 26, "Keystore exception."), /** CX0027. */ CX_SIGEXC(CX, 27, "Signature exception."), /** CX0028. */ CX_SIGTYPINV(CX, 28, "Signature type is not supported."), /** FILE0001. */ FILE_WHICH(FILE, 1, "Path '%' does not exist."), /** FILE0002. */ FILE_EXISTS(FILE, 2, "File '%' already exists."), /** FILE0003. */ FILE_NODIR(FILE, 3, "Path '%' is no directory."), /** FILE0004. */ FILE_DIR(FILE, 4, "Path '%' is a directory."), /** FILE0004. */ FILE_NEDIR(FILE, 4, "Path '%' is a non-empty directory."), /** FILE0005. */ FILE_ENCODING(FILE, 5, "Encoding '%' is not supported."), /** FILE9999. */ FILE_IO(FILE, 9999, "%"), /** FILE9999. */ FILE_CREATE(FILE, 9999, "Directory '%' cannot be created."), /** FILE9999. */ FILE_DEL(FILE, 9999, "Path '%' cannot be deleted."), /** FILE9999. */ FILE_MOVE(FILE, 9999, "Moving '%' to '%' failed."), /** FILE9999. */ FILE_LIST(FILE, 9999, "Files of '%' cannot be accessed."), /** FILE9999. */ FILE_PATH(FILE, 9999, "Invalid file path: '%'."), /** HASH0001. */ HASH_ALG(HASH, 1, "Algorithm not supported: '%'."), /** HC0001. */ HC_ERROR(HC, 1, "%"), /** HC0002. */ HC_PARSE(HC, 2, "Conversion failed: %"), /** HC0003. */ HC_ATTR(HC, 3, "No attribute beside 'src' and 'media-type' allowed."), /** HC0004. */ HC_REQ(HC, 4, "Invalid request element: %."), /** HC0005. */ HC_URL(HC, 5, "No URL supplied."), /** HC0006. */ HC_PARAMS(HC, 6, "Specify request element or HTTP URI."), /** ZIP0001. */ ZIP_NOTFOUND(ZIP, 1, "Path '%' is not found."), /** ZIP0002. */ ZIP_INVALID(ZIP, 2, "% element: attribute '%' expected."), /** ZIP0002. */ ZIP_UNKNOWN(ZIP, 2, "ZIP definition: unknown element %."), /** ZIP0003. */ ZIP_FAIL(ZIP, 3, "Operation failed: %."), // W3 Functions /** FOAR0001. */ DIVZERO(FOAR, 1, "% cannot be divided by zero."), /** FOAR0002. */ DIVFLOW(FOAR, 2, "Invalid division result: % / %."), /** FOAR0002. */ RANGE(FOAR, 2, "Value out of range: %."), /** FOCA0002. */ INVALUE(FOCA, 2, "Invalid value for %: %."), /** FOCA0003. */ INTRANGE(FOCA, 3, "Integer value out of range: %."), /** FOCA0005. */ DATECALC(FOCA, 5, "Invalid % calculation: %."), /** FOCH0001. */ INVCODE(FOCH, 1, "Invalid XML character '&#x%;'."), /** FOCH0002. */ WHICHCOLL(FOCH, 2, "Unknown collation '%'."), /** FOCH0003. */ NORMUNI(FOCH, 3, "Unsupported normalization form (%)."), /** FOCH0004. */ CHARCOLL(FOCH, 4, "Collation does not support function."), /** FODC0001. */ IDDOC(FODC, 1, "Root must be a document node."), /** FODC0002. */ NODEERR(FODC, 2, "% could not be created (%)."), /** FODC0002. */ NODEFCOLL(FODC, 2, "No default collection available."), /** FODC0002. */ IOERR(FODC, 2, "%"), /** FODC0002. */ WHICHRES(FODC, 2, "Resource '%' does not exist."), /** FODC0004. */ INVCOLL(FODC, 4, "Invalid collection URI '%'."), /** FODC0005. */ INVDOC(FODC, 5, "Invalid document URI '%'."), /** FODC0006. */ SAXERR(FODC, 6, "SAX: %"), /** FODC0007. */ RESINV(FODC, 7, "Resource path '%' is invalid."), /** FODC0007. */ INVDB(FODC, 7, "Invalid database name: '%'."), /** FODF1280. */ FORMNUM(FODF, 1280, "Unknown decimal format: %."), /** FODF1310. */ PICEMPTY(FODF, 1310, "The picture string may not be empty."), /** FODF1310. */ PICNUM(FODF, 1310, "Invalid picture string: '%'."), /** FODF1310. */ OPTAFTER(FODF, 1310, "Optional digit sign follows mandatory digit signs: '%'."), /** FODF1310. */ INVGROUP(FODF, 1310, "Invalid position of grouping separator signs: '%'."), /** FODF1310. */ DIFFMAND(FODF, 1310, "Mandatory digits must be of the same group: '%'."), /** FODF1310. */ INVORDINAL(FODF, 1310, "Invalid specification of ordinal numbering: '%'."), /** FODF1310. */ INVDDPATTERN(FODF, 1310, "Invalid decimal-digit-pattern: '%'."), /** FODT0001. */ DATERANGE(FODT, 1, "%: '%' out of range."), /** FODT0001. */ DATEADDRANGE(FODT, 1, "%: out of range."), /** FODT0002. */ DURRANGE(FODT, 2, "%: '%' out of range."), /** FODT0002. */ DURADDRANGE(FODT, 2, "%: out of range."), /** FODT0002. */ DATEZERO(FODT, 2, "Invalid % calculation: infinity/zero."), /** FODT0003. */ INVALZONE(FODT, 3, "Timezone out of range (-14:00 to +14:00): %."), /** FODT0003. */ ZONESEC(FODT, 3, "No seconds allowed in timezone: %."), /** FOER0000. */ FUNERR1(FOER, 0, "Halted on error()."), /** FOFD1340. */ INVCOMPSPEC(FOFD, 1340, "Invalid variable marker: '[%]'."), /** FOFD1340. */ PICDATE(FOFD, 1340, "Invalid picture string: '%'."), /** FOFD1340. */ CALQNAME(FOFD, 1340, "Invalid EQName: '%'."), /** FOFD1340. */ CALWHICH(FOFD, 1340, "Unknown calendar: '%'."), /** FOFD1350. */ PICINVCOMP(FOFD, 1350, "Component '[%]' not applicable to % values."), /** FONS0004. */ NSDECL(FONS, 4, "No namespace declared for prefix '%'."), /** FORG0001. */ INVALIDZONE(FORG, 1, "Invalid timezone: %."), /** FORG0001. */ FUNCAST(FORG, 1, "Invalid % cast: %."), /** FORG0001. */ FUNCCASTEX(FORG, 1, "Invalid cast from % to %: %."), /** FORG0001. */ DATEFORMAT(FORG, 1, "Wrong % format: '%' (try e.g. '%')."), /** FORG0002. */ URIINVRES(FORG, 2, "URI argument is invalid: %."), /** FORG0002. */ URIABS(FORG, 2, "Base URI % is not absolute."), /** FORG0003. */ EXPECTZ0(FORG, 3, "Zero or one value expected."), /** FORG0004. */ EXPECTOM(FORG, 4, "One or more values expected."), /** FORG0005. */ EXPECTO(FORG, 5, "Exactly one value expected."), /** FORG0006. */ FUNCMP(FORG, 6, "%: % expected, % found."), /** FORG0006. */ CONDTYPE(FORG, 6, "% not allowed as condition type."), /** FORG0006. */ SUMTYPE(FORG, 6, "%: invalid argument type '%'."), /** FORG0006. */ FUNNUM(FORG, 6, "%: number expected, % found."), /** FORG0006. */ FUNDUR(FORG, 6, "%: duration expected, % found."), /** FORG0006. */ TYPECMP(FORG, 6, "% is not comparable."), /** FORG0006. */ JAVACON(FORG, 6, "Unknown constructor: %(%)."), /** FORG0006. */ JAVAMTH(FORG, 6, "Unknown method: %(%)."), /** FORG0006. */ JAVAFUN(FORG, 6, "Invalid call of Java function: %(%)."), /** FORG0006. */ JAVAMOD(FORG, 6, "Invalid arguments: % expected, % found."), /** FORG0006. */ INVBASE(FORG, 6, "Unsupported base: %."), /** FORG0006. */ INVDIG(FORG, 6, "Invalid digit for base %: %."), /** FORG0006. */ JAVAERR(FORG, 6, "Java function call failed: %."), /** FORG0006. */ ERRFORM(FORG, 6, "%: %."), /** FORG0006. */ BINARYTYPE(FORG, 6, "Binary item expected, % found"), /** FORG0006. */ STRNODTYPE(FORG, 6, "%: string or node expected, % found."), /** FORG0006. */ ELMMAPTYPE(FORG, 6, "element(%) or map expected, % found"), /** FORG0006. */ ELMSTRTYPE(FORG, 6, "element(%) or string expected, % found"), /** FORG0006. */ STRBINTYPE(FORG, 6, "String or binary type expected, % found"), /** FORG0006. */ ELMOPTION(FORG, 6, "Unknown option: %."), /** FORG0008. */ FUNZONE(FORG, 8, "% and % have different timezones."), /** FORX0001. */ REGMOD(FORX, 1, "Invalid regular modifier: '%'."), /** FORX0002. */ REGPAT(FORX, 2, "Invalid pattern: %."), /** FORX0003. */ REGROUP(FORX, 3, "Pattern matches empty string."), /** FORX0004. */ FUNREPBS(FORX, 4, "Replacement string: invalid backslash."), /** FORX0004. */ FUNREPDOL(FORX, 4, "Replacement string: invalid dollar sign."), /** FOTY0013. */ FIVALUE(FOTY, 13, "Item has no typed value: %."), /** FOTY0013. */ FIATOM(FOTY, 13, "Function items cannot be atomized: %."), /** FOTY0013. */ FIEQ(FOTY, 13, "Function items have no defined equality: %."), /** FOTY0013. */ FISTR(FOTY, 14, "Function items have no string representation: %."), /** FOTY0013. */ FICMP(FOTY, 15, "Function items cannot be compared: %."), /** FOUP0001. */ UPFOTYPE(FOUP, 1, "Document or element expected, % found."), /** FOUP0001. */ UPDOCTYPE(FOUP, 1, "Document expected, % found."), /** FOUP0002. */ UPFOURI(FOUP, 2, "No valid URI: \"%\"."), /** FOUP0002. */ UPPUTERR(FOUP, 2, "\"%\" could not be written."), /** FOUP0002. */ UPDBDROP(FOUP, 2, "Database \"%\" could not be dropped."), /** FOUP0002. */ UPDBPUTERR(FOUP, 2, "Resource \"%\" could not be written."), /** FOUP0002. */ UPDBDELERR(FOUP, 2, "Resource \"%\" could not be deleted."), /** FOUP0002. */ UPDBRENAMEERR(FOUP, 2, "Resource \"%\" could not be renamed."), /** FOUP0002. */ UPDBOPTERR(FOUP, 2, "%"), /** FOUT1170. */ RESNF(FOUT, 1170, "Resource '%' cannot be retrieved."), /** FOUT1170. */ FRAGID(FOUT, 1170, "URI contains a fragment identifier: %"), /** FOUT1170. */ INVURL(FOUT, 1170, "URI is invalid: %"), /** FOUT1190. */ WHICHENC(FOUT, 1190, "Encoding '%' is not supported."), /** FOUT1190. */ INVCHARS(FOUT, 1190, "%."), /** FOUT1200. */ WHICHCHARS(FOUT, 1200, "Resource contains invalid input: %."), /** FTDY0016. */ FTWEIGHT(FTDY, 16, "Weight value out of range: %."), /** FTDY0017. */ FTMILD(FTDY, 17, "Invalid 'mild not' selection."), /** FTDY0020. */ FTREG(FTDY, 20, "Invalid wildcard syntax: '%'."), /** FTST0007. */ FTIGNORE(FTST, 7, "Ignore option not supported."), /** FTST0008. */ NOSTOPFILE(FTST, 8, "Stop word file not found: '%'."), /** FTST0009. */ FTNOSTEM(FTST, 9, "No stemmer available for language '%'."), /** FTST0009. */ FTNOTOK(FTST, 9, "No tokenizer available for language '%'."), /** FTST0018. */ NOTHES(FTST, 18, "Thesaurus not found: '%'."), /** FTST0019. */ FTDUP(FTST, 19, "Match option '%' was declared twice."), /** SENR0001. */ SERATTR(SENR, 1, "Attributes cannot be serialized:%."), /** SENR0001. */ SERNS(SENR, 1, "Namespaces cannot be serialized:%."), /** SENR0001. */ SERFUNC(SENR, 1, "Functions cannot be serialized: %."), /** SEPM0004. */ SERSA(SEPM, 4, "If 'standalone' is specified, the root must be a single element."), /** SEPM0004. */ SERDT(SEPM, 4, "If 'doctype-system' is specified, the root must be a single element."), /** SESU0007. */ SERENCODING(SESU, 7, "Encoding not supported: '%'."), /** SEPM0009. */ SERSTAND(SEPM, 9, "Invalid combination of 'omit-xml-declaration'."), /** SEPM0010. */ SERUNDECL(SEPM, 10, "XML 1.0: undeclaring prefixes not allowed."), /** SESU0013. */ SERNOTSUPP(SESU, 13, "%."), /** SERE0014. */ SERILL(SERE, 14, "Illegal HTML character found: #x%;."), /** SERE0015. */ SERPI(SERE, 15, "Processing construction contains '>'."), /** SEPM0016. */ SERMAP(SEPM, 16, "Character map '%' is not defined."), /** SEPM0016. */ SERANY(SEPM, 16, "%."), /** SEPM0017. */ SEROPT(SEPM, 17, "%."), /** SEPM0017. */ SERWHICH(SEPM, 17, "Unknown serialization parameter: '%'."), /** XPDY0002. */ NOCTX(XPDY, 2, "No context item defined to evaluate '%'."), /** XPDY0002. */ VAREMPTY(XPDY, 2, "No value assigned to %."), /** XPDY0050. */ CTXNODE(XPDY, 50, "Root of the context item must be a document node."), /** XPDY0050. */ NOTREAT(XPDY, 50, "%: % cannot be treated as %."), /** XPDY0050. */ NOTREATS(XPDY, 50, "%: % expected, sequence found."), /** XPST0001. */ STBASEURI(XPST, 1, "Static Base URI is undefined."), /** XPST0003. */ QUERYEMPTY(XPST, 3, "Empty query."), /** XPST0003. */ QUERYINV(XPST, 3, "Query contains an illegal character (#%)."), /** XPST0003. */ NOQUOTE(XPST, 3, "Expecting quote%."), /** XPST0003. */ NOVALIDATE(XPST, 3, "Invalid validation expression."), /** XPST0003. */ NUMBERWS(XPST, 3, "Expecting separator after number."), /** XPST0003. */ NUMBERINC(XPST, 3, "Incomplete double value: '%'."), /** XPST0003. */ NUMBERITR(XPST, 3, "Unexpected decimal point."), /** XPST0003. */ QUERYEND(XPST, 3, "Unexpected end of query: '%'."), /** XPST0003. */ MODEXPR(XPST, 3, "No expression allowed in a library module."), /** XPST0003. */ MAINMOD(XPST, 3, "Library modules cannot be evaluated."), /** XPST0003. */ CMPEXPR(XPST, 3, "Comparison is incomplete."), /** XPST0003. */ NOTAG(XPST, 3, "Expecting tag name."), /** XPST0003. */ TAGNAME(XPST, 3, "Expecting tag name, '<%' found."), /** XPST0003. */ NOATTNAME(XPST, 3, "Expecting attribute name."), /** XPST0003. */ NOLOCSTEP(XPST, 3, "Incomplete location step."), /** XPST0003. */ NOEXPR(XPST, 3, "Expecting expression."), /** XPST0003. */ WRONGCHAR(XPST, 3, "Expecting '%'%."), /** XPST0003. */ INVENTITY(XPST, 3, "Invalid entity '%'."), /** XPST0003. */ INCOMPLETE(XPST, 3, "Incomplete expression."), /** XPST0003. */ EVALUNARY(XPST, 3, "Unary operator expects a numeric value."), /** XPST0003. */ PATHMISS(XPST, 3, "Expecting location path%."), /** XPST0003. */ DECLINCOMPLETE(XPST, 3, "Expecting 'function', 'variable', ..."), /** XPST0003. */ FUNCNAME(XPST, 3, "Expecting function name."), /** XPST0003. */ RESERVED(XPST, 3, "'%' is a reserved keyword."), /** XPST0003. */ PREDMISSING(XPST, 3, "Expecting expression before predicate."), /** XPST0003. */ NOVARNAME(XPST, 3, "Expecting variable name."), /** XPST0003. */ NOVARDECL(XPST, 3, "Expecting variable declaration."), /** XPST0003. */ PIWRONG(XPST, 3, "Expecting name of processing-instruction."), /** XPST0003. */ NSWRONG(XPST, 3, "Expecting namespace prefix."), /** XPST0003. */ NOENCLEXPR(XPST, 3, "Expecting valid expression after curly brace."), /** XPST0003. */ NOFTSELECT(XPST, 3, "Expecting quote or opening curly brace%."), /** XPST0003. */ NODOCCONS(XPST, 3, "Expecting expression in document constructor."), /** XPST0003. */ NOTXTCONS(XPST, 3, "Expecting expression in text constructor."), /** XPST0003. */ NOCOMCONS(XPST, 3, "Expecting expression in comment constructor."), /** XPST0003. */ NOFUNBODY(XPST, 3, "Expecting function body."), /** XPST0003. */ FUNCMISS(XPST, 3, "Expecting closing bracket for function '%'."), /** XPST0003. */ MAPTAAT(XPST, 3, "Expecting atomic key type for map, found '%'."), /** XPST0003. */ TYPEINVALID(XPST, 3, "Expecting type declaration."), /** XPST0003. */ NODECLFORM(XPST, 3, "Unknown decimal-format property: '%'."), /** XPST0003. */ NOTYPESWITCH(XPST, 3, "Incomplete typeswitch expression."), /** XPST0003. */ NOSWITCH(XPST, 3, "Incomplete switch expression."), /** XPST0003. */ TYPEPAR(XPST, 3, "Expecting '(' after 'switch' or 'typeswitch'."), /** XPST0003. */ PRAGMAINV(XPST, 3, "Invalid pragma expression."), /** XPST0003. */ CALCEXPR(XPST, 3, "Calculation is incomplete."), /** XPST0003. */ INVMAPKEY(XPST, 3, "Invalid key, simple expression expected."), /** XPST0003. */ INVMAPVAL(XPST, 3, "Invalid value, simple expression expected."), /** XPST0003. */ NORETURN(XPST, 3, "Expecting return value."), /** XPST0003. */ NOWHERE(XPST, 3, "Expecting valid expression after 'where'."), /** XPST0003. */ ORDERBY(XPST, 3, "Expecting valid expression after 'order by'."), /** XPST0003. */ GRPBY(XPST, 3, "Expecting valid expression after 'group by'."), /** XPST0003. */ FLWORRETURN(XPST, 3, "Incomplete FLWOR expression: expecting 'return'."), /** XPST0003. */ NOSOME(XPST, 3, "Incomplete quantifier expression."), /** XPST0003. */ IFPAR(XPST, 3, "Expecting '(' after 'if' expression."), /** XPST0003. */ NOIF(XPST, 3, "Incomplete 'if' expression."), /** XPST0003. */ NOFOR(XPST, 3, "Incomplete 'for' expression."), /** XPST0003. */ NOLET(XPST, 3, "Incomplete 'let' expression."), /** XPST0003. */ NOWINDOW(XPST, 3, "Incomplete 'window' expression."), /** XPST0003. */ NOCOUNT(XPST, 3, "Incomplete 'count' expression."), /** XPST0003. */ NOCLOSING(XPST, 3, "Expecting closing tag ."), /** XPST0003. */ COMCLOSE(XPST, 3, "Unclosed XQuery comment (: ..."), /** XPST0003. */ EXPREMPTY(XPST, 3, "Unknown function or expression."), /** XPST0003. */ NOTYPE(XPST, 3, "Unknown type '%'."), /** XPST0003. */ PIXML(XPST, 3, "Processing instruction has illegal name: '%'."), /** XPST0003. */ QNAMEINV(XPST, 3, "Expecting QName, '%' found."), /** XPST0003. */ PROLOGORDER(XPST, 3, "Default declarations must be declared first."), /** XPST0003. */ FTRANGE(XPST, 3, "Expecting full-text range."), /** XPST0003. */ FTSTOP(XPST, 3, "Stop words expected."), /** XPST0003. */ FTMATCH(XPST, 3, "Unknown match option '%...'."), /** XPST0003. */ INVALPI(XPST, 3, "Processing instruction has invalid name."), /** XPST0003. */ INTEXP(XPST, 3, "Integer expected."), /** XPST0003. */ VARFUNC(XPST, 3, "Variable or function declaration expected."), /** XPST0003. */ NOANN(XPST, 3, "No annotation allowed here."), /** XPST0003. */ NOCATCH(XPST, 3, "Expecting catch clause."), /** XPST0003. */ ANNVALUE(XPST, 3, "Literal expected after annotation."), /** XPST0003. */ UPDATINGVAR(XPST, 3, "Variable cannot be updating."), /** XPST0003. */ NSNOTALL(XPST, 3, "Namespace axis is not available in XQuery."), /** XPST0003. */ SIMPLETYPE(XPST, 3, "Simple type expected, '%(' found."), /** XPST0008. */ VARUNDEF(XPST, 8, "Undefined variable %."), /** XPST0008. */ VARPRIVATE(XPST, 8, "Variable % is not visible from this module."), /** XPST0008. */ TYPEUNDEF(XPST, 8, "Undefined type '%'."), /** XPST0008. */ SCHEMAINV(XPST, 8, "Undefined schema name '%'."), /** XPST0017. */ FUNCPRIV(XPST, 17, "Function '%' is not visible from this module."), /** XPST0017. */ FUNCSIMILAR(XPST, 17, "Unknown function '%'; similar: '%'."), /** XPST0017. */ FUNCARGSG(XPST, 17, "%: % argument supplied."), /** XPST0017. */ FUNCARGPL(XPST, 17, "%: % arguments supplied."), /** XPST0017. */ FUNCTYPESG(XPST, 17, "Function '%': % argument supplied; expected: %."), /** XPST0017. */ FUNCTYPEPL(XPST, 17, "Function '%': % arguments supplied; expected: %."), /** XPST0017. */ FUNCUNKNOWN(XPST, 17, "Unknown function '%'."), /** XPST0017. */ FUNCNOIMPL(XPST, 17, "Function v not implemented."), /** XPST0017. */ FUNCJAVA(XPST, 17, "Java function '%' not found."), /** XPST0017. */ JAVAAMBIG(XPST, 17, "Signature '%' is ambiguous."), /** XPST0017. */ JAVAINIT(XPST, 17, "Class cannot be initialized: %."), /** XPST0003. */ FUNC30(XPST, 17, "Function not available in XQuery 1.0."), /** XPST0051. */ TYPEUNKNOWN(XPST, 51, "Unknown type '%'."), /** XPST0080. */ CASTUNKNOWN(XPST, 80, "Invalid cast type '%'."), /** XPST0081. */ NOURI(XPST, 81, "No namespace declared for '%'."), /** XPST0081. */ NSMISS(XPST, 81, "QName '%' has no namespace."), /** XPTY0004. */ SEQCAST(XPTY, 4, "Single item expected, % found."), /** XPTY0004. */ INVCAST(XPTY, 4, "Cannot cast from % to %."), /** XPTY0004. */ INVCASTEX(XPTY, 4, "Invalid cast from % to %: %."), /** XPTY0004. */ INVTREAT(XPTY, 4, "Cannot treat % as %: %."), /** XPTY0004. */ CALCTYPE(XPTY, 4, "% not defined for % and %."), /** XPTY0004. */ NOSUBDUR(XPTY, 4, "%: only supported on subtypes of xs:duration, not %."), /** XPTY0004. */ INVEMPTY(XPTY, 4, "%: no empty sequence allowed."), /** XPTY0004. */ INVEMPTYEX(XPTY, 4, "%: % expected, empty sequence found."), /** XPTY0004. */ NODUR(XPTY, 4, "%: duration expected, % found."), /** XPTY0004. */ INVTYPECMP(XPTY, 4, "% and % cannot be compared."), /** XPTY0004. */ NONUMBER(XPTY, 4, "%: number expected, % found."), /** XPTY0004. */ NONAME(XPTY, 4, "Expecting name, '%' found."), /** XPTY0004. */ DOCATTS(XPTY, 4, "Cannot add attributes to a document node."), /** XPTY0004. */ DOCNS(XPTY, 4, "Cannot add namespaces to a document node."), /** XPTY0004. */ CPIWRONG(XPTY, 4, "Name has invalid type: '%'."), /** XPTY0004. */ INVQNAME(XPTY, 4, "Invalid QName: '%'."), /** XPTY0004. */ INVARITY(XPTY, 4, "Wrong number of arguments in %, expected %."), /** XPTY0004. */ INVNCNAME(XPTY, 4, "Invalid NCName: '%'."), /** XPTY0004. */ CITYPES(XPTY, 4, "Incompatible types in context item declarations: % vs. %."), /** XPTY0018. */ EVALNODESVALS(XPTY, 18, "Path yields both nodes and atomic values."), /** XPTY0019. */ PATHNODE(XPTY, 19, "Steps within a path expression must yield nodes; % found."), /** XPTY0020. */ STEPNODE(XPTY, 20, "Context node required for %; % found."), /** XPTY0117. */ NSSENS(XPTY, 117, "Cannot cast from % to %."), /** XQDY0025. */ CATTDUPL(XQDY, 25, "Duplicate attribute '%'."), /** XQDY0026. */ CPICONT(XQDY, 26, "Processing instruction has invalid content: '%'."), /** XQDY0041. */ CPIINVAL(XQDY, 41, "Processing instruction has invalid name: '%'."), /** XQDY0044. */ CAXML(XQDY, 44, "XML prefix and namespace cannot be rebound."), /** XQDY0044. */ CAINV(XQDY, 44, "Invalid attribute prefix/namespace '%'."), /** XQDY0054. */ CIRCVAR30(XQDY, 54, "Global variable depends on itself: %"), /** XQDY0054. */ CIRCCTX(XQDY, 54, "Context item is not defined."), /** XQDY0064. */ CPIXML(XQDY, 64, "Processing instruction has illegal name: '%'."), /** XQDY0072. */ COMINVALID(XQDY, 72, "Invalid comment."), /** XQDY0074. */ INVNAME(XQDY, 74, "Invalid name: '%'."), /** XQDY0074. */ INVPREF(XQDY, 74, "No namespace declared for %."), /** XQDY0096. */ CEXML(XQDY, 96, "XML prefix and namespace cannot be rebound."), /** XQDY0096. */ CEINV(XQDY, 96, "Invalid element prefix/namespace '%'."), /** XQDY0101. */ CNXML(XQDY, 101, "XML prefix and namespace cannot be rebound."), /** XQDY0101. */ CNINV(XQDY, 101, "Invalid prefix/namespace '%'."), /** XQDY0102. */ DUPLNSCONS(XQDY, 102, "Duplicate namespace declaration: '%'."), /** XQST0009. */ IMPLSCHEMA(XQST, 9, "Schema import not supported."), /** XQST0022. */ NSCONS(XQST, 22, "Constant namespace value expected."), /** XQST0031. */ XQUERYVER(XQST, 31, "XQuery version '%' not supported."), /** XQST0032. */ DUPLBASE(XQST, 32, "Duplicate 'base-uri' declaration."), /** XQST0033. */ DUPLNSDECL(XQST, 33, "Duplicate declaration of prefix '%'."), /** XQST0034. */ FUNCDEFINED(XQST, 34, "Duplicate declaration of function '%'."), /** XQST0038. */ DUPLCOLL(XQST, 38, "Duplicate 'collation' declaration."), /** XQST0038. */ WHICHDEFCOLL(XQST, 38, "Unknown collation '%'."), /** XQST0039. */ FUNCDUPL(XQST, 39, "Duplicate function argument %."), /** XQST0040. */ ATTDUPL(XQST, 40, "Duplicate attribute '%'."), /** XQST0045. */ NAMERES(XQST, 45, "Function '%' is in reserved namespace."), /** XQST0045. */ ANNRES(XQST, 45, "Annotation %% is in reserved namespace."), /** XQST0046. */ INVURI(XQST, 46, "URI '%' is invalid."), /** XQST0047. */ DUPLMODULE(XQST, 47, "Module namespace is declared twice: '%'."), /** XQST0047. */ MODNS(XQST, 48, "Declaration % does not match the module namespace."), /** XQST0049. */ VARDUPL(XQST, 49, "Duplicate declaration of %."), /** XQST0052. */ TYPEUNKNOWN30(XQST, 52, "Unknown cast type '%'."), /** XQST0054. */ CIRCVAR(XQST, 54, "Global variable depends on itself: %"), /** XQST0055. */ DUPLCOPYNS(XQST, 55, "Duplicate 'copy-namespace' declaration."), /** XQST0057. */ NSEMPTY(XQST, 57, "Namespace URI cannot be empty."), /** XQST0059. */ NOINST(XQST, 59, "Could not instantiate module '%'."), /** XQST0059. */ NOMODULE(XQST, 59, "Module \"%\" not found."), /** XQST0059. */ MODINIT(XQST, 59, "Module '%' not initialized."), /** XQST0059. */ NOMODULEFILE(XQST, 59, "Could not retrieve module '%'."), /** XQST0059. */ WRONGMODULE(XQST, 59, "Wrong URI '%' in imported module '%'."), /** XQST0060. */ FUNNONS(XQST, 60, "Namespace needed for function '%'."), /** XQST0065. */ DUPLORD(XQST, 65, "Duplicate 'ordering' declaration."), /** XQST0066. */ DUPLNS(XQST, 66, "Duplicate 'default namespace' declaration."), /** XQST0067. */ DUPLCONS(XQST, 67, "Duplicate 'construction' declaration."), /** XQST0068. */ DUPLBOUND(XQST, 68, "Duplicate 'boundary-space' declaration."), /** XQST0069. */ DUPLORDEMP(XQST, 69, "Duplicate 'order empty' declaration."), /** XQST0070. */ BINDXML(XQST, 70, "Prefix '%' cannot be rebound."), /** XQST0070. */ XMLNSDEF(XQST, 70, "'%' cannot be default namespace."), /** XQST0070. */ BINDXMLURI(XQST, 70, "'%' can only be bound to '%'."), /** XQST0071. */ DUPLNSDEF(XQST, 71, "Duplicate declaration of prefix '%'."), /** XQST0075. */ IMPLVAL(XQST, 75, "Validation not supported."), /** XQST0076. */ FLWORCOLL(XQST, 76, "Unknown collation '%'."), /** XQST0079. */ NOPRAGMA(XQST, 79, "Expecting pragma expression."), /** XQST0085. */ NSEMPTYURI(XQST, 85, "Namespace URI cannot be empty."), /** XQST0087. */ XQUERYENC2(XQST, 87, "Unknown encoding '%'."), /** XQST0088. */ NSMODURI(XQST, 88, "Module namespace cannot be empty."), /** XQST0089. */ DUPLVAR(XQST, 89, "Duplicate declaration of %."), /** XQST0090. */ INVCHARREF(XQST, 90, "Invalid character reference '%'."), /** XQST0093. */ CIRCMODULE(XQST, 93, "Circular module declaration."), /** XPST0094. */ GVARNOTDEFINED(XQST, 94, "Undeclared grouping variable '%'."), /** XPST0097. */ INVDECFORM(XQST, 97, "Invalid decimal-format property: %='%'."), /** XPST0097. */ INVDECSINGLE(XQST, 97, "Decimal-format property must be a single character: %='%'."), /** XPST0097. */ INVDECZERO(XQST, 97, "Zero-digit property must be Unicode digit with value zero: '%'."), /** XPST0098. */ DUPLDECFORM(XQST, 98, "Duplicate use of decimal-format '%'."), /** XQST0099. */ DUPLITEM(XQST, 99, "Duplicate declaration of context item."), /** XQST0103. */ WINDOWUNIQ(XQST, 103, "Duplicate variable name in window clause: %"), /** XQST0106. */ DUPLUPD(XQST, 106, "More than one updating annotation declared."), /** XQST0106. */ DUPLVIS(XQST, 106, "More than one visibility annotation declared."), /** XQST0108. */ MODOUT(XQST, 108, "No output declarations allowed in library modules."), /** XPST0109. */ OUTWHICH(XQST, 109, "Unknown serialization parameter: '%'."), /** XPST0110. */ OUTDUPL(XQST, 110, "Duplicate declaration of 'output:%'."), /** XPST0111. */ DECDUPL(XQST, 111, "Duplicate decimal-format declaration."), /** XQST0113. */ DECITEM(XQST, 113, "Context item cannot be bound in library module."), /** XPST0111. */ DECDUPLPROP(XQST, 114, "Duplicate decimal-format property '%'."), /** XQST0116. */ DUPLVARVIS(XQST, 116, "More than one visibility annotation declared."), /** XQST0118. */ TAGWRONG(XQST, 118, "Start and end tag are different: <%>...."), /** XQST0119. */ OUTDOC(XQST, 119, "Serialization document '%' cannot be parsed."), /** XQST0120. */ FEATNOTSUPP(XQST, 120, "Feature '%' is not supported by the implementation."), /** XQST0122. */ DECLQNAME(XQST, 122, "Invalid QName: '%'."), /** XQST0123. */ DECLOPTION(XQST, 123, "Unknown option: %."), /** XQST0123. */ DECLFEAT(XQST, 123, "Unknown feature: '%'."), /** XPST0125. */ INVISIBLE(XQST, 125, "No visibility annotation allowed in inline function."), /** XQTY0024. */ NOATTALL(XQTY, 24, "Attribute must follow the root element."), /** XQTY0024. */ NONSALL(XQTY, 24, "Namespaces must follow the root element."), /** XQTY0105. */ CONSFUNC(XQTY, 105, "Invalid content: %."), /** XUDY0009. */ UPNOPAR(XUDY, 9, "Target % has no parent."), /** XUDY0014. */ UPNOTCOPIED(XUDY, 14, "% was not created by copy clause."), /** XUDY0015. */ UPMULTREN(XUDY, 15, "Node can only be renamed once: %."), /** XUDY0015. */ UPPATHREN(XUDY, 15, "Path can only be renamed once: '%'."), /** XUDY0016. */ UPMULTREPL(XUDY, 16, "Node can only be replaced once: %."), /** XUDY0017. */ UPMULTREPV(XUDY, 17, "Node can only be replaced once: %"), /** XUDY0021. */ UPATTDUPL(XUDY, 21, "Duplicate attribute %."), /** XUDY0023. */ UPNSCONFL(XUDY, 23, "Conflicts with existing namespaces."), /** XUDY0024. */ UPNSCONFL2(XUDY, 24, "New namespaces conflict with each other."), /** XUDY0027. */ UPSEQEMP(XUDY, 27, "% target must not be empty."), /** XUDY0029. */ UPPAREMPTY(XUDY, 29, "Target has no parent node."), /** XUDY0030. */ UPATTELM(XUDY, 30, "Attributes cannot be inserted as child of a document."), /** XUDY0031. */ UPURIDUP(XUDY, 31, "URI '%' is addressed multiple times."), /** XUST0001. */ UPNOT(XUST, 1, "%: no updating expression allowed."), /** XUST0001. */ UPALL(XUST, 1, "%: all expressions must be updating or return an empty sequence."), /** XUST0001. */ UPCTX(XUST, 1, "Context item may not declare an updating expression."), /** XUST0002. */ UPMODIFY(XUST, 2, "Modify clause: all expressions must be updating or return an empty sequence."), /** XUST0002. */ UPEXPECTF(XUST, 2, "Function body must be an updating expression."), /** XUST0003. */ DUPLREVAL(XUST, 3, "Duplicate 'revalidation' declaration."), /** XUST0026. */ NOREVAL(XUST, 26, "Revalidation mode not supported."), /** XUST0028. */ UPFUNCTYPE(XUST, 28, "No return type allowed in updating functions."), /** XUTY0004. */ UPNOATTRPER(XUTY, 4, "Attribute must follow the root element."), /** XUTY0005. */ UPTRGTYP(XUTY, 5, "Single element or document expected as insert target."), /** XUTY0006. */ UPTRGTYP2(XUTY, 6, "Single element, text, comment or pi expected as insert target."), /** XUTY0007. */ UPTRGDELEMPT(XUTY, 7, "Only nodes can be deleted."), /** XUTY0008. */ UPTRGMULT(XUTY, 8, "Single element, text, attribute, comment or pi expected as replace target."), /** XUTY0010. */ UPWRELM(XUTY, 10, "Replacing nodes must be no attribute nodes."), /** XUTY0011. */ UPWRATTR(XUTY, 11, "Replacing nodes must be attribute nodes."), /** XUTY0012. */ UPWRTRGTYP(XUTY, 12, "Single element, attribute or pi expected as rename target."), /** XUTY0013. */ UPCOPYMULT(XUTY, 13, "Value assigned to $% must be a single node."), /** XUTY0022. */ UPATTELM2(XUTY, 22, "Insert target must be an element."); /** Cached enums (faster). */ public static final Err[] VALUES = values(); /** Error type. */ public final ErrType type; /** Error number. */ public final int num; /** Error description. */ public final String desc; /** * Constructor. * @param t error type * @param n error number * @param d description */ Err(final ErrType t, final int n, final String d) { type = t; num = n; desc = d; } /** * Throws a query exception. * @param ii input info * @param ext extended info * @return query exception (indicates that an error is raised) * @throws QueryException query exception */ public QueryException thrw(final InputInfo ii, final Object... ext) throws QueryException { throw new QueryException(ii, this, ext); } /** * Throws a serializer exception. Might be merged with {@link #thrw} in * future. * @param ext extended info * @return serializer exception (indicates that an error is raised) * @throws SerializerException serializer exception */ public SerializerException thrwSerial(final Object... ext) throws SerializerException { throw new SerializerException(new QueryException(null, this, ext)); } /** * Error types. * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public enum ErrType { // Project errors /** BASX Error type. */ BASX(QueryText.BXERR, QueryText.BXERRORS), /** BXCL Error type. */ BXCL(QueryText.BXERR, QueryText.BXERRORS), /** BXCO Error type. */ BXCO(QueryText.BXERR, QueryText.BXERRORS), /** BXCS Error type. */ BXCS(QueryText.BXERR, QueryText.BXERRORS), /** BXDB Error type. */ BXDB(QueryText.BXERR, QueryText.BXERRORS), /** BXFE Error type. */ BXFE(QueryText.BXERR, QueryText.BXERRORS), /** BXFT Error type. */ BXFT(QueryText.BXERR, QueryText.BXERRORS), /** BXHL Error type. */ BXHL(QueryText.BXERR, QueryText.BXERRORS), /** BXJS Error type. */ BXJS(QueryText.BXERR, QueryText.BXERRORS), /** BXPR Error type. */ BXPR(QueryText.BXERR, QueryText.BXERRORS), /** BXRE Error type. */ BXRE(QueryText.BXERR, QueryText.BXERRORS), /** BXSL Error type. */ BXSL(QueryText.BXERR, QueryText.BXERRORS), /** BXSQ Error type. */ BXSQ(QueryText.BXERR, QueryText.BXERRORS), /** BXVA Error type. */ BXVA(QueryText.BXERR, QueryText.BXERRORS), /** BXXQ Error type. */ BXXQ(QueryText.BXERR, QueryText.BXERRORS), /** HASH Error type. */ HASH(QueryText.BXERR, QueryText.BXERRORS), /** UNIT Error type. */ UNIT(QueryText.UNIT, QueryText.UNITURI), // EXPath errors /** CX Error type. */ CX(QueryText.EXPERR, QueryText.EXPERROR), /** FILE Error type. */ FILE(QueryText.EXPERR, QueryText.EXPERROR), /** HC Error type. */ HC(QueryText.EXPERR, QueryText.EXPERROR), /** ZIP Error type. */ ZIP(QueryText.EXPERR, QueryText.EXPERROR), /** ARCH Error type. */ ARCH(QueryText.EXPERR, QueryText.EXPERROR), // W3 errors /** FOAR Error type. */ FOAR, /** FOCA Error type. */ FOCA, /** FOCH Error type. */ FOCH, /** FODC Error type. */ FODC, /** FODF Error type. */ FODF, /** FODT Error type. */ FODT, /** FOFD Error type. */ FOFD, /** FOER Error type. */ FOER, /** FONS Error type. */ FONS, /** FORG Error type. */ FORG, /** FORX Error type. */ FORX, /** FOTY Error type. */ FOTY, /** FOUP Error type. */ FOUP, /** FOUT Error type. */ FOUT, /** FTDY Error type. */ FTDY, /** FTST Error type. */ FTST, /** SENR Error type. */ SENR, /** SEPM Error type. */ SEPM, /** SERE Error type. */ SERE, /** SEPM Error type. */ SESU, /** XPDY Error type. */ XPDY, /** XPST Error type. */ XPST, /** XPTY Error type. */ XPTY, /** XQDY Error type. */ XQDY, /** XQST Error type. */ XQST, /** XQTY Error type. */ XQTY, /** XUDY Error type. */ XUDY, /** XUST Error type. */ XUST, /** XUTY Error type. */ XUTY; /** This error type's prefix. */ public final String prefix; /** This error type's URI. */ public final byte[] uri; /** * Constructor for non-standard errors. * @param pref QName prefix * @param u error URI */ ErrType(final byte[] pref, final byte[] u) { prefix = Token.string(pref); uri = u; } /** * Constructor for standard XQuery errors. The prefix is {@code err}, the URI is * {@code http://www.w3.org/2005/xqt-errors}. */ ErrType() { this(QueryText.ERR, QueryText.ERRORURI); } /** * Creates a QName for the given error number. * @param num error number * @return constructed QName */ public final QNm qname(final int num) { return new QNm(String.format("%s:%s%04d", prefix, name(), num), uri); } } /** * Returns the namespace URI of this error. * @return function */ public final QNm qname() { return type.qname(num); } /** * Returns an error for the specified name. * @param name error name * @param ii input info * @param msg error message * @return exception or null * @throws QueryException query exception */ public static QueryException thrw(final String name, final InputInfo ii, final String msg) throws QueryException { for(final Err e : VALUES) { if(e.toString().equals(name)) throw new QueryException(ii, e.qname(), msg).err(e); } return null; } /** * Throws a comparison exception. * @param ii input info * @param it1 first item * @param it2 second item * @return query exception (indicates that an error is raised) * @throws QueryException query exception */ public static QueryException diff(final InputInfo ii, final Item it1, final Item it2) throws QueryException { throw (it1 == it2 ? TYPECMP : INVTYPECMP).thrw(ii, it1.type, it2.type); } /** * Throws a type cast exception. * @param ii input info * @param t expression cast type * @param v value * @return query exception (indicates that an error is raised) * @throws QueryException query exception */ public static QueryException cast(final InputInfo ii, final Type t, final Value v) throws QueryException { throw INVCASTEX.thrw(ii, v.type, t, v); } /** * Throws a type promoting exception. * @param ii input info * @param t expression cast type * @param e expression * @return query exception (indicates that an error is raised) * @throws QueryException query exception */ public static QueryException treat(final InputInfo ii, final SeqType t, final Expr e) throws QueryException { throw INVTREAT.thrw(ii, e.description(), t, e); } /** * Throws a type exception. * @param e parsing expression * @param t expected type * @param it found item * @return query exception (indicates that an error is raised) * @throws QueryException query exception */ public static QueryException type(final ParseExpr e, final Type t, final Item it) throws QueryException { throw INVCAST.thrw(e.info, it.type, t); } /** * Throws a number exception. * @param e parsing expression * @param it found item * @return query exception (indicates that an error is raised) * @throws QueryException query exception */ public static QueryException number(final ParseExpr e, final Item it) throws QueryException { throw NONUMBER.thrw(e.info, e.description(), it.type); } /** * Throws an invalid value exception. * @param ii input info * @param t expected type * @param v value * @return query exception (indicates that an error is raised) * @throws QueryException query exception */ public static QueryException value(final InputInfo ii, final Type t, final Object v) throws QueryException { throw INVALUE.thrw(ii, t, v); } /** * Throws an exception for circular static variables. * @param ctx query context * @param var variable expression * @return never * @throws QueryException query exception */ public static QueryException circVar(final QueryContext ctx, final StaticVar var) throws QueryException { throw (ctx.sc.xquery3() ? CIRCVAR30 : CIRCVAR).thrw(var.info, var); } @Override public String toString() { return String.format("%s%04d", type, num); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/ExprList.java000066400000000000000000000035401222453003200257400ustar00rootroot00000000000000package org.basex.query.util; import org.basex.query.expr.*; import org.basex.util.list.*; /** * This is a simple container for expressions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ExprList extends ElementList { /** Element container. */ private Expr[] list; /** * Default constructor. */ public ExprList() { this(1); } /** * Constructor, specifying an initial array capacity. * @param c array capacity */ public ExprList(final int c) { list = new Expr[c]; } /** * Constructor, specifying an initial entry. * @param c array capacity */ public ExprList(final Expr c) { list = new Expr[] { c }; size = 1; } /** * Returns the specified element. * @param p position * @return value */ public Expr get(final int p) { return list[p]; } /** * Adds an element to the array. * @param e element to be added */ public void add(final Expr e) { if(size == list.length) resize(newSize()); list[size++] = e; } /** * Sets an element at the specified index position. * @param i index * @param e element to be set */ public void set(final int i, final Expr e) { if(i >= list.length) resize(newSize(i + 1)); list[i] = e; size = Math.max(size, i + 1); } /** * Resizes the array. * @param s new size */ private void resize(final int s) { final Expr[] tmp = new Expr[s]; System.arraycopy(list, 0, tmp, 0, size); list = tmp; } /** * Returns an array with all elements. * Warning: returns the internal array representation for better performance. * @return internal array */ public Expr[] finish() { if(size != list.length) { final Expr[] tmp = new Expr[size]; System.arraycopy(list, 0, tmp, 0, size); list = tmp; } return list; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/HashItemSet.java000066400000000000000000000052651222453003200263520ustar00rootroot00000000000000package org.basex.query.util; import java.util.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.util.*; import org.basex.util.hash.*; /** * This is an efficient and memory-saving hash map for storing items. * It is related to the {@link TokenSet} class. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class HashItemSet extends ASet implements ItemSet { /** Hash values. */ private int[] hash; /** Hashed items. */ private Item[] keys; /** * Default constructor. */ public HashItemSet() { super(Array.CAPACITY); hash = new int[Array.CAPACITY]; keys = new Item[Array.CAPACITY]; } @Override public final boolean add(final Item key, final InputInfo ii) throws QueryException { return index(key, ii) > 0; } /** * Stores the specified key and returns its id. * @param key key to be added * @param ii input info * @return unique id of stored key (larger than zero) * @throws QueryException query exception */ public int put(final Item key, final InputInfo ii) throws QueryException { final int i = index(key, ii); return Math.abs(i); } /** * Returns the id of the specified key, or {@code 0} if the key does not exist. * @param key key to be looked up * @param ii input info * @return id, or {@code 0} if key does not exist * @throws QueryException query exception */ public final int id(final Item key, final InputInfo ii) throws QueryException { final int h = key.hash(ii); final int p = h & bucket.length - 1; for(int id = bucket[p]; id != 0; id = next[id]) { if(keys[id].equiv(key, null, ii)) return -id; } return 0; } /** * Stores the specified key and returns its id, or returns the negative id if the * key has already been stored. * @param key key to be found * @param ii input info * @return id, or negative id if key has already been stored * @throws QueryException query exception */ private int index(final Item key, final InputInfo ii) throws QueryException { checkSize(); final int h = key.hash(ii); final int b = h & bucket.length - 1; for(int r = bucket[b]; r != 0; r = next[r]) { if(keys[r].equiv(key, null, ii)) return -r; } next[size] = bucket[b]; keys[size] = key; hash[size] = h; bucket[b] = size; return size++; } @Override public Iterator iterator() { return new ArrayIterator(keys, 1, size); } @Override protected int hash(final int id) { return hash[id]; } @Override protected void rehash(final int newSize) { keys = Array.copy(keys, new Item[newSize]); hash = Arrays.copyOf(hash, newSize); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/IndexContext.java000066400000000000000000000010301222453003200265720ustar00rootroot00000000000000package org.basex.query.util; import org.basex.data.*; /** * This class contains data required for index operations. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class IndexContext { /** Data reference. */ public final Data data; /** Flag for iterative evaluation. */ public final boolean iterable; /** * Constructor. * @param d data reference * @param i iterable flag */ public IndexContext(final Data d, final boolean i) { data = d; iterable = i; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/IndexCosts.java000066400000000000000000000044251222453003200262540ustar00rootroot00000000000000package org.basex.query.util; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.path.*; import org.basex.util.*; /** * This class contains methods for analyzing the costs of index requests. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class IndexCosts { /** Query context. */ public final QueryContext ctx; /** Index context. */ public final IndexContext ictx; /** Index Step. */ public final Step step; /** Costs of index access: smaller is better, 0 means no results. */ private int costs; /** Flag for ftnot expressions. */ public boolean not; /** Flag for sequential processing. */ public boolean seq; /** * Constructor. * @param ic index context * @param c query context * @param s index step */ public IndexCosts(final IndexContext ic, final QueryContext c, final Step s) { ctx = c; ictx = ic; step = s; } /** * Rewrites the specified expression for index access. * @param ex expression to be rewritten * @param root new root expression * @param text text flag * @return index access */ public Expr invert(final Expr ex, final ParseExpr root, final boolean text) { // handle context node if(ex instanceof Context) { if(text) return root; // add attribute step if(step.test.name == null) return root; final Step as = Step.get(step.info, Axis.SELF, step.test); return Path.get(root.info, root, as); } final AxisPath orig = (AxisPath) ex; final AxisPath path = orig.invertPath(root, step); if(!text) { // add attribute step final Step s = orig.step(orig.steps.length - 1); if(s.test.name != null) { Expr[] steps = { Step.get(s.info, Axis.SELF, s.test) }; for(final Expr e : path.steps) steps = Array.add(steps, e); path.steps = steps; } } return path; } /** * Adds the estimated costs. * @param c cost to be added */ public void addCosts(final int c) { costs = Math.max(1, costs + c); } /** * Sets the estimated costs. * @param c cost to be added */ public void costs(final int c) { costs = c; } /** * Returns the estimated costs. * @return costs */ public int costs() { return costs; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/ItemSet.java000066400000000000000000000012021222453003200255310ustar00rootroot00000000000000package org.basex.query.util; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * This is an interface for indexing and retrieving items in a set. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public interface ItemSet extends Iterable { /** * Stores the specified key if it has not been stored before. * @param key key to be added * @param ii input info * @return {@Code true} if the key did not exist yet and was stored * @throws QueryException query exception */ boolean add(final Item key, final InputInfo ii) throws QueryException; } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/ItemValueMap.java000066400000000000000000000027161222453003200265230ustar00rootroot00000000000000package org.basex.query.util; import org.basex.query.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * Map for quickly indexing items. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class ItemValueMap extends HashItemSet { /** Values. */ private Value[] values = new Value[Array.CAPACITY]; /** * Indexes the specified key and stores the associated value. * If the key already exists, the value is updated. * @param key key * @param value value * @param ii input info * @throws QueryException query exception */ public void add(final Item key, final Value value, final InputInfo ii) throws QueryException { // array bounds are checked before array is resized.. final int i = put(key, ii); values[Math.abs(i)] = value; } /** * Returns the value for the specified key. * @param key key to be found * @param ii input info * @return value or {@code null} if nothing was found * @throws QueryException query exception */ public Value get(final Item key, final InputInfo ii) throws QueryException { return values[id(key, ii)]; } /** * Returns a value iterator. * @return iterator */ public final Iterable values() { return new ArrayIterator(values, 1, size); } @Override protected void rehash(final int s) { super.rehash(s); values = Array.copy(values, new Value[s]); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/JDBCConnections.java000066400000000000000000000030131222453003200270660ustar00rootroot00000000000000package org.basex.query.util; import java.sql.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Opened JDBC connections. * * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ public final class JDBCConnections { /** Last inserted id. */ private int lastId = -1; /** Map with all open connections and prepared statements with unique ids. */ private final IntObjMap conns = new IntObjMap(); /** * Adds a connection or prepared statement to depot. * @param obj connection or prepared statement * @return connection/prepared statement id */ public int add(final Object obj) { conns.put(++lastId, obj); return lastId; } /** * Returns connection or prepared statement with the given id. * @param id id * @return connection or prepared statement */ public Object get(final int id) { return conns.get(id); } /** * Removes either a connection or a prepared statement from the depot. * @param id connection/prepared statement id */ public void remove(final int id) { conns.delete(id); } /** * Closes all opened connections. */ public void close() { for(int i = 0; i < conns.size(); i++) { final int key = conns.key(i); final Object obj = conns.get(key); if(obj == null) continue; try { if(obj instanceof Connection) ((Connection) obj).close(); else ((PreparedStatement) obj).close(); } catch(final SQLException ex) { Util.debug(ex); } } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/JsonXMLConverter.java000066400000000000000000000011071222453003200273450ustar00rootroot00000000000000package org.basex.query.util; import org.basex.query.*; import org.basex.query.util.json.*; import org.basex.query.value.node.*; import org.basex.util.*; /** * This class provides a parse method to convert JSON data to XML nodes. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class JsonXMLConverter extends JsonConverter { /** * Constructor. * @param ii input info */ public JsonXMLConverter(final InputInfo ii) { super(ii); } @Override public abstract ANode convert(final String in) throws QueryException; } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/NSContext.java000066400000000000000000000056111222453003200260540ustar00rootroot00000000000000package org.basex.query.util; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import org.basex.query.*; import org.basex.util.*; /** * This class references all statically known namespaces. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class NSContext { /** Static namespaces, containing prefixes and URIs. */ private final Atts ns = new Atts(); /** Dynamically added namespaces. */ private Atts stack; /** * Validates and adds the specified namespace at parsing time. * @param pref namespace prefix * @param uri namespace URI * @param ii input info * @throws QueryException query exception */ public void add(final byte[] pref, final byte[] uri, final InputInfo ii) throws QueryException { if(eq(pref, XML, XMLNS)) BINDXML.thrw(ii, pref); if(eq(uri, XMLURI)) BINDXMLURI.thrw(ii, uri, XML); if(eq(uri, XMLNSURI)) BINDXMLURI.thrw(ii, uri, XMLNS); ns.add(pref, uri); } /** * Deletes the specified namespace at parsing time. * @param pref namespace prefix */ public void delete(final byte[] pref) { for(int s = ns.size() - 1; s >= 0; s--) { if(eq(pref, ns.name(s))) ns.delete(s); } } /** * Finds the namespace URI for the specified prefix, if it is found * in statically declared namespaces. * @param pref prefix of the namespace * @return uri or {@code null} */ public byte[] staticURI(final byte[] pref) { for(int s = ns.size() - 1; s >= 0; s--) { if(eq(ns.name(s), pref)) return ns.value(s); } return null; } /** * Returns the namespace URI for the specified prefix, if it is either * found in the dynamic, static or predefined namespaces. * @param pref prefix of the namespace * @return namespace URI or {@code null} */ public byte[] uri(final byte[] pref) { if(stack != null) { for(int s = stack.size() - 1; s >= 0; s--) { if(eq(stack.name(s), pref)) return stack.value(s); } } final byte[] uri = staticURI(pref); return uri == null ? NSGlobal.uri(pref) : uri.length == 0 ? null : uri; } /** * Returns the number of dynamic namespaces. * @return namespaces */ public int size() { return stack().size(); } /** * Sets the number of dynamic namespaces. * @param s namespaces */ public void size(final int s) { stack().size(s); } /** * Adds a namespace to the namespace stack. * @param pref namespace prefix * @param uri namespace URI */ public void add(final byte[] pref, final byte[] uri) { stack().add(pref, uri); } /** * Returns the namespace stack. * @return stack */ public Atts stack() { if(stack == null) stack = new Atts(); return stack; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/NSGlobal.java000066400000000000000000000056321222453003200256330ustar00rootroot00000000000000package org.basex.query.util; import static org.basex.query.QueryText.*; import static org.basex.util.Token.*; import org.basex.util.*; /** * Global namespaces. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class NSGlobal { /** Namespace: prefixes and namespace URIs. */ private static final Atts NS = new Atts(); /** Reserved namespaces. */ private static final int RESERVED; static { // reserved namespaces NS.add(XML, XMLURI); NS.add(XS, XSURI); NS.add(XSI, XSIURI); NS.add(FN, FNURI); NS.add(MATH, MATHURI); NS.add(MAP, MAPURI); NS.add(ANN, XQURI); RESERVED = NS.size(); // implementation-defined pre-declarations NS.add(LOCAL, LOCALURI); NS.add(OUTPUT, OUTPUTURI); NS.add(ERR, ERRORURI); // EXPath namespaces NS.add(EXPERR, EXPERROR); NS.add(CRYPTO, CRYPTOURI); NS.add(FILE, FILEURI); NS.add(HTTP, HTTPURI); NS.add(PKG, PKGURI); NS.add(ZIP, ZIPURI); // EXQuery namespaces NS.add(REST, RESTURI); NS.add(RESTXQ, RESTURI); // BaseX namespaces NS.add(BXERR, BXERRORS); NS.add(BASEX, BASEXURI); NS.add(ADMIN, ADMINURI); NS.add(ARCHIVE, ARCHIVEURI); NS.add(CLIENT, CLIENTURI); NS.add(CONVERT, CONVERTURI); NS.add(CSV, CSVURI); NS.add(DB, DBURI); NS.add(FETCH, FETCHURI); NS.add(FT, FTURI); NS.add(HASH, HASHURI); NS.add(HOF, HOFURI); NS.add(HTML, HTMLURI); NS.add(INDEX, INDEXURI); NS.add(INSPECT, INSPECTURI); NS.add(JSON, JSONURI); NS.add(OUT, OUTURI); NS.add(PROC, PROCURI); NS.add(PROF, PROFURI); NS.add(QUERY, QUERYURI); NS.add(RANDOM, RANDOMURI); NS.add(REPO, REPOURI); NS.add(SQL, SQLURI); NS.add(STREAM, STREAMURI); NS.add(UNIT, UNITURI); NS.add(VLDT, VALIDATEURI); NS.add(XSLT, XSLTURI); NS.add(XQRY, XQUERYURI); } /** Private constructor. */ private NSGlobal() { } /** * Finds the specified namespace uri. * @param pref prefix of the namespace * @return uri, or {@code null} */ public static byte[] uri(final byte[] pref) { for(int s = NS.size() - 1; s >= 0; s--) { if(eq(NS.name(s), pref)) return NS.value(s); } return null; } /** * Finds the prefix for the specified uri. * @param uri namespace uri * @return prefix, or empty string */ public static byte[] prefix(final byte[] uri) { for(int s = NS.size() - 1; s >= 0; s--) { if(eq(NS.value(s), uri)) return NS.name(s); } return EMPTY; } /** * Checks if the specified uri is a reserved namespace. * @param uri uri to be checked * @return result of check */ public static boolean reserved(final byte[] uri) { for(int s = RESERVED - 1; s >= 0; s--) { if(eq(NS.value(s), uri)) return true; } return false; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/QNmCache.java000066400000000000000000000020701222453003200256020ustar00rootroot00000000000000package org.basex.query.util; import org.basex.query.value.item.*; import org.basex.util.*; import org.basex.util.hash.*; /** * This class caches frequently used QNames. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class QNmCache extends TokenSet { /** QNames. */ private QNm[] values = new QNm[Array.CAPACITY]; /** * Creates a QName for the specified key, or returns an existing one. * @param prefix prefix (may be {@code null)} * @param local local name * @param uri namespace uri (may be {@code null)} * @return name */ public QNm index(final byte[] prefix, final byte[] local, final byte[] uri) { final int i = put(QNm.internal(prefix, local, uri)); QNm value = values[i]; if(value == null) { final byte[] nm = QNm.internal(prefix, local, null); value = uri == null ? new QNm(nm) : new QNm(nm, uri); values[i] = value; } return value; } @Override protected void rehash(final int s) { super.rehash(s); values = Array.copy(values, new QNm[s]); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/TypedFunc.java000066400000000000000000000027331222453003200260720ustar00rootroot00000000000000package org.basex.query.util; import org.basex.query.expr.*; import org.basex.query.func.*; import org.basex.query.value.type.*; /** * Wrapper that provides types for function expressions. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class TypedFunc { /** Function expression. */ public final Expr fun; /** Function type. */ public final FuncType type; /** Annotations. */ public final Ann ann; /** * Constructor. * @param f function expression * @param a annotations * @param ret return type * @param args argument types */ private TypedFunc(final Expr f, final Ann a, final SeqType ret, final SeqType... args) { this(f, a, FuncType.get(ret, args)); } /** * Constructor. * @param f function expression * @param a annotations * @param ft function type */ public TypedFunc(final Expr f, final Ann a, final FuncType ft) { fun = f; type = ft; ann = a; } /** * Creates a type constructor function. * @param cast cast expression * @param to type to cast to * @return typed function */ public static TypedFunc constr(final Cast cast, final SeqType to) { return new TypedFunc(cast, new Ann(), to, SeqType.AAT_ZO); } /** * Creates a type constructor function. * @param f java function * @return typed function */ public static TypedFunc java(final JavaMapping f) { return new TypedFunc(f, new Ann(), FuncType.arity(f.expr.length)); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/ValueList.java000066400000000000000000000022171222453003200260760ustar00rootroot00000000000000package org.basex.query.util; import java.util.*; import org.basex.query.value.*; import org.basex.util.*; import org.basex.util.list.*; /** * This is a simple container for values. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ValueList extends ElementList { /** List entries. */ private Value[] list; /** * Default constructor. */ public ValueList() { this(Array.CAPACITY); } /** * Constructor, specifying an initial array capacity. * @param c array capacity */ private ValueList(final int c) { list = new Value[c]; } /** * Adds an element to the list. * @param e element be added */ public void add(final Value e) { if(size == list.length) list = Array.copy(list, new Value[newSize()]); list[size++] = e; } /** * Returns the element at the specified index. * @param i index * @return element */ public Value get(final int i) { return list[i]; } @Override public String toString() { return Util.name(this) + Arrays.toString(Arrays.copyOf(list, size)); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/archive/000077500000000000000000000000001222453003200247425ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/util/archive/ArchiveIn.java000066400000000000000000000040021222453003200274510ustar00rootroot00000000000000package org.basex.query.util.archive; import static org.basex.query.util.Err.*; import java.io.*; import java.util.zip.*; import org.basex.io.*; import org.basex.io.in.*; import org.basex.io.out.*; import org.basex.query.*; import org.basex.util.*; /** * Archive reader. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class ArchiveIn { /** Buffer. */ private final byte[] data = new byte[IO.BLOCKSIZE]; /** * Returns a new instance of an archive reader. * @param bi buffer input * @param info input info * @return reader * @throws QueryException query exception */ public static ArchiveIn get(final BufferInput bi, final InputInfo info) throws QueryException { try { final LookupInput li = new LookupInput(bi); if(li.lookup() == 0x50) return new ZIPIn(li); if(li.lookup() == 0x1f) return new GZIPIn(li); } catch(final IOException ex) { try { bi.close(); } catch(final IOException ignored) { } throw ARCH_FAIL.thrw(info, ex); } throw ARCH_UNKNOWN.thrw(info); } /** * Indicates if the archive contains more entries. * @return result of check * @throws IOException I/O exception */ public abstract boolean more() throws IOException; /** * Returns the current entry. * @return entry */ public abstract ZipEntry entry(); /** * Returns the name of the archive format. * @return name */ public abstract String format(); /** * Reads data from the archive. * @param d data buffer * @return number of read bytes * @throws IOException I/O exception */ public abstract int read(final byte[] d) throws IOException; /** * Reads the next entry. * @return entry * @throws IOException I/O exception */ public byte[] read() throws IOException { final ArrayOutput ao = new ArrayOutput(); for(int c; (c = read(data)) != -1;) ao.write(data, 0, c); return ao.toArray(); } /** * Closes the stream. */ public abstract void close(); } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/archive/ArchiveOut.java000066400000000000000000000033471222453003200276650ustar00rootroot00000000000000package org.basex.query.util.archive; import static org.basex.query.util.Err.*; import java.io.*; import java.util.zip.*; import org.basex.io.*; import org.basex.io.out.*; import org.basex.query.*; import org.basex.util.*; /** * Archive writer. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class ArchiveOut { /** Output. */ final ArrayOutput ao = new ArrayOutput(); /** Buffer. */ final byte[] data = new byte[IO.BLOCKSIZE]; /** * Returns a new instance of an archive writer. * @param format archive format * @param info input info * @return writer * @throws QueryException query exception */ public static ArchiveOut get(final String format, final InputInfo info) throws QueryException { try { if(format.equals("zip")) return new ZIPOut(); if(format.equals("gzip")) return new GZIPOut(); } catch(final IOException ex) { throw ARCH_FAIL.thrw(info, ex); } throw ARCH_UNKNOWN.thrw(info); } /** * Sets the compression level. * @param l level */ public abstract void level(final int l); /** * Writes data from the specified archive. * @param in input archive * @throws IOException I/O exception */ public abstract void write(final ArchiveIn in) throws IOException; /** * Writes the specified entry. * @param entry zip entry * @param val value to be written * @throws IOException I/O exception */ public abstract void write(final ZipEntry entry, final byte[] val) throws IOException; /** * Closes the stream. */ public abstract void close(); /** * Returns the output as byte array. * @return byte array */ public final byte[] toArray() { return ao.toArray(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/archive/GZIPIn.java000066400000000000000000000020341222453003200266440ustar00rootroot00000000000000package org.basex.query.util.archive; import java.io.*; import java.util.zip.*; import org.basex.util.*; /** * GZIP reader. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class GZIPIn extends ArchiveIn { /** GZIP input stream. */ private final GZIPInputStream zis; /** Flag. */ private boolean more; /** * Constructor. * @param is input stream * @throws IOException I/O exception */ public GZIPIn(final InputStream is) throws IOException { zis = new GZIPInputStream(is); } @Override public boolean more() throws IOException { return more ^= true; } @Override public ZipEntry entry() { final ZipEntry ze = new ZipEntry(""); ze.setMethod(ZipEntry.DEFLATED); return ze; } @Override public int read(final byte[] d) throws IOException { return zis.read(d); } @Override public String format() { return "gzip"; } @Override public void close() { try { zis.close(); } catch(final IOException ex) { Util.debug(ex); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/archive/GZIPOut.java000066400000000000000000000016531222453003200270530ustar00rootroot00000000000000package org.basex.query.util.archive; import java.io.*; import java.util.zip.*; import org.basex.util.*; /** * GZIP output. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class GZIPOut extends ArchiveOut { /** ZIP output stream. */ private final GZIPOutputStream zos; /** * Writing constructor. * @throws IOException I/O exception */ public GZIPOut() throws IOException { zos = new GZIPOutputStream(ao); } @Override public void level(final int l) { // ignore compression level } @Override public void write(final ArchiveIn in) throws IOException { for(int c; (c = in.read(data)) != -1;) zos.write(data, 0, c); } @Override public void write(final ZipEntry entry, final byte[] val) throws IOException { zos.write(val); } @Override public void close() { try { zos.close(); } catch(final IOException ex) { Util.debug(ex); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/archive/ZIPIn.java000066400000000000000000000016561222453003200265460ustar00rootroot00000000000000package org.basex.query.util.archive; import java.io.*; import java.util.zip.*; import org.basex.util.*; /** * ZIP input. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ZIPIn extends ArchiveIn { /** ZIP input stream. */ private final ZipInputStream zis; /** Current entry. */ private ZipEntry ze; /** * Constructor. * @param is input stream */ public ZIPIn(final InputStream is) { zis = new ZipInputStream(is); } @Override public boolean more() throws IOException { ze = zis.getNextEntry(); return ze != null; } @Override public ZipEntry entry() { return ze; } @Override public int read(final byte[] d) throws IOException { return zis.read(d); } @Override public String format() { return "zip"; } @Override public void close() { try { zis.close(); } catch(final IOException ex) { Util.debug(ex); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/archive/ZIPOut.java000066400000000000000000000021361222453003200267410ustar00rootroot00000000000000package org.basex.query.util.archive; import java.io.*; import java.util.zip.*; import org.basex.util.*; /** * ZIP output. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ZIPOut extends ArchiveOut { /** ZIP output stream. */ private final ZipOutputStream zos; /** * Writing constructor. */ public ZIPOut() { zos = new ZipOutputStream(ao); } @Override public void level(final int l) { zos.setLevel(l); } @Override public void write(final ArchiveIn in) throws IOException { final ZipEntry zi = in.entry(); final ZipEntry zo = new ZipEntry(zi.getName()); zo.setTime(zi.getTime()); zo.setComment(zi.getComment()); zos.putNextEntry(zo); for(int c; (c = in.read(data)) != -1;) zos.write(data, 0, c); zos.closeEntry(); } @Override public void write(final ZipEntry entry, final byte[] val) throws IOException { zos.putNextEntry(entry); zos.write(val); zos.closeEntry(); } @Override public void close() { try { zos.close(); } catch(final IOException ex) { Util.debug(ex); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/crypto/000077500000000000000000000000001222453003200246415ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/util/crypto/DigitalSignature.java000066400000000000000000000321021222453003200307410ustar00rootroot00000000000000package org.basex.query.util.crypto; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.io.*; import java.security.*; import java.security.cert.*; import java.util.*; import javax.xml.crypto.*; import javax.xml.crypto.dom.*; import javax.xml.crypto.dsig.*; import javax.xml.crypto.dsig.dom.*; import javax.xml.crypto.dsig.keyinfo.*; import javax.xml.crypto.dsig.spec.*; import javax.xml.parsers.*; import javax.xml.xpath.*; import org.basex.io.out.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.hash.*; import org.w3c.dom.*; import org.xml.sax.*; /** * This class generates and validates digital signatures for XML data. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class DigitalSignature { /** Canonicalization algorithms. */ private static final TokenMap CANONICALIZATIONS = new TokenMap(); /** Signature digest algorithms. */ private static final TokenMap DIGESTS = new TokenMap(); /** Signature algorithms. */ private static final TokenMap SIGNATURES = new TokenMap(); /** Signature types. */ private static final TokenSet TYPES = new TokenSet(); /** Default canonicalization algorithm. */ private static final byte[] DEFC = token("inclusive-with-comments"); /** Default digest algorithm. */ private static final byte[] DEFD = token("sha1"); /** Default signature algorithm. */ private static final byte[] DEFS = token("rsa_sha1"); /** Default signature type enveloped. */ private static final byte[] DEFT = token("enveloped"); /** Signature type enveloping. */ private static final byte[] ENVT = token("enveloping"); // initializations static { CANONICALIZATIONS.put("inclusive-with-comments", CanonicalizationMethod.INCLUSIVE_WITH_COMMENTS); CANONICALIZATIONS.put("exclusive-with-comments", CanonicalizationMethod.EXCLUSIVE_WITH_COMMENTS); CANONICALIZATIONS.put("inclusive", CanonicalizationMethod.INCLUSIVE); CANONICALIZATIONS.put("exclusive", CanonicalizationMethod.EXCLUSIVE); DIGESTS.put("sha1", DigestMethod.SHA1); DIGESTS.put("sha256", DigestMethod.SHA256); DIGESTS.put("sha512", DigestMethod.SHA512); SIGNATURES.put("rsa_sha1", SignatureMethod.RSA_SHA1); SIGNATURES.put("dsa_sha1", SignatureMethod.DSA_SHA1); TYPES.add(DEFT); TYPES.add(ENVT); } /** Input info. */ private final InputInfo info; /** * Constructor. * @param ii input info */ public DigitalSignature(final InputInfo ii) { info = ii; } /** * Generates a signature. * @param node node to be signed * @param c canonicalization algorithm * @param d digest algorithm * @param sig signature algorithm * @param ns signature element namespace prefix * @param t signature type (enveloped, enveloping, detached) * @param expr XPath expression which specifies node to be signed * @param ce certificate which contains keystore information for * signing the node, may be null * @param ctx query context * @param ii input info * * @return signed node * @throws QueryException query exception */ public Item generateSignature(final ANode node, final byte[] c, final byte[] d, final byte[] sig, final byte[] ns, final byte[] t, final byte[] expr, final ANode ce, final QueryContext ctx, final InputInfo ii) throws QueryException { // checking input variables byte[] b = c; if(b.length == 0) b = DEFC; b = CANONICALIZATIONS.get(lc(b)); if(b == null) CX_CANINV.thrw(info, c); final String canonicalization = string(b); b = d; if(b.length == 0) b = DEFD; b = DIGESTS.get(lc(b)); if(b == null) CX_DIGINV.thrw(info, d); final String digest = string(b); b = sig; if(b.length == 0) b = DEFS; final byte[] tsig = b; b = SIGNATURES.get(lc(b)); if(b == null) CX_SIGINV.thrw(info, sig); final String signature = string(b); final String keytype = string(tsig).substring(0, 3); b = t; if(b.length == 0) b = DEFT; if(!TYPES.contains(lc(b))) CX_SIGTYPINV.thrw(info, t); final byte[] type = b; Item signedNode = null; try { final XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM"); final PrivateKey pk; final PublicKey puk; final KeyInfo ki; // dealing with given certificate details to initialize the keystore if(ce != null) { String ksTY = null; String ksPW = null; String kAlias = null; String pkPW = null; String ksURI = null; final Document ceDOM = toDOMNode(ce); if(!ceDOM.getDocumentElement().getNodeName(). equals("digital-certificate")) CX_INVNM.thrw(info, ceDOM); final NodeList ceChildren = ceDOM.getDocumentElement().getChildNodes(); final int s = ceChildren.getLength(); int ci = 0; // iterate child axis to retrieve keystore setup while(ci < s) { final Node cn = ceChildren.item(ci++); final String name = cn.getNodeName(); if(name.equals("keystore-type")) ksTY = cn.getTextContent(); else if(name.equals("keystore-password")) ksPW = cn.getTextContent(); else if(name.equals("key-alias")) kAlias = cn.getTextContent(); else if(name.equals("private-key-password")) pkPW = cn.getTextContent(); else if(name.equals("keystore-uri")) ksURI = cn.getTextContent(); } // initialize the keystore KeyStore ks = null; try { ks = KeyStore.getInstance(ksTY); } catch(final KeyStoreException ex) { CX_KSNULL.thrw(info, ex); } ks.load(new FileInputStream(ksURI), ksPW.toCharArray()); pk = (PrivateKey) ks.getKey(kAlias, pkPW.toCharArray()); final X509Certificate x509ce = (X509Certificate) ks.getCertificate(kAlias); if(x509ce == null) CX_ALINV.thrw(info, kAlias); puk = x509ce.getPublicKey(); final KeyInfoFactory kifactory = fac.getKeyInfoFactory(); final KeyValue keyValue = kifactory.newKeyValue(puk); final Vector kiCont = new Vector(); kiCont.add(keyValue); final List x509Content = new ArrayList(); final X509IssuerSerial issuer = kifactory.newX509IssuerSerial(x509ce. getIssuerX500Principal().getName(), x509ce.getSerialNumber()); x509Content.add(x509ce.getSubjectX500Principal().getName()); x509Content.add(issuer); x509Content.add(x509ce); final X509Data x509Data = kifactory.newX509Data(x509Content); kiCont.add(x509Data); ki = kifactory.newKeyInfo(kiCont); // auto-generate keys if no certificate is provided } else { final KeyPairGenerator gen = KeyPairGenerator.getInstance(keytype); gen.initialize(512); final KeyPair kp = gen.generateKeyPair(); final KeyInfoFactory kif = fac.getKeyInfoFactory(); final KeyValue kv = kif.newKeyValue(kp.getPublic()); ki = kif.newKeyInfo(Collections.singletonList(kv)); pk = kp.getPrivate(); } final Document inputNode = toDOMNode(node); final List tfList; // validating a given XPath expression to get nodes to be signed if(expr.length > 0) { final XPathFactory xpf = XPathFactory.newInstance(); final XPathExpression xExpr = xpf.newXPath().compile(string(expr)); final NodeList xRes = (NodeList) xExpr.evaluate(inputNode, XPathConstants.NODESET); if(xRes.getLength() < 1) CX_XPINV.thrw(info, expr); tfList = new ArrayList(2); tfList.add(fac.newTransform(Transform.XPATH, new XPathFilterParameterSpec(string(expr)))); tfList.add(fac.newTransform(Transform.ENVELOPED, (TransformParameterSpec) null)); } else { tfList = Collections.singletonList(fac.newTransform( Transform.ENVELOPED, (TransformParameterSpec) null)); } // creating reference element final Reference ref = fac.newReference("", fac.newDigestMethod(digest, null), tfList, null, null); // creating signed info element final SignedInfo si = fac.newSignedInfo(fac.newCanonicalizationMethod( canonicalization, (C14NMethodParameterSpec) null), fac.newSignatureMethod(signature, null), Collections.singletonList(ref)); // prepare document signature final DOMSignContext signContext; final XMLSignature xmlSig; // enveloped signature if(eq(type, DEFT)) { signContext = new DOMSignContext(pk, inputNode.getDocumentElement()); xmlSig = fac.newXMLSignature(si, ki); // detached signature // } else if(eq(type, DETT)) { // final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); // dbf.setNamespaceAware(true); // inputNode = dbf.newDocumentBuilder().newDocument(); // signContext = new DOMSignContext(pk, inputNode); // xmlSig = fac.newXMLSignature(si, ki); // enveloping signature } else { final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); final XMLStructure cont = new DOMStructure(inputNode.getDocumentElement()); final XMLObject obj = fac.newXMLObject(Collections.singletonList(cont), "", null, null); xmlSig = fac.newXMLSignature(si, ki, Collections.singletonList(obj), null, null); signContext = new DOMSignContext(pk, inputNode); } // set Signature element namespace prefix, if given if(ns.length > 0) signContext.setDefaultNamespacePrefix(string(ns)); // actually sign the document xmlSig.sign(signContext); signedNode = NodeType.DOC.cast(inputNode, ctx, ii); } catch(final XPathExpressionException e) { CX_XPINV.thrw(info, e); } catch(final SAXException e) { CX_IOEXC.thrw(info, e); } catch(final IOException e) { CX_IOEXC.thrw(info, e); } catch(final ParserConfigurationException e) { CX_IOEXC.thrw(info, e); } catch(final KeyStoreException e) { CX_KSEXC.thrw(info, e); } catch(final MarshalException e) { CX_SIGEXC.thrw(info, e); } catch(final XMLSignatureException e) { CX_SIGEXC.thrw(info, e); } catch(final NoSuchAlgorithmException e) { CX_ALGEXC.thrw(info, e); } catch(final CertificateException e) { CX_ALGEXC.thrw(info, e); } catch(final UnrecoverableKeyException e) { CX_NOKEY.thrw(info, e); } catch(final KeyException e) { CX_NOKEY.thrw(info, e); } catch(final InvalidAlgorithmParameterException e) { CX_ALGEXC.thrw(info, e); } return signedNode; } /** * Validates a signature. * @param node input node * * @return true if signature valid * @throws QueryException query exception */ public Item validateSignature(final ANode node) throws QueryException { boolean coreVal = false; try { final Document doc = toDOMNode(node); final DOMValidateContext valContext = new DOMValidateContext(new MyKeySelector(), doc); final NodeList signl = doc.getElementsByTagNameNS(XMLSignature.XMLNS, "Signature"); if(signl.getLength() < 1) CX_NOSIG.thrw(info, node); valContext.setNode(signl.item(0)); final XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM"); final XMLSignature signature = fac.unmarshalXMLSignature(valContext); coreVal = signature.validate(valContext); } catch(final XMLSignatureException e) { CX_IOEXC.thrw(info, e); } catch(final SAXException e) { CX_IOEXC.thrw(info, e); } catch(final ParserConfigurationException e) { CX_IOEXC.thrw(info, e); } catch(final IOException e) { CX_IOEXC.thrw(info, e); } catch(final MarshalException e) { CX_SIGEXC.thrw(info, e); } return Bln.get(coreVal); } /** * Serializes the given XML node to a byte array. * @param n node to be serialized * @return byte array containing XML * @throws IOException exception */ private static byte[] nodeToBytes(final ANode n) throws IOException { final ArrayOutput ao = new ArrayOutput(); final Serializer ser = Serializer.get(ao, new SerializerProp("format=no")); ser.serialize(n); ser.close(); return ao.toArray(); } /** * Creates a DOM node for the given input node. * @param n node * @return DOM node representation of input node * @throws SAXException exception * @throws IOException exception * @throws ParserConfigurationException exception */ private static Document toDOMNode(final ANode n) throws SAXException, IOException, ParserConfigurationException { final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); return dbf.newDocumentBuilder().parse(new ByteArrayInputStream(nodeToBytes(n))); } }basex-7.7.2/basex-core/src/main/java/org/basex/query/util/crypto/Encryption.java000066400000000000000000000153261222453003200276450ustar00rootroot00000000000000package org.basex.query.util.crypto; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.security.*; import javax.crypto.*; import javax.crypto.spec.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.util.*; import org.basex.util.hash.*; /** * This class encrypts and decrypts textual inputs. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class Encryption { /** Input info. */ private final InputInfo info; /** Token. */ private static final byte[] SYM = token("symmetric"); /** Token. */ private static final byte[] BASE64 = token("base64"); /** Token. */ private static final byte[] HEX = token("hex"); /** Supported encryption algorithms, mapped to correct IV lengths. */ private static final TokenMap ALGE = new TokenMap(); /** Exact encryption algorithm JAVA names. */ private static final TokenMap ALGN = new TokenMap(); /** Supported HMAC algorithms. */ private static final TokenMap ALGHMAC = new TokenMap(); /** Default hash algorithm. */ private static final byte[] DEFA = token("md5"); /** DES encryption token. */ private static final byte[] DES = token("des"); static { ALGE.put("des", "8"); ALGE.put("aes", "16"); ALGN.put("des", "DES/CBC/PKCS5Padding"); ALGN.put("aes", "AES/CBC/PKCS5Padding"); ALGHMAC.put("md5", "hmacmd5"); ALGHMAC.put("sha1", "hmacsha1"); ALGHMAC.put("sha256", "hmacsha256"); ALGHMAC.put("sha384", "hmacsha1"); ALGHMAC.put("sha512", "hmacsha512"); } /** * Constructor. * * @param ii input info */ public Encryption(final InputInfo ii) { info = ii; } /** * Encrypts or decrypts the given input. * @param in input * @param s encryption type * @param k secret key * @param a encryption algorithm * @param ec encrypt or decrypt * @return encrypted or decrypted input * @throws QueryException query exception */ public Str encryption(final byte[] in, final byte[] s, final byte[] k, final byte[] a, final boolean ec) throws QueryException { final boolean symmetric = eq(lc(s), SYM) || s.length == 0; final byte[] aa = a.length == 0 ? DES : a; final byte[] tivl = ALGE.get(lc(aa)); if(!symmetric) CX_ENCTYP.thrw(info, ec); if(tivl == null) CX_INVALGO.thrw(info, s); // initialization vector length final int ivl = toInt(tivl); byte[] t = null; try { if(ec) t = encrypt(in, k, aa, ivl); else t = decrypt(in, k, aa, ivl); } catch(final NoSuchPaddingException e) { CX_NOPAD.thrw(info, e); } catch(final BadPaddingException e) { CX_BADPAD.thrw(info, e); } catch(final NoSuchAlgorithmException e) { CX_INVALGO.thrw(info, e); } catch(final InvalidKeyException e) { CX_KEYINV.thrw(info, e); } catch(final IllegalBlockSizeException e) { CX_ILLBLO.thrw(info, e); } catch(final InvalidAlgorithmParameterException e) { CX_INVALGO.thrw(info, e); } return Str.get(t); } /** * Encrypts the given input data. * * @param in input data to encrypt * @param k key * @param a encryption algorithm * @param ivl initialization vector length * @return encrypted input data * @throws InvalidKeyException ex * @throws InvalidAlgorithmParameterException ex * @throws NoSuchAlgorithmException ex * @throws NoSuchPaddingException ex * @throws IllegalBlockSizeException ex * @throws BadPaddingException ex */ static byte[] encrypt(final byte[] in, final byte[] k, final byte[] a, final int ivl) throws InvalidKeyException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException { final Cipher cipher = Cipher.getInstance(string(ALGN.get(lc(a)))); final SecretKeySpec kspec = new SecretKeySpec(k, string(a)); // generate random iv. random iv is necessary to make the encryption of a // string look different every time it is encrypted. final byte[] iv = new byte[ivl]; // create new random iv if encrypting final SecureRandom rand = SecureRandom.getInstance("SHA1PRNG"); rand.nextBytes(iv); final IvParameterSpec ivspec = new IvParameterSpec(iv); // encrypt/decrypt cipher.init(Cipher.ENCRYPT_MODE, kspec, ivspec); final byte[] t = cipher.doFinal(in); // initialization vector is appended to the message for later decryption return concat(iv, t); } /** * Decrypts the given input data. * * @param in data to decrypt * @param k secret key * @param a encryption algorithm * @param ivl initialization vector length * @return decrypted data * @throws NoSuchAlgorithmException ex * @throws NoSuchPaddingException ex * @throws InvalidKeyException ex * @throws InvalidAlgorithmParameterException ex * @throws IllegalBlockSizeException ex * @throws BadPaddingException ex */ static byte[] decrypt(final byte[] in, final byte[] k, final byte[] a, final int ivl) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException { final SecretKeySpec keySpec = new SecretKeySpec(k, string(a)); final Cipher cipher = Cipher.getInstance(string(ALGN.get(lc(a)))); // extract iv from message beginning final byte[] iv = substring(in, 0, ivl); final IvParameterSpec ivspec = new IvParameterSpec(iv); cipher.init(Cipher.DECRYPT_MODE, keySpec, ivspec); return cipher.doFinal(substring(in, ivl, in.length)); } /** * Creates a message authentication code (MAC) for the given input. * @param msg input * @param k secret key * @param a encryption algorithm * @param enc encoding * @return MAC * @throws QueryException query exception */ public Item hmac(final byte[] msg, final byte[] k, final byte[] a, final byte[] enc) throws QueryException { // create hash value from input message final Key key = new SecretKeySpec(k, string(a)); final byte[] aa = a.length == 0 ? DEFA : a; if(!ALGHMAC.contains(lc(aa))) CX_INVHASH.thrw(info, aa); final boolean b64 = eq(lc(enc), BASE64) || enc.length == 0; if(!b64 && !eq(lc(enc), HEX)) CX_ENC.thrw(info, enc); try { final Mac mac = Mac.getInstance(string(ALGHMAC.get(lc(aa)))); mac.init(key); final byte[] hash = mac.doFinal(msg); // convert to specified encoding, base64 as a standard, else use hex return Str.get(b64 ? Base64.encode(hash) : hex(hash, true)); } catch(final NoSuchAlgorithmException e) { throw CX_INVHASH.thrw(info, e); } catch(final InvalidKeyException e) { throw CX_KEYINV.thrw(info, e); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/crypto/MyKeySelector.java000066400000000000000000000042621222453003200302470ustar00rootroot00000000000000package org.basex.query.util.crypto; import java.security.*; import java.util.*; import javax.security.cert.*; import javax.xml.crypto.*; import javax.xml.crypto.dsig.*; import javax.xml.crypto.dsig.keyinfo.*; /** * Extracts a key from a given {@link KeyInfo} object. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ class MyKeySelector extends KeySelector { /** * Wrapper for KeySelector results. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ private static class MyKeySelectorResult implements KeySelectorResult { /** Key. */ private final Key pk; @Override public Key getKey() { return pk; } /** * Constructor. * @param key key */ MyKeySelectorResult(final PublicKey key) { pk = key; } } @Override public KeySelectorResult select(final KeyInfo ki, final Purpose p, final AlgorithmMethod m, final XMLCryptoContext c) throws KeySelectorException { if(ki == null) throw new KeySelectorException("KeyInfo is null"); final SignatureMethod sm = (SignatureMethod) m; @SuppressWarnings("unchecked") final List list = ki.getContent(); for(final Object l : list) { final XMLStructure s = (XMLStructure) l; PublicKey pk = null; if(s instanceof KeyValue) { try { pk = ((KeyValue) s).getPublicKey(); } catch(final KeyException ke) { throw new KeySelectorException(ke); } } else if(s instanceof X509Data) { for(final Object d : ((X509Data) s).getContent()) if(d instanceof X509Certificate) pk = ((X509Certificate) d).getPublicKey(); } if(pk != null) { final String sa = sm.getAlgorithm(); final String ka = pk.getAlgorithm(); if(ka.equalsIgnoreCase("DSA") && sa.equalsIgnoreCase( "http://www.w3.org/2000/09/xmldsig#dsa-sha1") || ka.equalsIgnoreCase("RSA") && sa.equalsIgnoreCase( "http://www.w3.org/2000/09/xmldsig#rsa-sha1")) return new MyKeySelectorResult(pk); } } throw new KeySelectorException("No KeyValue element found"); } }basex-7.7.2/basex-core/src/main/java/org/basex/query/util/csv/000077500000000000000000000000001222453003200241145ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/util/csv/CsvParser.java000066400000000000000000000066541222453003200267020ustar00rootroot00000000000000package org.basex.query.util.csv; import static org.basex.util.Token.*; import java.io.*; import org.basex.build.file.*; import org.basex.io.*; import org.basex.io.in.*; import org.basex.query.value.node.*; import org.basex.util.*; import org.basex.util.list.*; /** *

This class converts CSV input to XML.

* * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class CsvParser { /** CSV element. */ private static final byte[] CSV = token("csv"); /** CSV element. */ private static final byte[] RECORD = token("record"); /** CSV element. */ private static final byte[] ENTRY = token("entry"); /** Column separator (see {@link ParserProp#SEPARATOR}). */ private final int separator; /** Root node. */ private final FElem root = new FElem(CSV); /** Record. */ private FElem record; /** Headers. */ private final TokenList headers = new TokenList(); /** Header flag. */ private boolean header; /** Current column. */ private int col; /** * Constructor. * @param sep separator character * @param head header flag */ public CsvParser(final int sep, final boolean head) { separator = sep; header = head; } /** * Converts the specified input to an XML element. * @param input CSV input * @return node * @throws IOException I/O exception */ public FElem convert(final byte[] input) throws IOException { return convert(new NewlineInput(new IOContent(input))); } /** * Converts the specified input stream to an XML element. * @param input CSV input * @return node * @throws IOException I/O exception */ public FElem convert(final NewlineInput input) throws IOException { final TokenBuilder data = new TokenBuilder(); boolean quoted = false, open = true; int ch = -1; try { while(true) { if(ch == -1) ch = input.read(); if(ch == -1) break; if(quoted) { if(ch == '"') { ch = input.read(); if(ch != '"') { quoted = false; continue; } } data.add(ch); } else if(ch == separator) { if(open) { newRecord(); open = false; } newEntry(data); } else if(ch == '\n') { finish(data, open); open = true; } else if(ch == '"') { quoted = true; } else { data.add(XMLToken.valid(ch) ? ch : '?'); } ch = -1; } } finally { input.close(); } finish(data, open); return root; } /** * Creates a new record. */ private void newRecord() { if(header) return; record = new FElem(RECORD); root.add(record); } /** * Finishes the current record. * @param entry current entry * @param open open flag */ private void finish(final TokenBuilder entry, final boolean open) { if(open && !entry.isEmpty()) newRecord(); if(!entry.isEmpty()) newEntry(entry); header = false; col = 0; } /** * Adds an entry. * @param entry current entry */ private void newEntry(final TokenBuilder entry) { if(header) { // add header headers.add(XMLToken.encode(entry.finish())); entry.reset(); } else { byte[] tag = headers.get(col); if(tag == null) tag = ENTRY; if(record != null) record.add(new FElem(tag).add(entry.finish())); entry.reset(); ++col; } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/format/000077500000000000000000000000001222453003200246115ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/util/format/DateFormat.java000066400000000000000000000034641222453003200275110ustar00rootroot00000000000000package org.basex.query.util.format; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.util.regex.*; import org.basex.query.*; import org.basex.util.*; /** * Parser for formatting integers in dates and times. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DateFormat extends FormatParser { /** With pattern: "," min-width ("-" max-width)?. */ private static final Pattern WIDTH = Pattern.compile("^(\\*|\\d+)(-(\\*|\\d+))?$"); /** * Constructor. * @param pic variable marker (info picture) * @param df default presentation modifier * @param ii input info * @throws QueryException query exception */ public DateFormat(final byte[] pic, final byte[] df, final InputInfo ii) throws QueryException { super(ii); // split variable marker final int comma = lastIndexOf(pic, ','); byte[] pres = comma == -1 ? pic : substring(pic, 0, comma); // extract second presentation modifier final int pl = pres.length; if(pl > 1) { final int p = pres[pl - 1]; if(p == 'a' || p == 'c' || p == 'o' || p == 't') { pres = substring(pres, 0, pl - 1); if(p == 'o') ordinal = EMPTY; if(p == 't') trad = true; } } // choose first character and case finish(pres.length == 0 ? df : presentation(pres, df, true)); // check width modifier final byte[] width = comma == -1 ? null : substring(pic, comma + 1); if(width != null) { final Matcher m = WIDTH.matcher(string(width)); if(!m.find()) PICDATE.thrw(ii, width); int i = toInt(m.group(1)); if(i != Integer.MIN_VALUE) min = i; final String mc = m.group(3); i = mc != null ? toInt(mc) : Integer.MIN_VALUE; if(i != Integer.MIN_VALUE) max = i; } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/format/DateParser.java000066400000000000000000000027351222453003200275150ustar00rootroot00000000000000package org.basex.query.util.format; import static org.basex.query.util.Err.*; import org.basex.query.*; import org.basex.util.*; /** * Parser for formatting dates. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class DateParser extends TokenParser { /** Input information. */ private final InputInfo info; /** * Constructor. * @param ii input info * @param p picture */ DateParser(final InputInfo ii, final byte[] p) { super(p); info = ii; } /** * Returns the next literal and advances the cursor. * @return current literal, or {@code -1} * @throws QueryException query exception */ int literal() throws QueryException { final int ch = next(); if(ch == '[') { // check begin of variable marker if(!more()) PICDATE.thrw(info, token); // [$ if(!consume(ch)) return -1; // [... } else if(ch == ']') { // check end of variable marker if(!consume(ch)) PICDATE.thrw(info, token); // ]$ or ]... } return ch; } /** * Returns the next marker. * @return marker or {@code null} reference * @throws QueryException query exception */ byte[] marker() throws QueryException { final TokenBuilder tb = new TokenBuilder(); while(more()) { final int ch = next(); if(ch == ']') return tb.finish(); if(!Character.isWhitespace(ch)) tb.add(ch); } throw PICDATE.thrw(info, token); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/format/DecFormatter.java000066400000000000000000000270231222453003200300370ustar00rootroot00000000000000package org.basex.query.util.format; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.func.*; import org.basex.query.value.item.*; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * Formatter for decimal numbers. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DecFormatter extends FormatUtil { /** Decimal-digit-family (mandatory-digit-sign). */ public final byte[] digits; /** Active characters. */ private final byte[] active; /** Zero digit sign. */ private final int zero; /** Infinity. */ private byte[] inf = token("Infinity"); /** NaN. */ private byte[] nan = token("NaN"); /** Pattern-separator sign. */ private int pattern = ';'; /** Decimal-separator sign. */ private int decimal = '.'; /** Grouping-separator sign. */ private int grouping = ','; /** Optional-digit sign. */ private int optional = '#'; /** Minus sign. */ private int minus = '-'; /** Percent sign. */ private int percent = '%'; /** Permille sign. */ private int permille = '\u2030'; /** * Default constructor. * @throws QueryException query exception */ public DecFormatter() throws QueryException { this(null, null); } /** * Constructor. * @param ii input info * @param map decimal format * @throws QueryException query exception */ public DecFormatter(final InputInfo ii, final TokenMap map) throws QueryException { // assign map values int z = '0'; if(map != null) { for(final byte[] key : map) { final String k = string(key); final byte[] v = map.get(key); if(k.equals(DF_INF)) { inf = v; } else if(k.equals(DF_NAN)) { nan = v; } else if(v.length != 0 && cl(v, 0) == v.length) { final int cp = cp(v, 0); if(k.equals(DF_DEC)) decimal = cp; else if(k.equals(DF_GRP)) grouping = cp; else if(k.equals(DF_PAT)) pattern = cp; else if(k.equals(DF_MIN)) minus = cp; else if(k.equals(DF_DIG)) optional = cp; else if(k.equals(DF_PC)) percent = cp; else if(k.equals(DF_PM)) permille = cp; else if(k.equals(DF_ZG)) { z = zeroes(cp); if(z == -1) INVDECFORM.thrw(ii, k, v); if(z != cp) INVDECZERO.thrw(ii, (char) cp); } } else { // signs must have single character INVDECSINGLE.thrw(ii, k, v); } } } // check for duplicate characters zero = z; final IntSet is = new IntSet(); final int[] ss = { decimal, grouping, percent, permille, zero, optional, pattern }; for(final int s : ss) if(!is.add(s)) DUPLDECFORM.thrw(ii, (char) s); // create auxiliary strings final TokenBuilder tb = new TokenBuilder(); for(int i = 0; i < 10; i++) tb.add(zero + i); digits = tb.finish(); active = tb.add(decimal).add(grouping).add(optional).finish(); } /** * Returns a formatted number. * @param ii input info * @param number number to be formatted * @param pict picture * @return string representation * @throws QueryException query exception */ public byte[] format(final InputInfo ii, final Item number, final byte[] pict) throws QueryException { // find pattern separator and sub-patterns final TokenList tl = new TokenList(); byte[] pic = pict; final int i = indexOf(pic, pattern); if(i == -1) { tl.add(pic); } else { tl.add(substring(pic, 0, i)); pic = substring(pic, i + cl(pic, i)); if(contains(pic, pattern)) PICNUM.thrw(ii, pict); tl.add(pic); } final byte[][] patterns = tl.toArray(); // check and analyze patterns if(!check(patterns)) PICNUM.thrw(ii, pict); final Picture[] pics = analyze(patterns); // return formatted string return format(number, pics, ii); } /** * Checks the syntax of the specified patterns. * @param patterns patterns * @return result of check */ private boolean check(final byte[][] patterns) { for(final byte[] pt : patterns) { boolean frac = false, pas = false, act = false; boolean dg = false, opt1 = false, opt2 = false; int cl, pc = 0, pm = 0, ls = 0; // loop through all characters for(int i = 0; i < pt.length; i += cl) { final int ch = ch(pt, i); cl = cl(pt, i); final boolean a = contains(active, ch); if(ch == decimal) { // more than 1 decimal sign? if(frac) return false; frac = true; } else if(ch == grouping) { // adjacent decimal sign? if(i == 0 && frac || ls == decimal || i + cl < pt.length ? ch(pt, i + cl) == decimal : !frac) return false; } else if(ch == percent) { if(++pc > 1) return false; } else if(ch == permille) { if(++pm > 1) return false; } else if(ch == optional) { if(!frac) { // integer part, and optional sign after digit? if(dg) return false; opt1 = true; } else { opt2 = true; } } else if(contains(digits, ch)) { // fractional part, and digit after optional sign? if(frac && opt2) return false; dg = true; } // passive character with preceding and following active character? if(a && pas && act) return false; // will be assigned if active characters were found if(act) pas |= !a; act |= a; // cache last character ls = ch; } // more than 1 percent and permille sign? if(pc + pm > 1) return false; // no optional sign or digit? if(!opt1 && !opt2 && !dg) return false; } return true; } /** * Analyzes the specified patterns. * @param patterns patterns * @return picture variables */ private Picture[] analyze(final byte[][] patterns) { // pictures final Picture[] pics = new Picture[patterns.length]; // analyze patterns for(int s = 0; s < patterns.length; ++s) { final byte[] pt = patterns[s]; final Picture pic = new Picture(); // position (integer/fractional) int p = 0; // active character found boolean act = false; // number of optional characters final int[] opt = new int[2]; // loop through all characters for(int i = 0; i < pt.length; i += cl(pt, i)) { final int ch = ch(pt, i); final boolean a = contains(active, ch); if(ch == decimal) { ++p; act = false; } else if(ch == optional) { opt[p]++; } else if(ch == grouping) { if(p == 0) { pic.group[p] = Array.add(pic.group[p], pic.min[p] + opt[p]); } } else if(contains(digits, ch)) { pic.min[p]++; } else { // passive characters pic.pc |= ch == percent; pic.pm |= ch == permille; // prefixes/suffixes pic.fix[p == 0 && act ? p + 1 : p].add(ch); } act |= a; } // finalize integer-part-grouping-positions final int[] igp = pic.group[0]; final int igl = igp.length; for(int g = 0; g < igl; ++g) igp[g] = pic.min[0] + opt[0] - igp[g]; // check if integer-part-grouping-positions are regular // if yes, they are replaced with a single position if(igl > 1) { boolean reg = true; final int i = igp[igl - 1]; for(int g = igl - 2; g >= 0; --g) reg &= i * igl == igp[g]; if(reg) pic.group[0] = new int[] { i }; } pic.maxFrac = pic.min[1] + opt[1]; pics[s] = pic; } return pics; } /** * Formats the specified number and returns a string representation. * @param it item * @param pics pictures * @param ii input info * @return picture variables * @throws QueryException query exception */ private byte[] format(final Item it, final Picture[] pics, final InputInfo ii) throws QueryException { // return results for NaN final double d = it.dbl(ii); if(Double.isNaN(d)) return nan; // return infinite results final boolean neg = d < 0 || d == 0 && Double.doubleToLongBits(d) == Long.MIN_VALUE; final Picture pic = pics[neg && pics.length == 2 ? 1 : 0]; final TokenBuilder res = new TokenBuilder(); final TokenBuilder intgr = new TokenBuilder(); final TokenBuilder fract = new TokenBuilder(); if(d == Double.POSITIVE_INFINITY || d == Double.NEGATIVE_INFINITY) { intgr.add(inf); } else { // convert and round number Item num = it; if(pic.pc) num = Calc.MULT.ev(ii, num, Int.get(100)); if(pic.pm) num = Calc.MULT.ev(ii, num, Int.get(1000)); num = FNNum.abs(FNNum.round(num, num.dbl(ii), pic.maxFrac, true, ii), ii); // convert positive number to string, chop leading zero final String s = (num instanceof Dbl || num instanceof Flt ? Dec.get(num.dbl(ii)) : num).toString(); // integer/fractional separator final int sep = s.indexOf('.'); // create integer part final int sl = s.length(); final int il = sep == -1 ? sl : sep; for(int i = il; i < pic.min[0]; ++i) intgr.add(zero); for(int i = 0; i < il; i++) intgr.add(zero + s.charAt(i) - '0'); // squeeze in grouping separators if(pic.group[0].length == 1) { // regular pattern with repeating separators final int pos = pic.group[0][0]; for(int p = intgr.size() - (neg ? 2 : 1); p > 0; --p) { if(p % pos == 0) intgr.insert(intgr.size() - p, grouping); } } else { // irregular pattern, or no separators at all for(int i = 0; i < pic.group[0].length; ++i) { final int pos = intgr.size() - pic.group[0][i]; if(pos > 0) intgr.insert(pos, grouping); } } // create fractional part final int fl = sep == -1 ? 0 : sl - il - 1; if(fl != 0) for(int i = sep + 1; i < sl; i++) fract.add(zero + s.charAt(i) - '0'); for(int i = fl; i < pic.min[1]; ++i) fract.add(zero); // squeeze in grouping separators in a reverse manner final int ul = fract.size(); for(int p = pic.group[1].length - 1; p >= 0; p--) { final int pos = pic.group[1][p]; if(pos < ul) fract.insert(pos, grouping); } } // add minus sign if(neg && pics.length != 2) res.add(minus); // add prefix and integer part res.add(pic.fix[0].finish()).add(intgr.finish()); // add fractional part if(!fract.isEmpty()) res.add(decimal).add(fract.finish()); // add suffix return res.add(pic.fix[1].finish()).finish(); } /** Picture variables. */ static final class Picture { /** Prefix/suffix. */ final TokenBuilder[] fix = { new TokenBuilder(), new TokenBuilder() }; /** Integer/fractional-part-grouping-positions. */ final int[][] group = { {}, {} }; /** Minimum-integer/fractional-part-size. */ final int[] min = { 0, 0 }; /** Maximum-fractional-part-size. */ int maxFrac; /** Percent flag. */ boolean pc; /** Per-mille flag. */ boolean pm; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/format/FormatParser.java000066400000000000000000000070641222453003200300700ustar00rootroot00000000000000package org.basex.query.util.format; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import org.basex.query.*; import org.basex.util.*; /** * Format parser for integers and dates. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class FormatParser extends FormatUtil { /** Input information. */ protected final InputInfo info; /** Case. */ Case cs; /** Primary format token. */ byte[] primary; /** First character of format token, or mandatory digit. */ int first = -1; /** Ordinal suffix; {@code null} if not specified. */ byte[] ordinal; /** Traditional modifier. */ boolean trad; /** Minimum width. */ int min; /** Maximum width. */ int max = Integer.MAX_VALUE; /** * Constructor for formatting integers. * @param ii input info */ protected FormatParser(final InputInfo ii) { info = ii; } /** * Parses and returns the presentation modifier. * @param pic picture * @param def default token * @param date date flag * @return presentation modifier * @throws QueryException query exception */ protected byte[] presentation(final byte[] pic, final byte[] def, final boolean date) throws QueryException { // find primary format final TokenParser tp = new TokenParser(pic); int ch = tp.next(); // check single character if(!tp.more()) { // Latin, Greek and other alphabets if(sequence(ch) != null || // Roman sequences (lower/upper case) ch == 'i' || ch == 'I' || // Word output (lower/upper case) ch == 'w' || ch == 'W' || // Textual output date && (ch == 'n' || ch == 'N') || // circled, parenthesized or full stop digits ch == '\u2460' || ch == '\u2474' || ch == '\u2488' || // Japanese numbering ch == KANJI[1]) return pic; } else { // Word output (title case) if(ch == 'W' && tp.consume('w')) return pic; // Textual output (title case) if(date && ch == 'N' && tp.consume('n')) return pic; } // find digit of decimal-digit-pattern tp.reset(); while(first == -1 && tp.more()) first = zeroes(tp.next()); // no digit found: return default primary token if(first == -1) return def; // flags for mandatory-digit-sign and group-separator-sign boolean mds = false, gss = true; tp.reset(); while(tp.more()) { ch = tp.next(); final int d = zeroes(ch); if(d != -1) { // mandatory-digit-sign if(first != d) DIFFMAND.thrw(info, pic); mds = true; gss = false; } else if(ch == '#') { // optional-digit-sign if(mds) OPTAFTER.thrw(info, pic); gss = false; } else if(!Character.isLetter(ch)) { // grouping-separator-sign if(gss) INVGROUP.thrw(info, pic); gss = true; } else { // any other letter: return default primary token INVDDPATTERN.thrw(info, pic); } } if(gss) INVGROUP.thrw(info, pic); return pic; } /** * Finishes format parsing. * @param pres presentation string */ protected void finish(final byte[] pres) { // skip correction of case if modifier has more than one codepoint (Ww) final int cp = ch(pres, 0); cs = cl(pres, 0) < pres.length || digit(cp) ? Case.STANDARD : (cp & ' ') == 0 ? Case.UPPER : Case.LOWER; primary = lc(pres); if(first == -1) first = ch(primary, 0); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/format/FormatUtil.java000066400000000000000000000121431222453003200275430ustar00rootroot00000000000000package org.basex.query.util.format; import static org.basex.util.Token.*; /** * This class assembles methods and variables that are used by more than one * formatter class. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ abstract class FormatUtil { /** Zero digits, Unicode Category Nd. */ private static final int[] ZEROES = { 0x30, 0x660, 0x6F0, 0x7C0, 0x966, 0x9E6, 0xA66, 0xAE6, 0xB66, 0xBE6, 0xC66, 0xCE6, 0xD66, 0xE50, 0xED0, 0xF20, 0x1040, 0x1090, 0x17E0, 0x1810, 0x1946, 0x19D0, 0x1A80, 0x1A90, 0x1B50, 0x1BB0, 0x1C40, 0x1C50, 0xA620, 0xA8D0, 0xA900, 0xA9D0, 0xAA50, 0xABF0, 0xFF10, 0x104A0, 0x11066, 0x1D7CE, 0x1D7D8, 0x1D7E2, 0x1D7EC, 0x1D7F6 }; /** Kanji digits. */ static final int[] KANJI = { 0x3007, 0x4e00, 0x4e8c, 0x4e09, 0x56db, 0x4e94, 0x516d, 0x4e03, 0x516b, 0x4e5d, 0x5341, 0x767E, 0x5343, 0x4e07, 0x5104, 0x5146 }; /** Roman numbers (1-10). */ static final byte[][] ROMANI = tokens("", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"); /** Roman numbers (10-100). */ static final byte[][] ROMANX = tokens("", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"); /** Roman numbers (100-1000). */ static final byte[][] ROMANC = tokens("", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"); /** Roman numbers (1000-3000). */ static final byte[][] ROMANM = tokens("", "M", "MM", "MMM"); /** Alphabet sequences. */ private static final String[] SEQS = { // Latin numbering "abcdefghijklmnopqrstuvwxyz", // Latin numbering (upper case) "ABCDEFGHIJKLMNOPQRSTUVWXYZ", // Greek numbering "\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba" + "\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4" + "\u03c5\u03c6\u03c7\u03c8\u03c9", // Greek numbering (upper case) "\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a" + "\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a2\u03a3\u03a4" + "\u03a5\u03a6\u03a7\u03a8\u03a9", // Hebrew numbering "\u05d0\u05d1\u05d2\u05d3\u05d4\u05d5\u05d6\u05d7\u05d8\u05d9\u05db" + "\u05dc\u05de\u05e0\u05e1\u05e2\u05e4\u05e6\u05e7\u05e8\u05e9\u05ea", // Cyrillic numbering, based on Dmitry Kirsanov's sequence in Saxon. "\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u043a" + "\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0441\u0443\u0444" + "\u0445\u0446\u0447\u0448\u0449\u044b\u044d\u044e\u044f", // Cyrillic numbering (upper case). "\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u041a" + "\u041b\u041c\u041d\u041e\u041f\u0420\u0421\u0421\u0423\u0424" + "\u0425\u0426\u0427\u0428\u0429\u042b\u042d\u042e\u042f", // Hiragana A numbering, based on Murakami Shinyu's sequences in Saxon. "\u3042\u3044\u3046\u3048\u304a\u304b\u304d\u304f\u3051\u3053" + "\u3055\u3057\u3059\u305b\u305d\u305f\u3061\u3064\u3066\u3068" + "\u306a\u306b\u306c\u306d\u306e\u306f\u3072\u3075\u3078\u307b" + "\u307e\u307f\u3080\u3081\u3082\u3084\u3086\u3088\u3089\u308a" + "\u308b\u308c\u308d\u308f\u3092\u3093", // Katakana A numbering. "\u30a2\u30a4\u30a6\u30a8\u30aa\u30ab\u30ad\u30af\u30b1\u30b3" + "\u30b5\u30b7\u30b9\u30bb\u30bd\u30bf\u30c1\u30c4\u30c6\u30c8" + "\u30ca\u30cb\u30cc\u30cd\u30ce\u30cf\u30d2\u30d5\u30d8\u30db" + "\u30de\u30df\u30e0\u30e1\u30e2\u30e4\u30e6\u30e8\u30e9\u30ea" + "\u30eb\u30ec\u30ed\u30ef\u30f2\u30f3", // Hiragana I numbering. "\u3044\u308d\u306f\u306b\u307b\u3078\u3068\u3061\u308a\u306c" + "\u308b\u3092\u308f\u304b\u3088\u305f\u308c\u305d\u3064\u306d" + "\u306a\u3089\u3080\u3046\u3090\u306e\u304a\u304f\u3084\u307e" + "\u3051\u3075\u3053\u3048\u3066\u3042\u3055\u304d\u3086\u3081" + "\u307f\u3057\u3091\u3072\u3082\u305b\u3059", // Katakana I numbering. "\u30a4\u30ed\u30cf\u30cb\u30db\u30d8\u30c8\u30c1\u30ea\u30cc" + "\u30eb\u30f2\u30ef\u30ab\u30e8\u30bf\u30ec\u30bd\u30c4\u30cd" + "\u30ca\u30e9\u30e0\u30a6\u30f0\u30ce\u30aa\u30af\u30e4\u30de" + "\u30b1\u30d5\u30b3\u30a8\u30c6\u30a2\u30b5\u30ad\u30e6\u30e1" + "\u30df\u30b7\u30f1\u30d2\u30e2\u30bb\u30b9" }; /** * Returns a character sequence the first character of which equals the * specified character. * @param ch character to be checked * @return character sequence, or {@code null} */ static String sequence(final int ch) { for(final String seq : SEQS) if(ch == seq.charAt(0)) return seq; return null; } /** Cases. */ protected enum Case { /** Lower case. */ LOWER, /** Upper case. */ UPPER, /** Standard. */ STANDARD } /** * Returns the zero base for the specified code point, or {@code -1}. * @param ch character * @return zero base */ static int zeroes(final int ch) { for(final int z : ZEROES) if(ch >= z && ch <= z + 9) return z; return -1; } /** * Returns the character at the specified position, or {@code 0} if the * specified position is outside the string range. * @param in input * @param pos position * @return character */ static int ch(final byte[] in, final int pos) { return pos >= 0 && pos < in.length ? cp(in, pos) : 0; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/format/Formatter.java000066400000000000000000000454141222453003200274270ustar00rootroot00000000000000package org.basex.query.util.format; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.math.*; import java.util.*; import java.util.regex.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * Abstract class for formatting data in different languages. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class Formatter extends FormatUtil { /** Calendar pattern. */ private static final Pattern CALENDAR = Pattern.compile("(Q\\{([^}]*)\\})?([^}]+)"); /** Military timezones. */ private static final byte[] MIL = token("YXWVUTSRQPONZABCDEFGHIKLM"); /** Token: Nn. */ private static final byte[] NN = { 'N', 'n' }; /** Allowed calendars. */ private static final byte[][] CALENDARS = tokens( "ISO", "AD", "AH", "AME", "AM", "AP", "AS", "BE", "CB", "CE", "CL", "CS", "EE", "FE", "JE", "KE", "KY", "ME", "MS", "NS", "OS", "RS", "SE", "SH", "SS", "TE", "VE", "VS"); /** Default language: English. */ private static final byte[] EN = token("en"); /** Formatter instances. */ private static final TokenObjMap MAP = new TokenObjMap(); // initialize hash map with English formatter as default static { MAP.put(EN, new FormatterEN()); MAP.put(token("de"), new FormatterDE()); } /** * Returns a formatter for the specified language. * @param ln language * @return formatter instance */ public static Formatter get(final byte[] ln) { // check if formatter has already been created Formatter form = MAP.get(ln); if(form == null) { final String clz = Util.name(Formatter.class) + string(uc(ln)); form = (Formatter) Reflect.get(Reflect.find(clz)); // instantiation not successful: return default formatter if(form == null) form = MAP.get(EN); } return form; } /** * Returns a word representation for the specified number. * @param n number to be formatted * @param ord ordinal suffix * @return token */ protected abstract byte[] word(final long n, final byte[] ord); /** * Returns an ordinal representation for the specified number. * @param n number to be formatted * @param ord ordinal suffix * @return ordinal */ protected abstract byte[] ordinal(final long n, final byte[] ord); /** * Returns the specified month (0-11). * @param n number to be formatted * @param min minimum length * @param max maximum length * @return month */ protected abstract byte[] month(final int n, final int min, final int max); /** * Returns the specified day of the week (0-6, Sunday-Saturday). * @param n number to be formatted * @param min minimum length * @param max maximum length * @return day of week */ protected abstract byte[] day(final int n, final int min, final int max); /** * Returns the am/pm marker. * @param am am flag * @return am/pm marker */ protected abstract byte[] ampm(final boolean am); /** * Returns the calendar. * @return calendar */ protected abstract byte[] calendar(); /** * Returns the era. * @param year year * @return era */ protected abstract byte[] era(final long year); /** * Formats the specified date. * @param date date to be formatted * @param lng language * @param pic picture * @param cal calendar * @param plc place * @param ii input info * @return formatted string * @throws QueryException query exception */ public final byte[] formatDate(final ADate date, final byte[] lng, final byte[] pic, final byte[] cal, final byte[] plc, final InputInfo ii) throws QueryException { final TokenBuilder tb = new TokenBuilder(); if(lng.length != 0 && MAP.get(lng) == null) tb.add("[Language: en]"); boolean iso = false; if(cal.length != 0) { final Matcher m = CALENDAR.matcher(string(cal)); if(!m.matches()) CALQNAME.thrw(ii, cal); final QNm qnm = new QNm(m.group(3), m.group(1) == null || m.group(2).isEmpty() ? null : m.group(2)); if(!qnm.hasURI()) { int c = -1; final byte[] ln = qnm.local(); final int cl = CALENDARS.length; while(++c < cl && !eq(CALENDARS[c], ln)); if(c == cl) CALWHICH.thrw(ii, cal); if(c > 1) tb.add("[Calendar: AD]"); iso = c == 0; } } if(plc.length != 0) tb.add("[Place: ]"); final DateParser dp = new DateParser(ii, pic); while(dp.more()) { final int ch = dp.literal(); if(ch != -1) { // print literal tb.add(ch); } else { // retrieve variable marker final byte[] marker = dp.marker(); if(marker.length == 0) PICDATE.thrw(ii, pic); // parse component specifier final int compSpec = ch(marker, 0); byte[] pres = ONE; boolean max = false; BigDecimal frac = null; long num = 0; final boolean dat = date.type == AtomType.DAT; final boolean tim = date.type == AtomType.TIM; boolean err = false; switch(compSpec) { case 'Y': num = Math.abs(date.yea()); max = true; err = tim; break; case 'M': num = date.mon(); err = tim; break; case 'D': num = date.day(); err = tim; break; case 'd': final long y = date.yea(); for(int m = (int) date.mon() - 1; --m >= 0;) num += ADate.dpm(y, m); num += date.day(); err = tim; break; case 'F': num = date.toJava().toGregorianCalendar().get(Calendar.DAY_OF_WEEK) - 1; if(num == 0) num = 7; pres = NN; err = tim; break; case 'W': num = date.toJava().toGregorianCalendar().get(Calendar.WEEK_OF_YEAR); err = tim; break; case 'w': num = date.toJava().toGregorianCalendar().get(Calendar.WEEK_OF_MONTH); if(iso && num == 0) num = 5; err = tim; break; case 'H': num = date.hou(); err = dat; break; case 'h': num = date.hou() % 12; if(num == 0) num = 12; err = dat; break; case 'P': num = date.hou() / 12; pres = NN; err = dat; break; case 'm': num = date.min(); pres = token("01"); err = dat; break; case 's': num = date.sec().intValue(); pres = token("01"); err = dat; break; case 'f': frac = date.sec().remainder(BigDecimal.ONE); num = frac.movePointRight(3).intValue(); err = dat; break; case 'Z': case 'z': num = date.zon(); pres = token("01:01"); break; case 'C': pres = NN; break; case 'E': num = date.yea(); pres = NN; err = tim; break; default: INVCOMPSPEC.thrw(ii, marker); } if(err) PICINVCOMP.thrw(ii, marker, date.type); if(pres == null) continue; // parse presentation modifier(s) and width modifier final DateFormat fp = new DateFormat(substring(marker, 1), pres, ii); if(max) { // limit maximum length of numeric output int mx = 0; for(int s = 0; s < fp.primary.length; s += cl(fp.primary, s)) mx++; if(mx > 1) fp.max = mx; } if(compSpec == 'z' || compSpec == 'Z') { // output timezone tb.add(formatZone((int) num, fp, marker)); } else if(fp.first == 'n') { // output name representation byte[] in = null; if(compSpec == 'M') { in = month((int) num - 1, fp.min, fp.max); } else if(compSpec == 'F') { in = day((int) num - 1, fp.min, fp.max); } else if(compSpec == 'P') { in = ampm(num == 0); } else if(compSpec == 'C') { in = calendar(); } else if(compSpec == 'E') { in = era((int) num); } if(in != null) { if(fp.cs == Case.LOWER) in = lc(in); if(fp.cs == Case.UPPER) in = uc(in); tb.add(in); } else { // fallback representation fp.first = '0'; fp.primary = ONE; tb.add(formatInt(num, fp)); } } else { // output fractional component if(frac != null && !frac.equals(BigDecimal.ZERO)) { String s = frac.toString().replace("0.", ""); final int sl = s.length(); if(fp.min > sl) { s = frac(frac, fp.min); } else if(fp.max < sl) { s = frac(frac, fp.max); } else { final int fl = fp.primary.length; if(fl != 1 && fl != sl) s = frac(frac, fl); } num = Token.toLong(s); } tb.add(formatInt(num, fp)); } } } return tb.finish(); } /** * Returns the fractional part of a decimal number. * @param num number * @param len length of fractional part * @return string representation */ private String frac(final BigDecimal num, final int len) { final String s = num.setScale(len, BigDecimal.ROUND_HALF_UP).toString(); final int d = s.indexOf('.'); return d == -1 ? s : s.substring(d + 1); } /** * Returns a formatted integer. * @param num integer to be formatted * @param fp format parser * @return string representation */ public final byte[] formatInt(final long num, final FormatParser fp) { // prepend minus sign to negative values long n = num; final boolean sign = n < 0; if(sign) n = -n; final TokenBuilder tb = new TokenBuilder(); final int ch = fp.first; if(ch == 'w') { tb.add(word(n, fp.ordinal)); } else if(ch == KANJI[1]) { japanese(tb, n); } else if(ch == 'i') { roman(tb, n, fp.min); } else if(ch == '\u2460' || ch == '\u2474' || ch == '\u2488') { if(num < 1 || num > 20) tb.addLong(num); else tb.add((int) (ch + num - 1)); } else { final String seq = sequence(ch); if(seq != null) alpha(tb, num, seq); else tb.add(number(n, fp, zeroes(ch))); } // finalize formatted string byte[] in = tb.finish(); if(fp.cs == Case.LOWER) in = lc(in); if(fp.cs == Case.UPPER) in = uc(in); return sign ? concat(new byte[] { '-' }, in) : in; } /** * Returns a formatted timezone. * @param num integer to be formatted * @param fp format parser * @param marker marker * @return string representation * @throws QueryException query exception */ public final byte[] formatZone(final int num, final FormatParser fp, final byte[] marker) throws QueryException { final boolean uc = ch(marker, 0) == 'Z'; final boolean mil = uc && ch(marker, 1) == 'Z'; // ignore values without timezone. exception: military timezone if(num == Short.MAX_VALUE) return mil ? new byte[] { 'J' } : EMPTY; final TokenBuilder tb = new TokenBuilder(); if(!mil || !addMilZone(num, tb)) { if(!uc) tb.add("GMT"); final boolean minus = num < 0; if(fp.trad && num == 0) { tb.add('Z'); } else { tb.add(minus ? '-' : '+'); final TokenParser tp = new TokenParser(fp.primary); final int c1 = tp.next(), c2 = tp.next(), c3 = tp.next(), c4 = tp.next(); final int z1 = zeroes(c1), z2 = zeroes(c2), z3 = zeroes(c3), z4 = zeroes(c4); if(z1 == -1) { tb.add(addZone(num, 0, new TokenBuilder("00"))).add(':'); tb.add(addZone(num, 1, new TokenBuilder("00"))); } else if(z2 == -1) { tb.add(addZone(num, 0, new TokenBuilder().add(c1))); if(c2 == -1) { if(num % 60 != 0) tb.add(':').add(addZone(num, 1, new TokenBuilder("00"))); } else { final TokenBuilder t = new TokenBuilder().add(z3 == -1 ? '0' : z3); if(z3 != -1 && z4 != -1) t.add(z4); tb.add(c2).add(addZone(num, 1, t)); } } else if(z3 == -1) { tb.add(addZone(num, 0, new TokenBuilder().add(c1).add(c2))); if(c3 == -1) { if(num % 60 != 0) tb.add(':').add(addZone(num, 1, new TokenBuilder("00"))); } else { final int c5 = tp.next(), z5 = zeroes(c5); final TokenBuilder t = new TokenBuilder().add(z4 == -1 ? '0' : z4); if(z4 != -1 && z5 != -1) t.add(z5); tb.add(c3).add(addZone(num % 60, 1, t)); } } else if (z4 == -1) { tb.add(addZone(num, 0, new TokenBuilder().add(c1))); tb.add(addZone(num, 1, new TokenBuilder().add(c2).add(c3))); } else { tb.add(addZone(num, 0, new TokenBuilder().add(c1).add(c2))); tb.add(addZone(num, 1, new TokenBuilder().add(c3).add(c4))); } } } return tb.finish(); } /** * Returns a timezone component. * @param num number to be formatted * @param c counter * @param format presentation format * @return timezone component * @throws QueryException query exception */ private byte[] addZone(final int num, final int c, final TokenBuilder format) throws QueryException { int n = c == 0 ? num / 60 : num % 60; if(num < 0) n = -n; return number(n, new IntFormat(format.finish(), null), zeroes(format.cp(0))); } /** * Adds a military timezone component to the specified token builder. * @param num number to be formatted * @param tb token builder * @return {@code true} if timezone was added */ private boolean addMilZone(final int num, final TokenBuilder tb) { final int n = num / 60; if(num % 60 != 0 || n < -12 || n > 12) return false; tb.add(MIL[n + 12]); return true; } /** * Returns a character sequence based on the specified alphabet. * @param tb token builder * @param n number to be formatted * @param a alphabet */ private static void alpha(final TokenBuilder tb, final long n, final String a) { final int al = a.length(); if(n > al) alpha(tb, (n - 1) / al, a); if(n > 0) tb.add(a.charAt((int) ((n - 1) % al))); else tb.add(ZERO); } /** * Adds a Roman character sequence. * @param tb token builder * @param n number to be formatted * @param min minimum width */ private static void roman(final TokenBuilder tb, final long n, final int min) { final int s = tb.size(); if(n > 0 && n < 4000) { final int v = (int) n; tb.add(ROMANM[v / 1000]); tb.add(ROMANC[v / 100 % 10]); tb.add(ROMANX[v / 10 % 10]); tb.add(ROMANI[v % 10]); } else { tb.addLong(n); } while(tb.size() - s < min) tb.add(' '); } /** * Adds a Japanese character sequence. * @param tb token builder * @param n number to be formatted */ private static void japanese(final TokenBuilder tb, final long n) { if(n == 0) { tb.add(KANJI[0]); } else { jp(tb, n, false); } } /** * Recursively adds a Japanese character sequence. * @param tb token builder * @param n number to be formatted * @param i initial call */ private static void jp(final TokenBuilder tb, final long n, final boolean i) { if(n == 0) { } else if(n <= 9) { if(n != 1 || !i) tb.add(KANJI[(int) n]); } else if(n == 10) { tb.add(KANJI[10]); } else if(n <= 99) { jp(tb, n, 10, 10); } else if(n <= 999) { jp(tb, n, 100, 11); } else if(n <= 9999) { jp(tb, n, 1000, 12); } else if(n <= 99999999) { jp(tb, n, 10000, 13); } else if(n <= 999999999999L) { jp(tb, n, 100000000, 14); } else if(n <= 9999999999999999L) { jp(tb, n, 1000000000000L, 15); } else { tb.addLong(n); } } /** * Recursively adds a Japanese character sequence. * @param tb token builder * @param n number to be formatted * @param f factor * @param o kanji offset */ private static void jp(final TokenBuilder tb, final long n, final long f, final int o) { jp(tb, n / f, true); tb.add(KANJI[o]); jp(tb, n % f, false); } /** * Creates a number character sequence. * @param num number to be formatted * @param fp format parser * @param z zero digit * @return number character sequence */ private byte[] number(final long num, final FormatParser fp, final int z) { // cache characters of presentation modifier final IntList pr = new TokenParser(fp.primary).toList(); // check for a regular separator pattern int rp = -1; boolean reg = false; for(int p = pr.size() - 1; p >= 0; --p) { final int ch = pr.get(p); if(ch == '#' || ch >= z && ch <= z + 9) continue; if(rp == -1) rp = pr.size() - p; reg = (pr.size() - p) % rp == 0; } final int rc = reg ? pr.get(pr.size() - rp) : 0; if(!reg) rp = Integer.MAX_VALUE; // build string representation in a reverse order final IntList cache = new IntList(); final byte[] n = token(num); int b = n.length - 1, p = pr.size() - 1; // add numbers and separators int mn = fp.min; int mx = fp.max; while((--mn >= 0 || b >= 0 || p >= 0) && --mx >= 0) { final boolean sep = cache.size() % rp == rp - 1; if(p >= 0) { final int c = pr.get(p--); if(b >= 0) { if(c == '#' && sep) cache.add(rc); cache.add(c == '#' || c >= z && c <= z + 9 ? n[b--] - '0' + z : c); } else { // add remaining modifiers if(c == '#') break; cache.add(c >= z && c <= z + 9 ? z : c); } } else if(b >= 0) { // add remaining numbers if(sep) cache.add(rc); cache.add(n[b--] - '0' + z); } else { // add minimum numbers cache.add(z); } } // reverse result and add ordinal suffix final TokenBuilder tb = new TokenBuilder(); for(int c = cache.size() - 1; c >= 0; --c) tb.add(cache.get(c)); return tb.add(ordinal(num, fp.ordinal)).finish(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/format/FormatterDE.java000066400000000000000000000133721222453003200276360ustar00rootroot00000000000000package org.basex.query.util.format; import static org.basex.util.Token.*; import org.basex.util.*; /** * English language formatter. Can be instantiated via {@link Formatter#get}. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class FormatterDE extends Formatter { /** Written number (0). */ private static final byte[] ZERO = token("Null"); /** Written numbers (1-20). */ private static final byte[][] WORDS = tokens("", "eins", "zwei", "drei", "vier", "f\u00fcnf", "sechs", "sieben", "acht", "neun", "zehn", "elf", "zw\u00f6lf", "dreizehn", "vierzehn", "f\u00fcnfzehn", "sechzehn", "siebzehn", "achtzehn", "neunzehn"); /** Written numbers (20-100). */ private static final byte[][] WORDS20 = tokens("", "", "zwanzig", "drei\u00dfig", "vierzig", "f\u00fcnfzig", "sechzig", "siebzig", "achtzig", "neunzig"); /** Written numbers (1000000, ...). */ private static final byte[][] WORDS1000000 = tokens( "million", "milliard", "billion", "billiard", "trillion"); /** Units (100, 1000, ...). */ private static final long[] UNITS100 = { 1000000, 1000000000, 1000000000000L, 1000000000000000L, 1000000000000000000L }; /** Ordinal Numbers (1-20). */ private static final byte[][] ORDINALS = tokens("", "erst", "zweit", "dritt", "viert", "f\u00fcnft", "sechst", "siebt", "acht", "neunt", "zehnt", "elft", "zw\u00f6lft", "dreizehnt", "vierzehnt", "f\u00fcnfzehnt", "sechzehnt", "siebzehnt", "achtzehnt", "neunzehnt"); /** Days. */ private static final byte[][][] DAYS = { tokens("Mo", "Mon", "Montag"), tokens("Di", "Die", "Dienstag"), tokens("Mi", "Mit", "Mittwoch"), tokens("Do", "Don", "Donnerstag"), tokens("Fr", "Fre", "Freitag"), tokens("Sa", "Sam", "Samstag"), tokens("So", "Son", "Sonntag") }; /** Months. */ private static final byte[][] MONTHS = tokens( "Januar", "Februar", "M\u00e4rz", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"); /** AM/PM Markers. */ private static final byte[][] AMPM = tokens("a.m.", "p.m."); /** Token: und. */ private static final byte[] UND = token("und"); /** Token: ein. */ private static final byte[] EIN = token("ein"); /** Token: eine. */ private static final byte[] EINE = token("eine"); /** Token: e. */ private static final byte[] E = token("e"); /** Token: hundert. */ private static final byte[] HUNDERT = token("hundert"); /** Token: tausend. */ private static final byte[] TAUSEND = token("tausend"); /** Eras: BC, AD. */ private static final byte[][] ERAS = tokens("v. Chr.", "n. Chr."); @Override public byte[] word(final long n, final byte[] ord) { final TokenBuilder tb = new TokenBuilder(); if(n == 0) { tb.add(ZERO); if(ord != null) tb.add("t").add(ord.length == 0 ? E : ord); } else { word(tb, n, ord); } // create title case final TokenParser tp = new TokenParser(tb.finish()); tb.reset(); for(boolean u = true; tp.more(); u = false) { tb.add(u ? uc(tp.next()) : lc(tp.next())); } return tb.finish(); } @Override public byte[] ordinal(final long n, final byte[] ord) { return ord == null ? EMPTY : E; } @Override public byte[] month(final int n, final int min, final int max) { final TokenBuilder tb = new TokenBuilder(); tb.add(substring(MONTHS[n], 0, Math.max(3, max))); while(tb.size() < min) tb.add(' '); return tb.finish(); } @Override public byte[] day(final int n, final int min, final int max) { final TokenBuilder tb = new TokenBuilder(); final byte[][] formats = DAYS[n]; int f = formats.length; while(--f > 0 && max < formats[f].length); tb.add(formats[f]); while(tb.size() < min) tb.add(' '); return tb.finish(); } @Override public byte[] ampm(final boolean am) { return AMPM[am ? 0 : 1]; } @Override public byte[] calendar() { return ERAS[1]; } @Override public byte[] era(final long year) { return ERAS[year <= 0 ? 0 : 1]; } // PRIVATE METHODS ========================================================== /** * Creates a word character sequence for the specified number. * @param tb token builder * @param n number to be formatted * @param ord ordinal suffix */ private static void word(final TokenBuilder tb, final long n, final byte[] ord) { if(n == 0) { if(ord != null) tb.add("st").add(ord.length == 0 ? E : ord); } else if(n < 20) { if(ord == null) tb.add(WORDS[(int) n]); else tb.add(ORDINALS[(int) n]).add(ord.length == 0 ? E : ord); } else if(n < 100) { final int r = (int) (n % 10); if(r != 0) tb.add(r == 1 ? EIN : WORDS[r]).add(UND); tb.add(WORDS20[(int) n / 10]); if(ord != null) tb.add("st").add(ord.length == 0 ? E : ord); } else if(n < 1000) { if(n < 200) tb.add("ein"); else word(tb, n / 100, null); tb.add(HUNDERT); word(tb, n % 100, ord); } else if(n < 1000000) { if(n < 2000) tb.add("ein"); if(n >= 2000) word(tb, n / 1000, null); tb.add(TAUSEND); word(tb, n % 1000, ord); } else { int w = WORDS1000000.length; while(--w > 0 && n < UNITS100[w]); final long f = UNITS100[w]; final long i = n / f; if(ord == null) { if(i == 1) tb.add(EINE); else word(tb, i, null); tb.add(' '); } else { if(i != 1) word(tb, i, null); } tb.add(WORDS1000000[w]); final long r = n % f; if(ord != null && r == 0) { tb.add("st").add(ord.length == 0 ? E : ord); } else { if(i > 1) tb.add("en"); else if(endsWith(WORDS1000000[w], 'f')) tb.add("e"); } if(r != 0) { tb.add(' '); word(tb, r, ord); } } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/format/FormatterEN.java000066400000000000000000000121371222453003200276460ustar00rootroot00000000000000package org.basex.query.util.format; import static org.basex.util.Token.*; import org.basex.util.*; /** * English language formatter. Can be instantiated via {@link Formatter#get}. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class FormatterEN extends Formatter { /** Written number (0). */ private static final byte[] ZERO = token("Zero"); /** Written numbers (1-20). */ private static final byte[][] WORDS = tokens("", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"); /** Written numbers (20-100). */ private static final byte[][] WORDS10 = tokens("", "Ten", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"); /** Written numbers (100, 1000, ...). */ private static final byte[][] WORDS100 = tokens("Hundred", "Thousand", "Million", "Billion", "Trillion", "Quadrillion", "Quintillion"); /** Units (100, 1000, ...). */ private static final long[] UNITS100 = { 100, 1000, 1000000, 1000000000, 1000000000000L, 1000000000000000L, 1000000000000000000L }; /** Ordinal Numbers (1-20). */ private static final byte[][] ORDINALS = tokens("", "First", "Second", "Third", "Fourth", "Fifth", "Sixth", "Seventh", "Eighth", "Ninth", "Tenth", "Eleventh", "Twelfth", "Thirteenth", "Fourteenth", "Fifteenth", "Sixteenth", "Seventeenth", "Eighteenth", "Nineteenth"); /** Ordinal Numbers (20-100). */ private static final byte[][] ORDINALS10 = tokens("", "Tenth", "Twentieth", "Thirtieth", "Fortieth", "Fiftieth", "Sixtieth", "Seventieth", "Eightieth", "Ninetieth"); /** Days. */ private static final byte[][][] DAYS = { tokens("M", "Mon", "Monday"), tokens("Tu", "Tue", "Tues", "Tuesday"), tokens("W", "Wed", "Weds", "Wednesday"), tokens("Th", "Thu", "Thur", "Thurs", "Thursday"), tokens("F", "Fri", "Friday"), tokens("Sa", "Sat", "Saturday"), tokens("Su", "Sun", "Sunday") }; /** Months. */ private static final byte[][] MONTHS = tokens( "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); /** AM/PM Markers. */ private static final byte[][] AMPM = tokens("am", "pm"); /** And. */ private static final byte[] AND = token("and"); /** Ordinal suffixes (st, nr, rd, th). */ private static final byte[][] ORDSUFFIX = tokens("st", "nd", "rd", "th"); /** Eras: BC, AD. */ private static final byte[][] ERAS = tokens("BC", "AD"); @Override public byte[] word(final long n, final byte[] ord) { final TokenBuilder tb = new TokenBuilder(); if(n == 0) tb.add(ZERO); else word(tb, n, ord); return tb.finish(); } @Override public byte[] ordinal(final long n, final byte[] ord) { if(ord == null) return EMPTY; final int f = (int) (n % 10); return ORDSUFFIX[f > 0 && f < 4 && n % 100 / 10 != 1 ? f - 1 : 3]; } @Override public byte[] month(final int n, final int min, final int max) { final TokenBuilder tb = new TokenBuilder(); tb.add(substring(MONTHS[n], 0, Math.max(3, max))); while(tb.size() < min) tb.add(' '); return tb.finish(); } @Override public byte[] day(final int n, final int min, final int max) { final TokenBuilder tb = new TokenBuilder(); final byte[][] formats = DAYS[n]; int f = formats.length; while(--f > 0 && max < formats[f].length); tb.add(formats[f]); while(tb.size() < min) tb.add(' '); return tb.finish(); } @Override public byte[] ampm(final boolean am) { return AMPM[am ? 0 : 1]; } @Override public byte[] calendar() { return ERAS[1]; } @Override public byte[] era(final long year) { return ERAS[year <= 0 ? 0 : 1]; } // PRIVATE METHODS ========================================================== /** * Creates a word character sequence for the specified number. * @param tb token builder * @param n number to be formatted * @param ord ordinal suffix */ private static void word(final TokenBuilder tb, final long n, final byte[] ord) { if(n == 0) { } else if(n < 20) { tb.add((ord != null ? ORDINALS : WORDS)[(int) n]); } else if(n < 100) { final int r = (int) (n % 10); if(r == 0) { tb.add((ord != null ? ORDINALS10 : WORDS10)[(int) n / 10]); } else { tb.add(WORDS10[(int) n / 10]).add(' '); tb.add((ord != null ? ORDINALS : WORDS)[r]); } } else { for(int w = WORDS100.length - 1; w >= 0; w--) { final long f = UNITS100[w]; if(n < f) continue; word(tb, n / f, null); tb.add(' ').add(WORDS100[w]); final long r = n % f; if(r == 0) { if(ord != null) tb.add(ORDSUFFIX[3]); } else { tb.add(' '); if(r < 100) tb.add(AND).add(' '); } word(tb, r, ord); break; } } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/format/IntFormat.java000066400000000000000000000026071222453003200273640ustar00rootroot00000000000000package org.basex.query.util.format; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import org.basex.query.*; import org.basex.util.*; /** * Parser for formatting integers. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class IntFormat extends FormatParser { /** * Constructor. * @param p picture * @param ii input info * @throws QueryException query exception */ public IntFormat(final byte[] p, final InputInfo ii) throws QueryException { super(ii); final int sc = lastIndexOf(p, ';'); final byte[] pres = sc == -1 ? p : substring(p, 0, sc); if(pres.length == 0) PICEMPTY.thrw(info, p); finish(presentation(pres, ONE, false)); if(sc == -1) return; // parses the format modifier final byte[] mod = substring(p, sc + 1); final TokenParser tp = new TokenParser(mod); // parse cardinal/ordinal flag if(tp.consume('c') || tp.consume('o')) { final TokenBuilder ord = new TokenBuilder(); if(tp.consume('(')) { while(!tp.consume(')')) { if(!tp.more()) INVORDINAL.thrw(info, mod); final int cp = tp.next(); if(cp != '-') ord.add(cp); }; } ordinal = ord.finish(); } // parse alphabetical/traditional flag if(!tp.consume('a')) tp.consume('t'); if(tp.more()) INVORDINAL.thrw(info, mod); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/format/package.html000066400000000000000000000000641222453003200270720ustar00rootroot00000000000000 XQuery formatter utility classes. basex-7.7.2/basex-core/src/main/java/org/basex/query/util/http/000077500000000000000000000000001222453003200243005ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/util/http/HTTPClient.java000066400000000000000000000300421222453003200270600ustar00rootroot00000000000000package org.basex.query.util.http; import static java.net.HttpURLConnection.*; import static org.basex.data.DataText.*; import static org.basex.io.MimeTypes.*; import static org.basex.query.util.Err.*; import static org.basex.query.util.http.HTTPText.*; import static org.basex.util.Token.*; import java.io.*; import java.lang.reflect.*; import java.net.*; import java.util.*; import org.basex.core.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.util.http.HTTPRequest.Part; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.util.*; import org.basex.util.hash.*; /** * HTTP Client. * * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ public final class HTTPClient { /** Input information. */ private final InputInfo info; /** Database properties. */ private final Prop prop; /** * Constructor. * @param ii input info * @param pr database properties */ public HTTPClient(final InputInfo ii, final Prop pr) { info = ii; prop = pr; } /** * Sends an HTTP request and returns the response. * @param href URL to send the request to * @param request request data * @param bodies content items * @return HTTP response * @throws QueryException query exception */ public Iter sendRequest(final byte[] href, final ANode request, final ValueBuilder bodies) throws QueryException { try { if(request == null) { if(href == null || href.length == 0) HC_PARAMS.thrw(info); final HttpURLConnection conn = openConnection(string(href)); try { return new HTTPResponse(info, prop).getResponse(conn, Bln.FALSE.string(), null); } finally { conn.disconnect(); } } final HTTPRequest r = new HTTPRequestParser(info).parse(request, bodies); final byte[] dest = href == null ? r.attrs.get(HREF) : href; if(dest == null) HC_URL.thrw(info); final HttpURLConnection conn = openConnection(string(dest)); try { setConnectionProps(conn, r); setRequestHeaders(conn, r); if(r.bodyContent.size() != 0 || r.parts.size() != 0) { setContentType(conn, r); setRequestContent(conn.getOutputStream(), r); } final byte[] mt = r.attrs.get(OVERRIDE_MEDIA_TYPE); return new HTTPResponse(info, prop).getResponse(conn, r.attrs.get(STATUS_ONLY), mt == null ? null : string(mt)); } finally { conn.disconnect(); } } catch(final IOException ex) { throw HC_ERROR.thrw(info, ex); } } /** * Opens an HTTP connection. * @param dest HTTP URI to open connection to * @return HHTP connection * @throws QueryException query exception * @throws IOException I/O Exception * @throws MalformedURLException incorrect url */ private HttpURLConnection openConnection(final String dest) throws QueryException, IOException { final URL url = new URL(dest); if(!eqic(url.getProtocol(), "HTTP", "HTTPS")) HC_ERROR.thrw(info, "Invalid URL: " + url); return (HttpURLConnection) url.openConnection(); } /** * Sets the connection properties. * @param conn HTTP connection * @param r request data * @throws ProtocolException protocol exception * @throws QueryException query exception */ private void setConnectionProps(final HttpURLConnection conn, final HTTPRequest r) throws ProtocolException, QueryException { if(r.bodyContent != null || r.parts.size() != 0) conn.setDoOutput(true); final String method = string(r.attrs.get(METHOD)).toUpperCase(Locale.ENGLISH); try { // set field via reflection to circumvent string check final Field f = conn.getClass().getSuperclass().getDeclaredField("method"); f.setAccessible(true); f.set(conn, method); } catch(final Throwable th) { conn.setRequestMethod(method); } final byte[] timeout = r.attrs.get(TIMEOUT); if(timeout != null) conn.setConnectTimeout(Integer.parseInt(string(timeout))); final byte[] redirect = r.attrs.get(FOLLOW_REDIRECT); if(redirect != null) setFollowRedirects(Bln.parse(redirect, info)); } /** * Sets content type of HTTP request. * @param conn HTTP connection * @param r request data */ private static void setContentType(final HttpURLConnection conn, final HTTPRequest r) { String mt = null; final byte[] contTypeHdr = r.headers.get(lc(token(CONTENT_TYPE))); if(contTypeHdr != null) { // if header "Content-Type" is set explicitly by the user, its value is used mt = string(contTypeHdr); } else { // otherwise @media-type of is considered mt = string(r.payloadAttrs.get(MEDIA_TYPE)); if(r.isMultipart) { final byte[] b = r.payloadAttrs.get(BOUNDARY); final byte[] boundary = b != null ? b : DEFAULT_BOUND; final TokenBuilder tb = new TokenBuilder(); mt = tb.add(mt).add("; ").add(BOUNDARY).add('=').add(boundary).toString(); } } conn.setRequestProperty(CONTENT_TYPE, mt); } /** * Sets HTTP request headers. * @param conn HTTP connection * @param r request data * @throws QueryException query exception */ private void setRequestHeaders(final HttpURLConnection conn, final HTTPRequest r) throws QueryException { for(final byte[] headers : r.headers) conn.addRequestProperty(string(headers), string(r.headers.get(headers))); // HTTP Basic Authentication final byte[] sendAuth = r.attrs.get(SEND_AUTHORIZATION); if(sendAuth != null && Bln.parse(sendAuth, info)) conn.setRequestProperty(AUTHORIZATION, encodeCredentials(string(r.attrs.get(USERNAME)), string(r.attrs.get(PASSWORD)))); } /** * Set HTTP request content. * @param out output stream * @param r request data * @throws IOException I/O exception * @throws QueryException query exception */ public void setRequestContent(final OutputStream out, final HTTPRequest r) throws IOException, QueryException { if(r.isMultipart) { writeMultipart(r, out); } else { writePayload(r.bodyContent, r.payloadAttrs, out); } out.close(); } /** * Encodes credentials with Base64 encoding. * @param u user name * @param p password * @return encoded credentials */ private static String encodeCredentials(final String u, final String p) { return BASIC + ' ' + Base64.encode(u + ':' + p); } /** * Writes the payload of a body or part in the output stream of the * connection. * @param payload body/part payload * @param payloadAtts payload attributes * @param out output stream * @throws IOException I/O exception * @throws QueryException query exception */ private void writePayload(final ValueBuilder payload, final TokenMap payloadAtts, final OutputStream out) throws IOException, QueryException { final byte[] t = payloadAtts.get(MEDIA_TYPE); final String type = t == null ? null : string(t); // no resource to set the content from final byte[] src = payloadAtts.get(SRC); if(src == null) { // default value @method is determined by @media-type byte[] m = payloadAtts.get(METHOD); if(m == null) { if(eq(type, APP_HTML_XML)) { m = token(M_XHTML); } else if(eq(type, TEXT_HTML)) { m = token(M_HTML); } else if(type != null && isXML(type)) { m = token(M_XML); } else if(type != null && isText(type)) { m = token(M_TEXT); } else { // default serialization method is XML m = token(M_XML); } } // write content depending on the method if(eq(m, BASE64)) { writeBase64(payload, out); } else if(eq(m, HEXBIN)) { writeHex(payload, out); } else { write(payload, payloadAtts, m, out); } } else { // if the src attribute is present, the content is set as the content of // the linked resource writeResource(src, out); } } /** * Writes the payload of a body in case method is base64Binary. * @param payload payload * @param out connection output stream * @throws IOException I/O Exception * @throws QueryException query exception */ private void writeBase64(final ValueBuilder payload, final OutputStream out) throws IOException, QueryException { for(int i = 0; i < payload.size(); i++) { final Item item = payload.get(i); if(item instanceof B64) { out.write(((B64) item).toJava()); } else { out.write(new B64(item.string(info)).toJava()); } } } /** * Writes the payload of a body in case method is hexBinary. * @param payload payload * @param out connection output stream * @throws IOException I/O Exception * @throws QueryException query exception */ private void writeHex(final ValueBuilder payload, final OutputStream out) throws IOException, QueryException { for(int i = 0; i < payload.size(); i++) { final Item item = payload.get(i); if(item instanceof Hex) { out.write(((Hex) item).toJava()); } else { out.write(new Hex(item.string(info)).toJava()); } } } /** * Writes the payload of a body using the serialization parameters. * @param payload payload * @param attrs payload attributes * @param method serialization method * @param out connection output stream * @throws IOException I/O Exception */ private static void write(final ValueBuilder payload, final TokenMap attrs, final byte[] method, final OutputStream out) throws IOException { // extract serialization parameters final TokenBuilder tb = new TokenBuilder(); tb.add(METHOD).add('=').add(method); for(final byte[] key : attrs) { if(!eq(key, SRC)) tb.add(',').add(key).add('=').add(attrs.get(key)); } // serialize items according to the parameters final SerializerProp sp = new SerializerProp(tb.toString()); final Serializer ser = Serializer.get(out, sp); try { payload.serialize(ser); } finally { ser.close(); } } /** * Reads the content of the linked resource. * @param src resource link * @param out output stream * @throws IOException I/O Exception */ private static void writeResource(final byte[] src, final OutputStream out) throws IOException { final InputStream bis = new URL(string(src)).openStream(); try { final byte[] buf = new byte[256]; while(true) { final int len = bis.read(buf, 0, buf.length); if(len <= 0) break; out.write(buf, 0, len); } } finally { bis.close(); } } /** * Writes parts of multipart message in the output stream of the HTTP * connection. * @param r request data * @param out output stream * @throws IOException I/O exception * @throws QueryException query exception */ private void writeMultipart(final HTTPRequest r, final OutputStream out) throws IOException, QueryException { final byte[] boundary = r.payloadAttrs.get(BOUNDARY); for(final Part part : r.parts) writePart(part, out, boundary); out.write(new TokenBuilder("--").add(boundary).add("--").add(CRLF).finish()); } /** * Writes a single part of a multipart message. * @param part part * @param out connection output stream * @param boundary boundary * @throws IOException I/O exception * @throws QueryException query exception */ private void writePart(final Part part, final OutputStream out, final byte[] boundary) throws IOException, QueryException { // write boundary preceded by "--" final TokenBuilder boundTb = new TokenBuilder(); boundTb.add("--").add(boundary).add(CRLF); out.write(boundTb.finish()); // write headers for(final byte[] header : part.headers) { final TokenBuilder hdrTb = new TokenBuilder(); hdrTb.add(header).add(": ").add(part.headers.get(header)).add(CRLF); out.write(hdrTb.finish()); } out.write(CRLF); // write content writePayload(part.bodyContent, part.bodyAttrs, out); out.write(CRLF); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/http/HTTPPayload.java000066400000000000000000000303231222453003200272350ustar00rootroot00000000000000package org.basex.query.util.http; import static org.basex.io.MimeTypes.*; import static org.basex.query.util.Err.*; import static org.basex.query.util.http.HTTPText.*; import static org.basex.util.Token.*; import java.io.*; import java.net.*; import java.util.*; import org.basex.build.file.*; import org.basex.core.*; import org.basex.io.*; import org.basex.io.in.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.map.Map; import org.basex.query.value.node.*; import org.basex.util.*; import org.basex.util.list.*; /** * HTTP payload helper functions. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class HTTPPayload { /** Payloads (may be {@code null}). */ private final ValueBuilder payloads; /** Input stream. */ private final InputStream in; /** Input info. */ private final InputInfo info; /** Database properties. */ private final Prop prop; /** * Constructor. * @param is input stream * @param st only create status * @param ii input info * @param pr database properties */ public HTTPPayload(final InputStream is, final boolean st, final InputInfo ii, final Prop pr) { in = is; info = ii; prop = pr; payloads = st ? null : new ValueBuilder(); } /** * Parses the HTTP payload and returns a result body element. * @param error error flag * @param ctype content type defined in the connection * @param utype content type specified by the user * @return body element * @throws IOException I/O exception * @throws QueryException query exception */ public FElem parse(final boolean error, final String ctype, final String utype) throws IOException, QueryException { // error: use text/plain as content type final String ct = error ? MimeTypes.TEXT_PLAIN : utype != null ? utype : contentType(ctype); final FElem body; if(MimeTypes.isMultipart(ct)) { // multipart response final byte[] boundary = boundary(ctype); if(boundary == null) HC_REQ.thrw(info, "No separation boundary specified"); body = new FElem(Q_MULTIPART).add(MEDIA_TYPE, ct).add(BOUNDARY, boundary); final ANodeList parts = new ANodeList(); extractParts(concat(DASHES, boundary), parts); for(final ANode node : parts) body.add(node); } else { // single part response body = new FElem(Q_BODY).add(MEDIA_TYPE, ct); if(payloads != null) { final byte[] pl = extract(ct, charset(ctype)); payloads.add(parse(pl, ct)); } } return body; } /** * Returns all payloads. * @return payloads */ public Value payloads() { return payloads.value(); } /** * Extracts payload from HTTP message and returns it as a byte array encoded * in UTF-8. * @param ctype content type * @param ce response content charset * @return payload as byte array * @throws IOException I/O Exception */ private byte[] extract(final String ctype, final String ce) throws IOException { final BufferedInputStream bis = new BufferedInputStream(in); try { final ByteList bl = new ByteList(); for(int i; (i = bis.read()) != -1;) bl.add(i); // In case of XML, HTML or text content type, use supplied character set if(MimeTypes.isXML(ctype) || MimeTypes.isText(ctype)) return new TextInput(new IOContent(bl.toArray())).encoding(ce).content(); // In case of binary data, do not encode anything return bl.toArray(); } finally { bis.close(); } } /** * Interprets a payload according to content type and returns a corresponding value. * @param payload payload * @param ctype content type * @return interpreted payload * @throws QueryException query exception */ private Value parse(final byte[] payload, final String ctype) throws QueryException { try { return value(new IOContent(payload), prop, ctype, null); } catch(final IOException ex) { throw HC_PARSE.thrw(info, ex); } } /** * Extracts the parts from a multipart message. * @param sep separation boundary * @param parts list with all parts (may be {@code null}) * @throws IOException I/O Exception * @throws QueryException query exception */ private void extractParts(final byte[] sep, final ANodeList parts) throws IOException, QueryException { try { // RFC 1341: Preamble is to be ignored -> read till 1st boundary while(true) { final byte[] l = readLine(); if(l == null) HC_REQ.thrw(info, "No body specified for http:part"); if(eq(sep, l)) break; } while(extractPart(sep, concat(sep, DASHES), parts)); } finally { in.close(); } } /** * Extracts a part from a multipart message. * @param sep separation boundary * @param end closing boundary * @param parts list with all parts (may be {@code null}) * @return part * @throws IOException I/O Exception * @throws QueryException query exception */ private boolean extractPart(final byte[] sep, final byte[] end, final ANodeList parts) throws IOException, QueryException { // check if last line is reached final byte[] line = readLine(); if(line == null || eq(line, end)) return false; // content type of part payload - if not defined by header 'Content-Type', // it is equal to 'text/plain' (RFC 1341) String ctype = MimeTypes.TEXT_PLAIN, enc = null; // extract headers for(byte[] l = line; l != null && l.length > 0;) { final int pos = indexOf(l, ':'); if(pos > 0) { final byte[] key = substring(l, 0, pos); final byte[] val = trim(substring(l, pos + 1)); if(eq(lc(key), CONTENT_TYPE_LC)) { ctype = string(val); enc = charset(ctype); } if(val.length != 0 && parts != null) parts.add(new FElem(Q_HEADER).add(NAME, key).add(VALUE, val)); } l = readLine(); } if(parts != null) parts.add(new FElem(Q_BODY).add(MEDIA_TYPE, ctype)); final byte[] pl = extractPart(sep, end, enc); if(payloads != null) payloads.add(parse(pl, ctype)); return true; } /** * Reads the next line of an HTTP multipart content. * @return line, or {@code null} if end of stream is reached * @throws IOException I/O Exception */ private byte[] readLine() throws IOException { final ByteList bl = new ByteList(); for(int b; (b = in.read()) != -1;) { // RFC 1341: a line ends with CRLF while(b == '\r') { b = in.read(); if(b == '\n') return bl.toArray(); bl.add('\r'); if(b == -1) return bl.toArray(); } bl.add(b); } return bl.isEmpty() ? null : bl.toArray(); } /** * Reads the payload of a part. * @param sep separation boundary * @param end closing boundary * @param enc part content encoding * @return payload part content * @throws IOException I/O Exception */ private byte[] extractPart(final byte[] sep, final byte[] end, final String enc) throws IOException { final ByteList bl = new ByteList(); while(true) { final byte[] next = readLine(); if(next == null || eq(next, sep)) break; // RFC 1341: Epilogue is to be ignored if(eq(next, end)) { while(readLine() != null); break; } bl.add(next).add('\n'); } return new TextInput(new IOContent(bl.toArray())).encoding(enc).content(); } /** * Extracts the encapsulation boundary from the content type. * @param ct content type * @return boundary, or {@code null} * @throws QueryException query exception */ private byte[] boundary(final String ct) throws QueryException { int i = ct.toLowerCase(Locale.ENGLISH).indexOf(BOUNDARY_IS); if(i == -1) HC_REQ.thrw(info, "No separation boundary specified"); String b = ct.substring(i + BOUNDARY_IS.length()); if(b.charAt(0) == '"') { // if the boundary is enclosed in quotes, strip them i = b.lastIndexOf('"'); b = b.substring(1, i); } return token(b); } /** * Returns a map with multipart form data. * @param ext content type extension (may be {@code null}) * @return map, or {@code null} * @throws IOException I/O exception * @throws QueryException query exception */ public HashMap multiForm(final String ext) throws IOException, QueryException { // parse boundary, create helper arrays final byte[] bound = concat(DASHES, boundary(ext)), last = concat(bound, DASHES); final HashMap map = new HashMap(); final ByteList cont = new ByteList(); int lines = -1; String name = null, fn = null; for(byte[] line; (line = readLine()) != null;) { if(lines >= 0) { if(startsWith(line, bound)) { Value val = map.get(name); if(val == null && fn != null) val = Map.EMPTY; if(fn != null && val instanceof Map) { final Map m = (Map) val; final Str k = Str.get(fn); final Value v = new ValueBuilder().add(m.get(k, info)).add( new B64(cont.toArray())).value(); val = m.insert(k, v, info); } else { val = Str.get(cont.toArray()); } map.put(name, val); cont.reset(); lines = -1; if(eq(line, last)) break; } else { if(lines++ > 0) cont.add(CRLF); cont.add(line); } } else if(startsWith(line, CONTENT_DISPOSITION)) { name = !contains(line, token(NAME_IS)) ? null : string(line). replaceAll("^.*?" + NAME_IS + "\"|\".*", "").replaceAll("\\[\\]", ""); fn = !contains(line, token(FILENAME_IS)) ? null : string(line).replaceAll("^.*" + FILENAME_IS + "\"|\"$", ""); } else if(line.length == 0) { lines = 0; } } return map; } // STATIC METHODS ===================================================================== /** * Returns an XQuery value for the specified content type. * @param in input source * @param prop database properties * @param ctype content type * @param ext content type extension (may be {@code null}) * @return xml parser * @throws IOException I/O exception * @throws QueryException query exception */ public static Value value(final IO in, final Prop prop, final String ctype, final String ext) throws IOException, QueryException { Value val = null; if(ctype != null) { if(Token.eq(ctype, APP_JSON, APP_JSONML)) { final String options = ParserProp.JSONML[0] + "=" + eq(ctype, APP_JSONML); val = new DBNode(new JSONParser(in, prop, options)); } else if(TEXT_CSV.equals(ctype)) { val = new DBNode(new CSVParser(in, prop)); } else if(TEXT_HTML.equals(ctype)) { val = new DBNode(new HTMLParser(in, prop)); } else if(APP_FORM_URLENCODED.equals(ctype)) { final String enc = charset(ext); val = Str.get(URLDecoder.decode(string(in.read()), enc == null ? UTF8 : enc)); } else if(MimeTypes.isXML(ctype)) { val = new DBNode(in, prop); } else if(MimeTypes.isText(ctype)) { val = Str.get(new TextInput(in).content()); } else if(MimeTypes.isMultipart(ctype)) { final HTTPPayload hp = new HTTPPayload(in.inputStream(), false, null, prop); hp.extractParts(concat(DASHES, hp.boundary(ext)), null); val = hp.payloads(); } } return val == null ? new B64(in.read()) : val; } /** * Extracts the content from a "Content-type" header. * @param ctype value for "Content-type" header * @return result */ public static String contentType(final String ctype) { if(ctype == null) return MimeTypes.APP_OCTET; final int end = ctype.indexOf(';'); return end == -1 ? ctype : ctype.substring(0, end); } /** * Extracts the charset from the 'Content-Type' header if present. * @param ctype Content-Type header * @return charset charset */ private static String charset(final String ctype) { // content type is unknown if(ctype == null) return null; final int i = ctype.toLowerCase(Locale.ENGLISH).indexOf(CHARSET_IS); return i == -1 ? null : ctype.substring(i + CHARSET_IS.length()); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/http/HTTPRequest.java000066400000000000000000000023321222453003200272730ustar00rootroot00000000000000package org.basex.query.util.http; import java.util.*; import org.basex.query.iter.*; import org.basex.util.hash.*; /** * Container for parsed data from {@code }. * * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ public final class HTTPRequest { /** Request attributes. */ public final TokenMap attrs = new TokenMap(); /** Request headers. */ public final TokenMap headers = new TokenMap(); /** Body or multipart attributes. */ public final TokenMap payloadAttrs = new TokenMap(); /** Body content. */ public final ValueBuilder bodyContent = new ValueBuilder(); /** Parts in case of multipart request. */ public final ArrayList parts = new ArrayList(); /** Indicator for multipart request. */ public boolean isMultipart; /** * Container for parsed data from element. * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ public static class Part { /** Part headers. */ public final TokenMap headers = new TokenMap(); /** Attributes of part body. */ public final TokenMap bodyAttrs = new TokenMap(); /** Content of part body. */ public final ValueBuilder bodyContent = new ValueBuilder(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/http/HTTPRequestParser.java000066400000000000000000000147001222453003200304520ustar00rootroot00000000000000package org.basex.query.util.http; import static org.basex.query.util.Err.*; import static org.basex.query.util.http.HTTPText.*; import static org.basex.util.Token.*; import java.util.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.util.http.HTTPRequest.Part; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Request parser. * * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ public final class HTTPRequestParser { /** Input information. */ private final InputInfo info; /** * Constructor. * @param ii input info */ public HTTPRequestParser(final InputInfo ii) { info = ii; } /** * Parses an element. * @param request request element * @param bodies content items * @return parsed request * @throws QueryException query exception */ public HTTPRequest parse(final ANode request, final ValueBuilder bodies) throws QueryException { final HTTPRequest r = new HTTPRequest(); parseAttrs(request, r.attrs); checkRequest(r); final ANode payload = parseHdrs(request.children(), r.headers); final byte[] method = lc(r.attrs.get(METHOD)); // it is an error if content is set for HTTP verbs which must be empty if(eq(method, TRACE, DELETE) && (payload != null || bodies != null)) HC_REQ.thrw(info, "Body not expected for method " + string(method)); if(payload != null) { final QNm pl = payload.qname(); // single part request if(pl.eq(Q_BODY)) { final Item it = bodies != null ? bodies.next() : null; parseBody(payload, it, r.payloadAttrs, r.bodyContent); r.isMultipart = false; // multipart request } else if(pl.eq(Q_MULTIPART)) { parseMultipart(payload, bodies, r.payloadAttrs, r.parts); r.isMultipart = true; } else { HC_REQ.thrw(info, "Unknown payload element " + payload.qname()); } } return r; } /** * Parses the attributes of an element. * @param element element * @param attrs map for parsed attributes */ private static void parseAttrs(final ANode element, final TokenMap attrs) { final AxisIter elAttrs = element.attributes(); for(ANode attr; (attr = elAttrs.next()) != null;) { attrs.put(attr.name(), attr.string()); } } /** * Parses children of requests and parts. * @param i iterator on request/part children * @param hdrs map for parsed headers * @return body or multipart */ private static ANode parseHdrs(final AxisIter i, final TokenMap hdrs) { ANode n; while(true) { n = i.next(); if(n == null) break; final QNm nm = n.qname(); if(nm == null) continue; if(!nm.eq(Q_HEADER)) break; final AxisIter hdrAttrs = n.attributes(); byte[] name = null; byte[] value = null; for(ANode attr; (attr = hdrAttrs.next()) != null;) { final byte[] qn = attr.qname().local(); if(eq(qn, NAME)) name = attr.string(); if(eq(qn, VALUE)) value = attr.string(); if(name != null && name.length != 0 && value != null && value.length != 0) { hdrs.put(name, value); break; } } } return n; } /** * Parses element. * @param body body element * @param contItem content item * @param attrs map for parsed body attributes * @param bodyContent item cache for parsed body content * @throws QueryException query exception */ private void parseBody(final ANode body, final Item contItem, final TokenMap attrs, final ValueBuilder bodyContent) throws QueryException { parseAttrs(body, attrs); checkBody(body, attrs); if(attrs.get(SRC) == null) { // no linked resource for setting request content if(contItem == null) { // content is set from children for(final ANode n : body.children()) bodyContent.add(n); } else { // content is set from $bodies parameter bodyContent.add(contItem); } } } /** * Parses a element. * @param multipart multipart element * @param contItems content items * @param attrs map for multipart attributes * @param parts list for multipart parts * @throws QueryException query exception */ private void parseMultipart(final ANode multipart, final ValueBuilder contItems, final TokenMap attrs, final ArrayList parts) throws QueryException { parseAttrs(multipart, attrs); if(attrs.get(MEDIA_TYPE) == null) HC_REQ.thrw(info, "Attribute media-type of http:multipart is mandatory"); final AxisIter prts = multipart.children(); while(true) { final Part p = new Part(); final ANode partBody = parseHdrs(prts, p.headers); if(partBody == null) break; // content is set from children or from $bodies parameter final Item ci = contItems == null ? null : contItems.next(); parseBody(partBody, ci, p.bodyAttrs, p.bodyContent); parts.add(p); } } /** * Checks consistency of attributes for . * @param r request * @throws QueryException query exception */ private void checkRequest(final HTTPRequest r) throws QueryException { // @method denotes the HTTP verb and is mandatory if(r.attrs.get(METHOD) == null) HC_REQ.thrw(info, "Attribute method is mandatory"); // check parameters needed in case of authorization final byte[] sendAuth = r.attrs.get(SEND_AUTHORIZATION); if(sendAuth != null && Boolean.parseBoolean(string(sendAuth))) { final byte[] un = r.attrs.get(USERNAME); final byte[] pw = r.attrs.get(PASSWORD); if(un == null || pw == null) HC_REQ.thrw(info, "Provided credentials are invalid"); } } /** * Checks consistency of attributes for . * @param body body * @param bodyAttrs body attributes * @throws QueryException query exception */ private void checkBody(final ANode body, final TokenMap bodyAttrs) throws QueryException { // @media-type is mandatory if(bodyAttrs.get(MEDIA_TYPE) == null) HC_REQ.thrw(info, "Attribute media-type of http:body is mandatory"); // if src attribute is used to set the content of the body, no // other attributes must be specified and no content must be present if(bodyAttrs.get(SRC) != null && (bodyAttrs.size() > 2 || body.children().more())) HC_ATTR.thrw(info); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/http/HTTPResponse.java000066400000000000000000000046231222453003200274460ustar00rootroot00000000000000package org.basex.query.util.http; import static org.basex.query.util.http.HTTPText.*; import static org.basex.util.Token.*; import java.io.*; import java.net.*; import org.basex.core.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.util.*; /** * HTTP response handler. Reads HTTP response and constructs the * {@code } element. * * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ public final class HTTPResponse { /** Input information. */ private final InputInfo info; /** Database properties. */ private final Prop prop; /** * Constructor. * @param ii input info * @param pr database properties */ public HTTPResponse(final InputInfo ii, final Prop pr) { info = ii; prop = pr; } /** * Constructs http:response element and reads HTTP response content. * @param conn HTTP connection * @param status indicates if content is required * @param utype content type provided by the user to interpret the * response content * @return result sequence of and content items * @throws IOException I/O Exception * @throws QueryException query exception */ public ValueIter getResponse(final HttpURLConnection conn, final byte[] status, final String utype) throws IOException, QueryException { // check content type final String type = conn.getContentType(); InputStream is = conn.getErrorStream(); final boolean error = is != null; if(!error) is = conn.getInputStream(); // construct final FElem response = new FElem(Q_RESPONSE).declareNS(); response.add(STATUS, token(conn.getResponseCode())); response.add(MESSAGE, conn.getResponseMessage()); for(final String header : conn.getHeaderFields().keySet()) { if(header != null) { final FElem hdr = new FElem(Q_HEADER); hdr.add(NAME, token(header)); hdr.add(VALUE, conn.getHeaderField(header)); response.add(hdr); } } // construct final boolean st = status != null && Bln.parse(status, info); final HTTPPayload hp = new HTTPPayload(is, st, info, prop); response.add(hp.parse(error, type, utype)); // result final ValueBuilder vb = new ValueBuilder().add(response); if(!st) vb.add(hp.payloads()); return vb; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/http/HTTPText.java000066400000000000000000000057521222453003200266000ustar00rootroot00000000000000package org.basex.query.util.http; import static org.basex.query.QueryText.*; import static org.basex.util.Token.*; import org.basex.query.value.item.*; /** * HTTP strings. * * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ public interface HTTPText { /** HTTP header: Authorization. */ String AUTHORIZATION = "Authorization"; /** HTTP basic authentication. */ String BASIC = "Basic"; /** Payload string. */ String PAYLOAD = "payload"; /** Content-Disposition. */ byte[] CONTENT_DISPOSITION = token("Content-Disposition"); /** Dashes. */ byte[] DASHES = token("--"); /** Character string. */ String CHARSET_IS = "charset="; /** Boundary string. */ String BOUNDARY_IS = "boundary="; /** Name string. */ String NAME_IS = "name="; /** Filename string. */ String FILENAME_IS = "filename="; /** Module prefix. */ String PREFIX = "http"; /** QName. */ QNm Q_BODY = QNm.get(PREFIX, "body", HTTPURI); /** QName. */ QNm Q_RESPONSE = QNm.get(PREFIX, "response", HTTPURI); /** QName. */ QNm Q_HEADER = QNm.get(PREFIX, "header", HTTPURI); /** QName. */ QNm Q_MULTIPART = QNm.get(PREFIX, "multipart", HTTPURI); /** Request attribute: HTTP method. */ byte[] METHOD = token("method"); /** Request attribute: username. */ byte[] USERNAME = token("username"); /** Request attribute: password. */ byte[] PASSWORD = token("password"); /** Request attribute: send-authorization. */ byte[] SEND_AUTHORIZATION = token("send-authorization"); /** Request attribute: href. */ byte[] HREF = token("href"); /** Request attribute: status-only. */ byte[] STATUS_ONLY = token("status-only"); /** Request attribute: override-media-type. */ byte[] OVERRIDE_MEDIA_TYPE = token("override-media-type"); /** Request attribute: follow-redirect. */ byte[] FOLLOW_REDIRECT = token("follow-redirect"); /** Request attribute: timeout. */ byte[] TIMEOUT = token("timeout"); /** Body attribute: src. */ byte[] SRC = token("src"); /** Body attribute: media-type. */ byte[] MEDIA_TYPE = token("media-type"); /** boundary marker. */ byte[] BOUNDARY = token("boundary"); /** HTTP method TRACE. */ byte[] TRACE = token("trace"); /** HTTP method DELETE. */ byte[] DELETE = token("delete"); /** Carriage return/line feed. */ byte[] CRLF = { '\r', '\n' }; /** Default multipart boundary. */ byte[] DEFAULT_BOUND = token("1BEF0A57BE110FD467A"); /** HTTP header Content-Type lower case. */ byte[] CONTENT_TYPE_LC = token("content-type"); /** Response attribute: status. */ byte[] STATUS = token("status"); /** Response attribute: message. */ byte[] MESSAGE = token("message"); // Serialization methods defined by the EXPath specification. /** Method http:base64Binary. */ byte[] BASE64 = token("http:base64Binary"); /** Method http:hexBinary. */ byte[] HEXBIN = token("http:hexBinary"); /** Header attribute: name. */ byte[] NAME = token("name"); /** Header attribute: value. */ byte[] VALUE = token("value"); } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/inspect/000077500000000000000000000000001222453003200247665ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/util/inspect/Inspect.java000066400000000000000000000113371222453003200272430ustar00rootroot00000000000000package org.basex.query.util.inspect; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.io.*; import org.basex.core.*; import org.basex.io.*; import org.basex.query.*; import org.basex.query.func.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * This class contains functions for inspecting XQuery modules and * generating XQuery documentation. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public abstract class Inspect { /** Query context. */ protected final QueryContext ctx; /** Input info. */ protected final InputInfo info; /** Parsed main module. */ protected StaticScope module; /** * Constructor. * @param qc query context * @param ii input info */ protected Inspect(final QueryContext qc, final InputInfo ii) { ctx = qc; info = ii; } /** * Parses a module and returns an inspection element. * @param io input reference * @return inspection element * @throws QueryException query exception */ public abstract FElem parse(final IO io) throws QueryException; /** * Parses a module. * @param io input reference * @return query parser * @throws QueryException query exception */ public final QueryParser parseQuery(final IO io) throws QueryException { if(!io.exists()) WHICHRES.thrw(info, io); final QueryContext qc = new QueryContext(ctx.context); try { final String input = string(io.read()); // parse query final QueryParser qp = new QueryParser(input, io.path(), qc); module = QueryProcessor.isLibrary(input) ? qp.parseLibrary(true) : qp.parseMain(); return qp; } catch(final IOException ex) { throw IOERR.thrw(info, ex); } catch(final QueryException ex) { throw IOERR.thrw(info, ex); } finally { qc.close(); } } /** * Creates a comment sub element. * @param tags map with tags * @param parent parent element */ protected final void comment(final TokenObjMap tags, final FElem parent) { for(final byte[] key : tags) { for(final byte[] value : tags.get(key)) { add(value, ctx.context, tag(key, parent)); } } } /** * Creates annotation child elements. * @param ann annotations * @param parent parent element * @param uri include uri * @throws QueryException query exception */ protected final void annotation(final Ann ann, final FElem parent, final boolean uri) throws QueryException { final int as = ann.size(); for(int a = 0; a < as; a++) { final FElem annotation = elem("annotation", parent); annotation.add("name", ann.names[a].string()); if(uri) annotation.add("uri", ann.names[a].uri()); for(final Item it : ann.values[a]) { final FElem literal = elem("literal", annotation); literal.add("type", it.type.toString()).add(it.string(null)); } } } /** * Creates a new element for the specified tag. * @param tag tag * @param parent parent element * @return element */ protected abstract FElem tag(final byte[] tag, final FElem parent); /** * Creates an element. * @param name name of element * @param parent parent element * @return element node */ protected abstract FElem elem(final String name, final FElem parent); /** * Parses a string as XML and adds the resulting nodes to the specified parent. * @param ctx database context * @param value string to parse * @param elem element */ public static void add(final byte[] value, final Context ctx, final FElem elem) { try { final ANode node = FNGen.parseXml(new IOContent(value), ctx, true); for(final ANode n : node.children()) elem.add(n.copy()); } catch(final IOException ex) { // fallback: add string representation Util.debug(ex); elem.add(value); } } /** * Returns a value for the specified parameter, or {@code null}. * @param doc documentation * @param name parameter name * @return documentation of specified variable */ public static byte[] doc(final TokenObjMap doc, final byte[] name) { final TokenList params = doc != null ? doc.get(DOC_PARAM) : null; if(params != null) { for(final byte[] param : params) { final int vl = param.length; final int s = startsWith(param, '$') ? 1 : 0; for(int v = s; v < vl; v++) { if(!ws(param[v])) continue; if(!eq(substring(param, s, v), name)) break; return trim(substring(param, v + 1, vl)); } } } return null; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/inspect/PlainDoc.java000066400000000000000000000126651222453003200273340ustar00rootroot00000000000000package org.basex.query.util.inspect; import static org.basex.query.QueryText.*; import static org.basex.util.Token.*; import org.basex.io.*; import org.basex.query.*; import org.basex.query.func.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * This class contains functions for generating a plain XQuery documentation. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class PlainDoc extends Inspect { /** * Constructor. * @param qc query context * @param ii input info */ public PlainDoc(final QueryContext qc, final InputInfo ii) { super(qc, ii); } /** * Parses a module and returns an inspection element. * @return inspection element * @throws QueryException query exception */ public FElem context() throws QueryException { final FElem context = elem("context", null); for(final StaticVar sv : ctx.vars) { variable(sv, context); } for(final StaticFunc sf : ctx.funcs.funcs()) { function(sf.name, sf, sf.funcType(), context); } return context; } @Override public FElem parse(final IO io) throws QueryException { final QueryParser qp = parseQuery(io); final FElem mod = elem("module", null); if(module instanceof LibraryModule) { final QNm name = ((LibraryModule) module).name; mod.add("prefix", name.string()); mod.add("uri", name.uri()); } final TokenObjMap doc = module.doc(); if(doc != null) comment(doc, mod); for(final StaticVar sv : qp.vars) variable(sv, mod); for(final StaticFunc sf : qp.funcs) function(sf.name, sf, sf.funcType(), mod); return mod; } /** * Creates a description for the specified variable. * @param sv static variable * @param parent node * @return resulting value * @throws QueryException query exception */ private FElem variable(final StaticVar sv, final FElem parent) throws QueryException { final FElem variable = elem("variable", parent); variable.add("name", sv.name.string()); if(sv.name.uri().length != 0) variable.add("uri", sv.name.uri()); type(sv.type(), variable); comment(sv, variable); annotation(sv.ann, variable, true); return variable; } /** * Creates a description for the specified function. * @param fname name of function * @param sf function reference * @param ftype function type * @param parent node * @return resulting value * @throws QueryException query exception */ public FElem function(final QNm fname, final StaticFunc sf, final FuncType ftype, final FElem parent) throws QueryException { final FElem function = elem("function", parent); if(fname != null) { function.add("name", fname.string()); if(fname.uri().length != 0) function.add("uri", fname.uri()); } final TokenObjMap doc = sf != null ? sf.doc() : null; final int al = ftype.args.length; QNm[] names = null; if(sf != null) { names = new QNm[al]; for(int n = 0; n < al; n++) names[n] = sf.args[n].name; } for(int a = 0; a < al; a++) { final FElem argument = elem("argument", function); if(names != null) { final byte[] name = names[a].string(); final byte[] uri = names[a].uri(); argument.add("name", name); if(uri.length != 0) argument.add("uri", uri); final byte[] pdoc = doc(doc, name); if(pdoc != null) add(pdoc, ctx.context, argument); } type(ftype.args[a], argument); } if(sf != null) annotation(sf.ann, function, true); if(doc != null) { for(final byte[] key : doc) { if(eq(key, DOC_PARAM, DOC_RETURN)) continue; for(final byte[] value : doc.get(key)) { final FElem elem = eq(key, DOC_TAGS) ? elem(string(key), function) : elem("tag", function).add("name", key); add(value, ctx.context, elem); } } } final SeqType rt = sf != null ? sf.type() : ftype.type; final FElem ret = type(rt, elem("return", function)); final TokenList returns = doc != null ? doc.get(DOC_RETURN) : null; if(returns != null) for(final byte[] val : returns) ret.add(val); return function; } /** * Creates an element. * @param name name of element * @param parent parent node * @return element node */ @Override protected FElem elem(final String name, final FElem parent) { final FElem elem = new FElem(name); if(parent != null) parent.add(elem); return elem; } /** * Creates a comment element. * @param scope scope * @param parent parent element */ private void comment(final StaticScope scope, final FElem parent) { final TokenObjMap tags = scope.doc(); if(tags != null) comment(tags, parent); } @Override protected FElem tag(final byte[] tag, final FElem parent) { final String t = string(tag); return elem(eq(tag, DOC_TAGS) ? t : t + "_tag", parent); } /** * Returns an element with type information. * @param st sequence type * @param elem element * @return element */ private FElem type(final SeqType st, final FElem elem) { if(st != null) { elem.add("type", st.typeString()); final String occ = st.occ.toString(); if(!occ.isEmpty()) elem.add("occurrence", occ); } return elem; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/inspect/XQDoc.java000066400000000000000000000120571222453003200266140ustar00rootroot00000000000000package org.basex.query.util.inspect; import static org.basex.query.QueryText.*; import static org.basex.util.Token.*; import org.basex.io.*; import org.basex.query.*; import org.basex.query.func.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * This class contains functions for generating a xqDoc documentation. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class XQDoc extends Inspect { /** Namespace uri. */ private static final byte[] URI = token("http://www.xqdoc.org/1.0"); /** Prefix. */ private static final byte[] PREFIX = token("xqdoc"); /** Namespaces. */ private final TokenMap nsCache = new TokenMap(); /** * Constructor. * @param qc query context * @param ii input info */ public XQDoc(final QueryContext qc, final InputInfo ii) { super(qc, ii); } @Override public FElem parse(final IO io) throws QueryException { final QueryParser qp = parseQuery(io); final FElem xqdoc = new FElem(PREFIX, PREFIX, URI).declareNS(); final FElem control = elem("control", xqdoc); elem("date", control).add(ctx.initDateTime().dtm.string(info)); elem("version", control).add("1.1"); final String type = module instanceof LibraryModule ? "library" : "main"; final FElem mod = elem("module", xqdoc).add("type", type); if(module instanceof LibraryModule) { final QNm name = ((LibraryModule) module).name; elem("uri", mod).add(name.uri()); elem("name", mod).add(io.name()); } else { elem("uri", mod).add(io.name()); } comment(module, mod); // namespaces final FElem namespaces = elem("namespaces", xqdoc); for(final byte[] pref : qp.namespaces) nsCache.put(pref, qp.namespaces.get(pref)); // imports final FElem imports = elem("imports", xqdoc); for(final byte[] imp : qp.modules) { elem("uri", elem("import", imports).add("type", "library")).add(imp); } // variables final FElem variables = elem("variables", xqdoc); for(final StaticVar sv : qp.vars) { final FElem variable = elem("variable", variables); elem("name", variable).add(sv.name.string()); if(sv.name.hasPrefix()) nsCache.put(sv.name.prefix(), sv.name.uri()); comment(sv, variable); annotations(sv.ann, variable); type(sv.type(), variable); } // functions final FElem functions = elem("functions", xqdoc); for(final StaticFunc sf : qp.funcs) { final int al = sf.args.length; final FElem function = elem("function", functions).add("arity", token(al)); comment(sf, function); elem("name", function).add(sf.name.string()); if(sf.name.hasPrefix()) nsCache.put(sf.name.prefix(), sf.name.uri()); annotations(sf.ann, function); elem("signature", function).add(sf.toString().replaceAll(" \\{.*| \\w+;.*", "")); if(al != 0) { final FElem fparameters = elem("parameters", function); for(int a = 0; a < al; a++) { final FElem fparameter = elem("parameter", fparameters); final Var v = sf.args[a]; elem("name", fparameter).add(v.name.string()); type(v.declType, fparameter); } } type(sf.type(), elem("return", function)); } // add namespaces for(final byte[] pref : nsCache) { final FElem namespace = elem("namespace", namespaces); namespace.add("prefix", pref).add("uri", nsCache.get(pref)); } return xqdoc; } @Override protected FElem elem(final String name, final FElem parent) { final FElem elem = new FElem(PREFIX, token(name), URI); parent.add(elem); return elem; } @Override protected FElem tag(final byte[] tag, final FElem parent) { return eq(tag, DOC_TAGS) ? elem(string(tag), parent) : elem("custom", parent).add("tag", tag); } /** * Creates a comment element. * @param scope scope * @param parent parent element */ private void comment(final StaticScope scope, final FElem parent) { final TokenObjMap map = scope.doc(); if(map != null) comment(map, elem("comment", parent)); } /** * Creates annotation elements. * @param ann annotations * @param parent parent node * @throws QueryException query exception */ private void annotations(final Ann ann, final FElem parent) throws QueryException { if(!ann.isEmpty()) annotation(ann, elem("annotations", parent), false); for(int a = 0; a < ann.size(); a++) { final QNm name = ann.names[a]; if(name.hasPrefix()) nsCache.put(name.prefix(), name.uri()); } } /** * Creates a type element. * @param st sequence type * @param parent parent node */ protected void type(final SeqType st, final FElem parent) { if(st == null) return; final FElem type = elem("type", parent).add(st.typeString()); final String occ = st.occ.toString(); if(!occ.isEmpty()) type.add("occurrence", occ); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/json/000077500000000000000000000000001222453003200242725ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/util/json/JsonCGConverter.java000066400000000000000000000170001222453003200301460ustar00rootroot00000000000000package org.basex.query.util.json; import org.basex.query.QueryException; import org.basex.query.util.*; import org.basex.query.util.json.JsonParser.*; import org.basex.query.value.node.*; import static org.basex.util.Token.*; import org.basex.util.*; import org.basex.util.hash.TokenObjMap; import org.basex.util.list.ByteList; import static org.basex.data.DataText.*; /** *

This class converts a JSON document to XML. The converted XML document is * both well readable and lossless, i.e., the converted document can be * serialized back to the original JSON representation.

* *

The specified JSON input is first transformed into a tree representation * and then converted to an XML document, according to the following rules:

* *
    *
  1. The resulting document has a {@code } root node.
  2. *
  3. Names (keys) of objects are represented as elements: *
      *
    1. Empty names are represented by a single underscore * (<_>...</_>).
    2. *
    3. Underscore characters are rewritten to two underscores ({@code __}). *
    4. *
    5. A character that cannot be represented as NCName character is * rewritten to an underscore and its four-digit Unicode.
    6. *
  4. *
  5. As arrays have no names, {@code } is used as element name. *
  6. JSON values are represented as text nodes.
  7. *
  8. The types of values are represented in attributes: *
      *
    1. The value types number, boolean, null, * object and array are represented by a * {@code type} attribute.
    2. *
    3. The string type is omitted, as it is treated as default type. *
    4. *
    5. If a name has the same type throughout the document, the {@code type} * attribute will be omitted. Instead, the name will be listed in * additional, type-specific attributes in the root node. The attributes * are named by their type in the plural (numbers, booleans, * nulls, objects and arrays), and the attribute * value contains all names with that type, separated by whitespaces.
    6. *
  9. *
* * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Leo Woerteler */ public final class JsonCGConverter extends JsonXMLConverter { /** Type names. */ private static final byte[][] NAMES = { T_ARRAY, T_OBJECT, T_STRING, T_NUMBER, T_BOOLEAN, NULL }; /** The {@code types} QNames. */ private static final byte[][] TYPES = new byte[NAMES.length][]; static { final byte[] s = { 's' }; for(int i = 0; i < NAMES.length; i++) TYPES[i] = concat(NAMES[i], s); } /** Spec to use. */ private final Spec spec; /** Flag for interpreting character escape sequences. */ private final boolean unescape; /** * Constructor. * @param sp JSON spec to use * @param unesc unescape flag * @param ii input info */ public JsonCGConverter(final Spec sp, final boolean unesc, final InputInfo ii) { super(ii); spec = sp; unescape = unesc; } @Override public ANode convert(final String in) throws QueryException { final JsonCGHandler handler = new JsonCGHandler(); JsonParser.parse(in, spec, unescape, handler, null); final ByteList[] types = new ByteList[TYPES.length]; for(final TypedArray arr : handler.names.values()) { if(arr != null) { for(int i = 0; i < NAMES.length; i++) { if(arr.type == NAMES[i] && arr.type != T_STRING) { if(types[i] == null) types[i] = new ByteList(); else types[i].add(' '); types[i].add(arr.vals[0].qname().string()); break; } } } } for(int i = 0; i < types.length; i++) if(types[i] != null) handler.elem.add(TYPES[i], types[i].toArray()); return handler.elem; } /** JSON handler containing the state of the conversion. */ static class JsonCGHandler implements JsonHandler { /** Map from element name to a pair of all its nodes and the collective node type. */ final TokenObjMap names = new TokenObjMap(); /** The next element's name. */ private byte[] name = T_JSON; /** The current node. */ FElem elem; /** * Adds a new element with the given type. * @param type JSON type * @return the element */ FElem addElem(final byte[] type) { final FElem e = new FElem(name); if(names.contains(name)) { final TypedArray arr = names.get(name); if(arr != null && arr.type == type) { arr.add(e); } else { if(arr != null) { names.put(name, null); if(arr.type != T_STRING) for(int i = 0; i < arr.size; i++) arr.vals[i].add(T_TYPE, arr.type); } if(type != T_STRING) e.add(T_TYPE, type); } } else { names.put(name, new TypedArray(type, e)); } if(elem != null) elem.add(e); else elem = e; name = null; return e; } @Override public void openObject() throws QueryException { elem = addElem(T_OBJECT); } @Override public void openEntry(final byte[] key) throws QueryException { name = XMLToken.encode(key); } @Override public void closeEntry() throws QueryException { } @Override public void closeObject() throws QueryException { final FElem par = (FElem) elem.parent(); if(par != null) elem = par; } @Override public void openArray() throws QueryException { elem = addElem(T_ARRAY); } @Override public void openArrayEntry() throws QueryException { name = T_VALUE; } @Override public void closeArrayEntry() throws QueryException { } @Override public void closeArray() throws QueryException { closeObject(); } @Override public void openConstr(final byte[] nm) throws QueryException { // [LW] what can be done here? openObject(); openEntry(nm); openArray(); } @Override public void openArg() throws QueryException { openArrayEntry(); } @Override public void closeArg() throws QueryException { closeArrayEntry(); } @Override public void closeConstr() throws QueryException { closeArray(); closeEntry(); closeObject(); } @Override public void numberLit(final byte[] value) throws QueryException { addElem(T_NUMBER).add(value); } @Override public void stringLit(final byte[] value) throws QueryException { addElem(T_STRING).add(value); } @Override public void nullLit() throws QueryException { addElem(NULL); } @Override public void booleanLit(final boolean b) throws QueryException { addElem(T_BOOLEAN).add(token(b)); } } /** * A simple container for all elements having the same name. * @author Leo Woerteler */ private static class TypedArray { /** The shared JSON type. */ final byte[] type; /** The nodes. */ FElem[] vals = new FElem[8]; /** Logical size of {@link #vals}. */ int size; /** * Constructor. * @param tp JSON type * @param nd element */ protected TypedArray(final byte[] tp, final FElem nd) { type = tp; vals[0] = nd; size = 1; } /** * Adds a new element to the list. * @param nd element to add */ protected void add(final FElem nd) { if(size == vals.length) vals = Array.copy(vals, new FElem[Array.newSize(size)]); vals[size++] = nd; } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/json/JsonConverter.java000066400000000000000000000032011222453003200277320ustar00rootroot00000000000000package org.basex.query.util.json; import static org.basex.util.Token.*; import org.basex.query.*; import org.basex.query.util.json.JsonParser.Spec; import org.basex.query.value.item.*; import org.basex.util.*; /** * Interface for converters from JSON to XQuery values. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public abstract class JsonConverter { /** Input info. */ protected final InputInfo info; /** The {@code map} conversion format. */ public static final byte[] MAP = token("map"); /** The {@code jsonml} conversion format. */ public static final byte[] JSONML = token("jsonml"); /** The {@code json} conversion format. */ public static final byte[] JSON = token("json"); /** * Constructor. * @param ii input info */ public JsonConverter(final InputInfo ii) { info = ii; } /** * Converts the given JSON string into an XQuery value. * @param in the JSON string * @return the result * @throws QueryException parse exception */ public abstract Item convert(final String in) throws QueryException; /** * Returns a {@link JsonConverter} for the given configuration. * @param format conversion format * @param spec JSON spec * @param unesc unescape flag * @param ii input info * @return a JSON converter */ public static JsonConverter get(final byte[] format, final Spec spec, final boolean unesc, final InputInfo ii) { if(format != null) { if(eq(format, JSONML)) return new JsonMLConverter(ii); if(eq(format, MAP)) return new JsonMapConverter(spec, unesc, ii); } return new JsonCGConverter(spec, unesc, ii); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/json/JsonHandler.java000066400000000000000000000055041222453003200273500ustar00rootroot00000000000000package org.basex.query.util.json; import org.basex.query.QueryException; /** * A handler for events from a {@link JsonParser}. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public interface JsonHandler { /** * Called when a JSON object is opened. * @throws QueryException query exception */ void openObject() throws QueryException; /** * Called when an entry of a JSON object is opened. * @param key the key of the entry * @throws QueryException query exception */ void openEntry(byte[] key) throws QueryException; /** * Called when an entry of a JSON object is closed. * @throws QueryException query exception */ void closeEntry() throws QueryException; /** * Called when a JSON object is closed. * @throws QueryException query exception */ void closeObject() throws QueryException; /** * Called when a JSON array is opened. * @throws QueryException query exception */ void openArray() throws QueryException; /** * Called when an entry of a JSON array is opened. * @throws QueryException query exception */ void openArrayEntry() throws QueryException; /** * Called when an entry of a JSON array is closed. * @throws QueryException query exception */ void closeArrayEntry() throws QueryException; /** * Called when a JSON array is closed. * @throws QueryException query exception */ void closeArray() throws QueryException; /** * Called when a constructor function is opened. * @param name name of the constructor * @throws QueryException query exception */ void openConstr(byte[] name) throws QueryException; /** * Called when an argument of a constructor function is opened. * @throws QueryException query exception */ void openArg() throws QueryException; /** * Called when an argument of a constructor function is closed. * @throws QueryException query exception */ void closeArg() throws QueryException; /** Called when a constructor function is closed. * @throws QueryException query exception */ void closeConstr() throws QueryException; /** * Called when a number literal is encountered. * @param value string representation of the number literal * @throws QueryException query exception */ void numberLit(byte[] value) throws QueryException; /** * Called when a string literal is encountered. * @param bs the string * @throws QueryException query exception */ void stringLit(byte[] bs) throws QueryException; /** * Called when a {@code null} literal is encountered. * @throws QueryException query exception */ void nullLit() throws QueryException; /** * Called when a boolean literal is encountered. * @param b the boolean * @throws QueryException query exception */ void booleanLit(boolean b) throws QueryException; } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/json/JsonMLConverter.java000066400000000000000000000107551222453003200301770ustar00rootroot00000000000000package org.basex.query.util.json; import static org.basex.query.util.Err.*; import java.util.Stack; import org.basex.query.QueryException; import org.basex.query.util.*; import org.basex.query.util.json.JsonParser.*; import org.basex.query.value.node.*; import org.basex.util.*; /** *

This class converts a JsonML * document to XML. * The specified JSON input is first transformed into a tree representation * and then converted to an XML document. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Leo Woerteler */ public class JsonMLConverter extends JsonXMLConverter { /** Element stack. */ final Stack stack = new Stack(); /** * Constructor. * @param ii input info */ public JsonMLConverter(final InputInfo ii) { super(ii); } @Override public ANode convert(final String in) throws QueryException { final JsonMLHandler handler = new JsonMLHandler(); stack.clear(); JsonParser.parse(in, Spec.RFC4627, true, handler, null); return stack.pop(); } /** * Raises an error with the specified message. * @param msg error message * @param ext error details * @throws QueryException query exception */ void error(final String msg, final Object... ext) throws QueryException { throw BXJS_PARSEML.thrw(info, Util.inf(msg, ext)); } /** * Returns the specified name. * @param name name * @return cached QName * @throws QueryException query exception */ byte[] check(final byte[] name) throws QueryException { // retrieve name from cache, or create new instance if(!XMLToken.isNCName(name)) error("Invalid name: \"%\"", name); return name; } /** JSON handler. */ private class JsonMLHandler implements JsonHandler { /** Current element. */ private FElem curr; /** Current attribute name. */ private byte[] attName; /** Constructor for visibility. */ protected JsonMLHandler() { } @Override public void openObject() throws QueryException { if(curr == null || attName != null || stack.peek() != null) error("No object allowed at this stage"); } @Override public void openEntry(final byte[] key) throws QueryException { attName = check(key); } @Override public void closeEntry() throws QueryException { } @Override public void closeObject() { stack.pop(); stack.push(curr); curr = null; } @Override public void openArray() throws QueryException { if(!stack.isEmpty()) { if(attName == null && curr != null && stack.peek() == null) { stack.pop(); stack.push(curr); curr = null; } else if(attName != null || curr != null || stack.peek() == null) { error("No array allowed at this stage"); } } stack.push(null); curr = null; } @Override public void openArrayEntry() { } @Override public void closeArrayEntry() throws QueryException { } @Override public void closeArray() throws QueryException { FElem val = stack.pop(); if(val == null) { val = curr; curr = null; } if(val == null) error("Missing element name"); if(stack.isEmpty()) stack.push(val); else stack.peek().add(val); } @Override public void stringLit(final byte[] val) throws QueryException { if(attName == null && curr != null && stack.peek() == null) { stack.pop(); stack.push(curr); curr = null; } if(curr == null) { final FElem elem = stack.peek(); if(elem == null) curr = new FElem(check(val)); else elem.add(new FTxt(val)); } else if(attName != null) { curr.add(attName, val); attName = null; } else { error("No string allowed at this stage"); } } @Override public void numberLit(final byte[] value) throws QueryException { error("No numbers allowed"); } @Override public void nullLit() throws QueryException { error("No 'null' allowed"); } @Override public void booleanLit(final boolean b) throws QueryException { error("No booleans allowed"); } @Override public void openConstr(final byte[] nm) throws QueryException { error("No constructor functions allowed"); } @Override public void openArg() { } @Override public void closeArg() throws QueryException { } @Override public void closeConstr() throws QueryException { } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/json/JsonMapConverter.java000066400000000000000000000063351222453003200304030ustar00rootroot00000000000000package org.basex.query.util.json; import java.util.*; import org.basex.query.QueryException; import org.basex.query.util.json.JsonParser.*; import org.basex.query.value.Value; import org.basex.query.value.item.*; import org.basex.query.value.map.Map; import org.basex.query.value.seq.Empty; import org.basex.util.*; /** *

Provides a method for parsing a JSON string and converting it to an XQuery * item made of nested maps. * *

The mapping from JSON to XQuery is the following: *

*
string
xs:string *
number
xs:double *
boolean
xs:boolean *
null
an empty sequence () *
array (e.g. {@code ["foo", true, 123]}) *
an XQuery map with integer keys, starting by 1 (e.g. * {1:'foo', 2:true(), 3:123}) *
object (e.g. {"foo": 42, "bar": null}) *
an XQuery map (e.g. * {'foo':42, 'bar':()}) *
* * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class JsonMapConverter extends JsonConverter implements JsonHandler { /** Stack for intermediate values. */ private final Stack stack = new Stack(); /** JSON spec. */ private final Spec spec; /** Unescape flag. */ private final boolean unescape; /** * Constructor. * @param sp JSON spec * @param unesc unescape flag * @param ii input info */ public JsonMapConverter(final Spec sp, final boolean unesc, final InputInfo ii) { super(ii); spec = sp; unescape = unesc; } @Override public Item convert(final String in) throws QueryException { stack.clear(); JsonParser.parse(in, spec, unescape, this, info); return stack.peek().isEmpty() ? null : (Item) stack.pop(); } @Override public void openObject() { stack.push(Map.EMPTY); } @Override public void openEntry(final byte[] key) { stack.push(Str.get(key)); } @Override public void closeEntry() throws QueryException { final Value val = stack.pop(); final Item key = (Item) stack.pop(); final Map map = (Map) stack.pop(); stack.push(map.insert(key, val, null)); } @Override public void closeObject() { } @Override public void openArray() { stack.push(Map.EMPTY); } @Override public void openArrayEntry() { stack.push(Int.get(((Map) stack.peek()).mapSize() + 1)); } @Override public void closeArrayEntry() throws QueryException { closeEntry(); } @Override public void closeArray() { } @Override public void openConstr(final byte[] name) { openObject(); openEntry(name); openArray(); } @Override public void openArg() { openArrayEntry(); } @Override public void closeArg() throws QueryException { closeArrayEntry(); } @Override public void closeConstr() throws QueryException { closeArray(); closeEntry(); closeObject(); } @Override public void numberLit(final byte[] val) throws QueryException { stack.push(Dbl.get(val, info)); } @Override public void stringLit(final byte[] value) { stack.push(Str.get(value)); } @Override public void nullLit() { stack.push(Empty.SEQ); } @Override public void booleanLit(final boolean b) { stack.push(Bln.get(b)); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/json/JsonParser.java000066400000000000000000000274741222453003200272410ustar00rootroot00000000000000package org.basex.query.util.json; import org.basex.query.*; import org.basex.util.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; /** * A JSON parser generating parse events similar to a SAX XML parser. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class JsonParser extends InputParser { /** JSON specs. */ public static enum Spec { /** Parse the input according to RFC 4627. */ RFC4627("RFC4627"), /** Parse the input according to ECMA-262. */ ECMA_262("ECMA-262"), /** Parse the input being as compatible as possible. */ LIBERAL("liberal"); /** Description. */ public final byte[] desc; /** * Constructor. * @param dsc description */ Spec(final String dsc) { desc = token(dsc); } } /** Names of control characters not allowed in string literals. */ private static final String[] CTRL = { // U+0000 -- U+001F "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", "BS", "TAB", "LF", "VT", "FF", "CR", "SO", "SI", "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US", }; /** Input info for errors. */ private final InputInfo info; /** JSON spec. */ private final Spec spec; /** Unescape flag. */ private final boolean unescape; /** Token builder for string literals. */ private final TokenBuilder tb = new TokenBuilder(); /** * Constructor taking the input string and the spec according to which it is parsed. * @param in input string * @param s JSON spec * @param u unescape flag * @param ii input info */ private JsonParser(final String in, final Spec s, final boolean u, final InputInfo ii) { super(in); spec = s != null ? s : Spec.RFC4627; unescape = u; info = ii; } /** * Parses the input JSON string and directs the parse events to the given handler. * @param json JSON string to parse * @param sp JSON spec to use * @param unesc unescape flag * @param h JSON handler * @param ii input info * @throws QueryException parse exception */ public static void parse(final String json, final Spec sp, final boolean unesc, final JsonHandler h, final InputInfo ii) throws QueryException { new JsonParser(json, sp, unesc, ii).parse(h); } /** * Parses a JSON expression. * @param h handler * @throws QueryException parse exception */ private void parse(final JsonHandler h) throws QueryException { skipWs(); if(spec == Spec.RFC4627 && !(curr() == '{' || curr() == '[')) throw error("Expected '{' or '[', found %", rest()); value(h); if(more()) throw error("Unexpected trailing content: %", rest()); } /** * Parses a JSON value. * @param h handler * @throws QueryException query exception */ private void value(final JsonHandler h) throws QueryException { if(pos >= length) throw eof(", expected JSON value."); switch(curr()) { case '[': array(h); break; case '{': object(h); break; case '"': // string h.stringLit(string()); break; case '-': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': // number h.numberLit(number()); break; default: // boolean, null or constructor if(consume("true")) h.booleanLit(true); else if(consume("false")) h.booleanLit(false); else if(consume("null")) h.nullLit(); else if(spec == Spec.LIBERAL && consume("new") && Character.isWhitespace(curr())) constr(h); else throw error("Unexpected JSON value: '%'.", rest()); skipWs(); } } /** * Parses a JSON object. * @param h handler * @throws QueryException query exception */ private void object(final JsonHandler h) throws QueryException { consumeWs('{', true); h.openObject(); if(!consumeWs('}', false)) { do { h.openEntry(spec != Spec.LIBERAL || curr() == '"' ? string() : unquoted()); consumeWs(':', true); value(h); h.closeEntry(); } while(consumeWs(',', false) && !(spec == Spec.LIBERAL && curr() == '}')); consumeWs('}', true); } h.closeObject(); } /** * Parses a JSON array. * @param h handler * @throws QueryException query exception */ private void array(final JsonHandler h) throws QueryException { consumeWs('[', true); h.openArray(); if(!consumeWs(']', false)) { do { h.openArrayEntry(); value(h); h.closeArrayEntry(); } while(consumeWs(',', false) && !(spec == Spec.LIBERAL && curr() == ']')); consumeWs(']', true); } h.closeArray(); } /** * Parses a JSON constructor function. * @param h handler * @throws QueryException query exception */ private void constr(final JsonHandler h) throws QueryException { skipWs(); if(!input.substring(pos).matches("^[a-zA-Z0-9_-]+\\(.*")) throw error("Wrong constructor syntax: '%'", rest()); final int p = input.indexOf('(', pos); h.openConstr(token(input.substring(pos, p))); pos = p + 1; skipWs(); if(!consumeWs(')', false)) { do { h.openArg(); value(h); h.closeArg(); } while(consumeWs(',', false)); consumeWs(')', true); } h.closeConstr(); } /** * Reads an unquoted string literal. * @return the string * @throws QueryException query exception */ private byte[] unquoted() throws QueryException { int cp = more() ? input.codePointAt(pos) : -1; if(cp < 0 || !Character.isJavaIdentifierStart(cp)) throw error("Expected unquoted string, found %.", rest()); tb.reset(); do { tb.add(cp); cp = input.codePointAt(pos += cp < 0x10000 ? 1 : 2); } while(Character.isJavaIdentifierPart(cp)); skipWs(); return tb.finish(); } /** * Parses a number literal. * @return string representation * @throws QueryException query exception */ private byte[] number() throws QueryException { tb.reset(); // integral part int c = consume(); tb.addByte((byte) c); if(c == '-') { c = consume(); if(c < '0' || c > '9') throw error("Number expected after '-'."); tb.addByte((byte) c); } final boolean zero = c == '0'; c = curr(); if(zero && c >= '0' && c <= '9') throw error("No digit allowed after '0'."); loop: while(true) { switch(c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': tb.addByte((byte) c); pos++; c = curr(); break; case '.': case 'e': case 'E': break loop; default: skipWs(); return tb.finish(); } } if(consume('.')) { tb.addByte((byte) '.'); c = curr(); if(c < '0' || c > '9') throw error("Number expected after '.'."); do { tb.addByte((byte) c); pos++; c = curr(); } while(c >= '0' && c <= '9'); if(c != 'e' && c != 'E') { skipWs(); return tb.finish(); } } // 'e' or 'E' tb.addByte((byte) consume()); c = curr(); if(c == '-' || c == '+') { tb.addByte((byte) consume()); c = curr(); } if(c < '0' || c > '9') throw error("Exponent expected."); do tb.addByte((byte) consume()); while((c = curr()) >= '0' && c <= '9'); skipWs(); return tb.finish(); } /** * Parses a string literal. * @return the string * @throws QueryException query exception */ private byte[] string() throws QueryException { if(!consume('"')) throw error("Expected string, found '%'", curr()); tb.reset(); char hi = 0; // cached high surrogate while(pos < length) { int cp = consume(); if(cp == '"') { if(hi != 0) tb.add(hi); skipWs(); return tb.finish(); } if(cp == '\\') { if(!unescape) { if(hi != 0) { tb.add(hi); hi = 0; } tb.addByte((byte) '\\'); } final int n = consume(); switch(n) { case '/': case '\\': case '"': cp = n; break; case 'b': cp = unescape ? '\b' : 'b'; break; case 'f': cp = unescape ? '\f' : 'f'; break; case 't': cp = unescape ? '\t' : 't'; break; case 'r': cp = unescape ? '\r' : 'r'; break; case 'n': cp = unescape ? '\n' : 'n'; break; case 'u': if(pos + 4 >= length) throw eof(", expected four-digit hex value"); if(unescape) { cp = 0; for(int i = 0; i < 4; i++) { final char x = consume(); if(x >= '0' && x <= '9') cp = 16 * cp + x - '0'; else if(x >= 'a' && x <= 'f') cp = 16 * cp + x + 10 - 'a'; else if(x >= 'A' && x <= 'F') cp = 16 * cp + x + 10 - 'A'; else throw error("Illegal hexadecimal digit: '%'", x); } } else { tb.addByte((byte) 'u'); for(int i = 0; i < 4; i++) { final char x = consume(); if(x >= '0' && x <= '9' || x >= 'a' && x <= 'f' || x >= 'A' && x <= 'F') { if(i < 3) tb.addByte((byte) x); else cp = x; } else throw error("Illegal hexadecimal digit: '%'", x); } } break; default: throw error("Unknown character escape: '\\%'", n); } } else if(spec != Spec.LIBERAL && cp <= 0x1F) { throw error("Non-escaped control character: '\\%'", CTRL[cp]); } if(hi != 0) { if(cp >= 0xDC00 && cp <= 0xDFFF) cp = (hi - 0xD800 << 10) + cp - 0xDC00 + 0x10000; else tb.add(hi); hi = 0; } if(cp >= 0xD800 && cp <= 0xDBFF) hi = (char) cp; else tb.add(cp); } throw eof(" in string literal"); } /** Consumes all whitespace characters from the remaining query. */ private void skipWs() { while(pos < length) { switch(input.charAt(pos)) { case ' ': case '\t': case '\r': case '\n': case '\u00A0': // non-breaking space pos++; break; default: return; } } } /** * Tries to consume the given character. If successful, following whitespace is skipped. * Otherwise if the error flag is set a parse error is thrown. * @param c character to be consumed * @param err error flag * @return if the character was consumed * @throws QueryException parse error */ private boolean consumeWs(final char c, final boolean err) throws QueryException { if(consume() != c) { pos--; if(err) throw error("Expected '%', found '%'", c, curr()); return false; } skipWs(); return true; } /** * Throws an end-of-input error. * @param desc description * @return never * @throws QueryException query exception */ private QueryException eof(final String desc) throws QueryException { throw error("Unexpected end of input%.", desc); } /** * Raises an error with the specified message. * @param msg error message * @param ext error details * @return build exception * @throws QueryException query exception */ private QueryException error(final String msg, final Object... ext) throws QueryException { final int[] lc = new InputInfo(this).lineCol(); throw BXJS_PARSE.thrw(info, lc[0], lc[1], Util.inf(msg, ext)); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/json/JsonStringConverter.java000066400000000000000000000073241222453003200311330ustar00rootroot00000000000000package org.basex.query.util.json; import org.basex.query.*; import org.basex.query.util.json.JsonParser.*; import org.basex.util.*; /** * Writes the parsed JSON file to the given {@link TokenBuilder}. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class JsonStringConverter implements JsonHandler { /** The token builder. */ private final TokenBuilder tb; /** Flag for first array entry, object member or constructor argument. */ private boolean first = true; /** * Constructor. * @param builder the token builder */ private JsonStringConverter(final TokenBuilder builder) { tb = builder; } /** * Writes a pretty-printed representation of the given JSON string to the given builder. * @param json JSON string * @param spec JSON spec for parsing * @param un unescape flag * @param tb token builder * @return the token builder * @throws QueryException parse exception */ public static TokenBuilder print(final String json, final Spec spec, final boolean un, final TokenBuilder tb) throws QueryException { JsonParser.parse(json, spec, un, new JsonStringConverter(tb), null); return tb; } @Override public void openObject() throws QueryException { tb.add("{ "); first = true; } @Override public void openEntry(final byte[] key) throws QueryException { if(!first) tb.add(", "); stringLit(key); tb.add(": "); } @Override public void closeEntry() throws QueryException { first = false; } @Override public void closeObject() throws QueryException { tb.add(first ? "}" : " }"); } @Override public void openArray() throws QueryException { tb.add("[ "); first = true; } @Override public void openArrayEntry() throws QueryException { if(!first) tb.add(", "); } @Override public void closeArrayEntry() throws QueryException { first = false; } @Override public void closeArray() throws QueryException { tb.add(first ? "]" : " ]"); } @Override public void openConstr(final byte[] name) throws QueryException { tb.add("new ").add(name).addByte((byte) '('); first = true; } @Override public void openArg() throws QueryException { if(!first) tb.add(", "); } @Override public void closeArg() throws QueryException { first = false; } @Override public void closeConstr() throws QueryException { tb.addByte((byte) ')'); } @Override public void numberLit(final byte[] value) throws QueryException { tb.add(value); } @Override public void stringLit(final byte[] value) { tb.addByte((byte) '"'); for(int i = 0; i < value.length; i += Token.cl(value, i)) { final int cp = Token.cp(value, i); switch(cp) { case '\\': case '"': tb.addByte((byte) '\\').addByte((byte) cp); break; case '\b': tb.add("\\b"); break; case '\f': tb.add("\\f"); break; case '\t': tb.add("\\t"); break; case '\r': tb.add("\\r"); break; case '\n': tb.add("\\n"); break; default: if(Character.isISOControl(cp)) { tb.addByte((byte) '\\').addByte((byte) 'u'); for(int j = 4; --j >= 0;) { final int hex = cp >>> (j << 2) & 0xF; tb.addByte((byte) (hex + (hex > 9 ? 'A' - 10 : '0'))); } } else { tb.add(cp); } } } tb.addByte((byte) '"'); } @Override public void nullLit() throws QueryException { tb.add("null"); } @Override public void booleanLit(final boolean b) throws QueryException { tb.add(b ? "true" : "false"); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/package.html000066400000000000000000000000521222453003200255770ustar00rootroot00000000000000 XQuery utility classes. basex-7.7.2/basex-core/src/main/java/org/basex/query/util/pkg/000077500000000000000000000000001222453003200241025ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/util/pkg/JarDesc.java000066400000000000000000000005401222453003200262570ustar00rootroot00000000000000package org.basex.query.util.pkg; import org.basex.util.list.*; /** * Jar descriptor. * * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ public final class JarDesc { /** List of jar files. */ public final TokenList jars = new TokenList(); /** List of public classes. */ final TokenList classes = new TokenList(); } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/pkg/JarParser.java000066400000000000000000000033361222453003200266430ustar00rootroot00000000000000package org.basex.query.util.pkg; import static org.basex.query.util.Err.*; import static org.basex.query.util.pkg.PkgText.*; import static org.basex.util.Token.*; import java.io.*; import org.basex.core.*; import org.basex.io.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.util.*; /** * Parses the jar descriptors and performs schema checks. * * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ public final class JarParser { /** Context. */ private final Context context; /** Input info. */ private final InputInfo info; /** * Constructor. * @param ctx database context * @param ii input info */ public JarParser(final Context ctx, final InputInfo ii) { context = ctx; info = ii; } /** * Parses a jar descriptor. * @param io XML input * @return jar descriptor container * @throws QueryException query exception */ public JarDesc parse(final IO io) throws QueryException { final JarDesc desc = new JarDesc(); try { final ANode node = new DBNode(io, context.prop).children().next(); for(final ANode next : node.children()) { final QNm name = next.qname(); // ignore namespace to improve compatibility if(eq(JAR, name.local())) desc.jars.add(next.string()); else if(eq(CLASS, name.local())) desc.classes.add(next.string()); // [CG] Packaging: add warning if unknown elements are encountered } if(desc.jars.isEmpty()) BXRE_JARDESC.thrw(info, NOJARS); else if(desc.classes.isEmpty()) BXRE_JARDESC.thrw(info, NOCLASS); return desc; } catch(final IOException ex) { throw BXRE_JARFAIL.thrw(info, ex); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/pkg/ModuleLoader.java000066400000000000000000000251611222453003200273260ustar00rootroot00000000000000package org.basex.query.util.pkg; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.lang.reflect.*; import java.net.*; import java.util.*; import org.basex.core.*; import org.basex.io.*; import org.basex.query.*; import org.basex.query.util.pkg.Package.Component; import org.basex.query.util.pkg.Package.Dependency; import org.basex.util.*; import org.basex.util.hash.*; /** * Module loader. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ModuleLoader { /** Default class loader. */ private static final ClassLoader LOADER = Thread.currentThread().getContextClassLoader(); /** Cached URLs to be added to the class loader. */ private final ArrayList urls = new ArrayList(); /** Current class loader. */ private ClassLoader loader = LOADER; /** Java modules. */ private HashMap> javaModules; /** Database context. */ private final Context context; /** * Constructor. * @param ctx database context */ public ModuleLoader(final Context ctx) { context = ctx; } /** * Closes opened jar files. */ public void close() { if(loader instanceof JarLoader) ((JarLoader) loader).close(); } /** * Adds a package from the repository or a Java class. * @param uri module uri * @param ii input info * @param qp query parser * @return if the package has been found * @throws QueryException query exception */ public boolean addImport(final byte[] uri, final InputInfo ii, final QueryParser qp) throws QueryException { // add EXPath package final TokenSet pkgs = context.repo.nsDict().get(uri); if(pkgs != null) { Version ver = null; byte[] nm = null; for(final byte[] name : pkgs) { final Version v = new Version(Package.version(name)); if(ver == null || v.compareTo(ver) > 0) { ver = v; nm = name; } } if(nm != null) { addRepo(nm, new TokenSet(), new TokenSet(), ii, qp); return true; } } // search module in repository: rewrite URI to file path final boolean java = startsWith(uri, JAVAPREF); String uriPath = uri2path(string(java ? substring(uri, JAVAPREF.length) : uri)); if(uriPath == null) return false; if(!java) { // no "java:" prefix: first try to import module as XQuery final String path = context.mprop.get(MainProp.REPOPATH) + uriPath; // check for any file with XQuery suffix for(final String suf : IO.XQSUFFIXES) { if(addModule(new IOFile(path + suf), uri, qp)) return true; } } // "java:" prefix, or no XQuery package found: try to load Java module uriPath = capitalize(uriPath); final String path = context.mprop.get(MainProp.REPOPATH) + uriPath; final IOFile file = new IOFile(path + IO.JARSUFFIX); if(file.exists()) addURL(file); // try to create Java class instance addJava(uriPath, uri, ii); return true; } /** * Returns a reference to the specified class. * @param clz fully classified class name * @return found class, or {@code null} * @throws Throwable any exception or error: {@link ClassNotFoundException}, * {@link LinkageError} or {@link ExceptionInInitializerError}. */ public Class findClass(final String clz) throws Throwable { // add cached URLs to class loader final int us = urls.size(); if(us != 0) { loader = new JarLoader(urls.toArray(new URL[us]), loader); urls.clear(); } // no external classes added: use default class loader return loader == LOADER ? Reflect.forName(clz) : Class.forName(clz, true, loader); } /** * Returns an instance of the specified Java module class. * @param clz class to be found * @return instance, or {@code null} */ public Object findImport(final String clz) { // check if class was imported as Java module if(javaModules != null) { for(final Object jm : javaModules.keySet()) { if(jm.getClass().getName().equals(clz)) return jm; } } return null; } // STATIC METHODS ===================================================================== /** *

Converts a URI to a directory path. The conversion is inspired by Zorba's * URI transformation * (http://www.zorba-xquery.com/html/documentation/2.2.0/zorba/uriresolvers):

*
    *
  • In the URI authority, the order of all substrings separated by dots is reversed. *
  • *
  • Dots in the authority and the path are replaced by slashes. * If no path exists, a single slash is appended.
  • *
  • If the resulting string ends with a slash, "index" is appended.
  • *
  • {@code null} is returned if the URI has an invalid syntax.
  • *
* @param uri namespace uri * @return path, or {@code null} */ public static String uri2path(final String uri) { try { final URI u = new URI(uri); final TokenBuilder tb = new TokenBuilder(); final String auth = u.getAuthority(); if(auth != null) { // reverse authority, replace dots by slashes final String[] comp = auth.split("\\."); for(int c = comp.length - 1; c >= 0; c--) tb.add('/').add(comp[c]); } else { tb.add('/'); } // add remaining path String path = u.getPath(); if(path == null) return null; path = path.replace('.', '/'); // add slash or path tb.add(path.isEmpty() ? "/" : path); final String pth = tb.toString(); // add "index" string return pth.endsWith("/") ? pth + "index" : pth; } catch(final URISyntaxException ex) { Util.debug(ex); return null; } } /** * Capitalizes the last path segment. * @param path input path * @return capitalized path */ public static String capitalize(final String path) { final int i = path.lastIndexOf('/'); return i == -1 || i + 1 >= path.length() ? path : path.substring(0, i + 1) + Character.toUpperCase(path.charAt(i + 1)) + path.substring(i + 2); } // PRIVATE METHODS ==================================================================== /** * Parses the specified file as module if it exists. * @param file file to be added * @param uri namespace uri * @param qp query parser * @return {@code true} if file exists and was successfully parsed * @throws QueryException query exception */ private static boolean addModule(final IOFile file, final byte[] uri, final QueryParser qp) throws QueryException { if(!file.exists()) return false; qp.module(token(file.path()), uri); return true; } /** * Loads a Java class. * @param path file path * @param uri original URI * @param ii input info * @throws QueryException query exception */ private void addJava(final String path, final byte[] uri, final InputInfo ii) throws QueryException { final String cp = path.replace('/', '.').substring(1); Class clz = null; try { clz = findClass(cp); } catch(final ClassNotFoundException ex) { NOMODULE.thrw(ii, uri); // expected exception } catch(final Throwable th) { MODINIT.thrw(ii, th); } final boolean qm = clz.getSuperclass() == QueryModule.class; final Object jm = Reflect.get(clz); if(jm == null) NOINST.thrw(ii, cp); // add all public methods of the class (ignore methods from super classes) final ArrayList list = new ArrayList(); for(final Method m : clz.getMethods()) { // if class is inherited from {@link QueryModule}, no super methods are accepted if(!qm || m.getDeclaringClass() == clz) list.add(m); } // add class and its methods to module cache if(javaModules == null) javaModules = new HashMap>(); javaModules.put(jm, list); } /** * Adds a package from the package repository. * @param name package name * @param toLoad list with packages to be loaded * @param loaded already loaded packages * @param ii input info * @param qp query parser * @throws QueryException query exception */ private void addRepo(final byte[] name, final TokenSet toLoad, final TokenSet loaded, final InputInfo ii, final QueryParser qp) throws QueryException { // return if package is already loaded if(loaded.contains(name)) return; // find package in package dictionary final byte[] pDir = context.repo.pkgDict().get(name); if(pDir == null) BXRE_NOTINST.thrw(ii, name); final IOFile pkgDir = context.repo.path(string(pDir)); // parse package descriptor final IO pkgDesc = new IOFile(pkgDir, PkgText.DESCRIPTOR); if(!pkgDesc.exists()) Util.debug(PkgText.MISSDESC, string(name)); final Package pkg = new PkgParser(context.repo, ii).parse(pkgDesc); // check if package contains a jar descriptor final IOFile jarDesc = new IOFile(pkgDir, PkgText.JARDESC); // add jars to classpath if(jarDesc.exists()) addJar(jarDesc, pkgDir, string(pkg.abbrev), ii); // package has dependencies -> they have to be loaded first => put package // in list with packages to be loaded if(!pkg.dep.isEmpty()) toLoad.add(name); for(final Dependency d : pkg.dep) { if(d.pkg != null) { // we consider only package dependencies here final byte[] depPkg = new PkgValidator(context.repo, ii).depPkg(d); if(depPkg == null) { BXRE_NOTINST.thrw(ii, string(d.pkg)); } else { if(toLoad.contains(depPkg)) CIRCMODULE.thrw(ii); addRepo(depPkg, toLoad, loaded, ii, qp); } } } for(final Component comp : pkg.comps) { final String p = new IOFile(new IOFile(pkgDir, string(pkg.abbrev)), string(comp.file)).path(); qp.module(token(p), comp.uri); } if(toLoad.contains(name)) toLoad.delete(name); loaded.add(name); } /** * Adds the jar files registered in jarDesc. * @param jarDesc jar descriptor * @param pkgDir package directory * @param modDir module directory * @param ii input info * @throws QueryException query exception */ private void addJar(final IOFile jarDesc, final IOFile pkgDir, final String modDir, final InputInfo ii) throws QueryException { // add new URLs final JarDesc desc = new JarParser(context, ii).parse(jarDesc); for(final byte[] u : desc.jars) { addURL(new IOFile(new IOFile(pkgDir, modDir), string(u))); } } /** * Adds a URL to the cache. * @param jar jar file to be added */ private void addURL(final IOFile jar) { try { urls.add(new URL(jar.url())); } catch(final MalformedURLException ex) { Util.errln(ex); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/pkg/Package.java000066400000000000000000000054311222453003200263030ustar00rootroot00000000000000package org.basex.query.util.pkg; import static org.basex.util.Token.*; import java.io.*; import java.util.*; import org.basex.util.*; /** * Package. * * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ public final class Package { /** List of dependencies. */ public final ArrayList dep = new ArrayList(); /** Package components. */ public final ArrayList comps = new ArrayList(); /** Package short name. */ public byte[] abbrev; /** Package uri. */ byte[] name; /** Package version. */ byte[] version; /** Version of packaging specification the package conforms to. */ byte[] spec; /** * Returns a unique package name, consisting of the package URI and its version, * separated by a hyphen. * @return result */ byte[] uniqueName() { return new TokenBuilder(name).add('-').add(version).finish(); } /** * Extracts the package name from a unique package name. * @param pkg unique package name: name-version * @return package name */ public static byte[] name(final byte[] pkg) { final int idx = lastIndexOf(pkg, '-'); return idx == -1 ? pkg : subtoken(pkg, 0, idx); } /** * Extracts the package version from a unique package name. * @param pkg unique package name: name-version * @return package version */ public static byte[] version(final byte[] pkg) { final int idx = lastIndexOf(pkg, '-'); return subtoken(pkg, idx + 1, pkg.length); } /** * Package dependency. * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ static final class Dependency { /** Name of package a package depends on. */ byte[] pkg; /** Name of processor a package depends on. */ byte[] processor; /** Set of acceptable version. */ byte[] versions; /** SemVer template. */ byte[] semver; /** Minimum acceptable version. */ byte[] semverMin; /** Maximum acceptable version. */ byte[] semverMax; /** * Returns unique package name for secondary package using the given * version. * @param version version * @return unique name */ byte[] name(final byte[] version) { return new TokenBuilder(pkg).add('-').add(version).finish(); } } /** * Package component. * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ static final class Component { /** Namespace URI. */ byte[] uri; /** Component file. */ byte[] file; /** * Extracts component's file name from component's path. * @return component's name */ String name() { final String path = string(file); final int i = path.lastIndexOf(File.separator); return i == -1 ? path : path.substring(i + 1, path.length()); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/pkg/PkgParser.java000066400000000000000000000134371222453003200266530ustar00rootroot00000000000000package org.basex.query.util.pkg; import static org.basex.query.util.Err.*; import static org.basex.query.util.pkg.PkgText.*; import static org.basex.util.Token.*; import java.io.*; import org.basex.io.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.util.pkg.Package.Component; import org.basex.query.util.pkg.Package.Dependency; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Parses the package descriptors and performs schema checks. * * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ public final class PkgParser { /** Repository context. */ private final Repo repo; /** Input info. */ private final InputInfo info; /** * Constructor. * @param r repository context * @param ii input info */ public PkgParser(final Repo r, final InputInfo ii) { repo = r; info = ii; } /** * Parses package descriptor. * @param io XML input * @return package container * @throws QueryException query exception */ public Package parse(final IO io) throws QueryException { final Package pkg = new Package(); try { final byte[] content = io.read(); final DBNode doc = new DBNode(new IOContent(content), repo.context.prop); final ANode node = childElements(doc).next(); // checks root node if(!eqNS(PACKAGE, node.qname())) BXRE_DESC.thrw(info, Util.info(WHICHELEM, node.qname())); parseAttributes(node, pkg, PACKAGE); parseChildren(node, pkg); return pkg; } catch(final IOException ex) { throw BXRE_PARSE.thrw(info, io.name(), ex); } } /** * Parses the attributes of or . * @param node package node * @param p package container * @param root root node * @throws QueryException query exception */ private void parseAttributes(final ANode node, final Package p, final byte[] root) throws QueryException { final AxisIter atts = node.attributes(); for(ANode next; (next = atts.next()) != null;) { final byte[] name = next.name(); if(eq(A_NAME, name)) p.name = next.string(); else if(eq(A_ABBREV, name)) p.abbrev = next.string(); else if(eq(A_VERSION, name)) p.version = next.string(); else if(eq(A_SPEC, name)) p.spec = next.string(); else BXRE_DESC.thrw(info, Util.info(WHICHATTR, name)); } // check mandatory attributes if(p.name == null) BXRE_DESC.thrw(info, Util.info(MISSATTR, A_NAME, root)); if(p.version == null) BXRE_DESC.thrw(info, Util.info(MISSATTR, A_VERSION, root)); if(p.abbrev == null) BXRE_DESC.thrw(info, Util.info(MISSATTR, A_ABBREV, root)); if(p.spec == null) BXRE_DESC.thrw(info, Util.info(MISSATTR, A_SPEC, root)); } /** * Parses the children of . * @param node package node * @param p package container * @throws QueryException query exception */ private void parseChildren(final ANode node, final Package p) throws QueryException { final AxisIter ch = childElements(node); for(ANode next; (next = ch.next()) != null;) { final QNm name = next.qname(); if(eqNS(DEPEND, name)) p.dep.add(parseDependency(next)); else if(eqNS(XQUERY, name)) p.comps.add(parseComp(next)); } } /** * Parses . * @param node node to be parsed * @return dependency container * @throws QueryException query exception */ private Dependency parseDependency(final ANode node) throws QueryException { final AxisIter atts = node.attributes(); final Dependency d = new Dependency(); for(ANode next; (next = atts.next()) != null;) { final byte[] name = next.name(); if(eq(A_PACKAGE, name)) d.pkg = next.string(); else if(eq(A_PROCESSOR, name)) d.processor = next.string(); else if(eq(A_VERSIONS, name)) d.versions = next.string(); else if(eq(A_SEMVER, name)) d.semver = next.string(); else if(eq(A_SEMVER_MIN, name)) d.semverMin = next.string(); else if(eq(A_SEMVER_MAX, name)) d.semverMax = next.string(); else BXRE_DESC.thrw(info, Util.info(WHICHATTR, name)); } return d; } /** * Parses . * @param node xquery component * @return component container * @throws QueryException query exception */ private Component parseComp(final ANode node) throws QueryException { final AxisIter ch = childElements(node); final Component c = new Component(); for(ANode next; (next = ch.next()) != null;) { final QNm name = next.qname(); if(eqNS(A_NAMESPACE, name)) c.uri = next.string(); else if(eqNS(A_FILE, name)) c.file = next.string(); else BXRE_DESC.thrw(info, Util.info(WHICHELEM, name)); } // check mandatory children if(c.uri == null) BXRE_DESC.thrw(info, Util.info(MISSCOMP, A_NAMESPACE)); if(c.file == null) BXRE_DESC.thrw(info, Util.info(MISSCOMP, A_FILE)); return c; } /** * Returns an iterator on all child elements * (text and other nodes will be skipped). * @param node root node * @return child element iterator */ private static AxisIter childElements(final ANode node) { return new AxisIter() { /** Child iterator. */ final AxisIter ch = node.children(); @Override public ANode next() { while(true) { final ANode n = ch.next(); if(n == null || n.type == NodeType.ELM) return n; } } }; } /** * Checks if the specified name equals the qname and if it uses the packaging * namespace. * @param cmp input * @param name name to be compared * @return result of check */ private static boolean eqNS(final byte[] cmp, final QNm name) { return name.eq(new QNm(cmp, QueryText.PKGURI)); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/pkg/PkgText.java000066400000000000000000000050721222453003200263370ustar00rootroot00000000000000package org.basex.query.util.pkg; import static org.basex.util.Token.*; import org.basex.core.*; import org.basex.io.*; /** * This class assembles textual information for package handling. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public interface PkgText { /** JAR manifest file. */ String MANIFEST_MF = "META-INF/MANIFEST.MF"; /** Package descriptor. */ String DESCRIPTOR = "expath-pkg" + IO.XMLSUFFIX; /** Jar descriptor. */ String JARDESC = Text.NAMELC + IO.XMLSUFFIX; /** EXPath type. */ String EXPATH = "EXPath"; /** Internal type. */ String INTERNAL = "Internal"; /** root element. */ /** Element package. */ byte[] PACKAGE = token("package"); /** children. */ /** Element dependency. */ byte[] DEPEND = token("dependency"); /** Element xquery. */ byte[] XQUERY = token("xquery"); /** children. */ /** Attribute namespace. */ byte[] A_NAMESPACE = token("namespace"); /** Attribute file. */ byte[] A_FILE = token("file"); /** Jar descriptor children. */ /** element. */ byte[] JAR = token("jar"); /** element. */ byte[] CLASS = token("class"); /** attributes. */ /** Attribute name. */ byte[] A_NAME = token("name"); /** Attribute abbrev. */ byte[] A_ABBREV = token("abbrev"); /** Attribute version. */ byte[] A_VERSION = token("version"); /** Attribute spec. */ byte[] A_SPEC = token("spec"); /** attributes. */ /** Attribute package. */ byte[] A_PACKAGE = token("package"); /** Attribute processor. */ byte[] A_PROCESSOR = token("processor"); /** Attribute versions. */ byte[] A_VERSIONS = token("versions"); /** Attribute semver. */ byte[] A_SEMVER = token("semver"); /** Attribute semver-min. */ byte[] A_SEMVER_MIN = token("semver-min"); /** Attribute semver-max. */ byte[] A_SEMVER_MAX = token("semver-max"); /** Not expected initialization error. */ String MISSDESC = "Missing package descriptor for package '%'"; /** Attribute missing. */ String MISSATTR = "'%' attribute missing in '%' element"; /** Invalid attribute. */ String WHICHATTR = "Invalid attribute '%'"; /** Invalid element. */ String WHICHELEM = "Invalid element %"; /** Secondary package missing. */ String MISSSECOND = "Dependency not completely specified."; /** Component missing. */ String MISSCOMP = "Component '%' not specified"; /** No jars registered. */ String NOJARS = "No jars specified"; /** No public classes registered. */ String NOCLASS = "No public classes specified"; } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/pkg/PkgValidator.java000066400000000000000000000173541222453003200273460ustar00rootroot00000000000000package org.basex.query.util.pkg; import static org.basex.query.util.Err.*; import static org.basex.query.util.pkg.Package.*; import static org.basex.query.util.pkg.PkgText.*; import static org.basex.util.Token.*; import java.util.*; import org.basex.core.*; import org.basex.io.*; import org.basex.query.*; import org.basex.query.util.pkg.Package.Component; import org.basex.query.util.pkg.Package.Dependency; import org.basex.util.*; import org.basex.util.hash.*; /** * Package validator. This class executes some essential checks before the * installation of a package. * * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ public final class PkgValidator { /** Repository context. */ private final Repo repo; /** Input info. */ private final InputInfo info; /** * Constructor. * @param r repository context * @param ii input info */ public PkgValidator(final Repo r, final InputInfo ii) { repo = r; info = ii; } /** * Checks package descriptor and if packages involved in dependencies are * already installed. * @param pkg package * @throws QueryException query exception */ public void check(final Package pkg) throws QueryException { // check package dependencies checkDepends(pkg); // check package components checkComps(pkg); } /** * Checks dependency elements, if packages involved in dependencies are * already installed and if processor dependencies are fulfilled. * @param pkg package * @throws QueryException query exception */ private void checkDepends(final Package pkg) throws QueryException { final ArrayList procs = new ArrayList(); for(final Dependency dep : pkg.dep) { // first check of dependency elements are consistently defined in the // descriptor if(dep.pkg == null && dep.processor == null) BXRE_DESC.thrw(info, MISSSECOND); // if dependency involves a package, check if this package or an // appropriate version of it is installed if(dep.pkg != null && depPkg(dep) == null) BXRE_NOTINST.thrw(info, dep.pkg); // if dependency involves a processor, add it to the list with processor // dependencies if(dep.processor != null) procs.add(dep); } if(!procs.isEmpty()) checkProcs(procs); } /** * Checks if secondary package, i.e. package involved in a dependency is * already installed. * @param dep dependency * @return result */ public byte[] depPkg(final Dependency dep) { // get installed versions of secondary package final TokenSet instVers = new TokenSet(); for(final byte[] nextPkg : repo.pkgDict()) { if(nextPkg != null && startsWith(nextPkg, dep.pkg)) instVers.add(version(nextPkg)); } // check if an appropriate version is already installed final byte[] version = availVersion(dep, instVers); return version == null ? null : dep.name(version); } /** * Checks if current version of BaseX is among the processor dependencies. * @param procs processor dependencies * @throws QueryException query exception */ private void checkProcs(final ArrayList procs) throws QueryException { boolean supported = false; for(final Dependency d : procs) { if(!eq(lc(d.processor), token(Text.NAMELC))) { supported = false; break; } // extract version final int i = Prop.VERSION.indexOf(' '); final String v = i == -1 ? Prop.VERSION : Prop.VERSION.substring(0, i); // check if current version is acceptable for the dependency supported = availVersion(d, new TokenSet(token(v))) != null; } if(!supported) BXRE_VERSION.thrw(info); } /** * Checks compatibility of dependency version with installed version. * @param dep dependency * @param versions current versions - either currently installed versions * for a package or current version of BaseX * @return available appropriate version */ private static byte[] availVersion(final Dependency dep, final TokenSet versions) { if(versions.isEmpty()) return null; if(dep.versions != null) { // get acceptable versions for secondary package/processor final TokenSet versList = new TokenSet(split(dep.versions, ' ')); // check if any acceptable version is already installed for(final byte[] v : versList) if(versions.contains(v)) return v; } else if(dep.semver != null) { // version template - version of secondary package or BaseX version must // be compatible with the defined template final Version semVer = new Version(dep.semver); for(final byte[] v : versions) if(new Version(v).isCompatible(semVer)) return v; } else if(dep.semverMin != null && dep.semverMax != null) { // version templates for minimal and maximal acceptable version - version // of secondary package or BaseX version must be equal or above // the minimal and strictly below the maximal final Version min = new Version(dep.semverMin); final Version max = new Version(dep.semverMax); for(final byte[] nextVer : versions) { final Version v = new Version(nextVer); if(v.compareTo(min) >= 0 && v.compareTo(max) < 0) return nextVer; } } else if(dep.semverMin != null) { // version template for minimal acceptable version - version of secondary // package or BaseX version must be either compatible with this template // or greater than it final Version semVer = new Version(dep.semverMin); for(final byte[] nextVer : versions) { final Version v = new Version(nextVer); if(v.isCompatible(semVer) || v.compareTo(semVer) >= 0) return nextVer; } } else if(dep.semverMax != null) { // version template for maximal acceptable version - version of secondary // package or BaseX version must be either compatible with this template // or smaller than it final Version semVer = new Version(dep.semverMax); for(final byte[] nextVer : versions) { final Version v = new Version(nextVer); if(v.isCompatible(semVer) || v.compareTo(semVer) <= 0) return nextVer; } } else { // no versioning attribute is specified => any version of the secondary // package is acceptable return versions.key(1); } return null; } /** * Checks consistency of components and if components are already installed as * part of other packages. * @param pkg package * @throws QueryException query exception */ private void checkComps(final Package pkg) throws QueryException { // modules other than xquery could be supported in future for(final Component comp : pkg.comps) { if(isInstalled(comp, pkg.name)) BXRE_INST.thrw(info, comp.name()); } } /** * Checks if an XQuery component is already installed as part of another * package. * @param comp component * @param name component's package * @return result * @throws QueryException query exception */ private boolean isInstalled(final Component comp, final byte[] name) throws QueryException { // get packages in which the module's namespace is found final TokenSet pkgs = repo.nsDict().get(comp.uri); if(pkgs == null) return false; for(final byte[] nextPkg : pkgs) { if(nextPkg != null && !eq(Package.name(nextPkg), name)) { // installed package is a different one, not just a different version // of the current one final String pkgDir = string(repo.pkgDict().get(nextPkg)); final IO pkgDesc = new IOFile(repo.path(pkgDir), DESCRIPTOR); final Package pkg = new PkgParser(repo, info).parse(pkgDesc); for(final Component nextComp : pkg.comps) { if(nextComp.name().equals(comp.name())) return true; } } } return false; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/pkg/Repo.java000066400000000000000000000101001222453003200256420ustar00rootroot00000000000000package org.basex.query.util.pkg; import static org.basex.query.util.pkg.PkgText.*; import static org.basex.util.Token.*; import org.basex.core.*; import org.basex.io.*; import org.basex.query.*; import org.basex.query.util.pkg.Package.Component; import org.basex.util.*; import org.basex.util.hash.*; /** * EXPath repository context. * * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ public final class Repo { /** Database context. */ final Context context; /** Namespace-dictionary with all namespaces (unique names) available * in the repository, and the packages in which they are found. */ private final TokenObjMap nsDict = new TokenObjMap(); /** Package dictionary with installed packages and their directories. */ private final TokenMap pkgDict = new TokenMap(); /** Repository path; will be initialized after first call. */ private IOFile path; /** * Constructor. * @param ctx database context */ public Repo(final Context ctx) { context = ctx; } /** * Returns the path to the repository. * @return dictionary */ public IOFile path() { return init().path; } /** * Returns the namespace dictionary. * @return dictionary */ public TokenObjMap nsDict() { return init().nsDict; } /** * Returns the package dictionary. * @return dictionary */ public TokenMap pkgDict() { return init().pkgDict; } /** * Returns the path to the specified repository package. * @param pkg package * @return file reference */ public IOFile path(final String pkg) { return new IOFile(init().path, pkg); } /** * Adds a newly installed package to the namespace and package dictionaries. * @param pkg new package * @param dir new package directory */ synchronized void add(final Package pkg, final String dir) { init(); final byte[] name = pkg.uniqueName(); // update namespace dictionary for(final Component comp : pkg.comps) { final TokenSet dict = nsDict.get(comp.uri); if(dict != null) { dict.add(name); } else { nsDict.put(comp.uri, new TokenSet(name)); } } // update package dictionary pkgDict.put(name, token(dir)); } /** * Deletes a package from the namespace and package dictionaries when it is deleted. * @param pkg deleted package */ synchronized void delete(final Package pkg) { init(); final byte[] name = pkg.uniqueName(); // delete package from namespace dictionary for(final Component comp : pkg.comps) { final byte[] uri = comp.uri; final TokenSet pkgs = nsDict.get(uri); if(pkgs.size() > 1) { pkgs.delete(name); } else { nsDict.delete(uri); } } // delete package from package dictionary pkgDict.delete(name); } /** * Initializes the package repository. * @return self reference */ private Repo init() { if(path == null) { path = new IOFile(context.mprop.get(MainProp.REPOPATH)); for(final IOFile dir : path.children()) { if(dir.isDir()) readPkg(dir); } } return this; } /** * Reads a package descriptor and adds components namespaces to * namespace-dictionary and packages - to package dictionary. * @param dir package directory */ private void readPkg(final IOFile dir) { final IOFile desc = new IOFile(dir, DESCRIPTOR); if(!desc.exists()) return; try { final Package pkg = new PkgParser(context.repo, null).parse(desc); final byte[] name = pkg.uniqueName(); // read package components for(final Component comp : pkg.comps) { // add component's namespace to namespace dictionary if(comp.uri != null) { final TokenSet dict = nsDict.get(comp.uri); if(dict != null) { dict.add(name); } else { nsDict.put(comp.uri, new TokenSet(name)); } } } // add package to package dictionary pkgDict.put(name, token(dir.name())); } catch(final QueryException ex) { Util.errln(ex); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/pkg/RepoManager.java000066400000000000000000000245171222453003200271560ustar00rootroot00000000000000package org.basex.query.util.pkg; import static org.basex.core.Text.*; import static org.basex.query.util.Err.*; import static org.basex.query.util.pkg.PkgText.*; import static org.basex.util.Token.*; import java.io.*; import java.util.regex.*; import org.basex.core.*; import org.basex.io.*; import org.basex.io.in.*; import org.basex.query.*; import org.basex.query.util.pkg.Package.Dependency; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * Repository manager. * * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ public final class RepoManager { /** Main-class pattern. */ private static final Pattern MAIN_CLASS = Pattern.compile("^Main-Class: *(.+?) *$"); /** Repository context. */ private final Repo repo; /** Input info. */ private InputInfo info; /** * Constructor. * @param ctx database context */ public RepoManager(final Context ctx) { repo = ctx.repo; } /** * Constructor. * @param ctx database context * @param ii input info */ public RepoManager(final Context ctx, final InputInfo ii) { this(ctx); info = ii; } /** * Installs a package. * @param path package path * @return {@code true} if package was replaced * @throws QueryException query exception */ public boolean install(final String path) throws QueryException { // check if package exists, and cache contents final IO io = IO.get(path); byte[] cont = null; try { cont = io.read(); } catch(final IOException ex) { Util.debug(ex); BXRE_WHICH.thrw(info, path); } try { if(io.hasSuffix(IO.XQSUFFIXES)) return installXQ(cont, path); if(io.hasSuffix(IO.JARSUFFIX)) return installJAR(cont); return installXAR(cont); } catch(final IOException ex) { throw BXRE_PARSE.thrw(info, io.name(), ex); } } /** * Returns all installed packages in a table. * @return table */ public Table table() { final Table t = new Table(); t.description = PACKAGES_X; t.header.add(NAME); t.header.add(VERSINFO); t.header.add(TYPE); t.header.add(PATH); final TokenMap pkg = repo.pkgDict(); // traverse EXPath packages for(final byte[] p : pkg) { if(p != null) t.contents.add(entry(string(Package.name(p)), string(Package.version(p)), EXPATH, string(pkg.get(p)))); } // traverse all directories, ignore root entries with dashes for(final IOFile ch : repo.path().children()) { final String n = ch.name(); if(!ch.isDir()) { t.contents.add(entry(n.replaceAll("\\..*", ""). replace('/', '.'), "-", INTERNAL, n)); } else if(n.indexOf('-') == -1) { for(final String s : ch.descendants()) { t.contents.add(entry(n + '.' + s.replaceAll("\\..*", "").replace('/', '.'), "-", INTERNAL, n + '/' + s)); } } } return t.sort(); } /** * Adds a single table entry. * @param name package name * @param version package version * @param type package type * @param path package path * @return new entry */ private static TokenList entry(final String name, final String version, final String type, final String path) { final TokenList tl = new TokenList(); tl.add(name); tl.add(version); tl.add(type); tl.add(path); return tl; } /** * Returns a list of all packages. * @return packages */ public StringList list() { final StringList sl = new StringList(); // traverse EXPath packages for(final byte[] p : repo.pkgDict()) { if(p != null) sl.add(string(p)); } // traverse all directories, ignore root entries with dashes for(final IOFile ch : repo.path().children()) { final String n = ch.name(); if(!ch.isDir()) { sl.add(n.replaceAll("\\..*", "").replace('/', '.')); } else if(n.indexOf('-') == -1) { for(final String s : ch.descendants()) { sl.add(n + '.' + s.replaceAll("\\..*", "").replace('/', '.')); } } } return sl.sort(false); } /** * Removes a package from the package repository. * @param pkg package * @throws QueryException query exception */ public void delete(final String pkg) throws QueryException { boolean found = false; final TokenMap dict = repo.pkgDict(); final byte[] pp = token(pkg); for(final byte[] nextPkg : dict) { if(nextPkg == null) continue; // a package can be deleted by its name or the name suffixed with its version if(eq(nextPkg, pp) || eq(Package.name(nextPkg), pp)) { // check if package to be deleted participates in a dependency final byte[] primPkg = primary(nextPkg); if(primPkg != null) BXRE_DEP.thrw(info, string(primPkg), pkg); // clean package repository final IOFile f = repo.path(string(dict.get(nextPkg))); repo.delete(new PkgParser(repo, info).parse(new IOFile(f, DESCRIPTOR))); // package does not participate in a dependency => delete it if(!f.delete()) BXRE_DELETE.thrw(info, f); found = true; } } // traverse all files final IOFile file = file(pkg, repo); if(file != null) { if(!file.delete()) BXRE_DELETE.thrw(info, file); return; } if(!found) BXRE_WHICH.thrw(info, pkg); } /** * Looks for a file with the specified name. * @param name name * @param repo repository * @return file, or {@code null} */ public static IOFile file(final String name, final Repo repo) { // traverse all files, find exact matches IOFile path = new IOFile(repo.path(), name); for(final IOFile ch : path.dir().children()) { if(ch.name().equals(path.name())) return ch; } // traverse all files, find prefix matches path = new IOFile(repo.path(), name.replace('.', '/')); final String start = path.name() + '.'; for(final IOFile ch : path.dir().children()) { if(ch.name().startsWith(start)) return ch; } return null; } // PRIVATE METHODS ==================================================================== /** * Installs an XQuery module. * @param cont package content * @param path package path * @return {@code true} if existing package was replaced * @throws QueryException query exception * @throws IOException I/O exception */ private boolean installXQ(final byte[] cont, final String path) throws QueryException, IOException { // parse module to find namespace uri final Context ctx = repo.context; final byte[] uri = new QueryContext(ctx).parseLibrary(string(cont), path).name.uri(); // copy file to rewritten URI file path final String uriPath = ModuleLoader.uri2path(string(uri)); if(uriPath == null) BXRE_URI.thrw(info, uri); final IOFile rp = new IOFile(ctx.mprop.get(MainProp.REPOPATH)); final boolean exists = md(rp, uriPath); new IOFile(rp, uriPath + IO.XQMSUFFIX).write(cont); return exists; } /** * Installs a JAR package. * @param cont package content * @return {@code true} if existing package was replaced * @throws IOException I/O exception */ private boolean installJAR(final byte[] cont) throws IOException { final Zip zip = new Zip(new IOContent(cont)); final IOContent mf = new IOContent(zip.read(MANIFEST_MF)); final NewlineInput nli = new NewlineInput(mf); for(String s; (s = nli.readLine()) != null;) { final Matcher m = MAIN_CLASS.matcher(s); if(!m.find()) continue; // copy file to rewritten file path final IOFile rp = new IOFile(repo.context.mprop.get(MainProp.REPOPATH)); final String path = m.group(1).replace('.', '/'); final boolean exists = md(rp, path); new IOFile(rp, path + IO.JARSUFFIX).write(cont); return exists; } return false; } /** * Creates the package directory and deletes existing packages. * @param rp path to the repository * @param path file path * @return {@code true} if a package already existed */ private static boolean md(final IOFile rp, final String path) { final IOFile target = new IOFile(rp, path); final IOFile dir = target.dir(); dir.md(); final IOFile[] ch = dir.children(target.name() + ".*"); for(final IOFile c : ch) c.delete(); return ch.length != 0; } /** * Installs a XAR package. * @param cont package content * @return {@code true} if existing package was replaced * @throws QueryException query exception * @throws IOException I/O exception */ private boolean installXAR(final byte[] cont) throws QueryException, IOException { final Zip zip = new Zip(new IOContent(cont)); // parse and validate descriptor file final IOContent dsc = new IOContent(zip.read(DESCRIPTOR)); final Package pkg = new PkgParser(repo, info).parse(dsc); // remove existing package final byte[] name = pkg.uniqueName(); final boolean exists = repo.pkgDict().get(name) != null; if(exists) delete(string(name)); new PkgValidator(repo, info).check(pkg); // choose unique directory, unzip files and register repository final IOFile file = uniqueDir(string(name).replaceAll("[^\\w.-]+", "-")); zip.unzip(file); repo.add(pkg, file.name()); return exists; } /** * Returns a unique directory for the specified package. * @param n name * @return unique directory */ private IOFile uniqueDir(final String n) { String nm = n; int c = 0; do { final IOFile io = repo.path(nm); if(!io.exists()) return io; nm = n + '-' + ++c; } while(true); } /** * Checks if a package participates in a dependency. * @param pkgName package * @return package depending on the current one * @throws QueryException query exception */ private byte[] primary(final byte[] pkgName) throws QueryException { final TokenMap dict = repo.pkgDict(); for(final byte[] nextPkg : dict) { if(nextPkg != null && !eq(nextPkg, pkgName)) { // check only packages different from the current one final IOFile desc = new IOFile(repo.path(string(dict.get(nextPkg))), DESCRIPTOR); final Package pkg = new PkgParser(repo, info).parse(desc); final byte[] name = Package.name(pkgName); for(final Dependency dep : pkg.dep) // Check only package dependencies if(dep.pkg != null && eq(dep.pkg, name)) return Package.name(nextPkg); } } return null; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/unit/000077500000000000000000000000001222453003200243005ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/util/unit/Constants.java000066400000000000000000000025221222453003200271200ustar00rootroot00000000000000package org.basex.query.util.unit; import static org.basex.util.Token.*; /** * XQuery Unit tests. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public interface Constants { /** Annotation: test. */ byte[] TEST = token("test"); /** Annotation: skipped. */ byte[] IGNORE = token("ignore"); /** Annotation: before. */ byte[] BEFORE = token("before"); /** Annotation: before. */ byte[] AFTER = token("after"); /** Annotation: before. */ byte[] BEFORE_MODULE = token("before-module"); /** Annotation: before. */ byte[] AFTER_MODULE = token("after-module"); /** Annotation: expected. */ byte[] EXPECTED = token("expected"); /** Name: testsuites. */ String TESTSUITES = "testsuites"; /** Name: testsuite. */ String TESTSUITE = "testsuite"; /** Name: testcase. */ String TESTCASE = "testcase"; /** Name: failure. */ String FAILURE = "failure"; /** Name: error. */ String ERROR = "error"; /** Name: failure. */ String FAILURES = "failures"; /** Name: error. */ String ERRORS = "errors"; /** Name: skipped. */ String SKIPPED = "skipped"; /** Name: error. */ String TESTS = "tests"; /** Name: name. */ String NAME = "name"; /** Name: message. */ String MESSAGE = "message"; /** Name: type. */ String TYPE = "type"; /** Name: time. */ String TIME = "time"; } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/unit/Suite.java000066400000000000000000000031101222453003200262270ustar00rootroot00000000000000package org.basex.query.util.unit; import static org.basex.query.util.Err.*; import static org.basex.query.util.unit.Constants.*; import static org.basex.util.Token.*; import java.io.*; import org.basex.io.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.util.*; import org.basex.util.list.*; /** * XQuery Unit tests: Testing multiple modules. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class Suite { /** Query context. */ private final QueryContext ctx; /** Input info. */ private final InputInfo info; /** * Constructor. * @param ii input info * @param qc query context */ public Suite(final QueryContext qc, final InputInfo ii) { info = ii; ctx = qc; } /** * Tests all specified libraries. * @param libs locations of library modules * @return resulting value * @throws QueryException query exception */ public Item test(final TokenList libs) throws QueryException { final FElem suites = new FElem(TESTSUITES); for(final byte[] path : libs) { final IO io = IO.get(string(path)); if(!io.exists()) WHICHRES.thrw(info, path); try { final QueryContext qc = new QueryContext(ctx.context); try { qc.parseLibrary(string(io.read()), io.path()); qc.compile(); suites.add(new Unit(qc, info).test()); } finally { qc.close(); } } catch(final IOException ex) { throw IOERR.thrw(info, ex); } } return suites; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/util/unit/Unit.java000066400000000000000000000151611222453003200260660ustar00rootroot00000000000000package org.basex.query.util.unit; import static org.basex.query.util.Err.*; import static org.basex.query.util.unit.Constants.*; import static org.basex.util.Token.*; import java.util.*; import org.basex.query.*; import org.basex.query.func.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.util.*; /** * XQuery Unit tests: Testing single modules. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class Unit { /** Query context. */ private final QueryContext ctx; /** Input info. */ private final InputInfo info; /** Currently processed function. */ private StaticFunc current; /** * Constructor. * @param ii input info * @param qc query context */ public Unit(final QueryContext qc, final InputInfo ii) { info = ii; ctx = qc; } /** * Performs the test function. * @return resulting value * @throws QueryException query exception */ public FElem test() throws QueryException { final ArrayList funcs = new ArrayList(); for(final StaticFunc uf : ctx.funcs.funcs()) funcs.add(uf); return test(funcs); } /** * Performs the test function. * @param funcs functions to test * @return resulting value * @throws QueryException query exception */ public FElem test(final ArrayList funcs) throws QueryException { final FElem testsuite = new FElem(TESTSUITE).add(NAME, ctx.sc.baseURI().string()); int t = 0, e = 0, f = 0, s = 0; final ArrayList before = new ArrayList(1); final ArrayList after = new ArrayList(1); final ArrayList beforeModule = new ArrayList(1); final ArrayList afterModule = new ArrayList(1); final ArrayList tests = new ArrayList(1); // loop through all functions final Performance p = new Performance(); for(final StaticFunc uf : funcs) { // find Unit annotations final Ann ann = uf.ann; final int as = ann.size(); boolean xq = false; for(int a = 0; !xq && a < as; a++) { xq |= eq(ann.names[a].uri(), QueryText.UNITURI); } if(!xq) continue; // Unit function: if(uf.updating) UNIT_UPDATE.thrw(info, uf.name.local()); if(uf.args.length > 0) UNIT_ARGS.thrw(info, uf.name.local()); if(indexOf(uf, BEFORE) != -1) before.add(uf); if(indexOf(uf, AFTER) != -1) after.add(uf); if(indexOf(uf, BEFORE_MODULE) != -1) beforeModule.add(uf); if(indexOf(uf, AFTER_MODULE) != -1) afterModule.add(uf); if(indexOf(uf, TEST) != -1) tests.add(uf); } try { // call initializing functions before first test for(final StaticFunc uf : beforeModule) eval(uf); for(final StaticFunc uf : tests) { // check arguments final Value values = uf.ann.values[indexOf(uf, TEST)]; final long vs = values.size(); // expected error code byte[] code = null; if(vs != 0) { if(vs == 2 && eq(EXPECTED, values.itemAt(0).string(info))) { code = values.itemAt(1).string(info); } else { UNIT_ANN.thrw(info, '%', uf.ann.names[0]); } } final FElem testcase = new FElem(TESTCASE).add(NAME, uf.name.local()); t++; final Performance pt = new Performance(); final int skip = indexOf(uf, IGNORE); if(skip != -1) { // skip test final FElem skipped = new FElem(SKIPPED); final Value sv = uf.ann.values[skip]; if(sv.size() > 0) skipped.add(MESSAGE, sv.itemAt(0).string(info)); testcase.add(skipped); s++; } else { try { // call functions marked with "before" for(final StaticFunc fn : before) eval(fn); // call functions eval(uf); // call functions marked with "after" for(final StaticFunc fn : after) eval(fn); if(code != null) { f++; final FElem error = new FElem(FAILURE); error.add(MESSAGE, "Error expected."); error.add(TYPE, code); testcase.add(error); } } catch(final QueryException ex) { final QNm name = ex.qname(); if(code == null || !eq(code, name.local())) { final boolean failure = eq(name.uri(), QueryText.UNITURI); if(failure) f++; else e++; final FElem error = new FElem(failure ? FAILURE : ERROR); error.add(MESSAGE, ex.getLocalizedMessage()); error.add(TYPE, ex.qname().local()); testcase.add(error); } } } testcase.add(TIME, time(pt)); testsuite.add(testcase); } // run finalizing tests for(final StaticFunc uf : afterModule) eval(uf); } catch(final QueryException ex) { // handle initializers final FElem test = new FElem(TESTCASE).add(NAME, current.name.local()); test.add(TIME, time(p)); testsuite.add(test); } testsuite.add(TIME, time(p)); testsuite.add(TESTS, token(t)); testsuite.add(FAILURES, token(f)); testsuite.add(ERRORS, token(e)); testsuite.add(SKIPPED, token(s)); return testsuite; } /** * Evaluates a function. * @param fn function to evaluate * @throws QueryException query exception */ private void eval(final StaticFunc fn) throws QueryException { current = fn; final Iter ir = fn.invokeValue(ctx, info).iter(); for(Item it; (it = ir.next()) != null;) it.materialize(info); } /** * Checks if a unit annotation has been specified. * If positive, returns its offset in the annotation array. * * @param func user function * @param name name of annotation to be found * @return value * @throws QueryException query exception */ private int indexOf(final StaticFunc func, final byte[] name) throws QueryException { final Ann ann = func.ann; final int as = ann.size(); int pos = -1; for(int a = 0; a < as; a++) { final QNm nm = ann.names[a]; if(eq(nm.uri(), QueryText.UNITURI) && eq(nm.local(), name)) { if(pos != -1) UNIT_TWICE.thrw(info, '%', nm.local()); pos = a; } } return pos; } /** * Returns a token representation of the measured time. * * @param p performance * @return time */ private byte[] time(final Performance p) { return new DTDur(p.time() / 1000000).string(info); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/000077500000000000000000000000001222453003200234605ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/value/Value.java000066400000000000000000000116551222453003200254070ustar00rootroot00000000000000package org.basex.query.value; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import java.io.*; import java.util.*; import org.basex.data.*; import org.basex.io.out.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Abstract value. * * This class also implements the {@link Iterable} interface, which is why all of its * values can also be retrieved via enhanced for (for-each) loops. The default * {@link #iter()} method will provide better performance. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class Value extends Expr implements Iterable { /** Data type. */ public Type type; /** * Constructor. * @param t data type */ public Value(final Type t) { type = t; } @Override public final void checkUp() { } @Override public final Value compile(final QueryContext ctx, final VarScope scp) { return this; } @Override public final ValueIter iter(final QueryContext ctx) { return iter(); } @Override public final Iterator iterator() { return iter().iterator(); } /** * Returns an iterator. * @return iterator */ public abstract ValueIter iter(); @Override public final Value value(final QueryContext ctx) { return this; } /** * Returns the data reference (if) attached to this value. This method is overwritten * by {@link DBNode} and {@link DBNodeSeq}. * @return data reference */ public Data data() { return null; } @Override public final boolean isValue() { return true; } @Override public abstract long size(); /** * Returns a Java representation of the value. * @return Java object * @throws QueryException query exception */ public abstract Object toJava() throws QueryException; @Override public boolean has(final Flag flag) { return false; } @Override public final boolean removable(final Var v) { return true; } @Override public final VarUsage count(final Var v) { return VarUsage.NEVER; } @Override public Expr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { // values do not contain variable references return null; } @Override public Value copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return this; } @Override public String description() { return type + " " + SEQUENCE; } /** * Returns a hash code for this value. * @param ii input info * @return hash code * @throws QueryException if atomization can't be applied (e.g. function item) */ public abstract int hash(final InputInfo ii) throws QueryException; /** * Writes this value's items out to the given array. * @param arr array to write to * @param start start position * @return number of written items */ public abstract int writeTo(final Item[] arr, final int start); /** * Creates an {@link ValueBuilder}, containing all items of this value. * Use with care, as compressed Values are expanded, creating many objects. * @return cached items */ public final ValueBuilder cache() { final ValueBuilder vb = new ValueBuilder((int) size()); vb.size(writeTo(vb.item, 0)); return vb; } /** * Serializes the value, using the standard XML serializer, * and returns the cached result. * @return serialized value * @throws QueryException query exception */ public final ArrayOutput serialize() throws QueryException { final ArrayOutput ao = new ArrayOutput(); try { final Serializer ser = Serializer.get(ao); final ValueIter vi = iter(); for(Item it; (it = vi.next()) != null;) ser.serialize(it); ser.close(); } catch(final SerializerException ex) { throw ex.getCause(null); } catch(final IOException ex) { SERANY.thrw(null, ex); } return ao; } /** * Gets the item at the given position in the value. * @param pos position * @return item */ public abstract Item itemAt(final long pos); /** * Checks if all items of this value share the same type. * @return result of check */ public abstract boolean homogeneous(); @Override public boolean accept(final ASTVisitor visitor) { final Data data = data(); return data == null || visitor.lock(data.meta.name); } @Override public final int exprSize() { return 1; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/000077500000000000000000000000001222453003200244165ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/ADate.java000066400000000000000000000352071222453003200262460ustar00rootroot00000000000000package org.basex.query.value.item; import static org.basex.query.util.Err.*; import java.math.*; import java.util.*; import java.util.regex.*; import javax.xml.datatype.*; import org.basex.query.*; import org.basex.query.util.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Abstract super class for date items. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class ADate extends ADateDur { /** Maximum value for computations on year value based on long range. */ static final long MAX_YEAR = (long) (Long.MAX_VALUE / 365.2425) - 2; /** Minimum year value. */ static final long MIN_YEAR = -MAX_YEAR; /** Constant for counting negative years (divisible by 400). */ private static final long ADD_NEG = (MAX_YEAR / 400 + 1) * 400; /** Pattern for two digits. */ protected static final String DD = "(\\d{2})"; /** Year pattern. */ protected static final String YEAR = "(-?(000[1-9]|00[1-9]\\d|0[1-9]\\d{2}|[1-9]\\d{3,}))"; /** Date pattern. */ protected static final String ZONE = "((\\+|-)" + DD + ':' + DD + "|Z)?"; /** Day per months. */ protected static final byte[] DAYS = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; /** Date pattern. */ private static final Pattern DATE = Pattern.compile(YEAR + '-' + DD + '-' + DD + ZONE); /** Time pattern. */ private static final Pattern TIME = Pattern.compile( DD + ':' + DD + ':' + "(\\d{2}(\\.\\d+)?)" + ZONE); /** Year. *
    *
  • 1 - {@code Long#MAX_VALUE}-1: AD
  • *
  • 0 - {@link Long#MIN_VALUE}: BC, +1 added
  • *
  • {@link Long#MAX_VALUE}: undefined
  • *
*/ protected long yea = Long.MAX_VALUE; /** Month ({@code 0-11}). {@code -1}: undefined. */ protected byte mon = -1; /** Day ({@code 0-30}). {@code -1}: undefined. */ protected byte day = -1; /** Hour ({@code 0-59}). {@code -1}: undefined. */ protected byte hou = -1; /** Minute ({@code 0-59}). {@code -1}: undefined. */ protected byte min = -1; /** Timezone in minutes ({@code -14*60-14*60}). {@link Short#MAX_VALUE}: undefined. */ protected short zon = Short.MAX_VALUE; /** Data factory. */ public static DatatypeFactory df; static { try { df = DatatypeFactory.newInstance(); } catch(final Exception ex) { Util.notexpected(ex); } } /** * Constructor. * @param typ data type * @param d date reference */ ADate(final Type typ, final ADate d) { super(typ); yea = d.yea; mon = d.mon; day = d.day; hou = d.hou; min = d.min; sec = d.sec; zon = d.zon; } /** * Constructor. * @param typ data type */ ADate(final Type typ) { super(typ); } /** * Initializes the date format. * @param d input * @param e example format * @param ii input info * @throws QueryException query exception */ final void date(final byte[] d, final String e, final InputInfo ii) throws QueryException { final Matcher mt = DATE.matcher(Token.string(d).trim()); if(!mt.matches()) dateErr(d, e, ii); yea = toLong(mt.group(1), false, ii); // +1 is added to BC values to simplify computations if(yea < 0) yea++; mon = (byte) (Token.toInt(mt.group(3)) - 1); day = (byte) (Token.toInt(mt.group(4)) - 1); if(mon < 0 || mon >= 12 || day < 0 || day >= dpm(yea, mon)) dateErr(d, e, ii); if(yea <= MIN_YEAR || yea > MAX_YEAR) DATERANGE.thrw(ii, type, d); zone(mt, 5, d, ii); } /** * Initializes the time format. * @param d input format * @param e expected format * @param ii input info * @throws QueryException query exception */ final void time(final byte[] d, final String e, final InputInfo ii) throws QueryException { final Matcher mt = TIME.matcher(Token.string(d).trim()); if(!mt.matches()) dateErr(d, e, ii); hou = (byte) Token.toInt(mt.group(1)); min = (byte) Token.toInt(mt.group(2)); sec = toDecimal(mt.group(3), false, ii); if(min >= 60 || sec.compareTo(BD60) >= 0 || hou > 24 || hou == 24 && (min > 0 || sec.compareTo(BigDecimal.ZERO) > 0)) dateErr(d, e, ii); zone(mt, 5, d, ii); if(hou == 24) { hou = 0; add(DAYSECONDS); } } /** * Initializes the timezone. * @param mt matcher * @param p first matching position * @param val value * @param ii input info * @throws QueryException query exception */ final void zone(final Matcher mt, final int p, final byte[] val, final InputInfo ii) throws QueryException { final String tz = mt.group(p); if(tz == null) return; if(tz.equals("Z")) { zon = 0; } else { final int th = Token.toInt(mt.group(p + 2)); final int tm = Token.toInt(mt.group(p + 3)); if(th > 14 || tm > 59 || th == 14 && tm != 0) INVALIDZONE.thrw(ii, val); final int mn = th * 60 + tm; zon = (short) (mt.group(p + 1).equals("-") ? -mn : mn); } } /** * Adds/subtracts the specified dayTime duration. * @param dur duration * @param p plus/minus flag */ protected final void calc(final DTDur dur, final boolean p) { add(p ? dur.sec : dur.sec.negate()); } /** * Adds/subtracts the specified yearMonth duration. * @param dur duration * @param p plus/minus flag * @param ii input info * @throws QueryException query exception */ final void calc(final YMDur dur, final boolean p, final InputInfo ii) throws QueryException { final long m = p ? dur.mon : -dur.mon; final long mn = mon + m; mon = (byte) mod(mn, 12); yea = yea + div(mn, 12); day = (byte) Math.min(dpm(yea, mon) - 1, day); if(yea <= MIN_YEAR || yea > MAX_YEAR) DATEADDRANGE.thrw(ii, this); } /** * Adds the specified dayTime duration. * @param add value to be added */ private void add(final BigDecimal add) { // normalized modulo: sc % 60 vs. (-sc + sc % 60 + 60 + sc) % 60 final BigDecimal sc = sec().add(add); sec = sc.signum() >= 0 ? sc.remainder(BD60) : sc.negate().add(sc.remainder(BD60)).add(BD60).add(sc).remainder(BD60); final long mn = Math.max(min(), 0) + div(sc.longValue(), 60); min = (byte) mod(mn, 60); final long ho = Math.max(hou, 0) + div(mn, 60); hou = (byte) mod(ho, 24); final long da = div(ho, 24); final long[] ymd = ymd(days().add(BigDecimal.valueOf(da))); yea = ymd[0]; mon = (byte) ymd[1]; day = (byte) ymd[2]; } /** * Returns a normalized module value for negative and positive values. * @param i input value * @param m modulo * @return result */ private static long mod(final long i, final int m) { return i > 0 ? i % m : (Long.MAX_VALUE / m * m + i) % m; } /** * Returns a normalized division value for negative and positive values. * @param i input value * @param d divisor * @return result */ private static long div(final long i, final int d) { return i < 0 ? (i + 1) / d - 1 : i / d; } /** * Adjusts the timezone. * @param tz timezone * @param spec indicates if zone has been specified (can be {@code null}) * @param ii input info * @throws QueryException query exception */ public abstract void timeZone(final DTDur tz, final boolean spec, final InputInfo ii) throws QueryException; /** * Adjusts the timezone. * @param tz timezone * @param spec indicates if zone has been specified (can be {@code null}) * @param ii input info * @throws QueryException query exception */ protected void tz(final DTDur tz, final boolean spec, final InputInfo ii) throws QueryException { final short t; if(spec && tz == null) { t = Short.MAX_VALUE; } else { if(tz == null) { final Calendar c = Calendar.getInstance(); t = (short) ((c.get(Calendar.ZONE_OFFSET) + c.get(Calendar.DST_OFFSET)) / 60000); } else { t = (short) (tz.min() + tz.hou() * 60); if(tz.sec().signum() != 0) ZONESEC.thrw(ii, tz); if(Math.abs(t) > 60 * 14 || tz.day() != 0) INVALZONE.thrw(ii, tz); } // change time if two competing time zones exist if(zon != Short.MAX_VALUE) add(BigDecimal.valueOf(60 * (t - zon))); } zon = t; } @Override public final long yea() { return yea > 0 ? yea : yea - 1; } @Override public final long mon() { return mon + 1; } @Override public final long day() { return day + 1; } @Override public final long hou() { return hou; } @Override public final long min() { return min; } @Override public final BigDecimal sec() { return sec == null ? BigDecimal.ZERO : sec; } /** * Returns the timezone in minutes. * @return time zone */ public final int zon() { return zon; } @Override public byte[] string(final InputInfo ii) { final TokenBuilder tb = new TokenBuilder(); final boolean ymd = yea != Long.MAX_VALUE; if(ymd) { if(yea <= 0) tb.add('-'); prefix(tb, Math.abs(yea()), 4); tb.add('-'); prefix(tb, mon(), 2); tb.add('-'); prefix(tb, day(), 2); } if(hou >= 0) { if(ymd) tb.add('T'); prefix(tb, hou(), 2); tb.add(':'); prefix(tb, min(), 2); tb.add(':'); if(sec.intValue() < 10) tb.add('0'); tb.addExt(Token.chopNumber(Token.token(sec().abs().toPlainString()))); } zone(tb); return tb.finish(); } /** * Adds the time zone to the specified token builder. * @param tb token builder */ protected void zone(final TokenBuilder tb) { if(zon == Short.MAX_VALUE) return; if(zon == 0) { tb.add('Z'); } else { tb.add(zon > 0 ? '+' : '-'); prefix(tb, Math.abs(zon) / 60, 2); tb.add(':'); prefix(tb, Math.abs(zon) % 60, 2); } } /** * Prefixes the specified number of zero digits before a number. * @param tb token builder * @param n number to be printed * @param z maximum number of zero digits */ protected static void prefix(final TokenBuilder tb, final long n, final int z) { final byte[] t = Token.token(n); for(int i = t.length; i < z; i++) tb.add('0'); tb.add(t); } @Override public final boolean eq(final Item it, final Collation coll, final InputInfo ii) throws QueryException { final ADate d = (ADate) (it instanceof ADate ? it : type.cast(it, null, ii)); final BigDecimal d1 = seconds().add(days().multiply(DAYSECONDS)); final BigDecimal d2 = d.seconds().add(d.days().multiply(DAYSECONDS)); return d1.compareTo(d2) == 0; } @Override public int hash(final InputInfo ii) throws QueryException { return seconds().add(days().multiply(DAYSECONDS)).intValue(); } @Override public int diff(final Item it, final Collation coll, final InputInfo ii) throws QueryException { final ADate d = (ADate) (it instanceof ADate ? it : type.cast(it, null, ii)); final BigDecimal d1 = seconds().add(days().multiply(DAYSECONDS)); final BigDecimal d2 = d.seconds().add(d.days().multiply(DAYSECONDS)); return d1.compareTo(d2); } @Override public final XMLGregorianCalendar toJava() { return df.newXMLGregorianCalendar( yea != Long.MAX_VALUE ? BigInteger.valueOf(yea > 0 ? yea : yea - 1) : null, mon >= 0 ? mon + 1 : Integer.MIN_VALUE, day >= 0 ? day + 1 : Integer.MIN_VALUE, hou >= 0 ? hou : Integer.MIN_VALUE, min >= 0 ? min : Integer.MIN_VALUE, sec != null ? sec.intValue() : Integer.MIN_VALUE, sec != null ? sec.remainder(BigDecimal.ONE) : null, zon != Short.MAX_VALUE ? zon : Integer.MIN_VALUE); } /** * Returns the date in seconds. * @return seconds */ final BigDecimal seconds() { int z = zon; if(z == Short.MAX_VALUE) { // [CG] XQuery, DateTime: may be removed final long n = System.currentTimeMillis(); z = Calendar.getInstance().getTimeZone().getOffset(n) / 60000; } return (sec == null ? BigDecimal.ZERO : sec).add( BigDecimal.valueOf(Math.max(0, hou) * 3600 + Math.max(0, min) * 60 - z * 60)); } /** * Returns a day count. * @return days */ final BigDecimal days() { final long y = yea == Long.MAX_VALUE ? 1 : yea; return days(y + ADD_NEG, Math.max(mon, 0), Math.max(day, 0)); } /** * Returns a day count for the specified years, months and days. * All values must be specified in their internal representation * (undefined values are supported, too). * Algorithm is derived from J R Stockton (http://www.merlyn.demon.co.uk/daycount.htm). * @param yea year * @param mon month * @param day days * @return days */ public static BigDecimal days(final long yea, final int mon, final int day) { final long y = yea - (mon < 2 ? 1 : 0); final int m = mon + (mon < 2 ? 13 : 1); final int d = day + 1; return BD365.multiply(BigDecimal.valueOf(y)).add( BigDecimal.valueOf(y / 4 - y / 100 + y / 400 - 92 + d + (153 * m - 2) / 5)); } /** * Converts a day count into year, month and day components. * Algorithm is derived from J R Stockton (http://www.merlyn.demon.co.uk/daycount.htm). * @param days day count * @return result array */ private static long[] ymd(final BigDecimal days) { BigDecimal d = days; BigDecimal t = d.add(BD36525).multiply(BD4). divideToIntegralValue(BD146097).subtract(BigDecimal.ONE); BigDecimal y = BD100.multiply(t); d = d.subtract(BD36524.multiply(t).add(t.divideToIntegralValue(BD4))); t = d.add(BD366).multiply(BD4).divideToIntegralValue(BD1461).subtract(BigDecimal.ONE); y = y.add(t); d = d.subtract(BD365.multiply(t).add(t.divideToIntegralValue(BD4))); final BigDecimal m = BD5.multiply(d).add(BD2).divideToIntegralValue(BD153); d = d.subtract(BD153.multiply(m).add(BD2).divideToIntegralValue(BD5)); long mm = m.longValue(); if(mm > 9) { mm -= 12; y = y.add(BigDecimal.ONE); } return new long[] { y.subtract(BigDecimal.valueOf(ADD_NEG)).longValue(), mm + 2, d.longValue() }; } /** * Returns days per month, considering leap years. * @param yea year * @param mon month * @return days */ public static int dpm(final long yea, final int mon) { final byte l = DAYS[mon]; return mon == 1 && yea % 4 == 0 && (yea % 100 != 0 || yea % 400 == 0) ? l + 1 : l; } @Override public final String toString() { return Util.info("\"%\"", string(null)); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/ADateDur.java000066400000000000000000000101401222453003200267060ustar00rootroot00000000000000package org.basex.query.value.item; import static org.basex.query.util.Err.*; import java.math.*; import org.basex.query.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Abstract super class for dates and durations. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class ADateDur extends Item { /** Maximum long value. */ public static final BigDecimal BDMAXLONG = BigDecimal.valueOf(Long.MAX_VALUE); /** Seconds per day. */ protected static final BigDecimal DAYSECONDS = BigDecimal.valueOf(86400); /** BigDecimal: 146097. */ protected static final BigDecimal BD146097 = BigDecimal.valueOf(146097); /** BigDecimal: 36525. */ protected static final BigDecimal BD36525 = BigDecimal.valueOf(36525); /** BigDecimal: 36524. */ protected static final BigDecimal BD36524 = BigDecimal.valueOf(36524); /** BigDecimal: 60. */ protected static final BigDecimal BD3600 = BigDecimal.valueOf(3600); /** BigDecimal: 1461. */ protected static final BigDecimal BD1461 = BigDecimal.valueOf(1461); /** BigDecimal: 1000. */ protected static final BigDecimal BD1000 = BigDecimal.valueOf(1000); /** BigDecimal: 366. */ protected static final BigDecimal BD366 = BigDecimal.valueOf(366); /** BigDecimal: 365. */ protected static final BigDecimal BD365 = BigDecimal.valueOf(365); /** BigDecimal: 153. */ protected static final BigDecimal BD153 = BigDecimal.valueOf(153); /** BigDecimal: 100. */ protected static final BigDecimal BD100 = BigDecimal.valueOf(100); /** BigDecimal: 60. */ protected static final BigDecimal BD60 = BigDecimal.valueOf(60); /** BigDecimal: 5. */ protected static final BigDecimal BD5 = BigDecimal.valueOf(5); /** BigDecimal: 4. */ protected static final BigDecimal BD4 = BigDecimal.valueOf(4); /** BigDecimal: 2. */ protected static final BigDecimal BD2 = BigDecimal.valueOf(2); /** Seconds and milliseconds ({@code 0-59.\d+}). {@code -1}: undefined. */ public BigDecimal sec; /** * Constructor. * @param t data type */ protected ADateDur(final Type t) { super(t); } /** * Returns the years. * @return year */ public abstract long yea(); /** * Returns the months. * @return year */ public abstract long mon(); /** * Returns the days. * @return day */ public abstract long day(); /** * Returns the hours (0-23). * @return day */ public abstract long hou(); /** * Returns the minutes (0-59). * @return day */ public abstract long min(); /** * Returns the seconds (0-59), including the fractional part. * @return day */ public abstract BigDecimal sec(); /** * Throws a date format exception. * @param i input * @param ex example format * @param ii input info * @return never * @throws QueryException query exception */ protected final QueryException dateErr(final byte[] i, final String ex, final InputInfo ii) throws QueryException { throw DATEFORMAT.thrw(ii, type, i, ex); } /** * Date and durations: converts the specified string to an integer value. * Returns an exception if the value is invalid. * @param s string to be converted * @param dur duration * @param ii input info * @return long value * @throws QueryException query exception */ protected long toLong(final String s, final boolean dur, final InputInfo ii) throws QueryException { try { return Long.parseLong(s); } catch(final NumberFormatException ex) { throw (dur ? DURRANGE : DATERANGE).thrw(ii, type, s); } } /** * Date and durations: converts the specified string to a decimal value. * Returns an exception if the value is invalid. * @param s string to be converted * @param dur duration * @param ii input info * @return decimal * @throws QueryException query exception */ protected BigDecimal toDecimal(final String s, final boolean dur, final InputInfo ii) throws QueryException { try { return new BigDecimal(s); } catch(final NumberFormatException ex) { throw (dur ? DURRANGE : DATERANGE).thrw(ii, type, s); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/ANum.java000066400000000000000000000041321222453003200261210ustar00rootroot00000000000000package org.basex.query.value.item; import static java.lang.Float.*; import org.basex.query.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Abstract super class for all numeric items. * Useful for removing exceptions and unifying hash values. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public abstract class ANum extends Item { /** * Constructor. * @param t type */ ANum(final Type t) { super(t); } /* Removing "throws QueryException" */ @Override public final byte[] string(final InputInfo ii) { return string(); } @Override public final double dbl(final InputInfo ii) { return dbl(); } @Override public final long itr(final InputInfo ii) { return itr(); } @Override public final float flt(final InputInfo ii) { return flt(); } /** * Returns a string representation of the value. * @return string value */ public abstract byte[] string(); /** * Returns an integer (long) representation of the value. * @return long value */ public abstract long itr(); /** * Returns an double representation of the value. * @return double value */ public abstract double dbl(); /** * Returns an float representation of the value. * @return float value */ public abstract float flt(); @Override public Item test(final QueryContext ctx, final InputInfo ii) throws QueryException { return dbl() == ctx.pos ? this : null; } @Override public final int hash(final InputInfo ii) { // makes sure the hashing is good for very small and very big numbers final long l = itr(); final float f = flt(ii); // extract fractional part from a finite float final int frac = f == POSITIVE_INFINITY || f == NEGATIVE_INFINITY || isNaN(f) ? 0 : floatToIntBits(f - l); int h = frac ^ (int) (l ^ l >>> 32); // this part ensures better distribution of bits (from java.util.HashMap) h ^= h >>> 20 ^ h >>> 12; return h ^ h >>> 7 ^ h >>> 4; } @Override public final String toString() { return Token.string(string(null)); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/AStr.java000066400000000000000000000021511222453003200261310ustar00rootroot00000000000000package org.basex.query.value.item; import org.basex.query.*; import org.basex.query.util.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Abstract string item. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class AStr extends Item { /** * Constructor. */ protected AStr() { super(AtomType.STR); } /** * Constructor, specifying a type. * @param t atomic type */ protected AStr(final AtomType t) { super(t); } @Override public final boolean bool(final InputInfo ii) throws QueryException { return string(ii).length != 0; } @Override public final boolean eq(final Item it, final Collation coll, final InputInfo ii) throws QueryException { return coll == null ? Token.eq(string(ii), it.string(ii)) : coll.compare(string(ii), it.string(ii)) == 0; } @Override public final int diff(final Item it, final Collation coll, final InputInfo ii) throws QueryException { return coll == null ? Token.diff(string(ii), it.string(ii)) : coll.compare(string(ii), it.string(ii)); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/Atm.java000066400000000000000000000036771222453003200260170ustar00rootroot00000000000000package org.basex.query.value.item; import static org.basex.data.DataText.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.util.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.list.*; /** * Untyped atomic item ({@code xs:untypedAtomic}). * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Atm extends Item { /** String data. */ final byte[] val; /** * Constructor. * @param v value */ public Atm(final byte[] v) { super(AtomType.ATM); val = v; } /** * Constructor. * @param v value */ public Atm(final String v) { this(Token.token(v)); } @Override public byte[] string(final InputInfo ii) { return val; } @Override public boolean bool(final InputInfo ii) throws QueryException { return val.length != 0; } @Override public boolean eq(final Item it, final Collation coll, final InputInfo ii) throws QueryException { return it.type.isUntyped() ? coll == null ? Token.eq(val, it.string(ii)) : coll.compare(val, it.string(ii)) == 0 : it.eq(this, coll, ii); } @Override public int diff(final Item it, final Collation coll, final InputInfo ii) throws QueryException { return it.type.isUntyped() ? coll == null ? Token.diff(val, it.string(ii)) : coll.compare(val, it.string(ii)) : -it.diff(this, coll, ii); } @Override public boolean sameAs(final Expr cmp) { return cmp instanceof Atm && Token.eq(val, ((Atm) cmp).val); } @Override public String toJava() { return Token.string(val); } @Override public String toString() { final ByteList tb = new ByteList(); tb.add('"'); for(final byte v : val) { if(v == '&') tb.add(E_AMP); else tb.add(v); if(v == '"') tb.add(v); } return tb.add('"').toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/B64.java000066400000000000000000000040371222453003200256200ustar00rootroot00000000000000package org.basex.query.value.item; import static org.basex.query.util.Err.*; import org.basex.query.*; import org.basex.query.util.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Base64 item ({@code xs:base64Binary}). * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class B64 extends Bin { /** * Empty constructor. */ B64() { super(null, AtomType.B64); } /** * Constructor. * @param d binary data */ public B64(final byte[] d) { super(d, AtomType.B64); } /** * Constructor. * @param v textual representation * @param ii input info * @throws QueryException query exception */ public B64(final byte[] v, final InputInfo ii) throws QueryException { super(decode(v, ii), AtomType.B64); } /** * Constructor. * @param b base64 input * @param ii input info * @throws QueryException query exception */ public B64(final Bin b, final InputInfo ii) throws QueryException { this(b.binary(ii)); } @Override public byte[] string(final InputInfo ii) throws QueryException { return Base64.encode(binary(ii)); } @Override public final boolean eq(final Item it, final Collation coll, final InputInfo ii) throws QueryException { return Token.eq(binary(ii), it instanceof Bin ? ((Bin) it).binary(ii) : decode(it.string(ii), ii)); } /** * Converts the input into a byte array. * @param d textual data * @param ii input info * @return decoded string * @throws QueryException query exception */ private static byte[] decode(final byte[] d, final InputInfo ii) throws QueryException { try { return Base64.decode(d); } catch(final IllegalArgumentException ex) { final String chars = ex.getMessage().replaceAll("^.*?: |\\.$", ""); throw FUNCAST.thrw(ii, AtomType.B64, chars); } } @Override public String toString() { return Util.info("\"%\"", Base64.encode(data)); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/B64Stream.java000066400000000000000000000024401222453003200267700ustar00rootroot00000000000000package org.basex.query.value.item; import java.io.*; import org.basex.io.*; import org.basex.io.in.*; import org.basex.query.*; import org.basex.query.func.*; import org.basex.query.util.*; import org.basex.util.*; /** * Streamable base64 item ({@code xs:base64Binary}). * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class B64Stream extends B64 { /** File reference. */ private final IO input; /** Error message. */ private final Err error; /** * Constructor. * @param in input * @param err error message to be thrown */ public B64Stream(final IO in, final Err err) { input = in; error = err; } @Override public byte[] binary(final InputInfo ii) throws QueryException { try { return input.read(); } catch(final IOException ex) { throw error.thrw(ii, ex); } } @Override public BufferInput input(final InputInfo ii) throws QueryException { try { return new BufferInput(input); } catch(final IOException ex) { throw error.thrw(ii, ex); } } @Override public Item materialize(final InputInfo ii) throws QueryException { return new B64(binary(ii)); } @Override public String toString() { return Util.info(Function._FILE_READ_BINARY.args(input)); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/Bin.java000066400000000000000000000022461222453003200257750ustar00rootroot00000000000000package org.basex.query.value.item; import org.basex.io.in.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Abstract class for binary items. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class Bin extends Item { /** Binary data. */ byte[] data; /** * Constructor. * @param d binary data * @param t type */ Bin(final byte[] d, final Type t) { super(t); data = d; } /** * Returns the binary content. * @param ii input info * @return content * @throws QueryException query exception */ @SuppressWarnings("unused") public byte[] binary(final InputInfo ii) throws QueryException { return data; } @Override public BufferInput input(final InputInfo ii) throws QueryException { return new ArrayInput(data); } @Override public final byte[] toJava() throws QueryException { return binary(null); } @Override public final boolean sameAs(final Expr cmp) { if(!(cmp instanceof Bin)) return false; final Bin b = (Bin) cmp; return type == b.type && Token.eq(data, b.data); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/Bln.java000066400000000000000000000066011222453003200257770ustar00rootroot00000000000000package org.basex.query.value.item; import static org.basex.query.util.Err.*; import java.math.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.util.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Boolean item ({@code xs:boolean}). * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Bln extends Item { /** Static boolean item without scoring. */ public static final Bln TRUE = new Bln(true); /** Static boolean item without scoring. */ public static final Bln FALSE = new Bln(false); /** Data. */ private final boolean val; /** * Constructor, adding a full-text score. * @param b boolean value */ private Bln(final boolean b) { super(AtomType.BLN); val = b; } /** * Constructor, adding a full-text score. * @param b boolean value * @param s score value */ private Bln(final boolean b, final double s) { this(b); score = s; } /** * Constructor, adding a full-text score. * @param s score value * @return item */ public static Bln get(final double s) { return s == 0 ? FALSE : new Bln(true, s); } /** * Returns a static item instance. * @param b boolean value * @return item */ public static Bln get(final boolean b) { return b ? TRUE : FALSE; } @Override public byte[] string(final InputInfo ii) { return Token.token(val); } /** * Returns the string value. * @return string value */ public byte[] string() { return Token.token(val); } @Override public boolean bool(final InputInfo ii) { return val; } @Override public long itr(final InputInfo ii) { return val ? 1 : 0; } @Override public float flt(final InputInfo ii) { return val ? 1 : 0; } @Override public double dbl(final InputInfo ii) { return val ? 1 : 0; } @Override public BigDecimal dec(final InputInfo ii) { return val ? BigDecimal.ONE : BigDecimal.ZERO; } @Override public boolean eq(final Item it, final Collation coll, final InputInfo ii) throws QueryException { return val == (it.type == type ? it.bool(ii) : parse(it.string(ii), ii)); } @Override public int diff(final Item it, final Collation coll, final InputInfo ii) throws QueryException { final boolean n = it.type == type ? it.bool(ii) : parse(it.string(ii), ii); return val ? !n ? 1 : 0 : n ? -1 : 0; } @Override public Boolean toJava() { return val; } @Override public boolean sameAs(final Expr cmp) { return cmp instanceof Bln && val == ((Bln) cmp).val; } /** * Converts the specified string to a boolean. * @param str string to be checked * @param ii input info * @return result of check * @throws QueryException query exception */ public static boolean parse(final byte[] str, final InputInfo ii) throws QueryException { final byte[] s = Token.trim(str); if(Token.eq(s, Token.TRUE) || Token.eq(s, Token.ONE)) return true; if(Token.eq(s, Token.FALSE) || Token.eq(s, Token.ZERO)) return false; throw FUNCAST.thrw(ii, AtomType.BLN, str); } @Override public String toString() { return new TokenBuilder(val ? Token.TRUE : Token.FALSE). add("()").toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/DTDur.java000066400000000000000000000106521222453003200262470ustar00rootroot00000000000000package org.basex.query.value.item; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import java.math.*; import java.util.regex.*; import org.basex.query.*; import org.basex.query.util.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * DayTime Duration item ({@code xs:dayTimeDuration}). * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DTDur extends Dur { /** DayTime pattern. */ private static final Pattern DUR = Pattern.compile( "(-?)P(" + DP + "D)?(T(" + DP + "H)?(" + DP + "M)?((\\d+(\\.\\d+)?)S)?)?"); /** * Constructor. * @param d duration item */ public DTDur(final Dur d) { super(AtomType.DTD); sec = d.sec == null ? BigDecimal.ZERO : d.sec; } /** * Timezone constructor. * @param h hours * @param m minutes */ public DTDur(final long h, final long m) { super(AtomType.DTD); sec = BigDecimal.valueOf(h).multiply(BD60).add(BigDecimal.valueOf(m)).multiply(BD60); } /** * Timezone constructor. * @param ms milliseconds */ public DTDur(final long ms) { super(AtomType.DTD); sec = BigDecimal.valueOf(ms).divide(BD1000); } /** * Constructor. * @param it duration item * @param a duration to be added/subtracted * @param p plus/minus flag * @param ii input info * @throws QueryException query exception */ public DTDur(final DTDur it, final DTDur a, final boolean p, final InputInfo ii) throws QueryException { this(it); sec = p ? sec.add(a.sec) : sec.subtract(a.sec); final double d = sec.doubleValue(); if(d <= Long.MIN_VALUE || d >= Long.MAX_VALUE) DURADDRANGE.thrw(ii, type); } /** * Constructor. * @param it duration item * @param f factor * @param m multiplication flag * @param ii input info * @throws QueryException query exception */ public DTDur(final Dur it, final double f, final boolean m, final InputInfo ii) throws QueryException { this(it); if(Double.isNaN(f)) DATECALC.thrw(ii, description(), f); if(m ? Double.isInfinite(f) : f == 0) DATEZERO.thrw(ii, description()); if(m ? f == 0 : Double.isInfinite(f)) { sec = BigDecimal.ZERO; } else { BigDecimal d = BigDecimal.valueOf(f); try { sec = m ? sec.multiply(d) : sec.divide(d); } catch(final ArithmeticException ex) { // catching cases in which a computation yields no exact result; eg: // xs:dayTimeDuration("P1D") div xs:double("-1.7976931348623157E308") d = BigDecimal.valueOf(1 / f); sec = m ? sec.divide(d) : sec.multiply(d); } } if(Math.abs(sec.doubleValue()) < 1E-13) sec = BigDecimal.ZERO; } /** * Constructor. * @param dat date item * @param sub date to be subtracted * @param ii input info * @throws QueryException query exception */ public DTDur(final ADate dat, final ADate sub, final InputInfo ii) throws QueryException { super(AtomType.DTD); sec = dat.days().subtract(sub.days()).multiply(DAYSECONDS).add( dat.seconds().subtract(sub.seconds())); final double d = sec.doubleValue(); if(d <= Long.MIN_VALUE || d >= Long.MAX_VALUE) DATEADDRANGE.thrw(ii, type); } /** * Constructor. * @param vl value * @param ii input info * @throws QueryException query exception */ public DTDur(final byte[] vl, final InputInfo ii) throws QueryException { super(AtomType.DTD); final String val = Token.string(vl).trim(); final Matcher mt = DUR.matcher(val); if(!mt.matches() || val.endsWith("P") || val.endsWith("T")) dateErr(vl, XDTD, ii); dayTime(vl, mt, 2, ii); } /** * Returns the date and time. * @return year */ public BigDecimal dtd() { return sec; } @Override public byte[] string(final InputInfo ii) { final TokenBuilder tb = new TokenBuilder(); final int ss = sec.signum(); if(ss < 0) tb.add('-'); tb.add('P'); if(day() != 0) { tb.addLong(Math.abs(day())); tb.add('D'); } time(tb); if(ss == 0) tb.add("T0S"); return tb.finish(); } @Override public int diff(final Item it, final Collation coll, final InputInfo ii) throws QueryException { if(it.type != type) Err.diff(ii, it, this); return sec.subtract(((Dur) it).sec).signum(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/Dat.java000066400000000000000000000031551222453003200257750ustar00rootroot00000000000000package org.basex.query.value.item; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import org.basex.query.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Date item ({@code xs:date}). * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Dat extends ADate { /** * Constructor. * @param date date */ public Dat(final ADate date) { super(AtomType.DAT, date); clean(); } /** * Constructor. * @param date date * @param ii input info * @throws QueryException query exception */ public Dat(final byte[] date, final InputInfo ii) throws QueryException { super(AtomType.DAT); date(date, XDATE, ii); } /** * Constructor. * @param date date * @param dur duration * @param plus plus/minus flag * @param ii input info * @throws QueryException query exception */ public Dat(final Dat date, final Dur dur, final boolean plus, final InputInfo ii) throws QueryException { this(date); if(dur instanceof DTDur) { calc((DTDur) dur, plus); if(yea <= MIN_YEAR || yea > MAX_YEAR) DATEADDRANGE.thrw(ii, this); } else { calc((YMDur) dur, plus, ii); } clean(); } @Override public void timeZone(final DTDur tz, final boolean spec, final InputInfo ii) throws QueryException { tz(tz, spec, ii); clean(); } /** * Cleans the item and removes invalid components. */ private void clean() { hou = -1; min = -1; sec = null; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/Dbl.java000066400000000000000000000060641222453003200257700ustar00rootroot00000000000000package org.basex.query.value.item; import static java.lang.Double.*; import java.math.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.util.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Double item ({@code xs:double}). * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Dbl extends ANum { /** Value "NaN". */ public static final Dbl NAN = new Dbl(Double.NaN); /** Value "0". */ private static final Dbl ZERO = new Dbl(0); /** Value "1". */ private static final Dbl ONE = new Dbl(1); /** Data. */ private final double val; /** * Constructor. * @param v value */ private Dbl(final double v) { super(AtomType.DBL); val = v; } /** * Returns an instance of this class. * @param d value * @return instance */ public static Dbl get(final double d) { return d == 0 && Double.doubleToRawLongBits(d) == 0 ? ZERO : d == 1 ? ONE : isNaN(d) ? NAN : new Dbl(d); } /** * Returns an instance of this class. * @param v value * @param ii input info * @return instance * @throws QueryException query exception */ public static Dbl get(final byte[] v, final InputInfo ii) throws QueryException { return get(parse(v, ii)); } @Override public byte[] string() { return Token.token(val); } @Override public boolean bool(final InputInfo ii) { return !isNaN(val) && val != 0; } @Override public long itr() { return (long) val; } @Override public float flt() { return (float) val; } @Override public double dbl() { return val; } @Override public BigDecimal dec(final InputInfo ii) throws QueryException { return Dec.parse(val, ii); } @Override public boolean eq(final Item it, final Collation coll, final InputInfo ii) throws QueryException { return val == it.dbl(ii); } @Override public int diff(final Item it, final Collation coll, final InputInfo ii) throws QueryException { final double n = it.dbl(ii); if(isNaN(n) || isNaN(val)) return UNDEF; return val < n ? -1 : val > n ? 1 : 0; } @Override public Double toJava() { return val; } @Override public boolean sameAs(final Expr cmp) { return cmp instanceof Dbl && val == ((Dbl) cmp).val || this == NAN && cmp == NAN; } /** * Converts the given token into a double value. * @param val value to be converted * @param ii input info * @return double value * @throws QueryException query exception */ public static double parse(final byte[] val, final InputInfo ii) throws QueryException { try { return Double.parseDouble(Token.string(val)); } catch(final NumberFormatException ex) { if(Token.eq(Token.trim(val), Token.INF)) return Double.POSITIVE_INFINITY; if(Token.eq(Token.trim(val), Token.NINF)) return Double.NEGATIVE_INFINITY; throw ZERO.castErr(val, ii); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/Dec.java000066400000000000000000000073631222453003200257650ustar00rootroot00000000000000package org.basex.query.value.item; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.math.*; import org.basex.query.*; import org.basex.query.util.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Decimal item ({@code xs:decimal}). * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Dec extends ANum { /** Maximum unsigned long values. */ public static final BigDecimal MAXULNG = new BigDecimal(Long.MAX_VALUE).multiply( BigDecimal.valueOf(2)).add(BigDecimal.ONE); /** Zero value. */ private static final Dec ZERO = new Dec(BigDecimal.ZERO); /** Decimal value. */ private final BigDecimal val; /** * Constructor. * @param t string representation */ public Dec(final byte[] t) { super(AtomType.DEC); val = new BigDecimal(Token.string(trim(t))); } /** * Constructor. * @param d decimal value * @param t string representation */ public Dec(final BigDecimal d, final Type t) { super(t); val = d; } /** * Constructor. * @param d decimal value */ private Dec(final BigDecimal d) { super(AtomType.DEC); val = d; } /** * Constructor. * @param d big decimal value * @return value */ public static Dec get(final BigDecimal d) { return d.signum() == 0 ? ZERO : new Dec(d); } /** * Constructor. * @param d big decimal value * @return value */ public static Dec get(final double d) { return get(BigDecimal.valueOf(d)); } @Override public byte[] string() { return chopNumber(token(val.toPlainString())); } @Override public boolean bool(final InputInfo ii) { return val.signum() != 0; } @Override public long itr() { return val.longValue(); } @Override public float flt() { return val.floatValue(); } @Override public double dbl() { return val.doubleValue(); } @Override public BigDecimal dec(final InputInfo ii) { return val; } @Override public boolean eq(final Item it, final Collation coll, final InputInfo ii) throws QueryException { return it.type == AtomType.DBL || it.type == AtomType.FLT ? it.eq(this, coll, ii) : val.compareTo(it.dec(ii)) == 0; } @Override public int diff(final Item it, final Collation coll, final InputInfo ii) throws QueryException { final double d = it.dbl(ii); return d == Double.NEGATIVE_INFINITY ? -1 : d == Double.POSITIVE_INFINITY ? 1 : Double.isNaN(d) ? UNDEF : val.compareTo(it.dec(ii)); } @Override public Object toJava() { return type == AtomType.ULN ? new BigInteger(val.toString()) : val; } /** * Converts the given double into a decimal value. * @param val value to be converted * @param ii input info * @return double value * @throws QueryException query exception */ public static BigDecimal parse(final double val, final InputInfo ii) throws QueryException { if(Double.isNaN(val) || Double.isInfinite(val)) Err.value(ii, AtomType.DEC, val); return BigDecimal.valueOf(val); } /** * Converts the given token into a decimal value. * @param val value to be converted * @param ii input info * @return double value * @throws QueryException query exception */ public static BigDecimal parse(final byte[] val, final InputInfo ii) throws QueryException { if(contains(val, 'e') || contains(val, 'E')) FUNCAST.thrw(ii, AtomType.DEC, val); try { return new BigDecimal(Token.string(val).trim()); } catch(final NumberFormatException ex) { throw ZERO.castErr(val, ii); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/Dtm.java000066400000000000000000000056241222453003200260140ustar00rootroot00000000000000package org.basex.query.value.item; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import java.math.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * DateTime item ({@code xs:dateTime}). * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Dtm extends ADate { /** * Constructor. * @param date date */ public Dtm(final ADate date) { super(AtomType.DTM, date); if(hou == -1) { hou = 0; min = 0; sec = BigDecimal.ZERO; } } /** * Constructor. * @param date date * @param time time * @param ii input info * @throws QueryException query exception */ public Dtm(final Dat date, final Tim time, final InputInfo ii) throws QueryException { super(AtomType.DTM, date); hou = time.hou; min = time.min; sec = time.sec; if(zon == Short.MAX_VALUE) { zon = time.zon; } else if(zon != time.zon && time.zon != Short.MAX_VALUE) { FUNZONE.thrw(ii, date, time); } } /** * Constructor. * @param date date * @param ii input info * @throws QueryException query exception */ public Dtm(final byte[] date, final InputInfo ii) throws QueryException { super(AtomType.DTM); final int i = Token.indexOf(date, 'T'); if(i == -1) dateErr(date, XDTM, ii); date(Token.substring(date, 0, i), XDTM, ii); time(Token.substring(date, i + 1), XDTM, ii); } /** * Constructor. * @param ms milliseconds since January 1, 1970, 00:00:00 GMT * @param ii input info * @throws QueryException query exception */ public Dtm(final long ms, final InputInfo ii) throws QueryException { this(Token.token(DateTime.format(new java.util.Date(ms), DateTime.FULL)), ii); } /** * Constructor. * @param date date * @param dur duration * @param plus plus/minus flag * @param ii input info * @throws QueryException query exception */ public Dtm(final Dtm date, final Dur dur, final boolean plus, final InputInfo ii) throws QueryException { this(date); if(dur instanceof DTDur) { calc((DTDur) dur, plus); if(yea <= MIN_YEAR || yea > MAX_YEAR) DATEADDRANGE.thrw(ii, this); } else { calc((YMDur) dur, plus, ii); } } @Override public void timeZone(final DTDur tz, final boolean spec, final InputInfo ii) throws QueryException { tz(tz, spec, ii); } @Override public boolean sameAs(final Expr cmp) { if(!(cmp instanceof Dtm)) return false; final Dtm dtm = (Dtm) cmp; return type == dtm.type && yea == dtm.yea && mon == dtm.mon && day == dtm.day && hou == dtm.hou && min == dtm.min && zon == dtm.zon && sec == null ? dtm.sec == null : sec.equals(dtm.sec); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/Dur.java000066400000000000000000000146161222453003200260230ustar00rootroot00000000000000package org.basex.query.value.item; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import java.math.*; import java.util.regex.*; import javax.xml.datatype.*; import org.basex.query.*; import org.basex.query.util.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Duration item ({@code xs:duration}). * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class Dur extends ADateDur { /** Pattern for one or more digits. */ protected static final String DP = "(\\d+)"; /** Date pattern. */ private static final Pattern DUR = Pattern.compile("(-?)P(" + DP + "Y)?(" + DP + "M)?(" + DP + "D)?(T(" + DP + "H)?(" + DP + "M)?((\\d+|\\d*\\.\\d+)?S)?)?"); /** Number of months. */ long mon; /** * Constructor. * @param v value * @param ii input info * @throws QueryException query exception */ public Dur(final byte[] v, final InputInfo ii) throws QueryException { this(v, AtomType.DUR, ii); } /** * Constructor. * @param t data type */ Dur(final Type t) { super(t); } /** * Constructor. * @param d duration */ public Dur(final Dur d) { this(d, AtomType.DUR); } /** * Constructor. * @param d duration * @param t data type */ private Dur(final Dur d, final Type t) { this(t); mon = d.mon; sec = d.sec == null ? BigDecimal.ZERO : d.sec; } /** * Constructor. * @param vl value * @param t data type * @param ii input info * @throws QueryException query exception */ private Dur(final byte[] vl, final Type t, final InputInfo ii) throws QueryException { this(t); final String val = Token.string(vl).trim(); final Matcher mt = DUR.matcher(val); if(!mt.matches() || val.endsWith("P") || val.endsWith("T")) dateErr(vl, XDURR, ii); yearMonth(vl, mt, ii); dayTime(vl, mt, 6, ii); } /** * Initializes the yearMonth component. * @param vl value * @param mt matcher * @param ii input info * @throws QueryException query exception */ protected void yearMonth(final byte[] vl, final Matcher mt, final InputInfo ii) throws QueryException { final long y = mt.group(2) != null ? toLong(mt.group(3), true, ii) : 0; final long m = mt.group(4) != null ? toLong(mt.group(5), true, ii) : 0; mon = y * 12 + m; double v = y * 12d + m; if(!mt.group(1).isEmpty()) { mon = -mon; v = -v; } if(v <= Long.MIN_VALUE || v >= Long.MAX_VALUE) DURRANGE.thrw(ii, type, vl); } /** * Initializes the dayTime component. * @param vl value * @param mt matcher * @param p first matching position * @param ii input info * @throws QueryException query exception */ protected void dayTime(final byte[] vl, final Matcher mt, final int p, final InputInfo ii) throws QueryException { final long d = mt.group(p) != null ? toLong(mt.group(p + 1), true, ii) : 0; final long h = mt.group(p + 3) != null ? toLong(mt.group(p + 4), true, ii) : 0; final long m = mt.group(p + 5) != null ? toLong(mt.group(p + 6), true, ii) : 0; final BigDecimal s = mt.group(p + 7) != null ? toDecimal(mt.group(p + 8), true, ii) : BigDecimal.ZERO; sec = s.add(BigDecimal.valueOf(d).multiply(DAYSECONDS)). add(BigDecimal.valueOf(h).multiply(BD3600)). add(BigDecimal.valueOf(m).multiply(BD60)); if(!mt.group(1).isEmpty()) sec = sec.negate(); final double v = sec.doubleValue(); if(v <= Long.MIN_VALUE || v >= Long.MAX_VALUE) DURRANGE.thrw(ii, type, vl); } @Override public final long yea() { return mon / 12; } @Override public final long mon() { return mon % 12; } @Override public final long day() { return sec.divideToIntegralValue(DAYSECONDS).longValue(); } @Override public final long hou() { return tim() / 3600; } @Override public final long min() { return tim() % 3600 / 60; } @Override public final BigDecimal sec() { return sec.remainder(BD60); } /** * Returns the time. * @return time */ private long tim() { return sec.remainder(DAYSECONDS).longValue(); } @Override public byte[] string(final InputInfo ii) { final TokenBuilder tb = new TokenBuilder(); final int ss = sec.signum(); if(mon < 0 || ss < 0) tb.add('-'); date(tb); time(tb); if(mon == 0 && ss == 0) tb.add("T0S"); return tb.finish(); } /** * Adds the date to the specified token builder. * @param tb token builder */ protected final void date(final TokenBuilder tb) { tb.add('P'); final long y = yea(); if(y != 0) { tb.addLong(Math.abs(y)); tb.add('Y'); } final long m = mon(); if(m != 0) { tb.addLong(Math.abs(m)); tb.add('M'); } final long d = day(); if(d != 0) { tb.addLong(Math.abs(d)); tb.add('D'); } } /** * Adds the time to the specified token builder. * @param tb token builder */ protected final void time(final TokenBuilder tb) { if(sec.remainder(DAYSECONDS).signum() == 0) return; tb.add('T'); final long h = hou(); if(h != 0) { tb.addLong(Math.abs(h)); tb.add('H'); } final long m = min(); if(m != 0) { tb.addLong(Math.abs(m)); tb.add('M'); } final BigDecimal sc = sec(); if(sc.signum() == 0) return; tb.add(Token.chopNumber(Token.token(sc.abs().toPlainString()))).add('S'); } @Override public final boolean eq(final Item it, final Collation coll, final InputInfo ii) throws QueryException { final Dur d = (Dur) (it instanceof Dur ? it : type.cast(it, null, ii)); final BigDecimal s1 = sec == null ? BigDecimal.ZERO : sec; final BigDecimal s2 = d.sec == null ? BigDecimal.ZERO : d.sec; return mon == d.mon && s1.compareTo(s2) == 0; } @Override public int diff(final Item it, final Collation coll, final InputInfo ii) throws QueryException { throw Err.diff(ii, it, this); } @Override public final Duration toJava() { return ADate.df.newDuration(Token.string(string(null))); } @Override public final int hash(final InputInfo ii) { return (int) (31 * mon + (sec == null ? 0 : sec.doubleValue())); } @Override public final String toString() { return Util.info("\"%\"", string(null)); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/FItem.java000066400000000000000000000032751222453003200262740ustar00rootroot00000000000000package org.basex.query.value.item; import static org.basex.query.util.Err.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.func.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Abstract super class for function items. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public abstract class FItem extends Item implements XQFunction { /** * Constructor. * @param t type */ protected FItem(final FuncType t) { super(t); } @Override public final Value invokeValue(final QueryContext ctx, final InputInfo ii, final Value... args) throws QueryException { return FuncCall.value(this, args, ctx, ii); } @Override public final Item invokeItem(final QueryContext ctx, final InputInfo ii, final Value... args) throws QueryException { return FuncCall.item(this, args, ctx, ii); } /** * Coerces this function item to the given function type. * @param ft function type * @param ctx query context * @param ii input info * @return coerced item * @throws QueryException query exception */ public abstract FItem coerceTo(final FuncType ft, final QueryContext ctx, final InputInfo ii) throws QueryException; @Override public final byte[] string(final InputInfo ii) throws QueryException { throw FIVALUE.thrw(ii, description()); } @Override public final boolean eq(final Item it, final Collation coll, final InputInfo ii) throws QueryException { throw FIEQ.thrw(ii, description()); } @Override public abstract void plan(final FElem root); } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/Flt.java000066400000000000000000000054421222453003200260130ustar00rootroot00000000000000package org.basex.query.value.item; import static java.lang.Double.*; import java.math.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.util.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Float item ({@code xs:float}). * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Flt extends ANum { /** Value "NaN". */ public static final Flt NAN = new Flt(Float.NaN); /** Value "0". */ private static final Flt ZERO = new Flt(0); /** Value "1". */ private static final Flt ONE = new Flt(1); /** Data. */ private final float val; /** * Constructor. * @param v value */ private Flt(final float v) { super(AtomType.FLT); val = v; } /** * Returns an instance of this class. * @param f value * @return instance */ public static Flt get(final float f) { return f == 0 && Float.floatToRawIntBits(f) == 0 ? ZERO : f == 1 ? ONE : isNaN(f) ? NAN : new Flt(f); } @Override public byte[] string() { return Token.token(val); } @Override public boolean bool(final InputInfo ii) { return !isNaN(val) && val != 0; } @Override public long itr() { return (long) val; } @Override public float flt() { return val; } @Override public double dbl() { return val; } @Override public BigDecimal dec(final InputInfo ii) throws QueryException { return Dec.parse(val, ii); } @Override public boolean eq(final Item it, final Collation coll, final InputInfo ii) throws QueryException { return it.type == AtomType.DBL ? it.eq(this, coll, ii) : val == it.flt(ii); } @Override public int diff(final Item it, final Collation coll, final InputInfo ii) throws QueryException { final double n = it.flt(ii); if(isNaN(n) || isNaN(val)) return UNDEF; return val < n ? -1 : val > n ? 1 : 0; } @Override public Float toJava() { return val; } @Override public boolean sameAs(final Expr cmp) { return cmp instanceof Flt && val == ((Flt) cmp).val || this == NAN && cmp == NAN; } /** * Converts the given token into a double value. * @param val value to be converted * @param ii input info * @return double value * @throws QueryException query exception */ static float parse(final byte[] val, final InputInfo ii) throws QueryException { try { return Float.parseFloat(Token.string(val)); } catch(final NumberFormatException ex) { if(Token.eq(Token.trim(val), Token.INF)) return Float.POSITIVE_INFINITY; if(Token.eq(Token.trim(val), Token.NINF)) return Float.NEGATIVE_INFINITY; throw ZERO.castErr(val, ii); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/FuncItem.java000066400000000000000000000200431222453003200267720ustar00rootroot00000000000000package org.basex.query.value.item; import static org.basex.query.QueryText.*; import java.util.*; import java.util.Map.Entry; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.func.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.query.var.*; import org.basex.util.*; /** * Function item. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class FuncItem extends FItem implements Scope { /** Original function. */ public final StaticFunc func; /** Static context. */ private final StaticContext sc; /** Variables. */ private final Var[] vars; /** Function expression. */ private final Expr expr; /** Function name. */ private final QNm name; /** Optional type to cast to. */ private final SeqType cast; /** Context value. */ private final Value ctxVal; /** Context position. */ private final long pos; /** Context length. */ private final long size; /** The closure of this function item. */ private final Map closure; /** Size of the stack frame needed for this function. */ private final int stackSize; /** * Constructor. * @param n function name * @param arg function arguments * @param body function body * @param t function type * @param scp variable scope * @param sctx static context * @param sf original function */ public FuncItem(final QNm n, final Var[] arg, final Expr body, final FuncType t, final VarScope scp, final StaticContext sctx, final StaticFunc sf) { this(n, arg, body, t, false, null, 0, 0, null, scp, sctx, sf); } /** * Constructor. * @param n function name * @param arg function arguments * @param body function body * @param t function type * @param cst cast flag * @param cls closure * @param scp variable scope * @param sctx static context * @param sf original function */ public FuncItem(final QNm n, final Var[] arg, final Expr body, final FuncType t, final boolean cst, final Map cls, final VarScope scp, final StaticContext sctx, final StaticFunc sf) { this(n, arg, body, t, cst, null, 0, 0, cls, scp, sctx, sf); } /** * Constructor for anonymous functions. * @param arg function arguments * @param body function body * @param t function type * @param cl variables in the closure * @param cst cast flag * @param scp variable scope * @param sctx static context */ public FuncItem(final Var[] arg, final Expr body, final FuncType t, final Map cl, final boolean cst, final VarScope scp, final StaticContext sctx) { this(null, arg, body, t, cst, cl, scp, sctx, null); } /** * Constructor. * @param n function name * @param arg function arguments * @param body function body * @param t function type * @param cst cast flag * @param vl context value * @param ps context position * @param sz context size * @param cls closure * @param scp variable scope * @param sctx static context * @param sf original function */ public FuncItem(final QNm n, final Var[] arg, final Expr body, final FuncType t, final boolean cst, final Value vl, final long ps, final long sz, final Map cls, final VarScope scp, final StaticContext sctx, final StaticFunc sf) { super(t); name = n; vars = arg; expr = body; cast = cst && t.type != null ? t.type : null; closure = cls != null ? cls : Collections.emptyMap(); stackSize = scp.stackSize(); sc = sctx; ctxVal = vl; pos = ps; size = sz; func = sf; } @Override public int arity() { return vars.length; } @Override public QNm fName() { return name; } @Override public FuncType funcType() { return (FuncType) type; } /** * Binds all variables to the context. * @param ctx query context * @param ii input info * @param arg argument values * @throws QueryException if the arguments can't be bound */ private void bindVars(final QueryContext ctx, final InputInfo ii, final Value[] arg) throws QueryException { for(final Entry e : closure.entrySet()) ctx.set(e.getKey(), e.getValue(), ii); for(int v = vars.length; --v >= 0;) ctx.set(vars[v], arg[v], ii); } @Override public Value invValue(final QueryContext ctx, final InputInfo ii, final Value... args) throws QueryException { // bind variables and cache context final StaticContext cs = ctx.sc; ctx.sc = sc; final int fp = ctx.stack.enterFrame(stackSize); final Value cv = ctx.value; final long ps = ctx.pos, sz = ctx.size; try { bindVars(ctx, ii, args); ctx.value = ctxVal; ctx.pos = pos; ctx.size = size; final Value v = ctx.value(expr); // optionally cast return value to target type return cast != null ? cast.funcConvert(ctx, ii, v) : v; } finally { ctx.value = cv; ctx.pos = ps; ctx.size = sz; ctx.stack.exitFrame(fp); ctx.sc = cs; } } @Override public Item invItem(final QueryContext ctx, final InputInfo ii, final Value... args) throws QueryException { // bind variables and cache context final StaticContext cs = ctx.sc; ctx.sc = sc; final int fp = ctx.stack.enterFrame(stackSize); final Value cv = ctx.value; final long ps = ctx.pos, sz = ctx.size; try { bindVars(ctx, ii, args); ctx.value = ctxVal; ctx.pos = pos; ctx.size = size; final Item it = expr.item(ctx, ii); final Value v = it == null ? Empty.SEQ : it; // optionally cast return value to target type return cast != null ? cast.funcConvert(ctx, ii, v).item(ctx, ii) : it; } finally { ctx.value = cv; ctx.pos = ps; ctx.size = sz; ctx.stack.exitFrame(fp); ctx.sc = cs; } } /** * Coerces a function item to the given type. * @param ctx query context * @param ii input info * @param fun function item to coerce * @param t type to coerce to * @return coerced function item */ private static FuncItem coerce(final QueryContext ctx, final InputInfo ii, final FuncItem fun, final FuncType t) { final VarScope sc = new VarScope(); final Var[] vs = new Var[fun.vars.length]; final Expr[] refs = new Expr[vs.length]; for(int i = vs.length; i-- > 0;) { vs[i] = sc.uniqueVar(ctx, t.args[i], true); refs[i] = new VarRef(ii, vs[i]); } final Expr e = new DynFuncCall(ii, fun, refs); e.markTailCalls(); return new FuncItem(fun.name, vs, e, t, fun.cast != null, null, sc, ctx.sc, fun.func); } @Override public FItem coerceTo(final FuncType ft, final QueryContext ctx, final InputInfo ii) throws QueryException { if(vars.length != ft.args.length) throw Err.cast(ii, ft, this); return type.instanceOf(ft) ? this : coerce(ctx, ii, this, ft); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(TYPE, type), vars, expr); } @Override public boolean accept(final ASTVisitor visitor) { return visitor.funcItem(this); } @Override public boolean visit(final ASTVisitor visitor) { for(final Var var : vars) if(!visitor.declared(var)) return false; for(final Var var : closure.keySet()) if(!visitor.declared(var)) return false; return expr.accept(visitor); } @Override public void compile(final QueryContext ctx) throws QueryException { // nothing to do here } @Override public boolean compiled() { return true; } @Override public Object toJava() throws QueryException { throw Util.notexpected(); } @Override public String toString() { final FuncType ft = (FuncType) type; final TokenBuilder tb = new TokenBuilder(FUNCTION).add('('); for(final Var v : vars) tb.addExt(v).add(v == vars[vars.length - 1] ? "" : ", "); return tb.add(')').add(ft.type != null ? " as " + ft.type : "").add(" { "). addExt(expr).add(" }").toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/GDt.java000066400000000000000000000067451222453003200257530ustar00rootroot00000000000000package org.basex.query.value.item; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import java.util.regex.*; import org.basex.query.*; import org.basex.query.util.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Simple date item, used for {@code xs:gYearMonth}, {@code xs:gYear}, * {@code xs:gMonthDay}, {@code xs:gDay} and {@code xs:gMonth}. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class GDt extends ADate { /** Date pattern. */ private static final Type[] TYPES = { AtomType.YEA, AtomType.YMO, AtomType.MON, AtomType.MDA, AtomType.DAY, }; /** Date patterns. */ private static final Pattern[] PATTERNS = { Pattern.compile(YEAR + ZONE), Pattern.compile(YEAR + '-' + DD + ZONE), Pattern.compile("--" + DD + ZONE), Pattern.compile("--" + DD + '-' + DD + ZONE), Pattern.compile("---" + DD + ZONE) }; /** Date pattern. */ private static final String[] EXAMPLES = { XYEA, XYMO, XMON, XMDA, XDAY }; /** Date zones. */ private static final int[] ZONES = { 3, 4, 2, 3, 2 }; /** * Constructor. * @param d date * @param t data type */ public GDt(final ADate d, final Type t) { super(t, d); if(t != AtomType.YEA && t != AtomType.YMO) yea = Long.MAX_VALUE; if(t != AtomType.MON && t != AtomType.YMO && t != AtomType.MDA) mon = -1; if(t != AtomType.DAY && t != AtomType.MDA) day = -1; hou = -1; min = -1; sec = null; } /** * Constructor. * @param d date * @param t data type * @param ii input info * @throws QueryException query exception */ public GDt(final byte[] d, final Type t, final InputInfo ii) throws QueryException { super(t); final String dt = Token.string(d).trim(); final int i = type(t); final Matcher mt = PATTERNS[i].matcher(dt); if(!mt.matches()) dateErr(d, EXAMPLES[i], ii); if(i < 2) { yea = toLong(mt.group(1), false, ii); // +1 is added to BC values to simplify computations if(yea < 0) yea++; if(yea < MIN_YEAR || yea >= MAX_YEAR) DATERANGE.thrw(ii, type, d); } if(i > 0 && i < 4) { mon = (byte) (Token.toLong(mt.group(i == 1 ? 3 : 1)) - 1); if(mon < 0 || mon > 11) dateErr(d, EXAMPLES[i], ii); } if(i > 2) { day = (byte) (Token.toLong(mt.group(i == 3 ? 2 : 1)) - 1); final int m = Math.max(mon, 0); if(day < 0 || day >= DAYS[m] + (m == 1 ? 1 : 0)) dateErr(d, EXAMPLES[i], ii); } zone(mt, ZONES[i], d, ii); } /** * Returns the offset for the specified type. * @param type type * @return offset */ private static int type(final Type type) { for(int t = 0; t < TYPES.length; ++t) if(TYPES[t] == type) return t; throw Util.notexpected(); } @Override public void timeZone(final DTDur tz, final boolean d, final InputInfo ii) throws QueryException { Util.notexpected(); } @Override public int diff(final Item it, final Collation coll, final InputInfo ii) throws QueryException { throw Err.diff(ii, it, this); } @Override public byte[] string(final InputInfo ii) { final TokenBuilder tb = new TokenBuilder(); if(yea != Long.MAX_VALUE) { if(yea <= 0) tb.add('-'); prefix(tb, Math.abs(yea()), 4); } else { tb.add('-'); } if(mon >= 0 || day >= 0) tb.add('-'); if(mon >= 0) prefix(tb, mon + 1, 2); if(day >= 0) tb.add('-'); if(day >= 0) prefix(tb, day + 1, 2); zone(tb); return tb.finish(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/Hex.java000066400000000000000000000047601222453003200260140ustar00rootroot00000000000000package org.basex.query.value.item; import static org.basex.query.util.Err.*; import org.basex.query.*; import org.basex.query.util.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * HexBinary item ({@code xs:hexBinary}). * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Hex extends Bin { /** * Constructor. * @param b bytes */ public Hex(final byte[] b) { super(b, AtomType.HEX); } /** * Constructor. * @param v textual representation * @param ii input info * @throws QueryException query exception */ public Hex(final byte[] v, final InputInfo ii) throws QueryException { super(decode(Token.trim(v), ii), AtomType.HEX); } /** * Constructor. * @param b binary data * @param ii input info * @throws QueryException query exception */ public Hex(final Bin b, final InputInfo ii) throws QueryException { this(b.binary(ii)); } @Override public byte[] string(final InputInfo ii) throws QueryException { return Token.hex(binary(ii), true); } @Override public boolean eq(final Item it, final Collation coll, final InputInfo ii) throws QueryException { return Token.eq(binary(ii), it instanceof Bin ? ((Bin) it).binary(ii) : decode(it.string(ii), ii)); } /** * Converts the input into a byte array. * @param d textual data * @param ii input info * @return decoded string * @throws QueryException query exception */ private static byte[] decode(final byte[] d, final InputInfo ii) throws QueryException { if((d.length & 1) != 0) throw FUNCAST.thrw(ii, AtomType.HEX, (char) d[0]); final int l = d.length >>> 1; final byte[] v = new byte[l]; for(int i = 0; i < l; ++i) { v[i] = (byte) ((dec(d[i << 1], ii) << 4) + dec(d[(i << 1) + 1], ii)); } return v; } /** * Converts a single character into a byte value. * @param b character * @param ii input info * @return byte value * @throws QueryException query exception */ private static int dec(final byte b, final InputInfo ii) throws QueryException { if(b >= '0' && b <= '9') return b - '0'; if(b >= 'a' && b <= 'f' || b >= 'A' && b <= 'F') return (b & 0x0F) + 9; throw FUNCAST.thrw(ii, AtomType.HEX, (char) b); } @Override public String toString() { return new TokenBuilder().add('"').add(Token.hex(data, true)).add('"').toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/Int.java000066400000000000000000000072021222453003200260140ustar00rootroot00000000000000package org.basex.query.value.item; import java.math.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.util.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Integer item ({@code xs:int}, {@code xs:integer}, {@code xs:short}, etc.). * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Int extends ANum { /** Constant values. */ private static final Int[] NUMS; /** Integer value. */ private final long val; // caches the first 128 integers static { NUMS = new Int[128]; for(int i = 0; i < NUMS.length; ++i) NUMS[i] = new Int(i); } /** * Constructor. * @param v value */ private Int(final long v) { this(v, AtomType.ITR); } /** * Constructor. * @param v value * @param t data type */ public Int(final long v, final Type t) { super(t); val = v; } /** * Returns an instance of this class. * @param v value * @return instance */ public static Int get(final long v) { return v >= 0 && v < NUMS.length ? NUMS[(int) v] : new Int(v); } /** * Returns an instance of this class. * @param v value * @param t data type * @return instance */ public static Int get(final long v, final Type t) { return t == AtomType.ITR ? get(v) : new Int(v, t); } @Override public byte[] string() { return val == 0 ? Token.ZERO : Token.token(val); } @Override public boolean bool(final InputInfo ii) { return val != 0; } @Override public long itr() { return val; } @Override public float flt() { return val; } @Override public double dbl() { return val; } @Override public Item test(final QueryContext ctx, final InputInfo ii) throws QueryException { return val == ctx.pos ? this : null; } @Override public BigDecimal dec(final InputInfo ii) { return BigDecimal.valueOf(val); } @Override public boolean eq(final Item it, final Collation coll, final InputInfo ii) throws QueryException { return it instanceof Int ? val == ((Int) it).val : val == it.dbl(ii); } @Override public int diff(final Item it, final Collation coll, final InputInfo ii) throws QueryException { if(it instanceof Int) { final long i = ((Int) it).val; return val < i ? -1 : val > i ? 1 : 0; } final double n = it.dbl(ii); return Double.isNaN(n) ? UNDEF : val < n ? -1 : val > n ? 1 : 0; } @Override public Object toJava() { switch((AtomType) type) { case BYT: return (byte) val; case SHR: case UBY: return (short) val; case INT: case USH: return (int) val; case LNG: case UIN: return val; default: return new BigInteger(toString()); } } @Override public boolean sameAs(final Expr cmp) { if(!(cmp instanceof Int)) return false; final Int i = (Int) cmp; return type == i.type && val == i.val; } /** * Converts the given item into a long value. * @param val value to be converted * @param ii input info * @return long value * @throws QueryException query exception */ public static long parse(final byte[] val, final InputInfo ii) throws QueryException { // try fast conversion final long l = Token.toLong(val); if(l != Long.MIN_VALUE) return l; // fails; choose default conversion try { return Long.parseLong(Token.string(val).trim()); } catch(final NumberFormatException ex) { throw NUMS[0].castErr(val, ii); } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/Item.java000066400000000000000000000172061222453003200261650ustar00rootroot00000000000000package org.basex.query.value.item; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import java.math.*; import org.basex.io.in.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Abstract super class for all items. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class Item extends Value { /** Undefined item. */ public static final int UNDEF = Integer.MIN_VALUE; /** Score value. {@code null} reference takes less memory on 32bit than a double. */ public Double score; /** * Constructor. * @param t data type */ protected Item(final Type t) { super(t); } @Override public final ValueIter iter() { return new ValueIter() { private boolean req; @Override public Item next() { if(req) return null; req = true; return Item.this; } @Override public long size() { return 1; } @Override public Item get(final long i) { return Item.this; } @Override public boolean reset() { req = false; return true; } @Override public Value value() { return Item.this; } }; } @Override public final Item item(final QueryContext ctx, final InputInfo ii) { return this; } @Override public final Item itemAt(final long pos) { return this; } @Override public final Item ebv(final QueryContext ctx, final InputInfo ii) { return this; } @Override public Item test(final QueryContext ctx, final InputInfo ii) throws QueryException { return bool(ii) ? this : null; } @Override public final boolean isItem() { return true; } /** * Returns a string representation of the value. * @param ii input info, use {@code null} if none is available * @return string value * @throws QueryException if the item can't be atomized */ public abstract byte[] string(final InputInfo ii) throws QueryException; /** * Returns a boolean representation of the value. * @param ii input info * @return boolean value * @throws QueryException query exception */ public boolean bool(final InputInfo ii) throws QueryException { throw CONDTYPE.thrw(ii, type, this); } /** * Returns a decimal representation of the value. * @param ii input info * @return decimal value * @throws QueryException query exception */ public BigDecimal dec(final InputInfo ii) throws QueryException { return Dec.parse(string(ii), ii); } /** * Returns an integer (long) representation of the value. * @param ii input info * @return long value * @throws QueryException query exception */ public long itr(final InputInfo ii) throws QueryException { return Int.parse(string(ii), ii); } /** * Returns a float representation of the value. * @param ii input info * @return float value * @throws QueryException query exception */ public float flt(final InputInfo ii) throws QueryException { return Flt.parse(string(ii), ii); } /** * Returns a double representation of the value. * @param ii input info * @return double value * @throws QueryException query exception */ public double dbl(final InputInfo ii) throws QueryException { return Dbl.parse(string(ii), ii); } /** * Checks if the items can be compared. * @param it item to be compared * @return result of check */ public final boolean comparable(final Item it) { final Type t1 = type; final Type t2 = it.type; return t1 == t2 || this instanceof ANum && it instanceof ANum || t1.isStringOrUntyped() && t2.isStringOrUntyped() || this instanceof Dur && it instanceof Dur; } /** * Checks the items for equality. * @param it item to be compared * @param coll collation * @param ii input info * @return result of check * @throws QueryException query exception */ public abstract boolean eq(final Item it, final Collation coll, final InputInfo ii) throws QueryException; /** * Checks the items for equivalence. * @param it item to be compared * @param coll collation * @param ii input info * @return result of check * @throws QueryException query exception */ public final boolean equiv(final Item it, final Collation coll, final InputInfo ii) throws QueryException { // check if both values are NaN, or if values are equal.. return (this == Dbl.NAN || this == Flt.NAN) && it instanceof ANum && Double.isNaN(it.dbl(ii)) || comparable(it) && eq(it, coll, ii); } /** * Returns the difference between the current and the specified item. * @param it item to be compared * @param coll query context * @param ii input info * @return difference * @throws QueryException query exception */ @SuppressWarnings("unused") public int diff(final Item it, final Collation coll, final InputInfo ii) throws QueryException { throw (this == it ? TYPECMP : INVTYPECMP).thrw(ii, type, it.type); } /** * Returns an input stream. * @param ii input info * @return input stream * @throws QueryException query exception */ public BufferInput input(final InputInfo ii) throws QueryException { return new ArrayInput(string(ii)); } /** * Materializes streamable values, or returns a self reference. * @param ii input info * @return materialized item * @throws QueryException query exception */ @SuppressWarnings("unused") public Item materialize(final InputInfo ii) throws QueryException { return this; } @Override public final SeqType type() { return type.seqType(); } @Override public final long size() { return 1; } @Override public final boolean iterable() { return true; } /** * Returns a score value. * @return score value */ public double score() { return score == null ? 0 : score; } /** * Sets a new score value. * @param s score value */ public final void score(final double s) { if(score != null || s != 0) score = s; } /** * Throws a cast error. * @param val cast value * @param ii input info * @return never * @throws QueryException query exception */ protected final QueryException castErr(final Object val, final InputInfo ii) throws QueryException { return FUNCAST.thrw(ii, type, val); } @Override public String description() { return type.toString(); } @Override public void plan(final FElem plan) { try { addPlan(plan, planElem(VAL, string(null), TYP, type)); } catch(final QueryException ex) { // only function items throw exceptions in atomization, and they should // override plan(Serializer) sensibly Util.notexpected(ex); } } @Override public int hash(final InputInfo ii) throws QueryException { return Token.hash(string(ii)); } @Override public final int writeTo(final Item[] arr, final int start) { arr[start] = this; return 1; } @Override public final boolean homogeneous() { return true; } /** * Returns data model info. * @return type string */ public byte[] xdmInfo() { return new byte[] { typeId().asByte() }; } /** * Returns a type id. * @return type string */ public Type.ID typeId() { return type.id(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/Jav.java000066400000000000000000000027071222453003200260070ustar00rootroot00000000000000package org.basex.query.value.item; import org.basex.query.*; import org.basex.query.util.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Java item. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Jav extends Item { /** Java object. */ private final Object val; /** Query context. */ private final QueryContext qc; /** * Constructor. * @param o value * @param ctx query context */ public Jav(final Object o, final QueryContext ctx) { super(AtomType.JAVA); val = o; qc = ctx; } @Override public byte[] string(final InputInfo ii) throws QueryException { return materialize(ii).val; } @Override public Str materialize(final InputInfo ii) throws QueryException { return Str.get(val, qc, ii); } @Override public boolean bool(final InputInfo ii) { return !val.toString().isEmpty(); } @Override public boolean eq(final Item it, final Collation coll, final InputInfo ii) throws QueryException { return Token.eq(string(ii), it.string(ii)); } @Override public int diff(final Item it, final Collation coll, final InputInfo ii) throws QueryException { return Token.diff(string(ii), it.string(ii)); } @Override public Object toJava() { return val; } @Override public String toString() { return Util.info("\"%\"", val); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/QNm.java000066400000000000000000000204441222453003200257600ustar00rootroot00000000000000package org.basex.query.value.item; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import javax.xml.namespace.*; import org.basex.query.*; import org.basex.query.util.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.list.*; /** * QName item ({@code xs:QName}). * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class QNm extends Item { /** Singleton instance. */ private static final QNmCache CACHE = new QNmCache(); /** Namespace URI. */ private byte[] uri; /** Name with optional prefix. */ private byte[] name; /** Prefix index. */ private int pref; /** * Empty constructor. */ public QNm() { super(AtomType.QNM); name = EMPTY; } /** * Constructor. * @param n name */ public QNm(final byte[] n) { super(AtomType.QNM); name = n; pref = indexOf(n, ':'); } /** * Constructor. * @param n name */ public QNm(final String n) { this(token(n)); } /** * Constructor. * @param n name * @param u namespace URI */ public QNm(final byte[] n, final byte[] u) { this(n); uri(u); } /** * Constructor. * @param n name * @param u namespace URI */ public QNm(final String n, final byte[] u) { this(token(n), u); } /** * Constructor. * @param n name * @param u namespace URI */ public QNm(final String n, final String u) { this(token(n), u == null ? null : token(u)); } /** * Constructor, binding a statically known namespace. * If no namespace is found, the namespace uri is set to {@code null}. * @param n name * @param ctx query context */ public QNm(final byte[] n, final QueryContext ctx) { this(n); uri(ctx.sc.ns.uri(prefix())); } /** * Constructor for converting a Java QName. * @param qn qname */ public QNm(final QName qn) { this(token(qn.getPrefix().isEmpty() ? qn.getLocalPart() : qn.getPrefix() + ':' + qn.getLocalPart()), token(qn.getNamespaceURI())); } /** * Sets the URI of this QName. * @param u the uri to be set */ public void uri(final byte[] u) { uri = u == null ? null : norm(u); } /** * Returns the URI of this QName. * @return uri */ public byte[] uri() { return uri == null ? EMPTY : uri; } /** * Checks if the URI of this QName has been explicitly set. * @return result of check */ public boolean hasURI() { return uri != null; } @Override public byte[] string(final InputInfo ii) { return name; } /** * Returns the string value. * @return string value */ public byte[] string() { return name; } @Override public boolean eq(final Item it, final Collation coll, final InputInfo ii) throws QueryException { if(it instanceof QNm) return eq((QNm) it); throw INVTYPECMP.thrw(ii, it.type, type); } /** * Compares the specified item. * @param n name to be compared * @return result of check */ public boolean eq(final QNm n) { return n == this || Token.eq(uri(), n.uri()) && Token.eq(local(), n.local()); } @Override public int diff(final Item it, final Collation coll, final InputInfo ii) throws QueryException { throw Err.diff(ii, it, this); } /** * Checks if the name contains a prefix. * @return result of check */ public boolean hasPrefix() { return pref != -1; } /** * Returns the prefix. * @return prefix */ public byte[] prefix() { return pref == -1 ? EMPTY : substring(name, 0, pref); } /** * Returns the local name. * @return local name */ public byte[] local() { return pref == -1 ? name : substring(name, pref + 1); } /** * Updates the values of this QName. This method is only called * to speed up internal operations. * @param n name * @param u URI */ public void set(final byte[] n, final byte[] u) { name = n; pref = indexOf(name, ':'); uri = u; } /** * Returns a unique representation of the QName: *
    *
  • if a URI exists, the EQName notation is used.
  • *
  • otherwise, if a prefix exists, the prefix and local name is returned.
  • *
  • otherwise, the local name is returned.
  • *
* @return unique representation */ public byte[] id() { return uri == null ? name : internal(null, local(), uri); } @Override public QName toJava() { return new QName(Token.string(uri()), Token.string(local()), Token.string(prefix())); } @Override public int hash(final InputInfo ii) throws QueryException { return Token.hash(local()); } @Override public byte[] xdmInfo() { return new ByteList().add(typeId().asByte()).add(uri()).add(0).toArray(); } @Override public String toString() { return Token.string(id()); } @Override public boolean equals(final Object obj) { return obj.getClass() == QNm.class && eq((QNm) obj); } @Override public int hashCode() { return Token.hash(id()); } /** * Returns a cached QName with the specified local name. * @param local local name * @return instance */ public static QNm get(final String local) { return CACHE.index(null, token(local), null); }; /** * Returns a cached QName with the specified local name. * @param local local name * @return instance */ public static QNm get(final byte[] local) { return CACHE.index(null, local, null); }; /** * Returns a cached QName with the specified local name and uri. * @param local local name * @param uri namespace uri * @return instance */ public static QNm get(final String local, final byte[] uri) { return CACHE.index(null, token(local), uri); }; /** * Returns a cached QName with the specified local name and uri. * @param local local name * @param uri namespace uri * @return instance */ public static QNm get(final byte[] local, final byte[] uri) { return CACHE.index(null, local, uri); }; /** * Returns a cached QName with the specified prefix, local name and uri. * @param prefix prefix * @param local local name * @param uri namespace uri * @return instance */ public static QNm get(final String prefix, final String local, final byte[] uri) { return CACHE.index(token(prefix), token(local), uri); }; /** * Returns a cached QName with the specified prefix, local name and uri. * @param prefix prefix * @param local local name * @param uri namespace uri * @return instance */ public static QNm get(final String prefix, final String local, final String uri) { return CACHE.index(token(prefix), token(local), token(uri)); }; /** * Returns a cached QName with the specified prefix, local name and uri. * @param prefix prefix * @param local local name * @param uri namespace uri * @return instance */ public static QNm get(final byte[] prefix, final byte[] local, final byte[] uri) { return CACHE.index(prefix, local, uri); }; /** * Constructs an internal string representation for the components of a QName. * @param prefix prefix * @param local name * @param uri uri * @return EQName representation */ public static byte[] internal(final byte[] prefix, final byte[] local, final byte[] uri) { // optimized for speed, as it is called quite frequently final int ul = uri == null ? 0 : uri.length; final int pl = prefix == null ? 0 : prefix.length; // return local name if no prefix and uri exist if(ul == 0 && pl == 0) return local; final int l = (ul == 0 ? 0 : ul + 3) + (pl == 0 ? 0 : pl + 1) + local.length; final byte[] key = new byte[l]; int i = 0; if(ul != 0) { key[i++] = 'Q'; key[i++] = '{'; System.arraycopy(uri, 0, key, i, ul); key[i + ul] = '}'; i += ul + 1; } if(pl != 0) { System.arraycopy(prefix, 0, key, i, pl); key[i + pl] = ':'; i += pl + 1; } System.arraycopy(local, 0, key, i, local.length); return key; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/Str.java000066400000000000000000000054121222453003200260330ustar00rootroot00000000000000package org.basex.query.value.item; import static org.basex.data.DataText.*; import static org.basex.query.util.Err.*; import org.basex.core.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.list.*; /** * String item ({@code xs:string}, {@code xs:normalizedString}, {@code xs:language}, * etc.). * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class Str extends AStr { /** Zero-length string. */ public static final Str ZERO = new Str(Token.EMPTY); /** String data. */ final byte[] val; /** * Constructor. * @param v value */ private Str(final byte[] v) { this(v, AtomType.STR); } /** * Constructor. * @param v value * @param t data type */ public Str(final byte[] v, final AtomType t) { super(t); val = v; } /** * Returns an instance of this class. * @param v value * @return instance */ public static Str get(final byte[] v) { return v.length == 0 ? ZERO : new Str(v); } /** * Returns an instance of this class. * @param s string * @return instance */ public static Str get(final String s) { return get(Token.token(s.toString())); } /** * Returns an instance of this class. * @param v object (will be converted to token) * @param ctx query context * @param ii input info * @return instance * @throws QueryException query exception */ public static Str get(final Object v, final QueryContext ctx, final InputInfo ii) throws QueryException { final byte[] bytes = Token.token(v.toString()); if(ctx.context.prop.is(Prop.CHECKSTRINGS)) { final int bl = bytes.length; for(int b = 0; b < bl; b += Token.cl(bytes, b)) { final int cp = Token.cp(bytes, b); if(!XMLToken.valid(cp)) INVCODE.thrw(ii, Integer.toHexString(cp)); } } return get(bytes); } @Override public final byte[] string(final InputInfo ii) { return val; } /** * Returns the string value. * @return string value */ public final byte[] string() { return val; } @Override public final boolean sameAs(final Expr cmp) { if(!(cmp instanceof Str)) return false; final Str i = (Str) cmp; return type == i.type && Token.eq(val, i.val); } @Override public final String toJava() { return Token.string(val); } @Override public final String toString() { final ByteList tb = new ByteList(); tb.add('"'); for(final byte v : val) { if(v == '&') tb.add(E_AMP); else tb.add(v); if(v == '"') tb.add(v); } return tb.add('"').toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/StrStream.java000066400000000000000000000036001222453003200272040ustar00rootroot00000000000000package org.basex.query.value.item; import java.io.*; import org.basex.core.*; import org.basex.io.*; import org.basex.io.in.*; import org.basex.query.*; import org.basex.query.func.*; import org.basex.query.util.*; import org.basex.util.*; /** * Streamable string item ({@code xs:string}). * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class StrStream extends AStr { /** Input reference. */ private final IO input; /** Encoding (optional). */ private final String encoding; /** Error message. */ private final Err error; /** Validation flag. */ private final boolean validate; /** * Constructor. * @param io input * @param enc encoding (may be null) * @param ctx query context * @param err error message to be thrown */ public StrStream(final IO io, final String enc, final Err err, final QueryContext ctx) { input = io; encoding = enc; error = err; validate = ctx.context.prop.is(Prop.CHECKSTRINGS); } @Override public byte[] string(final InputInfo ii) throws QueryException { try { return input(ii).content(); } catch(final IOException ex) { throw error.thrw(ii, ex); } } @Override public String toJava() throws QueryException { return Token.string(string(null)); } @Override public TextInput input(final InputInfo ii) throws QueryException { TextInput nli = null; try { nli = new TextInput(input); nli.encoding(encoding).validate(validate); return nli; } catch(final IOException ex) { if(nli != null) try { nli.close(); } catch(final IOException ignored) { } throw error.thrw(ii, ex); } } @Override public Item materialize(final InputInfo ii) throws QueryException { return Str.get(string(ii)); } @Override public String toString() { return Util.info(Function._FILE_READ_TEXT.args(input)); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/Tim.java000066400000000000000000000025321222453003200260140ustar00rootroot00000000000000package org.basex.query.value.item; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Time item ({@code xs:time}). * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Tim extends ADate { /** * Constructor. * @param time time */ public Tim(final ADate time) { super(AtomType.TIM, time); clean(); } /** * Constructor. * @param time time * @param ii input info * @throws QueryException query exception */ public Tim(final byte[] time, final InputInfo ii) throws QueryException { super(AtomType.TIM); time(time, XTIME, ii); clean(); } /** * Constructor. * @param time time * @param dur duration to be added/subtracted * @param plus plus/minus flag */ public Tim(final Tim time, final DTDur dur, final boolean plus) { super(AtomType.TIM, time); calc(dur, plus); clean(); } @Override public void timeZone(final DTDur tz, final boolean spec, final InputInfo ii) throws QueryException { tz(tz, spec, ii); clean(); } /** * Cleans the item and removes invalid components. */ private void clean() { yea = Long.MAX_VALUE; mon = -1; day = -1; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/Uri.java000066400000000000000000000045431222453003200260260ustar00rootroot00000000000000package org.basex.query.value.item; import java.net.*; import org.basex.query.*; import org.basex.query.util.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * URI item ({@code xs:anyURI}). * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Uri extends Str { /** Empty URI. */ public static final Uri EMPTY = new Uri(Token.EMPTY); /** * Constructor. * @param v value */ private Uri(final byte[] v) { super(v, AtomType.URI); } /** * Creates a new uri instance. * @param uri value * @return uri instance */ public static Uri uri(final byte[] uri) { return uri(uri, true); } /** * Creates a new uri instance. * @param uri value * @return uri instance */ public static Uri uri(final String uri) { return uri(Token.token(uri), true); } /** * Creates a new uri instance. * @param uri value * @param normalize chop leading and trailing whitespaces * @return uri instance */ public static Uri uri(final byte[] uri, final boolean normalize) { final byte[] u = normalize ? Token.norm(uri) : uri; return u.length == 0 ? EMPTY : new Uri(u); } /** * Appends the specified address. If one of the URIs is invalid, * the original uri is returned. * @param add address to be appended * @param info input info * @return new uri * @throws QueryException query exception */ public Uri resolve(final Uri add, final InputInfo info) throws QueryException { if(add.val.length == 0) return this; try { final URI base = new URI(Token.string(val)); final URI res = new URI(Token.string(add.val)); final URI uri = base.resolve(res); return uri(Token.token(uri.toString()), false); } catch(final URISyntaxException ex) { throw Err.URIINVRES.thrw(info, ex.getMessage()); } } /** * Tests if this is an absolute URI. * @return result of check */ public boolean isAbsolute() { return Token.contains(val, ':'); } /** * Checks the validity of this URI. * @return result of check */ public boolean isValid() { try { new URI(Token.string(Token.uri(val, true))); return true; } catch(final URISyntaxException ex) { return false; } } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/item/YMDur.java000066400000000000000000000056561222453003200262750ustar00rootroot00000000000000package org.basex.query.value.item; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import java.math.*; import java.util.regex.*; import org.basex.query.*; import org.basex.query.util.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * YearMonth duration ({@code xs:yearMonthDuration}). * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class YMDur extends Dur { /** YearMonth pattern. */ private static final Pattern DUR = Pattern.compile("(-?)P(" + DP + "Y)?(" + DP + "M)?"); /** * Constructor. * @param it duration item */ public YMDur(final Dur it) { super(AtomType.YMD); mon = it.mon; sec = BigDecimal.ZERO; } /** * Constructor. * @param it duration item * @param a duration to be added/subtracted * @param p plus/minus flag * @param ii input info * @throws QueryException query exception */ public YMDur(final YMDur it, final YMDur a, final boolean p, final InputInfo ii) throws QueryException { this(it); final double d = (double) mon + (p ? a.mon : -a.mon); if(d <= Long.MIN_VALUE || d >= Long.MAX_VALUE) DURADDRANGE.thrw(ii, type); mon += p ? a.mon : -a.mon; } /** * Constructor. * @param it duration item * @param f factor * @param m multiplication/division flag * @param ii input info * @throws QueryException query exception */ public YMDur(final Dur it, final double f, final boolean m, final InputInfo ii) throws QueryException { this(it); if(Double.isNaN(f)) DATECALC.thrw(ii, description(), f); if(m ? Double.isInfinite(f) : f == 0) DATEZERO.thrw(ii, description()); final double d = m ? mon * f : mon / f; if(d <= Long.MIN_VALUE || d >= Long.MAX_VALUE) DURADDRANGE.thrw(ii, type); mon = StrictMath.round(d); } /** * Constructor. * @param vl value * @param ii input info * @throws QueryException query exception */ public YMDur(final byte[] vl, final InputInfo ii) throws QueryException { super(AtomType.YMD); final String val = Token.string(vl).trim(); final Matcher mt = DUR.matcher(val); if(!mt.matches() || val.endsWith("P")) dateErr(vl, XYMD, ii); yearMonth(vl, mt, ii); sec = BigDecimal.ZERO; } /** * Returns the years and months. * @return year */ public long ymd() { return mon; } @Override public byte[] string(final InputInfo ii) { final TokenBuilder tb = new TokenBuilder(); if(mon < 0) tb.add('-'); date(tb); if(mon == 0) tb.add("0M"); return tb.finish(); } @Override public int diff(final Item it, final Collation coll, final InputInfo ii) throws QueryException { if(it.type != type) Err.diff(ii, it, this); final long m = mon - ((Dur) it).mon; return m < 0 ? -1 : m > 0 ? 1 : 0; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/map/000077500000000000000000000000001222453003200242355ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/value/map/Branch.java000066400000000000000000000146261222453003200263060ustar00rootroot00000000000000package org.basex.query.value.map; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Inner node of a {@link Map}. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ final class Branch extends TrieNode { /** Child array. */ private final TrieNode[] kids; /** Bit array with a bit set for every used slot. */ final int used; /** * Constructor taking children array and the size of this map. * @param ch children * @param u bit array * @param s size of this node */ Branch(final TrieNode[] ch, final int u, final int s) { super(s); kids = ch; used = u; assert verify(); } /** * Copies the children array. * This is faster than {@code kids.clone()} according to * Heinz M. Kabutz. * @return copy of the child array */ TrieNode[] copyKids() { final TrieNode[] copy = new TrieNode[KIDS]; System.arraycopy(kids, 0, copy, 0, KIDS); return copy; } @Override TrieNode insert(final int h, final Item k, final Value v, final int l, final InputInfo ii) throws QueryException { final int key = key(h, l); final TrieNode sub = kids[key], nsub; final int bs, rem; if(sub != null) { nsub = sub.insert(h, k, v, l + 1, ii); if(nsub == sub) return this; bs = used; rem = sub.size; } else { nsub = new Leaf(h, k, v); bs = used | 1 << key; rem = 0; } final TrieNode[] ks = copyKids(); ks[key] = nsub; return new Branch(ks, bs, size - rem + nsub.size); } @Override TrieNode delete(final int h, final Item k, final int l, final InputInfo ii) throws QueryException { final int key = key(h, l); final TrieNode sub = kids[key]; if(sub == null) return this; final TrieNode nsub = sub.delete(h, k, l + 1, ii); if(nsub == sub) return this; final int nu; if(nsub == null) { nu = used ^ 1 << key; if(Integer.bitCount(nu) == 1) { final TrieNode single = kids[Integer.numberOfTrailingZeros(nu)]; // check whether the child depends on the right offset if(!(single instanceof Branch)) return single; } } else nu = used; final TrieNode[] ks = copyKids(); ks[key] = nsub; return new Branch(ks, nu, size - 1); } @Override Value get(final int h, final Item k, final int l, final InputInfo ii) throws QueryException { final int key = key(h, l); final TrieNode sub = kids[key]; return sub == null ? null : sub.get(h, k, l + 1, ii); } @Override boolean contains(final int h, final Item k, final int l, final InputInfo ii) throws QueryException { final int key = key(h, l); final TrieNode sub = kids[key]; return sub != null && sub.contains(h, k, l + 1, ii); } /** End strings. */ private static final String[] ENDS = { "|-- ", "| ", "`-- ", " " }; @Override StringBuilder toString(final StringBuilder sb, final String ind) { final int s = Integer.bitCount(used); for(int i = 0, j = 0; i < s; i++, j++) { while((used & 1 << j) == 0) j++; final int e = i == s - 1 ? 2 : 0; sb.append(ind).append(ENDS[e]).append( String.format("%x", j)).append('\n'); kids[j].toString(sb, ind + ENDS[e + 1]); } return sb; } @Override TrieNode addAll(final TrieNode o, final int l, final InputInfo ii) throws QueryException { return o.add(this, l, ii); } @Override TrieNode add(final Leaf o, final int l, final InputInfo ii) throws QueryException { final int k = key(o.hash, l); final TrieNode ch = kids[k], nw; if(ch != null) { final TrieNode ins = ch.add(o, l + 1, ii); if(ins == ch) return this; nw = ins; } else nw = o; final TrieNode[] ks = copyKids(); ks[k] = nw; // we don't replace here, so the size must increase return new Branch(ks, used | 1 << k, size + 1); } @Override TrieNode add(final List o, final int l, final InputInfo ii) throws QueryException { final int k = key(o.hash, l); final TrieNode ch = kids[k], nw; int n = o.size; if(ch != null) { final TrieNode ins = ch.add(o, l + 1, ii); if(ins == ch) return this; n = ins.size - ch.size; nw = ins; } else nw = o; final TrieNode[] ks = copyKids(); ks[k] = nw; // we don't replace here, so the size must increase return new Branch(ks, used | 1 << k, size + n); } @Override TrieNode add(final Branch o, final int l, final InputInfo ii) throws QueryException { TrieNode[] ch = null; int nu = used, ns = size; for(int i = 0; i < kids.length; i++) { final TrieNode k = kids[i], ok = o.kids[i]; if(ok != null) { final TrieNode nw = k == null ? ok : ok.addAll(k, l + 1, ii); if(nw != k) { if(ch == null) ch = copyKids(); ch[i] = nw; nu |= 1 << i; ns += nw.size - (k == null ? 0 : k.size); } } } return ch == null ? this : new Branch(ch, nu, ns); } @Override boolean verify() { int c = 0; for(int i = 0; i < KIDS; i++) { final boolean bit = (used & 1 << i) != 0, act = kids[i] != null; if(bit ^ act) return false; if(act) c += kids[i].size; } return c == size; } @Override void keys(final ValueBuilder ks) { for(final TrieNode nd : kids) if(nd != null) nd.keys(ks); } @Override boolean hasType(final AtomType kt, final SeqType vt) { for(final TrieNode k : kids) if(!(k == null || k.hasType(kt, vt))) return false; return true; } @Override int hash(final InputInfo ii) throws QueryException { int hash = 0; for(final TrieNode ch : kids) if(ch != null) hash = 31 * hash + ch.hash(ii); return hash; } @Override boolean deep(final InputInfo ii, final TrieNode o) throws QueryException { if(!(o instanceof Branch)) return false; final Branch ob = (Branch) o; // check bin usage first if(used != ob.used) return false; // recursively compare children for(int i = 0; i < KIDS; i++) if(kids[i] != null && !kids[i].deep(ii, ob.kids[i])) return false; // everything OK return true; } @Override StringBuilder toString(final StringBuilder sb) { for(int i = 0; i < KIDS; i++) if(kids[i] != null) kids[i].toString(sb); return sb; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/map/Leaf.java000066400000000000000000000115601222453003200257520ustar00rootroot00000000000000package org.basex.query.value.map; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * A single binding of a {@link Map}. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ final class Leaf extends TrieNode { /** Hash code of the key, stored for performance. */ final int hash; /** Key of this binding. */ final Item key; /** Value of this binding. */ final Value value; /** * Constructor. * @param h hash code of the key * @param k key * @param v value */ Leaf(final int h, final Item k, final Value v) { super(1); hash = h; key = k; value = v; assert verify(); } @Override TrieNode insert(final int h, final Item k, final Value v, final int l, final InputInfo ii) throws QueryException { // same hash, replace or merge if(h == hash) return eq(k, key, ii) ? new Leaf(h, k, v) : new List(hash, key, value, k, v); // different hash, branch final TrieNode[] ch = new TrieNode[KIDS]; final int a = key(h, l), b = key(hash, l); final int used; if(a != b) { ch[a] = new Leaf(h, k, v); ch[b] = this; used = 1 << a | 1 << b; } else { ch[a] = insert(h, k, v, l + 1, ii); used = 1 << a; } return new Branch(ch, used, 2); } @Override TrieNode delete(final int h, final Item k, final int l, final InputInfo ii) throws QueryException { return h == hash && eq(key, k, ii) ? null : this; } @Override Value get(final int h, final Item k, final int l, final InputInfo ii) throws QueryException { return h == hash && eq(key, k, ii) ? value : null; } @Override boolean contains(final int h, final Item k, final int l, final InputInfo ii) throws QueryException { return h == hash && eq(key, k, ii); } @Override StringBuilder toString(final StringBuilder sb, final String ind) { return sb.append(ind).append("`-- ").append(key).append( " => ").append(value).append('\n'); } @Override TrieNode addAll(final TrieNode o, final int l, final InputInfo ii) throws QueryException { return o.add(this, l, ii); } @Override TrieNode add(final Leaf o, final int l, final InputInfo ii) throws QueryException { if(hash == o.hash) return eq(key, o.key, ii) ? this : new List(hash, key, value, o.key, o.value); final TrieNode[] ch = new TrieNode[KIDS]; final int k = key(hash, l), ok = key(o.hash, l); final int nu; // same key? add recursively if(k == ok) { ch[k] = add(o, l + 1, ii); nu = 1 << k; } else { ch[k] = this; ch[ok] = o; nu = 1 << k | 1 << ok; } return new Branch(ch, nu, 2); } @Override TrieNode add(final List o, final int l, final InputInfo ii) throws QueryException { // same hash? insert binding if(hash == o.hash) { for(int i = 0; i < o.size; i++) { if(eq(key, o.keys[i], ii)) { final Item[] ks = o.keys.clone(); final Value[] vs = o.values.clone(); ks[i] = key; vs[i] = value; return new List(hash, ks, vs); } } return new List(hash, Array.add(o.keys, key), Array.add(o.values, value)); } final TrieNode[] ch = new TrieNode[KIDS]; final int k = key(hash, l), ok = key(o.hash, l); final int nu; // same key? add recursively if(k == ok) { ch[k] = add(o, l + 1, ii); nu = 1 << k; } else { ch[k] = this; ch[ok] = o; nu = 1 << k | 1 << ok; } return new Branch(ch, nu, o.size + 1); } @Override TrieNode add(final Branch o, final int l, final InputInfo ii) throws QueryException { final int k = key(hash, l); final TrieNode[] ch = o.copyKids(); final TrieNode old = ch[k]; ch[k] = old == null ? this : old.addAll(this, l + 1, ii); return new Branch(ch, o.used | 1 << k, o.size + ch[k].size - (old != null ? old.size : 0)); } @Override boolean verify() { try { return key.hash(null) == hash; } catch(final QueryException ex) { return false; } } @Override void keys(final ValueBuilder ks) { ks.add(key); } @Override boolean hasType(final AtomType kt, final SeqType vt) { return (kt == null || key.type.instanceOf(kt)) && (vt == null || vt.instance(value)); } @Override boolean deep(final InputInfo ii, final TrieNode o) throws QueryException { return o instanceof Leaf && eq(key, ((Leaf) o).key, ii) && deep(value, ((Leaf) o).value, ii); } @Override int hash(final InputInfo ii) throws QueryException { return 31 * hash + value.hash(ii); } @Override StringBuilder toString(final StringBuilder sb) { return sb.append(key).append(COL).append(value).append(", "); } }basex-7.7.2/basex-core/src/main/java/org/basex/query/value/map/List.java000066400000000000000000000163471222453003200260260ustar00rootroot00000000000000package org.basex.query.value.map; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Leaf that contains a collision list of keys with the same hash code. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ final class List extends TrieNode { /** Common hash value of all contained values. */ final int hash; /** List of keys of this collision list. */ final Item[] keys; /** List of values of this collision list. */ final Value[] values; /** * Constructor. * * @param h hash value * @param ks key array * @param vs value array */ List(final int h, final Item[] ks, final Value[] vs) { super(ks.length); keys = ks; values = vs; hash = h; assert verify(); } /** * Constructor for creating a collision list from two bindings. * @param h hash value * @param k1 first key * @param v1 first value * @param k2 second key * @param v2 second value */ List(final int h, final Item k1, final Value v1, final Item k2, final Value v2) { this(h, new Item[]{ k1, k2 }, new Value[]{ v1, v2 }); } @Override TrieNode delete(final int h, final Item k, final int l, final InputInfo ii) throws QueryException { if(h == hash) { for(int i = size; i-- > 0;) { if(eq(k, keys[i], ii)) { // found entry if(size == 2) { // single leaf remains final int o = i ^ 1; return new Leaf(h, keys[o], values[o]); } // still collisions return new List(h, Array.delete(keys, i), Array.delete(values, i)); } } } return this; } @Override TrieNode insert(final int h, final Item k, final Value v, final int l, final InputInfo ii) throws QueryException { // same hash, replace or merge if(h == hash) { for(int i = keys.length; i-- > 0;) { if(eq(k, keys[i], ii)) { // replace value final Value[] vs = values.clone(); vs[i] = v; return new List(h, keys.clone(), vs); } } return new List(hash, Array.add(keys, k), Array.add(values, v)); } // different hash, branch final TrieNode[] ch = new TrieNode[KIDS]; final int a = key(h, l), b = key(hash, l); final int used; if(a != b) { ch[a] = new Leaf(h, k, v); ch[b] = this; used = 1 << a | 1 << b; } else { ch[a] = insert(h, k, v, l + 1, ii); used = 1 << a; } // we definitely inserted one value return new Branch(ch, used, size + 1); } @Override Value get(final int h, final Item k, final int l, final InputInfo ii) throws QueryException { if(h == hash) for(int i = keys.length; i-- != 0;) if(eq(k, keys[i], ii)) return values[i]; return null; } @Override boolean contains(final int h, final Item k, final int u, final InputInfo ii) throws QueryException { if(h == hash) for(int i = keys.length; i-- != 0;) if(eq(k, keys[i], ii)) return true; return false; } @Override StringBuilder toString(final StringBuilder sb, final String ind) { sb.append(ind).append("`-- Collision (").append( Integer.toHexString(hash)).append("):\n"); for(int i = 0; i < keys.length; i++) { sb.append(ind).append(" ").append(keys[i]).append(" => ").append( values[i]).append('\n'); } return sb; } @Override TrieNode addAll(final TrieNode o, final int l, final InputInfo ii) throws QueryException { return o.add(this, l, ii); } @Override TrieNode add(final Leaf o, final int l, final InputInfo ii) throws QueryException { if(hash == o.hash) { for(final Item k : keys) if(eq(k, o.key, ii)) return this; return new List(hash, Array.add(keys, o.key), Array.add(values, o.value)); } final TrieNode[] ch = new TrieNode[KIDS]; final int k = key(hash, l), ok = key(o.hash, l); final int nu; // same key? add recursively if(k == ok) { ch[k] = add(o, l + 1, ii); nu = 1 << k; } else { ch[k] = this; ch[ok] = o; nu = 1 << k | 1 << ok; } return new Branch(ch, nu, size + 1); } @Override TrieNode add(final List o, final int l, final InputInfo ii) throws QueryException { if(hash == o.hash) { Item[] ks = keys; Value[] vs = values; outer: for(int i = 0; i < size; i++) { final Item ok = o.keys[i]; // skip all entries that are overridden for(final Item k : keys) if(eq(k, ok, ii)) continue outer; // key is not in this list, add it ks = Array.add(ks, ok); vs = Array.add(vs, o.values[i]); } return ks == keys ? this : new List(hash, ks, vs); } final TrieNode[] ch = new TrieNode[KIDS]; final int k = key(hash, l), ok = key(o.hash, l); final int nu; // same key? add recursively if(k == ok) { ch[k] = add(o, l + 1, ii); nu = 1 << k; } else { ch[k] = this; ch[ok] = o; nu = 1 << k | 1 << ok; } return new Branch(ch, nu, size + o.size); } @Override TrieNode add(final Branch o, final int l, final InputInfo ii) throws QueryException { final int k = key(hash, l); final TrieNode[] ch = o.copyKids(); final TrieNode old = ch[k]; ch[k] = old == null ? this : old.addAll(this, l + 1, ii); return new Branch(ch, o.used | 1 << k, o.size + size - (old != null ? old.size : 0)); } @Override boolean verify() { try { for(int i = 1; i < size; i++) { for(int j = i; j-- > 0;) { if(eq(keys[i], keys[j], null)) return false; } } } catch(final QueryException ex) { return false; } return true; } @Override void keys(final ValueBuilder ks) { for(final Item k : keys) ks.add(k); } @Override boolean hasType(final AtomType kt, final SeqType vt) { if(kt != null) for(final Item k : keys) if(!k.type.instanceOf(kt)) return false; if(vt != null) for(final Value v : values) if(!vt.instance(v)) return false; return true; } @Override int hash(final InputInfo ii) throws QueryException { int h = hash; // order isn't important, operation has to be commutative for(int i = size; --i >= 0;) h ^= values[i].hash(ii); return h; } @Override boolean deep(final InputInfo ii, final TrieNode o) throws QueryException { if(!(o instanceof List) || size != o.size) return false; final List ol = (List) o; // do the evil nested-loop thing outer: for(int i = 0; i < size; i++) { final Item k = keys[i]; for(int j = 0; j < size; j++) { if(eq(k, ol.keys[i], ii)) { // check bound value, too if(!deep(values[i], ol.values[j], ii)) return false; // value matched, continue with next key continue outer; } } // all keys of the other list were checked, none matched return false; } // all entries were found return true; } @Override StringBuilder toString(final StringBuilder sb) { for(int i = size; --i >= 0;) sb.append(keys[i]).append(ASSIGN).append(values[i]).append(", "); return sb; } }basex-7.7.2/basex-core/src/main/java/org/basex/query/value/map/Map.java000066400000000000000000000176111222453003200256230ustar00rootroot00000000000000package org.basex.query.value.map; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import java.util.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.hash.*; /** * The map item. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class Map extends FItem { /** The empty map. */ public static final Map EMPTY = new Map(TrieNode.EMPTY); /** Number of bits per level, maximum is 5 because {@code 1 << 5 == 32}. */ static final int BITS = 5; /** Wrapped immutable map. */ private final TrieNode root; /** Key sequence. */ private Value keys; /** * Constructor. * @param m map */ private Map(final TrieNode m) { super(SeqType.ANY_MAP); root = m; } @Override public int arity() { return 1; } @Override public QNm fName() { return null; } @Override public FuncType funcType() { return MapType.get(AtomType.AAT, SeqType.ITEM_ZM); } @Override public Item invItem(final QueryContext ctx, final InputInfo ii, final Value... args) throws QueryException { return get(args[0].item(ctx, ii), ii).item(ctx, ii); } @Override public Value invValue(final QueryContext ctx, final InputInfo ii, final Value... args) throws QueryException { return get(args[0].item(ctx, ii), ii); } /** * Checks the key item. * @param it item * @param ii input info * @return possibly atomized item if non {@code NaN}, {@code null} otherwise * @throws QueryException query exception */ private Item key(final Item it, final InputInfo ii) throws QueryException { // no empty sequence allowed if(it == null) throw INVEMPTY.thrw(ii, description()); // function items can't be keys if(it instanceof FItem) throw FIATOM.thrw(ii, it.description()); // NaN can't be stored as key, as it isn't equal to anything if(it == Flt.NAN || it == Dbl.NAN) return null; // untyped items are converted to strings return it.type.isUntyped() ? Str.get(it.string(ii)) : it; } /** * Deletes a key from this map. * @param key key to delete * @param ii input info * @return updated map if changed, {@code this} otherwise * @throws QueryException query exception */ public Map delete(final Item key, final InputInfo ii) throws QueryException { final Item k = key(key, ii); if(k == null) return this; final TrieNode del = root.delete(k.hash(ii), k, 0, ii); return del == root ? this : del != null ? new Map(del) : EMPTY; } /** * Gets the value from this map. * @param key key to look for * @param ii input info * @return bound value if found, the empty sequence {@code ()} otherwise * @throws QueryException query exception */ public Value get(final Item key, final InputInfo ii) throws QueryException { final Item k = key(key, ii); if(k == null) return Empty.SEQ; final Value val = root.get(k.hash(ii), k, 0, ii); return val == null ? Empty.SEQ : val; } /** * Checks if the given key exists in the map. * @param k key to look for * @param ii input info * @return {@code true()}, if the key exists, {@code false()} otherwise * @throws QueryException query exception */ public boolean contains(final Item k, final InputInfo ii) throws QueryException { final Item key = key(k, ii); return key != null && root.contains(key.hash(ii), key, 0, ii); } /** * Adds all bindings from the given map into {@code this}. * @param other map to add * @param ii input info * @return updated map if changed, {@code this} otherwise * @throws QueryException query exception */ public Map addAll(final Map other, final InputInfo ii) throws QueryException { if(other == EMPTY) return this; final TrieNode upd = root.addAll(other.root, 0, ii); return upd == other.root ? other : new Map(upd); } /** * Checks if the map has the given type. * @param t type * @return {@code true} if the type fits, {@code false} otherwise */ public boolean hasType(final MapType t) { return root.hasType(t.keyType == AtomType.AAT ? null : t.keyType, t.type.eq(SeqType.ITEM_ZM) ? null : t.type); } @Override public Map coerceTo(final FuncType ft, final QueryContext ctx, final InputInfo ii) throws QueryException { if(!(ft instanceof MapType) || !hasType((MapType) ft)) throw cast(ii, ft, this); return this; } /** * Inserts the given value into this map. * @param k key to insert * @param v value to insert * @param ii input info * @return updated map if changed, {@code this} otherwise * @throws QueryException query exception */ public Map insert(final Item k, final Value v, final InputInfo ii) throws QueryException { final Item key = key(k, ii); if(key == null) return this; final TrieNode ins = root.insert(key.hash(ii), key, v, 0, ii); return ins == root ? this : new Map(ins); } /** * Number of values contained in this map. * @return size */ public int mapSize() { return root.size; } /** * All keys defined in this map. * @return list of keys */ public Value keys() { if(keys == null) { final ValueBuilder res = new ValueBuilder(root.size); root.keys(res); keys = res.value(); } return keys; } /** * Collation of this map. * @return collation */ public Str collation() { return Str.get(URLCOLL); } /** * Checks if the this map is deep-equal to the given one. * @param ii input info * @param o other map * @return result of check * @throws QueryException query exception */ public boolean deep(final InputInfo ii, final Map o) throws QueryException { return root.deep(ii, o.root); } /** * Converts the map to a map with keys and values represented as tokens. * @param ii input info * @return token map * @throws QueryException query exception */ public TokenMap tokenMap(final InputInfo ii) throws QueryException { final TokenMap tm = new TokenMap(); final ValueIter vi = keys().iter(); for(Item it; (it = vi.next()) != null;) { if(!(it instanceof AStr)) FUNCMP.thrw(ii, description(), AtomType.STR, it.type); final Value v = get(it, ii); if(!v.isItem()) FUNCMP.thrw(ii, description(), AtomType.ITEM, v); final byte[] key = it.string(null); byte[] val = ((Item) v).string(ii); final byte[] o = tm.get(key); if(o != null) val = new TokenBuilder(o).add(',').add(val).finish(); tm.put(key, val); } return tm; } @Override public HashMap toJava() throws QueryException { final HashMap map = new HashMap(); final ValueIter vi = keys().iter(); for(Item k; (k = vi.next()) != null;) { map.put(k.toJava(), get(k, null).toJava()); } return map; } @Override public int hash(final InputInfo ii) throws QueryException { return root.hash(ii); } @Override public String description() { return MAPSTR + BRACE1 + DOTS + BRACE2; } @Override public void plan(final FElem plan) { final int s = mapSize(); final FElem el = planElem(SIZE, s); final Value ks = keys(); try { final int max = Math.min(s, 5); for(long i = 0; i < max; i++) { final Item key = ks.itemAt(i); final Value val = get(key, null); key.plan(el); val.plan(el); } } catch(final QueryException ex) { Util.notexpected(ex); } addPlan(plan, el); } @Override public String toString() { final StringBuilder sb = root.toString(new StringBuilder("{ ")); // remove superfluous comma if(root.size > 0) sb.deleteCharAt(sb.length() - 2); return sb.append('}').toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/map/TrieNode.java000066400000000000000000000176121222453003200266200ustar00rootroot00000000000000package org.basex.query.value.map; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Abstract superclass of all trie nodes. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ abstract class TrieNode { /** Number of children on each level. */ static final int KIDS = 1 << Map.BITS; /** Mask for the bits used on the current level. */ private static final int MASK = KIDS - 1; /** The empty node. */ static final TrieNode EMPTY = new TrieNode(0) { @Override StringBuilder toString(final StringBuilder sb, final String ind) { return sb.append("{ }"); } @Override TrieNode delete(final int h, final Item k, final int l, final InputInfo i) { return this; } @Override Value get(final int h, final Item k, final int l, final InputInfo i) { return null; } @Override boolean contains(final int h, final Item k, final int l, final InputInfo ii) { return false; } @Override TrieNode addAll(final TrieNode o, final int l, final InputInfo ii) { return o; } @Override TrieNode add(final Leaf o, final int l, final InputInfo ii) { return o; } @Override TrieNode add(final List o, final int l, final InputInfo ii) { return o; } @Override TrieNode add(final Branch o, final int l, final InputInfo ii) { return o; } @Override boolean verify() { return true; } @Override void keys(final ValueBuilder ks) { } @Override boolean hasType(final AtomType kt, final SeqType vt) { return true; } @Override int hash(final InputInfo ii) throws QueryException { return 0; } @Override boolean deep(final InputInfo ii, final TrieNode o) { return this == o; } @Override public TrieNode insert(final int h, final Item k, final Value v, final int l, final InputInfo i) throws QueryException { return new Leaf(h, k, v); } @Override StringBuilder toString(final StringBuilder sb) { return sb; } }; /** Size of this node. */ final int size; /** * Constructor. * @param s size */ TrieNode(final int s) { size = s; } /** * Inserts the given value into this map. * @param hash hash code used as key * @param key key to insert * @param val value to insert * @param lvl level * @param ii input info * @return updated map if changed, {@code this} otherwise * @throws QueryException query exception */ abstract TrieNode insert(final int hash, final Item key, final Value val, final int lvl, final InputInfo ii) throws QueryException; /** * Deletes a key from this map. * @param hash hash code of the key * @param key key to delete * @param lvl level * @param ii input info * @return updated map if changed, {@code null} if deleted, * {@code this} otherwise * @throws QueryException query exception */ abstract TrieNode delete(int hash, Item key, int lvl, final InputInfo ii) throws QueryException; /** * Looks up the value associated with the given key. * @param hash hash code * @param key key to look up * @param lvl level * @param ii input info * @return bound value if found, {@code null} otherwise * @throws QueryException query exception */ abstract Value get(int hash, Item key, int lvl, final InputInfo ii) throws QueryException; /** * Checks if the given key exists in the map. * @param hash hash code * @param key key to look for * @param lvl level * @param ii input info * @return {@code true}, if the key exists, {@code false} otherwise * @throws QueryException query exception */ abstract boolean contains(int hash, Item key, int lvl, final InputInfo ii) throws QueryException; /** *

Inserts all bindings from the given node into this one. *

This method is part of the double dispatch pattern and * should be implemented as {@code return o.add(this, lvl, ii);}. * @param o other node * @param lvl level * @param ii input info * @return updated map if changed, {@code this} otherwise * @throws QueryException query exception */ abstract TrieNode addAll(final TrieNode o, final int lvl, final InputInfo ii) throws QueryException; /** * Add a leaf to this node, if the key isn't already used. * @param o leaf to insert * @param lvl level * @param ii input info * @return updated map if changed, {@code this} otherwise * @throws QueryException query exception */ abstract TrieNode add(final Leaf o, final int lvl, final InputInfo ii) throws QueryException; /** * Add an overflow list to this node, if the key isn't already used. * @param o leaf to insert * @param lvl level * @param ii input info * @return updated map if changed, {@code this} otherwise * @throws QueryException query exception */ abstract TrieNode add(final List o, final int lvl, final InputInfo ii) throws QueryException; /** * Add all bindings of the given branch to this node for which the key isn't * already used. * @param o leaf to insert * @param lvl level * @param ii input info * @return updated map if changed, {@code this} otherwise * @throws QueryException query exception */ abstract TrieNode add(final Branch o, final int lvl, final InputInfo ii) throws QueryException; /** * Verifies the tree. * @return check result */ abstract boolean verify(); /** * Collects all keys in this subtree. * @param ks key cache */ abstract void keys(final ValueBuilder ks); /** * Calculates the hash key for the given level. * @param hash hash value * @param lvl current level * @return hash key */ static int key(final int hash, final int lvl) { return hash >>> lvl * Map.BITS & MASK; } @Override public String toString() { return toString(new StringBuilder(), "").toString(); } /** * Recursive {@link #toString()} helper. * * @param sb string builder * @param ind indentation string * @return string builder for convenience */ abstract StringBuilder toString(final StringBuilder sb, final String ind); /** * Checks if the map has the specified key and value type. * @param kt key type * @param vt value type * @return {@code true} if the type fits, {@code false} otherwise */ abstract boolean hasType(final AtomType kt, final SeqType vt); /** * Compares two values. * @param a first value * @param b second value * @param ii input info * @return {@code true} if both values are deep equal, {@code false} otherwise * @throws QueryException query exception */ static boolean deep(final Value a, final Value b, final InputInfo ii) throws QueryException { return a.size() == b.size() && Compare.deep(a, b, ii); } /** * Compares two items. * @param a first item * @param b second item * @param ii input info * @return {@code true} if both items are equal, {@code false} otherwise * @throws QueryException query exception */ static boolean eq(final Item a, final Item b, final InputInfo ii) throws QueryException { return a.comparable(b) && a.eq(b, null, ii); } /** * Calculates the hash code of this node. * @param ii input info * @return hash value * @throws QueryException query exception */ abstract int hash(InputInfo ii) throws QueryException; /** * Checks if this node is indistinguishable from the given node. * @param ii input info * @param o other node * @return result of check * @throws QueryException query exception */ abstract boolean deep(final InputInfo ii, final TrieNode o) throws QueryException; /** * Recursive helper for {@link Map#toString()}. * @param sb string builder * @return reference to {@code sb} */ abstract StringBuilder toString(final StringBuilder sb); }basex-7.7.2/basex-core/src/main/java/org/basex/query/value/node/000077500000000000000000000000001222453003200244055ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/value/node/ANode.java000066400000000000000000000304351222453003200262430ustar00rootroot00000000000000package org.basex.query.value.node; import org.basex.api.dom.*; import org.basex.core.*; import org.basex.data.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Abstract node type. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class ANode extends Item { /** Node Types. */ private static final NodeType[] TYPES = { NodeType.DOC, NodeType.ELM, NodeType.TXT, NodeType.ATT, NodeType.COM, NodeType.PI }; /** Static node counter. */ // [CG] XQuery, node id: move to query context to reduce chance of overflow, or // move to FNode to reduce memory usage of DBNode instances private static int sid; /** Unique node id. */ public final int id = ++sid; /** Cached string value. */ byte[] val; /** Parent node. */ ANode par; /** * Constructor. * @param t data type */ ANode(final NodeType t) { super(t); } @Override public final boolean bool(final InputInfo ii) { return true; } @Override public final byte[] string(final InputInfo ii) { return string(); } /** * Returns the string value. * @return string value */ public abstract byte[] string(); @Override public final boolean eq(final Item it, final Collation coll, final InputInfo ii) throws QueryException { return it.type.isUntyped() ? coll == null ? Token.eq(string(), it.string(ii)) : coll.compare(string(), it.string(ii)) == 0 : it.eq(this, coll, ii); } @Override public final int diff(final Item it, final Collation coll, final InputInfo ii) throws QueryException { return it.type.isUntyped() ? coll == null ? Token.diff(string(), it.string(ii)) : coll.compare(string(), it.string(ii)) : -it.diff(this, coll, ii); } /** * Creates a copy of this node. * @return copy */ public abstract ANode copy(); /** * Returns a deep copy of the node. * @return node copy */ public abstract ANode deepCopy(); /** * Returns a database node representation of the node. * @param prop properties * @return database node */ public DBNode dbCopy(final Prop prop) { final MemData md = new MemData(prop); new DataBuilder(md).build(this); return new DBNode(md); } /** * Returns the name of the node, composed of an optional prefix * and the local name. * This function must only be called for element and attribute nodes. * It is more efficient than calling {@link #qname}, as no {@link QNm} * instance is created. * @return name */ public byte[] name() { return null; } /** * Returns the QName of the node. * This function must only be called for elements, attributes and pi's. * @return name */ public QNm qname() { return null; } /** * Updates the specified with the information of the current node. * This is more efficient than calling {@link #qname}, as an existing * {@link QNm} instance is reused. * This function must only be called for elements, attributes and pi's. * @param nm temporary qname * @return name */ public abstract QNm qname(final QNm nm); /** * Minimizes the memory consumption of the node. * @return self reference */ public ANode optimize() { return this; } /** * Returns all namespaces defined for the nodes. * Overwritten by {@link FElem} and {@link DBNode}. * @return namespace array */ public Atts namespaces() { return null; } /** * Returns a copy of the namespace hierarchy. * @return namespaces */ public final Atts nsScope() { final Atts ns = new Atts(); ANode node = this; do { final Atts n = node.namespaces(); if(n != null) { for(int a = n.size() - 1; a >= 0; a--) { final byte[] key = n.name(a); if(!ns.contains(key)) ns.add(key, n.value(a)); } } node = node.parent(); } while(node != null && node.type == NodeType.ELM); return ns; } /** * Recursively finds the uri for the specified prefix. * @param pref prefix * @param ctx query context * @return uri */ public final byte[] uri(final byte[] pref, final QueryContext ctx) { final Atts at = namespaces(); if(at != null) { final byte[] s = at.value(pref); if(s != null) return s; final ANode n = parent(); if(n != null) return n.uri(pref, ctx); } return pref.length == 0 ? Token.EMPTY : null; } /** * Returns the base URI of the node. * @return base URI */ public byte[] baseURI() { return Token.EMPTY; } /** * Checks if two nodes are identical. * @param node node to be compared * @return result of check */ public abstract boolean is(final ANode node); /** * Checks the document order of two nodes. * @param node node to be compared * @return {@code 0} if the nodes are identical, or {@code 1}/{@code -1} * if the node appears after/before the argument */ public abstract int diff(final ANode node); /** * Compares two nodes for their unique order. * @param node1 first node * @param node2 node to be compared * @return {@code 0} if the nodes are identical, or {@code 1}/{@code -1} * if the first node appears after/before the second */ protected static int diff(final ANode node1, final ANode node2) { // cache parents of first node final ANodeList nl = new ANodeList(); for(ANode n = node1; n != null; n = n.parent()) { if(n == node2) return 1; nl.add(n); } // find lowest common ancestor ANode c2 = node2; LOOP: for(ANode n = node2; (n = n.parent()) != null;) { final int is = nl.size(); for(int i = 1; i < is; i++) { if(n == node1) return -1; if(!nl.get(i).is(n)) continue; // check which node appears as first LCA child final ANode c1 = nl.get(i - 1); final AxisMoreIter ir = n.children(); for(ANode c; (c = ir.next()) != null;) { if(c.is(c1)) return -1; if(c.is(c2)) return 1; } break LOOP; } c2 = n; } return node1.id < node2.id ? -1 : 1; } /** * Returns a final node representation. This method is called by the * step expressions, before it is passed on as result. * @return node */ public ANode finish() { return this; } /** * Returns the parent node. * @return parent node */ public abstract ANode parent(); /** * Sets the parent node. * @param p parent node * @return self reference */ public abstract ANode parent(final ANode p); /** * Returns true if the node has children. * @return result of test */ public abstract boolean hasChildren(); /** * Returns the value of the specified attribute, or {@code null}. * @param name attribute to be found * @return attribute value */ public byte[] attribute(final String name) { return attribute(new QNm(name)); } /** * Returns the value of the specified attribute, or {@code null}. * @param name attribute to be found * @return attribute value */ public byte[] attribute(final byte[] name) { return attribute(new QNm(name)); } /** * Returns the value of the specified attribute, or {@code null}. * @param name attribute to be found * @return attribute value */ public byte[] attribute(final QNm name) { final AxisIter ai = attributes(); while(true) { final ANode node = ai.next(); if(node == null) return null; if(node.qname().eq(name)) return node.string(); } } /** * Returns an ancestor axis iterator. * @return iterator */ public abstract AxisIter ancestor(); /** * Returns an ancestor-or-self axis iterator. * @return iterator */ public abstract AxisIter ancestorOrSelf(); /** * Returns an attribute axis iterator. * @return iterator */ public abstract AxisMoreIter attributes(); /** * Returns a child axis iterator. * @return iterator */ public abstract AxisMoreIter children(); /** * Returns a descendant axis iterator. * @return iterator */ public abstract AxisIter descendant(); /** * Returns a descendant-or-self axis iterator. * @return iterator */ public abstract AxisIter descendantOrSelf(); /** * Returns a following axis iterator. * @return iterator */ public abstract AxisIter following(); /** * Returns a following-sibling axis iterator. * @return iterator */ public abstract AxisIter followingSibling(); /** * Returns a parent axis iterator. * @return iterator */ public abstract AxisIter parentIter(); /** * Returns a preceding axis iterator. * @return iterator */ public final AxisIter preceding() { return new AxisIter() { /** Iterator. */ private NodeSeqBuilder nc; @Override public ANode next() { if(nc == null) { nc = new NodeSeqBuilder(); ANode n = ANode.this; ANode p = n.parent(); while(p != null) { if(n.type != NodeType.ATT) { final NodeSeqBuilder tmp = new NodeSeqBuilder(); final AxisIter ai = p.children(); for(ANode c; (c = ai.next()) != null && !c.is(n);) { tmp.add(c.finish()); addDesc(c.children(), tmp); } for(long t = tmp.size() - 1; t >= 0; t--) nc.add(tmp.get(t)); } n = p; p = p.parent(); } } return nc.next(); } }; } /** * Returns a preceding-sibling axis iterator. * @return iterator */ public final AxisIter precedingSibling() { return new AxisIter() { /** Child nodes. */ private NodeSeqBuilder nc; /** Counter. */ private long c; @Override public ANode next() { if(nc == null) { final ANode r = parent(); if(r == null) return null; nc = new NodeSeqBuilder(); final AxisIter ai = r.children(); for(ANode n; (n = ai.next()) != null && !n.is(ANode.this);) { nc.add(n.finish()); } c = nc.size(); } return c > 0 ? nc.get(--c) : null; } }; } /** * Returns an self axis iterator. * @return iterator */ public final AxisMoreIter self() { return new AxisMoreIter() { /** First call. */ private boolean more = true; @Override public boolean more() { return more; } @Override public ANode next() { return (more ^= true) ? null : ANode.this; } }; } /** * Adds children of a sub node. * @param ch child nodes * @param nc node cache */ static final void addDesc(final AxisMoreIter ch, final NodeSeqBuilder nc) { for(ANode n; (n = ch.next()) != null;) { nc.add(n.finish()); addDesc(n.children(), nc); } } /** * Returns a database kind for the specified node type. * @return node kind */ public int kind() { return kind(nodeType()); } /** * Returns a database kind for the specified node type. * @param t node type * @return node kind */ public static int kind(final NodeType t) { switch(t) { case DOC: return Data.DOC; case ELM: return Data.ELEM; case TXT: return Data.TEXT; case ATT: return Data.ATTR; case COM: return Data.COMM; case PI : return Data.PI; default : return -1; } } /** * Returns a node type for the specified database kind. * @param k database kind * @return node type */ public static NodeType type(final int k) { return TYPES[k]; } @Override public final BXNode toJava() { return BXNode.get(deepCopy()); } /** * Returns this Node's node type. * @return node type */ public final NodeType nodeType() { return (NodeType) type; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/node/DBNode.java000066400000000000000000000307431222453003200263520ustar00rootroot00000000000000package org.basex.query.value.node; import static org.basex.query.QueryText.*; import java.io.*; import org.basex.build.*; import org.basex.core.*; import org.basex.data.*; import org.basex.io.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.query.value.type.Type.ID; import org.basex.query.var.*; import org.basex.util.*; import org.basex.util.ft.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * Database nodes. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class DBNode extends ANode { /** Data reference. */ public final Data data; /** Pre value. */ public int pre; /** Namespaces. */ private Atts nsp; /** * Constructor, creating a document node from the specified data reference. * @param d data reference */ public DBNode(final Data d) { this(d, 0); } /** * Constructor, creating a node from the specified data reference. * @param d data reference * @param p pre value */ public DBNode(final Data d, final int p) { this(d, p, d.kind(p)); } /** * Constructor, specifying full node information. * @param d data reference * @param p pre value * @param k node kind */ public DBNode(final Data d, final int p, final int k) { this(d, p, null, type(k)); } /** * Constructor, specifying full node information. * @param d data reference * @param p pre value * @param r parent reference * @param t node type */ DBNode(final Data d, final int p, final ANode r, final NodeType t) { super(t); data = d; pre = p; par = r; } /** * Constructor, specifying an XML input reference. * @param input input reference * @param prop database properties * @throws IOException I/O exception */ public DBNode(final IO input, final Prop prop) throws IOException { this(Parser.xmlParser(input, prop)); } /** * Constructor, specifying a parser reference. * @param parser parser * @throws IOException I/O exception */ public DBNode(final Parser parser) throws IOException { this(MemBuilder.build("", parser)); } /** * Sets the node type. * @param p pre value * @param k node kind */ public final void set(final int p, final int k) { type = type(k); par = null; val = null; nsp = null; pre = p; } @Override public final Data data() { return data; } @Override public final byte[] string() { if(val == null) val = data.atom(pre); return val; } @Override public final long itr(final InputInfo ii) throws QueryException { final boolean txt = type == NodeType.TXT || type == NodeType.COM; if(txt || type == NodeType.ATT) { final long l = data.textItr(pre, txt); if(l != Long.MIN_VALUE) return l; } return Int.parse(data.atom(pre), ii); } @Override public final double dbl(final InputInfo ii) throws QueryException { final boolean txt = type == NodeType.TXT || type == NodeType.COM; if(txt || type == NodeType.ATT) { final double d = data.textDbl(pre, txt); if(!Double.isNaN(d)) return d; } return Dbl.parse(data.atom(pre), ii); } @Override public final byte[] name() { return type == NodeType.ELM || type == NodeType.ATT || type == NodeType.PI ? data.name(pre, kind(nodeType())) : Token.EMPTY; } @Override public final QNm qname() { return type == NodeType.ELM || type == NodeType.ATT || type == NodeType.PI ? qname(new QNm()) : null; } @Override public final QNm qname(final QNm name) { // update the name and uri strings in the specified QName final byte[] nm = name(); byte[] uri = Token.EMPTY; final boolean pref = Token.indexOf(nm, ':') != -1; if(pref || data.nspaces.size() != 0) { final int n = pref ? data.nspaces.uri(nm, pre, data) : data.uri(pre, data.kind(pre)); final byte[] u = n > 0 ? data.nspaces.uri(n) : pref ? NSGlobal.uri(Token.prefix(nm)) : null; if(u != null) uri = u; } name.set(nm, uri); return name; } @Override public final Atts namespaces() { if(type == NodeType.ELM && nsp == null) nsp = data.ns(pre); return nsp; } @Override public final byte[] baseURI() { if(type == NodeType.DOC) { final byte[] base = data.text(pre, true); if(data.inMemory()) { final String bs = Token.string(base); if(bs.endsWith(IO.BASEXSUFFIX + IO.XMLSUFFIX)) return Token.EMPTY; final String dir = data.meta.original; return Token.token(dir.isEmpty() ? bs : IO.get(dir).merge(bs).url()); } return new TokenBuilder(data.meta.name).add('/').add(base).finish(); } final byte[] b = attribute(new QNm(BASE, XMLURI)); return b != null ? b : Token.EMPTY; } @Override public final boolean is(final ANode node) { return node == this || node instanceof DBNode && data == node.data() && pre == ((DBNode) node).pre; } @Override public final int diff(final ANode node) { // compare fragment with database node; specify fragment first to save time if(node instanceof FNode) return -diff(node, this); // same database instance: compare pre values if(data == node.data()) { final int p = ((DBNode) node).pre; return pre > p ? 1 : pre < p ? -1 : 0; } // check order via lowest common ancestor return diff(this, node); } @Override public final DBNode copy() { final DBNode n = new DBNode(data, pre, par, nodeType()); n.score = score; return n; } @Override public final Value copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { return copy(); } @Override public final DBNode dbCopy(final Prop prop) { final MemData md = data.inMemory() ? new MemData(data) : new MemData(prop); new DataBuilder(md).build(this); return new DBNode(md).parent(par); } @Override public final DBNode deepCopy() { return dbCopy(data.meta.prop); } @Override public final DBNode finish() { return copy(); } @Override public final ANode parent() { if(par != null) return par; final int p = data.parent(pre, data.kind(pre)); if(p == -1) return null; final DBNode node = copy(); node.set(p, data.kind(p)); node.score(Scoring.step(node.score())); return node; } @Override public final DBNode parent(final ANode p) { par = p; return this; } @Override public final boolean hasChildren() { final int k = data.kind(pre); return data.attSize(pre, k) != data.size(pre, k); } @Override public final AxisIter ancestor() { return new AxisIter() { private final DBNode node = copy(); int p = pre; int k = data.kind(p); final double sc = node.score(); @Override public ANode next() { p = data.parent(p, k); if(p == -1) return null; k = data.kind(p); node.set(p, k); node.score(Scoring.step(sc)); return node; } }; } @Override public final AxisIter ancestorOrSelf() { return new AxisIter() { private final DBNode node = copy(); int p = pre; int k = data.kind(p); final double sc = node.score(); @Override public ANode next() { if(p == -1) return null; k = data.kind(p); node.set(p, k); node.score(Scoring.step(sc)); p = data.parent(p, k); return node; } }; } @Override public final AxisMoreIter attributes() { return new AxisMoreIter() { final DBNode node = copy(); final int s = pre + data.attSize(pre, data.kind(pre)); int p = pre + 1; @Override public boolean more() { return p != s; } @Override public DBNode next() { if(!more()) return null; node.set(p++, Data.ATTR); return node; } }; } @Override public final AxisMoreIter children() { return new AxisMoreIter() { int k = data.kind(pre); int p = pre + data.attSize(pre, k); final int s = pre + data.size(pre, k); final DBNode node = copy(); final double sc = node.score(); @Override public boolean more() { return p < s; } @Override public ANode next() { if(!more()) return null; k = data.kind(p); node.set(p, k); node.score(Scoring.step(sc)); p += data.size(p, k); return node; } }; } @Override public final AxisIter descendant() { return new AxisIter() { int k = data.kind(pre); int p = pre + data.attSize(pre, k); final int s = pre + data.size(pre, k); final DBNode node = copy(); final double sc = node.score(); @Override public DBNode next() { if(p == s) return null; k = data.kind(p); node.set(p, k); p += data.attSize(p, k); node.score(Scoring.step(sc)); return node; } }; } @Override public final AxisIter descendantOrSelf() { return new AxisIter() { final DBNode node = copy(); final int s = pre + data.size(pre, data.kind(pre)); int p = pre; @Override public ANode next() { if(p == s) return null; final int k = data.kind(p); node.set(p, k); p += data.attSize(p, k); return node; } }; } @Override public final AxisIter following() { return new AxisIter() { private final DBNode node = copy(); final int s = data.meta.size; int k = data.kind(pre); int p = pre + data.size(pre, k); @Override public ANode next() { if(p == s) return null; k = data.kind(p); node.set(p, k); p += data.attSize(p, k); return node; } }; } @Override public final AxisIter followingSibling() { return new AxisIter() { private final DBNode node = copy(); int k = data.kind(pre); private final int pp = data.parent(pre, k); final int s = pp == -1 ? 0 : pp + data.size(pp, data.kind(pp)); int p = pp == -1 ? 0 : pre + data.size(pre, k); @Override public ANode next() { if(p == s) return null; k = data.kind(p); node.set(p, k); p += data.size(p, k); return node; } }; } @Override public final AxisIter parentIter() { return new AxisIter() { /** First call. */ private boolean more; @Override public ANode next() { if(more) return null; more = true; return parent(); } }; } @Override public final boolean sameAs(final Expr cmp) { return cmp instanceof DBNode && data == ((DBNode) cmp).data && pre == ((DBNode) cmp).pre; } @Override public final void plan(final FElem plan) { addPlan(plan, planElem(NAM, data.meta.name, PRE, pre)); } @Override public final byte[] xdmInfo() { final ByteList bl = new ByteList().add(typeId().asByte()); if(type == NodeType.DOC) bl.add(baseURI()).add(0); else if(type == NodeType.ATT) bl.add(qname().uri()).add(0); return bl.toArray(); } @Override public final ID typeId() { // check if a document has a single element as child Type.ID t = type.id(); if(type == NodeType.DOC) { final AxisMoreIter ai = children(); if(ai.more() && ai.next().type == NodeType.ELM && !ai.more()) t = NodeType.DEL.id(); } return t; } @Override public String toString() { final TokenBuilder tb = new TokenBuilder(type.string()).add(' '); switch((NodeType) type) { case ATT: case PI: tb.add(name()).add(" { \"").add(Token.chop(string(), 64)).add("\" }"); break; case ELM: tb.add(name()).add(" { ... }"); break; case DOC: tb.add("{ \"").add(data.text(pre, true)).add("\" }"); break; default: tb.add("{ \"").add(Token.chop(string(), 64)).add("\" }"); break; } return tb.toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/node/FAttr.java000066400000000000000000000037421222453003200262760ustar00rootroot00000000000000package org.basex.query.value.node; import static org.basex.query.QueryText.*; import static org.basex.util.Token.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.list.*; import org.w3c.dom.*; /** * Attribute node fragment. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FAttr extends FNode { /** Attribute name. */ private final QNm name; /** * Constructor for creating an attribute. * QNames will be cached and reused. * @param n name * @param v value */ public FAttr(final String n, final String v) { this(token(n), token(v)); } /** * Constructor for creating an attribute. * QNames will be cached and reused. * @param n name * @param v value */ public FAttr(final byte[] n, final byte[] v) { this(QNm.get(n), v); } /** * Default constructor. * @param n name * @param v value */ public FAttr(final QNm n, final byte[] v) { super(NodeType.ATT); name = n; val = v; } /** * Constructor for creating an attribute from a DOM node. * Originally provided by Erdal Karaca. * @param attr DOM node */ public FAttr(final Attr attr) { this(new QNm(attr.getName()), token(attr.getValue())); } @Override public QNm qname() { return name; } @Override public byte[] name() { return name.string(); } @Override public FNode copy() { return new FAttr(name, val).parent(par); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(NAM, name.string(), VAL, val)); } @Override public byte[] xdmInfo() { return new ByteList().add(typeId().asByte()).add(name.uri()).add(0).toArray(); } @Override public String toString() { return Util.info(" %=\"%\"", name.string(), Token.string(val).replaceAll("\"", """)); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/node/FComm.java000066400000000000000000000030051222453003200262470ustar00rootroot00000000000000package org.basex.query.value.node; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import org.basex.query.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.w3c.dom.*; /** * Comment node fragment. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FComm extends FNode { /** Two dashes, marking the start/end of a comment. */ private static final byte[] DASHES = { '-', '-' }; /** * Constructor. * @param t text value */ public FComm(final String t) { this(token(t)); } /** * Constructor. * @param t text value */ public FComm(final byte[] t) { super(NodeType.COM); val = t; } /** * Constructor for creating a comment from a DOM node. * Originally provided by Erdal Karaca. * @param com DOM node */ public FComm(final Comment com) { this(com.getData()); } @Override public FNode copy() { return new FComm(val).parent(par); } @Override public String toString() { return Util.info("", val); } /** * Checks the specified token for validity. * @param str token to be checked * @param ii input info * @return token * @throws QueryException query exception */ public static byte[] parse(final byte[] str, final InputInfo ii) throws QueryException { if(contains(str, DASHES) || endsWith(str, '-')) COMINVALID.thrw(ii, str); return str; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/node/FDoc.java000066400000000000000000000055241222453003200260710ustar00rootroot00000000000000package org.basex.query.value.node; import static org.basex.query.QueryText.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; import org.w3c.dom.*; /** * Document node fragment. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FDoc extends FNode { /** Child nodes. */ private final ANodeList children; /** Base URI. */ private final byte[] base; /** * Constructor. */ public FDoc() { this(Token.EMPTY); } /** * Constructor. * @param b base uri */ public FDoc(final String b) { this(Token.token(b)); } /** * Constructor. * @param b base uri */ public FDoc(final byte[] b) { this(new ANodeList(), b); } /** * Constructor. * @param ch children * @param b base uri */ public FDoc(final ANodeList ch, final byte[] b) { super(NodeType.DOC); children = ch; base = b; // update parent references for(final ANode n : ch) n.parent(this); } @Override public FDoc optimize() { // update parent references for(final ANode n : children) n.parent(this); return this; } /** * Adds a node and updates its parent reference. * @param node node to be added * @return self reference */ public FDoc add(final ANode node) { children.add(node); node.parent(this); return this; } /** * Constructor for DOM nodes. * Originally provided by Erdal Karaca. * @param doc DOM node * @param bu base uri */ public FDoc(final DocumentFragment doc, final byte[] bu) { this(bu); final Node elem = doc.getFirstChild(); if(elem instanceof Element) children.add(new FElem((Element) elem, this, new TokenMap())); } @Override public byte[] string() { return string(children); } @Override public AxisMoreIter children() { return iter(children); } @Override public boolean hasChildren() { return !children.isEmpty(); } @Override public byte[] baseURI() { return base; } @Override public FDoc copy() { return new FDoc(children, base).optimize(); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(BASE, base)); } @Override public byte[] xdmInfo() { return new ByteList().add(typeId().asByte()).add(base).add(0).toArray(); } @Override public Type.ID typeId() { // check if a document has a single element as child return children.size() == 1 && children.get(0).type == NodeType.ELM ? NodeType.DEL.id() : type.id(); } @Override public String toString() { return Util.info("%(%)", type, base); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/node/FElem.java000066400000000000000000000300721222453003200262420ustar00rootroot00000000000000package org.basex.query.value.node; import static org.basex.query.QueryText.*; import static org.basex.util.Token.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.hash.*; import org.w3c.dom.*; /** * Element node fragment. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FElem extends FNode { /** Element name. */ private final QNm name; /** Child nodes (may be set {@code null}). */ private ANodeList children; /** Attributes (may be set {@code null}). */ private ANodeList atts; /** Namespaces (may be set {@code null}). */ private Atts ns; /** * Convenience constructor for creating an element. * All QNames that are created from the specified name will be cached. * @param nm element name */ public FElem(final String nm) { this(token(nm)); } /** * Convenience constructor for creating an element. * All QNames that are created from the specified name will be cached. * @param nm element name */ public FElem(final byte[] nm) { this(QNm.get(nm)); } /** * Convenience constructor for creating an element with a new namespace. * QNames will be cached and reused. * @param local local name * @param uri namespace uri */ public FElem(final byte[] local, final byte[] uri) { this(Token.EMPTY, local, uri); } /** * Convenience constructor for creating an element with a new namespace. * QNames will be cached and reused. * @param local local name * @param uri namespace uri */ public FElem(final String local, final String uri) { this(Token.EMPTY, Token.token(local), Token.token(uri)); } /** * Convenience constructor for creating an element with a new namespace. * QNames will be cached and reused. * @param prefix prefix (a default namespace will be created if the string is empty) * @param local local name * @param uri namespace uri */ public FElem(final String prefix, final String local, final String uri) { this(Token.token(prefix), Token.token(local), Token.token(uri)); } /** * Convenience constructor for creating an element with a new namespace. * QNames will be cached and reused. * @param prefix prefix (a default namespace will be created if the string is empty) * @param local local name * @param uri namespace uri */ public FElem(final byte[] prefix, final byte[] local, final byte[] uri) { this(QNm.get(prefix, local, uri)); } /** * Constructor for creating an element. * @param n element name */ public FElem(final QNm n) { this(n, null); } /** * Constructor for creating an element with namespace declarations. * @param n element name * @param nsp namespaces */ private FElem(final QNm n, final Atts nsp) { this(n, nsp, null, null); } /** * Constructor for creating an element with nodes, attributes and * namespace declarations. * @param nm element name * @param nsp namespaces; can be {@code null} * @param ch children; can be {@code null} * @param at attributes; can be {@code null} */ public FElem(final QNm nm, final Atts nsp, final ANodeList ch, final ANodeList at) { super(NodeType.ELM); name = nm; children = ch; atts = at; ns = nsp; } /** * Constructor for creating an element from a DOM node. * Originally provided by Erdal Karaca. * @param elem DOM node * @param p parent reference * @param nss namespaces in scope */ public FElem(final Element elem, final ANode p, final TokenMap nss) { super(NodeType.ELM); // general stuff final String nu = elem.getNamespaceURI(); name = new QNm(elem.getNodeName(), nu == null ? EMPTY : token(nu)); par = p; ns = new Atts(); // attributes and namespaces final NamedNodeMap at = elem.getAttributes(); final int as = at.getLength(); for(int i = 0; i < as; ++i) { final Attr att = (Attr) at.item(i); final byte[] nm = token(att.getName()), uri = token(att.getValue()); if(Token.eq(nm, XMLNS)) { ns.add(EMPTY, uri); } else if(startsWith(nm, XMLNSC)) { ns.add(local(nm), uri); } else { add(new FAttr(att)); } } // add all new namespaces for(int i = 0; i < ns.size(); ++i) nss.put(ns.name(i), ns.value(i)); // no parent, so we have to add all namespaces in scope if(p == null) { nsScope(elem.getParentNode(), nss); for(final byte[] pref : nss) { if(!ns.contains(pref)) ns.add(pref, nss.get(pref)); } } final byte[] pref = name.prefix(); final byte[] uri = name.uri(); final byte[] old = nss.get(pref); if(old == null || !Token.eq(uri, old)) { ns.add(pref, uri); nss.put(pref, uri); } // children final NodeList ch = elem.getChildNodes(); for(int i = 0; i < ch.getLength(); ++i) { final Node child = ch.item(i); switch(child.getNodeType()) { case Node.TEXT_NODE: add(new FTxt((Text) child)); break; case Node.COMMENT_NODE: add(new FComm((Comment) child)); break; case Node.PROCESSING_INSTRUCTION_NODE: add(new FPI((ProcessingInstruction) child)); break; case Node.ELEMENT_NODE: add(new FElem((Element) child, this, nss)); break; default: break; } } optimize(); } /** * Gathers all defined namespaces in the scope of the given DOM element. * @param elem DOM element * @param nss map */ private static void nsScope(final Node elem, final TokenMap nss) { Node n = elem; // only elements can declare namespaces while(n instanceof Element) { final NamedNodeMap atts = n.getAttributes(); final byte[] pref = token(n.getPrefix()); if(nss.get(pref) != null) nss.put(pref, token(n.getNamespaceURI())); final int len = atts.getLength(); for(int i = 0; i < len; ++i) { final Attr a = (Attr) atts.item(i); final byte[] name = token(a.getName()), val = token(a.getValue()); if(Token.eq(name, XMLNS)) { // default namespace if(nss.get(EMPTY) == null) nss.put(EMPTY, val); } else if(startsWith(name, XMLNS)) { // prefixed namespace final byte[] ln = local(name); if(nss.get(ln) == null) nss.put(ln, val); } } n = n.getParentNode(); } } @Override public FElem optimize() { // update parent references and invalidate empty arrays if(children != null) { for(final ANode n : children) n.parent(this); if(children.isEmpty()) children = null; } if(atts != null) { for(final ANode n : atts) n.parent(this); if(atts.isEmpty()) atts = null; } if(ns != null && ns.isEmpty()) ns = null; return this; } /** * Adds a namespace declaration for the namespace in the given QName. * @return self reference */ public FElem declareNS() { namespaces().add(name.prefix(), name.uri()); return this; } /** * Adds a node and updates its parent reference. * @param node node to be added * @return self reference */ public FElem add(final ANode node) { if(node.type == NodeType.ATT) { if(atts == null) atts = new ANodeList(node); else atts.add(node); } else { if(children == null) children = new ANodeList(node); else children.add(node); } node.parent(this); return this; } /** * Adds an attribute and updates its parent reference. * @param nm attribute name * @param value attribute value * @return self reference */ public FElem add(final String nm, final String value) { return add(token(nm), token(value)); } /** * Adds an attribute and updates its parent reference. * @param nm attribute name * @param value attribute value * @return self reference */ public FElem add(final byte[] nm, final String value) { return add(nm, token(value)); } /** * Adds an attribute and updates its parent reference. * @param nm attribute name * @param value attribute value * @return self reference */ public FElem add(final String nm, final byte[] value) { return add(token(nm), value); } /** * Adds an attribute and updates its parent reference. * @param nm attribute name * @param value attribute value * @return self reference */ public FElem add(final byte[] nm, final byte[] value) { return add(new FAttr(nm, value)); } /** * Adds an attribute and updates its parent reference. * @param nm attribute name * @param value attribute value * @return self reference */ public FElem add(final QNm nm, final String value) { return add(nm, token(value)); } /** * Adds an attribute and updates its parent reference. * @param nm attribute name * @param value attribute value * @return self reference */ public FElem add(final QNm nm, final byte[] value) { return add(new FAttr(nm, value)); } /** * Creates and adds a text node if the specified value is not empty. * Converts the specified string to a token and calls {@link #add(byte[])}. * @param text value of text node * @return self reference */ public FElem add(final String text) { return add(token(text)); } /** * Creates and adds a text node if the specified value is not empty. * @param text value of text node * @return self reference */ public FElem add(final byte[] text) { if(text.length != 0) { final FTxt txt = new FTxt(text); if(children == null) children = new ANodeList(txt); else children.add(txt); txt.parent(this); } return this; } @Override public Atts namespaces() { if(ns == null) ns = new Atts(); return ns; } @Override public byte[] string() { return children == null ? EMPTY : string(children); } @Override public byte[] baseURI() { final byte[] b = attribute(new QNm(BASE, XMLURI)); return b != null ? b : EMPTY; } @Override public QNm qname() { return name; } @Override public byte[] name() { return name.string(); } @Override public AxisMoreIter attributes() { return atts != null ? iter(atts) : super.attributes(); } @Override public AxisMoreIter children() { return children != null ? iter(children) : super.children(); } @Override public boolean hasChildren() { return children != null && !children.isEmpty(); } @Override public FElem copy() { // nodes must be added after root constructor in order to ensure ascending node ids final ANodeList ch = children != null ? new ANodeList(children.size()) : null; final ANodeList at = atts != null ? new ANodeList(atts.size()) : null; final Atts as = ns != null ? new Atts() : null; final FElem node = new FElem(name, as, ch, at); if(ns != null) for(int n = 0; n < ns.size(); ++n) as.add(ns.name(n), ns.value(n)); if(atts != null) for(final ANode n : atts) at.add(n.copy()); if(children != null) for(final ANode n : children) ch.add(n.copy()); node.parent(par); return node.optimize(); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(NAM, name.string())); } @Override public String toString() { final TokenBuilder tb = new TokenBuilder().add('<').add(name.string()); if(ns != null) { for(int n = 0; n < ns.size(); n++) { tb.add(new FNames(ns.name(n), ns.value(n)).toString()); } } if(atts != null) { for(final ANode n : atts) tb.add(n.toString()); } if(hasChildren()) tb.add(">...").toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/node/FNames.java000066400000000000000000000022241222453003200264210ustar00rootroot00000000000000package org.basex.query.value.node; import static org.basex.query.QueryText.*; import static org.basex.util.Token.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Namespace node. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNames extends FNode { /** Namespace name. */ private final byte[] name; /** * Default constructor. * @param n name * @param v value */ public FNames(final byte[] n, final byte[] v) { super(NodeType.NSP); name = n; val = v; } @Override public QNm qname() { return new QNm(name); } @Override public byte[] name() { return name; } @Override public FNode copy() { return new FNames(name, val); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(NAM, name, VAL, val)); } @Override public String toString() { final TokenBuilder tb = new TokenBuilder().add(' ').add(XMLNS); if(name.length != 0) tb.add(':').add(name); return tb.add("=\"").add(Token.string(val).replaceAll("\"", "\"\"")). add('"').toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/node/FNode.java000066400000000000000000000133201222453003200262420ustar00rootroot00000000000000package org.basex.query.value.node; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Main memory based node fragments. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class FNode extends ANode { /** * Constructor. * @param t data type */ FNode(final NodeType t) { super(t); } @Override public byte[] string() { if(val == null) val = Token.EMPTY; return val; } @Override public final QNm qname(final QNm nm) { return qname(); } @Override public final ANode deepCopy() { return copy(); } @Override public final boolean is(final ANode node) { return id == node.id; } @Override public final int diff(final ANode node) { // compare fragment with database node if(node instanceof DBNode) return diff(this, node); // compare fragments: compare node ids final int i = node.id; return id > i ? 1 : id < i ? -1 : 0; } @Override public final ANode parent() { return par; } @Override public final AxisIter ancestor() { return new AxisIter() { private ANode node = FNode.this; @Override public ANode next() { node = node.parent(); return node; } }; } @Override public final AxisIter ancestorOrSelf() { return new AxisIter() { private ANode node = FNode.this; @Override public ANode next() { if(node == null) return null; final ANode n = node; node = n.parent(); return n; } }; } @Override public AxisMoreIter attributes() { return AxisMoreIter.EMPTY; } @Override public AxisMoreIter children() { return AxisMoreIter.EMPTY; } @Override public final FNode parent(final ANode p) { par = p; return this; } @Override public boolean hasChildren() { return false; } @Override public final AxisIter descendant() { return desc(false); } @Override public final AxisIter descendantOrSelf() { return desc(true); } /** * Iterates all nodes of the specified iterator. * @param iter iterator * @return node iterator */ static final AxisMoreIter iter(final ANodeList iter) { return new AxisMoreIter() { /** Child counter. */ int c; @Override public boolean more() { return iter != null && c != iter.size(); } @Override public ANode next() { return more() ? iter.get(c++) : null; } @Override public ANode get(final long i) { return iter.get((int) i); } @Override public long size() { return iter.size(); } @Override public boolean reset() { c = 0; return true; } @Override public Value value() { return iter.value(); } }; } /** * Returns the string value for the specified nodes. * @param iter iterator * @return node iterator */ final byte[] string(final ANodeList iter) { if(val == null) { final TokenBuilder tb = new TokenBuilder(); for(final ANode nc : iter) { if(nc.type == NodeType.ELM || nc.type == NodeType.TXT) tb.add(nc.string()); } val = tb.finish(); } return val; } /** * Returns an iterator for all descendant nodes. * @param self include self node * @return node iterator */ private AxisIter desc(final boolean self) { return new AxisIter() { /** Iterator. */ private AxisMoreIter[] nm = new AxisMoreIter[1]; /** Iterator Level. */ private int l; @Override public ANode next() { if(nm[0] == null) nm[0] = self ? self() : children(); if(l < 0) return null; final ANode node = nm[l].next(); if(node != null) { final AxisMoreIter ch = node.children(); if(ch.more()) { if(l + 1 == nm.length) nm = Array.copy(nm, new AxisMoreIter[l + 1 << 1]); nm[++l] = ch; } else { while(!nm[l].more()) if(l-- <= 0) break; } } return node; } }; } @Override public final AxisIter parentIter() { return new AxisIter() { /** First call. */ private boolean more; @Override public ANode next() { return (more ^= true) ? par : null; } }; } @Override public final AxisIter followingSibling() { return new AxisIter() { /** Iterator. */ private AxisIter ai; @Override public ANode next() { if(ai == null) { final ANode r = parent(); if(r == null) return null; ai = r.children(); for(ANode n; (n = ai.next()) != null && !n.is(FNode.this);); } return ai.next(); } }; } @Override public final AxisIter following() { return new AxisIter() { /** Iterator. */ private NodeSeqBuilder nc; @Override public ANode next() { if(nc == null) { nc = new NodeSeqBuilder(); ANode n = FNode.this; ANode p = n.parent(); while(p != null) { final AxisIter i = p.children(); for(ANode c; n.type != NodeType.ATT && (c = i.next()) != null && !c.is(n);); for(ANode c; (c = i.next()) != null;) { nc.add(c.finish()); addDesc(c.children(), nc); } n = p; p = p.parent(); } } return nc.next(); } }; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/node/FPI.java000066400000000000000000000040711222453003200256700ustar00rootroot00000000000000package org.basex.query.value.node; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.w3c.dom.*; /** * PI node fragment. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FPI extends FNode { /** Closing processing instruction. */ private static final byte[] CLOSE = { '?', '>' }; /** PI name. */ private final QNm name; /** * Constructor for creating a processing instruction. * @param n name * @param v value */ public FPI(final String n, final String v) { this(QNm.get(n), token(v)); } /** * Constructor for creating a processing instruction. * @param n name * @param v value */ public FPI(final QNm n, final byte[] v) { super(NodeType.PI); name = n; val = v; } /** * Constructor for creating a processing instruction from a DOM node. * Originally provided by Erdal Karaca. * @param pi DOM node */ public FPI(final ProcessingInstruction pi) { this(pi.getTarget(), pi.getData()); } @Override public QNm qname() { return name; } @Override public byte[] name() { return name.string(); } @Override public FNode copy() { return new FPI(name, val).parent(par); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(NAM, name.string(), VAL, val)); } @Override public String toString() { return Util.info("", name.string(), val); } /** * Checks the specified token for validity. * @param atom token to be checked * @param ii input info * @return token * @throws QueryException query exception */ public static byte[] parse(final byte[] atom, final InputInfo ii) throws QueryException { if(contains(atom, CLOSE)) CPICONT.thrw(ii, atom); return atom; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/node/FTNode.java000066400000000000000000000027041222453003200263720ustar00rootroot00000000000000package org.basex.query.value.node; import org.basex.data.*; import org.basex.query.value.type.*; import org.basex.util.ft.*; /** * Disk-based full-text Node item. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FTNode extends DBNode { /** Length of the full-text token. */ private final int tl; /** Total number of indexed results. */ private final int is; /** Full-text matches. */ public FTMatches all; /** * Constructor, called by the sequential variant. * @param a matches * @param s scoring */ public FTNode(final FTMatches a, final double s) { this(a, null, 0, 0, 0, s); } /** * Constructor, called by the index variant. * @param a full-text matches * @param d data reference * @param p pre value * @param tol token length * @param tis total size indexed results * @param s score value out of the index */ public FTNode(final FTMatches a, final Data d, final int p, final int tol, final int tis, final double s) { super(d, p, null, NodeType.TXT); all = a; tl = tol; is = tis; if(s != -1) score = s; } @Override public double score() { if(score == null) { if(all == null) return 0; score = Scoring.textNode(all.size(), is, tl, data.textLen(pre, true)); } return score; } @Override public String toString() { return super.toString() + (all != null ? " (" + all.size() + ')' : ""); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/node/FTPosNode.java000066400000000000000000000010561222453003200270530ustar00rootroot00000000000000package org.basex.query.value.node; import org.basex.data.*; /** * Database node with full-text positions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FTPosNode extends DBNode { /** Full-text positions. */ public final FTPosData ft; /** * Constructor, called by the sequential variant. * @param d data reference * @param p pre value * @param ftpos full-text positions */ public FTPosNode(final Data d, final int p, final FTPosData ftpos) { super(d, p); ft = ftpos; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/node/FTxt.java000066400000000000000000000020441222453003200261350ustar00rootroot00000000000000package org.basex.query.value.node; import static org.basex.query.QueryText.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.w3c.dom.*; /** * Text node fragment. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FTxt extends FNode { /** * Constructor. * @param t text value */ public FTxt(final String t) { this(Token.token(t)); } /** * Constructor. * @param t text value */ public FTxt(final byte[] t) { super(NodeType.TXT); val = t; } /** * Constructor for creating a text from a DOM node. * Originally provided by Erdal Karaca. * @param txt DOM node */ public FTxt(final Text txt) { this(txt.getData()); } @Override public FNode copy() { return new FTxt(val).parent(par); } @Override public void plan(final FElem plan) { addPlan(plan, planElem(VAL, val)); } @Override public String toString() { return Token.string(val); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/package.html000066400000000000000000000000451222453003200257400ustar00rootroot00000000000000 XQuery data types. basex-7.7.2/basex-core/src/main/java/org/basex/query/value/seq/000077500000000000000000000000001222453003200242505ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/value/seq/BlnSeq.java000066400000000000000000000044551222453003200263070ustar00rootroot00000000000000package org.basex.query.value.seq; import java.util.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; /** * Sequence of items of type {@link Int xs:boolean}, containing at least two of them. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BlnSeq extends NativeSeq { /** Values. */ private final boolean[] values; /** * Constructor. * @param vals bytes */ private BlnSeq(final boolean[] vals) { super(vals.length, AtomType.BLN); values = vals; } @Override public Bln itemAt(final long pos) { return Bln.get(values[(int) pos]); } @Override public boolean sameAs(final Expr cmp) { return cmp instanceof BlnSeq && Arrays.equals(values, ((BlnSeq) cmp).values); } @Override public boolean[] toJava() { return values; } @Override public Value reverse() { final int s = values.length; final boolean[] tmp = new boolean[s]; for(int l = 0, r = s - 1; l < s; l++, r--) tmp[l] = values[r]; return get(tmp); } // STATIC METHODS ===================================================================== /** * Creates a sequence with the specified items. * @param items items * @return value */ public static Value get(final boolean[] items) { return items.length == 0 ? Empty.SEQ : items.length == 1 ? Bln.get(items[0]) : new BlnSeq(items); } /** * Creates a sequence with the items in the specified expressions. * @param vals values * @param size size of resulting sequence * @return value * @throws QueryException query exception */ public static Value get(final Value[] vals, final int size) throws QueryException { final boolean[] tmp = new boolean[size]; int t = 0; for(final Value val : vals) { // speed up construction, depending on input final int vs = (int) val.size(); if(val instanceof Item) { tmp[t++] = ((Item) val).bool(null); } else if(val instanceof BlnSeq) { final BlnSeq sq = (BlnSeq) val; System.arraycopy(sq.values, 0, tmp, t, vs); t += vs; } else { for(int v = 0; v < vs; v++) tmp[t++] = val.itemAt(v).bool(null); } } return get(tmp); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/seq/BytSeq.java000066400000000000000000000044611222453003200263270ustar00rootroot00000000000000package org.basex.query.value.seq; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Sequence of items of type {@link Int xs:byte}, containing at least two of them. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BytSeq extends NativeSeq { /** Values. */ private final byte[] values; /** * Constructor. * @param vals bytes */ private BytSeq(final byte[] vals) { super(vals.length, AtomType.BYT); values = vals; } @Override public Int itemAt(final long pos) { return new Int(values[(int) pos], type); } @Override public boolean sameAs(final Expr cmp) { return cmp instanceof BytSeq && Token.eq(values, ((BytSeq) cmp).values); } @Override public byte[] toJava() { return values; } @Override public Value reverse() { final int s = values.length; final byte[] tmp = new byte[s]; for(int l = 0, r = s - 1; l < s; l++, r--) tmp[l] = values[r]; return get(tmp); } // STATIC METHODS ===================================================================== /** * Creates a sequence with the specified items. * @param items items * @return value */ public static Value get(final byte[] items) { return items.length == 0 ? Empty.SEQ : items.length == 1 ? Int.get(items[0], AtomType.BYT) : new BytSeq(items); } /** * Creates a sequence with the items in the specified expressions. * @param vals values * @param size size of resulting sequence * @return value * @throws QueryException query exception */ public static Value get(final Value[] vals, final int size) throws QueryException { final byte[] tmp = new byte[size]; int t = 0; for(final Value val : vals) { // speed up construction, depending on input final int vs = (int) val.size(); if(val instanceof Item) { tmp[t++] = (byte) ((Item) val).itr(null); } else if(val instanceof BytSeq) { final BytSeq sq = (BytSeq) val; System.arraycopy(sq.values, 0, tmp, t, vs); t += vs; } else { for(int v = 0; v < vs; v++) tmp[t++] = (byte) val.itemAt(v).itr(null); } } return get(tmp); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/seq/DBNodeSeq.java000066400000000000000000000055601222453003200266650ustar00rootroot00000000000000package org.basex.query.value.seq; import org.basex.data.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.list.*; /** * Sequence, containing at least two ordered database nodes. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DBNodeSeq extends NativeSeq { /** Data reference. */ private final Data data; /** Pre values. */ public final int[] pres; /** Complete. */ public final boolean complete; /** * Constructor. * @param p pre values * @param d data reference * @param t node type * @param c indicates if pre values represent all document nodes of a database */ private DBNodeSeq(final int[] p, final Data d, final Type t, final boolean c) { super(p.length, t); pres = p; data = d; complete = c; } @Override public Data data() { return data; } @Override public Item ebv(final QueryContext ctx, final InputInfo ii) { return itemAt(0); } @Override public boolean iterable() { return true; } @Override public boolean sameAs(final Expr cmp) { if(!(cmp instanceof DBNodeSeq)) return false; final DBNodeSeq seq = (DBNodeSeq) cmp; return pres == seq.pres && size == seq.size; } @Override public DBNode itemAt(final long pos) { return new DBNode(data, pres[(int) pos]); } @Override public Value reverse() { final int s = pres.length; final int[] tmp = new int[s]; for(int l = 0, r = s - 1; l < s; l++, r--) tmp[l] = pres[r]; return get(tmp, data, type, false); } // STATIC METHODS ===================================================================== /** * Creates a node sequence with the given data reference and pre values. * @param v pre values * @param d data reference * @param docs indicates if all values reference document nodes * @param c indicates if values include all document nodes of a database * @return resulting item or sequence */ public static Value get(final IntList v, final Data d, final boolean docs, final boolean c) { return get(v.toArray(), d, docs ? NodeType.DOC : NodeType.NOD, c); } /** * Creates a node sequence with the given data reference and pre values. * @param v pre values * @param d data reference * @param t node type * @param c indicates if values include all document nodes of a database * @return resulting item or sequence */ public static Value get(final int[] v, final Data d, final Type t, final boolean c) { return v.length == 0 ? Empty.SEQ : v.length == 1 ? new DBNode(d, v[0]) : new DBNodeSeq(v, d, t, c); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/seq/DblSeq.java000066400000000000000000000044421222453003200262710ustar00rootroot00000000000000package org.basex.query.value.seq; import java.util.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; /** * Sequence of items of type {@link Int xs:double}, containing at least two of them. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DblSeq extends NativeSeq { /** Values. */ private final double[] values; /** * Constructor. * @param vals bytes */ private DblSeq(final double[] vals) { super(vals.length, AtomType.DBL); values = vals; } @Override public Dbl itemAt(final long pos) { return Dbl.get(values[(int) pos]); } @Override public boolean sameAs(final Expr cmp) { return cmp instanceof DblSeq && Arrays.equals(values, ((DblSeq) cmp).values); } @Override public double[] toJava() { return values; } @Override public Value reverse() { final int s = values.length; final double[] tmp = new double[s]; for(int l = 0, r = s - 1; l < s; l++, r--) tmp[l] = values[r]; return get(tmp); } // STATIC METHODS ===================================================================== /** * Creates a sequence with the specified items. * @param items items * @return value */ public static Value get(final double[] items) { return items.length == 0 ? Empty.SEQ : items.length == 1 ? Dbl.get(items[0]) : new DblSeq(items); } /** * Creates a sequence with the items in the specified expressions. * @param vals values * @param size size of resulting sequence * @return value * @throws QueryException query exception */ public static Value get(final Value[] vals, final int size) throws QueryException { final double[] tmp = new double[size]; int t = 0; for(final Value val : vals) { // speed up construction, depending on input final int vs = (int) val.size(); if(val instanceof Item) { tmp[t++] = ((Item) val).dbl(null); } else if(val instanceof DblSeq) { final DblSeq sq = (DblSeq) val; System.arraycopy(sq.values, 0, tmp, t, vs); t += vs; } else { for(int v = 0; v < vs; v++) tmp[t++] = val.itemAt(v).dbl(null); } } return get(tmp); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/seq/DecSeq.java000066400000000000000000000045271222453003200262670ustar00rootroot00000000000000package org.basex.query.value.seq; import java.math.*; import java.util.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; /** * Sequence of items of type {@link Int xs:decimal}, containing at least two of them. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DecSeq extends NativeSeq { /** Values. */ private final BigDecimal[] values; /** * Constructor. * @param vals bytes */ private DecSeq(final BigDecimal[] vals) { super(vals.length, AtomType.DEC); values = vals; } @Override public Dec itemAt(final long pos) { return Dec.get(values[(int) pos]); } @Override public boolean sameAs(final Expr cmp) { return cmp instanceof DecSeq && Arrays.equals(values, ((DecSeq) cmp).values); } @Override public BigDecimal[] toJava() { return values; } @Override public Value reverse() { final int s = values.length; final BigDecimal[] tmp = new BigDecimal[s]; for(int l = 0, r = s - 1; l < s; l++, r--) tmp[l] = values[r]; return get(tmp); } // STATIC METHODS ===================================================================== /** * Creates a sequence with the specified items. * @param items items * @return value */ public static Value get(final BigDecimal[] items) { return items.length == 0 ? Empty.SEQ : items.length == 1 ? Dec.get(items[0]) : new DecSeq(items); } /** * Creates a sequence with the items in the specified expressions. * @param vals values * @param size size of resulting sequence * @return value * @throws QueryException query exception */ public static Value get(final Value[] vals, final int size) throws QueryException { final BigDecimal[] tmp = new BigDecimal[size]; int t = 0; for(final Value val : vals) { // speed up construction, depending on input final int vs = (int) val.size(); if(val instanceof Item) { tmp[t++] = ((Item) val).dec(null); } else if(val instanceof DecSeq) { final DecSeq sq = (DecSeq) val; System.arraycopy(sq.values, 0, tmp, t, vs); t += vs; } else { for(int v = 0; v < vs; v++) tmp[t++] = val.itemAt(v).dec(null); } } return get(tmp); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/seq/Empty.java000066400000000000000000000045141222453003200262150ustar00rootroot00000000000000package org.basex.query.value.seq; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Empty sequence. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Empty extends Value { /** Single instance. */ public static final Empty SEQ = new Empty(); /** Empty iterator. */ public static final ValueIter ITER = new ValueIter() { @Override public Item next() { return null; } @Override public Item get(final long i) { return null; } @Override public Value value() { return SEQ; } @Override public long size() { return 0; } @Override public boolean reset() { return true; } }; /** * Private constructor. */ private Empty() { super(AtomType.ITEM); } @Override public boolean isEmpty() { return true; } @Override public boolean isVacuous() { return true; } @Override public long size() { return 0; } @Override public Object toJava() { return new Object[0]; } @Override public ValueIter iter() { return ITER; } @Override public Item item(final QueryContext ctx, final InputInfo ii) { return null; } @Override public Item ebv(final QueryContext ctx, final InputInfo ii) { return Bln.FALSE; } @Override public Item test(final QueryContext ctx, final InputInfo ii) { return null; } @Override public SeqType type() { return SeqType.EMP; } @Override public boolean iterable() { return true; } @Override public void plan(final FElem plan) { addPlan(plan, planElem(SIZE, 0)); } @Override public int hash(final InputInfo ii) { return 0; } @Override public String description() { return EMPTY_SEQUENCE + "()"; } @Override public String toString() { return "()"; } @Override public int writeTo(final Item[] arr, final int start) { return 0; } @Override public Item itemAt(final long pos) { throw Util.notexpected(); } @Override public boolean homogeneous() { return true; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/seq/FltSeq.java000066400000000000000000000044271222453003200263200ustar00rootroot00000000000000package org.basex.query.value.seq; import java.util.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; /** * Sequence of items of type {@link Int xs:float}, containing at least two of them. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FltSeq extends NativeSeq { /** Values. */ private final float[] values; /** * Constructor. * @param vals bytes */ private FltSeq(final float[] vals) { super(vals.length, AtomType.FLT); values = vals; } @Override public Flt itemAt(final long pos) { return Flt.get(values[(int) pos]); } @Override public boolean sameAs(final Expr cmp) { return cmp instanceof FltSeq && Arrays.equals(values, ((FltSeq) cmp).values); } @Override public float[] toJava() { return values; } @Override public Value reverse() { final int s = values.length; final float[] tmp = new float[s]; for(int l = 0, r = s - 1; l < s; l++, r--) tmp[l] = values[r]; return get(tmp); } // STATIC METHODS ===================================================================== /** * Creates a sequence with the specified items. * @param items items * @return value */ public static Value get(final float[] items) { return items.length == 0 ? Empty.SEQ : items.length == 1 ? Flt.get(items[0]) : new FltSeq(items); } /** * Creates a sequence with the items in the specified expressions. * @param vals values * @param size size of resulting sequence * @return value * @throws QueryException query exception */ public static Value get(final Value[] vals, final int size) throws QueryException { final float[] tmp = new float[size]; int t = 0; for(final Value val : vals) { // speed up construction, depending on input final int vs = (int) val.size(); if(val instanceof Item) { tmp[t++] = ((Item) val).flt(null); } else if(val instanceof FltSeq) { final FltSeq sq = (FltSeq) val; System.arraycopy(sq.values, 0, tmp, t, vs); t += vs; } else { for(int v = 0; v < vs; v++) tmp[t++] = val.itemAt(v).flt(null); } } return get(tmp); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/seq/IntSeq.java000066400000000000000000000060151222453003200263200ustar00rootroot00000000000000package org.basex.query.value.seq; import java.util.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; /** * Sequence of items of type {@link Int xs:integer}, containing at least two of them. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class IntSeq extends NativeSeq { /** Values. */ private final long[] values; /** * Constructor. * @param vals values * @param t type */ private IntSeq(final long[] vals, final Type t) { super(vals.length, t); values = vals; } @Override public Int itemAt(final long pos) { return Int.get(values[(int) pos], type); } @Override public boolean sameAs(final Expr cmp) { if(!(cmp instanceof IntSeq)) return false; final IntSeq is = (IntSeq) cmp; return type == is.type && Arrays.equals(values, is.values); } @Override public Object toJava() throws QueryException { switch((AtomType) type) { case BYT: final byte[] t1 = new byte[(int) size]; for(int s = 0; s < size; s++) t1[s] = (byte) values[s]; return t1; case SHR: case UBY: final short[] t2 = new short[(int) size]; for(int s = 0; s < size; s++) t2[s] = (short) values[s]; return t2; case INT: case USH: final short[] t3 = new short[(int) size]; for(int s = 0; s < size; s++) t3[s] = (short) values[s]; return t3; default: return values; } } @Override public Value reverse() { final int s = values.length; final long[] tmp = new long[s]; for(int l = 0, r = s - 1; l < s; l++, r--) tmp[l] = values[r]; return get(tmp, type); } // STATIC METHODS ===================================================================== /** * Creates a sequence with the specified items. * @param items items * @param type type * @return value */ public static Value get(final long[] items, final Type type) { return items.length == 0 ? Empty.SEQ : items.length == 1 ? Int.get(items[0], type) : new IntSeq(items, type); } /** * Creates a sequence with the items in the specified expressions. * @param vals values * @param size size of resulting sequence * @param type data type * @return value * @throws QueryException query exception */ public static Value get(final Value[] vals, final int size, final Type type) throws QueryException { final long[] tmp = new long[size]; int t = 0; for(final Value val : vals) { // speed up construction, depending on input final int vs = (int) val.size(); if(val instanceof Item) { tmp[t++] = ((Item) val).itr(null); } else if(val instanceof IntSeq) { final IntSeq sq = (IntSeq) val; System.arraycopy(sq.values, 0, tmp, t, vs); t += vs; } else { for(int v = 0; v < vs; v++) tmp[t++] = val.itemAt(v).itr(null); } } return get(tmp, type); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/seq/ItemSeq.java000066400000000000000000000044571222453003200264740ustar00rootroot00000000000000package org.basex.query.value.seq; import static org.basex.query.util.Err.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.value.type.SeqType.Occ; import org.basex.util.*; /** * Sequence, containing at least two items. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ItemSeq extends Seq { /** Item array. */ private final Item[] item; /** Item Types. */ private Type ret; /** * Constructor. * @param it items * @param s size */ private ItemSeq(final Item[] it, final int s) { super(s); item = it; } /** * Constructor. * @param it items * @param s size * @param t sequence type */ ItemSeq(final Item[] it, final int s, final Type t) { this(it, s); ret = t; } @Override public Item ebv(final QueryContext ctx, final InputInfo ii) throws QueryException { if(item[0] instanceof ANode) return item[0]; throw CONDTYPE.thrw(ii, this); } @Override public SeqType type() { if(ret == null) { Type t = item[0].type; for(int s = 1; s < size; s++) { if(t != item[s].type) { t = AtomType.ITEM; break; } } ret = t; type = t; } return SeqType.get(ret, Occ.ONE_MORE); } @Override public boolean iterable() { return false; } @Override public boolean sameAs(final Expr cmp) { if(!(cmp instanceof ItemSeq)) return false; final ItemSeq is = (ItemSeq) cmp; return item == is.item && size == is.size; } @Override public int writeTo(final Item[] arr, final int start) { System.arraycopy(item, 0, arr, start, (int) size); return (int) size; } @Override public Item itemAt(final long pos) { return item[(int) pos]; } @Override public boolean homogeneous() { return ret != null && ret != AtomType.ITEM; } @Override public Value reverse() { final int s = item.length; final Item[] tmp = new Item[s]; for(int l = 0, r = s - 1; l < s; l++, r--) tmp[l] = item[r]; return get(tmp, s, type); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/seq/NativeSeq.java000066400000000000000000000021561222453003200270160ustar00rootroot00000000000000package org.basex.query.value.seq; import static org.basex.query.util.Err.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.query.value.type.SeqType.*; import org.basex.util.*; /** * Sequence of items, which are stored in their primitive/native representation. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class NativeSeq extends Seq { /** * Constructor. * @param s number of items * @param t item type */ protected NativeSeq(final int s, final Type t) { super(s, t); } @Override public Item ebv(final QueryContext ctx, final InputInfo ii) throws QueryException { throw CONDTYPE.thrw(ii, this); } @Override public final int writeTo(final Item[] arr, final int start) { final int w = Math.min((int) size, arr.length - start); for(int i = 0; i < w; i++) arr[start + i] = itemAt(i); return w; } @Override public final boolean homogeneous() { return true; } @Override public final SeqType type() { return SeqType.get(type, Occ.ONE_MORE); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/seq/RangeSeq.java000066400000000000000000000054761222453003200266340ustar00rootroot00000000000000package org.basex.query.value.seq; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.func.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Range sequence, containing at least two integers. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class RangeSeq extends Seq { /** Start value. */ public final long start; /** Ascending/descending. */ public final boolean asc; /** * Constructor. * @param s start value * @param sz size * @param a ascending */ private RangeSeq(final long s, final long sz, final boolean a) { super(sz, AtomType.ITR); start = s; asc = a; } /** * Returns a value representation of the specified items. * @param min minimum value * @param sz size * @param asc ascending * @return resulting item or sequence */ public static Value get(final long min, final long sz, final boolean asc) { return sz < 1 ? Empty.SEQ : sz == 1 ? Int.get(min) : new RangeSeq(min, sz, asc); } @Override public Object toJava() { final long[] obj = new long[(int) size]; for(int s = 0; s < size; ++s) obj[s] = start + (asc ? s : -s); return obj; } @Override public Item ebv(final QueryContext ctx, final InputInfo ii) throws QueryException { throw CONDTYPE.thrw(ii, this); } @Override public SeqType type() { return SeqType.ITR_OM; } @Override public boolean sameAs(final Expr cmp) { if(!(cmp instanceof RangeSeq)) return false; final RangeSeq is = (RangeSeq) cmp; return start == is.start && size == is.size && asc == is.asc; } @Override public int writeTo(final Item[] arr, final int pos) { for(int i = 0; i < size; i++) arr[pos + i] = itemAt(i); return (int) size; } @Override public Item itemAt(final long pos) { return Int.get(start + (asc ? pos : -pos)); } @Override public Value reverse() { final long s = size(); return asc ? get(start + s - 1, s, false) : get(start - s + 1, s, true); } @Override public boolean homogeneous() { return true; } @Override public void plan(final FElem plan) { final long s = start; final long e = asc ? start + size - 1 : start - size + 1; addPlan(plan, planElem(FROM, s, TO, e)); } @Override public String toString() { final long s = asc ? start : start - size + 1; final long e = asc ? start + size - 1 : start; final String str = PAR1 + s + ' ' + TO + ' ' + e + PAR2; return asc ? str : Function.REVERSE.args(str); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/seq/Seq.java000066400000000000000000000071451222453003200256520ustar00rootroot00000000000000package org.basex.query.value.seq; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Sequence, containing at least two items. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class Seq extends Value { /** Length. */ final long size; /** * Constructor. * @param s size */ Seq(final long s) { this(s, AtomType.ITEM); } /** * Constructor, specifying a type. * @param s size * @param t type */ Seq(final long s, final Type t) { super(t); size = s; } /** * Returns a value representation of the specified items. * @param v value * @param s size * @return resulting item or sequence */ public static Value get(final Item[] v, final int s) { return get(v, s, null); } /** * Returns a value representation of the specified items. * @param v value * @param s size * @param t sequence type * @return resulting item or sequence */ public static Value get(final Item[] v, final int s, final Type t) { return s == 0 ? Empty.SEQ : s == 1 ? v[0] : new ItemSeq(v, s, t); } @Override public Object toJava() throws QueryException { final Object[] obj = new Object[(int) size]; for(int s = 0; s < size; s++) obj[s] = itemAt(s).toJava(); return obj; } @Override public final long size() { return size; } @Override public final Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { throw SEQCAST.thrw(ii, this); } @Override public final Item test(final QueryContext ctx, final InputInfo ii) throws QueryException { return ebv(ctx, ii); } @Override public final ValueIter iter() { return new ValueIter() { int c; @Override public Item get(final long i) { return itemAt(i); } @Override public Item next() { return c < size ? itemAt(c++) : null; } @Override public boolean reset() { c = 0; return true; } @Override public long size() { return size; } @Override public Value value() { return Seq.this; } }; } @Override public final int hash(final InputInfo ii) throws QueryException { // final hash function because equivalent sequences *must* produce the // same hash value, otherwise they get lost in hash maps. // example: hash(RangeSeq(1 to 3)) == hash(ItrSeq(1, 2, 3)) // == hash(ItemSeq(Itr(1), Itr(2), Itr(3))) int h = 1; for(long v = Math.min(size, 5); --v >= 0;) h = 31 * h + itemAt(v).hash(ii); return h; } /** * Returns a sequence in reverse order. * @return sequence */ public abstract Value reverse(); @Override public void plan(final FElem plan) { final FElem el = planElem(SIZE, size); addPlan(plan, el); for(int v = 0; v != Math.min(size, 5); ++v) itemAt(v).plan(el); } @Override public String toString() { final StringBuilder sb = new StringBuilder(PAR1); for(int i = 0; i < size; ++i) { sb.append(i != 0 ? SEP : "").append(itemAt(i)); if(sb.length() <= 32 || i + 1 == size) continue; // output is chopped to prevent too long error strings sb.append(SEP + DOTS); break; } return sb.append(PAR2).toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/seq/StrSeq.java000066400000000000000000000053711222453003200263420ustar00rootroot00000000000000package org.basex.query.value.seq; import java.util.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.list.*; /** * Sequence of items of type {@link Str xs:string}, containing at least two of them. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class StrSeq extends NativeSeq { /** Values. */ private final byte[][] values; /** * Constructor. * @param vals values */ private StrSeq(final byte[][] vals) { super(vals.length, AtomType.STR); values = vals; } @Override public Str itemAt(final long pos) { return Str.get(values[(int) pos]); } @Override public boolean sameAs(final Expr cmp) { return cmp instanceof StrSeq && Arrays.equals(values, ((StrSeq) cmp).values); } @Override public String[] toJava() { final String[] tmp = new String[values.length]; for(int v = 0; v < values.length; v++) tmp[v] = Token.string(values[v]); return tmp; } @Override public Value reverse() { final int s = values.length; final byte[][] tmp = new byte[s][]; for(int l = 0, r = s - 1; l < s; l++, r--) tmp[l] = values[r]; return get(tmp); } // STATIC METHODS ===================================================================== /** * Creates a sequence with the specified items. * @param items items * @return value */ public static Value get(final TokenList items) { return items.isEmpty() ? Empty.SEQ : items.size() == 1 ? Str.get(items.get(0)) : new StrSeq(items.toArray()); } /** * Creates a sequence with the specified items. * @param items items * @return value */ public static Value get(final byte[][] items) { return items.length == 0 ? Empty.SEQ : items.length == 1 ? Str.get(items[0]) : new StrSeq(items); } /** * Creates a sequence with the items in the specified expressions. * @param vals values * @param size size of resulting sequence * @return value * @throws QueryException query exception */ public static Value get(final Value[] vals, final int size) throws QueryException { final byte[][] tmp = new byte[size][]; int t = 0; for(final Value val : vals) { // speed up construction, depending on input final int vs = (int) val.size(); if(val instanceof Item) { tmp[t++] = ((Item) val).string(null); } else if(val instanceof StrSeq) { final StrSeq sq = (StrSeq) val; System.arraycopy(sq.values, 0, tmp, t, vs); t += vs; } else { for(int v = 0; v < vs; v++) tmp[t++] = val.itemAt(v).string(null); } } return get(tmp); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/seq/SubSeq.java000066400000000000000000000045141222453003200263210ustar00rootroot00000000000000package org.basex.query.value.seq; import static org.basex.query.util.Err.*; import org.basex.query.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * A sequence that defines a sub-range of another sequence. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class SubSeq extends Seq { /** Underlying sequence. */ private final Seq sub; /** Starting index in {@link #sub}. */ private final long start; /** * Factory method for subsequences. * @param val underlying value * @param from starting index * @param len length of the subsequence * @return the resulting value */ public static Value get(final Value val, final long from, final long len) { final long vLen = val.size(), n = Math.min(vLen - from, len); if(n == vLen) return val; if(n <= 0) return Empty.SEQ; if(n == 1) return val.itemAt(from); if(val instanceof SubSeq) { final SubSeq sSeq = (SubSeq) val; return new SubSeq(sSeq.sub, sSeq.start + from, n); } // cast is safe because n >= 2 return new SubSeq((Seq) val, from, n); } /** * Constructor. * @param seq underlying sequence * @param from starting index * @param len length of the subsequence */ private SubSeq(final Seq seq, final long from, final long len) { super(len, seq.type); sub = seq; start = from; } @Override public Value reverse() { final int n = (int) size; final Item[] items = new Item[n]; for(int i = 0; i < n; i++) items[n - 1 - i] = sub.itemAt(start + i); return Seq.get(items, n); } @Override public int writeTo(final Item[] arr, final int st) { final int n = (int) Math.min(arr.length - st, size); for(int i = 0; i < n; i++) arr[st + i] = sub.itemAt(start + i); return n; } @Override public Item itemAt(final long pos) { return sub.itemAt(start + pos); } @Override public boolean homogeneous() { return sub.homogeneous(); } @Override public Item ebv(final QueryContext ctx, final InputInfo ii) throws QueryException { final Item fst = itemAt(0); if(fst instanceof ANode) return fst; throw CONDTYPE.thrw(ii, this); } @Override public SeqType type() { return sub.type(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/type/000077500000000000000000000000001222453003200244415ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/value/type/AtomType.java000066400000000000000000000761601222453003200270600ustar00rootroot00000000000000package org.basex.query.value.type; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import static org.basex.util.Token.*; import java.math.*; import java.util.*; import java.util.regex.*; import javax.xml.namespace.*; import org.basex.query.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * XQuery data types. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public enum AtomType implements Type { /** Item type. */ ITEM("item", null, EMPTY, false, false, false, Type.ID.ITEM), /** Untyped type. */ UTY("untyped", null, XSURI, false, false, false, Type.ID.UTY), /** Any type. */ ATY("anyType", null, XSURI, false, false, false, Type.ID.ATY), /** Any simple type. */ AST("anySimpleType", null, XSURI, false, false, false, Type.ID.AST), /** Any atomic type. */ AAT("anyAtomicType", ITEM, XSURI, false, false, false, Type.ID.AAT) { @Override public Atm cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return new Atm(it.string(ii)); } @Override public Atm cast(final Object o, final QueryContext ctx, final InputInfo ii) { return new Atm(o.toString()); } }, /** Untyped Atomic type. */ ATM("untypedAtomic", AAT, XSURI, false, true, false, Type.ID.ATM) { @Override public Atm cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return new Atm(it.string(ii)); } @Override public Atm cast(final Object o, final QueryContext ctx, final InputInfo ii) { return new Atm(o.toString()); } }, /** String type. */ STR("string", AAT, XSURI, false, false, true, Type.ID.STR) { @Override public Str cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return Str.get(it.string(ii)); } @Override public Str cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return Str.get(o, ctx, ii); } }, /** Normalized String type. */ NST("normalizedString", STR, XSURI, false, false, true, Type.ID.NST) { @Override public Str cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { final byte[] str = it.string(ii); for(int s = 0; s < str.length; s++) { final byte b = str[s]; if(b == '\t' || b == '\r' || b == '\n') str[s] = ' '; } return new Str(str, this); } @Override public Str cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast(Str.get(o, ctx, ii), null, ii); } }, /** Token type. */ TOK("token", NST, XSURI, false, false, true, Type.ID.TOK) { @Override public Str cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return new Str(norm(it.string(ii)), this); } @Override public Str cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast(Str.get(o, ctx, ii), null, ii); } }, /** Language type. */ LAN("language", TOK, XSURI, false, false, true, Type.ID.LAN) { @Override public Str cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { final byte[] v = norm(it.string(ii)); if(!LANGPATTERN.matcher(Token.string(v)).matches()) invValue(it, ii); return new Str(v, this); } @Override public Str cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast(Str.get(o, ctx, ii), null, ii); } }, /** NMTOKEN type. */ NMT("NMTOKEN", TOK, XSURI, false, false, true, Type.ID.NMT) { @Override public Str cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { final byte[] v = norm(it.string(ii)); if(!XMLToken.isNMToken(v)) invValue(it, ii); return new Str(v, this); } @Override public Str cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast(Str.get(o, ctx, ii), null, ii); } }, /** Name type. */ NAM("Name", TOK, XSURI, false, false, true, Type.ID.NAM) { @Override public Str cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { final byte[] v = norm(it.string(ii)); if(!XMLToken.isName(v)) invValue(it, ii); return new Str(v, this); } @Override public Str cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast(Str.get(o, ctx, ii), null, ii); } }, /** NCName type. */ NCN("NCName", NAM, XSURI, false, false, true, Type.ID.NCN) { @Override public Str cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return new Str(checkName(it, ii), this); } @Override public Str cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast(Str.get(o, ctx, ii), null, ii); } }, /** ID type. */ ID("ID", NCN, XSURI, false, false, true, Type.ID.ID) { @Override public Str cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return new Str(checkName(it, ii), this); } @Override public Str cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast(Str.get(o, ctx, ii), null, ii); } }, /** IDREF type. */ IDR("IDREF", NCN, XSURI, false, false, true, Type.ID.IDR) { @Override public Str cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return new Str(checkName(it, ii), this); } @Override public Str cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast(Str.get(o, ctx, ii), null, ii); } }, /** Entity type. */ ENT("ENTITY", NCN, XSURI, false, false, true, Type.ID.ENT) { @Override public Str cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return new Str(checkName(it, ii), this); } @Override public Str cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast(Str.get(o, ctx, ii), null, ii); } }, /** Float type. */ FLT("float", AAT, XSURI, true, false, false, Type.ID.FLT) { @Override public Flt cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return Flt.get(checkNum(it, ii).flt(ii)); } @Override public Flt cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast(Str.get(o, ctx, ii), null, ii); } }, /** Double type. */ DBL("double", AAT, XSURI, true, false, false, Type.ID.DBL) { @Override public Dbl cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return Dbl.get(checkNum(it, ii).dbl(ii)); } @Override public Dbl cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast(Str.get(o, ctx, ii), null, ii); } }, /** Decimal type. */ DEC("decimal", AAT, XSURI, true, false, false, Type.ID.DEC) { @Override public Dec cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return Dec.get(checkNum(it, ii).dec(ii)); } @Override public Dec cast(final Object o, final QueryContext ctx, final InputInfo ii) { return Dec.get(new BigDecimal(o.toString())); } }, /** Precision decimal type. */ PDC("precisionDecimal", null, XSURI, false, false, false, Type.ID.PDC), /** Integer type. */ ITR("integer", DEC, XSURI, true, false, false, Type.ID.ITR) { @Override public Int cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast((Object) it, ctx, ii); } @Override public Int cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return Int.get(checkLong(o, 0, 0, ii)); } }, /** Non-positive integer type. */ NPI("nonPositiveInteger", ITR, XSURI, true, false, false, Type.ID.NPI) { @Override public Int cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast((Object) it, ctx, ii); } @Override public Int cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return new Int(checkLong(o, Long.MIN_VALUE, 0, ii), this); } }, /** Negative integer type. */ NIN("negativeInteger", NPI, XSURI, true, false, false, Type.ID.NIN) { @Override public Int cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast((Object) it, ctx, ii); } @Override public Int cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return new Int(checkLong(o, Long.MIN_VALUE, -1, ii), this); } }, /** Long type. */ LNG("long", ITR, XSURI, true, false, false, Type.ID.LNG) { @Override public Int cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast((Object) it, ctx, ii); } @Override public Int cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return new Int(checkLong(o, 0, 0, ii), this); } }, /** Int type. */ INT("int", LNG, XSURI, true, false, false, Type.ID.INT) { @Override public Int cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast((Object) it, ctx, ii); } @Override public Int cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return new Int(checkLong(o, -0x80000000, 0x7FFFFFFF, ii), this); } }, /** Short type. */ SHR("short", INT, XSURI, true, false, false, Type.ID.SHR) { @Override public Int cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast((Object) it, ctx, ii); } @Override public Int cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return new Int(checkLong(o, -0x8000, 0x7FFF, ii), this); } }, /** Byte type. */ BYT("byte", SHR, XSURI, true, false, false, Type.ID.BYT) { @Override public Int cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast((Object) it, ctx, ii); } @Override public Int cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return new Int(checkLong(o, -0x80, 0x7F, ii), this); } }, /** Non-negative integer type. */ NNI("nonNegativeInteger", ITR, XSURI, true, false, false, Type.ID.NNI) { @Override public Int cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast((Object) it, ctx, ii); } @Override public Int cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return new Int(checkLong(o, 0, Long.MAX_VALUE, ii), this); } }, /** Unsigned long type. */ ULN("unsignedLong", NNI, XSURI, true, false, false, Type.ID.ULN) { @Override public Dec cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast((Object) it, ctx, ii); } @Override public Dec cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { final Item it = o instanceof Item ? (Item) o : Str.get(o.toString()); final BigDecimal v = checkNum(it, ii).dec(ii); final BigDecimal i = v.setScale(0, BigDecimal.ROUND_DOWN); if(v.signum() < 0 || v.compareTo(Dec.MAXULNG) > 0 || it.type.isStringOrUntyped() && !v.equals(i)) FUNCAST.thrw(ii, this, it); return new Dec(i, this); } }, /** Short type. */ UIN("unsignedInt", ULN, XSURI, true, false, false, Type.ID.UIN) { @Override public Int cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast((Object) it, ctx, ii); } @Override public Int cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return new Int(checkLong(o, 0, 0xFFFFFFFFL, ii), this); } }, /** Unsigned Short type. */ USH("unsignedShort", UIN, XSURI, true, false, false, Type.ID.USH) { @Override public Int cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast((Object) it, ctx, ii); } @Override public Int cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return new Int(checkLong(o, 0, 0xFFFF, ii), this); } }, /** Unsigned byte type. */ UBY("unsignedByte", USH, XSURI, true, false, false, Type.ID.UBY) { @Override public Int cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast((Object) it, ctx, ii); } @Override public Int cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return new Int(checkLong(o, 0, 0xFF, ii), this); } }, /** Positive integer type. */ PIN("positiveInteger", NNI, XSURI, true, false, false, Type.ID.PIN) { @Override public Int cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast((Object) it, ctx, ii); } @Override public Int cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return new Int(checkLong(o, 1, Long.MAX_VALUE, ii), this); } }, /** Duration type. */ DUR("duration", AAT, XSURI, false, false, false, Type.ID.DUR) { @Override public Item cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return it instanceof Dur ? new Dur((Dur) it) : str(it) ? new Dur(it.string(ii), ii) : invCast(it, ii); } @Override public Item cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast(Str.get(o, ctx, ii), null, ii); } }, /** Year month duration type. */ YMD("yearMonthDuration", DUR, XSURI, false, false, false, Type.ID.YMD) { @Override public Item cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return it instanceof Dur ? new YMDur((Dur) it) : str(it) ? new YMDur(it.string(ii), ii) : invCast(it, ii); } @Override public Item cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast(Str.get(o, ctx, ii), null, ii); } }, /** Day time duration type. */ DTD("dayTimeDuration", DUR, XSURI, false, false, false, Type.ID.DTD) { @Override public Item cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return it instanceof Dur ? new DTDur((Dur) it) : str(it) ? new DTDur(it.string(ii), ii) : invCast(it, ii); } @Override public Item cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast(Str.get(o, ctx, ii), null, ii); } }, /** DateTime type. */ DTM("dateTime", AAT, XSURI, false, false, false, Type.ID.DTM) { @Override public Item cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return it.type == DAT ? new Dtm((Dat) it) : str(it) ? new Dtm(it.string(ii), ii) : invCast(it, ii); } @Override public Item cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast(Str.get(o, ctx, ii), null, ii); } }, /** DateTimeStamp type. */ DTS("dateTimeStamp", null, XSURI, false, false, false, Type.ID.DTS), /** Date type. */ DAT("date", AAT, XSURI, false, false, false, Type.ID.DAT) { @Override public Item cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return it.type == DTM ? new Dat((Dtm) it) : str(it) ? new Dat(it.string(ii), ii) : invCast(it, ii); } @Override public Item cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast(Str.get(o, ctx, ii), null, ii); } }, /** Time type. */ TIM("time", AAT, XSURI, false, false, false, Type.ID.TIM) { @Override public Item cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return it.type == DTM ? new Tim((Dtm) it) : str(it) ? new Tim(it.string(ii), ii) : invCast(it, ii); } @Override public Item cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast(Str.get(o, ctx, ii), null, ii); } }, /** Year month type. */ YMO("gYearMonth", AAT, XSURI, false, false, false, Type.ID.YMO) { @Override public Item cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return it.type == DTM || it.type == DAT ? new GDt((ADate) it, this) : str(it) ? new GDt(it.string(ii), this, ii) : invCast(it, ii); } @Override public Item cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast(Str.get(o, ctx, ii), null, ii); } }, /** Year type. */ YEA("gYear", AAT, XSURI, false, false, false, Type.ID.YEA) { @Override public Item cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return it.type == DTM || it.type == DAT ? new GDt((ADate) it, this) : str(it) ? new GDt(it.string(ii), this, ii) : invCast(it, ii); } @Override public Item cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast(Str.get(o, ctx, ii), null, ii); } }, /** Month day type. */ MDA("gMonthDay", AAT, XSURI, false, false, false, Type.ID.MDA) { @Override public Item cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return it.type == DTM || it.type == DAT ? new GDt((ADate) it, this) : str(it) ? new GDt(it.string(ii), this, ii) : invCast(it, ii); } @Override public Item cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast(Str.get(o, ctx, ii), null, ii); } }, /** Day type. */ DAY("gDay", AAT, XSURI, false, false, false, Type.ID.DAY) { @Override public Item cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return it.type == DTM || it.type == DAT ? new GDt((ADate) it, this) : str(it) ? new GDt(it.string(ii), this, ii) : invCast(it, ii); } @Override public Item cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast(Str.get(o, ctx, ii), null, ii); } }, /** Month type. */ MON("gMonth", AAT, XSURI, false, false, false, Type.ID.MON) { @Override public Item cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return it.type == DTM || it.type == DAT ? new GDt((ADate) it, this) : str(it) ? new GDt(it.string(ii), this, ii) : invCast(it, ii); } @Override public Item cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast(Str.get(o, ctx, ii), null, ii); } }, /** Boolean type. */ BLN("boolean", AAT, XSURI, false, false, false, Type.ID.BLN) { @Override public Item cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return it instanceof ANum ? Bln.get(it.bool(ii)) : str(it) ? Bln.get(Bln.parse(it.string(ii), ii)) : invCast(it, ii); } @Override public Bln cast(final Object o, final QueryContext ctx, final InputInfo ii) { return o instanceof Boolean ? Bln.get((Boolean) o) : Bln.get(Boolean.parseBoolean(o.toString())); } }, /** Implementation specific: binary type. */ BIN("binary", AAT, BASEXURI, false, false, false, Type.ID.BIN), /** Base64 binary type. */ B64("base64Binary", BIN, XSURI, false, false, false, Type.ID.B64) { @Override public Item cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return it instanceof Bin ? new B64((Bin) it, ii) : str(it) ? new B64(it.string(ii), ii) : invCast(it, ii); } @Override public Item cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return new B64(o instanceof byte[] ? (byte[]) o : Token.token(o.toString()), ii); } }, /** Hex binary type. */ HEX("hexBinary", BIN, XSURI, false, false, false, Type.ID.HEX) { @Override public Item cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return it instanceof Bin ? new Hex((Bin) it, ii) : str(it) ? new Hex(it.string(ii), ii) : invCast(it, ii); } @Override public Item cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return new Hex(o instanceof byte[] ? (byte[]) o : Token.token(o.toString()), ii); } }, /** Any URI type. */ URI("anyURI", AAT, XSURI, false, false, true, Type.ID.URI) { @Override public Uri cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { if(!it.type.isStringOrUntyped()) invCast(it, ii); final Uri u = Uri.uri(it.string(ii)); if(!u.isValid()) FUNCAST.thrw(ii, this, it); return u; } @Override public Item cast(final Object o, final QueryContext ctx, final InputInfo ii) { return Uri.uri(o.toString()); } }, /** QName Type. */ QNM("QName", AAT, XSURI, false, false, false, Type.ID.QNM) { @Override public QNm cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { // xquery 3.0 also allows untyped arguments if(it.type != STR && !(ctx.sc.xquery3() && it.type.isUntyped())) invCast(it, ii); final byte[] nm = trim(it.string(ii)); if(!XMLToken.isQName(nm)) FUNCAST.thrw(ii, this, it); final QNm qn = new QNm(nm, ctx); if(!qn.hasURI() && qn.hasPrefix()) NSDECL.thrw(ii, qn.prefix()); return qn; } @Override public QNm cast(final Object o, final QueryContext ctx, final InputInfo ii) { return o instanceof QName ? new QNm((QName) o) : new QNm(o.toString()); } }, /** NOTATION Type. */ NOT("NOTATION", AAT, XSURI, false, false, false, Type.ID.NOT), /** Java type. */ JAVA("java", ITEM, BASEXURI, true, true, true, Type.ID.JAVA) { @Override public Item cast(final Item it, final QueryContext ctx, final InputInfo ii) { return new Jav(it, ctx); } @Override public Item cast(final Object o, final QueryContext ctx, final InputInfo ii) { return new Jav(o, null); } }; /** Language pattern. */ static final Pattern LANGPATTERN = Pattern.compile("[A-Za-z]{1,8}(-[A-Za-z0-9]{1,8})*"); /** Cached enums (faster). */ public static final AtomType[] VALUES = values(); /** Name. */ public final QNm name; /** Parent type. */ public final AtomType par; /** Type id . */ private final Type.ID id; /** Number flag. */ private final boolean num; /** Untyped flag. */ private final boolean unt; /** String flag. */ private final boolean str; /** Sequence type (lazy). */ private SeqType seq; /** * Constructor. * @param nm string representation * @param pr parent type * @param ur uri * @param n number flag * @param u untyped flag * @param s string flag * @param i type id */ AtomType(final String nm, final AtomType pr, final byte[] ur, final boolean n, final boolean u, final boolean s, final Type.ID i) { name = new QNm(nm, ur); par = pr; num = n; unt = u; str = s; id = i; } @Override public boolean isNumber() { return num; } @Override public boolean isUntyped() { return unt; } @Override public boolean isNumberOrUntyped() { return num || unt; } @Override public boolean isStringOrUntyped() { return str || unt; } @Override public byte[] string() { return name.string(); } @Override public Item cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return it.type != this ? invCast(it, ii) : it; } @Override public Item cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { throw Util.notexpected(o); } @Override public Item castString(final String o, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast(o, ctx, ii); } @Override public SeqType seqType() { // cannot be statically instantiated due to circular dependencies if(seq == null) seq = new SeqType(this); return seq; } @Override public boolean eq(final Type t) { return this == t; } @Override public final boolean instanceOf(final Type t) { return this == t || par != null && par.instanceOf(t); } @Override public Type union(final Type t) { if(this.instanceOf(t)) return t; if(t.instanceOf(this)) return this; if(t instanceof AtomType) { final List arr = new ArrayList(); for(AtomType at = (AtomType) t; (at = at.par) != null;) arr.add(at); for(AtomType p = this; (p = p.par) != null;) if(arr.contains(p)) return p; } return ITEM; } @Override public Type intersect(final Type t) { return this.instanceOf(t) ? this : t.instanceOf(this) ? t : null; } @Override public final boolean isNode() { return false; } @Override public Type.ID id() { return id; } @Override public String toString() { final boolean xs = Token.eq(XSURI, name.uri()); final TokenBuilder tb = new TokenBuilder(); if(xs) tb.add(NSGlobal.prefix(name.uri())).add(':'); tb.add(name.string()); if(!xs) tb.add("()"); return tb.toString(); } /** * Throws an exception if the specified item cannot be converted to a number. * @param it item * @param ii input info * @return item argument * @throws QueryException query exception */ Item checkNum(final Item it, final InputInfo ii) throws QueryException { final Type ip = it.type; return it instanceof ANum || ip.isStringOrUntyped() && ip != URI || ip == BLN ? it : invCast(it, ii); } /** * Checks the validity of the specified object and returns its long value. * @param o value to be checked * @param min minimum value * @param max maximum value * @param ii input info * @return integer value * @throws QueryException query exception */ long checkLong(final Object o, final long min, final long max, final InputInfo ii) throws QueryException { final Item it = o instanceof Item ? (Item) o : Str.get(o.toString()); checkNum(it, ii); final Type ip = it.type; if(ip == DBL || ip == FLT) { final double d = it.dbl(ii); if(Double.isNaN(d) || Double.isInfinite(d)) value(ii, this, it); if(d < Long.MIN_VALUE || d > Long.MAX_VALUE) INTRANGE.thrw(ii, d); if(min != max && (d < min || d > max)) FUNCAST.thrw(ii, this, it); return (long) d; } if(min == max) { final double d = it.dbl(ii); if(d < Long.MIN_VALUE || d > Long.MAX_VALUE) FUNCAST.thrw(ii, this, it); } final long l = it.itr(ii); if(min != max && (l < min || l > max)) FUNCAST.thrw(ii, this, it); return l; } /** * Checks if the specified item is a string. * @param it item * @return item argument */ static boolean str(final Item it) { final Type ip = it.type; return ip.isStringOrUntyped() && ip != URI; } /** * Checks the validity of the specified name. * @param it value to be checked * @param ii input info * @throws QueryException query exception * @return name */ byte[] checkName(final Item it, final InputInfo ii) throws QueryException { final byte[] v = norm(it.string(ii)); if(!XMLToken.isNCName(v)) invValue(it, ii); return v; } /** * Throws a casting exception. * @param it item to be included in the error message * @param ii input info * @return dummy item * @throws QueryException query exception */ Item invCast(final Item it, final InputInfo ii) throws QueryException { throw Err.cast(ii, this, it); } /** * Throws a casting exception. * @param it item to be included in the error message * @param ii input info * @return dummy item * @throws QueryException query exception */ Item invValue(final Item it, final InputInfo ii) throws QueryException { throw FUNCCASTEX.thrw(ii, it.type(), this, it); } /** * Finds and returns the specified data type. * @param type type as string * @param all accept all types (include those without parent type) * @return type or {@code null} */ public static AtomType find(final QNm type, final boolean all) { if(!Token.eq(type.uri(), BASEXURI)) { for(final AtomType t : VALUES) { if(t.name.eq(type) && (all || t.par != null)) return t; } } return null; } @Override public boolean nsSensitive() { return instanceOf(QNM) || instanceOf(NOT); } /** * Gets the type instance for the given ID. * @param id type ID * @return corresponding type if found, {@code null} otherwise */ static Type getType(final Type.ID id) { for(final AtomType t : VALUES) if(t.id == id) return t; return null; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/type/FuncType.java000066400000000000000000000170241222453003200270450ustar00rootroot00000000000000package org.basex.query.value.type; import static org.basex.query.QueryText.*; import static org.basex.util.Token.*; import java.util.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.var.*; import org.basex.util.*; /** * XQuery 3.0 function data types. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public class FuncType implements Type { /** Any function type. */ public static final FuncType ANY_FUN = new FuncType(null, null, null); /** Annotations. */ public final Ann ann; /** Argument types. */ public final SeqType[] args; /** Return type. */ public final SeqType type; /** This function type's sequence type. */ private SeqType seq; /** * Constructor. * @param a annotations * @param arg argument types * @param typ return type */ FuncType(final Ann a, final SeqType[] arg, final SeqType typ) { ann = a != null ? a : new Ann(); args = arg; type = typ; } @Override public final boolean isNode() { return false; } @Override public final boolean isNumber() { return false; } @Override public final boolean isUntyped() { return false; } @Override public final boolean isNumberOrUntyped() { return false; } @Override public final boolean isStringOrUntyped() { return false; } @Override public final SeqType seqType() { if(seq == null) seq = new SeqType(this); return seq; } @Override public byte[] string() { return token(FUNCTION); } @Override public FItem cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { if(!(it instanceof FItem)) throw Err.cast(ii, this, it); final FItem f = (FItem) it; return this == ANY_FUN ? f : f.coerceTo(this, ctx, ii); } @Override public final Item cast(final Object o, final QueryContext ctx, final InputInfo ii) { throw Util.notexpected(o); } @Override public final Item castString(final String s, final QueryContext ctx, final InputInfo ii) { throw Util.notexpected(s); } @Override public boolean eq(final Type t) { if(this == t) return true; if(t.getClass() != FuncType.class) return false; final FuncType ft = (FuncType) t; // check annotations if(ann.size() != ft.ann.size()) return false; for(int i = 0; i < ann.size(); i++) { if(!ann.contains(ft.ann.names[i], ft.ann.values[i])) return false; } if(this == ANY_FUN || ft == ANY_FUN || args.length != ft.args.length) return false; for(int i = 0; i < args.length; i++) if(!args[i].eq(ft.args[i])) return false; return type.eq(ft.type); } @Override public boolean instanceOf(final Type t) { // the only non-function super-type of function is item() if(!(t instanceof FuncType)) return t == AtomType.ITEM; if(t instanceof MapType) return false; final FuncType ft = (FuncType) t; // check annotations for(int i = 0; i < ft.ann.size(); i++) if(!ann.contains(ft.ann.names[i], ft.ann.values[i])) return false; // takes care of FunType.ANY if(this == ft || ft == ANY_FUN) return true; if(this == ANY_FUN || args.length != ft.args.length || !type.instanceOf(ft.type)) return false; for(int a = 0; a < args.length; a++) { if(!ft.args[a].instanceOf(args[a])) return false; } return true; } @Override public Type union(final Type t) { if(!(t instanceof FuncType)) return AtomType.ITEM; final FuncType ft = (FuncType) t; if(this == ANY_FUN || ft == ANY_FUN || args.length != ft.args.length) return ANY_FUN; final SeqType[] arg = new SeqType[args.length]; for(int i = 0; i < arg.length; i++) { arg[i] = args[i].intersect(ft.args[i]); if(arg[i] == null) return ANY_FUN; } return get(ann.intersect(ft.ann), type.union(ft.type), arg); } @Override public Type intersect(final Type t) { // ensure commutativity if(t instanceof MapType) return t.intersect(this); // the easy cases if(this.instanceOf(t)) return this; if(t.instanceOf(this)) return t; if(t instanceof FuncType) { final FuncType ft = (FuncType) t; // ANY_FUN is excluded by the easy cases final SeqType rt = type.intersect(ft.type); if(rt != null && args.length == ft.args.length) { final SeqType[] arg = new SeqType[args.length]; for(int i = 0; i < arg.length; i++) arg[i] = args[i].union(ft.args[i]); final Ann a = ann.union(ft.ann); return a == null ? null : get(a, rt, arg); } } return null; } /** * Getter for function types. * @param a annotations * @param ret return type * @param args argument types * @return function type */ public static FuncType get(final Ann a, final SeqType ret, final SeqType... args) { return args == null || ret == null ? ANY_FUN : new FuncType(a, args, ret); } /** * Getter for function types without annotations. * @param ret return type * @param args argument types * @return function type */ public static FuncType get(final SeqType ret, final SeqType... args) { return get(new Ann(), ret, args); } /** * Finds and returns the specified function type. * @param type type as string * @return type or {@code null} */ public static Type find(final QNm type) { if(type.uri().length == 0) { final byte[] ln = type.local(); if(Token.eq(ln, token(FUNCTION))) return FuncType.ANY_FUN; if(Token.eq(ln, MAP)) return SeqType.ANY_MAP; } return null; } /** * Getter for function types with a given arity. * @param a number of arguments * @return function type */ public static FuncType arity(final int a) { final SeqType[] args = new SeqType[a]; Arrays.fill(args, SeqType.ITEM_ZM); return get(null, SeqType.ITEM_ZM, args); } /** * Getter for a function's type. * @param an annotations * @param args formal parameters * @param ret return type * @return function type */ public static FuncType get(final Ann an, final Var[] args, final SeqType ret) { final SeqType[] at = new SeqType[args.length]; for(int a = 0; a < at.length; a++) at[a] = args[a] == null ? SeqType.ITEM_ZM : args[a].declaredType(); return new FuncType(an, at, ret == null ? SeqType.ITEM_ZM : ret); } /** * Creates variables with types corresponding to this type's arguments. * @param vs array in which to write the variables * @param ctx query context * @param scp variable scope * @param ii input info * @return calls to the variables */ public Expr[] args(final Var[] vs, final QueryContext ctx, final VarScope scp, final InputInfo ii) { final Expr[] refs = new Expr[vs.length]; for(int i = 0; i < vs.length; i++) refs[i] = new VarRef(ii, vs[i] = scp.uniqueVar(ctx, args[i], true)); return refs; } @Override public ID id() { return Type.ID.FUN; } @Override public String toString() { final TokenBuilder tb = new TokenBuilder(ann.toString()).add(FUNCTION).add('('); if(this == ANY_FUN) { tb.add('*').add(')'); } else { tb.addSep(args, ", ").add(") as ").add(type.toString()); } return tb.toString(); } @Override public boolean nsSensitive() { return false; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/type/ListType.java000066400000000000000000000076731222453003200270760ustar00rootroot00000000000000package org.basex.query.value.type; import static org.basex.query.QueryText.*; import static org.basex.util.Token.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.type.SeqType.Occ; import org.basex.util.*; /** * XQuery list types. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public enum ListType implements Type { /** NMTOKENS type. */ NMT("NMTOKENS") { @Override public Value cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return create(it, ctx, ii, AtomType.NMT); } }, /** ENTITIES type. */ ENT("ENTITIES") { @Override public Value cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return create(it, ctx, ii, AtomType.ENT); } }, /** IDREFS type. */ IDR("IDREFS") { @Override public Value cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return create(it, ctx, ii, AtomType.IDR); } }; /** Cached enums (faster). */ public static final ListType[] VALUES = values(); /** Name. */ private final QNm name; /** Sequence type (lazy). */ private SeqType seq; /** * Constructor. * @param nm string representation */ ListType(final String nm) { name = new QNm(nm, XSURI); } /** * Creates a sequence with the resulting list items. * @param it item * @param ctx query context * @param ii input info * @param type result type * @return created value * @throws QueryException query exception */ protected static Value create(final Item it, final QueryContext ctx, final InputInfo ii, final AtomType type) throws QueryException { final byte[][] values = split(norm(it.string(ii)), ' '); final ValueBuilder vb = new ValueBuilder(values.length); for(final byte[] v : values) vb.add(type.cast(Str.get(v), ctx, ii)); return vb.value(); } /** * Finds and returns the specified data type. * @param type type as string * @return type or {@code null} */ public static ListType find(final QNm type) { for(final ListType t : VALUES) if(t.name.eq(type)) return t; return null; } @Override public boolean isNumber() { return false; } @Override public boolean isUntyped() { return false; } @Override public boolean isNumberOrUntyped() { return false; } @Override public boolean isStringOrUntyped() { return false; } @Override public byte[] string() { return name.string(); } @Override public abstract Value cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException; @Override public Value cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast(Str.get(o, ctx, ii), null, ii); } @Override public Value castString(final String o, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast(o, ctx, ii); } @Override public SeqType seqType() { if(seq == null) seq = SeqType.get(this, Occ.ZERO_MORE); return seq; } @Override public boolean eq(final Type t) { return this == t; } @Override public final boolean instanceOf(final Type t) { return this == t; } @Override public Type union(final Type t) { return this == t ? t : AtomType.ITEM; } @Override public Type intersect(final Type t) { return this == t ? this : t.instanceOf(this) ? t : null; } @Override public final boolean isNode() { return false; } @Override public Type.ID id() { return null; } @Override public boolean nsSensitive() { return false; } @Override public String toString() { return new TokenBuilder(NSGlobal.prefix(name.uri())).add(':').add(name.string()). toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/type/MapType.java000066400000000000000000000060161222453003200266660ustar00rootroot00000000000000package org.basex.query.value.type; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.map.*; import org.basex.util.*; /** * Type for maps. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class MapType extends FuncType { /** Key type of the map. */ public final AtomType keyType; /** * Constructor. * @param arg argument type * @param rt return type */ MapType(final AtomType arg, final SeqType rt) { super(new Ann(), new SeqType[]{ arg.seqType() }, rt); keyType = arg; } @Override public byte[] string() { return MAP; } @Override public Map cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { if(it instanceof Map) { final Map m = (Map) it; if(m.hasType(this)) return m; } throw Err.cast(ii, this, it); } @Override public boolean eq(final Type t) { if(this == t) return true; if(t.getClass() != MapType.class) return false; final MapType mt = (MapType) t; return keyType.eq(mt.keyType) && type.eq(mt.type); } @Override public boolean instanceOf(final Type t) { if(!(t instanceof MapType)) return super.instanceOf(t); final MapType mt = (MapType) t; return type.instanceOf(mt.type) && mt.keyType.instanceOf(keyType); } @Override public Type union(final Type t) { if(instanceOf(t)) return t; if(t instanceof MapType) { final MapType mt = (MapType) t; if(mt.instanceOf(this)) return this; final AtomType a = (AtomType) keyType.intersect(mt.keyType); return a != null ? get(a, type.union(mt.type)) : ANY_FUN; } return t instanceof FuncType ? t.union(this) : AtomType.ITEM; } @Override public MapType intersect(final Type t) { // case for item() and compatible FuncType, e.g. function(xs:anyAtomicType) as item()* // also excludes FuncType.ANY_FUN if(instanceOf(t)) return this; if(t instanceof MapType) { final MapType mt = (MapType) t; if(mt.instanceOf(this)) return mt; final SeqType rt = type.intersect(mt.type); return rt == null ? null : get((AtomType) keyType.union(mt.keyType), rt); } else if(t instanceof FuncType) { final FuncType ft = (FuncType) t; if(ft.args.length == 1 && ft.args[0].instanceOf(SeqType.AAT)) { final SeqType rt = type.intersect(ft.type); return rt == null ? null : get((AtomType) keyType.union(ft.args[0].type), rt); } } return null; } /** * Creates a new map type. * @param key key type * @param val value type * @return map type */ public static MapType get(final AtomType key, final SeqType val) { return key == AtomType.AAT && val.eq(SeqType.ITEM_ZM) ? SeqType.ANY_MAP : new MapType(key, val); } @Override public String toString() { return keyType == AtomType.AAT && type.eq(SeqType.ITEM_ZM) ? "map(*)" : "map(" + keyType + ", " + type + ')'; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/type/NodeType.java000066400000000000000000000176271222453003200270500ustar00rootroot00000000000000package org.basex.query.value.type; import static org.basex.query.util.Err.*; import java.io.*; import java.util.regex.*; import org.basex.api.dom.*; import org.basex.build.*; import org.basex.build.xml.*; import org.basex.core.*; import org.basex.io.*; import org.basex.query.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.util.*; import org.basex.util.hash.*; import org.w3c.dom.*; import org.w3c.dom.Text; /** * XQuery node types. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public enum NodeType implements Type { /** Node type. */ NOD("node", AtomType.ITEM, ID.NOD), /** Text type. */ TXT("text", NOD, ID.TXT) { @Override public ANode cast(final Object o, final QueryContext ctx, final InputInfo ii) { if(o instanceof BXText) return ((BXText) o).getNode(); if(o instanceof Text) return new FTxt((Text) o); return new FTxt(o.toString()); } }, /** PI type. */ PI("processing-instruction", NOD, ID.PI) { @Override public ANode cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { if(o instanceof BXPI) return ((BXPI) o).getNode(); if(o instanceof ProcessingInstruction) return new FPI((ProcessingInstruction) o); final Matcher m = Pattern.compile("<\\?(.*?) (.*)\\?>").matcher(o.toString()); if(m.find()) return new FPI(m.group(1), m.group(2)); throw NODEERR.thrw(ii, this, o); } }, /** Element type. */ ELM("element", NOD, ID.ELM) { @Override public ANode cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { if(o instanceof BXElem) return ((BXElem) o).getNode(); if(o instanceof Element) return new FElem((Element) o, null, new TokenMap()); try { final DBNode db = new DBNode(new IOContent(o.toString()), new Prop()); return db.children().next(); } catch(final IOException ex) { NODEERR.thrw(ii, this, ex); } return null; } }, /** Document type. */ DOC("document-node", NOD, ID.DOC) { @Override public ANode cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { if(o instanceof BXDoc) return ((BXDoc) o).getNode(); try { if(o instanceof Document) { final DOMWrapper p = new DOMWrapper((Document) o, "", new Prop()); return new DBNode(MemBuilder.build(p)); } if(o instanceof DocumentFragment) { // document fragment final DocumentFragment df = (DocumentFragment) o; final String bu = df.getBaseURI(); return new FDoc(df, bu != null ? Token.token(bu) : Token.EMPTY); } final String c = o.toString(); if(c.startsWith("<")) return new DBNode(new IOContent(c), new Prop()); return new FDoc().add(new FTxt(c)); } catch(final IOException ex) { throw NODEERR.thrw(ii, this, ex); } } }, /** Document element type. */ DEL("document-node(element())", NOD, ID.DEL) { @Override public Item cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { return DOC.cast(o, ctx, ii); } }, /** Attribute type. */ ATT("attribute", NOD, ID.ATT) { @Override public ANode cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { if(o instanceof BXAttr) return ((BXAttr) o).getNode(); if(o instanceof Attr) return new FAttr((Attr) o); final Matcher m = Pattern.compile(" (.*?)=\"(.*)\"").matcher(o.toString()); if(m.find()) return new FAttr(m.group(1), m.group(2)); throw NODEERR.thrw(ii, this, o); } }, /** Comment type. */ COM("comment", NOD, ID.COM) { @Override public ANode cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { if(o instanceof BXComm) return ((BXComm) o).getNode(); if(o instanceof Comment) return new FComm((Comment) o); final Matcher m = Pattern.compile("").matcher(o.toString()); if(m.find()) return new FComm(m.group(1)); throw NODEERR.thrw(ii, this, o); } }, /** Namespace type. */ NSP("namespace-node", NOD, ID.NSP), /** Schema-element. */ SCE("schema-element", NOD, ID.SCE), /** Schema-attribute. */ SCA("schema-attribute", NOD, ID.SCA); /** Cached enums (faster). */ public static final NodeType[] VALUES = values(); /** String representation. */ private final byte[] string; /** Parent type. */ private final Type par; /** Type id . */ private final ID id; /** Sequence type. */ private SeqType seq; /** * Constructor. * @param nm string representation * @param pr parent type * @param i type id */ NodeType(final String nm, final Type pr, final ID i) { string = Token.token(nm); par = pr; id = i; } @Override public final boolean isNode() { return true; } @Override public boolean isNumber() { return false; } @Override public boolean isUntyped() { return true; } @Override public boolean isNumberOrUntyped() { return true; } @Override public boolean isStringOrUntyped() { return true; } @Override public Item cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException { return it.type != this ? error(it, ii) : it; } @Override public Item cast(final Object o, final QueryContext ctx, final InputInfo ii) throws QueryException { Util.notexpected(o); return null; } @Override public Item castString(final String o, final QueryContext ctx, final InputInfo ii) throws QueryException { return cast(o, ctx, ii); } @Override public SeqType seqType() { // cannot be statically instantiated due to circular dependency if(seq == null) seq = new SeqType(this); return seq; } @Override public boolean eq(final Type t) { return this == t; } @Override public final boolean instanceOf(final Type t) { return this == t || par.instanceOf(t); } @Override public Type union(final Type t) { return !t.isNode() ? AtomType.ITEM : this == t ? this : NOD; } @Override public NodeType intersect(final Type t) { if(!(t instanceof NodeType)) return instanceOf(t) ? this : null; return this == t ? this : this == NOD ? (NodeType) t : t == NOD ? this : null; } @Override public ID id() { return id; } @Override public byte[] string() { return string; } @Override public String toString() { return new TokenBuilder(string).add("()").toString(); } /** * Throws a casting exception. * @param it item to be included in the error message * @param ii input info * @return dummy item * @throws QueryException query exception */ Item error(final Item it, final InputInfo ii) throws QueryException { Err.cast(ii, this, it); return null; } /** * Finds and returns the specified node type. * @param type type as string * @return type or {@code null} */ public static NodeType find(final QNm type) { if(type.uri().length == 0) { final byte[] ln = type.local(); for(final NodeType t : VALUES) { if(Token.eq(ln, t.string)) return t; } } return null; } @Override public boolean nsSensitive() { return false; } /** * Gets the type instance for the given ID. * @param id type ID * @return corresponding type if found, {@code null} otherwise */ static Type getType(final Type.ID id) { for(final NodeType t : VALUES) if(t.id == id) return t; return null; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/type/SeqType.java000066400000000000000000000520531222453003200267030ustar00rootroot00000000000000package org.basex.query.value.type; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import org.basex.data.*; import org.basex.query.*; import org.basex.query.func.*; import org.basex.query.iter.*; import org.basex.query.path.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.map.*; import org.basex.query.value.seq.*; import org.basex.util.*; /** * Stores a sequence type definition. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class SeqType { /** Number of occurrences (cardinality). */ public enum Occ { /** Zero. */ ZERO(0, 0, ""), /** Zero or one. */ ZERO_ONE(0, 1, "?"), /** Exactly one. */ ONE(1, 1, ""), /** One or more. */ ONE_MORE(1, Integer.MAX_VALUE, "+"), /** Zero or more. */ ZERO_MORE(0, Integer.MAX_VALUE, "*"); /** String representation. */ private final String str; /** Minimal number of occurrences. */ public final int min; /** Maximal number of occurrences. */ public final int max; /** * Constructor. * @param mn minimal number of occurrences * @param mx maximal number of occurrences * @param s string representation */ Occ(final int mn, final int mx, final String s) { min = mn; max = mx; str = s; } /** * Checks if the specified occurrence indicator is an instance of the * current occurrence indicator. * @param o occurrence indicator to check * @return result of check */ public boolean instanceOf(final Occ o) { return min >= o.min && max <= o.max; } /** * Computes the intersection between this occurrence indicator and the given one. * If none exists (e.g. between {@link #ZERO} and {@link #ONE}), {@code null} is * returned. * @param other other occurrence indicator * @return intersection or {@code null} */ public Occ intersect(final Occ other) { final int mn = Math.max(min, other.min), mx = Math.min(max, other.max); return mx < mn ? null : mx == 0 ? ZERO : mn == mx ? ONE : mx == 1 ? ZERO_ONE : mn == 0 ? ZERO_MORE : ONE_MORE; } /** * Computes the union between this occurrence indicator and the given one. * @param other other occurrence indicator * @return union */ public Occ union(final Occ other) { final int mn = Math.min(min, other.min), mx = Math.max(max, other.max); return mx == 0 ? ZERO : mn == mx ? ONE : mx == 1 ? ZERO_ONE : mn == 0 ? ZERO_MORE : ONE_MORE; } /** * Checks if the given cardinality is supported by this type. * @param c cardinality * @return result of check */ public boolean check(final long c) { return min <= c && c <= max; } @Override public String toString() { return str; } } /** Zero items. */ public static final SeqType EMP = new SeqType(AtomType.ITEM, Occ.ZERO); /** Single item. */ public static final SeqType ITEM = AtomType.ITEM.seqType(); /** Zero or one item. */ public static final SeqType ITEM_ZO = new SeqType(AtomType.ITEM, Occ.ZERO_ONE); /** Zero or more items. */ public static final SeqType ITEM_ZM = new SeqType(AtomType.ITEM, Occ.ZERO_MORE); /** One or more items. */ public static final SeqType ITEM_OM = new SeqType(AtomType.ITEM, Occ.ONE_MORE); /** Zero or one xs:anyAtomicType. */ public static final SeqType AAT = AtomType.AAT.seqType(); /** Zero or one xs:anyAtomicType. */ public static final SeqType AAT_ZO = new SeqType(AtomType.AAT, Occ.ZERO_ONE); /** Zero or more xs:anyAtomicType. */ public static final SeqType AAT_ZM = new SeqType(AtomType.AAT, Occ.ZERO_MORE); /** Single xs:boolean. */ public static final SeqType BLN = AtomType.BLN.seqType(); /** Zero or one xs:boolean. */ public static final SeqType BLN_ZO = new SeqType(AtomType.BLN, Occ.ZERO_ONE); /** Double number. */ public static final SeqType DBL = AtomType.DBL.seqType(); /** Double number. */ public static final SeqType DBL_ZM = new SeqType(AtomType.DBL, Occ.ZERO_MORE); /** Zero or one double. */ public static final SeqType DBL_ZO = new SeqType(AtomType.DBL, Occ.ZERO_ONE); /** Zero or one decimal number. */ public static final SeqType DEC_ZO = new SeqType(AtomType.DEC, Occ.ZERO_ONE); /** Single integer; for simplicity, numbers are summarized by this type. */ public static final SeqType ITR = AtomType.ITR.seqType(); /** Zero or one integer. */ public static final SeqType ITR_ZO = new SeqType(AtomType.ITR, Occ.ZERO_ONE); /** Zero or more integers. */ public static final SeqType ITR_ZM = new SeqType(AtomType.ITR, Occ.ZERO_MORE); /** One or more integers. */ public static final SeqType ITR_OM = new SeqType(AtomType.ITR, Occ.ONE_MORE); /** One or more bytes. */ public static final SeqType BYT_OM = new SeqType(AtomType.BYT, Occ.ONE_MORE); /** Single node. */ public static final SeqType NOD = NodeType.NOD.seqType(); /** Zero or one nodes. */ public static final SeqType NOD_ZO = new SeqType(NodeType.NOD, Occ.ZERO_ONE); /** Zero or more nodes. */ public static final SeqType NOD_ZM = new SeqType(NodeType.NOD, Occ.ZERO_MORE); /** Single QName. */ public static final SeqType QNM = AtomType.QNM.seqType(); /** Zero or one QNames. */ public static final SeqType QNM_ZO = new SeqType(AtomType.QNM, Occ.ZERO_ONE); /** Single URI. */ public static final SeqType URI = AtomType.URI.seqType(); /** Zero or one URIs. */ public static final SeqType URI_ZO = new SeqType(AtomType.URI, Occ.ZERO_ONE); /** Zero or more URIs. */ public static final SeqType URI_ZM = new SeqType(AtomType.URI, Occ.ZERO_MORE); /** Single string. */ public static final SeqType STR = AtomType.STR.seqType(); /** Zero or one strings. */ public static final SeqType STR_ZO = new SeqType(AtomType.STR, Occ.ZERO_ONE); /** Zero or more strings. */ public static final SeqType STR_ZM = new SeqType(AtomType.STR, Occ.ZERO_MORE); /** Zero or one NCName. */ public static final SeqType NCN_ZO = new SeqType(AtomType.NCN, Occ.ZERO_ONE); /** Single date. */ public static final SeqType DAT = AtomType.DAT.seqType(); /** Zero or one date. */ public static final SeqType DAT_ZO = new SeqType(AtomType.DAT, Occ.ZERO_ONE); /** One day-time-duration. */ public static final SeqType DTD = AtomType.DTD.seqType(); /** Zero or one day-time-duration. */ public static final SeqType DTD_ZO = new SeqType(AtomType.DTD, Occ.ZERO_ONE); /** One date-time. */ public static final SeqType DTM = AtomType.DTM.seqType(); /** Zero or one date-time. */ public static final SeqType DTM_ZO = new SeqType(AtomType.DTM, Occ.ZERO_ONE); /** One time. */ public static final SeqType TIM = AtomType.TIM.seqType(); /** Zero or one time. */ public static final SeqType TIM_ZO = new SeqType(AtomType.TIM, Occ.ZERO_ONE); /** Zero or one duration. */ public static final SeqType DUR_ZO = new SeqType(AtomType.DUR, Occ.ZERO_ONE); /** Zero of single function. */ public static final SeqType FUN_OZ = new SeqType(FuncType.ANY_FUN, Occ.ZERO_ONE); /** Single function. */ public static final SeqType FUN_O = FuncType.ANY_FUN.seqType(); /** Zero of more functions. */ public static final SeqType FUN_ZM = new SeqType(FuncType.ANY_FUN, Occ.ZERO_MORE); /** Zero or more bytes. */ public static final SeqType BYT_ZM = new SeqType(AtomType.BYT, Occ.ZERO_MORE); /** One attribute node. */ public static final SeqType ATT = NodeType.ATT.seqType(); /** One comment node. */ public static final SeqType COM = NodeType.COM.seqType(); /** One document node. */ public static final SeqType DOC_O = NodeType.DOC.seqType(); /** Zero or one document node. */ public static final SeqType DOC_ZO = new SeqType(NodeType.DOC, Occ.ZERO_ONE); /** One or more document node. */ public static final SeqType DOC_OM = new SeqType(NodeType.DOC, Occ.ONE_MORE); /** Zero or more document node. */ public static final SeqType DOC_ZM = new SeqType(NodeType.DOC, Occ.ZERO_MORE); /** One element node. */ public static final SeqType ELM = NodeType.ELM.seqType(); /** Zero or more element nodes. */ public static final SeqType ELM_ZM = new SeqType(NodeType.ELM, Occ.ZERO_MORE); /** Namespace node. */ public static final SeqType NSP = NodeType.NSP.seqType(); /** Namespace node. */ public static final SeqType PI = NodeType.PI.seqType(); /** Namespace node. */ public static final SeqType TXT_ZO = new SeqType(NodeType.TXT, Occ.ZERO_ONE); /** The general map type. */ public static final MapType ANY_MAP = new MapType(AtomType.AAT, ITEM_ZM); /** Single function. */ public static final SeqType MAP_ZM = new SeqType(ANY_MAP, Occ.ZERO_MORE); /** Single function. */ public static final SeqType MAP_O = new SeqType(ANY_MAP); /** One xs:hexBinary. */ public static final SeqType HEX = AtomType.HEX.seqType(); /** Single xs:base64Binary. */ public static final SeqType B64 = AtomType.B64.seqType(); /** Zero or more xs:base64Binary. */ public static final SeqType B64_ZM = new SeqType(AtomType.B64, Occ.ZERO_MORE); /** Single binary. */ public static final SeqType BIN = AtomType.BIN.seqType(); /** Zero or more binaries. */ public static final SeqType BIN_ZM = new SeqType(AtomType.BIN, Occ.ZERO_MORE); /** Sequence type. */ public final Type type; /** Number of occurrences. */ public final Occ occ; /** Optional kind test. */ private final Test kind; /** * Private constructor. * @param t type * @param o occurrences */ private SeqType(final Type t, final Occ o) { this(t, o, null); } /** * Constructor. This one is called by {@link Type#seqType} to create * unique sequence type instances. * @param t type */ SeqType(final Type t) { this(t, Occ.ONE); } /** * Private constructor. * @param t type * @param o occurrences * @param k kind test */ private SeqType(final Type t, final Occ o, final Test k) { type = t; occ = o; kind = k; } /** * Returns a sequence type. * @param t type * @param o occurrences * @return sequence type */ public static SeqType get(final Type t, final Occ o) { return o == Occ.ONE ? t.seqType() : new SeqType(t, o); } /** * Returns a sequence type. * @param t type * @param o number of occurrences * @return sequence type */ public static SeqType get(final Type t, final long o) { return get(t, o == 0 ? Occ.ZERO : o == 1 ? Occ.ONE : o > 1 ? Occ.ONE_MORE : Occ.ZERO_MORE); } /** * Returns a sequence type. * @param t type * @param o occurrences * @param k kind test * @return sequence type */ public static SeqType get(final Type t, final Occ o, final Test k) { return new SeqType(t, o, k); } /** * Returns a version of this sequence type that is adapted to the given {@link Occ}. * @param o occurrence indicator * @return sequence type */ public SeqType withOcc(final Occ o) { return o == occ ? this : get(type, o, kind); } /** * Matches a value against this sequence type. * @param val value to be checked * @return result of check */ public boolean instance(final Value val) { final long size = val.size(); if(!occ.check(size)) return false; for(long i = 0; i < size; i++) { // maps don't have type information attached to them, you have to look... if(!instance(val.itemAt(i), true)) return false; if(i == 0 && val.homogeneous()) break; } return true; } /** * Checks if an item can be part of a sequence that is instance of this type. * @param it item to check * @param knd check kind * @return result of check */ private boolean instance(final Item it, final boolean knd) { // maps don't have type information attached to them, you have to look... return type instanceof MapType ? it instanceof Map && ((Map) it).hasType((MapType) type) : it.type.instanceOf(type) && (!knd || kind == null || kind.eq(it)); } /** * Tries to cast the given item to this sequence type. * @param it item to cast * @param ctx query context * @param ii input info * @param e expression for error message * @return promoted item * @throws QueryException query exception */ public Value cast(final Item it, final QueryContext ctx, final InputInfo ii, final ExprInfo e) throws QueryException { if(it == null) { if(!occ.check(0)) INVEMPTYEX.thrw(ii, e.description(), this); return Empty.SEQ; } if(!occ.check(1)) INVCAST.thrw(ii, it.type, this); final Value v = it.type.eq(type) ? it : type.cast(it, ctx, ii); if(kind != null) { for(final Item i : v) if(!kind.eq(it)) Err.cast(ii, type, i); } return v; } /** * Casts a sequence to this type. * @param val value to cast * @param ctx query context * @param ii input info * @param e expression * @return resulting value * @throws QueryException query exception */ public Value cast(final Value val, final QueryContext ctx, final InputInfo ii, final ExprInfo e) throws QueryException { if(val.size() < 2) return cast(val.isEmpty() ? null : val.itemAt(0), ctx, ii, e); if(!occ.check(val.size())) INVCAST.thrw(ii, val.type(), this); final ValueBuilder vb = new ValueBuilder((int) val.size()); for(int i = 0; i < val.size(); i++) vb.add(cast(val.itemAt(i), ctx, ii, e)); return vb.value(); } /** * Treats the specified value as this sequence type. * @param val value to promote * @param ii input info * @return the value * @throws QueryException query exception */ public Value treat(final Value val, final InputInfo ii) throws QueryException { if(val.type().instanceOf(this)) return val; final int size = (int) val.size(); if(!occ.check(size)) Err.treat(ii, this, val); // empty sequence has all types if(size == 0) return Empty.SEQ; // check first item boolean ins = instance(val.itemAt(0), true); // check heterogeneous sequences if(!val.homogeneous()) for(int i = 1; ins && i < size; i++) ins = instance(val.itemAt(i), true); if(!ins) Err.treat(ii, this, val); return val; } /** * Tries to promote an item to this type's element type. * @param ctx query context * @param ii input info * @param it item to promote * @return promoted item * @throws QueryException query exception */ private Value funcConv(final QueryContext ctx, final InputInfo ii, final Item it) throws QueryException { if(type instanceof AtomType) { final Item atom = StandardFunc.atom(it, ii); if(atom != it && atom.type.instanceOf(type)) return it; if(atom.type == AtomType.ATM) { if(type.nsSensitive()) { if(ctx.sc.xquery3()) NSSENS.thrw(ii, it.type, type); Err.treat(ii, withOcc(Occ.ONE), it); } return type.cast(atom, ctx, ii); } final Type at = atom.type, tt = type; if(tt == AtomType.DBL && (at.instanceOf(AtomType.FLT) || at.instanceOf(AtomType.DEC))) return Dbl.get(atom.dbl(ii)); if(tt == AtomType.FLT && at.instanceOf(AtomType.DEC)) return Flt.get(atom.flt(ii)); if(tt == AtomType.STR && at.instanceOf(AtomType.URI)) return Str.get(atom.string(ii)); } else if(it instanceof FItem && type instanceof FuncType) { return ((FItem) it).coerceTo((FuncType) type, ctx, ii); } throw Err.treat(ii, withOcc(Occ.ONE), it); } /** * Performs function conversion on the given value. * @param ctx query context * @param ii input info * @param val value to convert * @return converted value * @throws QueryException if the conversion ws not possible */ public Value funcConvert(final QueryContext ctx, final InputInfo ii, final Value val) throws QueryException { final long n = val.size(); if(!occ.check(n)) throw Err.treat(ii, this, val); if(n == 0) return Empty.SEQ; if(val.isItem()) return instance((Item) val, true) ? val : funcConv(ctx, ii, (Item) val); ValueBuilder vb = null; final Item fst = val.itemAt(0); if(!instance(fst, true)) { vb = new ValueBuilder(new Item[(int) val.size()], 0); vb.add(funcConv(ctx, ii, fst)); } else if(val.homogeneous()) { return val; } for(int i = 1; i < n; i++) { final Item it = val.itemAt(i); if(vb != null) { vb.add(instance(it, true) ? it : funcConv(ctx, ii, it)); } else if(!instance(it, true)) { vb = new ValueBuilder(new Item[(int) val.size()], 0); for(int j = 0; j < i; j++) vb.add(val.itemAt(j)); vb.add(funcConv(ctx, ii, it)); } } return vb != null ? Seq.get(vb.item, (int) vb.size(), type) : val; } /** * Checks if this type could be converted to the given one by function conversion. * @param t type to convert to * @return result of check */ public boolean convertibleTo(final SeqType t) { if(intersect(t) != null) return true; if(occ.intersect(t.occ) == null) return false; final Type to = t.type; if(to instanceof AtomType) { if(type.isUntyped()) return !to.nsSensitive(); return to == AtomType.DBL && (couldBe(AtomType.FLT) || couldBe(AtomType.DEC)) || to == AtomType.FLT && couldBe(AtomType.DEC) || to == AtomType.STR && couldBe(AtomType.URI); } return t.type instanceof FuncType && type instanceof FuncType; } /** * Checks if this type's item type could be instance of the given one. * @param o other type * @return result of check */ private boolean couldBe(final Type o) { return type.intersect(o) != null; } /** * Computes the union of two sequence types, i.e. the lowest common ancestor of both * types. * @param t second type * @return resulting type */ public SeqType union(final SeqType t) { return get(type == t.type ? type : type.union(t.type), occ.union(t.occ)); } /** * Computes the intersection of two sequence types, i.e. the most general type that is * sub-type of both types. If no such type exists, {@code null} is returned * @param t second type * @return resulting type or {@code null} */ public SeqType intersect(final SeqType t) { final Occ o = occ.intersect(t.occ); if(o == null) return null; final Type tp = type.intersect(t.type); if(tp == null) return null; if(kind == null || t.kind == null || kind.sameAs(t.kind)) return get(tp, o, kind != null ? kind : t.kind); final Test k = kind.intersect(t.kind); return k == null ? null : get(tp, o, k); } /** * Returns the number of occurrences, or {@code -1} if the number is unknown. * @return result of check */ public long occ() { return occ == Occ.ZERO ? 0 : occ == Occ.ONE ? 1 : -1; } /** * Tests if the type yields at most one item. * @return result of check */ public boolean zeroOrOne() { return occ.max <= 1; } /** * Tests if the type exactly one item. * @return result of check */ public boolean one() { return occ == Occ.ONE; } /** * Tests if the type may yield zero items. * @return result of check */ public boolean mayBeZero() { return occ.min == 0; } /** * Tests if the type may be numeric. * @return result of check */ public boolean mayBeNumber() { return type.isNumber() || type == AtomType.ITEM; } /** * Checks the types for equality. * @param t type * @return result of check */ public boolean eq(final SeqType t) { return type.eq(t.type) && occ == t.occ && (kind == null ? t.kind == null : t.kind != null && kind.sameAs(t.kind)); } /** * Checks if the specified SeqType is an instance of the current SeqType. * @param t SeqType to check * @return result of check */ public boolean instanceOf(final SeqType t) { return type.instanceOf(t.type) && occ.instanceOf(t.occ) // [LW] complete kind check && t.kind == null || kind != null && kind.intersect(t.kind) != null; } @Override public String toString() { final StringBuilder sb = new StringBuilder(); if(occ != Occ.ONE && type instanceof FuncType) { sb.append('(').append(typeString()).append(')'); } else { sb.append(typeString()); } if(!(type instanceof ListType)) sb.append(occ); return sb.toString(); } /** * Returns a string representation of the type. * @return string */ public String typeString() { final StringBuilder sb = new StringBuilder(); sb.append(occ == Occ.ZERO ? EMPTY_SEQUENCE + "()" : type); if(kind != null) sb.deleteCharAt(sb.length() - 1).append(kind).append(')'); return sb.toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/value/type/Type.java000066400000000000000000000171241222453003200262320ustar00rootroot00000000000000package org.basex.query.value.type; import org.basex.query.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * XQuery data types. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public interface Type { /** Type IDs for client/server communication. */ public static enum ID { // function types /** function(*). */ FUN(7), // node types /** node(). */ NOD(8), /** text(). */ TXT(9), /** processing-instruction(). */ PI(10), /** element(). */ ELM(11), /** document-node(). */ DOC(12), /** document-node(element()). */ DEL(13), /** attribute(). */ ATT(14), /** comment(). */ COM(15), /** namespace-node(). */ NSP(16), /** schema-element(). */ SCE(17), /** schema-attribute(). */ SCA(18), // item type /** item(). */ ITEM(32), // atomic types /** xs:untyped. */ UTY(33), /** xs:anyType. */ ATY(34), /** xs:anySimpleType. */ AST(35), /** xs:anyAtomicType. */ AAT(36), /** xs:untypedAtomic. */ ATM(37), /** xs:string. */ STR(38), /** xs:normalizedString. */ NST(39), /** xs:token. */ TOK(40), /** xs:language. */ LAN(41), /** xs:NMTOKEN. */ NMT(42), /** xs:Name. */ NAM(43), /** xs:NCName. */ NCN(44), /** xs:ID. */ ID(45), /** xs:IDREF. */ IDR(46), /** xs:ENTITY. */ ENT(47), /** xs:float. */ FLT(48), /** xs:double. */ DBL(49), /** xs:decimal. */ DEC(50), /** precisionDecimal(). */ PDC(51), /** xs:integer. */ ITR(52), /** xs:nonPositiveInteger. */ NPI(53), /** xs:negativeInteger. */ NIN(54), /** xs:long. */ LNG(55), /** xs:int. */ INT(56), /** xs:short. */ SHR(57), /** xs:byte. */ BYT(58), /** xs:nonNegativeInteger. */ NNI(59), /** xs:unsignedLong. */ ULN(60), /** xs:unsignedInt. */ UIN(61), /** xs:unsignedShort. */ USH(62), /** xs:unsignedByte. */ UBY(63), /** xs:positiveInteger. */ PIN(64), /** xs:duration. */ DUR(65), /** xs:yearMonthDuration. */ YMD(66), /** xs:dayTimeDuration. */ DTD(67), /** xs:dateTime. */ DTM(68), /** dateTimeStamp(). */ DTS(69), /** xs:date. */ DAT(70), /** xs:time. */ TIM(71), /** xs:gYearMonth. */ YMO(72), /** xs:gYear. */ YEA(73), /** xs:gMonthDay. */ MDA(74), /** xs:gDay. */ DAY(75), /** xs:gMonth. */ MON(76), /** xs:boolean. */ BLN(77), /** binary(). */ BIN(78), /** xs:base64Binary. */ B64(79), /** xs:hexBinary. */ HEX(80), /** xs:anyURI. */ URI(81), /** xs:QName. */ QNM(82), /** xs:NOTATION. */ NOT(83), /** java(). */ JAVA(86); /** Cached enums (faster). */ public static final ID[] VALUES = values(); /** Node ID. */ private final byte id; /** * Constructor. * @param i type id */ private ID(final int i) { id = (byte) i; } /** * returns the type ID as a byte. * @return type ID */ public byte asByte() { return id; } /** * Gets the ID for the given byte value. * @param b byte * @return type ID if found, {@code null} otherwise */ public static ID get(final byte b) { for(final ID i : VALUES) if(i.id == b) return i; return null; } /** * Gets the type instance for the given ID. * @param b type ID * @return corresponding type if found, {@code null} otherwise */ public static Type getType(final byte b) { final ID id = get(b); if(id == null) return null; if(id == FUN) return FuncType.ANY_FUN; final Type t = AtomType.getType(id); return t != null ? t : NodeType.getType(id); } } /** * Casts the specified item to the XQuery data type. * @param it item to be converted * @param ctx query context * @param ii input info * @return new item * @throws QueryException query exception */ Value cast(final Item it, final QueryContext ctx, final InputInfo ii) throws QueryException; /** * Casts the specified Java object to the XQuery data type. * @param o Java object * @param ctx TODO * @param ii input info * @return new item * @throws QueryException query exception */ Value cast(final Object o, QueryContext ctx, final InputInfo ii) throws QueryException; /** * Casts the specified string to the XQuery data type. * @param s string object * @param ctx TODO * @param ii input info * @return new item * @throws QueryException query exception */ Value castString(final String s, QueryContext ctx, final InputInfo ii) throws QueryException; /** * Returns the sequence type of this data type. * @return sequence type */ SeqType seqType(); // PUBLIC AND STATIC METHODS ================================================ /** * Checks if this type is equal to the given one. * @param t other type * @return {@code true} if both types are equal, {@code false} otherwise */ boolean eq(final Type t); /** * Checks if the current type is an instance of the specified type. * @param t type to be checked * @return result of check */ boolean instanceOf(final Type t); /** * Computes the union between this type and the given one, i.e. the least common * ancestor of both types in the type hierarchy. * @param t other type * @return union type */ Type union(final Type t); /** * Computes the intersection between this type and the given one, i.e. the least * specific type that is sub-type of both types. If no such type exists, {@code null} is * returned. * @param t other type * @return intersection type or {@code null} */ Type intersect(final Type t); /** * Checks if the type refers to a node. * @return result of check */ boolean isNode(); /** * Checks if the type refers to a number. * @return result of check */ boolean isNumber(); /** * Checks if the type refers to an untyped item. * @return result of check */ boolean isUntyped(); /** * Checks if the type refers to a number or an untyped item. * @return result of check */ boolean isNumberOrUntyped(); /** * Checks if the type refers to a number or a string. * Returns if this item is untyped or a string. * @return result of check */ boolean isStringOrUntyped(); /** * Returns the string representation of this type. * @return name */ byte[] string(); /** * Returns a type id to differentiate all types. * @return id */ ID id(); @Override String toString(); /** * Checks if the type is namespace-sensitive. * @return result of check */ boolean nsSensitive(); } basex-7.7.2/basex-core/src/main/java/org/basex/query/var/000077500000000000000000000000001222453003200231345ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/query/var/StaticVar.java000066400000000000000000000160631222453003200257050ustar00rootroot00000000000000package org.basex.query.var; import static org.basex.query.QueryText.*; import static org.basex.query.util.Err.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.expr.Expr.Flag; import org.basex.query.func.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Static variable to which an expression can be assigned. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class StaticVar extends StaticDecl { /** Annotation for lazy evaluation. */ private static final QNm LAZY = new QNm(QueryText.LAZY, QueryText.BASEXURI); /** If this variable can be bound from outside the query. */ private final boolean external; /** Flag for implicitly defined variables. */ private final boolean implicit; /** Bound value. */ Value value; /** Flag for lazy evaluation. */ private final boolean lazy; /** * Constructor for a variable declared in a query. * @param sctx static context * @param scp variable scope * @param a annotations * @param n variable name * @param t variable type * @param e expression to be bound * @param ext external flag * @param xqdoc current xqdoc cache * @param ii input info */ StaticVar(final StaticContext sctx, final VarScope scp, final Ann a, final QNm n, final SeqType t, final Expr e, final boolean ext, final String xqdoc, final InputInfo ii) { super(sctx, a, n, t, scp, xqdoc, ii); expr = e; external = ext; lazy = ann.contains(LAZY); implicit = false; } /** * Constructor for implicitly declared external variables. * @param ctx query context * @param nm variable name * @param ii input info */ public StaticVar(final QueryContext ctx, final QNm nm, final InputInfo ii) { super(ctx.sc, null, nm, null, new VarScope(), null, ii); expr = null; external = true; lazy = false; implicit = true; } @Override public void compile(final QueryContext ctx) throws QueryException { if(expr == null) throw (implicit ? VARUNDEF : VAREMPTY).thrw(info, this); if(dontEnter) throw circVar(ctx, this); if(!compiled) { final StaticContext cs = ctx.sc; ctx.sc = sc; dontEnter = true; final int fp = scope.enter(ctx); try { expr = expr.compile(ctx, scope); } catch(final QueryException qe) { compiled = true; if(lazy) { expr = FNInfo.error(qe); return; } throw qe.notCatchable(); } finally { scope.cleanUp(this); scope.exit(ctx, fp); ctx.sc = cs; dontEnter = false; } compiled = true; if(!lazy || expr.isValue()) bind(value(ctx)); } } /** * Evaluates this variable lazily. * @param ctx query context * @return value of this variable * @throws QueryException query exception */ public Value value(final QueryContext ctx) throws QueryException { if(dontEnter) circVar(ctx, this); if(lazy) { if(!compiled) throw Util.notexpected(this + " was not compiled."); if(value != null) return value; final StaticContext cs = ctx.sc; ctx.sc = sc; dontEnter = true; final int fp = scope.enter(ctx); try { return bind(expr.value(ctx)); } catch(final QueryException qe) { throw qe.notCatchable(); } finally { scope.exit(ctx, fp); ctx.sc = cs; dontEnter = false; } } if(value != null) return value; if(expr == null) throw VAREMPTY.thrw(info, this); dontEnter = true; final int fp = scope.enter(ctx); final StaticContext cs = ctx.sc; ctx.sc = sc; try { return bind(expr.value(ctx)); } finally { scope.exit(ctx, fp); ctx.sc = cs; dontEnter = false; } } /** * Checks for the correct placement of updating expressions in this variable. * @throws QueryException query exception */ public void checkUp() throws QueryException { if(expr != null && expr.has(Flag.UPD)) UPNOT.thrw(info, description()); } /** * Binds an expression to this variable from outside the query. * @param e value to bind * @param ctx query context * @return if the value could be bound * @throws QueryException query exception */ public boolean bind(final Expr e, final QueryContext ctx) throws QueryException { return bind(e, true, ctx, info); } /** * Binds the specified expression to the variable. * @param e expression to be set * @param ext if the value is bound from outside the query * @param ctx query context * @param ii input info * @return if the value could be bound * @throws QueryException query exception */ private boolean bind(final Expr e, final boolean ext, final QueryContext ctx, final InputInfo ii) throws QueryException { if(!external || compiled) return false; if(e instanceof Value) { Value v = (Value) e; if(ext && declType != null && !declType.instance(v)) v = declType.cast(v, ctx, ii, e); bind(v); } else { expr = checkType(e, ii); value = null; } return true; } /** * Checks if the given expression can be bound to this variable. * @param e expression * @param ii input info * @return the expression * @throws QueryException query exception */ private Expr checkType(final Expr e, final InputInfo ii) throws QueryException { if(declType != null) { if(e instanceof Value) declType.treat((Value) e, ii); else if(e.type().intersect(declType) == null) throw treat(ii, declType, e); } return e; } /** * Binds the specified value to the variable. * @param v value to be set * @return self reference * @throws QueryException query exception */ private Value bind(final Value v) throws QueryException { expr = v; value = declType != null ? declType.treat(v, info) : v; return value; } @Override public void plan(final FElem plan) { final FElem e = planElem(NAM, name.string()); if(expr != null) expr.plan(e); plan.add(e); } @Override public boolean visit(final ASTVisitor visitor) { return expr == null || expr.accept(visitor); } /** * Adds the description of this variable to the given string builder. * @param sb string builder * @return the string builder for convenience */ public StringBuilder fullDesc(final StringBuilder sb) { sb.append(DECLARE).append(' '); if(!ann.isEmpty()) sb.append(ann); sb.append(VARIABLE).append(' ').append(DOLLAR).append( Token.string(name.string())).append(' '); if(declType != null) sb.append(AS).append(' ').append(declType).append(' '); if(expr != null) sb.append(ASSIGN).append(' ').append(expr); else sb.append(EXTERNAL); return sb.append(';'); } @Override public String toString() { return new TokenBuilder(DOLLAR).add(name.string()).toString(); } @Override public byte[] id() { return Token.concat(new byte[] { '$' }, name.id()); } } basex-7.7.2/basex-core/src/main/java/org/basex/query/var/StaticVarRef.java000066400000000000000000000053151222453003200263400ustar00rootroot00000000000000package org.basex.query.var; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Reference to a static variable. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class StaticVarRef extends ParseExpr { /** Variable name. */ private final QNm name; /** Referenced variable. */ StaticVar var; /** URI of the enclosing module. */ private final StaticContext sc; /** * Constructor. * @param ii input info * @param nm variable name * @param sctx static context */ public StaticVarRef(final InputInfo ii, final QNm nm, final StaticContext sctx) { super(ii); name = nm; sc = sctx; } @Override public void checkUp() throws QueryException { } @Override public Expr compile(final QueryContext ctx, final VarScope o) throws QueryException { var.compile(ctx); return var.value != null ? var.value : this; } @Override public Iter iter(final QueryContext ctx) throws QueryException { return value(ctx).iter(); } @Override public Value value(final QueryContext ctx) throws QueryException { return var.value(ctx); } @Override public boolean has(final Flag flag) { return var != null && var.expr != null && var.expr.has(flag); } @Override public boolean accept(final ASTVisitor visitor) { return visitor.staticVar(var); } @Override public Expr copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final StaticVarRef ref = new StaticVarRef(info, name, sc); ref.var = var; return ref; } @Override public int exprSize() { // should always be inlined return 0; } @Override public String toString() { return '$' + Token.string(name.string()); } @Override public boolean removable(final Var v) { return true; } @Override public VarUsage count(final Var v) { return VarUsage.NEVER; } @Override public Expr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { return null; } @Override public void plan(final FElem plan) { addPlan(plan, planElem(QueryText.VAR, name)); } /** * Initializes this reference with the given variable. * @param vr variable * @throws QueryException query exception */ public void init(final StaticVar vr) throws QueryException { if(vr.ann.contains(Ann.Q_PRIVATE) && !Token.eq(sc.baseURI().string(), vr.sc.baseURI().string())) throw Err.VARPRIVATE.thrw(info, vr); var = vr; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/var/Var.java000066400000000000000000000144461222453003200245400ustar00rootroot00000000000000package org.basex.query.var; import org.basex.data.ExprInfo; import org.basex.query.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.query.expr.*; import org.basex.query.util.*; import org.basex.util.*; /** * Variable expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Leo Woerteler */ public final class Var extends ExprInfo { /** Variable name. */ public final QNm name; /** Variable ID. */ public final int id; /** Declared type, {@code null} if not specified. */ public SeqType declType; /** Stack slot number. */ public int slot = -1; /** Expected result size. */ public long size = -1; /** Flag for function parameters. */ private final boolean param; /** Actual return type (by type inference). */ private SeqType inType; /** Flag for function conversion. */ private boolean promote; /** * Constructor. * @param ctx query context, used for generating a variable ID * @param n variable name, {@code null} for unnamed variable * @param typ expected type, {@code null} for no check * @param fun function parameter flag */ Var(final QueryContext ctx, final QNm n, final SeqType typ, final boolean fun) { name = n; declType = typ; inType = SeqType.ITEM_ZM; id = ctx.varIDs++; param = fun; promote = fun; size = inType.occ(); } /** * Constructor for local variables. * @param ctx query context, used for generating a variable ID * @param n variable name, {@code null} for unnamed variable * @param typ expected type, {@code null} for no check */ Var(final QueryContext ctx, final QNm n, final SeqType typ) { this(ctx, n, typ, false); } /** * Copy constructor. * @param ctx query context * @param var variable to copy */ Var(final QueryContext ctx, final Var var) { this(ctx, var.name, var.declType, var.param); promote = var.promote; inType = var.inType; size = var.size; } /** * Type of values bound to this variable. * @return (non-{@code null}) type */ public SeqType type() { final SeqType intersect = declType != null ? declType.intersect(inType) : null; return intersect != null ? intersect : declType != null ? declType : inType; } /** * Declared type of this variable. * @return declared type, possibly {@code null} */ public SeqType declaredType() { return declType == null ? SeqType.ITEM_ZM : declType; } /** * Tries to refine the compile-time type of this variable through the type of the bound * expression. * @param t type of the bound expression * @param ctx query context * @param ii input info * @throws QueryException query exception */ public void refineType(final SeqType t, final QueryContext ctx, final InputInfo ii) throws QueryException { if(t == null) return; if(declType != null) { if(declType.occ.intersect(t.occ) == null) Err.INVCAST.thrw(ii, t, declType); if(!t.convertibleTo(declType)) return; } if(!inType.eq(t) && !inType.instanceOf(t)) { final SeqType is = inType.intersect(t); if(is != null) { inType = is; if(declType != null && inType.instanceOf(declType)) { ctx.compInfo(QueryText.OPTCAST, this); declType = null; } } } } /** * Determines if this variable checks the type of the expression bound to it. * @return {@code true} if the type is checked or promoted, {@code false} otherwise */ public boolean checksType() { return declType != null; } /** * Returns an equivalent to the given expression that checks this variable's type. * @param e expression * @param scp variable scope * @param ctx query context * @param ii input info * @return checked expression * @throws QueryException query exception */ public Expr checked(final Expr e, final QueryContext ctx, final VarScope scp, final InputInfo ii) throws QueryException { return checksType() ? new TypeCheck(ii, e, declType, promotes()).optimize(ctx, scp) : e; } /** * Checks the type of this value and casts/promotes it when necessary. * @param val value to be checked * @param ctx query context * @param ii input info * @return checked and possibly cast value * @throws QueryException if the check failed */ public Value checkType(final Value val, final QueryContext ctx, final InputInfo ii) throws QueryException { if(!checksType() || declType.instance(val)) return val; if(promote) return declType.funcConvert(ctx, ii, val); throw Err.INVCAST.thrw(ii, val.type(), declType); } /** * Checks whether the given variable is identical to this one, i.e. has the * same ID. * @param v variable to check * @return {@code true}, if the IDs are equal, {@code false} otherwise */ public boolean is(final Var v) { return id == v.id; } /** * Checks if this variable performs function conversion on its bound values. * @return result of check */ public boolean promotes() { return promote; } @Override public void plan(final FElem plan) { final FElem e = planElem(QueryText.NAM, '$' + Token.string(name.string()), QueryText.ID, Token.token(id)); if(declType != null) e.add(planAttr(QueryText.AS, declType.toString())); addPlan(plan, e); } @Override public String toString() { final TokenBuilder tb = new TokenBuilder(); if(name != null) { tb.add(QueryText.DOLLAR).add(name.string()); if(declType != null) tb.add(' ' + QueryText.AS); } if(declType != null) tb.add(" " + declType); return tb.toString(); } @Override public boolean equals(final Object obj) { return obj instanceof Var && is((Var) obj); } @Override public int hashCode() { return id; } /** * Tries to adopt the given type check. * @param t type to check * @param prom if function conversion should be applied * @return {@code true} if the check could be adopted, {@code false} otherwise */ public boolean adoptCheck(final SeqType t, final boolean prom) { if(declType == null || t.instanceOf(declType)) { declType = t; } else if(!declType.instanceOf(t)) { return false; } promote |= prom; return true; } }basex-7.7.2/basex-core/src/main/java/org/basex/query/var/VarRef.java000066400000000000000000000052571222453003200251750ustar00rootroot00000000000000package org.basex.query.var; import static org.basex.query.QueryText.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.util.*; import org.basex.util.hash.*; /** * Local Variable Reference expression. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Leo Woerteler */ public final class VarRef extends ParseExpr { /** Variable name. */ public Var var; /** * Constructor. * @param ii input info * @param v variable */ public VarRef(final InputInfo ii, final Var v) { super(ii); var = v; } @Override public Expr compile(final QueryContext ctx, final VarScope scp) throws QueryException { type = var.type(); size = var.size; // constant propagation final Value v = ctx.get(var); return v != null ? v : this; } @Override public Item item(final QueryContext ctx, final InputInfo ii) throws QueryException { return ctx.get(var).item(ctx, ii); } @Override public Iter iter(final QueryContext ctx) throws QueryException { return ctx.get(var).iter(); } @Override public Value value(final QueryContext ctx) throws QueryException { return ctx.get(var); } @Override public boolean removable(final Var v) { return true; } @Override public VarUsage count(final Var v) { return var.is(v) ? VarUsage.ONCE : VarUsage.NEVER; } @Override public Expr inline(final QueryContext ctx, final VarScope scp, final Var v, final Expr e) throws QueryException { // [LW] Is copying always necessary? return !v.is(var) ? null : e.isValue() ? e : e.copy(ctx, scp); } @Override public VarRef copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final Var nw = vs.get(var.id); return new VarRef(info, nw != null ? nw : var); } @Override public boolean sameAs(final Expr cmp) { return cmp instanceof VarRef && var.is(((VarRef) cmp).var); } @Override public void plan(final FElem plan) { final FElem e = planElem(); var.plan(e); plan.add(e); } @Override public String description() { return VARBL; } @Override public boolean accept(final ASTVisitor visitor) { return visitor.used(this); } @Override public void checkUp() throws QueryException { } @Override public String toString() { return new TokenBuilder(DOLLAR).add(var.name.toString()).toString(); } @Override public boolean has(final Flag flag) { return false; } @Override public int exprSize() { return 1; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/var/VarScope.java000066400000000000000000000137041222453003200255260ustar00rootroot00000000000000package org.basex.query.var; import static org.basex.util.Token.*; import java.util.*; import java.util.Map.Entry; import java.util.concurrent.atomic.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.query.expr.*; import org.basex.query.util.*; import org.basex.util.*; import org.basex.util.hash.*; /** * The scope of variables, either the query, a use-defined or an inline function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class VarScope { /** stack of currently accessible variables. */ private final VarStack current = new VarStack(); /** Local variables in this scope. */ private final ArrayList vars = new ArrayList(); /** This scope's closure. */ private final Map closure = new HashMap(); /** This scope's parent scope, used for looking up non-local variables. */ private final VarScope parent; /** Constructor for a top-level module. */ public VarScope() { this(null); } /** * Constructor. * @param par parent scope */ private VarScope(final VarScope par) { parent = par; } /** * Adds a variable to this scope. * @param var variable to be added * @return the variable (for convenience) */ private Var add(final Var var) { var.slot = vars.size(); vars.add(var); current.push(var); return var; } /** * Tries to resolve the given name as a local variable. * @param name variable name * @param ctx query context * @param ii input info * @return variable reference if found, {@code null} otherwise */ public VarRef resolve(final QNm name, final QueryContext ctx, final InputInfo ii) { final Var v = current.get(name); if(v != null) return new VarRef(ii, v); if(parent == null) return null; final VarRef nonLocal = parent.resolve(name, ctx, ii); if(nonLocal == null) return null; // a variable in the closure final Var local = add(new Var(ctx, name, nonLocal.type())); closure.put(local, nonLocal); return new VarRef(ii, local); } /** * Opens a new sub-scope inside this scope. The returned marker has to be supplied to * the corresponding call to {@link VarScope#close(int)} in order to mark the variables * as inaccessible. * @return marker for the current bindings */ public int open() { return current.size(); } /** * Closes the sub-scope and marks all contained variables as inaccessible. * @param marker marker for the start of the sub-scope */ public void close(final int marker) { current.size(marker); } /** * Get a sub-scope of this scope. * @return sub-scope */ public VarScope child() { return new VarScope(this); } /** * Parent scope of this scope. * @return parent */ public VarScope parent() { return parent; } /** * Creates a variable with a unique, non-clashing variable name. * @param ctx context for variable ID * @param type type * @param param function parameter flag * @return variable */ public Var uniqueVar(final QueryContext ctx, final SeqType type, final boolean param) { return add(new Var(ctx, new QNm(token(ctx.varIDs)), type, param)); } /** * Creates a new local variable in this scope. * @param ctx query context * @param name variable name * @param typ type of the variable * @param param function parameter flag * @return the variable */ public Var newLocal(final QueryContext ctx, final QNm name, final SeqType typ, final boolean param) { return add(new Var(ctx, name, typ, param)); } /** * Creates a new copy of the given variable in this scope. * @param ctx query context * @param var variable to copy * @return the variable */ public Var newCopyOf(final QueryContext ctx, final Var var) { return add(new Var(ctx, var)); } /** * Get the closure of this scope. * @return mapping from non-local to local variables */ public Map closure() { return closure; } /** * Enters this scope. * @param ctx query context * @return old frame pointer */ public int enter(final QueryContext ctx) { return ctx.stack.enterFrame(vars.size()); } /** * Exits this scope. * @param ctx query context * @param fp frame pointer */ public void exit(final QueryContext ctx, final int fp) { ctx.stack.exitFrame(fp); } /** * Deletes all unused variables from this scope and assigns stack slots. * This method should be run after compiling the scope. * @param expr the scope */ public void cleanUp(final Scope expr) { final BitSet declared = new BitSet(); final AtomicInteger counter = new AtomicInteger(); expr.visit(new ASTVisitor() { @Override public boolean declared(final Var var) { declared.set(var.id); var.slot = counter.getAndIncrement(); return true; } }); // purge all unused variables final Iterator iter = vars.iterator(); while(iter.hasNext()) { final Var v = iter.next(); if(!declared.get(v.id)) { v.slot = -1; iter.remove(); } } } @Override public String toString() { return Util.name(this) + vars.toString(); } /** * Stack-frame size needed for this scope. * @return stack-frame size */ public int stackSize() { return vars.size(); } /** * Copies this VarScope. * @param ctx query context * @param scp new parent scope * @param vs variable mapping * @return copied scope */ public VarScope copy(final QueryContext ctx, final VarScope scp, final IntObjMap vs) { final VarScope sc = new VarScope(scp); for(final Var v : vars) vs.put(v.id, sc.newCopyOf(ctx, v)); for(final Entry e : closure.entrySet()) { final Var v = vs.get(e.getKey().id); final Expr ex = e.getValue().copy(ctx, scp, vs); sc.closure.put(v, ex); } sc.current.clear(); return sc; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/var/VarStack.java000066400000000000000000000022661222453003200255230ustar00rootroot00000000000000package org.basex.query.var; import java.util.*; import org.basex.query.value.item.*; import org.basex.util.*; import org.basex.util.list.*; /** * Variable stack. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Leo Woerteler */ public final class VarStack extends ElementList { /** Variable expressions. */ public Var[] vars; /** * Default constructor. */ public VarStack() { this(4); } /** * Default constructor. * @param c initial capacity */ public VarStack(final int c) { vars = new Var[c]; } /** * Adds the specified variable. * @param v variable */ public void push(final Var v) { if(size == vars.length) vars = Array.copy(vars, new Var[newSize()]); vars[size++] = v; } /** * Returns a variable with the specified name; should only be * used while parsing because it ignores ids of variables. * @param name variable name * @return variable */ public Var get(final QNm name) { for(int i = size; i-- > 0;) if(name.eq(vars[i].name)) return vars[i]; return null; } /** Empties this stack. */ public void clear() { Arrays.fill(vars, null); size = 0; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/var/VarUsage.java000066400000000000000000000041221222453003200255130ustar00rootroot00000000000000package org.basex.query.var; import org.basex.query.expr.*; /** * A tri-state encoding the number of usages of a variable. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public enum VarUsage { /** No usages. */ NEVER, /** Exactly one usage. */ ONCE, /** More than one usage. */ MORE_THAN_ONCE; /** * Combines the usages for two alternative branches. * @param other usage count to be combined * @return number of usages for the disjunction of both branches */ public VarUsage max(final VarUsage other) { return compareTo(other) > 0 ? this : other; } /** * Combines the usages for two expressions that are both executed. * @param other usage count to be combined * @return number of usages of both expressions combined */ public VarUsage plus(final VarUsage other) { return this == NEVER ? other : other == NEVER ? this : MORE_THAN_ONCE; } /** * Number of usages of the variable if the code is executed {@code count} times. * @param count number of executions, may be {@code -1} if not known * @return number of usages */ public VarUsage times(final long count) { return count == 0 || this == NEVER ? NEVER : count == 1 ? this : MORE_THAN_ONCE; } /** * Checks how often the given variable is accessed in all of the given expressions. * @param v variable * @param es expressions * @return number of accesses to the variable in all expressions combined */ public static VarUsage sum(final Var v, final Expr... es) { VarUsage all = VarUsage.NEVER; for(final Expr e : es) if((all = all.plus(e.count(v))) == VarUsage.MORE_THAN_ONCE) break; return all; } /** * Checks how often the given variable is used in any of the given expressions. * @param v variable * @param es expressions * @return maximum number of accesses in any given expression */ public static VarUsage maximum(final Var v, final Expr... es) { VarUsage any = VarUsage.NEVER; for(final Expr e : es) if((any = any.max(e.count(v))) == VarUsage.MORE_THAN_ONCE) break; return any; } } basex-7.7.2/basex-core/src/main/java/org/basex/query/var/Variables.java000066400000000000000000000125421222453003200257130ustar00rootroot00000000000000package org.basex.query.var; import java.util.*; import java.util.Map.Entry; import org.basex.data.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.util.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Container of global variables of a module. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class Variables extends ExprInfo implements Iterable { /** The variables. */ public final HashMap vars = new HashMap(); /** * Declares a new static variable. * @param nm variable name * @param t type * @param a annotations * @param e bound expression, possibly {@code null} * @param ext {@code external} flag * @param sctx static context * @param scp variable scope * @param xqdoc current xqdoc cache * @param ii input info * @return static variable reference * @throws QueryException query exception */ public StaticVar declare(final QNm nm, final SeqType t, final Ann a, final Expr e, final boolean ext, final StaticContext sctx, final VarScope scp, final String xqdoc, final InputInfo ii) throws QueryException { final StaticVar var = new StaticVar(sctx, scp, a, nm, t, e, ext, xqdoc, ii); final VarEntry ve = vars.get(nm); if(ve != null) ve.setVar(var); else vars.put(nm, new VarEntry(var)); return var; } /** * Checks if none of the variables contains an updating expression. * @throws QueryException query exception */ public void checkUp() throws QueryException { for(final VarEntry e : vars.values()) e.var.checkUp(); } /** * Checks if all variables were declared and are visible to all their references. * @param ctx query context * @throws QueryException query exception */ public void check(final QueryContext ctx) throws QueryException { for(final Entry e : vars.entrySet()) { final QNm name = e.getKey(); final VarEntry ve = e.getValue(); if(ve.var == null) { if(name.uri().length != 0) throw Err.VARUNDEF.thrw(ve.refs[0].info, ve.refs[0]); ve.setVar(new StaticVar(ctx, name, ve.refs[0].info)); } } } @Override public void plan(final FElem plan) { if(vars.isEmpty()) return; final FElem e = planElem(); for(final VarEntry v : vars.values()) v.var.plan(e); plan.add(e); } @Override public String toString() { final StringBuilder sb = new StringBuilder(); for(final VarEntry v : vars.values()) v.var.fullDesc(sb); return sb.toString(); } /** * Checks if a variable with the given name was already declared. * @param nm variable name * @return result of check */ public boolean declared(final QNm nm) { final VarEntry entry = vars.get(nm); return entry != null && entry.var != null; } /** * returns a new reference to the (possibly not yet declared) variable * with the given name. * @param ii input info * @param nm variable name * @param sctx static context * @return reference * @throws QueryException if the variable is not visible */ public StaticVarRef newRef(final QNm nm, final StaticContext sctx, final InputInfo ii) throws QueryException { final StaticVarRef ref = new StaticVarRef(ii, nm, sctx); final VarEntry e = vars.get(nm), entry = e != null ? e : new VarEntry(null); if(e == null) vars.put(nm, entry); entry.addRef(ref); return ref; } /** * Binds all external variables. * @param ctx query context * @param bindings variable bindings * @throws QueryException query exception */ public void bindExternal(final QueryContext ctx, final HashMap bindings) throws QueryException { for(final Entry e : bindings.entrySet()) { final VarEntry ve = vars.get(e.getKey()); if(ve != null) ve.var.bind(e.getValue(), ctx); } } @Override public Iterator iterator() { final Iterator> iter = vars.entrySet().iterator(); return new Iterator() { @Override public boolean hasNext() { return iter.hasNext(); } @Override public StaticVar next() { return iter.next().getValue().var; } @Override public void remove() { Util.notexpected(); } }; } /** Entry for static variables and their references. */ private class VarEntry { /** The static variable. */ StaticVar var; /** Variable references. */ StaticVarRef[] refs = { }; /** * Constructor. * @param vr variable, possibly {@code null} */ VarEntry(final StaticVar vr) { var = vr; } /** * Sets the variable for existing references. * @param vr variable to set * @throws QueryException if the variable was already declared */ void setVar(final StaticVar vr) throws QueryException { if(var != null) throw Err.VARDUPL.thrw(vr.info, var); var = vr; for(final StaticVarRef ref : refs) ref.init(var); } /** * Adds a reference to this variable. * @param ref reference to add * @throws QueryException query exception */ void addRef(final StaticVarRef ref) throws QueryException { refs = Array.add(refs, ref); if(var != null) ref.init(var); } } }basex-7.7.2/basex-core/src/main/java/org/basex/server/000077500000000000000000000000001222453003200225055ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/server/ClientBlocker.java000066400000000000000000000015061222453003200260720ustar00rootroot00000000000000package org.basex.server; import org.basex.util.hash.*; /** * This class delays blocked clients. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ClientBlocker { /** Temporarily blocked clients. */ private final TokenIntMap blocked = new TokenIntMap(); /** * Registers the client and returns a delay time. * @param client client address * @return number of seconds to wait */ public synchronized int delay(final byte[] client) { int delay = blocked.get(client); delay = delay == -1 ? 1 : Math.min(delay, 1024) * 2; blocked.put(client, delay); return delay; } /** * Resets the login delay after successful login. * @param client client address */ public synchronized void remove(final byte[] client) { blocked.delete(client); } } basex-7.7.2/basex-core/src/main/java/org/basex/server/ClientListener.java000066400000000000000000000360551222453003200263050ustar00rootroot00000000000000package org.basex.server; import static org.basex.core.Text.*; import static org.basex.util.Token.*; import java.io.*; import java.net.*; import java.util.*; import org.basex.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.core.parse.*; import org.basex.io.in.*; import org.basex.io.out.*; import org.basex.query.*; import org.basex.util.*; import org.basex.util.list.*; /** * Server-side client session in the client-server architecture. * * @author BaseX Team 2005-12, BSD License * @author Andreas Weiler * @author Christian Gruen */ public final class ClientListener extends Thread { /** Timer for authentication time out. */ public final Timer auth = new Timer(); /** Timestamp of last interaction. */ public long last; /** Active queries. */ private final HashMap queries = new HashMap(); /** Performance measurement. */ private final Performance perf = new Performance(); /** Database context. */ private final Context context; /** Server reference. */ private final BaseXServer server; /** Socket reference. */ private final Socket socket; /** Socket for events. */ private Socket esocket; /** Output for events. */ private PrintOutput eout; /** Flag for active events. */ private boolean events; /** Input stream. */ private BufferInput in; /** Output stream. */ private PrintOutput out; /** Current command. */ private Command command; /** Query id counter. */ private int id; /** Indicates if the server thread is running. */ private boolean running; /** * Constructor. * @param s socket * @param c database context * @param srv server reference */ public ClientListener(final Socket s, final Context c, final BaseXServer srv) { context = new Context(c, this); socket = s; server = srv; last = System.currentTimeMillis(); setDaemon(true); } @Override public void run() { if(!authenticate()) return; ServerCmd sc; String cmd; try { while(running) { command = null; try { final int b = in.read(); if(b == -1) { // end of stream: exit session quit(); break; } last = System.currentTimeMillis(); perf.time(); sc = ServerCmd.get(b); cmd = null; if(sc == ServerCmd.CREATE) { create(); } else if(sc == ServerCmd.ADD) { add(); } else if(sc == ServerCmd.WATCH) { watch(); } else if(sc == ServerCmd.UNWATCH) { unwatch(); } else if(sc == ServerCmd.REPLACE) { replace(); } else if(sc == ServerCmd.STORE) { store(); } else if(sc != ServerCmd.COMMAND) { query(sc); } else { // database command cmd = new ByteList().add(b).add(in.readBytes()).toString(); } } catch(final IOException ex) { // this exception may be thrown if a session is stopped quit(); break; } if(sc != ServerCmd.COMMAND) continue; // parse input and create command instance try { command = new CommandParser(cmd, context).parseSingle(); log(command, null); } catch(final QueryException ex) { // log invalid command final String msg = ex.getMessage(); log(cmd, null); log(msg, false); // send 0 to mark end of potential result out.write(0); // send {INFO}0 out.writeString(msg); // send 1 to mark error send(false); continue; } // execute command and send {RESULT} boolean ok = true; String info; try { // run command command.execute(context, new EncodingOutput(out)); info = command.info(); } catch(final BaseXException ex) { ok = false; info = ex.getMessage(); if(info.startsWith(INTERRUPTED)) info = TIMEOUT_EXCEEDED; } // send 0 to mark end of result out.write(0); // send info info(info, ok); // stop console if(command instanceof Exit) { command = null; quit(); } } } catch(final IOException ex) { log(ex, false); command = null; quit(); } command = null; } /** * Initializes a session via cram-md5. * @return success flag */ private boolean authenticate() { try { final String ts = Long.toString(System.nanoTime()); final byte[] address = socket.getInetAddress().getAddress(); // send {TIMESTAMP}0 out = PrintOutput.get(socket.getOutputStream()); out.print(ts); send(true); // evaluate login data in = new BufferInput(socket.getInputStream()); // receive {USER}0{PASSWORD}0 final String us = in.readString(); final String pw = in.readString(); context.user = context.users.get(us); running = context.user != null && md5(context.user.password + ts).equals(pw); // write log information if(running) { // send {OK} send(true); context.blocker.remove(address); context.sessions.add(this); } else { if(!us.isEmpty()) log(ACCESS_DENIED, false); // delay users with wrong passwords for(int d = context.blocker.delay(address); d > 0; d--) Performance.sleep(1000); send(false); } } catch(final IOException ex) { if(running) { Util.stack(ex); log(ex, false); running = false; } } server.remove(this); return running; } /** * Quits the authentication. */ public synchronized void quitAuth() { try { socket.close(); log(TIMEOUT_EXCEEDED, false); } catch(final Throwable ex) { log(ex, false); } } /** * Exits the session. */ public synchronized void quit() { if(!running) return; running = false; // wait until running command was stopped if(command != null) { command.stop(); do Performance.sleep(50); while(command != null); } context.sessions.remove(this); try { new Close().run(context); socket.close(); if(events) { esocket.close(); // remove this session from all events in pool for(final Sessions s : context.events.values()) s.remove(this); } } catch(final Throwable ex) { log(ex, false); Util.stack(ex); } } /** * Returns the context of this session. * @return user reference */ public Context context() { return context; } /** * Registers the event socket. * @param s socket * @throws IOException I/O exception */ public synchronized void register(final Socket s) throws IOException { esocket = s; eout = PrintOutput.get(s.getOutputStream()); eout.write(0); eout.flush(); } /** * Sends a notification to the client. * @param name event name * @param msg event message * @throws IOException I/O exception */ public synchronized void notify(final byte[] name, final byte[] msg) throws IOException { last = System.currentTimeMillis(); eout.print(name); eout.write(0); eout.print(msg); eout.write(0); eout.flush(); } /** * Returns the host and port of a client. * @return string representation */ public String address() { return socket.getInetAddress().getHostAddress() + ':' + socket.getPort(); } @Override public String toString() { final StringBuilder sb = new StringBuilder("[").append(address()).append(']'); if(context.data() != null) sb.append(COLS).append(context.data().meta.name); return sb.toString(); } // PRIVATE METHODS ========================================================== /** * Returns error feedback. * @param info error string * @throws IOException I/O exception */ private void error(final String info) throws IOException { info(info, false); } /** * Returns user feedback. * @param info information string * @throws IOException I/O exception */ private void success(final String info) throws IOException { info(info, true); } /** * Returns user feedback. * @param info information string * @param ok success/error flag * @throws IOException I/O exception */ private void info(final String info, final boolean ok) throws IOException { // write feedback to log file log(info, ok); // send {MSG}0 and (0|1) as (success|error) flag out.writeString(info); send(ok); } /** * Creates a database. * @throws IOException I/O exception */ private void create() throws IOException { execute(new CreateDB(in.readString())); } /** * Adds a document to a database. * @throws IOException I/O exception */ private void add() throws IOException { execute(new Add(in.readString())); } /** * Replace a document in a database. * @throws IOException I/O exception */ private void replace() throws IOException { execute(new Replace(in.readString())); } /** * Stores raw data in a database. * @throws IOException I/O exception */ private void store() throws IOException { execute(new Store(in.readString())); } /** * Executes the specified command. * @param cmd command to be executed * @throws IOException I/O exception */ private void execute(final Command cmd) throws IOException { log(cmd + " [...]", null); final DecodingInput di = new DecodingInput(in); try { cmd.setInput(di); cmd.execute(context); success(cmd.info()); } catch(final BaseXException ex) { di.flush(); error(ex.getMessage()); } } /** * Watches an event. * @throws IOException I/O exception */ private void watch() throws IOException { server.initEvents(); // initialize server-based event handling if(!events) { out.writeString(Integer.toString(context.mprop.num(MainProp.EVENTPORT))); out.writeString(Long.toString(getId())); out.flush(); events = true; } final String name = in.readString(); final Sessions s = context.events.get(name); final boolean ok = s != null && !s.contains(this); final String message; if(ok) { s.add(this); message = WATCHING_EVENT_X; } else if(s == null) { message = EVENT_UNKNOWN_X; } else { message = EVENT_WATCHED_X; } info(Util.info(message, name), ok); } /** * Unwatches an event. * @throws IOException I/O exception */ private void unwatch() throws IOException { final String name = in.readString(); final Sessions s = context.events.get(name); final boolean ok = s != null && s.contains(this); final String message; if(ok) { s.remove(this); message = UNWATCHING_EVENT_X; } else if(s == null) { message = EVENT_UNKNOWN_X; } else { message = EVENT_NOT_WATCHED_X; } info(Util.info(message, name), ok); out.flush(); } /** * Processes the query iterator. * @param sc server command * @throws IOException I/O exception */ private void query(final ServerCmd sc) throws IOException { // iterator argument (query or identifier) String arg = in.readString(); String err = null; try { final QueryListener qp; final StringBuilder info = new StringBuilder(); if(sc == ServerCmd.QUERY) { final String query = arg; qp = new QueryListener(query, context); arg = Integer.toString(id++); queries.put(arg, qp); // send {ID}0 out.writeString(arg); // write log file info.append(query); } else { // find query process qp = queries.get(arg); // ID has already been removed if(qp == null) { if(sc != ServerCmd.CLOSE) throw new IOException("Unknown Query ID: " + arg); } else if(sc == ServerCmd.BIND) { final String key = in.readString(); final String val = in.readString(); final String typ = in.readString(); qp.bind(key, val, typ); info.append(key).append('=').append(val); if(!typ.isEmpty()) info.append(" as ").append(typ); } else if(sc == ServerCmd.CONTEXT) { final String val = in.readString(); final String typ = in.readString(); qp.context(val, typ); info.append(val); if(!typ.isEmpty()) info.append(" as ").append(typ); } else if(sc == ServerCmd.RESULTS) { qp.execute(true, out, true, false); } else if(sc == ServerCmd.EXEC) { qp.execute(false, out, true, false); } else if(sc == ServerCmd.FULL) { qp.execute(true, out, true, true); } else if(sc == ServerCmd.INFO) { out.print(qp.info()); } else if(sc == ServerCmd.OPTIONS) { out.print(qp.options()); } else if(sc == ServerCmd.UPDATING) { out.print(Boolean.toString(qp.updating())); } else if(sc == ServerCmd.CLOSE) { queries.remove(arg); } else if(sc == ServerCmd.NEXT) { throw new Exception("Protocol for query iteration is out-of-date."); } // send 0 as end marker out.write(0); } // send 0 as success flag out.write(0); // write log file log(new StringBuilder(sc.toString()).append('['). append(arg).append("] ").append(info), true); } catch(final Throwable ex) { // log exception (static or runtime) err = Util.message(ex); log(sc + "[" + arg + ']', null); log(err, false); queries.remove(arg); } if(err != null) { // send 0 as end marker, 1 as error flag, and {MSG}0 out.write(0); out.write(1); out.writeString(err); } out.flush(); } /** * Sends a success flag to the client (0: true, 1: false). * @param ok success flag * @throws IOException I/O exception */ void send(final boolean ok) throws IOException { out.write(ok ? 0 : 1); out.flush(); } /** * Writes a log message. * @param info message info * @param type message type (true/false/null: OK, ERROR, REQUEST) */ private void log(final Object info, final Object type) { // add evaluation time if any type is specified final String user = context.user != null ? context.user.name : ""; final Log log = context.log; if(log != null) log.write(type != null ? new Object[] { address(), user, type, info, perf } : new Object[] { address(), user, null, info }); } } basex-7.7.2/basex-core/src/main/java/org/basex/server/ClientQuery.java000066400000000000000000000043341222453003200256200ustar00rootroot00000000000000package org.basex.server; import java.io.*; import org.basex.core.*; import org.basex.io.in.*; /** * This class defines all methods for iteratively evaluating queries with the * client/server architecture. All sent data is received by the * {@link ClientListener} and interpreted by the {@link QueryListener}. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class ClientQuery extends Query { /** Client session. */ protected final ClientSession cs; /** Query id. */ protected final String id; /** * Standard constructor. * @param query query to be run * @param session client session * @param os output stream * @throws IOException I/O exception */ public ClientQuery(final String query, final ClientSession session, final OutputStream os) throws IOException { cs = session; id = cs.exec(ServerCmd.QUERY, query, null); out = os; } @Override public String info() throws IOException { return cs.exec(ServerCmd.INFO, id, null); } @Override public String options() throws IOException { return cs.exec(ServerCmd.OPTIONS, id, null); } @Override public boolean updating() throws IOException { return Boolean.parseBoolean(cs.exec(ServerCmd.UPDATING, id, null)); } @Override public void bind(final String n, final Object v, final String t) throws IOException { cache = null; cs.exec(ServerCmd.BIND, id + '\0' + n + '\0' + v + '\0' + (t == null ? "" : t), null); } @Override public void context(final Object v, final String t) throws IOException { cache = null; cs.exec(ServerCmd.CONTEXT, id + '\0' + v + '\0' + (t == null ? "" : t), null); } @Override public String execute() throws IOException { return cs.exec(ServerCmd.EXEC, id, out); } @Override public void close() throws IOException { cs.exec(ServerCmd.CLOSE, id, null); } @Override protected void cache() throws IOException { cs.sout.write(ServerCmd.RESULTS.code); cs.send(id); cs.sout.flush(); final BufferInput bi = new BufferInput(cs.sin); cache(bi); if(!ClientSession.ok(bi)) throw new BaseXException(bi.readString()); } } basex-7.7.2/basex-core/src/main/java/org/basex/server/ClientSession.java000066400000000000000000000234741222453003200261440ustar00rootroot00000000000000package org.basex.server; import java.io.*; import java.net.*; import java.util.*; import org.basex.core.*; import org.basex.core.parse.Commands.*; import org.basex.io.in.*; import org.basex.io.out.*; import org.basex.util.*; /** * This class offers methods to execute database commands via the * client/server architecture. Commands are sent to the server instance over * a socket connection: *

    *
  • A socket instance is created by the constructor.
  • *
  • The {@link #execute} method sends database commands to the server. * All strings are encoded as UTF8 and suffixed by a zero byte.
  • *
  • If the command has been successfully executed, the result string is read.
  • *
  • Next, the command info string is read.
  • *
  • A last byte is next sent to indicate if command execution * was successful (0) or not (1).
  • *
  • {@link #close} closes the session by sending the {@link Cmd#EXIT} * command to the server.
  • *
* * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class ClientSession extends Session { /** Event notifications. */ protected final Map notifiers = Collections.synchronizedMap(new HashMap()); /** Server output (buffered). */ protected final PrintOutput sout; /** Server input. */ protected final InputStream sin; /** Socket reference. */ private final Socket socket; /** Socket host name. */ private final String ehost; /** Socket event reference. */ private Socket esocket; /** * Constructor, specifying login data. * @param context database context * @param user user name * @param pass password * @throws IOException I/O exception */ public ClientSession(final Context context, final String user, final String pass) throws IOException { this(context, user, pass, null); } /** * Constructor, specifying login data and an output stream. * @param context database context * @param user user name * @param pass password * @param output client output; if set to {@code null}, results will * be returned as strings. * @throws IOException I/O exception */ public ClientSession(final Context context, final String user, final String pass, final OutputStream output) throws IOException { this(context.mprop.get(MainProp.HOST), context.mprop.num(MainProp.PORT), user, pass, output); } /** * Constructor, specifying the server host:port combination and login data. * @param host server name * @param port server port * @param user user name * @param pass password * @throws IOException I/O exception */ public ClientSession(final String host, final int port, final String user, final String pass) throws IOException { this(host, port, user, pass, null); } /** * Constructor, specifying the server host:port combination, login data and * an output stream. * @param host server name * @param port server port * @param user user name * @param pass password * @param output client output; if set to {@code null}, results will * be returned as strings. * @throws IOException I/O exception */ public ClientSession(final String host, final int port, final String user, final String pass, final OutputStream output) throws IOException { super(output); ehost = host; socket = new Socket(); try { // limit timeout to five seconds socket.connect(new InetSocketAddress(host, port), 5000); } catch(final IllegalArgumentException ex) { throw new BaseXException(ex); } sin = socket.getInputStream(); // receive timestamp final BufferInput bi = new BufferInput(sin); final String ts = bi.readString(); // send user name and hashed password/timestamp sout = PrintOutput.get(socket.getOutputStream()); send(user); send(Token.md5(Token.md5(pass) + ts)); sout.flush(); // receive success flag if(!ok(bi)) throw new LoginException(); } @Override public void create(final String name, final InputStream input) throws IOException { send(ServerCmd.CREATE, input, name); } @Override public void add(final String path, final InputStream input) throws IOException { send(ServerCmd.ADD, input, path); } @Override public void replace(final String path, final InputStream input) throws IOException { send(ServerCmd.REPLACE, input, path); } @Override public void store(final String path, final InputStream input) throws IOException { send(ServerCmd.STORE, input, path); } @Override public ClientQuery query(final String query) throws IOException { return new ClientQuery(query, this, out); } @Override public synchronized void close() throws IOException { if(esocket != null) esocket.close(); socket.close(); } @Override protected void execute(final String cmd, final OutputStream os) throws IOException { send(cmd); sout.flush(); receive(os); } @Override protected void execute(final Command cmd, final OutputStream os) throws IOException { execute(cmd.toString(), os); } /** * Watches an event. * @param name event name * @param notifier event notification * @throws IOException I/O exception */ public void watch(final String name, final EventNotifier notifier) throws IOException { sout.write(ServerCmd.WATCH.code); if(esocket == null) { sout.flush(); final BufferInput bi = new BufferInput(sin); final int eport = Integer.parseInt(bi.readString()); // initialize event socket esocket = new Socket(); esocket.connect(new InetSocketAddress(ehost, eport), 5000); final OutputStream so = esocket.getOutputStream(); so.write(bi.readBytes()); so.write(0); so.flush(); final InputStream is = esocket.getInputStream(); is.read(); listen(is); } send(name); sout.flush(); receive(null); notifiers.put(name, notifier); } /** * Unwatches an event. * @param name event name * @throws IOException I/O exception */ public void unwatch(final String name) throws IOException { sout.write(ServerCmd.UNWATCH.code); send(name); sout.flush(); receive(null); notifiers.remove(name); } /** * Starts the listener thread. * @param in input stream */ private void listen(final InputStream in) { final BufferInput bi = new BufferInput(in); new Thread() { @Override public void run() { try { while(true) { final EventNotifier n = notifiers.get(bi.readString()); final String l = bi.readString(); if(n != null) n.notify(l); } } catch(final IOException ex) { // listener did not receive any more input } } }.start(); } /** * Sends the specified stream to the server. * @param input input stream * @throws IOException I/O exception */ private void send(final InputStream input) throws IOException { final EncodingOutput eo = new EncodingOutput(sout); for(int b; (b = input.read()) != -1;) eo.write(b); sout.write(0); sout.flush(); receive(null); } /** * Receives the info string. * @param os output stream to send result to. If {@code null}, no result * will be requested * @throws IOException I/O exception */ private void receive(final OutputStream os) throws IOException { final BufferInput bi = new BufferInput(sin); if(os != null) receive(bi, os); info = bi.readString(); if(!ok(bi)) throw new BaseXException(info); } /** * Checks the next success flag. * @param bi buffer input * @return value of check * @throws IOException I/O exception */ protected static boolean ok(final BufferInput bi) throws IOException { return bi.read() == 0; } /** * Sends the specified command, string arguments and input. * @param cmd command * @param input input stream * @param strings string arguments * @throws IOException I/O exception */ protected void send(final ServerCmd cmd, final InputStream input, final String... strings) throws IOException { sout.write(cmd.code); for(final String s : strings) send(s); send(input); } /** * Retrieves data from the server. * @param bi buffered server input * @param os output stream * @throws IOException I/O exception */ protected static void receive(final BufferInput bi, final OutputStream os) throws IOException { final DecodingInput di = new DecodingInput(bi); for(int b; (b = di.read()) != -1;) os.write(b); } /** * Sends a string to the server. * @param s string to be sent * @throws IOException I/O exception */ protected void send(final String s) throws IOException { sout.write(Token.token(s)); sout.write(0); } /** * Executes a command and sends the result to the specified output stream. * @param cmd server command * @param arg argument * @param os target output stream * @return string * @throws IOException I/O exception */ protected String exec(final ServerCmd cmd, final String arg, final OutputStream os) throws IOException { final OutputStream o = os == null ? new ArrayOutput() : os; sout.write(cmd.code); send(arg); sout.flush(); final BufferInput bi = new BufferInput(sin); ClientSession.receive(bi, o); if(!ClientSession.ok(bi)) throw new BaseXException(bi.readString()); return o.toString(); } @Override public String toString() { return ehost + ':' + socket.getPort(); } } basex-7.7.2/basex-core/src/main/java/org/basex/server/EventNotifier.java000066400000000000000000000005001222453003200261240ustar00rootroot00000000000000package org.basex.server; /** * Notification interface for handling database events. * * @author BaseX Team 2005-12, BSD License * @author Roman Raedle */ public interface EventNotifier { /** * Invoked when a database event was fired. * @param value event string */ void notify(final String value); } basex-7.7.2/basex-core/src/main/java/org/basex/server/LocalQuery.java000066400000000000000000000034321222453003200254320ustar00rootroot00000000000000package org.basex.server; import java.io.*; import org.basex.core.*; import org.basex.io.in.*; import org.basex.io.out.*; /** * This class defines all methods for iteratively evaluating queries locally. * All data is interpreted by the {@link QueryListener}. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class LocalQuery extends Query { /** Active query listener. */ private final QueryListener ql; /** * Constructor. Query output will be written to the provided output stream. * All methods will return {@code null}. * @param q query string * @param ctx database context * @param o output stream to write query output */ protected LocalQuery(final String q, final Context ctx, final OutputStream o) { ql = new QueryListener(q, ctx); out = o; } @Override public void bind(final String n, final Object v, final String t) throws IOException { cache = null; ql.bind(n, v, t); } @Override public void context(final Object v, final String t) throws IOException { cache = null; ql.context(v, t); } @Override protected void cache() throws IOException { final ArrayOutput ao = new ArrayOutput(); ql.execute(true, ao, true, false); cache(new ArrayInput(ao.toArray())); } @Override public String execute() throws IOException { final OutputStream os = out == null ? new ArrayOutput() : out; ql.execute(false, os, false, false); return out == null ? os.toString() : null; } @Override public String info() throws IOException { return ql.info(); } @Override public String options() throws IOException { return ql.options(); } @Override public boolean updating() throws IOException { return ql.updating(); } @Override public void close() { } } basex-7.7.2/basex-core/src/main/java/org/basex/server/LocalSession.java000066400000000000000000000064471222453003200257610ustar00rootroot00000000000000package org.basex.server; import java.io.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.core.parse.*; import org.basex.query.*; import org.basex.util.*; /** * This class offers methods to locally execute database commands. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class LocalSession extends Session { /** Database context. */ protected final Context ctx; /** * Default constructor. * @param context context */ public LocalSession(final Context context) { this(context, null); } /** * Constructor, specifying login data. * @param context context * @param user user name * @param pass password * @throws LoginException login exception */ public LocalSession(final Context context, final String user, final String pass) throws LoginException { this(context, user, pass, null); } /** * Constructor, specifying login data and an output stream. * @param context context * @param user user name * @param pass password * @param output output stream * @throws LoginException login exception */ public LocalSession(final Context context, final String user, final String pass, final OutputStream output) throws LoginException { this(context, output); ctx.user = ctx.users.get(user); if(ctx.user == null || !ctx.user.password.equals(Token.md5(pass))) throw new LoginException(); } /** * Constructor, specifying an output stream. * @param context context * @param output output stream */ public LocalSession(final Context context, final OutputStream output) { super(output); ctx = new Context(context, null); ctx.user = context.user; } @Override public void create(final String name, final InputStream input) throws IOException { execute(new CreateDB(name), input); } @Override public void add(final String path, final InputStream input) throws IOException { execute(new Add(path), input); } @Override public void replace(final String path, final InputStream input) throws IOException { execute(new Replace(path), input); } @Override public void store(final String path, final InputStream input) throws IOException { execute(new Store(path), input); } /** * Executes a command, passing the specified input. * @param cmd command * @param input input stream * @throws BaseXException database exception */ private void execute(final Command cmd, final InputStream input) throws BaseXException { cmd.setInput(input); cmd.execute(ctx); info = cmd.info(); } @Override public LocalQuery query(final String query) { return new LocalQuery(query, ctx, out); } @Override public synchronized void close() { new Close().run(ctx); } @Override protected void execute(final String str, final OutputStream os) throws BaseXException { try { execute(new CommandParser(str, ctx).parseSingle(), os); } catch(final QueryException ex) { throw new BaseXException(ex); } } @Override protected void execute(final Command cmd, final OutputStream os) throws BaseXException { cmd.execute(ctx, os); info = cmd.info(); } } basex-7.7.2/basex-core/src/main/java/org/basex/server/Log.java000066400000000000000000000076221222453003200241000ustar00rootroot00000000000000package org.basex.server; import static org.basex.core.Text.*; import static org.basex.util.Token.*; import java.io.*; import java.util.*; import org.basex.core.*; import org.basex.io.*; import org.basex.util.*; /** * This class writes daily log files to disk. * The log format has been updated in Version 7.4; it now has the following columns: *
    *
  • Time: timestamp (format: xs:time)
  • *
  • Address: host name and port of the requesting client
  • *
  • User: user name
  • *
  • Type: Type of logging message: REQUEST, OK or ERROR
  • *
  • Info: Logging message
  • *
  • Performance: Measured time in milliseconds
  • *
* * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Log { /** SERVER string. */ public static final String SERVER = "SERVER"; /** ERROR string. */ public static final String ERROR = "ERROR"; /** REQUEST string. */ public static final String REQUEST = "REQUEST"; /** Main properties. */ private final MainProp mprop; /** Start date of log. */ private String start; /** Output stream. */ private FileOutputStream fos; /** * Constructor. * @param ctx database context */ public Log(final Context ctx) { mprop = ctx.mprop; } /** * Writes an error to the log file. * @param th throwable */ public synchronized void writeError(final Throwable th) { writeServer(ERROR, Util.message(th)); } /** * Writes a server entry to the log file. * @param str strings to be written */ public synchronized void writeServer(final Object... str) { final Object[] tmp = new Object[str.length + 2]; tmp[0] = SERVER; tmp[1] = Text.ADMIN; System.arraycopy(str, 0, tmp, 2, str.length); write(tmp); } /** * Writes an entry to the log file. * @param str strings to be written */ public synchronized void write(final Object... str) { if(!mprop.is(MainProp.LOG)) { close(); return; } // initializes the output stream and returns the current date final Date date = new Date(); try { // check if day has changed final String nstart = DateTime.format(date, DateTime.DATE); if(fos != null && !start.equals(nstart)) close(); // create new log file if(fos == null) { final IOFile dir = dir(); dir.md(); fos = new FileOutputStream(new IOFile(dir, nstart + IO.LOGSUFFIX).file(), true); start = nstart; } // construct log text final int ml = mprop.num(MainProp.LOGMSGMAXLEN); final TokenBuilder tb = new TokenBuilder(DateTime.format(date, DateTime.TIME)); for(final Object s : str) { tb.add('\t'); String st; if(s == null) st = REQUEST; else if(s instanceof Boolean) st = (Boolean) s ? OK : ERROR; else if(s instanceof Throwable) st = Util.message((Throwable) s); else st = s.toString(); tb.add(chop(token(st.replaceAll("\\s+", " ").trim()), ml)); } tb.add(Prop.NL); // write and flush text fos.write(tb.finish()); fos.flush(); } catch(final IOException ex) { Util.stack(ex); } } /** * Closes the log file. */ public synchronized void close() { if(fos == null) return; try { fos.close(); fos = null; } catch(final IOException ex) { Util.stack(ex); } } /** * Returns a reference to the log directory. * @return log directory */ public synchronized IOFile dir() { // log suffix, plural return mprop.dbpath(IO.LOGSUFFIX + 's'); } /** * Returns all log files. * @return log directory */ public synchronized IOFile[] files() { return dir().children(".*\\" + IO.LOGSUFFIX); } } basex-7.7.2/basex-core/src/main/java/org/basex/server/LoginException.java000066400000000000000000000012451222453003200263010ustar00rootroot00000000000000package org.basex.server; import static org.basex.core.Text.*; import java.io.*; import org.basex.util.*; /** * This exception is thrown if a wrong user/password combination was specified. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class LoginException extends IOException { /** * Constructor. */ public LoginException() { super(ACCESS_DENIED); } /** * Constructs an exception with the specified message and extension. * @param s message * @param e message extension */ public LoginException(final String s, final Object... e) { super(Util.info(s, e)); } } basex-7.7.2/basex-core/src/main/java/org/basex/server/Query.java000066400000000000000000000104641222453003200244620ustar00rootroot00000000000000package org.basex.server; import java.io.*; import org.basex.io.in.*; import org.basex.query.value.type.*; import org.basex.util.*; import org.basex.util.list.*; /** *

This class defines methods for executing queries. * It is implemented by {@link ClientQuery}.

*

Results are either returned as string or serialized to the output * stream that has been specified via the constructor or via * {@link Session#setOutputStream(OutputStream)}.

* * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class Query { /** Client output stream. */ protected OutputStream out; /** Cached results. */ protected TokenList cache; /** Cached result types. */ private ByteList types; /** Cache pointer. */ private int pos; /** * Binds a value to an external variable. * @param n name of variable * @param v value to be bound * @throws IOException I/O exception */ public final void bind(final String n, final Object v) throws IOException { bind(n, v, ""); } /** * Binds a value with an optional type to an external variable. * @param n name of variable * @param v value to be bound * @param t data type (may be {@code null}) * @throws IOException I/O exception */ public abstract void bind(final String n, final Object v, final String t) throws IOException; /** * Binds a value to the context item. * @param v value to be bound * @throws IOException I/O exception */ public final void context(final Object v) throws IOException { context(v, ""); } /** * Binds a value with an optional type to an external variable. * @param v value to be bound * @param t data type (may be {@code null}) * @throws IOException I/O exception */ public abstract void context(final Object v, final String t) throws IOException; /** * Returns {@code true} if more items are available. * @return result of check * @throws IOException I/O exception */ public boolean more() throws IOException { if(cache == null) cache(); if(pos < cache.size()) return true; cache = null; types = null; return false; } /** * Caches the query result. * @throws IOException I/O exception */ protected abstract void cache() throws IOException; /** * Returns the next item of the query. * @return item string or {@code null}. * @throws IOException I/O exception */ public final String next() throws IOException { if(!more()) return null; final byte[] item = cache.get(pos); cache.set(pos++, null); if(out == null) return Token.string(item); out.write(item); return null; } /** * Returns the current XQuery type (must be called after {@link #next()}. * @return item type */ public final Type type() { return Type.ID.getType(types.get(pos - 1)); } /** * Caches the incoming input. * @param is input stream * @throws IOException I/O exception */ protected void cache(final InputStream is) throws IOException { cache = new TokenList(); types = new ByteList(); final ByteList bl = new ByteList(); for(int t; (t = is.read()) > 0;) { final DecodingInput di = new DecodingInput(is); for(int b; (b = di.read()) != -1;) bl.add(b); cache.add(bl.toArray()); types.add(t); bl.reset(); } pos = 0; } /** * Returns the complete result of the query. * @return item string or {@code null}. * @throws IOException I/O exception */ public abstract String execute() throws IOException; /** * Returns the serialization options. * @return serialization options. * @throws IOException I/O exception */ public abstract String options() throws IOException; /** * Returns {@code true} if the query may perform updates. * @return updating flag * @throws IOException I/O exception */ public abstract boolean updating() throws IOException; /** * Returns query info. * @return query info * @throws IOException I/O exception */ public abstract String info() throws IOException; /** * Closes the query. * @throws IOException I/O exception */ public abstract void close() throws IOException; } basex-7.7.2/basex-core/src/main/java/org/basex/server/QueryListener.java000066400000000000000000000125531222453003200261710ustar00rootroot00000000000000package org.basex.server; import static org.basex.core.Text.*; import static org.basex.io.serial.SerializerProp.*; import static org.basex.query.util.Err.*; import java.io.*; import org.basex.core.*; import org.basex.io.out.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * Server-side query session in the client-server architecture. * * @author BaseX Team 2005-12, BSD License * @author Andreas Weiler * @author Christian Gruen */ final class QueryListener extends Proc { /** Performance. */ final Performance perf = new Performance(); /** Query info. */ private final QueryInfo qi = new QueryInfo(); /** Query string. */ private final String query; /** Database context. */ private final Context ctx; /** Query processor. */ private QueryProcessor qp; /** Serialization options. */ private SerializerProp options; /** Parsing flag. */ private boolean parsed; /** Query info. */ private String info = ""; /** * Constructor. * @param qu query string * @param c database context */ QueryListener(final String qu, final Context c) { query = qu; ctx = c; } /** * Binds a value to a global variable. * @param n name of variable * @param v value to be bound * @param t type * @throws IOException query exception */ void bind(final String n, final Object v, final String t) throws IOException { try { init().bind(n, v, t); } catch(final QueryException ex) { throw new BaseXException(ex); } } /** * Binds a value to the context item. * @param v value to be bound * @param t type * @throws IOException query exception */ void context(final Object v, final String t) throws IOException { try { init().context(v, t); } catch(final QueryException ex) { throw new BaseXException(ex); } } /** * Returns the query info. * @return query info */ String info() { return info; } /** * Returns the serialization options. * @return serialization options * @throws IOException I/O Exception */ String options() throws IOException { if(options == null) options = parse().ctx.serParams(false); return options.toString(); } /** * Returns {@code true} if the query may perform updates. * @return updating flag * @throws IOException I/O Exception */ boolean updating() throws IOException { return parse().updating; } /** * Executes the query. * @param iter iterative evaluation * @param out output stream * @param enc encode stream * @param full return full type information * @throws IOException I/O Exception */ void execute(final boolean iter, final OutputStream out, final boolean enc, final boolean full) throws IOException { try { try { // parses the query and registers the process ctx.register(parse()); // create serializer qp.compile(); qi.cmpl = perf.time(); final Iter ir = qp.iter(); qi.evlt = perf.time(); options(); final boolean wrap = !options.get(S_WRAP_PREFIX).isEmpty(); // iterate through results final PrintOutput po = PrintOutput.get(enc ? new EncodingOutput(out) : out); if(iter && wrap) po.write(1); final Serializer ser = Serializer.get(po, full ? null : options); int c = 0; for(Item it; (it = ir.next()) != null;) { if(iter && !wrap) { if(full) { po.write(it.xdmInfo()); } else { po.write(it.typeId().asByte()); } ser.reset(); } ser.serialize(it); if(iter && !wrap) { po.flush(); out.write(0); } c++; } ser.close(); if(iter && wrap) out.write(0); qi.srlz = perf.time(); // generate query info info = qi.toString(qp, po, c, ctx.prop.is(Prop.QUERYINFO)); } catch(final QueryException ex) { throw new BaseXException(ex); } catch(final StackOverflowError ex) { Util.debug(ex); throw new BaseXException(BASX_STACKOVERFLOW.desc); } catch(final ProcException ex) { throw new BaseXException(TIMEOUT_EXCEEDED); } } finally { // close processor and unregisters the process if(qp != null) { qp.close(); if(parsed) { ctx.unregister(qp); parsed = false; } qp = null; } } } /** * Initializes the query. * @return query processor * @throws IOException I/O Exception */ private QueryProcessor parse() throws IOException { if(!parsed) { try { perf.time(); init().parse(); qi.pars = perf.time(); parsed = true; } catch(final QueryException ex) { throw new BaseXException(ex); } } return qp; } /** * Returns an instance of the query processor. * @return query processor */ private QueryProcessor init() { if(parsed || qp == null) { qp = new QueryProcessor(query, ctx); parsed = false; } return qp; } } basex-7.7.2/basex-core/src/main/java/org/basex/server/ServerCmd.java000066400000000000000000000040361222453003200252450ustar00rootroot00000000000000package org.basex.server; /** * This class defines the available command-line commands. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public enum ServerCmd { /** Code for creating a query process: {query}0. */ QUERY(0), /** Code for iterating results (obsolete). */ NEXT(1), /** Code for closing the query: {id}0. */ CLOSE(2), /** Code for binding an external query variable: {id}0{name}0{val}0{type}0. */ BIND(3), /** Code for executing the query in an iterative manner: {id}0. */ RESULTS(4), /** Code for executing the query: {id}0. */ EXEC(5), /** Code for showing the query info: {id}0. */ INFO(6), /** Code for showing the serializations options: {id}0. */ OPTIONS(7), /** Code for creating a database: {name}0{input}0. */ CREATE(8), /** Code for adding a document to a database: {path}0{input}0. */ ADD(9), /** Code for watching an event: {name}0. */ WATCH(10), /** Code for unwatching an event: {name}0. */ UNWATCH(11), /** Code for replacing a document in a database: {path}0{input}0. */ REPLACE(12), /** Code for storing raw data in a database: {path}0{input}0. */ STORE(13), /** Code for binding a context item: {id}0{val}0{type}0. */ CONTEXT(14), /** Code for returning the update flag: {id}0. */ UPDATING(30), /** Code for executing a query and returning all information relevant for XQJ: {id}0. */ FULL(31), /** Code for running a database command: {path}0{input}0. */ COMMAND(-1); /** Control code (soon obsolete). */ public final int code; /** * Constructor. * @param c control code */ ServerCmd(final int c) { code = c; } /** * Returns the server command for the specified control byte * (soon obsolete). * @param b control byte * @return server command */ static ServerCmd get(final int b) { for(final ServerCmd s : values()) if(s.code == b) return s; // current default for unknown codes: database command. return COMMAND; } } basex-7.7.2/basex-core/src/main/java/org/basex/server/Session.java000066400000000000000000000111761222453003200250010ustar00rootroot00000000000000package org.basex.server; import java.io.*; import org.basex.core.*; import org.basex.io.out.*; /** *

This class defines methods for evaluating commands, either locally or * via the client/server architecture.

* *

The results of database commands are returned as strings. If an output * stream is specified in the constructor or with * {@link #setOutputStream(OutputStream)}, results are instead serialized * to that stream. * The class is implemented by the {@link ClientSession} and * {@link LocalSession} classes.

* * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class Session { /** Client output stream. */ protected OutputStream out; /** Command info. */ String info; /** * Executes a {@link Command} and returns the result as string or serializes * it to the specified output stream. * @param command command to be executed * @return result, or {@code null} reference * @throws IOException I/O exception */ public final String execute(final Command command) throws IOException { final ArrayOutput ao = out == null ? new ArrayOutput() : null; execute(command, ao != null ? ao : out); return ao != null ? ao.toString() : null; } /** * Executes a command and returns the result as string or serializes * it to the specified output stream. * @param command command to be parsed * @return result, or {@code null} reference * @throws IOException I/O exception */ public final String execute(final String command) throws IOException { final ArrayOutput ao = out == null ? new ArrayOutput() : null; execute(command, ao != null ? ao : out); return ao != null ? ao.toString() : null; } /** * Returns a query object for the specified query string. * @param query query string * @return query * @throws IOException I/O exception */ public abstract Query query(final String query) throws IOException; /** * Creates a database. * @param name name of database * @param input xml input * @throws IOException I/O exception */ public abstract void create(final String name, final InputStream input) throws IOException; /** * Adds a document to the opened database. * @param path target path * @param input xml input * @throws IOException I/O exception */ public abstract void add(final String path, final InputStream input) throws IOException; /** * Replaces a document in an open database. * @param path document(s) to replace * @param input new content * @throws IOException I/O exception */ public abstract void replace(final String path, final InputStream input) throws IOException; /** * Stores raw data in an open database. * @param path target path * @param input binary input * @throws IOException I/O exception */ public abstract void store(final String path, final InputStream input) throws IOException; /** * Returns command info as a string, regardless of whether an output stream * was specified. * @return command info */ public final String info() { return info; } /** * Specifies an output stream. The output stream can be invalidated by * passing on {@code null} as argument. * @param output client output stream */ public final void setOutputStream(final OutputStream output) { out = output; } /** * Returns the assigned output stream. * @return client output stream */ public OutputStream getOutputStream() { return out; } /** * Closes the session. * @throws IOException I/O exception */ public abstract void close() throws IOException; // PROTECTED METHODS ======================================================== /** * Constructor. * @param output client output stream; if set to {@code null}, all * results will be returned as strings */ Session(final OutputStream output) { out = output; } /** * Executes a command and prints the result to the specified output stream. * @param cmd command to be parsed * @param os output stream * @throws IOException I/O exception */ protected abstract void execute(final String cmd, final OutputStream os) throws IOException; /** * Executes a command and prints the result to the specified output stream. * @param cmd command to be executed * @param os output stream * @throws IOException I/O exception */ protected abstract void execute(final Command cmd, final OutputStream os) throws IOException; } basex-7.7.2/basex-core/src/main/java/org/basex/server/Sessions.java000066400000000000000000000016041222453003200251570ustar00rootroot00000000000000package org.basex.server; import static org.basex.core.Text.*; import java.util.concurrent.*; import org.basex.util.*; import org.basex.util.list.*; /** * This class organizes all currently opened database sessions. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Sessions extends CopyOnWriteArrayList { /** * Returns information about the currently opened sessions. * @return data reference */ public synchronized String info() { final TokenBuilder tb = new TokenBuilder(); tb.addExt(SESSIONS_X, size()).add(size() != 0 ? COL : DOT); final StringList sl = new StringList(); for(final ClientListener sp : this) { sl.add(sp.context().user.name + ' ' + sp); } for(final String sp : sl.sort(true)) tb.add(NL).add(LI).add(sp); return tb.toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/server/package.html000066400000000000000000000000511222453003200247620ustar00rootroot00000000000000 Server implementation. basex-7.7.2/basex-core/src/main/java/org/basex/util/000077500000000000000000000000001222453003200221545ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/util/Args.java000066400000000000000000000067231222453003200237230ustar00rootroot00000000000000package org.basex.util; import java.util.*; import org.basex.core.*; /** * This class parses command-line arguments. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Args { /** Calling object. */ private final Object obj; /** Program header. */ private final String header; /** Usage info. */ private final String usage; /** Command-line arguments. */ private final String[] args; /** Dash flag. */ private boolean dash; /** Position in current argument. */ private int pos; /** Current argument. */ private int arg; /** * Default constructor. * @param a arguments * @param o calling object * @param u usage info * @param h header */ public Args(final String[] a, final Object o, final String u, final String h) { args = a; usage = u; obj = o; header = h; } /** * Checks if more arguments are available. * @return result of check */ public boolean more() { // parse all arguments while(arg < args.length) { // analyze current argument final String a = args[arg]; if(pos == 0) { // start from first character dash = false; // find first relevant character while(pos < a.length()) { final char ch = a.charAt(pos); if(ch == '-') { // treat input as flag dash = true; } else if(ch != ' ') { // ignore spaces return true; } pos++; } // treat input as string pos = 0; dash = false; return true; } else if(pos < a.length()) { // check next character return true; } arg++; pos = 0; } // all arguments have been parsed return false; } /** * Checks if the current argument starts with a dash * (i.e., introduces any flags). * @return result of check */ public boolean dash() { return dash; } /** * Returns the next flag. * @return next flag */ public char next() { return arg < args.length && pos < args[arg].length() ? args[arg].charAt(pos++) : 0; } /** * Returns the next string argument. * @return string */ public String string() { while(arg < args.length) { final String a = args[arg++]; int p = pos; pos = 0; if(p == a.length()) continue; final StringBuilder sb = new StringBuilder(); while(p < a.length()) sb.append(a.charAt(p++)); final String str = sb.toString(); return str.equals("-") ? new Scanner(System.in).useDelimiter("\0").next() : str; } return ""; } /** * Returns the next positive numeric argument. * @return positive integer * @throws BaseXException database exception */ public int number() throws BaseXException { final int i = Token.toInt(string()); if(i < 0) usage(); return i; } /** * Throws an exception with the command usage info. * @throws BaseXException database exception */ public void usage() throws BaseXException { throw new BaseXException(header + "Usage: " + Util.name(obj).toLowerCase(Locale.ENGLISH) + usage); } @Override public String toString() { final StringBuilder sb = new StringBuilder(); for(final String s : args) sb.append(s).append(' '); return sb.toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/Array.java000066400000000000000000000156711222453003200241070ustar00rootroot00000000000000package org.basex.util; import java.util.*; import org.basex.util.list.*; /** * This class provides convenience methods for handling arrays * and serves as an extension to the {@link Arrays} class of Java. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Array { /** Initial default size for new arrays. */ public static final int CAPACITY = 1 << 3; /** Default factor for resizing dynamic arrays. */ public static final double RESIZE = 1.5; /** Private constructor. */ private Array() { } /** * Copies the specified array. * @param a array to be copied * @param s new array size * @return new array */ public static byte[][] copyOf(final byte[][] a, final int s) { final byte[][] tmp = new byte[s][]; System.arraycopy(a, 0, tmp, 0, Math.min(s, a.length)); return tmp; } /** * Copies the specified array. * @param a array to be copied * @param s new array size * @return new array */ public static int[][] copyOf(final int[][] a, final int s) { final int[][] tmp = new int[s][]; System.arraycopy(a, 0, tmp, 0, Math.min(s, a.length)); return tmp; } /** * Copies the specified array. * @param a array to be copied * @param s new array size * @return new array */ public static String[] copyOf(final String[] a, final int s) { final String[] tmp = new String[s]; System.arraycopy(a, 0, tmp, 0, Math.min(s, a.length)); return tmp; } /** * Adds an entry to the end of an array and returns the new array. * @param ar array to be resized * @param e entry to be added * @param array type * @return array */ public static T[] add(final T[] ar, final T e) { final int s = ar.length; final T[] t = Arrays.copyOf(ar, s + 1); t[s] = e; return t; } /** * Adds an entry to the end of an array and returns the new array. * @param ar array to be resized * @param e entry to be added * @return array */ public static int[] add(final int[] ar, final int e) { final int s = ar.length; final int[] t = Arrays.copyOf(ar, s + 1); t[s] = e; return t; } /** * Moves entries inside an array. * @param ar array * @param pos position * @param off move offset * @param l length */ public static void move(final Object ar, final int pos, final int off, final int l) { System.arraycopy(ar, pos, ar, pos + off, l); } /** * Copies entries from one array to another. * @param object type * @param source source array * @param target target array * @return object */ public static T[] copy(final Object[] source, final T[] target) { System.arraycopy(source, 0, target, 0, source.length); return target; } /** * Removes an array entry at the specified position. * @param ar array to be resized * @param p position * @param array type * @return array */ public static T[] delete(final T[] ar, final int p) { final int s = ar.length - 1; move(ar, p + 1, -1, s - p); return Arrays.copyOf(ar, s); } /** * Sorts the specified tokens and returns an integer array * with offsets to the sorted tokens. * @param vals values to sort by * @param num numeric sort * @param asc ascending * @return array containing the order */ public static int[] createOrder(final byte[][] vals, final boolean num, final boolean asc) { final IntList il = number(vals.length); il.sort(vals, num, asc); return il.toArray(); } /** * Sorts the specified doubles and returns an integer array * with offsets to the sorted doubles. * @param vals values to sort by * @param asc ascending * @return array containing the order */ public static int[] createOrder(final double[] vals, final boolean asc) { final IntList il = number(vals.length); il.sort(vals, asc); return il.toArray(); } /** * Sorts the specified integers and returns an integer array * with offsets to the sorted integers. * @param vals values to sort by * @param asc ascending * @return array containing the order */ public static int[] createOrder(final int[] vals, final boolean asc) { final IntList il = number(vals.length); il.sort(vals, asc); return il.toArray(); } /** * Returns an integer list with a number list. * @param l array size * @return number list */ private static IntList number(final int l) { final int[] tmp = new int[l]; for(int i = 0; i < l; ++i) tmp[i] = i; return new IntList(tmp); } /** * Reverses the order of the elements in the given array. * @param arr array */ public static void reverse(final byte[] arr) { reverse(arr, 0, arr.length); } /** * Reverses the order of all elements in the given interval. * @param arr array * @param pos position of first element of the interval * @param len length of the interval */ private static void reverse(final byte[] arr, final int pos, final int len) { for(int l = pos, r = pos + len - 1; l < r; l++, r--) { final byte tmp = arr[l]; arr[l] = arr[r]; arr[r] = tmp; } } /** * Reverses the order of all elements in the given interval. * @param arr array * @param pos position of first element of the interval * @param len length of the interval */ public static void reverse(final Object[] arr, final int pos, final int len) { for(int l = pos, r = pos + len - 1; l < r; l++, r--) { final Object tmp = arr[l]; arr[l] = arr[r]; arr[r] = tmp; } } /** * Returns a value for a new array size, which will always be larger than * the specified value. * @param old old size * @return resulting size */ public static int newSize(final int old) { return newSize(old, RESIZE); } /** * Returns a value for a new array size, which will always be larger than * the specified value. * @param old old size * @param factor resize factor; must be larger than or equal to 1 * @return resulting size */ public static int newSize(final int old, final double factor) { return (int) (old * factor) + 1; } /** * Swaps two entries of the given int array. * @param arr array * @param a first position * @param b second position */ public static void swap(final int[] arr, final int a, final int b) { final int c = arr[a]; arr[a] = arr[b]; arr[b] = c; } /** * Swaps arr[a .. (a+n-1)] with arr[b .. (b+n-1)]. * @param arr order array * @param a first offset * @param b second offset * @param n number of values */ public static void swap(final int[] arr, final int a, final int b, final int n) { for(int i = 0; i < n; ++i) swap(arr, a + i, b + i); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ArrayIterator.java000066400000000000000000000023541222453003200256130ustar00rootroot00000000000000package org.basex.util; import java.util.*; /** * This class is used to iterate through objects of an array. * @param generic object type * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class ArrayIterator implements Iterator, Iterable { /** Array. */ private final Object[] a; /** Index + 1 of last object to return. */ private final int e; /** Current index. */ private int s; /** * Constructor. * @param array array to iterate through * @param end index + 1 of last object to return */ public ArrayIterator(final Object[] array, final int end) { this(array, 0, end); } /** * Constructor. * @param array array to iterate through * @param start index of first object to return * @param end index + 1 of last object to return */ public ArrayIterator(final Object[] array, final int start, final int end) { a = array; s = start; e = end; } @Override public Iterator iterator() { return this; } @Override public boolean hasNext() { return s < e; } @Override @SuppressWarnings("unchecked") public E next() { return (E) a[s++]; } @Override public void remove() { Util.notexpected(); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/Atts.java000066400000000000000000000057351222453003200237440ustar00rootroot00000000000000package org.basex.util; import org.basex.util.list.*; /** * This is a simple container for attributes (name/value pairs). * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Atts extends ElementList { /** Name array. */ private byte[][] nm = new byte[1][]; /** Value array. */ private byte[][] vl = new byte[1][]; /** * Default constructor. */ public Atts() { nm = new byte[1][]; vl = new byte[1][]; } /** * Constructor, specifying an initial entry. * @param name name to be added * @param value value to be added */ public Atts(final byte[] name, final byte[] value) { nm = new byte[][] { name }; vl = new byte[][] { value }; size = 1; } /** * Adds the next name/value pair. * @param name name to be added * @param value value to be added * @return self reference */ public Atts add(final byte[] name, final byte[] value) { if(size == nm.length) { final int s = Array.newSize(size); nm = Array.copyOf(nm, s); vl = Array.copyOf(vl, s); } nm[size] = name; vl[size++] = value; return this; } /** * Deletes the specified entry. * @param i entry offset */ public void delete(final int i) { Array.move(nm, i + 1, -1, --size - i); Array.move(vl, i + 1, -1, size - i); } /** * Checks if the specified name is found. * @param name name to be found * @return result of check */ public boolean contains(final byte[] name) { return get(name) != -1; } /** * Returns the offset to the specified name. * @param name name to be found * @return offset or -1 */ public int get(final byte[] name) { for(int i = 0; i < size; ++i) if(Token.eq(nm[i], name)) return i; return -1; } /** * Returns the name at the specified index position. * @param i index * @return name */ public byte[] name(final int i) { return nm[i]; } /** * Returns the value at the specified index position. * @param i index * @return value */ public byte[] value(final int i) { return vl[i]; } /** * Returns the value for the specified name, or {@code null}. * @param name name to be found * @return offset or -1 */ public byte[] value(final byte[] name) { final int i = get(name); return i == -1 ? null : vl[i]; } /** * Clears the container. * @return self reference */ public Atts clear() { size = 0; return this; } @Override public String toString() { final TokenBuilder tb = new TokenBuilder(Util.name(this) + '['); for(int i = 0; i < size; ++i) { if(i > 0) tb.add(", "); tb.add(nm[i]).add("=\"").add(vl[i]).add("\""); } return tb.add("]").toString(); } /** * Creates a shallow copy which shares all keys and values. * @return shallow copy */ public Atts copy() { final Atts copy = new Atts(); copy.nm = nm.clone(); copy.vl = vl.clone(); copy.size = size; return copy; } } basex-7.7.2/basex-core/src/main/java/org/basex/util/Base64.java000066400000000000000000000112311222453003200240410ustar00rootroot00000000000000package org.basex.util; import static org.basex.util.Token.*; import org.basex.util.list.*; /** * This class provides functions for encoding and decoding Base64 strings. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Base64 { /** Ending characters. */ private static final byte[] ENDING = token("AQgw"); /** Ending characters. */ private static final byte[] ENDING2 = token("AEIMQUYcgkosw048"); /** Hidden constructor. */ private Base64() { } /** * Encodes the specified string. * @param token value to be encoded * @return resulting token */ public static String encode(final String token) { return string(encode(token(token))); } /** * Encodes the specified token. * @param token value to be encoded * @return resulting token */ public static byte[] encode(final byte[] token) { final ByteList bl = new ByteList(); final int a = token.length; final int f = a / 3; final int p = a - 3 * f; int c = 0; for(int i = 0; i < f; ++i) { final int b0 = token[c++] & 0xff; final int b1 = token[c++] & 0xff; final int b2 = token[c++] & 0xff; bl.add(H2B[b0 >> 2]); bl.add(H2B[b0 << 4 & 0x3f | b1 >> 4]); bl.add(H2B[b1 << 2 & 0x3f | b2 >> 6]); bl.add(H2B[b2 & 0x3f]); } if(p != 0) { final int b0 = token[c++] & 0xff; bl.add(H2B[b0 >> 2]); if(p == 1) { bl.add(H2B[b0 << 4 & 0x3f]); bl.add('='); bl.add('='); } else { final int b1 = token[c] & 0xff; bl.add(H2B[b0 << 4 & 0x3f | b1 >> 4]); bl.add(H2B[b1 << 2 & 0x3f]); bl.add('='); } } return bl.toArray(); } /** Hex to byte conversion table. */ private static final byte[] H2B = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' }; /** * Decodes the specified string. * @param token value to be decoded * @return resulting token */ public static String decode(final String token) { return string(decode(token(token))); } /** * Decodes the specified token. * @param token value to be decoded * @return resulting token */ public static byte[] decode(final byte[] token) { final ByteList bl = new ByteList(); for(final byte c : token) if(c < 0 || c > ' ') bl.add(c); final byte[] s = bl.toArray(); // input must be a multiple of four characters if((s.length & 3) != 0) error(s); final int l = s.length, g = l >>> 2; int m = 0, n = g; if(l != 0) { if(s[l - 1] == '=') { ++m; --n; } if(s[l - 2] == '=') { ++m; if(!contains(ENDING, s[l - 3])) error(substring(s, l - 3)); } if(m == 1 && !contains(ENDING2, s[l - 2])) error(substring(s, l - 4)); } final byte[] val = new byte[3 * g - m]; int c = 0, o = 0; for(int i = 0; i < n; ++i) { final int c0 = b2h(s[c++]), c1 = b2h(s[c++]), c2 = b2h(s[c++]), c3 = b2h(s[c++]); val[o++] = (byte) (c0 << 2 | c1 >> 4); val[o++] = (byte) (c1 << 4 | c2 >> 2); val[o++] = (byte) (c2 << 6 | c3); } if(m != 0) { final int c0 = b2h(s[c++]), c1 = b2h(s[c++]); val[o++] = (byte) (c0 << 2 | c1 >> 4); if(m == 1) val[o] = (byte) (c1 << 4 | b2h(s[c]) >> 2); } return val; } /** Byte to hex conversion table. */ private static final byte[] B2H = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51 }; /** * Converts a single byte to its hex representation. * @param c character to be encoded * @return encoded value */ private static int b2h(final byte c) { if(c < 0 || c >= B2H.length) error((char) c); final int result = B2H[c]; if(result < 0) error((char) c); return result; } /** * Throws an illegal argument exception for the specified character. * @param a character */ private static void error(final Object a) { throw new IllegalArgumentException(Util.info("Invalid Base64 cast: %.", a)); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/BitArray.java000066400000000000000000000117741222453003200245460ustar00rootroot00000000000000package org.basex.util; import static java.lang.Long.*; /** * Bit array that grows when needed. The implementation is similar to * {@link java.util.BitSet}. * * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ public final class BitArray { /** Number of bits needed to address a bit in a word; 26 = 64. */ private static final int WORD_POWER = 6; /** Size of a word = 2{@link #WORD_POWER}. */ private static final int WORD_SIZE = 1 << WORD_POWER; /** A bit mask of 64 bits set to 1. */ private static final long WORD_MASK = -1L; /** Bit storage. */ private long[] words; /** Number of used bits. */ private int size; /** Construct a new bit array. */ public BitArray() { this(WORD_SIZE); } /** * Construct a new bit array with the specified number of bits. * @param n initial number of bits (> 0) */ public BitArray(final int n) { init(n); } /** * Construct a new bit array with the specified backing array. * @param a array with bits * @param l number of used bits */ public BitArray(final long[] a, final int l) { init(a, l); } /** Initialize the bit array with an empty array. */ public void init() { init(new long[1], 0); } /** * Initialize the bit array with a new size. All bits will be set to 0. * @param n initial number of bits (> 0) */ void init(final int n) { init(new long[(Math.max(0, n - 1) >>> WORD_POWER) + 1], n); } /** * Initialize the bit array with the specified backing array. * @param a array with bits * @param l number of used bits */ public void init(final long[] a, final int l) { words = a; size = l; } /** * The word array used to store the bits. The array is shrunk to the last * word, where a bit is set. * @return array of longs */ public long[] toArray() { // find the last index of a word which is different from 0: int i = words.length; while(--i >= 0 && words[i] == 0); final long[] result = new long[++i]; System.arraycopy(words, 0, result, 0, i); return result; } /** * Returns the number of bits set to {@code true}. * @return the number of bits set to {@code true} */ public int cardinality() { int sum = 0; final int inUse = size + WORD_SIZE - 1 >>> WORD_POWER; for (int i = 0; i < inUse; i++) sum += bitCount(words[i]); return sum; } /** * Get the value of the ith bit. * @param i index of the bit * @return true if the ith bit is set */ public boolean get(final int i) { if(i >= size) return false; // calculate the index of the word in the array: i div 2^6 = i >> 6 final int wi = i >>> WORD_POWER; // check if the ith bit is 1 return (words[wi] & 1L << i) != 0; } /** * Set the ith bit to 1. * @param i index of the bit */ public void set(final int i) { // calculate the index of the word in the array: i div 2^6 = i >> 6 final int wi = i >>> WORD_POWER; if(wi >= words.length) resize(wi + 1); words[wi] |= 1L << i; if(i >= size) size = i + 1; } /** * Set the ith bit to 0. * @param i index of the bit */ public void clear(final int i) { // calculate the index of the word in the array: i div 2^6 = i >> 6 final int wi = i >>> WORD_POWER; if(wi >= words.length) resize(wi + 1); words[wi] &= ~(1L << i); // it is not necessary to set the last used bit } /** * Get the next bit set to 0, starting from the ith bit. * @param i index from which to start the search (inclusive) * @return index of the next clear bit after the ith bit */ public int nextFree(final int i) { // calculate the index of the word in the array: i div 2^6 = i >> 6 int wi = i >>> WORD_POWER; // invert the word and skip the first i bits: long word = ~words[wi] & WORD_MASK << i; if(word != 0) { return (wi << WORD_POWER) + numberOfTrailingZeros(word); } while(++wi < words.length) { if((word = ~words[wi]) != 0) { return (wi << WORD_POWER) + numberOfTrailingZeros(word); } } // wi * 2^6: return wi << WORD_POWER; } /** * Get the next bit set to 1, starting from the ith bit. * @param i index from which to start the search (inclusive) * @return index of the next set bit after the ith bit */ public int nextSet(final int i) { if(i >= size) return -1; final int inUse = size + WORD_SIZE - 1 >>> WORD_POWER; int wi = i >>> WORD_POWER; long word = words[wi] & WORD_MASK << i; while(true) { if (word != 0) return (wi << WORD_POWER) + numberOfTrailingZeros(word); if (++wi == inUse) return -1; word = words[wi]; } } /** * Expand the {@link #words} array to the desired size. * @param s new size */ private void resize(final int s) { final long[] tmp = new long[Math.max(words.length << 1, s)]; System.arraycopy(words, 0, tmp, 0, words.length); words = tmp; } } basex-7.7.2/basex-core/src/main/java/org/basex/util/Compress.java000066400000000000000000000144521222453003200246200ustar00rootroot00000000000000package org.basex.util; import org.basex.util.list.*; /** * This class compresses and decompresses tokens. It is inspired by the * Huffman coding, but was simplified to speed up processing. * * NOTE: this class is not thread-safe. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Wolfgang Kronberg */ public final class Compress { /** A ByteList instance serving as a buffer. */ private final MyByteList bl = new MyByteList(); /** Temporary value. */ private int pc; /** Pack offset. */ private int po; /** Current unpack position. */ private int uc; /** Unpack offset. */ private int uo; /** * Compresses the specified text. * @param txt text to be packed * @return packed text */ public byte[] pack(final byte[] txt) { // initialize compression final int tl = txt.length; bl.reset(); Num.set(bl.get(), tl, 0); bl.size(Num.length(tl)); pc = 0; po = 0; // write packer version bit (0) push(0, 1); // relate upper with lower case and write mapping bit int lc = 0; for(final byte b : txt) lc += b >= 'A' && b <= 'Z' ? -1 : 1; final byte[] pack = lc >= 0 ? PACK1 : PACK2; push(lc >= 0 ? 1 : 0, 1); // compress all characters for(final byte t : txt) { int b = t; if(b >= 0) b = pack[b]; if(b >= 0x00 && b < 0x08) { // 1 xxx push(1 | b << 1, 4); } else if(b >= 0x08 && b < 0x10) { // 01 xxx push(2 | b << 2, 5); } else if(b >= 0x10 && b < 0x20) { // 001 xxxx push(4 | b << 3, 7); } else if(b >= 0x20 && b < 0x40) { // 0001 xxxxx push(8 | b << 4, 9); } else { // 0000 xxxxxxxx push(b << 4, 12); } } if(po != 0) bl.add(pc); return bl.size() < tl ? bl.toArray() : txt; } /** * Pushes bits to the byte cache. * @param b value to be pushed. * @param s number of bits */ private void push(final int b, final int s) { int bb = b, oo = po, cc = pc; for(int i = 0; i < s; i++) { cc |= (bb & 1) << oo; bb >>= 1; if(++oo == 8) { bl.add(cc); oo = 0; cc = 0; } } po = oo; pc = cc; } /** * Decompresses the specified text. * @param txt text to be unpacked * @return unpacked text */ public byte[] unpack(final byte[] txt) { // initialize decompression final byte[] tmp = bl.get(); bl.set(txt); uc = Num.length(txt, 0); uo = 0; // read packer bit pull(); // choose mapping final byte[] unpack = pull() ? UNPACK1 : UNPACK2; // decompress all characters final int l = Num.get(txt, 0); final byte[] res = new byte[l]; for(int r = 0; r < l; r++) { final int b; if(pull()) { // 1 xxx b = pull(3); } else if(pull()) { // 01 xxx b = pull(3) | 0x08; } else if(pull()) { // 001 xxxx b = pull(4) | 0x10; } else if(pull()) { // 0001 xxxxx b = pull(5) | 0x20; } else { // 0000 xxxxxxxx b = pull(8); } res[r] = (byte) (b >= 128 ? b : unpack[b]); } // make sure that the external txt byte array does not remain in this class bl.set(tmp); return res; } /** * Pulls the specified number of bits and returns the result. * @param s number of bytes * @return result */ private int pull(final int s) { int oo = uo, cc = uc, x = 0; final byte[] l = bl.get(); for(int i = 0; i < s; i++) { if((l[cc] & 1 << oo) != 0) x |= 1 << i; if(++oo == 8) { oo = 0; ++cc; } } uo = oo; uc = cc; return x; } /** * Pulls a single bit. * @return result */ private boolean pull() { int oo = uo; final boolean b = (bl.get()[uc] & 1 << oo) != 0; if(++oo == 8) { oo = 0; ++uc; } uo = oo; return b; } /** First mapping for unpacking data. */ private static final byte[] UNPACK1 = { 0x20, 0x61, 0x65, 0x6E, 0x69, 0x6F, 0x72, 0x73, // encode via 1 xxx 0x74, 0x6C, 0x75, 0x68, 0x64, 0x63, 0x67, 0x6D, // encode via 01 xxx 0x70, 0x79, 0x62, 0x6B, 0x66, 0x76, 0x43, 0x53, // encode via 001 xxxx 0x77, 0x4D, 0x41, 0x42, 0x50, 0x7A, 0x2E, 0x0A, 0x54, 0x52, 0x4B, 0x4C, 0x47, 0x4E, 0x48, 0x6A, // encode via 0001 xxxxx 0x45, 0x49, 0x44, 0x46, 0x4A, 0x78, 0x4F, 0x71, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x2D, 0x27, 0x2C, 0x22, 0x3F, 0x56, 0x57, 0x55, 0x5A, 0x59, 0x51, 0x58, 0x09, 0x40, 0x28, 0x2F, 0x29, 0x2B, 0x7E, 0x21, 0x23, // encode via 0000 xxxxxxxx 0x24, 0x25, 0x26, 0x2A, 0x3B, 0x3C, 0x3D, 0x3E, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x7B, 0x7C, 0x7D, 0x7F, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F }; /** First mapping for packing data. */ private static final byte[] PACK1 = new byte[UNPACK1.length]; /** Second mapping for unpacking data. */ private static final byte[] UNPACK2 = new byte[UNPACK1.length]; /** Second mapping for packing data. */ private static final byte[] PACK2 = new byte[UNPACK2.length]; // initializes the character mappings static { final int pl = UNPACK1.length; for(int p = 0; p < pl; p++) { final byte b1 = UNPACK1[p]; // swap lower and upper case in second mapping final byte b2 = (byte) (b1 >= 'A' && b1 <= 'Z' ? b1 + 0x20 : b1 >= 'a' && b1 <= 'z' ? b1 - 0x20 : b1); UNPACK2[p] = b2; PACK1[b1] = (byte) p; PACK2[b2] = (byte) p; } } /** Local ByteList implementation to make protected fields accessible. */ static final class MyByteList extends ByteList { /** * Exchanges the actual byte array backing this list instance. * @param newList the new value for ByteList.list, including * setting ByteList.size to list.size. */ void set(final byte[] newList) { list = newList; size = newList.length; } /** * Direct access to the backing byte array. * @return ByteList.list */ byte[] get() { return list; } } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ConsoleReader.java000066400000000000000000000116031222453003200255450ustar00rootroot00000000000000package org.basex.util; import static org.basex.core.Text.*; import static org.basex.util.Token.*; import java.io.*; import java.lang.reflect.*; import org.basex.core.*; import org.basex.core.parse.*; import org.basex.io.*; /** * Console reader. * * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ public abstract class ConsoleReader { /** Password prompt. */ private static final String PW_PROMPT = PASSWORD + COLS; /** Default prompt. */ private static final String PROMPT = "> "; /** Password reader. */ private final PasswordReader pwReader = new PasswordReader() { @Override public String password() { return md5(readPassword()); } }; /** * Reads next line. If no input, then the method blocks the thread. * @return next line or {@code null} if EOF is reached */ public abstract String readLine(); /** * Reads a password. * @return password as plain text */ public abstract String readPassword(); /** * Create a new password reader for this console. * @return a new instance of {@link PasswordReader} */ public PasswordReader pwReader() { return pwReader; } /** * Creates a new instance. * @return instance of console reader */ public static final ConsoleReader get() { if(JLineConsoleReader.isAvailable()) { try { return new JLineConsoleReader(); } catch(final Exception ex) { Util.errln(ex); } } return new SimpleConsoleReader(); } /** Simple console reader implementation. */ private static class SimpleConsoleReader extends ConsoleReader { /** Input reader. */ private final BufferedReader in; /** Constructor. */ SimpleConsoleReader() { in = new BufferedReader(new InputStreamReader(System.in)); } @Override public String readLine() { try { Util.out(PROMPT); return in.readLine(); } catch(final IOException e) { // should not happen throw new RuntimeException(e); } } @Override public String readPassword() { Util.out(PW_PROMPT); return Util.password(); } } /** Implementation which provides advanced features, such as history. */ private static class JLineConsoleReader extends ConsoleReader { /** JLine console reader class name. */ private static final String JLINE_CONSOLE_READER = "jline.ConsoleReader"; /** JLine history class name. */ private static final String JLINE_HISTORY = "jline.History"; /** Command history file. */ private static final String HISTORY_FILE = IO.BASEXSUFFIX + "history"; /** Password echo character. */ private static final Character PASSWORD_ECHO = (char) 0; /** JLine console reader class. */ private final Class readerClass; /** Method to read the next line. */ private final Method readLine; /** Method to read the next line with echoing a character. */ private final Method readEcho; /** Method to set the default prompt. */ private final Method setDefaultPrompt; /** Implementation. */ private final Object reader; /** * Checks if JLine implementation is available? * @return {@code true} if JLine is in the classpath */ static boolean isAvailable() { return Reflect.available(JLINE_CONSOLE_READER); } /** * Constructor. * @throws Exception error */ JLineConsoleReader() throws Exception { // reflection readerClass = Reflect.find(JLINE_CONSOLE_READER); readLine = Reflect.method(readerClass, "readLine"); readEcho = Reflect.method(readerClass, "readLine", String.class, Character.class); setDefaultPrompt = Reflect.method(readerClass, "setDefaultPrompt", String.class); // initialization reader = readerClass.newInstance(); defaultConfiguration(); } /** Apply default configuration. */ private void defaultConfiguration() { final Class historyClass = Reflect.find(JLINE_HISTORY); final File hist = new File(Prop.HOME, HISTORY_FILE); final Object history = Reflect.get(Reflect.find(historyClass, File.class), hist); Reflect.invoke(Reflect.method(readerClass, "setUseHistory", boolean.class), reader, true); Reflect.invoke(Reflect.method(readerClass, "setBellEnabled", boolean.class), reader, false); Reflect.invoke(Reflect.method(readerClass, "setHistory", historyClass), reader, history); restoreDefaultPrompt(); } /** Restore the default prompt. */ private void restoreDefaultPrompt() { Reflect.invoke(setDefaultPrompt, reader, PROMPT); } @Override public String readLine() { return (String) Reflect.invoke(readLine, reader); } @Override public String readPassword() { final Object pw = Reflect.invoke(readEcho, reader, PW_PROMPT, PASSWORD_ECHO); restoreDefaultPrompt(); return (String) pw; } } } basex-7.7.2/basex-core/src/main/java/org/basex/util/DateTime.java000066400000000000000000000043571222453003200245240ustar00rootroot00000000000000package org.basex.util; import java.text.*; import java.util.*; /** * This class contains static, thread-safe methods for parsing and formatting * dates and times. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DateTime { /** Date pattern. */ public static final String PATTERN = "-\\d{4}-\\d{2}-\\d{2}-\\d{2}-\\d{2}-\\d{2}"; /** Full date format. */ public static final SimpleDateFormat FULL = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); /** Date format without milliseconds and timestamp. */ public static final SimpleDateFormat DATETIME = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss"); /** Date format. */ public static final SimpleDateFormat DATE = new SimpleDateFormat("yyyy-MM-dd"); /** Time format. */ public static final SimpleDateFormat TIME = new SimpleDateFormat("HH:mm:ss.SSS"); /** Time zone. */ public static final SimpleDateFormat ZONE = new SimpleDateFormat("Z"); static { FULL.setTimeZone(TimeZone.getTimeZone("UTC")); } /** Hidden constructor. */ private DateTime() { } /** * Parses the specified date and returns its time in milliseconds. * Returns {@code null} if it cannot be converted. * @param date date to be parsed * @return time in milliseconds */ public static long parse(final String date) { try { return parse(date, FULL).getTime(); } catch(final ParseException ex) { Util.errln(ex); return 0; } } /** * Thread-safe method to create a string from a given date in a given format. * @param format date format * @param date date * @return string with the formatted date */ public static String format(final Date date, final DateFormat format) { synchronized(format) { return format.format(date); } } /** * Thread-safe method to parse a date from a string in a given format. * @param date string representing a date * @param format date format * @return parsed date * @throws ParseException if the string cannot be parsed */ public static Date parse(final String date, final DateFormat format) throws ParseException { synchronized(format) { return format.parse(date); } } } basex-7.7.2/basex-core/src/main/java/org/basex/util/History.java000066400000000000000000000066441222453003200244720ustar00rootroot00000000000000package org.basex.util; /** * This class stores strings in a history. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class History { /** Maximum size for storing entries in a history (currently: 10 MB). */ private static final int MAXBYTES = 10000000; /** Maximum number of entries to be stored. */ private static final int MAX = 1024; /** String history. */ private final byte[][] hist; /** Cursor history. */ private final int[] cur; /** Active flag. */ private final boolean active; /** Maximum of stored entries. */ private int max; /** History position. */ private int pos; /** Save position. */ private int saved; /** * Constructor. * @param text initial text */ public History(final byte[] text) { active = text != null; if(active) { cur = new int[MAX]; hist = new byte[MAX][]; hist[0] = text; } else { cur = null; hist = null; } } /** * Indicates if the history is active. * @return result of check */ public boolean active() { return active; } /** * Checks if the history points to the first entry. * @return result of check */ public boolean first() { return pos == 0; } /** * Checks if the history points to the last entry. * @return result of check */ public boolean last() { return pos == max; } /** * Returns the previous string and decreases the pointer, or returns {@code null}. * @return previous string */ public byte[] prev() { return pos > 0 ? hist[--pos] : null; } /** * Returns the next string and increases the pointer, or returns {@code null}. * @return previous string */ public byte[] next() { return pos < max ? hist[++pos] : null; } /** * Returns the cursor position. * @return cursor position */ public int cursor() { return cur[pos]; } /** * Stores a string in the history. * @param str string to be stored * @param oc old cursor position * @param nc new cursor position */ public void store(final byte[] str, final int oc, final int nc) { if(!active || str == hist[pos] || Token.eq(str, hist[pos])) return; // merge consecutive character inputs without deletions int len = str.length; if(pos > 0 && saved != pos && cur[pos] == oc && oc + 1 == nc && hist[pos - 1].length < len) { hist[pos] = str; cur[pos] = nc; return; } // summarize and limit size of new and existing entries int off = pos + 1; for(; off > 0 && len < MAXBYTES; off--) len += hist[off - 1].length; // enough space: limit number of entries if(off == 0 && pos + 1 == MAX) off = 1; // remove entries if(off > 0) { Array.move(hist, off, -off, MAX - off); Array.move(cur, off, -off, MAX - off); saved -= off; pos -= off; } // save new entry if(pos >= 0) cur[pos] = oc; hist[++pos] = str; cur[pos] = nc; max = pos; // remove old entries to save memory for(int p = pos + 1; p < MAX; p++) hist[p] = null; } /** * Sets the saved position. */ public void save() { saved = pos; } /** * Checks if the file has been modified. * @return result of check */ public boolean modified() { return saved != pos; } } basex-7.7.2/basex-core/src/main/java/org/basex/util/InputInfo.java000066400000000000000000000043531222453003200247370ustar00rootroot00000000000000package org.basex.util; /** * This class contains the original query, its file reference, and line/column * information. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class InputInfo { /** File reference. */ private final String file; /** Input query. */ private final String query; /** Parse position. */ private final int pos; /** Line and column number. */ private int[] lineCol; /** * Constructor. * @param parser input parser, containing information on the current parsing state */ public InputInfo(final InputParser parser) { query = parser.input; file = parser.file; pos = parser.pos; } /** * Returns the input reference. * @return input reference */ public String file() { return file; } /** * Returns an array with the line and column position of the associated expression. * @return line and column position */ public int[] lineCol() { if(lineCol == null) lineCol = lineCol(query, Math.min(pos, query.length())); return lineCol; } /** * Calculates the column and line number of a given offset in the string. * @param query query string * @param pos query position * @return two element array of line and column number */ public static int[] lineCol(final String query, final int pos) { int l = 1, c = 1; for(int i = 0, ch; i < pos; i += Character.charCount(ch)) { ch = query.codePointAt(i); if(ch == '\n') { l++; c = 1; } else if(ch != '\r') { c++; } } return new int[] { l, c }; } @Override public boolean equals(final Object object) { if(!(object instanceof InputInfo)) return false; final InputInfo ii = (InputInfo) object; return (file != null ? file.equals(ii.file) : query.equals(ii.query)) && pos == ii.pos; } @Override public int hashCode() { return (file != null ? file.hashCode() : query.hashCode()) + pos; } @Override public String toString() { final TokenBuilder tb = new TokenBuilder(); tb.add(file == null ? "." : file); final int[] lc = lineCol(); tb.add(", ").addExt(lc[0]).add('/').addExt(lc[1]); return tb.toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/InputParser.java000066400000000000000000000071031222453003200252740ustar00rootroot00000000000000package org.basex.util; import static org.basex.core.Text.*; import static org.basex.util.Token.*; import org.basex.core.*; import org.basex.io.*; /** * Abstract class for parsing various inputs, such as database commands or queries. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class InputParser { /** Parsing exception. */ private static final String FOUND = ", found '%'"; /** Input to be parsed. */ public final String input; /** Query length. */ public final int length; /** File reference. */ public String file; /** Current input position. */ public int pos; /** Marked input position. */ public int mark; /** * Constructor. * @param in input */ public InputParser(final String in) { input = in; length = input.length(); } /** * Sets a file reference. * @param f file * @param c database context */ protected void file(final IO f, final Context c) { file = f == null ? null : c.user.has(Perm.ADMIN) ? f.path() : f.name(); } /** * Checks if more characters are found. * @return current character */ public final boolean more() { return pos < length; } /** * Returns the current character. * @return current character */ public final char curr() { final int i = pos; return i < length ? input.charAt(i) : 0; } /** * Checks if the current character equals the specified one. * @param ch character to be checked * @return result of check */ public final boolean curr(final int ch) { final int i = pos; return i < length && ch == input.charAt(i); } /** * Remembers the current position. */ protected final void mark() { mark = pos; } /** * Returns the next character. * @return result of check */ protected final char next() { final int i = pos + 1; return i < length ? input.charAt(i) : 0; } /** * Returns next character. * @return next character */ public final char consume() { return pos < length ? input.charAt(pos++) : 0; } /** * Peeks forward and consumes the character if it equals the specified one. * @param ch character to consume * @return true if character was found */ public final boolean consume(final int ch) { final int i = pos; if(i >= length || ch != input.charAt(i)) return false; ++pos; return true; } /** * Checks if the specified character is a quote. * @param ch character to be checked * @return result */ protected static final boolean quote(final int ch) { return ch == '"' || ch == '\''; } /** * Peeks forward and consumes the string if it equals the specified one. * @param str string to consume * @return true if string was found */ public final boolean consume(final String str) { int i = pos; final int l = str.length(); if(i + l > length) return false; for(int s = 0; s < l; ++s) { if(input.charAt(i++) != str.charAt(s)) return false; } pos = i; return true; } /** * Returns a "found" string, containing the current character. * @return completion */ protected final byte[] found() { return curr() == 0 ? EMPTY : Util.inf(FOUND, curr()); } /** * Returns the remaining, unscanned query substring. * @return query substring */ protected final String rest() { final int ie = Math.min(length, pos + 15); return input.substring(pos, ie) + (ie == length ? "" : DOTS); } /** * Creates input information. * @return input information */ public final InputInfo info() { return new InputInfo(this); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/JarLoader.java000066400000000000000000000025621222453003200246670ustar00rootroot00000000000000package org.basex.util; import java.lang.reflect.*; import java.net.*; import java.util.*; import java.util.jar.*; /** * Custom class loader for loading jar files. This class is needed because JDK * does not offer a fine and easy way to delete open jars: * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5041014 * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen * @author Rositsa Shadura */ public final class JarLoader extends URLClassLoader { /** * Constructor. * @param urls of jars to be loaded * @param parent the parent class loader for delegation */ public JarLoader(final URL[] urls, final ClassLoader parent) { super(urls, parent); } /** * Closes the class loader. */ public void close() { try { final Field ucp = URLClassLoader.class.getDeclaredField("ucp"); ucp.setAccessible(true); final Object cp = ucp.get(this); final Field loaders = cp.getClass().getDeclaredField("loaders"); loaders.setAccessible(true); for(final Object jl : (Collection) loaders.get(cp)) { try { final Field jar = jl.getClass().getDeclaredField("jar"); jar.setAccessible(true); ((JarFile) jar.get(jl)).close(); } catch(final Throwable th) { Util.errln(th); } } } catch(final Throwable th) { Util.errln(th); } } } basex-7.7.2/basex-core/src/main/java/org/basex/util/Levenshtein.java000066400000000000000000000071121222453003200253040ustar00rootroot00000000000000package org.basex.util; import static org.basex.util.Token.*; /** * Damerau-Levenshtein implementation. Based on the publications from * Levenshtein (1965): Binary codes capable of correcting spurious insertions * and deletions of ones, and Damerau (1964): A technique for computer * detection and correction of spelling errors. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Levenshtein { /** Maximum token size. */ private static final int MAX = 50; /** Matrix for calculating Levenshtein distance. */ private int[][] matrix; /** * Compares two character arrays for similarity. * @param token token to be compared * @param sub second token to be compared * @return true if the arrays are similar */ public boolean similar(final byte[] token, final byte[] sub) { return similar(token, sub, 0); } /** * Compares two character arrays for similarity. * @param token token to be compared * @param sub second token to be compared * @param err number of allowed errors; dynamic calculation if value is 0 * @return true if the arrays are similar */ public boolean similar(final byte[] token, final byte[] sub, final int err) { int sl = 0, tl = 0; for(int s = 0; s < sub.length; s += cl(sub, s)) ++sl; for(int t = 0; t < token.length; t += cl(token, t)) ++tl; if(tl == 0) return false; // use exact search for too short and too long values if(sl < 4 || tl > MAX || sl > MAX) return sl == tl && same(token, sub); // skip different tokens with too different lengths final int k = err == 0 ? Math.max(1, sl >> 2) : err; return Math.abs(sl - tl) <= k && ls(token, tl, sub, sl, k); } /** * Calculates a Levenshtein distance. * @param tk token to be compared * @param tl token length * @param sb sub token to be compared * @param sl string length * @param k maximum number of accepted errors * @return true if the arrays are similar */ private boolean ls(final byte[] tk, final int tl, final byte[] sb, final int sl, final int k) { int[][] m = matrix; if(m == null) { m = new int[MAX + 2][MAX + 2]; for(int i = 0; i < m.length; ++i) { m[0][i] = i; m[i][0] = i; } matrix = m; } int e2 = -1, f2 = -1; for(int t = 0; t < tl; t += cl(tk, t)) { final int e = norm(lc(cp(tk, t))); int d = Integer.MAX_VALUE; for(int s = 0; s < sl; s += cl(sb, s)) { final int f = norm(lc(cp(sb, s))); int c = m(m[t][s + 1] + 1, m[t + 1][s] + 1, m[t][s] + (e == f ? 0 : 1)); if(e == f2 && f == e2) c = m[t][s]; m[t + 1][s + 1] = c; d = Math.min(d, c); f2 = f; } if(d > k) return false; e2 = e; } return m[tl][sl] <= k; } /** * Gets the minimum of three values. * @param a 1st value * @param b 2nd value * @param c 3rd value * @return minimum */ private static int m(final int a, final int b, final int c) { final int d = a < b ? a : b; return d < c ? d : c; } /** * Compares two character arrays for equality. * @param tk token to be compared * @param sb second token to be compared * @return true if the arrays are equal */ private static boolean same(final byte[] tk, final byte[] sb) { int t = 0, s = 0; for(; t < tk.length && s < sb.length; t += cl(tk, t), s += cl(sb, s)) { if(lc(norm(cp(tk, t))) != lc(norm(cp(sb, t)))) return false; } return true; } } basex-7.7.2/basex-core/src/main/java/org/basex/util/MinHeap.java000066400000000000000000000074051222453003200243460ustar00rootroot00000000000000package org.basex.util; import java.util.*; /** * A min-heap. * * @param key type * @param value type * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class MinHeap { /** value array. */ private Object[] vals; /** Comparator. */ private final Comparator comp; /** Size of the heap. */ private int size; /** * Constructs a heap with the given initial capacity and order. * @param cap initial capacity * @param cmp comparator */ public MinHeap(final int cap, final Comparator cmp) { vals = new Object[2 * cap]; comp = cmp; } /** * Inserts the given key/value pair into the heap. * @param key key * @param value value */ public void insert(final K key, final V value) { final int s = size << 1; if(s == vals.length) vals = Array.copy(vals, new Object[s << 1]); vals[s] = key; vals[s + 1] = value; // let the inserted value bubble up to its position int curr = size++, par = (curr - 1) / 2; while(curr > 0 && compare(curr, par) < 0) { swap(curr, par); curr = par; par = (curr - 1) / 2; } } /** * Removes the minimum from this heap. * @return the removed entry's value */ public V removeMin() { final V val = minValue(); swap(0, --size); int pos = 0, sm; while(pos < size / 2) { sm = 2 * pos + 1; if(sm < size - 1 && compare(sm + 1, sm) < 0) sm++; if(compare(pos, sm) <= 0) break; swap(pos, sm); pos = sm; } return val; } /** * returns the value of the smallest key from this heap. * @return value of the smallest key */ @SuppressWarnings("unchecked") public V minValue() { return (V) vals[1]; } /** * Size of this heap. * @return number of entries */ public int size() { return size; } /** * Checks if this heap is empty. * @return {@code true} if heap is empty, {@code false} otherwise */ public boolean isEmpty() { return size == 0; } /** * Compares the keys at position {@code i} and {@code j}. * @param i position of first key * @param j position of second key * @return result of check */ @SuppressWarnings("unchecked") private int compare(final int i, final int j) { final K a = (K) vals[2 * i], b = (K) vals[2 * j]; return comp == null ? ((Comparable) a).compareTo(b) : comp.compare(a, b); } /** * Swaps the entries at position {@code a} and {@code b}. * @param a first index * @param b second index */ private void swap(final int a, final int b) { if(a == b) return; final int k1 = 2 * a, v1 = k1 + 1, k2 = 2 * b, v2 = k2 + 1; final Object k = vals[k1], v = vals[v1]; vals[k1] = vals[k2]; vals[v1] = vals[v2]; vals[k2] = k; vals[v2] = v; } /** * Verifies the inner structure of the heap. * @throws IllegalStateException if the invariants don't hold */ public void verify() { verify(0); } /** * Checks if the heap invariant holds for the node at position {@code i}. * @param i position of the node * @throws IllegalStateException if the invariants don't hold */ private void verify(final int i) { if(2 * i + 1 < size) { final int left = 2 * i + 1, right = 2 * (i + 1); if(compare(i, left) > 0 || right < size && compare(i, right) > 0) throw new IllegalStateException("Heap invariant doesn'T hold at node " + i + '.'); verify(left); verify(right); } } @Override public String toString() { final StringBuilder sb = new StringBuilder("Heap["); for(int i = 0; i < size; i++) { sb.append('(').append(vals[2 * i]).append(", ").append( vals[2 * i + 1]).append(')'); if(i < size - 1) sb.append(", "); } return sb.append(']').toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/Num.java000066400000000000000000000133701222453003200235620ustar00rootroot00000000000000package org.basex.util; import java.util.*; /** *

This class provides operations to compress and decompress 4-byte integer * values in byte arrays in order to save memory.

* *

The first two bits of a {@code Num} array indicate the range of the * compressed number:

* *
    *
  • {@code 00}: the number (0x00-0x3F) is encoded in the remaining 6 bits of * the current byte
  • *
  • {@code 01}: the number (0x40-0x3FFF) is encoded in 14 bits of the current * and the following byte
  • *
  • {@code 10}: the number (0x4000-0x3FFFFFFF) is encoded in 30 bits of the * current and the following three bytes
  • *
  • {@code 11}: the number (0x40000000-0xFFFFFFFF) is encoded in 32 bits of * the following four bytes
  • *
* * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Num { /** Private constructor, preventing instantiation. */ private Num() { } // STATIC METHODS =========================================================== /** * Creates a new number array, in which the first four bytes contain * the number of occupied bytes. * @param value initial value to be compressed and stored * @return new number array */ public static byte[] newNum(final int value) { final int len = length(value); final byte[] array = new byte[4 + len]; set(array, value, 4, len); size(array, 4 + len); return array; } /** * Creates a compressed representation of the specified value. * @param value value to be compressed * @return new number array */ public static byte[] num(final int value) { final int len = length(value); final byte[] array = new byte[len]; set(array, value, 0, len); return array; } /** * Compresses and adds a value to the specified array and * returns the resulting array. * @param array input array * @param value value to be added * @return resulting array (may be the same as input array) */ public static byte[] add(final byte[] array, final int value) { final int len = length(value); final int pos = size(array); final byte[] tmp = check(array, pos, len); set(tmp, value, pos, len); size(tmp, pos + len); return tmp; } /** * Decompresses and returns a value from the specified byte array. * @param array array * @param pos position where the value is found * @return decompressed value */ public static int get(final byte[] array, final int pos) { int p = pos; final int v = array[p++] & 0xFF; switch((v & 0xC0) >>> 6) { case 0: return v; case 1: return (v & 0x3F) << 8 | array[p] & 0xFF; case 2: return (v & 0x3F) << 24 | (array[p++] & 0xFF) << 16 | (array[p++] & 0xFF) << 8 | array[p] & 0xFF; default: return (array[p++] & 0xFF) << 24 | (array[p++] & 0xFF) << 16 | (array[p++] & 0xFF) << 8 | array[p] & 0xFF; } } /** * Compresses and stores an integer value to the specified byte array. * @param array array * @param value value to be stored * @param pos position where the value is to be stored */ public static void set(final byte[] array, final int value, final int pos) { set(array, value, pos, length(value)); } /** * Returns the length value of the specified array, stored in the first * four bytes. * @param array input array * @return array length */ public static int size(final byte[] array) { return ((array[0] & 0xFF) << 24) + ((array[1] & 0xFF) << 16) + ((array[2] & 0xFF) << 8) + (array[3] & 0xFF); } /** * Stores the specified length value in the first bytes of the * specified array. * @param array input array * @param length length to be stored */ public static void size(final byte[] array, final int length) { array[0] = (byte) (length >>> 24); array[1] = (byte) (length >>> 16); array[2] = (byte) (length >>> 8); array[3] = (byte) length; } /** * Returns the compressed length of the value at the specified position. * @param array array * @param pos position where the value is found * @return value length */ public static int length(final byte[] array, final int pos) { final int v = (array[pos] & 0xFF) >>> 6; return v == 0 ? 1 : v == 1 ? 2 : v == 2 ? 4 : 5; } /** * Returns the compressed length of the specified value. * @param v integer value * @return value length */ public static int length(final int v) { return v < 0 || v > 0x3FFFFFFF ? 5 : v > 0x3FFF ? 4 : v > 0x3F ? 2 : 1; } // PRIVATE STATIC METHODS =================================================== /** * Resizes the specified array if no space is left. * @param a array to be resized * @param p current array position * @param l length of new entry * @return new array */ private static byte[] check(final byte[] a, final int p, final int l) { final int s = a.length; return p + l < s ? a : Arrays.copyOf(a, s + Math.max(l, s >> 3)); } /** * Compresses and writes an integer value to the specified byte array. * @param a array * @param v value to be written * @param p position * @param l value length */ private static void set(final byte[] a, final int v, final int p, final int l) { int i = p; if(l == 5) { a[i++] = (byte) 0xC0; a[i++] = (byte) (v >>> 24); a[i++] = (byte) (v >>> 16); a[i++] = (byte) (v >>> 8); } else if(l == 4) { a[i++] = (byte) (v >>> 24 | 0x80); a[i++] = (byte) (v >>> 16); a[i++] = (byte) (v >>> 8); } else if(l == 2) { a[i++] = (byte) (v >>> 8 | 0x40); } a[i] = (byte) v; } } basex-7.7.2/basex-core/src/main/java/org/basex/util/Performance.java000066400000000000000000000073721222453003200252710ustar00rootroot00000000000000package org.basex.util; /** * This class contains methods for performance measurements. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Performance { /** Performance timer, using nano seconds. */ private long time = System.nanoTime(); /** * Returns the measured execution time in nanoseconds. * @return execution time */ public long time() { final long time2 = System.nanoTime(); final long diff = time2 - time; time = time2; return diff; } /** * Returns the measured execution time in milliseconds and reinitializes * the timer. * @return execution time */ public String getTime() { return getTime(1); } /** * Returns the measured execution time in milliseconds, divided by the * number of runs, and reinitializes the timer. * @param runs number of runs * @return execution time */ public String getTime(final int runs) { final long time2 = System.nanoTime(); final String t = getTime(time2 - time, runs); time = time2; return t; } /** * Returns a string with the measured execution time in milliseconds. * @param time measured time in nanoseconds * @param runs number of runs * @return execution time */ public static String getTime(final long time, final int runs) { return time / runs / 10000 / 100d + " ms" + (runs > 1 ? " (avg)" : ""); } /** * Returns a formatted representation of the current memory consumption. * @return memory consumption */ public static String getMemory() { return format(memory()); } /** * Formats a number according to the binary size orders (KB, MB, ...). * @param size value to be formatted * @return formatted size value */ public static String format(final long size) { return format(size, true, 5); } /** * Formats a file size according to the binary size orders (KB, MB, ...). * @param size file size * @param det detailed suffix * @return formatted size value */ public static String format(final long size, final boolean det) { return format(size, det, 0); } /** * Formats a file size according to the binary size orders (KB, MB, ...), * adding the specified offset to the orders of magnitude. * @param size file size * @param det detailed suffix * @param off offset: higher values will result in more digits * @return formatted size value */ private static String format(final long size, final boolean det, final int off) { if(size >= 1L << 50 + off) return (size + (1L << 49) >> 50) + " PB"; if(size >= 1L << 40 + off) return (size + (1L << 39) >> 40) + " TB"; if(size >= 1L << 30 + off) return (size + (1L << 29) >> 30) + " GB"; if(size >= 1L << 20 + off) return (size + (1L << 19) >> 20) + " MB"; if(size >= 1L << 10 + off) return (size + (1L << 9) >> 10) + " KB"; return size + (det ? " Byte" + (size == 1 ? "" : "s") : " B"); } /** * Sleeps the specified number of milliseconds. * @param ms time in milliseconds to wait */ public static void sleep(final long ms) { try { Thread.sleep(Math.max(0, ms)); } catch(final InterruptedException ignored) { } } /** * Performs some garbage collection. * GC behavior in Java is a pretty complex task. Still, garbage collection * can be forced by calling it several times. * @param n number of times to execute garbage collection */ public static void gc(final int n) { for(int i = 0; i < n; ++i) System.gc(); } /** * Returns the current memory consumption in bytes. * @return memory consumption */ public static long memory() { final Runtime rt = Runtime.getRuntime(); return rt.totalMemory() - rt.freeMemory(); } @Override public String toString() { return getTime(); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/Reflect.java000066400000000000000000000152421222453003200244070ustar00rootroot00000000000000package org.basex.util; import java.lang.reflect.*; import java.util.*; /** * This class assembles some reflection methods. Most exceptions are caught and replaced * by a {@code null} value. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Reflect { /** Cached constructors. */ private static final HashMap> CONS = new HashMap>(); /** Cached classes. */ private static final HashMap> CLASSES = new HashMap>(); /** Cached fields. */ private static final HashMap FIELDS = new HashMap(); /** Hidden constructor. */ private Reflect() { } /** * Checks if the class specified by the pattern is available. * @param pattern class pattern * @param ext optional extension * @return result of check */ public static boolean available(final String pattern, final Object... ext) { try { forName(Util.info(pattern, ext)); return true; } catch(final Throwable ex) { return false; } } /** * Caches and returns a reference to the specified class, or {@code null}. * @param name fully qualified class name * @return reference, or {@code null} if the class is not found */ public static Class find(final String name) { final Class c = CLASSES.get(name); if(c != null) return c; try { return forName(name); } catch(final Throwable ex) { return null; } } /** * Caches and returns a reference to the specified class, or throws an exception. * @param name fully qualified class name * @return class reference * @throws Throwable any exception or error */ public static Class forName(final String name) throws Throwable { return cache(name, Class.forName(name)); } /** * Caches the specified class. * @param name fully qualified class name * @param c class * @return reference, or {@code null} if the class is not found */ private static Class cache(final String name, final Class c) { try { if(!accessible(c)) return null; CLASSES.put(name, c); } catch(final Throwable ignored) { } return c; } /** * Caches and returns a reference to the specified field, or {@code null}. * @param clazz class to search for the constructor * @param name field name * @return reference, or {@code null} if the field is not found */ public static Field field(final Class clazz, final String name) { final String key = clazz.getName() + name; Field f = FIELDS.get(key); if(f == null) { try { f = clazz.getField(name); FIELDS.put(key, f); } catch(final Throwable ignored) { } } return f; } /** * Caches and returns a reference to the class specified by the pattern, * or {@code null}. * @param pattern class pattern * @param ext optional extension * @return reference, or {@code null} if the class is not found */ public static Class find(final String pattern, final Object... ext) { return find(Util.info(pattern, ext)); } /** * Returns a class reference to one of the specified classes, or {@code null}. * @param names fully qualified class names * @return reference, or {@code null} if the class is not found */ public static Class find(final String[] names) { for(final String n : names) { final Class c = find(n); if(c != null) return c; } return null; } /** * Caches and returns a constructor by parameter types. * @param clazz class to search for the constructor * @param types constructor parameters * @return {@code null} if the constructor is not found */ public static Constructor find(final Class clazz, final Class... types) { if(clazz == null) return null; final StringBuilder sb = new StringBuilder(clazz.getName()); for(final Class c : types) sb.append(c.getName()); final String key = sb.toString(); Constructor m = CONS.get(key); if(m == null) { try { try { m = clazz.getConstructor(types); } catch(final Throwable ex) { m = clazz.getDeclaredConstructor(types); m.setAccessible(true); } CONS.put(key, m); } catch(final Throwable ex) { Util.debug(ex); } } return m; } /** * Finds a public, protected or private method by name and parameter types. * @param clazz class to search for the method * @param name method name * @param types method parameters * @return reference, or {@code null} if the method is not found */ public static Method method(final Class clazz, final String name, final Class... types) { if(clazz == null) return null; Method m = null; try { try { m = clazz.getMethod(name, types); } catch(final Throwable ex) { m = clazz.getDeclaredMethod(name, types); m.setAccessible(true); } } catch(final Throwable ex) { Util.debug(ex); } return m; } /** * Returns a class instance, or throws a runtime exception. * @param clazz class * @return instance */ public static Object get(final Class clazz) { try { return clazz != null ? clazz.newInstance() : null; } catch(final Throwable ex) { Util.debug(ex); return null; } } /** * Returns a class instance, or {@code null}. * @param clazz class * @param args arguments * @return instance */ public static Object get(final Constructor clazz, final Object... args) { try { return clazz != null ? clazz.newInstance(args) : null; } catch(final Throwable ex) { Util.debug(ex); return null; } } /** * Invokes the specified method. * @param method method to run * @param object object ({@code null} for static methods) * @param args arguments * @return result of method call */ public static Object invoke(final Method method, final Object object, final Object... args) { try { return method != null ? method.invoke(object, args) : null; } catch(final Throwable ex) { Util.debug(ex); return null; } } /** * Check if a class is accessible. * @param cls class * @return {@code true} if a class is accessible */ private static boolean accessible(final Class cls) { // non public classes cannot be instantiated return Modifier.isPublic(cls.getModifiers()); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/Table.java000066400000000000000000000115761222453003200240600ustar00rootroot00000000000000package org.basex.util; import static org.basex.core.Text.*; import static org.basex.util.Token.*; import java.util.*; import org.basex.util.list.*; /** * This is a table representation for textual table output. * It should be guaranteed that the {@link #header} object has the * same number of entries as all {@link #contents} string arrays. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Table { /** Distance between table columns. */ private static final int DIST = 2; /** Table header. */ public final TokenList header = new TokenList(); /** Alignment (false: left, true: right alignment). */ public final BoolList align = new BoolList(); /** Table contents. */ public final ArrayList contents = new ArrayList(); /** Data description; if available, will be added as footer. */ public String description; /** * Default constructor. */ public Table() { } /** * Constructor with table input. * @param in textual table input */ public Table(final String in) { if(in.isEmpty()) return; // parse table header final Scanner scan = new Scanner(in); byte[] line = token(scan.nextLine()); final IntList il = new IntList(); int i = 0; while(i < line.length) { il.add(i); // find next two spaces while(++i + 1 < line.length && (line[i] != ' ' || line[i + 1] != ' ')); header.add(substring(line, il.get(il.size() - 1), i)); while(++i < line.length && line[i] == ' '); } il.add(i); // skip delimiter scan.nextLine(); // parse table entries final int s = il.size() - 1; while((line = token(scan.nextLine())).length != 0) { final TokenList entry = new TokenList(); for(int e = 0; e < s; ++e) { entry.add(trim(substring(line, il.get(e), il.get(e + 1)))); } contents.add(entry); } } /** * Sorts the table by the first column. * @return self reference */ public Table sort() { Collections.sort(contents, new Comparator() { @Override public int compare(final TokenList tl1, final TokenList tl2) { return diff(lc(tl1.get(0)), lc(tl2.get(0))); } }); return this; } /** * Returns the value for the specified table position. * @param r row * @param c column * @return value */ public String value(final int r, final int c) { return string(contents.get(r).get(c)); } /** * Returns the number of rows. * @return number of rows */ public int rows() { return contents.size(); } /** * Returns the number of columns. * @return number of columns */ public int cols() { return header.size(); } /** * Moves the specified string to top. * @param top entry to be moved to the top * @return self reference */ public Table toTop(final byte[] top) { for(int i = 0; i < contents.size(); ++i) { if(eq(top, contents.get(i).get(0))) { contents.add(0, contents.remove(i)); break; } } return this; } /** * Returns a textual representation of the table. * @return text */ public byte[] finish() { final int[] ind = new int[header.size()]; final int sz = header.size(); for(int s = 0; s < sz; ++s) { for(final TokenList e : contents) { ind[s] = Math.max(ind[s], e.get(s).length); } ind[s] = Math.max(ind[s], header.get(s).length); } final TokenBuilder tb = new TokenBuilder(); for(int u = 0; u < sz; ++u) { final byte[] s = header.get(u); final int is = ind[u] - s.length + DIST; tb.add(s); for(int i = 0; i < is; ++i) tb.add(' '); } tb.add(NL); for(int u = 0; u < sz; ++u) { for(int i = 0; i < ind[u] + (u + 1 == sz ? 0 : DIST); ++i) tb.add('-'); } tb.add(NL); for(final TokenList e : contents) { for(int u = 0; u < sz; ++u) { final byte[] s = e.get(u); final int is = ind[u] - s.length; if(u < align.size() && align.get(u)) { for(int i = 0; i < is; ++i) tb.add(' '); tb.add(s); } else { tb.add(s); for(int i = 0; i < is; ++i) tb.add(' '); } for(int i = 0; i < DIST; ++i) tb.add(' '); } tb.add(NL); } if(description != null) { tb.add(NL).addExt(description, contents.size()).add(DOT); } return tb.finish(); } @Override public String toString() { final TokenBuilder tb = new TokenBuilder(); for(final byte[] b : header) { tb.add(b); tb.add('\t'); } tb.add(NL); for(final TokenList e : contents) { for(final byte[] b : e) { tb.add(b); tb.add('\t'); } } return tb.toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/Token.java000066400000000000000000001336741222453003200241150ustar00rootroot00000000000000package org.basex.util; import java.nio.charset.*; import java.security.*; import java.text.*; import java.util.*; /** *

This class provides convenience operations for handling 'Tokens'. * Tokens are UTF-8 encoded strings, stored in a byte array.

* *

Note that, to guarantee a consistent string representation, all string * conversions should be done via the methods of this class.

* * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Token { /** Maximum length for hash calculation. */ private static final byte MAXLENGTH = 96; /** Maximum values for converting tokens to integer values. */ private static final int MAXINT = Integer.MAX_VALUE / 10; /** Maximum values for converting tokens to long values. */ private static final long MAXLONG = Long.MAX_VALUE / 10; /** Empty token. */ public static final byte[] EMPTY = {}; /** XML token. */ public static final byte[] XML = token("xml"); /** XML token with colon. */ public static final byte[] XMLC = token("xml:"); /** XMLNS token. */ public static final byte[] XMLNS = token("xmlns"); /** XMLNS token with colon. */ public static final byte[] XMLNSC = token("xmlns:"); /** Token 'true'. */ public static final byte[] TRUE = token("true"); /** Token 'false'. */ public static final byte[] FALSE = token("false"); /** Token 'null'. */ public static final byte[] NULL = token("null"); /** Token 'NaN'. */ private static final byte[] NAN = token("NaN"); /** Token 'INF'. */ public static final byte[] INF = token("INF"); /** Token '-INF'. */ public static final byte[] NINF = token("-INF"); /** Space. */ public static final byte[] SPACE = { ' ' }; /** Number '0'. */ public static final byte[] ZERO = { '0' }; /** Number '-0'. */ private static final byte[] MZERO = { '-', '0' }; /** Number '1'. */ public static final byte[] ONE = { '1' }; /** Slash. */ public static final byte[] SLASH = { '/' }; /** Colon. */ public static final byte[] COLON = { ':' }; /** Hex codes. */ public static final byte[] HEX = token("0123456789ABCDEF"); /** Reserved characters. */ private static final byte[] IRIRES = token("!#$%&*'()+,-./:;=?@[]~_"); /** Reserved characters. */ private static final byte[] RES = token("-._~"); /** UTF8 encoding string. */ public static final String UTF8 = "UTF-8"; /** UTF8 encoding string (variant). */ public static final String UTF82 = "UTF8"; /** UTF16 encoding string. */ public static final String UTF16 = "UTF-16"; /** UTF16 encoding string. */ public static final String UTF162 = "UTF16"; /** UTF16BE (=UTF16) encoding string. */ public static final String UTF16BE = "UTF-16BE"; /** UTF16 encoding string. */ public static final String UTF16LE = "UTF-16LE"; /** UTF16 encoding string. */ public static final String UTF32 = "UTF-32"; /** UTF16 encoding string. */ public static final String UTF322 = "UTF32"; /** Comparator for byte arrays. */ public static final Comparator COMP = new Comparator() { @Override public int compare(final byte[] o1, final byte[] o2) { return diff(o1, o2); } }; /** Case-insensitive comparator for byte arrays. */ public static final Comparator LC_COMP = new Comparator() { @Override public int compare(final byte[] o1, final byte[] o2) { return diff(lc(o1), lc(o2)); } }; /** Hidden constructor. */ private Token() { } /** * Returns the specified token as string. * @param token token * @return string */ public static String string(final byte[] token) { return string(token, 0, token.length); } /** * Returns the specified token as string. * @param token token * @param start start position * @param length length * @return string */ public static String string(final byte[] token, final int start, final int length) { if(length <= 0) return ""; /// check if string contains non-ascii characters final int e = start + length; for(int p = start; p < e; ++p) if(token[p] < 0) return utf8(token, start, length); /// copy ascii characters to character array final char[] str = new char[length]; for(int p = 0; p < length; ++p) str[p] = (char) token[start + p]; return new String(str); } /** * Returns a string of the specified UTF8 token. * @param token token * @param start start position * @param length length * @return string */ private static String utf8(final byte[] token, final int start, final int length) { // input is assumed to be correct UTF8. if input contains codepoints // larger than Character.MAX_CODE_POINT, results might be unexpected. final StringBuilder sb = new StringBuilder(length << 1); final int il = Math.min(start + length, token.length); for(int i = start; i < il; i += cl(token, i)) { final int cp = cp(token, i); if(cp < Character.MIN_SUPPLEMENTARY_CODE_POINT) { sb.append((char) cp); } else { final int o = cp - Character.MIN_SUPPLEMENTARY_CODE_POINT; sb.append((char) ((o >>> 10) + Character.MIN_HIGH_SURROGATE)); sb.append((char) ((o & 0x3ff) + Character.MIN_LOW_SURROGATE)); } } return sb.toString(); } /** * Checks if the specified token only consists of ASCII characters. * @param token token * @return result of check */ public static boolean ascii(final byte[] token) { for(final byte t : token) if(t < 0) return false; return true; } /** * Converts a string to a byte array. * All strings should be converted by this function to guarantee * a consistent character conversion. * @param string string to be converted * @return byte array */ public static byte[] token(final String string) { final int l = string.length(); if(l == 0) return EMPTY; final byte[] b = new byte[l]; for(int i = 0; i < l; ++i) { final char c = string.charAt(i); if(c > 0x7F) return utf8(string); b[i] = (byte) c; } return b; } /** * Converts the specified strings to tokens. * @param strings strings * @return tokens */ public static byte[][] tokens(final String... strings) { final byte[][] t = new byte[strings.length][]; for(int i = 0; i < t.length; ++i) t[i] = token(strings[i]); return t; } /** * Converts a string to a UTF8 byte array. * @param string string to be converted * @return byte array */ private static byte[] utf8(final String string) { final char[] arr = string.toCharArray(); final int al = arr.length; final TokenBuilder tb = new TokenBuilder(al << 1); for(int c = 0; c < al; ++c) { final char ch = arr[c]; tb.add(Character.isHighSurrogate(ch) && c < al - 1 && Character.isLowSurrogate(arr[c + 1]) ? Character.toCodePoint(ch, arr[++c]) : ch); } return tb.finish(); } /** * Converts a token from the input encoding to UTF8. * @param token token to be converted * @return byte array * @param encoding input encoding */ public static byte[] utf8(final byte[] token, final String encoding) { // UTF8 (comparison by ref.) or no special characters: return input if(encoding == UTF8 || ascii(token)) return token; // convert to utf8. if errors occur while converting, an empty is returned. try { return token(new String(token, encoding)); } catch(final Exception ex) { Util.debug(ex); return EMPTY; } } /** * Returns a unified representation of the specified encoding. * @param encoding input encoding (UTF-8 is returned for a {@code null} reference) * @return encoding */ public static String normEncoding(final String encoding) { return normEncoding(encoding, null); } /** * Returns a unified representation of the specified encoding. * @param encoding input encoding (UTF-8 is returned for a {@code null} reference) * @param old previous encoding (optional) * @return encoding */ public static String normEncoding(final String encoding, final String old) { if(encoding == null) return UTF8; final String e = encoding.toUpperCase(Locale.ENGLISH); if(eq(e, UTF8, UTF82)) return UTF8; if(e.equals(UTF16BE)) return UTF16BE; if(e.equals(UTF16LE)) return UTF16LE; if(eq(e, UTF16, UTF162)) return old == UTF16BE || old == UTF16LE ? old : UTF16BE; if(eq(e, UTF32, UTF322)) return UTF32; return encoding; } /** * Checks if the specified encoding is supported. * @param encoding encoding * @return result of check */ public static boolean supported(final String encoding) { try { return Charset.isSupported(encoding); } catch(final IllegalArgumentException ex) { return false; } } /** * Returns the codepoint (unicode value) of the specified token, starting at * the specified position. Returns a unicode replacement character for invalid * values. * @param token token * @param pos character position * @return current character */ public static int cp(final byte[] token, final int pos) { // 0xxxxxxx final byte v = token[pos]; if((v & 0xFF) < 192) return v & 0xFF; // number of bytes to be read final int vl = cl(v); if(pos + vl > token.length) return 0xFFFD; // 110xxxxx 10xxxxxx if(vl == 2) return (v & 0x1F) << 6 | token[pos + 1] & 0x3F; // 1110xxxx 10xxxxxx 10xxxxxx if(vl == 3) return (v & 0x0F) << 12 | (token[pos + 1] & 0x3F) << 6 | token[pos + 2] & 0x3F; // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx return (v & 0x07) << 18 | (token[pos + 1] & 0x3F) << 12 | (token[pos + 2] & 0x3F) << 6 | token[pos + 3] & 0x3F; } /** Character lengths. */ private static final int[] CHLEN = { 1, 1, 1, 1, 2, 2, 3, 4 }; /** * Returns the length of the specified UTF8 byte. * @param cp codepoint * @return character length */ public static int cl(final byte cp) { return cp >= 0 ? 1 : CHLEN[cp >> 4 & 0x7]; } /** * Returns the length of a UTF8 character at the specified position. * @param token token * @param pos position * @return character length */ public static int cl(final byte[] token, final int pos) { return cl(token[pos]); } /** * Converts a token to a sequence of codepoints. * @param token token * @return codepoints */ public static int[] cps(final byte[] token) { int pos = 0; final int len = token.length; final int[] cp = new int[len]; for(int i = 0; i < len; i += cl(token, i)) cp[pos++] = cp(token, i); return pos < len ? Arrays.copyOf(cp, pos) : cp; } /** * Returns the token length. * @param token token * @return length */ public static int len(final byte[] token) { int l = 0; for(int t = 0; t < token.length; t += cl(token, t)) ++l; return l; } /** * Creates a byte array representation of the specified boolean value. * @param bool boolean value to be converted * @return boolean value in byte array */ public static byte[] token(final boolean bool) { return bool ? TRUE : FALSE; } /** * Creates a byte array representation of the specified integer value. * @param integer int value to be converted * @return integer value in byte array */ public static byte[] token(final int integer) { if(integer == 0) return ZERO; if(integer == Integer.MIN_VALUE) return MININT; int n = integer; final boolean m = n < 0; if(m) n = -n; int j = numDigits(n); if(m) ++j; final byte[] num = new byte[j]; // faster division by 10 for values < 81920 (see Integer.getChars) while(n > 81919) { final int q = n / 10; num[--j] = (byte) (n - (q << 3) - (q << 1) + '0'); n = q; } while(n != 0) { final int q = n * 52429 >>> 19; num[--j] = (byte) (n - (q << 3) - (q << 1) + '0'); n = q; } if(m) num[--j] = '-'; return num; } /** * Checks number of digits of the specified integer. * @param integer number to be checked * @return number of digits */ public static int numDigits(final int integer) { for(int i = 0;; ++i) if(integer <= INTSIZE[i]) return i + 1; } /** Minimum integer. */ private static final byte[] MININT = token("-2147483648"); /** Table with integer sizes. */ private static final int[] INTSIZE = { 9, 99, 999, 9999, 99999, 999999, 9999999, 99999999, 999999999, Integer.MAX_VALUE }; /** * Creates a byte array representation from the specified long value, * using Java's standard method. * @param integer value to be converted * @return byte array */ public static byte[] token(final long integer) { return integer >= Integer.MIN_VALUE && integer <= Integer.MAX_VALUE ? token((int) integer) : token(Long.toString(integer)); } /** US charset. */ private static final DecimalFormatSymbols LOC = new DecimalFormatSymbols(Locale.US); /** Scientific double output. */ private static final DecimalFormat SD = new DecimalFormat("0.0##################E0", LOC); /** Decimal double output. */ private static final DecimalFormat DD = new DecimalFormat("#####0.0################", LOC); /** Scientific float output. */ private static final DecimalFormat SF = new DecimalFormat("0.0######E0", LOC); /** Decimal float output. */ private static final DecimalFormat DF = new DecimalFormat("#####0.0######", LOC); /** * Creates a byte array representation from the specified double value; * inspired by Xavier Franc's Qizx/open processor. * @param dbl double value to be converted * @return byte array */ public static byte[] token(final double dbl) { final byte[] b = tok(dbl); if(b != null) return b; final double a = Math.abs(dbl); return chopNumber(token(a >= 1e-6 && a < 1e6 ? DD.format(dbl) : SD.format(dbl))); } /** * Creates a byte array representation from the specified float value. * @param flt float value to be converted * @return byte array */ public static byte[] token(final float flt) { final byte[] b = tok(flt); if(b != null) return b; // not that brilliant here.. no chance for elegant code either // due to the nifty differences between Java and XQuery for(int i = 0; i < FLT.length; ++i) if(flt == FLT[i]) return FLTSTR[i]; final float a = Math.abs(flt); final boolean small = a >= 1e-6f && a < 1e6f; String s1 = small ? DF.format(flt) : SF.format(flt); final String s2 = Float.toString(flt); if(s2.length() < s1.length() && (!s2.contains("E") || !small)) s1 = s2; return chopNumber(token(s1)); } /** * Checks if the specified value equals a constant token. * @param dbl value to be converted * @return byte array or zero, or {@code null} */ private static byte[] tok(final double dbl) { if(dbl == Double.POSITIVE_INFINITY) return INF; if(dbl == Double.NEGATIVE_INFINITY) return NINF; if(dbl == 0) return 1 / dbl > 0 ? ZERO : MZERO; if(Double.isNaN(dbl)) return NAN; final double a = Math.abs(dbl); if(a < 1e6) { final int i = (int) dbl; if(i == dbl) return token(i); } return null; } /** * Finishes the numeric token, removing trailing zeroes. * @param token token to be modified * @return token */ public static byte[] chopNumber(final byte[] token) { if(!contains(token, '.') || contains(token, 'e') || contains(token, 'E')) return token; // remove trailing zeroes int l = token.length; while(--l > 0 && token[l] == '0'); return substring(token, 0, token[l] == '.' ? l : l + 1); } /** Constant float values. */ private static final float[] FLT = { 1.0E17f, 1.0E15f, 1.0E13f, 1.0E11f, -1.0E17f, -1.0E15f, -1.0E13f, -1.0E11f }; /** String representations of float values. */ private static final byte[][] FLTSTR = tokens("1.0E17", "1.0E15", "1.0E13", "1.0E11", "-1.0E17", "-1.0E15", "-1.0E13", "-1.0E11"); /** * Converts the specified token into a double value. * {@link Double#NaN} is returned if the input is invalid. * @param token token to be converted * @return resulting double value */ public static double toDouble(final byte[] token) { final int tl = token.length; boolean f = false; for(final int t : token) { if(t >= 0 && t <= ' ' || digit(t)) continue; f = t == 'e' || t == 'E' || t == '.' || t == '-'; if(!f) return Double.NaN; } if(f || tl > 9) return dbl(token); final int d = toInt(token); return d == Integer.MIN_VALUE ? Double.NaN : d; } /** * Converts the specified token into a double value. * {@link Double#NaN} is returned when the input is invalid. * @param token token to be converted * @return resulting double value */ private static double dbl(final byte[] token) { try { return Double.parseDouble(string(token)); } catch(final Exception ex) { return Double.NaN; } } /** * Converts the specified string into an long value. * {@link Long#MIN_VALUE} is returned when the input is invalid. * @param string string to be converted * @return resulting long value */ public static long toLong(final String string) { return toLong(token(string)); } /** * Converts the specified token into an long value. * {@link Long#MIN_VALUE} is returned when the input is invalid. * @param token token to be converted * @return resulting long value */ public static long toLong(final byte[] token) { return toLong(token, 0, token.length); } /** * Converts the specified token into an long value. * {@link Long#MIN_VALUE} is returned when the input is invalid. * @param token token to be converted * @param start first byte to be parsed * @param end last byte to be parsed - exclusive * @return resulting long value */ public static long toLong(final byte[] token, final int start, final int end) { int t = start; while(t < end && token[t] <= ' ') ++t; if(t == end) return Long.MIN_VALUE; boolean m = false; if(token[t] == '-' || token[t] == '+') m = token[t++] == '-'; if(t == end) return Long.MIN_VALUE; long v = 0; for(; t < end; ++t) { final byte c = token[t]; if(c < '0' || c > '9') break; if(v >= MAXLONG && (c > '7' || v > MAXLONG)) return Long.MIN_VALUE; v = (v << 3) + (v << 1) + c - '0'; } while(t < end && token[t] <= ' ') ++t; return t < end ? Long.MIN_VALUE : m ? -v : v; } /** * Converts the specified string into an integer value. * {@link Integer#MIN_VALUE} is returned when the input is invalid. * @param string string to be converted * @return resulting integer value */ public static int toInt(final String string) { return toInt(token(string)); } /** * Converts the specified token into an integer value. * {@link Integer#MIN_VALUE} is returned when the input is invalid. * @param token token to be converted * @return resulting integer value */ public static int toInt(final byte[] token) { return toInt(token, 0, token.length); } /** * Converts the specified token into an integer value. * {@link Integer#MIN_VALUE} is returned when the input is invalid. * @param token token to be converted * @param start first byte to be parsed * @param end last byte to be parsed (exclusive) * @return resulting integer value */ public static int toInt(final byte[] token, final int start, final int end) { int t = start; while(t < end && token[t] <= ' ') ++t; if(t == end) return Integer.MIN_VALUE; boolean m = false; if(token[t] == '-' || token[t] == '+') m = token[t++] == '-'; if(t == end) return Integer.MIN_VALUE; int v = 0; for(; t < end; ++t) { final byte c = token[t]; if(c < '0' || c > '9') break; if(v >= MAXINT && (c > '7' || v > MAXINT)) return Integer.MIN_VALUE; v = (v << 3) + (v << 1) + c - '0'; } while(t < end && token[t] <= ' ') ++t; return t < end || v < 0 ? Integer.MIN_VALUE : m ? -v : v; } /** * Converts the specified token into a positive integer value. * {@link Integer#MIN_VALUE} is returned if non-digits are found * or if the input is longer than nine characters. * @param token token to be converted * @return resulting integer value */ public static int toSimpleInt(final byte[] token) { final int te = token.length; if(te >= 10 || te == 0) return Integer.MIN_VALUE; if(token[0] == '0') return te == 1 ? 0 : Integer.MIN_VALUE; int v = 0; for(final byte c : token) { if(c < '0' || c > '9') return Integer.MIN_VALUE; v = (v << 3) + (v << 1) + c - '0'; } return v; } /** * Calculates a hash code for the specified token. * @param token specified token * @return hash code */ public static int hash(final byte[] token) { int h = 0; final int l = Math.min(token.length, MAXLENGTH); for(int i = 0; i != l; ++i) h = (h << 5) - h + token[i]; return h; } /** * Compares two tokens for equality. * @param token1 first token * @param token2 token to be compared * @return true if the arrays are equal */ public static boolean eq(final byte[] token1, final byte[] token2) { final int tl = token2.length; if(tl != token1.length) return false; for(int t = 0; t != tl; ++t) if(token2[t] != token1[t]) return false; return true; } /** * Compares several tokens for equality. * @param token token * @param tokens tokens to be compared * @return true if one test is successful */ public static boolean eq(final byte[] token, final byte[]... tokens) { for(final byte[] t : tokens) if(eq(token, t)) return true; return false; } /** * Compares several strings for equality. * @param str first string * @param strings strings to be compared * @return true if one test is successful */ public static boolean eq(final String str, final String... strings) { for(final String s : strings) { if(str == null ? s == null : str.equals(s)) return true; } return false; } /** * Compares several strings for equality, ignoring the case. * @param str first string * @param strings strings to be compared * @return true if one test is successful */ public static boolean eqic(final String str, final String... strings) { for(final String s : strings) { if(str == null ? s == null : str.equalsIgnoreCase(s)) return true; } return false; } /** * Compares two tokens lexicographically. * @param token first token * @param compare token to be compared * @return 0 if tokens are equal, negative if first token is smaller, * positive if first token is bigger */ public static int diff(final byte[] token, final byte[] compare) { final int tl = token.length; final int cl = compare.length; final int l = Math.min(tl, cl); for(int i = 0; i < l; ++i) { final int c = (token[i] & 0xFF) - (compare[i] & 0xFF); if(c != 0) return c; } return tl - cl; } /** * Returns the smaller token. * @param token first token * @param compare token to be compared * @return smaller token */ public static byte[] min(final byte[] token, final byte[] compare) { return diff(token, compare) < 0 ? token : compare; } /** * Returns the bigger token. * @param token first token * @param compare token to be compared * @return bigger token */ public static byte[] max(final byte[] token, final byte[] compare) { return diff(token, compare) > 0 ? token : compare; } /** * Checks if the first token contains the second token. * @param token token * @param sub token to be found * @return result of test */ public static boolean contains(final byte[] token, final byte[] sub) { return indexOf(token, sub) != -1; } /** * Checks if the first token contains the specified character. * @param token token * @param c character to be found * @return result of test */ public static boolean contains(final byte[] token, final int c) { return indexOf(token, c) != -1; } /** * Returns the position of the specified character or -1. * @param token token * @param c character to be found * @return position or {@code -1} */ public static int indexOf(final byte[] token, final int c) { final int tl = token.length; if(c < 128) { for(int t = 0; t < tl; t++) if(token[t] == c) return t; } else { for(int t = 0; t < tl; t += cl(token, t)) if(cp(token, t) == c) return t; } return -1; } /** * Returns the last position of the specified character or -1. * @param token token * @param c character to be found * @return position or {@code -1} */ public static int lastIndexOf(final byte[] token, final int c) { final int tl = token.length; int p = -1; if(c < 128) { for(int t = tl - 1; t >= 0; --t) if(token[t] == c) return t; } else { for(int t = 0; t < tl; t += cl(token, t)) if(cp(token, t) == c) p = t; } return p; } /** * Returns the position of the specified token or -1. * @param token token * @param sub token to be found * @return position or {@code -1} */ public static int indexOf(final byte[] token, final byte[] sub) { return indexOf(token, sub, 0); } /** * Returns the position of the specified token or -1. * @param token token * @param sub token to be found * @param pos start position * @return result of test */ public static int indexOf(final byte[] token, final byte[] sub, final int pos) { final int sl = sub.length; if(sl == 0) return 0; final int tl = token.length - sl; if(pos > tl) return -1; // compare tokens character wise for(int t = pos; t <= tl; ++t) { int s = 0; while(sub[s] == token[t + s]) if(++s == sl) return t; } return -1; } /** * Checks if the first token starts with the specified character. * @param token token * @param ch character to be found * @return result of test */ public static boolean startsWith(final byte[] token, final int ch) { return token.length != 0 && token[0] == ch; } /** * Checks if the first token starts with the second token. * @param token token * @param sub token to be found * @return result of test */ public static boolean startsWith(final byte[] token, final byte[] sub) { final int sl = sub.length; if(sl > token.length) return false; for(int s = 0; s < sl; ++s) if(sub[s] != token[s]) return false; return true; } /** * Checks if the first token starts with the specified character. * @param token token * @param ch character to be bound * @return result of test */ public static boolean endsWith(final byte[] token, final int ch) { return token.length != 0 && token[token.length - 1] == ch; } /** * Checks if the first token ends with the second token. * @param token token * @param sub token to be found * @return result of test */ public static boolean endsWith(final byte[] token, final byte[] sub) { final int sl = sub.length; final int tl = token.length; if(sl > tl) return false; for(int s = sl; s > 0; s--) if(sub[sl - s] != token[tl - s]) return false; return true; } /** * Returns a substring of the specified token. * Note that this method does not correctly split UTF8 character; * use {@link #subtoken} instead. * @param token input token * @param start start position * @return substring */ public static byte[] substring(final byte[] token, final int start) { return substring(token, start, token.length); } /** * Returns a substring of the specified token. * Note that this method does not correctly split UTF8 character; * use {@link #subtoken} instead. * @param token input token * @param start start position * @param end end position * @return substring */ public static byte[] substring(final byte[] token, final int start, final int end) { final int s = Math.max(0, start); final int e = Math.min(end, token.length); if(s == 0 && e == token.length) return token; return s >= e ? EMPTY : Arrays.copyOfRange(token, s, e); } /** * Returns a partial token. * @param token input token * @param start start position * @return resulting text */ public static byte[] subtoken(final byte[] token, final int start) { return subtoken(token, start, token.length); } /** * Returns a partial token. * @param token input text * @param start start position * @param end end position * @return resulting text */ public static byte[] subtoken(final byte[] token, final int start, final int end) { int s = Math.max(0, start); final int e = Math.min(end, token.length); if(s == 0 && e == token.length) return token; if(s >= e) return EMPTY; int t = Math.max(0, s - 4); for(; t != s && t < e; t += cl(token, t)) { if(t >= s) s = t; } for(; t < e; t += cl(token, t)); return Arrays.copyOfRange(token, s, t); } /** * Splits a token around matches of the given separator. * @param token token to be split * @param sep separation character * @return array */ public static byte[][] split(final byte[] token, final int sep) { final int l = token.length; final byte[][] split = new byte[l][]; int s = 0; final TokenBuilder tb = new TokenBuilder(); for(int i = 0; i < l; i += cl(token, i)) { final int c = cp(token, i); if(c == sep) { if(!tb.isEmpty()) { split[s++] = tb.finish(); tb.reset(); } } else { tb.add(c); } } if(!tb.isEmpty()) split[s++] = tb.finish(); return Array.copyOf(split, s); } /** * Performs a regular expression on the specified string. * @param token token to match * @param pattern regular expression * @param replace replacement string * @return resulting string */ public static byte[] replaceAll(final byte[] token, final String pattern, final String replace) { return token(string(token).replaceAll(pattern, replace)); } /** * Checks if the specified token has only whitespaces. * @param token token * @return true if all characters are whitespaces */ public static boolean ws(final byte[] token) { for(final byte t : token) if(t < 0 || t > ' ') return false; return true; } /** * Replaces the specified character and returns the result token. * @param token token to be checked * @param search the character to be replaced * @param replace the new character * @return resulting token */ public static byte[] replace(final byte[] token, final int search, final int replace) { final TokenBuilder tb = new TokenBuilder(token.length); final int tl = token.length; for(int i = 0; i < tl; i += cl(token, i)) { final int c = cp(token, i); tb.add(c == search ? replace : c); } return tb.finish(); } /** * Removes leading and trailing whitespaces from the specified token. * @param token token to be trimmed * @return trimmed token */ public static byte[] trim(final byte[] token) { int s = -1; int e = token.length; while(++s < e) if(token[s] > ' ' || token[s] < 0) break; while(--e > s) if(token[e] > ' ' || token[e] < 0) break; if(++e == token.length && s == 0) return token; return s == e ? EMPTY : Arrays.copyOfRange(token, s, e); } /** * Chops a token to the specified length and adds dots. * @param token token to be chopped * @param max maximum length * @return chopped token */ public static byte[] chop(final byte[] token, final int max) { if(token.length <= max) return token; final byte[] tt = Arrays.copyOf(token, max); if(max > 2) tt[max - 3] = '.'; if(max > 1) tt[max - 2] = '.'; if(max > 0) tt[max - 1] = '.'; return tt; } /** * Concatenates two tokens. * @param token1 first token * @param token2 second token * @return resulting array */ public static byte[] concat(final byte[] token1, final byte[] token2) { final int t1 = token1.length; final int t2 = token2.length; final byte[] tmp = new byte[t1 + t2]; System.arraycopy(token1, 0, tmp, 0, t1); System.arraycopy(token2, 0, tmp, t1, t2); return tmp; } /** * Concatenates three tokens. A {@link TokenBuilder} instance can be used to * concatenate more than three tokens. * @param token1 first token * @param token2 second token * @param token3 third token * @return resulting array */ public static byte[] concat(final byte[] token1, final byte[] token2, final byte[] token3) { final int t1 = token1.length; final int t2 = token2.length; final int t3 = token3.length; final byte[] tmp = new byte[t1 + t2 + t3]; System.arraycopy(token1, 0, tmp, 0, t1); System.arraycopy(token2, 0, tmp, t1, t2); System.arraycopy(token3, 0, tmp, t1 + t2, t3); return tmp; } /** * Deletes the specified character from the token. * @param token token * @param ch character to be removed * @return resulting token */ public static byte[] delete(final byte[] token, final int ch) { // skip step if specified ascii character is not contained if(ch < 0x80 && !contains(token, ch)) return token; // remove character final TokenBuilder tb = new TokenBuilder(token.length); final int tl = token.length; for(int i = 0; i < tl; i += cl(token, i)) { final int c = cp(token, i); if(c != ch) tb.add(c); } return tb.finish(); } /** * Normalizes all whitespace occurrences from the specified token. * @param token token * @return normalized token */ public static byte[] norm(final byte[] token) { final int l = token.length; final byte[] tmp = new byte[l]; int c = 0; boolean ws1 = true; for(final byte t : token) { final boolean ws2 = ws(t); if(ws2 && ws1) continue; tmp[c++] = ws2 ? (byte) ' ' : t; ws1 = ws2; } if(c > 0 && ws(tmp[c - 1])) --c; return c == l ? tmp : Arrays.copyOf(tmp, c); } /** * Checks if the specified character is a whitespace. * @param ch the letter to be checked * @return result of check */ public static boolean ws(final int ch) { return ch == 0x09 || ch == 0x0A || ch == 0x0D || ch == 0x20; } /** * Checks if the specified character is a computer letter (A - Z, a - z, _). * @param ch the letter to be checked * @return result of check */ public static boolean letter(final int ch) { return ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'z' || ch == '_'; } /** * Checks if the specified character is a digit (0 - 9). * @param ch the letter to be checked * @return result of check */ public static boolean digit(final int ch) { return ch >= '0' && ch <= '9'; } /** * Checks if the specified character is a computer letter or digit. * @param ch the letter to be checked * @return result of check */ public static boolean letterOrDigit(final int ch) { return letter(ch) || digit(ch); } /** * Returns true if the specified character is a full-text letter or digit. * @param ch character to be tested * @return result of check */ public static boolean ftChar(final int ch) { return ch >= '0' && (ch < 0x80 ? LOD[ch - '0'] : Character.isLetterOrDigit(ch)); } /** Letter-or-digit table for ASCII codes larger than '0'. */ private static final boolean[] LOD = { true, true, true, true, true, true, true, true, true, true, false, false, false, false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false, false }; /** * Converts the specified token to upper case. * @param token token to be converted * @return resulting token */ public static byte[] uc(final byte[] token) { if(ascii(token)) { final byte[] tok = new byte[token.length]; for(int i = 0; i < token.length; ++i) tok[i] = (byte) uc(token[i]); return tok; } return token(string(token).toUpperCase(Locale.ENGLISH)); } /** * Converts a character to upper case. * @param ch character to be converted * @return resulting character */ public static int uc(final int ch) { return ch >= 'a' && ch <= 'z' ? ch - 0x20 : ch > 0x7F ? Character.toUpperCase(ch) : ch; } /** * Converts the specified token to lower case. * @param token token to be converted * @return resulting token */ public static byte[] lc(final byte[] token) { if(ascii(token)) { final byte[] tok = new byte[token.length]; for(int i = 0; i < token.length; ++i) tok[i] = (byte) lc(token[i]); return tok; } return token(string(token).toLowerCase(Locale.ENGLISH)); } /** * Converts a character to lower case. * @param ch character to be converted * @return resulting character */ public static int lc(final int ch) { return ch >= 'A' && ch <= 'Z' ? ch | 0x20 : ch > 0x7F ? Character.toLowerCase(ch) : ch; } /** * Returns the prefix of the specified token. * @param name name * @return prefix or empty token if no prefix exists */ public static byte[] prefix(final byte[] name) { final int i = indexOf(name, ':'); return i == -1 ? EMPTY : substring(name, 0, i); } /** * Returns the local name of the specified name. * @param name name * @return local name */ public static byte[] local(final byte[] name) { final int i = indexOf(name, ':'); return i == -1 ? name : substring(name, i + 1); } /** * Returns a URI encoded token. * @param token token * @param iri input * @return encoded token */ public static byte[] uri(final byte[] token, final boolean iri) { final TokenBuilder tb = new TokenBuilder(); for(final byte t : token) { if(letterOrDigit(t) || contains(iri ? IRIRES : RES, t)) tb.addByte(t); else hex(tb, t); } return tb.finish(); } /** * Escapes the specified token. * @param token token * @return escaped token */ public static byte[] escape(final byte[] token) { final TokenBuilder tb = new TokenBuilder(); for(final byte t : token) { if(t >= 0x20 && t <= 0x7e) tb.addByte(t); else hex(tb, t); } return tb.finish(); } /** * Adds the specified byte in hex code. * @param tb token builder * @param b byte to be added */ private static void hex(final TokenBuilder tb, final byte b) { tb.add('%'); tb.addByte(HEX[(b & 0xFF) >> 4]); tb.addByte(HEX[b & 0xFF & 15]); } /** * Returns an MD5 hash in lower case. * @param string string to be hashed * @return md5 hash */ public static String md5(final String string) { try { final MessageDigest md = MessageDigest.getInstance("MD5"); return string(hex(md.digest(token(string)), false)); } catch(final Exception ex) { throw Util.notexpected(ex); } } /** * Returns a hex representation of the specified byte array. * @param val values to be mapped * @param uc upper case * @return hex representation */ public static byte[] hex(final byte[] val, final boolean uc) { final int u = uc ? 0x37 : 0x57; final byte[] data = new byte[val.length << 1]; for(int d = 0, c = 0; d < val.length; d++) { int b = val[d] >> 4 & 0x0F; data[c++] = (byte) (b + (b > 9 ? u : '0')); b = val[d] & 0x0F; data[c++] = (byte) (b + (b > 9 ? u : '0')); } return data; } /** * Returns a normalized character without diacritics. * This method supports all latin1 characters, including supplements. * @param ch character to be normalized * @return resulting character */ public static int norm(final int ch) { return ch < 0x80 || ch >= 0x400 ? ch : ch()[ch]; } /** * Initializes the array of normalized characters. * @return normalization array */ private static synchronized char[] ch() { if(norm == null) { // will only be initialized if needed norm = new char[0x400]; for(int n = 0; n < norm.length; ++n) norm[n] = (char) n; for(final char[] aNC : NC) norm[aNC[0]] = aNC[1]; } return norm; } /** Mapping table for character normalization. */ private static char[] norm; /** Normalized characters. */ private static final char[][] NC = { { '\u00C0', 'A' }, { '\u00C1', 'A' }, { '\u00C2', 'A' }, { '\u00C3', 'A' }, { '\u00C4', 'A' }, { '\u00C5', 'A' }, { '\u00C6', 'A' }, { '\u00C7', 'C' }, { '\u00C8', 'E' }, { '\u00C9', 'E' }, { '\u00CA', 'E' }, { '\u00CB', 'E' }, { '\u00CC', 'I' }, { '\u00CD', 'I' }, { '\u00CE', 'I' }, { '\u00CF', 'I' }, { '\u00D0', 'D' }, { '\u00D1', 'N' }, { '\u00D2', 'O' }, { '\u00D3', 'O' }, { '\u00D4', 'O' }, { '\u00D5', 'O' }, { '\u00D6', 'O' }, { '\u00D8', 'O' }, { '\u00D9', 'U' }, { '\u00DA', 'U' }, { '\u00DB', 'U' }, { '\u00DC', 'U' }, { '\u00DD', 'Y' }, { '\u00DE', 'd' }, { '\u00DF', 's' }, { '\u00E0', 'a' }, { '\u00E1', 'a' }, { '\u00E2', 'a' }, { '\u00E3', 'a' }, { '\u00E4', 'a' }, { '\u00E5', 'a' }, { '\u00E6', 'a' }, { '\u00E7', 'c' }, { '\u00E8', 'e' }, { '\u00E9', 'e' }, { '\u00EA', 'e' }, { '\u00EB', 'e' }, { '\u00EC', 'i' }, { '\u00ED', 'i' }, { '\u00EE', 'i' }, { '\u00EF', 'i' }, { '\u00F0', 'd' }, { '\u00F1', 'n' }, { '\u00F2', 'o' }, { '\u00F3', 'o' }, { '\u00F4', 'o' }, { '\u00F5', 'o' }, { '\u00F6', 'o' }, { '\u00F8', 'o' }, { '\u00F9', 'u' }, { '\u00FA', 'u' }, { '\u00FB', 'u' }, { '\u00FC', 'u' }, { '\u00FD', 'y' }, { '\u00FE', 'd' }, { '\u00FF', 'y' }, { '\u0100', 'A' }, { '\u0101', 'a' }, { '\u0102', 'A' }, { '\u0103', 'a' }, { '\u0104', 'A' }, { '\u0105', 'a' }, { '\u0106', 'C' }, { '\u0107', 'c' }, { '\u0108', 'C' }, { '\u0109', 'c' }, { '\u010A', 'C' }, { '\u010B', 'c' }, { '\u010C', 'C' }, { '\u010D', 'c' }, { '\u010E', 'D' }, { '\u010F', 'd' }, { '\u0110', 'D' }, { '\u0111', 'd' }, { '\u0112', 'E' }, { '\u0113', 'e' }, { '\u0114', 'E' }, { '\u0115', 'e' }, { '\u0116', 'E' }, { '\u0117', 'e' }, { '\u0118', 'E' }, { '\u0119', 'e' }, { '\u011A', 'E' }, { '\u011B', 'e' }, { '\u011C', 'G' }, { '\u011D', 'g' }, { '\u011E', 'G' }, { '\u011F', 'g' }, { '\u0120', 'G' }, { '\u0121', 'g' }, { '\u0122', 'G' }, { '\u0123', 'g' }, { '\u0124', 'H' }, { '\u0125', 'h' }, { '\u0126', 'H' }, { '\u0127', 'h' }, { '\u0128', 'I' }, { '\u0129', 'i' }, { '\u012A', 'I' }, { '\u012B', 'i' }, { '\u012C', 'I' }, { '\u012D', 'i' }, { '\u012E', 'I' }, { '\u012F', 'i' }, { '\u0130', 'I' }, { '\u0131', 'i' }, { '\u0132', 'I' }, { '\u0133', 'i' }, { '\u0134', 'J' }, { '\u0135', 'j' }, { '\u0136', 'K' }, { '\u0137', 'k' }, { '\u0138', 'k' }, { '\u0139', 'L' }, { '\u013A', 'l' }, { '\u013B', 'L' }, { '\u013C', 'l' }, { '\u013D', 'L' }, { '\u013E', 'l' }, { '\u013F', 'L' }, { '\u0140', 'l' }, { '\u0141', 'L' }, { '\u0142', 'l' }, { '\u0143', 'N' }, { '\u0144', 'n' }, { '\u0145', 'N' }, { '\u0146', 'n' }, { '\u0147', 'N' }, { '\u0148', 'n' }, { '\u0149', 'n' }, { '\u014A', 'N' }, { '\u014B', 'n' }, { '\u014C', 'O' }, { '\u014D', 'o' }, { '\u014E', 'O' }, { '\u014F', 'o' }, { '\u0150', 'O' }, { '\u0151', 'o' }, { '\u0152', 'O' }, { '\u0153', 'o' }, { '\u0154', 'R' }, { '\u0155', 'r' }, { '\u0156', 'R' }, { '\u0157', 'r' }, { '\u0158', 'R' }, { '\u0159', 'r' }, { '\u015A', 'S' }, { '\u015B', 's' }, { '\u015C', 'S' }, { '\u015D', 's' }, { '\u015E', 'S' }, { '\u015F', 's' }, { '\u0160', 'S' }, { '\u0161', 's' }, { '\u0162', 'T' }, { '\u0163', 't' }, { '\u0164', 'T' }, { '\u0165', 't' }, { '\u0166', 'T' }, { '\u0167', 't' }, { '\u0168', 'U' }, { '\u0169', 'u' }, { '\u016A', 'U' }, { '\u016B', 'u' }, { '\u016C', 'U' }, { '\u016D', 'u' }, { '\u016E', 'U' }, { '\u016F', 'u' }, { '\u0170', 'U' }, { '\u0171', 'u' }, { '\u0172', 'U' }, { '\u0173', 'u' }, { '\u0174', 'W' }, { '\u0175', 'w' }, { '\u0176', 'Y' }, { '\u0177', 'y' }, { '\u0178', 'Y' }, { '\u0179', 'Z' }, { '\u017A', 'z' }, { '\u017B', 'Z' }, { '\u017C', 'z' }, { '\u017D', 'Z' }, { '\u017E', 'z' }, { '\u01FA', 'A' }, { '\u01FB', 'a' }, { '\u01FC', 'A' }, { '\u01FD', 'a' }, { '\u01FE', 'O' }, { '\u01FF', 'o' }, // Greek characters {'\u0390', '\u03B9'}, {'\u03B0', '\u03C5'}, {'\u03D3', '\u03A5'}, {'\u03D4', '\u03A5'}, {'\u0386', '\u0391'}, {'\u0388', '\u0395'}, {'\u0389', '\u0397'}, {'\u038A', '\u0399'}, {'\u03AA', '\u0399'}, {'\u03CA', '\u03B9'}, {'\u03AB', '\u03A5'}, {'\u03CB', '\u03C5'}, {'\u038C', '\u039F'}, {'\u03AC', '\u03B1'}, {'\u03CC', '\u03BF'}, {'\u03AD', '\u03B5'}, {'\u03CD', '\u03C5'}, {'\u038E', '\u03A5'}, {'\u03AE', '\u03B7'}, {'\u03CE', '\u03C9'}, {'\u038F', '\u03A9'}, {'\u03AF', '\u03B9'} }; } basex-7.7.2/basex-core/src/main/java/org/basex/util/TokenBuilder.java000066400000000000000000000243741222453003200254200ustar00rootroot00000000000000package org.basex.util; import static org.basex.util.Token.*; import java.util.*; import org.basex.util.list.*; /** * This class serves as an efficient constructor for {@link Token Tokens}. * It bears some resemblance to Java's {@link StringBuilder}. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class TokenBuilder { /** Half new line. */ public static final byte HLINE = 0x01; /** Bold flag. */ public static final byte BOLD = 0x02; /** Standard flag. */ public static final byte NORM = 0x03; /** Mark flag. */ public static final byte MARK = 0x04; /** Underline flag. */ public static final byte ULINE = 0x05; /** New line. */ public static final byte NLINE = 0x0A; /** Byte array, storing all characters as UTF8. */ private byte[] chars; /** Current token size. */ private int size; /** * Empty constructor. */ public TokenBuilder() { this(Array.CAPACITY); } /** * Constructor, specifying an initial internal array size. * @param capacity initial array capacity */ public TokenBuilder(final int capacity) { chars = new byte[capacity]; } /** * Constructor, specifying an initial string. * @param string initial string */ public TokenBuilder(final String string) { this(token(string)); } /** * Constructor, specifying an initial token. * @param token initial token */ public TokenBuilder(final byte[] token) { this(token.length + Array.CAPACITY); size = token.length; System.arraycopy(token, 0, chars, 0, size); } /** * Returns the number of bytes. * @return number of bytes */ public int size() { return size; } /** * Sets the number of bytes. Note that no bound check is performed by this method. * @param s number of bytes */ public void size(final int s) { size = s; } /** * Tests if the token is empty. * @return result of check */ public boolean isEmpty() { return size == 0; } /** * Resets the token buffer. * @return self reference */ public TokenBuilder reset() { size = 0; return this; } /** * Adds a bold flag. This method should only be called to control text * rendering in the visual front end. * @return self reference */ public TokenBuilder bold() { return addByte(BOLD); } /** * Adds an underline toggle flag. This method should only be called to control text * rendering in the visual front end. * @return self reference */ public TokenBuilder uline() { return addByte(ULINE); } /** * Adds a norm flag. This method should only be called to control text * rendering in the visual front end. * @return self reference */ public TokenBuilder norm() { return addByte(NORM); } /** * Adds a new line. This method should only be called to control text * rendering in the visual front end. * @return self reference */ public TokenBuilder nline() { return addByte(NLINE); } /** * Adds a half new line. This method should only be called to control text * rendering in the visual front end. * @return self reference */ public TokenBuilder hline() { return addByte(HLINE); } /** * Adds the specified UTF8 codepoint. * @param cp the codepoint to be added * @return self reference */ public TokenBuilder add(final int cp) { if(cp <= 0x7F) { addByte((byte) cp); } else if(cp <= 0x7FF) { addByte((byte) (cp >> 6 & 0x1F | 0xC0)); addByte((byte) (cp & 0x3F | 0x80)); } else if(cp <= 0xFFFF) { addByte((byte) (cp >> 12 & 0x0F | 0xE0)); addByte((byte) (cp >> 6 & 0x3F | 0x80)); addByte((byte) (cp & 0x3F | 0x80)); } else { addByte((byte) (cp >> 18 & 0x07 | 0xF0)); addByte((byte) (cp >> 12 & 0x3F | 0x80)); addByte((byte) (cp >> 6 & 0x3F | 0x80)); addByte((byte) (cp & 0x3F | 0x80)); } return this; } /** * Inserts the specified UTF8 character. * @param pos insertion position * @param cp the character to be added * @return self reference */ public TokenBuilder insert(final int pos, final int cp) { final int s = size; final int cl = chars.length; final int l = cp <= 0x7F ? 1 : cp <= 0x7FF ? 2 : cp <= 0xFFF ? 3 : 4; if(s + l > cl) { final int ns = Math.max(s + l, (int) (cl * Array.RESIZE)); chars = Arrays.copyOf(chars, ns); } Array.move(chars, pos, l, size - pos); size = pos; add(cp); size = s + l; return this; } /** * Returns the codepoint stored at the specified position. * @param pos position * @return character */ public int cp(final int pos) { return Token.cp(chars, pos); } /** * Returns the length of the codepoints stored at the specified position. * @param pos position * @return character */ public int cl(final int pos) { return Token.cl(chars, pos); } /** * Returns the byte stored at the specified position. * @param pos position * @return byte */ public byte get(final int pos) { return chars[pos]; } /** * Sets a byte at the specified position. * @param value byte to be set * @param pos position */ public void set(final int pos, final byte value) { chars[pos] = value; } /** * Deletes bytes from the token. * @param pos position * @param length number of bytes to be removed */ public void delete(final int pos, final int length) { Array.move(chars, pos + length, -length, size - pos - length); size -= length; } /** * Adds a byte to the token. {@link ByteList} instances should be preferred * for the construction of pure byte arrays. * @param value the byte to be added * @return self reference */ public TokenBuilder addByte(final byte value) { if(size == chars.length) chars = Arrays.copyOf(chars, Array.newSize(size)); chars[size++] = value; return this; } /** * Adds an integer value to the token. * @param value value to be added * @return self reference */ public TokenBuilder addInt(final int value) { return add(token(value)); } /** * Adds a number to the token. * @param value value to be added * @return self reference */ public TokenBuilder addLong(final long value) { return add(token(value)); } /** * Adds a byte array to the token. * @param value the byte array to be added * @return self reference */ public TokenBuilder add(final byte[] value) { return add(value, 0, value.length); } /** * Adds part of a byte array to the token. * @param value the byte array to be added * @param start start position * @param end end position * @return self reference */ public TokenBuilder add(final byte[] value, final int start, final int end) { final int l = end - start; final int cl = chars.length; if(size + l > cl) { final int ns = Math.max(size + l, (int) (cl * Array.RESIZE)); chars = Arrays.copyOf(chars, ns); } System.arraycopy(value, start, chars, size, l); size += l; return this; } /** * Adds a string to the token. * @param string the string to be added * @return self reference */ public TokenBuilder add(final String string) { return add(token(string)); } /** * Adds multiple strings to the token, separated by the specified string. * @param objects the object to be added * @param sep separator string * @return self reference */ public TokenBuilder addSep(final Object[] objects, final String sep) { for(int e = 0; e != objects.length; ++e) { if(e != 0) add(sep); addExt(objects[e]); } return this; } /** * Adds the string representation of an object: *
    *
  • objects of type {@link Throwable} are converted to a string representation * via {@link Util#message}.
  • *
  • objects of type {@link Class} are converted via {@link Util#name(Class)}.
  • *
  • {@code null} references are replaced by the string {@code "null"}.
  • *
  • byte arrays are directly inserted as tokens.
  • *
  • for all other typed, {@link Object#toString} is called.
  • *
* The specified string may contain {@code "%"} characters as place holders. * All place holders will be replaced by the specified extensions. If a digit is * specified after the place holder character, it will be interpreted as insertion * position. * * @param object string to be extended * @param ext optional extensions * @return self reference */ public TokenBuilder addExt(final Object object, final Object... ext) { final byte[] t; if(object instanceof byte[]) { t = (byte[]) object; } else { final String s; if(object == null) { s = "null"; } else if(object instanceof Throwable) { s = Util.message((Throwable) object); } else if(object instanceof Class) { s = Util.name((Class) object); } else { s = object.toString(); } t = token(s); } for(int i = 0, e = 0; i < t.length; ++i) { if(t[i] != '%' || e == ext.length) { addByte(t[i]); } else { final byte c = i + 1 < t.length ? t[i + 1] : 0; final boolean d = c >= '1' && c <= '9'; if(d) ++i; final int n = d ? c - '1' : e++; final Object o = n < ext.length ? ext[n] : null; addExt(o); } } return this; } /** * Trims leading and trailing whitespaces. * @return self reference */ public TokenBuilder trim() { while(size > 0 && ws(chars[size - 1])) --size; int s = -1; while(++s < size && ws(chars[s])); if(s != 0 && s != size) Array.move(chars, s, -s, size - s); size -= s; return this; } /** * Returns the token as byte array. * @return character array */ public byte[] finish() { return Arrays.copyOf(chars, size); } @Override public String toString() { return string(chars, 0, size); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/TokenParser.java000066400000000000000000000032021222453003200252510ustar00rootroot00000000000000package org.basex.util; import static org.basex.util.Token.*; import org.basex.util.list.*; /** *

This class can be used to iterate through all codepoints of a token.

* * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public class TokenParser { /** Token to be parsed. */ protected final byte[] token; /** Token length. */ private final int size; /** Current position. */ private int pos; /** * Constructor. * @param tok token */ public TokenParser(final byte[] tok) { token = tok; size = token.length; } /** * Resets the cursor position. */ public void reset() { pos = 0; } /** * Checks if the parser will return more codepoints. * @return result of check */ public boolean more() { return pos < size; } /** * Returns the current codepoint and advances the cursor. * @return current codepoint, or {@code -1} */ public int next() { final int p = pos; if(p < size) { pos += cl(token, p); return cp(token, p); } return -1; } /** * Tries to consume the specified codepoint. * @param ch codepoint to be consumed * @return indicates if the codepoint was consumed */ public boolean consume(final int ch) { final int p = pos; if(p >= size || cp(token, p) != ch) return false; pos += cl(token, p); return true; } /** * Returns a list with all codepoints. * @return array */ public final IntList toList() { final IntList il = new IntList(); while(more()) il.add(next()); return il; } @Override public String toString() { return string(token); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/Util.java000066400000000000000000000220261222453003200237360ustar00rootroot00000000000000package org.basex.util; import static org.basex.core.Text.*; import java.io.*; import java.net.*; import java.util.*; import org.basex.core.*; import org.basex.server.*; import org.basex.util.list.*; /** * This class contains static methods, which are used throughout the project. * The methods are used for dumping error output, debugging information, * getting the application path, etc. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Util { /** Flag for using default standard input. */ private static final boolean NOCONSOLE = System.console() == null; /** Hidden constructor. */ private Util() { } /** * Returns an information string for an unexpected exception. * @param ex exception * @return dummy object */ public static String bug(final Throwable ex) { final TokenBuilder tb = new TokenBuilder(BUGINFO); tb.add(NL).add("Contact: ").add(MAIL); tb.add(NL).add("Version: ").add(TITLE); tb.add(NL).add("Java: ").add(System.getProperty("java.vendor")); tb.add(", ").add(System.getProperty("java.version")); tb.add(NL).add("OS: ").add(System.getProperty("os.name")); tb.add(", ").add(System.getProperty("os.arch")); tb.add(NL).add("Stack Trace: "); for(final String e : toArray(ex)) tb.add(NL).add(e); return tb.toString(); } /** * Throws a runtime exception for an unexpected exception. * @param ext optional extension * @return runtime exception (indicates that an error is raised) */ public static RuntimeException notexpected(final Object... ext) { final TokenBuilder tb = new TokenBuilder(); tb.addExt("%", ext.length == 0 ? "Not Expected." : ext[0]); throw new RuntimeException(tb.toString()); } /** * Throws a runtime exception for an unimplemented method. * @param ext optional extension * @return runtime exception (indicates that an error is raised) */ public static RuntimeException notimplemented(final Object... ext) { final TokenBuilder tb = new TokenBuilder("Not Implemented"); if(ext.length != 0) tb.addExt(" (%)", ext); throw new UnsupportedOperationException(tb.add('.').toString()); } /** * Returns the class name of the specified object. * @param o object * @return class name */ public static String name(final Object o) { return name(o.getClass()); } /** * Returns the name of the specified class. * @param o object * @return class name */ public static String name(final Class o) { return o.getSimpleName(); } /** * Returns a single line from standard input. * @return string */ public static String input() { final Scanner sc = new Scanner(System.in); return sc.hasNextLine() ? sc.nextLine().trim() : ""; } /** * Returns a password from standard input. * @return password */ public static String password() { // use standard input if no console if defined (such as in Eclipse) if(NOCONSOLE) return input(); // hide password final char[] pw = System.console().readPassword(); return pw != null ? new String(pw) : ""; } /** * Prints a newline to standard output. */ public static void outln() { out(NL); } /** * Prints a string to standard output, followed by a newline. * @param str output string * @param ext text optional extensions */ public static void outln(final Object str, final Object... ext) { out((str instanceof byte[] ? Token.string((byte[]) str) : str) + NL, ext); } /** * Prints a string to standard output. * @param str output string * @param ext text optional extensions */ public static void out(final Object str, final Object... ext) { System.out.print(info(str, ext)); } /** * Prints a string to standard error, followed by a newline. * @param obj error string * @param ext text optional extensions */ public static void errln(final Object obj, final Object... ext) { err((obj instanceof Throwable ? message((Throwable) obj) : obj) + NL, ext); } /** * Prints a string to standard error. * @param string debug string * @param ext text optional extensions */ public static void err(final String string, final Object... ext) { System.err.print(info(string, ext)); } /** * Returns a more user-friendly error message for the specified exception. * @param ex throwable reference * @return error message */ public static String message(final Throwable ex) { debug(ex); if(ex instanceof BindException) return SRV_RUNNING; if(ex instanceof LoginException) return ACCESS_DENIED; if(ex instanceof ConnectException) return CONNECTION_ERROR; if(ex instanceof SocketTimeoutException) return TIMEOUT_EXCEEDED; if(ex instanceof SocketException) return CONNECTION_ERROR; String msg = ex.getMessage(); if(msg == null || msg.isEmpty()) msg = ex.toString(); if(ex instanceof FileNotFoundException) return info(RES_NOT_FOUND_X, msg); if(ex instanceof UnknownHostException) return info(UNKNOWN_HOST_X, msg); return msg; } /** * Prints the exception stack trace if the {@link Prop#debug} flag is set. * @param ex exception */ public static void debug(final Throwable ex) { if(Prop.debug && ex != null) stack(ex); } /** * Prints a string to standard error if the {@link Prop#debug} flag is set. * @param str debug string * @param ext text optional extensions */ public static void debug(final Object str, final Object... ext) { if(Prop.debug) errln(str, ext); } /** * Returns a string and replaces all % characters by the specified extensions * (see {@link TokenBuilder#addExt} for details). * @param str string to be extended * @param ext text text extensions * @return extended string */ public static String info(final Object str, final Object... ext) { return Token.string(inf(str, ext)); } /** * Returns a token and replaces all % characters by the specified extensions * (see {@link TokenBuilder#addExt} for details). * @param str string to be extended * @param ext text text extensions * @return token */ public static byte[] inf(final Object str, final Object... ext) { return new TokenBuilder().addExt(str, ext).finish(); } /** * Prints the current stack trace to System.err. * @param i number of steps to print */ public static void stack(final int i) { errln("You're here:"); final String[] stack = toArray(new Throwable()); final int l = Math.min(Math.max(2, i + 2), stack.length); for(int s = 2; s < l; ++s) errln(stack[s]); } /** * Prints the stack of the specified error to standard error. * @param th error/exception instance */ public static void stack(final Throwable th) { //for(final String s : toArray(th)) errln(s); th.printStackTrace(); } /** * Returns an string array representation of the specified throwable. * @param th throwable * @return string array */ private static String[] toArray(final Throwable th) { final StackTraceElement[] st = th.getStackTrace(); final String[] obj = new String[st.length + 1]; obj[0] = th.toString(); for(int i = 0; i < st.length; i++) obj[i + 1] = "\tat " + st[i]; return obj; } /** * Starts the specified class in a separate process. * @param clz class to start * @param args command-line arguments * @return reference to a {@link Process} instance representing the started process */ public static Process start(final Class clz, final String... args) { final String[] largs = { "java", "-Xmx" + Runtime.getRuntime().maxMemory(), "-cp", System.getProperty("java.class.path") }; final StringList sl = new StringList().add(largs); for(final Map.Entry o : System.getProperties().entrySet()) { final String k = o.getKey().toString(); if(k.startsWith(Prop.DBPREFIX)) sl.add("-D" + o.getValue()); } sl.add(clz.getName()).add("-D").add(args); try { return new ProcessBuilder(sl.toArray()).start(); } catch(final IOException ex) { notexpected(ex); return null; } } /** * Checks if the specified string is "yes", "true" or "on". * @param string string to be checked * @return result of check */ public static boolean yes(final String string) { return Token.eqic(string, YES, TRUE, ON, INFOON); } /** * Checks if the specified string is "no", "false" or "off". * @param string string to be checked * @return result of check */ public static boolean no(final String string) { return Token.eqic(string, NO, FALSE, OFF, INFOOFF); } /** * Returns an info message for the specified flag. * @param flag current flag status * @return ON/OFF message */ public static String flag(final boolean flag) { return flag ? INFOON : INFOOFF; } } basex-7.7.2/basex-core/src/main/java/org/basex/util/Version.java000066400000000000000000000034171222453003200244510ustar00rootroot00000000000000package org.basex.util; import static org.basex.util.Token.*; /** * Version according to the SemVer syntax. * * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ public final class Version implements Comparable { /** Major version. */ private final int major; /** Minor version. */ private final int minor; /** Patch version. */ private final int patch; /** * Constructor. * @param version according to semantic versioning */ public Version(final String version) { this(token(version)); } /** * Constructor. * @param version according to semantic versioning */ public Version(final byte[] version) { final byte[][] versions = split(version, '.'); major = toInt(versions[0]); minor = versions.length > 1 ? toInt(versions[1]) : -1; patch = versions.length > 2 ? toInt(versions[2]) : -1; } /** * Checks if this version is compatible with the given version template. * @param ver version template * @return result */ public boolean isCompatible(final Version ver) { if(major != ver.major) return false; if(ver.minor == -1) return true; if(ver.patch == -1) return minor == ver.minor; return minor == ver.minor && patch == ver.patch; } @Override public int compareTo(final Version ver) { return major != ver.major ? major - ver.major : minor != ver.minor ? minor - ver.minor : patch - ver.patch; } @Override public boolean equals(final Object o) { return o instanceof Version && compareTo((Version) o) == 0; } @Override public int hashCode() { return major + (minor << 8) + (patch << 16); } @Override public String toString() { return major + (minor == -1 ? "" : "." + minor + (patch == -1 ? "" : "." + patch)); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/XMLToken.java000066400000000000000000000153041222453003200244630ustar00rootroot00000000000000package org.basex.util; import static org.basex.util.Token.*; /** * This class provides convenience operations for XML-specific character * operations. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class XMLToken { /** The underscore. */ private static final byte[] UNDERSCORE = { '_' }; /** Hidden constructor. */ private XMLToken() { } /** * Checks if the specified character is a valid XML 1.0 character. * @param ch the letter to be checked * @return result of check */ public static boolean valid(final int ch) { return ch < 0xD800 ? ch >= 0x20 || ch == 0xA || ch == 0x9 || ch == 0xD : ch >= 0xE000 && ch <= 0xFFFD || ch >= 0x10000 && ch <= 0x10ffff; } /** * Checks if the specified character is a name start character, as required * e.g. by QName and NCName. * @param ch character * @return result of check */ public static boolean isNCStartChar(final int ch) { return ch < 0x80 ? ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'z' || ch == '_' : ch < 0x300 ? ch >= 0xC0 && ch != 0xD7 && ch != 0xF7 : ch >= 0x370 && ch <= 0x37D || ch >= 0x37F && ch <= 0x1FFF || ch >= 0x200C && ch <= 0x200D || ch >= 0x2070 && ch <= 0x218F || ch >= 0x2C00 && ch <= 0x2EFF || ch >= 0x3001 && ch <= 0xD7FF || ch >= 0xF900 && ch <= 0xFDCF || ch >= 0xFDF0 && ch <= 0xFFFD || ch >= 0x10000 && ch <= 0xEFFFF; } /** * Checks if the specified character is an XML letter. * @param ch character * @return result of check */ public static boolean isNCChar(final int ch) { return isNCStartChar(ch) || (ch < 0x100 ? digit(ch) || ch == '-' || ch == '.' || ch == 0xB7 : ch >= 0x300 && ch <= 0x36F || ch == 0x203F || ch == 0x2040); } /** * Checks if the specified character is an XML first-letter. * @param ch the letter to be checked * @return result of check */ public static boolean isStartChar(final int ch) { return isNCStartChar(ch) || ch == ':'; } /** * Checks if the specified character is an XML letter. * @param ch the letter to be checked * @return result of check */ public static boolean isChar(final int ch) { return isNCChar(ch) || ch == ':'; } /** * Checks if the specified token is a valid NCName. * @param v value to be checked * @return result of check */ public static boolean isNCName(final byte[] v) { final int l = v.length; return l != 0 && ncName(v, 0) == l; } /** * Checks if the specified token is a valid name. * @param v value to be checked * @return result of check */ public static boolean isName(final byte[] v) { final int l = v.length; for(int i = 0; i < l; i += cl(v, i)) { final int c = cp(v, i); if(i == 0 ? !isStartChar(c) : !isChar(c)) return false; } return l != 0; } /** * Checks if the specified token is a valid NMToken. * @param v value to be checked * @return result of check */ public static boolean isNMToken(final byte[] v) { final int l = v.length; for(int i = 0; i < l; i += cl(v, i)) if(!isChar(cp(v, i))) return false; return l != 0; } /** * Checks if the specified token is a valid QName. * @param val value to be checked * @return result of check */ public static boolean isQName(final byte[] val) { final int l = val.length; if(l == 0) return false; final int i = ncName(val, 0); if(i == l) return true; if(i == 0 || val[i] != ':') return false; final int j = ncName(val, i + 1); return j == l && j != i + 1; } /** * Checks the specified token as an NCName. * @param v value to be checked * @param p start position * @return end position */ private static int ncName(final byte[] v, final int p) { final int l = v.length; for(int i = p; i < l; i += cl(v, i)) { final int c = cp(v, i); if(i == p ? !isNCStartChar(c) : !isNCChar(c)) return i; } return l; } /** * Encodes a string to a valid NCName. * @param name token * @return valid NCName */ public static byte[] encode(final byte[] name) { if(name.length == 0) return UNDERSCORE; for(int i = 0, cp; i < name.length; i += cl(name, i)) { cp = cp(name, i); if(cp == '_' || !(i == 0 ? XMLToken.isNCStartChar(cp) : XMLToken.isNCChar(cp))) { final TokenBuilder tb = new TokenBuilder(name.length << 1).add(name, 0, i); for(int j = i; j < name.length; j += cl(name, j)) { cp = cp(name, j); if(cp == '_') tb.addByte(UNDERSCORE[0]).addByte(UNDERSCORE[0]); else if(j == 0 ? XMLToken.isNCStartChar(cp) : XMLToken.isNCChar(cp)) tb.add(cp); else if(cp < 0x10000) addEsc(tb, cp); else { final int r = cp - 0x10000; addEsc(addEsc(tb, (r >>> 10) + 0xD800), (r & 0x3FF) + 0xDC00); } } return tb.finish(); } } return name; } /** * Adds the given 16-bit char to the token builder in encoded form. * @param tb token builder * @param cp char * @return the token builder for convenience */ private static TokenBuilder addEsc(final TokenBuilder tb, final int cp) { tb.addByte(UNDERSCORE[0]); final int a = cp >>> 12; tb.addByte((byte) (a + (a > 9 ? 'A' : '0'))); final int b = cp >>> 8 & 0x0F; tb.addByte((byte) (b + (b > 9 ? 'A' : '0'))); final int c = cp >>> 4 & 0x0F; tb.addByte((byte) (c + (c > 9 ? 'A' : '0'))); final int d = cp & 0x0F; tb.addByte((byte) (d + (d > 9 ? 'A' : '0'))); return tb; } /** * Decodes an NCName to a string. * @param name name * @return cached QName */ public static byte[] decode(final byte[] name) { // convert name to valid XML representation final TokenBuilder tb = new TokenBuilder(); int uc = 0; // mode: 0=normal, 1=unicode, 2=underscore, 3=building unicode int mode = 0; for(int n = 0; n < name.length;) { final int cp = cp(name, n); if(mode >= 3) { uc = (uc << 4) + cp - (cp >= '0' && cp <= '9' ? '0' : 0x37); if(++mode == 7) { tb.add(uc); mode = 0; uc = 0; } } else if(cp == '_') { // limit underscore counter if(++mode == 3) { tb.add('_'); mode = 0; continue; } } else if(mode == 1) { // unicode mode = 3; continue; } else if(mode == 2) { // underscore tb.add('_'); mode = 0; continue; } else { // normal character tb.add(cp); mode = 0; } n += cl(name, n); } if(mode == 2) { tb.add('_'); } else if(mode > 0 && !tb.isEmpty()) { tb.add('?'); } return tb.finish(); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/000077500000000000000000000000001222453003200225655ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/DictionaryStemmer.java000066400000000000000000000014501222453003200270720ustar00rootroot00000000000000package org.basex.util.ft; import java.util.*; /** * Dictionary-based stemmer. * * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ final class DictionaryStemmer extends Stemmer { /** Stem dictionary. */ private final StemDir dict; /** * Constructor. * @param d stem dictionary * @param fti full-text iterator */ DictionaryStemmer(final StemDir d, final FTIterator fti) { super(fti); dict = d; } @Override Stemmer get(final Language l, final FTIterator fti) { return new DictionaryStemmer(dict, fti); } @Override protected byte prec() { return 20; } @Override Collection languages() { return Language.ALL.values(); } @Override protected byte[] stem(final byte[] word) { return dict.stem(word); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/DummyStemmer.java000066400000000000000000000011721222453003200260610ustar00rootroot00000000000000package org.basex.util.ft; import java.util.*; /** * Dummy stemmer for languages that do not require stemming. * * @author BaseX Team 2005-12, BSD License * @author Toshio HIRAI */ final class DummyStemmer extends InternalStemmer { /** * Constructor. * @param fti full-text iterator */ DummyStemmer(final FTIterator fti) { super(fti); } @Override Stemmer get(final Language l, final FTIterator fti) { return new DummyStemmer(fti); } @Override Collection languages() { return collection("ja"); } @Override protected byte[] stem(final byte[] word) { return word; } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/EnglishStemmer.java000066400000000000000000000146311222453003200263630ustar00rootroot00000000000000package org.basex.util.ft; import static org.basex.util.Token.*; import java.util.*; /** * English stemming algorithm, based on the publication from * Porter (1980), "An algorithm for suffix stripping". * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class EnglishStemmer extends InternalStemmer { /** Stemming character. */ private static final byte[] AT = token("at"); /** Stemming character. */ private static final byte[] BL = token("bl"); /** Stemming character. */ private static final byte[] ED = token("ed"); /** Stemming character. */ private static final byte[] EED = token("eed"); /** Stemming character. */ private static final byte[] IES = token("ies"); /** Stemming character. */ private static final byte[] ING = token("ing"); /** Stemming character. */ private static final byte[] ION = token("ion"); /** Stemming character. */ private static final byte[] IZ = token("iz"); /** Stemming character. */ private static final byte[] LL = token("ll"); /** Stemming character. */ private static final byte[] SION = token("sion"); /** Stemming character. */ private static final byte[] SSES = token("sses"); /** Stemming character. */ private static final byte[] TION = token("tion"); /** Stemming character. */ private static final byte S = 's'; /** Stemming character. */ private static final byte Y = 'y'; /** Stemming character. */ private static final byte E = 'e'; /** Stemming character. */ private static final byte L = 'l'; /** Step 2. */ private static final byte[][][] ST2 = { tokens("abli", "able"), tokens("alism", "al"), tokens("aliti", "al"), tokens("alli", "al"), tokens("anci", "ance"), tokens("ation", "ate"), tokens("ational", "ate"), tokens("ator", "ate"), tokens("biliti", "ble"), tokens("eli", "e"), tokens("enci", "ence"), tokens("entli", "ent"), tokens("fulness", "ful"), tokens("iveness", "ive"), tokens("iviti", "ive"), tokens("ization", "ize"), tokens("ization", "ize"), tokens("izer", "ize"), tokens("izer", "ize"), tokens("ousli", "ous"), tokens("ousness", "ous"), tokens("tional", "tion"), }; /** Step 3. */ private static final byte[][][] ST3 = { tokens("alize", "al"), tokens("alize", "al"), tokens("ative", ""), tokens("ful", ""), tokens("ical", "ic"), tokens("icate", "ic"), tokens("iciti", "ic"), tokens("ness", "") }; /** Step 4. */ private static final byte[][] ST4 = tokens( "able", "al", "ance", "ant", "ate", "ement", "ence", "ent", "er", "ible", "ic", "ism", "iti", "ive", "ize", "ment", "ou", "ous", "sion", "tion" ); /** Token to be stemmed. */ private byte[] tok; /** Token length. */ private int te; /** Stemming length. */ private int tt; /** * Constructor. * @param fti full-text iterator */ EnglishStemmer(final FTIterator fti) { super(fti); } @Override Stemmer get(final Language l, final FTIterator fti) { return new EnglishStemmer(fti); } @Override Collection languages() { return collection("en"); } @Override protected byte[] stem(final byte[] str) { te = str.length; tok = str; return !s() ? str : Arrays.copyOf(str, te); } /** * Stems the current word. * @return true if word was stemmed */ private boolean s() { if(te < 3) return false; // step 1 if(e(S)) { if(e(SSES) || e(IES)) te -= 2; else if(l(te - 2) != 's') --te; } if(e(EED)) { if(m() > 0) --te; } else if((e(ED) || e(ING)) && v()) { te = tt; if(e(AT) || e(BL) || e(IZ)) { tt = te; a((byte) 'e'); } else if(te > 1) { final int c = l(te - 1); if(c == l(te - 2) && c != 'l' && c != 's' && c != 'z') { --te; } else if(m() == 1 && c(te)) { a((byte) 'e'); } } } if(e(Y) && v()) a((byte) 'i'); // step 2 for(final byte[][] s : ST2) { if(e(s[0])) { if(m() > 0) a(s[1]); break; } } // step 3 for(final byte[][] s : ST3) { if(e(s[0])) { if(m() > 0) a(s[1]); break; } } // step 4 if((e(TION) || e(SION)) && e(ION) && m() > 1) { te -= 3; } else { for(final byte[] s : ST4) { if(e(s)) { if(m() > 1) te = tt; break; } } } // step 5 if(e(E)) { final int m = m(); if(m > 1 || m == 1 && !c(te - 1)) --te; } if(e(LL) && e(L) && m() > 1) --te; return te != tok.length; } /** * Checks for the cvc pattern. * @param l position * @return result of check */ private boolean c(final int l) { if(l < 3) return false; final int c = l(l - 1); return c != 'w' && c != 'x' && c != 'y' && !v(l - 1) && v(l - 2) && !v(l - 3); } /** * Suffix test for a token. * @param s suffix * @return result of check */ private boolean e(final byte[] s) { final int sl = s.length; final int l = te - sl; if(l < 0) return false; for(int i = 0; i < sl; ++i) if(l(l + i) != s[i]) return false; tt = l; return true; } /** * Suffix test for a single character. * @param s suffix * @return result of check */ private boolean e(final byte s) { final int l = te - 1; if(l < 0 || l(l) != s) return false; tt = l; return true; } /** * Returns word measure. * @return measure */ private int m() { int c = 0; int i = -1; boolean v = false; while(++i < tt) { if(v ^ v(i)) { if(v) ++c; v ^= true; } } return c; } /** * Vowel test. * @return result of check */ private boolean v() { for(int i = 0; i < tt; ++i) if(v(i)) return true; return false; } /** * Vowel test. * @param p position * @return result of check */ private boolean v(final int p) { final int c = l(p); return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'y' && p != 0 && !v(p - 1); } /** * Returns the lower character at the specified position. * @param p position * @return result of check */ private int l(final int p) { return lc(tok[p]); } /** * Adds a character. * @param c character */ private void a(final byte c) { te = tt; tok[te++] = c; } /** * Adds a token. * @param t token */ private void a(final byte[] t) { te = tt; for(final byte c : t) tok[te++] = c; } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/FTBitapSearch.java000066400000000000000000000106271222453003200260550ustar00rootroot00000000000000package org.basex.util.ft; import java.util.*; import org.basex.query.*; import org.basex.query.ft.*; import org.basex.util.list.*; /** * Generalized search algorithm based on the Bitap string matching algorithm. * The implementation is based on the implementation in Wikipedia, but uses * {@link BitSet} for fast bit operation. This version works with a set of * needles and each one of it can be matched in the haystack. * * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov * @see http://en.wikipedia.org/wiki/Bitap_algorithm */ public final class FTBitapSearch { /** Iterator over the set of elements being searched. */ private final FTIterator haystack; /** Subset of elements being searched for. */ private final FTTokens needles; /** Comparator used for comparing two elements for equality. */ private final TokenComparator cmp; /** Bit masks, showing which elements from a {@link #needles} are equal to * the current element of {@link #haystack}. */ private final BitSet[] masks; /** Needle indexes in {@link #needles} sorted by the length of the needle. */ private final int[] sorted; /** Is the method {@link #hasNext} already called? */ private boolean next; /** The current position in the {@link #haystack} iterator; first is 0. */ private int pos; /** Index of the needle which is matched. */ private int match; /** * Constructor. * @param h iterator over the set of elements being searched ("haystack") * @param n a list of "needles" (a needle is an array of elements being * searched for) * @param c comparator for comparing two elements for equality */ public FTBitapSearch(final FTIterator h, final FTTokens n, final TokenComparator c) { haystack = h; cmp = c; needles = n; sorted = new int[n.size()]; // skip empty needles: int count = -1; for(int i = 0; i < sorted.length; i++) { if(n.get(i) != null && n.get(i).size() > 0) sorted[++count] = i; } masks = new BitSet[++count]; // sort the needles by length (longest first): for(int i = 0; i < count; i++) { for(int j = i; j > 0 && n.get(sorted[j]).size() > n.get(sorted[j - 1]).size(); j--) { final int t = sorted[j]; sorted[j] = sorted[j - 1]; sorted[j - 1] = t; } // initialize the bit masks, too: masks[i] = new BitSet(); masks[i].set(0); } } /** * Is there one more match? * @return {@code true} if yes * @throws QueryException if an error occurs during search */ public boolean hasNext() throws QueryException { if(masks.length == 0) return false; if(next) return pos >= 0; // find next hit: next = true; while(haystack.hasNext()) { final byte[] current = haystack.nextToken(); ++pos; // check each needle for a match: boolean matched = false; for(int i = 0; i < masks.length; i++) { final int id = sorted[i]; final TokenList n = needles.get(id); final BitSet m = masks[id]; // compare each element from the needle and set the corresponding bit: for(int k = n.size(); k >= 1; k--) m.set(k, m.get(k - 1) && cmp.equal(current, n.get(k - 1))); // if the last element of the needle's mask is true, then all elements // of the needle are matched: if(m.get(n.size()) && !matched) { match = id; matched = true; } } if(matched) return true; } // nothing was found and the whole haystack was checked: pos = -1; return false; } /** * Position in the haystack of the next match. * @return start position of the match; first position is 0 * @throws QueryException if an error occurs during search */ public int next() throws QueryException { if(hasNext()) { next = false; return pos - needles.get(match).size(); } throw new NoSuchElementException(); } /** * Token comparator. * * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ public interface TokenComparator { /** * Check if two tokens are equal. * @param t1 first token * @param t2 second token * @return {@code true} if the two are equal * @throws QueryException if an error occurs during comparison */ boolean equal(final byte[] t1, final byte[] t2) throws QueryException; } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/FTFlag.java000066400000000000000000000006571222453003200245430ustar00rootroot00000000000000package org.basex.util.ft; /** * This enumeration assembles globally used full-text options. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public enum FTFlag { /** Sensitive flag. */ CS, /** Lowercase flag. */ LC, /** Uppercase flag. */ UC, /** Diacritics flag. */ DC, /** Stemming flag. */ ST, /** Wildcards flag. */ WC, /** Fuzzy flag. */ FZ } basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/FTIterator.java000066400000000000000000000013101222453003200254460ustar00rootroot00000000000000package org.basex.util.ft; import java.util.*; import org.basex.util.*; /** * Full-text iterator. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class FTIterator implements Iterator { /** * Initializes the iterator. * @param text text * @return self reference */ public abstract FTIterator init(final byte[] text); /** * Returns the next token. May be called as an alternative to {@link #next} * to avoid the creation of new {@link FTSpan} instances. * @return token */ public abstract byte[] nextToken(); @Override public final void remove() { throw Util.notimplemented(); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/FTLexer.java000066400000000000000000000116361222453003200247500ustar00rootroot00000000000000package org.basex.util.ft; import java.util.Map.Entry; import java.util.*; import org.basex.index.*; import org.basex.index.query.*; import org.basex.io.serial.*; import org.basex.query.ft.*; import org.basex.util.*; import org.basex.util.list.*; /** * Performs full-text lexing on token. Calls tokenizers, stemmers matching to * full-text options to achieve this. * * @author BaseX Team 2005-12, BSD License * @author Jens Erat */ public final class FTLexer extends FTIterator implements IndexToken { /** Tokenizer. */ private final Tokenizer tok; /** Full-text options. */ private final FTOpt ftopt; /** Text to be tokenized. */ private byte[] text = Token.EMPTY; /** Iterator over result tokens. */ private FTIterator iter; /** The last parsed span. */ private FTSpan curr; /** The last parsed text. */ private byte[] ctxt; /** * Constructor, using the default full-text options. Called by the * {@link XMLSerializer}, {@link FTFilter}, and the map visualizations. */ public FTLexer() { this(null); } /** * Default constructor. * @param opt full-text options */ public FTLexer(final FTOpt opt) { ftopt = opt; // check if language option is provided: Language lang = opt != null ? opt.ln : null; if(lang == null) lang = Language.def(); // use default tokenizer if specific tokenizer is not available. Tokenizer tk = Tokenizer.IMPL.getFirst(); for(final Tokenizer t : Tokenizer.IMPL) { if(t.supports(lang)) { tk = t; break; } } tok = tk.get(opt); iter = tok; // wrap original iterator if(opt != null && opt.is(FTFlag.ST)) { if(opt.sd == null) { // use default stemmer if specific stemmer is not available. Stemmer st = Stemmer.IMPL.getFirst(); for(final Stemmer stem : Stemmer.IMPL) { if(stem.supports(lang)) { st = stem; break; } } iter = st.get(lang, iter); } else { iter = new DictionaryStemmer(opt.sd, iter); } } } /** * Sets the special character flag. * Returns not only tokens, but also delimiters. * @return self reference */ public FTLexer sc() { tok.special = true; return this; } /** * Initializes the iterator. */ public void init() { init(text); } @Override public FTLexer init(final byte[] txt) { text = txt; iter.init(txt); return this; } @Override public boolean hasNext() { return iter.hasNext(); } @Override public FTSpan next() { curr = iter.next(); return curr; } @Override public byte[] nextToken() { ctxt = iter.nextToken(); return ctxt; } /** * Returns total number of tokens. * @return token count */ public int count() { init(); int c = 0; while(hasNext()) { nextToken(); c++; } return c; } @Override public IndexType type() { return IndexType.FULLTEXT; } /** * Returns the original token. Inherited from {@link IndexToken}; * use {@link #next} or {@link #nextToken} if not using this interface. * @return current token. */ @Override public byte[] get() { return ctxt != null ? ctxt : curr.text; } /** * Returns the full-text options. Can be {@code null}. * @return full-text options */ public FTOpt ftOpt() { return ftopt; } /** * Returns the text to be processed. * @return text */ public byte[] text() { return text; } /** * Is paragraph? Does not have to be implemented by all tokenizers. * Returns false if not implemented. * @return boolean */ public boolean paragraph() { return tok.paragraph(); } /** * Calculates a position value, dependent on the specified unit. Does not have * to be implemented by all tokenizers. Returns 0 if not implemented. * @param w word position * @param u unit * @return new position */ public int pos(final int w, final FTUnit u) { return tok.pos(w, u); } /** * Gets full-text info for the specified token; needed for visualizations. * See {@link Tokenizer#info()} for more info. * @return int arrays or empty array if not implemented */ public int[][] info() { return tok.info(); } /** * Lists all languages for which tokenizers and stemmers are available. * @return supported languages */ public static StringList languages() { final TreeMap langs = new TreeMap(); for(final Stemmer stem : Stemmer.IMPL) { for(final Language l : stem.languages()) { if(langs.containsKey(l)) continue; for(final Tokenizer t : Tokenizer.IMPL) { if(t.languages().contains(l)) langs.put(l, stem); } } } final StringList sl = new StringList(); for(final Entry l : langs.entrySet()) { sl.add(l.getKey() + " (" + l.getValue() + ')'); } return sl.sort(true); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/FTOpt.java000066400000000000000000000064761222453003200244410ustar00rootroot00000000000000package org.basex.util.ft; import static org.basex.query.QueryText.*; import static org.basex.util.Token.*; import static org.basex.util.ft.FTFlag.*; import java.util.*; import java.util.Map.Entry; import org.basex.data.*; import org.basex.query.ft.*; import org.basex.query.value.node.*; /** * This class contains all full-text options. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FTOpt extends ExprInfo { /** Flag values. */ private final EnumMap map = new EnumMap(FTFlag.class); /** Stemming dictionary. */ public StemDir sd; /** Stop words. */ public StopWords sw; /** Thesaurus. */ public ThesQuery th; /** Language. */ public Language ln; /** * Initializes the full-text options, inheriting the options of the argument. * @param opt parent full-text options * @return self reference */ public FTOpt copy(final FTOpt opt) { for(final Entry f : opt.map.entrySet()) { final FTFlag fl = f.getKey(); if(map.get(fl) == null) map.put(fl, f.getValue()); } if(sw == null) sw = opt.sw; if(sd == null) sd = opt.sd; if(ln == null) ln = opt.ln; if(th == null) th = opt.th; else if(opt.th != null) th.merge(opt.th); return this; } /** * Copies the full-text options from the specified database meta data. * @param md meta data * @return self reference */ public FTOpt copy(final MetaData md) { set(CS, md.casesens); set(DC, md.diacritics); set(ST, md.stemming); ln = md.language; return this; } /** * Sets the specified flag. * @param f flag to be set * @param v value */ public void set(final FTFlag f, final boolean v) { map.put(f, v); } /** * Tests if the specified flag has been set. * @param f flag index * @return true if flag has been set */ public boolean isSet(final FTFlag f) { return map.get(f) != null; } /** * Returns the specified flag. * @param f flag index * @return flag */ public boolean is(final FTFlag f) { final Boolean b = map.get(f); return b != null && b; } @Override public void plan(final FElem plan) { if(is(WC)) plan.add(planAttr(WILDCARDS, TRUE)); if(is(FZ)) plan.add(planAttr(FUZZY, TRUE)); if(is(UC)) plan.add(planAttr(UPPERCASE, TRUE)); if(is(LC)) plan.add(planAttr(LOWERCASE, TRUE)); if(is(DC)) plan.add(planAttr(DIACRITICS, TRUE)); if(is(ST)) plan.add(planAttr(STEMMING, TRUE)); if(ln != null) plan.add(planAttr(LANGUAGE, ln)); if(th != null) plan.add(planAttr(THESAURUS, TRUE)); } @Override public String toString() { final StringBuilder s = new StringBuilder(); if(is(WC)) s.append(' ' + USING + ' ' + WILDCARDS); if(is(FZ)) s.append(' ' + USING + ' ' + FUZZY); if(is(UC)) s.append(' ' + USING + ' ' + UPPERCASE); if(is(LC)) s.append(' ' + USING + ' ' + LOWERCASE); if(is(DC)) s.append(' ' + USING + ' ' + DIACRITICS + ' ' + SENSITIVE); if(is(ST) || sd != null) s.append(' ' + USING + ' ' + STEMMING); if(ln != null) s.append(' ' + USING + ' ' + LANGUAGE + " '" + ln + '\''); if(th != null) s.append(' ' + USING + ' ' + THESAURUS); return s.toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/FTSpan.java000066400000000000000000000013731222453003200245670ustar00rootroot00000000000000package org.basex.util.ft; import static org.basex.util.Token.*; import org.basex.util.*; /** * This class contains a single full-text token. * * @author BaseX Team 2005-12, BSD License * @author Jens Erat */ public final class FTSpan { /** Text. */ public byte[] text; /** Token position. */ public final int pos; /** Special character flag. */ public final boolean special; /** * Constructor. * @param t token text * @param p number of tokens parsed before the current token * @param sc is a special character */ FTSpan(final byte[] t, final int p, final boolean sc) { text = t; pos = p; special = sc; } @Override public String toString() { return Util.name(this) + '[' + string(text) + ']'; } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/FTUnit.java000066400000000000000000000007401222453003200246020ustar00rootroot00000000000000package org.basex.util.ft; import java.util.*; /** * Full-text units. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public enum FTUnit { /** Word unit. */ WORD, /** Sentence unit. */ SENTENCE, /** Paragraph unit. */ PARAGRAPH; /** * Returns a string representation. * @return string representation */ @Override public String toString() { return name().toLowerCase(Locale.ENGLISH); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/GermanStemmer.java000066400000000000000000000107311222453003200262000ustar00rootroot00000000000000package org.basex.util.ft; import java.util.*; import org.basex.util.*; /** * German stemming algorithm, derived from the Apache Lucene project and the * report "A Fast and Simple Stemming Algorithm for German Words" by * Jörg Caumanns. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class GermanStemmer extends InternalStemmer { /** Removed characters. */ private int subst; /** * Constructor. * @param fti full-text iterator */ GermanStemmer(final FTIterator fti) { super(fti); } @Override Stemmer get(final Language l, final FTIterator fti) { return new GermanStemmer(fti); } @Override Collection languages() { return collection("de"); } @Override protected byte[] stem(final byte[] word) { subst = 0; return part(resub(opt(strip(subst(new TokenBuilder(word)))))).finish(); } /** * Does some substitutions. * @param tb string builder * @return substituted string */ private TokenBuilder subst(final TokenBuilder tb) { subst = 0; final int s = tb.size(); final TokenBuilder tmp = new TokenBuilder(s); int ls = 0; int nx = tb.cp(0); for(int c = 0; c < s;) { int sb = 0; int ch = nx; c += tb.cl(c); nx = c < s ? tb.cp(c) : 0; if(ch == ls) { ch = '*'; } else if(ch == '\u00e4') { ch = 'a'; } else if(ch == '\u00f6') { ch = 'o'; } else if(ch == '\u00fc') { ch = 'u'; } else if(ch == '\u00df') { tmp.add('s'); ch = 's'; subst++; } else if(ch == 's' && nx == 'c' && c + 1 < s && tb.get(c + 1) == 'h') { ch = '\1'; sb = 2; } else if(ch == 'c' && nx == 'h') { ch = '\2'; sb = 1; } else if(ch == 'e' && nx == 'i') { ch = '\3'; sb = 1; } else if(ch == 'i' && nx == 'e') { ch = '\4'; sb = 1; } else if(ch == 'i' && nx == 'g') { ch = '\5'; sb = 1; } else if(ch == 's' && nx == 't') { ch = '\6'; sb = 1; } if(sb > 0) { c += sb; nx = c < s ? tb.cp(c) : 0; subst += sb; } ls = ch; tmp.add(ch); } return tmp; } /** * Strips suffixes. * @param tb token builder * @return token builder */ private TokenBuilder strip(final TokenBuilder tb) { while(tb.size() > 3) { final int tl = tb.size(); final int c1 = tb.get(tl - 1); final int c2 = tb.get(tl - 2); if(tl + subst > 5 && c2 == 'n' && c1 == 'd') { tb.size(tl - 2); } else if(tl + subst > 4 && c2 == 'e' && (c1 == 'm' || c1 == 'r')) { tb.size(tl - 2); } else if(c1 == 'e' || c1 == 's' || c1 == 'n' || c1 == 't') { tb.size(tl - 1); } else { break; } } return tb; } /** * Does optimizations. * @param tb token builder * @return token builder */ private TokenBuilder opt(final TokenBuilder tb) { int tl = tb.size(); if(tl > 5 && tb.get(tl - 5) == 'e' && tb.get(tl - 4) == 'r' && tb.get(tl - 3) == 'i' && tb.get(tl - 2) == 'n' && tb.get(tl - 1) == '*') { tb.size(tl - 1); strip(tb); } tl = tb.size(); if(tb.get(tl - 1) == 'z') tb.set(tl - 1, (byte) 'x'); return tb; } /** * Undoes the changes made by substitute. * @param tb token builder * @return new token builder */ private static TokenBuilder resub(final TokenBuilder tb) { final TokenBuilder tmp = new TokenBuilder(); final int s = tb.size(); for(int c = 0; c < s; c++) { final int ch = tb.get(c); if(ch == '*') { tmp.add(tmp.get(c - 1)); } else if(ch == '\1') { tmp.add('s').add('c').add('h'); } else if(ch == '\2') { tmp.add('c').add('h'); } else if(ch == '\3') { tmp.add('e').add('i'); } else if(ch == '\4') { tmp.add('i').add('e'); } else if(ch == '\5') { tmp.add('i').add('g'); } else if(ch == '\6') { tmp.add('s').add('t'); } else { tmp.add(ch); } } return tmp; } /** * Removes a particle denotion ("ge") from a term. * @param tb token builder * @return token builder */ private static TokenBuilder part(final TokenBuilder tb) { for(int c = 0; c < tb.size() - 4; c++) { if(tb.get(c) == 'g' && tb.get(c + 1) == 'e' && tb.get(c + 2) == 'g' && tb.get(c + 3) == 'e') { tb.delete(c, 2); break; } } return tb; } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/GreekStemmer.java000066400000000000000000001121371222453003200260270ustar00rootroot00000000000000package org.basex.util.ft; import java.util.*; import org.basex.util.*; /** * German stemming algorithm, derived from the Apache Lucene project and the report * "Development of a Stemmer for the Greek Language" by Georgios Ntais. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class GreekStemmer extends InternalStemmer { /** * Constructor. * @param fti full-text iterator */ GreekStemmer(final FTIterator fti) { super(fti); } @Override GreekStemmer get(final Language l, final FTIterator fti) { return new GreekStemmer(fti); } @Override Collection languages() { return collection("el"); } @Override protected byte[] stem(final byte[] word) { int ln = 0; final int wl = word.length; final char[] s = new char[wl]; for(int i = 0; i < wl; i += Token.cl(word, i)) { s[ln++] = (char) Token.cp(word, i); } if(ln < 4) return word; final int olen = ln; // "short rules": if it hits one of these, it skips the "long list" int l = rule0(s, ln); l = rule1(s, l); l = rule2(s, l); l = rule3(s, l); l = rule4(s, l); l = rule5(s, l); l = rule6(s, l); l = rule7(s, l); l = rule8(s, l); l = rule9(s, l); l = rule10(s, l); l = rule11(s, l); l = rule12(s, l); l = rule13(s, l); l = rule14(s, l); l = rule15(s, l); l = rule16(s, l); l = rule17(s, l); l = rule18(s, l); l = rule19(s, l); l = rule20(s, l); if(l == olen) l = rule21(s, l); // "long list" l = rule22(s, l); final TokenBuilder tb = new TokenBuilder(l << 1); for(int i = 0; i < l; i++) tb.add(s[i]); return tb.finish(); } /** * Applies rule 0. * @param s characters * @param l length * @return new length */ private static int rule0(final char[] s, final int l) { if(l > 9 && ( e(s, l, "\u03ba\u03b1\u03b8\u03b5\u03c3\u03c4\u03c9\u03c4\u03bf\u03c3") || e(s, l, "\u03ba\u03b1\u03b8\u03b5\u03c3\u03c4\u03c9\u03c4\u03c9\u03bd"))) return l - 4; if(l > 8 && ( e(s, l, "\u03b3\u03b5\u03b3\u03bf\u03bd\u03bf\u03c4\u03bf\u03c3") || e(s, l, "\u03b3\u03b5\u03b3\u03bf\u03bd\u03bf\u03c4\u03c9\u03bd"))) return l - 4; if(l > 8 && e(s, l, "\u03ba\u03b1\u03b8\u03b5\u03c3\u03c4\u03c9\u03c4\u03b1")) return l - 3; if(l > 7 && ( e(s, l, "\u03c4\u03b1\u03c4\u03bf\u03b3\u03b9\u03bf\u03c5") || e(s, l, "\u03c4\u03b1\u03c4\u03bf\u03b3\u03b9\u03c9\u03bd"))) return l - 4; if(l > 7 && e(s, l, "\u03b3\u03b5\u03b3\u03bf\u03bd\u03bf\u03c4\u03b1")) return l - 3; if(l > 7 && e(s, l, "\u03ba\u03b1\u03b8\u03b5\u03c3\u03c4\u03c9\u03c3")) return l - 2; if(l > 6 && e(s, l, "\u03c3\u03ba\u03b1\u03b3\u03b9\u03bf\u03c5") || e(s, l, "\u03c3\u03ba\u03b1\u03b3\u03b9\u03c9\u03bd") || e(s, l, "\u03bf\u03bb\u03bf\u03b3\u03b9\u03bf\u03c5") || e(s, l, "\u03bf\u03bb\u03bf\u03b3\u03b9\u03c9\u03bd") || e(s, l, "\u03ba\u03c1\u03b5\u03b1\u03c4\u03bf\u03c3") || e(s, l, "\u03ba\u03c1\u03b5\u03b1\u03c4\u03c9\u03bd") || e(s, l, "\u03c0\u03b5\u03c1\u03b1\u03c4\u03bf\u03c3") || e(s, l, "\u03c0\u03b5\u03c1\u03b1\u03c4\u03c9\u03bd") || e(s, l, "\u03c4\u03b5\u03c1\u03b1\u03c4\u03bf\u03c3") || e(s, l, "\u03c4\u03b5\u03c1\u03b1\u03c4\u03c9\u03bd")) return l - 4; if(l > 6 && e(s, l, "\u03c4\u03b1\u03c4\u03bf\u03b3\u03b9\u03b1")) return l - 3; if(l > 6 && e(s, l, "\u03b3\u03b5\u03b3\u03bf\u03bd\u03bf\u03c3")) return l - 2; if(l > 5 && ( e(s, l, "\u03c6\u03b1\u03b3\u03b9\u03bf\u03c5") || e(s, l, "\u03c6\u03b1\u03b3\u03b9\u03c9\u03bd") || e(s, l, "\u03c3\u03bf\u03b3\u03b9\u03bf\u03c5") || e(s, l, "\u03c3\u03bf\u03b3\u03b9\u03c9\u03bd"))) return l - 4; if(l > 5 && ( e(s, l, "\u03c3\u03ba\u03b1\u03b3\u03b9\u03b1") || e(s, l, "\u03bf\u03bb\u03bf\u03b3\u03b9\u03b1") || e(s, l, "\u03ba\u03c1\u03b5\u03b1\u03c4\u03b1") || e(s, l, "\u03c0\u03b5\u03c1\u03b1\u03c4\u03b1") || e(s, l, "\u03c4\u03b5\u03c1\u03b1\u03c4\u03b1"))) return l - 3; if(l > 4 && ( e(s, l, "\u03c6\u03b1\u03b3\u03b9\u03b1") || e(s, l, "\u03c3\u03bf\u03b3\u03b9\u03b1") || e(s, l, "\u03c6\u03c9\u03c4\u03bf\u03c3") || e(s, l, "\u03c6\u03c9\u03c4\u03c9\u03bd"))) return l - 3; if(l > 4 && ( e(s, l, "\u03ba\u03c1\u03b5\u03b1\u03c3") || e(s, l, "\u03c0\u03b5\u03c1\u03b1\u03c3") || e(s, l, "\u03c4\u03b5\u03c1\u03b1\u03c3"))) return l - 2; if(l > 3 && e(s, l, "\u03c6\u03c9\u03c4\u03b1")) return l - 2; if(l > 2 && e(s, l, "\u03c6\u03c9\u03c3")) return l - 1; return l; } /** * Applies rule 1. * @param s characters * @param l length * @return new length */ private static int rule1(final char[] s, final int l) { int len = l; if(len > 4 && ( e(s, len, "\u03b1\u03b4\u03b5\u03c3") || e(s, len, "\u03b1\u03b4\u03c9\u03bd"))) { len -= 4; if(!(e(s, len, "\u03bf\u03ba") || e(s, len, "\u03bc\u03b1\u03bc") || e(s, len, "\u03bc\u03b1\u03bd") || e(s, len, "\u03bc\u03c0\u03b1\u03bc\u03c0") || e(s, len, "\u03c0\u03b1\u03c4\u03b5\u03c1") || e(s, len, "\u03b3\u03b9\u03b1\u03b3\u03b9") || e(s, len, "\u03bd\u03c4\u03b1\u03bd\u03c4") || e(s, len, "\u03ba\u03c5\u03c1") || e(s, len, "\u03b8\u03b5\u03b9") || e(s, len, "\u03c0\u03b5\u03b8\u03b5\u03c1"))) len += 2; // add back -\u03b1\u03b4 } return len; } /** * Applies rule 2. * @param s characters * @param l length * @return new length */ private static int rule2(final char[] s, final int l) { int len = l; if(len > 4 && ( e(s, len, "\u03b5\u03b4\u03b5\u03c3") || e(s, len, "\u03b5\u03b4\u03c9\u03bd"))) { len -= 4; if(e(s, len, "\u03bf\u03c0") || e(s, len, "\u03b9\u03c0") || e(s, len, "\u03b5\u03bc\u03c0") || e(s, len, "\u03c5\u03c0") || e(s, len, "\u03b3\u03b7\u03c0") || e(s, len, "\u03b4\u03b1\u03c0") || e(s, len, "\u03ba\u03c1\u03b1\u03c3\u03c0") || e(s, len, "\u03bc\u03b9\u03bb")) len += 2; // add back } return len; } /** * Applies rule 3. * @param s characters * @param l length * @return new length */ private static int rule3(final char[] s, final int l) { int len = l; if(len > 5 && ( e(s, len, "\u03bf\u03c5\u03b4\u03b5\u03c3") || e(s, len, "\u03bf\u03c5\u03b4\u03c9\u03bd"))) { len -= 5; if(e(s, len, "\u03b1\u03c1\u03ba") || e(s, len, "\u03ba\u03b1\u03bb\u03b9\u03b1\u03ba") || e(s, len, "\u03c0\u03b5\u03c4\u03b1\u03bb") || e(s, len, "\u03bb\u03b9\u03c7") || e(s, len, "\u03c0\u03bb\u03b5\u03be") || e(s, len, "\u03c3\u03ba") || e(s, len, "\u03c3") || e(s, len, "\u03c6\u03bb") || e(s, len, "\u03c6\u03c1") || e(s, len, "\u03b2\u03b5\u03bb") || e(s, len, "\u03bb\u03bf\u03c5\u03bb") || e(s, len, "\u03c7\u03bd") || e(s, len, "\u03c3\u03c0") || e(s, len, "\u03c4\u03c1\u03b1\u03b3") || e(s, len, "\u03c6\u03b5")) len += 3; // add back } return len; } /** String arrays. */ private static final String[] EXC4 = { "\u03b8", "\u03b4", "\u03b5\u03bb", "\u03b3\u03b1\u03bb", "\u03bd", "\u03c0", "\u03b9\u03b4", "\u03c0\u03b1\u03c1" }; /** * Applies rule 4. * @param s characters * @param l length * @return new length */ private static int rule4(final char[] s, final int l) { int len = l; if(len > 3 && ( e(s, len, "\u03b5\u03c9\u03c3") || e(s, len, "\u03b5\u03c9\u03bd"))) { len -= 3; if(c(EXC4, s, len)) len++; // add back -\u03b5 } return len; } /** * Applies rule 5. * @param s characters * @param l length * @return new length */ private static int rule5(final char[] s, final int l) { int len = l; if(len > 2 && e(s, len, "\u03b9\u03b1")) { len -= 2; if(ev(s, len)) len++; // add back -\u03b9 } else if(len > 3 && ( e(s, len, "\u03b9\u03bf\u03c5") || e(s, len, "\u03b9\u03c9\u03bd"))) { len -= 3; if(ev(s, len)) len++; // add back -\u03b9 } return len; } /** String arrays. */ private static final String[] EXC6 = { "\u03b1\u03bb", "\u03b1\u03b4", "\u03b5\u03bd\u03b4", "\u03b1\u03bc\u03b1\u03bd", "\u03b1\u03bc\u03bc\u03bf\u03c7\u03b1\u03bb", "\u03b7\u03b8", "\u03b1\u03bd\u03b7\u03b8", "\u03b1\u03bd\u03c4\u03b9\u03b4", "\u03c6\u03c5\u03c3", "\u03b2\u03c1\u03c9\u03bc", "\u03b3\u03b5\u03c1", "\u03b5\u03be\u03c9\u03b4", "\u03ba\u03b1\u03bb\u03c0", "\u03ba\u03b1\u03bb\u03bb\u03b9\u03bd", "\u03ba\u03b1\u03c4\u03b1\u03b4", "\u03bc\u03bf\u03c5\u03bb", "\u03bc\u03c0\u03b1\u03bd", "\u03bc\u03c0\u03b1\u03b3\u03b9\u03b1\u03c4", "\u03bc\u03c0\u03bf\u03bb", "\u03bc\u03c0\u03bf\u03c3", "\u03bd\u03b9\u03c4", "\u03be\u03b9\u03ba", "\u03c3\u03c5\u03bd\u03bf\u03bc\u03b7\u03bb", "\u03c0\u03b5\u03c4\u03c3", "\u03c0\u03b9\u03c4\u03c3", "\u03c0\u03b9\u03ba\u03b1\u03bd\u03c4", "\u03c0\u03bb\u03b9\u03b1\u03c4\u03c3", "\u03c0\u03bf\u03c3\u03c4\u03b5\u03bb\u03bd", "\u03c0\u03c1\u03c9\u03c4\u03bf\u03b4", "\u03c3\u03b5\u03c1\u03c4", "\u03c3\u03c5\u03bd\u03b1\u03b4", "\u03c4\u03c3\u03b1\u03bc", "\u03c5\u03c0\u03bf\u03b4", "\u03c6\u03b9\u03bb\u03bf\u03bd", "\u03c6\u03c5\u03bb\u03bf\u03b4", "\u03c7\u03b1\u03c3" }; /** * Applies rule 6. * @param s characters * @param l length * @return new length */ private static int rule6(final char[] s, final int l) { int len = l; boolean rem = false; if(len > 3 && ( e(s, len, "\u03b9\u03ba\u03b1") || e(s, len, "\u03b9\u03ba\u03bf"))) { len -= 3; rem = true; } else if(len > 4 && ( e(s, len, "\u03b9\u03ba\u03bf\u03c5") || e(s, len, "\u03b9\u03ba\u03c9\u03bd"))) { len -= 4; rem = true; } if(rem && (ev(s, len) || c(EXC6, s, len))) len += 2; // add back -\u03b9\u03ba return len; } /** String arrays. */ private static final String[] EXC7 = { "\u03b1\u03bd\u03b1\u03c0", "\u03b1\u03c0\u03bf\u03b8", "\u03b1\u03c0\u03bf\u03ba", "\u03b1\u03c0\u03bf\u03c3\u03c4", "\u03b2\u03bf\u03c5\u03b2", "\u03be\u03b5\u03b8", "\u03bf\u03c5\u03bb", "\u03c0\u03b5\u03b8", "\u03c0\u03b9\u03ba\u03c1", "\u03c0\u03bf\u03c4", "\u03c3\u03b9\u03c7", "\u03c7" }; /** * Applies rule 7. * @param s characters * @param l length * @return new length */ private static int rule7(final char[] s, final int l) { int len = l; if(len == 5 && e(s, len, "\u03b1\u03b3\u03b1\u03bc\u03b5")) return len - 1; if(len > 7 && e(s, len, "\u03b7\u03b8\u03b7\u03ba\u03b1\u03bc\u03b5")) len -= 7; else if(len > 6 && e(s, len, "\u03bf\u03c5\u03c3\u03b1\u03bc\u03b5")) len -= 6; else if(len > 5 && ( e(s, len, "\u03b1\u03b3\u03b1\u03bc\u03b5") || e(s, len, "\u03b7\u03c3\u03b1\u03bc\u03b5") || e(s, len, "\u03b7\u03ba\u03b1\u03bc\u03b5"))) len -= 5; if(len > 3 && e(s, len, "\u03b1\u03bc\u03b5")) { len -= 3; if(c(EXC7, s, len)) len += 2; // add back -\u03b1\u03bc } return len; } /** String arrays. */ private static final String[] EXC8A = { "\u03c4\u03c1", "\u03c4\u03c3" }; /** String arrays. */ private static final String[] EXC8B = { "\u03b2\u03b5\u03c4\u03b5\u03c1", "\u03b2\u03bf\u03c5\u03bb\u03ba", "\u03b2\u03c1\u03b1\u03c7\u03bc", "\u03b3", "\u03b4\u03c1\u03b1\u03b4\u03bf\u03c5\u03bc", "\u03b8", "\u03ba\u03b1\u03bb\u03c0\u03bf\u03c5\u03b6", "\u03ba\u03b1\u03c3\u03c4\u03b5\u03bb", "\u03ba\u03bf\u03c1\u03bc\u03bf\u03c1", "\u03bb\u03b1\u03bf\u03c0\u03bb", "\u03bc\u03c9\u03b1\u03bc\u03b5\u03b8", "\u03bc", "\u03bc\u03bf\u03c5\u03c3\u03bf\u03c5\u03bb\u03bc", "\u03bd", "\u03bf\u03c5\u03bb", "\u03c0", "\u03c0\u03b5\u03bb\u03b5\u03ba", "\u03c0\u03bb", "\u03c0\u03bf\u03bb\u03b9\u03c3", "\u03c0\u03bf\u03c1\u03c4\u03bf\u03bb", "\u03c3\u03b1\u03c1\u03b1\u03ba\u03b1\u03c4\u03c3", "\u03c3\u03bf\u03c5\u03bb\u03c4", "\u03c4\u03c3\u03b1\u03c1\u03bb\u03b1\u03c4", "\u03bf\u03c1\u03c6", "\u03c4\u03c3\u03b9\u03b3\u03b3", "\u03c4\u03c3\u03bf\u03c0", "\u03c6\u03c9\u03c4\u03bf\u03c3\u03c4\u03b5\u03c6", "\u03c7", "\u03c8\u03c5\u03c7\u03bf\u03c0\u03bb", "\u03b1\u03b3", "\u03bf\u03c1\u03c6", "\u03b3\u03b1\u03bb", "\u03b3\u03b5\u03c1", "\u03b4\u03b5\u03ba", "\u03b4\u03b9\u03c0\u03bb", "\u03b1\u03bc\u03b5\u03c1\u03b9\u03ba\u03b1\u03bd", "\u03bf\u03c5\u03c1", "\u03c0\u03b9\u03b8", "\u03c0\u03bf\u03c5\u03c1\u03b9\u03c4", "\u03c3", "\u03b6\u03c9\u03bd\u03c4", "\u03b9\u03ba", "\u03ba\u03b1\u03c3\u03c4", "\u03ba\u03bf\u03c0", "\u03bb\u03b9\u03c7", "\u03bb\u03bf\u03c5\u03b8\u03b7\u03c1", "\u03bc\u03b1\u03b9\u03bd\u03c4", "\u03bc\u03b5\u03bb", "\u03c3\u03b9\u03b3", "\u03c3\u03c0", "\u03c3\u03c4\u03b5\u03b3", "\u03c4\u03c1\u03b1\u03b3", "\u03c4\u03c3\u03b1\u03b3", "\u03c6", "\u03b5\u03c1", "\u03b1\u03b4\u03b1\u03c0", "\u03b1\u03b8\u03b9\u03b3\u03b3", "\u03b1\u03bc\u03b7\u03c7", "\u03b1\u03bd\u03b9\u03ba", "\u03b1\u03bd\u03bf\u03c1\u03b3", "\u03b1\u03c0\u03b7\u03b3", "\u03b1\u03c0\u03b9\u03b8", "\u03b1\u03c4\u03c3\u03b9\u03b3\u03b3", "\u03b2\u03b1\u03c3", "\u03b2\u03b1\u03c3\u03ba", "\u03b2\u03b1\u03b8\u03c5\u03b3\u03b1\u03bb", "\u03b2\u03b9\u03bf\u03bc\u03b7\u03c7", "\u03b2\u03c1\u03b1\u03c7\u03c5\u03ba", "\u03b4\u03b9\u03b1\u03c4", "\u03b4\u03b9\u03b1\u03c6", "\u03b5\u03bd\u03bf\u03c1\u03b3", "\u03b8\u03c5\u03c3", "\u03ba\u03b1\u03c0\u03bd\u03bf\u03b2\u03b9\u03bf\u03bc\u03b7\u03c7", "\u03ba\u03b1\u03c4\u03b1\u03b3\u03b1\u03bb", "\u03ba\u03bb\u03b9\u03b2", "\u03ba\u03bf\u03b9\u03bb\u03b1\u03c1\u03c6", "\u03bb\u03b9\u03b2", "\u03bc\u03b5\u03b3\u03bb\u03bf\u03b2\u03b9\u03bf\u03bc\u03b7\u03c7", "\u03bc\u03b9\u03ba\u03c1\u03bf\u03b2\u03b9\u03bf\u03bc\u03b7\u03c7", "\u03bd\u03c4\u03b1\u03b2", "\u03be\u03b7\u03c1\u03bf\u03ba\u03bb\u03b9\u03b2", "\u03bf\u03bb\u03b9\u03b3\u03bf\u03b4\u03b1\u03bc", "\u03bf\u03bb\u03bf\u03b3\u03b1\u03bb", "\u03c0\u03b5\u03bd\u03c4\u03b1\u03c1\u03c6", "\u03c0\u03b5\u03c1\u03b7\u03c6", "\u03c0\u03b5\u03c1\u03b9\u03c4\u03c1", "\u03c0\u03bb\u03b1\u03c4", "\u03c0\u03bf\u03bb\u03c5\u03b4\u03b1\u03c0", "\u03c0\u03bf\u03bb\u03c5\u03bc\u03b7\u03c7", "\u03c3\u03c4\u03b5\u03c6", "\u03c4\u03b1\u03b2", "\u03c4\u03b5\u03c4", "\u03c5\u03c0\u03b5\u03c1\u03b7\u03c6", "\u03c5\u03c0\u03bf\u03ba\u03bf\u03c0", "\u03c7\u03b1\u03bc\u03b7\u03bb\u03bf\u03b4\u03b1\u03c0", "\u03c8\u03b7\u03bb\u03bf\u03c4\u03b1\u03b2" }; /** * Applies rule 8. * @param s characters * @param l length * @return new length */ private static int rule8(final char[] s, final int l) { boolean rem = false; int len = l; if(len > 8 && e(s, len, "\u03b9\u03bf\u03c5\u03bd\u03c4\u03b1\u03bd\u03b5")) { len -= 8; rem = true; } else if(len > 7 && e(s, len, "\u03b9\u03bf\u03bd\u03c4\u03b1\u03bd\u03b5") || e(s, len, "\u03bf\u03c5\u03bd\u03c4\u03b1\u03bd\u03b5") || e(s, len, "\u03b7\u03b8\u03b7\u03ba\u03b1\u03bd\u03b5")) { len -= 7; rem = true; } else if(len > 6 && e(s, len, "\u03b9\u03bf\u03c4\u03b1\u03bd\u03b5") || e(s, len, "\u03bf\u03bd\u03c4\u03b1\u03bd\u03b5") || e(s, len, "\u03bf\u03c5\u03c3\u03b1\u03bd\u03b5")) { len -= 6; rem = true; } else if(len > 5 && e(s, len, "\u03b1\u03b3\u03b1\u03bd\u03b5") || e(s, len, "\u03b7\u03c3\u03b1\u03bd\u03b5") || e(s, len, "\u03bf\u03c4\u03b1\u03bd\u03b5") || e(s, len, "\u03b7\u03ba\u03b1\u03bd\u03b5")) { len -= 5; rem = true; } if(rem && c(EXC8A, s, len)) { // add -\u03b1\u03b3\u03b1\u03bd (we rem > 4 chars so its safe) len += 4; s[len - 4] = '\u03b1'; s[len - 3] = '\u03b3'; s[len - 2] = '\u03b1'; s[len - 1] = '\u03bd'; } if(len > 3 && e(s, len, "\u03b1\u03bd\u03b5")) { len -= 3; if(ey(s, len) || c(EXC8B, s, len)) { len += 2; // add back -\u03b1\u03bd } } return len; } /** String arrays. */ private static final String[] EXC9 = { "\u03b1\u03b2\u03b1\u03c1", "\u03b2\u03b5\u03bd", "\u03b5\u03bd\u03b1\u03c1", "\u03b1\u03b2\u03c1", "\u03b1\u03b4", "\u03b1\u03b8", "\u03b1\u03bd", "\u03b1\u03c0\u03bb", "\u03b2\u03b1\u03c1\u03bf\u03bd", "\u03bd\u03c4\u03c1", "\u03c3\u03ba", "\u03ba\u03bf\u03c0", "\u03bc\u03c0\u03bf\u03c1", "\u03bd\u03b9\u03c6", "\u03c0\u03b1\u03b3", "\u03c0\u03b1\u03c1\u03b1\u03ba\u03b1\u03bb", "\u03c3\u03b5\u03c1\u03c0", "\u03c3\u03ba\u03b5\u03bb", "\u03c3\u03c5\u03c1\u03c6", "\u03c4\u03bf\u03ba", "\u03c5", "\u03b4", "\u03b5\u03bc", "\u03b8\u03b1\u03c1\u03c1", "\u03b8" }; /** * Applies rule 9. * @param s characters * @param l length * @return new length */ private static int rule9(final char[] s, final int l) { int len = l; if(len > 5 && e(s, len, "\u03b7\u03c3\u03b5\u03c4\u03b5")) len -= 5; if(len > 3 && e(s, len, "\u03b5\u03c4\u03b5")) { len -= 3; if(c(EXC9, s, len) || ey(s, len) || e(s, len, "\u03bf\u03b4") || e(s, len, "\u03b1\u03b9\u03c1") || e(s, len, "\u03c6\u03bf\u03c1") || e(s, len, "\u03c4\u03b1\u03b8") || e(s, len, "\u03b4\u03b9\u03b1\u03b8") || e(s, len, "\u03c3\u03c7") || e(s, len, "\u03b5\u03bd\u03b4") || e(s, len, "\u03b5\u03c5\u03c1") || e(s, len, "\u03c4\u03b9\u03b8") || e(s, len, "\u03c5\u03c0\u03b5\u03c1\u03b8") || e(s, len, "\u03c1\u03b1\u03b8") || e(s, len, "\u03b5\u03bd\u03b8") || e(s, len, "\u03c1\u03bf\u03b8") || e(s, len, "\u03c3\u03b8") || e(s, len, "\u03c0\u03c5\u03c1") || e(s, len, "\u03b1\u03b9\u03bd") || e(s, len, "\u03c3\u03c5\u03bd\u03b4") || e(s, len, "\u03c3\u03c5\u03bd") || e(s, len, "\u03c3\u03c5\u03bd\u03b8") || e(s, len, "\u03c7\u03c9\u03c1") || e(s, len, "\u03c0\u03bf\u03bd") || e(s, len, "\u03b2\u03c1") || e(s, len, "\u03ba\u03b1\u03b8") || e(s, len, "\u03b5\u03c5\u03b8") || e(s, len, "\u03b5\u03ba\u03b8") || e(s, len, "\u03bd\u03b5\u03c4") || e(s, len, "\u03c1\u03bf\u03bd") || e(s, len, "\u03b1\u03c1\u03ba") || e(s, len, "\u03b2\u03b1\u03c1") || e(s, len, "\u03b2\u03bf\u03bb") || e(s, len, "\u03c9\u03c6\u03b5\u03bb")) { len += 2; // add back -\u03b5\u03c4 } } return len; } /** * Applies rule 10. * @param s characters * @param l length * @return new length */ private static int rule10(final char[] s, final int l) { int len = l; if(len > 5 && ( e(s, len, "\u03bf\u03bd\u03c4\u03b1\u03c3") || e(s, len, "\u03c9\u03bd\u03c4\u03b1\u03c3"))) { len -= 5; if(len == 3 && e(s, len, "\u03b1\u03c1\u03c7")) { len += 3; // add back *\u03bd\u03c4 s[len - 3] = '\u03bf'; } if(e(s, len, "\u03ba\u03c1\u03b5")) { len += 3; // add back *\u03bd\u03c4 s[len - 3] = '\u03c9'; } } return len; } /** * Applies rule 11. * @param s characters * @param l length * @return new length */ private static int rule11(final char[] s, final int l) { int len = l; if(len > 6 && e(s, len, "\u03bf\u03bc\u03b1\u03c3\u03c4\u03b5")) { len -= 6; if(len == 2 && e(s, len, "\u03bf\u03bd")) { len += 5; // add back -\u03bf\u03bc\u03b1\u03c3\u03c4 } } else if(len > 7 && e(s, len, "\u03b9\u03bf\u03bc\u03b1\u03c3\u03c4\u03b5")) { len -= 7; if(len == 2 && e(s, len, "\u03bf\u03bd")) { len += 5; s[len - 5] = '\u03bf'; s[len - 4] = '\u03bc'; s[len - 3] = '\u03b1'; s[len - 2] = '\u03c3'; s[len - 1] = '\u03c4'; } } return len; } /** String arrays. */ private static final String[] EXC12A = { "\u03c0", "\u03b1\u03c0", "\u03c3\u03c5\u03bc\u03c0", "\u03b1\u03c3\u03c5\u03bc\u03c0", "\u03b1\u03ba\u03b1\u03c4\u03b1\u03c0", "\u03b1\u03bc\u03b5\u03c4\u03b1\u03bc\u03c6" }; /** String arrays. */ private static final String[] EXC12B = { "\u03b1\u03bb", "\u03b1\u03c1", "\u03b5\u03ba\u03c4\u03b5\u03bb", "\u03b6", "\u03bc", "\u03be", "\u03c0\u03b1\u03c1\u03b1\u03ba\u03b1\u03bb", "\u03b1\u03c1", "\u03c0\u03c1\u03bf", "\u03bd\u03b9\u03c3" }; /** * Applies rule 12. * @param s characters * @param l length * @return new length */ private static int rule12(final char[] s, final int l) { int len = l; if(len > 5 && e(s, len, "\u03b9\u03b5\u03c3\u03c4\u03b5")) { len -= 5; if(c(EXC12A, s, len)) len += 4; // add back -\u03b9\u03b5\u03c3\u03c4 } if(len > 4 && e(s, len, "\u03b5\u03c3\u03c4\u03b5")) { len -= 4; if(c(EXC12B, s, len)) len += 3; // add back -\u03b5\u03c3\u03c4 } return len; } /** String arrays. */ private static final String[] EXC13 = { "\u03b4\u03b9\u03b1\u03b8", "\u03b8", "\u03c0\u03b1\u03c1\u03b1\u03ba\u03b1\u03c4\u03b1\u03b8", "\u03c0\u03c1\u03bf\u03c3\u03b8", "\u03c3\u03c5\u03bd\u03b8" }; /** * Applies rule 13. * @param s characters * @param l length * @return new length */ private static int rule13(final char[] s, final int l) { int len = l; if(len > 6 && e(s, len, "\u03b7\u03b8\u03b7\u03ba\u03b5\u03c3")) { len -= 6; } else if(len > 5 && ( e(s, len, "\u03b7\u03b8\u03b7\u03ba\u03b1") || e(s, len, "\u03b7\u03b8\u03b7\u03ba\u03b5"))) { len -= 5; } boolean rem = false; if(len > 4 && e(s, len, "\u03b7\u03ba\u03b5\u03c3")) { len -= 4; rem = true; } else if(len > 3 && ( e(s, len, "\u03b7\u03ba\u03b1") || e(s, len, "\u03b7\u03ba\u03b5"))) { len -= 3; rem = true; } if(rem && (c(EXC13, s, len) || e(s, len, "\u03c3\u03ba\u03c9\u03bb") || e(s, len, "\u03c3\u03ba\u03bf\u03c5\u03bb") || e(s, len, "\u03bd\u03b1\u03c1\u03b8") || e(s, len, "\u03c3\u03c6") || e(s, len, "\u03bf\u03b8") || e(s, len, "\u03c0\u03b9\u03b8"))) { len += 2; // add back the -\u03b7\u03ba } return len; } /** String arrays. */ private static final String[] EXC14 = { "\u03c6\u03b1\u03c1\u03bc\u03b1\u03ba", "\u03c7\u03b1\u03b4", "\u03b1\u03b3\u03ba", "\u03b1\u03bd\u03b1\u03c1\u03c1", "\u03b2\u03c1\u03bf\u03bc", "\u03b5\u03ba\u03bb\u03b9\u03c0", "\u03bb\u03b1\u03bc\u03c0\u03b9\u03b4", "\u03bb\u03b5\u03c7", "\u03bc", "\u03c0\u03b1\u03c4", "\u03c1", "\u03bb", "\u03bc\u03b5\u03b4", "\u03bc\u03b5\u03c3\u03b1\u03b6", "\u03c5\u03c0\u03bf\u03c4\u03b5\u03b9\u03bd", "\u03b1\u03bc", "\u03b1\u03b9\u03b8", "\u03b1\u03bd\u03b7\u03ba", "\u03b4\u03b5\u03c3\u03c0\u03bf\u03b6", "\u03b5\u03bd\u03b4\u03b9\u03b1\u03c6\u03b5\u03c1", "\u03b4\u03b5", "\u03b4\u03b5\u03c5\u03c4\u03b5\u03c1\u03b5\u03c5", "\u03ba\u03b1\u03b8\u03b1\u03c1\u03b5\u03c5", "\u03c0\u03bb\u03b5", "\u03c4\u03c3\u03b1" }; /** * Applies rule 14. * @param s characters * @param l length * @return new length */ private static int rule14(final char[] s, final int l) { int len = l; boolean rem = false; if(len > 5 && e(s, len, "\u03bf\u03c5\u03c3\u03b5\u03c3")) { len -= 5; rem = true; } else if(len > 4 && ( e(s, len, "\u03bf\u03c5\u03c3\u03b1") || e(s, len, "\u03bf\u03c5\u03c3\u03b5"))) { len -= 4; rem = true; } if(rem && (c(EXC14, s, len) || ev(s, len) || e(s, len, "\u03c0\u03bf\u03b4\u03b1\u03c1") || e(s, len, "\u03b2\u03bb\u03b5\u03c0") || e(s, len, "\u03c0\u03b1\u03bd\u03c4\u03b1\u03c7") || e(s, len, "\u03c6\u03c1\u03c5\u03b4") || e(s, len, "\u03bc\u03b1\u03bd\u03c4\u03b9\u03bb") || e(s, len, "\u03bc\u03b1\u03bb\u03bb") || e(s, len, "\u03ba\u03c5\u03bc\u03b1\u03c4") || e(s, len, "\u03bb\u03b1\u03c7") || e(s, len, "\u03bb\u03b7\u03b3") || e(s, len, "\u03c6\u03b1\u03b3") || e(s, len, "\u03bf\u03bc") || e(s, len, "\u03c0\u03c1\u03c9\u03c4"))) { len += 3; // add back -\u03bf\u03c5\u03c3 } return len; } /** String arrays. */ private static final String[] EXC15A = { "\u03b1\u03b2\u03b1\u03c3\u03c4", "\u03c0\u03bf\u03bb\u03c5\u03c6", "\u03b1\u03b4\u03b7\u03c6", "\u03c0\u03b1\u03bc\u03c6", "\u03c1", "\u03b1\u03c3\u03c0", "\u03b1\u03c6", "\u03b1\u03bc\u03b1\u03bb", "\u03b1\u03bc\u03b1\u03bb\u03bb\u03b9", "\u03b1\u03bd\u03c5\u03c3\u03c4", "\u03b1\u03c0\u03b5\u03c1", "\u03b1\u03c3\u03c0\u03b1\u03c1", "\u03b1\u03c7\u03b1\u03c1", "\u03b4\u03b5\u03c1\u03b2\u03b5\u03bd", "\u03b4\u03c1\u03bf\u03c3\u03bf\u03c0", "\u03be\u03b5\u03c6", "\u03bd\u03b5\u03bf\u03c0", "\u03bd\u03bf\u03bc\u03bf\u03c4", "\u03bf\u03bb\u03bf\u03c0", "\u03bf\u03bc\u03bf\u03c4", "\u03c0\u03c1\u03bf\u03c3\u03c4", "\u03c0\u03c1\u03bf\u03c3\u03c9\u03c0\u03bf\u03c0", "\u03c3\u03c5\u03bc\u03c0", "\u03c3\u03c5\u03bd\u03c4", "\u03c4", "\u03c5\u03c0\u03bf\u03c4", "\u03c7\u03b1\u03c1", "\u03b1\u03b5\u03b9\u03c0", "\u03b1\u03b9\u03bc\u03bf\u03c3\u03c4", "\u03b1\u03bd\u03c5\u03c0", "\u03b1\u03c0\u03bf\u03c4", "\u03b1\u03c1\u03c4\u03b9\u03c0", "\u03b4\u03b9\u03b1\u03c4", "\u03b5\u03bd", "\u03b5\u03c0\u03b9\u03c4", "\u03ba\u03c1\u03bf\u03ba\u03b1\u03bb\u03bf\u03c0", "\u03c3\u03b9\u03b4\u03b7\u03c1\u03bf\u03c0", "\u03bb", "\u03bd\u03b1\u03c5", "\u03bf\u03c5\u03bb\u03b1\u03bc", "\u03bf\u03c5\u03c1", "\u03c0", "\u03c4\u03c1", "\u03bc" }; /** String arrays. */ private static final String[] EXC15B = { "\u03c8\u03bf\u03c6", "\u03bd\u03b1\u03c5\u03bb\u03bf\u03c7" }; /** * Applies rule 15. * @param s characters * @param l length * @return new length */ private static int rule15(final char[] s, final int l) { int len = l; boolean rem = false; if(len > 4 && e(s, len, "\u03b1\u03b3\u03b5\u03c3")) { len -= 4; rem = true; } else if(len > 3 && ( e(s, len, "\u03b1\u03b3\u03b1") || e(s, len, "\u03b1\u03b3\u03b5"))) { len -= 3; rem = true; } if(rem) { final boolean cond1 = c(EXC15A, s, len) || e(s, len, "\u03bf\u03c6") || e(s, len, "\u03c0\u03b5\u03bb") || e(s, len, "\u03c7\u03bf\u03c1\u03c4") || e(s, len, "\u03bb\u03bb") || e(s, len, "\u03c3\u03c6") || e(s, len, "\u03c1\u03c0") || e(s, len, "\u03c6\u03c1") || e(s, len, "\u03c0\u03c1") || e(s, len, "\u03bb\u03bf\u03c7") || e(s, len, "\u03c3\u03bc\u03b7\u03bd"); final boolean cond2 = c(EXC15B, s, len) || e(s, len, "\u03ba\u03bf\u03bb\u03bb"); if(cond1 && !cond2) len += 2; // add back -\u03b1\u03b3 } return len; } /** String arrays. */ private static final String[] EXC16 = { "\u03bd", "\u03c7\u03b5\u03c1\u03c3\u03bf\u03bd", "\u03b4\u03c9\u03b4\u03b5\u03ba\u03b1\u03bd", "\u03b5\u03c1\u03b7\u03bc\u03bf\u03bd", "\u03bc\u03b5\u03b3\u03b1\u03bb\u03bf\u03bd", "\u03b5\u03c0\u03c4\u03b1\u03bd" }; /** * Applies rule 16. * @param s characters * @param l length * @return new length */ private static int rule16(final char[] s, final int l) { int len = l; boolean rem = false; if(len > 4 && e(s, len, "\u03b7\u03c3\u03bf\u03c5")) { len -= 4; rem = true; } else if(len > 3 && ( e(s, len, "\u03b7\u03c3\u03b5") || e(s, len, "\u03b7\u03c3\u03b1"))) { len -= 3; rem = true; } if(rem && c(EXC16, s, len)) len += 2; // add back -\u03b7\u03c3 return len; } /** String arrays. */ private static final String[] EXC17 = { "\u03b1\u03c3\u03b2", "\u03c3\u03b2", "\u03b1\u03c7\u03c1", "\u03c7\u03c1", "\u03b1\u03c0\u03bb", "\u03b1\u03b5\u03b9\u03bc\u03bd", "\u03b4\u03c5\u03c3\u03c7\u03c1", "\u03b5\u03c5\u03c7\u03c1", "\u03ba\u03bf\u03b9\u03bd\u03bf\u03c7\u03c1", "\u03c0\u03b1\u03bb\u03b9\u03bc\u03c8" }; /** * Applies rule 17. * @param s characters * @param l length * @return new length */ private static int rule17(final char[] s, final int l) { int len = l; if(len > 4 && e(s, len, "\u03b7\u03c3\u03c4\u03b5")) { len -= 4; if(c(EXC17, s, len)) len += 3; // add back the -\u03b7\u03c3\u03c4 } return len; } /** String arrays. */ private static final String[] EXC18 = { "\u03bd", "\u03c1", "\u03c3\u03c0\u03b9", "\u03c3\u03c4\u03c1\u03b1\u03b2\u03bf\u03bc\u03bf\u03c5\u03c4\u03c3", "\u03ba\u03b1\u03ba\u03bf\u03bc\u03bf\u03c5\u03c4\u03c3", "\u03b5\u03be\u03c9\u03bd" }; /** * Applies rule 18. * @param s characters * @param l length * @return new length */ private static int rule18(final char[] s, final int l) { boolean rem = false; int len = l; if(len > 6 && ( e(s, len, "\u03b7\u03c3\u03bf\u03c5\u03bd\u03b5") || e(s, len, "\u03b7\u03b8\u03bf\u03c5\u03bd\u03b5"))) { len -= 6; rem = true; } else if(len > 4 && e(s, len, "\u03bf\u03c5\u03bd\u03b5")) { len -= 4; rem = true; } if(rem && c(EXC18, s, len)) { len += 3; s[len - 3] = '\u03bf'; s[len - 2] = '\u03c5'; s[len - 1] = '\u03bd'; } return len; } /** String arrays. */ private static final String[] EXC19 = { "\u03c0\u03b1\u03c1\u03b1\u03c3\u03bf\u03c5\u03c3", "\u03c6", "\u03c7", "\u03c9\u03c1\u03b9\u03bf\u03c0\u03bb", "\u03b1\u03b6", "\u03b1\u03bb\u03bb\u03bf\u03c3\u03bf\u03c5\u03c3", "\u03b1\u03c3\u03bf\u03c5\u03c3" }; /** * Applies rule 19. * @param s characters * @param l length * @return new length */ private static int rule19(final char[] s, final int l) { int len = l; boolean rem = false; if(len > 6 && ( e(s, len, "\u03b7\u03c3\u03bf\u03c5\u03bc\u03b5") || e(s, len, "\u03b7\u03b8\u03bf\u03c5\u03bc\u03b5"))) { len -= 6; rem = true; } else if(len > 4 && e(s, len, "\u03bf\u03c5\u03bc\u03b5")) { len -= 4; rem = true; } if(rem && c(EXC19, s, len)) { len += 3; s[len - 3] = '\u03bf'; s[len - 2] = '\u03c5'; s[len - 1] = '\u03bc'; } return len; } /** * Applies rule 20. * @param s characters * @param l length * @return new length */ private static int rule20(final char[] s, final int l) { int len = l; if(len > 5 && ( e(s, len, "\u03bc\u03b1\u03c4\u03c9\u03bd") || e(s, len, "\u03bc\u03b1\u03c4\u03bf\u03c3"))) len -= 3; else if(len > 4 && e(s, len, "\u03bc\u03b1\u03c4\u03b1")) len -= 2; return len; } /** * Applies rule 21. * @param s characters * @param l length * @return new length */ private static int rule21(final char[] s, final int l) { if(l > 9 && e(s, l, "\u03b9\u03bf\u03bd\u03c4\u03bf\u03c5\u03c3\u03b1\u03bd")) return l - 9; if(l > 8 && ( e(s, l, "\u03b9\u03bf\u03bc\u03b1\u03c3\u03c4\u03b1\u03bd") || e(s, l, "\u03b9\u03bf\u03c3\u03b1\u03c3\u03c4\u03b1\u03bd") || e(s, l, "\u03b9\u03bf\u03c5\u03bc\u03b1\u03c3\u03c4\u03b5") || e(s, l, "\u03bf\u03bd\u03c4\u03bf\u03c5\u03c3\u03b1\u03bd"))) return l - 8; if(l > 7 && ( e(s, l, "\u03b9\u03b5\u03bc\u03b1\u03c3\u03c4\u03b5") || e(s, l, "\u03b9\u03b5\u03c3\u03b1\u03c3\u03c4\u03b5") || e(s, l, "\u03b9\u03bf\u03bc\u03bf\u03c5\u03bd\u03b1") || e(s, l, "\u03b9\u03bf\u03c3\u03b1\u03c3\u03c4\u03b5") || e(s, l, "\u03b9\u03bf\u03c3\u03bf\u03c5\u03bd\u03b1") || e(s, l, "\u03b9\u03bf\u03c5\u03bd\u03c4\u03b1\u03b9") || e(s, l, "\u03b9\u03bf\u03c5\u03bd\u03c4\u03b1\u03bd") || e(s, l, "\u03b7\u03b8\u03b7\u03ba\u03b1\u03c4\u03b5") || e(s, l, "\u03bf\u03bc\u03b1\u03c3\u03c4\u03b1\u03bd") || e(s, l, "\u03bf\u03c3\u03b1\u03c3\u03c4\u03b1\u03bd") || e(s, l, "\u03bf\u03c5\u03bc\u03b1\u03c3\u03c4\u03b5"))) return l - 7; if(l > 6 && ( e(s, l, "\u03b9\u03bf\u03bc\u03bf\u03c5\u03bd") || e(s, l, "\u03b9\u03bf\u03bd\u03c4\u03b1\u03bd") || e(s, l, "\u03b9\u03bf\u03c3\u03bf\u03c5\u03bd") || e(s, l, "\u03b7\u03b8\u03b5\u03b9\u03c4\u03b5") || e(s, l, "\u03b7\u03b8\u03b7\u03ba\u03b1\u03bd") || e(s, l, "\u03bf\u03bc\u03bf\u03c5\u03bd\u03b1") || e(s, l, "\u03bf\u03c3\u03b1\u03c3\u03c4\u03b5") || e(s, l, "\u03bf\u03c3\u03bf\u03c5\u03bd\u03b1") || e(s, l, "\u03bf\u03c5\u03bd\u03c4\u03b1\u03b9") || e(s, l, "\u03bf\u03c5\u03bd\u03c4\u03b1\u03bd") || e(s, l, "\u03bf\u03c5\u03c3\u03b1\u03c4\u03b5"))) return l - 6; if(l > 5 && ( e(s, l, "\u03b1\u03b3\u03b1\u03c4\u03b5") || e(s, l, "\u03b9\u03b5\u03bc\u03b1\u03b9") || e(s, l, "\u03b9\u03b5\u03c4\u03b1\u03b9") || e(s, l, "\u03b9\u03b5\u03c3\u03b1\u03b9") || e(s, l, "\u03b9\u03bf\u03c4\u03b1\u03bd") || e(s, l, "\u03b9\u03bf\u03c5\u03bc\u03b1") || e(s, l, "\u03b7\u03b8\u03b5\u03b9\u03c3") || e(s, l, "\u03b7\u03b8\u03bf\u03c5\u03bd") || e(s, l, "\u03b7\u03ba\u03b1\u03c4\u03b5") || e(s, l, "\u03b7\u03c3\u03b1\u03c4\u03b5") || e(s, l, "\u03b7\u03c3\u03bf\u03c5\u03bd") || e(s, l, "\u03bf\u03bc\u03bf\u03c5\u03bd") || e(s, l, "\u03bf\u03bd\u03c4\u03b1\u03b9") || e(s, l, "\u03bf\u03bd\u03c4\u03b1\u03bd") || e(s, l, "\u03bf\u03c3\u03bf\u03c5\u03bd") || e(s, l, "\u03bf\u03c5\u03bc\u03b1\u03b9") || e(s, l, "\u03bf\u03c5\u03c3\u03b1\u03bd"))) return l - 5; if(l > 4 && ( e(s, l, "\u03b1\u03b3\u03b1\u03bd") || e(s, l, "\u03b1\u03bc\u03b1\u03b9") || e(s, l, "\u03b1\u03c3\u03b1\u03b9") || e(s, l, "\u03b1\u03c4\u03b1\u03b9") || e(s, l, "\u03b5\u03b9\u03c4\u03b5") || e(s, l, "\u03b5\u03c3\u03b1\u03b9") || e(s, l, "\u03b5\u03c4\u03b1\u03b9") || e(s, l, "\u03b7\u03b4\u03b5\u03c3") || e(s, l, "\u03b7\u03b4\u03c9\u03bd") || e(s, l, "\u03b7\u03b8\u03b5\u03b9") || e(s, l, "\u03b7\u03ba\u03b1\u03bd") || e(s, l, "\u03b7\u03c3\u03b1\u03bd") || e(s, l, "\u03b7\u03c3\u03b5\u03b9") || e(s, l, "\u03b7\u03c3\u03b5\u03c3") || e(s, l, "\u03bf\u03bc\u03b1\u03b9") || e(s, l, "\u03bf\u03c4\u03b1\u03bd"))) return l - 4; if(l > 3 && ( e(s, l, "\u03b1\u03b5\u03b9") || e(s, l, "\u03b5\u03b9\u03c3") || e(s, l, "\u03b7\u03b8\u03c9") || e(s, l, "\u03b7\u03c3\u03c9") || e(s, l, "\u03bf\u03c5\u03bd") || e(s, l, "\u03bf\u03c5\u03c3"))) return l - 3; if(l > 2 && ( e(s, l, "\u03b1\u03bd") || e(s, l, "\u03b1\u03c3") || e(s, l, "\u03b1\u03c9") || e(s, l, "\u03b5\u03b9") || e(s, l, "\u03b5\u03c3") || e(s, l, "\u03b7\u03c3") || e(s, l, "\u03bf\u03b9") || e(s, l, "\u03bf\u03c3") || e(s, l, "\u03bf\u03c5") || e(s, l, "\u03c5\u03c3") || e(s, l, "\u03c9\u03bd"))) return l - 2; if(l > 1 && ev(s, l)) return l - 1; return l; } /** * Applies rule 22. * @param s characters * @param l length * @return new length */ private static int rule22(final char[] s, final int l) { if(e(s, l, "\u03b5\u03c3\u03c4\u03b5\u03c1") || e(s, l, "\u03b5\u03c3\u03c4\u03b1\u03c4")) return l - 5; if(e(s, l, "\u03bf\u03c4\u03b5\u03c1") || e(s, l, "\u03bf\u03c4\u03b1\u03c4") || e(s, l, "\u03c5\u03c4\u03b5\u03c1") || e(s, l, "\u03c5\u03c4\u03b1\u03c4") || e(s, l, "\u03c9\u03c4\u03b5\u03c1") || e(s, l, "\u03c9\u03c4\u03b1\u03c4")) return l - 4; return l; } /** * Checks if the specified characters end with a specified suffix. * @param s characters * @param l length * @param suf suffix * @return result of check */ private static boolean e(final char[] s, final int l, final String suf) { final int sl = suf.length(); if(sl > l) return false; for(int i = sl - 1; i >= 0; i--) { if(s[l - (sl - i)] != suf.charAt(i)) return false; } return true; } /** * Checks if the specified characters end with a vowel. * @param s characters * @param l length * @return result of check */ private static boolean ev(final char[] s, final int l) { if(l == 0) return false; switch(s[l - 1]) { case '\u03b1': case '\u03b5': case '\u03b7': case '\u03b9': case '\u03bf': case '\u03c5': case '\u03c9': return true; default: return false; } } /** * Checks if the specified characters end with a vowel, but no y. * @param s characters * @param l length * @return result of check */ private static boolean ey(final char[] s, final int l) { if(l == 0) return false; switch(s[l - 1]) { case '\u03b1': case '\u03b5': case '\u03b7': case '\u03b9': case '\u03bf': case '\u03c9': return true; default: return false; } } /** * Checks if the specified characters are contained in the string array. * @param strings string array * @param s characters * @param l length of characters * @return result of check */ private static boolean c(final String[] strings, final char[] s, final int l) { for(final String e : strings) { final int el = e.length(); if(l != el) continue; int i = -1; while(++i < l && e.charAt(i) == s[i]); if(i == l) return true; } return false; } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/IndonesianStemmer.java000066400000000000000000000231061222453003200270560ustar00rootroot00000000000000package org.basex.util.ft; import java.util.*; import org.basex.util.*; /** * Indonesian stemming algorithm, derrived from Lucene 3.3.0 Indonesian stemmer * implementation which is based on report "A Study of Stemming Effects on * Information Retrieval in Bahasa Indonesia" by Fadillah Z Tala. * http://www.illc.uva.nl/Publications/ResearchReports/MoL-2003-02.text.pdf * * @author BaseX Team 2005-12, BSD License * @author Andria Arisal */ final class IndonesianStemmer extends InternalStemmer { /** Private variables. */ private int numSyllables; /** Flags. */ private int flags; /** * Flag for ke- prefix. * e.g.: ke-terang-an */ private static final int REMOVED_KE = 1; /** * Flag for peng- prefix. * e.g.: peng-umum-an */ private static final int REMOVED_PENG = 2; /** * Flag for di- prefix. * e.g.: di-keluar-kan */ private static final int REMOVED_DI = 4; /** * Flag for meng- prefix. * e.g.: meng-ukur */ private static final int REMOVED_MENG = 8; /** * Flag for ter- prefix. * e.g.: ter-jadi */ private static final int REMOVED_TER = 16; /** * Flag for ber- prefix. * e.g.: ber-tanding */ private static final int REMOVED_BER = 32; /** * Flag for pe- prefix. * e.g.: pe-nyanyi */ private static final int REMOVED_PE = 64; /** * Constructor. * @param fti full-text iterator */ IndonesianStemmer(final FTIterator fti) { super(fti); } @Override Stemmer get(final Language l, final FTIterator fti) { return new IndonesianStemmer(fti); } @Override Collection languages() { return collection("in"); } @Override protected byte[] stem(final byte[] word) { final TokenBuilder tb = new TokenBuilder(word); numSyllables = countSyllables(tb); int s = tb.size(); if(numSyllables > 2) remParticle(tb); if(numSyllables > 2) remPossesivePronous(tb); if(numSyllables > 2) remFirstPrefix(tb); final int n = tb.size(); if(n != s) { // a rule is fired if(numSyllables > 2) { remSuffix(tb); s = tb.size(); } // a rule is fired again if(n != s && numSyllables > 2) { remSecondPrefix(tb); return tb.finish(); } return tb.finish(); } // fail if(numSyllables > 2) remSecondPrefix(tb); if(numSyllables > 2) remSuffix(tb); return tb.finish(); } /** * Count syllabes. [p.9] A syllable contains at least one vowel * @param tb token builder * @return integer */ private static int countSyllables(final TokenBuilder tb) { int t = 0; final int s = tb.size(); for(int c = 0; c < s; c++) { final byte ch = tb.get(c); if(isVowel(ch)) t++; } return t; } /** * Check whether the character input is vowel. (a, e, i, o, u) * @param c char * @return boolean */ private static boolean isVowel(final byte c) { switch(c) { case 'a': case 'e': case 'i': case 'o': case 'u': return true; default: return false; } } /** * Remove particles. (-kah, -lah, -pun, -tah) * @param tb token builder */ private void remParticle(final TokenBuilder tb) { final int tl = tb.size(); if(tl > 3) { final int c1 = tb.get(tl - 1); final int c2 = tb.get(tl - 2); final int c3 = tb.get(tl - 3); if(c3 == 'k' && c2 == 'a' && c1 == 'h') { numSyllables--; tb.size(tl - 3); } else if(c3 == 'l' && c2 == 'a' && c1 == 'h') { numSyllables--; tb.size(tl - 3); } else if(c3 == 'p' && c2 == 'u' && c1 == 'n') { numSyllables--; tb.size(tl - 3); } else if(c3 == 't' && c2 == 'a' && c1 == 'h') { numSyllables--; tb.size(tl - 3); } } } /** * Remove possessive pronouns. (-ku, -mu, -nya) * @param tb token builder */ private void remPossesivePronous(final TokenBuilder tb) { final int tl = tb.size(); if(tl > 3) { final int c1 = tb.get(tl - 1); final int c2 = tb.get(tl - 2); final int c3 = tb.get(tl - 3); if(c2 == 'k' && c1 == 'u') { numSyllables--; tb.size(tl - 2); } else if(c2 == 'm' && c1 == 'u') { numSyllables--; tb.size(tl - 2); } else if(c3 == 'n' && c2 == 'y' && c1 == 'a') { numSyllables--; tb.size(tl - 3); } } } /** * Remove suffixes. (-kan, -an, -i (but not -si)) * @param tb token builder */ private void remSuffix(final TokenBuilder tb) { final int tl = tb.size(); if(tl > 3) { final int c1 = tb.get(tl - 1); final int c2 = tb.get(tl - 2); final int c3 = tb.get(tl - 3); if(c3 == 'k' && c2 == 'a' && c1 == 'n' && (flags & REMOVED_KE) == 0 && (flags & REMOVED_PENG) == 0 && (flags & REMOVED_PE) == 0) { numSyllables--; tb.size(tl - 3); } else if(c2 == 'a' && c1 == 'n' && (flags & REMOVED_DI) == 0 && (flags & REMOVED_MENG) == 0 && (flags & REMOVED_TER) == 0) { numSyllables--; tb.size(tl - 2); } else if(c1 == 'i' && c2 != 's' && (flags & REMOVED_BER) == 0 && (flags & REMOVED_KE) == 0 && (flags & REMOVED_PENG) == 0) { numSyllables--; tb.size(tl - 1); } } } /** * Remove first order prefixes. (meng-, meny-, men-, mem-, me-, peng-, peny-, * pen-, pem-, di-, ter-, ke-) * @param tb token builder */ private void remFirstPrefix(final TokenBuilder tb) { final int tl = tb.size(); if(tl > 4) { final int c1 = tb.get(0); final int c2 = tb.get(1); final int c3 = tb.get(2); final int c4 = tb.get(3); if(c1 == 'm' && c2 == 'e' && c3 == 'n' && c4 == 'g') { flags |= REMOVED_MENG; numSyllables--; tb.delete(0, 4); } else if(c1 == 'm' && c2 == 'e' && c3 == 'n' && c4 == 'y' && tl > 4 && isVowel(tb.get(4))) { final byte setS = 's'; flags |= REMOVED_MENG; tb.set(3, setS); numSyllables--; tb.delete(0, 3); } else if(c1 == 'm' && c2 == 'e' && c3 == 'n') { flags |= REMOVED_MENG; numSyllables--; tb.delete(0, 3); } else if(c1 == 'm' && c2 == 'e' && c3 == 'm' && tl > 3 && isVowel(tb.get(3))) { final byte setP = 'p'; flags |= REMOVED_MENG; tb.set(2, setP); numSyllables--; tb.delete(0, 2); } else if(c1 == 'm' && c2 == 'e' && c3 == 'm') { flags |= REMOVED_MENG; numSyllables--; tb.delete(0, 3); } else if(c1 == 'm' && c2 == 'e') { flags |= REMOVED_MENG; numSyllables--; tb.delete(0, 2); } else if(c1 == 'p' && c2 == 'e' && c3 == 'n' && c4 == 'g') { flags |= REMOVED_PENG; numSyllables--; tb.delete(0, 4); } else if(c1 == 'p' && c2 == 'e' && c3 == 'n' && c4 == 'y' && tl > 4 && isVowel(tb.get(4))) { flags |= REMOVED_PENG; final byte setS = 's'; tb.set(3, setS); numSyllables--; tb.delete(0, 3); } else if(c1 == 'p' && c2 == 'e' && c3 == 'n' && tl > 4 && isVowel(tb.get(3))) { flags |= REMOVED_PENG; final byte setT = 't'; tb.set(2, setT); numSyllables--; tb.delete(0, 2); } else if(c1 == 'p' && c2 == 'e' && c3 == 'n') { flags |= REMOVED_PENG; numSyllables--; tb.delete(0, 3); } else if(c1 == 'p' && c2 == 'e' && c3 == 'm' && tl > 4 && isVowel(tb.get(3))) { flags |= REMOVED_PENG; final byte setP = 'p'; tb.set(2, setP); numSyllables--; tb.delete(0, 2); } else if(c1 == 'p' && c2 == 'e' && c3 == 'm') { flags |= REMOVED_PENG; numSyllables--; tb.delete(0, 3); } else if(c1 == 'd' && c2 == 'i') { flags |= REMOVED_DI; numSyllables--; tb.delete(0, 2); } else if(c1 == 't' && c2 == 'e' && c3 == 'r') { flags |= REMOVED_TER; numSyllables--; tb.delete(0, 3); } else if(c1 == 'k' && c2 == 'e') { flags |= REMOVED_KE; numSyllables--; tb.delete(0, 2); } } } /** * Remove second order prefixes. (ber-, bel-, be-, per-, pel-, pe-) * @param tb token builder */ private void remSecondPrefix(final TokenBuilder tb) { final int tl = tb.size(); if(tl > 4) { final int c1 = tb.get(0); final int c2 = tb.get(1); final int c3 = tb.get(2); final int c4 = tb.get(3); if(c1 == 'b' && c2 == 'e' && c3 == 'r') { flags |= REMOVED_BER; numSyllables--; tb.delete(0, 3); } else if(c1 == 'b' && c2 == 'e' && c3 == 'l' && c4 == 'a' && tl > 7) { if(tb.get(4) == 'j' && tb.get(5) == 'a' && tb.get(6) == 'r') { flags |= REMOVED_BER; numSyllables--; tb.delete(0, 3); } } else if(c1 == 'b' && c2 == 'e' && !isVowel(tb.get(2)) && c4 == 'e' && tl > 4) { if(tb.get(4) == 'r') { flags |= REMOVED_BER; numSyllables--; tb.delete(0, 2); } } else if(c1 == 'p' && c2 == 'e' && c3 == 'r') { flags |= REMOVED_PE; numSyllables--; tb.delete(0, 3); } else if(c1 == 'b' && c2 == 'e' && c3 == 'l' && c4 == 'a' && tl > 7) { if(tb.get(4) == 'j' && tb.get(5) == 'a' && tb.get(6) == 'r') { flags |= REMOVED_PE; numSyllables--; tb.delete(0, 3); } } else if(c1 == 'p' && c2 == 'e') { flags |= REMOVED_PE; numSyllables--; tb.delete(0, 2); } } } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/InternalStemmer.java000066400000000000000000000007711222453003200265460ustar00rootroot00000000000000package org.basex.util.ft; /** * Internal stemmer implementation. * The names of the implementations * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class InternalStemmer extends Stemmer { /** * Constructor. * @param fti full-text iterator */ InternalStemmer(final FTIterator fti) { super(fti); } @Override protected final byte prec() { return 10; } @Override public final String toString() { return "Internal"; } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/JapaneseTokenizer.java000066400000000000000000000427001222453003200270540ustar00rootroot00000000000000package org.basex.util.ft; import static org.basex.util.Token.*; import static org.basex.util.ft.FTFlag.*; import java.io.*; import java.lang.reflect.*; import java.util.*; import org.basex.core.*; import org.basex.util.*; /** * Japanese lexer using igo (http://igo.sourceforge.jp/). * * @author BaseX Team 2005-12, BSD License * @author Toshio HIRAI */ public class JapaneseTokenizer extends Tokenizer { /** Flag available. */ private static boolean available = true; /** Name of the Igo tagger class. */ private static final String PATTERN = "net.reduls.igo.Tagger"; /** Name of Japanese dictionary. */ private static final String LANG = "ja"; /** The kind of POS(Noun). */ private static final String MEISHI = "\u540D\u8A5E"; /** The kind of POS(Pre-noun Adjectival). */ private static final String RENTAISHI = "\u9023\u4F53\u8A5E"; /** The kind of POS(Adverb). */ private static final String HUKUSHI = "\u526F\u8A5E"; /** The kind of POS(Verb). */ private static final String DOUSHI = "\u52D5\u8A5E"; /** The kind of POS(Conjunction). */ private static final String SETSUZOKUSHI = "\u63A5\u7D9A\u8A5E"; /** The kind of POS(Prefix). */ private static final String SETTOUSHI = "\u63A5\u982D\u8A5E"; /** The kind of POS(Modal verbs). */ private static final String JYODOUSHI = "\u52A9\u52D5\u8A5E"; /** The kind of POS(Postpositional particle). */ private static final String JYOSHI = "\u52A9\u8A5E"; /** The kind of POS(Adjective). */ private static final String KEIYOUSHI = "\u5F62\u5BB9\u8A5E"; /** The kind of POS(Mark). */ private static final String KIGOU = "\u8A18\u53F7"; /** The kind of POS(Interjection). */ private static final String KANDOUSHI = "\u611F\u52D5\u8A5E"; /** The kind of POS(Filler). */ private static final String FILLER = "\u30D5\u30A3\u30E9\u30FC"; /** Constant of Feature(Mark). */ private static final String KIGOU_FEATURE = "\u8A18\u53F7,*,*,*,*,*,*,*,*"; /** Constant of Feature(Noun). */ private static final String MEISHI_FEATURE = "\u540D\u8A5E,*,*,*,*,*,*,*,*"; /** Igo instance. */ private static Object tagger; /** Parse method. */ private static Method parse; /** Surface field. */ private static Field surface; /** feature field. */ private static Field feature; /** Start field. */ private static Field start; /** Token iterator. */ private Iterator tokens; /** Token list. */ private ArrayList tokenList = new ArrayList(); /** Current position of the Token list. */ private int cpos; /** Current token. */ private Morpheme currToken; /** Diacritics flag. */ private final boolean dc; /** Sensitivity flag. */ private final boolean cs; /** Uppercase flag. */ private final boolean uc; /** Lowercase flag. */ private final boolean lc; /** Wildcard flag. */ private final boolean wc; /** Stemming flag. */ private final boolean st; /** Token position. */ private int pos = -1; /** Flag indicating a special character. */ private boolean sc; static { File dic = null; if(!Reflect.available(PATTERN)) { available = false; } else { dic = new File(LANG); if(!dic.exists()) { dic = new File(Prop.HOME, "etc/" + LANG); if(!dic.exists()) { available = false; } } } if(available) { Class clz = Reflect.find(PATTERN); if(clz == null) { Util.debug("Could not initialize Igo Japanese lexer."); } else { /* Igo constructor. */ final Constructor tgr = Reflect.find(clz, String.class); tagger = Reflect.get(tgr, dic.toString()); if(tagger == null) { available = false; Util.debug("Could not initialize Igo Japanese lexer."); } else { parse = Reflect.method(clz, "parse", CharSequence.class); if(parse == null) { Util.debug("Could not initialize Igo lexer method."); } clz = Reflect.find("net.reduls.igo.Morpheme"); surface = Reflect.field(clz, "surface"); feature = Reflect.field(clz, "feature"); start = Reflect.field(clz, "start"); } } } } /** * Checks if the library is available. * @return result of check */ static boolean available() { return available; } /** * Constructor. * @param fto (optional) full-text options */ public JapaneseTokenizer(final FTOpt fto) { lc = fto != null && fto.is(LC); uc = fto != null && fto.is(UC); cs = fto != null && fto.is(CS); wc = fto != null && fto.is(WC); dc = fto != null && fto.is(DC); st = fto != null && fto.is(ST); } @Override Tokenizer get(final FTOpt f) { return new JapaneseTokenizer(f); } @Override public JapaneseTokenizer init(final byte[] txt) { String source = string(txt); if(wc) { // convert wide-space to space source = source.replace('\u3000', '\u0020'); } final ArrayList morpheme = (ArrayList) Reflect.invoke(parse, tagger, source); final ArrayList list = new ArrayList(); try { int prev = 0; for(int i = 0; i < morpheme.size(); i++) { final Object m = morpheme.get(i); final String srfc = surface.get(m).toString(); final String ftr = feature.get(m).toString(); final int s = start.getInt(m); if(i != 0) { final int l = s - prev; if(l != 0) { list.add(new Morpheme( source.substring(s - 1, s + l - 1), KIGOU_FEATURE) ); } } prev = srfc.length() + s; // separates continuous mark (ASCII) boolean cont = true; final ArrayList marks = new ArrayList(); for(int j = 0; j < srfc.length(); j++) { final String c = String.valueOf(srfc.charAt(j)); final byte[] t = token(c); if(t.length == 1) if(letter(t[0]) || digit(t[0])) cont = false; else marks.add(new Morpheme(c, KIGOU_FEATURE)); else cont = false; } if(cont) list.addAll(marks); else list.add(new Morpheme(srfc, ftr)); } } catch(final Exception ex) { Util.errln(Util.name(this) + ": " + ex); } tokenList = list; tokens = list.iterator(); return this; } /** * Returns whether the special character. * @param s string * @return result of check */ private static boolean isFtChar(final String s) { return s.equals(".") || s.equals("?") || s.equals("*") || s.equals("+") || s.equals("\\") || s.equals("{") || s.equals("}"); } /** * Returns whether the following token exists (using wildcards). * @return result of check */ private boolean moreWC() { final StringBuilder word = new StringBuilder(); final int size = tokenList.size(); boolean period = false; boolean bs = false; boolean more = false; for(; cpos < size; cpos++) { String cSrfc = tokenList.get(cpos).getSurface(); final boolean cMark = tokenList.get(cpos).isMark(); String nSrfc = null; boolean nMark = false; if(cpos < size - 1) { nSrfc = tokenList.get(cpos + 1).getSurface(); nMark = tokenList.get(cpos + 1).isMark(); } if(nSrfc != null) { if(cSrfc.equals("\\")) bs = true; // delimiter if(cMark && !isFtChar(cSrfc) || cSrfc.equals("\\") && nMark) { period = false; bs = false; if(word.length() != 0) { more = true; break; } if(cSrfc.equals("\\") && nMark) cpos++; continue; } word.append(cSrfc); if(bs || nSrfc.equals("\\")) { more = true; continue; } if(cSrfc.equals(".") || nSrfc.equals(".")) { period = true; continue; } if(period) { if(cSrfc.equals("{")) { cpos++; for(; cpos < size; cpos++) { cSrfc = tokenList.get(cpos).getSurface(); word.append(cSrfc); if(cSrfc.equals("}")) { more = true; break; } } cpos++; break; } continue; } } else { // last token. if(cMark) { if(cSrfc.equals("\\")) continue; if(word.length() != 0) { word.append(cSrfc); } more = true; continue; } } if(period) { word.append(cSrfc); } else { if(bs) if(!isFtChar(cSrfc)) word.append(cSrfc); else word.setLength(0); } more = true; cpos++; break; } if(more) { currToken = word.length() != 0 ? new Morpheme(word.toString(), MEISHI_FEATURE) : tokenList.get(cpos - 1); } return more; } /** * Returns whether the following token exists. * @return result */ private boolean more() { if(special) { return tokens.hasNext(); } while(tokens.hasNext()) { currToken = tokens.next(); if(!currToken.isMark() && !currToken.isAttachedWord()) return true; } return false; } @Override public boolean hasNext() { return wc ? moreWC() : more(); } @Override public FTSpan next() { return new FTSpan(nextToken(), pos, sc); } /** * Returns the effective token. * @return token */ private byte[] get() { pos++; String n = currToken.getSurface(); final int hinshi = currToken.getHinshi(); if(st && (hinshi == Morpheme.HINSHI_DOUSHI || hinshi == Morpheme.HINSHI_KEIYOUSHI)) { n = currToken.getBaseForm(); } byte[] token = token(n); final boolean a = ascii(token); if(!a && !dc) token = WesternTokenizer.dia(token); if(uc) token = WesternTokenizer.upper(token, a); if(lc || !cs) token = WesternTokenizer.lower(token, a); return toHankaku(token); } /** * Returns the token which contains special character. * @return token */ private byte[] getSC() { final Morpheme m = tokens.next(); final String n = m.getSurface(); if(m.isMark() || m.isAttachedWord()) sc = true; else { pos++; sc = false; } return token(n); } @Override public byte[] nextToken() { return special ? getSC() : get(); } @Override protected byte prec() { return 20; } @Override Collection languages() { return collection(LANG); } /** * Converts to HANKAKU characters. * @param s Japanese text * @return result of conversion(->HANKAKU) */ private static byte[] toHankaku(final byte[] s) { if(ascii(s)) return s; final TokenBuilder tb = new TokenBuilder(s.length); for(int p = 0; p < s.length; p += cl(s, p)) { final int c = cp(s, p); if(c >= 0xFF10 && c <= 0xFF19 || c >= 0xFF21 && c <= 0xFF3A || c >= 0xFF41 && c <= 0xFF5A) { tb.add(c - 0xFEE0); } else if(c == 0x3000) { // IDEOGRAPHIC SPACE tb.add(0x0020); } else if(c == 0xFF01) { // ! tb.add(0x0021); } else if(c == 0xFF02) { // " FULLWIDTH QUOTATION MARK tb.add(0x0022); } else if(c == 0x201C) { // " LEFT DOUBLE QUOTATION MARK tb.add(0x0022); } else if(c == 0x201D) { // " RIGHT DOUBLE QUOTATION MARK tb.add(0x0022); } else if(c == 0xFF03) { // # tb.add(0x0023); } else if(c == 0xFF04) { // $ tb.add(0x0024); } else if(c == 0xFF05) { // % tb.add(0x0025); } else if(c == 0xFF06) { // & tb.add(0x0026); } else if(c == 0xFF07) { // ' FULLWIDTH APOSTROPHE tb.add(0x0027); } else if(c == 0x2018) { // ' LEFT SINGLE QUOTATION MARK tb.add(0x0027); } else if(c == 0x2019) { // ' RIGHT SINGLE QUOTATION MARK tb.add(0x0027); } else if(c == 0xFF08) { // ( tb.add(0x0028); } else if(c == 0xFF09) { // ) tb.add(0x0029); } else if(c == 0xFF0A) { // * tb.add(0x002A); } else if(c == 0xFF0B) { // + tb.add(0x002B); } else if(c == 0xFF0C) { // , tb.add(0x002C); } else if(c == 0xFF0D) { // - tb.add(0x002D); } else if(c == 0xFF0E) { // . tb.add(0x002E); } else if(c == 0xFF0F) { // / tb.add(0x002F); } else if(c == 0xFF1A) { // : tb.add(0x003A); } else if(c == 0xFF1B) { // ; tb.add(0x003B); } else if(c == 0xFF1C) { // < tb.add(0x003C); } else if(c == 0xFF1D) { // = tb.add(0x003D); } else if(c == 0xFF1E) { // > tb.add(0x003E); } else if(c == 0xFF1F) { // ? tb.add(0x003F); } else if(c == 0xFF20) { // @ tb.add(0x0040); } else if(c == 0xFF3B) { // [ tb.add(0x005B); } else if(c == 0xFFE5) { // \ tb.add(0x005C); } else if(c == 0xFF3D) { // ] tb.add(0x005D); } else if(c == 0xFF3E) { // ^ tb.add(0x005E); } else if(c == 0xFF3F) { // _ tb.add(0x005F); } else if(c == 0xFF40) { // ` tb.add(0x0060); } else if(c == 0xFF5B) { // { tb.add(0x007B); } else if(c == 0xFF5C) { // | tb.add(0x007C); } else if(c == 0xFF5D) { // } tb.add(0x007D); } else if(c == 0xFF5E) { // ~ tb.add(0x007E); } else { tb.add(c); } } return tb.finish(); } /** Morpheme class. */ static class Morpheme { /** A part of speech in the context, NEISHI(Noun). */ static final int HINSHI_MEISHI = 1; /** A part of speech in the context, RENTAISHI(Pre-noun Adjectival). */ static final int HINSHI_RENTAISHI = 2; /** A part of speech in the context, HUKUSHI(Adverb). */ static final int HINSHI_HUKUSHI = 3; /** A part of speech in the context, DOUSHI(Verb). */ static final int HINSHI_DOUSHI = 4; /** A part of speech in the context, SETSUZOKUSHI(Conjunction). */ static final int HINSHI_SETSUZOKUSHI = 5; /** A part of speech in the context, JYODOUSHI(Modal verbs). */ static final int HINSHI_JYODOUSHI = 6; /** A part of speech in the context, JYOSHI(Postpositional particle). */ static final int HINSHI_JYOSHI = 7; /** A part of speech in the context, KEIYOUSHI(Adjective). */ static final int HINSHI_KEIYOUSHI = 8; /** A part of speech in the context, KIGOU(Mark). */ static final int HINSHI_KIGOU = 9; /** A part of speech in the context, KANDOUSHI(Interjection). */ static final int HINSHI_KANDOUSHI = 10; /** A part of speech in the context, FILLER(Filler). */ static final int HINSHI_FILLER = 11; /** A part of speech in the context, SETTOUSHI(Prefix). */ static final int HINSHI_SETTOUSHI = 12; /** A part of speech in the context, Others. */ static final int HINSHI_SONOTA = 0; /** Surface of Morpheme. */ private final String mSurface; /** Feature of Morpheme. */ private final String mFeature; /** * Constructor. * @param srfc surface * @param ftr feature */ Morpheme(final String srfc, final String ftr) { mSurface = srfc; mFeature = ftr; } /** * Returns surface. * @return Surface */ public String getSurface() { return mSurface; } /** * Returns whether the avoid token. * @return result */ public boolean isMark() { final int hinshi = getHinshi(); return hinshi == HINSHI_KIGOU || hinshi == HINSHI_FILLER; } /** * Tests an attached word(FUZOKU-GO). * @return result */ public boolean isAttachedWord() { final int hinshi = getHinshi(); return hinshi == HINSHI_JYODOUSHI || hinshi == HINSHI_JYOSHI; } /** * Returns the part of speech. * @return part of speech */ public int getHinshi() { final int hinshi; // morphological analyzer certainly returns // the single ascii char as a "noun". final byte[] s = token(mSurface); if(s.length == 1 && !letter(s[0]) && !digit(s[0])) { hinshi = HINSHI_KIGOU; } else { final String h = getPos(); if(h.equals(MEISHI)) { hinshi = HINSHI_MEISHI; } else if(h.equals(RENTAISHI)) { hinshi = HINSHI_RENTAISHI; } else if(h.equals(HUKUSHI)) { hinshi = HINSHI_HUKUSHI; } else if(h.equals(DOUSHI)) { hinshi = HINSHI_DOUSHI; } else if(h.equals(SETSUZOKUSHI)) { hinshi = HINSHI_SETSUZOKUSHI; } else if(h.equals(SETTOUSHI)) { hinshi = HINSHI_SETTOUSHI; } else if(h.equals(JYODOUSHI)) { hinshi = HINSHI_JYODOUSHI; } else if(h.equals(JYOSHI)) { hinshi = HINSHI_JYOSHI; } else if(h.equals(KEIYOUSHI)) { hinshi = HINSHI_KEIYOUSHI; } else if(h.equals(KIGOU)) { hinshi = HINSHI_KIGOU; } else if(h.equals(KANDOUSHI)) { hinshi = HINSHI_KANDOUSHI; } else if(h.equals(FILLER)) { hinshi = HINSHI_FILLER; } else { hinshi = HINSHI_SONOTA; } } return hinshi; } /** * Retrieves base form from feature. * @return base form */ public String getBaseForm() { final String[] parts = mFeature.split(","); return parts[6]; } /** * Retrieves parts of speech from feature. * @return parts of speech(coding in Japanese) */ private String getPos() { final String[] parts = mFeature.split(","); return parts[0]; } @Override public String toString() { return mSurface; } } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/Language.java000066400000000000000000000057431222453003200251640ustar00rootroot00000000000000package org.basex.util.ft; import java.util.*; import org.basex.core.*; /** * This class contains language tokens which are valid for the xml:lang * attribute. * As specified by W3C, the values of the attribute are language identifiers as * defined by IETF BCP 47, Tags for the Identification of Languages. * * @see http://www.w3.org/TR/REC-xml/#sec-lang-tag * @see http://tools.ietf.org/html/bcp47 * @see http://www.iana.org/assignments/language-subtag-registry * * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov * @author Jens Erat */ public final class Language implements Comparable { /** Available languages, indexed by language code. */ static final HashMap ALL = new HashMap(); /** Available languages, indexed by their display. */ private static final HashMap DISP = new HashMap(); static { for(final Locale l : Locale.getAvailableLocales()) { ALL.put(l.getLanguage(), new Language(l)); DISP.put(l.getDisplayLanguage(Locale.ENGLISH), new Language(l)); } } /** Locale. */ private final Locale locale; /** * Private Constructor. * @param loc locale */ private Language(final Locale loc) { locale = loc; } /** * Returns an instance for the specified language code, or {@code null}. * @param lang name or code of language * @return language code */ public static Language get(final String lang) { final int i = lang.indexOf('-'); final String l = i == -1 ? lang : lang.substring(0, i); Language ln = ALL.get(l.toLowerCase(Locale.ENGLISH)); if(ln == null) ln = DISP.get(lang); return ln; } /** * Returns an instance for the current language property, * or English as default language. * @param prop properties * @return language code */ public static Language get(final Prop prop) { final Language lang = get(prop.get(Prop.LANGUAGE)); return lang == null ? get("en") : lang; } /** * Returns the user language as default language, or English, if the user * language cannot be assigned. * @return default language */ public static Language def() { final Language lang = DISP.get(Prop.language); return lang == null ? get("en") : lang; } /** * Returns the language code (ISO 639). * @return code */ String code() { return locale.getLanguage(); } @Override public boolean equals(final Object o) { return o instanceof Language && code().equals(((Language) o).code()); } @Override public int hashCode() { return code().hashCode(); } @Override public int compareTo(final Language o) { return code().compareTo(o.code()); } @Override public String toString() { return locale.getDisplayLanguage(Locale.ENGLISH); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/LanguageImpl.java000066400000000000000000000027361222453003200260050ustar00rootroot00000000000000package org.basex.util.ft; import java.util.*; /** * Abstract class for stemmer and tokenizer implementations. * * @author BaseX Team 2005-12, BSD License * @author Jens Erat */ abstract class LanguageImpl extends FTIterator implements Comparable { /** * Returns the precedence of the processor. If two language implementations * support the same language, the processor with the higher precedence * will be selected. * @return precedence */ protected abstract byte prec(); /** * Checks if the specified language is supported. * @param ln language * @return true if language is supported */ public boolean supports(final Language ln) { return languages().contains(ln); } /** * Creates a collection with the specified language. * @param ln language * @return collection */ static Collection collection(final String ln) { final HashSet coll = new HashSet(); final Language lang = Language.get(ln); if(lang != null) coll.add(lang); return coll; } /** * Returns the supported languages. * @return languages */ abstract Collection languages(); @Override public final boolean equals(final Object o) { return o instanceof LanguageImpl && ((LanguageImpl) o).prec() == prec(); } @Override public final int compareTo(final LanguageImpl o) { return o.prec() - prec(); } @Override public int hashCode() { return prec(); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/LuceneStemmer.java000066400000000000000000000106271222453003200262060ustar00rootroot00000000000000package org.basex.util.ft; import static org.basex.util.Token.*; import java.lang.reflect.*; import java.util.*; import org.basex.util.*; /** * Stemmer implementation using the Lucene stemmer contributions. * The Lucene stemmers are based on the Apache License: * {@code http://lucene.apache.org/}. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ final class LuceneStemmer extends Stemmer { /** Name of the package with all Lucene stemmers. */ private static final String PATTERN = "org.apache.lucene.analysis.%Stemmer"; /** Stemmer classes which the Lucene library provides. */ private static final HashMap CLASSES = new HashMap(); /** Stemmer class corresponding to the required properties. */ private StemmerClass clazz; /** Stemmer instance. */ private Object stemmer; static { if(Reflect.available(PATTERN, "de.German")) { add(Language.get("cs"), "cz.Czech"); add(Language.get("es"), "es.SpanishLight"); add(Language.get("fi"), "fi.FinnishLight"); add(Language.get("hu"), "hu.HungarianLight"); add(Language.get("it"), "it.ItalianLight"); add(Language.get("pt"), "br.Brazilian"); add(Language.get("sv"), "sv.SwedishLight"); add("ar", "bg", "de", "fr", "hi", "lv", "nl", "ru"); } } /** * Check if a stemmer class is available, and add it the the list of stemmers. * @param lang language */ private static void add(final String... lang) { for(final String ln : lang) { final Language l = Language.get(ln); if(l != null) add(l, l.code() + '.' + l); } } /** * Check if a stemmer class is available, and add it the the list of stemmers. * @param lang language * @param name name of language */ private static void add(final Language lang, final String name) { final Class clz = Reflect.find(PATTERN, name); if(clz == null) { Util.debug("Could not initialize \"%\" Lucene stemmer class.", lang); return; } final boolean ch; Method m = Reflect.method(clz, "stem", String.class); ch = m == null; if(ch) m = Reflect.method(clz, "stem", char[].class, int.class); if(m == null) { Util.debug("Could not initialize \"%\" Lucene stemmer method.", lang); } else { CLASSES.put(lang, new StemmerClass(clz, m, ch)); } } /** * Checks if the library is available. * @return result of check */ static boolean available() { return !CLASSES.isEmpty(); } /** Empty constructor. */ LuceneStemmer() { } /** * Constructs a stemmer instance. Call {@link #available()} first to * check if the library is available. * @param lang language of the text to stem * @param fti full-text iterator */ private LuceneStemmer(final Language lang, final FTIterator fti) { super(fti); clazz = CLASSES.get(lang); stemmer = Reflect.get(clazz.clz); } @Override Collection languages() { return CLASSES.keySet(); } @Override Stemmer get(final Language l, final FTIterator fti) { return new LuceneStemmer(l, fti); } @Override public boolean supports(final Language lang) { return CLASSES.containsKey(lang); } @Override protected byte prec() { return 5; } @Override protected byte[] stem(final byte[] word) { String s = string(word); if(clazz.chars) { final char[] ch = s.toCharArray(); final int cl = s.length(); final int nl = (Integer) Reflect.invoke(clazz.stem, stemmer, ch, cl); s = new String(ch, 0, nl); } else { s = (String) Reflect.invoke(clazz.stem, stemmer, s); } return s == null ? word : token(s); } /** Structure, containing stemming methods. */ private static class StemmerClass { /** Class implementing the stemmer. */ final Class clz; /** Method {@code stem}. */ final Method stem; /** String indicator. */ final boolean chars; /** * Constructor. * @param sc class implementing the stemmer * @param stm method {@code stem} * @param ch indicator for stemming via character array */ StemmerClass(final Class sc, final Method stm, final boolean ch) { clz = sc; stem = stm; chars = ch; stem.setAccessible(true); } } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/Scoring.java000066400000000000000000000044111222453003200250340ustar00rootroot00000000000000package org.basex.util.ft; import static java.lang.StrictMath.*; /** * Default scoring model, assembling all score calculations. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Scoring { /** Logarithmic base for calculating the score value. */ private static final double LOG = Math.E - 1; /** Scoring step. */ private static final double SCORESTEP = 0.8; /** Private constructor. */ private Scoring() { } /** * Calculates a score value, based on the token length * and complete text length. * @param tl token length * @param l complete length * @return result */ public static double word(final int tl, final double l) { return min(1, log(1 + LOG * tl / l)); } /** * Combines two scoring values. * @param o old value * @param n new value * @return result */ public static double and(final double o, final double n) { return 1 - (1 - o) * (1 - n); } /** * Combines two scoring values. * @param o old value * @param n new value * @return result */ public static double or(final double o, final double n) { return and(o, n); } /** * Inverses the scoring value for FTNot. * @param d scoring value * @return inverse scoring value */ public static double not(final double d) { return 1 - d; } /** * Returns a score for the let clause. * @param s summed up scoring values * @param c number of values * @return new score value */ public static double let(final double s, final int c) { return s / c; } /** * Calculates the score for a text node. * Used if no index score is available. * @param npv number of pos values * @param is total number of index entries * @param tokl token length * @param tl text length * @return score value */ public static double textNode(final int npv, final int is, final int tokl, final int tl) { return max((double) npv / is, log(tokl * npv + 1) / log(tl + 1)); } /** * Returns a score for a single step. * @param sc current score value * @return new score value */ public static double step(final double sc) { return sc * SCORESTEP; } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/SnowballStemmer.java000066400000000000000000000066471222453003200265630ustar00rootroot00000000000000package org.basex.util.ft; import static org.basex.util.Token.*; import java.lang.reflect.*; import java.util.*; import org.basex.util.*; /** * Stemmer implementation using the Snowball stemmer. * The Snowball stemmers were written by Dr Martin Porter and Richard Boulton * and is based on the BSD License: {@code http://snowball.tartarus.org/}. * * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ final class SnowballStemmer extends Stemmer { /** Name of the package with all Snowball stemmers. */ private static final String PATTERN = "org.tartarus.snowball.ext.%Stemmer"; /** Stemmer classes which the Snowball library provides. */ private static final HashMap CLASSES = new HashMap(); /** Stemmer class corresponding to the required properties. */ private StemmerClass clazz; /** Stemmer instance. */ private Object stemmer; static { if(Reflect.available(PATTERN, "German")) { for(final Language l : Language.ALL.values()) { final Class clz = Reflect.find(PATTERN, l); if(clz == null) continue; final Method m1 = Reflect.method(clz, "setCurrent", String.class); final Method m2 = Reflect.method(clz, "stem"); final Method m3 = Reflect.method(clz, "getCurrent"); if(m1 == null || m2 == null || m3 == null) { Util.debug("Could not initialize \"%\" Snowball stemmer.", l); } else { CLASSES.put(l, new StemmerClass(clz, m1, m2, m3)); } } } } /** * Checks if the library is available. * @return result of check */ static boolean available() { return !CLASSES.isEmpty(); } /** Empty constructor. */ SnowballStemmer() { } /** * Constructs a Snowball stemmer. Call {@link #available()} first to * check if the library is available. * @param fti full-text iterator * @param lang language of the text to stem */ private SnowballStemmer(final Language lang, final FTIterator fti) { super(fti); clazz = CLASSES.get(lang); stemmer = Reflect.get(clazz.clz); } @Override Stemmer get(final Language l, final FTIterator fti) { return new SnowballStemmer(l, fti); } @Override public boolean supports(final Language lang) { return CLASSES.containsKey(lang); } @Override protected byte prec() { return 2; } @Override Collection languages() { return CLASSES.keySet(); } @Override protected byte[] stem(final byte[] word) { Reflect.invoke(clazz.setCurrent, stemmer, string(word)); Reflect.invoke(clazz.stem, stemmer); final String s = (String) Reflect.invoke(clazz.getCurrent, stemmer); return s == null ? word : token(s); } /** Structure, containing stemming methods. */ private static class StemmerClass { /** Class implementing the stemmer. */ final Class clz; /** Method {@code setCurrent}. */ final Method setCurrent; /** Method {@code stem}. */ final Method stem; /** Method {@code getCurrent}. */ final Method getCurrent; /** * Constructor. * @param sc class implementing the stemmer * @param s method {@code setCurrent} * @param stm method {@code stem} * @param g method {@code getCurrent} */ StemmerClass(final Class sc, final Method s, final Method stm, final Method g) { clz = sc; setCurrent = s; stem = stm; getCurrent = g; } } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/StemDir.java000066400000000000000000000020631222453003200250000ustar00rootroot00000000000000package org.basex.util.ft; import static org.basex.util.Token.*; import java.io.*; import org.basex.io.*; import org.basex.util.hash.*; /** * Simple stemming directory for full-text requests. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class StemDir extends TokenMap { /** * Reads a stop words file. * @param fl file reference * @return true if everything went alright */ public boolean read(final IO fl) { try { for(final byte[] sl : split(fl.read(), '\n')) { byte[] val = null; for(final byte[] st : split(norm(sl), ' ')) { if(val == null) val = st; else put(st, val); } } return true; } catch(final IOException ex) { return false; } } /** * Returns a stemmed word or the word itself. * @param word word to be stemmed * @return resulting token */ public byte[] stem(final byte[] word) { final byte[] sn = get(word); return sn != null ? sn : word; } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/Stemmer.java000066400000000000000000000043551222453003200250530ustar00rootroot00000000000000package org.basex.util.ft; import java.util.*; import org.basex.util.*; /** * Implementation of common stemmer methods. * * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ public abstract class Stemmer extends LanguageImpl { /** List of available stemmers. */ static final LinkedList IMPL = new LinkedList(); /** Load stemmers and order them by precedence. */ static { // built-in stemmers IMPL.add(new EnglishStemmer(null)); IMPL.add(new GermanStemmer(null)); IMPL.add(new GreekStemmer(null)); IMPL.add(new IndonesianStemmer(null)); IMPL.add(new DummyStemmer(null)); if(SnowballStemmer.available()) IMPL.add(new SnowballStemmer()); if(LuceneStemmer.available()) IMPL.add(new LuceneStemmer()); if(WordnetStemmer.available()) IMPL.add(new WordnetStemmer()); // sort stemmers and tokenizers by precedence Collections.sort(IMPL); } /** Full-text iterator. */ private final FTIterator iter; /** * Constructor. */ Stemmer() { this(null); } /** * Constructor. * @param ft full-text iterator. */ Stemmer(final FTIterator ft) { iter = ft; } /** * Checks if the language is supported by the available stemmers. * @param l language to be found * @return result of check */ public static boolean supportFor(final Language l) { for(final Stemmer s : IMPL) if(s.supports(l)) return true; return false; } /** * Factory method. * @param l language * @param fti full-text iterator * @return stemmer */ abstract Stemmer get(final Language l, final FTIterator fti); /** * Stems a word. * @param word input word to stem * @return the stem of the word */ protected abstract byte[] stem(final byte[] word); @Override public final Stemmer init(final byte[] txt) { iter.init(txt); return this; } @Override public final boolean hasNext() { return iter.hasNext(); } @Override public final FTSpan next() { final FTSpan s = iter.next(); s.text = stem(s.text); return s; } @Override public final byte[] nextToken() { return stem(iter.nextToken()); } @Override public String toString() { return Util.name(this).replace("Stemmer", ""); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/StopWords.java000066400000000000000000000043351222453003200254010ustar00rootroot00000000000000package org.basex.util.ft; import static org.basex.data.DataText.*; import static org.basex.util.Token.*; import java.io.*; import org.basex.core.*; import org.basex.data.*; import org.basex.io.*; import org.basex.io.in.DataInput; import org.basex.io.out.DataOutput; import org.basex.util.*; import org.basex.util.hash.*; /** * Simple stop words set for full-text requests. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class StopWords extends TokenSet { /** * Default constructor. */ public StopWords() { } /** * Constructor, reading stopword list from disk. * And creating database stopword file. * @param data data reference * @param file stopword list file * @throws IOException I/O exception */ public StopWords(final Data data, final String file) throws IOException { if(!data.meta.prop.get(Prop.STOPWORDS).isEmpty()) read(IO.get(file), false); final DataOutput out = new DataOutput(data.meta.dbfile(DATASWL)); write(out); out.close(); } /** * Compiles the stop word list. * @param data data reference */ public void comp(final Data data) { // no data reference, or stop words have already been defined.. if(data == null || size() != 0 || data.inMemory()) return; // try to parse the stop words file of the current database try { final IOFile file = data.meta.dbfile(DATASWL); if(!file.exists()) return; final DataInput in = new DataInput(data.meta.dbfile(DATASWL)); try { read(in); } finally { in.close(); } } catch(final Exception ex) { Util.debug(ex); } } /** * Reads a stop words file. * @param file file reference * @param exclude exclude stop words * @return success flag */ public boolean read(final IO file, final boolean exclude) { try { final byte[] content = norm(file.read()); final int s = Token.contains(content, ' ') ? ' ' : '\n'; for(final byte[] sl : split(content, s)) { if(exclude) delete(sl); else put(sl); } return true; } catch(final IOException ex) { return false; } } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/Tokenizer.java000066400000000000000000000041101222453003200253760ustar00rootroot00000000000000package org.basex.util.ft; import java.util.*; /** * Abstract tokenizer. * * @author BaseX Team 2005-12, BSD License * @author Jens Erat */ public abstract class Tokenizer extends LanguageImpl { /** List of available tokenizers. */ public static final LinkedList IMPL = new LinkedList(); /** Are special characters included? */ boolean special; /** Load tokenizer classes and order them by precedence. */ static { IMPL.add(new WesternTokenizer(null)); if(JapaneseTokenizer.available()) IMPL.add(new JapaneseTokenizer(null)); Collections.sort(IMPL); } /** * Checks if the language is supported by the available tokenizers. * @param l language to be found * @return result of check */ public static boolean supportFor(final Language l) { for(final Tokenizer t : IMPL) if(t.supports(l)) return true; return false; } /** * Factory method. * @param f full-text options * @return tokenizer */ abstract Tokenizer get(final FTOpt f); /** * Gets full-text info for the specified token; needed for visualizations. * Does not have to be implemented by all tokenizers. *
    *
  • int[0]: length of each token *
  • int[1]: sentence info, length of each sentence *
  • int[2]: paragraph info, length of each paragraph *
  • int[3]: each token as int[] *
  • int[4]: punctuation marks of each sentence *
* @return int arrays or empty array if not implemented */ int[][] info() { return new int[0][]; } /** * Checks if current token is a paragraph. Does not have to be implemented * by all tokenizers. Returns false if not implemented. * @return whether current token is a paragraph */ boolean paragraph() { return false; } /** * Calculates a position value, dependent on the specified unit. Does not have * to be implemented by all tokenizers. Returns 0 if not implemented. * @param w word position * @param u unit * @return new position */ @SuppressWarnings("unused") int pos(final int w, final FTUnit u) { return 0; } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/WesternTokenizer.java000066400000000000000000000216731222453003200267630ustar00rootroot00000000000000package org.basex.util.ft; import static org.basex.util.Token.*; import static org.basex.util.ft.FTFlag.*; import java.util.*; import org.basex.util.*; import org.basex.util.list.*; /** * Full-text tokenizer. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class WesternTokenizer extends Tokenizer { /** Supported languages. */ private static final HashSet SUPPORTED = new HashSet(); static { final String[] nonw = { "ar", "ja", "ko", "th", "zh" }; for(final Language l : Language.ALL.values()) { if(!eq(l.code(), nonw)) SUPPORTED.add(l); } } /** Cached sentence positions. */ private final IntList sen = new IntList(); /** Cached paragraph positions. */ private final IntList par = new IntList(); /** Diacritics flag. */ private final boolean dc; /** Sensitivity flag. */ private final boolean cs; /** Uppercase flag. */ private final boolean uc; /** Lowercase flag. */ private final boolean lc; /** Wildcard flag. */ private final boolean wc; /** Flag for a paragraph. */ private boolean pa; /** Text. */ private byte[] text = EMPTY; /** Current sentence. */ private int sent; /** Current paragraph. */ private int para; /** Last punctuation mark. */ private int pm; /** Last character position. */ private int lp; /** Character start position. */ private int spos; /** Current token position. */ private int pos = -1; /** Current character position. */ private int cpos; /** Flag indicating a special character. */ private boolean sc; /** Next pointer. */ private int next; /** * Constructor. * @param f full-text options */ public WesternTokenizer(final FTOpt f) { lc = f != null && f.is(LC); uc = f != null && f.is(UC); cs = f != null && f.is(CS); wc = f != null && f.is(WC); dc = f != null && f.is(DC); } @Override Collection languages() { return SUPPORTED; } @Override Tokenizer get(final FTOpt f) { return new WesternTokenizer(f); } @Override public WesternTokenizer init(final byte[] txt) { if(text != txt) { text = txt; sen.reset(); par.reset(); } init(); return this; } /** * Initializes the iterator. */ private void init() { sent = 0; para = 0; pos = -1; cpos = 0; next = 0; } @Override public boolean hasNext() { if(next <= 0 && (special ? moreSC() : more())) next++; return next > 0; } @Override public FTSpan next() { return new FTSpan(nextToken(), pos, sc); } @Override public byte[] nextToken() { if(--next < 0) hasNext(); return special ? getSC() : get(); } /** * Scans the next token and returns {@code true} if more tokens can be * returned. * @return result of check */ private boolean more() { final int l = text.length; ++pos; lp = cpos; // parse whitespaces boolean sn = false; pa = false; boolean bs = false; for(; cpos < l; cpos += cl(text, cpos)) { final int c = cp(text, cpos); if(wc && !bs) { bs = c == '\\'; if(bs) continue; if(c == '.') break; } if(!sn && (c == '.' || c == '!' || c == '?')) { sn = true; ++sent; pm = c; } else if(!pa && c == '\n') { pa = true; ++para; } else if(ftChar(c)) { if(bs) { // backslash (bs) followed by any character is the character itself: --cpos; bs = false; } break; } bs = false; } // end of text... spos = cpos; if(cpos == l) return false; // parse token for(; cpos < l; cpos += cl(text, cpos)) { int c = cp(text, cpos); // parse wildcards if(wc && !bs) { bs = c == '\\'; if(bs) continue; if(c == '.') { c = cpos + 1 < l ? text[cpos + 1] : 0; if(c == '?' || c == '*' || c == '+') { ++cpos; } else if(c == '{') { while(++cpos < l && text[cpos] != '}'); if(cpos == l) break; } continue; } } if(!ftChar(c)) { if(bs) --cpos; break; } bs = false; } return true; } /** * Returns a normalized version of the current token. * @return result */ private byte[] get() { byte[] n = orig(); final boolean a = ascii(n); if(!a && !dc) n = dia(n); if(uc) n = upper(n, a); if(lc || !cs) n = lower(n, a); return n; } /** * Returns the original token. * @return original token */ private byte[] orig() { final int l = cpos - spos; final byte[] copy = new byte[l]; System.arraycopy(text, spos, copy, 0, l); return copy; } /** * Checks if more tokens are to be returned; special characters are included. * @return result of check */ private boolean moreSC() { final int l = text.length; // parse whitespaces pa = false; sc = false; lp = cpos; for(; cpos < l; cpos += cl(text, cpos)) { final int c = cp(text, cpos); if(c == '\n') { pa = true; ++cpos; sc = true; break; } else if(ftChar(c)) { break; } sc = true; } // special chars found if(lp < cpos) return true; ++pos; // end of text... spos = cpos; if(cpos == l) return false; // parse token for(; cpos < l; cpos += cl(text, cpos)) { final int c = cp(text, cpos); if(!ftChar(c)) { spos = cpos - cl(text, cpos); break; } } return true; } /** * Get next token, including special characters. * @return next token */ private byte[] getSC() { return lp < cpos ? Arrays.copyOfRange(text, lp, cpos) : Arrays.copyOfRange(text, cpos, spos); } @Override int pos(final int w, final FTUnit u) { if(u == FTUnit.WORD) return w; // if necessary, calculate sentences and paragraphs final IntList il = u == FTUnit.SENTENCE ? sen : par; if(sen.isEmpty()) { init(); while(more()) { sen.add(sent); par.add(para); } } return il.get(w); } /** * Removes diacritics from the specified token. This method supports all * latin1 characters, including supplements. * @param t token to be converted * @return converted token */ static byte[] dia(final byte[] t) { // find first character to be normalized final int tl = t.length; for(int i = 0; i < tl; i += cl(t, i)) { final int c = cp(t, i); // normalized character found; run conversion if(c != norm(c)) { final TokenBuilder tb = new TokenBuilder(); tb.add(t, 0, i); for(int j = i; j < tl; j += cl(t, j)) tb.add(norm(cp(t, j))); return tb.finish(); } } // return original character return t; } /** * Converts the specified token to upper case. * @param t token to be converted * @param a ascii flag * @return the converted token */ static byte[] upper(final byte[] t, final boolean a) { final int tl = t.length; if(a) { for(int i = 0; i < tl; ++i) t[i] = (byte) uc(t[i]); return t; } final TokenBuilder tb = new TokenBuilder(); for(int i = 0; i < tl; i += cl(t, i)) tb.add(uc(cp(t, i))); return tb.finish(); } /** * Converts the specified token to lower case. * @param t token to be converted * @param a ascii flag * @return the converted token */ static byte[] lower(final byte[] t, final boolean a) { final int tl = t.length; if(a) { for(int i = 0; i < tl; ++i) t[i] = (byte) lc(t[i]); return t; } final TokenBuilder tb = new TokenBuilder(); for(int i = 0; i < tl; i += cl(t, i)) tb.add(lc(cp(t, i))); return tb.finish(); } @Override int[][] info() { init(); final IntList[] il = new IntList[] { new IntList(), new IntList(), new IntList(), new IntList(), new IntList()}; int lass = 0; int lasp = 0; int sl = 0; int pl = 0; while(more()) { final byte[] n = orig(); final int l = n.length; il[0].add(l); for(final byte b : n) il[3].add(b); if(sent != lass) { if(sl > 0) { il[1].add(sl); il[4].add(pm); } lass = sent; sl = 0; } if(para != lasp) { if(pl > 0) il[2].add(pl); lasp = para; pl = 0; } sl += l; pl += l; } if(sent != lass && sl > 0) { il[1].add(sl); il[4].add(pm); } if(pl > 0) il[2].add(pl); // last sentence not finished with a punctuation mark il[1].add(sl + 1); return new int[][] { il[0].toArray(), il[1].toArray(), il[2].toArray(), il[3].toArray(), il[4].toArray()}; } @Override protected byte prec() { return 10; } @Override boolean paragraph() { return pa; } @Override public String toString() { return Util.name(this) + '[' + string(text) + ']'; } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/WordnetStemmer.java000066400000000000000000000061611222453003200264130ustar00rootroot00000000000000package org.basex.util.ft; import static org.basex.util.Token.*; import java.lang.reflect.*; import java.net.*; import java.util.*; import org.basex.util.*; /** * Stemmer implementation using the WordNet stemmer. * The WordNet stemmer is developed by George A. Miller and is based on * the WordNet 3.0 License: {@code http://wordnet.princeton.edu/}. * * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ final class WordnetStemmer extends Stemmer { /** Name of the package of the WordNet stemmer. */ private static final String PATTERN = "edu.mit.jwi.%"; /** Path to the WordNet dictionary files. */ private static final String PATH = "etc/wndict"; /** WordnetStemmer class. */ private static final Constructor CTR; /** WordnetStemmer.findStems method. */ private static final Method FIND_STEMS; /** WordNet dictionary instance. */ private static final Object DICT; static { // don't try to find the other classes if Dictionary is not found: if(Reflect.available(PATTERN, "Dictionary")) { FIND_STEMS = null; CTR = null; DICT = null; } else { final Class dict = Reflect.find(PATTERN, "Dictionary"); final Class wn = Reflect.find(PATTERN, "morph.WordnetStemmer"); CTR = Reflect.find(wn, Reflect.find(PATTERN, "IDictionary")); FIND_STEMS = Reflect.method(wn, "findStems", String.class); DICT = newDict(dict); } } /** * Create new instance of the WordNet dictionary. * @param dct dictionary class * @return new instance of the WordNet dictionary */ private static Object newDict(final Class dct) { try { final Constructor ctr = Reflect.find(dct, URL.class); final Object dict = Reflect.get(ctr, new URL("file", null, PATH)); return Reflect.invoke(Reflect.method(dct, "open"), dict); } catch(final Exception ex) { return null; } } /** * Checks if the library is available. * @return result of check */ static boolean available() { return DICT != null; } /** Instance of WordNet stemmer. */ private Object stemmer; /** Empty constructor. */ WordnetStemmer() { } /** * Constructs a WordNet stemmer. Call {@link #available()} first to * check if the library is available. * @param fti full-text iterator */ private WordnetStemmer(final FTIterator fti) { super(fti); stemmer = Reflect.get(CTR, DICT); } @Override Stemmer get(final Language l, final FTIterator fti) { return new WordnetStemmer(fti); } @Override public boolean supports(final Language lang) { return lang.equals(Language.get("en")); } @Override protected byte prec() { return 30; } @Override Collection languages() { final HashSet ln = new HashSet(); ln.add(Language.get("en")); return ln; } @Override protected byte[] stem(final byte[] word) { @SuppressWarnings("unchecked") final List l = (List) Reflect.invoke(FIND_STEMS, stemmer, string(word)); final byte[] result = l.isEmpty() ? word : token(l.get(0)); return result.length == 0 ? word : result; } } basex-7.7.2/basex-core/src/main/java/org/basex/util/ft/package.html000066400000000000000000000000661222453003200250500ustar00rootroot00000000000000 Full-text specific utility classes. basex-7.7.2/basex-core/src/main/java/org/basex/util/hash/000077500000000000000000000000001222453003200230775ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/util/hash/ASet.java000066400000000000000000000041761222453003200246060ustar00rootroot00000000000000package org.basex.util.hash; import java.util.*; /** * This is the basic structure of an efficient and memory-saving hash set. * The first entry of the token set (offset 0) will always be kept empty. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public abstract class ASet { /** Hash table buckets. */ protected int[] bucket; /** Pointers to the next entry. */ protected int[] next; /** Hash entries. The actual number of entries is {@code size - 1}. */ protected int size = 1; /** * Empty constructor. */ protected ASet() { } /** * Initializes the data structure with an initial array size. * @param capacity initial array capacity (will be resized to a power of two) */ protected ASet(final int capacity) { int c = 1; while(c < capacity) c <<= 1; bucket = new int[c]; next = new int[c]; } /** * Resets the data structure. Must be called when data structure is initialized. */ public void clear() { Arrays.fill(bucket, 0); size = 1; } /** * Returns the number of entries. * The actual number of keys may be smaller if keys have been deleted. * @return number of entries */ public final int size() { return size - 1; } /** * Tests is the set is empty. * @return result of check */ public final boolean isEmpty() { return size == 1; } /** * Resizes the hash table. */ protected final void checkSize() { if(size < next.length) return; final int s = size << 1; final int[] tmp = new int[s]; for(final int b : bucket) { int id = b; while(id != 0) { final int p = hash(id) & s - 1; final int nx = next[id]; next[id] = tmp[p]; tmp[p] = id; id = nx; } } bucket = tmp; next = Arrays.copyOf(next, s); rehash(s); } /** * Returns the hash value of the element with the specified id. * @param id id of the element * @return hash value */ protected abstract int hash(final int id); /** * Rehashes all entries. * @param newSize new hash size */ protected abstract void rehash(final int newSize); } basex-7.7.2/basex-core/src/main/java/org/basex/util/hash/IntObjMap.java000066400000000000000000000034371222453003200255740ustar00rootroot00000000000000package org.basex.util.hash; import org.basex.util.*; /** * This is an efficient and memory-saving hash map for storing primitive integers * and objects. It extends the {@link IntSet} class. * @param generic value type * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class IntObjMap extends IntSet { /** Values. */ private Object[] values = new Object[Array.CAPACITY]; /** * Indexes the specified key and stores the associated value. * If the key already exists, the value is updated. * @param key key * @param value value */ public void put(final int key, final E value) { // array bounds are checked before array is resized.. final int i = put(key); values[i] = value; } /** * Returns the value for the specified key. * @param key key to be looked up * @return value, or {@code null} if the key was not found */ @SuppressWarnings("unchecked") public E get(final int key) { return (E) values[id(key)]; } /** * Returns a value iterator. * @return iterator */ public Iterable values() { return new ArrayIterator(values, 1, size); } @Override protected void rehash(final int s) { super.rehash(s); values = Array.copy(values, new Object[s]); } @Override public int delete(final int key) { final int i = super.delete(key); if(i != 0) values[i] = null; return i; } @Override public String toString() { final TokenBuilder tb = new TokenBuilder(Util.name(this)).add('['); for(int i = 1; i < size; i++) { tb.add(Integer.toString(keys[i])).add(": ").add(get(keys[i]).toString()); if(i < size - 1) tb.add(",\n\t"); } return tb.add(']').toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/hash/IntSet.java000066400000000000000000000066231222453003200251570ustar00rootroot00000000000000package org.basex.util.hash; import java.util.*; import org.basex.util.*; /** * This is an efficient and memory-saving hash map for storing primitive integers. * It is related to the {@link TokenSet} class. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public class IntSet extends ASet { /** Hashed keys. */ protected int[] keys; /** * Default constructor. */ public IntSet() { this(Array.CAPACITY); } /** * Default constructor. * @param capacity initial array capacity */ public IntSet(final int capacity) { super(capacity); keys = new int[bucket.length]; } /** * Stores the specified key if it has not been stored before. * @param key key to be added * @return {@Code true} if the key did not exist yet and was stored */ public final boolean add(final int key) { return index(key) > 0; } /** * Stores the specified key and returns its id. * @param key key to be added * @return unique id of stored key (larger than zero) */ public final int put(final int key) { final int i = index(key); return Math.abs(i); } /** * Checks if the set contains the specified key. * @param key key to be looked up * @return result of check */ public final boolean contains(final int key) { return id(key) > 0; } /** * Returns the id of the specified key, or {@code 0} if the key does not exist. * @param key key to be looked up * @return id, or {@code 0} if key does not exist */ public final int id(final int key) { final int p = key & bucket.length - 1; for(int id = bucket[p]; id != 0; id = next[id]) if(key == keys[id]) return id; return 0; } /** * Returns the key with the specified id. * All ids starts with {@code 1} instead of {@code 0}. * @param id id of the key to return * @return key */ public final int key(final int id) { return keys[id]; } /** * Deletes the specified key. * The deletion of keys will lead to empty entries. If {@link #size} is called after * deletions, the original number of entries will be returned. * @param key key * @return deleted key or 0 */ public int delete(final int key) { final int b = key & bucket.length - 1; for(int p = 0, i = bucket[b]; i != 0; p = i, i = next[i]) { if(key != keys[i]) continue; if(p == 0) bucket[b] = next[i]; else next[p] = next[next[i]]; keys[i] = 0; return i; } return 0; } /** * Stores the specified key and returns its id, or returns the negative id if the * key has already been stored. * @param key key to be found * @return id, or negative id if key has already been stored */ private int index(final int key) { checkSize(); final int b = key & bucket.length - 1; for(int r = bucket[b]; r != 0; r = next[r]) if(key == keys[r]) return -r; next[size] = bucket[b]; keys[size] = key; bucket[b] = size; return size++; } @Override protected int hash(final int id) { return keys[id]; } @Override protected void rehash(final int newSize) { keys = Arrays.copyOf(keys, newSize); } /** * Returns an array with all elements. * @return array */ public final int[] toArray() { return Arrays.copyOfRange(keys, 1, size); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/hash/TokenBoolMap.java000066400000000000000000000021551222453003200262770ustar00rootroot00000000000000package org.basex.util.hash; import java.util.*; import org.basex.util.*; /** * This is an efficient and memory-saving hash map for storing tokens and booleans. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class TokenBoolMap extends TokenSet { /** Values. */ private boolean[] values; /** * Constructor. */ public TokenBoolMap() { values = new boolean[Array.CAPACITY]; } /** * Indexes the specified key and stores the associated value. * If the key already exists, the value is updated. * @param key key * @param value value */ public void put(final byte[] key, final boolean value) { // array bounds are checked before array is resized.. final int i = put(key); values[i] = value; } /** * Returns the value for the specified key. * @param key key to be looked up * @return value, or {@code -1} if the key was not found */ public boolean get(final byte[] key) { return values[id(key)]; } @Override protected void rehash(final int s) { super.rehash(s); values = Arrays.copyOf(values, s); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/hash/TokenIntMap.java000066400000000000000000000033211222453003200261320ustar00rootroot00000000000000package org.basex.util.hash; import java.io.*; import java.util.*; import org.basex.io.in.DataInput; import org.basex.io.out.DataOutput; import org.basex.util.*; /** * This is an efficient and memory-saving hash map for storing tokens and integers. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class TokenIntMap extends TokenSet { /** Values. */ private int[] values; /** * Constructor. */ public TokenIntMap() { values = new int[Array.CAPACITY]; } /** * Constructor. * @param in input stream * @throws IOException I/O exception */ public TokenIntMap(final DataInput in) throws IOException { read(in); } @Override public void read(final DataInput in) throws IOException { super.read(in); values = in.readNums(); } @Override public void write(final DataOutput out) throws IOException { super.write(out); out.writeNums(values); } /** * Indexes the specified key and stores the associated value. * If the key already exists, the value is updated. * @param key key * @param value value */ public void put(final byte[] key, final int value) { // array bounds are checked before array is resized.. final int i = put(key); values[i] = value; } /** * Returns the value for the specified key. * @param key key to be looked up * @return value, or {@code -1} if the key was not found */ public int get(final byte[] key) { final int i = id(key); return i == 0 ? -1 : values[i]; } @Override protected void rehash(final int s) { super.rehash(s); values = Arrays.copyOf(values, s); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/hash/TokenMap.java000066400000000000000000000037771222453003200254760ustar00rootroot00000000000000package org.basex.util.hash; import org.basex.util.*; /** * This is an efficient and memory-saving hash map for storing tokens. * It extends the {@link TokenSet} class. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public class TokenMap extends TokenSet { /** Hash values. */ private byte[][] values = new byte[Array.CAPACITY][]; /** * Stores the specified key and value. * If the key exists, the value is updated. * @param key key * @param value value */ public final void put(final byte[] key, final byte[] value) { // array bounds are checked before array is resized.. final int i = put(key); values[i] = value; } /** * Convenience function for adding strings, which will be converted to tokens. * @param key key * @param value value */ public final void put(final String key, final String value) { put(Token.token(key), Token.token(value)); } /** * Returns the value for the specified key. * @param key key to be looked up * @return value or {@code null} if nothing was found */ public final byte[] get(final byte[] key) { return key != null ? values[id(key)] : null; } @Override public int delete(final byte[] key) { final int i = super.delete(key); values[i] = null; return i; } /** * Returns a value iterator. * @return iterator */ public final Iterable values() { return new ArrayIterator(values, 1, size); } @Override protected final void rehash(final int s) { super.rehash(s); values = Array.copyOf(values, s); } @Override public final String toString() { final TokenBuilder tb = new TokenBuilder(); for(int i = 1; i < size; i++) { if(!tb.isEmpty()) tb.add(", "); if(keys[i] != null) tb.add(keys[i]).add(" = ").add(values[i]); } return new TokenBuilder(Util.name(getClass())).add('[').add(tb.finish()). add(']').toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/hash/TokenObjMap.java000066400000000000000000000025701222453003200261170ustar00rootroot00000000000000package org.basex.util.hash; import org.basex.util.*; /** * This is an efficient and memory-saving hash map for storing tokens and objects. * {@link TokenSet hash set}. * @param generic value type * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class TokenObjMap extends TokenSet { /** Values. */ private Object[] values = new Object[Array.CAPACITY]; /** * Indexes the specified key and value. * If the key exists, the value is updated. * @param key key * @param val value */ public void put(final byte[] key, final E val) { // array bounds are checked before array is resized.. final int i = put(key); values[i] = val; } /** * Returns the value for the specified key. * @param key key to be looked up * @return value, or {@code null} if nothing was found */ @SuppressWarnings("unchecked") public E get(final byte[] key) { return key != null ? (E) values[id(key)] : null; } /** * Returns a value iterator. * @return iterator */ public Iterable values() { return new ArrayIterator(values, 1, size); } @Override public int delete(final byte[] key) { final int i = super.delete(key); values[i] = null; return i; } @Override protected void rehash(final int s) { super.rehash(s); values = Array.copy(values, new Object[s]); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/hash/TokenSet.java000066400000000000000000000122301222453003200254740ustar00rootroot00000000000000package org.basex.util.hash; import static org.basex.util.Token.*; import java.io.*; import java.util.*; import org.basex.io.in.DataInput; import org.basex.io.out.DataOutput; import org.basex.util.*; /** * This is an efficient and memory-saving hash set for storing tokens. * The first entry of the token set (offset 0) is always empty. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public class TokenSet extends ASet implements Iterable { /** Hashed keys. */ protected byte[][] keys; /** * Default constructor. */ public TokenSet() { super(Array.CAPACITY); keys = new byte[Array.CAPACITY][]; } /** * Constructor, specifying initial keys. * @param key initial keys */ public TokenSet(final byte[]... key) { this(); for(final byte[] i : key) add(i); } /** * Constructor, specifying some initial input. * @param in input stream * @throws IOException I/O exception */ public TokenSet(final DataInput in) throws IOException { read(in); } /** * Reads the data structure from the specified input. * @param in input stream * @throws IOException I/O exception */ protected void read(final DataInput in) throws IOException { keys = in.readTokens(); next = in.readNums(); bucket = in.readNums(); size = in.readNum(); } /** * Writes the data structure to the specified output. * @param out output stream * @throws IOException I/O exception */ public void write(final DataOutput out) throws IOException { out.writeTokens(keys); out.writeNums(next); out.writeNums(bucket); out.writeNum(size); } /** * Stores the specified key if it has not been stored before. * @param key key to be added * @return {@Code true} if the key did not exist yet and was stored */ public final boolean add(final byte[] key) { return index(key) > 0; } /** * Stores the specified string as key if it has not been stored before. * @param key string to be added * @return {@Code true} if the key did not exist yet and was stored */ public boolean add(final String key) { return add(token(key)); } /** * Stores the specified key and returns its id. * @param key key to be added * @return unique id of stored key (larger than zero) */ public final int put(final byte[] key) { final int i = index(key); return Math.abs(i); } /** * Checks if the set contains the specified key. * @param key key to be looked up * @return result of check */ public final boolean contains(final byte[] key) { return id(key) > 0; } /** * Returns the id of the specified key, or {@code 0} if the key does not exist. * @param key key to be looked up * @return id, or {@code 0} if key does not exist */ public final int id(final byte[] key) { final int p = Token.hash(key) & bucket.length - 1; for(int i = bucket[p]; i != 0; i = next[i]) if(eq(key, keys[i])) return i; return 0; } /** * Returns the key with the specified id. * All ids starts with {@code 1} instead of {@code 0}. * @param id id of the key to return * @return key */ public final byte[] key(final int id) { return keys[id]; } /** * Deletes the specified key. * The deletion of keys will lead to empty entries. If {@link #size} is called after * deletions, the original number of entries will be returned. * @param key key * @return deleted key or 0 */ public int delete(final byte[] key) { final int b = Token.hash(key) & bucket.length - 1; for(int p = 0, i = bucket[b]; i != 0; p = i, i = next[i]) { if(!eq(key, keys[i])) continue; if(p == 0) bucket[b] = next[i]; else next[p] = next[next[i]]; keys[i] = null; return i; } return 0; } /** * Stores the specified key and returns its id, or returns the negative id if the * key has already been stored. * @param key key to be found * @return id, or negative id if key has already been stored */ private int index(final byte[] key) { checkSize(); final int b = Token.hash(key) & bucket.length - 1; for(int r = bucket[b]; r != 0; r = next[r]) if(eq(key, keys[r])) return -r; next[size] = bucket[b]; keys[size] = key; bucket[b] = size; return size++; } @Override protected int hash(final int id) { return Token.hash(keys[id]); } @Override protected void rehash(final int newSize) { keys = Array.copyOf(keys, newSize); } @Override public final void clear() { Arrays.fill(keys, null); super.clear(); } @Override public final Iterator iterator() { return new ArrayIterator(keys, 1, size); } @Override public String toString() { final TokenBuilder tb = new TokenBuilder(); for(final byte[] key : this) { if(!tb.isEmpty()) tb.add(", "); if(key != null) tb.add(key); } return new TokenBuilder(Util.name(getClass())).add('[').add(tb.finish()). add(']').toString(); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/list/000077500000000000000000000000001222453003200231275ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/java/org/basex/util/list/BoolList.java000066400000000000000000000041601222453003200255220ustar00rootroot00000000000000package org.basex.util.list; import java.util.*; import org.basex.util.*; /** * This is a simple container for native booleans. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class BoolList extends ElementList { /** Element container. */ private boolean[] list; /** * Default constructor. */ public BoolList() { this(Array.CAPACITY); } /** * Constructor, specifying an initial internal array size. * @param capacity initial array capacity */ public BoolList(final int capacity) { list = new boolean[capacity]; } /** * Adds an element. * @param element element to be added */ public void add(final boolean element) { if(size == list.length) list = Arrays.copyOf(list, newSize()); list[size++] = element; } /** * Returns the element at the specified index. * @param index index of the element to return * @return element */ public boolean get(final int index) { return list[index]; } /** * Stores an element at the specified index. * @param index index of the element to replace * @param element element to be stored */ public void set(final int index, final boolean element) { if(index >= list.length) list = Arrays.copyOf(list, newSize(index + 1)); list[index] = element; size = Math.max(size, index + 1); } /** * Pops the uppermost element from the stack. * @return the popped element */ public boolean pop() { return list[--size]; } /** * Pushes an element onto the stack. * @param element element */ public void push(final boolean element) { add(element); } /** * Returns the uppermost element on the stack, without removing it. * @return uppermost element */ public boolean peek() { return list[size - 1]; } /** * Finishes the int array. * @return int array */ public boolean[] toArray() { return Arrays.copyOf(list, size); } @Override public String toString() { return Arrays.toString(toArray()); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/list/ByteList.java000066400000000000000000000041571222453003200255400ustar00rootroot00000000000000package org.basex.util.list; import static org.basex.util.Token.*; import java.util.*; import org.basex.util.*; /** * This is a simple container for byte values. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public class ByteList extends ElementList { /** Element container. */ protected byte[] list; /** * Default constructor. */ public ByteList() { this(Array.CAPACITY); } /** * Constructor, specifying an initial internal array size. * @param capacity initial array capacity */ public ByteList(final int capacity) { list = new byte[capacity]; } /** * Adds an element to the array. * @param element element to be added; will be cast to a byte * @return self reference */ public ByteList add(final int element) { if(size == list.length) list = Arrays.copyOf(list, newSize()); list[size++] = (byte) element; return this; } /** * Adds elements to the container. * @param elements elements to be added * @return self reference */ public ByteList add(final byte[] elements) { return add(elements, 0, elements.length); } /** * Adds a part of the specified elements to the container. * @param elements elements to be added * @param start start position * @param end end position * @return self reference */ public ByteList add(final byte[] elements, final int start, final int end) { final int l = end - start; if(size + l > list.length) list = Arrays.copyOf(list, newSize(size + l)); System.arraycopy(elements, start, list, size, l); size += l; return this; } /** * Returns the element at the specified index position. * @param index index of the element to return * @return element */ public final byte get(final int index) { return list[index]; } /** * Returns an array with all elements. * @return array */ public byte[] toArray() { return Arrays.copyOf(list, size); } @Override public String toString() { return string(list, 0, size); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/list/ElementList.java000066400000000000000000000026531222453003200262250ustar00rootroot00000000000000package org.basex.util.list; import org.basex.util.*; /** * This is an abstract class for storing elements of any kind in an array-based * list. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public abstract class ElementList { /** Resize factor for extending the arrays. */ protected double factor = Array.RESIZE; /** Number of elements. */ protected int size; /** * Default constructor. */ protected ElementList() { } /** * Returns a new array size. * @return new array size */ protected final int newSize() { return Array.newSize(size, factor); } /** * Returns a new array size that is larger than or equal to the specified * size. * @param min minimum size * @return new array size */ protected final int newSize(final int min) { return Math.max(newSize(), min); } /** * Returns the number of elements. * @return number of elements */ public final int size() { return size; } /** * Enforces the number of elements. * @param s number of elements */ public final void size(final int s) { size = s; } /** * Tests is the container has no elements. * @return result of check */ public final boolean isEmpty() { return size == 0; } /** * Resets the array size. */ public final void reset() { size = 0; } } basex-7.7.2/basex-core/src/main/java/org/basex/util/list/IntList.java000066400000000000000000000326601222453003200253670ustar00rootroot00000000000000package org.basex.util.list; import java.util.*; import org.basex.util.*; /** * This is a simple container for native integers. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public class IntList extends ElementList { /** Element container. */ protected int[] list; /** * Default constructor. */ public IntList() { this(Array.CAPACITY); } /** * Constructor, specifying an initial internal array size. * @param capacity initial array capacity */ public IntList(final int capacity) { list = new int[capacity]; } /** * Constructor, specifying a resize factor. Smaller values are more memory-saving, * while larger will provide better performance. * @param resize resize factor */ public IntList(final double resize) { this(); factor = resize; } /** * Lightweight constructor, adopting the specified elements. * @param elements initial array */ public IntList(final int[] elements) { list = elements; size = elements.length; } /** * Adds an element to the array. * @param element element to be added */ public final void add(final int element) { if(size == list.length) list = Arrays.copyOf(list, newSize()); list[size++] = element; } /** * Returns the element at the specified position. * @param index index of the element to return * @return element */ public final int get(final int index) { return list[index]; } /** * Stores an element at the specified position. * @param index index of the element to replace * @param element element to be stored */ public final void set(final int index, final int element) { if(index >= list.length) list = Arrays.copyOf(list, newSize(index + 1)); list[index] = element; size = Math.max(size, index + 1); } /** * Checks if the specified element is found in the list. * @param element element to be found * @return result of check */ public final boolean contains(final int element) { for(int i = 0; i < size; ++i) if(list[i] == element) return true; return false; } /** * Inserts elements at the specified index position. * @param index inserting position * @param element elements to be inserted */ public final void insert(final int index, final int[] element) { final int l = element.length; if(l == 0) return; if(size + l > list.length) list = Arrays.copyOf(list, newSize(size + l)); Array.move(list, index, l, size - index); System.arraycopy(element, 0, list, index, l); size += l; } /** * Removes all occurrences of the specified element from the list. * @param element element to be removed */ public final void delete(final int element) { int s = 0; for(int i = 0; i < size; ++i) { if(list[i] != element) list[s++] = list[i]; } size = s; } /** * Deletes the element at the specified position. * @param index index of the element to delete */ public final void deleteAt(final int index) { Array.move(list, index + 1, -1, --size - index); } /** * Adds a difference to all elements starting from the specified index. * @param diff difference * @param index index of the first element */ public final void move(final int diff, final int index) { for(int a = index; a < size; a++) list[a] += diff; } /** * Returns the uppermost element from the stack. * @return the uppermost element */ public final int peek() { return list[size - 1]; } /** * Pops the uppermost element from the stack. * @return the popped element */ public final int pop() { return list[--size]; } /** * Pushes an element onto the stack. * @param element element */ public final void push(final int element) { add(element); } /** * Searches the specified element via binary search. * Note that all elements must be sorted. * @param element element to be found * @return index of the search key, or the negative insertion point - 1 */ public final int sortedIndexOf(final int element) { return Arrays.binarySearch(list, 0, size, element); } /** * Returns an array with all elements. * @return array */ public final int[] toArray() { return Arrays.copyOf(list, size); } /** * Removes duplicates from a sorted list. * @return self reference */ public IntList unique() { if(size != 0) { int s = 0; for(int l = 1; l < size; l++) { if(list[l] != list[s]) list[++s] = list[l]; } size = s + 1; } return this; } /** * Sorts the data. * @return self reference */ public IntList sort() { Arrays.sort(list, 0, size); return this; } /** * Sorts the data in the order of the specified token array. * Note that the input array will be resorted as well. * The algorithm is derived from {@link Arrays#sort(int[])}. * @param tok token array to sort by * @param num numeric sort * @param asc ascending */ public final void sort(final byte[][] tok, final boolean num, final boolean asc) { sort(0, size, num, asc, tok); } /** * Sorts the data in the order of the specified numeric array. * Note that the input array will be resorted as well. * The algorithm is derived from {@link Arrays#sort(int[])}. * @param num token array to sort by * @param asc ascending */ public final void sort(final double[] num, final boolean asc) { sort(0, size, asc, num); } /** * Sorts the data in the order of the specified numeric array. * Note that the input array will be resorted as well. * The algorithm is derived from {@link Arrays#sort(int[])}. * @param num token array to sort by * @param asc ascending */ public final void sort(final int[] num, final boolean asc) { sort(0, size, asc, num); } /** * Sorts the array. * @param s offset * @param e length * @param g numeric sort * @param f ascending/descending sort * @param t sort tokens */ private void sort(final int s, final int e, final boolean g, final boolean f, final byte[][] t) { if(e < 7) { for(int i = s; i < e + s; ++i) { for(int j = i; j > s; j--) { final int h = g ? s(t[j - 1], t[j]) : d(t[j - 1], t[j]); if(f ? h < 0 : h > 0) break; s(j, j - 1, t); } } return; } int m = s + (e >> 1); if(e > 7) { int l = s; int n = s + e - 1; if(e > 40) { final int k = e >>> 3; l = m(l, l + k, l + (k << 1)); m = m(m - k, m, m + k); n = m(n - (k << 1), n - k, n); } m = m(l, m, n); } final byte[] v = t[m]; int a = s, b = a, c = s + e - 1, d = c; while(true) { while(b <= c) { final int h = g ? s(t[b], v) : d(t[b], v); if(f ? h > 0 : h < 0) break; if(h == 0) s(a++, b, t); ++b; } while(c >= b) { final int h = g ? s(t[c], v) : d(t[c], v); if(f ? h < 0 : h > 0) break; if(h == 0) s(c, d--, t); --c; } if(b > c) break; s(b++, c--, t); } int k; final int n = s + e; k = Math.min(a - s, b - a); s(s, b - k, k, t); k = Math.min(d - c, n - d - 1); s(b, n - k, k, t); if((k = b - a) > 1) sort(s, k, g, f, t); if((k = d - c) > 1) sort(n - k, k, g, f, t); } /** * Sorts the array. * @param s offset * @param e length * @param f ascending/descending sort * @param t sort tokens */ private void sort(final int s, final int e, final boolean f, final double[] t) { if(e < 7) { for(int i = s; i < e + s; ++i) { for(int j = i; j > s; j--) { final double h = t[j - 1] - t[j]; if(f ? h < 0 : h > 0) break; s(j, j - 1, t); } } return; } int m = s + (e >> 1); if(e > 7) { int l = s; int n = s + e - 1; if(e > 40) { final int k = e >>> 3; l = m(l, l + k, l + (k << 1)); m = m(m - k, m, m + k); n = m(n - (k << 1), n - k, n); } m = m(l, m, n); } final double v = t[m]; int a = s, b = a, c = s + e - 1, d = c; while(true) { while(b <= c) { final double h = t[b] - v; if(f ? h > 0 : h < 0) break; if(h == 0) s(a++, b, t); ++b; } while(c >= b) { final double h = t[c] - v; if(f ? h < 0 : h > 0) break; if(h == 0) s(c, d--, t); --c; } if(b > c) break; s(b++, c--, t); } int k; final int n = s + e; k = Math.min(a - s, b - a); s(s, b - k, k, t); k = Math.min(d - c, n - d - 1); s(b, n - k, k, t); if((k = b - a) > 1) sort(s, k, f, t); if((k = d - c) > 1) sort(n - k, k, f, t); } /** * Sorts the array. * @param s offset * @param e length * @param f ascending/descending sort * @param t sort tokens */ private void sort(final int s, final int e, final boolean f, final int[] t) { if(e < 7) { for(int i = s; i < e + s; ++i) { for(int j = i; j > s; j--) { final int h = t[j - 1] - t[j]; if(f ? h < 0 : h > 0) break; s(j, j - 1, t); } } return; } int m = s + (e >> 1); if(e > 7) { int l = s; int n = s + e - 1; if(e > 40) { final int k = e >>> 3; l = m(l, l + k, l + (k << 1)); m = m(m - k, m, m + k); n = m(n - (k << 1), n - k, n); } m = m(l, m, n); } final int v = t[m]; int a = s, b = a, c = s + e - 1, d = c; while(true) { while(b <= c) { final int h = t[b] - v; if(f ? h > 0 : h < 0) break; if(h == 0) s(a++, b, t); ++b; } while(c >= b) { final int h = t[c] - v; if(f ? h < 0 : h > 0) break; if(h == 0) s(c, d--, t); --c; } if(b > c) break; s(b++, c--, t); } int k; final int n = s + e; k = Math.min(a - s, b - a); s(s, b - k, k, t); k = Math.min(d - c, n - d - 1); s(b, n - k, k, t); if((k = b - a) > 1) sort(s, k, f, t); if((k = d - c) > 1) sort(n - k, k, f, t); } /** * Compares two numeric tokens and returns an integer. * @param a first token * @param b second token * @return result */ private static int s(final byte[] a, final byte[] b) { final double n = Token.toDouble(a) - Token.toDouble(b); return n > 0 ? 1 : n < 0 ? -1 : 0; } /** * Compares two tokens and returns an integer. * @param a first token * @param b second token * @return result */ private static int d(final byte[] a, final byte[] b) { return a == null ? b == null ? 0 : -1 : b == null ? 1 : Token.diff(a, b); } /** * Swaps two array elements. * @param a first offset * @param b second offset * @param t sort tokens */ private void s(final int a, final int b, final byte[][] t) { final int l = list[a]; list[a] = list[b]; list[b] = l; final byte[] c = t[a]; t[a] = t[b]; t[b] = c; } /** * Swaps two array elements. * @param a first offset * @param b second offset * @param t sort tokens */ private void s(final int a, final int b, final double[] t) { final int l = list[a]; list[a] = list[b]; list[b] = l; final double c = t[a]; t[a] = t[b]; t[b] = c; } /** * Swaps two array elements. * @param a first offset * @param b second offset * @param t sort tokens */ private void s(final int a, final int b, final int[] t) { final int l = list[a]; list[a] = list[b]; list[b] = l; final int c = t[a]; t[a] = t[b]; t[b] = c; } /** * Swaps x[a .. (a+n-1)] with x[b .. (b+n-1)]. * @param a first offset * @param b second offset * @param n number of elements * @param t sort tokens */ private void s(final int a, final int b, final int n, final byte[][] t) { for(int i = 0; i < n; ++i) s(a + i, b + i, t); } /** * Swaps x[a .. (a+n-1)] with x[b .. (b+n-1)]. * @param a first offset * @param b second offset * @param n number of elements * @param t sort tokens */ private void s(final int a, final int b, final int n, final double[] t) { for(int i = 0; i < n; ++i) s(a + i, b + i, t); } /** * Swaps x[a .. (a+n-1)] with x[b .. (b+n-1)]. * @param a first offset * @param b second offset * @param n number of elements * @param t sort tokens */ private void s(final int a, final int b, final int n, final int[] t) { for(int i = 0; i < n; ++i) s(a + i, b + i, t); } /** * Returns the index of the median of the three indexed integers. * @param a first offset * @param b second offset * @param c thirst offset * @return median */ private int m(final int a, final int b, final int c) { return list[a] < list[b] ? list[b] < list[c] ? b : list[a] < list[c] ? c : a : list[b] > list[c] ? b : list[a] > list[c] ? c : a; } @Override public String toString() { return Arrays.toString(toArray()); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/list/StringList.java000066400000000000000000000125161222453003200261010ustar00rootroot00000000000000package org.basex.util.list; import java.util.*; import org.basex.util.*; /** * This is a simple container for strings. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public class StringList extends ElementList implements Iterable { /** Element container. */ protected String[] list; /** * Default constructor. */ public StringList() { this(Array.CAPACITY); } /** * Constructor, specifying an initial internal array size. * @param capacity initial array capacity */ public StringList(final int capacity) { list = new String[capacity]; } /** * Lightweight constructor, assigning the specified array. * @param elements initial array */ public StringList(final String... elements) { list = elements; size = elements.length; } /** * Adds an element to the array. * @param e element to be added * @return self reference */ public final StringList add(final String e) { if(size == list.length) list = Array.copyOf(list, newSize()); list[size++] = e; return this; } /** * Adds elements to the array. * @param elements elements to be added * @return self reference */ public final StringList add(final String... elements) { for(final String s : elements) add(s); return this; } /** * Adds elements from a string list to the array. * @param elements string list to be added * @return self reference */ public final StringList add(final StringList elements) { for(final String s : elements) add(s); return this; } /** * Returns the element at the specified position. * @param index element index * @return element */ public final String get(final int index) { return list[index]; } /** * Sets an element at the specified index position. * @param index index * @param element element to be set */ public final void set(final int index, final String element) { if(index >= list.length) list = Array.copyOf(list, newSize(index + 1)); list[index] = element; size = Math.max(size, index + 1); } /** * Checks if the specified element is found in the list. * @param element element to be found * @return result of check */ public final boolean contains(final String element) { for(int i = 0; i < size; ++i) if(list[i].equals(element)) return true; return false; } /** * Check if all elements of the specified list are contained in the list. * Both lists must be sorted. * @param elements sorted list * @return result of check */ public final boolean containsAll(final StringList elements) { if(isEmpty() && !elements.isEmpty()) return false; int i = 0; for(final String e : elements) { int result; while(0 != (result = list[i].compareTo(e))) { if(++i >= size() || result > 0) return false; } } return true; } /** * Deletes the specified element. * @param index index of element to be deleted */ public final void deleteAt(final int index) { Array.move(list, index + 1, -1, --size - index); } /** * Returns an array with all elements. * @return array */ public final String[] toArray() { return Array.copyOf(list, size); } /** * Sorts the elements in ascending order. * @param cs respect case sensitivity * @return self reference */ public final StringList sort(final boolean cs) { return sort(cs, true, 0); } /** * Sorts the elements. * @param cs respect case sensitivity * @param asc ascending/descending flag * @return self reference */ public final StringList sort(final boolean cs, final boolean asc) { return sort(cs, asc, 0); } /** * Sorts the elements. * @param cs respect case sensitivity * @param asc ascending (true)/descending (false) flag * @param index index of element from which sorting starts * @return self reference */ public final StringList sort(final boolean cs, final boolean asc, final int index) { final Comparator comp = cs ? null : String.CASE_INSENSITIVE_ORDER; Arrays.sort(list, index, size, asc ? comp : Collections.reverseOrder(comp)); return this; } /** * Removes duplicates from the list. * The list must be sorted. * @return self reference */ public StringList unique() { if(size != 0) { int s = 0; for(int l = 1; l < size; l++) { if(!list[l].equals(list[s])) list[++s] = list[l]; } size = s + 1; } return this; } /** * Returns the uppermost element from the stack. * @return the uppermost element */ public final String peek() { return list[size - 1]; } /** * Pops the uppermost element from the stack. * @return the popped element */ public final String pop() { return list[--size]; } /** * Pushes an element onto the stack. * @param element element */ public final void push(final String element) { add(element); } @Override public final Iterator iterator() { return new ArrayIterator(list, size); } @Override public final String toString() { return Arrays.toString(toArray()); } } basex-7.7.2/basex-core/src/main/java/org/basex/util/list/TokenList.java000066400000000000000000000130521222453003200257070ustar00rootroot00000000000000package org.basex.util.list; import static org.basex.util.Token.*; import java.util.*; import org.basex.util.*; import org.basex.util.hash.*; /** * This is a simple container for tokens (byte arrays). * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class TokenList extends ElementList implements Iterable { /** Element container. */ private byte[][] list; /** * Default constructor. */ public TokenList() { this(Array.CAPACITY); } /** * Constructor, specifying an initial internal array size * (default is {@link Array#CAPACITY}). * @param capacity initial array capacity */ public TokenList(final int capacity) { list = new byte[capacity][]; } /** * Constructor, specifying a resize factor. Smaller values are more memory-saving, * while larger will provide better performance. * @param resize resize factor */ public TokenList(final double resize) { this(); factor = resize; } /** * Lightweight constructor, adopting the specified array. * @param tokens initial array */ public TokenList(final byte[][] tokens) { list = tokens; size = list.length; } /** * Constructor, adopting the elements from the specified array. * @param strings initial array */ public TokenList(final String[] strings) { this(strings.length); for(final String s : strings) add(s); } /** * Constructor, adopting the elements from the specified set. * @param set set to be added */ public TokenList(final TokenSet set) { this(set.size()); for(final byte[] e : set) add(e); } /** * Adds an element. * @param element element to be added */ public void add(final byte[] element) { if(size == list.length) list = Array.copyOf(list, newSize()); list[size++] = element; } /** * Adds a long value. * @param element element to be added */ public void add(final long element) { add(token(element)); } /** * Adds a string. * @param element element to be added */ public void add(final String element) { add(token(element)); } /** * Inserts the given elements at the specified position. * @param index inserting position * @param elements elements to insert */ public void insert(final int index, final byte[][] elements) { final int l = elements.length; if(l == 0) return; if(size + l > list.length) list = Array.copyOf(list, newSize(size + l)); Array.move(list, index, l, size - index); System.arraycopy(elements, 0, list, index, l); size += l; } /** * Deletes the element at the specified position. * @param index index of the element to delete */ public void deleteAt(final int index) { Array.move(list, index + 1, -1, --size - index); } /** * Returns the element at the specified position. * @param index index of the element to return * @return element */ public byte[] get(final int index) { return index < list.length ? list[index] : null; } /** * Stores an element to the specified position. * @param index index of the element to replace * @param element element to be stored */ public void set(final int index, final byte[] element) { if(index >= list.length) list = Array.copyOf(list, newSize(index + 1)); list[index] = element; size = Math.max(size, index + 1); } /** * Pops the uppermost element from the stack. * @return the popped element */ public byte[] pop() { return list[--size]; } /** * Pushes an element onto the stack. * @param element element */ public void push(final byte[] element) { add(element); } /** * Returns the uppermost element on the stack, without removing it. * @return uppermost element */ public byte[] peek() { return list[size - 1]; } /** * Checks if the specified element is found in the list. * @param element element to be found * @return result of check */ public boolean contains(final byte[] element) { for(int i = 0; i < size; ++i) if(eq(list[i], element)) return true; return false; } /** * Returns an array with all elements. * @return array */ public byte[][] toArray() { return Array.copyOf(list, size); } /** * Returns an array with all elements as strings. * @return array */ public String[] toStringArray() { final int is = size; final byte[][] l = list; final String[] items = new String[is]; for(int i = 0; i < is; ++i) items[i] = string(l[i]); return items; } /** * Sorts the elements. * @param cs respect case sensitivity * @return self reference */ public TokenList sort(final boolean cs) { Arrays.sort(list, 0, size, cs ? COMP : LC_COMP); return this; } @Override public Iterator iterator() { return new ArrayIterator(list, size); } @Override public String toString() { final TokenBuilder tb = new TokenBuilder(Util.name(this) + '['); for(int i = 0; i < size; ++i) { if(i != 0) tb.add(", "); tb.add(list[i]); } return tb.add(']').toString(); } /** * Creates a copy of this list. * @return copy of this list */ public TokenList copy() { final TokenList tl = new TokenList(list.length); tl.factor = factor; for(int i = 0; i < size; i++) tl.add(list[i].clone()); return tl; } } basex-7.7.2/basex-core/src/main/java/org/basex/util/package.html000066400000000000000000000000431222453003200244320ustar00rootroot00000000000000 Utility classes. basex-7.7.2/basex-core/src/main/javacc/000077500000000000000000000000001222453003200176145ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/javacc/regex.jj000066400000000000000000000230761222453003200212630ustar00rootroot00000000000000 options { STATIC = false; USER_TOKEN_MANAGER = true; GRAMMAR_ENCODING = "UTF-8"; JDK_VERSION = "1.6"; } PARSER_BEGIN(RegExParser) package org.basex.query.regex.parse; import static org.basex.query.util.Err.*; import java.util.ArrayList; import java.util.regex.*; import org.basex.query.*; import org.basex.query.regex.*; import org.basex.query.util.*; import org.basex.util.*; import static org.basex.util.Token.*; import static java.util.regex.Pattern.*; /** * A parser for XSD regular expressions. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class RegExParser { /** Group counter. */ private int groups; /** Current backref's number. */ private int backref; /** Closed groups. */ private final BitArray closed = new BitArray(); /** If the wildcard {@code .} matches any character. */ private boolean dotAll; /** Multi-line matching mode, {@code ^} and {@code $} match on line bounds. */ private boolean multiLine; /** * Compiles this regular expression to a {@link Pattern}. * @param regex regular expression to parse * @param mod modifiers * @param ext XQuery 3.0 syntax * @param ii input info * @return the pattern * @throws QueryException query exception */ public static Pattern parse(final byte[] regex, final byte[] mod, final boolean ext, final InputInfo ii) throws QueryException { // process modifiers int m = 0; boolean strip = false; if(mod != null) { for(final byte b : mod) { if(b == 'i') m |= CASE_INSENSITIVE | UNICODE_CASE; else if(b == 'm') m |= MULTILINE; else if(b == 's') m |= DOTALL; else if(b == 'q' && ext) m |= LITERAL; else if(b == 'x') strip = true; else REGMOD.thrw(ii, (char) b); } } // no need to change anything if((m & LITERAL) != 0) return Pattern.compile(string(regex), m); try { final RegExParser parser = new RegExParser(regex, strip, (m & DOTALL) != 0, (m & MULTILINE) != 0); return Pattern.compile(parser.parse().toString(), m); } catch(final ParseException pe) { throw Err.REGPAT.thrw(ii, pe.getMessage()); } catch(final TokenMgrError err) { throw Err.REGPAT.thrw(ii, err.getMessage()); } } /** * Constructor. * @param regex regular expression to parse * @param strip strip whitespace while lexing * @param all dot matches all * @param multi multi line search */ public RegExParser(final byte[] regex, final boolean strip, final boolean all, final boolean multi) { this(new RegExLexer(regex, strip)); dotAll = all; multiLine = multi; } } PARSER_END(RegExParser) /** * Root production. * @return expression * @throws ParseException parsing exception */ RegExp parse() : { RegExp regex; } { regex = regExp() { return regex; } } /** * Parses the "regExp" rule. * @return expression * @throws ParseException parsing exception */ RegExp regExp() : { RegExp nd; RegExp[] brs = null; } { ( nd = branch() { brs = new RegExp[] { nd }; } ( nd = branch() { final RegExp[] nw = new RegExp[brs.length + 1]; System.arraycopy(brs, 0, nw, 0, brs.length); nw[brs.length] = nd; brs = nw; } )* ) { return brs.length == 1 ? nd : new Disjunction(brs); } } /** * Parses the "branch" rule. * Parses the "piece" rule. * @return expression * @throws ParseException parsing exception */ RegExp branch() : { RegExp atom; RegExp[] pieces = new RegExp[0]; Quantifier qu = null; } { ( ( atom = atom() [ qu = quantifier() ] ) { final RegExp[] nw = new RegExp[pieces.length + 1]; System.arraycopy(pieces, 0, nw, 0, pieces.length); nw[pieces.length] = qu == null ? atom : new Piece(atom, qu); pieces = nw; qu = null; } )* { return pieces.length == 1 ? pieces[0] : new Branch(pieces); } } /** * Parses the "quantifier" rule. * @return expression * @throws ParseException parsing exception */ Quantifier quantifier() : { int min = 0, max = 0; boolean lazy = false; int[] qu = null; } { ( { max = 1; } | { max = -1; } | { min = 1; max = -1; } | ( qu = quantity() { min = qu[0]; max = qu[1]; } ) ) [ { lazy = true; } ] { return new Quantifier(min, max, lazy); } } /** * Parses the "quantity" rule. * Parses the "quantRange" rule. * Parses the "quantMin" rule. * Parses the "quantExact" rule. * @return quantity * @throws ParseException parsing exception */ int[] quantity() : { final int[] qty = new int[2]; } { { try { qty[0] = qty[1] = Integer.parseInt((String) token.getValue()); } catch(final NumberFormatException ex) { throw new ParseException("Number in quantifier is too large"); } } [ { qty[1] = -1; } [ { try { qty[1] = Integer.parseInt((String) token.getValue()); } catch(final NumberFormatException ex) { throw new ParseException("Number in quantifier is too large"); } if(qty[0] > qty[1]) throw new ParseException("Illegal quantifier, " + "lower > upper bound: {" + qty[0] + "," + qty[1] + "}"); } ] ] { return qty; } } /** * Parses the "atom" rule. * @return expression * @throws ParseException parsing exception */ RegExp atom() : { RegExp nd = null; } { ( nd = Char() | nd = charClass() | ( nd = regExp() ) { nd = new Group(nd, false); } | ( { final int grp = ++groups; } nd = regExp() ) { closed.set(grp); nd = new Group(nd, true); } | nd = backReference() ) { return nd; } } /** * Parses the "Char" rule. * @return expression * @throws ParseException parsing exception */ Literal Char() : { } { ( | ) { return new Literal(token.image.codePointAt(0)); } } /** * Parses the "backReference" rule. * @return expression * @throws ParseException parsing exception */ BackRef backReference() : { Token tok; } { tok = { backref = token.image.charAt(1) - '0'; } ( LOOKAHEAD(1, { 10 * backref + token.next.image.charAt(0) - '0' <= groups }) { backref = 10 * backref + token.image.charAt(0) - '0'; } )* { if(!closed.get(backref)) throw new ParseException("Illegal back-reference: \\" + backref); return new BackRef(backref); } } /** * Parses the "charClass" rule. * @return expression * @throws ParseException parsing exception */ RegExp charClass() : { RegExp nd = null; } { ( nd = charClassEsc() | nd = charClassExpr() | { nd = Wildcard.get(dotAll); } | { nd = LineBorder.get(true, multiLine); } | { nd = LineBorder.get(false, multiLine); } ) { return nd; } } /** * Parses the "charClassEsc" rule. * @return expression * @throws ParseException parsing exception */ RegExp charClassEsc() : { } { ( | | ) { final RegExp esc = Escape.get(token.image); if(esc == null) throw new ParseException("Unknown escape: " + token); return esc; } } /** * Parses the "charClassExpr" rule. * Parses the "charClassSub" rule. * @return character class * @throws ParseException parsing exception */ CharClass charClassExpr() : { CharGroup group = null; CharClass sub = null; } { ( LOOKAHEAD(1) group = posCharGroup() { group.negative = true; } | group = posCharGroup() ) [ sub = charClassExpr() ] { return new CharClass(group, sub); } } /** * Parses the "posCharGroup" rule. * @return character group * @throws ParseException parsing exception */ CharGroup posCharGroup() : { final ArrayList cg = new ArrayList(); RegExp sub = null; } { ( LOOKAHEAD(3) sub = charRange() { cg.add(sub); } | ( | | ) { for(final RegExp re : Escape.inGroup(token.image)) cg.add(re); } )+ { return new CharGroup(cg.toArray(new RegExp[cg.size()])); } } /** * Parses the "charRange" rule. * @return expression * @throws ParseException parsing exception */ RegExp charRange() : { int a = -1, b = -1; } { ( LOOKAHEAD({ getToken(2).kind == CHAR && "-".equals(getToken(2).image) }) (a = charOrEsc() b = charOrEsc()) { if(a > b) throw new ParseException("Illegal range, " + "lower > upper bound: " + Literal.escape(a) + "-" + Literal.escape(b)); } | a = XmlChar() ) { return b == -1 ? new Literal(a) : new CharRange(a, b); } } /** * Parses the "charOrEsc" rule. * @return character * @throws ParseException parsing exception */ int charOrEsc() : { int cp = -1; } { ( cp = XmlChar() | { cp = Escape.getCp(token.image); } ) { return cp; } } /** * Parses the "XmlChar" rule. * @return character * @throws ParseException parsing exception */ int XmlChar() : {} { ( | ) { return token.image.codePointAt(0); } } basex-7.7.2/basex-core/src/main/resources/000077500000000000000000000000001222453003200203775ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/resources/img/000077500000000000000000000000001222453003200211535ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/resources/img/basex.png000066400000000000000000000021241222453003200227620ustar00rootroot00000000000000‰PNG  IHDR_*tEXtCreation TimeSo 2 Sep 2007 23:40:39 +0100r>ˆtIME× +/£ºf pHYs\F\F”CAgAMA± üa­IDATxÚmSmL[e~Þ~À¤Ðš"tƒèBLŠnòï‘-*&, !n“}ÈüÚ¦ˆ“0ê¦ft.ƒ1üJÜtÿͶ27$°e® ®„®_„ ki{)4PZ¤=¾÷’veÙ“œÜsÎ}ÎóžûžsÙ ?„¶ÃéÙgž@pf±X q0nÍý¸pþš¿>ËZjwSeÅK˜šž%8ju.^îFãñN¦“*• «óóñø“Oãn8‡¸r¥WòµÚLéõ(Z[¼„3:<„Þëý‹Ø¡hZ]ôvÓa2^»JqŒ8éýÏÛ)ÎÍpu€NµŸHpvî~ ½ý Ž,~Jö™¬öÀAfèþ Ó~Ÿ”Ë}h%RãKº¹tºïÔí—ü—«w éXÓêY‚|zܪßÜKÉØºóU©ƒõ wrœs¯ZDêß#Ÿþrt$²ó‚¶ŸÎÒdn. ÕÕ’@ùž=D}H€FS”ä°Pè«/É_THƒ9ä×jh®®–à[ó¹óWÑŸš»t#¹yÁ v~KúB²‹-õô“û¹;ýó9öí#ÿ®]äR¥‘‹çFÝ~sû¡d,K%OëQr¥¦PÐb#'xdŒ¿œ§ñ‚|šji‘4m\pŒ›¯¢BgûvãmÛÈ[RBþß~'bQ(³²°Pµò-¯ P¸+ù݆cgŠвhn–‹°®.øM7°À)4¤¨Õ˜?z áÖ/ZSÌd4…Ã|É2ärDÄeýìS,ðçÚÆ€žüÇ}¡®ÆS^ŽÛ¯½ž£ù¢Á dnÈùfÜg³B]U‰àÝ`Ï­§¨V‹¼[·ll‚î̤×ÔÀ%®T餽¸j#J%Šóò`꺄“^vP»˜ C½i=˜4ê$ôÞ0Q¶bU¥›ðMà“ÎÓxëÝýìæm7…†PSQ)ñnÙaè³`KYK®—%ÎQ1û?’˜ˆú#-’˜èësV°É™(lf³ôN¿ªÊB0›Í”¬!uèñzé_£óãv:´8€ÎS'‘ûÔóÈP¥A—Åfgç(Êóß·~Œ¾éHt´·APjP²¡+–/g8þ£.ÿz³3t7¬æAúîä éh8ÐH¦¿û螈EÉÔŽ´’BÎ'kµY1îñ"‰Üihzz;Öñ80%Àj±ÂhìG4]rï …ªe©àÂø· M>cepoIEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/c_close.png000066400000000000000000000010111222453003200232610ustar00rootroot00000000000000‰PNG  IHDRVÎŽW pHYs ð ðB¬4˜ cHRMz%€ƒùÿ€éu0ê`:˜o’_ÅFIDATxÚÜ”±Êâ@…¿,ZX¢`!XÚ>@:·±K°´³´ôì-}!åÔ²ÛÙ™BHc1„‘ 2E [%èþú³…ÕÞf˜¹sçžsg¬¢(øDüàCñ1 ÚãfµZýÊó|¸^¯i·ÛA`=æ}ß/Œ1ŒF#Æïétúó%PžçÃÁ`€ïûG<Ï+„V ²X,8ŸÏìv»ác­õ(¶çyÅx<&MSz½¶m³\.1Æ0ŸÏ¹\.\¯W6›ÍãÚß½¦i Àáp Õj1›Íˆã¸Êcx˨dåºî·Ân·[ʖߺ&„°Â0DkÖ)%Zë— oí7ÆÐétªbÇqÐZWgÿ4G¥àõz¥J)”RdYÆd2Áó¼/Ïá‹k®ëbÛ6Qá8J©jè÷ûdYF†ï]«Õj•%)%RJºÝ.ŽãEÑKמZ+/—‘$ BKa%IR±h6›ïâ8æt:!¥$I’'êAXRJöû=÷ûÛíöýý?ßÈŸÐÝÛt—wgýIEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/c_create.png000066400000000000000000000007031222453003200234260ustar00rootroot00000000000000‰PNG  IHDRa~esRGB®ÎéœPLTEize*HfÑ//Ñ33Ó99ÕDDÖGG×MMØQQÙWWÚZZÝggáwwŒ µæŽŽ‹¨Çœ¦Åç••š®Öœ°Åš¸Ö¬¶Õì©©«¾æ¬ÀÕî²²æ»Á¼Æå¾ÈÒ¾ÉÞ¿Éß¿ÉàðÀÀñÃüÐåÎÎãóÉÉÌÖõÎØãõÓÓÌàõÞÞóÞéóùããúííðððððÿûôôðøÿü÷÷ÿøÿÿÿÿº×ÂtRNS@æØfbKGDˆH pHYs  d_‘tIMEØ 0b<íi“IDATÓmÐÛ‚ €a×Îi–eG;Y‘Ô¾ÿ»åàb:ã·ßÀƒçuµ¦Ò$Ρ+‚cEiMá–’š8XZÚq`W#NÏèÓ9G«áÆLT“ð3ê±™2šhX0Üð«%Q„8§¾2R…åÅb°Õ2'âôª·÷6-òK‹ÊÝÏë®&þšuþßЭlÿçIEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/c_editopen.png000066400000000000000000000007741222453003200240020ustar00rootroot00000000000000‰PNG  IHDRVÎŽWsRGB®ÎébKGD@@@§ö/f pHYs  d_‘tIMEØ )!š÷|IDAT8Ëå“?LTAÆÏpS ‰ÉK4†"N‰R‘B­ •=¥%%åÑAÅYÑž±±5žæ ¸ª¡#VßuÓ=‹ÝwÜM¨a›Íî~ó›™owáÞŽàª^õ/Ϧž·´[ûUZ§êf†ÂƵ; c§©ÿ’Á=çüÏúDkYÐsìÀrvº§?æùðñ͸ل¸€±¹¨ÄhܶKˆA]yˆvW<}öŠ¥ÕàÑhÆžåã‘jr¥ ÿí¸ÃÊæû ³ã¿,ɽ~oüáý¬ï­ ”a^ ¼¥yÈ-ý&0µ¸qɯӗ”áSò1• “™éäÙ¬ "uháƒï,bBQ¬`˜h¨”ò²A[3;™‚™gÃb“ñ·â®±cïa»©;¢¬ v‰B%n€[fPùaÆq 1"Šÿì×wSÈÂ1¦ÆÔø-#²ýÓYbÄ¢°X·°o!Æò\ùöv­±ghÝjÔ0ûÆ!ySüýf‡*›9xñ)‡ ÿM};WÌHeâ±IEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/c_goforward.png000066400000000000000000000012211222453003200241510ustar00rootroot00000000000000‰PNG  IHDRVÎŽWsRGB®ÎébKGD@@@§ö/f pHYsÊ&ó?tIMEØ e_òøIDAT8ËÕ“ÁKTQ‡¿{½oF('Q‹¢EÑ"H‚¨F]Ñ?îjA-d‚H!ÑMDnZ9‹ÚE‹ÒI¤Eˆ 3d¢\”b0f锥è̼ç¼{çÝ#Y¦F­ê,Ϲ|çwÎ=?ø×BlX9Ú2]¸J*ñèw ¹q êj;·ŸÊê·Äÿœ:X%žÞ>/êš®‹?àÐ…}›k}W±ûÈžµÅ¾ö^d$»¶’ƒi¿¯7©Ð…ã¤ÏÖ5vdZ¯\¬“¦$P¨àûƒôW1–úí’©Osܽ7'—¾Æè­?‚VÕJÐ9$‰F,Ž,£å ”@ XœØ©¡ùìéÈãþÁv¯,~ ]h&•pWAÂÙ1ã[<×ÅÓeDî*dq¤e)$Éd'LSã‰ÈÛÚê“S#OÆ€½« `~Á‚qÁÀ‚·’ 9PVNH9ÔTHGRQ´8Êð9“3™ùy4`bi“ò5 ñygUÂR,º ?Læp?ÞÁèË¿€p*J†:¡Ñ™ÈòÄÐô̦ޢ‹Ë™Â޶p`‘Ms§gÐòÌÒòˇÊ~†ÃZL5rVžô.­.î+8¹ÕÀ~9í&Ö"4q.8:{ÄŽh\=|‡.åµ·=tM^N¼?Ÿ/gW¬O<ÞÜGšõp* Ó£xöó1Ö‹_ð1ÿO9\œšêUݤ:{à™î×#ów/ÍÖJŸQæeì’5&Ïa»¼]E¯_¼M桌˜13Ó²ÚÎëþ!Ù¯¼ºqá¶f° XÌDMTðÃIÀä9@…•@ý!EóY[ÉÃ}ì‰ñ¢a5áÅ›Ó'Ï„â€2LØ0 L–ý=qvƒÛÛ"Òƒc™~߃:Gë “jÚóÅ…,ìÚ»»{p¬ÙZºñ ’æW ’á-B‰˜£×óÁ9V¨òb ÄM7gT7bÕžfºUVxA-rw‹1@qÉ(8JíŒJ„°ÝpÚî}Þ.¨\m mûN®Lr-EŒoI›p€ àÏ)Òø¿âw¾7¶þSIEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/c_home.png000066400000000000000000000007571222453003200231240ustar00rootroot00000000000000‰PNG  IHDRa~esRGB®Îé½PLTE ÿ4i 1l 3i 0fCtPŒ$´äªa™Q™É“ Ú˜ÎòÊ¡âœ`/L}7±ß«oÄ^pÃ]Öù×¶ë¯}Éq€Ìn,fÁ뻈Ò~ЀV0ÄïÁÞ–1f·ç±›Ü”>p*J†:¡Ñ™ÈòÄÐô̦ޢ‹Ë™Â޶p`‘Ms§gÐòÌÒòˇÊ~†ÃZL·´[ûUZ§êf†ÂƵ; c§©ÿ’Á=çüÏúDkYÐsìÀrvº§?æùðñ͸ل¸€±¹¨ÄhܶKˆA]yˆvW<}öŠ¥ÕàÑhÆžåã‘jr¥ ÿí¸ÃÊæû ³Š@8Žx”¤#T>V¬É;ÆÍì…fm¿,`)³‰H$†eáõy!Ìrè(Þ¾)a@.¦.P® òù†h“€ÆûÁ@sïÁÐ0`Ú^8u1&]£¡öu˜† ¦{‚L&ƒBaÛ‰î! ~OÂ’3µ×ƒÞW0ÇûÜçÅ ^íì`_ªå˜'áÈÄá4äDQuz‘¾¿~æÌøÛø r¹2ØÌÞ/Ì¢ÝVP¯VñiÿîÞ¹ _0Fý¨>b‰1#2Ýr]Eve ¥ÚW‹E躎P(„t:åõ›'›x(?}dK†á™¡Ñ8hB39\~°EaŠ<öçײ¢Q–І?ËhÉ=̯ÞÂÜüÂãi§‰f<•Ì´ºW…\k ~ýâKëS«Ûrö@1x±ÛDBW°zÿ!’kÙ2ÿýJtË2¬–ÿIEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/c_showeditor.png000066400000000000000000000031251222453003200243530ustar00rootroot00000000000000‰PNG  IHDRóÿatEXtSoftwareAdobe ImageReadyqÉe<diTXtXML:com.adobe.xmp £Îôc‡IDATxÚ|’OHbqÇçýž&ú4KRÖPcÁˆ¤ÙzX‘N¤–eA](A,ºì1ìÒ9Ø£‡õ$íF°Ê^":yP̨”òÏF ,¤f™;ï‰nmÃ{o~ó>3óû³µµ½v}}í`YvG$1õz}ixxø[ïy èË'½ÕjÕAùáñx¸µµ5éÈÈÈWŒ}‚¬ ¸ººr0 ó]¥RqwwwD(ÂÊÊ ÇCðÌý" \.;:ÎŽËå[,ˆF£Ë倇ø|>²9ÏBÈÅÅ…çüiµZ¥CCC,:˜ÍfˆÅb]ˆßïç”Jå6æ>¾òøø8‹˜B¡@ƒ„ééé.d``VWW)dyy¹BÙÛÛ["—ËáèèŠÅ"=P(O ëëët¯×ûz~~žæ±ƒîïï­jµZ( T*J`ošÍfé¯7* ›µ¦ /IEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/c_showexplore.png000066400000000000000000000004511222453003200245420ustar00rootroot00000000000000‰PNG  IHDRVÎŽWtIMEÙ   ¦s£ pHYs  ÒÝ~ügAMA± üa¸IDATxÚcüÿÿ?5UL£©,›d§ÕuMeÄ0*A´!@‹±»¾~OÐÏÞâöÄ•Ä>L=†AŒŒP " ‚«‡Lt H^cBñšŽ¡)†â+çOÃÙÜœœØ]ÄÉÎ1 /Ÿ?…¢ćÉÕsá0ˆ‹› FP|ùÜIˆ! Iœ¬0‚FtÁ¹yØŒ$¦#šG?Ìékd`ae!¨éÏï?bŒƒ®<ÞI¥jzúIEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/c_showfolder.png000066400000000000000000000003271222453003200243410ustar00rootroot00000000000000‰PNG  IHDR+ fÄsRGB®Îé PLTE€€€ÀÀÀM›˜‹tRNS@æØfbKGDˆH pHYs  d_‘tIMEØ 5¾ãVê7IDAT×c`@¬RkÕ0›CDr]Yµ ÈFªá0‹(€Hí 45"¯ ›Îûk Άa¨IEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/c_showinfo.png000066400000000000000000000021631222453003200240210ustar00rootroot00000000000000‰PNG  IHDRóÿatEXtSoftwareAdobe ImageReadyqÉe< iTXtXML:com.adobe.xmp ÍÇÿLéIDATxÚ¤SÁ ƒ0 «3dŠü`&è³ô™ úì}2ÏNÀ<‘Ø!ŸŽ@}’#¬§ED:9qÎ;qêu]«3ƒJ›mÛv _âÔypcd93"£;LÓ4ì p cóÿƒ‰1öJxÛ‡Ð4MÏi­|Kæ ð§5‰:”#«¾~]šp¢ÄTñ£îëùnè@ä KR{•×,™-Œ~G8¦{C ¸œÑ8éS¨1žXmkX{±¤ÒuÿvŸæ’J'èàÊ&õ4.=³@ŸŽKO~ºüÌGó/X¿Q:t¶8_’†9ªAIEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/c_showmap.png000066400000000000000000000004221222453003200236370ustar00rootroot00000000000000‰PNG  IHDR¤à“dsRGB®Îé!PLTE7‘< P¹gÌtÒ â–´ÿª¾ÿÈÜÿÚâÿdÜtRNS@æØfbKGDˆH pHYs  d_‘tIMEØ :aݼ]IDAT×c`À•CÀH€AkÕª¬U«V)00XAX ^–ƒ[Y™3gÎDae¡,÷²r ªÈÊèèè²Ì!, ÉêÐ6! ¹Àý.MZ”IEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/c_showplot.png000066400000000000000000000003411222453003200240400ustar00rootroot00000000000000‰PNG  IHDR¤à“dsRGB®ÎéPLTEBBBJJJXXXdddÀÀÀr!VtRNS@æØfbKGDˆH pHYs  d_‘tIMEØ / À9W8IDAT×c`ÀÀ!,--M,--Y + ¤*MŒuó bpY8KÙ5°¹“ýPòÿ{—R@êIEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/c_showtable.png000066400000000000000000000005531222453003200241560ustar00rootroot00000000000000‰PNG  IHDRa~esRGB®ÎéZPLTE·ÓÓéçóó ó4'œLV»DOóD?óP?óPD³dmÓ\lÓd\³odókVól\Ë|…óytËŠ|Ü¢ã”㢔ëœÛ³ºÛóóÒÍÿÿÿþ$ØtRNS@æØfbKGDˆH pHYs  d_‘tIMEØ #¯EÐ}IDATÓÐëƒ ` Ž‹Ú‰"E¼ÿkŽ›óDzœ/‡6¡infªé¥àmË2-%ó< R>®V×  =CŒ‡Ò%Óx’ýG¸{ïW"kCÌdBã>-ýMêE´Ùø )êh¼Z?(͉{Ž£ÐZÖ£ÑZ)¸ùYo¨X¥ËêIEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/c_showtree.png000066400000000000000000000005361222453003200240270ustar00rootroot00000000000000‰PNG  IHDRVÎŽWsRGB®ÎégAMA± üa pHYsÃÃÇo¨dtEXtSoftwarePaint.NET v3.5.5IŠüàÎIDAT8Oc`2À!÷ÿã,N‚ àÇe8õ\´ÁÉÉÉÂÙÙù:ÒûtI¾jàjlâã@¶H3Tl:Pl=-€×@tï ,!y„áЀLJJ’bp¬!B|˜ZB6’G±À@|¸Â(w¨f!Þp*šŠhli +Ê%ñ  üy -Ó0 ‚ç @\d÷#+Å Ôlò`µ0ÿÃbŠT>JŒÓ ,fH¥ÑcŒr‘”öi¨ÍfÏQ«„ê®IEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/e_close.png000066400000000000000000000003071222453003200232720ustar00rootroot00000000000000‰PNG  IHDR Vu\çtEXtSoftwareAdobe ImageReadyqÉe<iIDATxÚœRAÀ “Åσü.³‹D<°&ÄHªZ2¨8Dd©Zkd Ç*0³N ÿ¯¾dϲ²Â?eó°U—à&²dØS²øÕ’'ãÅ–ú„¾yÃà‡‹›D¿¸!Ú¾e¿Æ+ÀøãYçñlÒIEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/e_close2.png000066400000000000000000000003341222453003200233540ustar00rootroot00000000000000‰PNG  IHDR Vu\çtEXtSoftwareAdobe ImageReadyqÉe<~IDATxÚ”QÛÀ +ž;¸#±#SPé)Vïl><IHfvýAö…™C%"„„ù-Ç¡” Ôý#bU‹{Õ· NDõšó2·»÷¨ œ©—ý[ÄApŠNËHØSæüã=¢6޴˼ë)#qþ8©SÄÆzŠ[€;tEXtCommentEdited by Paul Sherman for WPClipart, Public Domainp'zIDAT8Ë­“±OSQ‡¿×´¾¾Ö†¦( )ÄRmÂ"!Œ“²ØŽ¤‰ü †‘¸˜:6WWˆš‘ˆ+¡¶e¡Ïj “IMúò(û mßq¨m*Tô$7¹÷&ç;çw~9ð¡ ú|7[ðÀaÀ¶áã5ØJ@õ€¼Û­šFjÂë]º5?¯29 µd2ä¿W[­§M{²¬ö@ÎåRO›ÍôÜÂBLâq”rLªU8;ƒze{›ÝfóUDÓ†,Ëpv§Ífj.‹1=’Ëu*wõ:J¥~?w*•dÁ²>Ïû5óOÃ^Y{qQìÕUiëºÈè¨Èø¸†!v2)ÈW,œ¤N/€ ñ»Á Êñ1Êæ&D£œŒŒ kkÈÆF§Êò2)^ÿE«u¿'Á añù°××9˜™!¼·‡95@@×ù^6 ÜëÀQ …Nr74­Ï«nÛý€â§vÏ&J%̱1ºN TÂŒDg2—Åþ!ÞÈB½R±ggÅÞß—Þûà@$’"ˆ ’cËãqÿ‚{©nÂïŽ ‹(ŠìÀ£nž£{ z½O¾ÀëAb@8‘à­ÈË{.׋‹QÖ4ç;xœ…ZäD††¤ IŒXú¦ªÊ_—) ¾ ˆ·N[WUu7~~nñ¿ã`Lë³h£†IEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/file_raw.png000066400000000000000000000012431222453003200234510ustar00rootroot00000000000000‰PNG  IHDR ×9‚„ pHYs  šœUIDATxœ¥SAKbQþž3Qð j¥‹\D‚ÙâE®B‰&wË B…þDHöZm3[¸pª?EAm‹@p!¥Ù{Ïza×o·qdŠi`¾Å½çžsùîwÎ=G! @®Š¢  2$ÿb+í\-Š?Hßã/w¾ÊíññQ ££Ãét¶ÂBˆ‡‡‡ÎÎNé´,ëõõUUUEQ,Ëj4===Ò¶m»¯¯ïí5Ã0fff|>ŸÏçÍår$…$www¬®®6 ’º®ûýþºU¶Ÿ#‘H(zzz2Msbb"‹‘$ ’———‰D±X ƒ*• Éb±(•jšvwwGrmm €išÇÇdž‡‡MÓ<88ptt$J¥€±±1UUkµÚüü¼ªª¶¶¶‚Áàâââéé©aºººÔëõ|>ÇÝn÷ýý}&“ ããã¿k¬ë:©.ßÜÜ<;;pqq‘Ë圜œÜÞÞ°ÿc? ŸŸ‡ÃáÙl–¿!Äòò2€B¡J¥\__“ŒF£VVVfgg¤Ói’{{{2› Ã04Mòz½RÄc¥R0õmŠäíí-€d2)K£on …t:-?‡äáá¡ÌìêêêååerrÀúúzë'I~‰Åb–eÍ}Ÿéîîîïï¯V«år9ÄãqÇ3à°mÛåriš&»diiizzºÙl†188¸°°ÐÛÛûI‡·ÂB‡Ãñi÷CyK¾mž>²i»ÿýñcÿ‰ŸÛ3}¿#öIEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/file_xml.png000066400000000000000000000012461222453003200234630ustar00rootroot00000000000000‰PNG  IHDR ×9‚„ pHYs  šœXIDATxœS¿KzQÿø4!Tè©ÏA-‚mÁ©%›kÑÆ"ÝÍ?Á9j”‡hkˆ¢Â!i Š„"äiú(‡Ö ïÓpëÕWú‚ŸárϯϹçžs,$ÈÓb±ÿ4IÍï;¾ñ£5Aò·Ç¦ ÃÐ4 €×ëµÙlF·Û º®Ûív¯×«( €ççç÷÷w‡Ã1==Ýét^__'''ÇÆÆ~( à ¹³³àââ‚äÉÉ €ÝÝ]’…B@$©×ë$ïîîü~?€ýý}’¹\@©T"Ùï÷I’üb|zz°¹¹Y.—looK}6›•‰¯®®H®¯¯Kñòò’äÊÊ €ûû{Yè£)ìííIïn·KRF“ÉäòòòÑÑÑé驪ª[[[4MkµZb±˜b±×ë‘¶^¯˜ ‡Ã•Jemmmqq1ŸÏ›Å‡Ã–oÈ(EQ”V«ÇÊår<Ïf³º®¸½½àóùfffR©T&“i6›’ÀÍÍ —Ë%„Ð4MñÕë———ÕÕÕ`0øøøHòøøÀÁÁÉt:=>>®ëºÙÊÃÃC×××ý~iiiÄ6277'œÉª-N§ÝnOMMMLLÈ?Õ4Ín·{<žF£@UU9‰2½BUU«Õ*GØA·Û=::Šß;3Ì> þ¿Ôzüµï&L·O‡Ÿð )ï±IEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/go.png000066400000000000000000000010151222453003200222630ustar00rootroot00000000000000‰PNG  IHDRVÎŽWsRGB®ÎébKGD@@@§ö/f pHYs  šœtIMEØ  0ò;M]IDAT8ËíÓ=KQÆñÿÌ]vÜÕ]Íâšdm´ ­”hˆI—bÁJ!Â&ˆ2µ¥Ÿ@Bz_ÐF° bÉ'HB `¡ßMæŽ;sgF=¶[¸¸Z¥ÈÓ.÷ǹœsáŸÎäÊSy3Û'7¹ë4ßw?S­Vɯf$öR|xöźRi*• ¡©3±ìIɹÇÔèÇ+A»Ù›É2<4D¾?áå\·L—–!á\Nñ}ÖíkÚÜ,Ÿ<âØýÊó™.iùiqãi ‚(GQè,ðpd»kÛ²³}È|mßj ‚‰CNê>Æ„a@ÅcH’„rïmzî”8#æÅŒÈ|íÀjÚ‘‰êyD‘„s7›¦\,¡”bãç&áÉ)È¥Pû8iP© ¶m“͹8*ÅÑžF,¾þcµ65ÚrºŠ» ~ÄÆß ÜkŠ\ )ùÎañëÛ½j˜¥šg½yo]k!ý¿{[>åöû,¼Z·Xºþ™^—wË„ÿị쟳(8HIEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/hist.png000066400000000000000000000002761222453003200226350ustar00rootroot00000000000000‰PNG  IHDR+ fÄsRGB®Îé PLTE0ÿÿÿ³³³³T›ÜtRNS@æØfbKGDˆH pHYs  šœtIMEØ , ˜‚Ûã!IDAT×c`¦U«VÉÐÐ8™¶jÙl 6 ŒTo–o¯»IEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/icon.png000066400000000000000000000027421222453003200226160ustar00rootroot00000000000000‰PNG  IHDR szzô*tEXtCreation TimeSo 9 Sep 2007 21:52:43 +0100`c÷tIME× !¿|G pHYs  d_‘gAMA± üa;IDATxÚíVkH”i~¾ùÆSó’æ)RýÙØ¨Øè™—-›²Ëv£úUÖ™m…eW‰‚b“ÂR‰µ ”]()X¤ôGa-K¹4Zi8¦éŒŽ9—³ç}§optf·‰ ?=pæò½ï¹|ç=ç|²)S¦ ¤¤DY¼x1µµµ…¬§×ôöö¢¶¶6äÖ­['¿FcHúšžîk¥òKñÕèïï—ßN§óË>|8æÍ›‡ŒŒ ÔUU‘…_Æ¢ªô&%…𢢍):šµµ²˜êoÞ$‹NG­t¤¨ˆÚOŸ–ûí—.÷*9îß§Ö´4²„…Ñ›ÔT²ææ’õÌjâ"lމ‘{_''KÛšÔTWËÂôË€!ÓC<ÍœLLmééˆ,)AòË—°{<Ðq6¶ðQù·¨ƒžÊJDð02Μ‰ÄÛ·eE;î݃½¬ Ž{ä´Ó_´ ó…Ï—^?4"²æW¯ðìÙ3t^½*Ÿuððx=z´7CƒÅ` wЛñã©mùrrwu‘Çå¢îòr¯.3¬––ÆFª¯¯‡&ZúeÀÅ£›<™¢8]ÌŽâ-ÕÄD¸[[a˜?ñ×®Á`0ȽÝÅÅèäÑêá³è½|Y ĺhWnQeœ=+×L¿ñŠBš¯÷[·"þèQ/«Ñш)*òoCæÏ„ Ðsá‰5cZšÏ¹@ÄêÕð|ø m4¿‘ãÆ ¸ß½ƒÇfƒ:j†qÀvnåèÂBÏ”Á›1#8 &ªöŒœB,çÔßä" †ýû÷ÓöíÛƒNÂÿ s¾tPff¦ŸA“ÉD<  M[AAAh\ð¹Î5ÉÎΖ³?>~üHk×®•ÙøßqcƒÛl6JOOšJ-ƒÏ{~bX2Ú·o½eâéá±êr¹pìØ1Lä±:OxÎóY"%%zîá²²2ßTÛ´i9ˆKé;w ]<ÖwïÞWÜê‰Ü]cÆŒñ.lÞ¼™BÁªU«üÞBdL¿ÀgÛÇòEwB¿ë#Šy@ƒªª!Ùúæ·b9ˆÄ€™;w.bcc?K©{¿‹³åQHŽEÍ$ñ}â;¾9þd5·¦øØIEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/logo.png000066400000000000000000000255551222453003200226350ustar00rootroot00000000000000‰PNG  IHDR€€Ã>aË CiCCPICC Profilex–wTSYÀï{/½ÐB‘z MJ‘z‘^E%$B °WDWiŠ"‹".¸ºY+¢XX°/È" ¬‹«ˆŠe_ôeÿØý¾³óǜߛ;sïÜ™¹ç<(¾BQ&¬@†H"óñ`ÆÄÆ1ñÝD€ÖpyÙYAáÞ?/3u’±L Ïúuÿ¸Åò a2?›þ¥ÈËKÐBй|A6å<”Ós%Y2û$ÊôÄ4ËÑQV•qò6ÿìó…ÝdÌÏñQYÎYü ¾Œ;PÞ’# Œ¢œŸ#ä¢|eýti†å7(Ó3Ül0™]"ॠl…2EÆAyJò,NœÅÁ24O8™YËÅÂä Ó˜g´vtd3}¹é‰„Âå¥qÅ|&'3#‹+ZÀ—;Ë¢€’¬¶L´ÈöÖŽöö, ´ü_å_¿zý;ÈzûÅãeèçžAŒ®o¶o±ßl™Õ°§ÐÚìøfK, eª÷¾Ùô Ÿ@óY÷aÈæ%E"Ér²´ÌÍ͵ x²‚~•ÿéðÕóŸaÖy²ó¾ÖŽé)HâJÓ%LYQy™é™R13;‹Ë0Ybtëÿ8+­Yy˜‡ ’b=* 2¡(m·ˆ/”3EL¡èŸ:üÃfå Ã/s­æ# /± 7èù½ `hd€ÄïGW ¯} $FÙË‹Öý2÷(£ëŸõß\„~ÂÙÂd¦ÌÌ ‹`ò¤â£oB¦°€ä¨- Œ Øà Ü€ðÁ ĂŀR@ƒ\° ¬ù ì{@9¨5 4€ œÀepÜ}à>#à˜¯Á Axˆ Ñ 5H2€Ì ˆ ͇¼ @( Š… dHI¡UÐF¨*†Ê¡ƒPô#t º]…z »Ð4ý ½ƒ˜ÓaMض„Ù°;GÀ‹àdx)¼΃·Ã¥p5| n†/À×á>x~O!!# Da!l„ƒ#qH"FÖ H R4 mH'r D&·††abXgŒ/&ÃÃ,ŬÁlÔcŽ`š1˜[˜!Ì$æ#–ŠÕÀša°~Øl26›-ÁÖb›°—°}ØìkÇÀáp¾¸X\*n%nn®w׃ÆMáñx5¼ÞŒçâ%ø||þþ¾?‚C ´ 6oBADØ@(!%œ%ôF 3D¢щLä—‹ˆ5Ä6â âq†¤H2"¹"H©¤õ¤RRééé%™LÖ%;’CÉBò:r)ù8ù yˆü–¢D1¥p(ñ)e;å0å<å.å%•J5¤ºQã¨êvjõ"õõMÎBÎOŽ/·V®B®Y®W›¦°©iŠi…é 3ØÌÞLh¶Ï¬Çkîh.2¯6`QXî¬V=kÈ‚ah±Á¢Åâ¹¥¾eœåNËNËVvVéV5V÷­•¬ý­7X·Yÿicjó©°¹=—:×{îÚ¹­s_ØšÙ l÷ÛÞ±£ÙÙm¶k·û`ï`/¶o°wÐwHp¨t`ÓÙ!ìmì+ŽXGÇµŽ§ß:Ù;IœN8ýáÌrNs>ê<6Ïhž`^ͼa]®ËA—ÁùÌù óÌtÕqåºV»>vÓsã»Õºº›¸§ºsîaå!öhò˜æ8qVsÎ{"ž>žžÝ^J^‘^å^¼u½“½ë½'}ì|Vúœ÷ÅúøîôðÓôãùÕùMú;ø¯öï „”<4 ¶ÁAþA»‚,0X ZÐ ‚ý‚w? 1 Yòs(.4$´"ôI˜uت°ÎpZø’ð£á¯#<"Š"îGGJ#Û£ä£â£ê¢¦£=£‹£c,cVÇ\UƶÆáã¢âjã¦z-ܳp$Þ.>?¾‘Ñ¢e‹®.V_œ¾øÌù%Ü%'° Ñ GÞsƒ¹ÕÜ©D¿ÄÊÄI‡·—÷ŒïÆßÍ¸Š£I.IÅIcÉ.É»’ÇS\SJR&„a¹ðEªojUêtZpÚá´OéÑ鄌„ŒS"%Qš¨#S+sYfO–YV~ÖàR§¥{–NŠĵÙPö¢ìV ý™ê’K7I‡ræçTä¼ÉÊ=¹Lq™hY×rÓå[—®ð^ñýJÌJÞÊöU:«Ö¯Zí¾úàhMâšöµzkóÖŽ¬óYwd=i}Úú_6Xm(Þðjcôƶ<ͼuyÛ|6ÕçËå‹ó6;o®Ú‚Ù"ÜÒ½uîÖ²­ ø× ­ K ßoãm»öõw¥ß}Úž´½»È¾hÿÜÑŽþ®;+¯(Þ´«y7swÁîW{–ì¹Zb[Rµ—´Wºw°4°´µL¿lGÙûò”ò¾ ŠÆJÊ­•Óûøûz÷»ío¨Ò¬*¬zw@xàÎAŸƒÍÕ†Õ%‡p‡r=©‰ªéüžý}]­zmaí‡Ã¢ÃƒGÂŽtÔ9ÔÕÕ8ZT×KëÇÅ»ùƒç­ ¬†ƒŒÆÂãà¸ôøÓ~ì?p¢ý$ûdÃO?U6Ñš š¡æåÍ“-)-ƒ­±­=§üOµ·9·5ýlñóáÓ:§+Î(Ÿ):K:›wöÓ¹ç¦ÎgŸ¸|a¸}Iûý‹1ow„vt_ ¸tå²÷å‹î箸\9}Õéê©kìk-×í¯7wÙu5ýb÷KS·}wó ‡­7o¶õÌë9ÛëÚ{á–ç­Ë·ýn_ï[Ð×ÓÙg ~`ðÿÎØÝô»/îåÜ›¹¿îöAÁC…‡%4Uÿjòkã ýà™!Ï¡®Çáïó†Ÿý–ýÛû‘¼'Ô'%£Ú£uc6c§Ç½Ço>]øtäYÖ³™‰ü߯|nüü§?Üþ蚌™y!~ñéÏm/Õ^~eûª}*dêÑëŒ×3ÓoÔÞyË~Ûù.úÝèLî{üûÒ&Ú>||ð)ãÓ§¿›óüìÎçŠ pHYs  šœ IDATxíœUÅõÇgû.[X©*bÊ(jŒ¢,{ï°¢±›˜?+±ý-ĨI4ÆŠ½c×hl!ŠŠ!¨Á‚tØÞïÿû»»w¹{÷Þ÷îk»KÞ;ŸÏy÷Þy3gΙ93sæÌ̽Y–e™ ¤o d§¯èÉUHs=È(@FÒ¼Ò\üLQ€4/4?Ód ÍK ÍÅÏôHóHsñ3=@FÒ¼Ò\üLQ€4/4?Ód ÍK ÍÅÏôHóHsñsã‘?++«7é.‹âIßÃÒܶ¸/ýxBÎ~„ÿÌóû¿†eÁÓ§Ès[hÞ´'0V„ø°Ô†Âu÷ ’Ù6[å{5H¿ð¸z€¶B©9rdþÍ7ßÌãºøÃÌÃ?,Æ›#p/å®Ým·ÝŠ®¹æšѺÿ¯~øÁLž<ÙÔ±p¯ØyôéÓÇì¹çž±ä×câ>û쳡yéׯ_—ó»ï¾3ÙÙ±Ûô±§p[KK‹ëiݺmnŽÔð;ʲ.ÈÙÐÐБéO )@È<2Ñzp d WNW°–Q€®(åœGFzpåtk )@NNNWð˜’<òòÂûvÖ9‹ŠâóÉ%4 üâ‹/ÌgœÑ¡‚òóóMï޽͆nh†n¶Þzk£iTWÃûï¿oÞzë-óí·ß? ùwÞ ÍÒG}ÔINM¹ LÿþýÍf›mfvØaûšh%ÇìÙ³Í{ï½g¾ùæÓØØhðVÚ”***|匚Ÿw(ZDƒkÀ¨^Àõ×_ß:ꨣ,æÝS/H§jkk­“N:É¢ÕFå­ÿ½áÈ×Êÿ›‚r¬D¥UZZjxâ‰Ö’%K’.`MMuÇwX;î¸cT>àuV<~áY Œк|Òìz{©£ÂÊÁ¡àHpWp8höÚk/#ÚÎ;ï¬Ç”À-·ÜbÎ9çÑžÞ Î#M’å;_MœN€œ…JN¿¡Raú¿?¸ ¸?8âC1>ú¨IÖ°ñòË/›K/½Ôüë_ÿ‚¼©_g @¯\*ÿ•Èó×pà§É ƒ‹^àPL[j)·ÝvY¤Æ/VAmM¾-;áä'9?)++³~üñÇ„…S«¿ð ­ÜÜ\É#Û}àöÉæ½+ HÚ9 \ÚÂ¥bH˜0a‚£[$»°"ÑC¦¾àwC‡µ*++R€¯¿þÚ¢·”Bµô#åÈ]¦“£.U˯ÖÙgŸmáfM¨°¼‰bœ‚»Âɳ+®Ès“dºøâ‹½,ÅôŒñjaT:2<ÍÁ©ä¿Ë@›€sÁ„ Ì[º¬ŠYƒV&UàèTžC›|¦€Í›o¾¹µtéR/K¡Ÿ_|ñE‹“SùWC3×É#U×nQ ÈÂV÷f͘1#t!…‰8sæL‹iš2ù –ªÂk“ã$òhdeÔbz†=ß8O<ñ„mAK†ÝY©äÙM»Û@L–ZÒþdÂe—]æ´$Mø{»…NÖ=t'‚ åååÖ+¯¼7û=ö˜…#GüÊx=>Yü…¡Ó­ ƒÁ†AƒYóæÍ‹»½ e`žp ŽÌ$¤v§Ð;¬Çé•ò>óÌ3Vqq±ø¬SiÉŒÓí a€ Ak§v²V®Ô469€wÌbÊ£Ó¡šyáõX°NS¾Y³äw‰˜ã[¢!ZàQPI ±Ðéò ý˜CxMïm¯aSSS|%ê“jÑ¢E–Œ3ÑO÷Ë?–0hÖ–””ØÞMŸ,C½ýöÛVß¾}Å“Æü‰±ð̸=B$P¾ Z¿ûÝïJà?·d¤A[Ýìx(Ç%7i uÙO=õTÜ Î™3Ç™©h[Òiñò“ŒtqD22ö£Aal ~- þþûï'JòàñÇ·X”ünå˜d'Í!`u¯^½,ÑŠdç 6L|Ï‹•dÇ©’¹= e°RÆU"Ó*hw‚o¼Ñ)øOÉc BÉOÜÅ“,õGy¤ݰ¬àY¬Ž:<üOØüS/T¤’?Úöd°E1–s‰’<˜:uªS/’G”#–qö+4U•!^X¼x±5jÔ('ïë£åÛUÿG¾«˜ðˇBÿ=hûĵ0’,`Û¼uÀ8q§_ÞNù×°îo=ðÀq³°bÅ k=öpò¼šÙNÝ}íÉ  -;O‚Ö”)Sâ.|¿„Ë–-³ØÀáTˆœ÷Ê|÷W±Áź÷Þ{ýÈ„ Óþ€±cÇ:yÝÍ<¿üº+ÌYÏ߯.³XwÔ”,a`±\B×Co%÷rÉjÜýô®aÔ(FÖãOáŸa·ß~ûˆ-·ÜÒYçï9ÆíP¢EÛûX;¸’|¾!¿‡2<ãþaŒÆò;ï¼ÓàPrþŠùúÉ'Ÿè´ŽaæðLUUÕñ>6"ìb0ieï“G‡ ¶ºÑŒèrgCˆ\²tˆ•äÍwЬ¹d~/·w+ÂdAelK¼×è†ûc€™”=–xýõ×mzÕÕÕPœ€¼C~c¸Œuø¾ìÂ1ì.ê”YËŠ¦yÉÓ²r¥i©¬4–NcqH&‹}†Y%%&›S9˜l¶‹)L@CøÙÿ­dwo@Ù‰çÙ`WC=nâ(ÀHšëœzvŸ¬¾üòä0Â^µ,öf÷íkò¶ØÂî¶›);³«H]Ôa*½&3*Eµþè~ûí—ÿÜsÏ™º_4«¯¼2LRS~Å­ùÄþë_ÿjW2•¿(þzvóôÿãÿhN=õÔÖTMM¦Žý…µ'«÷]ÓôÕW¦eÕ*c±GOÝœ²Ø,›]VfrØY°ÓN¦×þû›¢ ì‰i•ý dÿ%i^mKg7¾Xdòæës¿Ûnc"¼]ÝÿÎ`ÓhY¼ØÔþãÉ|¸ÊcódÛµJ§N•kî) B}ëc>Q;Q9Ï —üñ2 s+n½5Ÿªœœ3"*À¤I“ÌWTèW\¡ÕÉ{´•‹ÕÉöʯ}þy³æê«MýÛo·W6|·ƒû¾=cgRf°! ò®»ìFPvtÊ”­è ž£78‰ø8išS\öN>ºZ«WKXðîuCx ”*lü÷¿ÍŠ_þÒ,?æ“U[«ýtêw£JðÈÑÇWÛ¼`©{í5›ûh|JÂZz µØH0mÚ4ƒrÙQtÚ£ÓZýªóÏ7K8ÀÔQù'?û¡íGJ&ô'¾®óç›ì ^vÔQ&»ªª€4&xPëhjjËÞÍ §Hí,õ³ö®=(u7U3gš¿ú•2ÒJˆZuNˆ\$RiåßþfZjµjZªªLõCíöo"mñ¾•^Ÿ9묳ì8+Ï;Ϭ¹áj×òíUéïÕ«å³õ=w£ìñ>š2TcÇ,?í4ÑÔú¯ÎÖ—Ñ#tĬÙåå&wèP[` m#Ï9l`?’$¨)¥Uú“©óMÅÝ›Gƒ‘ Ÿx X™¹Œf.Ív«¾ÿþVCÍè¹_o½õÌ¡‡j‡Ö<ñ„©`w±øôƒ,Î=ô¹î:3øãÍ`ºøÁŸ}f†Ð3 ùàSÎ^)Fز?ø ©áÝÜïJ¼£±Æ¢Y;9EL¥Ôt°œÀ «’•ž}¶)£kÌÆÀëPà:*Nkkà°HåÝw›*Œ+YÆA@—nªî»ÏôÝsO•É80’%<šÿG¨;×0â­ñUB×Úøé§¦ž qÿ¯û†Ï?7uXü¶!Æs$°8lQée: B/TtÐAídf³e»å9j”)¿ê*S¸Ï>fÙa‡Ùv@{$ÏM½K/â˜ÜÜãóø¯ÞU)ž¨ö£-#öJñG´Ê×v Ä/n´°¼m·•5)^L  Y……&»´T>¡zW(¬ r­‚‚¾fôè­ûŽmr‡ 3«.»¬Ce8kã\m ´§H[DéŠ&«"eLA » 6)€T‘6Œ4¢,õsæøò­J(úéO;TþóäÉÁÃT²zâĉ§3«8ŒÙÎaåÓ¦™­çüØ1uÿü§©Gq vݵ¿*As²h¿Ýv¦ˆE#ƒ›V4*vÚÊ»š˜VÌ à§B.dL~Ñyn»Šž\l3é%†UÑ4b€¹[¤;¾U#_„ EÎÏu„=È¢å×½úª/­Ü!CLÁO~b÷8kèš½ ümcðë¯mÅôþï~núòKcañ¬¹½lc³‡ Žliê$*_3šgàw‡’É“‡ièi©®6YÅÅ&´}45 ,!)& wÐcœÂåMû!þéÐò¸€Ä~†›º•ÙÞ#¦°ðÂ<¼wR€ Èn;3ˆ6.ŠCø‘ü_¶úÞ{M ã­»Urâ(‹9v>'Žò6ÞØ4rnÎO›jÆÞތёÀªn‹¢©é`3¯c‘Í“ÏpÀq0ÃΣ;X(r|ðû )-½t}Î'¦AwA2h'¢Ò  XOز „ÛŽ!®x ?òÓ&þÊ'“IÙxÚjpÝAÑÁÚVˆIB«*Ü{oÓøgͰ:ƒZdÙ¯±åå Ô9¡+¤‰—1-=üpÓ禛ÌÏÆŽµþÏCóF†OP’÷ˆ®¦ý5á_ò¼Œ{M[jQŒJ® ®Îý`îoç”'—Ð`ß¡cGˆ˜ˆô†nmÑRØÞ~¬Á±Ñ€•ì'–Z­\¥¥¸Y©à Îi=.rÜ65ÎÊ͵¿ãO‘s4…cÆØF˜Zd1gó*}@|„1óFŒ0¹tóÍËToAtê¿äåX»ìb ö3ûZ4räf£6ào-kœ® @²‰?‡ÇÀ/îru‡•›€ëEÐ=®õ)®ß/Iu½RÆ®mS-ü éÝýe.•YZ€˜CW½Œy~3>s˜$DÕwd6c7p+øn:Anî$¥—碥ʗ»ùý×_À A[m3fLYîàÁ¦™–ê²K"ƒRÌâ_ü¬¹ñÆN¼;ôl™ä戹PÍÔO†oþÈ‘¦@†âî»—em·Ý¾´ì}i7Òú54ÞGÔA·v1 m½t´L¨—ŠOšuÞ+çI1îÙb‡ MŸ ‹#ü§±¶ž3õvAµEp´·`ÇÍzÓ§ÛS%þzœÞÅ{‘ñw°Œ¿ÚW^é@˱-^´wÝu×s0Æ5%%bTa3¸óW=×¾ð‚iŠb öþÍoLÝo˜ú?ìDCtpÓ·4fV#´óÆ/a¯ÐCôbˆ*7ng¼};#Óù(ƒœ_w‚Z8P^U4šÚ§ž¢ pJ3\Z'– Ø8¢šóóœ!7¦@LTÂD% %€9¿›-wádÓªÔU{¬)Úw_ÓÒú6‹‡¡q( º3´´‰’•­ÆWàgü)A«nE̹)Ôÿ°]ëCPÇ.Ò0 JðÛÄ3Øû’Küþ¶Ã´š×¯àrÜÃr»e LÄâÑChÈVðRÊüm¶1%'ŸlÊN=uC”tÑ÷'ƒî^”Ç`húÏL#/ähãñÍ Œ1‚´OD¼€ƒUMÏúá8éO¡«%ÈZ'Žüß2‘5õƒ¼–ìì‰,¤›êãOÊV¸Ç&‹™Ú<‹Gµ¦àìßE([.JÕ(U4UÞγf™rz)„òÆNYèÚ€·p%è”G-t àÓàÐX,:7͘ïå¼ó@ì à!í±žWš,;òH³˜±q‹,5O>i²««e%ß@j•E "^pÛ×¾ô’iÄÅ*Aý@ Õô‹6Ô®Y¹ò ƒ[·ÛÀ¯ÂDË1ÛÒ^4«(gÙyFŸ!oóÍÛÁv !þp*Ky/•¡Ê^@²«7Ж$=GÅŠµÀå…˜†ob¿g·vÅih`^ÏŒ@(Áó·ÚÊ”]pÁY"§Ñ,âɯ*ep ªç/‡õö^?ÿ¹ü™‹â%Ä&ÙDø<㼆-¼A4cÐ.wÓMmE(»øbÛ`{YÇÐ Ÿ†'ly‡€«‡}+Y•ÑÈ8L•fPO”Í:D¼ÃŒÉ;ÝŒIT¹e´ââI“dvj™Ú Ñ´|¹=ýSKw»TÝ…£õ‚åLX<é3c†¦’wƒZY Áj>Ø,\hêØ âNÇ6ˆ6˜d1g§ S7ZAåk:5“7—2…ˆ? ‡ž@ëò^Í0Æ 7,ý¢ñãm”·PÆd#Æn=/mÒÔPkͬµ üøvӓѼ…*d:Æ#(™K™Yõ–ûã&é^³ê!³½ÞÛo"¥sÿ—ƒÖj\o@iaŠKÈÃMY(ÇLo„[…×MKªÞÂpžeÉ[¨ "ØgÂÜ•PÓ²oٚƟrlwþàveÜ¿sv£\²dˆÞÚÕŸia‚ÊF¨~úéNù+}cPñ‚ÿ„=$ä2,ôbˆ³©g5J[…Í£= ‘@e RÏN#-…MŸåV¦Üç ³{&Lr;e+]úØI³˜¶—,cNœ‘WBmWêßÈ ¸{K~þ´õ®½v}Ùut—N¥»ã+¬â÷¿7¥¸S›ÊÊŽƒ™›ìDyþ‚Œ?¥·["-Ü6D³³w¡Øeo=; ñ”’H‚Àö ²K'L ¢1—Å'mÝm÷ÝÍø *ûNœXZ¶ß}ÏݧTÊJZôßM¥AЈ_]ûì¬ñã7ƒ™_od-­¨ñÕOil:tŸÚYãϼyh±)ˆ†Âe™‡]&öÒvž·ei•ƒ¢æøãŽ3œ?üšw'^ÛÀ€sK&N%ÛG; ‚x¦E‹R±\©·ù$Bˆ:Žóõo6ãp4h˜7Ïô?^½ÇEÍ òü9t´`£î3 D*|¥wƒ(„z,‹—.¶׬±¯ö3÷Ú ÓO¢ºbd ]ÍžA½¯ŸóŒ#8†½ãéÉÞ.=ùäá¬NF¬äÖ¿“_²¯‰(€wü÷òF¥•aEYÒti‚¡Úð¡ ZÅEû¿•\ä_ѰÁo¾1¹olrË0Nƒh+\;µêè)¯¾³7—¾ûî»§bÎ畘³Ù<\N0‹VD3§Õî&æ¾ó|.L*Ÿ8‰(ÀO¡çM/OÃFà}ÀC­ï¿·ÝÂAÂ;ühzã€Výì5t' Å×vc°Í"ÏéÕ˸ö)tÈ]Ö“v$˱å^ô`îÃpå˜áñt^WSÆL¡9Bå‹B¼¤Ÿ­¶µøû|Y`ÄP'§SFMêt âåA‘UáìvY1uªibí ’ÐZLþöÛÛ¤,íù ðü9yÙ\;1\#ñ Ï`S¬ÜM6±]Ö5œ=ð‹¯0ñ§©[É)§tÊ}ÒóÆSV^žÓ›7b®ÆÝÜ´t©/-ɑǹ-f…ûeÄ4p”¦sqC›")½·G¥©]9A^+Ímub¦QNæÆ-ŒÕ~éd¢B(à%Ëù  ŽEŸv䥑ò1³0öš}رaÅs%›Pýè*Ì6ßxÃáX*c7°†g¶c3æþa¤íÝòh^nû×]ÿ`9Y{#W³n ¼úåéD/e8 c#)¾èT²¡šÙEPù;t#]Uæ…ô:ýPzAL &j(a4P\a4è­}ƒmF• ² ãù®Zj¬ %«¦ÛŽ´ÛÇ6Q-Z•Òº+ðXòO×¾ÃOó}VùL>3yèdË4âä’Â5âÈ J/YŠHWv晥ƒQpT°¤±Äž(ï<–ˈI”(H(‡`Ø«)§‹Ôr® ‰‹füiCd<«½û,C×1Ýôã_aZ q–‰Ë±ÜµQ‹3Ç/¾xP¸¶†I ü (äÖq±~¬V²‰¶‰xÓ±è~+?¶oX¨HÞDÞg¡8À@â•ðBmŽìÞ€rZ‘ÚC CA óv½8¥0^º·qûѰA¬´ÔŸ}ûZlrxöK£0Uˆzã;tŠ9µ>Ê–C+$Ý…Ä{Ë9)õêÍ3ÌsG ksMæUŒè°¤¶5ëlà`vÑ”]t‘òZD÷W©Í£ƒò$޽¹"¯ÍX #˜7Žhª”ƒòPx=ñ"Ð.£=fú1æjë—Œ.wZ;R„Ÿqqkÿã@œôGÑy¬¦Ðç€ÿjeTÛß:Ðw§Oú½N3·Aû@áX¹Ã‡g•òõɄՑŊ PZ®-Ûsr±xMÛ†KîYï1!Ÿ×îž Ç"vñ9\y®*­ñÛ‹ žÿÂ<êK:¾¥ÁMìUŒ$_3V{.=” ô:%¸©KðòiwP=n[9Šš´gPÊâ ç­×öúƒÁP•«ZóÓö0íPÊçЈ€Äs˜2žÍí?ì€ÖÖŸ¼²o#tQYæ³þâ€s<|G>p“y•Ç‚\M¡ÿˆ¶Íã*ÁŸç‚€Ç‚)ƒ§Y x ŸD%/þÕ{ðóËgÁ·[ ŸC± ?‚z;sM™ÍrŒ·)§Ÿnx3èrÞÂÖeCcv‚±ÙÉc.6JNð-ÉÔ%Eja)‹†º8 ¸„ –p•éº \Û÷´Î@^&쟠Ó>ù’{ÕUW·zõêAû²}ì ×,'NØë‡´Z½àO6r½¿½ßÚE;9^]ŸuÝu×MZ¼xñö¼µ4øÍ ô r p­9ÕNÆ÷¦ »‚µ}×GsÞû±ùC ´ `˜¬²÷Í;b L0­ì9³W‚M̧ñ .‚µø`áÂ…Ö¦›n*ÅN…J(9‰«þq±¾9”ÈË ý¸Ö÷Œ&´~ÐB<Ý–§TÆ U(©dÀM›Bù h¿K/‘Ê×;û]¯d‹ùÃððs°Ž½Öܹsa1y ÏɸÞx&”»µº5s·ðø°…ÏÍYŸþyÜ%΋˜,†§åß MÛÎqçæžtê–-õDz«X2A¯Šm{Op-y솟TÅé @! Ö«PXM‹»¬ùŽžÅ›>œÊš‰éo-Þ€—»1n¾üêm¯®ý<¶L„ÏDÒv» ü^`…ÞÁËQk¿² vî¹ç:•¯™Fy"£´@/ð5кä’KBó6âµ×^ëð«XŸDù'}·*Bkr¼DŸFc)5l¹ùÆ›>}ºS˜ŸAsH<…á—Z80ÌB¬vëž{îñÍ;‘À“O>ÙáûQòIêG-üäñ†u› ìæàW Å‹™)Cëî»ïv¾ôô’þ½@hîVèã|r6!^½‰e³Œ]û&Ñ«½”êçnQ sø1héÛ>‰À /¼à|oG~†”}% Ú'‚-šZ&2Cñ“UôÚ¦¬øÌÌäTWº›~—+öÿZgžyfBß œ?¾¥oCKŽ'9VR*yLßãÆÃ XíW—q‡éÕøzE>ôµ!OaJeqèwI&홵.|È:·Ž>úh6¸4Ä]`zë·«ëô}᳓o²®ð­uû'IJ_`­‚x衇œ^/&Éâ;.SÒÊã]*¼}öÙ'áÏ«^ýõŽñ$…ʉ$d2ÿ#¯~ =|é‹ÞÉ\ÑŽ\_’ϰdòîG«+@«1_Oèëš*ðï¿ÿÞ’—zòíoì'X*ÃÈs{p¥¾ò™l{@ò]pÁŽ|D>¦T–Tm@-ÿÐÚf›m¬oølJ¢àj%ÓRÍ}ä¹L2q& Qq:¥×7Ï8ã G >$Ÿ”)¹ 0á0®…u»Ûç}ÿÖ‚ : OÀþûï¯ÂÑÊb÷yÐZ?}[5f̘„ Ù ùõé<ÙÈ(œŽJFxi¤L`XëÜov·¯Õ¹dA›¯¿Ú)#½æ<“·z¶…š¾i•/ žàüóÏw”@Kêg€Q¿säðæš4€±Bp#ð`ðo ;%ŒuÌ1ÇXË—/Ojù\~ùåN¡1ù ?ÿ” ]^J¹«ã–ÝN¨€+ôT"Š 7°çÃ:Þ³>XÆ{ƒ1cx}ª“ (”ý¥æÎ¢+€T–ƒšCëÙË#AöfÅÓ×C§ ßi¥•œ*ìõ@9²p –™ÙãLJ,xL-|Ê»kx‡ñ³|´‚meNfk¸‘Ü«@É®×äÈ™ä€6çh=û|'À{En"ñ9|>—]­Ý£sq¬j©4̼=“1¦yg‰¾“ãÍ/iÏì2¸€^ת>蹞ƒ(t›òP«×w{Øñ#Wñ'’WΟð޽%Ô>âDê‚+C©y“ÓÖ¸¤ ¡äuŒ‹m…ðÊ.™šÔÿþ4ˆµXàzˆœÇ´Ìw@Ã÷|ì#Ò:&Ý Êå,ž]ÉtÇXЦPµRe!ê«¡~  ™Ê¯½ò9Ĥô|A¬[åtxq_ù¤ž^Tm+¿dWÅ Øcx]ŽY³fÍ›„q§qß«[‹ Ôʇ SšTGV«zU^è‰òEâ›etFíEQ3Dá¡à×Åz¢ô¸GwˈÆÜº(ŸŸL~=¡_¼˜ÀH&lÝ-Œ¬»u—Î3 ”b\w‰d`Ý­»¤p³„µ¦“Â]’ˆhšÊ?Á4+ #s,Ó@»§M›fØ…ã—g “eÏG¢Å_$-Xgåó+x9ØoMæ˜Þ"cËkQÞ€éÇL ëì&\Ëæ‘¶rÄIDAT܃|k¥Y{IæÖE„µqƒïèN†ðïÐÏWœ°çü£^ÎÃ3æö—ÛþÈçWÒ’¹ yøý©°Ð®à ™ðu»b6×mq3Ü{K £ÞI³çŒ¤Y…{ÅÍ(€·DÒì9£iVá^q3 à-‘4{Î(@šU¸WÜŒxK$Íž3 fî7£ÞI³çŒ¤Y…{ÅÍ(€·DÒì9£iVá^q3 à-‘4{Î(@šU¸WÜŒxK$Ížÿ•;ÐÇR¸ÂIEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/ok.png000066400000000000000000000016101222453003200222700ustar00rootroot00000000000000‰PNG  IHDRóÿasBIT|dˆ pHYs  ÒÝ~ütEXtCreation Time9/4/04y^£Õ%tEXtSoftwareMacromedia Fireworks MX 2004‡v¬ÏÙIDATxœ•’]ˆT†ŸsfÎü¸óë:³®«±Žšk]ÔEQ&’Ð`îE*áA(f´t]FEÝÅÆân‰NS¨íZíºã쬻;sæÌ9s~gæë¢viË‹z?¾›¾ç{/^D„ÿ²Œ ÜÉWD„¿kïèý9 ªºßïtvÜKw¶L¬¸oUSfèÊ🇫/œß6´yý=ß<3x0×ÝH£]§â–¹e—ù¼t–¹©Ó2½} ùÖy–ö*Àž¯·=x÷Cã/ny-v¡ý×­"†íÐhÙ8¶× üPþžùŸ–°mowsÀ—a‘ðò÷LfÝèó›Ä¾ N(Š¢°<Ó7æ˜TÊ„Qd=0©œ @[xüÓÂ+OlÙ—ÿÂxº£c:^Ð&è´ùñb™—ú1úä–ßB‰‡!®nÒ®‡ö¨]UَĨ´*4m‡¦íÐr=fgêìŽ?Å‘Gr©1N¤–BKF®ìÒÝö»5‰é8LOù ø[iÝ{ƒ›%“s‡NÒô ÎL ¢Ä鉦°4—N`<°’ÀsÛ‰ŠUÁ²=¢>Þ{–üo;9þÈ›dâ>™þˆ[V•llÉHµB„镞ݩÜnÕüŽJ56ƒá48ñìiñ¹´4Á»¿œ¢Í] ¦ TÍyÜš Tß’oëzƒlh=ѵ+¥lÏ2ëÞäää;Ü—ÝÎPß.Z’¥Å¦nðåJßÎí\›ë½²}×6$6áw}ÔNU ‘Ô’4=‹Ë3—)^(¢ëúùP^]I0óúbqi¾öÁÔÕ_©Y:­—\O¹ž>R‘4Usž‰k”.–0F áåþ¬ªrþxöýl&{¸oc?©TЛ ª³s,,,â8Θˆ<'#bÜ~Y},±&q(Ž>ÝévÓ¶k®çާeD¾ãúàÿê{˜Àk¿ØbIEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/s_case.png000066400000000000000000000020421222453003200231140ustar00rootroot00000000000000‰PNG  IHDRH-ÑtEXtSoftwareAdobe ImageReadyqÉe< iTXtXML:com.adobe.xmp îß`˜IDATxÚbüÿÿ?9€‰L@¶FGGG;ˆÓ€ØÊßÄé@|Ÿ « Š¡x rj9Ÿ…Ú«¡b0ƒßñ( Ö2U ê4lä…™PCA."6p\ †®Fwê{¨ß\ȉP@CÆP¼‰ˆ(Ý µ¹°èè„:»‘BÙ•qè$9€©ú!퀚qIEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/s_close.png000066400000000000000000000020301222453003200233030ustar00rootroot00000000000000‰PNG  IHDRH-ÑtEXtSoftwareAdobe ImageReadyqÉe< iTXtXML:com.adobe.xmp ‚ŽIDATxÚbüÿÿ?9€‰L@¶FdŽ££cš Ä@Ü †‰¥ïß¿V@’0â > Ä÷ ìYPÌ€K#¤C5ƒlyÕœŽ×©H ˆÏ± ›8.PM J0p @ É_ HþÝCHã*4Áükõ3V§v@¦£ùWª‡N’0óž »÷Ý98IEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/s_multi.png000066400000000000000000000017671222453003200233500ustar00rootroot00000000000000‰PNG  IHDRH-ÑtEXtSoftwareAdobe ImageReadyqÉe< iTXtXML:com.adobe.xmp Ë5mIDATxÚbtpp` 01 `倸?‘¤–ªñ3’b#ãÿÿÿAì™D¨YÐ Ä¿XÏ’b#²ÆYäjœÄÌÔ_âéè/ÐÅ©È à ø{UÃn£ ]’8 „¨$FÙûzIEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/s_regex.png000066400000000000000000000021661222453003200233220ustar00rootroot00000000000000‰PNG  IHDRH-ÑtEXtSoftwareAdobe ImageReadyqÉe<diTXtXML:com.adobe.xmp ̲k¨IDATxÚbüÿÿ?9€‰L@¶FÃÑÑ]î qwÂ÷ïßOÐÆ{h4N§*ñ] .‡òÏ"ÑÆ@¼ ŠQ ¡PÍ@œÕðÊ…ªyM#Ì‚PÚʾ‡$7 ›FdÍ çº@mÑ®È¶á œr¨óVq:Ôæ3H.Áª1 ª æ,{ ~ß5‘ BmÙK‡†f²BFº§U€ön&×?£ŽIEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/s_replace.png000066400000000000000000000024431222453003200236210ustar00rootroot00000000000000‰PNG  IHDRH-ÑtEXtSoftwareAdobe ImageReadyqÉe<diTXtXML:com.adobe.xmp USØfUIDATxÚbüÿÿ?9€ÆpttLR3¡Ü³@ìºÿþ÷¸42!±g1# ±‡â³Yc9ƒÜýˆ¡˜héP[ïôcxxƒ’’¢€ÐîOŸ>ÍüóçÏLd@¿»©ÝP]]]˜Ž=ª¤¤”ËÂÂ. ÀÀÇÇÇ   €×F¦+W®h5ب©©}”••eøðáÛÓ§O:¤‚W£ººú•_¿~]¿uë–îãÇnß¾Szùò•I¼¼¼¯ÐÔþ‡âÝ`ÜÜÜ ¢¢¢‡nܸ™ùìÙ³m@?Š]¼x1wÇŽûÐ4‚ü¨ ÄÆ@œÆ´AZZú˜  à#`àØ|üøÉ¤êû÷ïbX\xš8ÁÑñ÷ï_ ÍO€Î[ÁÈÈøCEEe——§ÆPüžä@i¢úúzÝ@ƒ>bIÃÿ‘RØ,Fr9@€"z’0˜ÒIEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/s_word.png000066400000000000000000000020241222453003200231540ustar00rootroot00000000000000‰PNG  IHDRH-ÑtEXtSoftwareAdobe ImageReadyqÉe< iTXtXML:com.adobe.xmp ™-XŠIDATxÚbüÿÿ?9€‰L@¶FGGGA ýÊ? Ä&èŠöïßÏT×d–C…Âm æ €š@T ÁmÄf:ðj˜N…>½øl¥ˆ™@ìe§ACÄ–Ãj#Ô6F$!dv' b³qŸÁæ>hHw Å7#ÝÓ*@€S¿"<÷ÌûIEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/save.png000066400000000000000000000011011222453003200226100ustar00rootroot00000000000000‰PNG  IHDRVÎŽWsRGB®ÎébKGD@@@§ö/f pHYs  šœtIMEØ !ºþ|&ÁIDAT8ËÍ“;kTQ…¿I®Þ1 þñX$e I›Ú+Ø{ m,m|¢`£XYk;b@­´ÐX‚B@2áž3g¯óˆÅ8‡y€]vµ8l¾³Ö‚ ‡mZ}±ñÊí¤Tˆ± e¤„YÆ,ã@K )cáî½S-€ªJ©0?¿Àö¶±~­žøs×/½á8{Cï3}!åÞb·;ÒøH#ñåë9ëÿA®p1²ºr}<(„€÷~*¤ñ¢‘!s™¥±ŽF £9ïÈ%NŽffS!]K8 çýP´jà(S ¬­-rùÊ>Fœz1\ì¹h$œÄù“'6­ú7Z ÁÙ3‹ììBHÂÌôîÞ.ÁŒ 0ÞQ ïÁûDÓˆ×ïouU×G8Ö®1;M°0$e¼‡NGxß+üåó;,-¯òøÉSŽV³}xKÉçÐ~!¥D…FvýêÇ fÍ‹Nç'9‹œ#¹ÄÎ"gåÈE”œx·u¿Å¡œ?¹•ˆµøqz¿IEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/search.png000066400000000000000000000026611222453003200231330ustar00rootroot00000000000000‰PNG  IHDRVÎŽWtEXtSoftwareAdobe ImageReadyqÉe< iTXtXML:com.adobe.xmp âm¬'IDATxÚ¬ÔMoAðÿ,»åe—Š,T’‚=x¨¤ŠM»ISô¦Ñ«o~ú1<éÝ# ‰‰4Am ’¨¥Û ­Ø–À²/À¸ÐЈÊÚhç²ÉÌìoÿ³yž!”RœÄ CèývéêûŸhµZ…¢ ÔÁãA(è…/!Ã=sç§ÁØ}¥l¼ÍAÑYpü¼0Úà‘•÷‘ÿ˜9 ;qB£k/Ò˜—V †Àrœ.'„I7êŠ7¯³Ø´° ±ÙA²±‰R©bs—LÃ+xÀ±, ÝD£Þ™à/¡|Ð@}¯Dm!Y–™ÛJÁ² X<;fµïmD7übåJ¶ªi¼¼•¤0‡sˆimÓ{ðZëí¶fÿ:†³ñÂ/ =ë-jK‡ih 0íI’„tzmp$‡•èçdœ5§6›Ð[ Nñ.{èœèÃËõulÉy "dˆuº&ö¾î¢R.BÅñùåÕÓÁäNï4’É$¤•¬&®&Q«)( ØÞú€[7oÀå ‘~Aþž=¢bHD—0È•T$—-~F&“®ëðûýˆÇãXX¾>RÙ#Pîñz6€c‚Ae· ÍtãâÝûäo}6Ò"ïž<¤Á)]£‰¹ˆƒâ7ˆ³Ò±›ö2Ã1¨VM6 (+_½ðü29.tTGj—Åó*"º‚+wî!º” ÿtœØ}ô¿ã‡¥©ãš[ì«·IEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/start.png000066400000000000000000000206201222453003200230160ustar00rootroot00000000000000‰PNG  IHDR ®±Å]+tEXtCreation TimeDi 10 Nov 2009 15:16:06 +0100Uk4-tIMEÙ pñ pHYs  ÒÝ~ügAMA± üa èIDATxÚí] xÕõ?y“ <ò$(ˆ@ÀPJ%JAT¬¶”GÑj«†BñoQZµ@¿’U0©Xø †D ÈȉAIx’ „­[«Ã«µl:§{n¶—€ ü@whÝ:> ÉCÉãÄž!Ã.$ŸN>ö“öÜháóч]Žb §?ÚºÉÖ kw©Ö-Ñ᳸N†éØ-ÖnP" ü|pµèÖ®WPA†@”·«CMœ!ìIÿ % ˆ¨|:Ôçšÿh.ÏwtÃC‡{ƒR°XþÁ\‚¡:ùt¸ Y_0ýÁTÂò½@úð«Ã½€}Ñ]þ©´Ãô‰GÈ7qâDÚ¶m›Öá2èäÉ“eñú‘#GhðàÁZWÓá6P›6mÜU†àÛ¨1¬ß”€ã<ÕÈÊÊJ*//§¸¸8 òT±ª¢´´”êêêHi&©¾¾^´3""‚Ú¶m«u•Ui“J×ã¦ëé:tˆ<]¬*2díڵˮ{'MšD+W®ÔºÊª¶ÉE€k‚€²‚u»]´î7  î‰1^&à@­k¤ã¦F^Á9™€úî:<.øC' ­ 8'P<ÐáitÁ:uh]êÐ]ð‡ìÔD>|8…„„ÿH‘‘‘ÂAݽ{wúÙÏ~FC‡õ¸÷ôéÓ”‘‘A{÷îÎY8”Íñã?Ú߯©oß¾M~ÃŒC‹-(&&†n¿ýv1c2zôh u[»0°iÓ&ÊÊÊ¢ï¾ûŽ®]»Öäú‰nßÍ]ÄŸðzKÆ< 1ñ𥠠 ‰_ ÜðÆÄ/Dš0a‚ôå—_J n¯Û®]»¤V­Z‰²Q—àà`‹uEBÝ.]ºd5¯¯¿þÚê³È×¼­Ýºu“Ž9¢z›***¤×_]jß¾½±,þØj“ÊІ€uuuRuuu³TUU%•••‰—°víZé¹çž“:uêd$ÃäÉ“%–Hn«Î’J¼œ¿üå/K9‰¥„ź"ÕÔÔØÌÓڳȷ¼¼\:vì˜ôÉ'ŸH'NmìÙ³§ÄWµölÙ²Eºå–[DFDDH3f̶mÛ&]¼xÑé6©mè®_¿.­[·NêÑ£‡èÄÎ;K‡rKY(ã'?ù‰&mE¹(Ät ø³Ï>+HjÚ´iÒ¹sç4i—¼Ÿ€2СˆèPÖ¥­[·ª^¾þ°°0ArO£¨¨H —\–€gΜ‘X6~°;vìðx{ì„ïPƲeË„þÄ ¼[Hý$‡Ôõ$yäA˜7ÞxÃ¥|rrr¤ÄÄD‘ט1c„JãÅð=«W¯$lÙ²¥Ä–ªªyïÛ·OClJl {¤=sçΤ‡þ Iï,vîÜ)EEE‰¼RSS…úâåðMË—/ºMll¬tòäIUó~õÕW…éß¿¿Ð ݉ùóç Â`è=qâ„Óùdff #}²dÉ·ÖYEø.W^yE¼¼äädéêÕ«ªå É×H8~üx·Õ®ÔQ^^žÓù@J‚QaåÊ•n«¯àÛà¾Q&Mš¤šû€ä“­Ò9sæ¨^ïE‹ òEGGKß~û­Óù|ñÅBò|PM| ¾O@åÎ;ïDïNM@ìØ±£ ÊŠ+TË7--Mä Ç0Œg}µuëÖBgýðÃUm»‡àû B’@ÿùôÓOUÍûàÁƒBÂ`†ÒÆU¼õÖ[‚|mÛ¶•>ìt>pÖ·k×N´ù½÷ÞSµÍ„9@L£©=…™ Yb?~Üé|Þ}÷]AXªp:Ÿ~øAŠuZ¼x±ªmõ0ü‡€^0^Ê­·Þªú”Ý‚ Ä0Lc9Š÷ß_C&†Ng's×®]E]æÍ›§zzþE@àé§Ÿ/gذaRmm­jùb^uÊ”)"ïáÇ;”÷| Èé¼gϧ뀪W¯^¢¿ûÝïÜÚ‚ÿÄ2dˆxI˜ºS3‚“õƒycR߬ZµJ pšÃQì,0?<`ÀQö/ùK·÷£‡àJJJ¤.]ºˆ—•žž®jÞB›²GÿZ³fpÀˆùüóÏ.QBC‡í7nœˆ&òø'Äâ!h† büÔD~~¾0$ Ù6mÚdñžÿüç?"¾ÙÙÙN—…‰±cÇ òÝwß}B ûü—€À¿ÿýoãt]aa¡ªyƒTnÐëÌ}yëׯÄÇì¦È\†í»ï¾[JIIQu¶ÇKàß`)Ê1~jÏë.]ºTä€O„Sˆ º6oÞlñ¹BëNŸ–ª”ª¶o—*·l‘*ù¹ÊÏ>“®íÞ-Õ~ÿ½TÏî)| °À·gsy7šë§OÓ…'ŸToÅ@p0¶jEÁ;SèOJ-FޤàØX§²?~6U©ì·¿¥R&¾«äŠŠèÒsÏQɘ1ÔpåŠÛºÙÓð6¢¡´”JÆŽ¥º‚‡žÃH …Ë—;ô\Ý×_Sí¡CŠ÷´æ!Ë׬Y#†xö”)T±ÔŽC¦¸^âƒíÛ¹:+‹Jy„¤z§)÷*xž€Í]Ž ¡¬Œ.±îå(ªwì ë?ü`ù¢ÂF™,m¡3ëØùUÜÿÁTÅ’Ð*X—k=o%°Úr «._¦NååËzbäÌ™6ÉXÍÒÜž:ù<ª†²¢¿¿ÕëÕ|íÚÆtõ­·Hª¬T. “ÈÃRPLŒÝu,eÝ¥Š Khõ t• ‹ÄCxâ™3VS`è=Ûµ+ÕŸ=kùþØ¢¹lXÈÀ6¿@W~¸¶};•òuÉláx“æ'&RǤ€Æ…ýöè€!IIÔÚ‰×Á\ÏC‡ºœzC57 \ÜÿJ©hà@»òª>p@* ·™_•>¶ëÅÅRAX˜Å| [¶”êËË¥S±±V˺²l™]åÀ­¢Tçs÷ÞÛdzpÿþýƘ¾ÿþ÷¿ÆßËÓÒl·?+«IŸÙºÿüý÷«ñªÕ„wê€a?ý)EÚáRhà¡Ë^TüóŸ,&,â-\,Ý"Ý&Ÿ·aŒÈ¨eQ Á]ºkÈËË£1lTT°eþÎ;ïK]F$[»íÚ ë:"$^p¯^:p µ1‚¡*HH_מ vÏ=tõÍ7ï lßÞ®¼„ñ‘aýüä¸Lð7¿ÔŠôt‹÷À©=|˜Âú÷W.«¢BñzÍÿþG¬æææRŸ>}hO›¹zÃéã©Sjfý^)lI~¡6È £zçNºÎ:ªµ|ÂY -î½—6B²FNSØÒI¯Ÿ8A¥OÑF­+` 5{ö(^üÕ¯(ÈÎ]³”ˆÓbøp ŒŠ¢ÚÚZ!mÂÇZ?, ’-Û.ìî»mÖçÚúõt–­æÒ§ž¢Š>¢:¶Ì!¥oFx%kXR"Mp÷îµ`]yÕ—–R¿pk‡ßõ÷Èÿ·éêUª´1Ò·/…¦¤Ø¬†ê*&_“°ˆÛs&.ŽŠÙò½üÆtí‹/¨Áô;{àY7 +Ðñ{÷Z½^óÍ7 señb6;-{ûÃXbuøðC ¶ó|‘+iitiÖ,˃ƒ ®œèhºÂåá@™@–„gxµæ 0€âöï7ÛÁÐyÖaɱØbð`!‘#Æ£àDå-íqÃuì(æÔ]Aä¯M-~þs—ò0‡ç‚ñÒ,mÀ¯þõëÖŸc=-âá‡)rút g Ð^`X+JJ¢ëùù–³e/îóÏ›ý^:iU­[g5ßx6FBûõ#%T}ö]À¬ˆ-¦= ^ë矧ˆ°x‹§æ‚Û/_N‘S§ª•‡ç‚Av¸BÌ“òÁõ·¿QâÙ³½v­Cäjvï¶J>ÀÚp«4 Wí0F"F’2ô®»\ï7DÓdgS)KÃsƒQíwß¹ž§—À+u@й.Ï›'æ>/ÿùÏTýå—)ëW•¦«Xª`h³a+„>Uþë_6 ´woŠã:w`i õC Ô²qIWµi“*ùi ¯& KÈš;©|þ|*f½êl·ntåÝwIR²õeeÂÚ´L šëUˆ˜Yµj¶iCá÷ÝgõYè§Ö¦ôÌÀDoÉtßøÜ\jýòËܧK]"UU 5¡Ú†§ÀàQ0¨sgjý ¯aµ%ÞõãÇ©šõ²†’żÂXŽÞ°‚0[`W–,¡K/¾hõy ímfÏ6þ'6Œ~ÎùnÞ¼™*V¬ ²iÓ¬>¡5ÞÁ°0c[¹ÏëÏþI¸›jXJÖ9bÐ…@ðwP·ßRSö耡ü·w1ˆ!(>Þn÷—ð¬bË 6Eù‚tùOú5„1ab³²,hž…ñ‘—gõÙ&zH·nâß*ÇC} “;÷?Gñ… t†;[É8ŠÏÉ¡Ð;ïtµë„n\Ï$=\F0€lͨÈ =d[Ü?Åffº^_õཀྵm^z‰ZÏ™£xO KʪO>iö{5Œò…$'Sðm·ÿ ÒLøålá|@P‡fã°é«*„D}Ël“è"«ˆéðÁÔ±°"ŸyƮ篱´öexí\0€ðû+‹)NË!È å£6ýÍ–•Êù]úÃl–/ÙX·c¤-å˜2s={ö¤Ù¬ <ÂzâôéÓiÙ²eB­h÷ˆùbk!b2°Ä—áÕ"#…5l æÑʘcUòáuß|#’«ÊË…1ç,ÐP]-êÚÀ¿›&-ø; "‚Z1ÉLé‹Hê””Jç§«1XèGwÔk¯ ]TRÁ·õ‘x;¼ž€¶:X¼`ÖÓ£ˆ!•<ùRàl9eŠ )I¬€-„´6lÅIPXµ"0¡W¯^"B&?¾Þ½©VAo´b„ù ¼V„Ã׆e(•LBØí‰XQ G–Y’!„L KÈŠU«,^»ƒ-ZHB…ÐC±’ÿÆ%„²>ëËðZÖìßO—LÜ$ÖÂ/NF5ÈÀJ½§!¯Ïg+³7J€?óú©S¯Aêýƒu¿¥K—Š•|ŠkXnÅ™î+ðè,ÙXYËäR}mÓ&CÔI]Í<ÃMÖVØ’~®lY¶–€e  çÏ[½Žª(6–°>rÆ ºš–fõÞ† ¨xøpŠ^¿žB-8¤gbQú‚¥*"e”¿^ ;"odÔåçÓÅçŸw¸ý–ÐzÖ, ¾å—óñ…é–*E¹\D³ <ÿLb¢âä+îüv6¬JK¸ÌÆ@ù+¯(ÞÓ~åJ£ˆ˜"ÖÛŠ‹•3eÕ¡% :az!BìAø+ØV ¹çç1Í'Gh{ra:wà€X:á"¼×h»êÔîÝwù€ŠÕ«mFž äÞØóœ¼€=¨}{ê=ÏÖ:_ *—/§¶Ï&$Ði–žg¸-Å,¡aÈ(’mûm›Ë|¾I@~¹mùDNžlüÉæðGa W¦éÙ“BØ2UB-¦Ó߈ÚiEPŽ„ÓÛ±àI ,ŒÚ1q[yhw÷È_~è A»kµ~öYãÏ5_}esû D¾عû@óbl†h¦A$[²±;wRˆ¸AG€øÅxúZ5úýê!6 T‰Ï¬ßÅÆ–"rBB›°STÈ­·6»ý*V¼Ù(Û)>ÏÃpù_ÿªx|Q Šm „xÖͪ·o§Ê5kèZv65œ9ãP¹Ü~„‡EN™¢lp¨Ùÿ„jFâôTqsGÂa °U†9P®8AÌB8ñ‚p´}MM %''ÛݬTŽˆ‚9{VpÅÀÇãIx`ñ³„†+ë°~NhlO‡üðì>¶Æ·nÝJóçÏožw}½G× ðGæÈ;²–ßmP‰ý“qÒ9’«;ŠâHœ·;sæL»7ˆT«ls`Ÿhœ‰®á0E?ÿí:uêTñ’p`ó•+WœÎçòåËâ0lFþâ‹/ÚýŽIEùØVWíýœ Ä1²ØvÛûü‹€/½ô’xù·ß~»T\\ìt> ÎA^>ú¨CÏBRŽ9R<;}útU‰°á:¶Æ±®õå%ð¾ùæ›Æsw1: œ¸ùÄOáhg¤NRÂQÈãí·ßV½­"o¨çÏŸW=Â?øñNjݥڴiãÒé“V³gÏ/·OŸ>Ò¥K—œÎ+77Wìz…ô]9#ÄZ=ŸþyQÏ{î¹Ç—nð}nÛ¶MìH#vìØát>x©¢x©:uGµºŠ 6}­C‡.IeK€±%õÐ{}¾MÀC‡÷Ö[·nKyá`Ǩºr€´9p†1HÒ·o_Õ-c õÐw¡zà b„ïG–ÆÅʼn—‹S2]ƒERãL`sȧºão5OuäS›0Ô»z(ŽðMBñ–•üW^yÅ%Kº¤¤èÚµkÝR_ÓSÝ_{í5Õóÿì³ÏDýÑŽ£Gº¥ n‚ï§Föïß_¼L8ˆ]!Ÿ|¨¡'†0è€Ð1ÌC7T88QvA•••¹µ-*·ˆƒûp`:züøñ.iê¯{æ™g|X$Œ<çÎ#Ö©ººšLÖÖ0ñ¨ÔÆÞ4.Cò D¸º/d§T#ŒË[€hpr³ô½u|:ü :uh €:4…N@šB' M¡P‡¦Ð ¨CSxÔ‘‘a<Ú—PgÇVÁ2°Ó}°“ÛÀyJl—¦<ÒS˜GÄŒ^d±­­k½¨¨¥³Žk¸óÚþ´IépnWá‘`:¬À‡÷ˆÖáÐ ¨CSèÔ¡)têÐ:uh €:4…N@šB' M¡P‡¦Ð ¨CSxó(#`e»yñ•ëõÀõš¥zE ù˜$õË@1œ·Yû,ýæax}½iº$ÑâÑnÈ;•²J$à Œ,¢‘1”‘§võ§Snz\˜M¾•RöŠ”š5—ÜÒ$;áÝ_h£dhòFÌ¥wæ,YràZåY}öÆý†ëf $›fY”D¦eÚS†‰d›•MyÙ³,ÜcÑÉ4*•(¿¨ÔFà’…6”Þ¨¿yÛzOÏ¥ô´‘´?æm¤‘”Esµdy5ùîMi\·Ì7#É©0ƒ’ägY¢¤6yĈ¡ÌQ%yO%Ê‘ßKˆDs’h¡Âðd«Œ$ÊÏj,cj!%L£ÔÎ1¶«^šC™i©4*9Z¹˜h+f¤Sn“6ðý1#©gn£4Ííi"ñ–â¹é”Æíšµ"Ÿ²æŽ méGÞ°9Q®”N©AÊw¥“”j¼Éü™)+U¾Þ<¿&Ïæ¦K<îHÍ‹SÊÓüºãe4­¿y¹¦[aXï‹&y”dI©æ÷6+×RßÚEéênì$¼YR“á'i†:Y–åõL°ã˦„žî.C†‰(Í%Zh2ü[ëƒè´¸deÆà«r¹<ÄÆ‡à$–ÓiThØ\š½‡ÞT3‰­¼—€èø$jb$V ÕÉ6¬Ê/"w~®•Mɬ¦eæP©­> ù÷’¬|Jb=S|1é¹ò¨fLÓ{;•6Ž$zÓ\ƒ3Vd»µì×P|ͩɠ5åÑÞ&0†:§¦Q¦¬»A¡N³3ãÞ)7ñƼ³ÕöC4–Ó(bJÙ±_‚—RN&ë‹£’‰”ú /»¹~Šr›H66¶2n,/z©Áê1—MÓ~Ð^B@VþcL}aT2bªá%Šÿï¥ÎüÅÞ@4˜kpWˆûYQ/ir] p§äROùÙ¶:’ÕVÅQF eå'‰2Ò\Ü´ý îžh¥>è@…ÏÄ©ƒ‚Ëeƒ(?éF^…)CÃð¤ÓT£ÕË}8‰\>@_âÀísƒX:ŒÐׄ¸M‡>ƒŠ »Vt˜B' [ÀÃ[Já k4)Ÿ­ÜÅšÎ8x+ô!X‡–Ї`ÚB' MácT ]Ò6¬K4 ˜0 h¶êhúœi…ÂǘN[üyÞð‚b:§6ýÈÛKð‹ ù·’BJKeÃíèΰ/ïƒLÀ3ZWÄ9ô¦‡³R)­ÐÂ.N aIj†8ɈNE©i…$×DÌä&¿åí!f8¢ë Krƒï3®ZF´RX’ê!N&ˆé,ôÀ“x@94+§Ð$"ÚM¡f>†&Я¨–TªrˆS=0Ÿ23MôÒÆ!;3ÿÆ\°r¨Y“ ›Å"ªkLn,‡1wíøŒë¦ÈܧumÔ…õ°$5Cœš„I£4£®g¨KJ:ÿF7Ü/Šu0oIJz£lP üש‘sò\0p’S­k¦ã¦ÀœîÅ?LÑ›µ®•Ž›F®™pƒÖµÒqÓÀÈ5Ó!§,_à©uítø5~àÔ]þ©¬!}Öá~¬3ý©îät<|‚’Ž›œºq2žVd ó §´®¥¿ÅßÉ„|€¹bÉ0N뺠5ÉH¿Ó-Å‚¡׺¶:ü"3ò–$ ‹¸€SœÖµÖáÈáÔÏÒkÑ`ê“d˜2Ñ¡ÃÀðxÒÚE¥ü휞Ӻö:|`YŸÆ¶µ&d§¥Z·B‡Ïzߥ¬é€¦â”Éé>­[£Ã§°’Ó¯mÝd6dŸ¹CëVéð ìæ4”S½­í]–YÎi §mZ·L‡×-m’pd]0H8ŠtP‡u@ç{Š,øû¬ÁÞ!Ø39½Cúœ±dWËFGt–€Àp2ˆ[ÝY}sÓ¶ÉGà0\Ùš~Â.œæ“á Ðqs±£ðÃ0uŠ|€+Ð`XH1¬Ëþj2¨_¯“Á.p jPâ çrKz4¿¡ô4'ÔÊTmÊ@0à NãÈ@Æ.îïnÀQ2‘òðÛåZqî" 9°J„ìÂ)ÑìoÚóµˆÕ+hLø7 8“U“tÖà)êÐaÿË„Eš:]IEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/stop.png000066400000000000000000000006171222453003200226520ustar00rootroot00000000000000‰PNG  IHDRVÎŽWsRGB®ÎébKGD@@@§ö/f pHYs  šœtIMEØ #(ÉþR¦IDAT8ËÝÔ±nÂ@ €áÿB‡V ,ÍZõ*ÚWè V}žVˆ"E’[ˆr>»iÕ"È-Lõrò Ÿ|¶|.Ïsn7Š›Aw¿“âåÕêÝžºªp«5‡²$˜¡€‚ '(Ž÷ǹ»Õ»=ó·3!o=â=±m‘áN¼gº)XÛëÕUÅÌ{ŽŸDËPT"1¢)ª ÷øç'ä úÓ#·Z#MsùÎMѾGÆš}(Kbë“HÖ‡q(˜!Þ'‘¬ëÆ!bÛ&‘¬ëÐ1Hà4¥29v³ëS iTuAÁÒ¥B‡¦›"‰ÄQ&ן¦8–Å)¶?« Âٰ"'ä¼Ùîÿ~#_Ô·N>cÒÆIEND®B`‚basex-7.7.2/basex-core/src/main/resources/img/warn.png000066400000000000000000000013571222453003200226360ustar00rootroot00000000000000‰PNG  IHDRóÿasRGB®ÎébKGDÿÿÿ ½§“ pHYs  šœtIMEØ 5 öTçoIDAT8Ë‘ÍKTa‡Ÿ÷½wæ:ã8cŒ©:PY6`YR¹S‰ŠÒrÑ'AÔ&"û Rú‚v¶ ÚDà.\´hSˆBI™_c áÂ&¥¼ã|ÜûÞy[(E¨ÔYþ8ç9Ïáˆx<Îz5;k¶‚<ÐÜ|¼7™ì/°A‘HdM85ÉNWé!ŸÏj, dÛÞ¶¿TîÈÒz¹^˜ËÐ# [iiš©Û\–~ôßÉQj\—'%aBf°L—匨?Ùïæß§þiÍp?0Ð<ìµqT˜sF$’¾÷Oƒéwlqò<-‰hj)0ùqÛ·)v×ÙØ?ħÉcÏ]gdqCƒLšÛËSQ-!(TDÀs¾}ÂWÊwoxÂô UÚåJQÈ‚¬CãADmœÝuiК²R—¶Öä…hùÅøº€e›n¿)…T 2š†½ŠXµ‹ß,-¡}Å\:=f!¸µðå •x\ „,Ⱥ‡úz—Ò’qp¼B>*K³œ:2Ý-ïŠýHÛÜ-2 Ó48ð ¦2Ç¡ýß (à‡ ÁR:ÛÆ‚ÒP7a~8Ëex. ‘ËAAƒ ¯‡}|þê±/¡àxˆH˜÷“…Öž™ï‡ŸåìÑ%¹lsÝoH! Þïíh¸vǤ¯¯¡U+™¤Ñþg[&‚:oÞ0]‡6ŸÐ(Û!@ƒ”š 'ד¨C¹€ ˆ ±MŠÄÖÔå¹PWé¹¼ú–Öµ:¥ÿúïÅ£‹Hù˜ÅyXЬh†T8^ˆ¹T8\й"³cGG‡ÖâŒXízuF€øhì¬%Ð…)-yð ÷ûæ? ;IEND®B`‚basex-7.7.2/basex-core/src/main/resources/lang/000077500000000000000000000000001222453003200213205ustar00rootroot00000000000000basex-7.7.2/basex-core/src/main/resources/lang/Dutch.lang000066400000000000000000000643611222453003200232440ustar00rootroot00000000000000# LANGUAGE FILE, TRANSLATED BY # Huib Verweij OFF = UIT ON = AAN about_% = Over % access_denied = Toegang geweigerd. add = Toevoegen add_raw_files = Add remaining files as raw files add_resources = Add Resources adjust_nodes = Pas nodes aan tekst aan admin_static_% = Admin gebruiker kan niet gewijzigd worden. algorithm = Algoritme all = Alles alter_pw = Verander wachtwoord and_others = en anderen are_you_sure = Weet je het zeker? attribute = Attribuut attribute_index = Attribuut index attributes = Attributen backup = Backup backup_dropped_% = Backup bestanden '%' zijn verwijderd. backup_not_found_% = Geen backup gevonden voor '%'. backups = Backups backups_% = % backup(s) binaries = Binaries blue = Blauw bold = Vet browse = Bladeren buttons = Knoppen bye1 = Prettige dag. bye2 = Later. bye3 = Veel plezier. bye4 = Geniet van je leven. cancel = Annuleer case_sensitivity = Hoofdlettergevoeligheid check_for_updates = Controleer op updates. chief_architect = Hoofd ontwikkelaar children_text_len = children/tekst lengte choose_dir = Kies directory choose_font = Kies font chop_ws = Verwijder whitespaces chopped = Afgekapt clear = Clear close = Sluit close_file_% = Bewaar wijzigingen in %? color_schema = Kleurenschema colors = Kleuren command = Commando command_canceled = Commando is geannuleerd. comment = Commentaar community = Gemeenschap compiling = Compileren connect = Verbind connection_error = Communicatie met de server mislukt. copy = Kopieer copy_db = Kopieer database copy_path = Kopieer pad create = Maak create_database = Maak database create_stats = Statistieken maken creating_db = Bezig de database te maken creating_indexes = Bezig de indexen te maken cut = Knip database = Database database_path = Database pad (databases moeten handmatig verplaatst worden) databases = Databases databases_% = % database(s) db_backup_% = Backup voor '%' gemaakt in %. db_closed_% = Database '%' is gesloten. db_copied_% = Kopie van '%' gemaakt in %. db_corrupt = Waarschuwing: de database kan beschadigd zijn! db_created_%_% = Database '%' gemaakt in %. db_dropped_% = Database '%' is verwijderd. db_exists_% = Database bestaat '%' al. db_exported_% = Database '%' geexporteerd in %. db_flushed_% = Database '%' geflushed in %. db_not_backup_% = Backup van database '%' kon niet gemaakt worden. db_not_copied_% = Kopie van '%' kon niet gemaakt worden. db_not_dropped_% = Database '%' kon niet verwijderd worden. db_not_found_% = Database '%' is niet gevonden. db_not_renamed_% = Database '%' kon niet hernoemd worden. db_not_restored_% = '%' kon niet teruggezet worden. db_opened_% = Database '%' geopend in %. db_optimized_% = Database '%' geoptimaliseerd in %. db_pinned_% = Database '%' is momenteel door een andere proces geopend. db_props = Database eigenschappen db_renamed_% = Database '%' is hernoemd naar '%'. db_restored_% = '%' teruggezet in %. db_updated_% = Database '%' wordt bijgewerkt, of het bijwerken was niet afgerond. delete = Verwijder delete_all = Verwijder alles delete_nodes = Wil je echt verwijderen? delete_packages_% = % package(s) zullen verwijderd worden. diacritics = Diakritische tekens dir_not_empty = Directory is niet leeg. disconnect = Verbreek verbinding document = Document documents = Documenten drop = Verwijder drop_backups_% = % backup(s) zullen verwijderd worden. dropping_db_% = % database(s) zullen verwijderd worden. edit = Wijzig edit_% = Edit % edit_data = Wijzig data editor = Editor element = Element elements = Elementen empty_db = Een lege database wordt gemaakt. encoding = Encoding enter_db_name = Geef de database een naam. entries_% = % entries error = Fout evaluating = Evalueren event_created_% = Event '%' is gecreeerd. event_dropped_% = Event '%' is verwijderd. event_exists_% = Event '%' bestaat al. event_not_watched_% = Event '%' werd niet bekeken. event_unknown_% = Event '%' is onbekend. event_watched_% = Event '%' wordt al bekeken. events_% = % event(s) exec_error_% = Kon % niet uitvoeren exit = Stop expecting_cmd = Commando verwacht. explorer = Verkenner export = Exporteer file = bestand file_exists_% = % bestaat al.\nWil je het vervangen? file_not_deleted_% = Bestand '%' kon niet verwijderd worden. file_not_opened = Bestand kon niet geopend worden. file_not_saved = Bestand kon niet opgeslagen worden. file_not_stored_% = Bestand '%' kon niet opgeslagen worden. file_or_dir = Input bestand of directory file_patterns = Bestands patronen (gescheiden door komma's) files_replace_% = Bestanden in % worden vervangen.\nWil je doorgaan? filter = Filter filter_selected = Filter geselecteerde finishing = Afronden first_line_header = Schakel deze optie in om een header te gebruiken folder = Directory fonts = Fonts fullscreen = Volledig scherm fulltext = Full-Text fulltext_index = Full-Text index general = Algemeen general_info = Algemene informatie global_option_% = Global option '%' cannot be set. go_back = Ga terug go_forward = Ga vooruit go_home = Ga naar home go_to_line = Spring naar regel go_up = Ga omhoog granted_%_% = % toegewezen aan '%'. granted_%_%_% = % toegewezen aan '%' op '%'. green = Groen gui_interactions = GUI & interacties help = Help help1_use_catalog = Om 'catalog resolving' te kunnen gebruiken moet de help2_use_catalog = Apache XML Commons Resolver in je classpath staan. hit_s = Hit(s) index_attributes = Attributen indexeren index_created_%_% = Index '%' in % seconden gemaakt. index_dropped_%_% = Index '%' in % seconden verwijderd. index_fulltext = Full-Text indexeren index_not_dropped_% = Index '%' kon niet verwijderd worden. index_text = Text indexeren indexes = Indexen information = Informatie input_bar = Invoerveld input_format = Input format input_path = Input pad input_size = Input grootte insert_new_data = Voeg nieuwe data toe install = Installeer int_parser = Gebruik interne XML parser interrupted = Interrupted. invalid_% = % is ongeldig. invalid_value_%_% = Kon '%' niet de waarde '%' geven. italics = Cursief java_lf = Gebruik Java Look & Feel kill_self_% = '%' kan zichzelf niet stoppen. language = Taal license = BSD License line = Regel line_% = Regel % line_number = Regelnummer main_options = Hoofdopties manage_db = Beheer databases map = Map map_choice1 = Geen titel, geen rand map_choice2 = Geen titel, kleine rand map_choice3 = Titel, geen rand map_choice4 = Titel, kleine rand map_choice5 = Titel, grote rand map_layout = Map Layout match_case = Match Case max_nr_of_hits = Maximum aantal hits method = Method more_skipped_% = % meer bestanden overgeslagen multi_line = Multi-line mode name = Naam name_invalid_% = Naam '%' is ongeldig. name_of_db = Naam van database name_of_db_copy = Naam van database kopie names = Namen namespaces = Namespaces new = Nieuw new_db_question = Wil je een nieuwe maken? no = Nee no_data = Geen gegevens beschikbaar. no_db_dropped = Geen database verwijderd. no_db_found = Geen database gevonden. no_db_opened = Geen database geopend. no_dir_allowed_% = "%" wijst naar een directory. no_help = Sorry, geen help beschikbaar. no_mainmem = Commando is niet beschikbaar in main memory mode. no_pixels = Niet genoeg ruimte. no_stemmer_% = Geen 'stemmer' beschikbaar voor taal "%". no_tokenizer_% = Geen 'tokenizer' beschikbaar voor taal "%". nodes = Nodes nodes_parsed_% = % nodes geparsed not_available = Niet beschikbaar not_parsed_% = "%" voldoet niet aan de grammatica. number_children = aantal children offsets = Offsets ok = OK only_backup = Alleen beschikbaar als backup. open = Open open_manage = Manage optimize = Optimaliseer optimized_query = Geoptimaliseerd Query options = Opties out_of_date = verouderd out_of_mem = Hoofdgeheugen is op. output_dir = Output directory overwrite_db = Oude database wordt overschreven. packages = Packages packages_% = % package(s) parameters = Parameters parse_archives = Parse bestanden in archieven parse_as_jsonml = Parse input as JsonML parse_dtds = Parse DTDs en entities parser_% = % Parser parsing = Parsing password = Wachtwoord paste = Plak path = Pad path_added_%_% = Pad '%' toegevoegd in %. path_index = Path summary perm_required_% = % toegang geweigerd. perm_unknown_% = % permissie is onbekend. pi = PI pkg_deleted_% = Package '%' verwijderd. pkg_installed_%_% = Package '%' geïnstalleerd in %. pkg_replaced_%_% = Package '%' vervangen in %. please_wait = Een ogenblik plot = Plot port_twice_% = Poort '%' was twee peer gespecificeerd. preferences = Voorkeuren printed = Geprint printing = Printen properties = Eigenschappen pw_changed_% = Wachtwoord van gebruiker '%' veranderd. pw_not_valid = Password is geen geldige MD5 hash. query = Query query_executed_%_% = Query% uitgevoerd in % seconden. query_info = Query info query_plan = Query plan ratio = Verhouding read_locking = Read Locking red = Rood redo = Opnieuw refresh = Ververs regular_expr = Regular Expression rename = Hernoem rename_db = Hernoem database replace_all = Vervang alles replace_with = Vervang door requires_restart = vereist een herstart res_deleted_%_% = % resource(s) verwijderd in %. res_not_found = Resource niet gevonden. res_not_found_% = Resource "%" niet gevonden. res_props = Resource Eigenschappen res_renamed_%_% = % resource(s) hernoemd in %. res_replaced_%_% = % resource(s) vervangen in %. reserved_mem = Gereserveerd geheugen reset = Reset resources = Resources restore = Herstel result = Resultaat results_% = % Resultaten reopen = Opnieuw openen reopen_file_% = % opnieuw openen en wijzigingen niet opslaan? rt_execution = Realtime uitvoering rt_filtering = Realtime filteren rt_focus = Realtime muis focus save = Opslaan save_as = Opslaan als search = Zoeken select_all = Selecteer alles separator = Scheidingsteken sessions_% = % sessie(s) sessions_killed_% = % sessies gestopt. show_atts = Toon attributen show_name_atts = Vervang tags door @name attributen similar_cmd_% = Bedoelde je '%'? simple_file_chooser = Gebruik simpele bestandskiezer single_cmd = Single command expected. size = Grootte skip_corrupt_files = Sla non-well-formed bestanden over skipped = Overgeslagen split_input_lines = Splits input op in regels srv_running = Server loopt al of toegang ontzegd. srv_started_port_% = Server is gestart (poort: %) srv_stopped_port_% = Server is gestopt (poort: %) standard = Standaard start = Start status_bar = Status bar stemming = Stam zoeken stop = Stop stopped_at = Gestopt bij stopword_list = Stopword lijst strings_found_% = % string(s) gevonden. strings_replaced = Strings zijn vervangen. strip_ns = Strip namespaces syntax = Syntax table = Tabel target_path = Target path team = Team text = Tekst text_index = Tekst index text_length = tekst lengte time_needed = Benodigde tijd timeout_exceeded = Timeout overschreden. timestamp = Timestamp timing = Timing total_mem = Totaal geheugen total_time = Totale Tijd translation = Vertaling tree = Tree tree_options = Tree opties try_% = Probeer %. try_more_% = Probeer % om informatie te krijgen. try_specific_% = Probeer % om informatie over een specifiek commando te krijgen. type = Type undo = Herstel unknown_cmd_% = Onbekend commando: %. unknown_host_x = Onbekende host '%'. unknown_option_% = Onbekende optie '%'. unknown_parser_% = Onbekende parser '%'. unknown_user_% = Gebruiker '%' is onbekend. unwatching_event_% = Event '%' niet langer bekeken. up_to_date = bijgewerkt updated = Bijgewerkt use_catalog_file = Gebruik XML Catalog bestand used_mem = Geheugengebruik user_created_% = Gebruiker '%' gecreeerd. user_dropped_% = Gebruiker '%' verwijderd. user_dropped_%_% = Gebruiker '%' verwijderd uit '%'. user_exists_% = Gebruiker '%' bestaat al. user_logged_in_% = Gebruiker '%' is momenteel ingelogd. username = Gebruikersnaam users = Gebruikers users_% = % Gebruiker(s) value = Waarde version = Versie view = View watching_event_% = Bekijk event '%'. whole_word = Heel woord write_locking = Write Locking ws_chopping = Whitespace afkappen xquery = XQuery yes = Ja # Help texts h_about = Toont algemene informatie over het project. h_attr_index = Deze index versnelt attribute vergelijkingen in predicaten. h_browser_error_% = Kon geen browser openen.\nOpen zelf de URL:\n\n% h_buttons = Schakel de knoppenbalk aan/uit. h_case = Hoofdlettergevoeligheid wordt gebruikt in de index. h_chop_ws = Deze optie verwijdert witruimte tussen tags en content. h_close = Sluit de actuele (geopende) database. h_close_file = Sluit het geopende bestand. h_colors = Verander de kleuren van de applicatie. h_community = Toont de Basex gemeenschap webpagina. h_copy = Kopieert de geselecteerde XML nodes. h_copy_path = Kopieert het pad naar de geselecteerde XML nodes. h_db_format = Het database formaat is gewijzigd; maak een nieuwe database. h_delete = Verwijdert XML nodes. h_diacritics = Diakritische tekens worden gebruikt in de index. h_edit = Wijzigt XML nodes. h_editor = Toon de tekst editor. h_execute_query = Voer de query uit. h_exit = Stopt de applicatie. h_explorer = Toon het Verkennerspaneel. h_export = Exporteert de actuele database. h_filter_selected = Filtert de geselecteerde nodes. h_folder = Toon de folder visualisatie. h_fonts = Verander de gebruikte fonts. h_fullscreen = Schakelt naar volledig scherm. h_fulltext_index = Een full-text index versnelt full-text queries. h_go_home = Spring naar de root node. h_go_to_line = Springt naar het opgegeven regelnummer. h_go_up = Ga een niveau omhoog. h_help = Toon de documentatie webpagina. h_html_parser = De TagSoup parser zal gebruikt worden om HTML naar XML te converteren. h_index_format = Het index formaat is gewijzigd; maak nieuwe indexen. h_input_bar = Schakel het invoerveld aan/uit. h_int_parser = Robuuster en sneller dan Java's standaard parser. h_languauge = Met deze optie zullen taalspecifieke parsers worden gebruikt. h_large_db = De database is % groot. Wil je enkele visualisaties\nsluiten om sneller te kunnen werken? h_map = Toon de map visualisatie. h_map_layout = Verandert de map layout. h_new = Maakt een nieuwe database. h_new_file = Maakt een nieuw bestand. h_new_node = Maakt een nieuwe XML node. h_new_version = Een nieuwe versie is beschikbaar (% %)!\nWil je bijwerken? h_no_html_parser = Geen HTML parser beschikbaar; input wordt behandeld als gewone XML. h_open_file = Opent een tekst bestand. h_open_manage = Beheert bestaande databases. h_out_of_mem = De volgende hints kunnen je helpen:\n- vergroot Java's heap size met de vlag -Xmx\n- kies de interne XML parser in de GUI of via 'set intparse on'\n- deactiveer de text en attribute indexen. h_packages = Toon, installeer en verwijder XQuery packages. h_paste = Plakt eerder gekopieerde nodes. h_path_index = Een 'path summary' (pad-index) versnelt het vergelijken van paden. h_plot = Toon de scatter-plot visualisatie. h_preferences = Toont algemene applicatie voorkeuren. h_properties = Toon informatie over de geopende database. h_query_info = Toon het query info paneel. h_recently_open = Recent geopende bestanden. h_replace = Zoekt en vervangt text. h_reopen_file = Heropent het actuele bestand. h_result = Toon de resultaat view. h_rt_execution = Als deze optie ingeschakeld is worden queries na elke click uitgevoerd. h_rt_filtering = Als deze optie ingeschakeld is worden query resultaten automatisch gefiltert. h_save = Slaat het bestand op. h_save_result = Bewaart het resultaat. h_show_history = Toon input geschiedenis. h_status_bar = Schakel de status bar aan/uit. h_stemming = Van termen wordt de stam bepaald voor ze geïndexeerd worden. h_stop_process = Stopt het actuele proces. h_stopwords = Kies een stopword lijst om veelvoorkomende termen over te slaan. h_table = Toon de table visualisatie. h_text_index = Deze index versnelt tekst vergelijkingen in predicaten. h_tree = Toon de tree visualisatie. h_tree_options = Opties voor de treeView. h_updates = Toon de webpagina met updates. h_used_mem = Als er weinig geheugen beschikbaar is, start\nBaseX dan met de Java vlag -Xmx. # Commands c_add1 = Voeg resource aan database toe. c_add2 = Voegt [%] als [%] toe aan de database. c_alter1 = Wijzig gebruiker's wachtwoord of database naam. c_alter2 = Wijzigt gebruiker's wachtwoord of database naam: c_alterdb = wijzigt de naam of a database. c_alterpw = wijzigt het wachtwoord van een gebruiker. c_check1 = Opent of maakt een database. c_check2 = Opent een bestaande database of maakt een nieuwe instantie. c_close1 = Sluit actuele database. c_close2 = Sluit de actuele database. c_copy1 = Kopieer database. c_copy2 = Kopieert een database. c_create1 = Maak database, index, gebruiker, backup of event. c_create2 = Maakt een nieuwe database, index, gebruiker, backup of event: c_create3 = maakt de database [%] met een optionele [%] c_create4 = maakt een backup van database [%] c_create5 = maakt de opgegeven index c_create8 = creeert de opgegeven gebruiker c_create9 = creeert het event c_cs1 = Evalueer XQuery en neem resultaat als nieuwe context set. c_cs2 = Evalueert de query en neemt het resultaat als nieuwe context set. c_delete1 = Verwijder resources uit de database. c_delete2 = Verwijdert resources uit de actuele database. c_drop1 = Verwijder database, index, gebruiker, backup of event. c_drop2 = Verwijdert een database, index, gebruiker, backup of event: c_drop21 = verwijdert de database c_drop22 = verwijdert de opgegeven index c_drop23 = verwijdert de opgegeven gebruiker (van een database). c_drop24 = verwijdert de database backup c_drop25 = verwijdert de event c_execute1 = Voer commando script uit. c_execute2 = Voer het bestand [%] als commando script uit. c_exit1 = Stop applicatie. c_exit2 = Stop %. c_export1 = Exporteer database naar XML. c_export2 = Exporteert de database naar [%]. c_find1 = Evalueer een keyword query. c_find2 = De volgende modifiers kunnen gebruikt worden:\n = : zoekt naar exacte tekst nodes"\n @= : zoekt naar exacte attributen\n @ : zoekt naar attributen c_flush1 = Schrijft database naar disk. c_flush2 = Schrijft alle database buffers naar disk. c_get1 = Toon globale optie. c_get2 = Toont de waarde van een globale optie. c_grant1 = Geef gebruiker permissies. c_grant2 = Geeft permissies (op een database) aan een gebruiker. c_help1 = Vraag hulp over % commando's. c_help2 = Als [%] is opgegeven, dan wordt informatie over het specifieke\ncommando geprint; anders worden alle commando's getoond. c_info1 = Toon informatie over de actuele database. c_info21 = Toont informatie over de momenteel geopende database: c_info22 = geen argument: toon globale informatie c_info23 = toont database informatie c_info24 = toont index informatie c_info25 = toon interne database tabel c_inspect1 = Voer integriteitscontroe uit. c_inspect2 = Controleer de database op fouten. c_kill1 = Stop gebruiker sessions. c_kill2 = Stopt alle sessies van de opgegeven gebruiker. c_list1 = Toon een lijst van databases of resources in een database. c_list2 = Toon een lijst van alle beschikbare databases,\nof de resources in een database [%]. c_open1 = Open database. c_open2 = Opent de database [%], gefilterd op [%]. c_optimize1 = Optimaliseer de database. c_optimize2 = Optimaliseert de geopende database.\nAls % gespecificeerd is, wordt de database grootte geminimaliseerd. c_password1 = Verander wachtwoord. c_password2 = Verandert het wachtwoord van de gebruiker. c_rename1 = Hernoem resources in database. c_rename2 = Hernoemt resources in de actuele database. c_replace1 = Vervang resources in database. c_replace2 = Vervangt resources in de actuele database. c_repo1 = Installeer, verwijder of toon packages. c_repo2 = Installeert, verwijdert of toont packages van de repository c_repo3 = verwijdert het package met de naam [%] of directory [%] c_repo4 = installeert package met path [%] c_repo5 = toont alle geinstalleerde packages c_restore1 = Herstel database. c_restore2 = Zet een backup van de gegeven database terug mbv\nde laatste of met datum gespecificeerde backup file. c_retrieve1 = Haal regel op. c_retrieve2 = Haalt regel op van de gespecificeerde [%]. c_run1 = Voer query of commando script uit. c_run2 = Voer de inhoud van [%] als query of commando script uit. c_set1 = Stel globale opties in. c_set2 = Stel een nieuwe waarde in voor een database optie. c_show1 = Toon server informatie. c_show21 = Toont server informatie: c_show23 = toont actuele database sessies. c_show24 = toont gebruikers (van een database). c_show25 = toont backups. c_show26 = toont events. c_store1 = Sla ruwe data op. c_store2 = Slaat ruwe data op in de gespecificeerde [%]. c_xquery1 = Evalueer XQuery. c_xquery2 = Evalueert de opgegeven query en print het resultaat. # Server texts; will be outsourced s_adlogin = Administrator login (local of remote) s_connect = Connectie s_connected = Verbonden met %:%. s_createu = Nieuwe gebruiker s_dbrevoke = Permissie wordt ingetrokken voor de ingelogde gebruiker. s_disconnected = Niet verbonden. s_drquestion = % gebruiker(s) worden verwijderd. s_globperm = Globale permissies s_host = Host s_info1 = Deze dialoog is alleen bedoeld om de client/server omgeving te beheren. s_info2 = Het heeft geen invloed op andere features van de GUI. s_locallogs = Local Logs s_localport = Lokale poort s_localserver = Lokale server s_locperm = Lokale permissies s_port = Poort s_sessions = Sessies s_alter = Wijzig s_server_admin = Server administratie s_h_server_admin = Toont de server administratie voor gebruikersbeheer en de logbestanden. basex-7.7.2/basex-core/src/main/resources/lang/English.lang000066400000000000000000000616061222453003200235650ustar00rootroot00000000000000# LANGUAGE FILE, TRANSLATED BY # BaseX Team OFF = OFF ON = ON about_% = About % access_denied = Access denied. add = Add add_raw_files = Add other files as raw files add_resources = Add Resources adjust_nodes = Adjust nodes to text admin_static_% = Admin user cannot be modified. algorithm = Algorithm all = All alter_pw = Alter Password and_others = and others are_you_sure = Are you sure? attribute = Attribute attribute_index = Attribute Index attributes = Attributes backup = Backup backup_dropped_% = Backup files '%' were dropped. backup_not_found_% = No backup found for '%'. backups = Backups backups_% = % backup(s) binaries = Binaries blue = Blue bold = Bold browse = Browse buttons = Buttons bye1 = Have a nice day. bye2 = See you. bye3 = Have fun. bye4 = Enjoy life. cancel = Cancel case_sensitivity = Case Sensitivity check_for_updates = Check for Updates chief_architect = Chief Architect children_text_len = children/text length choose_dir = Choose Directory choose_font = Choose Font chop_ws = Chop whitespaces chopped = Chopped clear = Clear close = Close close_file_% = Save changes to %? color_schema = Color Schema colors = Colors command = Command command_canceled = Command was canceled. comment = Comment community = Community compiling = Compiling connect = Connect connection_error = Can't communicate with the server. copy = Copy copy_db = Copy Database copy_path = Copy Path create = Create create_database = Create Database create_stats = Create statistics creating_db = Creating Database creating_indexes = Creating Indexes cut = Cut database = Database database_path = Database Path (existing databases will not be moved) databases = Databases databases_% = % database(s) db_backup_% = Backup for '%' was created in %. db_closed_% = Database '%' was closed. db_copied_% = Copy of '%' was created in %. db_corrupt = State of database is inconsistent. db_created_%_% = Database '%' created in %. db_dropped_% = Database '%' was dropped. db_exists_% = Database '%' already exists. db_exported_% = Database '%' was exported in %. db_flushed_% = Database '%' was flushed in %. db_not_backup_% = Backup of database '%' could not be created. db_not_copied_% = Copy of '%' could not be created. db_not_dropped_% = Database '%' could not be dropped. db_not_found_% = Database '%' was not found. db_not_renamed_% = Database '%' could not be renamed. db_not_restored_% = '%' could not be restored. db_opened_% = Database '%' was opened in %. db_optimized_% = Database '%' was optimized in %. db_pinned_% = Database '%' is currently opened by another process. db_props = Database Properties db_renamed_% = Database '%' was renamed to '%'. db_restored_% = '%' was restored in %. db_updated_% = Database '%' is being updated, or update was not completed. delete = Delete delete_all = Delete All delete_nodes = Do you really want to delete? delete_packages_% = % package(s) will be deleted. diacritics = Diacritics dir_not_empty = Directory is not empty. disconnect = Disconnect document = Document documents = Documents drop = Drop drop_backups_% = % backup(s) will be dropped. dropping_db_% = % database(s) will be dropped. edit = Edit edit_% = Edit % edit_data = Edit data editor = Editor element = Element elements = Elements empty_db = An empty database will be created. encoding = Encoding enter_db_name = Please enter a database name. entries_% = % entries error = Error evaluating = Evaluating event_created_% = Event '%' was created. event_dropped_% = Event '%' was dropped. event_exists_% = Event '%' already exists. event_not_watched_% = Event '%' was not watched. event_unknown_% = Event '%' is unknown. event_watched_% = Already watching event '%'. events_% = % event(s) exec_error_% = Could not execute % exit = Exit expecting_cmd = Expecting command. explorer = Explorer export = Export file = file file_exists_% = % already exists.\nDo you want to replace it? file_not_deleted_% = File '%' could not be deleted. file_not_opened = File could not be opened. file_not_saved = File could not be saved. file_not_stored_% = File '%' could not be stored. file_or_dir = Input file or directory file_patterns = File patterns (separated by commas) files_replace_% = Files will be replaced in %.\nDo you want to continue? filter = Filter filter_selected = Filter Selected finishing = Finishing first_line_header = Parse first line as table header folder = Folder fonts = Fonts fullscreen = Fullscreen fulltext = Full-Text fulltext_index = Full-Text Index general = General general_info = General Information global_option_% = Global option '%' cannot be set. go_back = Go Back go_forward = Go Forward go_home = Go Home go_to_line = Go to line go_up = Go Up granted_%_% = % granted to '%'. granted_%_%_% = % granted to '%' on '%'. green = Green gui_interactions = GUI & Interactions help = Help help1_use_catalog = To enable catalog resolving make sure the help2_use_catalog = Apache XML Commons Resolver is on your classpath. hit_s = Hit(s) index_attributes = Indexing Attribute Values index_created_%_% = Index '%' created in %. index_dropped_%_% = Index '%' dropped in %. index_fulltext = Indexing Full-Text index_not_dropped_% = Index '%' could not be dropped. index_text = Indexing Text indexes = Indexes information = Information input_bar = Input Bar input_format = Input format input_path = Input Path input_size = Input Size insert_new_data = Insert new data install = Install int_parser = Use internal XML parser interrupted = Interrupted. invalid_% = % is invalid. invalid_value_%_% = Could not set '%' to '%'. italics = Italics java_lf = Use Java Look & Feel kill_self_% = '%' cannot kill him-/herself. language = Language license = BSD License line = Line line_% = Line % line_number = Line number main_options = Main Options manage_db = Manage Databases map = Map map_choice1 = No Title, no Border map_choice2 = No Title, small Border map_choice3 = Title, no Border map_choice4 = Title, small Border map_choice5 = Title, large Border map_layout = Map Layout match_case = Match Case max_nr_of_hits = Maximum number of hits method = Method more_skipped_% = % more file(s) skipped multi_line = Multi-line mode name = Name name_invalid_% = Name '%' is invalid. name_of_db = Name of database name_of_db_copy = Name of database copy names = Names namespaces = Namespaces new = New new_db_question = Do you want to create a new one? no = No no_data = No data available. no_db_dropped = No database was dropped. no_db_found = No database found. no_db_opened = No database opened. no_dir_allowed_% = "%" points to a directory. no_help = Sorry, no help available. no_mainmem = Command is not available in main memory mode. no_pixels = Not enough pixels. no_stemmer_% = No stemmer available for language "%". no_tokenizer_% = No tokenizer available for language "%". nodes = Nodes nodes_parsed_% = % nodes parsed not_available = Not available not_parsed_% = "%" could not be parsed. number_children = number of children offsets = Offsets ok = OK only_backup = Only available as a backup. open = Open open_manage = Open & Manage optimize = Optimize optimized_query = Optimized Query options = Options out_of_date = out-of-date out_of_mem = Out of Main Memory. output_dir = Output directory overwrite_db = Existing database will be overwritten. packages = Packages packages_% = % package(s) parameters = Parameters parse_archives = Parse files in archives parse_as_jsonml = Parse input as JsonML parse_dtds = Parse DTDs and entities parser_% = % Parser parsing = Parsing password = Password paste = Paste path = Path path_added_%_% = Path "%" added in %. path_index = Path Summary perm_required_% = % permission needed. perm_unknown_% = % permission is unknown. pi = PI pkg_deleted_% = Package '%' deleted. pkg_installed_%_% = Package '%' installed in %. pkg_replaced_%_% = Package '%' replaced in %. please_wait = Please Wait plot = Plot port_twice_% = Port '%' was specified twice. preferences = Preferences printed = Printed printing = Printing properties = Properties pw_changed_% = Password of user '%' changed. pw_not_valid = Password is no valid MD5 hash. query = Query query_executed_%_% = Query% executed in %. query_info = Query Info query_plan = Query plan ratio = Ratio read_locking = Read Locking red = Red redo = Redo refresh = Refresh regular_expr = Regular Expression rename = Rename rename_db = Rename Database reopen = Reopen reopen_file_% = Reopen % and discard changes? replace_all = Replace all replace_with = Replace with requires_restart = requires a restart res_deleted_%_% = % resource(s) deleted in %. res_not_found = Resource not found. res_not_found_% = Resource "%" not found. res_props = Resource Properties res_renamed_%_% = % resource(s) renamed in %. res_replaced_%_% = % resource(s) replaced in %. reserved_mem = Reserved Memory reset = Reset resources = Resources restore = Restore result = Result results_% = % Results rt_execution = Realtime Execution rt_filtering = Realtime Filtering rt_focus = Realtime mouse focus save = Save save_as = Save as search = Search select_all = Select All separator = Separator sessions_% = % session(s) sessions_killed_% = % sessions killed. show_atts = Show Attributes show_name_atts = Replace tags with @name attributes similar_cmd_% = Did you mean '%'? simple_file_chooser = Use simple file chooser single_cmd = Single command expected. size = Size skip_corrupt_files = Skip corrupt (non-well-formed) files skipped = Skipped split_input_lines = Splits input into lines srv_running = Server is running or permission was denied. srv_started_port_% = Server was started (port: %) srv_stopped_port_% = Server was stopped (port: %) standard = Standard start = Start status_bar = Status Bar stemming = Stemming stop = Stop stopped_at = Stopped at stopword_list = Stopword List strings_found_% = % string(s) found. strings_replaced = Strings were replaced. strip_ns = Strip namespaces syntax = Syntax table = Table target_path = Target path team = Team text = Text text_index = Text Index text_length = text length time_needed = Time needed timeout_exceeded = Timeout exceeded. timestamp = Timestamp timing = Timing total_mem = Total Memory total_time = Total Time translation = Translation tree = Tree tree_options = Tree Options try_% = Try %. try_more_% = Try % to get more information. try_specific_% = Try % to get info on a specific command. type = Type undo = Undo unknown_cmd_% = Unknown command: %. unknown_host_x = Unknown host '%'. unknown_option_% = Unknown option '%'. unknown_parser_% = Unknown parser '%'. unknown_user_% = Unknown user '%'. unwatching_event_% = Event '%' unwatched. up_to_date = Up-to-date updated = Updated use_catalog_file = Use XML Catalog file used_mem = Used Memory user_created_% = User '%' created. user_dropped_% = User '%' dropped. user_dropped_%_% = User '%' dropped from '%'. user_exists_% = User '%' already exists. user_logged_in_% = User '%' is currently logged in. username = Username users = Users users_% = % user(s) value = Value version = Version view = View watching_event_% = Watch event '%'. whole_word = Whole Word write_locking = Write Locking ws_chopping = Whitespace Chopping xquery = XQuery yes = Yes # Help texts h_about = Displays general information on the project. h_attr_index = This index speeds up attribute comparisons in predicates. h_browser_error_% = Failed to open a browser.\nPlease manually open the URL:\n\n% h_buttons = Switches the button bar on/off. h_case = Case sensitivity is retained in the index. h_chop_ws = This option removes whitespaces between tags and contents. h_close = Closes the current database. h_close_file = Closes the currently opened file. h_colors = Allows to change the application colors. h_community = Shows the community web page. h_copy = Copies the currently selected XML nodes. h_copy_path = Copies the path to the selected XML nodes. h_db_format = The database format has changed; please use a newer version. h_delete = Deletes XML nodes. h_diacritics = Diacritics are retained in the index. h_edit = Edits XML nodes. h_editor = Shows the text editor. h_execute_query = Executes the query. h_exit = Exits the application. h_explorer = Shows the explorer panel. h_export = Exports the current database. h_filter_selected = Filters the selected nodes. h_folder = Shows the folder visualization. h_fonts = Allows to change the used fonts. h_fullscreen = Switches to fullscreen. h_fulltext_index = A full-text index speeds up full-text queries. h_go_home = Shows all data. h_go_to_line = Jumps to a specified line. h_go_up = Moves one level up. h_help = Shows the documentation web page. h_html_parser = The TagSoup parser will be used to convert HTML to XML. h_index_format = The index format has changed; please create new indexes. h_input_bar = Switches the input field on/off. h_int_parser = Fault tolerant, and faster than Java’s default parser. h_languauge = Language specific text parsers will be used. h_large_db = The database is % large. Do you want to close\nsome visualizations in order to speed up processing? h_map = Shows the map visualization. h_map_layout = Changes the map layout. h_new = Creates a new database. h_new_file = Creates a new file. h_new_node = Creates a new XML node. h_new_version = A new version is available (% %)!\nDo you want to update? h_no_html_parser = No HTML parser is available; input will be treated as ordinary XML. h_open_file = Opens an existing file. h_open_manage = Manages existing databases. h_out_of_mem = You can try to:\n- increase Java's heap size with the flag -Xmx\n- deactivate the text and attribute indexes. h_packages = Allows to list, install, and delete XQuery packages. h_paste = Pastes previously copied nodes. h_path_index = A path summary speeds up path resolutions. h_plot = Shows the scatter-plot visualization. h_preferences = Displays general application preferences. h_properties = Gives insight into the currently opened database. h_query_info = Shows the query info panel. h_recently_open = Provides shortcuts to the recently opened files. h_replace = Searches and replaces text. h_reopen_file = Reopens the current file. h_result = Shows the result view. h_rt_execution = If this option is turned on, queries are executed after each key click. h_rt_filtering = If this option is turned on, the query results are automatically filtered. h_save = Saves the file. h_save_result = Saves the result. h_show_history = Shows input history. h_status_bar = Switches the status bar on/off. h_stemming = Terms are stemmed before they are indexed. h_stop_process = Stops the current process. h_stopwords = Choose a stopword list to skip frequent terms. h_table = Shows the table visualization. h_text_index = This index speeds up text comparisons in predicates. h_tree = Shows the tree visualization. h_tree_options = Options for the TreeView. h_updates = Shows the update web page. h_used_mem = If memory is low, please launch\nBaseX with the Java flag -Xmx. # Commands c_add1 = Add resource to database. c_add2 = Adds [%] as [%] to the database. c_alter1 = Alter database name or user password. c_alter2 = Alters the name of a database or the user password: c_alterdb = alters the name of a database. c_alterpw = alters the password of a user. c_check1 = Open or create database. c_check2 = Opens an existing database or creates a new instance. c_close1 = Close current database. c_close2 = Closes the currently opened database. c_copy1 = Copy database. c_copy2 = Copies a database. c_create1 = Create database, index, user, backup or event. c_create2 = Creates a new database, index, user, backup or event: c_create3 = creates the database [%] with an optional [%] c_create4 = creates a backup of the database [%] c_create5 = creates the specified index c_create8 = creates the specified user c_create9 = creates the event c_cs1 = Run XQuery and set result as new context set. c_cs2 = Runs the query and sets the result as new context set. c_delete1 = Delete resources from database. c_delete2 = Deletes resources from the currently opened database. c_drop1 = Drop database, index, user, backup or event. c_drop2 = Drops a database, index, user, backup or event. c_drop21 = drops the database c_drop22 = drops the specified index c_drop23 = drops the specified user (on a database). c_drop24 = drops the database backup c_drop25 = drops the event c_execute1 = Execute command script. c_execute2 = Executes the specified [%] as command script. c_exit1 = Exit application. c_exit2 = Exits %. c_export1 = Export database to XML. c_export2 = Exports the database to [%]. c_find1 = Run a keyword query. c_find2 = Finds keywords in a database. c_flush1 = Flush database. c_flush2 = Flushes all database buffers to disk. c_get1 = Show global option. c_get2 = Shows the value of a global option. c_grant1 = Grant user permissions. c_grant2 = Grants permissions (on a database) to a user. c_help1 = Get help on % commands. c_help2 = If [%] is specified, information on the specific\ncommand is printed; otherwise, all commands are listed. c_info1 = Show information on current database. c_info21 = Shows information on the currently opened database: c_info22 = no argument: shows global information c_info23 = shows database information c_info24 = shows index information c_info25 = shows internal database table c_inspect1 = Perform integrity checks. c_inspect2 = Checks the database for errors. c_kill1 = Kill user sessions. c_kill2 = Kills all sessions of the specified user. c_list1 = List databases or resources of database. c_list2 = Lists all available databases, or the resources of\nthe database [%] filtered by an optional [%]. c_open1 = Open database. c_open2 = Opens the database [%], filtered by [%]. c_optimize1 = Optimize the database. c_optimize2 = Optimizes the currently opened database.\nIf % is specified, the database size is minimized. c_password1 = Change password. c_password2 = Changes the user's password. c_rename1 = Rename resources in database. c_rename2 = Renames resources in the current database. c_replace1 = Replace resources in database. c_replace2 = Replaces resources in the current database. c_repo1 = Install, delete or list packages. c_repo2 = Installs, deletes or lists packages from the repository. c_repo3 = deletes the package with name [%] or directory [%] c_repo4 = installs package with path [%] c_repo5 = lists all installed packages c_restore1 = Restore database. c_restore2 = Restores a database. The argument may include\nthe timestamp of the backup file. c_retrieve1 = Retrieve raw data. c_retrieve2 = Retrieves raw data from the specified [%]. c_run1 = Run query or command script. c_run2 = Runs the contents of [%] as query or command script. c_set1 = Set global options. c_set2 = Sets a database option to a new value. c_show1 = Show server information. c_show21 = Shows server information: c_show23 = shows current database sessions. c_show24 = shows users (on a database). c_show25 = shows backups. c_show26 = shows events. c_store1 = Store raw data. c_store2 = Stores raw data to the specified [%]. c_xquery1 = Run XQuery. c_xquery2 = Runs the specified query and prints the result. # Server texts; will be outsourced s_adlogin = Administrator Login (local or remote) s_connect = Connection s_connected = Connected to %:%. s_createu = Create User s_dbrevoke = Permission will be revoked from logged in user. s_disconnected = Disconnected. s_drquestion = % User(s) will be dropped. s_globperm = Global Permissions s_host = Host s_info1 = Warning: The client/server architecture and the GUI are not synchronized. s_info2 = The same database should not be opened from clients and the GUI. s_locallogs = Local Logs s_localport = Local Port s_localserver = Local Server s_locperm = Local Permissions s_port = Port s_sessions = Sessions s_alter = Alter s_server_admin = Server Administration s_h_server_admin = Display the server administration for user management and log tracing. basex-7.7.2/basex-core/src/main/resources/lang/French.lang000066400000000000000000000710541222453003200233770ustar00rootroot00000000000000# LANGUAGE FILE, TRANSLATED BY # Maud Ingarao OFF = OFF ON = ON about_% = A propos de % access_denied = Accès refusé. add = Ajouter add_raw_files = Ajouter les fichiers restants comme fichiers bruts add_resources = Add Resources adjust_nodes = Ajuster les nÅ“uds au texte admin_static_% = L'utilisateur Admin ne peut être modifié. algorithm = Algorithme all = All alter_pw = Modifier mot de passe and_others = et d'autres are_you_sure = Confirmer? attribute = Attribut attribute_index = Index attributs attributes = Attributs backup = Sauvegarde backup_dropped_% = Les fichiers de sauvegarde '%' ont été supprimés. backup_not_found_% = Aucune sauvegarde trouvée pour '%'. backups = Sauvegardes backups_% = % sauvegarde(s) binaries = Binaires blue = Bleu bold = Gras browse = Parcourir buttons = Boutons bye1 = Bonne journée. bye2 = Au revoir. bye3 = Amusez-vous bien. bye4 = Carpe diem. cancel = Annuler case_sensitivity = Casse check_for_updates = Vérifier les mises à jour chief_architect = Developpeur principal children_text_len = noeuds fils/longueur du texte choose_dir = Choisir dossier choose_font = Choisir police chop_ws = Supprimer les espaces chopped = Réduit clear = Effacer close = Fermer close_file_% = Enregistrer les modifications à % ? color_schema = Code couleurs colors = Couleurs command = Commande command_canceled = Le commande a été annulée. comment = Commentaire community = Communauté compiling = Compilation connect = Connecter connection_error = Pas de communication avec le serveur. copy = Copier copy_db = Copier la base de données copy_path = Copier le chemin create = Créer create_database = Créer base de données create_stats = Créer statistiques creating_db = Création base de données en cours creating_indexes = Création index en cours cut = Couper database = Base de données database_path = Emplacement de la base de données (à déplacer manuellement) databases = Base de données databases_% = % base de donnée(s) db_backup_% = Sauvegarde de '%' créée en %. db_closed_% = La base de données '%' a été fermée. db_copied_% = Copie de '%' créée en %. db_corrupt = Attention : la base de données est peut-être corrompue ! db_created_%_% = Base de données '%' créée en %. db_dropped_% = La base de données '%' a été effacée. db_exists_% = La base de données '%' existe déjà. db_exported_% = Base de données '%' exportée en %. db_flushed_% = La base de données '%' a été nettoyée (flush) en %. db_not_backup_% = La sauvegarde de la base de données '%' n'a pas pu être créée. db_not_copied_% = La copie de '%' n'a pas pu être créée. db_not_dropped_% = Impossible d'effacer la base de données '%'. db_not_found_% = La base de données '%' est introuvable. db_not_renamed_% = La base de données '%' n'a pas pu être renommée. db_not_restored_% = '%' n'a pas pu être restaurée. db_opened_% = Base de données '%' ouverte en %. db_optimized_% = Base de données '%' optimisée en %. db_pinned_% = La base de données '%' est actuellement utilisée par un autre processus. db_props = Propriétés de la base de données db_renamed_% = La base de données '%' a été renommée en '%'. db_restored_% = '%' restaurée en %. db_updated_% = La base de données '%' est en cours de mise à jour, ou la mise à jour n'a pas été effectuée. delete = Supprimer delete_all = Supprimer tout delete_nodes = Voulez-vous vraiment supprimer? delete_packages_% = % package(s) will be deleted. diacritics = Diacritiques dir_not_empty = Le dossier n'est pas vide. disconnect = Déconnecter document = Document documents = Documents drop = Effacer drop_backups_% = % sauvegardes(s) seront supprimées. dropping_db_% = % base(s) de données va être effacée. edit = Editer edit_% = Editer % edit_data = Editer les données editor = Editeur element = Elément elements = Balises empty_db = Une base de données vide va être créée. encoding = Encodage enter_db_name = Entrer un nom de base de données. entries_% = % entrées error = Erreur evaluating = Evaluation event_created_% = L'évènement '%' a été créé. event_dropped_% = L'évènement '%' a été supprimé. event_exists_% = L'évènement '%' existe déjà. event_not_watched_% = L'évènement '%' was not watched. event_unknown_% = L'évènement '%' est inconnu. event_watched_% = L'évènement '%' est déjà observé. events_% = % évènement(s) exec_error_% = Impossible d'exécuter % exit = Quitter expecting_cmd = Commande attendue. explorer = Explorer export = Exporter file = fichier file_exists_% = % existe déjà.\nVoulez-vous le remplacer ? file_not_deleted_% = Impossible de supprimer le fichier '%'. file_not_opened = Echec à l'ouverture du fichier. file_not_saved = Echec à l'enregistrement du fichier. file_not_stored_% = Le fichier '%' n'a pas été enregistré. file_or_dir = Fichier ou dossier source file_patterns = Filtres de fichiers (séparés par des virgules) files_replace_% = Les fichiers vont être remplacés dans %.\nVoulez-vous continuer ? filter = Filter filter_selected = Filtre sélectionné finishing = Fin first_line_header = Analyser la première ligne comme entête de tableau folder = Dossier fonts = Polices fullscreen = Plein écran fulltext = Plein texte fulltext_index = Index plein texte general = Général general_info = Informations Générales global_option_% = L'option globale '%' ne peut être modifié. go_back = En arrière go_forward = En avant go_home = Aller à l'accueil go_to_line = Go to line go_up = Vers le haut granted_%_% = % accordé à '%'. granted_%_%_% = % accordé à '%' sur '%'. green = Vert gui_interactions = Interface graphique & Interactions help = Aide help1_use_catalog = Pour activer la résolution de catalogue, assurez-vous que le help2_use_catalog = Apache XML Commons Resolver est dans votre classpath. hit_s = Hit(s) index_attributes = Indexation des attributs en cours index_created_%_% = Index '%' créé en %. index_dropped_%_% = Index '%' effacé en %. index_fulltext = Indexation plein texte en cours index_not_dropped_% = Impossible d'effacer l'index '%'. index_text = Indexation du texte en cours indexes = Indexes information = Information input_bar = Champ de saisie input_format = Format d'entrée input_path = Chemin en entrée input_size = Taille en entrée insert_new_data = Insérer nouvelles données install = Installer int_parser = Utiliser le parseur XML interne interrupted = Interrupted. invalid_% = % est invalide. invalid_value_%_% = Impossible de donner à la propriété '%' la valeur '%'. italics = Italique java_lf = Utiliser apparence Java kill_self_% = '%' ne peut pas s'auto-interrompre. language = Langue license = License BSD line = Ligne line_% = Ligne % line_number = Zeilennummer main_options = Main Options manage_db = Manage Databases map = Carte map_choice1 = Pas de titre, pas de bordure map_choice2 = Pas de titre, petite bordure map_choice3 = Title, pas de bordure map_choice4 = Title, petite bordure map_choice5 = Title, bordure large map_layout = Disposition de la carte match_case = Match Case max_nr_of_hits = Maximum number of hits method = Méthode more_skipped_% = % fichier(s) supplémentaires ignorés multi_line = Multi-line mode name = Nom name_invalid_% = Le nom '%' est invalide. name_of_db = Nom de la base de données name_of_db_copy = Nom de la copie de la base de données names = Noms namespaces = Espaces de noms new = Nouveau new_db_question = Voulez-vous en créer une nouvelle ? no = Non no_data = Aucune donnée disponible. no_db_dropped = Aucune base de données n'a été supprimée. no_db_found = Aucune base de données trouvée. no_db_opened = Aucune base de données ouverte. no_dir_allowed_% = "%" points to a directory. no_help = Pas d'aide disponible. no_mainmem = Cette commande n'est pas disponible en mode mémoire principale. no_pixels = Espace insuffisant. no_stemmer_% = No stemmer available for language "%". no_tokenizer_% = No tokenizer available for language "%". nodes = Noeuds nodes_parsed_% = % noeuds parsés not_available = Pas disponible not_parsed_% = "%" n'a pu être parsé. number_children = nombre de noeuds fils offsets = Offsets ok = OK only_backup = Only available as a backup. open = Ouvrir open_manage = Administrer optimize = Optimiser optimized_query = Requête Optimisée options = Options out_of_date = périmé out_of_mem = Dépassement de mémoire principale. output_dir = Dossier de sortie overwrite_db = La base de données existante va être remplacée. packages = Packages packages_% = % paquet(s) parameters = Parameters parse_archives = Analyser les fichiers dans les archives parse_as_jsonml = Parse input as JsonML parse_dtds = Analyser les DTD et les entités parser_% = % Parser parsing = Analyse password = Mot de passe paste = Coller path = Chemin path_added_%_% = Chemin '%' ajouté en %. path_index = Index des chemins perm_required_% = Permission % requise. perm_unknown_% = La permission % est inconnue. pi = PI pkg_deleted_% = Paquet '%' supprimé. pkg_installed_%_% = Paquet '%' installé en %. pkg_replaced_%_% = Paquet '%' remplacé en %. please_wait = Veuillez patienter plot = Diagramme port_twice_% = Le port '%' a été spécifié deux fois. preferences = Préférences printed = Imprimé printing = Impression properties = Propriétés pw_changed_% = Mot de passe modifié pour l'utilisateur '%'. pw_not_valid = Le hachage MD5 du mot de passe est invalide. query = Requête query_executed_%_% = Requête% executée en %. query_info = Info requête query_plan = Plan de requête ratio = Ratio read_locking = Read Locking red = Rouge redo = Refaire refresh = Raffraîchir regular_expr = Regular Expression rename = Renommer rename_db = Renommer la base de données replace_all = Remplacer tout replace_with = Remplacer avec requires_restart = Nécessité de redémarrer res_deleted_%_% = % resource(s) supprimé en %. res_not_found = Ressource introuvable. res_not_found_% = Ressource '%' introuvable. res_props = Propriétés de la ressource res_renamed_%_% = % ressource(s) renommée en %. res_replaced_%_% = % ressource(s) remplacé en %. reserved_mem = Mémoire réservée reset = Réinitialiser resources = Ressources restore = Restaurer result = Résultat results_% = % Résultats reopen = Reopen reopen_file_% = Reopen % and discard changes? rt_execution = Execution en temps réel rt_filtering = Filtrage en temps réel rt_focus = Focus souris en temps réel save = Enregistrer save_as = Enregistrer sous search = Rechercher select_all = Sélectionner tout separator = Separateur sessions_% = % session(s) sessions_killed_% = % sessions interrompues. show_atts = Montrer les attributs show_name_atts = Remplacer les balises par des attributs @name similar_cmd_% = Voulez-vous dire '%' ? simple_file_chooser = Utiliser sélecteur de fichiers simple single_cmd = Single command expected. size = Taille skip_corrupt_files = Ignorer les fichiers corrompus (mal formés) skipped = Ignoré split_input_lines = Eclater l'entrée en lignes srv_running = Serveur déjà démarré ou permission refusée. srv_started_port_% = Serveur démarré (port: %) srv_stopped_port_% = Serveur arrêté (port: %) standard = Standard start = Démarrer status_bar = Barre d'état stemming = Stemming stop = Arrêter stopped_at = Arrêté à stopword_list = Liste des mots vides strings_found_% = % string(s) found. strings_replaced = Strings were replaced. strip_ns = Strip namespaces syntax = Syntaxe table = Tableau target_path = Chemin cible team = Equipe text = Texte text_index = Index texte text_length = longueur du texte time_needed = Temps d'exécution timeout_exceeded = Délai expiré. timestamp = Horodateur timing = Timing total_mem = Mémoire totale total_time = Temps total translation = Traduction tree = Arbre tree_options = Options de l'arbre try_% = Essayez %. try_more_% = Essayez % pour obtenir des informations. try_specific_% = Essayez % pour obtenir des informations sur une commande specifique type = Type undo = Annuler unknown_cmd_% = Commande inconnue: %. unknown_host_x = Serveur '%' inconnu. unknown_option_% = Option '%' inconnue. unknown_parser_% = Unknown parser '%'. unknown_user_% = Utilisateur '%' inconnu. unwatching_event_% = Evènement '%' non observé. up_to_date = A jour updated = Mis à jour use_catalog_file = Utiliser un fichier de catalogue XML Catalog used_mem = Mémoire utilisée user_created_% = Utilisateur '%' créé. user_dropped_% = Utilisateur '%' effacé. user_dropped_%_% = Utilisateur '%' effacé de '%'. user_exists_% = L'utilisateur '%' existe déjà. user_logged_in_% = L'utilisateur '%' est actuellement logué. username = Nom d'utilisateur users = Utilisateurs users_% = % utilisateurs(s) value = Valeur version = Version view = Affichage watching_event_% = Observation de l'évènement '%'. whole_word = Whole Word write_locking = Write Locking ws_chopping = Suppression des espaces xquery = XQuery yes = Oui # Help texts h_about = Affiche les informations générales sur le projet. h_attr_index = Cet index accélère les comparaisons d'attributs dans les prédicats. h_browser_error_% = Impossible d'ouvrir un navigateur.\nVeuillez ouvrir l'URL manuellement:\n\n% h_buttons = Activer/désactiver la barre des boutons. h_case = La casse est conservée dans l'index. h_chop_ws = Cette option supprime les espaces entre balises et contenus. h_close = Ferme la base de données courante. h_close_file = Ferme le fichier actuellement ouvert. h_colors = Autorise le changement des couleurs de l'application. h_community = Affiche la page web de la communauté. h_copy = Copie les noeuds XML sélectionnés. h_copy_path = Copie le chemin des noeuds XML sélectionné. h_db_format = Le format de base de données a changé ; Veuillez créer une nouvelle base de données. h_delete = Supprime noeuds XML. h_diacritics = Les signes diacritiques sont conservés dans l'index. h_edit = Edite les noeuds XML. h_editor = Afficher l'éditeur de texte. h_execute_query = Execute la requête. h_exit = Quitte l'application. h_explorer = Afficher le panneau d'exploration. h_export = Exporte la base de données courante. h_filter_selected = Filtre les noeuds sélectionné . h_folder = Afficher la visualisation par dossiers. h_fonts = Autorise le changement des polices utilisées. h_fullscreen = Passe en mode plein écran. h_fulltext_index = Un index plein texte accélère les requêtes plein texte. h_go_home = Aller au noeud racine. h_go_to_line = Jumps to a specified line. h_go_up = Remonter d'un niveau. h_help = Afficher la page web de documentation. h_html_parser = The TagSoup parser will be used to convert HTML to XML. h_index_format = Le format des index a changé ; Veuillez créer de nouveaux indexes. h_input_bar = Activer/désactiver le champ de saisie. h_int_parser = Fault tolerant, and faster than Java’s default parser. h_languauge = Des analyseurs spécifiques à la langue vont être utilisés. h_large_db = La taille de la base de données est de %. Voulez-vous fermer\ncertaines visualisations pour accélerer les traitements ? h_map = Afficher la visualisation par carte. h_map_layout = Modifie la disposition de la carte. h_new = Crée une nouvelle base de données. h_new_file = Crée un nouveaux fichier XQuery. h_new_node = Crée un nouveau noeud XML. h_new_version = Une nouvelle version est disponible (% %)!\nVoulez-vous mettre à jour ? h_no_html_parser = No HTML parser is available; input will be treated as ordinary XML. h_open_file = Ouvre un fichier texte. h_open_manage = Administre les bases de données existantes. h_out_of_mem = Voici quelques suggestions qui peuvent vous aider :\n- augmenter la mémoire maximum allouée à Java avec le paramètre -Xmx\n- Choisir le parseur XML interne via la GUI ou via 'set intparse on'\n- Désactiver les index du texte et des attributs. h_packages = Allows to list, install, and delete XQuery packages. h_paste = Colle les noeuds précédemment copiés. h_path_index = Définir un index des chemins accélère les résolutions de chemins. h_plot = Afficher la visualisation par diagramme de dispersion. h_preferences = Affiche les préférences générales de l'application. h_properties = Montrer les informations de la base de données actuellement ouverte. h_query_info = Afficher le panneau d'info requête. h_recently_open = Fichiers récemment ouverts. h_replace = Searches and replaces text. h_reopen_file = Reopens the current file. h_result = Afficher la visualisation par results. h_rt_execution = Si cette option est activée, les requêtes sont executées après chaque saisie clavier. h_rt_filtering = Si cette option est activée, les results des requêtes sont filtrés automatiquement. h_save = Enregistre le fichier. h_save_result = Enregistre le resultat. h_show_history = Afficher l'historique des saisies. h_status_bar = Activer/désactiver la barre d'état. h_stemming = Les termes sont stemmés avant d'être indexés. h_stop_process = Stoppe le processus en cours. h_stopwords = Choisir une liste de mots vides pour ignorer les termes fréquents. h_table = Afficher la visualisation par tableau. h_text_index = Cet index accélère les comparaisons de texte dans les prédicats. h_tree = Afficher la visualiaation en arbre. h_tree_options = Options de la vue en arbre. h_updates = Afficher la page de mise à jour. h_used_mem = Si la mémoire est insuffisante, lancez\nBaseX avec le paramètre Java -Xmx. # Commands c_add1 = Ajouter ressource. c_add2 = Ajoute [%] comme [%] à la base de données. c_alter1 = Modifier nom base de données ou mot de passe utilisateur. c_alter2 = modifie nom base de données ou mot de passe utilisateur: c_alterdb = modifie le nom d'une base de données. c_alterpw = modifie le mot de passe d'un utilisateur. c_check1 = Ouvrir ou créer une base de données. c_check2 = Ouvre une base de données existante ou crée une nouvelle instance. c_close1 = Fermer la base de données. c_close2 = Ferme la base de données courante. c_copy1 = Copier la base de données. c_copy2 = Copie une base de données. c_create1 = Créer base de données, index, utilisateur, sauvegard ou évènement. c_create2 = Crée nouvelle base de données, index, utilisateur, sauvegard ou évènement : c_create3 = crée la base de données [%] avec [%] optionnel c_create4 = crée une sauvegarde pour la base de données [%] c_create5 = crée l'index specifié c_create8 = crée l'utilisateur specifié c_create9 = crée l'évènement c_cs1 = Evalue l'expression XQuery et définit le resultat comme nouveau contexte. c_cs2 = Evalue la requête et définit le resultat comme nouveau contexte. c_delete1 = Supprimer ressources. c_delete2 = Supprime ressources de la base de données courante. c_drop1 = Supprimer base de données, index, utilisateur, sauvegard ou évènement. c_drop2 = Supprime base de données, index, utilisateur, sauvegard ou évènement : c_drop21 = supprime la base de données c_drop22 = supprime l'index spécifié c_drop23 = supprime l'utilisateur spécifié (sur une base de données). c_drop24 = supprime la sauvegarde de la base de données c_drop25 = supprime l'évènement c_execute1 = Execute command script. c_execute2 = Executes the specified [%] as command script. c_exit1 = Quitter l'application. c_exit2 = Quitter %. c_export1 = Exporter la base de données en XML. c_export2 = Exporte la base de données vers [%]. c_find1 = Evaluer une requête par mot-clé. c_find2 = Les modificateurs suivants peuvent être utilisés :\n = : Rechercher exactement ce texte dans les noeuds texte"\n @= : Rechercher exactement ces atributs\n @ : Rechercher les attributs c_flush1 = Nettoyer la base de données. c_flush2 = Nettoie tous les buffers de base de données sur le disque. c_get1 = Afficher l'option globale. c_get2 = Affiche la valeur d'une option globale. c_grant1 = Octroyer les permissions utilisateur. c_grant2 = Octroie les permissions à un utilisateur (sur une base de données). c_help1 = Obtenir de l'aide sur les commandes % c_help2 = Si [%] est spécifié, l'information relative à la \ncommande est imprimée; sinon, toutes les commandes sont listées. c_info1 = Affiche les informations de la base de données courante. c_info21 = Affiche les informations de la base de données actuellement ouverte. c_info22 = aucun argument: voir informations globales c_info23 = Affiche les informations de la base de données c_info24 = Affiche les informations de l'index c_info25 = Afficher la table interne de la base de données c_inspect1 = Perform integrity checks. c_inspect2 = Checks the database for errors. c_kill1 = Fermer les sessions de l'utilisateur. c_kill2 = Ferme toutes les sessions de l'utilisateur spécifié. c_list1 = Lister les bases de données ou les ressources dans la base de données. c_list2 = Liste toutes les bases de données disponibles, ou les ressources\ndans une base de données [%]. c_open1 = Ouvrir base de données. c_open2 = Ouvre la base de données [%], filtré par [%]. c_optimize1 = Optimiser la base de données. c_optimize2 = Optimise la base de données actuellement ouverte.\nIf % est specifié, la taille de la base de données est réduite. c_password1 = Changer le mot de passe. c_password2 = Change le mot de passe de l'utilisateur. c_rename1 = Renommer le chemin des ressources dans la base de données. c_rename2 = Renomme le chemin des ressources dans la base de données courante. c_replace1 = Remplacer les ressources dans la base de données. c_replace2 = Remplace les ressources dans la base de données courante. c_repo1 = Installer, supprimer ou lister les paquets. c_repo2 = installe, supprime ou liste les paquets du dossier c_repo3 = supprime le paquet nommé [%] ou le dossier [%] c_repo4 = installe le paquet avec le chemin [%] c_repo5 = liste tous les paquets installés c_restore1 = Restaurer la base de données. c_restore2 = Restaure une base de données. L'argument peut inclure\nle timestamp du fichier de sauvegarde. c_retrieve1 = Récupérer les données brutes. c_retrieve2 = Récupère les données brutes du [%] spécifié. c_run1 = Run query or command script. c_run2 = Runs the contents of [%] as query or command script. c_set1 = Définir les options globales. c_set2 = Modifie la valeur d'une option de base de données. c_show1 = Montrer les informations du serveur. c_show21 = Montre les informations du serveur : c_show23 = montre les sessions de la base de données courante. c_show24 = montre les utilisateurs (sur une base de données). c_show25 = montre les backups. c_show26 = montre les events. c_store1 = Enregistrer les données brutes. c_store2 = Enregistre les données brutes dans le [%] specifié. c_xquery1 = Evalue l'expression XQuery. c_xquery2 = Evalue la requête specifiée et imprime le résultat. # Server texts; will be outsourced s_adlogin = Login administrateur (local ou distant) s_connect = Connexion s_connected = Connecté à %:%. s_createu = Créer utilisateur s_dbrevoke = La permission va être supprimée pour l'utilisateur logué. s_disconnected = Déconnecté. s_drquestion = % utilisateur(s) va (vont) être effacé(s). s_globperm = Permissions globales s_host = Hôte s_info1 = Cette fenêtre de dialogue ne sert qu'à l'administration de l'environement client/serveur. s_info2 = Cela n'a aucune incidence sur les autres fonctionalités de la GUI. s_locallogs = Logs locaux s_localport = Port local s_localserver = Serveur local s_locperm = Permissions locales s_port = Port s_sessions = Sessions s_alter = Modifier s_h_server_admin = Afficher le panneau d'administration du serveur pour la gestion des utilisateurs des logs. s_server_admin = Administration Serveurbasex-7.7.2/basex-core/src/main/resources/lang/German.lang000066400000000000000000000665661222453003200234170ustar00rootroot00000000000000# LANGUAGE FILE, TRANSLATED BY # BaseX Team OFF = AUS ON = AN about_% = Über % access_denied = Der Zugriff wurde verweigert. add = Hinzufügen add_raw_files = Speichere andere Dateien im Binärformat add_resources = Neue Ressourcen adjust_nodes = Knoten an Text anpassen admin_static_% = Admin-Benutzer kann nicht modifiziert werden. algorithm = Algorithmus all = All alter_pw = Passwort ändern and_others = und andere are_you_sure = Sind Sie sicher? attribute = Attribut attribute_index = Attribut-Index attributes = Attribute backup = Backup backup_dropped_% = Backup-Dateien '%' wurden gelöscht. backup_not_found_% = Kein Backup wurde für '%' gefunden. backups = Backups backups_% = % Backup(s) binaries = Binärdateien blue = Blau bold = Fett browse = Ändern buttons = Buttonleiste bye1 = Schönen Tag noch. bye2 = Ciao. bye3 = Bis dann. bye4 = Viel Spass. cancel = Abbrechen case_sensitivity = Groß- und Kleinschreibung check_for_updates = Nach Updates suchen chief_architect = Hauptentwickler children_text_len = Kindknoten/Textlänge choose_dir = Verzeichnis choose_font = Schriftart chop_ws = Leerzeichen entfernen chopped = Gekürztes clear = Leeren close = Schließen close_file_% = Änderungen speichern in %? color_schema = Farbschema colors = Farben command = Befehl command_canceled = Der Befehl wurde abgebrochen. comment = Kommentar community = Community compiling = Kompilierung connect = Verbinden connection_error = Der Server ist nicht erreichbar. copy = Kopieren copy_db = Datebank kopieren copy_path = Pfad kopieren create = Erstellen create_database = Datenbank-Optionen create_stats = Erstelle Statistiken creating_db = Datenbank wird angelegt creating_indexes = Indizes werden angelegt cut = Ausschneiden database = Datenbank database_path = Datenbank-Pfad (existierende Datenbanken werden nicht verschoben) databases = Datenbanken databases_% = % Datenbank(en) db_backup_% = Backup für '%' erstellt (%). db_closed_% = Die Datenbank '%' wurde geschlossen. db_copied_% = Kopie der Datenbank '%' erstellt. db_corrupt = Warnung: die Datenbank könnte beschädigt sein! db_created_%_% = Die Datenbank '%' wurde angelegt (%). db_dropped_% = Die Datenbank '%' wurde gelöscht. db_exists_% = Die Datenbank '%' existiert schon. db_exported_% = Datenbank '%' exportiert (%). db_flushed_% = Die Datenbank '%' wurde geschrieben (%). db_not_backup_% = Backup der Datenbank '%' konnte nicht erstellt werden. db_not_copied_% = Kopie der Datenbank '%' konnte nicht erstellt werden. db_not_dropped_% = Die Datenbank '%' konnte nicht gelöscht werden. db_not_found_% = Die Datenbank '%' wurde nicht gefunden. db_not_renamed_% = Die Datenbank '%' konnte nicht umbenannt werden. db_not_restored_% = '%' konnte nicht wiederhergestellt werden. db_opened_% = Datenbank '%' geöffnet (%). db_optimized_% = Die Datenbank '%' wurde optimiert (%). db_pinned_% = Die Datenbank '%' wird von einem anderen Prozess genutzt. db_props = Datenbank-Eigenschaften db_renamed_% = Die Datenbank '%' wurde in '%' umbenannt. db_restored_% = '%' wiederhergestellt (%). db_updated_% = Die Datenbank '%' wird gerade aktualisiert, oder das Update wurde nicht abgeschlossen. delete = Löschen delete_all = Alles löschen delete_nodes = Möchten Sie wirklich löschen? delete_packages_% = % Paket(e) werden gelöscht. diacritics = Diakritische Zeichen dir_not_empty = Verzeichnis ist nicht leer. disconnect = Trennen document = Dokument documents = Dokumente drop = Entfernen drop_backups_% = % Backup(s) werden gelöscht. dropping_db_% = % Datenbank(en) werden gelöscht. edit = Bearbeiten edit_% = % bearbeiten edit_data = Daten bearbeiten editor = Editor element = Element elements = Elemente empty_db = Eine leere Datenbank wird erstellt. encoding = Kodierung enter_db_name = Bitte geben Sie einen Datenbanknamen ein. entries_% = % Einträge error = Fehler evaluating = Ausführung event_created_% = Event '%' erzeugt. event_dropped_% = Event '%' entfernt. event_exists_% = Event '%' existiert schon. event_not_watched_% = Event '%' wurde nicht beobachtet. event_unknown_% = Unbekannter Event '%'. event_watched_% = Event '%' wird schon beobachtet. events_% = % Event(s) exec_error_% = % konnte nicht ausgeführt werden exit = Beenden expecting_cmd = Befehl erwartet. explorer = Explorer export = Exportieren file = Datei file_exists_% = % besteht bereits.\nMöchten Sie sie ersetzen? file_not_deleted_% = Die Datei '%' konnte nicht gelöscht werden. file_not_opened = Die Datei konnte nicht geöffnet werden. file_not_saved = Die Datei konnte nicht gespeichert werden. file_not_stored_% = Die Datei '%' konnte nicht gespeichert werden. file_or_dir = Eingabedatei oder Verzeichnis file_patterns = Dateimuster (getrennt durch Kommata) files_replace_% = Dateien in % werden ersetzt.\nWollen Sie weiterfahren? filter = Filtern filter_selected = Filtern finishing = Beenden first_line_header = Parse erste Zeile als Tabellenkopf folder = Verzeichnis fonts = Schriftart fullscreen = Vollbild fulltext = Volltext fulltext_index = Volltext-Index general = Allgemein general_info = Allgemeines global_option_% = Die globale Option '%' kann nicht verändert werden. go_back = Zurück go_forward = Weiter go_home = Wurzelknoten go_to_line = Gehe zu Zeile go_up = Hoch granted_%_% = % zugewiesen an '%'. granted_%_%_% = % zugewiesen an '%' für '%'. green = Grün gui_interactions = GUI & Interaktionen help = Hilfe help1_use_catalog = Zur Aktivierung des Catalog-Resolvers muss sich der help2_use_catalog = Apache XML Commons Resolver im Klassenpfad befinden. hit_s = Treffer index_attributes = Indiziere Attributwerte index_created_%_% = Index '%' angelegt (%). index_dropped_%_% = Index '%' gelöscht (%). index_fulltext = Indiziere Volltext index_not_dropped_% = Index '%' konnte nicht gelöscht werden. index_text = Indiziere Texte indexes = Indizes information = Information input_bar = Eingabeleiste input_format = Eingabe-Format input_path = Eingabepfad input_size = Größe der Eingabe insert_new_data = Neue Daten einfügen install = Installieren int_parser = Internen XML-Parser benutzen interrupted = Abgebrochen. invalid_% = % ist ungültig. invalid_value_%_% = Fehler beim Setzen von '%' auf '%'. italics = Kursiv java_lf = Verwende Java Look & Feel kill_self_% = '%' kann sich nicht selbst beenden. language = Sprache license = BSD-Lizenz line = Zeile line_% = Zeile % line_number = Line number main_options = Main Options manage_db = Datenbank-Verwaltung map = Map map_choice1 = Kein Titel, kein Rand map_choice2 = Kein Titel, kleiner Rand map_choice3 = Titel, kein Rand map_choice4 = Titel, kleiner Rand map_choice5 = Titel, großer Rand map_layout = Map-Layout match_case = Groß- und Kleinschreibung max_nr_of_hits = Maximale Trefferzahl method = Methode more_skipped_% = % weitere Datei(en) übersprungen multi_line = Mehrzeiliger Modus name = Name name_invalid_% = Der Name '%' ist ungültig. name_of_db = Name der Datenbank name_of_db_copy = Name der Datenbank Kopie names = Namen namespaces = Namespaces new = Neu new_db_question = Wollen Sie eine neue Datenbank erstellen? no = Nein no_data = Keine Daten verfügbar. no_db_dropped = Keine database wurde gelöscht. no_db_found = Keine Datenbank gefunden. no_db_opened = Keine Datenbank geöffnet. no_dir_allowed_% = "%" verweist auf ein Verzeichnis. no_help = Keine Hilfe verfügbar. no_mainmem = Der Befehl ist im Hauptspeicher-Modus nicht verfügbar. no_pixels = Zu wenig Pixel. no_stemmer_% = Kein Stemmer für die Sprache "%" verfügbar. no_tokenizer_% = Kein Tokenizer für die Sprache "%" verfügbar. nodes = Knoten nodes_parsed_% = % Knoten eingelesen not_available = Nicht verfügbar not_parsed_% = "%" konnte nicht eingelesen werden. number_children = Anzahl Kindknoten offsets = Offsets ok = OK only_backup = Nur als Backup verfügbar. open = Öffnen open_manage = Öffnen und verwalten optimize = Optimieren optimized_query = Optimierte Anfrage options = Options out_of_date = veraltet out_of_mem = Der Hauptspeicher ist voll. output_dir = Ausgabeverzeichnis overwrite_db = Existierende Datenbank wird überschrieben. packages = Pakete packages_% = % Paket(e) parameters = Parameter parse_archives = Parse Dateien in Archiven parse_as_jsonml = Parse Eingabe als JsonML parse_dtds = Parsen von DTDs und Entities parser_% = %-Parser parsing = Parsing password = Passwort paste = Einfügen path = Pfad path_added_%_% = Pfad '%' hinzugefügt (%). path_index = Pfadindex perm_required_% = %-Recht benötigt. perm_unknown_% = %-Recht ist unbekannt. pi = PI pkg_deleted_% = Das Paket '%' wurde gelöscht (%). pkg_installed_%_% = Das Paket '%' wurde installiert (%). pkg_replaced_%_% = Das Paket '%' wurde ersetzt (%). please_wait = Bitte warten plot = Plot port_twice_% = Der Port '%' wurde mehrfach angegeben. preferences = Einstellungen printed = Ausgegeben printing = Ausgabe properties = Eigenschaften pw_changed_% = Passwort von Benutzer '%' geändert. pw_not_valid = Passwort ist kein gültiger MD5-Hash. query = Anfrage query_executed_%_% = Anfrage% ausgeführt (%). query_info = Anfrage-Info query_plan = Ausführungsplan ratio = Verhältnis read_locking = Read Locks red = Rot redo = Wiederherstellen refresh = Aktualisieren regular_expr = Regulärer Ausdruck rename = Umbenennen rename_db = Datenbank umbenennen reopen = Neu öffnen reopen_file_% = Datei % neu öffnen und Änderungen verwerfen? replace_all = Alle ersetzen replace_with = Ersetzen mit requires_restart = nach Neustart res_deleted_%_% = % Ressource(n) wurden gelöscht (%). res_not_found = Ressource nicht gefunden. res_not_found_% = Ressource "%" nicht gefunden. res_props = Ressourcen-Eigenschaften res_renamed_%_% = % Ressource(n) wurden umbenannt (%). res_replaced_%_% = % Ressource(n) wurden ersetzt (%). reserved_mem = Reservierter Speicher reset = Zurücksetzen resources = Ressourcen restore = Wiederherstellen result = Ergebnis results_% = % Ergebnisse rt_execution = Echtzeit-Ausführung rt_filtering = Echtzeit-Filter rt_focus = Echtzeit-Mausfokus save = Speichern save_as = Speichern unter search = Suche select_all = Alles markieren separator = Trennzeichen sessions_% = % Verbindung(en) sessions_killed_% = % Verbindungen beendet. show_atts = Zeige Attribute show_name_atts = Ersetze Tags durch @name-Attribute similar_cmd_% = Alternative: "%" simple_file_chooser = Einfacher Datei-Dialog single_cmd = Einzelnes Kommando erwartet. size = Größe skip_corrupt_files = Ignoriere korrupte Dateien skipped = Übersprungen split_input_lines = Trennt den Text in einzelne Zeilen auf srv_running = Der Server läuft, oder der Zugriff wurde untersagt. srv_started_port_% = Server wurde gestartet (Port: %) srv_stopped_port_% = Server wurde gestoppt (Port: %) standard = Standard start = Start status_bar = Statusleiste stemming = Stemming stop = Stopp stopped_at = Gestoppt in stopword_list = Stoppwort-Liste strings_found_% = % String(s) wurden gefunden. strings_replaced = Strings wurden ersetzt. strip_ns = Namespaces entfernen syntax = Syntax table = Tabelle target_path = Zielpfad team = Team text = Text text_index = Text-Index text_length = Textlänge time_needed = Benötigte Zeit timeout_exceeded = Überschreitung des Time-Outs. timestamp = Zeitstempel timing = Zeit total_mem = Insgesamter Speicher total_time = Gesamt translation = Übersetzung tree = Baum tree_options = Tree-Optionen try_% = Infos via %. try_more_% = % zeigt die verfügbaren Befehle an. try_specific_% = Detaillierte Infos: %. type = Typ undo = Rückgängig unknown_cmd_% = Unbekannter Befehl: %. unknown_host_x = Unbekannter Host '%'. unknown_option_% = Unbekannte Option '%'. unknown_parser_% = Unbekannter Parser '%'. unknown_user_% = Unbekannter Benutzer '%'. unwatching_event_% = Von Event '%' abgemeldet. up_to_date = Up-to-date updated = Updates use_catalog_file = Use XML Catalog file used_mem = Genutzter Speicher user_created_% = Benutzer '%' erzeugt. user_dropped_% = Benutzer '%' entfernt. user_dropped_%_% = Benutzer '%' von Datenbank '%' entfernt. user_exists_% = Benutzer '%' existiert schon. user_logged_in_% = Benutzer '%' ist gerade eingeloggt. username = Benutzer users = Benutzer users_% = % Benutzer value = Wert version = Version view = Ansicht watching_event_% = Beobachte Event '%'. whole_word = Ganzes Wort write_locking = Write Locks ws_chopping = Entfernung von Leerzeichen xquery = XQuery yes = Ja # Help texts h_about = Zeigt allgemeine Projektinfos an. h_attr_index = Dieser Index beschleunigt Attributvergleiche in Prädikaten. h_browser_error_% = Browser konnte nicht geöffnet werden. Bitte die URL von Hand im Browser öffnen:\n\n% h_buttons = (De-)aktiviert die Buttonleiste. h_case = Groß- und Kleinschreibung wird im Index beibehalten. h_chop_ws = Diese Option entfernt Leerzeichen zwischen Tags und Textknoten. h_close = Schließt die aktuelle Datenbank. h_close_file = Schließt die gerade geöffnete Datei. h_colors = Stellt eine Farbpalette zur Auswahl. h_community = Zeigt die Community-Webseite. h_copy = Kopiert die derzeit ausgewählten XML-Knoten. h_copy_path = Kopiert den Pfad zu den ausgewählten XML-Knoten. h_db_format = Das Datenbankformat hat sich geändert; bitte verwenden Sie eine neuere Version. h_delete = Löscht XML-Knoten. h_diacritics = Diakritische Zeichen werden im Index beibehalten. h_edit = Bearbeitet den derzeit ausgewählten XML-Knoten. h_editor = Zeigt den Texteditor an. h_execute_query = Führt die Anfrage aus. h_exit = Beendet die Anwendung. h_explorer = Zeigt den Explorer an. h_export = Exportiert die aktuelle Datenbank. h_filter_selected = Filtert die derzeit ausgewählten Knoten. h_folder = Zeigt die Verzeichnisansicht an. h_fonts = Stellt einen Schriftdialog zur Auswahl. h_fullscreen = Wechselt in den Vollbild-Modus. h_fulltext_index = Ein Volltext-Index beschleunigt Volltext-Anfragen. h_go_home = Springt zum Wurzelverzeichnis der Datenbank. h_go_to_line = Springt zu einer angegebenen Zeile. h_go_up = Wechselt eine Ebene nach oben. h_help = Zeigt die Dokumentations-Webseite. h_html_parser = Der TagSoup-Parser wird verwendet, um HTML in XML zu konvertieren. h_index_format = Das Indexformat hat sich geändert; bitte erstellen Sie neue Indizes. h_input_bar = (De-)aktiviert das Eingabefeld. h_int_parser = Fehlertolerant und schneller als Javas XML-Parser. h_languauge = Sprachspezifische Text-Parser werden verwendet. h_large_db = Die zu öffnende Datenbank ist % groß. Wollen Sie einige\nVisualisierungen schließen, um die Arbeit zu beschleunigen? h_map = Zeigt die TreeMap-Ansicht an. h_map_layout = Ändert das Map-Layout. h_new = Erzeugt eine neue Datenbank. h_new_file = Erzeugt eine neue Datei. h_new_node = Erzeugt einen neuen XML-Knoten. h_new_version = Eine neue Version ist verfügbar (% %)!\nWollen Sie updaten? h_no_html_parser = Kein HTML-Parser gefunden; Eingabe wird als gewöhnliches XML geparst. h_open_file = Öffnet eine existierende Datei. h_open_manage = Öffnet und verwaltet existierende Datenbanken. h_out_of_mem = Die folgenden Hinweise helfen vielleicht weiter:\n- Erhöhen Sei den verfügbaren Speicher mit dem Java-Flag -Xmx\n- deaktivieren Sie die Text- und Attribut-Indizes. h_packages = Auflisten, Installieren und Löschen von Paketen. h_paste = Fügt kopierte XML-Knoten in die Datenbank ein. h_path_index = Ein Path Summary beschleunigt Pfadauflösungen. h_plot = Zeigt die Scatterplot-Ansicht an. h_preferences = Zeigt allgemeine Programmeinstellungen an. h_properties = Zeigt Informationen über die aktuelle Datenbank an. h_query_info = Zeigt Informationen über die Anfrageausführung an. h_recently_open = Zuletzt geöffnete Dateien. h_reopen_file = Öffnet eine existierende Datei erneut. h_replace = Sucht und ersetzt Text. h_result = Zeigt die Ergebnisansicht an. h_rt_execution = Wenn die Option aktiviert ist, werden Suchen nach jedem Tastenklick ausgeführt. h_rt_filtering = Wenn die Option aktiviert ist, werden Suchergebnisse automatisch gefiltert. h_save = Speichert die Datei. h_save_result = Speichert das Ergebnis. h_show_history = Auswahl der letzten Texteingaben. h_status_bar = (De-)aktiviert die Statusleiste. h_stemming = Begriffe werden vor der Indexierung auf die Stammform reduziert. h_stop_process = Stoppt den aktuellen Prozess. h_stopwords = Auswahl einer Stoppwort-Liste, um häufige Begriffe zu ignorieren. h_table = Zeigt die tabellarische Ansicht an. h_text_index = Dieser Index beschleunigt Textvergleiche in Prädikaten. h_tree = Zeigt die Baum-Ansicht an. h_tree_options = Options für die TreeView. h_updates = Zeigt die Update-Webseite. h_used_mem = Der verfügbare Speicher kann mit dem Java-Flag -Xmx erhöht werden. # Commands c_add1 = Hinzufügen von Ressourcen. c_add2 = Fügt der Datenbank eine Ressource [%] als [%] hinzu. c_alter1 = Ändern von Benutzerpasswörtern oder Datenbanknamen. c_alter2 = Ändert ein Benutzerpasswort oder einen Datenbanknamen: c_alterdb = ändert den Namen einer Datenbank. c_alterpw = ändert das Passwort eines Benutzers. c_check1 = Öffnet oder erzeugt eine Datenbank. c_check2 = Öffnet eine existierende Datenbank oder erstellt eine neue Instanz. c_close1 = Schließen der Datenbank. c_close2 = Schließt die aktuell geöffnete Datenbank. c_copy1 = Kopiert Datenbank. c_copy2 = Kopiert eine Datenbank. c_create1 = Erstellung einer Datenbank, eines Index, Benutzers, Backups or Ereignisses. c_create2 = Erstellt eine neue Datenbank, einen Index, Benutzer,\nein Backup oder Ereignis: c_create3 = erstellt die Datenbank [%] mit optionalem [%] c_create4 = erstellt ein Backup der Datenbank [%] c_create5 = erstellt den angegebenen Index c_create8 = erstellt den angegebenen Benutzer c_create9 = erstellt den angegebenen Event c_cs1 = Ausführung einer Anfrage und Wechsel zu neuer Kontextmenge. c_cs2 = Führt die angegebene XQuery aus und setzt das\nErgebnis als neue Kontextmenge. c_delete1 = Entfernen von Ressourcen. c_delete2 = Entfernt Ressourcen aus der geöffneten Datenbank. c_drop1 = Entfernen einer Datenbank, eines Index oder Benutzers. c_drop2 = Entfernt eine Datenbank, einen Index, Benutzer,\nein Backup oder Ereignis: c_drop21 = entfernt die Datenbank c_drop22 = entfernt den angegebenen Index c_drop23 = entfernt den angegebenen Benutzer (einer Datenbank). c_drop24 = entfernt das Datenbank-Backup c_drop25 = entfernt den Event c_execute1 = Execute command script. c_execute2 = Executes the specified [%] as command script. c_exit1 = Beenden des Programms. c_exit2 = Beendet %. c_export1 = Export der Datenbank nach XML. c_export2 = Exportiert die Datenbank nach [%]. c_find1 = Ausführung einer Schlüsselwort-Anfrage. c_find2 = Die folgenden Modifikatoren sind erlaubt:\n = : sucht nach exakten Textknoten\n @= : sucht nach exakten Attributen\n @ : sucht nach Attributen c_flush1 = Schreiben der Datenbank. c_flush2 = Schreibt die Datenbank-Buffer auf die Festplatte. c_get1 = Anzeige globaler Datenbankoptionen. c_get2 = Zeigt den Wert einer globalen Option an. c_grant1 = Zuweisung von Benutzerrechten. c_grant2 = Weist einem Benutzer (für eine Datenbank) Rechte zu. c_help1 = Hilfe für %-Befehle. c_help2 = Wenn [%] angegeben wurde, werden Informationen\nzum eingegebenen Befehl dargestellt; ansonsten werden\nalle Befehle aufgelistet. c_info1 = Anzeige von Datenbank-Informationen. c_info21 = Zeigt Informationen über die geöffneten Datenbank: c_info22 = kein Argument: zeigt allgemeine Information an c_info23 = zeigt Datenbank-Informationen an c_info24 = zeigt Index-Informationen an c_info25 = zeigt interne Datenbanktabelle an c_inspect1 = Durchführung von Integritätstests. c_inspect2 = Überprüft die Datenbank auf Fehler. c_kill1 = Beendung der Verbindungen. c_kill2 = Beendet alle Verbindungen des angegebenen Benutzers. c_list1 = Anzeige aller Datenbanken oder Ressourcen einer Datenbank. c_list2 = Listet alle Datenbanken, oder die Ressourcen der\nDatenbank [%], begrenzt auf [%]. c_open1 = Öffnen einer Datenbank. c_open2 = Öffnet die Datenbank [%], begrenzt auf [%]. c_optimize1 = Optimierung der Datenbank. c_optimize2 = Optimiert die geöffnete Datenbank.\nWenn % angegeben wurde, wird die Datenbankgröße minimiert. c_password1 = Ändern des Passworts. c_password2 = Ändert das Passwort des angemeldeten Benutzers. c_rename1 = Umbenennung von Ressourcen. c_rename2 = Benennt Ressouren in der geöffneten Datenbank um. c_replace1 = Ersetzung von Datenbank-Ressourcen. c_replace2 = Ersetzt Ressourcen in der geöffneten Datenbank. c_repo1 = Installation, Entfernen oder Auflisten von Paketen. c_repo2 = Installiert, entfernt oder listet installierte Pakete auf: c_repo3 = entfernt das Paket mit dem Namen [%] oder dem Verzeichnis [%] c_repo4 = installiert das Paket mit dem Pfad [%] c_repo5 = listet alle installierten Pakete auf c_restore1 = Wiederherstellung der Datenbank. c_restore2 = Stellt eine Datenbank wieder her. Das Argument\nkann den Zeitstempel des Backup-Files beinhalten. c_retrieve1 = Anfrage von Rohdaten. c_retrieve2 = Liefert Rohdaten vom Pfad [%] zurück. c_run1 = Run query or command script. c_run2 = Runs the contents of [%] as query or command script. c_set1 = Setzen von allgemeinen Optionen. c_set2 = Setzt eine Datenbankoption auf einen neuen Wert. c_show1 = Anzeige von Server-Informationen. c_show21 = Zeigt Server-Informationen an: c_show23 = zeigt aktuelle Datenbankverbindungen. c_show24 = zeigt registrierte Benutzer (einer Datenbank). c_show25 = zeigt Backups an. c_show26 = zeigt Events an. c_store1 = Speicherung von Rohdaten. c_store2 = Speichert Rohdaten am angegebenen Pfad [%]. c_xquery1 = Ausführung einer XQuery-Anfrage. c_xquery2 = Führt eine XQuery-Anfrage aus und zeigt das Ergebnis an. # Server texts; will be outsourced s_adlogin = Administrator-Login (lokal oder remote) s_connect = Verbindung s_connected = Verbunden mit %:%. s_createu = Benutzer anlegen s_dbrevoke = Recht wird vom eingeloggten Benutzer entfernt. s_disconnected = Verbindung wurde getrennt. s_drquestion = % Benutzer werden entfernt. s_globperm = Globale Rechte s_host = Host s_info1 = Dieser Dialog ist nur zur Administration der Client-/Server-Umgebung gedacht. s_info2 = Er hat keine Auswirkungen auf die anderen GUI-Features. s_locallogs = Lokale Logs s_localport = Lokaler Port s_localserver = Lokaler Server s_locperm = Lokale Rechte s_port = Port s_sessions = Verbindungen s_alter = Ändern s_h_server_admin = Zeigt die Server-Administration zur Verwaltung von Benutzern und Log-Files an. s_server_admin = Server-Administration basex-7.7.2/basex-core/src/main/resources/lang/Indonesian.lang000066400000000000000000000641261222453003200242630ustar00rootroot00000000000000# LANGUAGE FILE, TRANSLATED BY # Andria Arisal OFF = OFF ON = ON about_% = Perihal % access_denied = Akses ditolak. add = Tambah add_raw_files = Tambah berkas yang tersisa sebagai berkas mentah add_resources = Tambah sumber daya adjust_nodes = Sesuaikan simpul dengan teks admin_static_% = Pengguna Admin tidak dapat diubah. algorithm = Algoritma all = Semua alter_pw = Ubah kata sandi and_others = dan lainnya are_you_sure = Apakah anda yakin? attribute = Atribut attribute_index = Indeks Atribut attributes = Atribut backup = Cadangan backup_dropped_% = Berkas cadangan '%' telah dihapus. backup_not_found_% = Tidak ada cadangan untuk '%'. backups = Cadangan backups_% = % cadangan binaries = Biner blue = Biru bold = Tebal browse = Telusur buttons = Tombol bye1 = Sampai jumpa. bye2 = Salam. bye3 = Selamat bersenang-senang. bye4 = Sampai jumpa lagi. cancel = Batal case_sensitivity = Sensitifitas bentuk check_for_updates = Periksa Pembaruan chief_architect = Arsitek Kepala children_text_len = Anak/panjng teks choose_dir = Pilih direktori choose_font = Pilih Huruf chop_ws = Potong spasi chopped = terpotong clear = Bersih close = Tutup close_file_% = Simpan perubahan ke %? color_schema = Skema Warna colors = Warna command = Perintah command_canceled = Perintah dibatalkan. comment = Komentar community = Komunitas compiling = Mengompilasi connect = Menyambung connection_error = Tidak dapat terhubung dengan server. copy = Salin copy_db = Salin Basis data copy_path = Salin Jalur create = Buat create_database = Buat Basis data create_stats = Buat statistik creating_db = Membuat Basis data creating_indexes = Membuat Indeks cut = Potong database = Basis Data database_path = Jalur Basis Data (basis data yang ada tidak akan dipindahkan) databases = Basis Data databases_% = % basis data db_backup_% = Cadangan untuk '%' telah dibuat di %. db_closed_% = Basis data '%' telah ditutup. db_copied_% = Salinan '%' telah dibuat di %. db_corrupt = Peringatan: Basis data mungkin rusak! db_created_%_% = Basis data '%' telah dibuat di %. db_dropped_% = Basis data '%' telah dihapus. db_exists_% = Basis data '%' telah ada. db_exported_% = Basis data '%' telah diekspor di %. db_flushed_% = Basis data '%' telah dialirkan ke %. db_not_backup_% = Cadangan basis data '%' tidak dapat dibuat. db_not_copied_% = Salinan dari '%' tidak dapat dibuat. db_not_dropped_% = Basis data '%' tidak dapat dihapus. db_not_found_% = Basis data '%' tidak ditemukan. db_not_renamed_% = Basis data '%' tidak dapat diganti nama. db_not_restored_% = '%' tidak dapat dipulihkan. db_opened_% = Basis data '%' telah dibuka di %. db_optimized_% = Basis data '%' telah dioptimasi di %. db_pinned_% = Basis data '%' sedang dibuka oleh klien yang lain. db_props = Sifat Basis data db_renamed_% = Basis data '%' telah diganti nama menjadi '%'. db_restored_% = '%' telah dipulihkan di %. db_updated_% = Basis data '%' sedang dimutakhirkan, atau pemutakhiran tidak selesai delete = Hapus delete_all = Hapus semua delete_nodes = Apakah anda ingin menghapusnya? delete_packages_% = % pater akan dihapus. diacritics = Diakritik dir_not_empty = Direktori tidak kosong. disconnect = Putus document = Dokumen documents = Dokumen drop = Hancur drop_backups_% = % cadangan akan dihancurkan. dropping_db_% = % basis data akan dihancurkan. edit = Sunting edit_% = Sunting % edit_data = Sunting data editor = Penyunting element = Elemen elements = Elemen empty_db = Sebuah basis data kosong akan dibuat. encoding = Encoding enter_db_name = Silahkan masukkan nama basis data. entries_% = % masukan error = Error evaluating = Mengevaluasi event_created_% = Kejadian '%' telah dibuat. event_dropped_% = Kejadian '%' telah dihapus. event_exists_% = Kejadian '%' sudah ada. event_not_watched_% = Kejadian '%' tidak diamati. event_unknown_% = Kejadian '%' tidak diketahui. event_watched_% = Sudah sedang mengamati kejadian '%'. events_% = % kejadian exec_error_% = Tidak dapat menjalankan % exit = Keluar expecting_cmd = Mengharapkan perintah. explorer = Penelusur export = Ekspor file = Berkas file_exists_% = % sudah ada.\nApakah anda ingin menggantinya? file_not_deleted_% = Berkas '%' tidak dapat dihapus. file_not_opened = Berkas tidak dapat dibuka. file_not_saved = Berkas tidak dapat disimpan. file_not_stored_% = Berkas '%' tidak dapat disimpan. file_or_dir = Masukkan berkas atau direktori file_patterns = Pola berkas (dipisakan dengan koma) files_replace_% = Berkas akan diganti di %.\nApakah anda ingin melanjutkan? filter = Saringan filter_selected = Saringan dipilih finishing = Menyelesaikan first_line_header = Gunakan baris pertama sebagai kepala tabel folder = Map fonts = Huruf fullscreen = Layar penuh fulltext = Teks-Penuh fulltext_index = Indeks Teks-Penuh general = Umum general_info = Informasi umum global_option_% = Global option '%' cannot be set. go_back = Kembali go_forward = Maju go_home = Pulang go_to_line = Menuju ke baris go_up = Ke atas granted_%_% = % diberikan kepada '%'. granted_%_%_% = % diberikan kepada '%' untuk '%'. green = Hujau gui_interactions = GUI & Interaksi help = Bantuan help1_use_catalog = Untuk mengaktifkan penyelesaian katalog pastikan help2_use_catalog = Apache XML Commons Resolver ada dalam classpath anda. hit_s = mengenai sasaran index_attributes = Mengindeks atribut index_created_%_% = Indeks '%' dibuat di %. index_dropped_%_% = Indeks '%' dihapus di %. index_fulltext = Mengindeks Full-Text index_not_dropped_% = Indeks '%' tidak dapat dihapus. index_text = Mengindeks Teks indexes = Indeks information = Informasi input_bar = Balok masukan input_format = Format masukan input_path = Jejak masukan input_size = Ukuran masukan insert_new_data = Masukkan data baru install = Install int_parser = Gunakan XML parser internal interrupted = Terganggu. invalid_% = % tidak sah. invalid_value_%_% = Tidak dapat mengatur '%' menjadi '%'. italics = Miring java_lf = Gunakan Java Look & Feel kill_self_% = '%' tidak dapat mematikan sendiri. language = Bahasa license = Lisensi BSD line = Baris line_% = Baris % line_number = Line number main_options = Pilihan utama manage_db = Kelola Basis data map = Peta map_choice1 = Tanpa Judul, tanpa Pembatas map_choice2 = Tanpa Judul, Pembatas kecil map_choice3 = Dengan Judul, tanpa Pembatas map_choice4 = Dengan Judul, Pembatas kecil map_choice5 = Dengan Judul, Pembatas besar map_layout = Susunan Peta match_case = Match Case max_nr_of_hits = Jumlah temuan maksimum method = Metode more_skipped_% = % lebih berkas dilewatkan multi_line = Moda banyak baris name = Nama name_invalid_% = Nama '%' tidak sah. name_of_db = Nama basis data name_of_db_copy = Nama salinan basis data names = Nama namespaces = Namespaces new = Baru new_db_question = Apakah anda ingin membuat yang baru? no = Tidak no_data = Tidak ada data yang tersedia. no_db_dropped = Tidak ada basis data yang dihapus. no_db_found = Tidak ada basis data yang ditemukan. no_db_opened = Tidak ada basis data yang dibukan. no_dir_allowed_% = "%" menunjuk ke direktori. no_help = Maaf, tidak ada bantuan yang tersedia. no_mainmem = Perintah tidak tersedia di mode main memory. no_pixels = Tidak cukup ruang. no_stemmer_% = Tidak ada pemotong yang tersedia untuk bahasa "%". no_tokenizer_% = Tidak ada penmbuat token yang tersedia untuk bahasa "%". nodes = Simpul nodes_parsed_% = % simpul diuraikan not_available = Tidak tersedia not_parsed_% = "%" tidak dapat diuraikan. number_children = Jumlah anak offsets = Pengimbang ok = OK only_backup = Hanya tersedia sebagai cadangan. open = Buka open_manage = Buka & Kelola optimize = Optimisasi optimized_query = Dioptimalkan kueri options = Pilihan out_of_date = kuno out_of_mem = Keluar dari Memori utama. output_dir = Direktori keluaran overwrite_db = Basis data lama akan ditimpa. packages = Paket packages_% = % Paket parameters = Parameter parse_archives = Uraikan berkas yang didalam arsip parse_as_jsonml = Uraikan masukan sebagai JsonML parse_dtds = Uraikan DTD dan entitas parser_% = % Parser parsing = Menguarikan password = Kata kunci paste = Tempel path = Jejak path_added_%_% = Jejak "%" ditambahkan di %. path_index = Ringkasan jejak perm_required_% = % izin dibutuhkan. perm_unknown_% = % izin tidak diketahui. pi = PI pkg_deleted_% = Paket '%' terhapus. pkg_installed_%_% = Paket '%' terpasang di %. pkg_replaced_%_% = Paket '%' diganti di %. please_wait = Mohon tunggu plot = Alur port_twice_% = Alur '%' dinyatakan dua kali. preferences = Perasa printed = Tercetak printing = Mencetak properties = Sifat pw_changed_% = Kata kunci dari pengguna '%' telah berubah. pw_not_valid = Kata kunci tidak sesuai dengan MD5 hash. query = Kueri query_executed_%_% = Kueri% dijalankan dalam %. query_info = Informasi Kueri query_plan = Rencana kueri ratio = Rasio read_locking = Read Locking red = Merah redo = Ulangi refresh = Segarkan regular_expr = Regular Expression rename = Ganti Nama rename_db = Ganti nama Basis data replace_all = Ganti semua replace_with = Ganti dengan requires_restart = Membutuhkan start lagi res_deleted_%_% = % sumber dihapus di %. res_not_found = Sumber tidak ditemukan. res_not_found_% = Sumber "%" tidak ditemukan. res_props = Sifat sumber daya res_renamed_%_% = % sumber diubah nama di %. res_replaced_%_% = % sumber diganti di %. reserved_mem = Memori cadangan reset = Reset resources = Sumber daya restore = Selamatkan result = Hasil results_% = % Hasil reopen = Buka lagi reopen_file_% = Buka lagi % dan abaikan perubahan? rt_execution = Eksekusi waktu nyata rt_filtering = Penyaringan waktu nyata rt_focus = Fokus tetikus waktu nyata save = Simpan save_as = Simpan sebagai search = Cari select_all = Pilih Semua separator = Pemisah sessions_% = % sesi sessions_killed_% = % sesi ditutup. show_atts = Tampilkan Atribut show_name_atts = Ganti tag dengan atribut @name similar_cmd_% = Apakah yang anda maksud adalah '%'? simple_file_chooser = Gunakan pemilih berkas sederhana single_cmd = Satu perintah diharapkan. size = Ukuran skip_corrupt_files = Lewatkan berkas yang rusak (tidak sesuai format) skipped = Terlewat split_input_lines = Potong masukan menjadi baris srv_running = Servis sudah berjalan atau izin ditolak. srv_started_port_% = Server sudah dijalankan (alur: %) srv_stopped_port_% = Server sudah dihentikan (alur: %) standard = Standar start = Mulai status_bar = Batang status stemming = Memotong stop = Henti stopped_at = Berhenti pada stopword_list = Daftar kata henti strings_found_% = % kata ditemukan. strings_replaced = Kata telah diganti. strip_ns = Hapus namespaces syntax = Sintaks table = Tabel target_path = Jejak tujuan team = Tim text = Teks text_index = Indeks Teks text_length = panjang teks time_needed = Waktu yang dibutuhkan timeout_exceeded = Melebihi batas waktu. timestamp = Tanda waktu timing = Pewaktu total_mem = Jumlah Memori total_time = Jumlah Waktu translation = Penterjemahan tree = Pohon tree_options = Pilihan Pohon try_% = Coba %. try_more_% = Coba % untuk mendapatkan informasi yang lebih banyak. try_specific_% = Cob % untuk mendapatkan informasi untuk perintah tertentu. type = Jenis undo = Kembali unknown_cmd_% = Perintah tidak diketahui: %. unknown_host_x = Host '%' tidak dikenal. unknown_option_% = Pilihan '%' tidak dikenal. unknown_parser_% = Parser '%' tidak dikenal. unknown_user_% = Pengguna '%' tidak diketahui. unwatching_event_% = Kejadian '%' tidak diamati. up_to_date = Termutakhir updated = Termutakhirkan use_catalog_file = Gunakan berkas katalog XML used_mem = Memori yang digunakan user_created_% = Pengguna '%' terbuat. user_dropped_% = Pengguna '%' terhapus. user_dropped_%_% = Pengguna '%' terhapus dari '%'. user_exists_% = Pengguna '%' sidah ada. user_logged_in_% = Pengguna '%' sedang didalam. username = Nama pengguna users = Pengguna users_% = % pengguna value = Nilai version = Versi view = Lihat watching_event_% = Amati kejadian '%'. whole_word = Seluruh kata write_locking = Write Locking ws_chopping = Pemotongan spasi xquery = XQuery yes = Ya # Help texts h_about = Menampikan informasi umum mengenai proyek. h_attr_index = Indeks ini mempercepat perbandingan atribut dengan predikat. h_browser_error_% = Gagal membuka peramban.\nMohon buka URL secara terpandu:\n\n% h_buttons = Pengubah papan tombol hidup/mati. h_case = Sensitifitas bentuk dipertahankan dalam indeks. h_chop_ws = Pilihan ini menghilangkan spasi antara tag dan isi. h_close = Tutup basis data ini. h_close_file = Tutup berkas yang terbuka. h_colors = Bolehkan untuk merubah warna aplikasi. h_community = Tampilkan halaman web komunitas. h_copy = Salin simpul XML yang terpilih. h_copy_path = Salin jejak ke simpul XML yang terpilih. h_db_format = Bentuk basis data telah berubah; mohon buat basis data baru h_delete = Hapus simpul XML. h_diacritics = Diakritik dipertahankan dalam indeks. h_edit = Edit simpula XML. h_editor = Tampilkan editor teks. h_execute_query = Jalankan kueri. h_exit = Keluar dari aplikasi. h_explorer = Tampilkan papan penjelajah. h_export = Ekspor basis data sekarang. h_filter_selected = Saring simpul terpilih. h_folder = Tampilkan visualiasasi map. h_fonts = Bolehkan untuk mengubah huruf yang digunakan. h_fullscreen = Beralih ke layar penuh. h_fulltext_index = Indeks teks penuh mempercepat kueri teks penuh. h_go_home = Melompat ke simpul akar. h_go_to_line = Jumps to a specified line. h_go_up = Pindah ke satu tingkat diatas. h_help = Tampilkan halaman web dokumentasi. h_html_parser = Parser TagSoup akan digunakan untuk mengubah HTML menjadi XML. h_index_format = Bentuk indeks telah berubah; mohon buat indeks baru. h_input_bar = Pengubah tempat masukan hidup/mati. h_int_parser = Toleran kesalahan, dan lebih cepat dari parser standar Java. h_languauge = Pengurai teks bahasa tertentu akan digunakan. h_large_db = Basis data % besar. Apakah anda ingin untuk menutup\nbeberapa visualisasi untuk mempercepat pemrosesan? h_map = Tampilkan visualisasi peta. h_map_layout = Ubah susunan peta. h_new = Buat satu basis data baru. h_new_file = Buat satu berkas baru. h_new_node = Buat satu simpul XML baru. h_new_version = Versi yang baru telah tersedia (% %)!\nApakah anda ingin pemutakhiran? h_no_html_parser = Tidak ada parser HTML yang tersedia; masukan akan diperlakukan sebagai XML biasa. h_open_file = Buka satu berkas yang ada. h_open_manage = Kelola basis data yang ada. h_out_of_mem = Petunjuk berikut mungkin dapat membantu anda:\n- naikkan ukuran heap Java dengan penanda -Xmx\n- pilih pengurai XML internal dalam GUI atau melalui 'set intparse on'\n- matikan indeks teks dan indeks atribut. h_packages = Membolehkan untuk menuraikan, menginstall, dan menghapus paket XQuery. h_paste = Tempel simpul yang telah disalin sebelumnya. h_path_index = Ringkasan jejak mempercepat penemuan jejak. h_plot = Tampilkan visualisai titik tersebar. h_preferences = Tampilkan perasa aplikasi umum. h_properties = Tampilkan informasi dari basis data yang sedang terbuka. h_query_info = Tampilkan papan informasi kueri. h_recently_open = Sedakan jalan pintas untuk berkas yang baru terbuka. h_replace = Cari dan ganti teks. h_result = Tampilkan tampilan teks. h_reopen_file = Buka kembali berkas yang sama. h_rt_execution = Jika pilihan ini dipilih, kueri dieksekusi sesudah mencetek kunci. h_rt_filtering = Jika pilihan ini dipilih, hasil kueri akan disaring secara otomatis. h_save = Simpan berkas. h_save_result = Simpan hasil. h_show_history = Tampilkan sejarah masukan. h_status_bar = Pengubah papan status hidup/mati. h_stemming = Istilah dipotong sebelum diindeks. h_stop_process = Hentikan proses sekarang. h_stopwords = Pilih suatu daftar kata henti untuk melewatkan istilah yang sering muncul. h_table = Tampilkan visualisasi table. h_text_index = Indeks ini mempercepat pembandingan teks dan predikat. h_tree = Tampilkan visualisasi pohon. h_tree_options = Pilihan untuk visualisasi pohon. h_updates = Tampilkan halaman web pemutakhiran. h_used_mem = Jika memori kurang, mohon jalankan\nBaseX dengan penanda Java -Xmx. # Commands c_add1 = Tambahkan sumber ke dalam basis data. c_add2 = Tambahkan [%] sebagai [%] ke dalam basis data. c_alter1 = Ganti nama basis data atau kata kunci pengguna. c_alter2 = Ganti nama basis data atau kata kunci pengguna: c_alterdb = ganti nama basis data. c_alterpw = ganti kata kunci satu pengguna. c_check1 = Buka atau buat basis data. c_check2 = Buka satu basis data yang sudah ada atau buat satu contoh baru. c_close1 = Tutup basis data sekarang. c_close2 = Tutup basis data yang sedang terbuka. c_copy1 = Salin basis data c_copy2 = Salin satu basis data. c_create1 = Buat basis data, indeks pengguna atau kejadian. c_create2 = Buat basis data, indeks pengguna atau kejadian: c_create3 = buat basis data [%] dengan satu pilihan [%] c_create4 = buat cadangan dari basis data [%] c_create5 = buat indeks yang ditentukan c_create8 = buat pengguna yang ditentukan c_create9 = buat kejadian c_cs1 = Jalankan XQuery dan jadikan hasil sebagai himpunan konteks yang baru. c_cs2 = Jalankan XQuery dan jadikan hasil sebagai himpunan konteks yang baru. c_delete1 = Hapus sumber dari basis data. c_delete2 = Hapus sumber dari basis data yang sedang terbuka. c_drop1 = Hapus basis data, indeks atau pengguna. c_drop2 = Hapus basis data, indeks atau pengguna: c_drop21 = hapus basis data c_drop22 = hapus indeks yang ditentukan c_drop23 = hapus pengguna yang ditentukan (dalam satu basis data). c_drop24 = hapus cadangan basis data c_drop25 = hapus kejadian c_execute1 = Eksekusi skrip perintah. c_execute2 = Eksekusi [%] tertentu sebagai skrip perintah. c_exit1 = Keluar dari aplikasi. c_exit2 = Keluar %. c_export1 = Ekspor basis data ke XML. c_export2 = Ekspor basis data ke [%]. c_find1 = Jalankan kueri satu kata kunci. c_find2 = Temukan kata kunci dalam satu basis data. c_flush1 = Salurkan basis data. c_flush2 = Salurkan semua basis data penyangga ke cakram. c_get1 = Tampilkan pilihan umum. c_get2 = Tampilkan nilai dari pilihan umum. c_grant1 = Memberikan izin pengguna. c_grant2 = Memberikan izin (dalam satu basis data) untuk pengguna. c_help1 = Dapatkan bantuan untuk perintah %. c_help2 = Jika [%] ditentukan, informasi dalam perintah tertentu\ndicetak; sebaliknya, semua perintah didaftarkan. c_info1 = Tampilkan informasi dari basis data sekarang. c_info21 = Tampilkan informasi dari basis data yang sedang terbuka: c_info22 = tanpa penjelasan: tampilkan informasi umum c_info23 = tampilkan informasi basis data c_info24 = tampilkan informasi indeks c_info25 = tampilkan tabel basis data internal c_inspect1 = Lakukan pemeriksaan integritas. c_inspect2 = Periksa basis data dari kesalahan. c_kill1 = Matikan sesi pengguna. c_kill2 = Matikan semua sesi dari pengguna tertentu. c_list1 = Daftar basis data atau sumber dalam basis data. c_list2 = Daftar semua basis data yang tersedia, atau sumber\ndalam satu basis data [%]. c_open1 = Buka basis data. c_open2 = Buka basis data [%]. c_optimize1 = Optimisasi basis data. c_optimize2 = Optimisasi basis data yang sedang terbuka.\nJika % ditentukan, ukuran basis data diminimalisasi. c_password1 = Ubah kata kunci. c_password2 = Ubah kata kunci pengguna. c_rename1 = Ganti nama jejak sumber dalam basis data. c_rename2 = Ganti nama jejak sumber dalam basis data sekarang. c_replace1 = Ganti sumber dalam basis data. c_replace2 = Ganti sumber dalam basis data sekarang. c_repo1 = Pasang, hapus atau daftar paket. c_repo2 = pasang, hapus atau daftar paket dalam tempat penyimpanan c_repo3 = hapus paket dengan nama [%] atau direktori [%] c_repo4 = pasang paket dengan jejak [%] c_repo5 = daftarkan semua paket yang terpasang c_restore1 = Selamatkan basis data. c_restore2 = Selamatkan satu basis data. Penjelasan dalat berupa\nwaktu tanda dari berkas cadangan. c_retrieve1 = Tarik data mentah. c_retrieve2 = Tarik data mentah dari yang ditentukan [%]. c_run1 = Run query or command script. c_run2 = Runs the contents of [%] as query or command script. c_set1 = Atur pilihan umum. c_set2 = Atur pilihan dari satu basis data menjadi satu nilai yang baru. c_show1 = Tampilkan informasi server. c_show21 = Tampilkan informasi server: c_show23 = tampilkan sesi basis data sekarang. c_show24 = tampilkan pengguna (dalam satu basis data). c_show25 = tampilkan cadangan. c_show26 = tampilkan kejadian. c_store1 = Simpan data mentah. c_store2 = Simpan data mentah ke [%] yang ditetapkan. c_xquery1 = Jalankan XQuery. c_xquery2 = Jalankan kueri yang ditetapkan dan tampilkan hasilnya. # Server texts; will be outsourced s_adlogin = Login Administrator (lokal atau jauh) s_connect = Koneksi s_connected = Terhubung ke %:%. s_createu = Buat Pengguna s_dbrevoke = Izin akan di tarik dari pengguna yang daidalam. s_disconnected = Terputus. s_drquestion = % Pengguna akan dihapus. s_globperm = Izin Umum s_host = Tuan rumah s_info1 = Percakapan in ihanya dimaksudkan untuk pengelolaan lingkungan client/server. s_info2 = Dia tidak akan mempengaruhi layanan lainnya dari GUI. s_locallogs = Catatan Lokal s_localport = Port Lokal s_localserver = Server Lokal s_locperm = Izin Lokal s_port = Port s_sessions = Sesi s_alter = Ubah s_server_admin = Administrasi Server s_h_server_admin = Tampilkan administrasi server untuk pengelolaan pengguna dan penelusuran catatan. basex-7.7.2/basex-core/src/main/resources/lang/Italian.lang000066400000000000000000000671301222453003200235530ustar00rootroot00000000000000# LANGUAGE FILE, TRANSLATED BY # Massimo Franceschet OFF = OFF ON = ON about_% = Su % access_denied = Accesso negato. add = Aggiungi add_raw_files = Aggiungi i risorse rimanenti come 'binaries' add_resources = Aggiungi risorse adjust_nodes = Adegua i nodi al testo admin_static_% = L'utente amministratore non può essere modificato. algorithm = Algoritmo all = Tutti alter_pw = Modifica parola chiave and_others = ed altri are_you_sure = Sei sicuro? attribute = Attributo attribute_index = Indice sugli attributi attributes = Attributi backup = Backup backup_dropped_% = I documenti di backup '%' sono stati eliminati. backup_not_found_% = Nessun backup trovato per '%'. backups = Backups backups_% = % backups binaries = Binari blue = Blu bold = Grassetto browse = Sfoglia buttons = Pulsanti bye1 = Buona giornata. bye2 = Ci vediamo. bye3 = Conosci te stesso. bye4 = Goditi la vita. cancel = Annulla case_sensitivity = Sensibilità al maiuscolo check_for_updates = Controlla aggiornamenti chief_architect = Sviluppatore principale children_text_len = figli/lunghezza testo choose_dir = Scegli una cartella choose_font = Scegli carattere chop_ws = Taglia gli spazi chopped = tagliato clear = Pulisci close = Chiudi close_file_% = Salva in %? color_schema = Combinazione di colori colors = Colori command = Comando command_canceled = Comando annullato. comment = Commento community = Comunità compiling = Compilando connect = Connetti connection_error = Impossibile comunicare con il Server. copy = Copia copy_db = Copia base di dati copy_path = Copia percorso create = Crea create_database = Crea base di dati create_stats = Crea statistiche creating_db = Sto creando la base di dati creating_indexes = Sto creando gli indici cut = Taglia database = Base di dati database_path = Percorso della base di dati (la base di dati dev'essere rimossa manualmente) databases = Basi di dati databases_% = % base/i di dati db_backup_% = Backup per '%' creato in %. db_closed_% = Base di dati '%' chiusa. db_copied_% = Copia di '%' creata in %. db_corrupt = Attenzione: la base di dati potrebbe essere corrotta! db_created_%_% = Base di dati '%' creata in %. db_dropped_% = Base di dati '%' cancellata. db_exists_% = La base di dati '%' esiste già. db_exported_% = Base di dati '%' esportata in %. db_flushed_% = La base di dati '%' è stata svuotata in %. db_not_backup_% = Il backup della base di dati '%' non può essere creato. db_not_copied_% = Una copia di '%' non può essere creata. db_not_dropped_% = Impossibile cancellare la base di dati '%'. db_not_found_% = Base di dati '%' non trovata. db_not_renamed_% = La base di dati '%' non può essere rinominata. db_not_restored_% = '%' non può essere ripristinata. db_opened_% = Base di dati '%' aperta in %. db_optimized_% = Base di dati '%' ottimizzata in %. db_pinned_% = La base di dati '%' è correntemente aperta da un altro processo. db_props = Informazioni sulla base di dati db_renamed_% = La base di dati '%' è stata rinominata '%'. db_restored_% = '%' ripristinato in %. db_updated_% = La base di dati '%' è in fase di aggiornamento. delete = Cancella delete_all = Cancella tutto delete_nodes = Cancellare. Sei sicuro? delete_packages_% = % pacchetto(i) verranno cancellati. diacritics = Segni diacritici dir_not_empty = La cartella non è vuota. disconnect = Disconnetti document = Documento documents = Documenti drop = Rimuovi drop_backups_% = % backup sarà eliminato. dropping_db_% = % base di dati verrà cancellata. edit = Modifica edit_% = Modifica % edit_data = Modifica dati editor = Editor element = Elemento elements = Elementi empty_db = Una base di dati vuota verrà creata. encoding = Codifica enter_db_name = Inserisci un nome per la base di dati. entries_% = % occorrenze error = Errore evaluating = Eseguendo event_created_% = L'evento '%' è stato creato. event_dropped_% = L'evento '%' è stato rimosso. event_exists_% = L'evento '%' esiste già. event_not_watched_% = L'evento '%' non è stato osservato. event_unknown_% = L'evento '%' è sconosciuto. event_watched_% = Stai già osservando l'evento '%'. events_% = % event(i) exec_error_% = Impossibile eseguire % exit = Esci expecting_cmd = Attendo un comando. explorer = Esploratore export = Esporta file = documento file_exists_% = Il documento "%" esiste già.\nVuoi sovrascriverlo? file_not_deleted_% = Il documento '%' non può essere cancellato. file_not_opened = Impossibile aprire il documento. file_not_saved = Impossibile salvare il documento. file_not_stored_% = Il documento '%' non può essere archiviato. file_or_dir = Inserisci un documento o una cartella file_patterns = Pattern dei documenti (separati da una virgola) files_replace_% = I documenti saranno sostituiti da %.\nVado avanti? filter = Filtro filter_selected = Filtra selezione finishing = Sto terminando first_line_header = Leggi la prima linea come intestazione di tabella folder = Cartella fonts = Carattere fullscreen = Schermo intero fulltext = Full-Text fulltext_index = Indice "full-text" general = Generale general_info = Informazioni generali global_option_% = L'opzione principale '%' non può essere modificata. go_back = Indietro go_forward = Avanti go_home = Casa go_to_line = Vai alla linea go_up = Livello superiore granted_%_% = % concesso a '%'. granted_%_%_% = % concesso a '%' su '%'. green = Verde gui_interactions = GUI & Interazioni help = Aiuto help1_use_catalog = Per abilitare la risoluzione del catalogo assicurati che help2_use_catalog = l'Apache XML Commons Resolver stia nel tuo percorso classpath. hit_s = Trovati index_attributes = Sto indicizzando gli attributi index_created_%_% = Indici '%' creati in %. index_dropped_%_% = Indici '%' cancellati in %. index_fulltext = Sto indicizzando il testo pieno index_not_dropped_% = Impossibile cancellare gli indici '%'. index_text = Sto indicizzando il testo indexes = Indici information = Informazione input_bar = Campo di inserimento input_format = Inserisci formato input_path = Cammino dell'input input_size = Dimensione dell'input insert_new_data = Inserisci nuovi dati install = Installa int_parser = Usa il parser XML interno interrupted = Interrotto. invalid_% = % non valido. invalid_value_%_% = Non è possibile impostare '%' a '%'. italics = Corsivo java_lf = Usa la disposizione di Java kill_self_% = '%' non può chiudere se stessa. language = Lingua license = Licenza BSD line = Linea line_% = Linea % line_number = Numero di linea main_options = Opzioni Principali manage_db = Gestisci Basi di dati map = Mappa map_choice1 = Nessun titolo, nessun bordo map_choice2 = Nessun titolo, bordo piccolo map_choice3 = Titolo, nessun bordo map_choice4 = Titolo, bordo piccolo map_choice5 = Titolo, bordo grande map_layout = Disposizione della mappa match_case = Confronta Maiuscolo/Minuscolo max_nr_of_hits = Massimo numero di successi method = Metodo more_skipped_% = % documento(i) saltati multi_line = Modalità multi-linea name = Nome name_invalid_% = Name '%' invalido. name_of_db = Nome della base di dati name_of_db_copy = Nome della copia della base di dati names = Nomi namespaces = Spazi di nomi new = Nuovo new_db_question = Vuoi crearne una nuova? no = No no_data = Nessun dato disponibile. no_db_dropped = Nessuna base di dati è stata rimossa. no_db_found = Nessuna base di dati trovata. no_db_opened = Nessuna base di dati aperta. no_dir_allowed_% = "%" è una cartella. no_help = Ci spiace sinceramente, nessun aiuto disponibile. no_mainmem = Questo comando non è disponibile in modalità di memoria principale. no_pixels = Spazio insufficiente. no_stemmer_% = Nessun 'stemmer' disponibile per la lingua "%". no_tokenizer_% = Nessun 'tokenizer' disponibile per la lingua "%". nodes = Nodi nodes_parsed_% = % nodi analizzati not_available = Non disponibile not_parsed_% = "%" non può essere analizzato. number_children = figli offsets = Offset ok = OK only_backup = Disponibile solo come backup. open = Apri open_manage = Gestisci optimize = Ottimizza optimized_query = Interrogazione ottimizzata options = Opzioni out_of_date = non aggiornato out_of_mem = Spazio in memoria principale insufficiente. output_dir = Cartella di output overwrite_db = La vecchia base di dati verrà sovrascritta. packages = Pacchetti packages_% = % pacchetto(i) parameters = Parametri parse_archives = Leggi i documenti negli archivi parse_as_jsonml = Leggi l'input come JsonML parse_dtds = Leggi le DTD e le entità parser_% = % Parser parsing = Parsing password = Parola chiave paste = Incolla path = Percorso path_added_%_% = Percorso '%' aggiunto in %. path_index = Indice strutturale perm_required_% = % permessi richiesti. perm_unknown_% = % permesso sconosciuto. pi = PI pkg_deleted_% = Pacchetto '%' rimosso. pkg_installed_%_% = Pacchetto '%' installato in %. pkg_replaced_%_% = Pacchetto '%' sostituiti in %. please_wait = Attendi plot = Grafico port_twice_% = La porta '%' è stata specificata due volte. preferences = Impostazioni printed = Stampato printing = Stampando properties = Informazioni pw_changed_% = La parola chiave dell'utente '%' è stata cambiata. pw_not_valid = La parola chiave non è un valido MD5 hash. query = Interrogazione query_executed_%_% = Interrogazione% eseguita in %. query_info = Informazioni sull'interrogazione query_plan = Piano dell'interrogazione ratio = Rapporto read_locking = Read Locking red = Rosso redo = Ripristina refresh = Aggiorna regular_expr = Espressione Regolare rename = Rinomina rename_db = Rinomina la base di dati replace_all = Rimpiazzare tutto replace_with = Rimpiazzare con requires_restart = Richiede un riavvio res_deleted_%_% = % risorsa/e cancellato in %. res_not_found = Risorsa non trovato. res_not_found_% = Risorsa "%" non trovato. res_props = Proprietà delle Risorse res_renamed_%_% = % risorsa/e rinominati come %. res_replaced_%_% = % risorsa/e sostituiti in %. reserved_mem = Memoria riservata reset = Azzera resources = Risorse restore = Ripristina result = Risultato results_% = % Risultati reopen = Riapri reopen_file_% = Riapri % e scarta le modifiche? rt_execution = Esecuzione in tempo reale rt_filtering = Filtro in tempo reale rt_focus = Focus del mouse in tempo reale save = Salva save_as = Salva come search = Cerca select_all = Seleziona tutto separator = Separatore sessions_% = % sessione sessions_killed_% = % sessione chiusa. show_atts = Mostra Attributi show_name_atts = Sostituisci i tag con gli attributi @name similar_cmd_% = Intendevi '%'? simple_file_chooser = Usa un selezionatore di documenti semplificato single_cmd = Atteso un singolo comando. size = Dimensione skip_corrupt_files = Salta i documenti corrotti (non ben formati) skipped = Saltato split_input_lines = Dividi l'input in linee srv_running = Il server sta lavorando o il permesso è stato negato. srv_started_port_% = Server è stato avviato (porta: %) srv_stopped_port_% = Server è stato spento (porta: %) standard = Normale start = Inizio status_bar = Barra di stato stemming = Radice linguistica (Inglese) stop = Fine stopped_at = Fermato a stopword_list = Lista parole irrilevanti (stopwords) strings_found_% = % stringa/he trovate. strings_replaced = Le stringhe sono state sostituite. strip_ns = Rimuovi i namespace syntax = Sintassi table = Tabella target_path = Target Path team = Team text = Testo text_index = Indice sul testo text_length = lunghezza testo time_needed = Tempo necessario timeout_exceeded = Il processo ha raggiunto il timeout. timestamp = Data timing = Cronometraggio total_mem = Memoria totale total_time = Tempo totale translation = Traduzione tree = Albero tree_options = Opzioni dell'albero try_% = Usa %. try_more_% = Usa % per avere maggiori informazioni. try_specific_% = Usa % per avere maggiori informazioni su un comando specifico. type = Tipo undo = Annulla unknown_cmd_% = Comando sconosciuto: %. unknown_host_x = Host sconosciuto '%'. unknown_option_% = Opzione sconosciuta '%'. unknown_parser_% = Parser '%' sconosciuto. unknown_user_% = L'utente '%' è sconosciuto. unwatching_event_% = Evento '%' non osservato. up_to_date = Aggiornato updated = Aggiornato use_catalog_file = Usa il documento del catalogo XML used_mem = Memoria usata user_created_% = Utente '%' creato. user_dropped_% = Utente '%' eliminato. user_dropped_%_% = Utente '%' eliminato della base di dati '%'. user_exists_% = L'utente '%' esiste già. user_logged_in_% = L'utente '%' è attualmente connesso. username = Utente users = Utenti users_% = % utente/i value = Valore version = Versione view = Visualizza watching_event_% = Guarda l'evento '%'. whole_word = Parola Intera write_locking = Write Locking ws_chopping = Rimozione spazi xquery = XQuery yes = Sì # Help texts h_about = Mostra le informazioni generali sul progetto. h_attr_index = Questo indice velocizza i confronti tra attributi all'interno dei predicati. h_browser_error_% = Il browser non si apre. Apri la URL col tuo browser di fiducia:\n\n% h_buttons = Attiva/Disattiva la barra dei pulsanti. h_case = La sensibilità al maiuscolo è conservata nell'indice. h_chop_ws = Quest'opzione rimuove gli spazi irrilevanti tra i tag. h_close = Chiude la basi di dati corrente. h_close_file = Chiude i documenti aperti. h_colors = Consente di cambiare i colori dell'applicazione. h_community = Mostra la pagina web della comunità. h_copy = Copia i nodi XML selezionati. h_copy_path = Copia il percorso nei nodi XML selezionati. h_db_format = Il formato della base di dati è cambiato; creare una nuova base di dati. h_delete = Cancella i nodi XML. h_diacritics = I segni diacritici sono conservati nell'indice. h_edit = Modifica i nodi XML. h_editor = Mostra il editor di testi. h_execute_query = Esegue l'interrogazione. h_exit = Esce dall'applicazione. h_explorer = Mostra l'esploratore. h_export = Esporta la base di dati corrente. h_filter_selected = Filtra i nodi selezionati. h_folder = Mostra la visualizzazione tipo cartelle. h_fonts = Permettere di cambiare i caratteri dell'applicazione. h_fullscreen = Passa a modalità schermo intero. h_fulltext_index = Un indice "full-text" velocizza le interrogazioni sul testo. h_go_home = Salta al nodo radice. h_go_to_line = Salta ad una linea specifica. h_go_up = Sale di un livello. h_help = Mostra la documentazione web. h_html_parser = Il parser TagSoup verrò usato per convertire HTML in XML. h_index_format = Il formato degli indici è cambiato; creare nuovi indici. h_input_bar = Attiva/Disattiva il campo di inserimento. h_int_parser = Tollerante ai guasti e più veloce del parser di default di Java. h_languauge = Parser di testo specifici per la lingua verranno usati h_large_db = La base di dati è grande % . Vuoi chiudere\nalcune visualizzazioni per accelerare l'elaborazione? h_map = Mostra la visualizzazione tipo mappa. h_map_layout = Cambia la disposizione della mappa. h_new = Crea una base di dati. h_new_file = Crea un nuovo documento. h_new_node = Crea un nuovo nodo XML. h_new_version = Una nuova versione è dispobile (% %)!\nVuoi aggiornare? h_no_html_parser = Nessun parser HTML è disponibile; l'input verrà trattato come XML. h_open_file = Apre un documento di testo. h_open_manage = Gestisce le basi di dati esistenti. h_out_of_mem = Le seguenti azioni potrebbero aiutarti:\n- aumenta la dimensione dello heap di Java con l'opzione -Xmx\n- scegli il parser XML integrato nella GUI o attraverso 'set intparse on'\n- disattiva gli indici di testo ed attributi. h_packages = Consente di elencare, installare, e cancellare pacchetti XQuery. h_paste = Incolla i nodi copiati. h_path_index = Questo indice velocizza le interrogazioni sulla struttura del documento. h_plot = Mostra la visualizzazione tipo grafico di dispersione. h_preferences = Mostra le impostazioni generali dell'applicazione. h_properties = Mostra le informazioni sulla base di dati attualmente in uso. h_query_info = Mostra il pannello informazioni sull'interrogazione. h_recently_open = File aperti recentemente. h_replace = Cerca e sostituisci il testo. h_reopen_file = Riapri il documento corrente. h_result = Mostra la visualizzazione tipo risultati. h_rt_execution = Se quest'opzione è attiva, le interrogazioni vengono eseguite alla pressione di ogni pulsante. h_rt_filtering = Se quest'opzione è attiva, i risultati della interrogazioni vengono automaticamente filtrati. h_save = Salva il documento. h_save_result = Salva i risultati. h_show_history = Mostra la cronologia degli inserimenti. h_status_bar = Attiva/Disattiva la barra di stato. h_stemming = I termini sono ridotti alla radice linguistica prima di essere indicizzati. h_stop_process = Ferma il processo in corso. h_stopwords = Scegli una lista di stopwords per trascurare i termini comuni. h_table = Mostra la visualizzazione tipo tabella. h_text_index = Questo indice velocizza i confronti testuali all'interno dei predicati. h_tree = Mostra la visualizzazione ad albero. h_tree_options = Opzioni per la visualizzazione ad albero. h_updates = Mostra la pagina web degli aggiornamenti. h_used_mem = Se la memoria è insufficiente, avviare\nBaseX con l'opzione Java -Xmx. # Commands c_add1 = Aggiungi risorse. c_add2 = Aggiungi [%] come [%] alla base di dati. c_alter1 = Modifica il nome della base di dati o la parola chiave dell'utente. c_alter2 = Modifica il nome della base di dati o la parola chiave dell'utente: c_alterdb = modifica il nome della base di dati c_alterpw = cambia la parola chiave di un utente. c_check1 = Apri o crea una base di dati. c_check2 = Apri una base di dati esistente o crea una nuova istanza. c_close1 = Chiudi la base di dati in uso. c_close2 = Chiude la base di dati in uso. c_copy1 = Copia la base di dati. c_copy2 = Copia una base di dati. c_create1 = Crea base di dati, indice, utente, backup o evento. c_create2 = Crea una nuova base di dati, indice, utente, backup o evento: c_create3 = crea la base di dati [%] opzionalmente con [%] c_create4 = crea un backup della base di dati [%] c_create5 = crea l'indice specificato c_create8 = crea l'utente specificato c_create9 = crea un evento c_cs1 = Esegui interrogazione XQuery ed imposta i risultati come un nuovo insieme contesto. c_cs2 = Esegue la specifica interrogazione XQuery ed imposta i risultati\ncome un nuovo insieme contesto. c_delete1 = Rimuovi risorse. c_delete2 = Rimuovi risorse della base di dati corrente. c_drop1 = Cancella base di dati, indice, utente, backup o evento. c_drop2 = Cancella una base di dati, indice, utente, backup o evento: c_drop21 = cancella la base di dati c_drop22 = cancella l'indice specificato c_drop23 = cancella l'utente specificato (su una base di dati). c_drop24 = rimuovi il backup della base di dati c_drop25 = rimuovi l'evento c_execute1 = Esegui lo script dei comandi. c_execute2 = Esegui [%] come script di comandi. c_exit1 = Esci dall'applicazione. c_exit2 = Esci da %. c_export1 = Esporta la base di dati in XML. c_export2 = Esporta la base di dati in [%]. c_find1 = Esegui una interrogazione a parole chiave. c_find2 = I seguenti modificatori possono essere usati:\n = : cerca nodi di testo con corrispondenza esatta"\n @= : cerca attributi con corrispondenza esatta\n @ : cerca attributi c_flush1 = Svuota la base di dati. c_flush2 = Svuota tutti i buffer della base di dati sul disco. c_get1 = Mostra le opzioni globali. c_get2 = Mostra i valori di una opzione globale. c_grant1 = Assegna i permessi all'utente. c_grant2 = Assegna i permessi all'utente (su una base di dati) ad un utente. c_help1 = Ottieni aiuto su % comandi. c_help2 = Se è specificato [%], l'informazione sullo specifico\n comando viene mostrata; altrimenti, vengono mostrati tutti i comandi. c_info1 = Mostra informazioni sulla base di dati attuale. c_info21 = Mostra informazioni sulla base di dati attualmente aperta: c_info22 = nessun argomento: mostra informazioni globali c_info23 = mostra informazioni sulla base di dati c_info24 = mostra informazioni sugli Indici c_info25 = mostra tabella della base di dati c_inspect1 = Esegui i controlli di integrità. c_inspect2 = Controlla se ci sono errori nella base di dati. c_kill1 = Chiudi la sessione utente. c_kill2 = Chiudi tutte le sessioni dell'utente. c_list1 = Mostra le basi di dati o le risorse delle basi di dati. c_list2 = Mostra tutte le basi di dati, o le risorse\nnella base [%]. c_open1 = Apri una base di dati. c_open2 = Apre la base di dati [%]. c_optimize1 = Ottimizza la base di dati. c_optimize2 = Ottimizza le basi di dati aperte.\nSe % è specificato, la dimensione della base è ottimizzata. c_password1 = Cambia parola chiave. c_password2 = Cambia parola chiave dell'utente. c_rename1 = Rinomina le risorse nella base di dati. c_rename2 = Rinomina le risorse nella base di dati corrente. c_replace1 = Sostituisci le risorse nella base di dati. c_replace2 = Sostituisce le risorse nella base di dati corrente. c_repo1 = Installa, cancella or o elenca i pacchetti. c_repo2 = installa, cancella o elenca i pacchetti dal repository c_repo3 = cancella il pacchetto [%] o la cartella [%] c_repo4 = installa il pacchetto con percorso [%] c_repo5 = elenca tutti i pacchetti installati c_restore1 = Ripristina la base di dati. c_restore2 = Ripristina una base di dati. L'argomento può includere \nla data del backup. c_retrieve1 = Recupera i dati grezzi. c_retrieve2 = Recupera i dati grezzi da [%]. c_run1 = Esegui l'interrogazione o lo script dei comandi. c_run2 = Esegui i contenuti di [%] come interrogazione o script di comandi. c_set1 = Imposta opzioni globali. c_set2 = Imposta l'opzione della base di dati ad un nuovo valore. c_show1 = Mostra l'informazione sul server. c_show21 = mostra l'informazione sul server: c_show23 = mostra le sessioni aperte. c_show24 = mostra gli utenti (su una base di dati). c_show25 = mostra i backup. c_show26 = mostra gli event. c_store1 = Archivia i dati grezzi. c_store2 = Archivia i dati grezzi in [%]. c_xquery1 = Esegui interrogazione XQuery. c_xquery2 = Esegue la specifica interrogazione e stampa il risultato. # Server texts; will be outsourced s_adlogin = Accesso dell'amministratore (locale o remoto) s_connect = Connessione s_connected = Connesso a %:%. s_createu = Crea utente s_dbrevoke = I permessi saranno revocati. s_disconnected = Disconnesso. s_drquestion = % L'utente sarà eliminato. s_globperm = Permessi globali s_host = Host s_info1 = Questa scheda serve per amministrare l'ambiente client/server. s_info2 = Non influirà su alcuna proprietà della GUI. s_locallogs = Diari locali s_localport = Porta locale s_localserver = Server locale s_locperm = Permessi locali s_port = Porta s_sessions = Sessioni s_alter = Modifica s_h_server_admin = Mostra l'amministrazione del server per gestire gli utenti e diari s_server_admin = Amministrazione del serverbasex-7.7.2/basex-core/src/main/resources/lang/Japanese.lang000066400000000000000000001034061222453003200237150ustar00rootroot00000000000000# LANGUAGE FILE, TRANSLATED BY # Toshio HIRAI, Kazuo KASHIMA OFF = OFF ON = ON about_% = %ã«ã¤ã„㦠access_denied = ã‚¢ã‚¯ã‚»ã‚¹ãŒæ‹’å¦ã•れã¾ã—ãŸã€‚ add = 追加 add_raw_files = 残りã®ãƒ•ァイルをRAWファイルã¨ã—ã¦è¿½åŠ ã—ã¾ã™ add_resources = リソースã®è¿½åŠ  adjust_nodes = ノードをテキストã«èª¿æ•´ admin_static_% = Admin ユーザーã¯ç·¨é›†ã§ãã¾ã›ã‚“。 algorithm = アルゴリズム all = ã™ã¹ã¦ alter_pw = パスワードã®å¤‰æ›´ and_others = ãã®ä»–ã®è²¢çŒ®è€… are_you_sure = よã‚ã—ã„ã§ã™ã‹ï¼Ÿ attribute = 属性 attribute_index = 属性インデックス attributes = 属性 backup = ãƒãƒƒã‚¯ã‚¢ãƒƒãƒ— backup_dropped_% = ãƒãƒƒã‚¯ã‚¢ãƒƒãƒ—ファイル '%' ã¯ãƒ‰ãƒ­ãƒƒãƒ—ã•れã¾ã—ãŸã€‚ backup_not_found_% = '%' ã®ãƒãƒƒã‚¯ã‚¢ãƒƒãƒ—ãŒã¿ã¤ã‹ã‚Šã¾ã›ã‚“ã§ã—ãŸã€‚ backups = ãƒãƒƒã‚¯ã‚¢ãƒƒãƒ— backups_% = % ãƒãƒƒã‚¯ã‚¢ãƒƒãƒ— binaries = ãƒã‚¤ãƒŠãƒª blue = é’ bold = 太字 browse = å‚ç…§ buttons = ボタン bye1 = ãƒã‚¤ãƒã‚¤ bye2 = ã¾ãŸã­ã€‚ bye3 = ã¾ãŸæ¬¡å›žã€‚ bye4 = ã˜ã‚ƒãƒ¼ã­ã€‚ cancel = 中止 case_sensitivity = å¤§æ–‡å­—ãƒ»å°æ–‡å­—ã®åŒºåˆ¥ check_for_updates = æ›´æ–°ã®ç¢ºèª chief_architect = メイン開発者 children_text_len = å­/テキスト長 choose_dir = ディレクトリã®é¸æŠž choose_font = フォントã®é¸æŠž chop_ws = 空白をå–り除ã chopped = çœç•¥ã•れã¾ã—㟠clear = クリア close = é–‰ã˜ã‚‹ close_file_% = % ã¸ã®å¤‰æ›´ã‚’ä¿å­˜ã—ã¾ã™ã‹ï¼Ÿ color_schema = カラースキーマ colors = 色 command = コマンド command_canceled = コマンドã¯ã‚­ãƒ£ãƒ³ã‚»ãƒ«ã•れã¾ã—ãŸã€‚ comment = コメント community = コミュニティ compiling = コンパイル中 connect = 接続 connection_error = サーãƒãƒ¼ã¨é€šä¿¡ã§ãã¾ã›ã‚“。 copy = コピー copy_db = ドキュメントã®ã‚³ãƒ”ー copy_path = パスã®ã‚³ãƒ”ー create = ä½œæˆ create_database = データベースã®ä½œæˆ create_stats = 統計ã®ä½œæˆ creating_db = データベースを作æˆã—ã¦ã„ã¾ã™ creating_indexes = インデックスを作æˆä¸­ã§ã™ã€‚ cut = カット database = データベース database_path = データベースパス (既存ã®ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã¯ç§»å‹•ã•れã¾ã›ã‚“) databases = データベース databases_% = % データベース db_backup_% = '%' ã®ãƒãƒƒã‚¯ã‚¢ãƒƒãƒ—ã‚’ % ã«ä½œæˆã—ã¾ã—ãŸã€‚ db_closed_% = データベース '%' ã‚’é–‰ã˜ã¾ã—ãŸã€‚ db_copied_% = '%' ã®ã‚³ãƒ”ー㌠% ã«ä½œæˆã•れã¾ã—ãŸã€‚ db_corrupt = 警告:データベースãŒå£Šã‚Œã¦ã„ã‚‹å¯èƒ½æ€§ãŒã‚りã¾ã™ï¼ db_created_%_% = データベース '%' ã‚’ % ã«ä½œæˆã—ã¾ã—ãŸã€‚ db_dropped_% = データベース '%' ãŒå‰Šé™¤ã•れã¾ã—ãŸã€‚ db_exists_% = データベース '%' ã¯æ—¢ã«å­˜åœ¨ã—ã¾ã™ã€‚ db_exported_% = データベース '%' ã‚’ % ã«ã‚¨ã‚¯ã‚¹ãƒãƒ¼ãƒˆã—ã¾ã—ãŸã€‚ db_flushed_% = データベース '%' ã‚’ % ã§ãƒ•ラッシュã—ã¾ã—ãŸã€‚ db_not_backup_% = データベース '%' ã®ãƒãƒƒã‚¯ã‚¢ãƒƒãƒ—ã¯ä½œæˆã•れã¾ã›ã‚“ã§ã—ãŸã€‚ db_not_copied_% = '%' ã®ã‚³ãƒ”ーã¯ä½œæˆã•れã¾ã›ã‚“ã§ã—ãŸã€‚ db_not_dropped_% = データベース '%' を削除ã§ãã¾ã›ã‚“ã§ã—ãŸã€‚ db_not_found_% = データベース '%' ãŒè¦‹ä»˜ã‹ã‚Šã¾ã›ã‚“ã§ã—ãŸã€‚ db_not_renamed_% = データベース '%' ã¯ãƒªãƒãƒ¼ãƒ ã§ãã¾ã›ã‚“ã§ã—ãŸã€‚ db_not_restored_% = '%' リストアã§ãã¾ã›ã‚“ã§ã—ãŸã€‚ db_opened_% = データベース '%' ã‚’ % ã§é–‹ãã¾ã—ãŸã€‚ db_optimized_% = データベース '%' ã‚’ % ã§æœ€é©åŒ–ã—ã¾ã—ãŸã€‚ db_pinned_% = データベース '%' ã¯ä»–ã®ã‚¯ãƒ©ã‚¤ã‚¢ãƒ³ãƒˆãŒä½¿ç”¨ä¸­ã§ã™ã€‚ db_props = データベース情報 db_renamed_% = データベース '%' 㯠'%' ã«ãƒªãƒãƒ¼ãƒ ã•れã¾ã—ãŸã€‚ db_restored_% = '%' 㯠% ã«ãƒªã‚¹ãƒˆã‚¢ã•れã¾ã—ãŸã€‚ db_updated_% = データベース '%' ãŒæ›´æ–°ã•れã¦ã„ã¾ã™ã€‚ã¾ãŸã¯ã€æ›´æ–°ã¯å®Œäº†ã—ã¾ã›ã‚“ã§ã—㟠delete = 削除 delete_all = å…¨ã¦å‰Šé™¤ delete_nodes = 本当ã«å‰Šé™¤ã—ã¾ã™ã‹ï¼Ÿ delete_packages_% = % パッケージã¯å‰Šé™¤ã•れã¾ã™ã€‚ diacritics = 補助記å·ï¼ˆç™ºéŸ³åŒºåˆ¥ç¬¦å·ï¼‰ dir_not_empty = ディレクトリãŒç©ºã§ã¯ã‚りã¾ã›ã‚“。 disconnect = 切断 document = ドキュメント documents = ドキュメント drop = 削除 drop_backups_% = % 一ã¤ä»¥ä¸Šã®ãƒãƒƒã‚¯ã‚¢ãƒƒãƒ—ãŒå‰Šé™¤ã•れã¾ã™ã€‚ dropping_db_% = % 一ã¤ä»¥ä¸Šã®ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ãŒå‰Šé™¤ã•れã¾ã™ edit = 編集 edit_% = % ã®ç·¨é›† edit_data = データã®ç·¨é›† editor = エディタ element = è¦ç´  elements = è¦ç´  empty_db = 空ã®ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ãŒä½œæˆã•れã¾ã™ã€‚ encoding = エンコーディング enter_db_name = データベースåを入力ã—ã¦ãã ã•ã„。 entries_% = % 個ã®ã‚¨ãƒ³ãƒˆãƒªãƒ¼ error = エラー evaluating = 計算中 event_created_% = イベント '%' ãŒä½œæˆã•れã¾ã—ãŸã€‚ event_dropped_% = イベント '%' ãŒå‰Šé™¤ã•れã¾ã—ãŸã€‚ event_exists_% = イベント '%' ã¯æ—¢ã«å­˜åœ¨ã—ã¦ã„ã¾ã™ã€‚ event_not_watched_% = イベント '%' ã¯ç›£è¦–ã•れã¦ã„ã¾ã›ã‚“。 event_unknown_% = イベント '%' ã¯ä¸æ˜Žã§ã™ã€‚ event_watched_% = æ—¢ã«ã‚¤ãƒ™ãƒ³ãƒˆã‚’監視ã—ã¦ã„ã¾ã™ '%'。 events_% = % イベント exec_error_% = %を実行ã§ãã¾ã›ã‚“ã§ã—ãŸã€‚ exit = 終了 expecting_cmd = 予想ã•れるコマンド explorer = エクスプローラ export = エクスãƒãƒ¼ãƒˆ file = ファイル file_exists_% = ファイル % ã¯æ—¢ã«å­˜åœ¨ã—ã¾ã™ã€‚\nç½®æ›ã—ã¦ã‚ˆã‚ã—ã„ã§ã™ã‹ï¼Ÿ file_not_deleted_% = ファイル '%' を削除ã§ãã¾ã›ã‚“ã§ã—ãŸã€‚ file_not_opened = ファイルãŒé–‹ã‘ã¾ã›ã‚“ã§ã—ãŸã€‚ file_not_saved = ファイルをä¿å­˜ã§ãã¾ã›ã‚“ã§ã—ãŸã€‚ file_not_stored_% = ファイル '%' ã‚’æ ¼ç´ã§ãã¾ã›ã‚“ã§ã—ãŸã€‚ file_or_dir = ファイルã¾ãŸã¯ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒª file_patterns = ファイルパターン(カンマ区切り) files_replace_% = ファイル % ã¯ç½®æ›ã•れã¾ã™\nç¶šã‘ã¦ã‚‚よã‚ã—ã„ã§ã™ã‹ï¼Ÿ filter = フィルター filter_selected = é¸æŠžä¸­ã®ãƒŽãƒ¼ãƒ‰ã®ãƒ•ィルター finishing = 終了ã—ã¾ã—ãŸã€‚ first_line_header = 1行目をヘッダーã¨ã—ã¦è§£æžã—ã¾ã™ folder = フォルダー fonts = フォント fullscreen = 全画é¢è¡¨ç¤º fulltext = 全文 fulltext_index = 全文インデックス general = 一般 general_info = 一般事項 global_option_% = Global option '%' cannot be set. go_back = 戻る go_forward = 進む go_home = ホーム㸠go_to_line = 指定行㸠go_up = 上㸠granted_%_% = % ã‚’ '%' ã«ä¸Žãˆã¾ã—ãŸã€‚ granted_%_%_% = % ã‚’ '%' ã«ä¸Žãˆã¾ã—ãŸï¼ˆãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ï¼š'%')。 green = ç·‘ gui_interactions = ユーザーインターフェース help = ヘルプ help1_use_catalog = カタログã®è§£æ±ºã‚’有効ã«ã™ã‚‹ãŸã‚ã« help2_use_catalog = Apache XML Commons Resolver ãŒã‚¯ãƒ©ã‚¹ãƒ‘ス上ã«ã‚ã‚‹ã“ã¨ã‚’確èªã—ã¦ãã ã•ã„ hit_s = ヒット index_attributes = 属性インデックスを作æˆä¸­ã§ã™ã€‚ index_created_%_% = インデックス % ㌠% ã«ä½œæˆã•れã¾ã—ãŸã€‚ index_dropped_%_% = インデックス % ㌠% ã‹ã‚‰å‰Šé™¤ã•れã¾ã—ãŸã€‚ index_fulltext = 全文インデックスを作æˆä¸­ã§ã™ã€‚ index_not_dropped_% = インデックスを削除ã§ãã¾ã›ã‚“ã§ã—ãŸã€‚ index_text = テキストインデックスを作æˆä¸­ã§ã™ã€‚ indexes = インデックス information = 情報 input_bar = 入力フィールド input_format = å…¥åŠ›å½¢å¼ input_path = 文書ã®ãƒ‘ス input_size = 文書ã®ã‚µã‚¤ã‚º insert_new_data = æ–°è¦ãƒ‡ãƒ¼ã‚¿ã®ä½œæˆ install = インストール int_parser = 内部XMLパーサーを使用 interrupted = 中断ã•れã¾ã—ãŸã€‚ invalid_% = % ã¯ä¸æ­£ã§ã™ã€‚ invalid_value_%_% = プロパティ '%' ã‚’ '%' ã«å¤‰æ›´ã™ã‚‹äº‹ãŒå‡ºæ¥ã¾ã›ã‚“ã§ã—ãŸã€‚ italics = 斜体 java_lf = Javaã®ãƒ«ãƒƒã‚¯ï¼†ãƒ•ィールを使用ã™ã‚‹ kill_self_% = '%' 自身ã®ã‚»ãƒƒã‚·ãƒ§ãƒ³ã‚’切断ã™ã‚‹äº‹ã¯å‡ºæ¥ã¾ã›ã‚“。 language = 言語 license = BSD ライセンス line = 行 line_% = % 行 line_number = è¡Œç•ªå· main_options = メインオプション manage_db = データベースã®ç®¡ç† map = マップ map_choice1 = タイトル無ã—ã€æž ç·šç„¡ã— map_choice2 = タイトル無ã—ã€ç´°æž ç·š map_choice3 = ã‚¿ã‚¤ãƒˆãƒ«æœ‰ã‚Šã€æž ç·šç„¡ã— map_choice4 = タイトル有りã€ç´°æž ç·š map_choice5 = タイトル有りã€å¤ªæž ç·š map_layout = マップレイアウト match_case = å¤§æ–‡å­—ãƒ»å°æ–‡å­—を区別ã™ã‚‹ max_nr_of_hits = 最大ヒット件数 method = メソッド more_skipped_% = % ä»¶ã®ãƒ•ァイルをスキップã—ã¾ã—ãŸã€‚ multi_line = マルãƒãƒ©ã‚¤ãƒ³ãƒ¢ãƒ¼ãƒ‰ name = åå‰ name_invalid_% = '%' ã¯ä¸æ­£ãªåå‰ã§ã™ã€‚ name_of_db = データベースã®åå‰ name_of_db_copy = コピー先ã®åç§° names = åå‰ namespaces = åå‰ç©ºé–“ new = æ–°è¦ new_db_question = æ–°ã—ã„データベースを作æˆã—ã¾ã™ã‹ï¼Ÿ no = ã„ã„㈠no_data = データãŒã‚りã¾ã›ã‚“。 no_db_dropped = データベースã¯å‰Šé™¤ã•れã¾ã›ã‚“ã§ã—ãŸã€‚ no_db_found = データベースãŒè¦‹ä»˜ã‹ã‚Šã¾ã›ã‚“。 no_db_opened = データベースãŒã‚ªãƒ¼ãƒ—ンã•れã¦ã„ã¾ã›ã‚“。 no_dir_allowed_% = "%" ディレクトリを示ã—ã¾ã™ã€‚ no_help = ヘルプãŒã‚りã¾ã›ã‚“。 no_mainmem = コマンドã¯ãƒ¡ã‚¤ãƒ³ãƒ¡ãƒ¢ãƒªãƒ¢ãƒ¼ãƒ‰ã§ã¯ä½¿ç”¨ã§ãã¾ã›ã‚“。 no_pixels = å分ãªã‚¹ãƒšãƒ¼ã‚¹ãŒã‚りã¾ã›ã‚“。 no_stemmer_% = "%"ã®èªžå¹¹æŠ½å‡ºã¯ä½¿ç”¨ã§ãã¾ã›ã‚“。 no_tokenizer_% = "%"ã®ãƒˆãƒ¼ã‚¯ãƒŠã‚¤ã‚¶ã¯ä½¿ç”¨ã§ãã¾ã›ã‚“。 nodes = ノード nodes_parsed_% = % ノードãŒãƒ‘ースã•れã¾ã—㟠not_available = 利用ã§ãã¾ã›ã‚“。 not_parsed_% = "%" をパースã§ãã¾ã›ã‚“ã§ã—ãŸã€‚ number_children = å­ã®æ•° offsets = オフセット ok = OK only_backup = ãƒãƒƒã‚¯ã‚¢ãƒƒãƒ—ã¨ã—ã¦ã®ã¿ä½¿ç”¨ã§ãã¾ã™ã€‚ open = é–‹ã open_manage = ç®¡ç† optimize = 最é©åŒ– optimized_query = クエリー options = オプション out_of_date = 期é™åˆ‡ã‚Œ out_of_mem = メモリーä¸è¶³ã€‚ output_dir = 出力ディレクトリ overwrite_db = å¤ã„データベースã¯ä¸Šæ›¸ãã•れã¾ã™ã€‚ packages = パッケージ packages_% = % パッケージ parameters = パラメータ parse_archives = アーカイブ内ã®ãƒ•ァイルを解æžã™ã‚‹ parse_as_jsonml = JsonMLã¨ã—ã¦è§£æžã™ã‚‹ parse_dtds = DTDã¨ã‚¨ãƒ³ãƒˆãƒªãƒ¼ã‚’è§£æžã™ã‚‹ parser_% = % Parser parsing = パース password = パスワード paste = 貼り付㑠path = パス path_added_%_% = パス '%' ㌠% ã«è¿½åŠ ã•れã¾ã—ãŸã€‚ path_index = パスサマリー perm_required_% = % パーミッションãŒå¿…è¦ã§ã™ã€‚ perm_unknown_% = % ã¯ä¸æ˜Žãªãƒ‘ーミッションã§ã™ã€‚ pi = PI pkg_deleted_% = パッケージ '%' ãŒå‰Šé™¤ã•れã¾ã—ãŸã€‚ pkg_installed_%_% = パッケージ '%' 㯠% ã«ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã•れã¾ã—ãŸã€‚ pkg_replaced_%_% = パッケージ '%' 㯠% ã«ç½®ãæ›ãˆã‚‰ã‚Œã¾ã—ãŸã€‚ please_wait = ãŠå¾…ã¡ä¸‹ã•ã„ plot = プロット port_twice_% = ãƒãƒ¼ãƒˆç•ªå· '%' ã«å¯¾ã™ã‚‹æŒ‡å®šãŒé‡è¤‡ã—ã¦ã„ã¾ã™ã€‚ preferences = 設定 printed = å°åˆ·ã—ã¾ã—㟠printing = å°åˆ·ä¸­ properties = プロパティ pw_changed_% = ユーザー '%' ã®ãƒ‘スワードを変更ã—ã¾ã—ãŸã€‚ pw_not_valid = ãƒ‘ã‚¹ãƒ¯ãƒ¼ãƒ‰ãŒæœ‰åйãªMD5ãƒãƒƒã‚·ãƒ¥å€¤ã§ã¯ã‚りã¾ã›ã‚“。 query = クエリー query_executed_%_% = % % ã®ã‚¯ã‚¨ãƒªãƒ¼ãŒå®Ÿè¡Œã•れã¾ã—ãŸã€‚ query_info = クエリー情報 query_plan = クエリー計画 ratio = 比率 read_locking = Read Locking red = 赤 redo = やり直㗠refresh = æ›´æ–° regular_expr = æ­£è¦è¡¨ç¾ rename = åå‰ã®å¤‰æ›´ rename_db = データベースã®åå‰ã‚’変更 reopen = é–‹ãç›´ã™ reopen_file_% = 変更を破棄ã—㦠% ã‚’é–‹ãç›´ã—ã¾ã™ã‹ï¼Ÿ replace_all = å…¨ç½®æ› replace_with = ç½®æ› requires_restart = å†èµ·å‹•ãŒå¿…è¦ã§ã™ res_deleted_%_% = % リソース㌠% ã‹ã‚‰å‰Šé™¤ã•れã¾ã—ãŸã€‚ res_not_found = リソースãŒè¦‹ã¤ã‹ã‚Šã¾ã›ã‚“ã§ã—ãŸã€‚ res_not_found_% = リソース "%" ãŒè¦‹ä»˜ã‹ã‚Šã¾ã›ã‚“ã§ã—ãŸã€‚ res_props = リソースプロパティ res_renamed_%_% = % リソース㌠% ã§ãƒªãƒãƒ¼ãƒ ã•れã¾ã—ãŸã€‚ res_replaced_%_% = % リソース㌠% ã§ç½®æ›ã•れã¾ã—ãŸã€‚ reserved_mem = äºˆç´„ãƒ¡ãƒ¢ãƒªé‡ reset = リセット resources = リソース restore = リストア result = çµæžœ results_% = % çµæžœ rt_execution = リアルタイムã§ã®å®Ÿè¡Œ rt_filtering = リアルタイムフィルタリング rt_focus = リアルタイムマウスフォーカス save = ä¿å­˜ save_as = 別åã§ä¿å­˜ search = 検索 select_all = å…¨é¸æŠž separator = セパレータ sessions_% = % セッション sessions_killed_% = % セッションãŒåˆ‡æ–­ã•れã¾ã—ãŸã€‚ show_atts = 属性ã®è¡¨ç¤º show_name_atts = ã‚¿ã‚°ã‚’@name属性ã§ç½®ãæ›ãˆ similar_cmd_% = '%' ã®é–“é•ã„ã§ã¯ãªã„ã§ã™ã‹ï¼Ÿ simple_file_chooser = ç°¡æ˜“ç‰ˆãƒ•ã‚¡ã‚¤ãƒ«é¸æŠžç”»é¢ã‚’使用 single_cmd = å˜ä¸€ã®ã‚³ãƒžãƒ³ãƒ‰ã‚’指定ã—ã¦ãã ã•ã„。 size = サイズ skip_corrupt_files = 䏿­£ãªï¼ˆéžæ•´å½¢å¼ã®ï¼‰ãƒ•ァイルをスキップã™ã‚‹ skipped = スキップã—ã¾ã—ãŸã€‚ split_input_lines = 改行ã§åˆ†å‰²ã™ã‚‹ srv_running = サーãƒãƒ¼ãŒæ—¢ã«èµ·å‹•ã—ã¦ã„ã‚‹ã‹ã€æ¨©é™ãŒè¶³ã‚Šã¾ã›ã‚“。 srv_started_port_% = サーãƒãƒ¼ã‚’é–‹å§‹ã—ã¾ã—㟠(port: %) srv_stopped_port_% = サーãƒãƒ¼ã‚’åœæ­¢ã—ã¾ã—㟠(port: %) standard = 通常 start = é–‹å§‹ status_bar = ステータスãƒãƒ¼ stemming = èªžå¹¹å‡¦ç† stop = 終了 stopped_at = åœæ­¢ã—ã¾ã—㟠stopword_list = ストップワードリスト strings_found_% = %箇所ヒットã—ã¾ã—ãŸã€‚ strings_replaced = æ–‡å­—åˆ—ã‚’ç½®ãæ›ãˆã¾ã—ãŸã€‚ strip_ns = åå‰ç©ºé–“ã®é™¤åŽ» syntax = 文法 table = テーブル target_path = ターゲットパス team = ãƒãƒ¼ãƒ  text = テキスト text_index = テキストインデックス text_length = テキスト長 time_needed = æ‰€è¦æ™‚é–“ timeout_exceeded = タイムアウトã«ãªã‚Šã¾ã—ãŸã€‚ timestamp = タイムスタンプ timing = タイミング total_mem = メモリåˆè¨ˆ total_time = åˆè¨ˆæ™‚é–“ translation = 翻訳 tree = ツリー tree_options = ツリーオプション try_% = %を試ã—ã¦ãã ã•ã„。 try_more_% = % ã¨å…¥åŠ›ã™ã‚‹ã¨å…¨èˆ¬çš„ãªæƒ…å ±ãŒå¾—られã¾ã™ã€‚ try_specific_% = % ã¨å…¥åŠ›ã™ã‚‹ã¨ã€ã‚³ãƒžãƒ³ãƒ‰ã«ã¤ã„ã¦ã®æƒ…å ±ãŒå¾—られã¾ã™ã€‚ type = タイプ undo = å…ƒã«æˆ»ã™ unknown_cmd_% = '%' 䏿˜Žãªã‚³ãƒžãƒ³ãƒ‰ã§ã™ã€‚ unknown_host_x = '%' ã¯ä¸æ˜Žãªãƒ›ã‚¹ãƒˆåã§ã™ã€‚ unknown_option_% = '%' ã¯ä¸æ˜Žãªã‚ªãƒ—ションã§ã™ã€‚ unknown_parser_% = '%' ã¯ä¸æ˜Žãªãƒ‘ーサã§ã™ã€‚ unknown_user_% = ユーザー '%' ãŒè¦‹ä»˜ã‹ã‚Šã¾ã›ã‚“。 unwatching_event_% = イベント '%' ã¯ç›£è¦–外ã§ã™ã€‚ up_to_date = 最新 updated = æ›´æ–°ã—ã¾ã—㟠use_catalog_file = XMLカタログファイルを使用ã™ã‚‹ used_mem = ãƒ¡ãƒ¢ãƒªä½¿ç”¨é‡ user_created_% = ユーザー '%' ãŒä½œæˆã•れã¾ã—ãŸã€‚ user_dropped_% = ユーザー '%' ã¯å‰Šé™¤ã•れã¾ã—ãŸã€‚ user_dropped_%_% = ユーザー '%' ã¯ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ '%' ã‹ã‚‰å‰Šé™¤ã•れã¾ã—ãŸã€‚ user_exists_% = ユーザー '%' ã¯æ—¢ã«å­˜åœ¨ã—ã¾ã™ã€‚ user_logged_in_% = ユーザー '%' ã¯ç¾åœ¨ãƒ­ã‚°ã‚¤ãƒ³ã—ã¦ã„ã¾ã™ã€‚ username = ユーザーå users = ユーザー users_% = % ユーザー value = 値 version = ãƒãƒ¼ã‚¸ãƒ§ãƒ³ view = ビュー watching_event_% = イベント '%' を監視ã—ã¦ã„ã¾ã™. whole_word = å˜èªžå…¨ä½“ write_locking = Write Locking ws_chopping = 空白ã®é™¤åŽ» xquery = XQuery yes = ã¯ã„ # Help texts h_about = ã“ã®ãƒ—ロジェクトã«ã¤ã„ã¦ã®æ¦‚è¦ã‚’表示ã—ã¾ã™ã€‚ h_attr_index = ã“ã®ã‚¤ãƒ³ãƒ‡ãƒƒã‚¯ã‚¹ã¯å±žæ€§æ¯”較を高速化ã—ã¾ã™ã€‚ h_browser_error_% = ブラウザã®èµ·å‹•ã«å¤±æ•—ã—ã¾ã—ãŸã€‚ä»»æ„ã®ãƒ–ラウザã§ã“ã®URLを指定ã—ã¦é–‹ã„ã¦ãã ã•ã„:\n\n% h_buttons = ボタンãƒãƒ¼ã®ã‚ªãƒ³ãƒ»ã‚ªãƒ•を切り替ãˆã¾ã™ã€‚ h_case = å¤§æ–‡å­—å°æ–‡å­—ã®åŒºåˆ¥ãŒã‚¤ãƒ³ãƒ‡ãƒƒã‚¯ã‚¹å†…ã«ä¿æŒã•れã¾ã™ã€‚ h_chop_ws = ã“ã®ã‚ªãƒ—ションã¯ã‚¿ã‚°ã¨ã‚³ãƒ³ãƒ†ãƒ³ãƒ„ã®é–“ã«ã‚ã‚‹å…¨ã¦ã®ç©ºç™½ã‚’削除ã—ã¾ã™ã€‚ h_close = ç¾åœ¨ã®ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã‚’é–‰ã˜ã¾ã™ã€‚ h_close_file = ç¾åœ¨é–‹ã„ã¦ã„るファイルを閉ã˜ã¾ã™ã€‚ h_colors = アプリケーションã®é…色を変更ã—ã¾ã™ã€‚ h_community = コミュニティã®Webページを開ãã¾ã™(デフォルトã®ãƒ–ラウザを起動ã—ã¾ã™)。 h_copy = ç¾åœ¨é¸æŠžä¸­ã®XMLノードをコピーã—ã¾ã™ã€‚ h_copy_path = ãƒ‘ã‚¹ã‚’é¸æŠžã•れãŸXMLノードã«ã‚³ãƒ”ーã—ã¾ã™ã€‚ h_db_format = データベース形å¼ã‚’変更ã—ã¾ã—ãŸã€‚æ–°ã—ã„データベースを作æˆã—ã¦ä¸‹ã•ã„。 h_delete = XMLノードを削除ã—ã¾ã™ã€‚ h_diacritics = インデックス内ã§ä»˜åŠ è¨˜å·ï¼ˆã‚¦ãƒ ãƒ©ã‚¦ãƒˆç­‰ï¼‰ã¯ä¿æŒã•れã¾ã™ã€‚ h_edit = XMLノードã®ç·¨é›†ã€‚ h_editor = クエリーパãƒãƒ«ã‚’表示ã—ã¾ã™ã€‚ h_execute_query = クエリーを実行ã—ã¾ã™ã€‚ h_exit = アプリケーションを終了ã—ã¾ã™ã€‚ h_explorer = クエリーパãƒãƒ«ã‚’表示ã—ã¾ã™ã€‚ h_export = ç¾åœ¨ã®ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã‚’エクスãƒãƒ¼ãƒˆã—ã¾ã™ã€‚ h_filter_selected = é¸æŠžã•れãŸãƒŽãƒ¼ãƒ‰ã‚’フィルターã—ã¾ã™ã€‚ h_folder = 視覚化ã•れãŸãƒ•ォルダーを表示ã—ã¾ã™ã€‚ h_fonts = フォントを変更ã—ã¾ã™ã€‚ h_fullscreen = 全画é¢è¡¨ç¤ºã—ã¾ã™ã€‚ h_fulltext_index = 全文テキストインデックスã¯å…¨æ–‡æ¤œç´¢ã‚’高速化ã—ã¾ã™ã€‚ h_go_home = ãƒ«ãƒ¼ãƒˆãƒŽãƒ¼ãƒ‰ã¸æˆ»ã‚Šã¾ã™ã€‚ h_go_to_line = 指定ã—ãŸè¡Œã¸ã‚¸ãƒ£ãƒ³ãƒ—ã—ã¾ã™ã€‚ h_go_up = 1階層上ã«è¡Œãã¾ã™ã€‚ h_help = Webページã®ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆã‚’表示ã—ã¾ã™ã€‚ h_html_parser = TagSoup パーサ㯠HTML ã‚’ XML ã«å¤‰æ›ã—ã¾ã™ã€‚ h_index_format = インデックス形å¼ã‚’変更ã—ã¾ã—ãŸã€‚æ–°ã—ãインデックスを作æˆã—ã¦ä¸‹ã•ã„。 h_input_bar = 入力フィールドã®è¡¨ç¤ºã‚’切り替ãˆã¾ã™ã€‚ h_int_parser = フォールトトレラントã€Javaã®ãƒ‡ãƒ•ォルトパーサより高速。 h_languauge = 指定ã•れãŸè¨€èªžã®ãƒ†ã‚­ã‚¹ãƒˆãƒ‘ーサãŒä½¿ç”¨ã•れã¾ã™ã€‚ h_large_db = % ã¯å·¨å¤§ãªãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã§ã™ã€‚処ç†é€Ÿåº¦å‘上ã®ãŸã‚ã«\nã„ãã¤ã‹ã®ãƒ“ジュアライゼーションを閉ã˜ã¾ã™ã‹ï¼Ÿ h_map = マップビューを表示ã—ã¾ã™ã€‚ h_map_layout = マップレイアウトを変更ã—ã¾ã™ã€‚ h_new = é¸æŠžã•れãŸXML文書ã‹ã‚‰ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã‚’作æˆã—ã¾ã™ã€‚ h_new_file = æ–°ã—ã„ファイルを作æˆã—ã¾ã™ã€‚ h_new_node = æ–°ã—ã„XMLノードを作æˆã—ã¾ã™ã€‚ h_new_version = æ–°ã—ã„ãƒãƒ¼ã‚¸ãƒ§ãƒ³ãŒåˆ©ç”¨å¯èƒ½ã§ã™ (% %)!\nアップデートã—ã¾ã™ã‹ï¼Ÿ h_no_html_parser = HTMLパーサã¯åˆ©ç”¨ã§ãã¾ã›ã‚“。通常㮠XML ã¨ã—ã¦æ‰±ã„ã¾ã™ã€‚ h_open_file = XQueryファイルを開ãã¾ã™ã€‚ h_open_manage = データベースを管ç†ã—ã¾ã™ã€‚ h_out_of_mem = - -Xmx<サイズ>を使ã†ã“ã¨ã§ã€Javaã®ãƒ’ープサイズを増やã™ã“ã¨ãŒå‡ºæ¥ã¾ã™ã€‚\n- BaseXã®å†…部XMLパーサー㫠'set intparse on' を設定ã—ã¦ã¿ã¦ä¸‹ã•ã„。 \n- ã„ãã¤ã‹ã®ã‚¤ãƒ³ãƒ‡ãƒƒã‚¯ã‚¹ã‚’無効ã«ã™ã‚‹ã“ã¨ã«ã‚ˆã‚Šãƒ¡ãƒ¢ãƒªãƒ¼ã‚’節約ã§ãã¾ã™ã€‚ h_packages = リストã€ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã€ãŠã‚ˆã³XQueryã®ãƒ‘ッケージを削除ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚ h_paste = 以å‰ã‚³ãƒ”ーã—ãŸãƒŽãƒ¼ãƒ‰ã‚’貼付ã‘ã¾ã™ã€‚ h_path_index = パスサマリーã¯ãƒ‘スレゾリューションを高速化ã—ã¾ã™ã€‚ h_plot = 散布図(scatter-plot)を表示ã—ã¾ã™ã€‚ h_preferences = アプリケーションã®è¨­å®šã‚’表示ã—ã¾ã™ã€‚ h_properties = ç¾åœ¨é¸æŠžã•れã¦ã„るデータベースã«ã¤ã„ã¦ã®æƒ…報を表示ã—ã¾ã™ã€‚ h_query_info = クエリー情報パãƒãƒ«ã‚’表示ã—ã¾ã™ã€‚ h_recently_open = 最近オープンã—ãŸãƒ•ァイル。 h_replace = 検索ï¼ç½®æ› h_reopen_file = ç¾åœ¨é–‹ã„ã¦ã„るファイルを開ãç›´ã—ã¾ã™ã€‚ h_result = テキストビューを表示ã—ã¾ã™ã€‚ h_rt_execution = ã“ã®ã‚ªãƒ—ã‚·ãƒ§ãƒ³ãŒæœ‰åйãªå ´åˆã€ã‚­ãƒ¼å…¥åŠ›ã®åº¦ã«ã‚¯ã‚¨ãƒªãƒ¼ãŒå®Ÿè¡Œã•れã¾ã™ã€‚ h_rt_filtering = ã“ã®ã‚ªãƒ—ã‚·ãƒ§ãƒ³ãŒæœ‰åйãªå ´åˆã€ã‚¯ã‚¨ãƒªãƒ¼çµæžœãŒè‡ªå‹•çš„ã«ãƒ•ィルターã•れã¾ã™ã€‚ h_save = ファイルをä¿å­˜ã—ã¾ã™ã€‚ h_save_result = æ¤œç´¢çµæžœã‚’ä¿å­˜ã—ã¾ã™ã€‚ h_show_history = 入力履歴ã®è¡¨ç¤ºã€‚ h_status_bar = ステータスãƒãƒ¼ã®è¡¨ç¤ºãƒ»éžè¡¨ç¤ºã‚’切り替ãˆã¾ã™ã€‚ h_stemming = インデックスãŒä½œæˆã•れるå‰ã«ã€å˜èªžã®èªžå¹¹ãŒæŠ½å‡ºã•れã¾ã™ã€‚ h_stop_process = ç¾åœ¨ã®æ“作を中止ã—ã¾ã™ã€‚ h_stopwords = 頻出ã™ã‚‹èªžã‚’スキップã™ã‚‹ã‚¹ãƒˆãƒƒãƒ—ãƒ¯ãƒ¼ãƒ‰ãƒªã‚¹ãƒˆã‚’é¸æŠžã—ã¦ãã ã•ã„。 h_table = テーブルビューを表示ã—ã¾ã™ã€‚ h_text_index = ã“ã®ã‚¤ãƒ³ãƒ‡ãƒƒã‚¯ã‚¹ã¯ãƒ†ã‚­ã‚¹ãƒˆæ¯”較を高速化ã—ã¾ã™ã€‚ h_tree = 視覚化ã•れãŸãƒ„リーを表示ã—ã¾ã™ã€‚ h_tree_options = ツリービューã®ã‚ªãƒ—ション。 h_updates = 更新情報を開ãã¾ã™ã€‚ h_used_mem = メモリãŒå°‘ãªã„å ´åˆã¯BaseXã‚’èµ·å‹•ã™ã‚‹éš›ã«ã€\nJavaã®ã‚³ãƒžãƒ³ãƒ‰ãƒ©ã‚¤ãƒ³å¼•æ•° -Xmx <サイズ> を付ã‘ã¦ä¸‹ã•ã„。 # Commands c_add1 = リソースã®è¿½åŠ  c_add2 = [%] ã‚’ [%] ã¨ã—ã¦ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã«è¿½åŠ ã—ã¾ã™ã€‚ c_alter1 = データベースåã€ã¾ãŸã¯ã€ãƒ¦ãƒ¼ã‚¶ãƒ‘スワードã®å¤‰æ›´ã€‚ c_alter2 = データベースã®åç§°ã€ã¾ãŸã¯ã€ãƒ¦ãƒ¼ã‚¶ãƒ¼ãƒ‘スワードを変更ã—ã¾ã™: c_alterdb = データベースã®å称を変更ã—ã¾ã™ã€‚ c_alterpw = ユーザã®ãƒ‘スワードを変更ã—ã¾ã™ã€‚ c_check1 = データベースã®ã‚ªãƒ¼ãƒ—ンã€ã¾ãŸã¯ã€ä½œæˆã€‚ c_check2 = 既存ã®ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã‚’é–‹ãã‹ã€ã¾ãŸã¯ã€æ–°ã—ã„インスタンスを作æˆã—ã¾ã™ã€‚ c_close1 = ç¾åœ¨ã®ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã‚’é–‰ã˜ã‚‹ c_close2 = ç¾åœ¨ã®ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã‚’é–‰ã˜ã¦ã€ãƒ¡ã‚¤ãƒ³ãƒ¡ãƒ¢ãƒªã‚’リセットã—ã¾ã™ã€‚ c_copy1 = データベースã®ã‚³ãƒ”ー。 c_copy2 = コピーã•れãŸãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã‚’æ–°ã—ã作æˆã—ã¾ã™ã€‚ c_create1 = データベースã€ã‚¤ãƒ³ãƒ‡ãƒƒã‚¯ã‚¹ã€ãƒ¦ãƒ¼ã‚¶ã€ãƒãƒƒã‚¯ã‚¢ãƒƒãƒ—ã€ã¾ãŸã¯ã‚¤ãƒ™ãƒ³ãƒˆã®ä½œæˆ c_create2 = æ–°ã—ã„データベースã€ã‚¤ãƒ³ãƒ‡ãƒƒã‚¯ã‚¹ã€ãƒ¦ãƒ¼ã‚¶ã€ãƒãƒƒã‚¯ã‚¢ãƒƒãƒ—ã€ã¾ãŸã¯ã‚¤ãƒ™ãƒ³ãƒˆã®ã„ãšã‚Œã‹ã‚’作æˆã—ã¾ã™: c_create3 = データベースを作æˆã—ã¾ã™ [%]。 [%] をオプションã¨ã—ã¦æŒ‡å®šã§ãã¾ã™ã€‚ c_create4 = データベースã®ãƒãƒƒã‚¯ã‚¢ãƒƒãƒ—ã‚’ [%] ã«ä½œæˆã—ã¾ã™ c_create5 = 指定ã•れãŸã‚¤ãƒ³ãƒ‡ãƒƒã‚¯ã‚¹ã‚’作æˆã—ã¾ã™ã€‚ c_create8 = 指定ã•れãŸãƒ¦ãƒ¼ã‚¶ãƒ¼ã‚’作æˆã—ã¾ã™ã€‚ c_create9 = イベントを作æˆã—ã¾ã™ã€‚ c_cs1 = XQueryã®å®Ÿè¡Œã¨ã€ã‚³ãƒ³ãƒ†ã‚­ã‚¹ãƒˆã‚»ãƒƒãƒˆã¸ã®çµæžœã®ã‚»ãƒƒãƒˆã€‚ c_cs2 = 指定ã•れãŸã‚¯ã‚¨ãƒªãƒ¼ã‚’実行ã—ã€æ–°ã—ã„コンテキストセットã¨ã—ã¦çµæžœã‚’セットã—ã¾ã™ã€‚ c_delete1 = リソースã®å‰Šé™¤ c_delete2 = ç¾åœ¨ã®ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã‹ã‚‰ãƒªã‚½ãƒ¼ã‚¹ãƒˆã‚’削除ã—ã¾ã™ã€‚ c_drop1 = データベースã€ã‚¤ãƒ³ãƒ‡ãƒƒã‚¯ã‚¹ã€ãƒ¦ãƒ¼ã‚¶ã€ãƒãƒƒã‚¯ã‚¢ãƒƒãƒ—ã€ã¾ãŸã¯ã‚¤ãƒ™ãƒ³ãƒˆã®å‰Šé™¤ c_drop2 = データベースã€ã‚¤ãƒ³ãƒ‡ãƒƒã‚¯ã‚¹ã€ãƒ¦ãƒ¼ã‚¶ã€ãƒãƒƒã‚¯ã‚¢ãƒƒãƒ—ã€ã¾ãŸã¯ã‚¤ãƒ™ãƒ³ãƒˆã®ã„ãšã‚Œã‹ã‚’削除ã—ã¾ã™ã€‚ c_drop21 = データベースを削除ã—ã¾ã™ã€‚ c_drop22 = 指定ã•れãŸã‚¤ãƒ³ãƒ‡ãƒƒã‚¯ã‚¹ã‚’削除ã—ã¾ã™ã€‚ c_drop23 = 指定ã•れ㟠(database 上ã®) ユーザを削除ã—ã¾ã™ã€‚ c_drop24 = データベースã®ãƒãƒƒã‚¯ã‚¢ãƒƒãƒ—を削除ã—ã¾ã™ã€‚ c_drop25 = イベントを削除ã—ã¾ã™ã€‚ c_execute1 = コマンドスクリプトを実行ã—ã¾ã™ã€‚ c_execute2 = 指定ã•れ㟠[%] をコマンドスクリプトã¨ã—ã¦å®Ÿè¡Œã—ã¾ã™ã€‚ c_exit1 = アプリケーションã®çµ‚了 c_exit2 = % を終了ã—ã¾ã™ã€‚ c_export1 = データベースをXMLã§å‡ºåŠ› c_export2 = ç¾åœ¨ã®ã‚³ãƒ³ãƒ†ã‚¯ã‚¹ãƒˆã‚’XML文書ã¨ã—㦠[%] ã«å‡ºåŠ›ã—ã¾ã™ã€‚ c_find1 = キーワードクエリーã®è©•価 c_find2 = 以下ã®ä¿®é£¾å­ãŒä½¿ãˆã¾ã™ã€‚:\n = : 完全ã«ä¸€è‡´ã™ã‚‹ãƒ†ã‚­ã‚¹ãƒˆãƒŽãƒ¼ãƒ‰ã‚’検索ã—ã¾ã™\n @= : 完全ã«ä¸€è‡´ã™ã‚‹å±žæ€§ã‚’検索ã—ã¾ã™ã€‚\n @ : 属性を検索ã—ã¾ã™ã€‚ c_flush1 = データベースã®ãƒ•ラッシュ。 c_flush2 = ã™ã¹ã¦ã®ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ãƒãƒƒãƒ•ã‚¡ã‚’ãƒ•ã‚¡ã‚¤ãƒ«ã«æ›¸ãè¾¼ã¿ã¾ã™ã€‚ c_get1 = グローãƒãƒ«ã‚ªãƒ—ションを表示ã—ã¾ã™ã€‚ c_get2 = グローãƒãƒ«ã‚ªãƒ—ションã®å€¤ã‚’表示ã—ã¾ã™ã€‚ c_grant1 = パーミッションã®ä»˜ä¸Ž c_grant2 = ユーザーã«ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã«å¯¾ã™ã‚‹ãƒ‘ーミッションを与ãˆã¾ã™ã€‚ c_help1 = ヘルプをオンã«ã™ã‚‹ % コマンド c_help2 = [%] ãŒæŒ‡å®šã•れãŸå ´åˆã€æŒ‡å®šã•れãŸã‚³ãƒžãƒ³ãƒ‰ã«é–¢ã™ã‚‹æƒ…å ±ãŒ\n 表示ã•れã¾ã™ã€‚指定ã—ãªã‹ã£ãŸå ´åˆã¯å…¨ã¦ã®ã‚³ãƒžãƒ³ãƒ‰ãŒè¡¨ç¤ºã•れã¾ã™ã€‚ c_info1 = ç¾åœ¨ã®ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã«é–¢ã™ã‚‹æƒ…報を表示ã—ã¾ã™ã€‚ c_info21 = ç¾åœ¨é–‹ã„ã¦ã„るデータベースã«é–¢ã™ã‚‹æƒ…報を表示ã—ã¾ã™ã€‚ c_info22 = 引数無ã—: 一般事項ã®è¡¨ç¤º c_info23 = データベース情報を表示ã—ã¾ã™ã€‚ c_info24 = インデックス情報を表示ã—ã¾ã™ã€‚ c_info25 = XMLテーブルã®è¡¨ç¤º c_inspect1 = æ•´åˆæ€§ãƒã‚§ãƒƒã‚¯ã‚’実行ã—ã¾ã™ã€‚ c_inspect2 = エラーã®ãŸã‚データベースをãƒã‚§ãƒƒã‚¯ã—ã¾ã™ã€‚ c_kill1 = ユーザーセッションã®å¼·åˆ¶åˆ‡æ–­ c_kill2 = 指定ã•れãŸãƒ¦ãƒ¼ã‚¶ãƒ¼ã®å…¨ã¦ã®ã‚»ãƒƒã‚·ãƒ§ãƒ³ã‚’切断ã—ã¾ã™ã€‚ c_list1 = 利用å¯èƒ½ãªãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã®ä¸€è¦§ c_list2 = 利用å¯èƒ½ãªãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã®ä¸€è¦§ã‚’表示ã—ã¾ã™ã€‚ c_open1 = データベースを開ã c_open2 = [%]データベースを開ãã¾ã™ï¼ˆ[%] フィルターを使用ã—ã¾ã™ï¼‰ã€‚ c_optimize1 = ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã®æœ€é©åŒ– c_optimize2 = ç¾åœ¨é–‹ã„ã¦ã„るデータベースを最é©åŒ–ã—ã¾ã™ã€‚\n % ãŒæŒ‡å®šã•れãŸå ´åˆã€ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã‚µã‚¤ã‚ºã¯æœ€å°åŒ–ã•れã¾ã™ã€‚ c_password1 = パスワードã®å¤‰æ›´ c_password2 = パスワードを変更ã—ã¾ã™ã€‚ c_rename1 = データベースã®ãƒªã‚½ãƒ¼ã‚¹ãƒˆãƒ‘スをリãƒãƒ¼ãƒ ã€‚ c_rename2 = ç¾åœ¨é–‹ã„ã¦ã„るデータベースã®ãƒªã‚½ãƒ¼ã‚¹ãƒˆãƒ‘スå称をリãƒãƒ¼ãƒ ã—ã¾ã™ã€‚ c_replace1 = データベースã®ãƒªã‚½ãƒ¼ã‚¹ãƒˆã‚’ç½®æ›ã€‚ c_replace2 = ç¾åœ¨é–‹ã„ã¦ã„るデータベースã®ãƒªã‚½ãƒ¼ã‚¹ãƒˆã‚’ç½®æ›ã—ã¾ã™ã€‚ c_repo1 = パッケージã®ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã€å‰Šé™¤ã€ã¾ãŸã¯ã€ãƒªã‚¹ãƒˆè¡¨ç¤ºã€‚ c_repo2 = パッケージをレãƒã‚¸ãƒˆãƒªã‹ã‚‰ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã€å‰Šé™¤ã€ã¾ãŸã¯ã€ãƒªã‚¹ãƒˆè¡¨ç¤ºã—ã¾ã™ c_repo3 = åå‰ [%] ã¾ãŸã¯ã€ ディレクトリ [%] を指定ã—ã¦ã€ãƒ‘ッケージを削除ã—ã¾ã™ã€‚ c_repo4 = パス [%] ã‹ã‚‰ãƒ‘ッケージをインストールã—ã¾ã™ã€‚ c_repo5 = æ—¢ã«ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«æ¸ˆã¿ã®ãƒ‘ッケージをリスト表示ã—ã¾ã™ã€‚ c_restore1 = データベースã®ãƒªã‚¹ãƒˆã‚¢ã€‚ c_restore2 = データベースをリストアã—ã¾ã™ã€‚引数ã«\nãƒãƒƒã‚¯ã‚¢ãƒƒãƒ—ファイルã®ã‚¿ã‚¤ãƒ ã‚¹ã‚¿ãƒ³ãƒ—ã‚’å«ã‚ã‚‹ã“ã¨ãŒå‡ºæ¥ã¾ã™ã€‚ c_retrieve1 = Rawデータをå–り出ã—ã¾ã™ã€‚ c_retrieve2 = Rawデータを指定ã•れ㟠[%] ã‹ã‚‰å–り出ã—ã¾ã™ã€‚ c_run1 = クエリã¾ãŸã¯ã‚³ãƒžãƒ³ãƒ‰ã‚¹ã‚¯ãƒªãƒ—トを実行ã—ã¾ã™ã€‚ c_run2 = [%] ã®å†…容をクエリã¾ãŸã¯ã‚³ãƒžãƒ³ãƒ‰ã‚¹ã‚¯ãƒªãƒ—トを実行ã—ã¾ã™ã€‚ c_set1 = グローãƒãƒ«ã‚ªãƒ—ションをセットã—ã¾ã™ã€‚ c_set2 = æ–°ã—ã„値をデータベースオプションã«ã‚»ãƒƒãƒˆã—ã¾ã™ã€‚ c_show1 = サーãƒãƒ¼æƒ…å ±ã®è¡¨ç¤º c_show21 = サーãƒãƒ¼æƒ…報を表示ã—ã¾ã™: c_show23 = ç¾åœ¨ã®ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã‚»ãƒƒã‚·ãƒ§ãƒ³ã‚’表示ã—ã¾ã™ã€‚ c_show24 = データベースã«ã‚¢ã‚¯ã‚»ã‚¹ã§ãるユーザーを表示ã—ã¾ã™ã€‚ c_show25 = ãƒãƒƒã‚¯ã‚¢ãƒƒãƒ—を表示ã—ã¾ã™ã€‚ c_show26 = イベントを表示ã—ã¾ã™ã€‚ c_store1 = Rawデータを格ç´ã—ã¾ã™ã€‚ c_store2 = Rawデータを指定ã•れ㟠[%] ã«æ ¼ç´ã—ã¾ã™ã€‚ c_xquery1 = XQueryã®å®Ÿè¡Œ c_xquery2 = 指定ã•れãŸã‚¯ã‚¨ãƒªãƒ¼ã‚’実行ã—ã€çµæžœã‚’表示ã—ã¾ã™ # Server texts; will be outsourced s_adlogin = 管ç†è€…ログイン (ローカルã‚ã‚‹ã„ã¯ãƒªãƒ¢ãƒ¼ãƒˆ) s_connect = 接続 s_connected = %:% ã«æŽ¥ç¶šã•れã¾ã—ãŸã€‚ s_createu = ãƒ¦ãƒ¼ã‚¶ãƒ¼ä½œæˆ s_dbrevoke = パーミッション '%'å–り消㗠s_disconnected = 切断ã•れã¾ã—ãŸã€‚ s_drquestion = % ユーザーãŒå‰Šé™¤ã•れã¾ã™ s_globperm = グローãƒãƒ«ãƒ‘ーミッション s_host = ホスト s_info1 = ã“ã®ãƒ€ã‚¤ã‚¢ãƒ­ã‚°ã¯ã‚¯ãƒ©ã‚¤ã‚¢ãƒ³ãƒˆãƒ»ã‚µãƒ¼ãƒãƒ¼ç’°å¢ƒã®è¨­å®šã®ãŸã‚ã®ã‚‚ã®ã§ã™ã€‚ s_info2 = GUI機能ã«ã¯å½±éŸ¿ã‚’与ãˆã¾ã›ã‚“。 s_locallogs = ログ s_localport = ローカルãƒãƒ¼ãƒˆ s_localserver = ローカルサーãƒãƒ¼ s_locperm = ローカルパーミッション s_port = ãƒãƒ¼ãƒˆ s_sessions = セッション s_alter = 変更 s_server_admin = サーãƒãƒ¼ç®¡ç† s_h_server_admin = ユーザー管ç†ã€ãŠã‚ˆã³ãƒ­ã‚°ãƒˆãƒ¬ãƒ¼ã‚¹ã®ç”»é¢ã‚’表示ã—ã¾ã™ã€‚ basex-7.7.2/basex-core/src/main/resources/lang/Mongolian.lang000066400000000000000000001155531222453003200241200ustar00rootroot00000000000000# LANGUAGE FILE, TRANSLATED BY # Tuguldur Jamiyansharav, CSMS 2011 # E-mail at: tuguldur0519@gmail.com OFF = Хаалттай ON = ÐÑÑлттÑй about_% = % тухай access_denied = Хандалт амжилтгүй. add = ÐÑмÑÑ… add_raw_files = ҮлдÑÑн боловÑруулагдаагүй файлуудыг нÑмÑÑ… add_resources = Add Resources adjust_nodes = Ð—Ð°Ð½Ð³Ð¸Ð»Ð°Ð°Ð½Ð°Ð°Ñ Ñ‚ÐµÐºÑтрүү өөрчлөх admin_static_% = Ðдмин Ñ…ÑÑ€ÑглÑгч өөрчлөгдөж чадахгүй байна. algorithm = Ðлгоритм all = Бүгд alter_pw = Ðууц үг өөрчлөх and_others = Болон буÑад are_you_sure = Та итгÑлтÑй байна уу? attribute = Ðтрибут attribute_index = Ðтрбут Ð¸Ð½Ð´ÐµÐºÑ attributes = Ðтрибутууд backup = Ðөөцлөх backup_dropped_% = Ðөөцлөлт '%' уÑтгагдÑан байна. backup_not_found_% = '%'-нд зориулÑан нөөцлөлт байхгүй байна. backups = Ðөөцлөлтүүд backups_% = % нөөцлөлтүүд binaries = Хоёртын Ñ‚ÑмдÑгтүүд blue = ЦÑнхÑÑ€ bold = Тодоор browse = Байршил Ñонгох buttons = Товчлуурууд bye1 = Өдрийг Ñайхан өнгөрүүлÑÑÑ€Ñй. bye2 = Дараа уулзъÑ. bye3 = Цагыг зугаатай өнгөөрүүлөөрÑй. bye4 = Ðз жаргалтай амьдрал. cancel = Цуцлах case_sensitivity = Томоор бичигдÑÑ… check_for_updates = ШинÑчлÑлтүүдийг шалгах chief_architect = Ерөнхий архитектур children_text_len = Хүүхдүүд/текÑтийн урт choose_dir = Байршил Ñонгох choose_font = Фонт Ñонгох chop_ws = БичиглÑлийн илүү Ñул зайг хаÑах chopped = ХаÑагдÑан clear = ЦÑвÑрлÑÑ… close = Хаах close_file_% = Өөрчлөлтийг %-нд хадгалах? color_schema = Өнгөний загвар colors = Өнгө command = Комманд command_canceled = Command was canceled. comment = СÑтгÑгдÑл community = Олон нийтийн харилцаа compiling = ХөрвүүлÑлт connect = Холбогдох connection_error = СервертÑй холбогдож чадахгүй байна. copy = Хуулах copy_db = Өгөгдлийн Ñанг хуулах copy_path = Байршил хуулах create = Ò®Ò¯ÑгÑÑ… create_database = Өгөгдлийн Ñанг Ò¯Ò¯ÑгÑÑ… create_stats = СтатиÑтик үзүүлÑлт Ò¯Ò¯ÑгÑÑ… creating_db = Өгөгдлийн Ñанг Ò¯Ò¯ÑгÑÑ… creating_indexes = ИндекÑүүдийг Ò¯Ò¯ÑгÑÑ… cut = БүрмөÑөн хуулах database = Өгөгдлийн Ñан database_path = Өгөгдлийн Ñангийн байршил (Өгөгдлийн Ñангийн байршил гар аргаар өөрчлөгдÑөн байх Ñ‘Ñтой.) databases = Өгөгдлийн Ñангууд databases_% = % өгөгдлийн Ñан(гууд) db_backup_% = Ðөөцлөлт '%' нь %-нд Ò¯Ò¯ÑÑÑн. db_closed_% = Өгөгдлийн Ñан '%' хаагдÑан байна. db_copied_% = '%' хуулбар %-нд Ò¯Ò¯ÑÑÑн байна. db_corrupt = Ðнхааруулга: өгөгдлийн Ñан уÑтгагдах болно! db_created_%_% = Өгөгдлийн Ñан '%' нь %-нд Ò¯Ò¯ÑÑÑн байна. db_dropped_% = Өгөгдлийн Ñан '%' уÑтгагдÑан. db_exists_% = Өгөгдлийн Ñан '%' аль Ñ…ÑÐ´Ð¸Ð¹Ð½Ñ Ò¯Ò¯ÑÑÑн байна. db_exported_% = Өгөгдлийн Ñан '%' нь %-нд ÑкÑпорт хийгдÑÑн. db_flushed_% = Өгөгдлийн Ñан '%' нь %-д орÑон байна. db_not_backup_% = Өгөгдлийн Ñан '%'-ий(Ñ‹)н нөөцлөлт Ò¯Ò¯ÑÑÑгүй байна. db_not_copied_% = '%'хуулбар Ò¯Ò¯ÑÑÑгүй байна. db_not_dropped_% = Өгөгдлийн Ñан '%' уÑтгагдÑангүй. db_not_found_% = Өгөгдлийн Ñан '%' олдÑонгүй. db_not_renamed_% = Өгөгдлийн Ñан '%' нÑÑ€ өөрчлөгдÑөнгүй. db_not_restored_% = '%' ÑÑргÑÑгдÑÑгүй байна. db_opened_% = Өгөгдлийн Ñан '%' нь %-нд нÑÑгдÑÑн. db_optimized_% = Өгөгдлийн Ñан '%' нь %-нд шинÑчлÑгдÑÑн. db_pinned_% = Өгөгдлийн Ñан '%' нь аль Ñ…ÑÐ´Ð¸Ð¹Ð½Ñ Ó©Ó©Ñ€ клиент дÑÑÑ€ нÑÑгдÑÑн байна. db_props = Өгөгдлийн Ñангийн тохиргоонууд db_renamed_% = Өгөгдлийн Ñан '%' нь '%' нÑртÑй болж өөрчлөгдÑөн. db_restored_% = '%' нь %-нд ÑÑргÑÑгдÑÑн. db_updated_% = Өгөгдлийн Ñан '%' нь шинÑчлÑлт хийгдÑж байÑан байна ÑÑвÑл шинÑчлÑлт гүйцÑтгÑгдÑÑнгүй. delete = УÑтгах delete_all = Бүгдийг уÑтгах delete_nodes = Та уÑтгахдаа итгÑлтÑй байна уу? delete_packages_% = % багц уÑтгагдах болно. diacritics = Ялгах Ñ‚ÑмдÑгнүүд dir_not_empty = Байршил хооÑон биш байна disconnect = Холболт цуцлах document = Документ documents = Документууд drop = УÑтгах (өгөгдлийн Ñан) drop_backups_% = % Ðөөцлөлт(үүд) уÑгагдах болно. dropping_db_% = % өгөгдлийн Ñан уÑтгагдÑан. edit = ЗаÑах edit_% = % заÑах edit_data = Өгөгдөл заÑах editor = ЗаÑварлагч element = Элемент elements = Тагууд empty_db = ХооÑон өгөгдлийн Ñан Ò¯Ò¯ÑÑÑн байна. encoding = Юникод хөрвүүлÑлт enter_db_name = Өгөгдлийн Ñангийн нÑÑ€ÑÑ Ð¾Ñ€ÑƒÑƒÐ»Ð½Ð° уу. entries_% = % оролтууд error = Ðлдаатай evaluating = Тооцоололт event_created_% = Үйл ажиллагаа(event) '%' Ò¯Ò¯ÑÑÑн. event_dropped_% = Үйл ажиллагаа(event) '%' уÑтгагдÑан. event_exists_% = Үйл ажиллагаа(event) '%' өмнө Ò¯Ò¯ÑÑÑн байна. event_not_watched_% = Үйл ажиллагаа(event) '%' Ñ…Ñнаагүй байна. event_unknown_% = Үйл ажиллагаа(event) '%' тодорхойгүй. event_watched_% = Үйл ажиллагаа(event) '%' Ñ…ÑнагдÑан байна. events_% = % Үйл ажиллагаа(event(s))-үүд exec_error_% = ХөрвүүлÑгдÑж чадахгүй байна % exit = Хаах expecting_cmd = ÐšÐ¾Ð¼Ð¼Ð°Ð½Ð´Ð°Ð°Ñ Ð³Ð°Ð´ÑƒÑƒÑ€ байна. explorer = ÐÑÑгч export = ÑкÑпортлох file = Файл file_exists_% = % аль Ñ…ÑÐ´Ð¸Ð¹Ð½Ñ Ò¯Ò¯ÑÑÑн байна.\nҮүнийг шинÑÑÑ€ Ò¯Ò¯ÑгÑÑ… Ò¯Ò¯? file_not_deleted_% = Файл '%' нь уÑтгагдаагүй байна. file_not_opened = Файл нÑÑгдÑхгүй байна. file_not_saved = Файл хадгалагдахгүй байна. file_not_stored_% = Файл '%' хадгалагдаагүй байна. file_or_dir = Файл ÑÑвÑл байршил Ñонгох file_patterns = Файлын өргөтгөл (таÑлалаар зааглаж Ð±Ð¸Ñ‡Ð½Ñ Ò¯Ò¯) files_replace_% = Файлууд нь %. дахин шинÑÑÑ€ тодорхойлогдÑон байна. \nЦааш үргÑлжлүүлÑÑ… Ò¯Ò¯? filter = Шүүлт filter_selected = Шүүлт ÑонгогдÑон finishing = ТөгÑөлт first_line_header = Ð¥Ò¯ÑнÑгтийн толгойн Ñ…ÑÑгÑÑÑ€ дамжуулан мөрийг Parsing хийх folder = Ð¥Ð°Ð²Ñ‚Ð°Ñ fonts = Ò®Ñгийн фонт fullscreen = БүтÑн дÑлгÑцÑÑÑ€ fulltext = БүтÑн-текÑÑ‚ fulltext_index = БүтÑн текÑÑ‚ Ð¸Ð½Ð´ÐµÐºÑ general = Ерөнхий general_info = Ерөнхий мÑдÑÑлÑл global_option_% = Global option '%' cannot be set. go_back = Буцах go_forward = Урагшлуулах go_home = ЭхлÑл Ñ€Ò¯Ò¯ буцах go_to_line = Go to line go_up = ДÑÑшлүүлÑÑ… granted_%_% = % нь '%'-нд баталгаажÑан. granted_%_%_% = % нь '%'-нд '%' дÑÑÑ€ баталгаажÑан. green = Ðогоон gui_interactions = GUI & Харилцах цонх help = ТуÑламж help1_use_catalog = Каталогыг бий болгохын тулд дараах байдлаар хандана help2_use_catalog = Apache XML журам тухайн хаÑгын байршилд ÑууÑан байх. hit_s = Ðмжилттай index_attributes = Ðтрибут индекÑжүүлÑлт index_created_%_% = Ð˜Ð½Ð´ÐµÐºÑ '%' нь %-нд Ò¯Ò¯ÑÑÑн. index_dropped_%_% = Ð˜Ð½Ð´ÐµÐºÑ '%' нь %.-нд уÑтгагдÑан index_fulltext = БүтÑн текÑÑ‚ хайлт индекÑжүүлÑлт index_not_dropped_% = Ð˜Ð½Ð´ÐµÐºÑ '%' нь уÑтгагдÑангүй. index_text = ТекÑÑ‚ индекÑжүүлÑлт indexes = ИндекÑүүд information = МÑдÑÑлÑл input_bar = Оролтын комманд Ñ…ÑÑÑг input_format = Оролтын Ñ…ÑлбÑÑ€ input_path = Оролтын зам input_size = Оролтын Ñ…ÑмжÑÑ insert_new_data = Өгөгдөл оруулах install = Install int_parser = Дотоод XML Parser-Ñ€ хөрвүүлÑÑ… interrupted = Interrupted. invalid_% = % нь хүчинтÑй. invalid_value_%_% = '%'-г '%'-руу тохируулах боломжгүй. italics = Ðалуу java_lf = Жава Ñ…ÑлбÑÑ€ÑÑÑ€ харах болон ашиглах kill_self_% = '%' өөрийгөө уÑтгах боломжгүй. language = Ð¥Ñл license = BSD лиценз line = Мөр line_% = Мөр % line_number = Line number main_options = ҮндÑÑн тохиргоонууд manage_db = Өгөгдлийн Ñанг удирдах map = Газрын зураг map_choice1 = Гарчиггүй, ХүрÑÑгүй map_choice2 = Гарчиггүй, ХүрÑÑгүй map_choice3 = Гарчиг, ХүрÑÑгүй map_choice4 = Гарчиг, жижиг хүрÑÑÑ‚Ñй map_choice5 = Гарчиг, том хүрÑÑÑ‚Ñй map_layout = Газрын байршил match_case = Match Case max_nr_of_hits = Оролтуудын хамгийн дÑÑд утга method = Ðрга more_skipped_% = %-Ð°Ð°Ñ Ð¸Ð»Ò¯Ò¯ алгаÑÑан multi_line = Multi-line mode name = ÐÑÑ€ name_invalid_% = ÐÑÑ€ '%' буруу байна. name_of_db = Өгөгдлийн Ñангийн нÑÑ€ name_of_db_copy = Хуулбар өгөгдлийн Ñангийн нÑÑ€ names = ÐÑрүүд namespaces = КлаÑÑуудын багц(Namespaces) new = ШинÑÑÑ€ Ò¯Ò¯ÑгÑÑ… new_db_question = ШинÑÑÑ€ Ó©Ó©Ñ€ нÑгийг Ò¯Ò¯ÑгÑхийг Ñ…Ò¯Ñч байна уу? no = Үгүй no_data = Өгөгдөл байхгүй байна. no_db_dropped = Өгөгдлийн Ñан уÑтгагдаагүй байна. no_db_found = Өгөгдлийн Ñан олдÑонгүй. no_db_opened = Өгөгдлийн Ñан нÑÑгдÑÑгүй байна. no_dir_allowed_% = "%" ÑÑ… байршлыг заах. no_help = Уучлаарай, уг Ñ…ÑÑÑгт туÑламж агуулагдаагүй байна. no_mainmem = Санах ойд комманд байхгүй байна. no_pixels = Зай хүрÑлцÑÑгүй байна. no_stemmer_% = СонгоÑон Ñ…Ñл олдÑонгүй"%". no_tokenizer_% = Ð¥Ñл олдÑонгүй "%". nodes = Зангилаанууд nodes_parsed_% = % зангилаа хөрвүүлÑгдÑÑн not_available = ИдÑвхгүй байна. not_parsed_% = "%" Parse хийгдÑÑгүй байна. number_children = Хүүхдүүдийн тоо Ñ…ÑмжÑÑ offsets = Салаалах ok = OK only_backup = Зөвхөн нөөцлөлтөд хүчинтÑй open = ÐÑÑÑ… open_manage = Удирдах optimize = ШинÑчлÑÑ… optimized_query = Квери options = Тохиргоонууд out_of_date = ШинÑчлÑгдÑÑгүй байна, шинÑчлÑгдÑÑ… шаардлагатай out_of_mem = Санах ой дүүрÑÑн. output_dir = Гаралтын байршил overwrite_db = Өмнөх өгөгдлийн Ñан нь аль Ñ…Ñдийн бичигдÑÑн байна. packages = Packages packages_% = % Багцууд parameters = Parameters parse_archives = Ðрхиваар дамжуулан файлыг Parsing хийх parse_as_jsonml = Parse input as JsonML parse_dtds = DTD-үүд болон объектуудыг Parsing хийх parser_% = % Parser parsing = Parsing хийх password = Ðууц үг paste = Хуулж тавих path = зам path_added_%_% = "%"зам нь % нÑмÑгдÑÑн. path_index = Замын байршил perm_required_% = % Ñ…ÑÑ€ÑглÑгчийн Ñрх шаардагдаж байна. perm_unknown_% = % Ñ…ÑÑ€ÑглÑгчийн Ñрх тодорхойгүй. pi = PI pkg_deleted_% = '%' багц уÑтгагдÑан. pkg_installed_%_% = '%' багц %-нд ÑуугдÑан. pkg_replaced_%_% = '%' багц %-нд ÑолигдÑон. please_wait = Түр хүлÑÑÐ½Ñ Ò¯Ò¯ plot = Схем port_twice_% = Порт '%' нь дахин тодорхойлогдÑон байна. preferences = Тохиргоонууд printed = Ð¥ÑвлÑгдÑÑн printing = Ð¥ÑвлÑлт properties = Тохиргоонууд pw_changed_% = Ð¥ÑÑ€ÑглÑгчийн нууц үг '%' өөрчлөгдÑөн. pw_not_valid = Ðууц үгийн оролтын утга буруу байна. query = Квери query_executed_%_% = % %-нд хөрвүүлÑгдÑÑн. query_info = Квери мÑдÑÑлÑл query_plan = Квери план ratio = ҮзүүлÑлт read_locking = Read Locking red = Улаан redo = ҮйлдÑл ургшлуулах refresh = Дахин ÑÑргÑÑÑ… regular_expr = Regular Expression rename = ÐÑÑ€ өөрчлөх rename_db = Өгөгдлийн Ñангийн нÑрийг өөрчлөх replace_all = Replace all replace_with = Replace with requires_restart = Дахин ачааллах шаардлагатай res_deleted_%_% = % документ нь %-нд уÑтгагдÑан байна. res_not_found = Файл ÑÑвÑл документ олдÑонгүй. res_not_found_% = Файл ÑÑвÑл документ байршил "%" олдÑонгүй. res_props = Ðөөцийн тохиргоонууд res_renamed_%_% = % документ нь %-нд нÑÑ€ өөрчлөгдÑөн байна. res_replaced_%_% = % документ нь % ÑолигдÑон. reserved_mem = ҮлдÑÑн Ñанах ой reset = ШинÑÑÑ€ тохируулах resources = Ðөөцүүд restore = СÑргÑÑÑ… result = Үр дүн results_% = % Үр дүнгүүд reopen = Reopen reopen_file_% = Reopen % and discard changes? rt_execution = Тухайн агшинд хөрвүүлÑлт (Real-Time) rt_filtering = Тухайн агшинд шүүлт хийх (Real-Time) rt_focus = Тухайн агшинд төвлөрүүрÑлт хийх (Real-Time) save = Хадгалах save_as = Файлын хадгалах байршил Ñонгох search = Хайх select_all = Бүгдийг Ñонгох separator = ТуÑгаарлагч sessions_% = % Ñуулт (session) sessions_killed_% = % Ñуулт (session) уÑтгагдÑан. show_atts = Ðтрибутуудыг харах show_name_atts = @name тагаар атрибутуудыг Ñолих similar_cmd_% = '%'? ийм байх боломжтой simple_file_chooser = Энгийн файл Ñонголтыг ашиглах single_cmd = Single command expected. size = Ð¥ÑмжÑÑ skip_corrupt_files = Ðлдаатай (буруу бичигдÑÑн) файлуудыг алгаÑах skipped = ÐлгаÑÑан split_input_lines = МөрүүдÑд хуваах srv_running = Серверийн ажиллагаа ÑÑвÑл Ñрх олголт амжилтгүй. srv_started_port_% = Сервер ажиллаж байна (Порт: %) srv_stopped_port_% = Сервер зогÑÑон (Порт: %) standard = Стандарт start = ЭхлүүлÑÑ… status_bar = Ð¡Ñ‚Ð°Ñ‚ÑƒÑ Ð±Ð°Ñ€ stemming = ЗогÑоолт stop = ЗогÑоох stopped_at = дÑÑÑ€ зогÑÑон stopword_list = Үгийн зогÑолт бүрийн тухайн жагÑаалт strings_found_% = % string(s) found. strings_replaced = Strings were replaced. strip_ns = Strip namespaces syntax = ӨгүүлбÑрийн бүтÑц table = Ð¥Ò¯ÑнÑгт target_path = Байршил тодорхойлох team = Баг text = ТекÑÑ‚ text_index = ТекÑÑ‚ Ð¸Ð½Ð´ÐµÐºÑ text_length = ТекÑтийн Ñ…ÑмжÑÑ time_needed = Хугацаа шаардагдÑан timeout_exceeded = Ðжиллуулахад их хугацаа шаардагдаж байна. timestamp = Цаг тооцогч timing = Хугацаа тооцоолж байна total_mem = Ерөнхий Ñанах ой total_time = Ерөнхий хугацаа translation = Ð¥Ñлний орчуулга tree = Мод tree_options = Модны тохиргоонууд try_% = % оролдоод үзÑÑ…. try_more_% = % илүү их мÑдÑÑлÑл авахыг оролдох. try_specific_% = % коммандаар мÑдÑÑлÑл авахыг оролдох. type = Төрөл undo = ҮйлдÑл буцаах unknown_cmd_% = '%' тодорхойгүй комманд. unknown_host_x = Тодорхойлогдоогүй '%' хоÑÑ‚ байна. unknown_option_% = '%' тодорхойгүй тохиргоо. unknown_parser_% = Unknown parser '%'. unknown_user_% = Ð¥ÑÑ€ÑглÑгч '%' тодорхойгүй. unwatching_event_% = Үйл ажиллагаа(event) '%' Ñ…Ñнагдаагүй. up_to_date = СаÑхан шинÑчлÑгдÑÑн, ÑˆÐ¸Ð½Ñ updated = ШинÑчлÑгдÑÑн use_catalog_file = XML каталог файл ашиглах used_mem = Ð¥ÑÑ€ÑглÑÑÑн Ñанах ой user_created_% = Ð¥ÑÑ€ÑглÑгч '%' Ò¯Ò¯ÑÑÑн. user_dropped_% = Ð¥ÑÑ€ÑглÑгч '%' уÑтгагдÑан. user_dropped_%_% = Ð¥ÑÑ€ÑглÑгч '%' нь '%'-Ð°Ð°Ñ ÑƒÑтгагдÑан. user_exists_% = Ð¥ÑÑ€ÑглÑгч '%' өмнө Ò¯Ò¯ÑÑÑн байна. user_logged_in_% = Ð¥ÑÑ€ÑглÑгч '%' аль Ñ…ÑÐ´Ð¸Ð¹Ð½Ñ Ð½ÑвтÑÑ€ÑÑн байна. username = Ð¥ÑÑ€ÑглÑгчийн нÑÑ€ users = Ð¥ÑÑ€ÑглÑгчид users_% = % Ð¥ÑÑ€ÑглÑгчийн/д value = Ð¥ÑмжÑÑ version = Хувилбар view = Харагдах байдал watching_event_% = Үйл ажиллагаа(event) '%' Ñ…Ñнах. whole_word = Whole Word write_locking = Write Locking ws_chopping = Сул зайг хаÑах xquery = XQuery yes = Тийм # Help texts /ТуÑламжийн текÑтүүд/ h_about = ТөÑлийн ерөнхий мÑдÑÑллийг харуулах. h_attr_index = Уг Ð¸Ð½Ð´ÐµÐºÑ Ð½ÑŒ атрибутын харьцуулалтыг баталгаатай хурдан ажиллагаатай болгоно. h_browser_error_% = Ð’Ñб хөтөч нÑÑгдÑхгүй байна.\nГар аргаар нÑÑÐ½Ñ Ò¯Ò¯ URL:\n\n% h_buttons = Товчлуур барыг нÑÑÑ… ÑÑвÑл хаах. h_case = ИндекÑд томоор бичигдÑÑн байхаар авч үлдÑÑ…. h_chop_ws = Уг тохиргоо нь тагууд дах илүү зайнууд болон контентуудыг хаÑалт хийнÑ. h_close = ÐÑÑлттÑй байгаа өгөгдлийн Ñанг хаах. h_close_file = ÐÑÑлттÑй байгаа файлыг хаах. h_colors = Программын өнгөний өөрчлөлтийг зөвшөөрөх. h_community = Цахим Ñ…ÑƒÑƒÐ´Ð°Ñ Ð´ÑÑрх олон нийтийн харилцаа. h_copy = ÐÑÑллттÑй байгаа XML зангилаануудыг хуулах. h_copy_path = ÐÑÑллтÑй байгаа XML зангилаануудын замыг хуулах. h_db_format = Өгөгдлийн Ñангийн формат өөрчлөгдÑөн байна; шинÑÑÑ€ Ò¯Ò¯ÑгÑÐ½Ñ Ò¯Ò¯. h_delete = XML зангилаануудыг уÑтгах. h_diacritics = Ð˜Ð½Ð´ÐµÐºÑ Ð´ÑÑ… Ñанах Ñ‚Ñмдгийг авч үлдÑÑ…. h_edit = XML зангилаануудыг заÑварлах. h_editor = Квери заÑварлагчийг харуулах. h_execute_query = Квериг хөрвүүлÑÑ…. h_exit = ÐŸÑ€Ð¾Ð³Ñ€Ð°Ð¼Ð°Ð°Ñ Ð³Ð°Ñ€Ð°Ñ…. h_explorer = Багажит Ñамбар нÑÑÑ…. h_export = Exports the current database. h_filter_selected = СонгогдÑон зангилаануудыг шүүх. h_folder = Ð¥Ð°Ð²Ñ‚Ð°Ñ Ð±Ð°Ð³Ð°Ð¶Ð¸Ñ‚ Ñамбарыг үзүүлÑÑ…. h_fonts = Ò®Ñгийн фонтны өөрчлөлтүүдийг зөвшөөрөх. h_fullscreen = БүтÑн дÑлгÑцÑÑÑ€ харах. h_fulltext_index = БүтÑн текÑÑ‚ Ð¸Ð½Ð´ÐµÐºÑ Ð½ÑŒ бүрÑн текÑÑ‚ квериг хурдан ажиллагаатай болгоно. h_go_home = Эх зангилаа руу буцах. h_go_to_line = Jumps to a specified line. h_go_up = ÐÑг үеÑÑ€ дÑÑшлүүлÑÑ…. h_help = Цахим Ñ…ÑƒÑƒÐ´Ð°Ñ Ð´ÑÑрх бичиг баримтжуулалт. h_html_parser = The TagSoup parser will be used to convert HTML to XML. h_index_format = Ð˜Ð½Ð´ÐµÐºÑ Ñ„Ð¾Ñ€Ð¼Ð°Ñ‚ өөрчлөгдÑөн байна; шинÑÑÑ€ Ò¯Ò¯ÑгÑÐ½Ñ Ò¯Ò¯. h_input_bar = Коммандын оролтын Ñ…ÑÑгийг нÑÑÑ… ÑÑвÑл хаах. h_int_parser = Fault tolerant, and faster than Java’s default parser. h_languauge = Ð¥Ñлний текÑÑ‚ Parser тодорхойлогдох болно. h_large_db = Өгөгдлийн Ñангийн Ñ…ÑмжÑÑ Ð¸Ñ… байна. Үйл ажиллагааг хурдаÑгахад шаардагдах\nзахиалгуудын үйл ажиллагаа хаахыг Ñ…Ò¯Ñч байна уу? h_map = Газрын зураг байдлаар харах. h_map_layout = Газрын зургын байршлыг өөрчлөх h_new = ШинÑÑÑ€ өгөгдлийн Ñанг Ò¯Ò¯ÑгÑÑ…. h_new_file = ШинÑÑÑ€ файл Ò¯Ò¯ÑгÑÑ…. h_new_node = ШинÑÑÑ€ XML зангилааг Ò¯Ò¯ÑгÑÑ…. h_new_version = Ð¨Ð¸Ð½Ñ Ñ…ÑƒÐ²Ð¸Ð»Ð±Ð°Ñ€ олдÑон байна (% %)!\nШинÑчлÑлт хийхийг Ñ…Ò¯Ñч байна уу? h_no_html_parser = No HTML parser is available; input will be treated as ordinary XML. h_open_file = Квери ÑÑвÑл текÑÑ‚ файлыг нÑÑÑ…. h_open_manage = Өгөгдлийн Ñангуудыг удирдах. h_out_of_mem = Дараах зөвлөмжүүд нь туÑалж магадгүй.:\n- Жава Ñ…ÑмжÑÑг шинж байдлаар нь ихÑÑгÑÑ… -Xmx\n- Ð¥ÑÑ€ÑглÑгчийн Ð¸Ð½Ñ‚ÐµÑ€Ñ„ÐµÐ¹Ñ ÑÑвÑл 'дотоод Parse хийх замаар'\n текÑтүүд болон атрибут индекÑүүд идÑвхгүй болгоход байрших дотоод XML Parser-ийг Ñонгох. h_packages = Allows to list, install, and delete XQuery packages. h_paste = Өмнөх зангилаануудыг хуулж тавих. h_path_index = ХаÑгын байршлын үр дүнг илүү хурдан ажиллагаатай болгоно. h_plot = СхемчилÑÑн байдлаар харах. h_preferences = Програмын ерөнхий тохиргоог харуулах. h_properties = ÐÑÑллтÑй байгаа өгөгдлийн Ñангийн мÑдÑÑллийг харуулах. h_query_info = Квери багажит Ñамбарыг үзүүлÑÑ…. h_recently_open = СаÑхан нÑÑгдÑÑн файлууд. h_replace = Searches and replaces text. h_reopen_file = Reopens the current file. h_result = ТекÑÑ‚ үзүүлÑгчийг харуулах. h_rt_execution = Ð¥ÑрвÑÑ ÑƒÐ³ тохиргоо нÑÑлттÑй байгаа тохиолдолд, кверинүүд товч дарагдÑаны дараагаар автоматаар хөрвүүлÑгдÑÑ… болно. h_rt_filtering = Ð¥ÑрвÑÑ ÑƒÐ³ тохиргоо нÑÑлттÑй байгаа тохиолдолд, кверинүүд товч дарагдÑаны дараагаар автоматаар шүүлт хийх болно. h_save = Файлыг хадгалах. h_save_result = Үр дүнг хадгалах. h_show_history = Оролтын утгын түүхийг харуулах. h_status_bar = Ð¡Ñ‚Ð°Ñ‚ÑƒÑ Ð±Ð°Ñ€Ñ‹Ð³ нÑÑÑ… ÑÑвÑл хаах. h_stemming = ИндекÑд тодорхойлогдохооÑоо өмнө бий болгоно. h_stop_process = Тухайн процеÑÑийг зогÑоох. h_stopwords = Байнгын үйл ажиллагааг алгаÑаж үгийн жагÑаалтыг Ñонгох. h_table = Ð¥Ò¯ÑнÑгт багажит Ñамбарыг Ò¯Ò¯ÑгÑÑ…. h_text_index = Уг Ð¸Ð½Ð´ÐµÐºÑ Ð½ÑŒ текÑÑ‚ харьцуулалтыг баталгаатай хурдан ажиллагаатай болгоно. h_tree = Мод бүтцÑÑÑ€ харах. h_tree_options = Мод бүтцÑÑÑ€ харагдах тохиргоонууд h_updates = Цахим Ñ…ÑƒÑƒÐ´Ð°Ñ Ð´ÑÑрх шинÑчлÑлтүүд. h_used_mem = Ð¥ÑрвÑÑ Ñанах ой багаÑвал, \nBaseX-г Java шинж Ñ‚ÑмдÑг -Xmx туÑламжтай ажиллуулна уу. # Commands c_add1 = Өгөгдлийн Ñанд документ Ò¯Ò¯ÑгÑÑ…. c_add2 = [%]-нд [%]-аар өгөгдлийн Ñанд нÑмÑÑ…. c_alter1 = Өгөгдлийн Ñангийн нÑÑ€ ÑÑвÑл нууц үгийг өөрчлөх. c_alter2 = Өгөгдлийн Ñангийн нÑÑ€ ÑÑвÑл нууц үгийг өөрчлөх: c_alterdb = Ð¥ÑÑ€ÑглÑгчийн нÑÑ€ өөрчлөх. c_alterpw = Ð¥ÑÑ€ÑглÑгчийн нууц үгийг өөрчлөх. c_check1 = Өгөгдлийн Ñанг нÑÑÑ… ÑÑвÑл шинÑÑÑ€ Ò¯Ò¯ÑгÑÑ…. c_check2 = Өмнө Ò¯Ò¯ÑÑÑн өгөгдлийн Ñанг нÑÑÑ… ÑÑвÑл шинÑÑÑ€ тогтмолоор Ò¯Ò¯ÑгÑÑ…. c_close1 = Өгөгдлийн Ñанг хаах. c_close2 = ÐÑÑлттÑй байгаа өгөгдлйин Ñанг хаах. c_copy1 = Өгөгдлийн Ñанг хуулах. c_copy2 = Өгөгдлийн Ñангийн хуулбарууд. c_create1 = Өгөгдлийн Ñан, Ñ…ÑÑ€ÑглÑгч ÑÑвÑл зангилаанууд Ò¯Ò¯ÑгÑÑ…. c_create2 = Өгөгдлийн Ñан, Ñ…ÑÑ€ÑглÑгч, зангилаа ÑÑвÑл event Ò¯Ò¯ÑгÑÑ…: c_create3 = [%] Өгөгдлийн Ñанг [%] тохиргоогоор Ò¯Ò¯ÑгÑÑ… c_create4 = [%] Ðөөцлөх өгөгдлийн Ñанг Ò¯Ò¯ÑгÑÑ… c_create5 = ТодорхойлогдÑон Ð¸Ð½Ð´ÐµÐºÑ Ò¯Ò¯ÑгÑÑ… c_create8 = ТодорхойлогдÑон Ñ…ÑÑ€ÑглÑгч Ò¯Ò¯ÑгÑÑ… c_create9 = үйл ажиллагаа (event) Ò¯Ò¯ÑгÑÑ… c_cs1 = XQuery-г ажиллуулах болон үр дүнг текÑÑ‚ÑÑÑ€ харуулах. c_cs2 = Квериг ажиллуулах болон үр дүнг текÑÑ‚ÑÑÑ€ харуулах. c_delete1 = Өгөгдлийн ÑÐ°Ð½Ð³Ð°Ð°Ñ Ð´Ð¾ÐºÑƒÐ¼ÐµÐ½Ñ‚ уÑтгах. c_delete2 = ÐÑÑллтÑй байгаа өгөгдлийн ÑÐ°Ð½Ð³Ð°Ð°Ñ Ð´Ð¾ÐºÑƒÐ¼ÐµÐ½Ñ‚ уÑтгах. c_drop1 = Өгөгдлийн Ñан, Ñ…ÑÑ€ÑглÑгч ÑÑвÑл Ð¸Ð½Ð´ÐµÐºÑ ÑƒÑтгах. c_drop2 = Өгөгдлийн Ñан, Ñ…ÑÑ€ÑглÑгч ÑÑвÑл Ð¸Ð½Ð´ÐµÐºÑ ÑƒÑтгах: c_drop21 = Өгөгдлийн Ñанг уÑтгах c_drop22 = ТодорхойлогдÑон индекÑийг уÑтгах c_drop23 = ТодорхойлогдÑон Ñ…ÑÑ€ÑглÑгчийг уÑтгах (өгөгдлийн Ñан дах). c_drop24 = Өгөгдлийн Ñангийн нөөцлөлтийг уÑтгах c_drop25 = Үйл ажиллагаануудыг уÑтгах c_execute1 = Execute command script. c_execute2 = Executes the specified [%] as command script. c_exit1 = Програмыг хаах. c_exit2 = % гаргах. c_export1 = Өгөгдлийн Ñанг XML-Ñ€ ÑкÑпортлох. c_export2 = Өгөгдлийн Ñан [%] XML-Ñ€ ÑкÑпортлох. c_find1 = Квери түлхүүр үгийг ажиллуулах. c_find2 = Квери түлхүүр үгийг ажиллуулах. Зарим өөрчлөлтүүд нь :\n = : зангилаатай таарч байхаар шалгах"\n @= : аттрибуттай таарч байхаар шалгах\n @ : аттрибутыг шалгах c_flush1 = Өгөгдлийн Ñанг хорих. c_flush2 = ДиÑк Ñ€Ò¯Ò¯ өгөгдлийн Ñанг буферлÑхийг хорих. c_get1 = Глобал тохиргоог харуулах. c_get2 = Глобал тохиргооны Ñ…ÑмжÑÑг харуулах. c_grant1 = Ð¥ÑÑ€ÑглÑгчийн Ñрхийг баталгаажуулах. c_grant2 = Өгөгдлийн Ñанд Ñ…ÑÑ€ÑглÑгчийн Ñрхийг баталгаажуулах. c_help1 = ТуÑламж % коммандаар авна. c_help2 = Ð¥ÑÑ€Ñв [%] тодорхойлогдÑон бол мÑдÑÑлÑл тодорхойлогдÑон\nкомманд Ñ…ÑвлÑгдÑнÑ; Ó©Ó©Ñ€Ó©Ó©Ñ€ комманд бүртгÑгдÑÑн. c_info1 = ÐÑÑлттÑй байгаа өгөгдлийн Ñангийн мÑдÑÑллийг харуулах. c_info21 = ÐÑÑлттÑй байгаа өгөгдлийн Ñангийн мÑдÑÑллийг харуулах: c_info22 = аргументгүй: глобал мÑдÑÑллийг харуулах c_info23 = Өгөгдлийн Ñангийн мÑдÑÑллийг харуулах c_info24 = Ð˜Ð½Ð´ÐµÐºÑ Ð¼ÑдÑÑллийг харуулах c_info25 = Дотоод өгөгдлийн Ñангийн Ñ…Ò¯ÑнÑгтийг харуулах c_inspect1 = Perform integrity checks. c_inspect2 = Checks the database for errors. c_kill1 = Ð¥ÑÑ€ÑглÑгчийн Ñуулт(session)-г зогÑоох. c_kill2 = Ð¥ÑÑ€ÑглÑгчийн бүх Ñуулт(session)-г зогÑоох. c_list1 = Өгөгдлийн Ñан дах документуудыг жагÑаалтаар харуулах. c_list2 = Бүх өгөгдлийн Ñан ÑÑвÑл документуудыг\n[%]-аар жагÑаалтаар харуулах. c_open1 = Өгөгдлийн Ñанг нÑÑÑ…. c_open2 = Opens the database [%], filtered by [%]. c_optimize1 = Өгөгдлийн Ñанг шинÑчлÑÑ…. c_optimize2 = ÐÑÑлттÑй байгаа өгөгдлийн Ñанг шинÑчлÑÑ….\nÑ…ÑрвÑÑ Ñ‚Ð¾Ð´Ð¾Ñ€Ñ…Ð¾Ð¹Ð»Ð¾Ð³Ð´Ñон бол өгөгдлийн Ñангийн Ñ…ÑмжÑÑ Ð±Ð°Ð³Ð°Ñах болно. c_password1 = Ðууц үгийг өөрчлөх. c_password2 = Ð¥ÑÑ€ÑглÑгчийн нууц үг өөрчлөх. c_rename1 = Өгөгдлийн Ñан дах документийн байршлыг өөрчлөх. c_rename2 = ÐÑÑлттÑй байгаа өгөгдлийн Ñан дах документийн байршлыг өөрчлөх. c_replace1 = Өгөгдлийн Ñангийн документийг шинÑÑÑ€ Ñолих. c_replace2 = ÐÑÑлттÑй байгаа өгөгдлийн Ñангийн документийг шинÑÑÑ€ Ñолих. c_repo1 = УÑтгал болон багцын жагÑаалтуудыг Ñуулгах. c_repo2 = ХаÑгын өөрчлөлтийн дагуу багцын жагÑаалтууд болон уÑтгал Ñуулгах c_repo3 = [%] багцын нÑÑ€ÑÑÑ€ ÑÑвÑл [%] хаÑгаар уÑтгах c_repo4 = [%] багцыг хаÑгаар Ñуулгах c_repo5 = Бүх багцыг жагÑаах c_restore1 = Өгөгдлийн Ñанг дахин шинÑÑÑ€ ÑÑргÑÑÑ…. c_restore2 = Өгөгдлийн Ñанг дахин шинÑÑÑ€ ÑÑргÑÑÑ…. Ðргумент нь \nагуулагдах нөөцлөлтийн файл c_retrieve1 = БоловÑруулалт хийгдÑÑгүй мÑдÑÑллийг буцаах. c_retrieve2 = [%] боловÑруулалт хийгдÑÑгүй мÑдÑÑллийг буцаах. c_run1 = Run query or command script. c_run2 = Runs the contents of [%] as query or command script. c_set1 = Глобал тохиргоог тохируулах. c_set2 = Өгөгдлийн Ñангийн тохиргоог шинÑÑÑ€ тохируулах. c_show1 = Сервер мÑдÑÑллийг харуулах. c_show21 = Сервер мÑдÑÑллийг харуулах: c_show23 = ÐÑÑлттÑй байгаа өгөгдлийн Ñангийн Ñуулт(session)-г харуулах. c_show24 = Ð¥ÑÑ€ÑглÑгчдийг харуулах (өгөгдлийн Ñан дÑÑÑ€). c_show25 = Ðөөцлөлтийг харуулах. c_show26 = Үйл ажиллагааг харуулах. c_store1 = БоловÑруулалт хийгдÑÑгүй мÑдÑÑллийг хадгалах. c_store2 = [%]-нд боловÑруулалт хийгдÑÑгүй мÑдÑÑллийг хадгалах. c_xquery1 = XQuery-г ажиллуулах. c_xquery2 = ТодорхойлогдÑон квери болон Ñ…ÑвлÑлтийг үр дүнгÑÑÑ€ харуулах. # Серверийн үйл ажиллагаатай холбоотой текÑтүүд; аутÑорÑинг хийгдÑÑн байна s_adlogin = Ðдмины нÑвтрÑÑ… Ñ…ÑÑÑг (дотоод, удирдлагын түвшин) s_connect = Холболт s_connected = %:% холбогдÑон байна. s_createu = Ð¥ÑÑ€ÑглÑгч Ò¯Ò¯ÑгÑÑ… s_dbrevoke = ÐÑвтÑÑ€ÑÑн Ñ…ÑÑ€ÑглÑгчийн Ñрхийг цуцлах. s_disconnected = Холболт таÑарÑан. s_drquestion = % Ð¥ÑÑ€ÑглÑгч нь уÑÑ‚Ñан. s_globperm = Гадаад Ñ…ÑÑ€ÑглÑгчийн Ñрх s_host = ХоÑÑ‚ s_info1 = Клиент/Сервер холболт, удирдлага. s_info2 = Ð¥ÑÑ€ÑглÑгч Ò¯Ò¯ÑгÑÑ…, баталгаажуулалт. s_locallogs = Дотоод лог файл s_localport = Дотоод порт s_localserver = Дотоод Ñервер s_locperm = Дотоод Ñ…ÑÑ€ÑглÑгчийн Ñрх s_port = Порт s_sessions = Суулт (session) s_alter = Өөрчлөх s_h_server_admin = Ð¥ÑÑ€ÑглÑгчийн удирдлага болон лог(log) бүртгÑлийн Ñервер зааварчлагаа. s_server_admin = Сервер удирдлага basex-7.7.2/basex-core/src/main/resources/lang/Romanian.lang000066400000000000000000000702501222453003200237330ustar00rootroot00000000000000# LANGUAGE FILE, TRANSLATED BY # Adrian Berila OFF = Oprit ON = Pornit about_% = Despre % access_denied = Acces refuzat. add = Adăugare add_raw_files = AdăugaÅ£i fiÅŸiere rămase ca fiÅŸiere RAW add_resources = AdăugaÅ£i resurse adjust_nodes = ReglaÅ£i noduri la text admin_static_% = Utilizatorul admin nu poate fi modificat. algorithm = Algoritm all = Toti alter_pw = Modifică parola and_others = Si altele are_you_sure = SînteÈ›i sigur? attribute = Atribut attribute_index = Atribut Index attributes = Atribute backup = Copie de rezervă backup_dropped_% = FiÅŸierele de rezervă '%' au fost sterse. backup_not_found_% = FiÅŸierele de rezervă '%' nu au fost gasite. backups = Copii de siguranţă backups_% = % copii de siguranţă binaries = Binare blue = Albastru bold = ÃŽngroÈ™at browse = Răsfoire buttons = Butoane bye1 = Sa ai o zi frumoasă. bye2 = Pe curand! bye3 = Pa-pa! bye4 = La revedere! cancel = Anulare case_sensitivity = Sensibil la majuscule check_for_updates = Caută actualizări... chief_architect = Arhitect ÅŸef children_text_len = Text lungime copii choose_dir = Alege director choose_font = Alege font chop_ws = Taie spaÅ£iile goale chopped = Tocate clear = Șterge close = ÃŽnchidere close_file_% = SalvaÅ£i modificările la %? color_schema = Schemă de culori colors = Culori command = Comandă command_canceled = Comanda a fost anulata. comment = ObservaÈ›ie community = Comunitate compiling = Compilator connect = Conectare connection_error = Nu se poate comunica cu serverul. copy = Copiaza copy_db = Copiaza baza de date copy_path = Calea de copiere create = Creează create_database = Creare baza de date create_stats = Crea statistici creating_db = Creare baze de date creating_indexes = Crearea Indexuri cut = Cut database = Baza de date database_path = Calea bazei de date (bazele de date existente, nu vor fi mutate) databases = Bază de date databases_% = baza/ă de date db_backup_% = Copie de rezerva pentru '%' a fost creata în %. db_closed_% = Baza de date '%' a fost închisa. db_copied_% = Copie la '%' a fost creata în %. db_corrupt = Starea bazei de date este inconsistenta. db_created_%_% = Baza de date '%', a fost creata în %. db_dropped_% = Baza de date '%' a fost stearsa. db_exists_% = Bază de date '%' există deja. db_exported_% = Baza de date '%' a fost exportata în %. db_flushed_% = Baza de date '%' a fost scoasa în %. db_not_backup_% = Copie de rezerva la baza de date '%' nu a putut fi creata. db_not_copied_% = Copie la '%' nu a putut fi creata. db_not_dropped_% = Baza de date '%' nu a putut fi stearsa db_not_found_% = Baza de date '%' nu a putut fi găsita. db_not_renamed_% = Baza de date '%' nu a putut fi redenumita. db_not_restored_% = '%' nu a putut fi restaurata. db_opened_% = Baza de date '%' a fost deschisa în %. db_optimized_% = Baza de date '%' a fost optimizata în %. db_pinned_% = Baza de date '%' este în prezent deschisa de un alt procesul. db_props = Proprietăţile bazei de date db_renamed_% = Baza de date '%' a fost redenumita '%'. db_restored_% = '%' a fost restaurată în %. db_updated_% = Baza de date '%' este în curs de actualizare, sau actualizarea nu a fost finalizata. delete = Åžtergere delete_all = Șterge tot delete_nodes = DoriÅ£i într-adevăr să ÅŸtergeÅ£i notiÅ£a? delete_packages_% = Pachetul % va fi ÅŸters. diacritics = Semn diacritic dir_not_empty = Directorul nu este gol. disconnect = Deconectare document = Document documents = Documente drop = Elimina drop_backups_% = % copii de rezervă vor fi sterse. dropping_db_% = % baze de date vor fi sterse edit = Editeaza edit_% = Editeaza % edit_data = Editeaza date editor = Editor element = Element elements = Elemente empty_db = O bază de date goala va fi creata. encoding = Codare enter_db_name = Vă rugăm să introduceÅ£i un nume de bază de date. entries_% = % intrări error = Eroare evaluating = Evaluarea event_created_% = Evenimentul '%' a fost creat. event_dropped_% = Evenimentul '%' a fost sters. event_exists_% = Evenimentul '%' deja există. event_not_watched_% = Evenimentul '%' nu a fost vizualizat. event_unknown_% = Evenimentul '%' este necunoscut. event_watched_% = Deja in curs de vizualizare a evnimentului '%'. events_% = % evenimente exec_error_% = Nu s-a putut executa % exit = IeÅŸire expecting_cmd = Astept comanda. explorer = Explorer export = Exporta file = FiÈ™ier file_exists_% = % deja există. \n DoriÅ£i să-l înlocuiasc? file_not_deleted_% = FiÅŸierul '%' nu a putut fi ÅŸters. file_not_opened = FiÅŸierul nu a putut fi deschis. file_not_saved = FiÅŸierul nu a putut fi salvat. file_not_stored_% = Fisierul '%' nu a putut fi stocat. file_or_dir = Fisierul sau director de intrare file_patterns = Modele de fiÅŸiere (separate prin virgule) files_replace_% = FiÅŸierele vor fi înlocuite în %, n\ DoriÅ£i să continuaÅ£i? filter = Filtrare filter_selected = Filtrare selectata finishing = In curs de terminare... first_line_header = Parsare a primei linii ca antent al tabelului. folder = Director fonts = Fonturi fullscreen = Pe tot ecranul fulltext = Full-text fulltext_index = Full-text Index general = General general_info = Informatii generale global_option_% = Global option '%' cannot be set. go_back = Mergi inapoi go_forward = Mergi inainte go_home = Home go_to_line = Go to line go_up = Mai sus granted_%_% = % acordat lui '%'. granted_%_%_% = % acordat lui '%' pe '%'. green = Verde gui_interactions = InteracÅ£iuni GUI help = Ajutor help1_use_catalog = Pentru a permite rezolvarea catalogului asiguraÅ£i-vă că help2_use_catalog = Apache XML Commons Resolver este in classpathul dumneavoastră. hit_s = Afisari index_attributes = Valori Indexing Attribute index_created_%_% = Index '%' creat în %. index_dropped_%_% = Index '%' sters în %. index_fulltext = Indexare full-text index_not_dropped_% = Indexul '%' nu a putut fi sters. index_text = Indexare text indexes = Indecsi information = InformaÈ›ii input_bar = Bara de inserare input_format = Formatare intrari input_path = Calea de intrare input_size = Marime intrari insert_new_data = Inserare de noi date install = Instalare int_parser = Utilizare parser XML intern interrupted = Intrerupt. invalid_% = % este invalid. invalid_value_%_% = Nu s-a putut seta '%' la '%'. italics = Italice java_lf = Foloseste Java Look & Feel kill_self_% = '%' nu poate sa se omoare. language = Limbă license = Licenţă BSD line = Linie line_% = Linia % line_number = Line number main_options = OpÅ£iuni principale manage_db = Administrare baze de date map = Hartă map_choice1 = Fara titlu, fara frontieră map_choice2 = Fara titlu, frontiera mică map_choice3 = Titlu, fara frontieră map_choice4 = Titlu, frontieră mică map_choice5 = Titlu, frontieră mare map_layout = Aspect hartă match_case = Match Case max_nr_of_hits = Numărul maxim de afisari method = Metodă more_skipped_% = Mai mult de % fiÅŸiere omise multi_line = Multi-line mode name = Denumire name_invalid_% = '%', Numele este invalid. name_of_db = Numele bazei de date name_of_db_copy = Numele bazei de date copiata names = Nume namespaces = SpaÅ£ii de nume new = Nou new_db_question = Nu doriÅ£i să creaÅ£i una noua? no = Nu no_data = Nu există date disponibile. no_db_dropped = Nici o baza de date nu a fost stearsa no_db_found = Nici o baza de date nu a fost gasita no_db_opened = Nici o baza de date deschisa. no_dir_allowed_% = "%" puncte pana la director. no_help = Ne pare rău, nici un ajutor disponibil. no_mainmem = Comandă nu este disponibilă în modul de memorie principală. no_pixels = Nu este suficient spaÅ£iu. no_stemmer_% = Nu este disponibil stemmer pentru limba '%'. no_tokenizer_% = Nu este disponibil tokenizer pentru limba '%'. nodes = Noduri nodes_parsed_% = % noduri parsate not_available = Nu este disponibil not_parsed_% = "%" Nu au putut fi analizate. number_children = Numărul de copii offsets = Offsets ok = OK only_backup = Disponibil numai ca o copie de rezervă. open = Deschide open_manage = Deschide & administreaza optimize = OptimizaÅ£i optimized_query = Interogare options = OpÅ£iuni out_of_date = Data insuficiente. out_of_mem = Memorie insuficientă. output_dir = Directorul de ieÅŸire overwrite_db = Baze de date existenta va fi suprascrisa. packages = Pachete packages_% = % Pachete parameters = Parametri parse_archives = Parsare fisiere in arhiva parse_as_jsonml = Parsare intrari ca JsonML parse_dtds = Parsare DTD-uri si entitati parser_% = % Parser parsing = Parsare password = Parolă paste = LipeÈ™te path = Cale path_added_%_% = Calea "%" a fost adăugata în %. path_index = Rezumatul caii. perm_required_% = % permisiuni necesare. perm_unknown_% = Permisiunea % este necunoscuta. pi = PI pkg_deleted_% = Pachetul '%' eliminat. pkg_installed_%_% = Pachetul '%' instalat în %. pkg_replaced_%_% = Pachetul '%' înlocuit în %. please_wait = Vă rog să aÈ™teptaÈ›i plot = Plot port_twice_% = Portul '%' a fost specificat de două ori. preferences = PreferinÈ›e printed = Tipărit printing = In curs de tipărire properties = Proprietăți pw_changed_% = Parola utilizatorului '%' a fost schimbata. pw_not_valid = Parola nu este validă cu hash MD5. query = Interogare query_executed_%_% = Interogare % executata in %. query_info = Informatii interogari query_plan = Planul de interogare ratio = Raport read_locking = Read Locking red = RoÈ™u redo = Refacere refresh = Reîmprospătare regular_expr = Regular Expression rename = Redenumire rename_db = Redenumire baza de date replace_all = Replace all replace_with = Replace with requires_restart = Necesită o repornire res_deleted_%_% = % resurse sterse in % res_not_found = Resursa nu a fost găsita. res_not_found_% = Resursă "%" nu a fost găsita. res_props = Proprietăţi resurse res_renamed_%_% = % resurse redenumite in % res_replaced_%_% = % resurse inlocuite in % reserved_mem = Memorie rezervata reset = Resetează resources = Resurse restore = Restabilire result = Rezultat results_% = Rezultate % reopen = Reopen reopen_file_% = Reopen % and discard changes? rt_execution = ÃŽn timp real de executie rt_filtering = Filtrarea in timp real rt_focus = Mouse focus in timp real save = Salvare save_as = Salvează ca search = Căutare select_all = Selectare totală separator = Separator sessions_% = % sesiuni sessions_killed_% = % sesiuni ucise. show_atts = AfiÅŸează atributele show_name_atts = ÃŽnlocuiÅ£i etichete cu atributele @nume similar_cmd_% = Ai vrut sa spui '%'? simple_file_chooser = UtilizaÅ£i selectorul simplu de fisiere single_cmd = Single command expected. size = Dimensiune skip_corrupt_files = Treci peste fisierele corupte (nu foarte bine formatate) skipped = Trecute peste split_input_lines = Desparte intrarea în linii srv_running = Serverul este pornit sau permisiunea a fost refuzata. srv_started_port_% = Serverul este pornit (portul: %) srv_stopped_port_% = Serverul a fost oprit (portul: %) standard = Standard start = PorneÈ™te status_bar = Bara de stare stemming = Stemming stop = Stop stopped_at = Oprit la stopword_list = Lista stopword strings_found_% = % cuvinte gasite. strings_replaced = Strings were replaced. strip_ns = Strip namespaces syntax = Sintaxă table = Tabel target_path = Cale target team = Echipă text = Text text_index = Text Index text_length = Lungime text time_needed = Timpul necesar timeout_exceeded = Timeout depăşit. timestamp = Timestamp timing = Sincronizare total_mem = Memorie totală total_time = Timp total translation = Traducere tree = Arbore tree_options = OpÅ£iuni arbori try_% = ÃŽncercaÅ£i %. try_more_% = ÃŽncercaÅ£i % pentru a obÅ£ine mai multe informaÅ£ii. try_specific_% = ÃŽncercaÅ£i % pentru a obÅ£ine informaÅ£ii despre o anumită comandă. type = Tip undo = Anulare unknown_cmd_% = Comandă necunoscută: %. unknown_host_x = Host necunoscut '%'. unknown_option_% = OpÅ£iune necunoscută '%'. unknown_parser_% = Parser necunoscut '%'. unknown_user_% = Utilizator necunoscut '%'. unwatching_event_% = Eveniment '%' nesupravegheat. up_to_date = La zi updated = Actualizat use_catalog_file = UtilizaÅ£i fiÅŸier XML Catalog used_mem = Memorie utilizată user_created_% = Utilizator '%' creat. user_dropped_% = Utilizator '%' sters. user_dropped_%_% = Utilizator '%' sters din '%'. user_exists_% = Utilizatorul '%' există deja. user_logged_in_% = Utilizatorul '%' este în prezent autentificat. username = Nume utilizator users = Utilizatori users_% = Utilizator(i) value = Valoare version = Versiune view = Vizualizare watching_event_% = Uita-te la evenimentul '%'. whole_word = Cuvantul intreg write_locking = Write Locking ws_chopping = Tocare spatii albe xquery = XQuery yes = Da # Help texts h_about = AfiÅŸează informaÅ£ii generale despre proiect. h_attr_index = Acest index mareste viteza de comparatie a predicatelor. h_browser_error_% = Nu am reuÅŸit să deschid un browser.\n Va rog sa-l deschideti manual URLul:\n\n% h_buttons = Comută bara de butoane Pornit / Oprit. h_case = Sensibilitatea la caractere este retinuta in index. h_chop_ws = Această opÅ£iune elimină spaÅ£iile goale dintre tag-uri ÅŸi conÅ£inut. h_close = ÃŽnchide baza de date curentă. h_close_file = ÃŽnchide fiÅŸierul curent deschis. h_colors = Permite schimbarea culorilor din aplicatie. h_community = AfiÅŸează pagina web a comunităţii. h_copy = Copiază nodurile selectate XML. h_copy_path = Copiază calea de la nodurile selectate XML. h_db_format = Formatul bazei de date a fost schimbat, vă rugăm să folosiÅ£i o versiune mai nouă. h_delete = Åžterge nodurile XML. h_diacritics = Diacritice sunt păstrate în index. h_edit = Editeaza nodurile XML. h_editor = AfiÅŸează editorul de texte. h_execute_query = Executa interogarea. h_exit = Iese din aplicaÅ£ie. h_explorer = AfiÅŸează panoul de explorator. h_export = Exportă baza de date curentă. h_filter_selected = Filtreaza nodurile selectate. h_folder = AfiÅŸează vizualizare dosarul. h_fonts = Permite schimbarea fonturilor utilizate. h_fullscreen = Comută la full-screen. h_fulltext_index = Un full-text index accelereaza interogările full-text. h_go_home = AfiÅŸează toate datele. h_go_to_line = Sari la o linie specificata. h_go_up = Mută ​​cu un nivel mai sus. h_help = AfiÅŸează documentaÅ£ia web. h_html_parser = Parserul TagSoup va fi folosit pentru a converti HTML în XML. h_index_format = Formatul index s-a schimbat, vă rugăm creati noi indici. h_input_bar = Comută câmpul de introducere pornit / oprit. h_int_parser = Fault tolerant, and faster than Java’s default parser. h_languauge = Parsere de text specifice limbii vor fi folosite. h_large_db = Baza de date este de mare %. Nu doriÅ£i să închideÅ£i cateva \n vizualizări în scopul de a accelera de prelucrarea? h_map = AfiÅŸează hartă. h_map_layout = Modifică aspectul hartă. h_new = Creează o bază de date nouă. h_new_file = Creează un nou fiÅŸier. h_new_node = Creează un nou nod XML. h_new_version = O nouă versiune este disponibilă (% %)! \n DoriÅ£i să actualizaÅ£i?! h_no_html_parser = Nici un parser HTML este disponibil, datele de intrare vor fi tratate ca XML obisnuit. h_open_file = Deschide un fiÈ™ier existent h_open_manage = Gestionează bazele de date existente. h_out_of_mem = PuteÅ£i încerca să: \n -măriti dimensiunea Java heap cu flagul -Xmx\n- dezactivat textul si indicii de atribute. h_packages = Permite listare, instalrea ÅŸi ÅŸtergere pachetelor XQuery. h_paste = Lipeste noduri copiate anterior. h_path_index = Un rezumat a caii accelerează rezoluÅ£iile de cale. h_plot = AfiÅŸează vizualizarea scatter-plot. h_preferences = AfiÅŸează preferinÅ£ele generale ale aplicatiei. h_properties = Ofera o perspectiva în baza de date în prezent deschisa. h_query_info = AfiÅŸează panoul de informaÅ£ii pentru interogare. h_recently_open = Oferă comenzi rapide pentru fiÅŸierele deschise recent. h_replace = Cauta si inlocuieste text. h_reopen_file = Redeschide fisierul curent. h_result = AfiÅŸează vizualizarea rezultate. h_rt_execution = Dacă această opÅ£iune este activată, interogările sunt executate dupa fiecare click. h_rt_filtering = Dacă această opÅ£iune este activată, rezultatele interogării sunt automat filtrate. h_save = Salvează fiÅŸierul. h_save_result = Salvează rezultatele. h_show_history = Prezinta istoria intrarilor. h_status_bar = Comută bara de stare pornit / oprit. h_stemming = Termenii sunt stemmed înainte de a fi indexati. h_stop_process = OpreÅŸte procesul curent. h_stopwords = Alege o listă stopword pentru a sări peste termeni frecventi. h_table = AfiÅŸează vizualizarea tabelului. h_text_index = Acest indice accelereaza comparaÅ£ia de predicate. h_tree = AfiÅŸează vizualizare TreeView. h_tree_options = OpÅ£iuni pentru TreeView. h_updates = AfiÅŸează pagina web de actualizare. h_used_mem = Dacă memoria este redusa, vă rugăm să lanseti\nBaseX cu Java flag -Xmx. # Commands c_add1 = Adaugă resurse la baza de date. c_add2 = Adaugă [%] ca [%] la baza de date. c_alter1 = Modifica numele bazei de date sau parola de utilizator. c_alter2 = Modifică numele unei baze de date sau parola de utilizator: c_alterdb = Modifică numele unei baze de date. c_alterpw = Modifica parola unui utilizator. c_check1 = DeschideÅ£i sau creaÅ£i baza de date. c_check2 = Deschide o bază de date existentă sau creează o nouă instanţă. c_close1 = ÃŽnchideÅ£i baza de date curentă. c_close2 = ÃŽnchide baza de date în prezent deschis. c_copy1 = CopiaÅ£i baza de date. c_copy2 = Copiază o bază de date. c_create1 = Creaza baze de date, index, utilizator, copie de rezervă sau eveniment. c_create2 = Creează o nouă bază de date, index, utilizator,\ncopie de rezervă sau eveniment: c_create3 = Creează baza de date [%], cu un [%] opÅ£ional c_create4 = Creează o copie de rezervă a bazei de date [%] c_create5 = Creează indicele specificat c_create8 = Creează utilizatorul specificat c_create9 = Creeaza eveniment c_cs1 = RulaÅ£i XQuery ÅŸi seteaza rezultatele ca un set de context nou. c_cs2 = Execută interogarea ÅŸi stabileÅŸte rezultatul ca set de context nou. c_delete1 = ÅžtergeÅ£i resurse din baza de date. c_delete2 = Åžterge resursele din baza de date în prezent deschise. c_drop1 = Sterge baze de date, index, utilizator, copie de rezervă sau eveniment. c_drop2 = Sterge o bază de date, index, utilizator,\ncopie de rezervă sau eveniment: c_drop21 = Sterge baza de date c_drop22 = Sterge indicele specificat c_drop23 = Sterge utilizator specificat (pe o bază de date). c_drop24 = Sterge baza de date de rezerva c_drop25 = Sterge eveniment c_execute1 = Executa command script. c_execute2 = Executa [%] specificat ca un command script. c_exit1 = IeÅŸiÅ£i din aplicaÅ£ie. c_exit2 = Iese %. c_export1 = Exporta baza de date in XML. c_export2 = Exporta de baze de date in [%]. c_find1 = ExecutaÅ£i o interogare de cuvânte cheie. c_find2 = GăseÅŸte cuvinte cheie într-o bază de date. c_flush1 = Flush database. c_flush2 = Flush toate bufferele bazelor de date pe disc. c_get1 = AfiÅŸare opÅ£iune la nivel global. c_get2 = AfiÅŸează valoarea unei optiuni globale. c_grant1 = Acorda permisiuni de utilizator. c_grant2 = Acorda permisiuni (pe o bază de date) pentru un utilizator. c_help1 = ObÅ£ineÅ£i ajutor privind comenzile %. c_help2 = ÃŽn cazul în care [%] este specificat, informaÅ£iile comenzii \nsunt imprimate, în caz contrar, toate comenzile sunt listate. c_info1 = AfiÅŸare informaÅ£ii privind baza de date curentă. c_info21 = AfiÅŸează informaÅ£ii cu privire la baza de date a deschis în prezent: c_info22 = Nici un argument: afiÅŸează informaÅ£ii la nivel global c_info23 = AfiÅŸează informaÅ£ii referitoare la baze de date c_info24 = AfiÅŸează informaÅ£ii index c_info25 = Arată tabelul de bază de date internă c_inspect1 = Verificare de integritate. c_inspect2 = Verifica baza de date pentru erori. c_kill1 = Omoară sesiunea de utilizator. c_kill2 = Omoară toate sesiunile utilizatorului specificat. c_list1 = Listeaza baze de date sau resurse bazei de date. c_list2 = Listează toate bazele de date disponibile, sau resursele \nbazei de date [%] filtrate de un opÅ£ional [%]. c_open1 = DeschideÅ£i baza de date. c_open2 = Deschide baza de date [%], filtrate de [%]. c_optimize1 = Optimizează baza de date. c_optimize2 = Optimizează baza de date a deschisa în prezent. \nDacă % este specificat, dimensiunea bazei de date este redusă la minimum. c_password1 = Modifică parola c_password2 = Schimbă parola utilizatorului. c_rename1 = Redenumeste resurse în baza de date. c_rename2 = Redenumeste resurse în baza de date curentă. c_replace1 = ÃŽnlocuiÅ£i resurse în baza de date. c_replace2 = ÃŽnlocuieÅŸte resursele în baza de date curentă. c_repo1 = Instaleaza, ÅŸterge sau listeaza pachetele. c_repo2 = Instalează, ÅŸterge sau listeaza pachete din repository c_repo3 = Sterge pachetul cu numele de [%], sau directorul [%] c_repo4 = Se instalează pachetul cu calea [%] c_repo5 = Listează toate pachetele instalate c_restore1 = Restabilire bază de date c_restore2 = RestabileÅŸte o bază de date. Argumentul poate include \ntimestampurie fisierului de rezerva. c_retrieve1 = Preluare de date brute. c_retrieve2 = Preia date brute din ceea ce s-a specificat [%]. c_run1 = Ruleaza query sau comand script c_run2 = Ruleaza continutul [%] ca un query sau command script. c_set1 = SetaÅ£i opÅ£iunile globale. c_set2 = StabileÅŸte o opÅ£iune a bazei de date la o nouă valoare. c_show1 = AfiÅŸează informaÅ£ii despre server. c_show21 = AfiÅŸează informaÅ£ii despre server: c_show23 = prezinta sesiuni de baze de date actuale. c_show24 = Afiseaza utilizatorii (unei baze de date). c_show25 = Arată backupurile. c_show26 = Arată evenimente. c_store1 = Stochează date brute. c_store2 = Stochează date brute la [%]. c_xquery1 = RulaÅ£i XQuery. c_xquery2 = Execută interogare specificat ÅŸi imprimă rezultatele. # Server texts; will be outsourced s_adlogin = Administrator Login (local sau la distanţă) s_connect = Conexiune s_connected = Conectat la%:%. s_createu = CreaÅ£i utilizator s_dbrevoke = Permisiunea va fi revocată de la utilizatorul conectat. s_disconnected = Deconectat. s_drquestion = % utilizatori vor fi stersi. s_globperm = Permisiuni globale s_host = Host s_info1 = Avertisment: arhitectura client/server si GUI nu sunt sincronizate. s_info2 = AceeaÅŸi bază de date nu ar trebui să fie deschisa de la clienÅ£i ÅŸi de GUI. s_locallogs = Loguri Locale s_localport = Portul local s_localserver = Server local s_locperm = Permisiuni Locale s_port = Port s_sessions = Sesiuni s_alter = Modifica s_server_admin = Serverul de administrare s_h_server_admin = AfiÅŸarea administrare server pentru managementul utilizatorilor ÅŸi logurile de urmărire.basex-7.7.2/basex-core/src/main/resources/lang/Russian.lang000066400000000000000000001202641222453003200236140ustar00rootroot00000000000000# LANGUAGE FILE, TRANSLATED BY # Oleksandr Shpak, Max Shamaev OFF = ÐЕТ ON = ДРabout_% = О % access_denied = ДоÑтуп запрещен add = Добавить add_raw_files = Добавить другие файлы в иÑходном виде add_resources = Добавить реÑурÑÑ‹ adjust_nodes = ПодгонÑть размер узла к ширине текÑта admin_static_% = ÐдминиÑтратор не может быть изменен algorithm = Ðлгоритм all = Ð’Ñе alter_pw = Изменить пароль and_others = и другие are_you_sure = Ð’Ñ‹ уверены? attribute = Ðтрибут attribute_index = Ð˜Ð½Ð´ÐµÐºÑ Ð¿Ð¾ атрибутам attributes = Ðтрибуты backup = Создать резервную копию backup_dropped_% = Файл резервной копии '%' был удален backup_not_found_% = Ð ÐµÐ·ÐµÑ€Ð²Ð½Ð°Ñ ÐºÐ¾Ð¿Ð¸Ñ '%' не найдена backups = Резервные копии backups_% = Резервных копий: % binaries = Бинарные файлы blue = Синий bold = Жирный browse = Обзор buttons = Кнопки bye1 = ПриÑтного времÑÐ¿Ñ€Ð¾Ð²Ð¾Ð¶Ð´ÐµÐ½Ð¸Ñ bye2 = УвидимÑÑ bye3 = РазвлекайÑÑ bye4 = ÐаÑлаждайÑÑ ÐºÐ°Ð¶Ð´Ñ‹Ð¼ моментом cancel = Отмена case_sensitivity = ЧувÑтвительноÑть к региÑтру check_for_updates = Проверить Ð¾Ð±Ð½Ð¾Ð²Ð»ÐµÐ½Ð¸Ñ chief_architect = Главный Ðрхитектор children_text_len = дочерние Ñлементы / длина текÑта choose_dir = Выберите директорию choose_font = Выбор шрифта chop_ws = Вырезать пробелы chopped = Урезано clear = ОчиÑтить close = Закрыть close_file_% = Сохранить Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ñ Ð² файле '%'? color_schema = Ð¦Ð²ÐµÑ‚Ð¾Ð²Ð°Ñ Ñхема colors = Цвета command = Команда command_canceled = Команда была отменена comment = Комментарий community = СообщеÑтво compiling = КомпилÑÑ†Ð¸Ñ connect = Соединение connection_error = Ðе удалоÑÑŒ ÑоединитьÑÑ Ñ Ñервером copy = Копировать copy_db = Копировать базу данных copy_path = Копировать пути create = Создать create_database = Создать базу данных create_stats = СобираетÑÑ ÑтатиÑтика creating_db = СоздаетÑÑ Ð±Ð°Ð·Ð° данных creating_indexes = СоздаютÑÑ Ð¸Ð½Ð´ÐµÐºÑÑ‹ cut = Вырезать database = База данных database_path = Путь к базам данных (ÑущеÑтвующие базы не изменÑÑ‚ меÑтоположение) databases = Базы данных databases_% = Баз данных: % db_backup_% = Ð ÐµÐ·ÐµÑ€Ð²Ð½Ð°Ñ ÐºÐ¾Ð¿Ð¸Ñ Ð´Ð»Ñ Ð±Ð°Ð·Ñ‹ '%' была Ñоздана за % db_closed_% = База данных '%' была закрыта db_copied_% = ÐšÐ¾Ð¿Ð¸Ñ Ð±Ð°Ð·Ñ‹ данных '%' была Ñоздана за % db_corrupt = База данных находитÑÑ Ð² неконÑиÑтетном ÑоÑтоÑнии db_created_%_% = База данных '%' Ñоздана за %. db_dropped_% = База данных '%' была уничтожена db_exists_% = База данных '%' уже ÑущеÑтвует db_exported_% = База данных '%' была ÑкÑпортирована за % db_flushed_% = Буфер базы данных '%' был Ñброшен за % db_not_backup_% = Ðе удалоÑÑŒ Ñоздать резервную копию Ð´Ð»Ñ Ð±Ð°Ð·Ñ‹ данных '%' db_not_copied_% = Ðе удалоÑÑŒ Ñоздать копию базы данных '%' db_not_dropped_% = Ðе получилоÑÑŒ удалить базу данных '%' db_not_found_% = База данных '%' не найдена db_not_renamed_% = Ðе удалоÑÑŒ переименовать базу данных '%' db_not_restored_% = Ðе удалоÑÑŒ воÑÑтановить базу данных '%' db_opened_% = База данных '%' была открыта за %. db_optimized_% = База данных '%' была оптимизирована за %. db_pinned_% = База данных '%' ÑÐµÐ¹Ñ‡Ð°Ñ Ð¾Ñ‚ÐºÑ€Ñ‹Ñ‚Ð° другим процеÑÑом db_props = СвойÑтва базы данных db_renamed_% = База данных '%' была переименована в '%' db_restored_% = '%' воÑÑтановлено за %. db_updated_% = База данных '%' в процеÑÑе Ð¾Ð±Ð½Ð¾Ð²Ð»ÐµÐ½Ð¸Ñ Ð¸Ð»Ð¸ процедура не была завершена delete = Удалить delete_all = Удалить вÑе delete_nodes = Ð’Ñ‹ дейÑтвительно хотите удалить? delete_packages_% = Пакеты в количеÑтве % будут удалены diacritics = ДиакритичеÑкий анализ dir_not_empty = Ð”Ð¸Ñ€ÐµÐºÑ‚Ð¾Ñ€Ð¸Ñ Ð´Ð¾Ð»Ð¶Ð½Ð° быть пуÑтой disconnect = Разрыв ÑÐ¾ÐµÐ´Ð¸Ð½ÐµÐ½Ð¸Ñ document = Документ documents = Документы drop = Удалить drop_backups_% = Резервные копии в количеÑтве % будут удалены dropping_db_% = Базы данных в количеÑтве % будут удалены edit = Редактировать edit_% = Редактировать % edit_data = Редактировать данные editor = Редактор element = Элемент elements = Элементы empty_db = Будет Ñоздана пуÑÑ‚Ð°Ñ Ð±Ð°Ð·Ð° данных encoding = Кодировка enter_db_name = ПожалуйÑта, введите название базы данных entries_% = Элементов: % error = Ошибка evaluating = Обработка event_created_% = Событие '%' было Ñоздано event_dropped_% = Событие '%' было удалено event_exists_% = Событие '%' уже ÑущеÑтвует event_not_watched_% = Событие '%' уже не ÑлушаетÑÑ event_unknown_% = ÐеизвеÑтное Ñобытие '%' event_watched_% = Уже ÑлушаетÑÑ Ñобытие '%' events_% = Событий: % exec_error_% = Ðе удалоÑÑŒ выполнить % exit = Выход expecting_cmd = ОжидаетÑÑ ÐºÐ¾Ð¼Ð°Ð½Ð´Ð° explorer = Обозреватель export = ЭкÑпорт file = файл file_exists_% = % уже ÑущеÑтвует.\nЗаменить его? file_not_deleted_% = Ðе получилоÑÑŒ удалить файл '%' file_not_opened = Ðе удалоÑÑŒ открыть файл file_not_saved = Ðе удалоÑÑŒ Ñохранить файл file_not_stored_% = Ðе удалоÑÑŒ Ñохранить файл '%' в базе file_or_dir = ИÑходный файл или Ð´Ð¸Ñ€ÐµÐºÑ‚Ð¾Ñ€Ð¸Ñ file_patterns = МаÑки файлов (через запÑтую) files_replace_% = Ð’Ñе файлы будут заменены в %.\nЗаменить их? filter = Фильтровать filter_selected = Фильтровать выделенное finishing = Завершение процеÑÑа first_line_header = Считать первую Ñтроку заголовком таблицы folder = Дерево fonts = Шрифты fullscreen = ПолноÑкранный режим fulltext = ПолнотекÑтовый Ð¸Ð½Ð´ÐµÐºÑ fulltext_index = ПолнотекÑтовый Ð¸Ð½Ð´ÐµÐºÑ general = Общее general_info = ÐžÐ±Ñ‰Ð°Ñ Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ global_option_% = Ðе удалоÑÑŒ уÑтановить глобальную наÑтройку '%' go_back = Ðазад go_forward = Вперед go_home = Домой go_to_line = Перейти к Ñтроке go_up = Ðаверх granted_%_% = ÐŸÑ€Ð¸Ð²Ð¸Ð»ÐµÐ³Ð¸Ñ % уÑтановлена пользователю '%' granted_%_%_% = ÐŸÑ€Ð¸Ð²Ð¸Ð»ÐµÐ³Ð¸Ñ % уÑтановлена пользователю '%' Ð´Ð»Ñ Ð´ÐµÐ¹Ñтвий '%' green = Зеленый gui_interactions = ГрафичеÑкий Ð¸Ð½Ñ‚ÐµÑ€Ñ„ÐµÐ¹Ñ Ð¸ Ð¸Ð½Ñ‚ÐµÑ€Ð°ÐºÑ‚Ð¸Ð²Ð½Ð°Ñ Ñ€Ð°Ð±Ð¾Ñ‚Ð° help = Помощь help1_use_catalog = Перед включением механизма поиÑка по каталогу убедитеÑÑŒ, что help2_use_catalog = Apache XML Commons Resolver доÑтупен в путÑÑ… к клаÑÑам hit_s = Попаданий index_attributes = ИндекÑируютÑÑ Ð·Ð½Ð°Ñ‡ÐµÐ½Ð¸Ñ Ð°Ñ‚Ñ€Ð¸Ð±ÑƒÑ‚Ð¾Ð² index_created_%_% = Ð˜Ð½Ð´ÐµÐºÑ '%' Ñоздан за % index_dropped_%_% = Ð˜Ð½Ð´ÐµÐºÑ '%' удален за % index_fulltext = СоздаетÑÑ Ð¿Ð¾Ð»Ð½Ð¾Ñ‚ÐµÐºÑтовый Ð¸Ð½Ð´ÐµÐºÑ index_not_dropped_% = Ðевозможно удалить Ð¸Ð½Ð´ÐµÐºÑ '%' index_text = ИндекÑируетÑÑ Ñ‚ÐµÐºÑÑ‚ indexes = ИндекÑÑ‹ information = Ð˜Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ input_bar = Строка ввода input_format = ИÑходный формат input_path = Путь к иÑходным данным input_size = ИÑходный размер insert_new_data = Ð’Ñтавить новые данные install = УÑтановить int_parser = ИÑпользовать вÑтроенный парÑер XML interrupted = Прервано invalid_% = % введено неверно invalid_value_%_% = Ðе удалоÑÑŒ уÑтановить '%' значение '%' italics = Ðаклонный java_lf = ИÑпользовать Ñтандартную тему Java kill_self_% = '%' не может убить ÑÐµÐ±Ñ language = Язык license = BSD Ð»Ð¸Ñ†ÐµÐ½Ð·Ð¸Ñ line = Строка line_% = Строка % line_number = Ðомер Ñтроки main_options = ОÑновные наÑтройки manage_db = Управление базами данных map = Карта map_choice1 = Без заголовка и границ map_choice2 = Без заголовка, узкие границы map_choice3 = Заголовок, без границ map_choice4 = Заголовок, узкие границы map_choice5 = Заголовок, широкие границы map_layout = Карта Ð½Ð°Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ match_case = Учитывать региÑтр max_nr_of_hits = Ограничение макÑимального количеÑтва попаданий method = СпоÑоб more_skipped_% = Файлы в количеÑтве % были пропущены multi_line = МультиÑтрочный режим name = Ðазвание name_invalid_% = Ðеверное название '%' name_of_db = Ð˜Ð¼Ñ Ð±Ð°Ð·Ñ‹ данных name_of_db_copy = Ð˜Ð¼Ñ ÐºÐ¾Ð¿Ð¸Ð¸ базы данных names = Имена namespaces = ПроÑтранÑтва имен new = Создать new_db_question = Ð’Ñ‹ хотите Ñоздать новую? no = Ðет no_data = Данные не доÑтупны no_db_dropped = Ðе удалоÑÑŒ удалить базу данных no_db_found = Базы данных не найдены no_db_opened = Ðе открыто ни одной базы данных no_dir_allowed_% = "%" указывает на директорию no_help = Извините, помощь не доÑтупна no_mainmem = Команда не доÑтупна в режиме работы в памÑти no_pixels = Ðе доÑтаточно пикÑелей no_stemmer_% = Ðет ни одного морфологичеÑкого анализатора Ð´Ð»Ñ Ñзыка "%" no_tokenizer_% = Ðет ни одного анализатора лекÑем Ð´Ð»Ñ Ñзыка "%" nodes = Узлы nodes_parsed_% = Разобрано узлов % not_available = Ðе доÑтупно not_parsed_% = "%" не может быть разобрано number_children = количеÑтво дочерних Ñлементов offsets = Ð¡Ð¼ÐµÑ‰ÐµÐ½Ð¸Ñ ok = OK only_backup = ДоÑтупно только в виде резервной копии open = Открыть open_manage = Открыть и ÐдминиÑтрировать optimize = Оптимизировать optimized_query = Оптимизированный Ð·Ð°Ð¿Ñ€Ð¾Ñ options = Параметры out_of_date = не актуальное ÑоÑтоÑние out_of_mem = ЗакончилаÑÑŒ памÑть output_dir = Ð”Ð¸Ñ€ÐµÐºÑ‚Ð¾Ñ€Ð¸Ñ Ð´Ð»Ñ ÑкÑпорта overwrite_db = СущеÑÑ‚Ð²ÑƒÑŽÑ‰Ð°Ñ Ð±Ð°Ð·Ð° будет перезапиÑана packages = Пакеты packages_% = Пакетов: % parameters = Параметры parse_archives = Обрабатывать файлы в архивах parse_as_jsonml = Разбирать Ñодержимое как JsonML parse_dtds = Разбирать DTD и ÑущноÑти parser_% = ПарÑер % parsing = ПарÑинг password = Пароль paste = Ð’Ñтавить path = Путь path_added_%_% = Путь "%" добавлен за % path_index = Структурный Ð¸Ð½Ð´ÐµÐºÑ perm_required_% = Ðеобходимы права доÑтупа % perm_unknown_% = ÐеизвеÑтные права доÑтупа % pi = ИнÑÑ‚Ñ€ÑƒÐºÑ†Ð¸Ñ Ð¾Ð±Ñ€Ð°Ð±Ð¾Ñ‚ÐºÐ¸ pkg_deleted_% = Пакет '%' был удален pkg_installed_%_% = Пакет '%' был уÑтановлен за % pkg_replaced_%_% = Пакет '%' был заменен за %. please_wait = Ожидайте plot = График port_twice_% = Порт '%' был указан дважды preferences = ÐаÑтройки printed = Выведено printing = Вывод на Ñкран properties = СвойÑтва pw_changed_% = Пароль Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ '%' был изменен pw_not_valid = Пароль не ÑвлÑетÑÑ ÐºÐ¾Ñ€Ñ€ÐµÐºÑ‚Ð½Ñ‹Ð¼ Ñ…Ñшем MD5 query = Ð—Ð°Ð¿Ñ€Ð¾Ñ query_executed_%_% = ЗапроÑ% выполнен за %. query_info = Ð˜Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ð¾ запроÑе query_plan = План запроÑа ratio = Пропорции read_locking = Блокировка на чтение red = КраÑный redo = Вернуть refresh = Обновить regular_expr = РегулÑрные Ð²Ñ‹Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ rename = Переименовать rename_db = Переименовать базу данных reopen = Открыть заново reopen_file_% = Открыть заново и отменить вÑе Ð¸Ð·Ð¼ÐµÐ½ÐµÐ½Ð¸Ñ Ð² '%'? replace_all = Заменить вÑе replace_with = Замена requires_restart = необходима перезагрузка res_deleted_%_% = РеÑурÑÑ‹ в количеÑтве % были удалены за % res_not_found = РеÑÑƒÑ€Ñ Ð½Ðµ найден res_not_found_% = РеÑÑƒÑ€Ñ "%" не найден res_props = СвойÑтва иÑходного реÑурÑа res_renamed_%_% = РеÑурÑÑ‹ в количеÑтве % были переименованы за % res_replaced_%_% = РеÑурÑÑ‹ в количеÑтве % были заменены за % reserved_mem = Зарезервировано памÑти reset = СброÑить resources = РеÑурÑÑ‹ restore = ВоÑÑтановить result = Результат results_% = Результатов: % rt_execution = Ðемедленное выполнение rt_filtering = ÐÐµÐ¼ÐµÐ´Ð»ÐµÐ½Ð½Ð°Ñ Ñ„Ð¸Ð»ÑŒÑ‚Ñ€Ð°Ñ†Ð¸Ñ rt_focus = Ð¤Ð¾ÐºÑƒÑ Ñледует за мышью save = Сохранить save_as = Сохранить как search = ПоиÑк select_all = Ðайти вÑе separator = Разделитель sessions_% = СеÑÑий: % sessions_killed_% = СеÑÑии в количеÑтве % были убиты show_atts = Показывать атрибуты show_name_atts = ЗаменÑть в карте Ð½Ð°Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ Ð¸Ð¼Ñ Ñ‚ÐµÐ³Ð° на значение атрибута @name similar_cmd_% = Возможно, вы имели в виду '%'? simple_file_chooser = ИÑпользовать упрощенный диалог выбора файла single_cmd = ОжидаетÑÑ Ð¾Ð´Ð¸Ð½Ð¾Ñ‡Ð½Ð°Ñ ÐºÐ¾Ð¼Ð°Ð½Ð´Ð° size = Размер skip_corrupt_files = Игнорировать поврежденные (неверно оформленные) файлы skipped = Пропущено split_input_lines = РазделÑть Ñодержимое на Ñтроки srv_running = Сервер уже запущен или недоÑтаточно прав Ð´Ð»Ñ Ð²Ñ‹Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ Ð¾Ð¿ÐµÑ€Ð°Ñ†Ð¸Ð¸ srv_started_port_% = Сервер запущен (порт: %) srv_stopped_port_% = Сервер оÑтановлен (порт: %) standard = Обычный start = ЗапуÑтить status_bar = Строка ÑтатуÑа stemming = МорфологичеÑкий поиÑк stop = ОÑтановить stopped_at = ОÑтановлен на Ñтроке stopword_list = СпиÑок Ñтоп-Ñлов strings_found_% = Ðайдено Ñтрок: % strings_replaced = Строки были заменены strip_ns = Убирать проÑтранÑтва имен syntax = СинтакÑÐ¸Ñ table = Таблица target_path = Путь team = Команда text = ТекÑÑ‚ text_index = ТекÑтовый Ð¸Ð½Ð´ÐµÐºÑ text_length = длина текÑта time_needed = ПонадобилоÑÑŒ времени timeout_exceeded = Ð’Ñ€ÐµÐ¼Ñ Ð¾Ð¶Ð¸Ð´Ð°Ð½Ð¸Ñ Ð²Ñ‹ÑˆÐ»Ð¾ timestamp = Метка времени timing = Тайминги total_mem = Ð’Ñего памÑти total_time = Итоговое Ð²Ñ€ÐµÐ¼Ñ translation = Перевод tree = Граф tree_options = Параметры графа try_% = Ðаберите % try_more_% = Ðаберите % чтобы получить больше информации try_specific_% = Ðаберите % чтобы получить информацию о конкретной команде type = Тип undo = Отменить unknown_cmd_% = ÐеизвеÑÑ‚Ð½Ð°Ñ ÐºÐ¾Ð¼Ð°Ð½Ð´Ð°: %. unknown_host_x = ÐеизвеÑтный хоÑÑ‚ '%' unknown_option_% = ÐеизвеÑтный параметр '%'. unknown_parser_% = ÐеизвеÑтный парÑер '%'. unknown_user_% = ÐеизвеÑтный пользователь '%'. unwatching_event_% = Событие '%' переÑтало ÑлушатьÑÑ up_to_date = Ðктуальное ÑоÑтоÑние updated = Обновлено use_catalog_file = ИÑпользовать файл XML каталога used_mem = Потребление памÑти user_created_% = Создан пользователь '%' user_dropped_% = Пользователь '%' удален user_dropped_%_% = Пользователь '%' удален из '%' user_exists_% = Пользователь '%' уже ÑущеÑтвует user_logged_in_% = Пользователь '%' подключен к Ñерверу username = Логин users = Пользователи users_% = Пользователей: % value = Значение version = ВерÑÐ¸Ñ view = Вид watching_event_% = СлушаетÑÑ Ñобытие '%' whole_word = Слово целиком write_locking = Блокировка на запиÑÑŒ ws_chopping = Игнорирование пробелов xquery = XQuery yes = Да # Help texts h_about = Отображение общей информации о проекте h_attr_index = Этот Ð¸Ð½Ð´ÐµÐºÑ ÑƒÑкорÑет Ñравнение атрибутов в предикатах h_browser_error_% = Ошибка Ð¾Ñ‚ÐºÑ€Ñ‹Ñ‚Ð¸Ñ Ð±Ñ€Ð°ÑƒÐ·ÐµÑ€Ð°.\nПожалуйÑта, перейдите по ÑÑылке:\n\n% h_buttons = Переключение Ð¾Ñ‚Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ð¿Ð°Ð½ÐµÐ»Ð¸ кнопок h_case = ИндекÑирование будет производитьÑÑ Ñ ÑƒÑ‡ÐµÑ‚Ð¾Ð¼ региÑтра букв h_chop_ws = Эта Ð¾Ð¿Ñ†Ð¸Ñ ÑƒÐ´Ð°Ð»Ñет пробелы между тегами и контентом h_close = Закрытие текущей базы данных h_close_file = Закрытие текущего открытого файла h_colors = Изменение цветовой Ñхемы программы h_community = Переход на Ñтраницу ÑообщеÑтва h_copy = Копирование текущих выделенных XML-узлов h_copy_path = Копирование путей к текущим выбранным XML-узлам h_db_format = Формат Ñ…Ñ€Ð°Ð½ÐµÐ½Ð¸Ñ Ð±Ð°Ð· данных был изменен. ПожалуйÑта, иÑпользуйте новую верÑию. h_delete = Удаление XML-узлов h_diacritics = Разделительные знаки будут включены в Ð¸Ð½Ð´ÐµÐºÑ h_edit = Редактирование XML-узлов h_editor = Отображение текÑтового редактора h_execute_query = Выполнить Ð·Ð°Ð¿Ñ€Ð¾Ñ h_exit = Выход из программы h_explorer = Отображение панели Ð¾Ð±Ð¾Ð·Ñ€ÐµÐ²Ð°Ñ‚ÐµÐ»Ñ h_export = ЭкÑпорт текущей базы данных h_filter_selected = Ð¤Ð¸Ð»ÑŒÑ‚Ñ€Ð°Ñ†Ð¸Ñ Ð²Ñ‹Ð´ÐµÐ»ÐµÐ½Ð½Ñ‹Ñ… узлов h_folder = Отображение панели Ñ Ð²Ð¸Ð·ÑƒÐ°Ð»Ð¸Ð·Ð°Ñ†Ð¸ÐµÐ¹ в виде дерева h_fonts = Изменение иÑпользуемых в приложении шрифтов h_fullscreen = Переход в полноÑкранный режим h_fulltext_index = ПолнотекÑтовый Ð¸Ð½Ð´ÐµÐºÑ ÑƒÑкорÑет ÑоответÑтвующие запроÑÑ‹ h_go_home = Показать вÑе h_go_to_line = Переход к указанной Ñтроке h_go_up = ПоднÑтьÑÑ Ð½Ð° уровень выше h_help = Переход на Ñтраницу Ñ Ð´Ð¾ÐºÑƒÐ¼ÐµÐ½Ñ‚Ð°Ñ†Ð¸ÐµÐ¹ h_html_parser = Ð”Ð»Ñ ÐºÐ¾Ð½Ð²ÐµÑ€Ñ‚Ð°Ñ†Ð¸Ð¸ HTML в XML будет иÑпользован парÑер TagSoup h_index_format = Формат Ñ…Ñ€Ð°Ð½ÐµÐ½Ð¸Ñ Ð¸Ð½Ð´ÐµÐºÑов был изменен. ПожалуйÑта, Ñоздайте индекÑÑ‹ заново. h_input_bar = Переключение Ð¾Ñ‚Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ Ñтроки ввода h_int_parser = Толерантный к ошибкам и быÑтрее чем Ñтандартный парÑер Java h_languauge = Будут иÑпользованы Ñпециализированные под каждый Ñзык парÑеры h_large_db = База данных Ð±Ð¾Ð»ÑŒÑˆÐ°Ñ (%). Ð’Ñ‹ хотите выключить некоторые панели\nÐ´Ð»Ñ ÑƒÑÐºÐ¾Ñ€ÐµÐ½Ð¸Ñ Ñ€Ð°Ð±Ð¾Ñ‚Ñ‹? h_map = Отображение панели Ñ Ð²Ð¸Ð·ÑƒÐ°Ð»Ð¸Ð·Ð°Ñ†Ð¸ÐµÐ¹ в виде карты h_map_layout = Изменение наÑтроек Ð´Ð»Ñ ÐºÐ°Ñ€Ñ‚Ñ‹ Ð½Ð°Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ h_new = Создание новой базы данных h_new_file = Создание нового файла h_new_node = Создание новых XML-узлов h_new_version = ДоÑтупна Ð½Ð¾Ð²Ð°Ñ Ð²ÐµÑ€ÑÐ¸Ñ (% %)!\nХотите обновить? h_no_html_parser = ПарÑер HTML не доÑтупен. ИÑходные данные будут обработаны как Ñтандартный XML. h_open_file = Открытие ÑущеÑтвующего файла h_open_manage = Управление ÑущеÑтвующими базами данных h_out_of_mem = Возможные решениÑ:\n- увеличить объем доÑтупной памÑти запуÑтив BaseX Ñ Java-параметром -Xmx\n- отключить индекÑÑ‹ по текÑту и по атрибутам. h_packages = ПроÑмотр, уÑтановка, удаление XQuery пакетов h_paste = Ð’Ñтавка предварительно Ñкопированных узлов h_path_index = Структурный Ð¸Ð½Ð´ÐµÐºÑ ÑƒÑкорÑет поиÑк пути к XML-узлу. h_plot = Отображение панели Ñ Ð²Ð¸Ð·ÑƒÐ°Ð»Ð¸Ð·Ð°Ñ†Ð¸ÐµÐ¹ в виде графика раÑÐ¿Ñ€ÐµÐ´ÐµÐ»ÐµÐ½Ð¸Ñ h_preferences = Отображение оÑновных наÑтроек программы h_properties = Получение предÑÑ‚Ð°Ð²Ð»ÐµÐ½Ð¸Ñ Ð¾ ÑвойÑтвах открытой базы данных h_query_info = Отображение панели информации о запроÑе h_recently_open = БыÑтрый переход к текущим открытым файлам h_replace = ПоиÑк и замена текÑта h_reopen_file = Открытие заново текущего файла h_result = Отображение панели результатов h_rt_execution = При включенной опции запроÑÑ‹ выполнÑÑŽÑ‚ÑÑ Ð¿Ð¾Ñле каждого Ð½Ð°Ð¶Ð°Ñ‚Ð¸Ñ ÐºÐ½Ð¾Ð¿ÐºÐ¸ h_rt_filtering = При включенной опции результаты запроÑа фильтруютÑÑ Ð°Ð²Ñ‚Ð¾Ð¼Ð°Ñ‚Ð¸Ñ‡ÐµÑки h_save = Сохранение файла h_save_result = Сохранение результата h_show_history = ИÑÑ‚Ð¾Ñ€Ð¸Ñ Ð²Ð²Ð¾Ð´Ð° h_status_bar = Переключение Ð¾Ñ‚Ð¾Ð±Ñ€Ð°Ð¶ÐµÐ½Ð¸Ñ ÑтатуÑной Ñтроки h_stemming = Перед индекÑированием из Ñлов будет извлечен корень h_stop_process = ОÑтановить текущий процеÑÑ h_stopwords = Выберите ÑпиÑок Ñтоп-Ñлов Ð´Ð»Ñ Ð¸Ð³Ð½Ð¾Ñ€Ð¸Ñ€Ð¾Ð²Ð°Ð½Ð¸Ñ Ñ‡Ð°Ñто употреблÑемых значений h_table = Отображение панели Ñ Ð²Ð¸Ð·ÑƒÐ°Ð»Ð¸Ð·Ð°Ñ†Ð¸ÐµÐ¹ в виде таблицы h_text_index = Этот Ð¸Ð½Ð´ÐµÐºÑ ÑƒÑкорÑет Ñравнение текÑта в предикатах h_tree = Отображение панели Ñ Ð²Ð¸Ð·ÑƒÐ°Ð»Ð¸Ð·Ð°Ñ†Ð¸ÐµÐ¹ в виде графа h_tree_options = ÐаÑтройка визуализации в виде графа h_updates = Переход к Ñтранице Ñ Ð¾Ð±Ð½Ð¾Ð²Ð»ÐµÐ½Ð¸Ñми программы h_used_mem = ЕÑли Ð´Ð»Ñ Ð²Ñ‹Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ Ð·Ð°Ð¿Ñ€Ð¾Ñов не хватает памÑти,\nзапуÑкайте BaseX Ñ Java-параметром -Xmx # Commands c_add1 = Добавление реÑурÑа в базу данных c_add2 = ДобавлÑет [%] по пути [%] в базу данных c_alter1 = Изменение Ð½Ð°Ð·Ð²Ð°Ð½Ð¸Ñ Ð±Ð°Ð·Ñ‹ данных или Ð¿Ð°Ñ€Ð¾Ð»Ñ Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ c_alter2 = ИзменÑет название базы данных или пароль пользователÑ: c_alterdb = изменит название базы данных c_alterpw = изменит пароль Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ c_check1 = Открытие или Ñоздание базы данных c_check2 = Откроет ÑущеÑтвующую базу данных или ÑоздаÑÑ‚ новую c_close1 = Закрытие текущей базы данных c_close2 = Закроет базу данных, открытую в данный момент c_copy1 = Копирование базы данных c_copy2 = СоздаÑÑ‚ копию базы данных c_create1 = Создание резервной копии, базы данных, ÑобытиÑ, индекÑа или Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ c_create2 = Создает новую резервную копию, базу данных, Ñобытие, Ð¸Ð½Ð´ÐµÐºÑ Ð¸Ð»Ð¸ пользователÑ: c_create3 = ÑоздаÑÑ‚ базу данных [%] Ñ Ð´Ð°Ð½Ð½Ñ‹Ð¼Ð¸ [%], еÑли указано c_create4 = ÑоздаÑÑ‚ резервную копию базы данных [%] c_create5 = ÑоздаÑÑ‚ Ð¸Ð½Ð´ÐµÐºÑ ÑƒÐºÐ°Ð·Ð°Ð½Ð½Ð¾Ð³Ð¾ типа c_create8 = ÑоздаÑÑ‚ указанного Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ c_create9 = ÑоздаÑÑ‚ Ñобытие c_cs1 = Выполнение XQuery и объÑвление результатов запроÑа новым контекÑтом c_cs2 = ВыполнÑет xquery-Ð·Ð°Ð¿Ñ€Ð¾Ñ Ð¸ объÑвлÑет результат запроÑа новым контектом c_delete1 = Удаление реÑурÑов из базы данных c_delete2 = УдалÑет реÑурÑÑ‹ в открытой на данный момент базе c_drop1 = Удаление резервной копии, базы данных, ÑобытиÑ, индекÑа или Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ c_drop2 = УдалÑет резервную копию, базу данных, Ñобытие, Ð¸Ð½Ð´ÐµÐºÑ Ð¸Ð»Ð¸ Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ c_drop21 = удалит базу данных c_drop22 = удалит указанный Ð¸Ð½Ð´ÐµÐºÑ c_drop23 = удалит указанного Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ (в указанной базе данных) c_drop24 = удалит резервную копию базы данных c_drop25 = удалит Ñобытие c_execute1 = Выполнение ÑÑ†ÐµÐ½Ð°Ñ€Ð¸Ñ ÐºÐ¾Ð¼Ð°Ð½Ð´ c_execute2 = ИÑполнÑет указанный [%] как Ñценарий команд c_exit1 = Выход из Ð¿Ñ€Ð¸Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ c_exit2 = Выходит из % c_export1 = ЭкÑпорт базы данных в XML c_export2 = ВыполнÑет ÑкÑпорт базы данных в [%] c_find1 = Выполнить поиÑковый Ð·Ð°Ð¿Ñ€Ð¾Ñ Ð¿Ð¾ ключевым Ñловам c_find2 = Создает и запуÑкает поиÑковый Ð·Ð°Ð¿Ñ€Ð¾Ñ Ð¿Ð¾ указанным ключевым Ñловам c_flush1 = Ð¡Ð±Ñ€Ð¾Ñ Ð±ÑƒÑ„ÐµÑ€Ð° базы данных на диÑк c_flush2 = СбраÑывает буфер базы данных на диÑк c_get1 = Вывод глобальной переменной c_get2 = Выводит значение глобальной переменной c_grant1 = ПредоÑтавление пользователю прав доÑтупа c_grant2 = ПредоÑтавлÑет пользователю права доÑтупа (Ð´Ð»Ñ ÑƒÐºÐ°Ð·Ð°Ð½Ð½Ð¾Ð¹ базы данных) c_help1 = Вывод информации о командах % c_help2 = ЕÑли указано [%] - выводитÑÑ Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ð¿Ð¾ указанной команде.n\Иначе - Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ð¿Ð¾ вÑем командам c_info1 = Вывод информации по текущей базе данных c_info21 = Выводит информацию по текущей базе данных: c_info22 = аргументы не указаны: вывод общей информации c_info23 = Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ð¿Ð¾ текущей базе данных c_info24 = Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ð¿Ð¾ индекÑам c_info25 = Ð¸Ð½Ñ„Ð¾Ñ€Ð¼Ð°Ñ†Ð¸Ñ Ð¿Ð¾ внутренней Ñтруктуре базы данных c_inspect1 = ЗапуÑк проверки целоÑтноÑти c_inspect2 = ВыполнÑет проверку целоÑтноÑти базы данных c_kill1 = Завершение пользовательÑких ÑеÑÑий c_kill2 = Завершает вÑе ÑеÑÑии указанного Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ c_list1 = Вывод ÑпиÑка баз данных или их реÑурÑов c_list2 = Выводит ÑпиÑок вÑех доÑтупных баз данных либо их реÑурÑÑ‹, отфильтрованные по [%] c_open1 = Открыть базу данных c_open2 = Открывает базу данных [%], отфильтрованную по [%] c_optimize1 = Оптимизировать базу данных c_optimize2 = Оптимизирует открытую базу данных.\nЕÑли указан ключ % - производитÑÑ Ð¿ÐµÑ€ÐµÑтроение вÑей Ñтруктуры базы данных,\nчто может привеÑти к уменьшению общего размера базы данных c_password1 = Изменить пароль c_password2 = ИзменÑет пароль Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ c_rename1 = Переименовать реÑурÑÑ‹ базы данных c_rename2 = Переименовывает реÑурÑÑ‹ в текущей базе данных c_replace1 = Заменить реÑурÑÑ‹ в базе данных c_replace2 = ЗаменÑет реÑурÑÑ‹ в текущей базе данных c_repo1 = УÑтановка, удаление либо вывод ÑпиÑка пакетов c_repo2 = УÑтанавливает, удалÑет либо выводит ÑпиÑок пакетов Ñ€ÐµÐ¿Ð¾Ð·Ð¸Ñ‚Ð¾Ñ€Ð¸Ñ c_repo3 = удалит пакет Ñ Ð½Ð°Ð¸Ð¼ÐµÐ½Ð¾Ð²Ð°Ð½Ð¸ÐµÐ¼ [%] или директорию [%] c_repo4 = уÑтановит пакет по пути [%] c_repo5 = отобразит ÑпиÑок вÑех уÑтановленных пакетов c_restore1 = ВоÑÑтановить базу данных c_restore2 = ВоÑÑтанавливает базу данных из поÑледней резервной копии.\nÐ’ качеÑтве аргумента можно указывать метку времени файла резервной копии c_retrieve1 = Получить иÑходный файл c_retrieve2 = Возвращает файл Ñ Ð¸Ñходными данными по указанному пути [%] c_run1 = Выполнить Ð·Ð°Ð¿Ñ€Ð¾Ñ Ð¸Ð»Ð¸ Ñценарий команд c_run2 = ВыполнÑет Ñодержимое [%] как Ð·Ð°Ð¿Ñ€Ð¾Ñ Ð¸Ð»Ð¸ Ñценарий команд c_set1 = УÑтановка глобальных переменных c_set2 = УÑтанавливает новое значение Ð´Ð»Ñ ÑƒÐºÐ°Ð·Ð°Ð½Ð½Ð¾Ð¹ переменной c_show1 = ВывеÑти информацию по Ñерверу c_show21 = Выводит информацию по Ñерверу: c_show23 = активные ÑеÑÑии текущей базы данных c_show24 = ÑпиÑок пользователей (указанной базы данных) c_show25 = ÑпиÑок резервных копий c_show26 = ÑпиÑок Ñобытий c_store1 = Сохранить иÑходный файл c_store2 = СохранÑет иÑходный файл по указанному пути [%] c_xquery1 = Выполнить XQuery c_xquery2 = ВыполнÑет указанный Ð·Ð°Ð¿Ñ€Ð¾Ñ Ð¸ выводит на Ñкран результат # Server texts; will be outsourced s_adlogin = Вход админиÑтратора (локальный или удаленный) s_connect = Соединение s_connected = УÑтановлено Ñоединение Ñ %:%. s_createu = Ðовый пользователь s_dbrevoke = Права доÑтупа будут отозваны Ð´Ð»Ñ Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ, который подключен к Ñерверу s_disconnected = Соединение разорвано s_drquestion = Пользователи в количеÑтве % будут удалены s_globperm = Глобальные права доÑтупа s_host = ХоÑÑ‚ s_info1 = ПРЕДУПРЕЖДЕÐИЕ: Клиент-ÑÐµÑ€Ð²ÐµÑ€Ð½Ð°Ñ Ð°Ñ€Ñ…Ð¸Ñ‚ÐµÐºÑ‚ÑƒÑ€Ð° и графичеÑкий Ð¸Ð½Ñ‚ÐµÑ€Ñ„ÐµÐ¹Ñ Ð½Ðµ Ñинхронизированы между Ñобой s_info2 = Их Ð¾Ð´Ð½Ð¾Ð²Ñ€ÐµÐ¼ÐµÐ½Ð½Ð°Ñ Ñ€Ð°Ð±Ð¾Ñ‚Ð° Ñ Ð¾Ð´Ð½Ð¾Ð¹ базой данных может привеÑти к неиÑправимым повреждениÑм s_locallogs = Локальный журнал Ñобытий s_localport = Локальный порт s_localserver = Локальный Ñервер s_locperm = Локальные права доÑтупа s_port = Порт s_sessions = СеÑÑии s_alter = Изменить s_server_admin = ÐдминиÑтрирование Ñервера s_h_server_admin = ИнÑтрументарий админиÑтратора Ð´Ð»Ñ ÑƒÐ¿Ñ€Ð°Ð²Ð»ÐµÐ½Ð¸Ñ Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñми и траÑÑировки журнала Ñобытий Ñервера basex-7.7.2/basex-core/src/main/resources/mime.properties000066400000000000000000001063131222453003200234500ustar00rootroot00000000000000123=application/vnd.lotus-1-2-3 323=text/h323 3dm=x-world/x-3dmf 3dmf=x-world/x-3dmf 3dml=text/vnd.in3d.3dml 3g2=video/3gpp 3gp=video/3gp 3gpp=audio/3gp 7z=application/x-7z-compressed aab=application/x-authorware-bin aac=audio/x-aac aam=application/x-authorware-map aas=application/x-authorware-map abc=text/vnd.abc abw=application/x-abiword ac=application/pkix-attr-cert acc=application/vnd.americandynamics.acc ace=application/x-ace-compressed acgi=text/html acu=application/vnd.acucobol acutc=application/vnd.acucorp adp=audio/adpcm adr=application/x-msaddr aep=application/vnd.audiograph afl=video/animaflex afm=application/x-font-type1 afp=application/vnd.ibm.modcap ahead=application/vnd.ahead.space ai=application/postscript aif=audio/x-aiff aifc=audio/x-aiff aiff=audio/x-aiff aim=application/x-aim aip=text/x-audiosoft-intra air=application/vnd.adobe.air-application-installer-package+zip ait=application/vnd.dvb.ait alt=application/x-up-alert amc=application/x-mpeg ami=application/vnd.amiga.ami ani=application/x-navi-animation anx=application/annodex aos=application/x-nokia-9000-communicator-add-on-software apk=application/vnd.android.package-archive application=application/x-ms-application apr=application/vnd.lotus-approach aps=application/mime arj=application/arj art=image/x-jg asc=text/plain asd=application/astound asf=video/x.ms.asf asm=text/x-asm asn=application/astound aso=application/vnd.accpac.simply.aso asp=text/asp asx=video/x.ms.asx asz=application/astound atc=application/vnd.acucorp atom=application/atom+xml atomcat=application/atomcat+xml atomsvc=application/atomsvc+xml atx=application/vnd.antix.game-component au=audio/basic avi=video/avi avs=video/avs-video aw=application/applixware axa=audio/annodex axs=application/olescript axv=video/annodex azf=application/vnd.airzip.filesecure.azf azs=application/vnd.airzip.filesecure.azs azw=application/vnd.amazon.ebook bas=text/plain bat=text/plain bcf=application/vnd.belarc-cf bci=application/vnd.belarc-bci bcpio=application/x-bcpio bdf=application/x-font-bdf bdm=application/vnd.syncml.dm+wbxml bed=application/vnd.realvnc.bed bh2=application/vnd.fujitsu.oasysprs bild=image/jpeg bin=application/x-binary bm=image/bmp bmi=application/vnd.bmi bmp=image/bmp boo=application/book book=application/book box=application/vnd.previewsystems.box boz=application/x-bzip2 bpp=application/x-mmjb-bpp bsh=application/x-bsh btif=image/prs.btif bwp=application/x-bwpreview bz=application/x-bzip bz2=application/x-bzip2 c=text/x-c c++=text/plain c11amc=application/vnd.cluetrust.cartomobile-config c11amz=application/vnd.cluetrust.cartomobile-config-pkg c4d=application/vnd.clonk.c4group c4f=application/vnd.clonk.c4group c4g=application/vnd.clonk.c4group c4p=application/vnd.clonk.c4group c4u=application/vnd.clonk.c4group cab=application/x-cabinet cacert=application/x-x509-ca-cert caf=audio/x-caf car=application/vnd.curl.car cat=application/vnd.ms-pki.seccat cc=text/x-c ccad=application/clariscad cco=application/x-cocoa ccs=text/ccs cct=application/x-director ccxml=application/ccxml+xml cdbcmsg=application/vnd.contact.cmsg cdf=application/cdf cdkey=application/vnd.mediastation.cdkey cdmia=application/cdmi-capability cdmic=application/cdmi-container cdmid=application/cdmi-domain cdmio=application/cdmi-object cdmiq=application/cdmi-queue cdr=application/x-cdr cdx=chemical/x-cdx cdxml=application/vnd.chemdraw+xml cdy=application/vnd.cinderella cer=application/pkix-cert cgi=magnus-internal/cgi cgm=image/cgm cha=application/x-chat chat=application/x-chat che=application/x-up-cacheop chm=application/chm chrt=application/vnd.kde.kchart cht=audio/x-dspeech cif=chemical/x-cif cii=application/vnd.anser-web-certificate-issue-initiation cil=application/vnd.ms-artgalry ckl=application/x-fortezza-ckl cla=application/vnd.claymore class=application/java clkk=application/vnd.crick.clicker.keyboard clkp=application/vnd.crick.clicker.palette clkt=application/vnd.crick.clicker.template clkw=application/vnd.crick.clicker.wordbank clkx=application/vnd.crick.clicker clp=image/x-clp cmc=application/vnd.cosmocaller cmd=text/plain cmdf=chemical/x-cmdf cml=chemical/x-cml cmp=application/vnd.yellowriver-custom-menu cmx=image/x-cmx cnc=application/x-cnc cod=image/cis-cod coda=application/x-coda com=text/plain con=application/x-connector conf=text/plain cpi=image/cpi cpio=application/x-cpio cpp=text/x-c cpt=application/x-cpt crd=application/x-mscardfile crl=application/pkcs-crl crt=application/pkix-cert cryptonote=application/vnd.rig.cryptonote csh=application/x-csh csm=application/x-cu-seeme csml=chemical/x-csml csp=application/vnd.commonspace css=text/css cst=application/x-director csv=text/comma-separated-values cu=application/x-cu-seeme curl=text/vnd.curl cut=image/x-halo-cut cvsignore=text/plain cww=application/prs.cww cxt=application/x-director cxx=text/plain dae=model/vnd.collada+xml daf=application/vnd.mobius.daf dataless=application/vnd.fdsn.seed davmount=application/davmount+xml dcr=application/x-director dcurl=text/vnd.curl.dcurl dd2=application/vnd.oma.dd2+xml ddd=application/vnd.fujixerox.ddd deb=application/x-debian-package deepv=application/x-deepv def=text/plain der=application/x-x509-ca-cert dfac=application/vnd.dreamfactory dic=text/x-c dif=video/x-dv dig=multipart/mixed dir=application/x-director dis=application/vnd.mobius.dis djv=image/vnd.djvu djvu=image/vnd.djvu dl=video/dl dna=application/vnd.dna doc=application/msword docm=application/vnd.ms-word.document.macroenabled.12 docx=application/vnd.openxmlformats-officedocument.wordprocessingml.document dot=application/x-dot dotm=application/vnd.ms-word.template.macroenabled.12 dotx=application/vnd.openxmlformats-officedocument.wordprocessingml.template dp=application/commonground dpg=application/vnd.dpgraph dra=audio/vnd.dra drw=application/drafting dsc=text/prs.lines.tag dsf=image/x-mgx-dsf dss=text/dss dssc=application/dssc+der dst=application/tajima dtb=application/x-dtbook+xml dtd=application/xml-dtd dts=audio/vnd.dts dtshd=audio/vnd.dts.hd dus=audio/x-dspeech dv=video/x-dv dvi=application/x-dvi dwf=drawing/x-dwf dwg=image/vnd dxf=image/vnd dxp=application/vnd.spotfire.dxp dxr=application/x-director ebk=application/x-expandedbook ecelp4800=audio/vnd.nuera.ecelp4800 ecelp7470=audio/vnd.nuera.ecelp7470 ecelp9600=audio/vnd.nuera.ecelp9600 ecert=application/x-x509-email-cert ecma=application/ecmascript edm=application/vnd.novadigm.edm edn=application/vnd.adobe.edn edx=application/vnd.novadigm.edx efif=application/vnd.picsel ei6=application/vnd.pg.osasli el=text/x-script.elisp elc=application/x-elc email=application/x-x509-email-cert emf=image/x-emf eml=message/rfc822 emma=application/emma+xml enc=application/pre-encrypted env=application/x-envoy eol=audio/vnd.digital-winds eot=application/vnd.ms-fontobject eps=application/postscript epub=application/epub+zip erf=application/x-hsp-erf es=audio/echospeech es3=application/vnd.eszigno3+xml esf=application/vnd.epson.esf esl=audio/echospeech et3=application/vnd.eszigno3+xml etc=application/x-earthtime etd=application/x-ebx etf=image/x-etf etx=text/x-setext evy=application/envoy exi=application/exi ext=application/vnd.novadigm.ext ez=application/andrew-inset ez2=application/vnd.ezpix-album ez3=application/vnd.ezpix-package f=text/plain f4v=video/mp4 f77=text/x-fortran f90=text/plain fbs=image/vnd.fastbidsheet fcs=application/vnd.isac.fcs fdf=application/vnd.fdf fe_launch=application/vnd.denovo.fcselayout-link fg5=application/vnd.fujitsu.oasysgp fgd=application/x-director fh=image/x-freehand fh4=image/x-freehand fh5=image/x-freehand fh7=image/x-freehand fhc=image/x-freehand fif=image/fif fig=application/x-xfig flac=audio/flac flc=video/flc fli=video/fli flo=image/florian flv=video/x-flv flw=application/vnd.kde.kivio flx=text/vnd.fmi.flexstor fly=text/vnd.fly fm=application/x-maker fmf=video/x-atomic3d-feature fml=application/fml fnc=application/vnd.frogans.fnc for=text/plain fpx=image/x-fpx frame=application/vnd.framemaker frl=application/freeloader fs=application/X-FSRecipe fsc=application/vnd.fsc.weblaunch fst=image/vnd.fst ftc=application/vnd.fluxtime.clip fti=application/vnd.anser-web-funds-transfer-initiation funk=audio/make fvi=video/isivideo fvt=video/vnd.fvt fxp=application/vnd.adobe.fxp fxpl=application/vnd.adobe.fxp fzs=application/vnd.fuzzysheet g=text/plain g2w=application/vnd.geoplan g3=image/g3fax g3w=application/vnd.geospace gac=application/vnd.groove-account gdl=model/vnd.gdl geo=application/vnd.dynageo gex=application/vnd.geometry-explorer ggb=application/vnd.geogebra.file ggt=application/vnd.geogebra.tool ghf=application/vnd.groove-help gif=image/gif gim=application/vnd.groove-identity-message gl=video/gl gmx=application/vnd.gmx gnumeric=application/x-gnumeric gph=application/vnd.flographit gqf=application/vnd.grafeq gqs=application/vnd.grafeq gram=application/srgs gre=application/vnd.geometry-explorer grv=application/vnd.groove-injector grxml=application/srgs+xml gsd=audio/gsm gsf=application/x-font-ghostscript gsm=audio/gsm gsp=application/x-gsp gss=application/x-gss gtar=application/x-gtar gtm=application/vnd.groove-tool-message gtw=model/vnd.gtw gv=text/vnd.graphviz gxt=application/vnd.geonext gz=application/gzip gzip=application/gzip h=text/x-h h261=video/h261 h263=video/h263 h264=video/h264 hal=application/vnd.hal+xml hbci=application/vnd.hbci hdf=application/x-hdf hdml=text/x-hdml help=application/x-helpfile hgl=application/vnd.hp-hpgl hh=text/x-h hlb=text/x-script hlp=application/hlp hpg=application/vnd.hp-hpgl hpgl=application/vnd.hp-hpgl hpid=application/vnd.hp-hpid hps=application/vnd.hp-hps hqx=application/binhex hta=application/hta htc=text/x-component htke=application/vnd.kenameaapp htm=text/html html=text/html htmls=text/html htt=text/webviewhtml htx=text/html hvd=application/vnd.yamaha.hv-dic hvp=application/vnd.yamaha.hv-voice hvs=application/vnd.yamaha.hv-script i2g=application/vnd.intergeo iad=application/x-iad ica=application/x-ica icc=application/vnd.iccprofile ice=x-conference/x-cooltalk icm=application/vnd.iccprofile ico=image/x-icon ics=text/calendar idc=text/plain ief=image/ief iefs=image/ief ifb=text/calendar ifm=application/vnd.shana.informed.formdata ifs=image/ifs iges=model/iges igl=application/vnd.igloader igm=application/vnd.insors.igm igs=model/iges igx=application/vnd.micrografx.igx iif=application/vnd.shana.informed.interchange iii=application/x-iphone ima=application/x-ima imap=application/x-httpd-imap imp=application/vnd.accpac.simply.imp ims=application/vnd.ms-ims in=text/plain inf=application/inf infopathxml=application/ms-infopath.xml ins=application/x-NET-Install ip=application/x-ip2 ipfix=application/ipfix ipk=application/vnd.shana.informed.package ips=application/ips ipx=application/x-ipix iqy=text/x-ms-iqy irm=application/vnd.ibm.rights-management irp=application/vnd.irepository.package+xml isu=video/x-isvideo it=audio/it itms=application/x-itunes-itms itp=application/vnd.shana.informed.formtemplate itpc=application/x-itunes-itpc iv=application/x-inventor ivp=application/vnd.immervision-ivp ivr=i-world/i-vrml ivu=application/vnd.immervision-ivu ivy=application/x-livescreen iw4=image/x-iw44 iw44=image/x-iw44 jad=text/vnd.sun.j2me.app-descriptor jam=audio/x-jam jar=application/java-archive jardiff=application/x-java-archive-diff jav=text/plain java=text/plain jcm=application/x-java-commerce jfif=image/jpeg jfif-tbnl=image/jpeg jisp=application/vnd.jisp jlt=application/vnd.hp-jlyt jnlp=application/x-java-jnlp-file joda=application/vnd.joost.joda-archive jp2=image/jp2 jpe=image/jpeg jpeg=image/jpeg jpg=image/jpeg jpgm=video/jpm jpgv=video/jpeg jpm=video/jpm jps=image/x-jps js=text/ecmascript jsc=application/x-javascript-config json=application/json jsp=text/html jsu=application/x-javascript;charset jut=image/jutvision kar=audio/midi karbon=application/vnd.kde.karbon kfo=application/vnd.kde.kformula kia=application/vnd.kidspiration kml=application/vnd.google-earth.kml+xml kmz=application/vnd.google-earth.kmz kne=application/vnd.kinar knp=application/vnd.kinar kon=application/vnd.kde.kontour kpr=application/vnd.kde.kpresenter kpt=application/vnd.kde.kpresenter ksh=application/x-ksh ksp=application/vnd.kde.kspread ktr=application/vnd.kahootz ktx=image/ktx ktz=application/vnd.kahootz kwd=application/vnd.kde.kword kwt=application/vnd.kde.kword la=audio/nspaudio lam=audio/x-liveaudio lasxml=application/vnd.las.las+xml latex=application/x-latex lbd=application/vnd.llamagraphics.life-balance.desktop lbe=application/vnd.llamagraphics.life-balance.exchange+xml lcc=application/fastman les=application/vnd.hhe.lesson-player lha=application/lha link66=application/vnd.route66.link66+xml list=text/plain list3820=application/vnd.ibm.modcap listafp=application/vnd.ibm.modcap lit=application/lit lma=audio/nspaudio log=text/plain lostxml=application/lost+xml lrm=application/vnd.ms-lrm lsm=text/plain lsp=text/lsp lst=text/plain lsx=text/x-la-asf ltf=application/vnd.frogans.ltf ltx=application/x-latex lvp=audio/vnd.lucent.voice lwp=application/x-wordpro lzh=application/x-lzh lzx=application/lzx m=text/x-m m13=application/x-msmediaview m14=application/x-msmediaview m1v=video/mpeg m21=application/mp21 m2a=audio/mpeg m2v=video/mpeg m3a=audio/mpeg m3u=audio/x-mpegurl m3u8=application/vnd.apple.mpegurl m4a=audio/x-m4a m4b=audio/x-m4b m4p=audio/x-m4p m4u=video/vnd.mpegurl m4v=video/mp4 ma=application/mathematica mads=application/mads+xml mag=application/vnd.ecowin.chart maker=application/vnd.framemaker man=application/x-troff-man map=application/x-navimap mar=text/plain mathml=application/mathml+xml mb=application/mathematica mbd=application/mbedlet mbk=application/vnd.mobius.mbk mbox=application/mbox mc$=application/x-magic-cap-package-1.0 mc1=application/vnd.medcalcdata mcd=application/mcad mcf=text/mcf mcp=application/netmc mcurl=text/vnd.curl.mcurl mdb=application/mdb mdi=image/vnd.ms-modi me=application/x-troff-me mesh=model/mesh meta4=application/metalink4+xml mets=application/mets+xml mf=text/xml mfm=application/vnd.mfmp mfp=application/mirage mgp=application/vnd.osgeo.mapguide.package mgz=application/vnd.proteus.magazine mht=message/rfc822 mhtml=message/rfc822 mi=application/x-mif mid=audio/midi midi=audio/midi mif=application/x-mif mime=www/mime mj2=video/mj2 mjf=audio/x-vnd.audioexplosion.mjuicemediafile mjp2=video/mj2 mjpg=video/x-motion-jpeg mlp=application/vnd.dolby.mlp mm=application/base64 mmd=application/vnd.chipnuts.karaoke-mmd mme=application/base64 mmf=application/vnd.smaf mmjb_mime=application/x-musicmatch-mmjb5.20detect mmr=image/vnd.fujixerox.edmics-mmr mmz=application/x-mmjb-mmz mnd=audio/x-musicnet-download mns=audio/x-musicnet-stream mny=application/x-msmoney mobi=application/x-mobipocket-ebook moc=application/x-mocha mocha=application/x-mocha mod=audio/mod mods=application/mods+xml mol=chemical/x-mdl-molfile moov=video/quicktime mov=video/quicktime movie=video/x-sgi-movie mp2=audio/mpeg mp21=application/mp21 mp2a=audio/mpeg mp2v=video/x-mpeg2 mp3=audio/mpeg mp4=video/mp4 mp4a=audio/mp4 mp4s=application/mp4 mp4v=video/mp4 mpa=audio/mpeg mpc=application/x-project mpe=video/mpeg mpeg=video/mpeg mpegv=video/mpeg mpf=application/vnd.ms-mediapackage mpg=video/mpeg mpg4=video/mp4 mpga=audio/mpeg mpire=application/x-mpire mpkg=application/vnd.apple.installer+xml mpl=application/x-mpire mpm=application/vnd.blueice.multipass mpn=application/vnd.mophun.application mpp=application/vnd.ms-project mpt=application/x-project mpv=video/mpeg mpv2=video/x-mpeg2 mpx=application/x-project mpy=application/vnd.ibm.minipay mqy=application/vnd.mobius.mqy mrc=application/marc mrcx=application/marcxml+xml ms=application/x-troff-ms mscml=application/mediaservercontrol+xml mseed=application/vnd.fdsn.mseed mseq=application/vnd.mseq msf=application/vnd.epson.msf msh=model/mesh msi=application/msi msl=application/vnd.mobius.msl msm=application/msm msty=application/vnd.muvee.style msw=application/msword mts=model/vnd.mts mus=application/vnd.musician musicxml=application/vnd.recordare.musicxml+xml mv=video/x-sgi-movie mvb=application/x-msmediaview mwf=application/vnd.mfer mwrt=application/macwriteii mxf=application/mxf mxl=application/vnd.recordare.musicxml mxml=application/xv+xml mxs=application/vnd.triscape.mxs mxu=video/vnd.mpegurl my=audio/make mzz=application/x-vnd.audioexplosion.mzz n2p=application/n2p n3=text/n3 nap=image/naplps naplps=image/naplps nb=application/mathematica nbp=application/vnd.wolfram.player nc=application/x-netcdf ncm=application/vnd.nokia.configuration-message ncx=application/x-dtbncx+xml n-gage=application/vnd.nokia.n-gage.symbian.install ngdat=application/vnd.nokia.n-gage.data nif=image/x-niff niff=image/x-niff nix=application/x-mix-transfer nlu=application/vnd.neurolanguage.nlu nml=application/vnd.enliven nnd=application/vnd.noblenet-directory nns=application/vnd.noblenet-sealer nnw=application/vnd.noblenet-web npx=application/x-netfpx nsc=application/x-nschat nsf=application/vnd.lotus-notes nvd=application/x-navidoc oa2=application/vnd.fujitsu.oasys2 oa3=application/vnd.fujitsu.oasys3 oas=application/vnd.fujitsu.oasys obd=application/x-msbinder oda=application/oda odb=application/vnd.oasis.opendocument.database odc=text/x-ms-odc odf=application/vnd.oasis.opendocument.formula odft=application/vnd.oasis.opendocument.formula-template odg=application/vnd.oasis.opendocument.graphics odi=application/vnd.oasis.opendocument.image odm=application/vnd.oasis.opendocument.text-master odp=application/vnd.oasis.opendocument.presentation ods=application/vnd.oasis.opendocument.spreadsheet odt=application/vnd.oasis.opendocument.text ofc=application/x-ofc ofml=application/fml ofx=application/x-ofx oga=audio/ogg ogg=audio/ogg ogv=video/ogg ogx=application/ogg omc=application/x-omc omcd=application/x-omcdatamaker omcr=application/x-omcregerator onepkg=application/onenote onetmp=application/onenote onetoc=application/onenote onetoc2=application/onenote opf=application/oebps-package+xml oprc=application/vnd.palm org=application/vnd.lotus-organizer osf=application/vnd.yamaha.openscoreformat osfpvg=application/vnd.yamaha.openscoreformat.osfpvg+xml otc=application/vnd.oasis.opendocument.chart-template otf=application/vnd.oasis.opendocument.formula-template otg=application/vnd.oasis.opendocument.graphics-template oth=application/vnd.oasis.opendocument.text-web oti=application/vnd.oasis.opendocument.image-template otp=application/vnd.oasis.opendocument.presentation-template ots=application/vnd.oasis.opendocument.spreadsheet-template ott=application/vnd.oasis.opendocument.text-template oxt=application/vnd.openofficeorg.extension p=text/x-pascal p10=application/pkcs10 p12=application/pkcs-12 p7a=application/x-pkcs7-signature p7b=application/x-pkcs7-certificates p7c=application/pkcs7-mime p7m=application/pkcs7-mime p7r=application/x-pkcs7-certreqresp p7s=application/pkcs7-signature p8=application/pkcs8 pac=audio/x-pac pae=audio/x-epac page=application/x-coda part=application/pro_eng pas=text/pascal paw=application/vnd.pawaafile pbd=application/vnd.powerbuilder6 pbm=image/x-portable-bitmap pcast=application/x-podcast pcd=image/x-photo-cd pcf=application/x-font-pcf pcl=application/x-pcl pclxl=application/vnd.hp-pclxl pct=image/x-pict pcurl=application/vnd.curl.pcurl pcx=image/x-pcx pdb=chemical/x-pdb pdf=application/pdf pdx=application/vnd.adobe.pdx pfa=application/x-font-type1 pfb=application/x-font-type1 pfm=application/x-font-type1 pfr=application/font-tdpfr pfunk=audio/make pfx=application/x-pkcs12 pgm=image/x-portable-graymap pgn=application/x-chess-pgn pgp=application/x-pgp-plugin pgr=text/parsnegar-document php=application/x-httpd-php php3=application/x-httpd-php3 php4=application/x-httpd-php phps=application/x-httpd-php-source phtml=application/x-httpd-php4 pic=image/pict pict=image/pict pinstall=application/x-picasa-detect pjp=image/jpeg pjpeg=image/jpeg pkg=application/x-newton-compatible-pkg pki=application/pkixcmp pkipath=application/pkix-pkipath pko=application/vnd.ms-pki.pko pl=text/plain plb=application/vnd.3gpp.pic-bw-large plc=application/vnd.mobius.plc plf=application/vnd.pocketlearn pls=audio/x-scpls plx=application/x-pixclscript pm=image/x-xpixmap pm4=application/x-pagemaker pm5=application/x-pagemaker pml=application/vnd.ctc-posml png=image/png pnm=image/x-portable-anymap pntg=image/x-macpaint portpkg=application/vnd.macports.portpkg pot=application/mspowerpoint potm=application/vnd.ms-powerpoint.template.macroenabled.12 potx=application/vnd.openxmlformats-officedocument.presentationml.template pov=model/x-pov ppa=application/vnd.ms-powerpoint ppam=application/vnd.ms-powerpoint.addin.macroenabled.12 ppd=application/vnd.cups-ppd ppm=image/x-portable-pixmap pps=application/mspowerpoint ppsm=application/vnd.ms-powerpoint.slideshow.macroenabled.12 ppsx=application/vnd.openxmlformats-officedocument.presentationml.slideshow ppt=application/powerpoint pptm=application/vnd.ms-powerpoint.presentation.macroenabled.12 pptx=application/vnd.openxmlformats-officedocument.presentationml.presentation ppz=application/mspowerpoint pqa=application/vnd.palm pqf=application/x-cprplayer pqi=application/cprplayer prc=application/x-mobipocket-ebook pre=application/x-freelance prf=application/pics-rules proxy=application/x-ns-proxy-autoconfig prt=application/pro_eng ps=application/postscript psb=application/vnd.3gpp.pic-bw-small psf=application/x-font-linux-psf pskcxml=application/pskc+xml psr=application/datawindow ptid=application/vnd.pvi.ptid1 ptlk=application/listenup pub=application/x-mspublisher push=multipart/x-mixed-replace pvb=application/vnd.3gpp.pic-bw-var pvu=paleovu/x-pv pwn=application/vnd.3m.post-it-notes pwz=application/vnd.ms-powerpoint py=text/x-script.phyton pya=audio/vnd.ms-playready.media.pya pyc=applicaiton/x-bytecode.python pyv=video/vnd.ms-playready.media.pyv qam=application/vnd.epson.quickanime qbo=application/vnd.intu.qbo qcp=audio/vnd.qcelp qd3=x-world/x-3dmf qd3d=x-world/x-3dmf qfx=application/vnd.intu.qfx qif=application/x-qif qps=application/vnd.publishare-delta-tree qrt=application/quest qt=video/quicktime qtc=video/x-qtc qti=image/x-quicktime qtif=image/x-quicktime qtl=application/x-quicktimeplayer qwd=application/vnd.quark.quarkxpress qwt=application/vnd.quark.quarkxpress qxb=application/vnd.quark.quarkxpress qxd=application/vnd.quark.quarkxpress qxl=application/vnd.quark.quarkxpress qxt=application/vnd.quark.quarkxpress r3t=text/vnd.rn-realtext3d ra=audio/x-realaudio ram=audio/x-pn-realaudio rar=application/rar ras=image/cmu-raster rast=image/cmu-raster rcprofile=application/vnd.ipunplugged.rcprofile rdf=application/rdf+xml rdz=application/vnd.data-vision.rdz rec=application/vnd.rn-recording rep=application/vnd.businessobjects res=application/x-dtbresource+xml rexx=text/x-script.rexx rf=image/vnd.rn-realflash rgb=image/x-rgb rif=application/reginfo+xml rip=image/rip rl=application/resource-lists+xml rlc=image/vnd.fujixerox.edmics-rlc rld=application/resource-lists-diff+xml rm=audio/x-pn-realaudio rmf=audio/rmf rmi=audio/mid rmm=audio/x-pn-realaudio rmp=audio/x-pn-realaudio rms=application/vnd.jcp.javame.midlet-rms rnc=application/relax-ng-compact-syntax rng=application/ringing-tones rnx=application/vnd.rn-realplayer roff=application/x-troff rp=image/vnd.rn-realpix rp9=application/vnd.cloanto.rp9 rpm=application/x-rpm rpss=application/vnd.nokia.radio-presets rpst=application/vnd.nokia.radio-preset rq=application/sparql-query rqy=text/x-ms-rqy rrf=application/x-InstallFromTheWeb rs=application/rls-services+xml rsd=application/rsd+xml rss=application/rss+xml rt=text/richtext rtc=application/rtc rtf=application/rtf rtsp=application/x-rtsp rtx=text/richtext rv=video/vnd.rn-realvideo s=text/x-asm s3m=audio/s3m saf=application/vnd.yamaha.smaf-audio sbk=application/x-tbook sbml=application/sbml+xml sc=application/vnd.ibm.secure-container sca=application/x-supercard scd=application/x-msschedule scert=application/x-x509-server-cert sch=application/schdpl32 scm=video/x-scm scq=application/scvp-cv-request scs=application/scvp-cv-response scurl=text/vnd.curl.scurl sd2=audio/x-sd2 sda=application/vnd.stardivision.draw sdc=application/vnd.stardivision.calc sdd=application/vnd.stardivision.impress sdkd=application/vnd.solent.sdkm+xml sdkm=application/vnd.solent.sdkm+xml sdml=text/plain sdp=application/sdp sdr=application/sounder sdv=video/sd-video sdw=application/vnd.stardivision.writer sea=application/sea see=application/vnd.seemail seed=application/vnd.fdsn.seed sema=application/vnd.sema semd=application/vnd.semd semf=application/vnd.semf ser=application/java-serialized-object set=application/set setpay=application/set-payment-initiation setreg=application/set-registration-initiation sfd-hdstx=application/vnd.hydrostatix.sof-data sfs=application/vnd.spotfire.sfs sgi=image/x-sgi sgl=application/vnd.stardivision.writer-global sgm=text/sgml sgml=text/sgml sh=application/x-sh sha=application/sha shar=application/x-bsh shf=application/shf+xml shtm=text/html shtml=text/html shw=application/presentations sid=audio/x-psid sig=application/pgp-signature silo=model/mesh sis=application/vnd.symbian.install sisx=application/vnd.symbian.install sit=application/x-sit sitx=application/x-stuffitx skd=application/x-koan skm=application/x-koan skp=application/x-koan skt=application/x-koan sl=application/x-seelogo slc=application/x-salsa sldm=application/vnd.ms-powerpoint.slide.macroenabled.12 sldx=application/vnd.openxmlformats-officedocument.presentationml.slide slt=application/vnd.epson.salt sm=application/vnd.stepmania.stepchart smf=application/vnd.stardivision.math smi=application/smil smil=application/smil sml=application/smil smp=application/studiom snd=audio/basic snf=application/x-font-snf sol=application/solids spc=text/x-speech spf=application/vnd.yamaha.smaf-phrase spl=application/futuresplash spot=text/vnd.in3d.spot spp=application/scvp-vp-response spq=application/scvp-vp-request spr=application/x-sprite sprite=application/x-sprite spx=audio/ogg sql=text/plain src=application/x-wais-source sru=application/sru+xml srx=application/sparql-results+xml sse=application/vnd.kodak-descriptor ssf=application/vnd.epson.ssf ssi=text/x-server-parsed-html ssm=application/streamingmedia ssml=application/ssml+xml sst=application/vnd.ms-pki.certstore st=application/vnd.sailingtracker.track stc=application/vnd.sun.xml.calc.template std=application/vnd.sun.xml.draw.template step=application/step stf=application/vnd.wt.stf sti=application/vnd.sun.xml.impress.template stk=application/hstu stl=application/sla stp=application/step str=application/vnd.pg.format stream=audio/x-qt-stream stw=application/vnd.sun.xml.writer.template sub=image/vnd.dvb.subtitle sus=application/vnd.sus-calendar susp=application/vnd.sus-calendar sv4cpio=application/x-sv4cpio sv4crc=application/x-sv4crc svc=application/vnd.dvb.service svd=application/vnd.svd svf=image/vnd svg=image/svg+xml svgz=image/svg+xml svh=image/svh svr=x-world/x-svr swa=application/x-director swf=application/x-shockwave-flash swi=application/vnd.aristanetworks.swi sxc=application/vnd.sun.xml.calc sxd=application/vnd.sun.xml.draw sxg=application/vnd.sun.xml.writer.global sxi=application/vnd.sun.xml.impress sxm=application/vnd.sun.xml.math sxw=application/vnd.sun.xml.writer t=application/x-troff talk=text/x-speech tao=application/vnd.tao.intent-module-archive tar=application/x-tar tar.gz=application/x-gtar targa=image/x-targa tbk=application/x-tbook tbp=application/x-timbuktu tbt=application/timbuktu tcap=application/vnd.3gpp2.tcap tcl=application/x-tcl tcsh=text/x-script.tcsh teacher=application/vnd.smart.teacher tei=application/tei+xml teicorpus=application/tei+xml tex=application/x-tex texi=application/x-texinfo texinfo=application/x-texinfo text=text/plain tfi=application/thraud+xml tfm=application/x-tex-tfm tgz=application/gzip thmx=application/vnd.ms-officetheme tif=image/tiff tiff=image/tiff tki=application/x-tkined tkined=application/x-tkined tlk=application/x-tlk tmo=application/vnd.tmobile-livetv tmv=application/x-Parable-Thing torrent=application/x-bittorrent tpl=application/vnd.groove-tool-template tpt=application/vnd.trid.tpt tr=application/x-troff tra=application/vnd.trueapp trm=application/x-msterminal troff=application/x-troff tsd=application/timestamped-data tsi=audio/tsplayer tsp=audio/tsplayer tsq=application/timestamp-query tsr=application/timestamp-reply tsv=text/tab-separated-values ttc=application/x-font-ttf ttf=font/ttf ttl=text/turtle turbot=image/florian twd=application/vnd.simtech-mindmapper twds=application/vnd.simtech-mindmapper txd=application/vnd.genomatix.tuxedo txf=application/vnd.mobius.txf txt=text/plain u98=urdu/urdu98 ucert=application/x-x509-user-cert udeb=application/x-debian-package ufd=application/vnd.ufdl ufdl=application/vnd.ufdl uil=text/x-uil uin=application/x-icq uls=text/iuls umj=application/vnd.umajin uni=text/uri-list unis=text/uri-list unityweb=application/vnd.unity unv=application/i-deas uoml=application/vnd.uoml+xml uri=text/uri-list uris=text/uri-list urls=text/uri-list usercert=application/x-x509-user-cert usr=application/x-x509-user-cert ustar=multipart/x-ustar utz=application/vnd.uiq.theme uu=text/x-uuencode uue=text/x-uuencode uva=audio/vnd.dece.audio uvd=application/vnd.dece.data uvf=application/vnd.dece.data uvg=image/vnd.dece.graphic uvh=video/vnd.dece.hd uvi=image/vnd.dece.graphic uvm=video/vnd.dece.mobile uvp=video/vnd.dece.pd uvs=video/vnd.dece.sd uvt=application/vnd.dece.ttml+xml uvu=video/vnd.uvvu.mp4 uvv=video/vnd.dece.video uvva=audio/vnd.dece.audio uvvd=application/vnd.dece.data uvvf=application/vnd.dece.data uvvg=image/vnd.dece.graphic uvvh=video/vnd.dece.hd uvvi=image/vnd.dece.graphic uvvm=video/vnd.dece.mobile uvvp=video/vnd.dece.pd uvvs=video/vnd.dece.sd uvvt=application/vnd.dece.ttml+xml uvvu=video/vnd.uvvu.mp4 uvvv=video/vnd.dece.video uvvx=application/vnd.dece.unspecified uvx=application/vnd.dece.unspecified vbd=application/activexdocument vbs=video/mpeg vcd=application/x-cdlink vcf=text/x-vcard vcg=application/vnd.groove-vcard vcs=text/x-vcalendar vcx=application/vnd.vcx vda=application/vda vdo=video/vdo vew=application/groupwise vgm=video/x-videogram vgp=video/x-videogram-plugin vgx=video/x-videogram vis=application/vnd.visionary viv=video/vivo vivo=video/vivo vmd=application/vocaltec-media-desc vmf=application/vocaltec-media-file vmi=application/x-dreamcast-vms-info vms=application/x-dreamcast-vms voc=audio/voc vor=application/vnd.stardivision.writer vos=video/vosaic vox=audio/voxware vpa=application/vpa vpg=application/x-vpeg005 vqe=audio/x-twinvq-plugin vqf=audio/x-twinvq vql=audio/x-twinvq vrml=model/vrml vrt=x-world/x-vrt vsd=application/x-visio vsf=application/vnd.vsf vss=application/vnd.visio vst=application/x-visio vsw=application/x-visio vts=workbook/formulaone vtts=workbook/formulaone vtu=model/vnd.vtu vxml=application/voicexml+xml w3d=application/x-director w60=application/wordperfect6.0 w61=application/wordperfect6.1 w6w=application/msword wad=application/x-doom waf=plugin/wanimate wan=plugin/wanimate wav=audio/wav wax=audio/x-ms-wax wb1=application/x-qpro wbmp=image/vnd.wap.wbmp wbs=application/vnd.criticaltools.wbs+xml wbxml=application/vnd.wap.wbxml wcm=application/vnd.ms-works wdb=application/vnd.ms-works web=application/vnd.xara weba=audio/webm webm=video/webm webp=image/webp wg=application/vnd.pmi.widget wgt=application/widget wi=image/wavelet wid=application/x-DemoShield wis=application/x-InstallShield wiz=application/msword wk1=application/x-123 wk2=application/vnd.lotus-1-2-3 wk3=application/vnd.lotus-1-2-3 wk4=application/vnd.lotus-1-2-3 wks=application/vnd.lotus-1-2-3 wlt=application/x-mswallet wm=video/x-ms-wm wma=audio/x-ms-wma wmd=application/x-ms-wmd wmf=image/x-wmf wml=x-world/x-vrml wmlc=application/vnd.wap.wmlc wmls=text/vnd.wap.wmlscript wmlsc=application/vnd.wap.wmlscriptc wmv=video/x-ms-wmv wmx=video/x-ms-wmx wmz=application/x-ms-wmz woff=application/x-font-woff word=application/msword wp=application/wordperfect wp5=application/wordperfect wp6=application/wordperfect wpd=application/x-wpwin wpl=application/vnd.ms-wpl wps=application/vnd.ms-works wq1=application/x-lotus wqd=application/vnd.wqd wri=application/write wrl=model/vrml wrz=model/vrml wsc=text/scriplet wsdl=application/wsdl+xml wspolicy=application/wspolicy+xml wsrc=application/x-wais-source wtb=application/vnd.webturbo wtk=application/x-wintalk wtls-ca-certificate=application/vnd.wap.wtls-ca-certificate wtx=audio/wtx wv=video/wavelet wvx=video/x-ms-wvx x3d=application/vnd.hzn-3d-crossword xap=application/x-silverlight-app xar=application/vnd.xara xbap=application/x-ms-xbap xbd=application/vnd.fujixerox.docuworks.binder xbm=image/x-xbitmap xdf=application/xcap-diff+xml xdm=application/vnd.syncml.dm+xml xdp=application/vnd.adobe.xdp+xml xdr=video/x-videogram xdssc=application/dssc+xml xdw=application/vnd.fujixerox.docuworks xenc=application/xenc+xml xer=application/patch-ops-error+xml xfd=application/vnd.adobe.xfd+xml xfdf=application/vnd.adobe.xfdf xfdl=application/vnd.xfdl xgz=xgl/drawing xht=application/xhtml+xml xhtm=application/xhtml+xml xhtml=application/xhtml+xml xhvml=application/xv+xml xif=image/vnd.xiff xl=application/excel xla=application/excel xlam=application/vnd.ms-excel.addin.macroEnabled.12 xlb=application/excel xlc=application/excel xld=application/excel xlk=application/excel xll=application/excel xlm=application/excel xls=application/excel xlsb=application/vnd.ms-excel.sheet.binary.macroEnabled.12 xlsm=application/vnd.ms-excel.sheet.macroenabled.12 xlsx=application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlt=application/excel xltm=application/vnd.ms-excel.template.macroenabled.12 xltx=application/vnd.openxmlformats-officedocument.spreadsheetml.template xlv=application/excel xlw=application/excel xm=audio/xm xml=application/xml xmz=xgl/movie xo=application/vnd.olpc-sugar xop=application/xop+xml xpi=application/x-xpinstall xpix=application/x-vnd.ls-xpix xpm=image/x-xbitmap x-png=image/png xpr=application/vnd.is-xpr xps=application/vnd.ms-xpsdocument xpw=application/vnd.intercon.formnet xpx=application/vnd.intercon.formnet xq=application/xquery xql=application/xquery xqm=application/xquery xquery=application/xquery xqy=application/xquery xsd=text/xml xsl=text/xml xslt=application/xslt+xml xsm=application/vnd.syncml+xml xspf=application/xspf+xml xsr=video/x-amt-showrun xul=application/vnd.mozilla.xul+xml xvm=application/xv+xml xvml=application/xv+xml xwd=image/x-xwindowdump xyz=chemical/x-pdb yang=application/yang yin=application/yin+xml z=application/compress zaz=application/vnd.zzazz.deck+xml zip=application/zip zir=application/vnd.zul zirz=application/vnd.zul zlib=application/x-deflate zpa=application/pcphoto zsh=text/x-script.zsh basex-7.7.2/basex-core/src/test/000077500000000000000000000000001222453003200164205ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/java/000077500000000000000000000000001222453003200173415ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/java/org/000077500000000000000000000000001222453003200201305ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/java/org/basex/000077500000000000000000000000001222453003200212325ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/java/org/basex/test/000077500000000000000000000000001222453003200222115ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/java/org/basex/test/BaseXClientTest.java000066400000000000000000000052061222453003200260600ustar00rootroot00000000000000package org.basex.test; import static org.junit.Assert.*; import java.io.*; import org.basex.*; import org.basex.core.*; import org.basex.io.out.*; import org.basex.util.*; import org.basex.util.list.*; import org.junit.*; /** * Tests the command-line arguments of the client starter class. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BaseXClientTest extends BaseXTest { @Override protected String run(final String... args) throws IOException { return run(args, new String[0]); } /** * Test client with different port. * @throws IOException I/O exception */ @Test public void port() throws IOException { equals("1", new String[] { "-p9898", "-q1" }, new String[] { "-p9898" }); } /** * Test client with invalid port argument. * @throws IOException I/O exception */ @Test(expected = BaseXException.class) public void portErr() throws IOException { run("-px"); } /** * Test client with invalid port number. * @throws IOException I/O exception */ @Test(expected = BaseXException.class) public void portErr2() throws IOException { run("-px0"); } /** * Test client with different user. * @throws IOException I/O exception */ @Test public void user() throws IOException { run("-cexit", "-cdrop user " + NAME); equals("5", new String[] { "-U" + NAME, "-P" + NAME, "-q5" }, new String[] { "-ccreate user " + NAME + ' ' + Token.md5(NAME) }); run("-cexit", "-cdrop user " + NAME); } /** * Runs a request and compares the result with the expected result. * @param exp expected result * @param args command-line arguments * @param sargs server arguments * @throws IOException I/O exception */ private static void equals(final String exp, final String[] args, final String[] sargs) throws IOException { assertEquals(exp, run(args, sargs)); } /** * Runs a request with the specified arguments and server arguments. * @param args command-line arguments * @param sargs server arguments * @return result * @throws IOException I/O exception */ private static String run(final String[] args, final String[] sargs) throws IOException { final BaseXServer server = createServer(sargs); final ArrayOutput ao = new ArrayOutput(); System.setOut(new PrintStream(ao)); System.setErr(NULL); final StringList sl = new StringList(); sl.add("-p9999").add("-U" + Text.ADMIN).add("-P" + Text.ADMIN).add(args); try { new BaseXClient(sl.toArray()); return ao.toString(); } finally { System.setErr(ERR); stopServer(server); } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/BaseXStandaloneTest.java000066400000000000000000000017731222453003200267370ustar00rootroot00000000000000package org.basex.test; import static org.basex.util.Token.*; import static org.junit.Assert.*; import java.io.*; import org.basex.*; import org.basex.io.out.*; import org.junit.*; /** * Tests the command-line arguments of the standalone starter class. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BaseXStandaloneTest extends BaseXTest { /** * Write back updates. * @throws IOException I/O exception */ @Test public void writeBack() throws IOException { INPUT.write(token("X")); run("-i", INPUT.toString(), "-u", "-q", "delete node //text()"); assertEquals("", string(INPUT.read())); } @Override protected String run(final String... args) throws IOException { try { final ArrayOutput ao = new ArrayOutput(); System.setOut(new PrintStream(ao)); System.setErr(NULL); new BaseX(args); return ao.toString(); } finally { System.setOut(OUT); System.setErr(ERR); } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/BaseXTest.java000066400000000000000000000113521222453003200247200ustar00rootroot00000000000000package org.basex.test; import static org.basex.util.Token.*; import static org.junit.Assert.*; import java.io.*; import org.basex.core.*; import org.junit.*; /** * Tests the command-line arguments of the starter class. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class BaseXTest extends MainTest { /** * Deletes the test files. * @throws IOException I/O exception */ @After public void clean() throws IOException { assertTrue("Could not delete input file.", !INPUT.exists() || INPUT.delete()); run("-cdrop db " + NAME); } /** * Tests a query file. * @throws IOException I/O exception */ @Test public void queryFile() throws IOException { final String query = "1"; INPUT.write(token(query)); equals(query, INPUT.path()); } /** * Test variable bindings. * @throws IOException I/O exception */ @Test public void bind() throws IOException { equals("1", "-ba=1", "-q$a"); equals("2", "-ba=1", "-bb=1", "-q$a+$b"); equals("3", "-ba=1", "-bb=2", "-q$a+$b"); INPUT.write(token("$a")); equals("4", "-ba=4", INPUT.toString()); equals("5,6;7'", "-ba=5,6;7'", "-q$a"); // bind variables with namespaces equals("8", "-b{}a=8", "-q$a"); equals("9", "-b{URI}a=9", "-qdeclare namespace a='URI';" + "declare variable $a:a external; $a:a"); // check if parameters are evaluated in given order equals("12", "-ba=1", "-q$a", "-ba=2", "-q$a"); } /** * Test variable bindings. * @throws IOException I/O exception */ @Test(expected = BaseXException.class) public void bindErr() throws IOException { run("-ba=A", "-qdeclare variable $a as xs:integer external; $a"); } /** * Test variable bindings with namespaces. * @throws IOException I/O exception */ @Test(expected = BaseXException.class) public void bindNSErr() throws IOException { run("X'\"", "-b{URI}ln=X'\"", INPUT.toString()); } /** * Test command execution. * @throws IOException I/O exception */ @Test public void input() throws IOException { final String in = ""; INPUT.write(token(in)); equals(in, "-i" + INPUT, "-q."); equals(in, "-i" + in, "-q."); } /** * Test command execution. * @throws IOException I/O exception */ @Test public void command() throws IOException { equals("1", "-cxquery 1"); } /** * Command error. * @throws IOException I/O exception */ @Test(expected = BaseXException.class) public void commandErr() throws IOException { run("-1"); } /** * Tests command scripts. * @throws IOException I/O exception */ @Test public void commands() throws IOException { INPUT.write(token("xquery 1" + Prop.NL + "xquery 2" + Prop.NL)); equals("12", "-c" + INPUT.path()); } /** * Test query evaluation. * @throws IOException I/O exception */ @Test public void query() throws IOException { equals("3", "-q1+2"); } /** * Query error. * @throws IOException I/O exception */ @Test(expected = BaseXException.class) public void queryErr() throws IOException { run("-q1+"); } /** * Test different number of runs. * @throws IOException I/O exception */ @Test public void runs() throws IOException { equals("1", "-r2", "-q1"); } /** * Test different number of runs. * @throws IOException I/O exception */ @Test(expected = BaseXException.class) public void runErr() throws IOException { run("-rx", "-q2"); } /** * Test trailing newline. * @throws IOException I/O exception */ @Test public void newline() throws IOException { equals("1", "-q1"); equals("1" + Prop.NL, "-L", "-q1"); equals("1" + Prop.NL + "2" + Prop.NL, "-L", "-q1", "-q2"); } /** * Test serialization parameters. * @throws IOException I/O exception */ @Test public void serial() throws IOException { equals("1", "-smethod=text", "-q1"); // check if parameters are evaluated in given order equals("11", "-smethod=text", "-q1", "-smethod=xml", "-q1"); } /** * Test verbose mode. * @throws IOException I/O exception */ @Test public void verbose() throws IOException { contains(Text.QUERY_EXECUTED_X_X.replaceAll(" *%.*", ""), "-v", "-q1"); contains(Text.TOTAL_TIME_CC, "-V", "-q1"); } /** * Turn off whitespace chopping. * @throws IOException I/O exception */ @Test public void chop() throws IOException { final String in = " CHOP "; INPUT.write(token(in)); equals(in, "-w", "-i" + INPUT, "-q."); } /** * Turn off serialization. * @throws IOException I/O exception */ @Test public void noSerialization() throws IOException { equals("", "-z", "-q1"); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/JsonParserTest.java000066400000000000000000000157071222453003200260140ustar00rootroot00000000000000package org.basex.test; import org.basex.query.*; import org.basex.query.util.json.*; import org.basex.query.util.json.JsonParser.*; import org.basex.util.*; import org.junit.Test; import static org.junit.Assert.*; /** * Tests for the {@link JsonParser} class. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public class JsonParserTest { /** Token builder for output checks. */ private final TokenBuilder tb = new TokenBuilder(); /** Tests if the empty JSON string is rejected. */ public void emptyQuery() { error("", Spec.ECMA_262); error(" \t\r\n", Spec.ECMA_262); } /** * Tests for parsing numbers. * @throws QueryException query exception */ @Test public void numberTest() throws QueryException { parse("0", Spec.ECMA_262); parse("1", Spec.ECMA_262); parse("-1", Spec.ECMA_262); parse("10", Spec.ECMA_262); parse("1234567890123456789012345678901234567890", Spec.ECMA_262); parse("0.5", Spec.ECMA_262); parse("0.01", Spec.ECMA_262); parse("-0.01", Spec.ECMA_262); parse("1234567890123456789012345678901234567890" + ".1234567890123456789012345678901234567890", Spec.ECMA_262); parse("0E1", Spec.ECMA_262); parse("0E-1", Spec.ECMA_262); parse("0E+1", Spec.ECMA_262); parse("-0E+1", Spec.ECMA_262); parse("0E00", Spec.ECMA_262); parse("1234567890123456789012345678901234567890" + "e1234567890123456789012345678901234567890", Spec.ECMA_262); parse("123e-123", Spec.ECMA_262); parse("123.4e-123", Spec.ECMA_262); parse("123.456E0001", Spec.ECMA_262); parse("-123.456E0001", Spec.ECMA_262); parse("[ -123.456E0001, 0 ]", Spec.ECMA_262); error("01", Spec.ECMA_262); error("-", Spec.ECMA_262); error("-\u00e4", Spec.ECMA_262); error("0.", Spec.ECMA_262); error("0.\u00e4", Spec.ECMA_262); error("1e", Spec.ECMA_262); error("1e+", Spec.ECMA_262); error("1e+\u00e4", Spec.ECMA_262); error("1e+0\u00e4", Spec.ECMA_262); } /** * Tests for paring strings. * @throws QueryException query exception */ @Test public void stringTest() throws QueryException { parse("\"\"", Spec.ECMA_262); parse("\"test\"", Spec.ECMA_262); parse("\"\u00e4\"", Spec.ECMA_262); parse("\"\uD834\uDD1E\"", Spec.ECMA_262); parse("\"\uD834\"", Spec.ECMA_262); parse("\"\uD853\uDF5C\"", Spec.ECMA_262); parse("\"\uD853\uFFFF\"", Spec.ECMA_262); parse("\"\uFFFF\"", Spec.ECMA_262); parse("\"\uD853a\"", Spec.ECMA_262); parse("\"\\n\"", Spec.ECMA_262); parse("\"\\b\\f\\t\\r\\n\"", Spec.ECMA_262); unescape("\"\\b\\f\\t\\r\\n\"", "\"\\\\b\\\\f\\\\t\\\\r\\\\n\""); parse("\"\\u0000\\u001F\"", Spec.ECMA_262); parse("\"\\\"\\\\\"", Spec.ECMA_262); parse("\"\\u000a\"", "\"\\n\"", Spec.ECMA_262); parse("\"\\u000A\"", "\"\\n\"", Spec.ECMA_262); parse("\"\n\"", "\"\\n\"", Spec.LIBERAL); unescape("\"\\uD853\\uDF5C\"", "\"\\\\uD853\\\\uDF5C\""); unescape("\"\\uD853asdf\"", "\"\\\\uD853asdf\""); unescape("\"\\uD853\"", "\"\\\\uD853\""); unescape("\"\uD853\\t\"", "\"\uD853\\\\t\""); unescape("\"\uD853\\uD853\\t\"", "\"\uD853\\\\uD853\\\\t\""); error("\"\\u0A", Spec.ECMA_262); error("\"\\uXX0A\"", Spec.ECMA_262); error("\"\\u0 00\"", Spec.ECMA_262); error("\"\\u0:00\"", Spec.ECMA_262); error("\"\\u0_00\"", Spec.ECMA_262); error("\"\\u0~00\"", Spec.ECMA_262); error("\"test", Spec.ECMA_262); error("\"\uD800", Spec.ECMA_262); error("\"\n\"", Spec.ECMA_262); } /** * Tests for parsing arrays. * @throws QueryException query exception */ @Test public void arrayTest() throws QueryException { parse("[ ]", Spec.RFC4627); parse("[]", "[ ]", Spec.RFC4627); parse("[[[[[[42], {}]]]]]", "[ [ [ [ [ [ 42 ], { } ] ] ] ] ]", Spec.RFC4627); parse("[ 1, 2, 3, 4, 5, 6, 7, 8 ]", Spec.RFC4627); parse("[1,2,3,]", "[ 1, 2, 3 ]", Spec.LIBERAL); error("[1,2,3,]", Spec.RFC4627); error("[,42]", Spec.RFC4627); error("[1, ", Spec.RFC4627); } /** Tests for the restrictions in RFC 4627. */ @Test public void rfc4627() { error("\"test\"", Spec.RFC4627); error("123", Spec.RFC4627); error("true", Spec.RFC4627); error("null", Spec.RFC4627); } /** * Tests for parsing objects. * @throws QueryException query exception */ @Test public void objectTest() throws QueryException { parse("{ }", Spec.RFC4627); parse("{ \"\": 42 }", Spec.RFC4627); parse("{ a : 42, b: 23 }", "{ \"a\": 42, \"b\": 23 }", Spec.LIBERAL); parse("{ \"a\": 1, \"b\": 2, }", "{ \"a\": 1, \"b\": 2 }", Spec.LIBERAL); error("{ a : 42 }", Spec.RFC4627); error("{ \"a\": 42, b: 23 }", Spec.RFC4627); } /** * Tests for parsing literals. * @throws QueryException query exception */ @Test public void literals() throws QueryException { parse("true", Spec.ECMA_262); parse("false", Spec.ECMA_262); parse("null", Spec.ECMA_262); parse("true", Spec.LIBERAL); parse("false", Spec.LIBERAL); parse("null", Spec.LIBERAL); error("true123", Spec.LIBERAL); } /** * Tests for parsing constructors. * @throws QueryException query exception */ @Test public void constructorTest() throws QueryException { parse("new foo()", Spec.LIBERAL); parse("new Test(1, { })", Spec.LIBERAL); parse("new Foo([ { \"a\": new Test(1, { }) } ])", Spec.LIBERAL); error("new ", Spec.LIBERAL); error("newt", Spec.LIBERAL); } /** * Tests if the given JSON string is rejected by the parser using the given spec. * @param json JSON string * @param spec specification */ private void error(final String json, final Spec spec) { try { parse(json, spec); fail("Should have failed: '" + json + "'"); } catch(final QueryException qe) { // expected error } } /** * Checks if the given JSON string is correct and is reproduced by the parser. * @param json JSON string * @param spec specification * @throws QueryException parse error */ private void parse(final String json, final Spec spec) throws QueryException { parse(json, json, spec); } /** * Checks if the given JSON string is correct and produces the given output. * @param json JSON string * @param exp expected output * @param spec specification * @throws QueryException parse error */ private void parse(final String json, final String exp, final Spec spec) throws QueryException { tb.reset(); JsonStringConverter.print(json, spec, true, tb); assertEquals(exp, tb.toString()); } /** * Checks if the given JSON string is correct and produces the given output with the * {@code ECMA_262} spec and unescaping deactivated. * @param json JSON string * @param exp expected output * @throws QueryException parse error */ private void unescape(final String json, final String exp) throws QueryException { tb.reset(); JsonStringConverter.print(json, Spec.ECMA_262, false, tb); assertEquals(exp, tb.toString()); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/MainTest.java000066400000000000000000000025511222453003200246030ustar00rootroot00000000000000package org.basex.test; import static org.junit.Assert.*; import java.io.*; import org.basex.core.*; import org.basex.io.*; /** * Tests the command-line arguments of the starter classes. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class MainTest extends SandboxTest { /** Input file. */ static final IOFile INPUT = new IOFile(Prop.TMP + NAME + ".in"); /** * Runs a request with the specified arguments. * @param args command-line arguments * @return result * @throws IOException I/O exception */ protected abstract String run(final String... args) throws IOException; /** * Runs a request and compares the result with the expected result. * @param exp expected result * @param args command-line arguments * @throws IOException I/O exception */ final void equals(final String exp, final String... args) throws IOException { assertEquals(exp, run(args)); } /** * Runs a request and checks if the expected string is contained in the * result. * @param exp expected result * @param args command-line arguments * @throws IOException I/O exception */ final void contains(final String exp, final String... args) throws IOException { final String result = run(args); if(!result.contains(exp)) fail('\'' + exp + "' not contained in '" + result + "'."); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/SandboxTest.java000066400000000000000000000110421222453003200253100ustar00rootroot00000000000000package org.basex.test; import static org.basex.core.Text.*; import static org.junit.Assert.*; import java.io.*; import java.util.concurrent.*; import org.basex.*; import org.basex.core.*; import org.basex.io.*; import org.basex.io.out.*; import org.basex.server.*; import org.basex.util.*; import org.basex.util.list.*; import org.junit.*; /** * If this class is extended, tests will be run in a sandbox. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class SandboxTest { /** Default output stream. */ public static final PrintStream OUT = System.out; /** Default error stream. */ public static final PrintStream ERR = System.err; /** Null output stream. */ public static final PrintStream NULL = new PrintStream(new NullOutput()); /** Test name. */ public static final String NAME = Util.name(SandboxTest.class); /** Database context. */ protected static Context context; /** Clean up files. */ protected static boolean cleanup; /** * Creates the sandbox. */ @BeforeClass public static void createContext() { final IOFile sb = sandbox(); sb.delete(); assertTrue("Sandbox could not be created.", sb.md()); context = new Context(); initContext(context); cleanup = true; } /** * Initializes the specified context. * @param ctx context */ protected static void initContext(final Context ctx) { final IOFile sb = sandbox(); ctx.mprop.set(MainProp.DBPATH, sb.path() + "/data"); ctx.mprop.set(MainProp.WEBPATH, sb.path() + "/webapp"); ctx.mprop.set(MainProp.RESTXQPATH, sb.path() + "/webapp"); ctx.mprop.set(MainProp.REPOPATH, sb.path() + "/repo"); } /** * Removes test databases and closes the database context. */ @AfterClass public static void closeContext() { if(cleanup) { context.close(); assertTrue("Sandbox could not be deleted.", sandbox().delete()); } } /** * Creates a new, sandboxed server instance. * @param args additional arguments * @return server instance * @throws IOException I/O exception */ protected static BaseXServer createServer(final String... args) throws IOException { try { System.setOut(NULL); final StringList sl = new StringList().add("-z").add("-p9999").add("-e9998"); for(final String a : args) sl.add(a); final BaseXServer server = new BaseXServer(sl.toArray()); server.context.mprop.set(MainProp.DBPATH, sandbox().path()); return server; } finally { System.setOut(OUT); } } /** * Stops a server instance. * @param server server * @throws IOException I/O exception */ protected static void stopServer(final BaseXServer server) throws IOException { try { System.setOut(NULL); if(server != null) server.stop(); } finally { System.setOut(OUT); } } /** * Creates a client instance. * @param login optional login data * @return client instance * @throws IOException I/O exception */ public static ClientSession createClient(final String... login) throws IOException { final String user = login.length > 0 ? login[0] : ADMIN; final String pass = login.length > 1 ? login[1] : ADMIN; return new ClientSession(LOCALHOST, 9999, user, pass); } /** * Returns the sandbox database path. * @return database path */ protected static IOFile sandbox() { return new IOFile(Prop.TMP, NAME); } /** Client. */ public static final class Client extends Thread { /** Start signal. */ private final CountDownLatch startSignal; /** Stop signal. */ private final CountDownLatch stopSignal; /** Client session. */ private final ClientSession session; /** Command string. */ private final Command cmd; /** Fail flag. */ public String error; /** * Client constructor. * @param c command string to execute * @param start start signal * @param stop stop signal * @throws IOException I/O exception while establishing the session */ public Client(final Command c, final CountDownLatch start, final CountDownLatch stop) throws IOException { session = createClient(); cmd = c; startSignal = start; stopSignal = stop; start(); } @Override public void run() { try { if(null != startSignal) startSignal.await(); session.execute(cmd); session.close(); } catch(final Throwable ex) { error = "\n" + cmd + "\n" + ex; } finally { if(null != stopSignal) stopSignal.countDown(); } } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/build/000077500000000000000000000000001222453003200233105ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/java/org/basex/test/build/AddDeleteTest.java000066400000000000000000000156331222453003200266360ustar00rootroot00000000000000package org.basex.test.build; import static org.junit.Assert.*; import java.io.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.io.*; import org.basex.test.*; import org.basex.util.*; import org.junit.*; /** * Tests adding files/folders/zip files/urls to collections. * * @author BaseX Team 2005-12, BSD License * @author Michael Seiferle */ public final class AddDeleteTest extends SandboxTest { /** Test file. */ private static final String DIR = "src/test/resources/"; /** Test file. */ private static final String FILE = DIR + "input.xml"; /** Test file. */ private static final String CORRUPT = DIR + "corrupt.xml"; /** Test folder. */ private static final String FLDR = DIR + "dir"; /** Test ZIP file. */ private static final String ZIPFILE = DIR + "xml.zip"; /** Test GZIP file. */ private static final String GZIPFILE = DIR + "xml.gz"; /** Test XML fragment. */ private static final String XMLFRAG = ""; /** Temporary XML file. */ private static final String TEMP = NAME + IO.XMLSUFFIX; /** Number of XML files for folder. */ private static final int NFLDR; static { int fc = 0; for(final IOFile c : new IOFile(FLDR).children()) { if(c.name().endsWith(IO.XMLSUFFIX)) ++fc; } NFLDR = fc; } /** * Creates a database. * @throws BaseXException exception */ @Before public void setUp() throws BaseXException { new CreateDB(NAME).execute(context); } /** * Drops the database. * @throws BaseXException exception */ @After public void tearDown() throws BaseXException { new DropDB(NAME).execute(context); } /** *

Adds an XML fragment to the database.

    *
  1. with name and w/o target
  2. *
  3. with name and target set
  4. *
  5. w/o name and target set
* @throws BaseXException database exception */ @Test public void addXMLString() throws BaseXException { new Add("index.xml", XMLFRAG).execute(context); assertEquals(1, docs()); new Add("a/b/c/index2.xml", XMLFRAG).execute(context); assertEquals(2, docs()); new Add("a/d/c", XMLFRAG).execute(context); assertEquals(3, docs()); } /** * Adds a single file to the database. * @throws BaseXException exception */ @Test public void addFile() throws BaseXException { new Add(null, FILE).execute(context); assertEquals(1, docs()); } /** * Adds a zip file. * @throws BaseXException exception */ @Test public void addZip() throws BaseXException { new Add("target", ZIPFILE).execute(context); assertEquals(4, docs()); // do not add archives new Set(Prop.ADDARCHIVES, false).execute(context); new Add("", ZIPFILE).execute(context); assertEquals(4, docs()); new Set(Prop.ADDARCHIVES, true).execute(context); } /** * Adds/deletes a GZIP file. * @throws BaseXException exception */ @Test public void addGzip() throws BaseXException { new Add("", GZIPFILE).execute(context); new Add("bar", GZIPFILE).execute(context); new Delete("bar").execute(context); assertEquals(1, docs()); } /** * Adds a folder. The contained a zip file is added as well. * @throws BaseXException exception */ @Test public void addFolder() throws BaseXException { new Add("", FLDR).execute(context); assertEquals(NFLDR, docs()); } /** * Adds/deletes with target. * @throws BaseXException exception */ @Test public void deletePath() throws BaseXException { new Add("foo/pub", FLDR).execute(context); assertEquals(NFLDR, docs()); new Delete("foo").execute(context); assertEquals(0, docs()); new Add("/foo///bar////", FILE).execute(context); new Add("foobar", FLDR).execute(context); new Delete("foo").execute(context); assertEquals(NFLDR, docs()); } /** * Adds/deletes a file/folder. * @throws BaseXException exception */ @Test public void addFoldersDeleteFiles() throws BaseXException { new Add("folder", FLDR).execute(context); new Add("", FILE).execute(context); new Delete("input.xml").execute(context); new Delete("folder/input.xml").execute(context); assertEquals(NFLDR - 1, docs()); } /** * Adds/deletes with target. * @throws BaseXException exception */ @Test public void createDeleteAdd() throws BaseXException { new CreateDB(NAME, "").execute(context); new Delete("/").execute(context); assertEquals(0, docs()); final StringBuilder sb = new StringBuilder(); for(int i = 0; i < 256; i++) sb.append(""); new Add("x", "" + sb + "").execute(context); assertEquals(1, docs()); assertEquals("1", new XQuery("count(//x)").execute(context)); assertEquals("0", new XQuery("count(//a)").execute(context)); } /** * Adds a non-existent file. * @throws BaseXException expected. */ @Test(expected = BaseXException.class) public void addFileFail() throws BaseXException { new Add("", FILE + "/doesnotexist").execute(context); } /** * Adds a broken input file to the database and checks if the file can be * deleted afterwards. * @throws Exception exception */ @Test public void addCorrupt() throws Exception { final IOFile io = new IOFile(TEMP); io.write(Token.token(" files = new HashSet(); final Session session = new LocalSession(context); try { final Query q = session.query(Function._DB_LIST.args(NAME)); while(q.more()) files.add(q.next()); q.close(); } finally { session.close(); } assertFalse("No files were imported", files.isEmpty()); for(final File f : FILES) { final String fname = f.getName(); assertTrue("File " + fname + " is not imported", files.contains(fname)); } assertEquals("Expected number of imported files is different", FILES.length, files.size()); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/build/CSVTest.java000066400000000000000000000063131222453003200254510ustar00rootroot00000000000000package org.basex.test.build; import static org.basex.util.Token.*; import static org.junit.Assert.*; import java.io.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.io.*; import org.basex.test.*; import org.junit.*; /** * CSV Parser Test. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class CSVTest extends SandboxTest { /** Test CSV file. */ private static final String FILE = "src/test/resources/input.csv"; /** Temporary CSV file. */ private static final String TEMP = Prop.TMP + NAME + IO.CSVSUFFIX; /** * Creates the initial database. * @throws BaseXException exception */ @BeforeClass public static void before() throws BaseXException { new Set(Prop.PARSER, "csv").execute(context); } /** * Removes the temporary CSV file. */ @AfterClass public static void after() { new IOFile(TEMP).delete(); } /** * Sets initial options. * @throws BaseXException exception */ @Before public void init() throws BaseXException { new Set(Prop.PARSEROPT, "header=true").execute(context); } /** * Drops the database. * @throws BaseXException exception */ @After public void finish() throws BaseXException { new DropDB(NAME).execute(context); } /** * Adds an empty CSV file. * @throws Exception exception */ @Test public void empty() throws Exception { write(""); new CreateDB(NAME, TEMP).execute(context); assertEquals("", new XQuery(".").execute(context)); } /** * Adds the sample CSV file. * @throws Exception exception */ @Test public void one() throws Exception { new CreateDB(NAME, FILE).execute(context); assertEquals("3", new XQuery("count(//Name)").execute(context)); assertEquals("2", new XQuery("count(//Email)").execute(context)); new Set(Prop.PARSEROPT, "header=true").execute(context); new CreateDB(NAME, FILE).execute(context); assertEquals("3", new XQuery("count(//record)").execute(context)); } /** * Adds the sample CSV file, using the simple XML format. * @throws Exception exception */ @Test public void simple() throws Exception { new Set(Prop.PARSEROPT, "header=true").execute(context); new CreateDB(NAME, FILE).execute(context); assertEquals("3", new XQuery("count(//record)").execute(context)); } /** * Adds the sample CSV file, using different separators. * @throws Exception exception */ @Test public void sep() throws Exception { new Set(Prop.PARSEROPT, "separator=tab,header=true").execute(context); new CreateDB(NAME, FILE).execute(context); assertEquals("0", new XQuery("count(//Name)").execute(context)); new Set(Prop.PARSEROPT, "separator=9,header=true").execute(context); new CreateDB(NAME, FILE).execute(context); assertEquals("0", new XQuery("count(//Name)").execute(context)); } /** * Writes the specified test file. * @param data data to write * @throws IOException I/O exception */ private static void write(final String data) throws IOException { new IOFile(TEMP).write(token(data)); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/build/CollectionPathTest.java000066400000000000000000000045141222453003200277270ustar00rootroot00000000000000package org.basex.test.build; import static org.junit.Assert.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.query.*; import org.basex.test.*; import org.junit.*; /** * Tests queries on collections. * * @author BaseX Team 2005-12, BSD License * @author Michael Seiferle */ public final class CollectionPathTest extends SandboxTest { /** Test files directory. */ private static final String DIR = "src/test/resources/"; /** Test files. */ private static final String[] FILES = { DIR + "input.xml", DIR + "xmark.xml", DIR + "test.xml" }; /** Test ZIP. */ private static final String ZIP = DIR + "xml.zip"; /** * Creates an initial database. * @throws BaseXException exception */ @BeforeClass public static void before() throws BaseXException { new CreateDB(NAME).execute(context); for(final String file : FILES) { new Add(DIR, file).execute(context); } new Add("test/zipped", ZIP).execute(context); } /** * Drops the initial collection. * @throws BaseXException exception */ @AfterClass public static void after() throws BaseXException { new DropDB(NAME).execute(context); } /** * Finds single doc. * @throws Exception exception */ @Test public void findDoc() throws Exception { final String find = "for $x in collection('" + NAME + '/' + DIR + "xmark.xml') " + "where $x//location contains text 'uzbekistan' " + "return $x"; final QueryProcessor qp = new QueryProcessor(find, context); assertEquals(1, qp.execute().size()); qp.close(); } /** * Finds documents in path. * @throws Exception exception */ @Test public void findDocs() throws Exception { final String find = "collection('" + NAME + "/test/zipped') "; final QueryProcessor qp = new QueryProcessor(find, context); assertEquals(4, qp.execute().size()); qp.close(); } /** * Checks if the constructed base-uri matches the base-uri of added documents. * @throws Exception exception */ @Test public void baseUri() throws Exception { final String find = "for $x in collection('" + NAME + '/' + DIR + "xmark.xml') " + "return base-uri($x)"; final QueryProcessor qp = new QueryProcessor(find, context); assertEquals(NAME + '/' + FILES[1], qp.iter().next().toJava()); qp.close(); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/build/CreateTest.java000066400000000000000000000105151222453003200262200ustar00rootroot00000000000000package org.basex.test.build; import static org.junit.Assert.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.io.*; import org.basex.test.*; import org.basex.util.*; import org.junit.*; /** * Tests for creating databases and adding documents. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class CreateTest extends SandboxTest { /** Test document name. */ private static final String DOCNAME = "t.xml"; /** Target. */ private static final String TARGET = "target/"; /** Path to test file. */ private static final String PATH = "src/test/resources/input.xml"; /** Test folder. */ private static final String FOLDER = "src/test/resources/dir"; /** Test XML fragment. */ private static final String FRAG = ""; /** First document in test folder. */ private static final String FOLDERFILE; // finds the first document in the xml folder static { String file = ""; for(final IOFile c : new IOFile(FOLDER).children()) { file = c.name(); if(file.endsWith(IO.XMLSUFFIX)) break; } FOLDERFILE = file; } /** Test inputs (path, folder, fragment). */ private static final String[] INPUTS = { PATH, FOLDER, FRAG }; /** Names of test inputs (path, folder, fragment). */ private static final String[] NAMES = { PATH.replaceAll(".*/", ""), FOLDERFILE, NAME + IO.XMLSUFFIX }; /** * Drops the initial collection. * @throws BaseXException exception */ @After public void tearDown() throws BaseXException { new DropDB(NAME).execute(context); } /** * CREATE DB {DB}. * @throws BaseXException exception */ @Test public void createDB() throws BaseXException { new CreateDB(NAME).execute(context); // check if database name equals argument of create command assertEquals(db(), NAME); } /** * CREATE DB {DB} {INPUT[]}. * @throws BaseXException exception */ @Test public void createDBWithInput() throws BaseXException { for(int i = 0; i < INPUTS.length; ++i) { new CreateDB(NAME, INPUTS[i]).execute(context); // check name of database assertEquals(NAME, db()); // check name of document assertEquals(NAMES[i], docName()); } } /** * CREATE DB {DB}; ADD {INPUT[]}. * @throws BaseXException exception */ @Test public void createDBandAdd() throws BaseXException { // add file and folder, skip fragment for(int i = 0; i < INPUTS.length - 1; i++) { new CreateDB(NAME).execute(context); new Add("", INPUTS[i]).execute(context); assertEquals(NAMES[i], docName()); } } /** * CREATE DB {DB}; ADD TO {DOCNAME} {INPUT[]}. * @throws BaseXException exception */ @Test public void createDBandAddToName() throws BaseXException { // add file and fragment, skip folder for(int i = 0; i < INPUTS.length; i += 2) { new CreateDB(NAME).execute(context); new Add(DOCNAME, INPUTS[i]).execute(context); assertEquals(DOCNAME, docName()); } } /** * CREATE DB {DB}; ADD TO {TARGET} {INPUT[]}. * @throws BaseXException exception */ @Test public void createDBandAddToTarget() throws BaseXException { // add file and folder, skip fragment for(int i = 0; i < INPUTS.length - 1; i++) { new CreateDB(NAME).execute(context); new Add(TARGET, INPUTS[i]).execute(context); assertEquals(TARGET + NAMES[i], docName()); } } /** * CREATE DB {DB}; ADD TO {TARGET/DOCNAME} {INPUT[]}. * @throws BaseXException exception */ @Test public void createDBandAddToTargetName() throws BaseXException { // add file and fragment, skip folder for(int i = 0; i < INPUTS.length; i += 2) { new CreateDB(NAME).execute(context); new Add(TARGET + DOCNAME, INPUTS[i]).execute(context); assertEquals(TARGET + DOCNAME, docName()); } } /** * Returns the name of the database. * @return database name */ private static String db() { return context.data().meta.name; } /** * Returns the name of the first document in the database. * @return first document name */ private static String docName() { return Token.string(context.data().text(context.current().pres[0], true)); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/build/PathTest.java000066400000000000000000000102441222453003200257100ustar00rootroot00000000000000package org.basex.test.build; import static org.junit.Assert.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.query.*; import org.basex.test.*; import org.basex.util.*; import org.junit.*; /** * Tests queries with path in it on collections. * * @author BaseX Team 2005-12, BSD License * @author Andreas Weiler */ public final class PathTest extends SandboxTest { /** Test database name. */ private static final String INPUT = Util.name(PathTest.class); /** Test database name. */ private static final String WEEK1 = Util.name(PathTest.class) + '2'; /** Test database name. */ private static final String WEEK2 = Util.name(PathTest.class) + '3'; /** Test file. */ private static final String INPUTF = "src/test/resources/input.xml"; /** Test file. */ private static final String WEEK = "src/test/resources/week.zip"; /** * Creates initial databases. * @throws BaseXException exception */ @BeforeClass public static void before() throws BaseXException { new CreateDB(INPUT).execute(context); new Add("input", INPUTF).execute(context); new Add("input2", INPUTF).execute(context); new CreateDB(WEEK1, WEEK).execute(context); new CreateDB(WEEK2, WEEK).execute(context); new Close().execute(context); } /** * Drops the initial databases. * @throws BaseXException exception */ @AfterClass public static void after() throws BaseXException { new DropDB(INPUT).execute(context); new DropDB(WEEK1).execute(context); new DropDB(WEEK2).execute(context); } /** * Checks the number of documents under the specified path. * @throws Exception exception */ @Test public void documentTestInput() throws Exception { final String count = "count(collection('" + INPUT + "/input'))"; final QueryProcessor qp = new QueryProcessor(count, context); assertEquals(1, Integer.parseInt(qp.execute().toString())); qp.close(); } /** * Checks the number of documents under the specified path. * @throws Exception exception */ @Test public void documentTestWeek() throws Exception { final String count = "count(collection('" + WEEK1 + "/week/monday'))"; final QueryProcessor qp = new QueryProcessor(count, context); assertEquals(3, Integer.parseInt(qp.execute().toString())); qp.close(); } /** * Checks the results of the query with index access. * @throws Exception exception */ @Test public void withIndexTest() throws Exception { weekTest(); weekTest2(); } /** * Checks the results of the query without index access. * @throws Exception exception */ @Test public void withoutIndexTest() throws Exception { new Open(WEEK1).execute(context); new DropIndex("text").execute(context); new Open(WEEK2).execute(context); new DropIndex("text").execute(context); weekTest(); weekTest2(); } /** Checks the results of the queries with the db week. * @throws Exception exception */ static void weekTest() throws Exception { final String count = "count(collection('" + WEEK1 + "/week/monday')/root/monday/text[text() = 'text'])"; final QueryProcessor qp = new QueryProcessor(count, context); assertEquals(3, Integer.parseInt(qp.execute().toString())); qp.close(); // cross-check final String count2 = "count(collection('" + WEEK1 + "/week')/root/monday/text[text() = 'text'])"; final QueryProcessor qp2 = new QueryProcessor(count2, context); assertEquals(4, Integer.parseInt(qp2.execute().toString())); qp2.close(); } /** Checks the results of the queries with the db week. * @throws Exception exception */ static void weekTest2() throws Exception { final String count = "count(collection('" + WEEK1 + "/week/monday')/root/monday/text[text() = 'text'])," + " count(collection('" + WEEK2 + "/week/tuesday')/root/monday/text[text() = 'text']) "; final QueryProcessor qp = new QueryProcessor(count, context); final String result = qp.execute().toString(); assertEquals("3 1", result); qp.close(); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/build/XMLParserTest.java000066400000000000000000000064221222453003200266340ustar00rootroot00000000000000package org.basex.test.build; import static org.junit.Assert.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.test.*; import org.junit.*; /** * Tests for parsing XML documents. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class XMLParserTest extends SandboxTest { /** * Prepares the tests. */ @Before public void before() { context.prop.set(Prop.MAINMEM, true); } /** * Finishes the tests. */ @Before public void after() { context.prop.set(Prop.MAINMEM, false); context.prop.set(Prop.CHOP, true); context.prop.set(Prop.STRIPNS, false); context.prop.set(Prop.SERIALIZER, ""); context.prop.set(Prop.INTPARSE, true); } /** * Tests the internal parser (Option {@link Prop#INTPARSE}). */ @Test public void intParse() { context.prop.set(Prop.CHOP, false); final StringBuilder sb = new StringBuilder(); final String[] docs = { "", " ", "", "A", "", "", "", "", "", "", "x", "x", "", }; for(final String doc : docs) { // parse document with default parser (expected to yield correct result) context.prop.set(Prop.INTPARSE, false); boolean def = true; try { new CreateDB(NAME, doc).execute(context); } catch(final BaseXException ex) { def = false; } // parse document with internal parser context.prop.set(Prop.INTPARSE, true); boolean cust = true; try { new CreateDB(NAME, doc).execute(context); } catch(final BaseXException ex) { cust = false; } // compare results if(def != cust) { sb.append("\n").append(def ? "- not accepted: " : "- not rejected: ").append(doc); } } // list all errors if(sb.length() != 0) fail(sb.toString()); context.prop.set(Prop.MAINMEM, false); } /** * Tests the namespace stripping option (Option {@link Prop#STRIPNS}). * @throws Exception exceptions */ @Test public void parse() throws Exception { context.prop.set(Prop.STRIPNS, true); context.prop.set(Prop.SERIALIZER, "indent=no"); final String doc = ""; for(final boolean b : new boolean[] { false, true }) { context.prop.set(Prop.INTPARSE, b); new CreateDB(NAME, doc).execute(context); String result = new XQuery(".").execute(context); assertEquals("", result); result = new XQuery("e/f").execute(context); assertEquals("", result); } } /** * Tests the xml:space attribute. * @throws Exception exceptions */ @Test public void xmlSpace() throws Exception { context.prop.set(Prop.SERIALIZER, "indent=no"); final String in = " " + " "; final String out = "" + " "; for(final boolean b : new boolean[] { true, false }) { context.prop.set(Prop.INTPARSE, b); new CreateDB(NAME, in).execute(context); final String result = new XQuery(".").execute(context); assertEquals("Internal parser: " + b, out, result); } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/core/000077500000000000000000000000001222453003200231415ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/java/org/basex/test/core/CommandLockingTest.java000066400000000000000000000414541222453003200275410ustar00rootroot00000000000000package org.basex.test.core; import static org.junit.Assert.*; import org.basex.index.*; import org.basex.core.*; import org.basex.core.LockResult; import org.basex.core.cmd.*; import org.basex.test.*; import org.basex.util.list.*; import org.junit.*; /** * This class tests commands and XQueries for correct identification of databases * to lock. * * @author BaseX Team 2005-12, BSD License * @author Jens Erat */ public class CommandLockingTest extends SandboxTest { /** Static dummy context so we do not have to create a new one every time. */ private static final Context DUMMY_CONTEXT = new Context(); /** Test file name. */ private static final String FN = "hello.xq"; /** Test folder. */ private static final String FLDR = "src/test/resources"; /** Test file. */ private static final String FILE = FLDR + '/' + FN; /** Test name. */ private static final String NAME2 = NAME + '2'; /** Test repository. **/ private static final String REPO = "src/test/resources/repo/"; /** Empty StringList. */ private static final StringList NONE = new StringList(0); /** StringList containing name. */ private static final StringList NAME_LIST = new StringList(NAME); /** StringList containing context. */ private static final StringList CTX_LIST = new StringList(DBLocking.CTX); /** StringList containing collection. */ private static final StringList COLL_LIST = new StringList(DBLocking.COLL); /** StringList containing name and context. */ private static final StringList NAME_CTX = new StringList(NAME, DBLocking.CTX); /** StringList containing ADMIN lock string. */ private static final StringList ADMIN_LIST = new StringList(DBLocking.ADMIN); /** StringList containing ADMIN lock string and name. */ private static final StringList ADMIN_NAME = new StringList(DBLocking.ADMIN, NAME); /** StringList containing REPO lock string. */ private static final StringList REPO_LIST = new StringList(DBLocking.REPO); /** StringList containing BACKUP lock string. */ private static final StringList BACKUP_LIST = new StringList(DBLocking.BACKUP); /** StringList containing BACKUP lock string and name. */ private static final StringList BACKUP_NAME = new StringList(DBLocking.BACKUP, NAME); /** StringList containing EVENT lock string. */ private static final StringList EVENT_LIST = new StringList(DBLocking.EVENT); /** * Test commands affecting databases. */ @Test public final void databaseCommands() { ckDBs(new Add(FILE), true, CTX_LIST); ckDBs(new AlterDB(NAME, NAME2), true, new StringList(NAME, NAME2)); ckDBs(new AlterUser(NAME, NAME), true, ADMIN_LIST); ckDBs(new Check(NAME), false, NAME_CTX); ckDBs(new Close(), false, CTX_LIST); ckDBs(new Copy(NAME2, NAME), new StringList(NAME2), NAME_LIST); ckDBs(new CreateBackup(NAME), NAME_LIST, BACKUP_LIST); ckDBs(new CreateDB(NAME), CTX_LIST, NAME_LIST); ckDBs(new CreateEvent(NAME), true, EVENT_LIST); ckDBs(new CreateIndex(IndexType.TEXT), true, CTX_LIST); ckDBs(new CreateUser(NAME, NAME), true, ADMIN_LIST); ckDBs(new Delete(FILE), true, CTX_LIST); ckDBs(new DropBackup(NAME), true, BACKUP_LIST); ckDBs(new DropDB(NAME + "*"), true, null); // Drop using globbing ckDBs(new DropDB(NAME), true, NAME_LIST); ckDBs(new DropEvent(NAME), true, EVENT_LIST); ckDBs(new DropIndex(IndexType.TEXT), true, CTX_LIST); ckDBs(new DropUser(NAME), true, ADMIN_LIST); ckDBs(new Execute("RUN " + FILE), true, null); ckDBs(new Export(FILE), false, CTX_LIST); ckDBs(new Find("token"), false, CTX_LIST); ckDBs(new Flush(), true, CTX_LIST); ckDBs(new Get("DBPATH"), false, NONE); ckDBs(new Grant("all", NAME), true, ADMIN_LIST); ckDBs(new Grant("all", NAME, NAME), true, ADMIN_NAME); ckDBs(new Grant("all", NAME, NAME + "*"), true, null); ckDBs(new Help("HELP"), false, NONE); ckDBs(new Info(), false, NONE); ckDBs(new InfoDB(), false, CTX_LIST); ckDBs(new InfoIndex(), false, CTX_LIST); ckDBs(new InfoStorage(), false, CTX_LIST); ckDBs(new Inspect(), false, CTX_LIST); ckDBs(new Kill(NAME), true, ADMIN_LIST); ckDBs(new List(NAME), false, null); ckDBs(new Open(NAME), false, NAME_CTX); ckDBs(new Optimize(), true, CTX_LIST); ckDBs(new OptimizeAll(), true, CTX_LIST); ckDBs(new Password(NAME), true, ADMIN_LIST); ckDBs(new Rename(FILE, FILE), true, CTX_LIST); ckDBs(new Replace(FILE, FILE), true, CTX_LIST); ckDBs(new RepoInstall(REPO + "/pkg3.xar", null), true, REPO_LIST); ckDBs(new RepoList(), false, REPO_LIST); ckDBs(new RepoDelete("http://www.pkg3.com", null), true, REPO_LIST); ckDBs(new Restore(NAME), true, BACKUP_NAME); ckDBs(new Retrieve(FILE), false, CTX_LIST); ckDBs(new Run(FILE), true, null); ckDBs(new Set(NAME, NAME), false, NONE); ckDBs(new ShowBackups(), false, BACKUP_LIST); ckDBs(new ShowEvents(), false, EVENT_LIST); ckDBs(new ShowSessions(), false, NONE); ckDBs(new ShowUsers(), false, ADMIN_LIST); ckDBs(new ShowUsers(NAME), false, ADMIN_NAME); ckDBs(new Store(FILE), true, CTX_LIST); } /** Tests locked databases in XQuery queries. */ @Test public void xquery() { // Basic document access ckDBs(new XQuery("collection('" + NAME + "')"), false, NAME_LIST); ckDBs(new XQuery("collection()"), false, COLL_LIST); // fn:collection() always accesses the global context, no matter what local context is ckDBs(new XQuery("/count(collection())"), false, COLL_LIST); ckDBs(new XQuery("doc('" + NAME + "')"), false, NAME_LIST); ckDBs(new XQuery("doc-available('" + NAME + "/foo.xml')"), false, NAME_LIST, null); ckDBs(new XQuery("parse-xml('')"), true, NONE); ckDBs(new XQuery("parse-xml-fragment('')"), true, NONE); ckDBs(new XQuery("put(, '" + NAME + "')"), true, NONE); ckDBs(new XQuery("put(., '" + NAME + "')"), true, CTX_LIST); ckDBs(new XQuery("root()"), false, CTX_LIST); ckDBs(new XQuery("root(.)"), false, CTX_LIST); ckDBs(new XQuery("root(./test)"), false, CTX_LIST); ckDBs(new XQuery("serialize('')"), true, NONE); ckDBs(new XQuery("unparsed-text('" + FILE + "')"), false, NONE); ckDBs(new XQuery("unparsed-text-available('" + FILE + "')"), false, NONE); ckDBs(new XQuery("unparsed-text-lines('" + FILE + "')"), false, NONE); ckDBs(new XQuery("uri-collection('" + NAME + "')"), false, NAME_LIST); ckDBs(new XQuery("uri-collection()"), false, COLL_LIST); // Accessor and node functions for(final String fn : new String[] { "data", "string", "number", "string-length", "normalize-space", "document-uri", "nilled", "node-name", "local-name", "name", "namespace-uri", "root", "base-uri", "generate-id", "has-children", "path"}) { ckDBs(new XQuery(fn + "()"), false, CTX_LIST); ckDBs(new XQuery("doc('" + NAME + "')/" + fn + "()"), false, NAME_LIST, NAME_CTX); } for(final String fn : new String[] { "data", "string", "number", "string-length", "normalize-space", "document-uri", "nilled", "node-name", "local-name", "name", "namespace-uri", "root", "base-uri", "generate-id", "has-children", "path"}) { ckDBs(new XQuery(fn + "(doc('" + NAME + "'))"), false, NAME_LIST); } // Others ckDBs(new XQuery("."), false, CTX_LIST); ckDBs(new XQuery("error()"), false, NONE); ckDBs(new XQuery("error(xs:QName('foo'))"), false, NONE); ckDBs(new XQuery("error(xs:QName('foo'), 'bar')"), false, NONE); ckDBs(new XQuery("error(xs:QName('foo'), 'bar', )"), false, NONE); ckDBs(new XQuery("random:integer()"), false, NONE); // User defined functions ckDBs(new XQuery("declare function local:a($a) {" + "if($a = 0) then $a else local:a($a idiv 2) };" + "local:a(5)"), false, NONE); ckDBs(new XQuery("declare function local:a($a) {" + "if($a = 0) then collection() else local:a($a idiv 2) };" + "local:a(5)"), false, COLL_LIST); ckDBs(new XQuery("declare function local:a($a) {" + "if($a = 0) then doc('" + NAME + "') else local:a($a idiv 2) };" + "local:a(5)"), false, NAME_LIST); } /** Test admin module. */ @Test public void admin() { ckDBs(new XQuery("admin:users()"), false, ADMIN_LIST); ckDBs(new XQuery("admin:users('" + NAME + "')"), false, ADMIN_NAME); ckDBs(new XQuery("admin:sessions()"), false, ADMIN_LIST); ckDBs(new XQuery("admin:logs()"), false, NONE); } /** Test database module. */ @Test public void db() { // General Functions ckDBs(new XQuery("db:info('" + NAME + "')"), false, NAME_LIST); ckDBs(new XQuery("db:list('" + NAME + "')"), false, NAME_LIST); ckDBs(new XQuery("db:list()"), false, null); ckDBs(new XQuery("db:list-details('" + NAME + "')"), false, NAME_LIST); ckDBs(new XQuery("db:list-details()"), false, null); ckDBs(new XQuery("db:open('" + NAME + "')"), false, NAME_LIST); ckDBs(new XQuery("db:open-id('" + NAME + "', 0)"), false, NAME_LIST); ckDBs(new XQuery("db:open-pre('" + NAME + "', 0)"), false, NAME_LIST); ckDBs(new XQuery("db:system()"), false, NONE); // Read Operations ckDBs(new XQuery("db:attribute('" + NAME + "', 'foo')"), false, NAME_LIST); ckDBs(new XQuery("db:attribute-range('" + NAME + "', '23', '42')"), false, NAME_LIST); ckDBs(new XQuery("db:fulltext('" + NAME + "', 'foo')"), false, NAME_LIST); ckDBs(new XQuery("db:node-id(.)"), false, CTX_LIST); ckDBs(new XQuery("db:node-pre(.)"), false, CTX_LIST); ckDBs(new XQuery("db:retrieve('" + NAME + "', 'foo')"), false, NAME_LIST); ckDBs(new XQuery("db:text('" + NAME + "', 'foo')"), false, NAME_LIST); ckDBs(new XQuery("db:text-range('" + NAME + "', '23', '42')"), false, NAME_LIST); // Updates ckDBs(new XQuery("db:create('" + NAME + "')"), true, NAME_LIST); ckDBs(new XQuery("db:create('" + NAME + "', '" + FILE + "')"), true, NAME_LIST); ckDBs(new XQuery("db:create('" + NAME + "', '', '" + FILE + "')"), true, NAME_LIST); ckDBs(new XQuery("db:create('" + NAME + "', '" + FILE + "', '" + FILE + "')"), true, NAME_LIST); ckDBs(new XQuery("db:drop('" + NAME + "')"), true, NAME_LIST); ckDBs(new XQuery("db:add('" + NAME + "', '" + FILE + "')"), true, NAME_LIST); ckDBs(new XQuery("db:add('" + NAME + "', '', '" + FILE + "')"), true, NAME_LIST); ckDBs(new XQuery("db:add('" + NAME + "', '" + FILE + "', '" + FILE + "')"), true, NAME_LIST); ckDBs(new XQuery("db:delete('" + NAME + "', '" + FILE + "')"), true, NAME_LIST); ckDBs(new XQuery("db:optimize('" + NAME + "')"), true, NAME_LIST); ckDBs(new XQuery("db:optimize('" + NAME + "', true())"), true, NAME_LIST); ckDBs(new XQuery("db:rename('" + NAME + "', '" + FILE + "', '" + FILE + "2')"), true, NAME_LIST); ckDBs(new XQuery("db:replace('" + NAME + "', '" + FILE + "', '" + FILE + "2')"), true, NAME_LIST); ckDBs(new XQuery("db:store('" + NAME + "', '" + FILE + "', 'foo')"), true, NAME_LIST); ckDBs(new XQuery("db:output('foo')"), true, NONE); ckDBs(new XQuery("db:flush('" + NAME + "')"), true, NAME_LIST); // Helper Functions ckDBs(new XQuery("db:exists('" + NAME + "')"), false, NAME_LIST); ckDBs(new XQuery("db:is-raw('" + NAME + "', '" + FILE + "')"), false, NAME_LIST); ckDBs(new XQuery("db:is-xml('" + NAME + "', '" + FILE + "')"), false, NAME_LIST); ckDBs(new XQuery("db:content-type('" + NAME + "', '" + FILE + "')"), false, NAME_LIST); ckDBs(new XQuery("db:event('foo', 'bar')"), false, NONE); ckDBs(new XQuery("db:event('foo', doc('" + NAME + "'))"), false, NAME_LIST); } /** Test ft module. */ @Test public void ft() { ckDBs(new XQuery("ft:search('" + NAME + "', 'foo')"), false, NAME_LIST); ckDBs(new XQuery("ft:tokens('" + NAME + "')"), false, NAME_LIST); ckDBs(new XQuery("ft:tokens('" + NAME + "', 'foo')"), false, NAME_LIST); ckDBs(new XQuery("ft:tokenize('foo')"), false, NONE); } /** Test index module. */ @Test public void index() { ckDBs(new XQuery("index:facets('" + NAME + "')"), false, NAME_LIST); ckDBs(new XQuery("index:texts('" + NAME + "')"), false, NAME_LIST); ckDBs(new XQuery("index:texts('" + NAME + "', 'foo')"), false, NAME_LIST); ckDBs(new XQuery("index:texts('" + NAME + "', 'foo', true())"), false, NAME_LIST); ckDBs(new XQuery("index:attributes('" + NAME + "')"), false, NAME_LIST); ckDBs(new XQuery("index:attributes('" + NAME + "', 'foo')"), false, NAME_LIST); ckDBs(new XQuery("index:attributes('" + NAME + "', 'foo', true())"), false, NAME_LIST); ckDBs(new XQuery("index:element-names('" + NAME + "')"), false, NAME_LIST); ckDBs(new XQuery("index:attribute-names('" + NAME + "')"), false, NAME_LIST); } /** Test repository module. */ @Test public void repository() { // ckDBs(new XQuery("repo:install('" + FILE + "')"), true, REPO_LIST); // ckDBs(new XQuery("repo:install('foo')"), true, REPO_LIST); ckDBs(new XQuery("repo:list()"), false, REPO_LIST); } /** Test XQuery module. */ @Test public void xqueryModule() { ckDBs(new XQuery("xquery:eval('1')"), false, null); ckDBs(new XQuery("xquery:eval('" + FILE + "')"), false, null); ckDBs(new XQuery("xquery:type(doc('" + NAME + "'))"), false, NAME_LIST); } /** * Test if the right databases are identified for locking. Required databases are exact, * no additional ones allowed. * * Pass empty string for currently opened database, {@code null} for all. * * @param cmd Command to test * @param up Updating command? * @param dbs Required and allowed databases */ private void ckDBs(final Command cmd, final boolean up, final StringList dbs) { ckDBs(cmd, up, dbs, dbs); } /** * Test if the right databases are identified for locking. Required databases are exact, * no additional ones allowed. * * Pass empty string for currently opened database, {@code null} for all. * * @param cmd Command to test * @param read Required and allowed databases for read lock * @param write Required and allowed databases for write lock */ private void ckDBs(final Command cmd, final StringList read, final StringList write) { ckDBs(cmd, read, read, write, write); } /** * Test if the right databases are identified for locking. * * Pass empty string for currently opened database, {@code null} for all. * * @param cmd Command to test * @param up Updating command? * @param req Required databases * @param allow Allowed databases */ private void ckDBs(final Command cmd, final boolean up, final StringList req, final StringList allow) { ckDBs(cmd, up ? NONE : req, up ? NONE : allow, up ? req : NONE, up ? allow : NONE); } /** * Test if the right databases are identified for locking. * * Pass empty string for currently opened database, {@code null} for all. * * @param cmd Command to test * @param reqRd Required databases for read locks * @param allowRd Allowed databases for read locks * @param reqWt Required databases for write locks * @param allowWt Allowed databases for write locks */ private void ckDBs(final Command cmd, final StringList reqRd, final StringList allowRd, final StringList reqWt, final StringList allowWt) { // Fetch databases BaseX thinks it needs to lock final LockResult lr = new LockResult(); // [CG] cmd.updating needed because of some side-effects (instantiate QueryProcessor?) cmd.updating(DUMMY_CONTEXT); cmd.databases(lr); // Need sorted lists for compareAll for (final StringList list : new StringList[] {reqRd, allowRd, reqWt, allowWt, lr.read, lr.write}) if (null != list) list.sort(false).unique(); // Test if read locking too much or less databases if(null == reqRd && !lr.readAll) fail("Should read lock all databases, didn't."); if(null != reqRd && null != allowRd && !lr.read.containsAll(reqRd)) fail("Didn't read lock all necessary databases."); if(null != allowRd && lr.readAll) fail("Read locked all databases, may not."); if(null != allowRd && !allowRd.containsAll(lr.read)) fail("Read locked more databases than I should."); // Test if write locking too much or less databases if(null == reqWt && !lr.writeAll) fail("Should write lock all databases, didn't."); if(null != reqWt && null != allowWt && !lr.write.containsAll(reqWt)) fail("Didn't write lock all necessary databases."); if(null != allowWt && lr.writeAll) fail("Write locked all databases, may not."); if(null != allowWt && !allowWt.containsAll(lr.write)) fail("Write locked more databases than I should."); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/core/CommandTest.java000066400000000000000000000365731222453003200262400ustar00rootroot00000000000000package org.basex.test.core; import static org.basex.util.Token.*; import static org.junit.Assert.*; import java.io.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.core.parse.Commands.*; import org.basex.data.*; import org.basex.io.*; import org.basex.server.*; import org.basex.test.*; import org.basex.util.*; import org.junit.*; /** * This class tests the database commands. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class CommandTest extends SandboxTest { /** Test file name. */ private static final String FN = "input.xml"; /** Test folder. */ private static final String FLDR = "src/test/resources"; /** Test file. */ private static final String FILE = FLDR + '/' + FN; /** Test name. */ static final String NAME2 = NAME + '2'; /** Socket reference. */ static Session session; /** Starts the server. * @throws IOException I/O exception */ @BeforeClass public static void start() throws IOException { session = new LocalSession(context); cleanUp(); } /** * Deletes the potentially already existing DBs. * DBs & User {@link #NAME} and {@link #NAME2} * @throws IOException I/O exception */ static void cleanUp() throws IOException { session.execute(new DropBackup(NAME)); session.execute(new DropBackup(NAME2)); session.execute(new DropDB(NAME)); session.execute(new DropDB(NAME2)); session.execute(new DropUser(NAME)); session.execute(new DropUser(NAME2)); } /** * Creates the database. * @throws IOException I/O exception */ @After public final void after() throws IOException { cleanUp(); } /** Command test. */ @Test public final void add() { // database must be opened to add files no(new Add("", FILE)); ok(new CreateDB(NAME)); ok(new Add(FN, FILE)); ok(new Add("target/" + FN, FILE)); ok(new Add("/", FILE)); } /** Command test. */ @Test public final void alterDB() { ok(new CreateDB(NAME)); ok(new AlterDB(NAME, NAME2)); ok(new Close()); no(new AlterDB(NAME, NAME2)); no(new AlterDB(NAME2, "?")); no(new AlterDB("?", NAME2)); } /** Command test. */ @Test public final void alterUser() { ok(new CreateUser(NAME2, md5(NAME2))); ok(new AlterUser(NAME2, md5("test"))); no(new AlterUser(":", md5(NAME2))); } /** Command test. */ @Test public final void close() { // close is successful, even if no database is opened ok(new Close()); ok(new CreateDB(NAME, FILE)); ok(new Close()); } /** Create Backup Test. * Using glob Syntax. */ @Test public final void createBackup() { no(new CreateBackup(NAME)); ok(new CreateDB(NAME)); ok(new CreateDB(NAME2)); ok(new CreateBackup(NAME)); ok(new Restore(NAME)); ok(new Close()); ok(new Restore(NAME)); ok(new CreateBackup(NAME)); ok(new Restore(NAME)); ok(new DropBackup(NAME)); ok(new CreateBackup(NAME + '*')); ok(new Restore(NAME2)); ok(new DropBackup(NAME + '*')); no(new Restore(":")); ok(new CreateBackup(NAME + "?," + NAME)); ok(new DropBackup(NAME2)); ok(new Restore(NAME)); no(new Restore(NAME + '?')); ok(new DropBackup(NAME)); } /** Command test. */ @Test public final void createDB() { ok(new CreateDB(NAME, FILE)); ok(new InfoDB()); ok(new CreateDB(NAME, FILE)); ok(new CreateDB("abcde")); ok(new DropDB("abcde")); // invalid database names no(new CreateDB("")); no(new CreateDB(" ")); no(new CreateDB(":")); no(new CreateDB("*?")); no(new CreateDB("/")); } /** Command test. */ @Test public final void createIndex() { no(new CreateIndex(null)); for(final CmdIndex cmd : CmdIndex.values()) no(new CreateIndex(cmd)); ok(new CreateDB(NAME, FILE)); for(final CmdIndex cmd : CmdIndex.values()) ok(new CreateIndex(cmd)); no(new CreateIndex("x")); } /** Command test. */ @Test public final void createUser() { ok(new CreateUser(NAME2, md5("test"))); no(new CreateUser(NAME2, md5("test"))); ok(new DropUser(NAME2)); no(new CreateUser("", "")); no(new CreateUser(":", "")); ok(new CreateUser(Databases.DBCHARS, md5(""))); ok(new DropUser(Databases.DBCHARS)); } /** Command test. */ @Test public final void cs() { no(new Cs("//li")); ok(new CreateDB(NAME, FILE)); ok(new Cs("// li")); ok(context.current(), 2); ok(new Cs(".")); ok(context.current(), 2); ok(new Cs("/")); ok(context.current(), 1); } /** Command test. */ @Test public final void delete() { // database must be opened to add and delete files no(new Delete(FILE)); ok(new CreateDB(NAME)); ok(new Delete(FILE)); ok(new Add("", FILE)); ok(new Delete(FILE)); // target need not exist ok(new Delete(FILE)); // delete binary file ok(new Store(FN, FILE)); ok(new Delete(FN)); ok(new Delete(FN)); } /** Command test. */ @Test public final void dropDB() { ok(new DropDB(NAME)); ok(new CreateDB(NAME, FILE)); ok(new DropDB(NAME2)); ok(new DropDB(NAME)); ok(new DropDB(NAME)); ok(new CreateDB(NAME)); ok(new CreateDB(NAME2)); ok(new DropDB(NAME + '*')); no(new Open(NAME2)); no(new DropDB(":")); no(new DropDB("")); ok(new CreateDB(NAME)); ok(new CreateDB(NAME2)); ok(new DropDB(NAME + ',' + NAME2)); no(new DropDB(NAME + ", " + ':')); } /** Command test. */ @Test public final void dropIndex() { for(final CmdIndex cmd : CmdIndex.values()) no(new DropIndex(cmd)); ok(new CreateDB(NAME, FILE)); for(final CmdIndex cmd : CmdIndex.values()) ok(new DropIndex(cmd)); no(new DropIndex("x")); } /** Command test. */ @Test public final void dropUser() { ok(new CreateUser(NAME, md5(NAME))); ok(new CreateUser(NAME2, md5(NAME))); ok(new DropUser(NAME)); ok(new DropUser(NAME2)); no(new DropUser("")); no(new DropUser(NAME2, ":")); ok(new CreateDB(NAME)); ok(new CreateUser(NAME, md5(NAME))); ok(new CreateUser(NAME2, md5(NAME))); ok(new DropUser(NAME2, NAME + '*')); ok(new DropUser(NAME + ',' + NAME2)); } /** Command test. */ @Test public final void export() { final IOFile io = new IOFile(FN); no(new Export(io.path())); ok(new CreateDB(NAME, FILE)); ok(new Export(".")); ok(io.exists()); ok(io.delete()); } /** Command test. */ @Test public final void find() { no(new Find("1")); ok(new CreateDB(NAME, FILE)); ok(new Find("1")); } /** Command test. */ @Test public final void flush() { no(new Flush()); ok(new CreateDB(NAME)); ok(new Flush()); ok(new Close()); no(new Flush()); } /** Command test. */ @Test public final void get() { ok(new Get()); ok(new Get(Prop.CHOP)); no(new Get(NAME2)); } /** Command test. */ @Test public final void grant() { ok(new CreateUser(NAME2, md5("test"))); ok(new CreateUser(NAME, md5("test"))); no(new Grant("something", NAME2)); ok(new CreateDB(NAME)); ok(new Grant("none", NAME + '*', NAME + '*')); no(new Grant("all", NAME2)); no(new Grant("all", ":*?", ":*:")); ok(new DropUser(NAME + ',' + NAME2)); no(new Grant("all", NAME)); no(new Grant("all", NAME + '*', ":")); } /** Command test. */ @Test public final void help() { no(new Help("bla")); ok(new Help(null)); } /** Command test. */ @Test public final void info() { ok(new Info()); } /** Command test. */ @Test public final void infoDB() { no(new InfoDB()); ok(new CreateDB(NAME, FILE)); ok(new InfoDB()); } /** Command test. */ @Test public final void infoIndex() { no(new InfoIndex()); ok(new CreateDB(NAME, FILE)); ok(new InfoIndex()); no(new InfoIndex("x")); } /** Command test. */ @Test public final void infoTable() { no(new InfoStorage("1", "2")); ok(new CreateDB(NAME, FILE)); ok(new InfoStorage()); ok(new InfoStorage("1", "2")); ok(new InfoStorage("1", null)); ok(new InfoStorage("// li", null)); } /** Command test. */ @Test public final void list() { ok(new List()); ok(new CreateDB(NAME, FILE)); ok(new List()); } /** Command test. */ @Test public final void listdb() { no(new List(NAME)); ok(new CreateDB(NAME, FILE)); ok(new List(NAME)); } /** Command test. */ @Test public final void open() { no(new Open(NAME)); ok(new CreateDB(NAME, FILE)); ok(new Open(NAME)); ok(new Open(NAME)); no(new Open(":")); } /** Command test. */ @Test public final void optimize() { no(new Optimize()); no(new OptimizeAll()); ok(new CreateDB(NAME, FILE)); ok(new Optimize()); ok(new Optimize()); ok(new OptimizeAll()); } /** Command test. */ @Test public final void password() { ok(new Password(md5(Text.ADMIN))); no(new Password("")); } /** Command test. */ @Test public final void rename() { // database must be opened to rename paths no(new Rename(FILE, "xxx")); ok(new CreateDB(NAME, FILE)); // target path must not be empty no(new Rename(FN, "/")); no(new Rename(FN, "")); ok(new Rename(FILE, FILE)); ok(new Rename(FILE, "xxx")); // source need not exist ok(new Rename(FILE, "xxx")); } /** Command test. */ @Test public final void replace() { // query to count number of documents final String count = "count(db:open('" + NAME + "'))"; // database must be opened to replace resources no(new Replace(FILE, "xxx")); ok(new CreateDB(NAME, FILE)); assertEquals("1", ok(new XQuery(count))); // replace existing document ok(new Replace(FN, "")); assertEquals("1", ok(new XQuery(count))); // replace existing document (again) ok(new Replace(FN, "")); assertEquals("1", ok(new XQuery(count))); // invalid content no(new Replace(FN, "")); assertEquals("1", ok(new XQuery(count))); // create and replace binary file ok(new XQuery("db:store('" + NAME + "', 'a', 'a')")); ok(new Replace("a", "")); assertFalse(ok(new XQuery("db:open('" + NAME + "')")).isEmpty()); ok(new XQuery("db:retrieve('" + NAME + "', 'a')")); // a failing replace should not remove existing documents no(new Replace(FN, "")); assertEquals("1", ok(new XQuery(count))); } /** Command test. */ @Test public final void restore() { no(new Restore(NAME)); ok(new CreateDB(NAME)); ok(new CreateBackup(NAME)); ok(new Restore(NAME)); no(new Restore(":")); ok(new DropBackup(NAME)); no(new Restore(NAME)); ok(new Open(NAME)); no(new Restore(NAME)); ok(new XQuery(".")); ok(new CreateDB("test-1")); ok(new CreateBackup("test-1")); ok(new Restore("test-1")); ok(new DropBackup("test")); no(new Restore("test")); ok(new DropBackup("test-1")); ok(new DropDB("test-1")); ok(new CreateDB(Databases.DBCHARS)); no(new Restore(Databases.DBCHARS)); ok(new CreateBackup(Databases.DBCHARS)); ok(new Restore(Databases.DBCHARS)); ok(new DropBackup(Databases.DBCHARS)); ok(new DropDB(Databases.DBCHARS)); } /** * Dropping backups. */ @Test public final void dropBackup() { // dropping a backup with db name as argument ok(new CreateDB(NAME)); ok(new CreateBackup(NAME)); ok(new DropBackup(NAME)); /* Creates 2 dbs: one with a short name (1), the other with a * longer name (2). (1) is a prefix of (2). Tests then, whether * backups of both dbs are deleted, when we drop backups of (1). */ ok(new CreateDB(NAME)); ok(new CreateDB(NAME2)); ok(new CreateBackup(NAME)); ok(new CreateBackup(NAME2)); ok(new DropBackup(NAME)); } /** Retrieves raw data. */ @Test public final void retrieve() { ok(new CreateDB(NAME)); // retrieve non-existing file no(new Retrieve(NAME2)); // retrieve existing file ok(new Store(NAME2, FILE)); ok(new Retrieve(NAME2)); } /** Stores raw data. */ @Test public final void store() { ok(new CreateDB(NAME)); ok(new Store(NAME2, FILE)); // file can be overwritten ok(new Store(NAME2, FILE)); // adopt name from specified file ok(new Store("", FILE)); // reject invalid or missing names no(new Store("", "")); no(new Store("../x", FILE)); } /** * Command test. * @throws IOException I/O exception */ @Test public final void run() throws IOException { // test xquery IOFile io = new IOFile("test.xq"); no(new Run(io.path())); io.write(token("// li")); no(new Run(io.path())); ok(new CreateDB(NAME, FILE)); ok(new Run(io.path())); io.delete(); // test command script (1) io = new IOFile("test.bxs"); io.write(token("")); ok(new Run(io.path())); // test command script (2) io = new IOFile("test.bxs"); io.write(token("")); no(new Run(io.path())); io.delete(); } /** Command test. */ @Test public final void execute() { ok(new Execute(new CreateDB(NAME, FILE).toString())); ok(new XQuery("//li")); ok(new Execute("")); ok(new Execute("")); no(new XQuery("//li")); } /** Command test. */ @Test public final void set() { ok(new Set(Prop.CHOP, false)); ok(new Set(Prop.CHOP, true)); ok(new Set("chop", true)); ok(new Set("runs", 1)); no(new Set("runs", true)); no(new Set(NAME2, NAME2)); } /** Command test. */ @Test public final void showUsers() { ok(new ShowUsers()); no(new ShowUsers(NAME)); ok(new CreateDB(NAME)); ok(new ShowUsers(NAME)); no(new ShowUsers(":")); } /** Command test. */ @Test public final void xquery() { no(new XQuery("/")); ok(new CreateDB(NAME, FILE)); ok(new XQuery("/")); ok(new XQuery("1")); no(new XQuery("1+")); } /** * Assumes that the specified flag is successful. * @param flag flag */ private static void ok(final boolean flag) { assertTrue(flag); } /** * Assumes that the nodes have the specified number of nodes. * @param nodes context nodes * @param size expected size */ private static void ok(final Nodes nodes, final int size) { if(nodes != null) assertEquals(size, nodes.size()); } /** * Assumes that this command is successful. * @param cmd command reference * @return result as string */ static final String ok(final Command cmd) { try { return session.execute(cmd); } catch(final IOException ex) { fail(Util.message(ex)); return null; } } /** * Assumes that this command fails. * @param cmd command reference */ static final void no(final Command cmd) { try { session.execute(cmd); fail("\"" + cmd + "\" was supposed to fail."); } catch(final IOException ex) { /* expected */ } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/core/LangTest.java000066400000000000000000000012531222453003200255260ustar00rootroot00000000000000package org.basex.test.core; import static org.junit.Assert.*; import java.io.*; import org.basex.core.*; import org.basex.io.out.*; import org.basex.test.*; import org.junit.*; /** * This class tests the completeness and correctness of the language files. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class LangTest extends SandboxTest { /** * Tests all language files. */ @Test public void test() { try { final ArrayOutput ao = new ArrayOutput(); System.setErr(new PrintStream(ao)); Lang.check(); if(ao.size() != 0) fail(ao.toString()); } finally { System.setErr(ERR); } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/core/LockingTest.java000066400000000000000000000575301222453003200262440ustar00rootroot00000000000000package org.basex.test.core; import static org.junit.Assert.*; import java.lang.reflect.Array; import java.util.*; import java.util.List; import java.util.concurrent.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.test.*; import org.basex.util.list.*; import org.junit.*; import org.junit.runner.*; import org.junit.runners.*; import org.junit.runners.Parameterized.*; /** * Tests for {@link org.basex.core.DBLocking}. * * @author BaseX Team 2005-12, BSD License * @author Jens Erat */ @RunWith(Parameterized.class) public final class LockingTest extends SandboxTest { /** How often should tests be repeated? */ private static final int REPEAT = 1; /** How many milliseconds to wait for threads to finish. */ private static final long WAIT = 100L; /** Number of threads used in fuzzing test. */ private static final int FUZZING_THREADS = 5; /** Repeated locking events each thread should trigger. */ private static final int FUZZING_REPEATS = 10; /** How long each lock should be hold before releasing it and fetching the next. */ private static final int HOLD_TIME = 10; /** * Enable repeated running of test to track down synchronization issues. * @return Collection of empty object arrays */ @Parameters public static Collection generateParams() { final List params = new ArrayList(); for(int i = 1; i <= REPEAT; i++) { params.add(new Object[0]); } return params; } /** Main properties, used to read parallel transactions limit. */ private final MainProp mprop = new Context().mprop; /** Locking instance used for testing. */ DBLocking locks = new DBLocking(mprop); /** Objects used for locking. */ final String[] objects = new String[5]; /** Empty string array for convenience. */ private static final String[] NONE = new String[0]; /** * Test preparations: create objects for locking. */ @Before public void before() { for(int i = 0; i < objects.length; i++) { objects[i] = Integer.toString(i); } } /** * Test for concurrent writes. * @throws InterruptedException Got interrupted. */ @Test public void writeWriteTest() throws InterruptedException { final CountDownLatch sync = new CountDownLatch(1), test = new CountDownLatch(1); final LockTester th1 = new LockTester(null, NONE, objects, sync); final LockTester th2 = new LockTester(sync, NONE, objects, test); th1.start(); th2.start(); assertFalse("Thread 2 shouldn't be able to acquire lock yet.", test.await(WAIT, TimeUnit.MILLISECONDS)); th1.release(); assertTrue("Thread 2 should be able to acquire lock now.", test.await(WAIT, TimeUnit.MILLISECONDS)); th2.release(); } /** * Fetch write lock, then read lock. * @throws InterruptedException Got interrupted. */ @Test public void writeReadTest() throws InterruptedException { final CountDownLatch sync = new CountDownLatch(1), test = new CountDownLatch(1); final LockTester th1 = new LockTester(null, NONE, objects, sync); final LockTester th2 = new LockTester(sync, objects, NONE, test); th1.start(); th2.start(); assertFalse("Thread 2 shouldn't be able to acquire lock yet.", test.await(WAIT, TimeUnit.MILLISECONDS)); th1.release(); assertTrue("Thread 2 should be able to acquire lock now.", test.await(WAIT, TimeUnit.MILLISECONDS)); th2.release(); } /** * Fetch read lock, then write lock. * @throws InterruptedException Got interrupted. */ @Test public void readWriteTest() throws InterruptedException { final CountDownLatch sync = new CountDownLatch(1), test = new CountDownLatch(1); final LockTester th1 = new LockTester(null, objects, NONE, sync); final LockTester th2 = new LockTester(sync, NONE, objects, test); th1.start(); th2.start(); assertFalse("Thread 2 shouldn't be able to acquire lock yet.", test.await(WAIT, TimeUnit.MILLISECONDS)); th1.release(); assertTrue("Thread 2 should be able to acquire lock now.", test.await(WAIT, TimeUnit.MILLISECONDS)); th2.release(); } /** * Fetch two read locks. * @throws InterruptedException Got interrupted. */ @Test public void readReadTest() throws InterruptedException { final CountDownLatch sync = new CountDownLatch(1), test = new CountDownLatch(1); final LockTester th1 = new LockTester(null, objects, NONE, sync); final LockTester th2 = new LockTester(sync, objects, NONE, test); th1.start(); th2.start(); assertTrue("Thread 2 should be able to acquire lock.", test.await(WAIT, TimeUnit.MILLISECONDS)); th1.release(); th2.release(); } /** * Test parallel transaction limit. * @throws InterruptedException Got interrupted. */ @Test public void parallelTransactionLimitTest() throws InterruptedException { final CountDownLatch latch = new CountDownLatch(Math.max(mprop.num(MainProp.PARALLEL), 1)); // Container for (maximum number allowed transactions) + 1 testers final LockTester[] testers = (LockTester[]) Array.newInstance( LockTester.class, (int) (latch.getCount() + 1)); // Start maximum number of allowed transactions for(int i = 0; i < testers.length - 1; i++) { testers[i] = new LockTester(null, objects, NONE, latch); testers[i].start(); } assertTrue("Couldn't start maximum allowed number of parallel transactions!", latch.await(WAIT, TimeUnit.MILLISECONDS)); // Start one more transaction final CountDownLatch latch2 = new CountDownLatch(1); testers[testers.length - 1] = new LockTester(null, objects, NONE, latch2); testers[testers.length - 1].start(); assertFalse("Shouldn't be able to start another parallel transaction yet!", latch2.await(WAIT, TimeUnit.MILLISECONDS)); // Stop first transaction testers[0].release(); assertTrue("New transaction should have started!", latch2.await(WAIT, TimeUnit.MILLISECONDS)); // Stop all other transactions for(int i = 1; i < testers.length; i++) { testers[i].release(); } } /** * Global locking test. * @throws InterruptedException Got interrupted. */ @Test public void globalWriteLocalWriteLockingTest() throws InterruptedException { final CountDownLatch sync1 = new CountDownLatch(1), sync2 = new CountDownLatch(1), test = new CountDownLatch(1); final LockTester th1 = new LockTester(null, NONE, objects, sync1); final LockTester th2 = new LockTester(sync1, NONE, null, sync2); final LockTester th3 = new LockTester(sync2, NONE, objects, test); th1.start(); th2.start(); assertFalse("Thread 2 shouldn't be able to acquire lock yet.", sync2.await(WAIT, TimeUnit.MILLISECONDS)); th1.release(); assertTrue("Thread 2 should be able to acquire lock now.", sync2.await(WAIT, TimeUnit.MILLISECONDS)); th3.start(); assertFalse("Thread 3 shouldn't be able to acquire lock yet.", test.await(WAIT, TimeUnit.MILLISECONDS)); th2.release(); assertTrue("Thread 3 should be able to acquire lock now.", test.await(WAIT, TimeUnit.MILLISECONDS)); th3.release(); } /** * Global locking test. * @throws InterruptedException Got interrupted. */ @Test public void globalWriteLocalReadLockingTest() throws InterruptedException { final CountDownLatch sync1 = new CountDownLatch(1), sync2 = new CountDownLatch(1), test = new CountDownLatch(1); final LockTester th1 = new LockTester(null, objects, NONE, sync1); final LockTester th2 = new LockTester(sync1, NONE, null, sync2); final LockTester th3 = new LockTester(sync2, objects, NONE, test); th1.start(); th2.start(); assertFalse("Thread 2 shouldn't be able to acquire lock yet.", sync2.await(WAIT, TimeUnit.MILLISECONDS)); th1.release(); assertTrue("Thread 2 should be able to acquire lock now.", sync2.await(WAIT, TimeUnit.MILLISECONDS)); th3.start(); assertFalse("Thread 3 shouldn't be able to acquire lock yet.", test.await(WAIT, TimeUnit.MILLISECONDS)); th2.release(); assertTrue("Thread 3 should be able to acquire lock now.", test.await(WAIT, TimeUnit.MILLISECONDS)); th3.release(); } /** * Global locking test. * @throws InterruptedException Got interrupted. */ @Test public void globalReadLocalWriteLockingTest() throws InterruptedException { final CountDownLatch sync1 = new CountDownLatch(1), sync2 = new CountDownLatch(1), test = new CountDownLatch(1); final LockTester th1 = new LockTester(null, NONE, objects, sync1); final LockTester th2 = new LockTester(sync1, null, NONE, sync2); final LockTester th3 = new LockTester(sync2, NONE, objects, test); th1.start(); th2.start(); assertFalse("Thread 2 shouldn't be able to acquire lock yet.", sync2.await(WAIT, TimeUnit.MILLISECONDS)); th1.release(); assertTrue("Thread 2 should be able to acquire lock now.", sync2.await(WAIT, TimeUnit.MILLISECONDS)); th3.start(); assertFalse("Thread 3 shouldn't be able to acquire lock yet.", test.await(WAIT, TimeUnit.MILLISECONDS)); th2.release(); assertTrue("Thread 3 should be able to acquire lock now.", test.await(WAIT, TimeUnit.MILLISECONDS)); th3.release(); } /** * Global locking test. * @throws InterruptedException Got interrupted. */ @Test public void globalReadLocalReadLockingTest() throws InterruptedException { final CountDownLatch sync1 = new CountDownLatch(1), sync2 = new CountDownLatch(1), test = new CountDownLatch(1); final LockTester th1 = new LockTester(null, objects, NONE, sync1); final LockTester th2 = new LockTester(sync1, null, NONE, sync2); final LockTester th3 = new LockTester(sync2, objects, NONE, test); th1.start(); th2.start(); assertTrue("Thread 2 should be able to acquire lock.", sync2.await(WAIT, TimeUnit.MILLISECONDS)); th3.start(); assertTrue("Thread 3 should be able to acquire lock.", test.await(WAIT, TimeUnit.MILLISECONDS)); th1.release(); th2.release(); th3.release(); } /** * Simultaneous read/write lock test. * @throws InterruptedException Got interrupted. */ @Test public void simultaneousReadWriteTest() throws InterruptedException { final CountDownLatch sync = new CountDownLatch(1), test = new CountDownLatch(1); final LockTester th1 = new LockTester(null, objects, objects, sync); final LockTester th2 = new LockTester(sync, objects, NONE, test); final LockTester th3 = new LockTester(sync, NONE, objects, test); th1.start(); th2.start(); th3.start(); assertFalse("Threads 2 & 3 shouldn't be able to acquire lock yet.", test.await(WAIT, TimeUnit.MILLISECONDS)); th1.release(); assertTrue("Threads 2 & 3 should be able to acquire lock now.", test.await(WAIT, TimeUnit.MILLISECONDS)); th2.release(); th3.release(); } /** * Another simultaneous read/write lock test. * @throws InterruptedException Got interrupted. */ @Test public void simultaneousReadWriteTestSingleReadFirst() throws InterruptedException { final CountDownLatch sync = new CountDownLatch(1), test = new CountDownLatch(1); final LockTester th1 = new LockTester(null, objects, NONE, sync); final LockTester th2 = new LockTester(sync, objects, objects, test); th1.start(); th2.start(); assertFalse("Thread 2 shouldn't be able to acquire lock yet.", test.await(WAIT, TimeUnit.MILLISECONDS)); th1.release(); assertTrue("Thread 2 should be able to acquire lock now.", test.await(WAIT, TimeUnit.MILLISECONDS)); th2.release(); } /** * Another simultaneous read/write lock test. * @throws InterruptedException Got interrupted. */ @Test public void simultaneousReadWriteTestSingleWriteFirst() throws InterruptedException { final CountDownLatch sync = new CountDownLatch(1), test = new CountDownLatch(1); final LockTester th1 = new LockTester(null, NONE, objects, sync); final LockTester th2 = new LockTester(sync, objects, objects, test); th1.start(); th2.start(); assertFalse("Thread 2 shouldn't be able to acquire lock yet.", test.await(WAIT, TimeUnit.MILLISECONDS)); th1.release(); assertTrue("Thread 2 should be able to acquire lock now.", test.await(WAIT, TimeUnit.MILLISECONDS)); th2.release(); } /** * Test for concurrent writes. * @throws BaseXException database exception */ @Test public void downgradeTest() throws BaseXException { // hangs if QueryContext.downgrade call is activated.. new CreateDB(NAME, "").execute(context); new XQuery("delete node /y").execute(context); new XQuery("let $d := '" + NAME + "' return doc($d)").execute(context); } /** * Lock downgrading, the other thread is reader. * @throws InterruptedException Got interrupted. */ @Test public void downgradeOtherReadTest() throws InterruptedException { final CountDownLatch sync = new CountDownLatch(1), test = new CountDownLatch(1); assertTrue("Increase {@code objects.length}!", objects.length > 1); final String[] release = Arrays.copyOf(objects, 1); final String[] keep = Arrays.copyOfRange(objects, 1, objects.length); final LockTester th1 = new LockTester(null, NONE, objects, sync); final LockTester th2 = new LockTester(sync, release, NONE, test); th1.start(); th2.start(); assertFalse("Thread 2 shouldn't be able to acquire lock yet.", test.await(WAIT, TimeUnit.MILLISECONDS)); th1.downgrade(keep); assertTrue("Thread 2 should be able to acquire lock now.", test.await(WAIT, TimeUnit.MILLISECONDS)); th1.release(); th2.release(); } /** * Lock downgrading, the other thread is writer. * @throws InterruptedException Got interrupted. */ @Test public void downgradeOtherWriteTest() throws InterruptedException { final CountDownLatch sync = new CountDownLatch(1), test = new CountDownLatch(1); assertTrue("Increase {@code objects.length}!", objects.length > 1); final String[] release = Arrays.copyOf(objects, 1); final String[] keep = Arrays.copyOfRange(objects, 1, objects.length); final LockTester th1 = new LockTester(null, NONE, objects, sync); final LockTester th2 = new LockTester(sync, NONE, release, test); th1.start(); th2.start(); assertFalse("Thread 2 shouldn't be able to acquire lock yet.", test.await(WAIT, TimeUnit.MILLISECONDS)); th1.downgrade(keep); assertFalse("Thread 2 shouldn't be able to acquire lock yet.", test.await(WAIT, TimeUnit.MILLISECONDS)); th1.release(); assertTrue("Thread 2 should be able to acquire lock now.", test.await(WAIT, TimeUnit.MILLISECONDS)); th2.release(); } /** * Downgrade from global write lock, other fetches local writes locks. * @throws InterruptedException Got interrupted. */ @Test public void downgradeGlobalWriteLockTest() throws InterruptedException { final CountDownLatch sync = new CountDownLatch(1), test = new CountDownLatch(1); final LockTester th1 = new LockTester(null, NONE, null, sync); final LockTester th2 = new LockTester(sync, NONE, objects, test); th1.start(); th2.start(); assertFalse("Thread 2 shouldn't be able to acquire lock yet.", test.await(WAIT, TimeUnit.MILLISECONDS)); th1.downgrade(objects); assertFalse("Thread 2 shouldn't be able to acquire lock yet.", test.await(WAIT, TimeUnit.MILLISECONDS)); th1.release(); assertTrue("Thread 2 should be able to acquire lock now.", test.await(WAIT, TimeUnit.MILLISECONDS)); th2.release(); } /** * Lock downgrading holding read locks. * @throws InterruptedException Got interrupted. */ @Test public void downgradeHoldingReadLocksTest() throws InterruptedException { final CountDownLatch sync = new CountDownLatch(1), test = new CountDownLatch(1); assertTrue("Increase {@code objects.length}!", objects.length > 1); final String[] release = Arrays.copyOf(objects, 1); final String[] keep = Arrays.copyOfRange(objects, 1, objects.length); final LockTester th1 = new LockTester(null, objects, release, sync); final LockTester th2 = new LockTester(sync, NONE, keep, test); th1.start(); th2.start(); assertFalse("Thread 2 shouldn't be able to acquire lock yet.", test.await(WAIT, TimeUnit.MILLISECONDS)); th1.downgrade(NONE); assertFalse("Thread 2 shouldn't be able to acquire lock yet.", test.await(WAIT, TimeUnit.MILLISECONDS)); th1.release(); assertTrue("Thread 2 should be able to acquire lock now.", test.await(WAIT, TimeUnit.MILLISECONDS)); th2.release(); } /** * Force deadlock. * @throws InterruptedException Got interrupted. */ @Test public void deadlockTest() throws InterruptedException { final CountDownLatch sync = new CountDownLatch(1), test2 = new CountDownLatch(1), test3 = new CountDownLatch(1);; final LockTester th1 = new LockTester(null, NONE, new String[] {"3"}, sync); final LockTester th2 = new LockTester(sync, new String[] {"2"}, new String[] {"1", "3"}, test2); final LockTester th3 = new LockTester(sync, new String[] {"1"}, new String[] {"2", "3"}, test3); th1.start(); // Make sure thread 1 has wl(3) Thread.sleep(WAIT); th2.start(); th3.start(); th1.release(); assertTrue( "One of the threads should be able to aquire its locks now.", test2.await(WAIT, TimeUnit.MILLISECONDS) || test3.await(WAIT, TimeUnit.MILLISECONDS)); boolean which = false; if(test2.getCount() == 0) { th2.release(); which = true; } else th3.release(); assertTrue( "The other thread should be able to acquire its locks now.", test2.await(WAIT, TimeUnit.MILLISECONDS) && test3.await(WAIT, TimeUnit.MILLISECONDS)); if(which) th3.release(); else th2.release(); } /** * Fuzzing test, watch for deadlocks. Uses multiple threads in parallel which all fetch * random locks, hold them for a while, release them and fetch the next one. * @throws InterruptedException Got interrupted. */ @Test public void fuzzingTest() throws InterruptedException { assertTrue("Increase {@code objects.length}!", objects.length > 1); final Thread[] threads = new Thread[FUZZING_THREADS]; final CountDownLatch allDone = new CountDownLatch(FUZZING_THREADS * FUZZING_REPEATS); for(int i = 0; i < FUZZING_THREADS; i++) { threads[i] = new Thread() { private String[] randomSubset(final String[] set, final boolean nullAllowed) { if(nullAllowed && Math.random() * set.length == 0) return null; final int start = (int) (Math.random() * set.length); final int end = (int) (Math.random() * (set.length - start)) + start; final String[] subset = Arrays.copyOfRange(set, start, end); return subset; } @Override public void run() { for(int j = 0; j < FUZZING_REPEATS; j++) { final CountDownLatch latch = new CountDownLatch(1); final String[] read = randomSubset(objects, true); final String[] write = randomSubset(objects, true); final LockTester th = new LockTester(null, read, write, latch); th.start(); try { Thread.sleep(HOLD_TIME); th.downgrade(randomSubset(write, false)); Thread.sleep(HOLD_TIME); if(!latch.await(FUZZING_THREADS * HOLD_TIME + WAIT, TimeUnit.MILLISECONDS)) throw new RuntimeException("Looks like thread is stuck in a deadlock."); } catch(final InterruptedException e) { throw new RuntimeException(e); } th.release(); allDone.countDown(); } } }; threads[i].start(); } assertTrue("Looks like thread is stuck in a deadlock.", allDone.await(FUZZING_THREADS * FUZZING_REPEATS * HOLD_TIME, TimeUnit.MILLISECONDS)); } /** * Default implementation for setting locks and latches. */ private class LockTester extends Thread { /** Latch to await before locking. */ private final CountDownLatch await; /** Latch to count down after locking. */ private final CountDownLatch countDown; /** Shall we fetch write locks? */ private final boolean writing; /** Array of objects to put read locks onto. */ private final String[] readObjects; /** Array of objects to put write locks onto. */ private final String[] writeObjects; /** If set, downgrade locks after being notified. */ private volatile String[] downgrade; /** Flag indicating to release locks after being notified. */ private volatile boolean requestRelease; /** * Setup locking thread. Call {@code start} to lock, notify the thread to unlock. * @param a Latch to await * @param r Strings to put read lock on * @param w Strings to put write lock on * @param c Latch to count down after receiving locks */ LockTester(final CountDownLatch a, final String[] r, final String[] w, final CountDownLatch c) { await = a; writing = w != null && w.length != 0; readObjects = r; writeObjects = w; countDown = c; } @Override public void run() { // Await latch if set if(null != await) { try { if(!await.await(WAIT, TimeUnit.MILLISECONDS)) fail("Latch timed out."); } catch(final InterruptedException e) { throw new RuntimeException("Unexpectedly interrupted."); } } // Fetch lock if objects are set final Command cmd = new Cmd(writing); locks.acquire(cmd, null != readObjects ? new StringList().add(readObjects) : null, null != writeObjects ? new StringList().add(writeObjects) : null); // We hold the lock, count down if(null != countDown) countDown.countDown(); // Wait until we're asked to release the lock synchronized(this) { try { while(!requestRelease || null != downgrade) { if(null != downgrade) { locks.downgrade(new StringList().add(downgrade)); downgrade = null; } if(!requestRelease) wait(); } } catch(final InterruptedException e) { throw new RuntimeException("Unexpectedly interrupted."); } } locks.release(cmd); } /** * Downgrade given locks. * @param dg Locks to keep */ public synchronized void downgrade(final String[] dg) { downgrade = dg; notifyAll(); } /** * Release all locks tester owns. {@code release} gets called by other threads, so it * cannot release locks directly (the thread holding the lock must do this). Set flag * in object that lock should be released and wake up all threads. */ public synchronized void release() { requestRelease = true; notifyAll(); } } /** Dummy command. */ private static class Cmd extends Command { /** * Constructor. * @param w write flag */ Cmd(final boolean w) { super(Perm.NONE); updating = w; } @Override protected boolean run() { return true; } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/core/PermissionTest.java000066400000000000000000000241331222453003200267770ustar00rootroot00000000000000package org.basex.test.core; import static org.basex.core.Text.*; import static org.junit.Assert.*; import java.io.*; import org.basex.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.core.parse.Commands.*; import org.basex.server.*; import org.basex.test.*; import org.basex.util.*; import org.junit.*; /** * This class tests user permissions. * * @author BaseX Team 2005-12, BSD License * @author Andreas Weiler */ public final class PermissionTest extends SandboxTest { /** Name of the database to be renamed. */ private static final String RENAMED = Util.name(PermissionTest.class) + 'r'; /** Test repository. **/ private static final String REPO = "src/test/resources/repo/"; /** Server reference. */ private static BaseXServer server; /** Admin session. */ private Session adminSession; /** Test session. */ private Session testSession; /** * Starts the server. * @throws IOException I/O exception */ @BeforeClass public static void start() throws IOException { server = createServer(); } /** * Stops the server. * @throws IOException I/O exception */ @AfterClass public static void stop() throws IOException { stopServer(server); } /** Set up method. */ @Before public void setUp() { try { adminSession = createClient(); if(server.context.users.get(NAME) != null) { ok(new DropUser(NAME), adminSession); } ok(new CreateUser(NAME, Token.md5(NAME)), adminSession); ok(new CreateDB(RENAMED), adminSession); server.context.mprop.set(MainProp.REPOPATH, REPO); testSession = createClient(NAME, NAME); ok(new CreateDB(NAME, ""), adminSession); ok(new Close(), adminSession); } catch(final Exception ex) { fail(Util.message(ex)); } } /** Clean up method. */ @After public void cleanUp() { try { testSession.close(); adminSession.execute(new DropDB(RENAMED)); adminSession.execute(new DropDB(NAME)); adminSession.close(); // give the server some time to clean up the sessions before next test Performance.sleep(50); } catch(final Exception ex) { fail(Util.message(ex)); } } /** Tests all commands where no permission is needed. */ @Test public void noPermsNeeded() { ok(new Grant("none", NAME), adminSession); ok(new Password(Token.md5(NAME)), testSession); ok(new Help("list"), testSession); ok(new Close(), testSession); no(new List(NAME), testSession); ok(new List(), testSession); no(new Open(NAME), testSession); no(new InfoDB(), testSession); no(new InfoIndex(), testSession); no(new InfoStorage(), testSession); no(new Get("DBPATH"), testSession); ok(new Get(Prop.QUERYINFO), testSession); ok(new Set(Prop.QUERYINFO, false), testSession); // repo Stuff no(new RepoInstall(REPO + "/pkg3.xar", null), testSession); ok(new RepoList(), testSession); no(new RepoDelete("http://www.pkg3.com", null), testSession); // XQuery read no(new XQuery("//xml"), testSession); no(new Find(NAME), testSession); no(new Optimize(), testSession); // XQuery update no(new XQuery("for $item in doc('" + NAME + "')//xml " + "return rename node $item as 'null'"), testSession); no(new CreateDB(NAME, ""), testSession); no(new Rename(RENAMED, RENAMED + '2'), testSession); no(new CreateIndex("SUMMARY"), testSession); no(new DropDB(NAME), testSession); no(new DropIndex("SUMMARY"), testSession); no(new CreateUser(NAME, Token.md5(NAME)), testSession); no(new DropUser(NAME), testSession); no(new Kill("dada"), testSession); no(new ShowUsers("Users"), testSession); no(new Grant("read", NAME), testSession); no(new Grant("none", NAME), testSession); no(new AlterUser(NAME, Token.md5(NAME)), testSession); no(new Flush(), testSession); } /** Tests all commands where read permission is needed. */ @Test public void readPermsNeeded() { ok(new Grant("read", NAME), adminSession); ok(new Open(NAME), testSession); ok(new List(NAME), testSession); ok(new InfoDB(), testSession); ok(new InfoStorage("1", "2"), testSession); no(new Get("DBPATH"), testSession); ok(new Get(Prop.QUERYINFO), testSession); ok(new Set(Prop.QUERYINFO, false), testSession); // XQuery read ok(new XQuery("//xml"), testSession); ok(new Find(NAME), testSession); // repo Stuff no(new RepoInstall(REPO + "/pkg3.xar", null), testSession); ok(new RepoList(), testSession); no(new RepoDelete("http://www.pkg3.com", null), testSession); // XQuery update no(new XQuery("for $item in doc('" + NAME + "')//xml " + "return rename node $item as 'null'"), testSession); no(new Optimize(), testSession); no(new CreateDB(NAME, ""), testSession); no(new Replace(RENAMED, ""), testSession); no(new Rename(RENAMED, RENAMED + '2'), testSession); no(new CreateIndex("SUMMARY"), testSession); no(new DropDB(NAME), testSession); no(new DropIndex("SUMMARY"), testSession); no(new CreateUser(NAME, Token.md5(NAME)), testSession); no(new DropUser(NAME), testSession); no(new Export("."), testSession); no(new Kill("dada"), testSession); no(new ShowUsers("Users"), testSession); no(new Grant("read", NAME), testSession); no(new Grant("none", NAME), testSession); no(new AlterUser(NAME, Token.md5(NAME)), testSession); no(new Flush(), testSession); ok(new Close(), testSession); } /** Tests all commands where write permission is needed. */ @Test public void writePermsNeeded() { ok(new Grant("write", NAME), adminSession); ok(new Open(RENAMED), testSession); ok(new Rename(RENAMED, RENAMED + '2'), testSession); ok(new Rename(RENAMED + '2', RENAMED), testSession); // replace Test ok(new Close(), testSession); ok(new Open(RENAMED), testSession); ok(new Add(NAME + ".xml", "1"), testSession); ok(new Optimize(), testSession); ok(new Replace(NAME + ".xml", "2"), testSession); // repo Stuff no(new RepoInstall(REPO + "/pkg3.xar", null), testSession); ok(new RepoList(), testSession); no(new RepoDelete("http://www.pkg3.com", null), testSession); // XQuery Update ok(new XQuery("for $item in doc('" + NAME + "')//xml " + "return rename node $item as 'null'"), testSession); ok(new Optimize(), testSession); for(final CmdIndex cmd : CmdIndex.values()) { ok(new CreateIndex(cmd), testSession); } ok(new InfoIndex(), testSession); for(final CmdIndex cmd : CmdIndex.values()) { ok(new DropIndex(cmd), testSession); } ok(new Flush(), testSession); ok(new Close(), testSession); no(new CreateDB(NAME, ""), testSession); no(new DropDB(NAME), testSession); no(new CreateUser(NAME, Token.md5(NAME)), testSession); no(new DropUser(NAME), testSession); no(new Export("."), testSession); no(new Kill("dada"), testSession); no(new ShowUsers("Users"), testSession); no(new Grant("read", NAME), testSession); no(new Grant("none", NAME), testSession); no(new AlterUser(NAME, Token.md5(NAME)), testSession); } /** Tests all commands where create permission is needed. */ @Test public void createPermsNeeded() { ok(new Grant("create", NAME), adminSession); ok(new Close(), testSession); ok(new CreateDB(NAME, ""), testSession); for(final CmdIndex cmd : CmdIndex.values()) { ok(new CreateIndex(cmd), testSession); } ok(new Export("."), testSession); // repo Stuff ok(new RepoInstall(REPO + "/pkg3.xar", null), testSession); ok(new RepoList(), testSession); ok(new RepoDelete("http://www.pkg3.com", null), testSession); no(new CreateUser(NAME, Token.md5(NAME)), testSession); no(new DropUser(NAME), testSession); no(new Kill("dada"), testSession); no(new ShowUsers("Users"), testSession); no(new Grant("read", NAME), testSession); no(new Grant("none", NAME), testSession); no(new AlterUser(NAME, Token.md5(NAME)), testSession); } /** Tests all commands where admin permission is needed. */ @Test public void adminPermsNeeded() { ok(new Grant(ADMIN, NAME), adminSession); if(server.context.users.get("test2") != null) { ok(new DropUser("test2"), testSession); } ok(new CreateUser("test2", Token.md5(NAME)), testSession); ok(new CreateDB(NAME, ""), testSession); ok(new ShowUsers(), testSession); ok(new Grant(ADMIN, "test2"), testSession); ok(new Grant("create", "test2"), testSession); ok(new AlterUser(NAME, Token.md5(NAME)), testSession); ok(new DropUser("test2"), testSession); ok(new Close(), testSession); ok(new Close(), adminSession); ok(new DropDB(NAME), adminSession); // repo Stuff ok(new RepoInstall(REPO + "/pkg3.xar", null), testSession); ok(new RepoList(), testSession); ok(new RepoDelete("http://www.pkg3.com", null), testSession); } /** Drops users. */ @Test public void dropUsers() { no(new DropUser(NAME), testSession); no(new DropUser(NAME), adminSession); ok(new Exit(), testSession); // give the server some time to close the client session Performance.sleep(50); ok(new DropUser(NAME), adminSession); } /** * Assumes that this command is successful. * @param cmd command reference * @param s session */ private static void ok(final Command cmd, final Session s) { try { s.execute(cmd); } catch(final IOException ex) { fail(Util.message(ex)); } } /** * Assumes that this command fails. * @param cmd command reference * @param s session */ private static void no(final Command cmd, final Session s) { try { s.execute(cmd); fail("\"" + cmd + "\" was supposed to fail."); } catch(final IOException ex) { } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/core/PinTest.java000066400000000000000000000170551222453003200254020ustar00rootroot00000000000000package org.basex.test.core; import static org.junit.Assert.*; import java.io.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.index.*; import org.basex.test.*; import org.basex.util.*; import org.junit.*; /** * This class tests update conflicts caused by multiple database contexts. * Note that the use of multiple contexts is bad practice: all databases should be * opened and managed by a single database context. As the standalone and GUI mode * of BaseX are not synchronized, and as users prefer to visualize databases that are * opened in other instances, this pinning concept prevents users from performing * updates in one instance that will not be reflected in another instance. * * Currently, all tests are disabled, as the concurrent process instances would have * to run in different JVMs. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ @Ignore("OverlappingLocking") public final class PinTest extends SandboxTest { /** Second database context. */ private static final Context CONTEXT2 = new Context(); /** Test file name. */ private static final String FN = "input.xml"; /** Test folder. */ private static final String FLDR = "src/test/resources"; /** Test file. */ private static final String FILE = FLDR + '/' + FN; /** Test name. */ private static final String NAME2 = NAME + '2'; /** Creates new database contexts. */ @BeforeClass public static void start() { initContext(CONTEXT2); } /** Closes the database contexts. */ @AfterClass public static void finish() { CONTEXT2.close(); } /** Closes the contexts. */ @Before public void before() { cleanUp(); } /** Closes the contexts. */ @After public void after() { cleanUp(); } /** Test ADD, DELETE, RENAME, REPLACE and STORE. */ @Test public void update() { // create database and perform update ok(new CreateDB(NAME), context); // open database by second process ok(new Check(NAME), CONTEXT2); // fail, close database and succeed noCloseOk(new Add(FN, FILE)); // fail, close database and succeed ok(new Check(NAME), CONTEXT2); noCloseOk(new Replace(FN, "")); // fail, close database and succeed ok(new Check(NAME), CONTEXT2); noCloseOk(new Rename(FN, FN)); // fail, close database and succeed ok(new Check(NAME), CONTEXT2); noCloseOk(new Store(NAME2, "")); // fail, close database and succeed ok(new Check(NAME), CONTEXT2); noCloseOk(new Delete(FN)); } /** Test COPY. */ @Test public void copy() { // create databases and open by second context ok(new CreateDB(NAME), context); ok(new Check(NAME), CONTEXT2); // copy database (may be opened by multiple databases) ok(new Copy(NAME, NAME2), context); // open second database and run update operation ok(new Open(NAME2), context); ok(new Add(FN, FILE), context); // drop first database and copy back ok(new Close(), CONTEXT2); ok(new DropDB(NAME), context); ok(new Copy(NAME2, NAME), context); } /** Test CREATE BACKUP and RESTORE. */ @Test public void backupRestore() { // create databases and open by second context ok(new CreateDB(NAME), context); ok(new Check(NAME), CONTEXT2); // copy database (may be opened by multiple databases) ok(new CreateBackup(NAME), context); // fail, close database and succeed noCloseOk(new Restore(NAME)); // run update operation to ensure that no pin files were zipped ok(new Add(FN, FILE), context); } /** Test CREATE DB, DROP DB and ALTER DB. */ @Test public void createDropAlterDB() { // create database ok(new CreateDB(NAME), context); // create database with same name ok(new CreateDB(NAME), context); // block second process no(new CreateDB(NAME), CONTEXT2); no(new CreateDB(NAME), CONTEXT2); // create database with different name ok(new CreateDB(NAME2), context); // allow second process ok(new CreateDB(NAME), CONTEXT2); ok(new CreateDB(NAME), CONTEXT2); // fail, close database and succeed noCloseOk(new CreateDB(NAME)); // allow main-memory instances with same name ok(new Set(Prop.MAINMEM, true), CONTEXT2); ok(new CreateDB(NAME), CONTEXT2); ok(new Set(Prop.MAINMEM, false), CONTEXT2); // fail, close database and succeed ok(new Check(NAME), CONTEXT2); noCloseOk(new DropDB(NAME)); // fail, close database and succeed ok(new CreateDB(NAME), CONTEXT2); ok(new DropDB(NAME), CONTEXT2); // create databases and open by second context ok(new CreateDB(NAME), context); ok(new Check(NAME), CONTEXT2); // fail, close database and succeed ok(new DropDB(NAME2), context); noCloseOk(new AlterDB(NAME, NAME2)); } /** Test CREATE USER, DROP USER and ALTER USER. */ @Test public void createDropAlterUser() { // create and alter users (open issue: allow this if other instances are opened?) ok(new CreateUser(NAME, Token.md5(Text.ADMIN)), context); ok(new AlterUser(NAME, Token.md5("abc")), context); // create databases and open by second context ok(new CreateDB(NAME), context); ok(new Check(NAME), CONTEXT2); // create databases and open by second context ok(new AlterUser(NAME, Token.md5("abc")), context); } /** Test CREATE INDEX and DROP INDEX. */ @Test public void createDropIndex() { // create databases and open by second context ok(new CreateDB(NAME), context); ok(new Check(NAME), CONTEXT2); // fail, close database and succeed noCloseOk(new CreateIndex(IndexType.TEXT)); ok(new Check(NAME), CONTEXT2); // fail, close database and succeed noCloseOk(new DropIndex(IndexType.TEXT)); } /** Test XQUERY. */ @Test public void xquery() { // create databases and open by second context ok(new CreateDB(NAME, FILE), context); ok(new Check(NAME), CONTEXT2); // perform read-only queries ok(new XQuery("."), context); ok(new XQuery("."), CONTEXT2); // perform updating query: fail, close database and succeed noCloseOk(new XQuery("delete node /*")); } /** * Runs a command twice: the first time, it is supposed to fail, because the database * is opened by two contexts; after closing the database, it is supposed to succeed. * @param cmd command to test */ private static void noCloseOk(final Command cmd) { // command is supposed to fail, because database is opened by two contexts no(cmd, context); // close database in second context ok(new Close(), CONTEXT2); // command should now succeed ok(cmd, context); } /** * Assumes that this command is successful. * @param cmd command reference * @param ctx database context * @return result as string */ private static String ok(final Command cmd, final Context ctx) { try { return cmd.execute(ctx); } catch(final IOException ex) { fail(Util.message(ex)); return null; } } /** * Assumes that this command fails. * @param cmd command reference * @param ctx database context */ private static void no(final Command cmd, final Context ctx) { try { cmd.execute(ctx); fail("\"" + cmd + "\" was supposed to fail."); } catch(final IOException ex) { } } /** * Deletes the potentially already existing DBs. * DBs & User {@link #NAME} and {@link #NAME2} */ private static void cleanUp() { ok(new Close(), context); ok(new Close(), CONTEXT2); ok(new DropDB(NAME), context); ok(new DropDB(NAME2), context); ok(new DropUser(NAME), context); ok(new DropUser(NAME2), context); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/core/PoolTest.java000066400000000000000000000060121222453003200255540ustar00rootroot00000000000000package org.basex.test.core; import static org.junit.Assert.*; import java.io.*; import org.basex.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.server.*; import org.basex.test.*; import org.basex.util.*; import org.junit.*; /** * This class tests transaction and locking cases. * * @author BaseX Team 2005-12, BSD License * @author Andreas Weiler */ public final class PoolTest extends SandboxTest { /** Test file. */ private static final String FILE = "src/test/resources/input.xml"; /** Server reference. */ private static BaseXServer server; /** Socket reference. */ private static Session session1; /** Socket reference. */ private static Session session2; /** * Starts the server. * @throws Exception exception */ @BeforeClass public static void start() throws Exception { server = createServer(); session1 = createClient(); session2 = createClient(); } /** * Stops the server. * @throws IOException I/O exception */ @AfterClass public static void stop() throws IOException { session1.close(); session2.close(); stopServer(server); } /** Create and Drop Tests. */ @Test public void createAndDrop() { ok(new CreateDB(NAME, FILE), session1); pins(1, NAME); ok(new CreateDB(NAME, FILE), session1); pins(1, NAME); no(new CreateDB(NAME, FILE), session2); pins(1, NAME); no(new CreateDB(NAME, FILE), session2); pins(1, NAME); no(new DropDB(NAME), session2); pins(1, NAME); ok(new DropDB(NAME), session1); pins(0, NAME); } /** Close and Open Tests. */ @Test public void closeAndOpen() { ok(new CreateDB(NAME, FILE), session2); pins(1, NAME); ok(new Close(), session1); pins(1, NAME); ok(new Close(), session2); pins(0, NAME); ok(new Open(NAME), session1); pins(1, NAME); ok(new Open(NAME), session2); pins(2, NAME); ok(new Close(), session1); pins(1, NAME); ok(new Close(), session2); pins(0, NAME); ok(new DropDB(NAME), session1); } /** * Checks the number of database pins for the specified database. * @param pin expected number of pins * @param name name of database */ private static void pins(final int pin, final String name) { assertEquals(pin, server.context.dbs.pins(name)); } /** * Assumes that this command is successful. * @param cmd command reference * @param session Session */ static void ok(final Command cmd, final Session session) { try { session.execute(cmd); } catch(final IOException ex) { fail(Util.message(ex)); } } /** * Assumes that this command fails. * @param cmd command reference * @param session Session */ private static void no(final Command cmd, final Session session) { try { session.execute(cmd); fail("Command was supposed to fail."); } catch(final IOException ex) { } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/core/ServerCommandTest.java000066400000000000000000000027621222453003200274200ustar00rootroot00000000000000package org.basex.test.core; import static org.basex.core.Text.*; import static org.junit.Assert.*; import java.io.*; import org.basex.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.server.*; import org.basex.util.*; import org.junit.*; /** * This class tests the database commands with the client/server * architecture. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ServerCommandTest extends CommandTest { /** Server instance. */ private static BaseXServer server; /** * Starts the server. * @throws IOException I/O exception */ @BeforeClass public static void start() throws IOException { server = createServer(); session = createClient(); cleanUp(); } /** * Stops the server. * @throws IOException I/O exception */ @AfterClass public static void stop() throws IOException { try { if(session != null) session.close(); } catch(final Exception ex) { fail(Util.message(ex)); } stopServer(server); } /** * Kill test. * @throws IOException on server error */ @Test public void kill() throws IOException { ok(new Kill(ADMIN)); ok(new Kill(ADMIN + '2')); ok(new Kill(Prop.NAME + '*')); ok(new CreateUser(NAME2, Token.md5(NAME2))); final ClientSession cs = createClient(NAME2, NAME2); ok(new Kill(NAME2)); ok(new Kill(NAME2 + '?')); cs.close(); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/core/XMLCommandTest.java000066400000000000000000000074041222453003200266100ustar00rootroot00000000000000package org.basex.test.core; import static org.junit.Assert.*; import org.basex.core.parse.*; import org.basex.query.*; import org.basex.test.*; import org.basex.util.*; import org.junit.*; /** * This class tests the XML syntax of the database commands. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class XMLCommandTest extends SandboxTest { /** Check syntax of all commands. */ @Test public final void commands() { // surrounded by element (required to process more than one command) ok("x"); ok("x"); ok("X"); ok(""); ok(""); ok("X"); ok(""); ok(""); ok(""); ok(""); ok(""); ok("X"); ok(""); ok(""); ok(""); ok(""); ok("X"); ok("X"); ok(""); ok(""); ok(""); ok(""); ok(""); ok(""); ok(""); ok(""); ok("info"); ok(""); ok(""); ok("X"); ok(""); ok(""); ok(""); ok(""); ok("X"); ok(""); ok(""); ok(""); ok(""); ok(""); ok(""); ok("X"); ok(""); ok(""); ok(""); ok(""); ok(""); ok(""); ok(""); ok(""); ok("X"); ok(""); ok("X"); ok(""); ok(""); ok(""); ok(""); ok(""); ok(""); ok(""); ok(""); ok("X"); ok(""); ok(""); ok(""); ok(""); ok(""); ok("X"); ok("X"); ok(""); ok("X"); } /** Evaluates some commands with invalid syntax. */ @Test public final void failing() { no(""); no("X"); no("X"); no(""); no("X"); no("X"); no(""); no(""); } /** * Assumes that this command is successful. * @param xml command */ static final void ok(final String xml) { try { new CommandParser(xml, context).parse(); } catch(final QueryException ex) { fail(Util.message(ex)); } } /** * Assumes that this command fails. * @param xml command */ static final void no(final String xml) { try { new CommandParser(xml, context).parse(); fail("\"" + xml + "\" was supposed to fail."); } catch(final QueryException ex) { /* expected */ } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/data/000077500000000000000000000000001222453003200231225ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/java/org/basex/test/data/DiskDataTest.java000066400000000000000000000014501222453003200263110ustar00rootroot00000000000000package org.basex.test.data; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.util.*; import org.junit.*; /** * Test index updates when using disk storage ({@link DiskData}). * * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ public class DiskDataTest extends MemDataTest { /** Test database name. */ private final String dbname = Util.name(DiskDataTest.class); @Override @Before public void setUp() throws BaseXException { new CreateDB(dbname, XMLSTR).execute(context); } /** * Clean up method; executed after each test; drops the database. * @throws BaseXException the database cannot be dropped */ @After public void cleanUp() throws BaseXException { new DropDB(dbname).execute(context); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/data/DiskTableTest.java000066400000000000000000000234671222453003200265030ustar00rootroot00000000000000package org.basex.test.data; import static org.junit.Assert.*; import java.io.*; import java.lang.reflect.*; import org.basex.build.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.io.*; import org.basex.io.random.*; import org.basex.test.*; import org.basex.util.*; import org.junit.*; /** * This class tests the update functionality of the block storage. * * @author BaseX Team 2005-12, BSD License * @author Tim Petrowsky */ public final class DiskTableTest extends SandboxTest { /** Test file we do updates with. */ private static final String TESTFILE = "src/test/resources/xmark.xml"; /** BlockStorage. */ private TableDiskAccess tda; /** Data reference. */ private Data data; /** Test file size. */ private int size; /** Starting storage. */ private byte[] storage; /** Expected blocks in file. */ private int blocks; /** Nodes per block. */ private int nodes; /** * Initializes the test class. */ @BeforeClass public static void setUpBeforeClass() { context.prop.set(Prop.TEXTINDEX, false); context.prop.set(Prop.ATTRINDEX, false); } /** * Loads the JUnitTest database. * @throws Exception exception */ @Before public void setUp() throws Exception { final Parser parser = Parser.xmlParser(IO.get(TESTFILE), context.prop); data = new DiskBuilder(NAME, parser, context).build(); size = data.meta.size; data.close(); tda = new TableDiskAccess(data.meta, true); final int bc = size * (1 << IO.NODEPOWER); storage = new byte[bc]; for(int i = 0; i < bc; ++i) { storage[i] = (byte) tda.read1(i >> IO.NODEPOWER, i % (1 << IO.NODEPOWER)); } nodes = IO.BLOCKSIZE >>> IO.NODEPOWER; blocks = (int) Math.ceil((double) size / nodes); } /** * Drops the JUnitTest database. * @throws Exception exception */ @After public void tearDown() throws Exception { if(tda != null) tda.close(); DropDB.drop(NAME, context); } /** * Closes and reloads storage. */ private void closeAndReload() { try { tda.close(); tda = new TableDiskAccess(data.meta, true); } catch(final IOException ex) { fail(Util.message(ex)); } } /** * Compares old with new entries. * @param startNodeNumber first old entry to compare * @param currentNodeNumber first new entry to compare * @param count number of entries to compare */ private void assertEntrysEqual(final int startNodeNumber, final int currentNodeNumber, final int count) { final int startOffset = startNodeNumber << IO.NODEPOWER; final int currentOffset = currentNodeNumber << IO.NODEPOWER; for(int i = 0; i < count << IO.NODEPOWER; ++i) { final int startByteNum = startOffset + i; final int currentByteNum = currentOffset + i; final byte startByte = storage[startByteNum]; final byte currentByte = (byte) tda.read1(currentByteNum >> IO.NODEPOWER, currentByteNum % (1 << IO.NODEPOWER)); assertEquals("Old entry " + (startByteNum >> IO.NODEPOWER) + " (byte " + startByteNum % (1 << IO.NODEPOWER) + ") and new entry " + (currentByteNum >> IO.NODEPOWER) + " (byte " + currentByteNum % (1 << IO.NODEPOWER) + ')', startByte, currentByte); } } /** * Tests size of file. */ @Test public void size() { assertEquals("Testfile size changed!", size, tdaSize()); assertTrue("Need at least 3 blocks for testing!", blocks > 2); assertEquals("Unexpected number of blocks!", blocks, tdaBlocks()); closeAndReload(); assertEquals("Testfile size changed!", size, tdaSize()); assertTrue("Need at least 3 blocks for testing!", blocks > 2); assertEquals("Unexpected number of blocks!", blocks, tdaBlocks()); } /** * Returns the number of block entries. * @return number of entries */ private int tdaSize() { try { final Field f = tda.getClass().getSuperclass().getDeclaredField("meta"); f.setAccessible(true); return ((MetaData) f.get(tda)).size; } catch(final Exception ex) { Util.stack(ex); return 0; } } /** * Returns the number of blocks. * @return number of blocks */ private int tdaBlocks() { try { final Field f = tda.getClass().getDeclaredField("used"); f.setAccessible(true); return f.getInt(tda); } catch(final Exception ex) { Util.stack(ex); return 0; } } /** * Tests delete. */ @Test public void deleteOneNode() { tda.delete(3, 1); assertEquals("One node deleted => size-1", size - 1, tdaSize()); assertEntrysEqual(0, 0, 3); assertEntrysEqual(4, 3, size - 4); closeAndReload(); assertEquals("One node deleted => size-1", size - 1, tdaSize()); assertEntrysEqual(0, 0, 3); assertEntrysEqual(4, 3, size - 4); } /** * Tests delete at beginning. */ @Test public void deleteAtBeginning() { tda.delete(0, 3); assertEquals("Three nodes deleted => size-3", size - 3, tdaSize()); assertEntrysEqual(3, 0, size - 3); closeAndReload(); assertEquals("Three nodes deleted => size-3", size - 3, tdaSize()); assertEntrysEqual(3, 0, size - 3); } /** * Tests delete at end. */ @Test public void deleteAtEnd() { tda.delete(size - 3, 3); assertEquals("Three nodes deleted => size-3", size - 3, tdaSize()); assertEntrysEqual(0, 0, size - 3); closeAndReload(); assertEquals("Three nodes deleted => size-3", size - 3, tdaSize()); assertEntrysEqual(0, 0, size - 3); } /** * Deletes first block. */ @Test public void deleteFirstBlock() { tda.delete(0, nodes); assertEquals(blocks - 1, tdaBlocks()); assertEntrysEqual(nodes, 0, size - nodes); closeAndReload(); assertEquals(blocks - 1, tdaBlocks()); assertEntrysEqual(nodes, 0, size - nodes); } /** * Deletes the second block. */ @Test public void deleteSecondBlock() { tda.delete(nodes, nodes); assertEquals(blocks - 1, tdaBlocks()); assertEntrysEqual(0, 0, nodes); assertEntrysEqual(2 * nodes, nodes, size - 2 * nodes); closeAndReload(); assertEquals(blocks - 1, tdaBlocks()); assertEntrysEqual(0, 0, nodes); assertEntrysEqual(2 * nodes, nodes, size - 2 * nodes); } /** * Deletes the last block. */ @Test public void deleteLastBlock() { tda.delete(size / nodes * nodes, size % nodes); assertEquals(blocks - 1, tdaBlocks()); assertEntrysEqual(0, 0, nodes - size % nodes); closeAndReload(); assertEquals(blocks - 1, tdaBlocks()); assertEntrysEqual(0, 0, nodes - size % nodes); } /** * Deletes the second block with some surrounding nodes. */ @Test public void deleteSecondBlockAndSurroundingNodes() { tda.delete(nodes - 1, nodes + 2); assertEquals(size - 2 - nodes, tdaSize()); assertEquals(blocks - 1, tdaBlocks()); assertEntrysEqual(0, 0, nodes - 1); assertEntrysEqual(2 * nodes + 1, nodes - 1, size - 2 * nodes - 1); closeAndReload(); assertEquals(size - 2 - nodes, tdaSize()); assertEquals(blocks - 1, tdaBlocks()); assertEntrysEqual(0, 0, nodes - 1); assertEntrysEqual(2 * nodes + 1, nodes - 1, size - 2 * nodes - 1); } /** * Tests basic insertion. */ @Test public void simpleInsert() { tda.insert(4, getTestEntries(1)); assertEquals(size + 1, tdaSize()); assertEntrysEqual(0, 0, 4); assertAreInserted(4, 1); assertEntrysEqual(4, 5, size - 4); closeAndReload(); assertEquals(size + 1, tdaSize()); assertEntrysEqual(0, 0, 4); assertAreInserted(4, 1); assertEntrysEqual(4, 5, size - 4); } /** * Tests inserting multiple entries. */ @Test public void insertMultiple() { tda.insert(4, getTestEntries(3)); assertEquals(size + 3, tdaSize()); assertEntrysEqual(0, 0, 4); assertAreInserted(4, 3); assertEntrysEqual(4, 7, size - 4); closeAndReload(); assertEquals(size + 3, tdaSize()); assertEntrysEqual(0, 0, 4); assertAreInserted(4, 3); assertEntrysEqual(4, 7, size - 4); } /** * Tests inserting multiple entries. */ @Test public void insertMany() { tda.insert(4, getTestEntries(nodes - 1)); assertEquals(size + nodes - 1, tdaSize()); assertEntrysEqual(0, 0, 4); assertAreInserted(4, nodes - 1); assertEntrysEqual(4, 4 + nodes - 1, size - 4); closeAndReload(); assertEquals(size + nodes - 1, tdaSize()); assertEntrysEqual(0, 0, 4); assertAreInserted(4, nodes - 1); assertEntrysEqual(4, 4 + nodes - 1, size - 4); } /** * Tests inserting multiple entries. */ @Test public void insertAtBlockBoundary() { tda.insert(nodes, getTestEntries(nodes)); assertEquals(size + nodes, tdaSize()); assertEquals(blocks + 1, tdaBlocks()); assertEntrysEqual(0, 0, nodes); assertAreInserted(nodes, nodes); assertEntrysEqual(nodes, 2 * nodes, size - nodes); closeAndReload(); assertEquals(size + nodes, tdaSize()); assertEquals(blocks + 1, tdaBlocks()); assertEntrysEqual(0, 0, nodes); assertAreInserted(nodes, nodes); assertEntrysEqual(nodes, 2 * nodes, size - nodes); } /** * Asserts that the chosen entries are inserted by a test case. * @param startNum first entry * @param count number of entries */ private void assertAreInserted(final int startNum, final int count) { for(int i = 0; i < count; ++i) for(int j = 0; j < 1 << IO.NODEPOWER; ++j) assertEquals(5, tda.read1(startNum + i, j)); } /** * Creates a test-byte array containing the specified number of entries. * All bytes are set to (byte) 5. * @param e number of entries to create * @return byte array containing the number of entries (all bytes 5) */ private static byte[] getTestEntries(final int e) { final byte[] result = new byte[e << IO.NODEPOWER]; for(int i = 0; i < result.length; ++i) result[i] = 5; return result; } } basex-7.7.2/basex-core/src/test/java/org/basex/test/data/IdPreMapBulkFixedTest.java000066400000000000000000000062041222453003200300660ustar00rootroot00000000000000package org.basex.test.data; import org.junit.*; /** * Fixed ID -> PRE mapping tests. * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ public final class IdPreMapBulkFixedTest extends IdPreMapBulkTestBase { /** Set-up method. */ @Before @Override public void setUp() { baseid = 4; opcount = 10; super.setUp(); } /** Insert test. */ @Test public void insert1() { insert(5, 6, 2); insert(4, 8, 2); check(); } /** Insert test. */ @Test public void insert2() { insert(1, 6, 2); insert(2, 8, 2); insert(5, 10, 2); check(); } /** Insert test. */ @Test public void insert3() { insert(5, 6, 3); insert(4, 9, 2); insert(9, 11, 3); check(); } /** Delete test. */ @Test public void delete1() { insertRecords(); delete(3, -10); check(); } /** Delete test. */ @Test public void delete2() { insertRecords(); delete(4, -8); check(); } /** Delete test. */ @Test public void delete3() { insertRecords(); delete(4, -7); check(); } /** Delete test. */ @Test public void delete4() { insertRecords(); delete(3, -9); check(); } /** Delete test. */ @Test public void delete5() { insertRecords(); delete(4, -2); check(); } /** Delete test. */ @Test public void delete6() { insertRecords(); delete(4, -3); check(); } /** Delete test. */ @Test public void delete7() { insertRecords(); delete(2, -4); check(); } /** Delete test. */ @Test public void delete8() { insertRecords(); delete(2, -5); check(); } /** Delete test. */ @Test public void delete9() { insertRecords(); delete(2, -2); check(); } /** Delete test. */ @Test public void delete10() { insertRecords(); delete(2, -3); check(); } /** Delete test. */ @Test public void delete11() { insertRecords(); delete(3, -2); check(); } /** Delete test. */ @Test public void delete12() { insertRecords(); delete(6, -2); check(); } /** Delete test. */ @Test public void delete13() { insertRecords(); delete(8, -2); check(); } /** Delete test. */ @Test public void delete14() { insertRecords(); delete(1, -7); check(); } /** Delete test. */ @Test public void delete15() { insertRecords(); delete(3, -1); check(); } /** Delete test. */ @Test public void delete16() { insertRecords(); delete(2, -1); check(); } /** Delete test. */ @Test public void delete17() { insertRecords(); delete(1, -2); check(); } /** Delete test. */ @Test public void delete18() { insertRecords(); delete(1, -11); check(); } /** Delete test. */ @Test public void delete19() { insertRecords(); delete(6, -8); check(); } /** Delete test. */ @Test public void delete20() { insertRecords(); delete(12, -3); check(); } /** Delete test. */ @Test public void delete21() { delete(1, -2); delete(2, -1); check(); } /** Delete test. */ @Test public void delete22() { delete(2, -2); delete(2, -1); check(); } /** Delete test. */ @Test public void delete23() { delete(0, -2); delete(0, -2); check(); } /** Delete test. */ @Test public void delete24() { delete(1, -1); delete(2, -1); check(); } /** Insert some records. */ private void insertRecords() { insert(4, 5, 4); insert(5, 9, 1); insert(2, 10, 2); insert(2, 12, 3); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/data/IdPreMapBulkTest.java000066400000000000000000000056401222453003200271110ustar00rootroot00000000000000package org.basex.test.data; import java.util.*; import org.junit.*; /** * ID -> PRE mapping test. * * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ public final class IdPreMapBulkTest extends IdPreMapBulkTestBase { /** Random number generator. */ private static final Random RANDOM = new Random(); /** Maximal number of bulk inserted/deleted records. */ private static final int BULK = 50; /** Number of times to repeat each test. */ private static final int ITER = 20; /** Set-up method. */ @Before @Override public void setUp() { baseid = 200; opcount = 100; super.setUp(); } /** * Bulk insert correctness: insert random number of values at random * positions. */ @Test public void bulkInsertCorrectness() { for(int k = 0; k < ITER; ++k) { setUp(); for(int c, id = baseid + 1, i = 0; i < opcount; i += c) { c = RANDOM.nextInt(BULK) + 1; insert(RANDOM.nextInt(id), id, c); check(); id += c; } } } /** Delete correctness: delete values at random positions. */ @Test public void bulkDeleteCorrectness() { for(int k = 0; k < ITER; ++k) { setUp(); for(int id = baseid; id > 0;) { final int deleteid = RANDOM.nextInt(id); // we don't want to delete more records than already exist: final int c = -Math.min(id - deleteid, RANDOM.nextInt(BULK) + 1); delete(deleteid, c); check(); id += c; } } } /** Delete correctness: delete values at random positions. */ @Test public void bulkDeleteCorrectness2() { for(int k = 0; k < ITER; ++k) { setUp(); int n = baseid + 1; for(int i = 0; i < opcount; ++i) { final int c = RANDOM.nextInt(BULK) + 1; insert(RANDOM.nextInt(n), n, c); check(); n += c; } check(); while(n > 0) { final int pre = RANDOM.nextInt(n); // we don't want to delete more records than already exist: final int c = -Math.min(n - pre, RANDOM.nextInt(BULK) + 1); try { delete(pre, c); check(); } catch(final ArrayIndexOutOfBoundsException ex) { dump(); throw ex; } n += c; } } } /** Correctness: randomly insert/delete value at random positions. */ @Test public void bulkInsertDeleteCorrectness() { for(int k = 0; k < ITER; ++k) { setUp(); for(int i = 0, n = baseid, id = baseid + 1; i < opcount; ++i) { final int pre = RANDOM.nextInt(n + 1); final int c; // can't delete if all records have been deleted: if(RANDOM.nextBoolean() || n == 0) { c = RANDOM.nextInt(BULK) + 1; insert(pre, id, c); id += c; } else { c = -Math.min(n - pre, RANDOM.nextInt(BULK) + 1); if(c != 0) delete(pre, c); } check(); n += c; } } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/data/IdPreMapBulkTestBase.java000066400000000000000000000076741222453003200277150ustar00rootroot00000000000000package org.basex.test.data; import static org.junit.Assert.*; import java.util.*; import org.basex.index.*; import org.basex.util.*; import org.junit.*; /** * Base class with common functionality for all ID -> PRE mapping tests. * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ public abstract class IdPreMapBulkTestBase { /** Number of update operations to execute in each test. */ int opcount = 7000; /** Initial number of records. */ int baseid = 400; /** ID -> PRE map to compare to. */ private DummyIdPreMap basemap; /** ID -> PRE map to test. */ private IdPreMap testedmap; /** Sequence of performed operations and parameters. */ private ArrayList ops; /** Set-up method. */ @Before public void setUp() { final int[] map = new int[baseid + 1]; for(int i = 0; i < map.length; ++i) map[i] = i; basemap = new DummyIdPreMap(map); testedmap = new IdPreMap(baseid); ops = new ArrayList(baseid + opcount); } /** * Insert a <pre, id> pair in {@link #basemap} and {@link #testedmap}. * @param pre pre value * @param id id value * @param c number of inserted records */ final void insert(final int pre, final int id, final int c) { ops.add(new int[] { pre, id, c}); testedmap.insert(pre, id, c); basemap.insert(pre, id, c); } /** * Delete a <pre, id> pair from {@link #basemap} and {@link #testedmap}. * @param pre pre value * @param c number of deleted records */ final void delete(final int pre, final int c) { ops.add(new int[] { pre, basemap.id(pre), c}); testedmap.delete(pre, basemap.id(pre), c); basemap.delete(pre, basemap.id(pre), c); } /** Check the two mappings. */ final void check() { for(int pre = 0; pre < basemap.size(); pre++) { final int id = basemap.id(pre); final int p = testedmap.pre(id); if(pre != p) { dump(); fail("Wrong PRE for ID=" + id + ": expected " + pre + ", actual " + p); } } } /** Print inserted and deleted records and the tested map. */ final void dump() { final StringBuilder s = new StringBuilder(); for(final int[] o : ops) { s.append(o[2] > 0 ? "insert(" : "delete("); s.append(o[0]); s.append(','); s.append(o[1]); s.append(','); s.append(o[2]); s.append(");\n"); } Util.errln("Operations:\n" + s); Util.errln(testedmap); } /** * Dummy implementation of ID -> PRE map: very slow, but simple and correct. * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ protected static class DummyIdPreMap extends IdPreMap { /** ID list. */ private final ArrayList idlist; /** * Constructor. * @param list initial list of ids. */ public DummyIdPreMap(final int[] list) { super(list.length - 1); idlist = new ArrayList(list.length); for(final int l : list) idlist.add(l); } @Override public void insert(final int pre, final int id, final int c) { for(int i = 0; i < c; ++i) idlist.add(pre + i, id + i); } @Override public void delete(final int pre, final int id, final int c) { for(int i = 0; i < -c; ++i) idlist.remove(pre); } @Override public int pre(final int id) { return idlist.indexOf(id); } @Override public int size() { return idlist.size(); } /** * ID of the record with a given PRE. * @param pre record PRE * @return record ID */ public int id(final int pre) { return idlist.get(pre); } @Override public String toString() { final StringBuilder spres = new StringBuilder(); final StringBuilder sids = new StringBuilder(); for(int i = 0; i < idlist.size(); ++i) { spres.append(i); spres.append(' '); sids.append(idlist.get(i)); sids.append(' '); } return spres.append('\n').append(sids).toString(); } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/data/IdPreMapTest.java000066400000000000000000000200221222453003200262620ustar00rootroot00000000000000package org.basex.test.data; import static org.junit.Assert.*; import java.util.*; import org.basex.index.*; import org.basex.util.*; import org.basex.util.list.*; import org.junit.*; /** * ID -> PRE mapping test. * * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ public final class IdPreMapTest { /** Verbose flag. */ private static final boolean VERBOSE = false; /** Number of update operations to execute in each test. */ private static final int ITERATIONS = 200; /** Initial number of records. */ private static final int BASEID = 2000; /** Random number generator. */ private static final Random RANDOM = new Random(); /** ID -> PRE map to compare to. */ private DummyIdPreMap basemap; /** ID -> PRE map to test. */ private IdPreMap testedmap; /** Sequence of inserted PRE values. */ private IntList insertedpres; /** Sequence of deleted PRE values. */ private IntList deletedpres; /** Set-up method. */ @Before public void setUp() { final int[] map = new int[BASEID + 1]; for(int i = 0; i < map.length; ++i) map[i] = i; basemap = new DummyIdPreMap(map); testedmap = new IdPreMap(BASEID); insertedpres = new IntList(ITERATIONS); deletedpres = new IntList(ITERATIONS); } /** Insert correctness: insert values at at the end. */ @Test public void appendCorrectness() { final int n = BASEID + ITERATIONS; for(int id = BASEID + 1; id <= n; ++id) { insert(id, id); check(); } } /** Insert correctness: insert values at at the end. */ @Test public void deleteFromEndCorrectness() { for(int id = BASEID; id >= 0; --id) { delete(id); check(); } } /** Insert correctness: insert values at random positions. */ @Test public void insertCorrectness() { final int n = BASEID + ITERATIONS; for(int id = BASEID + 1; id <= n; ++id) { insert(RANDOM.nextInt(id), id); check(); } } /** Delete correctness: delete values at random positions. */ @Test public void deleteCorrectness() { for(int id = BASEID + 1; id > 0; --id) { delete(RANDOM.nextInt(id)); check(); } } /** Delete correctness: delete values at random positions. */ @Test public void deleteCorrectness2() { final int n = BASEID + ITERATIONS; for(int id = BASEID + 1; id <= n; ++id) insert(RANDOM.nextInt(id), id); for(int id = n; id > 0; --id) { delete(RANDOM.nextInt(id)); check(); } } /** Correctness: randomly insert/delete value at random positions. */ @Test public void insertDeleteCorrectness() { for(int i = 0, cnt = BASEID + 1, id = BASEID + 1; i < ITERATIONS; ++i) { // can't delete if all records have been deleted: if(RANDOM.nextBoolean() || cnt == 0) insert(RANDOM.nextInt(++cnt), id++); else delete(RANDOM.nextInt(cnt--)); check(); } } /** Insert performance: insert at random positions. */ @Test public void insertPerformance() { if(VERBOSE) Util.err("Tested mapping: "); insertPerformance(testedmap); } /** Delete performance: delete at random positions. */ @Test public void deletePerformance() { if(VERBOSE) Util.err("Tested mapping: "); deletePerformance(testedmap, basemap); } /** Search performance: insert at random positions and the search. */ @Test public void searchPerformance() { if(VERBOSE) Util.err("Tested mapping: "); searchPerformance(testedmap); } /** Dummy insert performance: insert at random positions. */ @Test public void insertPerformanceDummy() { if(VERBOSE) Util.err("Dummy mapping: "); insertPerformance(basemap); } /** Dummy delete performance: delete at random positions. */ @Test public void deletePerformanceDummy() { if(VERBOSE) Util.err("Dummy mapping: "); deletePerformance(basemap, basemap.copy()); } /** Dummy search performance: insert at random positions and the search. */ @Test public void searchPerformanceDummy() { if(VERBOSE) Util.err("Dummy mapping: "); searchPerformance(basemap); } /** * Insert performance: insert at random positions. * @param m tested map */ private static void insertPerformance(final IdPreMap m) { // prepare pairs: final int[][] d = new int[ITERATIONS][2]; for(int i = 0, id = BASEID + 1; i < d.length; ++id, ++i) { d[i][0] = RANDOM.nextInt(id); d[i][1] = id; } // perform the actual test: final Performance p = new Performance(); for(final int[] a : d) m.insert(a[0], a[1], 1); if(VERBOSE) Util.errln(d.length + " records inserted in: " + p); } /** * Delete performance: delete at random positions. * @param m tested map * @param b base map */ private static void deletePerformance(final IdPreMap m, final DummyIdPreMap b) { // prepare pairs: final int[][] d = new int[BASEID + 1][2]; for(int i = 0, id = BASEID + 1; i < d.length; --id, ++i) { d[i][0] = RANDOM.nextInt(id); d[i][1] = b.id(d[i][0]); b.delete(d[i][0], d[i][1], -1); } // perform the test: final Performance p = new Performance(); for(final int[] dd : d) m.delete(dd[0], dd[1], -1); if(VERBOSE) Util.errln(d.length + " records deleted in: " + p); } /** * Search performance: insert at random positions and then search. * @param m tested map */ private static void searchPerformance(final IdPreMap m) { final int n = BASEID + ITERATIONS; for(int id = BASEID + 1; id <= n; ++id) m.insert(RANDOM.nextInt(id), id, 1); final Performance p = new Performance(); for(int i = 0; i < n; ++i) m.pre(i); if(VERBOSE) Util.errln(n + " records found in: " + p); } /** * Insert a <pre, id> pair in {@link #basemap} and {@link #testedmap}. * @param pre pre value * @param id id value */ private void insert(final int pre, final int id) { insertedpres.add(pre); //if(VERBOSE) Util.errln("insert(" + pre + ", " + id + ")"); testedmap.insert(pre, id, 1); //if(VERBOSE) Util.errln(testedmap); basemap.insert(pre, id, 1); } /** * Delete a <pre, id> pair from {@link #basemap} and {@link #testedmap}. * @param pre pre value */ private void delete(final int pre) { deletedpres.add(pre); //if(VERBOSE) Util.errln("delete(" + pre + ", " + basemap.id(pre) + ")"); testedmap.delete(pre, basemap.id(pre), -1); //if(VERBOSE) Util.errln(testedmap); basemap.delete(pre, basemap.id(pre), -1); } /** Check the two mappings. */ private void check() { for(int pre = 0; pre < basemap.size(); pre++) { final int id = basemap.id(pre); final int p = testedmap.pre(id); if(pre != p) fail("Wrong PRE for ID = " + id + ": expected " + pre + ", actual " + p + "\nInserted PREs: " + insertedpres + "\nDelete PREs: " + deletedpres); } } /** * Dummy implementation of ID -> PRE map: very slow, but simple and correct. * @author Dimitar Popov */ private static class DummyIdPreMap extends IdPreMap { /** ID list. */ private final ArrayList ids; /** * Constructor. * @param i initial list of ids. */ DummyIdPreMap(final int[] i) { super(i.length - 1); ids = new ArrayList(i.length); for(final int id : i) ids.add(id); } @Override public void insert(final int pre, final int id, final int c) { ids.add(pre, id); } @Override public void delete(final int pre, final int id, final int c) { ids.remove(pre); } @Override public int pre(final int id) { return ids.indexOf(id); } @Override public int size() { return ids.size(); } /** * ID of the record with a given PRE. * @param pre record PRE * @return record ID */ int id(final int pre) { return ids.get(pre); } /** * Create a copy of the current object. * @return deep copy of the object */ DummyIdPreMap copy() { final int[] a = new int[ids.size()]; for(int i = size() - 1; i >= 0; --i) a[i] = ids.get(i); return new DummyIdPreMap(a); } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/data/MemDataTest.java000066400000000000000000000072041222453003200261400ustar00rootroot00000000000000package org.basex.test.data; import static org.junit.Assert.*; import java.io.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.io.*; import org.basex.test.*; import org.basex.util.*; import org.junit.*; /** * Test index updates when using memory storage ({@link MemData}). * * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ public class MemDataTest extends SandboxTest { /** XML document. */ static final String XMLSTR = "testtest1test3"; /** XML document. */ private static final byte[] XML = Token.token(XMLSTR); /** Tested {@link MemData} instance. */ private Data data; /** * Set up method; executed before each test. * @throws IOException should never be thrown */ @Before public void setUp() throws IOException { data = CreateDB.mainMem(new IOContent(XML), context); context.openDB(data); } /** Clean up method; executed after each test. */ @After public void end() { context.closeDB(); data = null; } /** * Replace value update test. * @throws BaseXException query exception */ @Test public void replaceValue() throws BaseXException { new XQuery("replace value of node /a/b with 'test2'").execute(context); final String o = new XQuery("/a/b[text() = 'test']").execute(context); assertTrue("Old node found", o.isEmpty()); final String n = new XQuery("/a/b[text() = 'test2']").execute(context); assertFalse("New node not found", n.isEmpty()); } /** * Replace node update test. * @throws BaseXException query exception */ @Test public void replaceNode() throws BaseXException { new XQuery("replace node /a/b with ").execute(context); final String o = new XQuery("/a/b").execute(context); assertTrue("Old node found", o.isEmpty()); final String n = new XQuery("//d[@f = 'test2']").execute(context); assertFalse("New node not found", n.isEmpty()); } /** * Insert node update test. * @throws BaseXException query exception */ @Test public void insertNode() throws BaseXException { new XQuery("insert node test2 as first into /a").execute(context); final String r = new XQuery("//d[text() = 'test2']").execute(context); assertFalse("Node not found", r.isEmpty()); new XQuery("insert node test2 as first into /a").execute(context); final String c = new XQuery("count(//d[text() = 'test2'])").execute(context); assertEquals("Second node not found", 2, Integer.parseInt(c)); } /** * Insert node update test. * @throws BaseXException query exception */ @Test public void insertDuplicateNode() throws BaseXException { new XQuery("insert node test as first into /a").execute(context); final String r = new XQuery("//d[text() = 'test']").execute(context); assertFalse("Node not found", r.isEmpty()); final String c = new XQuery("count(//*[text() = 'test'])").execute(context); assertEquals("Second node not found", 2, Integer.parseInt(c)); } /** * Delete node update test. * @throws BaseXException query exception */ @Test public void deleteNode() throws BaseXException { new XQuery("delete node //b").execute(context); final String r = new XQuery("//*[text() = 'test']").execute(context); assertTrue("Node not deleted", r.isEmpty()); } /** * Try to find non-existing node. * @throws BaseXException query exception */ @Test public void findNonexistingNode() throws BaseXException { final String r = new XQuery("//*[text() = 'test0']").execute(context); assertTrue("Found non-existing node", r.isEmpty()); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/data/StoreTest.java000066400000000000000000000075361222453003200257340ustar00rootroot00000000000000package org.basex.test.data; import static org.junit.Assert.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.test.*; import org.junit.*; /** * This class tests the stability of the database text store. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class StoreTest extends SandboxTest { /** Number of runs per client. */ private static final int NQUERIES = 100; /** * Initializes the test. * @throws Exception exception */ @BeforeClass public static void init() throws Exception { // speed up updates and create initial database run(new Set(Prop.TEXTINDEX, false)); run(new Set(Prop.ATTRINDEX, false)); run(new Set(Prop.AUTOFLUSH, false)); } /** * Finishes the test. * @throws BaseXException database exception */ @AfterClass public static void finish() throws BaseXException { run(new DropDB(NAME)); run(new Set(Prop.TEXTINDEX, true)); run(new Set(Prop.ATTRINDEX, true)); run(new Set(Prop.AUTOFLUSH, true)); run(new Set(Prop.UPDINDEX, false)); } /** * Replaces text nodes with random double values. * @throws BaseXException database exception */ @Test public void replace() throws BaseXException { run(new CreateDB(NAME, "qq")); final long size = context.data().meta.dbfile(DataText.DATATXT).length(); for(int n = 0; n < NQUERIES; n++) { final String qu = "for $a in //text() " + "let $d := random:double() " + "return replace node $a with $d"; run(new XQuery(qu)); } check(size); } /** * Replaces two text nodes with random integer values. * @throws BaseXException database exception */ @Test public void deleteInsertTwo() throws BaseXException { run(new CreateDB(NAME, "qq")); final long size = context.data().meta.dbfile(DataText.DATATXT).length(); for(int n = 0; n < NQUERIES; n++) { String qu = "for $a in //text() return delete node $a"; run(new XQuery(qu)); qu = "for $a in //text() " + "let $d := random:integer(" + Integer.MAX_VALUE + ") " + "return insert node $a into $d"; run(new XQuery(qu)); } check(size); } /** * Deletes and inserts a text multiple times. * @throws BaseXException database exception */ @Test public void deleteInsert() throws BaseXException { run(new CreateDB(NAME, "abc")); final long size = context.data().meta.dbfile(DataText.DATATXT).length(); for(int i = 0; i < NQUERIES; i++) { run(new XQuery("delete node //text()")); run(new XQuery("insert node 'abc' into /X")); } check(size); } /** * Tests the {@link Prop#UPDINDEX} and {@link Prop#AUTOFLUSH} flags in combination. * Reaction on a bug (incremental value index was not correctly closed) * @throws BaseXException database exception */ @Test public void updIndexFlush() throws BaseXException { run(new Set(Prop.TEXTINDEX, true)); run(new Set(Prop.AUTOFLUSH, false)); run(new Set(Prop.UPDINDEX, true)); run(new CreateDB(NAME)); final String input = "0"; run(new Add("a.xml", input)); final String query = "doc('" + NAME + "')//*[text()='0']"; assertEquals(input, run(new XQuery(query))); run(new Close()); assertEquals(input, run(new XQuery(query))); } /** * Tests if the size of the text store has not changed. * @param old old size */ private static void check(final long old) { assertEquals(old, context.data().meta.dbfile(DataText.DATATXT).length()); } /** * Runs the specified command. * @param cmd command to be run * @return string result * @throws BaseXException database exception */ private static String run(final Command cmd) throws BaseXException { return cmd.execute(context); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/data/TableTest.java000066400000000000000000000035301222453003200256550ustar00rootroot00000000000000package org.basex.test.data; import static org.junit.Assert.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.io.*; import org.basex.test.*; import org.junit.*; /** * This class tests the stability of the data storage. * * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ public final class TableTest extends SandboxTest { /** Database XML file. */ private static final String DBFILE = "src/test/resources/factbook.zip"; /** Select Germany. */ private static final String SELECT = "//country[@name='Germany']"; /** Delete Germany. */ private static final String DELETE = "delete node " + SELECT; /** Re-insert Germany. */ private static final String INSERT = "insert node %1$s " + "after //country[@name='France']"; /** Table file. */ private IOFile tbl; /** * Set up method. * @throws BaseXException exception during creation of database */ @Before public void setUp() throws BaseXException { new CreateDB(NAME, DBFILE).execute(context); tbl = context.data().meta.dbfile(DataText.DATATBL); } /** * Drops the JUnitTest database. * @throws BaseXException exception during drop of database */ @After public void tearDown() throws BaseXException { new DropDB(NAME).execute(context); } /** * Test if the size of the table remains constant after insertion, deletion, * and re-insertion of the same record. * @throws BaseXException exception during query execution */ @Test public void tableSize() throws BaseXException { final long s = tbl.length(); final String n = new XQuery(SELECT).execute(context); new XQuery(DELETE).execute(context); new XQuery(String.format(INSERT, n)).execute(context); new Close().execute(context); assertEquals("Database size changed: ", s, tbl.length()); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/data/UpdateTest.java000066400000000000000000000053351222453003200260550ustar00rootroot00000000000000package org.basex.test.data; import static org.basex.util.Token.*; import static org.junit.Assert.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.test.*; import org.basex.util.*; import org.junit.*; /** * This class tests the update features of the {@link Data} class. * * @author BaseX Team 2005-12, BSD License * @author Tim Petrowsky */ public abstract class UpdateTest extends SandboxTest { /** Test file we do updates with. */ private static final String TESTFILE = "src/test/resources/test.xml"; /** Main memory flag; can be changed for testing. */ private static boolean mainmem; /** JUnit tag. */ static final byte[] T_JUNIT = token("junit"); /** JUnit tag. */ static final byte[] T_FOO = token("foo"); /** JUnit tag. */ static final byte[] T_NAME = token("name"); /** JUnit tag. */ static final byte[] T_PARENTNODE = token("parentnode"); /** JUnit tag. */ static final byte[] T_CONTEXTNODE = token("contextnode"); /** JUnit tag. */ static final byte[] T_ID = token("id"); /** JUnit tag. */ static final byte[] T_B = token("b"); /** Test file size in nodes. */ int size; /** * Initializes the test class. */ @BeforeClass public static void setUpBeforeClass() { final Prop prop = context.prop; prop.set(Prop.TEXTINDEX, false); prop.set(Prop.ATTRINDEX, false); prop.set(Prop.MAINMEM, mainmem); } /** * Creates the database. */ @Before public final void setUp() { exec(new CreateDB(NAME, TESTFILE)); size = context.data().meta.size; } /** * Deletes the test database. */ @After public final void tearDown() { if(mainmem) return; exec(new Close()); exec(new DropDB(NAME)); } /** * Reloads the database. */ static final void reload() { if(mainmem) return; exec(new Close()); exec(new Open(NAME)); } /** * Tests byte-arrays for equality. * @param exp expected value * @param act actual value */ static final void assertArraysEquals(final byte[] exp, final byte[] act) { assertEquals("array lengths don't equal", exp.length, act.length); for(int i = 0; i < exp.length; ++i) assertEquals(exp[i], act[i]); } /** * Tests for correct data size. */ @Test public final void size() { assertEquals("Unexpected size!", size, context.data().meta.size); reload(); assertEquals("Unexpected size!", size, context.data().meta.size); } /** * Executes the specified command. Gives feedback and stops the test * if errors occur. * @param cmd command reference */ private static void exec(final Command cmd) { try { cmd.execute(context); } catch(final BaseXException ex) { Util.errln(ex); } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/data/UpdateTestAttributes.java000066400000000000000000000055121222453003200301210ustar00rootroot00000000000000package org.basex.test.data; import static org.junit.Assert.*; import org.basex.data.*; import org.basex.data.atomic.*; import org.basex.util.*; import org.junit.*; /** * This class tests the update features of the {@link Data} class. * * @author BaseX Team 2005-12, BSD License * @author Tim Petrowsky */ public final class UpdateTestAttributes extends UpdateTest { /** * Tests the update of an existing attribute. */ @Test public void updateAttribute() { final Data data = context.data(); data.startUpdate(); data.update(7, Data.ATTR, T_NAME, Token.EMPTY); data.update(7, Data.ATTR, T_JUNIT); data.finishUpdate(); assertEquals(size, data.meta.size); assertArraysEquals(T_NAME, data.name(7, Data.ATTR)); assertArraysEquals(T_JUNIT, data.text(7, false)); reload(); assertEquals(size, data.meta.size); assertArraysEquals(T_NAME, data.name(7, Data.ATTR)); assertArraysEquals(T_JUNIT, data.text(7, false)); } /** * Tests the update of an existing attribute. */ @Test public void updateAttribute2() { final Data data = context.data(); data.startUpdate(); data.update(8, Data.ATTR, T_NAME, Token.EMPTY); data.update(8, Data.ATTR, T_JUNIT); data.finishUpdate(); assertEquals(size, data.meta.size); assertArraysEquals(T_JUNIT, data.text(8, false)); reload(); assertEquals(size, data.meta.size); assertArraysEquals(T_JUNIT, data.text(8, false)); } /** * Tests the insertion of a new attribute. */ @Test public void addAttribute() { final Data data = context.data(); final long nextid = data.meta.lastid; final MemData md = new MemData(context.data()); md.attr(0, 1, data.atnindex.index(T_FOO, null, false), T_JUNIT, 0, false); md.insert(0); data.startUpdate(); data.insertAttr(9, 6, new DataClip(md)); data.finishUpdate(); assertEquals(size + 1, data.meta.size); assertEquals(size + 1, data.size(0, Data.DOC)); assertEquals(Data.ATTR, data.kind(9)); assertEquals(6, data.parent(9, Data.ATTR)); assertEquals(6, data.parent(8, Data.ATTR)); assertEquals(6, data.parent(10, Data.ELEM)); assertEquals(10, data.parent(11, Data.TEXT)); assertEquals(nextid + 1, data.meta.lastid); assertArraysEquals(T_FOO, data.name(9, Data.ATTR)); assertArraysEquals(T_JUNIT, data.text(9, false)); reload(); assertEquals(size + 1, data.meta.size); assertEquals(size + 1, data.size(0, Data.DOC)); assertEquals(Data.ATTR, data.kind(9)); assertEquals(6, data.parent(9, Data.ATTR)); assertEquals(6, data.parent(8, Data.ATTR)); assertEquals(6, data.parent(10, Data.ELEM)); assertEquals(10, data.parent(11, Data.TEXT)); assertEquals(nextid + 1, data.meta.lastid); assertArraysEquals(T_FOO, data.name(9, Data.ATTR)); assertArraysEquals(T_JUNIT, data.text(9, false)); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/data/UpdateTestDeletes.java000066400000000000000000000111451222453003200273570ustar00rootroot00000000000000package org.basex.test.data; import static org.junit.Assert.*; import org.basex.data.*; import org.junit.*; /** * This class tests the update features of the {@link Data} class. * * @author BaseX Team 2005-12, BSD License * @author Tim Petrowsky */ public final class UpdateTestDeletes extends UpdateTest { /** * Tests deletion of a simple node. */ @Test public void simpleNodeDelete() { final Data data = context.data(); final int oldDocSize = data.size(0, Data.DOC); final int oldRootSize = data.size(1, Data.ELEM); final int oldParSize = data.size(2, Data.ELEM); data.startUpdate(); data.delete(3); data.finishUpdate(); assertEquals(size - 1, data.meta.size); assertArraysEquals(T_PARENTNODE, data.name(3, Data.ELEM)); assertEquals(oldDocSize - 1, data.size(0, Data.DOC)); assertEquals(oldRootSize - 1, data.size(1, Data.ELEM)); assertEquals(oldParSize - 1, data.size(2, Data.ELEM)); assertEquals(1, data.parent(3, Data.ELEM)); reload(); assertEquals(size - 1, data.meta.size); assertArraysEquals(T_PARENTNODE, data.name(3, Data.ELEM)); assertEquals(oldDocSize - 1, data.size(0, Data.DOC)); assertEquals(oldRootSize - 1, data.size(1, Data.ELEM)); assertEquals(oldParSize - 1, data.size(2, Data.ELEM)); assertEquals(1, data.parent(3, Data.ELEM)); } /** * Tests deletion of a node with a child. */ @Test public void cascadingDelete() { final Data data = context.data(); final int oldDocSize = data.size(0, Data.DOC); final int oldRootSize = data.size(1, Data.ELEM); data.startUpdate(); data.delete(2); data.finishUpdate(); assertEquals(size - 2, data.meta.size); assertArraysEquals(T_PARENTNODE, data.name(2, Data.ELEM)); assertEquals(oldDocSize - 2, data.size(0, Data.DOC)); assertEquals(oldRootSize - 2, data.size(1, Data.ELEM)); assertEquals(1, data.parent(2, Data.ELEM)); reload(); assertEquals(size - 2, data.meta.size); assertArraysEquals(T_PARENTNODE, data.name(2, Data.ELEM)); assertEquals(oldDocSize - 2, data.size(0, Data.DOC)); assertEquals(oldRootSize - 2, data.size(1, Data.ELEM)); assertEquals(1, data.parent(2, Data.ELEM)); } /** * Tests deletion of a node with a child (with text) and attribute. */ @Test public void cascadingDelete2() { final Data data = context.data(); final int oldDocSize = data.size(0, Data.DOC); final int oldRootSize = data.size(1, Data.ELEM); final int oldParentSize = data.size(4, Data.ELEM); data.startUpdate(); data.delete(6); data.finishUpdate(); assertEquals(size - 5, data.meta.size); assertArraysEquals(T_B, data.name(6, Data.ELEM)); assertEquals(oldDocSize - 5, data.size(0, Data.DOC)); assertEquals(oldRootSize - 5, data.size(1, Data.ELEM)); assertEquals(oldParentSize - 5, data.size(4, Data.ELEM)); assertEquals(2, data.parent(3, Data.ELEM)); reload(); assertEquals(size - 5, data.meta.size); assertArraysEquals(T_B, data.name(6, Data.ELEM)); assertEquals(oldDocSize - 5, data.size(0, Data.DOC)); assertEquals(oldRootSize - 5, data.size(1, Data.ELEM)); assertEquals(oldParentSize - 5, data.size(4, Data.ELEM)); assertEquals(2, data.parent(3, Data.ELEM)); } /** * Tests deletion of an attribute. */ @Test public void deleteAttribute() { final Data data = context.data(); final int oldRootSize = data.size(1, Data.ELEM); final int oldParentSize = data.size(6, Data.ELEM); data.startUpdate(); data.delete(7); data.finishUpdate(); assertEquals(size - 1, data.meta.size); assertArraysEquals(T_CONTEXTNODE, data.name(6, Data.ELEM)); assertArraysEquals(T_ID, data.name(7, Data.ATTR)); assertEquals(oldRootSize - 1, data.size(1, Data.ELEM)); assertEquals(oldParentSize - 1, data.size(6, Data.ELEM)); assertEquals(6, data.parent(7, Data.ATTR)); assertEquals(4, data.size(6, Data.ELEM)); reload(); assertEquals(size - 1, data.meta.size); assertArraysEquals(T_CONTEXTNODE, data.name(6, Data.ELEM)); assertArraysEquals(T_ID, data.name(7, Data.ATTR)); assertEquals(oldRootSize - 1, data.size(1, Data.ELEM)); assertEquals(oldParentSize - 1, data.size(6, Data.ELEM)); assertEquals(6, data.parent(7, Data.ATTR)); assertEquals(4, data.size(6, Data.ELEM)); } /** * For the sake of completeness. * Tests deletion of a text-node. */ @Test public void deleteText() { final Data data = context.data(); data.startUpdate(); data.delete(10); data.finishUpdate(); assertEquals(size - 1, data.meta.size); reload(); assertEquals(size - 1, data.meta.size); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/data/UpdateTestTags.java000066400000000000000000000161271222453003200266750ustar00rootroot00000000000000package org.basex.test.data; import static org.junit.Assert.*; import org.basex.data.*; import org.basex.data.atomic.*; import org.basex.util.*; import org.junit.*; /** * This class tests the update features of the {@link Data} class. * * @author BaseX Team 2005-12, BSD License * @author Tim Petrowsky */ public final class UpdateTestTags extends UpdateTest { /** * Tests insert as last child. */ @Test public void insertTagAsOnly1() { final Data data = context.data(); final long nextid = data.meta.lastid; insertTag(3, 0, T_JUNIT, Data.ELEM); assertEquals(size + 1, data.meta.size); assertEquals(3, data.parent(4, Data.ELEM)); assertEquals(Data.ATTR, data.kind(9)); assertEquals(Data.ELEM, data.kind(5)); assertEquals(1, data.parent(5, Data.ELEM)); assertEquals(5, data.parent(6, Data.ELEM)); assertEquals(nextid + 1, data.meta.lastid); assertArraysEquals(T_JUNIT, data.name(4, Data.ELEM)); reload(); assertEquals(size + 1, data.meta.size); assertEquals(3, data.parent(4, Data.ELEM)); assertEquals(Data.ATTR, data.kind(9)); assertEquals(1, data.parent(5, Data.ELEM)); assertEquals(5, data.parent(6, Data.ELEM)); assertEquals(nextid + 1, data.meta.lastid); assertArraysEquals(T_JUNIT, data.name(4, Data.ELEM)); } /** * Tests insert as last child. */ @Test public void insertTagAsOnly2() { final Data data = context.data(); final long nextid = data.meta.lastid; insertTag(3, 1, T_JUNIT, Data.ELEM); assertEquals(size + 1, data.meta.size); assertEquals(3, data.parent(4, Data.ELEM)); assertEquals(Data.ATTR, data.kind(9)); assertEquals(Data.ELEM, data.kind(5)); assertEquals(1, data.parent(5, Data.ELEM)); assertEquals(5, data.parent(6, Data.ELEM)); assertEquals(nextid + 1, data.meta.lastid); assertArraysEquals(T_JUNIT, data.name(4, Data.ELEM)); reload(); assertEquals(size + 1, data.meta.size); assertEquals(3, data.parent(4, Data.ELEM)); assertEquals(Data.ATTR, data.kind(9)); assertEquals(1, data.parent(5, Data.ELEM)); assertEquals(5, data.parent(6, Data.ELEM)); assertEquals(nextid + 1, data.meta.lastid); assertArraysEquals(T_JUNIT, data.name(4, Data.ELEM)); } /** * Tests insert as last child. */ @Test public void insertTagAsOnly3() { final Data data = context.data(); final long nextid = data.meta.lastid; insertTag(3, 2, T_JUNIT, Data.ELEM); assertEquals(size + 1, data.meta.size); assertEquals(3, data.parent(4, Data.ELEM)); assertEquals(Data.ATTR, data.kind(9)); assertEquals(Data.ELEM, data.kind(5)); assertEquals(1, data.parent(5, Data.ELEM)); assertEquals(5, data.parent(6, Data.ELEM)); assertEquals(nextid + 1, data.meta.lastid); assertArraysEquals(T_JUNIT, data.name(4, Data.ELEM)); reload(); assertEquals(size + 1, data.meta.size); assertEquals(3, data.parent(4, Data.ELEM)); assertEquals(Data.ATTR, data.kind(9)); assertEquals(1, data.parent(5, Data.ELEM)); assertEquals(5, data.parent(6, Data.ELEM)); assertEquals(nextid + 1, data.meta.lastid); assertArraysEquals(T_JUNIT, data.name(4, Data.ELEM)); } /** * Tests insert as last child. */ @Test public void insertTagAfterAttsAsFirst() { final Data data = context.data(); final long nextid = data.meta.lastid; insertTag(6, 1, T_JUNIT, Data.ELEM); assertEquals(size + 1, data.meta.size); assertEquals(Data.ELEM, data.kind(9)); assertEquals(6, data.parent(9, Data.ELEM)); assertArraysEquals(T_JUNIT, data.name(9, Data.ELEM)); assertEquals(6, data.parent(10, Data.ELEM)); assertEquals(4, data.parent(12, Data.ELEM)); assertEquals(nextid + 1, data.meta.lastid); reload(); assertEquals(size + 1, data.meta.size); assertEquals(Data.ELEM, data.kind(9)); assertEquals(6, data.parent(9, Data.ELEM)); assertArraysEquals(T_JUNIT, data.name(9, Data.ELEM)); assertEquals(6, data.parent(10, Data.ELEM)); assertEquals(4, data.parent(12, Data.ELEM)); assertEquals(nextid + 1, data.meta.lastid); } /** * Tests insert as last child. */ @Test public void insertTagAfterAttsAsSecond() { final Data data = context.data(); final long nextid = data.meta.lastid; insertTag(6, 2, T_JUNIT, Data.ELEM); assertEquals(size + 1, data.meta.size); assertEquals(Data.ELEM, data.kind(9)); assertArraysEquals(T_JUNIT, data.name(11, Data.ELEM)); assertEquals(6, data.parent(11, Data.ELEM)); assertEquals(6, data.parent(9, Data.ELEM)); assertEquals(4, data.parent(12, Data.ELEM)); assertEquals(nextid + 1, data.meta.lastid); reload(); assertEquals(size + 1, data.meta.size); assertEquals(Data.ELEM, data.kind(9)); assertArraysEquals(T_JUNIT, data.name(11, Data.ELEM)); assertEquals(6, data.parent(11, Data.ELEM)); assertEquals(6, data.parent(9, Data.ELEM)); assertEquals(4, data.parent(12, Data.ELEM)); assertEquals(nextid + 1, data.meta.lastid); } /** * Tests insert as last child. */ @Test public void insertTagAfterAttsAsLast() { final Data data = context.data(); final long nextid = data.meta.lastid; insertTag(6, 0, T_JUNIT, Data.ELEM); assertEquals(size + 1, data.meta.size); assertEquals(Data.ELEM, data.kind(9)); assertArraysEquals(T_JUNIT, data.name(11, Data.ELEM)); assertEquals(6, data.parent(11, Data.ELEM)); assertEquals(6, data.parent(9, Data.ELEM)); assertEquals(4, data.parent(12, Data.ELEM)); assertEquals(nextid + 1, data.meta.lastid); reload(); assertEquals(size + 1, data.meta.size); assertEquals(Data.ELEM, data.kind(9)); assertArraysEquals(T_JUNIT, data.name(11, Data.ELEM)); assertEquals(6, data.parent(11, Data.ELEM)); assertEquals(6, data.parent(9, Data.ELEM)); assertEquals(4, data.parent(12, Data.ELEM)); assertEquals(nextid + 1, data.meta.lastid); } /** * Tests updateTagName. */ @Test public void updateTagName() { final Data data = context.data(); data.startUpdate(); data.update(6, Data.ELEM, T_JUNIT, Token.EMPTY); data.finishUpdate(); assertEquals(Data.ELEM, data.kind(6)); assertArraysEquals(T_JUNIT, data.name(6, Data.ELEM)); reload(); assertEquals(Data.ELEM, data.kind(6)); assertArraysEquals(T_JUNIT, data.name(6, Data.ELEM)); } /** * Inserts a tag. * @param par parent node * @param pos inserting position * @param name tag name * @param kind node kind */ private static void insertTag(final int par, final int pos, final byte[] name, final int kind) { int root; final Data data = context.data(); if(pos == 0) { root = par + data.size(par, kind); } else { int currPos = 1; root = par + data.attSize(par, kind); while(currPos < pos) { final int k = data.kind(root); if(data.parent(root, k) != par) break; root += data.size(root, k); ++currPos; } } final MemData md = new MemData(data); md.elem(1, data.tagindex.index(name, null, false), 1, 1, 0, false); md.insert(0); data.startUpdate(); data.insert(root, par, new DataClip(md)); data.finishUpdate(); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/data/UpdateTestText.java000066400000000000000000000204571222453003200267240ustar00rootroot00000000000000package org.basex.test.data; import static org.junit.Assert.*; import java.io.*; import org.basex.data.*; import org.basex.data.atomic.*; import org.junit.*; /** * This class tests the update features of the {@link Data} class. * * @author BaseX Team 2005-12, BSD License * @author Tim Petrowsky */ public final class UpdateTestText extends UpdateTest { /** * Tests insert as last child. * @throws IOException I/O exception */ @Test public void insertTextAsOnly1() throws IOException { final Data data = context.data(); final int nextid = data.meta.lastid; insertText(3, 0, T_JUNIT, Data.TEXT); assertEquals(size + 1, data.meta.size); assertEquals(3, data.parent(4, Data.TEXT)); assertEquals(Data.ATTR, data.kind(9)); assertEquals(Data.ELEM, data.kind(5)); assertEquals(1, data.parent(5, Data.ELEM)); assertEquals(5, data.parent(6, Data.ELEM)); assertEquals(nextid + 1, data.meta.lastid); assertArraysEquals(T_JUNIT, data.atom(4)); reload(); assertEquals(size + 1, data.meta.size); assertEquals(3, data.parent(4, Data.TEXT)); assertEquals(Data.ATTR, data.kind(9)); assertEquals(Data.ELEM, data.kind(5)); assertEquals(1, data.parent(5, Data.ELEM)); assertEquals(5, data.parent(6, Data.ELEM)); assertEquals(nextid + 1, data.meta.lastid); assertArraysEquals(T_JUNIT, data.atom(4)); } /** * Tests insert as last child. * @throws IOException I/O exception */ @Test public void insertTextAsOnly2() throws IOException { final Data data = context.data(); final int nextid = data.meta.lastid; insertText(3, 1, T_JUNIT, Data.TEXT); assertEquals(size + 1, data.meta.size); assertEquals(3, data.parent(4, Data.TEXT)); assertEquals(Data.ATTR, data.kind(9)); assertEquals(Data.ELEM, data.kind(5)); assertEquals(1, data.parent(5, Data.ELEM)); assertEquals(5, data.parent(6, Data.ELEM)); assertEquals(nextid + 1, data.meta.lastid); assertArraysEquals(T_JUNIT, data.atom(4)); reload(); assertEquals(size + 1, data.meta.size); assertEquals(3, data.parent(4, Data.TEXT)); assertEquals(Data.ATTR, data.kind(9)); assertEquals(Data.ELEM, data.kind(5)); assertEquals(1, data.parent(5, Data.ELEM)); assertEquals(5, data.parent(6, Data.ELEM)); assertEquals(nextid + 1, data.meta.lastid); assertArraysEquals(T_JUNIT, data.atom(4)); } /** * Tests insert as last child. * @throws IOException I/O exception */ @Test public void insertTextAsOnly3() throws IOException { final Data data = context.data(); final int nextid = data.meta.lastid; insertText(3, 2, T_JUNIT, Data.TEXT); assertEquals(size + 1, data.meta.size); assertEquals(3, data.parent(4, Data.TEXT)); assertEquals(Data.ATTR, data.kind(9)); assertEquals(Data.ELEM, data.kind(5)); assertEquals(1, data.parent(5, Data.ELEM)); assertEquals(5, data.parent(6, Data.ELEM)); assertEquals(nextid + 1, data.meta.lastid); assertArraysEquals(T_JUNIT, data.atom(4)); reload(); assertEquals(size + 1, data.meta.size); assertEquals(3, data.parent(4, Data.TEXT)); assertEquals(Data.ATTR, data.kind(9)); assertEquals(Data.ELEM, data.kind(5)); assertEquals(1, data.parent(5, Data.ELEM)); assertEquals(5, data.parent(6, Data.ELEM)); assertEquals(nextid + 1, data.meta.lastid); assertArraysEquals(T_JUNIT, data.atom(4)); } /** * Tests insert as last child. * @throws IOException I/O exception */ @Test public void insertTextAfterAttsAsFirst() throws IOException { final Data data = context.data(); final int nextid = data.meta.lastid; insertText(6, 1, T_JUNIT, Data.TEXT); assertEquals(size + 1, data.meta.size); assertEquals(Data.TEXT, data.kind(9)); assertEquals(6, data.parent(9, Data.TEXT)); assertArraysEquals(T_JUNIT, data.atom(9)); assertEquals(6, data.parent(10, Data.ELEM)); assertEquals(4, data.parent(12, Data.ELEM)); assertEquals(nextid + 1, data.meta.lastid); reload(); assertEquals(size + 1, data.meta.size); assertEquals(Data.TEXT, data.kind(9)); assertEquals(6, data.parent(9, Data.TEXT)); assertArraysEquals(T_JUNIT, data.atom(9)); assertEquals(6, data.parent(10, Data.ELEM)); assertEquals(4, data.parent(12, Data.ELEM)); assertEquals(nextid + 1, data.meta.lastid); } /** * Tests insert as last child. * @throws IOException I/O exception */ @Test public void insertTextAfterAttsAsSecond() throws IOException { final Data data = context.data(); final int nextid = data.meta.lastid; insertText(6, 2, T_JUNIT, Data.TEXT); assertEquals(size + 1, data.meta.size); assertEquals(Data.ELEM, data.kind(9)); assertArraysEquals(T_JUNIT, data.atom(11)); assertEquals(6, data.parent(11, Data.TEXT)); assertEquals(6, data.parent(9, Data.ELEM)); assertEquals(4, data.parent(12, Data.ELEM)); assertEquals(nextid + 1, data.meta.lastid); reload(); assertEquals(size + 1, data.meta.size); assertEquals(Data.ELEM, data.kind(9)); assertArraysEquals(T_JUNIT, data.atom(11)); assertEquals(6, data.parent(11, Data.TEXT)); assertEquals(6, data.parent(9, Data.ELEM)); assertEquals(4, data.parent(12, Data.ELEM)); assertEquals(nextid + 1, data.meta.lastid); } /** * Tests insert as last child. * @throws IOException I/O exception */ @Test public void insertTextAfterAttsAsLast() throws IOException { final Data data = context.data(); final int nextid = data.meta.lastid; insertText(6, 0, T_JUNIT, Data.TEXT); assertEquals(size + 1, data.meta.size); assertEquals(Data.ELEM, data.kind(9)); assertArraysEquals(T_JUNIT, data.atom(11)); assertEquals(6, data.parent(11, Data.TEXT)); assertEquals(6, data.parent(9, Data.ELEM)); assertEquals(4, data.parent(12, Data.ELEM)); assertEquals(nextid + 1, data.meta.lastid); reload(); assertEquals(size + 1, data.meta.size); assertEquals(Data.ELEM, data.kind(9)); assertArraysEquals(T_JUNIT, data.atom(11)); assertEquals(6, data.parent(11, Data.TEXT)); assertEquals(6, data.parent(9, Data.ELEM)); assertEquals(4, data.parent(12, Data.ELEM)); assertEquals(nextid + 1, data.meta.lastid); } /** * Tests insert text before text. * @throws IOException I/O exception */ @Test(expected = IOException.class) public void insertTextBeforeText() throws IOException { insertText(9, 1, T_FOO, Data.TEXT); } /** * Tests insert text before text. * @throws IOException I/O exception */ @Test(expected = IOException.class) public void insertTextAfterTextAsSecond() throws IOException { insertText(9, 2, T_FOO, Data.TEXT); } /** * Tests insert text before text. * @throws IOException I/O exception */ @Test(expected = IOException.class) public void insertTextAfterTextAsLast() throws IOException { insertText(9, 0, T_FOO, Data.TEXT); } /** * Tests updateText. */ @Test public void updateText() { final Data data = context.data(); data.startUpdate(); data.update(10, Data.TEXT, T_JUNIT); data.finishUpdate(); assertEquals(Data.TEXT, data.kind(10)); assertArraysEquals(T_JUNIT, data.text(10, true)); reload(); assertEquals(Data.TEXT, data.kind(10)); assertArraysEquals(T_JUNIT, data.text(10, true)); } /** * Inserts a value in the database. * @param par parent node * @param pos inserting position * @param val value to be inserted * @param kind node kind * @throws IOException I/O exception */ private static void insertText(final int par, final int pos, final byte[] val, final byte kind) throws IOException { final Data data = context.data(); int pre = par; int k = data.kind(pre); if(pos == 0) { pre += data.size(pre, k); } else { pre += data.attSize(pre, k); for(int p = 1; p < pos && data.parent(pre, k) == par; pre += data.size(pre, k), ++p) k = data.kind(pre); } if(kind == Data.TEXT && (data.kind(pre) == Data.TEXT || data.parent(pre - 1, data.kind(pre - 1)) == par && data.kind(pre - 1) == Data.TEXT)) throw new IOException("May not insert TEXT before/after TEXT!"); final MemData md = new MemData(context.data()); md.text(0, pre - par, val, kind); md.insert(0); data.startUpdate(); data.insert(pre, par, new DataClip(md)); data.finishUpdate(); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/data/package.html000066400000000000000000000000571222453003200254050ustar00rootroot00000000000000 Contains JUnit test classes. basex-7.7.2/basex-core/src/test/java/org/basex/test/index/000077500000000000000000000000001222453003200233205ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/java/org/basex/test/index/IndexCacheTest.java000066400000000000000000000052231222453003200270200ustar00rootroot00000000000000package org.basex.test.index; import static org.basex.util.Token.*; import static org.junit.Assert.*; import java.util.*; import org.basex.index.*; import org.junit.*; /** * Tests for {@link IndexCache}. * * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ public final class IndexCacheTest { /** Test instance. */ private IndexCache cache; /** Set up method. */ @Before public void setUp() { cache = new IndexCache(); } /** Test for method {@link IndexCache#get(byte[])}. */ @Test public void testGetNotExisting() { for(int i = 0; i < 4000; ++i) { final byte[] key = token("keyAdd" + i); final int size = i; final long pointer = i + 5000L; cache.add(key, size, pointer); assertCacheEntry(key, size, pointer); } assertNull(cache.get(token("keyAdd" + 4000))); } /** Test for method {@link IndexCache#add(byte[], int, long)}. */ @Test public void testAdd() { for(int i = 0; i < 4000; ++i) { final byte[] key = token("keyAdd" + i); final int size = i; final long pointer = i + 5000L; cache.add(key, size, pointer); assertCacheEntry(key, size, pointer); } } /** Test for method {@link IndexCache#add(byte[], int, long)}: update. */ @Test public void testUpdate() { final byte[] key = token("keyUpdate"); final int size = 10; final long pointer = 12L; cache.add(key, size - 1, pointer - 1L); cache.add(key, size, pointer); assertCacheEntry(key, size, pointer); } /** Test for method {@link IndexCache#delete(byte[])}. */ @Test public void testDelete() { final byte[] key = token("keyDelete"); final int size = 10; final long pointer = 12L; cache.add(key, size, pointer); cache.delete(key); assertNull(cache.get(key)); } /** * Test that new records can be continuously added without hitting * {@link OutOfMemoryError}. */ @Test @Ignore("Start this test with a small heap size (e.g. -Xmx64m)") public void testPerformance() { final Random random = new Random(System.nanoTime()); while(true) { final byte[] key = new byte[100]; random.nextBytes(key); final int size = random.nextInt(); final long pointer = random.nextLong(); cache.add(key, size, pointer); } } /** * Assert a cache entry is found in the cache. * @param key key * @param size number of index hits * @param pointer pointer to id list */ private void assertCacheEntry(final byte[] key, final int size, final long pointer) { final IndexEntry entry = cache.get(key); assertEquals(entry.size, size); assertEquals(entry.pointer, pointer); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/io/000077500000000000000000000000001222453003200226205ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/java/org/basex/test/io/BufferInputTest.java000066400000000000000000000075351222453003200265660ustar00rootroot00000000000000package org.basex.test.io; import static org.junit.Assert.*; import java.io.*; import org.basex.io.*; import org.basex.io.in.*; import org.basex.util.*; import org.junit.*; /** * Test class for the BufferInput method. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class BufferInputTest { /** * Test small array. * @throws IOException I/O exception */ @Test public void read1() throws IOException { final byte[] data = { ' ' }; run(data); } /** * Test intermediate array. * @throws IOException I/O exception */ @Test public void read255() throws IOException { final byte[] data = new byte[255]; for(int d = 0; d < data.length; d++) data[d] = (byte) (' ' + (d & 0x3F)); run(data); } /** * Test large array. * @throws IOException I/O exception */ @Test public void read4095() throws IOException { final byte[] data = new byte[4095]; for(int d = 0; d < data.length; d++) data[d] = (byte) (' ' + (d & 0x3F)); run(data); } /** * Test large array. * @throws IOException I/O exception */ @Test public void read65535() throws IOException { final byte[] data = new byte[65535]; for(int d = 0; d < data.length; d++) data[d] = (byte) (' ' + (d & 0x3F)); run(data); } /** * Test unknown encoding. * @throws IOException I/O exception */ @Test(expected = IOException.class) public void unknownEncoding() throws IOException { encoding("unknown", ""); } /** * Test alternate encodings. * @throws IOException I/O exception */ @Test public void ascii() throws IOException { final String in = "a"; encoding("Shift_JIS", in); encoding("UTF8", in); encoding("UTF-8", in); encoding("UTF-16LE", in); encoding("UTF-16BE", in); encoding("UTF-32", in); encoding("GBK", in); encoding("GBK", in); } /** * Test alternate encodings. * @throws IOException I/O exception */ @Test public void japanese() throws IOException { final String in = "\u3053\u308c\u306f\u6bb4\u843d\u3067\u3059\u3002"; encoding("Shift_JIS", in); encoding("UTF8", in); encoding("UTF-8", in); encoding("UTF-16LE", in); encoding("UTF-16BE", in); encoding("UTF-32", in); encoding("GBK", in); encoding("GBK", in); } /** * Test alternate encoding. * @param enc encoding to be tested * @param input input string * @throws IOException I/O exception */ private static void encoding(final String enc, final String input) throws IOException { final byte[] utf8 = Token.token(input); final IO io = new IOContent(input.getBytes(enc)); final byte[] cache = new TextInput(io).encoding(enc).content(); assertSame(cache, utf8); } /** * Performs a test on the specified data. * @param data data to be tested * @throws IOException I/O exception */ private static void run(final byte[] data) throws IOException { final TokenBuilder tb = new TokenBuilder(); final TextInput ti = new TextInput(new IOContent(data)); ti.read(); ti.reset(); for(int b; (b = ti.read()) != -1;) tb.add(b); try { ti.reset(); assertTrue("Mark should not be supported for data size of " + data.length, data.length < IO.BLOCKSIZE); tb.reset(); for(int b; (b = ti.read()) != -1;) tb.add(b); assertSame(data, tb.finish()); } catch(final IOException ex) { assertTrue("Mark could not be reset for data size of " + data.length, data.length >= IO.BLOCKSIZE); } } /** * Compares two byte arrays for equality. * @param data1 first array * @param data2 first array */ private static void assertSame(final byte[] data1, final byte[] data2) { assertEquals("Different array size: ", data1.length, data2.length); assertTrue("Data arrays differ: ", Token.eq(data1, data2)); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/io/DataAccessTest.java000066400000000000000000000353001222453003200263170ustar00rootroot00000000000000package org.basex.test.io; import static org.junit.Assert.*; import java.io.*; import org.basex.io.*; import org.basex.io.random.*; import org.basex.util.*; import org.junit.*; /** * Tests for class {@link DataAccess}. *
*

The read operations are tested using a pre-created file with different * types of values at fixed positions; the values occupy the first * {@link IO#BLOCKSIZE} bytes of the file.

*
*

In order to test cross-block reads, a string is written at position * {@link IO#BLOCKSIZE} - 5.

*
*

Write operations are tested by writing a value at a specified random * position.

* * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ public class DataAccessTest { /** String. */ private static final String STR = "string with characters: 10"; /** Long string. */ private static final String STR_LONG = repeat(STR, 1000); /** Byte. */ private static final byte BYTE = Byte.MIN_VALUE; /** Long (5-byte long). */ private static final long LONG = 1L << 5 * Byte.SIZE - 1; // 39 shifts /** Integer. */ private static final int INT = Integer.MAX_VALUE; /** Integer, which should take 5 bytes when compressed. */ private static final int CINT5 = 0x3FFFFFFF + 1; /** Integer, which should take 4 bytes when compressed. */ private static final int CINT4 = 0x3FFF + 1; /** Integer, which should take 2 bytes when compressed. */ private static final int CINT2 = 0x3F + 1; /** Integer, which should take 1 byte when compressed. */ private static final int CINT1 = 0x3F; /** String: binary representation with unsigned bytes. */ private static final int[] STR_BIN = stringToByteArray(STR); /** Long string: binary representation with unsigned bytes. */ private static final int[] STR_LONG_BIN = stringToByteArray(STR_LONG); /** Byte: binary representation with unsigned bytes. */ private static final int[] BYTE_BIN = new int[] { toUnsignedByte(BYTE) }; /** Long (5-byte long): binary representation with unsigned bytes. */ private static final int[] LONG_BIN = longToByteArray(LONG); /** Integer: binary representation with unsigned bytes. */ private static final int[] INT_BIN = intToByteArray(INT); /** Compressed integer: 5-bytes: binary representation with unsigned bytes. */ private static final int[] CINT5_BIN = numToByteArray(CINT5); /** Compressed integer: 4-bytes: binary representation with unsigned bytes. */ private static final int[] CINT4_BIN = numToByteArray(CINT4); /** Compressed integer: 2-bytes: binary representation with unsigned bytes. */ private static final int[] CINT2_BIN = numToByteArray(CINT2); /** Compressed integer: 1-byte: binary representation with unsigned bytes. */ private static final int[] CINT1_BIN = numToByteArray(CINT1); /** Block boundary position for testing cross block reads and writes. */ private static final long BLOCK_BOUNDARY_POS = IO.BLOCKSIZE - 5; /** Random position to test write operations. */ private static final long RANDOM_POS = 15L; /** Temporary file. */ protected IOFile file; /** Instance under test. */ protected DataAccess da; /** * Set up method. * @throws IOException I/O exception */ @Before public void setUp() throws IOException { file = new IOFile(File.createTempFile("page", IO.BASEXSUFFIX)); final RandomAccessFile f = new RandomAccessFile(file.file(), "rw"); try { initialContent(f); } finally { f.close(); } da = new DataAccess(file); } /** * Tear down method. */ @After public void tearDown() { da.close(); file.delete(); } /** Test method for {@link DataAccess#cursor()}. */ @Test public final void testCursor() { assertEquals(0L, da.cursor()); } /** Test method for {@link DataAccess#length()}. */ @Test public final void testLength() { final long len = BLOCK_BOUNDARY_POS + STR_BIN.length; assertEquals(len, da.length()); } /** Test method for {@link DataAccess#more()}. */ @Test public final void testMore() { assertTrue(da.more()); da.cursor(da.length()); assertFalse(da.more()); } /** Test method for {@link DataAccess#read1(long)}. */ @Test public final void testRead1Long() { final long off = STR_BIN.length; assertEquals(BYTE, da.read1(off)); } /** Test method for {@link DataAccess#read1()}. */ @Test public final void testRead1() { final long off = STR_BIN.length; da.cursor(off); assertEquals(BYTE, da.read1()); } /** Test method for {@link DataAccess#read4(long)}. */ @Test public final void testRead4Long() { final long off = STR_BIN.length + BYTE_BIN.length + LONG_BIN.length; assertEquals(INT, da.read4(off)); } /** Test method for {@link DataAccess#read4()}. */ @Test public final void testRead4() { final long off = STR_BIN.length + BYTE_BIN.length + LONG_BIN.length; da.cursor(off); assertEquals(INT, da.read4()); } /** Test method for {@link DataAccess#read5(long)}. */ @Test public final void testRead5Long() { final long off = STR_BIN.length + BYTE_BIN.length; assertEquals(LONG, da.read5(off)); } /** Test method for {@link DataAccess#read5()}. */ @Test public final void testRead5() { final long off = STR_BIN.length + BYTE_BIN.length; da.cursor(off); assertEquals(LONG, da.read5()); } /** Test method for {@link DataAccess#readNum(long)}. */ @Test public final void testReadNumLong() { long off = STR_BIN.length + BYTE_BIN.length + LONG_BIN.length + INT_BIN.length; assertEquals(CINT5, da.readNum(off)); off += CINT5_BIN.length; assertEquals(CINT4, da.readNum(off)); off += CINT4_BIN.length; assertEquals(CINT2, da.readNum(off)); off += CINT2_BIN.length; assertEquals(CINT1, da.readNum(off)); } /** Test method for {@link DataAccess#readNum()}. */ @Test public final void testReadNum() { final long off = STR_BIN.length + BYTE_BIN.length + LONG_BIN.length + INT_BIN.length; da.cursor(off); assertEquals(CINT5, da.readNum()); assertEquals(CINT4, da.readNum()); assertEquals(CINT2, da.readNum()); assertEquals(CINT1, da.readNum()); } /** Test method for {@link DataAccess#readToken(long)}. */ @Test public final void testReadTokenLong() { assertEquals(STR, Token.string(da.readToken(0L))); assertEquals(STR, Token.string(da.readToken(BLOCK_BOUNDARY_POS))); } /** Test method for {@link DataAccess#readToken()}. */ @Test public final void testReadToken() { assertEquals(STR, Token.string(da.readToken())); } /** Test method for {@link DataAccess#readBytes(long, int)}. */ @Test public final void testReadBytesLongInt() { final byte[] bytes = Token.token(STR); final long off = numToByteArray(bytes.length).length; assertEquals(STR, Token.string(da.readBytes(off, bytes.length))); } /** Test method for {@link DataAccess#readBytes(int)}. */ @Test public final void testReadBytesInt() { final byte[] bytes = Token.token(STR); final long off = numToByteArray(bytes.length).length; da.cursor(off); assertEquals(STR, Token.string(da.readBytes(bytes.length))); } /** Test method for {@link DataAccess#cursor(long)}. */ @Test public final void testCursorLong() { long off = STR_BIN.length + BYTE_BIN.length + LONG_BIN.length + INT_BIN.length + CINT5_BIN.length + CINT4_BIN.length + CINT2_BIN.length; da.cursor(off); assertEquals(CINT1, da.readNum()); off -= CINT2_BIN.length; da.cursor(off); assertEquals(CINT2, da.readNum()); off -= CINT4_BIN.length; da.cursor(off); assertEquals(CINT4, da.readNum()); off -= CINT5_BIN.length; da.cursor(off); assertEquals(CINT5, da.readNum()); off -= INT_BIN.length; da.cursor(off); assertEquals(INT, da.read4()); off -= LONG_BIN.length; da.cursor(off); assertEquals(LONG, da.read5()); off -= BYTE_BIN.length; da.cursor(off); assertEquals(BYTE, da.read1()); off -= STR_BIN.length; da.cursor(off); assertEquals(STR, Token.string(da.readToken())); } /** * Test method for {@link DataAccess#write4(long, int)}. * @throws IOException I/O exception */ @Test public final void testWrite4LongInt() throws IOException { final long pos = RANDOM_POS; da.write4(pos, INT); da.flush(); assertContent(pos, INT_BIN); } /** * Test method for {@link DataAccess#write4(int)}. * @throws IOException I/O exception */ @Test public final void testWrite4Int() throws IOException { final long pos = RANDOM_POS; da.cursor(pos); da.write4(pos, INT); da.flush(); assertContent(pos, INT_BIN); } /** * Test method for {@link DataAccess#writeToken(long, byte[])}. * @throws IOException I/O exception */ @Test public final void testWriteToken() throws IOException { final long pos = RANDOM_POS; da.writeToken(pos, Token.token(STR)); da.flush(); assertContent(pos, STR_BIN); } /** * Test method for {@link DataAccess#writeToken(long, byte[])}. * @throws IOException I/O exception */ @Test public final void testWriteTokenBig() throws IOException { final long pos = RANDOM_POS; da.writeToken(pos, Token.token(STR_LONG)); da.flush(); assertContent(pos, STR_LONG_BIN); } /** Performance test for {@link DataAccess#writeToken(long, byte[])}. */ @Test public final void testPerfWriteTokenBig() { final byte[] token = Token.token(STR_LONG); for(int i = 0; i < 10000; ++i) da.writeToken(da.cursor(), token); } /** * Test method for {@link DataAccess#writeNum(long, int)}. * @throws IOException I/O exception */ @Test public final void testWriteNum() throws IOException { long pos = RANDOM_POS; da.cursor(pos); da.writeNum(da.cursor(), CINT5); da.writeNum(da.cursor(), CINT4); da.writeNum(da.cursor(), CINT2); da.writeNum(da.cursor(), CINT1); da.flush(); assertContent(pos, CINT5_BIN); pos += CINT5_BIN.length; assertContent(pos, CINT4_BIN); pos += CINT4_BIN.length; assertContent(pos, CINT2_BIN); pos += CINT2_BIN.length; assertContent(pos, CINT1_BIN); } /** Test method for {@link DataAccess#free(long, int)}. */ @Ignore @Test public final void testFree() { fail("Not yet implemented"); } /** * Check that the test file {@link #file} has the specified unsigned bytes at * the specified position. * @param pos file position * @param bytes expected unsigned bytes * @throws IOException I/O exception */ protected void assertContent(final long pos, final int[] bytes) throws IOException { final RandomAccessFile f = new RandomAccessFile(file.file(), "r"); try { f.seek(pos); for(final int b : bytes) assertEquals(b, f.read()); } finally { f.close(); } } /** * Write initialization data. * @param out file. * @throws IOException I/O exception */ protected static void initialContent(final RandomAccessFile out) throws IOException { write(out, STR_BIN); write(out, BYTE_BIN); write(out, LONG_BIN); write(out, INT_BIN); write(out, CINT5_BIN); write(out, CINT4_BIN); write(out, CINT2_BIN); write(out, CINT1_BIN); final long off = out.getFilePointer() >>> 12 << 12; out.seek(off + BLOCK_BOUNDARY_POS); write(out, STR_BIN); } /** * Write an array of unsigned bytes in the specified file. * @param out file * @param bytes unsigned bytes * @throws IOException I/O exception */ private static void write(final RandomAccessFile out, final int[] bytes) throws IOException { for(final int b : bytes) out.write(b); } /** * Convert the last byte of a value to an unsigned byte. * @param v value * @return the last byte (unsigned) */ private static int toUnsignedByte(final long v) { return (int) (v & 0xFFL); } /** * Convert the last byte of a value to an unsigned byte. * @param v value * @return the last byte (unsigned) */ private static int toUnsignedByte(final int v) { return v & 0xFF; } /** * Convert the last byte of a value to an unsigned byte. * @param v value * @return the last byte (unsigned) */ private static int toUnsignedByte(final byte v) { return v & 0xFF; } /** * Get the binary representation of a string as defined in * {@link DataAccess#writeToken(long, byte[])}. * @param s string * @return array of unsigned bytes */ private static int[] stringToByteArray(final String s) { final byte[] token = Token.token(s); final int[] len = numToByteArray(token.length); final int[] bytes = new int[len.length + token.length]; System.arraycopy(len, 0, bytes, 0, len.length); for(int i = 0; i < token.length; ++i) bytes[len.length + i] = toUnsignedByte(token[i]); return bytes; } /** * Get the binary representation of a long (5-byte long) as defined in * {@link DataAccess#read5()}. * @param v long (5-byte long) * @return array of unsigned bytes */ private static int[] longToByteArray(final long v) { return new int[] { toUnsignedByte(v >>> 32), toUnsignedByte(v >>> 24), toUnsignedByte(v >>> 16), toUnsignedByte(v >>> 8), toUnsignedByte(v) }; } /** * Get the binary representation of an integer as defined in * {@link DataAccess#write4(int)}. * @param v integer * @return array of unsigned bytes */ private static int[] intToByteArray(final int v) { return new int[] { toUnsignedByte(v >>> 24), toUnsignedByte(v >>> 16), toUnsignedByte(v >>> 8), toUnsignedByte(v) }; } /** * Get the compressed binary representation of an integer as defined in * {@code DataAccess.writeNum(int)}. * @param v integer * @return array of unsigned bytes */ private static int[] numToByteArray(final int v) { if(v < 0 || v > 0x3FFFFFFF) { return new int[] { 0xC0, toUnsignedByte(v >>> 24), toUnsignedByte(v >>> 16), toUnsignedByte(v >>> 8), toUnsignedByte(v) }; } else if(v > 0x3FFF) { return new int[] { toUnsignedByte(v >>> 24 | 0x80), toUnsignedByte(v >>> 16), toUnsignedByte(v >>> 8), toUnsignedByte(v) }; } else if(v > 0x3F) { return new int[] { toUnsignedByte(v >>> 8 | 0x40), toUnsignedByte(v) }; } else { return new int[] { v }; } } /** * Construct a new string by repeating a given string several times. * @param s string * @param n number of time to repeat the string * @return result string */ private static String repeat(final String s, final int n) { final StringBuilder str = new StringBuilder(n * s.length()); for(int i = 0; i < n; ++i) str.append(s); return str.toString(); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/io/GlobTest.java000066400000000000000000000042421222453003200252100ustar00rootroot00000000000000package org.basex.test.io; import static org.junit.Assert.*; import org.basex.io.*; import org.junit.*; /** * Test class for glob patterns. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class GlobTest { /** Input strings. */ private static final String[] STRINGS = { "ab", "ab.cd", "ef.cd", "ab.ef.cd" }; /** Tests. */ enum TEST { /** Test. */ FILE1("a", true, true, false, true), /** Test. */ FILE2("ab", true, true, false, true), /** Test. */ FULL("ab.cd", false, true, false, false), /** Test. */ SUFFIX("*.cd", false, true, true, true), /** Test. */ ALL("*", true, true, true, true), /** Test. */ ABC("ab.c", false, false, false, false), /** Test. */ ABCDE("ab.cde", false, false, false, false), /** Test. */ MULTIPLE("ab,ef", true, true, true, true), /** Test. */ SPACES1("ab ,ef", true, true, true, true), /** Test. */ SPACES2("ab, ef", true, true, true, true), /** Test. */ AST2("a*.cd", false, true, false, true), /** Test. */ QUESTION("?", false, false, false, false), /** Test. */ QUESTIONS("??", true, false, false, false), /** Test. */ NOSUFFIX("*.", true, false, false, false), /** Test. */ NOSUFFIX2("*..", false, false, false, false), /** Test. */ BACK("\\", false, false, false, false); /** Glob syntax. */ final String glob; /** Results. */ final boolean[] results; /** * Constructor. * @param g glob syntax * @param r results */ TEST(final String g, final boolean... r) { glob = g; results = r; } } /** * Glob test. */ @Test public void test() { for(final TEST g : TEST.values()) { final String regex = IOFile.regex(g.glob); for(int i = 0; i < STRINGS.length; i++) { final boolean exp = g.results[i]; final boolean res = STRINGS[i].matches(regex); if(exp != res) fail(g + " #" + i + " failed.\n" + "Query: \"" + g.glob + "\" matches \"" + STRINGS[i] + "\" \u2192 " + res + "\nExpected: " + exp + "\nRegex: " + regex); } } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/io/IOTest.java000066400000000000000000000016261222453003200246370ustar00rootroot00000000000000package org.basex.test.io; import static org.junit.Assert.*; import org.basex.core.*; import org.basex.io.*; import org.junit.*; /** * Test class for IO methods. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class IOTest { /** URL to file conversions. */ @Test public void urlToFile() { if(Prop.WIN) { assertEquals("C:/x y", IOFile.get("file:/c:/x%20y").path()); assertEquals("C:/x y", IOFile.get("file://c:/x y").path()); assertEquals("D:/x+y", IOFile.get("file:///D:/x%2By").path()); assertEquals("G:/X", IOFile.get("file:///G:/X").path()); } else { assertEquals("/x y", IOFile.get("file:///x%20y").path()); } } /** File to URL conversions. */ @Test public void fileToURL() { final String url = new IOFile("X Y").url(); assertTrue(url.startsWith("file:/")); assertTrue(url.endsWith("X%20Y")); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/io/SAXSerializerObject.java000066400000000000000000000017631222453003200273060ustar00rootroot00000000000000package org.basex.test.io; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; /** * Class for testing the (un)marshalling and serialization of objects. * * @author BaseX Team 2005-12, BSD License * @author Michael Hedenus */ @XmlRootElement(name = "domain-object") @XmlAccessorType(XmlAccessType.FIELD) public class SAXSerializerObject { /** Name of the object. */ @XmlAttribute String name; /** Value. */ long value; /** * Empty constructor. */ public SAXSerializerObject() { } /** * Empty constructor, specifying initial values. * @param nm name * @param val value */ public SAXSerializerObject(final String nm, final long val) { name = nm; value = val; } /** * Returns the value. * @return value */ public long getValue() { return value; } } basex-7.7.2/basex-core/src/test/java/org/basex/test/io/SAXSerializerTest.java000066400000000000000000000044241222453003200270140ustar00rootroot00000000000000package org.basex.test.io; import javax.xml.bind.*; import javax.xml.transform.*; import javax.xml.transform.dom.*; import javax.xml.transform.sax.*; import junit.framework.Assert; import org.basex.core.cmd.*; import org.basex.io.out.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.test.*; import org.junit.Test; /** * Tests the SAXSerializer. * * @author BaseX Team 2005-12, BSD License * @author Michael Hedenus */ public class SAXSerializerTest extends SandboxTest { /** * Tests the (un)marshalling of objects. * @throws Exception exception */ @Test public void unmarshallJAXBObjectWithSAXSerializer() throws Exception { final JAXBContext jaxbContext = JAXBContext.newInstance(SAXSerializerObject.class); // create XML final ArrayOutput marshalled = new ArrayOutput(); jaxbContext.createMarshaller().marshal( new SAXSerializerObject("Object1", 42), marshalled); new CreateDB(NAME, marshalled.toString()).execute(context); // get object from DB final QueryProcessor queryProcessor = new QueryProcessor( "//domain-object[@name='Object1']", context); final Item item = queryProcessor.iter().next(); final SAXSerializer saxSerializer = new SAXSerializer(item); final SAXSource saxSource = new SAXSource(saxSerializer, null); final SAXSerializerObject dom = jaxbContext.createUnmarshaller().unmarshal(saxSource, SAXSerializerObject.class).getValue(); queryProcessor.close(); Assert.assertEquals(42, dom.getValue()); } /** * Tests the handling of namespaces. * @throws Exception exception */ @Test public void namespaces() throws Exception { final QueryProcessor queryProcessor = new QueryProcessor("", context); final Item item = queryProcessor.iter().next(); final SAXSerializer saxSerializer = new SAXSerializer(item); final SAXSource saxSource = new SAXSource(saxSerializer, null); final DOMResult result = new DOMResult(); TransformerFactory.newInstance().newTransformer().transform(saxSource, result); Assert.assertEquals("x", result.getNode().getFirstChild().getNamespaceURI()); queryProcessor.close(); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/000077500000000000000000000000001222453003200233565ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/java/org/basex/test/query/AdvancedQueryTest.java000066400000000000000000000131551222453003200276210ustar00rootroot00000000000000package org.basex.test.query; import static org.junit.Assert.*; import org.basex.io.out.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.util.*; import org.basex.test.*; import org.basex.util.*; /** * This class contains some methods for performing advanced query tests. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public abstract class AdvancedQueryTest extends SandboxTest { /** * Runs the specified query and normalizes newlines. * @param query query string * @return result */ protected static String query(final String query) { final QueryProcessor qp = new QueryProcessor(query, context); qp.ctx.sc.baseURI("."); try { final ArrayOutput ao = new ArrayOutput(); final Serializer ser = qp.getSerializer(ao); qp.execute().serialize(ser); ser.close(); return ao.toString().replaceAll("(\\r|\\n)+ *", ""); } catch(final Exception ex) { final AssertionError err = new AssertionError("Query failed:\n" + query); err.initCause(ex); throw err; } finally { qp.close(); } } /** * Checks if a query yields the specified string. * @param query query string * @param result query result */ protected static void query(final String query, final Object result) { final String res = query(query); final String exp = result.toString(); if(!res.equals(exp)) fail("Wrong result:\n[Q] " + query + "\n[E] \u00bb" + result + "\u00ab\n[F] \u00bb" + res + '\u00ab'); } /** * Creates a transform expression from a given input, modification and return clause. * * @param input input XML fragment, target of the updating expression * @param modification updating expression, make sure to address all target nodes via * the $input variable, i.e. delete node $input/a * @param ret return clause * @return the query formulated with a transform expression */ protected static String transform(final String input, final String modification, final String ret) { final String q = "copy $input := " + input + " " + "modify (" + modification + ") " + "return (" + (ret.length() == 0 ? "$input" : ret) + ")"; return q; } /** * Creates a transform expression from a given input and modification clause. * * @param input input XML fragment, target of the updating expression * @param modification updating expression, make sure to address all target nodes via * the $input variable, i.e. delete node $input/a * @return the query formulated with a transform expression */ protected static String transform(final String input, final String modification) { return transform(input, modification, ""); } /** * Checks if a query yields the specified result. * @param query query string * @param result query result */ protected static void contains(final String query, final String result) { final String res = query(query); if(!res.contains(result)) fail("Result does not contain \"" + result + "\":\n" + query + "\n[E] " + result + "\n[F] " + res); } /** * Checks if a query yields the specified error code. * @param query query string * @param error expected error */ protected static void error(final String query, final Err... error) { final QueryProcessor qp = new QueryProcessor(query, context); qp.ctx.sc.baseURI("."); try { final ArrayOutput ao = new ArrayOutput(); final Serializer ser = qp.getSerializer(ao); qp.execute().serialize(ser); ser.close(); final String res = ao.toString().replaceAll("(\\r|\\n)+ *", ""); final StringBuilder sb = new StringBuilder("Query did not fail:\n"); sb.append(query + "\n[E]"); for(final Err e : error) sb.append(" " + e); fail(sb.append("\n[F] " + res).toString()); } catch(final SerializerException ex) { check(query, ex.getCause(), error); } catch(final QueryException ex) { check(query, ex, error); } catch(final Exception ex) { fail("Unexpected exception: " + ex); ex.printStackTrace(); } finally { qp.close(); } } /** * Checks if an exception yields one of the specified error codes. * @param query query * @param ex resulting query exception * @param error expected errors */ protected static void check(final String query, final QueryException ex, final Err... error) { boolean found = false; final Err err = ex.err(); for(final Err e : error) found |= err != null ? err == e : e.qname().eq(ex.qname()); if(!found) { final TokenBuilder tb = new TokenBuilder("\n"); if(query != null) tb.add("Query: ").add(query).add("\n"); tb.add("Error(s): "); if(err != null) { int c = 0; for(final Err er : error) tb.add(c++ != 0 ? "/" : "").add(er.name()); fail(tb.add("\nResult: ").add(err.name() + " (" + err.qname() + ')').toString()); } else { int c = 0; for(final Err er : error) tb.add(c++ != 0 ? "/" : "").add(er.qname().local()); fail(tb.add("\nResult: ").add(ex.qname().string()).toString()); } } } /** * Returns serialization parameters. * @param arg serialization arguments * @return parameter string */ protected static String serialParams(final String arg) { return "" + arg + ""; } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/CollationTest.java000066400000000000000000000100031222453003200267770ustar00rootroot00000000000000package org.basex.test.query; import org.junit.*; /** * XQuery collation tests. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class CollationTest extends AdvancedQueryTest { /** Collation arguments used in the tests. */ private static final String ARGS = "lang=de;strength=primary"; /** Collation used in the tests. */ private static final String COLLATION = "http://basex.org/collation?" + ARGS; /** Default collation used in the tests. */ private static final String PROLOG = "declare default collation '" + COLLATION + "'; "; /** Strengths. */ private static final String[] STRENGTHS = { "primary", "secondary", "tertiary", "identical" }; /** Checks the German collation and different strengths. */ @Test public void german() { for(int s = 0; s < STRENGTHS.length; s++) { final String prolog = "declare default collation " + "'http://basex.org/collation?lang=de;strength=" + STRENGTHS[s] + "'; "; query(prolog + "'A' ='A' ", true); query(prolog + "'\u00c4'='A\u0308'", s < 3); query(prolog + "'A' ='a' ", s < 2); query(prolog + "'A' ='\u00c4' ", s < 1); query(prolog + "'A' ='B' ", false); } } /** Tests operators. */ @Test public void operators() { query(PROLOG + "'\u00c4' = 'a'", true); query(PROLOG + "'\u00c4' != 'a'", false); query(PROLOG + "'\u00c4' > 'a'", false); query(PROLOG + "'\u00c4' < 'a'", false); query(PROLOG + "'\u00c4' <= 'a'", true); query(PROLOG + "'\u00c4' >= 'a'", true); query(PROLOG + "'\u00c4' eq 'a'", true); query(PROLOG + "'\u00c4' ne 'a'", false); query(PROLOG + "'\u00c4' gt 'a'", false); query(PROLOG + "'\u00c4' lt 'a'", false); query(PROLOG + "'\u00c4' le 'a'", true); query(PROLOG + "'\u00c4' ge 'a'", true); } /** Tests functions. */ @Test public void functions() { query("compare('a', '\u00c4', '" + COLLATION + "')", "0"); query(PROLOG + "compare('a', '\u00c4')", "0"); query(PROLOG + "contains('XaX', '\u00c4')", true); query(PROLOG + "starts-with('aX', '\u00c4')", true); query(PROLOG + "ends-with('Xa', '\u00c4')", true); query(PROLOG + "starts-with('Xa', '\u00c4')", false); query(PROLOG + "ends-with('aX', '\u00c4')", false); query(PROLOG + "substring-before('XaY', '\u00c4')", "X"); query(PROLOG + "substring-after('XaY', '\u00c4')", "Y"); query(PROLOG + "distinct-values(('a', '\u00c4'))", "a"); query(PROLOG + "index-of('a', '\u00c4')", "1"); query(PROLOG + "deep-equal('a', '\u00c4')", true); query(PROLOG + "min(('\u00c4', 'a'))", "\u00c4"); query(PROLOG + "max(('a', '\u00c4'))", "a"); query(PROLOG + "default-collation()", COLLATION); query("declare default collation '?" + ARGS + "'; default-collation()", COLLATION); } /** Tests the order by clause. */ @Test public void orderBy() { // identical strings query(PROLOG + "for $a in ('b', 'b') order by $a return $a", "b b"); query("for $a in ('b', 'b') order by $a collation '" + COLLATION + "'return $a", "b b"); // different strings query(PROLOG + "for $a in ('\u00c4', 'b') order by $a return $a", "\u00c4 b"); query("for $a in ('\u00c4', 'b') order by $a collation '" + COLLATION + "'return $a", "\u00c4 b"); query("for $a in ( '\u00c4', 'A' ) " + "group by $b := $a collation '?lang=de;strength=primary' " + "return count($a)", 2); } /** Tests the group by clause. */ @Test @Ignore public void groupBy() { // identical strings query(PROLOG + "for $a in ('a','a') group by $b:=$a return count($a)", "2"); query("for $a in ('a','a') group by $b:=$a return count($a)", "2"); // different strings query(PROLOG + "for $a in ('a','\u00c4') group by $b:=$a return count($a)", "2"); query("for $a in ('a','\u00c4') group by $b:=$a collation '" + COLLATION + "' return count($a)", "2"); query("for $a in 'a' group by $a, $a:=$a collation '" + COLLATION + "' return $a", "a"); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/FTIndexQueryTest.java000066400000000000000000000100321222453003200274040ustar00rootroot00000000000000package org.basex.test.query; import static org.basex.query.func.Function.*; import static org.junit.Assert.*; import java.lang.annotation.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.test.*; import org.basex.test.query.simple.*; import org.basex.util.*; import org.junit.*; import org.junit.rules.*; import org.junit.runners.model.*; /** * Test if index and non-index full-text queries behave the same way. * * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ @InputData("A x B") public final class FTIndexQueryTest extends SandboxTest { /** Name of database with full-text index. */ private static final String NAME_IX = NAME + "ix"; /** Context of database with full-text index. */ private static final Context CTX_IX = new Context(); /** Rule to create database without full-text index. */ @Rule public final CreateDBRule createdb = new CreateDBRule(NAME, context); /** Rule to create database with full-text index. */ @Rule public final CreateDBRule createdbix = new CreateDBRule(NAME_IX, CTX_IX); /** Static initialization. */ @BeforeClass public static void setUpClass() { context.prop.set(Prop.FTINDEX, false); CTX_IX.prop.set(Prop.FTINDEX, true); initContext(CTX_IX); } /** Static clean-up. */ @AfterClass public static void cleanUpClass() { CTX_IX.close(); } /** Run all tests from {@link FTTest}. */ @Test @InputData(FTTest.DOC) public void testFTTest() { for(final Object[] q : FTTest.QUERIES) if(q.length == 3) assertQuery((String) q[2]); } /** Run all tests from {@link XPathMarkFTTest}. */ @Test @InputData(XPathMarkFTTest.DOC) public void testXPathMarkFTTest() { for(final Object[] q : XPathMarkFTTest.QUERIES) assertQuery((String) q[2]); } /** Word distance test. */ @Test @Ignore("GH-359") public void testWordsDistance() { assertQuery( "//*[text() contains text 'A B' all words distance exactly 0 words]"); } /** {@code ft:mark()} test with ft option {@code all words}. */ @Test @Ignore("GH-337") public void testFTMarkAllWords() { assertQuery( _FT_MARK.args(" //*[text() contains text {'A B'} all words], 'b'")); } /** {@code ft:mark()} test with {@code ftand}. */ @Test public void testFTMarkFTAnd() { assertQuery( _FT_MARK.args(" //*[text() contains text 'A' ftand 'B'], 'b'")); } /** * Assert that a query returns the same result with and without ft index. * @param q query */ private static void assertQuery(final String q) { try { assertEquals("Query failed:\n" + q + '\n', new XQuery(q).execute(context), new XQuery(q).execute(CTX_IX)); } catch(final BaseXException ex) { final AssertionError err = new AssertionError( "Query failed:\n" + q + "\nMessage: " + Util.message(ex)); err.initCause(ex); throw err; } } } /** Annotation to provide input data for a test. */ @Retention(RetentionPolicy.RUNTIME) @interface InputData { /** * Input data. * @return string */ String value(); } /** * Test rule, creating a database before executing each test method, which is * annotated with {@link InputData}. */ class CreateDBRule implements MethodRule { /** Database context. */ final Context ctx; /** Database name. */ final String db; /** * Constructor. * @param d database * @param c database context */ public CreateDBRule(final String d, final Context c) { db = d; ctx = c; } @Override public Statement apply(final Statement base, final FrameworkMethod method, final Object target) { return new Statement() { @Override public void evaluate() throws Throwable { InputData input = method.getAnnotation(InputData.class); if(input == null) { input = method.getMethod().getDeclaringClass().getAnnotation(InputData.class); } if(input != null) new CreateDB(db, input.value()).execute(ctx); base.evaluate(); if(input != null) new DropDB(db).execute(ctx); } }; } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/FTWildcardTest.java000066400000000000000000000043651222453003200270540ustar00rootroot00000000000000package org.basex.test.query; import static org.basex.util.Token.*; import static org.junit.Assert.*; import org.basex.query.ft.*; import org.junit.*; /** * Wild-card parsing and matching tests. * * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ public final class FTWildcardTest { /** Sample texts which should be matched. */ private static final String[][] TEXTS_GOOD = { { "well", "wall", "will", "w.ll", "w\u00fcll" }, { "site", "asite" }, { "improv", "improve", "improvement" }, { "wisdomness", "witches" }, { "site" }, { "Usability\\", "Usable\\" }, { "\u00fcbersch\u00fcsse", "\u00fcberschuss" } }; /** Sample texts which should NOT be matched. */ private static final String[][] TEXTS_BAD = new String[][] { { "wll", "wel", "ell" }, { "bite", "abite", "sit", "asit" }, { "impro", "mprove" }, { "witch", "wiskey", "wisdomnetts" }, { "\\s\\i\\t\\e" }, { "Usability", "Usab\\", "usability\\" }, { "ueberschuss" } }; /** Valid wild-card expressions. */ private static final String[] VALIDWC = new String[] { "w.ll", ".?site", "improv.*", "wi.{4,7}s", "\\s\\i\\t\\e", "Usab.+\\\\", "\u00fcbersch.ss.?" }; /** Valid wild card expressions. */ private static final String[] INVALIDWC = new String[] { ".{5,7]", ".{2,1}", ".{,}", ".{0,}", ".{,0}", ".{-1,0}", "will\\" }; /** Test if wild-card expressions are correctly parsed. */ @Test public void testParse() { for(final String wc : VALIDWC) assertTrue(new FTWildcard(token(wc)).parse()); for(final String wc : INVALIDWC) assertFalse(new FTWildcard(token(wc)).parse()); } /** * Test wild-card matching. */ @Test public void testMatch() { for(int i = 0; i < VALIDWC.length; i++) { final String q = VALIDWC[i]; final FTWildcard wc = new FTWildcard(token(q)); assertTrue(wc.parse()); final String[] good = TEXTS_GOOD[i]; for(final String g : good) { assertTrue('"' + q + "\" did NOT match \"" + g + '"', wc.match(token(g))); } final String[] bad = TEXTS_BAD[i]; for(final String b : bad) { assertFalse('"' + q + "\" matched \"" + b + '"', wc.match(token(b))); } } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/IndexOptimizeTest.java000066400000000000000000000150531222453003200276550ustar00rootroot00000000000000package org.basex.test.query; import static org.basex.query.func.Function.*; import static org.junit.Assert.*; import java.io.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.core.cmd.Set; import org.basex.io.out.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.ft.*; import org.basex.test.*; import org.basex.util.*; import org.junit.*; /** * This class tests if queries are rewritten for index access. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class IndexOptimizeTest extends SandboxTest { /** * Creates a test database. * @throws Exception exception */ @BeforeClass public static void start() throws Exception { new DropDB(NAME).execute(context); new Set(Prop.FTINDEX, true).execute(context); new Set(Prop.QUERYINFO, true).execute(context); } /** * Drops the test database. * @throws Exception exception */ @AfterClass public static void stop() throws Exception { new DropDB(NAME).execute(context); } /** * Checks the open command. * Test method. * @throws Exception unexpected exception */ @Test public void openDocTest() throws Exception { createDoc(); new Open(NAME).execute(context); check("//*[text() = '1']"); check("data(//*[@* = 'y'])", "1"); check("data(//@*[. = 'y'])", "y"); check("//*[text() contains text '1']"); } /** * Checks the open command. * Test method. * @throws Exception unexpected exception */ @Test public void openCollTest() throws Exception { createColl(); new Open(NAME).execute(context); check("//*[text() = '1']"); check("//*[text() contains text '1']"); } /** * Checks the XQuery doc() function. * @throws Exception unexpected exception */ @Test public void docTest() throws Exception { createDoc(); final String doc = DOC.args(NAME); check(doc + "//*[text() = '1']"); check(doc + "//*[text() contains text '2']"); } /** * Checks the XQuery collection() function. * @throws Exception unexpected exception */ @Test public void collTest() throws Exception { createColl(); final String doc = COLLECTION.args(NAME); check(doc + "//*[text() = '1']"); check(doc + "//*[text() contains text '2']"); } /** * Checks the XQuery db:open() function. * @throws Exception unexpected exception */ @Test public void dbOpenTest() throws Exception { createColl(); final String doc = _DB_OPEN.args(NAME); check(doc + "//*[text() = '1']"); check(doc + "//*[text() <- '2']"); } /** * Checks the XQuery db:open() function, using a specific path. * @throws Exception unexpected exception */ @Test public void dbOpenExtTest() throws Exception { createColl(); final String doc = _DB_OPEN.args(NAME, "two"); check(doc + "//*[text() = '1']", ""); check(doc + "//*[text() = '4']", "4"); } /** * Checks full-text requests. * @throws Exception unexpected exception */ @Test public void ftTest() throws Exception { createDoc(); new Open(NAME).execute(context); check("data(//*[text() <- '1'])", "1"); check("data(//*[text() <- '1 2' any word])", "1 2 3"); check("//*[text() <- {'2','4'} all]", ""); check("//*[text() <- {'2','3'} all words]", "2 3"); check("//*[text() <- {'2','4'} all words]", ""); } /** * Checks if a full-text index with language option is used. * @throws Exception unexpected exception */ @Test public void ftTestLang() throws Exception { new Set(Prop.LANGUAGE, "de").execute(context); createDoc(); new Open(NAME).execute(context); check("//text()[. contains text 'test' using language 'de']"); check("//text()[. contains text 'test' using language 'German']"); } /** * Checks index optimizations inside functions. * @throws Exception unexpected exception */ @Test public void functionTest() throws Exception { createColl(); final String doc = _DB_OPEN.args(NAME); // text: search term must be string check("declare function local:x() {" + doc + "//text()[. = '1'] }; local:x()", "1"); check("declare function local:x($x as xs:string) {" + doc + "//text()[. = $x] }; local:x('1')", "1"); // full-text: search term may can have any type check("declare function local:x() {" + doc + "//text()[. contains text '1'] }; local:x()", "1"); check("declare function local:x($x) {" + doc + "//text()[. contains text { $x }] }; local:x('1')", "1"); } /** * Creates a test database. * @throws Exception exception */ private static void createDoc() throws Exception { new CreateDB(NAME, "12 3").execute(context); new Close().execute(context); } /** * Creates a test collection. * @throws Exception exception */ private static void createColl() throws Exception { new CreateDB(NAME).execute(context); new Add("one", "12 3").execute(context); new Add("two", "45 6").execute(context); new Optimize().execute(context); new Close().execute(context); } /** * Check if specified query was rewritten for index access. * @param query query to be tested */ private static void check(final String query) { check(query, null); } /** * Checks if specified query was rewritten for index access, and checks the * query result. * @param query query to be tested * @param result expected query result */ private static void check(final String query, final String result) { // compile query String plan = null; QueryProcessor qp = new QueryProcessor(query, context); try { ArrayOutput ao = qp.execute().serialize(); final String info = qp.info(); if(result != null) assertEquals(result, ao.toString().replaceAll("\\r?\\n", "")); // fetch query plan plan = qp.plan().serialize().toString(); qp.close(); // check if index is used qp = new QueryProcessor(plan + "/descendant-or-self::*" + "[self::" + Util.name(ValueAccess.class) + "|self::" + Util.name(FTIndexAccess.class) + "]", context); ao = qp.execute().serialize(); assertFalse("No index used:\nQuery: " + query + "\nInfo: " + info + "\nPlan: " + plan, ao.toString().isEmpty()); } catch(final QueryException ex) { fail(Util.message(ex) + "\nQuery: " + query + "\nPlan: " + plan); } catch(final IOException ex) { fail(Util.message(ex)); } finally { qp.close(); } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/NamespaceTest.java000066400000000000000000000607531222453003200267700ustar00rootroot00000000000000package org.basex.test.query; import static org.basex.core.Text.*; import static org.basex.util.Token.*; import static org.junit.Assert.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.io.*; import org.basex.query.*; import org.basex.query.up.primitives.*; import org.basex.query.util.*; import org.basex.query.value.node.*; import org.basex.util.*; import org.junit.*; /** * This class tests namespaces. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class NamespaceTest extends AdvancedQueryTest { /** Test documents. */ private static final String[][] DOCS = { { "d1", "" }, { "d2", "" }, { "d3", "" }, { "d4", "" }, { "d5", "" }, { "d6", "" }, { "d7", "" }, { "d8", "" }, { "d9", "" }, { "d10", ""}, { "d11", "" + "" }, { "d12", "" }, { "d13", "" }, { "d14", "" }, { "d15", "" + "" }, { "d16", "" }, { "d17", "" }, { "d18", ""}, { "d19", ""}, { "d20", ""}, }; /** * Checks if namespace hierarchy structure is updated correctly on the * descendant axis after a NSNode has been inserted. * @throws Exception exception */ @Test public void insertIntoShiftPreValues() throws Exception { create(12); query("insert node into doc('d12')/*:a/*:b"); assertEquals(NL + " Pre[3] xmlns:ns=\"A\" " + NL + " Pre[4] xmlns=\"B\" ", context.data().nspaces.toString()); } /** * Checks if namespace hierarchy structure is updated correctly on the * descendant axis after a NSNode has been inserted. * @throws Exception exception */ @Test public void insertIntoShiftPreValues2() throws Exception { create(13); query("insert node as first into doc('d13')/a"); assertEquals(NL + " Pre[3] xmlns=\"A\" ", context.data().nspaces.toString()); } /** * Checks if namespace hierarchy structure is updated correctly on the * descendant axis after a NSNode has been inserted. * @throws Exception exception */ @Test public void insertIntoShiftPreValues3() throws Exception { create(14); query("insert node into doc('d14')/*:a/*:b"); assertEquals(NL + " Pre[1] xmlns=\"A\" " + NL + " Pre[2] xmlns=\"B\" " + NL + " Pre[3] xmlns=\"D\" " + NL + " Pre[4] xmlns=\"C\" ", context.data().nspaces.toString()); } /** * Checks if namespace hierarchy structure is updated correctly on the * descendant axis after a NSNode has been deleted. * @throws Exception exception */ @Test public void deleteShiftPreValues() throws Exception { create(12); query("delete node doc('d12')/a/b"); assertEquals(NL + " Pre[2] xmlns=\"B\" ", context.data().nspaces.toString()); } /** * Checks if namespace hierarchy structure is updated correctly on the * descendant axis after a NSNode has been deleted. * @throws Exception exception */ @Test public void deleteShiftPreValues2() throws Exception { create(14); query("delete node doc('d14')/*:a/*:b"); assertEquals(NL + " Pre[1] xmlns=\"A\" " + NL + " Pre[2] xmlns=\"C\" ", context.data().nspaces.toString()); } /** * Checks if namespace hierarchy structure is updated correctly on the * descendant axis after a NSNode has been deleted. * @throws Exception exception */ @Test public void deleteShiftPreValues3() throws Exception { create(15); query("delete node doc('d15')/*:a/*:c"); assertEquals(NL + " Pre[1] xmlns=\"A\" " + NL + " Pre[2] xmlns=\"B\" " + NL + " Pre[3] xmlns=\"E\" ", context.data().nspaces.toString()); } /** * Checks if namespace hierarchy structure is updated correctly on the * descendant axis after a NSNode has been deleted. * @throws Exception exception */ @Test public void deleteShiftPreValues4() throws Exception { create(16); query("delete node doc('d16')/a/b"); assertTrue(context.data().nspaces.toString().isEmpty()); } /** * Tests for correct namespace hierarchy, esp. if namespace nodes * on the following axis of an insert/delete operation are * updated correctly. * @throws Exception exception */ @Test public void delete1() throws Exception { create(11); query("delete node doc('d11')/*:a/*:b", "doc('d11')/*:a", ""); } /** Test query. */ @Test public void copy1() { query( "copy $c := /b modify () return $c", ""); } /** * Detects corrupt namespace hierarchy. * @throws Exception exception */ @Test public void copy2() throws Exception { create(4); query( "declare namespace a='aa';" + "copy $c:=doc('d4') modify () return $c//a:y", ""); } /** * Detects missing prefix declaration. * @throws Exception exception */ @Test public void copy3() throws Exception { create(4); query( "declare namespace a='aa';" + "copy $c:=doc('d4')//a:y modify () return $c", ""); } /** * Detects duplicate namespace declaration in MemData instance. */ @Test public void copy4() { query( "copy $c := modify () return $c", ""); } /** * Detects bogus namespace after insert. * @throws Exception exception */ @Test public void bogusDetector() throws Exception { create(1); query( "insert node into doc('d1')/x", "declare namespace na = 'test';doc('d1')/x/na:a", ""); } /** * Detects empty default namespace in serializer. */ @Test public void emptyDefaultNamespace() { query("", ""); } /** * Detects duplicate default namespace in serializer. */ @Test public void duplicateDefaultNamespace() { query("", ""); } /** * Detects malformed namespace hierarchy. * @throws Exception exception */ @Test public void nsHierarchy() throws Exception { create(9); query("insert node into doc('d9')//*:e"); assertEquals(NL + " Pre[1] xmlns=\"A\" " + NL + " Pre[4] xmlns=\"D\" " + NL + " Pre[6] xmlns=\"F\" ", context.data().nspaces.toString()); } /** * Detects malformed namespace hierarchy. * @throws Exception exception */ @Test public void nsHierarchy2() throws Exception { create(10); query("insert node into doc('d10')//*:e"); assertEquals(NL + " Pre[1] xmlns=\"A\" " + NL + " Pre[4] xmlns=\"D\" " + NL + " Pre[5] xmlns=\"G\" " + NL + " Pre[7] xmlns=\"F\" ", context.data().nspaces.toString()); } /** * Detects malformed namespace hierarchy inserting an element. * @throws BaseXException exception */ @Test public void nsHierarchy3() throws BaseXException { query(transform( "", "insert node into $input"), ""); // in-depth test create(2); query("insert node into doc('d2')//*:x"); assertEquals(NL + " Pre[1] xmlns=\"xx\" " + NL + " Pre[2] xmlns=\"y\" ", context.data().nspaces.toString()); } /** * Detects malformed namespace hierarchy adding a document to an empty DB. * @throws BaseXException exception */ @Test public void nsHierarchy4() throws BaseXException { new CreateDB("d00x").execute(context); new Add("x", "").execute(context); query("/", ""); } /** Test query. */ @Test public void copy5() { query( "copy $c := " + "modify () return $c", ""); } /** * Test query. * @throws Exception exception */ @Test public void insertD2intoD1() throws Exception { create(1, 2); query( "insert node doc('d2') into doc('d1')/x", "doc('d1')", ""); } /** * Test query. * @throws Exception exception */ @Test public void insertD3intoD1() throws Exception { create(1, 3); query( "insert node doc('d3') into doc('d1')/x", "doc('d1')/x/*", ""); } /** * Test query. * @throws Exception exception */ @Test public void insertD3intoD1b() throws Exception { create(1, 3); query( "insert node doc('d3') into doc('d1')/x", "doc('d1')/x/*/*", ""); } /** * Detects missing prefix declaration. * @throws Exception exception */ @Test public void insertD4intoD1() throws Exception { create(1, 4); query( "declare namespace a='aa'; insert node doc('d4')/a:x/a:y " + "into doc('d1')/x", "doc('d1')/x", ""); } /** * Detects duplicate prefix declaration at pre=0 in MemData instance after * insert. * Though result correct, prefix * a is declared twice. -> Solution? * @throws Exception exception */ @Test public void insertD4intoD5() throws Exception { create(4, 5); query( "declare namespace a='aa';insert node doc('d4')//a:y " + "into doc('d5')/a:x", "declare namespace a='aa';doc('d5')//a:y", ""); } /** * Detects duplicate namespace declarations in MemData instance. * @throws Exception exception */ @Test public void insertD7intoD1() throws Exception { create(1, 7); query( "declare namespace x='xx';insert node doc('d7')/x:x into doc('d1')/x", "doc('d1')/x", ""); } /** * Detects general problems with namespace references. * @throws Exception exception */ @Test public void insertD6intoD4() throws Exception { create(4, 6); query( "declare namespace a='aa';insert node doc('d6') into doc('d4')/a:x", "declare namespace a='aa';doc('d4')/a:x/a:y", ""); } /** * Detects general problems with namespace references. */ @Test public void insertTransform1() { query( "declare default element namespace 'xyz';" + "copy $foo := modify insert nodes (, )" + "into $foo return $foo", ""); } /** * Detects general problems with namespace references. */ @Test public void insertTransformX() { query( "copy $foo := modify insert nodes ()" + "into $foo return $foo", ""); } /** * Detects wrong namespace references. * @throws Exception exception */ @Test public void uriStack() throws Exception { /* * [LK] problem: * - XMLParser.java l.146 calls ns.add before ns.open * - for this TC sequence of ns operations should be: * doc:open, a:open, b:open, b:add, b:close, c:open ... * BUT IS * doc:open, a:open, *b:add, b:open* ... */ create(8); query( "doc('d8')", ""); } /** * Deletes the document node and checks if namespace nodes of descendants * are deleted as well. F.i. adding a document via REST/PUT deletes a * document node if the given document/name is already stored in the target * collection. If the test fails, this may lead to superfluous namespace * nodes. * @throws Exception exception */ @Test public void deleteDocumentNode() throws Exception { create(2); context.data().startUpdate(); context.data().delete(0); context.data().finishUpdate(); final byte[] ns = context.data().nspaces.globalNS(); assertTrue(ns != null && ns.length == 0); } /** * Checks a path optimization fix. * @throws BaseXException database exception */ @Test public void queryPathOpt() throws BaseXException { create(17); query("doc('d17')/descendant::*:b", ""); } /** * Checks a path optimization fix. * @throws BaseXException database exception */ @Test public void queryPathOpt2() throws BaseXException { create(17); query("doc('d17')/*:a/*:b", ""); } /** * GH-249: Inserts an element with a prefixed attribute and checks * if there are superfluous namespace declarations for the element. * @throws BaseXException database exception */ @Test public void superfluousPrefixDeclaration() throws BaseXException { create(18); query( "declare namespace ns='ns'; " + "insert node into /n/a"); query("//*:a", ""); } /** * Checks namespace declarations. */ @Test public void renameNSCheck1() { query( "copy $copy := " + "modify rename node $copy as QName('uri', 'e') " + "return $copy", ""); } /** * Checks namespace declarations. */ @Test public void renameNSCheck2() { query( "copy $n := " + "modify rename node $n/b as QName('uri', 'e') " + "return $n/*:e", ""); } /** * Checks namespace declarations. */ @Test public void renameNSCheck3() { query( "copy $n := " + "modify rename node $n as QName('uri', 'e') " + "return $n", ""); } /** * Checks namespace declarations. */ @Test public void renameNSCheck4() { query( "copy $a := " + "modify rename node $a/@a as QName('uri', 'p:a') " + "return $a", ""); } /** * Checks namespace declarations. */ @Test public void renameNSCheck5() { error( "copy $a := " + "modify rename node $a/@a as QName('uri', 'p:a') " + "return $a", Err.UPNSCONFL); } /** * Checks namespace declarations. * Note: xmlns='' is being erroneously added. Might have to do with * Data.update(); see {@link RenameNode}. */ @Test public void renameDuplNSCheck() { query( "copy $a := " + "modify rename node $a/@a as fn:QName('uri', 'a') " + "return $a", ""); } /** * Checks namespace declarations. */ @Test public void renameRemoveNS1() { error( "copy $a := " + "modify for $el in $a/descendant-or-self::element() return " + "rename node $el as QName('',local-name($el)) " + "return $a", Err.UPNSCONFL); } /** * Checks namespace declarations. */ @Test public void renameRemoveNS2() { query( "copy $a := " + "modify for $el in $a/descendant-or-self::element() return " + "rename node $el as QName('',local-name($el)) " + "return $a", ""); } /** * Checks duplicate namespace declarations. * @throws BaseXException exception */ @Test public void avoidDuplicateNSDeclaration() throws BaseXException { create(19); query( "let $b := " + "return insert node $b//@*:id into /*:n"); assertEquals(1, context.data().ns(1).size()); } /** Handles duplicate prefixes. */ @Test public void duplicatePrefixes1() { query( "{ /@* }", ""); } /** Handles duplicate prefixes. */ @Test public void duplicatePrefixes2() { query( "{ /@* }
", ""); } /** Handles duplicate prefixes. */ @Test public void duplicatePrefixes3() { query( "{ /@* }
", ""); } /** Handles duplicate prefixes. */ @Test public void duplicatePrefixes4() { query( "{ /@* }
", ""); } /** * Test query. * Detects malformed namespace hierarchy. */ @Test public void nsInAtt() { query("data()}' xmlns:x='X'/>/@a)", "X"); } /** * Test query. * Detects malformed namespace hierarchy. */ @Test public void nsInBraces() { query("{namespace-uri-for-prefix('x', )}/text()", "X"); } /** * Test query. */ @Test public void defaultElementNamespaceTest() { query("declare default element namespace 'a';" + "let $x as element(a) := return $x", ""); } /** * Test query. * Detects malformed namespace hierarchy. */ @Test public void newPrefix() { query("{ attribute {QName('U', 'a')} {} }", ""); } /** * Test query. * Detects malformed namespace hierarchy. */ @Test public void newPrefix2() { query("" + "{attribute {QName('ns1', 'att1')} {}," + "attribute {QName('ns2', 'att2')} {}}", "" + "" + ""); } /** * Test query for stripping existing namespaces. * @throws Exception exception */ @Test public void stripNS() throws Exception { final IO io = IO.get(""); final ANode root = new DBNode(io, context.prop); final QueryProcessor qp = new QueryProcessor("/*:a/*:b", context).context(root); final ANode sub = (ANode) qp.iter().next(); DataBuilder.stripNS(sub, token("a"), context); } /** * Test query. * Detects malformed namespace hierarchy. */ @Test @Ignore public void xuty0004() { try { new QueryProcessor("declare variable $input-context external;" + "let $source as node()* := (" + " on leave," + " " + " )," + " $target := $input-context/works[1]/employee[1]" + "return insert nodes $source into $target", context).execute(); } catch(final QueryException ex) { assertEquals("XUTY0004", string(ex.qname().local())); } fail("should throw XUTY0004"); } /** * Tests preserve, no-inherit for copy expression. Related to XQUTS * id-insert-expr-081-no-inherit.xq. Tests if no-inherit has a persistent * effect. Is it actually supposed to? * The tag is inserted into a fragment f using no-inherit and copy. * The resulting fragment is inserted into a database. The * namespaces in scope with prefix 'ns' are finally checked for the * inserted tag. If the result is non-empty we may have a problem - * being not able propagate the no-inherit flag to our table. */ @Test @Ignore public void copyPreserveNoInheritPersistent() { query("declare copy-namespaces preserve,no-inherit;" + "declare namespace my = 'ns';" + "let $v :=" + "(copy $c := " + "modify insert node into $c " + "return $c)" + "return insert node $v into doc('d2')/n", "namespace-uri-for-prefix('my', doc('d2')//*:new)", ""); } /** * Checks if a query uses the outer default namespace. * @throws Exception exception */ @Test @Ignore public void defaultNS() throws Exception { create(1); query("{ doc('d1')/x }/*", ""); } /** * Test query. * @throws Exception exception */ @Test public void precedingSiblingNsDecl() throws Exception { create(20); query("//Q{A}a", ""); query("//Q{A}b", ""); query("//Q{A}c", ""); query("//Q{B}a", ""); query("//Q{B}b", ""); query("//Q{B}c", ""); } /** * Test query. * @throws Exception exception */ @Test public void duplicateXMLNamespace() throws Exception { create(1); query("insert node attribute xml:space { 'preserve' } into /x", ""); query(".", ""); error("insert node attribute xml:space { 'preserve' } into /x", Err.UPATTDUPL); } /** * Test query. */ @Test public void duplicateNamespaces() { query("copy $c := modify (" + " rename node $c as QName('X','b')," + " insert node attribute c{'a'} into $c" + ") return $c", ""); error("copy $c := modify (" + " rename node $c as QName('Y','b')," + " insert node attribute c{'a'} into $c" + ") return $c", Err.UPNSCONFL); query("copy $c := modify (" + " rename node $c as QName('X','b')," + " insert node attribute c{'a'} into $c" + ") return $c", ""); } /** * Creates the database context. * @throws BaseXException database exception */ @BeforeClass public static void start() throws BaseXException { // turn off pretty printing new Set(Prop.SERIALIZER, "indent=no").execute(context); } /** * Creates the specified test databases. * @param db database numbers * @throws BaseXException database exception */ static void create(final int... db) throws BaseXException { for(final int d : db) { final String[] doc = DOCS[d - 1]; new CreateDB(doc[0], doc[1]).execute(context); } } /** * Runs a query and matches the result against the expected output. * @param query query * @param expected expected output */ private static void query(final String query, final String expected) { query(null, query, expected); } /** * Runs an updating query and matches the result of the second query * against the expected output. * @param first first query * @param second second query * @param expected expected output */ private static void query(final String first, final String second, final String expected) { try { if(first != null) new XQuery(first).execute(context); final String result = new XQuery(second).execute(context).trim(); // quotes are replaced by apostrophes to simplify comparison final String res = result.replaceAll("\"", "'"); final String exp = expected.replaceAll("\"", "'"); if(!exp.equals(res)) fail("\n[E] " + exp + "\n[F] " + res); } catch(final BaseXException ex) { fail(Util.message(ex)); } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/QueryContextTest.java000066400000000000000000000023541222453003200275370ustar00rootroot00000000000000package org.basex.test.query; import static org.junit.Assert.*; import org.basex.io.*; import org.basex.query.*; import org.basex.query.util.*; import org.basex.test.*; import org.basex.util.*; import org.junit.*; /** * Tests for the {@link QueryContext}. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public class QueryContextTest extends SandboxTest { /** Tests the {@link QueryContext#parseLibrary(String, String)} method. */ @Test public void module() { final QueryContext qc = new QueryContext(context); try { qc.parseLibrary( "module namespace m='foo'; declare function m:foo() { m:bar() }; ", ""); fail("Unknown function 'm:bar()' was not detected."); } catch(final QueryException e) { assertSame(Err.FUNCUNKNOWN, e.err()); } finally { qc.close(); } } /** * Tests the {@link QueryContext#parseLibrary(String, String)} method. * @throws Exception exception */ @Test public void module2() throws Exception { final QueryContext qc = new QueryContext(context); final IOFile a = new IOFile("src/test/resources/recmod/a.xqm"); try { qc.parseLibrary(Token.string(a.read()), a.path()); } finally { qc.close(); } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/QueryTest.java000066400000000000000000000126121222453003200261700ustar00rootroot00000000000000package org.basex.test.query; import static org.junit.Assert.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.query.iter.*; import org.basex.query.value.item.*; import org.basex.test.*; import org.basex.test.query.simple.*; import org.basex.util.*; import org.junit.*; /** * This class tests the database commands. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class QueryTest extends SandboxTest { /** Document. */ protected static String doc; /** Queries. */ protected static Object[][] queries; /** Prepares the tests. */ @BeforeClass public static void startTest() { context.prop.set(Prop.CACHEQUERY, true); } /** * Tests the specified instance. * @throws BaseXException database exception */ @Test public void test() throws BaseXException { final String file = doc.replaceAll("\"", "\\\\\""); final String name = Util.name(QueryTest.class); final boolean up = this instanceof XQUPTest; new CreateDB(name, file).execute(context); final StringBuilder sb = new StringBuilder(); int fail = 0; for(final Object[] qu : queries) { // added to renew document after each update test final String title = (String) qu[0]; if(up && title.startsWith("xxx")) { new CreateDB(name, file).execute(context); } final boolean correct = qu.length == 3; final String query = qu[correct ? 2 : 1].toString(); final Result cmp = correct ? (Result) qu[1] : null; final Command c = new XQuery(query); try { c.execute(context); final Result val = c.result(); if(cmp instanceof Nodes) { ((Nodes) cmp).data = context.data(); } if(!correct || !val.sameAs(cmp)) { sb.append("[" + qu[0] + "] " + query); String s = correct && cmp.size() != 1 ? "#" + cmp.size() : ""; sb.append("\n[E" + s + "] "); if(correct) { final String cp = cmp.toString(); sb.append('\''); sb.append(cp.length() > 1000 ? cp.substring(0, 1000) + "..." : cp); sb.append('\''); } else { sb.append("error"); } final TokenBuilder types = new TokenBuilder(); if(val instanceof ValueBuilder) { final ValueBuilder vb = (ValueBuilder) val; for(final Item i : vb) types.add(i.type.toString()).add(" "); } else { types.add(Util.name(val)); } s = val.size() != 1 ? "#" + val.size() : ""; sb.append("\n[F" + s + "] '" + val + "', " + types + details() + '\n'); ++fail; } } catch(final Exception ex) { final String msg = ex.getMessage(); if(correct || msg == null || msg.contains("mailman")) { final String cp = correct && (!(cmp instanceof Nodes) || ((Nodes) cmp).data != null) ? cmp.toString() : "()"; sb.append("[" + qu[0] + "] " + query + "\n[E] " + cp + "\n[F] " + (msg == null ? Util.name(ex) : msg.replaceAll("\r\n?|\n", " ")) + ' ' + details() + '\n'); ++fail; } } } if(fail != 0) fail(fail + " Errors. [E] = expected, [F] = found:\n" + sb.toString().trim()); } /** * Returns property details. * @return details */ protected String details() { return ""; } /** * Creates a container for the specified node values. * @return node array */ protected static ValueBuilder empty() { return new ValueBuilder(); } /** * Creates a container for the specified node values. * @param nodes node values * @return node array */ protected static Nodes node(final int... nodes) { return new Nodes(nodes); } /** * Creates an iterator for the specified string. * @param str string * @return iterator */ protected static ValueBuilder str(final String... str) { final ValueBuilder ii = new ValueBuilder(); for(final String s : str) ii.add(Str.get(s)); return ii; } /** * Creates an iterator for the specified double. * @param d double value * @return iterator */ protected static ValueBuilder dbl(final double d) { return item(Dbl.get(d)); } /** * Creates an iterator for the specified decimal. * @param d decimal value * @return iterator */ protected static ValueBuilder dec(final double d) { return item(Dec.get(d)); } /** * Creates an iterator for the specified integer. * @param d double value * @return iterator */ protected static ValueBuilder itr(final long... d) { final ValueBuilder ii = new ValueBuilder(); for(final long dd : d) ii.add(Int.get(dd)); return ii; } /** * Creates an iterator for the specified boolean. * @param b boolean value * @return iterator */ protected static ValueBuilder bool(final boolean... b) { final ValueBuilder ii = new ValueBuilder(); for(final boolean bb : b) ii.add(Bln.get(bb)); return ii; } /** * Creates an iterator for the specified item. * @param i item * @return iterator */ private static ValueBuilder item(final Item i) { return new ValueBuilder().add(i); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/SeqTypeTest.java000066400000000000000000000201311222453003200264500ustar00rootroot00000000000000package org.basex.test.query; import static org.junit.Assert.*; import org.basex.query.value.type.*; import org.basex.query.value.type.SeqType.Occ; import static org.basex.query.value.type.SeqType.*; import static org.basex.query.value.type.SeqType.Occ.*; import org.junit.*; /** * Tests for the {@link SeqType} class. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public class SeqTypeTest { /** Tests for {@link Occ#intersect(Occ)}. */ @Test public void occIntersectTest() { final Occ[] occs = { ZERO, ZERO_ONE, ONE, ZERO_MORE, ONE_MORE }; final Occ[][] table = { { ZERO, ZERO, null, ZERO, null }, { ZERO, ZERO_ONE, ONE, ZERO_ONE, ONE }, { null, ONE, ONE, ONE, ONE }, { ZERO, ZERO_ONE, ONE, ZERO_MORE, ONE_MORE }, { null, ONE, ONE, ONE_MORE, ONE_MORE } }; for(int i = 0; i < occs.length; i++) for(int j = 0; j < occs.length; j++) assertSame("(" + i + ", " + j + ")", table[i][j], occs[i].intersect(occs[j])); } /** Tests for {@link Occ#union(Occ)}. */ @Test public void occUnionTest() { final Occ[] occs = { ZERO, ZERO_ONE, ONE, ZERO_MORE, ONE_MORE }; final Occ[][] table = { { ZERO, ZERO_ONE, ZERO_ONE, ZERO_MORE, ZERO_MORE }, { ZERO_ONE, ZERO_ONE, ZERO_ONE, ZERO_MORE, ZERO_MORE }, { ZERO_ONE, ZERO_ONE, ONE, ZERO_MORE, ONE_MORE }, { ZERO_MORE, ZERO_MORE, ZERO_MORE, ZERO_MORE, ZERO_MORE }, { ZERO_MORE, ZERO_MORE, ONE_MORE, ZERO_MORE, ONE_MORE } }; for(int i = 0; i < occs.length; i++) for(int j = 0; j < occs.length; j++) assertSame("(" + i + ", " + j + ")", table[i][j], occs[i].union(occs[j])); } /** Tests for {@link Occ#instanceOf(Occ)}. */ @Test public void occInstanceOfTest() { final Occ[] occs = { ZERO, ZERO_ONE, ONE, ZERO_MORE, ONE_MORE }; final int bits = 0x014F90E1; assertTrue(Occ.ONE.instanceOf(Occ.ZERO_MORE)); assertFalse(Occ.ZERO_MORE.instanceOf(Occ.ONE)); for(int i = 0; i < occs.length; i++) { for(int j = 0; j < occs.length; j++) { final boolean inst = (bits >>> 5 * j + i & 1) != 0; assertEquals("(" + i + ", " + j + ")", inst, occs[i].instanceOf(occs[j])); } } } /** Tests for {@link SeqType#instanceOf(SeqType)}. */ @Test public void instanceOfTest() { assertTrue(BLN.instanceOf(AAT_ZM)); assertFalse(AAT_ZM.instanceOf(BLN)); assertTrue(DBL.instanceOf(DBL_ZM)); assertFalse(DBL_ZM.instanceOf(DBL)); final SeqType f = FuncType.get(DEC_ZO, BLN).seqType(), m = MapType.get(AtomType.AAT, ITR).seqType(); assertTrue(m.instanceOf(f)); assertFalse(f.instanceOf(m)); assertFalse(f.instanceOf(ITR)); assertTrue(f.instanceOf(ITEM)); assertTrue(f.instanceOf(f)); assertTrue(f.instanceOf(FUN_OZ)); assertFalse(FUN_O.instanceOf(f)); assertFalse(f.instanceOf(FuncType.get(DEC_ZO, BLN, ITR).seqType())); assertFalse(f.instanceOf(FuncType.get(DEC_ZO, AAT).seqType())); assertFalse(f.instanceOf(FuncType.get(BLN, BLN).seqType())); assertFalse(MAP_O.instanceOf(m)); assertTrue(m.instanceOf(MAP_O)); assertFalse(m.instanceOf(MapType.get(AtomType.AAT, BLN).seqType())); assertFalse(MapType.get(AtomType.BLN, ITR).seqType().instanceOf(m)); assertTrue(ATT.instanceOf(NOD)); assertTrue(ATT.instanceOf(ATT)); assertFalse(ATT.instanceOf(ELM)); assertFalse(ELM.instanceOf(f)); assertFalse(NOD.instanceOf(ELM)); assertFalse(ITEM.instanceOf(ELM)); assertTrue(ELM.instanceOf(ITEM)); } /** Tests for {@link SeqType#union(SeqType)}. */ @Test public void unionTest() { assertTrue(STR.union(ITR).eq(AAT)); assertTrue(STR.union(STR).eq(STR)); assertTrue(STR.union(ATT).eq(ITEM)); assertTrue(AtomType.NST.seqType().union(STR).eq(STR)); assertTrue(STR.union(AtomType.NST.seqType()).eq(STR)); assertTrue(STR.union(AtomType.JAVA.seqType()).eq(ITEM)); assertTrue(ATT.union(ELM).eq(NOD)); assertTrue(NOD.union(ELM).eq(NOD)); assertTrue(ELM.union(NOD).eq(NOD)); assertTrue(ELM.union(ELM).eq(ELM)); assertTrue(ELM.union(STR).eq(ITEM)); final SeqType // function(xs:boolean) as xs:decimal? f = FuncType.get(DEC_ZO, BLN).seqType(), // function(xs:boolean) as xs:nonNegativeInteger f2 = FuncType.get(AtomType.NNI.seqType(), BLN).seqType(), // function(xs:boolean, xs:boolean) as xs:nonNegativeInteger f3 = FuncType.get(AtomType.NNI.seqType(), BLN, BLN).seqType(), // function(xs:integer) as xs:nonNegativeInteger f4 = FuncType.get(AtomType.NNI.seqType(), ITR).seqType(), // function(xs:boolean) as xs:integer f5 = FuncType.get(ITR, BLN).seqType(), // map(xs:anyAtomicType, xs:integer) m = MapType.get(AtomType.AAT, ITR).seqType(), // map(xs:boolean, xs:integer) m2 = MapType.get(AtomType.BLN, ITR).seqType(), // map(xs:boolean, xs:nonNegativeInteger) m3 = MapType.get(AtomType.BLN, AtomType.NNI.seqType()).seqType(), // map(xs:integer, xs:integer) m4 = MapType.get(AtomType.ITR, ITR).seqType(); union(f, ITR, ITEM); union(f, FUN_O, FUN_O); union(f2, f3, FUN_O); union(f2, f4, FUN_O); union(MAP_O, m, MAP_O); union(m, ITR, ITEM); union(m, f, f); union(m, f2, f5); union(m, m2, m2); union(m, m3, m2); union(m2, m4, FUN_O); } /** * Union test method. * @param a one argument * @param b other argument * @param res result */ private static void union(final SeqType a, final SeqType b, final SeqType res) { assertTrue(a + ", " + b, a.union(b).eq(res)); assertTrue(b + ", " + a, b.union(a).eq(res)); } /** Tests for {@link SeqType#intersect(SeqType)}. */ @Test public void intersectTest() { final SeqType // function(xs:boolean) as xs:decimal? f = FuncType.get(DEC_ZO, BLN).seqType(), // function(xs:boolean) as xs:nonNegativeInteger f2 = FuncType.get(AtomType.NNI.seqType(), BLN).seqType(), // function(xs:boolean, xs:boolean) as xs:nonNegativeInteger f3 = FuncType.get(AtomType.NNI.seqType(), BLN, BLN).seqType(), // function(xs:integer) as xs:nonNegativeInteger f4 = FuncType.get(AtomType.NNI.seqType(), ITR).seqType(), // function(xs:boolean) as xs:integer f5 = FuncType.get(ITR, BLN).seqType(), // function(xs:boolean) as xs:boolean f6 = FuncType.get(BLN, BLN).seqType(), // map(xs:anyAtomicType, xs:integer) m = MapType.get(AtomType.AAT, ITR).seqType(), // map(xs:boolean, xs:integer) m2 = MapType.get(AtomType.BLN, ITR).seqType(), // map(xs:boolean, xs:nonNegativeInteger) m3 = MapType.get(AtomType.BLN, AtomType.NNI.seqType()).seqType(), // map(xs:integer, xs:integer) m4 = MapType.get(AtomType.ITR, ITR).seqType(); intersect(SeqType.get(AtomType.ITEM, 0), ITEM, null); intersect(ATT, ATT, ATT); intersect(ATT, NOD, ATT); intersect(ATT, ELM, null); intersect(NOD, ITR, null); intersect(f, ITR, null); intersect(f, f, f); intersect(f, f2, f2); intersect(m, f, m); intersect(f, f5, f5); intersect(f, f4, FuncType.get(AtomType.NNI.seqType(), AAT).seqType()); intersect(f2, f3, null); intersect(f5, f6, null); intersect(m, ITEM, m); intersect(m, ITR, null); intersect(m, m2, m); intersect(m, m3, MapType.get(AtomType.AAT, AtomType.NNI.seqType()).seqType()); intersect(m2, m4, m); intersect(m2, MapType.get(AtomType.BLN, BLN).seqType(), null); intersect(m, FUN_O, m); intersect(m, f, m); intersect(m4, f5, m); intersect(m, f3, null); intersect(m, f6, null); intersect(m, FuncType.get(ITR, ITEM).seqType(), null); } /** * Intersect test method. * @param a one argument * @param b other argument * @param r result or {@code null} */ private static void intersect(final SeqType a, final SeqType b, final SeqType r) { assertTrue(a + ", " + b, r != null ? a.intersect(b).eq(r) : a.intersect(b) == null); assertTrue(b + ", " + a, r != null ? b.intersect(a).eq(r) : b.intersect(a) == null); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/SerializerTest.java000066400000000000000000000060221222453003200271720ustar00rootroot00000000000000package org.basex.test.query; import org.basex.query.util.*; import org.junit.*; /** * This class tests serializer. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class SerializerTest extends AdvancedQueryTest { /** Test: method=xml. */ @Test public void xml() { final String option = "declare option output:method 'xml';"; query(option + "", ""); } /** Test: method=xhtml. */ @Test public void xhtml() { final String option = "declare option output:method 'xhtml';"; query(option + "", ""); final String[] empties = { "area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "basefont", "frame", "isindex", "param" }; for(final String e : empties) query(option + "<" + e + "/>", "<" + e + " />"); } /** Test: method=html. */ @Test public void html() { final String option = "declare option output:method 'html';"; query(option + "", ""); final String[] empties = { "area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "basefont", "frame", "isindex", "param" }; for(final String e : empties) query(option + "<" + e + "/>", "<" + e + ">"); query(option + "", ""); query(option + "", ""); query(option + "", ""); error(option + "", Err.SERILL); query(option + "", ""); error(option + " ?>", Err.SERPI); } /** Test: method=html, version=5.0. */ @Test public void version50() { final String option = "declare option output:method 'html';" + "declare option output:version '5.0';"; query(option + "", ""); final String[] empties = { "area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr" }; for(final String e : empties) { query(option + "<" + e + "/>", "<" + e + ">"); } query(option + "", ""); } /** Test: method=html, html-version=5.0. */ @Test public void htmlVersion50() { final String option = "declare option output:method 'html';" + "declare option output:html-version '5.0';"; query(option + "", ""); } /** Test: method=text. */ @Test public void text() { final String option = "declare option output:method 'text';"; query(option + "1,2", "1 2"); query(option + "1", "1"); query(option + "1,2,3", "123"); } /** Test: item-separator. */ @Test public void itemSeparator() { query("declare option output:item-separator '-'; 1,2", "1-2"); query("declare option output:item-separator ''; 1,2", "12"); query("declare option output:item-separator 'ABC'; 1 to 3", "1ABC2ABC3"); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/ast/000077500000000000000000000000001222453003200241455ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/java/org/basex/test/query/ast/FlworOptimizeTest.java000066400000000000000000000207321222453003200304660ustar00rootroot00000000000000package org.basex.test.query.ast; import org.basex.core.*; import org.basex.query.expr.*; import org.basex.query.gflwor.*; import org.basex.util.*; import org.junit.*; /** * Tests for rewritings of FLWOR-expressions. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class FlworOptimizeTest extends QueryPlanTest { /** Tests the relocation of a static let clause. */ @Test public void moveTop() { check("let $b := a " + "for $i in 1 to 2 " + "let $m := $b " + "return $m/text()", "aa", Util.info("every $l in //% satisfies $l << //%", Let.class, For.class) ); } /** Tests the relocation of a let clause. */ @Test public void moveMid() { check("let $seq := ('a', 'b', 'c') " + "for $i in 1 to count($seq) " + "for $j in $i + 1 to count($seq) " + "let $a as xs:string := $seq[$i] " + "return concat($i, $j, $a, $a)", "12aa 13aa 23bb", "let $a := //Let[Var/@name eq '$a'] return " + "//For[Var/@name eq '$i'] << $a and $a << //For[Var/@name eq '$j']" ); } /** Tests the relocation of a let clause. */ @Test public void dontMove() { check("let $seq := ('a', 'b', 'c') " + "for $i in 1 to count($seq) " + "for $j in $i + 1 to count($seq) " + "let $b as xs:string := $seq[$j] " + "return concat($i, $j, $b, $b)", "12bb 13cc 23cc", Util.info("every $f in //% satisfies $f << //%[starts-with(Var/@name, '$b')]", For.class, Let.class) ); } /** Tests the relocation of a let clause. */ @Test public void dontMove2() { check("let $a := , $b := , $c := ($a,$a)[1] " + "for $i in 1 to 2 return ($c,$b)", "" + Prop.NL + "" + Prop.NL + "" + Prop.NL + "", Util.info("//Let[Var/@name='$a'] << //Let[Var/@name='$b'] and " + "//Let[Var/@name='$b'] << //Let[Var/@name='$c']") ); } /** Tests the relocation of a static let clause. */ @Test public void moveFor() { check("let $x := " + "for $a in 1 to 2 " + "for $b as element(x) in $x " + "return ($b, $b)[1]", "" + Prop.NL + "", "//(For | Let)[Var/@name='$b'] << //For[Var/@name='$a']", "every $let in //Let, $for in //For satisfies $let << $for" ); } /** Tests the relocation of a where clause. */ @Test public void slideWhere() { check("for $i at $p in 1 to 1000 " + "let $sum as xs:integer := sum(1 to $i * $i) " + "where $i lt 5 " + "return ($sum,$sum)[1]", "1 10 45 136", "//For << //Where and //Where << //Let" ); check("for $len in 1 to 3 " + "for sliding window $w in 1 to 3 start at $p when true() only " + "end at $q when $q - $p + 1 eq $len where $len > 2 return {$w}", "1 2 3", "//For << //Window and exists(//For/*[ends-with(name(), 'Filter')])" ); } /** Tests if multiple successive where clauses are merged into one. */ @Test public void mergeWheresTest() { Prop.debug = true; check("let $rnd := random:double() where $rnd div 2 >= 0.2 where $rnd < 0.5 " + "where round(2 * $rnd) eq 1 return $rnd", null, "exists(exactly-one(//Where))", "exists(//Where/And)" ); } /** Tests if where clauses are converted to predicates where applicable. */ @Test public void whereToPred() { check("for $i in 1 to 10 where [$i] and $i < 3 return $i", "1", "exists(//Where) and exists(//For/*[ends-with(name(), 'Filter')])" ); check("for $i in 1 to 10 where ()[$i] return $i", "1", "exists(//Where)" ); check("for $i in 1 to 3 " + "where count(for $j in 1 to $i group by $k := $j mod 2 return $i) > 1 " + "return $i", "2 3", "empty(//Where) and exists(//*[ends-with(name(), 'Filter')])" ); } /** Tests if let clauses are moved out of any loop they don't depend on. */ @Test public void slideLet() { check("for $i in 0 to 3, $j in 0 to 3 where ()[$i + $j] " + "let $foo := $i * $i return $foo * $foo", "0 1", "every $let in //Let satisfies $let << exactly-one(//Where)" ); check("/(for $i in 1 to 3 let $x := . where $x return $x)", "", "//GFLWOR/*[1] is //Let" ); check("for $len in 1 to 3 " + "for sliding window $w in 1 to 3 start at $p when true() only " + "end at $q when $q - $p + 1 eq $len " + "let $x := $len div 2 " + "return count($w) div ($x + $x)", "1 1 1 1 1 1", "//For << //Let and //Let << //Window" ); } /** Tests if multiple let clauses are all moved to their optimal position. */ @Test public void slideMultipleLets() { check("for $i in 1 to 2 for $j in 1 to 2 " + "let $a as xs:integer := 3 * $i, " + " $b as xs:integer := 2 * $i " + "return $a * $a + $b * $b", "13 13 52 52", "exists(//For[every $let in //Let satisfies . << $let])", "exists(//For[every $let in //Let satisfies . >> $let])", "//Let[Var/@name='$a'] << //Let[Var/@name='$b']" ); } /** Tests if where clauses containing non-deterministic expressions are left alone. */ @Test public void dontSlideWhereNDT() { check("for $x in 1 to 100 where random:double() gt 0.5 return $x", null, "exactly-one(//Where) >> exactly-one(//For)" ); } /** Tests if let clauses containing non-deterministic expressions are left alone. */ @Test public void dontSlideLetNDT() { check("for $i in 1 to 10 let $rnd := random:double() return $i * $rnd", null, "exactly-one(//For) << exactly-one(//Let)" ); } /** Tests if let clauses containing node constructors are left alone. */ @Test public void dontSlideLetCNS() { check("for $i in 1 to 10 let $x := return ($i, $x, $x)", null, "//For << //Let" ); } /** Tests is where clauses are rewritten to if. */ @Test public void whereToIfTest() { check("(1 to 3) ! (for $j in 1 to 5 where . eq 1 return $j)", "1 2 3 4 5", "exists(//If) and empty(//GFLWOR)" ); check("(1 to 3) ! (for $j at $p in 1 to 5 where . eq 1 return $j * $p)", "1 4 9 16 25", "exists(//If) and exists(//GFLWOR)" ); check("let $x := 0 where $x != 0 return 42 idiv $x", "", "exists(//If) and starts-with(//If/*[2]/@name, 'error(')"); } /** Tests if {@code for $x in E return $x} is rewritten to {@code E} inside FLWORs. */ @Test public void inlineForTest() { check("let $x := 5 for $i in 1 to $x return $i", "1 2 3 4 5", "empty(//For)" ); } /** Tests if {@link And} expressions inside {@code where} are split. */ @Test public void splitWhereTest() { check("for $i in 1 to 5, $j in 1 to 5 where $i < 3 and $j < 3 return $i * $j", "1 2 2 4", "empty(//Where)", "every $for in //For satisfies exists($for/*[ends-with(name(), 'Filter')])" ); } /** Tests if redundant FLWOR expressions are eliminated. */ @Test public void eliminateFLWORTest() { check("let $x := (23, 42) where true() for $y in $x return $y", "23 42", "empty(//GFLWOR)" ); } /** Tests FLWOR expressions containing updates or non-determinism are left alone. */ @Test public void dontEliminateFLWORTest() { check("copy $x := modify " + " for $i in 1 to 3 let $y := {$i} return insert node $y into $x " + "return $x", String.format("%1$s 1%1$s 2%1$s 3%1$s", Prop.NL), "exists(//GFLWOR) and exists(//Insert)" ); check("for $i in 1 to 3 let $x := $i * $i return error()", null, "exists(//GFLWOR)" ); } /** Tests if empty FLWOR expressions are replaced by the empty sequence. */ @Test public void eliminateEmptyFLWORTest() { // literal false() check("for $x in 1 to 100 where false() return $x", "", "exists(//Empty)" ); // empty return clause check("for $x in 1 to 100 return ()", "", "exists(//Empty)" ); // value with ebv == false in where check("for $x in 1 to 100 where () return $x", "", "exists(//Empty)" ); } /** Tests if {@link And} expressions inside {@code where} are split. */ @Test public void dontInlineNDTTest() { check("let $rnd := random:double() return (1 to 10) ! $rnd", null, "exists(//Let)" ); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/ast/FuncItemTest.java000066400000000000000000000105271222453003200273670ustar00rootroot00000000000000package org.basex.test.query.ast; import org.basex.query.func.*; import org.basex.query.value.item.*; import org.basex.util.*; import org.junit.*; /** * Tests for compiling function items. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class FuncItemTest extends QueryPlanTest { /** Checks if the identity function is pre-compiled. */ @Test public void idTest() { check("function($x) { $x }(42)", "42", "exists(//" + Util.name(FuncItem.class) + ")" ); } /** Checks if a function literal is pre-compiled. */ @Test public void literalTest() { check("lower-case#1('FooBar')", "foobar", "exists(//" + Util.name(FuncItem.class) + ")" ); } /** Checks if a partial application is pre-compiled. */ @Test public void partAppTest() { check("starts-with('foobar', ?)('foo')", "true", "exists(//" + Util.name(FuncItem.class) + ")" ); } /** Checks if a partial application with non-empty closure is left alone. */ @Test public void partApp2Test() { check("for $sub in ('foo', 'bar')" + "return starts-with(?, $sub)('foobar')", "true false", "exists(//" + Util.name(PartFunc.class) + ")" ); } /** Checks that the Y combinator is pre-compiled. */ @Test public void yCombinatorTest() { check("function($f) {" + " let $loop := function($x) { $f(function() { $x($x) }) }" + " return $loop($loop)" + "}(function($f) { 42 })", "42", // both outer inline functions are pre-compiled "exists(//" + Util.name(DynFuncCall.class) + ")", "every $f in outermost(//" + Util.name(DynFuncCall.class) + ")/* satisfies" + " $f instance of element(" + Util.name(FuncItem.class) + ")" ); } /** Checks if {@code fold-left1(...)} can be used. */ @Test public void foldLeft1Test() { check("hof:fold-left1(1 to 42, function($a, $b) { max(($a, $b)) })", "42" ); } /** Checks if statically unused functions are compiled at runtime. */ @Test public void compStatUnusedTest() { check("declare function local:foo() { abs(?) };" + "function-lookup(xs:QName('local:foo'), 0)()(-42)", "42", "exists(//" + Util.name(PartFunc.class) + ")" ); } /** * Checks if statically used functions are compiled at compile time. * Added because of issue GH-382. */ @Test public void compStatUsedTest() { check("declare function local:a() { local:b() };" + "declare function local:b() { 42 };" + "local:a#0()", "42", "exists(//" + Util.name(FuncItem.class) + ")" ); } /** Checks for circular references leading to stack overflows. */ @Test public void noLoopTest() { check("declare function local:Y($f) { $f(function() { $f }) };" + "let $f := local:Y(function($x) { $x() }) return $f[2]", "", "exists(//" + Util.name(FuncItem.class) + ")" ); } /** Checks for circular references leading to stack overflows. */ @Test public void noLoopTest2() { check("declare function local:Y($f) { $f(function() { $f }) };" + "for-each(function($x) { $x() }, local:Y#1)[2]", "", "exists(//" + Util.name(FuncItem.class) + ")" ); } /** Checks for circular references leading to stack overflows. */ @Test public void noLoopTest3() { check("declare function local:Y($f) { $f(function() { $f }) };" + "let $f := for-each(function($x) { $x() }, local:Y#1) return $f[2]", "", "exists(//" + Util.name(FuncItem.class) + ")" ); } /** Checks for circular references leading to stack overflows. */ @Test public void noLoopTest4() { check("declare function local:foo($x) { function($f) { $f($x) } };" + "declare function local:bar($f) { $f(function($_) { $f }) };" + "let $a := local:foo(local:foo(function($e) { $e() })) " + "let $b := local:bar($a) " + "return $b[2]", "", "exists(//" + Util.name(FuncItem.class) + ")" ); } /** Checks for circular references leading to stack overflows. */ @Test public void noLoopTest5() { check("declare function local:foo($f) { $f($f) };" + "let $id := local:foo(function($g) { $g })" + "return $id(42)", "42", "exists(//" + Util.name(FuncItem.class) + ")" ); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/ast/InlineTest.java000066400000000000000000000026561222453003200270770ustar00rootroot00000000000000package org.basex.test.query.ast; import org.basex.query.expr.*; import org.junit.*; /** * Tests for inlining. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public class InlineTest extends QueryPlanTest { /** Tests if inlining works in {@link Arith} expressions. */ @Test public void plusTest() { check("let $x := 21 return $x + 21", "42", "empty(//GFLWOR)"); check("let $x := 21 return 21 + $x", "42", "empty(//GFLWOR)"); check("let $x := 21 return $x + $x", "42", "empty(//GFLWOR)"); check("let $x := 21 return $x + 21", "42", "exists(//GFLWOR)"); } /** Tests if variable uses in {@link Switch} are counted correctly. */ @Test public void switchTest() { // all paths use $x only once check("let $x := 1 ! 42 return switch(42) case 23 return $x case 84 return $x" + " case $x return 123 default return 1337", "123", "empty(//GFLWOR)"); // $x is used twice check("let $x := 1 ! 42 return switch(23) case $x return 123 case 23 return $x" + " default return 1337", "42", "exists(//GFLWOR)"); } /** Regression test for Issue GH-738, "switch with contains". */ @Test public void gh738() { check("let $item:=blah blah " + "let $type:= switch (fn:true())" + " case $item contains text \"blah\" return a" + " default return ()" + "return $type", "a", "count(//Let) = 2"); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/ast/QueryPlanTest.java000066400000000000000000000026761222453003200276030ustar00rootroot00000000000000package org.basex.test.query.ast; import static org.basex.core.Prop.*; import static org.junit.Assert.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.test.query.*; import org.basex.util.*; /** * Abstract test class for properties on the Query Plan. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public abstract class QueryPlanTest extends AdvancedQueryTest { /** * Checks the query plan and the result. * @param qu query * @param res result or {@code null} for no comparison * @param pr queries on the query plan */ protected static final void check(final String qu, final String res, final String... pr) { final QueryProcessor qp = new QueryProcessor(qu, context); try { // parse and compile query plan qp.compile(); // retrieve compiled query plan final FDoc plan = qp.plan(); // compare results if(res != null) assertEquals(res, qp.execute().toString()); for(final String p : pr) { if(new QueryProcessor(p, context).context(plan).value() != Bln.TRUE) { fail(NL + "- Query: " + qu + NL + "- Check: " + p + NL + "- Plan: " + plan.serialize()); } } } catch(final Exception ex) { final AssertionError err = new AssertionError(Util.message(ex)); err.initCause(ex); throw err; } finally { qp.close(); } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/ast/StringRangeTest.java000066400000000000000000000105421222453003200300750ustar00rootroot00000000000000package org.basex.test.query.ast; import java.util.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.core.parse.Commands.*; import org.basex.query.expr.*; import org.basex.util.*; import org.junit.*; /** * This class tests if string range queries are correctly evaluated with(out) the index. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class StringRangeTest extends QueryPlanTest { /** * Initializes the tests. * @throws BaseXException database exception */ @BeforeClass public static void start() throws BaseXException { final Random rnd = new Random(); // create initial document final TokenBuilder tb = new TokenBuilder(); final TokenBuilder r = new TokenBuilder(); tb.add(""); for(int i = 100; i < 1000; i++) { // add numeric value tb.add("").addInt(i).add(""); // add random value final int s = rnd.nextInt(8); for(int j = 0; j <= s; j++) r.add('A' + rnd.nextInt(26)); tb.add("").add(r.finish()).add(""); r.reset(); } tb.add(""); new CreateDB(NAME, tb.toString()).execute(context); } /** * Finishes the tests. * @throws BaseXException database exception */ @AfterClass public static void finish() throws BaseXException { new DropDB(NAME).execute(context); } /** * Testing greater-equal and less-equal. * @throws BaseXException database exception */ @Test public void geLe() throws BaseXException { final Class clz = StringRangeAccess.class; test("exists(//*[text() >= '999' and text() <= '999'])", "true", ValueAccess.class); test("count(//*[text() >= '990' and text() <= '999'])", "10", clz); test("count(//*[text() >= '900' and text() <= '999'])", "100", clz); test("count(//*[text() >= '100' and text() <= '999'])", "900", clz); test("count(//*[text() >= ' ' and text() <= 'a' ])", "1800", clz); test("count(//*[text() >= '@' and text() <= 'a' ])", "900", clz); test("count(//*[text() >= '@'])", "900"); } /** * Testing less-equal and greater-equal. * @throws BaseXException database exception */ @Test public void leGe() throws BaseXException { final Class clz = StringRangeAccess.class; test("exists(//*[text() <= '999' and text() >= '999'])", "true", ValueAccess.class); test("count(//*[text() <= '999' and text() >= '990'])", "10", clz); test("count(//*[text() <= '999' and text() >= '900'])", "100", clz); test("count(//*[text() <= '999' and text() >= '100'])", "900", clz); test("count(//*[text() <= 'zzz' and text() >= ' ' ])", "1800", clz); test("count(//*[text() <= 'a' and text() >= '@' ])", "900", clz); } /** * Testing greater-than and less-than. * @throws BaseXException database exception */ @Test public void gtLt() throws BaseXException { final Class clz = StringRangeAccess.class; test("exists(//*[text() > '999' and text() < '999'])", "false"); test("count(//*[text() > '990' and text() < '999'])", "8", clz); test("count(//*[text() > '900' and text() < '999'])", "98", clz); test("count(//*[text() > '100' and text() < '999'])", "898", clz); test("count(//*[text() > ' ' and text() < 'a' ])", "1800", clz); test("count(//*[text() > '@' and text() < 'a' ])", "900", clz); test("count(//*[text() > '@'])", "900"); } /** * Tests a query with and without index. * @param query query * @param result expected result * @param expr class expected in query plan * @throws BaseXException database exception */ public void test(final String query, final String result, final Class expr) throws BaseXException { new CreateIndex(CmdIndex.TEXT).execute(context); check(query, result, "exists(//" + expr.getSimpleName() + ")"); new DropIndex(CmdIndex.TEXT).execute(context); check(query, result, "not(//" + expr.getSimpleName() + ")"); } /** * Tests a query with and without index. * @param query query * @param result expected result * @throws BaseXException database exception */ public void test(final String query, final String result) throws BaseXException { new CreateIndex(CmdIndex.TEXT).execute(context); check(query, result); new DropIndex(CmdIndex.TEXT).execute(context); check(query, result); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/ast/TCOTest.java000066400000000000000000000102151222453003200262740ustar00rootroot00000000000000package org.basex.test.query.ast; import org.basex.query.expr.*; import org.basex.query.func.*; import org.basex.query.value.item.*; import org.basex.util.*; import org.junit.*; /** * Tests for proper tail-calls. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public class TCOTest extends QueryPlanTest { /** Checks if tail-call optimization was applied. */ @Test public void facTest() { check("declare function local:fac($n, $f) {" + " if($n = 0) then $f" + " else local:fac($n - 1, $f * $n)" + "};" + "local:fac(123, xs:decimal('1'))", "12146304367025329675766243241881295855454217088483382315328918161829" + "23589236216766883115696061264020217073583522129404778259109157041165" + "14721860295199062616467307339074198149529600000000000000000000000000" + "00", "exists(//" + Util.name(StaticFuncCall.class) + "[@tailCall = 'true'])" ); } /** Checks if TCO was applied to mutually recursive functions. */ @Test public void evenOddTest() { check("declare function local:odd($n) {" + " if($n = 0) then false()" + " else local:even($n - 1)" + "};" + "declare function local:even($n) {" + " if($n = 0) then true()" + " else local:odd($n - 1)" + "};" + "local:odd(123)", "true", "count(//" + Util.name(StaticFuncCall.class) + "[@tailCall eq 'true']) eq 2" ); } /** Checks if partially tail-recursive functions are properly optimized. */ @Test public void fastPowTest() { check("declare function local:pow($n, $k) {" + " if($k = 0) then xs:decimal(1)" + " else if($k mod 2 = 0) then local:pow($n * $n, $k idiv 2)" + " else $n * local:pow($n * $n, $k idiv 2)" + "};" + "local:pow(4, 5)", "1024", "exists(//" + Util.name(StaticFuncCall.class) + "[@tailCall eq 'true'])", "count(//" + Util.name(StaticFuncCall.class) + "[@tailCall eq 'false']) eq 2" ); } /** Checks if a function only containing a tail call is properly optimized. */ @Test public void tightLoopTest() { check("declare function local:foo() { local:foo() }; local:foo()", null, "exists(//" + Util.name(StaticFunc.class) + "/" + Util.name(StaticFuncCall.class) + "[@tailCall eq 'true'])", "exists(//" + Util.name(StaticFuncCall.class) + "[@tailCall eq 'false'])" ); } /** Checks if a function only containing a tail call is properly optimized. */ @Test public void selfRecursive() { check("declare function local:f($i) { if($i eq 12345) then $i else local:f($i+1) };" + "local:f(0)", "12345", "exists(//" + Util.name(If.class) + "/" + Util.name(StaticFuncCall.class) + "[@tailCall eq 'true'])" ); } /** Checks if a function only containing a tail call is properly optimized. */ @Test public void mixedSelfRecursive() { check("declare function local:inc($i) { $i + 1 };" + "declare function local:f($i) { if($i eq 12345) then $i " + "else local:f(local:inc($i)) };" + "local:f(0)", "12345", "exists(//" + Util.name(If.class) + "/" + Util.name(StaticFuncCall.class) + "[@tailCall eq 'true'])" ); } /** Checks if dynamic function calls are tail-call optimized. */ @Test public void dynFuncCall() { check("let $sum :=" + " function($seq) {" + " let $go :=" + " function($seq, $acc, $go) {" + " if(empty($seq)) then $acc" + " else $go(tail($seq), $acc + head($seq), $go)" + " }" + " return $go($seq, 0, $go)" + " }" + "return $sum(1 to 100000)", "5000050000", "empty(//" + Util.name(FuncItem.class) + "//" + Util.name(DynFuncCall.class) + "[@tailCall eq 'false'])" ); } /** Checks if continuations are caught in built-in HOFs. */ @Test public void hofCont() { check("declare function local:f($n) { if($n eq 0) then 42 else local:f($n - 1) };" + "fn:for-each(1000, function($x) { local:f($x) })", "42" ); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/expr/000077500000000000000000000000001222453003200243345ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/java/org/basex/test/query/expr/AnnotationsTest.java000066400000000000000000000051441222453003200303400ustar00rootroot00000000000000package org.basex.test.query.expr; import org.basex.query.util.*; import org.basex.test.query.*; import org.junit.*; /** * Annotations tests. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class AnnotationsTest extends AdvancedQueryTest { /** Parsing of function declarations. */ @Test public void functionDecl() { query("declare namespace a='a';declare %a:a function local:x() {1}; local:x()", "1"); query("declare %public function local:x() { 1 }; local:x()", "1"); query("declare %private function local:x() { 1 }; local:x()", "1"); query("declare namespace a='a';declare %a:a function local:x() {1}; local:x()", "1"); } /** Parsing of variable declarations. */ @Test public void varDecl() { query("declare %public variable $x := 1; $x", "1"); query("declare %private variable $x := 1; $x", "1"); query("declare namespace a='a';declare %a:a variable $x := 1; $x", "1"); query("declare namespace a='a';declare %a:a(1) %a:b(2) variable $x:=1; $x", "1"); } /** Parsing errors and conflicts. */ @Test public void conflicts() { error("declare namespace a='a';declare %a:a() variable $x:=1; $x", Err.ANNVALUE); error("declare namespace a='a';declare %a:a() variable $x:=1; $x", Err.ANNVALUE); error("declare %pfff:public variable $x := 1; $x", Err.NOURI); error("declare %public %public variable $x := 1; $x", Err.DUPLVARVIS); error("declare %public %private variable $x := 1; $x", Err.DUPLVARVIS); error("declare %updating variable $x := 1; $x", Err.UPDATINGVAR); error("declare %updating function local:x() { 1 }; local:x()", Err.UPEXPECTF); error("declare %updating updating function local:x() " + "{ insert node into }; local:x()", Err.DUPLUPD); error("declare updating %updating function local:x() " + "{ insert node into }; local:x()", Err.DUPLUPD); } /** Parsing errors and conflicts. */ @Test public void unknown() { // ignore prefixes with no annotation definitions query("declare %db:xx function local:x() { 1 }; 1"); // check unit annotations error("declare %unit:xyz function local:x() { 1 }; 1", Err.BASX_ANNOT); // check restxq annotations error("declare %rest:xx function local:x() { 1 }; 1", Err.BASX_ANNOT); // check output annotations error("declare %output:xx function local:x() { 1 }; 1", Err.BASX_ANNOT); error("declare %output:method function local:x() { 1 }; 1", Err.BASX_ANNOTARGS); } /** Test for empty-sequence() as function item. */ @Test public void emptyFunTest() { error("()()", Err.INVEMPTY); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/expr/FLWORTest.java000066400000000000000000000027231222453003200267340ustar00rootroot00000000000000package org.basex.test.query.expr; import static org.junit.Assert.*; import org.basex.query.*; import org.basex.query.util.*; import org.basex.test.query.*; import org.basex.util.*; import org.junit.*; /** * Test cases for FLWOR expressions. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class FLWORTest extends AdvancedQueryTest { /** Tests shadowing of outer variables. */ @Test public void shadowTest() { query("for $a in for $a in 1 return $a/text() return { $a }", "1"); error("for $a at $b in 'c'[$b > 1] return $a", Err.VARUNDEF); } /** Tests shadowing between grouping variables. */ @Test public void groupShadowTest() { query("let $i := 1 group by $i, $i return $i", "1"); } /** * Runs an updating query and matches the result of the second query * against the expected output. * @param query query * @param expected expected output */ private static void query(final String query, final String expected) { final QueryProcessor proc = new QueryProcessor(query, context); try { final String result = proc.value().serialize().toString(); // quotes are replaced by apostrophes to simplify comparison assertEquals(expected.replaceAll("\"", "'"), result.replaceAll("\"", "'")); } catch(final QueryException ex) { throw (Error) new AssertionError(Util.message(ex)).initCause(ex); } finally { proc.close(); } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/expr/HigherOrderTest.java000066400000000000000000000057331222453003200302510ustar00rootroot00000000000000package org.basex.test.query.expr; import org.basex.query.util.*; import org.basex.test.query.*; import org.junit.*; /** * Higher-order function tests. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class HigherOrderTest extends AdvancedQueryTest { /** * Test for name shadowing. */ @Test public void shadowingTest() { query("let $x := 1 to 9 " + "return fold-left($x, 0, function($x, $y){$x * 10 + $y})", "123456789"); } /** * Test for name heavy currying. */ @Test public void curryTest() { query("let $digits := 1 to 9," + " $base-cmb := function($b, $n, $d) { $b * $n + $d }," + " $dec-cmb := $base-cmb(10, ?, ?)," + " $from-digits := fold-left(?, 0, $dec-cmb)" + " return $from-digits($digits)", "123456789"); } /** * Test for name heavy currying. */ @Test public void curryTest2() { query("let $digits := 1 to 9," + " $base-cmb := function($n, $d) { 10 * $n + $d }," + " $from-digits := fold-left(?, 0, $base-cmb)" + "return $from-digits(1 to 9)", "123456789"); } /** * Test for name heavy currying. */ @Test public void foldRightTest() { query("declare function local:before-first(" + " $input as item()*," + " $pred as function(item()) as item()*" + ") as item()* {" + " fold-right($input, ()," + " function($x, $xs) { if($pred($x)) then () else ($x, $xs) })" + "};" + "local:before-first((

,

,

,

,

)," + " function($it) { name($it) = 'h2' })", "

"); } /** * Test for name heavy currying. */ @Test public void typeTest() { query("declare function local:f($x as xs:long, $y as xs:NCName)" + " as element(e) {" + " " + "};" + "local:f#2 instance of function(xs:long, xs:NCName) as element(e)", "true"); } /** Test for name heavy currying. */ @Test public void placeHolderTest() { error("string-join(('a', 'b'), )(',')", Err.FUNCMISS); } /** Test for empty-sequence() as function item. */ @Test public void emptyFunTest() { error("()()", Err.INVEMPTY); } /** Tests the creation of a cast function as function item. */ @Test public void xsNCNameTest() { query("xs:NCName(?)('two')", "two"); } /** Tests the creation of a cast function as function item. */ @Test public void wrongArityTest() { error("count(concat#2('1','2','3'))", Err.INVARITY); } /** Tests using a partial function application as the context item (see GH-579). */ @Test public void ctxItemTest() { query("declare context item := contains(?, \"a\"); .(\"abc\")", "true"); } /** Tests using a function literal that is used before the function (see GH-698). */ @Test public void funcLitForward() { query("declare function local:a($a) { local:b#1($a) };" + "declare function local:b($b) { $b }; local:a(1)", "1"); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/expr/MapTest.java000066400000000000000000000012521222453003200265540ustar00rootroot00000000000000package org.basex.test.query.expr; import org.basex.query.util.*; import org.basex.test.query.*; import org.junit.*; /** * Tests for XQuery Maps. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class MapTest extends AdvancedQueryTest { /** A map as key should lead to FOTY0013. */ @Test public void mapAsKeyTest() { error("declare variable $m := { 'a' : 'b' };" + "declare variable $q := { $m : 'a' };" + "$q", Err.FIATOM); } /** Tests the the new syntax for map literals (see GH-755). */ @Test public void jsonSyntax() { query("( / {'test':y, 42:'asdf'})('test')", ""); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/expr/MixedTest.java000066400000000000000000000060331222453003200271070ustar00rootroot00000000000000package org.basex.test.query.expr; import static org.basex.query.func.Function.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.query.util.*; import org.basex.test.query.*; import org.junit.*; /** * Mixed XQuery tests. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class MixedTest extends AdvancedQueryTest { /** Test XQuery module file. */ private static final String XQMFILE = "src/test/resources/hello.xqm"; /** * Drops the collection. * @throws BaseXException exception */ @AfterClass public static void after() throws BaseXException { new DropDB(NAME).execute(context); } /** Catches duplicate module import. */ @Test public void duplImport() { error("import module namespace a='world' at '" + XQMFILE + "';" + "import module namespace a='world' at '" + XQMFILE + "'; 1", Err.DUPLMODULE); } /** Catches duplicate module import with different module uri. */ @Test public void duplImportDiffUri() { error("import module namespace a='world' at '" + XQMFILE + "';" + "import module namespace a='galaxy' at '" + XQMFILE + "'; 1", Err.DUPLNSDECL); } /** Catches duplicate module import. */ @Test public void duplLocation() { error("import module namespace a='world' at '" + XQMFILE + "';" + "import module namespace b='galaxy' at '" + XQMFILE + "'; 1", Err.WRONGMODULE); } /** Checks static context scoping in variables. */ @Test public void varsInModules() { contains("import module namespace a='world' at '" + XQMFILE + "';" + "$a:eager", "hello:foo"); contains("import module namespace a='world' at '" + XQMFILE + "';" + "$a:lazy", "hello:foo"); contains("import module namespace a='world' at '" + XQMFILE + "';" + "$a:func()", "hello:foo"); contains("import module namespace a='world' at '" + XQMFILE + "';" + "a:inlined()", "hello:foo"); } /** * Overwrites an empty attribute value. * @throws BaseXException database exception */ @Test public void emptyAttValues() throws BaseXException { new CreateDB(NAME, "").execute(context); query("replace value of node /A/@a with 'A'"); query("/", ""); } /** * Parse recursive queries. */ @Test public void parseRec() { // simple call query("declare function local:x() { if() then 1 else local:x() }; local:x()"); // call from FLWOR expression query("declare function local:x() { if() then 1 else local:x() }; " + "let $x := local:x() return $x", "1"); } /** * Performs count() on parts of a collection. * @throws BaseXException database exception */ @Test public void countCollection() throws BaseXException { new CreateDB(NAME).execute(context); new Add("a", "").execute(context); new Add("b", "").execute(context); new Optimize().execute(context); query(COUNT.args(_DB_OPEN.args(NAME, "a") + "/a"), "1"); query(COUNT.args(_DB_OPEN.args(NAME) + "/a"), "2"); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/expr/PackageAPITest.java000066400000000000000000000330551222453003200277320ustar00rootroot00000000000000package org.basex.test.query.expr; import static org.basex.util.Token.*; import static org.junit.Assert.*; import java.io.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.io.*; import org.basex.query.*; import org.basex.query.util.*; import org.basex.query.util.pkg.*; import org.basex.test.query.*; import org.basex.util.*; import org.basex.util.hash.*; import org.junit.*; /** * This class tests the EXPath package API. * * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ public final class PackageAPITest extends AdvancedQueryTest { /** Test repository. */ private static final String REPO = "src/test/resources/repo/"; /** Pkg1 URI. */ private static final String PKG1 = "http://www.pkg1.com"; /** Pkg1 URI. */ private static final String PKG2 = "http://www.pkg2.com"; /** Pkg1 URI. */ private static final String PKG3 = "http://www.pkg3.com"; /** Pkg4 URI. */ private static final String PKG4 = "http://www.pkg4.com"; /** Pkg5 URI. */ private static final String PKG5 = "http://www.pkg5.com"; /** Pkg1 identifier. */ private static final String PKG1ID = PKG1 + "-12.0"; /** Pkg2 identifier. */ private static final String PKG2ID = PKG2 + "-10.0"; /** Pkg3 identifier. */ private static final String PKG3ID = PKG3 + "-10.0"; /** Pkg1 identifier. */ private static final String PKG4ID = PKG4 + "-2.0"; /** Prepare test. */ @Before public void setUpBeforeClass() { for(final IOFile f : new IOFile(REPO).children()) { if(f.isDir() && f.name().contains(".")) f.delete(); } context = new Context(); context.mprop.set(MainProp.REPOPATH, REPO); } /** Tests repository initialization. */ @Test public void repoInit() { // check namespace dictionary final TokenObjMap nsDict = context.repo.nsDict(); final TokenMap pkgDict = context.repo.pkgDict(); assertEquals(3, nsDict.size()); assertTrue(nsDict.contains(token("ns1"))); assertTrue(nsDict.contains(token("ns2"))); assertTrue(nsDict.contains(token("ns3"))); TokenSet ts = nsDict.get(token("ns1")); assertEquals(ts.size(), 2); assertTrue(ts.contains(token(PKG1ID))); assertTrue(ts.contains(token(PKG2ID))); ts = nsDict.get(token("ns2")); assertEquals(ts.size(), 1); assertTrue(ts.contains(token(PKG1ID))); ts = nsDict.get(token("ns3")); assertEquals(ts.size(), 1); assertTrue(ts.contains(token(PKG2ID))); // check package dictionary assertEquals(pkgDict.size(), 2); assertTrue(pkgDict.contains(token(PKG1ID))); assertTrue(pkgDict.contains(token(PKG2ID))); assertEquals("pkg1", string(pkgDict.get(token(PKG1ID)))); assertEquals("pkg2", string(pkgDict.get(token(PKG2ID)))); } /** Test for missing mandatory attributes. */ @Test public void mandatoryAttr() { error(new IOContent(""), Err.BXRE_DESC, "Missing mandatory attribute not detected."); } /** * Tests package with not installed dependencies - dependency is defined with * no specific versions. */ @Test public void notInstalledDeps() { error( desc(PKG5, "pkg5", "12.0", ""), Err.BXRE_NOTINST, "Missing dependency not detected."); } /** * Tests package with not installed dependencies - dependency is defined with * version set. */ @Test public void notInstalledDepVersion() { error( desc(PKG5, "pkg5", "12.0", ""), Err.BXRE_NOTINST, "Missing dependency not detected."); } /** * Tests package with not installed dependencies - dependency is defined with * version template. */ @Test public void notInstalledDepTemp() { error( desc(PKG5, "pkg5", "12.0", ""), Err.BXRE_NOTINST, "Missing dependency not detected."); } /** * Tests package with not installed dependencies - dependency is defined with * version template for minimal acceptable version. */ @Test public void notInstalledMin() { error( desc(PKG5, "pkg5", "12.0", ""), Err.BXRE_NOTINST, "Missing dependency not detected."); } /** * Tests package with not installed dependencies - dependency is defined with * version template for maximal acceptable version. */ @Test public void notInstalledMax() { error( desc(PKG5, "pkg5", "12.0", ""), Err.BXRE_NOTINST, "Missing dependency not detected."); } /** * Tests package with not installed dependencies - dependency is defined with * version templates for minimal and maximal acceptable version. */ @Test public void notInstalledMinMax() { error(desc(PKG5, "pkg5", "12.0", ""), Err.BXRE_NOTINST, "Missing dependency not detected."); } /** * Tests package with component which is already installed as part of another * package. */ @Test public void alreadyAnotherInstalled() { error(desc(PKG5, "pkg5", "12.0", "ns1pkg1mod1.xql"), Err.BXRE_INST, "Already installed component not detected."); } /** * Tests package with dependency on an older version of BaseX. */ @Test public void notSupported() { error(desc(PKG5, "pkg5", "12.0", ""), Err.BXRE_VERSION, "Unsupported package not detected."); } /** * Tests package with component which is already installed as part of another * version of the same package. */ @Test public void alreadyAnotherSame() { ok(desc(PKG1, "pkg1", "10.0", "ns1pkg1mod1.xql")); } /** * Tests valid package. */ @Test public void valid() { ok(desc(PKG1, "pkg1", "10.0", "" + "ns3" + "pkg5mod1.xql")); } /** * Tests ability to import two modules from the same package. * @throws QueryException query exception */ @Test public void importTwoModulesFromPkg() throws QueryException { final QueryProcessor qp = new QueryProcessor( "import module namespace ns1='ns1';" + "import module namespace ns3='ns3';" + "(ns1:test2() eq 'pkg2mod1') and (ns3:test() eq 'pkg2mod2')", context); assertEquals(qp.execute().toString(), "true"); qp.execute(); } /** * Tests package installation. * @throws BaseXException database exception */ @Test public void repoInstall() throws BaseXException { // try to install non-existing package try { new RepoManager(context).install("src/test/resources/pkg"); fail("Not existing package not detected."); } catch(final QueryException ex) { check(null, ex, Err.BXRE_WHICH); } // try to install a package new RepoInstall(REPO + "pkg3.xar", null).execute(context); final String dir = normalize(PKG3ID); assertTrue(dir(dir)); assertTrue(file(dir + "/expath-pkg.xml")); assertTrue(dir(dir + "/pkg3")); assertTrue(dir(dir + "/pkg3/mod")); assertTrue(file(dir + "/pkg3/mod/pkg3mod1.xql")); assertTrue(new IOFile(REPO, dir).delete()); } /** * Tests installing of a package containing a jar file. * @throws BaseXException database exception * @throws QueryException query exception */ @Test public void installJar() throws BaseXException, QueryException { // install package new RepoInstall(REPO + "testJar.xar", null).execute(context); // ensure package was properly installed final String dir = normalize("jarPkg-1.0.0"); assertTrue(dir(dir)); assertTrue(file(dir + "/expath-pkg.xml")); assertTrue(file(dir + "/basex.xml")); assertTrue(dir(dir + "/jar")); assertTrue(file(dir + "/jar/test.jar")); assertTrue(file(dir + "/jar/wrapper.xq")); // use package final QueryProcessor qp = new QueryProcessor( "import module namespace j='jar'; j:print('test')", context); assertEquals(qp.execute().toString(), "test"); qp.close(); // delete package assertTrue("Repo directory could not be deleted.", new IOFile(REPO, dir).delete()); } /** * Tests usage of installed packages. * @throws QueryException query exception */ @Test public void importPkg() throws QueryException { // try with a package without dependencies final QueryProcessor qp1 = new QueryProcessor( "import module namespace ns3='ns3'; ns3:test()", context); assertEquals(qp1.execute().toString(), "pkg2mod2"); qp1.execute(); // try with a package with dependencies final QueryProcessor qp2 = new QueryProcessor( "import module namespace ns2='ns2'; ns2:test()", context); assertEquals(qp2.execute().toString(), "pkg2mod2"); qp2.execute(); } /** * Tests package delete. * @throws BaseXException database exception */ @Test public void delete() throws BaseXException { // try to delete a package which is not installed try { new RepoManager(context).delete("xyz"); fail("Not installed package not detected."); } catch(final QueryException ex) { check(null, ex, Err.BXRE_WHICH); } // install a package without dependencies (pkg3) new RepoInstall(REPO + "pkg3.xar", null).execute(context); // check if pkg3 is registered in the repo assertTrue(context.repo.pkgDict().contains(token(PKG3ID))); // check if pkg3 was correctly unzipped final String pkg3Dir = normalize(PKG3ID); assertTrue(dir(pkg3Dir)); assertTrue(file(pkg3Dir + "/expath-pkg.xml")); assertTrue(dir(pkg3Dir + "/pkg3")); assertTrue(dir(pkg3Dir + "/pkg3/mod")); assertTrue(file(pkg3Dir + "/pkg3/mod/pkg3mod1.xql")); // install another package (pkg4) with a dependency to pkg3 new RepoInstall(REPO + "pkg4.xar", null).execute(context); // check if pkg4 is registered in the repo assertTrue(context.repo.pkgDict().contains(token(PKG4ID))); // check if pkg4 was correctly unzipped final String pkg4Dir = normalize(PKG4ID); assertTrue(dir(pkg4Dir)); assertTrue(file(pkg4Dir + "/expath-pkg.xml")); assertTrue(dir(pkg4Dir + "/pkg4")); assertTrue(dir(pkg4Dir + "/pkg4/mod")); assertTrue(file(pkg4Dir + "/pkg4/mod/pkg4mod1.xql")); // try to delete pkg3 try { new RepoManager(context).delete(PKG3ID); fail("Package involved in a dependency was deleted."); } catch(final QueryException ex) { check(null, ex, Err.BXRE_DEP); } // try to delete pkg4 (use package name) new RepoDelete(PKG4, null).execute(context); // check if pkg4 is unregistered from the repo assertFalse(context.repo.pkgDict().contains(token(PKG4ID))); // check if pkg4 directory was deleted assertFalse(dir(pkg4Dir)); // try to delete pkg3 (use package dir) new RepoDelete(PKG3ID, null).execute(context); // check if pkg3 is unregistered from the repo assertFalse(context.repo.pkgDict().contains(token(PKG3ID))); // check if pkg3 directory was deleted assertFalse(dir(pkg3Dir)); } // PRIVATE METHODS ========================================================== /** Header string. */ private static final byte[] HEADER = token(""); /** Footer string. */ private static final byte[] FOOTER = token(""); /** * Returns a package descriptor. * @param name package name * @param abbrev package abbreviation * @param version package version * @param cont package content * @return descriptor */ private static IOContent desc(final String name, final String abbrev, final String version, final String cont) { return new IOContent(concat(Util.inf(HEADER, name, abbrev, version), token(cont), FOOTER)); } /** * Checks if the specified package descriptor results in an error. * @param desc descriptor */ private void ok(final IO desc) { try { new PkgValidator(context.repo, null).check( new PkgParser(context.repo, null).parse(desc)); } catch(final QueryException ex) { fail("Unexpected exception thrown: " + ex); } } /** * Checks if the specified package descriptor results in an error. * @param desc descriptor * @param err expected error * @param exp information on expected error */ private void error(final IO desc, final Err err, final String exp) { try { new PkgValidator(context.repo, null).check( new PkgParser(context.repo, null).parse(desc)); fail(exp); } catch(final QueryException ex) { check(null, ex, err); } } /** * Checks if the specified path points to a file. * @param path file path * @return result of check */ private static boolean file(final String path) { final File file = new File(REPO + path); return file.exists() && !file.isDirectory(); } /** * Checks if the specified path points to a directory. * @param path file path * @return result of check */ private static boolean dir(final String path) { return new File(REPO + path).isDirectory(); } /** * Normalizes the given path. * @param path path * @return normalized path */ private static String normalize(final String path) { return path.replaceAll("[^\\w.-]+", "-"); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/000077500000000000000000000000001222453003200243115ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNAdminTest.java000066400000000000000000000036411222453003200272740ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import static org.basex.util.Token.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the Admin Module. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNAdminTest extends AdvancedQueryTest { /** * Init method. * @throws BaseXException database exception */ @BeforeClass public static void init() throws BaseXException { new CreateDB(NAME).execute(context); new DropUser(NAME).execute(context); } /** * Init method. * @throws BaseXException database exception */ @AfterClass public static void finish() throws BaseXException { new DropDB(NAME).execute(context); } /** * Test method. * @throws BaseXException database exception */ @Test public void users() throws BaseXException { // check if the admin user exists query(_ADMIN_USERS.args() + "= 'admin'", "true"); // check if the temporarily created user is found new CreateUser(NAME, md5(NAME)).execute(context); query(_ADMIN_USERS.args() + "= '" + NAME + "'", "true"); // check if local user is found new Grant(Perm.READ, NAME, NAME).execute(context); query(_ADMIN_USERS.args(NAME) + "= '" + NAME + "'", "true"); // check if user has been removed new DropUser(NAME).execute(context); query(_ADMIN_USERS.args(NAME) + "= '" + NAME + "'", "false"); query(_ADMIN_USERS.args() + "= '" + NAME + "'", "false"); } /** * Test method. */ @Test public void sessions() { // can only be tested in client/server mode query(_ADMIN_SESSIONS.args(), ""); } /** * Test method. */ @Test public void logs() { // no loggin data exists in the sandbox query(_ADMIN_LOGS.args(), ""); query(_ADMIN_LOGS.args("2001-01-01"), ""); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNArchiveTest.java000066400000000000000000000225571222453003200276340ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import org.basex.io.*; import org.basex.query.util.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the Archive Module. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNArchiveTest extends AdvancedQueryTest { /** Test ZIP file. */ private static final String ZIP = "src/test/resources/xml.zip"; /** Test GZIP file. */ private static final String GZIP = "src/test/resources/xml.gz"; /** Test method. */ @Test public void create() { // simple zip files query(COUNT.args(_ARCHIVE_CREATE.args("X", "")), "1"); // simple zip files query(COUNT.args(_ARCHIVE_CREATE.args("X", "")), "1"); query(COUNT.args(_ARCHIVE_CREATE.args( "X", "")), "1"); query(COUNT.args(_ARCHIVE_CREATE.args( "X", "")), "1"); query(COUNT.args(_ARCHIVE_CREATE.args("X", "")), "1"); query(COUNT.args(_ARCHIVE_CREATE.args("X", "", " { }")), "1"); query(COUNT.args(_ARCHIVE_CREATE.args("X", "", " { 'format':'zip', 'algorithm':'deflate' }")), "1"); query(COUNT.args(_ARCHIVE_CREATE.args("X", "", "")), "1"); query(COUNT.args(_ARCHIVE_CREATE.args("X", "", "" + "")), "1"); query(COUNT.args(_ARCHIVE_CREATE.args("X", "", "")), "1"); query(COUNT.args(_ARCHIVE_CREATE.args("X", "", "")), "1"); // different number of entries and contents error(_ARCHIVE_CREATE.args("X", "()"), Err.ARCH_DIFF); // name must not be empty error(_ARCHIVE_CREATE.args("", ""), Err.ARCH_EMPTY); // invalid compression level error(_ARCHIVE_CREATE.args("X", ""), Err.ARCH_LEVEL); error(_ARCHIVE_CREATE.args("X", ""), Err.ARCH_LEVEL); // invalid modification date error(_ARCHIVE_CREATE.args("X", ""), Err.ARCH_DATETIME); // content must be string or binary error(_ARCHIVE_CREATE.args("X", " 123"), Err.STRBINTYPE); // wrong encoding error(_ARCHIVE_CREATE.args("X", ""), Err.ARCH_ENCODING); // errors while converting a string error(_ARCHIVE_CREATE.args("X", "\u00fc"), Err.ARCH_ENCODE); error(_ARCHIVE_CREATE.args("X", "", " { 'format':'rar' }"), Err.ARCH_UNKNOWN); // format not supported error(_ARCHIVE_CREATE.args("X", "", ""), Err.ARCH_UNKNOWN); // algorithm not supported error(_ARCHIVE_CREATE.args("X", "", ""), Err.ARCH_SUPP); // algorithm not supported error(_ARCHIVE_CREATE.args("('x','y')", "('a','b')", ""), Err.ARCH_ONE); } /** Test method. */ @Test public void entries() { // read entries query(COUNT.args(_ARCHIVE_ENTRIES.args(_FILE_READ_BINARY.args(ZIP))), "5"); // simple zip files query(COUNT.args(_ARCHIVE_ENTRIES.args(_FILE_READ_BINARY.args(ZIP)) + "[@size][@last-modified][@compressed-size]"), "5"); // simple gzip files query(COUNT.args(_ARCHIVE_ENTRIES.args(_FILE_READ_BINARY.args(GZIP)) + "[not(@size)][not(@last-modified)][not(@compressed-size)][not(text())]"), "1"); } /** Test method. */ @Test public void options() { // read entries query(_ARCHIVE_OPTIONS.args(_FILE_READ_BINARY.args(ZIP)) + "//@value/data()", "zip deflate"); query(_ARCHIVE_OPTIONS.args(_FILE_READ_BINARY.args(GZIP)) + "//@value/data()", "gzip deflate"); } /** Test method. */ @Test public void extractText() { // extract all entries query(COUNT.args(_ARCHIVE_EXTRACT_TEXT.args(_FILE_READ_BINARY.args(ZIP))), "5"); // extract all entries query("let $a := " + _FILE_READ_BINARY.args(ZIP) + "let $b := " + _ARCHIVE_ENTRIES.args("$a") + "return " + COUNT.args(_ARCHIVE_EXTRACT_TEXT.args("$a", "$b")), 5); // extract single entry query("let $a := " + _FILE_READ_BINARY.args(ZIP) + "let $b := " + _ARCHIVE_EXTRACT_TEXT.args("$a", "test/input.xml") + "let $c := " + PARSE_XML.args("$b") + "return $c//title/text()", "XML"); // extract single entry query("let $a := " + _FILE_READ_BINARY.args(ZIP) + "let $b := " + _ARCHIVE_EXTRACT_TEXT.args("$a", "test/input.xml") + "let $c := " + PARSE_XML.args("$b") + "return $c//title/text()", "XML"); } /** Test method. */ @Test public void extractBinary() { // extract all entries query(COUNT.args(_ARCHIVE_EXTRACT_BINARY.args(_FILE_READ_BINARY.args(ZIP))), "5"); // extract all entries query("let $a := " + _FILE_READ_BINARY.args(ZIP) + "let $b := " + _ARCHIVE_ENTRIES.args("$a") + "return count(" + _ARCHIVE_EXTRACT_BINARY.args("$a", "$b") + ")", 5); // extract single entry query("let $a := " + _FILE_READ_BINARY.args(ZIP) + "let $b := " + _ARCHIVE_EXTRACT_BINARY.args("$a", "test/input.xml") + "let $c := " + _CONVERT_BINARY_TO_STRING.args("$b") + "let $d := " + PARSE_XML.args("$c") + "return $d//title/text()", "XML"); // extract single entry query("let $a := " + _FILE_READ_BINARY.args(ZIP) + "let $b := " + _ARCHIVE_EXTRACT_BINARY.args("$a", "test/input.xml") + "let $c := " + _CONVERT_BINARY_TO_STRING.args("$b") + "let $d := " + PARSE_XML.args("$c") + "return $d//title/text()", "XML"); } /** Test method. */ @Test public void update() { // add a new entry query(_FILE_READ_BINARY.args(ZIP) + " ! " + _ARCHIVE_UPDATE.args(" .", "X", "X") + " ! " + COUNT.args(_ARCHIVE_ENTRIES.args(" .")), 6); // add a new entry query(_FILE_READ_BINARY.args(ZIP) + " ! " + _ARCHIVE_UPDATE.args(" .", "X", "X") + " ! " + COUNT.args(_ARCHIVE_ENTRIES.args(" .")), 6); query(_ARCHIVE_CREATE.args("X", "X") + " ! " + _ARCHIVE_UPDATE.args(" .", "Y", "Y") + " ! " + _ARCHIVE_EXTRACT_TEXT.args(" ."), "X Y"); // updates an existing entry query(_ARCHIVE_CREATE.args("X", "X") + " ! " + _ARCHIVE_UPDATE.args(" .", "X", "Y") + " ! " + _ARCHIVE_EXTRACT_TEXT.args(" ."), "Y"); // updates an existing entry error(_ARCHIVE_CREATE.args("X", "X", "") + " ! " + _ARCHIVE_UPDATE.args(" .", "X", "Y"), Err.ARCH_MODIFY); } /** Test method. */ @Test public void delete() { // delete single entry query("let $a := " + _FILE_READ_BINARY.args(ZIP) + "let $b := " + _ARCHIVE_DELETE.args("$a", "infos/stopWords") + "let $c := " + _ARCHIVE_ENTRIES.args("$b") + "return count($c)", 4); // delete all entries except for the first query("let $a := " + _FILE_READ_BINARY.args(ZIP) + "let $b := " + _ARCHIVE_ENTRIES.args("$a") + "let $c := " + _ARCHIVE_DELETE.args("$a", "$b[position() > 1]") + "return count(archive:entries($c))", "1"); // updates an existing entry error(_ARCHIVE_CREATE.args("X", "X", "") + " ! " + _ARCHIVE_DELETE.args(" .", "X"), Err.ARCH_MODIFY); } /** Test method. */ @Test public void write() { // write archive and count number of entries final String tmp = new IOFile(sandbox(), "tmp").path(); query(_ARCHIVE_WRITE.args(tmp, _FILE_READ_BINARY.args(ZIP))); query(COUNT.args(_ARCHIVE_ENTRIES.args(_FILE_READ_BINARY.args(ZIP))), "5"); // write archive and count number of entries query(_ARCHIVE_WRITE.args(tmp, _FILE_READ_BINARY.args(ZIP), _ARCHIVE_ENTRIES.args(_FILE_READ_BINARY.args(ZIP)))); query(COUNT.args(_ARCHIVE_ENTRIES.args(_FILE_READ_BINARY.args(ZIP))), "5"); query("let $a := " + _ARCHIVE_ENTRIES.args( _FILE_READ_BINARY.args(ZIP)) + "/string() " + "let $f := " + _FILE_LIST.args(tmp, "true()") + "[" + _FILE_IS_FILE.args(" '" + tmp + "/'||.") + "] ! replace(., '\\\\', '/') " + "return (every $e in $a satisfies $e = $f) and (every $e in $f satisfies $e =$ a)", "true"); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNClientTest.java000066400000000000000000000064351222453003200274660ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import java.io.*; import org.basex.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.query.util.*; import org.basex.test.query.*; import org.basex.test.server.*; import org.junit.*; /** * This class tests the functions of the Client Module. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNClientTest extends AdvancedQueryTest { /** Server reference. */ private static BaseXServer server; /** * Starts the server. * @throws IOException I/O exception */ @BeforeClass public static void start() throws IOException { server = createServer(); } /** * Stops the server. * @throws IOException I/O exception */ @AfterClass public static void stop() throws IOException { stopServer(server); } /** Test method. */ @Test public void connect() { query(conn()); query(EXISTS.args(" " + conn())); // BXCL0001: connection errors error(_CLIENT_CONNECT.args(Text.LOCALHOST, 9999, Text.ADMIN, ""), Err.BXCL_CONN); error(_CLIENT_CONNECT.args("xxx", 9999, Text.ADMIN, Text.ADMIN), Err.BXCL_CONN); } /** Test method. */ @Test public void execute() { contains(_CLIENT_EXECUTE.args(conn(), new ShowUsers()), Text.USERHEAD[0]); query("let $a := " + conn() + ", $b := " + conn() + " return (" + _CLIENT_EXECUTE.args("$a", new XQuery("1")) + "," + _CLIENT_EXECUTE.args("$b", new XQuery("2")) + ")", "1 2"); // BXCL0004: connection errors error(_CLIENT_EXECUTE.args(conn(), "x"), Err.BXCL_COMMAND); } /** Test method. */ @Test public void info() { // check if the info string is not empty query("let $a := " + conn() + " return (" + _CLIENT_EXECUTE.args("$a", "xquery 123") + " and " + _CLIENT_INFO.args("$a") + ")", "true"); } /** Test method. */ @Test public void query() { contains(_CLIENT_EXECUTE.args(conn(), new ShowUsers()), Text.USERHEAD[0]); query("let $a := " + conn() + ", $b := " + conn() + " return " + _CLIENT_QUERY.args("$a", "1") + "+" + _CLIENT_QUERY.args("$b", "2"), "3"); query(_CLIENT_QUERY.args(conn(), "\"$a*2\"", " { 'a':1 }"), "2"); // query errors error(_CLIENT_QUERY.args(conn(), "x"), Err.NOCTX); error(_CLIENT_QUERY.args(conn(), "\"$a\"", " { 'a':(1,2) }"), Err.BXCL_ITEM); } /** Test method for the correct return of all XDM data types. */ @Test public void queryTypes() { final Object[][] types = XdmInfoTest.TYPES; for(final Object[] type : types) { if(type == null || type.length < 3) continue; query(_CLIENT_QUERY.args(conn(), " " + "\"" + type[1] + "\""), type[2]); } } /** Test method. */ @Test public void close() { query(conn() + " ! " + _CLIENT_CLOSE.args(" .")); // BXCL0002: session not available error(_CLIENT_CLOSE.args("xs:anyURI('unknown')"), Err.BXCL_NOTAVL); // BXCL0002: session has already been closed error(conn() + " ! (" + _CLIENT_CLOSE.args(" .") + ", " + _CLIENT_CLOSE.args(" .") + ")", Err.BXCL_NOTAVL); } /** * Returns a successful connect string. * @return connect string */ private static String conn() { return _CLIENT_CONNECT.args(Text.LOCALHOST, 9999, Text.ADMIN, Text.ADMIN); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNConvertTest.java000066400000000000000000000120251222453003200276600ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import org.basex.query.util.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the Conversion Module. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNConvertTest extends AdvancedQueryTest { /** Test method. */ @Test public void integerToBase() { query(_CONVERT_INTEGER_TO_BASE.args(4, 2), 100); query(_CONVERT_INTEGER_TO_BASE.args(65535, 2), "1111111111111111"); query(_CONVERT_INTEGER_TO_BASE.args(65536, 2), "10000000000000000"); query(_CONVERT_INTEGER_TO_BASE.args(4, 16), 4); query(_CONVERT_INTEGER_TO_BASE.args(65535, 16), "ffff"); query(_CONVERT_INTEGER_TO_BASE.args(65536, 16), "10000"); query(_CONVERT_INTEGER_TO_BASE.args(4, 10), 4); query(_CONVERT_INTEGER_TO_BASE.args(65535, 10), 65535); query(_CONVERT_INTEGER_TO_BASE.args(65536, 10), 65536); error(_CONVERT_INTEGER_TO_BASE.args(1, 1), Err.INVBASE); error(_CONVERT_INTEGER_TO_BASE.args(1, 100), Err.INVBASE); error(_CONVERT_INTEGER_TO_BASE.args(1, 100), Err.INVBASE); } /** Test method. */ @Test public void integerFromBase() { query(_CONVERT_INTEGER_FROM_BASE.args("100", 2), "4"); query(_CONVERT_INTEGER_FROM_BASE.args("1111111111111111", 2), 65535); query(_CONVERT_INTEGER_FROM_BASE.args("10000000000000000", 2), 65536); query(_CONVERT_INTEGER_FROM_BASE.args("4", 16), 4); query(_CONVERT_INTEGER_FROM_BASE.args("ffff", 16), 65535); query(_CONVERT_INTEGER_FROM_BASE.args("FFFF", 16), 65535); query(_CONVERT_INTEGER_FROM_BASE.args("10000", 16), 65536); query(_CONVERT_INTEGER_FROM_BASE.args("4", 10), 4); query(_CONVERT_INTEGER_FROM_BASE.args("65535", 10), 65535); query(_CONVERT_INTEGER_FROM_BASE.args("65536", 10), 65536); error(_CONVERT_INTEGER_FROM_BASE.args("1", 1), Err.INVBASE); error(_CONVERT_INTEGER_FROM_BASE.args("1", 100), Err.INVBASE); error(_CONVERT_INTEGER_FROM_BASE.args("abc", 10), Err.INVDIG); error(_CONVERT_INTEGER_FROM_BASE.args("012", 2), Err.INVDIG); } /** Test method. */ @Test public void binaryToBytes() { query(_CONVERT_BINARY_TO_BYTES.args("xs:base64Binary('QmFzZVggaXMgY29vbA==')"), "66 97 115 101 88 32 105 115 32 99 111 111 108"); query(_CONVERT_BINARY_TO_BYTES.args("xs:base64Binary(xs:hexBinary('4261736558'))"), "66 97 115 101 88"); query(_CONVERT_BINARY_TO_BYTES.args("xs:base64Binary(AAE=)"), "0 1"); query(_CONVERT_BINARY_TO_BYTES.args("a"), 97); query(COUNT.args(_CONVERT_BINARY_TO_BYTES.args("\u00e4")), 2); query(COUNT.args(_CONVERT_BINARY_TO_BYTES.args(123)), 3); } /** Test method. */ @Test public void binaryToString() { query(_CONVERT_BINARY_TO_STRING.args("xs:base64Binary(xs:hexBinary('41'))"), "A"); query(_CONVERT_BINARY_TO_STRING.args("xs:hexBinary('41')"), "A"); query(_CONVERT_BINARY_TO_STRING.args("xs:hexBinary('41')", "CP1252"), "A"); error(_CONVERT_BINARY_TO_STRING.args("xs:hexBinary('41')", "X"), Err.BXCO_ENCODING); } /** Test method. */ @Test public void bytesToHex() { query(_CONVERT_BYTES_TO_HEX.args("xs:byte(1)"), "01"); query(_CONVERT_BYTES_TO_HEX.args(" for $i in 1 to 3 return xs:byte($i)"), "010203"); } /** Test method. */ @Test public void bytesToBase64() { query(_CONVERT_BYTES_TO_BASE64.args("xs:byte(97)"), "YQ=="); query(_CONVERT_BYTES_TO_BASE64.args("()"), ""); } /** Test method. */ @Test public void stringToBase64() { query(_CONVERT_STRING_TO_BASE64.args("a"), "YQ=="); query(_CONVERT_STRING_TO_BASE64.args("a", "UTF-8"), "YQ=="); query(_CONVERT_STRING_TO_BASE64.args("a", "US-ASCII"), "YQ=="); error(_CONVERT_STRING_TO_BASE64.args("\u00fc", "US-ASCII"), Err.BXCO_BASE64); error(_CONVERT_STRING_TO_BASE64.args("a", "X"), Err.BXCO_ENCODING); } /** Test method. */ @Test public void stringToHex() { query(_CONVERT_STRING_TO_HEX.args("a"), "61"); query(_CONVERT_STRING_TO_HEX.args("a", "UTF-8"), "61"); query(_CONVERT_STRING_TO_HEX.args("a", "US-ASCII"), "61"); error(_CONVERT_STRING_TO_HEX.args("\u00fc", "US-ASCII"), Err.BXCO_BASE64); error(_CONVERT_STRING_TO_HEX.args("a", "X"), Err.BXCO_ENCODING); } /** Test method. */ @Test public void integerToDateTime() { query(_CONVERT_INTEGER_TO_DATETIME.args(" 0"), "1970-01-01T00:00:00Z"); } /** Test method. */ @Test public void dateTimeToInteger() { query(_CONVERT_DATETIME_TO_INTEGER.args("xs:dateTime('1970-01-01T00:00:00Z')"), "0"); error(_CONVERT_DATETIME_TO_INTEGER.args("xs:dateTime('600000000-01-01T00:00:00Z')"), Err.INTRANGE); } /** Test method. */ @Test public void integerToDatyTimeDuration() { query(_CONVERT_INTEGER_TO_DAYTIME.args(" 0"), "PT0S"); } /** Test method. */ @Test public void dayTimeDurationToInteger() { query(_CONVERT_DAYTIME_TO_INTEGER.args("xs:dayTimeDuration('PT0S')"), "0"); error(_CONVERT_DAYTIME_TO_INTEGER.args("xs:dayTimeDuration('PT10000000000000000S')"), Err.INTRANGE); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNCryptoTest.java000066400000000000000000000247061222453003200275310ustar00rootroot00000000000000package org.basex.test.query.func; import java.util.logging.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the Cryptography Module. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public class FNCryptoTest extends AdvancedQueryTest { /** Set higher log level to avoid INFO output. */ public FNCryptoTest() { Logger.getLogger("com.sun.org.apache.xml.internal").setLevel(Level.WARNING); } /** Checks default/empty arguments. */ @Test public void check() { query("crypto:hmac('msg','key','','')"); query("crypto:encrypt('msg','','keykeyke','')"); query("crypto:decrypt(crypto:encrypt('msg','','keykeyke',''),'','keykeyke','')"); query("crypto:generate-signature(,'','','','','')"); query("crypto:validate-signature(crypto:generate-signature(,'','','','',''))"); } /** * Test method for encrypt and decrypt with symmetric keys. */ @Test public void encryption1() { final String msg = "messagemessagemessagemessagemessagemessagemessage"; query("let $e := crypto:encrypt('" + msg + "','symmetric','aaabbbaa'," + "'DES') return crypto:decrypt($e,'symmetric'," + "'aaabbbaa','DES')", msg); } /** * Test method for encrypt and decrypt with symmetric keys. */ @Test public void encryption2() { final String msg = "messagemessagemessagemessagemessagemessagemessage"; query("let $e := crypto:encrypt('" + msg + "','symmetric','abababababababab'," + "'AES') return crypto:decrypt($e,'symmetric','abababababababab','AES')", msg); } /** * Tests the creation of a message authentication code for the md5 algorithm. */ @Test public void hmacMD5defencoding() { query("crypto:hmac('message','key','md5')", "TkdI5itGNSH2d1+/khI0tQ=="); } /** * Tests the creation of a message authentication code for the md5 algorithm. */ @Test public void hmacMD5hex() { query("crypto:hmac('message','key','md5', 'hex')", "4E4748E62B463521F6775FBF921234B5"); } /** * Tests the creation of a message authentication code for the md5 algorithm. */ @Test public void hmacMD5base64() { query("crypto:hmac('message','key','md5', 'base64')", "TkdI5itGNSH2d1+/khI0tQ=="); } /** * Tests the creation of a message authentication code for the sha1 algorithm. */ @Test public void hmacSHA1hex() { query("crypto:hmac('message','key','sha1', 'hex')", "2088DF74D5F2146B48146CAF4965377E9D0BE3A4"); } /** * Tests the creation of a message authentication code for the sha1 algorithm. */ @Test public void hmacSHA1base64() { query("crypto:hmac('message','key','sha1', 'base64')", "IIjfdNXyFGtIFGyvSWU3fp0L46Q="); } /** * Tests the creation of a message authentication code for the sha256 * algorithm. */ @Test public void hmacSHA256hex() { query("crypto:hmac('message','key','sha256', 'hex')", "6E9EF29B75FFFC5B7ABAE527D58FDADB2FE42E7219011976917343065F58ED4A"); } /** * Tests the creation of a message authentication code for the sha256 * algorithm. */ @Test public void hmacSHA256base64() { query("crypto:hmac('message','key','sha256', 'base64')", "bp7ym3X//Ft6uuUn1Y/a2y/kLnIZARl2kXNDBl9Y7Uo="); } /** * Tests the creation of a message authentication code for the sha384 * algorithm. */ @Test public void hmacSHA384hex() { query("crypto:hmac('message','key','sha384', 'hex')", "2088DF74D5F2146B48146CAF4965377E9D0BE3A4"); } /** * Tests the creation of a message authentication code for the sha384 * algorithm. */ @Test public void hmacSHA384base64() { query("crypto:hmac('message','key','sha384', 'base64')", "IIjfdNXyFGtIFGyvSWU3fp0L46Q="); } /** * Tests the creation of a message authentication code for the sha512 * algorithm. */ @Test public void hmacSHA512hex() { query("crypto:hmac('message','key','sha512', 'hex')", "E477384D7CA229DD1426E64B63EBF2D36EBD6D7E669A6735424E72EA6C01D3F8" + "B56EB39C36D8232F5427999B8D1A3F9CD1128FC69F4D75B434216810FA367E98"); } /** * Tests the creation of a message authentication code for the sha512 * algorithm. */ @Test public void hmacSHA512base64() { query("crypto:hmac('message','key','sha512', 'base64')", "5Hc4TXyiKd0UJuZLY+vy0269bX5mmmc1Qk5y6mwB0/i1brOcNtgjL1QnmZuNGj+c0RK" + "Pxp9NdbQ0IWgQ+jZ+mA=="); } /** * Tests whether validate-signature returns true for a certificate created * with generate-signature. */ @Test public void validateSignature1() { query("crypto:validate-signature(crypto:generate-signature(,'','','','',''))", "true"); } /** * Tests whether validate-signature returns true for a certificate created * with generate-signature. */ @Test public void validateSignature1b() { query("crypto:validate-signature(" + "crypto:generate-signature(,'','SHA1','DSA_SHA1','','enveloped'))", "true"); } /** * Tests whether validate-signature returns true for a certificate created * with generate-signature. */ @Test public void validateSignature1c() { final String input = "" + "" + "" + "" + "9hvH4qztnIYgYfJDRLnEMPJdoaY=" + "W/BpXt9odK+Ot2cU0No0+tzwAJyqSx+CRMXG2B" + "T6NRc2qbMMSB7l+RcR6jwsu2Smt0LCltR1YFLTPoD+GCarZA==" + "mH+uHBX+3mE9bgWzcDym0pnyu" + "W3ca6EexNvQ/sAKgDNmO1xFNgVWSgKGMxmaGRzGyPi+8+KeGKGM0mS1jpRPQQ==" + "AQAB" + ""; query("crypto:validate-signature(" + input + ')', "true"); } /** * Tests whether validate-signature returns true for a certificate created * with generate-signature. */ @Test public void validateSignatureWithCanonicalization() { query("crypto:validate-signature(crypto:generate-signature(," + "'exclusive','','','',''))", "true"); } /** * Tests whether validate-signature returns true for a certificate created * with generate-signature. */ @Test public void validateSignatureWithCanonicalization2() { query("crypto:validate-signature(crypto:generate-signature(," + "'exclusive-with-comments','','','',''))", "true"); } /** * Tests whether validate-signature returns true for a certificate created * with generate-signature. */ @Test public void validateSignatureWithCanonicalization3() { query("crypto:validate-signature(crypto:generate-signature(," + "'inclusive','','','',''))", "true"); } /** * Tests whether validate-signature returns true for a certificate created * with generate-signature. */ @Test public void validateSignatureWithCanonicalization4() { query("crypto:validate-signature(crypto:generate-signature(," + "'inclusive-with-comments','','','',''))", "true"); } /** * Tests whether validate-signature returns true for a certificate created * with generate-signature. */ @Test public void validateSignatureWithDigestAlgorithm() { query("crypto:validate-signature(crypto:generate-signature(,'','SHA1','','',''))", "true"); } /** * Tests whether validate-signature returns true for a certificate created * with generate-signature. */ @Test public void validateSignatureWithDigestAlgorithm2() { query("crypto:validate-signature(crypto:generate-signature(" + ",'','SHA256','','',''))", "true"); } /** * Tests whether validate-signature returns true for a certificate created * with generate-signature. */ @Test public void validateSignatureWithDigestAlgorithm3() { query("crypto:validate-signature(crypto:generate-signature(" + ",'','SHA512','','',''))", "true"); } /** * Tests whether validate-signature returns true for a certificate created * with generate-signature. */ @Test public void validateSignatureWithSignatureAlgorithm() { query("crypto:validate-signature(crypto:generate-signature(,'',''," + "'DSA_SHA1','',''))", "true"); } /** * Tests whether validate-signature returns true for a certificate created * with generate-signature. */ @Test public void validateSignatureWithSignatureAlgorithm2() { query("crypto:validate-signature(crypto:generate-signature(,'',''," + "'RSA_SHA1','',''))", "true"); } /** * Tests whether validate-signature returns true for a certificate created * with generate-signature. */ @Test public void validateSignatureWithSignatureNamespace3() { query("crypto:validate-signature(crypto:generate-signature(" + ",'','','','prefix',''))", "true"); } /** * Tests whether validate-signature returns true for a certificate created * with generate-signature. */ @Test public void validateSignatureWithSignatureType() { query("crypto:validate-signature(crypto:generate-signature(,'','','',''," + "'enveloped'))", "true"); } /** * Tests whether validate-signature returns true for a certificate created * with generate-signature. */ @Test public void validateSignatureWithSignatureType2() { query("crypto:validate-signature(crypto:generate-signature(,'','','',''," + "'enveloping'))", "true"); } /** * Tests whether validate-signature returns true for a certificate created * with generate-signature. */ @Test public void validateSignatureWithXPath() { query("crypto:validate-signature(crypto:generate-signature(," + "'','','','','','/a/n'))", "true"); } /** * Tests whether validate-signature returns true for a certificate created * with generate-signature. */ @Test public void validateSignatureFullySpecified() { query("crypto:validate-signature(crypto:generate-signature(," + "'exclusive','SHA512','RSA_SHA1','myPrefix','enveloped','/a/n'))", "true"); } }basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNCsvTest.java000066400000000000000000000044241222453003200267770ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import org.basex.query.util.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the CSV Module. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class FNCsvTest extends AdvancedQueryTest { /** JSON snippets. */ private static final String[][] TOXML = { { "", "", "" }, { "X", "", "X" }, { "X,Y", "", "XY" }, { "X\nY", "'header':true()", "Y" }, { "X;Y", "'separator':';'", "XY" }, }; /** XML snippets. */ private static final String[][] TOCSV = { { "", "", "" }, { "", "", "" }, { "", "'header':'yes'", "" }, { "A", "", "A" }, { "A", "'header':'yes'", "entryA" }, { "AB", "", "A,B" }, { "<_>A<_>B", "'separator':';'", "A;B" }, { "1", "'header':'yes'", "A1" }, { "12", "'header':'yes'", "A,B1,2" }, }; /** Test method. */ @Test public void parse() { for(final String[] test : TOXML) { final String expected = test[2]; final String query = _CSV_PARSE.args(test[0], " {" + test[1] + "}"); if(test.length == 1) { error(query, Err.BXCS_PARSE); } else if(expected.startsWith("...")) { contains(query, expected.substring(3)); } else { query(query, expected); } } } /** Test method. */ @Test public void serialize() { for(final String[] test : TOCSV) { final String expected = test[2]; final String query = _CSV_SERIALIZE.args(test[0], " {" + test[1] + "}"); if(test.length == 1) { error(query, Err.BXCS_SERIAL); } else if(test[1].startsWith("...")) { contains(query, expected.substring(3)); } else { query(query, expected); } } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNDbServerTest.java000066400000000000000000000067651222453003200277720ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import static org.junit.Assert.*; import java.io.*; import java.util.concurrent.*; import org.basex.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.server.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the Database Module in a client/server environment. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNDbServerTest extends AdvancedQueryTest { /** Number of clients. */ private static final int NUM = 1; /** Test file. */ private static final String FILE = "src/test/resources/input.xml"; /** Server reference. */ private static BaseXServer server; /** * Initializes a test. * @throws BaseXException database exception */ @Before public void finishTest() throws BaseXException { new DropDB(NAME).execute(context); } /** * Starts the server. * @throws IOException I/O exception */ @BeforeClass public static void start() throws IOException { server = createServer(); } /** * Finishes the test. * @throws IOException I/O exception */ @AfterClass public static void finish() throws IOException { stopServer(server); } /** * Tests client/server functionality of database functions. * @throws IOException I/O exception */ @Test public void clientServer() throws IOException { final ClientSession c1 = createClient(); final ClientSession c2 = createClient(); c1.execute(new XQuery(_DB_CREATE.args(NAME))); c2.execute(new XQuery(_DB_CREATE.args(NAME))); Assert.assertEquals("true", c1.execute(new XQuery(_DB_EXISTS.args(NAME)))); } /** * Tests client/server functionality of database functions. * @throws IOException I/O exception * @throws InterruptedException interrupted exception */ @Test public void concurrentClients() throws IOException, InterruptedException { final ClientSession check = createClient(); // same DB name, which is 2 x NUM times runTwoClients(new XQuery(_DB_CREATE.args(NAME))); Assert.assertEquals("true", check.execute(new XQuery(_DB_EXISTS.args(NAME)))); runTwoClients(new XQuery(_DB_CREATE.args(NAME))); Assert.assertEquals("true", check.execute(new XQuery(_DB_EXISTS.args(NAME)))); // same DB name and files runTwoClients(new XQuery(_DB_CREATE.args(NAME, FILE, "in/"))); Assert.assertEquals("true", check.execute(new XQuery(_DB_EXISTS.args(NAME)))); // drop, create runTwoClients(new XQuery( _DB_DROP.args(NAME) + "," + _DB_CREATE.args(NAME, FILE, "in/") )); // add, drop, create runTwoClients(new XQuery( _DB_ADD.args(NAME, "", "x.xml") + "," + _DB_DROP.args(NAME) + "," + _DB_CREATE.args(NAME, FILE))); check.execute(new DropDB(NAME)); } /** * Runs a number of clients in parallel that execute the same query. * @param cmd command * @throws IOException I/O exception * @throws InterruptedException interrupted exception */ private void runTwoClients(final Command cmd) throws IOException, InterruptedException { final CountDownLatch start = new CountDownLatch(1); final CountDownLatch stop = new CountDownLatch(NUM); final Client[] clients = new Client[NUM]; for(int i = 0; i < NUM; i++) { clients[i] = new Client(cmd, start, stop); } start.countDown(); stop.await(); for(final Client c : clients) if(c.error != null) fail(c.error); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNDbTest.java000066400000000000000000000561521222453003200265760ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.core.Text.*; import static org.basex.query.func.Function.*; import static org.junit.Assert.*; import java.io.*; import java.util.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.core.parse.*; import org.basex.io.*; import org.basex.query.util.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the Database Module. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNDbTest extends AdvancedQueryTest { /** Test file. */ private static final String FILE = "src/test/resources/input.xml"; /** Test folder. */ private static final String FLDR = "src/test/resources/dir/"; /** Number of XML files for folder. */ private static final int NFLDR; static { int fc = 0; for(final IOFile c : new IOFile(FLDR).children()) { if(c.name().endsWith(IO.XMLSUFFIX)) ++fc; } NFLDR = fc; } /** * Initializes a test. * @throws BaseXException database exception */ @Before public void initTest() throws BaseXException { new CreateDB(NAME, FILE).execute(context); } /** * Finishes the test. * @throws IOException I/O exception */ @AfterClass public static void finish() throws IOException { new DropDB(NAME).execute(context); } /** * Test method. * @throws BaseXException database exception */ @Test public void open() throws BaseXException { query(COUNT.args(_DB_OPEN.args(NAME)), "1"); query(COUNT.args(_DB_OPEN.args(NAME, "")), "1"); query(COUNT.args(_DB_OPEN.args(NAME, "unknown")), "0"); // close database instance new Close().execute(context); query(COUNT.args(_DB_OPEN.args(NAME, "unknown")), "0"); query(_DB_OPEN.args(NAME) + "//title/text()", "XML"); // run function on non-existing database new DropDB(NAME).execute(context); error(_DB_OPEN.args(NAME), Err.BXDB_OPEN); } /** Test method. */ @Test public void openPre() { query(_DB_OPEN_PRE.args(NAME, 0) + "//title/text()", "XML"); error(_DB_OPEN_PRE.args(NAME, -1), Err.BXDB_RANGE); } /** Test method. */ @Test public void openId() { query(_DB_OPEN_ID.args(NAME, 0) + "//title/text()", "XML"); error(_DB_OPEN_ID.args(NAME, -1), Err.BXDB_RANGE); } /** * Test method. * @throws BaseXException database exception */ @Test public void text() throws BaseXException { // run function without and with index new DropIndex(Commands.CmdIndex.TEXT).execute(context); query(_DB_TEXT.args(NAME, "XML"), "XML"); new CreateIndex(Commands.CmdIndex.TEXT).execute(context); query(_DB_TEXT.args(NAME, "XML"), "XML"); query(_DB_TEXT.args(NAME, "XXX"), ""); } /** * Test method. * @throws BaseXException database exception */ @Test public void textRange() throws BaseXException { // run function without and with index new DropIndex(Commands.CmdIndex.TEXT).execute(context); query(_DB_TEXT_RANGE.args(NAME, "Exercise", "Fun"), "Exercise 1Exercise 2"); new CreateIndex(Commands.CmdIndex.TEXT).execute(context); query(_DB_TEXT_RANGE.args(NAME, "Exercise", "Fun"), "Exercise 1Exercise 2"); query(_DB_TEXT_RANGE.args(NAME, "XXX", "XXX"), ""); } /** * Test method. * @throws BaseXException database exception */ @Test public void attribute() throws BaseXException { // run function without and with index new DropIndex(Commands.CmdIndex.ATTRIBUTE).execute(context); query(DATA.args(_DB_ATTRIBUTE.args(NAME, "0")), "0"); new CreateIndex(Commands.CmdIndex.ATTRIBUTE).execute(context); query(DATA.args(_DB_ATTRIBUTE.args(NAME, "0")), "0"); query(DATA.args(_DB_ATTRIBUTE.args(NAME, "0", "id")), "0"); query(DATA.args(_DB_ATTRIBUTE.args(NAME, "0", "XXX")), ""); query(DATA.args(_DB_ATTRIBUTE.args(NAME, "XXX")), ""); } /** * Test method. * @throws BaseXException database exception */ @Test public void attributeRange() throws BaseXException { // run function without and with index new CreateIndex(Commands.CmdIndex.ATTRIBUTE).execute(context); query(_DB_ATTRIBUTE_RANGE.args(NAME, "0", "9") + "/data()", "0 1"); new CreateIndex(Commands.CmdIndex.ATTRIBUTE).execute(context); query(_DB_ATTRIBUTE_RANGE.args(NAME, "0", "9") + "/data()", "0 1"); query(_DB_ATTRIBUTE_RANGE.args(NAME, "XXX", "XXX"), ""); } /** * Test method. * @throws BaseXException database exception */ @Test public void fulltext() throws BaseXException { // run function without and with index new DropIndex(Commands.CmdIndex.FULLTEXT).execute(context); error(_DB_FULLTEXT.args(NAME, "assignments"), Err.BXDB_INDEX); new CreateIndex(Commands.CmdIndex.FULLTEXT).execute(context); query(_DB_FULLTEXT.args(NAME, "assignments"), "Assignments"); query(_DB_FULLTEXT.args(NAME, "XXX"), ""); } /** * Test method. * @throws BaseXException database exception */ @Test public void list() throws BaseXException { // add documents new Add("test/docs", FLDR).execute(context); contains(_DB_LIST.args(NAME), "test/docs"); contains(_DB_LIST.args(NAME, "test/"), "test/docs"); contains(_DB_LIST.args(NAME, "test/docs/input.xml"), "input.xml"); query(_DB_STORE.args(NAME, "bin/b", "b")); query(_DB_LIST.args(NAME, "bin/"), "bin/b"); query(_DB_LIST.args(NAME, "bin/b"), "bin/b"); // create two other database and compare substring new CreateDB(NAME + 1).execute(context); new CreateDB(NAME + 2).execute(context); contains(_DB_LIST.args(), NAME + 1 + ' ' + NAME + 2); new DropDB(NAME + 1).execute(context); new DropDB(NAME + 2).execute(context); } /** Test method. */ @Test public void listDetails() { query(_DB_ADD.args(NAME, "\"\"", "xml")); query(_DB_STORE.args(NAME, "raw", "bla")); final String xmlCall = _DB_LIST_DETAILS.args(NAME, "xml"); query(xmlCall + "/@raw/data()", "false"); query(xmlCall + "/@content-type/data()", MimeTypes.APP_XML); query(xmlCall + "/@modified-date/xs:dateTime(.)"); query(xmlCall + "/@size/data()", ""); query(xmlCall + "/text()", "xml"); final String rawCall = _DB_LIST_DETAILS.args(NAME, "raw"); query(rawCall + "/@raw/data()", "true"); query(rawCall + "/@content-type/data()", MimeTypes.APP_OCTET); query(rawCall + "/@modified-date/xs:dateTime(.) > " + "xs:dateTime('1971-01-01T00:00:01')", "true"); query(rawCall + "/@size/data()", "3"); query(rawCall + "/text()", "raw"); query(_DB_LIST_DETAILS.args(NAME, "test"), ""); error(_DB_LIST_DETAILS.args("mostProbablyNotAvailable"), Err.BXDB_OPEN); } /** Test method. * @throws BaseXException database exception */ @Test public void backups() throws BaseXException { query(COUNT.args(_DB_BACKUPS.args(NAME)), "0"); new CreateBackup(NAME).execute(context); query(COUNT.args(_DB_BACKUPS.args()), "1"); query(COUNT.args(_DB_BACKUPS.args(NAME)), "1"); query(COUNT.args(_DB_BACKUPS.args(NAME + "X")), "0"); new DropBackup(NAME).execute(context); query(COUNT.args(_DB_BACKUPS.args(NAME)), "0"); } /** Test method. */ @Test public void system() { contains(_DB_SYSTEM.args(), Prop.VERSION); } /** Test method. */ @Test public void info() { query("count(" + _DB_INFO.args(NAME) + "//" + SIZE.replaceAll(" |-", "").toLowerCase(Locale.ENGLISH) + ')', 1); } /** Test method. */ @Test public void nodeID() { query(_DB_NODE_ID.args(" /html"), "1"); query(_DB_NODE_ID.args(" / | /html"), "0 1"); } /** Test method. */ @Test public void nodePre() { query(_DB_NODE_PRE.args(" /html"), "1"); query(_DB_NODE_PRE.args(" / | /html"), "0 1"); } /** Test method. */ @Test public void event() { error(_DB_EVENT.args("X", "Y"), Err.BXDB_EVENT); } /** Test method. */ @Test public void output() { query(_DB_OUTPUT.args("x"), "x"); query(_DB_OUTPUT.args("('x','y')"), "x y"); query(_DB_OUTPUT.args(""), ""); error(_DB_OUTPUT.args("x") + ",1", Err.UPALL); error(_DB_OUTPUT.args(" count#1"), Err.FIVALUE); } /** Test method. */ @Test public void add() { query(_DB_ADD.args(NAME, "\"\"", "t1.xml")); query(COUNT.args(COLLECTION.args(NAME + "/t1.xml") + "/root"), "1"); query(_DB_ADD.args(NAME, " document { }", "t2.xml")); query(COUNT.args(COLLECTION.args(NAME + "/t2.xml") + "/root"), "1"); query(_DB_ADD.args(NAME, " ", "test/t3.xml")); query(COUNT.args(COLLECTION.args(NAME + "/test/t3.xml") + "/root"), "1"); query(_DB_ADD.args(NAME, FILE, "in/")); query(COUNT.args(COLLECTION.args(NAME + "/in/input.xml") + "/html"), "1"); query(_DB_ADD.args(NAME, FILE, "test/t4.xml")); query(COUNT.args(COLLECTION.args(NAME + "/test/t4.xml") + "/html"), "1"); query(_DB_ADD.args(NAME, FLDR, "test/dir")); query(COUNT.args(COLLECTION.args(NAME + "/test/dir")), NFLDR); query("for $f in " + _FILE_LIST.args(FLDR, "true()", "*.xml") + " return " + _DB_ADD.args(NAME, " '" + FLDR + "' || $f", "dir")); query(COUNT.args(COLLECTION.args(NAME + "/dir")), NFLDR); query("for $i in 1 to 3 return " + _DB_ADD.args(NAME, "\"\"", "\"doc\" || $i")); query(COUNT.args(" for $i in 1 to 3 return " + COLLECTION.args('"' + NAME + "/doc\" || $i")), 3); } /** Test method. */ @Test public void addWithNS() { query(_DB_ADD.args(NAME, " document { }", "x")); } /** * Test method. * @throws BaseXException database exception */ @Test public void delete() throws BaseXException { new Add("test/docs", FLDR).execute(context); query(_DB_DELETE.args(NAME, "test")); query(COUNT.args(COLLECTION.args(NAME + "/test")), 0); } /** * Test method. */ @Test public void create() { // non-existing DB name final String dbname = NAME + "DBCreate"; // create DB without initial content query(_DB_CREATE.args(dbname)); query(_DB_EXISTS.args(dbname), true); // create DB w/ initial content query(_DB_CREATE.args(dbname, "", "t1.xml")); query(_DB_OPEN.args(dbname) + "/root()", ""); // create DB w/ initial content via document constructor query(_DB_CREATE.args(dbname, " document { }", "t2.xml")); query(_DB_OPEN.args(dbname) + "/root()", ""); // create DB w/ initial content given as string query(_DB_CREATE.args(dbname, "\"\"", "t1.xml")); query(_DB_OPEN.args(dbname) + "/root()", ""); // create DB w/ initial content multiple times query(_DB_CREATE.args(dbname, "", "t1.xml")); query(_DB_CREATE.args(dbname, "", "t1.xml")); query(_DB_OPEN.args(dbname) + "/root()", ""); // try to create DB twice during same query error(_DB_CREATE.args(dbname) + "," + _DB_CREATE.args(dbname), Err.BXDB_CREATE); // create DB from file query(_DB_CREATE.args(dbname, FILE, "in/")); query(COUNT.args(COLLECTION.args(dbname + "/in/input.xml") + "/html"), "1"); // create DB from folder query(_DB_CREATE.args(dbname, FLDR, "test/dir")); query(COUNT.args(COLLECTION.args(dbname + "/test/dir")), NFLDR); // create DB w/ more than one input query(_DB_CREATE.args(dbname, "(,)", "('1.xml','2.xml')")); query(_DB_CREATE.args(dbname, "(,'" + FILE + "')", "('1.xml','2.xml')")); error(_DB_CREATE.args(dbname, "()", "1.xml"), Err.BXDB_CREATEARGS); error(_DB_CREATE.args(dbname, "(,)", "1.xml"), Err.BXDB_CREATEARGS); // create and drop more than one database query("for $i in 1 to 5 return " + _DB_CREATE.args(" '" + dbname + "' || $i")); query("for $i in 1 to 5 return " + _DB_DROP.args(" '" + dbname + "' || $i")); error(_DB_CREATE.args(dbname, ""), Err.WHICHRES); // create DB with initial EMPTY content error(_DB_CREATE.args(""), Err.BXDB_NAME); // try to access non-existing DB (create is supposed to be called last) query(_DB_DROP.args(dbname)); error(_DB_CREATE.args(dbname) + "," + _DB_DROP.args(dbname), Err.BXDB_OPEN); // run update on existing DB then drop it and create a new one query(_DB_CREATE.args(dbname, "", "a.xml")); query("insert node into " + _DB_OPEN.args(dbname)); query(_DB_CREATE.args(dbname, "", "t1.xml") + ", insert node into " + _DB_OPEN.args(dbname) + "," + _DB_DROP.args(dbname)); query(_DB_OPEN.args(dbname) + "/root()", ""); // eventually drop database query(_DB_DROP.args(dbname)); // specify additional index options for(final boolean b : new boolean[] { false, true }) { query(_DB_CREATE.args(dbname, "()", "()", " { 'updindex':" + b + "() }")); query(_DB_INFO.args(dbname) + "//updindex/text()", b ? "ON" : "OFF"); } assertEquals(context.prop.is(Prop.UPDINDEX), false); final String[] nopt = { "maxcats", "maxlen", "indexsplitsize", "ftindexsplitsize" }; for(final String k : nopt) { query(_DB_CREATE.args(dbname, "()", "()", " { '" + k + "':1 }")); } final String[] bopt = { "textindex", "attrindex", "ftindex", "stemming", "casesens", "diacritics" }; for(final String k : bopt) { for(final boolean v : new boolean[] { true, false }) { query(_DB_CREATE.args(dbname, "()", "()", " { '" + k + "':" + v + "() }")); } } final String[] sopt = { "language", "stopwords" }; for(final String k : sopt) { query(_DB_CREATE.args(dbname, "()", "()", " { '" + k + "':'' }")); } error(_DB_CREATE.args(dbname, "()", "()", " { 'xyz':'abc' }"), Err.BASX_OPTIONS); error(_DB_CREATE.args(dbname, "()", "()", " { 'maxlen':-1 }"), Err.BASX_VALUE); error(_DB_CREATE.args(dbname, "()", "()", " { 'maxlen':'a' }"), Err.BASX_VALUE); } /** * Test method. */ @Test public void drop() { // non-existing DB name final String dbname = NAME + "DBCreate"; // drop existing DB query(_DB_CREATE.args(dbname, "", "doc.xml")); query(_DB_DROP.args(dbname)); query(_DB_EXISTS.args(dbname), "false"); // try to drop non-existing DB error(_DB_DROP.args(dbname), Err.BXDB_OPEN); } /** * Test method, using a mix of command and XQuery calls. * @throws BaseXException database exception */ @Test public void createCommand() throws BaseXException { final String dbname = NAME + "DBCreate"; query(_DB_CREATE.args(dbname)); new Open(dbname).execute(context); error(_DB_CREATE.args(dbname), Err.BXDB_OPENED); // close and try again new Close().execute(context); query(_DB_CREATE.args(dbname)); // eventually drop database query(_DB_DROP.args(dbname)); } /** * Test method. * @throws BaseXException database exception */ @Test public void rename() throws BaseXException { new Add("test/docs", FLDR).execute(context); query(COUNT.args(COLLECTION.args(NAME + "/test")), NFLDR); // rename document query(_DB_RENAME.args(NAME, "test", "newtest")); query(COUNT.args(COLLECTION.args(NAME + "/test")), 0); query(COUNT.args(COLLECTION.args(NAME + "/newtest")), NFLDR); // rename paths query(_DB_RENAME.args(NAME, "", "x")); query(COUNT.args(COLLECTION.args(NAME + "/x/newtest")), NFLDR); // rename binary file query(_DB_STORE.args(NAME, "one", "")); query(_DB_RENAME.args(NAME, "one", "two")); query(_DB_RETRIEVE.args(NAME, "two")); error(_DB_RETRIEVE.args(NAME, "one"), Err.WHICHRES); } /** * Test method. * @throws BaseXException database exception */ @Test public void replace() throws BaseXException { new Add("test", FILE).execute(context); query(_DB_REPLACE.args(NAME, FILE, "\"\"")); query(COUNT.args(COLLECTION.args(NAME + '/' + FILE) + "/R1"), 1); query(COUNT.args(COLLECTION.args(NAME + '/' + FILE) + "/R2"), 0); query(_DB_REPLACE.args(NAME, FILE, " document { }")); query(COUNT.args(COLLECTION.args(NAME + '/' + FILE) + "/R1"), 0); query(COUNT.args(COLLECTION.args(NAME + '/' + FILE) + "/R2"), 1); query(_DB_REPLACE.args(NAME, FILE, FILE)); query(COUNT.args(COLLECTION.args(NAME + '/' + FILE) + "/R1"), 0); query(COUNT.args(COLLECTION.args(NAME + '/' + FILE) + "/R2"), 0); query(COUNT.args(COLLECTION.args(NAME + '/' + FILE) + "/html"), 1); } /** * Test method. * @throws BaseXException database exception */ @Test public void optimize() throws BaseXException { query(_DB_OPTIMIZE.args(NAME)); query(_DB_OPTIMIZE.args(NAME)); error(_DB_OPTIMIZE.args(NAME, "true()"), Err.UPDBOPTERR); new Close().execute(context); query(_DB_OPTIMIZE.args(NAME, "true()")); // specify additional index options final String[] nopt = { "maxcats", "maxlen", "indexsplitsize", "ftindexsplitsize" }; for(final String k : nopt) { query(_DB_OPTIMIZE.args(NAME, "false()", " map { '" + k + "':=1 }")); } final String[] bopt = { "textindex", "attrindex", "ftindex", "stemming", "casesens", "diacritics" }; for(final String k : bopt) { for(final boolean v : new boolean[] { true, false }) { query(_DB_OPTIMIZE.args(NAME, "false()", " map { '" + k + "':=" + v + "() }")); } } final String[] sopt = { "language", "stopwords" }; for(final String k : sopt) { query(_DB_OPTIMIZE.args(NAME, "false()", " map { '" + k + "':='' }")); } assertEquals(context.prop.is(Prop.TEXTINDEX), true); error(_DB_OPTIMIZE.args(NAME, "false()", " map { 'updindex':=1 }"), Err.BASX_OPTIONS); error(_DB_OPTIMIZE.args(NAME, "false()", " map { 'xyz':='abc' }"), Err.BASX_OPTIONS); error(_DB_OPTIMIZE.args(NAME, "false()", " map { 'maxlen':=-1 }"), Err.BASX_VALUE); error(_DB_OPTIMIZE.args(NAME, "false()", " map { 'maxlen':='a' }"), Err.BASX_VALUE); // check if optimize call preserves original options query(_DB_OPTIMIZE.args(NAME)); query(_DB_INFO.args(NAME) + "//textindex/text()", "OFF"); query(_DB_INFO.args(NAME) + "//attributeindex/text()", "OFF"); query(_DB_INFO.args(NAME) + "//fulltextindex/text()", "OFF"); new Open(NAME).execute(context); new CreateIndex(Commands.CmdIndex.TEXT).execute(context); new CreateIndex(Commands.CmdIndex.ATTRIBUTE).execute(context); new CreateIndex(Commands.CmdIndex.FULLTEXT).execute(context); new Close().execute(context); query(_DB_OPTIMIZE.args(NAME)); query(_DB_INFO.args(NAME) + "//textindex/text()", "ON"); query(_DB_INFO.args(NAME) + "//attributeindex/text()", "ON"); query(_DB_INFO.args(NAME) + "//fulltextindex/text()", "ON"); new Open(NAME).execute(context); new DropIndex(Commands.CmdIndex.TEXT).execute(context); new DropIndex(Commands.CmdIndex.ATTRIBUTE).execute(context); new DropIndex(Commands.CmdIndex.FULLTEXT).execute(context); new Close().execute(context); query(_DB_OPTIMIZE.args(NAME)); query(_DB_INFO.args(NAME) + "//textindex/text()", "OFF"); query(_DB_INFO.args(NAME) + "//attributeindex/text()", "OFF"); query(_DB_INFO.args(NAME) + "//fulltextindex/text()", "OFF"); query(_DB_OPTIMIZE.args(NAME, "true()", " map { 'textindex':=true(),'attrindex':=true(),'ftindex':=true() }")); query(_DB_INFO.args(NAME) + "//textindex/text()", "ON"); query(_DB_INFO.args(NAME) + "//attributeindex/text()", "ON"); query(_DB_INFO.args(NAME) + "//fulltextindex/text()", "ON"); } /** Test method. */ @Test public void retrieve() { error(_DB_RETRIEVE.args(NAME, "raw"), Err.WHICHRES); query(_DB_STORE.args(NAME, "raw", "xs:hexBinary('41')")); query("xs:hexBinary(" + _DB_RETRIEVE.args(NAME, "raw") + ')', "41"); query(_DB_DELETE.args(NAME, "raw")); error(_DB_RETRIEVE.args(NAME, "raw"), Err.WHICHRES); } /** Test method. */ @Test public void store() { query(_DB_STORE.args(NAME, "raw1", "xs:hexBinary('41')")); query(_DB_STORE.args(NAME, "raw2", "b")); query("xs:hexBinary(" + _DB_RETRIEVE.args(NAME, "raw2") + ')', "62"); query(_DB_STORE.args(NAME, "raw3", 123)); query("xs:hexBinary(" + _DB_RETRIEVE.args(NAME, "raw3") + ')', "313233"); } /** Test method. */ @Test public void flush() { query(_DB_FLUSH.args(NAME)); error(_DB_FLUSH.args(NAME + 'x'), Err.BXDB_OPEN); } /** Test method. */ @Test public void isRaw() { query(_DB_ADD.args(NAME, "\"\"", "xml")); query(_DB_STORE.args(NAME, "raw", "bla")); query(_DB_IS_RAW.args(NAME, "xml"), "false"); query(_DB_IS_RAW.args(NAME, "raw"), "true"); query(_DB_IS_RAW.args(NAME, "xxx"), "false"); } /** * Test method. * @throws BaseXException database exception */ @Test public void exists() throws BaseXException { query(_DB_ADD.args(NAME, "\"\"", "x/xml")); query(_DB_STORE.args(NAME, "x/raw", "bla")); // checks if the specified resources exist (false expected for directories) query(_DB_EXISTS.args(NAME), "true"); query(_DB_EXISTS.args(NAME, "x/xml"), "true"); query(_DB_EXISTS.args(NAME, "x/raw"), "true"); query(_DB_EXISTS.args(NAME, "xxx"), "false"); query(_DB_EXISTS.args(NAME, "x"), "false"); query(_DB_EXISTS.args(NAME, ""), "false"); // false expected for missing database new DropDB(NAME).execute(context); query(_DB_EXISTS.args(NAME), "false"); } /** Test method. */ @Test public void isXML() { query(_DB_ADD.args(NAME, "\"\"", "xml")); query(_DB_STORE.args(NAME, "raw", "bla")); query(_DB_IS_XML.args(NAME, "xml"), "true"); query(_DB_IS_XML.args(NAME, "raw"), "false"); query(_DB_IS_XML.args(NAME, "xxx"), "false"); } /** Test method. */ @Test public void contentType() { query(_DB_ADD.args(NAME, "\"\"", "xml")); query(_DB_STORE.args(NAME, "raw", "bla")); query(_DB_CONTENT_TYPE.args(NAME, "xml"), MimeTypes.APP_XML); query(_DB_CONTENT_TYPE.args(NAME, "raw"), MimeTypes.APP_OCTET); error(_DB_CONTENT_TYPE.args(NAME, "test"), Err.WHICHRES); } /** Test method. */ @Test public void export() { // exports the database query(_DB_EXPORT.args(NAME, new IOFile(Prop.TMP, NAME))); final IOFile f = new IOFile(new IOFile(Prop.TMP, NAME), FILE.replaceAll(".*/", "")); query(_FILE_EXISTS.args(f)); // serializes as text; ensures that the output contains no angle bracket query(_DB_EXPORT.args(NAME, new IOFile(Prop.TMP, NAME), " {'method':'text'}")); query("0[" + CONTAINS.args(_FILE_READ_TEXT.args(f), "<") + "]", ""); // deletes the exported file query(_FILE_DELETE.args(f)); } /** Test method. */ @Test public void name() { query(_DB_NAME.args(_DB_OPEN.args(NAME)), NAME); } /** Test method. */ @Test public void path() { query(_DB_PATH.args(_DB_OPEN.args(NAME)), FILE.replaceAll(".*/", "")); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNFetchTest.java000066400000000000000000000017301222453003200272720ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import org.basex.query.util.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the Fetch Module. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNFetchTest extends AdvancedQueryTest { /** Test file. */ private static final String FILE = "src/test/resources/input.xml"; /** Test method. */ @Test public void text() { query(_FETCH_TEXT.args(FILE)); error(_FETCH_TEXT.args(FILE + 'x'), Err.BXFE_IO); error(_FETCH_TEXT.args(FILE, "xxx"), Err.BXFE_ENCODING); } /** Test method. */ @Test public void binary() { query(_FETCH_BINARY.args(FILE)); error(_FETCH_BINARY.args(FILE + 'x'), Err.BXFE_IO); } /** Test method. */ @Test public void contentType() { query(_FETCH_CONTENT_TYPE.args(FILE)); error(_FETCH_CONTENT_TYPE.args(FILE + 'x'), Err.BXFE_IO); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNFileTest.java000066400000000000000000000334311222453003200271230ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import static org.junit.Assert.*; import java.io.*; import java.util.*; import org.basex.core.*; import org.basex.io.*; import org.basex.query.util.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the File Module. * * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ public final class FNFileTest extends AdvancedQueryTest { /** Test path. */ private static final String PATH = Prop.TMP + NAME + '/'; /** Test path. */ private static final String PATH1 = PATH + NAME; /** Test path. */ private static final String PATH2 = PATH + NAME + '2'; /** Test path. */ private static final String PATH3 = PATH + NAME + "/x"; /** Test path. */ private static final String PATH4 = PATH + NAME + "/x/y"; /** Initializes the test. */ @After public void init() { new File(PATH4).delete(); new File(PATH3).delete(); new File(PATH2).delete(); new File(PATH1).delete(); } /** Test method. */ @Test public void dirSeparator() { assertFalse(query(_FILE_DIR_SEPARATOR.args()).isEmpty()); } /** Test method. */ @Test public void pathSeparator() { assertFalse(query(_FILE_PATH_SEPARATOR.args()).isEmpty()); } /** Test method. */ @Test public void tempDir() { assertEquals(query(_FILE_TEMP_DIR.args()), Prop.TMP); } /** Test method. */ @Test public void createTempDir() { final String tmp = query(_FILE_CREATE_TEMP_DIR.args("", "")); query(_FILE_EXISTS.args(tmp), "true"); query(_FILE_IS_DIR.args(tmp), "true"); query(_FILE_IS_FILE.args(tmp), "false"); query(_FILE_DELETE.args(tmp)); } /** Test method. */ @Test public void createTempFile() { final String tmp = query(_FILE_CREATE_TEMP_FILE.args("", "")); query(_FILE_EXISTS.args(tmp), "true"); query(_FILE_IS_DIR.args(tmp), "false"); query(_FILE_IS_FILE.args(tmp), "true"); query(_FILE_DELETE.args(tmp)); } /** Test method. */ @Test public void lineSeparator() { } /** Test method. */ @Test public void exists() { query(_FILE_WRITE.args(PATH1, "()")); query(_FILE_EXISTS.args(PATH1), true); query(_FILE_EXISTS.args(IO.FILEPREF + "//" + PATH1), true); query(_FILE_DELETE.args(PATH1)); query(_FILE_EXISTS.args(PATH1), false); query(_FILE_EXISTS.args(IO.FILEPREF + "//" + PATH1), false); } /** Test method. */ @Test public void isDir() { query(_FILE_IS_DIR.args(PATH), true); query(_FILE_WRITE.args(PATH1, "()")); query(_FILE_IS_DIR.args(PATH1), false); query(_FILE_DELETE.args(PATH1)); query(_FILE_CREATE_DIR.args(PATH1)); query(_FILE_IS_DIR.args(PATH1), true); query(_FILE_DELETE.args(PATH1)); } /** Test method. */ @Test public void isFile() { query(_FILE_IS_FILE.args(PATH), false); query(_FILE_WRITE.args(PATH1, "()")); query(_FILE_IS_FILE.args(PATH1), true); query(_FILE_DELETE.args(PATH1)); query(_FILE_CREATE_DIR.args(PATH1)); query(_FILE_IS_FILE.args(PATH1), false); query(_FILE_DELETE.args(PATH1)); } /** Test method. */ @Test public void lastModified() { assertFalse(query(_FILE_LAST_MODIFIED.args(PATH)).isEmpty()); } /** Test method. */ @Test public void size() { query(_FILE_WRITE.args(PATH1, "abcd")); query(_FILE_SIZE.args(PATH1), "4"); query(_FILE_DELETE.args(PATH1)); } /** Test method. */ @Test public void list() { error(_FILE_LIST.args(PATH1), Err.FILE_NODIR); query(_FILE_WRITE.args(PATH1, "()")); error(_FILE_LIST.args(PATH1), Err.FILE_NODIR); contains(_FILE_LIST.args(PATH), NAME); contains(_FILE_LIST.args(PATH, "false()"), NAME); contains(_FILE_LIST.args(PATH, "false()", NAME), NAME); query(_FILE_LIST.args(PATH, "false()", "XXX"), ""); query(_FILE_DELETE.args(PATH1)); // check recursive paths query(_FILE_CREATE_DIR.args(PATH1)); query(_FILE_CREATE_DIR.args(PATH3)); query(_FILE_WRITE.args(PATH4, "()")); contains(_FILE_LIST.args(PATH1, "true()"), "y"); query(_FILE_LIST.args(PATH1, "true()", "x"), "x" + File.separator); } /** Test method. */ @Test public void createDir() { query(_FILE_CREATE_DIR.args(PATH1)); query(_FILE_CREATE_DIR.args(PATH1)); query(_FILE_CREATE_DIR.args(PATH3)); query(_FILE_DELETE.args(PATH1, "true()")); query(_FILE_WRITE.args(PATH1, "()")); error(_FILE_CREATE_DIR.args(PATH1), Err.FILE_EXISTS); error(_FILE_CREATE_DIR.args(PATH3), Err.FILE_EXISTS); query(_FILE_DELETE.args(PATH1)); } /** Test method. */ @Test public void delete() { query(_FILE_CREATE_DIR.args(PATH3)); query(_FILE_DELETE.args(PATH3)); query(_FILE_CREATE_DIR.args(PATH3)); query(_FILE_WRITE.args(PATH4, "()")); query(_FILE_DELETE.args(PATH1, "true()")); error(_FILE_DELETE.args(PATH1), Err.FILE_WHICH); } /** Test method. */ @Test public void readText() { error(_FILE_READ_TEXT.args(PATH1), Err.FILE_WHICH); error(_FILE_READ_TEXT.args(PATH), Err.FILE_DIR); query(_FILE_WRITE.args(PATH1, "a\u00e4")); query(_FILE_READ_TEXT.args(PATH1), "a\u00e4"); error(_FILE_READ_TEXT.args(PATH1, "UNKNOWN"), Err.FILE_ENCODING); assertEquals(3, query(_FILE_READ_TEXT.args(PATH1, "CP1252")).length()); query(_FILE_WRITE_BINARY.args(PATH1, "xs:hexBinary('00')")); error(_FILE_READ_TEXT.args(PATH1), Err.FILE_IO); query("declare option db:checkstrings 'off';" + _FILE_READ_TEXT.args(PATH1), "�"); query(_FILE_DELETE.args(PATH1)); } /** Test method. */ @Test public void readBinary() { error(_FILE_READ_BINARY.args(PATH1), Err.FILE_WHICH); error(_FILE_READ_BINARY.args(PATH), Err.FILE_DIR); query(_FILE_WRITE.args(PATH1, "0")); query(_FILE_READ_BINARY.args(PATH1), "MA=="); query(_FILE_WRITE.args(PATH1, "a\u00e4")); query(_FILE_READ_BINARY.args(PATH1), "YcOk"); query(_FILE_WRITE_BINARY.args(PATH1, _CONVERT_STRING_TO_BASE64.args("a\u00e4"))); query(_FILE_READ_BINARY.args(PATH1), "YcOk"); query(_FILE_DELETE.args(PATH1)); } /** Test method. */ @Test public void write() { error(_FILE_WRITE.args(PATH, "()"), Err.FILE_DIR); error(_FILE_WRITE.args(PATH4, "()"), Err.FILE_NODIR); query(_FILE_WRITE.args(PATH1, "0")); query(_FILE_SIZE.args(PATH1), "1"); query(_FILE_WRITE.args(PATH1, "0")); query(_FILE_SIZE.args(PATH1), "1"); query(_FILE_DELETE.args(PATH1)); query(_FILE_WRITE.args(PATH1, "a\u00e4", serialParams(""))); query(_FILE_READ_TEXT.args(PATH1, "CP1252"), "a\u00e4"); query(_FILE_WRITE.args(PATH1, "\"\"", serialParams(""))); query(_FILE_READ_TEXT.args(PATH1), "<a/>"); query(_FILE_DELETE.args(PATH1)); // test spaces in filename query(_FILE_WRITE.args(PATH1 + "%20X", "")); query(_FILE_EXISTS.args(PATH1 + "%20X"), "true"); query(_FILE_DELETE.args(PATH1 + "%20X")); query(_FILE_EXISTS.args(PATH1 + "%20X"), "false"); query(_FILE_WRITE.args(PATH1 + " X", "")); query(_FILE_EXISTS.args(PATH1 + " X"), "true"); query(_FILE_DELETE.args(PATH1 + " X")); query(_FILE_EXISTS.args(PATH1 + " X"), "false"); } /** Test method. */ @Test public void append() { error(_FILE_APPEND.args(PATH, "()"), Err.FILE_DIR); error(_FILE_APPEND.args(PATH4, "()"), Err.FILE_NODIR); query(_FILE_APPEND.args(PATH1, "0")); query(_FILE_SIZE.args(PATH1), "1"); query(_FILE_APPEND.args(PATH1, "0", "()")); query(_FILE_SIZE.args(PATH1), "2"); query(_FILE_DELETE.args(PATH1)); query(_FILE_APPEND.args(PATH1, "a\u00e4", serialParams(""))); query(_FILE_READ_TEXT.args(PATH1, "CP1252"), "a\u00e4"); query(_FILE_DELETE.args(PATH1)); query(_FILE_APPEND.args(PATH1, "\"\"", serialParams(""))); query(_FILE_READ_TEXT.args(PATH1), "<a/>"); query(_FILE_DELETE.args(PATH1)); } /** Test method. */ @Test public void writeText() { error(_FILE_WRITE_TEXT.args(PATH, "x"), Err.FILE_DIR); error(_FILE_WRITE_TEXT.args(PATH1, " 123"), Err.INVCAST); query(_FILE_WRITE_TEXT.args(PATH1, "x")); query(_FILE_SIZE.args(PATH1), "1"); query(_FILE_WRITE_TEXT.args(PATH1, "\u00fc", "US-ASCII")); query(_FILE_READ_TEXT.args(PATH1), "?"); query(_FILE_DELETE.args(PATH1)); } /** Test method. */ @Test public void writeTextLines() { error(_FILE_WRITE_TEXT_LINES.args(PATH, "x"), Err.FILE_DIR); error(_FILE_WRITE_TEXT_LINES.args(PATH1, " 123"), Err.INVCAST); query(_FILE_WRITE_TEXT_LINES.args(PATH1, "x")); query(_FILE_SIZE.args(PATH1), 1 + Prop.NL.length()); query(_FILE_WRITE_TEXT_LINES.args(PATH1, "\u00fc", "US-ASCII")); query(_FILE_READ_TEXT_LINES.args(PATH1), "?"); query(_FILE_DELETE.args(PATH1)); } /** Test method. */ @Test public void writeBinary() { final String bin = "xs:base64Binary('MA==')"; error(_FILE_WRITE_BINARY.args(PATH, bin), Err.FILE_DIR); error(_FILE_WRITE_BINARY.args(PATH1, "NoBinary"), Err.BINARYTYPE); query(_FILE_WRITE_BINARY.args(PATH1, bin)); query(_FILE_SIZE.args(PATH1), "1"); query(_FILE_WRITE_BINARY.args(PATH1, bin)); query(_FILE_SIZE.args(PATH1), "1"); query(_FILE_DELETE.args(PATH1)); } /** Test method. */ @Test public void appendBinary() { final String bin = "xs:base64Binary('MA==')"; error(_FILE_APPEND_BINARY.args(PATH, bin), Err.FILE_DIR); error(_FILE_WRITE_BINARY.args(PATH1, "NoBinary"), Err.BINARYTYPE); query(_FILE_APPEND_BINARY.args(PATH1, bin)); query(_FILE_SIZE.args(PATH1), "1"); query(_FILE_APPEND_BINARY.args(PATH1, bin)); query(_FILE_READ_TEXT.args(PATH1), "00"); query(_FILE_DELETE.args(PATH1)); } /** Test method. */ @Test public void appendText() { error(_FILE_APPEND_TEXT.args(PATH, "x"), Err.FILE_DIR); error(_FILE_APPEND_TEXT.args(PATH1, " 123"), Err.INVCAST); query(_FILE_APPEND_TEXT.args(PATH1, "x")); query(_FILE_SIZE.args(PATH1), "1"); query(_FILE_APPEND_TEXT.args(PATH1, "\u00fc", "US-ASCII")); query(_FILE_READ_TEXT.args(PATH1), "x?"); query(_FILE_DELETE.args(PATH1)); } /** Test method. */ @Test public void appendTextLines() { error(_FILE_APPEND_TEXT_LINES.args(PATH, "x"), Err.FILE_DIR); error(_FILE_APPEND_TEXT_LINES.args(PATH1, " 123"), Err.INVCAST); query(_FILE_APPEND_TEXT_LINES.args(PATH1, "x")); query(_FILE_SIZE.args(PATH1), 1 + Prop.NL.length()); query(_FILE_APPEND_TEXT_LINES.args(PATH1, "('y','z')")); query(_FILE_SIZE.args(PATH1), 3 * (1 + Prop.NL.length())); query(_FILE_APPEND_TEXT_LINES.args(PATH1, "\u00fc", "US-ASCII")); query(_FILE_READ_TEXT_LINES.args(PATH1), "x y z ?"); query(_FILE_DELETE.args(PATH1)); } /** Test method. */ @Test public void copy() { query(_FILE_WRITE.args(PATH1, "A")); query(_FILE_COPY.args(PATH1, PATH2)); query(_FILE_COPY.args(PATH1, PATH2)); query(_FILE_COPY.args(PATH2, PATH2)); query(_FILE_SIZE.args(PATH1), "1"); query(_FILE_SIZE.args(PATH2), "1"); error(_FILE_COPY.args(PATH1, PATH3), Err.FILE_NODIR); query(_FILE_DELETE.args(PATH1)); query(_FILE_DELETE.args(PATH2)); } /** Test method. */ @Test public void move() { error(_FILE_MOVE.args(PATH1, PATH2), Err.FILE_WHICH); query(_FILE_WRITE.args(PATH1, "a")); query(_FILE_MOVE.args(PATH1, PATH2)); query(_FILE_MOVE.args(PATH2, PATH1)); query(_FILE_MOVE.args(PATH1, PATH1)); query(_FILE_MOVE.args(PATH1 + "/../" + NAME, PATH1)); error(_FILE_MOVE.args(PATH1, PATH4), Err.FILE_NODIR); query(_FILE_SIZE.args(PATH1), "1"); query(_FILE_EXISTS.args(PATH2), false); query(_FILE_DELETE.args(PATH1)); } /** Test method. */ @Test public void resolvePath() { final String path = query(_FILE_RESOLVE_PATH.args(PATH1)); final String can = new File(PATH1).getAbsolutePath(); assertEquals(path.toLowerCase(Locale.ENGLISH), can.toLowerCase(Locale.ENGLISH)); } /** Test method. */ @Test public void pathToURI() { final String path = query(_FILE_PATH_TO_URI.args(PATH1)); final String uri = new File(PATH1).toURI().toString(); assertEquals(path.toLowerCase(Locale.ENGLISH), uri.toLowerCase(Locale.ENGLISH)); } /** Test method. */ @Test public void baseName() { // check with a simple path query(_FILE_BASE_NAME.args(PATH1), NAME); // check with a path ending with a directory separator query(_FILE_BASE_NAME.args(PATH1 + File.separator), NAME); // check with a path consisting only of directory separators query(_FILE_BASE_NAME.args("//"), ""); // check with empty string path query(_FILE_BASE_NAME.args(""), "."); // check using a suffix query(_FILE_BASE_NAME.args(PATH1 + File.separator + "test.xml", ".xml"), "test"); } /** Test method. */ @Test public void dirName() { // check with a simple path assertEquals(norm(PATH), norm(query(_FILE_DIR_NAME.args(PATH1))).toLowerCase(Locale.ENGLISH)); // check with an empty path query(_FILE_DIR_NAME.args(""), "." + File.separator); // check with a path without directory separators query(_FILE_DIR_NAME.args(NAME), "." + File.separator); // check with a path without directory separators query(_FILE_DIR_NAME.args("/"), File.separator); } /** * Tests method. * @throws IOException I/O exception */ @Test public void pathToNative() throws IOException { assertEquals(norm(new File(PATH1).getCanonicalPath()), norm(query(_FILE_PATH_TO_NATIVE.args(PATH1)))); query(_FILE_PATH_TO_NATIVE.args(PATH + ".." + "/test.xml"), new File(PATH + ".." + "/test.xml").getCanonicalPath()); } /** * Normalize slashes of specified path to reduce OS dependent bugs. * @param path input path * @return normalized path */ private static String norm(final String path) { return (path + '/').replaceAll("[\\\\/]+", "/").toLowerCase(Locale.ENGLISH); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNFormatDETest.java000066400000000000000000000272001222453003200277020ustar00rootroot00000000000000package org.basex.test.query.func; import org.basex.test.query.*; /** * XQuery functions tests. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNFormatDETest extends QueryTest { /** Constructor. */ static { doc = ""; queries = new Object[][] { { "de0", str("null"), "format-integer(0, 'w', 'de')" }, { "de1", str("eins"), "format-integer(1, 'w', 'de')" }, { "de2", str("zwei"), "format-integer(2, 'w', 'de')" }, { "de3", str("drei"), "format-integer(3, 'w', 'de')" }, { "de4", str("vier"), "format-integer(4, 'w', 'de')" }, { "de5", str("f\u00fcnf"), "format-integer(5, 'w', 'de')" }, { "de6", str("sechs"), "format-integer(6, 'w', 'de')" }, { "de7", str("sieben"), "format-integer(7, 'w', 'de')" }, { "de8", str("acht"), "format-integer(8, 'w', 'de')" }, { "de9", str("neun"), "format-integer(9, 'w', 'de')" }, { "de10", str("zehn"), "format-integer(10, 'w', 'de')" }, { "de11", str("elf"), "format-integer(11, 'w', 'de')" }, { "de12", str("zw\u00f6lf"), "format-integer(12, 'w', 'de')" }, { "de13", str("dreizehn"), "format-integer(13, 'w', 'de')" }, { "de14", str("vierzehn"), "format-integer(14, 'w', 'de')" }, { "de15", str("f\u00fcnfzehn"), "format-integer(15, 'w', 'de')" }, { "de16", str("sechzehn"), "format-integer(16, 'w', 'de')" }, { "de17", str("siebzehn"), "format-integer(17, 'w', 'de')" }, { "de18", str("achtzehn"), "format-integer(18, 'w', 'de')" }, { "de19", str("neunzehn"), "format-integer(19, 'w', 'de')" }, { "de20", str("zwanzig"), "format-integer(20, 'w', 'de')" }, { "de21", str("einundzwanzig"), "format-integer(21, 'w', 'de')" }, { "de22", str("zweiundzwanzig"), "format-integer(22, 'w', 'de')" }, { "de23", str("dreiundzwanzig"), "format-integer(23, 'w', 'de')" }, { "de24", str("vierundzwanzig"), "format-integer(24, 'w', 'de')" }, { "de25", str("f\u00fcnfundzwanzig"), "format-integer(25, 'w', 'de')" }, { "de26", str("sechsundzwanzig"), "format-integer(26, 'w', 'de')" }, { "de27", str("siebenundzwanzig"), "format-integer(27, 'w', 'de')" }, { "de28", str("achtundzwanzig"), "format-integer(28, 'w', 'de')" }, { "de29", str("neunundzwanzig"), "format-integer(29, 'w', 'de')" }, { "de30", str("drei\u00dfig"), "format-integer(30, 'w', 'de')" }, { "de31", str("einunddrei\u00dfig"), "format-integer(31, 'w', 'de')" }, { "de32", str("zweiunddrei\u00dfig"), "format-integer(32, 'w', 'de')" }, { "de33", str("dreiunddrei\u00dfig"), "format-integer(33, 'w', 'de')" }, { "de34", str("vierunddrei\u00dfig"), "format-integer(34, 'w', 'de')" }, { "de35", str("f\u00fcnfunddrei\u00dfig"), "format-integer(35, 'w', 'de')" }, { "de36", str("sechsunddrei\u00dfig"), "format-integer(36, 'w', 'de')" }, { "de37", str("siebenunddrei\u00dfig"), "format-integer(37, 'w', 'de')" }, { "de38", str("achtunddrei\u00dfig"), "format-integer(38, 'w', 'de')" }, { "de39", str("neununddrei\u00dfig"), "format-integer(39, 'w', 'de')" }, { "de40", str("vierzig"), "format-integer(40, 'w', 'de')" }, { "de41", str("einundvierzig"), "format-integer(41, 'w', 'de')" }, { "de42", str("zweiundvierzig"), "format-integer(42, 'w', 'de')" }, { "de43", str("dreiundvierzig"), "format-integer(43, 'w', 'de')" }, { "de44", str("vierundvierzig"), "format-integer(44, 'w', 'de')" }, { "de45", str("f\u00fcnfundvierzig"), "format-integer(45, 'w', 'de')" }, { "de46", str("sechsundvierzig"), "format-integer(46, 'w', 'de')" }, { "de47", str("siebenundvierzig"), "format-integer(47, 'w', 'de')" }, { "de48", str("achtundvierzig"), "format-integer(48, 'w', 'de')" }, { "de49", str("neunundvierzig"), "format-integer(49, 'w', 'de')" }, { "de50", str("f\u00fcnfzig"), "format-integer(50, 'w', 'de')" }, { "de51", str("einundf\u00fcnfzig"), "format-integer(51, 'w', 'de')" }, { "de52", str("zweiundf\u00fcnfzig"), "format-integer(52, 'w', 'de')" }, { "de53", str("dreiundf\u00fcnfzig"), "format-integer(53, 'w', 'de')" }, { "de54", str("vierundf\u00fcnfzig"), "format-integer(54, 'w', 'de')" }, { "de55", str("f\u00fcnfundf\u00fcnfzig"), "format-integer(55, 'w', 'de')" }, { "de56", str("sechsundf\u00fcnfzig"), "format-integer(56, 'w', 'de')" }, { "de57", str("siebenundf\u00fcnfzig"), "format-integer(57, 'w', 'de')" }, { "de58", str("achtundf\u00fcnfzig"), "format-integer(58, 'w', 'de')" }, { "de59", str("neunundf\u00fcnfzig"), "format-integer(59, 'w', 'de')" }, { "de60", str("sechzig"), "format-integer(60, 'w', 'de')" }, { "de61", str("einundsechzig"), "format-integer(61, 'w', 'de')" }, { "de62", str("zweiundsechzig"), "format-integer(62, 'w', 'de')" }, { "de63", str("dreiundsechzig"), "format-integer(63, 'w', 'de')" }, { "de64", str("vierundsechzig"), "format-integer(64, 'w', 'de')" }, { "de65", str("f\u00fcnfundsechzig"), "format-integer(65, 'w', 'de')" }, { "de66", str("sechsundsechzig"), "format-integer(66, 'w', 'de')" }, { "de67", str("siebenundsechzig"), "format-integer(67, 'w', 'de')" }, { "de68", str("achtundsechzig"), "format-integer(68, 'w', 'de')" }, { "de69", str("neunundsechzig"), "format-integer(69, 'w', 'de')" }, { "de70", str("siebzig"), "format-integer(70, 'w', 'de')" }, { "de71", str("einundsiebzig"), "format-integer(71, 'w', 'de')" }, { "de72", str("zweiundsiebzig"), "format-integer(72, 'w', 'de')" }, { "de73", str("dreiundsiebzig"), "format-integer(73, 'w', 'de')" }, { "de74", str("vierundsiebzig"), "format-integer(74, 'w', 'de')" }, { "de75", str("f\u00fcnfundsiebzig"), "format-integer(75, 'w', 'de')" }, { "de76", str("sechsundsiebzig"), "format-integer(76, 'w', 'de')" }, { "de77", str("siebenundsiebzig"), "format-integer(77, 'w', 'de')" }, { "de78", str("achtundsiebzig"), "format-integer(78, 'w', 'de')" }, { "de79", str("neunundsiebzig"), "format-integer(79, 'w', 'de')" }, { "de80", str("achtzig"), "format-integer(80, 'w', 'de')" }, { "de81", str("einundachtzig"), "format-integer(81, 'w', 'de')" }, { "de82", str("zweiundachtzig"), "format-integer(82, 'w', 'de')" }, { "de83", str("dreiundachtzig"), "format-integer(83, 'w', 'de')" }, { "de84", str("vierundachtzig"), "format-integer(84, 'w', 'de')" }, { "de85", str("f\u00fcnfundachtzig"), "format-integer(85, 'w', 'de')" }, { "de86", str("sechsundachtzig"), "format-integer(86, 'w', 'de')" }, { "de87", str("siebenundachtzig"), "format-integer(87, 'w', 'de')" }, { "de88", str("achtundachtzig"), "format-integer(88, 'w', 'de')" }, { "de89", str("neunundachtzig"), "format-integer(89, 'w', 'de')" }, { "de90", str("neunzig"), "format-integer(90, 'w', 'de')" }, { "de91", str("einundneunzig"), "format-integer(91, 'w', 'de')" }, { "de92", str("zweiundneunzig"), "format-integer(92, 'w', 'de')" }, { "de93", str("dreiundneunzig"), "format-integer(93, 'w', 'de')" }, { "de94", str("vierundneunzig"), "format-integer(94, 'w', 'de')" }, { "de95", str("f\u00fcnfundneunzig"), "format-integer(95, 'w', 'de')" }, { "de96", str("sechsundneunzig"), "format-integer(96, 'w', 'de')" }, { "de97", str("siebenundneunzig"), "format-integer(97, 'w', 'de')" }, { "de98", str("achtundneunzig"), "format-integer(98, 'w', 'de')" }, { "de99", str("neunundneunzig"), "format-integer(99, 'w', 'de')" }, { "de100", str("einhundert"), "format-integer(100, 'w', 'de')" }, { "de101", str("einhunderteins"), "format-integer(101, 'w', 'de')" }, { "de109", str("einhundertneun"), "format-integer(109, 'w', 'de')" }, { "de110", str("einhundertzehn"), "format-integer(110, 'w', 'de')" }, { "de111", str("einhundertelf"), "format-integer(111, 'w', 'de')" }, { "de190", str("einhundertneunzig"), "format-integer(190, 'w', 'de')" }, { "de199", str("einhundertneunundneunzig"), "format-integer(199, 'w', 'de')" }, { "de200", str("zweihundert"), "format-integer(200, 'w', 'de')" }, { "de201", str("zweihunderteins"), "format-integer(201, 'w', 'de')" }, { "de999", str("neunhundertneunundneunzig"), "format-integer(999, 'w', 'de')" }, { "de1000", str("eintausend"), "format-integer(1000, 'w', 'de')" }, { "de1001", str("eintausendeins"), "format-integer(1001, 'w', 'de')" }, { "de1009", str("eintausendneun"), "format-integer(1009, 'w', 'de')" }, { "de1010", str("eintausendzehn"), "format-integer(1010, 'w', 'de')" }, { "de1011", str("eintausendelf"), "format-integer(1011, 'w', 'de')" }, { "de1111", str("eintausendeinhundertelf"), "format-integer(1111, 'w', 'de')" }, { "de9999", str("neuntausendneunhundertneunundneunzig"), "format-integer(9999, 'w', 'de')" }, { "de999999", str("neunhundertneunundneunzigtausendneunhundertneunundneunzig"), "format-integer(999999, 'w', 'de')" }, { "de999999999", str("neunhundertneunundneunzig millionen " + "neunhundertneunundneunzigtausendneunhundertneunundneunzig"), "format-integer(999999999, 'w', 'de')" }, { "de0.", str("nullte"), "format-integer(0, 'w;o', 'de')" }, { "de1.", str("erste"), "format-integer(1, 'w;o', 'de')" }, { "de2.", str("zweite"), "format-integer(2, 'w;o', 'de')" }, { "de3.", str("dritte"), "format-integer(3, 'w;o', 'de')" }, { "de4.", str("vierte"), "format-integer(4, 'w;o', 'de')" }, { "de5.", str("f\u00fcnfte"), "format-integer(5, 'w;o', 'de')" }, { "de6.", str("sechste"), "format-integer(6, 'w;o', 'de')" }, { "de7.", str("siebte"), "format-integer(7, 'w;o', 'de')" }, { "de8.", str("achte"), "format-integer(8, 'w;o', 'de')" }, { "de9.", str("neunte"), "format-integer(9, 'w;o', 'de')" }, { "de10.", str("zehnte"), "format-integer(10, 'w;o', 'de')" }, { "de11.", str("elfte"), "format-integer(11, 'w;o', 'de')" }, { "de12.", str("zw\u00f6lfte"), "format-integer(12, 'w;o', 'de')" }, { "de13.", str("dreizehnte"), "format-integer(13, 'w;o', 'de')" }, { "de14.", str("vierzehnte"), "format-integer(14, 'w;o', 'de')" }, { "de15.", str("f\u00fcnfzehnte"), "format-integer(15, 'w;o', 'de')" }, { "de16.", str("sechzehnte"), "format-integer(16, 'w;o', 'de')" }, { "de17.", str("siebzehnte"), "format-integer(17, 'w;o', 'de')" }, { "de18.", str("achtzehnte"), "format-integer(18, 'w;o', 'de')" }, { "de19.", str("neunzehnte"), "format-integer(19, 'w;o', 'de')" }, { "de20.", str("zwanzigste"), "format-integer(20, 'w;o', 'de')" }, { "de21.", str("einundzwanzigste"), "format-integer(21, 'w;o', 'de')" }, { "de22.", str("zweiundzwanzigste"), "format-integer(22, 'w;o', 'de')" }, { "de23.", str("dreiundzwanzigste"), "format-integer(23, 'w;o', 'de')" }, { "de99.", str("neunundneunzigste"), "format-integer(99, 'w;o', 'de')" }, { "de999.", str("neunhundertneunundneunzigste"), "format-integer(999, 'w;o', 'de')" }, { "de9999.", str("neuntausendneunhundertneunundneunzigste"), "format-integer(9999, 'w;o', 'de')" }, { "de999999.", str("neunhundertneunundneunzigtausendneunhundertneunundneunzigste"), "format-integer(999999, 'w;o', 'de')" }, { "de100.", str("einhundertste"), "format-integer(100, 'w;o', 'de')" }, { "de1000.", str("eintausendste"), "format-integer(1000, 'w;o', 'de')" }, { "de10000.", str("zehntausendste"), "format-integer(10000, 'w;o', 'de')" }, { "de100000.", str("einhunderttausendste"), "format-integer(100000, 'w;o', 'de')" }, { "de1000000.", str("millionste"), "format-integer(1000000, 'w;o', 'de')" }, }; } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNFormatDateTest.java000066400000000000000000000072231222453003200302720ustar00rootroot00000000000000package org.basex.test.query.func; import org.basex.test.query.*; /** * XQuery functions tests. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNFormatDateTest extends QueryTest { /** Constructor. */ static { doc = ""; queries = new Object[][] { { "formdate 10", str("2002-12-31"), "format-date(xs:date('2002-12-31'), '[Y0001]-[M01]-[D01]')" }, { "formdate 20", str("12-31-2002"), "format-date(xs:date('2002-12-31'), '[M]-[D]-[Y]')" }, { "formdate 30", str("2002-12-31"), "format-date(xs:date('2002-12-31'), '[Y0001]-[M01]-[D01]') " }, { "formdate 40", str("12-31-2002"), "format-date(xs:date('2002-12-31'), '[M]-[D]-[Y]') " }, { "formdate 50", str("31-12-2002"), "format-date(xs:date('2002-12-31'), '[D]-[M]-[Y]') " }, { "formdate 60", str("31 XII 2002"), "format-date(xs:date('2002-12-31'), '[D1] [MI] [Y]') " }, { "formdate 70", str("31st December, 2002"), "format-date(xs:date('2002-12-31'), '[D1o] [MNn], [Y]', 'en', (), ()) " }, { "formdate 80", str("31 DEC 2002"), "format-date(xs:date('2002-12-31'), '[D01] [MN,*-3] [Y0001]', 'en', (), ()) " }, { "formdate 90", str("December 31, 2002"), "format-date(xs:date('2002-12-31'), '[MNn] [D], [Y]', 'en', (), ()) " }, { "formdate 100", str("31 December, 2002"), "format-date(xs:date('2002-12-31'), '[D] [MNn], [Y]', 'en', (), ()) " }, { "formdate 110", str("[2002-12-31]"), "format-date(xs:date('2002-12-31'), '[[[Y0001]-[M01]-[D01]]]') " }, { "formdate 120", str("Two Thousand and Two"), "format-date(xs:date('2002-12-31'), '[YWw]', 'en', (), ()) " }, { "formdate 130", str("einunddrei\u00dfigste Dezember"), "format-date(xs:date('2002-12-31'), '[Dwo] [MNn]', 'de', (), ()) " }, { "formdate 140", str("3:58 PM"), "format-time(xs:time('15:58:45.762+02:00'), '[h]:[m01] [PN]', 'en', (), ()) " }, { "formdate 150", str("3:58:45 pm"), "format-time(xs:time('15:58:45.762+02:00'), " + "'[h]:[m01]:[s01] [Pn]', 'en', (), ()) " }, /* { "formdate 160", str("3:58:45 PM PDT"), "format-time(xs:time('15:58:45.762+02:00'), " + "'[h]:[m01]:[s01] [PN] [ZN,*-3]', 'en', (), ()) " }, { "formdate 170", str("3:58:45 o'clock PM PDT"), "format-time(xs:time('15:58:45.762+02:00'), " + "'[h]:[m01]:[s01] o''clock [PN] [ZN,*-3]', 'en', (), ()) " }, */ { "formdate 180", str("15:58"), "format-time(xs:time('15:58:45.762+02:00'),'[H01]:[m01]') " }, { "formdate 190", str("15:58:45.762"), "format-time(xs:time('15:58:45.762+02:00'), '[H01]:[m01]:[s01].[f001]') " }, { "formdate 200", str("15:58:45 GMT+02:00"), "format-time(xs:time('15:58:45.762+02:00'), " + "'[H01]:[m01]:[s01] [z,6-6]', 'en', (), ()) " }, { "formdate 210", str("15:58 Uhr GMT+2"), "format-time(xs:time('15:58:45.762+02:00'), " + "'[H01]:[m01] Uhr [z0]', 'de', (), ()) " }, { "formdate 220", str("3.58pm on Tuesday, 31st December"), "format-dateTime(xs:dateTime('2002-12-31T15:58:45.762+02:00'), " + "'[h].[m01][Pn] on [FNn], [D1o] [MNn]') " }, { "formdate 230", str("12/31/2002 at 15:58:45"), "format-dateTime(xs:dateTime('2002-12-31T15:58:45.762+02:00'), " + "'[M01]/[D01]/[Y0001] at [H01]:[m01]:[s01]')" }, { "formdate 250", str("J"), "format-time(xs:time('12:12:12'), '[ZZ]')" }, { "formdate 251", str(""), "format-time(xs:time('12:12:12'), '[zZ]')" }, { "formdate 252", str(""), "format-time(xs:time('12:12:12'), '[Zz]')" }, }; } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNFormatIntTest.java000066400000000000000000000147611222453003200301540ustar00rootroot00000000000000package org.basex.test.query.func; import org.basex.test.query.*; /** * XQuery functions tests. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNFormatIntTest extends QueryTest { /** Constructor. */ static { doc = ""; queries = new Object[][] { { "010", str("123"), "format-integer(123, '1')" }, { "020", str("123"), "format-integer(123, '001')" }, { "030", str("00123"), "format-integer(123, '00001')" }, { "040", str("-123"), "format-integer(-123, '9')" }, { "050", str("-123"), "format-integer(-123, '999')" }, { "060", str("-00123"), "format-integer(-123, '99999')" }, { "070", str("0"), "format-integer(0, '0')" }, { "080", str("000"), "format-integer(0, '000')" }, { "090", str("00000"), "format-integer(0, '00000')" }, { "100", str(",1"), "format-integer(1, '#,0')" }, { "102", str(".1"), "format-integer(1, '#.0')" }, { "104", str(",1"), "format-integer(1, '#,#,0')" }, { "106", str("1"), "format-integer(1, '#0')" }, { "110", str("0.1"), "format-integer(1, '0.0')" }, { "112", str("0,1"), "format-integer(1, '0,0')" }, { "114", str("1,1"), "format-integer(11, '#,0')" }, { "116", str("1.1.1"), "format-integer(111, '##0.0')" }, { "120", str("abcd"), "string-join(for $i in 1 to 4 return format-integer($i, 'a'))" }, { "122", str("ABCD"), "string-join(for $i in 1 to 4 return format-integer($i, 'A'))" }, { "124", str("i|ii|iii|iv|v|vi|vii|viii|ix|x|" + "xi|xii|xiii|xiv|xv|xvi|xvii|xviii|xix|xx"), "string-join(for $i in 1 to 20 return format-integer($i, 'i'), '|')" }, { "126", str("I|II|III|IV|V|VI|VII|VIII|IX|X|" + "XI|XII|XIII|XIV|XV|XVI|XVII|XVIII|XIX|XX"), "string-join(for $i in 1 to 20 return format-integer($i, 'I'), '|')" }, { "140", str("\u0661|\u0662|\u0663|\u0664|\u0665|\u0666|\u0667|\u0668|" + "\u0669|\u0661\u0660|\u0661\u0661|\u0661\u0662|\u0661\u0663|\u0661" + "\u0664|\u0661\u0665|\u0661\u0666|\u0661\u0667|\u0661\u0668|\u0661" + "\u0669|\u0662\u0660"), "string-join(for $i in 1 to 20 " + "return format-integer($i, '\u0661'), '|')" }, { "150", str("\u0661|\u0662|\u0663|\u0664|\u0665|\u0666|\u0667|\u0668|" + "\u0669|\u0661\u0660|\u0661\u0661|\u0661\u0662|\u0661\u0663|\u0661" + "\u0664|\u0661\u0665|\u0661\u0666|\u0661\u0667|\u0661\u0668|\u0661" + "\u0669|\u0662\u0660"), "string-join(for $i in 1 to 20 " + "return format-integer($i, '\u0669'), '|')" }, { "160", str("One|Two|Three|Four|Five|Six|Seven|Eight|Nine|Ten"), "string-join(for $i in 1 to 10 return format-integer($i, 'Ww'), '|')" }, { "170", str("ONE|TWO|THREE|FOUR|FIVE|SIX|SEVEN|EIGHT|NINE|TEN"), "string-join(for $i in 1 to 10 return format-integer($i, 'W'), '|')" }, { "180", str("one|two|three|four|five|six|seven|eight|nine|ten"), "string-join(for $i in 1 to 10 return format-integer($i, 'w'), '|')" }, { "210", str("1,500,000"), "format-integer(1500000, '0,000')" }, { "220", str("1,500,000"), "format-integer(1500000, '#,###,000')" }, { "290", str("1500\ud800\udd000,00"), "format-integer(1500000, '###\ud800\udd000,00')" }, { "300", str("(602)347-826"), "format-integer(602347826, '#(000)000-000')" }, { "310", str("SECOND"), "format-integer(2, 'W;o')" }, { "330", str("1st"), "format-integer(1, '1;o(-en)')" }, { "350", str("One"), "format-integer(1, 'Ww;t')" }, { "360", str(""), "format-integer((), 'Ww')" }, { "41", str("\uD801\uDCA1,\uD801\uDCA2\uD801\uDCA3\uD801\uDCA4"), "format-integer(1234, '#,\uD801\uDCA0\uD801\uDCA0\uD801\uDCA0')" }, { "420", str("\uD801\uDCA1"), "format-integer(1, '\uD801\uDCA0')" }, { "430", str("-85th"), "format-integer(-85, '1;o')" }, { "440", str("-Fifth"), "format-integer(-5, 'Ww;o')" }, { "450", str("Zero"), "format-integer(0, 'Ww')" }, { "460", str("\u2460\u2461\u2462\u2463\u2464"), "string-join(for $i in 1 to 5 return format-integer($i, '\u2460'))" }, { "470", str("\u2474\u2475\u2476\u2477\u2478"), "string-join(for $i in 1 to 5 return format-integer($i, '\u2474'))" }, { "480", str("\u2488\u2489\u248A\u248B\u248C"), "string-join(for $i in 1 to 5 return format-integer($i, '\u2488'))" }, { "490", str("\u0391\u0392\u0393\u0394\u0395"), "string-join(for $i in 1 to 5 return format-integer($i, '\u0391'))" }, { "500", str("\u03b1\u03b2\u03b3\u03b4\u03b5"), "string-join(for $i in 1 to 5 return format-integer($i, '\u03b1'))" }, { "505", str("\u03b1\u03b2\u03b3\u03b4\u03b5"), "string-join(for $i in 1 to 5 return format-integer($i, '\u03b1'))" }, { "507", str("\u05d0\u05d1\u05d2\u05d3\u05d4"), "string-join(for $i in 1 to 5 return format-integer($i, '\u05d0'))" }, { "510", str("12 345 678 901"), "format-integer(12345678901,'# 000')" }, { "520", str("1=\u4E00|2=\u4E8C|3=\u4E09|4=\u56DB|" + "5=\u4E94|6=\u516D|7=\u4E03|8=\u516B|9=\u4E5D|10=\u5341|11=\u5341" + "\u4E00|12=\u5341\u4E8C|13=\u5341\u4E09|14=\u5341\u56DB|15=\u5341" + "\u4E94|16=\u5341\u516D|17=\u5341\u4E03|18=\u5341\u516B|19=\u5341" + "\u4E5D|20=\u4E8C\u5341|21=\u4E8C\u5341\u4E00|22=\u4E8C\u5341\u4E8C|" + "23=\u4E8C\u5341\u4E09|151=\u767E\u4E94\u5341\u4E00|302=\u4E09\u767E" + "\u4E8C|469=\u56DB\u767E\u516D\u5341\u4E5D|2025=\u4E8C\u5343" + "\u4E8C\u5341\u4E94|"), "string-join(for $i in (1 to 23, 151, 302, 469, 2025) " + "return concat($i, '=', format-integer($i, '\u4e00'), '|'))" }, // errors { "err010", "format-integer(123, '0\u0661')" }, { "err020", "format-integer(123, '\u06610')" }, { "err030", "format-integer(123, '0\u06610')" }, { "err035", "format-integer(1234, '\u06630\u0663')" }, { "err040", "format-integer(a, 'w')" }, // XPDY0002 { "err050", "format-integer(1, '')" }, // XTDE0030 { "err070", "format-integer(1234, 'Ww;o())')" }, { "err100", "format-integer(1500000, '0,000,')" }, { "err110", "format-integer(1500000, '11#0,000')" }, // check: { "err140", "format-integer(1500000, ',123')" }, { "err150", "format-integer(1500000, '0,00,,000')" }, { "err160", "format-integer(1, '#--0')" } }; } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNFormatNumTest.java000066400000000000000000000110101222453003200301410ustar00rootroot00000000000000package org.basex.test.query.func; import org.basex.test.query.*; /** * XQuery functions tests. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNFormatNumTest extends QueryTest { /** Constructor. */ static { doc = ""; queries = new Object[][] { { "DecFormat 1", itr(1), "declare default decimal-format NaN='x'; 1" }, { "DecFormat 2", itr(1), "declare default decimal-format NaN='x' digit='y'; 1" }, { "DecFormat 3", itr(1), "declare decimal-format hans NaN='x'; 1" }, // XQST0114: duplicate decimal-format property { "DecFormatErr 1", "declare default decimal-format NaN='x' NaN='y'; 1" }, // XQST0111: duplicate decimal-format declaration { "DecFormatErr 2", "declare default decimal-format NaN='x'; " + "declare default decimal-format NaN='x'; 1" }, // XQST0098: character specified twice { "DecFormatErr 3", "declare default decimal-format percent=','; 1" }, // XQST0003: unknown decimal-format property { "DecFormatErr 4", "declare default decimal-format xxx='x'; 1" }, // XQST0097: invalid decimal-format property { "DecFormatErr 6", "declare default decimal-format zero-digit='x'; 1" }, // XQST0097: invalid decimal-format property { "DecFormatErr 7", "declare default decimal-format percent='xxx'; 1" }, { "formnum 10", str("0"), "format-number(0, '0')" }, { "formnum 20", str("00"), "format-number(0, '10')" }, { "formnum 30", str("1"), "format-number(1, '0')" }, { "formnum 35", str("0.1"), "format-number(0.1, '.0')" }, { "formnum 40", str("1.0"), "format-number(1, '1.0')" }, { "formnum 50", str("1"), "format-number(1.1, '1')" }, { "formnum 60", str("1.1"), "format-number(1.1, '1.0')" }, { "formnum 70", str("-1"), "format-number(-1, '1')" }, { "formnum 80", str("-1.1"), "format-number(-1.1, '1.1')" }, { "formnum 90", str("11"), "format-number(11, '00')" }, { "formnum 100", str("011"), "format-number(11, '000')" }, { "formnum 110", str("11"), "format-number(11, '###')" }, { "formnum 120", str("1,111"), "format-number(1111, '#,###')" }, { "formnum 130", str("1,111"), "format-number(1111, '0,000')" }, { "formnum 140", str("1.11"), "format-number(1.11, '#,#.#,#')" }, { "formnum 150", str("100%"), "format-number(1, '0.%')" }, { "formnum 160", str("-100.3%"), "format-number(-1.003, '0.0%')" }, { "formnum 170", str("1000\u2030"), "format-number(1, '0.\u2030')" }, { "formnum 180", str("Infinity"), "format-number(1 div 0.0e0, '0')" }, { "formnum 190", str("NaN"), "format-number(0 div 0.0e0, '0')" }, { "formnum 200", str("NaN"), "format-number(xs:double('NaN'), '00')" }, { "formnum 210", str("-1"), "format-number(-1, '0;-0')" }, { "formnum 220", str("100.0%"), "format-number(-1, '0.0%;0.0%')" }, { "formnum 230", str("1"), "format-number(-1, '-0;0')" }, { "formnum 240", str("1,2,3,4"), "format-number(1234, '#,#')" }, { "formnum 250", str("1,234,567"), "format-number(1234567, '#,###')" }, { "formnum 260", str("1,234,567.76"), "format-number(1234567.765, '#,###.##')" }, { "formnum 270", str("1.57"), "format-number(1.567, '#.#,#')" }, { "formnum 280", str("123,45,6"), "format-number(123456, '#,##,#')" }, { "formnum 290", str("1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"), "format-number(xs:decimal('11111111111111111111'), '#,#')" }, // http://www.w3schools.com/XSL/func_formatnumber.asp { "formnum w3-10", str("500100"), "format-number(500100, '#')" }, { "formnum w3-20", str("500100"), "format-number(500100, '0')" }, { "formnum w3-30", str("500100.00"), "format-number(500100, '#.00')" }, { "formnum w3-40", str("500100.0"), "format-number(500100, '#.0')" }, { "formnum w3-50", str("500,100.0"), "format-number(500100, '#,###.0')" }, { "formnum w3-60", str("23%"), "format-number(0.23456, '#%')" }, // http://www.devguru.com/technologies/xslt/quickref/ // xslt_example_formatnumber.xml { "formnum w3-10", str("123456789.000000000"), "format-number(123456789, '#.000000000')" }, { "formnum w3-20", str("123456789.0"), "format-number(123456789, '#.0')" }, { "formnum w3-3", str("12%"), "format-number(0.123456789, '##%')" }, { "formnum w3-40", str("123456789"), "format-number(123456789, '################')" }, }; } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNFtTest.java000066400000000000000000000132671222453003200266220ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import java.io.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.core.parse.Commands.CmdIndex; import org.basex.index.*; import org.basex.query.util.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the Fulltext Module. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNFtTest extends AdvancedQueryTest { /** Test file. */ private static final String FILE = "src/test/resources/input.xml"; /** * Initializes a test. * @throws BaseXException database exception */ @Before public void initTest() throws BaseXException { new CreateDB(NAME, FILE).execute(context); new CreateIndex(CmdIndex.FULLTEXT).execute(context); } /** * Test method. * @throws BaseXException database exception */ @Test public void search() throws BaseXException { // check index results query(_FT_SEARCH.args(NAME, "assignments"), "Assignments"); query(_FT_SEARCH.args(NAME, " ('exercise','1')"), "Exercise 1Exercise 2"); query(_FT_SEARCH.args(NAME, "1"), "Exercise 1"); query(_FT_SEARCH.args(NAME, "1"), "Exercise 1"); query(_FT_SEARCH.args(NAME, "XXX"), ""); // apply index options to query term new Set(Prop.STEMMING, true).execute(context); new CreateIndex("fulltext").execute(context); contains(_FT_SEARCH.args(NAME, "Exercises") + "/..", "
  • Exercise 1
  • "); new Set(Prop.STEMMING, false).execute(context); new CreateIndex(CmdIndex.FULLTEXT).execute(context); // check match options query(_FT_SEARCH.args(NAME, "Assignments", " { }"), "Assignments"); query(_FT_SEARCH.args(NAME, "Azzignments", " { 'fuzzy':'' }"), "Assignments"); query(_FT_SEARCH.args(NAME, "Azzignments", " { 'fuzzy':'no' }"), ""); // check search modes query(_FT_SEARCH.args(NAME, "1 Exercise", " { 'mode':'phrase' }"), ""); query(_FT_SEARCH.args(NAME, "1 Exercise", " { 'mode':'all' }"), ""); query(_FT_SEARCH.args(NAME, "1 Exercise", " { 'mode':'any' }"), ""); query(_FT_SEARCH.args(NAME, "1 Exercise", " { 'mode':'any word' }"), "Exercise 1Exercise 2"); query(_FT_SEARCH.args(NAME, "1 Exercise", " { 'mode':'all words' }"), "Exercise 1"); // check buggy options error(_FT_SEARCH.args(NAME, "x", " { 'x':'y' }"), Err.ELMOPTION); error(_FT_SEARCH.args(NAME, "x", " { 'mode':'' }"), Err.ELMOPTION); error(_FT_SEARCH.args(NAME, "x", " 1"), Err.ELMMAPTYPE); } /** Test method. */ @Test public void count() { query(_FT_COUNT.args("()"), "0"); query(_FT_COUNT.args(" //*[text() contains text '1']"), "1"); query(_FT_COUNT.args(" //li[text() contains text 'exercise']"), "2"); query("for $i in //li[text() contains text 'exercise'] return " + _FT_COUNT.args("$i[text() contains text 'exercise']"), "1 1"); } /** * Test method. * @throws IOException query exception */ @Test public void mark() throws IOException { query(_FT_MARK.args(" //*[text() contains text '1']"), "
  • Exercise 1
  • "); query(_FT_MARK.args(" //*[text() contains text '2'], 'b'"), "
  • Exercise 2
  • "); contains(_FT_MARK.args(" //*[text() contains text 'Exercise']"), "
  • Exercise 1
  • "); query("copy $a := text { 'a b' } modify () return " + _FT_MARK.args("$a[. contains text 'a']", "b"), "a b"); query("copy $a := text { 'ab' } modify () return " + _FT_MARK.args("$a[. contains text 'ab'], 'b'"), "ab"); query("copy $a := text { 'a b' } modify () return " + _FT_MARK.args("$a[. contains text 'a b'], 'b'"), "a b"); query(COUNT.args(_FT_MARK.args(" //*[text() contains text '1']/../../../../..")), "1"); new CreateDB(NAME, "C").execute(context); query(_FT_MARK.args(" /descendant::*[text() contains text 'C']", 'b'), "C"); new DropDB(NAME).execute(context); query("copy $c :=
    A modify () return { " + _FT_MARK.args(" $c[text() contains text 'A']") + " }/*"); } /** Test method. */ @Test public void extract() { query(_FT_EXTRACT.args(" //*[text() contains text '1']"), "
  • Exercise 1
  • "); query(_FT_EXTRACT.args(" //*[text() contains text '2'], 'b', 20"), "
  • Exercise 2
  • "); query(_FT_EXTRACT.args(" //*[text() contains text '2'], '_o_', 1"), "
  • ...<_o_>2
  • "); contains(_FT_EXTRACT.args(" //*[text() contains text 'Exercise'], 'b', 1"), "
  • Exercise...
  • "); } /** Test method. */ @Test public void score() { query(_FT_SCORE.args(_FT_SEARCH.args(NAME, "2")), "1"); query(_FT_SCORE.args(_FT_SEARCH.args(NAME, "XML")), "1 0.5"); } /** * Test method. * @throws BaseXException database exception */ @Test public void tokens() throws BaseXException { new CreateIndex(IndexType.FULLTEXT).execute(context); String entries = _FT_TOKENS.args(NAME); query("count(" + entries + ')', 6); query("exists(" + entries + "/self::entry)", "true"); query(entries + "/@count = 1", "true"); query(entries + "/@count = 2", "true"); query(entries + "/@count = 3", "false"); entries = _FT_TOKENS.args(NAME, "a"); query("count(" + entries + ')', 1); } /** Test method. */ @Test public void tokenize() { query(_FT_TOKENIZE.args("A bc"), "a bc"); query("declare ft-option using stemming; " + _FT_TOKENIZE.args("Gifts"), "gift"); query("count(" + _FT_TOKENIZE.args("") + ')', "0"); query("count(" + _FT_TOKENIZE.args("a!b:c") + ')', "3"); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNGenTest.java000066400000000000000000000021611222453003200267510ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import org.basex.query.func.*; import org.basex.query.util.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests XQuery functions placed in the {@link FNGen} class. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNGenTest extends AdvancedQueryTest { /** Text file. */ private static final String TEXT = "src/test/resources/input.xml"; /** Test method. */ @Test public void unparsedText() { contains(UNPARSED_TEXT.args(TEXT), "<html"); contains(UNPARSED_TEXT.args(TEXT, "US-ASCII"), "<html"); error(UNPARSED_TEXT.args(TEXT, "xyz"), Err.WHICHENC); } /** Test method. */ @Test public void parseXML() { contains(PARSE_XML.args("\"a\"") + "//text()", "a"); } /** Test method. */ @Test public void serialize() { contains(SERIALIZE.args(""), "<x/>"); contains(SERIALIZE.args("", serialParams("")), "<x/>"); contains(SERIALIZE.args("a", serialParams("")), "a"); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNHashTest.java000066400000000000000000000032171222453003200271260ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import org.basex.query.util.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the Hash Module. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNHashTest extends AdvancedQueryTest { /** Test method. */ @Test public void md5() { query(_HASH_MD5.args(""), "1B2M2Y8AsgTpgAmY7PhCfg=="); query(_HASH_MD5.args("BaseX"), "DWUYXJ4pYxHAoiABeeR5og=="); } /** Test method. */ @Test public void sha1() { query(_HASH_SHA1.args(""), "2jmj7l5rSw0yVb/vlWAYkK/YBwk="); query(_HASH_SHA1.args("BaseX"), "OtWVjw8n1a/9yilXVg8SHQWXpO0="); } /** Test method. */ @Test public void sha256() { query(_HASH_SHA256.args(""), "47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU="); query(_HASH_SHA256.args("BaseX"), "FdVwdj3rddcou2lkM5KHO4NczMlKLx6IGQnaR2YoIaM="); } /** Test method. */ @Test public void hash() { query(_HASH_HASH.args("", "MD5"), "1B2M2Y8AsgTpgAmY7PhCfg=="); query(_HASH_HASH.args("", "md5"), "1B2M2Y8AsgTpgAmY7PhCfg=="); query(_HASH_HASH.args("", "SHA"), "2jmj7l5rSw0yVb/vlWAYkK/YBwk="); query(_HASH_HASH.args("", "SHA1"), "2jmj7l5rSw0yVb/vlWAYkK/YBwk="); query(_HASH_HASH.args("", "SHA-1"), "2jmj7l5rSw0yVb/vlWAYkK/YBwk="); query(_HASH_HASH.args("", "SHA-256"), "47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU="); query(_HASH_HASH.args("xs:base64Binary('')", "md5"), "1B2M2Y8AsgTpgAmY7PhCfg=="); query(_HASH_HASH.args("xs:hexBinary('')", "md5"), "1B2M2Y8AsgTpgAmY7PhCfg=="); error(_HASH_HASH.args("", ""), Err.HASH_ALG); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNHofTest.java000066400000000000000000000040141222453003200267530ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import org.basex.query.util.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the Higher-Order Module. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class FNHofTest extends AdvancedQueryTest { /** Test method. */ @Test public void idTest() { query(_HOF_ID.args("()"), ""); query(_HOF_ID.args(""), ""); query("hof:id(1 to 10)", "1 2 3 4 5 6 7 8 9 10"); } /** Test method. */ @Test public void constTest() { query(_HOF_CONST.args("(), error()"), ""); query(_HOF_CONST.args(", 123"), ""); query("hof:const(1 to 10, error('foo'))", "1 2 3 4 5 6 7 8 9 10"); } /** Test method. */ @Test public void sortWithTest() { query("hof:sort-with((), function($a, $b) { $a < $b })", ""); query("hof:sort-with(1 to 5, function($a, $b) { $a > $b })", "5 4 3 2 1"); error("hof:sort-with(1 to 5, )", Err.INVCAST); } /** Test method. */ @Test public void foldLeft1Test() { query("hof:fold-left1(1 to 10, function($x, $y) { $x + $y })", "55"); error("hof:fold-left1((), function($x, $y) { $x + $y })", Err.INVEMPTY); } /** Test method. */ @Test public void untilTest() { query("hof:until(function($x) { $x >= 1000 }, function($x) { $x * 2 }, 1)", "1024"); query("hof:until(function($xs) {count($xs)>3}, function($x) {$x,$x}, 1)", "1 1 1 1"); } /** Test method. */ @Test public void topKByTest() { query("hof:top-k-by(1 to 1000, function($x) {-$x}, 0)", ""); query("hof:top-k-by((), function($x) {-$x}, 5)", ""); query("hof:top-k-by(1 to 1000, function($x) {-$x}, 5)", "1 2 3 4 5"); } /** Test method. */ @Test public void topKWithTest() { query("hof:top-k-with(1 to 1000, function($x,$y) {$x > $y}, 0)", ""); query("hof:top-k-with((), function($x,$y) {$x > $y}, 5)", ""); query("hof:top-k-with(1 to 5, function($x,$y) {$x > $y}, 5)", "1 2 3 4 5"); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNHtmlTest.java000066400000000000000000000014551222453003200271510ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the HTML module. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNHtmlTest extends AdvancedQueryTest { /** Test method. */ @Test public void parser() { // check if function returns a string query(_HTML_PARSER.args() + " instance of xs:string", "true"); } /** Test method. */ @Test public void parse() { // check if the function returns a HTML root node query(EXISTS.args(_HTML_PARSE.args("<html/>") + "/*:html"), "true"); // check if the function returns query(_HTML_PARSE.args("<html/>", " {'nons':true()}"), ""); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNIndexTest.java000066400000000000000000000063701222453003200273150ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the Index Module. * * @author BaseX Team 2005-12, BSD License * @author Andreas Weiler */ public final class FNIndexTest extends AdvancedQueryTest { /** Test file. */ private static final String FILE = "src/test/resources/input.xml"; /** * Initializes a test. * @throws BaseXException database exception */ @Before public void initTest() throws BaseXException { new CreateDB(NAME, FILE).execute(context); } /** * Finishes the code. * @throws BaseXException database exception */ @AfterClass public static void finish() throws BaseXException { new DropDB(NAME).execute(context); } /** Test method. */ @Test public void facets() { final String tree = _INDEX_FACETS.args(NAME); query(tree + "//element[@name='head']/@count/data()", 1); query(tree + "//element[@name='title']/text/@type/data()", "category"); query(tree + "//element[@name='li']/text/@count/data()", 2); final String flat = _INDEX_FACETS.args(NAME, "flat"); query(flat + "//element[@name='title']/@count/data()", 1); query(flat + "//element[@name='title']/@type/data()", "category"); query(flat + "//element[@name='li']/@count/data()", 2); } /** Test method. */ @Test public void texts() { // complete search final String entries = _INDEX_TEXTS.args(NAME); query("count(" + entries + ')', 5); query("exists(" + entries + "/self::entry)", "true"); query(entries + "/@count = 1", "true"); query(entries + "/@count != 1", "false"); // prefix search query(COUNT.args(_INDEX_TEXTS.args(NAME, "X")), 1); // ascending traversal query(COUNT.args(_INDEX_TEXTS.args(NAME, "X", "true()")), 1); // descending traversal query(_INDEX_TEXTS.args(NAME, "B", "false()") + "/text()", "Assignments"); // main memory traversal // extract single entry //query("let $a := copy $a := parse-xml('A') modify () return $a " + // "return " + _INDEX_TEXTS.args("$a") + "/text()", "A"); } /** Test method. */ @Test public void attributes() { // complete search final String entries = _INDEX_ATTRIBUTES.args(NAME); query("count(" + entries + ')', 6); query("exists(" + entries + "/self::entry)", "true"); query(entries + "/@count = 1", "true"); query(entries + "/@count != 1", "false"); // prefix search query(_INDEX_ATTRIBUTES.args(NAME, "1") + "/text()", "1"); // ascending traversal query(_INDEX_ATTRIBUTES.args(NAME, "X", "true()") + "/text()", "right"); // descending traversal query(_INDEX_ATTRIBUTES.args(NAME, "#000099", "false()") + "/text()", "#000000"); } /** Test method. */ @Test public void elementNames() { final String entries = _INDEX_ELEMENT_NAMES.args(NAME); query("count(" + entries + ')', 9); query("exists(" + entries + "/self::entry)", "true"); } /** Test method. */ @Test public void attributeNames() { final String entries = _INDEX_ATTRIBUTE_NAMES.args(NAME); query("count(" + entries + ')', 5); query("exists(" + entries + "/self::entry)", "true"); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNInspectTest.java000066400000000000000000000072271222453003200276550ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import org.basex.query.util.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the Inspection Module. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNInspectTest extends AdvancedQueryTest { /** Test method. */ @Test public void function() { String func = query(_INSPECT_FUNCTION.args(" true#0")); query(func + "/@name/data()", "true"); query(func + "/@uri/data()", "http://www.w3.org/2005/xpath-functions"); query(func + "/return/@type/data()", "xs:boolean"); query(func + "/return/@occurrence/data()", ""); func = query(_INSPECT_FUNCTION.args(" { }")); query(func + "/@name/data()", ""); query(func + "/@uri/data()", ""); query(func + "/argument/@type/data()", "xs:anyAtomicType"); query(func + "/return/@type/data()", "item()"); query(func + "/return/@occurrence/data()", "*"); func = query(_INSPECT_FUNCTION.args(" function($a as xs:string) as item() { $a }")); query(func + "/@name/data()", ""); query(func + "/@uri/data()", ""); query(func + "/argument/@name/data()", ""); query(func + "/argument/@type/data()", "xs:string"); query(func + "/return/@type/data()", "item()"); query(func + "/return/@occurrence/data()", ""); func = query("declare %private function Q{U}f($v as xs:int) as xs:integer {$v};" + _INSPECT_FUNCTION.args(" Q{U}f#1")); query(func + "/@name/data()", "f"); query(func + "/@uri/data()", "U"); query(func + "/argument/@name/data()", "v"); query(func + "/argument/@type/data()", "xs:int"); query(func + "/annotation/@name/data()", "private"); query(func + "/annotation/@uri/data()", "http://www.w3.org/2012/xquery"); query(func + "/return/@type/data()", "xs:integer"); query(func + "/return/@occurrence/data()", ""); } /** Test method. */ @Test public void module() { error(_INSPECT_MODULE.args("src/test/resources/non-existent.xqm"), Err.WHICHRES); final String module = "src/test/resources/hello.xqm"; final String result = query(_INSPECT_MODULE.args(module)); final String var = query(result + "/variable[@name = 'hello:lazy']"); query(var + "/@uri/data()", "world"); query(var + "/annotation/@name/data()", "basex:lazy"); query(var + "/annotation/@uri/data()", "http://basex.org"); final String func = query(result + "/function[@name = 'hello:world']"); query(func + "/@uri/data()", "world"); query(func + "/annotation/@name/data()", "public"); query(func + "/annotation/@uri/data()", "http://www.w3.org/2012/xquery"); query(func + "/return/@type/data()", "xs:string"); query(func + "/return/@occurrence/data()", ""); } /** Test method. */ @Test public void xqdoc() { error(_INSPECT_XQDOC.args("src/test/resources/non-existent.xqm"), Err.WHICHRES); // validate against xqDoc schema final String result = query(_INSPECT_XQDOC.args("src/test/resources/hello.xqm")); query(_VALIDATE_XSD.args(result, "src/test/resources/xqdoc.xsd")); } /** Test method. */ @Test public void context() { final String func = query("declare function local:x() { 1 }; " + _INSPECT_CONTEXT.args()); query(func + "/name()", "context"); query(COUNT.args(func + "/function"), "1"); query(func + "/function/@name/string()", "local:x"); } /** Test method. */ @Test public void contextFunctions() { query("declare function local:x() { 1 }; " + COUNT.args(_INSPECT_FUNCTIONS.args()), "1"); query("declare function local:x() { 2 }; " + _INSPECT_FUNCTIONS.args() + "()", "2"); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNJsonTest.java000066400000000000000000000102241222453003200271500ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import org.basex.query.util.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the JSON Module. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNJsonTest extends AdvancedQueryTest { /** JSON snippets. */ private static final String[][] TOXML = { { "" }, { "{" }, { "[]", "" }, { "{}", "" }, { "{ } ", "" }, { "{ \"" }, { "{ \"\\c\" : 0 }" }, { "{ \"\\t\" : 0 }", "<_0009>0" }, { "{ \"a\" :0 }", "0" }, { "{ \"\" : 0 }", "<_>0" }, { "{ \"\" : 0.0e0 }", "...<_>0.0e0" }, { "{ \"\" : null }", "...<_/>" }, { "{ \"\" : true }", "...<_>true" }, { "{ \"\" : {} }", "... objects=\"json _\"><_/>" }, { "{ \"\" : [] }", "... arrays=\"_\" objects=\"json\"><_/>" }, { "{ \"\" : 0, \"\": 1 }", "... objects=\"json\" numbers=\"_\"><_>0<_>1" }, { "{ \"\" : [ 1 ] }", "... arrays=\"_\" objects=\"json\" numbers=\"value\"><_>1" }, { "{ \"A\" : [ 0,1 ] }", "... objects=\"json\" numbers=\"value\">01" }, { "{ \"\" : 00 }" }, { "{ \"\" : 0. }" }, { "{ \"\" : 0.0 }", "...0.0" }, { "{ \"\" : 0e }" }, { "{ \"\" : 0.1. }" }, { "{ \"\" : 0.1e }" }, { "{ \"a\" : 0, }" }, { "{ \"a\" : 0 }}" }, }; /** XML snippets. */ private static final String[][] TOJSON = { { "" }, // invalid tag { "" }, // no type specified { "" }, // invalid type { "", "{}" }, { "", "{}" }, { "", "[]" }, { "", "[]" }, { "1" }, // no text allowed in json tag { "", "[null]" }, { "" }, // value needed { "" }, // value needed { "x" }, // no value { "", "[\"\"]" }, { "x", "[\"x\"]" }, { "1", "[1]" }, { "1", "[1]" }, }; /** Test method. */ @Test public void parse() { for(final String[] test : TOXML) { final String query = _JSON_PARSE.args(test[0]); if(test.length == 1) { error(query, Err.BXJS_PARSE); } else if(test[1].startsWith("...")) { contains(query, test[1].substring(3)); } else { query(query, test[1]); } } } /** Test method. */ @Test public void serialize() { for(final String[] f : TOJSON) { final String qu = _JSON_SERIALIZE.args(f[0]); if(f.length == 1) { error(qu, Err.BXJS_SERIAL); } else if(f[1].startsWith("...")) { contains(qu, f[1].substring(3)); } else { query(qu, f[1]); } } } /** Test method with namespaces. */ @Test public void ns() { query("json:serialize({ json:parse('{}') }/*)", "{}"); } /** Tests the configuration argument of {@code json:parse(...)}. */ @Test public void config() { query("json:parse('[\"foo\",{\"test\":\"asdf\"}]', {'format':'jsonml'})", ""); query("map:size(json:parse('[\"foo\",{\"test\":\"asdf\"}]', {'format':'map'}))", "2"); query("json:parse('\"\\t\\u000A\"'," + " {'format':'map','unescape':false(),'spec':'liberal'})", "\\t\\u000A"); query("string-to-codepoints(json:parse('\"\\t\\u000A\"'," + " {'format':'map','unescape':true(),'spec':'liberal'}))", "9 10"); error("json:parse('42', {'spec':'garbage'})", Err.BXJS_CONFIG); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNMapTest.java000066400000000000000000000043211222453003200267550ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import org.basex.query.*; import org.basex.query.util.*; import org.basex.test.query.*; import org.basex.util.*; import org.junit.*; /** * This class tests the functions of the Map Module. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNMapTest extends AdvancedQueryTest { /** Test method. */ @Test public void newTest() { query(EXISTS.args(_MAP_NEW.args("()")), true); query(_MAP_SIZE.args(_MAP_NEW.args("()")), 0); query(COUNT.args(_MAP_NEW.args("()")), 1); query(_MAP_SIZE.args(_MAP_NEW.args(_MAP_NEW.args("()"))), 0); } /** Test method. */ @Test public void entry() { query(EXISTS.args(_MAP_ENTRY.args("A", "B")), true); query(EXISTS.args(_MAP_ENTRY.args(1, 2)), true); query(EXISTS.args(_MAP_NEW.args(_MAP_ENTRY.args(1, 2))), "true"); error(EXISTS.args(_MAP_ENTRY.args("()", 2)), Err.INVEMPTY); error(EXISTS.args(_MAP_ENTRY.args("(1,2)", 2)), Err.SEQCAST); } /** Test method. */ @Test public void get() { query(_MAP_GET.args(_MAP_NEW.args("()"), 1), ""); query(_MAP_GET.args(_MAP_ENTRY.args(1, 2), 1), 2); } /** Test method. */ @Test public void contains() { query(_MAP_CONTAINS.args(_MAP_NEW.args(), 1), false); query(_MAP_CONTAINS.args(_MAP_ENTRY.args(1, 2), 1), true); } /** Test method. */ @Test public void remove() { query(_MAP_SIZE.args(_MAP_REMOVE.args(_MAP_ENTRY.args(1, 2), 1)), 0); } /** Test method. */ @Test public void size() { query(_MAP_SIZE.args(_MAP_ENTRY.args(1, 2)), 1); } /** Test method. */ @Test public void keys() { query("for $i in " + _MAP_KEYS.args( _MAP_NEW.args(" for $i in 1 to 3 return " + _MAP_ENTRY.args("$i", "$i+1"))) + " order by $i return $i", "1 2 3"); query("let $map := " + _MAP_NEW.args(" for $i in 1 to 3 return " + _MAP_ENTRY.args("$i", "$i + 1")) + "for $k in " + _MAP_KEYS.args("$map") + " order by $k return " + _MAP_GET.args("$map", "$k"), "2 3 4"); } /** Test method. */ @Test public void collation() { query(_MAP_COLLATION.args(_MAP_NEW.args()), Token.string(QueryText.URLCOLL)); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNMathTest.java000066400000000000000000000007441222453003200271360ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the Math Module. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNMathTest extends AdvancedQueryTest { /** Test method. */ @Test public void crc32() { query(_MATH_CRC32.args(""), "00000000"); query(_MATH_CRC32.args("BaseX"), "4C06FC7F"); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNNotTest.java000066400000000000000000000154241222453003200270060ustar00rootroot00000000000000package org.basex.test.query.func; import org.basex.test.query.*; /** * XQuery functions tests. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNNotTest extends QueryTest { /** Constructor. */ static { doc = ""; queries = new Object[][] { { "fn-notint1args-1", bool(false), "fn:not(xs:int('-2147483648'))" }, { "fn-notint1args-2", bool(false), "fn:not(xs:int('-1873914410'))" }, { "fn-notint1args-3", bool(false), "fn:not(xs:int('2147483647'))" }, { "fn-notintg1args-1", bool(false), "fn:not(xs:integer('-999999999999999999'))" }, { "fn-notintg1args-2", bool(false), "fn:not(xs:integer('830993497117024304'))" }, { "fn-notintg1args-3", bool(false), "fn:not(xs:integer('999999999999999999'))" }, { "fn-notdec1args-1", bool(false), "fn:not(xs:decimal('-999999999999999999'))" }, { "fn-notdec1args-2", bool(false), "fn:not(xs:decimal('617375191608514839'))" }, { "fn-notdec1args-3", bool(false), "fn:not(xs:decimal('999999999999999999'))" }, { "fn-notdbl1args-1", bool(false), "fn:not(xs:double('-1.7976931348623157E308'))" }, { "fn-notdbl1args-2", bool(true), "fn:not(xs:double('0'))" }, { "fn-notdbl1args-3", bool(false), "fn:not(xs:double('1.7976931348623157E308'))" }, { "fn-notflt1args-1", bool(false), "fn:not(xs:float('-3.4028235E38'))" }, { "fn-notflt1args-2", bool(true), "fn:not(xs:float('0'))" }, { "fn-notflt1args-3", bool(false), "fn:not(xs:float('3.4028235E38'))" }, { "fn-notlng1args-1", bool(false), "fn:not(xs:long('-92233720368547758'))" }, { "fn-notlng1args-2", bool(false), "fn:not(xs:long('-47175562203048468'))" }, { "fn-notlng1args-3", bool(false), "fn:not(xs:long('92233720368547758'))" }, { "fn-notusht1args-1", bool(true), "fn:not(xs:unsignedShort('0'))" }, { "fn-notusht1args-2", bool(false), "fn:not(xs:unsignedShort('44633'))" }, { "fn-notusht1args-3", bool(false), "fn:not(xs:unsignedShort('65535'))" }, { "fn-notnint1args-1", bool(false), "fn:not(xs:negativeInteger('-999999999999999999'))" }, { "fn-notnint1args-2", bool(false), "fn:not(xs:negativeInteger('-297014075999096793'))" }, { "fn-notnint1args-3", bool(false), "fn:not(xs:negativeInteger('-1'))" }, { "fn-notpint1args-1", bool(false), "fn:not(xs:positiveInteger('1'))" }, { "fn-notpint1args-2", bool(false), "fn:not(xs:positiveInteger('52704602390610033'))" }, { "fn-notpint1args-3", bool(false), "fn:not(xs:positiveInteger('999999999999999999'))" }, { "fn-notulng1args-1", bool(true), "fn:not(xs:unsignedLong('0'))" }, { "fn-notulng1args-2", bool(false), "fn:not(xs:unsignedLong('130747108607674654'))" }, { "fn-notulng1args-3", bool(false), "fn:not(xs:unsignedLong('184467440737095516'))" }, { "fn-notnpi1args-1", bool(false), "fn:not(xs:nonPositiveInteger('-999999999999999999'))" }, { "fn-notnpi1args-2", bool(false), "fn:not(xs:nonPositiveInteger('-475688437271870490'))" }, { "fn-notnpi1args-3", bool(true), "fn:not(xs:nonPositiveInteger('0'))" }, { "fn-notnni1args-1", bool(true), "fn:not(xs:nonNegativeInteger('0'))" }, { "fn-notnni1args-2", bool(false), "fn:not(xs:nonNegativeInteger('303884545991464527'))" }, { "fn-notnni1args-3", bool(false), "fn:not(xs:nonNegativeInteger('999999999999999999'))" }, { "fn-notsht1args-1", bool(false), "fn:not(xs:short('-32768'))" }, { "fn-notsht1args-2", bool(false), "fn:not(xs:short('-5324'))" }, { "fn-notsht1args-3", bool(false), "fn:not(xs:short('32767'))" }, { "fn-not-1", bool(false), "fn:not('true')" }, { "fn-not-2", bool(false), "fn:not('fn:not()')" }, { "fn-not-3", bool(false), "fn:not('true') and fn:not('true')" }, { "fn-not-4", bool(false), "fn:not('true') or fn:not('true')" }, { "fn-not-5", bool(true), "fn:not('true') eq fn:not('true')" }, { "fn-not-6", bool(false), "fn:not('true') ne fn:not('true')" }, { "fn-not-7", bool(false), "fn:not('true') lt fn:not('true')" }, { "fn-not-8", bool(true), "fn:not('true') le fn:not('true')" }, { "fn-not-9", bool(false), "fn:not('true') gt fn:not('true')" }, { "fn-not-10", bool(true), "fn:not('true') ge fn:not('true')" }, { "fn-not-11", bool(true), "fn:not('true') = fn:not('true')" }, { "fn-not-12", bool(false), "fn:not('true') != fn:not('true')" }, { "fn-not-13", bool(false), "fn:not('true') < fn:not('true')" }, { "fn-not-14", bool(true), "fn:not('true') <= fn:not('true')" }, { "fn-not-15", bool(false), "fn:not('true') > fn:not('true')" }, { "fn-not-16", bool(true), "fn:not('true') >= fn:not('true')" }, { "fn-not-17", bool(false), "xs:boolean(fn:not('true'))" }, { "fn-not-18", str("false"), "fn:string(fn:not('true'))" }, { "fn-not-19", str("falsefalse"), "fn:concat(xs:string(fn:not('true')),xs:string(fn:not('true')))" }, { "fn-not-20", bool(true), "fn:contains(xs:string(fn:not('true')),xs:string(fn:not('true')))" }, { "fn-not-21", itr(5), "fn:string-length(xs:string(fn:not('true')))" }, { "K-NotFunc-1", "not()" }, { "K-NotFunc-2", "not(1, 2, 3, 4, 5, 6)" }, { "K-NotFunc-3", bool(true), "not(false() and false())" }, { "K-NotFunc-4", bool(true), "not(not(true()))" }, { "K-NotFunc-5", bool(true), "not(false())" }, { "K-NotFunc-6", bool(true), "not(0)" }, { "K-NotFunc-7", bool(true), "not(())" }, { "K-NotFunc-8", bool(true), "not(xs:anyURI(''))" }, { "K-NotFunc-9", bool(true), "not(not(xs:anyURI('example.com/')))" }, { "K-NotFunc-10", bool(true), "not(fn:boolean((1, 2, 3, current-time())[1] treat as xs:integer)) " + "eq false()" }, { "not 1", bool(false), "not( = )" }, { "not 2", bool(true), "not( != )" }, { "not 3", bool(false), "not(a < b)" }, { "not 4", bool(true), "not(a > b)" }, { "not 5", bool(false), "not(a >= a)" }, { "not 6", bool(false), "not(a <= a)" }, { "not 7", bool(false), "not((b,a) <= a)" }, { "not 8", bool(false), "not((b,a) >= a)" }, { "not 9", bool(true), "not(not())" }, { "not 10", bool(false, true), "for $b in (true(),false()) return not($b)" }, { "not 11", bool(true, false), "for $b in (true(),false()) return not(not($b))" }, }; } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNOutTest.java000066400000000000000000000015141222453003200270100ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the Output Module. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNOutTest extends AdvancedQueryTest { /** Test method. */ @Test public void nl() { // query() function removes all newlines.. query(_OUT_NL.args(), ""); } /** Test method. */ @Test public void tab() { query(_OUT_TAB.args(), "\t"); } /** Test method. */ @Test public void format() { query(_OUT_FORMAT.args("x", "x"), "x"); query(_OUT_FORMAT.args("%d", " 1"), "1"); query(_OUT_FORMAT.args("%2d", " 1"), " 1"); query(_OUT_FORMAT.args("%05d", " 123"), "00123"); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNPatTest.java000066400000000000000000000013031222453003200267610ustar00rootroot00000000000000package org.basex.test.query.func; import org.basex.query.func.*; import org.basex.query.util.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests XQuery functions placed in the {@link FNPat} class. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class FNPatTest extends AdvancedQueryTest { /** Tests for the {@code fn:replate} function. */ @Test public void replace() { // tests for issue GH-573: query("replace('aaaa bbbbbbbb ddd ','(.{6,15}) ','$1@')", "aaaa bbbbbbbb@ddd "); query("replace(' aaa AAA 123','(\\s+\\P{Ll}{3,280}?)','$1@')", " aaa AAA@ 123@"); error("replace('asdf','a{12,3}','')", Err.REGPAT); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNProcTest.java000066400000000000000000000012541222453003200271450ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import org.basex.query.util.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the Process Module. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNProcTest extends AdvancedQueryTest { /** Test method. */ @Test public void system() { query(_PROC_SYSTEM.args("java", "-version"), ""); error(_PROC_SYSTEM.args("java", "-version", "xx"), Err.BXPR_ENC); } /** Test method. */ @Test public void execute() { query("count(" + _PROC_EXECUTE.args("java", "-version") + "/*)", "3"); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNProfTest.java000066400000000000000000000042171222453003200271520ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the Profiling Module. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNProfTest extends AdvancedQueryTest { /** Test method. */ @Test public void mem() { try { System.setErr(NULL); query(_PROF_MEM.args("()")); query(COUNT.args(_PROF_MEM.args(" 1 to 100 ", false)), "100"); query(COUNT.args(_PROF_MEM.args(" 1 to 100 ", true)), "100"); query(COUNT.args(_PROF_MEM.args(" 1 to 100 ", true, "label")), "100"); } finally { System.setErr(ERR); } } /** Test method. */ @Test public void time() { try { System.setErr(NULL); query(_PROF_TIME.args("()")); query(COUNT.args(_PROF_TIME.args(" 1 to 100 ", false)), "100"); query(COUNT.args(_PROF_TIME.args(" 1 to 100 ", true)), "100"); query(COUNT.args(_PROF_TIME.args(" 1 to 100 ", true, "label")), "100"); } finally { System.setErr(ERR); } } /** Test method. */ @Test public void sleep() { query(_PROF_SLEEP.args(" 10")); query(_PROF_SLEEP.args(" 1")); query(_PROF_SLEEP.args(" 0")); query(_PROF_SLEEP.args(" -1")); } /** Test method. */ @Test public void human() { query(_PROF_HUMAN.args(" 1"), "1 Byte"); query(_PROF_HUMAN.args(" 2"), "2 Bytes"); query(_PROF_HUMAN.args(" 512"), "512 Bytes"); query(_PROF_HUMAN.args(" 32768"), "32 KB"); query(_PROF_HUMAN.args(" 1048576"), "1 MB"); } /** Test method. */ @Test public void dump() { try { System.setErr(NULL); query(_PROF_DUMP.args("a"), ""); } finally { System.setErr(ERR); } } /** Test method. */ @Test public void voidd() { query(_PROF_VOID.args("()"), ""); query(_PROF_VOID.args("1"), ""); query(_PROF_VOID.args("1,2"), ""); } /** Test method. */ @Test public void currentMs() { } /** Test method. */ @Test public void currentNs() { } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNPutTest.java000066400000000000000000000010141222453003200270040ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import org.basex.test.query.AdvancedQueryTest; import org.junit.Test; /** * This class tests the XQuery fn:put() function. * * @author BaseX Team 2005-13, BSD License * @author Dimitar Popov */ public class FNPutTest extends AdvancedQueryTest { /** Test output URI is correctly resolved. */ @Test public void resolveUri() { final String output = sandbox().merge("test.xml").url(); query(PUT.args("", output)); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNRandomTest.java000066400000000000000000000033731222453003200274660ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import static org.junit.Assert.*; import java.util.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the Random Module. * * @author BaseX Team 2005-12, BSD License * @author Dirk Kirsten */ public final class FNRandomTest extends AdvancedQueryTest { /** Test method. */ @Test public void doubleTest() { final Double i1 = Double.valueOf(query(_RANDOM_DOUBLE.args())); final Double i2 = Double.valueOf(query(_RANDOM_DOUBLE.args())); assertTrue(!i1.equals(i2) && i1 >= 0.0 && i1 < 1.0); } /** Test method. */ @Test public void seededDouble() { final int num = 5; final Random r = new Random(); final Integer seed = r.nextInt(); query(_RANDOM_SEEDED_DOUBLE.args(seed, num)); } /** Test method. */ @Test public void integer() { final Integer i = Integer.valueOf(query(_RANDOM_INTEGER.args(5))); assertTrue(i >= 0 && i < 5); assertEquals("0", query(_RANDOM_INTEGER.args(0))); assertEquals("0", query(_RANDOM_INTEGER.args(-1))); assertEquals("0", query(_RANDOM_INTEGER.args(" 8000000000"))); } /** Test method. */ @Test public void seededInteger() { final int num = 5; final Random r = new Random(); final Integer seed = r.nextInt(); query(_RANDOM_SEEDED_INTEGER.args(seed, num)); query(_RANDOM_SEEDED_INTEGER.args(seed, num, 1000000)); } /** Test method. */ @Test public void gaussian() { final int num = 50; query(_RANDOM_GAUSSIAN.args(num)); } /** Test method. */ @Test public void uuid() { final String s1 = query(_RANDOM_UUID.args()); final String s2 = query(_RANDOM_UUID.args()); assertFalse(s1.equals(s2)); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNRepoTest.java000066400000000000000000000055451222453003200271560ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import static org.junit.Assert.*; import java.io.*; import org.basex.core.*; import org.basex.io.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the Repository Module. * * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ public class FNRepoTest extends AdvancedQueryTest { /** Test repository. */ private static final String REPO = "src/test/resources/repo/"; /** Pkg3 name. */ private static final String PKG3 = "http://www.pkg3.com"; /** Pkg4 name. */ private static final String PKG4 = "http://www.pkg4.com"; /** Pkg3 directory. */ private static final String PKG3ID = PKG3 + "-10.0"; /** Prepares a test. */ @Before public void setupTest() { context = new Context(); context.mprop.set(MainProp.REPOPATH, REPO); new IOFile(REPO, PKG3ID).delete(); } /** Test method. */ @Test public void install() { query(_REPO_INSTALL.args(REPO + "pkg3.xar")); final String dir = normalize(PKG3ID); assertTrue(dir(dir)); assertTrue(file(dir + "/expath-pkg.xml")); assertTrue(dir(dir + "/pkg3")); assertTrue(dir(dir + "/pkg3/mod")); assertTrue(file(dir + "/pkg3/mod/pkg3mod1.xql")); query(_REPO_DELETE.args(PKG3)); } /** Test method. */ @Test public void delete() { // install query(_REPO_INSTALL.args(REPO + "pkg3.xar")); // delete by package name final String dir = normalize(PKG3ID); assertTrue("Directory not found: " + dir, dir(dir)); query(_REPO_DELETE.args(PKG3)); assertFalse("Directory still exists: " + dir, dir(dir)); // install again query(_REPO_INSTALL.args(REPO + "pkg3.xar")); // delete by name and version query(_REPO_DELETE.args(PKG3ID)); assertFalse(dir(dir)); } /** Test method. */ @Test public void list() { // install pkg3 query(_REPO_INSTALL.args(REPO + "pkg3.xar")); // install pkg4 query(_REPO_INSTALL.args(REPO + "pkg4.xar")); contains(_REPO_LIST.toString(), PKG3); contains(_REPO_LIST.toString(), PKG4); query(_REPO_DELETE.args(PKG4)); query(_REPO_DELETE.args(PKG3)); } /** * Checks if the specified path points to a file. * @param path file path * @return result of check */ private static boolean file(final String path) { final File file = new File(REPO + path); return file.exists() && !file.isDirectory(); } /** * Checks if the specified path points to a directory. * @param path file path * @return result of check */ private static boolean dir(final String path) { return new File(REPO + path).isDirectory(); } /** * Normalizes the given path. * @param path path * @return normalized path */ private static String normalize(final String path) { return path.replaceAll("[^\\w.-]+", "-"); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNSqlTest.java000066400000000000000000000016201222453003200267760ustar00rootroot00000000000000package org.basex.test.query.func; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the SQL Module. * Due to the lack of a default JDBC driver, this class contains only tests signatures. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNSqlTest extends AdvancedQueryTest { /** Test method. */ @Test public void init() { } /** Test method. */ @Test public void connect() { } /** Test method. */ @Test public void prepare() { } /** Test method. */ @Test public void execute() { } /** Test method. */ @Test public void executePrepared() { } /** Test method. */ @Test public void close() { } /** Test method. */ @Test public void commit() { } /** Test method. */ @Test public void rollback() { } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNStreamTest.java000066400000000000000000000017451222453003200275020ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the Streaming Module. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNStreamTest extends AdvancedQueryTest { /** Test file. */ private static final String FILE = "src/test/resources/corrupt.xml"; /** Test method. */ @Test public void materialize() { query(_FILE_READ_TEXT.args(FILE), "<"); query(_STREAM_MATERIALIZE.args(_FILE_READ_BINARY.args(FILE)), "PA=="); query(_STREAM_MATERIALIZE.args(_FILE_READ_TEXT.args(FILE)), "<"); } /** Test method. */ @Test public void isStreamable() { query(_STREAM_IS_STREAMABLE.args(_FILE_READ_BINARY.args(FILE)), "true"); query(_STREAM_IS_STREAMABLE.args("A"), "false"); query(_STREAM_IS_STREAMABLE.args(_STREAM_MATERIALIZE.args( _FILE_READ_TEXT.args(FILE))), "false"); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNUnitTest.java000066400000000000000000000025611222453003200271630ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import org.basex.query.util.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the Unit Module. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNUnitTest extends AdvancedQueryTest { /** Test method. */ @Test public void faill() { error(_UNIT_FAIL.args("1"), Err.UNIT_MESSAGE); } /** Test method. */ @Test public void assrt() { query(_UNIT_ASSERT.args("1"), ""); query(_UNIT_ASSERT.args("(,)"), ""); error(_UNIT_ASSERT.args("()"), Err.UNIT_ASSERT); error(_UNIT_ASSERT.args("()", "X"), Err.UNIT_MESSAGE); } /** Test method. */ @Test public void test() { String func = "declare %unit:test function local:x() { 1 }; "; query(func + COUNT.args(_UNIT_TEST.args()), "1"); func = "declare %unit:test function local:x() { unit:fail('') }; "; query(func + COUNT.args(_UNIT_TEST.args() + "//failure"), "1"); func = "declare %unit:test function local:x() { 1+ }; "; query(func + COUNT.args(_UNIT_TEST.args() + "//error"), "1"); func = "declare %unit:test function local:x() { 1+ }; "; query(func + COUNT.args(_UNIT_TEST.args(_INSPECT_FUNCTIONS.args()) + "//error"), "1"); query(func + _UNIT_TEST.args("()") + "/*/*", ""); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNValidateTest.java000066400000000000000000000115301222453003200277710ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import org.basex.query.util.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the Validation Module. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNValidateTest extends AdvancedQueryTest { /** Test file. */ private static final String DIR = "src/test/resources/"; /** Test file. */ private static final String FILE = DIR + "validate.xml"; /** Test file. */ private static final String XSD = DIR + "validate.xsd"; /** Test file. */ private static final String DTD = DIR + "validate.dtd"; /** Test method. */ @Test public void xsd() { // specify arguments as file paths query(_VALIDATE_XSD.args(FILE, XSD), ""); // specify arguments as document nodes query(_VALIDATE_XSD.args(DOC.args(FILE), DOC.args(XSD)), ""); // specify arguments as file contents query(_VALIDATE_XSD.args(_FILE_READ_TEXT.args(FILE), _FILE_READ_TEXT.args(XSD)), ""); // specify main-memory fragments as arguments query( "let $doc := " + "let $schema := " + " " + " " + "return validate:xsd($doc, $schema)", ""); // invalid arguments error(_VALIDATE_XSD.args("unknown"), Err.WHICHRES); error(_VALIDATE_XSD.args(FILE, "unknown.xsd"), Err.WHICHRES); error(_VALIDATE_XSD.args(FILE), Err.BXVA_FAIL); error( "let $doc := " + "let $schema := " + " " + " " + "return validate:xsd($doc, $schema)", Err.BXVA_FAIL); } /** Test method. */ @Test public void xsdInfo() { // specify arguments as file paths query(_VALIDATE_XSD_INFO.args(FILE, XSD), ""); // specify arguments as document nodes query(_VALIDATE_XSD_INFO.args(DOC.args(FILE), DOC.args(XSD)), ""); // specify arguments as file contents query(_VALIDATE_XSD_INFO.args(_FILE_READ_TEXT.args(FILE), _FILE_READ_TEXT.args(XSD)), ""); // specify main-memory fragments as arguments query( "let $doc := " + "let $schema := " + " " + " " + "return validate:xsd-info($doc, $schema)", ""); // returned error query(EXISTS.args(_VALIDATE_XSD_INFO.args(FILE)), "true"); query(EXISTS.args( "let $doc := " + "let $schema := " + " " + " " + "return validate:xsd-info($doc, $schema)"), "true"); // invalid arguments error(_VALIDATE_XSD_INFO.args("unknown"), Err.WHICHRES); error(_VALIDATE_XSD_INFO.args(FILE, "unknown.xsd"), Err.WHICHRES); } /** Test method. */ @Test public void dtd() { // specify arguments as file paths query(_VALIDATE_DTD.args(FILE, DTD), ""); // specify document as document nodes query(_VALIDATE_DTD.args(DOC.args(FILE), DTD), ""); // specify arguments as file contents query(_VALIDATE_DTD.args(_FILE_READ_TEXT.args(FILE), _FILE_READ_TEXT.args(DTD)), ""); // specify main-memory fragments as arguments query( "let $doc := " + "let $dtd := '' " + "return validate:dtd($doc, $dtd) ", ""); // invalid arguments error(_VALIDATE_DTD.args("unknown"), Err.WHICHRES); error(_VALIDATE_DTD.args(FILE, "unknown.dtd"), Err.WHICHRES); error(_VALIDATE_DTD.args(FILE), Err.BXVA_FAIL); error( "let $doc := " + "let $dtd := '' " + "return validate:dtd($doc, $dtd) ", Err.BXVA_FAIL); } /** Test method. */ @Test public void dtdInfo() { // specify arguments as file paths query(_VALIDATE_DTD_INFO.args(FILE, DTD), ""); // specify document as document nodes query(_VALIDATE_DTD_INFO.args(DOC.args(FILE), DTD), ""); // specify arguments as file contents query(_VALIDATE_DTD_INFO.args(_FILE_READ_TEXT.args(FILE), _FILE_READ_TEXT.args(DTD)), ""); // specify main-memory fragments as arguments query( "let $doc := " + "let $dtd := '' " + "return validate:dtd($doc, $dtd) ", ""); // returned error query(EXISTS.args(_VALIDATE_DTD_INFO.args(FILE)), "true"); query(EXISTS.args( "let $doc := " + "let $dtd := '' " + "return validate:dtd($doc, $dtd) "), "true"); // invalid arguments error(_VALIDATE_DTD_INFO.args("unknown"), Err.WHICHRES); error(_VALIDATE_DTD_INFO.args(FILE, "unknown.dtd"), Err.WHICHRES); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNXQueryTest.java000066400000000000000000000037241222453003200275030ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import org.basex.query.util.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the XQuery Module. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNXQueryTest extends AdvancedQueryTest { /** Test method. */ @Test public void eval() { query(_XQUERY_EVAL.args("1"), 1); query(_XQUERY_EVAL.args("1 + 2"), 3); query(_XQUERY_EVAL.args("\"$a\"", " { '$a' : 'b' }"), "b"); query(_XQUERY_EVAL.args("\"$a\"", " { 'a' : 'b' }"), "b"); query(_XQUERY_EVAL.args("\"$a\"", " { 'a' : (1,2) }"), "1 2"); query(_XQUERY_EVAL.args("\"declare variable $local:a external;$local:a\"", " { xs:QName('local:a') : 1 }"), "1"); query(_XQUERY_EVAL.args(".", " { '' : 1 }"), "1"); error(_XQUERY_EVAL.args("1+"), Err.CALCEXPR); error("declare variable $a:=1;" + _XQUERY_EVAL.args("\"$a\""), Err.VARUNDEF); error("for $a in (1,2) return " + _XQUERY_EVAL.args("\"$a\""), Err.VARUNDEF); // check updating expressions error(_XQUERY_EVAL.args("delete node ()"), Err.BXXQ_UPDATING); error(_XQUERY_EVAL.args("declare %updating function local:x() {()}; local:x()"), Err.BXXQ_UPDATING); query(_XQUERY_EVAL.args("declare %updating function local:x() {()}; 1")); } /** Test method. */ @Test public void invoke() { query(_XQUERY_INVOKE.args("src/test/resources/input.xq"), "XML"); error(_XQUERY_INVOKE.args("src/test/resources/xxx.xq"), Err.WHICHRES); } /** Test method. */ @Test public void type() { try { System.setErr(NULL); query(_XQUERY_TYPE.args("()"), ""); query(_XQUERY_TYPE.args("1"), "1"); query(_XQUERY_TYPE.args("(1, 2, 3)"), "1 2 3"); query(_XQUERY_TYPE.args("/@*/data()"), "1 2 3"); } finally { System.setErr(ERR); } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNXsltTest.java000066400000000000000000000041531222453003200271750ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import static org.junit.Assert.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the XSLT Module. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNXsltTest extends AdvancedQueryTest { /** Test method. */ @Test public void processor() { assertFalse(query(_XSLT_PROCESSOR.args()).isEmpty()); } /** Test method. */ @Test public void version() { assertFalse(query(_XSLT_VERSION.args()).isEmpty()); } /** Test method. */ @Test public void transform() { final String doc = ""; String style = wrap(""); query(_XSLT_TRANSFORM.args(doc, style), ""); query(_XSLT_TRANSFORM.args(doc, '"' + style + '"'), ""); style = wrap("" + ""); final String param = "1"; query(_XSLT_TRANSFORM.args(doc, style, param), "1"); } /** Test method. */ @Test public void transformText() { final String doc = ""; String style = wrap("" + "1"); query(_XSLT_TRANSFORM_TEXT.args(doc, style), "1"); query(_XSLT_TRANSFORM_TEXT.args(doc, '"' + style + '"'), "1"); style = wrap("" + ""); final String param = "1"; query(_XSLT_TRANSFORM_TEXT.args(doc, style, param), "1"); } /** * Wraps the specified string with an XSLT header and footer. * @param content content string * @return wrapped string */ private static String wrap(final String content) { return "" + content + ""; } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FNZipTest.java000066400000000000000000000157221222453003200270110ustar00rootroot00000000000000package org.basex.test.query.func; import static org.basex.query.func.Function.*; import static org.basex.util.Token.*; import static org.junit.Assert.*; import java.io.*; import java.util.zip.*; import org.basex.core.*; import org.basex.io.*; import org.basex.query.util.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the functions of the ZIP Module. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FNZipTest extends AdvancedQueryTest { /** Test ZIP file. */ private static final String ZIP = "src/test/resources/xml.zip"; /** Temporary ZIP file. */ private static final String TMPZIP = Prop.TMP + NAME + ".zip"; /** Temporary file. */ private static final String TMPFILE = Prop.TMP + NAME + ".tmp"; /** Test ZIP entry. */ private static final String ENTRY1 = "infos/stopWords"; /** Test ZIP entry. */ private static final String ENTRY2 = "test/input.xml"; /** * Initializes the test. * @throws IOException I/O exception. */ @BeforeClass public static void init() throws IOException { // create temporary file new IOFile(TMPFILE).write(token("!")); } /** Finishes the test. */ @AfterClass public static void finish() { new File(TMPZIP).delete(); new File(TMPFILE).delete(); } /** Test method. */ @Test public void binaryEntry() { query(_ZIP_BINARY_ENTRY.args(ZIP, ENTRY1)); contains("xs:hexBinary(" + _ZIP_BINARY_ENTRY.args(ZIP, ENTRY1) + ")", "610A61626F"); error(_ZIP_BINARY_ENTRY.args("abc", "xyz"), Err.ZIP_NOTFOUND); error(_ZIP_BINARY_ENTRY.args(ZIP, ""), Err.ZIP_NOTFOUND); } /** Test method. */ @Test public void textEntry() { query(_ZIP_TEXT_ENTRY.args(ZIP, ENTRY1)); query(_ZIP_TEXT_ENTRY.args(ZIP, ENTRY1, "US-ASCII")); error(_ZIP_TEXT_ENTRY.args(ZIP, ENTRY1, "xyz"), Err.ZIP_FAIL); // newlines are removed from the result.. contains(_ZIP_TEXT_ENTRY.args(ZIP, ENTRY1), "aaboutab"); } /** Test method. */ @Test public void xmlEntry() { query(_ZIP_XML_ENTRY.args(ZIP, ENTRY2)); query(_ZIP_XML_ENTRY.args(ZIP, ENTRY2) + "//title/text()", "XML"); } /** Test method. */ @Test public void entries() { query(_ZIP_ENTRIES.args(ZIP)); } /** * Test method. * @throws IOException I/O exception */ @Test public void zipFile() throws IOException { // check first file query(_ZIP_ZIP_FILE.args(params(""))); checkEntry("one", new byte[0]); // check second file query(_ZIP_ZIP_FILE.args(params("!"))); checkEntry("two", new byte[] { '!' }); // check third file query(_ZIP_ZIP_FILE.args( params("!"))); checkEntry("three", new byte[] { '\0', '!' }); // check fourth file query(_ZIP_ZIP_FILE.args(params(""))); checkEntry("four", new byte[] { '!' }); // check fifth file query(_ZIP_ZIP_FILE.args(params(""))); checkEntry(NAME + ".tmp", new byte[] { '!' }); // check sixth file query(_ZIP_ZIP_FILE.args(params(""))); checkEntry("a/b", new byte[] { '!' }); // error: duplicate entry specified error(_ZIP_ZIP_FILE.args(params("" + "")), Err.ZIP_FAIL); } /** * Test method. * @throws IOException I/O exception */ @Test public void zipFileNS() throws IOException { // ZIP namespace must be removed from zipped node query(_ZIP_ZIP_FILE.args(params(""))); checkEntry("1", token("")); // ZIP namespace must be removed from zipped node query(_ZIP_ZIP_FILE.args(params(""))); checkEntry("2", token("")); // ZIP namespace must be removed from zipped node and its descendants query(_ZIP_ZIP_FILE.args(params(""))); checkEntry("3", token("" + Prop.NL + " " + Prop.NL + "")); // ZIP namespace must be removed from zipped entry query(_ZIP_ZIP_FILE.args(params(""))); checkEntry("4", token("")); // ZIP namespace must be removed from zipped entry query(_ZIP_ZIP_FILE.args(paramsPrefix("5", ""))); checkEntry("5", token("")); query(_ZIP_ZIP_FILE.args(paramsPrefix("6", ""))); checkEntry("6", token("" + Prop.NL + " " + Prop.NL + "")); query(_ZIP_ZIP_FILE.args(paramsPrefix("7", ""))); checkEntry("7", token("")); query(_ZIP_ZIP_FILE.args(paramsPrefix("8", ""))); checkEntry("8", token("")); query(_ZIP_ZIP_FILE.args(paramsPrefix("9", ""))); checkEntry("9", token("")); } /** * Returns a zip archive description with ZIP prefix. * @param name file name * @param entry entry * @return parameter string * @throws IOException I/O Exception */ private static String paramsPrefix(final String name, final String entry) throws IOException { return "" + "" + entry + ""; } /** Test method. */ @Test public void updateEntries() { String list = query(_ZIP_ENTRIES.args(ZIP)); // create and compare identical zip file query(_ZIP_UPDATE_ENTRIES.args(list, TMPZIP)); final String list2 = query(_ZIP_ENTRIES.args(TMPZIP)); assertEquals(list.replaceAll(" href=\".*?\"", ""), list2.replaceAll(" href=\".*?\"", "")); // remove one directory list = list.replaceAll(".*", ""); query(_ZIP_UPDATE_ENTRIES.args(list, TMPZIP)); } /** * Returns a zip archive description. * @param arg zip arguments * @return parameter string * @throws IOException I/O Exception */ private static String params(final String arg) throws IOException { return "" + arg + ""; } /** * Checks the contents of the specified zip entry. * @param file file to be checked * @param data expected file contents * @throws IOException I/O exception */ private static void checkEntry(final String file, final byte[] data) throws IOException { ZipFile zf = null; try { zf = new ZipFile(TMPZIP); final ZipEntry ze = zf.getEntry(file); assertNotNull("File not found: " + file, ze); final byte[] dt = new IOStream(zf.getInputStream(ze)).read(); assertTrue("Wrong contents in file \"" + file + "\":" + Prop.NL + "Expected: " + string(data) + Prop.NL + "Found: " + string(dt), eq(data, dt)); } finally { if(zf != null) zf.close(); } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/FuncTest.java000066400000000000000000000022651222453003200267140ustar00rootroot00000000000000package org.basex.test.query.func; import org.basex.test.query.*; /** * XQuery functions tests. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FuncTest extends QueryTest { /** Constructor. */ static { doc = "" + "blue" + "bleu" + ""; queries = new Object[][] { { "distinct-values 2", itr(2), "count(distinct-values(//line/text()))" }, }; } /* TABLE REPRESENTATION PRE DIS SIZ ATS NS KIND CONTENT ------------------------------------------------- 0 1 11 1 +0 DOC test.xml 1 1 10 2 0 ELEM desclist 2 1 1 1 0 ATTR xml:lang="en" 3 2 4 2 0 ELEM desc 4 1 1 1 0 ATTR xml:lang="en-US" 5 2 2 1 0 ELEM line 6 1 1 1 0 TEXT A line of text. 7 6 4 2 0 ELEM desc 8 1 1 1 0 ATTR xml:lang="fr" 9 2 2 1 0 ELEM line 10 1 1 1 0 TEXT Une ligne de texte. */ } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/JavaFuncTest.java000066400000000000000000000072441222453003200275200ustar00rootroot00000000000000package org.basex.test.query.func; import org.basex.query.util.*; import org.basex.test.query.*; import org.junit.*; /** * This class tests the Java bindings. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public class JavaFuncTest extends AdvancedQueryTest { /** Tests calling some Java constructors from XQuery. */ @Test public void constr() { query("Q{java:java.lang.Integer}new('123')", 123); query("declare namespace rand='java:java.util.Random'; rand:nextInt(rand:new())"); query("declare namespace ctx='java:org.basex.core.Context'; ctx:new()"); } /** Tests calling some Java static fields from XQuery. */ @Test public void staticField() { query("Q{java:java.lang.Math}PI()", Math.PI); query("Q{java:org.basex.core.Prop}gui()"); } /** Tests calling some Java object fields from XQuery. */ @Test public void field() { query("declare namespace point='java:java.awt.Point'; point:x(point:new())", 0); } /** Tests calling some Java static methods from XQuery. */ @Test public void staticMethod() { query("Q{java.lang.Math}sqrt(xs:double(9.0))", 3); } /** Tests calling some Java static methods from XQuery. */ @Test public void method() { query("declare namespace rect = 'java.awt.Rectangle';" + "rect:contains(rect:new(xs:int(2), xs:int(2)), xs:int(1), xs:int(1))", true); query("declare namespace p = 'java.util.Properties'; p:new()", "{}"); } /** Tests importing a Java class. */ @Test public void importClass() { query("import module namespace set='java.util.HashSet';" + "let $a := (set:add('a'), set:add('b')) return set:size()", "2"); // use class with capital and lower case query("import module namespace string='http://lang.java/String';" + "string:length()", "0"); query("import module namespace string='http://lang.java/string';" + "string:length()", "0"); // address class extending QueryModule query("import module namespace qm='java:org.basex.test.query.func.QueryModuleTest';" + "qm:fast(0)", "Apple"); query("import module namespace qm='java:org.basex.test.query.func.QueryModuleTest';" + "qm:convenient(xs:int(1))", "Banana"); query("import module namespace qm='java:org.basex.test.query.func.QueryModuleTest';" + "qm:functionNS()", "http://www.w3.org/2005/xpath-functions"); } /** Tests importing a Java class and throwing errors. */ @Test public void importError() { query("declare namespace qm='java:org.basex.test.query.func.QueryModuleTest';" + "try{qm:error(qm:new())} catch * {local-name-from-QName($err:code)}", "BASX0000"); query("import module namespace qm='java:org.basex.test.query.func.QueryModuleTest';" + "try { qm:error() } catch * { local-name-from-QName($err:code) }", "BASX0000"); } /** Tests ambiguous function signatures. */ @Test public void ambiguousSignature() { error("import module namespace n='java:java.lang.StringBuilder'; n:append('x')", Err.JAVAAMBIG); } /** Ensure that items cannot be cast to Java. */ @Test public void javaCast() { error("xs:java('x')", Err.FUNCUNKNOWN); error("java('x')", Err.FUNCUNKNOWN); error("'x' cast as xs:java", Err.TYPEUNKNOWN30); error("'x' cast as java", Err.TYPEUNKNOWN30); } /** Pass on Java items to functions. */ @Test public void funcItem() { query("function($x) { $x }(Q{java:java.io.File}new('x'))", "x"); query("declare function db:f($x) { $x }; db:f#1(Q{java:java.io.File}new('x'))", "x"); } /** Atomizing Java items. */ @Test public void data() { query("data(Q{java:java.lang.Object}new()) instance of xs:anyAtomicType", "true"); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/QueryModuleTest.java000066400000000000000000000031711222453003200302710ustar00rootroot00000000000000package org.basex.test.query.func; import org.basex.query.*; import org.basex.query.value.item.*; /** * This is a simple XQuery demo module written in Java. * It is derived from the abstract {@link QueryModule} class. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class QueryModuleTest extends QueryModule { /** Fruits array. */ private static final String[] FRUITS = { "Apple", "Banana", "Cherry" }; /** * Returns the specified fruit modulo number of fruits. * This variant is more convenient, as it uses Java's standard data types. * * @param fruit index of fruit to be returned * @return fruit string */ @Requires(Permission.NONE) @Deterministic public String convenient(final int fruit) { final int i = fruit; return FRUITS[i % FRUITS.length]; } /** * Returns the specified fruit modulo number of fruits. * This variant is faster, as it uses the internal data types of BaseX. * * @param fruit index of fruit to be returned * @return fruit string */ @Requires(Permission.NONE) @Deterministic public Str fast(final Int fruit) { final int i = (int) fruit.itr(); final String f = FRUITS[i % FRUITS.length]; return Str.get(f); } /** * Returns the default function namespace. * @return default function namespace */ @Requires(Permission.NONE) @ContextDependent public Str functionNS() { return Str.get(context.sc.funcNS); } /** * Throws an error. * @throws QueryException query exception */ public void error() throws QueryException { throw new QueryException("Stopped with an error."); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/func/SignatureTest.java000066400000000000000000000044211222453003200277560ustar00rootroot00000000000000package org.basex.test.query.func; import org.basex.core.cmd.*; import org.basex.io.*; import org.basex.query.func.*; import org.basex.query.util.*; import org.basex.query.value.type.*; import org.basex.test.query.*; import org.junit.*; /** * Tests all function signatures. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class SignatureTest extends AdvancedQueryTest { /** * Tests the validity of all function signatures. * @throws Exception exception */ @Test public void signatures() throws Exception { context.openDB(CreateDB.mainMem(new IOContent(""), context)); context.data().meta.name = "X"; for(final Function f : Function.values()) check(f); } /** * Checks if the specified function correctly handles its argument types, * and returns the function name. * @param def function definition * types are supported. */ protected static void check(final Function def) { final String desc = def.toString(); final String name = desc.replaceAll("\\(.*", ""); // test too few, too many, and wrong argument types for(int al = Math.max(def.min - 1, 0); al <= def.max + 1; al++) { final boolean in = al >= def.min && al <= def.max; final StringBuilder qu = new StringBuilder(name + '('); int any = 0; for(int a = 0; a < al; a++) { if(a != 0) qu.append(", "); if(in) { // test arguments if(def.args[a].type == AtomType.STR) { qu.append('1'); } else { // any type (skip test) qu.append("'X'"); if(SeqType.STR.instanceOf(def.args[a])) any++; } } else { // test wrong number of arguments qu.append("'x'"); } } // skip test if all types are arbitrary if((def.min > 0 || al != 0) && (any == 0 || any != al)) { final String query = qu.append(')').toString(); // wrong types: XPTY0004, FORG0006, FODC0002, BXDB0001, BXDB0004 if(in) error(query, Err.INVCAST, Err.NONUMBER, Err.STRNODTYPE, Err.ELMMAPTYPE, Err.BINARYTYPE, Err.STRBINTYPE, Err.WHICHRES, Err.BXDB_NODB, Err.BXDB_INDEX); // wrong number of arguments: XPST0017 else error(query, Err.FUNCARGSG, Err.FUNCARGPL); } } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/package.html000066400000000000000000000001041222453003200256320ustar00rootroot00000000000000 Contains classes for testing the query processor. basex-7.7.2/basex-core/src/test/java/org/basex/test/query/simple/000077500000000000000000000000001222453003200246475ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/java/org/basex/test/query/simple/DocTest.java000066400000000000000000000135021222453003200270600ustar00rootroot00000000000000package org.basex.test.query.simple; import org.basex.test.query.*; /** * Simple document tests. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DocTest extends QueryTest { /** Constructor. */ static { doc = "\n" + "\n" + " \n" + " \n" + " XML\n" + " \n" + " \n" + " \n" + "

    Databases & XML

    \n" + "
    \n" + " Assignments\n" + "
      \n" + "
    • Exercise 1
    • \n" + "
    • Exercise 2
    • \n" + "
    \n" + "
    \n" + " \n" + " \n" + ""; queries = new Object[][] { { "Root 1", node(0), "/" }, { "Root 2", node(0), "/." }, { "Root 3", node(1), "/*" }, { "Root 4", node(1), "/node()" }, { "Child 1", node(1), "*" }, { "Child 2", node(1), "node()" }, { "Child 3", node(2, 3, 7, 8, 24), "node()/node()" }, { "Child 4", node(17, 19), "/*/*/*/*" }, { "Child 5", node(0), "./." }, { "Child 6", node(24), "node()/node()[last()]" }, { "Child Error 1", "./" }, { "Child Error 2", "html/" }, { "Desc 1", node(20, 22), "//li" }, { "Desc 2", node(20, 22), "//ul/li" }, { "Desc 3", node(20, 22), "//ul//li" }, { "Desc 4", node(17, 19, 20, 22), "//*//*//*//*" }, { "Desc 5", node(1, 2, 3, 5, 6, 7, 8, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24), "//node()" }, { "Desc 6", node(0, 1, 2, 3, 5, 6, 7, 8, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24), ".//." }, { "Desc 7", node(20, 22), ".//li" }, { "Desc 8", node(23), "/descendant-or-self::*[last()]/text()" }, { "Desc 9", node(23), "/descendant::*[last()]/text()" }, { "Desc Error 1", "//" }, { "Desc Error 2", "///" }, { "Ancestor 1", node(0), "/*/ancestor::node()" }, { "Ancestor 2", node(0, 1), "/*/*/ancestor::node()" }, { "Pred 1", node(1), "/*[/]" }, { "Pred 2", node(1), "/*[/*]" }, { "Pred 3", node(19), "//ul[li]" }, { "Pred 4", node(19), "//ul[li = 'Exercise 1']" }, { "Pred 5", node(20), "//ul/li[text() = 'Exercise 1']" }, { "Pred 6", node(20), "/html/body/div/ul/li[text() = 'Exercise 1']" }, { "Pred 7", node(8), "//*[@* = '#FFFFFF']" }, { "Pred 8", node(8), "//*[@id = 1]" }, { "Pred 9", node(5, 17), "//*[text() = 'XML' or text()='Assignments']" }, { "Pred A", node(5, 17), "//*[text() = ('XML', 'Assignments')]" }, { "Pred B", node(5), "//title[text() = .]" }, { "Pred C", itr(1), "1[.]" }, { "PredIndex 1", node(21), "//text()[. = 'Exercise 1']" }, { "PredIndex 2", node(20), "//text()[. = 'Exercise 1']/.." }, { "PredIndex 3", str("1"), "//@*[. = '1']/string()" }, { "PredIndex 4", str("1"), "//@id[. = '1']/string()" }, { "PredIndex 5", node(8), "//@id[. = '1']/.." }, { "PredIndex 6", str("#000000"), "//@*[. = '#000000']/string()" }, { "PredIndex 7", empty(), "//@id[. = '#000000']" }, { "Pred Error 1", "/[/]" }, { "Pred Error 2", "/*[]" }, { "Pred Error 3", "/*[//]" }, { "Pred Error 4", "/*[li" }, { "PosPred 1", node(20), "//li[1]" }, { "PosPred 2", node(20), "//li[position() = 1]" }, { "PosPred 3", node(22), "//li[2]" }, { "PosPred 4", node(22), "//li[2][1]" }, { "PosPred 5", empty(), "//li[2][2]" }, { "PosPred 6", node(8, 15, 19, 22), "//*[.[1]][2]" }, { "PosPred 7", node(1, 3, 5, 13, 17, 20), "//*[.[1]][1]" }, { "PosPred 8", empty(), "//*[1.1]" }, { "PosPred 9", node(8, 15, 19, 22), "//*[position() > 1.1]" }, { "PosPred A", empty(), "//*[position() <= 0.9]" }, { "PosPred B", str("XML"), "(('XML')[1])[1]" }, { "PosPred C", itr(1), "1[position() = 1 to 2]" }, { "PosPred D", empty(), "//li[last()][contains(text(), '1')]" }, { "PosPred D", node(22), "//li[last()][contains(text(), '2')]" }, { "Prec 1", node(3, 5), "//body/preceding::*" }, { "Prec 2", node(3, 5), "//@id/preceding::*" }, { "Union 1", node(0), ".|." }, { "Union 2", node(0), ". | ." }, { "Union 3", node(1), "*|*" }, { "Index 1", node(20), "//li[text() = 'Exercise 1']" }, { "Index 2", node(21), "//li[text() = 'Exercise 1']/text()" }, { "Index 3", node(5), "for $a in //title where $a = 'XML' return $a" }, { "Index 4", node(5), "for $a in //* where $a/text() = 'XML' return $a" }, { "Index 5", node(3, 5), "for $a in //* where $a = 'XML' return $a" }, { "Index 6", node(5), "//*[text() = 'XML' and text()]" }, { "Index 7", empty(), "//*[text() = 'XM' and text()]" }, { "Index 8", node(5), "//title[text() = 'XML' or text()]" }, { "Index 9", node(5), "//title[text() = 'XM' or text()]" }, { "RangeIndex 1", node(8), "//*[@id = 1]" }, { "RangeIndex 2", node(3, 8), "//*[@id >= 0 and @id <= 1]" }, { "RangeIndex 3", str("1"), "//@id[. = 1]/string()" }, }; } /* TABLE REPRESENTATION PRE PAR TYPE CONTENT 0 -1 DOC test.xml 1 0 ELEM html 2 1 COMM Header 3 1 ELEM head 4 3 ATTR id="0" 5 3 ELEM title 6 5 TEXT XML 7 1 COMM Body 8 1 ELEM body 9 8 ATTR id="1" 10 8 ATTR bgcolor="#FFFFFF" 11 8 ATTR text="#000000" 12 8 ATTR link="#0000CC" 13 8 ELEM h1 14 13 TEXT Databases & XML 15 8 ELEM div 16 15 ATTR align="right" 17 15 ELEM b 18 17 TEXT Assignments 19 15 ELEM ul 20 19 ELEM li 21 20 TEXT Exercise 1 22 19 ELEM li 23 22 TEXT Exercise 2 24 1 PI pi bogus */ } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/simple/FTTest.java000066400000000000000000000640531222453003200266730ustar00rootroot00000000000000package org.basex.test.query.simple; import org.basex.core.*; import org.basex.test.query.*; import org.junit.*; /** * Full-text test queries. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class FTTest extends QueryTest { /** Test all flag. */ private static final boolean ALL = true; /** Test document. */ public static final String DOC = "\n" + " \n" + " xml in the first sentence. second sentence. " + "third sentence. fourth sentence. fifth sentence.\n" + " XML xml XmL\n" + " we have xml databases\n" + " XML DATABASES\n" + " XML & Databases\n" + " \n" + " \n" + " hello\n" + " \n" + " \n" + " di\u00e4t-joghurt\n" + " diat-joghurt\n" + " \n" + " Bad one\n" + " adfas wordt. ook wel eens" + " wordt ook wel een s" + " adfad. wordt\nook wel.eens a" + " adfad wordt. ook\nwel een s adf" + " adfad wordt ook. wel een s" + " " + " the fifth sentence. fourth sentence. " + "third sentence. second sentence. first sentence.\n" + " \n" + " yeah\n" + " AB\n" + " BA\n" + ""; /** Test queries. */ public static final Object[][] QUERIES = new Object[][] { { "Simple 1", bool(true), "'a' contains text 'a'" }, { "Simple 2", bool(true), "'a b' contains text 'b'" }, { "Simple 3", bool(false), "'abc' contains text 'b'" }, { "Simple 4", node(22), "//b['true' contains text 'true']" }, { "Simple 5", bool(true), "//@key contains text 'value'" }, { "Simple 6", str("value"), "//@key[. contains text 'value']/string()" }, { "Simple 7", bool(false), "//@key contains text 'values'" }, { "Simple 8", bool(true), "number('100') + 23 contains text '123'" }, { "Simple 9", bool(true), "true() contains text 'true'" }, { "Simple 10", bool(true), "false() contains text 'false'" }, { "Simple 11", bool(false), "'text' contains text ''" }, { "FT 1", node(14), "//w[text() contains text 'HELLO']" }, { "FT 2", node(14), "//w[text() <- 'hello']" }, { "FT 3", node(14), "//w[text() <- ' hello!... ']" }, { "FT 4", empty(), "//w[ text ( ) <- ' crap ' ] " }, { "FT 5", empty(), "//w[text() <- 'db']" }, { "FT 6", node(42, 46), "//mix[text() <- 'A']" }, { "FT 7", node(14), "//w[text() <- 'hello']['A' <- 'A']" }, { "FT 8", node(14), "//w[text() <- 'hello']['X' <- 'X' using fuzzy]" }, { "FT 9", node(14), "//w[text() = 'hello' and 'X' <- 'X']" }, { "FT 10", node(14), "//w[text() = 'hello' and text() <- 'hello']" }, { "FT 11", empty(), "//wld[text() <- '']" }, { "FT 12", empty(), "//wld[text() <- ' ']" }, { "FT 13", node(40), "//*[text() <- 'yeah']" }, { "Preds 1", node(7, 9, 11), "//w[text() <- 'xml'][text() <- 'Databases']" }, { "Preds 2", node(35), "//fttest[co/w <- 'xml'][w <- 'fifth']/atr" }, { "Preds 3", node(1), "//fttest[*/text() <- 'ook']" + "[*/text() <- 'een']" }, { "Preds 4", node(1), "*[*/text() <- 'ook'][*/text() <- 'een']" }, { "Preds 5", node(7), "//*[text() <- 'have'][text() <- 'xml']" }, { "Preds 6", node(13), "//*[*/text() <- 'hello'][*/text() = 'hello']" }, { "Preds 7", node(7), "//w[text()[. <- 'have xml'] <- 'Databases']" }, { "Preds 8", node(5), "/descendant::w[text() <- 'xml'][2]" }, { "Preds 9", node(3), "//w[text() <- 'xml'][1]" }, { "Preds 10", node(5), "//w[text() <- 'xml'][2]" }, { "Preds 11", node(14), "//wc/w[text() <- 'hello']" }, { "Preds 12", node(46), "//mix[text()[1] <- 'B']" }, { "AndOr 1", node(7, 9, 11), "//w[text() <- 'xml' and text() <- 'databases']" }, { "AndOr 2", node(2), "//*[*/text() <- 'have' and */text() <- 'first']" }, { "AndOr 3", node(25, 29), "//fti[text() <- 'eens' or text() <- 'a']" }, { "AndOr 4", node(25, 29), "//fti[text() <- 'eens' and text() <- 'ook' or text() <- 'a']" }, { "AndOr 5", node(31), "//fti[text() <- 'adf s' or text() <- 's adf']" }, { "AndOr 6", node(31), "//fti[contains(text(), 'adf') and text() <- 'adf']" }, { "AndOr 7", node(3), "//*[text() <- 'sentence' and text() <- 'xml']" }, { "AndOr 8", node(42, 46), "//mix[text() <- 'A'][text() <- 'B']" }, { "Phrase 1", node(7, 9, 11), "//w [text() <- 'xml databases']" }, { "Phrase 2", node(7, 9, 11), "//w [text() <- 'xml & databases']" }, { "Phrase 3", node(7, 9, 11), "//w [text() <- 'xml :) databases :|']" }, { "Phrase 4", empty(), "//w [text() <- 'xml db']" }, { "Phrase 5", node(25, 29), "/fttest/fti[text() <- 'wordt ook wel eens']" }, { "FTDiacritics 1", node(17, 19), "//s [text() <- 'diat']" }, { "FTDiacritics 2", node(17, 19), "//s [text() <- 'di\u00e4t joghurt' using diacritics " + "insensitive]" }, { "FTDiacritics 3", node(17), "//s [text() <- 'di\u00e4t joghurt' " + "using diacritics sensitive]" }, { "FTCaseOption 1", node(3, 5, 7, 9, 11), "/fttest/co/w [text() <- 'xml']" }, { "FTCaseOption 2", node(3, 5, 7, 9, 11), "/fttest/co/w [text() <- 'xml' using case insensitive]" }, { "FTCaseOption 3", node(11), "/fttest/co/w [text() <- 'XML Databases' " + "using case sensitive]" }, { "FTCaseOption 4", node(9), "/fttest/co/w [text() <- 'xml databases' using uppercase]" }, { "FTCaseOption 5", node(3, 5, 7), "/fttest/co/w [text() <- 'XML' using lowercase]" }, { "FTCaseOption 6", node(5, 9, 11), "/fttest/co/w [text() <- 'xml' using uppercase]" }, { "FTCaseOption 7", node(7), "/fttest/co/w [text() <- 'XML DATABASES' using lowercase]" }, { "FTWildCard 1", node(14), "/fttest/wc/w [text() <- '.ello' using wildcards]" }, { "FTWildCard 2", node(14), "/fttest/wc/w [text() <- 'hell.' using wildcards]" }, { "FTWildCard 3", node(14), "/fttest/wc/w [text() <- '.+llo' using wildcards]" }, { "FTWildCard 4", node(14), "/fttest/wc/w [text() <- 'hell.+' using wildcards]" }, { "FTWildCard 5", node(14), "/fttest/wc/w [text() <- '.*llo' using wildcards]" }, { "FTWildCard 6", node(14), "/fttest/wc/w [text() <- 'hel.*' using wildcards]" }, { "FTWildCard 7", node(14), "/fttest/wc/w [text() <- '.*' using wildcards]" }, { "FTWildCard 8", node(14), "/fttest/wc/w [text() <- '.+' using wildcards]" }, { "FTWildCard 9", node(5, 9, 11), "/fttest/co/w [text() <- 'X.+' " + "using wildcards using case sensitive]" }, { "FTWildCard 10", node(5, 9, 11), "/fttest/co/w [text() <- 'x.+' using wildcards " + "using uppercase]" }, { "FTWildCard 11", node(40), "/fttest/wld [text() <- '.*' using wildcards]" }, { "FTWildCard 12", node(40), "/fttest/wld [text() <- '.+' using wildcards]" }, { "FTWildCard 13", node(14), "//w [text() <- 'he.{1,2}o' using wildcards]" }, { "FTWildCard 14", node(14), "//w [text() <- 'h.+ll.+' using wildcards]" }, { "FTWildCard 15", node(14), "//w [text() <- 'h.\\llo' using wildcards]" }, { "FTWildCard 16", bool(false), "'a' <- 'a.+' using wildcards" }, { "FTWildCard 17", bool(true), "'aa' <- 'a.+' using wildcards" }, { "FTWildCard 18", bool(true), "'aaaa' <- 'a.+' using wildcards" }, { "FTWildCard 19", bool(true), "'a' <- 'a.*' using wildcards" }, { "FTWildCard 20", bool(true), "'aaaaaa' <- 'a.*' using wildcards" }, { "FTWildCard 21", bool(false), "'a' <- 'a.' using wildcards" }, { "FTWildCard 22", bool(true), "'aa' <- 'a.' using wildcards" }, { "FTWildCard 23", bool(true), "'a' <- 'a.{0,1}' using wildcards" }, { "FTWildCard 24", bool(true), "'aa' <- 'a.{0,1}' using wildcards" }, // parsing tests: should throw exception { "FTWildCard 25", "'aa' <- 'a.{0, 1}' using wildcards" }, { "FTWildCard 26", "'a' <- 'a.{-1,1}' using wildcards" }, { "FTWildCard 27", "'a' <- 'a.{1}' using wildcards" }, { "FTWildCard 28", "'a' <- 'a.{1-5}' using wildcards" }, { "FTWildCard 29", bool(true), "'hi' <- '\\h\\i' using wildcards" }, // #660: combination of FTAnyAllOption and wildcards { "FTWildCard 30", bool(true), "'a' contains text '.*' all words using wildcards" }, { "FTFuzzy 1", node(7, 9, 11), "//* [text() <- 'Database' using fuzzy]" }, { "FTFuzzy 2", node(7, 9, 11), "//* [text() <- 'Databaze' using fuzzy]" }, { "FTFuzzy 3", empty(), "//* [text() <- 'Databasing' using fuzzy]" }, { "FTAnyAllOption 1", node(3, 5, 7, 9, 11), "/fttest/co/w [text() <- 'xml' any]" }, { "FTAnyAllOption 2", node(3, 5, 7, 9, 11), "/fttest/co/w [text() <- 'xml' all]" }, { "FTAnyAllOption 3", node(3, 5, 7, 9, 11), "/fttest/co/w [text() <- 'xml' any word]" }, { "FTAnyAllOption 4", node(3, 5, 7, 9, 11), "/fttest/co/w [text() <- 'xml' all words]" }, { "FTAnyAllOption 5", node(3, 5, 7, 9, 11), "/fttest/co/w [text() <- 'xml' phrase]" }, { "FTAnyAllOption 6", bool(false), "'text' <- { '' } any" }, { "FTAnyAllOption 7", bool(false), "'text' <- { '' } all" }, { "FTAnyAllOption 8", bool(false), "'text' <- { '' } all words" }, { "FTAnyAllOption 9", bool(false), "'text' <- { '' } any word" }, { "FTAnyAllOption 10", bool(false), "'text' <- { '' } phrase" }, { "FTAnyAllOption 11", bool(true), "'red balloon' <- { 'red', '', 'balloon' } any" }, { "FTAnyAllOption 12", bool(false), "'red balloon' <- { 'red', '', 'balloon' } all" }, { "FTAnyAllOption 13", bool(true), "'red balloon' <- { 'red', '', 'balloon' } all words" }, { "FTAnyAllOption 14", bool(true), "'red balloon' <- { 'red', '', 'balloon' } any word" }, { "FTAnyAllOption 15", bool(true), "'red balloon' <- { 'red', '', 'balloon' } phrase" }, { "FTTimes 1", node(7, 9, 11), "//w [text() <- 'DaTaBaSeS' occurs exactly 1 times]" }, { "FTTimes 2", node(5), "//w [text() <- 'XmL' occurs exactly 3 times]" }, { "FTTimes 3", node(14, 37), "//w [text() <- 'xml' occurs exactly 0 times]" }, { "FTTimes 4", node(5), "//w [text() <- 'xml' occurs at least 3 times]" }, { "FTTimes 5", node(3, 7, 9, 11, 14, 37), "//w [text() <- 'XmL' occurs at most 2 times]" }, { "FTTimes 6", node(3, 7, 9, 11, 14, 37), "//w [text() <- 'XmL' occurs from 0 to 1 times]" }, { "FTTimes 7", node(5), "//w [text() <- 'xml xml' occurs at least 2 times]" }, { "FTTimes 8", empty(), "//w [text() <- 'xml xml' occurs at least 4 times]" }, { "FTAnyAllTimes 1", bool(true), "'a a a' <- 'a a' occurs exactly 2 times" }, { "FTAnyAllTimes 2", bool(true), "'a a a' <- 'a a' any occurs exactly 2 times" }, { "FTAnyAllTimes 3", bool(true), "'a a a' <- 'a a' any word occurs exactly 3 times" }, { "FTAnyAllTimes 4", bool(true), "'a a a' <- 'a a' all occurs exactly 2 times" }, { "FTAnyAllTimes 5", bool(true), "'a a a' <- 'a a' all words occurs exactly 3 times" }, { "FTAnyAllTimes 6", bool(true), "'a a a' <- 'a a' phrase occurs exactly 2 times" }, { "FTAnyAllTimes 7", bool(true), "'a b c' <- '.' occurs exactly 3 times using wildcards" }, { "FTAnyAllTimes 8", bool(true), "'a b c' <- '. .' occurs exactly 2 times using wildcards" }, { "FTAndOr 1", node(7, 9, 11), "//w [text() <- 'XmL' ftand 'Databases']" }, { "FTAndOr 2", node(7, 9, 11, 14), "//w [text() <- 'databases' ftor 'hello']" }, { "FTAndOr 3", node(14), "//w [text() <- 'HELLO' ftand 'hello']" }, { "FTAndOr 4", node(7, 9, 11, 14), "//w [text() <- 'xml' ftand 'databases' ftor 'hello' ]" }, { "FTAndOr 5", node(7, 9, 11), "//w [text() <- 'databases' ftand ('xml' ftor 'hello')]" }, { "FTAndOr 6", node(31, 33), "//fti [text() <- 'adfad' ftand 'wordt' ftand 'ook' " + "ftand 'wel' ftand 'een' ftand 's']" }, { "FTAndOr 7", empty(), "//* [text() <- 'databases' ftand 'db']" }, { "FTAndOr 8", node(14), "//* [text() <- 'hola' ftor 'hello']" }, { "FTAndOr 9", empty(), "//* [text() <- 'hola' ftand 'hello']" }, { "FTAndOr 10", node(14), "//w [text() <- 'HELLO' ftand ('hello' using stemming)]" }, { "FTAndOr 11", node(14), "//w [text() <- 'HELLO' ftand ('hello') using stemming]" }, { "FTStemming 1", node(7, 9, 11), "//w [text() <- 'xml database' using stemming]" }, { "FTStemming 2", empty(), "//w [text() <- 'xml database' using no stemming]" }, { "FTStemming 3", node(7, 9, 11), "//w [text() <- 'xml' ftand 'databasing' using stemming " + "using language 'en']" }, { "FTStemming 4", node(7, 9, 11, 14), "//w [text() <- 'hello' ftor 'database' using stemming]" }, { "FTStemming 5", node(3, 5, 14, 37), "//w [text() <- ftnot 'database' using stemming]" }, { "FTStemming 6", bool(true), "'base' <- 'bases' using stemming" }, { "FTStemming 7", bool(true), "'bases' <- ('base') using stemming" }, { "FTStemming 8", bool(true), "'base' <- ('bases') using stemming" }, { "FTStemming 9", bool(true), "'base' <- ('bases' using stemming) using no stemming" }, { "FTStemming 10", bool(true), "'\u043a\u043d\u0438\u0433\u0430' <- '\u043a\u043d\u0438\u0433\u0438'" + " using stemming using language 'Russian'" }, { "FTStemming 11", bool(true), "'de' <- 'de' using stemming using language 'pt'" }, { "FTLanguage 1", node(14), "//* [text() <- 'hello' using language 'en']" }, { "FTLanguage 2", node(14), "//* [text() <- 'hello' using language 'de']" }, { "FTLanguage 3", // error "//* [text() <- 'hello' using language 'jp']" }, { "FTStopWords 1", node(7, 9, 11), "//* [text() <- " + "'and databases' using stop words ('xml', 'and')]" }, { "FTStopWords 2", node(7), "//* [text() <- 'we use xml' using stop words ('use')]" }, { "FTAtomization 1", node(21), "//at [. <- 'bad one']" }, { "FTAtomization 2", node(35), "//atr [@key <- 'value']" }, { "FTOrdered 1", node(7, 9, 11), "//w [. <- 'databases' ordered]" }, { "FTOrdered 2", node(7, 9, 11), "//w [. <- 'xml' ftand 'databases' ordered]" }, { "FTOrdered 3", empty(), "//w [. <- 'databases' ftand 'xml' ordered]" }, { "FTOrdered 4", bool(true), "'A B' <- ('A' ftand 'B' ordered)" }, { "FTOrdered 5", bool(true), "'A B' <- ('A' ftand 'B') ftor ('C' ftand 'D') ordered" }, { "FTOrdered 6", bool(true), "'C D' <- ('A' ftand 'B') ftor ('C' ftand 'D') ordered" }, { "FTOrdered 7", bool(true), "'A B C D' <- ('B' ftand 'A' ordered) ftor " + "('C' ftand 'D' ordered) ordered" }, { "FTOrdered 8", bool(false), "'B A' <- ('A' ftand ftnot 'B') ordered" }, { "FTOrdered 9", bool(true), "'A B' <- 'B' ftor 'A' ordered" }, { "FTOrdered 10", bool(true), "'A B' <- ('B' ftor 'A') ordered" }, { "FTOrdered 11", bool(true), "'A B C' <- ('A' ftor 'C') ftand 'B' ordered" }, { "FTDistance 1", node(3), "//w [text() <- 'the' ftand 'fourth' " + "distance exactly 2 sentences]" }, { "FTDistance 2", node(3, 37), "//w [. <- 'first' ftand 'second' ftand 'third' " + "distance exactly 1 words]" }, { "FTDistance 3", node(3, 37), "//w [. <- 'first sentence' ftand 'third sentence' " + "distance exactly 2 words]" }, { "FTDistance 4", node(3), "//w [. <- 'the first sentence' ftand 'third sentence' " + "distance exactly 2 words]" }, { "FTDistance 5", node(3, 37), "//w [. <- 'sentence' ftand 'the' " + "distance exactly 1 words]" }, { "FTDistance 6", node(3, 37), "//w [. <- ('second' ftand 'third' window 3 words) " + "ftand 'sentence' distance exactly 0 words]" }, { "FTDistance 7", node(3, 37), "//w [text() <- ('second' ftand 'third' window 3 words) " + "ftand 'sentence' distance exactly 0 words ordered]" }, { "FTDistance 8", node(37), "//w [. <- 'third' ftand 'second' " + " ftand 'first' distance exactly 1 words ordered]" }, { "FTDistance 9", node(3), "//w [. <- 'first' ftand 'second' " + " ftand 'third' distance exactly 1 words ordered]" }, { "FTDistance 10", bool(true), "'a b' <- 'a' ftand ('b') distance exactly 0 words" }, { "FTDistance 11", bool(true), "'a b' <- ('a') ftand ('b') entire content" }, { "FTWindow 1", node(3, 37), "//w [. <- 'second' ftand 'fifth' window 7 words]" }, { "FTWindow 2", node(3, 37), "//w [. <- 'second sentence' ftand 'fifth sentence' " + "window 8 words]" }, { "FTWindow 3", node(3, 37), "//w [. <- 'third' ftand 'second' " + "ftand 'fifth' window 7 words]" }, { "FTWindow 4", node(37), "//w [. <- 'fifth' ftand 'third' " + "ftand 'second' ordered window 7 words]" }, { "FTWindow 5", node(37), "//w [. <- 'fifth' ftand 'third' " + "ftand 'second' window 7 words ordered]" }, { "FTScope 1", node(25, 27, 29, 31, 33), "//fti [. <- 'wordt ook' same sentence]" }, { "FTScope 2", node(27, 29, 33), "//fti [text() <- 'wordt' ftand 'ook' same sentence]" }, { "FTScope 3", node(25, 31), "//fti [. <- 'wordt' ftand 'ook' different sentence]" }, { "FTScope 4", node(25, 27, 29, 33), "//fti [. <- 'ook' ftand 'wel' same paragraph]" }, { "FTScope 5", node(31), "//fti [. <- 'ook' ftand 'wel' different paragraph]" }, { "FTScope 6", bool(true), "'a. a b' <- ('a' ftand 'b') different sentence" }, { "FTContent 1", node(3, 5, 9, 11), "//w [text() <- 'xml' at start]" }, { "FTContent 2", empty(), "//w [. <- 'databases' at start]" }, { "FTContent 3", node(9, 11), "//w [. <- 'xml databases' at start]" }, { "FTContent 4", node(9, 11), "//w [. <- 'xml' ftand 'databases' ordered at start]" }, { "FTContent 5", node(7, 9, 11), "//w [. <- 'databases' at end]" }, { "FTContent 6", node(7, 9, 11), "//w [. <- 'xml databases' at end]" }, { "FTContent 7", node(7, 9, 11), "//w [. <- 'xml' ftand 'databases' at end]" }, { "FTContent 8", empty(), "//w [. <- 'have xml' at end]" }, { "FTContent 9", node(14), "//w [text() <- 'hello' entire content]" }, { "FTContent 10", node(9, 11), "//w [. <- 'xml databases' entire content]" }, { "FTContent 11", bool(true), "'a b c d' <- 'a' ftand 'b' ftand 'c'" + " ftand 'd' entire content" }, { "FTContent 12", bool(true), "'a b c d' <- 'd' ftand 'c' ftand 'b'" + " ftand 'a' entire content" }, { "FTContent 13", bool(true), "'a b c d' <- 'a' ftand 'b' ftand 'c'" + " ftand 'd' entire content ordered" }, { "FTContent 14", bool(false), "'a b c d' <- 'd' ftand 'c' ftand 'b'" + " ftand 'a' entire content ordered" }, { "FTContent 15", bool(true), "'a b c d' <- 'a' ftand 'b' at start" }, { "FTContent 16", bool(true), "'a b c d' <- 'a' ftand 'b' at start ordered" }, { "FTContent 17", bool(true), "'a b c d' <- 'b' ftand 'a' at start" }, { "FTContent 18", bool(false), "'a b c d' <- 'b' ftand 'a' at start ordered" }, { "FTContent 19", bool(true), "'a b c d' <- 'c' ftand 'd' at end" }, { "FTContent 20", bool(true), "'a b c d' <- 'c' ftand 'd' at end ordered" }, { "FTContent 21", bool(true), "'a b c d' <- 'd' ftand 'c' at end" }, { "FTContent 22", bool(false), "'a b c d' <- 'd' ftand 'c' at end ordered" }, { "FTContent 23", bool(true), "'a b c' <- 'b c' ftand 'a' entire content" }, { "FTContent 24", bool(true), "'a b c' <- 'a' ftand 'b c' entire content" }, { "FTContent 25", bool(true), "'a b c' <- 'a b c' entire content" }, { "FTContent 26", bool(false), "'a b' <- 'a' entire content" }, { "FTContent 27", bool(false), "'a b' <- 'b' entire content" }, { "FTMildNot 1", node(3, 5), "//w [text() <- 'xml' not in 'xml databases']" }, { "FTMildNot 2", node(14), "//w [text() <- 'hello' not in 'xml']" }, { "FTMildNot 3", bool(false), "'a b' <- 'a' not in 'a b'" }, { "FTMildNot 4", bool(false), "'a' <- 'a' not in 'a'" }, { "FTMildNot 5", bool(true), "'a b' <- 'a b' not in 'a'" }, { "FTMildNot 6", bool(true), "'a b a' <- 'a' not in 'a b'" }, { "FTMildNot 7", bool(false), "'a b a b' <- 'a' not in 'a b'" }, { "FTMildNot 8", "'a' <- 'a' not in ftnot 'a'" }, { "FTMildNot 9", node(3, 5, 7, 9, 11), "//w [text() <- 'xml' not in 'we have']" }, { "FTUnaryNot 1", node(14, 37), "//w [text() <- ftnot 'xml']" }, { "FTUnaryNot 2", node(3, 5), "//w [text() <- 'xml' ftand ftnot 'databases']" }, { "FTUnaryNot 3", node(3, 5), "//w [text() <- ftnot 'databases' ftand 'xml']" }, { "FTUnaryNot 4", node(31), "//* [text() <- 'adf' ftand ftnot 'xml']" }, { "FTUnaryNot 5", node(3, 5, 9, 11), "//w [text() <- 'xml' ftand ftnot 'databases' " + "using case sensitive]" }, { "FTUnaryNot 6", node(7, 9, 11, 14, 37), "//w [text() <- 'databases' ftor ftnot 'xml']" }, { "FTUnaryNot 7", node(3, 5, 14, 37), "//w [text() <- 'hello' ftor ftnot 'databases']" }, { "FTUnaryNot 8", node(3, 5, 7, 9, 11, 14, 37), "//w [text() <- ftnot 'bier']" }, { "FTUnaryNot 9", node(3, 5, 7, 9, 11, 14, 37), "//w [text() <- ftnot 'bier' ftand ftnot 'wein' ]" }, { "FTUnaryNot 10", node(3, 5, 7, 9, 11, 14, 37), "//w [text() <- ftnot 'bier' ftor ftnot 'wein' ]" }, { "FTUnaryNot 11", node(14, 37), "//w [text() <- ftnot 'xml' ftand ftnot 'databeses' ]" }, { "FTUnaryNot 12", node(31), "//fti [text() <- ftnot (ftnot 'adf') ]" }, { "FTUnaryNot 13", node(31), "//fti [text() <- 'adf' ftand ftnot (ftnot 'adf')]" }, { "FTUnaryNot 14", node(31), "//fti [text() <- 'adf' ftor ftnot (ftnot 'adf')]" }, { "FTUnaryNot 15", node(25, 27, 29, 31, 33), "//fti [text() <- 'adf' ftor ftnot 'adf']" }, }; /** Constructor. */ static { doc = DOC; queries = QUERIES; } @Test @Override public void test() throws BaseXException { final Prop prop = context.prop; if(ALL) { // testing all kinds of combinations for(int a = 0; a < 2; ++a) { prop.set(Prop.FTINDEX, a == 0); super.test(); } } else { // single test //prop.set(Prop.MAINMEM, true); prop.set(Prop.FTINDEX, true); prop.set(Prop.STEMMING, true); prop.set(Prop.DIACRITICS, true); prop.set(Prop.CASESENS, true); super.test(); } } @Override protected String details() { final Prop prop = context.prop; final StringBuilder sb = new StringBuilder(); sb.append(set(Prop.FTINDEX, prop)).append(';'); sb.append(set(Prop.STEMMING, prop)).append(';'); sb.append(set(Prop.DIACRITICS, prop)).append(';'); sb.append(set(Prop.CASESENS, prop)); return sb.toString(); } /** * Returns a flag string. * @param key key * @param prop properties * @return string */ private static String set(final Object[] key, final AProp prop) { return "set " + key[0] + ' ' + prop.is(key); } /* TABLE REPRESENTATION PRE DIS SIZ ATS NS KIND CONTENT 0 1 46 1 0 DOC tmp 1 1 45 1 0 ELEM fttest 2 1 11 1 0 ELEM co 3 1 2 1 0 ELEM w 4 1 1 1 0 TEXT xml in the first sentence. second sentence. third sentence. fourth sentence. fifth sentence. 5 3 2 1 0 ELEM w 6 1 1 1 0 TEXT XML xml XmL 7 5 2 1 0 ELEM w 8 1 1 1 0 TEXT we have xml databases 9 7 2 1 0 ELEM w 10 1 1 1 0 TEXT XML DATABASES 11 9 2 1 0 ELEM w 12 1 1 1 0 TEXT XML & Databases 13 12 3 1 0 ELEM wc 14 1 2 1 0 ELEM w 15 1 1 1 0 TEXT hello 16 15 5 1 0 ELEM sc 17 1 2 1 0 ELEM s 18 1 1 1 0 TEXT di\u00e4t-joghurt 19 3 2 1 0 ELEM s 20 1 1 1 0 TEXT diat-joghurt 21 20 4 1 0 ELEM at 22 1 2 1 0 ELEM b 23 1 1 1 0 TEXT B 24 3 1 1 0 TEXT ad one 25 24 2 1 0 ELEM fti 26 1 1 1 0 TEXT adfas wordt. ook wel eens 27 26 2 1 0 ELEM fti 28 1 1 1 0 TEXT wordt ook wel een s 29 28 2 1 0 ELEM fti 30 1 1 1 0 TEXT adfad. wordt ook wel.eens a 31 30 2 1 0 ELEM fti 32 1 1 1 0 TEXT adfad wordt. ook wel een s adf 33 32 2 1 0 ELEM fti 34 1 1 1 0 TEXT adfad wordt ook. wel een s 35 34 2 2 0 ELEM atr 36 1 1 1 0 ATTR key="value" 37 36 2 1 0 ELEM w 38 1 1 1 0 TEXT the fifth sentence. fourth sentence. third sentence. second sentence. first sentence. 39 1 1 1 0 ELEM wld 40 1 2 1 0 ELEM wld 41 1 1 1 0 TEXT yeah 42 41 4 1 0 ELEM mix 43 1 1 1 0 TEXT A 44 2 1 1 0 ELEM sub 45 3 1 1 0 TEXT B */ } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/simple/NSTest.java000066400000000000000000000072361222453003200267020ustar00rootroot00000000000000package org.basex.test.query.simple; import org.basex.test.query.*; /** * Simple XQuery namespace tests. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class NSTest extends QueryTest { /** Constructor. */ static { doc = ""; queries = new Object[][] { { "NUFP 1", str("http://www.w3.org/XML/1998/namespace"), "string(namespace-uri-for-prefix('xml', ))" }, { "NUFP 2", str(""), "string(namespace-uri-for-prefix('xs', ))" }, { "NUFP 3", str("http://www.w3.org/2001/XMLSchema"), "string(namespace-uri-for-prefix('xs', ))" }, { "NUFP 4", itr(1), "count(string(namespace-uri-for-prefix((), )))" }, { "NUFP 5", itr(1), "count(string(namespace-uri-for-prefix('', )))" }, { "NUFP 6", itr(0, 0, 0, 0), "count(namespace-uri-for-prefix('',
    ))," + "count(namespace-uri-for-prefix((), ))," + "count(namespace-uri-for-prefix('', ))," + "count(namespace-uri-for-prefix((), ))" }, { "NUFP 7", str("U"), "string() }'/>/@a)" }, { "NUFP 8", str("U"), "string() }' xmlns:n='U'/>/@a)" }, { "NUFP 9", str("O"), "string({ namespace-uri-for-prefix('o', ) })" }, { "NU 1", str("u"), "string({ namespace-uri() })" }, { "NU 2", str("u"), "string({ namespace-uri() })" }, { "NU 3", str(""), "string({ namespace-uri() }
    )" }, { "NU 4", str("u"), "declare default element namespace 'u';" + "string({ namespace-uri() })" }, { "NU 5", str("u"), "string({namespace-uri-from-QName(xs:QName('a'))})" }, { "ISP 1", str("xml"), "string(element { QName('U', 'p:e') } { in-scope-prefixes() })" }, { "ISP 2", dbl(2), "number({count(in-scope-prefixes())})" }, { "ISP 3", itr(2, 2, 1, 1), "declare default element namespace 'x'; " + "count(in-scope-prefixes()), " + "count(in-scope-prefixes()), " + "count(in-scope-prefixes()), " + "count(in-scope-prefixes())" }, { "ISP 4", dbl(2), "number( { count( in-scope-prefixes() ) } )" }, { "EC1", bool(true), "exists({ /p:x })" }, { "NC1", itr(1), "count(namespace p { 'u' })" }, { "NC2", "namespace p {''}" }, { "NC3", "namespace p {'http://www.w3.org/2000/xmlns/'}" }, { "NC4", "namespace xml {''}" }, { "NC5", "namespace xml {'http://www.w3.org//XML/1998/namespace'}" }, { "NC6", "namespace xmlns {'u'}" }, { "DCN1 0", "declare copy-namespaces no-preserve no-inherit; 1" }, { "STEP 1", str("X"), "string(/@*)" }, /* Buggy queries: // expected error: XQDY0102 { "NSCon 1", "{ namespace {''} { 'y' } }" }, { "NSCon 2", "{ namespace {'p'} { 'y' } }" }, // function prefix is declared by element constructor { "FuncX 1", dbl(1), "number(/@*)" }, // error expected: variable namespace must be invalidated by // element namespace declaration { "VarDecl X1", "declare namespace x='a'; " + "let $x:x := 1 return " }, */ }; } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/simple/SimpleTest.java000066400000000000000000000140101222453003200275770ustar00rootroot00000000000000package org.basex.test.query.simple; import org.basex.test.query.*; /** * Simple XQuery tests. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class SimpleTest extends QueryTest { /** Constructor. */ static { doc = "X"; queries = new Object[][] { { "Compare 1", "xs:QName('a') = attribute a { 'b' }" }, { "FLWOR 1", itr(3), "(for $i in 1 to 5 return $i)[3]" }, { "FLWOR 2", itr(4), "(for $a in 1 to 5 for $b in 1 to 5 return $a * $b)[7]" }, { "FLWOR 3", bool(true), "declare namespace x = 'X'; " + "let $a := 0 let $b := $a return $b = 0" }, { "FLWOR 4", itr(1), "for $a in (1,2) let $b := 'a' where $a = 1 return $a" }, { "FLWOR 5", itr(1, 2), "for $a in (1,2) let $b := 'a'[$a = 1] return $a" }, { "FLWOR 6", empty(), "for $a in (1,2) let $b := 3 where $b = 4 return $a" }, { "FLWOR 7", itr(1, 2), "for $a in (1,2) let $b := 3[. = 4] return $a" }, { "FLWOR 8", itr(2), "for $a at $p in (1,2) where $a = 2 return $p" }, { "CompForLet 1", itr(3, 3), "for $a in 1 to 2 let $b := 3 return $b" }, { "CompForLet 2", itr(3, 3), "for $a in 1 to 2 let $b := 3 let $c := 3 return $c" }, { "CompForLet 3", itr(4, 4), "for $a in 1 to 2 let $b := 3 let $b := 4 return $b" }, { "CompForLet 4", itr(3), "for $a score $s in 1 let $s := 3 return $s" }, { "CompForLet 4", itr(1), "for $a at $p in 1 let $s := $p return $s" }, { "ExtVar 1", itr(1), "declare variable $a external; 1" }, { "ExtVar 2", "declare variable $a external; $a" }, { "If 1", bool(true), "if(true()) then true() else false()" }, { "If 2", bool(false), "if(false()) then true() else false()" }, { "If 3", bool(true), "if(true() = true()) then true() else false()" }, { "If 4", itr(1), "if(boolean() eq true()) then 1 else 2" }, { "If 5", itr(2), "if(boolean() ne true()) then 1 else 2" }, { "If 6", itr(2), "if(boolean() eq false()) then 1 else 2" }, { "If 7", itr(1), "if(boolean() ne false()) then 1 else 2" }, { "If 8", itr(1), "if(boolean() = true()) then 1 else 2" }, { "If 9", itr(2), "if(boolean() != true()) then 1 else 2" }, { "If 10", itr(2), "if(boolean() = false()) then 1 else 2" }, { "If 11", itr(1), "if(boolean() != false()) then 1 else 2" }, { "If 12", "if( = true()) then 1 else 2" }, { "And 1", bool(true), " and " }, { "And 2", bool(true), " and ( and )" }, { "And 3", bool(false), " and ( and not())" }, { "Or 1", bool(true), " or " }, { "Or 2", bool(true), " or ( or )" }, { "Or 3", bool(false), "not() or (not() or not())" }, { "Seq 1", itr(), "((( ) ) )" }, { "Seq 2", itr(1), "((( 1 ) ) )" }, { "Seq 3", itr(1, 2), "((( 1,2 ) ) )" }, { "Seq 4", itr(1, 2, 3), "(1, (( 2,3 ) ) )" }, { "Seq 5", itr(1, 2, 3, 4), "(1, (( 2,3 ) ),4 )" }, { "Seq 6", "()()" }, { "Seq 7", "() ()" }, { "Filter 1", "1[1][error()]" }, { "Filter 2", empty(), "1[1][/a]" }, { "Filter 3", str("b"), "name(/(a,b)[@c])" }, { "Filter 4", str("b"), "name(/(b,a)[self::b])" }, { "Filter 5", empty(), "/(a,b)[@c]" }, { "ContextItem 0", node(0), "." }, { "ContextItem 1", node(0), "42[not(.)], ." }, { "ContextItem 2", node(0), "try { 1[error()] } catch * {.}" }, { "ContextItem 3", node(0), "try { 1[error()][1] } catch * {.}" }, { "ContextItem 4", node(0), "try { 1[1][error()] } catch * {.}" }, { "ContextItem 5", node(0), "try { let $a := return $a/b[error()] } catch * {.}" }, { "ContextItem 6", itr(1), "declare function local:x() {1+};1[try { local:x() } catch *{.}]" }, { "ContextItem 7", node(0), "try { /(1+'') } catch * {.}" }, { "Path 1", empty(), "[./(@*)]" }, { "Cast 1", itr(1), "xs:integer('+1')" }, { "Cast 2", "xs:integer('++1')" }, { "Cast 3", bool(false), "string('/') castable as xs:QName" }, { "Div 1", "xs:dayTimeDuration('PT0S') div xs:dayTimeDuration('PT0S')" }, { "Div 2", "xs:yearMonthDuration('P0M') div xs:yearMonthDuration('P0M')" }, { "Mixed 1", "(,)/(if(name() = 'a') then else 2)/." }, { "Typeswitch 1", itr(1), "typeswitch(1) case xs:string return 1 default return 1" }, { "Typeswitch 2", itr(1), "typeswitch(1) case $a as xs:string return 1 default return 1" }, { "Typeswitch 3", itr(1, 2), "typeswitch(1) case $a as xs:string return (1,2) default return (1,2)" }, { "FunctionContext 0", "declare function local:x() { /x }; local:x()" }, { "XQuery 3.0", empty(), "xquery version '3.0'; /node()" }, { "XQuery 1.0", empty(), "xquery version '1.0'; /node()" }, { "DeclFun 1", itr(0, 1), "declare function local:x($x as xs:integer) { $x }; " + "let $a := 0, $b := 1 return try { local:x( (1 to 20) ) } catch * { ($a,$b) }" }, { "Catch 1", "try { 1+'' } catch XPTY0004 { 1 }" }, { "Catch 2", itr(1), "try { 1+'' } catch err:XPTY0004 { 1 }" }, { "Catch 3", itr(1), "try { 1+'' } catch *:XPTY0004 { 1 }" }, { "Catch 4", itr(1), "try { 1+'' } catch err:* { 1 }" }, { "Catch 5", itr(1), "try { 1+'' } catch * { 1 }" }, { "FuncTest 1", itr(1), "xquery version '1.0';" + "declare function local:foo() { count(local:bar()) };" + "declare function local:bar() { 42 };" + "local:foo()" }, { "FuncTest 2", itr(1), "xquery:eval('" + "declare function local:foo() { count(local:bar()) };" + "declare function local:bar() { 1 };" + "local:foo()')" }, }; } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/simple/TypeTest.java000066400000000000000000000035071222453003200273000ustar00rootroot00000000000000package org.basex.test.query.simple; import org.basex.test.query.*; /** * XQuery type tests. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class TypeTest extends QueryTest { /** Constructor. */ static { doc = ""; queries = new Object[][] { { "Simple 1", bool(true), "1 castable as xs:integer" }, { "Simple 2", bool(true), "1 castable as xs:integer?" }, { "Simple 3", bool(true), "() castable as xs:integer?" }, { "SimpleErr 1", "1 castable as xs:integer+" }, { "SimpleErr 2", "1 castable as xs:integer()" }, { "SimpleErr 3", "1 castable as xml:integer" }, { "SimpleErr 4", "1 castable as integer" }, { "SimpleErr 5", "1 castable as xs:NOTATION" }, { "SimpleErr 6", "1 castable as xs:anyAtomicType" }, { "Type 1", bool(true), "1 instance of item()" }, { "Type 2", bool(true), "1 instance of xs:anyAtomicType" }, { "Type 3", bool(true), "1 instance of xs:decimal" }, { "Type 4", bool(true), "1 instance of xs:integer" }, { "Type 5", bool(false), "1 instance of xs:string" }, { "Type 6", bool(false), "1 instance of xs:untypedAtomic" }, { "TypeErr 1", "1 instance of xs:abcde" }, { "TypeErr 2", "1 instance of xs:string()" }, { "TypeErr 3", "1 instance of item" }, /* * Sequence type: * - for/let * - some/every * - instance of * - typeswitch * - treat as * - variable declaration * - function declaration (arguments, return value) * * Type.find: * - function declaration * - sequence type * - bind, query processor * - Functions.get */ }; } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/simple/XPathMarkFTTest.java000066400000000000000000000250411222453003200304450ustar00rootroot00000000000000package org.basex.test.query.simple; import org.basex.test.query.*; /** * XPathMark functional tests. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class XPathMarkFTTest extends QueryTest { /** Test document. */ public static final String DOC = "" + //"" + "" + "" + "clergywoman" + "decadent" + "" + "" + "gentility" + "" + "happy-go-lucky man" + "" + "jigsaw" + "kerchief" + "" + "" + "The letter L is followed by the letter:" + "" + "which is followed by the letter:" + "ovenware" + "

    plentiful

    " + "" + "" + "quarrelsome
    " + "" + "sage" + "tattered" + "" + "voluptuary" + "wriggle
    " + "" + "yawn" + "zuzzurellone
    "; /** Test queries. */ public static final Object[][] QUERIES = new Object[][] { { "A01", node(59, 64, 79), "//L/*" }, { "A02", node(20), "//L/parent::*" }, { "A03", node(59, 64, 68, 73, 79), "//L/descendant::*" }, { "A04", node(53, 59, 64, 68, 73, 79), "//L/descendant-or-self::*" }, { "A05", node(1, 20), "//L/ancestor::*" }, { "A06", node(1, 20, 53), "//L/ancestor-or-self::*" }, { "A07", node(85, 99), "//L/following-sibling::*" }, { "A08", node(24, 39), "//L/preceding-sibling::*" }, { "A09", node(85, 89, 94, 99, 103, 108, 113, 117, 122), "//L/following::*" }, { "A10", node(6, 10, 15, 24, 28, 33, 39, 43, 48), "//L/preceding::*" }, { "A11", node(53), "//L/self::*" }, { "A12", str("n12"), "//L/@id/string()" }, { "F01", node(1, 20, 53, 64, 73), "//*[contains(., 'plentiful')]" }, { "F02", node(73), "//*[starts-with(., 'plentiful')]" }, { "F03", node(73), "//*[substring(., 1, 9) = 'plentiful']" }, { "F04", node(68), "//*[substring-after(., 'oven') = 'ware']" }, { "F05", node(73), "//*[substring-before(., 'ful') = 'plenti']" }, { "F06", node(1, 20), "//*[string-length(translate(" + "normalize-space(.), ' ', '')) > 100]" }, { "F07", node(59), "//*[concat(., ..) = ..]" }, { "F08", node(1, 6, 20, 24, 39, 53, 85, 99, 113), "//*[ceiling(@pre div @post) = 1]" }, { "F09", node(1, 6, 20, 53, 113), "//*[floor(@pre div @post) = 0]" }, { "F10", node(1, 20), "//*[round(@pre div @post) = 0]" }, { "F11", node(113), "//*[name(.) = 'X']" }, { "F12", node(122), "//*[lang('it')]" }, { "F13", node(79), "//L/child::*[last()]" }, { "F14", node(73), "//L/descendant::*[4]" }, { "F15", node(1), "//L/ancestor::*[2]" }, { "F16", node(85), "//L/following-sibling::*[1]" }, { "F17", node(39), "//L/preceding-sibling::*[1]" }, { "F18", node(113), "//L/following::*[7]" }, { "F19", node(15), "//L/preceding::*[7]" }, { "F20", node(68, 73), "//*[count(ancestor::*) > 3]" }, { "F21", node(1, 6, 20, 24, 39, 53, 64, 85, 99, 113), "//*[sum(ancestor::*/@pre) < sum(descendant::*/@pre)]" }, { "F22", node(1, 122), "id('n1 n26')" }, { "F23", node(33, 79, 122), "id(id(//*[.='happy-go-lucky man']/@idrefs)/@idrefs)" }, { "F24", node(1, 6, 20, 53, 113), "//*[number(@pre) < number(@post)]" }, { "F25", node(1), "//*[string(@pre - 1) = '0']" }, { "F26", node(1, 6, 10, 15, 20, 24, 28, 39, 43, 48, 53, 59, 64, 68, 73, 85, 89, 94, 99, 103, 108, 113, 117), "//*[boolean(@id) = true() and boolean(@idrefs) = false()]" }, { "O01", node(85, 99, 113), "//*[child::* and preceding::Q]" }, { "O02", node(89, 94, 103, 108, 117, 122), "//*[not(child::*) and preceding::Q]" }, { "O03", node(6, 10, 15, 24, 28, 33, 39, 43, 48, 85, 89, 94, 99, 103, 108, 113, 117, 122), "//*[preceding::L or following::L]" }, { "O04", node(1, 20, 59, 64, 68, 73, 79), "//L/ancestor::* | //L/descendant::*" }, { "O05", node(33), "//*[.='happy-go-lucky man']" }, { "O06", node(59, 64, 68, 73, 79), "//*[@pre > 12 and @post < 15]" }, { "O07", node(1, 6, 10, 15, 20, 28, 33, 43, 48, 53, 59, 64, 68, 73, 79, 89, 94, 103, 108, 113, 117, 122), "//*[@pre != @post]" }, { "O08", node(6, 24, 39, 48, 53, 59, 64, 79, 85, 89, 94, 99, 103, 108, 113, 117, 122), "//*[((@post * @post + @pre * @pre) div " + "(@post + @pre)) > ((@post - @pre) * (@post - @pre))]" }, { "O09", node(6, 15, 24, 33, 43, 53, 64, 73, 85, 94, 103, 113, 122), "//*[@pre mod 2 = 0]" }, { "P01", node(20), "//*[L]" }, { "P02", node(59, 64, 79), "//*[parent::L]" }, { "P03", node(1, 20), "//*[descendant::L]" }, { "P04", node(1, 20, 53), "//*[descendant-or-self::L]" }, { "P05", node(59, 64, 68, 73, 79), "//*[ancestor::L]" }, { "P06", node(53, 59, 64, 68, 73, 79), "//*[ancestor-or-self::L]" }, { "P07", node(24, 39), "//*[following-sibling::L]" }, { "P08", node(85, 99), "//*[preceding-sibling::L]" }, { "P09", node(6, 10, 15, 24, 28, 33, 39, 43, 48), "//*[following::L]" }, { "P10", node(85, 89, 94, 99, 103, 108, 113, 117, 122), "//*[preceding::L]" }, { "P11", node(53), "//*[self::L]" }, { "P12", node(1, 6, 10, 15, 20, 24, 28, 33, 39, 43, 48, 53, 59, 64, 68, 73, 79, 85, 89, 94, 99, 103, 108, 113, 117, 122), "//*[@id]" }, { "T01", node(58, 63), "//L/text()" }, { "T02", node(57), "//L/comment()" }, { "T03", node(78), "//L/processing-instruction()" }, { "T04", node(78), "//L/processing-instruction('myPI')" }, { "T05", node(57, 58, 59, 63, 64, 78, 79), "//L/node()" }, { "T06", node(64), "//L/N" }, { "T07", node(59, 64, 79), "//L/*" } }; /** Constructor. */ static { doc = DOC; queries = QUERIES; } /* TABLE REPRESENTATION POS PAR TYPE CONTENT 0 -1 DOC test.xml 1 0 ELEM A 2 1 ATTR id="n1" 3 1 ATTR pre="1" 4 1 ATTR post="26" 5 1 ATTR xml:lang="en" 6 1 ELEM B 7 6 ATTR id="n2" 8 6 ATTR pre="2" 9 6 ATTR post="3" 10 6 ELEM C 11 10 ATTR id="n3" 12 10 ATTR pre="3" 13 10 ATTR post="1" 14 10 TEXT clergywoman 15 6 ELEM D 16 15 ATTR id="n4" 17 15 ATTR pre="4" 18 15 ATTR post="2" 19 15 TEXT decadent 20 1 ELEM E 21 20 ATTR id="n5" 22 20 ATTR pre="5" 23 20 ATTR post="22" 24 20 ELEM F 25 24 ATTR id="n6" 26 24 ATTR pre="6" 27 24 ATTR post="6" 28 24 ELEM G 29 28 ATTR id="n7" 30 28 ATTR pre="7" 31 28 ATTR post="4" 32 28 TEXT gentility 33 24 ELEM H 34 33 ATTR id="n8" 35 33 ATTR pre="8" 36 33 ATTR post="5" 37 33 ATTR idrefs="n17 n26" 38 33 TEXT happy-go-lucky man 39 20 ELEM I 40 39 ATTR id="n9" 41 39 ATTR pre="9" 42 39 ATTR post="9" 43 39 ELEM J 44 43 ATTR id="n10" 45 43 ATTR pre="10" 46 43 ATTR post="7" 47 43 TEXT jigsaw 48 39 ELEM K 49 48 ATTR id="n11" 50 48 ATTR pre="11" 51 48 ATTR post="8" 52 48 TEXT kerchief 53 20 ELEM L 54 53 ATTR id="n12" 55 53 ATTR pre="12" 56 53 ATTR post="15" 57 53 COMM L is the twelve-th letter of the English alphabet 58 53 TEXT The letter L is followed by the letter: 59 53 ELEM M 60 59 ATTR id="n13" 61 59 ATTR pre="13" 62 59 ATTR post="10" 63 53 TEXT which is followed by the letter: 64 53 ELEM N 65 64 ATTR id="n14" 66 64 ATTR pre="14" 67 64 ATTR post="13" 68 64 ELEM O 69 68 ATTR id="n15" 70 68 ATTR pre="15" 71 68 ATTR post="11" 72 68 TEXT ovenware 73 64 ELEM P 74 73 ATTR id="n16" 75 73 ATTR pre="16" 76 73 ATTR post="12" 77 73 TEXT plentiful 78 53 PI myPI value="XPath is nice" 79 53 ELEM Q 80 79 ATTR id="n17" 81 79 ATTR pre="17" 82 79 ATTR post="14" 83 79 ATTR idrefs="n8 n26" 84 79 TEXT quarrelsome 85 20 ELEM R 86 85 ATTR id="n18" 87 85 ATTR pre="18" 88 85 ATTR post="18" 89 85 ELEM S 90 89 ATTR id="n19" 91 89 ATTR pre="19" 92 89 ATTR post="16" 93 89 TEXT sage 94 85 ELEM T 95 94 ATTR id="n20" 96 94 ATTR pre="20" 97 94 ATTR post="17" 98 94 TEXT tattered 99 20 ELEM U 100 99 ATTR id="n21" 101 99 ATTR pre="21" 102 99 ATTR post="21" 103 99 ELEM V 104 103 ATTR id="n22" 105 103 ATTR pre="22" 106 103 ATTR post="19" 107 103 TEXT voluptuary 108 99 ELEM W 109 108 ATTR id="n23" 110 108 ATTR pre="23" 111 108 ATTR post="20" 112 108 TEXT wriggle 113 1 ELEM X 114 113 ATTR id="n24" 115 113 ATTR pre="24" 116 113 ATTR post="25" 117 113 ELEM Y 118 117 ATTR id="n25" 119 117 ATTR pre="25" 120 117 ATTR post="23" 121 117 TEXT yawn 122 113 ELEM Z 123 122 ATTR id="n26" 124 122 ATTR pre="26" 125 122 ATTR post="24" 126 122 ATTR idrefs="n8 n17" 127 122 ATTR xml:lang="it" 128 122 TEXT zuzzurellone */ } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/simple/XQUPTest.java000066400000000000000000000061661222453003200271600ustar00rootroot00000000000000package org.basex.test.query.simple; import org.basex.test.query.*; /** * XQuery Update Tests. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class XQUPTest extends QueryTest { /** Testing sequence containing different kinds of fragments for * insert / replace expressions. */ static final String SEQ1 = "(, 5, 'fooboo')"; /** S.a. */ static final String SEQ2 = "(, 5, 'fooboo', attribute n{'b'})"; /** S.a. */ static final String SEQ3 = "(attribute n{'b'}, attribute c{'b'})"; /** S.a. */ static final String SEQ4 = "(attribute n{'b'}, attribute n{'b'}, attribute c{'b'})"; /** S.a. */ static final String SEQ5 = "(attribute n{'b'}, , 5, 'fooboo')"; /** S.a. */ static final String SEQ6 = "(attribute n{'b'}, 'fooboo', 5, , 'fooboo', 'aaa')"; /** * Constructor. */ static { doc = "" + "" + "" + "" + "" + "" + "" + "optional" + "" + "" + "" + "" + "" + "" + "positive" + "2 and a half" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + ""; // XQUP expressions return an empty iterator thus every test query q which // name starts with 'xxx' is an update query. // the test query following q represents the actual test. queries = new Object[][] { // merge text nodes { "xxxMERGEins", empty(), "insert node 'foo' into /up/cars/good/car/wheels" }, { "MERGEins", node(11), "/up/cars/good/car/wheels[text()='optionalfoo']" }, }; } /* PRE DIS SIZ ATS NS KIND CONTENT 0 1 29 1 0 DOC basex 1 1 28 1 0 ELEM up 2 1 26 2 0 ELEM cars 3 1 1 1 0 ATTR cat="c" 4 2 9 1 0 ELEM good 5 1 3 2 0 ELEM car 6 1 1 1 0 ATTR id="1" 7 2 1 1 0 COMM NO COMMENT 8 4 5 3 0 ELEM car 9 1 1 1 0 ATTR id="2" 10 2 1 1 0 ATTR color="blue" 11 3 2 1 0 ELEM wheels 12 1 1 1 0 TEXT optional 13 11 11 2 0 ELEM bad 14 1 1 1 0 ATTR howbad="really bad" 15 2 9 3 0 ELEM car 16 1 1 1 0 ATTR id="3" 17 2 1 1 0 ATTR color="pink" 18 3 1 1 0 PI advice nogo='buying this one' 19 4 5 1 0 ELEM wheels 20 1 1 1 0 TEXT positive 21 2 3 2 0 ELEM count 22 1 1 1 0 ATTR what="wheels" 23 2 1 1 0 TEXT 2 and a half 24 22 4 1 0 ELEM ugly 25 1 3 2 0 ELEM car 26 1 1 1 0 ATTR id="4" 27 2 1 1 0 COMM nice one 28 27 1 1 0 PI dohere what='how' */ } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/simple/XQuery30Test.java000066400000000000000000000102311222453003200277470ustar00rootroot00000000000000package org.basex.test.query.simple; import org.basex.test.query.*; /** * XQuery 3.0 tests (former: 1.1). * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class XQuery30Test extends QueryTest { /** Constructor. */ static { doc = ""; queries = new Object[][] { { "FLWOR 1", itr(1), "for $i in (1,1) group by $i return $i" }, { "FLWOR 2", itr(1, 2), "for $i in (1, 2, 2, 1) group by $i return $i" }, { "FLWOR 3", itr(1, 1, 2, 2, 2, 2, 1, 1), "for $x in (1, 2, 2, 1) for $y in ('a','a') group by $y return $x " }, { "FLWOR 4", itr(1, 2, 1, 1, 2, 2), "for $x in (1, 2) for $y in ('b','a','a') group by $y return $x " }, { "FLWOR 5", itr(1, 2), "for $a in 1 let $b := (1, 2) group by $a return $b" }, { "FLWOR group varref", itr(2, 1), "for $x in (2,1) let $y:=($x+1) group by $y return $x" }, { "GFLWOR varref ordered", itr(1, 2), "for $x in (2,1) let $y:=($x+1) group by $y order by $y return $x" }, { "FLWOR group ngvar", itr(3, 2, 1), "for $x in (1,2,3) for $y in ('a') group by $x order by $y, " + "$x descending return $x" }, { "FLWOR Err 1", "let $x := (1,2) group by $x return $x" }, { "FLWOR Err 2", "let $x := (1,2) group by $z return $x" }, { "FLWOR Err 3", "for $a in (1,1) let $b := $a group by $b order by $a return 1" }, { "FLWOR Err 4", "for $a in (1,1) let $b := $a group by $b order by $a return 1" }, { "FLWOR 6", itr(2), "for $a in 1 for $a in 2 group by $a return $a" }, { "FLWOR 7", itr(2, 3), "for $a in 1 for $a in (2,3) group by $a return $a" }, { "FLWOR 8", itr(1, 1), "for $s in (1,1) let $p := $s group by " + "$p order by $p return $s" }, { "FLWOR 9", itr(0), "for $s in (1) let $p := () group by $p order by $p return 0" }, { "FLWOR 10", itr(1), "for $i as xs:integer in 1 for $i in 1 return $i" }, { "FLWOR Err 4 (global)", "declare variable $a := 1; for $b in 1 group by $a return $b" }, { "FLWOR 11", itr(1), "for $x in (1,1) let $y := () group by $x order by $y return 1" }, { "FLWOR 12", itr(1, 3, 5, 7, 9, 2, 4, 6, 8, 10), "for $a at $p in 1 to 10 let $g := $a mod 2 group by $g return $p" }, { "FLWOR 13", itr(2), "for $a in 1 let $a:=$a+1 group by $a return $a" }, { "FLWOR 14", itr(1, 2), "for $i as xs:integer in (1,2) let $j := 42 group by $j return $i" }, { "FLWOR 15", itr(2, 4, 1, 3), "for $i in 1 to 4 group by $g := $i mod 2 " + "order by $g return $i" }, { "FLWOR 16", itr(1, 2, 3, 4), "for $i in 1 to 4 group by $g := 5 return $i" }, { "FLWOR 17", itr(2, 4, 1, 3), "for $i in 1 to 4 " + "group by $g as xs:integer := $i mod 2 order by $g return $i" }, { "FLWOR 18", itr(1, 2), "for $i in 1 to 2 group by $g as item() := 5 return $i" }, { "FLWOR 19", "for $i in 1 to 2 group by $g as node() := 5 return $i" }, { "FLWOR 19", "for $i in 1 to 2 let $g := $i group by $i as xs:integer return $i" }, { "Concat 1", str("ab"), "'a'||'b'" }, { "Concat 2", str("ab"), "'a' || 'b'" }, { "Concat 3", str("abc"), "'a' || 'b' || 'c'" }, { "Concat 4", str("1true3"), "1 || true() || '3'" }, { "Try/catch 1", str("X"), "try { 1+'a' } catch * { 'X' }" }, { "Try/catch 2", str("X"), "try { for $i in (42,0)" + "return 1 idiv $i } catch * {'X'}" }, { "Try/catch 3", itr(42), "try { error(xs:QName('local:error')) } " + "catch local:error { 42 }" }, { "Try/catch 4", itr(42), "try { error(xs:QName('local:error')) } " + "catch Q{http://www.w3.org/2005/xquery-local-functions}error { 42 }" }, { "Try/catch 5", itr(42), "try { error() } catch err:FOER0000 { 42 }" }, { "Try/catch 6", itr(42), "declare function local:a($n) { try { local:b() } catch * { $n } };" + "declare function local:b() { (: fails at compile-time :) xs:QName('b:b') };" + "local:a(42)" }, { "Try/catch 7", itr(), "let $seq := (1,2) return try { [*] } catch * { zero-or-one($seq) }" }, }; } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/up/000077500000000000000000000000001222453003200240025ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/java/org/basex/test/query/up/AtomicUpdatesTest.java000066400000000000000000000274041222453003200302560ustar00rootroot00000000000000package org.basex.test.query.up; import static org.junit.Assert.*; import static org.basex.util.Token.*; import java.io.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.data.atomic.*; import org.basex.io.*; import org.basex.test.query.*; import org.basex.util.*; import org.junit.*; import org.junit.rules.*; /** * Test the {@link AtomicUpdateList}. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class AtomicUpdatesTest extends AdvancedQueryTest { /** Expected exception. */ @Rule public ExpectedException thrown = ExpectedException.none(); /** * Basic test for tree-aware updates. */ @Test public void treeAwareUpdates() { final String doc = "" + "" + ""; final AtomicUpdateList l = atomics(doc); final DataClip ins = data(""); l.addInsert(7, 6, ins, false); l.addReplace(6, ins); l.addInsert(6, 5, ins, false); l.addInsert(3, 2, ins, true); l.addDelete(2); optimize(l, 1); l.clear(); l.addInsert(7, 5, ins, false); l.addInsert(7, 6, ins, false); l.addReplace(6, ins); l.addInsert(6, 5, ins, false); l.addInsert(4, 2, ins, true); l.addDelete(3); l.addInsert(2, 2, ins, true); optimize(l, 6); } /** * Tests tree-aware updates algorithm. * - Delete and Insert on the single child of a node */ @Test public void treeAwareUpdates1() { final String doc = ""; final AtomicUpdateList l = atomics(doc); l.addInsert(3, 2, data(""), false); l.addDelete(2); optimize(l, 1); query(transform(doc, "insert node into $input/b, delete node $input/b"), ""); } /** * Tests tree-aware updates algorithm. * - Insert on a target T * - Delete and Insert on the single child of T */ @Test public void treeAwareUpdates2() { final String doc = ""; final AtomicUpdateList l = atomics(doc); l.addInsert(3, 1, data(""), false); l.addInsert(3, 2, data(""), false); l.addDelete(2); optimize(l, 2); query(transform(doc, "insert node into $input, insert node into $input/b," + "delete node $input/b"), ""); } /** * Tests tree-aware updates algorithm. * - Insert on a target T * - Replace on child of T */ @Test public void treeAwareUpdates3() { final String doc = ""; final AtomicUpdateList l = atomics(doc); l.addInsert(3, 1, data(""), false); l.addReplace(2, data("")); optimize(l, 2); query(transform(doc, "insert node into $input," + "replace node $input/b with "), ""); } /** * Tests tree-aware updates algorithm. * - Replace and InsertInto on the single child of a node */ @Test public void treeAwareUpdates4() { final String doc = ""; final AtomicUpdateList l = atomics(doc); l.addInsert(3, 2, data(""), false); l.addReplace(2, data("")); optimize(l, 1); query(transform(doc, "insert node into $input/b," + "replace node $input/b with "), ""); } /** * Checks Constraints. A node can only be target of one 'destructive' operation like * replace and delete. */ @Test public void noMultipleDeletesOnSameTarget() { final AtomicUpdateList l = atomics(""); l.addDelete(2); l.addDelete(2); thrown.expect(RuntimeException.class); thrown.expectMessage("Multiple deletes/replaces on node"); optimize(l, -1); l.clear(); l.addDelete(2); l.addReplace(2, data("")); thrown.expect(RuntimeException.class); thrown.expectMessage("Multiple deletes/replaces on node"); optimize(l, -1); l.clear(); l.addReplace(2, data("")); l.addReplace(2, data("")); thrown.expect(RuntimeException.class); thrown.expectMessage("Multiple deletes/replaces on node"); optimize(l, -1); } /** * Checks Constraints. */ @Test public void noMultipleRenamesOrUpdatesOnSameTarget() { final AtomicUpdateList l = atomics(""); l.addRename(2, Data.ELEM, token("foo"), EMPTY); l.addRename(2, Data.ELEM, token("foo2"), EMPTY); thrown.expect(RuntimeException.class); thrown.expectMessage("Multiple renames on node"); optimize(l, -1); l.clear(); l.addUpdateValue(2, Data.ELEM, token("foo")); l.addUpdateValue(2, Data.ELEM, token("foo")); thrown.expect(RuntimeException.class); thrown.expectMessage("Multiple updates on node"); optimize(l, -1); } /** * Checks Constraints. */ @Test public void wrongOrderOfAtomicUpdates() { final AtomicUpdateList l = atomics(""); l.addDelete(2); l.addDelete(3); thrown.expect(RuntimeException.class); thrown.expectMessage("Invalid order at location"); optimize(l, -1); } /** * Tests if PRE values are correctly calculated before/after updates. */ @Test public void calculatePreValues() { final String doc = "" + "" + ""; final AtomicUpdateList l = atomics(doc); l.addDelete(3); l.check(); l.applyStructuralUpdates(); assertEquals(2, l.calculatePreValue(2, false)); assertEquals(3, l.calculatePreValue(3, false)); assertEquals(3, l.calculatePreValue(4, false)); assertEquals(4, l.calculatePreValue(5, false)); assertEquals(2, l.calculatePreValue(2, true)); assertEquals(4, l.calculatePreValue(3, true)); assertEquals(5, l.calculatePreValue(4, true)); assertEquals(6, l.calculatePreValue(5, true)); l.clear(); l.addDelete(7); l.addDelete(5); l.addDelete(3); l.check(); l.applyStructuralUpdates(); assertEquals(2, l.calculatePreValue(2, false)); assertEquals(3, l.calculatePreValue(3, false)); assertEquals(3, l.calculatePreValue(4, false)); assertEquals(4, l.calculatePreValue(5, false)); assertEquals(4, l.calculatePreValue(6, false)); assertEquals(5, l.calculatePreValue(7, false)); assertEquals(5, l.calculatePreValue(8, false)); assertEquals(2, l.calculatePreValue(2, true)); assertEquals(4, l.calculatePreValue(3, true)); assertEquals(6, l.calculatePreValue(4, true)); assertEquals(8, l.calculatePreValue(5, true)); assertEquals(9, l.calculatePreValue(6, true)); assertEquals(10, l.calculatePreValue(7, true)); assertEquals(11, l.calculatePreValue(8, true)); l.clear(); l.addDelete(3); // mind that dummy insert data instance has size equal 2! l.addInsert(3, 1, data(""), false); l.addInsert(3, 1, data(""), false); l.check(); l.applyStructuralUpdates(); assertEquals(1, l.calculatePreValue(1, false)); assertEquals(2, l.calculatePreValue(2, false)); assertEquals(7, l.calculatePreValue(3, false)); assertEquals(7, l.calculatePreValue(4, false)); assertEquals(8, l.calculatePreValue(5, false)); assertEquals(9, l.calculatePreValue(6, false)); assertEquals(1, l.calculatePreValue(1, true)); assertEquals(2, l.calculatePreValue(2, true)); // nodes like 3,4 that have not existed prior to insert are not recalculated assertEquals(3, l.calculatePreValue(3, true)); assertEquals(4, l.calculatePreValue(4, true)); assertEquals(3, l.calculatePreValue(5, true)); assertEquals(4, l.calculatePreValue(6, true)); } /** * Tests if distances are updated correctly. */ @Test public void distanceCaching() { final String doc = "" + "T3T4T6" + "" + ""; final AtomicUpdateList l = atomics(doc); l.addDelete(13); l.addInsert(13, 10, insseq(l.data), false); l.addInsert(11, 10, insseq(l.data), false); l.addReplace(5, insseq(l.data)); l.addDelete(3); l.execute(true); checkDistances(l.data, new int[][] { new int[] {17, 1}, new int[] {16, 15}, new int[] {15, 10}, new int[] {14, 10}, new int[] {13, 10}, new int[] {12, 11}, new int[] {11, 10}, new int[] {10, 9}, new int[] {9, 8}, new int[] {8, 1}, new int[] {7, 1}, new int[] {6, 1}, new int[] {5, 4}, new int[] {4, 1}, new int[] {3, 1}, new int[] {2, 1}, new int[] {1, 0}, }); } /** * Tests if the given child/parent PRE value pairs are still valid in the database. * @param d reference * @param pairs PRE value pairs */ private void checkDistances(final Data d, final int[][] pairs) { for(final int[] pair : pairs) if(d.parent(pair[0], d.kind(pair[0])) != pair[1]) fail("Wrong parent for pre=" + pair[0]); } /** * Tests if text node adjacency is correctly resolved. */ @Test public void textMerging() { final String doc = "" + "T3T4T6" + ""; final AtomicUpdateList l = atomics(doc); l.addInsert(8, 1, data(l.data, "Tx3"), false); l.addInsert(8, 7, data(l.data, "Tx2"), false); l.addInsert(8, 7, data(l.data, "Tx1"), false); l.addReplace(6, data(l.data, "T6new")); l.addDelete(5); l.addInsert(4, 2, data(l.data, "Tx01"), false); l.addDelete(3); l.addInsert(3, 2, data(l.data, "Tx0"), false); l.execute(true); checkTextAdjacency(l.data, new byte[][] { token("Tx0Tx01"), token("T4T6new"), token("Tx1Tx2"), token("Tx3"), }); } /** * Checks if text node adjacency has been correctly resolved for the given data instance. * @param data reference * @param texts in the expected order of occurrence */ private void checkTextAdjacency(final Data data, final byte[][] texts) { int i = 0; // find adjacent text nodes while(i + 1 < data.meta.size) { final int a = i++; final int b = i; final int aKind = data.kind(a); final int bKind = data.kind(b); if(aKind == Data.TEXT && bKind == Data.TEXT && data.parent(a, aKind) == data.parent(b, bKind)) fail("Adjacent text nodes at position " + i); } // check order of texts i = -1; int t = 0; while(++i < data.meta.size) { if(data.kind(i) == Data.TEXT && !eq(data.text(i, true), texts[t++])) fail("Invalid text node at position " + i); } } /** * Creates a {@link MemData} instance from the given string. * @param s XML fragment string * @return data instance or null in case of error */ private DataClip data(final String s) { try { return new DataClip(CreateDB.mainMem(new IOContent(s), context)); } catch(final IOException ex) { fail(Util.message(ex)); return null; } } /** * Creates a Data instance that contains a text node with the given value. * @param d parent data instance * @param text for text node * @return data instance with text node */ private DataClip data(final Data d, final String text) { final MemData m = new MemData(d); m.text(0, 1, token(text), Data.TEXT); m.insert(0); return new DataClip(m); } /** * Creates a small insertion sequence data containing 2 nodes. * @param d parent data instance * @return insertion sequence data instance */ private DataClip insseq(final Data d) { final MemData m = new MemData(d); m.elem(1, m.tagindex.index(token("dummy"), null, false), 1, 2, 0, false); m.insert(0); m.elem(1, m.tagindex.index(token("dummy"), null, false), 1, 1, 0, false); m.insert(1); return new DataClip(m); } /** * Creates an {@link AtomicUpdateList} for the given XML fragment. * @param doc XML fragment string * @return atomic update list */ private AtomicUpdateList atomics(final String doc) { return new AtomicUpdateList(data(doc).data); } /** * Tests the given {@link AtomicUpdateList} for correct optimizations. * @param l list of atomic updates * @param expectedSize expected size after optimizing the list */ private void optimize(final AtomicUpdateList l, final int expectedSize) { l.optimize(); assertEquals(expectedSize, l.structuralUpdatesSize()); } }basex-7.7.2/basex-core/src/test/java/org/basex/test/query/up/FastReplaceTest.java000066400000000000000000000111121222453003200276720ustar00rootroot00000000000000package org.basex.test.query.up; import static org.junit.Assert.*; import org.basex.core.cmd.*; import org.basex.test.query.*; import org.junit.*; /** * Stress Testing the fast replace feature where blocks on disk are directly * overwritten. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class FastReplaceTest extends AdvancedQueryTest { /** Test document. */ private static final String DOC = "src/test/resources/xmark.xml"; /** * Creates the db based on xmark.xml. * @throws Exception exception */ @Before public void setUp() throws Exception { new CreateDB(NAME, DOC).execute(context); query("let $items := /site/regions//item " + "for $i in 1 to 10 " + "return (insert node $items into /site/regions, " + "insert node $items before /site/regions, " + "insert node $items after /site/closed_auctions)"); } /** * Replaces blocks of equal size distributed over the document. */ @Test public void replaceEqualBlocks() { query("for $i in //item/location/text() return replace node $i with $i"); query("count(//item)", "186"); } /** * Replaces blocks of equal size distributed over the document. */ @Test public void replaceEqualBlocks2() { query("for $i in //item return replace node $i with $i"); query("count(//item)", "186"); } /** * Replaces blocks where the new subtree is smaller than the old one. Find * the smallest //item node in the database and replace each //item with * this. */ @Test public void replaceWithSmallerTree() { final String id = query("let $newitem := (let $c := min(for $i in //item " + "return count($i/descendant-or-self::node())) " + "return for $i in //item where " + "(count($i/descendant-or-self::node()) = $c) " + "return $i)[1] return $newitem/@id/data()"); final String count1 = query("count(//item)"); query("for $i in //item return replace node $i " + "with (//item[@id='" + id + "'])[1]"); final String count2 = query("count(//item[@id='" + id + "'])"); assertEquals(count1, count2); } /** * Replaces blocks where the new subtree is bigger than the old one. Find * the biggest //item node in the database and replace each //item with * this. */ @Test public void replaceWithBiggerTree() { query("let $newitem := (let $c := max(for $i in //item " + "return count($i/descendant-or-self::node())) " + "return for $i in //item where " + "(count($i/descendant-or-self::node()) = $c) " + "return $i)[1] return for $i in //item " + "return replace node $i with $newitem"); query("count(//item)", "186"); } /** * Replaces blocks where the new subtree is bigger than the old one. Find * the biggest //item node in the database and replace the last item in the * database with this. */ @Test public void replaceSingleWithBiggerTree() { query("let $newitem := (let $c := max(for $i in //item " + "return count($i/descendant-or-self::node())) " + "return for $i in //item where " + "(count($i/descendant-or-self::node()) = $c) " + "return $i)[1] return replace node (//item)[last()] with $newitem"); query("count(//item)", "186"); } /** * Replaces blocks where the new subtree is bigger than the old one. Find * the biggest //item node in the database and replace the last item in the * database with this. */ @Test public void replaceSingleWithSmallerTree() { final String id = query("let $newitem := (let $c := min(for $i in //item " + "return count($i/descendant-or-self::node())) " + "return for $i in //item where " + "(count($i/descendant-or-self::node()) = $c) " + "return $i)[1] return $newitem/@id/data()"); query("replace node (//item)[last()] with (//item[@id='" + id + "'])[1]"); query("count(//item)", "186"); } /** * Replaces a single attribute with two attributes. Checks for correct * updating of the parent's attribute size. */ @Test public void replaceAttribute() { query("replace node (//item)[1]/attribute() with " + "(attribute att1 {'0'}, attribute att2 {'1'})"); query("(//item)[1]/attribute()/string()", "0 1"); } /** * Replaces a single attribute with two attributes for each item. Checks for * correct updating of the parent's attribute size. */ @Test public void replaceAttribute2() { query("for $i in //item return replace node $i/attribute() with " + "(attribute att1 {'0'}, attribute att2 {'1'})"); query("//item/attribute()/string()"); } }basex-7.7.2/basex-core/src/test/java/org/basex/test/query/up/UpdatePrimitiveComparatorTest.java000066400000000000000000000414331222453003200326550ustar00rootroot00000000000000package org.basex.test.query.up; import static org.junit.Assert.*; import java.util.*; import java.util.List; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.query.up.*; import org.basex.query.up.primitives.*; import org.basex.test.query.*; import org.basex.util.*; import org.junit.*; import org.junit.rules.*; /** * Tests {@link UpdatePrimitiveComparator} that creates an order on update primitives * and is part of the XQuery Update Facility implementation. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public class UpdatePrimitiveComparatorTest extends AdvancedQueryTest { /** Expected exception. */ @Rule public ExpectedException thrown = ExpectedException.none(); /** Test document. */ final String testDocument = "" + "" + "" + "" + "TEXT14" + "" + "" + "" + "" + ""; /** * Single delete. */ @Test public void scoring01() { final String doc = ""; final Data d = data(doc); compare( new UpdatePrimitive[] { new DeleteNode(2, d, null) }); query(transform(doc, "delete node $input//b"), ""); } /** * Two basic deletes called on siblings. */ @Test public void scoring02() { final String doc = ""; final Data d = data(doc); compare( new UpdatePrimitive[] { new DeleteNode(4, d, null), new DeleteNode(2, d, null) }); query(transform(doc, "delete node ($input//b, $input//d)"), ""); } /** * Three basic deletes called on siblings. */ @Test public void scoring03() { final String doc = ""; final Data d = data(doc); compare( new UpdatePrimitive[] { new DeleteNode(4, d, null), new DeleteNode(3, d, null), new DeleteNode(2, d, null) }); query(transform(doc, "delete node ($input//child::node())"), ""); } /** * 'Insert after' and 'insert before' statement on the same target node. */ @Test public void scoring04() { final String doc = ""; final Data d = data(doc); compare( new UpdatePrimitive[] { new InsertAfter(2, d, null, null), new InsertBefore(2, d, null, null) }); query(transform(doc, "insert node before $input/b, insert node after $input/b"), ""); } /** * Two insert into statements performed on a node A and its child B. * * Tests if an insert into statement on target T is scored higher (hence executed first) * then all insert into statements on any of its descendant nodes. */ @Test public void scoring05() { final String doc = ""; final Data d = data(doc); compare( new UpdatePrimitive[] { new InsertInto(1, d, null, null), new InsertInto(2, d, null, null), }); query(transform(doc, "insert node into $input/b, insert node into $input"), ""); } /** * An insert into statement on target T and an insert after on its single child. * * Tests if the insert into on T is correctly score to be executed first. */ @Test public void scoring06() { final String doc = ""; final Data d = data(doc); compare( new UpdatePrimitive[] { new InsertInto(1, d, null, null), new InsertAfter(2, d, null, null), }); query(transform(doc, "insert node after $input/b, insert node into $input"), ""); } /** * An insert into and an insert after statement on the same target T that has a subtree * size > 1. * * Tests if two corrected insert into/insert after statements are correctly scored * depending on their type (insert after must come first). */ @Test public void scoring07() { final String doc = ""; final Data d = data(doc); compare( new UpdatePrimitive[] { new InsertAfter(2, d, null, null), new InsertInto(2, d, null, null), }); query(transform(doc, "insert node into $input/b," + "insert node after $input/b"), ""); } /** * Tests if an insert attribute statement on T and a delete statement on the single * attribute of T are scored correctly. */ @Test public void scoring08() { final String doc = ""; final Data d = data(doc); compare( new UpdatePrimitive[] { new DeleteNode(2, d, null), new InsertAttribute(1, d, null, null), }); query(transform(doc, "delete node $input/attribute::node()," + "insert node attribute {'idnew'} {0} into $input"), ""); } /** * Test if an exception is thrown for duplicate {@link UpdatePrimitive}. */ @Test public void duplicateScore() { thrown.expect(RuntimeException.class); thrown.expectMessage("Ambiguous order of UpdatePrimitives: "); final String doc = ""; final Data d = data(doc); compare( new UpdatePrimitive[] { new DeleteNode(2, d, null), new DeleteNode(2, d, null), }); } /** * Simple tests for the {@link UpdatePrimitive} comparator. * * Compares two primitives A and B based on the triple (LOCATION, SHIFTED, * SUBTREE, TYPE); * - LOCATION is the pre value where the update affects the table * - SHIFTED states if the primitives location has been updated to support * InsertInto, InsertAfter statements * - SUBTREE states if one update takes place in the subtree of the other's target node * - TYPE relates to the {@link PrimitiveType} hierarchy */ @Test public void comparatorTest() { // JUST ADD NEW SCENARIOS TO THE END OF THE DOCUMENT final Data d = data(testDocument); // ****** Tests on single target node T and on the single descendant of T //(A=B, A=B, A=B, A>B) compare(new UpdatePrimitive[] { new InsertIntoAsFirst(3, d, null, null), new InsertBefore(3, d, null, null) }); //(A=B, A>B, A>B, A=B) compare(new UpdatePrimitive[] { new InsertInto(2, d, null, null), new InsertInto(3, d, null, null), }); //(A=B, A>B, A=B, A>B, AB, A>B, A>B) compare(new UpdatePrimitive[] { new InsertAfter(2, d, null, null), new InsertInto(3, d, null, null), }); //(A>B, A>B, A>B, AB) compare(new UpdatePrimitive[] { new InsertIntoAsFirst(5, d, null, null), new InsertBefore(5, d, null, null) }); //(A=B, A=B, A>B, A=B) compare(new UpdatePrimitive[] { new InsertInto(4, d, null, null), new InsertInto(5, d, null, null), }); //(A=B, A=B, A>B, AB, A>B) compare(new UpdatePrimitive[] { new InsertAfter(4, d, null, null), new InsertInto(5, d, null, null), }); // ***** Tests on neighboring target nodes //(A=B, A=B, A=B, A>B) compare(new UpdatePrimitive[] { new InsertAfter(7, d, null, null), new InsertInto(7, d, null, null), }); //(A=B, A>B, A=B, A=B) compare(new UpdatePrimitive[] { new InsertInto(7, d, null, null), new InsertInto(4, d, null, null), }); //(A>B, A=B, A=B, A=B) compare(new UpdatePrimitive[] { new DeleteNode(9, d, null), new DeleteNode(8, d, null), }); } /** * Tests {@link InsertIntoAsFirst} on T and a {@link DeleteNode} on the attribute of T. */ @Test public void shiftInsertIntoAsFirst() { final Data d = data(testDocument); compare(new UpdatePrimitive[] { new InsertIntoAsFirst(22, d, null, null), new DeleteNode(23, d, null), }); } /** * Tests if {@link UpdatePrimitive} are ordered correctly for a target node T. */ @Test public void compareOnSingleNode() { final Data d = data(testDocument); compare(new UpdatePrimitive[] { new InsertAfter(10, d, null, null), new InsertInto(10, d, null, null), new InsertIntoAsFirst(10, d, null, null), new InsertAttribute(10, d, null, null), new ReplaceValue(10, d, null, new byte[] {' '}), new RenameNode(10, d, null, null), new ReplaceNode(10, d, null, null), new DeleteNode(10, d, null), new InsertBefore(10, d, null, null), }); } /** * Tests if {@link UpdatePrimitive} are ordered correctly for two sibling nodes. */ @Test public void compareOnSiblings() { final Data d = data(testDocument); compare(new UpdatePrimitive[] { new InsertAfter(8, d, null, null), new InsertInto(8, d, null, null), new InsertIntoAsFirst(8, d, null, null), new InsertAttribute(8, d, null, null), new ReplaceValue(8, d, null, new byte[] {' '}), new RenameNode(8, d, null, null), new ReplaceNode(8, d, null, null), new DeleteNode(8, d, null), new InsertBefore(8, d, null, null), new InsertAfter(7, d, null, null), new InsertInto(7, d, null, null), new InsertIntoAsFirst(7, d, null, null), new InsertAttribute(7, d, null, null), new ReplaceValue(7, d, null, new byte[] {' '}), new RenameNode(7, d, null, null), new ReplaceNode(7, d, null, null), new DeleteNode(7, d, null), new InsertBefore(7, d, null, null), }); } /** * Tests if {@link UpdatePrimitive} are ordered correctly for a target node T. */ @Test public void compareComplexRelationships() { final Data d = data(testDocument); compare(new UpdatePrimitive[] { // 25 new InsertAfter(18, d, null, null), new InsertInto(18, d, null, null), new InsertAfter(24, d, null, null), new InsertInto(24, d, null, null), new InsertAfter(25, d, null, null), new InsertInto(25, d, null, null), new InsertIntoAsFirst(25, d, null, null), new InsertAttribute(25, d, null, null), new ReplaceValue(25, d, null, new byte[] {' '}), new RenameNode(25, d, null, null), new ReplaceNode(25, d, null, null), new DeleteNode(25, d, null), new InsertBefore(25, d, null, null), // 24 new InsertIntoAsFirst(24, d, null, null), //i==13 new InsertAttribute(24, d, null, null), new ReplaceValue(24, d, null, new byte[] {' '}), new RenameNode(24, d, null, null), new ReplaceNode(24, d, null, null), new DeleteNode(24, d, null), new InsertBefore(24, d, null, null), // 23 new InsertAfter(21, d, null, null), new InsertInto(21, d, null, null), new InsertAfter(22, d, null, null), new InsertInto(22, d, null, null), new InsertIntoAsFirst(22, d, null, null), new ReplaceValue(23, d, null, new byte[] {' '}), new RenameNode(23, d, null, null), new ReplaceNode(23, d, null, null), new DeleteNode(23, d, null), // 22 new InsertAttribute(22, d, null, null), new ReplaceValue(22, d, null, new byte[] {' '}), new RenameNode(22, d, null, null), new ReplaceNode(22, d, null, null), new DeleteNode(22, d, null), new InsertBefore(22, d, null, null), // 21 new InsertIntoAsFirst(21, d, null, null), new InsertAttribute(21, d, null, null), new ReplaceValue(21, d, null, new byte[] {' '}), new RenameNode(21, d, null, null), new ReplaceNode(21, d, null, null), new DeleteNode(21, d, null), new InsertBefore(21, d, null, null), // 20 new InsertIntoAsFirst(18, d, null, null), new ReplaceValue(20, d, null, new byte[] {' '}), new RenameNode(20, d, null, null), new ReplaceNode(20, d, null, null), new DeleteNode(20, d, null), // 19 new ReplaceValue(19, d, null, new byte[] {' '}), new RenameNode(19, d, null, null), new ReplaceNode(19, d, null, null), new DeleteNode(19, d, null), // 18 new InsertAttribute(18, d, null, null), new ReplaceValue(18, d, null, new byte[] {' '}), new RenameNode(18, d, null, null), new ReplaceNode(18, d, null, null), new DeleteNode(18, d, null), new InsertBefore(18, d, null, null), }); } /** * Tests order of {@link UpdatePrimitive} for 2 siblings with the first sibling having * a single child node. */ @Test public void compareSiblingsComplex() { final Data d = data(testDocument); compare(new UpdatePrimitive[] { // node 28 new InsertAfter(28, d, null, null), new InsertInto(28, d, null, null), new InsertIntoAsFirst(28, d, null, null), new InsertAttribute(28, d, null, null), new ReplaceValue(28, d, null, new byte[] {' '}), new RenameNode(28, d, null, null), new ReplaceNode(28, d, null, null), new DeleteNode(28, d, null), new InsertBefore(28, d, null, null), // node 26 new InsertAfter(26, d, null, null), new InsertInto(26, d, null, null), new InsertIntoAsFirst(26, d, null, null), new InsertAttribute(26, d, null, null), new ReplaceValue(26, d, null, new byte[] {' '}), new RenameNode(26, d, null, null), new ReplaceNode(26, d, null, null), new DeleteNode(26, d, null), new InsertBefore(26, d, null, null), }); } /** * Tests order of {@link UpdatePrimitive} for 2 siblings with the first sibling having * a single child node. */ @Test public void compareSiblingsSimple() { final Data d = data(testDocument); compare(new UpdatePrimitive[] { new InsertInto(28, d, null, null), new InsertInto(26, d, null, null), }); compare(new UpdatePrimitive[] { new InsertInto(31, d, null, null), new InsertInto(29, d, null, null), }); compare(new UpdatePrimitive[] { new DeleteNode(28, d, null), new InsertInto(26, d, null, null), }); // two empty siblings compare(new UpdatePrimitive[] { new InsertInto(8, d, null, null), new InsertInto(7, d, null, null), }); // first sibling has attribute, second one is empty compare(new UpdatePrimitive[] { new DeleteNode(35, d, null), new InsertIntoAsFirst(33, d, null, null), new DeleteNode(34, d, null), }); // two empty siblings compare(new UpdatePrimitive[] { new DeleteNode(8, d, null), new InsertInto(7, d, null, null), }); } /** * Creates a database instance from the given string. * @param s database content string * @return database instance */ private static Data data(final String s) { try { new CreateDB(NAME, s).execute(context); } catch(final BaseXException ex) { fail(Util.message(ex)); } return context.data(); } /** * Helper function to test score calculations of a list of update primitives. Tests * for both directions! * * @param order update primitives (ordered as expected, that means the first given * primitive is the first to be executed, hence has the highest score) */ private static void compare(final UpdatePrimitive[] order) { final List l = new ArrayList(); for(final UpdatePrimitive p : order) l.add(p); final List l2 = new ArrayList(); for(final UpdatePrimitive p : order) l2.add(0, p); // primitives are sorted ASCENDING final UpdatePrimitiveComparator c = new UpdatePrimitiveComparator(); Collections.sort(l, c); Collections.sort(l2, c); final int s = order.length; // check if primitives are ordered as expected for(int i = 0; i < s; i++) { // ordered list must be traversed back-to-front as elements are sorted ascending final UpdatePrimitive p = l.get(s - i - 1); final UpdatePrimitive p2 = l2.get(s - i - 1); if(!p.equals(order[i]) || !p2.equals(order[i])) fail("Unexpected order of updates at position: " + i); } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/query/up/UpdateTest.java000066400000000000000000000777411222453003200267470ustar00rootroot00000000000000package org.basex.test.query.up; import static org.junit.Assert.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.data.atomic.*; import org.basex.io.*; import org.basex.query.up.primitives.*; import org.basex.query.util.*; import org.basex.test.query.*; import org.junit.*; /** * General test of the XQuery Update Facility implementation. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class UpdateTest extends AdvancedQueryTest { /** Test document. */ private static final String DOC = "src/test/resources/xmark.xml"; /** * Creates a database. * @param input input database string, if null, then use default. * @throws BaseXException database exception */ private static void createDB(final String input) throws BaseXException { new CreateDB(NAME, input == null ? DOC : input).execute(context); } // BASIC XQUF TESTS ********************************************* /** * Basic delete. */ @Test public void delete() { query(transform("", "delete node $input//b, delete node $input//f, delete node $input//e"), ""); } /** * Basic delete. */ @Test public void delete2() { query(transform("", "delete node $input//b, delete node $input//c"), ""); } /** * Basic delete. */ @Test public void delete3() { final String doc = "" + "" + ""; query(transform(doc, "delete node ($input//n3, $input//n5, $input//n7)"), ""); } /** Transform expression shadowing another variable. */ @Test public void transform() { query("let $c := return copy $c := $c modify () return $c", ""); } /** * Basic insert into. */ @Test public void insertinto() { query(transform("", "insert node into $input, insert node into $input//a"), ""); } /** * Basic insert into. */ @Test public void insertinto2() { query(transform("", "insert node into $input//a, insert node into $input//b"), ""); } /** * Tests {@link InsertIntoAsFirst} on T and a {@link DeleteNode} on the attribute of T. */ @Test public void insertIntoAsFirst() { query(transform("", "insert node as first into $input, delete node $input/@att"), ""); } /** * Tests {@link InsertIntoAsFirst} on T and a {@link ReplaceNode} on the attribute of T. */ @Test public void insertIntoAsFirst2() { query(transform("", "insert node as first into $input, replace node $input/@att with " + "(attribute {'att1'}{0}, attribute {'att2'}{0})"), ""); } /** * Tests if insertion sequences are merged in a consistent way. */ @Test public void insertSequenceMerging() { query(transform("", "insert node into $input, insert node into $input"), ""); query(transform("", "insert node as last into $input, insert node as last into $input"), ""); query(transform("", "insert node into $input, insert node as last into $input"), ""); query(transform("", "insert node as last into $input, insert node into $input"), ""); } /** * Delete last node of a data instance. Checks if table limits are crossed. */ @Test public void deleteLastNode() { query(transform("", "delete node $input//c"), ""); } /** * ReplaceValue on attribute. */ @Test public void replaceValue() { final String result = ""; final String[] replacements = { "'a'", "attribute a { 'a' }", "attribute b { 'a' }", "text { 'a' }", "comment { 'a' }", "processing-instruction x { 'a' }", "document { 'a' }", "element x { 'a' }", }; for(final String r : replacements) query(transform("", "replace value of node $input/@b with " + r), result); } /** * Replacement of an identical value. */ @Test public void replaceIdenticalValue() { query(transform("A", "replace value of node $input/text() with 'A'"), "A"); query(transform("", "replace value of node $input/@a with 'a'"), ""); query(transform("", "replace value of node $input with 'a'"), ""); query(transform("", "replace value of node $input with 'a'"), ""); query(transform("text { 'A' }", "replace value of node $input with 'A'"), "A"); query(transform("document { 'A' }", "replace value of node $input/text() with 'A'"), "A"); } /** * Tests detection of duplicate attributes in insertion sequences and whether a * combination of delete/insert/replace can lead to duplicate attributes. */ @Test public void duplicateAttribute() { // check 'global' duplicate detection String q = transform("", "for $i in 1 to 2 return insert node attribute a { 'b' } into $input"); error(q, Err.UPATTDUPL); // check if insertion sequence itself is duplicate free (which it is not) q = transform("", "delete node $input/@a," + "for $i in 1 to 2 return insert node attribute a { 'b' } into $input"); error(q, Err.UPATTDUPL); // replace with a + delete a + insert a q = transform("", "delete node $input/@a, replace node $input/@a with attribute a {'b'}," + "insert node attribute a { 'b' } into $input"); error(q, Err.UPATTDUPL); } /** * Replace last node of a data instance. Checks if table limits are crossed. */ @Test public void replaceLastNode() { query(transform("", "replace node $input//c with "), ""); } /** * Replaces an attribute with two attributes. */ @Test public void replaceAttribute() { query(transform("", "replace node $input/@att0 with (attribute att1 {'1'}, attribute att2 {'2'})"), ""); } /** * Replaces a target T which is an attribute and has a following node with another * parent than T itself. */ @Test public void replaceAttribute2() { query(transform("", "replace node $input/b/@att0 with attribute att1 {'1'}"), ""); } /** * **** TC tries to provoke multiple delete atomics on the same PRE within the same * snapshot. ***** * * Only delete primitives {@link DeleteNode} are allowed to create atomic delete * updates {@link AtomicUpdateList}. This ensures that * no PRE value is deleted twice by an atomic delete, as the XQUF module resolves * multiple operations of the same type on the same node. Deleting a PRE value twice * would lead to deleting another node due to PRE shifts after the first delete. * * If another {@link UpdatePrimitive} leads to the deletion of a node (i.e. * {@link ReplaceValue} it must be substituted first by a sequence of other * {@link UpdatePrimitive} that contains the {@link DeleteNode} primitive. * */ @Test public void noMultipleAtomicDeletes() { query(transform("text", "replace value of node $input//text() with \"\", " + "delete node $input//text()"), ""); } /** * Tests if the substitution of a {@link ReplaceNode} primitive does not interfere with * the primitive types used for substitution that are actually called by the user. */ @Test public void replaceSubstitution() { final String doc = ""; // both queries should yield the same result final String a = query(transform(doc, "replace node $input//a with element shouldBeLast {}, " + "insert node before $input//a")); final String b = query(transform(doc, "insert node before $input//a, " + "replace node $input//a with element shouldBeLast {}")); assertEquals(a, b); } /** * ReplaceElementContent with non-empty text node. */ @Test public void replaceelementcontent1() { query(transform("", "replace value of node $input with 'Hello'"), "Hello"); } /** * ReplaceElementContent with empty text node. */ @Test public void replaceelementcontent2() { query(transform("", "replace value of node $input with ''"), ""); } /** * ReplaceElementContent on a target T with a text node and insertBefore * on a child of T. */ @Test public void replaceelementcontent3() { testBothSequences("", "newText", "replace value of node $input with 'newText'", "insert node before $input/A"); } /** * ReplaceElementContent on a target T with a text node and a replaceNode on a child * of T. */ @Test public void replaceelementcontent4() { testBothSequences("", "newText", "replace value of node $input with 'newText'", "replace node $input/A with "); } /** * ReplaceElementContent on a target T with a text node and insertInto on T. */ @Test public void replaceelementcontent5() { testBothSequences("", "newText", "replace value of node $input with 'newText'", "insert node into $input"); } /** * ReplaceElementContent on a target T with a text node and rename on a child of * T. As a rename does not introduce any new node identities the rename is lost and T * is expected to have no children after the end of the snapshot. */ @Test public void replaceelementcontent6() { testBothSequences("", "newText", "replace value of node $input with 'newText'", "rename node $input/A as 'newA'"); } /** * ReplaceElementContent on a target T and replaceElementContent on the only child of * T. */ @Test public void replaceelementcontent7() { testBothSequences("", "newtextA", "replace value of node $input with 'newtextA'", "replace value of node $input/A with 'newtextB'"); } /** * ReplaceNode on a target T and replaceElementContent on the only child of * T. */ @Test public void replaceelementcontent8() { testBothSequences("", "", "replace node $input/A with ", "replace value of node $input/A/B with 'newContentForA'"); } /** * ReplaceNode and ReplaceElementContent on a target T. */ @Test public void replaceelementcontent9() { testBothSequences("", "", "replace node $input/A with ", "replace value of node $input/A with 'newContentForA'"); } /** * Delete/replace same target. */ @Test public void deleteAndReplaceOnSameTarget() { testBothSequences("", "", "replace node $input/b with ", "delete node $input/b"); } /** * Tests if adding the two given statements to the pending update list leads to the * desired result regardless of the order they are added. * @param doc input document * @param result expected result * @param statement1 update statement 1 * @param statement2 update statement 2 */ private void testBothSequences(final String doc, final String result, final String statement1, final String statement2) { query(transform(doc, statement1 + "," + statement2), result); query(transform(doc, statement2 + "," + statement1), result); } /** * Replaces the value of the documents root node. Related to * github issue #141. * @throws BaseXException database exception */ @Test public void replaceValueOfEmptyRoot() throws BaseXException { createDB(""); query("replace value of node /a with 'a'"); query("/", "a"); } /** * Insertion into an empty element. */ @Test public void emptyInsert1() { query( "copy $x := modify insert nodes into $x return $x", ""); } /** * Insertion into an empty document. */ @Test public void emptyInsert2() { query( "copy $x := document {()} modify insert nodes into $x return $x", ""); } /** * Insertion into an empty document. * @throws BaseXException database exception */ @Test public void emptyInsert3() throws BaseXException { createDB(""); query("delete node /a"); query("insert nodes into doc('" + NAME + "')"); query("/", ""); } /** * Tests a simple call of the optimize command. * @throws BaseXException database exception */ @Test public void optimize() throws BaseXException { createDB(null); query("let $w := //item[@id = 'item0'] " + "return (if($w/@id) " + "then (delete node $w/@id, db:optimize('" + NAME + "')) else ())"); } /** Variable from the inner scope shouldn't be visible. */ @Test public void outOfScope() { error("let $d := copy $e := modify () return $e return $e", Err.VARUNDEF); } /** * The new-namespace flag has to be set for the parent of an inserted * attribute. */ @Test public void setNSFlag() { query("declare namespace x='x';" + "copy $x := modify insert node attribute x:x {} into $x return $x", ""); } /** * The new-namespace flag has to be set for the parent of an inserted * attribute. */ @Test public void setNSFlag2() { query("declare namespace x='x';" + "copy $x := " + "modify insert node attribute x:x {} into $x return $x/a", ""); } /** * The new-namespace flag has to be set for the parent of an inserted * attribute. */ @Test public void setNSFlag3() { query("declare namespace x='x';" + "copy $x := " + "modify insert node attribute x:x {} into $x/a return $x/a", ""); } /** * Text merging after a simple delete. */ @Test public void textMerging00() { query(transform("AACC", "delete node $input//b", "($input,count($input//text()))"), "AACC1"); } /** * Text merging for a simple insert into statement. * @throws Exception exception */ @Test public void textMerging01() throws Exception { createDB(null); query("insert node 'foo' into //item[@id='item0']/location"); query("(//item[@id='item0']/location/text())[1]", "United Statesfoo"); } /** * Text merging for a simple insert into statement in combination with an * insert before statement. Checks if pre value shifts are taken into * account. * @throws Exception exception */ @Test public void textMerging02() throws Exception { createDB(null); query("insert node 'foo' into //item[@id='item0']/location," + "insert node before //item[@id='item0']"); query("(//item[@id='item0']/location/text())[1]", "United Statesfoo"); } /** * Text merging test. Test 'insert into as first' and whether pre value * shifts are taken into account correctly. * @throws Exception exception */ @Test public void textMerging03() throws Exception { createDB(null); query("let $i := //item[@id='item0'] return (insert node 'foo' as " + "first into $i/location, insert node 'foo' before $i/location, " + "insert node 'foo' into $i/quantity)"); query("let $i := //item[@id='item0'] return " + "(($i/location/text())[1], ($i/quantity/text())[1])", "fooUnited States1foo"); } /** * Text merging for a simple insert into statement. Checks if pre value shifts * are taken into account. * @throws Exception exception */ @Test public void textMerging04() throws Exception { createDB(null); query("let $i := //item[@id='item0'] return insert node 'foo' " + "before $i/location/text()"); query("let $i := //item[@id='item0'] return " + "($i/location/text())[1]", "fooUnited States"); } /** * Text merging for a simple insert into statement. Checks if pre value shifts * are taken into account. * @throws Exception exception */ @Test public void textMerging05() throws Exception { createDB(null); query("let $i := //item[@id='item0']/location return " + "(insert node 'foo' into $i, delete node $i/text())"); query("//item[@id='item0']/location/text()", "foo"); } /** * Text merging test. * @throws Exception exception */ @Test public void textMerging06() throws Exception { createDB(null); query("let $i := //item[@id='item0']/location return " + "(insert node into $i, insert node 'foo' as last into $i)"); query("let $i := //item[@id='item0']/location return " + "delete node $i/n"); query("(//item[@id='item0']/location/text())[1]", "United Statesfoo"); } /** * Text merging test. * @throws Exception exception */ @Test public void textMerging07() throws Exception { createDB(null); query("let $i := //item[@id='item0']/location return " + "insert node 'foo' after $i/text()"); query("(//item[@id='item0']/location/text())[1]", "United Statesfoo"); } /** * Text merging test. * @throws Exception exception */ @Test public void textMerging08() throws Exception { createDB(null); query("let $i := //item[@id='item0'] return " + "(insert node 'foo' after $i/location)"); query("let $i := //item[@id='item0']/location return " + "(insert node 'foo' after $i, insert node 'faa' before $i, insert " + "node 'faa' into $i, delete node $i/text())"); query("let $i := //item[@id='item0']/location " + "return ($i/text(), ($i/../text())[2])", "faafoofoo"); } /** * Text merging test for delete operation. */ @Test public void textMerging09() { query(transform("aacc", "delete node $input//d, insert node 'bb' after ($input//d)[1]", "count($input//text()), $input//text()"), "1aabbcc"); } /** * Text merging test for delete operation. */ @Test public void textMerging10() { query("copy $c := aacc " + "modify (delete node $c//d, insert node 'bb' before ($c//d)[2]) " + "return (count($c//text()), $c//text())", "1aabbcc"); } /** * Text merging test for delete operation. */ @Test public void textMerging11() { query( "copy $c := aacc " + "modify (delete node $c//d, insert node 'bb' before ($c//d)[2]) " + "return (count($c//text()), $c//text())", "1aabbcc"); } /** * Text node merging for replace. */ @Test public void textMerging12() { final String doc = "shouldBeTextNode"; final String query = "replace node $input/Single with 'Single'"; final String expected = "shouldBeSingleTextNode"; checkTextNodeMerging(doc, query, expected, 1); } /** * Text node merging in multiple locations. */ @Test public void textMerging13() { final String doc = "T1T2T3T4T5"; final String query = "replace node $input//e with 'T6'," + "insert node 'T11' before $input//a," + "delete node ($input//a,$input//b,$input//c), " + "replace node $input//d with (,'T44')"; final String expected = "T1T11T2T3T4T44T5T6"; checkTextNodeMerging(doc, query, expected, 2); } /** * Convenience method for text node merging. * @param input input document * @param query modification query * @param result expected result * @param textCount expected number of text nodes in result */ protected static void checkTextNodeMerging(final String input, final String query, final String result, final int textCount) { query(transform(input, query), result); assertEquals(textCount, Integer.parseInt(query(transform(input, query, "count($input//text())")))); } /** * Simple delete. */ @Test public void distanceCaching000() { query(transform("", "delete node $input/b"), ""); } /** * Two simple deletes on two empty siblings. */ @Test public void distanceCaching00() { query(transform("", "delete node ($input/b, $input/c)"), ""); } /** * Tests the distance cache for replacements where the new nodes have * the same size as the replaced ones. */ @Test public void distanceCaching0() { query("copy $c := " + "modify for $a in $c//a return replace node $a with " + "return $c", ""); } /** * Tests if the common data instance for all insert sequences is built correctly. * [LK][CG] XQUF: maybe we should add some more low-level TCs ... */ @Test public void dataClipBuildFail() { query("copy $c := " + "modify for $a in $c//a return replace node $a with " + "return $c", ""); } /** * Distance caching tested for inserts at different levels. * @throws BaseXException excp */ @Test public void distanceCaching1() throws BaseXException { createDB(""); query("insert node before //B, insert node before //C, " + "insert node before //D"); query("/", ""); } /** * Distance caching tested for inserts at different levels. * @throws BaseXException excp */ @Test public void distanceCaching2() throws BaseXException { createDB(""); query("insert node before //B, insert node before //C, " + "insert node before //D, insert node before //E"); query("/", ""); } /** * Distance caching tested for inserts at different levels. * @throws BaseXException excp */ @Test public void distanceCaching3() throws BaseXException { createDB(""); query("insert node before //B, insert node before //C, " + "insert node into //C"); query("/", ""); } /** * Distance caching tested for inserts at different levels. * @throws BaseXException excp */ @Test public void distanceCaching4() throws BaseXException { createDB(""); query("insert node before //B, insert node before //C, " + "insert node into //C"); query("/", ""); } /** * Distance caching tested for inserts at different levels. * @throws BaseXException excp */ @Test public void distanceCaching5() throws BaseXException { createDB(""); query("insert node before //B, insert node before //C"); query("/", ""); } /** * Distance caching tested for simple deletes. * @throws BaseXException excp */ @Test public void distanceCaching6() throws BaseXException { createDB(""); query("delete node //B"); query("/", ""); } /** * Distance caching tested for simple deletes. * @throws BaseXException excp */ @Test public void distanceCaching7() throws BaseXException { createDB(""); query("delete node (//B,//D)"); query("/", ""); } /** * Distance caching tested for deletes at different levels. * @throws BaseXException excp */ @Test public void distanceCaching8() throws BaseXException { createDB(""); query("delete node (//B,//D)"); query("/", ""); } /** * Distance caching tested for deletes at different levels. * @throws BaseXException excp */ @Test public void distanceCaching9() throws BaseXException { createDB(""); query("delete node (//B,//D)"); query("/", ""); } /** * Distance caching tested for deletes at different levels. * @throws BaseXException excp */ @Test public void distanceCaching10() throws BaseXException { createDB(""); query("delete node (//B,//D)"); query("/", ""); } /** * Distance caching tested for deletes at different levels. * @throws BaseXException excp */ @Test public void distanceCaching11() throws BaseXException { createDB(""); query("delete node (//C,//D)"); query("/", ""); } /** * Distance caching tested for deletes at different levels. * @throws BaseXException excp */ @Test public void distanceCaching12() throws BaseXException { createDB(""); query("delete node (//B, //C), insert node before //D"); query("/", ""); } /** * Distance caching tested for deletes at different levels. * @throws BaseXException excp */ @Test public void distanceCaching13() throws BaseXException { createDB(""); query("insert node into //C," + "insert node before //C," + "insert node after //D"); query("/", ""); } /** * Distance caching tested for neighboring inserts. * @throws BaseXException excp */ @Test public void distanceCaching14() throws BaseXException { createDB(""); query("insert node into //C," + "insert node before //C," + "insert node after //D"); query("/", ""); } /** * Distance caching tested for neighboring inserts. * @throws BaseXException excp */ @Test public void distanceCaching15() throws BaseXException { createDB(""); query("insert node before //C," + "insert node after //B"); query("/", ""); } /** * Distance caching tested for neighboring inserts. * @throws BaseXException excp */ @Test public void distanceCaching16() throws BaseXException { createDB(""); query("insert node into //C," + "insert node as last into //C"); query("/", ""); } /** * Tests if pre cache is clear / free of ambiguous entries. * @throws BaseXException excp */ @Test public void distanceCaching17() throws BaseXException { createDB(""); query("insert node after //B, delete node //C"); query("/", ""); } /** * Tests if pre cache is clear / free of ambiguous entries. * @throws BaseXException excp */ @Test public void distanceCaching18() throws BaseXException { createDB(""); query("insert node before //D, delete node //C"); query("/", ""); } /** * Tests if pre cache is clear / free of ambiguous entries. * @throws BaseXException excp */ @Test public void distanceCaching19() throws BaseXException { createDB(""); query("replace node //C with "); query("/", ""); } /** * Testing cached distance updates. */ @Test public void distanceCaching20() { query("copy $c := " + "modify (replace node ($c//a)[1] with , " + "replace node ($c//a)[2] with , " + "insert node into ($c//a)[3], " + "replace node ($c//a)[4] with , " + "replace node ($c//a)[5] with ) " + "return $c"); } /** * Testing cached distance updates. Insert + replace statement on the same * target node. */ @Test public void distanceCaching21() { query("copy $c := " + "modify (replace node ($c//a)[1] with , " + "replace node ($c//a)[2] with , " + "insert node into ($c//a)[3], " + "replace node ($c//a)[4] with , " + "replace node ($c//a)[5] with ) " + "return $c"); } /** * Testing distance caching when a node is deleted and there have been updates on the * descendant axis. Tests effect on following nodes. * @throws BaseXException excp */ @Test public void distanceCaching22() throws BaseXException { createDB(""); query("insert node into //D, delete node //B"); query("/", ""); } /** * Tests if updates are executed in the correct order and if the sorting of updates * is stable. * @throws BaseXException excp */ @Test public void distanceCaching23() throws BaseXException { createDB(""); query("insert node into //B, insert node into //A"); query("/", ""); } /** * Tests if reordering of updates works correctly. * @throws BaseXException excp */ @Test public void distanceCaching24() throws BaseXException { createDB(""); query("insert node into //B, delete node //C"); query("/", ""); } /** * Tests if reordering of updates works correctly. * @throws BaseXException excp */ @Test public void distanceCaching25() throws BaseXException { createDB(""); query("insert node into //B, delete node //C"); query("/", ""); } /** * Tests if side-effecting updates within transform expressions are rejected. * Also includes db:output() and fn:put(). */ @Test public void dbUpdateTransform() { error("copy $c := modify db:output('x') return $c", Err.BASX_DBTRANSFORM); error("copy $c := modify db:add('" + NAME + "','','x.xml') return $c", Err.BASX_DBTRANSFORM); error("copy $c := modify put(, 'x.txt') return $c", Err.BASX_DBTRANSFORM); } /** * Replaces a node with two others. */ @Test public void duplAttribute() { query("replace node document { }//B with (, )"); } /** * Inserts attributes. */ @Test public void attributeInserts() { // Issue #736 query("declare namespace x='x';" + "let $x := " + "for $n in $x//n " + "for $i in 1 to 16 " + "return insert node attribute {concat('x:', 'att', $i)} {} into $n"); } /** * Tests the combination of transform expressions and xquery:eval(). */ @Test public void evalFItem() { query("declare function local:c() { copy $a := modify () return $a };" + "xquery:eval('$c()', { 'c' : local:c#0 })", ""); } /** * Tests the expressions in modify clauses for updates. */ @Test public void modifyCheck() { error("copy $c:= X modify 'a' return $c", Err.UPMODIFY); error("copy $c:= X modify(delete node $c/text(),'a') return $c", Err.UPALL); } /** Tests adding an attribute and thus crossing the {@link IO#MAXATTS} line (GH-752). */ @Test public void insertAttrMaxAtt() { query( transform( "", "insert node attribute { 'b' } { '' } into $input", "count($input/@*)" ), "31" ); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/server/000077500000000000000000000000001222453003200235175ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/java/org/basex/test/server/AdminStressTest.java000066400000000000000000000045521222453003200274640ustar00rootroot00000000000000package org.basex.test.server; import static org.junit.Assert.*; import java.io.*; import java.util.concurrent.*; import org.basex.*; import org.basex.core.cmd.*; import org.basex.server.*; import org.basex.test.*; import org.basex.util.*; import org.junit.*; /** * Admin stress test. * * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ public final class AdminStressTest extends SandboxTest { /** Number of clients/events. */ private static final int NUM = 100; /** Server reference. */ private static BaseXServer server; /** * Starts the server. * @throws IOException I/O exception */ @BeforeClass public static void start() throws IOException { server = createServer(); } /** * Stops the server. * @throws IOException I/O exception */ @AfterClass public static void stop() throws IOException { stopServer(server); } /** * Start simultaneously clients which create events and clients which list all * events. * @throws Exception exception */ @Test public void createAndListEvents() throws Exception { final CountDownLatch start = new CountDownLatch(1); final CountDownLatch stop = new CountDownLatch(NUM); final Client[] c1 = new Client[NUM]; final Client[] c2 = new Client[NUM]; for(int i = 0; i < NUM; ++i) { c1[i] = new Client(new CreateEvent(NAME + i), start, stop); c2[i] = new Client(new ShowEvents(), start, stop); } start.countDown(); // start all clients stop.await(); Performance.sleep(200); final ClientSession cs = createClient(); for(int i = 0; i < NUM; ++i) cs.execute("drop event " + NAME + i); cs.close(); for(final Client c : c1) if(c.error != null) fail(c.error); for(final Client c : c2) if(c.error != null) fail(c.error); } /** * Start simultaneously clients which create events and clients which list all * events. * @throws Exception exception */ @Test public void createAndListSessions() throws Exception { final CountDownLatch start = new CountDownLatch(1); final CountDownLatch stop = new CountDownLatch(NUM); final Client[] clients = new Client[NUM]; for(int i = 0; i < NUM; ++i) clients[i] = new Client(new ShowSessions(), start, stop); start.countDown(); // start all clients stop.await(); for(final Client c : clients) if(c.error != null) fail(c.error); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/server/ClientSessionOutTest.java000066400000000000000000000006771222453003200305060ustar00rootroot00000000000000package org.basex.test.server; import org.basex.io.out.*; import org.junit.*; /** * This class tests the client/server session API with an output stream. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ClientSessionOutTest extends ClientSessionTest { /** Initializes the test. */ @Override @Before public void startSession() { out = new ArrayOutput(); super.startSession(); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/server/ClientSessionTest.java000066400000000000000000000017751222453003200300160ustar00rootroot00000000000000package org.basex.test.server; import static org.junit.Assert.*; import java.io.*; import org.basex.*; import org.basex.util.*; import org.junit.*; /** * This class tests the client/server session API. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class ClientSessionTest extends SessionTest { /** Server reference. */ private static BaseXServer server; /** * Starts the server. * @throws IOException I/O exception */ @BeforeClass public static void startServer() throws IOException { server = createServer(); } /** * Stops the server. * @throws IOException I/O exception */ @AfterClass public static void stop() throws IOException { stopServer(server); } /** Starts a session. */ @Before public void startSession() { try { session = createClient(); session.setOutputStream(out); } catch(final IOException ex) { fail(Util.message(ex)); } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/server/EventTest.java000066400000000000000000000171141222453003200263070ustar00rootroot00000000000000package org.basex.test.server; import static org.basex.query.func.Function.*; import static org.junit.Assert.*; import java.io.*; import java.util.*; import java.util.concurrent.*; import org.basex.*; import org.basex.core.*; import org.basex.server.*; import org.basex.test.*; import org.basex.util.*; import org.junit.*; /** * This class tests the event API. * * @author BaseX Team 2005-12, BSD License * @author Roman Raedle * @author Andreas Weiler */ public final class EventTest extends SandboxTest { /** Return value of function db:event. */ private static final String RETURN = "ABCDEFGHIJKLMNOP"; /** Event count. */ private static final int EVENT_COUNT = 10; /** Client count. */ private static final int CLIENTS = 10; /** Server reference. */ private static BaseXServer server; /** Admin session. */ private ClientSession session; /** Control client sessions. */ private final ClientSession[] sessions = new ClientSession[CLIENTS]; /** * Starts the server. * @throws IOException I/O exception */ @BeforeClass public static void start() throws IOException { server = createServer(); } /** * Starts the sessions. * @throws IOException I/O exception */ @Before public void startSessions() throws IOException { session = createClient(); // drop event, if not done yet try { session.execute("drop event " + NAME); } catch(final IOException ex) { } for(int i = 0; i < sessions.length; i++) sessions[i] = createClient(); } /** * Stops the sessions. * @throws IOException I/O exception */ @After public void stopSessions() throws IOException { for(final ClientSession cs : sessions) cs.close(); session.close(); } /** * Stops the server. * @throws IOException I/O exception */ @AfterClass public static void stop() throws IOException { stopServer(server); } /** * Creates and drops events. * @throws IOException I/O exception */ @Test public void createDrop() throws IOException { final String[] events = new String[EVENT_COUNT]; for(int i = 0; i < EVENT_COUNT; i++) events[i] = NAME + i; try { // create event for(final String e : events) session.execute("create event " + e); // query must return all events final HashSet names = new HashSet(); final String result = session.execute("show events"); for(final String line : result.split("\\r?\\n|\\r")) if(line.startsWith("- ")) names.add(line.substring(2)); for(final String ev : events) assertTrue("Event '" + ev + "' not created!", names.contains(ev)); } finally { // drop events as last action, preventing leftovers for(final String ev : events) session.execute("drop event " + ev); } } /** * Watches and unwatches events. * @throws IOException I/O exception */ @Test public void watchUnwatch() throws IOException { // create event session.execute("create event " + NAME); // create event try { session.execute("create event " + NAME); fail("This was supposed to fail."); } catch(final IOException ex) { /* expected. */ } // watch an event for(final ClientSession cs : sessions) { cs.watch(NAME, new EventNotifier() { @Override public void notify(final String data) { } }); } // watch an unknown event try { for(final ClientSession cs : sessions) { cs.watch(NAME + 1, new EventNotifier() { @Override public void notify(final String data) { } }); fail("This was supposed to fail."); } } catch(final IOException ex) { /* expected. */ } // unwatch event for(final ClientSession cs : sessions) { cs.unwatch(NAME); } // unwatch unknown event try { for(final ClientSession cs : sessions) { cs.unwatch(NAME + 1); fail("This was supposed to fail."); } } catch(final IOException ex) { /* expected. */ } // drop the event session.execute("drop event " + NAME); // drop event try { session.execute("drop event " + NAME); fail("This was supposed to fail."); } catch(final IOException ex) { /* expected. */ } } /** * Runs event test with specified second query and without. * @throws IOException I/O exception * @throws InterruptedException waiting interrupted */ @Test public void event() throws IOException, InterruptedException { // create the event // ignore the error that the event may already exist try { session.execute("create event " + NAME); } catch(final BaseXException ignore) { } final CountDownLatch doneSignal = new CountDownLatch(sessions.length); // watch event for(final ClientSession cs : sessions) { cs.watch(NAME, new EventNotifier() { @Override public void notify(final String data) { doneSignal.countDown(); assertEquals(RETURN, data); } }); } // fire an event session.query(_DB_EVENT.args(NAME, RETURN)).execute(); // wait for half a second that the event is fired assertTrue(doneSignal.await(500, TimeUnit.MILLISECONDS)); // all clients unwatch the events for(final ClientSession cs : sessions) cs.unwatch(NAME); // drop event session.execute("drop event " + NAME); } /** * Concurrent events. * @throws Exception exception */ @Test public void concurrent() throws Exception { // create events // ignore the error that the event may already exist try { session.execute("create event " + NAME); session.execute("create event " + NAME + 1); } catch(final BaseXException ignore) { } final CountDownLatch doneSignal = new CountDownLatch(CLIENTS * sessions.length); // watch events on all clients for(final ClientSession cs : sessions) { cs.watch(NAME, new EventNotifier() { @Override public void notify(final String data) { doneSignal.countDown(); assertEquals(RETURN, data); } }); cs.watch(NAME + 1, new EventNotifier() { @Override public void notify(final String data) { doneSignal.countDown(); assertEquals(RETURN, data); } }); } // fire events final Client[] clients = new Client[CLIENTS]; for(int i = 0; i < sessions.length; i++) { clients[i] = new Client(i % 2 == 0, RETURN); } for(final Client c : clients) c.start(); for(final Client c : clients) c.join(); // wait for half a second that the event is fired assertTrue(doneSignal.await(500, TimeUnit.MILLISECONDS)); // unwatch events for(final ClientSession cs : sessions) { cs.unwatch(NAME); cs.unwatch(NAME + 1); } // drop event session.execute("drop event " + NAME); session.execute("drop event " + NAME + 1); } /** Single client. */ static final class Client extends Thread { /** Client session. */ private final ClientSession cs; /** First event. */ private final boolean first; /** Event value. */ private final String value; /** * Default constructor. * @param f first flag * @param v value * @throws IOException I/O exception */ public Client(final boolean f, final String v) throws IOException { cs = createClient(); first = f; value = v; } @Override public void run() { try { String name = NAME; if(!first) name += 1; cs.query(_DB_EVENT.args(name, value)).execute(); cs.close(); } catch(final Exception ex) { Util.stack(ex); } } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/server/LocalSessionOutTest.java000066400000000000000000000006651222453003200303170ustar00rootroot00000000000000package org.basex.test.server; import org.basex.io.out.*; import org.junit.*; /** * This class tests the local session API with an output stream. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class LocalSessionOutTest extends LocalSessionTest { /** Initializes the test. */ @Override @Before public void startSession() { out = new ArrayOutput(); super.startSession(); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/server/LocalSessionTest.java000066400000000000000000000006121222453003200276170ustar00rootroot00000000000000package org.basex.test.server; import org.basex.server.*; import org.junit.*; /** * This class tests the local session API. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class LocalSessionTest extends SessionTest { /** Starts a session. */ @Before public void startSession() { session = new LocalSession(context, out); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/server/LockingTest.java000066400000000000000000000155301222453003200266140ustar00rootroot00000000000000package org.basex.test.server; import static org.junit.Assert.*; import java.io.*; import java.util.*; import java.util.List; import java.util.concurrent.*; import org.basex.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.test.*; import org.junit.*; import org.junit.runner.*; import org.junit.runners.*; import org.junit.runners.Parameterized.*; /** * This class tests database locking inside BaseX. For this purpose, two queries are * forced to be executed in parallel. If this fails, locking prevents these queries to * run in parallel. * * @author BaseX Team 2005-12, BSD License * @author Jens Erat */ @RunWith(Parameterized.class) public final class LockingTest extends SandboxTest { /** How often should tests be repeated? */ private static final int REPEAT = 1; /** Maximum sleep time in ms. */ private static final int SLEEP = 200; /** Additional allowed holding time for client creation overhead, ... in ms. */ private static final int SYNC = 100; /** Test document. */ private static final String DOC = "src/test/resources/test.xml"; /** XQuery code for handling latches. */ private static final String Q = "Q{java:org.basex.test.server.LockingTest}countDownAndWait()"; /** How often to run each query in load test. */ private static final int RUN_COUNT = 100; /** * Queries to run in load test, %1$s will get substituted by DB name, %2$s by code for * sleeping {@code SLEEP_LOAD} milliseconds. */ private static final String[] QUERIES = { "%2$s", "(doc('%1$s'), %2$s)", "insert node %2$s into doc('%1$s')", "for $i in ('%1$s') return insert node %2$s into doc($i)", "for $i in ('%1$s') return (doc($i), %2$s)" }; /** Server reference. */ private static BaseXServer server; /** * Enable repeated running of test to track down synchronization issues. * @return Collection of empty object arrays */ @Parameters public static Collection generateParams() { final List params = new ArrayList(); for(int i = 1; i <= REPEAT; i++) { params.add(new Object[0]); } return params; } /** * Starts the server. * @throws Exception None expected */ @BeforeClass public static void start() throws Exception { AProp.setSystem(MainProp.GLOBALLOCK, false); server = createServer(); final CountDownLatch latch = new CountDownLatch(2); new Client(new CreateDB(NAME, DOC), null, latch); new Client(new CreateDB(NAME + "1", DOC), null, latch); // Wait for both databases being created latch.await(); } /** * Stops the server. * @throws IOException I/O exception */ @AfterClass public static void stop() throws IOException { stopServer(server); } /** Latch for synchronizing threads inside lock. */ public static CountDownLatch sync; /** Latch for testing parallelism. */ public static CountDownLatch test; /** * Handle thread synchronization so both threads/queries have to be inside their locks * at the same time to count down {@code test} latch. * @throws Exception None expected */ public static void countDownAndWait() throws Exception { sync.countDown(); if(sync.await(SLEEP, TimeUnit.MILLISECONDS)) { test.countDown(); } } /** * Test parallel execution of given queries. * @param c1 First command * @param c2 Second command * @param parallel Should queries be executed in parallel? * @throws Exception None expected */ private static void testQueries(final Command c1, final Command c2, final boolean parallel) throws Exception { sync = new CountDownLatch(2); test = new CountDownLatch(2); final Client cl1 = new Client(c1, null, null); final Client cl2 = new Client(c2, null, null); final boolean await = test.await(2 * SLEEP + SYNC, TimeUnit.MILLISECONDS); assertTrue(cl1.error, cl1.error == null); assertTrue(cl2.error, cl2.error == null); assertTrue(parallel ? "Parallel execution expected" : "Serial execution expected", parallel == await); } /** * Encapsulates string formatter for convenience. * @param formatString Format string * @param args Objects to insert into format string * @return Formatted string */ private static String f(final String formatString, final Object... args) { return new Formatter().format(formatString, args).toString(); } /** * Test whether parallel execution of queries is successful. * @throws Exception None expected */ @Test public void lockingTests() throws Exception { // Not querying any databases testQueries( new XQuery(Q), new XQuery(Q), true); // Reading the same database twice testQueries( new XQuery(f("(doc('%s'), %s)", NAME, Q)), new XQuery(f("(doc('%s'), %s)", NAME, Q)), true); // Reading two different databases testQueries( new XQuery(f("(doc('%s'), %s)", NAME, Q)), new XQuery(f("(doc('%s1'), %s)", NAME, Q)), true); // Writing to the same database twice testQueries( new XQuery(f("insert node %s into doc('%s')", Q, NAME)), new XQuery(f("insert node %s into doc('%s')", Q, NAME)), false); // Writing to different databases testQueries( new XQuery(f("insert node %s into doc('%s')", Q, NAME)), new XQuery(f("insert node %s into doc('%s1')", Q, NAME)), true); // Read from and write to the same database testQueries( new XQuery(f("(doc('%s'), %s)", NAME, Q)), new XQuery(f("insert node %s into doc('%s')", Q, NAME)), false); // Read from and write to different databases testQueries( new XQuery(f("(doc('%s'), %s)", NAME, Q)), new XQuery(f("insert node %s into doc('%s1')", Q, NAME)), true); // Read from a database, perform global write lock testQueries( new XQuery(f("(doc('%s'), %s)", NAME, Q)), new XQuery(f("for $i in ('%s') return insert node %s into doc($i)", NAME, Q)), false); // Global write lock twice testQueries( new XQuery(f("for $i in ('%s') return insert node %s into doc($i)", NAME, Q)), new XQuery(f("for $i in ('%s') return insert node %s into doc($i)", NAME, Q)), false); } /** * Load test. * @throws Exception None expected */ @Test public void loadTests() throws Exception { final int totalQueries = RUN_COUNT * QUERIES.length; final ArrayList clients = new ArrayList(totalQueries); final CountDownLatch allDone = new CountDownLatch(totalQueries); for(int i = 0; i < RUN_COUNT; i++) for(final String query : QUERIES) clients.add(new Client(new XQuery(f(query, NAME, "1")), null, allDone)); allDone.await(totalQueries * SLEEP, TimeUnit.MILLISECONDS); for(final Client client : clients) assertTrue(client.error, client.error == null); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/server/SemaphoreTest.java000066400000000000000000000053631222453003200271540ustar00rootroot00000000000000package org.basex.test.server; import static org.junit.Assert.*; import java.io.*; import java.util.*; import org.basex.*; import org.basex.core.cmd.*; import org.basex.server.*; import org.basex.test.*; import org.basex.util.*; import org.junit.*; /** * This class tests the order of incoming commands. * * @author BaseX Team 2005-12, BSD License * @author Andreas Weiler */ public final class SemaphoreTest extends SandboxTest { /** Create random number. */ static final Random RANDOM = new Random(); /** Test file. */ private static final String FILE = "src/test/resources/factbook.zip"; /** Test queries. */ static final String [] QUERIES = { "xquery for $n in (db:open('" + NAME + "')//province)[position() < 100] " + " return insert node into $n", "xquery for $n in 1 to 100000 where $n = 0 return $n" }; /** Number of performance tests. */ private static final int TESTS = 5; /** Server reference. */ private static BaseXServer server; /** Socket reference. */ private static Session sess; /** Starts the server. * @throws IOException exception */ @BeforeClass public static void start() throws IOException { server = createServer(); sess = createClient(); } /** * Stops the server. * @throws Exception exception */ @AfterClass public static void stop() throws Exception { sess.execute(new DropDB(NAME)); sess.close(); // stop server instance stopServer(server); } /** * Runs a test for concurrent database creations. * @throws IOException I/O exception */ @Test public void createTest() throws IOException { // drops database for clean test sess.execute(new DropDB(NAME)); // create database for clean test sess.execute(new CreateDB(NAME, FILE)); } /** Efficiency test. * @throws Exception exception */ @Test public void runClients() throws Exception { final Client[] cl = new Client[TESTS]; for(int i = 0; i < TESTS; ++i) cl[i] = new Client(); for(final Client c : cl) c.start(); for(final Client c : cl) c.join(); for(final Client c : cl) c.session.close(); } /** Single client. */ static class Client extends Thread { /** Client session. */ ClientSession session; /** * Default constructor. */ public Client() { try { session = createClient(); } catch(final IOException ex) { fail(Util.message(ex)); } } @Override public void run() { try { final int t = RANDOM.nextInt(2); session.execute(QUERIES[t]); } catch(final IOException ex) { fail(Util.message(ex)); } } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/server/SessionTest.java000066400000000000000000000502071222453003200266510ustar00rootroot00000000000000package org.basex.test.server; import static org.basex.query.func.Function.*; import static org.basex.util.Token.*; import static org.junit.Assert.*; import java.io.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.io.in.*; import org.basex.io.out.*; import org.basex.io.serial.*; import org.basex.server.*; import org.basex.test.*; import org.basex.util.*; import org.junit.*; /** * This class tests the client/server query API. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class SessionTest extends SandboxTest { /** Raw output method. */ private static final String RAW = "declare option output:method 'raw';"; /** Output stream. */ ArrayOutput out; /** Serialization parameters to wrap query result with an element. */ static final String WRAPPER = "declare option output:wrap-prefix 'db';" + "declare option output:wrap-uri 'ns';"; /** Client session. */ Session session; /** Stops a session. */ @After public final void stopSession() { try { if(cleanup) session.execute(new DropDB(NAME)); session.close(); } catch(final IOException ex) { fail(Util.message(ex)); } } /** * Runs a query command and retrieves the result as string. * @throws IOException I/O exception */ @Test public final void command() throws IOException { session.execute("set serializer wrap-prefix=,wrap-uri="); assertEqual("A", session.execute("xquery 'A'")); } /** Runs a query command and wraps the result. * @throws IOException I/O exception */ @Test public final void commandSerial1() throws IOException { session.execute("set serializer wrap-prefix=db,wrap-uri=ns"); assertEqual("", session.execute("xquery ()")); } /** Runs a query command and wraps the result. * @throws IOException I/O exception */ @Test public final void commandSerial2() throws IOException { assertEqual("" + " 1" + "", session.execute("xquery " + WRAPPER + '1')); } /** Runs an erroneous query command. * @throws IOException I/O exception */ @Test(expected = BaseXException.class) public final void commandError() throws IOException { session.execute("xquery ("); } /** * Runs a query command and retrieves the result as string. * @throws IOException I/O exception */ @Test(expected = BaseXException.class) public final void commandErr() throws IOException { session.execute("1,+''"); } /** * Creates new databases. * @throws IOException I/O exception */ @Test public final void create() throws IOException { session.create(NAME, new ArrayInput("")); assertEqual("", session.query("db:open('" + NAME + "')").execute()); session.create(NAME, new ArrayInput("")); assertEqual("", session.query("db:open('" + NAME + "')").execute()); } /** * Stops because of invalid input. * @throws IOException I/O exception */ @Test(expected = BaseXException.class) public final void createErr() throws IOException { session.create(NAME, new ArrayInput("<")); } /** * Stops because of an invalid database name. * @throws IOException I/O exception */ @Test(expected = BaseXException.class) public final void createNameErr() throws IOException { session.create("", new ArrayInput("")); } /** * Adds documents to a database. * @throws IOException I/O exception */ @Test public final void add() throws IOException { session.execute("create db " + NAME); session.add(NAME, new ArrayInput("")); assertEqual("1", session.query("count(" + _DB_OPEN.args(NAME) + ')').execute()); for(int i = 0; i < 9; i++) session.add(NAME, new ArrayInput("")); assertEqual("10", session.query("count(" + _DB_OPEN.args(NAME) + ')').execute()); } /** * Adds a file with an invalid file name. * @throws IOException I/O exception */ @Test(expected = BaseXException.class) public final void addNameErr() throws IOException { session.execute("create db " + NAME); session.add("", new ArrayInput("")); } /** * Adds a file with missing input. * @throws IOException I/O exception */ @Test(expected = BaseXException.class) public final void addNoInput() throws IOException { session.execute("create db " + NAME); session.add("", new ArrayInput("")); } /** * Replaces documents in a database. * @throws IOException I/O exception */ @Test public final void replace() throws IOException { session.execute("create db " + NAME); assertEqual("0", session.query("count(" + _DB_OPEN.args(NAME) + ')').execute()); session.replace(NAME, new ArrayInput("")); assertEqual("1", session.query("count(" + _DB_OPEN.args(NAME) + ')').execute()); session.replace(NAME + '2', new ArrayInput("")); assertEqual("2", session.query("count(" + _DB_OPEN.args(NAME) + ')').execute()); session.replace(NAME + '2', new ArrayInput("")); assertEqual("2", session.query("count(" + _DB_OPEN.args(NAME) + ')').execute()); } /** * Replaces a file with an invalid file name. * @throws IOException I/O exception */ @Test(expected = BaseXException.class) public final void replaceNameErr() throws IOException { session.execute("create db " + NAME); session.replace("", new ArrayInput("")); } /** * Adds a file with missing input. * @throws IOException I/O exception */ @Test(expected = BaseXException.class) public final void replaceNoInput() throws IOException { session.execute("create db " + NAME); session.replace("", new ArrayInput("")); } /** * Stores binary content in the database. * @throws IOException I/O exception */ @Test public final void store() throws IOException { session.execute("create db " + NAME); session.store("X", new ArrayInput("!")); assertEqual("true", session.query(_DB_IS_RAW.args(NAME, "X")).execute()); session.store("X", new ArrayInput("")); assertEqual("", session.query(_DB_RETRIEVE.args(NAME, "X")).execute()); session.store("X", new ArrayInput(new byte[] { 0, 1, -1 })); assertEqual("0001FF", session.query( "xs:hexBinary(" + _DB_RETRIEVE.args(NAME, "X") + ')').execute()); session.execute("drop db " + NAME); } /** Stores binary content. * @throws IOException I/O exception */ @Test public void storeBinary() throws IOException { session.execute("create db " + NAME); session.store("X", new ArrayInput(new byte[] { -128, -2, -1, 0, 1, 127 })); assertEqual("-128 -2 -1 0 1 127", session.query( _CONVERT_BINARY_TO_BYTES.args(_DB_RETRIEVE.args(NAME, "X"))).execute()); } /** * Stores binary content in the database. * @throws IOException I/O exception */ @Test(expected = BaseXException.class) public final void storeNoDB() throws IOException { session.store("X", new ArrayInput("!")); } /** * Stores binary content in the database. * @throws IOException I/O exception */ @Test(expected = BaseXException.class) public final void storeInvalid() throws IOException { session.execute("create db " + NAME); session.store("..", new ArrayInput("!")); } /** Retrieves binary content. * @throws IOException I/O exception */ @Test public void retrieveBinary() throws IOException { session.execute("create db " + NAME); session.store("X", new ArrayInput("\0")); assertEqual("\0", session.execute("retrieve X")); } /** Retrieves empty content. * @throws IOException I/O exception */ @Test public void retrieveEmpty() throws IOException { session.execute("create db " + NAME); session.store("X", new ArrayInput("")); assertEqual("", session.execute("retrieve X")); } /** Runs a query and retrieves the result as string. * @throws IOException I/O exception */ @Test public void query() throws IOException { final Query query = session.query("1"); assertEqual("1", query.execute()); } /** Runs a query and retrieves the result as string. * @throws IOException I/O exception */ @Test public void query2() throws IOException { final Query query = session.query("1"); if(!query.more()) fail("No result returned"); assertEqual("1", query.next()); } /** Runs a query and retrieves the empty result as string. * @throws IOException I/O exception */ @Test public void queryNoResult() throws IOException { final Query query = session.query("()"); assertFalse("No result was expected.", query.more()); query.close(); } /** Tolerate multiple close calls. * @throws IOException I/O exception */ @Test public void queryClose() throws IOException { final Query query = session.query("()"); query.close(); query.close(); } /** Runs a query, using more(). * @throws IOException I/O exception */ @Test public void queryInit() throws IOException { final Query query = session.query("()"); assertFalse("No result was expected.", query.more()); } /** Runs a query and retrieves multiple results as string. * @throws IOException I/O exception */ @Test public void queryMore() throws IOException { final Query query = session.query("1 to 3"); int c = 0; while(query.more()) assertEqual(++c, query.next()); query.close(); } /** Queries binary content. * @throws IOException I/O exception */ @Test public void queryNullBinary() throws IOException { session.execute("create db " + NAME); session.store("X", new ArrayInput("\0")); assertEqual("\0", session.execute("xquery " + RAW + _DB_RETRIEVE.args(NAME, "X"))); assertEqual("\0", session.query(RAW + _DB_RETRIEVE.args(NAME, "X")).execute()); final Query q = session.query(RAW + _DB_RETRIEVE.args(NAME, "X")); assertTrue(q.more()); assertEqual("\0", q.next()); assertFalse(q.more()); } /** Queries empty content. * @throws IOException I/O exception */ @Test public void queryEmptyBinary() throws IOException { session.execute("create db " + NAME); session.store("X", new ArrayInput("")); assertEqual("", session.execute("xquery " + RAW + _DB_RETRIEVE.args(NAME, "X"))); assertEqual("", session.query(RAW + _DB_RETRIEVE.args(NAME, "X")).execute()); final Query q = session.query(RAW + _DB_RETRIEVE.args(NAME, "X")); assertTrue(q.more()); assertEqual("", q.next()); assertNull(q.next()); } /** Queries empty content. * @throws IOException I/O exception */ @Test public void queryEmptyString() throws IOException { final Query q = session.query("'',1"); assertTrue(q.more()); assertEqual("", q.next()); assertTrue(q.more()); assertEqual("1", q.next()); assertNull(q.next()); } /** Queries binary content (works only if output stream is specified). * @throws IOException I/O exception */ @Test public void queryBinary() throws IOException { if(out == null) return; session.execute("create db " + NAME); final byte[] tmp = { 0, 1, 2, 127, 0, -1, -2, -128 }; session.store("X", new ArrayInput(tmp)); final String retr = _DB_RETRIEVE.args(NAME, "X"); // check command session.execute("xquery " + RAW + retr + ',' + retr); assertTrue(eq(out.toArray(), concat(tmp, tmp))); out.reset(); // check query execution session.query(RAW + retr + ',' + retr).execute(); assertTrue(eq(out.toArray(), concat(tmp, tmp))); out.reset(); // check iterator final Query q = session.query(RAW + retr + ',' + retr); q.next(); assertTrue(eq(out.toArray(), tmp)); out.reset(); q.next(); assertTrue(eq(out.toArray(), tmp)); assertNull(q.next()); } /** Runs a query, omitting more(). * @throws IOException I/O exception */ @Test public void queryNoMore() throws IOException { final Query query = session.query("1 to 2"); assertEqual("1", query.next()); assertEqual("2", query.next()); assertNull(query.next()); query.close(); } /** Runs a query with additional serialization parameters. * @throws IOException I/O exception */ @Test public void querySerial1() throws IOException { session.execute("set serializer wrap-prefix=db,wrap-uri=ns"); final Query query = session.query(WRAPPER + "()"); assertTrue("Result expected.", query.more()); assertEqual("", query.next()); assertFalse("No result expected.", query.more()); } /** Runs a query with additional serialization parameters. * @throws IOException I/O exception */ @Test public void querySerial2() throws IOException { final Query query = session.query(WRAPPER + "1 to 2"); assertTrue("Result expected.", query.more()); assertEqual(" 1" + " 2", query.next()); } /** Runs a query with an external variable declaration. * @throws IOException I/O exception */ @Test public void queryBind() throws IOException { final Query query = session.query("declare variable $a external; $a"); query.bind("$a", "4"); assertEqual("4", query.execute()); query.bind("$a", "5"); assertEqual("5", query.next()); query.bind("$a", "6"); assertEqual("6", query.next()); query.close(); } /** Runs a query with an external variable declaration. * @throws IOException exception */ @Test(expected = BaseXException.class) public void queryBind2() throws IOException { session.query("declare variable $a external; $a").next(); } /** Runs a query with an external variable declaration. * @throws IOException I/O exception */ @Test public void queryBindURI() throws IOException { final Query query = session.query("declare variable $a external; $a"); query.bind("$a", "X", "xs:anyURI"); assertEqual("X", query.next()); query.close(); } /** Runs a query with an external variable declaration. * @throws IOException I/O exception */ @Test public void queryBindInt() throws IOException { final Query query = session.query("declare variable $a as xs:integer external; $a"); query.bind("a", "5", "xs:integer"); assertEqual("5", query.next()); query.close(); } /** Runs a query with an external variable declaration. * @throws IOException I/O exception */ @Test public void queryBindDynamic() throws IOException { final Query query = session.query("declare variable $a as xs:integer external; $a"); query.bind("a", "1"); assertEqual("1", query.execute()); query.close(); } /** Binds a document node to an external variable. * @throws IOException I/O exception */ @Test public void queryBindDoc() throws IOException { final Query query = session.query("declare variable $a external; $a//text()"); query.bind("$a", "XML", "document-node()"); assertEqual("XML", query.execute()); } /** Runs a query with a bound context item. * @throws IOException I/O exception */ @Test public void queryContext() throws IOException { final Query query = session.query("."); query.context("5"); assertEqual("5", query.next()); query.close(); } /** Runs a query with a bound context item. * @throws IOException I/O exception */ @Test public void queryContextInt() throws IOException { final Query query = session.query(". * 2"); query.context("6", "xs:integer"); assertEqual("12", query.next()); query.close(); } /** Runs a query with a bound context item. * @throws IOException I/O exception */ @Test public void queryContextVar() throws IOException { final Query query = session.query("declare variable $a := .; $a"); query.context("", "element()"); assertEqual("", query.next()); query.close(); } /** Runs a query, omitting more(). * @throws IOException I/O exception */ @Test public void queryInfo() throws IOException { final Query query = session.query("1 to 2"); query.execute(); query.close(); } /** Runs a query and checks the serialization parameters. * @throws IOException I/O exception */ @Test public void queryOptions() throws IOException { final Query query = session.query("declare option output:encoding 'US-ASCII';()"); query.execute(); final SerializerProp sp = new SerializerProp(query.options()); assertEquals("US-ASCII", sp.get(SerializerProp.S_ENCODING)); query.close(); } /** Runs a query and checks the updating flag. * @throws IOException I/O exception */ @Test public void queryUpdating() throws IOException { // test non-updating query Query query = session.query("12345678"); assertFalse(query.updating()); assertEqual("12345678", query.execute()); assertFalse(query.updating()); query.close(); // test updating query query = session.query("insert node into "); assertTrue(query.updating()); assertEqual("", query.execute()); assertTrue(query.updating()); query.close(); } /** Runs an erroneous query. * @throws IOException expected exception*/ @Test(expected = BaseXException.class) public void queryError() throws IOException { session.query("(").next(); } /** Runs an erroneous query. * @throws IOException expected exception*/ @Test(expected = BaseXException.class) public void queryError2() throws IOException { session.query("(1,'a')[. eq 1]").execute(); } /** Runs an erroneous query. * @throws IOException expected exception*/ @Test(expected = BaseXException.class) public void queryError3() throws IOException { final Query query = session.query("(1,'a')[. eq 1]"); assertEqual("1", query.next()); query.next(); } /** Runs two queries in parallel. * @throws IOException I/O exception */ @Test public void queryParallel() throws IOException { final Query query1 = session.query("1 to 2"); final Query query2 = session.query("reverse(3 to 4)"); assertEqual("1", query1.next()); assertEqual("4", query2.next()); assertEqual("2", query1.next()); assertEqual("3", query2.next()); assertNull(query1.next()); assertNull(query2.next()); query1.close(); query2.close(); } /** Runs 5 queries in parallel. * @throws IOException I/O exception */ @Test public void queryParallel2() throws IOException { final int size = 8; final Query[] cqs = new Query[size]; for(int q = 0; q < size; q++) cqs[q] = session.query(Integer.toString(q)); for(int q = 0; q < size; q++) assertEqual(q, cqs[q].next()); for(final Query query : cqs) query.close(); } /** Binds maps to external variables via JSON. * @throws IOException I/O exception */ @Test public void queryBindJson() throws IOException { final String var = "declare variable $x external;", map = "{\"foo\":[1,2,3],\"bar\":{\"a\":null,\"\":false}}"; final String[][] tests = { {"for $k in map:keys($x) order by $k descending return $k", "foo bar"}, {"every $k in map:keys($x('foo')) satisfies $k eq $x('foo')($k)", "true"}, {"empty($x('bar')('a')) and not($x('bar')(''))", "true"}, }; for(final String[] test : tests) { final Query q = session.query(var + test[0]); try { q.bind("$x", map, "json"); assertEqual(test[1], q.execute()); } finally { q.close(); } } } /** * Checks if the most recent output equals the specified string. * @param exp expected string * @param ret string returned from the client API */ protected final void assertEqual(final Object exp, final Object ret) { final String result = (out != null ? out : ret).toString(); if(out != null) out.reset(); assertEquals(exp.toString(), result.replaceAll("\\r|\\n", "")); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/server/XdmInfoTest.java000066400000000000000000000201661222453003200265730ustar00rootroot00000000000000package org.basex.test.server; import static org.junit.Assert.*; import java.io.*; import java.util.*; import org.basex.*; import org.basex.core.*; import org.basex.io.in.*; import org.basex.io.out.*; import org.basex.server.*; import org.basex.test.*; import org.basex.util.*; import org.junit.*; /** * This class tests the correctness of the item types of the client API. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class XdmInfoTest extends SandboxTest { /** Server reference. */ private static BaseXServer server; /** Client session. */ private static TestSession session; /** * Starts a session. * @throws Exception exception */ @BeforeClass public static void start() throws Exception { server = createServer(); session = new TestSession(Text.LOCALHOST, 9999, Text.ADMIN, Text.ADMIN); } /** * Stops a session. * @throws Exception exception */ @AfterClass public static void stop() throws Exception { session.close(); stopServer(server); } /** * Tests the returned item types. * @throws IOException I/O exception */ @Test public void testIter() throws IOException { for(final Object[] t : TYPES) { if(t.length < 2) continue; final TestQuery tq = session.query(t[1].toString()); final TestItem ti = tq.iter(); assertSame("Types are different.\nExpected: " + t[0] + "\nFound: " + TYPES[ti.type][0], t, TYPES[ti.type]); assertEquals(Token.string(ti.result), TYPES[ti.type][2]); tq.close(); } } /** * Tests the returned XDM information. * @throws IOException I/O exception */ @Test public void testFull() throws IOException { for(final Object[] t : TYPES) { if(t.length < 2) continue; final TestQuery tq = session.query(t[1].toString()); final TestItem ti = tq.full(); assertSame("Types are different.\nExpected: " + t[0] + "\nFound: " + TYPES[ti.type][0], t, TYPES[ti.type]); assertEquals(Token.string(ti.result), TYPES[ti.type][2]); if(t.length > 3) assertEquals(Token.string(ti.uri), TYPES[ti.type][3]); tq.close(); } } /** * Extends the client session. */ private static class TestSession extends ClientSession { /** * Constructor. * @param host host name * @param port port * @param user user name * @param pass password * @throws IOException I/O exception */ TestSession(final String host, final int port, final String user, final String pass) throws IOException { super(host, port, user, pass); } @Override public TestQuery query(final String query) throws IOException { return new TestQuery(query, this); } /** * Executes a command and sends the result to the specified output stream. * @param cmd server command * @param arg argument * @return string * @throws IOException I/O exception */ byte[] exec(final ServerCmd cmd, final String arg) throws IOException { final ArrayOutput o = new ArrayOutput(); sout.write(cmd.code); send(arg); sout.flush(); final BufferInput bi = new BufferInput(sin); ClientSession.receive(bi, o); if(!ClientSession.ok(bi)) throw new BaseXException(bi.readString()); return o.toArray(); } } /** * Extends the client session. */ private static class TestQuery extends ClientQuery { /** * Constructor. * @param q query string * @param s session reference * @throws IOException I/O exception */ TestQuery(final String q, final TestSession s) throws IOException { super(q, s, null); } /** * Returns a full result item. * @return full string * @throws IOException I/O exception */ TestItem full() throws IOException { final byte[] f = ((TestSession) cs).exec(ServerCmd.FULL, id); final TestItem ti = new TestItem(); ti.type = f[0]; if(TYPES[ti.type].length > 3) { for(int b = 1; b < f.length; b++) { if(f[b] == 0) { ti.uri = Arrays.copyOfRange(f, 1, b); ti.result = Arrays.copyOfRange(f, b + 1, f.length); break; } } assertNotNull("No extended info: " + TYPES[ti.type][0], ti.uri); } else { ti.result = Arrays.copyOfRange(f, 1, f.length); } return ti; } /** * Returns a typed result. * @return full string * @throws IOException I/O exception */ TestItem iter() throws IOException { final byte[] f = ((TestSession) cs).exec(ServerCmd.RESULTS, id); final TestItem ti = new TestItem(); ti.type = f[0]; ti.result = Arrays.copyOfRange(f, 1, f.length); return ti; } } /** * Resulting item. */ static class TestItem { /** Item kind/type. */ int type; /** Optional URI. */ byte[] uri; /** Result. */ byte[] result; } /** *

    Examples for available data types.

    *
      *
    • Array position: type id
    • *
    • Entry 1: node type
    • *
    • Entry 2: example
    • *
    • Entry 3: textual result
    • *
    */ public static final Object[][] TYPES = { { }, { }, { }, { }, { }, { }, { }, // code: 7 { "function item" }, // code: 8 and higher { "node()" }, { "text()", "text { 'a' }", "a" }, { "processing-instruction()", "processing-instruction { 'a' } { 'b' }", "" }, { "element()", "
    ", "" }, { "document-node()", "document { 'a' }", "a", "" }, { "document-node(element())", "document { }", "", "" }, { "attribute()" }, { "comment()", "comment { 'a' } ", "" }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, // code: 32 and higher { "item()" }, { "xs:untyped" }, { "xs:anyType" }, { "xs:anySimpleType" }, { "xs:anyAtomicType" }, { "xs:untypedAtomic", "data(a)", "a" }, { "xs:string", "'a'", "a" }, { "xs:normalizedString", "xs:normalizedString('a')", "a" }, { "xs:token", "xs:token('a')", "a" }, { "xs:language", "xs:language('a')", "a" }, { "xs:NMTOKEN", "xs:NMTOKEN('a')", "a" }, { "xs:Name", "xs:Name('a')", "a" }, { "xs:NCName", "xs:NCName('a')", "a" }, { "xs:ID", "xs:ID('a')", "a" }, { "xs:IDREF", "xs:IDREF('a')", "a" }, { "xs:ENTITY", "xs:ENTITY('a')", "a" }, { "xs:float", "xs:float(1)", "1" }, { "xs:double", "1.1e0", "1.1" }, { "xs:decimal", "1.1", "1.1" }, { "xs:precisionDecimal" }, { "xs:integer", "1", "1" }, { "xs:nonPositiveInteger", "xs:nonPositiveInteger(-1)", "-1" }, { "xs:negativeInteger", "xs:negativeInteger(-1)", "-1" }, { "xs:long", "xs:long(1)", "1" }, { "xs:int", "xs:int(1)", "1" }, { "xs:short", "xs:short(1)", "1" }, { "xs:byte", "xs:byte(1)", "1" }, { "xs:nonNegativeInteger", "xs:nonNegativeInteger(1)", "1" }, { "xs:unsignedLong", "xs:unsignedLong(1)", "1" }, { "xs:unsignedInt", "xs:unsignedInt(1)", "1" }, { "xs:unsignedShort", "xs:unsignedShort(1)", "1" }, { "xs:unsignedByte", "xs:unsignedByte(1)", "1" }, { "xs:positiveInteger", "xs:positiveInteger(1)", "1" }, { "xs:duration", "xs:duration('P1Y')", "P1Y" }, { "xs:yearMonthDuration", "xs:yearMonthDuration('P1Y')", "P1Y" }, { "xs:dayTimeDuration", "xs:dayTimeDuration('PT1M')", "PT1M" }, { "xs:dateTime", "xs:dateTime('2001-01-01T23:59:59')", "2001-01-01T23:59:59" }, { "xs:dateTimeStamp" }, { "xs:date", "xs:date('2001-01-01')", "2001-01-01" }, { "xs:time", "xs:time('01:01:01')", "01:01:01" }, { "xs:gYearMonth", "xs:gYearMonth('2001-01')", "2001-01" }, { "xs:gYear", "xs:gYear('2001')", "2001" }, { "xs:gMonthDay", "xs:gMonthDay(' --01-01 ')", "--01-01" }, { "xs:gDay", "xs:gDay('---01')", "---01" }, { "xs:gMonth", "xs:gMonth('--01')", "--01" }, { "xs:boolean", "true()", "true" }, { "basex:binary" }, { "xs:base64Binary", "xs:base64Binary('aaaa')", "aaaa" }, { "xs:hexBinary", "xs:hexBinary('aa')", "AA" }, { "xs:anyURI", "xs:anyURI('a')", "a" }, { "xs:QName", "xs:QName('xml:a')", "xml:a", "http://www.w3.org/XML/1998/namespace" }, { "xs:NOTATION" } }; } basex-7.7.2/basex-core/src/test/java/org/basex/test/server/package.html000066400000000000000000000001171222453003200257770ustar00rootroot00000000000000 Contains classes for testing the Client/Server architecture. basex-7.7.2/basex-core/src/test/java/org/basex/test/util/000077500000000000000000000000001222453003200231665ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/java/org/basex/test/util/BitArrayTest.java000066400000000000000000000044531222453003200264140ustar00rootroot00000000000000package org.basex.test.util; import static org.junit.Assert.*; import org.basex.util.*; import org.junit.*; /** * Tests for {@link BitArray}. * * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ public final class BitArrayTest { /** Instance of {@link BitArray}. */ private BitArray a; /** Create an instance of {@link BitArray}. */ @Before public void setUp() { a = new BitArray(); } /** Test method for {@link BitArray#toArray()}. */ @Test public void getTrimmedWords() { a.init(new long[] {-1L, 0L}, 64); assertEquals("Array not trimmed correctly", 1, a.toArray().length); } /** Test method for {@link BitArray#get(int)}. */ @Test public void get() { a.init(new long[] {-1L, 0L}, 65); assertTrue("Bit 63 is 0", a.get(63)); assertFalse("Bit 64 is 1", a.get(64)); } /** Test method for {@link BitArray#set(int)}. */ @Test public void set() { a.set(128); assertTrue("Bit 128 is 0", a.get(128)); a.init(); a.set(129); assertTrue("Bit 129 is 0", a.get(129)); } /** Test method for {@link BitArray#clear(int)}. */ @Test public void clear() { a.init(new long[] {-1L, 0L}, 64); a.clear(63); assertFalse("Bit 63 is 1", a.get(63)); } /** Test method for {@link BitArray#nextFree(int)}. */ @Test public void nextFree() { a.init(new long[] {-1L, 0L}, 64); assertEquals("Incorrect next clear bit", 64, a.nextFree(0)); } /** Test method for {@link BitArray#nextFree(int)}. */ @Test public void nextSet() { a.init(new long[] {0L, -1L}, 128); assertEquals("Incorrect next clear bit", 64, a.nextSet(0)); assertEquals("Incorrect next clear bit", 64, a.nextSet(64)); assertEquals("Incorrect next clear bit", 67, a.nextSet(67)); assertEquals("Incorrect next clear bit", -1, a.nextSet(128)); } /** Test method for {@link BitArray#cardinality()}. */ @Test public void cardinality() { a.init(new long[] { 0L }, 0); assertEquals(0, a.cardinality()); a.set(1); assertEquals(1, a.cardinality()); a.set(64); assertEquals(2, a.cardinality()); a.set(3); assertEquals(3, a.cardinality()); a.clear(64); assertEquals(2, a.cardinality()); a.clear(3); assertEquals(1, a.cardinality()); a.clear(1); assertEquals(0, a.cardinality()); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/util/CompressTest.java000066400000000000000000000056111222453003200264670ustar00rootroot00000000000000package org.basex.test.util; import static org.basex.util.Token.*; import static org.junit.Assert.*; import java.util.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.item.*; import org.basex.test.*; import org.basex.util.*; import org.basex.util.list.*; import org.junit.*; /** * Class for testing the {@link Compress} methods. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class CompressTest extends SandboxTest { /** Test. */ @Test public void test1() { run(token(" abcdefghijklmnopqrstuvwxyz")); } /** Test. */ @Test public void test2() { run(token("ABCDEFGHIJKLMNOPQRSTUVWXYZ")); } /** Test. */ @Test public void test3() { run(token("abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ " + "1234567890")); } /** Test. */ @Test public void test4() { final byte[] b = new byte[65]; for(int i = 0; i < b.length; i++) b[i] = (byte) i; run(b); } /** Test. */ @Test public void test5() { final byte[] b = new byte[256]; for(int i = 0; i < b.length; i++) b[i] = (byte) i; run(b); } /** Test. */ @Test public void test6() { final byte[] b = new byte[4096]; for(int i = 0; i < b.length; i++) b[i] = (byte) (i & 0xFF); run(b); } /** Test. * @throws Exception exception */ @Test public void test7() throws Exception { texts("src/test/resources/xmark.xml"); } /** Test. * @throws Exception exception */ @Test public void test8() throws Exception { texts("src/test/resources/factbook.zip"); } /** * Test on all text nodes of a document. * @param file file to be parsed * @throws Exception exception */ private static void texts(final String file) throws Exception { final String query = "let $doc := doc('" + file + "')" + "for $i in $doc//(@hohoho | text()) return data($i)"; final TokenList tl = new TokenList(); final TokenBuilder tb = new TokenBuilder(); final QueryProcessor qp = new QueryProcessor(query, context); final Iter ir = qp.iter(); for(Item it; (it = ir.next()) != null;) { final byte[] token = it.string(null); tl.add(token); tb.add(token).add(' '); } qp.close(); run(tl.toArray()); run(tb.finish()); } /** * Tests the correctness of the compressed tokens. * @param tokens test tokens */ private static void run(final byte[]... tokens) { final Compress comp = new Compress(); for(final byte[] token : tokens) { final byte[] cpr = comp.pack(token); if(token != cpr) { final byte[] pln = comp.unpack(cpr); if(!eq(token, pln)) { fail("\n[E] " + Arrays.toString(token) + ",\n[F] " + Arrays.toString(pln)); } } } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/util/FTBitapSearchTest.java000066400000000000000000000120041222453003200273050ustar00rootroot00000000000000package org.basex.test.util; import static org.basex.util.Token.*; import static org.junit.Assert.*; import java.util.*; import org.basex.query.*; import org.basex.query.ft.*; import org.basex.util.*; import org.basex.util.ft.*; import org.basex.util.ft.FTBitapSearch.TokenComparator; import org.basex.util.list.*; import org.junit.*; /** * Test {@link FTBitapSearch} methods. * * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ public final class FTBitapSearchTest { /** Simple comparator. */ private static final TokenComparator CMP = new TokenComparator() { @Override public boolean equal(final byte[] o1, final byte[] o2) { return eq(o1, o2); } }; /** * Test data. * @author Dimitar Popov */ public static class TestData { /** Set to search in. */ public final FTIterator haystack; /** Set to search for. */ public final FTTokens needles; /** Indices of expected hits. */ public final int[] expected; /** * Constructor. * @param h haystack * @param n needle * @param e expected hits */ public TestData(final String[] h, final String[][] n, final int[] e) { expected = e; final byte[][] hs = new byte[h.length][]; for(int i = 0; i < h.length; i++) hs[i] = token(h[i]); haystack = new FTIterator() { /** Index of current element. */ private int cnt; @Override public boolean hasNext() { return cnt < hs.length; } @Override public byte[] nextToken() { if(hasNext()) return hs[cnt++]; throw new NoSuchElementException(); } @Override public FTSpan next() { return null; } @Override public FTIterator init(final byte[] text) { return this; } }; needles = new FTTokens(); for(final String[] s : n) { final TokenList needle = new TokenList(s.length); for(final String t : s) needle.add(t); needles.add(needle); } } } /** Test data. */ private static final TestData[] TESTS = new TestData[] { new TestData( new String[] { "token1", "token1", "token2", "token3", "token4", "token1", "token2", "token3", "token3" }, new String[][] { { "token1", "token2" } }, new int[] { 1, 5 }), new TestData( new String[] { "token1" }, new String[][] { { "token1" } }, new int[] { 0 }), new TestData( new String[] { "token1" }, new String[][] { { "token2" } }, new int[] { }), new TestData( new String[] { "token1" }, new String[][] { { } }, new int[] { }), new TestData( new String[] { "token1", "token2", "token1", "token2", "token1" }, new String[][] { { "token1", "token2", "token1" } }, new int[] { 0, 2 }), new TestData( new String[] { "token", "token", "token" }, new String[][] { { "token", "token" } }, new int[] { 0, 1}), new TestData( new String[] { }, new String[][] { { "token", "token" } }, new int[] { }), new TestData( new String[] { }, new String[][] { { } }, new int[] { }), new TestData( new String[] { "token" }, new String[][] { }, new int[] { }), new TestData( new String[] { "token1", "token2", "token3" }, new String[][] { { "token2", "token3" }, { "token2" } }, new int[] { 1, 1}), new TestData( new String[] { "token1", "token2", "token3" }, new String[][] { { "token2" }, { "token2", "token3" } }, new int[] { 1, 1 }), new TestData( new String[] { "token1", "token2", "token3" }, new String[][] { { "token2" }, { "token1", "token2" } }, new int[] { 0})}; /** Pre-initialized {@link FTBitapSearch} objects. */ private FTBitapSearch[] searches; /** Set up method. */ @Before public void setUp() { searches = new FTBitapSearch[TESTS.length]; for(int i = 0; i < searches.length; i++) { searches[i] = new FTBitapSearch(TESTS[i].haystack, TESTS[i].needles, CMP); } } /** Test search. */ @Test public void searchIter() { try { for(int i = 0; i < TESTS.length; i++) { final FTBitapSearch s = searches[i]; for(int j = 0; j < TESTS[i].expected.length; j++) { if(!s.hasNext()) fail("Test " + i + ": expected " + TESTS[i].expected.length + " hits, got only " + (j + 1)); final int pos = s.next(); if(pos != TESTS[i].expected[j]) fail("Test " + i + ", result " + j + ": expected " + TESTS[i].expected[j] + ", got " + pos); } if(s.hasNext()) fail("Test " + i + ": expected " + TESTS[i].expected.length + " hits, got more!"); } } catch(final QueryException ex) { fail(Util.message(ex)); } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/util/MinHeapTest.java000066400000000000000000000024241222453003200262140ustar00rootroot00000000000000package org.basex.test.util; import static org.junit.Assert.*; import java.util.*; import org.basex.util.*; import org.junit.*; /** * Tests for the {@link MinHeap} implementation. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class MinHeapTest { /** Checks if the heap can be used for sorting. */ @Test public void heapSort() { final MinHeap heap = new MinHeap(2, null); final Integer[] vals = new Integer[1000]; for(int i = 0; i < vals.length; i++) vals[i] = i; Collections.shuffle(Arrays.asList(vals)); for(final int i : vals) { heap.insert(i, i); heap.verify(); } int i = 0; while(!heap.isEmpty()) { assertEquals(Integer.valueOf(i++), heap.removeMin()); heap.verify(); } assertEquals(1000, i); } /** Checks if the heap can be used for sorting a pre-sorted sequence. */ @Test public void heapPreSort() { final MinHeap heap = new MinHeap(2, null); for(int i = 0; i < 1000; i++) { heap.insert(i, i); heap.verify(); } int i = 0; while(!heap.isEmpty()) { assertEquals(i++, heap.removeMin().intValue()); heap.verify(); } assertEquals(1000, i); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/util/StringListTest.java000066400000000000000000000012001222453003200267640ustar00rootroot00000000000000package org.basex.test.util; import static org.junit.Assert.*; import org.basex.util.list.StringList; import org.junit.Test; /** * Tests for the {@link StringList} implementation. * * @author BaseX Team 2005-12, BSD License */ public class StringListTest { /** Tests {@code containsAll(l)} function. */ @Test public void containsAllTest() { final StringList list1 = new StringList(new String[] {"A", "B", "C"}), list2 = new StringList(new String[] {"A", "C"}); assertTrue("List1 does contain list2", list1.containsAll(list2)); assertFalse("List2 does not contain list1.", list2.containsAll(list1)); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/util/TokenSetTest.java000066400000000000000000000033521222453003200264300ustar00rootroot00000000000000package org.basex.test.util; import static org.junit.Assert.*; import org.basex.util.hash.*; import org.basex.util.list.*; import org.junit.*; /** * Token set tests. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public class TokenSetTest { /** Number of tests. */ private static final int SIZE = 100000; /** Token list. */ private static final TokenList LIST = new TokenList(SIZE); /** Token set. */ private final TokenSet set = new TokenSet(); /** Initializes the tests. */ @BeforeClass public static void init() { for(int i = 0; i < SIZE; i++) LIST.add(new byte[] { (byte) (i >>> 24), (byte) (i >> 16), (byte) (i >> 8), (byte) i }); } /** Initializes a single test. */ @Before public void initTest() { for(final byte[] t : LIST) set.add(t); } /** Tests added tokens. */ @Test public void add() { assertEquals(SIZE, set.size()); for(final byte[] t : LIST) assertTrue("Token is missing.", set.contains(t)); } /** Tests removed tokens. */ @Test public void delete() { for(final byte[] t : LIST) set.delete(t); for(final byte[] t : LIST) assertFalse("Token exists.", set.contains(t)); } /** Tests removed tokens. */ @Test public void addDelete() { for(final byte[] t : LIST) set.add(t); for(final byte[] t : LIST) assertTrue("Token is missing.", set.contains(t)); for(final byte[] t : LIST) set.delete(t); for(final byte[] t : LIST) assertFalse("Token exists.", set.contains(t)); for(final byte[] t : LIST) set.add(t); for(final byte[] t : LIST) assertTrue("Token is missing.", set.contains(t)); for(final byte[] t : LIST) set.delete(t); for(final byte[] t : LIST) assertFalse("Token exists.", set.contains(t)); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/util/UTF8Test.java000066400000000000000000000033101222453003200254140ustar00rootroot00000000000000package org.basex.test.util; import static org.basex.util.Token.*; import static org.junit.Assert.*; import java.nio.charset.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.test.*; import org.junit.*; /** * This class tests String <-> Token conversions. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class UTF8Test extends SandboxTest { /** UTF8 character set. */ private static final Charset CS_UTF8 = Charset.availableCharsets().get(UTF8); /** * Tests for all valid code points if characters are properly converted. */ @Test public void string2token2string() { for(int i = 0; i <= Character.MAX_CODE_POINT; i++) { final String s = new String(Character.toChars(i)); assertEquals(s, string(token(s))); } } /** * Tests for all valid code points if characters are properly converted. */ @Test public void token2string() { for(int i = 0; i <= Character.MAX_CODE_POINT; i++) { if(i >= Character.MIN_SURROGATE && i <= Character.MAX_SURROGATE) continue; final String s = new String(Character.toChars(i)); assertEquals(s, string(s.getBytes(CS_UTF8))); } } /** * Tests entity parsing with codepoints. * @throws BaseXException database exception */ @Test public void entities() throws BaseXException { for(int i = 0xA0; i <= Character.MAX_CODE_POINT; i++) { final String qu = new XQuery("'&#" + i + ";'").execute(context); assertEquals(new String(Character.toChars(i)), qu); if(i == 0x400) i = 0xFFF; else if(i == 0x1400) i = 0xFFFF; else if(i == 0x10400) i = 0x10FBFF; } } } basex-7.7.2/basex-core/src/test/java/org/basex/test/util/VersionTest.java000066400000000000000000000173411222453003200263240ustar00rootroot00000000000000package org.basex.test.util; import static org.basex.util.Token.*; import static org.junit.Assert.*; import org.basex.util.*; import org.junit.*; /** * EXPath package API: Version tests. * * @author BaseX Team 2005-12, BSD License * @author Rositsa Shadura */ public final class VersionTest { /** * Tests method isCompatible. */ @Test public void compatible() { // case 1: template = 3 final Version semVer1 = new Version(token("3")); assertTrue(new Version(token("3.0")).isCompatible(semVer1)); assertTrue(new Version(token("3.1")).isCompatible(semVer1)); assertTrue(new Version(token("3.9")).isCompatible(semVer1)); assertTrue(new Version(token("3.2.4")).isCompatible(semVer1)); assertTrue(new Version(token("3.9.89")).isCompatible(semVer1)); assertFalse(new Version(token("4")).isCompatible(semVer1)); assertFalse(new Version(token("2.7.4")).isCompatible(semVer1)); // case 2: template = 3.5 final Version semVer2 = new Version(token("3.5")); assertTrue(new Version(token("3.5")).isCompatible(semVer2)); assertTrue(new Version(token("3.5.45")).isCompatible(semVer2)); assertFalse(new Version(token("3.6")).isCompatible(semVer2)); assertFalse(new Version(token("2.7.4")).isCompatible(semVer2)); assertFalse(new Version(token("3.4")).isCompatible(semVer2)); // case 3: template = 3.4.7 final Version semVer3 = new Version(token("3.4.7")); assertTrue(new Version(token("3.4.7")).isCompatible(semVer3)); assertFalse(new Version(token("3.4")).isCompatible(semVer3)); assertFalse(new Version(token("3.4.8")).isCompatible(semVer3)); assertFalse(new Version(token("3")).isCompatible(semVer3)); } /** * Tests comparison between version, which is compatible to and greater than a * given version template. */ @Test public void compatGreater() { // case 1: template = 3 final Version semVer1 = new Version(token("3")); final Version v1 = new Version(token("3")); assertTrue(v1.isCompatible(semVer1) || v1.compareTo(semVer1) > 0); final Version v2 = new Version(token("3.4")); assertTrue(v2.isCompatible(semVer1) || v2.compareTo(semVer1) > 0); final Version v3 = new Version(token("3.4.55")); assertTrue(v3.isCompatible(semVer1) || v3.compareTo(semVer1) > 0); final Version v4 = new Version(token("2.6")); assertFalse(v4.isCompatible(semVer1) || v4.compareTo(semVer1) > 0); // case 2: template = 3.5 final Version semVer2 = new Version(token("3.5")); final Version vv1 = new Version(token("3.5")); assertTrue(vv1.isCompatible(semVer2) || vv1.compareTo(semVer2) > 0); final Version vv2 = new Version(token("3.5.6")); assertTrue(vv2.isCompatible(semVer2) || vv2.compareTo(semVer2) > 0); final Version vv3 = new Version(token("9")); assertTrue(vv3.isCompatible(semVer2) || vv3.compareTo(semVer2) > 0); final Version vv4 = new Version(token("3.4")); assertFalse(vv4.isCompatible(semVer2) || vv4.compareTo(semVer2) > 0); final Version vv5 = new Version(token("3.6")); assertTrue(vv5.isCompatible(semVer2) || vv5.compareTo(semVer2) > 0); // case 3: template = 3.4.7 final Version semVer3 = new Version(token("3.4.7")); final Version vvv1 = new Version(token("3.4.7")); assertTrue(vvv1.isCompatible(semVer3) || vvv1.compareTo(semVer3) > 0); final Version vvv2 = new Version(token("3.4.77")); assertTrue(vvv2.isCompatible(semVer3) || vvv2.compareTo(semVer3) > 0); final Version vvv3 = new Version(token("3.6")); assertTrue(vvv3.isCompatible(semVer3) || vvv3.compareTo(semVer3) > 0); final Version vvv4 = new Version(token("101")); assertTrue(vvv4.isCompatible(semVer3) || vvv4.compareTo(semVer3) > 0); final Version vvv5 = new Version(token("3.4")); assertFalse(vvv5.isCompatible(semVer3) || vvv5.compareTo(semVer3) > 0); final Version vvv6 = new Version(token("3.4.0")); assertFalse(vvv6.isCompatible(semVer3) || vvv6.compareTo(semVer3) > 0); final Version vvv7 = new Version(token("3.2")); assertFalse(vvv7.isCompatible(semVer3) || vvv7.compareTo(semVer3) > 0); final Version vvv8 = new Version(token("1.0")); assertFalse(vvv8.isCompatible(semVer3) || vvv8.compareTo(semVer3) > 0); } /** * Tests comparison between version, which is compatible to and smaller than a * given version template. */ @Test public void compatSmaller() { // case 1: template = 3 final Version semVer1 = new Version(token("3")); final Version v1 = new Version(token("3")); assertTrue(v1.isCompatible(semVer1) || v1.compareTo(semVer1) < 0); final Version v2 = new Version(token("2.4")); assertTrue(v2.isCompatible(semVer1) || v2.compareTo(semVer1) < 0); final Version v3 = new Version(token("2")); assertTrue(v3.isCompatible(semVer1) || v3.compareTo(semVer1) < 0); final Version v4 = new Version(token("4.6.55")); assertFalse(v4.isCompatible(semVer1) || v4.compareTo(semVer1) < 0); // case 2: template = 3.5 final Version semVer2 = new Version(token("3.5")); final Version vv1 = new Version(token("3.5")); assertTrue(vv1.isCompatible(semVer2) || vv1.compareTo(semVer2) < 0); final Version vv2 = new Version(token("3.5.0")); assertTrue(vv2.isCompatible(semVer2) || vv2.compareTo(semVer2) < 0); final Version vv3 = new Version(token("2")); assertTrue(vv3.isCompatible(semVer2) || vv3.compareTo(semVer2) < 0); final Version vv4 = new Version(token("3.6")); assertFalse(vv4.isCompatible(semVer2) || vv4.compareTo(semVer2) < 0); final Version vv5 = new Version(token("3.4.66")); assertTrue(vv5.isCompatible(semVer2) || vv5.compareTo(semVer2) < 0); final Version vv6 = new Version(token("6")); assertFalse(vv6.isCompatible(semVer2) || vv6.compareTo(semVer2) < 0); // case 3: template = 3.4.7 final Version semVer3 = new Version(token("3.4.7")); final Version vvv1 = new Version(token("3.4.7")); assertTrue(vvv1.isCompatible(semVer3) || vvv1.compareTo(semVer3) < 0); final Version vvv2 = new Version(token("3.4.6")); assertTrue(vvv2.isCompatible(semVer3) || vvv2.compareTo(semVer3) < 0); final Version vvv3 = new Version(token("3.3")); assertTrue(vvv3.isCompatible(semVer3) || vvv3.compareTo(semVer3) < 0); final Version vvv4 = new Version(token("1")); assertTrue(vvv4.isCompatible(semVer3) || vvv4.compareTo(semVer3) < 0); final Version vvv5 = new Version(token("3.4.8")); assertFalse(vvv5.isCompatible(semVer3) || vvv5.compareTo(semVer3) < 0); final Version vvv6 = new Version(token("3.5.0")); assertFalse(vvv6.isCompatible(semVer3) || vvv6.compareTo(semVer3) < 0); final Version vvv8 = new Version(token("3.4.0")); assertTrue(vvv8.isCompatible(semVer3) || vvv8.compareTo(semVer3) < 0); } /** * Tests if a version is in a given interval. */ @Test public void interval() { final Version semVerMin1 = new Version(token("3")); final Version semVerMax1 = new Version(token("7")); final Version test1 = new Version(token("3.0")); assertTrue(test1.compareTo(semVerMin1) > 0 && test1.compareTo(semVerMax1) < 0); final Version test2 = new Version(token("3.5")); assertTrue(test2.compareTo(semVerMin1) > 0 && test2.compareTo(semVerMax1) < 0); final Version test3 = new Version(token("6.9")); assertTrue(test3.compareTo(semVerMin1) > 0 && test3.compareTo(semVerMax1) < 0); final Version test4 = new Version(token("7.0")); assertFalse(test4.compareTo(semVerMin1) > 0 && test4.compareTo(semVerMax1) < 0); final Version test5 = new Version(token("7.6.0")); assertFalse(test5.compareTo(semVerMin1) > 0 && test5.compareTo(semVerMax1) < 0); final Version test6 = new Version(token("2.0")); assertFalse(test6.compareTo(semVerMin1) > 0 && test6.compareTo(semVerMax1) < 0); } } basex-7.7.2/basex-core/src/test/java/org/basex/test/util/WesternTokenizerTest.java000066400000000000000000000100271222453003200302130ustar00rootroot00000000000000package org.basex.test.util; import static org.basex.util.Token.*; import static org.junit.Assert.*; import org.basex.util.ft.*; import org.junit.*; /** * Tests for {@link WesternTokenizer}. * * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ public final class WesternTokenizerTest { /** Case sensitive. */ private static final int FTCS = 1; /** Diacritics. */ private static final int FTDC = 2; /** Lower case. */ private static final int FTLC = 4; /** Upper case. */ private static final int FTUC = 8; /** Wild cards. */ private static final int FTWC = 16; /** Full-text options to use. */ private final FTOpt opt = new FTOpt(); /** Test text to tokenize. */ private static final byte[] TEXT = token("\\T\u00e9st.*\\t\u00c4Ste\\\\Toast\\."); /** Test case insensitive. */ @Test public void cI() { run(TEXT, "test", "taste", "toast"); } /** Test case sensitive. */ @Test public void cS() { setFTFlags(FTCS); run(TEXT, "Test", "tASte", "Toast"); } /** Test lower case. */ @Test public void lC() { setFTFlags(FTCS | FTLC); run(TEXT, "test", "taste", "toast"); } /** Test upper case. */ @Test public void uC() { setFTFlags(FTCS | FTUC); run(TEXT, "TEST", "TASTE", "TOAST"); } /** Test + case insensitive. */ @Test public void diaCI() { setFTFlags(FTDC); run(TEXT, "t\u00e9st", "täste", "toast"); } /** Test diacritics + case sensitive. */ @Test public void diaCS() { setFTFlags(FTDC | FTCS); run(TEXT, "T\u00e9st", "t\u00c4Ste", "Toast"); } /** Test diacritics + lower case. */ @Test public void diaLC() { setFTFlags(FTDC | FTCS | FTLC); run(TEXT, "t\u00e9st", "t\u00e4ste", "toast"); } /** Test diacritics + upper case. */ @Test public void diaUC() { setFTFlags(FTDC | FTCS | FTUC); run(TEXT, "T\u00c9ST", "T\u00c4STE", "TOAST"); } /** Test wild cards + case insensitive. */ @Test public void wildCardsCI() { setFTFlags(FTWC); run(TEXT, "\\test.*\\taste", "toast"); } /** Test wild cards + case sensitive. */ @Test public void wildCardsCS() { setFTFlags(FTWC | FTCS); run(TEXT, "\\Test.*\\tASte", "Toast"); } /** Test wild cards + lower case. */ @Test public void wildCardsLC() { setFTFlags(FTWC | FTCS | FTLC); run(TEXT, "\\test.*\\taste", "toast"); } /** Test wild cards + upper case. */ @Test public void wildCardsUC() { setFTFlags(FTWC | FTCS | FTUC); run(TEXT, "\\TEST.*\\TASTE", "TOAST"); } /** Test wild cards + diacritics + case insensitive. */ @Test public void wildCardsDiaCI() { setFTFlags(FTWC | FTDC); run(TEXT, "\\t\u00e9st.*\\t\u00e4ste", "toast"); } /** Test wild cards + diacritics + case sensitive. */ @Test public void wildCardsDiaCS() { setFTFlags(FTWC | FTDC | FTCS); run(TEXT, "\\T\u00e9st.*\\t\u00c4Ste", "Toast"); } /** Test wild cards + diacritics + lower case. */ @Test public void wildCardsDiaLC() { setFTFlags(FTWC | FTDC | FTCS | FTLC); run(TEXT, "\\t\u00e9st.*\\t\u00e4ste", "toast"); } /** Test wild cards + diacritics + upper case. */ @Test public void wildCardsDiaUC() { setFTFlags(FTWC | FTDC | FTCS | FTUC); run(TEXT, "\\T\u00c9ST.*\\T\u00c4STE", "TOAST"); } /** * Perform tokenization test. * @param input input text to tokenize * @param tokens expected tokens */ private void run(final byte[] input, final String... tokens) { final WesternTokenizer tok = new WesternTokenizer(opt); tok.init(input); int i = -1; while(tok.hasNext()) { assertTrue(eq(tok.nextToken(), token(tokens[++i]))); } } /** * Set the full-text option flags. * @param flags bit mask with full-text flags */ private void setFTFlags(final int flags) { if((flags & FTCS) != 0) opt.set(FTFlag.CS, true); if((flags & FTDC) != 0) opt.set(FTFlag.DC, true); if((flags & FTLC) != 0) opt.set(FTFlag.LC, true); if((flags & FTUC) != 0) opt.set(FTFlag.UC, true); if((flags & FTWC) != 0) opt.set(FTFlag.WC, true); } } basex-7.7.2/basex-core/src/test/resources/000077500000000000000000000000001222453003200204325ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/resources/.empty000066400000000000000000000000001222453003200215570ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/resources/.gitignore000066400000000000000000000000001222453003200224100ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/resources/corrupt.xml000066400000000000000000000000011222453003200226410ustar00rootroot00000000000000<basex-7.7.2/basex-core/src/test/resources/dir/000077500000000000000000000000001222453003200212105ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/resources/dir/basex.png000066400000000000000000000021241222453003200230170ustar00rootroot00000000000000‰PNG  IHDR_*tEXtCreation TimeSo 2 Sep 2007 23:40:39 +0100r>ˆtIME× +/£ºf pHYs\F\F”CAgAMA± üa­IDATxÚmSmL[e~Þ~À¤Ðš"tƒèBLŠnòï‘-*&, !n“}ÈüÚ¦ˆ“0ê¦ft.ƒ1üJÜtÿͶ27$°e® ®„®_„ ki{)4PZ¤=¾÷’veÙ“œÜsÎ}ÎóžûžsÙ ?„¶ÃéÙgž@pf±X q0nÍý¸pþš¿>ËZjwSeÅK˜šž%8ju.^îFãñN¦“*• «óóñø“Oãn8‡¸r¥WòµÚLéõ(Z[¼„3:<„Þëý‹Ø¡hZ]ôvÓa2^»JqŒ8éýÏÛ)ÎÍpu€NµŸHpvî~ ½ý Ž,~Jö™¬öÀAfèþ Ó~Ÿ”Ë}h%RãKº¹tºïÔí—ü—«w éXÓêY‚|zܪßÜKÉØºóU©ƒõ wrœs¯ZDêß#Ÿþrt$²ó‚¶ŸÎÒdn. ÕÕ’@ùž=D}H€FS”ä°Pè«/É_THƒ9ä×jh®®–à[ó¹óWÑŸš»t#¹yÁ v~KúB²‹-õô“û¹;ýó9öí#ÿ®]äR¥‘‹çFÝ~sû¡d,K%OëQr¥¦PÐb#'xdŒ¿œ§ñ‚|šji‘4m\pŒ›¯¢BgûvãmÛÈ[RBþß~'bQ(³²°Pµò-¯ P¸+ù݆cgŠвhn–‹°®.øM7°À)4¤¨Õ˜?z áÖ/ZSÌd4…Ã|É2ärDÄeýìS,ðçÚÆ€žüÇ}¡®ÆS^ŽÛ¯½ž£ù¢Á dnÈùfÜg³B]U‰àÝ`Ï­§¨V‹¼[·ll‚î̤×ÔÀ%®T餽¸j#J%Šóò`꺄“^vP»˜ C½i=˜4ê$ôÞ0Q¶bU¥›ðMà“ÎÓxëÝýìæm7…†PSQ)ñnÙaè³`KYK®—%ÎQ1û?’˜ˆú#-’˜èësV°É™(lf³ôN¿ªÊB0›Í”¬!uèñzé_£óãv:´8€ÎS'‘ûÔóÈP¥A—Åfgç(Êóß·~Œ¾éHt´·APjP²¡+–/g8þ£.ÿz³3t7¬æAúîä éh8ÐH¦¿û螈EÉÔŽ´’BÎ'kµY1îñ"‰Üihzz;Öñ80%Àj±ÂhìG4]rï …ªe©àÂø· M>cepoIEND®B`‚basex-7.7.2/basex-core/src/test/resources/dir/input.xml000066400000000000000000000006371222453003200230770ustar00rootroot00000000000000 XML

    Databases & XML

    Assignments
    • Exercise 1
    • Exercise 2
    basex-7.7.2/basex-core/src/test/resources/dir/test.xml000066400000000000000000000006721222453003200227160ustar00rootroot00000000000000 text in child 3 3.4 3 3 basex-7.7.2/basex-core/src/test/resources/dir/xmark.xml000066400000000000000000001022041222453003200230530ustar00rootroot00000000000000 United States 1 duteous nine eighteen Creditcard page rous lady idle authority capt professes stabs monster petition heave humbly removes rescue runs shady peace most piteous worser oak assembly holes patience but malice whoreson mirrors master tenants smocks yielded officer embrace such fears distinction attires shepherd noble supposed dotage humble servilius bitch theirs venus dismal wounds gum merely raise red breaks earth god folds closet captain dying reek Will ship internationally, See description for charges Dominic Takano mailto:Takano@yahoo.com Mechthild Renear mailto:Renear@acm.org 10/12/1999 asses scruple learned crowns preventions half whisper logotype weapons doors factious already pestilent sacks dram atwain girdles deserts flood park lest graves discomfort sinful conceiv therewithal motion stained preventions greatly suit observe sinews enforcement armed gold gazing set almost catesby turned servilius cook doublet preventions shrunk United States 1 great Money order, Cash print deceit arming ros apes unjustly oregon spring hamlet containing leaves italian turn spirit model favour disposition approach charg gold promotions despair flow assured terror assembly marry concluded author debase get bourn openly gonzago wisest bane continue cries Will ship internationally Fumitaka Cenzer mailto:Cenzer@savera.com Lanju Takano mailto:Takano@itc.it 02/24/2000 entreaty hath fowl prescience bounds roof fiend intellect boughs caught add jests feelingly doubt trojans wisdom greatness tune worship doors fields reads canst france pay progeny wisdom stir mov impious promis clothes hangman trebonius choose men fits preparation benefit since eclipse gates Papa Godskesen mailto:Godskesen@uwindsor.ca Ioana Blumberg mailto:Blumberg@conclusivestrategies.com 08/02/2001 jealousy back greg folded gauntlets conduct hardness across sickness peter enough royal herb embrace piteous die servilius avoid laying chance dungeons pleasant thyself fellow purse steward heaven ambassador terrible doubtfully milk sky clouds unbraced put sacrifices seas childish longer flout heavy pitch rosalind orderly music delivery appease United States 1 scarce brook senses concave valiant star further instruments bankrupts countrymen horrid costard youth necessity tend curiously waken witness navy there honest interest perceive defendant chief traffic where nuptial descent travel prepare agreed voices swears remember peerless doing preparation rejoice swear canker barbarian parching coxcomb excess conspiring nobles sounded consider sayings fishified prime may spirit untruths misgives choughs mew here garments tenfold error discontent hung beatrice straight muse shame deep twice mann maecenas any conveyance fingers whereupon child case season presently victory women beating deprive almost wed dreams slew reveal spotted attend burden camillo field enlarge stead corporal ground tormenting naturally sanctuary riddle exile coming awake senseless chance famous albans service cricket limb from clouds amongst shore penker defend quantity dumb churlish uncover swung eros figur sulphur sky birth stare negligent unction shield instance ambition gate injury fort put infants find slavish hugh see afterwards slanders chides eyes minds alb loved endure combating voyage maintained peril rivall suddenly finds studies weary truth indulgence anatomy assisted imminent may excepted yonder aches regal friar prophetess spirits delays turning cassio finding unpractis steel sweets promises credulity err nym complete star greatly mope sorry experience virtues been offending bed drives faction learnt hurl eleven huge piece hours cruelly april league winged tract element sails course placed fouler four plac joint words blessing fortified loving forfeit doctor valiant crying wife county planet charge haughty precious alexander longboat bells lewd kingdoms knife giver frantic raz commend sit sovereignty engaged perceive its art alliance forge bestow perforce complete roof fie confident raging possible cassio teen crave park reign lords sounded our requite fourth confidence high sent fled bids oswald help answer artillery jealous hugh fingers gladly mows our craving preventions spurr edmund drunk how faction quickly bolingbroke painfully valorous line clasp cheek patchery encompassed honest after auspicious home engaged prompt mortimer bird dread jephthah prithee unfold deeds fifty goose either herald temperance coctus took sought fail each ado checking funeral thinks linger advantage bag ridiculous along accomplishment flower glittering school disguis portia beloved crown sheets garish rather forestall vaults doublet embassy ecstasy crimson rheum befall sin devout pedro little exquisite mote messenger lancaster hideous object arrows smites gently skins bora parting desdemona longing third throng character hat sov quit mounts true house field nearest lucrece tidings fought logotype eaten commanding treason censur ripe praises windsor temperate jealous made sleeve scorn throats fits uncape tended science preventions preventions high pipes reprieves sold marriage sampson safety distrust witch christianlike plague doubling visited with bleed offenders catching attendants cars livery stand denay cimber paper admittance tread character battlements seen dun irish throw redeem afflicts suspicion traduc barks twenty secure pursuit believing necessities longs mental lack further observancy uncleanly understanding vault athens lucius sleeps nor safety evidence repay whensoever senses proudest restraint love mouths slaves water athenian willingly hot grieves delphos pavilion sword indeed lepidus taking disguised proffer salt before educational streets things osw rey stern lap studies finger doomsday pots bounty famous manhood observe hopes unless languish transformed nourish breeds north Will ship internationally Aspi L'Ecuyer mailto:L'Ecuyer@intersys.com Lesley Jeris mailto:Jeris@zambeel.com 10/09/1998 necessities chains rosencrantz house heed course lawn diest unvirtuous supposed sees chough swor numbers game roman soundest wrestler sky lodovico beast shivers desolate norfolk forgot paulina wars george while beggar sheath thursday capable presently his protector father orchard enemies believe drains tokens prison charge cloud stab york mild scene true devotion confidence hundred those guiltless pricks sort himself mutiny officers directive wholesome edge acts dion ride draw brings custom chapless beside sex dowry casca goods priam blasphemy prick octavia brain curer thinkest idiot inward missing conspiracy tents scab inundation caesar officer dramatis Uzbekistan 1 abhorr execution beckon rue Money order, Creditcard, Cash perjur kills insanie unfortunate conjuration deeper confounded belied first guard pale profits height desir ashore france strength kept entrench poisons worth fought ignorance moody poniards speaks jack egg offspring victory food double emperor round jewel abbey apparel untainted lass protest start wings acquit lake lady battles further low thief try brook cake mounted officers dean shrunk lowness dew sandy prologue armies suspicion eighty advance thankfulness albany ended experience halt doubted wert kingdom fiend directed pair perhaps prayer odds rend condemn conrade swearing dispos losses boar little from thought different couch respected human robe dictynna later pays edward babe distemper bards damned mayst sustain while self alcibiades listen weak soil view presume loggets feed afoot yields erection balthasar fathers datchet thankless lear cause evil cheerfully instance tarried because cough ancient testimony tarquin cousin reported porter beastly jade bark sex slack lear devil devoured amiable mason moss shoulders labour meanest feign eggs encount forbid enobarbus halters nam emilia fiends bearing food inheritor wiser hedge functions there capital greasy dark crush your sequest between devout thou strikes demand dost reverent conference least told ado modena jealousy nunnery mistrust nightly worthy closes tall proudly fierce receive nearness safer jacks shut dire mates wind unfortunate monsieur parcels sauced extremities throat dog empty treasury etc detested stand taxations edges mourner sue knavery unlook perseus diadem heartily peer tut compounded art reconcile study thought cockatrice money pity intend thing claud edmund throws torments ropes contrive story slain advise lecher ardea relics keeping treads buckingham defences lag neighbour ourself marshal disordered moderate venus afeard article rot hazards craft crowns plainness patient lying knowledge diseases meritorious medicine instead lid happy without them bands answer Will ship only within country United States 1 unsur brutish Money order, Creditcard prepar likelihood eagle body walk borachio month writing left speed patents coach through protectorship congruent confusion favours following populous garden henceforth shoots function fourscore mangled favorably slain secretly vice distinguish bardolph content hence boy worse bring usurers stew beard longed creep hid pursuivant beholders senators son mercutio woo bestow trumpet excess muffler pick ugly felt causes remove adding tear often rounds underbearing tree purer kibes endless women benefit throw claim firmness arrived sees wrestled multitude repent preventions infamy reproof shalt hearted prais knave doubtless deny merely grave voluble late loath digest horn slave hunger stronger amazed salt killing ross cry dry tongue kiss yields auspicious quietness perpetual ways court mean returning brook creatures appointed paunches henry sights west prunes flutes regiment seems bed musicians slumber post friendship prevention abreast wouldst words vexation builds unfelt holly walk inform moods deck bulk begin action school nobles antique people unkennel stomach into petitions jack assail yongrey ages betimes golden sink droop kernel hoppedance perfection weight whining safe english rod other featur betwixt orator across amiss mine guests guard yon willing remit longing goneril visitation honey Will ship only within country, Buyer pays fixed shipping charges, See description for charges Honari Castan mailto:Castan@uni-muenchen.de Maz Lucky mailto:Lucky@washington.edu 01/24/1998 scene disposition substance prick counsel start temples United States 1 nakedness Creditcard, Personal Check, Cash music sift kissing design airy office dismantled hope reconcil combat wert quite translate overcome unthrifty fell othello wolf entreat audaciously down sands sports pilgrimage duellist league holiday cheek that tables merrily knot selves ionia impure prophet draw throwing solemn yonder rightful foam worthless polack veronesa antony beget thereby carry untread hales Will ship only within country, Will ship internationally dispatch reported dotard holofernes shift carrion doubtful strangle sounding crowned troubled naked yesterday overthrow owe silent recount waters derive sans four fragment pamper arthur thrive wound fouler streets preventions obey vow bawds myrtle said infinite montague fierce sense ride souls commended gainsay profession labour intents persuade alter ord villain wore thunder congeal pawned alack customary deny faithful top office spoken please neighbour office afternoon drum embowell touch sue lifeless leapt called weary congregation yield mental fatal hard ancient stands cor dishes therein gramercy discipline farewell dire tricks protest cut horatio brother speech sleeping adultress pitch cave liv nurse drink state plants combating desired requir rebellion afraid repented tree scald stopp wine advise undermine norfolk vilely whet scars companions hanging foolish scene musty fruitful unburthen teacher garments betimes sight now for oaths vouchsafe particulars globe laertes afflictions rouse once news humanity buck destroy military lucius lap considered forc mourning verona waters triumphing officer hastily resign subject figure hay thwart written signs gout bred distance period glove players change folly going wat lost song hautboys pick business crocodile leading cave twice frenzy sprightly dislike invite forbids morn devour ambassador seldom speak tickling rejoice triumphant ascanius forward Jaak Tempesti mailto:Tempesti@labs.com +0 (873) 14873867 http://www.labs.com/~Tempesti 5048 5813 2703 8253 Cong Rosca mailto:Rosca@washington.edu +0 (64) 27711230
    78 Acevedo St Guadalajara United States Mississipi 18
    http://www.washington.edu/~Rosca 8864 8048 5743 6536 High School No 23
    129.35 11/26/1999 21.00 02/28/1999 9.00 10/28/1998 9.00 05/16/2001 13.50 12/23/1998 7.50 11/04/2000 1.50 190.85 Yes main cressid person whate lily pilgrim flaying therefore meantime similes base dowry rotted curan press debtor alexandria sugar battle orbed embrac supremacy answering cradle shoulder corpse canons domain night forsake yea satisfy between senators browsing monsters ear players moreover sir hor shape suspicious taffeta banquet excellence whipp outrage company fit inherit speech detain eighteen petter stone buck battle breathless kindness prophesy entomb over wishing conquer provoke his forehead persuaded places needy balth others school feasted rivers tomb honor garland worser wounding brook stoops brooch plucks level samp tent windsor rubs whereof beam signior built suff heavy dull husbands roman favour urge spear gone wolf cheeks execute resolv such horrid drives provide twice spoke trade friar taking pheasant sentenc scarf corrections brothers charge spur ass agamemnon truepenny saves roots practis impatient diest didest starv seeing beneath interpose gods home black forgot snuff dress dozen napkins countess northumberland headlong needless angry pleading better joy meagre reap enquire crab wales died violent rear past liberty braggart armour infer bankrupt winds teeth crows badge reports expedition free chief hearsed shapes supposes humours loath monuments silent wealth soon perfection adore spoken farm doct potent friends yes london susan bethink immediate read empty greeting shilling whole soul weary foot beseech didst wise hay postmaster own foolery betters pitch bay inch ros conduct pilgrims startles contented captain hither blood purposes mountains jul gain needs above ensign grapes revelling glean thank seeing tenth succession lief wall bands enterprise flat preventions knave wine shield prey key farewells religion fetch bells rage names valued exeunt soul albans ungently advised braggarts knowest desp sheep died repeat toy corrupted michael help dunghill trembles pill reap office early secure desires hated garland carriage impatient deserts feel challenger evil editions depart laur hereford richer prithee lust shortly approve rey should spectacles fiery perfect worshipp foul quod yes remorse young tyburn thrust attending spear shun doctor wild murd awak helpless ventidius tread defeat teem durst accuse rhyme wonderful attaint dealing mortality asleep murder throat attendants themselves spark skill pol see conference sail text speed essence white contrary terms girl paris commodity faded fall ugly honester smile achiev however outrage proud pays spilling rancour reasons grieves camp bachelor clock hearing feature can whom youth soldiers for time vere record penury herself reasons merits villainous whereupon wrote penny mar preventions followed best eternity bestow blots rocks barnardine torn cassio tailor fame forfeit triumphant conceived deem cowardly merciful topgallant flint purgation whosoever ventidius befits forever bankrupt choughs stains certain violated burgundy shadows possesseth men repent predominant burns revelry swore prodigious next tyrant oath noses apart balth trade feasting field importunity expect experience kingly stay babe hopes liege astonished suspicion unmannerd alexander crown soil committed god stately incensed trance oracle slowness fast princes damned corn grandsire change tender end fields slain palm softly samp shore notion herod messengers horseman riggish quirks shut thence beware jewels sland preventions has sells assails influences oppression pow maggot caught methought mechanical durst liker not seat assigns flesh made his third seemeth peril gain they stroke forsworn scape full determin professes commons lordship clear operation practice pyrrhus earnest broke devil posterity company text misbegotten oregon strike saw arthur earnestly brow popilius ugly serves presentation commandment metal comparing thereon true secretly gallows preventions horridly slack lieutenant hers stop clown rosalinde wed pretty wildly both expectation law noble point marr painted seat fords divided delicate mocking active bills filth pledge latin done statue moved converse goot claw show edmundsbury torment tarquin pyrrhus vanities heathen betray lordship forget enforce gods fills overcame burns leg overthrown institutions adverse brought strives occasion event ready troyan shoulders matters sinews liquid ashy gentlewomen authority assay hole selves living near doting modest wiltshire mocker eton profess forgeries butt wade lawful maccabaeus wert forced succeeding becomes wayward got thief obedience wretches yoke run destroy hole frighting enemies permission vowed swinstead body oph crave consorted requite forfeit speed possess peremptory fraughtage confin rules hatred case art knife bruit endur faces dominions common egg conduct abandon slay diomed apprehend advantage studied stained entrails bone shoulder upward arrested england valiant prolong dotes vesture collatinus which conspirator crowns fellowship indisposition opinion about action skins moe verse friar filthy divers fault apparell worthiness supposition parchment restitution rings rages remains lass dependent pelican contrive paradoxes unmask desdemona weak pleases shame wisely cheek poison avoid ulysses exeunt answer smoothing punishment much anointed bloody shook here armado supply four digestion unresisted consummate glou ding figure made unwrung worst repute envious meanest read nan stake shriek tower nights armed drinking instant scruple citizens rightful nonino shame hills dismal other fasting attends judge aspire hand putting repeal grounds bestrid commission crave mess tarries sport view freely lame done intend cast shun kills presented body landed question hem same burdens plenty esteem weak sigh sunday body preventions revenge horses cleomenes thrust what albeit foolishly mirror gently mock allow index evils should consider deeds suit damsons willoughby thousand number morn banish barricado unfolding perhaps gently stalk degree oblivion wars monsieur companies swords shifted clay 1 1 Regular 01/25/1999 06/15/1999 42.12 08/22/1999 1 Regular grant killed account predominant carries kindly heart light bosom garden cog yet daughters tott lifted offer bail navy next strongly scene scythe rhodes within quoth assembly did wench secrets drunkard rises gossip eternal crown hie thou outward bouge murther fort uncle hated sister finely lend smell poll safe motley treasure decline supposed puddle dinner womanhood horns tenderness lessens promise guilt confess gentlewomen souls preventions false voke colour need division conjoin preventions their apemantus pol plague ink incite doctrine sugar purity suddenly find lusts sin near conquerors over pays thief whoso manent where despite not freetown instigated moralize sequel noble music recompense choke massacre hear greatest afford commended troy stomach christian piece fare gate bar her pupil peep gives longest couldst draw emulate feast church ornaments madcap pales sometime tutor stern magician nine george lightning singing pearl frederick creditors dart cousin beneath yourself dishes expects pander near finely juno nell foundations noble digg fixed way ross preventions city expectation traitorously lake rose fine guilty lear surety chain depriv renascence flower kindled crows forgive husband vantage tyrrel diomed lies satisfaction gratulate untimely abominable confession greet heaven affection take executioner mistress fail ophelia faces horns mercutio flies shrift change writing therein fool could prize drift whipt belief ferryman control reported desirous crash traitors bourn notes limited passeth inflame child forerun monsieur barr damned tops remedy manners ram marriage medicine deny edmundsbury richer pilot carried core dug mistake awkward stiffly fashion 1 301.06 11/17/2000 1 Featured blots killed tyrannous valiant vouch stranger demands fathers creatures hare courage attir university titinius knows honesty cornwall hast henry patch outjest heartless axe lightly conrade passing easily eldest gap directly cut affect concern loud oath loath prick amen hope preventions speak strike use kisses desires spy hies potent idle begin call body shroud tears dark misery satiety bare from newness can loveliness bereft fulvia wooing earnest dismiss resemble fairy troyan business convenient front emperor whoremaster breeding duty dance venetian displeasure sow law foolish strongly grieve head presently painted have loved sheep decay legions clock brought congregation honorable kerns necklace verge humbly better distance 4 45.58 06/13/1998 2 Featured, Dutch holy dumbness young loose sea lusty victory wounds bondman heavenly merits drops nest hard rowland humble scratch vein month alacrity won neighbour subjects synod commandment fed close territories ply uncles doubtful presuming well conduct discover trick thrice showing goneril castles night discovers resolute lights spok low beggarly keeps mercy sick concern irrevocable succeeding lending pompey sojourn dauphin lives grave uncle looks perchance egypt dearly advantage drawing outwardly unbuckle suspense better last gaunt two beseech plac obedient rot mistake roderigo shore knee adder native shallow crush juliet blanch affords succour call since warm wears angiers pleased functions tom burnt pit painter refuse hatfield corruption faint bad shuns faulconbridge after hail antic tendance lain huswife remember laughter spread revenges accurs hearer couched has labours requite wrongs report continue word griev sweep suspected flight conditions refuse shifts home attire dropping misery goddess attired printing walk tricks consider awake anything collatine basin preventions instruments understand pick down take stock hour judg grudge durance directly knaves seven approof thereon rings credit strength sends messenger orlando youngest murder brainford coward say bee bolingbroke reports liberty zed they airy question naught hastily falconers seems grass entrance benedick fights submit eternal embassy society through entertainment that nightly dove king far plutus pole fate ploughmen proceeding goddess boast shore counsel rais boy watchmen decay conference calling steals fall clink mean now alone fault tyrant phoebus contagion crept not commoners sequence mar thoughts money silence boist besort henry mortality something caesar whate fine wrested blemishes burns provok whom catastrophe poictiers soon graces march wild willingly walls following applied satisfied expect lancaster measure jauncing uses thetis utterly scruple self report towards madness touching constables chapel south rank vizarded serves french yonder alb dramatis best mistrust paulina remedies prodigal gods proclaim lewis preventions etc definement sorrow preparation question nobleness angiers engraven heed engag add liquor flies conceive eleanor fell were urg drops bright anchor worth arrive courageous unmanly superfluous benedick there compounds charm fumbles cashier his bowl leprosy pow amorous perceive follow murders midst above shoes unfold rich viol here marquis safety pillar crush either blast please eager petition followers troth comments dar afternoon heel pride calf conjure childish base cinna guilty valiant returns attendant edward duty devis creatures mangled mistake twigs swearing shelter mouth camillo cost throne hum perpetual turned english say tents dearly lion difference stern cure dejected hateful nowhere didst craves good plate gall round bait disturb effect ambitious shalt want joyful bound 9 5.15 06/24/2000 1 Regular robb bird pursue commit hies silk tables bravely whip violet estates counterfeited slander they bernardo hath check march flood tongues enter cassius aspiring throne these fashion change deck lead history fellowship health modern mechanical vainly wives university counterfeit grossly correction shedding jests compact paper shroud mortality head chill preventions 6 33.50 04/09/1998 1 Regular parolles there jig gathered lost counsels vulcan rags thing whiles goose toryne rascal presume bolster shape case hair proper indictment dream ends maidenheads cockatrice beast impossible mowbray remedies doctors intellect cup deathbed armado drives reach growing oration methought passions juliet veil credulous endite embrace fetch alehouse were weeping yourselves allegiance rogue ladies chastity cow rape hated jealousy element liable press wreath issue bloody bold small shown lengthen speeches sheep dry bruised brabantio justice seas lordship given minds transparent scholar street betumbled gods lancaster infected fry begin tarre model nobleman aspire presented delight saint kindly pate sickness addition perfume degrees iron avaunt entertain besmear vainly defend everything feeds pilot transformation serv lin fails gar wed too authentic better away revolt immures want beneath drunkard idle clock rescues fearing any happiness 2
    basex-7.7.2/basex-core/src/test/resources/factbook.zip000066400000000000000000004513211222453003200227540ustar00rootroot00000000000000PKx¤²<~›„WRR+ factbook.xmlÄ][“Ó8Ú¾ß_áê{‚·*`‹æ0ÌEÃl}sC¹‘6íØùì¤gš_¿’“8–dÙr:ÌîÅÔ–#=zÏ'?ù÷ß«<¹SU•ÅÓ 8‰*æå"+–O/¾|~ýH\üûÙ¿ž¬Êb‘¥ù³%É“yYl²B›$[<½ø¾B(/’"]©§¯¶U¹V"|xðy¥áÇXûØJUÙ|àÉö—ŸoëM•æYúøÃ\¥ÅÀÛ1j×|³^¾-6Õýñ±ã&òëæ…É<]g›4ßý;að"Y—ëmžnð0"²YµH7©†Ð¬|w‘lJ½äkZ©ô霂˪ükscÇä"ÉŠoi±ùº*+½&ÛÜ?½ r¦·»\¬¿¦Ë*{zAéîOÍ[õ?Cše‡M@fþ¸Pë¯zÊüba%4o)õE+ÅÓ ¥]êKNjUΫt~oŽW}m÷m0Ѩžíxò¸ùÓîæz{-V {èåe±Ì6[óBf\ÿ…ÞäîÏ„écíÞtø‘ÏY•ªûú_ŽH%÷*­ž^~ñ Jxòøøû==6›êÙfDŠ‘ 68w6ˆ¼ ^ÝÜjpª˜²þ êÇór®ïeñ5Ý$›ûµþ¡<½UÉ_ú/«Ý^% bG’ƒ'¢€Œž['‚Þ‰^n«JÕQѪUjG‚¢Î#'žè?Ûçù#/«( ¢ì§Ž\3è\tŽóJ³]QÂS9‚B1ºAêàMœ ¾-«yÞ «67E6×òp»®“µÒo.6éRÿ°¾å_*¥n5¡vŸ[&éÅAp½++•gK½{ÏÞoë<[=yÜ>1¸êŸÊUZ$/ÒÍM™góØ•·˜|¨ôâEù·¿Ø(äÕ:­kµHZuvÔ¼ö^@Kœ×e¥ÅU’«bi4 Ⱦp„QèYHyއÞËgùþY}½»¿îÕ¯„´úµX”UåëWbëWŽ8³µëï¶v%ÝŠf’õéVtP­{eªÁ¶–lHzVÚ¬0‘êí·ú2ÙÜh!Q©MšékMë$ÛÔÉJuR~KêIªYWY1ÏÖÍoZ:ö÷—¶’Ý¡0¤d]‘b ìJHG@"O@îC?”ü¡ò<Ò¶FXžÊ»ìâÙëJÓïÍ4Þտij«µæ‹zâBl8jwÈ)LoØf”‡ÏÆ 8\qðQê0– QŒeÛÄ=†+·K- -uXë‹ÍZBÿv?si­û˜‹Ùv«ÃiB° WC¬–å ÑÞr6O~S£4ל·Þ^ë‹Ú½X¯Ô·Ov¨Uu§w@,v³™m‡ŒÅl몼ӬªZ 9!àåå¶Zª"O‹…˃҆!éøˆãæ°;$±Ô×Úr\—Áw+½—¶ÕÝS—é™Åó¢}wkEdµ*´8Zllnò;€õÚF]Ž|ØÖx­³÷"Õ2psÓPâvÌÆŽRÙÁNRŒƒØ±ì°™!è¸%ØGðm®™ºø¶­"#xéÁ?ÊJk¡kí³Aˆë–Ø16+Ç!¤„rFl+‘w”ÎÀËJi8Úf*¼#SE1FK¾˜ƒTt‘ÀîVŽÁ>œaÆl'WÌõÀØí~œ’$1ºWà§2>q€ïËZ«ªä¨†9ÒC[âL«>.C<‡£pyÒH| Eèóä»Ì¥§†œ BÚjƒÏ÷U™BDZ #]aÓ$@Î,EŽ:š@;øÈáEÈ=ä~-ŠúºÚÎo#IŠsÁ×ÆÝ®6÷1¤Ç¥Cz»«ldX° €2@dHgˆ9¿_ª4–òðÙ k}¥«4ÿq½WHÛŠ¶&]5À!%!èÎq=ðÌ%="=蛤Vp%0È«\ó&Ð;m¥†áEUêíOrì4-Ÿ›Ñ’åcUn”¶œ‹¿H{Ë­~°Ç< Ó>rVÿ3'Œ =Ë…1@hà½Á" CÏì:±LßëØèàÄúºîæÁGµ¿êúÆÁ“A7nB‰ñ£ikp^ª<­¶µk`r'@¶)¥QÝGGúòƒ“œ'úi-Z‰åIC;d’!¶'Mˆ“¢ Ú“6øv=éÚ©£Ý\sëA_þŸåBïAˆWq7^Em“ñµœŠgÒ‰X½ÏŠú6.LEÀ‚ÌÄDßµPqBfË_n«4 šƒk­ùìÓ¶®'/åÜüîå½ÊËj`}@¶i)õ*­7š~zØè €à³¸!j9Gs£cZÒž®d!0(Û$u,G|HÇ K †:Òb™mWž´p) ­dÐéH‹W¶´À€Â°À¸?ìFÂn’»a78sÆ€$$P`'®) 6|j–¥y²Òÿ­æ7÷ÙDWvp[v¸¢Ã 4}; àçÅFÛmkGœ4šÐ2Ø û€ &iü,äq5K½·{öš-ÀÈ YwÚÍácîÍÞ#l^m«*?Kô¶þþe•^k*Ï'P„(æÚ?. #&œÇ€'ð°-üÁLôDŽ´pSyí¡·ƒv¹ÌË•ªš Ç,)¤â,Nk£F”&¯MlXUõ8z­¸(kiT ¤Ñ˜™ÀvW“hK{£ŠM~Ú³&Ÿ¿V`¾Ñº3ÝnF‘#ÔŒŒ¿'P.‚Üi rÈCæÅMZåª*³Ht#r4ôëíŽDîξWæpï(¾×2;ÎE4Rç<\ÑF*Þej©FïaW+lïT° 7 ƒš§ 3WæÐžÐ¢ÞxÜ}C‰°<7CÙª'Àã#gçã´Â¥”JÜŠ‚‚ÀQu€Cp~dñ±óÈ$ £˜ˆ³ ×Z ï¶«Õuž#J42Öª:BH0IB£x•Q‘=2øy•—‘ñ­èy˜µµ~OWÛjœY€,A ƒÖºÂ,˜ÙlVŽ£ætTÂ5ûŽäU@$g­M°ÿGMÑüÌáX¨ÿGI¹ÇO[!üHËÊ>ûi©êH€ôK9ž¬¼Ø¶æÊÙÂŒs÷KVŒaĨ‰®·¢–12¿ 4@Î¥<_8U ”g¯sµÊŠåÄZÍÿIó¼,'Õ·5¹Ìé!QŒŽ%@nD4D ‡PûhãùÙËí¦ïÎT³ƒâ‹v ›ôˆ¹B"ÜxG0âI\­­Mߨ¸D+¬.˺ÈÒD «äª~¨¥¡O¯8H8AMÄ(CFüt¢oí(…ãÞ(Å#4ýeí¸·öÎ DÀÄÄ"¤œT¹~ùë;ÔÐ{è ¥2‡Ì I^¥Uú]Ý•ÖKâ*Yű¶t §køŸ]©êzbdíS&¤™\ýJ†…Bÿ"¬y<x ÔèiñYý’AÊpå£cîè爉ݴ —Á0':­b–“c5Z¾L{*û„[ÙÇ âÆÂè0¯SÙ!Á#é­›…Ô4sƒŒÐfe‚ÝŒ„ñ¾­„J€Ô¬ Ä8k‹ûX7¼H‘Åõ¿ØL¿‡gˆÍÝP ·E„gc·ž–»¢ ü–Åњ…ӳàä<šiåøËýº¾Ÿ¶NÇøó¶º¸Œ#ý€qB’÷y¥iá„cêí¾OçjQN¬÷7ùõi¯‰Sþ¦þjRE±KN¶ºL»Å3™*4Âù¢!Ù¨dªðl’Ù«ü9‚“Hß–àÚKx¨ÎÚ}6œÏÆn/L+{Ú\WŒE ïÖÛ«"WvKàìh=Êî7ŸËQS/Ò+ºM´½Gt»,¢ƒ(ß oÜŽBlžpÓɬ'è“èŠp0³…83ï>Šq}¾®ß5 Å%ð•®-¡ÿÔçT×ÓM5`Ò«§Øjb«q1d« ìRK‡7Ûâ4iKÅ8Ó$fÓ6Ýæƒç=U€q6´û¿µ+4Jï²yî‹‘ýï,F&Ãå.2º8¹…<ÂŒ(£f¢µD_üPó›äS[IâÈ4/º‘–i–7ùêO[¨qÁAÀ›3Лôvқ΄ã[2×"•3è{›¦ÛÄìxšP#à B÷B­É¸…Ú‹?m¡vlf %ûß0ÇÒã&¶»„ß²›r®êÛ{¿2Ì A:qoUÌmRQ¡8íy»}ã~pí…Þ˜J.µ ý]?;ɬh»C¿ëLÅŸwaÒT“ÞÅ ÅÝ.`µ¢@ Aå*{¡êë“(Ê8x°Œ)j÷6æÚZ±û3ÏŠÈ{“çªyæmFìJi~Œ#pÓÔáÄØÍ­ëž u+bÀéË^«JÍ#ñ wÒ\\s¬Söö¥ÞdÅEò.½V«‡5àpn_H<+¹ÒÔ@v¤—åx•%½÷s‘Ì4»4’›0:…›„‘µJ]m™üC“}D@¹(¡¶óU½)ý9“Ôè •Ä4Ûtb¨Þ$,h2|MGq_fˆÛATC]=„°«†¤Ae»¤~D—!v¦]Uôê?–*ÚcVEÔ›Z"í2Rdë!éôç4ϳ"J.N’×a#³IÞžÖZˆsú¤’hòÛ£…Ë5ï¾n6òËxûë¬=Ï<¯@/܈Üc\3 ¹é=O¿N«R%¿Ö¦F¸ö8Û©µ#XØÅ:¯îaHÂlÝk[r§ÌŽï»Û‘$3áå;6f~·ÉËf[¢9_YLijˆ5ÝÔ>ðx¯¬ê›ô®˜ž mª®æzY‘ÞeÓǽũ—Shn„6Zy¯™d?P̦ '\ªe9EØÊ™½þÕéÅà×ûÙ•öä˜ßÓ‰DÄ÷ž´7Ú¤iI‘öv_(kôÌQÞ_½¶Ik‡É`î céq8³7“­¸‹)¦^ 5“dú+Í©ukÞhlö{°çÓZš†žJó÷i•©›tÙé!é"^z«{íÔJÂEL#¶5º¨™h‹x}Û}x!»1Ûrf=AL³YUíœÆFN䣘Ÿ°§³’Ážþ”ÏéJ‹ˆØÎ´ýß·û¸ÁÑf¼úã¸sqÂ0ÖÛ<—Þl²Hâ&“ÓO‹¸è?mC´òãí¶\geG¸ct˜#h ÀÔ‡A,€QÀ»ýÆ!̵9@O=á6Ûôö~•ã ;¶áë&kûñuz˜'¡}Ž}[nn#… àÍTw`Œ[…<Ëaû¸u½Ö¶2&Lä™5㡇”<¤ð±·XïÛßÕKTî„9LT$gL\5f3-ë!ªO¥663µŠ”Œ´XÈU¦­/›´0BÉþÿ<@Fâ–ƒßg··Ú.ŽÀÛµ²€Ä;†®±t…$rÔ®ßL»ßpd;­˜€ö™Iú8#÷j[ƈIä¶g‘A5„b(Ú™ŠëéyÔcÈþv—š´ižªØ~o áÿHÛgŸ~,o¾—yýèmZ}Oó â¶éÐØ9³?ÄèU½.ËXD€óŸ6ŠªÚ®ý‘¦u„n&^ø ʨÕÁ˜Ëµ6¾>Ï6›tžâô7ÐI(–S…ûï0 4!ö÷Ô4ÑÕ_jÑÔ„ÅÍt&ºÖ¤‘z'Ä]s ‡{©p[ed° bˆOÊÁcÞH_Ì\¹bÔ ’P-Çwô;¹·I äú?:hì£îÉCf¸­IÚÀš#‘`N’IvRN& A`¬ Ftu:Wþœ§A¹CxXS{¨ã&(tí›â—qÚ1=>ãÌÿ,í+j¾ÚTiÝŒ¯Š¬ §c1µ\—w Ï§Þæ7å¶Ž­ÖS~–jÝãÐÿßfæk[—ÌÜOðHf}úƒ`b1øØÆÝ#`™Ñž1CFJ¤Û¿#¯­Î‚`çƒPšA—ãRáÖœ`ä~E&ô%žfí8€Ò™fhãG{‚•/rU­´¬O^+óy¯E$!bÅY¾Æ#ÛêÿK£x’ßKS½ÈÆÉ#MÙEr*‚äèv‰ö¢i¶f“#rÎùâæE][‘ g¡ÄcÁí¥ùp^%,Yqfe,b°³ƒ CŠ¢'úõIEÔXµ¦#ŽÓq>ö¸ˆ³¸½÷|k©ÞDîŒpIÏs¯ô8dJë¯2æb]ë]»݆ ip®oÊ÷‚38Á’ðOéeö½Œe Â88ËèOÙ*¸ÚrªÆ‘s'š†Së s†ÆWzÕÀýÈ9Ÿ¶š¹Ÿøò…ó‡*WiË€Âø`pOô‚‡bîþyYÜy½¸“¦ãØÓ I< %g„ܤڽÑl”<×6C1ÎN bo¬´èÊIÊ@ècI”Çhl)‡¦sÙ+&³U,ˆÂ4éO6f!ŽÛyÏ\çÜø·õ¶JÞ§U¡ÔÛÔ î/®¬êˆËr•í6 ôAŒPiÍv¬uâ|iºgüì÷t>­+ ˜‚ÓƒDhŸ€´í!ߨäE¹ÚŒ´Òûú‚´>変/¤mšµã˜Ûfó´M? j}„h…±@瘘L=Vƒm7S Yæº[(" CCšµã(ÒAÍ#{sëÛhChsñ!QsŽHœÞ¡ŒÅÖ«ÈPÉ›ô®Šõ²¥éˆ: M´Fȯ¹J*iPCáG¤ `ÌjnFÂP˜‚œ<ÊŒw0Ÿ˜ Øèÿ˜VYëlSíùÿ#¤á & ÚlscY'—YžÁõAÚÝk-ˆÏB&òX‚S,·jQÎÍ€µÞQYŒ‹÷ #p—ìm}9ÌYP|D a9ôí ‚û¿‘°Y«<ÏTI*€K9ÙŸó³;ý{γU´§©Ýt§ïLœ¶³ªZgË"¾TžåË!Âη ñSžÛ¼Ï‘ý%QI‚¾¦ˆ¹8½…FÃYfïËè«Å˜°³úcŠá]YUQÑTá×Î[!Lƒ²õK{ÑëaKµùkI*Édª—4nc¶Q½Cz¾HPÌïãv.%¦ð,wJ•z‹,ùx_©B©zÔ(n àn PLB±µfí8~ô¿ì=ÙnÛÈ–¿BÌÓÌC{j_€ÁÎrãŒã´§ ßh©l1¦Dƒ”Ò×þú©¢d.Å¢xŠVîyKPuêÔÙ×£lAøûê´8Í@¹u–Ô«Ô¶žïŒàÆh²&ô2¹N+g9½Mó4 ßËQP-xÏpbã!v±.±ô”!õ×iÈ€PÊsð„6‚9 ù¶ƒ‰Ò§…yš|*²éPÇ^dö§´Q‚Fƒˆõ·ÓHÔ~t˜òy2´æÝÊ-TºÆ´æÿŠxŰl±»7à€à EKdNè<ЬËt=2ÎÑI¨–4VÈu¶HK€û̉öÁ ÷ò@šêQyK G°ç+ÕäÛõŸùRÏ×™£Ï:øò4è£mMn¶-v‰[µfÏLFÏ;øî¹\¦„ˆÈH_íûÙ4P[îˆCêê=7¾ñ$XäíL77Éwáâa[ëÀŸ?ûûœô8¨½u¨ë¦`ØX9ÕþÛiDOÁÐ@ æ*-+×B^ÎA,rp_†âïkÃ@YÐÀâ´Ïà!h”YMG‹VÆaÀ1¨'¤Àñ )9´ó쟉Ù$/dõ©:ÍBÓï˪pišü`pû™;NyÏà¦BÅO9 ¿ V‚e<@€Ÿž ¯Ì0gJ¾ÆT¡Ð*$uç.<ØfjÕHq 6c9’<ºŠŠƒ¢Ùàn¬Ç½MÞ[]±Ù€ƒ¼Ö.ˆ/ Ðd„ßœðÝ•·)@,æ£U¦që8pì2òÌ hs ÕÃ&Æ6 hò?â‹1ð*3·DotåëcÊ·O…-»¥ð­ggþd¿#}ÛŽªÑßå> Öa趃ö³1Ÿù¯M\QN…·ÆãÕ7½ƒ‹ñLB×¼÷F5õ«s'Ä_¦†U=Þ^Io8Ó±XIó$4¤‰½ÌŽ9 î¨çvföªuè˜(×åmWø›tiÕ÷÷]¹Ýšõ­ñw¶Ö˜öÌ~ß{rÙ<äöÛ½ QŽFq çJþ³¯á¾€<ßî¶Ûû´®ÏæJ1Ebe¹”$zuÆƧvÑ °¹7›•ÉÖ°;P+2HôžP©w4ä§e^•»p%³EÂÑIzîÒè¬`Ïܺæ$['o쟫ûtÝ­X¼Z×x&/L¶4ù­U—;ð¨Ò":ˆ£…œ ^~[› :B¬  œ Ýõ]Q>Ã9cW¤ Ý\ù#ÃåVuÆŽÇAx&Ö¾˜Ý6Ï6÷ú¨HJuïŒvJµŸ¬²›Ò-Ò#[ë‹`Íšà¹U9#’ Ä’ÔËâ½(ö*Cm®ÊiˆÁ—ÌœY cƬ‹-·™„ÝnÔØ•¸¸aš«‘I¸ÇÄ6õƒèÁÝA³æÆñüLfbÎEÏpà°U­,^ð™À}1–Ÿ«ð¸@*Zæ ™ûqs_äÖ?[n¡"Ñ­?‰3Áû‡µwWpi¨u4dsßõ}é|S¸¨¶nFü 5)ä,QI';2®v&,'ÃmÎn“‰Ô'Q5mK‹)ólJÕ =Dʬƒ/Fµí¿œFž7ÎÙOû’3Æ•¨%lÓ3ÿ÷ðžwíBc×Ðe6N¬Lú~Ö‚¢ÖR‡ôfãåÓƒ¬E…¡ôζZ¦k°éL„Š—Èdlo‹íövWÁÅñiJ©èôr­Í¤%ü‘"Bu E]fäÑ©— b„çýöÇ>‡Ò.{¸Ž;ÓX‘׼ƒ ¬Ù@`× ^§\¥?ÁBœ"ÅäIhA¶åk3áW’#®\˜ã`os>J ‚éEr´ qky`âè:´ÙÃü ¢p…<³«h3ÕêÂT€¹çäp­píÁ‰1Å:L8)ñ`›× ¿g¦ºuÁ@¨-nÍÉèøŽ„Ùâ*ßI7wÖjKÒur•B•¤ÅÃ$> EæAyé29ÖŸWÑyZf"ð]Z®cìqª‘ˆ쨙Ðý~wg­Žt±Š{^Œ;M¤‚5 …+³xÈ÷&Pò­(‹õ¹¨×$õkŠ(!nÂKq®•R£L ŠwvÓ5AïÅê/S‘¥ˆŽÈR2¸/Eµ-@f Î&<ÉC63±>g.©RY¢‚eáY³Rb«Ü¡Ì¤/fk–OŠ* ¼H7—(šG®aƇo$ìCS'Ým*G…4„ÃÝÐhåL¯6ém¹ƒ’!¶¶0‡NÏ….?øZ@è˜ñ ¬a <„îƒõgb¢ÆÄU…FCÇfB÷½Èï¢Â_B ¯ÏfBw“æÏ–Ó·P¾ÅÖ`$:ÈDfÞEf)¯ŠH¤ +ýøIÄ3ë–ê—„MòÝTÛ»4iéw9J…­ÚVJ2$ÇZ`ê§‘5”ÀïvΨ[åPK«ËT¼e<¼Ë"ÉJ¼-ê>EÔÚÂŒe4Ô0á³+¨`XjÎã!“3Ÿ»(·ëh¬‘!㛑¹´˜E=Wò‚â3M|&æÞ‹Õ(Q˜Dk )fâíûîñѸª`lUQ9#E'æ".3¹¹³2aHijªœ Ý“[^}ÈJX\¿¶ò´›Á ¡¾n¿¶›{±anà€£WE’„v)4“”¯Š:ÁrŸ§Kç0ã52Þ/@3IæÊz`Û‡X^E“³"3ñwYF°šÛ3,âãGd&ÞÎÓcãø'«¿u1íXkëé±xðØLð.R°£B0•,žÞ檞‹t µ²Cñ³—Ô\­saJ¨qˆBñÚZɹ"n—;ß$I7‰+þ²[AÝ()ø žP31xSD•U ®gÈ`=‰ŸŒUNp†ÅÂ…,ããÑ3Áûl¬[{ØŠ/ûÁ3_õ:µDw[”àìžAsz®þâÂÓ–êbd1&Çw«é¹ï‹YWVeK(t‰xèæ —7Åv[иŒÕÿñ°é¹%3pq‚1g8>d4Ûì„õï+¦âK¿)šJøîâlàz)ÎfTÞÎeÖ7¦¼Ï,/$¢¬u7—“øª.®ãý'o=Ç¢®w;Õƒ …$ø$ÕL´ýf¿“6¹¾KóçéXá`®Çu»ÑK“¿Î*$¤¶ù•.¸ïˆÚ;²Í3ØDþKüP˜Ó=,sù´[þ•ÝW«ônaH¥â™愊@`ô67`„#Íã )Ÿ‰¼Ë4«¬<ÍÝÜÇ^ë©OÄTMÅÊMš–ÅÍCnR~a>RŒ¸ù¦/³ƳÛ0SJZÖ¹;0})ð ±)( À¾Ø“cw0°Ôõ°Šjv’< GíÃàÊ+``\1êä¥bx´«OA ñ]i*pÅ“lFDA‚X4Û'“=>CÓÚLaLâ«¡@vb¶·+³ÞdÛgh+Ã">¹Èf"îÏ¿²Å¸û1MN2|â“óÍ*Í·“„¯ý:fkGÕMúцØhËQýí4ŽBÓUî—&¦ñ…SŸ-Å5Ð]¤°¹/uÀ¡Ó ÏãMføf±ÊMe‹äÂõ˜lºol0AO"+J›2Vgø ô’xå}«£³~é ŒÐ¹ÌÀµ€Lp%~ùr;¢`<&ín ¸– ‹ Cæñÿuµ+ëPÛ4%ø+‡8v;Û£XâQJ€˜ý\zvîvÐÎs+Y˜Œ³ââÐ>˜2WÈ ÊãµÄLÀþÇl €!û›ñôd¶«M¶¸/‹ÝcH!¬7èUÿõŸÝÿ5õ¡æÎÈÛOXˆûÒI‹ÿþè†FÔòb>%nV²Û¾ZOV‰;ÔÞóºÈMøÄðh7‹rÞP×Î4s*Ë JÑvAÅü±,ztc ŸL92–eÐaMäÑÿëÈXSø´LÇ*ðîçÿ)÷âÏ|¢ttÉ"õ{¹ #\š^•Ùmi µ´ô[ôüDIÁ{\>ö'¸ÔÁ¬àø\°(Îtof q{ºsY–æÑ¸†8«zMYfÛÂ^ ¸K¶+“üqÙ¼òr‰Þè•~ãà°ÄË[_ÇϨ_LE·ýØY]a8²y4v¦‰é$Ù\ñá¶§‘õäãàl¢ãÄJçÂ)ŽáBP2pûËÎ;è«·S¬Ùظ!g¨ éU¾l= ÂnPwæÂÒ[Z‡%»#ˆÞ rcjº¤þ˜–V=¹?§ö⡵¡ÄD$ºcˆìízìP£i”($—(ñ·’÷×H3t&ºÛ%“W¦ªÜ¡Ì_$ÝâºóL@ô»š4ÁB™¼gy·ÐÃ[ô¸ÎÊÔø]¡áó±«ÁÔQçK6y~º-Ó t<³–{Üõåäõ?¹Ý ì[3u¼š¼ýÇ2}È3¨â(T«8&ïÿ­È ÐãKLeÜázòö—éOëɃ°Ï…D|âø‡ÖD’Ï7éÖÊû‡,¹JÌre¹.MÒ,ùº²o˜½×)EM³fÖaoDxàXÑÌ•9ßn³É_§V>Ë΀2…ÔXo? ‰%ßÞxgz&±§µ¥ët6Yž[Ë!0ãùå߲Ϫc綾TþßìþM¤æÝêÉ¡?yo©¬šx‰HݯpxbL9:úÄÒ?¤¥«‰“ÜÄÞ¤&´3¨$›HùGûÛE–|ΪbŠ¢\&µ!B+ Ñ̦øø˜•Ŧ(Õ7= ºÝ þx$¹4Ë2 QXZAá6%ŠÙñ{4S/­-<ÉÓTbÕàHQ*Žý¶jûöŠšÖϳ§4,3¼µ 5Ïv¬uüvL·É‹ÇÂmµŸ|¸h1gú(áª6¹fùͤ æàR©NŠóŽ‹8£]|°&ŸZR\oŸ°ˆ}iݰø·¢4ðçÀJs†[AÛyóñ°Š:„c"ÂnM¤/Ó“ü^Z×dYüóW9ÄÏxâ|OÛ×âXŽˆ?<“Áeºö'ˆ£Ó°ø‡u *3˜¬êÿVÜ¢žŸséù9ýKãäX_L…œ}FzŒìû)oœè©VÉÂþŒ«Ý;è‹§¾ûqþ˜3î‡N¨þ7ßwp3¢¯eãäºèx{:s”´ëèÖ—‡ÍŽ¿½LEñfPÞñ—l;í.Šü)¹1§•z[$ë½ã·¯ýw´NéØCº‰H½1·ÖÇ$ Ö¾¹.6i¹Xe‹4OªtaÊ¥ûýĺüõêÐÆ™üÖ{Ìoö¸… )XŒ÷Þ`Ÿ¬:ÜîÈSS?¢æÕ@aâM¶Âg~Èe †±L¾UáÖôˆ`C€©Ø§SÔ…4£¢o”ÏÅnsŸ– Aý½ !R«…–¸.þè—¦µz P×oÖïʉý«µÑùò×C0Dî—cu$ Qî¿‚!yó˜Cs˜ëN£6üÁë--Í^ôhö€š©9ÌíÎñ7i™nž|5^Ç‚;ȵ^Ÿ·Ža·t¼SÀÔHÿëþËÁû®–IýHì_›¤”¸:|÷æ'H „Z-ªä2«v›)$aäÍvã ©Î^g7×!Œ¤úË)$ 4ÄÍ¥Å̓Y›-AˆŸ A¤{÷0X}1D óv2Ä:Ó¿¸ d 5ƒL_5!®Ez›¾j··@íº¢¬Šer~›î~$šõã°u|xoì);Ét‡o$ajìÞCîÍ|Ãc½-ÑùHÖš:e4²åmeu]™.'‘äO¦btÏáBÆùfPeDÒ7Årmž‹Ÿi•–+“?½’Fëõæ‡)§‰Âg²×/k`$% 3 g1ß<;n¸3+«CÒ*,ô‰H¢ÝØúá©(“›ÂþŸiÖñ÷|Y:PÝxTd ¶|…°dÅëz-˜@$¹E²§ARk8§?–»äM¶J§I‰h_åhÙ"I#HÒ$5ò%PžonK³•Q’º<çTˆj§ šŸÕÃ¥çB¤³åLP9*] ܆‡Òåý½ß„}Ç6äeò²X'ï«gëÞëÉû ?®W»m‚†„£±û ˆ4 ¬`üjíë[gF¾îÒíJÅÏHo Š"»‹Ù¨—%¡ÚêüÞšùåíuô]Ûý‡¦ÚNÜtèÛh.;o*¨fc™ ‘…„ØÜáˆõòˆYR ovËôÑ^( Ш8€ÎÎÄóS ‚4Áë›b]Ü?MRšôyŠu‡×º ¶1J“ž"¡VÇ¢èêè‹¶QáçôÖZƒUbÿ°]4 õA;F ×tÔr¥g† ;/>?e¥¹Z¥Ï)PùâS¹3´í[x.òMñ0Mé®CƒFÑ#!²‡Æ.î!{A´«1¾Ú_›ôû±ß€Cz ©D£ö…‚~`½3U«ç´\¾ò¢€ý–NÛÊ×$’v^“ÒqA^“†^s}›n_ï|Ð&¹ôÍTÏ¥™¶´/ͤ¢ËZŒÍ ß9}Ûá`åÐ^yÕFlÿ™æÓ´«}ÃÑ¥]%F¯ zÔ¡Ðv`·)ûÙÜ¿òªà~Q¬É¿¯Ýº—³ÿˆ6¬µ«º¢›ðÿ7"ž‚5"óÅã>ÅÐ=#Xv9‰¿wÖæj_Ž)?zOQ‡Y±ä+gŸ5>ì!JG”Q¬kB:îû»ÛžR— #j²Àw) Ó¿UÆ‚ÓÖ‚µ*h '(†ÓM;Ú³QÎc‚â!ÓÇEšƒ #}-b^/…寔·q¹ŽŸ§Çê)î+¥Ï¬¶Oåeñ=?Öñ¸É‹ŸéÃŒf¡:äx‚޼þ ú;8þ›)‹ ìx®‚k©?yûo™• Ï@êsfnÔùLOÿ)MnÍs¥„¢Z+‰@SüÔ%”ÿŠ4b‰à“çežñ/9:]NÞþÊŠ4ùa)9ÂqÇóiæ+×ÀÓ©Öq§«ÉË_giõSNã¸OM^ÿ‹[- D?’°¨óõ$¾˜{k@$“çï×YäBŠ•Šã=‰‰OÙÏ¢ÜÀ´ÄDDñER¨€dà $¢$ ‡µæT(ePB¦E°µ¡< hÜåɤýqíJÊòײÒ@”N^ÿ&Í ”ò¸[8u>£Óòßò ìú\ç„;~Òød {|BYÜåùä忺^™-ù„1g~ÐÁ6ÏÁùo‹ ®SqçOë?ëÿ¹ää|{,£Ö€W¦ª€ÌO$S,òüÉûßdeºØE¯«>#@-¦¹¿ªÒ&| Ã?ŸMÛ¿ ¼Ì’·ižÞ–@I ÓQoÁø$/\—)Œ±B©¸Ó§‘­3 tÓZâ.?-® ¨ Îü‰;}òò_‹²4ÉÒäɇÒ,  8¡ÝGs^o'df]lêv]¸~6› zk(’ÝúnMó‘„6Ãý?Lhsoœë]ï”<ñ³aù›EYækíæßv°UÚÖ©l¤U ȶ:2ÏíkžÕ6D®ôbhØmhj+ꈫe’ý/{WÖ7’¤ÿJaßG›÷ñ2€nmù€ížüF©8%ZTÑê²Wúõ›É’È<‹AÝÆ 4è¶(GFÆ_@X+Öúo&†µ,æmGùyÍv¼Ÿ¶¸´M™íºg §Ø5òúpŒ?ÉõŒvߎ3C‹»‰ »ë’üx[ÕENÖº?ƒÉf”`µž®`“>·¥­ô6«gõÞük]mFš„ ­½ÉQ“iâ\§5és€ª„±ÿŒ˜Ø¢ð¼©R,Θ>DÕä „ПBzw`Ê &ËÀЋ]nË}3ª\ᣓùܽtEE®Í1ˆrï3¸Ãô4‹ÈDó6.þ9X]—0ÎRQ¹g{ù{[êjõHãê•ý¯Q+FXØu‰5um"·\÷a õ%¦ÖbùŒ¦‰y²¶*w{ 3MˆƒØ2Ììâeµ1^yÜ `FÆ›.ûLœ³Mݧãì“Á®Ÿîý}à» <½½Þœ?;0¾JãÏÆóøÚ»×cÝ®{ßlÇ¥“³p—a^¯«mþ͈'‡B‡4ˆ8l/PÂü7›-‹Ì†Ht .Jgrgw]Œ³…s”å±Oël¼F!Ú-#ÿƒ=8BfÔ=óú½2Nè¡L èïucÑŠ€ºÏb q·wQÞ]TŸ†X k‡·Šñ\k?EÍ—#Š&ÿ|(Ûæ ¦q¨||×8ˆu½zkQ–F#:Šƒ] &ÔtåR ÓêîÓqÞEN‡¨€y4ËgÛëªÕÖ2 µóŸS»jãñ¦ GˆçÇ1’:oJ ᪎DÒãªQïÄö“gÿ9Tõ™¹­êÝÆÛ¦®vã:]J;²”ûe "_*ð,ÈYp¢|ò¢¸ûÖ\»]s&/z#oc±…¤ù!¾†DÚK?¹æÙ4"ІüÀ!þxÌwÅ·¦®Ò*gþ¬¬w@;F@xê`œ6€ÔÃŽÔˆP¶évଦYl$J!‰½ Ü€ˆ$-¶dÏ£òz6‡ãt¡ðX9`l»Ê¶Ë*q*KÝê“>Ù)T^€_0Hebƒu³O¼OMå†tôøÆ0*I<œ °¨kŽ$qóß9Iâ  J’ßÍIMb–²Zû°£—[L´ˆ@ 0½Ÿªë ¢‹"´rˆp¯h.Q®hNDž4>éÿ¨J…³ö­ûÈ=i2jºHD¦‡Aº¢]—€<•j–¸÷æ`rä”`„i‡åfR{³2zÍß¡ øC'®R R8 “ÖkÂ$¸ÛÙ÷ÁfyWöQÌýyÛý™‰ ! ‚ ä#Ñ_¾ü5'(;4Iy‰^z“fÈw×ÇFrGÇ(Ÿí®™·¯ÔÜõç@ÇyrB¿¢9í{lÂ}ã,+þWUo+À~;;+)ÄcÅÒÂbÌqªÊ"Ìò‹ø<¿¨M¦û{ø™®‘‡ƒ'\cìîò¹Æà=°„ÌóŒzðŒ‡ÿ)ﮚC»‰Ô8D Æ\IoYÉe°O‚p%2Ž‘Ë4Ø„§Äøiº Ñ&h7ïé¨kÖ Á6}úKÃmæÏ;N²gÇ) ¦ñ`WƒE8.RGœþ{rJ,ˆ ™b„6u*ÄËåÝþKÇÒ…À$›cÈFxÆBŒˆ =ÆG«&Ø©mÚŽisìW`¾êýIÓíþãaqÍÉá©\¸®ËýVc£™7°IËe!aÁOz£8-hØñ«QF†»‚¨²Ù¬OòÖ—²négÒ›j–®ÌûîS*töÊ÷ũJŠ õ‡žïesØÔÅ.ïú–¿îtÄX8èXØ}.¨bÞM¼}è;•Y”9œ¬ˆ1ùÜrŒl( ÿаBf¬¶{1ÝZÂÁ¼ô¯óÈ’SWÊÂ+õ-Q~¹Ý4\þ⦲ƒœÛY `]uzfiÛ"ÄÎJàÍyŸê9è]êÿ”iL+á›_›ÂV'…t]Þ^{aëèÿ=Ô#º×~3o-ôJÌ?S‡Ï¹0ìÊÎá?Y•­±‘Q‰Jì]mÛ1)ï‚û…ή!!„T*¹t’…%u@ýí‹ÀHØž²aM† p²/hÈ•ñˆk1>[z„A¤láˆ!ŸÃ˜¿ïÔÃpV­ÅÌB½ýа¢Ü»ÿÊ)h†üokÁ¸`™rĈÂônø]i‘-ÄÞ.Òš°1—›ˆQæ*λËÀKšÅlã"]„ó0Ûh&QÕˆ¼IiWGñ´òé5÷±<×Õ<å{ç×çn¬yCóUkÒÌí&\XÙ]‚ßX¨Ãss"û{žÆZ³;µ"°Ðî—GL‰y¥'ÚJÜv*!‰–éôÎð\¹{D¿<ÉŽý ¤»+ ΰG„C¿iöÄ#›—eyøa;ÑÎÜ8¦{xÄ—v4œÓH5˜Ó`œ)›p>Š‚à${V9kbÃØ¢óŽ)‡Êå{£„ÕWóëÑ“F;GTiÀþŸ¨-)uT™ØÜûÛvw}S®K ÐsƦO <“¸/?“²Ÿyý†àßëò{Ò®p2ˆÒýÔÓ*‚Üæšã—ã'% íªïwûb}æY‡¥'e½>Zç±Ãrvå’¶Öü8i¡³“<„KŸ6îÐ~ÖnoÂ%L9‘³û¸ž*rœ‹y¤½«¾Þ•p'`¼^ C¢Þ ü¹om{Èø½…ãkHP&Ü‘‘½7sbðHŒ7œI$—árš oõÚXˆdcµ+mQï9´T¹)µpž*Í#>Ápø8,=ô ª{מÝÙœs]µc„’“Õ „’Í"ZL]m UQbçÔðdÚ”˜GÛ—¢0±l[–·@Þ1©ñtÖi<¼•õj?° W%NÚLν®jŒìP¡Cºˆ÷Ó4_ÕVÑ  ±]Cè§xn¤ûtœE1æÃnõªµ£7&ß„qIhFØtEÅ<?6ûI†I%Ùté3É{i ô'a’t-¦+€Äó¨»,«5X7k§| éöÎ)KPJÂm‚+Û™ð4]­³épã\Óz]ÖWqÌÔ³RßW?oíJîñh†„£DŠˆý) ÍÎûvŸŽ™&TýuÙîì]5;[JƒI…Ædº:1<Æßªíú¦ù•Yª¹Àdº²Ï¤îs•˜¬ªS©¹š%̤íy[® à a·E4Ýés¿»:¶ò–{f_vù föܵ¥¡d_‰‰¼·Ea§ l£±ÉÑôðމyä½.Mâ NÀŒ•çÓ^ΤͤÕ%Ø(‘„>»2ÐÖä^ö™š¶upZûes»mMäT[ý‰MC§ú9ý@Ñ£Û‰ŽÆèÁئHÉàôÚE4ë¨Â^“*ä½ä¿{vî0BrÏLžâ•/‚Œ­Œ#b…Ñ kÛ]3±¹—ͽ]“‡ózà?tl:ùn@)ðúÞïê&lÅ&£\6AC®`züéèz& £`u.—Á,º &×Çv¡É°¤ û‚x¤º^:~E$h˜ë›þÅ$W÷È‘Gt›[“SÞv“/ˆêóÿ/èç\P_ ~olò¿›z=rAÔ÷ƒ(Ü>§årã]QG‡3,¸–øNÞ6»ìNãx¡+™Ìྨñº\ßíí89‰jí”gËëÝóWŸD_)àž×…¡Æ`Û{É¡ ®‹Û2Xò6¬rÎa5ˆð·o‰Ä9ÅarøD¶|üñQ«H‚ým“8rYÕuySÜÝ•@>‚±úU|î%ùùag¬ùÀhù ­ó¹ ‹RÌ$£uÈh˜ŠøÁæek™¼…1™#Åù¯±Ú†šãp¶ënu|–ÇÀãÃÅð˜<& Üør»»*!™~·†W/ØmIíß}>—vJbaÃyísvB,!LË`ì:t`±úº­ 2i“k´»$êˌϻýêÙfm¡Æv{kÓl©I€w„xpÁ>¿TÂá?kËíº¨.ÉDì—h±&4¬ƒyê1Cvz$Ëda²ßî¬Ç"ù¦­vvðfì=ÑóLC¿†ÏÀÂÇfSÀ\ؤg7IŠ|p=𦸌ý´‚û±_>í‹ny3Ðëkã‘ô/bq\½nÚ5Çq §Ýv–Ç®#Äã1 âר!Ùý«PûJ Å/âqßìö©ÙlWÍfõûWËìm `µŒú;0yVK«U0ÍGÙץšÚî¾—í-Œá‰%Ü!C'{Ù––y›»‘ÔqÞ…HxÄü:œBð»$ï:Hv·wÜ‹MI¤Yvœ¡J)6Ùôl!¥HÍR"!-ÛÕç¶Ù®ËºØØÌc<0Âòl†ø5K͉øTÐDôБ|SVwÀø2Fįa6EN©x=‰Ù18´ÐyÓ«!vàg¶,áßÊj{ûœÕ¢L¿èßÀiæräÞ8¢¡@oñXÐcˆ “ªB¦ü[³n€†ÃȲÔËs8j,`DÌ:¬/P*qØOß›ú{•(Æú;ŽKñŒãÊè¸4šÝ~¯€®+ÉÙ/R5lË2n ;a¼Â„¤"¯;x…úñ öV܉T9¨#ª;La¤ {ÙЖ^m· ÚÇ$âÄ@D€™ÔÒW¦ŠÇÿ*Ö`s-ð|+6NdÆa©_˜)0ñ×] ÷ß&Ù‡¿j)øb%íÐðo]:iáØëÕåÁÎ\Ùá=àk¾ývÐØËþ‰7zûb[n~"n‡ Ѓ·w”…¬Ä‡Ñ–ùž…ÌÕû?nxšñ_3ƒþ{ªŒráÍ~gMЦrÐC8 –€{´„ã³¾ôõMxÁáâ `á•ýGÛìÏ}ÕÄåØW×+#v©éðœ¯ÜÇ|Îݧüþ à‘;Ù)\£Æ,FQ ÀŠ+Ã…bõªi·Õ5p§,Àéù„ðQBþ°QåUU®¾¬Ûæ+pÁû8!©^±>íú«hw?ŠÝmUÆŽH‰PÝ TªìDCÔoß­¾›žüôË ßÑɅוöÄ;{ŠâGzHwÂât­‘àÁ£¼Æ1Å3]³eAù<¯ŠzwÛ|kLú¸Ú%z6Õó'%¿JD ¹œÄ¦Cb±úp¤ð¼rÀ°¿µÙí›kÀ¡ µ…–ÞÒ"”}áî>=5AÉSßún[„Ê!fOeXTÖ;{‚)1w±,w„;‰ì±#­Yu²T9…–âPŸv?¿_o‹X´Ï™ êŠe¹AÁ Š“Øju¤îáú¸gg9õvÿÅMYßÁ슭¾reH ‘µ+žxÔ¯£íLsÒÛÑðºØ6?@‡p(fÃaÍn÷V$ ±íé;ïÀCmïÅCi­ç ìÄ‚åjÉÜE„«ì„{„(“:1 è@ t/_Ê„Ͳ¿ÕW0¿*x (q”[6xürœA± íhÛ@×—ñ¥x3 p¯‹-ˆ5"l)cÌÝ™$ive`÷é8obÓy¤ ¸U@x’&µžKÚý¶‹4^êÚz“n2˜¨™‹–]qánnU¹{S —Gc›~$nõ— lPkè€Ó—¨¤^ŒÎ3A †bæe]n«fÓ´ KRÑžSíf5wI tI±/:ØåÂg†ó¬wGoŠº‚“ V•Ø•IaÇÉs¶«²Øu¤=@WÓ‰…v¨¾¾)öÍ ”çDq ž²Î8ÃP`ÂH‚;uÀ5Ô¶ ~Ž­IܧfgB&:AÍ­žcDÐLêžßï›; eÍ¢LÏ£ìU]Áï”`1‡6<“k_Š«öJšåðL¶}¾¿¾¹ =ëBÉL¦}<¬‹Õ§D&KŸœGßLÎ}¼¿ÚVÀx ³Y—Jg’öâ¦óõ@Úè,ÚØLÚþjÖU]ü8^-4TÂK•¬ÏÞ˜@¨¹(Mé 5ÁYàÉ$Yq[âàÆŒ.Åœ>â~cQû`±\p3IœºÇ4Ë$(d;ÚÎ âÔpÐ݃ –`YaøL`N'ÝäBfCÐ+S‰³Ƀ†rK•øå¶Å-°à¢Ã¤™¿äÔÏ&Í’4ó ¯J_h¿q] ‘xC9¸j˜-ÆÂ!nMLW•0}Š :r;ò}Á qòD8lÉkÎS(Þ›ÕËr³…Eþ:H‹8qKø ea»/ÇOÊ@5–6h8aAÚ—‘10ÇÖÆï’vÞk?8«M Tçá)4ÒÝÃÙ’ †Õ[W°ÇœaÑoÊ&ÄÍe¶#S‚ÖK £4«’qIÃvÁæ(:äeÚ­c‹lIKƒ˜#âò%îÌ2‰ ÃI×!P*Âlq# ÌI®-Ĉ>¨! &Ê.p\FœÚÍ®XƒbPc`Z·`±WrB1‰ždCÞýêS>åM>ooüÞ×»‡=Læ» !︻O—„’œsè>?olüɃ6S,•5Lc70s‰#ŒRbRû8”Sže$±¹´´•вöRÔ†ñ~·oX¶¦qTPDަ¦sÝ"TÞ‘(uÑQwn£ˆìMæ‡ $‡¹—ân>BÏbdl1 eçž’ §lö-0·Ð!’`Ì­“ì[½ÕŸ$KµÙwô­>·÷W‡m¿ìL>{o ?Ô . ®3ÆÏ8•p³kœ5ƒ’QÉØ v”A5})§(ÕÐú°…½Ñvž¤žL(»³.ÇHÀ c3x¤Æ®ôBÜQ½üÐ>”w÷0… mÒŽä0–Í®4¨ ªb3øH\}žŽ¨Þ ~,Ö ¨‘§{à÷[ø¹cò%É>ÖK 1*Qüµ´Ësd©÷µ¸åãƒÉÔ`–³{°ôÏ1ì>¶ê¬ aHJÅ–ó‘: Y¬_@ —U¹F ¡èΩ[ÒÓ¹ò¥†‰Nl`;â®Ï|zWÊ9k[€2¬nù•o”.0ÛÕ–;+È$¨ÔY-qçU÷æÏâ´Ûª„=-ë°’윗j‘+×jP/ˆFI€’Gϼ`Ý›ÁOõáÈâ³ðz±vDYÚí¹ãB®W'Þª;ÒÎ~°¸—‡+%vv*]sÐÍ&&t-qçÆÃN¢O×å5ìÙ¡{–ñz¥›ûkmd” ’î%Ö=‘ìFÃKÅãÏE»mì«9L t¸¸‰Q7;PYÑç Ñ-[OßyÈÞjØhÔýF˜Kï„ñÂ^e8ør@V ;ƒŽÄAÓ‚…Ê¥jØ2ô¹i0eáAV „[J>1,Ò}9ΛŽ—¡ ÚÜç¼µC„4EÙ«ö°~¨Š5¸ /uql˜Âª–€RÎùHûãˆu3@Bæ|Tb/Ñ#u ˜ú®c1 cj&ß® ˜ÞKöð#åætÙ·ÁîËqÅŽà‘º\XŒA½'ø«À ¿!(Ïd“) ŠÁ#y0þ¶§T”×—â®ù ò’¡~™0ÉeŽVÙ¨ ¤_8±jÎж»>ÏCâÞ |©ÊºÙB»Œ»J‚ï ˜[Uys¢ ^'úü:S]ÆùƦY½;'VL›HçU.5m­¶ËíÔñäåÔÈ~8s w„ðüÞp­=±Š{þÜ£÷OGý9s÷¨L˜gGéEx`Åò¸û"ƒ¥ŸXv@UX¬®Ü¯Þø6úÙ°xÚïÐŽ–D;ñ`(C—Þ‡¦Ý6:™?±DüZ ޱ€ÿk‚TûßFš1J€Õ $@øÈÿ8Bþg!FÀãÞ`l+i.F@[~³ý×.6¿ðÑ,¨‹ÀÙ2²$X p„Ͼ—UÂý³¨ú%œˆ‹(,"õË{,‡çÿKݵ5¹mcé¿¢šç^â¼l•'Ž×ñ¥ÜmW%/[è#qta%öŽú×@u‹ ’‡3µû’JÙ–tpœ¾óüzä«ÊÍÑ1fCßítMWz5öå&Ñu ˜‹Þ|/èÜl¾Ê3í±Þh+€¬Äd^œddŽùnÒi‹¶¿¾Õ1“nÚˇ·¯Ñý“> ¶c¥öcg#×r.†÷±mW-‹Ý}5¶Šwkt½,Ã*èþˆîd¤-õ,l/íÁšc†‘l»X~*Gµ€anC2¤cr!ÁþE^qB3·üo‹ C_ÝöàÕºZŽÊ-…tQ)hðÕâ⊪ çË Cƒ¯mFú­8Ü—û±SqCaN!êeü€˜éïêòƒÈ£ü8˧ühþxve&™|û„ûåhl€±óå˜ôÇVbõ©ˆ¼Ü1âwêËcôï¢;@° \N¿S—Oz±Ìïu@,eì,çäb¡oMhlvg7f£‘v»T váÖ¿Íõ}ÀA„y~‹fhm_p±Ñ,2aà,08RÎ1ÊT²vŠ…ÉÍf—‹—lÌkQ÷ׄԃ—²Å¡7çê[>ªpLD+€ý9Sí÷òzì¨d.Å–msúîOü湬òÃ,îÖù¨ô¼£áÃÈ/áð'½4Þb,Á(ÐÆh}ãµ —Ÿ‡Œ¿Ôû‡5ô,R“…£™(-"$m\!JžVxNhëüÿU%„|§dbDk¥¥4qj§v#΄ˆè#¾yÅs³š?Rø;º±ó†Ãr&¶$ÐÖ#ºñJ x Y´"!íØ±Š·¼»mE‚RKÎÞV$Ì’Ü’Ä‹rÆ*-ÞùÍöÞ¿c uuK’€‰&=aúù“Á—×NF²{½øPo‹ë€®ÒåWéåØB3ÔÍ2—ïMp†ûìK€éŽ-4[¶bŒ‹²ßs=ëˆvšNe.ø¨VpøÒín¿Ìú¶? ð¯Q­ ìך¯¨>×{ޏ„oõƒ®ÇãsŠÔi Êx¯b$D1‘ÑÏV.èy!s©¥å½+Öe5ª–ÎÇÝ'dÑÛqþä¸ZÂ'ä/æå¦<¥•l‘äo ;vúhÒ}ÐõrÜ ó|ÜebÖkPDC_–º_±ÏlËx×á÷=rlÅ* ü»üI_¹Î‹iÿ ·å²±Á€èLuŒX߉ó'Ç—I"m‡å}ù\\»TÖ.õ°Õ^:g™íœ»JûšgÏŸ_fh«? K¯¥&3¹0Õö¥|2G|gSíQÍŒu)Ǩ׋)Ð9Tu¡FÀ˜ì²ÙÔs‰û?åë|i"Èñl×';'¸s?TÖkø$H=aÜÿ®*ïó£^ÜÕÕ¾~ÍR¯»,m»É'È™@™—ìpÜ}žP½¶/$;*Òjröltз›™J ªíPùœëÝqüDø3 dÇ”HÕ" Åh{ô±Ò‹F¼+m鼯W˜Ò©¿Úq¥=+™éÓ¶?µ¿Ò5´Cä¾Vzm2‰ñ…z[*…ëës ½ mi”§§ë “WÚòH˜Ì`4bÅ>!檗÷VypÚPi!Ûêë¢UÕöÜj“ò[Ç1º¡Húd ¥ý q÷‘ƒ‹l@ó5Wa[á…WÜr³,@*¨N$„q¯mçÕDPyV. Z$K--Gýëq#€}ŽF®T§ÎÛ[áÃÄDfÒ½Hvåõ¸Äüwù6/mïàèRQÀRì>n0Á{í‚ØL"°œüŸz¿¬® ûÛ®—»bWŒG2È«ÑìF·’«ÞÓŽ0d¥,ɹl† þÉ\'þR½¸«·ùø÷ù±pÝ»¤¤ÿ€|¤~Ñvå ¸ø¼ú°­G#xŒq ÷1h?9¾Ln»r™´›cé„¥ý5xŒA»Vh¾»}ñP/Î^·\rñb?l`½><„¨jBò¾º4†ÀC ýØ/åÃDtÈ@ç4Mkô¶s¬ÿëýéñpšö9ycöï×z¿ÒÕä6o©nÐß^¢Sz¼y*™‘ã²ÉW!_*ó‹ËòŸá‡çê÷»¾E×7%^+7Cýâ~ú[¹ƒÑ+¯þoûAO_¬í·¦Å?€¡ø,žTÚÆ õqÐÓ·]ô´ ÆÃ}øéìÆä•1ü4½ýýÜB»ž]ì4¦‹L.PÓ!çb§ÿÌ¢š8èiŠ:Ýܤƒœî§½ôŽzgfa}wÂúm^­ŠüiñÕŠ{æå%‹jX3F'¯3KIA§€7±ŸШ úûYÊäwÕvÁ~Ëo埋Ú^]Êæ;Ÿ[]ºa :´és*òõ+ÃÙ¯ù±*ŸõS¹Íü4zÁsÍJV„š*wŨš(óÉu$ë¤è¯e6×S ßž6ÇÓÓFW@%á„qx e8Mºï›5]Ñ댧H†%ûQV›.Û\I3-¾³Öû•¢OzQÚ¡ÄÇÑ3ÖRFìr1)î"C]‰,‘f7ÌëËæô†±H·Äe=0¥ѧTÛ U>—²ü}\OæG«ÂÈ¿-þ×üiu™°v †{CV¿ž…‡ÝŽæGËåS±¡¹ÐTÛüÿ£Ü–+k§œt'+çœ Ú4BõQ—ŠÜ)#èx§°J°D4„”í§u^å&(9€Çs.–FE‘ó6´³äí6Ò$YÞ,‹Î”vDÈš*‹vqÈ„ÜdÝë.o"ó^—S& *£(qÇ ï‹ýªÒÓ®†´PcÖô f¬„.®Ûrx¹CØhœÕÂYP§HÍ¥Sæt±oŽ {åÕ}]­Fu)˜?`#sgpõ*R@¢Ê/ÿ±Ì]A“DÎ¥2ÑR³¤B_qæD0åÖÂnõÿiåùÒªLB¤Ü‡rûXìK`€6W j;~.ŸLN8ÑïJ䣼;ìº w~϶JHtƲȪ³œ@·;[5¼ßøõ°)Ÿ¦©É O$qùM†Õ N"S!:Ê&š³,¬”ì‡IÂ7Å)_üVƒæý65>×.¶ ¤Õibl¢üØ„ å M$4‰Œ¨|‘h³æj?V5ÈV/‹]QMÓ”òÍ=uIâΈ§>MA‚ŽÈ°ÊWAá.I Ƕ‚á>–Oô:šÈÇ ~#¢™È4ºÆJ†g»†—*ð‡'½ŸfMmK²7W˜sÚ¡‹ê=]$ƒ‘øÿ,&Ð=SASj;§Éö±Øç‡õ\Ü™Ë#¶ÓKM0_?¯'m"ò+;™.ç—ØD "sL­˜+ šMrЧ‰öå~¯ºÌ6×[µ4JK;µp7mý°&sç ò l!$¬‰Œh}Zt‘sa:Û1­ŸÊÃæiì!|Ç’ÆFÑÑTñü¹qÅЗl‡w«—DÜpÞüY›³‚n–ñšàaÔ(š«žÁ…«ÇI†?Ô)gŠ»CìDoXñÿZ¯A}¶–éá²׫q–†HDÒdû#ßæû^‚qâ±Dñ~;Õ÷yu´( X ÇS¤“‰û±Ü–»=4`4E6•¨¹O§cqX?¬¡©K:v©Wâçm¾1åp„ëåËR¢óÔkq›Wõf Î’Ò…µ÷V»½.6kèÑ#)×B‘Ôk±.vàI¹*Õž|±ÍBpFpÒ¾òDÅ}©r{æÊÅõ)‡Ë˜´¹©7÷s¹š1£@¤­xk½;•Û |g‹è!éÕvZbÍýÖ4…\$¦ýo¨<ìM‹h*6+½Ê·=4Ì•Ñ 4W›M{í´á“~žV$دì%ÍÀåž|CìHdûYL˜š™«|ÓÒðÝîJ·MS“_|AT]: 倚 ÅÁ+ß«˜ÀóÄæJ[^¾»ð6AM$x2cwÑôÙ5T¹"Ô|VH`‰k>I§Ë`’†¨_B’ ÕÅ^ `>šÏŽkHÆ4ô¶%•q3’&Øgãkv/)5ôq.”WËÃ÷»6±ôVO«çR¼Cr át`!u¤/ß« @Óâ/‘*Ý·Óý Ö\Þ¯¥´{‚~ÒUqZü¼ÝCæù>Áyg‚îßBP¡·û½<¬7ºZ|ÞH<×hyÕ2¿]UVKóÏô¸¢|8cîœ>¤(ˆó‹°¿Ýê þ†8Ì!Œ[×–ökñíB*>¢$îû>¹¸p>Ùÿ`Þ|v\K<†˜»/7] 0© dšxÖ¾?¼Š6ñx®·ž–áîcQM|¯¾ŸæÄõÓè éíÙNqÔ2ö(~p¥|.G¨Z4Mñ¼Î'ãiˆð\!Ø}ÚtHSg£"€#êÞXùiÀD$Iq‰ {DÊwÏyõ¼žàAO?AÆOÅ{S=ë>@«sá4TKB›o§7 Z¸r'ŠCBÜ¶Š°Ò¾ uGIåà,Q¸Û£±ÿ‹/&Œ†–ƒÕ\Á—¢-¾*÷ùÄ÷tŸD›³ìvJ 4- ,5•4‚ÂT¥f«qµüëiIµ  Ê•‹:°¯ XD˜žˆÎfd;îð1?NQÍ|mÎvë€ýVfw­ddÈa#å_ˆ¯¡ ô‚‘í÷| n£@3¡ÔÏM/um9d§maЃÜâÑyv_ߎÇÒ}h¿”F1f¥t¿e+ʰT.wÚ@8D_¼{§¥7Y„ßDÆì¾.Ú Ä¯kÞµ¬7eu,A5[VÍ:]yˆ¥Rà‰°ãÿÜî¬RòªÔÅhûyµ5ÚÙih¡“%1€"µèX­~ÒGh³SÒ3 MÔÝ—Íñ¤ï+pÅ¡¹2â–ÜÿûrWWG0T²¦M\ÅÕMqßšÿÏr&žÒîÇ2gŒ 0YŠù!ðåLjËi²½ßêgp']šAG‰¢ý(›)Þ†ÎuðÛù=U¾·ôX“aîÕó0ÆÒµýç×=ÇŸC z˜Æz†öp"¯4¾€mdL8ð —HC¨% f£“!ðzã|ÖµŸ”W»iÌ/7f?¿0ž  ¸ŽÌR2R‚ÉT’ zX¦IöÖ¾õî pS«L²ý"Qo·å¶˜ðÄ;Ê¢áñ¾YžVù(Æ‚š8Ï ^YÖÁXô. À"L¢ú´)¡4sÕ(Hä¿Ó«ßû=q¦„[ñϰDÞ“`ǾÍ>¬7ÚÛãói*@ì|دêÃ:?B0;>1VŠ8Áz!; réH¤®Ãÿä5Ó–Éé^WËÂ$–oõÖv×X%ŒÉ|Æ|¥Ü(€õŸ ‰I ÷²}XPW;ßéh¡§&Ð}XkÛo7Õ&?60u)äOÖq›¥Ð BAb&ín9Køï†1’À4.«ãzñåp€Ü(³bïFqîRŒÂèFÉ8“àF?mô3͈gÒÍÚž©üaïAŠû^Lr†Üû7ðXrc4´Ðï«òŠ5#|®t…¶|e•>ìË¥}½>-6•>)‰e$˜QGT××÷i‰e -EèÊ^¥æê4¥ÄÎA^6"Ým ¦åµÄ‡LU‰z³ÉJUÅé/¦«¡o"¾©vú J6Šæ;ÿí³õQ?Uå£åó‚ž?Žãôœ³ó:a4ÖOs–Jä‘Ô3zQH÷õd~#2©ÿÉ$‰'ÓÄûœ›±/w'¸Û&)¤hJ& ø±8lË #‹ÎRÒÑŒ¤êïÏcäø“¼)·&ÐÍ«Sù\wÄ\·ÙícZMƒÕš„Á§QAî`Ü‚Ý4ÚÊ´‚≚˜v5µC©Ÿòj9‘ÕˆaŒëì„Ûj ¦ùð¸¦b=C‹þ-&*l¢Wàý¹Lñµï÷N¯Š-t®IÒ[U–(áGós)ß+mÜ\}R"‰¤ ù5¯žÊº‘j¤“^@jùns8óølSææ1Û“nèL¦ÜY¿ìË¥tê(R¨+ Iû"ƒ%IÁõˤp“4?éÕ¾8–Š“øeAñ@DÀ?Ìo”õáØS¢)I…ûTèÈçòð,(&¾ÙGcu†8ök®È)z(Ìû[ÿ@·‘±ïËj_žÅ sN]õ%Kyùº˜¢WËUæ2Îì=÷„FŠØÐÕ^C_¬™JÁ^¢b²MH€±LºN‰ZûVß[þR°­³¹–6hÎwùD.æÏv%'Îc†bI0$Á±ág9àh–d9#iÂqøSúP˜HzPÅ/¿Vå¦|œÐšÙn&$Á‰ l¢™ õµ™¦b”4u‰%Ââ`› 6©CZíbShòçõ²®šš7<þbIcVE|³^›{¼¸­—Ï“¤œ«·šÓ T‹ûiS™ Ú@i¬#d× 5°0m1¡q>×ÛS; æË$Ô óÇc$: |¢ú©Eƒ” b#`vîæ\µ•vÌ]9QG>ÅH&„K1‚ø@Žzìæ±n»œ$f®ˆ£ýrwªwÓ:^™?ÐÖêEuÐÑlàÖREFggAŠJHƒÌhD´ÛºZÕБ'õ{³DÑÎ$Oº:Âý$&s˜8pøue_(ÆÉ8vÂZÂÐ@“CâZëÓûÅ÷e­ÏÕYÇHÁÝéišB ]hŽIPØ@R :Q‘ æéù´½.™rëãZÛÞȹðçî2é²Ír4`¢ÄáGýßÜé =Ç|®ØHxÀ€“@Ëþ[b®Ë Gý½„ø{+ŸC¡ðêŽÉæ7YtLv»`ãooôd*!‚Ç™J‚Ò°…‡!aUÀ«åIí1 k‰ÈöæaÇ(Œ^7Há@î)"ÛG=!é˜+†nG=|¨6õ$"Aæ=Æ¢ÓÄ,øPÔä!ºt^(£7ø_Ä]ëo7¶ÿW„~îðM÷ˆ½©“6iЏi±ùŒ%Fžx4ãIN¿þ’#i|hÎŒÔ.° ĵ(þ΃çÑïç…çjáÃV€ñŽhC¯ÐÊÓÝ»P*‘v¡ư-ûžé ˜Oz bmWUº…Gn&µ `Ùöq³½É³õe "ü2T1•¼2Ö³Û½ó\>kèÕ¿”%: ܳíÈåƒU?NU7¨é˜‹Á¤4»‹º ©êôï3Ævžä£c{sÚ½²òÄÜŽ!†w`XÆ¿wßï‹rÖ’ ÕZ“$Ooï‹l±ªÊÝãfö¨«….¶éÊŽ²ÿáÇFQeEf­û±¡•Í =v›Íè¥ÉÜ ØÕ³ÎËjÊrb—×MäÇ­C¶ñóaøØX‚•!ضAʪ±+]ø®Ì—éSlŸyZ¬v¶úºO¬¹†»ÍgޝX”ëÇt³ÑK#}…ñÆÍº½´Õ˜Ð=§ähžZUwåî¬Âíª»²Zêj–ëbµ½·RèH¼-UŽ|+§(R2öYcX;ˆ„“臱«(±ŒŒÝ§IKUŒïe‡àè÷ÚFãýÏFaxä|Ø(¹è»Ó“)a±Ï¯½#Ñ ó±û,—Ô¡˜‘øÙ9"aÓCbSwÖ*SÛÿçú‡Ã¿H[ò;B|QO¢,Ê>Žltõá¾bci°bQZuûî‡Ù¶4 >ž¼’î‚Ïæ^~³D€2Š.+¾¤Åö³qG̓­ÿ÷37[-?×ßa6ccæcÍ{šý}V,õãgó7íõG3û?bçàX­*Öõ•«Ú~RiõyOÛCÜg‡ÖIÇmvUCOýìwÜ“A˦^ŒgŽ_µ ðœú;!d¤åGs|ÜW?=åSé<[™_…­\›¿vnïK³ûÿýŸæ£ÃXøÆÂH,tQÍ~QL.Æ\B¤²}޽ÕÕ]–ÎÒb9{g¨Ð…6Òä ¨[¥•Y“¡+•(ÁÄ–Lt$ ïçõtd '}QCFÎè Õ3à†Díßû’"ý”йqË…ŽÐádN¹ÓïŸÎ¥#wvò[•ºùa©3†¬H¼¨æÆÌ±›ÜŒ4ŒÙö2¿K­q4r)·ZÿÀÊlìbóg_ïì#NôïF®˜±RÞí6y¶öoVx¾’‘?õƒÍÄÝÖ-c¶ÐE›~|_™?´,ÿ‚Þ}ÖõÃK¬lO»|q]•FVþ>ÐÀî«$"<öY¯ q#·Ù+4JçîgUÜ qt/fq+Ä«uŒóºÖ 9~ïz¶:Ý8âéC=0¹˜ÒÉX!‚›¥Øêô·ïûèI¥ì§¶vÔºílã«ud­ômSs[œ<ªy•8à+ŠÕCåºèû˜VFkÙÛI’K½.UºxÞ½ùË»9ßÿ¸ÑÕ“m9eÿz‹Õ·¿ô±úÀ¨Sðì&bWåÛWØÌÎ;ï K“¹¹û7ºZ÷ú,hï}M÷Rk'õæùqóŽð>Ž£]tÀÆ™k†Q»"`†Q× î›aë²H«Å}NHß ã¸'¯ú`b¹ÔÀЛD;(±X¦ùn“¹I@u³Ã^ú†t2VDÂHbûøq¢Ò[âÀ×{/6­ú)ËA5ˆ"*Ç&½aF§ÑfçpV6ÄáhÁrðøêÜšžyF¸´ná¶o/XO‡üäÚßÒ|Zì4øž—Õª³m:»¼·hË­Ívzv½ßÅ0¯¸›|-³3>™ÖW‰1 $N~NÍÙ¶4×pv“n¶jzáI­çíAi¼Êò»x‰@ÆâMšRÓH³Á·úÎ0/ dpíç*–Ei ÔCB(¬."…m퉱 ½±»ùµ„J›˜zBJEL †°‘‡Ø¸Mg×Õ®¶y~×…ñ`¾h(þÇ|aTÓH}›nf5Âl,©ÖòžÕü…°P€¡áÛgh*¹³·éjW@Å›‚\DüdGü¶é]5ìÊcä¾\a^çÉcc< a ^±ÔÔ¸¦ãK°§mÁ#×u*Á[=l/bLÝ Ö„©jpQŒcAp`ÎúF•¦Ë2Ï–@)'\¡ÑRîeqAɳÏÝ ½ÕP7!1ÞÍ”jqW»jUBÝch³ññ5‘oVÞ <M l"ÏìŒÅuZ,F„±äeî%vï¥AÐw†’ûAø¢ÂdhŒ7œ8(NEyÌØ¥^¯ˆ £Bí|rÏS½gÚîÙì¦,PM³ÞuݺìP²"1"ÃõkÈðõÊ.)šûP.´Y–’H>¥HBaô{·-×4JgÖcBÇ“¦¦‘ö{ZÕÁ 8u†w£©chu¯ËM-{zkm®·yyWéhkísLÇûçŒO£õ*]¦pÄH:ž‘BN#î6½K—:ϧ,U’Œö¥(šxÊ¿k#ƒ› øòš2Ú¥„Oå\í¡”y¹-Ãßè' ”ADlû»ÑÄr2U«t‘æVóë‡à¯c¡Q¦Æ/’iÄ¿³U*`ÒŒžÑû·üj³­ô:]îªa/¯i˜í{ÔD·Œ†‰Eli˜¯%ô‘Œ$Æ}}v2™FÛ;ã·»nôI4ŽãMšg‹ p ^WNœˆ6l†4z …)C~õuYýjÌìÌåÑ8Oè4êþÈVÐèµ”LŒ˜&—ÁÁÆ¥÷»ð/#7_ˆ/ØlÝþ3c Yè¿.×åf«½€±’Ž“¶ui.΀ ûI%,!”QÙNòë Kuµ ’„û5 /ÈœKb›ÂwìîdNCö;c#$£IÂlm¶ŸD®¡.¸RˆŽ'NÑiĽ5–l¦MHÄÇ¿¡‚p(¬b¬ˆÚÜy­ #cc‚㟠ÑD*Úé"Oï*pb±£x¢øÝèmúš2êx«O?à²ZÀc@qv k˲ò€|»j 7p¯UrB“FÅ#DP4æ 2ù;¡å6jÒ€F™54@!Åi×ie“+ÁîºPœ]äQ 7á±_Ó§´ªôÐÉéÎ 5ça•Ññõž¨XPŸHˆûƒCÀëÇQ ‰é…¤º‰£}ÈʯÃBMÝ^[œP"Ú©à4úÚK!ïl8*WUY@+L%¾È[nœ«?Ò\ O¥›?›¨„ж¡¬±¨£ÜDG°“˜Ì‰µuzÆQû¢ÌÀkH½ `þ'§XO# ¶ Ó³…±V#FöË<]Ô¥'°TAªÆ‡-çÓ(•/î#d¿Êÿ‚ZoÆåeãÃBhÉö‘À8†„}®Þoy Æ+ÒôrmIêd¡wz™mm­Ðiaç„/m­¸2A©Éõææ–Ô¯£Ê >x ®[Šüg§ÿ®ŠîV6Ñhe“× #-H˜» 8Þ÷{¾Ú‘ˆÓ m_¤Û§4¿K«¥ç?ºó‹…}Té$üá´zÀ UáÂ&:wû3X±³ÉDχ õßÒçYº\gEf®HeNåîy¶½×³wõÙìM±ÜÙ÷+ÔŸ*;r±±›EvÐtÅÊÞµ»ç~~*¬òÈŽ´·[ЫхŒö‰ïЃf6P€9Ab$@4ðM/µW”‚ƒÃÆ÷•­3èˆÀŸNe0UŠÓHM Ö¤ÐcÇ}M îU¤ !ˆÛ•¡.#éH’aÆÆª`ûë4•ž`Ñ-<±¹*¶¾0ÕŒ¨;©Çí=mÌ…\¹ò%…¹Æ¥´.‹h³O˜g½Ùo÷”8Ù”„É9Ø%…®jò‡UmA˜Lè9îiÒvϵò6&V¤7>ÈŽTMbe®²b¥‡Ém-Èâ² S=%9%å4{›g& 4¡¯òÍCrPì)Ùv¬bj‡S‰cN! '¨Å?åt1˜ëÕHUÛ²‡‹!QÔác r1,M]–‹~{½@Z@M;Œ×Rаÿðš4¼.·5«gåâ~vUÞï6CL§ÊͲ¦öÅ¡q%QTÌ©[Hæ9qÀ¨'ä"ÄóÀ”¨BRýHäU‚“3ΊuÎÊfÕß ‡˜¨ÃÇFå4‰Þ  §ƒ•œ»'DoD›»gØ­ÀÉ=–ϼf~mSœöÿ2!Epb”Å…ŒƒàÇÑË.Þ²WÒ|½Ù¦K¯í¸étžT7êõçt kw"²âU[Ýa;'ĸ lG¿Ò¾~å$`½·þÆfWÎ8çI¤²ü¹,ÊGcŸ ã6÷'j‘Æ*dÒ×tCï˜âä"àÉ›§v)V@WßÍÒ£ ïÌæ@ ‹V1ïå'ȾÓV“ }›3ë‰ñs“ñ8Ša䯙V£ÈÃD¨ËqÛÅë!­RP€Sy39mR^[åE¢f™‚èæ˜e¤+LÎC9óU¦áv¶ÑÁÉNÛy1|Ö¾Q•˺%*äRñÄ‹êp‰:¶0ynd•0q"¨lXî[s¿>C%¶†rŠÔeô~£¹Ý–‹‡û2_ðÎöCÜ&p7Ésƈ¦ có”}LœVæÔ‰ÏÂf°[/ŒƒŽÔeô?0:!ÐtAç…öññq“æé °àÄS»ª#ãÆ>‹ †ñ¹c°ØðOÿŒü#:„ecLŠ‹X,µ cÕ.*KcƉv6=“4ŠXæÈ…eâJxø¥ù¥Æí;ç ¤»ò 9'í!Yûæ„pä!¹¡£idGQÆÞª8‚ 'î`䄌b¾†ú Ò8˜òœCâç@ ës¼0vèr¸ö0·sÄš@âBFyºîû“3!7ô(b¨ß¤Ð =Xþ—ÞÀ¹è2h¯0ì¶rbж}N’¨€!}.NGšU€å{™5Ä;ØØXžÙëÎxF£áÑ—²ÒÙªxa,óbö%«6Û+Û¨¦hLÏåzòÚ¤®í6Hýê)-VÚfÖæ³·¶k|e“ºàs?Ì¿õ¢4º 5ÀÇf/Õ½ÿÿžlG&9x|X éŽ@†PѶÚí·lû]«o¢:e+8­MßÍLûäd¦!¬bÍ’­EEE{Í’û‰iL2'1 Ù~ÆÝÄ´/ÚpÄH@;¨Û ™õš!×?·Yiׯ´´†C¹i¼±ø_Þ8=ïëF= ç^%);VMb¾z¥÷åì(?Ýܸͻóê Ecí½ü0¸Cá֓кßÞA“Ѭr·kpb¼U¶9{‡©ôòÍðÝ~ û®àGC6¾CÈ ßJ}ùø¨‹ï^WˆÑ{lŒ“«·ƒ{”ÞVLjó•b!.AÇÈ0½Gß³¶Ø˜W·ƒ[ô¼nÅD›  y.wx‡"Ð`£!=­Â_¤Õ¥h32_ pÄyE OšÀS±Î~å0OúaÑ7‰(Ÿz)h²ŒP2¾ˆ‡s#Üoy =KFÈeº–Ê…Fa·g1Æ”µGiÌÓh8NBPJú8üS•Ý•;÷¡mô&Û$ËWÃ7Ø«Ac”ó6}!ŠÄ´Ç¾ŸÊíl–ž¸º}ÝÓÔLÕ=ѸºHo”vÔÅÍ0²+â2¢F{qKŠ¯× óÌö›<­v›3¥¢Áõ›aÑW®z6v#o’ˆJâ[‰…ì×÷»êÌ ¶™}‡6(܉°\¡6iGÙžH@'ècÝ¿t®×¥[“8v‹ª¯·ƒ[äÄÎBFxk&«¨™ìvd nR¡À3÷w°®aJ¢‹¤Í¨í~}5|ìÒ{%À¬Ó[„DÏ"Ö*ðê§w‹ût«Ï4ÊTƒN¿þ9¸Iä¢ï"ºˆÊ6‚ȶ =qÔãHÏÚ_NïûsU"-úÚ\ÿØþ@g(}qªÂ1zƒí“Ö°ƒK·ìj?÷·Ä»¹4lQ…Zÿ¢ÝšËûåË}ºÛœ)6:{Üæ§ámº0eLÏ6ã\%ñ}JÈ>IhŸßž¿Ÿ¹Ã6Íàýà‰ëUO-:æD/1d¤Ê¼ÜãÜcl€ê÷›áMz!·‰ïñM‚ŽQü‡t§‹/:_ž¹Ë­~ åꪛ„Õp×$@Ç\ˆzåð6Ž£Îó¬øîŽÝ&j çã‡ámºZ‡Év~ Jâj•B¡@‹í²¬¾œ¹Åöýr0š#ñJç±jVñ–ëõÊá=p'+ϼ¨}.ü×°bånCgÆE¯ŸsT±rÈ!9£:Ò¢Ð@wD/‘BƒQƒSŸ†qŠ9¢­pÝgáØ…&ªmH²}˜ú´[yè >}´¸[«‹`”u²&pô]˜aÈU`ƒUfÇlÛÃ'â#Ï xŸ¯a+ÆQ„ë4ƒg“±öDX2ÈÓkG‰×H´‘'Øm(*ŸdúöÝõ£3¥–'D$IlÜ5 =¼bÜo b_zz=A¨;îZy3jŒ»<ÄRÒ}†­“)šGØ/{°¦ <Àâ¶Yáõ½®ÒÍCêÏwÔ'Þ ¥D%?UE‡Òþ?wW÷7Žäÿ•Æ>Ý=œWü ìKœd’¹$3AœYcç% Ý´[gµdHÝîéüõGªm‰M‘î[w8°Ìl,§X,Öwý*Õ º•äžú ¨Ìt[ïË<›eº câò§*VňE‘$‚"è5I‡HC}0‘ ÍÅ"vÌ¢'½°h´P„fL <:Úè±Èß'f‹°èiÓ@1b³‰Qï–½« óçzc~Â&[¹ò°E% |ûiÇ4Âx…€0˧Q™Fã§fÿ´ß/¾+}9J!OúÍÇÓX¸ü©›Ÿ«}e"t.ë=åwu{þL©]ãéH¶ëÖ£’–CØ(ˆƒŠXÒ ½Jœ<Ù>Ö%Œ:yUÀ2–JÜC±/žŒ:Š“Ä%R÷±nJ8q„ˆ™Ä~ÀtúõIUõâ—FU “-ý¥OˆRìx5Ñ2&þ’@´{5‘@%4·܃•j`|ÊG5p»7Ð5H4®&$Äûóð˜¿Àt-ƒ}?¨H8šMàôã\´&*…°Púi~æÚt,^Ñ´b/óHÏä$ŸË9 Ž>­Öº¬öS$2ß7´;€ÝƒG$@ •Šž¾=4Ê ³q©·ÖŸö{È3G·ÔØ9áÊPT]¾=Í¢ãŽ3’y£š&HY¡ŸÂ ÇÝÁ€|åˆOÀä ¢0Æ’g"ðuô©0Z¯µ„-Bþ«¦Œ87B_ZñÔin±§ÈÚ|.sÀÌù¼])ˆÚ¾ÚÃ"GÈu0ó8ƒ@jfÃÄ]¸ÙbâçóȬŠÑSÎ)u˜c-VTz ÞwàµZڀѓœË`ÒÞ |Ù?Ô¥ÚÃØã7 B1>. ñ:h`íÏ Pé™G½9ø}©AÜ‘£e ®ê1îÓ+ܽ¬‘1ÈýÝIü‚ 2~€ö ße|&²^‡­Ë‰ñŽœq7­)^yât°±þ>P “S‰´}jôÚÖO¶Ð¸d¶(nÀ&ùVÅúœi•ÿŸz×#Ì´[gÜv#¤§p,NX¬¥È²ñBägåh·bÑÖ¿o( l´Æì|ȨÕý²^µžeœj!¥ýK6¤OÇmH˜Rcøv†z܆ÄñÐE~܆dYêõ! äu"Ùf$áo¿‚ì,º8ÞZ”]5'}¸jÒ„Òfb Put‹ºùL77Àjèæxm>šÃ̽6&£×–CX3ö°¿iµ„Á·®-Ÿ~mÉ4Ú®k»*Ìè u]OÃdê0M£î7½»Ù6{(m(K ¤rή¶n ·Ên•ÉD¾]•õö~$-#l:i .bîÀLºò‘#Ï™[¿ÁQéÊ!޼N[X8M op–"[ˆ¦Ñv­šÆ\Ü[µÝtÓÉ2¼/êöÖ(ÿ»b4ŒýŠöO}F |ÛèTkd’Í$õÃM©Ÿôe6 öþäc¹#ö,nµ$<]<ÅriíöµEYŠìÃAå­í6ÿû®ÁÆ;ÏçR^=ÜéÛº©vª,_üÚ¦Ù…çW·EYîOÜ+áÑœ9î1†àoŸÛŠ18ð÷fë/X™|ò~I×Û­µ¼ê´øzq*Ò)rp¢u/‰SøMY´%øqã™J‹J"ÜB'‘‘|ŽèñˆWÙ Û% I–S1œHÙÕvcuQ-Þ´«)–#“ Ú‡£D2Ÿ½‚I"œ@ I$ð‹Ú”FAž÷Òe6H3$ÍêÏC ®â><ô< .!)ÄPÉñ°Ã×r¿®·›P˜Y‚:œ+…¸÷i¸ë˜14’x˜wkZ½9©(õC6wÚóØ&eÔB¤SŽñ-/ëmSièÅuŽ¡LIÖ¬d€¾¯u ¶$Oy×4‘2s¥·¡ˆd²ôîË»m³RëÓBâÇõ=êèáEZa‚u쪼³6|Jt“eI7‘J^Ç·3o¡Oú¿Wífqµm[ý×É«`Þ{Í‘£\²Ø{ÍAg e:‹ûü"XJ†Œƒ2dâ>› ®=óú„ê{À ]äw2êºl„GÑÛ%(M#Cà°º\·jfŒ%¤é L/"­.×ÕÒ†cW%;‡teÎRhLdá¥j‹žçâ(…2‘oëòvRª‰J”`óDò.m×ϦÑP«Ø éL¦N$ÞìûG»¢oñKÝBÓÀb¦šû€kú¡¬··ÝÂ?¿¡˜yäu8ƒ9^2¨E6º‚I³¤bO$ïjÓÔ[p@ÅRr…° øã/w %¦¤©Û‘7ƒcH,ÚF ͯ[|®«åÉàoÜÜÅEFÜé–Ëè.àÐaÎÜUv4‹ÂWÒa±!—QkµÍMµ%8î ß¿¨êùFO)’ÌǬ›vZË#kHŸžæ}h[{·W†½” {…r™FÞuq¯€o¥t:eR´ QÖ%®ëfLYÈ”’ƉÔ]Öåúb0g f©ŒS%Ðý=¤- 扴}7ÿh‹¥—äažø~/—0ƒß‘–¥ˆ[žÊ·FÝM¸T$tHWªI!î[}»Zªz©Yž@I~¨ð–1SSàÍ?ªõ#ÈÇÍFP!Ë •󴛥¨6‹7åÍhËN<•Ò{Îy"/ <ïBçÛõn¬Gyò6rOüDî¥Û=Á1H ÒR§«ÅöÑüãã¶,¡ñBŠ¡`(‘ÌKm"ôRC½$”Ò¾ÄóDâÆ\›,,}ÂÀvÙ¦£k[¤9íå£1tY ¨;–CŽJݿЀÚúMï€qï¡®:“‚G}¿Ò']æCzÕvòh;N† „CبŵsgUy´ðE!™–À¦‡DèóËñL|’G|êÒ—€ÑFc*¥¿:×åËŽY‡|”m ä£n»ŠÈyö–ࣣ/þUÃð[8—~#7v—Ç%š}ŒÈC"8Pœjšú^mþGKg ”¿ Pwu«&ŽÊw À&Ó'é³7 îþKðV¸L¼ÖÃÃ/KÝlÎ\&Ü&½HófÇáÙ>83Ô…í‡î ’8%4pîþHJøâ—yz§š‡nB¹Ñàšp–2=Ád"_T5iB” Zïýþ¸ö˜Z¦e~´˜-‹úE Ú#ûêÀÙ¡™Š¤Ož]­šúhO<æPäâY°Ò˜-…IO`\wÕè]ÞgêqiŸ2¹ª×2µ˜gþì"»Åˆp«ÿ2µç¨ŽŒ_Û ‰Dg*ÏÑÁÃØ6ÞŸ6¸~i.#ì¨ï+†« Ê/»¶E9'ó¹÷ê¾ébB(DÊD¤L¤í}9/a7Ï©{é ;Ó•êsNß÷•>tmšMN9!ã&»…ó£0ì¼þÅNÚ|ØH™¬A‰ä9šÚvøXnBãé”z3‰t~0¯­]iåb–íÿŸÉ+²>R¸V65 ü½bßÑÒ2Þà' Y†C0„–<°LiQUT´ý¶­´‚çÃQJgc‰Ä]mÕµ [GÎÙƒ³ž3U7Xï_ëv³øR,­ŽjOËØhÉ"r7= )£2y\–,gÔ÷?Ð…$þÞkžø½,šõ”Œ  M™K¥°sŒQc–àxš +€D"ioë'm?—%¬X¦w­ÊVÁ͉L‰ÅRi«Ë§.˜ž0ÒEYJÏ€L¼Ú«º,Vð>ý §ÀĦ>‰Nõ\6õzBÄ(›Iò# C`Ê$ó˜?²±Qý'!™8hm^gSž'yò>ÖM ŸÝêâûYnOÝ8—вÑv:ÎÝE ‰Ý`÷éi‰€{ÐÒ•$)"C0h–ÔzÙÂ(ËqJ ±DÊ.µ„ˆS‘2+‹@  d›‡†>lïTðÃ,‘¸Û¥‰:'U÷¨˜I¯ò¾ s]”У̑¹°£õ³„ŠX\Î@#§< AJS–S$ÌvçJ¡î{SïBIœÉwÑ’—Ý·öôM?ÕÇœJå2Veí¾<}VŠ™7õ®Z\m.—u»,L>õÐmÝZUž<µ?ù…sBNÆN üâ¡,~Ña\žyR>`y®ïšB·].ìƒñ—ë:ØÅþmÓÜi;ç³è¹A·˜èy¦óÌs÷Öÿ—âî´z!Þõšˆüh»5Š™üîËÓÇ ¤¯K]5¶ÒvæAólÀ†2QF¡ªÓŽß|HÜV‘Gû¹»/O6k«77Ú( €˜Å´3õ‘ä½vûXܯ =‡9¾÷ç®SÀ‘<* ‰ÏÇúí×ÊîÔí¹’Ð+µÏF® ‚àÕœ 7TÉó˜RC ³•{©raEŽS5ìB¢Àâ÷Ë¢2¶Ôëg$†Ò|¦¬W>mnu[îOOHöɺBƒ…«&í²»èx(¬²d¹¬¤8ÀJÁ¬üPªö¾ÞÁÉódB,gWɪ»Fï ©ˆûºäÞ8|W „½ ¾›Vëï7£qv_žfM` ƒ- iØ­™4“ø‹Ì°ŽÂsÀvñoëmUÜ^üûIíIɨkÙ)ž1kÄè><É&1¶,.™ç©OÑÛ k­nëj·ï\¥·u¹ÛW§Oî;JGËÚÂŒ:ˆb6¡Â—êÌþºa[Í›ê¾Ô- Üï·óráØÈ<î,zy›i>›K¾×wUqæI{å~Y*]©íâÃû3ïnÓç\m?.èfÇjñýÍÍnñOun‘pX8sÙEŠïÇßiÄÖ]÷@£ï—ƒn6”Á9PvæI„ºy\A,åܱv¸Ä é¢×ÊA×:®ýþ«5.Årñ‹Ú9³*‡åxªYww'íAþ$ ì‚âMÉhJ4rô¸uE<Þwò|h])†ÆBámµ:Âà•™9L2ï°9żVE´‡¥®rÿMq·ŠIôègN–“Òø©A7†‹}&îÌ“£Ö ¸éPvÄ @òÿ”;¿j#kõƒ†½4RxGý ,:&è-È ®nlÙv7ÚÈ2õÐ*æ×z·oOÖÚzŸ °À±ÃBž@Ìц®Ë¦¨–õ2µ5ùÀ½¾û¶ª«åR-Þî+Û—«NGbTÄ"®'Jqôð–%mäªh<óȽֻکªóêOE;¹ÎìhNCD£rNBﳄ1±çiq¡zå÷º¹Sº:-žüËìh HúyÀT&ùL>hï®Ú¬ˆÅ3ýPªuÝÜŸ.r2ÒoÒÝ£õZ¤W’°Å¾­öëJïm'ÓmLœšw„¤‘x©š3§rédvÝè¿["é^âø™4Ú, u5€{&ìÌs¢#ãª/~m ›Ù9¢#´XéÂ/#Šp´Àɇw´¹y—®˜æå]è —wª/™‰í®˜9é¢7«ª¸½oêíc»xÔÍ­®6êÞüN.ŒÊ}_Ý—EkB|÷çN}Š/Ì ~m&‡.Œ4s=õ;i¹}uk¡'¦ÿ•æþQÚ8CV·õúQµ­^ɨ6Ee¾wÃÝŽÂ"í‘ÉμñÇ3–æ¤íDçѳ̣eÁÍ[t'í!N+s )s&õVlZ>r&¯~ù’7ñßëËŦ/BÞ½ÈÐûï yH "͆´Àý5Á1ÜM]³@ù™yœë=!øäI’­ÃÒÍK"/qMüìk¤ät)x&õ„ìÒ4¿ÒÎù•¹2Ã}zÇ}«ëe¸ªn#4£°-3ÛK_ y§@g™ ùáÖ ±!K*c`À(•[03àEsÀEK&ÌÑóŒý~yæ~®š0>ç@•qàóEø2Ë€)-]—›qG†‘ñQ”8§.‚µ ˆˆ²Îh<^ÔwñÝ4£f³"¡\{<¡nLhÏZ´Ë(+9ö絜ûùwáóí",jÐM¥œ1’€Ùó¿ ë°‰/2¬>ChÝ"Q Âêúk»ý>³èߟÅàt™7mð]ÀHXì,Ga]߆%ˆúØYÞ'æ…ý:š Üìé››z¹ 0)€~€nöô/«ÛÛf]Á~_aßËy&ü. ,Èúü,ÏëUø äA.±гyh®×° ú×g´‹›°ºˆ\#Bh,|‚³ðw€]Çÿú¼HJ †I Žå/fOÿ6\Àô0çýëó º+KèûçXô šëЬ`¿æ9 ÀÙf¹¨î@?ϰf˜Wóo¿^‡Ï` ÈÐHA ¡Î¸‚©A†UC^@}}ƒ -æmÁág þ}õˆFª¹?ª¢¼Yb’ ÑŽ@SeØItÛÚ§qj I‘n7|êÿUã•"^@¼eýP t´h å& ós'„IÉýžŸü~è'+;å&G7­˜ÝãÜänr®r‡fè$3· X©¬ú¡¤:y?ô’»£îñó‚’¦‡“ƒê½£¿ðÙé&¬n†Žß=ƒ$Ì&ù/RmǶGØjV›ïói˜í’z7ËV¥2凾g›jÖßÃÕfLÕ°@Ùç2Vy¯úSõ4—S­Þ ®qò¸%äm¸[TõxÔ½(Š RÆDuP)õ4c¢zÅ­§áz<-Î2.²:.¡¤èwÒ¹©Êîí·óÀéÂ2¶DÚ#‹ÙÍî Qè/Ãüɗ먨f]¿™†M¶ ùÑvâQ‡ÊÊ›”íŒüЗ†yÿ:ì­h)ü½»K™]7³ðåkפõ¾ŸW“-g~4U©Ÿ-tw\7eþz[]·@æÒL?`½;çau= C6ÖFÒÝßRÀ¸hÞÜ~;™½¸=,[zr)=Ò4¢k{8¸Bó'Zb¤v»uÏÂu¨W×ó²+¯AuFôd—Wfj¦£÷Æá-ì8ÙÒö8ᵫ®}Võên5~={\!òé ¶/©¥œݵýtö´²´ ðïæ‘‚z·78™»ó‡ÌïÔ¸~ãaS#™¶ŸÎ²´-øËâ‘»u²¯Â%ä˜2¿K¦\³›ê`ß~:Ì ÔM}÷eS¯{T³;êrR;²«û,™t“ÏV‚n´0§ýk8xì„‚ÝjÒxΰ˜=§ùl×ïãVNSn´0ͼ©¿„ï;æ®jítV¡E3ÈŽÉD¿íVLÅñr™…}¤§áû2ÜħV•ÕÕiÓ.oÀ¦¶ì‰ôÕnÅé»(@"y³è9dUý\²4žÓô Ëwê»»ïÈ=û²Iuk #Š=Ñ\FÕ[¹ó/.b#mzs½¡Ú1>ivB<»ÂNÇ´÷úzSC±q‚€Í¾vŒmÈÝS±/ 4ÀJ™“À–p§?ìGQ:¼Š7‡ü*ÞÐ=!ƒl¿¥x"¾†® OµÓ÷¡²;è7joHn¢å.M[J·Ô]ï?ÔŽRª*™*§æ#4XçÊL¥© yÔéb§)î$Á VÖ¼5~n.š«qÛhÔs&Xé²RQ—r˜{[®ØföÐ ZÜİ€;$æù0Ày!Ö‰Ÿ›vyW ë(—õEµ˃«ê¦¹\‡ËÍý¶Úp…ø%ÒR‹ÅEjSoª^œU_瀞øGR“ìÇ%åá ¯Xv…­»Øä«AdòÜ{r£Ê6;¬wu·=/—êQíÇbÕܼ­V H@=ªŽ%oj‚yµ¸™ê’ŸÌÿýöûÿÕÕ]:*yæ+¿_Ägðw¸ ÿt€_+æãÑ,²6.µÊæ¥7V!nuß3ü¨8<ÕÄ(ïÇ'C–÷Úo¦ÚÛ|±½M¦Ñ =–ç~Àòi”HÎõœfUáÇÍMšd}{wùt˜sv”}f|ÿrÈ‹ÌÌ;–ñyWÆehA•ÆÂ(ƒ©.qjTe;úõ“(^‹½€;—,V³›*½hë1Q™'¨ùh¡fl0£–±É ºæ…Ù¬yZt0)¥ã¨>Usv[‡Ã~1^$ÜÂïo ñ®€Ä qFЈ;k.@ 9‰r®¹3O·Tít$MEƒKi4i–ˆÚ_íJ˜ÐVá¯Ó>â­]€!Ò&ÑÊ£isDÐNCXÝ.@ŒˆcZ Ž'ŽܳշQÔ{Š4¡™åMš'â–ú –pâ„cÜâ‰#âöG›:a€òÃzmÑòƒ3"n¯[è[ãJ åð„1;^´?j0mBK…æÎ•¶Ð`ˆ“Ñ®ÄGîC¼ÑËE~o\DgëIbz»Üíçñº¦‘‰ÄóT–äNL¤NÍO˜H\€.ÏÝϵÍÝÇdnûŒw<[Ôùûþ[_—6ù‰qsÖ§X7\8 ãSÇCNêù¿åQ›´7aõ,Ô¹×Ì(ªt–©ÀªW£ ÷‰u¹7= <ß‚™æÕ®““°ñ0ÒG¶klþèˆèÆY<¯Ž6Ö‰; õ¦¾9Á"ixÜ,·¿ÚïP/.j ÎðŒêˆ ·`Ê£Ë#Õ“ðéC*úETM×WͨxjÌ«.+ç3]¡MÏK 4'yÕ.n‡êèƒó£ÔŽÄ^ÓÈK Í;¨êÔÑ’hÚc4Ú’bOÆ5Py*Ƽ·xêÈÈUQ΂IͬÀÇùZ›k°»›ðJâ‰#"—\J¸½&£áaÐA)!ˆÈ=¢s†B¹?L¼LrƒgVIfÖœ:axà$¸—IŒ€õTA;<³*"t©ü!ç"ßqoðÔi²n¾!SeÚbšÝihÞUT_/æ4¸v 6›QVá_œ!ÂvÒÖ‡Ùp&ð°"l§Uˆ7ÊÈ x^°Tܪ <†,Á ö†ÜE`‘Ií“âjgˆwojÎ Žås´õÀeîvöM™áÝ×óð¨‚^óS,)F¸p†FÜëºýŠq‹¥‘`žÓÈûØ®6P‡ÝP2ÂÂ{–@ƒò£U\¡I“ŒÚóvÓÂ…˜·O´W¡^BåÍ=‰œx()9éŠæÄ„äYM‰ÝNìy(WÓBBrÐ’å¡þÕŠ)«ªÑZQ‚2]ÒÎÂj¦º×>À&N(ѱ†ítl4[&šUµ#ËX1ÈJš=õ¸äb™,+)L¶ÞGª‚²X_Ô@e!É“ ̰‚ÀûV/òÑ¡û§·â‰y`âÎëK°Ÿ“jêÂÎq{Yÿ²EZêÐL1"fÏXI¤Q€à¸¨$Àw*—/Nœ£’Voà¥æ’ÐÇ«=µcT7ªPÑÇÆ+ OeÔ(v “J¢Ü³øŒ¾aDÜþ/d_’lµÔ´ors†àN—n ¼QÖ¤íÏxÚˆ¸} Â6‚{4'ñ­°‚Z¥qœã‰#÷:D+óËÔH†®¥œÉ‰Œ" ZüPAXô·í7pq©øT VV·ðúü}+"h/¶ö¼ÀDXû$EœfW–ÛBÄF³¼ˆs8éMð=EœTŒfòIo2ÛÒîy©¥°‹ˆAË7Hµ%–Ò1Åò!D<Ñ¥ihâ`IS6ïÀæ±âÞˆ#"Z¸-¥˜÷øÉÆ;o+ø¥J&áÅY"n?@Ke4¦ðáD㈸¥ÞdLÖ |ã´qDàÎk„Åâ´Ã}3žˆÛëû"DDáO+‹ðá •B zñÙáÅ–QÑkÚ+¨zNáïÕ2ªvhC°æÒò>4mœˆÚÇúÜFŽº¯·,§>¶Q'Áœfh>°‚¬På}œYÆž&ãÿГÓ5¼Ï0²"Ëù[&}VÑÔ4“…U¢¹}ãè¤(äüß$ü IuAky±°´Ž+Äa¡¯N'%ž0K#ìfTÓ_qe3ÌTá(H¾hÈ*C#í7>NK®ðsŸ,¬TÍ«_¢DÆÇ ž:"v¯#e›v/–Zq‰¿[CDïMn¦--”ãxڈأžŒF‰GG­ådâáXáÓ³ÃGD.Lð9mÒ|ñ‹uDà:½ 'ŽKB}¤uÔ'‡°æcïL[OÄ-]÷óq/¾éÀúÇhˆÛ|¾¨Ã7k8FSÑÄÓꉧ\jÒ„{6†{ŽV¬Žq{0#p´PøÙŽ?BÀÁË…9ÇÏìw‚S5>âµ1¯þFYºýDd™ø8¦“œjÿ~CŒhÐ ¿èÀI"l¯ZĆè2ý$“vw É:•ùc¶2Ç©|›9ãÃ-3Ƙÿ¡~/ Ž£z”ŒQ%«ZÔÒ%cHµJNéL/-×\ã£m4Ô @Z*íÆÔÄ ­-^ôƒÆØRïe‹™Rè9ÇÏPtFS‰KùøŸ-MÈDžv‚0@Ù3N#îuš bº³âø¸–gDäÞ7§/²¬ÁߪçDàÎjøŠÉ­À×zN„íy»‚7çKMhšò‚ˆÚyÊÆ€''”^A{Ѥj‹Y†f4~^·—DäŽB £rëñ&“—DðN«º\d8ô ßÍâ¹?Z°Mâ…ÇOªðÊPµn S:Æñû¼æT…éÿ±ÚághxM„íu7¼ ^ž ¸çm‹Å“ô%¥n–­™´yªDž33½1yÄ ûó•¶“f¦å©U[NÊ)WÞƒï€WZQì8ZÌ©_í²†vM Åh´YmÏVˆ¹ž’åñŽˆÛí-Ø6'Fp¼#âv” µÆYü€ïɨý€¦þL4Ë ò×1{Y#©4]ç#óè >G iÐSŒ"mDÜ:W îz¡5ž8NîoLs+ñ—*‰ÐãÊÊ£o®ŒvL±;Á9‚Lkôê¦HYŸÖ_kp”Õ+‰îAvLS5j…8æ%~ýP¤Žˆ\*pÀPÇ„tORè›èÛz¦‹0—=u,Ÿk †!j»gÿôöãy|t¶¨T ê|m =°¬ÓQ˜ {T"áFø¸‚^ï#¹3üI.ÕþºÔ³EôHgSâÎŒ¶Š+7¨ÞŽ‚dÏ­‚*$¢·:¬Þ.7Öý-k~C¤ÛÃè.Q†èØÒ‚ &´Fµ@ÜQh AV)#+(#–ú— pºAD®C@uÌq;é2«ˆ8/ñ/Ρ{¶ú³29º°Üuë )¤ýU¥5횃zWEìN„dïú)·Ç²§Ç}q”D´‹$4 a·üë7‹”A¢™eÎvom7a&YY_¾¾|–æ7œ’ä>^Ë\¢â^äß±¡ÖqG£.QgïËï:ÑFæÉÇ€géÆF9dJ 2M#H§Rý‡¯[©•df+ËY¢êvŒàèI¦æ<-Õ¹U„ “V9Þ-O ÀñRØJLFfÎÙ’!ïz? BÐ'ç,OŽã÷Úsk-݉¤F €*ñK¿à –÷d“Yº Áç58ŽîÞRã„ß‹†VÆ`â$eŒ0e}ȇL'¼yÌ?'2ÙSz<ÂQÁJ©“ áÝ(18KŠlÇÝ2.)°ç¨Î;˺+Éz-G5Þ È8þÙºè3› \¢âž’v’ fýr“ª¹æ=,Ïy‹+–¨5pÁà©r ïc°Ü&ê ‚@Š—ZL'DP^®mõ¼,w…”I7g£NOpB¬S®Uæ‘r-GñCبÕ331 ½1¼Ü¸Á.qMó'¨þ;;ÔR…µhæ(gÓÄ3iâ½ µªA®·‡|3S’LêkªX4 øïå žFÇ FoÁ¨bÑ€horB›™„ƒD¾@KÔÚ©ÞÌ5wdR.Uo„¡t>ÕcOÔÛÛœÂq ÀBZºp‰zûT^¡Ù}$Ëùz"Qm+I¬ƒ¡É,£ŸS‘¨·gž?±po{Ì„LTܳœÂùÊ%= 2Qk;bpü¨'HÇ%]q*õ †”¾÷"´Å ºp‰ªÛ3q¡sOFEN'jî7¿¦¤µå ²%*4LFð“ ä¶¥ñS³žæ¢·ÂD<:›š„“ãy÷ô´vz-óÎÂR®z#^7ë‚2•Ô!P5Ûîyþ»õ BNo‘¨z΀dkóÆj}«k{./òÝí9iw.ÊA-u)sÁÓÚª¦dMR!^Ƈ:á({r…L2<¡‚í·N½…—‹mÌaYʰ›•(>;Ô ·¦l`–¼dKÔÛ NÃK%ª nXŸ$W§é²%ª-, P—Ggò·’'*.ìl"p®A`HïY•5÷è¢?“=Y,e¢Òž–¢WAæÄ²R%ªì…'4 …½ÓCÆ(4Òöï¿?ËÙï»æÂïSDþV´ßA%Ò‰Î(ˆÐb•(\¬õ g6"¡ò_ãÑp–ÂSeª÷ÊÕ‹ ·«Îœ ÷!*Rw¡?’ßkW“t¢-Qm¿‘0I&é´å{¬ maL*òfPM'¿QBО˜>~¤Y¢ÞÎ)Ma ÍIHP\[ÿ›—³ ð-7ÕrÊÕíHJ:t{|WQ?`Ì>2!QcoŽ ìN-Šj‹ôŠ+AŽ%j²m@´s_mÑÏ’‚+Ô`›ªñßæè5Â"ÛÓ¯y›¨·§EùGŽÌ2ú¬‘t‰z£´,³°‡‘ÓE³i¢…MäØ>o-32;—UYâ ³ŠKô,;WŠN´ Â%ª @åÒ×èd¹Vô%êíãÒ¯ÑÎ)§ÈTp [¢ÚÞ@d•£;!鬾VñD­]ìY}—èfÈ,ã§¹7ÛŽ’·{ÊèÙ‹¦D qêReÌ¥†Ã:" —.n*Ñó. €ÒØæ‹…Òšîë*oéÄÐÚàïM‰O;p7ØIò][ùG¹/ìÎ>Þß4õä[[§;ÝCz?‚y ÊÏéR¨¥Õ®[±¶Ã×gøX7+Ôbè]bR‡¤BÎzÅEþ{¡9§éD U6íµ¯ýÊßc[ýŒÎèGC&êí¡Ãèƒ.J&« 9™ ´‰dÉT¢ÒÎn7Øè¼1½ëF©D•½ð«½©G7·Z¥5öºª—L„¡D¶Ûvµ½F^F « ·*ÛÅT1>RãÃïÀ]^»æôå…ФÊ:Óå «J+U¬J¡:©ùx‚3i°®S¢fs)ºƒl·W:à¢Ç Ì]"ç4ʇ½Û.‹×eLåD×*Ùxb]b˜³‚l}"À85)c’Ô”o ÐÀM]5w›Ù]^_çë­¿Ùù–¹{ fO‹ro ü:þìÃãu¾,o໺ÏÂ;¿h6Ërõi?ðèðžu¹Ùîr£ñ3ùúºZÝùÍ&_€"×[g½Ý+.„m^Ã_»ªêE^Ï–ùúf[ü瓞sàj죲7c®ØØgyzY~8ž·ãŠÑ÷;|ûp˜7í~âóÑ÷jêJŽ*ê(Pz\qq °jì³Ù<ë¡N2öë8e«Ñ+¸ .Α÷"~VèxºN¨Q%˸g\ƒS•8h1? Nïþ¯wxøïÎEÚvMÍÓû»ºÙÄשÖÒ)uh³_ø­¿®‚‹~úéÉl[ÁŸ÷®ÌEvŸá¼ÛÉ8……rý‡_o?¯ª·öúánwŸýM]‚>çzÿÇÝ? ßîkxl‘ß}†o gTÏ2; 3pðÁêk^¯W»ó\çwÍÕ²¼Þ?OÀá’à„vÜäõW¸²ÂÝ ?±þÜ ÿ Ð}.w§ƒc‡„ÞØí.®"Âêh·Ù&¦ëjSFªï“CA@òàŽŽŽCqˆ–êB <ñ¼ÎóÛÙ¯õ¶¨ÕŸ$Gfé„ýµùy^Õ7¥ï`Ô¡©8s6L¹,ðùó®jŒÈaóÀ(Ù·Á]ÙùÈMöÃ(¬p‡uƒ-8Ÿó®Ufn–I°Ê€©'¬’…Ö»#«d.|ÛÁ*ŸÿWÇ*4ó˜YÆaQÔü'å¼›\ash7²ÌWå²Ü”(Ë|¤´¬®A!‹Ï~;ÛÞßÁ·Õ%hãÉìüm½wzÈ<õ±1¢ r~ï›ÍfwÁ‰Ñ'íÀÁY /ƒü¨šÃO=ûž×%í9°øÎ‡×FüNø™¿ÂùÚ’dðŠÿzvu[øï¤.™è'ìA›³³»j³­À¸ÑNFµGÍ~ODòÈÚO<ú„9~õ¸GtûÊ‘_ÑyÕñ3§ž¬—÷£Ÿ=bB1 ·LŒ]#<¦_Öåá]‹0^®þÝD8øÌ˜@gðð/ßv=¼àÖD…ˆ#˜”ÕwñðGÇ¥3™Yyu! µGûاÿ‘ƒfürvðíçýòí³Ž÷ÞýêQߨ-ú½ë—ß•«»ºÜ…Q×Å7¿˜rлpŽ™AN±Ž· qÛ‚ÁÙzQÔ~ö®ö‹|SôeŒi„£dÖ*äfÛÞ1£2©Æ’W½FÓð½·[/0¶‹µ˜™ÔKïÛºŠ•6¦6Á¤r‚\Îí¯¬‘?ïï¡*.ûÎoáÏÈ„†‚˜ÜCÐ_ñ‹¿÷`v›¼b–NìèzUg¤xÏᑦF.2,SäFÇmšh¿ùn¿D '&O¹Œ'êí½ÿâ‹U³^Ô÷È£†ÙIÒh-æ?«›µ¿.À“â܌ˤˆ©l¥R­“ #YâɈ¦$JSQ‚\DÃZC>æåÖ¯ýMÜ•AÖJ›ó>ÛlüjZ6î`“Lî.ÿ6~+hf"g Q&=Ð~蛾™R È»Eö? #[·µ÷·«?+7wÍO¾#ÖfÓÏËÂד—¢à±µŠ@‘mÚ×{D]н%+CŠ`ݺUÑl¡`€»÷3œ¼“ÖZ…¼ï“à`+°“kè.³i¢½ò«M‘/îðWuäÞ+—±DñΫ[¸lf—Û<_ΞÂ?‰ôéBh{Šn¢]ÓØC§ò“¾K‰¸H§ }?ðÞd|Ì‹+ŒgÝ"ÓñáløP¬ýÀî„^.c“ûn&ƒ’õ ZS‡Y/ð·Óš‹¼~èÙwÊ<ŠÓ—#Å 0àaÏY±ü‡FÑÜ)™0¨gx¢x— ¨;+ *4äŽ#Eû»_T x³ØÙÍ”#·EÚÞ¾+¤to+¤æ4ã’NuèŒHí¼ð_PÕ¨¿ Lî'›(\á™×mÖ1Âu\ïÅ\ П{ˆíË`VÖ"ù¾¾:ˆz}…R -[/%g|¡bfûÿüá?T+Ý„WƒÄ}‹T áD–ú½/*PÑ>è´\Ñ‚#]«»$PX¾ô@ø¦´Ž4æ$ÙŽ5¢¡N·Fß5—«¸ñЬ6§nÕÌàÅÌBoÞªœàVEÙEcØ>ç×Ò,;†¿­ÂxUÎ#¨1}ö¡Æe]|‡rÒj£œÐ†g'ž8ÝKøÉ7*¼Ñ×¾^û­¿vRöfSáG¯b•£öúÈsôÚSµ!cëÖ¡Hv ù| ¹ð|—å©ê º3Îék2,7¸ßÐg¸Z"ƒ*pÄ<~Hž&ÙÅý­5i£Nã`uk}!‰?iz6‹û2]æö£(ኅ«ỉd˜Ìv©cyÇFgᇺü ~°n9cíÜêý¹ §÷sQpo ;ó´‚ÈÛªf¹¢ó§9Tl= Úëê{QÞV‹»^kfOb¨ö‡¡^øEq¯ÅÄ ×A ±@–t #¾R¡nûJÁÎ$EQÝa³á qCç¡1¨BïÓo¿\/Юˆeîòd®±,M¶Wy/Ñ™'£SÒ-ãiÂ=ÿæ—eUcÝP–°uÒ ‘&Û{_âvœ¸£‡·6M´ó¢\b;˜…SBÓs‰Y¢h¿|ñXW,4×"¡h•¬5¿½CgSSΜ‚}[‰ìà‰ øþM±­§³œ:Šu X2Äm®N„>‡1à -Æ“‰,Žþ;¡-ëWp.šÕÕ€áíÏ2ˆ—>²6ààvì_) c špswΆ¸Èßú´`šKCŸ5 ù*{Iéf½’thziÛH–&Ùk¿¼G/«È˜Tôm¾Æ$jíCá±j³™ÖÑ#1ž&Ù[¿)o‘7¥ÒŽNÝb¥I“첨–}t&9}xÏ¢îÊáΚ]ºü Œàô¿“©â­jÿ]š£Ïþ:•(ÜëjYà_¬Ì´ Ï±:+Ò„ô-¤Y±0ˆsFFÝÎ%jî#(nCIòpkÈPH$Š÷6ÿ6;¯à.Ç–zA8N¯Ah›„Blœ8³ó¾¨ñÉÈŒÙ: ýIT3?1  ,̈?ô)rpcIrTvCt“ª®ËbÃËÕ]ÆdE´9Õ‹üþ5? PM\Œ1FshÙä’»QU  C>Þ¥3T‰¿„ÈhÙ#„'«£Mò]”ß«ÑOe#»ÐÜ…)Ö]°Ì²1]àü_7Ççx/cÒ×ÅYùå§í¢M"Ò³X/¦5›Ïœ’ú0A­Ì¨YX”YØè„tËHÃŒèUQ®~²’$Û0î׺Ül¦‹ñ´€ßîŒ8¨pm6Ú¿¥0VfQÿVtD†XºÏ‹æ 0îæº:Θ’tD„ª ÊþÝô´Ùnýõ-syš|©lø+r1šgÜ2wÈ“ªLèÿ»Åè~ Ê^ùÀ EQú5ºÇEr#3z‹}¢tÏËí{R x0AmœHîÕÎ#èb08bv*Ùvž…FðͶè-Ëè—˜Ã@Ê,SεÇBxrcçEc‚fu³ÄÞp€3›ã T­ Ün–œè=ÙªEªAC†ž‹@a9tŸn‘V #è•§;/oánC_la­ýb³i²}Yåø†4sÖi«ooËi$ë"$ Q½TmÉœCo87f"Ú¶nÓ7ô|Ïýúf[Ýþ$|k'$>øU¹œ½õ‹fÒiÅÊPÊ*ëä¡aVd¡ÑnÄiáÒ½Ò-@¶n^Ì3­Íõã¢ö›áT|X‘¹Fˆ¬d#{FOœŠW §ŸÚÔØŸãdæè‡Úh&ÛÓª\]ù-ºük"Ý¢"£ñ>”us]\eíïîür‰¶ Ã9½2—‰4)/ý2_aeÚ°S°[*ÕŽã|¨ ˜Îx¸ñex˜+ýÑ(í¸sļ@ÅâŒGÜŽ;p«²2¸UíÆGˆ¾jt³H\¥OÂçöoÉF;ëPW©êÎcX6êÞ4×·ëê¶*Ç@bz¸ƒêÌRb öµÆ#Nˆ[$}áƒQ‰²ý=Œœú ÖÑ Àë Ž–¥ wvƒ­ÜÛÐÌIךIl¹ô¾¾dOÑ;lŒM|§y^7[ìlx`¿§Ïð4ÑþÛ×%a.HWúä:* 5 Ý9ø¯r¹¼Ç6ZHcôÈߦ ÷¼ªý->:T™R:aÜQ¤žBºIÚLÑ}œ‰š»ÍŒNr—T6LÔÜå®AC#Tô²a¢x¯ ¿Æ^‚ éN2ñ¯ÚlÓoùf;;ÏCÃü$2‰—³j›s”žµpOަg ¦ã_©^(+º¤,üU/hðËëåÆ6:gék¼Ô¸Ñça®°W­S™¤'<ŠLa@²gM}CèGàÊŠ“tð)sÄkãW~½# \|W€•_næS¡ËâA6Ü­-r9Vc8'lâò`7‡À††–«ÓÒ—õÿöà²jS1‡Ú¹Ü¢³CìÅäÿë¹?ݳÏB^hoŸ¡ýdöÂÍ—å´ö9+Ãrl8jÿà¤zu7°5"ªÙÕ)/ËåW¿Ùüd`«ÅA1?î³²™Ô‹=ÀØì¡t;6fºpZý;a'ÞOþÖö¢|–/‹©w>ÀžGJ%7w³Çœ‘˜¢†Vñ˜G7açà Å`sÒî '7‡ÿ×p@¿Çdtø†¢EÒtR…ÿ^À¥’Lä‚ÒmÃÊ»)üâ[žß¡.&fûS¿í±ãVŽ:õ:îìêRidó¡üÈ×@e7D’Ò6®¼«À%_y]ßO*ƒÇüP­:8ÁQuà ÆÆMæÝKš\Ñ­ìuŒ’|r°ØgµÿZ.Èü „ SN¿œÕ÷ ¤¤a±bµ¬Ê…\TRÉE³À¸zÞ,E¹Ùb Fùýûiöä¯/Êõ¢A͸Ðn üOwõÊ—ë –ÞT"¥4¨wŠùµ¿E™´3‚ø2-Æ©|ñõÊoJ”¤e‚è[Ý´BëM  Äyø°’MÓ^…›TÄ¥‡Ë οgF’ÉòlR ¿€S™½ >wrÀÁé¡}yI1©‡³ÕU…2n´S´og“:¸Ø™ʵ95H“òØ×Oà ô%¯2É É·s>}ò[¿žûºÁ¹«¤‰€p ËòöÎßᣠÐÌ@ Ì`íêëyæ\Fûúi T71#ÉØ`†‘Ü!Ÿ†šOË:ÇžA%­¡‚iœù:_”u‰ƒÚÎf$ˆÇê„«g~\rkh'`e~È{¬û#ßÎ!&"]É\#°òÛ°iû ÁÖã ®YN3„iœy^6(qÁsí-˜i=ÔÕUµ,×77¡ÆižÀØiG´($@̸$ŽÀ‡~ÓÔ ¡þoWÚ·q´ÿÊ–¿‡5÷ñ%U”ãÈ#É:\oÙß°"D@{ÀÂîRµüõ™Ár1ÀœÆ.ò¦RŽdOÏôÝý4' MóIàüåœ" d¢0ä}ÃO‡U±P3"EÐ$µ@ ±÷—ý$7j‹‰WA釶\Ø¿À(0z)GA²nĺÈc‘\ÿ›ÞfÇ~2ºÃ†R“?•¶ðÒ œ\úéº8î&”¹,‚ð´2—ÝeØØ^†Ÿ‹}5ežøÉšÕ}¹3Æ~ÂräÉ%µdml¦…vRwoz°e,0Tu»Ì~k»ñÖqAÇï.H3bw³ ê9½zŽ` %v‹’]oËÉÖsÈx QÜ«çoß-§͢RË9ûªl¾´æ£/‹XeGë:D¯ÛQ÷q\ÕiÇ.ÊX¥0ÛG5ºªÁ:©s®jwUQå­³ÉuJ¦e¶™ßÌRðÛnm7´I Ôøý“‚Þ.Cù2 vº†‘ÐM­Xpé ú„[õT´Ëâhi–‹×•ù‡}Hâ¸=¢kn/RŒ !’1O¬¡?}üø CbœÈe㎻ØhèûÖ¸‡ÇÒoÇlÆDD+3/·KwÐÞÚƒ^–ê±Î`*•šÜÈÍc¡ìmÑU lSÄvÓÔ, Gßß'óþ¾×ù÷§}‚(ëÿ‰“›ºo³œ’ã6E&¼}Ü*‚Kü¹X¶õìýçX’§^3 F|0ˆÑÞËz bó‰³ÜrßsùªXUû¢õá!»µˆÒÞjB0wÀZtT³Çot³gÍL˜Kô\#&ÒNã(ŽÇÍH”DfAž©Z1B×ÓÄ`Ô‡À·ßНð®jÛV‡¦Ë¿º»ªÙ”ÇmÌwOûSвYü)ÕcÒý»hwÙÇgñF3ªˆrh&ÖH=>½#Ê 5¤3áëx NÇ1ÛêA!Fše¬Põ€o¯ë5@rýmPF bM%‘NòNBx7†þdÚ\ñP>Z4y '“³ )æ·ÙÕŽyÞù»Å°àÆÜ Ö/IÅR¼ÈQ±B™òiÝÄæ;âaÜcH ÉàÆš3#> ÐÖű{°\t³}ÒëצÝ4O»õ ¸6öŒº LH•´gbÀO9X·Ëe)þø•Ñ_ó<þÞåùmíÃF¸#y{'Ü®Z[8M>| ±ö*to,]PC$™çá¨ÁZ¬ àÕ(ì) Òapžw[kS`:TLQ¸äDðŘ€hòZÍaOZE¦ÛoðR)9˵õþ«qcÚb¹8Ï d5y¯Ê©q"¨L^Èz¬oEľ5v°yˆÖ‰Ð‚±Éašc£>DuX>•gR!1Ý»¦÷®<×u Æ$¢\(<],.¤îUóm{h¡ž?&ì‘U—ÒÖ‰ì=x –³È¬ÆNfO]1/+´>Ž!ÅÒØUâ2§D%3§âiìû_c™Å™½­¡n¿ R¨šì}1ÐÍj‹éÚ6ZJ^¯–„áéêËüWùôõ]†§ì–÷ÉR!/äÑÄßJ›‹üÔ¬Ëãf‚Mãt–ì³î³Ï6¿”íƒÖS¡÷F0Ž‹AY(ÃúÙZ7öLˆ”4DâOïãÿ§iAìaÈsb1Gx¸êA)”J¢2ñb#{qŸe˜÷yæÐôI}}¯šöð­„š&‚Œ˜%õ¯¥ÛYÒ®Š§l†ÕÂ/Žo+"0v(¡1 ñ´µŒTžŠ4-aÀ,œÑŽ3O]„xÚØsg©Ôt°Ð… ÆE’9oVÇüÁ¶†æ2¥@“ Ö TˆöºiÀ [&ÔtZ_FÚí¦Ú;£‘§c×rr!a¯Š%œ2 Èû†9¤ )ûP”“\B…šž7—úÒ·¶]žj–Åãauˆsä+LÐÚâ—›m^Oäoç “D#=ìèqH@ê– @Mt”]U 2ÊÃÁ¿[Sß•æÖ‡/Ìðû€(v£m²8giæ2å1B!çã‚¿Šª„çe±VJÌò$ú¬öç²Ê›Ž°ÐøˆÄxÚήjÄOÒ 7Á‚Jž·òÓ¨kÐ”ÒØ• 9BlzS Ãy(j,RúÐl`”K…ŸN8ò>„&j¡Þ:W&b•Óû|ôe”}(žkàu­$º x«/eÚ®»F¹¨yÔ{ãüY<ÝçÕœö{D0ÆÚí¼@)óÓ§y¾ðH/Ì0®¡H™Œ^ß<ó—üΫʃ»Ú4wßæ#"Úû ªº,Šæ³/!U™Àe9­íŸ›·ñ{Ùî&cjËglqó¥šø™9øíSÙ.‹Ú0ªž8£ðÓ?ïº|êDBÿcóÿù|hW›r"SÌ{²åøU½pA\=5 u£[óý¤¡ ›ßýTÕÅÄÏìtDQÙi J>±¥ÞU!LWò‹ó+} OW<íWØgoI`œD ý×-øÑ³„,zIþ&ñ̰/‹Óÿü¯ÐÍt°¿Ž$GJ|ÕÆhzT…ùÇ“$ ¾‘íÈ"hl~ÚQÈôÙ´l&!Àf–R7ó=p=£I0#„Ø_5ùk<èD’D'`èõ~"ˆfh4ñÂ0Fþ„ ]`´°3Ð)À²áìÊxåûhx%f6úózqk¢Ö6¼Q/Zô×+,•ôY)ŽR…ðg£»ÎXÊmñÑv´RK¶ikÂù<“víÞËzeG~>))]Ç)§¢û4Ï›Höh½øµ¶{:`¼1þ–¢s$Û»4ë™7Õ}qŸáN(VÌ® qQ¥¤,Sjs°W¨c^¡Žž@ìÃ,WG=Œ}ŒI;è6 ÿÈ@ö^»¶¨²ï‹z›&í.+—îÆ%;Š…¿Ê$ÎB{_'†2.½žEö°ƒ·®êÅ€jò·[<-WéÂÄâC¦¤O@¸Ù²]¼+vu[áÈ5•³0Èab›_¿.²üQ^Ì£MPŠÉðõ¤êݧyþÄÚÙ¾–PÖ`ãRàyÞNo×îì,€7È×Mœ«ÑÂc–Ì‚t“Œå\–Ár³ä«1ÆñYX£\)évE…œ ¶Ûj­ÝlÂz= ÖÎQ1sk!<¡"eŒì,u6AÐ@'¿=Øí¿ÛüÛÑ~ï¹Q5N+s,YRïh à 7‰ßîØí‡Ï¢ÉvFÈj²oÅ×ìi™—æÆŸpmŸD)’• e8zZײ†6Øs H£Y–A Ò› wõÖ0;ÿDÐM 5éw+P®tª‘^ÐSðFýè æ^!ű•ªÍÒTcÙ'„ v&÷û-`äGdýmñcçrN¾*>Ü&TØY“œ»0‰<ÑåF¹-…“tÁ~Çøy#‹~êÅî.`ã›L^t:×%ÔÝÚ"Q'_ˆÛÎl¬\µ(ìOÞæ/Ä“ ù ñ¬]Œ!M#ƒ½•ñ3Gfæ,Bf[\y\?p¿°k˜7YeA¼£rM”pcª(ݸØ}š?jd¢«nW‡Г·?b–H‘ö‘âÿ_yŸO1x¾gBH· F¾ •âŒQÓBw]’H*jþ; c|ªÃ*+~»±Hc½£!x’/Cô­î©×m'”¹T$‡‚¹?5K8u &'óK¥Ð°’×” Åõ<%+ê,–qæÌ³¥£ì ³cߨ ÞHD’òA!V‹ò¨¿9 èˆ †.Ȥ+<ü’"–JûªÁ¤ê—ùm»Ý±MU¿âe} èÕ KZf• “õ(½[$B¢4¹Z„ù1žH¡ü)k¢ [Vlð\œ‚ƒLÀm7ÙµE¹öò•ÒoŒâŒ`m{ŒU€Oã*AR¦`°pKÙ¶‡‚EÏÿø\P{(XÝ`o­ [ nך¨ìZï9ð+igG‡%„ÿŒ+Wr5Ú—Þ6¿µ- ¯3æçéè <윧c ¿çt#ÁÔ×x7åvõ†ôf6d¬·èMÙvãh „Òhr[vw|È!ÂèÍúJ/•J7Þ\-²7E°?G”»)ÅS‘¾ ƒÙØedpÙuåû×;#eUþŒ~ÄAõ â`ér–$ ‹TÔ‡'óÃ÷WX ¹¦¾õâö±~Ì•úíòˆ˜° <‡ÔQ)ä>Ù!²“”:"0SÏä_É×öÚ×Nýè˸ÒV0Œd’{gáA_•Æh}ªÊÇbŽ•w6:|Sþ˜ìÖØ|ë¶Ùþã…o“Ø—“—ÉY¸Ò‚pÀæ¿ÚÃS nn±\8Üõnó¿ò|t‚íJ”?xØiß)VÓëÞ¤€{CHúô*–<សeÌ/†8O¤7ûoìJ…Àw’þØgLwÜyOonÇÞ•Fað¨û„(¢]‘w"z3F%Bjâ9Pÿ訡£dÞÆÎª(ûçÅz±1m¿TÇßÄìßá:8iÁKçôfä8½ñ—LDu€«UQß7ÞkèÌËHg± [©-6yo©ÕD ¥ô4wvÏWZãô²Ñ‚7t”_fô Ë¡ýýwÓ6€ÞFn!åÙ\Etæ‚èÆ¼Š:ÇBLŒ1……èƒg-’TÄÁHìÜQv¥uë¥í7»«<L¿Á°îÚTŸÍ'R&Ï) ç‘C[7«+½7æÊ“õ±x¨ó2ácQ¢h’$WÛvŸæ´(·÷E {ë¶n;ÏSç®6¹2çÏ>ßwÇwH“ýžo‘Üô­ä©óHYÒRvÝàØõ·oЇrRØ¡yŸ2Ô”$ß:¼uŽ#=î'Ú®%‰”,iW”:¤ç¯‡ü1}‹û]Zqt¿è6Cƒd »ò}ѧª~:4«¼ Z²%•B¹¬”ÉW«A×Åúîh»ò¬.¡YÉK§^·”PÖåÎý¦©‰³îÓüAyìÝ6G ÷cØ\©^·ámO€Ø&R¦.'ÄeÜEiÐCíÐçݵï\ÞùCö‘kdø¬3ç¼ ”„Ö ï2²àýþÚC*‡ñylöùš‡og‰ zïbé,ïƒ ­Â^ Ào¼å\?K9ÐÁf&žGªÿ{ãàç£')ýaAÛ²à:)Urµû4ϹФu„5³…¹yã*iÇæ!ÿ¤”Ÿ²0’¢¤ëú· Ü Æ(HÊBE¢²fY UsiLyÿ®hê$¨Q¤q(I—V#ˆÊT1Srmß½®·|U@‚1”‰ê0]ž5Š$)WOƒJ€* ÆÎ´]yVéÂÎýPíÔ~P`#u½DY2}®AEÀBÿ3eWT ¡‰S²æ^ûÅ.£û;¯ó¦’RuTꊠڿ-Œ),¯;§îñ÷À·”º4G’#‡ç¤Qò Õa4ö~ާë½­ÛTé’þ7b"-Ézû¥XrmžTìŸö-? 6«„м'¨Í‘QŽóhsMF…Ñ :ÐAÃ7ÿ¬•Ä(é!‚j…šÄ+£–¸+ ¤Ûa¥QíW %ŒH—’aI½*êh&}ŽÂ¨f.5IŒk6rÏßH©äè˜ 5‹,]™›½Úý×½½þÅð-¯ØY8Q+-«\ÈôIA—*âš}•çöÆ4YõË… ‹®]îY³§ûQ5¨Z¨#;cšëÅt”5df¤ö·ÙÊn~œéärÎîÓü9µ§Õ‘ÏÑ«Š=¨×‰¤Uuìáàæ¾X¬ŽFÙ †Ï^uÒv®|²<È3Š…«ÙQš|ÇæH„"͇×ɪt˜É6)»´¦è ¤cû[)sÖ&Ù]¥!%AM>ÓvåY{?âî°)6€ŒŠ:×Þɬd(é^ ІnÄ™¶+ÏÚ{ï-sZ 5jô‡pÍ)Édª– ;ly¿¶aN:pgÛ1ùy»2(ÒI®¨°’&=% ºÏÈÖ¿gÚ®<+8J°0BëØ¤f„ô‚j"ݤ¬@—Éž‰»ò´Â…‡1ü‘ÈYƒNHI™ë®"„'/V.VD”R5Ë8‹îö§vó宜0–bÛ?Uõvß,^îï«z·C–Zcâ~åð›/M¸ÿ7M{NM`k‰`‚ùwòÍûñÌ„ÒÓÄÄ©­ð„#GNñxdŸæ tx¹0VŒ‰ÑlÕ‡OK$–`G4…ˆŠª AÏcOÏãUÊOgB{ÊB O_`±ÀÄè ³ãé¬WM'a[½Š¸»ýk¤"zþdF­$RjSì¾âP9kAñ`8q™‚’<}üøÀªÅéoèx‹„7Ê›™eæb¸¥§£Ñ`ÿg‹Û=4˜Å’°ybEì†T¾ošw1à4BþüŽb|ßéj„ NŸ¾Í²GÆT:Úâ¬û¼3êkÛ<´ ål¼Cê'31;æí›e™g÷±røp>߈»x{òPq+©#.ñðVûãaYow+ ó8BÄ<‡d¸?¶Å!Ï<í;[\‹[¸å4ó40/eØgÞëC{,¡}b.ÆQ‡ã¼?îŒVýY¡á / ¡ÏsL_à`1G9‰˜ÛbçßæOÀk<ÿ\LÚ¬¾Tåðö0ò€Â…Uz®Œ§HšqÝ·yÆE¢Ò3yàΕ¹Œ‚p³Û‡‡ê¸ƒð)~‡ʺ×%øKòìÇ2IÄ”[J<-rƒaàvmýéÞÿ, ìý—÷ƹ<?{5ELƒUgZÉ¡œžÃ'ƒ]gQNF¦d«ãfe½83®êøŸÆ‡(´ó°Ò!üþ^<®›ûVÜçŸÖ~/©fTŒàŠTW\kˆ’‹àûž‰²‡!9¹a5‰¸Œº_Võ²ØíO`M2“®%½‡ô¡h‹‡ªØÞóï?—ˆDCwsöÂûùóG6—)ŒK€Ý¹ö`×Á˜Èí àéwŒ ùŸËMÝ‚Ab®+îý¸UoÅ1/ þ¨²Cƒû¥ú …ÄLê3u@þP‚/‘P¬.£îãá~{„–2¹œéêzOòÃñ鸶 ¼¼p"êCŒ‰l"^ Ä6E@§{ú€,sÕR ,g-º‹ú#V•º§­¸z=$û,¶žµLh-óGõß…¥ãQ2W€ì@¾saýÈ)^ß ¥G8oÚ¦wÓŒ™qé‡^•Ýž¸h¸²Û/îÌßl›‡¦…3SÌäTº›õt§Rr‹ô6ïv ؆ͥ¿—û¶ùÛ¸Fq†öÜ<‚Ã@ªç’ì¾æs±¾?~oZküúOû€ç˜²/½Kpiæú/{×Ö·¬ÿ +O»™Åýò’*ÇIìD’-[ÊIy_NA#Ò •™a´ã_Ž$A6Æã—­SµµåTyŒF}ïþº'š#<–§=naGÀ¼Ä$<¦h8Ž»Ód¸L &”Ž$ ×™å+áÒoæß•¹¿Ú-ç/KÃhͪña¼ÁØD´†1DSÑ‘¼T»¬wåhÎxþÅÑÙ!±b@âw‡ÒèbîW~+Ú«òËù`¢q35LSPLÄÔã]˜Ž\¸üòמBh?˜:(D¤êpïÆÌþ*̯Ýÿ¸oWõõâŸÙEœ§2Çó—ùÿÎ(»_¼‚Órå|<0¿f4šEg÷þgóO,öžûÎZ}3_›…ˆ¾vÜÌ“K°N8ÚÓþpuÜ­#IøÃ"ì@cŠ8Àò¡?l˜ÒŠ©”;ìF»Æ6Ly=¼Ês†¹Ûïwðº±÷ÙF]¯M—y»>ÂÜâ_¦Üb)ß- ÀžÊâ>®š0{™Ê”¹O Hž¨QÓøå-À èJ< Ûÿ±ÌóùÜù—¦¼m!çÆ4¦:ï|6{ÿ_Anؾ(ƒ¤À*“€Yœ¾—ú>ùãÒ÷ñ;>Møñ‘,üe‘öÝz¹m¢±þÏH‡êR&–t/›kËž›ÿ5Ûb»{°m\Xævj­÷áRƒÅÈ á^zÐZj·qm˜þî)rz•_8dÝ*lÇÅ:gÀž§KyG’Óh‰ôÄloX(y™×‘é~Lg·¾Ý}›«¥ÑDÑÝF²\¿ äZw Zã+ ÝX°¥\18 î‰/ËHMNÐ$óM0$ûrÛ)é$qéÑëjèEZÈ‚Òùc½©î¢,ã¨xv‰´ƒg黣©Õ{‡CkõÄ &V­ÇÄÕÏ(×óî¦'õú¶ª¿Œÿô(Ò§Â"V^•š& Ï*ŒˆéXëƒ ÏýJƒSÓl"‰ŽÐÆ$—ÒK°KH  ¥v¸«Ñ%¤Zžëh³¼¨"n¤øA‰ÛŒÉÖ/*oLàP†IÀ^hF&$ b#ØHKËŸ‹r Bnèž Gä8ìé׫–VsÅ3œ# ó]+,Ô`ÔÌ9–)E9£Q­ÂÙš¬'D°–cµ¸xÔ«PË£¬|ŒCAÀ㈠0hPš? ŸxfxO5š[‡â(¬yÁèyWÞ–ëÚ>âû«z yE,Àéã~%‰oˆ1ÄÈ€úÚ’š}sB¦Wì(\R=zLeÍ‘*pC™N¼xÞ½”§§ó÷ýþÎ3+¼Ír$¸:„i!ü’óYØ~ÆE‡´6^ùzt©ƒö‹ÎÄOá³p£÷9ÐÑw›sgŠÎÔßæà'ìß½ñöO\™*†…ޜ㩧 =EÈT4þbÌêʘ(=;^ufRÅÎr(ºËu96Ò’}ë£ì9Ÿî’n¯¬¹SN*³¼«Lñ|Ú·)¯1!á­&”…åUàt§–}¶ôÁ,CAWy‚4CÔ+Ľ;$™¡tÛ-aKå„é ¢M¢¾³®Ûd(ÊöXº0i(Êfm%ÑýÙØ[ß”÷ÍõÚ\ï ³q“âÌìžûQ_ZÒÔ‚yÒÞ­S ¥ü|îÉ{ǹ a Ó®ø‚xmiD.Fæ›·Õ½ vAó÷T»è]Ð\´£Éòtb;“¢·uw—Œõf›ëo6vM(|ì‹pDŠi7ѯ¬|wmó0ÌÄ.ðº¶Ï‚i Ò•iG….öö.ªzËgñÚ‹[Щ¥q kߣ„° €º}Ô!ßn¾?óÄèýýdgwÔK‡|“É•ßÙMè"”!û°¯ ¨M Ò×h±‡þze¬<ßvÔ@„ ,'Ö}±p¢K¨äº/ H$AO[ö¥»zl(‡èæDÉ…¿íëü$Ø ˆ¨f)kB¤‰ù¹ÍãÙšHš:†lߨÁä|7¢×¿Ì¼nÄs>à™/S\†Ü7Ò‡Í GºV:s.|yã]™Q‘7šÉBøhBt‚·;û˜ $ìáQ6 ;{c>´å6ZF;ÎÅ%Λe!@@|þy¹©Ìã¼k¾Gd—ÙX9Œñ™g”úØnW¦Š ÖNMÕ¬KÐ3RÙˆBŒ£i:…Xèc”°…Š\ë²EûÝǧýU>¶ ã³êSoÌräU3Ëe”ŠJ ÄÊ|6†¥¥˜À7íçµY=𥽹¸$äí›_>X­XÀ!t6L“³œ8k—[³‚Bcä0Ë…‹ÚF‡Í¢}¨kÏÔ>j–f}ÛÜT0ý§1͈aj–{­R¼¶v¹é,'ˆšÿ5ô,3~« ø‘]óç™@LÏ?†öîn^1ìÏGœã¬ó»þ­éó]wšJ A3i˜åÁ‰Ù·_€daªq <e>Žg¯ÿþΚ/Øñ”©Ìë€6¨êG³„€4g™ÌÞÿ̄믓ç3©eT§ó ¨Êú®j­À¾ÃXd>:Ï„zm (N*³A•™Ê€‘yµ¼¾3+Ue0Ë…?L•i0q¸¾ytp2ï¨Tõ}ñÉtö4­z¦"“9oœÊe{: –i§ù¼×è²ó5ÌUq÷á:“€Y¼³ÆéÊÆJŒ’ æÆçýÅŸl´Z¼©Ì—þœÛv¨–¹ ›MµmãÄgò¿¯oÀÝ•–ÎÛÕgsUCâ–_X7¿ÿ†?šes ÿÙgˆÝ†R Qöˆµ©Zø-»ÅÚÔwß,§lµx˜&&Éœ2Ϙ,¶n;IäŸã¿¬£ÝJ2¦%úuÊçæ¡5Å»ò±xÓZNDå^Ž8R͸?ãx‰˜ØçÐÇÓzãÕ^ô #ôœªFQ/„ÒÖ®ePòrwAQ7äÁDO„I2 }2ÙröIïõº~1¾½|qfC©ÍÕ„Ä0?0mí0jD‡L5º…Å§í¶²Úw•Qizµºµ¤ÁbµÂEù·ý¯êûŸÌ®xuãþœQ©rʱcÿ¶\×fõ¯³Òmæ°ÿÀ¿Nâת8«77ågŸÑEs]—p¼1öÝ?ÿmÕNé.´,^-í‹\]—à’˜ý¹cƦÊÓ^ަBP¢•dFoô£%U½¬\ @¤2‚R—dL¹®æ¡Îø茮(“„%P£°á âkpDÃÒ8(v±'H1ß$⻺™À¯X3¥I𗻥‡Œ\Õƒ4acyÞ3³ª¡¹Až äQV,VùЖ_€€±:y²b8N"/›æ˜t(ÈÙ$Ìòà'ó·i`çç—E¸žeÁëò Ú(Kb'OŸ½ý¿ÍýUã†_@Õ†üí Í2àÌÜ™-(9Íò÷g4ËëÈ×· ãeþõñü÷7·fg-üMY¼_ƒ"#*ŸÌt<Ò_¯ÖÔ€¦Ÿ~úfRÐúÒX6ñ㤗“×€cõÿ®›>Äs£Çošö&ú=Ó\·cäG„cÍLvþwïE|PÑžÖN:t4ðÀºP鱂($t!‚fDŸ‚ Ët»67õh)J7|ð|‰ahèE¨°QÄï»wýiƒlØ5óS¨%íWî,¤õ§ùáIÒPÐÔ㦞f·ƒ-%ÒF$“>5KŸ è#QÒón Hpu+Ì„"k;uXë;îLûÆ”:SÇ¡Càb]¼8…›PUߺ5ý‡¡±Š~[ö…ioêÂ1$nˆ—ᜱv¶{áÎE¨¨´Ø;¶£½}ã´L,áÞã~íCý°eêm‡úúVUê… NEpúºY6÷W õ~‚ѯxØöË9AªÌ2;jwžì¥¹¯—™Û5ë|dgùs–äÆõBçOÖ¨0X1ÏÆé +µöÕÇ•˜V¬7‹»õˆ/®•a¥WË.pI«V°JÙÐQpI†¼!H]ã¸t°,¬ÖHŠvå¼ûꮌ¹.oëû²ØtÃàgÎ]w–&Q'ý=(Ÿ>úªÅ±nJ­è,×Nq z<‘ó“¹7›ëvÛŠ2vÀGýa™…"\x»,`[Mµ’ÈLâDqÑÊ׿~[‡Í8R‡jdœ§“ íÊ»yÚ®Óíj•›J—Ÿ'TÞ±r¨ˆÃ§'bšøï¦ÛCTÔ*aŠóÅߺ4õc<À¥H8ŸÈWN/öšóò h˵Jm•Q£á„7ÒOŸS¯ÏÃ[ñpËkªh—ÛúÁ¬·/[«+÷ÊqX«}™‚|Æ‘_x)Œ¯=u¸gȯŒÀ˜YÛv[5°Í©g¶BË„)&àÂ-oÛÕ-Œb?m& ³ ´xéyíF0ì'© pg ñ÷H7#ÔãJ–ž‘Êsÿ~„=C=SÀèqÜ itŒÝó§65€9a¥‹{¼q8…IÞ(ot±ÿƒcR nã¥õXñ18$_`²Ÿ”ÆïÛ“ö•í[LKg½ç/iÏx’´\sÐ÷ŒM晹‹íÌkö›…ÎkÙÁ;p”æž\K‘–kˆ› b(Ðgâ€.fò8¦OáA¸z]Ø#Q´(ÂÓ{n+dŠ?büÕ{»ª÷° ìÙqøCüYAì_cð¸ƒÓú€Cô"£~Ó®þjQ¡ƒ»>”:Jf(„ý—v¨ÄªØ :wx6'›`©Û?q”—ÀÜéB8z®4嘧¹Ò#llk\Ø8 «£ ¥öë¨.M³kr"4 U<{BÒZDC ÅG¸ÓÀ•ˆ¥G¨£Ä©êÅyúÔ®–5@‰„Ó`RzÎIÈÆ“S£¼¨oÚeý•>…R^@^üÃ-¬½^ü3?2'^<%ÐY\®ñ€QK·GÌ*‰ÂГy~MÝ/gy¥ñ‹–0¥âÂr{Ìq ˜5 ’ï)Êb`O¹ ö_—ÄÐ" a3øÅ¢õhlèÓažf(ˆÑ#K;žÉ„q 3"8>«Tèôfp*šºÃCM…E:æ—¥Õ˜MñIYß÷(éÕ€vèûf0)l)ÜK"NPðš:Ê‚>âuµ’…³þî0.JkH¹: ‰ïUƒ¹— õRi2å\Kˆo­ìOLð¢ƒâñ:ñÑp¢z¸šªÛLk5i>''ºïœHrÞòÿñveÍm#Iú¯0æ(ê>^&Bn{Úµ»·}LìôËd¢E˜—†$ÚKýú­IT¡TRÄl„_, ¨ÌD_fe~yº‚¼®U-2남mûÿTáãÚ4}©¾7iêPP‡rm6+úö.ž?„4Ôgùäy’8cP D½”‰ŠYõ…@:™×ç®”¿Ü¿ î”/êî•Së¹ï›f³}Ü΃EÒyßC¬%£~C”ko vYº9¸%Ub€hÆ>Üâý^mæÑú:·cßt}®æåå§´-EfMs8|Ñ®¶eÛ‰ð  û> 1Ó%0… fië8&1L1~XT³£¦UÔjSîÛFŒM+±M4þ½Ý=-ÌnS??W0q[Á;‰‰ú‹Ú7Õ¼Z.öFŽfö`ÎÁ²­TˆL…ô¦Qw$fM¥@ÓH'Vàv×>-nr†î}¼·­½²y¬sG¤uj¯ö¶šUYFô)­d>ƒ¬º³™›^–œº‹ý‹ЩC^3wòmbì!üª¢ËÖïΉ+[o˜¿¾<ÖËk”Ñë2ðÌPŸMõ¦;7{®s)1ÌÀ\J* ës‘çýÇQ„JCZæØÆ:Œ³¨l3ây¸jt°­r¥8îZÃzçýâpÌò-sP²’Òa i2ê{¯’üÿ„ªkûÞStÉçë³îõ _Þ+/Ö*$ÇUõ«Ñua$š}ªí$ŒE}Â¥® £ ¹9˜IøaBã}Œ’wÖÚ‹Vɼ‹•§Ë°mçI‹p_ÉèàI@€»ƒ:*r4Í™‰e`¤OI# CèÌv»è?¶É„#ß 2Z?/*³Bgÿµ¨…a¤­»Ò—QWzt~Zýb‰zìÆo×R1áuôã:ÿõ‹¶4["Ò™ˆqoL½½.«zöÞœ™³ÏÅA&Ô ÈÈ66%.ã`i€Ñìsõ£ÚÖCØ [êYÕ÷˜ãbd9HÀr $‘xà$.N&Z´ŸHöú›)*˜,}l®µí¢xY~#·ÔÜ¥D¾Y´SœN¶9)åÄCîá{UÇj[x=ÇH!êÀ.] {¬aßMi!›•«]ó\Æ©};óÞ~ØWãk- #(ª‰¤^ò©=˜ë²ØUuéëjŒu¿ÿ ÎF?®ëGÿ¹5“ø°(n§SìfàšŽ¾ß»=/™…™=Èí ÆGg£;„‹î|µbÏ̉¾) OÃàGŽoÒ\»UGªRRÁ¬@éÚzÛÛÖ‘÷»ž³'lQí`|av‰´rG‚ÐÖ¯ãûõ¦:Ì~ZT»m]‡2£Q? 5_etŒ~!¿iw9œ×¥‚‹F½FñœŒ ½+ª9Væl+”èRçû”¬ñ¯âR;ªUµoJÒu]ÎsJËÑ!½¸ˆ9ªº|¨u›]p“ˆ¸¥‚4ÎÞDuOµD:]/ìH#HLt¤¹¼_¶uy;2kÎ4˜ªÑ ê2»>V‹jf[¬/ÅYjÖ4%ý¶Á‰ݘ\NÌÇv97Ã×ê(Z/'e£3HÉ™3s³-© ¤ÀºŸ1æT=Õ4 ÆøTÙ£߬+ÀlÕaVйŸÿÄò·ñ*¤NÎVrÌÉ œµRM4k]ò¯¿i«™ÁÞæã´E8Æ DíwXKU:öeØ`˜‡òmÎ஄ì|&Ñq°áÚv~Ú6³w‡¢se¦’;Åc@O»ËÓÏÕÒ|ˆÓW+nàLÓCxAéèÔq—˜>{(ºn˜ NÜìŽÊ±„ÃL»âñ`à’°±œËË1Q£/w˜ã±ŸÏ‡ ´ ž¥~a×_sãÌ-<ÌË O'¢Â¡˜@ˆNиŸR_-m2bªUw¯ÖGø˜¡] è_ÕÞ`äâŒ5þs(¼$»K4úzø©Í;«0Âdæ©ÐÂKß¡¶v~l ~nÝ›­ã‹Ñ£v Š"ÎÝÊ}=!î>có´Ü.gëÃnû¼]5ûÒ䣔\‰ÝÁÎXáȈŸ65sIØ;àÿÃôN¦nõϪÀf5Wr"¤;¥ºß[[áRvŒ øt[ §”~/éci³о€SŸÖùušfox4»% 4áæ›ñìGOûøÉžýoÊï×La/ÎEÇ'4õ’Ç66òQA&¤‹6j®F÷ÇDôËö¢‚¥¢g 2êôi†Ñ~­ŽÅø„9 ± ®8Œ~gÆC®FËqµN¾L\mï \txš+N#•KÁ°ÃÛ®£Å;ÿÇ<Ì5å Ô2ÓùG_Úݲ>FáÓƒ ”m|7Hòü:Lò” q•KòiêYzIê<'yÚ®)~’'e|«‹ÍήgÖk¿ªÙ8Fš”Fo>ã2¼ L²kiõÌŽ×h÷ójSÅò„§ o›´­¹ö^ ÏÃQÆ„ÇYÀ•OùÝõWØ…qȾ“pÞYc!&/ñS&(ÛoûµÙ5P<ª&:Ž]ßý¼9Vë(ú‘øÀ!³‘AÔ˜öàKŠ‘œ2O|º“p@óÉÌÓ{÷·EÛ˜ @¨¼&„z|€4WŒrz¶lœ8ëºí–êóÖ>†wÿRjʰÿ²DÚK¥ÙšåÓ³e5ã¼#+ÙZöÀð~¹7.㱬(¾'%‚ºt)H^O úœñ]ÁY¶UuWºëj¬šÊ£QbwÎ9ÉO\ ú¢qŠÀI´ÛeÈÝ]/ÝJŠFˆˆÿN¸4@Âe–‚.NO)ʆåö”Ü© “ Õ©‚û“ü°ŽHEÈ4[œKƒ¾7°juœð<Ê¥§ÄÞà8"«<ãŽâ â„y:é`öaZNež>Œr¿;üÕŽq–ånÇ%£ù-ƒ@¶ ‡½O¢Ý¸úhÚýqÞ`@ä¥ÖÕ*ãÍh$h!(DÏ‚³’A1žj0—¾²j–õ¾ÙŒ„dµ¤Ôeþ ó—ÌBC¬Ã))gñ€ê’R&±w:€ ¤äQ6¹p÷³ÌR–å¬#!ã ëàRY9‰i„3Íñ±ÝûG¸»"3w\5³È²ž-ÛF$lÓÉvãÒcÈ7ͪþÖ,˪Ұ²_œá®$iv 9=ZV5F‘gÙnTÕ•34›§í  © ÛÂKþäyMAU%4µ¢Ý¨¨£"hqº^BQfŠ0vÉ rä“2Ð'Õ E­h·)êêÞlW-@Íðn› å60ãädY]OÏõäq*»•ìF-±W†3owe=CÖn™rþ°E959äsòèD»QQâ)º@Z–K D±W¥}8I  ')M÷@@«Ín1͉ä*ï~ª6ÕrY­jÀ4ˆü}BDi ¸™ Ùc½^ºgóÔ]6à†ç¼ÔØU)–e÷;=ZV–¥”µ²Ý¨ªK€Øî¢ò·”¢áå€-ôîÙÔˆÏ/@Ÿ5†ah7êÙcª·õ¦yY5€å-â|ó3¯:L •_Ý McPuèÐÓi˜§Œ$= {Û«Ýcµ„ø+:ª­ÑÌËÜòl}|÷pÙB1s½z¦èDFêÜ»y³ÛÔéÁ椻Ö1ÈìÅî±Otwæ¨~6‹µ²Tz E¡efÖ?s.lÄBƒZÄH³f!‰ÅTê±éÏͮ޷í$âZ#—b$4ÍcS 2OŒMϲݸ™ôØôçvÝq㼎Òý\ •à24Q ­3†§½t7ªÛCÔ÷Ö‰x!D5»?“|@„PEŒPϲݨªtªWª(¢¨4K·K•º$†æOD5ÄIj#Íûem{W·Ð0êUéâuòÙË­%ôr Ó©.·-‹Mb*ïÎ$ªòB;ŽÌU>µ§{¸l›D_«z·‡ÞúpÉSMàPö:Ù¾T»}ØKZ{7›*ÝÆïºܧE ܶ²ß¸Šó|è”®”h›j%»q:x f[o7å;5æN2B…Ë*ÂÔÀ«œª”;)SmuÎâݨ¯co«ŽûºŒ÷‘æe^Y±°îlnæs”JQ·„ƒFØDxÅ·=4»tådtÔQã.ê•+Ó<_«ET{é€'…DSÚ3ÐrUÙJÀz 3æ§ç(¿\@;ƒNYè,ÞmëÅõ™5oÏl>Wx-”ðÔ•yuA©¸‰>³ánT¶GRÛoàÓ"-@ªÍNènæh>íøôhYWœ„Hhö)•wÌØëD;› âJ‘W§_'ÜÏõãK ½ä{]QÉk?éý¼z®^*è†ÕTMÇñ°Ý2еÄQ"˜Ù[Ý„W„çOC ñdlÀ¸‚œÌ4(·‡jÈÌGa²$—¶ Ö»¼ÎÇA([2Ñ7ø,pâ0K¤1‰uEjeÞš:áÕ¾± Åy¯Oô > ³58|"ëpgMHkêxI†±VÎvÔV¶ç¬£ (3Ñ7ø$8 y¢x…#H1~ Ý ‚ˆŸFJÇÙÑ1·fh∄ivó[õÏïÇöiUÞ?HXÀñ:R`JiÞ¯U$¨ØÓèD»QOåôÜ´ ѰœyôªZä•}ÍDdº½ÑMv¬;¿Öa0ºÈkŽ<g‘PδŠQÿE¸Û”õ¸£›§y Ð4òo¸®Î”fƒ²§G‹š¦Ø¢­d7ªÙ£ýßvó°Eë° Â¡Ï½mÐÈšèPmWÑLäâ:¨OÍ àãGyäLI¯ß€Î§&P¹Žñ ìÆoïñÉ-«Ü‘0*Ì÷w“œ)œ_Πøg¢åöY¶Ueë uu÷„QÌÑ¿kîÅ™®!0V'Xn:Ù€8ˆ‰® Ùçj³jÚÝŸ”BÈü„ "½*›ÛÑ=\¶OØç,_º}ê×ÔoÒÆ3_o"ãyDw  ^ŠD% ¶Q÷Ò ò?¨D!ÑŒ½“ìÆõ#=>¿í3@Ͱ‚Hp›YyQS‰üiJÁ×2¡¦‘ìF5•Ss·©Ê5a$ʾym °Ìë ʾO´Œ?‰v£¢Ž…³ù«|ó…QØ C ɔ˕TL©ürü:¡è_ð¯‰2%±ëíð¥^6»yõ˜aš›PŠùtÁyR˜à÷¡îS9ÎÂÝ4 °crü²]V€Ý+Ì–ØÏÖšç5…¤ãuc'ÙjbíñÀŒ‚Â&ҨƼ’_•baQ4tgÙ A,Î&šð®·Yk~¹Ê ƒX˜úÍÔ¤”,? @ó=FgÙnœ= üºlî(d^'–­ÏkLÀ²!D0DÏZÁ 5ZO4zøO@Ò C‚Jæ#†ÙU‘Y@Ÿ?F~ÿ×Âk&&²Jìþµ}y‚lŽa°™˜»È7³<¹u¡@»cŒíN²Ý¸,zp÷ÇvóԮ浱€"I¹cñ5/? (…(#¼^ƒð1"aw~EÌ !>¶³·‹ê±)ÑÀÛÔ*(£éôØÕö›µìÿT‡ÙáølÛ×Õßf?ÌÏvpT)o=äYëi¯ µtXõ©ïN¥}¬@ºpűÒÿY]Šu Ì¿šÝ7y±4Ž ¾ª%¼4þg SªHb¼Vzuì:÷s-ñ…‡må‘m…¤|¬Óví~î¿ÇurÑË™ÿn6öb×êÇΪã±ðffû2y-–ôè»]g„Õìí÷긫…¸/ºu¡Gð:+îgfƒ{XTÇuq ÜT¸~ ht׎×xš3;™š‡èR%œk' Côhÿëzmõø½:þ¨Ž¥ÏLü1¤gª,¦²/]“¹ÙýõÐ|ì¿Û-»¹ÇØm÷vÕ&7h&ä'^ð»ý0n_(µbQšÑâ’ž:ì—ŒY…Ä7„2¬è° Í×?‚ “,´J¶¡‘ú´:ãή3òNñÅ3¤F£TøãÍô —¢P^#‰Í¼ù]˜jE ( ûºëÁæDF¢%Þ:n©V'á¾›™õMÔ »öoÚåb»Û¬#"* âY‡j6f1O‚<ø$Ì<„Š©ÌÓŸŽÿ¨vO‹mÔ…'aŸ0’Ða° ˜'J Lš'U^¤ƒÙ§Køþ2©+}t¿·ÿNÌìs%ÐÒ8 @±{Ø Ó׉ýÑõÿ˜{¶å¶mm…³ß«CÜ—ÎØN“4uÜ\¼=§û –Y‹­$:”ÔNüõg² ¼`‘Q³ÏìýN"paaݯåË”¤Ñš'¡º—Цwåã£ýs… :×2“ÐLÈÅÑi ~º5MOÀ!±sªÙ]ÄïùD‚}ܤ±#:v¡!ËF°ÓPÓ‡Þ ÿ»¾·Û%;Lœ ;Ô¯f{þÞ"ôŒõ¡DW#Ùƒæ·iôО-¶Gè “Sá'X]ûwU~E`GÆub¢åIäz =‘Ù³oã–µNF+ MÝï®íÞÖS%c9è‘ï5¿«íŸ@BÓØÓ÷Cþš/¦g°ù—Íã!sØÜQÊ@ÚûD+Êãvæ‘6Xu Ÿ˜Î;rðdD±*rBÊ[)D4Yùn¡›²ØÃŸ:ºœw6ì*i\k°%ß¼o‡’5B…’Eo(ÙM’lå¹u+°l޶RX&¼“çÎMFŒ[ŽÆ•/ªÍæàJ³Ýþa|~þÄSò™‡‘盫Vàù 7#™e‰Ü±‰Br±Ðíá™”,òÐJy½­p™å\Hp&¥7y\¸®òî‚óòŒÚ{T~“s%’ ÎáÂn³ëU…üL–OÄg©§’‹VÆœä‹8gþ¶ÊÀËÞ—ÛUvÇG°>ycå}…JT3C*1í"O]C/šÁ)ÁEä"‡Þ>—,fW÷à 8Ÿñ‰pŠÔ{_­lv]#A ’åf"ÉÉ"{–ú}â‚æAC†ÒŒŒïW6];6Ê>Ò_TÒnÔåè‚}ŠUvŽ9>,]לâÇo¹„£³Ï±³Þ=^¹&?÷*hê;ÞøãK0!ì!…þÜÅÕ}qa£Øñ#Ð/;¶LÏDðºÚMå;ý¥þ7xÛóäé’éx©s=zºßòk—™Æ)ê'M`Ѥ ŠmzÎ÷saáU³K›8]©VYV=ý…ßV6;už:¿Iû†|2ÊX~ ݳ9?¬R„ãÓù\³Qº÷ÓÂ@.þ“§»¡v!ôã§¿0m#²«4z´62 †ÒŽŸbó \ÿO%øÙ«b½O=2a@”ÁE\Åæè3û¹#£–BHùà‘ݭᳩfñì„¥ š™0®ž³ÑóYp~öö<ŸJ±P!ÈèùÁ&0a¾&iX>8Ý¥lÆNÁ|c§!8Œ(N¼ôŒÑ%a={›"*´O¹¡£§ ?Ž>¼mø¸lT³P_Ò{4'.žŠô/*»Û'¾d‘&L¾k1ê«|á)à2 ñ_`Œ„jÒ-´} _ë{u¿*²³m’Ru.Ãø¸+v;?4ƒ®¤vnp¾tŒFŽ÷E¾Gy‡QLª°úB²2‹êu]¦í¸P݈qjõõ“׫`hU‚ÂÏ@f)RR¡ÖntÒØg|.µ)#žB´Šµz¹ÐJŽ}Ë×È<é `ò,{ ~¤žß4½˜Án-F¿%¢oÝcŒÓ2ƒÅøm¼±äÄÉ+ 3ÅHHÂjô >í ¶Fö^ê9rŠªFùÛ;?¿ %‹ Ïãç«–´uDœºç&@㣆6õŽÎ9ö(4äðq üœ'¦x[Þ¯0N!˜•,¤$!Æe­wyÀ»¸L3žj%óå¨Uà]ž_À쾎÷ÚvÁç¡ág̨ÝJUоà—I6S,t˜Í¸»I½Ësé¢ti›LñЬ'¹sÉÆÎԶ˾e0LQ“4ᇚ…æcòÞO»Nñ£”……*fü;,ð²@ó¥Éu(ZÁÕ~ì8˜(?B†r‰çã&¸ŸížTC™¶1Ãgz4üBýXÞs nŠ…öðKùÒB‘nÇÕƒ‰ú¾øÓÝd‚K$#2,í 2ú­nÂÈI[€uúŽlÔµcÞ+jž,·ÔxëM5 ˜ªv¶E…Äà7L‡ª‚²Ñóý˜gE¡¾ [Õ‚n–ÇØ‚Ù!ðë:És,7cDé¨çÅüôˆ&öp‰pLsNB)Ëõød0Þ0»I3µaº5êDŽ£Çøa“YLòtË™f“Œq¥å1‘•VB4ä00/G?à%41Pë±Gù(‰zw¨Ñ ob„Ö8Ú&Ý.ÈþåŠØ¶Å®˜VãFU>eà{’±s©³¡Š‹F£¶ÿñp-‡ˆ³ âùäDy†ò×MÑíóÓ21Íš@ª/Îø-*ÎÓܨþâ ¶²·Ï<£z*Î ­â ¦â)ð §¢Y.\Û_žNE[£©ĽÔeüÖž Ð e¬*£Sk Z9rήÞ4È‹E¸øûyh·Mç¢Ô¿~äTJO¹”kk-—ÿTUÕÝ›JÀ›žÓœª(óºôþP®›})-’¥¹ëÜ=¸§×³›6½2@«\ôÌ`íŽTÖѦ> O·§|»ÏöE]—û ®Rý~tñK‹Òž¯3Blq–¢¬“`.²»^­z‘y ·K7ò{].'õ<»ªÊÊm_½°ûUµvä…«tÍMpéõñ{¸ß€œ>·ûr·Çþ¸æsñü×ê‡W`ϟݹ?Oø½+Ÿz_¸BÅÞ0ÛOînnbän“Ü–` ?mŽƒ5)Þs[ßîºü_’·fÊœ]Ä}ÛýÂ<_¨^aNÔ‚¶& Fƒùq®à Ë4ߪ´#ÿup?Øz]Z÷g —¿+6Õ²¶Ë¯d'M¾—íªÅK÷³7Ïu°5Æ~qmÿûA’¨¬K-XGÔ— ÞU«í#ð‡;Ž“óPLEê‡ïH²>¾|Vß;–Üv 5Ä¥¢Æ´ CÏ>µi<1çŽT†’^y®ŸiæH®íTéx,&‰'ä&ËUÆ€LÏÅ$!yÊÖ<¢Ogmâ|ÆKbó¹€óC±­vÙYYq uZDGQRa¸Q/+‹Á¯jp~·èh#Öíh` YÄi}Ï ?°î¨¹K›}€aqãæ$§F™É2£1|tï¸í£ÅNX$®ãh€b€ï«ÕYÞàŽ>4:w`&¸_Ù,°joq›:§g¼0‹@[»¡dSˆP€«¦§·I6‘ÁPÜXüå†s181—C¶$h\J%f€ÆgâíM±-\žü-àâz_"…ƒ ì«OÂ9…gàl‹;$ýb¦œŸ˜‰G‡¿Ÿwåjp ÀJ;§t|3ñwS:k¤È.«‡9 —j7N`:ˆr&ˆçvUÚì^y‰|dÏ33ˆP‹ù|U.«õQf¯]Q×Õ×j‡Õ|†åômŽÍ öçèêÞ5 /-¸él×âM˜ó¥ŒUætØ´Qœ‘^œ½óü‰ªQ"/îÐ÷9yà ¥§ð¶Û"ÚnËEÅŒÀÁ±X‹<8[t…Ç'û÷cº»¸€ §i!g~PÛEUßU·ÉJâr p¹¥ßùj›Ña¯çx©}|AÛddÁÂF3O Í-°$kEØ 1‹¼Dw!m•]ÀòDKP­;É;ëàëÒ™Gˆ3oÂp¿P3,F G:¸&Ý” õW@ÊQ¡IÎþkrô%9ü £9U!PÏãåº9Í›¢³ç6¥‡™ çx˜ˆÉò6‡u§7|°µÝbu—³ÿä?ó‘œã®Û¥£íäZc€G§Å)¸‘¿X´¯«zSíRWDÁ:ft3ð‰h.UkóÛ$~8é°"i³¢\tµïüHr+þM4Áæó¡/Ï}wøãðòÈ…p£¶©ñ» )–~ãA8ˆ"Cœ¶QÎýNÆg»c§r‘ª¬¹ òtNNã“ù‘n.^k7iîéo0M4ÿ¹„‡q>8qFåç¼k7´…š\ôíßîmö EÆÎø"ù‰¿1ô:½ðÆü6,å©RgH_½à€j!QµiÒôhägð‘d˜3EÕIèËŠ ðKø“ñVFž€ßÓ 2J‡ " JŒsÈcóµíöÌ {‚‡>¥!'± }ÿûrç`lBÛ„Z"|)›Î‡í‰± ylÊ´Eø˜÷›Q ÀÀýaçïaŠ—lÝUqørè´=ô \Å~µÖÚ¯“5:Ë™áÃb¶±åh", Òc~;IþÆåIî1©¥¦ –Jê6"_iZŒ×/Rž8¥¾‹€¶ Æ~q]Y¾èD?Å€óºÀæ´%˜ß'>ƒ“bÉK÷dTÀì«Ë ]Š£æÿ5»Ï„´VÚ{—!Ì~r£06Lìõ¹¡0Z{¢“lX‹H‰b^ÓKQO€®Ÿ Í.ÝðŽí:i ÎÐô#…rT…IxûTc®„túù‰F™3I‚n­º¶ (¯ þÒd@ãž=ã:“^æ[Œ”ë)TÕ–$ SBô™bÿÞ­¶DZ²§’ݾ}ùú°¼ÞD%ì‡Û±ŽŠÎûòxN⯵Ýþá¨ìnzC“ „ÿt¨«‡Ânÿç ÅÛÛÂU.Ne+Mçr‰>=—$ÈHøîÿ•ÝØÎJi&:9&[Ý?ç¯#Jr›÷ú)ò¹vCE»_îØ™ßj§ˆÚHÞ´SÅÚÈÚTÛ¿ÊÜì ßRÑZñ,[ý>çŸ[ôø„”1ŠŒ O)¥,Úv¼ÈugÈö¼*bÄjcXæ³{|t ^ yb`y¼™KÈ$!ï”ÄŒ?Wv0±ÅOŽvè þæbu¨Aj½©î¾gú°¿k4³wU—5ã…NB嬵Põüû¬Âß®¦mÒbq¸é{ûÕNà.9Û†t·ûç]-o”Ôbpv'ý<«pœƒ‰v€€¿ÊŽ—ÃãM0nc¨h[§—‘uš-ôàRñ^6”*jH§yg÷ :|e³S\S‘Þ)~þëe›×Ž—c6Þusã0iÉìl i ±1ÌfãIv AdÂä2£ˆrÞauÜ1ÌuXÖJÍèÙaø¤P*_»Œ¤G^]TË•½µ›[‹“Xüd–˜«Ü8øx(–«ÃD¡¤ûãÙ×­§ˆ-#Òb럊õøZÏøß2Þ©ŽõèxÉÕH¨G |¤ÇÄ0¼ÌÞNHAoˆÔö±\w„ êLj“’PÒ¶E¢±Z0ÊÅÐØƒ^o@ˆ¶›Nd´KÆž:ìðÒ=¢]ö3”Š¿ãÆYß襖³î28àüÔ–› z†Å&ÑŠv© fé†ò6)†KïGn€^§-ú0Ü$!°›‡j—'žæWx?ûXì0à0ÇLÚDs£Ràœû… Ê2“vÏPWøü§ò¶(k[)ﲫâ/*ˆQ„OZDã)X>@¨ïK¥™øý$.>ÞU»¢¡åve˪å4h$W=ÐxÝ.%ù+˜›HܸΔiШäÛœ­ÿªj{gqäRM{ž†àÂÞ6 z‡—*;»¯v ØÒ+〘¢YG¤è-HîÊMg.qXq…ÌÐ*y8,m ReŸk ̘I›´¨L‹ÕŸo˺DR¨+÷dÓi ½µÅ¾Øn-1 •'a¸ªv;›}.€.ëã“T˪®qDš3nää¥RM²à)QµìŒm¦!„Ö %q[4‹ nP@D>릇ãj{™ž”»+:LWDVØ©CªM~’–?­ülmï+»KáhÒ™eÀ”æ>¿®Ìp;{óã4£R&:8ìiZ°Ë¢DâOQF:©><ŽqõRps¶±F¥š5Q$ž)a-"õµ¿>}: e|.të…Ý€òwµ{\I=:Afb®±"]ô«©À”Õt:|f&öÎm];ˆV¤Lð“´*?ÚNGèD!RçLHåí>ɆûŒŽòUW%F] 7NGõ ZP‹G¬t1R±ï¡AsÜÅ»lÕ„¢Ü-ÿšNµû*CÒÒyÕnoV4iÉÍt½ÍÔL0ßa/™Š•œy®§Ë&.g‚÷¹º­í+75U§a|?pg÷P6•ìM/éøån÷S»·KË&‰õ²„V5Ч˜{¦Ð€j±Ër‰äW)¡'M¥9áóÀ»)×6»)Ö+,§•‹éœš+2¾Ï®‡ š”ZL7²À€Öí<»˜óžÒ'ã ?S¹þ2s>—–—«ê(7‹ Ìá‡b ¸AJ®¨ža/ߢüöôsÔ6ÕAä%ÓÚˆ=|X"%x·#·W?2mI8z‡lÏd”×U¨&×Ùz]!U¨•–}—·Èã–Ü—®ŠÒ¨„•TL|b…ò“¼ nkrØœ•0¢1Oð]¾Á—3µ; ÉëÛU"ì|šuÞi0žÄ{@ ™yTVÔën5=5óBO×ÔùŸþSFï© [GwÄx9¯Ñeë™0>2cÚФ‹¦ŸˆfÄÙñX=†jTèîZå·9|¬„L! D”ðEõŠ ¯M˜5èô?4Yp/i"Fcî³Û§å„Ê#JWÕê¶B4¥PAbp/›øBÞ5áý¶x® 8{C”oû€/t @KÂÛb9ñ廀Æì:àShŸÅÄí†Q\CŽvuÛÌN£mê?Úè³´nýC1Úy98DÁâüÇd…TS—Z97e½`ûwÙ,ÿ”¡û=„³ö{ô ‹[wÇ/·UØë°À=‹7 ›A×ÑF gœ…½M1¢ÅKÆ’ðÀ ¢tW¡ŽúÃ[G0•Þï. ÷qŸsl1Fi„ÒˆôÄÍ6uUà1…>¾È#Uy»6ÃçGô‡°¶²´FÕSO!ðx-òÛ -'eΉò½lá‡M‰Nì3„x(c´ès‡&?ÇH'\GÖ0¿¡DW×s¸« ¶Q"iƒÖ=U¦:[£oŠÑ@Opõµ´jûñz0[6”€æGô“'öœKHGë]?¹’þa«DôV¸e‘ÌÖ½PÜý2OKÉúñ ç6è ¹î>pì˪œ…¹&'¬7v¼e·< ‡aSÖ×Hp ì°“‹"[ÔØ÷J8#ô÷s½õ¸Õ÷÷$örÍúÇÂ!Æûîž(âuVTlü(™ê©©ú+Ñ@já'XVn%M¶-&*âh·=î,!Ó)ŒŸ ž…vŽ…ÐŒ€k8÷Iö¤¬Ã ¢öÚ¹ñ®0Šº¿Õäç |;tƒ¬c”ÐVP_—½ÀöB8A¨ÖKOÔàu€nÊM‰V 6’À¼£Q¿Ö Dàk΂#: {hɉ ¼ÄÞ\1OpŽ¥ÊãwU7_G7(Ù›ó¸B;\Ú¶ø4e¬`<ž-D yØÎ’Ns1ÈŽ…ËQ$È4#“R‰›êת°Ï4°v賨ÑîÕX‡ŽÔ¢bÉŒ+¡¬ê`9çCñÅö˧•˜ò¡³ã)ˆ¢G‡—U˜Üà«î\+nÌY4¸kë}¸1Îßéã¨YJ,o4ÛG¯ÅdÈÝÃ]ÜžVÓ*/ïó Äž¯³|!ÃI—NEO œ¶‡máEEîr\J×éï'®mW.‹f•¡IB×Q2„Š&ÝUÏòf…¾Z>xð6ñD_×0Îc”¤cDN`¸ Þ¹Ç99è– §2ÄÝý¦–bEcŒÐ'¤,Qq¯6á÷0‚µØ[ÝQ¶«%ôVbÛ8Ÿ†zbÌ ç{sSMj†À6ˆ’/£Ÿ¢-ßÑ‚ #«ab`‰ÞyÚzg¦F¦˜| dÁ}×£]’çÎq ):·žã–чëm¢o†¼$Þ k(âšx 6Xé˜õžSp4é`s/V[Ï[b–½›vv|L]àTQ· ¹96i„ãÒÜ¡¼£ß®Ãûâ!,NÜYKßçÝ,¸íÈ@$šÂië(At7ÀïºÎ6™"ÜxL÷\•YÕÑ+ÅsŠq ¨ÇcúïÉÝ $¡} ÓÛ'Û›€ïyVÆöÔ*ê3]G£„¨7ô Œ[”êþ=_Ý6芭!M/óTµÝ¶pîqLWN(JÑÖ…|ß| 刂2)Õ0CæÀ°V“„#*î:Šæ`Ù¢kÚÌñ&. *…‚ê^Æ—%C[³Æ¨ý…÷t!†"uiuï(ðSµATÞkT—a•ÎpsATÞŪåÒCÃŒõ²oI}ÿ. -úÏTg¤£`¹"Ë7 #行ЊB[í©™¡jKp‹¦—`0ˆÒOº¹Ù&Zq˜ Å#ŒL£¾Ó-éä}ŽÄ`<ý”(ÜUµAÛ7`o ­d½5èĀɮ`T‡ïU9ù˜{+ׄ=•DŽg¯åϾüxü0Þº î ¡‘¶OÉ ½Ä7•r®´&Î,ÕÇ‚>¾UU.C¹Às öŒ@†ÆžòÀlòrK5t‰zBg Õ¬ÃÒ“qT œyg„T‹Òæbòxe&oª:lÐ.F GPãÉî4d¢Ñ]BÊR˜ù¨þôkôäR&)T+Èõ†è)Ì›{ádSvêÓ7®§®“-zëéµ­ä£O¶Y–ùlQWÍÝzr—ÕP ‹(W| ÿuñ©Í_üøÃá§¾XgE¾ˆ¿åø[6‘wÕ*”l^VE>ûñ‡Ý'e9«Vwa½ÎæQƒp<ã· ë?Ž~\|$oé·U7uRdåb³lÑøé½”rèò%Ó9Þ®áŸl:C¼ú°IûÁœ´ƒ?˜§¹§Ýðú|"²çzðÃÚ¤ƒëÓé\$¯ÅÐg}:®ÖÛA‰£ÕH…p;àö¯Û?<ü÷ã]²vgÀ.Ve½œÜä0¤`òj c˜Öé­îŒcî%¿óèÂÌ*¸S7¯þ1ÙTñ H„±óãAþÒªm þH^~ŠäÇUUÇoÄ›¤ÃS¸¹‹ùÝÇöÇ´ôNíw] Ч±h§ô¬ÚÓ;Ï̓hcà Šë«>M6Ëlòë¿îöã½î[ãá-O^šUˆ=x”fâ…ùäCõåhfäѵ¼æpÃþu±ÎGÝrsú’÷ÑÅo^×Õ&ZúM÷[Q‹Æ]Ÿ—‹-üa÷™'<''Îã®Ëå*”a:ç/ÁÇ ÍÐpŠ÷Gðêâøzo WCÇh§ºÇЀˇ0,ê<þš£i€…€%‡RÁŸãQü‰B0>av²åÑ<<¬QMŸZ Ù‘/ùf9¹ u´5ð¿CÔÄ<[U³èºüµý•ñgSÜö묾=ÊP|Xí³_ŽÎøVoÃgZtg³Y›ê÷M äþJ\ƒ®íã0ñAó>ÆÎ£Ðç8ìöù¢¸Í¢Ú»"¥^’O»™Œ7NìÑÆ^sÐKꔈà7t|†¤‰s9ÕüÈgÐñoú\†çóU¼¨Ñ±Qm&z"„R¦ë˜RÜ*Ô”%«àÓ¾8´XĈ[åñÚÙ³¸Ì>5AWUѬnóÓg¢FÁåc®Ù¾1K9í[ܺtd½ÚLzŸ¢ósÜã¦úoB|›xíqÚT&a“#*X$.¢êÎÖXsÇ%nê2Ü"×Îø²»8W܆ȩ<>Þ0L¨o¢ÀM>k‰WO¯¦‘ #ùÂÜÁMÁ\ Á÷ãnËèÒÜž¾ Χ¼˜ñùr{~Q/†¼ ®Ósѧ{‘´Žø$µ |Ï]øo^–ù]¶À?g!hUbÇÁòKöerY7åúK>ûŒxU’•®uB·z´R ò…o¿{Z)ûJBÓªúhy^Ôà7À .qçWi¡ÎÒÉ$ô"?ÅÅÍÁo>­GÕ™#ƭߥ5€…+²ö*RŸPd__êûÇXáuµÄpƒ"¹’Òÿ ù.”îwŽJ-¿D÷}òá!Ìɳ5b’<‹QŠíö@J(9¼ k!zü u´ &šÌ>§é·¬(ª/ŸK>ì„Ú`÷¡Ÿ³£ðqŸ°~¿÷aò~õéÓêÉ[âYü«ýì*­ü`fÏ Ô[â;<ÇîIÜŒŽâŠaΧð'Òšs¥úK›ÿñ—;;ø£¼:mEj™ÕRÛýøÂ(vƒÉÅÎX£>¥ËÄZÝyÀ»ïÎÛÍ&| 8K.)íüÖ(œômQ5³e|\°+gÜXŠ€Ž&àMhËPbO,—\ƒc”½w1–:Þ|ÙÏ›ösK‚Ü&9a’¢ëTêQ§×O}²Ñ÷\ÿVyŽq£ó¬Êî§Ç·gJ@Tl‰Â€ /µôú vZjd8ë„¥ÜXÖY±ê»°ÿÎ7ñM,ÑO¢q‚hpRPÖ ¦Þ—³”è¿¶1þš¯+ì"|ôv GOÊÑsÛúÛñ^øžvê%Úr¶i„ñ˜;§8íV·nù·µ¹`ù M¾7ùzÿæ©@e¤$pÖ8MTàóMu›ÏªÏÖ2zï%A<¢þ.ë°ºC=Ïa¶}wL-vwCýyVØ´œtœu6TÕ5u‘— ´òâÕ¥Œ6r–¨¼m" iÀ†B=<0Œ¤¤¼ÎOe‚ZPn*ûžù˦„šðeÀfi¹´Ô¾sÔ—2»ËÐ<³FX‚lÄ£ú<¬7#qΠútŽÜšÜà¯ëö=Ÿ õü¡6}:¿Ð-ÈÇXÝÌÆΰi”ß!:é…£IHÊLEãR]T›M¶I ãßH¶+'íÿSŽa‡ÙúO“Ýf³Ó¥H—$6-—ÎúÝ*®Uh±eQŽêáÿºG³·Á—’„ØÆZ‡íØ“ˆìÇ›?Díèô‚5ë«óû¬>>Ö1da¤,šOe2ã3Þ×7;!ž)la5·ßiÑžx£š¬É ´µ¤Ì¥ô\ÐÄ{—Ï–«ªœc¥3FœeœÔ{¶·õçã—Pž~¿yÊõï™v_³ãž 'ˆq™ˆ¤F™š&A—fýð»l› ª´QBÍWHÒŽå=¾ìB…v=aç¡ý“»‚ÍoÍçø;‹5!lyrdt‚Ì~ˆVÝAcŽ: i¥F—iXO©à¿Ë|“-«z,ÑÀ4Æ3baEü‘/꬜-{ArÃà:Y¬atÝð/À[SW[_uÌ7Uüæ#„%ºoOŒ’~d:åäùús¾ªFÀ•&㣖ßׂq_Àý¯e<óÉÕ²©akþ ±s>y¼±¡S{á_ •!8«Oé6 äY°„¯±„ÂôãÕ2‘]¡ƒbÜGÈÿø€$´úFÈ£1ÛºG¶^ù"èõî&?b»Õð-Äkê8•€_fU½È¾yýß“º]Éöj™Yºù& À íŽö?3[mü0¢Yõ"šåÔž›œ†‹MêUsˆ&ånÂü„;ÎŽGÝ5·ñîžóøó·GAC€v€}wõÓñÉX&ãÉ0©#æ’‚³eÓdn„ò‚(…^˜7À­ìª/ÃrtÄ¥”1Ì=)&O8Ë£˜<‘ò&w¡ù%§0– $‚F¡ÃphqùhÆY••îÌÙäñ?þùŸ4`%<Õ¾@³wþþ.”g{*zš1x‡Þu¸¥›¡ýVËPGÈ·ß+¿·ZUQ= `Ÿ¬”Ú8.Û_wðd½M:0ȇÞ,Ó º5D{ü;o›.-/tòhñ¶Žxøj ¶ÅÀ#^-@±ì߬Fxˆq{üd=hçèÕêsÅwïÿÅ*|­Ê°îö+Xr›úàÞïÃ1μ1Cóíw;?¿ãƒ÷ðºg›|–¢RÇÆj7Oý"^ˆê¦ƒNê¬Vx›˜@½l~J3R´Wñákr¬Þ<{ZvÙ‘²}hê[¤ÚZR=^4CíyyŸ/Â+óB¥¬v€‹:4³pú‰rÉ¥u¾½Š»ÑHÜ ¾Pue{û©›ÙS¨ûbS€;8«N®•Y•úèÖ .÷øU7¸XÖ¡~é]¬ìŸ]Æ´(ö4%4á°2Nñ}Udó0ÇI'ŒÒNn’  ÷&a…¾æ-ÏàY.Ò.{ýÓûPŸ6é U( ¶m·wICËíùÃ=4º^\Óy¶¬ÒæÿØ»²æ6’#ýWûl1ê>^¡¡4ÔÌŠ3 Q²=~+‚=dkA4@ËCþú­j]':ÑhÉ»áp(l¨ÊªÌÊãË/Õˆçö:óÌé-ï»]A¯>cÓTB™ìÏïÙÌ!ÞKL¥A–ýüdbí.{/ "ŸL™½]~š‚žæ‘è3fq7ìÇ’Ž[>x$Eýì7©Tùb+ÝÔ¹›S¿˜Gáü"Ê1™„……ã^:´Õpu4Š›Iïý^kŠnþö³ƒòá8;ÍF®5ôö`…È$–œöòY›¥Ý#ÀÉÉÃËz/ƒ1ÁPÙË€XFN3Ù§¸>|òVy¿ÕbCÜ,Ÿ@O¸”üÀBâ >eEIæe÷™›"ùdž 0´!ÖŒ‘I*S¼ï­¯ÖÃÏ#E(r4…ÖŒxLEca„ ÏÏ´hš…umÚ'³‚:7œ£i¬ˆ—-n ¾)ŠžêBЃ a‚STäõá:ƒ&¨oÁ1 µAÊ$¬F¢7°Íê.mFÍGñ¸ SÂdïZ!R–NÌ|’•ŽÀYŒIµ‚X"’“ÿÅ!†»tÓ0ì?ÍjØø$Ù<ÌwM_{¤Ôš×}vXDd¶ýG’ g(¯\ˆ õÛ}³J“*ÅéÈq{Gh'™ÈÌ G-„“¼¥âðÀ\µ¦^Ö€x]Çu&BÙ!ÆÖ¾—ãu ±¢"ó´•TüÓ²^ÕwgÆíBz;þR¯Ì_fﻦÑÃjŸKÝCäR¬¼m ‹3IÃËÚ†U÷PÿÊÆ®§ó¹o76fqëæ~c1#ŒOò® íß×äýéÈûcõ ”ŒP"ËWâü‰ÜèÕån¨Uµ˜íWzÞÍ•‡gë][/f±ÃC%>8½n VùͨIæPÑõW¨c ±I†öô÷w6f[¤CPœwDcGm—sq3ÉÒôúk—2fÛí™M2·^,ý5 ¤tãbaˆà[ŠÛDZ,ˆM‘š—£üê¦HÍk WH8‘x¯°çêúÅõOš98QÊšæbkŸRÂÜY§f®{p†1¡¦L÷3üÈB¢™™àÜÎ[¨°Ÿ§h’„²:<Ú=©çáNâKF°ö§7…Ì*õÌ›3}EŠ\ÒÆkû¸ Û>lHòM¤0óÓ¸ÉC±x̉{<0ßv¦9´zظØ1ØÔóYßîáut|Œ::ö;èéàˆù±¼+EÇÙAj Ïzÿ´£ÞïZ”ü—î£É·'ö!b†P,¤HÁ¨Xì¼"VÉ¡I^Þ]0_Ú*.Š¥Ò£$NÚs¡;ˆàŽb_rZ4¯qÊ>/¾4Y´_L<˜+:‘xDë^ùaé$/¤»qT»H“r¾7æ.ÌKGœáЮQM$œCí]µªîjÈÕ‰BëFÊ~b\”¯Ž‚'ÃQº]L8n û4²Q^}iæf½©w'öÐ8s˜±ƒë‚._j¥îëûúˆ²ò¡b"ù`Ô—Rþ4iÅˉ'N¡S.1êiœ[QQe;eü5žÓPäãØE_ io>¡Ž¡à"0ò¦y¬—™zuBQeß…€W÷ͯ1¯j)£è A™ŒbÈ©JDTŒùT¯ubDt†ñ¬{íƒã“Y-jãþmì~w5ìù³ŸOüû› ¡¸—ÀÕ˜t«“_0S#¢&ÅÜ›©±km¬£ÙBXI1MJªÒ§‘’v7ïÒ¬êÛÙ6?¿>á»òÍHNQ~œStú+OP|å—³®!¸üQ´d­ê†æx×ÿcxý™’´ÄÐéúãR`òBÌÒ4Ô÷:²sÊ"37w~˜S8 —æ7ç›_¯³ ÑËç˜jÄá!‰è"E4š« ¦< Þ¿uͬûeÅ0vÙÉÕä%Ð*‰ÐµÔGªoç­¹kV‰¨[mݨÁÛˈ]]Q.Jz ³ %ÊB¦ÚH1„)VÖU›!Ãj’Ô*_ Þ†u¦PŽ]}•âÐâሜ†ý/¯PÇ–êA¡¬0ؽ'…{ŒZ{p¥.‹à-2~»®ZólþH&Æ”ÆGXW]¨ïŪ} ;iL?Z’þw—–yޤ¬„Ÿdd_µêcÇ·‹ÙY|ÍÙyó\¥]Gžg"è"Áˆ•¬€ÂY+€/tDªC1ŽÀt1‡W´K Ô»ßoYÅ)åqìæ3BíHlž½~ï–kF"gç7•×-A-áºúâžë¸V˜_fü4ûa— ¥ð¦Z¤Ô»… &õ© ”ÁkûuöóHæêLÁÏçBâxùÐ:˜§x8T§MQ$W%—ÚKÄ‘rã •¡§¡pzyXÞ™y%Jé’ïkÀnuÜ;O©Ÿ›EåTšÔݦPÊ›j¹¶Ÿªžª?ÚêÌ {@›µ}§ŽY: bØ«w—ñ‘TÎ7Ó¾Ò|i'ÙoÏ7ù`ìú«¥3c€-G§Lv¡ÊžªÜ‘Hä”3ÔÞþÏÜ4öŠg”rcî†÷sa1Š„w³EBMc¶©üžq!¥åp湇ꈳ«‘“™_hü`^†Å¤cmû掔 €†¨C†«úŸÆ¹”ófq.½9gÌÛîçeÝÔ_Ç㧈"¾.È#éBn†èvqgn¶çFjVæ`êJL] >Õr´W†@‡Ë³]?º~íz=ofWÎ=ä€I⺾o«Åð1³xʆ88æ²É‹(ó[ÏÓGl—T{ë•OBÈ™òEäEG…”„ ÝdN¯DR¨¨¸E7/"•ÌÕ&Ñ\mL/òr<Í€2B&ªJ2¿*9û›cùJº rŠ?°HûN#V¬¬h £’çîÛ­ï<ýâ(d+y€Srêc›˜< R~]™l˜£Bqí5Sâ7»:‰võTç7ÍrÝ, äFऑ‚²à]-º™ CLo†ëü°º3ïÃÉõyÝ.Ú ä¡Á:ži$¥wp™•¹ûèðnS(×~qSÔÇä•äwË+µÚ*^nYH/jYè'èn¿Î®Úz‹R _ ‘’è„y¥¯Â¼’Þ’3y%z¡ò-±ì"¬,ÆU•®ÖO¹®+³žÝUOfµqÿ£ØÙ¹!•ŸQúñêsR öz$o¬“€ êˉ¿°&iJ“šÉ¥y®–Ë ’“¥ ç¨hV«.¯«U}ê¥îªgNöSƒ¿MÝDÈzÎc¿Þ+ÍqEèGC]¹–´»T"Sçøf‚ËU4¾–²R™óìý?äUwÕ´Ÿ3»¯3*èêìÛ£– Xg?ÔZº ÇFþý*О€ŽéMlÛt£*< üArÁ’:cmÕy;w Òô½‹ñ¯_mG9犓—Å™Ï ~W-ìÅcv5"é{,‚!»W¢3©Š#vóC–©IC‹Med²iW8‡›ìÕ ªŠÃCk·ýòÔ1Á§bq!ïw8¯ÜÈøª8[ù˜çðmº öù8£0§ü?þúÎ ³î)Ì¢[íÔ ¿Ö½ÛiÏuS=š…InuÜ9éÚ‘:'¯>E÷)¥Kœ,‹sâ(„y¡ƒŠøvëSk\ýVTy\]¾Ž¯ûV,Çn;O=ÅÀàjûêÄ1¸õ·pRÞÎþZòÎ.íÏÖpìT6C§•ÑÑéf¢2Zýç¼ü¼R¦Oüyʆ~~ Gí²¾E`„‰íÓ¹ºÄµUüú¥™½šõÞÝ«Q¥t—¥ì¿c6à,æíƒ8†”ÉÄ ö‘Ö7ÂÖˆ˜›sx`EËß›t ‹"9RB¶ì0Wè1Z<§Ñ—Žùp¥¾úž¿ÅU}¦eÞú½B:kýð~–ýæ3Åèu#xØ6“»£2€r%Ú¹œÜÙ^Ï~þ-2‚ÏGC5sÿvB B52‰ •‰Ô¶þæ¦ù× ‘ã}N…¼‹³Ö xkÖ›Ùz6–á7ÞTûN5_ízQ?BÝ7¨ìòaU[“—óYòrÙ9;ß*ƒqœ°:„ T BÓ¿•1¡ÊLJ~ïL½©c›wÂÛsªëƻבÑ%d8¾pó'2!+¢!"°GH&׳‹ðÌþ+4Œ%a˜JœF÷6ãã»Àdtb9b1’†uDJq‹©$Hý`eñÊ´¯>¬\ºb2úža*ïU÷”î4:NÇ•R é[gRä- u'TßÝl˪ƒÖ„zFcÆ6ıØßý“ºØç»šdS£ Gj†Â—Å©RЦ M¯aï¢Ðd/”!–#¹F;AGµ– ¨W[`„ÛÄYÂH%2½I™¡¨ïm`SÕ N7ûãÒU–O¦A`š[Ü'Iv ìÑÐy^›E²HÏŒ'‘ºðAtJÉb3+G ±¤ÀƒO«öKÊ qòN{5|ÏÆÚ ášÐ‚¹ AߪËÝs,¡Ëî6ÃG¸_ì&06[£7϶Iá”9ÙÄ# öê Ž§,‘,Š?6ë® ²['P_0ŸHJڛݺ‰‰£sbJ¨^(ñ:Tó2€@ˆ˜ò‚Õݪ™Ý´P‹B‰#:ÝÖ)>n{ÎçNŠà%NsˆÞ^ëû´›j0 q?جpù±J8_r2Ê à=¬&aunù¯áƒY™zÝ ¿ q‘8ðϯ@ô¯èÏæÑ¤ôO's?1"÷ ?_ÇØ(­KØÔ,2 óJF Š$ÄI•OÌrØr*:•t8ržù%‰ŸÃŠÄNHÇÊ~qºEòãýÌD÷­ÿY/ï×›†@ß“"Ê.ÀR‹€VîÂqûÑæÕÑŠá±éh8a¶ý¦±h>Ý,·_u:ð`4Ø’s{½¿3ç•B=¿êÊ~_½u–MOýµÆ<€]ÿŒ(ô³Ôr¯iYp¯æ1¸W÷â@ŸÃç÷ ®ûýQâdBŠY&~t•ù»êÕöÇ'ø?§{\øwûê_öM¯¾ÍÔÀâÕ@þ~ƒÜ·)WÖó&¹½1ë7—’0€x¯ÿÝ_- /bRT“²Gín¯°Š@l’$d5œDµr±­•»ä®»¯ì{n‡{³Æ%{¬äîgm7’ÜÌœÌìŸÔ/VªýG÷Œ…ãS.°ÿš]¿ýG¨ (ÐÞH&SÈa„Vµ«œ¯Ú— ÷ýÂ|„­¸+ͨRä4 ­L"Ôdi¯7õ‹£?q®ÚPë¾y1ÕPÌ×'­&íIIVsÓ,ªÝmdÙ8R‡ùCõY&nÒáI‹ÒhxQ‡jÝ•Y½÷ßó$$£\›ù±õÁõìF¼~jî̶äh‰N§ñQ‡œàëûÖ¬çV¯\Óó:]aZª/«‘ý¤q~„¤½ûhòõIpë1Šb_dØ~‚]B<Ô‘)32 Cˆ:$0_ÌÌóþ½Y-“ŒrFœ:ªŒ»9äûPKÁh h„¼ÃÖ Èø¨ßGØXò­³&éäpY&SK HJYõ—6Á.Nh†“§·¸·ËuÒÃwDƒ…fd’i!½“ÝÂÙM»¾‰<æp‘œéÃxTIE™Ýƒs 5…Á ÉU-s…¢,©l’Ñ`Jz£Óž*ûLT9 p0:ÑçRº×X“A”IßQH·¬3–q¿~ íÛ' ¥z±‡Úú!ÃO‹ˆnöÅ`R‰þ *U¼‚"¸e%õ-èÎEô$(2üÔþ¹YXç ÝÔ®Ÿx‰ÒbX¯S“˜ä7 ûHòÌÕ‹yhÍbÞ<7›ð´mÀøé‹TR[ä§fiPÃÈ1Ö§§`•f#×f/éü¡/ÏÞF>‰¦h€®¶GøÐû Gù "5åŽAa_ޒ舲` ‘F±½¡¶•q{€‰ÑZHÌéϸƒ´BgÀ*,•›w5É÷°·ÆÊ&1™;a{†ÒúX¼/Va.qù„!¾¶[VxÂáù:G1-ß-6ÀqqÎ1$H³Ž!#°å§ÆZhÐlßÎkµ1åëGÙ¸Å]7Ëù¢ù 50RÊÿfîÚºÛ¶•õ_Ñ:Ï'Þ¸_^º–“ô§ÞµÓž½ßh™ÙJ¢7%¥u~ý(‹$€4¤¹³úÔ$µd`03˜Ì|ŸGûø Ó¼Z#tqȲgˆgaze„̾“¶=/˜“0+l"<¬)=¢¬š©Êv€o÷M4ŸºJ§Z˜;—Ù–L ¦­8Éeö¼Tœ¬|è;bÚB¿­×ågÕ¯ŠeUc³$AìøÎrä6ŠPY¼´€Û‡*ãÏgQF9$Í,\¼Ãè#DDµÇ޽SUT¬gã°ùÚki\ø2þ±Ýði+sWX±.6K¬+a|J ªíDÁ}ßþ\‘y†’DL¨nЉ«{S®Š'¤äfBza9rm0x…Â$•ëÁhp†Ë•!v»íû‹÷>‰lVÍèYꬶ ñ•‹’²V«9*>Ž;Ø.Ý"ö«eÞ]Î!Æ0ª´æe$ë”;t"ÔÅ2“KUà‹“Ñ¤ý¦ç2ƒ5Jäë ¨cqŒH,oŸµïè)°.#Ì„ä»þ¢¹ÙhwHVÜ¡¥÷ïb]£/bµ¤³(Ÿ8”«ñÔÄ!–‚§¿ü±"_Zå#œ8x ñnlÂU—ͦøT`Ë™ÝùÎ"À.r}ïr»¦Ú ïÆ*M:ù1§vy T$`⢌} )Ç§ó„øæª*ÚÅ„¶ÐfÖï'4|프ÒÎû)!OTY¢¼ß® >¸sPàH…êÏRŸÐµVcí„·N¦p»H­£öD–Ê%ç"VÔmM“¤ ‹÷.è9Ž—ÖÛCöUB)Â'Tcí´Õ>7=Ó¬;gÿt.À\d6‹ uñâOÅ_ÅñD!9…`ÆØîy̳¤åƒ‰Éª(ŒÃˆÃbÃ9,[cf–V E»÷ë}y‡x[Ô°ÓB(æÔ®o#€l‡æþ£³wûj»¸®wõ¶:ï !§¡‡Ѫ«Á*ŸßåËì¨FŸn³`‰*'Ø2t0†ñy®”~ ÜE«q!«ƒIÕ÷«HCl¤ýðy9F)†ï´©ȽËåÑž[Pç*'¤óDà6…ÚÅç–bûØç®ñu'£&®î ]¯êåCµE„JÎñ`¦ðƒÕ Bÿ4ìˆ#îúè5u™ç#BÉIL¨hhÈqLó]Ù¬ùâû¥ˆËŽõõ³¸åg‚ÿŸîšò#ö¹žQkÍ„K‡‰ikt2¬«e±x_,VØáJ¤Ñ³Ä¬KMn‹»óâã;å´0m]úØœ©òõëöÃçÅsž™ªhZmÄæ'Ê7>Ì"AÑKp]8wŒê7p2F2Íû&4m ˱˜Öv] FÚ3Oõ·,æØl…ÔF+&HŒÀm#îe^?VØG|¦™šÒß‚J¥‹»*v¾L\o±z¨ˆ”Úo&Êîçòi3ÂH¤RŠ5tââž ŒÎî±§ë.¾ øFM<Ýgû¸*îËÝÜGøLž¦{ ¸]- D-¤}W *ÙæpUQbi6h°¨°Š©s•ÔsÞóò‘ïx»k–rëò¨ãd3B€6bCpŽºŸc†æa•pj¦½ÀÍ}}‡žÕ ÊNp!zââþÏÜc±øzÓx¨…Ïèç!鄇D1U‚Åîs±¬ýÈ6¨²ÆL‰NõÄ%^ן‹ÅÏÕ?1¤¹Pœ¸¼+—;+FgoT0¢&Îdâú~jªÏÚFÜêè„^M¬‡>P’~hméÿ”ž˜Åÿuuí—ÅÑÅ áýA¥ ë/ÏUšu¨£9ßUÜÞe“/yeSa'‘%ãb–q'yû,Ňi‰Š÷#l>®„í§?%ÉËQ¡bQNbh*q2ÑÓð¼ôË™§­wCco«í®©võâ›LÊ9aFx0FKH×:L…Í¥N¸,ÓsÝ 9H8$ü¿ó!+ïËEæk’‡a]è¡íø sˆ‹Œ¡øËýÏWo ç`¶U @ôü§1,Bv*|‘š}+ÞGЄ1±ß &v[¬sz%Û÷#ºMm˦)v‘Ñ@v¦uˆö„úËý1“!¡ÖÕ$ô’ò™¢¨Ãqºl÷åc¹¹÷Ø_¾Aù·Çú·Åî¡\|øqˆ°´º0!øQ'†SH`ðuÃB¶ÎëÕÓºÞïÆc€µ$ÏG4¼í†ÌÃ7WIŠÌù±·l—½wk,÷ï·‹ËŸ‚-#Ê*ØÓȈ±!Iô{@¦kUƒ‹ð4Itˆé~'`ka¹BÈÝQKÞîwˇ…ûÅ«u ©½Ò xßZÈuû«ÿеoú¯é‹òÛ¾_ù}åÙ#EÁÉrHÿÍ4ãßlp´€ƒ`¶…PI“‘%Ö„>ASHò×r‰Ž# ëAÐÞÿ&<÷ãvO6O «†©º`PÎSÑ_›˜])CëK­Dc{®Š?ÊÜ“÷¹ Ìï-þ-b̬Wû~±qx`°Fÿv’è,²üˆ¦B¦tä̹5\ÛhÞ/÷û‰J=¢1!¿,ˆã*ÅSäÌ3A$G/y„¢a;úä3ήKr¯E®cO;"””Ä`’×õXPŠ“×˜I(IÂS@»È!#2…ŒÈ„/(]Pë¯É¡ÛsÂßzGä?6€”FG*ˆÌãëóø ¡3ŒŠw×Çkçœ|×çjq!µ·‚D-HDÉ`LF‹\åôðÉèÛ£D-.-‡+|.½âd‰%àOm—Àb‰ÖC*/Ëtv¿° –Þo\Hº.7õ&BàÏÑyèÛ),½c,n-ÄgC¶:ÍDvH°ýèyÑÈ F®];“`6Èæy’Óùð×+X&JiœŠÐÒȼò”ò¨$«AÝ|*7UóBK¡ùgêüV!­·jÀ×b”äÙýBò´ô~M‚ÖíSu-t1=Fˆ®\ø¶hªrƒPh!CÒ­,0Òá£g%#H‡pµ~c‰ÝEñ] P ´–%ˆÑC2&‘ß+„×Lï•¥†èw v UÌ¥]—ˆï:óã5Â0•6¤"3De…sF¤„#а]Üw+lA˜Ñ™f,…ŠÂ¶“‰â8ÿL<`÷¡4§h9JuÀÓ¶¶2È•H×›èm©mƒà”ªˆ†O´ ÞÇΖð:|6úþèM <ˇâ±~z!Ũ’*\n–Åö±]ØÁA\c{˜AiX¶œE!`Yr¿’¤r•õ» a÷ýºÆŽ‡_|=|ø¼„TbÎ÷y}8¹ËB̵ Ô«UQ#œI4MIßàH…Ê»”u%z“Û•½Ð“ô×ýç%b›q¹„裦ÆÒüõ¥0;œ:hš{Eyb ]|¦'n¿]" ŒI)Õ<ÖÅAînsþþ“‹Œ6F ¼‘ÜßOg2Fy^¸u#ÙÔíÛ­ðeʤÈp×{„:8¨Sý W–›¼Oш «d¸á‡tº.ý bP]§ê÷w 'û1ŠôÓ‘”ŸxŒš&’’‰çé¿ÇúÙ¶—\¥˜¶0ßãáöÅåj‡]¡Ë(é,Á„ê"Ëö›jƒ89ỳ=°½.ÎÌæ2P,cÅOhOgØ,˜ÍJõÅâ]uWºüôÂ'nîŽu8Ϋ¼ŒpZ”ølö¿#§ÌŒ$±œÎÒé¯d/£õ]ñT¨uψÈBô=B‘í1¢`ùË ýðyÉ”¡-Wh5”J>‘uñÖ»ˆ{#NTcQî_”îÇI„¯ªfm&U`Gë "Ã8„]Vð;û†Ïw8£tžñ{eúgÁ¦Ü!â8$¨e¼Ç¶RÆ'‡97NP"„qÇ^¥Ç¿wùâ5i罘‹<Ó@Ør©’éW-ŒÌõ€0û¾)[B‘ªF¼àý '=夆åc<Ìí I 5¬ÙÕ‹«bu_oŠû& z0'à\ÙÇ="²µ‘Ã×-sð‘§IgyÿŸ=¿k–@h<¬î…»íãb`‹äVaw»àîvë¯6NóM‹:à¢TÙ47zÑ®ñ…}ƒ8[‘<„GQ׃’¦Í«4ÁDñ:¾©Úµaý„Æ­ 1mi7{—˜o°ªËžJÛi‹»-VVp†16K>¬û®ŒýaB”ÃZ¸Ó¾Ê`mÞ†(&ûÑ*á$7ȸÇC ë úd§-ì‡8VŸ˜Ô³Äd:€‹»*š"ûa°yU9ë3´'xeù†W-ðÀ _ƒkG°Ìµ£“]ÎöÂ?¶ MЄ–u!©ÜÕ±¬W«r¹«>y#¨[|Ó.ÞNØMbc§¬¦‚E¡ŒûÖW‡oθ+Ä-d»xí_Æ5 #€xN8ùo§H_ÄÇ àãñÙû¯?~ëVRÜ»ßE7ÒÀŠ•á"˜ÿ„7ñ,­géYpª.\ÂmE7°÷W/(Ix~DtÃ}43h¬o#ùçÿ%¡ÁyÙRdØp/àu¹éø€àðë¬6·»úOTÃ=wA¨˜ûF˜]/ûîÖ›½gZ—PÿxÏžA,„Ô¹=çŠ3…#È ð@ÛŸ ð@Ƨ  Ê–ç‡98ˆ¨…ÿ{¯s7Wa{úQ0'”KÁgK ¢h)/hlÈ “€hñƒ#뢩îjT,íÇn'†Á*ОÚI©m—)·å¸˜ƒJ®üP|*ÆÖw"¼iÊz5öwžC·Ê~’9Õûj*²œ§þÎ}pïCjL Ëc}uµß®ª56BbÌ£ŠM ɘôàø¨ŒùPý°ÅÿVMZ.›I8io¸Îý¬‚U3#Qx-}Çî­Ó‰Êã ú›ç¶¾+>F±ŽÔÃTy ÇÞ]Þ¾ Ý¥¤–hÆc.Œ”rÔiqO 5ç„ÎdQ›NJú‚Fi扴Î÷³¾­J,|$ugªØ8Iµ Úè—–™¤RŒ^X êt\Þ6ÿÖ[äm¢ý¬Ô¨ËÞxÊÇñÁ ³|Ò¾ÛLì[Ñ̾۶¤j‹eÓŒ[9*rÓ\r*¿€šA¦yÐ à2“’Ö;÷©Åë²X> vw~YûHì.$$Ò…Ü8ÜÑ7M¹Ý žKAì¨Ýp«_ñÚN´öðÍ…Lëü²ißS±ûV–«Q0׊M¨n #§Z{XvqÖžÔߟŠ?üërÛÚù¸Q1&WÎ7ñÙ¦œzpò‹Ô€n±Ù.pÀ&¦–›q÷S_ã9©'Ú¬ÛÊCY¡Kó*Þ“-cÿŸ½k[n#G²¿Â/P™¸>Úr»í»­°í˜Ç’TkUªÒI_öë ݤ ÌL˜»13Ó¾( @^Ož£Ø­3e¤ª3ç}LyWÝ-½¨Ï ­…áŸÏ–®Ê %Ã{‘/v~X‡’cMmü€^ñf žÿ‡ª§èÂԪ䀞7÷á¬?wmO•Ôž”×VŽÛñ§,VÖ]ß8F膻p–œÌ@:©¥çÍP„ÕÓ#¯«3ƒ‡qXS)T Æy÷-Þ\jï4Ûd!<¿w+*S˜ßƒ-í°ø=üJr?<¯¦ˆ}r~\Ó¹î5¹V2M®¡ÔfzwñÜäôM‚žw˜J{Uш—¦Òp“Ü^‘{¡wŒÛQ½†òŒc)¨ø&«ÊûûvœÚa\üÕô}KDV¦QÂ#ðr•‰ÙÇqÚîÛÑIðûh‚§ãÛãk«Ý»U¼˜WcÜ袚,­à=Å(mÆf‚ ÎXŸ§-§.dÁäfÕïK7Z;Ã4ZÊ £Ueyÿz ¿‚zk¥@ä!Xgù·Vj¨ÌS7Ãðý =ñ•¯³.A„ ¹êÄ{Ý,.ûàÿÉ9ÁÌE£*N©z\à’`?Û:Æ¿©(Ȇl$ÏòX|…å•Çùªùþ•ž‰FªfšcŸ¼@m&úrBøDn,É-ñ!Ï !? Yé ß…~G÷†Fóªöpo¼à[ƒ•åÞû&—››&Äé;ê+1wâÙeŒäû &Yn"’šw¤K™xðêfn»[jæ,œQÌ I?s]y=ßD"öÕš Ûñh,Ç ÆV&ÍËq³ŠÛAïšûõ¢^Ï(DÃ÷!XWÊîןÜMsaÊ€¾²Ñ¡üá• 2"øFCeâõz¸ëÛ¯ãHÖ®öFÓ ¡ø¾k3ÉßúEÜT Æa$!'…SaOeæ±­¶ÿ‹ì ¹pÙð;´ç‡ô•™Ç‡î¡ãuÂç–<ç.Œçw£µÕ¨¤ú4¥XÔ@§Ol¸cÀ4ZW<3¥*ŸÙËðÆj5íl¸ÿ‰+jr¤xpÙ˜ù³Pø{}p‡Ã9(o6ë“KÃRÊtïÃøÈÈô÷šx?·õ¡…!9DéDÉdY[ÉÝÿ•¥rSw{×>†c ¯|î¤ÇúŠnàö³ñ-ßR¨™…îô´þ<’ÛÓè-……(f¿i9Éi6_çòíÄûá“}—ø¡JÁãÏöëâUó¥Èë3ЦùÖ·2†ß‹Ceh†çÑæqøÂ m¸ ŠÉmÕ¹pÂd©KýS¼_×2…pž9cFGìÑï7ë_´}ó5¸I3Cª‚'Ò͘w±š«KÕ õ…2YÎ)K­Œ#)éŒÛ«€úLŸp¿Nú2$Ýíin a|&AûVµÌ8g' 0’uRi¥Ž)dòûGss¿©H(f—»ë­ç/Y+/k¬Ç=0Ð…%Ú·]óÐQWˆ¸4s©:— ðä:†¡} \£éá‘Lz „Ô¼e ÚËFéšÓÆ Äãd ì…-KÖ‹«(1± ŽúŽh½Èkø'ãùÃfeh`€‚:z×ômC†ð‡Óä™#”qhjkë&™5¸ ]À2Nq'ŒŽ¨6̬)¤¤$Þøº3ÜÖioš`ðÄaïðÀÄûké*†„© >*Eˆ¤úcÓ÷Í2 ’¡¸ÊZdBŸàC‡‚¾ò=†rû;§Õ -°Ñp¾b!¡Î Ë1Ò²º[Öqye„† È€¦mÖä6]µ×Óxß.®RºÿŸ¤=ZæT"Tü›§ÑVTˆÓ6‘ 2MÃíãKüÕLpªQíð®î˜M:”eÐôU¥ÉË@Z2 æ+ö Ñ­ÎFˆÍc;1º÷N;Á,c­8M*Jr¯nï^·â3Ng—ƒÇ^¼ûé¾G+ç‡&Žø]FÅ)»/³þ°âqì;jcc÷†ÅC§ !¸åýW ´1·]'±^–[•ŸšïämO’Z&ËŠ²;ÊÒV¶½Ð‰§DWZRþ-”],æ}ˆr%¼¾ªŠÑ6Ò2W"€ ïÍ£¸cz_ÑÏSê^,æx‹Âügܬ—‹çí@F'h-™Cz§ ‚(®2® ýp•ãW‚2 &•AœÁ©'¥¤Š„¾sŽÒ’’Œø#‘§Å{ÄF'ôíjñv¤7Z¥ÇCóx¦0dÒg²Æîdª>›y··Í´xÎé–³ ÅL±P¹³t/ä¾{ñ?¶iR~l¯œ‡bÅ,,D)Iºrð£!‹é¨\/Å—×7wæü¤6ýÙ/(c—ã7çõ:”Fwd+Ü¿0“,ÝhõKœÝ’ ;P¤w“tT¼Ýñë¤ËúÔÝ,É<(”<êKèù±I’â¬,ÐF…/§Õ‹«fº'óZ[&áJQA¾¡ü$uÖ~¯O”j­ãc{O®µ¼cŽ$¤ŸYžg»¿}+îí°ÞÜÜ? ŠKõfÐ 'á †&”1rÎj ÇáöÇJt›§«Eèñ›qÓqÖ¸:¢y8#Œ«à(¥e.ýöÛÒÊ—Í÷v½&“¯jä n½Wƒ[]u¤*c€.[6ClO­‰@GíOóåžÅ¾!º½N¤šÝ¸L%0g‡†( ±³‰RØ\·?בG -ø _zpýnêwrÞ¤`×/X»²Æ@±“5†Ë”oJ”“ðçM|8ïÇ Y¿Lú™†å쳑ڹ_R ž–X£i+«—Sû…³áC!Å›Føà \Å&¨9~8 ±zÓ|æxK)¤ÓÌeoåN¯>‘¼Í¾?ø¶ å"!§ó°Pó ½Ç¥;#µ™¦kRJz Æ_I¾(U^ìx¶¹ÛøQ·îZ:y–âð§ï1é<ý S¥y-Bìs{o VøÙ$I£UHŠ7kòBÀ—‡ÐÏ›~Ý=Œ•¨ÍŒÞ<2]« Å,MY *ž$Íž|r?9Þ”V¥ßp¸9«Us³Ü¬‚Ï8=þD•(5›HOºJÏï#Sè·?ÚÑW”"nAY!çù¸"ÓŠi®=«únù@L奪³Ú¥»Hp%«?ÓMKçw’Æ[tC3#¦ûóG*y †gÝ](µ ÞŒ_Û¾§F9TÈÅ>ž)§†}©ù66:îšáô’«JzmÞÚ¸ùÿdyH»Y-:°¤ §2l–È¿{Q!áE»žÆnMç+ñL8¾b~˜BÁ  &–Î×|+½£ž<þVÅ®ðïSl±ºÂÎK&JHÃ+êW¡ Íö|ùqšÈ+¬Jq±áè„­ §ðŠ–n½Íƒ‹/¹Ù—}G–šP—OÀñu×wŽ‚o´:f› ÛbK)’¦wÔ¨eêˆIÐùP Á‚ ×öCpá ï¯Úîn¹^‘Ù~WŸÙ_AhE]!‡\<›®Ç‰Á¢Çä4s¶¦ÄUgЛîË8;B8&q±ˆçg íæÚ‡¡]kB»L$”>ʸ(\~È ³ N-HßÔ`ÃÈ® qÈËQGª~#Lͤd}äÁtyû³ÙôT$$%txFæßÑý"ݼCë¤[­âO#ÐmšWŸƒ|ÒªÕr6¯´´`ã²V­HG·Pn¢üXM'ž˜Ád)ôàá,)=Ч_ÜL¡ïâ’¾‹ <á­qâ'Ÿþ?ãóÿÏãs ÷N~f"ÛFWÔŽ Žn;­¡îEqñöÅ ô¯yºï›i¤¬ãZ%Œfû؆ÿ¡«ªD/“Z ÀŠ&¢«¹±OEåƒR…òGûùs;J|ÛŽ"šY¿_z$?zèBî]O»Ñ”1¤NîÛ¡ttÊÍŽHpCL7ƒä1FÖ\äÙÕ«¶'©»ìXiTŸ¤¯·o,ýÙ^OÍêž2«Mˆ}¤ ·ÒÚ·B šX+O£ÊÐ#þ$‰Ø»‡fIEE 7SóW,³ûX|sM™V"áyþ„±Èjσ Bdâ> LÍáŽ}in)4»aÖ8q(o\¤š½a´jÒšàØÑ£«Å_í•=´¡˜ŠÚ¾‚Ç£­²ÙǦÍÉ=õ÷í@—€ãÒ±n­ÐÁqDƒs/âúD®ŒòLaŽPbo±­>Àœò¬×/nPÅÑyž¿;<ÿÈ\øð¸Zv9H±rRÚ8YÞ{%fw$õ¶ =ý=]aq|¸Y2&aÞ#w(dβyªÄÓûG¸Õ-è’Ù}¨áÉê)iÜl爴p¦Ò¶Ú]É„z¶„³"£]Ájàk*Y¡NQ¼&ç‰t<F ~@*À ¬ñ%ùÎÒ)êä $91­'{W©„cRk|@7©¨;Åßúî¿›ëv½$+s ®ºŒ'Âa…ÒÚü%B©‡óqj"Æ ± ’Kƒ§.ímû­» .-i‹…8áíÒ…‘õlP¢HI•ç‚ÏúëÍ¿6íþK,:‚›å±"FšìЉÑM§5ª8–*Q`ît_¶´k¡Ü™@~J=½ÿ§û“—B©ôR8‰âàï>µ•n~˜¸Q*}_ÉÓRE0q4€ NмÑwHj„ÿµ¡‚‚|87û(‰Ù)û®®8a/¢ÿ6Ÿ?7=±\Ap’ÇÙWfTS'…17ÛîÈŽ™TŠ-÷÷#+kÈ#ÑÙ–®®YR]£òwòÏq¸™¢Ô1ç8eM-kÎÑìp޾OÍ͆Ì{cÐn¹í*¸Ý·Þ”o7&ZÞe^¤Í@SÈܯÆÊŽB{±‰?Çi½\„’zŒRЧ;¦˜ñ‚–î°i‘§}~nGég)1ZûtëK—S½Ëe3õ#í¯â’{ç+dhHte©á!V¨ÄêBG«é#~‡ºÕÂóz§ òQ ,Íà ضÃêzœ¨m:‡3t°óþR+¨ð— ë,úÔ †½øêh”ž©Š¬Qó…¢hOݽ´.{®Ô«{±™– ÕjtÜ£TÞ²;®hh+˜™‚¤«® ]õ}O–¸zk ãÌYº“Ê;õÍ=¥µOî‰Gw(å¼¾…'e6­ÏÄñÖ§2%V½nõÐL7÷Ä -vý¿5¹U{EŒwËŽ c'3Ö<éBŒ8 „Jý‡Î÷ÿop”û^d§þÒÆ•4â:ŽÐFž@ e*‘fP¶µï°ÉÂE J7 áWQa–JòVØPi'ù©ie@.·á’á½)>ô-UœããàÁJ¥55ò"$ZæÂÅ}v?‘1ˆ9äy;ÓÆ9¾ÒÄ6<Õ\ZÈ/mnñ‹æ;ym.¸!x« 6œøY†fzÏ"ÿî¾o–ãÃéò }²2bÎvÃuìC š_X$e‹ZfÄ7iªX¼ü°€¤Œð–«ˆ*3ºB‡‰äó3³œO„ñqÓSE”ÑXäÍcк5KöMÛKõ¾›Ú»‘°±çR¡^ˆ¸W»Íj©¤›ê%ݳT ÙãÑç|Rcz…»AÞ‹í;UAß(ªLÆàÒl²‘_ìÆý¶¹k:Ô"2É-?ï®I•Õ"³Ú{Œš[Xë™FÃŒ$ û}íÛqWí0¬¾÷_š¡£Tn&%€ñ7².ýíÎ¥E5Ë5³•9ýõu¦MxÌ5bhqÕójÙõÍmÛ?.É»KÚEô¯`¨ÐªÒÒVØîD:Ë3Þ«n½Þ*¬-©~Ý;žžB ¾’å94Z/dÅÔÜW™mŠŠ’ÂñÔEcgF#œgj¡÷ ®÷Ëñ¶]¼^Q8^”×)}€³ üS1/<êI;áÚfœ ªÀ?_šñ^Å?гa„fgôl/ùæá¤Û·ÅväÃÔ1“†´'‰¡è•É]'´››2í~óéCËÅÓÉ&â…ŸëÑô…åe1û:Õ†‘ÇŸŸØŽû¶‰Ü±õöÐöG›F™%w72ÛÈPXÞêùЛo‹—M߯èÑȤïF~€Ý~7¶é±Ç-ÙȪŲºvšˆC)ý¬Pä9÷ùâ4EV™Ç™±p) 7»[Ò[užE³¯x?¶q•}Õ¶„w“r‰EíMØi^êY)J¨1˜®E&­•wÿÛö!äàÔn½t†G€§£0Š®è¤ š½¹âÇj¹®b'¡»†<"T\1?ÑV^¸Š“t¸£ìL†ªÅ¥äaüÆÑb0ñùñ®BÑ­+ÐØ²ÆpÍU¥œšõºÆñŽ\NÆÝB&$[ñ¯òîáóíN6ãÐàþ²ýŸÖFŸ¥¹lôÁ~k(Lx颛W‘yjR5>R_Íö"2ž0:ë±bÆ{[J^:ž4h“Î*%øœ0 Ô˜à‚‚Õ%¥Ìañ,âÞ;â(Êkž7Êƺ è!6¿3«Í…KÕ2.Loú¾¡§†Á3ržßpB4›óµÅU³"ž¡Žû!Ìèí+P”»çÎ?B{¬‚¢pqŸ…§ÚQcº¼',{ÕœÕÏí%‰iì•ÉU3’R±C{YÛ²*©“ù=RËk©-¶å#û[0Ò2·Å¼ªñ;ÚAÝ!Ç»k“„â7«ÅårêVT¸h«4+E'Àðwÿ, €šš.… hÚ)‘n®¯Çª¼‡3ÀÔàó¨+œ”%q\̹êòšxð&L½VáùÆ8¬3æ÷f¢<¥™æ¡ùgãt¥9¯§/tF­òæIÖx_SòAÕóI< ¥P©ôyöÐL¡ ^ImµeÖ{^;WAåìkü©¿P©C-j6¼ …Ã-ùÂ̂޼ÍÞþ|d-mݽ}>_yŠÂ†‚‰Çš™N*¤*ŸbÈK›[ÑÏ}##˜Ô·Ò@ņ´¨Ì[Þ¶«m:†T„rÌξ$@¿r{dUî©2ëX.fÛlF2—o,e˜*Uáqò1X›}î(¦¯¦¦#Ï£ýO¸+gª@rÖhMÃ49ed‘ŠüÙu×Óa>¡|–É|Š qçʼ;ƒkÊ S2ûSs3’™ï5SZ.Ø,ùlâJ×:¡›-ª€¨f­pWQWh{Ñf<…>Uzq±Ü û!zÈ™ëyš«a ‘›å`ÿCÝÕö¶m,ë¿"œï¸ï»ÀElj›ÓÄ>>qš ýRÐc³‘D_JL®ûëï%“ÜÙ%µ¤•œ h@+ï˼Ï33ɴФÀ~S@–8/3:NÛ`"~Ý¥÷GôZãI¹‰0„ë¶Ý²Ñº˜©£ÆH5Ü10 vcXífïÒ/Ù0ÆŒÄB(ëp‹g Ràl:B6`ˆY 7"¡ˆ›äÚPí[Y·£7/ã’P¡(êÖÇøhNù­ò˜ }HJhÊO‚BV œác^ÞåI^O/vjÛcÆ´3("ï-WŽJÉ*?kó´¿™µ­±8@Ã’qcŸ9KØ”ã‚Ä ƒÃpOA¿râª(?«/Ña?:®Ážõí™ÇGNH2åÀj?“Ëר¿¶šËró2ºM·2ãd–ÑTª ±/6vÏï³múYÙ+…a‡#`ŒO(ú‰ŠæNt•}ƒ‰‡3ûÿؼ"cç#)KÍÎÕà3p¦‘!v¢¬lƒ¦Ó†è$ÓÍãØ&dä%Ô„á*zâû¬²ÿ³nh$d$ÙÒr²‰…3Û5à£=-3rPŒ5Ï=¡š_LÓgÉvðJV«<]À:­N2P5ø³Oéö~ÏêÇíE\Vnÿ%a²“¦$W½Xg§1Hƒ,Ýíb£š‚ŒuÛå*ß®IGµM ç¡ø’FÇP,aÉqù-…œ )â¨Ü?·tQ¬c¥’rät2ez굇S$’Ö¼ ?ƒÚF£ ÿZ=®òØôŠŸ¦W5­ý>eÛÝ,ÖI±—¡¼þ~BµÅ’’z¶÷&còŠ{`w‰F('ˆÖý”²mt÷LÉŒøþŸë¿~~¢qÓŠ¦_Ëê®J=摸·ÓFX³LwÖØÿõ·Ìv…]òGãùPêðÜö­¿Á>kN¾ùl¯øµõqÓ•%F˜) ‘ð»åÃé]™Ã ‚¿¯¿¢ïê½ìÊfõ’&nýa·o/f‰žA«)»´øš•›uýDeöPÝZJØ¡]±ÁìÿºÍʯ`ôÁ±Ë?öçyÿ¯_,»g×ÃÍty ºÆÂUH/½ú‚ñ.¢ºögP£Š2¬=egଅCTÙ¥ª“aUžêˆ‘1¯”S™—þÞ¸Ø`ž=Ÿ5Ùz²Œ`GÍÚ´Õ&û«ÊV©Ç8§Hì*Û[ŽüøÚåHCh+ p$™CšÑgIjžXdÏ’.?#bH¡\vL,;ªô8:ÊŽœt™±Îå7ÌøÛG‡›kéçF¡¼™‡š!>ûP•Ve²½›ÎƒR‡Ð˜<¶}Cü³M:[fÖ’‰Ü å"q¶2šégëô¯bãUÕhWÇU^?&im&ûÞl¨ãûv“¼®²rWÌÎÓEµ¸/ž—«oYélóWaIò®Ê[RHg¤)…·Žë@ØkÇ)ÏnšÆˆx•­Àð^[³<ÎT Ç‘ßÚÁ<PÊ -}Jlâ™Gn ‰‹tµðÚ¡³¢–ÆPF[äЫ¨Öq>Ó`2M`Y©ô羪q@X3JJ–Üô¢÷kÔ)ù—*Ý<ë°uš}ØwVh× “/g‰‘m“3ð¦RFv0þ·Ê·ù:Û±98ÁÅ)l 4rí2+óeÄ1d>K Ù½¶©çÃÇhÌ 2võÞ¢Ñd&¡'¹›&e~™CÙN ý (ÌÿbIëL™›BʘËñÑéïŠíìCö¿U¶*Éx´™JÈ´ý]g»´ŒÝÈ4Ÿ´·‰wgY¯Ú¥ÑÝÔ Ÿ`щ{ñœÅ»EŒ¡OBö ºá²Ø¤w1N£B2A’ÑŽ‘*PQ2A\ê]Uƶ⠉´Þ×In§²]e_ÓÙëíCZîÒ%Êqsû„%-üƒ Ä5¹"¨Qžm•u8ŠgêQҸʀ´¬î¬°‰92 ½+šhÙŠ%Ô–òÑ3ß=³ÞA~WE#[¥xÚ+5ŠÜåé' G?Fž¾©>©PLGÁ4ζ̄ 5JÇœÔMŸWëè8L5f'Q٤팘.îó“ó¥áÒ´cÚ Lšî½œ(Æ$=ntb)nÓUl<'‘JœäŽÚæieõ'tn8ÎÉ7”0¾1kø#›¨; xu‡Í=“Weö„`«Çˆ³"náR’ÎYÉÐY£˜Eö„ÃWùÃs%C£œ~¯VyñäïPM*]²!ê71þÑ^ûiÜI‚½Ë÷ñòü6:ÅTÉÔ>ÒÖ<1Ó˜ýjKÚÞ<¬,ˆŒ»'O„¦·ù:Úþ“B‰“ÈêÇò]ais™•éê=ù¹vªŒ«émÍlTŒF¥;&¥7|µ†Âø7 ä=ä˜R>av¯$îþîvy éÂËØà>‹'ütp5«¾k´Ùf™Â›™¿7…RÜôº•>ìU‡êêù°ÂóVµÐ1x•6å´à¦l1#yF‰ª ý;ˆ•»ˆ&h®ò"™ƒ?€Ñ¹à.F¥¾­.ô¤(ïÒMþW¶t!%ÎÎP^žuÔI¡‰È`^¹ Q"SŒO%?néïeú°³.v Œ}ýxÿ»U`“Sírisù0èì&]ÆI£T–0¢I-¹œ!r!†\Ø\…‡0TQ ‚ V+iŠò¡(AuΠÍMµi(hf5'¨{¸âólwŸÍ~½q¨Ê=àUáÔ›Á Àëô®˜ÁzÉiHž§•U£‘»–?XÍ4vdÃë‚ù&SéôïÜíÁúÚU‡Î‘ð;í1Ëì®&KÛ‘âÛLáGß°Be­’toÞ:\€Y«Èe¢¹Þa„—”ÔR‹>ð­ Bý„‹ô«Gt8ƒ'ƒoùò=ÚÌìb„öû¼·´fV0æ)ü[joÁ¾Ö.sñ¸ÊÁãÖE/-ð 3×Ó•9²ýš|ÉUöm¶Ìñ)]átçþ9\_B'HIB¼n3…pÚ×¼EÔ‰ÿWxÖS°€Þòkt‰'·†{2QŸ.j]Õ^€[ô‚±ð(ò›Çå&‹ÅÁâd²·£aSœë¢1¢'úU>+¸‡"¶æ93þYÄT²ù9at«N2iwrêînª ”¼Ô5ÝF7¿K"6å2gV»N³Oê;BH@!Šé¶1a\~µŒ#9·ú–°õ_a \â´Wiù-­µªá47Úrÿ®²l ¼I\2ϨRIÒS5€7Ó$Žü’Y F\8wiõMð._¨µørtð#·bObµÃtTÊirKOÜà‡±Z ?•TPîÀ®®v” ÆU@̸!dë*2¥úéØD]–B"AÏ…;º JˆL°…ñ2[¥ù2º5¥HžCÇD’ÉÚ45m†c»ö'±¯Ÿ \kY± iK5ª×F\¾Û«Í¾ïœ8ÍÚ^p̽)nÓ2V¿éSQ2ëôj[X¥u‡ Áä¹Höñ¥C’›*9p‹’¾E†ÌG˜Œ«àTxìÒe¶º-ª2V³D“ï"‹£îŸv{Q€y1F–x¸]câÛ‡€‘’C/eÈû/A¶/ 5S¸Î¢Ge‡1â5!J tfí84bÖjÿÇçå¬÷ûÙùþÅGXžóÏÞq>)}9 Ncõ\G¬iæ ¾ŸÀˆ¬ótsk™g'3á™lñÊ‹bÛ‰3c/…lNÙ±7{ cêU—(¬Í.]Ï>Z‹&½{fú“5ÊÛ¼Ì×ö1çõ¼Õ¸CóÞ‰£,8æKê‹Õc¾¹›]äÛ{ki~}î™MÇWƒþ–ÁÁÃÁ“k†‡¢é¤-ôé=¸Ž{jÒûÖÛïÖ3-cÅ'µW=ßí ¸NÏsÕsóÎ6w«}+‡ÈUúG4!W™}á»Ê~tëÅRz ¿ ŠÈ›Ï|Ç lÃp/³r]-ý,†ÈӺҮǾ|åÆc{C±*œÅbsÈ®wó Å^)à º!Öeöm–öÇ@Nâ­6=j a|ãX¡lÄ›t¯ÕGä¶Èä܈œ±gùâ&ûjÿvÿâUú8;[ÂÏ#’c–?.-7Ë1 5K¬gŸ÷IŸfñ¬I±ým‰¾…ßítn[™ëR?R-u@¦¥ý·PRމpWÏ J¶9”ÛÏ]âÅ›¢bO•u}‡°ƒåŽ› :)Â&$Ö,…]¦+(#°¡µÜ9B·Ù¸…Ä.|]•ÅC6JÐM^VÛU¾Žæ{°—Õry?†òŃp'ªÏ„ì¹õ€ ¶þ9ï˵ññ$ÞÝW/}ï·ˆèKéº)b€QŽ ja¿ê¦ÚlòÙ8¡ô¿h+ìŠâK/ à²h# 3@‡ >¹T@y_wèè®ÂŸž5¿ïžÒ(ùºÿ{—zê§Ýf«Ï‡‹ÛÍ©¶Ÿ¶_4û\fÙÌÞ\±È÷NÙ·|wM¹g¿gi-Û]Âkïbˆî8¦;ŠåêÙ×´tÁê‘òÆT ¸~ÈãòºX=Z±:Ú„†ÌsgñlÚð·lŠÍ‹Iâ:d¢ïÁÝ2Ñ/@½L¡p-˜r gH2R¢Â\a›Mµañ.‡ÈÕ‹ŒQ,&ovéfåæ©ãèµ~©—v§µà <ðßDÞµ¡É‹üÏ?)Ø¡4eÚt¿ GÕTõ‰:@P\åöv ÜE—xþ ,!É þÔ½´‘".†„t$¿üÓ%#{¤C¼&*7XF ¦¬êkÓÃMÂtÝ#-ú£ÖOùg?ȵÝ-ÜÀ(á¤G›’ÃA·gÍûœÕ‘~m„í¢´_?kd¸Ç* CÁ¹!.«\»¬RÏŒ ‹?Äaîr ‚³*é2 ©a[]x«ýq›YÉ‘¡e ¶mg#†Ë.Çè.Ç(í²º‘!vñBhLy Ƈ,ÛeS$í?[é1щ®\Ãk¢Œ8±ù(ŸŸHù¼Q ueßÝ·¯*q›š8ÿÏï exIzšÁlî¢pµ¡ˆÆ‘¡Å©O–Á«t1gû«Wk‡r› ‘¬Ä$˱-{UU_&Ы}ËýÎFš±V–7‡i_ã¬Æ×_­1‘Al5{WÈé\uúo¬=Â@ !k6þŒ Ü‚×”›Œ÷t%®7E X)€ýQŒ‡ÚàXÈÝ¡ÑH5®@T¥öHÐ e Ñ@ê"_åù¦SçÑ&ù;Š Ý|Öí>Ÿå n{®“zìu'Æøá‰ÕÖTÔC-:¤"µÛÅtŽ€Í„ÖmLëz®°ýÙ™oÿùÞ!¨§Sõ2ÙšNšWœ|HËô[”¡II’Lµ3k s™/Êb´R¯˜ZÕ’ÀØ»ñø~ˆÞ0õñÇPu#/ÓÕ2ÿšyž3†+YJ §aïåGTþÔ£EÙ\ÐYså¸XµÏ®[VuÕªÄdNåžÌ¥8îf‰Z)·ŽsÁú—nÇÞ§Kb/ë$\ì›r@çXOÛßÅp—Á!k1É+ ÿá èa±i„%iKXåö>]­úB3Ô]ʤc©½¿Än|Ÿ’e5.(@a Nñ†uè‰ìÝv’•0]Þq_l´<Wu)ì ¢0÷v†(ÍË I,n·úÖ£µ?«2ª9;Àçþòö?B”XAH¬òƒ ÅK…SÒwyITöšXO É -‘Ä 3Ðà™ Ýˆ=í¹Ðú2[‹2]<:DxƒˆðpôêóA“xz3CÃ~Ô7‡~5³wEå²°‹ ʃ]ZfÅj¤moÂRŋåŒ OÙ3ßXƒvêr ƒÔÒù‘/èa ËÈÜ—>‚oéuÕ ë&°©jÕI#Y<>ʼn/*ÈÞr!M¢Ú£GÂÎÈ姉R$Àžä{)’‹›K—‰›‹âb/ ¦‘zP‡¼-ì‡ó(£]ˆÓ)‘Ù¤ –˜Ô¯öµT£‰®,çWu{Íý©r̤«÷8 Õ£XPY·þ±ò]ºäÍu³Rw/¯Îܹ4õ‡ÕË)5D¨˜N7Ŭøü9·<´zºÈñ± =1 «§¦ƒE=qÊÞÌhµ ÒEnO|°$ÇGá~¬áÕÎõ€Äþ¹uƒ–ÅÆêÜ«#Wu ¾ÝŸãv I¯ñ¥hpQŒ‹ÁÃbÈœOÈ]ˆnœ—5º÷1À"ÜËói/ \TëlBPúBýô1Ïv°p,õ35'S^b2b_Õt™YòŸ°ZŠã“uÅòñkA4ÖVãh%¿[ûˆïÁ³ªË³O`̱¸NVpUw_ê°ìïHUAã‡^Rgå܉©§°ÎSd”²áÔ<ÄŒ ô|P‘ÎSÛïA<Ü+Azt4Ýï7njˆ—½$¤FêNñ¹Båg` Œyè9KÂa# †ˆ°È)lC…g½¥˜TA¥†âÄ/º³w=3_ð öVôÑ =YwÓ:Þ£ƒDdnQæct·˜,A¦Ä§atëèŠÑ žÄ ;¨Ž2ÛÞ>Z ýQfŒi͘¼ÊÝÌ E7^‹Û§8š%‹´ÜÕœÝÒj8œb€ðü§ú<‘½Ù½x•mÜtd„Ü6ü?A#mýW½õÙ›l•m¼ˆ©Ä=#êÊíCÞ¼ÁPï¾2oFz’`„OeãîÆ‡^‡CˆW¬õ D&ŸÁÂWgãÒÒéï•=.î³ÕÊGfáùV [;/ýëj1® Ÿ"–åÌ©±¹AQ53K$¸òxFèæ7—2šsÑ…ôèÂUÆÂíð‰‰æ©ÅÔ÷‡þþLH˜x€ëä°rhNŸ•'mÖM±*¬5Þg;Hä¨rˉ#•^"õ/DŒ‰ËRã&JÜ0dgªm)ìB×+—y†Ñ¿N=¡Ø¹ÞØÑsÀiÅ&¸ãEÿSäƒM{Úe×Ýv¡ø­Œ¬ Î.Õ€B¿øPÍ’ì žg%÷ÙkAÖ9ŽañPËë— éÏä5šfæ0mB´e>é,G>9æ;EÜx™çQÄ‹Ùà”ÚÁ>/›uãg¸Û´€)±jƒ8µAÈp »©ò1KÆYçm§C÷¸WŒ!ÔktYËï þéÅåâI Ràò7¦R)©a‰€‘]ÂûãÆ}G-4 Zh„· ¬'¥Îb`cåOá¡°³ê³ bGÆ×¨­¯«¯åèã´*?™&ý»ègɦëryÕjö@×µ¬ÑnmáK<ö67(§V™–½íjítg—Ø|çF7²RZbÌž;§;cy2»/—>´ØÔà¨åÊ1FT]:J8`8¦0h)1·±ŠÀíôâ«ä©Áö6¸n•nƒMD2ñÜF&>‰¥K¼JµCxTŒ ë½§]ª9œd÷M•òi¡Žzcb0¨y0ú‰š59´/gÉ‹…œ¤=R!$€÷(²³Þ_À©\/Ò‚Ch2¿¿_§åÇ©L*\ƒ‚!·€6ùÛ³€›ê®MÊÙèd2)ïdŒg.¤_7ÕÃ]ÚQ@Î0Ë[è—Äm©°’‰gAzŸ î ú´\;SÇÉ;+|·”IhcZèiQ?U¹ìè™)dëe’zﱊ `žPa½*×Õ§¤Ceà™ß,̬J½Ö rœùý)æ³L •Àe.÷ àºV·à^½p牋(P¦rã~)ÜÎʹŠm•›"8¸¥rhIFhœäRN^œ–ËIV[™þä:^`Ž8}S~kKǨgúãwï *`ì—bnûm졌±„¸…A„¢¿Ýv“Ù¿LPô—©›‰ÅÊ:ÅíŠ#–nï;´O÷õÌ‹¶…›(†Ü@pòÎeaÅ”±h›†);ßöçÃmæÎƒ……›¦mF,ÆkåèV•@\ÔóJýhö8’£y3[WÀdÔŽ7hD9Z­Õóé~ôe©žP0£ÛSWêm:7cxjÅðö4Ù·—vß »o”,Þ ì=“õîh§öôì‰$‚¸0ŠŒ)qzÚal*IûQÿï»SIp˜ÐÓ®î°),ûÂÞ_²Z–)[u{«4¶Š €:öÊ’öêO#ºžÈÅÙNp®ÜðNõÞW÷)û¥.S2'YNEt6pûÙ„ýBo¿zmîs7 õ—F&\â€Ñ¡íÄáý$*Ùèæ£ ûtGŸ:#†ùØŸ²´Y¼7„*!Voðœ7¼íuÖ´Oãà“.‹£HO(4EâÊAÓ”ûƒ¤ï¤ú>%§CUƒ:»¾if {v‹ÿ”SA¥ñ=³4¡9ÃóÉ¡ :7¹øœr¾Ì9_n?Π±To¯içË}ã·YÞ»{{ 4*ùFsè&þÌkb Ž¢[æiÇ+j¯–q kÛWb7;N»Ín¢hf–ýmV֞ķ›tÂ$05[ÓÍT_‚ö3­÷M9K \„«¼Øo‹ãqï&’N—øSk·ë;p¿;#ýª‘óI²[ïp¡µ]¬ {Ñí¦®oŸ7Ë;p³»9ܧU¿ÚÒ¢pRÍ{Ì ‰¸ùpÂNý±šjmnsç‚®ëïÕÇ:e§®ËÕ?3¦Ûª'*Šï4íLCqI¹8ôþrÓÝÞÕ£³FE¹÷){îéêׯÞ( Q6ÕÝ3H;Ý€*µVÜöM‹=uÓ¼š¤\fàª-°l2ˆÅw›tÂÔ^mVwà^ÁÞDU ö˜ú¼ÈÔŒÁ) Ý*L:X —¹½xîšî'åC÷X)µ|b ¾×´c…Wó÷j}èVçÁ¢\¤\aä†QÈ 9ÂñsEiçxÜW_å1†–§(RŠùîk5Ÿ4-ùa.ãùÕ O¤±†›\AúP>šÈ`r¡Œä+ô†ÁAHs’¯˜Gÿ4î߯Dÿ6ð†æàíßîË{ ÃFT^c¥;t•0õ#h]upä*®¡0Úûf0+ô¼k#é‰¨Ó Ã¨“ö$ćßp1(iÏ-Ðà tãg8×êߖͬÝ)•ú¢.ŵ\~¯VóÑ/Z(úÎË¥zß.5$S˜ŒÜpl¥;IËC¸Oxž^¼uæÀª?ØYð¦À¶'däh ]ͤA–ÚúÅÛúkkk%›9ª™ÉÌ  §ÉPOTxív·.­èqi:ÚLD´‚](»ÑU(ÆÖtÌÓ×®¶jÁt)ª‡ñŽ‹6ͦ‹[j>7ê ·ìe˜É‡Òªà PÂ…Áäé'eÏ ŸPxzA£@ìQgiº‘Ø_F(ödëÓ ±Ç7ÌËeíÜ7¥ªTŽbkÆÙµËaDpëÑŬ7´[duc=ë‚püX³¨œ(/æÊ˜©g'ö€­xú#xþNÎeÝx‰>-r'!äVбzéîBQO~ù•bý^BˆBjuúUzh^sŸºV÷a#î~WŠ@ýr#•ÓÍg¶Ëmt@ ±_¬øs# [àÁ õIèÌk¦þÍ•ÝNý.Vë„‹â–× `Ð,ÀŠÄoŠ__ŠNJtê]ßXá`ÀàN¼•ßÕU™— {öæ7pe}¬:]´ÎNýiÁ=³ÈH.½-ÇîÀèH÷íʶgõ:E8.g¸Šž07*^DñâÇŽƒÔ)úté\ n–(:Îñ±DGÌû•":áb¹ itÕ%‹_+—5,9_6—9׊±cÉÆ¤ÅU/%ÝÓ— !â/@Äan"˜6Nó­~tÞ¥ÊñcÉhgŠßiù¤xm÷0tO-Åë8$‰'`Œå§ºY­äteqyWe*jé¿=µGøfÝ,7Ÿ~[Ýë‰u3—þ¯ÿ,êÅ‹U“ìQw=Ãû˜y *â…ÇBx ,-ˆ2ê¥Üõî°£\*üÔX¼W…ú)’T-…Å+¿”£¥úÃî»ÊEa, ›yëÌÉ7ãÅžé"V±¨ €==¦}õwçšY C$”¼bæÛ\—Œ·ùçi¾HGîÊ:µµ’ÌÈÊ2»íf¿.åúKyþ“›Í hÁµ[ê˜÷™LÚQ­æÏÁ©m‚™oPfÿiÛ£ßBž¥N‹ ÃÚŠqëÔ*!<¦E¸ª©§ñ€^Ë=‚•˜vX™+dÕý?;±Õ#"¥.e!Cl=ùØb/ÀàTóV}ú²¬Ô6má"Sc4¯ã©|̬z–ٱ}gä†;7-‡hÖ—é„´ú²ÏU~mözR7óüOÊùSpðô$ø,)?šÐ1uƈ=h¼?•eDÀë"E"^Â&ÞÓ'1•¯×»µ‹SyçÙ@¯A£[¬×gçn)ß”£ršHaËy`PsÚy|äN—ÃÀk"M6‚Vˆ€¬Jôí™=-^‹¤ËàñÀé[t– ßžÖY 9ÀÞA3*[ù¥gø€§@4ž«m‘¾—Jêê4}fGAÙkÒé@S…°("-x‡û¥VÊR»4ߺc‚¨€È.±½u‡³Ò‘Y¾q&=¶X,³Òìë4¬·¿ó4µ :{çTÎ6[îÐ>èƒYíp£næ°k šªŽÆMq‘x0»<ícsø a2Ü»ƒzÁ·oœKkG kÀ+ç AƒqwDðÀmx-[÷°…'¹^Ôu$Ù! ²EWZ]7-$§j:dGÝÉÛfyØ®°w½šŽn¦RÛÚÄ}{Lm3#Q²“Ígû7.@hã'Ë–ƒò ­#C¹ÿw•Vî7ê¿w ûÆ®rC‹W€QRÄ•'¸@¡_Måòþ@í–Yk¦òq)û÷ì‘·!ZØêÓ·…÷€}ªÛ¸˜º÷¾A߬-ñÁ#Ý¡6O³»C—ʼL’®(„KŠÅ§i?Û+"½2WD·*lL½= 1€Ókk¯÷TÎfR„«f’|Ï99ÖYîr^¯æ²J3-dÉŠñ¡u8~°H–Ï‘³[_¢]GôX"Ú¹ý­é¾™–ÕCJ°ƒý`Ç6šqŽ(ˆY’ PÔÁlVyã6TýºZ4ŸÒTÝE:A 4nˆNÅÔÉý7î3 ÝL«IµhU©ž'ÅãÝjHê79k¢[q…ܺ"úe•I’¢!®Ã©LuÅ0£8tm7SmÛSTxž¸L‚бr×F¨Þ5Ë¿OÑë1°hÃ0àEüÓݧ¾ûKÞËÕ}¢=dGjp`çþO4ËG‚tqÓ]PŒPJd$€ïZÛ¥%Þpq,°G„ž¬›”˜ ×NjÙI‚â²I ‰ÈF-.ñÖˆcÀdâ«F7M;í­O>Øíü"Ü’‚q?‚“ü€!ë¸Y`êãìX¦˜ †—²zlæ 2"nûƒñ&‡Ñ $+ ‚‰…ÍS_ÙìX22#’ËêGŠuv§`HM®NN@‡š‘$ó pHDz}©—ˆMÓˆ³%90мQz6c-+M3Ò$øþÑëK¼CÅÑôl«ýV.’¤ã™ia=xLúlO:ifÚ„~ópœÑËӢ䰨À¥©ƒ{ÿ÷*5Å0?ÖÁí²W7õTÞ'œœ;³Rn?DpÜ8²4â§­ÚÅóè’dà f¡Ñ¬îFÿ3oÕÇñ¿^ªî¬L5+&*$‘æAüèU“4¶ËLMy »ã\ßVЇ= ¡™+{½zÐKõ¦È:Lœ™vÐþÐàöõ*­¡ µB ‚œ•ßÕN–•L#cþ?wp`ïy§n8`ÓŒó9ðÔ¡• ˜Vˬ§Þüb—FqŒ•&©4Ø.Ïè\üÒd”z 'û8!ÐoŒ(O¸¦ÐÑðCŠŒè“'6ÚìÇ8¬—’†ôðRN-# [±L´Ô•ƒqä‰r³»á„EÌŠmä5‚¤»Ž@¡q×<Œ™R¿lLUT+ ÎO4‘]8´èî.³AW®ôº‘4À–`ú9‹Òå„Ôó¬¼y8Á!®‘Ls–(˜N{iN3ò š7k9Vñ‰œ”³(–»£C~?Œµ¯sèH°E.Ò›'§”»vˆ5ÛO—ºXVëe@¹Ü’3†¬¥Õ1´ëw·ÛTm4¦^,Ü]vK·Ý }ô©8L”RiL‘©T‘ñ¤.ñw[E6;ïR €Z Z>Ð>Ô@ “1äÈma8YÍ¥Á¤Áñ¯n ºÕ„4‹ÜžzüôÉrtÕ¨¥f~éÎúixJÇOõ¢hß¶?_¾Ô«‚îk?øéb=­ê/•§K.‚0ÀÕcg eºõ&a0§8fjSx„6‘8¶q¾pCMî(—©DŸJ%¥?¡^mbu1ðk÷joÑ¡Z8t6Žj1Ë´ W¥îîªÕèd"'îËÀúçrÒ;g]Çг¼“ŠžY5ît TJ™Îå·¤E gykà°w —µ&æJZ¥D Ìô á­ü±,×I À¬à—©ëywyó‰zS®Å å™_O{¿þTg”Þ¦Ý ]myk€)"˜(ÛñWùµZ‡N¨ýçUšZDÐ>½>nB;;‰:#wËz^g&Ô·Uw2÷cz‘S¹P:8Ë%ú×.›¥¼ÏìºÔè­“ùTYQge±þálŠÝ¶uƋѻ¥z»ÜÕßÚø ¿Í /:‹³|øM{œÄ9ú¼!»­Ðo{ÀÊÔÈo?8POýñx÷=†2ULXí\—§N‚‚2°¤³ Eaó3ð±==†z*—´,½;ã1³ ÷íy—VØ ¥+$Ç«•v[©õÂk ÿ¥R&0‰—!¹-üHã(y–q<ƒ²'Àç¼ dp¢Rìðÿ—SêÀîÔ1F‡ÌJÛ]¾r´qFƒ‰^Ø,—Næê¡öv{²ð¹sÒ âô'«ÓZé ù”heé¿”.í‡R+¢. 5ª[ä ÅÚä ÄM€|ü¸ìä¸òñœ2LD°†pšö„6d¯÷ª™ËU•²`¤é62Cbé- e#=«åj² ękè­n ,S¾ "HÞÃá~!Ü–s™öõ€ÀÌø§ìÿ¡^Ê»¤k@•šdžéÀMùP/Ò€€thp­xpõk̇ÌÜDùtø98<0?ˆÃ#>ýŒû”ŒiSÇà~&E¸å¢V>˜[$\—î„@L8Åx,>qs«Cˆ{ô›õײ™Î2Ÿ-ÙFKl”¡¼<ûÈ;uw¦i~Õïj_/—J±§ÿ÷¿»_9ªºˆuâŒüVA7$>®6ÎÂÃ}:xyïPÄ¢ücÔ»ýˆ§Ññ¶:/N«ÕJ6žññ˜ {‚ï¯ïú1 ¢%:¶=€8EÛö€Þ÷åÓ_†{M5ì°õûÀùíiÀô< ¦Ë‘À½±-±-P€îÇÿ–ÿ2êøa³·óã€g½í«zœpË¥w Ù§c;Ï~Unþ¶nq·»P½T)·(ç¯.lå"\ðbïÔ`ö†û „ å®v™2ÑÄ<õÓ- ‹[ÓbÖ¼8¹²ô«Ji0J7õ$¤C®`VÓ ñ©]ȳÕí7xpµÀ¨ÄÇrY%@é„hF é°ßž¸´Ûiõðÿä]ÛvÛ:’ý­ó q^z-çv:m;ÉÄîNÏy£lÚb$‘JŒÛùú(Y"ndA–ý2/9g­„"P, ¨]{ç°¡1Óêr È;~ËÜ“Ê }6N]Î!Ùÿl’ð,Ú Ô= °° ÀUPŒöÀ¼šåk ñh"SÞ2W§ÏÀ^÷ȉǜs |R&¯Þ=»ƒîžÄ}¢—[ðå¸QâRÚL­~‹Èõ ¿Y"h 0ÐÍ<_ØäÕq ¡Ž/æˆÅôðŠ¦… ÍHõ12rìÈ>¬fíó×ÝÏü>+ǼÄßuõÁ·ßLÇe¿ÛêYÒék÷yɧ˜‡Ðû» h;è”HÓõžfmÜSŠÜÌ' +”y+´¿@1ÏTãÞ= °?éišìú™®¶¯Ä}~Ì+¿µ5°¡ 71fÑGpoÜìÌÖß±ÎËu»®xÓ™êFè¨ øñÓ)«‚žŠEá@~û­¼ÛLþ•/—Å#äƒ;±…Jem@‚Ñéè‡Å—@æ™/ZhŒ7hª´/Ž:L_ò'Š9ËÛÚÃrEç“òš#ü9ºsóÁ `2}T“ÅGMŸ@næ5pµœl;Ø£S¿À€H·õ—QâäúÑu"aû€ /-ôî¡É¼‘1N¶ÏÐÅËY“Ïïo±]´©‚¥:Ž^´óTl¶á’¸hN†¤ã\/‰êGY!«š¯fy2¢j·)$>µÍ„ÁwWF,ñ8-ã{//^@, €Ï%†–|Û52á‘(P³òŠã”ÀÊdjŸt^ëZ7±÷®”È„]'»pð$#qbë æM¹¥T“9J5Xz,×®bÝulqû2mUß–wåÖ!úð•þ³¹™÷ÑTNíkìlj]d_\Y÷l;{ Ü`û—'ÊîBÆÂÆI½Ájêé+åkï¤nÒl¼Ik¨"-LQk鉨^CÂFyD˜æRäÜû˲‹r¦7qï®Øí Æ(SÂôqõœû“ÛÞˆˆ*1‘%¦'v¥øX6NÎ~a×QvSò?(¦Ù”Ì>Fs¯†{YWf'~õ]ÅŽÑ5Ï­LŠV¿ÙÙ¤Z§ìGéº(ÙuYóšÕý²£ä~™ºl@Ã$^— ”ZŠ5>ÒV%²UýmübpÔN¥:eµj5ÿã,@ÁT TH¦<\¬éö «Ø•^ÂΆ‚é¶:cèÂú+óùÊt>Ó¥5&"ZeïžÊ/ÁôG ³9­È!ZÏó:£Å·N˜ FúÅä,ÃqCyÐá°¡H ˜¼b8¾\æ?ÚêhB|:î‹_×unz'@!ÚE.#JiÏ×ê »ô‘A ú£ýÃ4m›üpÅvÚ §1!;˜pYæÍ#d±r7‡P\XD&êžX,Ø ÓØQ g·"õ„kbò‰ïuFr¿DZa%zðd1Ý 60–Ô"â¸ônj$•±{HÂp}õÄj³Ëûì{îž%™’°t;w@³#QÈ’ïevÿò»“ )}\´ÝžIœ6¹>+9+¡›ÈÐ2ðãœòŠô«ºÝü®Ût?ïïóYÊÆ§Në©#ßü€Ð½¬›úæÆCˆ(÷îËÐi'³¾úû«ëS4‹6\eÁŒS‡4lD¨ãR¸'sµÐ3¼ãáƒÜ pÁOoßкhÝ;£Ù^µ5Õ€W)ïÎ8Á•;¹¤w›»}Ë·|–ÃXĈÞÛ~Q†ê§ÕÄ=XžÝç·%ˆ™M{N$u¤^û¡?€Åòv!ôY.™‚ªñéŸU¹i@ä|ú0($KÁøüÏçµÞøg÷0fME¹Lû,·ÂeÞ4ù¢¸™ƒ¾eŒ¢Ä1ŒÛá²XT0W`$C"qhÜ_Ú· À…B&¾ÜWù] y½>›d$ñõx|ú×ú$#6e˜cÄÀÇb«>à»Á•ùÜÏïòu®Éêº\2ŽÉ‹YFÆmÛiù]bÄ%è K½b LÆìºØèì¿€ 2ʺû·›˜‹ÐG·jÙŠ j4£žJY/Yý¾´òY'Òc/!ÕGì^Å\±Á—0ä¼äª}‡a„êPñQ ¿ƒö:Ën'_ÚÂëöÞÁ8å lÇ}£… ¾cÞøÒ”&Ç\ŽÎBpÉÍ®¹kNÀ΂ï! ×Eµ.ïF§@˜žßo")=La˜ÖéÅCÔK$uÚu#¼Ù‚Rrz9M.ÒXÞ€MÑ+vó @']JÉ‘§Ñ2ã²þ¯fåÿ¶ÞTyN§·S…í#é_öáDfˆ©Øá„‡¯Ã1³!ìÄ>› Œˆ_벇mCæ8sÊòp[¦·È¦Î|y¦zß—ë0…vtϦë7ð½›—«º Áº¾ÕLJ$OÝÙÁßxÑ>ÞÉÌpv80 ä+ócã¶ðHºçî‚Ç]2d°O7>˜0˨ '1Ð~‹ü\ê, bÅ]@¯…uÂ*cæ?þæxQÞÌKQ—<]vÐ>¾ËAîÀ\|8Å¢Aun¥ `¹lxºþù¶ðT.£Î ¤¤â$Î ç¡ d3eŽ2˜èèNÕL`·ÙÆßLÍà€DgÉÄ4û÷/½‘¿KˆëpO7©>45Ó~÷Î@öñwßÿnõ!lå%Q#QŽ3~ #Igÿ‰ª6b½£õ<‰gøÿó6 '/Ȧfoz"Ž\§]7臵3}ªnË#Ý1W¿Ù5\¾l¿$ÉŽå±5‚éí}Û) ½ø&€ðCÑÒy È£Ð@û–{±‘Eá4&uc}€Ì;’tõîŒéÓUÞØ‹ìåcåÌÇÒ(gGA\è=ÄÒšüî4cI̺;Ø0Ö0ØŒE…£ŒÂ€ð»ï¼.‰[ƒ¼h7ó¢/%ÓùgѬÌî* ?!z•ÃObLyM^)'âZÆ„ûH¹8B1øÒÆ>ß¼Ëzü}á¶7âÌéíPéÄBï~þÓEïr1€Þ¨· çºR: ÒŒy Žæ LAÀòCúuʧq žöÙ^‚¥S´`g%Lh5$¬]˜F`s±Í*Ô|ßÏ‘o(ùÀ¾Ú±'?y6kÄ«ís+÷;¾Ô©!BÔÙÞ«,¶Pñ Œ ¼Õç€4SGN·Â»|™Ï²¢Æ Œ¦`Ü ØQMÞéç@fÈHò ð¸>TúC€Þ/Ò]á<¿m+X2K÷‚¨jÈë™b鯇ÌãwáFÜðˆ…@Ç ðiY7e0  dëÈf9àSêŠ~\ä÷õô‰¸Œñ=Ÿ ±Å À–ð‹aPÆFQ/Ú lU ‘<>n‚/Õm ­éà 讽Ÿ¦GU˜þz^ßÏjØ¢Bé#·À—GÐÛ1æÉo—€˜2Ëoó ¶xúãóÿ,dSÕøüÍEçäïy£ÿY³-C~Ä8Æ­pU/ê l!Êd7€\ó‹^«z=Sš>†q#ü•7%锼ŠÙ`‹õ8€tÍ/U¹ŽÀ´1&Že~z¨aoÏÒߨ nëɇE¹7JÞ ͼl×sX–…UºÍ·,ÍO€$ólr?ÌÓçNÇçþé6÷ô ,dýÃæNHúÛs_ ,Â(9€TðÓºx„y>Réö$ƒú€3q‘H7$¼»ƒDúö# P7õ-Ì鹘 ðPÀ#ðQ£ì‚°=á§EÙ´°UÀÓ7AH*8Ïå ÝvI@&øgë+w†ßOTúûËàG1k'_`» "Éid‚îîôkΖyùKàΩ]Á–IÎ$ ¼šë#Áè Yú¡`¼žIÞ$„‚x9ÓW" ¼ÊKà’#±$ƒï‹Y®OÇ3àpúg‚¼•J_€¤ðmy›¿Øë9h;*^¨$IáE~;“£,=Crª\ߟ$æ÷ù 3ú !wWÕÕ8ÁÛó-¸8Ï’‚ô5dD„Gª¥ì´eå™ Î#.8S¯Š¾eÈÄã¸!Ò/«ÓñÛw›rek“¡Ê¹G‹ÉmV¬lÚ¿7Èc\9/ï]nAH{øßÛMªÞ˜2¨œÍ:X£ŸzÈSȯR¬i<Ž·S½m',Þ(ð#GÞ"_•‹à„_¦0Õ¾çÙºÊëÉu½*&Ú¹'_›²º)ºMÎ!Ù-Î×_ø Yu‹£'öº›‹‘6XPzR÷Ý’‡47ÛD¸–וžFÉ3ü·‰?Eùg^¼}ÛËK!u{ðp[À+‚æG|Uìw¥«¢*î;ÞÛ;Ýf‘LaA­méÊÅ´*ŽT ÝE‚|‹ÜfŸEÔ°ò© φñ«“¶2«Ù'nÞè¿kÚea¹¦ãÚ™bL¥CîÑÀïóE'vârøØRgY¯½Ípª…;oº'ý_w;o$qÅ”J»íÑ©ßäÕ Àlκ«ÙNZMGô<íõ}Y·Í¬XŽÙm9¿­¼ õµ¨I±"]aÊãj [ݧÛÞó(å¾ò£ñÚd²“о޻P„Å'Ë@“õÛ'·ƒ{æT÷d@çymÈ?Çç*…Ó+§}€ Eår¥‘œl@Mx;<èbÁ'JûnÑózy›<¹n¯W^¯Ûeq™‰îY€uü@Ò î™ž°_Ôí=h¦®Ï«¬çX!)ã3…9½ß÷Ù î™3í¥‰eµ™èŸ,׿—Ø=(f=¾“<Ѝßû‚·Áù*o¾½!}ŸÊ÷Õ9Êðz˜áƒVvVY/2mtÝ=;n'åS/ô†ø<ïP{z¤ëyY€üÂÙ0 Ÿ}[¯ÁŠGÝB‚¦ëk=uc:ã§rˆ=ÑÄ_å}«ÿr^7û¸mÏDYÂ;„D©@é—ò™&)ÙIÖŶ{©J¼„ zçû^/ë»Dµ?Lê“Ú,¥¶ eu_§«$\MÑ$¿ïºnõ÷\© åèp²›\†dhÒùd<$Qcå5îV=3ŠD´KÉXPž%ž&Lè‹NãLÇ0•¹¬WeÑ4¹þŽuå_Ê(7‘Va«•óÊbHDncéѰ`‘Ã;gžïƒ©K‰ËX,&F:]q4Ȉ”,vK§Ý×taŸ‡{†º Q™a«³šØÒkìüØŦ~¨^á–æ¿­ËTµjÃÞ>$s¹p=µHõiÖ=÷ää’D¤9hÁñÐJ{¾WùÀnÛ4':1·×šÃ@ωà<*éæxDŽ„áY©m8wJÕ.@쯋œ‹Ìí´VöÒnc”¾ú'³e¢±·2.kþ¾ž·ÉK£Gu,w°?vsJ•àx f_æ†ÄËu~OfQ® „Qm’õ«ºÝÌ'Ûáù¹{PÕétw{ŽþÑåЉ%Â1<dÜØ—øžÄjº¾[ÎkêtÇíûLû>n|»:sÀaÒD¥ªžGÒà¶’ÌóGX£(KFn+Ÿ-ÆÀû²ø¹*òÛú4šŒ×PbÜ Å¢†¡ˆ‘Lÿ¸®‹Õ ˆ˜Àéˆ%Ç-pžo–Å\HØpúÆ­ðáW¾©a þ,Ý Àz-˜5 ìæ@*KŸ¾ÕzÑÿ¬kXkS:œW/ãqS\ê?–5°±ô!"Cþ«x:b8yhÜ Wµv…ê¾ýìvä郷ƒ!#Ò‰)ÐÉ=N"Ãw¨îóÒqzãf8[ÿɫۈ-MwI2n†·õb=k›û—é>ÖC7û¼Yê#[õ«\Q¦H%ƒLQè,ñLwI:nˆóbõSÛaò5o0 ŸHÆ•öIèÚ„ìZ¡û×}ÝûC¾Öç ƒ#úYFfßÀŠŒ»*F¼¤W²ÓÿEé~Upòþ%l€ëÝ´ç~X–¿ó™>ÎÀè%I„c˜³Y!zä )'uuë~»ø×ÃG;Â󲺟|×˼ÌWëɵK“z(o7E1¹Úä›q'âÊ=EajÕuVF"ZØa ÙH‚—u±ºÓ§Ö¢„~ ,NUð¥v£O«3U&@}>\)xm4’°ñ—rЉËñʦ¾å¯MÑ)<ÂÌÈ0?ÂÏ·8fshj§¨¯-u`ЙXU¶ßØD:û1`Hñ«ñWõC¥Óeêdκ/kŸ?ä¿Ûe;ùœô„.KöoÁî­l…ŒHaÌJžMØJ~eûkYl ã^Sn~Ã?&¬š¦:r˜ïÛf–WPO;I©Õÿ Òó³]å˜C6zå’qÓ>I"Ýç·˜h;2Ö¿X®6m¹yƾd~™ôô¶ W+8¿N~#¬YNˆTÑi švh_^Í „?>sÚÌ›ö×Ý¿‚LÝ­—¡ŽZb¿Ý˜Kõø'°OÎ"‹7tJ½°f?ùY L[úúqÄš¶QÚöiÀ´ýÈ~¹2Ú±ÍJêœ÷‘ÚÌìçzkîÇFÒNÁˆŒçñ¾4vpÖ6¶IÊú†©"­ÙÌ"ŸÆ¢¥Œ\‹¹À¦ïdËìžÈâj|W/릸M¡ti6U$i³ò®Ò°Â ”ì%<ljө‡Sào÷3^(ɺÚïÚÛ¼òJ>NX$ˆmbj•|þétu±ŒI+nÒ°®ú|öª?œû…OPÖÞ4yµ.w(‚ŸMñ«¬µ§=ü¼9 î™Sh«äQp³HS¯þùÞ.µwX(T¡}r¦g<É«ÉçÒO)¥Ÿ»Î qÏŒ%ÛƒC‰*†Ü>í¿ÂT„,–ù"_>/<£}ò6Ÿ7ýþœç¿sÈ´ÝLcÎØAÖTÿ¸´Å¦H¥CÓöï÷üá™Sf‡ŽŠæ®m S•î¬7gÌ3“\ƧŠa_ØO<>?¶ˆ!Ý k@\Ôt3;jlÚSþ½këm#WÒ¥1Ï£y'}±ÏLNâœì:F¿µìŽÝ±,et‰×ùõK¶.ÍæEbÑêl²1pp0IH5/Åb±ê«¯þ¬æw^…fèflM"ýƒoæ‹æ±jžª»ý{RJå:äHnkÅ"%L$6j©¤yûVÑ¿–£Ä-Aˆ*yRÖ"½½«f‹åþò¯m>é¿Û -ÖÏ#uΤ-Oß|"øˆõüˆq(žØNaº|H[G…i°út2IDZ5<Iœ·;¥?Ü,Wå3’DÃd~\‘ÌßfÉ‹öå‘6J}m¡ðÂCooÖ·ËÙÍòskÃì;àŠùJ›€ö¦Vs‰£uéV½÷¯F!Åv9ªžžš›dÍ[*~UÚÞÅZ±w•AG%)CäÕ´+%iCœë| ÁK}""–$õØ¿‹«›âuõÐ<óÀÌ™÷ìŸÄi—È5AJ‰Ë­Š3Ü—"~/û SÁi³@~Ö|ž~3Š<„‚0É]‰ò ÞøIɈdð’Üêö_ÕM5k>'jK©Ÿúô '̶6>-ç‹*EÈ\GD‰03æëÚРʶ²²V'ßõUáÁÁ]/º)æ,©è‰þGGô•~oE¨5´ 'éùnÊ·­Ÿp8An–s²Œø:ˈîå‘=ѧ¶èŸìÉþfYö¹þðö…ýzz3}¨t?žÉízýôZ[Éï‘hòûª³ÿÏ*DhÛá%äyʶ¼$ävÙÊÙñl9¿KY†…CV&¬Ä$ªC|(¸<ÄÏŒ^ /myô‘(JoÒ=o›¶Pó—j6Ý¿F¸tÈ%~¶Ù•׉~òÆÖ—˜)([cYΗ}HÙº½;Þiã¦I¸5\*?N9ïQpÐèÅêÓÛ7ú—F;¸ç]t˨q¾x¬fUÊT]ö%©˜Í¾$JŸj’R¤>ÆjtÅysoØB'ÏuÇȺü¶L±,1vQµ’X ZN¨Š^•§m0 à8'·uõ̹n“°ßÌš$»cïÞ+¥¥P˜”œÆ'›¶Å>ÁÖjxÏœìÖ—x>ªŸRl —S QÁ-R%®•_ÜGï¥ ‡ç€q™Ñ%*B†%=ˆ£•vˆ½ÒÍMŠ(x`r…ì÷”"4úžÂ$Mì}Š­õðž) ª3‡õÛ>i²Ü«hÌ­C.¸á&ˆÎ6MîUÀ6Ã{ÞdYÙ)´ûÇ”¹R÷Â’Ô2Þ¸äQÂÀUßýSeþKðbù0ª«gs†»·Ým’gS÷ÖbÔd"J¿µhÒÖ2èšÑ—_š/ϼ±XÇÖz×Lžx.1˜~+`›v´2î‘I6#LTpe©—ø ޱŽKò¶N:òÌ¥`&ØVÿúA,ã÷:K;”¢åýtôÜ3Ð]uÆ¡– .š~^K;3H±8•äþa»®^¢w “Ä;Ö•¯?O3k™£ ”è=¢ãq ž¥)ÿ¦;_Î=Ï!t¦¼ì¤~~_}o&Ö8Ë4S#oÖÖõ.¢¦æI²Ïý;àü¾­Uú\žwWÀr›²³ÑÂ&Ñ”,nÙò¤]æk`úìKWCâü‹™íyu{WÍšQÊÛÔåAÆ¥}ê1‰or™äããþp¥|3J¢–nM\¡P‡8õœûgáC­Ž„eÞU ,6YǬ`‘vü'ϧzQ?S.¤s ’gë½ñ„å° Çg›v |ewzWÝ×Åiuw™ôabÔ»«w”–^"ÚŽà;^TÅÙ/ÙAúu(Lå“À+ ¸#¬ï³3ÒM>žকü0òC›{®Ú²þt‘Í¿Ž þ*;9ÔgÁÀ¦,X/¨/ú5ܰ&rcúH%6qM–]B Ëx`ñŸŽÿêE>Wk¶#äOq€³— E{X^½B.F5ù²Ï¢¸qý¢)SµZ F@¹Õÿ …ªaN9JxkÁ|œÞN½ƒäRÆ1Q²>:æ£Cȸˆß`A¾8IH…Tõ‹BQä±ÇÉéîj]>‘râÁG½d"Òò;Z\tª`z;Ýu²<Ô“Yûdõ±4¦ìˆCÍöCjÈ<ç\m Š/žfZä_eð#ð!Ã?„°ÔãÚUÎsA#¹£œWŽ«´ó»½ ?.'ÍgúÖ3¤#óæF·hŒÌ>iéz°åïê¿Ïzò×.ƾŒQvÄ“›¥þ_àÀ;žr"ˆ·¢T?ߦÌã,#&žl?ázËEÀÜ?º„fÁ4CjpÒX?žÀÙ¢Dän³|Ï ^ÔmǼ؈óžýÀÒ5ȵ=ÎÔ–Ù…SÃ-¼(iÆ!b—EuÓ$n‡À‚À³‹ •™ƒ;IJ?i‡F œì¡6Ñqÿ³ÔÜãl îp+±ñ™¿\œK‚c`åuï„õ!¸1ÂïS×ÈÔ)@Y£- åïj¹H–påh†L n ¶C0‰ç ¨´CÈ oæµ3I”rŠCâ Ë$¬¨mÕÿ¾¾n5¿Çx\,—h‹rÖ†ÙÖ5ÆC»¼*áŠХT“4ˆ“Y*¢ «4\!™9ºó»æ¾úš*𲔇É!ÊÙÉY“¸Ä-`¬ß c W.qœ:””,i¥T@5,¿8ÅS¢ÔË’ëÛ?C·“Ü>Ö“ºxÝ,–©^P¦àä2s€o«qýz3–ˆ”ê’&­ô¾o)fœ›¡Á°6Ï¿áÞãœGA%Ù … ~Õ·Ä­3®Ež±uŒdîò[3KÕˆ1•¡Â˜Ì^8mñ¦©r¥hÉ3„>wåþJ·¸J¥w‘'¸òA>!™wYR(ÃɾÏgq™O2·¤on½[Ž ÐÛËhêTf FÂw“̾ŽëïévŽD’eîòé«{ž88mÀ t|iÙ§›ÉüN_ßûÌw6`!$îèþ”Š“ÙyÜöáÕé^ Ö¾2ø…@µŠvø‰»Ë#aÈq"“NÎ4Œû¨Y[ùvT/–¯Ž¿ëÇʰ1{“š‘ç=6Oë]Þãø Y¹©`ÕÌs:cæ]ÓÚÄSìtH b>N N:„WˆË^kÌ‚óãAâÒtvˆ”Oœœˆ ì2Ë®‚¨@æ¼ÑÒ¶„ÞË'yå …¹©b~oDB(ÞGB>–i•Âh!\]P÷³à^µÍê<“Ž_Òƒü…”ï·|ª?9 <˜¤ï—tà%c ¯¬(Qñ«]„ðŸ¾öåcôX'hÖÒ¸Q8C‡±õ·þÓéׯ1^$,ôÒ]8·VHk}÷ÛJš´BþÓûýÍ4‰…P¯\?,à–…*3Çö¶Y¤îÑ[)2ÆÆ2Çvz×Ln“—q¡–¹Kw¾ü¼§½–Ê6iWÑœáå®Þ»e¥­ž§ÔáQŽÅAxU¤r*Âí?—N¤ÉÐqd¥ž*'!òïÕð©x}Õ—Íój?Òëm&2[æúìœbV²¸w²í»¶*d¥¥á¹sÅÝ\çÕýÞ©ú·U%ó˜sËAx™tW³j–Ak°Âó& îÖœ­ó#º¥W±cGÕ0äóí:õÁ µéG3ìКΠìáûÊÜH]™¼õÎüGqj’îGµùOƒ™üP]7Ÿ›ëâ´ý±¦žëkm4šÕZŠO?üQ7éhÜÌïê›U­-sBLîÀ]]Ýü³Ó6~ÿŸµ)è8_ûšWêÏ€£Ž`|k%¤5eÖ¬µ†ü¶D Ö2i%þ$´f”²;R@f©µÖÔšF ¿JÐ4QÉ`Í9h0úº5‡Yj.©95g°_ç°æ6U+[3¥¹u]$5‡ýº‚ýºýºá€†4GÖöëöëöëöëöëT‚š3kûuNaÍa2º LeXsد+ kÒ‘¤„5GÖ´îv‚FJs˜Â&0&0&0&0&0Þr^$6—°…” ÅaÄšÛÕSš£Ö$ÒfqP˜S˜[~ûAµë…ÕTÖ/¬âuý­O¿AqRMî­Õç×'¥4{~AÍêÛUc 1¸»_Ü*ÜÓó¼~Q[k_?•×/j}íë—ù=•ù=•÷½¸…¶§_ÔTÛ×/ó{8ó{8ó{$ó{$ó{4ó{Qµ´§_ô‚Ý×/ó{œfö˔먹§_ÔœÜ×/ó{ göËÓ»v1ÜûƒÁ¬ânž`k úm °”-¬ ´ˆ`°¡C‚¦0ÐÓDË®ÞQ{b-gR›>qÝŒ{N%÷lòÕÙ”€³8äé°‡†>hIPo½þ\ê@OÙÁÅôÚð#[ÊÎZÄ?Ï.^–±½eä‹JûUPl¡ ü>úrXL*\½²¾Aô®®n—µ¥ \ÿÆ+'½)Œf;h[ùóE3¼h†ÃiŒ^ɯ¡H$í)SizVŠËI?ìw~éšbk¡õŠ‚Dý€bõSídÆZ+g­§“ºM“7Æž½ÖºÊ[S‰e)^”÷‹ò~y×þ¼ê¡ŽT`ÞT[í«. ²øpæ>ˆKQ ä©[$ ¾CAG‰¢¬ „ñpªƒÀ"6@¿= }`ˆþ€ÒE‰-];Ó©æ^:RjC†ý[Epš‘^Eqê—Ò¼n, Ky^7QæuË›[^¾ÍKbyÙCŒd‹Y¶Ÿñ¬•dyûÆò]XÞ¾±¼4ž—­W¼{ºem7ÏK9á$K”ã×Äînø…¾ ü&œòC²ÄÃ2ÃþXâÓÏ œx¸ûÔvËu¹O•Ý8/؃³Âf"/(?N{ºå}-¦T䱊<ÒиØÝfÍMæ1ÐÉ<œ€Ì S˼0µ"™Ý²Âeqݳ»[^QåÅ·iŒÿÏCAùŽíó(]Íså”F.6TѧËùbú0oÍ Ø3åòõÙ±‡œ“k˜S?Í!öÇ/K—òCJÒ7M–±M[{oãõIhÇÈjÇ„“«á²Ò¿0¿ÈÎNÙé0ñ[ÙYQ LYÞÆá}ë¢eONßœ¹ÆÞZ‚xŸ’L!òÇP|0– o…Ìa‹HÞj½;Ý=ˆ=8OÏ×¼d/kXó.»YóMÕQ-åÍÂDÛ¿Y¦Ó³7¤óºWý —ÉÅ,Žj £;Åq€1 Ð^ÛèÍzÜ¡$m?m¥j:ž>Œ¦Å‡±Í¬R(üP©ÈEK(ÈGDa”‰C‚@ž H üY23†„+0PLˆƒ’œ€%C'ˆ f10(ZŒqàôÊY§ÍŒòXWãÅ¥ÍeFÖ($ÒWffGêŸ Š„ª>>JâÁ”•4äÁð(þª¡ŽAùvšÀÈÏêT ³A•pfJâ¯X@wØŠ¸rÐ ¡ƒÖð„VÙ„¶”C‡Tè×­ö-ß8l=FÊ:Ž6Û¾2ÿ7“›úk­ÿo²Xûp-«Ëƒ”n\ìŽ+‚B’ÓH‘Aá)¿à$ž“ Ë© ZR ¢Y€Š@—tQ¢—`ë&>_.–ƶñÏçÓÉuÏv~¼þZä·»œúÍoëóÐòµØQ'‚~z|v@Æðëg»„ÿø9X~".“Ÿ‹œ$“m$]Ð;^aKWŽb[¦]éc+ÚGÚçf¢¸ ŠHaÜI/é/é¿TúÈ ‡%1ͰðÈþZU¿G’Hb ÈªÊ ýréh8*Èë ‡dóÿmï[›ãĹuÿ •Ï'Ùˆ›DÕ9§ÊqœŒ'qì²™Úï7¹[±‰ið¡!³=¿þ@ÛF‚FÀ-‡N«j.qÌB×uyÖ³„Ð8¿€«Â,ïKS©T«ü€-éýÕUÇìB“æsÛÀî‰Y:OØN¡áŒÀq%ké$ÉKC[Ðèê¿hFüÃ'µÎß̥갶°‚T]ãiüó¬â¼`/óüñ6ó¼ÿäËðí 9M@Ý4ä0‡¯NÝY#ÀÃhÚ&Q×èΦ;mxª6¬Ó Ã.X¾>¤ȇ>#Ìû ªä Á<˰(„?æpŸè¾9³É‘¹ð£ëÕyú˜Ž`ÀHHGBW_ oЪÒZ 6ðgBþ -×Jô%'ÀpV°²§: ™ê,6êë£b•#¾ì9A¸`µ"v4¢¦€Î(z:óòì@g°b0æ¦Ùa®ž$¨:‡ýù í*F+À(ìdRè®ë„}@!‹®N„#l½»Ø›~Z gVpKÇQ*î£ Ì‰f…ýĸέ9Ù09?'ìË3õO޶8uìà åÖätv*Gµ¶ºf\h “:„ÔU{·BÊFëu%Ra7Uª_Wq¼çêN˜]µ3.ò\‰³ „„†aA  ³–= Ë;–…º·ÄÖ{šá s9‚fê ôg“kë˜ÌÜiNDäèDÄ3qôÍ,£Xoî¬u¬ÕÏ¢7÷Í ^#Un´NE< Щþ.õ%–%ݪ¡Ký}$)*Òb8¥Y˜Â¸[·ös_Èœ’ {!·ðe'ÇçWç[ÌÐÏfÓ‹""{v¶ÞÕ¶>6V›øº£Ì ·EÑí”Öîm.gh°^—3ÿh<Ô;"š›“CÛÕYJ’ó6î·wÝ6ÎxãŒßcgÚ.;½Ùí­,dÙææœ´w?wä>ïßßÚß’¦ê½Uì?á÷BgBÉ ³þæ¸wš£Cj^‹iºÜÄ_Žn³hQÄy‘1IÜïãQ;'Œ×Œûùž7“XŒÉ€2±StÆDWö!ºr ñ’}å]´ K£)óû–¿ÑÊ.iÏ…‹XZg>Ì•Î~ò\j-Ä£‘½M+‡æ\ ñh-­crøLŸÉá39|&‡ÏäðÉrøæÁÝ<§*VΜȘÙ• {ªaO5쩆=Õ°§öTÞjØS {ê/`Oõ=žfÿ1£ÉÂúOšL©ÿÓ†QÛr:Bù0,ü«9á~ft³*“ª•Œxi~ØY O‰÷H½o>eiñP1R8|ß|z wƒlÀw¾z[}užºÛøî ^'lj ¯æ³ùø¶³õɾøÉ~û\sž8Sˆÿf0X\÷ ªÂ•íá Äá :†³¢Z!„ ¹D€¬Xœ(Vø?úŽ»5úX},_ÌÿÕÛn¸Õ.Û%’s6É|0%°M¢È: ôUŽ_Þö Ź gFƳI½&­#•e:~þ8𼞿ò &°ú©s·΄¼ ÐäéÍvИ¿0$Ú«œ1ãÏ<æ‹5ê¸:àÅ Ëë †ë oë *HÍÄ™>Oà‹¬¡k#_=MT+d4êÐUîÏ%€[-° +0<åZÐʲw–œ«Œ/õ†Vý4YeÞW˜*P‚ñ™Ý·ƒà8ÐÕ©u³ª:ÂÇoÖëÖñ.:OÂO‰'dzÂ6/p;b’ÀÊôúPµ:·:Påƒáñt 0T–ÞKF@{‹hP=ÓÆRþvÁm¸\[vH…½Î½ Ãös›^WFÏ‹ZÞî3nú#±Ì•8H©‚°ä(Ç$uMLê‚¥iíkâÕ¾&G™t§ƒMwòæ’Kw2)I¿OJ’I22IF&ÉÈ$íʜ՚64§< “Øc{LbÏošØc2uL¦ŽÉÔ1™:&SÇdê(€ˆ€Á.âï|UaÐE >øã®*ôDv³Æè&G8Ìe tæét¡hi ÂÚ§Iβ·G+öT—T¨VתPqzô¡]¢Â&O%ëüÙ`yàហ±6*ø¨uRßßíoD'5o¬ñ¯þ>þÕ}§N¯Â`¯©Â|J²,©[GE~—f›Âë¥N“¥Åí].¯Æ{úéèCW9Þ ¶$ÕÏò^‡$³@:z¹T`^°ÕG”l›ñN‚Æ„'›ßWsoê{Ÿ$,»}Ü*sztÒ®ã<³ûûA5 û˜JˆÝ_»?H¡ÞßZ{ZiÙ± »¿©ükk'묂î+¿áÔŸ ÕZ«z? ZsW ür*ÛÏäš\@“ ¨?p_+Q›ÌAStäwÎÜÛì>“¯gòõ~çzÛ&§ÎäÔ™:ᇕ÷f›,¹ÃÌ’3¡ÐÍ©# ûÒ1ùz¦0Èo”€ç™9“"wH9o&‰Í$±™$6“Äf’ØL›ÈË@ØO§+–äÖÑz.¢6æàÃQÖ¡*°Hà4Ë­Ó±€Î§¥šlçÓR'W×ÓòpwçÓÔ¶Ô¸ë|Úõ$õ$µ- w=-¨v>íBæÒ‰…÷x 2*c(È`…1À ßC — áï‘zd\.£°ä ™@á= ëÀWX>QQ™Ó¾vÛQQxrdà÷<¸ß#£p^Ëý=2Â(¬Ql«ÈÀçTªï‘Q8Cäø>øžÃÂ{ÎyȽG&„¯Qyø½O>§òÀ}Œc+È(¼GAß‘ô{d|…±V8CH ð…{Ž(Üs¡Âý*¬ÑPa† k4t¾Ç…Ÿ½ò|ò…5*-ôÈ`»Ñv!WEHá“z€=BòxŸÊ7Écÿ}BŠVéž‚µÞµïRyS¨ò¦PáMòh~ŸB*B*orTÞ䨼ÉUy“ŠsÉQÙr°@Ÿ‚ÝÚƒ3èRñ˜9 Wz” WHåM o¸ ÏEi«!OEHaž\GåM®ŠÊÖpU¶†«²5Ü@å›T¶†oÐ'DTF(arHA§à¹îô )ì'OEßóT*OE¡òT¶†§²5à@/ º_èMšYç‚€<ørÞ®D,Û{eÒöÙä²Ãðw&óÝd¾›Ìw5v“'ohØMV½¡a7ùý&¿ßä÷›üþC"›Ÿ€¡¦7܆šÞ0 ¦C`0dó†lÞäê:¿»Ií—¥ö»† À0&C6oˆ q€v†JíïŠ×ŸÑ,Ê£“…ì϶Böز݊nž4¸*Ö»`6(ÐbBß&ô­!ô=£Êé:ƒÙ&q¢ÑJôù:¾1 _O¯ç è캣€. 艚ç@{h@ÃLÜÚLm÷…Hj÷%,§Ùã¦4”èüØ2ñDzqiâÉŠ=ýVœKÀiœ†Eɰ(%âô»°(V¬©‡ah2 Mkš C“×¼Öp.xížÁkÆýÀ¸z±»‡Cóñƒ‘ÁÈpWî*Ã]e Ö†»ÊpWî*Ã]e¸«~w±Ës¯âp?®¢…uœ®VQž3&ÀÎÛ0ײ«Ôw¼f©)/è†=|íyË8(Äè¤îÂñ-„S[š£[Zã[˜üxòHâÉ} “û u•ŽoLlA!Ýšúr¨ÉèÜ©kRIßÂä‘ &d0¹dò\HuãÑ-„“ûNíƒ`3¾…É}@“[˜¼³äðžÑ-LÞ›rÐè&ß¼îäóÁ|>ÈaE£[À“[˜|>¸“Ï9Lil rèÒèšÜÂÔõàMÞ›r(Ôø&÷Á›Üor&ïn9Üjt Áä>LÞÝrðÕø&ïÍpr©º½?ùƷ0ù+œ©kRßÂÔSΟ¼»å0´Ñ-öä&žÜ‡Éçƒ?ùîö'ïnòí/‡Éoar&[ÍÁdýA»ßÂÔ3JÏßÂä>L¶‚É~¹`²þLö“O9°pt “½jÁd¯žlûãÉ烼8º…Éw7ž¬™ãÉw·:9¾…É}˜|ûãÉ·?ÆÎä&¯ÉÉ{SÝB8µr(éø¦îM2Ù³G&{öÈdï™ì=^G·àOoaòlN¾yÉd¿=™¬Û“ɺ=™¬™‡“5ópòÞ 'ïÍpòÞ É#9ÙëNöºËÇ£[˜¼»ÃÉñn9hyt xòš$SO˜prL-œSë]š˜Œ_°ÉÛÞ„7ýC¦c9ì`z“=¾¡éM8Ó›˜>©r¸úø&üéM;hb2Ø áéÃ9¤³”"Ó{NïÅä Fì~|“Þ=ðüñM8Ó{áLï…;½Ó1…Îô#Gž0¾ z7½‰é{d²…¦ zML¾ÝÉÖXO²Áø&7½‰ÉëÂu¦÷ÂÞÄôÍîNßìîäx*š†êI41}]LG"Ë“+ML¾GäI€&&Oª7xÑ“Àhbò©åM72½é&7ݤñ¦9Þô#žL┋±;™D|ü{šYgÑmÖ.’p~Ö®à[È©ª¡£fV‰Cö²ºNzÌ©€ôÑL†AÀ¨“lÐÕHÃGö“›^+#<Œ6K#Æ Fž´¯tHûZT# ÑÞí-…JmcdgJ úY凌S?¯rš,i¶Ü®ÔuuÞVB‘eWJ¨‡gª„FwÃÑþ‹9Ú ¹a×Q.ÌŸ ãõŒ8¬5š6 ñòLkäkÖ[vkOyu2ëdš’Q¤K'wë¡p‰j­èµ›€¤}03 JMçj­¹döro#>’Ð]]²¥uœ¥ëµUZ†Ï?±õ‚%¹u–þd«ò‚•x|yÖa&¢ÒL,ÍÂQfb…¹JËÁ¼WÝrÃ9qÝrÃüRÝrÑX‰œb?‰âû†óÓ$rDInÃS·Rëç6§n9WmÞG07IäÇ%P—@ñ}Dq<‡aHÝr¡âûBµ÷àIê–S\g#ºå×çö¢n9Oí|q÷ƒ«¸F°uËaE9Åýà*î‡lCr#8†ºåR”S›?Oq?Œàí‘È)¾/P¬ØOÅõ9‚¿F"§¦‡øŠç熚n9GMÁ%Ó-§¸^F°¾tËjëÅǪrŠß§xžùŠëÓW<Gp¥tË)êŸâ98‚ E"§¶oG0ŸHäß§¨OŠún ¸E»jk‡DNm}Ž`èè–S<±â98‚AC"§ø>Åó+ê‘#x-ºåˆÚ>Á@Ñ)7‚wB"§¶ÎFpLtË)ÚUDQÁ"Ñ-ç©Ýc##$rŠó x~EQÔ'ˆ¢>1‚³A"§ö}¡âº×u¨h÷‡ŠvÿÖ„n9Åu=‚!¡[.P”ÊóNý¦¶¢b0&Ë_"¨84cré»G¤¿KU¿qDª»DÐW ”##RØe‚Š1å "ªo Uߨ诓†.TôŒI9—:ª‚®jWU£mŽê~TƒŒÉ¶–*j(H5‚Tc!c±e‚в«¨NIµ–"OUPq¸Žê]UAÕÝ1"]Z"¨è~Dªq˜1 Ñ2AÕyT ¹Hy– *#Ò›e‚ŠÓá)úåÇ$0ËO€ÉÊ2AÕ7ªªžêFöT72ØSy0;=×,f‹tµ*’hñ$ó-i¦|\kcy§¼ãr¼^-åÃÛÏXÌ=M'A â—{›|Zƒûšª+: ƒ^ÊQ<;È8á]]PR‹`¹ï¶I š–‚­›D¢É‰D 5ä1pAm{9@+ÖñÈq@Ý©Xö\·@°ÿ9¥y͆ï”#¯<õê g – t"û õíƒÖ·ÎD9t~¶Î$Y;€=ޱÎÜhØÈ Xn4òaHc^7> 豺¬µÂZY³=x’îÇ,AÁZw`­;°Ö]Xë®VêF²™ÁÄ{¶Ä@7;‚9ö¡¤ N#ÒYÚ`ÊÖ:‚1<€¼I=¸’ÐMÀ¶‡ Û.l{À¼ü=ØÉã°q‡SåèÉãFVPíAuì„sÁ8GG'£ ”#)Qjê¢W!؉ÂX[W4gqå¬AÏ)à2Êâ5Í[à Ƕlb¡£73¡u7¬—x°{(¯/ÜoøSø3 ››@ø«Â„eô ÂÏ3 (ë › ¯auÝu`Vk¨u>ÁS5…MLR-i…»åiå-ÞïøÖ>¬´F ô²QÏ+èã›8‹‰³xZ'‡ 1¡ ih#´ÚXÇt-¬ì'‹Ó‡ŠÞzO“{!vñá}+lžkÙbWW)Ô¹7w]°Ÿn/®©=u6iuétñèÄÞÏMsÃ@AŠ`Û#œ‘u p¦Tȵª ö>ëÀ@¥v^x¢"£¦ŽÖÅJkþEûRþ*±ŽV,‹4±Ni’VºÙÕã:g+®‘}9:¹j«dØBv¥’ù"ÍGùsøF—¯z_SwL2ŽIÆ1~pE?¸Æô5?øøs¶ì{÷9[ón³§ÇÖëtµÐ{_ŽNÚç­ó„Ü+5Šæyh;o÷õLt4î#k]÷z,Çüy=žEëu3ëš-î’4No­ã´l:­JùÝF+Æ—âÙõñe{)–íUKÏDjʛϺ cêL!‡j„ÊæS`8F‚µ¼­Ã£ÏbÇ©uƒ¯Ä?ºMز£Vê×£®R©ayø¨¡¡ýFâè7$M‡Šd…¹ôaôE0—¾¡2hÓýB›î+±Ï¾’ïhõÉ}Öꌕ®Š‡‡8ªÞô)K‹áò¿úԼ⃹€¢gcÒˆ‘~gÝ»‡PØÈ% ŠÂ øŽ€â¾WßE¢õi}O3ž®+zºi²©UøMu~rü¡m¦>G‚fN™ì™ÜaæV2i@F_ßs}˜aù:çõø‡ÒøŠ-Š,Ê7‡®xG‰uRdåÏÂñ{u|"qa„þb_#Ž0 ̘™MQ‘‰fH [cÁqU{6QXS:e¢ 2”ö6Â;Yo<Ø1Ñãß(z¸¤SQL¿[Gߟx_¾%¥²(¨„GßÚåÙ|Ëö+ƒÜ5By”¥æ\“œc’sLrŽIÎ1É9¿*9ÇdÛ˜l“m³/Ù6AHõÂBÀ«œæl-j†mºU×~â\óp'ìý,6êÖ}-3£ yq -¬¡…ýåT™ +Hâá͆ò#˜-°ôËèuÁ*þPV¬¬“ÿyH³Ÿ{â|ÎÐ)䥂ž9@Ð ô¢ä^ȹ²…œß1륶Ùqš|gK"ä´½€çy‡¦ª™©jfªš™ªf¦ª™©jfªš™ªf¦ª¸ªÁuU³ šåIù‚»èaÓ½`TTÄ.>^´- ûˆëí%ðVk¦ŸF+ ª‘¨F+è5ÜWÂ.‡AÊ¢}}>†6ªÏG–­hRQѧE–?ypo¢¥Hg„ñÙÓòÌ0dN¬Œ)ŠükP$z’µaÀO`Þ ºC³³êg$:ýŒz¡Èzá¼`|nUÆøÙ0¾ŒÒ6¿×å'IÒ>!¦î¶©»=¼ÀÜòЫ1WÑ:g+Z3÷¤Ö¦2|JŸà”/¼«“/GÏ/’5[¯Û«´¨Øj×mÔ“ß8¿«zÞU…Y‘ŸBxËÑÑe~Å Dš´¸´çQ×UkMM¬MæÁÓñK…Í9¾ ‹èû`²ZU5Üsy±5“eW3éáF:©íø`Î' -¨m "rù€UXÆ T“qašŒŒáÕ*Øã¨…9•6–sˆlàã0 ÁZ‡­Ó“è¬àèÃZô`ôQ÷Áø1ÍŠ•x&~lŸ‰¾U]p!FÍ3Ây;·fv¶Ìk÷ëÝÎø`6|aɪÆëŒ.Ù†Ú¬“hòè6c¬I1yõ@³œ-¨ÌdBf‹ýn[ì°öLØÜ3UFÊ ·Ëq±ÎÓÕºâxiXÇm’—ªÊ˜óûo §4Ÿµ1ŸÉ œ°T÷Úa4zà‘-xìvcM’«£ÇÕY* tš*@H4²ìypôN/šá„ââÑC| —  \Ɉl­äã4a›¥[>xF³{&\©g,[¤ë"kqžËq¶Š¿™G7Ð_‡ tz+R-¶´¾nž2ƾ}í³*Ðóõ¡<=CÆjÈX ?¸¡W5ôª†^õ hNí=MOEú’Y´Ÿ BŸÛQ‚ï|‹°\Ðú†ÕúÑ›˜lÏ$Ù×uÖ˜" ÒLXüVgúµN`«ÎÔn Y‰à@2mÖ K27´…†¶ÐÐÚBC[hh ç 8‡¹d¡q^½pv[k‘`XX1pk*V˜Š¦b…©Xa*V̼b…k \˜¦ÀÅïXàµ]ž¤ÒÄbXGÉmSë/–UÈÒ'±³vÚÊ·¯GœY§§§m¼†ýœ‡e60j‹<šøêÔˆ)0ªIôÅûB$°D9„V„Èn›ÖD'Ï(ÔªëZ•R¨¦T½´&–Ï ŒY}­äæ*/©ò.JìåÂzJ¦ý‡&KÚ¸»ÎN/·3Œ]a3]]$i0ülN„I³9GµžŒk<µú(Á^•@§ßcNÎͲ^+xîííçnhKÎÝã»(^f¬üÓÇ"YŠíéñÉGI"ÍK–ômìmu™«àùnBJ‰Ø…ãë£Ûeùžry<‡ï¤’‘í)åPîÊ”–@´Ü Àeù]ésjßyä%Öq––n\zÇ—çíq@Ïùl=,báSñØáaàƒ÷”¨R'*¨¥…3±vµr·h¥+Ô‡ÖE×á…#B¶ëëh9ã/FO¦ˆI¥Yz›Ñ•x~¸Ø.å„6 ý^UÄã´íFk–ÜÒÛMF½u~³fÙO–Utbé‚òÍç;®^¿"´ðštMXG7ìø®—÷øiñeå“eñäF¦ñÿ²®Q9V•gùm´¶ã"΋ŒÆ–X™K»“«ã¶Þ‚‚§yóš\W>„ ÄäšA“#8ÃA“õg¢R&ëï5ˆðMÖŸÉã3y|&Ïäñ™<>“™g2óLfžÉÌ3™y&3ÏdæÍ+3oN¹v³¢`ÝãL>(c«sx¤È&OÐä š®Â'H-j…ƒhaèÀ?`öÙ-jüB!X¶P2úÿÞ~.þ¡Ñ ?–´ Àéçó³6„¯\/^EP‰tAøfMÚS°*£ü2ŸÒ¯e ð@c¡`±_N­Äà3ry+žã³¢…}©„ŽLû8‹â(§Ù#g\ü”¥ÅC¥‡œ&ˈn,¨ z¿) ^1gçŸN·`é®e“ŠLh#AÖyÇúNH@j®÷ÉøåàÒåÀk=äw)ö†|Y¬ªñw9Û,K¬+zG3ûìôë·Ë«6¼ÜѯqÌÇüÞ[C#”ן‹V„Çͦ 0šùÝÅš)š¡W·ªwwüÑ.Mz9ÚËsüÒ„Œ—ùéíû¼ÊC½5|4º€þMO+§éd‡GÁtó†jŘéCiÅSÍ!GÓ„À°u}/Œ=è‘-­iórЧßk£n]ú×ôGÔeÇ]wPÂW°P[²/02ÔX¤ÔMj,átà‚-Dd;25¢öúÄ'V¶Ò¬t~vúi&YÄ:ók÷Ô¤ÔiÈÍ(¢;Ÿª?¾;“:>°ÜF"7ûÆŸJœJ_¢ò[§Ò—íÂ5pCt¤h̦Բêäë…SŽ_ZŒ›åüû÷¨ªø}ãý#º½³ŽÓÕêi•+nS—}/nkð¨üq¼U×}.ת×JÔé =n Pæ!ÔU»§(¬ñìg(š•®1Ïû3ñ Í(L­3/”ÙÌɃé_Z³¾€îhòF¨5ç ó':Ã÷zÁì@túëàÇGëaÉTü‹ô¡ˆŸžn—ÆþxqÔVµeã Ìûò’â".ʦ«âŠ?™õ=Äéã†[m«åÅåɇ-v>¥ZÐóѽtFZöµJòað5íi•d`~>µ‰¹Ëó,e<þh÷=éa›ælñt´oŸ°çÏÛ–´C,{¢p´Íƒ•Ñœõæ¬ß«³^'æÁÜ ¿êfëhcõ«u=\²8bß7Hä¿Óì~mݲdñ¸ñ¼^и¼¢„Õ>ØÊõ_yj¿2šY't‹·Éåß[–érÊI5âPaÛZ+%!̱#x9 ©ƒ`+Ô‘‚+^’‰[ ÇWé¢ÅÃÝXu§Wdª×k :H‡¿Îг®Š–ýŒ6!/ñ÷õ2»z¹ÿ„Ó×<¶=ˆxEìõa$aƒN ÙGÀ¬Šë¤Ð"z$¹2ë©ü±‚xEù£¸ë¿µ÷ü3ª âÜÀ½ •ù÷ Ha9L3ð5’ЈbA'ðŒÂBó¡ …Á–a$:)µ†³ÀäbsJ ¡–ƒ‘p{T×E©­^¤åW÷GCa¼ø¶M€l ì5ÔÅÀ1ub~“:1c4ÈŸ©êÌŒ*Ö€*'<Œj8¶©3Í )V¦ÒŽ©´£¡Ò¨f„©ËcêòŒ{š˜*>¦ŠÏo\ÅÇ35¶žÆ‡P!È!¦ž©'dê ™zB²§A·«©>dªÍ¢úМŠá9Õ6‚ $´’h­œd -™BK¦Ð’)´d -™BK¦ÐÒ/+´„L]&S—©ÔõjBéŠ#Ú:úžE šˆxhë=Mî9Êäï£ïÛ¼sžUÕ`ªŠÌÄq6Ÿ’³ñ÷SŠœÙ$ÛÀR\€¾¤=MCÑ™XK%˜tŽY§s„sI¹ÐIؾ¯© ÆC9ÕC¹·>GãE|M/¢V¿ VOÌwçhôô ¨ʦêè„Ý#­°{ 0þ€Ü”ûŒçÖ ÐžâÚ@¨wrÖë3= \± ïÌ‹=·åÀMÓ ‚W$‹(]¶ÇmÌ~æ#mB9}¯ŸW<Ý[ï»ÈÒÛŒ®Ä÷µ‹ò8ÏèâÁÞç·Ð…0çw²å¿ÿ8ï(/Zñ<{Á„š†;ÏpçíU}é½eÃ3üv†ßÎðÛ~;Ãogøí ¿á·3QÃogøí ¿á·3 5†ßî7ç·3Œu†±NKp˜Á³·|x6,òˆlögØö ÛžaÛ3l{†mϰí¶=ög@43L𬬬&å4ÉY³E^TU+2µ,”ATN/η‰÷žj‘ã×èxÑb-¦¤©iÐ2-cÐ2»EËü‹A´DË -‡€QÑJϹ¯Èù`=ö½1<†AXü>„aP×0Ó¤ý}¦óœSYsXXkœ×C&Vjb¥³Š•¢SÍ4ÑÌ]E3ËÛÉkF3ÏXÎÒ,ÓÛhAcYól+Љž)`±É´7qI“io2íç;4Ñ@ß3ÙðjÑ@“ßn¢&¿Ýä·›üv“ßnòÛM~»‰¾t~»‰Õv^ÄÙ5±ÚɱZ˜ÇÚu±Öô9±½;sb{7‰Ù&1û³M¦µA˜Lk“im° ›ð Ø×n•§½N‹,Z¯d „ë´J°Ë®ÊàfaÚ <ÃæJ8œÁ`@~‰9ŽM^ëkƽ‘l`IbßÄaMÖÄa*‹çs4qASîøwÎWÔÉñ ‹™ ÄYG‡´FX 1“š÷;æÚçúnœëÆ[nüÙ`¶©x»'.äªûMrF—Lê@ζÒÚ|Ëö¬ò^8Œuº€5&x™”­×NÙò5&a™D©CM}"‡Bs/ëtëtêêt¥[›»sF$t:24&MhM'0 ‡š 0#Èÿž®ÍhoJý:…šfà<>7‘=+´ñ¤רn 1™“¯Í];/_§fç¥Öø×ÿÐäö–eÖqºZEyÎ÷Zþçx&®IØ24ŽÌÉxS®Éи_—gi?݇0wÌ€ê3Lõ¯¯µŽÓxU=H#~Äõ_NâÏQ­hòƒfé+N“Û(/–åß—ëÔŠË6ž~zëV Ñí]þÞø¤ÜMÏ=‹ÓÍÙrû´²ôg”,Øó f»uÿ^º#ë›W‡¸Ži~w_þî‚ÑûFçœðÛè^ùï¡vo«Ñjö°Ôø_tþ= êÑcID]Ãï<±g¶0nˆGÝ:{U©³[½rÆ÷*|éÕŸì_–-X£_(lvÌsÞ sZªõÏ»ª«eß­¿7ÍèMs*ìæTx¨zOÝ.~9“:Û%|ovO£u«Ó¤Ùx€ßùBãõhu®´Æ“ gáðxõ:¼¢»Ï¤÷÷Í=‚Z“]vOS;´uv¯^„i–³ï?hUµ1ê ;è ÄöK¯i–uÍ.nÏ.ï"¾ÎÁÃ5KìUGù¯šÛÕ"9j]y¸ÞÉŸh¼¼KÙÃCtÛèiô­¹å¼½«iRoå?ÓuÙm¯Kµ»Ñ¶_í1iëö‹«³u\w<®Ôú,’e³ãÕ0Ê»þâÖëjœ[¦ì¾ˆ[Çnsºlq'"‚ƒžvë»ð*IÙËóæR ;來ëi¼ˆî­Ï¥©S”÷rk¡áF¿Ý7޽þû¢¢Äj/2b½.BÛ{w‘Þ”‹¡9Uvs®-£ÌmežÝwÜ„âÔžEùânëD NSíh.L§&ëlÞšÿ#M—­®;¨=ö ·çô¨\›ûƒfå‚ïœ[·u‹=wliϱ͵±ã¸œÖMÖÖ‡tÅZcã¾koÚ†Áéø=oàºyAK½¿xè^žMÕÁ}AÏ Ä=JÉm÷c·FÇn,ä¸=Í‹3{Yþ.ª\`ÍÉm®û Ñ¸:= öV’”@wïÛÊEã¬ïGÜ·—éͺ½gË´¹æý†sÆ }¯§uñ0>zŒW[ƒüæ¸û £Ë­Ã"]­»õ´Gy\^³ìå­âæ-(è5u*jgÛ‚ãa£‘u´M¤m{ýÒáM«y˜‡ô9l{õ‡e?é2µ–̺.mEK CY=ß'ྠwFtÐßîàqZ9sÛ;º1ùŽ-î ·gz¸?ñ]ÑŸ´eÉ—g´­MD}÷z—*f‚¶¾íõÁb›û$¯è isK•jžôø'Î AðÎa4ºsõž¼.nîhû†kœ°H<ƒž<¨Wä‡ì†ÅÖQ‘±¦ ´ ?¿á.íQwËÖ}î­»£M…«1ÍŽxㄨ¯In®­"ës±^Gmï®/[š®‡z†s/V5ùVicfÍeïxï½Fâyj2 ÛŒº?ƒ³ùìÓÕmë"‘¥µÙ³I=ù—´Ô 躴ÛK^ö½^àôµ\OüGÚòo7ú*ªïö@¨ÂOµ6BFŸ½„G,+Z+œ4ãRk¸.˜uöòĶg·üïˆ4C„}Sîª-u:šÑ¶;¯#Ûˆå½zl•®±e`ŽBãŠ8åÅô¿‹V7iFÿM[k)ðo‘¨é™;Ìÿh‘Z šålË•é¶VÜãË-Dê¥qÇtõÐ<—Þ[=ox¿ïü õÒøeëQùï"m¿ ‰Oj„5JÕ g+ ÚoþÎúœ®Q±þ· =ñZzpÃÝå8}‡vèŠ/xŸÞ–Ͷoo]1lÖAï%+ϸ\lº^ÏŸ¢ÊÏe}Ø{Vü(Q—ÝìU`Üíd½V 2níFzꞤ§µéw”ÓE¥ßË>©ØXZE‹<Í":0½®×»ªþ3 ÒzÓIvkÅöi ½¾¡çÑL.}Âeq¯,?ŠË‘XR‹ÅoË?U~…'i§Oš»£>²uuˆ?/L·W¨v|‰néÖª7½AuÚ¸wÁt …ý«¬ß'ªÏ¾ÞµÉƒ˜Õ$^²›ˆ&´±e£Ê£“G­ÄZÃê+Žª?¦ÛgQ6NŠß‰ô6Ú>®PŸ07[?”ÃXl@½cļÖ¹,¬uDºüùLãÒêÏêi(ùám¶·EmˆÛ"ZÇÕÑÏßËɯi–ßYÇ´T8×Ï’[Osãð„®ó¡‡=nþfÑM©/½|©u¤m!Á=ýÖ BdB>Ó–zZ=àA0Ù–à7R´,'™6q^\SR|°hQ¹ž'I8ȱœÕ‚ïH駸ê,²¾Ð䞎ÔÉm9¡(~n< Ï}ó¤õnü‹&Í ®/âÚÞ’âGøß¥Þ±¦«”¯ïš2µCŒŒåâ^Ñ5×—2ØRrA³ºLk1Ï•Ž97n>¤«(‰u9Ü~[HÐXRn^éƒÂÁ%¹õ¥XD|†t]s»åIî¯j«&üJ Ò¥*øÕË~ÝÒõ=­Ï@Ÿlb±½gƒ·ó&<{@5éB*BŽŠ«"ä©ÕºÃÓ¸K¦@D»eQkñP—ÎásžZ×éŠYÕYÙƒè¡V#Â@¶G=^åŠ=nà@Œ_µÄ–Šq–Æ9W K;>ÊÔ û?,«_:Ò]ãñ ýSšÇ›øË›RQû KÇWk+ÈÀ P·@aÜ…q Æ-PX£ÂX c­™ÑP©€dæ+Œ5Vk¢°®‰ÂX…±& ãFÖ5Qk¢p^‡ ë:T˜Ÿ ß5 0ªû{-SøåèŽz‘à‰¥š>Ï'¹*V4ϨôAŸç¹‰6ª)V:d8¡M¬3úÈ-SWj™ú<¦yõ“Æ7¥ÝQ …¶çJÅê­`Voÿ¢·)7Íj^’9Á_Ü•CU÷^¿Sµ3ã±æè›Ÿ»¬/hFWEå_änk[!Ó²¶XûßËc²iÎâäÑzz¤žNTÝkÐwã1Z¡/øÌ«Éá¾ ™sÏçæð9[³¸Œ<©¼t,¿ÍAؤƱÏã+ÖXâB®ö¶Ç1ž,ù`pž•/iܘæšäp[ˆ{Êß§YRò+îJ$R!î)nxyÕöåpØ[Ë)ôQÿmß-ã+È 2!\ÆA 2Ž‚Œ« £0nV! 2 cíÚ 2hÌñÅÁÒbÈCénâ~¢?¢õM¢4æÁ†…ŽTÐÅ’¿.¿Œ4#Ÿ£<ça©Ùç.¥¯ìgTK„ÒË–;9®³(‰–<í‘—ÕÑ!ŃäéMyð`·ô‹HݳÓ5½a|ì|Ï•°<sºŽ™•~/udÄ!ÚÂó@°|rC4N‹üÎúGë\ú0g!`É [±LÙ ¸ ôqík7à^ù?h…ò•=‡¤õ?=yÂàIÝ®wƒÿYHµÆÀáÈ4N“µ¼=‡;^7ì /C/»®~]_GåM/}L ıô©úk.ì)~_Ý?JßÈ/Ý«œ~ÿ.~Ïž¦‰ü)®Ö&·1[s#_*$ x2©'9à qOË÷²ìG¼\§rŸ/Ò™äYkgå!Ô0xZ(Î䋃y+œü9žäõ¥H–òÇ8‡A´¾KÊ_ÜKù¶ÍVÂ9ì»ï¤À²Õ—Y¥ÆvßT¿v¥²~@“%ÍýÄÒì–‡*åS"Š…8bþÎúƒÅŒμ,ä Èõ‚%ë§ZÏ ©P(,뢞¶˜ÛLGIm°êCaNŒÀù5+·‡ÚTŒƒ2*]aÉ’EDËÝ'{Þiá&ŸQ/r)Äœ«ñq%€¤|™ÉyFù—òz/ï·gIÙã~ó ÖûŒ.¤sB´ˆâGÞ/i*˜‹Gq´(–‘ôA!âGÒ3ó“ñKôPÁœdÏÕgã_E¼ I*}ˆ¡Äò‹d К÷öÇûˆ—.™`€6º[&„Ë ™¶¬N)È 9¶eá2\ŸÝ2ž‚ŒÂ÷„ } }™,Ú®‚ | BëÐQè›3æðnÃ`²9¹Øß,ZÜU|Œ}]s·¼¿6–ÿ‚Ê $ŽtËxpWá=®Â{<…÷x ï )ï–!p¬0§Da ˆÂ…¾… ãÂÇØ¶‚Œ£ ì(ââ7’N<ä ¾ê%Í~ÐÁH"ÀoäB Î qQštËu¯µøÛ|Éd²×-ƒÇiz#Ò|1Ĉ„Úç÷ ðPhd Û *¼«@WÉ$xh/Þ¸}¿ï«ýˆö06êê l½Â?0üT,þmxÑP®B§ öw…ñôÑÒ!X4CÞ¼ÊÜ{ 2ä•`¾c"/>qjŠÁjds¯ëßÀAË©0ñ& HÜœ—ïê1kÜ*%š§Þ¤áçtàß2¿Ùъ汃ÏQNï«ÂÛ¯\­¦g±Œp„÷ä ÜáA <Ñ)($¥þIË¿[³·Ÿ£ò#Þ5ïp@Íÿ”­Þ¥;ú†@ð˜T5q9£Ì}:ªóxx÷¢÷ÔÁ\f@›î–QyO–§g¢¯ ˆíË;õßqŽ¿mM ¥¥tÊô¿g{ÛX¬@Af­Ý-ƒá2DA&„3P£®[Þ7…@dÿ%a“.IÜp–sþä¿«:Ï»q/o¨»$0gÙ¨ÜB‘À*d¶£ qÄÐ!w÷¢Yš$»úWøÂU¿Ë»tÔ+F¨pXd‘p6à³h½®þyx¯ÆÞˆ‰Ms ôåkÒ"…Ç# ܰ]ÎŒv”ÝÓdM×»{‘RÂ*þýŒ.G(JcH,Út®í6ê6ØlG3„…s¬* "|OQå¢Y—›ÚÍWÑêFÜR­Ñ¿¤Kþ]W´Ð;ÚIDL= „™*7ë"E>öãF½.>Îã ÿ?ŠŠñ·ojuµñžÆ]«]é=• •Eœâì3ÍúqFDjC%;e°‚L— Ç;{ØI¸×ö}\0kŸl‡´\ã<ª¶;œÛ%ð ?e¹)~z5J²]~{}Iå74£o¦¤„üÝ}‚+ðUÞe‹ß~¢ë¡œÛÝÍà8.â _‚Û_òá»a¿àSBxwß/¯¦74ŸôÙÓ;ÃéS£›4Ó×™:¬ÀÏýžfé›5ËSpT…övÂ&Cx|áovYW‹»jG;j eµ’Q*µãÛ#𠦕]q7^Bè=KŠÊǪÀiÛ«„Ç”£>‘ˆuè-…÷fˆ¯©[(TÂiDÌÜö¼ÓJ#îŒÞ´2½9[ÉMÙ·èÍ„©}  âD¨á¹*ÞL!eè=²Fx¢BÑM$d*|cqÌÞ¼:ÇÄäÏAnçç%Å?ÑjÜé6f:Q7©À—⾸U ù$;\iޏÒgYñ³øÕ=kP Y±éj F·Cn’O2 H£ì¨¡9‹°àÏ)îñ¹ÆË|¦ß‹¡cWœ€OãœJz.ßWåå2H컳U>ÜÝá‡×ó}Mû³ ³]À( ¯îÂ*B¡‚ëìˆ2äÆeñ=ú1°M»èHà«!g úø©@aø*¦J¼—;ûfni}‰VéCªá³ÃŽÙF*B;ûlnžg4ù1ä¬ëøêPé«we“„‚±I=U;é~%„wôÍgqÖìûjçE¸Rð¾XGÕ¦TºÈp×D¸›`Š]¯ï ú@_˰g\†¤c” Q¨5á4Ó­«j™.ÙÃKZ+ eÏtÊ À¼s°J§Ì€tC”ÕqÝ`ˆ×¦Kf(S©Sƒe°d|¸Ìl§L P.×hÇZå^ß3¶Œò ï‘0š4Ö¬->i-À¾²¬™¡T¬.)È €º^/îèrÍØ‹*µ¶n)ײtY²äEÆ÷½~Ã/ÄÛÙ[~=*Õk:ÞçóD¸óY–ZGUçWo )V=jvžr…oó]ò®wuíŽø÷Ü&ié%U½úÅEÆÖõÜ9¤óÛJ)Òºº/òRs~s»g.´yÎØù]-k¡sK ÓçÂ|£Pö"\g”ÅåÓ\y2^kòGÊÖ\Ä­SÇÛasa|¡Ëô¶Ñçi$‘Ì£ï5º¢«ªW&ÔÔŽÖksÕV¶Ö‚ö~‹’‘äÑæJ>º¡´ûIÜüꫜ=”GG$YV¸ùµWÍ%6¿ð²X¦ñC}K“i—T[Áм“æ°Å7,˹.îuëˆ4‡øsTévO†­…-ò4‹êe[e4†x»º…T ÿ¾J’U„yX,‹ò¸­OéݯŸuQúRǶ[Sý³¨_YE«t¼²ù×Åê¦^0¾ä€pìæUù…¥i¼|{zÚý8rÛG×--O®é¸ÞÐÊìÎúP™zO%gf ª‡eΈ(Ÿæ–rsYÜq<î|ÀåÛÒ¡ò¬¿X§$ÝÈ|nnêGºŽt¼Çm*Egÿ°¬ÞÈ^èØo^iY w´y·¼¯¸?Yo”ßµãuë5OįåŒñSÃ&§Fw"àðK›gâñ]ÿÓ}å:^s_Ó›4£oß—ª­à¼RêåÅê´Ä?³$/÷ Á:!«-ÇñÜ奻 +ZÜRKê|rýæ¨ü%IôÀÖ´(¿R"¶L‘»” ™;.§QþøîûËw== š×ãEú‹ãîGqóþ>ctÉÈ•¬ž–»ãù‹oëñjhello:foo)); (:~ Variable. :) declare variable $hello:eager := xs:QName(string(hello:foo)); (:~ Function marked as lazy. :) declare %basex:lazy variable $hello:func := function() { xs:QName(string(hello:foo)) }; (:~ Function returning a QName. :) declare function hello:inlined() { xs:QName(string(hello:foo)) }; (:~ Function returning a simple string. :) declare %public function hello:world() as xs:string { "hello world" }; basex-7.7.2/basex-core/src/test/resources/input.csv000066400000000000000000000004471222453003200223130ustar00rootroot00000000000000Name,First Name,Address,City,Country,Phone,Props,Email Clooney,George,AnyStreet 1,,USA,+01/23451/89876,,George.Clooney@emergency.room Graham,Heather,,, Picard,Jean-Luc,Room next to the bridge of the USS Enterprise,,,,"He's the Captain of the"" USS Enterprise !!!",Jean-Luc.Picard@enterprise.ussbasex-7.7.2/basex-core/src/test/resources/input.xml000066400000000000000000000006371222453003200223210ustar00rootroot00000000000000 XML

    Databases & XML

    Assignments
    • Exercise 1
    • Exercise 2
    basex-7.7.2/basex-core/src/test/resources/input.xq000066400000000000000000000000611222453003200221400ustar00rootroot00000000000000doc('src/test/resources/input.xml')//title/text()basex-7.7.2/basex-core/src/test/resources/recmod/000077500000000000000000000000001222453003200217035ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/resources/recmod/a.xqm000066400000000000000000000002161222453003200226510ustar00rootroot00000000000000module namespace a = 'a'; import module namespace b = 'b' at 'b.xqm'; declare variable $a:foo := 23; declare function a:bar() { $b:bar * 2 }; basex-7.7.2/basex-core/src/test/resources/recmod/b.xqm000066400000000000000000000001551222453003200226540ustar00rootroot00000000000000module namespace b = 'b'; import module namespace a = 'a' at 'a.xqm'; declare variable $b:bar := $a:foo - 2; basex-7.7.2/basex-core/src/test/resources/repo/000077500000000000000000000000001222453003200213775ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/resources/repo/pkg1/000077500000000000000000000000001222453003200222415ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/resources/repo/pkg1/expath-pkg.xml000066400000000000000000000006411222453003200250340ustar00rootroot00000000000000 Test package 1 ns1 pkg1mod1.xql ns2 pkg1mod2.xql basex-7.7.2/basex-core/src/test/resources/repo/pkg1/pkg1/000077500000000000000000000000001222453003200231035ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/resources/repo/pkg1/pkg1/pkg1mod1.xql000066400000000000000000000001261222453003200252530ustar00rootroot00000000000000module namespace ns1="ns1"; declare function ns1:test() as xs:string { "pkg1mod1" };basex-7.7.2/basex-core/src/test/resources/repo/pkg1/pkg1/pkg1mod2.xql000066400000000000000000000001701222453003200252530ustar00rootroot00000000000000module namespace ns2="ns2"; import module namespace ns3="ns3"; declare function ns2:test() as xs:string { ns3:test() };basex-7.7.2/basex-core/src/test/resources/repo/pkg2/000077500000000000000000000000001222453003200222425ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/resources/repo/pkg2/expath-pkg.xml000066400000000000000000000005611222453003200250360ustar00rootroot00000000000000 Test package 2 ns1 pkg2mod1.xql ns3 pkg2mod2.xql basex-7.7.2/basex-core/src/test/resources/repo/pkg2/pkg2/000077500000000000000000000000001222453003200231055ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/resources/repo/pkg2/pkg2/pkg2mod1.xql000066400000000000000000000001271222453003200252570ustar00rootroot00000000000000module namespace ns1="ns1"; declare function ns1:test2() as xs:string { "pkg2mod1" };basex-7.7.2/basex-core/src/test/resources/repo/pkg2/pkg2/pkg2mod2.xql000066400000000000000000000001261222453003200252570ustar00rootroot00000000000000module namespace ns3="ns3"; declare function ns3:test() as xs:string { "pkg2mod2" };basex-7.7.2/basex-core/src/test/resources/repo/pkg3.xar000066400000000000000000000015571222453003200227670ustar00rootroot00000000000000PK DcÆ>pkg3/UT ?«ìMAûßMux èdPK øsÆ> pkg3/mod/UT ³ÈìMïªìMux èdPKÀcÆ>V·QUpkg3/mod/pkg3mod1.xqlUT (¬ìMJæßMux èd ‹1 À çúŠàÔÎnJ4©F1 …Ò¿×íŽãJ 30’†~‘95‹ÑN©@>c'¸&û‘*¯f[O<öPà+ci„WmzÍ7F2Z}îPK eÆ>N_î¦expath-pkg.xmlUT ™®ìM]ãßMux èdMKƒ †×õ :î:È)z´©:Ê£@ÕÞ¾Áj+†ÿñ%§ÚQu˜¯z2¡f}Œî €«S±çÖw`¸±cY~œà°­YÉ‹“f”Æ_yYN•Š·VŸ2ªi<Î5KÖIžÑ‡Á"„”ÉqˆÊ†˜ûU¾êXŸ/ôo¹SD(‰Ò þŸÙ…ÜÇ@5mïéÝ%_Ÿ“€MÞhpàìãäPK DcÆ>íApkg3/UT?«ìMux èdPK øsÆ> íA?pkg3/mod/UT³ÈìMux èdPKÀcÆ>V·QU¤‚pkg3/mod/pkg3mod1.xqlUT(¬ìMux èdPK eÆ>N_"expath-pkg.xmlUT™®ìMux èdPKIbasex-7.7.2/basex-core/src/test/resources/repo/pkg4.xar000066400000000000000000000016251222453003200227640ustar00rootroot00000000000000PK §cÆ>pkg4/UT ù«ìMó«ìMux èdPK æcÆ> pkg4/mod/UT o¬ìMù«ìMux èdPKÇcÆ>bsË\zpkg4/mod/pkg4mod1.xqlUT 5¬ìM¬ìMux èdËÍO)ÍIUÈKÌM-.HL²ŠMl•€„’5WfnA~Q‰B.¦cc ’”ÔäœÄ¢T…´Ò¼ä’Ìü™×ï“ÁYexpath-pkg.xmlUT ¨«ìM¨«ìMux èdUÍ‚ …÷=‡;F³6à)zÔÉ<)¢?oŸ¨”Ín.w¾{áFå/U"™šZ[AŸÎ™NF¹'kû´ó*鉄±sA4­üãÈ–“ ËÛæàQYÖã ¨:Èö¶jµ ç…(½Î]åj”w´Ž„z)‡M] Ôê|ý‡§>< p+¢„\I³8‚ 1uoìg¹÷àþva¡ÔöÂá·ãZÂ}õ¦-6u5‡UZahö>òPK §cÆ>íApkg4/UTù«ìMux èdPK æcÆ> íA?pkg4/mod/UTo¬ìMux èdPKÇcÆ>bsË\z¤‚pkg4/mod/pkg4mod1.xqlUT5¬ìMux èdPKzcÆ>™×ï“ÁY¤-expath-pkg.xmlUT¨«ìMux èdPKI6basex-7.7.2/basex-core/src/test/resources/repo/testJar.xar000066400000000000000000000037751222453003200235430ustar00rootroot00000000000000PK x®Í>jar/UT SjöMÿ§óMux èdPKx®Í>ðñ]M»jar/wrapper.xqUT SjöMSjöMux èdUŒA ƒ0E׿ƒ¸P(=@Ä;ô Cœ–„8†É¤Jï^C]ÔÝÿ¼Ç[Ö¹DÆ…rBG¦6 ´£13¹ˆòÏReO´JY¯7ñ¬t2ï…ú•!ØTißeÀ ¯l÷åù1œ¼MI¡K¿Ø ’eÚúÁ4BZ„÷¤ç5:˜ÏøPKì­Í>N›8¡÷ jar/test.jarUT LiöMLiöMux èd ðffaàÂ7kÏÚ1 N_×G]O?7ý§˜¼Ù9@RLP%85‹1\³¯£Ÿ§›kpˆž¯Ûgß3§}¼uõ.òzëj;s~sÁãO‹ô¼|u<}/–®báœñRòˆôLÍ –éÏ4¤©‰?›¾ä™˜vÅ3Õ×™ŸŠ>1‚¢Þ=÷°;Ðw¨C¸Àß 9ƒâV .I-.ÑG¸µyª[…àJŠ2óJR‹ô’s‹‹sn{v°¼zÙÅk·®ý^½…‹­vm‡Â‘!5>‚¶oY¹$ú¯níÆØ>Ê‘ ØòÛ`ºqú¹3çž_¿ÍÞ üf‡Ç>¡dјT£P¥âDA­¿/ ¹Øoqë=Þç!rÐrÚÊu–Í7_ ­Ù|q¤‹í¼í|©Zzj‡#R®Ú´dYx-r4?µä÷… ïE>|õçs„ß°Ë •Í~xþM_Ò†ëyÛcÖxí<æ«yÈ™uuÕT©…vþ‹WKòÊgG<ÏôßÕ}î¢Ú…ˆ|ûåJÝ&ë>ª?ª¿Íþ‚‹L“?ó_ž¾*9±ç˜¾¹wovÒCUýꜹ2&I¯Ïs¼™~ãsa€Þ,ÿ™‰Ǭµ¶ÿ‰¬ÿ·øá©^Éõ.\d3û|1Ú²þ·4(6~œŸ¿D›‘á #r²^„Ô‚° /ÊD i_ïÃ"s¦/ñœ½LþZØ_Î\Öæ8Q}'Gþ©~À>"bý{»ˆÈÁfûòªû|»¸ªnÜùýÙYéo?¿•=ÀÉgѲMl)_þ”+N•S?Mh© Ò9´ºDÓÈ·`ªÆuËfÇ/—çd«vÕ,?Ÿ¢øÕ2ÑäßíyGXž'•j×ÜÈ`ÿ ðæ£J^ãÞ Þ/\7 Lý;dÅk•³­‘[NM²ñ›bR]òe®çÜá)÷üc²sx”yŽOþ¯ôëóÕ¨Ô$µ^ßÝólŒ¬dŠyfïoN˜©Ó£sLnVÍöggDÿùu9Ü®]ÿ…Mè,¹ûw³6q¶OÕýñÂøöê«72¬¸ ·»ÈƒÇðVU›(»Ôåô¹ýo﬒1sÔ½qKà¶ÔÕâ ÐeÚüp‹<0d÷€C—‘I„5ÛÁ2$(Ï¢”Œ®9 ‰ h³Å‘A&p1àÎjp ‘ñ–‚²rJBÑòkFDÖJOÈa!ˆ¢?„ Kê ðfeƒ¸Ž•A¨e3ˆPKp?7É _v basex.xml-É €0 ÿ®"¢€øBj V8D±Q(Ÿó·3óX—¨_(°9׸ISª©F,¥ØŽ„O»ç€ë>‘Ó*`Œq3e¯,jïáð¡W÷‘D¾ÐæiS¾ãçþ_.PK¦œË>¼?]޲/expath-pkg.xmlUT ǧóMǧóMux èdUM F÷œ‚á¤nà ½mc‹?4T¼½•ÖQÙå}™GC¾?ùe¹œc²jÊ™öXÈçIÏíAjar/UTSjöMux èdPKx®Í>ðñ]M»¤>jar/wrapper.xqUTSjöMux èdPKì­Í>N›8¡÷ ¤jar/test.jarUTLiöMux èdPKp?7É _v  ìbasex.xmlPK¦œË>¼?]޲/¤rexpath-pkg.xmlUTǧóMux èdPK{lbasex-7.7.2/basex-core/src/test/resources/test.xml000066400000000000000000000006721222453003200221400ustar00rootroot00000000000000 text in child 3 3.4 3 3 basex-7.7.2/basex-core/src/test/resources/validate.dtd000066400000000000000000000000311222453003200227120ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/resources/validate.rng000066400000000000000000000001311222453003200227260ustar00rootroot00000000000000 basex-7.7.2/basex-core/src/test/resources/validate.xml000066400000000000000000000000071222453003200227420ustar00rootroot00000000000000basex-7.7.2/basex-core/src/test/resources/validate.xsd000066400000000000000000000001371222453003200227440ustar00rootroot00000000000000 basex-7.7.2/basex-core/src/test/resources/week.zip000066400000000000000000000024061222453003200221130ustar00rootroot00000000000000PK UK=week/PK UK= week/monday/PK¨lF= )S,aweek/monday/monday.xml³)ÊÏ/±ãå²ÉÍÏKI¬±JR+Jì@„>˜ ÒG’-M-Æ£IZl4PK„lF=åç¸U%7week/monday/monday2.xml³)ÊÏ/±ãå²ÉÍÏKI¬±JR+Jì@„>˜ ÒGÈêƒ5PK“lF=åç¸U%7week/monday/monday3.xml³)ÊÏ/±ãå²ÉÍÏKI¬±JR+Jì@„>˜ ÒGÈêƒ5PK UK= week/tuesday/PKklF=(Zo%9week/tuesday/tuesday.xml³)ÊÏ/±ãå²))M-NI¬3S+Jì@„>˜ ÒG’ÖkPKplF=w«y¯,aweek/tuesday/tuesday1.xml³)ÊÏ/±ãå²))M-NI¬3S+Jì@„>˜ ÒG’ÎÍÏã!«6PKflF=(Zo%9week/tuesday/tuesday2.xml³)ÊÏ/±ãå²))M-NI¬3S+Jì@„>˜ ÒG’ÖkPK UK=week/PK UK= #week/monday/PK¨lF= )S,a Mweek/monday/monday.xmlPK„lF=åç¸U%7 ­week/monday/monday2.xmlPK“lF=åç¸U%7 week/monday/monday3.xmlPK UK= aweek/tuesday/PKklF=(Zo%9 Œweek/tuesday/tuesday.xmlPKplF=w«y¯,a çweek/tuesday/tuesday1.xmlPKflF=(Zo%9 Jweek/tuesday/tuesday2.xmlPK J¦basex-7.7.2/basex-core/src/test/resources/xmark.xml000066400000000000000000001022041222453003200222750ustar00rootroot00000000000000 United States 1 duteous nine eighteen Creditcard page rous lady idle authority capt professes stabs monster petition heave humbly removes rescue runs shady peace most piteous worser oak assembly holes patience but malice whoreson mirrors master tenants smocks yielded officer embrace such fears distinction attires shepherd noble supposed dotage humble servilius bitch theirs venus dismal wounds gum merely raise red breaks earth god folds closet captain dying reek Will ship internationally, See description for charges Dominic Takano mailto:Takano@yahoo.com Mechthild Renear mailto:Renear@acm.org 10/12/1999 asses scruple learned crowns preventions half whisper logotype weapons doors factious already pestilent sacks dram atwain girdles deserts flood park lest graves discomfort sinful conceiv therewithal motion stained preventions greatly suit observe sinews enforcement armed gold gazing set almost catesby turned servilius cook doublet preventions shrunk United States 1 great Money order, Cash print deceit arming ros apes unjustly oregon spring hamlet containing leaves italian turn spirit model favour disposition approach charg gold promotions despair flow assured terror assembly marry concluded author debase get bourn openly gonzago wisest bane continue cries Will ship internationally Fumitaka Cenzer mailto:Cenzer@savera.com Lanju Takano mailto:Takano@itc.it 02/24/2000 entreaty hath fowl prescience bounds roof fiend intellect boughs caught add jests feelingly doubt trojans wisdom greatness tune worship doors fields reads canst france pay progeny wisdom stir mov impious promis clothes hangman trebonius choose men fits preparation benefit since eclipse gates Papa Godskesen mailto:Godskesen@uwindsor.ca Ioana Blumberg mailto:Blumberg@conclusivestrategies.com 08/02/2001 jealousy back greg folded gauntlets conduct hardness across sickness peter enough royal herb embrace piteous die servilius avoid laying chance dungeons pleasant thyself fellow purse steward heaven ambassador terrible doubtfully milk sky clouds unbraced put sacrifices seas childish longer flout heavy pitch rosalind orderly music delivery appease United States 1 scarce brook senses concave valiant star further instruments bankrupts countrymen horrid costard youth necessity tend curiously waken witness navy there honest interest perceive defendant chief traffic where nuptial descent travel prepare agreed voices swears remember peerless doing preparation rejoice swear canker barbarian parching coxcomb excess conspiring nobles sounded consider sayings fishified prime may spirit untruths misgives choughs mew here garments tenfold error discontent hung beatrice straight muse shame deep twice mann maecenas any conveyance fingers whereupon child case season presently victory women beating deprive almost wed dreams slew reveal spotted attend burden camillo field enlarge stead corporal ground tormenting naturally sanctuary riddle exile coming awake senseless chance famous albans service cricket limb from clouds amongst shore penker defend quantity dumb churlish uncover swung eros figur sulphur sky birth stare negligent unction shield instance ambition gate injury fort put infants find slavish hugh see afterwards slanders chides eyes minds alb loved endure combating voyage maintained peril rivall suddenly finds studies weary truth indulgence anatomy assisted imminent may excepted yonder aches regal friar prophetess spirits delays turning cassio finding unpractis steel sweets promises credulity err nym complete star greatly mope sorry experience virtues been offending bed drives faction learnt hurl eleven huge piece hours cruelly april league winged tract element sails course placed fouler four plac joint words blessing fortified loving forfeit doctor valiant crying wife county planet charge haughty precious alexander longboat bells lewd kingdoms knife giver frantic raz commend sit sovereignty engaged perceive its art alliance forge bestow perforce complete roof fie confident raging possible cassio teen crave park reign lords sounded our requite fourth confidence high sent fled bids oswald help answer artillery jealous hugh fingers gladly mows our craving preventions spurr edmund drunk how faction quickly bolingbroke painfully valorous line clasp cheek patchery encompassed honest after auspicious home engaged prompt mortimer bird dread jephthah prithee unfold deeds fifty goose either herald temperance coctus took sought fail each ado checking funeral thinks linger advantage bag ridiculous along accomplishment flower glittering school disguis portia beloved crown sheets garish rather forestall vaults doublet embassy ecstasy crimson rheum befall sin devout pedro little exquisite mote messenger lancaster hideous object arrows smites gently skins bora parting desdemona longing third throng character hat sov quit mounts true house field nearest lucrece tidings fought logotype eaten commanding treason censur ripe praises windsor temperate jealous made sleeve scorn throats fits uncape tended science preventions preventions high pipes reprieves sold marriage sampson safety distrust witch christianlike plague doubling visited with bleed offenders catching attendants cars livery stand denay cimber paper admittance tread character battlements seen dun irish throw redeem afflicts suspicion traduc barks twenty secure pursuit believing necessities longs mental lack further observancy uncleanly understanding vault athens lucius sleeps nor safety evidence repay whensoever senses proudest restraint love mouths slaves water athenian willingly hot grieves delphos pavilion sword indeed lepidus taking disguised proffer salt before educational streets things osw rey stern lap studies finger doomsday pots bounty famous manhood observe hopes unless languish transformed nourish breeds north Will ship internationally Aspi L'Ecuyer mailto:L'Ecuyer@intersys.com Lesley Jeris mailto:Jeris@zambeel.com 10/09/1998 necessities chains rosencrantz house heed course lawn diest unvirtuous supposed sees chough swor numbers game roman soundest wrestler sky lodovico beast shivers desolate norfolk forgot paulina wars george while beggar sheath thursday capable presently his protector father orchard enemies believe drains tokens prison charge cloud stab york mild scene true devotion confidence hundred those guiltless pricks sort himself mutiny officers directive wholesome edge acts dion ride draw brings custom chapless beside sex dowry casca goods priam blasphemy prick octavia brain curer thinkest idiot inward missing conspiracy tents scab inundation caesar officer dramatis Uzbekistan 1 abhorr execution beckon rue Money order, Creditcard, Cash perjur kills insanie unfortunate conjuration deeper confounded belied first guard pale profits height desir ashore france strength kept entrench poisons worth fought ignorance moody poniards speaks jack egg offspring victory food double emperor round jewel abbey apparel untainted lass protest start wings acquit lake lady battles further low thief try brook cake mounted officers dean shrunk lowness dew sandy prologue armies suspicion eighty advance thankfulness albany ended experience halt doubted wert kingdom fiend directed pair perhaps prayer odds rend condemn conrade swearing dispos losses boar little from thought different couch respected human robe dictynna later pays edward babe distemper bards damned mayst sustain while self alcibiades listen weak soil view presume loggets feed afoot yields erection balthasar fathers datchet thankless lear cause evil cheerfully instance tarried because cough ancient testimony tarquin cousin reported porter beastly jade bark sex slack lear devil devoured amiable mason moss shoulders labour meanest feign eggs encount forbid enobarbus halters nam emilia fiends bearing food inheritor wiser hedge functions there capital greasy dark crush your sequest between devout thou strikes demand dost reverent conference least told ado modena jealousy nunnery mistrust nightly worthy closes tall proudly fierce receive nearness safer jacks shut dire mates wind unfortunate monsieur parcels sauced extremities throat dog empty treasury etc detested stand taxations edges mourner sue knavery unlook perseus diadem heartily peer tut compounded art reconcile study thought cockatrice money pity intend thing claud edmund throws torments ropes contrive story slain advise lecher ardea relics keeping treads buckingham defences lag neighbour ourself marshal disordered moderate venus afeard article rot hazards craft crowns plainness patient lying knowledge diseases meritorious medicine instead lid happy without them bands answer Will ship only within country United States 1 unsur brutish Money order, Creditcard prepar likelihood eagle body walk borachio month writing left speed patents coach through protectorship congruent confusion favours following populous garden henceforth shoots function fourscore mangled favorably slain secretly vice distinguish bardolph content hence boy worse bring usurers stew beard longed creep hid pursuivant beholders senators son mercutio woo bestow trumpet excess muffler pick ugly felt causes remove adding tear often rounds underbearing tree purer kibes endless women benefit throw claim firmness arrived sees wrestled multitude repent preventions infamy reproof shalt hearted prais knave doubtless deny merely grave voluble late loath digest horn slave hunger stronger amazed salt killing ross cry dry tongue kiss yields auspicious quietness perpetual ways court mean returning brook creatures appointed paunches henry sights west prunes flutes regiment seems bed musicians slumber post friendship prevention abreast wouldst words vexation builds unfelt holly walk inform moods deck bulk begin action school nobles antique people unkennel stomach into petitions jack assail yongrey ages betimes golden sink droop kernel hoppedance perfection weight whining safe english rod other featur betwixt orator across amiss mine guests guard yon willing remit longing goneril visitation honey Will ship only within country, Buyer pays fixed shipping charges, See description for charges Honari Castan mailto:Castan@uni-muenchen.de Maz Lucky mailto:Lucky@washington.edu 01/24/1998 scene disposition substance prick counsel start temples United States 1 nakedness Creditcard, Personal Check, Cash music sift kissing design airy office dismantled hope reconcil combat wert quite translate overcome unthrifty fell othello wolf entreat audaciously down sands sports pilgrimage duellist league holiday cheek that tables merrily knot selves ionia impure prophet draw throwing solemn yonder rightful foam worthless polack veronesa antony beget thereby carry untread hales Will ship only within country, Will ship internationally dispatch reported dotard holofernes shift carrion doubtful strangle sounding crowned troubled naked yesterday overthrow owe silent recount waters derive sans four fragment pamper arthur thrive wound fouler streets preventions obey vow bawds myrtle said infinite montague fierce sense ride souls commended gainsay profession labour intents persuade alter ord villain wore thunder congeal pawned alack customary deny faithful top office spoken please neighbour office afternoon drum embowell touch sue lifeless leapt called weary congregation yield mental fatal hard ancient stands cor dishes therein gramercy discipline farewell dire tricks protest cut horatio brother speech sleeping adultress pitch cave liv nurse drink state plants combating desired requir rebellion afraid repented tree scald stopp wine advise undermine norfolk vilely whet scars companions hanging foolish scene musty fruitful unburthen teacher garments betimes sight now for oaths vouchsafe particulars globe laertes afflictions rouse once news humanity buck destroy military lucius lap considered forc mourning verona waters triumphing officer hastily resign subject figure hay thwart written signs gout bred distance period glove players change folly going wat lost song hautboys pick business crocodile leading cave twice frenzy sprightly dislike invite forbids morn devour ambassador seldom speak tickling rejoice triumphant ascanius forward Jaak Tempesti mailto:Tempesti@labs.com +0 (873) 14873867 http://www.labs.com/~Tempesti 5048 5813 2703 8253 Cong Rosca mailto:Rosca@washington.edu +0 (64) 27711230
    78 Acevedo St Guadalajara United States Mississipi 18
    http://www.washington.edu/~Rosca 8864 8048 5743 6536 High School No 23
    129.35 11/26/1999 21.00 02/28/1999 9.00 10/28/1998 9.00 05/16/2001 13.50 12/23/1998 7.50 11/04/2000 1.50 190.85 Yes main cressid person whate lily pilgrim flaying therefore meantime similes base dowry rotted curan press debtor alexandria sugar battle orbed embrac supremacy answering cradle shoulder corpse canons domain night forsake yea satisfy between senators browsing monsters ear players moreover sir hor shape suspicious taffeta banquet excellence whipp outrage company fit inherit speech detain eighteen petter stone buck battle breathless kindness prophesy entomb over wishing conquer provoke his forehead persuaded places needy balth others school feasted rivers tomb honor garland worser wounding brook stoops brooch plucks level samp tent windsor rubs whereof beam signior built suff heavy dull husbands roman favour urge spear gone wolf cheeks execute resolv such horrid drives provide twice spoke trade friar taking pheasant sentenc scarf corrections brothers charge spur ass agamemnon truepenny saves roots practis impatient diest didest starv seeing beneath interpose gods home black forgot snuff dress dozen napkins countess northumberland headlong needless angry pleading better joy meagre reap enquire crab wales died violent rear past liberty braggart armour infer bankrupt winds teeth crows badge reports expedition free chief hearsed shapes supposes humours loath monuments silent wealth soon perfection adore spoken farm doct potent friends yes london susan bethink immediate read empty greeting shilling whole soul weary foot beseech didst wise hay postmaster own foolery betters pitch bay inch ros conduct pilgrims startles contented captain hither blood purposes mountains jul gain needs above ensign grapes revelling glean thank seeing tenth succession lief wall bands enterprise flat preventions knave wine shield prey key farewells religion fetch bells rage names valued exeunt soul albans ungently advised braggarts knowest desp sheep died repeat toy corrupted michael help dunghill trembles pill reap office early secure desires hated garland carriage impatient deserts feel challenger evil editions depart laur hereford richer prithee lust shortly approve rey should spectacles fiery perfect worshipp foul quod yes remorse young tyburn thrust attending spear shun doctor wild murd awak helpless ventidius tread defeat teem durst accuse rhyme wonderful attaint dealing mortality asleep murder throat attendants themselves spark skill pol see conference sail text speed essence white contrary terms girl paris commodity faded fall ugly honester smile achiev however outrage proud pays spilling rancour reasons grieves camp bachelor clock hearing feature can whom youth soldiers for time vere record penury herself reasons merits villainous whereupon wrote penny mar preventions followed best eternity bestow blots rocks barnardine torn cassio tailor fame forfeit triumphant conceived deem cowardly merciful topgallant flint purgation whosoever ventidius befits forever bankrupt choughs stains certain violated burgundy shadows possesseth men repent predominant burns revelry swore prodigious next tyrant oath noses apart balth trade feasting field importunity expect experience kingly stay babe hopes liege astonished suspicion unmannerd alexander crown soil committed god stately incensed trance oracle slowness fast princes damned corn grandsire change tender end fields slain palm softly samp shore notion herod messengers horseman riggish quirks shut thence beware jewels sland preventions has sells assails influences oppression pow maggot caught methought mechanical durst liker not seat assigns flesh made his third seemeth peril gain they stroke forsworn scape full determin professes commons lordship clear operation practice pyrrhus earnest broke devil posterity company text misbegotten oregon strike saw arthur earnestly brow popilius ugly serves presentation commandment metal comparing thereon true secretly gallows preventions horridly slack lieutenant hers stop clown rosalinde wed pretty wildly both expectation law noble point marr painted seat fords divided delicate mocking active bills filth pledge latin done statue moved converse goot claw show edmundsbury torment tarquin pyrrhus vanities heathen betray lordship forget enforce gods fills overcame burns leg overthrown institutions adverse brought strives occasion event ready troyan shoulders matters sinews liquid ashy gentlewomen authority assay hole selves living near doting modest wiltshire mocker eton profess forgeries butt wade lawful maccabaeus wert forced succeeding becomes wayward got thief obedience wretches yoke run destroy hole frighting enemies permission vowed swinstead body oph crave consorted requite forfeit speed possess peremptory fraughtage confin rules hatred case art knife bruit endur faces dominions common egg conduct abandon slay diomed apprehend advantage studied stained entrails bone shoulder upward arrested england valiant prolong dotes vesture collatinus which conspirator crowns fellowship indisposition opinion about action skins moe verse friar filthy divers fault apparell worthiness supposition parchment restitution rings rages remains lass dependent pelican contrive paradoxes unmask desdemona weak pleases shame wisely cheek poison avoid ulysses exeunt answer smoothing punishment much anointed bloody shook here armado supply four digestion unresisted consummate glou ding figure made unwrung worst repute envious meanest read nan stake shriek tower nights armed drinking instant scruple citizens rightful nonino shame hills dismal other fasting attends judge aspire hand putting repeal grounds bestrid commission crave mess tarries sport view freely lame done intend cast shun kills presented body landed question hem same burdens plenty esteem weak sigh sunday body preventions revenge horses cleomenes thrust what albeit foolishly mirror gently mock allow index evils should consider deeds suit damsons willoughby thousand number morn banish barricado unfolding perhaps gently stalk degree oblivion wars monsieur companies swords shifted clay 1 1 Regular 01/25/1999 06/15/1999 42.12 08/22/1999 1 Regular grant killed account predominant carries kindly heart light bosom garden cog yet daughters tott lifted offer bail navy next strongly scene scythe rhodes within quoth assembly did wench secrets drunkard rises gossip eternal crown hie thou outward bouge murther fort uncle hated sister finely lend smell poll safe motley treasure decline supposed puddle dinner womanhood horns tenderness lessens promise guilt confess gentlewomen souls preventions false voke colour need division conjoin preventions their apemantus pol plague ink incite doctrine sugar purity suddenly find lusts sin near conquerors over pays thief whoso manent where despite not freetown instigated moralize sequel noble music recompense choke massacre hear greatest afford commended troy stomach christian piece fare gate bar her pupil peep gives longest couldst draw emulate feast church ornaments madcap pales sometime tutor stern magician nine george lightning singing pearl frederick creditors dart cousin beneath yourself dishes expects pander near finely juno nell foundations noble digg fixed way ross preventions city expectation traitorously lake rose fine guilty lear surety chain depriv renascence flower kindled crows forgive husband vantage tyrrel diomed lies satisfaction gratulate untimely abominable confession greet heaven affection take executioner mistress fail ophelia faces horns mercutio flies shrift change writing therein fool could prize drift whipt belief ferryman control reported desirous crash traitors bourn notes limited passeth inflame child forerun monsieur barr damned tops remedy manners ram marriage medicine deny edmundsbury richer pilot carried core dug mistake awkward stiffly fashion 1 301.06 11/17/2000 1 Featured blots killed tyrannous valiant vouch stranger demands fathers creatures hare courage attir university titinius knows honesty cornwall hast henry patch outjest heartless axe lightly conrade passing easily eldest gap directly cut affect concern loud oath loath prick amen hope preventions speak strike use kisses desires spy hies potent idle begin call body shroud tears dark misery satiety bare from newness can loveliness bereft fulvia wooing earnest dismiss resemble fairy troyan business convenient front emperor whoremaster breeding duty dance venetian displeasure sow law foolish strongly grieve head presently painted have loved sheep decay legions clock brought congregation honorable kerns necklace verge humbly better distance 4 45.58 06/13/1998 2 Featured, Dutch holy dumbness young loose sea lusty victory wounds bondman heavenly merits drops nest hard rowland humble scratch vein month alacrity won neighbour subjects synod commandment fed close territories ply uncles doubtful presuming well conduct discover trick thrice showing goneril castles night discovers resolute lights spok low beggarly keeps mercy sick concern irrevocable succeeding lending pompey sojourn dauphin lives grave uncle looks perchance egypt dearly advantage drawing outwardly unbuckle suspense better last gaunt two beseech plac obedient rot mistake roderigo shore knee adder native shallow crush juliet blanch affords succour call since warm wears angiers pleased functions tom burnt pit painter refuse hatfield corruption faint bad shuns faulconbridge after hail antic tendance lain huswife remember laughter spread revenges accurs hearer couched has labours requite wrongs report continue word griev sweep suspected flight conditions refuse shifts home attire dropping misery goddess attired printing walk tricks consider awake anything collatine basin preventions instruments understand pick down take stock hour judg grudge durance directly knaves seven approof thereon rings credit strength sends messenger orlando youngest murder brainford coward say bee bolingbroke reports liberty zed they airy question naught hastily falconers seems grass entrance benedick fights submit eternal embassy society through entertainment that nightly dove king far plutus pole fate ploughmen proceeding goddess boast shore counsel rais boy watchmen decay conference calling steals fall clink mean now alone fault tyrant phoebus contagion crept not commoners sequence mar thoughts money silence boist besort henry mortality something caesar whate fine wrested blemishes burns provok whom catastrophe poictiers soon graces march wild willingly walls following applied satisfied expect lancaster measure jauncing uses thetis utterly scruple self report towards madness touching constables chapel south rank vizarded serves french yonder alb dramatis best mistrust paulina remedies prodigal gods proclaim lewis preventions etc definement sorrow preparation question nobleness angiers engraven heed engag add liquor flies conceive eleanor fell were urg drops bright anchor worth arrive courageous unmanly superfluous benedick there compounds charm fumbles cashier his bowl leprosy pow amorous perceive follow murders midst above shoes unfold rich viol here marquis safety pillar crush either blast please eager petition followers troth comments dar afternoon heel pride calf conjure childish base cinna guilty valiant returns attendant edward duty devis creatures mangled mistake twigs swearing shelter mouth camillo cost throne hum perpetual turned english say tents dearly lion difference stern cure dejected hateful nowhere didst craves good plate gall round bait disturb effect ambitious shalt want joyful bound 9 5.15 06/24/2000 1 Regular robb bird pursue commit hies silk tables bravely whip violet estates counterfeited slander they bernardo hath check march flood tongues enter cassius aspiring throne these fashion change deck lead history fellowship health modern mechanical vainly wives university counterfeit grossly correction shedding jests compact paper shroud mortality head chill preventions 6 33.50 04/09/1998 1 Regular parolles there jig gathered lost counsels vulcan rags thing whiles goose toryne rascal presume bolster shape case hair proper indictment dream ends maidenheads cockatrice beast impossible mowbray remedies doctors intellect cup deathbed armado drives reach growing oration methought passions juliet veil credulous endite embrace fetch alehouse were weeping yourselves allegiance rogue ladies chastity cow rape hated jealousy element liable press wreath issue bloody bold small shown lengthen speeches sheep dry bruised brabantio justice seas lordship given minds transparent scholar street betumbled gods lancaster infected fry begin tarre model nobleman aspire presented delight saint kindly pate sickness addition perfume degrees iron avaunt entertain besmear vainly defend everything feeds pilot transformation serv lin fails gar wed too authentic better away revolt immures want beneath drunkard idle clock rescues fearing any happiness 2
    basex-7.7.2/basex-core/src/test/resources/xml.gz000066400000000000000000000024451222453003200216010ustar00rootroot00000000000000‹*rÉKbuild.xmlÕY[O#7~.¿âÔBÕ‚’™®TUUKXT¨TXÚ·Èxœ`˜ñD¶‡%Bü÷ÛsË&™™&íò€¢ø\¿sµ³÷á)‰á‘+-R9 ïƒ pÉÒHÈñ€|º>éÿB>ìomíMTzÏ™I> ·Tó'Ñ,6rO•&`¿„€ €ešpe¦01rqÃÂÛLÄ‘ÿäÇ‚kæ Ô܈P#`1ÕÚ~‡òòsó„KqʨqVo?;ò+¥,·áý(Ó<@s=í^hI½îïû}¸âî“ }€Òv£2©‚5ÊXª,:`Rôß &<²<€‚#¸•&€~߉g©Œ„Õ^ŠÏ*•ã>rNÉÔøOžÁP!5h£\¶Ÿ­¼{úHƒtŠ=’†"éþ‚|.ð³-ÈPcµù«ÍlVÎuéý­ïÐ΢a‚â£E}´Téô,κ¹ÅÂyc†Ì‘uCáÅ@*ãi‰¾5JHgÈá'Éö3v¸ÑKèpþÉó`SŠä6®ƒeÝJàO^³eÀÈY_ÂÝÝEýg!zW\a+lAO;¢µÑóbfÑûê(\£*Ý⿱4-î÷Uûâj/oö´#KüÛ\ß›éÌÇ—¿¯Þ—_­3¿Í8:´!¬b·-êÎÚ^}aâ¶"4{hÆÒ &˲ö”K®(fd©Ä­§e S’¢ëY5˜±/á m­"ʼLéê¬^¶Ê®H*Ū›pCûBŽÂ‹ƒË³“ã«ëa©ú⤡ú ÐZf‡u¨ur,"XŽ ×XÖ" ¨éZ!µ>Ú[?$¹-¢Ò2“¬“­iÁò¨xS»FþÕÍmé,Þ[|ÂÿÏâÈÔ®’;Ј¶¿P·•@oä-ˆ•YxÙù­nÚé§³NùÄ¢5 …ón °ÏM°ëÅW‡¼™÷ªæÔ«*¢·$\µøIVP¼m¼öÚ°êüüÆ×†?h&Ù}ñ¸²ÀXøß' ÊäÚð¯LÎ ?R»»üy]x \êuâz ”7Å/@Ö'ÖÅuÇIå¢WÖÑÅœx}›œÛPß®\ìè\«[µãQªľevp¶iÓµÁ\mÓ­üCùí.¢’ ¤Þˆ§oЄWíFßx>Š9Npôz]›²pöÅÛZ7lINž¤Æùú4Ëg)•˜;N†}Õã̤jZ$qÄcŽ+G~½àÉÄL‘FçY¸ìU°xs(n%²»îVOt^jË+·÷Íí]+w„/ìo¾e†]ˆk¢Nôµ=¿}ý§›fLêþUü{Ð0í6¸ 5Ÿ ï|^ôÀ­ÕܰÀ¯ÏoÚeV-·Wë2{aþûàþÖ¿‡è/Rbasex-7.7.2/basex-core/src/test/resources/xml.zip000066400000000000000000000422551222453003200217660ustar00rootroot00000000000000PK ÷d­<infos/UT ñÖëK®ûëKux ööPK䎑2Y´ÆM_Åm̵Hž¼,HŸÐ,É^—GVòµâ|œŽ `éî$z5üfýÚ&ò×ò6Â&k‰ â%›a€ŠÍF–­Ãè…ÙiXOQèxœ è ê¥$§ŽN˜diºÛ#š½6ÚV™N.<¹‰“q7ßõ¿«ÞMv²G4C?r'a{„¥Ý#z „R’~ÕõÐhDÖ ˆ_ øàì{g¤^ü‡69å09鸳'G^‰Eµ!Å~TÈWÃCh¥ÄBL/!0³ÃêåÅÙÛímn×þpµ·ÏÛ_£Ãª>O·ˆ‘9ÊFäæþ´³(?Ê÷‹šEÙ %m† Iú›ñã†ðâUpLž*ƒÀ6LzÆØ°o<^°~‹'‡pþÚ|b;=t t‚wì cAõtÇ?F¦Y§3ãåcüñáÖ»ÖÏ€»†ÚÌ|çŒòú™ÿ‚—i8UãD\uÀÙÄæ< ïªïÕcRêD½ö¯ÁâþPK Év­<test/UT yöëK®ûëKux ööPK e­< test/complex/UT  ×ëK®ûëKux ööPK£MG8ýù“útest/complex/test.xmlUT ŪG„öëKux ööm‘9Â0EkrŠ‘{bNÒq8€7À’GÎBÄéq²¦óŸ÷gñ°¬yZ¨µ/ŒÃ„ìãÒ)ƒ÷„\/çí‰diÄxA–{]Wè”,Æ*:°t ³œ{å$lFka„ MÛU–KÝt@þÔ ü ‚{¶"`TB„L®ÞÙβœó-¡C–.úÇÄiŠ™,Ò£b&Üœµî¶X/~ãgõ‰žc¡f|«.Z0Ù>d¸ çøPKHPJ<<~ñôŸtest/input.xmlUT vrKjöëKux ööuPÁNÃ0 ½#ñ&Hô”¥å„DÚj &p‰kÒF­EšLM6•¿'IK'ó%~ïÙÏŽy= NjthM™›<eÛ¢éÊìócO²ºº¾â½txø ¥ðªD«F t¦úÛ’ä$ò赪¾Þß8›ÓTÈbåÙæÉ¶?«‰Œ šd×XmÇ’ÜîSðjòæ)h4ß ÜíÖ¡}Q= /¤pÊÁ6üRÑâ „ÆÎ”dÄ®÷­q~µu.(ƒ2Þq&ÏÊQ¯y@«—I :g^ïÿ‰œ­6œ…5–ƒÄ_Ïi}@¶;ºto–þ PK Îv­< test/simple/UT ƒöëK®ûëKux ööPKT‘<‡è/ÿRinfos/build.xmlÕY[O#7~.¿âÔBÕ‚’™®T­ª–° ,¨P©°´o‘ñ8Á0ã‰lK„øï{lÏ-›If”Ëò€¢ø\¿sµ³óñ!‰áž+-R9 ïƒ_ pÉÒHÈñ€|¾<êÿN>înlìLTzË™I> ×TóÑ,6rK•&`¿„€ €ešpe¦01rqÃÂëLÄ‘ÿäÇ‚kæ ÔÜ€ˆP#`1ÕÚ~‡òòsó„KqʨqVo>:ò'+e Y,®ÃÛQ¦y€æzÚÐ’zÝ?÷ûpÁ ÜÞ'Az¥íFeR#k”±TYtÀ¤è¿ALxdyGp=*Mý¾ÏR «½7 _T*Ç}ä(œ’©ñŸ<ƒ¡BjÐF¹l>Zy·ôžy”žèìº8|(ÝsI;a©×»f¨ó"v솳»º~ÎnRH¸ÖtŒÇ™R7¯¸Ô.%>EûàÊÓ"笹눊¸bÝÇdù$瑆ӫ3@G,¤,M&˜,ðΙ ›§{W{ÃOÿœn£:zy½o ~ºœ )ŒMÔ —‘npÞhC“Iabr‡ù .‡ç’Š¥L†tæ0LÕ8tÅÆTŽIG›ðMÉ©µbs´eÔ¬ày_l:žã¯ÈÅR 쟜ÿ9Ô:Íã°ºÀg±°Ai™Ë‘ÿ„t_æZçcL GÝþ•‘®‡æ\3%&¾#zh÷€ë g?Ná‹À64ÎÙ…N±GÒP$Ã_Ïe~¶¥Ãj¬6µ™Íʹ.½»ñÚY4LP|ÔÔGK•NOsÖÍEà ¶È—aÈY7^ ¤2ž–è[£„dq†~’l>b‡=…çß<6õ©Hnã:XÖ­þà5[Œœ…ñ)ÜÞnê?è]p…­°=íˆÖFÏ‹™Eﻣp‰ªt‹ÿÆÒ´¸ßkªöæj/oö´#á«væÃó¿VïË/Ö™_gíÛV±Û5¼™q„‰Û:ˆÐì¡ 3˜,ÊÚc.¹¢˜‘¥·ž–-LYHŠ®gÕ`Æ>…3´µŠ(Wð2¥7KØV@YÃIB¥áQÕanh_ÈQx¶w~rtxq9,UŸ-©þ´–ÙajM‹ôk šCdIjºVB­öÖInK§¨´Ì$ëdëDj"X¯±sj×È¿;°¹-€Å{‹Oø_òYÜ™ÚUr –¢í/Ôm%Ð[y be^vþ¬›vüùd«SDÞF,Z£P8ï¶û,± vÝ|uÈ›y¯jN½ª"z ÂU €Ÿd…ÅÛÆK¯ «ÎÏ|mø›f’ÝØ_€onmh™€*“kOÀ393üHíîòçuá4p©Ô‰ë5PÞ¿}YgœX×'•‹^YGsâõ]\æÜ3õíÊŎεºU;¥ên@ì[fg—mº6˜«mº•(¿ÝET”ÔÏâé+4áU»ÑÞ„b޽^WàsY8ûâm­¶$'OÒ{ã|}ˆÀ?šå³”ÊÌ 'þêqfR5-’8â1Ç•#¿^ðdb¦H£ó,\ô*X¼9·’ÙÞ·«':/µå•ÛûæöŒÎ®•;Â7ö/¿e†]ˆk¢Nôµ=¿}ý§›å˜Ôý«ø÷ 3`Úmpj>Þù¼è[«¹a_Ÿ_µË¬Zn/ÖevÂü÷ÁݯPKx¤²ì»Åû±º¿Ñ_ÜOî<øqyøÝìÛ°4nnïoÊï^Ü·>5s˜òe&7÷!ñ÷ü‡ Ä‹ÿˆßLnï«™×é]{Æ ô¾rëÒÅK©7-Õ4ÇOÉ'îHªw¾ø¹š<¾ ¨:êÖ¡îÏÕì‡xÄ{g¬`ÅW¯#>×ñ»'ïO'|e°{;Å9ᛢ;TWÐt±ÇÇ'l‘ñþz]ªÁõ?ž°*ŸpÁ!Ì3>‰ßk!‹±u¸Ì›CªÎÁ÷-öûþàϸ@ûPÅÝŸŸ+\`æÒÚtÕÎ;|EË ݇[–€ `·O¾¸¿±}±]¶î³]LŸ:?·Õëžß?M1a m\¸¿ÚüÚÏÇÐÜw몥óK8úqÕBp›Ø‘ulSµ_‡jð³ç†º°ø¶zö÷‡u/]µmµ‹=ÞÛô¸Ö¢³ra¬Ús÷x¿?üÀêo.âpóXNR¦ Ÿ~ø_¡ï+¾ªÂˆ%¯®ïÏ¿©þä}uõ)¬a®šÎÍ{ŠööЇRî÷q¦Ù¿ýªütûÕÍ_Ù[ú:~Ì?áŸÝ‡‡ˆCCSý›;¸1VüÓßÛ«ïή‹ñe‡û½Âþà›néBßVô#Nª|Æ^}çšáeœ÷8—H-Åînoî^ÝÜ}ûí·8'ób‡æLçšy <=>>Bš9ž RÓì!7öª‹Äy,Ü9…ˆóÇÁWëøaMÜyÔ=‡ïÞCnN‘‡Åßô^'X`7jS«û;ÿ€Ïøoë{ˆ×1®3%†Ï¼Âý½ÏMp æNVÂŽ ¿1±ŒM.Ì”±ÀJK›ñ ƒ›©»®~¥i7…ÏÖ¶q5בK‹“ñvÜÒ'·Õ –"Q;xPÞTá‘°S¸£«Óþ©6ð?²™ûÙ–ð×BppÕïüøÉofÍ^}— %³{j ï f_¶ð/Ãrmo_ݼzsóêööö‰„ˆS% ÜÞ.žzjoj2<09Ǹ«vøU«Óê{ßH&ößáè@ÛV 0gÞ÷8= ÍÁR-süà Š—6f•F ˆ;‡…Rí(ÁÑ£çŧ–j7;®êH¹Þûñ\¾ ;U&_Ê}dž…¤á÷Õjöue¤àR ÑÐk\i‘™‡Ùu¦P*©áLðgšJ\Ø7}˜¨´3?^òQ^Ÿè¿ºÉUÿÛt€•Ëùl¿øn=ìlœ_6îúPÿ{t£«þ¾¤ñPçü±òú;ÓÑ`5–™re3¹¸:êw7<íÛÛ»'GýÁn¯é m<‡½ ާ_Ƕ‰f|lW.ŒI«Crðˆø'…æ ×€¥„z#rq† ‚7ª7ðW°g®ìW¸†Œ½Œ‚Íâ·ë¸÷´VðÄ.Á`ÃÓ‡ÛÝAÖ`¸¦@çíOX–bàÉæ)¹6Î2hPW á»:©!ô‡*ΔŒµ¥}ÖZa(Wùç9Àâ&qu¬ ð"¤®«’åÄ»xÍ3o®á]'Økè‚üí'N¤¹ìq.P}˜dOÃùL—gžÎ­<Ñþs¯÷êðz  µy¦“þÌùý¬È2LüDdxr”[ˆC°eëLˆ[{Zù͉^â¨%ƒ°Í¼ ‚œ@WäÇÚêŒîªN5%ÆG N³ÎTnlóÉðà âÈÂ׌tDr$ü@8‰Hz‡¯àºpª~Kà«Íñc#– ¿¼gâ …¸«ÏFq4[ É•lœÐ þòTE\GÏu´‘’|ík›2ûüôÏ yx9ZÀ®U»ÿ!à›q'ÔœøjµûÈÍâ10à/Š‘°^ZnZü%@L!çT9šXØ[ØY„0À°f°‘ 0¤=M í¦lýàO•¶nO°Èc]$û l4d!èŠÓÀ¦vÐmXT·ÌÜÊ8cmªŒgà:ðüT-'þÖš¦0BÝ(PrôgY‰] >&;¼àÛT›„¯ºì?•£Ãõ!6ÇÐ,ôȧH‘ãRt`—#i=vÒ’!%<ЀMìqÃIJ’çÜj(¢]Jo½ÂF`¥6¨æß`={Ft4hŽ'4Oª‹Ì3«°Xî­iàh‰pˆ¦W‡»Þ0™à?"ÊÀW€:jH%Í”hfóºsƒ…&5ÝpŽ2Î[sÄëĉލXI| ò•f^ò.Q4ªŠéƧšn¥è 9Mì)'kÎ@8¹E4Z<¬¼^ú_üúÊ›WPDã¸H¹‰ÍqêÝ‘«èèši·ƒA ËàI:¨Ã,ó}¯üÙS¾ n°/°õGÏsi¹›µ ÉþmïÿüÑÿˆ„ÅKlæçÐãà`+}×¶šÞiiY[gª=Ìõ7×®ý^8  `‰Ã™Àw…‹ç¾Q}i&þöy“ðÙRDûç‹m–4„_0;ÀQS?Ÿ®¤E‚ñ\wR¤"3ÄEÝ_®ã43æýÒhú¥à2ÚDkO¹¨ÆóÀ½†Ó_¼9ޱˆ4`Á•øÜ6m‚³â[jfê⎂d\¨¯²S†ÍÓöÌ}U Z€PøçnÆ`àUVÊ˼zjž›xxøâ=‚œMÑ5žYxÛ¼Ô`!èåçˆZ¦^Pcמh‚qUÁ30ö¾˜!þ?nŽšËÛ¢Œ›†pæ_ìm¶‘öló¸Í,(u ;o®õÌïh*o(G€Nô웜£ð¥ ‚8uD@\ãîîÔV|Ðuª#¿’`_à8g÷‰G6Ð$Bdª»{^Õ{·717ïKyq3S\) Qäzj¸hb:?+qeÐèï ¥¸¹Ùíysˆz“ð]–7åjºkK›h ¸izv|ÜèÙ¿âdµëP¨ò½<\x¡g$ð~²ºÓç22°˜˜N®'bí'è0ÔaæŽÀ'f1w[ˆ_Âl.•!âÔ-ë>ÞÑ)ÿÑ­=iN—yE2ØèÆ¿pÉ1ÌÜùuÀ7ïä0˜|öG#“oçXqEB8hN˜ dl‹sÒ}Â4–Á§Ëã ÆúwŒvb>?0¢ÝJJØ1Xª”¼üdëœìƒÄI.Ý-x£Õã÷;YJO}0„ݤ M>ƒ&h):ý /€c\BkxÔŽpK¬ÂP¹adœÙwæ'¸…‰:ð¦Ii{æDñÀý¥\ë‰ßä!èT$ B:ΖïíèhÌäí„_¨•{˜B?Ù64 Pr ªêÚ¦ä°y€ wÕ‹aÜ$}€ ØZ¤£—ƒ½òN@D‹¹7ÆÉ8!íUxsc “¡Ã,îàÆ›²qŸëuáCÛµa°]]Nž>%ù†ˆŒñ?e J†½W”“ƒDb&J'c(5<4s%µ¤7ní̇ó&àZµ‘K–.©bEÅ9C6™­ ØLˆ0ã\Î5¿ÁàîÌdLÑ êZ “·¶ïY™ºvÚj#)BSŠ«“ÙäÅÍà,SÖE¦ýM®±¦.²FÇä eˆ'@4HIèýZš?'—­] WÜs£hlàÖ&'VzÉ&Ñîå™°V ЇnônÚ ¨y"&ä†Ô2뾲ȡT³cÍ¢ºhioE°;\R÷iU`áÕø×z–ÉÇ&CÊÿl€üNù/)¶ý ‰æ/'wÿŠPýþ?ý·f=_R»åõwZU:§ÏÒ»bx®þN'•éÅwŸ]?ÍûÝÝÞÜ~ËJ×»'y¿k]nÓÎ#2ƒ8Ô}ÊFºóJ²ö.Œ²À°L¨›‡¾•]¡þ%% Ù¬Fe'éî¢8æ\ …ÑàQ!ˆ|úõ±–m"£pE–4V*RÄžÆÂ4pP„FLÐÍ÷s¢aÛ{¡ÇSÇ€·ö{øVºYf­}‰*lº#L¼ÿ]n.^˜ygް“ùMà?4+žE:nΤ$äv E+(V‰Q çÀÔóFÞ\]³`×5ÈĨÞÒÐ@)úE21ä&R8îàê™éVøÜs©¥3 /¹FŸT²¾j±GãÚ*»„ËpÍ'è’tº‡aüÞ¹I×Òæ[’ÿm>InS㈯Z-Â\ðu~8Û¢*`+˜Ànso$>)Á†Ë2æV]²L”RO®Q¾Ž†¿Á…÷nI°Æù„³*,VBCÄg¦G¯ò¢~E`êŸ&H_?N~ªý!м?;;êjæ!¤àl´âø‘û»ú?W)ÜØ!®jø#!ÃUêÐÏ€pÁ$ÑÁ24p¤~`¯ñÛV¦Í°·ñHŒi†™E䕇teW''ň‚?/T¼À: 2<¹ÐB?1î¡U ¯òÐÈ2Ejƒ8%ª ´!êŠö©2EW¿¦ l—â1T•‡Ÿ‹ %·£ÿ0\ ¼A=-ÿõÁŸ|_¹ºöJ¥5öLIÒ§Òÿ¹”5:Y¶yQ4ÎB…àgϘÈ6†XÒXHXrøœsá ß-Äj +ëž§³º5>¥tsëO̾µªB¬B6Xöõ×@G›z¶ƒhªsãÑ–ÕQ˜}c,Å“ºJjtt×*[ñyÜNÀs½Íìý;˸ø”;=;‘1;ºœØª¦6* H/#5 3ß”qŒ;îV¬ˆ:Bas|¡”àÒÙ·ƒq\K!'­åu+Íþk˜$ñydØ ¸31aä[ÚéïÉð:±VÖºé±ï[¸›âÙ˜—it}êà˜¶ã²é‚ùDÐwQžcÀ Ñ𯰔8 ½·Zä#%p»Å(LX“,,õgÐ9)s\cßÅŽÐPåãé*{Åȳ…Ò[®r!ú—"Ú¹Hü)¨¼@J©3ßYå)¬Œê€)¡Tp,LXÂð Fƽ¼‚–_ÿ?§ÙüÒñÜ— éG ¿ÄS~ó ”îW%½êÈ”!õ3áèÏ#+«r]1'ÕÅ÷ÞílÚâ2¦›.ШŽ@'H¶ÑØ (B)4â¤Qýé·LÒõß[g«½&ñ\Åpc6„ËùO––Ý;•P;*úNèÞ9‰â[”ÞgŽOä=“ïüºÙ‘ÛfÆ%ùfö¹ì3+Ù’„ ±ŸT°‚u&>>m±Uµ’97«®u’l„/ë×]hs–ŠÉe¼£‹æ‡:Þx%ß 7Â_K„ ‰‰I`«äënÇpyb4¶27´óýbÈ#eú7ÉV²‡^qÑlD-å¶Š—f‡‹ò )j=ÇVX¦TÂædé»’CÄvz΃¬Ü^ÚKðŸƒzXÓµ‡ ­­cܽë¬)‹³ÃYSVv’ ®\ÒU.$sS{+7^UåÇK•"“µÅŒ­Ž±WØ ”A™hÞ°¡cžW¹6ñè —Ùh<:?qù\ÃÁòn•˜M ô¿eÍï£ãDX[âU}xÍ/™5ã¸V’É lŸ‰Ä™YY„°¥zšc=W2ãá¢E9“ƒl‹ÃæGzHB‡InAX¨¦_+ò«9z?$ÕBÅF ,õ'£±|F0ðrH³fÁ¥ñ¢þ¥ë;zCpµ¡—XI!Ó}¶ÀfPØGDY­W,g¬r*J2!…f àûI¸FlåáI™—Œmn°1"Y‰Œ$;3æçÒO)˜å¾”žX„ÜÒÊœšò[ÏEn¬½¡ JJ2ÆX:¡l…1$†NNç⤩V‚!‡Oøuç V<Ïø$Û@ò˜Åu÷×I û³¨5c¤0 2 7ÇÙó˜pen§;_r’e§ï•;vÖÄCb¿ ÁØçÞg®Ÿïÿ_å±’¸T¶‰[-boçs.l3µª¿¡ “(D;7{-X¹°ÅJ]%a߬é\ѯÀGÞYŸ³<®EP1ËúY‚p¾ÇjTq²‰øŸˆn 6 aS l†ˆ_䑨&œ a mŽR¤Ež¼R‹p`ÓÄt/9(¯€])HBœhÏ“x¢D¹AÐàÝh—8Ò " æ3œ`kÕ!FFmJqmê‚h…òqÉ“@ã qžºPªX9ÍÚ«Ú3ÏÞ;(<‘µQ.´–YÅ\ö VêóSZž9:&͸=0Ì}ö —Lx`ùÿŠ’)ãb-ÎåU»¡r8‹fVpÊb•þ+e¾Î%e³§ž 3‰‚$V0‹L-žTÄ™I°"žß³u‘©°š+hCY0]è{Ñ*pðgcóbï½²ç«ÖE"7+ Q½w나>Y\]3ï.†ô›Øk53Ki36únöã§³º÷,CŒµˆ°Æ£± g‘üF–¿nJ6P—KaÕB.žEÖ·ŒÉeÕž„/T•ä¢@Üvõóæé ºØ«÷JV0_»<›§Þõæê3ÂéEùKûñâ-ÿÅá®ÿe¬ts‹žžÙµ-Õû¡ô¬å7}sYÞ†Ë0Jzø/·Õ~÷Íë¿©îÞàŸw_ƒ[×^Ü“}ÈVû‡nY¦÷77§Óéeù¶›¿¬b{¶`ûooß¼«Þ¾»{]½úæöuõîÕÛ׸ÝËß_ÜŸTJå'5Bþ·Jç~ûÕõ«¼Y—ÜØÆ|i³î¶ÍúEô1±ìGvJïø,xùÁÍúúÍßàŽ¾¹»{õúö²W—wšS~øæ]õw ÜrN(Ùo±C þ žíƒ›±´ÆB‰ŒŸÆ å×XÂLÆrãþÀHÿMØûí—/î?… Zçîd•ŸYêßVö¥ó||Û7ÿž·ëËGúîÝ×oªw:×oÞ¼®¾~ûúë'GªJxO]fhñÛ¯^¿{÷í7/¿y÷•Àfn$úa4ú«¿a£n=ü3ɇR.‡½ýúÅ}±bÿ#"æ(/pÂØWaÛ•›|§dñfSákáMO^KVK·–Ø6õp÷êÛ—¯ßaç×XPhá66>B鯟tÞÃÏaiïo¿yÏOêeQŒÙï*ûébL2ògŠ Ÿ»{ÉîÕí5îb»àã+³ýñÝ®|÷æýë×ï_}ýS¯üís/|w›/üîÉ…ßáªïïî~µ ß¾½¹ûúIϧöúîý«oß¿ýÉ{}÷úåÛgÞ2öúõnùöîýí·ï_ÝþÔ+óì ßÝÜ>íhÎâõöîýÛ7?ù–øÂÍ:³Èüp÷ííËwØËòšV$]s~øß4€å…%nxAþ[FÖðb‰­Óó×áÆ1.E³sþ—Þ÷ŒÀòY\£Aü.Ú[6ææê¦y¨S§ÄºêÖ!©v¹aWÀ_ÔR¦²¹Ál@“Ì˪ ¯ŽE7›­Ûå¬!h­ªµ ÌÁ’Égd ˆŠqõ“p8ù!¼°Jè“¶½fvì€+TõÑ‘táF›Ë¡;TqŸÀ*‘ésö¸Ég»óF1(4îR§©Y±æ¥ò M„Ù'°žW‹[Þ2ò§xT©#<]  P¹_Ü%‡ìÆïW¿lÙ¡gFe¬ AfFÍç ˆSŒg&¬,þ 5a)LŒIµ^ šm¨ÑäÙºÀ8gôäÝfî?'ša´Ä e­ØŒ0.l0ÕÍžBÊ]§¼ 5ˆÙNBv%¥¡câ©„×­µ<% ^4¬~é,¯žJI`ÇšÃ4ãêB€'QA;õÊè¢SÉ~X©·'Q$% Ñ Û:<»vI¸që ˜×:7‹ÆKvƒb‹€¿°ªA¦Ñn—ûºq"æ]“ÕÝÁšgn¬jÔœ(Lß[zQYÁ”ƒÌb¦ØmîQniÎ i=m (ù3±ÙúÜi—YÜØqë{'k‡­sG‰Î¥T¢åTø¨lþa}¤rdÝyñPá¬G¶‰jF”ª¤¥#/ …²`ÌÞ6´…BwdõÈZéFj…N&‘VYßQsOmÌzc榑›×šJÇO²ÑMê )uDqêRæw« ¥s¥¤¨Í†Â!ÉC7Ÿ• iMÁ·š …öCÜBHXœý|11Ý BÊ8ŸM¬®faJcsØ´bNQwYàê–pÉÃÀA¬Ù-–#Ú‰fMê&Cl37Ý>òÜJŸ/å2Žá•% “h­vÌ?XSzù~VFE¯î4D&Ó­«4n•NX¥ÜQŸ3|'/KÌ]Õ»‚n¹¦îR}ƒ$ó««ÉŠÌ²:Õªœ ä¶“íËþR,ÕI¸]›ÉHlˆWšÖÀê[â&+—óOâ×Õ>™! ,)–’3+ú Ò’G‹•[gfžÙ2–ìàKò§v¤ÙÐ…m8EöJÉJ-}fYb§Ìéê¬}¬¶ÙJël{)ª§HÞ°ä½<„Ú\Í´‚•¥`œ«ÚêÑÛmîÙ:bdÀ¢*¼ÓqMS’<ËYcfE¼thæ]Ã{>®Œ[Ù[)§Üï<±¾ ×¶¥Ï’ÈO{ÉŠ×NØ/iû"&vî­¢y&xu¹Å›¥o±ß-Ÿõì`QŠ$“Œ„O“šÙ&Ó+æÏX ‰g§U]ÇC€Mbá•]ŽœåAé`†mPÁdâ+ikÎpBPú­µÇ2vL¢-Jâš™hJÕ•Õ*Ó²ØXŒ Ò+²°/.dvâY»3˜.«z·ªƒ…ÞFy·K}Æ:û57¹kÇ8Néè­5FÈ¢ÃÕ5¢JhÖ²2ºfR’»ú~ÊÆ‹£ÁDå9² ~9׫5Ÿñ2Ö´%’KIÝ:–†Þ; †•‰×“;h7e %5-óCVà!çgÀn«v%×Û5ÍúhÂܺ*æ1™|ÄeÝ“nãÖ»ÞPÎÌéS¤-+«ˆô/&âäÒoFŽZ®|%õß^}o"¹‚u+uàçs¹bgª OqË„!µ+ºY.µ31Õ ïgèù>Ì×T߉m•JýÇ6¨+©ç^­›jTU„-Žý£éd/ù#ÛdÕ¼UÀ”xžV'OS)Ý;òc™Cvɦ©Y{VC Q3…Û³TÞÇæ Ó­ °19ˆAi‡<Ñ„-‚Á‹Ý„%h&kUµ™™¸i$Á“ΜÅr=ñS)=hœã6øâÄtze¾~PÃþŶƒJ,dˆ§õXþרF°‡¢a8ÕnÝÜÒ -La–æjœze¿õœ_e+ó:¯ž]6ð3eÉŽe?7!—:ö8 §æYJ¬o.H`OrÛÜE¨k¯ŽÂÈãµ .3G’ÙëÊOsMÏ.SµÚ¯äãsü%]î$îz¢Ë&½éBHj9C¬,hb6ë$Õ¨šƒ£oif9 ”R¹œÙ¥ì;°K+‡¦Ä`lÆn„¯:o›U1L"ùj®ÁGZ‹k‚ÿÁ:üpg£¿[³Ü›yÊYSi¯ÚÖ‘sP8ïòÒ©ŸÛŠ£•ÊÙ°Ik[+„ˆ„ÎþXU6”.'S®¹ô/윸CAlÙ̸W[,œÜ•@”%ÓÕËOmÇeºÉõ€Ðq§na*µŒ1O)%}fë>&h„<Hg0‡ýÞ(ŒöšÀ­Ð¦—Lºã|'o ydÇ“IŒäÓÑ 1H³~5pœar-}€+‹K™N6øÂ`/kÙVE›âz»è¼å rˆr!cÒLHs¯ÏXñ“7Ùïüjh+ YHm(ÔÛ.¯‰=øŽe9ˉjæÅtÑ×ãÆlz¬(vjÔÖ4Ñéyð;1ßÚÀx­Õ0¯ÆXû6KÀY3^­Þ¬] 1˜Œéݳô'>jˆÉ²ò3G›¼Äè–1‘+HœÏ`ÔøT¯"ª¸u„”Ã<²hÄÿS·0QñìÎqÐ(¥Œñ´0m§µ‰-CÛmÖ®÷û 3`ñ<,«í5à¡7Š«éFZ,j \šŽ9ˆb ‡½W%ƒ3 ž'Šöwв™ìl3¼ÑL/㎩´6€¸ðfú›¹ÙÔÃ#Ö6ŠÆÎv4GKÜôÄî^ƒ&ëu!¹¡UÓ*½Ï0äjÇf‘‰´?­uŸçÅ0ãÏf쳪m4Ök¼ÃÐÈìUÀ?hÊòV:ÕòwªòËJ éDE6ës”÷M§Âñ}:’a,ö*««F¹L'1'›ÔæÆøŒºÔ+7ËŠYÚ‡Ô¬¨7Ì<û<‹>Ê&¶Ô,9ÿìÙ&e*$Œ#'‰xeÒ‚ºÍ8©¡¯„bÙ¸;Æ—VΜkãGµá#º>\MïP·œÑMRž¹Æ`¼/ì6kíÌ3×þ,G”ÃÊ܃’Ø0¥§u,£Qæ»Ü˜)ËŠ´4Ń ‰sóÀ,Þ/iì6Á–{s]â}úZt¶D¶?ü›¯lÕFBÿRíí³2Ù~O>µxóêåÝ+UÕD(³m_=™æþS6ìçÙì˜÷Š ©eômÑ*¯£Ë&k-K)d#™OR¿ €ñUèw(ýLMÜWgÒƒåÛ­ ²\|Yo¢f3]j&M4ð´L„$Œßfó©Ç…B-âYjÎ0NÕÜI^ï÷+ñ6ñ» $ 2¯j`<Ùü0§,YRwi–> ’xH²V\øBk玜ª7ä{MeÔœœÍ“}§ce»44nð–ê­÷bˆ §œä6WÆ-X„Û°‘i՜˖m—¬•Ñ3—ŒM?)G­£Ñ"„ncmð†å Rz„MCz¼]'R\ŸØlt„ ÷bªXBʃ>8ÃïÑgôÌ 'Ë}»ŒwRV}lø˜ð›í.YûœVÁãG!••¶6tœ+o,Pª"§\•¡V%UØù¦j€Ïç¡ ëØ_1þY­ êZK]9”Ÿ0*îèì‡Ï’‘ÌQrÙ´bæ9On(ƒ`¥$äV·9bº=W–d0\ÆÊm äb—_grq:‹+R‚­-{m&7Ø2ÜPÍÝŽ¦†¤ºÇ#Ú~j¹ù üZáÕBx}{÷òöë'áîîæî›Ç¼ ƒÿh)ûöÁ–]ÏA™d%îKœz4 ¿Z;pU ËБK#hç·®*Nè¹IP.Å•‹N‰f*ŽUº”«*Ȫ?’zG­aîúƒÚc½•K }ÌF°?o³`(¯Ji¸DêŸòÄ9BnÊ3høÖuÉškeNŽcåDÙr«O[/œ³éî“2°Tñ…¥Y±b§˜=G5À4q`³)V¥Î¦AOͲÎÒFõU‹3U³Yì1SN¹’&²^È‚‡›óðšÑ[ œñ2Ùã½Åá5ë‚ 3±xULÊ)FÛ˦2Üc›'Ã*=ej§v¶œ »ðș냕Öa4¶‘Fz¨V®vkâºVŽ„Tš>ã9|ØË[^` ³}FE ¡ó‡[‡AA|V”ªŒ³ ={4õÉ¢óŽÁå†-•ŸÌe]ß0¯hQ¹œUòšIÄÏ‘MgŸ-«%Í<æ@öÛóÉ2mccí?ð¼ùë0,¯¯C·/ß¾{z †zBtÜlÉ«¶+¿©þa…þ…æåG(}]ìm »ъν&è&ï#¯Gà[ö!Ž-Ý›ùb«Ýi¸÷Lÿ#¹Wp‘vòÖàôhNŽô£6‚MO¯§8^µ2å6hôyŒí£ÊÀNñ3—§‡v,jI¨¦>OèL—8›å$– áSÉ8êÙ„Àj-R·Y£œáéºÅšy~›ñÿÊg’QµÖ%[?¥X4ã+Od_§fZ[S²¾^³t8èg ÛÒÉ}.èODÍøHü ,€°Ž 1šÇšòà‹8GéÝ<žßïÏé ºú%GJø«†‹µ´A$ïõF3@ÏÚÖ;j¤Ë)nô¿zLŸe·±8ï¦`ƒ™“qÂ>æºÞaô4A<ëTûxöÓú,·cc>¬€T ÙcŒ6-hHÚ?M·Î“™r'GɲÁ~*Q€”³l¯‡HÁœ³®¡gfãÆýN#,ÝbÙLM±¹"¬öÔ®U’ÌÒ²8ÐzÊÔiŒu‰Ô‰3mÌy1”ÆxàL)QŠÖ¤)ëÛ3@úº³Eˆ8'Ç’³Š7³ˆ©pû²ÁeWÚrÿ§YÃk `^ž¢¥‰¯2îš¡?Ù‘kÐÚÎr T‡Prr;{š€l&ëÙ³¥Ðê©Ë¾qqžtÿú³°=hB3r¯Þ–€³ÇI¸ñœ;å<:C¸ô$î½~ÒËe¾®5[©ïÚr²‹Èå† ›ƒ6aï¢éšË™L1uÑ׫±ôÜÞ’Ý.Éô„Õ”l×¾W)_Œ–\®Oy̘¸ŽË4ÎF§ â^LŠÿMTmäè6ìCJî†òr%)«>Lú`‘¼MßlžÆ-Žx (+%0DZl´Ð—ÑèÀ"ŽÑ·.‰Ä¯ÇAŒ5Óbç‡@6ËÕ˜ö!£½þbC‡¬×–ôÝ•–^Ø.'ýrÑ"s†d>–h;œq¹Õ2\f´æñKº´ˆI3 ÇÀygùaŽ$¹ÙÀÏò,‘¾¾Œl¥hœWÆó*` Ævn:²·³Ñ¦ õþ'6l˜OÄf×ÄYƒ«''mJöL§£„ʘùÄ:!ØY©M6Ö£ ô:Ö©IoR® ™øèGþ¹&Jœ˜C[ç}DµêAl‡&X³¨6©Äh òÄÚÑÓ6Éì52yÓù<ü0Ù3÷¿f ɆQ¸æôSÿN|Ì6/Edqƒ=Ÿa{¬†ÉT6h@Ãd™ñW¡Ï*ê‘ Ìˆ.eÕ¸AƒT&š“ævQóÕÛCœ wVœ!ëS÷nýPâÌ2SïoÔ£5³þÅ®ZØ;¯j‘ßð1ª6ÀÖ_²¦®;Ä('°J°lc’Ò…wXfˆ*zº/ƒíá:p.ó¿ ¦YNaŸ.SNË BÕ5@ÓÙ·‡3ñ1döp…3W“žòÓNË  ú )Q›ZÌËlTÍÐ%`ÌüÖy@*ŒÕsŽVçÖØ³^÷b)+‹FRLž„[» ìŠËו·¸;?iMyžÖ‰;ó!žùÕzZã_P˜úö¯#{s‰½}y÷öó@ìé£,ÿ_Õ€æX×ö4Ízó™‹gI‹Ä§ f+[ëQrg¥­aaUƒA­5B”ß–S¾¨½™ÑÆ©ç˜dïb϶e™[n|Mΰ,~˲ˇ_ú-µ—ó šÑÕk@L°±›Wœ‡Îz4s¼¦È<4æ(»²¥ ®î5í”úóU· õË&ÔÙAUH%o_ϛș›‹ßîì¡â _9‰g¤¾þëØ·×9Iëœ|,±o>›ÌÿëKìuæv?7Êûë)æ§>„=k5F@h†B†ˆ©:"|â ;·ÏO’°AÍ)?´‡‚ œ9Ҡߦ1±¤'±~¹BwŠÞ‚=yLŽä ia=‰oC=?±GAÁsçŸ8Níïìɳ—1·ö¤R|ó#¨†xªIÅÛPÑ÷ÓÕ“q›•y5l`­qºbÁ䆰YO)ÚçaP1£ =UIØhý)Œ›óQ=szzM?S¤Àäg®Zƒˆë½=Êa¹<ËSžª’KV\['ööD®YƒÌ{׿gC¤Å´ûT±&—q·ÑÉåùf}Øž² YjK´‡™Äêȓ镘áÙ¥±âªEUi”}Ô$v{€ "ÄŠOÏVR‡ÏcÝ(YXX¤ó£û4#Œ +±xºHDcó ˜ºj Œ^P6;½,ž/hÚ²ËäÝøüÈmJ&É2›çB¬!5TlI¥rµŸsO/Éå|Nãw±ÿBϸdõ 22‹h¥TÍÙV,Ûek›Ÿ±H:|½w¢ÂXmg{–ЉA;Ÿl¥2™†¥Š»Ä(æ¥W>#牜ªŒþ{Jô ÄôLí8ÙTS+n\eæ-gÌgFÓ5í2Ô"Ùx³Í&yõÓLüÍç\•>MéáÅÿPK ÷d­<íAinfos/UTñÖëKux ööPK䎑 basex-7.7.2/basex-examples/000077500000000000000000000000001222453003200155405ustar00rootroot00000000000000basex-7.7.2/basex-examples/.checkstyle000066400000000000000000000012351222453003200177000ustar00rootroot00000000000000 basex-7.7.2/basex-examples/.classpath000066400000000000000000000014041222453003200175220ustar00rootroot00000000000000 basex-7.7.2/basex-examples/.gitignore000066400000000000000000000000221222453003200175220ustar00rootroot00000000000000/doc /lib /target basex-7.7.2/basex-examples/.project000066400000000000000000000016421222453003200172120ustar00rootroot00000000000000 basex-examples org.eclipse.jdt.core.javabuilder net.sf.eclipsecs.core.CheckstyleBuilder org.maven.ide.eclipse.maven2Builder org.eclipse.m2e.core.maven2Builder org.eclipse.m2e.core.maven2Nature org.maven.ide.eclipse.maven2Nature org.eclipse.jdt.core.javanature net.sf.eclipsecs.core.CheckstyleNature basex-7.7.2/basex-examples/.settings/000077500000000000000000000000001222453003200174565ustar00rootroot00000000000000basex-7.7.2/basex-examples/.settings/checkstyle.xml000066400000000000000000000120351222453003200223370ustar00rootroot00000000000000 basex-7.7.2/basex-examples/.settings/org.eclipse.core.resources.prefs000066400000000000000000000002711222453003200256710ustar00rootroot00000000000000eclipse.preferences.version=1 encoding//src/main/java=UTF-8 encoding//src/main/resources=UTF-8 encoding//src/test/java=UTF-8 encoding//src/test/resources=UTF-8 encoding/=UTF-8 basex-7.7.2/basex-examples/.settings/org.eclipse.core.runtime.prefs000066400000000000000000000001211222453003200253340ustar00rootroot00000000000000#Mon Feb 14 18:03:25 CET 2011 eclipse.preferences.version=1 line.separator=\n basex-7.7.2/basex-examples/.settings/org.eclipse.jdt.core.prefs000066400000000000000000000714501222453003200244470ustar00rootroot00000000000000#Sun Nov 27 07:43:18 CET 2011 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.doc.comment.support=enabled org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning org.eclipse.jdt.core.compiler.problem.deadCode=warning org.eclipse.jdt.core.compiler.problem.deprecation=warning org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled org.eclipse.jdt.core.compiler.problem.fieldHiding=warning org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=private org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=enabled org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore org.eclipse.jdt.core.compiler.problem.nullReference=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=enabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled org.eclipse.jdt.core.compiler.problem.unusedImport=warning org.eclipse.jdt.core.compiler.problem.unusedLabel=warning org.eclipse.jdt.core.compiler.problem.unusedLocal=warning org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore org.eclipse.jdt.core.compiler.problem.unusedParameter=warning org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.compiler.taskCaseSensitive=disabled org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL org.eclipse.jdt.core.compiler.taskTags=TODO,[CG],[AH],[LK],[CG],[MS],[DP],[LW],[JE],[DK],[MSG] org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=90 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=0 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.comment.clear_blank_lines=true org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false org.eclipse.jdt.core.formatter.comment.format_block_comments=true org.eclipse.jdt.core.formatter.comment.format_comments=false org.eclipse.jdt.core.formatter.comment.format_header=true org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true org.eclipse.jdt.core.formatter.comment.format_line_comments=true org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=do not insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert org.eclipse.jdt.core.formatter.comment.line_length=96 org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=2 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true org.eclipse.jdt.core.formatter.lineSplit=96 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=space org.eclipse.jdt.core.formatter.tabulation.size=2 org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true basex-7.7.2/basex-examples/.settings/org.eclipse.jdt.ui.prefs000066400000000000000000000053341222453003200241320ustar00rootroot00000000000000#Sat Feb 04 16:59:42 CET 2012 cleanup.add_default_serial_version_id=true cleanup.add_generated_serial_version_id=false cleanup.add_missing_annotations=true cleanup.add_missing_deprecated_annotations=true cleanup.add_missing_methods=false cleanup.add_missing_nls_tags=false cleanup.add_missing_override_annotations=true cleanup.add_missing_override_annotations_interface_methods=true cleanup.add_serial_version_id=false cleanup.always_use_blocks=true cleanup.always_use_parentheses_in_expressions=false cleanup.always_use_this_for_non_static_field_access=false cleanup.always_use_this_for_non_static_method_access=false cleanup.convert_to_enhanced_for_loop=true cleanup.correct_indentation=false cleanup.format_source_code=false cleanup.format_source_code_changes_only=false cleanup.make_local_variable_final=true cleanup.make_parameters_final=true cleanup.make_private_fields_final=true cleanup.make_type_abstract_if_missing_method=false cleanup.make_variable_declarations_final=true cleanup.never_use_blocks=false cleanup.never_use_parentheses_in_expressions=true cleanup.organize_imports=false cleanup.qualify_static_field_accesses_with_declaring_class=false cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true cleanup.qualify_static_member_accesses_with_declaring_class=true cleanup.qualify_static_method_accesses_with_declaring_class=false cleanup.remove_private_constructors=true cleanup.remove_trailing_whitespaces=false cleanup.remove_trailing_whitespaces_all=true cleanup.remove_trailing_whitespaces_ignore_empty=false cleanup.remove_unnecessary_casts=true cleanup.remove_unnecessary_nls_tags=true cleanup.remove_unused_imports=true cleanup.remove_unused_local_variables=false cleanup.remove_unused_private_fields=true cleanup.remove_unused_private_members=false cleanup.remove_unused_private_methods=true cleanup.remove_unused_private_types=true cleanup.sort_members=false cleanup.sort_members_all=false cleanup.use_blocks=false cleanup.use_blocks_only_for_return_and_throw=false cleanup.use_parentheses_in_expressions=true cleanup.use_this_for_non_static_field_access=false cleanup.use_this_for_non_static_field_access_only_if_necessary=true cleanup.use_this_for_non_static_method_access=false cleanup.use_this_for_non_static_method_access_only_if_necessary=true cleanup_profile=_BaseX cleanup_settings_version=2 eclipse.preferences.version=1 formatter_profile=_BaseX Formatter Profile formatter_settings_version=11 org.eclipse.jdt.ui.ignorelowercasenames=true org.eclipse.jdt.ui.importorder=java;javax;org;com; org.eclipse.jdt.ui.ondemandthreshold=1 org.eclipse.jdt.ui.staticondemandthreshold=1 basex-7.7.2/basex-examples/.settings/org.eclipse.ltk.core.refactoring.prefs000066400000000000000000000002111222453003200267450ustar00rootroot00000000000000#Fri Mar 19 00:48:33 CET 2010 eclipse.preferences.version=1 org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false basex-7.7.2/basex-examples/.settings/org.eclipse.m2e.core.prefs000066400000000000000000000001721222453003200243420ustar00rootroot00000000000000#Wed Aug 03 00:22:36 CEST 2011 activeProfiles= eclipse.preferences.version=1 resolveWorkspaceProjects=true version=1 basex-7.7.2/basex-examples/.settings/org.maven.ide.eclipse.prefs000066400000000000000000000004171222453003200246000ustar00rootroot00000000000000#Fri Jan 29 18:36:39 CET 2010 activeProfiles= eclipse.preferences.version=1 fullBuildGoals=process-test-resources includeModules=false resolveWorkspaceProjects=true resourceFilterGoals=process-resources resources\:testResources skipCompilerPlugin=true version=1 basex-7.7.2/basex-examples/pom.xml000066400000000000000000000035331222453003200170610ustar00rootroot00000000000000 4.0.0 basex-examples org.basex basex-parent 7.7.2 .. org.basex basex-api ${project.version} org.ccil.cowan.tagsoup tagsoup junit junit ${project.artifactId}-${project.version} org.apache.maven.plugins maven-compiler-plugin false org.apache.maven.plugins maven-jar-plugin org.apache.maven.plugins maven-surefire-plugin org.apache.maven.plugins maven-source-plugin org.apache.maven.plugins maven-checkstyle-plugin basex-7.7.2/basex-examples/src/000077500000000000000000000000001222453003200163275ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/000077500000000000000000000000001222453003200172535ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/java/000077500000000000000000000000001222453003200201745ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/java/org/000077500000000000000000000000001222453003200207635ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/java/org/basex/000077500000000000000000000000001222453003200220655ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/java/org/basex/examples/000077500000000000000000000000001222453003200237035ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/java/org/basex/examples/api/000077500000000000000000000000001222453003200244545ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/java/org/basex/examples/api/AddExample.java000066400000000000000000000034001222453003200273200ustar00rootroot00000000000000package org.basex.examples.api; import java.io.*; /** * This example shows how documents can be added to databases, and how * existing documents can be replaced. * * This example required a running database server instance. * Documentation: http://docs.basex.org/wiki/Clients * * @author BaseX Team 2005-12, BSD License */ public final class AddExample { /** * Main method. * @param args command-line arguments * @throws IOException I/O exception */ public static void main(final String[] args) throws IOException { // create session final BaseXClient session = new BaseXClient("localhost", 1984, "admin", "admin"); try { // create empty database session.execute("create db database"); System.out.println(session.info()); // define input stream InputStream bais = new ByteArrayInputStream("Hello World!".getBytes()); // add document session.add("world/world.xml", bais); System.out.println(session.info()); // define input stream bais = new ByteArrayInputStream("Hello Universe!".getBytes()); // add document session.add("universe.xml", bais); System.out.println(session.info()); // run query on database System.out.println(session.execute("xquery collection('database')")); // define input stream bais = new ByteArrayInputStream("Hello Replacement!".getBytes()); // add document session.replace("universe.xml", bais); System.out.println(session.info()); // run query on database System.out.println(session.execute("xquery collection('database')")); // drop database session.execute("drop db database"); } finally { // close session session.close(); } } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/api/BaseXClient.java000066400000000000000000000302771222453003200274710ustar00rootroot00000000000000package org.basex.examples.api; import java.io.*; import java.net.*; import java.nio.charset.*; import java.security.*; import java.util.*; /** * Java client for BaseX. * Works with BaseX 7.0 and later * * Documentation: http://docs.basex.org/wiki/Clients * * (C) BaseX Team 2005-12, BSD License */ public class BaseXClient { /** UTF-8 charset. */ static final Charset UTF8 = Charset.forName("UTF-8"); /** Event notifications. */ final Map notifiers = new HashMap(); /** Output stream. */ final OutputStream out; /** Socket. */ final Socket socket; /** Cache. */ final BufferedInputStream in; /** Command info. */ String info; /** Socket event reference. */ Socket esocket; /** Socket host name. */ String ehost; /** * Constructor. * @param host server name * @param port server port * @param user user name * @param pass password * @throws IOException Exception */ public BaseXClient(final String host, final int port, final String user, final String pass) throws IOException { socket = new Socket(); socket.connect(new InetSocketAddress(host, port), 5000); in = new BufferedInputStream(socket.getInputStream()); out = socket.getOutputStream(); ehost = host; // receive timestamp final String ts = receive(); // send {Username}0 and hashed {Password/Timestamp}0 send(user); send(md5(md5(pass) + ts)); // receive success flag if(!ok()) throw new IOException("Access denied."); } /** * Executes a command and serializes the result to an output stream. * @param cmd command * @param o output stream * @throws IOException Exception */ public void execute(final String cmd, final OutputStream o) throws IOException { // send {Command}0 send(cmd); receive(in, o); info = receive(); if(!ok()) throw new IOException(info); } /** * Executes a command and returns the result. * @param cmd command * @return result * @throws IOException Exception */ public String execute(final String cmd) throws IOException { final ByteArrayOutputStream os = new ByteArrayOutputStream(); execute(cmd, os); return new String(os.toByteArray(), UTF8); } /** * Creates a query object. * @param query query string * @return query * @throws IOException Exception */ public Query query(final String query) throws IOException { return new Query(query); } /** * Creates a database. * @param name name of database * @param input xml input * @throws IOException I/O exception */ public void create(final String name, final InputStream input) throws IOException { send(8, name, input); } /** * Adds a document to a database. * @param path path to document * @param input xml input * @throws IOException I/O exception */ public void add(final String path, final InputStream input) throws IOException { send(9, path, input); } /** * Replaces a document in a database. * @param path path to document * @param input xml input * @throws IOException I/O exception */ public void replace(final String path, final InputStream input) throws IOException { send(12, path, input); } /** * Stores a binary resource in a database. * @param path path to document * @param input xml input * @throws IOException I/O exception */ public void store(final String path, final InputStream input) throws IOException { send(13, path, input); } /** * Watches an event. * @param name event name * @param notifier event notification * @throws IOException I/O exception */ public void watch(final String name, final EventNotifier notifier) throws IOException { out.write(10); if(esocket == null) { final int eport = Integer.parseInt(receive()); // initialize event socket esocket = new Socket(); esocket.connect(new InetSocketAddress(ehost, eport), 5000); final OutputStream os = esocket.getOutputStream(); receive(in, os); os.write(0); os.flush(); final InputStream is = esocket.getInputStream(); is.read(); listen(is); } send(name); info = receive(); if(!ok()) throw new IOException(info); notifiers.put(name, notifier); } /** * Unwatches an event. * @param name event name * @throws IOException I/O exception */ public void unwatch(final String name) throws IOException { out.write(11); send(name); info = receive(); if(!ok()) throw new IOException(info); notifiers.remove(name); } /** * Returns command information. * @return string info */ public String info() { return info; } /** * Closes the session. * @throws IOException Exception */ public void close() throws IOException { send("exit"); out.flush(); if(esocket != null) esocket.close(); socket.close(); } /** * Checks the next success flag. * @return value of check * @throws IOException Exception */ boolean ok() throws IOException { out.flush(); return in.read() == 0; } /** * Returns the next received string. * @return String result or info * @throws IOException I/O exception */ String receive() throws IOException { final ByteArrayOutputStream os = new ByteArrayOutputStream(); receive(in, os); return new String(os.toByteArray(), UTF8); } /** * Sends a string to the server. * @param s string to be sent * @throws IOException I/O exception */ void send(final String s) throws IOException { out.write((s + '\0').getBytes(UTF8)); } /** * Receives a string and writes it to the specified output stream. * @param is input stream * @param os output stream * @throws IOException I/O exception */ static void receive(final InputStream is, final OutputStream os) throws IOException { for(int b; (b = is.read()) > 0;) { // read next byte if 0xFF is received os.write(b == 0xFF ? is.read() : b); } } /** * Sends a command, argument, and input. * @param cmd command * @param path path to document * @param input xml input * @throws IOException I/O exception */ private void send(final int cmd, final String path, final InputStream input) throws IOException { out.write(cmd); send(path); send(input); } /** * Starts the listener thread. * @param is input stream */ private void listen(final InputStream is) { final BufferedInputStream bi = new BufferedInputStream(is); new Thread() { @Override public void run() { try { while(true) { ByteArrayOutputStream os = new ByteArrayOutputStream(); receive(bi, os); final String name = new String(os.toByteArray(), UTF8); os = new ByteArrayOutputStream(); receive(bi, os); final String data = new String(os.toByteArray(), UTF8); notifiers.get(name).notify(data); } } catch(final IOException ex) { // loop will be quit if no data can be received anymore } } }.start(); } /** * Sends an input stream to the server. * @param input xml input * @throws IOException I/O exception */ private void send(final InputStream input) throws IOException { final BufferedInputStream bis = new BufferedInputStream(input); final BufferedOutputStream bos = new BufferedOutputStream(out); for(int b; (b = bis.read()) != -1;) { // 0x00 and 0xFF will be prefixed by 0xFF if(b == 0x00 || b == 0xFF) bos.write(0xFF); bos.write(b); } bos.write(0); bos.flush(); info = receive(); if(!ok()) throw new IOException(info); } /** * Returns an MD5 hash. * @param pw String * @return String */ private static String md5(final String pw) { final StringBuilder sb = new StringBuilder(); try { final MessageDigest md = MessageDigest.getInstance("MD5"); md.update(pw.getBytes()); for(final byte b : md.digest()) { final String s = Integer.toHexString(b & 0xFF); if(s.length() == 1) sb.append('0'); sb.append(s); } } catch(final NoSuchAlgorithmException ex) { // should not occur ex.printStackTrace(); } return sb.toString(); } /** * Inner class for iterative query execution. */ public class Query { /** Query id. */ private final String id; /** Cached results. */ private ArrayList cache; /** Cache pointer. */ private int pos; /** * Standard constructor. * @param query query string * @throws IOException I/O exception */ public Query(final String query) throws IOException { id = exec(0, query); } /** * Binds a value to an external variable. * @param name name of variable * @param value value * @throws IOException I/O exception */ public void bind(final String name, final String value) throws IOException { bind(name, value, ""); } /** * Binds a value with the specified type to an external variable. * @param name name of variable * @param value value * @param type type (can be an empty string) * @throws IOException I/O exception */ public void bind(final String name, final String value, final String type) throws IOException { cache = null; exec(3, id + '\0' + name + '\0' + value + '\0' + type); } /** * Binds a value to the context item. * @param value value * @throws IOException I/O exception */ public void context(final String value) throws IOException { context(value, ""); } /** * Binds a value with the specified type to the context item. * @param value value * @param type type (can be an empty string) * @throws IOException I/O exception */ public void context(final String value, final String type) throws IOException { cache = null; exec(14, id + '\0' + value + '\0' + type); } /** * Checks for the next item. * @return result of check * @throws IOException I/O exception */ public boolean more() throws IOException { if(cache == null) { out.write(4); send(id); cache = new ArrayList(); final ByteArrayOutputStream os = new ByteArrayOutputStream(); while(in.read() > 0) { receive(in, os); cache.add(os.toByteArray()); os.reset(); } if(!ok()) throw new IOException(receive()); pos = 0; } if(pos < cache.size()) return true; cache = null; return false; } /** * Returns the next item. * @return item string * @throws IOException I/O Exception */ public String next() throws IOException { return more() ? new String(cache.set(pos++, null), UTF8) : null; } /** * Returns the whole result of the query. * @return query result * @throws IOException I/O Exception */ public String execute() throws IOException { return exec(5, id); } /** * Returns query info in a string. * @return query info * @throws IOException I/O exception */ public String info() throws IOException { return exec(6, id); } /** * Returns serialization parameters in a string. * @return query info * @throws IOException I/O exception */ public String options() throws IOException { return exec(7, id); } /** * Closes the query. * @throws IOException I/O exception */ public void close() throws IOException { exec(2, id); } /** * Executes the specified command. * @param cmd command * @param arg argument * @return resulting string * @throws IOException I/O exception */ private String exec(final int cmd, final String arg) throws IOException { out.write(cmd); send(arg); final String s = receive(); if(!ok()) throw new IOException(receive()); return s; } } /** * Interface for event notifications. */ public interface EventNotifier { /** * Invoked when a database event was fired. * @param value event string */ void notify(final String value); } }basex-7.7.2/basex-examples/src/main/java/org/basex/examples/api/BinaryExample.java000066400000000000000000000031371222453003200300630ustar00rootroot00000000000000package org.basex.examples.api; import java.io.*; import java.util.*; /** * This example shows how binary resource can be added to and retrieved from * the database. * * This example required a running database server instance. * Documentation: http://docs.basex.org/wiki/Clients * * @author BaseX Team 2005-12, BSD License */ public final class BinaryExample { /** * Main method. * @param args command-line arguments * @throws IOException I/O exception */ public static void main(final String[] args) throws IOException { // create session final BaseXClient session = new BaseXClient("localhost", 1984, "admin", "admin"); try { // create empty database session.execute("create db database"); System.out.println(session.info()); // define input stream final byte[] bytes = new byte[256]; for(int b = 0; b < bytes.length; b++) bytes[b] = (byte) b; final ByteArrayInputStream bais = new ByteArrayInputStream(bytes); // add document session.store("test.bin", bais); System.out.println(session.info()); // receive data final ByteArrayOutputStream baos = new ByteArrayOutputStream(); session.execute("retrieve test.bin", baos); // should always yield true if(Arrays.equals(bytes, baos.toByteArray())) { System.out.println("Stored and retrieved bytes are equal."); } else { System.err.println("Stored and retrieved bytes differ!"); } // drop database session.execute("drop db database"); } finally { // close session session.close(); } } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/api/CreateExample.java000066400000000000000000000023451222453003200300420ustar00rootroot00000000000000package org.basex.examples.api; import java.io.*; /** * This example shows how new databases can be created. * * This example required a running database server instance. * Documentation: http://docs.basex.org/wiki/Clients * * @author BaseX Team 2005-12, BSD License */ public final class CreateExample { /** * Main method. * @param args command-line arguments */ public static void main(final String[] args) { try { // create session final BaseXClient session = new BaseXClient("localhost", 1984, "admin", "admin"); try { // define input stream final InputStream bais = new ByteArrayInputStream("Hello World!".getBytes()); // create new database session.create("database", bais); System.out.println(session.info()); // run query on database System.out.println(session.execute("xquery doc('database')")); // drop database session.execute("drop db database"); } catch(final IOException ex) { // print exception ex.printStackTrace(); } // close session session.close(); } catch(final IOException ex) { // print exception ex.printStackTrace(); } } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/api/EventExample.java000066400000000000000000000025771222453003200277270ustar00rootroot00000000000000package org.basex.examples.api; import java.io.*; /** * This example demonstrates how to trigger and receive database events. * * This example required a running database server instance. * Documentation: http://docs.basex.org/wiki/Clients * * @author BaseX Team 2005-12, BSD License */ public final class EventExample { /** * Main method. * @param args command-line arguments */ public static void main(final String[] args) { try { final BaseXClient session1 = new BaseXClient("localhost", 1984, "admin", "admin"); final BaseXClient session2 = new BaseXClient("localhost", 1984, "admin", "admin"); session1.execute("create event messenger"); session2.watch("messenger", new Notifier()); session2.query("for $i in 1 to 1000000 where $i = 0 return $i").execute(); session1.query("db:event('messenger', 'Hello World!')").execute(); session2.unwatch("messenger"); session1.execute("drop event messenger"); session1.close(); session2.close(); } catch(final IOException e) { e.printStackTrace(); } } /** * Implementation of the event notifier interface. */ private static class Notifier implements BaseXClient.EventNotifier { /** Constructor. */ Notifier() { } @Override public void notify(final String value) { System.out.println("Message received: " + value); } } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/api/Example.java000066400000000000000000000022571222453003200267200ustar00rootroot00000000000000package org.basex.examples.api; import java.io.*; /** * This example shows how commands can be executed on a server. * * This example required a running database server instance. * Documentation: http://docs.basex.org/wiki/Clients * * @author BaseX Team 2005-12, BSD License */ public final class Example { /** * Main method. * @param args command-line arguments */ public static void main(final String[] args) { try { // initialize timer final long time = System.nanoTime(); // create session final BaseXClient session = new BaseXClient("localhost", 1984, "admin", "admin"); // version 1: perform command and print returned string System.out.println(session.execute("info")); // version 2 (faster): perform command and pass on result to output stream final OutputStream out = System.out; session.execute("xquery 1 to 10", out); // close session session.close(); // print time needed final double ms = (System.nanoTime() - time) / 1000000d; System.out.println("\n\n" + ms + " ms"); } catch(final IOException ex) { // print exception ex.printStackTrace(); } } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/api/QueryBindExample.java000066400000000000000000000023661222453003200305440ustar00rootroot00000000000000package org.basex.examples.api; import java.io.*; /** * This example shows how external variables can be bound to XQuery expressions. * * This example required a running database server instance. * Documentation: http://docs.basex.org/wiki/Clients * * @author BaseX Team 2005-12, BSD License */ public final class QueryBindExample { /** * Main method. * @param args command-line arguments */ public static void main(final String[] args) { try { // create session final BaseXClient session = new BaseXClient("localhost", 1984, "admin", "admin"); try { // create query instance final String input = "declare variable $name external; " + "for $i in 1 to 10 return element { $name } { $i }"; final BaseXClient.Query query = session.query(input); // bind variable query.bind("$name", "number", ""); // print result System.out.print(query.execute()); // close query instance query.close(); } catch(final IOException ex) { // print exception ex.printStackTrace(); } // close session session.close(); } catch(final IOException ex) { // print exception ex.printStackTrace(); } } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/api/QueryExample.java000066400000000000000000000024741222453003200277470ustar00rootroot00000000000000package org.basex.examples.api; import java.io.*; /** * This example shows how queries can be executed in an iterative manner. * Iterative evaluation will be slower, as more server requests are performed. * * This example required a running database server instance. * Documentation: http://docs.basex.org/wiki/Clients * * @author BaseX Team 2005-12, BSD License */ public final class QueryExample { /** * Main method. * @param args command-line arguments */ public static void main(final String[] args) { try { // create session final BaseXClient session = new BaseXClient("localhost", 1984, "admin", "admin"); try { // create query instance final String input = "for $i in 1 to 10 return Text { $i }"; final BaseXClient.Query query = session.query(input); // loop through all results while(query.more()) { System.out.println(query.next()); } // print query info System.out.println(query.info()); // close query instance query.close(); } catch(final IOException ex) { // print exception ex.printStackTrace(); } // close session session.close(); } catch(final IOException ex) { // print exception ex.printStackTrace(); } } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/create/000077500000000000000000000000001222453003200251465ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/java/org/basex/examples/create/CSVExample.java000066400000000000000000000030621222453003200277610ustar00rootroot00000000000000package org.basex.examples.create; import org.basex.core.*; import org.basex.core.cmd.*; /** * This example demonstrates how to import a file in the CSV format * into the database. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class CSVExample { /** * Main test method. * @param args command-line arguments * @throws BaseXException if a database command fails */ public static void main(final String[] args) throws BaseXException { System.out.println("=== CSVExample ==="); // ------------------------------------------------------------------------ // Create database context final Context ctx = new Context(); // Input file and name of database final String file = "src/main/resources/csv/example.csv"; final String name = "csvexample"; // ------------------------------------------------------------------------ // Import the specified file System.out.println("\n* Import: \"" + file + "\"."); new Set("parser", "csv").execute(ctx); new CreateDB(name, file).execute(ctx); // ------------------------------------------------------------------------ // Perform query System.out.print("\n* Number of records: "); System.out.println(new XQuery("count(//record)").execute(ctx)); // ------------------------------------------------------------------------ // Drop database and close context System.out.println("\n* Drop database."); new DropDB(name).execute(ctx); ctx.close(); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/create/HTMLExample.java000066400000000000000000000034321222453003200300730ustar00rootroot00000000000000package org.basex.examples.create; import org.basex.core.*; import org.basex.core.cmd.*; /** * This example demonstrates how to import a file in the HTML format * into the database. The specified input file will be converted to XML * if TagSoup is found in the classpath. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class HTMLExample { /** * Main test method. * @param args command-line arguments * @throws BaseXException if a database command fails */ public static void main(final String[] args) throws BaseXException { System.out.println("=== HTMLExample ==="); // ------------------------------------------------------------------------ // Create database context final Context ctx = new Context(); // Input file and name of database final String file = "http://news.google.com/index.html"; final String name = "htmlexample"; // ------------------------------------------------------------------------ // Import the specified file System.out.println("\n* Import: \"" + file + "\"."); new Set(Prop.PARSER, "html").execute(ctx); new CreateDB(name, file).execute(ctx); // ------------------------------------------------------------------------ // Perform query System.out.println("\n* First 10 headlines:"); String query = "(for $i in //*:h2/*:a/*:span[@class='titletext']" + "return { $i/text() })[position() <= 10]"; System.out.println(new XQuery(query).execute(ctx)); // ------------------------------------------------------------------------ // Drop database and close context System.out.println("\n* Drop database."); new DropDB(name).execute(ctx); ctx.close(); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/create/SimpleFSExample.java000066400000000000000000000023701222453003200310110ustar00rootroot00000000000000package org.basex.examples.create; import org.basex.build.*; import org.basex.core.*; import org.basex.core.cmd.*; /** * This example demonstrates a simple filesystem parser. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class SimpleFSExample { /** Private constructor. */ private SimpleFSExample() { } /** * Main test method. * @param args command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { System.out.println("=== SimpleFSExample ==="); // create database context final Context ctx = new Context(); System.out.println("\n* Import a directory."); // input path and name of database final String path = "."; final String name = "fsexample"; final Parser parser = new SimpleFSParser(path, ctx.prop); final CreateDB create = new CreateDB(name); create.setParser(parser); create.execute(ctx); System.out.println("\n* Number of created elements:"); new Open(name).execute(ctx); new XQuery(".").execute(ctx, System.out); System.out.println("\n\n* Drop database."); new DropDB(name).execute(ctx); ctx.close(); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/create/SimpleFSParser.java000066400000000000000000000043231222453003200306520ustar00rootroot00000000000000package org.basex.examples.create; import static org.basex.util.Token.*; import java.io.*; import org.basex.build.*; import org.basex.core.*; /** * This class serves as a simple filesystem parser and creates an XML * representation, which resembles the DeepFS markup. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class SimpleFSParser extends Parser { /** FS Token. */ private static final byte[] DIR = token("dir"); /** FS Token. */ private static final byte[] FILE = token("file"); /** FS Token. */ private static final byte[] FSML = token("fsml"); /** FS Token. */ private static final byte[] MTIME = token("mtime"); /** FS Token. */ private static final byte[] NAME = token("name"); /** FS Token. */ private static final byte[] SIZE = token("size"); /** FS Token. */ private static final byte[] SUFFIX = token("suffix"); /** * Constructor. * @param path file path * @param pr database properties */ public SimpleFSParser(final String path, final Prop pr) { super(path, pr); } @Override public void parse(final Builder b) throws IOException { b.openDoc(token(src.name())); b.openElem(FSML, atts.clear(), nsp.clear()); parse(new File(src.path()), b); b.closeElem(); b.closeDoc(); } /** * Recursively parses the specified directory. * @param dir directory to be parsed * @param b builder instance * @throws IOException I/O exception */ private void parse(final File dir, final Builder b) throws IOException { atts.clear(); atts.add(NAME, token(dir.getName())); atts.add(MTIME, token(dir.lastModified())); b.openElem(DIR, atts, nsp); for(final File f : dir.listFiles()) { if(f.isDirectory()) { parse(f, b); } else { atts.clear(); final String name = f.getName(); atts.add(NAME, token(name)); atts.add(SIZE, token(f.length())); atts.add(MTIME, token(f.lastModified())); int i = name.lastIndexOf('.'); if(i != -1) atts.add(SUFFIX, token(name.substring(i + 1))); b.emptyElem(FILE, atts, nsp); } } b.closeElem(); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/create/package.html000066400000000000000000000001011222453003200274170ustar00rootroot00000000000000 Contains examples for using different parsers. basex-7.7.2/basex-examples/src/main/java/org/basex/examples/local/000077500000000000000000000000001222453003200247755ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/java/org/basex/examples/local/BindContext.java000066400000000000000000000040641222453003200300650ustar00rootroot00000000000000package org.basex.examples.local; import org.basex.core.*; import org.basex.data.*; import org.basex.query.*; /** * This example demonstrates how items can be bound as context item of * the XQuery processor. * * @author BaseX Team 2005-12, BSD License */ public final class BindContext { /** * Runs the example code. * @param args (ignored) command-line arguments * @throws QueryException if an error occurs while evaluating the query */ public static void main(final String[] args) throws QueryException { // Database context. Context context = new Context(); System.out.println("=== BindContext ==="); // ------------------------------------------------------------------------ // Specify query to be executed String query = "declare context item external; ."; // ------------------------------------------------------------------------ // Show query System.out.println("\n* Query:"); System.out.println(query); // ------------------------------------------------------------------------ // Create a query processor QueryProcessor proc = new QueryProcessor(query, context); // ------------------------------------------------------------------------ // Define the items to be bound String item = "Hello World!\n"; // ------------------------------------------------------------------------ // Bind the variables proc.context(item); // ------------------------------------------------------------------------ // Execute the query Result result = proc.execute(); // ------------------------------------------------------------------------ // Print result as string System.out.println("\n* Result:"); System.out.println(result); // ------------------------------------------------------------------------ // Close the query processor proc.close(); // ------------------------------------------------------------------------ // Close the database context context.close(); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/local/BindVariables.java000066400000000000000000000043511222453003200303500ustar00rootroot00000000000000package org.basex.examples.local; import org.basex.core.*; import org.basex.data.*; import org.basex.query.*; /** * This example demonstrates how items can be bound to variables with * the XQuery processor. * * @author BaseX Team 2005-12, BSD License */ public final class BindVariables { /** * Runs the example code. * @param args (ignored) command-line arguments * @throws QueryException if an error occurs while evaluating the query */ public static void main(final String[] args) throws QueryException { // Database context. Context context = new Context(); System.out.println("=== BindVariable ==="); // ------------------------------------------------------------------------ // Specify query to be executed String query = "declare variable $var1 as xs:string external;\n" + "declare variable $var2 external;\n" + "($var1, $var2)"; // ------------------------------------------------------------------------ // Show query System.out.println("\n* Query:"); System.out.println(query); // ------------------------------------------------------------------------ // Create a query processor QueryProcessor proc = new QueryProcessor(query, context); // ------------------------------------------------------------------------ // Define the items to be bound String string = "Hello World!\n"; String number = "123"; // ------------------------------------------------------------------------ // Bind the variables proc.bind("var1", string); proc.bind("var2", number, "xs:integer"); // ------------------------------------------------------------------------ // Execute the query Result result = proc.execute(); System.out.println("\n* Result:"); // ------------------------------------------------------------------------ // Print result as string System.out.println(result); // ------------------------------------------------------------------------ // Close the query processor proc.close(); // ------------------------------------------------------------------------ // Close the database context context.close(); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/local/CreateCollection.java000066400000000000000000000052321222453003200310610ustar00rootroot00000000000000package org.basex.examples.local; import org.basex.core.*; import org.basex.core.cmd.*; /** * This class shows the basic usage of the BaseX collection commands. * Collections provide access to several XML documents inside one database. * Collections may be created by importing a folder or adding single files. * For some XQuery examples in a collection context, * please see {@link QueryCollection} * * @author BaseX Team 2005-12, BSD License * @author BaseXTeam */ public final class CreateCollection { /** * Runs the example code. * @param args (ignored) command-line arguments * @throws BaseXException if a database command fails */ public static void main(final String[] args) throws BaseXException { // Create database context Context context = new Context(); System.out.println("=== CreateCollection ==="); // ------------------------------------------------------------------------ // You can modify the CREATEFILTER property to import XML // files with suffixes other than XML (for example KML): new Set("CREATEFILTER", "*.xml").execute(context); // Variant 1 -------------------------------------------------------------- // Create a collection and add all documents within the specified path System.out.println("\n* Create a collection."); new CreateDB("Collection", "src/main/resources/").execute(context); new DropDB("Collection").execute(context); // Variant 2 -------------------------------------------------------------- // Or: Create an empty collection, add documents in a second pass // and optimize the database to refresh the index structures System.out.println("\n* Create an empty collection and add documents."); new CreateDB("Collection").execute(context); new Add("", "src/main/resources/").execute(context); new Optimize().execute(context); // ------------------------------------------------------------------------ // Remove a single document from the collection System.out.println("\n* Remove a single document."); new Delete("test.xml").execute(context); // ------------------------------------------------------------------------ // Show information on the currently opened database System.out.println("\n* Show database information:"); System.out.println(new InfoDB().execute(context)); // ------------------------------------------------------------------------ // Drop the database System.out.println("\n* Drop the collection."); new DropDB("Collection").execute(context); // ------------------------------------------------------------------------ // Close the database context context.close(); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/local/QueryCollection.java000066400000000000000000000043241222453003200307640ustar00rootroot00000000000000package org.basex.examples.local; import org.basex.core.*; import org.basex.core.cmd.*; /** * This class demonstrates collection relevant queries. * It shows how to find and query specific documents. * * @author BaseX Team 2005-12, BSD License */ public final class QueryCollection { /** * Runs the example code. * @param args (ignored) command-line arguments * @throws BaseXException if a database command fails */ public static void main(final String[] args) throws BaseXException { // Database context. Context context = new Context(); System.out.println("=== QueryCollection ==="); // ------------------------------------------------------------------------ // Create a collection from all XML documents in the specified directory System.out.println("\n* Create a collection."); new CreateDB("Collection", "src/main/resources/").execute(context); // ------------------------------------------------------------------------ // List all documents in the database System.out.println("\n* List all documents in the database:"); // The XQuery base-uri() function returns a file path System.out.println(new XQuery( "for $doc in collection('Collection')" + "return " ).execute(context)); // ------------------------------------------------------------------------ // Evaluate a query on a single document System.out.println("\n* Evaluate a query on a single document:"); // If the name of the database is omitted in the collection() function, // the currently opened database will be referenced System.out.println(new XQuery( "for $doc in collection()" + "let $file-path := base-uri($doc)" + "where ends-with($file-path, 'factbook.xml')" + "return concat($file-path, ' has ', count($doc//*), ' elements')" ).execute(context)); // ------------------------------------------------------------------------ // Drop the database System.out.println("\n* Drop the database."); new DropDB("Collection").execute(context); // ------------------------------------------------------------------------ // Close the database context context.close(); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/local/RunCommands.java000066400000000000000000000050261222453003200300710ustar00rootroot00000000000000package org.basex.examples.local; import org.basex.core.*; import org.basex.core.cmd.*; /** * This class demonstrates database creation and dropping. * It then shows how to add indexes to the database and retrieve * some information on the database structures. * * @author BaseX Team 2005-12, BSD License */ public final class RunCommands { /** * Runs the example code. * @param args (ignored) command-line arguments * @throws BaseXException if a database command fails */ public static void main(final String[] args) throws BaseXException { // Database context. Context context = new Context(); System.out.println("=== RunCommands ==="); // ------------------------------------------------------------------------ // Create a database from a local or remote XML document or XML String System.out.println("\n* Create a database."); new CreateDB("DBExample", "src/main/resources/xml/input.xml").execute(context); // ------------------------------------------------------------------------ // Close and reopen the database System.out.println("\n* Close and reopen database."); new Close().execute(context); new Open("DBExample").execute(context); // ------------------------------------------------------------------------ // Additionally create a full-text index System.out.println("\n* Create a full-text index."); new CreateIndex("fulltext").execute(context); // ------------------------------------------------------------------------ // Show information on the currently opened database System.out.println("\n* Show database information:"); System.out.print(new InfoDB().execute(context)); // ------------------------------------------------------------------------ // Drop indexes to save disk space System.out.println("\n* Drop indexes."); new DropIndex("text").execute(context); new DropIndex("attribute").execute(context); new DropIndex("fulltext").execute(context); // ------------------------------------------------------------------------ // Drop the database System.out.println("\n* Drop the database."); new DropDB("DBExample").execute(context); // ------------------------------------------------------------------------ // Show all existing databases System.out.println("\n* Show existing databases:"); System.out.print(new List().execute(context)); // ------------------------------------------------------------------------ // Close the database context context.close(); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/local/RunQueries.java000066400000000000000000000141361222453003200277470ustar00rootroot00000000000000package org.basex.examples.local; import java.io.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.item.*; /** * This example demonstrates three variants how XQuery expressions can be * evaluated. * * @author BaseX Team 2005-12, BSD License */ public final class RunQueries { /** Database context. */ static Context context = new Context(); /** * Runs the example code. * @param args (ignored) command-line arguments * @throws IOException if an error occurs while serializing the results * @throws QueryException if an error occurs while evaluating the query * @throws BaseXException if a database command fails */ public static void main(final String[] args) throws IOException, QueryException { System.out.println("=== RunQueries ==="); // ------------------------------------------------------------------------ // Evaluate the specified XQuery String query = "for $x in doc('src/main/resources/xml/input.xml')//li return data($x)"; // ------------------------------------------------------------------------ // Process the query by using the database command System.out.println("\n* Use the database command:"); query(query); // ------------------------------------------------------------------------ // Directly use the query processor System.out.println("\n* Use the query processor:"); process(query); // ------------------------------------------------------------------------ // Iterate through all query results System.out.println("\n* Serialize each single result:"); serialize(query); // ------------------------------------------------------------------------ // Iterate through all query results System.out.println("\n* Convert each result to its Java representation:"); iterate(query); // Uncomment this line to see how erroneous queries are handled // iterate("for error s$x in . return $x"); // ------------------------------------------------------------------------ // Flush output System.out.println(); } /** * This method evaluates a query by using the database command. * The results are automatically serialized and printed. * @param query query to be evaluated * @throws BaseXException if a database command fails */ static void query(final String query) throws BaseXException { System.out.println(new XQuery(query).execute(context)); } /** * This method uses the {@link QueryProcessor} to evaluate a query. * The resulting items are passed on to an {@link XMLSerializer} instance. * @param query query to be evaluated * @throws QueryException if an error occurs while evaluating the query */ static void process(final String query) throws QueryException { // ------------------------------------------------------------------------ // Create a query processor QueryProcessor proc = new QueryProcessor(query, context); // ------------------------------------------------------------------------ // Execute the query Result result = proc.execute(); // ------------------------------------------------------------------------ // Print result as string. System.out.println(result); // ------------------------------------------------------------------------ // Close the query processor proc.close(); } /** * This method uses the {@link QueryProcessor} to evaluate a query. * The results are iterated one by one and converted to their Java * representation, using {{@link Item#toJava()}. This variant is especially * efficient if large result sets are expected. * @param query query to be evaluated * @throws QueryException if an error occurs while evaluating the query */ static void iterate(final String query) throws QueryException { // ------------------------------------------------------------------------ // Create a query processor QueryProcessor proc = new QueryProcessor(query, context); // ------------------------------------------------------------------------ // Store the pointer to the result in an iterator: Iter iter = proc.iter(); // ------------------------------------------------------------------------ // Iterate through all items and serialize for(Item item; (item = iter.next()) != null;) { System.out.println(item.toJava()); } // ------------------------------------------------------------------------ // Close the query processor proc.close(); } /** * This method uses the {@link QueryProcessor} to evaluate a query. * The results are iterated one by one and passed on to an * {@link XMLSerializer} instance. This variant is especially * efficient if large result sets are expected. * @param query query to be evaluated * @throws QueryException if an error occurs while evaluating the query * @throws IOException if an error occurs while serializing the results */ static void serialize(final String query) throws QueryException, IOException { // ------------------------------------------------------------------------ // Create a query processor QueryProcessor proc = new QueryProcessor(query, context); // ------------------------------------------------------------------------ // Store the pointer to the result in an iterator: Iter iter = proc.iter(); // ------------------------------------------------------------------------ // Create a serializer instance Serializer ser = proc.getSerializer(System.out); // ------------------------------------------------------------------------ // Iterate through all items and serialize contents for(Item item; (item = iter.next()) != null;) { ser.serialize(item); } // ------------------------------------------------------------------------ // Close the serializer ser.close(); System.out.println(); // ------------------------------------------------------------------------ // Close the query processor proc.close(); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/local/WikiExample.java000066400000000000000000000047351222453003200300700ustar00rootroot00000000000000package org.basex.examples.local; import org.basex.core.*; import org.basex.core.cmd.*; /** * This example demonstrates how databases can be created from remote XML * documents, and how XQuery can be used to locally update the document and * perform full-text requests. * * @author BaseX Team 2005-12, BSD License */ public final class WikiExample { /** * Runs the example code. * @param args (ignored) command-line arguments * @throws BaseXException if a database command fails */ public static void main(final String[] args) throws BaseXException { // Database context. Context context = new Context(); System.out.println("=== WikiExample ==="); // ---------------------------------------------------------------------- // Create a database from a remote XML document System.out.println("\n* Create a database from a file via http."); // Use internal parser to skip DTD parsing new Set("intparse", true).execute(context); final String doc = "http://en.wikipedia.org/wiki/Wikipedia"; new CreateDB("WikiExample", doc).execute(context); // ------------------------------------------------------------------------- // Insert a node before the closing body tag // N.B. do not forget to specify the namespace System.out.println("\n* Update the document."); new XQuery( "declare namespace xhtml='http://www.w3.org/1999/xhtml';" + "insert node " + "

    I will match the following query because I contain " + "the terms 'ARTICLE' and 'EDITABLE'. :-)

    " + "into //body" ).execute(context); // ---------------------------------------------------------------------- // Match all paragraphs' textual contents against // 'edit.*' AND ('article' or 'page') System.out.println("\n* Perform a full-text query:"); System.out.println(new XQuery( "declare namespace xhtml='http://www.w3.org/1999/xhtml';" + "for $x in //p/text()" + "where $x contains text ('edit.*' ftand ('article' ftor 'page')) " + " using wildcards distance at most 10 words " + "return

    { $x }

    " ).execute(context)); // ---------------------------------------------------------------------- // Drop the database System.out.println("\n* Drop the database."); new DropDB("WikiExample").execute(context); // ------------------------------------------------------------------------ // Close the database context context.close(); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/local/package.html000066400000000000000000000001031222453003200272500ustar00rootroot00000000000000 Contains examples for using the query processor. basex-7.7.2/basex-examples/src/main/java/org/basex/examples/module/000077500000000000000000000000001222453003200251705ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/java/org/basex/examples/module/FruitsExample.java000066400000000000000000000040061222453003200306230ustar00rootroot00000000000000package org.basex.examples.module; import org.basex.core.*; import org.basex.data.*; import org.basex.query.*; /** * This example demonstrates how Java classes can be imported as XQuery modules. * * @author BaseX Team 2005-12, BSD License */ public final class FruitsExample { /** * Runs the example code. * * @param args (ignored) command-line arguments * @throws QueryException if an error occurs while evaluating the query */ public static void main(final String[] args) throws QueryException { // Database context. Context context = new Context(); System.out.println("=== FruitsExample ==="); // ------------------------------------------------------------------------ // Specify query to be executed String query = "import module namespace fruits = " + "'java:org.basex.examples.module.FruitsModule'; \n" + "element convenient {\n" + " for $i in 1 to 4\n" + " return fruits:convenient(xs:int($i))\n" + "},\n" + "element fast {\n" + " for $i in 1 to 4\n" + " return fruits:fast($i)\n" + "},\n" + "element functions { fruits:functionNamespace() }"; System.out.println("\n* Query:"); System.out.println(query); // ------------------------------------------------------------------------ // Create a query processor QueryProcessor processor = new QueryProcessor(query, context); // ------------------------------------------------------------------------ // Execute the query Result result = processor.execute(); System.out.println("\n* Result:"); // ------------------------------------------------------------------------ // Print result as string System.out.println(result); // ------------------------------------------------------------------------ // Close the query processor processor.close(); // ------------------------------------------------------------------------ // Close the database context context.close(); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/module/FruitsModule.java000066400000000000000000000026451222453003200304640ustar00rootroot00000000000000package org.basex.examples.module; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.util.*; /** * This is a simple demo module called by {link {@link FruitsExample}. * It is derived from the {@link QueryModule} class. * * @author BaseX Team 2005-12, BSD License */ public class FruitsModule extends QueryModule { /** Fruits array. */ private static final String[] FRUITS = { "Apple", "Banana", "Cherry" }; /** * Returns the specified fruit. * This variant is more convenient, as it uses Java's standard data types. * * @param fruit index of fruit to be returned * @return fruit string */ @Deterministic @Requires(Permission.READ) public String convenient(final int fruit) { final int i = fruit; final String f = FRUITS[i % FRUITS.length]; return f; } /** * Returns the specified fruit. * This variant is faster, as it uses the internal data types of BaseX. * * @param fruit index of fruit to be returned * @return fruit string */ @Deterministic @Requires(Permission.READ) public Str fast(final Int fruit) { final int i = (int) fruit.itr(); final String f = FRUITS[i % FRUITS.length]; return Str.get(f); } /** * Context-aware function: returns the default function namespace of this query. * @return function namespace */ public String functionNamespace() { return Token.string(context.sc.funcNS); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/module/ModuleDemo.java000066400000000000000000000042371222453003200300730ustar00rootroot00000000000000package org.basex.examples.module; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; /** * This is a simple XQuery demo module that demonstrates how XQuery items can be * processed from Java. It is derived from the {@link QueryModule} class. * * If the class is in the classpath of the executed BaseX instance, it can be addressed * as follows: * *
     * import module namespace demo = 'http://basex.org/examples/module/module-demo';
     * demo:name(demo:create()),
     * ...
     * 
    */ public class ModuleDemo extends QueryModule { /** * Creates a new example node. * @return node */ public ANode create() { FDoc doc = new FDoc("http://www.example.com"); FElem elem = new FElem("root").add("attr", "value"); doc.add(elem); return doc; } /** * Returns the QName of a node. * @param node input node * @return qname */ public QNm name(final ANode node) { return node.qname(); } /** * Creates a new node sequence. * @return resulting value */ public Value sequence() { FElem elem1 = new FElem("root1"); FElem elem2 = new FElem("root2"); ValueBuilder vb = new ValueBuilder(); vb.add(elem1); vb.add(elem2); return vb.value(); } /** * Creates a sequence with parts of the input. * @param value value * @return resulting value */ public Value value(final Value value) { ValueBuilder vb = new ValueBuilder(); for(final Item item : value) { if(item instanceof AStr) { vb.add(item); } else if(item instanceof ANode) { ANode node = (ANode) item; vb.add(node.qname()); } } return vb.value(); } /** * Returns all id values of the specified database nodes. * @param value value * @return resulting value */ public Value dbnodes(final Value value) { ValueBuilder vb = new ValueBuilder(); for(final Item item : value) { if(item instanceof DBNode) { DBNode node = (DBNode) item; int id = node.data.id(node.pre); vb.add(Int.get(id)); } } return vb.value(); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/package.html000066400000000000000000000001001222453003200261530ustar00rootroot00000000000000 Contains examples for using the project code. basex-7.7.2/basex-examples/src/main/java/org/basex/examples/rest/000077500000000000000000000000001222453003200246605ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/java/org/basex/examples/rest/RESTAll.java000066400000000000000000000017201222453003200267310ustar00rootroot00000000000000package org.basex.examples.rest; import org.basex.*; /** * This class runs all REST examples. * It shows the function of the HTTP DELETE method. * * @author BaseX Team 2005-12, BSD License */ public final class RESTAll { /** * This method demonstrates the available DELETE method. In this example, an * an XML database is deleted. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { // Start servers final BaseXHTTP http = new BaseXHTTP(); // Create a database // Run all REST examples RESTPut.run(); System.out.println(); // Send a query via GET RESTGet.run(); System.out.println(); // Send a query via POST RESTPost.run(); System.out.println(); // Delete a document RESTDelete.run(); System.out.println(); // Stop servers http.stop(); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/rest/RESTDelete.java000066400000000000000000000035531222453003200274310ustar00rootroot00000000000000package org.basex.examples.rest; import java.io.*; import java.net.*; import org.basex.*; /** * This class is a simple example to demonstrate the REST implementation. * It shows the function of the HTTP DELETE method. * * @author BaseX Team 2005-12, BSD License */ public final class RESTDelete { /** * Runs the example. * @throws IOException I/O exception */ static void run() throws IOException { System.out.println("=== DELETE: delete a document or database ==="); // The java URL connection to the resource URL url = new URL("http://localhost:8984/rest/factbook/input.xml"); System.out.println("\n* URL: " + url); // Establish the connection to the URL HttpURLConnection conn = (HttpURLConnection) url.openConnection(); // Set as DELETE request conn.setRequestMethod("DELETE"); // Print the HTTP response code System.out.println("\n* HTTP response: " + conn.getResponseCode() + " (" + conn.getResponseMessage() + ')'); // The java URL connection to the resource url = new URL("http://localhost:8984/rest/factbook"); System.out.println("\n* URL: " + url); // Establish the connection to the URL conn = (HttpURLConnection) url.openConnection(); // Set as DELETE request conn.setRequestMethod("DELETE"); // Print the HTTP response code System.out.println("\n* HTTP response: " + conn.getResponseCode() + " (" + conn.getResponseMessage() + ')'); // Close connection conn.disconnect(); } /** * Main method. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String... args) throws Exception { // Start server final BaseXHTTP http = new BaseXHTTP(); // Run example run(); // Stop server http.stop(); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/rest/RESTGet.java000066400000000000000000000035121222453003200267410ustar00rootroot00000000000000package org.basex.examples.rest; import java.io.*; import java.net.*; import org.basex.*; /** * This class is a simple example to demonstrate the REST implementation. * It shows the function of the HTTP GET method. * * @author BaseX Team 2005-12, BSD License */ public final class RESTGet { /** * Runs the example. * @throws IOException I/O exception */ static void run() throws IOException { System.out.println("=== GET: execute a query ==="); // The java URL connection to the resource String base = "http://localhost:8984/rest/"; URL url = new URL(base + "factbook?query=(//city/name)[position()=1+to+5]"); System.out.println("\n* URL: " + url); // Establish the connection to the URL HttpURLConnection conn = (HttpURLConnection) url.openConnection(); // Print the HTTP response code int code = conn.getResponseCode(); System.out.println("\n* HTTP response: " + code + " (" + conn.getResponseMessage() + ')'); // Check if request was successful if(code == HttpURLConnection.HTTP_OK) { // Print the received result to standard output System.out.println("\n* Result:"); // Get and cache input as UTF-8 encoded stream BufferedReader br = new BufferedReader(new InputStreamReader( conn.getInputStream(), "UTF-8")); // Print all lines of the result for(String line; (line = br.readLine()) != null;) { System.out.println(line); } br.close(); } // Close connection conn.disconnect(); } /** * Main method. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String... args) throws Exception { // Start servers final BaseXHTTP http = new BaseXHTTP(); // Run example run(); // Stop servers http.stop(); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/rest/RESTPost.java000066400000000000000000000050531222453003200271510ustar00rootroot00000000000000package org.basex.examples.rest; import java.io.*; import java.net.*; import org.basex.*; /** * This class is a simple example to demonstrate the REST implementation. * It shows the function of the HTTP DELETE method. * * @author BaseX Team 2005-12, BSD License */ public final class RESTPost { /** * Runs the example. * @throws IOException I/O exception */ static void run() throws IOException { System.out.println("=== POST: execute a query ==="); // The java URL connection to the resource URL url = new URL("http://localhost:8984/rest/factbook"); System.out.println("\n* URL: " + url); // Query to be sent to the server String request = "\n" + " (//city/name)[position() le 3]\n" + " \n" + ""; System.out.println("\n* Query:\n" + request); // Establish the connection to the URL HttpURLConnection conn = (HttpURLConnection) url.openConnection(); // Set an output connection conn.setDoOutput(true); // Set as PUT request conn.setRequestMethod("POST"); // Specify content type conn.setRequestProperty("Content-Type", "application/query+xml"); // Get and cache output stream OutputStream out = conn.getOutputStream(); // Send UTF-8 encoded query to server out.write(request.getBytes("UTF-8")); out.close(); // Print the HTTP response code int code = conn.getResponseCode(); System.out.println("\n* HTTP response: " + code + " (" + conn.getResponseMessage() + ')'); // Check if request was successful if(code == HttpURLConnection.HTTP_OK) { // Print the received result to standard output (same as GET request) System.out.println("\n* Result:"); // Get and cache input as UTF-8 encoded stream BufferedReader br = new BufferedReader(new InputStreamReader( conn.getInputStream(), "UTF-8")); // Print all lines of the result for(String line; (line = br.readLine()) != null;) { System.out.println(line); } br.close(); } // Close connection conn.disconnect(); } /** * Main method. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String... args) throws Exception { // Start servers final BaseXHTTP http = new BaseXHTTP(); // Run example run(); // Stop servers http.stop(); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/rest/RESTPut.java000066400000000000000000000035431222453003200267760ustar00rootroot00000000000000package org.basex.examples.rest; import java.io.*; import java.net.*; import org.basex.*; /** * This class is a simple example to demonstrate the REST implementation. * It shows the function of the HTTP PUT method. * * @author BaseX Team 2005-12, BSD License */ public final class RESTPut { /** * Runs the example. * @throws IOException I/O exception */ static void run() throws IOException { System.out.println("=== PUT: create a new database ==="); // The java URL connection to the resource URL url = new URL("http://localhost:8984/rest/factbook"); System.out.println("\n* URL: " + url); // Establish the connection to the URL HttpURLConnection conn = (HttpURLConnection) url.openConnection(); // Set an output connection conn.setDoOutput(true); // Set as PUT request conn.setRequestMethod("PUT"); // Get and cache output stream OutputStream out = new BufferedOutputStream(conn.getOutputStream()); // Create and cache file input stream InputStream in = new BufferedInputStream( new FileInputStream("src/main/resources/xml/factbook.xml")); // Send document to server System.out.println("\n* Send document..."); for(int i; (i = in.read()) != -1;) out.write(i); in.close(); out.close(); // Print the HTTP response code System.out.println("\n* HTTP response: " + conn.getResponseCode() + " (" + conn.getResponseMessage() + ')'); // Close connection conn.disconnect(); } /** * Main method. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String... args) throws Exception { // Start servers final BaseXHTTP http = new BaseXHTTP(); // Run example run(); // Stop servers http.stop(); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/rest/package.html000066400000000000000000000000741222453003200271420ustar00rootroot00000000000000 Contains examples for using the REST API. basex-7.7.2/basex-examples/src/main/java/org/basex/examples/server/000077500000000000000000000000001222453003200252115ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/java/org/basex/examples/server/ServerAndLocal.java000066400000000000000000000063541222453003200307300ustar00rootroot00000000000000package org.basex.examples.server; import java.io.*; import org.basex.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.examples.local.*; import org.basex.server.*; /** * This class sends a query to a database server instance. * The query result is used to create and query a local database. * For more information on server functionalities, see {@link ServerCommands} * For more information on local query processing, see {@link RunQueries}. * * @author BaseX Team 2005-12, BSD License */ public final class ServerAndLocal { /** Local database context. */ static final Context CONTEXT = new Context(); /** Reference to the client session. */ static ClientSession session; /** * Runs the example code. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { System.out.println("=== ServerAndLocal ==="); // ------------------------------------------------------------------------ // Start server System.out.println("\n* Start server."); BaseXServer server = new BaseXServer(); // ------------------------------------------------------------------------ // Create a client session with host name, port, user name and password System.out.println("\n* Create a client session."); session = new ClientSession("localhost", 1984, "admin", "admin"); // ------------------------------------------------------------------------- // Locally cache the result of a server-side query System.out.println("\n* Cache server-side query results."); String result = send( "XQUERY for $x in doc('src/main/resources/xml/input.xml') return $x"); // ------------------------------------------------------------------------- // Create a local database from the XML result string System.out.println("\n* Create a local database."); new CreateDB("LocalDB", result).execute(CONTEXT); // ------------------------------------------------------------------------- // Run a query on the locally cached results System.out.print("\n* Run a local query: "); System.out.println(new XQuery("//title").execute(CONTEXT)); // ------------------------------------------------------------------------ // Close the client session System.out.println("\n* Close the client session."); session.close(); // ------------------------------------------------------------------------ // Stop the server System.out.println("\n* Stop the server."); server.stop(); // ---------------------------------------------------------------------- // Drop the local database System.out.println("\n* Drop the local database."); new DropDB("LocalDB").execute(CONTEXT); } /** * Executes the specified command on the server and writes the * response to out. * Command info is printed to System.out by default. * @param command command to be executed * @return string result of command * @throws IOException I/O exception */ private static String send(final String command) throws IOException { // ------------------------------------------------------------------------ // Execute the command return session.execute(command); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/server/ServerCollection.java000066400000000000000000000103321222453003200313350ustar00rootroot00000000000000package org.basex.examples.server; import java.io.*; import org.basex.*; import org.basex.core.cmd.*; import org.basex.examples.local.*; import org.basex.server.*; /** * This class demonstrates database access via the client/server architecture. * It shows how to {@link #add(String, String)} and {@link #modify()} files. * For further options see {@link QueryCollection}. * * @author BaseX Team 2005-12, BSD License */ public final class ServerCollection { /** Session reference. */ static ClientSession session; /** XML Document Fragment Pt. 1. */ static final String XML_1 = "" + "Chapter "; /** XML Document Fragment Pt. 2. */ static final String XML_2 = ""; /** * Runs the example code. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { System.out.println("=== ServerCollection ==="); // ------------------------------------------------------------------------ // Start server System.out.println("\n* Start server."); BaseXServer server = new BaseXServer(); // Create a client session with host name, port, user name and password session = new ClientSession("localhost", 1984, "admin", "admin"); // ------------------------------------------------------------------------ System.out.println("\n* Create a Collection."); session.execute("CREATE DB input"); // ------------------------------------------------------------------------ // Add some 50 documents System.out.println("\n* Adding 50 documents"); for(int i = 0; i < 50; i++) { String path = "/book/chapters/" + i + "/Chapter-" + i + ".xml"; add(path, XML_1 + i + XML_2); } // Add another Test Document in folder /book/chapters/0 String path = "/book/chapters/0/Chapter-test.xml"; add(path, XML_1 + "test" + XML_2); // ------------------------------------------------------------------------ // Find some documents using the collection command find(); // ------------------------------------------------------------------------ // Modify specific document(s) System.out.println("\n* Modifying documents in folder /book/chapters/0:"); modify(); // ------------------------------------------------------------------------ // Drop the database session.execute("DROP DB input"); // ------------------------------------------------------------------------ // Close the client session session.close(); // ------------------------------------------------------------------------ // Stop the server System.out.println("\n* Stop server."); server.stop(); } /** * This Methods performs a simple path based search in a collection. * @throws IOException I/O exception */ private static void find() throws IOException { // ------------------------------------------------------------------------ System.out.println("\n* Finding documents in folder /book/chapters/0:"); System.out.println(session.execute( new XQuery( "for $doc in collection('input/book/chapters/0') " + "return $doc"))); } /** * This method shows how to modify multiple documents at once. * It replaces the title of the matching documents with 1 2 3. * @throws IOException I/O exception */ private static void modify() throws IOException { session.execute(new XQuery( "for $doc in collection('input/book/chapters/0/')" + " return " + "replace value of node $doc/text/title " + "with (1 to 3)")); // Validate result System.out.println(session.execute(new XQuery( "for $doc in collection('input/book/chapters/0')" + " return $doc"))); } /** * Adds a document to the collection. * @param target optional target path * @param xmlFragment XML Fragment * @throws IOException I/O exception */ private static void add(final String target, final String xmlFragment) throws IOException { session.execute(new Add(target, xmlFragment)); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/server/ServerCommands.java000066400000000000000000000054051222453003200310100ustar00rootroot00000000000000package org.basex.examples.server; import org.basex.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.server.*; /** * This class demonstrates database access via the client/server architecture. * * @author BaseX Team 2005-12, BSD License */ public final class ServerCommands { /** Session reference. */ static ClientSession session; /** * Runs the example code. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { System.out.println("=== ServerCommands ==="); // ------------------------------------------------------------------------ // Start server on default port 1984 BaseXServer server = new BaseXServer(); // ------------------------------------------------------------------------ // Create a client session with host name, port, user name and password System.out.println("\n* Create a client session."); session = new ClientSession("localhost", 1984, "admin", "admin"); // ------------------------------------------------------------------------ // Create a database System.out.println("\n* Create a database."); session.execute(new CreateDB("input", "src/main/resources/xml/input.xml")); // ------------------------------------------------------------------------ // Run a query System.out.println("\n* Run a query:"); System.out.println(session.query("//li").execute()); // ------------------------------------------------------------------------ // Faster version: specify an output stream and run a query System.out.println("\n* Run a query (faster):"); session.setOutputStream(System.out); session.query("//li").execute(); System.out.println(); // Reset output stream session.setOutputStream(null); // ------------------------------------------------------------------------ // Run a query System.out.println("\n\n* Run a buggy query: "); try { session.execute(new XQuery("///")); } catch(final BaseXException ex) { System.out.println(ex.getMessage()); } // ------------------------------------------------------------------------ // Drop the database System.out.println("\n* Close and drop the database."); session.execute(new DropDB("input")); // ------------------------------------------------------------------------ // Close the client session System.out.println("\n* Close the client session."); session.close(); // ------------------------------------------------------------------------ // Stop the server System.out.println("\n* Stop the server."); server.stop(); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/server/ServerConcurrency.java000066400000000000000000000124501222453003200315370ustar00rootroot00000000000000package org.basex.examples.server; import java.io.*; import java.util.*; import org.basex.*; import org.basex.server.*; /** * This class connects multiple clients to one server instance. * It sets up three clients with read/write access to the database. * Database information will be shown before and after the * clients have been run. * * @author BaseX Team 2005-12, BSD License */ public final class ServerConcurrency { /** * Main method of the example class. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { new ServerConcurrency().run(); } /** * Runs the example code. * @throws Exception on error. */ void run() throws Exception { System.out.println("=== ServerConcurrency ==="); // ------------------------------------------------------------------------ // Start server System.out.println("\n* Start server."); BaseXServer server = new BaseXServer(); // ------------------------------------------------------------------------ // Create a client session with host name, port, user name and password System.out.println("\n* Create a client session."); ClientSession session = new ClientSession("localhost", 1984, "admin", "admin", System.out); // ------------------------------------------------------------------------ // Create a database System.out.println("\n* Create a database."); send("CREATE DB input src/main/resources/xml/input.xml", session); // ------------------------------------------------------------------------ // Setup some clients that simultaneously read and write from the database System.out.println("\n* Run one reader and two writers threads."); ClientExample reader1 = new ClientExample("//li"); ClientExample writer1 = new ClientExample("insert node " + "
  • new node
  • as last into /html/body//ul"); ClientExample writer2 = new ClientExample("insert node " + "One more as last into /html/body"); // ------------------------------------------------------------------------- // Let the clients run their query several times: Thread.sleep(2000); // ------------------------------------------------------------------------ // Stop the clients System.out.println("\n* Stop client threads."); reader1.stop(); writer1.stop(); writer2.stop(); Thread.sleep(1000); // ------------------------------------------------------------------------- // Show modified database contents System.out.println("\n* Show modified database contents:"); send("XQUERY //li", session); // ---------------------------------------------------------------------- // Drop the database System.out.println("\n* Drop the database."); send("DROP DB input", session); // ------------------------------------------------------------------------ // Close the client session System.out.println("\n* Close the client session."); session.close(); // ------------------------------------------------------------------------ // Stop the server System.out.println("\n* Stop server."); server.stop(); } /** * Processes the specified command on the server and returns the output * or command info. * @param cmd command to be executed * @param cs client session reference * @throws IOException I/O exception */ static void send(final String cmd, final ClientSession cs) throws IOException { // ------------------------------------------------------------------------ // Execute the command cs.execute(cmd); } /** * This class simulates a database client. * Within a thread, a query is run several times until the thread is stopped. */ private final class ClientExample { /** Set to false to stop the Client from running.*/ boolean running = true; /** Random sleep time generator.*/ Random r = new Random(); /** * Constructor. * @param query query to be run * @throws IOException I/O exception */ ClientExample(final String query) throws IOException { // ---------------------------------------------------------------------- // Create a client session and open database final ClientSession session = new ClientSession("localhost", 1984, "admin", "admin"); send("OPEN input", session); // ---------------------------------------------------------------------- // Create and run the query thread new Thread() { @Override public void run() { try { // ---------------------------------------------------------------- // Loop until the running flag has been invalidated while(running) { // Run the specified query send("XQUERY " + query, session); // Wait for a random time Thread.sleep(r.nextInt(500)); } // ---------------------------------------------------------------- // Close the client session session.close(); } catch(final Exception ex) { ex.printStackTrace(); } } }.start(); } /** * Quits the client thread. */ void stop() { running = false; } } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/server/ServerEventsGUI.java000066400000000000000000000107341222453003200310610ustar00rootroot00000000000000package org.basex.examples.server; import static org.basex.core.Text.*; import java.awt.*; import java.awt.event.*; import java.io.*; import javax.swing.*; import javax.swing.border.*; import org.basex.*; import org.basex.server.*; import org.basex.util.*; /** * This class tests the event mechanism with a gui. * * @author BaseX Team 2005-12, BSD License */ public final class ServerEventsGUI extends JFrame { /** Name of test database and user. */ static final String NAME = Util.name(ServerEventsGUI.class); /** Number of clients. */ static final int CLIENTS = 2; /** Color. */ static final String RED = "RED"; /** Color. */ static final String BLUE = "BLUE"; /** Color. */ static final String YELLOW = "YELLOW"; /** Database server. */ private static BaseXServer server; /** Number of open windows. */ private static int open = CLIENTS; /** Client session. */ ClientSession session; /** Main panel. */ JPanel main; /** * Main method, launching the test gui. * @param args ignored * @throws Exception exception */ public static void main(final String[] args) throws Exception { server = new BaseXServer("-z"); // initialization final ClientSession cs = new ClientSession(server.context, ADMIN, ADMIN); cs.execute("create event " + NAME); cs.execute("create db " + NAME + " "); cs.close(); for(int i = 0; i < CLIENTS; i++) new ServerEventsGUI(i); } /** * Default Constructor. * @param count window counter * @throws IOException I/O exception */ private ServerEventsGUI(final int count) throws IOException { super("Window " + (count + 1)); final JPanel buttons = new JPanel(); buttons.setLayout(new FlowLayout()); buttons.setOpaque(false); final JTextArea area = new JTextArea(); area.setPreferredSize(new Dimension(280, 90)); area.setEditable(false); area.setBorder(new CompoundBorder(new EtchedBorder(), new EmptyBorder(10, 10, 10, 10))); // create notifier instance final EventNotifier en = new EventNotifier() { @Override public void notify(final String value) { // use event feedback to repaint background Color c = Color.WHITE; final String tmp = value.replaceAll("\"", ""); if(tmp.equals(RED)) { c = Color.RED; } else if(tmp.equals(BLUE)) { c = Color.BLUE; } else if(tmp.equals(YELLOW)) { c = Color.YELLOW; } main.setBackground(c); // display updated XML fragment try { area.setText(session.query("/").execute()); } catch(final IOException ex) { ex.printStackTrace(); } } }; // create session, open database and register event watcher session = new ClientSession(server.context, ADMIN, ADMIN); session.execute("open " + NAME); session.watch(NAME, en); // create notification buttons for(final String color : new String[] { RED, BLUE, YELLOW }) { final JButton b = new JButton(color); // create action event b.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { try { // send update query and event final String query = "let $color := '" + color + "' return " + "(replace value of node /Application/Background with $color," + " db:event('" + NAME + "', $color))"; session.query(query).execute(); } catch(final IOException ex) { ex.printStackTrace(); } en.notify(b.getText()); } }); buttons.add(b); } main = new JPanel(); main.setLayout(new BorderLayout()); main.setBackground(Color.WHITE); main.add(area, BorderLayout.CENTER); main.add(buttons, BorderLayout.SOUTH); add(main); pack(); setLocation(300 * count, 0); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); setVisible(true); } @Override public void dispose() { try { session.close(); if(--open == 0) { // no sessions left: drop event and database and stop server final ClientSession css = new ClientSession(server.context, ADMIN, ADMIN); css.execute("drop event " + NAME); css.execute("drop db " + NAME); css.close(); server.stop(); } super.dispose(); } catch(final Exception ex) { ex.printStackTrace(); } } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/server/ServerQueries.java000066400000000000000000000066321222453003200306670ustar00rootroot00000000000000package org.basex.examples.server; import org.basex.*; import org.basex.server.*; /** * This class demonstrates query execution via the client/server architecture. * * @author BaseX Team 2005-12, BSD License */ public final class ServerQueries { /** Session reference. */ private static ClientSession session; /** * Runs the example code. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { System.out.println("=== ServerQueries ==="); // ------------------------------------------------------------------------ // Start server System.out.println("\n* Start server."); BaseXServer server = new BaseXServer(); // ------------------------------------------------------------------------ // Create a client session with host name, port, user name and password System.out.println("\n* Create a client session."); session = new ClientSession("localhost", 1984, "admin", "admin"); // ------------------------------------------------------------------------ // Run a query System.out.print("\n* Run a query: "); System.out.println(session.execute("XQUERY 1")); // ------------------------------------------------------------------------ // Run a query, specifying an output stream System.out.print("\n* Run a query (faster): "); session.setOutputStream(System.out); session.execute("XQUERY 1 to 2"); System.out.println(); // Reset output stream session.setOutputStream(null); // ------------------------------------------------------------------------ // Iteratively run a query, specifying an output stream System.out.print("\n* Use query instance: "); session.execute("set queryinfo on"); // Create query instance ClientQuery query = session.query("1 to 3"); // Execute query System.out.println(query.execute()); System.out.print("\n* Show query info: \n"); System.out.println(query.info()); // Close iterator query.close(); // ------------------------------------------------------------------------ // Iteratively run a query System.out.print("\n* Iterate over results: "); // Create query instance query = session.query("1 to 4"); // Loop through all results while(query.more()) { System.out.print(query.next() + ' '); } System.out.println(); // Close iterator query.close(); // ------------------------------------------------------------------------ // Iteratively run a query, specifying an output stream System.out.print("\n* Bind variable $a: "); session.execute("set queryinfo on"); // Create query instance query = session.query("declare variable $a as xs:int external; 1 to $a"); // Bind value to variable query.bind("$a", "5"); // Execute query System.out.println(query.execute()); // Close iterator query.close(); // ------------------------------------------------------------------------ // Close the client session System.out.println("\n* Close the client session."); session.close(); // ------------------------------------------------------------------------ // Stop the server System.out.println("\n* Stop the server."); server.stop(); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/server/UserExample.java000066400000000000000000000052551222453003200303150ustar00rootroot00000000000000package org.basex.examples.server; import org.basex.core.*; import org.basex.core.cmd.*; /** * This class presents methods to directly access * core maintenance and administration features. * * @author BaseX Team 2005-12, BSD License */ public final class UserExample { /** * Runs the example code. * @param args (ignored) command-line arguments * @throws BaseXException if a database command fails */ public static void main(final String[] args) throws BaseXException { /** Database context. */ final Context context = new Context(); System.out.println("=== UserExample ==="); // ---------------------------------------------------------------------- // Create a database System.out.println("\n* Create a database."); new CreateDB("input", "src/main/resources/xml/input.xml").execute(context); // ------------------------------------------------------------------------ // Create a new user with password 'password' (MD5 encoded) System.out.println("\n* Create a user."); new CreateUser("testuser", "5f4dcc3b5aa765d61d8327deb882cf99").execute(context); // ------------------------------------------------------------------------ // Remove global user rights System.out.println("\n* Remove global user rights."); new Grant("NONE", "testuser").execute(context); // ------------------------------------------------------------------------ // Grant local user rights on database 'input' System.out.println("\n* Grant local user rights."); new Grant("WRITE", "testuser", "input").execute(context); // ------------------------------------------------------------------------ // Show global users System.out.println("\n* Show global users."); System.out.print(new ShowUsers().execute(context)); // ------------------------------------------------------------------------ // Show local users on a single database System.out.println("\n* Show local users."); System.out.print(new ShowUsers("input").execute(context)); // ------------------------------------------------------------------------ // Change user password to 'new' (MD5 encoded) System.out.println("\n* Alter a user's password."); new AlterUser("testuser", "22af645d1859cb5ca6da0c484f1f37ea").execute(context); // ------------------------------------------------------------------------ // Drop the database and user System.out.println("\n* Drop the user and database."); new DropUser("testuser").execute(context); new DropDB("input").execute(context); // ------------------------------------------------------------------------ // Close the database context context.close(); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/server/package.html000066400000000000000000000001031222453003200274640ustar00rootroot00000000000000 Contains examples for using the database server. basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xmldb/000077500000000000000000000000001222453003200250115ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xmldb/XMLDBCreate.java000066400000000000000000000027401222453003200276510ustar00rootroot00000000000000package org.basex.examples.xmldb; import org.basex.api.xmldb.*; import org.xmldb.api.*; import org.xmldb.api.base.*; /** * This class serves as an example for creating a database with the XML:DB API. * * @author BaseX Team 2005-12, BSD License */ public final class XMLDBCreate { /** Database driver. */ public static final String DRIVER = "org.basex.api.xmldb.BXDatabase"; /** Name of the collection. */ public static final String COLL = "XMLDBCollection"; /** * Main method of the example class. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { System.out.println("=== XMLDBCreate ==="); try { // Register the database Class c = Class.forName(DRIVER); Database db = (Database) c.newInstance(); DatabaseManager.registerDatabase(db); System.out.println("\n* Create a new collection."); // Create a new collection BXCollection coll = new BXCollection(COLL, false, db); // Close the connection coll.close(); System.out.println("\n* Create existing collection."); // Open an existing collection coll = new BXCollection(COLL, true, db); // Close the connection coll.close(); } catch(final XMLDBException ex) { // Handle exceptions System.err.println("XML:DB Exception occurred " + ex.errorCode); } } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xmldb/XMLDBInsert.java000066400000000000000000000041541222453003200277130ustar00rootroot00000000000000package org.basex.examples.xmldb; import org.xmldb.api.*; import org.xmldb.api.base.*; import org.xmldb.api.modules.*; /** * This class serves as an example for inserting an XML Document into a database with * the XML:DB API. * You first need to run {@link XMLDBCreate} in order to create the addressed database. * * @author BaseX Team 2005-12, BSD License */ public final class XMLDBInsert { /** Database driver. */ private static final String DRIVER = "org.basex.api.xmldb.BXDatabase"; /** Name of the referenced database. */ private static final String DBNAME = "xmldb:basex://localhost:1984/XMLDBCollection"; /** * Main method of the example class. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { System.out.println("=== XMLDBInsert ==="); // Collection instance Collection col = null; try { // Register the database Class c = Class.forName(DRIVER); Database db = (Database) c.newInstance(); DatabaseManager.registerDatabase(db); System.out.println("\n* Get collection."); // Receive the collection col = DatabaseManager.getCollection(DBNAME); // ID for the new document String id = "world"; // Content of the new document String doc = "Hello World!"; System.out.println("\n* Create new resource."); // Create a new XML resource with the specified ID XMLResource res = (XMLResource) col.createResource(id, XMLResource.RESOURCE_TYPE); // Set the content of the XML resource as the document res.setContent(doc); System.out.println("\n* Store new resource."); // Store the resource into the database col.storeResource(res); } catch(final XMLDBException ex) { // Handle exceptions System.err.println("XML:DB Exception occurred " + ex.errorCode); ex.printStackTrace(); } finally { // Close the collection if(col != null) col.close(); } } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xmldb/XMLDBQuery.java000066400000000000000000000042131222453003200275500ustar00rootroot00000000000000package org.basex.examples.xmldb; import org.xmldb.api.*; import org.xmldb.api.base.*; import org.xmldb.api.modules.*; /** * This class serves as an example for executing XPath requests with the XML:DB API. * You first need to run {@link XMLDBCreate} in order to create the addressed database. * * @author BaseX Team 2005-12, BSD License */ public final class XMLDBQuery { /** Database driver. */ private static final String DRIVER = "org.basex.api.xmldb.BXDatabase"; /** Name of the referenced database. */ private static final String DBNAME = "xmldb:basex://localhost:1984/XMLDBCollection"; /** Sample query. */ private static final String QUERY = "/"; /** * Main method of the example class. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { System.out.println("=== XMLDBQuery ===\n"); System.out.println("* Run query via XML:DB:"); // Collection instance Collection coll = null; try { // Register the database Class c = Class.forName(DRIVER); Database db = (Database) c.newInstance(); DatabaseManager.registerDatabase(db); // Receive the database coll = DatabaseManager.getCollection(DBNAME); // Receive the XPath query service XPathQueryService service = (XPathQueryService) coll.getService("XPathQueryService", "1.0"); // Execute the query and receives all results ResourceSet set = service.query(QUERY); // Create a result iterator ResourceIterator iter = set.getIterator(); // Loop through all result items while(iter.hasMoreResources()) { // Receive the next results Resource res = iter.nextResource(); // Write the result to the console System.out.println(res.getContent()); } } catch(final XMLDBException ex) { // Handle exceptions System.err.println("XML:DB Exception occurred " + ex.errorCode); } finally { // Close the collection if(coll != null) coll.close(); } } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xmldb/package.html000066400000000000000000000000761222453003200272750ustar00rootroot00000000000000 Contains examples for using the XML:DB API. basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xqj/000077500000000000000000000000001222453003200245055ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xqj/XQJQuery.java000066400000000000000000000026211222453003200270410ustar00rootroot00000000000000package org.basex.examples.xqj; import javax.xml.xquery.*; /** * This class serves as an example for executing XQuery requests * with the XQuery for Java (XQJ) API. * * @author BaseX Team 2005-12, BSD License */ public final class XQJQuery { /** Database driver. */ private static final String DRIVER = "net.xqj.basex.BaseXXQDataSource"; /** * Main method of the example class. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { System.out.println("=== XQJQuery ==="); System.out.println("\n* Run query via XQJ:"); // Create a new data source. XQDataSource source = (XQDataSource) Class.forName(DRIVER).newInstance(); // Build a connection to the specified driver. XQConnection conn = source.getConnection("admin", "admin"); // Prepare a query String input = System.getProperty("user.dir") + "/src/main/resources/xml/input.xml"; XQPreparedExpression expr = conn.prepareExpression("doc('" + input + "')//li"); // Execute the query. XQResultSequence result = expr.executeQuery(); // Get all results of the execution. while(result.next()) { // Print the results to the console. System.out.println(result.getItemAsString(null)); } // Close the expression. expr.close(); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xqj/cfoster/000077500000000000000000000000001222453003200261525ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xqj/cfoster/Main.java000066400000000000000000000022421222453003200277010ustar00rootroot00000000000000package org.basex.examples.xqj.cfoster; import javax.xml.xquery.*; import net.xqj.basex.*; /** * XQJ Examples, derived from the XQJ Tutorial * * http://www.cfoster.net/articles/xqj-tutorial from Charles Foster. * * @author BaseX Team 2005-12, BSD License */ abstract class Main { /** * Initializes the query example. * @param info info */ static void init(final String info) { System.out.println("=== XQJ Tutorial/cfoster.net ==="); System.out.println("Part " + info); } /** * Creates and returns a default connection. * @return connection instance */ static XQConnection connect() { return new BaseXXQDataSource().getConnection("admin", "admin"); } /** * Closes the specified connection. * @param xqc connection to be closed * @throws XQException connection exception */ static void close(final XQConnection xqc) throws XQException { xqc.close(); } /** * Shows some query info. * @param info info text */ static void info(final String info) { System.out.println("\n* " + info); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xqj/cfoster/Part1.java000066400000000000000000000021071222453003200300040ustar00rootroot00000000000000package org.basex.examples.xqj.cfoster; import javax.xml.xquery.*; import net.xqj.basex.*; /** * XQJ Example, derived from the XQJ Tutorial * * http://www.cfoster.net/articles/xqj-tutorial from Charles Foster. * * Part 1: Setting up your environment. * * @author BaseX Team 2005-12, BSD License */ public final class Part1 extends Main { /** * Main method of the example class. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { init("1: Setting up your environment"); // Connect and disconnect info("Connect and disconnect"); // Default User name and Password XQDataSource xqs = new BaseXXQDataSource(); XQConnection conn = xqs.getConnection("admin", "admin"); info("Connected."); // Database XQueries and Updates performed here (covered later!) // Closing connection to the Database. conn.close(); info("Disonnected."); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xqj/cfoster/Part2.java000066400000000000000000000031331222453003200300050ustar00rootroot00000000000000package org.basex.examples.xqj.cfoster; import java.io.*; import javax.xml.xquery.*; /** * XQJ Example, derived from the XQJ Tutorial * * http://www.cfoster.net/articles/xqj-tutorial from Charles Foster. * * Part 2: Executing XQuery in Java. * * @author BaseX Team 2005-12, BSD License */ public final class Part2 extends Main { /** * Main method of the example class. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { init("2: Executing XQuery in Java"); // Create the connection XQConnection conn = connect(); // Return book titles from 'books.xml' info("Return book titles from 'books.xml'"); String path = new File("src/main/resources/xml").getAbsolutePath(); String xqueryString = "for $x in doc('" + path + "/books.xml')//book " + "return $x/title/text()"; XQExpression xqe = conn.createExpression(); XQResultSequence rs = xqe.executeQuery(xqueryString); while(rs.next()) System.out.println(rs.getItemAsString(null)); // Get book prices info("Get book prices"); xqueryString = "for $x in doc('" + path + "/books.xml')//book " + "return xs:float($x/price)"; rs = xqe.executeQuery(xqueryString); while(rs.next()) { float price = rs.getFloat(); System.out.println("price = " + price); } conn.close(); // Closing connection to the Database. close(conn); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xqj/cfoster/Part3.java000066400000000000000000000056241222453003200300150ustar00rootroot00000000000000package org.basex.examples.xqj.cfoster; import java.io.*; import javax.xml.namespace.*; import javax.xml.xquery.*; /** * XQJ Example, derived from the XQJ Tutorial * * http://www.cfoster.net/articles/xqj-tutorial from Charles Foster. * * Part 3: Binding Java variables to XQuery. * * @author BaseX Team 2005-12, BSD License */ public final class Part3 extends Main { /** Default ISBN number. */ private static final String DEFAULT_ISBN = "059652112X"; /** * Main method of the example class. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { init("3: Binding Java variables to XQuery"); // Create the connection XQConnection conn = connect(); // Lookup specific ISBN String isbnID = args.length > 0 ? args[0] : DEFAULT_ISBN; info("Lookup books by ISBN '" + isbnID + '\''); XQExpression xqe = conn.createExpression(); // Bind variable to expression xqe.bindString(new QName("userisbn"), isbnID, null); String path = new File("src/main/resources/xml").getAbsolutePath(); String xqueryString = "declare variable $userisbn external; " + "for $x in doc('" + path + "/books.xml')//book " + "where $x/@isbn = $userisbn " + "return $x/title/text()"; XQResultSequence rs = xqe.executeQuery(xqueryString); while(rs.next()) System.out.println(rs.getItemAsString(null)); // Lookup by date range info("Lookup books by date range"); xqueryString = "declare variable $fromDate as xs:date external; " + "declare variable $toDate as xs:date external; " + "for $x in doc('" + path + "/books.xml')//book " + "let $publishDate := xs:date($x/publish_date) " + "where $publishDate > $fromDate and $publishDate < $toDate " + "return $x/title/text()"; XQPreparedExpression xqpe = conn.prepareExpression(xqueryString); // xs:date, we can use this to validate against when binding XQItemType dateType = conn.createAtomicType(XQItemType.XQBASETYPE_DATE); try { // validate against dateType (xs:date) xqpe.bindAtomicValue(new QName("fromDate"), "2008-01-32", dateType); // There are NOT 32 days in January, so this should fail! } catch(XQException ex) { System.out.println(ex.getMessage()); // Now set a proper date: validate against dateType (xs:date) xqpe.bindAtomicValue(new QName("fromDate"), "2008-01-01", dateType); } // validate against dateType (xs:date) xqpe.bindAtomicValue(new QName("toDate"), "2011-01-01", dateType); rs = xqpe.executeQuery(); while(rs.next()) System.out.println(rs.getItemAsString(null)); // Closing connection to the Database. close(conn); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xqj/cfoster/Part4.java000066400000000000000000000152751222453003200300210ustar00rootroot00000000000000package org.basex.examples.xqj.cfoster; import java.io.*; import java.util.*; import javax.xml.datatype.*; import javax.xml.namespace.*; import javax.xml.parsers.*; import javax.xml.xquery.*; import org.w3c.dom.*; /** * XQJ Example, derived from the XQJ Tutorial * * http://www.cfoster.net/articles/xqj-tutorial from Charles Foster. * * Part 4: XDM Model within XQJ. * * @author BaseX Team 2005-12, BSD License */ public final class Part4 extends Main { /** * Main method of the example class. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { init("4: XDM Model within XQJ"); // Create the connection XQConnection conn = connect(); // Create XQuery items from int values info("Create XQuery items from int values"); XQItem[] items = new XQItem[7]; // Create an XQItem type, with a type of xs:int and a value of 0 items[0] = conn.createItemFromInt(0, null); XQItemType xsInteger = conn.createAtomicType(XQItemType.XQBASETYPE_INTEGER); XQItemType xsString = conn.createAtomicType(XQItemType.XQBASETYPE_STRING); XQItemType xsByte = conn.createAtomicType(XQItemType.XQBASETYPE_BYTE); XQItemType xsDecimal = conn.createAtomicType(XQItemType.XQBASETYPE_DECIMAL); XQItemType xsLong = conn.createAtomicType(XQItemType.XQBASETYPE_LONG); // Create an XQItem, with a type of xs:integer and a value of 1 items[1] = conn.createItemFromInt(1, xsInteger); // Create an XQItem, with a type of xs:string and a value of 2 items[2] = conn.createItemFromInt(2, xsString); // Create an XQItem, with a type of xs:byte and a value of 3 items[3] = conn.createItemFromInt(3, xsByte); // Create an XQItem, with a type of xs:decimal and a value of 4 items[4] = conn.createItemFromInt(4, xsDecimal); // Create an XQItem, with a type of xs:long and a value of 5 items[5] = conn.createItemFromInt(5, xsLong); // Try to create an XQItem, with a type of xs:byte and a value of 1000 // This causes an XQException, because the // value 1000 is outside the range of xs:byte (-128 to 127) try { items[6] = conn.createItemFromInt(1000, xsByte); } catch(final XQException ex) { System.out.println(ex.getMessage()); } for(XQItem it : items) { if(it != null) it.writeItem(System.out, null); System.out.print(' '); } System.out.println(); // Create items from atomic values info("Create items from atomic values"); XQItemType date = // xs:date conn.createAtomicType(XQItemType.XQBASETYPE_DATE); XQItemType hex = // xs:hexBinary conn.createAtomicType(XQItemType.XQBASETYPE_HEXBINARY); XQItem dateValue = conn.createItemFromAtomicValue("2007-01-23", date); XQItem binaryData = conn.createItemFromAtomicValue("48656C6C6F", hex); dateValue.writeItem(System.out, null); System.out.println(); binaryData.writeItem(System.out, null); System.out.println(); // Create items from Java objects info("Create items from atomic values"); items = new XQItem[3]; // Create an XQItem with a type of xs:int items[0] = conn.createItemFromObject(5, null); // Create an XQItem with a type of xs:float items[1] = conn.createItemFromObject(123.4f, null); // Create an XQItem with a type of xs:hexBinary items[2] = conn.createItemFromObject(new byte[] { 1, 2, 3, 4 }, null); for(XQItem it : items) { if(it != null) System.out.println(it.getAtomicValue()); } // Create and bind XQuery sequences info("Create and bind XQuery sequences"); List list = new ArrayList(); list.add(conn.createItemFromInt(1, null)); list.add(conn.createItemFromInt(2, null)); list.add(conn.createItemFromInt(3, null)); list.add(4); list.add(5); list.add(6); XQSequence sequence = conn.createSequence(list.iterator()); XQPreparedExpression xqpe = conn.prepareExpression("declare variable $x as xs:int+ external; $x"); xqpe.bindSequence(new QName("x"), sequence); XQResultSequence rs = xqpe.executeQuery(); while(rs.next()) System.out.println(rs.getItemAsString(null) + ", " + rs.getItemType()); // Bind XQResultSequences to XQuery Expressions info("Bind XQResultSequences to XQuery Expressions"); XQExpression expr = conn.createExpression(); String path = new File("src/main/resources/xml").getAbsolutePath(); String xqueryString = "for $x in doc('" + path + "/books.xml')//book/@isbn " + "return xs:string($x)"; rs = expr.executeQuery(xqueryString); // Create a copy of the XQResultSequence that is scrollable and in memory. sequence = conn.createSequence(rs); expr.bindSequence(new QName("isbnCodes"), sequence); xqueryString = "declare variable $isbnCodes external; $isbnCodes"; rs = expr.executeQuery(xqueryString); while(rs.next()) { System.out.println(rs.getItemAsString(null)); } // Retrieve XML nodes info("Retrieve XML nodes"); expr = conn.createExpression(); xqueryString = "doc('" + path + "/books.xml')//book"; rs = expr.executeQuery(xqueryString); while(rs.next()) { Node book = rs.getNode(); // org.w3c.dom.Element System.out.println(book); } // Create XML nodes info("Create XML nodes"); // Create {@link Document} instance DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document docObj = builder.newDocument(); Element elementObj = docObj.createElement("e"); // from org.w3c.dom // Create an XQItem with a type of element() XQItem item1 = conn.createItemFromObject(elementObj, null); // Create an XQItem with a type of document-node() XQItem items2 = conn.createItemFromObject(docObj, null); System.out.println(item1.getItemType()); System.out.println(items2.getItemType()); // Retrieve date values info("Retrieve date values"); xqueryString = "for $x in doc('" + path + "/books.xml')//publish_date " + "return xs:date($x)"; rs = expr.executeQuery(xqueryString); while(rs.next()) { XMLGregorianCalendar cal = (XMLGregorianCalendar) rs.getObject(); int day = cal.getDay(); int month = cal.getMonth(); int year = cal.getYear(); System.out.println(year + "/" + month + '/' + day); } // Closing connection to the Database. close(conn); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xqj/cfoster/Part5.java000066400000000000000000000032411222453003200300100ustar00rootroot00000000000000package org.basex.examples.xqj.cfoster; import java.net.*; import javax.xml.namespace.*; import javax.xml.xquery.*; /** * XQJ Example, derived from the XQJ Tutorial * * http://www.cfoster.net/articles/xqj-tutorial from Charles Foster. * * Part 5: Stream massive amounts of XML to XQuery expressions. * * @author BaseX Team 2005-12, BSD License */ public final class Part5 extends Main { /** * Main method of the example class. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { init("5: Stream massive amounts of XML to XQuery expressions"); // Create the connection XQConnection conn = connect(); // Enable deferred binding info("Enable deferred binding"); // Create a NEW XQStaticContext Object (based on the current static context) XQStaticContext properties = conn.getStaticContext(); // Set its Binding Mode property to deferred (i.e. streaming). properties.setBindingMode(XQConstants.BINDING_MODE_DEFERRED); XQExpression xqe = conn.createExpression(properties); String surl = "http://www.w3.org/TR/2007/REC-xquery-20070123/xquery.xml"; URL url = new URL(surl); xqe.bindDocument(new QName("x"), url.openStream(), null, null); String xqueryString = "declare variable $x external; $x//p"; XQResultSequence rs = xqe.executeQuery(xqueryString); int c = 0; while(rs.next()) ++c; System.out.println(c + " results."); // Closing connection to the Database. close(conn); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xqj/cfoster/Part6.java000066400000000000000000000063071222453003200300170ustar00rootroot00000000000000package org.basex.examples.xqj.cfoster; import java.io.*; import javax.xml.stream.*; import javax.xml.xquery.*; import org.xml.sax.*; import org.xml.sax.helpers.*; /** * XQJ Example, derived from the XQJ Tutorial * * http://www.cfoster.net/articles/xqj-tutorial from Charles Foster. * * Part 6: Streaming XQuery results. * * @author BaseX Team 2005-12, BSD License */ public final class Part6 extends Main { /** * Main method of the example class. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { init("6: Streaming XQuery results"); // Create the connection XQConnection conn = connect(); // Stream XQuery Result Sequences with StAX info("Stream XQuery Result Sequences with StAX"); XQExpression xqe = conn.createExpression(); String path = new File("src/main/resources/xml").getAbsolutePath(); XQResultSequence rs = xqe.executeQuery( "doc('" + path + "/books.xml')//book"); XMLStreamReader reader = rs.getSequenceAsStream(); for(; reader.hasNext(); reader.next()) System.out.println(getEventString(reader)); // Print tailing END_DOCUMENT event too System.out.println(getEventString(reader)); // Streaming XQuery Result Sequences with SAX info("Stream XQuery Result Sequences with SAX"); rs = xqe.executeQuery("doc('" + path + "/books.xml')//book"); rs.writeSequenceToSAX(new MySAXHandler()); // Closing connection to the Database. close(conn); } /** * Returns the correspondent event string. * @param reader stream reader * @return event string */ static String getEventString(final XMLStreamReader reader) { switch(reader.getEventType()) { case XMLStreamConstants.START_ELEMENT: return "START_ELEMENT:\t\"" + reader.getLocalName() + '"'; case XMLStreamConstants.END_ELEMENT: return "END_ELEMENT:\t\"" + reader.getLocalName() + '"'; case XMLStreamConstants.START_DOCUMENT: return "START_DOCUMENT"; case XMLStreamConstants.END_DOCUMENT: return "END_DOCUMENT"; case XMLStreamConstants.CHARACTERS: return "CHARACTERS:\t\"" + reader.getText() + '"'; } return ""; } /** * SAX Handler. */ static class MySAXHandler extends DefaultHandler { @Override public void startDocument() { System.out.println("Start Document"); } @Override public void startElement(final String u, final String name, final String qn, final Attributes a) { System.out.println("Start Element:\t\"" + name + '"'); } @Override public void endElement(final String u, final String name, final String qn) { System.out.println("End Element:\t\"" + name + '"'); } @Override public void characters(final char[] ch, final int start, final int len) { System.out.println("Characters:\t\"" + new String(ch, start, len) + '"'); } @Override public void endDocument() { System.out.println("End Document"); } } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xqj/cfoster/package.html000066400000000000000000000003051222453003200304310ustar00rootroot00000000000000

    XQJ Examples, derived from the XQJ Tutorial http://www.cfoster.net/articles/xqj-tutorial from Charles Foster.

    basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xqj/package.html000066400000000000000000000001151222453003200267630ustar00rootroot00000000000000 Contains examples for using the XQuery for Java (XQJ) API. basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xqj/tutorial/000077500000000000000000000000001222453003200263505ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xqj/tutorial/Main.java000066400000000000000000000036061222453003200301040ustar00rootroot00000000000000package org.basex.examples.xqj.tutorial; import javax.xml.xquery.*; import net.xqj.basex.*; /** * XQJ Examples, derived from the XQJ Tutorial * * http://www.xquery.com/tutorials/xqj_tutorial * from Marc van Cappellen. * * @author BaseX Team 2005-12, BSD License */ abstract class Main { /** * Initializes the query example. * @param info info */ static void init(final String info) { System.out.println("=== XQJ Tutorial/xquery.com ==="); System.out.println("Part " + info); } /** * Creates and returns a default connection. * @return connection instance */ static XQConnection connect() { return new BaseXXQDataSource().getConnection("admin", "admin"); } /** * Closes the specified connection. * @param xqc connection to be closed * @throws XQException connection exception */ static void close(final XQConnection xqc) throws XQException { xqc.close(); } /** * Shows some query info. * @param info info text */ static void info(final String info) { System.out.println("\n* " + info); } /** * Prints the entries of a sequence. * @param info query information * @param xqs sequence * @throws XQException query exception */ static void print(final String info, final XQSequence xqs) throws XQException { info(info); xqs.writeSequence(System.out, null); System.out.println(); } /** * Prints the result of an expression. * @param info query info * @param xqp prepared query expression */ static void print(final String info, final XQPreparedExpression xqp) { info(info); try { xqp.executeQuery().writeSequence(System.out, null); } catch(final XQException ex) { System.out.println(ex); } System.out.println(); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xqj/tutorial/Part1.java000066400000000000000000000020701222453003200302010ustar00rootroot00000000000000package org.basex.examples.xqj.tutorial; import javax.xml.xquery.*; import net.xqj.basex.*; /** * XQJ Example, derived from the XQJ Tutorial * * http://www.xquery.com/tutorials/xqj_tutorial * from Marc van Cappellen. * * Part 1: An XQJ Introduction. * * @author BaseX Team 2005-12, BSD License */ public final class Part1 extends Main { /** * Main method of the example class. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { init("1: An XQJ Introduction"); // Print 'Hello World!' info("Print 'Hello World'"); XQDataSource xqjd = new BaseXXQDataSource(); XQConnection xqjc = xqjd.getConnection("admin", "admin"); XQExpression xqje = xqjc.createExpression(); XQSequence xqjs = xqje.executeQuery("'Hello World!'"); xqjs.writeSequence(System.out, null); xqjc.close(); // Flush output. System.out.println(); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xqj/tutorial/Part10.java000066400000000000000000000076501222453003200302720ustar00rootroot00000000000000package org.basex.examples.xqj.tutorial; import java.io.*; import javax.xml.namespace.*; import javax.xml.transform.*; import javax.xml.transform.sax.*; import javax.xml.transform.stream.*; import javax.xml.xquery.*; import org.xml.sax.*; import org.xml.sax.helpers.*; /** * XQJ Example, derived from the XQJ Tutorial * * http://www.xquery.com/tutorials/xqj_tutorial * from Marc van Cappellen. * * Part 10: XML Pipelines. * * @author BaseX Team 2005-12, BSD License */ public final class Part10 extends Main { /** * Main method of the example class. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { init("10: XML Pipelines"); // Create a connection XQConnection xqc = connect(); // Pipeline XQuery expressions String path = new File("src/main/resources/xml").getAbsolutePath(); XQExpression xqe = xqc.createExpression(); XQSequence xqs = xqe.executeQuery("doc('" + path + "/orders.xml')//order"); XQExpression xqe2 = xqc.createExpression(); xqe2.bindSequence(new QName("orders"), xqs); XQSequence xqs2 = xqe2.executeQuery( "declare variable $orders as element() external; " + "for $order in $orders where $order/@status = 'closed' " + "return { " + " $order/* }"); print("Pipeline XQuery expressions", xqs2); xqe2.close(); xqe.close(); // Passing XSLT results to XQuery info("Passing XSLT results to XQuery"); // Build an XMLFilter for the XSLT transformation SAXTransformerFactory stf = (SAXTransformerFactory) TransformerFactory.newInstance(); XMLFilter xmlf = stf.newXMLFilter(new StreamSource("" + path + "/orders.xsl")); // Create a SAX source, the input for the XSLT transformation SAXSource saxSource = new SAXSource(xmlf, new InputSource("" + path + "/orders.xml")); // Create an XQuery expression XQPreparedExpression xqp = xqc.prepareExpression( "declare variable $var external; { $var }"); // Bind the input document to prepared expression xqp.bindDocument(new QName("var"), saxSource, null); // Execute the query and print results xqs = xqp.executeQuery(); xqs.writeSequenceToResult(new StreamResult(System.out)); System.out.println(); // Passing XQuery results to XSLT info("Passing XQuery results to XSLT"); // Create an XQuery expression xqp = xqc.prepareExpression("doc('" + path + "/orders.xml')"); // Create an XQJFilter XQJFilter xqjf = new XQJFilter(xqp); // Create an XMLFilter for the XSLT transformation, the 2nd stage stf = (SAXTransformerFactory) TransformerFactory.newInstance(); xmlf = stf.newXMLFilter( new StreamSource(path + "/orders.xsl")); xmlf.setParent(xqjf); // Make sure to capture the SAX events as result of the pipeline xmlf.setContentHandler(new DefaultHandler()); // Activate the pipeline xmlf.parse(new InputSource()); // Close the connection close(xqc); } /** * XQuery for Java filter. */ private static class XQJFilter extends XMLFilterImpl { /** Prepared expression. */ final XQPreparedExpression expression; /** * Constructor. * @param xqp prepared expression */ public XQJFilter(final XQPreparedExpression xqp) { expression = xqp; } @Override public void parse(final InputSource source) throws SAXException { try { XQSequence xqs = expression.executeQuery(); SAXResult result = new SAXResult(getContentHandler()); xqs.writeSequenceToResult(result); xqs.close(); } catch(XQException ex) { throw new SAXException(ex); } } } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xqj/tutorial/Part11.java000066400000000000000000000037621222453003200302730ustar00rootroot00000000000000package org.basex.examples.xqj.tutorial; import java.io.*; import javax.xml.namespace.*; import javax.xml.transform.stream.*; import javax.xml.xquery.*; /** * XQJ Example, derived from the XQJ Tutorial * * http://www.xquery.com/tutorials/xqj_tutorial * from Marc van Cappellen. * * Part 11: Processing Large Inputs. * * @author BaseX Team 2005-12, BSD License */ public final class Part11 extends Main { /** * Main method of the example class. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { init("11: Processing Large Inputs"); // Create a connection XQConnection xqc = connect(); // Pipeline large inputs info("Pipeline large inputs"); XQStaticContext xqsc = xqc.getStaticContext(); xqc.setStaticContext(xqsc); String path = new File("src/main/resources/xml").getAbsolutePath(); XQExpression xqe = xqc.createExpression(); XQSequence xqs = xqe.executeQuery( "doc('" + path + "/orders.xml')//order"); XQExpression xqe2 = xqc.createExpression(); xqe2.bindSequence(new QName("orders"), xqs); XQSequence xqs2 = xqe2.executeQuery( "declare variable $orders as element() external; " + "for $order in $orders where $order/@status = 'closed' " + "return { " + " $order/* }"); xqs2.writeSequence(System.out, null); xqe2.close(); xqe.close(); System.out.println(); // Stream large inputs info("Stream large inputs"); xqe = xqc.createExpression(); xqe.bindDocument(XQConstants.CONTEXT_ITEM, new StreamSource(path + "/orders.xml"), null); xqs = xqe.executeQuery("/orders/order"); xqs.writeSequence(System.out, null); System.out.println(); // Close the connection close(xqc); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xqj/tutorial/Part2.java000066400000000000000000000024331222453003200302050ustar00rootroot00000000000000package org.basex.examples.xqj.tutorial; import java.util.*; import javax.xml.xquery.*; /** * XQJ Example, derived from the XQJ Tutorial * * http://www.xquery.com/tutorials/xqj_tutorial * from Marc van Cappellen. * * Part 2: Configuring XQJ Connections. * * @author BaseX Team 2005-12, BSD License */ public final class Part2 extends Main { /** * Main method of the example class. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { init("2: Configuring XQJ Connections"); // Set data source via property info("Set data source via property"); Properties p = new Properties(); p.setProperty("ClassName", "net.xqj.basex.BaseXXQDataSource"); String xqdsClassName = p.getProperty("ClassName"); Class xqdsClass = Class.forName(xqdsClassName); XQDataSource xqds = (XQDataSource) xqdsClass.newInstance(); // Connect with user name and password info("Connect with user name and password"); XQConnection xqjc = xqds.getConnection("admin", "admin"); // Close the connection info("Close successful connection"); xqjc.close(); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xqj/tutorial/Part3.java000066400000000000000000000053401222453003200302060ustar00rootroot00000000000000package org.basex.examples.xqj.tutorial; import java.io.*; import javax.xml.namespace.*; import javax.xml.parsers.*; import javax.xml.xquery.*; import org.w3c.dom.*; /** * XQJ Example, derived from the XQJ Tutorial * * http://www.xquery.com/tutorials/xqj_tutorial * from Marc van Cappellen. * * Part 3: Querying Data from XML Files or Java XML APIs. * * @author BaseX Team 2005-12, BSD License */ public final class Part3 extends Main { /** * Main method of the example class. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { init("3: Querying Data from XML Files or Java XML APIs"); // Create a connection XQConnection xqc = connect(); // Create and execute an expression String path = new File("src/main/resources/xml").getAbsolutePath(); XQExpression xqe = xqc.createExpression(); String query = "doc('" + path + "/orders.xml')//order[id='174']"; XQSequence xqs = xqe.executeQuery(query); print("Query: " + query, xqs); // Create and execute a second expression query = "doc('" + path + "/orders.xml')//order[id='267']"; xqs = xqe.executeQuery(query); if(xqs.next()) print("Query: " + query, xqs); // Prepare an expression query = "declare variable $id as xs:string external; " + "doc('" + path + "/orders.xml')//order[id=$id]"; XQPreparedExpression xqp = xqc.prepareExpression(query); // Bind a variable and execute the query xqp.bindString(new QName("id"), "174", null); xqs = xqp.executeQuery(); if(xqs.next()) print("Prepared query, $id=\"174\":", xqs); // Bind a second variable and execute the query xqp.bindString(new QName("id"), "267", null); xqs = xqp.executeQuery(); if(xqs.next()) print("Prepared query, $id=\"267\":", xqs); // Create {@link Document} instance DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document dom = builder.parse(path + "/orders.xml"); // Bind document to context item xqe = xqc.createExpression(); xqe.bindNode(XQConstants.CONTEXT_ITEM, dom, null); // Execute query query = ".//order[id='174']"; xqs = xqe.executeQuery(query); if(xqs.next()) print("Query: " + query, xqs); // Execute a query from a file input stream InputStream is = new FileInputStream(path + "/orders.xq"); xqs = xqe.executeQuery(is); if(xqs.next()) print("Query from input stream", xqs); is.close(); // Close the connection close(xqc); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xqj/tutorial/Part4.java000066400000000000000000000057151222453003200302150ustar00rootroot00000000000000package org.basex.examples.xqj.tutorial; import java.io.*; import java.math.*; import javax.xml.stream.*; import javax.xml.xquery.*; import org.w3c.dom.*; import org.xml.sax.*; import org.xml.sax.helpers.*; /** * XQJ Example, derived from the XQJ Tutorial * * http://www.xquery.com/tutorials/xqj_tutorial * from Marc van Cappellen. * * Part 4: Processing Results. * * @author BaseX Team 2005-12, BSD License */ public final class Part4 extends Main { /** * Main method of the example class. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { init("4: Processing Results"); // Create a connection XQConnection xqc = connect(); XQExpression xqe = xqc.createExpression(); // Iterate through query results info("Iterate through query results"); String path = new File("src/main/resources/xml").getAbsolutePath(); XQSequence xqs = xqe.executeQuery( "doc('" + path + "/employees.xml')//employee"); while(xqs.next()) { Element employee = (Element) xqs.getObject(); System.out.println(employee); } // Iterate through numeric values info("Iterate through numeric values"); xqs = xqe.executeQuery("doc('" + path + "/orders.xml')" + "/orders/order/xs:decimal(total_price)"); while(xqs.next()) { BigDecimal price = (BigDecimal) xqs.getObject(); System.out.println(price); } // Print atomic values info("Print atomic values"); xqs = xqe.executeQuery("'Hello world!', 123, 1E1, xs:QName('abc')"); while(xqs.next()) { System.out.println(xqs.getAtomicValue()); } // Return single items via SAX info("Return single items via SAX"); ContentHandler ch = new DefaultHandler() { @Override public void characters(final char[] c, final int s, final int l) { System.out.println("Characters/SAX: '" + new String(c, s, l) + '\''); } }; xqs = xqe.executeQuery( "doc('" + path + "/employees.xml')//employee"); while(xqs.next()) { xqs.writeItemToSAX(ch); } // Return sequence via SAX info("Return sequence via SAX"); xqs = xqe.executeQuery("doc('" + path + "/employees.xml')//employee"); xqs.writeSequenceToSAX(ch); // Return single items via StAX info("Return single items via StAX"); xqs = xqe.executeQuery("doc('" + path + "/employees.xml')//employee"); XMLStreamReader xmlReader = xqs.getSequenceAsStream(); while(true) { int type = xmlReader.next(); if(type == XMLStreamConstants.CHARACTERS) { System.out.println("Characters/StAX: '" + xmlReader.getText()); } else if(type == XMLStreamConstants.END_DOCUMENT) { break; } } // Close the connection close(xqc); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xqj/tutorial/Part5.java000066400000000000000000000026441222453003200302140ustar00rootroot00000000000000package org.basex.examples.xqj.tutorial; import java.io.*; import java.util.*; import javax.xml.xquery.*; /** * XQJ Example, derived from the XQJ Tutorial * * http://www.xquery.com/tutorials/xqj_tutorial * from Marc van Cappellen. * * Part 5: Serializing Results. * * @author BaseX Team 2005-12, BSD License */ public final class Part5 extends Main { /** * Main method of the example class. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { init("5: Serializing Results"); // Create a connection XQConnection xqc = connect(); XQExpression xqe = xqc.createExpression(); // Serialize output to disk info("Serialize output to disk"); String path = new File("src/main/resources/xml").getAbsolutePath(); FileOutputStream fos = new FileOutputStream("result.xml"); XQSequence xqs = xqe.executeQuery( "doc('" + path + "/orders.xml')//order[id='174']"); xqs.writeSequence(fos, new Properties()); fos.close(); /* Remaining examples from the tutorial are skipped, as * serialization in BaseX uses defaults. */ // Delete result file info("Delete result file"); new File("result.xml").delete(); // Close the connection close(xqc); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xqj/tutorial/Part6.java000066400000000000000000000026151222453003200302130ustar00rootroot00000000000000package org.basex.examples.xqj.tutorial; import javax.xml.xquery.*; /** * XQJ Example, derived from the XQJ Tutorial * * http://www.xquery.com/tutorials/xqj_tutorial * from Marc van Cappellen. * * Part 6: Manipulating Static Context. * * @author BaseX Team 2005-12, BSD License */ public final class Part6 extends Main { /** * Main method of the example class. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { init("6: Manipulating Static Context"); // Create a connection XQConnection xqc = connect(); // Set space policy to PRESERVE XQStaticContext xqsc = xqc.getStaticContext(); xqsc.setBoundarySpacePolicy(XQConstants.BOUNDARY_SPACE_PRESERVE); xqc.setStaticContext(xqsc); // Execute query XQPreparedExpression xqp = xqc.prepareExpression(" "); print("Set space policy to PRESERVE", xqp); // Change space policy to STRIP xqsc.setBoundarySpacePolicy(XQConstants.BOUNDARY_SPACE_STRIP); xqc.setStaticContext(xqsc); // the boundary-space policy for this second query *is* preserve xqp = xqc.prepareExpression(" "); print("Change space policy to STRIP", xqp); // Close the connection close(xqc); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xqj/tutorial/Part7.java000066400000000000000000000046571222453003200302240ustar00rootroot00000000000000package org.basex.examples.xqj.tutorial; import javax.xml.namespace.*; import javax.xml.xquery.*; /** * XQJ Example, derived from the XQJ Tutorial * * http://www.xquery.com/tutorials/xqj_tutorial * from Marc van Cappellen. * * Part 7: XQuery Type System. * * @author BaseX Team 2005-12, BSD License */ public final class Part7 extends Main { /** * Main method of the example class. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { init("7: XQuery Type System"); // Create a connection XQConnection xqc = connect(); // Check sequence types info("Check sequence types"); XQExpression xqe = xqc.createExpression(); XQSequence xqs = xqe.executeQuery("1, 'hello', "); while(xqs.next()) { XQItemType xqit = xqs.getItemType(); if(xqit.getItemKind() == XQItemType.XQITEMKIND_ATOMIC) { // Check atomic type switch(xqit.getBaseType()) { // Check for string case XQItemType.XQBASETYPE_INTEGER: long l = xqs.getLong(); System.out.println("Integer: " + l); break; // Check for integer case XQItemType.XQBASETYPE_STRING: String s = (String) xqs.getObject(); System.out.println("String: " + s); break; // Any other type default: String a = xqs.getAtomicValue(); System.out.println("Atomic Value: " + a); break; } } else { // Node type System.out.println("Node: " + xqs.getNode()); } } // Retrieve static result type info("Retrieve static result type"); XQPreparedExpression xqp = xqc.prepareExpression("1 + 2"); XQSequenceType xqst = xqp.getStaticResultType(); System.out.println("Type: " + xqst); // Retrieve type of external variables info("Retrieve type of external variables"); xqp = xqc.prepareExpression( "declare variable $i as xs:integer external; $i+1"); QName[] variables = xqp.getAllExternalVariables(); for(final QName v : variables) { xqst = xqp.getStaticVariableType(v); System.out.println("Variable $" + v + ": " + xqst); } // Close the connection close(xqc); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xqj/tutorial/Part8.java000066400000000000000000000104101222453003200302050ustar00rootroot00000000000000package org.basex.examples.xqj.tutorial; import java.io.*; import javax.xml.namespace.*; import javax.xml.parsers.*; import javax.xml.stream.*; import javax.xml.xquery.*; import org.w3c.dom.*; /** * XQJ Example, derived from the XQJ Tutorial * * http://www.xquery.com/tutorials/xqj_tutorial * from Marc van Cappellen. * * Part 8: Binding External Variables. * * @author BaseX Team 2005-12, BSD License */ public final class Part8 extends Main { /** * Main method of the example class. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { init("8: Binding External Variables"); // Create a connection String path = new File("src/main/resources/xml").getAbsolutePath(); XQConnection xqc = connect(); XQPreparedExpression xqp; // Bind an item to an external variable xqp = xqc.prepareExpression( "declare variable $id as xs:integer external; " + "doc('" + path + "/orders.xml')//order[id=$id]"); xqp.bindObject(new QName("id"), 174, null); print("Bind item to external variable", xqp); // Bind integers to external variables XQItemType xsinteger; xsinteger = xqc.createAtomicType(XQItemType.XQBASETYPE_INTEGER); xqp = xqc.prepareExpression( "declare variable $v1 external; " + "declare variable $v2 external; " + "$v1 instance of xs:integer, " + "$v1 instance of xs:int, " + "$v2 instance of xs:integer, " + "$v2 instance of xs:int"); xqp.bindObject(new QName("v1"), 174, null); xqp.bindObject(new QName("v2"), 174, xsinteger); print("Bind integers to external variables", xqp); // Bind atomic values xqp = xqc.prepareExpression( "declare variable $v1 external; " + "declare variable $v2 external; " + "declare variable $v3 external; " + "($v1, $v2, $v3)"); xqp.bindAtomicValue(new QName("v1"), "123", xqc.createAtomicType(XQItemType.XQBASETYPE_STRING)); xqp.bindAtomicValue(new QName("v2"), "123", xqc.createAtomicType(XQItemType.XQBASETYPE_INTEGER)); xqp.bindAtomicValue(new QName("v3"), "123", xqc.createAtomicType(XQItemType.XQBASETYPE_DOUBLE)); // Invalid integer cast info("Invalid integer cast"); xqp = xqc.prepareExpression("declare variable $e external; $e"); try { xqp.bindAtomicValue(new QName("e"), "abc", xqc.createAtomicType(XQItemType.XQBASETYPE_INTEGER)); } catch(final XQException ex) { System.out.println(ex.getMessage()); } // Invalid item type info("Invalid item type:"); xqp = xqc.prepareExpression("declare variable $e external; $e"); try { xqp.bindAtomicValue(new QName("e"), "123", null); } catch(final XQException ex) { System.out.println(ex.getMessage()); } // Bind specific types xqp = xqc.prepareExpression("declare variable $v external; $v"); xqp.bindInt(new QName("v"), 123, xqc.createAtomicType(XQItemType.XQBASETYPE_INTEGER)); print("Bind specific types", xqp); // Bind via DOM DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder parser = dbf.newDocumentBuilder(); Document domDocument = parser.parse(path + "/orders.xml"); xqp = xqc.prepareExpression("declare variable $e external; $e"); xqp.bindNode(new QName("e"), domDocument, null); print("Bind via DOM", xqp); // Bind via StAX XMLInputFactory xif = XMLInputFactory.newInstance(); FileInputStream fis = new FileInputStream(path + "/orders.xml"); XMLStreamReader reader = xif.createXMLStreamReader(fis); xqp = xqc.prepareExpression("declare variable $e external; $e"); xqp.bindDocument(new QName("e"), reader, null); fis.close(); print("Bind via StAX", xqp); // Bind via input stream xqp = xqc.prepareExpression("declare variable $e external; $e"); fis = new FileInputStream(path + "/orders.xml"); xqp.bindDocument(new QName("e"), fis, null, null); fis.close(); print("Bind via input stream", xqp); // Close the connection close(xqc); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xqj/tutorial/Part9.java000066400000000000000000000042671222453003200302230ustar00rootroot00000000000000package org.basex.examples.xqj.tutorial; import java.io.*; import java.math.*; import javax.xml.namespace.*; import javax.xml.xquery.*; /** * XQJ Example, derived from the XQJ Tutorial * * http://www.xquery.com/tutorials/xqj_tutorial * from Marc van Cappellen. * * Part 9: Creating XDM Instances. * * @author BaseX Team 2005-12, BSD License */ public final class Part9 extends Main { /** * Main method of the example class. * @param args (ignored) command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { init("9: Creating XDM Instances"); // Create a connection XQConnection xqc = connect(); // Test item instances info("Test item instances"); String path = new File("src/main/resources/xml").getAbsolutePath(); XQItemType xqt = xqc.createNodeType(); XQExpression xqe = xqc.createExpression(); XQSequence xqs = xqe.executeQuery("1, 'hello', "); while(xqs.next()) { if(xqs.instanceOf(xqt)) { System.out.println("Node: " + xqs.getNode()); } else { System.out.println("Atomic Value: " + xqs.getAtomicValue()); } } // Override data types info("Override data types"); xqt = xqc.createAtomicType(XQItemType.XQBASETYPE_SHORT); XQPreparedExpression xqp = xqc.prepareExpression( "declare variable $v as xs:short external; $v + 1"); xqp.bindInt(new QName("v"), 22, xqt); print("Override default type mappings", xqp); // Create decimal item instance info("Create decimal item instance"); XQItem xqi = xqc.createItemFromObject(new BigDecimal("174"), null); xqi.writeItem(System.out, null); System.out.println(); // Create item from query result info("Create item from query result"); xqs = xqe.executeQuery("doc('" + path + "/orders.xml')//order"); xqs.next(); xqi = xqc.createItem(xqs.getItem()); // Close the connection close(xqc); // Write item after closing connection xqi.writeItem(System.out, null); System.out.println(); } } basex-7.7.2/basex-examples/src/main/java/org/basex/examples/xqj/tutorial/package.html000066400000000000000000000003101222453003200306230ustar00rootroot00000000000000

    XQJ Examples, derived from the XQJ Tutorial http://www.xquery.com/tutorials/xqj_tutorial from Marc van Cappellen.

    basex-7.7.2/basex-examples/src/main/resources/000077500000000000000000000000001222453003200212655ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/resources/.empty000066400000000000000000000000001222453003200224120ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/resources/.gitignore000066400000000000000000000000001222453003200232430ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/resources/csv/000077500000000000000000000000001222453003200220605ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/resources/csv/example.csv000066400000000000000000000005141222453003200242300ustar00rootroot00000000000000John,Doe,120 jefferson st.,Riverside, NJ, 08075 Jack,McGinnis,220 hobo Av.,Phila, PA,09119 "John ""Da Man""",Repici,120 Jefferson St.,Riverside, NJ,08075 Stephen,Tyler,"7452 Terrace ""At the Plaza"" road",SomeTown,SD, 91234 ,Blankman,,SomeTown, SD, 00298 "Joan ""the bone"", Anne",Jet,"9th, at Terrace plc",Desert City,CO,00123basex-7.7.2/basex-examples/src/main/resources/csv/mac.csv000066400000000000000000000004471222453003200233420ustar00rootroot00000000000000Name,First Name,Address,City,Country,Phone,Props,Email Clooney,George,AnyStreet 1,,USA,+01/23451/89876,,George.Clooney@emergency.room Graham,Heather,,, Picard,Jean-Luc,Room next to the bridge of the USS Enterprise,,,,"He's the Captain of the"" USS Enterprise !!!",Jean-Luc.Picard@enterprise.ussbasex-7.7.2/basex-examples/src/main/resources/ir/000077500000000000000000000000001222453003200216775ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/resources/ir/pos-neg-small.xml000066400000000000000000000003161222453003200250770ustar00rootroot00000000000000 basex-7.7.2/basex-examples/src/main/resources/ir/pos-neg.xml000066400000000000000000002543171222453003200240050ustar00rootroot00000000000000 basex-7.7.2/basex-examples/src/main/resources/ir/stopwords.txt000066400000000000000000000035661222453003200245160ustar00rootroot00000000000000a about above across after afterwards again against all almost alone along already also although always am among amongst amoungst amount an and another any anyhow anyone anything anyway anywhere are around as at back be became because become becomes becoming been before beforehand behind being below beside besides between beyond bill both bottom but by call can cannot cant co computer con could couldnt cry de describe detail do done down due during each eg eight either eleven else elsewhere empty enough etc even ever every everyone everything everywhere except few fifteen fify fill find fire first five for former formerly forty found four from front full further get give go had has hasnt have he hence her here hereafter hereby herein hereupon hers herse him himse his how however hundred i ie if in inc indeed interest into is it its itse keep last latter latterly least less ltd made many may me meanwhile might mill mine more moreover most mostly move much must my myse name namely neither never nevertheless next nine no nobody none noone nor not nothing now nowhere of off often on once one only onto or other others otherwise our ours ourselves out over own part per perhaps please put rather re same see seem seemed seeming seems serious several she should show side since sincere six sixty so some somehow someone something sometime sometimes somewhere still such system take ten than that the their them themselves then thence there thereafter thereby therefore therein thereupon these they thick thin third this those though three through throughout thru thus to together too top toward towards twelve twenty two un under until up upon us very via was we well were what whatever when whence whenever where whereafter whereas whereby wherein whereupon wherever whether which while whither who whoever whole whom whose why will with within without would yet you your yours yourself yourselves basex-7.7.2/basex-examples/src/main/resources/json/000077500000000000000000000000001222453003200222365ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/resources/json/add-to-database.xq000066400000000000000000000004471222453003200255270ustar00rootroot00000000000000(:~ : This script adds all JSON files to the : specified database. :) declare variable $database := 'db'; (: add new files :) for $name in file:list('.', false(), '*.json') let $file := file:read-text($name) let $json := json:parse($file) return db:add($database, document { $json }, $name) basex-7.7.2/basex-examples/src/main/resources/json/colors.json000066400000000000000000000011361222453003200244330ustar00rootroot00000000000000{ "colorsArray":[{ "colorName":"red", "hexValue":"#f00" }, { "colorName":"green", "hexValue":"#0f0" }, { "colorName":"blue", "hexValue":"#00f" }, { "colorName":"cyan", "hexValue":"#0ff" }, { "colorName":"magenta", "hexValue":"#f0f" }, { "colorName":"yellow", "hexValue":"#ff0" }, { "colorName":"black", "hexValue":"#000" } ] }basex-7.7.2/basex-examples/src/main/resources/json/customer.json000066400000000000000000000007071222453003200247760ustar00rootroot00000000000000{ "firstName": "John", "lastName": "Smith", "age": 25, "address": { "streetAddress": "21 2nd Street", "city": "New York", "state": "NY", "postalCode": "10021" }, "phoneNumber": [ { "type": "home", "number": "212 555-1234" }, { "type": "fax", "number": "646 555-4567" } ] }basex-7.7.2/basex-examples/src/main/resources/json/facebook.json000066400000000000000000000023261222453003200247050ustar00rootroot00000000000000{ "data": [ { "id": "X999_Y999", "from": { "name": "Tom Brady", "id": "X12" }, "message": "Looking forward to 2010!", "actions": [ { "name": "Comment", "link": "http://www.facebook.com/X999/posts/Y999" }, { "name": "Like", "link": "http://www.facebook.com/X999/posts/Y999" } ], "type": "status", "created_time": "2010-08-02T21:27:44+0000", "updated_time": "2010-08-02T21:27:44+0000" }, { "id": "X998_Y998", "from": { "name": "Peyton Manning", "id": "X18" }, "message": "Where's my contract?", "actions": [ { "name": "Comment", "link": "http://www.facebook.com/X998/posts/Y998" }, { "name": "Like", "link": "http://www.facebook.com/X998/posts/Y998" } ], "type": "status", "created_time": "2010-08-02T21:27:44+0000", "updated_time": "2010-08-02T21:27:44+0000" } ] }basex-7.7.2/basex-examples/src/main/resources/json/flickr.json000066400000000000000000000024221222453003200244030ustar00rootroot00000000000000{ "title": "Talk On Travel Pool", "link": "http://www.flickr.com/groups/talkontravel/pool/", "description": "Travel and vacation photos from around the world.", "modified": "2009-02-02T11:10:27Z", "generator": "http://www.flickr.com/", "items": [ { "title": "View from the hotel", "link": "http://www.flickr.com/photos/33112458@N08/3081564649/in/pool-998875@N22", "media": {"m":"http://farm4.static.flickr.com/3037/3081564649_4a6569750c_m.jpg"}, "date_taken": "2008-12-04T04:43:03-08:00", "description": "

    Talk On Travel<\/a> has added a photo to the pool:<\/p>

    \"View<\/a><\/p> ", "published": "2008-12-04T12:43:03Z", "author": "nobody@flickr.com (Talk On Travel)", "author_id": "33112458@N08", "tags": "spain dolphins tenerife canaries lagomera aqualand playadelasamericas junglepark losgigantos loscristines talkontravel" } ] }basex-7.7.2/basex-examples/src/main/resources/json/glossary.json000066400000000000000000000011331222453003200247720ustar00rootroot00000000000000{ "glossary": { "title": "example glossary", "GlossDiv": { "title": "S", "GlossList": { "GlossEntry": { "ID": "SGML", "SortAs": "SGML", "GlossTerm": "Standard Generalized Markup Language", "Acronym": "SGML", "Abbrev": "ISO 8879:1986", "GlossDef": { "para": "A meta-markup language, used to create markup languages such as DocBook.", "GlossSeeAlso": ["GML", "XML"] }, "GlossSee": "markup" } } } } }basex-7.7.2/basex-examples/src/main/resources/json/interoperability.json000066400000000000000000000037031222453003200265210ustar00rootroot00000000000000{ "ResultSet": { "totalResultsAvailable": "1827221", "totalResultsReturned": 2, "firstResultPosition": 1, "Result": [ { "Title": "potato jpg", "Summary": "Kentang Si bungsu dari keluarga Solanum tuberosum L ini ternyata memiliki khasiat untuk mengurangi kerutan jerawat bintik hitam dan kemerahan pada kulit Gunakan seminggu sekali sebagai", "Url": "http:\/\/www.mediaindonesia.com\/spaw\/uploads\/images\/potato.jpg", "ClickUrl": "http:\/\/www.mediaindonesia.com\/spaw\/uploads\/images\/potato.jpg", "RefererUrl": "http:\/\/www.mediaindonesia.com\/mediaperempuan\/index.php?ar_id=Nzkw", "FileSize": 22630, "FileFormat": "jpeg", "Height": "362", "Width": "532", "Thumbnail": { "Url": "http:\/\/thm-a01.yimg.com\/nimage\/557094559c18f16a", "Height": "98", "Width": "145" } }, { "Title": "potato jpg", "Summary": "Introduction of puneri aloo This is a traditional potato preparation flavoured with curry leaves and peanuts and can be eaten on fasting day Preparation time 10 min", "Url": "http:\/\/www.infovisual.info\/01\/photo\/potato.jpg", "ClickUrl": "http:\/\/www.infovisual.info\/01\/photo\/potato.jpg", "RefererUrl": "http:\/\/sundayfood.com\/puneri-aloo-indian-%20recipe", "FileSize": 119398, "FileFormat": "jpeg", "Height": "685", "Width": "1024", "Thumbnail": { "Url": "http:\/\/thm-a01.yimg.com\/nimage\/7fa23212efe84b64", "Height": "107", "Width": "160" } } ] } }basex-7.7.2/basex-examples/src/main/resources/json/iphone.json000066400000000000000000000034141222453003200244150ustar00rootroot00000000000000{ "menu": { "header": "xProgress SVG Viewer", "items": [ { "id": "Open" }, { "id": "OpenNew", "label": "Open New" }, null, { "id": "ZoomIn", "label": "Zoom In" }, { "id": "ZoomOut", "label": "Zoom Out" }, { "id": "OriginalView", "label": "Original View" }, null, { "id": "Quality" }, { "id": "Pause" }, { "id": "Mute" }, null, { "id": "Find", "label": "Find..." }, { "id": "FindAgain", "label": "Find Again" }, { "id": "Copy" }, { "id": "CopyAgain", "label": "Copy Again" }, { "id": "CopySVG", "label": "Copy SVG" }, { "id": "ViewSVG", "label": "View SVG" }, { "id": "ViewSource", "label": "View Source" }, { "id": "SaveAs", "label": "Save As" }, null, { "id": "Help" }, { "id": "About", "label": "About xProgress CVG Viewer..." } ] } }basex-7.7.2/basex-examples/src/main/resources/json/json.json000066400000000000000000000143251222453003200241070ustar00rootroot00000000000000[{ "colorsArray": [ { "colorName": "red", "hexValue": "#f00" }, { "colorName": "green", "hexValue": "#0f0" }, { "colorName": "blue", "hexValue": "#00f" }, { "colorName": "cyan", "hexValue": "#0ff" }, { "colorName": "magenta", "hexValue": "#f0f" }, { "colorName": "yellow", "hexValue": "#ff0" }, { "colorName": "black", "hexValue": "#000" } ] }, { "firstName": "John", "lastName": "Smith", "age": 25, "address": { "streetAddress": "21 2nd Street", "city": "New York", "state": "NY", "postalCode": "10021" }, "phoneNumber": [ { "type": "home", "number": "212 555-1234" }, { "type": "fax", "number": "646 555-4567" } ] }, { "data": [ { "id": "X999_Y999", "from": { "name": "Tom Brady", "id": "X12" }, "message": "Looking forward to 2010!", "actions": [ { "name": "Comment", "link": "http:\/\/www.facebook.com\/X999\/posts\/Y999" }, { "name": "Like", "link": "http:\/\/www.facebook.com\/X999\/posts\/Y999" } ], "type": "status", "created_time": "2010-08-02T21:27:44+0000", "updated_time": "2010-08-02T21:27:44+0000" }, { "id": "X998_Y998", "from": { "name": "Peyton Manning", "id": "X18" }, "message": "Where's my contract?", "actions": [ { "name": "Comment", "link": "http:\/\/www.facebook.com\/X998\/posts\/Y998" }, { "name": "Like", "link": "http:\/\/www.facebook.com\/X998\/posts\/Y998" } ], "type": "status", "created_time": "2010-08-02T21:27:44+0000", "updated_time": "2010-08-02T21:27:44+0000" } ] }, { "title": "Talk On Travel Pool", "link": "http:\/\/www.flickr.com\/groups\/talkontravel\/pool\/", "description": "Travel and vacation photos from around the world.", "modified": "2009-02-02T11:10:27Z", "generator": "http:\/\/www.flickr.com\/", "items": [ { "title": "View from the hotel", "link": "http:\/\/www.flickr.com\/photos\/33112458@N08\/3081564649\/in\/pool-998875@N22", "media": { "m": "http:\/\/farm4.static.flickr.com\/3037\/3081564649_4a6569750c_m.jpg" }, "date_taken": "2008-12-04T04:43:03-08:00", "description": "<p><a href=\"http:\/\/www.flickr.com\/people\/33112458@N08\/\"> Talk On Travel<\/a> has added a photo to the pool:<\/p> <p><a href=\"http:\/\/ www.flickr.com\/photos\/33112458@N08\/3081564649\/\" title=\"View from the hotel\"> <img src=\"http:\/\/farm4.static.flickr.com\/3037\/3081564649_4a6569750c_m.jpg\" width=\"240\" height=\"180\" alt=\"View from the hotel\" \/><\/a><\/p> ", "published": "2008-12-04T12:43:03Z", "author": "nobody@flickr.com (Talk On Travel)", "author_id": "33112458@N08", "tags": "spain dolphins tenerife canaries lagomera aqualand playadelasamericas junglepark losgigantos loscristines talkontravel" } ] }, { "ResultSet": { "totalResultsAvailable": "1827221", "totalResultsReturned": 2, "firstResultPosition": 1, "Result": [ { "Title": "potato jpg", "Summary": "Kentang Si bungsu dari keluarga Solanum tuberosum L ini ternyata memiliki khasiat untuk mengurangi kerutan jerawat bintik hitam dan kemerahan pada kulit Gunakan seminggu sekali sebagai", "Url": "http:\/\/www.mediaindonesia.com\/spaw\/uploads\/images\/potato.jpg", "ClickUrl": "http:\/\/www.mediaindonesia.com\/spaw\/uploads\/images\/potato.jpg", "RefererUrl": "http:\/\/www.mediaindonesia.com\/mediaperempuan\/index.php?ar_id=Nzkw", "FileSize": 22630, "FileFormat": "jpeg", "Height": "362", "Width": "532", "Thumbnail": { "Url": "http:\/\/thm-a01.yimg.com\/nimage\/557094559c18f16a", "Height": "98", "Width": "145" } }, { "Title": "potato jpg", "Summary": "Introduction of puneri aloo This is a traditional potato preparation flavoured with curry leaves and peanuts and can be eaten on fasting day Preparation time 10 min", "Url": "http:\/\/www.infovisual.info\/01\/photo\/potato.jpg", "ClickUrl": "http:\/\/www.infovisual.info\/01\/photo\/potato.jpg", "RefererUrl": "http:\/\/sundayfood.com\/puneri-aloo-indian-%20recipe", "FileSize": 119398, "FileFormat": "jpeg", "Height": "685", "Width": "1024", "Thumbnail": { "Url": "http:\/\/thm-a01.yimg.com\/nimage\/7fa23212efe84b64", "Height": "107", "Width": "160" } } ] } }, { "menu": { "header": "xProgress SVG Viewer", "items": [ { "id": "Open" }, { "id": "OpenNew", "label": "Open New" }, null, { "id": "ZoomIn", "label": "Zoom In" }, { "id": "ZoomOut", "label": "Zoom Out" }, { "id": "OriginalView", "label": "Original View" }, null, { "id": "Quality" }, { "id": "Pause" }, { "id": "Mute" }, null, { "id": "Find", "label": "Find..." }, { "id": "FindAgain", "label": "Find Again" }, { "id": "Copy" }, { "id": "CopyAgain", "label": "Copy Again" }, { "id": "CopySVG", "label": "Copy SVG" }, { "id": "ViewSVG", "label": "View SVG" }, { "id": "ViewSource", "label": "View Source" }, { "id": "SaveAs", "label": "Save As" }, null, { "id": "Help" }, { "id": "About", "label": "About xProgress CVG Viewer..." } ] } }]basex-7.7.2/basex-examples/src/main/resources/json/json.xml000066400000000000000000000302641222453003200237360ustar00rootroot00000000000000 example glossary S SGML SGML Standard Generalized Markup Language SGML ISO 8879:1986 A meta-markup language, used to create markup languages such as DocBook. GML XML markup file File New CreateNewDoc() Open OpenDoc() Close CloseDoc() SVG Viewer Open OpenNew Open New ZoomIn Zoom In ZoomOut Zoom Out OriginalView Original View Quality Pause Mute Find Find... FindAgain Find Again Copy CopyAgain Copy Again CopySVG Copy SVG ViewSVG View SVG ViewSource View Source SaveAs Save As Help About About Adobe CVG Viewer... cofaxCDS org.cofax.cds.CDSServlet Philadelphia, PA ksm@pobox.com Cofax /images/cofax.gif /content/static org.cofax.WysiwygTemplate org.cofax.FilesTemplateLoader templates listTemplate.htm articleTemplate.htm false listTemplate.jsp articleTemplate.jsp 200 200 60 100 50 15 200 100 10 10 forSearchEnginesList.htm forSearchEngines.htm WEB-INF/robots.db true org.cofax.SqlDataStore org.cofax.SqlRedirection cofax com.microsoft.jdbc.sqlserver.SQLServerDriver jdbc:microsoft:sqlserver://LOCALHOST:1433;DatabaseName=goon sa dataStoreTestQuery SET NOCOUNT ON;select test='test'; /usr/local/tomcat/logs/datastore.log 10 100 100 debug 500 cofaxEmail org.cofax.cds.EmailServlet mail1 mail2 cofaxAdmin org.cofax.cds.AdminServlet fileServlet org.cofax.cds.FileServlet cofaxTools org.cofax.cms.CofaxToolsServlet toolstemplates/ 1 /usr/local/tomcat/logs/CofaxTools.log 1 /usr/local/tomcat/logs/dataLog.log /content/admin/remove?cache=pages&id= /content/admin/remove?cache=templates&id= /usr/local/tomcat/webapps/content/fileTransferFolder 1 4 true / /cofaxutil/aemail/* /admin/* /static/* /tools/* cofax.tld /WEB-INF/tlds/cofax.tld on Sample Konfabulator Widget main_window 500 500 Images/Sun.png sun1 250 250 center Click Here 36 bold text1 250 100 center sun1.opacity = (sun1.opacity / 100) * 90; basex-7.7.2/basex-examples/src/main/resources/json/menu.json000066400000000000000000000003731222453003200241000ustar00rootroot00000000000000{"menu": { "id": "file", "value": "File", "popup": { "menuitem": [ {"value": "New", "onclick": "CreateNewDoc()"}, {"value": "Open", "onclick": "OpenDoc()"}, {"value": "Close", "onclick": "CloseDoc()"} ] } }}basex-7.7.2/basex-examples/src/main/resources/json/menu2.json000066400000000000000000000016021222453003200241560ustar00rootroot00000000000000{"menu": { "header": "SVG Viewer", "items": [ {"id": "Open"}, {"id": "OpenNew", "label": "Open New"}, null, {"id": "ZoomIn", "label": "Zoom In"}, {"id": "ZoomOut", "label": "Zoom Out"}, {"id": "OriginalView", "label": "Original View"}, null, {"id": "Quality"}, {"id": "Pause"}, {"id": "Mute"}, null, {"id": "Find", "label": "Find..."}, {"id": "FindAgain", "label": "Find Again"}, {"id": "Copy"}, {"id": "CopyAgain", "label": "Copy Again"}, {"id": "CopySVG", "label": "Copy SVG"}, {"id": "ViewSVG", "label": "View SVG"}, {"id": "ViewSource", "label": "View Source"}, {"id": "SaveAs", "label": "Save As"}, null, {"id": "Help"}, {"id": "About", "label": "About Adobe CVG Viewer..."} ] }}basex-7.7.2/basex-examples/src/main/resources/json/products.json000066400000000000000000000016261222453003200250010ustar00rootroot00000000000000{ "name":"Product", "properties": { "id": { "type":"number", "description":"Product identifier", "required":true }, "name": { "description":"Name of the product", "type":"string", "required":true }, "price": { "type":"number", "minimum":0, "required":true }, "tags": { "type":"array", "items": { "type":"string" } } } }basex-7.7.2/basex-examples/src/main/resources/json/to-xml.xq000066400000000000000000000003711222453003200240310ustar00rootroot00000000000000(:~ : This script converts all JSON files in this : directory to their XML representation. :) { for $name in file:list('.', false(), '*.json') let $file := file:read-text($name) let $json := json:parse($file) return $json } basex-7.7.2/basex-examples/src/main/resources/json/twitter.json000066400000000000000000000015671222453003200246440ustar00rootroot00000000000000{"results":[ {"text":"@twitterapi http:\/\/tinyurl.com\/ctrefg", "to_user_id":396524, "to_user":"TwitterAPI", "from_user":"jkoum", "metadata": { "result_type":"popular", "recent_retweets": 109 }, "id":1478555574, "from_user_id":1833773, "iso_language_code":"nl", "source":"twitter<\/a>", "profile_image_url":"http:\/\/s3.amazonaws.com\/twitter_production\/profile_images\/118412707\/2522215727_a5f07da155_b_normal.jpg", "created_at":"Wed, 08 Apr 2009 19:22:10 +0000"} ], "since_id":0, "max_id":1480307926, "refresh_url":"?since_id=1480307926&q=%40twitterapi", "results_per_page":15, "next_page":"?page=2&max_id=1480307926&q=%40twitterapi", "completed_in":0.031704, "page":1, "query":"%40twitterapi" } basex-7.7.2/basex-examples/src/main/resources/json/web-app.json000066400000000000000000000067421222453003200244750ustar00rootroot00000000000000{"web-app": { "servlet": [ { "servlet-name": "cofaxCDS", "servlet-class": "org.cofax.cds.CDSServlet", "init-param": { "configGlossary:installationAt": "Philadelphia, PA", "configGlossary:adminEmail": "ksm@pobox.com", "configGlossary:poweredBy": "Cofax", "configGlossary:poweredByIcon": "/images/cofax.gif", "configGlossary:staticPath": "/content/static", "templateProcessorClass": "org.cofax.WysiwygTemplate", "templateLoaderClass": "org.cofax.FilesTemplateLoader", "templatePath": "templates", "templateOverridePath": "", "defaultListTemplate": "listTemplate.htm", "defaultFileTemplate": "articleTemplate.htm", "useJSP": false, "jspListTemplate": "listTemplate.jsp", "jspFileTemplate": "articleTemplate.jsp", "cachePackageTagsTrack": 200, "cachePackageTagsStore": 200, "cachePackageTagsRefresh": 60, "cacheTemplatesTrack": 100, "cacheTemplatesStore": 50, "cacheTemplatesRefresh": 15, "cachePagesTrack": 200, "cachePagesStore": 100, "cachePagesRefresh": 10, "cachePagesDirtyRead": 10, "searchEngineListTemplate": "forSearchEnginesList.htm", "searchEngineFileTemplate": "forSearchEngines.htm", "searchEngineRobotsDb": "WEB-INF/robots.db", "useDataStore": true, "dataStoreClass": "org.cofax.SqlDataStore", "redirectionClass": "org.cofax.SqlRedirection", "dataStoreName": "cofax", "dataStoreDriver": "com.microsoft.jdbc.sqlserver.SQLServerDriver", "dataStoreUrl": "jdbc:microsoft:sqlserver://LOCALHOST:1433;DatabaseName=goon", "dataStoreUser": "sa", "dataStorePassword": "dataStoreTestQuery", "dataStoreTestQuery": "SET NOCOUNT ON;select test='test';", "dataStoreLogFile": "/usr/local/tomcat/logs/datastore.log", "dataStoreInitConns": 10, "dataStoreMaxConns": 100, "dataStoreConnUsageLimit": 100, "dataStoreLogLevel": "debug", "maxUrlLength": 500}}, { "servlet-name": "cofaxEmail", "servlet-class": "org.cofax.cds.EmailServlet", "init-param": { "mailHost": "mail1", "mailHostOverride": "mail2"}}, { "servlet-name": "cofaxAdmin", "servlet-class": "org.cofax.cds.AdminServlet"}, { "servlet-name": "fileServlet", "servlet-class": "org.cofax.cds.FileServlet"}, { "servlet-name": "cofaxTools", "servlet-class": "org.cofax.cms.CofaxToolsServlet", "init-param": { "templatePath": "toolstemplates/", "log": 1, "logLocation": "/usr/local/tomcat/logs/CofaxTools.log", "logMaxSize": "", "dataLog": 1, "dataLogLocation": "/usr/local/tomcat/logs/dataLog.log", "dataLogMaxSize": "", "removePageCache": "/content/admin/remove?cache=pages&id=", "removeTemplateCache": "/content/admin/remove?cache=templates&id=", "fileTransferFolder": "/usr/local/tomcat/webapps/content/fileTransferFolder", "lookInContext": 1, "adminGroupID": 4, "betaServer": true}}], "servlet-mapping": { "cofaxCDS": "/", "cofaxEmail": "/cofaxutil/aemail/*", "cofaxAdmin": "/admin/*", "fileServlet": "/static/*", "cofaxTools": "/tools/*"}, "taglib": { "taglib-uri": "cofax.tld", "taglib-location": "/WEB-INF/tlds/cofax.tld"}}}basex-7.7.2/basex-examples/src/main/resources/json/widget.json000066400000000000000000000011621222453003200244140ustar00rootroot00000000000000{"widget": { "debug": "on", "window": { "title": "Sample Konfabulator Widget", "name": "main_window", "width": 500, "height": 500 }, "image": { "src": "Images/Sun.png", "name": "sun1", "hOffset": 250, "vOffset": 250, "alignment": "center" }, "text": { "data": "Click Here", "size": 36, "style": "bold", "name": "text1", "hOffset": 250, "vOffset": 100, "alignment": "center", "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;" } }}basex-7.7.2/basex-examples/src/main/resources/json/youtube.json000066400000000000000000000032751222453003200246340ustar00rootroot00000000000000{"apiVersion":"2.0", "data":{ "updated":"2010-01-07T19:58:42.949Z", "totalItems":800, "startIndex":1, "itemsPerPage":1, "items":[ {"id":"hYB0mn5zh2c", "uploaded":"2007-06-05T22:07:03.000Z", "updated":"2010-01-07T13:26:50.000Z", "uploader":"GoogleDeveloperDay", "category":"News", "title":"Google Developers Day US - Maps API Introduction", "description":"Google Maps API Introduction ...", "tags":[ "GDD07","GDD07US","Maps" ], "thumbnail":{ "default":"http://i.ytimg.com/vi/hYB0mn5zh2c/default.jpg", "hqDefault":"http://i.ytimg.com/vi/hYB0mn5zh2c/hqdefault.jpg" }, "player":{ "default":"http://www.youtube.com/watch?v\u003dhYB0mn5zh2c" }, "content":{ "1":"rtsp://v5.cache3.c.youtube.com/CiILENy.../0/0/0/video.3gp", "5":"http://www.youtube.com/v/hYB0mn5zh2c?f...", "6":"rtsp://v1.cache1.c.youtube.com/CiILENy.../0/0/0/video.3gp" }, "duration":2840, "aspectRatio":"widescreen", "rating":4.63, "ratingCount":68, "viewCount":220101, "favoriteCount":201, "commentCount":22, "status":{ "value":"restricted", "reason":"limitedSyndication" }, "accessControl":{ "syndicate":"allowed", "commentVote":"allowed", "rate":"allowed", "list":"allowed", "comment":"allowed", "embed":"allowed", "videoRespond":"moderated" } } ] } }basex-7.7.2/basex-examples/src/main/resources/modules/000077500000000000000000000000001222453003200227355ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/resources/modules/functx-1.0.xar000066400000000000000000000630751222453003200252670ustar00rootroot00000000000000PKü…•=®› ¿ expath-pkg.xmlUT +ÌM ÌMux õm‘̓ „ï>…ñ^·½6ȱÏÐ+’U‰ˆPñíëZšÈ‰Ì~3C¢oY©ï¤²EÖ8§Ÿè5sMÞ›”ÝÖY’G±Opš¦¼w>ç}Q¬, ŽE¶£ÁˆÆŠ^Ù#¿G²ÕÈw&«Jœpékµ¿S)JÃÌL`WwÂ[éhH ¢Ó½q·Ázù4×ÅD ‚%–ܘل­Î"â?šù4­«°Ëñº“À¸ìùüׄð„@øš|PKs—=³$"_Ÿcxan.xmlUT ©MM©MMux õMKà D÷œ"âÐn+à ]TêÚ%” ò‰À)Éí«$¤Š7¶fÞŒd1‚þ€5Ý|,’ˆãs=Cd)[ o%Ý1®—ô=EóIŒÌ?_ke;Át 'êkrq)JzeªÈj˜pHyk+øP¼Y¨ºgW´óºgÓßÉӀƦ¼lALɪëü°‰`UÁÞ»—àëMˆ8¾RäPK l—=functx/UT 1BM1BMux õPKl—=øÆ40W?functx/functx.xqUT 1BM1BMux õí}mwÛ6Öà÷ü N6çˆrDÇJ;óìd𦙤iól“fb·™ŽöÐes#‘*IÙqìo_Ü€¾È–MõìêäÄ \\à^\÷åŽÿèÿܹã=ò‚–”98¼«dRüÛû÷¿VQvA¿â4ñ~ˆ³0»è =K—Y|rZxþ³¡÷poçaq±Œ'w¨¥8÷æÓ_gYyy:+ÎÃ,ú‡w‘®¼I˜xY4ó"‹WEäÅ…&Óié4ž]À³U22¯¨Q¶È½t†?¾{ý“÷C”çâÝwQeáÜ{³:ž‹öEíâI”ä‘æÞæ§ÑÔ;¾ÀŠ/•}FÅ{‘ ø! Á?¼(ï±õ³(ËaTîŽe{ r×Ù½²S/N°üiºŸ†ôá<žÏ½ãÈ[åÑl5QØ{÷òàû:ðž¾þÅ{÷ôíÛ§¯~ù‡(\œ¦âmt¨x±œÇ²@8 “âB ^}ûöÙ÷¢ÊÓ¾üáåÁ/^šy/^¼þvß{ñã[ï©÷æéÛƒ—Ï~úáé[ïÍOoßü¸ÿí®çíG‘?)תñ› ˜‹T Ó4*ÂxžSïÔËŠó©wžE‚Š“(>†ÞD°Åzš§É vYÔ)õ^<ó’´yçY,x£H«´0%ùFÞËd²;òþ:¥ÂäÃ\Ða¿åŒñLÀ1OÓläý3Í (þê©çí=÷‚ñ{cÏûiÿéÉ}ŽÑý÷R¢„9yבèuR„“ÿ 6øfÅ>îNÒ Ø7’ŸÆ»{ø;Ý€ÏiQ,=xp~~¾ûñw€9ãù˜CeQtèÝ3a5¼$\Dù2œˆŠÞ{ìÝÕê—mÞõþqÇ»rA4õt:ͽ°`îÌa ÿýê/šG‹()rO”AŒÂ•`ºÌóÞdq>ÜzïÂù"ŸG¢{<±=»+Þ}yðñ÷„âoát”íž‹9AZ†Y¸î)ì`Ìù‡ŸùóÓxrŠòã\Ìjx"Àa9ÒÏ_Ãàa)FÅ<ª*1xV­þs8_qý3øÚ@ÐmMæ aä00ٙ݅=_ë±X²ÃÃOH ³ âõÇüÑ¿à‡ñ–1¤×arñ´Hñäàb)Š =êïë‰ü…).›Ù¥P—YT¬²DÖõ.Å”œFŽ¡,7ü,¡iŸK+ñ£äÝˣ߾ꌣžjQÌ~ÕƒovËvw‡‚ñ÷C'þ%žßX$šç:ë\*È®nÕ}.5BGß9«k]j)ö‡žÀâ³˜ÎÆl^)sŠ39ô„ì‹úšÃ„‡kþ"V0;$zÚ;‰=ÌÅÕâX,b&i]ê4¸<ÍlÄÁùOäáÒT$NŠèD´J³B<€êÖœà§>‚z÷eÓQ˜½`ÏW® þÞˆ¡„Ú>±›fÁj ú]»âÿ‹bóÃ-^C8^E. Q_øuâ>¾¿’Ü|wÁÖ^Ldز‡bG.x¹àMU /ÿˆ²4˜GɉØ-†^ìLû˜¨óyPbæšžav‚¼Ï8ú1è7ò¿¨V´M£f{€INæ«\,<µç3_ë ‰iÀ¿*a_‡GF ýÓNˆ2A…4‰X·ºè“yâäÏÆ< ãmcžÇ5Üó¸Ž}VY’Ãm¾8Ο…¹Ò4Š`꡾/È#9ïó4›ö"g½`"ð Š4@4:hKEظĺ´Šæñ‚n­à[\ˆùªxB]ô£Ý“]P[ [¸Â\­¦•IMè¯l½“­L&aáç«c^Gôh<-%y-ç £µJ>ŽþÑòò‡ÕçáÀ­W÷Êf½‘7¸7 ‡Ö¢ô,\Æj-hŸÅY^x“S1¸“‚îøÂUê…^€˜5± âò4ÎìRÖn¥¹ÙL»j]>pÑuµ\Fr‹Ä6+´µ)t&'ÚR©».PÇ'xE9{+¼aêƒLˆcÀXáPL£hé¢W¢¶Œæ%± §óiy©o1i(Êj³,]Ø EçÝêiÔõ%±7œ,ö®;G…žñ’8LÂÑÙ ö©¼Ã”pqûÉÏ$8Ü»âÖ5ʲ4ó%hÀyÏfQ&úñÝãÿ–Î~à °*ìuÕ¥&àêqì¡v‰g(~[¢Ô©nºA¸Ð›ª¬ºd¬âmøÒ¬ìÝ¡8LDƒtVB½t|´ËW¼y«»—¬ôw§—ø®Æ(¤w0_|®Õ‰²ë%wÈå1·B¢i:Y"Øn…P·Œµ4Bo€tï;3 3`‹¿‚M'Q2 {2Ö°Ç­‹T'e§C•p¹è\³Ô2‹fñG,&¿¦`µªvB•Êkˆ»N²Žð46=ü†rì\bÎ-wÖ;dBV#v.Q"’XIˆÜCQºñ;"Éí@£›‰0\Âwø&êQÃÞOÿÌÓI87dYÕà¤A’52Å5Ľdágm˜®$¿šÄצ‘µP½²ÔÚ ÕÕŽl»ET'#°«È¨k}‘êí¾:‰œuÅÍú¢¦«˜é.btñ" Ú, s©ÛÏÚ6_–É׳4LÔþ¡±WÇÓ¾&PÖQ_‘/çq›Q‚ëzàÜqðàäØÞƒÊb"Fu™Æ‚ɶKÛµ—¯  i \ƒ¾ˆ¿R®IUî|#%±L#M.Âbr9H¨/¡¼3üêïî½>©[˜5 Œ»8‡Ë(,6úè#‚=¤ü ü£w»;Ã'÷Mdºa¢Þ£Ò XGîr`©&®é‡C–-Pä Õ·µ(¾ÀûÑôú¨V{m©(µ¬d ÉÌÄxéûMÉNªm㥵959Êél@MX3Ùr¿l\¼ ¿«èÍô’®W¢ eâ_Ùð‰i²šÒ- 1ôÀ°eDF¨Ý™†}0 äâ$@Ù¿XW’ˆ4ÞGâ7ëÂ*¼`'«‹^a7,`l¥éº‘Æ©¾´Öx‰9Ý©îèH`—á4`33ØS’†_Úžùˆùpôåp4J¡Õ¹6ökˆW^W©.z •«¢Ìä¹`FŒ'ƒø,žÂ¥º`„¥n=Ô/@ëF™O{#¶t{À¯*0ãdU¨«øª«X î˜òE ~mgl°„»iææ×Ø£&øÔ§†Ü«Ö „rM"xaN$m(h’°K∘vp`/ñ\xÂÇ.ñ£Waó&4»Üá0û¡ôß”–%c¯_üíoÃ~ØüBÌápëä’ÚÈU 3V½‹©¢‹ s_- 刃@šFJ¹÷Ñt1 dÛxoé 1àà…:v˜ gÑYŒv…=>ŒäõGp´û69P}QGtð ç J6A§ ÐîsÞ½ûƒýU2yƒW)þ9XE9ü}Mñçé*Ãß/²þì‡)Ë«8•îÃã÷UÊÁH’ëÏB9ÀyÃtc› šË„ão@;þ*È—ð¬G„ä—‚–üMs•Áw©]›¬M¤ì™|$Û5Å¢f*KÂ펫UÆÚæË¯ÈJù`0þûÞ8€WÐ`E[µ“÷oÆÏEA°ÿòþ«i'gT“$,ÀXáþFü‰ŠÉnO”…%\.,nê^Ø‘ðQuÃf£g®Í[%t?umäì²òi+ŸÃ/yíBª7٫䉾-«{'Ñs¿•Yoµ­˜‰Š!t<¿–żÙi‚Gˆ|´ yCåƒñ÷îÚÄlíÕ_¹«ó0t°ïÀ#̉óÚd-Ž~¥Ž =ÌŠ6oˆÀ$^ ìš2…â !0S²¦ä!l¢­ãiœ‹#i¸4¶ƒPEæÃ¿“¦†¬­ü/Æ#ïáÿyð÷‹=ëoåÉÌô\Ë\´#âÏ£³h>¤«ikÁv„z«Ì`|ê f”½ ÝEG“mœ CÕ,XJë“*ý]ûd9Fy‘f†$æ³G”Be eTe³ N1šÞo;,7U$…Ùz5[,eiŠêϼ³¢‹Ò³®™:›¢ækÏJø¬ÿu”¬ž¬FšÚÁ uŠ>Ò•¢?(Kùp‚T×É…È~mËT·ÛMÊ kWi^Ö!ˆÑD3q\¶[|#Íajü1©ÈÕüa¿*yMÏ(¾ *ŸK±‰ªf!Àe?Ÿ]]|m»hvG “|‡ÅÊ8_hÀ- “tËŒ«M cÌö ÊfÕëÏQ£ÎÐr•´iÎ*ú,CÆô)¡l=©ï[ ÏFH¥TëbÝ,R2³k"_#ÝJ¡kÆ ò/xß1èÇÅE?ªGÙuD±ÝH·Ä¿#y¨úöˆÑ&Ù¹¾Õ,µà@û\Ïã‘w7Øû룽½»às÷?wiMuœÊú 9·M›f‰¶‹ôªK@}¼‚_¨Õóï †ßÿèÕ+"Ͷñƒ³Qæ õÓm1Ðx’ué5œY€¤ije4øÏ§Ã£ûGÁû£éåÃÏðr ƒO“ßÈËDHˆxúÛƒú •þ¦´ÙU=zì þ3Ð!‹sêÞþ@+/Ü4üŽî?ñ«!#7µîÁñZ1¯%qž_ˆ$žˆ¥á‹@Š…¸aórˆ¿,6~o„(ä†#äPB»ØL|A[‚Ú]µQ–/öðKôq™EyΩ‰ý4˜é¸U%”l¨îÙ FŒ‹haK©yT€EíÇb¿{ÅGesÊÖ(8ŽÄôh”hÐÂhð©‰DŠg# eípVÀ ®^íã9Dë&mwåÁŽÔø¢b¶º>î+†#…£²Yu¾©¯Ô"(+XÊ6FƒoÄŒÀ趺˂ÖÉ‹uH>õqäÕÔ#›s,c΄oÑÔ'÷ÐÎÇË—Ñ$†kì^Íemó£n–[T«…±mÐ^G+ZSˆ*¶‘:ÝþÑî§£ÃOGï?}:úôé(øtôë§£{ŸŽž|:ÚùttÿÓÑ姣ϟŽüOGáTGGàc[oaçÃ)2M„œ¿(êyêI£0aQl8²~¢ù©0 bWC§±æ&l ^-úP·¨”m¢«†FIÓ±m)~@KÖ««I÷—ÇT¹º¥îiWB¤HDuY_BÆóF´¤UˆÝU¥Žà˺=h<ëõ’¦tmQbš…ÇŽÓF…Zh°=ÄÚ„iCàm‘Êœƒ.OvÖÁg„ËeN DQ@:m‰Á´ÓP¿&Õr⬠],årí1Ͼýæsõîðо’V.I9Ò³t>OÏ•]¶2Ã?ŽPqi8¿VÆøÝÏeÀx—f¨íü.KWË1á'Fô‡ç:¢-"Ø9üf´ñÔaZGʽ0;!ůض‹}c Í´<ÔbžÇy¤«ûTæw#Õ,óš™"/&ñþ[rÞ"¼À øX˪P¸VU(ÈU#»çY,¶$JŽõÂü€[ë§Y|'á|¿dqùH»p#0d|ຟ;Hi¬{:®fmlSÚúèÃÒ8´ðô±vÏ$1÷¦7ÍÍyµnÆ$¸6pnG4ѩϾcAxµWez¶dµˆ2âš[ç°< ÒÑ1×Zeº”IÞ­%N1 ,ãÔ‰CÒK¼!™¸{hÁˆ4dé|Õù. 7ßÅl©ûÈj@½Vã¥Æ`±d´ôëaüñþþ£:§Ý|ƼdÉX‘.+H„KË>†™Ñ©;«éîKQxd¸t°ÕZÕdãª3wÅœ„‘ZU¦ˆ"˜6#Ñ:‚é&½ÛA±fËÞ›£YŰw#Tã‡>W³È6îL6Ž\Îçìê _TtÎȤÏ´{¤$¢Í$P0™œœƒN;Z$ÆJ‹V®ÆrQF/±ºiúòâ“$ÅzòîjR¨ŸáN8ÃúòS=ï¨`wµçªò¤Õ"M\Q†#v¬A“-]ËàúáÊ´h§ÀÆ3)‹®º˜iQýúÕsp¿W¯ž?ÿE|<Ÿ¼í“ qdžÇ‹ì¦Ð¶?õùb1^ˆ¤­˜Ödí†çšÁµêNéÐD'«MŸî´‡nR§[©÷KKwv(——J0ÿ²B½%ÿà×£ç;H¿òíKüvOÆý/:Dý´Š~{L0Ж>©úWŠ¿áÖPýÞÁ½qpïáÀ¹³îqB2{ÕòíBTFÏÿï0y/¢cJÙÏÎ o·6–V××ý¶Ç)Hü!̲czÖ0ؚˌ~aÞÕÿ†œ»XK|ãûÕ &d–ðçÇI^§gðçy4\9s‹®%)WaväÌè[Ï4ÝPÂ]Ø&è ƒÃ4Íä÷W°G`ÒÆs“¸‘FÝ &ï*/˜ÂEJ|¦sÊ_­ÕcApúN©–×#zi[‹)—eĸPlr4†æ¤]½?çÓI˜M{Ù¨üÎ`¹â9¢ˆf0øÅi,AýBzØÀ5 æÕ¾Ó‡Ú¨ÙáU­#Jh¹î4»ÃPÄ^og¿ËÍÌ"CcOÒΡþ…À{¥ª’u«ï<‚…@´Zu8ëØÆ¡ÂjW”Ü+:Z•PâNeýyjR®sˆ‚^ã2æQ°ˆm;R—•ƒí„À¹ý²AZtu¾q¨´Ñvó ÜOo_¶$,ãw ¹l—ù@µþ7îŒsÇ­Bú hÌ5®»jH8Ý ÇþÔ”ÍÞýú´Ü ÚŒà¥ë3ãJkUq¸8ö¸J£± `×#\©I+ƒ½¹HWÞyH±é”:« ²µf‡û2“ÄÛÌPÕ;Ê/áø¥˜†|êT¶CN»Åw´,]•ZŠ:e=õ¨¹&ÅÊ“•àWsyiÞ°O W47CÔ4{Èšk-³t³„(9k<°±žž ¹ JàƒUò!IÏ˃Q`‡3±ÔŒ–Ù0Äþ5CC§ÄKÓª—)–(]SïÛÆôøWSøÚá}YÑŠvbvšQZ3 å9" Ä?M!<{Á¢í”¦YŠŒÑÌ!Á ôO¨Ç7¾ur!f*´PWC Ç6So$z‰;ç’« Q{ ¹Nt#—ŒiÂQ8o{âåéü Y4Kӹ傃DÍ¢ ø‚¦˜/PSC[.eiØIÓe”Á@"áÜrE³×h®ß¨›«Çª·-T¬´,7b²1Ë{ÒØUM¸%à¦J‚ÐK¢²Ÿ‰Œ"äÌ`Õ*5KuÕªÖI5 ƒÁÓ—T>i6ÅX ôPl6vOv½q.¸àa2y_dÓÝ^¨Nh±}’@¼¤ ˆtÄo¤¦ Qn3Ë‚§Kí¾J@Ðm¬õ°cv©ÁáÞ—Áßßßû4>_¼Ý¢ÜœJju›ô<rÒ¸¬›kÖ}XÖM¦kÖý¢¬›UêV¬ß„Sd3)ÂHõåq&Ž{l¡q|á…S´•ö¢DYÚ‹†bNFÔ×õ¦)\è ¤P—e«4w”Ýõ¾7ó¬æ[ƒ&﮵FÜrµ¯ìp5Ì zóäXü·ÒþˆÞo? D]ONs«ä)-mFÊ+fŠÁÞ@场áªëÌÝE\<¬m*ܧroUÆu‘|Zö¢Ê¦âɳS±Ïr*ª¿UpÌ’gêæøÛî„q¹§sweËDÈl|e–/}êïh|üïBÊ‚¾ŽÕˆöØqTPæUQûjFQœÈȾ”ù[lÕØ*‰Ý)w1°šæç背m?Ћb@O{ËD°L;¸8wŒé„®)œJ° Q5 ‘X*¢‰T¨ÈšìçûÉããüÇÙ¾b É {’ªÿ`w÷ÁÎ!%A‡%ü¢^¢Z”Y€7 V‘²òÐe´4ô¾z¬'G ,ù(ùqp8ñ4m€#­åÁ{”·#rE›¼÷çaº5ƒ–vd¶+(žØÛHg6K¡NÕߺ†ÝåÑ,Ž™“‘¨Mb©ç¹õø±=L%Ù›hÃ,íÊ£µÃ}y½–_}e%° õ@7ÇmAn0°$Üž§«¼/ݸlúqÖ&uäAWùÛh9Aµè ”¨Ñ¼Ò½ýAN÷0ìb”ˆb…f÷0mù,Ê«N¾âœ±G¹Q›Áýç®rá|nE¼h ²õ:AØzê4@têæÍ|  Êym³ŽË¡ÊÅr‰­´¶b¨ˆÏc˜K^æ¿!7Eûê—æáˆz4¾w™Ó4ŽµÌ©ŸF<4"khøí®^¡e»aG…–y¥î¡¶oZ5déÉõ4=0¯°Kç§ñä´œ$öìé¶ñDS0]p[§[™¯©:áä49'ákÓŽQµKm&ñ É×z¢µæ•ÍûìfC-b¥Ýf”(¶HøkH÷’¡Ûvb*³[àT°›G©EÝLDR\q’-ýŠt»ÚRÐ.ä±lñkKw‡`ïКÖXƒDצ’â@ˆÜg}fº³» ;y«ëÆ6LמR:–·=µ:ͬ«N¬&nÔ;ݶÙ0gcÛd¼¬›‰kcbLÆuçâ:ß6#­@"Û¿®]q‹…ö>qnïµ°û^µu˜¦Ö`]q²njK嚨7°§ªÙ-uÛjU÷TpO¢Gú÷Nâ31þ¥ÅF/úqØ2îpšn*¨ÖeÕ¶jP ýÖ¡ìç$]ÆöãNÖÅ£á¼{ †×¹^Ðôƒ~yo@×Me 2ÚoÈBQ¹k}KÞ%4³Ž£“8A-úÈ[-é‹.¨§}Úê°3L 0m²ÕŽ™Î“Ó09±Š®œdÀ ò.‹… ¶ËCaÛ‘à;•÷UÿÝÉù©Ò©+Yþ¨¤îeënË ÖèBòÊ`ðëîΓ–Óld€·8é§%èꈑäfQŒcš`l´Ñë38–d™\½Þ.ϵtål$;f®]Ä&e§h2D'?7®).Ú`Øi± •ü¬aÑ2ÏPÖ‚¥6nžcåRF˜§U—¦R8ÑÙ ¢xÚ1Ôš&íDÐ Ÿ«'T¼Áãƒä¢ÇdYðÞx02d’m†e`Ö{‹Õ¼ˆ!c»V8KX"‹1'ÓTcÞG¾GîBœ»£.Â$^®æ|C£owß^À®»ÎƒZôŠG9×8ÔqR¦7i“_<צE²ÛaÛØN넹ý6Þ ÄÖñ¦×îÒKø`½¼W^£»ÕM‰LîÕàŽ×^™YL& ööPGìÏ V×Aª tdbí(&`X…J3)ÊAmJW`U–®Ô:½°>âÔ=­ F¬ÓÊp:äZŽk1ãœFK±gý"•–e X&¢/ÊbbоõÅ8—EÆó¸÷@—Y|rºáH—%È« ³êò(¿ÏêRú„ vâX²`‘EY®zHB‚|p;d¶jB cCF+§ˆ«úWbj«ÚœVÅyªäzN‘mqxAͤìLä8L¦ÄÐöÍ¥cbQLO›T“—X<62'u´ªO‚€Í†eBù2lúCýq£… G_*ýOË/½nÆÃQùã!YÔº$@áÃ{ñû–„oX€w«\ƒÃÇI˜MçQŽ;§ÞÂI+ àI„2À‹sO€­Ãzœé.ŒÑ1.u#~¯X×’W*&e.^ÝŸG„ö¢“hI'¸‡#†£=×åÚêN|ýñ6‘~; ¾A2_O$(9€¹4¤(¨Ú¤•áã!˜:ê‰E9‹rR<8Æd;V‚º{ mi«@ßH™cöò*îÇFÃLejÁ%â+{Ò4W‹Y„õËÇÆ-ùC°ì-}nT|>TÕ`]ýÜ¡‘žÊ”×[¶~HµXŒl'Pî5e'Á>+tõkv8y”øÛí(ük¡Ò¹Eu’’Äl´"Ž1–}VŽæeÍnÒìU™´5µ¡‡£ñ²Q h‡Qo¿?Ð\¥¼êtçt”ŸYY4wÍ\_·†˰@aƒöµ´Én™ ¦šÔÐx¶f,ŠJ2ÕWªÍ]4دj:1–‰\XÕE^êÈŽõE‚v·‹n£®Ù5Tͦ¶ t-.Æ— ¼äèU¯Ã÷Ó¬ºÖpXW^jÒ¬\‘o}(zA˜ŒR'0CI³¶°äróP]T䯪"ÞÈp©ð6iÇžÌ  ‡~xÐN{äÍSÀ$\ÆE8ÿ@ íÞÈ2ïgȱž€2ì¬[ÔÝ5ˆcÃß0‰VËe”a#¥7"Pë ä""mEÞ9eSÓt<»2]Lè&UÌݵ[6AúÉÝõç@Oƒ¹áÑÛ03ƒ61¬ºœ±¢éÁ$ª—hb«Cò¥¨X§T/µ’ÔGd똹E°Jb¯ªýk"g=*mW-ÔXÓýóEFžÃ€"Csï®—ÓJ5ÜOàÞI V¥~Ê B!id8DÉIôqH¹È¯ëQž:t¥h2õ(µq5zÅ\Ír/f¨¡;MU-eÓÉd•eRÖ†Û5©þg3ŽÒµ§±“ˆžƒŠŒE”‹Í] Y}9Í»“—ôo[=s·kÒnh¾>é6aŸ4ÌXÇRMWJöµšz±‹u—~Wkyix½åz«g=ùV-ØœnIø»;C)F!ú…¸7nî„ëÖ/ÞÚö>½obùÖÇ‘-RÛª]Îwƒ ›%‹3Ú`2Ï ˜T¤¯uxi»EÆ–I‹ÙÚ["isphG÷|–r WAðQK§éJœåq¹C¼JÅÕÈx¹ˆ("ð‹ùŽ/(£ÎªbZÉ½Ñ®Š›i†cCÂÖ6Ú’PrÌêKp‹®Š¤Ø V² £¨1~œ_:­øˆýpôp–D£µkSß®^Ÿzõëóë$Žx!”Ë—XôðJÀ¼Gwƒ½¿>ÚÛ» Ú¼»ÿ¹ÛoBœ¾Ñu†b‘]ÁHþhçº*tæCõSb1G¬uÍ‘êi îÉüÁ›ƒ½ýÁhà_m¥ü§ŒJ¥¯X(X÷püýý÷ÇJå(ÿæÀÇòÃïEÃ{÷Æ‚¤ÚºÓÒØuÚº¿nc¢gãýàËu𣠨ÞÚ]»Nc÷íÖÚ21 ß~ ¹3‡P‘*p,:Ù†”§Á³™¯™ÈAì¢ü†æb üN³Q˜MâE8·võeýi|¶NR›& ß·(ˆÓMRÅÑÀ­‘å`ü}ºÐʹm”a¬n’6Î&n‘:¯:QR01q.¢0{¿·€<ˆÖRÇÑ‚›8•aYŸ< Õ:чöÛ6{«›¤³‰[œ=û]¨tݾɃXÝ$m ÜîÔù¥BtN’AÕáÔ¾%ŽJuQº¾sR“Òhð«øîðWÒÝãË%~.=íq8Û40Fe<Ü´Æë¾ì1Œ·?w÷Ëâ0³éD¦“?>~.9¶5ãmøû«Î8ê™8(†±¬ò~è„Â<Ž–¬q©ª¹pv|.µ±¥ñ ëׄG±cÖõ(wGül]x ù—9P@•FZ˜Ì*‹’AA9 )€sm«[׌˜d[#u;xÕ‰RWñªÓ/¥ôØ={ä$ƒ¦¦Wsî«Jº+hÙ`÷1‚º­«PÏ€;ˆÃÊHçÕý‚=‘°Œ…Ý#™‚.®’m¥bÖÕhTz¡‘lD`YDÕ‰T÷b{ è¬Ó16G櫬mèK¨íûÒιݼÁÑ»ûƒáá®÷—ÇÞ`P™”UQâªoJ&b­›? ó^6ûˆÆR,оã`§ÓxvÑa¬-èW; XAÚÌÁ‡CÁ`¨GÁ=&V#(Wa+|‡¬È›.F_yYpÔa*¼êÙã].m#vr»Óv$Fô×>H.d19Œ›‚KžY;~Œ<õµdж[/?~md wÄz¨Ûìr£Ë|Ô†‹§Žvj襋“&²×I@‡ÿYüÄ’Ÿëoî«Z§aëh@%ÀºÎ¸pÀÖ›ô1„ha,ô̺á§n˜˾5Pߥ£ºó™jy©O€ ®É—*HSÔø ÚOˆ+OˆÅ³€ýˆ©¹ÑÞpèÝoð‹öêÓü_PKl—=|ù…Ë1Ø‚functx/functx.xslUT 1BM1BMux õí}ywÛF–ïÿúÕz>P&(ÑI÷¼8ã­ã8ñœØñXJÜiIñÈ¢ˆgà –´òÝ_Ý[ ª°Šé¤u|L¬åVÝ_ÝZîR{ÿõÏÛÛ# {ädJÉ«E4ÊþAþqüà âˆü\$~rkQÆù&žß&Áå4#î7=òèèè?ÉK?»£=¨!HIÈK#ìq’PJÒx’]û ýšÜÆ 2ò#’ÐqfIp±È( 2âGãÃ8Ù#³xLnáÍ"Ó„dŒàŒ&³”ÄüòÝÛŸÈ4MÙoßш&~HÞ-.BV7kÈF)%~Jæð*Ò1¹¸Ål¯€ŒcAy³Ò}hø×„ìwVóMRè‰Gƒ¡¬K8¨hVNý˜¦žÆsFëÔÏ€úë É%‹”Na°¤äÃë“ïü鄼xû ùðâýûoO~ùš%ͦ1û•^Q^P0›‡+—‘šøQvËÈÙ#o¾}ÿÍ÷,Ë¿¿þáõÉ/$NÈ«×'o¿=>&¯~|O^w/ÞŸ¼þæ§^¼'ï~zÿîÇão„S*{m¯ºÛT¯MX‰³˜uΘf~¦Ðê_·RF\8&SÿŠ2®hpÅHóɈ  OÂ8ºÄ¦²yW~M‚ ‰â¬O®“€!!‹ËÜÚÓØÕ'¯£Ñ Oþ:diüèSÈúþ8c©Y ¯‚ +ýUÇIŸü=N3Hþæ!G†Ã#oøÅÑŸŽ_ìA¢­AÄš=âIÌ{_‚Ê>km”ù£ ?ÛŸO ÑÍ`Ï ›žKì Gì[ʈ‡¿i–Í^__nÒ0›ˆ±–B¶=Ï{Jöþ‹½œf·!eX¥¹™…Qú˜½|²¯e¾þb'—‡Ã¯¾úê‘uxÂZžÝû{¤ðÇ ³‰QĘO¨ù~¬Ëy“VÕ̆øððo~8Mé̯Ë;‰jòþõðfîgSOu@] a<òÃZºñ×rVY;rÄÈœ3iŸR>z3 cê%4]„™7Oè$¸¡¬ýØ{ä&Ý—"áÉþ£ÁÑþÓ=Æ/³„¼SâgB¤€ZÖ;„†tF£,% ÁFuBÈ»$HGLøäƒÎÒ24 iILäKè²7‡¼mýñØË L³YÅÌýÄŸ±b(’Ùâ‹›ö€âëi0š¢<¾f’Þ°Â0*Ð( Þ¾õg”—±'(HH•EE3ÿì‡ ‘û ›²ç#D6k}²ÏÛþØlû>ûOöe{Ïö‹·‚ c2Á*9å¼>Ù‰…*öŸ’ªôª§x†›ôñÿÀ×¥éyç¨ ~tû"‹gÁèäv.3ʬlä{Ôg¼K)£ìɾâ2`”ˆTW~ø!5Û°¯2 X¡yjæOE‡ÕT’·ê©êÙªšRú¿y-ó8 €snOV§²1ÁÏØÆÒ0ñïÊ&>?8b6*_ƒyBF‹$Áþ>ïi5‹Br¨òÊÿ5ø½BBÈ?H“Îý$TÏÞ" ¼IÏ<ä«tYFwp¦>`M>7ÚwȨzôPïR£Ÿ¡ã=6 d¹Ïî ýyñ¼’?¥’öÄ1BžîíBjÆæ«) (Ÿ0YJ;M¼ú²XBR`àsš´_$Á b³ ¶¢`£µÂV0ð,jEñuäØÎ‡>›ÄüKÚçS)¬÷élžÝîË償âJ·ËyñêÒC¼ õ îæÙ7ýª5…=n¾ekß´´`‚Õ_ĉÉ$ˆÄ.›—Aböi1£‰ÍjPnt;­V¬®Eãy6¾C²Zy ±a®êÀpßq ^Ïf‰ð?2<ä »I¤MYÓGW·ùÝŸËŽUTO@LóiÃŒÁ4Ïkƒ6³ž¶~>+»˜Ïi‚â JE,•0d…„©]jê/4±S 68ÓP!8aËzx×%4Oƒz‹ÔS:/ã"R[SÈ‹0’Æá8WøéÞú<(jÌJèµ]NöÔŒÁºÆ™{õ!1ªÙÈ”SʲTïÉn©L.3(;±Ÿ‘uàfG¼“õt=_i|Ð$‰7ïY¡ëˆž}L&ŒE>rÛñä#v/“|8è–5ºCÞ[õ–4ð{­Í4ŽSjèã®aÛÇ;‹6Ž'”ƵAOÉ` ­SJbD7¾µ®Lwö)Û¹Ó/žä<é“\OˆÔözç5sP)aIi*'U¦D#êŸVzSYHïwŽubÔXB §íðùAU#š†£È̇LýL\ñ§õgm³ƒµ2µº{ãÑ‚ÓÍ•¸ÈŸ-úª±;J=`ôOu£Ëm.RTÓè6†×A>˜êÈF"ŠšñBn¡ÒVƒ³…R»4IrEöÄ4•½CÀ>™äÑhìwk>SdYóT©Nï*fIÆ»H¤¢×Z›õ4ÜXÉÇLÝÕ^ µí”¸+ó!öEå& œ–wÄÒÃŽN6A-·¼Av‚ßà³g•‹ŸÇ;Viù1ýã%["ýmÅéÉfÚáØÿ½lfÚfbY é{Ì)H[_Ž½Ý™NZÍ&–SI¡­;1‹l|Ùâ„agh¹Ó3ÆYI®oÖ°4‹liñÿ§ú¢y+ þ)‘{)ôÕ94Í'+dqIGllÊR;‡õ#uT×±ÄH¬ÎŒÓyXXIby4¥Zñð M¨Ø@ "Ñ$8“1þÎ〠7n, ¹YÉ‚„òn4m§«½‡>†¨¢[q «±'ê”ç‚ÑãÅîsYÃÞÒOFÓcA{ž§’0Ž?a—7ÃÅ$eVµUšZÛJX¶@[ϨÙEhºg”‹éü,H'[@È~àǼFÊ6Ýit¸Üé+wä„^úɘ°§]Úw*f£Rˆ=Ð ó«t­ò»ÄÄ <çIóoÂxÅ}E‚Š8ìD}PDÙ¤ÕÔUQšÂ¥\ŸèoTVš+œù8É (WëlcPB’•Jª=š ÛnH2ƒ{ìÌül4¥ÐÑÛ Ö•Î¯îààìCïYÝRN+DtMGþœz°nb²ˆÞ¸Øã%Ý—üsܳƒƒÞ³Žö+žƒDÕüßPë•+cXzq´vŠÌùíR8Hpëû2”ÑŽÁtæ+fzíkÈÆ5_Í6h,ì‹ÖˆaÞÖbù5(–m¬L¾W½ëÑ´¼®ÞïKUP²e2ùa{•¤…ý~¨ÿ¦«SôD…·¬`¾«0ÔVùžbé‚ àÅ(“¿ÈQŸ€=qŸ;ÒâiõØ¿íÔ@IÉ@J^ÀÜà ŸLßá[á:|ÛŒTÃO—Y8ê–†KИvYX+W7s’ŽÃ{º$–í=4÷Çžp(€= wÌss/ÙÔëÙë;^.¼­sc›{hÖ²JvÖ~Èl)ÒMì‚klf®‚1Ø2†Î™”ïöÄ Èj62´÷l垈`D‹BiA´È”­aÑ:¥ caÞ€VC ÜŒáÅ_ü¡†X9ômKª°ÇÛåá|¸÷àŽ˜@ãÜ"h@Ÿ6礸D¿."¬/ÐÔ¸±ž'¯ÂGñîú2̃4üâôôÅßþÖëtxÞ29äIÁ*šÇ…*«ì¡ÓKÑÁˆL¹]…t’óB!Ø„'¹ær4.ž`ãD ˆG1´uš¹¸HèU€6°ß?õåB íÃ9È·Ñ%„pë¬q@ŽÇIõh´<”JÝ Ýáý€A\çx9}⼉ñãdASøü@ÇøuºHðû«$€c?ãÇþ§åææK†ç–&HXì8B€ÔuãC”¹ãè` €ˆ'Àˆxd0‰Ä¤™FüÈ0#žl ­ÅÂÄÃW8È‹ÞUH ¹]@+ÚyH(í%[5e1÷•X“öøÈç+3¶¦{q+– cÖ]AvÛ©–DvRÖä_–mƒ öl›÷›š–M;ë›|4{r8Oú Ì›Âà%ûÞÑ_íC(…ýîó•Oy§Þ%ºD•|Û&©-£Lµ€†~ø† ÷á×ûþûÇoÞ~­‹ô*kíàlªT•½Ý]Å ' vä€:i˜§úªïüóîôìá™w~6þ×£ßãÿ<`üá¾›{×—|ê_GLèã'¢¨GÎæ¡÷_ž矎^²óîäèØÑÒËÐ'}gŸ¹HUO×g¹À!•êq!úò–õn0b³ê-¡ ­}\¾“îTbÛ€wLdãäÛ%°9M8·•áÌЯf/g¤æ ø@oæ M‘®fkp¼­WºòvèâµÖåÉ׎µªP_ô¥7ÙqÆv&ŠÖ‚“¡2Nö.(÷LÌN¼ÜRªë;‡Ž4¥«¨udöãêHË•ä¥û“ L’ª ,¹hñ£OÁÝéÞBìÊ\\9ö˜ˆ­S–2ÏóúL SG‰bYGßyÎîyo‰Ãñh„ã:ã’8¯õ^1’iþÀ=†UÑ'5ùP@ð4ºí£•÷Ô·h1œ4&霎0øÚ†ÃTÑxÙÆÆœçiÎŲ·/kù¥ä;x©èÄ8îÙàîìôîìüîììîìîîÌ»;ûõîìÁÝÙ³»³ƒ»³‡wgÿº;ûýî̽;ëõØ$pv‘­Zú¸p^Gl`ßø¥×1&ö*h=[ª&.WÑ$ÙÖ C-"—Am1á#ÝR¯²=v`–˯ ·ÊÚT“x9Ôx·ýå ïËmïaÍX€+Œð€¿cSìj=ú£r‘Û»i9ó”Â+£.è‚ê56æ”× Þ1m7ß%T …âÖA±£ÄR‰Haßž¹ò@¥pž‚×µúó9«)` dt ¶9wêüÃÙT¯Ü«;ê·äYÿ¶íÓyl6èZy)§é(çè$ÃøZy*Ö Š*#,“ÁË_|ƒ¥üÏ‚&·äCœ è»$^Ì×ÁKNëtP¬H*æ}mÒÇöè?^è=ÿµ‘Õ•õnÒѰB¥[NuÑZñËzæéSèXÍ ë 8¨b|a©ØïJÜFü&¾‚qd¡ YËÄXGïcUÐ q1…uä6|ïùñ•ç§ZigŠ¿¤âŒ?ÆÖç^å 6xêÎÉ«u‘¯Üˆ"kNbàÖIüm4®ˆâ¡‚19/À¦ô·WžR¹3¯‹ž"ÈY;SÔFN)$Æ¡û\h÷Ê´ÕQàËIa»œNϬ£z«­ªÃbéö’¸ûÖŽÙ°wpð¬wö}ô §{¸‘†ó´n•ŒO'Á$ÔÆªB~jµì êªÚऩ¢3-ñU®»ÀO».9£7,ÛiñR?í& k/“Ü 0o xQ̆ù¯×±ûŒ·_ïÔðsÜÐñ–ø‰uo˜ŸF;ÉOëA¼¶1,´`Ûa:¯|Ã\7+ùØŽÌ5†öͨþŽŠØŒ¯_ŠÛ8õ>뎳Á˜/ŠDÍËÙªÈkbe¡Ô .·ªùhçB›ù®«…< Æ0fƒ” çpžaÍGuhD‡RSÿŠòKVåÕÓh¹êF}Œ¡Ÿt~ó*c‹¸t‰í9j±qz*Ûƒiém`?ïÛÇNÊ (Åâ\ïI–Utè`uï|nÎ~xpúü¶rÁØÖ’”ŸùÉ%? d»Â È1 —h}¢ÂÖêgG*Ç’°ïÖ‘‰ç_¤•’@*<Ñö@Â|æß℘ÇHžß£¥2ðˆ±ÁD½Å;ÆEÖFìHÊ6e¡”¥²èØhe)—OÜÇò&HeJ¾oÇ>|Ço|ÿ~e{iUž.B?úÔO–>ÂG¬YBå°â›–6¨â:¹Ý±•¸ö³LÕž®®„)@”vmXn*ß]œàdÄÓöÈ’V‹¿)¥½è¸BôôrAÊý,4·‹±%®BÑüÕ0#×B𓸕¼Uzcá'\ícëH+úimé†ÕÔ²é×RðY˜ÕJ£Z–êTó×ÐlûZ_[{cp™gâÏcAý“ÇÝúЦÐ$y¦i`F“HZòç˜7ª´ê7éwÚ"2¥hL{#YtN•f°,W•Ç&ç¥"èX¢Û|óÔªKqÏCÜpèÚjœ[È?â¿C¥bü®‰º?Ÿ|Ó…¬?´Ž½XÛª4¬½8»wÄæJvD¤Ý#Z35381#3W ¶¢ê±"ãÃöÒ-ôwk@Öv¡|þH«n\:§Ð\×zå¥<™ÒÞÎ`f«pÙä$·S2É]A(åvœ8™rë® Ò;¨§%mx±ôÆûd´´*)Ÿ¯µœ‚¤‡ºÝGÛf.É]èG{ý:JÍKdÀÈ‘ûCL¶äTr»ËA$Õ¹8 .ƒÈóÁ%_i¼î«hŒJLqóv¼*D&c»óemÞÍÃV#sþf7X^£ùÖ[«8-JË # ÷››D÷‡}ì_”nEõ¥°ÐåJj>_r;æNÙ)¨¨>ãÐÝ®JØðÂp·²³ÂÖ*Ý §‘zŸ[lEË "µM¼4Ãk,m%ãë: è&ú[EÊ2Ký b¥CýÍ¢EÐëŠ^(Àex?¸ˆ»Lü0Q ~ ¸2¡Kx¨°…MYŒNóU¡äý=ݲø [ĺ_‹å›¯Úäâ ½³Ø*ðK34 ¿j#õ~Iž#=,$_ªß‡GG°d8ê±^¬Iò%KÂRÜCâÌb±ÏÐ㺷.î–‚RDAº5q‘jjA‹€4þo}ø8y陆‰Û°\³òAblí¡Æ/i„ ¯£c~œVÌÜ=?@Üç—6U—XW\ÞgÊlàz Ó–`»{XýóTÏ,¾­ŽË¶ñXr뀬&ë†Ê‹Åö*öÎA·KHûãÂëÞBÍDz8§“!ÌèÝâ)Y¤üxÑ ÞQ"2N;H•ÈÚêùäxsXMtéì°6ºñˆ.”¬7¸L©Ä?@ ƒäV±eT%Ú ù…Ÿ1XÖt¦Xà*døH\3qï¨3lVBÞo3Þ rháfT¹;mÆÞnåEêZ)çÞ8Žå¤uK0^až¤CR"Ýä*6Õ<¤¨ôÊjæ›^Ú]¬€šöñ` Wõ¶c-Ø™!%Á,…ãã1Ø\O¶2wÛNy6É<¶žÙ…„t6ŒEîv,Hç׳ô¡Ów¬”Š'Æ5cauzZõyh²kÅ%+p^æ/ÙY‘OÜ:Y#4w3käÔñ< ²ÜÚísR Det+Œ«„ež¥HµÓ6y%ÁŠü*ø+8îYr=»;‹Î’g=ëñ5óo‚Ùb&nºbì⊎ï¸b$yHNÓlÖò® Uî&­sWšØxe˜Üòkйòåa±pãˆðIáV¶0Kv ó(ó¬l\.pl@ð<›ŽÖÄ•TŒó±s0d4™è‚ʨX~’a'™ËõÔí'Ö‡•ûL ;ðx=PÜ, ,2bk]ŒWæ§xw@¼`_z&ÔP¿k$·*‡²çR°kÌ(uÂ*c+”‚ä%ܶcÈáDÍk^ßì_(x÷–ÀNN2»?PAܵ5O$Ø\°Y†d­¯ecëðüË!²Cn»™iXè–ÿí·Ä­PPŽ0±í±p?'|âáNj¶n’I†ö9Ã}XB0©ÄõÕ3o³û˜šÐóuöç’ššyÄŠ«•Æák08‘÷˜4”ÀV+õ¼éÆpväŽv¢ÏleDݬ,Jõü™VA´âÊ¢)ãj+ ‹ùFà¸[ nr¾Åïî|D­çÁ¤Ò|#dYŸ—QŒg_„g‘‚¼c¶F"®dÛyG½·WÅVUØádT ê¼lŽ‹ü "Ré}y¿[k Ї¯Ès+N‹ )Ã׺ØÐn4åb\<÷üÍ›—/aÄåÑò¢[2¦a0 Àc=u®VÍÆã[ö7…BÕÕjUÍñQµAú7â¡PÃFõ¬Ë\-Ö<Œ^¶Xpóé¿t‘až¡Þs×ùõìå¸D°ôô%>=wf72ЯW޶4‘*a¥ØXmK²?øÂ{0ôŽé>~eðñ6¾‚—t$ùŸ6°X¯±*ð“Cfá'·›„?m;Àõ!G”¶ã¸þØIäóX! ¡ "ª¡èVÀh‘fIýªÀS,¦Ôk,þŒèZ¸rŸ.èéu .]AŠÎð:…Cüý:Ç#®ié]ˆØ^U\ºÂÞ"]h®‹Æ•¼ ¤±QMØT´lЬR6Ê6t6¦õÊ?ï»'¢‡öâdOôÛ8ð]4»ÁüÒUÔw;=òÇ®4±tXgòâI~H]º³<† •ÕZÔaYÇ©¢jÀR80*j•¥Šìæñ&|ÀL%…`¥ZMžÎDóžÌ·ê–nG§ì!©MJ\iñÞF“[ªD—©?½½uK%uŸ=ߓʫޗ0 ¿œCÕ4j^[;zíH;d5«¬;ï=ûÊ‚vÕ<ÔœãÈêû×w×ÖFêò„ŒrÅ@îç^Q}wt¿ªBï ª)$ÄïâG¨Ø„ÛxA®}~Wƒ:ë¶`¼¬nƒÖ5«Or1/ÌvyË÷Tð'4Ö?2¡%În”•dO\y/^8{ù†¶œK1<ϧ^-ÏÉàÛòôÒÂØ¾÷"£ñzy ¬‹ÍŠËsÍ“x·Ô³)^' „Û+^îT'”…;‹èS_G6dä5dpö#•5ù-Ÿl_“ vDb Ñ4Ìîr¨E^ašh¥²\¥ êÎòvEñ$>h_˜B¡/zÚÒ ÒŠˆª?4 ðî¼Gž««DMóÒ„^›dôxˆ›ì«PÊ R±˜í KÛ=4kÞBoæ 0›hg%*¶a«²Æ`иÕ4™ÌBC¬2+Á’ÆánU²yÿŠG€‡æ„Nhõ²õ7›¸9H1ò_Š+î Ïiä1ºù"ºD§F„¤«<„c?ñ#oE3jŠEnΗUQ¶¶~¨Ù°’tŸ@=ì|1•szô¥÷Õùƒ»áéÐûâtrý6uò"ÔjŠmSÔXå’†yÞ4k™÷Qž7·ÌûEž7)åµóêxç΢ۅJަABÇÒØóâ–øcôÏ‘~:¿Ñ$îòpî=A!hÕêLAE’“˜µŠ_*“·Ša¤m[ôæ6ŽŒJj67:ôVµt¶®1mµ5‚òaöu1’®À¡N›•.“ü!Žàã„­û?þ€%ê*=>¬óþ“n0 e[õÕ5ú×9rú’\ÏŽV]½WÄzøh‹¿Òàévˆ–/#2è«"9éž3eKUH5bþŽjó+šØ<8ra«Ø‚Í+­'ì—¼Ø%•KÞu޾<ŒÛž†OïÿÅp{…ìWçeŸoׂü~ ÁˆžÚ¢ âÕ^ŸûýÁÃPŽ»SðE0¢a;6EÈk!_\0-ZÇuyfDxð0 fMo7F·²¿¥²ø .Œªƒ¶ìñ”…‹ï«Õ@üÚxl‘¸5^Aßz(AjÇß<©¬%£*‹ÈT§Oƒ‹ôÇÉ1{†™`_ïE‡,óp08<8…|n<Á\õcïܬ§4rÄj°«°”gU=œâža鬸¨u¨·Î©ÓÐ0nË)ÖÐ×rÎÙd'Ú"F™à {Å_È>|ºWÓVM p-VÚw^겡»óc¶ÅµGmÆêni‹¸:+F!jŸÜA¯O€µ+Æàš'tD¡e _Z`÷AÑ#À‰˜ÐÝÝt%©b¼É–Dƒö—E÷½hÙ·²Ú *ò}«€[íC/ø(°p]ÎúN¼„%Ÿ¯ú½X)È/^ Viñ"íX‡)«]‹S/ì3Ñez÷Òe¾§³ÏCóhލÀ/˜èQøÀv¢;ö&H —Ó‡—I|ÐÐ/¿·:7í&=oMõËË+Ï®“ý04‚^6a©šò®}8ÚZþ,[ö¥Æo4ã”>•-Àw×°][áU+W÷ŸæMÆ,òByNÜ¿p‘,&±ßõÄuc¢ÐƒîsI¦hzÅ—x½>g~¯w^²Ô]Ê6—wjŸÈüj]IÔŠL´$ï‘CÙ%–T<\/v•ü½}¯´l]EãJu×µN]5]¤¾Dã@«†—VÌËßj@+-}W–lÊbcg[Y¦i᪨AL²a;®§Áhš ª¢ÛyW>µFaWÞj­"OÕ¢K=;qe>o¶,zu!EˆX”åûÚ’ìYahWw(Ðé£%R³-IÙÒÀʳ>ØÔ²…¼AØ¿'ø‚Ü&"ƒ â+f|ûBÝDóü Ê-g —·uÓ½|L:^X¯Voóg¾ÐÄ›’MSäk;Šƒ ‘î·(ÚàA†ÙßÈ&gbN'òßâ®ñB1UE5A;¡VÝܲlÆx^:¦Õmdt+)Ý¢MÕMª—Öu'ÿ¥ˆˆ“æ÷å÷g.Ô ñzwv¹ºÒ¾Íñƒ´¸ÁÃ6' n’¾Ð?«Ëû þ¼6rúþMÊ*>ÀìvskÛ´I‹~54¹ ®(rSè,˜u)Ű²©·á”LHx^#=*\ k¼i£xØGh$mÞ „7ÍÖ&¤:€°õí¼\ýçæÖÜxƒw›4Ý0)[r]ºÑß{+ š zDhÍc¸ðÐ d1çæLÜ|r¼ã{ÑÁSÖßÃ=B‰ÄÑÔ.M}¡n…/ŸƒÒ²IˆU¬S´Þ4ÎÆ_PÎpCþü»mdR‹¶¼•m·j÷ –ÿFøqiMáü:8xæô‹`£UcƒèŸæ A〖;?ÆÜ8«?ÑÉh ·H~‹ªk‹ª©°ÿ—­1W¥zÊ·Ê„¦­R5©;´\Xî3µÒ²¡h©ÞR2Ç:}Cˆ[YSÓ¼mR2[„Y0 ¾¥lM© Œ!ÜI3MÝ£Iµq œùQ0_„h»¢¯õ¯`»XŽ5Fôvª“Ò)!/‹^(òÂÚÆþØÀ Fáiÿ¼¯ª÷u9NâUâ"jæ¢yÅàÏz”û9Tõ•î™`Ž"­œÓa•Bþ¤9éÄó/Rš×~C¶À7†œ^d>g¡ÓmE2VF!Qîu$Zí`àˆÙ†_eJä.‡ ’R»U-A‘ÃüzÑ;w‹Ïˆ-;ælߘ¥`à*\ÍnîA‘'—ÇXÙÿáLYâa°­+™’àrºî;™ò2wŽæ¥Lgéö—2Éè Ø!lŸ>ó‚>ÂÝ1Œ×Í#‘-’Šù½D"‘¬&VJÛàäSUzÿIŠ„¡©Z˜ig×±š¦S~w²N¸•ý¶ÜþùÑø±±ó¸ÉVWs³DCm÷‘›è›iéÛövüÝ^à máÅ3¹7[²!…U$\ Ç=?çƒÜK¯EÞw‚¡…ØÊ+¡)·úŒÙêŒ[} L6|½ÇŸø)±Ù´À5o0žÐÝnæÌÝ.µ¨åXâCÄxã7-ˆÜn|7ó(êŒ"‡yõiãirÓâi³ª1? (†ÇêcìNEnO¯õ)w9åôëQô×–vÊ÷晴iÌæzÛèp}¹´Í*Š`Þb³™\T¨kkrC ûŽ‹7h’þžq(Ë7 èhÁOˆ¥X.B~Î6)xpa®Ì;6@‘ÄyP9jjÕG¹lóH/•ºyMO¡;GGU—;†kÊpW_e2íW.PÄKÛÉ¡ŒÞ—³º)Z5w7iÏÙÞgƒ 0>ò<ŠKðÕæNã8)ÏÑâÂ21EC4o¾œêŽeŒ*ÏO=A‰EÈH0òe™,˜hmΗk]ëUOÅušTÈ`„a€ÖÈ_¹iž¦ÒtÏÙ¦hR2*l¡ä¬â‘ïæ^uäσ̃ßжkPŒ "›aiÇíW6·ÙµƒF±‚Ï ‹ùœ&H» Ë4èu‘ Êc?v¾³¶);âú#Œû Â,~S€ÂD›+æØëÃÁŠ’~»~Ý\ú<†ê`íÃR©÷ ×?èZË–!lÅdlÔ2¶Gqfœ©»ÄºDýM6º*•ÝH‡ )6©Jõ”솺Û²‚é ßãÉÛE080¥Å,] ¢¥j«ÑÆÕ¿b –ÇïŠñÓ #»kQ¨E¸áKz³EÈa<ôêˆãmX5"u=E;a'…»¯Í“fœŠ¦L¬Èž¥Vv)¢âÑh‘$rfówBˆa[–^@ÂN€gU©%­Ñ*Ð#šLS¶'¡Ì•'Wе{Š+!vQR픪’O[š×- žµ•PK1nÉð™®Å8ñ;±+“²˜ëd5&Ía6°ÛE)'x½K ²I»¾õJu=l[kÙðôÈû²Mu<Ö׺i÷©ìa±¶Ú†®ü0”ðùø3¨íî÷†eUgêR7Œûäßò;¼IQ,t8â&cžnjÌ×TI: f~¸ÖÈé ãÞΨHµq\Ýû"è"ïaÛæ#)å~E öŸ ¿_™ÿ|²#Äl•uü1PðfuÄQ6 ¸¥~ò¾oHÍfQPQE§ (õòj0(³Áê8à›Š‘‚˜â ²Ž?†48^ªHÌF1PQÃFüb ‡ /¾…S±í†FXoP„‡P¡ïüÊžm#$è‘áÔ}âVõ²ÃOw|\ ]«Ý¨+‡–åÚi`„½}kÄ—…ŠˆˆHäþx\Êüsbû¯){øJ]PrZÛ†›S¥Œç KÓÿl¢Î.B]U€:åHU2ÑUº2]M%y«òÀÏU55…“ÙÔ}ÊQëyÉM‹+TY_ŸÑÃ1TOoð{ÕUâc…À{ò„ð ŠA¾ú"Œžø¹*!¥»J&ÎyŠVÑâ2˜BäýÞ;¿Ä%çuÖµ0¦>‘£W#p.£ƒîÏgîd¸R7?æ74!·Ù{‘@»zUNZaCXšÆèu×ɵNuÃ¥#¿2Ë#+aQ9KÝo±7|ƒ'Øk=«ˆ #ue$ô!t#PCî~Ñ5n]ÛŽªþOƒkà,¢C ´´`Õ¤p¨ôy‡Y«Uò ôuœŒ»tà‚ú<Œ`¤“úé"±`z^l)ôûÖ÷O<>‚i!Bœ³Þé€üå q»!Ž¡åÔÕŠy¨1 Ãoü´Ë½/V ¡rt#µbj<&·v<-¿s{ãµ&“aìôôТx­´ c*U%.Ä•ÅÍ¢g”/µˆ†ìb™*–‰åVüCâÏ‹ž<¨‰¶’5.õêZŒ6!âØÄ¿ä—«Â&ÃêBn >'¼¼‡õ¿ÚyW]á5RvYÍH­¦vƒA<,¯×nºßúšQîÒ=SEuK"¯ëÝZ¹ã³Ú-ê¥4p×\bï°]7À+"‹øÅ#g8yª¨îFT•Ö/sê2cŽçï C=N¹™L6§ í¥>ª?^#â±åÃî:S=lKq-`'ÒÝ%Ê*¸À—÷B0ñDà+^Wÿ¨×#—ðKuØ4È¿Thã›4» i:¥”¡üÿPKü…•=®› ¿ ¤expath-pkg.xmlUT+ÌMux õPKs—=³$"_Ÿ¤cxan.xmlUT©MMux õPK l—=íAèfunctx/UT1BMux õPKl—=øÆ40W?¤)functx/functx.xqUT1BMux õPKl—=|ù…Ë1Ø‚¤u2functx/functx.xslUT1BMux õPKœ‹dbasex-7.7.2/basex-examples/src/main/resources/modules/hello-1.1.1.xar000066400000000000000000000017111222453003200252100ustar00rootroot00000000000000PKetØ>"{ò\À¹expath-pkg.xml…Mƒ …÷&ÞÁ¸¯Ónô½š©) ÒÛÿ‰iZXÍÌ÷Þ›!ŠV-­1q‚K“§µê€NQÛd®APmÆQ²=Iîä8Ž:*Çoó.¤Ô†u2Oo™ÿá„–¥ÆÁ;%Fa5ñ×´ˆ£¹O,³‹›¬Xzá^=êw±ÙiKãY,~mJààvé“yßyœ¹¹\B L!Îp{¨˜P¶—^³?‰ø5ÒðSæGÖÛ}õPKw²™<?;Ew”hello/hello.xqUT â£ÔKÂ5øLux õU‹M ƒ0÷9ÅW)DAÌ>Ò}¯ñˆ¯FÈI$‚ôî­Ýu7Ã0>.»cò\†Å­5i¥Zkä“ã)æUYv.v³ G™ñÚƒ©[ °ú×ú{³Tp]jÞÂ:ü™8ƒ¡ÚË経#®í 79ˆ÷,>PKw²™<ÕÕY#Ú“hello/hello.xslUT â£ÔKÂ5øLux õu‘ËnÂ0E÷ù ת”"¡8ÐU¢„ut ¶–5àH~©Ó¿ï„€ZÕhæžë;r3 ©1~@ Ù`Ú†-×1öµ)¥"½>Ä¢ª*±Û¬Å6H‡{,ÏØ]] žñ˲\ˆÝçz£4Xù«oP¤í œy ÆøGì vÞµ|Y”|•ûfg¯dBÍK>»°ø›ŒÂNƒßXe?PKetØ>"{ò\À¹ expath-pkg.xmlPKw²™<?;Ew”¤ìhello/hello.xqUTâ£ÔKux õPKw²™<ÕÕY#Ú“¤«hello/hello.xslUTâ£ÔKux õPKåÎbasex-7.7.2/basex-examples/src/main/resources/modules/hello/000077500000000000000000000000001222453003200240405ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/resources/modules/hello/Hello.java000066400000000000000000000005541222453003200257520ustar00rootroot00000000000000package org.basex.modules; /** * This is an example for a module that can be added to the BaseX repository. * @author BaseX Team 2005-12, BSD License */ public class Hello { /** * Say hello to someone. * @param world the one to be greeted * @return welcome string */ public String hello(final String world) { return "Hello " + world; } } basex-7.7.2/basex-examples/src/main/resources/modules/hello/HelloUniverse.xq000066400000000000000000000002771222453003200272040ustar00rootroot00000000000000(:~ : This query works with both the XQuery and Java module. : @author BaseX Team 2005-12, BSD License :) import module namespace m = 'http://basex.org/modules/Hello'; m:hello("Universe") basex-7.7.2/basex-examples/src/main/resources/modules/hello/HelloWorld.jar000066400000000000000000000020631222453003200266120ustar00rootroot00000000000000PK d/@org/PK d/@ org/basex/PK d/@org/basex/modules/PKÑe9@ META-INF/PK*y@û*×><META-INF/MANIFEST.MFóMÌËLK-.Ñ K-*ÎÌϳR0Ô3àåòMÌÌÓuÎI,.¶RÈ/J×KJ,N­ÐËÍO)ÍI-ÖóHÍÉÉçåPKùx@C`Ëcoorg/basex/modules/Hello.classQËJÃ@=ÓWjŒöaÖg« ­¢·Šâ"è¢Rp™4C;%MJšªŸ¥›ü?J¼“„ZÁYÜsçÞ3ç>æóëíÀ)öÄÊžßÕ-sÄŸõg>Òo¸ãx  Ù¾ùhêŽévõ;«Ï;CêL¸"8gˆ×m†Ä¥gsq,iH"Å1„ËoÇ‹û÷¦åp†¼áuL§múBÞ£`"è‰CÅø£|“!Ù“ÃAÝøi£øÂí6¿C r4Í|øb,›ûi¬Që¡rUEEÙm‰¡¸H»-ë*Ø GæpÈ]›áø_mDõšRbKÃ6vÒ7K2ê :§QŸ<ß±åª$Õ–7ö;üZȽ©á '’†è OŒ<Ú>Y…n:!#LN‘~ Ó*ÙTT°LV›WV‘‰_‘dŒ0÷ŽìC>?Eáh‚ò›/sB«¡PiFŽ„¤·‹jX¿ò÷¾PK d/@org/PK d/@ "org/basex/PK d/@Jorg/basex/modules/PKÑe9@ zMETA-INF/PK*y@û*×>< ¡META-INF/MANIFEST.MFPKùx@C`Ëco org/basex/modules/Hello.classPKn¯basex-7.7.2/basex-examples/src/main/resources/modules/hello/HelloWorld.xqm000066400000000000000000000005261222453003200266450ustar00rootroot00000000000000(:~ : This is an example for a module that can be added to the BaseX repository. : @author BaseX Team 2005-12, BSD License :) module namespace m = 'http://basex.org/modules/Hello'; (:~ : Say hello to someone. : @param $world the one to be greeted : @return welcome string :) declare function m:hello($world) { 'Hello ' || $world }; basex-7.7.2/basex-examples/src/main/resources/modules/mapExample/000077500000000000000000000000001222453003200250265ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/resources/modules/mapExample/MapExample.java000066400000000000000000000004031222453003200277170ustar00rootroot00000000000000package test; import org.basex.util.*; import java.util.HashMap; public class MapExample { public static String test(final HashMap map, final String key) { Util.debug("!"); return map.get(key).toString(); } } basex-7.7.2/basex-examples/src/main/resources/modules/mapExample/mapExample-1.0.0.xar000066400000000000000000000033601222453003200302670ustar00rootroot00000000000000PK x®Í> mapExample/UT SjöMÿ§óMux èdPKq?Øè..u¦mapExample/wrapper.xqËÍO)ÍIUÈKÌM-.HLNUȲUÊ())°Ò×OJ,N­ÐË/J×Ï+*ÖÏM,p­HÌ-ÈIU²æâJIMÎI,BÖ[`«”•X–hU’Z\¢ç‹UqZi^rIf~žBX•† ÐL•ìÔJM…j.… a®Zk.PK›’q? ¦KWíçmapExample/test.jar ðffaàÂ7kÏÚ1p2°0øº†8êzú¹éÿ;ÅÀÀÌàÍά$E³z÷ÜÃî@Qb¸f_G?O7×à=_·Ï¾gNûxëê]äõÖÕ:wæüæ ƒ+Æžéyùêxú^,]ÅÂ9ã¥ä陚,ÓŸiþHS*.6}É31íŠgª¯3?},b;Ù:C¸ÀNºrÆŽ °qIjq‰>Ä­L@·N›Th_p5fÊ!F†‰Ì ¢0%¾‰®‰¹9©zÉ9‰ÅÅsƒ|ó/;Ô «>’º´Kµ¦¾¥?i9‡÷U!{Ø™Ûô\^—<ÝeQödMàïõ‚„þ0Ô‰$íaÔÊ’°;³æþ™}Û7çïÿÿãïeƒ‹ _¦Ähüß9ÃÞRhs¥’¯ çêöG{?OtûwúC€Ÿè½ÂË7ÞR•Xg®h"ŸþûRSãº^±[g„¬¬ <ã4s¿P¢§ß_W#Áʘÿ™f¿Rˆ¸Öd¼iñ¦#‰·y·T-|t¤^MŒýŽ —¿IXå7åõ\‚»[xµj…UEÞ,µjÊ™÷TóÔ„8‚OÀçQ ù]ý€&*•sa¸ZJà[z™Á®‹tkÕŸÍÅ4ߪ·f×ì^‰©¯ª2bQuž³%ó,iÝ"ïsžäñý$?gKV ²1ù|ÿCO)…تšWÁŠ”Ë•âÃÈÕQ/‡¥¯ùÇq~ñm~‰`î™)6墡 Õ 6+!4l7â PK x®Í> íAmapExample/UTSjöMux èdPKq?Øè..u¦ EmapExample/wrapper.xqPK›’q? ¦KWíç ímapExample/test.jarPKjŒq?ª#cw  basex.xmlPKb‹q?a•V Ñ| •expath-pkg.xmlPKH’basex-7.7.2/basex-examples/src/main/resources/modules/mapExample/mapExample.xq000066400000000000000000000002401222453003200274650ustar00rootroot00000000000000import module namespace example = "http://basex.org/modules/mapExample"; let $map := map { 'key' := 'value', 'bla' := 'blu' } return example:test($map, 'bla') basex-7.7.2/basex-examples/src/main/resources/modules/testJar-2.0.0.xar000066400000000000000000000037311222453003200255240ustar00rootroot00000000000000PK x®Í>testJar/UT SjöMÿ§óMux èdPK¼EÙ>vÓ3X’ÔtestJar/wrapper.xqUŒA ƒ0E׿ƒ¸P(fñ]õ £Nm$Ž![¡ôî5ÔEÝýÏÿÍ˰:Æ™¢Çž`jó‡ˆ7Zwi«—0jg;-åŠ!o”¨wþO¾Í'|¢IP} –…Nä}å^ìÂ0ŸÖ²ˆ#lÑìÉòX¼UæH ð?˜¼az••ÊÉxï‡ê`.¤•ú4_PKì­Í>N›8¡÷testJar/test.jarUT LiöMLiöMux èd ðffaàÂ7kÏÚ1 N_×G]O?7ý§˜¼Ù9@RLP%85‹1\³¯£Ÿ§›kpˆž¯Ûgß3§}¼uõ.òzëj;s~sÁãO‹ô¼|u<}/–®báœñRòˆôLÍ –éÏ4¤©‰?›¾ä™˜vÅ3Õ×™ŸŠ>1‚¢Þ=÷°;Ðw¨C¸Àß 9ƒâV .I-.ÑG¸µyª[…àJŠ2óJR‹ô’s‹‹sn{v°¼zÙÅk·®ý^½…‹­vm‡Â‘!5>‚¶oY¹$ú¯níÆØ>Ê‘ ØòÛ`ºqú¹3çž_¿ÍÞ üf‡Ç>¡dјT£P¥âDA­¿/ ¹Øoqë=Þç!rÐrÚÊu–Í7_ ­Ù|q¤‹í¼í|©Zzj‡#R®Ú´dYx-r4?µä÷… ïE>|õçs„ß°Ë •Í~xþM_Ò†ëyÛcÖxí<æ«yÈ™uuÕT©…vþ‹WKòÊgG<ÏôßÕ}î¢Ú…ˆ|ûåJÝ&ë>ª?ª¿Íþ‚‹L“?ó_ž¾*9±ç˜¾¹wovÒCUýꜹ2&I¯Ïs¼™~ãsa€Þ,ÿ™‰Ǭµ¶ÿ‰¬ÿ·øá©^Éõ.\d3û|1Ú²þ·4(6~œŸ¿D›‘á #r²^„Ô‚° /ÊD i_ïÃ"s¦/ñœ½LþZØ_Î\Öæ8Q}'Gþ©~À>"bý{»ˆÈÁfûòªû|»¸ªnÜùýÙYéo?¿•=ÀÉgѲMl)_þ”+N•S?Mh© Ò9´ºDÓÈ·`ªÆuËfÇ/—çd«vÕ,?Ÿ¢øÕ2ÑäßíyGXž'•j×ÜÈ`ÿ ðæ£J^ãÞ Þ/\7 Lý;dÅk•³­‘[NM²ñ›bR]òe®çÜá)÷üc²sx”yŽOþ¯ôëóÕ¨Ô$µ^ßÝólŒ¬dŠyfïoN˜©Ó£sLnVÍöggDÿùu9Ü®]ÿ…Mè,¹ûw³6q¶OÕýñÂøöê«72¬¸ ·»ÈƒÇðVU›(»Ôåô¹ýo﬒1sÔ½qKà¶ÔÕâ ÐeÚüp‹<0d÷€C—‘I„5ÛÁ2$(Ï¢”Œ®9 ‰ h³Å‘A&p1àÎjp ‘ñ–‚²rJBÑòkFDÖJOÈa!ˆ¢?„ Kê ðfeƒ¸Ž•A¨e3ˆPK­‚p?7É _v basex.xml-É €0 ÿ®"¢€øBj V8D±Q(Ÿó·3óX—¨_(°9׸ISª©F,¥ØŽ„O»ç€ë>‘Ó*`Œq3e¯,jïáð¡W÷‘D¾ÐæiS¾ãçþ_.PK¹‚p?¾ -)Ëlexpath-pkg.xml}AnÃ0 ïz… ˜i…$ ×‹|@vX[ˆ#3¤š(¿¯-;m€åq9äîZ Ý)ô¨ËyLâÌ3½`¡‡fâ’z£ôcR8ãØÁR¹1¶Qò>ðÚ–ñêÌßÍY├ymvÍîi!„3/³æÕ¢Úóˆþ0д·˜½ÿПqD +Qá#¦#¦î®‰§E&v¦Æ4°"åò…|÷zµ´K™£ÿ¯“…_n;\¼ýrS.ªP-`óPÊ–٫oPK x®Í>íAtestJar/UTSjöMux èdPK¼EÙ>vÓ3X’Ô BtestJar/wrapper.xqPKì­Í>N›8¡÷¤testJar/test.jarUTLiöMux èdPK­‚p?7É _v  ïbasex.xmlPK¹‚p?¾ -)Ël uexpath-pkg.xmlPKWlbasex-7.7.2/basex-examples/src/main/resources/queries.txt000066400000000000000000000007461222453003200235120ustar00rootroot00000000000000# format-integer() format-integer(1, '#0') format-integer(1500000, '0,000') format-integer(1500000, '#,###,000') format-integer(1500000, '###ð„€0,00') format-integer(602347826, '#(000)000-000') format-integer(1234, '#,ð’ ð’ ð’ ') format-integer(1234, 'ﯴ') format-integer(12345678901,'# 000') # format-number() # format-number(.11, '.#,#') # format-number(.11, '.0,0') # format-number(.11, '0,0.0,0') # format-number(.123, '.#,##') # format-number(.123, '.#,#,#') basex-7.7.2/basex-examples/src/main/resources/xml/000077500000000000000000000000001222453003200220655ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/resources/xml/auction.xml000066400000000000000000043346171222453003200242730ustar00rootroot00000000000000 United States 1 duteous nine eighteen Creditcard page rous lady idle authority capt professes stabs monster petition heave humbly removes rescue runs shady peace most piteous worser oak assembly holes patience but malice whoreson mirrors master tenants smocks yielded officer embrace such fears distinction attires shepherd noble supposed dotage humble servilius bitch theirs venus dismal wounds gum merely raise red breaks earth god folds closet captain dying reek Will ship internationally, See description for charges Libero Rive mailto:Rive@hitachi.com Benedikte Glew mailto:Glew@sds.no 07/05/2000 virgin preventions half logotype weapons granted factious already carved fretted impress pestilent girdles deserts flood george nobility reprieve discomfort sinful conceiv corn preventions greatly suit observe sinews enforcement armed gold gazing set almost catesby turned servilius cook doublet preventions shrunk smooth great choice enemy disguis tender might deceit ros dreadful stabbing fold unjustly ruffian life hamlet containing leaves Moldova, Republic Of 1 condemn Money order, Creditcard, Cash gold promotions despair flow tempest pitch concluded dian wenches musing author debase get bourn openly gonzago determine conceit parcel continue trophies bade cries merrily signet sportive valor planetary hastings empire vow merciless shoulders sewing player experience hereford dorset sue horn humorous fiend intellect venture invisible fathers lucilius add jests villains ballad greek feelingly doubt circumstances hearty britaines trojans tune worship canst france pay progeny wisdom stir mov impious promis clothes hangman trebonius choose men fits preparation Will ship only within country, Buyer pays fixed shipping charges, See description for charges Javam Suwanda mailto:Suwanda@gmu.edu Mehrdad Glew mailto:Glew@cohera.com 05/28/2001 back greg flay across sickness peter enough royal herb embrace piteous die servilius avoid laying chance dungeons pleasant thyself fellow purse steward heaven ambassador terrible doubtfully milk sky clouds unbraced put sacrifices seas childish longer flout heavy pitch rosalind orderly music delivery appease confound brook balance bravery bench bearing compounds attentive learned senses concave boughs discourse punishment physic further reading chair discords instruments bankrupts countrymen horrid royalties necessity tend cap curiously waken therewithal horse gather uncleanliness chief traffic where nuptial either remember peerless doing preparation rejoice gallants shepherd barbarian ford ruin coxcomb excess childish carrions imaginary wooden preventions bounteous sounded consider sayings fishified fine prime may ponderous doubtful rite dotage discipline choughs mew here vill discontent manage beatrice straight muse shame prays maecenas any conveyance fingers whereupon child case season presently victory women beating deprive almost wed dreams slew United States 1 earnestly subtle spotted attend Money order, Cash tormenting naturally sanctuary riddle exile coming awake senseless chance famous albans service cricket limb from clouds amongst shore penker defend quantity dumb churlish uncover swung eros figur sulphur sky birth stare negligent unction shield instance ambition gate injury fort put infants find slavish hugh see afterwards slanders chides eyes minds alb loved endure combating voyage never maintained peril rivall suddenly finds studies weary truth indulgence anatomy assisted imminent may excepted yonder aches regal battle friar prophetess spirits delays turning cassio finding unpractis steel sweets promises credulity err nym complete star greatly mope sorry experience virtues been offending bed drives faction learnt hurl eleven huge wont pretty piece requite protectorship stock hours cruelly league winged tract element sails course placed fouler four plac joint words blessing fortified loving forfeit doctor valiant crying wife county planet charge haughty precious alexander longboat bells lewd kingdoms knife giver frantic raz commend sit sovereignty engaged perceive its art alliance forge bestow perforce complete roof fie confident raging possible cassio teen crave park reign lords sounded our requite fourth confidence high flaw surfeiter challenger cried main recreation answer gladly mows our craving preventions spurr edmund drunk how faction quickly bolingbroke painfully valorous line clasp cheek patchery encompassed honest after auspicious home engaged prompt mortimer bird dread jephthah prithee unfold deeds fifty goose either herald temperance coctus took sought fail each ado checking funeral thinks linger advantage bag ridiculous along accomplishment flower glittering school disguis portia beloved crown sheets garish rather forestall vaults doublet embassy ecstasy crimson will little haunt reasons ungenitur exquisite mote penalty respite gently skins bora parting desdemona longing third throng character hat were mounts true rounds house benefit field nearest lucrece tidings fought logotype eaten commanding treason censur ripe praises windsor temperate jealous made sleeve scorn throats fits uncape tended science preventions preventions high pipes reprieves sold marriage sampson safety distrust witch christianlike plague doubling visited with bleed offenders catching attendants cars livery stand denay cimber paper admittance tread character battlements seen dun irish throw redeem afflicts suspicion traduc barks twenty secure pursuit believing necessities longs mental lack further observancy uncleanly understanding vault athens lucius sleeps nor safety evidence repay whensoever senses proudest restraint love mouths slaves water athenian willingly hot grieves delphos pavilion sword indeed lepidus taking disguised proffer salt before educational streets things osw rey stern lap studies finger doomsday pots bounty famous manhood observe hopes unless languish transformed nourish breeds north sequent mountain fairies lepidus shoot dangers after unworthy odds suspicion chains rosencrantz bags heed lawn diest unvirtuous supposed numbers game roman greece leading wrestler sky slanderous noblemen beast shivers desolate norfolk george fret beggar sheath his valour burnt bedfellow protector father orchard enemies prison charge cloud boast heads mild scene true metals confidence hundred those guiltless mutiny edge lik complaints dion device brings custom chapless spar sold courtesies beside sex dowry casca goods priam blasphemy friendly octavia rot frantic brain inward missing conspiracy tents scab inundation caesar officer prize execution beckon rue physicians some crickets lend larron interruption flesh whispering perjur kills insanie unfortunate conjuration first choler saucy lack guard blank was Will ship only within country, See description for charges United States 1 poisons Money order, Creditcard, Personal Check, Cash jack Will ship internationally, Buyer pays fixed shipping charges, See description for charges Mitsuyuki Toussaint mailto:Toussaint@uiuc.edu Cort Penn mailto:Penn@uic.edu 07/17/2000 gentleman observe silver eagle battles bastardy shames brook mounted officers dean shrunk lowness dew sandy prologue armies suspicion eighty advance thankfulness albany ended experience halt doubted wert kingdom fiend directed pair perhaps happy lucky odds rend condemn cannot dispos perfect silence United States 1 thought inland different Creditcard, Personal Check, Cash dictynna later supper striving soil Will ship only within country, See description for charges Pierangelo Bokhari mailto:Bokhari@sleepycat.com Spencer Malabarba mailto:Malabarba@solidtech.com 06/15/2001 scourge ladyship view presume loggets feed blows plantain joint afoot yields erection sith stuck dagger balthasar fathers datchet foot thankless lear cause cheerfully instance tarried because cough devout testimony tarquin cousin reported porter beastly jade bark sex slack lear devil devoured amiable mason moss shoulders labour meanest feign eggs encount forbid enobarbus halters nam emilia fiends bearing food inheritor wiser hedge functions there capital greasy dark crush your sequest between devout thou strikes demand dost reverent conference least told ado modena jealousy nunnery mistrust nightly worthy closes tall proudly fierce receive nearness safer jacks shut dire mates wind unfortunate monsieur parcels sauced extremities throat dog empty treasury etc detested stand taxations edges mourner sue knavery unlook perseus diadem heartily peer tut compounded art reconcile Madagascar 1 cockatrice approves money Creditcard, Personal Check, Cash clothes edmund doubtful fool torments ropes contrive lecher ardea happiness fertile treads constable defences lion neighbour ourself marshal disordered moderate venus afeard article rot hazards craft crowns plainness patient lying knowledge diseases meritorious medicine Will ship only within country United States 1 answer misdoubt Personal Check, Cash delay brutish rage alexandria trumpet god wet resolve pursue colour body walk month writing beside profane left declining coach through protectorship congruent confusion favours following populous exercise timon shoots function fourscore mangled favorably slain secretly vice distinguish bardolph content hence boy worse bring usurers stew beard longed creep hid pursuivant beholders senators son mercutio woo bestow trumpet excess muffler pick ugly felt causes remove adding tear often rounds underbearing tree purer kibes endless women benefit throw claim firmness arrived sees wrestled multitude repent preventions infamy reproof shalt hearted prais knave doubtless deny merely grave voluble late loath digest horn slave hunger stronger amazed salt killing ross cry dry tongue kiss yields auspicious quietness perpetual ways began leg running unjust court mean returning brook creatures appointed paunches henry sights west prunes flutes regiment seems bed musicians slumber post friendship prevention abreast wouldst words vexation builds unfelt holly walk inform moods deck bulk begin action school nobles antique people unkennel stomach into petitions jack assail yongrey ages betimes golden sink droop kernel hoppedance perfection weight whining safe english rod other featur Buyer pays fixed shipping charges, See description for charges United States 2 prosperity dine yon debate Cash visitation strangely mab spirit forgot bargain holds See description for charges Manlio Legato mailto:Legato@stanford.edu Shuuji Lanzi mailto:Lanzi@mit.edu 11/08/2001 prostrate all enforcement emboss quickly emptier treble companion breaking thrifty kissing design airy office dismantled hope mother beastly worthiest quite translate overcome unthrifty fell othello wolf entreat audaciously down sands sports pilgrimage duellist league holiday cheek that tables merrily knot selves ionia impure prophet draw throwing solemn yonder rightful foam worthless polack veronesa antony beget thereby carry untread hales elbow passing yielding kept dotard holofernes onions din audrey says waterdrops carrion tax prithee crowned troubled naked finds owe silent recount crowned abus four door fragment pamper arthur thrive wound fouler streets preventions obey vow bawds myrtle said infinite montague fierce sense ride souls commended gainsay profession labour intents persuade alter villain United States 1 congeal pawned alack Money order, Creditcard, Personal Check, Cash white obey calling neighbour office afternoon drum embowell touch sue lifeless leapt shun called weary congregation yield check falling wives challenge mental fatal hard ancient stands cor dishes therein gramercy discipline farewell dire tricks protest cut horatio brother speech sleeping adultress pitch cave liv nurse drink state plants combating desired requir rebellion afraid repented tree scald stopp wine advise undermine norfolk vilely whet scars companions hanging foolish scene musty fruitful unburthen teacher garments betimes sight now for oaths vouchsafe particulars globe laertes afflictions rouse once news humanity buck destroy military lucius lap considered forc mourning verona waters triumphing officer hastily resign subject figure hay thwart written signs gout bred distance period glove players change folly going wat lost Buyer pays fixed shipping charges, See description for charges Berl Meekings mailto:Meekings@umd.edu Masali Takano mailto:Takano@ntua.gr 03/10/2001 forbids morn devour ambassador seldom speak tickling rejoice triumphant ascanius forward capable disguise compare buys english shame vulcan farther generation for hearts canst devils furrow promise lusty hatch privilege truly like serpent sing woman warn rejoice sooth perceived repeat roaring broke england plac seem villains garments therefore produce done hereford redemption princely smil fields plague hearts precepts laboured gentleman joint borrow lay believe rogue silken break suffer desire paper main cressid person whate lily pilgrim flaying therefore meantime similes base dowry rotted curan press debtor alexandria sugar battle orbed embrac supremacy answering cradle shoulder corpse canons domain night forsake yea satisfy between senators browsing monsters ear players moreover sir hor shape suspicious taffeta banquet forbear unshown frail journey loves swearing proceeds detain eighteen petter stone battle breathless kindness prophesy entomb over wishing conquer provoke his forehead persuaded United States 1 school feasted romeo Money order, Creditcard, Personal Check, Cash rises ghostly occupation brook stoops brooch hers gain paris easy rubs whereof resolved leads joyful built immortal ambition revenge create roman favour urge spear gone john wolf cheeks execute such impart inseparate steal shortly uses seldom friar taking broke those agamemnon truepenny roots vicious verses preceptial didest starv seeing interpose gods home black forgot snuff dress dozen napkins circumspect clamorous had countess louder kinsmen offend needless angry pleading peers tenderness curds very watch help reap livery pipes fortnight crab wales emilia rear past zounds braggart armour infer bankrupt winds teeth between wore preventions thread badge reports expedition free chief cressida hearsed shapes supposes humours loath monuments friendship adore farm doct potent begets ross susan ready empty dedicate shilling whole soul foot beseech higher lifeless hay postmaster distress disposition inherits marcus betters pitch betray beam corse player quality ros conduct thersites greediness boast pilgrims startles contented belch hung thus captain early blood par brook jul gain needs above ensign grapes revelling glean thank seeing tenth succession lief wall bands enterprise flat preventions knave wine shield prey key farewells religion fetch bells rage names valued exeunt soul albans Will ship only within country, Will ship internationally Saadia Detkin mailto:Detkin@clarkson.edu Jan Razborov mailto:Razborov@informix.com 05/26/1999 shifting paying complices serves commandment worse pill clifford petition haste asham shirt rise visage goose yon garland catesby elbows means carriage syria deserts feel despis task house challenger evil editions depart laur hereford richer prithee lust shortly approve rey should spectacles fiery perfect worshipp foul quod yes remorse young tyburn thrust attending spear shun doctor wild murd awak helpless ventidius tread defeat teem durst accuse rhyme wonderful attaint dealing mortality asleep murder throat attendants themselves spark skill pol see conference sail text speed essence white contrary terms girl paris commodity faded fall ugly honester smile achiev however outrage proud pays spilling rancour reasons grieves camp bachelor clock hearing feature can whom youth soldiers for time vere record penury herself reasons merits villainous whereupon wrote penny mar preventions followed best eternity bestow Cacos Islands 1 spied torn Creditcard converse budge flint purgation whosoever spite befits forever bankrupt choughs burgundy advise untimely order shadows possesseth approaches dead outcry venice repent swore prodigious next tyrant befits sinon scorns oath noses apart balth sovereign argues feasting field importunity expect what wether stay babe hopes liege astonished suspicion unmannerd alexander crown soil committed stately slowness fast princes their tender softly herod messengers horseman corrosive just make countries quirks shut thence beware jewels sland preventions further royal streets has sells daughters influences leontes priest maggot lays dishes display caught navarre durst Will ship only within country, Will ship internationally, Buyer pays fixed shipping charges United States 1 made his third Money order, Creditcard gain they stroke forsworn scape given professes commons lordship clear operation practice pyrrhus earnest broke devil posterity company text misbegotten oregon strike saw arthur earnestly brow popilius ugly serves presentation commandment metal comparing thereon true secretly gallows preventions horridly slack lieutenant hers stop clown rosalinde wed pretty wildly both expectation law noble point marr painted seat fords divided delicate mocking active bills filth pledge latin done statue moved converse goot claw show edmundsbury torment Will ship only within country, Buyer pays fixed shipping charges Marko Hanratty mailto:Hanratty@sbphrd.com Evgueni Claybrook mailto:Claybrook@uga.edu 05/11/1999 overthrown institutions adverse brought strives occasion event ready troyan shoulders matters sinews liquid ashy gentlewomen authority assay hole selves living near doting modest wiltshire mocker eton profess forgeries butt wade lawful maccabaeus wert forced succeeding becomes wayward got thief obedience wretches yoke run destroy hole frighting enemies permission vowed swinstead body oph crave consorted requite forfeit speed possess peremptory fraughtage confin rules hatred case art knife bruit wiser engross hero restraint bolingbroke run crimes dominions prey egg conduct abandon slay diomed apprehend advantage studied stained entrails bone shoulder upward arrested england valiant prolong dotes vesture collatinus which conspirator crowns fellowship indisposition opinion about action skins moe verse friar filthy divers fault apparell worthiness supposition parchment restitution rings rages remains lass dependent pelican contrive paradoxes unmask desdemona weak pleases shame wisely cheek poison avoid ulysses exeunt answer smoothing punishment much anointed bloody shook here armado supply four digestion unresisted consummate glou ding figure made unwrung worst repute envious meanest read nan stake shriek tower nights armed drinking instant scruple citizens rightful nonino shame hills dismal other fasting attends judge aspire hand putting repeal grounds bestrid commission crave mess tarries sport view freely lame done intend cast shun kills presented body landed question hem same burdens plenty esteem weak sigh sunday body Kireeti Takano mailto:Takano@ab.ca Youcef Fecht mailto:Fecht@ucdavis.edu 05/06/2001 commonwealth disguise evils should damsons willoughby thousand number morn banish barricado unfolding perhaps gently stalk degree oblivion wars monsieur companies swords shifted clay Shuhong Schreier mailto:Schreier@hp.com Teruji Maslak mailto:Maslak@ac.kr 11/10/1999 religiously United States 1 sounds ope extemporal Money order, Creditcard, Personal Check, Cash killed account obdurate kindly heart light bosom garden cog yet daughters tott lifted offer bail navy next strongly scene scythe rhodes within quoth assembly did wench secrets drunkard rises gossip eternal crown hie thou outward bouge murther fort uncle hated sister finely lend smell poll safe motley treasure decline supposed puddle dinner womanhood horns tenderness lessens promise guilt confess gentlewomen souls preventions false voke colour need division conjoin preventions their apemantus pol plague ink incite doctrine sugar Will ship only within country, Will ship internationally, Buyer pays fixed shipping charges Morocco 1 sin Money order, Creditcard, Personal Check, Cash applying effeminate manent where despite instigated moralize sequel noble music carcass recompense choke massacre soundly aweary misfortune hear greatest afford commended troy stomach edward bestows piece fare gate bar her pupil longest suppress Will ship only within country United States 2 patient set trespasses simplicity Personal Check, Cash dart cousin beneath yourself dishes expects pander finely due moor smell foundations noble digg fixed way ross preventions city expectation traitorously lake rose fine guilty lear surety chain depriv renascence flower kindled crows forgive husband vantage tyrrel diomed lies satisfaction gratulate untimely abominable confession greet heaven affection take executioner mistress fail ophelia faces horns mercutio flies shrift change writing therein fool could prize drift whipt belief ferryman control reported desirous crash traitors bourn notes limited passeth inflame child forerun monsieur barr damned tops remedy manners ram marriage medicine deny edmundsbury richer pilot carried core dug mistake awkward stiffly fashion pent raised certain Will ship only within country, Will ship internationally, See description for charges United States 1 blots killed tyrannous Creditcard frailty stumble henry patch outjest heartless axe lightly conrade passing easily gap gay ravin beauty thaw yourself dearest prick amen hope preventions speak strike use kisses desires spy hies potent idle begin call body shroud tears dark misery satiety bare from newness can loveliness bereft fulvia wooing earnest dismiss resemble fairy troyan business convenient front emperor whoremaster breeding duty dance venetian displeasure sow law foolish strongly grieve head presently painted have loved sheep decay legions clock brought congregation honorable kerns necklace verge humbly better distance slaves balls thyself foot passing comfort beds virtuously frets holy dumbness loose sea lusty victory wounds holds nest bosoms lord swells scratch won neighbour pedro octavia taught subjects synod grave fed unarm nicer one close territories ply uncles doubtful till devis discover trick ships goneril heavens anger castles lights spok low beggarly keeps mercy devil sword irrevocable holding succeeding lending pompey shalt uncle looks perchance egypt dearly pursuit estimation vill unbuckle suspense sixth holding stand better key enjoin gaunt two beseech plac obedient rot mistake roderigo shore knee adder native jove since bosom unfruitful feed uttermost throats tom wrought addition refuse hatfield entrance marching serves palace tendance lain huswife remember merry seal scattered wast couched has labours requite wrongs report continue griev sweep suspected flight conditions unhappily eleven bed shifts remiss attire dropping printing walk pleased entire lark tricks consider awake anything collatine basin preventions instruments understand pick down take stock hour judg grudge durance directly knaves seven approof thereon rings credit strength sends messenger orlando youngest murder brainford coward say bee bolingbroke reports liberty zed they airy question naught hastily falconers seems grass entrance benedick fights submit eternal embassy society through entertainment that nightly dove king far plutus pole fate ploughmen proceeding goddess boast shore counsel rais boy watchmen decay conference calling steals fall clink mean now alone fault tyrant phoebus contagion nurse bankrupt gift law knit subject money thursday deliverance finds feign appointment something caesar cumber lender shore desp fine wrested blemishes burns provok whom catastrophe poictiers soon graces march wild willingly walls following applied satisfied expect lancaster measure jauncing uses thetis utterly Will ship only within country, Will ship internationally Kristin Comellas mailto:Comellas@sdsc.edu Hungse Winkels mailto:Winkels@mitre.org 06/24/2000 alb dramatis scattered prodigal gods proclaim lewis preventions etc sorrow preparation question straightway scourge shuffling sullen engraven heed engag add liquor flies conceive eleanor fell were urg drops bright anchor worth arrive courageous unmanly superfluous benedick there compounds charm fumbles cashier his bowl leprosy pow amorous perceive follow murders midst above shoes unfold rich viol here marquis safety pillar crush either blast please eager petition followers troth comments dar afternoon heel pride calf conjure childish base cinna guilty valiant returns attendant edward duty devis creatures mangled mistake twigs swearing shelter mouth camillo cost throne hum perpetual turned english say tents dearly lion difference stern cure dejected hateful nowhere didst craves good plate gall round bait disturb effect ambitious shalt want joyful bound shall travel mud sleepy revenue bonfires teem royalty shamed bird pursue claim hies silk tables bravely whip violet estates counterfeited slander they bernardo hath check march flood tongues enter cassius aspiring throne these fashion change deck lead history fellowship health modern mechanical vainly wives university counterfeit grossly correction shedding jests compact paper shroud mortality head chill preventions bear theirs trebonius lance fainted nice United States 1 boundeth thickest wight Money order, Personal Check vulcan rags thing whiles goose toryne rascal presume bolster shape case hair proper indictment dream untimely thorns portal maidenheads cockatrice beast impossible mowbray cup deathbed armado drives reach growing oration tarried arithmetician pays veil credulous endite embrace Will ship only within country, Will ship internationally, Buyer pays fixed shipping charges, See description for charges United States 1 weeping allegiance rogue ladies Money order, Personal Check, Cash rape hated jealousy element liable press wreath issue bloody bold small shown lengthen speeches sheep dry bruised brabantio justice seas lordship given minds transparent scholar street betumbled gods lancaster infected fry begin tarre model nobleman aspire presented delight saint kindly pate sickness addition perfume degrees iron avaunt entertain besmear vainly defend everything feeds pilot transformation serv lin fails gar wed too authentic better away revolt immures protect speak ravens thirty read unkindness idle clock willing monster hercules fearing any suit smil service feast disdain contempt aloft actor profane pomfret afford lieutenantry knock lent refer side combat thee cold fain drops cloud betrays trifles melancholy within none medicine Will ship only within country, Will ship internationally, See description for charges Saudi Arabia 1 ears wall phrase composition Personal Check set bawdy profane treasury edmund except unlink lay creatures edmund gorgeous customary must doubted strikest marry stain witty engirt dwell actions draw once meant thyself hearer whom berowne difficulties manifest elizabeth then counsel nearer prophecy eyes nation wish should groan privy bachelor scornful money canonized water forsake couch remember dim duke Buyer pays fixed shipping charges, See description for charges Natalio Cox mailto:Cox@microsoft.com Shoaib Guting mailto:Guting@edu.au 10/25/2001 strip free ancestors custom tend pestilence zounds charg poetry iras receiv jointure line caper dreadful now fish embrace horn brought eat morn polixenes norfolk your honourable chorus fitted hook steel pride proper United States 1 nearest sighs Money order, Creditcard, Personal Check, Cash wail realm heaviness trumpeters walk loath unto sum maids entertain orlando achilles parley kills burning limit forever cade gav baser spite heard prodigal pound tricks hats ribbon grow increase mortimer execut cheeks pollution flying lecher three knife bar venge tallow merrier disdain climbing conceit possible midnight pedro unloose hate spark tucket laertes believ pick timon taste unworthy strive octavius seals happiness allegiance sooner jul heading cackling applause going feeble merit devotion consort use strew encorporal fortunes unhappy drink alone yours pedro judgment sense near owes creeps taking stretch reverence meeting certainty collected lightness possess metal ready latches laer successively them file hollowly dislike arm conqueror express gold simular firm society driven difference dover advance blocks degenerate whole tremble humbleness monday seizure unfelt sicilia beggar doth pleas asleep pleas climb beheld happy sign moved exact companion gondolier same cow compliment liberal through women forbid rank misadventur push great oath slender seas fled tempests offence rosemary none thief walk appeach varro folks needless throws frowning mere mistrust execute heads forward cur surrender rose tunes seem wages proving english cade action rumour wimpled statutes awake immortal frustrate spleen fine venerable fleer shook avouch box sadness then contempt betime earl phrygian gives triumph goodwin retire copy grant tragic quickly fain highness patient injuries yields prove alliance cost progress misgives drunk study followed sort devotion member fist mote julius hazard mantua nearest wrong ignorant pleas wretched hair shouldst upward bora belly hammering datchet polonius robbers preventions avaunt ingratitude gad marcellus cimber addicted wits wat clog kill fix stained queen beguiled censure practices child dotes gall unlocked instrument choice permit extend harmful short own attend wag deal came stephen ones madmen despis feels herself dotes nothing doubt among prayers citizens savory remembrance craves divorc deputy rests motions fardel enmity dash web roses theft wherein broach fights practice space commune women bench hare wives Will ship only within country, Will ship internationally, Buyer pays fixed shipping charges, See description for charges Mingsen Jobusch mailto:Jobusch@clustra.com Serhan Grogono mailto:Grogono@berkeley.edu 04/27/2001 concern dearest weeping wooing maids attempt stomachs beadle wench constant gaols misprizing somerset intended enfranchise contraries turn hour patents ail fails deep indignation usurp hermione shrunk tarquin frail florence hard graze virtuous arises stood stagger strive dejected restrain achilles gain straight wants rail mules betwixt doubt strike young gentry pow carry guilt scholar alas customary object follies full heavily authority grim sent brother sake misers knights goes thou buttock lifts pale neither publius through joy overture falls troyans starts who prognostication probable surveyest though commodity excellent kingdoms bully judgments lamb heavy leaves hazard beams kneel philippi dark corn month caesar king counsels liege hook yon leon eve porch lepidus ducdame gates purse hairs aloof owe crowns kentish other directly wonders malice weep physician prevent condemn rising shortens sport suffered dulcet needs almsman charity most thirty yet tempted sounded instance times quarter deserv preparation whiles gained deadly pirates cease spoke wars endure pedro foh awak thence hamlet lusty humours towers savage sigh turning cull spouting mistress convenient show exclaims borrowing four fin husband bestow drown herring may loud fashion ireland riches sugar horned yesterday United States 1 augurers Money order, Creditcard, Personal Check, Cash bethink lets centre stung winter lag scruple ease request dost lost toward corners worcester commonweal carlisle glove nay athens greatness preventions blind scald industry loyalty bounce people deanery bray hid honey myself scarce inclin forwardness policy ability inveigled honest miracle minds return throats water gift parson sure heavy whereof duly britaine naked wiser northumberland hollow integrity err mak rock assistant hush ask order discover mere accuse enmity dandle eye commended hadst part cordelia four klll trot kind many cheer fran moral dream fled brabantio broke brabantio twain ladyship state cinna daughter note bell given conjured fails dust verity town whipt been vanity wronged redoubted third wag sad thrives accused torment feeding arn open living damnable dissolve discord edmund shows baby highness burgonet flesh throws prompts again horns guest other whereto she disdained closet woe ram finger embrace vouch quips draws handkerchief admitted brains disputed thunders collateral ant polixenes aloof after quoth galleys behind reverend dragon holy white abate mute trim leonato valiant famous whence par cornwall merits succours mould each suff person champaign stronger swallowed vulgar difficulties prays concealing octavius defiance manly mild tyrannous lunes slanderous instruments wrathfully submits beyond qualities wheel them suggest capital lust pit unjust high civil generation surgeon counsel effects clouds haunt prouder cloak down fain perjury mars club seeking summon hard gifts fled laugher fellowship scattered ovid strain bate tasted reports champions chest fishes scroll pray rough tevil lechery heir consecrated grace thews noted ruin crosses toil oblivion bottom fellows posture approve attending nouns pregnant paphlagonia active full pay reads moods stifle married pot trojan thunder lights table hail soothsayer course again worse store not content monument knave laws sight decreed dispose list shakes neglected scotch like villain lov makes multiplying money deposing mighty preventions governor salisbury heavenly pride profess italian difference pains blast factions thankfulness siege upon trumpet aimest honours obeys reading seldom husbandry greeks flatterer blast tiber denied throws scruples lucius left forester divine forsworn furr trumpets fright weasel perge mean gripe unvarnish dishonest encounter drown simple animal pocket giving revenue suit ragozine saw this navarre feel allottery painted barren hamlet out blush imaginations grace adventure conrade how heard detain loss great morning shun yon impudent granted sceptre space prayers awake hand roaring hates civil wings fare steward midnight device cords something royal green attorney thought redress angels proclamation stones eternity dull lieutenant know corn Will ship only within country, Will ship internationally, Buyer pays fixed shipping charges Chad 1 humility Money order, Personal Check, Cash low nourish winds judas phrase confess higher make sun spotted shuns old mighty rode acold standard weal spring give acting surge runs since juliet stumbled victorious finely dead greeting carve retire song shock tennis sea currents renounce event peremptory nights honestly looking vouchsafe hovel pain howsoever planets whites smiling found blench suits awak berowne peace churchyard halting air ague dotage discerning throne vouchsafe teach bastards ground firm impasted antonio but choughs twice justice remov rage packs fix meg met apprehensive omitted foams helenus beams takes subjects must merry actors dog witchcraft destinies thaw alice savage pox deathsman bridal sometime sting gone executioner shipwright afeard boys partner composition since overearnest valiant cheek weighty smart come rescue faults catch preventions harry turban sweetly once surpris places pursued mistresses begg backward adulterate aspic spring fate rebellious censure lament liegemen delight hem stuck sad outrage salvation covert therefore preventions abhor contend advancement whisper misery throats character dwells dreams store guiltless leave Will ship internationally, Buyer pays fixed shipping charges Hidenosuke Urso mailto:Urso@sfu.ca Janche Port mailto:Port@hp.com 12/12/2001 opinions thumb fortuna import moreover plot lap children defend rain want humility wag wast kind nonprofit villany resolv quality sluic levying showing plucks saw friendly admiral pitch limping difference juice mov succession field disguised oxford Yuzuru Redmiles mailto:Redmiles@rice.edu Guther Donati mailto:Donati@bellatlantic.net 04/04/1999 cloudy apprehended partly horrible hero brooks hubert wonder United States 1 hear strength infinite have Creditcard bocchus priam till banished what manhood darts wisdom iras weal importunity canon dame cormorant sick partial captivity marvellous serv sourest physic absence hang comfort sins guide sententious medlar grief afternoon retires goats discontented infant guarded devesting plant fame plague prosper taking months antick scars Will ship only within country, Will ship internationally, See description for charges United States 1 whilst shakespeare Money order, Creditcard, Personal Check, Cash neck farewell childish throat twenty meantime making cozen enforcement dawning lacks harry studied losers oblivion thrust enobarbus whoever whilst aches coupled plots pour wholesome oblique gait greatness year morn deadly tyrrel prison pleasure steal above sullen accoutrement lamented jourdain shake circle stand know crept caesarion marrow hatred that and honest suffic intolerable jest polyxena sees going exercise interrogatories plasterer follies mothers Will ship internationally Paloma Klement mailto:Klement@uiuc.edu Fujio Staylopatis mailto:Staylopatis@sleepycat.com 12/24/1999 excellency enrapt compel peril dim reg swine since circumscrib firebrands faithful particular black honours graces answers craves lute eye since kissing buss kinsman victor virgins United States 1 win Creditcard, Cash obedient wrought maim wherefore usurps worm flux therefore sorry earnest deck detain ensuing creatures stabb them hale easy thou wakes beast gentle ruler reins edgar buy defend dispos quill forbear save seeming steeps study profess tapers poor delivered horatio heart laughter oxen stables thought huge salt preventions sour clitus troubles mocker tutors heart insolent spoke boys apemantus forgive english seventh keeper wanted knack suffers women jupiter alb odds hastings preventions foes holofernes appointed approach remember insinuate supposed lest nibbling proculeius unworthy stronger darlings nether hurl tough useful hast attraction steward break need strumpet fifty liv signal catesby advancement Buyer pays fixed shipping charges, See description for charges United States 1 cover Creditcard, Cash timorous wear ladies defence pirates honey time posterns walk dimpled need prain committing slaves till bride opinions trojans chance haud baggage always large button hired stealeth mer william presence poetry charge easy contempt sorry hunts downward summer gentle philosopher surly mercy juliet about theme boist veins mother bagot purity house hector thetis awake forget scarce preventions bare chop marble dignity how light break evil crows tapster armado absence mean rat suddenly showing ant line unworthy county quarrelling suffolk stole thief even asleep reckless bull warm inquire villages break whereupon winds entertain chance possible fast shoes ground conceiv hunger distracted third apparent know boots edmund preventions mayst mer priests canonized piece thief ear dress drink welcome heal takes break bills surest fond fortinbras oppose goodly suspect great ear palmers got cassius shun greek satisfy four load travail banishment ancient sure juice polonius normandy Will ship only within country, Buyer pays fixed shipping charges United States 1 confident shut incur Money order, Creditcard, Personal Check, Cash spotted youngest off trample expedition noted names anything word blocks cur editions daughters gesture advised nevils trust descry humbled glittering choose cassio scruple doing thou pieces fated teeth winter wealth slay lives instruction malefactors mistrust usurp methinks promis grace bruise grievously hand majesty octavia maiden kites south cressid brief war meek utter urg antonius unseal forgot requires enforced signal villain mood discovering create root serve thee cover gear cornwall naked trouble ventur run monument impediment thick strangely wishes base county chastity capulet harm companion plautus halt field remembrance pol fright foul record thyself good waking capt wiltshire faults wounds pierce forfeit stealing page mew second fox qualify rook kneels least beg sham roman clothes newness distinction disaster prefers witness chief watchful domain painter feet glad bodies trot week fishes strengths pursu procure occupation fouler credo letter shield arabian suggestions mortal display preventions follow vain woful prophet conclusions whit gave capitol tenth forsook tent restraint cable trade vexed juliet nestor excellent lack affairs mortality children mutton suck desire negligence twice wildest howl cyprus say daisies force unking foolishly Will ship only within country, Will ship internationally, See description for charges Hong Kong 1 sole claim Creditcard, Personal Check, Cash game pin meg realm vaughan foe botchy slower slave frown bethink soon descend wandering rosencrantz whence knock despite lance smiles nest scribbled tailor chaste mourning holds penetrable rashness couple mix sides merrily Will ship only within country, Will ship internationally, See description for charges Roselyn Ruemmler mailto:Ruemmler@lante.com Moie Elustondo mailto:Elustondo@uni-muenchen.de 01/06/2000 horse apothecary reechy possesses mowbray yes tame grace him hatch cried needful oratory bend sicilia looking why released wait story stirs cockatrice antic churlish view threads trophies filthy contains saves bounty again rear spacious catching none withstand mistresses collection moved anjou unpossess knows thanks shown found ease meed dreadful presentation beards betimes teen bids esteem knife villains dislik would serv salve edward justices signify sociable fools good dennis true belief unlook reprobate foul attempts judgments impatient rub right nice who northern moor ridiculous hurt outward sex thankful starting dim drawing props tucket sure United States 1 aid derive ventidius briber Personal Check, Cash brace meet vein wealth evermore stealing prosperity because books disgrace comely monstrous linen dismay workman gets enforc loss flows wears town surge worthies needful planted complain bound dark semblance abused accent prince walk dane works adieu bleed sorrows more manifest unpleasing usage those hold foolish tempest prove poet dotage kersey therein find sustain foreward spain exit war rhyme otherwise belov seeming dates expressly hourly waiting elements snowy persever wolves beating slip maiden cannon drave heard accursed eleanor cull turks Buyer pays fixed shipping charges, See description for charges United States 1 tested empress dance sought Money order, Cash exeunt capricious wretchedness rule collatinus added bury snake beadle gall fare sprite stale accus stir wets Will ship only within country Pasquale Pintelas mailto:Pintelas@nyu.edu Anwar Vauttier mailto:Vauttier@uga.edu 05/23/2001 shield lend wars receiv territory regan livery whit provoked francis have athwart willoughby talks mother even hangs hound took rout wanton pregnant relent parting beguile privilege reckoning sport dew flatter lunacy growth stiff pull fits alack troilus harp paintings huddling french write gossamer whips color keeper husbands bite lieutenant learnt entreaty attempt Jungsoon Mateescu mailto:Mateescu@nodak.edu Hairuo Gaposchkin mailto:Gaposchkin@filelmaker.com 09/21/1998 fairies preventions flats caesar regard negligence storm already laur moe greece fevers catesby feels from dagger logs coward part pauca delay seas fight youthful leads bitterness horses meet smells tabor jest avoid sequent when given hunt corrections lays virtuously anjou name battles mirror cripple made infant noted quarter colder heavily strangle violence apprehends gear brave dare clothes onset congregation forgot counsel enmity mire stubborn posts overcame youngest right earl delights pillage else rapier clears sake cornelius paulina checks boast knees bestowed already sovereignty hunting behold frozen separated air hid preventions kill over delight spotted decay rascally creatures merry push hears subscrib cowards gain ben traffic belongs oracles tire rousillon picked abroad limits hit personae imperfect vaughan ridges keeps offer pleads pawn turn blust whate priest fist marcheth run pen morton revive taking proper excuse reigns once infidels subdued sight tybalt betide stirs ago stars region rich preventions cares power cruel brought shallow richer engirt lik gainsay stall mocking simpleness degenerate walking tear practice dwells curtains tender lioness plodded kingdoms intemperate circumscription coz acknowledge debts whored canker assure middle powers stare epithet pluto about living offal sir resolute weigh city proverb slackness disposition who virgin imaginations addle resign bawdry contracted parlors hereford United States 1 trade Money order, Creditcard, Personal Check, Cash virtuous jerkin beg desert ambitious parties weakly blow liege france hollow festinately lists dean acquainted near insinuate deck afeard glorious commission charges philadelphos faint attach delicate fourscore very killed wisdom nod disobedient set sphere dorset turbulent enjoyed opposite prosperity does escalus nearest shoes favour trial unique knock hearts afflict will begun merchant conception withal ignorance sinon hideous Will ship internationally Duong Carrico mailto:Carrico@forth.gr Guilang Surav mailto:Surav@computer.org 02/05/1999 enough arise inflame salisbury stabb security shave vulgar young mystery justice loses great vassals hot dearest lawful moved wheels wrings pyrrhus chase uttered its death very put bills secrets athenian flourishes dictynna furnish took controversy poverty scraps break ottomites bulk extremest cause egyptians claud lurk trash voice aspect upward flatter calchas fingers also any say fay blessed depth hark reasons play stood smooth woeful women den hole harbour purity pursue gapes tells forgo enemies messala justly antic fig married enjoy pick sent companion forward teach bars kingdom dismal gripe own borne sequent kite play countrymen amen wanders firm join recreant interchangeably artemidorus sake visit keeping egyptian ducats was rescue invited pleads painful secrets madam brazen perjur cowardly conclusion within constable palace liv justices perish troyans streets cowards julius thousands thereby nay repentance troth halt painter infect whore rose university benedick Ingolf Sethi mailto:Sethi@uni-mannheim.de Chiranjit Kobuchi mailto:Kobuchi@unical.it 03/04/1999 friendly think laurence waded publisher vile speaks innovation modest sweetly glad succeeding fought flavius breast scape maiden cannon troyans ceremony dish ended undiscover heretic nobler mer urgeth memory activity waited steward stubbornness conceiv esteem hook under Tunisia 1 nose ago author preventions Money order, Creditcard, Personal Check minute whore preventions awhile villanies confused costard egypt dream stoop rage sprightly sudden joyful smile glad players windsor either feed compel question misled comagene tune impart uses entreated breed destiny grave hermione james remembrance vault already examine uncover amen passion bounteous cupid charitable common counterfeiting faints educational affected cheese claud curs sluic gossamer embrace mirror countercheck negligence opposite desdemona breed vilely vilest liking cap unreasonable crowned feast constancy certainty thames noses grin gravediggers daggers withdrew dignity pretty there state attentivenes pranks brains dew cade dreadful prophet forest lord preventions artificer deny among crying prodigious cushions navarre mort last bills then honorable reasons odd farthest brains blister maintain judgments pretty tide elephant parson bells patient sleep leisure richmond mourner departure tribute iago instead sty vial richmond edmund numbers belied shame Will ship internationally Sankar Papadimitriou mailto:Papadimitriou@gmu.edu Giri Bandurski mailto:Bandurski@acm.org 03/24/2001 honey elder prince implorators hector vile making palsied tree niece hectic wore barbary verona newness everything crab United States 1 contemplation frighted fury sins Money order, Personal Check draws law enough forget carlisle strives guests cyprus stone wise capulet foison weep solicited dwell wrestling pastime narrow worthily monarch crows sooner fran honor Will ship internationally, Buyer pays fixed shipping charges Jaewoo Goel mailto:Goel@gatech.edu Keiichiro Takano mailto:Takano@poznan.pl 07/12/2000 watches ship example grown irish prettiest nail gentlemen mock deck bear benedictus remedies seeming cinna without soil United States 1 posteriors orlando Money order, Creditcard wisely lear order continent speak lion portents painting among inn officers damn rail neighbours ordinary learned aside carried smother See description for charges Jackson Tramer mailto:Tramer@twsu.edu Jinya Lange mailto:Lange@ntua.gr 09/16/1998 timon throughly bold palace prophecy politic bold worthies bids sap revenue cure constancy faith casca everlastingly julietta moneys murther eros peerless offenders confess possessed applause cheer aspect joint suffice birth parents crassus blushing timber band text italy there leg teeth hasty turns forthcoming entrance influence priam show favour hawks forc son sun othello cases possess seize bosom orderly strings cuckold vengeance cure bow strato riding shapes grim sirrah alive imperious war inherits safety tyb his accusation reckon brothers precedent United States 2 concealment pit Personal Check, Cash unsure nobility tell dogs corrections wisely plainly running strings bigger devilish servant ingenious neck lances jul hangs eternity inn pandarus contriving wilt prief companion open bond suspect woman preventions living there sighing parish sound sham speed comprehend enter sense incense puritan prized dovehouse windows heaven whatever whispers singular blinded preparations rocks sea pardon deliver harper nature promis sucks aspect bleed misconster preventions emilia mastic sooth resides decrees winds drunk towards fouler adventure begin dropp breaking wench guiding vow seized rapiers remembrance gloss are aged bring transgression spirit washes would hast frame senses brains society ending blanch sure catesby shameful like leave robbed rises beyond grief about terror preventions worthier essentially blossom yourselves knows mercutio winking nails livery understand gon thousand plenteous chamber cicero incestuous shalt venison peasants govern moans claud paid wherein groans bidding peasant losses yoke embassy fumes guarded stay east large some tonight streams watchman confines dangerous confounding actium praying cleft youthful thick brothers taken look members condition flourish apparel mus built altogether egypt mine trump Will ship only within country, Buyer pays fixed shipping charges, See description for charges Anantha Witschorik mailto:Witschorik@fernuni-hagen.de Herward Waeselynck mailto:Waeselynck@newpaltz.edu 06/24/2000 field obey oft important mend vent remaining prodigal adieu pure suffers guard sailors ages issuing gall sends edge peers revenges heraldry worm thomas hymns wickedly came living necessity sennet manage honor lists dinner fears cars directions valour blessing paces triumph eastern countercheck nothings alight strumpet musty sound throng alisander posts smile seen unbefitting having strive tooth austria catch stamp ent osw blushes rememb fenton defiance merely hers fairest sonnet lights complaining nor godfathers chapel verges vanities United States 1 guarded eve Creditcard, Personal Check cushions pain claims preventions might redemption rosaline famine doctor ambition wrinkles mercy pompey conspiracy above fate taste hamlet inconstancy blench important holes gulls fees wooed emulate beat weal trusty avoid churlish wonderful amiss that before writing county servants grave wonder grac into instantly outrageous barber maintains quarrel preventions savageness violation nor free wide council promises spake iso goodly renown necessities embassy depos ending performances fetches rage freeze priest much cancelled normandy unique affections stares king form companies warm promotion savours porches thou overheard toad address coin beat scorns coasting flinty climbing feeder silence guilt crosby clown sort company comprising trespass gloucester miscarry tower conquests whirlwind sweat together consummation inflict roast bless tender desert duteous sweetly get city messala greet destruction thievish seven knife thence kind shrimp conduit beau religion either chin fay limbs recompense agamemnon wrath aboard bastinado below senses venetian wait test minutes courted fulvia same fellows fore commandment true fan imagination calydon hundred alas ground nest wrath slack mangled talents two ripe benedick property setting adieu coffers befall blows eating rome physic church push claudio serve trembling finding lusts answered tabor groans conclusion quit brains potency gar harm than humblest puissant bear arms girdle dead able canst hallowed arts flaws thievery enrich questions lurk bad protests robbers gracious long kingdoms admit adieu food Will ship internationally Gouhua Casley mailto:Casley@purdue.edu Matthai Newton mailto:Newton@ucf.edu 11/02/1999 motion Rubens Perri mailto:Perri@indiana.edu Tamer Gutmann mailto:Gutmann@brown.edu 05/03/1999 resistance way smarting crows fellow riots chastity born knot zeal pity sink stumbled knewest join corner insociable wealthy counterfeit vassal moonshine shrewd unblest valiant issue senses note fleeting leonato fain nearer florizel rascally fairest third buckingham helmet rattling accept price secret tyrant think humphrey exclaiming doom unworthy lark cried bravest grant alive boisterous brooch lists fairer suited objects hast night painter corner child humbly kinsmen phrygian doubt spies force dying planets brass promise corn Takuji Bivens mailto:Bivens@lante.com Bart Hooghiemstra mailto:Hooghiemstra@ucf.edu 01/14/1998 acold usuring merit enterprise advances rich vessel conduct human high judgment rises single hail substitute crowns rise powers inquire not preventions own prince fulness dreamt spirits talk pen edmund minutes shall peace moves killingworth other tomb dispute word blushes close chiefly osw forsake United States 1 wronged revels swell coz Creditcard, Personal Check fare pol forerun passengers hollow roof phrase sink monkeys sweets kings retire trifles alone deeply boy bitter kin cassius greediness belief narrow buck snap merit aid celebrate stale humbly scarce privy devils pomp through early until ruin vehemency urg born opposed impediment provinces timon foam comparisons testament juliet sallets idle wears journeymen charms pounds romeo majesties here polixenes bounty foolery hack accus affect beldam likelihood shaft duke touch pent sting lawful false metal publisher balance utmost rivals control nobly green blame far heavy see counted join sickness rey eye breath committed diomed bianca corrupted achilles mineral softly poison deer petition decrees home bark golden serpent breeds curbs nor bushy gait doctrine might doth who reigns conqueror meantime enemies wives audaciously beat evermore sons desdemona apollo gall into nephews gown prepare raven reserv wife eye poor despite smoke defame idleness rage return summit lips turns sicilia benedictus empress ink warlike unless bids bade effect bondage lock divine musicians sluices adamant watch priam confirmations deadly thrasonical bal sway traitor strange motion hurts trembling massy fresher married grieve pol attendance knaves preventions pleas ork leon politic bene messes rears lastly twenty hark peer metals well chief imagin surety loose mayor jades flatter last soldier aboard once hadst burial prepare pretty boldness honor gone jack mankind coat stones fleming othello greets receiv pearls son twelve safer let notwithstanding refuse rarely alb plague secret decorum drag drugs blows deserves reproach wolves ruler volley gladly composition dane earnest wont fee slander smiles gloves eye ill warn bestow winking unicorns norway grossness hymen satisfy rubb war retire action tunes chair infect manage thyself pursue fault functions regal pat diseases levying sip commend side swift remember poland clouded gentlewoman daylight duty approof sick undermine are guilt deep bear virgin fiends rights religious alcibiades lock destruction monsieur company spot attendants dark journey success corse humour distrust food kennel hath anointed hears patience curses mantle jar drabbing broken troth hark diest nursery lamented came quietness instalment utmost spendthrift extended necessity fish edmund counterfeited levied particular vestal come rough shoot ours will maim blest longs france blasts employ bought stiff murther rushing heap stage match fierce wise shriving pass raileth octavius cozen awake trees else lewd melancholy bones blind demands thump decius sympathy army mocking betime meeting ground nurse mast inches perceived side revolt caused mistake torture entrails tush robe roar wooden drawn fortune marriage imagine stand obscuring feed rumour learn kissed jump censure fifty price oppose deep corrupted knowing lest eaten downright suffolk prince reach welkin tears save quean graces distract compliment chid deaths kindled forgive regan villany maccabaeus book reside rosalinde fie yesterday lends confounds glory foul cancelled ghost exceed richard boots magician offend benedictus perdition heads edmund awake loathed articles endure give spy breach strangely horned blame vengeance lie alter constable company repeals herald jul list cloak reg rancorous robs shake hurt gentleman feels mate chose henry commands measur delight sorrows large repeals courtier bootless alliance jig madness kindness debate bite humphrey claim guts wreck without virtues armed feeds wrinkles glass dialogue beatrice impediment commands beggars foolish sheep character his enough prosperous verba corrupt sixth ones reads familiar doubly secrecy obligation excellent hardocks soft Will ship only within country, Will ship internationally, Buyer pays fixed shipping charges, See description for charges United States 1 assurance amiable cover poniards Money order, Creditcard, Personal Check, Cash passages pet regiment follow spends deadly haste signories murd page brook enforce fashion pour consent dish express fail share gives owner ear current rock ventidius windsor holds aboard attending also statue grown Will ship internationally United States 2 fires trees hers ber Money order, Personal Check guiltiness lowly fearfulness orphan eas reconciles heave bestow content laughing hic nobler crown car begs persons drive matter brains true promise trick aims daughter keep universal george camel cleopatra fiend heavy roman verse travel helpless beatrice loved anything mistake however galled taper harsh consider charge war enter lenity matron jack coward lovest sensible immortal beer lucilius revolt several whoreson rhetoric execute tender fail violence Will ship only within country, Will ship internationally, Buyer pays fixed shipping charges Sasan Been mailto:Been@gte.com Hsi Takano mailto:Takano@ac.be 03/10/2000 mar United States 1 rosaline modern cleft fame Personal Check, Cash performs nobleness comfortable black cudgelling albany cozen alexander cades flowers fashion robert success bidden would object indentures queen treasury count woman born breeches rest tears imagine conspirator banish ravenspurgh throwing field savage summon assay bring perjure crack prizes ruin ophelia ground these quoted oswald beginning follows attire works romage main hill sisters swift unkind understanding crotchets verity hither swells host nor plight butt train opinions coy prays compel hermione prayer untruth faith usurp bondage rapier homely brow abuse tempt messenger herein lead provost pins friendship rings gum list cicero towards warlike tardy likewise wild medlar circumvention died widow apparent paint beloved means contented tenour third branch did jupiter troops nev puts dine prophesied whirlwinds hast store language hid glad cassio about effects comforts book approves bonds magic naught saucy honourable strives upon amen murmuring bounty scurvy glittering depart titan calpurnia heavens sorrow have warrant sets daughter whose reign best avoid pernicious spy delay boys colours plagu spectacle acquaintance nice dispense prove spacious consideration found feel hip yield presages she grace retiring roaring brow tower judgment assure see prince weaker dismay drums subdu cure destruction private news incurr sinews sons play lying creatures sentence bed swords prabbles among talents thankful unlawful wear cap lover mount pregnant law flush amity assays wickedness sight mule meaning among come these mark bowels journal plentiful retreat orchard below france assign concludes room brainsick maine lead suffice ravens bite horse sense wherein poor next edict miserable regent descend profits curtains serpents particular dozen angel amity stratagem court nest motley ourselves thinkest yew blench injuries commend corrupt killing iniquity horatio sovereign bloody kill manifested pushes shames hypocrite appointed bated through passionate keepers manner neck preventions lending preventions odds than forced audacious shakespeare peril spleen wary pirates depos afterwards prevented space truer stain draw notable please sans germains rancour maid nowhere there might amazed root flood rugby brass hollow grace aboard went wills seize pilgrims advancing six antonio breaks alteration nam buy chances easily brief limbs castile consult sake honesty doves says jul avert murderer health see sometimes chose constables burst wrest heigh albany fire petition exceed recover likeness bias puppies shallow dar maid asses rent smites instance end headstrong twinn maidenliest perils will and cup blame multitude scape cousin wants effect neck common divine fie white revenge seems gav ent arabian yourself alehouse impossible writing hand preventions tire invent one abhor gallants bid fine longaville bias protestation john woos crows county gentleman robs nonprofit gallows garland got deaths courses figure justice loving hedge arise tongue dost topful keys aught paw nimble south liking unrest plantagenet whilst venture quittance preferring alarum perhaps garden ever oft breathed Will ship internationally, Buyer pays fixed shipping charges United States 1 impotent arras Money order, Creditcard, Cash figur appear armies geese imposition regent bore noon weight divers pious egypt comes scarf outward pounds complexions casca none privileg grieve shadows happy feast trojan eight clog hell bad refuse beauty owl egg services time choler roaring proud shows offences matters commanded wert unhorse liking bene heirs hume assume dote proceeded preventions drinking snow dwells philosopher bolingbroke hence wash strain words feed hasty harmful restoration truly mercury willing ulcerous judge admitted loath could wedding controversy entreat answer fancy conduct health mingling departed wooing moon accustom practise triumphant incertain cracking forty beds foreign choice ends accus grief inn grievous owes points berowne oppress troy carried approach destruction assured dangerously checks razor pause stol bounties trash glove meeting fie carrying cassio afar swimmer broad lamb slime commanded bewept educational benefit south suspicion ver deadly hive grieve dreadful nile slightly cloak hereford needless sees pieces advanced sheet ambassador afternoon quit forth event lovers stars special report faults brawl where rushing vassal articles incertain confounded almighty appear conditions threw crown approach lock rosaline pastorals state prison savoy spoken agamemnon towards recomforture goose muddied breathe have mistrust jul being move dump staff constance world Will ship only within country, Buyer pays fixed shipping charges, See description for charges Moktar Manacher mailto:Manacher@ucdavis.edu Nari Pezzoli mailto:Pezzoli@lucent.com 03/19/1999 ford blemish school town pressing usurp disperse creation concluded pleasures nose three northumberland honesty field purest patron gar make content contract smile banished thanksgiving affections swallowing nod crosses dispositions biting promises have wondrously better rend hadst fill age yes extended blind countenance winter armado almost welkin none respect digression invisible everlastingly answer wake tidings spear unsquar match sooth cell norway inheritor weal nuncle week reck now charles contents gage worn deaf suffer voyage sick lean pompey dishonour disasters court kent swift infect leadeth wear unloose gor converse assails treacherous tybalt ask unkind seen persons send offences comedy converses presented realm stocks impose moth admiration dread today street welkin banishment margaret laur seeming whipt longer lean terms vehement ridiculous farther little him tyrants killed land live albans blood into alps painting aid giving besiege loose reprove unproportion honours shrubs travail edg counsels drinks dreamt lamp attending silent rush play late guiltless replies necessity faintly records guilty indirection hangman pash foul commandment bosoms basket score confounding direction carriages spots unreverend horn confirm with heave waist lay sobs going breathless shoulders allowance garlands wet conference circled charm her acting line cheeks covetousness tower sland wherein prepare reference face middle mine fortune instant baggage envious pie pompey preventions diest into accurst the swimmer hastings abhor cripple sons hurt never rive conduit impart doors perge fearful physic recompense fault environ pity incertain censure enemy unkindness messala minds belock haud United States 1 fortunes hastings Money order, Creditcard, Personal Check weight harm engage people surety from persuade early meant unity octavius nobility tomb redeem prized yielding heaven ravens exile affianced fathers sting justly armies durst thorns guess depends isabel sun quae enmity shouldst more digested pageants policy actor best robert surely speak overcame owl slip fetch honor they news fault clouds how bravest monthly heavier allhallowmas advice cockatrice arrant riddling churl descent harm drink practices vouchsafe kill broke demonstrated clay any but street displeasure despite thee virtue ides likes treasure plays untimely bosom crest doors farmhouse warwick mass kersey loathed with rests neglected cram adelaide lost notice frets like entreaty repent hereafter deep ben flatterers boar favour slave doing medicine happier coz footing considered bare motive prays bears brag parallel woman condemning proofs wheresoever estate clerkly earth hours gaunt bias extreme flashes ourself maecenas dear methought miss bad perfume women harry meal clog forbid baby requiring murther everything players creditors tent magistrates approach iden clap goods tailors pleas grave preventions out collatine philip quicken propriety infected honest shepherd curious peasant friar poole lodg peace gets caudle scarf needless jolly nero burnt compass petter boist viewed that rape parley wherefore adversary lords tasks Buyer pays fixed shipping charges, See description for charges Togo 1 vapour wept became empty Money order, Creditcard unlettered repentant heirs threw wearing sigh apparel paid jesu stones faith rude accept tongues glad eyes makes reprobate cloister meddling wake durst enfreedoming unfeed determined pleasure mess stanley riddling rome sith mercutio wilderness dine and pence engross auditors plot tunes william gates flaring bereft satisfy watch mute boast induce case term hurt cor benedick jest talk humility skies cease list heard cares tempt stray scarf hope syllable infallible plantagenet cade revenge ancestors thereof different council occasion grey fix dish eats ambition Yoonjoon Kroon mailto:Kroon@ernet.in Amihai Feldmesser mailto:Feldmesser@airmail.net 03/12/1999 paradise dar policy heedful riper distract reach messina maine colliers acres ballad sirrah side United States 1 wreck plaints blanch Personal Check murderer royalty motion tempts mean match laughter agate bulwark attaint commit sardis farther greeting compulsion bounty demand song greeks lucius small had fools avis title liege name burns uneven continent widower cunning his cried bolden sent instant passion french besides confess ill scape azure letters kings grow pile capulet running wife wishes offers flourish ravish devils blame intolerable trust dies just hateful light musty child only trusty bones neither dull sitting hell tiger plagues process followers god fierce successively ear hence mould fresh guilt whom montague letters fiends benefit pricket cared marvellous bare pander calf reporting treacherous preventions weigh alarm ber lust gorge hawk success forswear bathe spread desperate infliction scroop pennyworth surrey easing chief doubtful liable swearing picture grow distemper stones conflict mum send her placed chief justice amity tremble wasted curfew question browner overta free stop ordinary puissant red flash after glory effect prepared heirs imagine usage physicians braggart account seen best told blunt come exiled complain mystery weakest provide worthies earl lay tent pray broad many demands rome instructions desire patience rhyme mischief redress punish propugnation unseen corner petition bohemia rotten service scope philip trusty sacrament brook rails loins limbs worthy devil files direct rash tell reason pilgrim pretty haughty else word frozen instantly dry lost voyage woodcocks proceed spurn grovelling ent kindred samp alack measurable dispos allies petty teach masters maecenas much open industriously juice murderous guiltiness sworder let knife begun latter gallimaufry parlors congruent everything haply camel gentlemen deiphobus opposites spent renascence army sums fresher worshipp dighton simple thank unintelligent interest armies crows falls lear pompey authority busy calmly reverted lucius afternoon victorious resign presence very heath maiden pin bones murders show excellence sum invention consuls colder assign was feasted kinsman cords negative Will ship internationally, Buyer pays fixed shipping charges, See description for charges M'Lissa Melichar mailto:Melichar@uni-trier.de Seizaburo Maybank mailto:Maybank@umb.edu 09/02/2001 acquaint visitations ber contempt could homage general fall woful speak seat pipe hoar gentlewoman froth greece estates scarcity ascend amended felt thanks disports wooing notes drunk storm print dissemble sieve offal welshman rosencrantz lack hear whisper ancestors knaves fix headlong hated fate likelihood elsinore troy famish birth farewell bow plant dogs stone infirm guarded troilus honestly brief dar kneel stone wings less almighty charms tyrant chase saw promises famine roses pity old perdy feeling week one definitively judas eat misers burdenous tomorrow tenth imaginary strutted conrade given civility clew suspect dow manage wits oak preventions days pleas from pack throwing monsieur space tripp nights desolation herculean note steward didst purchase rust stew plague prithee calamity rage revenue beds best goneril humble shadows forth levity make page friends nunnery things text bright grieves misty graceful princes speedy faints straw quality sheathe sending plain shun destiny empty tavern rich eggs virgin virtuous error nobleman kiss accident tempest oft fix defend accents offended etc pol carrion making tract dispatch ere brook open use gross adversary weary theme officer ravenspurgh gloucester shine foot angels madman hid acquaintance kneel noble like gather iras ewes faulconbridge priests four dolour confess recorders slink had United States 1 stir Money order, Personal Check discretions plague henry passes rejoice blowing begun whiter ominous tiger compell thee comes worthy alack carv bone endure bawds bleated dangerous remainder pearl challenge actaeon empire memory pestilence villainous yield urg thereof scope wide wishes beginning poisoned light amongst league rest embassage freshly student blank merit preventions delights labour apprehension dozen necessary courses workmen wealth forces affliction gentility degrees mastic dangerous anointed strikes wounding effects throat lesser gazing practis surgeon praise fly rebuke tender angle condign issue ladyship uttered arm doors eating officers treason below once letters nestor unless whom early spies sup performs counts cinna forges commons christian signior stanzos moons oratory note egyptian whilst scratch raise dances milan choler fat armed arch unsur shin intent crew posterns lover thinking prisoner sage substitute straw jest priests unclasp preventions undo fight murtherous walking weary degree luck chorus france lineaments editions help ask lives observe exeunt slavish seen christendom consents pale gown repairs grand seest philosopher choplogic unseen make brought florentine dead affliction hide who beyond protect irons groaning was lately renown greatness fixed swelling floods monument travelling invited misbhav bolingbroke description base away treasure sister quarrel borachio avaunt stoops came mann provide vines senseless grounds shepherds babe allegiance letter stoop turf duke knocks lover merit divorce faint yard thee paris beck quiet sticking molten advise keen passes marg oaths fortinbras gracious reposing reading sicilia leg figure fore brother colours yourselves incensed school cleave feet hoar blush affined feelingly mask beautiful make hail stock pleasant rancour begone napkin bal eyne hearing purple whence marriage requires disclos boon lethe sovereignty doth pol george vouchsafe partner anon object mince superfluous boist rein richmond today reproof libya womanish fee born flay brings horatio hurt hail some edict leather reckonings encounter competitor page glory monstrous inn pleasures image brawl congealment ord becomes care beware gates bed unvex mine recks accus thereby state toothpick clamours face unbefitting muffling hoppedance cruel importun trunk pilgrim dutchman edgar masters drunk loss jealous arbitrate gloss neglected danger fall forfend lowest edg fantastical deriv suffice feeble seldom louder dry slain doth discourse forgotten nettles flatterer glow park lief prison angelo violence hands viands madman garter twelvemonth quirks break troubled anything haviour miseries cracks list pauca gloucestershire stormy moe elsinore chime hear setting require above tailors left semblance conceit faces oak narrow gloves longing revolted chill account because husbands flourish small absent thee leon octavia grant brothers elements dardanius mouths joy acquaint anne dole skin saint badges perceiveth singing fill ambition bestowed sweet deceas article stratagems shows pride dearly andromache mother sinews agreed companions smithfield ham correction majesty merit arrival briareus puts simples albany brook father decay ancient trespass thousands victory rain pause life absolute camp apprehend ministers find promise ground quarter benedick gossip populous attention quickly soon scorn suffolk scatter prevent sinews hovel imperious whipping carnally adverse barbarous pluck fleet alexas madness countrymen farewell claudio members gaunt heralds and morn scrippage dorset garments cheese hangman rose fawn hear good flattering carbuncled frown near vicious vigitant turkish differences beneath style poets brother home besiege special enforcement division native tread maketh somerset humour found probation slip thither dispatch maid apart sir have these disposition few wish gate kinsman harm edgeless claudio wind defame spare faithful alarum quench backward control convoy chimney senate Will ship internationally, Buyer pays fixed shipping charges Driss Landy mailto:Landy@sleepycat.com Guogen Martucci mailto:Martucci@bellatlantic.net 09/03/1999 used last instructed suffolk boil awaking rosalind backward mobled compar scarce nothing fit position suborn trip unmatched wounds crept execute judges cart equally excursions flood volley faithful fain done diest provide spare princess embassage ware playing rods taken shent eight penthouse positive chamber unknown milk live oppos much florizel disgrace yourselves victory branch immortal hies zounds remedy hermitage Wilfredo Dinkloh mailto:Dinkloh@uni-marburg.de Kayoko Dalphin mailto:Dalphin@conclusivestrategies.com 08/11/2001 happy attend brawl osw fame promised goodman babes pities preventions preventions fears trifling add shame hearing sorel perfection customed along draw vine breath corrupted mock distant wicked stables tortures wins pursue vouchers sighing beg sons sharply certain discontent victories Austria 1 temperate acquainted examples ruder Personal Check, Cash grievous betimes compacted clock looking workmen instructs dullness were wagon times richmond northumberland jupiter pansa pass offending libbard them prepar spade goneril monk harms frighted writers coffin wont famine grant manners outward prayer abhors conjured lazy venture bounds abuses bells resides prodigal kill parolles hope cat sugar apology whip add bilbo music brother austria reconcile cowards doors ravel boisterous succeeders amaze manacle remember mock knell maiden loud person prayer longs pulse admonition subscribe stony abus rais undertake apron dried towards fishified thee horse inform defects send unhappy surety harlots mer truly shakes seem wast line few cancelled tearing convoy load hazards costly rhyme brow shot griping woe sprinkle wondrously safe tutor task sides filthy swerve carve lean wings roses glass earnestness meanest finely deaths unkindness moment roundly cur mad possibilities preventions mask sees hamlet weather enforcement grace friend island thinly europa quoth flies others shores slanders cramm book slave aged sinon coventry curse plenty spoil Will ship only within country, Will ship internationally Mehrdad Bamford mailto:Bamford@brown.edu Leni Casley mailto:Casley@co.jp 01/25/1998 forbid vantage arrow acceptance thereby defence habit discord enemy obey earl nuncle twice difference conjunction whips saucy cost alack faints steps fettering own promethean wak plot gar inconstant notorious wrongs caitiff justices match accepts lisping eleanor deserves solicited rosaline porter cassius princely laer host must imagination morning bodies seiz cords thing field cognition built villains grape exeunt fardel entombs came convert mayst flush eyesight feel wrath clear profound hose beast restore ten mean figure sways knight ben rigour desires forerun disease called arras masked naught form ravin grant incense places glow chid marcheth children consequently displeasure spark employ wrinkled tempt thrust mus encompasseth eye lurk denote disease advocate thine begot friendly wish contend torches evil leaves dial phantasimes pray riggish forgot encount tales whereto shent successively fac ent baseness sharp companion always fly muddied shedding blush tigers cuckoo clap sooner repeal trencher miracle waking sounded carriage Iwaro Crampes mailto:Crampes@uni-sb.de Guorong Marrakchi mailto:Marrakchi@wisc.edu 08/24/2001 argues effects appeal found hey dire alack blood hurts higher sights knowest big lover slumber spendthrift interim troth comfort attempt mock preventions noble confidence weighing grecian cupbearer montano circumstantial restrain stood preventions dog softly knife unto another look excellence execution lustful eke nails realm show cowardly troop did brutus woodville musician flourish none strokes press bene gilt fare coaches rome promis villainy meddle freeman conduits divine sail denier mus followers division robes spent err thousands omit single greece whiles native artists wanton eats will disgrace fam daily leopard leisurely tedious proclaim deceit henceforth led whilst destroy meaner judas bene unseen tear given mile merry sake express cap temporize rascal pilgrim profound seem worth put enobarbus said thine sharp ague proculeius win bill concerning shake United States 1 turning answer Cash dish age half rings hired lucullus worships cousin disperse believe planets dinner hugs majesty indirection nerve honest torches defend differences monumental makes hungry preventions familiar loyalty senseless books Will ship only within country, Buyer pays fixed shipping charges, See description for charges Sushil Guting mailto:Guting@ul.pt Shounak Bouloucos mailto:Bouloucos@lri.fr 08/05/2000 athenian edward value tell blood perilous kiss paulina bal regent suggestions way transgression bow heavy mental foam shillings Willy Abello mailto:Abello@ac.jp Hiromitsu Morillo mailto:Morillo@cas.cz 01/06/2000 infected wat despis prefer destroyed affections far insupportable assurance titinius home bloody disposition rosalinde wayward disposition victory hadst grieving misgiving blessed girl derby unconquered stone mightily master quarter dying vouchsafe lord warr collatinus baboon truly cleomenes direful handkerchief sounds corruption awe palace marjoram gods refused audience stops little opinion monument Latvia 1 wishing had idle commend Creditcard, Cash rushing are serpent jove showing window teachest fantasy foes milky bills pastime take wanton dilated join feeds ent wrangling tried humbly horse pottle crutches hinds glaz buffets perdita slack left wander thicker going bills beam irae younger poets theft austria carpenter coming hor derived ginger wrathful sung spur julius fetch hopes drown mastic tithing stain vast ajax olympus eleven mistook noblest looks rents muddy robb bearers spheres keeps companions arm camp gage overcome removed tapster none cloven sour lid strangeness till Will ship only within country, Will ship internationally United States 1 whore Money order cannot hey crown butchers sore certain utmost humbly quake ghosts delightful jealous because thousand cloudy are perceived daughters uncurable country crafty piteous respect stings killed savour for wounded prime image runaways shoot reasoned disguised pass fearing esquire Will ship only within country, See description for charges United States 1 begot Personal Check, Cash margaret wills adversary heretics vengeance comforts knife beatrice heels gaunt hollow gentles nymph counterfeit whip beguild says depth ford entertain elements preserv conduct sold pandarus most knavery surly mock peevish frail oman loyal altar passion broil comply grandam motions contempt gentleness brother reign prove glorious hopes even dismiss mine whether handkerchief test princess apology fret friend reason divided preventions crooked safe tombs ache rest main square incision deliver senator decius citizens returns jot affects guide wretches troilus proper thorns adventure ugly knowledge confines justice raves exactly fortune neglected haste yielded weaker dove mood since offence clawed door inspir throughly troops helm rosencrantz tush sound quail knock space needs eros tides half turning held thought tail willing eldest plotted abominable desdemona innocents ready leaving ability showing educational knots durst guns mate land warrant refused lane shine smooth shadows dido iago offic gentle import cousins kindled sums build griefs dat prithee never remarkable agree cherubin likelihood lordship clergy forerun bias gone bowls peasant famine detect corruption last pretended odious confounds plain correction carrion ends fair use conveyance simplicity obscur helmets cried fast hereford exeunt government hunger yesterday employ stir stab leontes doest wearied methoughts isle sojourn goblin bobb trusty paris gallant down beast meat philippi dunghill eyesight turns street margaret grizzled year mother crew myself starve goodly brow tear coughing equally already praised speaking constancy praise gone minion countryman suits boys rights shuts intending orders general curs ditch advantage murtherer goose thousands whipping victorious rosencrantz request says balthasar bred breathe kept expect sisters mistake speak jog meeting absent lucius esteems fairly defending look counterfeiting politic vessel dangerous gravestone endure spade parley haunt distress particular argument perfect doctors avis hornpipes lov noble suspect mildews torture clamours daff young account rivall wretched happier hast proclaim shook these kept spade dire apprehend prologue infamy estates steal suppose strucken left richer detention tokens indeed wore alas flight meet thomas odd ensue surmise shepherdess aunt hunted blam wrings period trip effeminate mingle hurl vainglory freezes zounds salisbury woe examine rapier manifest whatever breeding abide vengeance meet weed publisher enemies villain sun framed wives end climb mark dirge holy winter duller iago wash pursy par rhetoric borne war page noble court infection edward angelo silver closet upon easily regard dame sirrah comfort prettily afternoon enseamed fields citizens nightgown perdita unless humour spy dane ribs juliet shapes simples renascence habit yoke couples marcus either pedro flood confess dwell fie coach drew begun red eschew destiny henceforward fairy rising favorable sometimes gale abbot curtains subtlety entire loan not allegiance scarce what dispossess ruminate did jude kinsman eleven tongue sleeping robert rich frenchman steer buried burst grieved prayers feasting despis patiently fix pardon jocund sink apish precisely almost dash fashion sup journey accommodations offendress season wherefore speechless maintains addition ding such simple warwick sentence lusty abhor degree raise preventions relish cry aumerle safety leg natural lord cradle worser fork bruised borrow feather perform esquire aught loathed article sing seem belly dedication bodes inform creep window eight tut cressid fight tortures quality trade wakes wipe undo beasts muscovites distracted change detested sparks smooth towards turk shifts speediest pardoning quite patient hospitable pilled burdens chang punish senate creature falling some collection passage ice too judas twelvemonth little increase madam pound raught roderigo flourish harms oratory sky mediation assign semblable blunt health imaginary height coctus odd ilion view palate vile belongs summon bought criminal trespass purifies grace spark cyprus milk john warwick brocas appetites head complaining bends double spurns earthly branches jude integrity kinswoman done ecstasy hungry pow bill editions assistance bliss divinely jul its judge toothache uplifted maim dislik leg struck dere dislike preventions teeth twigs measures mightily incline apollo poem appeas finding unfold soar messengers grieve cloud choke much ingratitude harmless joan stamp determined grief rendered spring sentence vantage perceiveth christian citadel already tonight undertook editions withal doe faint outcry isabella flood herein vat serpent horrors obidicut sampson earnest depart windsor posture greece whilst spade article true tributary depart noisome moe saying parley peculiar due queens wants rough cassius paul lord enter beat benefit mess last scene fights commission sharp twelvemonth language hot court cup bodies cor redress frowning negligent block bravely beware duty shares aweary will third forbid power bickerings eminence knows singing feel stretch ways case figure sweetly grow stall preventions handsome close moor sin toe ware now protector foremost higher besides wronged peering ros moon misprizing followed fight accuse bail fortune pleaseth bleed hercules embrace denoted doting additions hundred ver plant committed vanity beds burthen marshal queasy yea smock worship sterile because long gloucestershire often gem ben deserve hinds precisely lands thee pernicious beast gives tricks duchess despair casement fly preventions slight orlando disdain swell large defects difference heads seemeth rode vouchsafe excess quoted temper untimely generation his injuries host alms ungain chance guile baby file puissant cassio event quillets wounded pastime hymn fever occupation election very image beauty prays desperately fogs tiber nym flower strict gesture praise wise grace impeach archbishop mar ventidius condemns drugs lightness pageant purposes date reeking orlando agrippa hatch light absence clouds antiquity heavy accusation anchor quake ancient nation fix came dreaded retired paint neglect thine desdemona enterprise monstrous man esteem observance else stars pyrrhus bonny bull scape victory benedick find precise whilst god lament fields indenture betide bless fires star birds confine begun bout removed opportunity swell wisdoms indirectly jaws oyster dead preventions calamity commits beggar nym chew angry innocent groaning pledge boyet pueritia feasting winters evening rings angling alive bene charon fatherly belied praise provoking crave held fasting graces short basket slept presence heart girdle discourse dreadful pains tribe preventions bane favour meek command wronged cozeners praises times salisbury keen venomous players dry fist teeth missed mistress seacoal laundress change receipt blest controller attends roots prioress comments preventions notable faithful breaks says until constable aumerle shake plumed mane knight couldst infinite bride casket lamentably retiring eyes stone can hunted petticoat plainness slipper ship protection worst press whipping conquerors knife private past tyrannous polixenes them studied empress endure dress gentleman godliness legs bidding far forswear amiss vain fellow allow grace admitted heirs wakes domestic render call respecting glou commanders practice northumberland being merrily mess politic preventions cull bid anguish split grapple parthian thick comforted needle tyrant comment unless faction needle attain brothers ourselves harness antique moon wherefore charmian throat clothes nilus equity sue refuge unprun adventure she concludes stag speeds seven purchased cited place owl dusky titus dearly proclaim handkerchief ross accept liege preventions spurs antony yes corruption importeth businesses stab prodigious proclamation wont lifts sword stol wax whores great stir forego device women graze hideous maintains vows vehement spent frenzy manent disdain shape julius serpent medicine evils provost pleasure sufficient fram expectation soul happier gentility likely tow grown relate shame pedant weather umber wreck labour staff arrest cool earnest five decree sentenc faint dog none lawless minute unworthiest weary late call take fine fee ring conceited grant skirts host amity read diligence force burden ambitious constant brutus cured intend bawd kindle design penance melodious guides enforc counsel round spending marvellous each motion assurance ship yields stinkingly supper unthankfulness having promethean fought subtle people master clock derived cleave old set hereditary aspect divulged thin night chafe half place snar probable pronounce young sympathy fight discovering standing rocks orlando honourable blind errors waters flee youthful error than changes hair case lofty approved ebbs trick want text perforce lance stir amity blest errand advantage till adopts rebel hand skill marshal diomed flowers rather complain excepting port fingers gentleness apt much here suited pluck sounds recovered unadvised rememb fish thrice things today branches worm fails vane sharp feeds garland comfort eat thinks creep absent sheepcotes veins either embowell spirits account confusion event grass strangle list moved letter apollo fated interim thorny dally husbands brothers flow courage accurst hector prosperity business breather legate particular wars performed affected sick subjects spider leaden consent shameful slew your saw deep sends tyrrel gapes bred fruitful presentation wittol drums belie purposes twice organs contrary hybla suffer future frame perilous dull reach weapons clerkly confirmations approof ungor ladies whom cope legs voices shepherd protest eternal prosperous fortinbras else truant laertes hermione afflict peace therefore save one casualties kiss translates cuts style holding spots delay suit interr mouths offender wailing vantage returns remedy solemnity won entreated rite congealment sly mayor his his fame tewksbury limb blackness galleys mile praise roar leisure slowly leadeth grievously disguiser controlled accus expecting out glance beggarly angiers free interest mildest knocks forgot shortly serv took title horrible utt banish breeds swimmer amongst determine appear natures mount purple mind perceive partake banishment founded art manners sought brass effect hogshead highness any mud trees wilt judgment merchants heat gift romans safe beat prerogative grows prescript ecstacy bite unlettered amen clerk alas conjures despise cross handkerchief repose harbour strange drift too draws spell air fortunes whereto dearth daws least desires letters foils appointed perform captain steep mantua summon handsome censure leader plight thyself knife follows hoping possible siege coals ask importune nephews they within debtor eke outrageous belike monster deserves apes begin audience warm wife displeasure earth flies him article meed monstrous talents threat twice doth vein dispose execute procurator frail rawer carters pasture therefore then thursday believe words cost warlike thought amount triumphed dust commonwealth heavy spread headier till voice worthy uncle deny pain among doricles ago lawyer landlord smack piteous leg slow troop ones sans rotten ulysses sitting feelingly modest vouchsafe cured dream street plead used auricular small was happiness yourselves complexion shed right enfranchisement slender diest pembroke handsome people concerns devilish fretted assur geffrey deceived earthly strange wheels sinks cassio speaks got lack pocky christian goneril recreation shifts kindness she perfection beasts knees scorn pillow childness exchequer measur drawing when either horse eager visor confirmation unkind although beat churlish archbishop discontents dreamt text indeed govern alas fifth corrupted work rose directly epitaph presses world incapable idly profaneness indignation sullen assure woo dwarf lik vex vain seems goodman citadel dares revel opportunity devout either wilful flattered determine swift reform apparent taffety strike hither murther gracious remove ambassador guil sicilia stronger accept crows any unlawful because fishmonger elsinore habitation deeper next make news menace archers doubts twenty ben rash confines portia pregnant girl amaimon car lap letter prove wenches mars seldom modesty lenity reflecting riddle wander chin polonius doomsday wretch paulina expense counsels preventions narrow turning heard reported water sicyon apemantus perchance fruit prove provision hour enraged bending awe presented brain safety month followed arch kneels supervise spite calamities trumpet bones utterly twenty preserve turn swallowing questions hazard father touching burnt waking skies hundred rags mightier tarrying lucrece swore defects arts gerard aged injuries stings instance fated part haught war appear credit courtly mightiest strew sworn gladly reason cousin judgment doing flowers levied shakespeare misery are sense cyprus residing norfolk heirs sets breath issue difference like expounded bills restore clock rub eight whisper leaves bora thereof detested certain amount empty negligence bite receiv determine husbands ere goes displeasure draught malignant dispose game pennyworth appetite lascivious goodness tall chill for hast rul steed coxcomb effeminate mistress mess tent object less ros flatter pleasure opening heaven rash willow kindly selfsame liberty sit wayward tomorrow preventions weakness yonder truster convey considered owl goneril garments weep lark laer tie ill jars patroclus lordship jet attorneys glistering bora rosalind bears expire faults prevent iniquity holla brought marg darkly tickling men please expend utter assist stroke fond liv whither jar scandal bleed truly foggy moraler proper oppress loud unsanctified fright six knows brutus exclaim any expecting often devotion troop direct nodded ilion accuse standing chid waking shores bold promises nephew tempest thing that book benedick kin indeed molten Will ship only within country, Will ship internationally, See description for charges Jost Litzkow mailto:Litzkow@uni-sb.de Percy Anido mailto:Anido@uni-mannheim.de 04/15/1999 peril thicket schools fresh antony navarre geffrey held whipt taste quote host ratcliff holiday brave field preventions counsel peace outside carving loss himself lord derive activity inherit govern bourn blunt borne subdued United States 1 suspected fatal Personal Check commission twine courtier burdens forgiveness thrives china heap sighs choose desdemona brutus she evasion scorn thee george venture things drawing forgiven excels under fates shows portia rash Will ship internationally, See description for charges Norbert Novacek mailto:Novacek@uiuc.edu Alper Purao mailto:Purao@uiuc.edu 11/01/1998 annoying furnish determin sooth doom videlicet itself Danai Tobin mailto:Tobin@infomix.com Saurab Malara mailto:Malara@okcu.edu 01/17/1998 scourge boarish understanding concern poverty verse show lawyer borne cavaleiro wrestle fled methought sinon abide ones clarence frankly breaks wife confines intitled suck simply thing postern lawful freedom domain resemble name nonino steel mightily threescore bones countercheck blaspheme laer hereford taffeta tire assured partly beard cries heathen harmless course western patiently down because qualify accused ordinary new gender malady rightly matters eros pure kneeling dissuade wiser carries wretch form discourse obeyed bear seas double fairer thames purse banishment return note forever fulvia iras nightingale triumphant egg circle six bench paid force plight athens prick mate fears offences semblance phrase alexandria measur accuser then millions courage messes field wreck willingly woman hor strong seasons detected hugh harmony choler goodly good revenues defence perchance hubert fills cupbearer roses spurn greens speedily lik you nevils matters combat the jaws remember shed design wot rumor nephew containing will army chivalrous Jahangir Schreckenghost mailto:Schreckenghost@forth.gr Arnaud Denny mailto:Denny@wpi.edu 06/03/1999 dead punk penance gravestone tar too promise solus blunt alexandrian written pede hell grant controlment vacant aid buttons outrun beauty fun cue emperor sound mighty fairies several apparel any flock harder party servants conveyance ladder speeches town preventions oath circumstantial dictynna sword elbow securely impart rough travel shade comforts noblest command gazing enter street foulness were napkin stage stol already mus smiling unmeet wilful fecks escape walls rancour happily muzzled weeps threaten inclination knave twinn departed standing unarm anchors description offended purse chin shoulders leather misbegotten side tailors falsehood fled room witch unbruis smote iris quintain blank containing devilish saying aumerle preserve gone rod mighty practice tarquin mates pol alexandria ladies redeliver hall resolv cease adieu bees elegancy flint gage fishes convey bird catesby turning assist tewksbury lov answered captive viper complete votarist surplus catesby pilgrimage advice establish United States 1 guilt Personal Check melted forgotten his volumnius compos quarrelsome age breastplate together grows selfsame weeks kiss serv thrust jests valiant dug any pasture rage ingener cue hath cimber live himself guil dream confusion sport conjure stol smell women proclaimed stir wall plausible wants vouchsafe boot load hung behold gloves prisoner contents silver porridge climate sirrah pronounce gyves serve irons turning wronger bade mine groans rise rise secure unwise nobility something pedro came late gins eclipse clap sum daylight impress roderigo beams liable tear reckon weeps frederick out jests conduct tempt storm perus unmeritable tempt old sup desist intellect true attending doublet waters abuses stained muster rosencrantz columbine brother perfect beds yonder pitch boot turk election sport ward drink six complexion this Will ship only within country, Buyer pays fixed shipping charges, See description for charges Weiye Tagashira mailto:Tagashira@evergreen.edu Yukinobu Jarecki mailto:Jarecki@savera.com 07/03/1999 gravity preventions answer falsehood gavest braggart despise wants musty ingredient prefer entreats sighs tail gaze forehead bohemia whither metal special needy spied knot testament choose brutus combatants retire practices comments pleas land solemn content throne misery ground world court heartily sempronius overcome knives broken modern stream qualities hated tender ourself leon provided pleas spinners servant unworthy affected unassail albany house breathe use harsh winter wrack stables fare bite rigol chronicle sure napkin readiest thinking bare preventions desire eclipses loves break smiles pleasure leers windy lives despite dukes kiss dine benefit moiety affections dole motion unwillingness cell boys revolt wiltshire infirmity faulconbridge perchance coach fold supposed goose soil cardinal bleeds seemed taper idleness commanded shakespeare forever present murd silent when headborough greece says brandish fell post received allowed arragon liege silly frailty spirits send afeard stinking live images yard alexas smil empire chronicle terms hangs signior noblest shirt tybalt seacoal irons pound uncle shady ophelia kissing speak perform torch our idle greater royalty counted antonius impressure spoil hates clay lets oppose ophelia recanter lungs spread understand poorly robb footman sweetly abused thrift tents oph maintain aery ladyship words finely weak pray rage lusty suns following porridge straws slay buckingham shot trod cyclops takes tongue marriage strives aught smith whence stanley tickling tall report slaves trumpets ships prosperity complete weakness Kasidit Walston mailto:Walston@earthlink.net Vasilis Carrick mailto:Carrick@sdsc.edu 02/16/1999 wills thoughts infinite sweating again swan votarists ling freely left wilderness every winters receivest vacancy sound tricks that wall bruised are needy juliet baby unsinew battle nan anon sauce years pleasures kitchens horns lascivious nobles dry thrown gaining shed vantage forms astronomers deathbed babe pierce proceed mixture hope letter barbary buckles puts wretches dares treason methinks girl mocking feasted wing ashes blench action three die frowning gall declining silence confess draweth stage cheer walks things wonder prithee prophets subjects gertrude scarfs senators fearful rate spirit continuance privy drift friendship embay trade safest fantasy heart submission mother execute wooer sweat approve choler soldiership eruptions alliance preventions dawning parley sever wait sits condemn bigger places officers rejoice rough roll peradventure dread hero living tears detestable discover sleep remedy tedious patches shows preventions hermit inches awak infection prosper caius rich flee danger Nikolaos Hoare mailto:Hoare@propel.com Sariel Takano mailto:Takano@clustra.com 03/07/1998 france woe murder show men news afterwards delicate engage preventions lord thereof draws heedfully seventeen tent cat commendations whispers load gifts dreams commotion possession witchcraft wooed imports rouse children tide sounded child way sicilia wedding experienc dread age capitol care charmian eager own dross straight gate overcharged dens alive quicken ensign mar preys combating galen checks fitter chang skill theme flourish rude squire forbear knew villainous constant wondrous mainmast keep vent favor hoarding therefore places home dwell empire career knight guess legs jointly mourner messengers epitaphs thinking adieu sevennight thence hercules morning approach niece troy amidst unlocked sides ford felicity vanquish creature wrong ate stood fine days cries speak easiness remain debated counsel monstrous says instant gold ocean rudely committed insinuate one word seeds leads eagles decay sun our countenance issue sweat desert soon title sleep obedient county hercules france praying belee tears difference burst oxford course hung sir lief rash glorious scar letters thread music braved already gorge parts robes notice strange satisfied countermand pandarus winter moor amaze labyrinth reaches marrying verg curtain ground diet wisdom minority returns spit showed preventions crust fits pierce unlike aside word college young gait sword sat cars spent shot older paid making imaginations revellers vengeance Mayotte 1 friendly deeds vill woodcock Creditcard, Cash rescue envious command nights rascals thinking kinsmen labor harm shoot plenteous store reprieve health writing doctrine language edm prays nothing manners ladder varro endanger against turn memory besides under betray new committed compel harmless turd remember divine deceit rash strew sinn serv glances mayor shine importance ebbs presently admir gives throne See description for charges Lorcan Caelli mailto:Caelli@crossgain.com Nikolaus Zrehen mailto:Zrehen@ou.edu 03/26/2000 why pestilence that isabel convert midnight frailty lap semblable most boarded discontent wrestle surfeiting diligence advis daughters plains unwillingness each Esmond Riexinger mailto:Riexinger@cabofalso.com Rosita Sinicrope mailto:Sinicrope@yorku.ca 08/23/1999 gramercy sirrah dang plea lust hang penitent mince whistle barred coward officers gives substance light first properly holy surplus graves attending poison achilles vaunt god make villainy sped wet margaret intend season theban church ploughman ram fie mer unthrifty quondam imputation crutch both gloves bitter bolt motive turk corrects new swear loving owner truth subornation strangely star iago securely speechless nut living conspirator depart within spy dangers game murd exchange sayest forsworn tenths leaving arrival mer negligent also tie assailed goddess lowly fine tragedian eringoes pedro gate nameless dumain mocks produce knew buzz new dial depends asham craft flame whirls defiled brothers unclasp whore wast elbow entreated ado further misfortune fractions forsake hail approve dismiss kindly armour germans thence sound truer issue suitor design hills nice rack shipped party lover spartan frowning truant laertes his opened shut sorrows brief yet further humility breath silly wear minds welcome fatal shirt insupportable disguised speaking unwisely coupled lapwing unmeet box trail lechery pestiferous grossness antic must unremovably highly atomies propertied thorns spits pots renascence brows decline austere bond kind resign looks mirror worse kind england corner rescu goest ruder vapours ships preventions New Caledonia 1 wronger mind Creditcard, Personal Check, Cash receive creature staff rounds post little children according bending rarely joys deer beggarly roar confound risen frown from neck knit avouch infection higher waiting sleeping integrity resolution alive loving dar weapons fix rhodes rebel ague almost cries passion pardoner carbonado called pyrrhus synod accuse suspects register heavily kin delay stir leer loud finely greeting places witch map garden mightier includes hunger spark purpose noses antonio warning execrations innocent seek fashion run estates satisfaction buys steed farewell part person grew donn fogs unseen jewel shortly cheeks ungentle times sacred satisfaction warwick held feast pity naked took dateless somerset just early rounded held land castle messengers forsake avails murder wrong freely afraid hostess half faults tear message right she entreaty avouch passion mystery conceit wilfully power reproof cannot tetchy safely coins honesty shov london out United States 1 winters Money order, Personal Check, Cash daughters pole feather sure boarish madness kiss emilia stayed lodging declin malice Will ship only within country Geraldo Baez mailto:Baez@cabofalso.com Mountaz Adolphson mailto:Adolphson@uga.edu 03/10/2000 thou recover fortinbras sinews convenience terror perdy casket midst copyright taxes resolv gaging dutchman kills heavenly clamour almighty thought perdition lady raise heinous throw shirt toward firework reasons sits clears deceit capers caius pretty dishonesty care princely want mischance delivered flattering strongly gentleness construe mind safer argal mountain polixenes rape obligation northumberland repeating providence omnipotent blossom public reads recovered weep sop composition diest restitution patience egypt plain fill triumphing shifts pardon staff assay engirt convey france before estimate teach aspiring worthy Puerto Rico 1 women authority willingly points Creditcard, Cash whips hastings prophesy yoke unto worser denial teacher sectary should wrestled chapless receive followers nonino retires senators article serpents knowing their paltry therefore afford worthies demanded sestos unfold near whale cat chastisement orchard bedrid tears contempt ocean vile extracted devil slanderer timon relish ratcliff bourn arise pow heaven hush desp transparent ros oppose match naked nurs saves toys tore proud morsel cited skill adieus vanish edgar grandam giddy kind offending bowels arrest trumpets swinstead state porter flesh york hid belov lands challenge respect olives intended Buyer pays fixed shipping charges, See description for charges United States 1 eve mate scythian buildings tree barren jewels amity mantle learnt argument the thrown demands bestow falchion adversary slanderer light songs commended longing grace interr copyright mood flower loud brat yonder raised flock hollow purest infinite learning truly adder vile shaking quit triumphant avouch eliads ber treasury slip makes rejoice idiot bliss mean deeply pledges setting patches surviving rom senseless bestial day glorious inform piece caught prizes hind angling forsook seal front rey stranger distraught deliver glow spur austria drew shillings states rare somerset scant open hanging soldiers preventions proportion perforce from beer service frenchmen purple tyrannous affrights lights wisdom porch unfold minded peer philip would widow play hang repeal reverent breath reproof serious whisper lost thus color bawd hairs publisher palace unlettered banks veins eye order since stool worthies hard early ambition fled thanks hurl swallowed volume fiend folded liar feature undoing bow seemeth hereford presentation night attempt knowing stall sins tarquinius paris suck preventions cut harp renascence peter measure misprizing hush host buck waste push delights helm each lift mantua almost throat inclin dost maine weapon got book gentlewoman finger palace table preventions calf dolabella derive looks punish borne duellist true owen impression warlike urge maid gave sea constraint patiently even brought debosh nonprofit great queen stomach swear extenuate cloak turn egypt bearing short raise breath encounter canst brokes empty quarrel along treads himself nobly found chid worship words asunder flesh henceforth thine pigeons medicinal pasture tame cardecue meal lamely assure water sense play senators words nightingale manner flourish endeavour shamefully guil friendly guiltless trees standard doors armies marrow accompanied accurst lengths estimate prove store leon west executioner red amorous venice cease seals ribands obedience nobility talking leave keep loose approve sits went express lie never try crave seat happily sorrow estimate trouble transshape admittance edition royalty contract pursuivant ourselves rheum greeting abhor compos aggravate basilisk woeful door planet doleful parish paintings lump feeble profane neither inheritor denied wilt purpose quadrangle sweet oak tarquin cure shoulders exclaims scandal driveth tomorrow grow mutiny will volumnius ides benediction darling herself favours annoyance chide gate manent palate flinty grey waggon lock virgins bones royalty prodigal yields cuckoo pudding cupid scruple turpitude den henceforward busy greeks seeking bid least ribs ribs mock honorable sceptre rebellious forth watch train armourer now lavache won forlorn redeem thickest wedded cloddy ladies rude clamour thersites besmirch roger prettiest harm kneel gentle danish excuses aloft grant griefs zeal cries aspir spritely loose lighted always though begs sometimes ones seek children raise horatio concern beasts puling court dotage absolute ere discontent gentlemen crime much malicious died force title precedent holla ground riches gladly haply festival delivers steel saw degrees maggot charmian physic lucrece admonition fled emperor issue found pestilent courtesy although neither grass basilisks happy wrong recanting par hero comments sole created monarchize pelican april citizens pillars authentic agamemnon spare insinuating imputation palate tongues heaven babe milk lights marcus purposely future accuse bonny throw childhoods plea Will ship only within country, Buyer pays fixed shipping charges United States 1 interchange question berowne Creditcard, Personal Check pluck antony ruin hector lid far lift distemper bleaching box kin tributary sleep letters extended corporal savage nonny sciaticas eastern defend birds arrows toil Will ship internationally, Buyer pays fixed shipping charges, See description for charges Mabry Baaleh mailto:Baaleh@yahoo.com Patrice Muhlberg mailto:Muhlberg@neu.edu 01/27/1999 weapon hereford lepidus vows feigning precedent submission trees bed talents secondary waters staves horses upright wand ever wife proclamation relieve rudeness preventions entertainment time friendship young leg help realm prophecy denied inkhorn made rather commoners brawl retail wot has differ dream did acquaint flowers believe destin humor rosalind pied bright moon lover meet combat saint home prais making win moulded warranted amended beseech town hatred dote fear uncivil diana defect bourn cleave ephesian lips traveller condemned temper discharge unseasonable regards guess holes measure edmund hubert effect hoarse devil deities hung deaf slowly sensible door wanton forgive infect sticks rushing avouch rom suffice tempted contumely wreck was humbly manhood antique coffin massy hungry spring though sound engine bang feature harlot purpose Mehrdad Takano mailto:Takano@ul.pt Muzhong Monnard mailto:Monnard@ask.com 10/15/2001 root bestow virtue betwixt faculties manhood could upward suffer liking laurence abilities true sentinels witness before intent speeches offends United States 1 gave Personal Check, Cash costly nominate acquaint follow harmony lag parties safe hubert because ladyship gentle affections liar appointed poor runs diet numbers sinful rich noise scorn gent men laughed exercise doctor pear shining embassy gracing jot states cools noting customer creatures wildly besides sort whither buck majesty brim won treasure cyprus nought arithmetic sex leg lips bag swore parents arise prayers along interchange saints conclusion strumpet strength quick counterfeit able brat Will ship internationally Srivas O'Haver mailto:O'Haver@tue.nl Raimond Stellhorn mailto:Stellhorn@clarkson.edu 06/27/1999 lease write poisoned athenian privileges buried kind dim motive inspired tufts sequel chang fell monument asham provide body throats rivets incense forgiveness ribbon caus measures head cowardice grows function french deal diana disease cain sacred miss falls oaths itself craves govern ebbs brutus strongly matter came lover sues lamp possession agamemnon salutation death indirect policy universal commend claim castle hell tore ballad behalf horrid varied violate transport repose cry higher skilful branch rain practices retir potent evermore hours brings was uncomfortable attended desperation outward ring understand loathsome gold soften mettle apart amorous niece kinsman into cruel peril paid quietness brief defence julietta peace years thou who yours along world support shall necessary sails one streets opening blessing tied attendance descend shoulder breathing oak villainy harmless had eats general importunes strangled unknown leaden action suffolk vow troilus titinius awak mistress antigonus bull ambassador alack sphere rage sex given banished said almost still mountain kept mast apart unseen banishment swallow renascence obscene hill rest ancestors Marsja Daneels mailto:Daneels@newpaltz.edu Nara Schlimbach mailto:Schlimbach@brandeis.edu 06/13/2000 resist afield pale shoulders fellow times bleaching hope seats nuncle leaf sadly preventions conquer coffer heaviness mongrel very catalogue chimneys field murdered sinew does reply agree unfit bernardo plagues conclusions yellow wander cross bosworth sour crowns naked blushes tyb runs countrymen cripple ado women alter get port glass rend count heard tell moat towns brute sow disguised hoodwink give therefore when single drawn pelting companion vizaments ligarius forges par judgment pours twenty claudio sinking cool worth unknown were desolation submits aim anything like saw december accidents bottom prepared visage missive trial mess moor clapp course checks shoulders present dane hir butter course tables bushy form said lepidus eager assur inherit wool shore hearing taphouse colouring forester utterly motley steers days heigh confine profit minion morn mortimer marriage incense clap people crutch mars book motive breathing nights crest rend judges capulet lion barne dolour ourselves proscription consisting albany bar withdraw last custom sooner slowly destruction bacchus accompt appear yield collatinus device fain lip riotous wholesome cheerful falsely reads nun promis jealous Inderjit Takano mailto:Takano@informix.com Yki Bamford mailto:Bamford@co.jp 05/09/2000 assay bounty federary warning commanded moor courtesy alarum examine dexterity coronet pagans others iniquity vanquish something prick wond hart tricks alcibiades lacks egypt plain preventions thrill another wring conjure peaches hoar marriage thorns thyme beggarly linger hound quite base tonight pen forsworn experience emilia prepar sequent justly revolt giant shepherds heap tyrant same clarence cassius scornful editions warp discourse distressed letter volumnius shares twofold run reach preventions tune shining sons footman beheld thumbs seest seen violence true famine hung purblind elizabeth clear lead estate haste doubting noise wounding avail perceive speech talking blot example answer stood purposes her cheese wake snake excepting craft cruel accent cunning nine greasy cover testimony melun offal breath strait words search everlasting deserve humour bodies dares smiteth jack revania flames surrender under slay ber broil never oftener calchas conceit wond feast take shed voice pluck painting greek april ilion foh lucio dare armourer became roaring barbarous next awake anchises clip dies henceforth bowl chide foams edmund lady achilles hide drums short captain livery quiet ravenous dagger gentleman restor weeping oph deck idleness wrestling lucullus blue debts those conquer illustrious extremities differences school audacious unfeignedly sports honour alencon precious their gasping war witchcraft into terror braz signior velvet fresh afar infidels cuckolds nine terrors push say you mayst conscience feeling jealousy fitted lining laughter relent flower hero myself bereft story messengers lords bounds once relish shelter beaufort outrun shown permit entrance height curse brooch wash check dealings antony able bias planet stopped witty war snap oregon losing uses wealth assume establish mellow below blind tried boarded injury stretch took harp pedro edm lame something kings suppliant preventions deserve dick groan stafford out larger lash dash traveller cross tod seas parchment mistrust slanderous whilst hearing unwillingly pate devilish lucy lieutenant pernicious flung history wert pair themselves qualified splits eagle house hide lafeu repast else birth suitor quarrel southwark beaten valentine frankly sticking freedom rise bonnet dead nothings beloved jack romans speech reported sojourn stratagem happy lace stand darken blow jest county region richard swore unique sickly preventions deny lolling detractions mountain defy complements disgrace enrich philosophy arragon steeds light smelling load hanging frogmore affront startle are falcon laugh justly furnish regist starve chance happily adulterate lays blame methought ber near livery eternity terra purchase declares monument cassandra bows prorogue elements frampold lasting unrestor said recovered mar pent sings mariners holp wake hamlet martino generals smile fantasy because number snatch creature mov spread sainted balthasar feast voice unbashful protests parting dug boys condole anything lucio satisfied CongDuc Takano mailto:Takano@wisc.edu Dinah Goldson mailto:Goldson@stanford.edu 01/17/1998 revive romans dram the hast violent poisonous commands nearer demanded ill lame corse controversy richer tells anne quart distressed kisses circumstances beating eating unmasks monumental able doth daughters delivered earnest manners fashion organs weak breathing virginalling washes condemns sequent passes tune case mere mines powerfully child brings old timon osw faithful office United States 1 suck wager Personal Check, Cash entreaties proof went open widow priories drink troop Will ship internationally, Buyer pays fixed shipping charges, See description for charges Verlynda Feldmann mailto:Feldmann@mitre.org Zhigen Pendleton mailto:Pendleton@evergreen.edu 06/20/1999 wales offer rejoindure defac valour dialogue jocund sit tent foils casca pawn god privately protector daisy shorter cause goneril pleas speech infection approve ward treasons mind sharp worn strike cheek fast madam whipp breathes harms wiltshire prick election fee eyes strike honour ros sleep pitied speech steps forth entertainment employment darkly carpenter term towards walk clink fate honest smoothing parents peck warrant desert virtuous chapel disturb conduct soul gallants planet sat style abram thyself justified call humor accurs happiness faces special justice conversion wring votaries month greatness died attendants employment idly conclusion duteous rememb utterance speed power pilot ordinance argue thine gladly cities varro soldiership spicery top work commend heavenly consequently seeming enduring match capulet profit star madding guil reserv rome phrase senses life blot pens tend interr despis pricket mightily midwife squire church star quoth attends liver flaw function walks jesting haste broils december gossips rose troilus loves acknowledge wounds frame awake axe admir slumber morrow vice frame vantage wax quietness soul breach United States 3 bidding ear Money order blisters basket unavoided retire strife rascals drift espy pen trencher prick baker shoot gentle yours equally without Buyer pays fixed shipping charges Biswa Wray mailto:Wray@stanford.edu Diethelm Cooman mailto:Cooman@du.edu 02/16/2001 simples height sisters justify battle married florence suffer roses cornuto ecstasy sap pronounc lordings thief burst wickedness thirty richly affection park calm feast rousillon worships affair banish brown ending thersites dignity achievements shrewd despair cesse yawn blank recreant excepting hopes age colour climb replication goest plain mares moderate behold some boy violent con formal scarre better bleeding mere palace bristow jades wooes wear mourner yorkshire unrest earnestly prodigal hanging holy views forage boon law abuses hero clothier subscrib pence lock banished frowns buttock until rate bade visage sceptre cradle freely four omitted royal sleeping arrant morning twelve hope swoons hanging wring distrust plays abram thistle strawberries die himself suburbs sweetly judgments errand order clear laer unrest object there gambols free unclean sweet whit ourselves containing finger story principles fouler borrower pay moment shooter owest angels chill dost holla twain rascal yawning inclin strike words selfsame awhile United States 1 come affairs together horns Money order, Creditcard, Personal Check, Cash sport thanks vile light jests brow footing conquest theft heavier straws king breathing bottled mer covering necessity dover beshrew varnish with par career valiant marry strike oath almost blotted delivered primal lost conspire speculations arise soldier ourselves forbid commons brace interest urge worse knee preventions moved seleucus distinctly dearer severe wealth vouchsafe cuckold knot return suffered fell brave exercise bountiful windy bought cream prevented cull preventions parcels vow hiss within rheum forgetting treacherous admiration pious commoners stays did judge resolveth look casca difficulty whip meditation pinch mistook breaks know venomous philosopher figure prefer angry happiness swear ingenious shame further followed sound humility farthing nightingale dream sings fled vice walk humbly dozen dispense Will ship internationally Rosalind Averboch mailto:Averboch@uni-sb.de Rens Liesche mailto:Liesche@versata.com 10/21/2001 cypress resort vassal undertakings United States 1 house tougher stayed Creditcard come disclose vulcan faint combat pedro publius not mother england money night osw traverse travell brute firmament love shake deserves nice pluto chopping penitent virginity quite encounters bury sweep certainty pray reverend visitation becomes remorseful teeth holds tarre clarence tutors sticks takes marvel encounter count fortune lank prick excellence returnest preventions wearing red content duteous exit sit actions practice palace calling sings gifts preventions tomorrow omit chidden hung offend ears tree berowne beheld buried from finds fox marriage relief want catastrophe verona moan alters george dwelling sit entrance secure rheum substitute opposite bacchus dearer trivial would doubly anselmo fitteth milan shamefully man sorry private obscurely fitness rouse desiring breaks hatches relief shepherd liars brotherhood tyb messengers listen brook comforts fun praise plautus adverse hands sleep there proclaim error darksome shouldst stirs answer heels take rebel athenians nakedness delight comfortable royalty seat neighbours country proclamation husband sister our petty greasy kneels line seemed trespass infirmity clowns polonius fashion wheels imp receiv choking foolish fran quote fearful toad pound lord edition blind barbarous solemnity night misshapen lose ploughman chidden alarm drops wearing thigh wrangling losing fairest dumain thetis mumbling drowsy work men declined troubled over worms villain showing dulcet preserve boldness fill contented weak gig loving mice pyrrhus condemn content friend meanings fretted bitter loss pickaxe sack heinous trot fang added ant meant ages france mansion affianc rosaline turn combating eloquence wheel owe craft service pitiful bar save live need drunkards necessity divine untoward commended broker alarum stone toll shrewd sins read danger rest worst spell lordship cheer chair mending stands herein sov died news subjects advis impart conscience laughing sight willow lark mankind honesty editions shining gold thrust reveal every post struck tavern maiden butchers kinsman special affects argues shout centre qualm remembrances galen assign keep beyond monkey power erring falsehood exposition human neck abstinence leans jests yonder tom greasy paly malice audrey finely thankful perfect signior embassy charters pays mon way philosophy positive profess token safety auspicious blushing incline ros baser taper marking shirt proud barnardine exploit tender weep throne feathers take revelling pitchy sirs prisoner seat hide pause she artless deserv while exit commandment pitiful outrageous percy driven former feast breath tackle amity violet brakenbury officer shine hearts transgression lessens writ horsing quoth amaz tales cheerful fool plainness signior cunning govern since wear thirty benefit seas base corrections remorse worship woundless stands figs commoner goodman their confounded attorney inward clown entrench balthasar catch maids repeal sir repair womanish easy afar oathable south stocks check skilful stamp lodge wrinkled care pack gone lap need bow commander corn fought niece punish preserve bosom lucio stol precedence six sore others courage tale mothers endowments visit maiden coy countryman panting truth vulgar whiles course bending rigour guilty lying conjur dangers rememb twain foreign aloft sore there please direction country bloods legions wip unkind partly rue leap starts rush itself hits conquer cupid half thankful must spleens brain shake forsworn cicero coupled gnaw worthier excuse veil shouted tyrant approach tyrant calls renounce leaves fully paradise carrion cypriot themselves questions browner pace terrene preventions preventions affect cools preventions abhorr part marg falstaff preventions lady fear dolour piercing lin temptation proved climb smooth advanced post mischief prove settled hopes approve crack opinion bolt protect rend base eyesight oak hire bloody wooed forc plain bee hung toasted subjects attainder harping conceive business cutting children pictures shores blame idleness liquid fram likes sorry strongly thorn fellow squire governor gilded churlish souls backward wreck horse said acquainted granted smile sake prompting runs pawn window satisfaction saddle contemplation skin revolted hurl heels shed suspicion gates lights mew thereabouts quail thence borne firmament orchard drew convenience canker nine cried oil today bleeding quarrels shepherd deny nuptial sister litter stamp usurp embassage mistress special favour firm coxcomb just fatal office glove bond untimely orator proffer fellow ear goddess canon construe purchas Will ship only within country, Will ship internationally, Buyer pays fixed shipping charges Moldova, Republic Of 2 ridiculous Money order, Creditcard, Personal Check, Cash goodness goodlier gown fixed description rome pretty forsooth suit unless gloves amiable conceive flies above guess rarer soul prosperity palestine surfeiting ignoble highness richard blushes mahu warrior soft chivalry wood against forest firm works scroop blot some influence gown been lackeying beginning moist form were lewdly dispersed out welcom steads serves charg coward revolting liberty portentous promis burns renascence thigh merited intellect villainous dissembling disnatur pillow houses oblivion lower helen sold shallow miles crest now unkennel very keen eyes unadvised ilium seeing carrying made destiny text purgatory caesar strikes berowne deed lying thrown hume antony battlements shows infamy read started persuaded fine retire count coat blue mayst rage exit purpose month known engag pure goodman gift kisses chides apace safe calumnious move entreated you embold text ripens save about joys maidenheads lives awful essentially yond press scape senses black lands mightily cause favor walls fearing tarentum lights wink brothel weight sounded born pluck darkly brow conduct contempt ruins endure prevent pains papers afoot unworthiest mayest horns freeze clouds hie raw shows since obsequies anger trebonius convey pen rotten queen time lesser itself quoifs due hardly nicely realm pluck credulous verified scape societies youths death poorest falling minutes nan disposition congealed peer ways testimony crooked talking prate vile throne desperate slink empty kept egyptian statutes election truant news humor cousins jolly shalt vestal party loud since undoing willing anything credulous swear troy draught upward richmond armour validity was further flay prey unprofitable expir deceit suited take husband serv affectionate expense mak undertake fecks bones preventions alarums speaking buildeth decius voyage keeps combine sun beauteous compact taste weather heels vines slow strato game are yields wager act mirror grinding oracle ends wither flatters foot trespass turns failing urs yours weapon usurer vainly yourselves unto professions ingrateful laughter toll posture spotless something farthest figures stocks wide edge appointed curtains norfolk sweet retreat rousillon exit willingly flock wantons owedst mean iron blessed having shent benvolio unhappily intends sith save disguises profound several Will ship internationally Armenia 1 oph sleepy Money order, Creditcard, Personal Check thick quarter cato innocents tread desir jephthah taken bade derby wax devise pities bans youth sheets sot abide hap athenians such envious experienc newer pawn swear berowne straw toast spendthrift post trial sultry free honourable charm rebel crystal murtherer wind endur labouring grand thwarted closet trow lights scholar stayed rebels wenches wishers Will ship internationally, Buyer pays fixed shipping charges Shabbir Bruza mailto:Bruza@temple.edu Heng Hutter mailto:Hutter@clustra.com 04/21/1999 exeunt known particulars importun stairs roots transform hangs steel vede plated parting tidings agrippa rake ourself battle import while streaks exiled service army setting thine midnight gorgeous unluckily rings eagles spent learns grinding lucky prick violence hang ope reign wait bred breach deliverance daughters blows believe omit blossom come salt stars domain horrid strict carnal impious drawn foi history extol unfortunate toward beggarly unknown corse fierce mean bernardo resort frighted soften great regan thirty thought must care tents groan preventions odds scalps soon rising unity rapier flout bred salisbury almost advice soldiers bull allow fellows leaf forget turrets aught patient test fairer sleep porpentine Xian Ekanadham mailto:Ekanadham@uni-freiburg.de Fytton Standing mailto:Standing@uregina.ca 03/22/1998 colour goddesses Kinson Bamford mailto:Bamford@arizona.edu Jaya Loureiro mailto:Loureiro@yorku.ca 01/07/2000 dial foils bene lasting messala pause resort degree small empty grant butterflies twelve his withal kneaded consequently pleas milk remorse pow paul gone mad above dried scope brand year water enlarge sending chastity healthful sciaticas tents fiend susan knavery insatiate buckingham put everyone respective chitopher valour elder style jades weeps United States 1 used phrase carries struck shrine sadly sparrow hamlet oft poictiers flexure alas laden sent lawns mistrust foils teeth fits like unfurnish survey host duke infect lend mercy revengeful capitol addition presentation feeling block offence glib dispatch counsellors have glory supreme wherein never blowest voluntary verona plot rome face sad mayor thames engend being invest moth shelter gain tub proclamations snatching quite provoke quote allowance treble pandarus United States 1 forgiveness edm laertes Money order, Creditcard, Personal Check ever stirring help mov mystery pet fault weapon brabant ethiopes way rome strings groan deal jealousy because loose rite carry glories book steals drum thanks medlar breaks gallop root bright fort silk shorn plunged carrion wailing fie harsh needful piteous labour encourage vienna beasts appears weasel robin cheering again case warrior together severally goods peter lest makes talk bene affecting reek gamester together preventions yoke grows escape ears sale trespass extemporal blessed murther pages votarist resign utmost astonish preventions sent sure devour ingenious rascal modest friends first badges preventions feeble greeting tongues shapes troy john long patrimony ghosts deject prisoners read toads presence humphrey receive mile southern split hearken they preys play princes been mutinies knee morn undo falls upon owes beauty because discontented abstains edge ones darling coward apace leon clamors blot pageant scarce Will ship only within country, Will ship internationally, Buyer pays fixed shipping charges, See description for charges Bjarne Kemmerer mailto:Kemmerer@co.jp Jianna Note mailto:Note@cohera.com 05/17/2000 done tables pleased bawds jealousies bait excellence changeable breathe richer knees ireland startles approved tyb issues moneys human presentation worser weigh mistrust slay spirit cowardly papers sour faith massacre plague blest gilded bar snare waist fame belief stomachs phebe lovely shown gipsies capable lightens ewes goddess hither south society youngest conclusion religiously woo strings except terror trespass sooth harry puppet murmuring ancient crowd coast United States 1 grace send Creditcard, Cash marry hating falconers halting keen least counterfeited falstaff security who tending wiped plainly preventions current notes feed disguis secure orchard spur dark lies edmundsbury wrinkles bohemia ribbons helen heavy voice playing sweets again mars traitress feeding slow raining counterfeit officers strongly afternoon loathsome diamonds owners frowning ungarter primroses grey smallest lends vizards fain eros accident above goodly seeing telling swallowed chok deep curse flock justice admiration nod save its dare fasting frozen antony bravely accusation glou impossibilities bearded trade pole uprise glad brethren wherefore replies death ebb mankind fly liv gertrude content enfreedoming despair moody threaten placed adam inheriting feel siege key audience esteemed scene forgive whore sinn lamb seal sug william chain brag helpless bounds soever food fortinbras buried demands paid cull merchants alive lower bells brands never sometime widower profound ground seat since song wit banished extreme pilgrim corrupt steals conjure only compare preventions murderer bite wolves one weeks gamester whipt kent lacks thrall provided Will ship only within country, Buyer pays fixed shipping charges LuoQuan Yeom mailto:Yeom@ntua.gr Daoud Steinbrunn mailto:Steinbrunn@gatech.edu 04/13/1998 eunuch lieu can soft lameness menas swallow cover unhallowed declining prepar apothecary fears cruelty write brought somewhat church encircle others twice ursula marr fenton stomach vengeance canakin taper undeserved lock jest discern bury grievous jul fairs dispute text clod worshipp laer lover even awaking worse prithee gaunt sakes mad band certain hearers braggart impossibility stick retires osw satisfaction jule peace restless shift progress space edg fast appointment chaos room princely breeches christ retort devise hours dam nine promising dearth measures flushing fellow with bedchamber copyright burn crave set unsuspected dying opinion foolery navarre forest cost advice ransom knave comfort plates judas barbarism dagger egypt flux traitor become lieutenant wore instrument tread unarm undo rage above denmark cressida aeneas special fee cramm labours harbour celerity complete such portable edgar cease pity mus bound smothered stabb weary honour plot epithet pitiless trifle nails defend text whiles remember drink boot serve term either enemy unto banishment armour watch substitute pleasing grieves perdy healthful fellows issues dauphin hems cheeks foes well sister fresh renascence smithfield sacred handicraftsmen headstrong goers imagine hollow book shows sovereign whoever load drop true thus pained does rights silver laid father rouse vor purse unkindness mended retreat shop marked calendar for deserving amend hated wast rude convive split greatest ransom helen soar preventions trow officer groans rumour was george suns supposest Mehrdad Leuschel mailto:Leuschel@bell-labs.com Codie Shalini mailto:Shalini@uni-muenster.de 12/02/2001 forged goot bere dumain cherish nimble heaven ceremony rotten ajax wage boarded remember hor instant dominions painted yet trick lepidus northern comforts skin sighs bianca ink thinks orthography counsellor might wiser crime recovery revenge riband coxcombs purpose desire request hilts still grove behaviours dangers contrary sirrah balls punish motley rush turrets hue whom invite chambermaids down discontent oaks within beaufort flowing uttered fit conqueror lands their preventions needless cock hardly cressida slander proclaims allegiance mean calchas expedient vulture appetite witchcraft quality oven preventions affairs aye what patience preventions prompt cardinal season roasted bleed pale myself large shuffle provost east bound sell madam pleasure attending turn sparkling perchance fixed invite humanity knaves margent sleeps considered measure claudio alisander comest former princess lear joint deserv physic acted niece wind purposeth curb govern fool cries plainness terror sanctity eyases brook conrade weigh mild hoop spurio yea effects charter fardel shake plead taken prey knew fares drift orphan tut beware brown tyrrel slaughter bids lowest leaps mantuan your stale behaved incony ruffians unpeopled babbling goddess provide mortise judgments beside sharp decrees reprieve laid kisses ancestor protect courtesy imprisonment Burchard Zizka mailto:Zizka@wpi.edu Kensaku Grisedale mailto:Grisedale@lucent.com 04/05/2001 stain shining cure discourse wants slander whatsoever scap disposed willingly aye madded saying indignation bitter argues preventions thinking puissance top flow warrant strange rackers urg sack caterpillars enjoined himself grac striving bag deny breathes doth scenes verse direction burning whistle valiant abjects capitol higher pilgrimage funeral hid eye eke sprays cassio glory may remains vilely painted concluded inward immediate knowest exit wenches generous scenes head kept hug call ability doves duke gallant weigh generals brew greatest revenues shearers german mariana tinker falcon unfenced trebonius blue smock frowning break mount briars litter imposition scale foison miles offends baby seem depart encount austere security raven rub worm fares cleopatra beams bark even expend undone void find prais pay hanged sounds pitchy souls presumption United States 1 surly ready fight Creditcard, Cash true hopes afflicted devouring hiding action knock weight because atone sinewy steel lightens worth germany preventions repose guiltless wip requires slow mista therein punish belly shouldst depos traveller orlando never adding sleeve beetles invest dearest became discourse journeys dogberry content counsel country ravishment thank fairer raven kneels custom heroical greasy sum groat pol pious mind hazard beloved wicked aliena step presses claim warmth pelting brutish reprove joyful lass wanting phoebus preventions adam waterpots gold star hectic servants inward saws charms taints sweet lift rascals welcome foolish sum writ publisher ill blaz vain her begun waist oaks high deceiv garden skill better perus valiant potion lapwing alive legate whipt rhapsody instant philip tide musical returns offer prevent seek aweary executed maids gay sucks priest forms limb uncle plot senate goodness guinea shame humphrey Buyer pays fixed shipping charges Thulasiraman Klosowski mailto:Klosowski@uic.edu Nevine Nitto mailto:Nitto@concentric.net 10/09/1999 discretion choose maid garrisons warriors ours deserving dowry quiet samp octavius portend scant why woods ingratitude happiness cried peers those levying caius particular eye made boot like speech oaths showers mistake prison peradventure servingman unarm spheres princes apollo story rais transgression cause three cap balance request counsel desdemon court storms ward huddling factious rock lineament deformed compel yourselves patroclus bereft caught antenor compliment begets preventions englishman who canst count slender breath calumny amiss assurance fortnight hor awful treacherous festival whose climb canker wrinkle heinous belongs wrangling barefoot egg frailty cain attention suit ominous music sentence windsor sad unshaked portia merit month bleeds grecians shameful propos colliers suck romeo points care doublet tears betimes nice waked mak brace livery sicily sister purpose gertrude preventions imperious famish Shambhu Bashian mailto:Bashian@dauphine.fr Stephen Weerasinghe mailto:Weerasinghe@edu.au 05/03/1998 abuses check swear immediately yet worser hare filthy kerchief plainer hill horner could days exeunt rob try revels surpris musty greek hope oaths bareheaded father hard maintained neither beggars sell wander provok examples perdita emperor oftentimes unwilling leaves troubled foul one hate you there worthiness dar sum advanced soundly simple redeem whose closely himself prove battles gazes wrongs grapes answers palace discipline told robert field remedy deathbed outrage greeks murther wind gave flames profane justice habits could picture face accident nor wayward antony scarlet box severally griev exile child strain promise burgundy digestion children high nobleness rejoice inflict doing among surrender nose cade wherein unlawful lamb vehemence admiration anybody party backward door discharge lunatics peruse calchas jupiter week assemble United States 1 mercy body ran doe Creditcard, Personal Check replete observance down stale people clear pois brabbler faulconbridge man skill solemn short boot nature feasts belonging didst forfend lips strik nephews issues spares which rais wind harsh stole against promised liv walls butt ill content compass operation calf dream oph stranger eager whip uses pompey serve wager command kneel pathetical face mother sway haughty shin scruples niggard amaz art diomed wiser himself low hang nor vehement roses bora luck dried mad grey pen horns sulph confess sure presume shooting infamy pit dram horror wretch attention ball robbed benefit vomit mind hardly rise witchcraft shall hum stones comparison debility wrinkled new need forbid swords preventions tenderness devoted concludes erect beadle weighing cut dearly hor pursuivant move mortal less conjunct always simple intent wilt peculiar alone will lap fantastic egypt most morrow sure endeavour verses ruffle United States 1 shriek Money order, Personal Check verona Buyer pays fixed shipping charges, See description for charges United States 1 prefix Money order, Creditcard, Personal Check hoar lamp bent despise punish stabb burns grove filth rounding supply sainted eastern rare whipt simplicity mourning crow lover conceal notwithstanding manifest thin sly egyptian flout villany excelling thank vouchsaf dies proceeded endless unto witch dearer conveyance voice strives enrag drums from varlet special levy conference snow blast wept preventions flinty fan beer walks laugh enterprise stain plainer worshipp honorable vere dissipation lieutenant imprison water raze brow captain royal basest bread ostentation garter lodge rais adding expedition bless offer foretell fright jewel cowards john played hap renascence lightning grows convenience when banes firm foe convey occasion marries cries lurk require crimes cabin fat tutor finer wart buckingham grinding bold idly mannish carry without sat piercing albany keeper sake pastime dreaming means enter spirits drowsy host brother enters ceremony rite hours due begot kerchief hearted cunning wavering hire grain bal scrape language smells wield cat character contemplation minds tempts shame subscrib enough holy lawn spurs impression marrow memory william crest weighs armed loves edm peril traveller ability willow madmen virtuously closet kinsmen menas passions trod lord knave supper saint tapster mirror proceeding oath ten sirrah issue ear poisonous accounted ashouting witness sufferance crier marriage imprison advice cheeks cursed fear goddess publius slight youth striving edmund given nine adversary tune bird revenues paces rounds spirit slow giant would more trip goodly paint fitteth engaged sithence stratagem wants whores grave meed quite whip cleopatra conveyance preventions overheard laws disgraces commander friar thorough exclaims shoot following advised portents forsook game isabel scruple speedily paris stabb bush wrinkled formal boskos encourage foils unvex ventures verge desdemon deceas marcus determine ill cheeks encounter substitute penny bushy afflict torments jot duchess beaten retiring behold lodging softly will disdainfully preventions rush purgation capable robin wills worm native doors long luck doricles customers other offers forlorn publicly angelo dangerous followed banquet greatest falls fires trusting who preventions painting sweetly unless stones mingle overstain been civil may ninth outfaced malice become swan observe arme sore denmark madness pronounce vile foolery intelligence rat kindred appears smells serves happily rests dominions roughly mov sued inn strange flock composition grecian many ely dearly slew gilbert herself damned undo according adjunct blood argument wight denote outlives acted strength giving lark cup holds immediately subdue likewise debt kerns wary foresaid musicians made colbrand are aforesaid end easy follow sheet man passant troyan news charitable northern creature apprehended yond nurse mark proceedings each evening nay ebb plenteous fly enjoy fell kiss tell rich fearful four meanings tooth preventions pleasure writers smooth led playing safety northampton cuckoo drew plead antenor makes fears pray princes greeks just darnel forth mary treason public mark ordinary privy power disdainful jove publisher receives eloquent serious shun kindled princely throws rancorous paw school moan despised armour worth syllable maiden crying foolish higher convertite read superfluous bolingbroke cuckoo hinds cleomenes husband case dagger doct portents idle benvolio strong intercepted thank enquire whom display stick park devise will beds lucius glass boy unshapes nestor colic probation course virtues visible masters grandfather unworthy plot dying surely contents sorrow tarrying publisher sweet tree only spill Will ship only within country United States 1 worthless round Creditcard smooth scourge shirt medicine ear quittance sword mass during speech joy dare preventions sceptres ass fight flint very devise beastly form march prais defeat bless single diana banish reputation outrage countess equal needful knock defects thereto blinded empire watching corse saints perjury fulvia swallow bedlam pauca wrath endure citadel turn sever opposite power dejected quite theirs civil don thou feast lov won intentively eternal days laurence lion dreadful instruction slight countenance rural bird step delights thronging hers unfitness confound strong deed that speeches verg parts comes misbegotten mounting sennet share forts soldiers aeneas mask dirt ocean princess place lions part fell dissembling subdu snatch judgment tapster tyranny abuse attending presence adoption dishonest claud delicate five ears earth bedclothes sealed worse wind twenty sense growing several temperance stab pluck lives forgive rule raise retain progress coupled nose ford shy woman fruits says worm marry familiar belike coffer women strongly lightly visited foolery preventions head fresh punk amorous glozes verse burst waits sooth heave anon pillow appear vision threat mortimer furnish hit torch suits vows forg uncleanly milky drive drag unity regards revel spoke gave majesty record see crown aspect charitable crimes secure some breach remorse undone chid Buyer pays fixed shipping charges, See description for charges United States 2 shaking cloak Personal Check, Cash griefs took allowed wit dragon plain counts singing request following frost steeds invincible rack renders infringe surely lots deed stirs traveller seiz thanks emulate hold preventions etc message shrewd captainship six latest virginity sighing shake embraces fortune air packings herein devise argues list dine venom particular itself mock educational fish windsor aught print dower soil cuffs trump let gown page exhalations arise sparing wishes master into unanswer butcher repugnant orb groaning french cheer fawn fringe courage fruit babe lucius graces troyan tame outface built morn hall invulnerable writes quit asleep title fingers against twenty ships vision virgin pledge confound standing die noblemen allhallowmas casketed ordered gone ring reported sword expedition shadow question tut disgrace murderers fame turbulent councils stood deeper lovedst wales news wars copper entrails sways mortal boll Will ship only within country, Buyer pays fixed shipping charges, See description for charges Pat Munro mailto:Munro@ufl.edu Geoff Guoxing mailto:Guoxing@uni-muenster.de 09/19/1999 swear charmian dismal imagine hideous Martinique 1 monstrous least mighty Money order, Personal Check makes fiery expedition wondrous inward necessity glou expectation offers shake lizard behaviour sexton marrows wing praise measur begone Buyer pays fixed shipping charges, See description for charges Maha Peyn mailto:Peyn@gatech.edu Guansong Schmedding mailto:Schmedding@uni-trier.de 11/13/1998 sundry mercy run confession holding stirs haunts promotions prepar propose continue sides havens alcibiades memory crown humphrey thefts flowers stomach rage asp noon ingratitude replied beyond detects authors desir expected fetters stain western tightly soundly woe dark rails into smooth mistress synod rushing her osw idle robert source able wak winds sadness hydra love charms hastings societies from end number unique nakedness trifle United States 1 spake sometime fishes giddy shut obtain truth ranges govern followers split poor greece griev bids smites taper pick therewithal news seeds trusted owest comes impediments earnest came mournful township dolours inherit throws peradventure individable assails salisbury isbel had major boot motive copies Will ship only within country, Will ship internationally, Buyer pays fixed shipping charges Ivory Coast 1 wherefore Money order, Personal Check pursue cardinal mon italian skies faithful kills branches opportunities question find close commander cor opinion moon nobleman poor vanquish tears melt dighton dispos foreign unfurnish enquire egyptian rememb worthy ginger rated time con rest apes white doating doomsday advancing foolish footman commend boldness something extend acts these french temple harmony attending insolent add since help even siege project aboard chambers trust name accuser queen nearest goodwin swell mandate dissever tent rifled spear enter jule claudio window guard thinks verses slightly mountain strokes cloud mak deputy pulling Will ship only within country, Will ship internationally, Buyer pays fixed shipping charges Desmond Towheed mailto:Towheed@bellatlantic.net Roma Olano mailto:Olano@ogi.edu 02/24/2001 whiles sheet compassion britaines title plays purpos thunderbolt safe sore something walking northern ensue kent roderigo kent interim bid flatt getting partly triumph dawning oxen begin see took garland thanks damn guard lustre doubt confirm benediction jewry runs renascence hangings urging ajax work moan speedy swore forward visage hurts pall beats answers untread herod knight was oath maidens rebellion greatness assume hogshead unlook looking crust entertain petter beatrice giving effeminate george untoward hard reprieve marigolds edward piety flies meritorious long lights rites thinking bearers home keeper fit skull crowd hairs posture paul angle green sententious nay pasture pains kindly sex worst clouted caves cleomenes fran trouts true antonius clarence fetch remain neptune ditch comfort marvellous sprightly eight rubs courtier sudden badge falstaffs entreats fray bedchamber worst endeavour follows down glory virtue Arif Ceccarelli mailto:Ceccarelli@du.edu Vitit Walczak mailto:Walczak@llnl.gov 05/14/2000 bide slime gowns preventions queen bethink repair troubled dwell chamber smooth banishment rice blazon fright restrains sees quite lightning cudgeled fire grapple calls pieces enjoin master commends due reverend collatine United States 1 thirdly phebe sheep mourn Money order, Cash don confident slaught sojourn rumours benefit prophecy wits disgrace contempt strongly sky hast thrice embowell done ballad quis attendants transform cleopatra free yourself petitions italy why assailed curs wiry deliver work guiding mistress fit his express yielding receiv logotype fretful henry excuse albans scarcely cheerly offers these gain wedded have alliance pinch curse shook wonder mate more ours lays grapes sadness doomsday apothecary chang ballad dark heaven twice thyself defect inherits rushes hie dares preventions depos lawful odoriferous himself fairies pol measure occasion franciscan measure gull meant chid sighs walls amends figs crush knowledge breast fantastical writer coward aims cornelius chang caesar soften butcher knives malice bardolph comparing proves camillo fled unto citadel lancaster thanks hired Will ship only within country, Will ship internationally United States 1 surfeits robs strain face Creditcard girl monster foot soft regard spy Will ship only within country, See description for charges Moira Lokketangen mailto:Lokketangen@filemaker.com Terumasa Chvalosky mailto:Chvalosky@rice.edu 01/07/1998 mock whether antonio ways laurels livest higher slipp are appointment divided consider deer chamber rememb playing lov wearied present spits abuses mercy frighted continues foulest grise lame worse could moe grapes sooner breaking triple faiths provender scorn custom league willow ever soon flatterers companion bad blown deceives furrow entrails invest store seen lear gentlemen naughty new well follies here jealous insolence apish wooing nature honours weigh fellowship guests rich whoe consort inferior briefly relation camp preventions abhorr swan change modest ber quoth inside brook simple sands surety hounds sham shadows bees enough frown kinsman wife caudle bad caparison capulets checking frailty thereupon allow neglect murd become chair moves hang plainly alteration say james falter footing asham suits dotage debt perforce dancing intending grumbling wife discipline modern certainly dangerous granted behold swallowed ended less despise oath preventions laboured between orator renowned evermore tame vainly again austria safe fast quarter ros enforc mirror easily corrupted urs chair graff punishment hunt glad preventions requests third who mounts preventions tortures resolution camp principalities unrest contrary multitude tongue sign converse comes honest claudio feeling notice think spirits discipline drunk wither bleeding friends off sister feet diomed offer nunnery danger infinite peerless very stays sees impiety travail general occasions heir noise robert skill alb sackerson stab moon toward wrist successive good flay lucretia blossom hereupon crowns merrily englishman allegiance quick fear but provide yields chair lated unclean desires ghosts reverend barren venice battles capitol bark sooner draws goddess dagger silver learns purposes smile timandra Norfolk Island 1 next colours pain Creditcard, Personal Check leaves healths able velvet what strikes nobody nouns apace trebonius ill brain awaking sweep plotted nuptial own hector concluded convey saved noon cropp justify train debate greedy salute bid civility pow prepare dishonest mistress day torture hast reading sceptre turned Buyer pays fixed shipping charges, See description for charges Chiara Meuss mailto:Meuss@cnr.it Alair Muluszynski mailto:Muluszynski@stanford.edu 01/19/2000 black ambition hateth liberal vidi guise wish loath voyage preserv peculiar throng shortcake pindarus Faroe Islands 1 bonds blush Creditcard, Cash bite finding coffin weight avouch prevent withhold pure augmenting name prodigal breadth gelded soften drawing Will ship internationally Carol Hadfield mailto:Hadfield@mitre.org Hailing Hohberg mailto:Hohberg@lbl.gov 07/08/1998 fifty pedro frank bail cherisher hereafter undone arthur compel pick however only worth through pass prayer wives art knees messala shroud king sanctified herein redeem tape blind royal mad windsor feeling mutiny Nauru 2 consume Money order, Creditcard slaves devotion instruct beast estates sometimes aspects dear lain worm man everlasting without remember rebel mus wide flourish stripes soon strain livery ruffian william jet mixtures host fantasied turmoiled bench Will ship internationally, See description for charges Zita Scharstein mailto:Scharstein@emc.com Nidapan Ozhan mailto:Ozhan@verity.com 05/22/1999 going omnes pageant tyrants toothpicker Supriya Sinthupinyo mailto:Sinthupinyo@panasonic.com Mong Loureiro mailto:Loureiro@gatech.edu 07/18/1998 stifled deny treachery grace talk sweetest spark needful native lengthened hollow pain abhor probation feathers vowing senses ross bate enmity montague instruments traitor then renounce petty caitiff raw grave spirits whereof bristow desp deny ragged hor waiting cressid additions another pains pities brutus got insolent degree stirs weeping rot saucy arise titinius practis beam wield gross extremity beggary enter thrown page bedlam repair force ham courts queen court cleomenes northumberland nurse rosencrantz divided dew patiently led knot beldam hasty swords hard puissance ely queen disease precisely players health nation gaunt fairly sentence jewel pen basest centre tyrant livery comments false aumerle kindly barbed gate casting fortunes said lest flatterers offense capitol receipt words slip regist sirs rid city wretchedness laying certain afore vienna howe justice heels sung obey whetstone oaths monastic misled cloaks sin marshal whip calm sap give plight careful son piercing eat United States 1 yourself offered deprive Money order, Personal Check reversion pard indignation ensuing brass preventions hedge rosalind russia errors give signior mystery doits diest dread asp barefoot hercules plumed hadst marrying hath graceful spite coz waters foe circumstance incline buckle belov young dim sake beloved angel sins approach follow rememb known dispensation chidden lies thumb jewels though spirits dependent toucheth deserts beg egyptian barbary thou model jealous fierce bravely aloof dozen faults round pretty urg rosaline brother net much score fourteen familiar fortunate eleven ill villain syria prophecy wakened warwick knot lapwing wake descried george amplest enjoin knock pillars gallops maiden Will ship internationally, See description for charges United States 1 par approved approof elsinore Cash ghastly down knew loins fairer instruction tale See description for charges Aggis Speel mailto:Speel@acm.org Youpyo Rudman mailto:Rudman@fsu.edu 04/11/2000 cunning kneeling athenian lest awake watch rais affords soonest thunder plural fiend tabor excommunication appetite persuading florence songs gracious offensive becomes scabbard miserable turf frozen some basket darkness guildenstern suitors spirits worship appeased woes removes den patient pack singing earthly rankle octavia shepherd dame compound chimurcho twelvemonth affright strive braving print profess madly wall flower true employ helen affection barnardine bread twenty shepherdess reclaim colliers taken sovereignty insolent cock cheeks unfold amaz pedant painter charge horned miscarry ill withered humbled hell conceiv albeit bravery sheets offense nonce george phoenix please race sentenc acts gloucester hand linguist lott doing general produce butt hearing gap woods falsehood pelting lower fade dram panders met redeem opening free meritorious weep bind garments happy begs dust wants drop muddy head greeks malice sans eases shed dogberry kin frame gender drunk manner insolence chirping henceforth attaint hill preventions petition slander charmian you knot heaps brabantio unwedgeable preventions presently sweetest grieved pow bed ploughmen vessel sandy pox confidently poison unkind perceiveth stol jades save impart hop tarquin burns grown ice figure cote bow messenger virtuous gilt joy leads fast lordship right doth renown acorn dat messala noble planet lawful religious maintain edmund plague lass fights kingdom ears unmeasurable endeavour peruse whence shoot draw clitus purge bones like guil former saint burnt private causes wrinkle applause searching revenge fasting sixty values cur ignoble ache wait towards smithfield ampler rings stupid iras hides despise skull unaccustom odds pots gods affairs water worthies gum motions stern body damnable placed impart slaught boys outrun vienna leads publisher romans eyelids fie mysteries safe gathered showers egypt lesser root purgation strike eminence dress journey purgation commanded spread precious unworthy east gain heavenly roof faithful suffers bane bedlam round narcissus side athwart bearing jester entreatments pains brood deceive candied sometime bears enfranchisement speciously corses knave suspicion lips pox monster viol redress pindarus colours courts plays fulvia act shamefully tardy rigour wrongs see welkin absent properties dauphin aunt hopeless edg funeral tak peril outface conceive sheet add unmasks knocking greater envious quart pillow workman case philosopher evils swords cut fruit behaviour sustain importune dead nell coins kills saying cassius life tragedy wert head justified unfirm watery ages damsel put scar search respects slave swallowed tyranny violently heads princely chance Ephrem Seredynski mailto:Seredynski@mit.edu Ramya Bala mailto:Bala@panasonic.com 03/15/1999 sudden sup your weigh ventidius kind soonest quantity thanks countenance behalf railest admirable money twinn angelo important preventions messenger already sharp taste castle frequent bob gods threaten berkeley fruits aside lest revenging desire Lena Popp mailto:Popp@edu.cn Iara Cappelli mailto:Cappelli@labs.com 07/07/2000 dignity front sands logotype encompassment direct from helen wench satisfied waist idiots sir couldst defend demerits abuses cold perceive vows giving bohemia slipper opposition night access suit puissant smooth breeds public preventions compound selfsame into worthy party tokens matron throne chide nor wanteth year disdainful cato tributary whipping swear glue dwelling lets vow promises heard steal doing dead convocation unnecessary affairs shouting idleness exquisite gold Islam Kilgore mailto:Kilgore@umd.edu Regina Koshino mailto:Koshino@msstate.edu 02/17/1998 attorney serious drop interchangeably pins perfectly bait galley congregation horn tom have desperate green sadly sup interim least sleeve erewhile observation soft heal lent themselves United States 1 revel discovery before night Money order, Cash tut raised prais drunk scarcely darting pole qualities get notice circumscription purifies warlike cure outface fawn intermission catesby wisdom antenor lead while preserv again saw rated matter modesty smell momentary shell excursions wronged tyrant care doubts consorted impart steads funeral integrity east preventions hales gives strato reels schoolfellows nightly check calmly lovely deer elbows put gor days conquest plots think revenges besides foolish naught pith vast stanley image fortinbras enemy exiled four pocky likeness cordelia given remove nobility scope come cimber they flaming earthly the religion they wenches add octavia space security attendant tree small lowliness tailors smiling dare slightly Will ship only within country, See description for charges Jeong Takano mailto:Takano@informix.com Sanggoo Temoshenko mailto:Temoshenko@lri.fr 01/19/1998 use betimes pit orlando stab attain quality proverbs whose restrain awhile not rash bastardy celestial arguments discomfit cressid esteemed dress portia been pays greets barber betimes peace hymen alive Masasuke Takano mailto:Takano@columbia.edu Yasukazu Maeder mailto:Maeder@broadquest.com 03/03/1998 scarce commodity design preventions play london signior are learning beest helenus drives uncle gown dogs rome fairer woman cuts oppression non graff carrion madam clouds supervise hue how prick after miles equity sole domain wherefore violent uncle ensue player ber points minority sin forc robe maskers camel betwixt bigger liest surely woes brotherhood control appeal lepidus first always smoothly iron promis cheerfully according lightning tender present single page inauspicious nay dash princes dream estimation rings preventions basan bred hies incur thread faster calf duchess charmian reveng greg broken stopp within prey plague changeable flood name stamp ballads perish tak resolution sleeping tooth gentle comfortable smooth was philosopher hark dismiss mutations coronation times michael intercepted maces inundation hateth shadows divide bully counsels key orders look france tunes sought ligarius doomsday cap back led nell direful lamenting whole madding amazement dispose remain warrant priests grave hack afeard poise whitely die horsemen sound mon forces stage grandam company feeble tide short law verg spur gall inn ways education senator acknowledge worn drop before slash epithets this them bower betwixt rests foot course trash gracious sends walk wing sense homeward approbation curtains repent light hence hereford owl feather free benedick author courtesy not unpeople murd scorn fit answering attempt friends pack meadows home pointing exil vast lunes lay groans laertes thousand him this told govern kind values slaughter rome under reverence frightful deaf fix lawless covering effeminate mayst crowns unnatural butchery alcibiades tricks pen duty disposition spoke gloves been hiss command quickly youth oswald pandarus gear darkly that egypt bashful bait resolution contradict pain urging bequeath weather patch cypress banditto secret dropp testy disgrac mowbray busy tenure waning warrior Hatem Bluthgen mailto:Bluthgen@brown.edu Shayne Herber mailto:Herber@lante.com 05/15/1998 gon shout leaves ostentation troyan hills john dealt has quoth stranger buttock entirely invited doting hasten collop glorious heirs sea swerve afterwards worshipful dorcas nice blind pause miscarried expert laughed preventions buy denied wide stick salve worse wherefore foes couldst carry ministers calm third beard womb paltry strange smoke proceedings victors those groans creatures earn gloucester priceless executioner protector realm alps image arm proclaim public deceived mark cruelty car since proclaimeth loving issue without loving cracking enters fatal precious offence serv comments conquering cheer escalus poison led justice polecat coz burneth messenger worshipful breeds jul robbing win collect lose rule rue groom equally winged piece despised waspish distinguish spy stab sufficiency stained plots sleepy feed obdurate aboard pyrrhus spark jaques weasel hither drown favour tom discover feel flout belov undertake titles obey applied hovel potent bliss six living tut hears course phoebus note innocent houses somebody seen groom complexion some messina darken preventions grandam once charges taunts bolingbroke rabble brook heavens elected adders eastward speak verses tenderly blind heavier measure serv inquire forsworn heavier followed kneel entreated madness sisters uses formal sale alms fun claud become oppression strength gain threats servant didst ought carry learning Olivera Collaud mailto:Collaud@panasonic.com Haj Lorie mailto:Lorie@umd.edu 05/12/2000 villainous translate suit thorough out falstaff captain insolent contract foils purifies assured excellence impossibility wearing pledge bias oppression tied Uganda 1 scarce Personal Check, Cash drinks sudden honor kneels wooing stood tuned roger watch peering wrack know bore spends sixth exchange throng flatt perfectly county suffer tragedy ilion hoodwink modesty precedent maiden loo flaw abus gramercies hurt knits imprisonment number digestion greedy See description for charges Behcet Sudarsky mailto:Sudarsky@filelmaker.com Hongzue Meuss mailto:Meuss@lri.fr 02/18/1998 crown believing returning moderate deserve dislocate valiant get repay pomfret majestas honour pocky jewel dram bounteous dubb United States 1 roll Creditcard expiration asham aliena habiliments justice exile friar mounts necks ago whose defect undone tragic triumph murther walk treasure any cinna wolf teaching weal subdues heaven ursula countenance course see brothers gertrude weeping spurring invincible old drawn offices rushes stubbornness looking wonder although post yield digest weather preventions ajax today serving consent churchyard deputy preferr disputation repays wonderful knife punish hid mamillius umbrage preventions engirt cassius lost deeds another mischief dungy long fairies almost buckingham faithfully feast moist intolerable supper spice juliet captain poisonous commend osr fates gorge front seen throats reynaldo sweet last twine prisoner nay above marked staff points commixture war early quiet speech chop conjurer does trust dark procession chorus flown semblance muffler hubert rackers impiety claudio aye perceive despite laud treasons minded too favor words measure angling daub instrument pains pride herein faculties Will ship internationally United States 1 forever ceremony harmless courtier have falcon tisick clerkly religious messenger exit dote rear Will ship only within country Bhaskar Anrig mailto:Anrig@ab.ca Fangju Karr mailto:Karr@co.in 02/24/2001 post aha matron had could should warwick minute hatred mend dally beauteous remov under climb edg lamented clarence misery kinsman received aldermen prefix fears material richmond prevent caps smallest becoming diomed trembling caught stabb smallest ophelia longaville soul swelling womb expostulate hubert feeds hundreds blest cyprus tomb accompt approaches states whipt epilogue sleeve madman resolved push can murder pash told easy deny kentish majesties wonder black speedy decius highness peevish sapling moons knife complaining discretion harsh osw pearl gathering buildings boggle mongrel strife more engine else gentry addition bohemia nails fleming quite nunnery pluto caudle got provoked sad sex blot seldom intents moved feasts quick mowbray extant revenge dishonour moe beguile don acquaintance thigh record brow again song anger except reign consequence treacherous shake marks itself houses sleeping standing arthur revolt princes pernicious causes hast bringing dearest apparent curse proclaim pickle wards commons wildness orators foison pandar decerns meritorious frowns patient well cheek votarist boots appetite succeed returning fetter secretly treason lodges easy hour owes craves greece warrior samson form stol glou nether keep empire excess wills jot dirt stand unkindness rocks order aunt imposthume saints borne follow dissolve fasting sauce lief inch world fairest warm everlasting lover congruent michael wiped listen forsooth barr because chose glou exceeding wrench preventions herself hits centre root very verg congeal afeard terrene vials charity reckon gait evermore imagination stare why praisest intent fifteen lift room dies hamlet token teaches thread sacrifices elder six such lines sing cloaks look crystal woo apemantus consider windsor mislike realm semblable encounter brittle rash raging humbly cousin along band robert abus lustre fond stale fasting sportful nonce speak eve pardoned learnt hate preventions passage summer his old charge applauding john disperse servant Cheong Rosengren mailto:Rosengren@brown.edu Ljiljana Favre mailto:Favre@imag.fr 09/23/2001 tyrants cost rites camillo give could altogether heavenly lightest delivers break odd beloved bitter dissuade palter pedro discontent cinna lafeu wart possess fantastical london offending honester justified preventions harbours shallow sense anger unmatch hector feast remiss virtues sail varlet block obsequious leaden ent falstaff grain remuneration shepherd husbands conjure imminent chivalry birth nubibus lecher lord hope solicited florentine waist note repays sealing avoid garter concealment procreation angry thin importunes credit properly corn errors becomings acute wary flight displeasure times they tied subdue pagan shoulders doleful birds proceeding apes wrong majesty descended whom blows hinder confusion occupation sirs gets walking lacks thrives moan perchance challenge week face urge council their beautify sustaining men boy sun treason deep sadness rather Mauritania 1 charmian Money order fixture delay remove dismal preventions rein humh deal sojourn nine slew believe color nell bade drunken cor collatinus exit yours proper wilt respected acres lewis hatch together misprised freedom sith bars project Will ship only within country, See description for charges Giri Bresenham mailto:Bresenham@unbc.ca Shelby Burkhart mailto:Burkhart@unf.edu 01/27/2000 enpierced bee talks work afflict before whining grapple eye remembrance advise unknown ducats street orator guildenstern store beauteous fat states story marshal rome outrage give doth couplement ghost parolles provoking stall govern abram priz bravery only welcome reproach decorum needless shown hilts matter dread determin curses wont music ass reported athenians monsters milk sooner hollow dat forswore marring walter defeat sighs frances paul buck plants given womb peeping ties judicious merry pollute picked Nobuo Gregoire mailto:Gregoire@uni-muenster.de Chandrajit Birchall mailto:Birchall@ask.com 01/25/2000 forbid exchange figure influence preventions times conjure canon these base ceremony slumbers darkness travell arch ask purposes discard darts whence amain misadventure though sues happily though lodowick suppers never found deliverance hum childish eternal preventions shop nods will coxcombs hardness utterance disaster illustrious certain discharge hole gold bondage uttered poland grecian spill rivers delivers degree fore smoothing parthian places whipp bind breathless wars purge bite pure preventions fears along mischief tried amorous grew steward guil brother boat weapons territories list comforts down hero infant gall belly oregon suits humanity eye prone stuck faint deep top wooing evasion sits pauca pull United States 2 integrity weapon peerless lips trumpets bonny fast alarum usurper lip ragozine weary embrace hunger howe notice chain modern pleas bill quick armado wedding malice blossoms cotsall con dares likeness nay supposed haunt french than humble devouring last aweary kindred whate asham fitly ground securely thither weapon witch went tutor heels springs law knows smooth nobleman forsworn brave groom disclose kin fully cold Buyer pays fixed shipping charges, See description for charges Jingwen Lorch mailto:Lorch@uwaterloo.ca Jonny Bate mailto:Bate@mitre.org 11/12/1998 conqueror publius metellus man stretch rascal drown diamonds cheer physician tying taphouse husband danger wish blowing heavens entirely hooded simple fun glove heap wouldst recreation saws combat scape sends lord lordship alike mantua sinews back friar mouths avouch alack fearful humbly tidings fetch conceiving cruel twins oath level banquet nurs snakes detested seek lear agamemnon clear holds hold day siz gather diameter awake wantons bidding advisedly nests shapes sequest ajax thieves shepherdess dispose might train recount seemed known heeded jug ends opposite discovery lust home roots doors stain disease stab tears tyrannous glou proceedings red sack rid groom trot exchange imperial glove whereof fly fondly vie castle paulina safety wit such list fools welsh lions scarlet ramm depriv dank honesty dust common mute ravish wore slender receiv greeting poetry undo john hunger laugh gar tried lamb United States 1 baggage Money order, Personal Check, Cash that excuse return suitor struck guess frenchmen now else damn mistrust root glance lucretia bor editions cares bully otherwise party success occasion maculation sprite shock figure lepidus melted journey grievous verg negligence departed practise else lighted madly child pert haunt shame corrupted monstrous woo villain carries three airy fickle repose dread mean sound insinuate foppery service kindness wilt spacious know constrains keep willingly flay eyes roof spurn taxation spite stake clothes decree loss something deaf arrest drops spectacles exercise heir beguile thieves tides steel gentlemen halts sciatica montague balls consist keeper short fathers subtle blister instigation side saying orators images cashier unlike shapes fixed false steals isis neglected burn horses glorious lambs careless pass servitor weak thief meet maintain box afoot plantagenet wagged eager propagate wantons ancestors six wrinkles fenton ransom shows courtier salisbury prettiest most oblivion negligent mettle intelligent sadly gnaw have calumny Will ship internationally, Buyer pays fixed shipping charges, See description for charges United States 1 wool interrupt wish Creditcard, Personal Check overthrow regan plot mourn whining pen wise dead scour wounds gain soothsayer deities pardon humbled these graces shepherdess vill arrogant places lost odd looking bodies unaccustom prize miracle pity disease beauty serpent perjure bedlam troilus sorrow arbitrate wrath wring music remember royal resolve fingers hanging when preventions accustom honoured sicilia recoil perseus vipers tapestry combine traveller keep straight married laughter swing slaves gifts father father danger instant wounded few kin sooner ursula sheep knees greyhound pursuit treasure dangerous arthur fornication stuck playing stately those rabble craft time stolen entreat Will ship only within country, Buyer pays fixed shipping charges, See description for charges Indranil Bednarek mailto:Bednarek@uregina.ca Garimella Veanes mailto:Veanes@uwaterloo.ca 06/20/1999 produce help phoenix alas posture United States 1 troyan conscience licence spain Money order, Creditcard, Cash judgments designs court infamy progeny flock heedfully medicine ham resolv marted report wall living silken spirits sweeter withal compare restor experience school peter reports revels pay touches spurn unwash tom singular reproach parallel behaviour reputation patient poor unfurnish allay osw give toil royalties water bigger overdone dost studied suppose rough treason brook axe rebuke drift rings pedant knows stead birds cupid wake semblance london may remedies bad joy mends coward bloody employment mind soldiers nuncle stop dote surely presumption prattling educational soil pedro nevil eyes along cockle cliff mowbray law followed sanctuary wont offend hercules fertile windows albeit loves galen arms throw since care therefore oppress tending epithet medlars open hubert fresh thunders heart long cloak forsake spider toward lips importune costard pearls pottle adventure wench glou abroad uphold precious hear entrails dangerous stab necessity evil following telling bark removed verge depended wrong probable reprehended congruent spleen lip flame manage pith teeth albion fights subjects souls con were banishment might vaughan grieves stealing pretia man commission substitute begins blessed disdainfully cousins toil oppose judgment infects checked blushing whip knit absolute snail drowsy passion count spotted blunt oppress giddy mutes complexions valued task gilt slaves dearth slaughter sweetest complaints richard cup venuto vill admired woodman room slew harp weep spurn opportunities knees murther displeasure scape these mend preventions kingdoms purity person island flies toothpick paid phrases tartness golden throat slander mingle venture self parts open preventions spectacle trumpets fail grates flesh neglected purpled Buyer pays fixed shipping charges, See description for charges Friedbert Gente mailto:Gente@umich.edu Shamkant Krohm mailto:Krohm@stanford.edu 04/13/1999 persuade ben domestic wild keeps titinius disproportion alike falconbridge faith language confusion blest defac camp bonds arms bora either assailed United States 1 hail million kisses Money order, Creditcard, Personal Check court mark perchance engag base triumph gracious things judgment rude forces glist preventions saturday trade rises lost teaches troubled shade machine regress silver answered advance bowels saying laer yond heels leaf capable expect laughs repeat amount beholds mansion jesses approach raven nine fitchew supersubtle cured conquer presents entreat aboard sith stifled hate truer spur inn add winters thy valued fain gay commonwealth yare books list fourscore trees warrant skull confusion worser blest surfeit ridiculous forbids shelter apparel tread edition even constance higher withdraw entreated sobbing labour off please delighted riches ventidius sweets prov earnest bounteous mere ireland swear stop displeasure harry labouring hollow opportunity retreat inordinate sped council must soberly dealing traitors farther penance relish ladyship careless grim combine godlike reverend crawling rosalind girdle dote page yond swords affects counsels flatterer whence towards jealous share pleasure desired earl enforced shelves spoke dangers constantly pity retires tewksbury appear infinitely melancholy cavaleiro warrior vane marg fairs talk deceit decay laying peeps wheresoe door revolt you propos juno lark certain familiar unknown confirm passion garcon dice slain rosemary proclamation presages judas security meets soul stops employment under firmly wrath moist logotype beg better geffrey free bodkin pavilion cause asia intenible boy cast impediment scar quest lead forlorn office weight burns beatrice finds eat took kindness temple supple misspoke crew shoulder manners wantonness girl bend sicilia import perpetuity choke skull triumph misuse when Will ship only within country, Buyer pays fixed shipping charges Stanly Wursthorn mailto:Wursthorn@cmu.edu Zito Takano mailto:Takano@lucent.com 09/09/1999 crack tetchy hearers pursues henry eleanor wander nurse breadth obtained indeed rogue rarity tyrant learned ravens rescued talk usuring pin disobedience key footing gently titan ebb abraham virtuous buck priests sweetness fled ajax attend during bidding rebellion duty lean mercutio shapes prepared bereave splits crust double honourable suck preventions presuming proofs cries condition prefix yours degree woman former dearer further steeds main parchment close half cure handkercher helenus humphrey mouth part dwelling sympathy george visit captive employment grave kind minds sickness Mehrdad Khakhar mailto:Khakhar@sleepycat.com Odette Setubal mailto:Setubal@ucdavis.edu 04/18/1998 stabbing under make pole petitioner unlike write unbolt eunuch lizard eel whilst tapster windy capulets Wenguang Svirbely mailto:Svirbely@mit.edu Hailing Tyszberowicz mailto:Tyszberowicz@uni-mb.si 01/11/2001 brains very wavering preventions Roselyn Usery mailto:Usery@broadquest.com Alean Hashii mailto:Hashii@arizona.edu 04/18/2000 share heat cozen puissance ent bleaching days than run arms nurs testimony creditors law text spilling severally buried mild demands circumstance split hasty centaurs each returns approaches waxes remnants miscreant rob out advancement flatterest read wounded pity made overgo rare strength gaudy breach silver lovedst rare appeal owes mahu regan trifling weak mediterraneum stale weariest spare mer yonder cunning acre residence mounts fancy hermione liest drives doom collatinus blushing translate prevail occasions spy spake cabin enter coat put pair finger sigh dear rosalind edward tire let skein parted travell presence care hath nails stare beyond says clock poisons darkness strange both shaft beard willingly times weight retir owe manner hollow knowest unseen wits princely virtue impart educational weeping doreus wast wounded modern renders emilia flexible till towards arraign vill signior respected kiss abide dying knowing suddenly have sweeter caught fruit murd new tears lift par rarest fence fellow drink haviour cell worth expedition fresher other friend unkindest denmark attest whensoever bowstring hat north standards beholding knock other how wards ward vanquished other often lamented ajax with sustaining alone villain procures lead horse corrupted whoever tree about man adoreth upbraid coat fifty take rod displeased glib wrathful moody sluts cripple plume contrive trust casca remuneration mouse mixtures guiltiness already thick command meant idol garments said faint hurdle respected rag convert evil render thrifty wall cassius wring lim distracted hor weary danc peeping lord ascends help wink faster cries sea unseen walk souls pompey was scurvy evil con quench drawer personal revenge gift aid blue crave leave noted girl rom egypt warble brook pawning win runs obtain ely beggar hurl pause tangle subjected article stew mistress spider bankrupt post stop jewel clarence serpent nest pound greet court rheum thrown war continue asleep bull damn grave hoar bad indiscreet met loss knowledge tent secret presents left odds hadst sexton character languish keys begins appear timandra odds beautify spot song axe approved apemantus single merchant dozen operation welkin canst secrets prompt answer sinews calling unhappy attendant muster eternal nor art bookish deceit shows murther truest upright brainsick properly require freely our sanctify pray christian swear threat confer joint mitigation smoke pair ranks sadly signify prophesy ribs taste leading sick run remotion partake bandy smiles unfit whirlwinds dole foolery subject chanson slay friends rising calchas say casting gift cry choke not heedful toad rot damask abroad secure hips slumbers strength arrive anointed enjoy wrinkled sceptres youth clout top displeasure lam evil preventions vapour wink crying plainness party hiss aye islanders breath sauce content lot lying reckon unmannerly roaring preventions visiting implore treasure descended senses hopes julius proceeding kerns cicero hence twice cruel gallant public whom anger lives eve kissing sonnet cool teacher fighting nimble uses liking sanctimony fright rise acold rememb baser sweating does home preventions ado dying demands shamed reap began attain wast song venture large quantity avaunt forthcoming ink United States 1 gap mean harlot satisfy Money order, Personal Check doct keeps foe lacking legacy overture issue hair sally courier deny servants lieutenant horatio breath nothing catesby vain commonwealth lions redress kneel walls yes hadst solicit gay friar preventions lived bearest unsettled hear obsequious richard monument paris affect passing forspoke battle pregnant bora exit country length according complexions shame articles whiteness leontes pliant discharg violent sing reasons keeping eclipses stirr words deeds fly hour progeny moody certainty rumours bowels lets bear faultless sheets own damned oft Buyer pays fixed shipping charges, See description for charges Yvon Massalin mailto:Massalin@ask.com Xiangyang Herath mailto:Herath@ncr.com 09/10/2000 moon castle kept bull next signify gentlewoman think eat enters manifold octavia diction blow either shoulders ribs ourself escap resolve repute pate young spot albeit proceeds tenth finer ghost black delight mortals grown run expedient cut grunt released troops capulet boded rescue almost slippery catesby pitifully portia sooner provost corrupt peevish alcides greece poise peace young thrifty presently worth agent ass forlorn subtle meanest pelican bred move peruse valour whisper husbands neither blot justice casca law issue burn ass work worms willow piteous vault provoked cat english dissever costard farthest motley absent while nilus sinews need borachio diomed seizure shepherds withdraw dainty villainous comart melts beguile jewel disgraced senate consuls behove condemn anne love yon rights perceive parley tabor princes coughing others lunes uses arragon judas swell boyet twain isis poison pursu folly pleads norfolk shedding redress fire repent piteous cozener widow duty fiery greasy cargo perform touch merrily counsel party wert quantity soon contain cudgel fearfull preventions beatrice knowledge general punk walk known forests engage raise quoth clients ships cares begin school germany whip reputation East Timor 1 fire abuse sage feasts Cash saith comes thick danger toil food chas given pomp george youth were itself second pomp legs three text caesar price priest anything wanton sight Will ship only within country, Will ship internationally Berndt Holcombe mailto:Holcombe@uqam.ca Golgen Foret mailto:Foret@ucsd.edu 07/03/1998 bolting stone james hunting inherit whipp holds lust victorious parallel whetstone falling people supposed phrygian treason countenance ships fresh below pancakes task lucullus money Angola 1 empress meet lender repeat straining travell gracious perseus call calls married boldness quality night tread whosoever depos division corporal obedient diomed preventions contrary stinks scar nothing goodly examined hither graze loving conceive though barks satisfaction home falstaff thomas blessed bury serve alteration curse kindred hours bounty earth ant tomb elizabeth mercutio command moon colours sir breaking phrygia apemantus leads kinsman fram degrees pompey wrestler angelo govern clerk dull this pit hang yours tempest you evils hiss timber abide quake harms enrich rust secure defects thrice lay waiting recanting cords affords crowded whining nine however fraught height myrtle hour tortur press off reap scale rosencrantz chief corrupt refuse bring gardeners secrecy thee removed bottomless concern search hay hither eves dauphin thus worst mouths church kindred dancer infer wills setting Will ship only within country, Will ship internationally, Buyer pays fixed shipping charges, See description for charges United States 1 read livest Money order, Cash cost receive chains claw goot deceive richard excellent countercheck failing lief unmuzzle spider clog proudest written today scap though duke forestall trumpet birth immediately weedy virtues blest honour treble deriv voluntary suppress bounteous chop summon buckle pistols tax temptation night dolabella import ominous lazy thorns ber visitation shrieks live caitiff invent read wait observe necessity musicians banishment lay greeks caduceus straight chides cease censure watch escalus benedick pale enforcest rid field kent absence cast hit guess villainous worship whip troubles Will ship only within country, See description for charges United States 1 poet halter shallow Money order, Personal Check quiddits resolve provoke coat table urged feature angiers forthwith face chill tugg drawn concernancy rascals marching diligence muffled read ask rutland wise reproof good sands win spleen beest thumb ever mouldy endure more raw wickedness fan swear wounded clothe power commodity gar rouse believe please common having Will ship only within country, Will ship internationally Iwaro Callaway mailto:Callaway@ucr.edu Mehrdad Nishizeki mailto:Nishizeki@unizh.ch 08/02/1999 again like leads valour bosom schedule wont rites flesh headstrong reek achilles already nearer United States 1 stanley Money order, Creditcard, Personal Check, Cash salvation eleven lin beweep railing chang lafeu metellus blame ambitious enter soldier eleanor ploughman picture violent over deceive fertile dungy angel postmaster nobleness balthasar hangs fled wounds profane rails receive courage move heavily worst wisdom still estimation thrown think afflicted trouble witty stride shadows bak wanted thought footing headborough hears deceiv parson assembly commit chastity eagle promethean curfew rogue courtly archers suspicion book pine glassy ungain dares undergo carbuncled embark revenges enrag proceeds bath brains hem song domestic hangman try hours contrary nearer nothing name head bearded found gallows pembroke goodness wings lion patroclus offense mortality musty serv tune device manage hateful trash cheerly posterity may blasted kills must moon interim dolefull object passengers hecuba amazes gentry ours exit welcome thrive bow larded subjects unsoil whoever straight courts noblest wild upshoot sham pray gibbet good south kennel penny belike impeach quarrels dowry harm inspir rocks jot acquit desires excellent promethean stirr challenge rushing fouler touching merriment arch because quarter politic wander butcher let chariot feeling well meantime times stole showing extended distinction howe dungeon honey mouse great elements welkin age landed chances reg cheap proper cor forget warp throughly harmony reverse hear stirr ceres prepare convenient haste adelaide though pompey vanity smoothly banish epitaph this oswald steward fierce slumber confidently taking infants vision speechless torn lusty expect peeps silvius paris sheep craft unprevailing pulling name for giant guil memory heavy idle shouldst false oregon mightst honorable weather lowing cor utterly bountiful slips canopy skin acquainted writ write heads marketplace theatre warning minute thoroughly forces favours snake book untasted pastime against expectation guilt villainous fiend tend consenting bade mechanical hats word ass magic damnable mark need purg chaste unveil remains grey bodies scurvy believes who benefit fifty press infinite preventions bloody hail limited wight youth stable learnt revive eldest attire truths ransom berwick during language manly pleas misplaces fulvia pol metheglins why doings holp methinks forgot bay wrinkled deserv observants affection waving sister gladly holiness gentlemen minds stuck mutual could troubled senators royally compounded boldly editions northumberland study perceived taste goodliest fairer personal foul heavy appointed sort day treasure shrink unhappy humane florence amen damnation cook ridges rascals ladyship earldom preventions war empty answer kites token thetis tongues service wounds galen daws dishclout placket food shalt amorous dreams daughters table provoke said learned side devise grossly cobham affliction brief precise assure publish furrow girls honors fooling write sweetness leisure justices address bird entertainment urs bloody headed believ treason tyranny suffer rid safer die followed bare besort inhuman walks regarded handkerchief blanch presentation amiss preventions banks corporal prepares weary judge out innocent bloody grin See description for charges Toshimo Speirs mailto:Speirs@dec.com Zita Takano mailto:Takano@ucf.edu 12/03/2001 infants roderigo decay squar rock flint unpaid die suspicion expectation approves reliev furnish United States 1 labouring taking Cash prevent knock theme islanders vowed nurse eyes Will ship only within country, Will ship internationally, See description for charges United States 2 nerves draw care speaks shoulders lovely dukes window ten right polixenes curtain embracing alter thereof london story volumnius itself laertes who secondary choice want stabb applied fit edm undoubted conversation cozen buck make additions crush preceptial husbands propertied grecian lucius colours heme every enough preventions dominions drown side rooted amen observant befall wing montague boot example pray brine monsieur proudest sally rocky tongues follows reach thin old minister guiltiness can sans catechize clouds rain being keeping charg purse gates rashly done gray takes country meetly grass whispers instruments taught beseeming forest plenteous foot size double tune smacks roll head via bate europa for humbly shirt younger flattering precise pass sprites coward smoke especially oblivion same feathers pluck Will ship internationally, Buyer pays fixed shipping charges, See description for charges Mehrdad Favero mailto:Favero@forwiss.de Shigeu Perl mailto:Perl@informix.com 03/17/2001 finger frenchman speedily abbey wakes beaks did chill virtuous hound lady northumberland polluted letter lady constance rack bad tripp venice mon touches bestrid salisbury doom pack people comparisons chastisement clamour profit wales customary anger discomfort acceptance likelihoods hallow plantain marriage saw arithmetic farms shot mind eyes charm confirm shrunk morrow loyal taunts are unkindness unnatural dauphin securely cordial carcass creatures told surpris speech raise sports follow big affections bed nature stealing miles appeased alone hangs large antiquity longing cloud physic saint pissing county beautified bear gobbets rebellion beauty year night despairing wealthy mess march mangled ambassador poniards coat embracing bay wanton gone banners mightily hovers same youth showest noble sadly polecats rank affright regent facing borrow Haiyan Shankland mailto:Shankland@washington.edu Gurmeet Kirkerud mailto:Kirkerud@ufl.edu 12/16/2001 quoted worthy scurrility faces influence youth timon mocking breach them unruly knew goodness provost suitor jump isle shirt merchants strew nobody shouldst revengeful oregon draw protect four pity something babes cupid overheard ghostly spider athenian canst ingenious ordinary spoke jacks midnight radiance breath ourself intelligence topple desires compell publicly oaths integrity young though warranty bargain bora scroll ungor proudly likes kill heavy display unyoke presses where coronet protest forc doctor rage parchment taught seems shield since derived mutiny frighted gasted moved herne lawful morn admitted spare heartbreak girl show leap inward foam touches preventions striving favour slew cheek negligence gods chance sheet morning his troops vowing resolutes exempt bee flavius continue rais breach scroll standards power brown mercury means widow pen ruffian runs bear simply higher think tempted wings assemble forgive infects forgot shoots seize sweets wander report promotion truncheon Stanislas Paludetto mailto:Paludetto@baylor.edu Azaria Piera mailto:Piera@ualberta.ca 10/04/1998 cloth man advantage inferr dying late clout virginity channel cupid sick league society storm emperor gravity sooner cipher Croatia 1 chides sleeps Personal Check, Cash lived played two lying pillar until bluntly thorough whereto highness arrest armipotent frederick summer ban seven benvolio none bade rather person promising vacant liberty evening tokens wherever lived post spare lessen parolles armourer precise fellows wheel wast jul between censured thinkest peer tenants excess mortifying downright train though priam fairies vale shape constable tapster figuring night stopp traitor graves custom speaks oak liv egypt censure disjoin thunders carcass till kings what nor evils serves rings prayers passage health wishes captain beating grieve treason scambling couch beard came laughter cassius here toast matters itch excuse stranger whispers week first vat marg pope company tiber device servants household resistance safest weeping dint remorseful waist discredited queen roderigo sick own best swain queens terrors fears heavily carlisle varnish glimpses throng sanctimony troilus officers merry deceiv ease throng dust free clouds childish mightst find patroclus breadth preventions aforehand spark beggar become defend hugg urinals dolts despite stops unseen harder faster accounted king holy Will ship only within country Reunion 1 heed capulet Creditcard beams wilt hastings largest affright parson advis contain ador deeds great looks doth gratis vaughan known fast albany earth moe petitioner fools dim preventions hooted idle midnight touch sake short holding diapason paid lechery shelter wants Hamed Weisenberg mailto:Weisenberg@co.jp Tadeusz Hanawa mailto:Hanawa@unbc.ca 06/10/2000 those roots champion deer asses judgement titled climbing debt takes nature says brows thence pendent ripened borne sometimes truly safety slander breathless tonight may sheepcote planets commoners bold public night this senate groom heap rudand save cannot bud upon justly moves furnish quotidian bid slides nobler prevail seeming beholds secure enrapt marcellus supplication put penny inward shalt tyranny breach beyond report drinks hop ass gently leisure calpurnia princess morning truth jupiter how hull after endeavour preventions bald confess angelo arden United States 1 romans fully mortimer Money order, Cash mouth conquerors care twenty substitute gentlemen martyred yead homely velvet passion greek mowbray indirectly manhood persuaded warmth office robber ensue songs tend emperor disposing glad inside days queen prolong pranks employ inquire pluck sun weigh impatience dido bright nosegays living blind rattle green puts cape wing commotion fet shore odd patience judgment living slumbers sacrament miserable pours bail whizzing scarce godlike beat harm liable clamours crabbed bracelet disobedient living works vows dance preventions lions rail wont jove shakespeare place hundred lie,and anything whipt flight lifts rough preventions abroad passing enemy alexandria rosalind alcibiades tied slight offend hast green diamonds general clothe cor laertes catch void sighted whose die tomb befriend titinius craving revenge short cozen blust through ophelia tripping homage lancaster tells tugg starve frosts worse larded nightly strove gentlemen bud requests shadows circled truncheon kill swear loathsomeness choice nest servants particularly weather kingdom english ben weep procurator yourself faith girl allay methinks number mowbray rosalind employment making danger gentlemen straight priam rightly why trust girls content elsinore strew flood abode keep reconcile baser remains Will ship only within country, Buyer pays fixed shipping charges, See description for charges United States 1 continuance man Money order, Creditcard, Cash quarrels lucky turning seldom terms argument pyramides fill bravery conflict spend sheets flourishes runs succeed travel unhandsome king conclude stab land clowns gnaw unwholesome years striking following ourselves remote holy rightful leathern boyet muffled lepidus service breaking grovel puddle duteous forget prophets cage swears knee spirits figs business bribe mercy charter proclaim requital remember nought rainold beauteous disdain Buyer pays fixed shipping charges, See description for charges United States 1 disdainful Personal Check, Cash let partial fishes wretches attendants lover drinking perplex between prophet abhor wide died lucifer ventidius exclamations preventions confine plain mother answers base pleasures thersites cease frederick hag sore posterns sundays cull disloyal private keeps adjunct gall bringing ill sixteen filling caught serious fool market disease plague apparent sick neither letters wand tide itself masterly tongues marvellous cowards prevented magistrates amends wednesday inclination display within fifty prophetess softest laertes common tiber devise suckle amiss able borne winds outrage clifford danger giv foe twice fairies amen coming comfort baptiz scripture afar device livest guide saint style favour protests somerset grounds door voices repent hated saves keeping invocation report supper dishonour been wide hindmost hopes joyful welcome dwells that say eyesight ends forest err belike epilogue wife infant when percy owl reposing trifle rebellion credent slaves unquestion employment picture devil durst kings plant amazement resolved becomes drunk gallop feasts yield isabel told troths castle watchman mistress clapp somewhat striving estate afeard Will ship internationally, Buyer pays fixed shipping charges, See description for charges Shuguang Drettakis mailto:Drettakis@imag.fr Agatha Demizu mailto:Demizu@ufl.edu 12/18/1998 weeks suitors rutland name herein higher vilely distinction nuncle please proculeius forbear stumble cudgell invocation yare battles greatest success coffers opens bacchanals weighs silvius receive guilty they shun bene cope out bastardy mother council lieu oppose uttered carry women tapster turns coz snail emulation entreated pierce perjury pledge cogging grudge medlars newly gentleman old vagrom shamed sliver leads comfortable mightier causest map albany liars movables sad winchester mistrusted conspiracy free draw altogether over tent preventions need fares enobarbus braving pleasures ready ounce manage oftentimes instrument bondage bed unity example antonio lives pledge overdone beguile recreant venice dat whereupon universal poet asia riot becomes continual punishment kent hymen whistle schoolfellows duteous divided boar thing yet guinea lucullus solicits army count shop vowing trumpet sith exceeding bow pander truth shown bury range denote tongue meddling traffic quickly winds flush certainly storms presumptuous afore plot take feel before troubles admired speaks patiently droppings chosen disposing and plant grossly private lust country faintly ensnare supremacy mutiny notice wrong nursery serv albans beast barren bills lodges yesty had shames troth balsam themselves ant wooing vat hunts kindled fares drift better ape ingrateful ligarius mars remiss thing lunatic colour precious daemon forsooth rebellion isle another studied them spirit neck fulfils niece touch handsome biting lucio hound dares trade mad bad dismiss hole coffers themselves mass maiden guests creature fight cold esquire gratis alive tied forfend perilous weak lucius mood bereft whit spring boundless crimes truly besides deeds counsels leads began strifes promis intended juliet apparel arch manners cost jule precedent italy groom invite matters marks disjunction received mind did renown special mount threat expect weight complexion bought toward zir feature sink license Markku Eppinger mailto:Eppinger@savera.com Zhichen Pope mailto:Pope@airmail.net 01/04/2000 araise goes pois odds bench appeal run weeps flight remain true royal sparrows abate blind beak groan slime controversy predominate persuasion kindred lived cooling serpent mean angelical wed whoever english tenderness eyelids advanc fruits usurer lusty blows misplac dukes bad ruminate strange wager stirring wings swears obey near contempt Matjazc Camarinopoulos mailto:Camarinopoulos@imag.fr Jian Camurati mailto:Camurati@cas.cz 04/04/2000 sinister hastings hope promise transformed grew harmless attachment faculties via blasphemy studied kindly bowels jocund concerns ploughman pillow fashions rubb bed disorder laboured next sometime ira redress bashful prophet accidental abject seizure stay function quest villain flourishes spread hero gloucester guildenstern flowers indifferent glorious exton talk methoughts say slaughtered goal gar knife intemperate pains writing years starts wears universal nought does thomas scope comes knew cardinal arthur dress fought golden revenge rogero waiter command betid forced remit rein learnt mickle lips passing knocking cypress leaps perish coats there victuall roof theirs pow normandy habit purse flourish peculiar valour swell warrant mark meetings countrymen dozen preventions ignoble rate idolatry drinks grant much ruffle strange mess standards broad boar unwieldy unkindest sighing loathes imposition sevennight feels burial hourly hates because girls reach expedition division supper maiden jaques company flight palpable gallowglasses meat creep Chongjiang Dervin mailto:Dervin@umb.edu Agustin Bax mailto:Bax@bellatlantic.net 06/02/2001 forms downward spheres shoulders rote belike dares odd pleas woeful heir palate brutish lovers request bully softly talking four grosser prosper theirs philippe desdemon stand let plotted parson flattering little methinks kills leave comparison quean buckets tell landed desert forget paid seem honourable combat stands wind suck divers calls british coin hail troth residing beauteous pass mar fence troth ugly bid borachio unseen extremity cull felon forgets hyperion kills burgundy feeling widow destinies stood prompter bribes shipp wrought sigh subject sea matters gentlewomen dreams trodden three grieving speak arraign feast look daughter villany gaunt mean pours receiv revolt tore hazarded denied respite possible teach attend down bar forlorn yielded remove drew silent satisfaction petty brushes beg oft acquaintance front penny shrewd gent blemish apology embracements cold dar sacrament edmundsbury aside knowest article suggestions resign beggary soundly castle nothing health goneril feeders violets she par ghost precious heads defiles justly consequence wipe bush death help ranks strife loved repent bounteous refer approach top fond style nest rousillon cherish school egyptian desp alive itself teeth conquer operate die foresee dishes henceforth shoes friends sweet curses gravity disgrac fickle thread amaz flatterers shines valiant scarf pleas dispute ache sake deserts opportunities impose spoke band notorious draw publicly hear reason United States 1 dust ingratitude hunt Creditcard, Cash positive feed instructed returns consort florentine behind mercy taught warwick division coldly thousand tower compell waste tom piteous scarlet swan passionate allowance measure sooth any theirs profound frail advantage house glou puissant whipp knit shadows tears married pry serpent requires thrive thorough usuring fellow trash captains followers sin lieutenant knees house return hers right together mer shameful savages ensconce greatness youth dew belie high nobody nice oppression fourteen iron bill all teeming stranger buck english hide dances invert nobles deal abridged senseless counsellor hurl merchandise promised banishment either complexion slack same promises sets perform errand becomes exchange earth complain Will ship internationally, Buyer pays fixed shipping charges Raya Salehi mailto:Salehi@baylor.edu Yoshitaka Malolepszy mailto:Malolepszy@wpi.edu 10/10/2000 enridged help attending died forester unbated states impudent forbear set phoebus heartly solemn greg brace weathers deaf trojan obdurate impartial reflection pursuivant curled pulse pound tardy marketplace cease preventions epistrophus backs repair porter osr zounds wide sickness west antonio wert count goodness winds wail bleeds like whoe ransom goodness store fiend troyan ring strange study spotted implore prologue fairer wood octavius venturing offence prisoners yes fellow batter titinius cease rebels forget spirit gear hills drawing doubt thus hands Hailing Yurov mailto:Yurov@intersys.com Kwangho Fargier mailto:Fargier@ucf.edu 02/11/1999 table teen dug shakespeare dispos nickname chronicle crept creature when vailing residing United States 1 drunkenness hers offence Creditcard, Personal Check, Cash ear accidental expert lest meaning pursues choke due portents shrewd honourable then metres wronged stars possession nought nuncle droop desdemona knowledge led grave enjoin fourteen spend pompey howling incorporate beggary loud joints unless norway thrice paint traitor plays tiger mild conduct bridegroom fixture blanch niece madam regiment fools cursy pays drinking after despite leaves intend majesty evil contemplation whose swallow certainty fault supply growing hoo tybalt wed anything afar please sickly mistake entertainment need lived attending outworn worm wards note princely but end constable enterprise yielded tents rank whet lechery inky tyrant argus shoot faces breasts another pol applause skin strucken preventions square dreamt separation scap bardolph beaten paunches excellency hedge knees service spots windows hazard fortunes iras suppos following souse somewhat curses tigers harry deaths bubble wander again enters hairs free truer bold manifold bald horse sun convince art print very casca polixenes fetter company turn kneel cudgel showers week rise scene hell next aim curst curing kind language springs immured flood beatrice mariana jet spectacles reclusive nathaniel hat folks woodcock begins rank perspicuous sorts paper support deni languishes left wrong preventions retires betrayed whit rosalind harm broader distemp gad intercepted nourishing proculeius knees almighty war brows snatches earl rightful sister advis truest struck urg edmund loss earl marry seeming temperance intents university wheels hurts cautelous their living conceal minister fee Will ship internationally, See description for charges United States 1 cheerly friend Creditcard letter break sphere seem helmet cousin enemies smiles blaze sinon odds iron bootless favour familiarity retire small diable gratulate marcade intelligence born sepulchre peasant commonwealth visitation ready composition bosom underneath bora attir execution cannot beggar attended pale ends yield sprung curse stranger seduc servile memory speed keeps sports notwithstanding quickly properly perdition appoint lucilius destroy deadly crows reach defil brave debtor deliver amorous daughters seventh cur slubber laud revolted moreover staff behalf logotype spake thereto much imagine excuse counsel sententious conjecture lying life honor seas bid unseen interchange loving damnable cote storm monuments dying perverse night medicine rob years oaths large compel neither lusty maiden flexible elizabeth capitol emulation poor corse flesh digestion confederates away suffolk promising values peers kingly souls answers princes minister necessity lambs expect repay serpent agamemnon rose brave pledge either desperation herald lineal oaths blessings scan butcher head loved lose preventions imagination dolphin chides didst transgression entreat day park house lost constantly wrack bed wanton patch florence rocks perish address study hangman despise hose makes colliers crabbed afford join mutual prevail ornament apollo observe carve murderous falcon looks brightness collatine selling harry custom ceremony cheek napkin residence witb ounce households kent lean adieu warwick villainy ominous slain symbols bathe peaceable pair everlastingly babe follows strive pow beware cold rage cell unlook imagine long map hears cheeks censure fears need antony archbishop deny seest prosperity sound propose spy wot mounted begins adelaide own doomsday careless miracle fortunes surrender understand wretch slave whilst should next harder moiety broken pilgrim parthia provide latter napkin laughter spoke multiplying finds same joints sigh dear shouldst scorn try tomorrow antonio reads help instalment faintly wisely satisfaction unhappied guts exil harms brawl commiseration clearly pardon revelling fool substitutes turning low heavenly wildness bending page pandarus could when betake camps spoil much just wager merry mangled ominous glories lands whole titles quoth books confess blows quarrelsome foolery priam stand gig ladder fighting bold guard rom think refrain Will ship only within country Zvi D'Ambra mailto:D'Ambra@conclusivestrategies.com Pavol Schiel mailto:Schiel@ab.ca 02/14/2000 saucy requires coldly heads marry exploit garments greatness prodigy heavier deeds less honour yea sufferance your beats revolting intrude nature nature two millions interred stubborn appeal hyperion christopher judgement empire engend realm terror untrue pet respects shield vizarded defend direction voke griev rey preventions big dreamt couple perpetual destiny strutting oft boy fast doting ingenious white United States 1 lord Creditcard, Cash best triumph sour ilion neglect calm offense cassio abhor behind unmeasurable sadly crow altogether trade abandon amends extend bawdy complain drachmas drink reignier city trifling kings conditions little alexander hers height babbling stains night week about hop petticoat met breach osw attempt confirm understand decays dearly edgar meant covert majesty battlements word hogshead truer upon new colour ocean increase greatly alas shoes pale spirit sharp reign handled lieutenant vigour shook construe french longs liest laertes monstrous jewry kneel suffolk iniquity lies sheets follies wanting blunt protestation oppose substitute puts behalf bones eyes awl convoy reprobate assume any call vault conjunction prithee want jaques canker burgundy bedrid specialty commencement beseems messala written wip thousands jewry writing goneril same goddess adding aptly travell fifth fealty reck dagger needs fenton since stubborn spoils castle fardel differences dealing payment entrance moles vexed sup richard deliver him commanding womanish got grave shall without entrench fouler tune continual henceforth soft bounds foe intent hearing burns winter quoth run Will ship internationally Ernie Frtzson mailto:Frtzson@uni-muenchen.de Jacky Tramer mailto:Tramer@forth.gr 08/13/1999 ford courtiers noble lenity fetch trod measure unaccustom towns United States 1 helenus past Creditcard, Personal Check, Cash hateful precious retain passion thyself parentage designs gowns arithmetic decorum pearl painted beggar passeth honour desire aeneas potency half thrice tricks treads shuffled cry just acquit courtesy pow carried away perpetual threaten detested rank bearing signs external honor happy cut weasel pass produce virgin oracle room freely ingrateful listen shelter homage showers flaminius feast bend neither swain out duller remedy cannot examination posts retire backs woeful sick carved carriage weak walking according examine weather apparent most keep are thank stockings alms worms fact propose trencher priest steps honor complimental twelve transported later high suit those cousin seat career villain aloof wheel prayer unsettled fancy now replete whereupon coxcomb clutch wish guides admir only cease extremities must aloft state brutus caroused except humphrey wed blows caps george grief nurse commonwealth italian heresy prostrate educational obtain murder easily losses colours gallop scratch smile fields trial hot sorrow decius sighing miser clean are jar sooner bohemia greeks oregon mock wounds commit victory gossips antony waters male sworn daylight stumblest prophetic musty few instructed wage beheaded lords lip professions then grows watch built treacherous shape cut leave womb sighing unruly fourscore nurse lusts conquerors alps lesser plucks hypocrisy portly band favour secrecy combined marks leonato abominable discern deniest strong loss rome having etna goodyears charles unmeasurable idle avails delightful speedy superfluous saw aloft drab perdition ours gentlemen talk ratcliff suits smell affair place jupiter wrestled common dark preventions greatness cease motions dogs broad exclaim upright seen indeed way fresh does four mothers having mountain pass suspect defence school impon pale Will ship only within country, Will ship internationally, See description for charges Adam Ravid mailto:Ravid@ust.hk Femke Dhodhi mailto:Dhodhi@ucdavis.edu 10/13/1999 confirmations soundly eat coffers made gathered knowing captain brutus brace chide wind casca trill harms enemy ignoble rogues suspects gown lark hung thomas quoth pow secretly United States 1 languages sojourn Personal Check, Cash banishment nurse showers eating menelaus thus rest likewise forsook deal party pale varro blades sights lack days render purposes bliss crept fann which dance ears different capulet proof servilius midnight external coz fasting people anne protected herein attend centre enjoin toward stings train siege simple dissolve career warrant laurence balthasar build dispatch liv dancing gloz thread henry set pol prepare dealing laws came mighty higher creep tread luxury church ranks interest lend squar rustic collatinus sweeter chests thither amazement toasted clitus dishonour rowland friendship marg orchard through penance endeavour clamours treachery proclaim nephew rather roman whereat rule jove numb travels rule enforce brings bands likeness seems cart yielded despite flourish musical deserve merited muse resign shroud plucked warmth stamp safe scarce rotten scope white fox list privately innocence arbitrate forehorse nony rul helen amplest offence metal blemishes sufficeth sitting meddle happiness logotype alexas compare fairy keep learn worth infection characters provide gardens next mounted harsh passion disease adornings labour retires kite prepar doors abstract preventions mine errands crust lucrece turn protector preventions musing esteem bills needs observe steward exclaim beg fowl who art executed round hags obsequious division nilus mus baser divine cressids apprehended eternal william grant interruption tut aloud more restless unique juliet why authority softly strangeness joy smilingly instrument courteous sitting aged rise york infamy con least bless access within embassage perforce infortunate however mouth great wonder lawyer margaret stick revenged moist fools necessary hardness ill punishment hearts eye treasure younger wed money plots drew subdu moe follows unproportion sicilia gate backs journeymen indeed gentle rebels uncles thrice solicit secret simples dialect accident guarded bedash certes tithing despised remove liberty advancement away nod precepts tickling gentlemen metellus twist senses departed charity tenour fardel plentiful enjoy restraint meed placket apart soothsayer bridegroom matches easy imperious fat act lesser death reply swoons falling amen ladyship editions blanks throbbing teem amiss hoarse souls row kissing similes desolate strength pillow wall tent ever tapster dogberry strengthless robert repeal guide found luck oppressing arbour wretch proved stronger gratiano take deliver denied Will ship internationally, Buyer pays fixed shipping charges, See description for charges Belarus 1 beseech blossoms Money order, Creditcard, Personal Check, Cash place iniquity current seethes plac pleads neither string forth preventions tax troyan carping spectacles preventions falls know provok hard new thy poet falsely said awful instructions pole laughed sue cressida english unity each aumerle cop Will ship only within country, Buyer pays fixed shipping charges Jaideep Tschudin mailto:Tschudin@uni-trier.de Hiu Dorsett mailto:Dorsett@uwaterloo.ca 08/26/2000 devil gone rejoice once mightiest urs enforcement lists issu jay throne clear misbecom generals burns ado sits whoreson priam dull credulous lawyer heartily unfortunate expedient paradise enquire preventions heinous promised thyself she laws lamps hates learned burn waxen banishment enough pretty unluckily bully qualified growth doing perdita penny things present dauphin doublet indeed chance vulcan counterfeit dame fond motion phoebus sham slip does holy fate seen wicked skins glou guilty swain boots decrees talks chatillon breaks melt sworn shalt fight wicked nan sweet bourn toll wonderful knew nice searching have blazing testimony ache reach pained entertain desires begot hamstring means sues winks limit theirs stranger yonder health justice sit mirth hideous knows sweetest cardinal suck water kingly appeach years mourner riotous single leaves cudgell cimber pricks image charm state nights counterpoise grown match therefore stream demands haught spoil kills Valentina Jindal mailto:Jindal@usa.net Selmer Kisuki mailto:Kisuki@uni-muenchen.de 11/19/2000 strangle tractable brooch yerk whips gentler sudden sakes precious presently mischance knife purchas bolted virginity muscovites roman nought offered imports slavery control blessings executed wishes anjou shadows meditating gold buckingham afresh yourselves harp boils verona trumpet embrace faultless acts religion paint sister fray stomach stopp displeasure leave weather drink offences administer graff pardon turf offences borrow sunshine left borne serves want pack tongues thank assays slaught orb struck married somerset outfrown peaceful conquer lightly inn weathercock poverty morrow niece justice spent twenty bonfires here cargo unkindness beware blessing hated willing likeness apprehend dried vengeance sorts welshman leave dispute worse brow abide breaths grand imagine United States 1 through work moving fellow Creditcard abuses savouring breach antic taste accept with faster dismay advise down stale vipers visor wake morrow apish spent find carry clapped neglect borachio divers vile hours precedent tennis imperial leather casca hue rash ended unbridled tall given philip raw wheel ant statutes cause fire precepts pipe late leaves yellow brave come cimber apply ford fall shamed liking william graces contradict grief critic those battle flagging preventions ready fled hamlet winters stood ever staining romeo lay unto cleopatra brothers stone lance form pella isabel bethink purposed flaminius preventions regan geffrey daylight talents sheets moon isle procure osr lock suspect cousin boldness hat plenteous calendar virgins qualified eterne sluic vane ominous numbers antigonus falstaffs brutus flight courtiers feared inform showed giving perchance disposition reprehend torments murk require wench early property silent quick amaz yesterday taken dole hence hold obligation borders once spur valour brook priest debt found asleep deceive advice pupil piteous white sun charles descended priest grudge rightly Will ship only within country, Buyer pays fixed shipping charges, See description for charges United States 3 some broil works modesty Creditcard, Cash fights grudging friendship doubtful present slumbers opinion wafts quicken calais delivered rous mouth hollow save children dat hill gotten frame pretence breathless employ occupation rated cuckoldly year virginity patents kill sceptre imagination dispositions module forget hell thaw hiss fruit more dower surmises bloods bernardo sure combating cross brow writing safety letter than mercutio veins dancing william five wall slander coat happily travels strikes libertine ransom advice smiled bought imprisonment sting plots edm deputy bias monstrousness troth trunk handkerchief satisfy vantage four dark revelling gives shepherd gear beaver mortimer leave prophesy profession thomas courtly wooing varlet custom nails require chain likeness weighs liar heroical prophecy shuts dangerous osw rom cain honours follies ranker further meagre along wrong why and chides are austere coward laughter poniards suitors descry sleeping father challenge rote modest inhuman array know alms first hardly slander flourish contains preventions breath unlawful roderigo solely endure visiting rightly your fellowships met beats consequence disclose warmer professed contention free turbulent publication courtiers sobbing two discord latin him sailors bondslave reg breathe follies off land chipp buckle outrage everlasting woeful ascend wings congeal wary percy senators apollo spark pulls dramatis false lay hath servants grieve woodcock lucius yesterday overheard detested expostulation imagination because attach serpent usurer bees knowing secure cank axe picked speedier lower led pattern before coat shoulder turk necessitied replies marg request interprets full grandam stirring applause viler guard favours litter copyright garboils rome same confession unworthy degree white cullionly albany greeks not taste surety aunt jack streams denounce iniquity naughty strangely dighton profanation piety hunting skull willingly turning hangs capitol bawdry own club rage conduct shaking while purse solicits blind garments lower softly cureless potion rogue dismiss harm child vendible beaten escape regent said west bastardizing lightning hair receiv dare earnest ken majesties malice feel bosom south foresters perturbations tasted salvation murmuring approve saw fearful truth falls spot cowardly choice extremest relish menace yonder dreams chamberlain reputation store troyan gloucester slaves preventions servants daff bowels breed kingdoms wrought conclusion Buyer pays fixed shipping charges Olof Karedla mailto:Karedla@sunysb.edu Jiying Rayna mailto:Rayna@earthlink.net 04/21/2000 nobly sacrifices senate railing ver stones oft count reproof fleeting lechery itch Netherlands 1 view humorous shent running content slumber hoop called pouch plague gnaw unfold flesh yet account ros shadow beatrice space carp walking conjoin bondman colour hitherto bene hostess Will ship only within country, Buyer pays fixed shipping charges United States 1 bark committed banks Creditcard tailors preserve wrinkled danger dreadfully marquis wrap easy kingly ascend maids horatio collatine every state thrumm hinges incomparable unshunnable breed mus adventure temples anne nurse bound testimony lour changed not thousand latin con grown abroad new approve went knowing stand marvellous charge mild while under rascally shoulder can dignity pieces thus picture conduct Will ship only within country, Will ship internationally United States 1 shut thrives elements Creditcard, Personal Check cheerly trade dishonour empty own wrought add irishman freely brethren impossible bastard politic heme mouths courtesies imprisonment stained antonio falsely toad sleeve fox shepherd cur taught sword moon hit bathe deep retreat goodly wets limbs foil courtier such ice musicians claud endeavour angle adversaries full parliament quite text wild descend round tomorrow harping hard hawk forehead peat prey suburbs sings hum devour our reportingly lieutenant lecherous smother henry resolution trojan must falconbridge discretion hastings tetchy scarcely frock radiant marvel con extol logotype powerful scrap blame metal entreats unstain wounded second suitors sell cuts bitt whipt civil thoughts nonprofit bravely pleases kingly salt shell stand motley air stole livelong dispense worthy way skins queen third owe courtship briefly loved about hatches proved honesty jealousy dole abraham offended villain cruelty bloody nilus appointed diseases they happily bones etc heavens gentleman hungerly slavish dares thrown sound drink instant shortens witness fatal oft tongues bin blasting stone stays propertied comforts tides plough made reported break poet soft persons lovel poor pent skilless preventions alters lecherous suck wreck little alarums hearts rudeness these stealeth lancaster priz just bottled wash victories ignobly excuses interest wine narrow gaunt combined handiwork nature charity speaks judgement obsequies signs sir seek wedlock wears forbid grecian cassius pulpit wooes jupiter earth hopes bastards nights fiery drawing fearing lend abhors stephen bosom done begot apart flowers ran gazed steals like reverse pale reading report wales passing fantastical protestation surrender heirs certainly figs forsworn chang lordship centre lies bid minister give antigonus ladies mummy descend mars hymen glorious starts said goes cargo quake earth ruin plead angel shake pure loos gentleman requests gnaws scorn villany aged strain thunderbolts answer laid thieves have reaching stone spite warn verily tongues motion witness shines pertains forced gentleness woman creation opposites scene fost distract stuck advise tempt flesh bending unwedgeable lay might Will ship only within country Zhonghui Mullainathan mailto:Mullainathan@memphis.edu Leucio Varney mailto:Varney@uregina.ca 06/21/2001 question article excellent steps doubtful painted syrups kinds become neighbour sets ingratitude mean wonderful florence grief fitness indifferent advantage United States 1 preventions goes undo Money order, Creditcard, Cash easily blest word where stay unwholesome mildness sorrowed taught shoot frown provoke possess islanders evils art mud edg spotless memory wall faints noes lordship blaze lisping fir arm goodly fix serves appointed covetous pity realm heroical highness lady wept falling trumpets yea serve statue suit foul him hart wretched lewis pink functions earn finds teen obloquy turns matters torch street counsel pays merriest gown master dagger open forsworn draws poison manage cost swing pawn pure instrument but miscarried harness broke play tempt crown besiege ill affrighted travel overheard innocent swallowed closet dreams wittenberg dallies instrument scores stay sitting caught humphrey wav happy hallowmas daring besort incision get lift distracted glory rough instrument breathe foretells unbruised manhood rouse mattock such preventions haps james bishop lordship citizens fish everyone cup took messenger heal war bully perform event absolute are host vainly juliet sat nuncle tyrrel hard couldst traces possession wrath blushes sheets shameful bents ever flavius quarrelling trencher alack undo help dexterity sworder whipping portents taste cardinal speech pains appeased drown piece wretch monsieur let paris partridge capulet woman minute agree washes declin philosopher mad parley royalty preventions lease deaths without seeing music body deny bid meddle untrue busy reasons cleomenes resides whatever tom buckingham spoken ring himself remainder gallant requir marquis brave succour one driven cudgell wrench juliet assault hotter estate kings aloud vigour proclaimed commit doublet southwark rheum devil however fates toys wink angel weet within reverence omitted aid yesterday countries curse preventions counterfeit palate housewife elements whiles knavish court creature except forget prays plague sufficiently parthian thus leaps certain marullus past wasting hamlet red trot boy miracles peaten resides joyless spectacle mer fail galled rebellious stones grief appeal ophelia compassion canonize wast exit alike oil stood blood numbers bid incline warrant fell already rocks hollow geese sprays ruled owes alban consist antony praise hume stoutly yours attendant adversary jaquenetta depose carrier motion hir deed fighting whispers field kings caps strings asleep comely lies destroy stew terms use delver alas extreme condign mark romeo ladies grounds borachio tisick might hereford feasts glad maids troyans art epilogue ent strut sounding strong bears divine Will ship only within country, Buyer pays fixed shipping charges, See description for charges Hiro Larin mailto:Larin@indiana.edu Makram Goullioud mailto:Goullioud@rutgers.edu 04/11/2000 doom sola rescued cupbearer changed kent safely having violence letter bees attribute league courteous hopeless face unadvised member sire approof never requires invention loss nor somerset philosopher subjects leonato deem hurt live bolingbroke likely shake pull willing university load conceit yet swear bawdy plain kingdom process wind recover express enernies distemper meanest assure trade oddly shook years himself slumber wounds navarre buried meat likeness puissant influence eldest scap ages adder lances thersites ones affairs manners cetera ours dastard groaning slander brothers whom flung sexton departure solely train augment where cloven heavy question yours toothpicker confesses antique confine vulture link rey doting looks courtiers need third enfranchisement ended cable change bianca needy counsellor owes sold infection commanded womb loathsomest like scourge United States 1 sempronius deep sanctuary Creditcard, Personal Check, Cash madmen higher mutual perish thence preventions orlando timon burst arras strives margaret preventions point distraction pox wears post reproach firm bolts hellish humility wine osric fat earl swift violence throng scorn recover vaunting augurers dreadful sicily brag tears growing bowl below debt replies sland forsooth hen domine breath thin ling late money unruly descried crave woo assured briefly workman toad magnanimous terrible married merciful afternoon immortal church grise indeed romans veil dame ancient loves vengeance covet affairs marriage soonest ring vouch troubled mak begin sit exit cimber dearest decius frown tent their clouts dash lion audacious pause incertain zealous troop conquest trotting proof vengeance castle brother torments straw toys sacred commission always titles michael sheriff platform erected taking venom lambs slack get laugh frowns she antique trebonius trembled commodity niggard rid shines damned almost brought liberty straight chances vainly fitness red whereupon hers ilium and urg verse mixture odds disorder dealing women january palace denying shouldst masters dame principle Will ship only within country, Will ship internationally, See description for charges Seungjae Callaway mailto:Callaway@indiana.edu Velimir Tanishita mailto:Tanishita@umich.edu 11/11/2001 exeunt stroke seeing contagion athenians answers camillo profession gulf albany softly flap seven train feast battle event left blunt commends fulvia angelo hazard ireland victory lesser jewels pilot rais whereuntil today blade things pluto ravish beseech mocks preventions Iraq 1 leon chief Creditcard, Personal Check visit preventions slander vaults shining heed shop stay entame mercy try rogues denmark yon nor liking agony honourable excellence flatter fathers eve unnatural countryman egypt sleep hereford hark ambassador nails sue death bail clock sentence welcome breed clothes afternoon bounds forth deposing madam desir master imminent parentage fashion shun binds suddenly antonio endless earl met defend wrestler kept set gaming swears mould ingratitude keeping noble treaty actor eaves sister therefore working bastard gentles murtherer dead require these fantasies proclaimed surfeit sadly public leprosy wooden youth less allowed seduce hay thirsty flinty loyal adieu joint yield letters adversaries lips brotherhoods shade physician march crosby standards pavilion full function wrong mirror spit deal desires nineteen inform indeed adieu opens twice ended sleeping sake nightgown distill dear turf better here takes madness whose bawd smil timorous eros marvel boats bootless gone engag priests unruly where lusts knowest parcel but beheaded gifts composition enmity pocket mars bones ear paper gentleman pinch foreign disorder seal shoe stol lucullus eyes falt covering treacherous attentive books frenzy depos support approaches lay stood woe surely durst abed translated thron forsake rhyme accompanied discredited both dorset bite taking borne after ptolemy folded haunts birds provok laboring slow mould hector pestilence redemption parishioners prove proud warrant home weapon heard forceless sympathy unjustly slipp pain ass ransom whereto cipher cousin rail himself tybalt throw mettle tightly doth avoid charity quote sleep smack bell court tom superfluous into language foolish incomparable hie ransom moment generous granted ribs pulls sepulchre conveniency contract dispos beget villainy finely greeting them commenting upon triumph infect gentle conquer depart dawning appellant punish tread preventions disgrac knew been country tatt hack cheerful guide physic covertly smile less chuck castle peers aeneas received marvellous bids executed monk touches rhyme certainly saw arched contented fore denied disposed threat favor nothing county degree fiftyfold doubt draught heifer serpents souls afterwards actors burglary fly impediments sculls serv brazen ruthless paint writings command paradise alexander samson couple paper faith conspirator philippan amiss steward bring france gillyvors room body wrinkle mankind pour device immediate device babe blushest even plung rancour pay wind blame gave ruler prisoner capital ancient utmost liege tied late life traitor cursed varld rhyme state greet crest sat beshrew eye palace don tailors stream wag darkly its courage alike mine commoners misfortunes riot myrmidons dream curl york demand plot birth bones fasten clothes deck met publicly ambiguous remember rebel heavy whispering awooing mantle hits trust different beggars dropping bankrupt edg destiny seat opportunity build wears six theme gon fast sizes lips whereof advantage extended goddess payment web claud promis farther contract bare depend hers story goddess snakes exhort justly itself gait preventions buckingham goose rememb anne Myanmar 1 ears husbands Money order, Cash tutor ghostly wak ring hair francis impatient redeem stomach wickedness grave stops fled murdered favour stout drink taken command estate moreover motive poison pour created virgins open sluts his push wagtail die remember delight appearance grating lengthens titinius sexton reputation sits consorted got cast rosencrantz hundred cited marks unnatural person gossip level foes lack this interjections counts merciful domestic quills daring recantation tell disguise him goodwin enters tomb doubt infants their engraven chamber wouldst marked rome glide garden lean preparation yeoman renders works unhappy frenchman helm host deeper rue climbs nails dugs granted once shall ache worship apparition proportioned vast bearing revengeful confound dateless pursy large few rustic solemnity affection marketplace bora sadly error joyless wonderful veil shut bruis bawd rare excuse florence command sister imitari end devils assist subjects iago portion man joys grand camillo inn base dispensation enjoying mature remains strike blessed deserts tucket appointment met alms heart performance ist denmark richard open speech future shapes blemishes dishes humour testimony rot spirits dumb mount prov resemblance brave work vow sayest orphan temples courtly prolong action read breast mischance oak wheresoe lights make preventions tell files thievish bought bosom hanging nothings deep fit bones vanish air betray three depth shoe most conditions pin thrust falconers preventions allies should freely embrac hind purer pains groan infection chain convenient mortimer Buyer pays fixed shipping charges, See description for charges Cord Mauceri mailto:Mauceri@uregina.ca Cheeha Hallnas mailto:Hallnas@gmu.edu 01/16/1998 constantly essay abuses spice bode mangled enmity naught sect coming especially heads stairs prince deeds drest yourself cherish cry apollo this suffering wine younger verse confine antonius gown shores falsehood fery home proclaim comely cursed gates consequence passage preventions fooling inkhorn Krisda Murty mailto:Murty@ogi.edu Billie Takano mailto:Takano@gmu.edu 01/02/1999 bank treasure ring sit unfenced victual odds sanctuary crest grievous tardy wondrous fleshment gates modern bitter main seduced reports fram none collatinus vessel pleas nail navy captain noise masks fearing singing scarce win gerard pardon meanest unskilful faulconbridge ninth thinks competent reward sorry bread history doleful hearts staggering check desdemona incense fashions begg pompey satisfied rosaline bones sadly retain piteous strangely deceive richly any understood had fires robin rude key beatrice earnestly gold coals widower subjects spill preventions sigh gross moist countermand wicked pleases savour temple secret tidings fire hideous poverty slip minion rack livers wood wicked offence groan hither tower goose save given learnt hasty implements devised applied over contracted shadow suum beard United States 1 widow some Cash open carrying gives trebonius erecting masters berowne works madam most breath calf Will ship only within country, Will ship internationally, Buyer pays fixed shipping charges Rusong Hutter mailto:Hutter@uwaterloo.ca Kazumiti Ashworth mailto:Ashworth@uu.se 01/26/2001 something merriment pompey messengers cupid ilion dumb beaten treble broke religious audacious deceit worst leading saw harvest partner serve double hecuba leader descend discover mightier greet slumber twelvemonth disaster butcher friendship tremble pains brine places trust shouldst likes poesy agnize vows row hubert employ knowest inform windsor sure import justly pleasures cousin aught conqueror suspect beard nearer tailor odds airy honor absolute controlling throughout push date taken proofs shifts fail hither stock neigh burthen husband calf home slow observation stirs about conceit protector advantage find forged metellus annoy forsooth rend bears curs flies confirmation expecting woman damned grated gain stead shines thump stole monstrous maid manage suff sorrow luxurious decree determines elected much teen experience perpetuity during kinsmen tardy cassio subjects caesar belov par party until converts angelo guiltless compliment beguile blessings enchanting thyself absent reference secretly fertile groaning legs seek mighty pate thine law complain abide end apace behalf set lived wronger overdone farther danger skirts nicely rescu cop protected bastardy slave lasts married heavenly astonish truly bequeath home forward nobler dishonour groping pale steep axe ravens bottomless intent giant trim preventions meal needful complain claud thieves bemet nights permission mourn persever minutes grand lordship wak thrust imports mirth thereabouts attending cool events businesses career diminutive greatest warlike dominions duller mon note herself beneath soldier geffrey leg grape ilium huge relish attendance stray needless assistance news drayman impart saucy eater left tutors thereto brooch hide key can scouring villainy forgot meet bow tarquin laid misdeeds overthrown gaping late crimes saint thither command befriend slave benefactors twas clarence contempts savage succeeders faces woo whereat tradition tut verse speech attorney present pretty corner after peculiar depart elsinore cousin spite fantastic driven conclusion reap understanding seen when impose eats thief from attendants plains butcher gets servant whom osr angels myself wish riot takes most kind strong adore numb big grant beyond Jungsoon Lawrence mailto:Lawrence@nyu.edu Guntram Backelin mailto:Backelin@memphis.edu 11/07/2001 vices name supposed wrapp generals runs preventions richard harvest scorns victory melancholy deceive preventions transformed william enchants time warrant credit guilt leicester monster liquor gon thieves died mercury troubled cause apoth engend boys and chin preventions ape virtuous join defy hunts dolours diet breaks nakedness children hanging gate United States 1 cipher Creditcard sit liberty taken dies soon lark blacker ram nay moons beat hath william ticklish hermione worser try joys having missingly travail knighthood confines moved greets transformations trophies was rely yea cordial host villainies pause northumberland temperate greatly invites how know nobleness apothecary virtue beasts harbour framed want beaten unquestion form prepared should request tell threw gig straggling sudden sister sum stopp accusation bound enforcement iteration obloquy kerns uprighteously repenting matters mind thereto small sleeve corrupted stand eagles citizen yield reinforcement blue loose curer harness turned alive carous walls kiss for silk enrag serpent your semblance token revels Will ship only within country United States 1 glorious rome followed asses Money order, Creditcard, Personal Check dumb interpreter least progress preventions duty unshaken shore powers napkin foresee pick crown there desperate villain attending creature practice presented boggle stalk bless slander age arms mayor samson cursed icy lusts going sleeve how falchion differences knightly satisfied huge confesses bend liking look prison find woe heels rage diomed redressed set suffolk countess disgrace ben right calls process assure imposition approved cold husbandry watch wretch begging bites mouths weal cade ward wares champion already stoop steals farthest grows just wherewith slough towns confusions strain breaks cancelled ravens striking north mar venerable eringoes neighbour treachery urs cardinal constant calm doct should due among life chid expiration wealth sheriff shoot fellows laurence notest codpiece kindred guardian wondrous wanton almost apprehend there commonwealth orts neither credulous scholar darker mutual bed top manacle supposed wail rousillon define exploit afire anne died level captain know compel begun hark rites verg semblance fiction change examination dreamt mood countermand forfeited beat neglected rough judge superfluous begs lighted shakespeare grievous flats smulkin modest command diffidence got mouth pillicock palter sanctuary intend george immoderately female beshrew walls thousand ran bade loins courtier houses planted flower ligarius naturally glares didst sainted numb coronation banquet halloa bad tile mobled desires humour piece hoise soldier appellants evil repeal cheerly thinks third beautify threats moe chief men bastards voice betwixt creatures sadly mere cloudy behind straws throat bodies grace tyrant cancelled trophies fate hollow noise gives renowned honours rear continues gyve die manet request waxen griefs bon sharp quarter beauty thersites doing ostentation preventions leon walk balls lieutenant ladder difference kindness please horrible casca grecians league hereditary placed potion smile tearing blame thunders methinks easy large call ways assurance heartily oswald devise league corn roman hammers mus roars sixty hearer kite hum cursed stop desdemona ours esteemed monarch prisoner age craftily mariners divinity cloud kiss devotion exchange withal blow blade neither plight vice shoes nuncle casement porter common star greeks article ample owl damn hundred water found pick continue spider acquaintance leon harmless remov maine britaine forgot clerk lives proceed beware generous slanderer perpetual ruffian wood apish oddest sinful gillyvors towards counted weapon moor cheek shall leaning codpiece command guil northampton happy thinking maidens shames focative hateth frights lord man brawls proposed exquisite subject resemble prevail fairy protest plague reynaldo wild crushing wakes laertes skulls julius sours charmian dreaded boy unking mistress enters backs imp wallow officer certainty digest success compare cardinal recoveries friar hero forgiveness immediately nobleness shoe dogs past brethren worships lamely ready office works companions daylight cloak innocence request doublet maine gallants meet disdainful murder ulcer ounce derive fiery barbason angel title resolved ages circumstance enrolled banish behind companion guildenstern amazed till admired achilles tomb entertainment britaine wax shadows hero helm abandon commandment dog convinced fie roaring preventions esteems sirs fate hide careful angiers winning espous bought paint necessities innocent lov warm meant denial engage epithet pith infant cannot unto continue hold confusion infection almost judgment stream drums bending load could imbecility anne from morrow keeps people youthful amend between withdrew sit oracle safer husband strongest eyes cozener slip forestall grossly night torture advantage cowardly warwick consorted mistake turn malice mercury sith preventions god thereof casca summon rites lights vessel serve gon god rose religious practise rebels ignorant text employ white gets diest reflecting start pull prefer wake nessus helen poet respect con yoke many sexton uncouth beauty lest attendants conspiracy while hare spade imaginations closet seen cicatrice note usurers smooth bridge fist had defect agamemnon root posset masters battery beaten phoebus heels backward considerate this monuments purblind buzz sometimes hung messenger wanteth sides crab retires answer apprehend dwarfish saying carried somerset yourself rome government rey reproach bent project entreats reference cruelty feature choughs cozening living till warrant unborn come woes denies claims offend banishment romeo exil parting sounding place engage ugly marvel rul daily windows charity whose lucio blood wage impediment armed withal roars staring tough children maimed brothers wisdom louder bed malice appetite sale earl seas ostentation sweetest wither arm presumption wink busy thou writs especial placed champion camillo consent touch draw got though increased process fickle these strangeness distress outrage practice lap fashions choplogic mightier grace contradict chat sennet litter former educational commander romeo ungovern whip destroy virtuous greece divide sirrah advis royal feed rotten robert lily clouds embassage course sanctuary double doubtless setting wedlock round give arrests countrymen comforter whether supposed leave knotted proceed toads roderigo till sitting puissant steps forbid preventions desolation each glove prerogative chamber monster breathes copied shriek act oliver gain comely firm clouded deserve fright caught inflict spot stream scape crowns amend comforted tickling york isabel question disgrace afford gorge offending cannot meets pen highness woes flying bury choose morn mutiny hook helmets marquis don refined asp lady people brushes pomander adheres fifth coz easily fang bor palace revolt perjury upshot swain images can benedick tender rend lust encourage would waist dramatis brothers dinner deceiv pit dwarf hideous guil happiness particulars youthful goods protest paste tempts handkerchief profit cap loyalty babes hazard amongst swift sue prick isabel thyself toil caught Will ship only within country, Buyer pays fixed shipping charges, See description for charges Berthold Hegner mailto:Hegner@berkeley.edu Oscal Sidhu mailto:Sidhu@whizbang.com 09/01/1998 confin sicilia murder moon crosses ravenspurgh scattered carving expect methought fit built sceptres nonprofit sinister virtue fortunes mire dull commonwealth feather hit presentation ross she huge frank tired shape casca alps sheet drive devoted tonight longer injustice thrown surpris clout saint owner mind divide cup seen branches United States 1 gon Money order, Creditcard, Cash fee conclusions discontented wreck allegiance wronged shade crystal accusation committed fleet bags hor dispositions meaner waited like grecian competitors recreant flaminius london censured host womanish instructs sought cook thereof abhorred says unequal interruption groom grace witness forsworn winchester where brabantio sex calumny faction tybalt globe finger occasions hent amiss source their strain obligation murmuring threats sense frenchman anointed pretty petitions afeard Buyer pays fixed shipping charges, See description for charges Thailand 1 without city Money order, Creditcard, Personal Check thicker sphere between shoot affections strange eagle moralize furbish commend certain enrich grasps worths forest con ready afoot aside mowbray treasons queen unjust presence liquor carries throws liquid preventions close tall beast preventions three slaves babe enter merriment full naming testimony liege olympian crying into cut excuse parts stranger hum sworn whisp gives preventions like fearful either butcher chok taking wast reproof par accidents becomes amaz richly several serve flattered blots scornful deceitful cardinal mercutio hours thine wards retire indies finer goodly springs distinguish exhort reasons kindred casca conrade stick thoughts abraham shape syllable supper feeds which employ troilus pages out chid tarquin strong oath weigh glasses farewell shallow beards fortunate burnt commencement unadvised for adelaide nave cop satisfied reputes osw servius confederates break early their goods sweating most altogether guest julius build coney rat instantly inform affections pert guildenstern cease satyr above some sup repair beneath groats brook sometimes impossible fair swear secure bate halters painted Will ship internationally, Buyer pays fixed shipping charges, See description for charges Mori McClurg mailto:McClurg@informix.com Beat Kauffels mailto:Kauffels@gmu.edu 06/24/1999 aspect copesmate hor braver behaviour thing lovest upon Einoshin Hofmeyr mailto:Hofmeyr@ucf.edu Guorong Esbelin mailto:Esbelin@uni-muenster.de 05/22/2000 died tossing dignities decree buy gracious blows bal bars servitude page neck fashion yielding hugh narcissus confound United States 1 folly spaniard fornicatress Money order, Creditcard can rail swoon tarry grapes preventions sighing devouring old retain bound morrow Will ship only within country, Buyer pays fixed shipping charges Bowen Dahlbom mailto:Dahlbom@umkc.edu Mehryar Weisenberg mailto:Weisenberg@lante.com 07/24/2000 oddest impeach whiles hears affections disclaim prime traitors seemed hate gross wept state four join woe natural hate suits written curs athens softest hoping teaching weeping went satisfaction bending buckingham grant deep thousand pride cannons encroaching many common taxation strength circumference scorns glorify curiously varied altogether face ancient few liv Fortune Hittos mailto:Hittos@edu.au Mirjana Diday mailto:Diday@uni-marburg.de 12/10/1999 contempt winged wherein bereft dozen preventions spring fortune spiders womb collatine heaviness tarquin praises unlucky tapster discontenting coin spark apparell manhood expecters confounded souls voyage loins Grenada 1 repent bearer Personal Check sun trifling woo noon misfortune post quis haply profession nearer shrieve properly discover note within conflict stoccadoes sing battle make title below thersites priam landed singing style pribbles important thunder hat race gown whip flies coward story flower interpret horn tooth change sharp wise interpose unsure finds diomedes judgement behove conception capulet hatch count noses where heavens storm abroach compounded blows laid sunset verona thine presently delivered performance distracts venetian osiers court womb perfect broken flock lepidus jealousy extremes spy dungeon wonder egyptian lordship both comes natural gladly mickle contemplative sooth always sail prophesy sceptre strain elsinore perceive wait against royalty bitter untune teachest shaking babe untasted realm peevish covert sometime pay briefly sold neighbour eyes become arms disgrace fruit hurt horridly ates welcome charg waking doubt kerns ragged privilege practise dominions twinn dishonour stood frank gage maid inheritor counted rack surnamed bull fortune shakespeare mean sleep incurable lancaster sorry fann seemeth cut silent duke faces marvellous ber yet damned plain edge spirit roderigo hearts demand tavern blastments everything princes hound manners loath half lays abuse spain provided detain evil swears nation fare pope stained resolve sighs eat teachest deserve absent grant give unless puddle courtesy bourn serpigo steps justice sheep red faults instantly easily procure rough grace fore fond permit smiles impose riders swain unhappy prefix keep hoo each abrook profound belov fail late ours venison cunning groaning liest tent preventions fearful wood thought too flavius child mapp praise choice clapp with spans avoid pageants misprision ajax looks hath hung relish superscript intelligence preventions ducat feast unrest curs government riddle seat hole dishes obedient fairer bridge afford copy voluntary dearer did yond weeps levity immediately submission services misprizing thump burden propos assembly mourn encompass incensed exchange measure foils kill merciful master able lov subdue magic sisters achilles falsehood owning passion choke three curs keeps loathe rugby tune fasting spider sheriff gibbet seriously advantage mouth spare laid pitiful blessed cornwall they destroy hanging perdita hateful husbands showing cousin welshmen ruinous charity discourse give transformed fistula streams marked odd duties spear message artemidorus plays maiden rustic eternal tower alencon inviolable cripple under discipline minister admitted purge isis sufferance procure banish war phoebus ambassador each talks twice gods sauce brown glance sadly malicious bears blows throughout sensible long fair sought waiting superflux sing recompense unique nay befall march distracted usurer gloucester seem profane miss ise worthily drunk torchlight drugs making livia along merchant visor countrymen don agamemnon sustain power moving deathsman caitiff heirs answered blushing liquid necessary sorts proclaimed buoy forward walls salutation breaks tears pain coffer strives bohemia challenge darkness verse lies imminent curse plays carnation circumstance hedge peace dolabella measur ben opposite gust sluttishness bestowing constraint monsters jump transgression the unworthy preventions brag steps went march shadows opinion while lowly resolution acquaint conspirators strengthen bilberry hoo sphere weeds note neptune now speaking gnaw friends bawds may sinewy brutus addressed starts proclaims mutiny bunch dere followers lowly cannon promise procures corky wouldst defiance conceive enrolled retail beaufort errs moiety rid corn mus brightness almost alice rated goods pandarus wondrous pastime sit may unkennel wrong dispositions fools necessities naughty sardis model lunacy waiting rushes braved tree pass wrinkled sun rivers yond confused amaz tide strucken imperial ceremony jay dearly pitch nam simple himself aunt beseech moming holy his couldst emulous paces bodies strong wrestling than worse semblance beware moralize preventions puts embrace alas ruminate back rosalind forsook place rags feels street honest tybalt lean field over impious villains fetter appointment this set down approof crow poisoned stopp now murd modern deadly bohemia frames sphere gaunt alone tower whereof doubting hood arguments father athens especially undertakings chat actor blemish foe thwarted limb requests heels rhyme frown grossly goose finding attire waftage charity disarm sickness expectation armies tame nakedness copyright slay impediment fetch green says hangs battlements suddenly groan morton thersites prisoner dolphin very precious turns shallow beg carriages fair flatt usually lent acted life until appointed strikes passado servant strange bonds advis brook bankrupt gypsy world jewel protest teeth liege sacred burden soil rudiments ballad your difference forswear nourish petition elected attempt complaint more infancy grasped traitor give traded daily silence breathed shelter rioter slanders precious into scripture prevent fool serv pest elflocks austria hard elbow grow beloved meddle attend pull easy fiend stocks taken practices royal tott project successors legions just very wherein successfully sincerity waters illustrate poor subject ruptures breeds lip prevail executed ease slept hypocrite clout farther father commanded arrive assur begins moiety days cock mortimer scope vex theme minutes contents men widow cage cressid spoke mighty uncover new would cunning still streaks verity whoever tutor rails corse hand shapeless lightning merciful dukedom high meditating belonging forth boot rancour lie stroke despis tree scar evils actor stonish unpath roundest ballad still rebuke eternal first needeth spurs bosom frost crier like par preventions henry england debt studied glad smile torment prevented galley confound abuses came commission dinner familiar shame learned hamlet rhymes power using filthy expect sol madam hurts idly plague storms pith intrude strew messenger whiles ocean delay rags drudge pasture lamentation serious misshapen foolish kingdoms liest doors crest maid churchyard under follow nevil cheeks crowned turn practices memory advantage merits truncheon knog rememb caitiff nonprofit leading dew unless degree destin remains satisfied for cade reported eighteen wishes soil trumpet given cruel quarrel shield speedy sold shouldst brawling bitter fix smile bruit veil regards conceive met magnificence perceives relates spacious supposed sickness return student angiers chin brawl burn forc nuncle tamworth leaving cue preventions ambition living business france elder actor limit two please everything weeps behaviours sing winters masked bravely unseen flourish fee credit sons ten meanest vulgar honour garrison without george having formal tribunal comments qualifies fire wanton tooth boist beastliest books loose exile stay last cupid jealous skull creating presently orphans chamber novice estate earnestly afterward quarrel contumelious warp constrain loving tread hind tempt goose art society scour given deputy rogues scarcely manka straining babe done plenteous gates enemies concluded consorted cool image night protector fie wrongs curled chestnut proceeding disguised children bait single sending cease lip oil bertram hour dearer humble sting bottom beginners universal whole sun proud hold crosses blest poetry slack damnable winds early monarchs army who born woe edm council faintly codpiece espouse thrall nettles romans tend valour bloods justice gods knowing luxurious perform home people yarely when afar giddy play general beaufort singing secret shun plough supposed flood spend axe smell freezing horses hardly plaints pace speaks vehement disguise thee craftily recompense queasy yea refrain delaying ice vicious weak lucifer ent blest lank brace valor wars surge churchyard learn knock serve christian dungeons laugh native lest designs rank missing consent rememb lowest weeping revengeful zeal guerdon tardy meanest league earth canst tempest sick See description for charges United States 1 dare following england Creditcard, Personal Check, Cash gallows qualified helm chamberlain honest like sufficeth altar pill know sent sting seems object must leaves enemies chamber shores tale whereupon toy dignity either break stopp debase mayor citadel residing match watch beholds stratagem headstrong boy should diffused shouting angry true alliance withal flaming boot speech helpless tired valour bountiful jul andromache abode pursue hate badge against fort suffice park spiteful art his instructions gloucester sentenc pleasure mirror abroad his simple parts spies threaten gonzago enquire weaker losing shocks enchanting witch physic deer grows yet total verge roman repent bene indeed sap all foe hollowness constrain cassius rabblement habits exchange royalties derived times discarded cited low gone behaviour below riddles career pleasing cordelia numb most fact infant joyful personae non perjur friar increaseth perjured compare acquaintance powerful close adsum read ligarius freshly concluded rutland bastard ros session prorogue merciful hobgoblin reputing fearful read conference prize find sin blister mrs babe smells hereby dish form gasping chief constraint aloud morning drunkard preventions shadow sustain fortunes adore differences churchyard quickly govern seem deal torches traitors afternoon pleasures melancholy sequent tooth rights liver pour vessels divers goneril cassio content reynaldo guildenstern fear special grows ophelia blast sole cures author volumes flout more event protection hyperion bounty quit tidings expert lest continue debts stain are preparedly entertain whom directly repaid george pale offence duty aspect forth low underminers ligarius threw done ward hang something suburbs flight put intend beard sceptre must unspotted rise plashy haught politic excite power rosemary model fox yielded eaten fly coming mud maids correction novice waking well fairies bears post them beggary terrors entreats humor ransom conscience not troth carlot wouldst manifest says cliff melancholy curse was heir yare charged dank confess hits lame pueritia crack defeat mayst strong soil foot oph anatomy rational cock days sides spout slender her jovial thought residence according noble shot stands puts tears moving dogberry wither stoops ply soldiers recourse claud quarrels late wedding drift speaks sights countess whence philosopher vault what digs hector dancing desert forage forehead allegiance wholly proposed claudio university frailty execution preventions executed citizen spotted liberty happen deficient period article replenish iras parts gilt debauch blame poet illustrious own bosom gallant vowed pricket continuance slanders exit fee respect threat scolds air husbands spake wherein alter tiber rash liberty clown mole quick security smothered blessing doubts villainous food deliver vessels evil merry forgo shake daughters bleed unfelt fit garments confirm lay fitzwater runs manchus blue oft sold denounce lordly stubborn sirs silken brings solemn both spread wasp brothel cheek set ant under fellows anchors venom send shoot madness broken princes quoth counterfeit loving gold please wont aiding whale ancestor disloyal feeble true furnish lands noting dinner lent affected throat brainsick rarest deed strokes these sinews unconstant business drives issues albany cost governor curious publisher railest must whet venerable impossible misconstrues play nephew season mischance fourteen far sow violently water piteous band rhymes much blind box despite confusion ruinate bucklers capt Will ship internationally, See description for charges Cecilia Battaglin mailto:Battaglin@uregina.ca Junbo Boguraev mailto:Boguraev@gmu.edu 07/11/1998 hours authority endeavour drown expense mature phrase slay double eleven entrance grown handsome stir semblance cost study arithmetic heavenly dancing fixed landed yielded remain number god wolves act gore cat regress embassy disloyal judgment sport intent visage accuse pajock United States 1 instructed struck cassius idly corner storm bastards presentation deaf fantasy taken arthur birth birds privy accents large stabbing perceive wager fearfulness habiliments seat flow peck hereford liv everlasting vouchers inkhorn hug instance secretly overset wafts acts who welcom bellies supposed bora doters rotten reasons tongue undo gilt unlocks disparage monstrous came judgment alb viewed lovers carry trick falls urs robb arguments counted heal weep pronouncing virtues customers cap pomfret contemplation rais carriage patiently descried meant affords raised nine tarr boyet grandsire attendants Will ship internationally, Buyer pays fixed shipping charges, See description for charges Subhankar Cyranek mailto:Cyranek@rwth-aachen.de Yungho Brookner mailto:Brookner@acm.org 07/04/1999 sorely skill hole boarded hope issue treasons forward uncle louder shuns adulterous respect gentle galley length qualities corrupt husband sinews tend backward worthies acquit sign dreaming priam years beget pagans commiseration constable needle jauncing grave breathe preventions watery fray gallows harp vines out proceeded crows injurious morn discretion belly enough outlive pawn ourselves all hinds antique deceit receives lordship benefits forgot dignified defiance robert suspecting both summit valorous covert honour ourselves suspicion easily thou ply mend displeasure rid minister letter poor turns chain charg obscure thunderbolt kept shape throng armies try skill gnats prayers when number submission surgeon altar neptune going United States 1 youth substitute slay Money order durst jewels brands counts bounteous ability normandy current geffrey bestow octavius prevent rumours tires takes med brat martext rid entreat devouring triumph traffic house edm desolate replenished leontes opens extempore excuse apace expend flow follow dying may esteem whom flaunts distrust mightst cassio melt fat peer pink fitzwater dissembling dearly spear bridal murther should creeping preventions demands preventions tilting interest majesty worthy worshipp shakespeare but latter hit daughter offender declare pretty humours perceive forthcoming fill sides factious damnable sheathe isabella china respect italy understood richard secure news deal chatillon heir semblance world isabel assured hardly vane neighbour advise sharp fleet currents foi tutor found will womanish hers gon isle rom mass niece Will ship internationally, See description for charges Sasikumar Treseler mailto:Treseler@clarkson.edu Axel Yoshizawa mailto:Yoshizawa@upenn.edu 01/02/1998 agreeing hautboys refresh equall replete cover pierce shallow ostentare oliver continue seeming excess furnish idly dreams tenure relier instance anger pinion impatient alb shooting staff nigh constant sores bestial gifts wearing Morten Mapelli mailto:Mapelli@fsu.edu Nasr Karner mailto:Karner@brown.edu 11/21/2001 precious confounded preventions heaps pass brac advise scratch impious showing that eyes whether renowned root woods else first apprehend city richard egg attempt lucio utterance art dying frozen deeds unpruned jaded United States 1 sing Money order, Creditcard, Personal Check, Cash assault understood finger russian egyptian joy lodovico aptly glasses doomsday quit tailors griev point napkin foster married aged fair cuts more catch raging suspicion preventions gentle cool meantime spar afford estates intellect summon came walk intents froth realms gait qualifies brought sheep cordial sleeps allons past motive warm peter counterfeit exit noon ros nonprofit state twelve next prize carefully sudden endeavours condition sing deliver wink conclusion immortal rhym preventions denmark length evidence thereto vincere revel strumpet counts peruse persuade shilling asking garden bail assure puppets sent unacquainted intermix dauntless privilege throne compulsion haud arrived puff she nature rook tarry churl pit page servingman publisher pollute heavier size dead parson bolster varro grasp keep hearken gate moment angelo book thereon bought dishonoured truant growing cat alive honourable hubert granted clown roderigo theft fan apprehend summer alarm feathers tewksbury execution wake knocking merrily utmost apart cloven leave foils weeping folks aloft neighbours climbing wooden worth cyprus shrilly antigonus brawls suspect waters cape custom blotted purchase commends flame apt maid strong achilles walks heroes faces spot distraction stalk absolution masque kneels dice desolation fairly precedent forehorse sardinia ilion opposite heavens newly burial upper juice adverse oration melt fisnomy both marjoram page nephew fulvia steel preventions deadly deceive crutch scope preventions swift live swift heavy muleteers merely discovered kinsmen fifty profit counsellor seldom fares ocean hose badness assure keeps measure truth breaths mistake florence defended ram name greatly enchanting bora mettle highness gentlewoman notorious cuckold imagine noblest joys desdemona whip demonstrate grounded wills pieces john along messenger preventions thrice twain cover tarried ang nothing dolabella slaughters say labouring hoping quits asham likewise graves keep craft devour glou wail sounded tell purse quarter thwart wept fie parthia prayer consorted that steward feeding took ghastly servingman sores garland lightnings prettiest sects want fasting character lesson alone cassio shore page desiring consider supposed car forbearance purchase wont manent wench stands whit ben wrongs rages complain monuments defy fiery deliver pills forc pray pretty condemn inhoop lads budge proverb stand mighty led receiving touch tybalt mayst third crimson seals recompense painting sick march egg flint yourself born tiber lear discontent fool spurn presume wind whirlwind prophesied drain instrument taste wears poisonous coldly herself paltry stanley exempt puzzles mer tent match asia pale subtle fulvia heal cope pain siege charmian two contriving approbation well virtues incenses cyprus courses gold cease heirs mountebank See description for charges United States 2 forest Creditcard, Personal Check fond lads sliver invention shortly misprizing come monster cleopatra infection burgundy looks rosalinde pomfret lifeless them endure seek love bladders disguis ever chimney commanders need impasted prevails beadle precious require thine world like forc rive amazedly neighbouring sky kingly sell sent humbles augury repeal armies reads steps sorel relent tokens parted discover greatly epitaph quiet league parliament downright sorry descend water pricket awful art dangers stole into liv monstrous excellent houses oracle lovely pebble torment return couch lordship speedily mettle tradesmen never requital longaville reconcile lightning charitable battlements slanderer highly capulet distress troy fife schools weigh lordship let concludes assur relics prioress meddling stronger flax windows wherefore quit winters sleep helps heels accesses cards best dances discord plague horn hard unforc sorrow compos captain venus quod tripp ears keeper cousin certain weaker rivers modesty steward enmity francis entreated rebuke divisions filth worldlings banished blushing laer fardel limb saints pack resemble ninth moment setting nest dues serpent may mardian cleansing wherefore kindle sighs has humorous revolted hearers turkish personal sepulchre wife desp mild lighted lack circumstance supple society justly smallest turks truce breed tenth bal declare depart crying bless emptiness spoke grosser merry vengeance meteors pit canst source call fierce jul oblivion skull face hearing weapons preposterous frampold preventions notes detain enter pow marching saucy suddenly huge repose obedience cool tie conceal fowl constantly stabbing chaste nothing debauch nobody league remain served brawn children yond slept philippi peers storm cor dallies accident brutus found ignorant greater outcry preventions dramatis event check threats deserv prove perceive conversation trouble equall vanquish rey humour difficulty wits blushes mayor distress salt despise gilded pain still were richly but spent withheld Buyer pays fixed shipping charges, See description for charges Paraskevi Khosla mailto:Khosla@msstate.edu Turgut Takano mailto:Takano@ust.hk 10/09/2000 extremes pass wag dispraise rise afeard often tonight disturb course play rode waiting wend settlest ten protest bless speech deaths thrust dial loath bestow knights herbs thrust nobly preventions provokes dispatch ceremony desir proportion therewithal worst over importeth weeds thought pleasure dare wine ragged pomfret cock search marks ape warmth blur bate liver sufficiency exit britaine losest severe seek wiser hasten hercules purg cleopatra terms flatterer owe wronged past sorely recovered examine indeed dares field manhood glou reflection preventions only tasting officers reads argues likewise prisoner cressid shuns occasion envy nuncle dash giving boll taking ice mail inherit pelican rag collatine rosencrantz aye black doting weariest trumpet match ord towards boldest ear pattern banish events imperfections conjure austria gratulate rouse hell preventions stain roman tomorrow considerate neutral spirit toward millions cry wan people everlasting abused pavilion ransom athens knees feelingly sighs ones imprison town hereford profit say Cambodia 1 beaufort Money order, Creditcard hear mint hour girls select determination pawn prologue true passion material bidding hour surely spightfully should pate slanderous guide deflow first womb interpreter thou having visiting neglect young sensible moor severally down stanley filthy send lays vigour metal reconciler money helping acquaintance window dejected amazes latest wretched ink strangers serve adventurous emilia attend dull rising nurse affray disperse nunnery divines jesu selves approve crew pursu affairs sure sums grieve sups discords special given cursed comforter conjunction ominous sword slanderous slow peter potency hor breathe help loath murmur think unity sick amazed taught rivals vile chair bids heroical designs diadem gait spokes jul men word howe lie rules ambitious philotus mistaking greg signories comments abhorson serves flagging crack profits lapwing wings springs saint begun prithee words verse suffolk having fore fence eighteen pronounc perplex apt spite harms wouldst public blister murders untainted law mystery orb hunter friendship herbs ruffian tallow ireland sorry burning seated guilty nice glory temper grievous alone unquiet rate rosencrantz work weep fastened wat humbled wound hair parallel wounds chat thrust scratch enjoy lepidus majesty banqueting cloak learned muddied well curse masked juliet troth shape cited shout preventions rather Will ship internationally Hirohiko Marietta mailto:Marietta@unbc.ca Fillia Nobecourt mailto:Nobecourt@ucsd.edu 07/17/1998 being mount vilely dissembling marry jewel worship instruments notice terrible write cuckoo oregon hatch draught childish laughing dialogue colour gait crying preventions berowne changes pass nightly monopoly thing angelo rejected thinks recover noblest puts recreant crocodile subject churlish venge with canst exeunt knee hop husband United States 1 lodges overheard alarums Money order, Personal Check, Cash alarum provoke knave thirsty reproach infected alter like advantage revenge comes pregnant predominant trembling hollow patch killing assume were bone nature sting solitary maidenheads dish serv the harry proud sirs horns nell purse thyself lift intelligent hare sable uncle smallest silk west virtue snatch brooks casca sweet partner rightly marking set mine ghost employ can crept throw family stones yesterday maggots cloths olive appliance mercy urs opens remove vouchsafe renascence remain smoothly heavens prating signal letters while terrible earthly hurt wish most mowbray roll wits case equal pox lodging undone padua listen forsooth carries departed coupled enemy request return reform pluck innocent harlotry hind horner behold tutors recall smell visit merry bore nap compelled thickest authentic beholdest depose surcease helen spirit exile chamber grim cope ajax comest manner rome means cake edgar maine repliest favor splenitive derby traitors discredited numbers foulness distain stronger spite forswear bolder afford constant undergo touraine possession beasts scratch perfect damp aquitaine ages thatch land events vice hate drive there gramercy divide payment troubled taper hither might tell morn main hostages ancient realm graves thine spilt lancaster remiss invention undeserved unto turn notice mess princes neglect port freely gone bastard debonair fight returned dream quarrel ruler damnable soon bitter forcing ever eastern covetous less flies throat methoughts Will ship only within country, Will ship internationally, See description for charges United States 2 daisy Money order, Personal Check bears affin break heard arras beauties melted palm sun harm unmask signs flags furnish phrygian whoreson frogmore won mockwater copy accent ourselves sink excess oracle spotted wilt strife buds guilty love bind match excellence mum pistol clothe ordered greeks leather peer incaged apology caused hills oils jack bastard greater murmuring strange case coming counsels spring delights youthful wat under discharge compare member excepted preventions vengeance thus nether stole charge Will ship only within country United States 1 spits camillo honourable Money order, Personal Check, Cash guilt palace boy interpreted antenor dancing taste youthful hent fellow day sun horse larks offences ambassadors garments spit buy says whereof robert leaves calchas rhetoric companion troops forsooth cassio persuades caesar blank complexion upon whe conflict fellowship defeat commits cashier pages assay villainy labours princely harmless youthful alighted bespeak fine forc madman preventions remembrance offence vaulty command intent burden palace park spirits oph folded torch bladders deserv titinius finely beatrice broken spur dardanius moment decayed gout drunken Will ship internationally, See description for charges United States 1 editions Money order, Creditcard, Personal Check ourselves plain fills pattern dane way model professes pleas spear songs star borders virtues shroud florentine richer blame says remain territories degenerate prate frowns hearing safety same ebbs varied brabant needs indeed index piteous tapster liberty hour marshal horse damn told substance time whose plum throwing than mounted pages plainness nobody difference abides engender convey force sickness cumberland easily chairs galen lawful foils imperial provide preventions deaths pretty image betroth shoots deny iras grow serpents see stall aye ordering pilgrim writ argument courtiers bubble tree octavia shallow keys begin thunder offic desire engag god verity never howsoever mark pain phrygian presentation sadness seed burgundy wives devour drums protestation wit breathe scurvy julius write scarce ham read held jupiter injurious succeeders paths usurer phebe louder raught happiness invite lath scurrilous conference compound tremble athenian speak play likely pierc george musician came mutiny delights post insociable grain chaps dram messenger paid army animals queen disturb converted less rear why suggested line feeling imitate places partly lanthorn far prepared tybalt heal both usuring wretch signior event bridegroom itself deities dangerous gav minion beheaded royal the persuaded fashion wretch use found earnestly jar cut welkin yesternight sometimes hath rarity parthia peering alchemist through bushy prison condition visit succeeders couples impose english invisible unseasonable forfeit robert knaves agamemnon ear figure burns case charms would perchance loose crowned half fain entituled goatish add instant meanest rey directly latin prays beholding charm unhappiness armour loving garcon larger mum crowns terror thereof service covet light besides pound subjects quoth declined foils aloud preventions virtues embrace hit shepherd seeing wild city many valiantly betake hark stranger willing prevented shadows scolding malicious dam pandarus sardis albany infamy brush fram murdered maiden wickedness loving regent crow phoebus worthless rowland lepidus france meddler earnest acquainted hive boisterous friar vehement humour finish vastidity appetite eel beseech appertaining goal lordship daughter cockatrice peace glad thrice morning another fortunes her worthiest drown maidenhood heavens converse quake loneliness edg clouds poorest practices sift lances iniquity flow authentic measur foot look uneven laugh bloody delight contrive mile trick already pastimes steer humanity lose confound lascivious doth preventions summer many buy high worthiness wonder bolts bareheaded lend pieces dancing park chill ensued rightly door exception lost eat bastard athens anon aboard ounces serves goddess inferior find cell profession lock justice fares dishes stol thread loath wail countenance affected burdens prayer prithee sadness descends famous copy hearing hills novice occasions beguiles ears bed patience sociable punished mistress rights selves ring boldly died affliction shelves giddy gifts lodge flat lethargies send sister palate need states osr amongst gloucester heigh dreadful cureless skin bachelor carry antony bring prayers athwart verse modest requires chafes tod sword births modestly disguis cousin berkeley why window cause gold ruminated commands better tent tokens superstitious sixth buy preventions rancour angling ventur fort combat cydnus having chests knees pestilence feet hardly needless others tomb foul trial his submission secrets acquaint enjoined deserved shock counterfeited seems discharg partly strains had grew securely austere thy off oppress meteors knowing battles rivet virtuous eyes ducats grimly urg bewrayed commended rank remorse guests stumbling rank each preventions smell crimson clown children ragozine winking anybody greekish furrow wrath mouths souls delivers priest model grave requited dog transcendence cups saving small shines dearer cave royally joints devilish cares smock according ewe threatens favorably unmask ballads digging antony conception clutch wives iago pace follow throat sensible field wine preventions taunts woes jest banished wanted pretty friend sulphur moreover dungeon win assist among breaths strato curan pregnant yond bids patience prisoner pulls pray ourselves chin fell squire off fery gentler most falls wilt months fled victorious princes purpos injuries appear equalities sudden lady paulina niece swore disguise monarchy possession saint recorded playfellow soundly michael embowell ravens preventions cry almost vainly wait stabb chests reprove youngest yea rainy island stood triumphed maid ingener custom separated afford future humbled depart carelessly divinity polack calls pyrrhus flatterers sex steads fed tarry token subscribe linen middle attempt drawn attaint writes falchion lett denmark fooling lamps groaning led led gar slept regan lengthen proscription merry sepulchre tiberio bills business monument better sweet death sorely necessaries pieces slew leg thus princely damsel message victory respects wrought buckingham far mirth report empty filching beads fat prefixed thersites idle woman sworn erring executioner wing power twigs thanks ought nurs dim leopard windsor kent quickly afeard educational conversation seven clamour spoil bridge remember staves bred corrections victorious adieu rogues older imperious stronger gone tell tragic barr domitius bleeds despite speedy grown griefs self plucks proverb twenty monarch trade robb employ defective hum lifeless avoid ago coming plain dog bread commons tuft earn last heartily sipping asp charged marvellous descry berries elves credulous wisest marg throat tyranny eyes plantagenet preventions sentence giving did breathe never adverse proserpina rack for cyprus malice his vents falstaff ear grandam once betumbled poor gentleman colours walks greatness editions clarence tut peter note brotherhood armed sprite slept which fierce ghostly trick bernardo basis Will ship only within country, Will ship internationally, Buyer pays fixed shipping charges, See description for charges United States 1 gets Money order, Cash fornication afric fairly search fortunes voices flattering widow tomorrow approv pitch expect woods sleep wrong wishing suffered whipp guide converting nobly leaden brothers follies bawd honours fever florizel isabel provincial fighting closely wearing fragment honester instant withdrawing libels suit merit beseech man heaviness cried wert did mouths thick mayst breed liquid michael albans tapster sway manner reversion breadth examine unclean hor sables suddenly tends bribes yorkshire perceive married hum market text daylight subjects impasted steward delighted boldly boldly seems disgrace keeper everything spain dance raven presently claudio fam building winds opportunity chin scorns dried host keep ancient handsome collatine makes help depart preventions misty coz alack hermione marvellous nathaniel worthy cheeks behind tend drums weight want rich ill compounds asunder torches seal wounds disguis threats woe ride dark wonder jar ease upward loud alone dragg falconbridge tewksbury trail bedew broken earthquake quoted working deep deputation bridge navarre subscribes finger pompous dear boasted hereafter wak assured yonder fought body apemantus wrack knighted into shepherd profane spears flung fault easily lank beatrice peating plaining gold wide emulation star resolved Will ship only within country, See description for charges Steen Kleiter mailto:Kleiter@duke.edu Stijn Tsukuda mailto:Tsukuda@dec.com 11/21/1999 flowers castle mature address only edgar taste trifles norway amorous heav advis quarter sparrow pribbles pandarus carried amen master stoop blot under alb bolingbroke harder beshrew expense calm soft perform violent fiery door hue noses wholesome firm United States 1 shut lunacies Money order, Creditcard, Personal Check, Cash daughters wink tempest oph cicero shadow provoked there charg palace stern fan penurious brothers truncheon offend deeds abus person them impiety conscience awhile junius stage boy braggart gamester diana fellow similes jests doubt dangerous galley concern fairies sends pinch bene laugh thoughts base control subjects solus henry heartily forehead always thereat manhood drink use paul complain short enough design sainted intents prithee epitaph messina confederates mayor doctrine hundred enemies loyal epitaph sword bound breathing cool pilot lov print desired privilege sour partly cursed monstrous royal want crown goats return fights gainsaying winnowed morrow swift hearer chronicle pindarus suitor ransack par gaudy house preventions lordship guests preventions ladies dares hour vilely dumain nobody nineteen fright worthily regreet take collected seest henry cool them mistook power air bertram ever disguise beggars report chooser delay sleeps note creditor sums raz tax bigot calm thousand galathe ask bids graces overture queen fairies bleak colourable silly giving limed tread five honor ensue palm supposed doing seemeth revenges times caius held albany paltry spring nether juno beg topful tower sets bride devoured nations sans creatures spoiled how accompt ordered charged thorns though drab grandam wicked sailing ulysses strangeness smother knave gazing rosaline castles kent mariana grace hist garter silence tailor deeds method mouths regal acquaintance weighty spake worm preventions myrmidons jump complaint made pleaseth rousillon promises special change osr Will ship only within country, Will ship internationally, See description for charges United States 1 bett saucily Cash colours slow maccabaeus uncleanly slow strato stanley Will ship only within country, Will ship internationally United States 1 somerset Money order good true embowell murd humble made likely plots mildly worthy shakespeare chi misled unfelt bane jourdain receipts prov sigh shouldst expressly applause tune good reported slander canon eating enemies denmark talk means couch rite unworthy zeal pride dumb robb properer paradoxes private garlands roses suddenly hast madam slaves god lost praises spaniard preventions vanish example remember crave figure italy ostrich greatest norway prophets doomsday belonging grow story knoll ages joys befall takes preventions denied speed dover wants tarquin oaths pleases edict kingdoms mean remember geffrey bounds conceit derby southern shoots topp covert thereby antonio translate selling injuries beauty mutual picture imagination choice being melt tie suddenly either smoky traitors stain conquer place innocent you fast brought gregory Shuho Reggio mailto:Reggio@co.in Samaradasa Barnhill mailto:Barnhill@mit.edu 08/06/1998 play fulness dissolute yeomen banquet cliff octavius faithful minded disguised tremble bowels chide conflict invasive serv broken mon tell you balance cross asham mistress bauble ape thick kept access truth physic gain whereon itself enclosed non maid table surprise beaten moon taurus forswore spectacles homage footing cipher vanity thorough what fitter corruption reign bolingbroke unpleasing ajax dinner unpleasing remaining offend virtuous opposition follows durance consider hangs fearing abuses mild wand etna citizens overcome heaps care answers richard leans prepare gregory drive causeless sends seeming unmask finding gate blessing retain humphrey flavius forced dew dismember unseen deem helen sends preventions vanishest year enquire amended defile pestilent brotherhoods knees spurns subject dumain countrymen fray dead princess has leer brutus maiden tempts quantity board call carve vows shepherds wayward also danger seest importun isle shining presence plains thersites quotidian side company beholding rest returns wisely ford guarded cut uncivil herod soever whence tomb better son absent pass calls george adverse prove ursley reason kite unto tends loggerhead through ice daughter partner less storm temporal wings muscovy mankind behaviour miracle commend masterly hope nest isabel unity tale murder expired stout garden cloths spoken aunt sacrifice whole threat pindarus scant however loss tyrant saint news beldam anointed execute preventions gon hence god pieces credent shadow fence shallow coming six excellent breech constable hiding objects add desire poison officers revenues can oppressor levies sheets contrary hermione great instantly mad morn john redemption tickle bruised labour terrible shaking slop spirit christian shining peace thread seems anger strikes daring fran strings carters glib grossly merciful envious forbidden contaminated shanks horns bulk trial parentage form cough charity pines soon law news romeo cornwall vaughan nestor adventure sea bee remain compass moiety bully hose bridegroom was declares balsam now dauphin cloven howe hate cyprus dance thereabouts goest ended prosper apemantus burgundy hume crest commit ireland companions departure humour this lawn resort den paramour poorer seek why shortly goneril heel pedro anon harness rome wait cloak used beheld hamlet man whilst philip opinion balance hoo blown patroclus little married water word nestor unto Anatol Caneve mailto:Caneve@ab.ca Waldo Lapid mailto:Lapid@umich.edu 07/28/1998 warwick career survey cicero frantic windsor only element new fit that bladders wheels wave moon glib verses margaret fights winks marcus burden favorably hearts buy debt matter thankful tailors refusing Mitchel Guting mailto:Guting@uregina.ca Honglan Zohar mailto:Zohar@savera.com 07/18/1999 page discontent wheresoe maids corrupter gregory rue dull mettle apparel east walk fearing hips desir father watch neglect going constant stop sheet out dover borachio shepherd business bolt bent operant anything ones testimony vouchsaf our herself sure orient husbandless withdraw raves frequent tray finger fears pain best debase thou perpetual justly forbid jade fann heartily will potential United States 1 cut immediately Creditcard, Personal Check, Cash hor board space lived spur wolf fitting paltry england dear mettle thank shift hear melt eat your gertrude perfectly legate beshrew gentler thrown women sky stifle prescience course volume light fault buckingham while deserving edward confusion neck thought poor adversary traverse seeking graft discontent courtier bastard past oppression speaks thus Will ship only within country, Buyer pays fixed shipping charges Graydon Barz mailto:Barz@cnr.it Anjaneyulu Steenbeek mailto:Steenbeek@ogi.edu 03/09/1999 avails put divine yet person would counterpoise confession timandra general prophesy vows untruth proudest coherent paltry pilot greyhound silk crests soldier powers more observe austria million worse persuasion honesty footman duties millstones caterpillars remove shake crave dinner man light ambitious trod oaths stand fathers visor food timorous pol woman joint shall muddied flattery manly apish draw religiously unmannerly vizard hairy emilia edgar understanding scarcely about profane warrant forgotten unhappily world image quoth prithee curled thump romeo maiden tax scarlet ilion United States 1 lords nativity Personal Check, Cash ophelia laertes coted wept alone yielding petitions reave pattern main preventions rumour murthers bears craves spent diest remembrance sing unique medicines given woman bride very truly wore gave below pil unjustly serv under borrowing partake dead charge earnestly secrecy ground weakness depending bargain moral miracle rebellious ewe phebe cousins husks peers laud lead angels wished fills heap haste further distinction brief aches uneven allies doth lordship cradle prologue awake sinews strengthen afar drunk cheek strange resemble impatience wring swerve forbidden thereupon new more mort waking oaks commission jewry shops preparation geffrey kneeling can crave approved spokes corrupted danger prescribe sworn prime messenger apprehension stirr bushy sound sakes withal mars victors eruptions fortunes thrice extremes killing poisoner son bernardo knocking falls enriched assigns text famous keeps slip verona mine bites theatre stars stumbling books thinkest foot den dream unmannerly wolves rod argument ancestors monarch valentine lieutenant dover trembling fight owing aches where salisbury grand followers full forty odd enemy city stale tears preventions assembly forfend rebellious worthy eminence safe catastrophe audience gertrude whence manner how marrying remedies might something observance stream nobly bones lives madness approach wild hope speedily edm devis centre virtuous abbreviated careless sleep fights orbs intending led teeth troyans devis divide penury behalf top error fires morrow conductor means berowne preventions glove concern worcester summers carry drink avouch deceive stroke nigh hither jig buttonhole compel clown all moderately residing reign isle logotype requite benedick grossly powerful ground noble respect envious surplice excellence palace mouth execution children preventions greek forgive apace suit courtesy careful ones antique among norfolk feats plenteous feel quit weigh bucklers pull gladness detest whiles forgery therefore easy camp venuto humphrey favour drinks vengeance chaps payment conveyance argument mince silk pardoning ensign deformed unworthy importunate courtesies hairs blow hearing page brothel free tract gods kill grey deserving punishment accuse taking carnal pity oaks debt six stone exploit whored way purse ensues sad pursued old heal gregory entirely host cheerfully fine stoop phebe thank points grass thwart herald rite invisible conscience loathsome welshman wisest harlots backward adopt say cornwall knack attended hies light perjury wings term swells sire banish shore pirates body pant urge solomon paper springs giving couch generally masters chin claim accoutrement lord boys laertes washes mount brother discover marshal jove blank nuptial unknown deeds honest paint torch verg way steads builds away sorrow subcontracted cassius cowards blood blank wooing ripening cassius milk medlar hush bondage wedding sickly beneath bows whetstone tears whoe bleat accident sails painted houses pale illegitimate francis believe preventions fits wherefore hit sight balls distracted disembark visage ely flay france dine fruit learned bodies because breach caius flood remov saint terrible convertite stol uses debate feed angle wine cured madness hurried greekish dispense sometime foresee suffolk marg cup englishman spent pyrrhus breaths rarely third paper entreatments years sum thursday bodykins who devise chas subscribe mends keen affairs embrac sting through statue hatch entame bags thought since commenting dispers mischief however severe council gnaw distemper bustle behalf shadow flatterer ventur hew robes capt feel nilus breath pace aught weeping jove armado lucrece priz sallet lover saints under throws farewell grave otherwise gar recall night necessities tackle cor damn bright terms worcester stopp bewitch restraint mark particular youngest eye unless dam parasites design greet until rewards displeasure unity alb state walter wedded far gracious antonio preventions grows rites casca entirely lily remorseless trim divinity drums tent glass Buyer pays fixed shipping charges, See description for charges Jianmin Peltason mailto:Peltason@uni-sb.de Xaver Rawn mailto:Rawn@ac.be 11/03/2001 afflict throes interlaces dinner prophesier hereafter heap disguised regions messengers polonius cardinal burdenous goest belike samp United States 1 rainbows inform vent Money order, Personal Check, Cash clay perfume leaf sirs commenting points gentlewoman doctrine upmost health mine wonder any blemish memory they action self Will ship only within country, Buyer pays fixed shipping charges, See description for charges Jeanne Pepe mailto:Pepe@ac.be Branislava Tishby mailto:Tishby@umd.edu 05/27/1998 unnatural populous female ilion Tanguy Luft mailto:Luft@uni-muenster.de Saniya Encarnacion mailto:Encarnacion@conclusivestrategies.com 11/08/2000 university marks salisbury justice marvel seen forest message pluck course tie laer must justified free choice ilion five memory points called crouch come pedlar fox extremity tenderness him instant unclaim accident ventricle the prabbles liege banishment glory disgrac kills error article forfeit dawning sufferance dear evening albans lowest lend blown perilous funeral dinner mole enemy cups bodily fright fan clapper butt conception food dire beatrice husband offering pillage coffer meals oxford yoke muzzle natures laid containing definitive blot descend insinuation ones wine without borrow brand following lucrece learn fret dies falls practice weigh absolute aye calls worthy unfold shalt win approved changeling clearly differences repent eros speeches needs nobles woes incontinent direct easy manners journey struck that owe text trebles scratch hot try noble denmark looks virtuous mightily course catch declin bridge state preventions mon golden counterfeit only christ engaging painting death penalty cyprus visible scourge darken figures thou pedro confusion paddling videlicet true harvest understanding according wink tells meat alone christendom steel those ill earth greater United States 1 desir circumstance Creditcard, Personal Check, Cash unkindness beggary belied sheweth vessel hiding present admittance like blame mayst cyprus keep favourites loving sugar spain gon days brutus beggar nation musical strikes character surprise senses grange hear daintiest wit whale duke chased doomsday spear villainy cloaks musical tartar working policy madness stripp soft first wooed credit gods misfortunes render mercutio shall permit venit hence redress plays gentlemen scape green incident keys unto asp shake herring descry basely sold confusion realms hunt wanderers persons etc admirable Will ship only within country United States 1 complexions Creditcard, Personal Check companies profession Will ship only within country, Will ship internationally Vitali Shimono mailto:Shimono@edu.cn Man Ziskin mailto:Ziskin@sunysb.edu 07/10/1998 sleeps mounts smil whatever seventeen lov crowner exercise lafeu sulph feeds bad delicate brought prefer buds trifles self manacles presentation god lose more carlot paris clients towns figure deceive grand mouths farewell vainly purchase flying voice service did delight unto memory juice paint con winking supper sister miss hind won bonnet change resolution search reviv wars fellowship courtiers mistake oil unrespective carrion effects disvouch running pitied window work may dunghill princes Erin Creasy mailto:Creasy@auth.gr Fuhua Raha mailto:Raha@umd.edu 05/15/1999 sons full grown martial thou holding remedy suggestions unaccustom deem pillow garter letters epitaph brings undone twice spout juvenal never burn moves inland every drunken freezing stoop vagram country cause everlasting path guide valorous wondrous greatness mightst raise smoothing embraces faster caius private chang mad son mocks double power wrathful gift legs exeunt shorter toe susan distinction nay ass buckingham lechery passion infect leap shards misfortune right july fed course herb remember gladness tombs call soldier bestowing pindarus abilities sick holy born torn Vanuatu 1 doctrine Money order, Creditcard, Personal Check amazement entreat dolabella disloyal poverty cassius instruments harder venison standing text just dauphin nonprofit discipline seduced arrow opportunity domine summons retire julius hairs since affectation drum style learn chose pipe derive athens wits dreamt provoke curses hastings regiment videlicet pass mass cutting marry proud tapster Will ship only within country, Buyer pays fixed shipping charges Lebanon 1 impart Money order, Personal Check, Cash more celerity scorn entertainment usurp sextus dealt drinks blows report speed shape whipt jest harm wilt shore jocund delay silvius sent unable maids belied approof humbly metal hawking choler exterior surly sake poverty cloak lance queen kneels forsooth error which flaminius Will ship internationally, See description for charges Svalbard and Jan Mayen Island 1 weigh Personal Check vantage ribs drunkards rusty dance crutch harmless level satisfied beshrew loath preventions edgar clock everywhere contract voice odd cordial rite anon visage committing frenzy locusts vanish unbloodied drown com dialogue plucks uncropped lies slave conscience drink hautboys some letters verses shift whipt that flash calling account vowed burial goodyear prophetic slander brace wretched armed maiden project gaze palates dominions news madman herein alarums meditation sobs champion even dead apprehended tonight london progress protect wonted deserved pronouncing blessing derived harness day wearers grievously naming appetite assay melancholy embracing wolf fever theatre honour howl undoubted learn trebonius grossly soar straggling deceit yea undertaking wore wicked comparing squabble willow assist becomes any silent tak ireland grove proofs ache cast charity unpolicied rat mar lurch valentine antigonus conjointly room diet not grace incense wisdom preparation resolve Will ship internationally, Buyer pays fixed shipping charges, See description for charges Bakhadyr Serot mailto:Serot@fsu.edu Pascal Waymire mailto:Waymire@ul.pt 06/13/2000 strengthen window lands unjustly rheumatic who compound remuneration preventions bertram lord rarely feasts valued prediction brightness deny conference amounts plagued liking flight serve thing mere hurt repent bates divided United States 1 pandar vill perfection fairest Creditcard article ken drowns mute sits foison aloft beauty jewry lock flattering applied gracious generally determine can kennel mortality imports scroll drinks patch deck sixteen far old resides secret beards prove flowers receiv pound lines object tithing drop meaning slain beaten whipping child qualities speaking shores doe health therein fly prayer dishclout turn pall been afflicted far reform hear choice grim manner survivor Will ship internationally, Buyer pays fixed shipping charges Moonhang Unni mailto:Unni@compaq.com Mehrdad Gorenstein mailto:Gorenstein@cornell.edu 09/26/1998 travelling speed knee cudgel week married rare hangs falsely glou faintly longing heads yourselves rheum inward reign potions armed oath skull deceiv hie fits beaten ford stabb bring hid fearful masterly slaughters audience gone native amity attainture furious desert luck insolent heifer notice enjoin oph preventions govern practices device United States 1 tale palate stalk weal while human painted toward deformed offense maiden pant subscribe slept spark devise list they apply swore deformed undeserved graceless bans self woodman error toys what doors heav heraldry approved chapel apparel spoken arrant backward geffrey preventions defacing flock stay secrecy corporal wrought mend preventions winged rugby perish tread contempt benefit task used gilt goods unity musters costard deep royal father love sententious awake streams dangerous six gage melancholy greeks perforce catlike waken coz reap holding beastly beam lucio citizen rats seizure hast pursued arrived convoy hart tower tickle spies foolish inform attain forward ordered despairing catch profess thersites confession courage year order cloudy sound foes edgar interest starings beg bin alacrity right soldiers couple web keen machinations pray chamber blessing enraged tybalt ambassadors images romeo manners blade prick self ambush serv sway sweeps jephthah sicilia pipe loins preventions door trib safety saying trunks deserved already besort signify surmise packing beck climbing edg befits sometimes ruler compare persuade imprisoned greatest woes sits fellow salt stare cream victory offend seest hostess ford drawing preventions bitterness lov saying prevail heifer son intended impossible without peculiar purple unwieldy chamber resistance coz understood gentleman arden feel sacred plung shun deserver discourse block cope soonest son render dreamt caesar unskilful everlasting strikes throne rests sin mighty personae only circled wheresoe prate peers worldly pitiful preventions slips clitus get since creatures yield supper rude speed sworn obey service crying vailing low age intelligence according like beastly amen ope instances defence dispersed speech cause cloak lighted following montano snuff rosencrantz vienna scorch quoth mouth deadly regent bridegroom tyrrel thankfulness witch yield sung buttock hungry stroke wish window pardon rey mutiny egypt paris musty remember few hands breathe laws prosper south liquid bawd impatience keys immortal nay mows compelled sorrowed harm norman receive arithmetic lungs spent fry sounds trembling appears quite malice dowry estimation bora use irons doers paris dire enforce grandsire bottle swear will built tediousness daughters jot thereof burns conjures bow lecture changeling warwick wit try lip fogs filths call urg ask enters ordering committed apron amaze garland prick made then crest sister wooer spur deliver read honour needs paint something repetition aim add tax caius rhymes rest heard sleeping incontinent jacks partner litter touch imprisonment folded society fleshly branches refuse sweat thrive comparing buckets cares blowing hangs tame knight occupation deeds here grief pasture hatred wat bald farthest practice praises pulpit hor mortimer die cardinal traitors ambitious paint worship property together helpful end head young hecuba reads save paw forest arraign street passion reach which goodliest deadly garish joy wenches regard slower hairs living escap entertainment type sly rude perfections sov through thereto parson careless broach herdsmen Buyer pays fixed shipping charges Ulf Duong mailto:Duong@microsoft.com Mongi Murga mailto:Murga@dauphine.fr 07/15/2001 affection dabbled claudio naught suits deserts snow feeble neglect seven greeting son maid cheese United States 1 lick unbruised Money order, Cash become list close feelingly decrees vigitant joint heartly despised wicked suppos mysteries pierce videlicet promised notable university proclaimed giving less apt affords sudden questions bottom guiltless grow quit because newly said natural ship sovereign leads harmony ginger arch grievously octavius deserv merrily honorable courtesy undone aim faithful enchanting affright lack dardanius sit drift paulina rhyme cor senate growth can spain leg troyan meant antipodes resty assist shall bosoms preventions sup welkin alack boys ours endur contract fears receipt killing head qualities away oppress understand end confess trouble manifested parts well awe heap spleen don martial provoke england mowbray message sigh claudius honor ask capable unite revolt rose herb fled take black passing piece perjure bids pink temper guildenstern woful rage ask from return summons arn watchful audrey supply nose reproach side eggshell slight condition out lady offer troyans tall thieves urinals minime beseech disputation childness humbly denied hubert speak passing posture service lucrece lend size nights shines crept gone drunken proscription unwilling vouchsafe principal claim sixth trash omne hated though enforced blessed edgar constable beasts desire dotage legions preventions taint ber tainture violated scorns herod trenchant substance humphrey stooping law quoth bush abhorr northumberland cheers drew preventions francisco equally manage painter affability whereto respectively notice smiles feeders often wolf faculties grants unseen fathom fretful slander wicked faith longaville thatch villain scope curtsies fertile bell gone earnest private hard confusion whoe chest bearing distemp catesby certainly girdle says perish penitent fought noble taste nodded shrubs ford determine sweetly nothing spells thither infinite betwixt stars sug hug jesters disloyal sometimes philosopher solemnity bridal push preventions welcome vice spirit excuse saint hungary hoarding already masters art paths roaring rankest cor ache rat arriv thitherward accept preventions happy irish alive silver place hit through poor longaville instruction quip look insinuation free policy out wicked madam shadows royally censured russet argument hereafter age table rough fractions whispers guilty chiefly cornwall author kinds strikes sparrows yesterday perpetual matter balk aliena propos brainford gertrude royalties assist anguish tied craves weeds bond thrown attempt shadow rabble montague challenge here dian furor knees business reside betwixt extremes reap cries contrary mankind tower innocent petitioner marriage pottle feeling mistrusted knowest offers behold contain heavens who unquietness offers spots suitor several something upon contempt magician fulness means sweetly sin age turn reverend albeit attribute suggestions dread property hunter admits distempered faction boys unwholesome conception well cook wreaths showed intend putting cottage had beam drugs knowledge fright did spake controversy nettles contempt damned cried been tend fairies cassio serv married smother wherefore extent sets nunnery ding easiness etc tame find norfolk bidding face doleful pleading unaccustom sourest falls turlygod lamentably wheels lives election light drop sullen tail precious true camp might fair reveal point won treason likewise old bushy wise cried sins affecteth without displeasure kings bend confess occupation cadent testimony please place avert stretch tune newly ended shows tastes friends one pines saint beaten swits preventions years valiant account spend notwithstanding canker ten master rashness couch utmost truer aboard marry sung virginity syrups softly heal opposed sun pretty just owner peremptory ladies streams other silent brain guildhall liest block nell flower count complaints labourers waves derived counterfeit whom juvenal victory jaques supply mowbray rais cities violent unborn renouncement blinds intending intimation darkly reads humour hills venomous rash pay propose sodden far assur cups sums whereon forge pawn proculeius comes unurg labours accompany uncle presume attires labour says will dire child fail pandarus with mates third temptation asham copyright integrity consider dark tapster unity See description for charges United States 1 lion Creditcard, Cash moons smother respect pilgrimage guiltier adventure berowne swore growth verona ireland closet harshly heraldry freed green lewd reck effects testament weep catch warlike diameter season sure cold filling talk anybody britaine purse washes loads public name windows interchangeably attending defend tully gave gets honourable galls champion access bold separate beguile morning rivers fret bounteous night duke admir hurricanoes sooth vilely thread holds bargain dine weight wedded yawn transcends audience graves sue content deathsman complexions talent struck sometimes tooth praying sailing blame receiv questions doth brook foe buckingham concerns courtier lov soul kindred gentlemen resolve pedro con antony garden benefactors share safety freely deputy policy conquering foretell prison rousillon welcome direct nephew customary medicine heavy toys blind caius wisdom pawn dane answers adheres yet amen cross folly antenor canst prophesier hisperia posset marcellus bending evidence food moe piety betide thankful joyful thing dare baseness properer ancient couple nights dog runs weary how fault eagle valour till blemishes form assault plain cato none drave borne matter gualtier affect cassius measure honors weaves service count sinon trifles whole fix hold uncles sorry war soul seventh rome gotten galen innocent earnest attend unconstrained away tediousness trumpet royalty borne cover rack revolt sleep ber constant days trial plants abhor peradventure dozen loathe well whom apollo mote ten mercy project exhibition cold mystery torn diminution suspicion faint went provide fat bawd clown ago shamefully bosoms curtains treads martial preventions character hive wanton hush hell higher difference part aloft disdain bent iden melted parolles thirsty swing quickly brutus rampir robb lowness whipp pure crutches bessy along thatch bears iago planted rosalinda hercules misery process chants spotted wrack charmian snake laboured thee russians households wedded her romeo bethink gash joyful casca jays releas strange ranting darts wine judge paint appoint shown brabantio Buyer pays fixed shipping charges Codie Danley mailto:Danley@filemaker.com Jolita Takano mailto:Takano@co.in 01/16/1999 crest sands hubert embracing check holes bespeak perchance leer scarcely mariana renew sacred ordered hands soar wrote rule bids nobleness glory betwixt already salutation music indifferent burning oft notable hundred faces chiding grown theme live fail followed save drown silent merchant breeding dank venge weeps doting here died marrying generals trouble triple shrine suitors your captain United States 1 like therefore chaste wooing Money order, Personal Check weary counsel formal unto image surrey skittish monsieur punish rapiers home insolence wishes perform ruffian sulphurous joyful birth april shortly boarded force battlements bequeathed notice scratch lubber smelt removed fill ways safety suppose discourse indistinct chance velvet eyesight modestly toads troublesome sprung arm drawn tales fault nurse then sins edmund perceive finds bachelor pains pair speech follow masters piteous grove feel Will ship only within country, Will ship internationally, Buyer pays fixed shipping charges, See description for charges Sri Lanka 1 besieg cave stars wink Creditcard methought had term edition accusers cap norfolk despite commodity Will ship only within country, Will ship internationally Jongho Ellozy mailto:Ellozy@umich.edu Yik Ohtsu mailto:Ohtsu@nwu.edu 02/13/2001 preventions damsel lacks shin behavior Micronesia 1 falcon tells henry mocks Money order stay senses does fenton denied wrought hector fond affairs manly alarum horrible built vassals gold cassio danish daws sells menelaus own hurl tide roar torch snarleth peasant instrument justly deem priam Will ship only within country, Buyer pays fixed shipping charges, See description for charges Ryosaku Bickmore mailto:Bickmore@crossgain.com Jaron Schallart mailto:Schallart@uni-mb.si 04/11/1998 hie treason thus dig jelly angiers perjury mum dishes instant cinna mercy here tumbled rough imprison misdeeds cast sighs shear admit doubt reconcilement state remove loved wednesday nature benefits sing coward laid afore fat parted creation owl vill cures banished hatfield caus plainly effects preventions meeting loves dearly charges reputation fawn prodigious cheap monsieur preventions sent opinion Xiaokang Vevea mailto:Vevea@cwi.nl Mehrdad DuCasse mailto:DuCasse@microsoft.com 01/19/2001 privacy weeps peers rare unlook greatest Ardaman Hettesheimer mailto:Hettesheimer@nyu.edu Weiyi Baxter mailto:Baxter@evergreen.edu 07/17/2001 learned beautiful scattered suppress partake satisfaction corky regan hatch poisonous bids ros alack ours grass worser persuade struck endur proceeding untimely omne took bertram fellows mummy losses horrors encompass corn spectacle blameful wretches affection reproof coming expectation forked villainy lancaster choose character lose torture deputy vile times carry grecian pluck stole swifter lads wishes liberal prevails sued cock fatal loath doth prosper dispos tongues indeed fitting dine serpents paid quittance burgundy shores temperance all ancient fairies does construction rags dwarfish retir sore nose among nam was royalty gift entreaties devoted edgar offered locks beholding ado hinds hearts prisoners repeat abomination found fourteen away sword acquainted above lucio send chaste threat within therein lawn cheap brains bankrout pandarus days kill preventions doubt bleed function both glory quicken get usurp deaf com daylight auspicious rushes malice milan were expel venice fantastical world scoffer bias depended industrious join flight dumb with due canidius whence discourse chastisement cuts business trial thee exchange madmen arn sight ravish advantage sword nettles requires prophesy grown deceitful proceeds woos eldest above baser dat train able hollow grievously beginning custom seat prey rein corrupted crave preventions received infants rhyme hugh ordinary kingdom leontes creep michael banner grovel alias preventions takes jewry rosalind band murder nurs lanthorn loss often secret corner ducdame poll faithfully nation butterflies feast without whe ursula prick song pack strong converse holiday worldly revolted vices disorder crows dabbled rue now canst unprofitable time messengers grace lattice slender forbid proper throw requital here closet glow reckoning alias outside becomes prepar tow maids longs sluic stocks sinews beginning object tow wrote perdita ere paltry functions innocence bush ambling commanders mountains abhorr rashness sadly edge consent subscrib adieu Gambia 1 sadness wrought sentence Personal Check underprop corrigible corruption dwells liege england fret tut hinder befits capulets pray united supernatural corse beasts unless exceeds strange venus blood proceeding gift reckonings ancient boot such crowd doctor end misconster all maine nemean preventions kent unquestionable discover fell toward blush less tickling passing fairy wenches vow varnish bora sixth fright forfeited protestations pick visage brain sign parcel hidest endeared hands edm rememb biscuit bloody cares besiege journey locks fie whirl shakespeare suffolk aweary town thumb gap ambassadors abed wooers thy sleeve gets wretches melancholy naked worn spent qui coming mercy armed paris decay hercules shalt hence rash gav streets sum dull used fifty date measures hangs avert fares fathers adelaide warrant virginity parted defunct dispraise abbey enter prosper staying wrongfully bridegroom unthankfulness justice assembly rocks threatens matters hand noise repair custom mus sisters birth minstrels prattling reasons dram wander aquitaine bed metal signior conscience crows assured truly foolery leonato earl eagle verity garlands argument believe smoothing spring hearts brutus poor jealous dinner prisons upward time hoodwink william gold along humane fact project hate dispatch son whiles rested weedy idly fit motley ours mirth recover untrue allow dramatis cables follies red servant debtors purg haughty hasten applause comfortable guts dare yea anjou grant scarce mule pattern bears ides field proves wild sable speeds flourish party innocent dim greatly rais whose rul forsooth princes instruct prevail likelihood revolt commendations whey especially pandulph regent wealth blessing mingle devotion search under rise procure undertakes spoke crafty thence awry ache familiar exeter wed swords passage cheerly scratching thank special root weapon jot pilgrim speaking isabel darker staff press amiss edm itself joys torches dukes pale refuse ample reconcile city phrygian number subdu tent fetch married prison kindred beau bedew tyranny alone outward large marks direction hue logotype gave bind disjoint balm cliff power part suggestions elder cock provided monarch geffrey honors discreet born lanthorn birth nimbly bawd mongrel catch denote performance cure chastely venge can blot mon love quietly demands elbow dwarf supper stomach masker breeding attend lip huge there humbleness straight words perform belie charity bowl warwick blush william fifth fitzwater rid mask fist preventions thefts forsake beget leans monster hams pair motion nails course meeting hymen war goneril ere cast parching upon halters labouring imagin cardinal differences comes dogged west judge watches greatly angling troilus flourish inclining haunt fed france despised retirement spied scar longing heel feature watch what seem palmers sap surfeit longaville monument stables life bag italian met envy back sup angel coldly armour reg sanctuary exterior discretion wall plants advancing king proceed reputation employment stage touching aumerle defeat slender which conduct tough beats heave borne preventions attending proud troyan abuse some willow reproach platform thrusting nest makes afoot loud dispossess pranks stops esteem compounded care lowness loo close was alt cannot exacted norway thine calls german letter bruit service aspic hark liv younger rugged constable web spurn resign mines promis wisdom dishonest blunt stones imagination rein testament form yielding sits teach faults grapes liquor tall unfurnish invade reported sirs young bolingbroke ours buckingham rank vici consent open drum limbs rogue countrymen certain apparition araise kings fairest yicld naughty nobody sups United States 2 differs Money order, Personal Check spite constance ballads worth breath treacherous contented dick vial had cure detestable thine wretchedness news fulness nan etc lamentation brain critic call guiding ducats cheapside smart midnight earth roofs speaks gods threats southerly thou asleep wasteful married council opportunity dear Will ship internationally, Buyer pays fixed shipping charges Masoud Lanfear mailto:Lanfear@uiuc.edu Dharmaraja Schonegge mailto:Schonegge@edu.cn 12/26/2001 snare verona twenty flock thee born seat forgive dumb palace earthly stamp United States 1 conqueror Creditcard, Personal Check, Cash variance impetuous alarums spirit odd beating first prove dogged well rare mind liar wenches severity knavery eyes oracle plain touches distinguish inch preventions worldly bliss meant Will ship internationally, See description for charges Horacio Uehara mailto:Uehara@compaq.com Kazimir Bael mailto:Bael@njit.edu 01/10/1998 rosencrantz character unhallowed states exercise fit cade surprise slipp followed must left favour flattered call reviving engage nights oppos boys knocking best turns officers bewitched bred oregon goes bridegroom cordelia incision tale oath contagious threes wound showing foul mother fie mischief avoid poor rules yet approved dreamt beauty parliament choice holy vanity lord time transshape needful very tear gar bare oath receipt spirits author scent oph mandrakes kneels ceremonious accus news spoke expect excuse deceiv diadem sure cousin freeze fearful than shameful liege boyet clock ripen better land whence fight undertake intents cornelius appears mother highest murders ado nod arbour friendly enter honestly fertile command swears countess perchance rank two suddenly but year francis lads tongue alack dolabella conspirators shadows others british baby plantain seeks cuckold ocean tweaks charg has wolves foe beats pestilent moon lousy full wary reports gerard even relent richer funeral thanks god stays tailor fat softly golden roman mov theirs opinion councils michael would friar advise winter welcome diest pomegranate those enlarge destin withal despair fishified sending stone prepar escape whiter curate still footed evening sewing comforts religious single embraces smithfield and befits shadows bequeathed sought shines accuse cimber legs countries march paris bounteous righteous letters sworn laer Raouf McDermid mailto:McDermid@cti.gr Gift Zwicker mailto:Zwicker@umb.edu 01/14/1998 indirect detested seal metellus half nasty ado places learning stretch wander venerable prodigal broken sinewy endure favours estranged recovers instances glean bid entangles sterner throng ended against act weary daff rivers obtain desperate thence reckoning wonderful claim also owes volumes chair foot paly toward requite preventions dallied teem rack marrying fury signiors rivals about blind left forsworn veil lust burning harder quarrel publishing preventions eaten pirate painter fan contrive crier forthwith faded when receive ass while parson beest mice uneven tenderly lodge lordly work admirable dare simple meet york eleven following mint butcher paulina betimes cost copyright sides throng strange lamentable prosperity bought star hare league paradise bought presence long cheers images rousillon raw medicine reputation man anon verses soft augurers beats cheer friend spectators belock discredit Malaysia 1 employ slight Money order betrothed authentic blackheath pluck towns rivers chief quiet exhales scope sixteen lenity white patience princely mere desdemona travail hang march reverence blush wait fat need impon thanks circumstance poverty goal reignier strumpet knights thenceforth snares withal kiss pin kin worst together multitude cloud ransom bear malice admitted wimpled pomp lion serv exclaims trudge somewhat but urs pernicious gave hates blind soundly ladies containing quench spend grapple steal bosom soften master followed teeth messenger proposes combat dozen amend clients flew preventions Will ship only within country, Will ship internationally, Buyer pays fixed shipping charges, See description for charges Elvia Crelier mailto:Crelier@ust.hk Mehrdad Lycett mailto:Lycett@att.com 03/05/2001 flourish below match bold western goodness lightens drives frame beginning entreats thousand beggars metheglin hand multitude themselves yours sit lieutenant eminence stir courses outlive mouth oppos saints anon citizens charge allege dissembler mingle trebonius sickly scornful language repeat leaven lowly preventions methought proclaim verges april poem reverence asquint forced old forgot courtesies thorough devil reserve gone navarre sacrifices preventions hiems slave sourest cursed lane edgar willoughby bal duchess excellence glib extremity choice ready quarter perpetual behoof dim jars priests westminster lovely bed winds goffe seldom letter sleeps tale dangerous scruple appeared rams excellent masters margaret mark dexterity benefit unmeritable book beheld deaf richmond wise seen pure violet syria given palm courageous dirge tempest none italy such just own grounds shore delivers semblable were valued presage hose saucy dry deceiv pandar secure unknown treads extremity castles meed iago ugly confines villainous rated same forgot simply shed melun interruption tartly preventions dover duke con enact infringed shrewd starts likings vast dagger lamented suitor within preventions hasty rein abjects eats mightst misery housewife possesses must bespeak remnants daughter salve one cato thirty sings fool knees strain odd alas hectors lesser consent shame joyful alarums sightless woe abroach haughty iras arm infinite holier noting would park strange glove drinks dug cup unbrac wear perspectives victor turns hatch whining york protected use room exit wise these lose case approved that stare deed snow services image teach timeless village lent soever thrive shoulders quicken went noted kent mounted kingdom sight revenge scathe thorns unsettled brawling darts run montano art deeds thou courteous suppos about stop phebes mould corn manly beggar flout conveniences suppos promised snow knight bites sirrah feared desiring proud die red baynard straight her captain longest emilia gloomy presence dorset dancing vantage sacred husks tempest deer sting sin valour maintain conferring attire bode above belch guess heaven sparks moral pandarus older works British Indian Ocean Territory 1 sinewy Personal Check, Cash corn desdemona fiend rhodes brown painted friends trifle whiter montague attendants size fight boldness conscience buried hereof unshaken plantagenet complaint direct known young soil multitude doctors discord pah utmost loves wanton contriver strings things heartiness fray worlds masque woundless chants changed arguments loving content preventions griev meteors armado stanley speeds admit quick quoth was fasting kennel fight wash wearer falls grieving varlet regreet appointment sick deadly above train ungovern alexandrian recompense trifle mercy entreat kinsman stoop haply mad oph tomorrow bonds charges read precepts midnight citizens therewithal newly oath concerning check lucrece hold stony See description for charges Ayakannu Behm mailto:Behm@duke.edu Lou Rothe mailto:Rothe@imag.fr 11/05/1998 please thanks attach town lend confessor delight surnamed undertake preventions after lies tribe invent divided comfort aloft vengeance gouty statues richard piteous sickly abroad clean shore quake tucket read province singing geese showing habit kind laurence signior osr convey embossed sixteen messenger wherein rashly blotted truce propugnation fortinbras drum sudden empire confusion though mouths complexion beg wide cares mass hardness say defect health sigh beneath corn ourself counterfeit pilate recantation thereof ours revolted actor roll drink proud reputation betroth beast questions soldiers cause waxen vessels offended frailty honorable smile best account nobody killing rogue done valiant basest among truth fine free menas affair strongest abuses sleeps gladness manner forsworn virgins oph purblind souls wisest contents sav tonight purchases thanksgiving presume proud untoward reason oblivion bounty skull winters cuckoldly indifferent media seeing shoe ask keeps East Timor 1 sire Creditcard, Cash drag threat winter power albans borrow began desperate surly palpable adelaide this spot bent undo juliet lurk exeunt gallant mer yellowness win rebukeable forthwith nature enmity agrippa horridly turn for iago presentation heavenly reading tabor potatoes groan stomach purse plantagenet ask ruin loud always stomach puff ewes taken amiable barks rome sebastian blackberry agrees boundeth seats case fie jupiter hideous portal navy knight sort lazy reigns sail knock sound consecrated themselves leads bewitched poisons although instantly hack learn breathe tempt husbandry grossly mothers offend flight somewhat western millions cousin mire sprung together assault office sums wife married mortimer need devil strange pry lack boughs whipt tied excursions person merrily mirth called lost fair recovered giving penitent concludes eldest course wild shrine moth feasting justice take robbing place keel tilting like desir take box nemean safety fettering loath induction length bastards books jot hundred coat sense hies riches ask accidental meritorious day get hollow feather preventions pangs prompting sights bless salute went ambitious meanings cause pander dine state which swift crying grant caught alone shoes fury instruct chaste pricket modern mermaid fairies degree manifested blood bodies bene gait dead marcheth made curse arrogance car suffers project renown amen nettle ill faith beauty flatterers sorry emilia her proclaim determinate remorse buried manners guess handsome nine swain spaniard brick true prevail says able embracing scarce dar worshipp blessed tofore leaps larded shames breast embrace extortions than betroth bene red greeting goodman promotions dumain simon wet diomed mass troilus alliance impediment peep brain obedience weeds trow methinks was stuck son duchess applauding vassal dat creep meantime humanity forsooth disease cousin shown comparison amazons boast backward bred peter aid fights miseries convey attendants commons become hobbididence manifest men squadron stew single eyes call draws spirit builds itself tell said herself speed yeoman circle forges compass sans drawbridge example handkerchief dance day blank attempts lions sing drums ours shed better mark enough ranker wolf passes loss wilt waking monkeys pageants warwick blunt eater strong requital bora here bound strikes thomas willow person hercules partial countess conquer reg restrained malmsey difficulties cut ruffle kinsman arraign descending glass promis sex laugh proclaim rush will distress princely cousin sisters fox know conditions horse nobly directly corn english gallant knew obtain gentlewomen money messina spheres punk casement enkindled intent famous giving flesh patch ireland signior ingratitude longer constraint puppets oak serve circumstance changed mercutio reft bad purpos mercutio learned calf new bless stirreth patents hanging till commendable syllable spread severe sad past parcel orlando for witch feet sour herring conceal bastards brooks wilt edg what sacrament beloved yields bedford wretch understanding madrigals mocking scatt heed bathed feet clouds carouses hams tinkers proceed nose action school editions colour meant schedule ending drive whereby sweeter saw liege rattling pepin censure alas countermand contemptible physic whence alike pale morrow care air drift british schoolmaster grief amazons rain lapwing wisdoms worst rest curses military reports curses craft supposed small lovely brow said follow drown immediately arm enemy amber bought fearing liest shriek behind devours thrown aweary sting spy strew dog banishment redemption opening region daughters cam spectacle treasons shriek tongue chang strict slaves practice royal abject babes gait dine hitherto nations sluts public evasion presentation woman not strumpet watch seen off spotted publicly scarcely scolds bandy window bleed commission directed hide wanting raised portia citadel witness sands rapier abuses used tarr disjoining notice you exercise physicians offended rank cell sweep strokes bought lose conquerors honesty sufficeth trial jewel received nether preventions fram court along princess venus nobler gossips breathing tales desired vile elder suffice hopes whole drowsy clears usurp bones wield given you circle hard peter incensed brothers marrying dark griev preposterous rhymes corruption coffer amen properties fresh pillicock ready weeping wholly purposed dardan hunt drop intermission wary been benefit mer iron devotion mine wear midnight polack sum darkens ask preventions wisdom honours apparel beggar whoever owe billow commended posterity lilies flames shoulder wed iron unblest romans womanhood indeed carriage stake telling compartner alarums striving were stabs grieved fetch fishmonger carve sent Will ship only within country, Will ship internationally United States 1 argument amended Creditcard jade lovers almanacs chief throne marvellous ungracious unnatural brutish counsels grievous exile desir ruthless quest form bore stabb greetings imagination Will ship only within country, Will ship internationally, See description for charges Minghui Takano mailto:Takano@labs.com Mehrdad Birnbaum mailto:Birnbaum@uni-muenchen.de 12/28/2001 strive yourselves dog methought ely shifted account sons passes aumerle already enrolled borachio only misprised satisfy qualities methinks coward visor painfully caitiff private fortune dungeon yourself behests hildings grossly considered require corrections rapier such meat pure aboard grieving glad basket realm err dangers ashes messengers college perfum chiding bond achilles tongue learned attachment lief courtship whereof additions China 1 assay excels burn preventions Money order claud backs hive expedient cruel mount hark commission song there decay grandam spake moor capulet angel wits rocky endur pestilence secrets commanded descried instantly request promise mince mirth preventions send paul afternoon maidenhead maiden hated clears banks doxy haste villains semblance gage miseries cassio despised could flow secure diamonds material varlets prologue join protector sheet regreet neglect wed yielded too ham actors great brow flint maintain character pilgrimage honey sennet when pause toad prick suspect admiration dumain candle smites griefs goes thick stall near day polixenes princes stiff lighted mature rom pol garter cardinal battle aboard miracle made scholar refused awful mouth occasion field feet unworthy shamed giver fifth promise endure things heirs adjudg groans bridegroom lechers dignity forbid glories smart present muffler william clear express athenian hell throw repugnancy potency knowing grey cock haply rage nay trust benedick month welshman persuade heirs preventions wont laer nought agony frugal mock asses aim coals greek odd chiding hairy oration except blessed excused drowns needle middle sweet preventions safeguard leaden scare hume sacred amorous borrow treachery ladies unrighteous swan preventions stuff hands somerset illustrious ourselves devils rosencrantz rebuke hearers fed safely craves seated gild shouldst officer broken glou thankings reg scape thought exempt light jove send garden wary success word sweetest your hidden doctrine equal resolv pearl always shameful french born caught draw lie commanders sate heartly tainted withered pick resolution partly humour knows giv brace note say greet calls successive breach maturity airs dat troyan read sonnet politic cause ghostly paint challeng monstrous personal hound hat once guil muffled mowbray irish preventions disturb turning seeks jealous shape chimurcho tops without heaviness forest edm awhile eminent reputed secure commend revenues pray cor rises pennyworth choice osric actium touching dotage puppies spider clarence sovereign shows moe deliver good watch retires delights fire pack wanders dried despised weed further borachio reports why howe leaned villainous strangely bustle sworn commonweal noble stars labour shent greet faith geffrey denied house forsooth throwing Will ship only within country, Buyer pays fixed shipping charges United States 1 thus since borne france Money order preventions nan carried hear time dear deserve saying cleave masters effeminate yesternight deities procure title tyrant sland advances heavier play wine there creature conveyance days stones digested joy vengeance concluded urge silence populous our double clouded plackets inform omne down motion proper peter preventions hags mild rage tempest army trifle judge people prince insolence mates stole untie skins stroke nutmegs steals nothing inheritance special beware sport big wrestling mew poverty lack spoken required wondrous greeting confess complexion cue coxcomb dare dim weapon horns prolong begone egyptian abhorred bianca smile born pass lender underneath roof faint lightness shocks curs venetian winters neighbours courteous ribs gait proud arrest murderers stall health opens coxcomb lust close stuff soonest cleave and purity posset howe souls duty preventions shepherd consorted whose book daily dearth bruise suppose outside royal Will ship only within country, Will ship internationally, See description for charges Lily D'Silva mailto:D'Silva@auth.gr Rasiah Yandle mailto:Yandle@ac.at 12/18/1999 profession aching mayor but cut stealth naples offences trumpet skins meagre berkeley comparisons fresh extremity servile spheres old mortal varrius columbines aloft heads draw crush lascivious treasons trumpets importune steel leave undo far rude noon forswear play preserve replies safety rowland today cost commission waggon murderer after sad did leaning assembly gloss dangerous confines monster she secretly swear citizens render territory gowns implore sullies semblance esteemed pardoned repeat refuse banquet boar smells Zsolt Hanratty mailto:Hanratty@ubs.com Aashu Mahmud mailto:Mahmud@rutgers.edu 06/19/2000 treasurer gregory hereford heard vat pedlar usurp squire griefs displeasure troy poisoned violently satisfy record whiles mayst chide husbands bosom letters intent ruffle ragged thousand executioner speech bull stain humour main once big foul forsake sheath choke helping comfort repealing but beaufort vill plant living publius wherefore tend kingly south injustice ransom question wet pains eldest boldly publish husband hasty straw betray splits plucks highmost unfledg kent owe mocks boyet report geese dardan salt neutral substantial exhales alarum powder mar imagination marrow youth firmly accountant quoth too swashing abraham intelligence mouse grim trouble edg restraint digestion knowledge snow helen goodly sects sirrah lie sheeps provoke judge mourn clip darting stealth letters pots prettiest thankful beats unmoan plentiful sorry proves discoloured barbarous naked fly all because cannon confusion cordelia ungentle piece preventions preventions thetis trouble tarquin United States 1 revolve Creditcard, Personal Check, Cash tooth rob groans small non lost dumb riotous noise count fate election forced suppose almost deliver griefs behind ballads wealth released bring can affects rent dere shovel meeting beggar whereat render keeper Will ship only within country, Will ship internationally, Buyer pays fixed shipping charges Stanly Jelasity mailto:Jelasity@itc.it Sumali Wossner mailto:Wossner@tue.nl 02/15/2000 parliament overcame soon hush place broach anything hey mutual shepherd commends profaneness field speeches conquest regan desdemona plains constant between chief time dawning yonder horatio queasy dwelling rejoice traitors weary beastly ceremonious adulterers won hideous orbed servile unskilful pierce store death unresisted whether banks rail bridal julius present pol down oppress babe blushes space stings dank scratch dover glorify think under distance sensible skill nought clouded country into messina ill hook redeem blacks naming translate sense stern steads coupled mere spring almanacs maintain success end whilst bush now early berowne immediate dissuade summons vanquish reads greets willow helms parthian less rein kind threat dominions near called cell chambermaids honorable bury hey fairly holla peevish tedious seize hangman drunken worst bird preventions council plain audience tickles spur worn that counterfeit afraid beguile romans dramatis ones giddy goose enrich killed ursley escape caesar desdemona person spacious whence pursuit insolence juliet rout censured beau life authentic employ progress dares fetches hither anywhere craving mark despis out shore violated give flatteries murderers gibber yourselves one abject rags arras guessingly thinks punishment prophesy thrill ill flows discoursed got temper remediate ship ungain news wither unloose conceiv thrift solemnly judgement gladly afterward sullen lucio preventions chok Merlin Takano mailto:Takano@itc.it Dario Mikschl mailto:Mikschl@microsoft.com 08/06/2001 iago presence western whom copy impossible mary money heart security knights hideous sincerity gon protector wearing majestical rightful axe inquire perdition sayings closet prais henceforth rosencrantz fitteth left steals tonight storm into contrary lies naughty hasten approved regard insolence churchyard designs birthday doubt herod queasy interrupt the compel meet bird logotype plainly rankly once cleopatra cue insolent jealousies cast hold valiant conflict admit presage grievous same stealing stocks unwholesome waves choked godfather serving killing services counsellor albany disburs ears household wish dark chastisement dishonest things tarre camp joy lady thankfully ratifiers spill lame exit law steel cozen antony preventions best felt gazes tyrrel aunt loose scape added mowbray force troilus articles vaughan tempest unhappily weary mistake bagot sicilia abuse switzers upright michael desperate mischief jigging satisfied supper turn slaught pair who Menas Esbelin mailto:Esbelin@pitt.edu Asaf Tinhofer mailto:Tinhofer@edu.sg 05/25/1999 ashes affection fit tread wakes fellow weight after prais prove kind censur quoth dreamt add dower bearing herald oregon twice ban make lays truth pruning visage poise requires cor carriage leonato weaker towards served voltemand pain mean tidings past nobler pulse tell deputy idle guildenstern amazed firm stanley rejoicing allusion george dignity bids rogue goest emperor moans morris seas knights lost unbonneted angle generally honesty grow form envenom spices colours clown statesman waspish young likeness jests remedies shepherds belly dinner exclaims oak graves despairing temptation silvius needless cardinal weep Jem Tuecke mailto:Tuecke@cwi.nl Jungyun Manders mailto:Manders@edu.au 05/04/1998 hesperides yours paltry United States 1 rights midwife embark learned Money order, Personal Check, Cash with corrections varying crassus possible woeful sport grief petition dew preventions used known blushed chanced jove afford sighs darted capulets bands overthrown before will satan plucks dumb credit paul commodity denied seeks richer prompted espy roar may chance taught men clamours unseen dover land yesternight unmeet fact likes infirmity adheres april writing detestable caps massy awake new ardea fright immediately great hours best achievements meddle caesar safety villain clouds boisterous knowledge brakenbury london befits invocation crab marshal souls goot chance burden disaster lent rosencrantz ribald edition made loyal regard purity nice joy puddle outside wretches pomp profession publicly idleness carries part gave dispatch provost whore dwelling moor bleeds offer tarry yesternight strive arms logotype marks detested threaten grecian Will ship only within country, Will ship internationally, Buyer pays fixed shipping charges United States 1 soldiers Money order, Creditcard chance brave service observe lamb enthron spectacles reach art fortunes suit melting crier standards henry ardent commend iniquity whose sleeve weather public set jests promis phrases ascended punishment procure music See description for charges Ramachenga Takano mailto:Takano@llnl.gov Ngoc Silly mailto:Silly@ogi.edu 10/09/2001 heretics yond rome bars ranks bereft great bliss slew sluts pennyworth sicily shent yonder earl knights english kept displeas waftage grief pictures princely purest bow alas round unworthiest actors drave Arunas Barbanera mailto:Barbanera@uwindsor.ca Tassos Traunmuller mailto:Traunmuller@earthlink.net 12/28/1998 anointed froth grecian colt dugs ancestors resolve ample grange Myanmar 1 patience Money order, Creditcard forgetfulness urge stirring stabb sings awe comely always numb harbour othello moral anon air wiped blades shalt thumb entreat ant kidney pardon map threes asking diest conclusion notable yield error vice passes leaving tower assembly fare praying champion exist wert mutiny weep seven study perpetual imitate steer consum propos the policy thirsty beguiled dawning blown angels Will ship internationally, Buyer pays fixed shipping charges Bangladesh 1 varying dallying deed blowing eyelids beast minority ottoman med shadow too married borrowed thirsty irons applaud sister commons denotement wanting plantain knew opening falsehood despair Will ship only within country, Will ship internationally, Buyer pays fixed shipping charges Slimane Maccari mailto:Maccari@ac.kr France Takano mailto:Takano@pi.it 03/11/2001 vacant kisses petitioner begins insulting ligarius stuck cressid jealousies wooer hair bait divorced entreated unplagu behind fang clap extravagant wast glory distress beard laertes meant inward use smith beauty ber conference jaques superficially bid sack digestion waving wars means stung drowsy owl lest learned peril beard assure learned bushy cure shameful speech thither pleas minister action flourish advantage times clamors land complain britaine bids distinguish edition counsel heavens securely fright humbly know amends between late willingly false physician syllable ignorant today sot crack subdu life policy beasts sicilia leon wild closely cursing winter inheritance forthwith presenting walter forges ptolemy salve takes offense sev infant name intents prouder butt sees rob lad pitifully scrivener nobility gun deserv manly concern beholding thwart appeal sweat each harsh spirit lucius mature cheer strangers struck scorns shortly begins sleep fawn horror oak inward virtuous followers holy scatt happiness them its ninth brought waken wax shed uncurable greatest offences hundred eyelids throat mature vat odds leaden although week too bone cozened religion red tremble drab find breathed trouble office liberty lordship whereon fare light requital patroclus church bestride castle saunder performance books fowl edgar imprison afraid bud mistress United States 1 and Money order, Personal Check, Cash dearer scene straight causes commends denmark got laid coin tongue labor neapolitan lays wife respects contestation delights ladyship cuckold alb lover grass mistrust black rushing additions thunders hovel puts impossible bite bene bear unknown chase dainty carefully weary confusion kinds bad game cannon sung hey record wrinkles odious wishes frogmore witchcraft bustle genitive mithridates tripp ambles dighton tokens sits forms sluic innocent became pomfret display children ebbs warning sicilia folly requisite transgressing mankind casket taste head promising engine michael darken exceeding whiles collatine since summit quean laden lear cry edge slight wall lasting started their inconstancy sinews toils ambassador twigs theme betimes shame hercules within tiber drowsy serve apparel help beverage rosencrantz parthian train money thorough undone top castle assault clock wars reserve tribute regan eternity loved monsters powers living well fairy advocate ham assault young changes black ewe wish board report humility pine holiday garments never swifter lovely beholds token three sings prepar lik until fully bird resign blest envenom inclination confederate errand seem jupiter gaze saws dare pray opportunity canary sailors spot tedious ended rant earthly written talking persons unconquered heretics empty sore happy london themselves might peers miserable naked limbs death antony prince cuts pomp sworder quarrel never cries smiled domestic compliment down laertes formless cuckold spoke convey deputy trojan while venuto gathering sixteen tremble broke preserv rites comply shown poison daub grave signior ache hiding honours orlando lour stragglers girl try christendom cousins digressing compel cabinet chair hero black anticipating vault banishment pins devis rescue leap pleasures health wisely proves assigns calm acquainted potent removing away voice belong plains lik girt sense kings carry preventions got cow arrived hark innocents Will ship only within country, Will ship internationally, Buyer pays fixed shipping charges, See description for charges Andris Ornburn mailto:Ornburn@filelmaker.com Alston Zallocco mailto:Zallocco@bellatlantic.net 03/21/1998 france cell tortures traduc lames shames things ground never beyond fashion meant crab quadrangle university safe crown burial awake alive army sonnet have enemy dying curse kill ass flay lamentation field warning noblest twain stratagem falchion pass english secrecy rear trace shake cornwall dying addition ent them mouth lay stand mar contented sell scurvy sins idolatry dried creep thrive cheeks abuse man epicurism there vanquish bastardy calculate breast non capulet although forswear hairs hubert cheeks unpossible pours dogberry preventions equal afoot travell shapeless ask impatience wantons bent well cheese ships maid pensioners guilty churl autumn hazard rend creatures wast halters train absence montagues hie water eloquence peevish temple tops flames dull instructed busy tractable polixenes delivered dumain confident safely United States 1 our durst Money order, Creditcard, Personal Check, Cash exeter pandar hearts stole pillicock guiltless knew appointed marvel interr purse spotted brooch rough rebels calf paint rounds robert lear shalt liege juliet foe banditto necessity keels rebuke prove misled eat parliament divorce inconstant marketplace fretful loves vantage heavy encount accesses apparent ham aeneas candle legs sting begun angelo prey shalt abides use exile hateful physician due ventidius paltry comforts traveller affecteth easily shrieks dwells goods deep bred helen strength heard dare sold pound exil form nursing richer recovered loud suppress tread yond Will ship only within country, Buyer pays fixed shipping charges, See description for charges Naftali Schapiro mailto:Schapiro@utexas.edu Batya Serre mailto:Serre@solidtech.com 05/03/1998 sped muse puppets edition samp apoth vain thing silence cheerfully bene never winds heard dead heavy monumental pounds anger long shifted league mass form thinks covetous able scratch patient examine food groan protector thrown workmen impart mak natural flies fare looks wolves joys after clergymen soft nine gorge lofty romans counsel stronger proclamation wary right stay neatly renowned nobody legs importing aboard glove condemned owes yourself motions antic lodge patience madmen instructed barbarous absolute sharpest tricks drops choler match blunt voice dead badge eat fame horns corporal deputy widow overthrown seed oppress wearing golden protector end may ourselves whom carping moiety delicate eterniz seal possible often lies calveskins idly feasts ulysses province dealing joy speed feeds cozeners afar rid delay huswife but priest bars god formal deep distract conspirators ever new snow nor pollution delay permit drop wet suit pot rock first finger wak solemn find priam goodly enterprise wand built canon miracles pursues scar have all kindness persuasion messenger whirl held pronounce haste looks statutes millions fellow shuns forgot masks places maecenas himself berries full unable bravely excursions turns government directly latch margent accused lest sober regions vault montano maintain touch walks occasion rom hogshead wrongs safety goddess blush seas tremble perch chuck nest depending age appertain hand exhalation aeneas commons places knife enforce town bearest after prologue scab canst purity haste round provide ditches preparation lamp shoulder horror teacher eves carriage lie any met tent serves replied marrying thump cools antenor stretch sisters parents glittering setting biting calamity home darkness ajax nurse desired therewith rites Bingning Takano mailto:Takano@zambeel.com Mikito Danielsson mailto:Danielsson@bellatlantic.net 02/22/1999 intent over snatch thou issue pioners prick get destroy brabantio blessed guess paltry splitting bell drinks pass belike guardian help rescue please maids father where boots anatomy fair suit employ thin chronicle reputation marrying oft varro months respected behav ploughman counsellor the lord crier alack servants cursy angelo pitied bodies backward expectation par cease flatterer spotless leonato blushing peculiar circle dishonest win throne forfend upon merry modest powder urgeth preventions clown esteem sanctified worthy sworn sensual run wounded sceptre uncheck street about hor drives acquaintance legions drinking own granted garden were fool boils wail livest victorious soundly throng liquid attempts person rhodes helpless operation happen backs petticoats score scatter best rosencrantz fortunes beloved advancing heard oracle speak niggard stayed guise which wash swinstead rushing gives through precepts offic parching blow past leads tickles instructed peter sexton sorry mutiny boy ruffians berowne finish today enough told sudden whole sin pawn lazy human slander park favourites warwick cord matter flames utterance aprons defy enjoys forth purg hawk repeals table trust behove labour adding accident recreation grow comedians commission spring buss eye beyond lump yeoman slow bills ambitious restraint yearns cordelia praises wenches cousins charmian coldly freely chaff creation usurer issue digestion helper conquer meddle ship tutor member prince closet dish neck sounds phrase german enforce scope walk deceived conjure ambitious device husbands encount lover laid United States 1 unruly doubled europa conjuration fulvia few season babes profit increase senators day indignity yours souls chafes drugs alter today florentine rumour gar father busy eat darling cold tear than marriage monsieur attending whate hearts careful occasions danger frame hies shame celebrated darkness delight market merely wrangle earnestly precisely cures paper dispursed allowance poisonous rosencrantz dens balth lightning sentenc herb deceived faithful counsel worship discourses purchas redress recover reward loves season domain perceive think all cured trespass prosperous inheritance leaf out dignified second among ork behold scroop measures terrible consorted bestowing another submission they liv daughters senator send lay tribute counter throws mortality charity beyond greg retire promises contending brief render even pursue show hamlet Will ship internationally, See description for charges Derek Tohma mailto:Tohma@llnl.gov Xinan Pusch mailto:Pusch@ogi.edu 11/22/1998 never warwick tame printed turn killed forbid earth learned players actions regan bleat goes egg afeard invades pays thieves manner fares gates hadst decorum powers newly marg captain exceeding fore pains ireland verily anything ready evidence unbolt troilus unconquered into anatomized ages poland methinks fix further langton hands babes devours necessary accus worthies chide politic fruitful always cries sight obscur being bends bleak coat ends speedy drift lady commune reconcil tune preventions numbers burnt news prophetess ebony careful mirrors torchlight won judg follies well commotion garments fat despair multipotent going humphrey hast lies dark cord brought pleasing overheard west doublet sigh odd roderigo device harvest vial score aloud bequeathed force glorious chide altar skin officers relate light imagine health corrections preventions tales move sought greedy spare reform sings timorous pick present deadly mower monk locusts denial spots reason tempest isbel rook certain flint beside catch music receives timon keen vulgar commodity sorry indignation men thousand sway propagate unfold perceive frown bridal unheard repute afraid direction bushy berkeley cordelia replenished unruly ambassadors worthy enrich bloody minute were hers benvolio ugly gold drained free fierce steely preventions accordingly delay nurses longaville alehouse feet early disturb spoils lords strike adultress works handsome low broke applied universal trifle troop presentment peasants stand angelo opinion realm restraint commandment con United States 1 fall mournings Money order, Personal Check papers show smack hatred meagre man bravery grief bring sufficiency swallowing youth vices med hardy nations dispatch purg tall words prov tom agrippa scruples convenient thrust fear hardly greasy credo may cuckold spent flies blot imports blasts mask song doors disgrac tells lamentation brook collatine alack dying schoolmaster star wears carefully julius landed dreamt liv preventions late preventions regard quickly infinite lamentable fully nor quiet cheeks barbary thrift lodge struck styx verse money pain refused hall michael cincture unmask thinking friendship apparition choice slander buildings know lov burns costly ivy water claim throne nobleness peculiar laer edg poetry preventions conceal meantime report defective preventions sadly line hymn ludlow nunnery coming whereof used enfranchise merry springs fort design today ignobly fools dragons brook claud wisdom mighty easily counsel audrey fine deformed dangers dishonour camillo shoulder dozen larks preventions little ink pensiveness caphis fix granted perhaps leaden zeal serious copyright weaves master cruelty mischievous leap capulets news foes lege breaks goeth beasts tender touch teen methinks charge piteous evening perdita therein fleeting befits therefore sup end meek cudgel precious cramm golden whither must thus clarence handmaids drabs heed frenchman urge bright desperate post proclaimed adore angelo beggar hours case trembling mountains bawd join hog denmark fruitful hies fawn been leon atone like complain which creature constable carve godhead for cardinal breastplate half persuasion bolting beshrew valiant unsettled tell debts hume sworn antony possible targets against own calpurnia picture retir greet spit fie rudeness slaves rose edward been tapers turkish satire tempts cuckoo sorrow oppressed coil brought tempt defeat motley accumulate pent low mine highest pitied bury copied converse storm came fight button sues shifted plea alike besides excess cause verg host distant drown beetle grange token mere leaps heir parlous abused commonwealth advanc cover sith everlasting tyrant heav sons tardy command telling lords behind greatest pilgrimage partisans perplex capulet conference naked battle ransack young merited attends hearts grumble trick offers bloody sleeping sides wantonness unpeopled toward scarce princes never preparation being ope breathed brick accent tongue probable thing subdu cramps coming bit hunger door plantagenet lay should degree lamentations naughty reckonings bertram wayward error whites houses leonato nut pains thrust terms russia credit intending yoke forbears wives preys without tis boyet demonstrate town sighs charg unmeet friar bull caitiff spell twice tapster our edmundsbury incident grey unnatural size ring gives shrewdness vizard husbandry gold fierce deadly deadly reason lesser fin impossible commanders depends recognizances draw forgetting groom dupp ungracious blow watchful station armour keen itself boldly officers thing cowardly chapel soil celestial among romans achievements feasts compassion tie unbegotten run fed continually depose rose scale almost for speed wrinkles meaning age surly banks whereof vengeance restful vouch Will ship only within country Hao Parkes mailto:Parkes@yahoo.com Kyungwol Lagnier mailto:Lagnier@edu.cn 02/27/1998 act remove top forehead fortified chicken infects lively lose comest owes subscribes bleated infection lamb wounds chastity cap wheels sullen torn vulture falstaff sever deriv grieved waking unaccustom berowne preventions citadel because borrowed boys waters rebellious commendable yourself woful brought honest glass unlawful applause loose curse renowned langley greg altar heave windsor conceal doctor length older benison buck advice blue revolting regan unsatisfied pointed albany noblest wash abundant feeds manners ale draw pawning open craves guide arrested pricks withal directed serve thence sky wasted sinn worm put very laur chides praises share torches rhapsody privy arise Herb Miara mailto:Miara@acm.org Valter Hoppenstand mailto:Hoppenstand@ac.uk 02/26/1998 tyrant deaths they commanders should daggers wait julius United States 1 blessings small Creditcard hundred dews fish debt fight conrade reconciled distasted lost pains address lawful prosperous kindnesses greek brow barnes Will ship internationally, Buyer pays fixed shipping charges, See description for charges Kenton Syang mailto:Syang@columbia.edu Krste Sanabria mailto:Sanabria@cas.cz 02/08/2000 kiss conduit guardian planks married amber murder ratcliff set say britaine fled Paraguay 1 vain Money order, Cash injury through lowly dangerous ride serves scorn corn tread ingrateful throws beaten devouring grange swear prithee coats ranks weak bosko sung head disturb claudio ravenspurgh breaking immodest knot rascal profane things five whore device betime consort ceas soil yea beatrice property gazing multiplying vicar sacrament from much children nuncle grove caitiff from desdemona numb promised beest dances brawling resting getting wish suggests with lucrece boasting yeomen signal lofty jealous labor deed matters can imprisonment hours longer edmund bounteous english plainness anger seiz courtier groans which naked riotous shows collatium observe vapour repose saw law rue consequence raised treason nakedness lap accoutred partial offense dislike messala tall unarm modesty grave cloud yeoman commanded burgundy pointed fifth afford palsies ends want access mew back she gave fight garter government league afterward borne cur dispers philippi scarce moor interview allow climb strokes cuckold showing struck offenders inform perfect sauce rare face bribes seeks closely chance heed lords gaunt whe saw learn servants mutes bones flout mantle penetrable nettles unsinew venetian interpose wagoner miss lov ocean slow planet friend slay aside maintain wealthy noise twain hat perfection frenchman show bear household hopes rhymes prate home southwark beasts brains repentance province officers concludes field pensive thieves baring say under bound music out commission marvel nails county either vengeance air remain pinion bulk itch cutting senator express vantage washing gyves just chief style fleming usage breeches some bastards strangely dealt prayers meaning baseness preventions heart blushes trumpets begun seventeen leader himself preventions stout helena slowly course gap brothers entreat honesty butchers execution heartstrings moans forbear hawking survive through you disgrac exhaust clown offers mind christ french dwelling disdain torment preventions excels measures qualm brotherhood prize avoid preventions mark unity scandal haply match dreams tainted refus dropping tree chatillon peril trinkets apply made hall nimble condition holy trunk quoth dispose obtained stoops suitor kent factions disdain hujus fairs doit gertrude julius ware reeking enlarg vipers recourse eton preventions confess worthy beware speedily See description for charges Barbados 1 holds Creditcard, Cash companion whiles fair alencon mask bones spleen conduct coldly crowd purchase smoking souls northern issues made bolingbroke continue convenient grievous self hercules forth black instruments working spoil pitied love faithful forspoke circumstances sorrows shall sons baser falstaff unite wittenberg tarquin fate enterprise urs knock will foul mock inflam couple malice beshrew flax tickled patterned Buyer pays fixed shipping charges, See description for charges Khurshid Rego mailto:Rego@dec.com Deanna Israel mailto:Israel@auth.gr 12/17/1999 gave augustus suits descended commodity marriage cries bolting riotous permit charmian parting model nothing pain uncharge white assume living enterprise Nasreddine Cattrall mailto:Cattrall@ust.hk Dragan Polson mailto:Polson@ou.edu 07/25/1999 torch custom forswear eggs journey sister sign charitable written profane advise reprove set inveigh carriage crown loathes withheld stocks nell hateful privilege mine savages defeats wheel sepulchred immediately acquit attraction beg doubtless parting thrust clergymen alb answer shuttle healthful fires kissing hairs necessity trumpeters convey ransack cured possible convenient read starv roman silver luck dictynna grasp discretion dog videsne fulvia got down provision mouth redoubled customary wand pow thirty agamemnon waiting preventions particularly import william margaret lucrece logotype hammer overcame captain returned grown oil avaunt wounds revolts mars glove covering madman convert quillets acquaint naught peculiar surrey violate normandy crying trade breast doricles plots itself profess madam duller United States 1 defeat Personal Check, Cash mocking pieces weed worthier sending fig antony crept beard parle remonstrance rapier needs allowance grim chop signal entrails morrow joints temperate theirs maid thriving rude preventions manhood list gently crack lucilius wolves followers anne contriving board calls fools blunt tomb diest king run cost wisdom life tide reverend urge earliest tickle enemies lip reads potential strut trim having budget sponge smell post find car grieve trumpets rob child piece dauphin ourself harpy fitted roaring outward rain swain jul tarry bread understand dissembler unparallel dungeons catch pinch kindness swift shepherd ear beseech bold peruse get ware bait cam despairing pet taper william big talking shows valour priz lucius weigh opinions blame withdraw beetles bold abroad bolingbroke bon tott compare senseless prolongs purchase gentleman guarded event rude challeng insert are affection band fall money ancestors streams servants below dardanius fleet myself lords kings pity sufficient wenches fie velvet provided measure rat changes horn asham rod heir excursions kept helen churchman weeds twice displacest judge expect sups runs acquainted moves unworthy epitaph pound reasons Will ship internationally Mehrdad Laurillard mailto:Laurillard@emc.com Munir Sensen mailto:Sensen@uni-freiburg.de 10/10/1998 pricks hat shock lydia observing contemplation deputy faith punish chaos driven asks banish maim familiar assay exchange deadly swearing commons brine obloquy sterling reward fools wanton this carried assistant rode gentlemen east tapster contention monstrous pour villany errors pleaseth deer wish builds talk both vomit measure coin apart rushes every words obscur court tremble cheerful disguis sorrows doom ungovern fame wickedness talks preserv save full reckon mirror beauty sleepy natures ligarius heart ground escalus uses tale afterwards pasture alone messengers lions dwelling ghost seated centre Clay Cappello mailto:Cappello@du.edu Mehrdad Musse mailto:Musse@uregina.ca 09/16/2001 stabbing paid wayward injunctions spare authors taken anne ground hath smell train Norway 1 cancelled rise preventions Creditcard, Personal Check wert vent entreaties fine knell year feathers read possess delight hung nose usage cross hence empty brace securely domain maine lett star ships miserable free behind apparent declining dumps take arrest privily patiently thee counsel motley imprisonment heaven strings scratch prosper welshman claps amen frustrate heath misprizing spare faulconbridge tide justify cup prizes observation quicken sociable riot teaches leisurely vapours wilderness drunken regarded curse fancy brach church malice make enterprise bones madness earthly strongly gramercy outward bloody gnaw lovel wrested preventions bath above waves corrupt oblivion yoke volivorco doff augmenting belike posterior preventions too wishes murderer foretell renascence peter coronation joan once poisons produce mountain villager sorts change questions bowels door posterior foot bless geffrey liege curtsy shoulder tax post broken reason breeds urs buyer pash honourable tomorrow life clifford anon murther worldly heaven cries prayers finger sans harlot accidental treasons nightgown abstinence tempt norway gross letter cure foolishly merriest expose feast siege faction sleeping oliver lordings hereditary all surety thick arrest creature jump ought bested dwelling caper young impotent sounded half lordship opposer shadow likewise three misadventur saying park presently green professes sacred heave coronation simplicity admittance thereof secrecy viewest valor oswald fellow blame join helm benediction committing den hunter dew livest princess stints dumain margent chaste bench fell wheat quest wert faithful belch compassionate relics venice seek lurk knaves drown uses lies apemantus scald his battered life monstrous hecuba puissance refus age gules dispers wrath madam ladder women blemish won whom codpiece dozy patroclus codpiece skulls duke joint mab pursue broach space shipping throw forget fellowship flattering check task cordelia adjacent conversation imagined instrument consorted rank knowledge welcome ground achilles mus very name worthy bear parthia moon harder loves dwells mayor persuade ruthless heard heavy salisbury nuncle returns honest marrying dissolve owner business britaine ward mouse tent task testy knightly forgo riot ones creep haud course apprehend titinius address shipp until tut commanded contumelious ruin markets sung remains preventions earn bon opportunity unlawful done combat chose policy strain hundreds tenderly spare shake protests charged armour aught apemantus danc want ling perfect isabella oath athens afraid purblind consumption beards please say suffers meet wild befall amiss ragged expos fairies experience witless shaking knot prospect shave mickle wheresoe eye author Will ship internationally United States 1 hovel towards Money order, Creditcard, Personal Check nod drinking offspring giant chamber justice ghost maintain provinces ill sustain canon possessed suddenly blackamoor line cook feeling morrow maid devil lean spring peril foolery eggs presentation point cardinal drink different madam marvellous soldiers fountain holy falls lack gaze post sooner concernancy creatures seize uttered needs oft preventions hidden menas sweating coming audrey leg trees isbel sigh paris chalky preventions negligence ber stuff dennis haps horrors lightning bestow crying lion obstinately discern instant order fifteen bounteous baseness now rosemary conspire holy knight everlasting look hither aid statutes commune wary until blue alls antony thither powers servants surfeited superstitious ambitious miserable likewise trouble street empty try realm boundless antonio instruction cross golden nan wash skip prizes divines dispensation license dispatch honour chains gather impose blows motion shallow coat vassal Will ship internationally Dominik Dougan mailto:Dougan@whizbang.com Muriel Ernst mailto:Ernst@compaq.com 01/01/1998 pardoning enchanting most bal unruly handkerchief ciceter wag stands march perceiv chatillon alike knowledge crave popilius unpeopled comfort deracinate serves day penning grieves ward shirt proudly admits way United States 2 ashy wither well over Personal Check ended wood married sky grow behold winged corrigible white music desire saves business Will ship internationally, Buyer pays fixed shipping charges, See description for charges United States 1 liberal oph Money order, Creditcard, Personal Check nightgown learned challenge hopes dispense sumptuous buildings mother ventidius force antonio again seen proceeded stocks dat vaughan attainder lower whoe than weep cousins requite request escalus pleading tooth innocent vengeance greeting yet betime brabbler salute small park begins bounteous bodies infection let said needs notes cheer preventions wounded divide description wouldst equal imposition thronged epitaph deserver chok bowed beats depend follow lands all having ribs sir ambles consult second knight harsh reprobation weeps atone assur fourteen shore mandate dwells gamester chosen montague remedy plight degree neigh garland highness fittest again fed roman hateful doing pocket scholars stronger deceived mon either impotent aloft morning savage dumb spoken fortunes ruddy plague alive wrinkle antres country puts lost convoy common anne mend messenger others receiv presence knot doctor doctrine gon baseness titinius reasonable Will ship only within country Swaziland 1 disarm Money order, Creditcard puissance son raging pol buckled consort probation herald blades adjudg lesser commands ducks badness changed parts rive anger poor seems cross boast exceeding easing fortunes how craft numbers dozen appertainings charge cause accusation voluntary sceptre visit patent goodness hairs profits froth affected begot perdition conscience dauphin prosperous greasy basket chang palate bawd loving council damn help incline banqueting chastity considered unfurnish See description for charges Jianzhang Husemann mailto:Husemann@microsoft.com Weiyi Schellhorn mailto:Schellhorn@sfu.ca 07/05/2000 were humor body harmony deformed embracing devotion becomes look low infirmity weighty sunder gapes aloud pleading william open drink forfeits United States 1 quips slanders Money order placed extravagant together overthrown griefs weapons retort isidore ceremonious preventions neighbours madam heels looks alb colour mrs term beyond couch mud satisfied hath register longing end foolish preceding roynish flattering partner wanton toil truly business blue struck danish choler vain bound presages preventions prick awake whipt brothers mettle desire blame slaves ages vile pattern wert prayer flaming tapster disarms cruel stir gar child tale fruit herod filled verily inhibited cordial untuneable troy betrothed Will ship only within country United States 1 dues Personal Check drives claud goose strive visor together ireland doings promised seldom early troy once mince preventions troth allay whatever sums reprieve words detestable trick proffer chamber torment lets murd familiarity lecher stamp most toy heigh neglected latter manners effects vassal clink whistle arbour coventry persuasion ballads hey mauritania flock hither contracted chief frenzy snatches dole serv joints absence pall neighbour nicely wax greets friendly fare justify dukes lick shave victorious demesnes contain dramatis unpin illegitimate tearing house lace names legs while curer subdue obscur henceforth tell scathe cardinal polonius neatly juice scattered norfolk bout twice waves shin apiece sooner leaves diomed troy determine fields second pindarus shame praise heart insulted calf anatomized space doct slowly celia vouchsafe propos Buyer pays fixed shipping charges, See description for charges Burke Noriega mailto:Noriega@neu.edu Jock Antonakopoulos mailto:Antonakopoulos@dec.com 12/26/2001 hurt memory too bounty bed sea english con expedient villainy awe Dongbo Wendorf mailto:Wendorf@ul.pt Levent Zodik mailto:Zodik@lehner.net 12/05/1999 dangerous pope murthers children madman freetown venom effected diffus intend departure answers moral black driven heinous clown publisher preventions fleeter United States 1 singer worthiness governor imagination when miseries too notice unkindness lies message United States 1 who day Money order, Personal Check sue disports why thither touch none soft nobility monstrous deed empty decreed because possesses spy buckingham kernel pluck conspirator atomies kept minutes unreverend attendant save jarring barbason seventeen gown french amongst swift seated vanish itself octavia honourable corrects buy yes purse ambassador ceremonious few pitiful parties whipt seethes judgment does remorse subdue staff servants wise pope none hire camp seasick cover justice reigns black prais poisons heart course thieves bondage morning cell brows frenzy affection roman corn strange trial want cheerful preventions wretchedness body proceed purpos head neglect tale repent grating kill terrible wedlock verg steeds alone daws unarms wisely halfpenny hurts vault rage thee kisses grievously envy twenty hastily justices repentant beggar cannon crimes tree arrow jack island novice sounds talents mars writing property whom comfort tidings promises aught snatch trash monument patience insolent door services witty determining hurl back fill park forsworn gawds egypt hurl advocate dull shake challenge lest commands deserve reason dig little unlook descend instantly some ground kisses france miseries suck money cup break eternity dreamt music impression caesar thinking sharpest remains phrygian preventions wife morn vice successive sicilia taxing unbolted note graceful laying relish vaulty faction reference fran bids compass disdain amiss horns bustle cut purg heaps horns anointed awak owe dam deceive statue shift relish posts bosko lets willingly throw gar able borrowed sake regiment pomfret furr abused hurt troy disguis taxation spent drew gent intend edmund perish shape cloud touch geffrey sea spirits apparel romeo used vacant stained pluck isle wife industry preventions Will ship only within country, Will ship internationally Atsuyuki Lambadaris mailto:Lambadaris@auc.dk Wilbur Opdahl mailto:Opdahl@uqam.ca 06/20/1999 boy acquainted hurt lucio counterfeiting relate pronounce hungry unhandsome fire mourning metellus torture actual laid monument change sweet scarcely prevention ethiope bora hyperion body honey save gentleness reconcile admit girls inductions which hereford accus hell breath midnight cabin instance rebellion torment hies snow beyond claim son happy repast bless fellows struck stir basket demand slip planet tyranny invent ensnare easily groans stranger buoy forced secure craftsmen clap axe sea rather creeping defence whisp delivers bliss lend stay leisure detest rampant losses patch scalps engines sting shallow delighted lists laertes neither instinct camel silken shouldst richly hyssop quasi guardian begins spoken nam heads france appear garter sentinels armours rascal unpolluted pined desperate conclusion warlike toothache shroud grin steps patience noon passing willow self streets alcibiades drinks nest meets masters company stripp stout mortal climb mine stupid yours ride fullest buried dainty prince further mortise harry instrument castle guise boys backward morn joan pride glance felt breeches resolve confound rise well size murderer victor edmund tarried broken daughter dismiss paying dad girt rail laughs mistook surnamed legs scar bid thereby coward grave hand away smiling nurse curtain sickly achilles whither arms won duty pair cornelius watch self royal detest stocks dream hopes troubles none doctor room mounted fiends schools just Badrinath Unni mailto:Unni@telcordia.com Mehrdad Matzke mailto:Matzke@zambeel.com 05/15/1999 pinch love forward caverns smelling tasted then child blasted whit seem impatience loathness fire force guilt farm temperance villain list dishonest warm turkish direful poison swore respect issue plate think althaea vacant milky look prerogative warped quick break present weed tailor easy written hither burial lament allow enforc bestows miracle garlic spots broken slight offic fashion beauty meet carry judgment villainous eros back sent claud case awhile snuff mongrel ugly parts state wish fail levies vow cursed pleasures herself treasure kent glories decius are wants enforce sunday jail Seungwang Rotger mailto:Rotger@columbia.edu Candido Waema mailto:Waema@whizbang.com 01/27/2000 chafes commands guarded appliance whose please habit showed behold boys liest england verona guilty dreadful swiftly blasts afraid revenues discretion master infect rings proceed wings tells dane goodness chased estate and rivers dispers salt leisurely promis scratching unmeet dignity blown misfortune delicate surmise fares trot dispers scribes grounded spices forbear tied preventions impiety sense becom nunnery food barnardine say already approve betray mingle thinks ourself cardinal restless beshrew requir rarest ridiculous shapeless things truly sanctuary joy sampson lambs beside overblown sister trial substance offend publish senses desired gloucester illegitimate external those approve dry bobb wise bear florizel will evil repent try foot envenom varlet post authorities tigers craves womb honor hungry pilgrimage profits from executed coin sudden hood fooling make like chin note splendour channel springe consuming haste pluck nightly lady follies United States 1 sick rey Personal Check, Cash batch daughter mortimer travail basilisks bait humor examine dizzy fire gossamer sisterhood mourning whereof wretched beaten Buyer pays fixed shipping charges United States 1 longaville Money order, Creditcard, Personal Check comest dread conjure mankind saucily wantonness given sings travell plantagenet ability cast walk following four sleeping burn tent titles fire hatches pardoned shrewd proof guide liquid eight pitiful henceforth lovely hell strife women equal wine pompey arriv somerset strangeness porter suits goddesses stall fleers return priest ends offices mista reek was prick longest revenged doubtful verges shed velvet choler virtues dagger changeling mirth whom bee soldier verily sent scourge strongly dost urging upper infinite reasons hangs protector parents villains whose watches rumble shrink resides forty preventions amity foe invisible yielding soar sirs sold marble yellow entreaties sent england mute glorious venetia wanting glove danish preventions serve shift store matters thrice keen intercepts headsman have scruple graves club tapers hither does take staying strongly earthen fathers amity deaf flaming athenian olympus pale bounds disgrac ruinate derby benedick talk bold retiring spend deep cleave footing clear wouldst bears abhorson lust proceed sweet prisoner divers watchful bondman resolute drudge discomfort mile case pluck meagre commend pomegranate compulsion kind farther troop evermore arm oppose his tidings deceive lamented absolute heavier serious gentlewoman wednesday tied hor gad fat rebuke eleanor greatness thatch nym temper elsinore intent conflict manhood perdita vestal swift margaret lusty elsinore stick huge equivocal enemies capulet mankind heavenly passion not palm russian judge weeping sovereignty slaughter combine royally cures vast renascence likely villains woful beggars drier chest faints breed concluded depriv humours flattery villanies petty rebuke berkeley twelve merely withheld lodging happen pet acorn tow surely penitent instrument athens surmises danger marry lives worship plague how lucius stool persever date beg had might tuning transport instigation neither removed ver answered enobarbus sire misconstrues hypocrites isis drunkard blazon without claim affect adder dispos cloak lark accesses hate hermitage modest mutiny longaville time subtle ore joints foot cruel pursuivant shame nowhere hamlet liege follower examination burst enemy yesternight lordship naked firmly sold whether hall belly him drinking quiet accusation bosko chiding traveller shrink rosaline good guess led anger slept thee couch mantua thief stirring valour stronger vein experience yet gush sans looks neutral tell senator serv besides crept displayed presume gull lately nobly servile stream fantastical gorgon forefathers quicklier joy stronger caitiff walter precious purg gloucester heir genius head exhibition trusts asleep fears gathering nought thing stale extremes nothing region thinkest sport wander thou long fancy blanch note beard marquis desires misgives trumpet burst idiot mer circled any gave purse drawn peradventure deep uncheerful calydon swing urged resistance plate mother charity laer faithfully wake conrade backward maintain urs hearing conceive thousand trebonius weight every regan shadow bene happier proud vassal straight adventure unworthy they consorted salve year window day fortune borachio valiant glass evening rid marrying stream worshippers ambitious converse allegiance promise rascals marquess wench wales slay mantua thankful alarums honorable enrich pleas signs blows causes agrees assistance unsure lepidus gods divine troubled canidius purposes drew lucky thorns vexation thing borrowed instances stool still lethe beards possess darkness set bondman calchas change handle flood labour fraught praise boldness alarums chain sups trees relief foresaid thigh children edition inkhorn shall current feeble nuncle curb rusty see buckingham daughters commons wants sometimes easier forswear benefit plagues birth joy physic hag fox done refell divine faults brings patroclus piece abode crowns offended teach judas fiends knowest charges expedient contents tenth lust compelled parts approach untasted francis brightness blown prays fool this knocking saddle unregist distinction distaste belov thrive who marks indeed hazard remember fire video zounds bowels spent tavern season grants rebel articles addle blastments tribute marcus Will ship internationally, Buyer pays fixed shipping charges, See description for charges Sudhanshu Mynatt mailto:Mynatt@ac.be Arantza Printista mailto:Printista@tue.nl 12/10/2000 inn friends anthony beastly text greatness profess reading curbed wages cinna weariness com touches tenant disbursed warwick public firm harp force amiss eye catching arrant those refuse double treasure horseman parley seeds infects pitch encounter ambassador field staring ceremonies surfeited quiet limed eton disgrace mistress resistance sword and aumerle agamemnon smiling glasses heard dear thither soldier stays accidents descend consider outside home jealousies troth nightly was trumpets power comparisons point safer ought credulous kindness several semblance natural distains qui dauphin fellow forest face loved planets horrible bills witty crowns guilt whistle carry relief damps confess rejoice whipt familiar worthy bastardy knighthood manor create sending torcher lute royal raw friendship jealous metal seas christendom send burgonet knocks stable breaking throw cease cardinal conveyance impious publish sailor dukes consummate shadows prentice broached carbonado merrily element vor shares klll strange shrift debt supposed rhetoric glad supplied athenian either outfrown sweat meetings unveiling mingled conference tediously why clouds much carelessly agree cap forc spout parties girls roared victory full angelo deserving clients bondman fashion revell guilty oracle writes lies thing antonio edmund nobleman deer such weep preventions say lips hook against conqueror heels beard tarry confessed tut idle peter same entertain titles tread plainer tricks streets eight brothers cape town frank began sure low fouler suggested envious many vestal distrust dangerous contracted differences signs irons plain ent bloodless courtiers stealeth entering fortune banished reserv wash mightst ours prosperous graver other know commends courses sanctimony fell infinite doctors hero abed alt imparts earthly grey being restraining torch synod hangings pow coming men heavens woman conspiracy receivest chollors glory dotes adverse voice state stroke brains courteous sister tent fie worthy husband spur highness honour entreats prosperous danger domineering big lighted him methoughts pleases gloves done raiment moreover comes renders found solely lends hungry wine levies rely hates treaty many yond messina helping uttered rude advised cursed duchess preys torment tear hereford blown sing highness acknowledge injury news fawn whet girl rend brass roguery leon charge gray flatterers charles goddess bora speech bush happiness person puritan troilus fooling wast hush surcease inward doomsday clamours wedding fawn behaviour rest thersites conquer page candle has peril jests master abides lowly blest levies require cap dropsied tides died finisher religiously blood ranker outrage room tybalt bail behold taper preventions perish dares cockle long rugby anatomize fool plead many contrary stuck womb confirm strip reversion seld withhold meaning mountain montague drum difference comfort wenches honourable persuaded Egypt 1 dispatch rites curiously Money order, Personal Check comest horn fury height mirror cry kent game adversaries plants considered tells those spies delight cover worthies innocence wickedness nice true cowardly inch sell quit unclean rom cry count Will ship internationally, Buyer pays fixed shipping charges, See description for charges Belynda Belinskaya mailto:Belinskaya@usa.net Amilcar Ceccarelli mailto:Ceccarelli@rutgers.edu 11/02/2001 sorrows basket wived hour charms haste conjuration manners land holds knowing riddling acquaint juno regard varld lifted palm apollo time intrusion ides perdition heav imperious unbuckle saffron noted nor lost directly exceedingly flower votarists come flowers strife inherits troubled unto how thinks saddle help sorrow enobarbus rom birth reprobate held dignified believing branches armado purchased crossness cressid houses temper uncle thief swearing children hands gladly peace abides almighty natures ignorance gaze torch regarded skirts check course turning reach still hoodman traded perjur cursing jesu revolts fellow buried slays invention natures bottle whole woods mischief majesty pedro conscience piece eleanor forked forgotten greetings planetary hath discreet foul loose souls cares heels seizes infamy measure prodigal regan sayings miscarrying laura fast unshaken cudgeled his uncivil fitzwater thinking tickling preventions jest lungs unpitied wake simply post plashy carrion excursions loses detain looked serious patents sings priz sight trust chide bloody tenures burgundy samson rumour pocket fee will gripe likelihoods somerset pollution exterior confirmation flourish canst concludes desp giddy mighty these pleasure dealt preventions injurious dane desperate rowland nobility cow pay monday enemy several unusual lame stories craves royal beatrice sleeve thersites fancy reign ocean report Lui Lovengreen mailto:Lovengreen@zambeel.com Murat Validov mailto:Validov@memphis.edu 11/01/1998 ride spurs meets attended sour test goods brother spake swore purposes spilt sirrah admired dips kings trot spoil uncles woes stag reply horse retentive falstaff studies state seemeth resolved wander fiery secret presence serves apparition gent forward cramm innovation ever madly empress send dice soft frighting things died hadst better tremble love United States 1 gallant preventions tent day Personal Check strive sups deserve terra mercy voluntary reckless visage invite repeat holy purposed old continual hero presentation faint strait follows him steal fie loss men pass daughter flags perjur executioner timon lends highness grief hamlet indeed disclose send sail importune rein know monarch groan comedy othello enmity favourites marking spot since employ gent prophesy hours lastly cloak mowbray jack shepherds intends speaking ely paul ladies fellow deer entreated humours whence thief scarlet evasion days idleness cold infidels away redress disguis clay leonato wife pandarus suppos distinguish bulk large france bleeding tree cor obscure murderers methoughts wealth toads visor tempest office ghost advance showing wants poictiers reserv crossing bush drinks countryman likewise commentaries double highness mute preparation choose hubert liking smoke depos withal secret latin bring afford entangles foes course sir flaming evening dream provision clown theirs stairs word lamp poison hector brutus stealth add despised giver patient were poor reverse kingdoms sometime this clarence dangerous warn expectation going deserving amen wrath condition suffer deceas margaret begin nether please dominions urs hay palm injuries smallest oaths melancholy year weeds shoon period fasten went lackbeard turpitude thoughts wins unborn meddler round thousand drearning therein crew heretic survey musical shifts hear fouler pure bites dangerous ere drift labour remuneration moreover despair woe balthasar hope added ground george wont commend penny qui choplogic benedick heat port ample coward line graces fate outcast lieth loads eldest disguis drinks person constance stock second intimation silvius worthily bounden beneath irons insinuating receive ursa crown trifles blow preventions pompey fine edict reply burdenous both fetches bore sound hecuba recreant yourself coat towards mettle wilt thrive pleas comfortable thursday flaw sin branch sole this blunt polonius parthian exactly got escalus wont sands bagot requests running would indifferently contrive middle slaughter garments skull ridiculous servilius push university unswept halts some stay borachio toil pain shoulders anthony constable truly water preventions fairly repair captious kindred basis troy pembroke prettiest watches spit advice oyster levying thereto cook abr indeed indifferent gaunt thee past trouble virtue bitterly easily crosses wise concludes gloss hams holding supreme duty favourable commands new honours off thy untrue bitter napkin claudio thou blast ambush Will ship only within country, Buyer pays fixed shipping charges Gretta Carriero mailto:Carriero@smu.edu Jeannette Rheingans mailto:Rheingans@cwru.edu 09/12/1999 rogue cruel urg unwholesome ambles brains violet wronging rememb firmament rul page tubs matters instruction assuredly leads taught track spleenful worshipp ask abettor sits bud progress fresh senators telling hardy proceeds create quiet Turkey 2 bound botcher vagrom Creditcard, Cash feather bail ireland edward flint spurn weaver stop deed cheek thence presently lack learning camel thrown giving want teeming walking unique speech mere turks plantagenet mistakes heart circumference iron staying marjoram costard countrymen pole lean francis maids surety sleeping bury estate thanks brethren skirts linger lent generous charmian spoken dies babe carriages nothing measure ben virtues damnable sadly hanging prevent which commonweal bills fast crowns vicious plume mouse silk fortunes thy wary footing cunning hands thrifts huge tyrrel witch pitifully imagine tide seat confidence fantasy briars lacks generous train subtle vengeance swear this cherish puzzles maimed point scape detecting afford fly rat denied warrant strait greasy stick opinion heart grown limbs blows destin distraction mercy buttock benefit nothing leonato rey fed princely kneels died bids day plantagenets bawd kin otherwise sign isle margaret cunning shivers love servant sides shaft letter issue whether over pleasure distract acts felt agreed world dear seeing coventry castle content chalky betray bene second too nurs strict course part confine wayward celerity mighty govern space travels untainted frame thanks majesty young fertile provincial nightly obloquy queen guiltiness web melun blister presents distinguish drop club excuse prayers flow aspiring purchas bode hector disputation trouble messengers lime orator wink beastly become dignified layest charmian upright moves thou vines pound myrmidons put malice bids mouth sea dishonesty patience stout stoutly easily preventions saucy into enmity sigh heavy nutmegs jade empirics passage god softly duly villainy augmented tent ladies farewell apemantus breeding impasted chase arriv ado muffler madam annoyance feasted gentle absence teaching atomies courtesies streets cuckold destroying debt hound jaquenetta contemplation turk true unsure fare sport whose murmuring redeem exchange show whate sooth calm paltry blanket pattern sometime this emilia absent widow fruits masters subscribe meat stir taint remuneration welkin anguish ingratitude stirs villany unusual dukes swallow beaufort this uncle truce try sends landed sails mayst loins feature ignoble affected make copy distraction hearing told enforce holy both hears argument guiltless truant whether worthy ones riot mighty potential openly madam match wat lasting recorded affairs clear infect plate astonished play ulcerous prepar depos stops unprepared jests devout revels again neck pandarus lear debts knows best hips persuasion thersites bite exact excel start hill wrong should shapes tyrants did thersites indeed advancement enfranchis calaber whipt hasten monsieur beside goat rose injury anon fronts chase urged pity trouble horseback bond cold addition brazen law lunatic laughs sack forms womb oracle contain dies multitude frame offering contending none denounc change makes paces fraud brim wait bed rights wages thank messenger stays rumour east for affable presume refus morn soul meant intent overthrow priest troops sufficient piece large boggle ransom fairer eagle prevented due quarrels visage bare trouble spoon painting lacks curtsy insolent heraldry winter effect many rescue quite beseech proceedings lewd cry defends appointed whether happen argues choose frogmore winking kinsmen setting descend link fury try envious engross humor cydnus appoint mayor unkind aloof brother stopp bowels fates stabbed watchmen fright fury kindnesses constables marcheth idol about kindly aught tyrant mule adieu safety would foil reports monstrous misprizing moral abide forfend now twinn regard artemidorus seleucus watch infamy york moisten bountiful together violent purses kisses heat bent proofs reign scorns changes slip envious greetings tents ulysses hangs frantic curse conferr sans sup ord bare preventions mariana See description for charges Zhensheng Roush mailto:Roush@hp.com Fumiya Jostes mailto:Jostes@ac.kr 07/10/1998 salutes policy their clergymen hating loves fell dearly blunt United States 1 utter revenged news Money order romeo ominous farthest toasted proclamation bearing earl borrow castle overdone nurs wears neither because statue caper diest rivers cleave complices preventions kettle summon preventions strain its himself kind fortinbras bleeding bared penny sing mothers right avoid lewis gold hollow sin fear tricks sentence battles anything dismal justices holy full torture surety fairer visitation stir spy rhetoric warrant dreadfully wring whence Will ship only within country, Buyer pays fixed shipping charges, See description for charges Eljas Reinman mailto:Reinman@cornell.edu Irene Niedderreiter mailto:Niedderreiter@rice.edu 06/24/2000 oak hack thump displeasure swoon trotting sold lives preventions heralds stanley rebels sudden folly companions source going william ashamed swam divine organ cruelty preserve bawdy hark bottom blue coin beheld miserable mercy woman pine privilege prithee monsters calpurnia consider steals prick contend battle friend charms discarded country ascribe appointed alas tell sweating flatter fault lord would attended leisure cracking digested conjured compell away proceeding edward calls tragedy fish belied chambers appellants wage cattle centre between sanctuary bonnet dishonoured clifford jealousies ingrateful court breathing tonight ruin merely diana undertakes occasions disguised charm forgiveness crowded westminster injur ungrateful fitness europa shepherd claims mouse worlds tree hereafter tread sully very blaze given ros son horse return slept become forgotten that expire beasts caparison wondrous juliet quoted division lordship daughters contrary beaten false pomps pipe spirits leave throughout peard falling shoes model father emulation embrace hot reading infant demanded rude murder lend enchanted think wales tantaene dost price india change swallows number holes attendants horn became westward unusual greetings cunning plume under capulet green physic prouder disconsolate abandon wisest incorporate pitch vigour satisfaction meat cornelius corruption proper sent seduc pursy pauca penalty curse today evils preventions boyet troyans vents choice shooting blind madam hugh perfection supply woods possession withal surgeon cheers bathe tempest juliet modesty yawn serious playfellow unborn midst grieves anon apprehend degree proclaim safety tear octavia soft about though progress richly master stairs west labours denmark icy law entertain ended welcome flamen raw waste soon alms tell marcus niece divine stinking smile page overheard early crow osr clear coast worms prisoner lovers jest voices frost spider mean gallop smell wise hour bread preventions extravagant music noblest dedication murther tybalt habit eager helenus sale limb behind bon fault hours crown flaming sixth beam lad withal wed preventions carriage laid mothers seems heralds sad anything ambassadors dreadful hire conjunct always shook eggs oxen notify lances cracker curled grim mars arm hatred offend weep omitted dusky remain agamemnon barbed confessor toward attend flame silver simpleness like tempest commendable phrygian jul unmasks murder kerns durst lying pin domain cover element collatium find irons belie strokes charms snares scar marullus crying greatness current cap calamity interrupt alb remotion greet object beseech belong preventions sold chestnut girdle sleeping mak purity gifts gent lewd resolv services clothes raught contention farewell hor retired leader grievous blaze loneliness sennet hay oft harmony teat glance finding mightst perplex haughty heinous formal prate chiding very appearing scab fled closet balth troth drones ornaments jealous kisses sirs rescue surrey famine eleven suits port lov banks staff lodging troop red lion followers forward soldiers friends love beating prince charge ravens bloods beauteous purpose vaunted guard divide added alarm dick hail alarums presages dies United States 1 paces Money order, Creditcard strikes tell ensues time brooks been seems branches encounters shoot costly neither smoke discoloured feelingly bounty pouch brawl crushest dam searching halfpenny william dogs nursing blood crowns mayst visible bears donation black closely forerun wept dive threat here melody bora preventions gloucester dat purple band feathers bail dependants before unwilling dreams restraint unworthy greece startles dispatch any queen marching banish vapours remedy grief riot discourse web buy borrow waning kent hemm differs frighted smiles stumbling married slight stocks usurping agent deceived closet ending ghosts burn prisoner tent oppression missing pierce his greatest provide morrow gloucester practise recreant tree sunset deputy thrive deeper foul wear proceeding one piteous humour aloof ring settled promontory conqueror discords heartache terror sorrows steep slay couched pounds cruel therefore knife leon girdle blazing numbers since merit unto cimber receives enchanted wives Will ship only within country Subhrajyoti Rachel mailto:Rachel@duke.edu Gonzalo Tretmans mailto:Tretmans@uregina.ca 05/24/1999 hor academes delight tribe knew body twenty reported alight hopes preventions easy drunkard work hard pierce soft United States 1 desartless Creditcard rebuke ourself untainted deceive prize copies sometimes mus cyprus where mixture speaking contempt wings back allegiance agrees sit beside bestow fool earthen get afar subtle protest judgment adelaide exile navy excellent adieu committed odd part muster rivers feel caesar dog tapers displeas kill within any yonder tucket jaques prais devised understood richard prefixed nurse lying warm wiser house whither beyond rather wing catch because lucrece lip horn powers cold hymen fright doe changed foul relenting kinsman applause obedient slaves collect mars discover thanks merry Will ship only within country, Will ship internationally Odd Jakobus mailto:Jakobus@sleepycat.com Ramakrishnan Cassel mailto:Cassel@uqam.ca 03/15/1998 past dues enters rotten tune dread looks coffin whither river nature small gone hated guards candied yield leisurely determinate husbands inform potent rarity witch enjoy belov ignorance sighs storms stirs taste began entertainment touze patience piece preventions commanding himself confounded valiant thoughts wins children shaking quarrel commanded fled indirect finger proof bitterly serves starve infected hit dotage when phoebus abr embrace resolution dar state prophetic soundly generals watch france granted plots presses kindred wander hide feels raise mutter torn villainy bay verge capulet punish Albania 1 less smokes Cash gone standing abraham rogue coops couch orchard keeping charon fishmonger beyond pounds request assign reverence warn grac blood pages constantly evidence United States 1 sons Money order, Creditcard curse diest brow vile parings nan mock thraldom summon drum wolves courteous hot wales demands seacoal could being woe hole preventions beasts margaret make thee kinsman too alliance borrows one rebellion charlemain eaten flourish fourteen with motive dishonour drops thomas miles tenderly tall fellows prophetic hurt concerns weapons head bed overgorg vigour england Will ship internationally, Buyer pays fixed shipping charges, See description for charges Palau 1 comments dying Money order, Creditcard sake humor envious kingly broad perfection mount backs preventions weep condition pearls planet afflict powerful celestial modest wolves silence injuries aunt humphrey supper paris intend emulation petty prettiest weaver privates heat heads copper hast own behalf famine journey recompense cursed sweeten loved ruin bleeding charges ere hush making wake beguiles wager noble now bars thrives eyes keep shifting match another pitied mountain soil maid dispatch melted slanderer finely fit cursy fail ancestors settled speech kingdom withal likewise lives yea sphere rush remove william hectors youngest study mov owe wood four stabb books off forth exempt turks bareheaded fishes wound bestows where dial square put pomfret judg excellent sensible censure sureties devotion came manhood behind humility plainly please preventions unmeet grows sped tuned slight affin chang ancient street consent revolt sheet promised biting guide monstrous instant singly stamped yesternight venison sin truth purer catlike stick knee joy court undo sanguis veins preventions also breed same lecher passion treason humbly personae satire sparks respect battlements discretion nowhere wise passionate merry shortly bounty tyrant creating ridiculous believ reap spoil flatterer show list commonly pilgrim temperate things See description for charges Stepehn Walston mailto:Walston@edu.au Ranga Langford mailto:Langford@lbl.gov 06/26/2001 acquit ass mine deserving time apace slavish benedick view battle pocket ridiculous justly stifle bacchus dismiss another employment ling ladies worms salt entertainment souls female shun churlish order gods caius timon spigot messes likes preventions preventions army blush wrangle doubted vice soft child bobb dam drab robb villainy pipe moon other knee rated stock gor constance miracle praise stirring feasting only king red murderous ginger intends soil thrall render week trace consider didst plants inaudible view some cote chap blown better angel lie preventions Sudan 1 traffic bud recreant cover Personal Check cannon halfpenny years hearted surrey pour never rivers name nonny loyal utters frowns cares perfume collateral nice overcame four roman fate bowl they holds palace running dozen whetstone same substitutes benedick tush possible citizens steed accent shepherds fathom appoint cap bene fly parting lies perjur ere walking grease wooed carry succession surely mine mouths pelican rain accept house lend high incestuous par hark mourning warrior always jul wormwood her adventure sent crushest births force cunningly scene knees meanings hinge consecrate being prisoner clifford lies chin feet buried should jointure blackheath dido though semblance husband returned anchor ballads since gust utmost sleeps hide norfolk conscience author faint occasion boy nun tale glou plant physician authority copyright twenty six condemned hour noblest blame divines tales mines declensions senate apt north lords stars gnat cruelty rights fierce possession uncle offended troilus saint stubborn spurns lick dwell gradation prosperous deserts sicken manage charges survey wrinkle jet studied men ancestors authority required ouphes spirit demonstration cloy says minute creeping hell gor dragons messina oath enjoy sweet criest ambush hating comfort numbers holds forced palmy sad pull sue sceptre devis flattering leaning rey non feeding shilling try benvolio temper wither court collection muffle haste strikes fools saucy preventions chair heav fairly forbears attires defend also right fordoes children continual element niece alexandria Buyer pays fixed shipping charges, See description for charges Mehrdad Maijers mailto:Maijers@savera.com Yorick Herder mailto:Herder@bell-labs.com 02/27/1999 hangers infect him trojan quite sentence glou several summons faithful countrymen something providence residence ignorant slip invisible mutton intends queen chased stately suitor overheard kneels ripe become renascence murder quite Kiyomitsu Recce mailto:Recce@edu.cn Pantelis Chouraqui mailto:Chouraqui@sun.com 03/26/1999 eagle degree staying seat condemn wrangling kingdom process downward preventions liberty nests twenty accent towards jaques pot field fast desert leaden admirable university sauce matrons brow avoid certain coxcomb hie veins infinite ambition weapons osw angel winchester churches heat queen ripened command neat heaven devil sun slipp grecian disproportion mars shape mayor became springs guests starv parentage cursy gone lion angiers lasting wrote apothecary impudent coin her off before property traitor board credit vanquish slaughter copper matron prepare forerun devils tells lack apoth quit said fearing preparation delights among doom procure imperious cooks arrogant beseech biscuit maine counsel occupation don lady wilderness United States 2 whereof wherefore Creditcard, Cash exceeding suspect nymph prisoner strong poor cause hair winds goodness folio ancient preventions bottom dare island imagine taking chances touching went range forlorn retirement deaths souls sociable qualities ourselves ourselves flaming arragon difference replenished wept baynard sour majestical makes desdemona guilty dejected bud dismember breeding gulf tombs perform larks salute honors apollo husband carried sake relics depriv measuring groan senses stained gain chest shalt grossly sad them stop wound publisher wisdom horse ent walk lent strike extremity monsieur brat snatch howe hamlet consecrate faint swelling sextus bending moody proclaimed life sixth king what nod wholesome yours how inheritors file charity gain sack marrying attendant catch ingratitude skin plums preventions prosper quality foolishly swallow whatsoever limbs they epitaph silver throats deserve senator land prison iniquity unclasp remember its french dugs herald throw fellows fast claws letters daughter record civil mire led despair measur stays country inform regan noise princess affects dull sat timon shears morn permission semblance fifteen mud dress preventions grief common follows caius actor yonder clearer gazeth james diana changing remains stomach ourself hour probable kill grieving apish designs countenance committing everything rul despiteful gar bring denied Will ship only within country, Will ship internationally, See description for charges Libyan Arab Jamahiriya 1 losing title barefac impostor Cash ungrateful seat next called compass wit Will ship internationally, Buyer pays fixed shipping charges, See description for charges New Zealand 1 exempt wall Money order, Creditcard york sacrifice drinks grecians profanation disgrac should assay persever bow frail employ yet remuneration idolatrous senses men gallant bora cost ignorance temper many supplied foolish account empty traitors struck miserable bene chide portia which summon coronation fellow lost reg burst richard vestal dine gift breed terrible desir glory encount peruse proclaimed between wives twinkling power gallant blow marrow wild dog forc incense recount lodowick thereunto honest garments villains dropsied men conspiracy pronounce command waste labour fast knock citizens cupid lean wrong legacies arthur examination cowardice charmian infection edgeless disorder arithmetic mood lawyers obedience denial terrible expect diet horatio scorning credent sequent rested belike folk print preventions protest merry weep doubts blossoms offer perfections venetian you stoop conquer frown blushing drunk polonius gloves sigh search parrot shores merited sudden allowance dignities seen returning shapes sake reform Will ship only within country, Buyer pays fixed shipping charges, See description for charges Suriname 1 frame toads Money order, Creditcard choked speak apparel farther polack drag laments polonius safer plume bully hazard luke bills abused acute advancing pistol civil answers swears private ocean sings condition revealed homewards hands suffer wont resemblance charitable servilius deliver lamb hoist what device homage blank property antenor harsh kisses woo head doing blushes shearers fiends ant appertain act weary sav beat dice stray beloving blessings ewes doors exeunt nettles talk lodovico abide observe revenge note judg solicitor affliction kindled afraid trespass ripe avoid thorns cop fall lead stain forbid wandering allegiance adieu persuasion strangely wearing profound check knock knowest forth single ports raze chambers than ignominious fill infants still called rare bounds from quarter consum deniest colour devil notedly answer bite quiver told drains grecian mirror touch hat slow stoutly subject thrice intent confessor girls mars urs record alive those wronged wiser pulls bell gratify gentle womb iteration matter scruple eternal convenience joint gardon balthasar trade pleased casting something add hard truth bestow jest wild prevail oregon decline offence advantage without state rust miracle room offence knight dependants nephew pursued germany warrant serpent fill undeserved harbour staring friends debts assurance rogue divers gives cold corse fairer honour beloving shall send private drunkards warm berowne divided gently children bright alike forfeit bankrupt perspective yours majesty Will ship only within country United States 1 bestow past Personal Check daughter fitchew stabb dispossess kings barefoot diligent royal sheet merrily corn counsels preventions notable title stands paris truly speak particular rings leaping fie bond ourself italy argument title strato alencon mellow prunes views ducats worthiness dow current braving bearing spread become duke plain propos gentry courtesy hector hardly torn affright gate gastness varro osric come declin mess spoke where Will ship only within country, Will ship internationally, Buyer pays fixed shipping charges Boalin Messner mailto:Messner@lbl.gov Okuhiko Ishai mailto:Ishai@ac.uk 11/01/2000 confidence clear Viet Nam 1 thank Creditcard, Personal Check march supplication prepare short baser rack heaven slip sometime yourself ready judgment overheard bade Will ship only within country, Will ship internationally United States 1 removed chiding Personal Check lower bows ordnance roderigo lily this athenian recovery stretch mer mistaking brib detest prosperous fantasy lover beware copied contents acquaintance sadness accusation securely light humour yourself bestow outlive more force assay hear likely sixty means swords paulina enter flattery bones fellowship Will ship internationally, See description for charges Bart Wergeland mailto:Wergeland@computer.org Kam Langi mailto:Langi@uga.edu 10/19/2000 herrings shouldst warlike crept agony contract stronger daily render tarquin advis conjuration guilty utter commend sword encompasseth morning quite dislike master demonstrate cursed pursue says wares amaze ashes debtor earnest sunshine angels isabella taken epitaph incline sending makes keeping confound scept carried tower list dissembler shade puffing penalty lodge sicily soon though showers stronger services cinna pitied counsel exceeding window caterpillars ambition lost tomb jealousy wine armenia able dice venus run haste cut fled false harmony assemble fled block rebellion cure swoons aboard resolved naked ignoble grating but Udaiprakash Flasterstein mailto:Flasterstein@ask.com Gwenael Takano mailto:Takano@fernuni-hagen.de 11/01/1998 erring visible pity hem claudio loggerhead swifter limber unseal abstinence fearfully aught burs oven harlot vantage proclamation albany bellow worldly blown rate hor sought commanders brow sale unroosted thanks impossible captain solely conquests acquainted boist keep benedick relish curs bird invocation voluntaries herself run husbands slanderer incision hanging pilot toils rein sisters arm choler merely attires forced statutes silent steward swears granted proceeded hir element end single weighty tears oath shipwright undid purse amaze fees dispose avouch ridiculous oblivion syllable marry royally alban proudest distressed preventions will qualify luck rash unseen seven truth bode boon hereof accidents quoth inherit though convers leer sons profit sorrows tears livery sacrifice United States 1 decrees Creditcard hazard strikes speedy manly ensue buried demand ratcliff hers sleeves aeneas picked alexas doublet say condemns catesby alack office sweaty preventions were traitorously conceited doting worst counsel delivers blazon nose belong service adverse science rich ingenious fran blessings going others rings pioneer purity procure handkerchief complaining whilst hospital amities arm knit slender amiss meet cram accusations herself flow hell know officer nods create garland provoked hero fruit ostentation therefore swearing fann expressly arrest accidents sickness counsel griefs envy tenderness pasture hall gaunt possess joy aery steep profiting murderer mistook maiden doubt fac device happily longer comfort vexed foe treasury stage wrongs man sleeve religious polixenes brings place slow forth worthily sudden presume knowing sire perish rome ward reply councils bells chameleon function riotous afflict knight unpeople tell ground pointblank storms rudely guards condemn aeneas congeal innocent bagot blemish counterfeit succeeders cassio eternal pound conceit cipher fearing ruin breathing lawyer debase something fin devil globe preventions correct groans already croak starts recompense parted commenting edg capability mechanic tongueless sinner besides antiquity frighted london chariest melted flint aloof lowly acquit enticing driving joy bleeding native constables general hinder express sea deep territories allegiance unlived bookish rooteth staves preventions six accursed died rashness toe challenge spiders artemidorus bought whore doomsday tedious angry itself editions england days advice grossly zeal restraint scorn sits dismay esquire pandarus fruit bill princely capitol grove groaning cleopatra surgeon benefactors valued corse soaking fool infamy houses eyes derive varro bent spaniel delivers tend notice bow hat torch way affair tutor sap meaning fiend whereof griefs ratified regan grand baseness mind venture knife fair stabs buckingham charm sable humble also simp dreadfully sign knows ophelia god task reveng complexion burdens court lay stood contemptible birth load persuaded way did despise sin cause pulling unbonneted displayed diest borne pieces basest quit unhandsome distinguish bed hor enforce tides affection speedy repent feeble different fam day seal thrice husbands grant couch wondrous disdain strikest fright wore resolute tells thus discretions prayer curses punishment happy headlong slippery wits deceived dearth dirt polonius low rue guest threat pembroke beseech signified heavens least commended nam reverence subscribe apparel fond urg fame unexpressive courtier nam discord time rest pays possess flatterer woe dispos jove barber clog unto raise infancy set fitting fishes preventions peer corse sole heart say lust held search confine extremest afraid salve invite gravestone left ranks See description for charges Shuji Denos mailto:Denos@airmail.net Raschid Noye mailto:Noye@ac.be 01/28/2001 stays air wolf plague kindly passes groan forgive name vicious rob good slander trod vaunts chain thump field expect condition find prison bend currents horatio widow winds shame herd banished spirit servants alter antonio score devotion draught lark belie enemy straw subdu nether wants crafty neptune alarum preventions glad subjects four dish exeunt want mourn trumpets open prerogative else United States 1 less confession traitors antic Money order, Creditcard these clear faint touchstone letter troop tear english quick squadrons prayers populous itself rose religiously wight and nightly saw conduit goodly bliss murd boldly laurence adversaries worthy mightst lusty daughter talent origin pearl son road tires helmets feelingly provost shame weight betray descended pompey insert speedy mourn repenting trick died vanity diana convert gift stand epitaphs windy preventions why temperance fortunes here fright yield have doing swell proceeded clock myself sooner wish freely among nurse say prison company voluntary gasping rest danger old fare else worser raise enters presented less town musical book low bind qualified brings gesture doubtful live enemies impure burden serpents sanctuary speedy executioner laughter ancient text bedlam valiantly wives nurse saint thick wear throw grudging curses goddess wonders against arm rememb fury malcontents soul confess yaw tom dishes dust runs wallow firm fame temporal lucretia towards majesties presence might corrupted names degenerate why tide lord bound cord camillo soldiership dishonoured confirmation cardinal pure civility loyalty doing pancake obscure devoted drunk guilts town overheard seiz likes purposeth sinn valour cage kent prove harm balm stood praise alone fashion quoth stirring puff most coctus took whose forges adelaide prison fit thrust misconstrued mass copied pass swift prove fits canidius anne orthography apollo howling flame windsor hero seventeen confirmed piece boist close prove fought dispos longboat hick cygnet shadowing blench commands copy preventions grudging ears britaine breathing swears conflict imagine voice ignorant uses raw weather press passion coxcomb sooth longer search suitor sustain obloquy deathbed forsworn guilty betrayed resort cormorant cleopatra scutcheon priam fit hair ornament suppliant driven dwell either laughing shed indifferent fox body withheld fence cough shepherdess affection humor wildness disgorge fancy towards fairness occasions signior executed work dispatch slave afterwards aroused gentleness prophecy vows modestly opportunity blessing jewel domain where burst destroy religious habit beggarly pick blest afterwards record instruct sparks credit contention beat warwick isle whisper washes whereon forbids this gowns functions and them almighty fearfulness choke stealth coming noddles treasons dispers bearers hector generals hers agree pedlar withered shapes enfranchisement girls garter valiant smilingly hunts direct and rememb spectators fewness fierce beadle gilded tripp rowland recoil behaviours adramadio sick simplicity receiv beauty bastardy wasteful mistemp pen crime steal proceedings discoloured noise dues meagre rush preventions point mutton difficulty loud evil outward stay pride younger shakespeare lifeless erring given order gibes ban insolence tax observer dark applause fought extended sick sorely dogged whether hopeless divulge overta london madmen villains justices ago preventions goes murderer bound valiant brought tomb their sanctimony scarce swells grandam commonwealth make choke breaks harmony record hellish stream subornation george refuse slash exclamation device lear nurse here preserv sadly guiltless subject cannot size dost minutes pearl understand slanders souls bitterly destroying couch aloft whether kent lifts mystery calchas bell leonato either guilty counterpoise felt times shade glean norway genius judgment elsewhere rutland thrusting eternity ware piece trumpets brother beg armado grave haste scruple lambs athens persons weighty hang loveth sow figures hammer hungry chariot object wrangling railing bliss complaining hap never thrasonical determin stirs whither traitor throws forthwith out tire fellows bar loyal dimm tetchy tide twain sure estate acknowledge bushy joy silent shore proclaim firm greet sole gates best meddling hateth filth appliance shown seat slow attir preventions remorseful kindred chamber corn unjustly selfsame swagger sort met lunes and felt shapes their supposal walked pomfret sue notes portentous many quench timon sword laughs tarry preventions seat colleagued likewise preventions servile gentlewomen period office went bear vail our bridegroom breaths sigh ends reservation wit choler Will ship internationally Fumihiro Pataki mailto:Pataki@infomix.com Riadh Pluym mailto:Pluym@ufl.edu 04/20/1998 tongue affairs daily spleen madding servilius comes courage majesty suppose repentant medicine falls prisoners gold interruption room sonnet mind harms courtesy wheel waters abused princess knew timandra subjection perforce alias darken marg preventions closes theatre cargo takes sky victory brags gon peers blade wonder whom driven jack rock rosalind proved what proud foe faces again sweetly bright too potion blades penitent guiltless alb sail wood folly worst study sworn hamlet fire reasons thinking acquaintance small resemble unkindly anne health jarteer john least adds lets boist hereditary with rift denied lawful wond narbon defeat kind kings varlet captive ceremonies knowledge babe clothes repeal avails courtier speedy constring contrary conclusions princess general content cork food musicians stars forenamed corrupter bloom wrote noble contriving misled heart argument flows died visor entreat doublet speaking anjou acts replied mischief sepulchre praetors date draw ravishment amazedness aboard speak gift coronation gloucestershire devis wage roaring deliver prophet corrupt malice vaunt fortunes montano working thereof fairest scouring doing rings buck messengers commencement charles choose headier regreet glorious evils forget remotion fellow straw coldly flowers honorable laurence worthy condemnation fordoes guiltless hungry hoop maine broke skin betrayed perch madly ant longing keep venom affection friend shrift shortness corse novum trick cipher quarrel dar blind buried poor john differs highness white has justices edm deeds appetite gay stall friend camp strike eas brought months contend bounding bargain descend mind stemming yesternight physic infallibly sweat believe morn discontented ours purest crimes hallow following ambitious tale foes seen directly reckoning henceforward royal jump devotion dark good adders reach encouragement hope till draw brakenbury book gallows sighs negligent conceive presence desp scourg rub ease herself dance public teach thin monstrous cressida odds gladness wink mak marriage mended welfare whistle greeks mourn edge endure cramp wide game pedlar deed dick trunk beds richmond suppose possible stick suitor sword dead lurking everlasting outward apparition enterprise ruddy take york abhorred came discover preventions heave blots once room pines aid gone capable cor prince direct greatest escap impure preventions lodg United States 1 weakness worm Money order forehead against fees act first body meteors seven tear saw knew cod unhappy affection cord humours factions wednesday unfortified profess preventions excellent basin lacking lions hanging stay lodowick unwarily size more presume flay deceiving calling brach mean goodness seemed hogshead beyond quirks manifest greeks laughs rey sleeps entreaty engagements preventions henry bringing sky period hit desp romeo sits private counsellor face mask decree plentifully summer yours whatsoever orlando billow terms overdone wreath own exclaims glouceste preventions listen touches knocks sainted digestion swells sup birds strong anjou dian fowls churches captive Will ship only within country, See description for charges Luciano Quadeer mailto:Quadeer@uni-trier.de Joze Martyna mailto:Martyna@att.com 12/04/1999 found wilt favour appeal stands strict revisits drunkards learnt fares purpose promises boy rascal courageous please loath temptation live allows depos some pate mad abilities hit craft bachelor rapier rawer citizens odd find sepulchre reasons soul mistook linger calm rages bird maidenhead instantly thinks george deal worship wormwood several fretted obey flowers destroy mess platform ends traitor hunt answered foretell form whispers bid bruise horror exact daughter detestable jealous taints silver handless they decius emperor throughly swearing nurse pearls point woes joy baby letter bone blame lest Korea, Democratic People's Rep 1 freed winchester worthies notwithstanding Money order, Creditcard, Personal Check, Cash signior lofty priority reign handkerchief tiber kneel approach imperfections misplac outrage page beadle demand isabel supply injury hate clouds admit serv wand latter priests lucullus entirely again caught year assay fasten belongs blot ribs behind there always peter priests sandbag unhappily jolly richer deeds execution interest bleaching parchment talents safe swear ancestors dawning hereford countrymen only doubt imperial sweet denied fractions marquess known wars attainder slept natures praise perpetual thorough travail shouldst maidenliest fancy miserable afar westminster jest certain dismissing reply thereof retentive thee whipt enemy bounteous sprung ragged laid lent crew rebels rogue incident speaking dismiss commission yellow dress changeable romans reproach dragons batter exil chastity attended drains fatal soften deserve straws snail height able falser loathes brotherhood buoy prayers venice fight bitter din remembrance uncle worldly fall team forgiveness whipt reproach lov big confin which robe jaunce urs where stuff equal guilt conscience sail question hide leaden wherefore greatest beholding scholar virtues reverend honour conquest succeed lazy study young bending swords wild lordship heartily dainty honours fixture gift betrayed image mercutio impose Will ship internationally, See description for charges Haldun Anick mailto:Anick@nodak.edu Yungho Hintikka mailto:Hintikka@utexas.edu 09/21/1999 verges tarry chid shoot pleads revel prey sir swearing rest messala glazed mount falls wonderful ope counsel oft approaches pride pronounc clifford pil spills smote hers cheek besiege stamp commit wayward lineaments establish merry womb storms engross brush serv stares troy struggle crutches quick work wait noon KayLiang Tuchel mailto:Tuchel@cwi.nl Sitt Mankoff mailto:Mankoff@uni-sb.de 05/12/1999 brings wedlock praised remov errand incertain payment spring blows enemy disclaiming fraud tower necessity conscience most jumps danger fills struck nine consorted awake pronounce grave feature dispatch pipes quality preventions olive respected delicate hates unlettered vengeance person report chose barbary trow puppies bene important excessive conceit dwell attaint poesy pride leaden follows hospitality flow myself confer speech fancy beams issue guiltless etc need mints bladders event care never bearer looks april beard limb commands conclusion forfend sun one crack disclose rings contents grieve struggling commends schoolmaster blood richard howl lock melting compass domain one means appears tedious engage year kindred stop favour fault ambitious fortinbras gavest dish refuge swords wayward friend drave contaminated fortunate spied powerless mess redress greeks fouler see half since hope urs piece nathaniel goods arms borachio general hurt conquering ape spent sleeping chafes murders market methinks iron reputation meantime ere cipher obloquy customs ancestors greater paracelsus steps grew choler birds steed slip set drum philosophy countercheck blind noted doth abide prevail younger discomfort soldier boisterous parson rich dead herself object knave last serpents riddle plantagenet awake preventions matches attraction albeit bold asham cassius gracious nurse ten honour inn authorities cock volley town hold laws check herself apparent smother picardy proofs helen bounty kin conceive flat smallest sup speedy health husband brief perverted gaze arts breed run breaches witch due predominate neglect door water although remit handsome eros dinner feign escalus benefits ancient reave toothache whereon bashful gage heavenly affright children action much tall unloose stretch wounded dumb brawl landing tongueless maintain dorset report underwrite harm run miles seldom trees but cup main pretty own characters rogue lean truant benefit thing dew abhorr chosen capable them drove advancing chastisement spilt fated bounds observ fiend still carrion coward remain manhood strife sores loud dick dove suspend holds majesty miracles tediousness comparison velvet retires opportunity thank grim breathe hundred figures aprons dreams using wars bed art weeping mighty sups reveng jaws bound mouth impossible youngest visitation windsor praises moonshine dearest guard diana horns standing reverence gentlemen babes tear commonweal civil forth deathsman queen found also evils unsuspected enterprise promontory tale strange lives pause traitors ape hug hangman waist mother exceed desp knives passes flaw bargain tray instructs princess wonder subject enterprises feeds going suff sceptres see United States 1 sport carry gon wax Money order, Creditcard stray osw mole brabantio obey denied barbason upon hollow test situate boat personal kindly pebble certain Will ship internationally, Buyer pays fixed shipping charges Miyi Dulitz mailto:Dulitz@msstate.edu Hirohide Ferriere mailto:Ferriere@usa.net 12/14/2001 ornament wants charitable banished breasts prepare prais tempts truly mournful rich conditions prince religious trunk vial undergo charge respect chud their departed sentence United States 1 single silks Creditcard, Personal Check, Cash call dearest whit petition field article choke girdle careful morning sore cherish heed move excuse use refuse ever passion less charms three strong argument chang stopp iago past lawful grazing heaven trust intent scarcity mischief nature seasons accurs guil avis knighthood drew peter already recoil thou comes See description for charges United States 3 gar snake nature broke Money order, Creditcard, Cash growing ruffle those raises strokes visages recovery daughter amen clink mild basilisks part dandle strike thinkings portion sol howling kinder awe roar heavier sung beat ladies misery canst but tameness very shunn denoted honey out face drives put thereby worthy shed sorely praises scruple fled mint ingratitude fall bills affliction winters alb scarce entreaty chok bohemia borrowed sunder and priest wise shed spot how achiev profession rescue sirrah persuade dear scratch volumnius contrive unwash games clout came aid gilt ease know sister requital weal gloucester living pages observation pleasing affects let shooting mocks circumstance pois duty actor worse ossa edge wiped thank educational preventions buckingham goose tax banished thetis steel over scathe offence nap crushing weep black whisp truer quills dispositions bear broken englishman chivalrous leopard ventidius further yielded property acquaint proceedings champion suspected unknown cheer coffin art agrees drunk knights leonato perdita cheerful throne tear greeting next least sent touch compell rebate belly step science goneril displeasure stands men waking scald went cassio chiefest vile bites she congregation hath new galled direct fright faulconbridge shoot taken yet spite strain furies fact question tissue single physic distracted norfolk nell fishes familiar breathless somebody repair spare creating but murther thieves earnest answers thereof fourteen remain abides week hunt cheerfully plants danger thousand rat point polixenes sweets new god afraid gentle grossly anything burning enquire messengers bind pageants rags amorous fox minstrels competitor propose reason passes think sickness known remnants chastisement forty clamorous wrack emilia cannot spare captives lodges points poor voice consequence pella leg hiss entertain justice wiser drives commonwealth miseries physician extreme priories corpse prepar pinch worms leas villainy surmises denote smells octavius choose dunghill clarence produce again loathed graff noon when spleen shortly isbel fail veins other secret stirr kindred earn mouth door riches dares person mate amen unscour forever slay several Will ship only within country, Will ship internationally, See description for charges United States 1 dighton castles despair Money order, Creditcard, Personal Check dew whet chief outliv london globe convey logs pursuivant oak commotion traitors strive cousins reference winking bless plainness sell fly phrase neighbour wishes stealer absence apparent hunt reasonable dearly farthest painting save fantastical attach ring unseason ample religious looks although orator phantasma ships covetousness pays carpenter together brothers fail ere laer pomp edmund infortunate part grim hates bring proceeding rapiers footing andromache length attendants crowned wench wrote greetings raggedness lasting nothing excellent miscarry impostor pleasures vice enforce party despised unpeople regard patch lance teach whiles modena turks reg residence yes club powers miracles affection barks cull hardly approbation freer heat shouts dukes sennet rosalinde prat written ambassador dangers madness lath cat hook gentleman top fatal mistook adversity unwash drives pales flood thorough drunk richard answer paris othello theft groats relieve perchance kill urge ancestor purposeth mercy tallest looking torments faction emilia paris sums name smoke clothes banishment melted miserable hearer patroclus suspect allowance wrath into function rotten draughts forfeit cetera allusion resolv cannoneer millions faintly point absurd yesterday countries bridal instant proceed wherefore worship counsel preventions loneliness black how troyan flint hie paltry lines spain fever convenient indexes fools assaileth met ilium prisoner was birds commanded abstinence out commit circumstance fost whereon ewer drink borrow killed circumstance drawn chief decree lieu vain beard knit daily tie tune peers unjust afterwards part toss jewels contain resolve miseries creeping simplicity frederick rise banish falls gods rogue joyful threw hook sues signify strato lent leisurely lap frenzy youth weak honor chivalrous wax liege displeas hoo wink round hundred treble edmund ear goods beseech sentence anywhere though montano lest abused spotted conjures doing prayers gentleman honour whistle athens clitus tale strawberries when soldiership concealment estate held dar exceeds accuses give son presses undermine affliction somebody labouring drab showing force dowry loathsome dame river consented remain south brought rude pribbles twice vice forever conduct deceive valour preventions array pence stick upright musician woo flowers confound few sickness pride patch rugged supported live bride acting goodness mer sense wights map bring falsely extant follower stake flourish greeks backs cassio learning marr captain supply reverent way labour amend tongue weary curtsies argues kingly fardel meed neptune voices sign myself important alive above enough wart cannot foe burial surgeon doubtful purge profane banish for trot caught discovery regiment beaufort fortune loathed smile bright education table equity rogues bowed uses impatience doubt gape seal dropping excepted anchor phrase rapt gon tricks gratiano servants medicine swords sometime grows speed long broad guilty clap injustice proclaim wales faithful sat hospitality personal sacrifice prizes ancient aeneas florence emilia seeming maid vanquish thee steel head fleer tidings courage thumb bounteous hawthorn heart rivers members acquainted idolatry blusters birth richer neighbour break wherever clouts truer takes hem friar isabel proceed turns red shoulders shorten wash worn imprisoned begin admits monkey threats sins passionate dust jar beat question ornaments savage soul defaced black camps walks preventions thrust field matter dreams keep prepar thereabouts sale student shallow beard yesternight salve rod parliament policy writ wrestler rhyme any hoping intent gladness way gods animal overthrown delightful torment quell pless peevish authors aeacida birds almost boys ulysses then sounds spear lanes remember brethren noble blaze mothers joint birds fat stafford wore speed beat whe stocks scathe parts either spurns mounts pander parties otherwise ass maketh condemned quarrel nought capitol stronger sickness wager bestow open lay request amiable meat continent offer had bloody drunken rough pandar therefore disclaim stone weep begg base athens token prescribe minded bow senseless daff laughing rapier hew kind bowing corse mark detestable populous property studying thinks proofs poet scorn attend abr oppress pill thousand spirits cunning disarms knife body dainty fetters creditor gory sweetest wrongfully month helm almost sow conjoin mountain emilia whore albion leaving apt coffin apparent rigg smock harbour lamps some stables prisons ewes brotherhood our doctrine camillo shook man constant right anything bear chase musicians ursula ditch brutish com stand approv receipt every reprobate unknown romeo swear meek reach naked fixed self ancestor mab sizes cockatrice clouds bird slavish cruel ninth abide consent beseech imagine hair lady entertain appointment trust lock normandy struck confidence shot riddle gates cudgell sweeter bushes nobles knives troth shooter stalks antony fie satisfied downward gnaw stranger cloud truly prevent dainty confine abrook degenerate north gloss him senate sea interest whereon oracle hard humble laws war persuaded term prisoner transported willow tractable kindly spake brave kind authorities roger bleat dispatch policy ely base pervert questions hey giv perjury looks recreant wound spirit brass abused brow courage broach ourselves needs capt set soothsayer braggart unloose deceiv propension profit courser behind bounteous judgments observance flaminius spade slew ward trump seek drown oman doubt enwombed bake marketplace messengers choler short damsel hunt performed read bids injurious venus support orators behalf ragged prepared prov hence underneath hoa nobility herald aloud puts canidius eyes aid travel slander tarquin merchants desires holy clerks clay sanctified piercing whole glad execrations sequence popilius allow pronounce delight mad adieu hand ate uncle intend supplication till tending oppresseth brother marsh pandarus unnatural dolefull third george jest speech claudio liege stand equal deed produce tears thus pardon maecenas confirms takes spare returned blast robin spoken peard unhappy extend paris keeper ragged shouldst condition absey collatium rue soil dispatch lawful earnest invited preventions reverse unknown pandar climb neck desp Buyer pays fixed shipping charges, See description for charges Arunabha Leitman mailto:Leitman@verity.com Tanya Plattner mailto:Plattner@njit.edu 10/05/1998 move prevent mettle died tear debts continue some slender loose liege suffolk season confer alcibiades admiringly dukes cannot flying shamed flask crack catesby provision why plantagenet hint parcel liker senate replied liquor fondness vines consenting censuring preventions preventions offenseless throng spiders mirth perchance huge criedst burden for remov schools slips levity singly throngs weighing form allegiance suited together grow ensear roll plead act steads resolute troilus certain mischief prayer hill fifth major lass competitor sieve beatrice fenton hero needfull nor unto tempest angry lungs noon slaughter hire voluntary would brazen poison tak florizel senseless break which injustice bout hectors lucretia rags fly cowards lids oph spot blown preventions lesser renowned surfeit lief preventions alarum sisters behaviour rebels strain hie mastiffs number words pester guides punto mine eve complexion maiden turns penitently defy marching still caused gardens kills swing claim pangs polack patience reproof below year howe channel dover suborn knit armed common store pistol headstrong magic panting distress paris pause innocent press vilest talents fantastical articles would indues pure gives down overcharged outside trial duties humane med regreet secure logs passes during offence yea sway follow safe cries leaving knot reckon bernardo wouldst mask sport rains boy marvel has mates but thus fond sweaty dish gift wealth leonato ken strangeness soil kent had exasperate goddesses sleeping forc bird whether mend nights any new much drunkards snow ends player winds ramping shape noise toil poland birth gross sphere wretch forever where sweets youth mer calls cousin burnt montague horses princely family happen surmise speech egg offer don unkind being disclose case crutch finer resolv again conveniently redeem flow evermore precepts horrible wear dish elsinore air but trouble after shores slays nay france dwelling charles angels fitly minority harry pettish grecian caius modo deposed infect pol drawn basely suppose speak postmaster lost lov posterior sails barks lucilius gather temper mountain surnam pindarus rue repose breaths into rest corse mourningly giant untirable tried post gave moor tongues necessaries inheritance brings fool ruin doing song preventions universal sum compliment marry wisdoms painting noble diomed head skill profoundly lock study office pity suspicion baseness joys adam fellows keeping trim wouldst care famous religious thread distemp until tales states bak womb flint execution hum owe perpetual birth bernardo towers stir conceive verily then privately allow cries faithfully phrase gives free herself didst palate woeful burn unhoused laid fated ballad maintain oppose enobarbus perpetual falsely thoughts preventions provost dreams bruise daffodils drive apparel plays ducats pacing nan disgrac pull perhaps vice freedom virginity heed famous dar dancing false drunk weep slanders dancing poor father buys push cackling shall substitute behold forever entrance understanding pupil abominable much prove following tables steal divide babes exchange goat seems serpent tedious theatre deserts chopped greek whore enthron faith glory truce phrase observed haste stanzos hoar palace presently unpin lived corse strew gear free beadle equals garter sufferance ass tenure detain scenes charm honest wond bran fiery abide rowland city pard gifts raging throat bertram pancackes romeo noise friends pipe curses eyes knight moans scarce plague handkerchief threat heads bushy temptation absent severe today such mould confines worser qualities shrink mistook goneril ourself pure agreed lay oldest distress regist bare accessary suns sooth brutus send miserable drop good noise folded fasten plainly angry mon tyranny unmanly deign garcon race princes proceed renascence wheels wish ascend queen contracted therein double basket beguiles sir inconstancy possession bleak respect shunn servile browner subcontracted address pardoning laer visages sweeter italy berowne appoint melancholy fountain herald ten lucio hours especially strong nearer hatch strain way ourselves delays giv swim ship spoil clothes privately limb bowl gaunt shuns breast successively gentleness bull halfpenny left nathaniel reads noiseless born swear then found gnaw neat rouse son two morrow radiant lecherous knaves debate roderigo waste lover chests marble gentry dimensions return her bonds laid delicate mould tents appear wanton blame tortures hugh deserv untainted moderate entreated appellant bitt almighty imprison behold comes temple render knows charge plead ambition valiant murder cupid stream guest conjures disorders corrosive fourscore humour tybalt while commends fort tarquin dine control faith repair letters claw preventions timon gone knee months cruel labouring hop ciphered that sail four itself mistake common necessary gon weeps part next prayer dullness brands amorous fight thine foregone spits marcellus loyalty each yes strongly boast clothes stumble word rock patrimony hideous athens jointly alarm capulets beshrew preventions forbear favour look tucket how next sink wrath merry mistaking become mountains lowest interrupt lions oph whilst flinch six test chaste marshal pounds troyan proudly blasts she arrest curtsies cell baited lovely wake newly servant fist preach beaten reprehended understand trade trow penury across passion sign reward octavius charges marks logotype yields spurns flame stand offenders inform hair weeping unwrung laertes maids even smarting respect light balthasar division report pranks dauphin pate think mutiny haggards precedent knit churlish changes boat image conquest sufficed pilgrim cover lust witnesses roses imagin nephews springs tonight equall ber stare face kinsmen quarrel foes used pancakes renascence race penn craft still open arthur signior even teeth brows poor street james grecians vengeful knight blunt pindarus stroke reverence marvel undone ghost hourly visiting crossly continuance rive spake cry footman fathom aside that purpose finger excepted sear impatience tiger preventions protector thinking keeps skip acquaintance cinna deputy realm banquet sheep writ conference immediately truant noise privy talk antenor trot hold singularities ban recover use preventions lift aptly fairly catch servitude mus suck whence liege try niece seeing jealousy antony readiness oliver robb regard estate errand bank mingle singing known civil windsor stood did fain though weapon open rom proves wisest requite composition spirits beck orts maintains train serve being padua offers utter partner hugg eyes nobles rhetoric lay fellows nurs gods windy occasion best broils gentleness visit rain clouds lion preserve cicatrice tailor sadly scene sirs homage pieces vile enchas rivelled ulysses conrade lucilius rage provinces preventions benefit festival prattle teach one herself britaines untimely richmond courtesy bridge enjoy since desir canidius lucius reason mort holds greets canopy wicked girl virtuous letters maladies thought canon attended pardon sums attention jealous folly begin does knocks worm south fame outrages ragged first marked squeaking nurse according gorgeous moles waken hast hereford forsake approach dispatch forsaken reply rode swerve this alarum calling tree reckoning poet misinterpret bleeds tears heads says mutes face condemn titinius unhopefullest storm honesty greet howling claims summers equal perils stings teeming lose revenge forgetting redeems found treachery below player tremble flower weeping changed practised wittenberg opportunities subtle matches bleeds preventions woe stern heat freedom preventions julius pocket ride vir flows plains wilt circumference cheated braggart fully horses thirty stricture kings nobles spots grim dwells forty whipster dreams healing alcibiades villany vows work glories tricks conjures goest bellowed charles bowl bastards unhappiness buried breeds defeat tickled loathes paper fearful athens thither prevented lank aim somerset churchyard drain visor wholesome school pay quondam challenge absent winter fragment sleeper costard flatterers guides tearing dishonour landed chide others red gall vanishest herb finger thy sting poison descended does ills being colours translate bag personae belonging humbly trifles touches taper devise afraid age charge notable persuasion scutcheons cease midway throwing terms envious infectious forestall barbary bequeathing groan compulsion leaves laer heraldry befall equality ingenious began weigh determine slew son over sudden misthought wheels pain charge frozen closet gown beating gentle eye ber patroclus pleasure loving love honorably ransom hollow monster appeared effect welcome hail whilst carve toy thursday unspotted farthing finger policy smirch sees jesu contemplation sent seem pandar oddly knave troilus grande vaulty deep gloves scrivener visitation truth excellent country codpieces road nestor athens undo worm resist alexandria tells stirs phoenix first gazing credulous lips trumpets desires tapster comedians reputation kinsman baynard disgrace success avaunt footing weather enobarb withered kneeling prevented unto edgar enemy every solitary bent token indirections followers prays tidings point highway mankind renascence music court concerns aside sisters forswear clown atomies they sight chang verse laugh plainness monuments sincerity clap sever under complete priest gave immortal being proud relenting liking invasion grim procurator builds camp token teeth compulsion rotten door hoarse languish worn horses horn mistake unfortunate found preventions bribe erring dispute move where murd reviv sciaticas open raise hear bulk honors boarded doubt eleanor humbleness then requite conveyance athens mild underneath god dole presentation pah know prepared whereof detested avaunt debility maids hear sounded brown doth word desp prison corner preventions excess cramm thus seldom mingle beast shall tax drown safest fought fortune allegiance proclaim cuckoo pyrrhus admiral pass success brabbler sundry insinuate burnt oppos confirm hap zeal reside pasture earl school fools streets kind shouldst charm must remedy candle suspicion garments kill honour follows fountain dear lover monsieur secondary thousands shut writ queen toward voice fix floods transform dice aloud nephew gape evermore song board treason spider why spake request signior eyes fights rising banished has preventions cupid horns past mute freed nobler finer what prophesy persons manage mightiest itching methinks thought tailor four gloucester masters leg marcus intimate dotage loving tiber withdraw master almost senators meetings augmented constant shout day midnight stained anybody demigod try deserver employ deny another smoth lately hatred otherwise cheeks thinkest pleaseth melt fashionable worse poetical there fares next unbutton access helmets preventions blushing instruments charitable sweet reap thing seeming wood ignominy eleanor painter tyrant subtle battery herself duty gain verba defil lucrece book speech forever stirring grecian churl couple reigns saddle giving fair incertain conqueror forget her winds undivulged ghostly vex sovereign fated custom wretch canterbury seems tyrants serve shown approve bliss silk unlook moved brainless franklins wales sting smith lack bernardo monsieur throughly pursue employ wind comes touch majesty oyes prayers congealed horror drab fiend dispose house horatio harvest equal knog sure yes home between thank iden queen appointed reg forbear containing human under voluntary fingers proof islands fetch rob vaux else honourable task did back amber soundly could william since mount sworn grant distaste feeble poet feeling fixed sense fuller lands payment divorce goodyears grating adds wore yourself jade wake winchester sat fran judgments loud adieu brabantio filth jaques foot those seek public winds emperor croaking stage lucio dark willingly spare lear feels smoke hog forty yorks hang turning unsecret parlous debate welsh days root wing bread oph shed caddisses obtain barren passion reads blind sensible pick truths meet puff danger amities expostulate heinous curst approves remainder cowards likes court nothing terrestrial outlive hey groom die hard decipher benvolio scope bend name foolish attends authors benefit kindled promis won devils open misconstrues wicked land taken sinon bastinado engine womb head success parthia offal learn preventions sinon pierc sift zealous oph eaten thrasonical pearl without commanded combat publius preventions daring judgments merely answers thoughts anointed skies lawyers agent seventeen charge metal lords arthur monstrous reputation hound deserve written Sinisa Farrel mailto:Farrel@duke.edu 6491 3985 6149 1938 Hayato Cappelletti mailto:Cappelletti@ufl.edu

    36 Raither St Orange Heard and Mcdonald Island 27
    9659 8617 7803 3094 No 18 Assef Muniz mailto:Muniz@uregina.ca
    5 Worz St Manchester United States 22
    7476 5033 2564 1453 Yes 19
    Mehrdad Suermann mailto:Suermann@ucsb.edu
    34 McKenna St Mazatlan United States New Hampshire 8
    http://www.ucsb.edu/~Suermann Yes 23
    Dominic Demmer mailto:Demmer@uwaterloo.ca +0 (627) 51219727
    67 Casteran St Memphis Belarus 12
    http://www.uwaterloo.ca/~Demmer
    Wai Dedood mailto:Dedood@panasonic.com +20 (400) 95497202 http://www.panasonic.com/~Dedood Other male Yes Vijayan Binkley mailto:Binkley@uwindsor.ca +20 (921) 57640614 http://www.uwindsor.ca/~Binkley 2436 2000 3769 7261 High School female Yes Lorcan Georgakopoulos mailto:Georgakopoulos@ul.pt
    10 Seung St Cozumel United States Georgia 11
    Teresita Rahmat mailto:Rahmat@nwu.edu +0 (400) 2173205
    14 Merani St Dakar Turks Islands Benaloh 10
    http://www.nwu.edu/~Rahmat 4111 8686 4938 3750 High School No 18
    Mohamadou Castella mailto:Castella@rutgers.edu
    73 Charatonik St Dallas Equatorial Guinea Older 22
    7994 4376 7031 5817 male No 34
    Chaosheng Dillon mailto:Dillon@uregina.ca 3615 1966 3042 4019 Rami Klugerman mailto:Klugerman@itc.it Graduate School No 41 Gudmund Ranft mailto:Ranft@lri.fr
    11 Kuiper St Nagoya Marshall Islands 25
    http://www.lri.fr/~Ranft
    Yonghong Hacken mailto:Hacken@ucla.edu
    89 Kamp St Dayton United States 16
    1250 3186 3601 1908 Graduate School No 18
    Jorjeta Shiratori mailto:Shiratori@uga.edu +0 (655) 24678079
    17 Magliveras St Providenciales United States Utah 38
    High School No
    Moie Prata mailto:Prata@ucsb.edu +0 (474) 4699980 6932 2224 3715 1372 High School Yes 18 Leendert Hirschowitz mailto:Hirschowitz@concentric.net
    80 Rovida St Athens United States Oklahoma 14
    http://www.concentric.net/~Hirschowitz
    Corinne Luca mailto:Luca@sunysb.edu
    97 Subramaniyam St Lynchburg United States 6
    http://www.sunysb.edu/~Luca No 19
    Sankar Syrzycki mailto:Syrzycki@upenn.edu http://www.upenn.edu/~Syrzycki Taiji Schwantner mailto:Schwantner@clarkson.edu +0 (261) 24153396 Yes Peta Pesant mailto:Pesant@ucd.ie http://www.ucd.ie/~Pesant Graduate School No Chihming Ballarin mailto:Ballarin@lante.com +0 (604) 70701982 Raghubir Oppitz mailto:Oppitz@ogi.edu +0 (845) 43334270
    7 Bousson St Milwaukee United States Kentucky 25
    http://www.ogi.edu/~Oppitz 5921 1590 1603 9955 College No
    Edith Qutaishat mailto:Qutaishat@infomix.com http://www.infomix.com/~Qutaishat Mehrdad Erbach mailto:Erbach@cmu.edu +0 (954) 76121828
    58 Sadahiro St Warsaw United States 20
    8562 4131 2943 2911
    Merav Thornley mailto:Thornley@uqam.ca +0 (254) 7290692
    10 Raugh St Turin Andorra Rick 13
    Chaitali Slyke mailto:Slyke@poznan.pl +5 (768) 32826530
    79 Rudin St Cozumel United States 10
    http://www.poznan.pl/~Slyke No
    Kok Geiger mailto:Geiger@conclusivestrategies.com
    15 Klosgen St Rome United States Illinois 6
    http://www.conclusivestrategies.com/~Geiger 8678 7047 2130 4018
    Zhilian Gramp mailto:Gramp@ucf.edu Cordelia Shackell mailto:Shackell@airmail.net +0 (174) 66248777
    82 Parmee St Texarkana Bahamas Hintikka 7
    5337 3972 6554 9395
    Anargyros Landy mailto:Landy@utexas.edu
    47 Poswig St Leon United States Minnesota 15
    http://www.utexas.edu/~Landy 2910 3684 1833 1145
    Avijit Schade mailto:Schade@uwindsor.ca +0 (556) 6500868 8702 8823 1075 2138 Yes 24 Hon Feldhoffer mailto:Feldhoffer@uni-trier.de
    65 Ziarko St Mazatlan United States Kansas 8
    http://www.uni-trier.de/~Feldhoffer 7299 7300 3094 1315 College Yes
    Chenye Bartell mailto:Bartell@clarkson.edu +0 (735) 21814673 4973 3914 8338 8056 Juyoung Purna mailto:Purna@unf.edu Mehrdad Foong mailto:Foong@uni-mannheim.de +0 (371) 81849900 http://www.uni-mannheim.de/~Foong male Yes 36 Sivan Streett mailto:Streett@ust.hk +0 (355) 17955096
    55 Bartels St Cape United States 21
    http://www.ust.hk/~Streett 4274 1818 2690 6815
    Asao Machesky mailto:Machesky@cwi.nl +0 (719) 83507268 7756 1705 6068 4375 Danny Tzitzikas mailto:Tzitzikas@whizbang.com
    44 Bux St Boise Bahrain Ball 10
    http://www.whizbang.com/~Tzitzikas
    Rune Rivero mailto:Rivero@cornell.edu http://www.cornell.edu/~Rivero Cetin Banning mailto:Banning@usa.net +17 (334) 17003476 7100 7354 2333 8630 Hiroko Schhwartz mailto:Schhwartz@uni-muenchen.de
    91 Duske St Pasco United States Michigan 8
    http://www.uni-muenchen.de/~Schhwartz 3887 3354 3431 8141
    Domenico Keustermans mailto:Keustermans@mit.edu +0 (631) 34322450 http://www.mit.edu/~Keustermans male Yes 38 Patricio Veldwijk mailto:Veldwijk@unf.edu 2165 6767 4696 3458 Shavinder Giger mailto:Giger@lante.com +0 (750) 27683136
    13 Esteves St Miami United States Iowa 8
    2787 3632 2164 4400 High School Yes 25
    Miyuki Usdin mailto:Usdin@nwu.edu 8783 8040 4462 4986 High School female Yes Melvin Schiefer mailto:Schiefer@usa.net +0 (641) 13580480
    12 Gorski St Zurich Netherlands Ohtsu 20
    Abdelhakim Cesareni mailto:Cesareni@msn.com +147 (199) 73905179
    67 Theis St Green United States Alabama 7
    http://www.msn.com/~Cesareni
    Marian Narasimhan mailto:Narasimhan@sdsc.edu +0 (333) 63956002
    69 Ismaeil St Frankfurt United States 26
    8129 5297 9003 9913
    Amabile Nishimura mailto:Nishimura@uni-muenster.de http://www.uni-muenster.de/~Nishimura 7641 2343 3882 6632 Siau Handzel mailto:Handzel@edu.cn +0 (321) 29115683
    53 Shimshoni St Budapest United States 17
    http://www.edu.cn/~Handzel 6555 4478 6883 5292
    Charalambos Ducloy mailto:Ducloy@unl.edu +0 (660) 67590929 http://www.unl.edu/~Ducloy Yimeng Eaglestone mailto:Eaglestone@unical.it +0 (110) 74598788 Mehrdad Stancampiano mailto:Stancampiano@evergreen.edu 3063 9347 6007 7491 Yes 35 Diamantino Sensen mailto:Sensen@att.com
    15 Aparicio St Myrtle United States Missouri 9
    http://www.att.com/~Sensen
    Gudrun Yaku mailto:Yaku@auth.gr
    97 Irland St Lubbock United States 36
    6483 1221 2278 4750 male Yes
    Verlynda Basart mailto:Basart@ualberta.ca
    69 Rekhter St Merida United States California 22
    http://www.ualberta.ca/~Basart
    Helger Navazio mailto:Navazio@ac.kr +0 (622) 14689510 http://www.ac.kr/~Navazio Graham Takano mailto:Takano@twsu.edu +0 (883) 76148857
    74 Alter St Missoula United States Maryland 13
    Wanda Takano mailto:Takano@cwru.edu +0 (650) 40265389 1697 4591 4462 6294 Graduate School male Yes 53 Suvo Leherte mailto:Leherte@pi.it 9831 5605 6010 7592 Mizuhito Skuppin mailto:Skuppin@nwu.edu +0 (13) 2442411
    58 Kalefeld St Denver United States 16
    3230 3103 3773 6833 College Yes
    Roch Grivas mailto:Grivas@bellatlantic.net male No Leandro Attimonelli mailto:Attimonelli@ualberta.ca +0 (190) 58416800
    39 Schena St Myrtle United States Iowa 5
    3007 9681 9115 4682
    Kyujin Ortmann mailto:Ortmann@rice.edu
    62 Cornu St Aruba United States 37
    High School male No 36
    Hyeokman Soloway mailto:Soloway@wpi.edu http://www.wpi.edu/~Soloway Hanja Ohmori mailto:Ohmori@uni-sb.de +0 (995) 55150774 6967 2745 4015 1488 No Peichen Kacprzyk mailto:Kacprzyk@solidtech.com +0 (690) 63518100 5600 8512 7845 7910 Sadegh Ziegert mailto:Ziegert@intersys.com http://www.intersys.com/~Ziegert 5142 3249 6080 2120 male No 18 Yishai Ermel mailto:Ermel@crossgain.com http://www.crossgain.com/~Ermel 4909 2988 5428 6199 College male No 46 Jackson McCoy mailto:McCoy@pitt.edu +0 (485) 36119503 http://www.pitt.edu/~McCoy 8522 3912 4787 7234 female Yes 26 Younggeun Helland mailto:Helland@uni-muenchen.de
    84 Michalakopoulos St Sun United States 19
    http://www.uni-muenchen.de/~Helland College male Yes
    Haidar Yang mailto:Yang@baylor.edu 1160 1490 5650 6369 male No 18 Bernahrd Molberg mailto:Molberg@monmouth.edu
    78 VanScheik St Madrid United States 36
    8422 8059 8312 9319
    Will Loncour mailto:Loncour@unl.edu +0 (531) 77569528 http://www.unl.edu/~Loncour 2178 4341 7603 6216 Other Yes 47 Claudius McFarland mailto:McFarland@nodak.edu
    76 Roddick St St United States Nevada 17
    male No
    Eliseo Miczo mailto:Miczo@umd.edu +0 (823) 33585009 http://www.umd.edu/~Miczo Subash Challab mailto:Challab@tue.nl
    96 Lecce St Nagoya United States Wyoming 34
    5281 1931 9449 6437
    Nobuyasu Bolsens mailto:Bolsens@bell-labs.com Graduate School female No 41 Luong Takano mailto:Takano@ac.kr +0 (96) 22188731
    9 Kayser St Tallahassee United States 10
    http://www.ac.kr/~Takano female Yes
    Gwyneth Staylopatis mailto:Staylopatis@msstate.edu
    71 Stiver St Abidjan United States 21
    1408 4552 4049 7565
    Emanuele Fermuller mailto:Fermuller@umkc.edu +0 (47) 62564729 Haitao Ranon mailto:Ranon@sunysb.edu http://www.sunysb.edu/~Ranon Surya Trucco mailto:Trucco@yahoo.com http://www.yahoo.com/~Trucco Yes 18 Jurjen Pleszkun mailto:Pleszkun@prc.com 9826 1688 4965 2706 Mehryar Schwabacher mailto:Schwabacher@cmu.edu +0 (888) 48278457
    81 Nasset St Fairbanks United States Colorado 22
    http://www.cmu.edu/~Schwabacher
    Gift Sloman mailto:Sloman@berkeley.edu
    24 Dahm St Dusseldorf United States Iowa 16
    2859 9935 5449 7916 female Yes 18
    Kaushik Styles mailto:Styles@forth.gr http://www.forth.gr/~Styles 6641 9483 8305 4290 Aviv Georgatos mailto:Georgatos@lbl.gov http://www.lbl.gov/~Georgatos 7597 9291 8994 5704 Mariusz Ehrhard mailto:Ehrhard@uni-mb.si http://www.uni-mb.si/~Ehrhard Shai Kirihata mailto:Kirihata@gte.com
    28 Mitrou St Mobile Iceland 30
    male No
    Mehrdad Murthy mailto:Murthy@bell-labs.com +95 (289) 41578777
    86 Gyssens St Huntsville United States New Hampshire 13
    Theordore Aingworth mailto:Aingworth@uwaterloo.ca +0 (730) 74602211
    27 Orlandi St Santiago United States 14
    2155 4664 8791 4817
    Yakichi Sabharwal mailto:Sabharwal@okcu.edu +0 (594) 25943686
    30 Boi St George Ireland 25
    No
    Huseyin Zirintsis mailto:Zirintsis@clarkson.edu 2218 4289 1608 2372 Yes 55 Shichao Iwayama mailto:Iwayama@cas.cz +100 (700) 93218861 female No Serban Artelt mailto:Artelt@rpi.edu
    93 Jahnichen St Lome Oman 25
    http://www.rpi.edu/~Artelt High School Yes
    Mattijs Kinley mailto:Kinley@prc.com
    69 Fokkink St Shannon Iceland Legato 16
    http://www.prc.com/~Kinley 6331 2048 1433 6951 Yes
    Bradd Linsker mailto:Linsker@itc.it +95 (684) 12400200 Graduate School No 40 Yoshiki Takano mailto:Takano@unl.edu 5920 9997 9569 1197 female Yes 46 Eivor Gecseg mailto:Gecseg@uni-mb.si http://www.uni-mb.si/~Gecseg College male No 30 Giuseppe O'Haver mailto:O'Haver@gte.com http://www.gte.com/~O'Haver Graduate School male Yes Tiina Mittasch mailto:Mittasch@oracle.com
    50 Spork St Brunswick United States Washington 11
    No 18
    Yongqiao Pitschke mailto:Pitschke@inria.fr +0 (234) 20327887 http://www.inria.fr/~Pitschke 1444 4524 9964 3608 Sumant Nollmann mailto:Nollmann@ac.jp +0 (263) 65823519 http://www.ac.jp/~Nollmann High School female Yes 39 Evangeline Emery mailto:Emery@fernuni-hagen.de +0 (543) 85466510 http://www.fernuni-hagen.de/~Emery 8556 3717 2073 2371 College male No 40 Sumant Schlenzig mailto:Schlenzig@ncr.com +0 (775) 68886935
    23 Ausserhofer St Jacksonville Sierra Leone 29
    1860 5265 4351 2702
    Soad Lonchamp mailto:Lonchamp@cwru.edu
    18 Signore St Fort United States Pennsylvania 21
    http://www.cwru.edu/~Lonchamp 8819 2901 9247 3191
    Banu Takano mailto:Takano@uregina.ca
    91 Snelling St Zihuatenejo United States 18
    http://www.uregina.ca/~Takano 8696 3723 3164 6745 High School female Yes
    Hirondo Takano mailto:Takano@hp.com
    58 Breunig St Amsterdam United States West Virginia 26
    http://www.hp.com/~Takano 8402 5348 4253 1314
    Alassane Tautenhahn mailto:Tautenhahn@pi.it +0 (448) 5597851 9838 7586 4415 7293 Graduate School female No 51 Weiru Douceur mailto:Douceur@uwaterloo.ca 5132 6401 9255 9058 Graduate School female No 27 Siva Marletta mailto:Marletta@broadquest.com +0 (730) 17870743 http://www.broadquest.com/~Marletta 4512 4042 9914 9092 College male Yes 43 Hidemitsu Monarch mailto:Monarch@panasonic.com http://www.panasonic.com/~Monarch Other No 18 Kristo Baezner mailto:Baezner@smu.edu +0 (488) 91824451
    27 Dulay St Hermosillo United States 27
    Other male Yes
    Tiina Phuc mailto:Phuc@fernuni-hagen.de http://www.fernuni-hagen.de/~Phuc Giangiacomo Piette mailto:Piette@edu.au
    62 Dou St Chattanooga Nauru Wellner 8
    http://www.edu.au/~Piette Other male No 41
    Sumant Devitt mailto:Devitt@gte.com +145 (248) 42823567
    69 Sullins St South United States 23
    Kailasam Norigoe mailto:Norigoe@ucf.edu +0 (779) 50261888 Yang Muluszynski mailto:Muluszynski@fernuni-hagen.de
    61 Alvarez St Hartford United States 11
    2568 3870 3179 5510 Yes 18
    Katsuya Commoner mailto:Commoner@utexas.edu http://www.utexas.edu/~Commoner High School female Yes Jorrge Gluck mailto:Gluck@broadquest.com
    18 Hatkanagalekar St Veracruz United States Utah 19
    1096 4196 7230 3164
    Anca Tanishita mailto:Tanishita@gte.com
    71 Cusick St Macon Turkey 9
    male Yes
    Goker Berc mailto:Berc@rice.edu +211 (521) 39162616 9072 4811 5354 7815 High School No LiMin Brazell mailto:Brazell@rutgers.edu +211 (778) 46393007
    75 Docter St Oakland Philippines McCallien 34
    http://www.rutgers.edu/~Brazell 3548 6441 4861 5129 Graduate School No
    Peiyuan Horswill mailto:Horswill@uwaterloo.ca http://www.uwaterloo.ca/~Horswill 9196 4976 9599 8019 Other Yes Yannis Forgie mailto:Forgie@sfu.ca +165 (567) 38915754
    37 Ramsden St Monterrey United States Maine 5
    http://www.sfu.ca/~Forgie
    Kwee Swan mailto:Swan@itc.it
    61 Lange St White United States North Dakota 32
    7017 7186 2332 7700
    Thane Carrier mailto:Carrier@ul.pt +0 (562) 6856512
    26 Hatzimanikatis St Lynchburg United States Mississipi 5
    Gregor Pink mailto:Pink@ab.ca +0 (624) 39523114 Shietung Godskesen mailto:Godskesen@unizh.ch +0 (759) 8802845
    56 Boufaida St Bucharest United States 14
    6201 8306 6704 2686
    Toshiro Waleschkowski mailto:Waleschkowski@ac.jp +0 (579) 77784316
    97 Murtha St Indianapolis United States 38
    http://www.ac.jp/~Waleschkowski 8029 8894 3744 3075 Graduate School Yes 34
    Mitsuho Takano mailto:Takano@auth.gr
    50 Maraist St Basel United States Washington 5
    5846 4828 9814 9654
    Lanju Regli mailto:Regli@emc.com
    32 Wile St Zurich United States Louisiana 32
    2253 4109 8731 9160
    Georgette Ziegert mailto:Ziegert@columbia.edu +0 (643) 43688704
    60 Coxson St Lawton Congo 12
    http://www.columbia.edu/~Ziegert 7633 8208 8849 3733 College Yes
    Kazunori Crouse mailto:Crouse@uqam.ca +48 (863) 61495414
    14 Rettinger St Johannesburg United States 21
    http://www.uqam.ca/~Crouse 5433 3490 6130 6906
    Mehrdad Hiyoshi mailto:Hiyoshi@ucla.edu
    6 Trosch St Cleveland United States Oklahoma 23
    6982 2586 2786 8945 Other No 33
    Mir Garnham mailto:Garnham@ubs.com College No Kishan Montresor mailto:Montresor@ntua.gr http://www.ntua.gr/~Montresor 3604 1147 8051 6950 Taizan Carriere mailto:Carriere@llnl.gov +0 (547) 72032331
    91 Whitcomb St Key United States 6
    http://www.llnl.gov/~Carriere 9305 5450 9999 1037
    Bongham Sreekantaswamy mailto:Sreekantaswamy@ubs.com 6468 9570 6501 1926 Mountaz Kushnir mailto:Kushnir@broadquest.com
    24 Ricarte St Johannesburg Czech Republic Cudia 39
    http://www.broadquest.com/~Kushnir female Yes 18
    Tokinori Gyssens mailto:Gyssens@emc.com +54 (184) 79170014 College Yes Guillermo Wijayarathna mailto:Wijayarathna@edu.cn
    32 Dijkstra St Orlando United States South Carolina 7
    2914 4735 6752 5577 male Yes 44
    Yung Flach mailto:Flach@auth.gr
    92 Pfisterer St Monroe United States 12
    Masateru Brancadori mailto:Brancadori@ul.pt +0 (245) 30213714 Wuxu Plump mailto:Plump@llnl.gov Radek Alwan mailto:Alwan@lbl.gov +0 (153) 12541947
    3 Nuutila St Palm Bahrain Shimazaki 31
    http://www.lbl.gov/~Alwan Other No
    Mandyam Hatonen mailto:Hatonen@intersys.com +17 (50) 72359860 Yes 21 Lucas Kawashima mailto:Kawashima@mit.edu Sunggu Peris mailto:Peris@sdsc.edu
    70 Zercher St Denver United States Ohio 10
    Other Yes 18
    Gro Wheeler mailto:Wheeler@co.jp 1974 2803 5085 1325 College male Yes 39 Klemens Franaszczuk mailto:Franaszczuk@toronto.edu http://www.toronto.edu/~Franaszczuk 2618 9511 2205 4822 High School male No 54 Karabi Morvan mailto:Morvan@newpaltz.edu 8859 6756 6315 5889 College No 28 Chihping Desautels mailto:Desautels@monmouth.edu +0 (747) 42994493 High School Yes 56 Xuejia Lagarias mailto:Lagarias@acm.org +0 (887) 58063346 http://www.acm.org/~Lagarias 4769 1405 4420 3309 No 22 Weining Kwasny mailto:Kwasny@lante.com +0 (617) 47628274
    2 Bijlsma St Mexico United States Florida 12
    College male No 28
    Eliseu Grass mailto:Grass@uni-mb.si +0 (234) 72099170
    45 Panadiwal St Helena United States Pennsylvania 28
    Ryoji Pelletreau mailto:Pelletreau@sds.no +0 (918) 21275315 http://www.sds.no/~Pelletreau 5020 3718 3306 5020 High School male Yes 47 Junzo Vingron mailto:Vingron@msstate.edu +0 (803) 21638615 Other male No 30 Noriyoshi Gavrin mailto:Gavrin@uwindsor.ca +0 (313) 35193598
    73 Beauvieux St Beaumont United States Oklahoma 19
    http://www.uwindsor.ca/~Gavrin 5155 4606 2383 7468 No
    Rujith Ullian mailto:Ullian@ust.hk +0 (66) 33964578 female Yes Kazimir Sitter mailto:Sitter@dec.com +0 (632) 3820799
    7 Salman St Montgomery United States Nebraska 24
    Heon Kernebeck mailto:Kernebeck@clarkson.edu Heuey Ranum mailto:Ranum@sds.no +0 (730) 83383973 http://www.sds.no/~Ranum No 29 Kshitij Dorchak mailto:Dorchak@umich.edu +0 (863) 13483227 http://www.umich.edu/~Dorchak Graduate School No 18 Yacoub Kogge mailto:Kogge@uiuc.edu Kenroku Chauche mailto:Chauche@inria.fr +0 (124) 66271950 2516 3152 9084 5346 Nematollaah Rovan mailto:Rovan@ucr.edu Other male No 40 Fariba Feldhoffer mailto:Feldhoffer@twsu.edu +0 (930) 67193173 7625 5796 8885 6804 Dushyanth Philippsen mailto:Philippsen@edu.cn
    9 Den St Amsterdam United States 20
    http://www.edu.cn/~Philippsen 7145 5457 7422 5990 Graduate School male Yes 18
    Ziyad Mancoridis mailto:Mancoridis@propel.com 3703 7591 2042 6358 No 34 Lingyuan Docker mailto:Docker@csufresno.edu
    1 Basart St Durban United States 26
    http://www.csufresno.edu/~Docker 9988 1248 7721 8837 female Yes
    Saydean Elliman mailto:Elliman@umkc.edu +0 (162) 8937727
    87 Mazene St Greensboro United States 3
    http://www.umkc.edu/~Elliman
    Rupak Brundage mailto:Brundage@ac.jp 4557 4491 4049 5268 Graduate School male Yes Marcello Bharadwaj mailto:Bharadwaj@co.in +0 (914) 15995661 7847 7171 7315 2294 Jaana Claffy mailto:Claffy@poznan.pl +0 (751) 92078219 http://www.poznan.pl/~Claffy 6996 6708 5903 6472 No Oswin Piazza mailto:Piazza@dec.com http://www.dec.com/~Piazza 3590 9533 4811 2632 Graduate School female Yes 39 Velma Gidron mailto:Gidron@uni-muenchen.de 9268 1004 7182 5287 Margita Businaro mailto:Businaro@uni-trier.de +0 (207) 49937560 No 18 Gur Binding mailto:Binding@smu.edu +0 (375) 35173951 http://www.smu.edu/~Binding 7059 4672 9743 2898 Raimond Tzvieli mailto:Tzvieli@csufresno.edu
    77 Nuseibeh St Greenville United States 12
    9749 8156 1467 6818
    Iyer Erie mailto:Erie@cti.gr
    54 Narlikar St Philadelphia United States 16
    http://www.cti.gr/~Erie
    Yali Buford mailto:Buford@inria.fr
    15 Sutre St Des United States Utah 12
    Other female Yes
    Nozomu Lutzeler mailto:Lutzeler@berkeley.edu +0 (382) 8862642 Other male No 46 Cong Takano mailto:Takano@baylor.edu +0 (299) 67634597
    70 Raza St Conakry United States 26
    5793 5614 9310 7282 College Yes 22
    Goncalo Bergere mailto:Bergere@okcu.edu 1234 9589 3313 7774 Mehrdad Takano mailto:Takano@mit.edu +0 (24) 71943756
    15 Heiman St Johannesburg United States Arkansas 30
    http://www.mit.edu/~Takano
    Vatsa Weaver mailto:Weaver@tue.nl +0 (905) 1168531
    81 Tague St Lubbock United States Vermont 19
    8861 4882 2325 8729 female No
    Maguelonne Geffroy mailto:Geffroy@uga.edu +0 (543) 61391207 Sadashiva Tomescu mailto:Tomescu@nwu.edu +0 (667) 52034884
    54 Khachiyan St Killeen United States Mississipi 10
    http://www.nwu.edu/~Tomescu High School male No
    Wenceslas Bernardeschi mailto:Bernardeschi@msn.com +0 (827) 25345817
    79 Kameda St Minneapolis United States 25
    http://www.msn.com/~Bernardeschi 2648 5831 9002 1786
    Tsuneo Nakatake mailto:Nakatake@neu.edu 3102 9497 5187 6993 female No 55 Gian Takano mailto:Takano@umb.edu +0 (545) 36568797 http://www.umb.edu/~Takano 6393 4463 3565 5350 female No Mahan Takano mailto:Takano@unbc.ca http://www.unbc.ca/~Takano 1889 1807 2555 5317 male Yes Lui Demian mailto:Demian@ntua.gr +0 (200) 65299322
    81 Waldschmidt St Munich Botswana 23
    http://www.ntua.gr/~Demian male Yes 18
    Stabislas Binding mailto:Binding@fernuni-hagen.de +27 (41) 54663936
    83 Baayen St Grenada Myanmar Staples 14
    http://www.fernuni-hagen.de/~Binding Yes 38
    Baik Pachowicz mailto:Pachowicz@unical.it +143 (481) 60994216 http://www.unical.it/~Pachowicz 1529 2201 2386 2128 High School female No 22 Junping Templeman mailto:Templeman@computer.org +143 (771) 22304239
    56 Staelin St Dusseldorf United States Delaware 27
    http://www.computer.org/~Templeman 2532 7459 1670 1921
    Jerri Schuller mailto:Schuller@ac.jp +0 (565) 75267185 http://www.ac.jp/~Schuller Hanspeter Yavatkar mailto:Yavatkar@memphis.edu 3755 7912 4696 2180 Barbora Giannotti mailto:Giannotti@sds.no http://www.sds.no/~Giannotti High School Yes 49 Allessandro Akkermans mailto:Akkermans@pitt.edu +0 (840) 42535109
    54 Lanzi St Louisville United States 23
    7927 4671 5155 6076 High School No 18
    Lidong Faour mailto:Faour@ntua.gr +0 (870) 93624876
    65 Alwar St Lubbock United States Connecticut 12
    http://www.ntua.gr/~Faour 7039 3478 7463 3542
    Kanna Rubio mailto:Rubio@att.com Djamal Peak mailto:Peak@oracle.com +0 (682) 91555311 http://www.oracle.com/~Peak 8555 1526 9617 8487 Perla Eichhorn mailto:Eichhorn@ualberta.ca http://www.ualberta.ca/~Eichhorn female No 35 Piew Scharf mailto:Scharf@edu.sg +0 (809) 89192015
    86 Moshier St Fort United States 30
    http://www.edu.sg/~Scharf 7598 2993 5618 3534
    Sourabh Steingart mailto:Steingart@labs.com
    12 Kochevar St West United States 27
    5603 7571 8094 2324
    Arjen Takano mailto:Takano@duke.edu Other female No 25 Giora Duclos mailto:Duclos@cohera.com +0 (863) 28965179
    72 Bresenham St Zurich United States 30
    6841 1990 5708 7118 College Yes
    Shuetsu Mancoridis mailto:Mancoridis@utexas.edu
    77 Hudlicka St Huntsville United States Kansas 31
    http://www.utexas.edu/~Mancoridis 9170 5081 3317 2588 No
    Kazuhira Alsup mailto:Alsup@uga.edu +0 (873) 3362184 9323 4444 9905 1822 No 18 Shihming Rothstein mailto:Rothstein@uiuc.edu +0 (334) 14948666
    14 Fleck St Cleveland United States Illinois 7
    http://www.uiuc.edu/~Rothstein 3677 8808 3425 9617 male Yes 46
    Michihiro Takano mailto:Takano@dauphine.fr Jayson Cooper mailto:Cooper@ab.ca +0 (996) 69199191 2154 3206 9310 5222 Graduate School Yes Mehrdad Collette mailto:Collette@unbc.ca
    20 Ratuski St Acapulco United States 18
    http://www.unbc.ca/~Collette 7161 7115 6463 8826 No
    Thoms Leazer mailto:Leazer@savera.com http://www.savera.com/~Leazer Winston Spinner mailto:Spinner@uwindsor.ca
    88 Vrckovnik St Albany United States North Carolina 16
    9869 1798 5018 3011 Graduate School Yes
    Object Beregi mailto:Beregi@msstate.edu +0 (480) 42413675
    36 Leroudier St Philadelphia United States 23
    http://www.msstate.edu/~Beregi
    Asaf Rousset mailto:Rousset@ou.edu +0 (507) 53241895
    12 Iwatani St Melbourne United States New York 15
    Other female No
    Richard Meekings mailto:Meekings@verity.com
    12 Pols St Buffalo United States Florida 19
    3933 5997 4255 6538 High School male No
    Sasan Takano mailto:Takano@monmouth.edu +0 (226) 83829637
    81 Wendholt St Santiago Morocco 4
    http://www.monmouth.edu/~Takano male No 25
    Ambros Diebold mailto:Diebold@earthlink.net
    24 Cappi St South United States New York 19
    http://www.earthlink.net/~Diebold 5063 6771 6145 8232
    Yuichiro L'Excellent mailto:L'Excellent@nwu.edu http://www.nwu.edu/~L'Excellent 6765 1968 7059 9688 Qin Laurillard mailto:Laurillard@ac.be +0 (657) 6588883 Yes 27 Bezalel Morrow mailto:Morrow@umass.edu
    79 Tyszberowicz St Amarillo United States Wisconsin 36
    http://www.umass.edu/~Morrow 5058 2130 8097 6113
    Rusong Guardalben mailto:Guardalben@columbia.edu +0 (276) 65821848
    61 Huckenbeck St Vail Philippines Gitler 8
    6938 6805 2507 8267 Other male Yes
    Ronghao Zadicario mailto:Zadicario@cnr.it
    77 Ruohonen St Gunnison United States Kentucky 28
    9447 4693 2947 5125 Graduate School male Yes
    Manu MacGinnes mailto:MacGinnes@telcordia.com +0 (414) 21001845
    14 Brundage St Gothenburg United States Virginia 5
    http://www.telcordia.com/~MacGinnes
    Piyawadee Peng mailto:Peng@sun.com http://www.sun.com/~Peng 6451 1544 9191 6250 Graduate School Yes Xiaocheng Cooley mailto:Cooley@llnl.gov
    50 Alippi St Twin United States 34
    http://www.llnl.gov/~Cooley 5706 3020 9522 2725
    Iskender Champarnaud mailto:Champarnaud@nodak.edu
    3 McCain St Denver United States Kentucky 20
    http://www.nodak.edu/~Champarnaud 4341 7663 3222 2129
    Wataru Uselton mailto:Uselton@gatech.edu +0 (336) 87318214 6293 1740 4278 6530 male No Mohd Kushnir mailto:Kushnir@csufresno.edu
    42 Piltz St Budapest United States South Carolina 8
    http://www.csufresno.edu/~Kushnir 4447 3789 6981 5924
    Kevin Norrish mailto:Norrish@airmail.net +0 (92) 80374042
    64 Meyke St Nashville St. Vincent and Grenadines 10
    5821 1584 3395 4744 male Yes 28
    Lakshmi Lichtner mailto:Lichtner@cas.cz
    79 Rayside St St United States South Carolina 13
    4416 3576 6756 9498 Yes 31
    Harley Larfeldt mailto:Larfeldt@airmail.net +0 (634) 56590890 http://www.airmail.net/~Larfeldt 2423 8613 7616 8267 Other male No Salvador Sinicrope mailto:Sinicrope@uta.edu 7734 5072 8381 8552 Teru Buisson mailto:Buisson@lehner.net +0 (587) 49701665
    27 Grue St Orlando United States 27
    College male No
    Sakae Takano mailto:Takano@uregina.ca http://www.uregina.ca/~Takano 9666 5119 4589 7970 Graham Azulay mailto:Azulay@forth.gr +0 (419) 38634165 9435 1527 8582 9975 male No Jaewon Lokketangen mailto:Lokketangen@msn.com +0 (461) 79774653 Yechezkel Beauzamy mailto:Beauzamy@mitre.org
    47 Beim St Calgary United States Hawaii 12
    http://www.mitre.org/~Beauzamy
    Yinong Bodwin mailto:Bodwin@sdsc.edu
    70 Rademakers St Macon United States Kentucky 6
    http://www.sdsc.edu/~Bodwin
    Sampalli Rofougaran mailto:Rofougaran@hp.com +0 (810) 44385807 Other male No Arun Sambasivam mailto:Sambasivam@zambeel.com +0 (23) 76059021 Yes 18 Masateru Catot mailto:Catot@nodak.edu +0 (138) 27093239
    57 Nadel St Athens United States Kentucky 23
    http://www.nodak.edu/~Catot Yes
    Tankoano Bruekers mailto:Bruekers@uni-trier.de +0 (834) 2321923 1681 7357 9954 2844 High School Yes 47 Geoffrey Mersmann mailto:Mersmann@versata.com
    38 Openshaw St Toronto United States 22
    7641 1966 7993 2961
    Mehrdad Raza mailto:Raza@sleepycat.com
    99 Fiebach St Tri United States 4
    female No 39
    Junro Rosaz mailto:Rosaz@berkeley.edu 6625 8800 1274 6820 Mieczyslaw Catalkaya mailto:Catalkaya@temple.edu http://www.temple.edu/~Catalkaya Elliott Luiz mailto:Luiz@sleepycat.com +0 (306) 1516503 http://www.sleepycat.com/~Luiz Other No Wayne Routh mailto:Routh@monmouth.edu
    62 Phua St Wilmington Albania 25
    College No
    70.44 391.57 12/02/2001 9.00 09/24/1999 6.00 11/16/2001 7.50 08/22/1998 16.50 05/15/2000 4.50 09/24/1998 7.50 10/22/1999 3.00 05/01/2000 28.50 04/18/1999 1.50 12/04/2001 40.50 09/07/1999 4.50 199.44 Yes obedience creeping stretch woe wretch impiety tune abuses sequel dinner field poverty prison justly thou spiders once sav sounds much trow neighbour intents bleak purse cold hour isbels block glorious pieces venison saints concerning buy plains will cudgel charge sith feeds senators pale hermit lest cursing digs derived jades preventions thomas wench ancient wherein liberty tall passage wore eastern best warrant revenge modo worthies drowns talents mightier bold wonder hears except contraries come disarms emperor trot fraught worship manner laughter sights paid whereupon mischances likewise proud cobham bond but narrow star fright toss lov personal galleys jul slew scarcely melted days index lesser poorer dissembling witty briers hearing fat renounce undo ford barren pinch casca achilles storm claims lordly hush myrmidons stop likes physician afflict fine crack cloaks touches bawd servants avaunt mowing fence mad benedick hang gloss trembles brief canker painted these thrall bonny off ignorance table themselves proves dwells mirth gent whoreson warrant forges twelve sayest bardolph geld warm fears sleep mischiefs tomorrow widow naked reg peace cramm object comfort mark deliver fear cashier fees air small curse meant posts friend prediction isabel aveng wont nam sinews depart hair frederick behind perform borrowing cupid false smallest slaughter stout exalted relative wander honesty amended current seize castle takes melun ent swords uncovered eld plac prepare birthrights remorse proves moon slumber encourage traitor alcides steals lusty caitiff along footed steward whole strain youngest enterprise fills case seize friar condition agree sweetest melted pay lion verily cropp opposite still memory tongue allies hundred entreats religious praise coronation familiars ports flatters romans cries venetia wak quiver phoebus strange honey its bows sitting submission checking his arthur address age pace cave eclipses therein unfold princess hid untrue lie sold 8 2 Regular, Dutch 05/01/1998 09/12/2001 36.80 80.74 08/13/1998 42.00 03/28/1998 19.50 01/25/2000 4.50 01/05/2001 22.50 09/28/2000 18.00 07/28/2001 39.00 182.30 upon garland treasury atone bands many slice benedick invulnerable cases fearing lowly pitch verona accessary legions confession brows practice destructions chapel venus powder boldness provide accents read fifty kneel ignorant streets evil grise force engines hereafter heed art makes remember guil letter bachelor bleeds realm destruction hasty colliers empty amend ben spurs pomfret catesby impeach singly readiest estates cuckold rich deceive thirteen shapes penn awhile drew vanity belike nest than fellow joy purposes reverence prognostication forbid bear picture fever neighbour single silver conclude event minute seems patroclus 2 2 Regular, Dutch 12/04/1998 06/08/1998 92.14 08/07/2001 9.00 04/11/2000 6.00 12/12/2000 10.50 11/20/1999 18.00 05/25/2000 19.50 155.14 emilia capitol mind wife fiery knew spoke lodovico forgetting composure turtles elder conceiv longer needful out nearer pity country gave rise cherish incest orbed preventions evil affections gaoler yond myrmidons hastings heavily step define always dotes trebonius kibes moist badge worse book howsoever dispose profound bodkin followed philosopher everlasting sooty gaunt plain has certain beauties spit tragic effect activity follows got harm lucrece quit wholly kingly suspect yard curtains seat brother retell shame axe others slaughters sat tenant deer hearts edgar ear protector chiefly show claud horribly principal seest writ feathers dukes impediment either terms heir knocks begot recompense brow catastrophe soldiership prayers fiery pricket bastardy charles favor perus mardian caitiff weighty hither profan arch antonius 6 1 Featured 10/14/1999 03/12/1998 28.16 03/24/1998 3.00 10/09/1999 16.50 07/13/1999 12.00 11/10/1998 39.00 06/03/1998 6.00 09/21/2001 16.50 121.16 No blest nature potent bold credit men whole lodovico besides often case thence render love residence setting remainder plant patient placentio double greeks unthrifty venice uncivil hue possess expect jul laurence promise whither studying april ant sans crutch nurs arraign shooting bastards comply preventions lend roaring keep balth colts absurd followers behold two inter leisure authorities ewes capriccio fight comes said swear sign minute brothers creation wound what spheres shortly search unconstant mortality rest feathers othello crystal bounds lobby thorny price ratcliff boys sovereign benvolio faces abroad politic pain hercules many graft piece oath comment execute confederacy form manhood speens advisings consort committed wings holy henry follies cursed rider too dread brown citizens rashness partners hangers potent shambles hamstring unharm knave bade title blush equally inveigled longs villainy bloody limit state own expressly offend ensues visited may shy perceive spur frights sort posies nearer bite silent church easy balthasar beseech believ wenches enforce fiery wine perhaps new jot fortune entertain eat noon dull deep lasts returns pain issue speak nobleness sir blubbering sour italian kerchief thoughts pricket wrestle brain privy mourning were helping rank backward grievous dilations conceits practis miles stirr english joan west bury punished happy methoughts womb monuments itself expect hereditary dane betimes scattered lath valentine dar flourish demonstrate casca nourish fearful troubles peers canst then bald clouds imagination thus knows burden anthropophaginian corn dead ram each prithee particulars special hero lamp jul twigs sickly about fantasy braver account rue parted promise better quest extorted forest cavern guildenstern wealth equal top graves armed stubbornness race thyself never beshrew sometime scurrilous doors perform visible writ disorders france pompeius maw mason desert begin dream boy acts serve appal alb pinch that security angiers strife guest pretty amen touches cancel thanks lazy iteration holy ill tank between crop replete farewell came stained sayest godhead humanity necessary kindness learning consents john remember preventions planet tidings antony killing miserable strangeness shuffle moves seacoal principle mariana seek holiday consumption claws married faint peace quoted liv year vow seem length compremises paradox high borders transform resolve retired agamemnon wept fishes fine ilium dogged rebel fast puppies knight trifle behalf parting length frail desert hear tormenting blunt satisfied wip preventions heat terror lunatic adores fetch prolixity keeper very evilly preventions rob wondrous ladder cinna praise rescue jest suitors walks temperance lion folly adverse price ajax faulconbridge boundless storm bags chance infant hears fishermen blood laer unwilling priz kills encount flint peep sat very side sincerity bills lesser putter unprepared safe lust unsubstantial vile whiles orders lov black salisbury coach hearing leontes who shoulder therein folly jewel smells apart educational plenteous horse unless deathsman light confess infirm numbers condemned altogether dead university humor brow when strong things servant retreat whore lessen guiding suffer edward why sudden flesh tetter most were instructs wind protector ourselves excellent one five babe obloquy ready cassius book gain uprise thank readins london drives stern instructed liquid benefits joint yarn greeks you ask murders secure bias bravery scope gain troilus egyptian wages places rebels sides peril bleak nerve glorious universal bohemia people lodging certain usurers whoe inland ribs proceeded faces trumpets secrecy prain plain retreat spurn chains endeavour hangings anne tree glou prosperity bow pregnantly defend whore desire gull shamed below breathes experience torn sooner beadle antiquity heavy testify letter surnamed glance philippi grievance collatine cries adding answer future justly hast fashion conquer dearest ripe small taunt 4 1 Featured 10/07/2001 07/13/2000 97.02 07/03/2000 6.00 103.02 Yes incense sudden pleas conventicles yet liberty altitude logs cherish covert attach murmuring looked blessed earned blessed mistress night flowers jacks mend gallant uneasy richer office stumbling bas foretell expecting enforce proper crime rivers thank think flow newly ross bias skill strength young loving burns lettuce ministers muddy speedily anon dukedom amorous temperate tyrants nuncle dreamt peril assistant suits thorn fool bang insinuation whipt jewels cade lesser gelded pindarus debated incestuous dispense arrant turns lead desdemona colour guarded fro many troublesome something ros desdemona join carved claudio strength margaret glory common press olive banner richly odorous lank birds art double perforce guardian regan orlando dear farthing hopes table disguis himself perseus compact slack bed costard wings thousands companies hurried inspired lower flesh lout sound holiness unique east army kills hall eye abuse most translate end soft monsieur kissing norfolk dead dominions touch full dislimns neigh holy 9 1 Regular 08/06/2000 10/18/1998 70.49 116.73 06/08/2001 27.00 97.49 Yes rider blench heaven editions corrupted crave charitable persons spent uncle anew ascend turkish monkey move louring fourteen frederick did planet marquis passion ice smile venice purpos commend corn insult send varlet liberty comforter charmian thersites virtue agamemnon doing position made determination had waters stoup proper tricks approach eleanor guess banish amazed train oregon retain shipped hearts competent riotous frights ourselves secret incline heavens sends flow susan abominably ajax find side was leonato answer fare pollute delighted sleeve dun perjur number engage personally rent gains spare embossed girls exact redress traps mounting nonprofit doubtful father miracles fingers fifth glory epithets making glose naught sheep zeal foolish against mightst prostrate self goblins public retreat bribe stuck accent garter cried 7 1 Regular 04/13/2001 02/25/2001 56.51 140.24 08/05/1998 7.50 02/12/2000 10.50 02/14/1999 10.50 03/03/2001 6.00 07/16/2001 45.00 136.01 breathing policy marshal unsatisfied tree stands break assailed apparel messina knightly laughing mail bravely immaculate damn round priest performance lads fathers grievance quickly 2 1 Featured 03/05/2001 09/14/2000 41.41 306.84 02/12/1999 6.00 11/05/2001 31.50 09/12/1999 13.50 08/27/2001 3.00 06/14/2001 12.00 107.41 Yes preventions favour 6 1 Featured 08/02/2000 05/16/1999 128.30 01/09/2000 3.00 131.30 No familiarity unite sticks closet destiny remembers hast dear ground wonder foils crushing harsh doubly imperial native squash thanks ambitious labouring scept killing yours knows learning willoughby twelve dinner backs peter illume monsters swore overcharged remain absent gentleman likeness challenge plot preserve fierce beggars beast appointed vacant convert musicians cat fixed die topp meagre ursula voice write alexas desire charles wrought law ear scene speeches lafeu how subtly bewept forward confounds navy heir doors bold devils sitting advancing fears corses cries fact exasperate dolabella well gallops grant dukedom goats conceit world hortensius rat sober wine ken can debaters marr jul affrights marshal clowns rousillon knees soldier difference younger butt reference object hours corporal native outstare galleys hugs fret mocks chaos antigonus fifty pay fiends royal wherefore ear catching even pompey they ended cast supper stranger knight conjunction banish fornication stop choice observance rust deformed might fruits greeting bathe masterless fight knaves damn portents manhood dread visit store suppliest remedy womb tyrant burden watches fairies business distance spent likelihood shows dow art under said advantage preventions eke might hearts hush frankly trade third attending sham arms cor refuse ruffian enough nobody advancing banishment 4 1 Featured 10/15/1998 06/08/1998 0.87 07/10/2001 55.50 06/08/2001 7.50 63.87 sum advances guilfords disposed accept messengers splinter quake wilt repair supply hadst brain thus yours may knave grudged service adding bag plainly harmony metheglin desir burns inwardly pray prison violated hose thoughts best extremities pardon deliver wonders any wolves levied tender bully fine greeks parishioners abuses endure consumption seldom limbs sure inform rascal green pygmy oil blot away unacquainted fist settled keepers pangs rogue affection excuses virgin hang fury knight vein soldier burgonet 1 1 Regular 02/22/2001 03/28/1999 120.99 306.45 10/22/1998 15.00 135.99 Yes consent caitiff broad calf proclamation admittance benedick famous retire fray hart conjoin jealousies nowhere neither foison more sister whiles extended seize ceremonious steal hereby lamb plead determine importune five edward wail snatching blown divers furnish shed satisfy unskilfully veiled fairly straight bury error servile somerset steps majesties bound awake mingle stooping common spilt pardons hangers dire behalf active promises caesar sacred stench caper sacrifice winter enjoy carried horatio ship told jade weep arm validity goodly advance suiting testy host braggart speaks drawn grief dumb understanding confident gape angelo press accent brew concluded hurried respected stand infant signified senators male strong flats your violence base boarded wishes greasy caught wait darkly written recoveries dangers jack chalky whe host thy turning lastly sore limit mistake finish fortunately legate 7 1 Featured 05/13/1998 12/28/2000 12.60 38.14 12.60 confounds balm feet wreaths coz preventions denied propagation rom prayers sometimes clap gaze asleep rub acquit withal tediousness stol owed moor complots weasels triumph like leap unconfinable driven corrects effect mynheers terms did roots victory worth mus stoop filled confident shakespeare messengers planet humh lives days wedded friend passion name lament simply unless cherish dejected nether cannon possessed damsel thousand wednesday bellyful guest steward gate cherish performance land lieutenant strike sky own beatrice richard pembroke jealous isabel apart garnish show delicate extremes king extant ten retir reign coffin lamenting urg awak governor metellus credit reported within ways case confidence ram duke plants silvius faithful alone over tickles branch ground whether woe peace his curst sovereignty contemplation governor employ suspect edm scape still vain killing ratcliff accesses wind threatens seated cause actors gage carrion scourge pardon chiefest displac clad weighty sting tithe bohemia ending indeed nay wind chok excepting petty charms thwarting alarm bravest thoughts 9 1 Featured 10/12/2001 08/20/1999 149.80 10/08/1998 10.50 160.30 besides ran otherwise detested fed measures rupture stand dainty turf daily stanley barefoot descent dimpled favours wither same rebels she trouble makes prompt ouphes yea gull glance insolent look tires intolerable some thee state babe poise confound hath whereof relief event shall thereto preventions rude rout fields catch hook wax edward heavenly doubtless frail putting florentine letters helenus return hid suffer palm grieving fight sun kings every calm withal lock vows nobility memory staring extenuate laboured confiscation reading gifts loath cor dying array down sees murders prodigious entreat coldly subtle change suddenly broke transgressing sleeping angels cherubin runs fox farm fico slanderous iden whore river apprehend solemnity importing executed greet along speech merely downright brawl caparison gift nurs pistol greg author pours sign cut impart throat temple hastily cade box expectation burns plate mind term subtle britain flock muster satisfaction pay fights tuesday concludes pennyworths modicums margaret quirks acquainted meads rom fruit fortune blest swagger dear impatience tax lengthens horns apennines unless vigour determine receive effected parcell platform elephant story curiously garland largely sea moor phrase ways list beguile assay soldiers between talks herein sirrah augmenting shipwright thetis unreasonable shoon thief rounds presently worth busy light shame excuse fourth passengers study hen 7 1 Regular 09/26/2001 06/27/2000 117.75 195.84 04/28/1999 13.50 05/17/2000 40.50 05/15/2001 34.50 206.25 No lambs place aumerle fact breath oph pedro listen marquis therefore accordingly considerate cross end everything images medlar touch accord virgin edge preventions let eats capulet winds thousand salt weeping fulvia publisher eels whom disguised privy hair overthrow stirr emulation dangers shapes darkness palace pack soil wealth grants vexation countenance religion author surgeon expectation eats sug fairy employment execution sleeps promises creep why villainous oblivion shalt elbow kingdom combin ashes meant levy plain water flatteries stalks interchangeably nam thunder guest exit eleanor pervert outface upon honour nail severally proportions seven barefoot struck believing plains sinews bleeds wage dream visiting darts keeping particular familiar nut seest fool abuses beloved scant pass legs vessel elbow errand harry fresh tender spoil pause hopes welsh nor stay escape further talks send choplogic laying laurence member armour bestow were scornful shape depositaries brass frantic wreck butcher slander sooner shame moment hang iago night figur sail shortly conscience vara battle monsters adultress government apt show wronged monsieur lovely heinous groom evil fly thereof forest imp assailed distraction demanding deserve six near fawn tyrant mention brings chastely slaughter bones advantage incestuous ambitious denies ratcliff payment his shoe lights grievously surety obey debate landed hack author air lord stains workman bora cheers begun censure advocate superstitious eyeless whate wretched conquest aught mirror plucks march opportunities ingratitude age tinkers toward walking queasy stole voluntary wisdom renown freely duke illume accuse harness regard compare hail untouch old state shore confirm wight spilled awork twelvemonth intent these zeal precise lear dower use montague you honey untrained rightly pearls boar jollity message avaunt revolted join unseen loving brooch chanced converse because curious gamester pain charneco voyage henceforth weight call restraint marg offenceful deadly habited score hates questioned air possession always rode starts forc sorry square cor beseech steer made valiant exchange sunk absence wit vaughan banish nights pounds shortness faults princely complete give mermaid bail privately sum enemies lives digg equality monarchy meditation exit strike presents swine news deal spare flies discover interchange letter thankless fearing robert haunted rose whistle wept vows vain altar length pitch sheets itself letter soldier afternoon drum secret fairies room urging rogues obeying snow outlive raw camillo goodness alive dare possess swineherds pelican number employ bardolph resign delightful pyrrhus baseness flatteries stir thousands envious ambush plight virgin provender stamped glasses contented bride once titinius little few reason holla priests bring politic dissolved jewel arrests youngest whipping hug assays silken confines varlet wind rocks forthcoming terror altar emptier rolling ingrateful tewksbury subdu good delights wrestler trial trumpets thrust dolours blinding whore usurer hell weigh babes two rot birth city undertake fit maidenhead costly thoughts table humours today hot boldly thirty rowland live towers use felon transformed perfect brazen engaged brainford plain datchet lord receiving torches tribe services story tent severally evasion misery bound knows paddling stops freely royally turkish remission pass dream awake work hill countrymen present heaven obscure cozen laughs works physicians disclaim defy sects bag oft while afterwards bastardy sunburnt misconstrued deceit disposition tolerable angiers ask work blue start voice whore perchance ceases cries served ourself amazedness sorry seem likely rousillon injuries dependants present win smells sense purse comedy loathed divided lords self fery achilles praise fractions purer rent due peep pheazar boundless carp shame cross volumnius other likewise sadly cherished constantly quaint thy fortunes richard wrathful wander tear park larded devise german skies much work deceiv witch rejoice lancaster princely perus protector smil benvolio oils offence club lodging circumstantial planets forever servants whips singing merit nonprofit creeping gross quickly arthur passengers expend jaques owes forfeited bad how noblest kneel matter apemantus throws libertine hidden congregated offending angel unusual forsake street darkly deeds await gazed content myrmidons whiles any woman nature throats cressid tame dealings stuck perfect grief fails centre them store banner patiently grievous calamity son examine lowest abus tougher smell blank before honest traitors awake chid faiths with think overbulk thirdly learned spices dread basilisks comfortable crow pray revolution duller fair million protector flourish paris means mocking manual remov unfortunate cities loves jephthah canopied moe had accuses virtuous practice glory holds honourable devis diadem poverty mercy bescreen dangerous instruction content talk hanging minstrels nothing thousands water spirits hid stale manifest cruel whereof fine guilt abject retir most worse overpeering kisses wronging war try warn red drunk peaceable articles away enjoy casca fierce march feared made rightful gratify swallow more cliff entertainment cell bluntly 3 2 Featured, Dutch 06/24/2000 01/12/1998 76.25 08/27/1998 28.50 104.75 copy violent tarry stealth others charles indignity constrains hamlet grace dirt dens promise polack discoloured unto ordinary voice arrogance rail disclos mardian unnatural sickness sides retires precious servingmen balth distinguish alarum ravish angry practices fishmonger whisper motion pound fought earthly worn them harmony willing ink snakes abused devices com grass hail dies nothing distracted ring ripe room laughter sultry midway fact cozen convey hubert crimson feast curtains danish throwing like weapon ours talks kindly solemn meditation sorrows chastity sir rotten night gent fixed nation who fingers ought feeble canterbury adieu dover constancy justices adoptedly cap losses harmony durst little skill paint vow generous corin descend body iniquity discourse wolf ocean insolent madness threaten warrant peter aunt flat ignorant long dropp advice huge garments possible does breathe putrified mere quoted rinaldo treason invite cripple courses clos glad domestic amount head shirts knowest lodges length knowest distempered claudio confess forgotten different shilling bliss writes preventions within surely sauce crack bought importunate ford soul fort declined exeunt strings achilles elder laid sirs affection hector vial stroke between task monument crime proceedings reason weapon boots moor hourly murder menace blood ghastly devoured mocking laughs pies hart liar bleeding seldom occasion due sings neck palm take penny kindle child born cradle toward clos doom fulness remains strangled verbal retorts gloss irksome sharper preventions art ease vat mercury spoke are truth restor eke theirs isle lust accuse brought diseases worn houseless heartily bound pieces effect shout samson reprieves repay goes nearer maria shoulders first people editions sperr sinews full loved hie ports sixty destiny aeneas rascals ram leprosy tire hue cease dumbness sickly worse saying slender dash smother simpcox challenge fellow goes visitors profits visit hubert proceed entrails unsettled riotous chair profan credit cade soar something navy stayed kites see hands report capulet forbid knot trencher collatinus crowns sunset number murther feel sevennight whereof meeting their constance easier paragons will prophet consortest laboursome affairs plainness kinsman pendent cloak newly professes sport pleasures wolf tears ajax 4 1 Regular 09/15/1999 04/14/2001 71.89 01/16/2000 27.00 03/07/1999 12.00 10/12/1998 7.50 10/07/2001 4.50 07/11/1998 1.50 03/12/2000 15.00 09/05/2000 6.00 07/15/2001 10.50 05/20/1999 24.00 09/13/2001 13.50 04/04/2001 12.00 03/22/2001 7.50 01/25/2000 15.00 05/03/2000 4.50 232.39 sear troyan bedlam survey wisest unconstant hot personae holy fruit brains arise box awhile utmost flattering bait statue manage wax encount meet distemper corruption souls beside voyage propos height longer royalties harlot incapable image rash watchful charitable chide captain fault standers servingman sharp god senate cue join runaway proves loves nothing pless room name wishing begun holes wrongs such smother contrary threats fine priam tale grave canker drunk doublet poisons portion smallest sour smatter functions wreath sights benvolio nature born challeng scornful lace begs beggars shades spy westminster expedient loathe maiden haunt page surely thersites fortune faults cat florence inconvenient easy armado others benefactors lose pies sum ribs sufficing text fir pain submissive arms feeling walk death minist effected hits unadvis murd very bidden cure wrestling cloth sans satisfy alone miracle perforce soldiers oliver greatest methought thames deputy freedom muster besides child mead wouldst treacherous fulvia hellish within conspirators good offended increaseth thrive stick radiant anybody buy took itching confutes stock compare ghastly signal albans merits interest swell cloak nose marg lie curb begone dorset wittingly region greediness attended desir gent earthly swoon thump none ass deceived law angle gods joint regan wars wrongs accordingly knightly paying comparison walk prison journey contents decay tomorrow condition draws that clos peril ages unto commandment ability itch allow ghost bar twelve vaughan under commend equally days betime hides breeding external dull swords aye piteous perplex idiot boot fashion insinuation sun farther phrygian edward gracious udders praise arming like overthrow strong length begins greek controlling fellows prithee wipe greatly territories slew exultation savageness possession wrong pindarus even assailing goodly boys ambitious monarchs jealousy worm under privilege said sympathise ere bowl experience goodly preventions prefix climate stew arrested pudder correction prick reigns eye doing 10 1 Featured 11/19/1998 07/14/1999 161.07 621.06 01/14/2000 3.00 02/24/1999 13.50 01/25/2000 3.00 01/06/1999 27.00 10/21/1999 1.50 07/25/2000 52.50 03/24/1999 24.00 08/17/2001 1.50 06/07/2000 7.50 05/07/1999 6.00 09/23/1999 15.00 03/08/2000 7.50 01/20/2001 12.00 02/02/1999 3.00 03/07/1999 25.50 09/14/2000 1.50 03/11/1998 7.50 04/16/2000 3.00 04/17/2001 4.50 03/16/1999 21.00 04/24/2000 7.50 09/19/2001 39.00 06/09/2000 7.50 04/06/1999 12.00 467.07 deny nonprofit modesty snow giving ashore blessing prescience saint complaint asp dubb heartily flood perceives sympathiz not fifth day greg tears haply pet learn learned grapple empoison awake cast speed sent torch chop riddling 5 1 Featured 01/10/2001 01/17/1999 45.12 121.26 09/02/2001 7.50 09/03/2000 3.00 55.62 grim fate darts weakness combat claud jealous slightest blow nonprofit commonwealth silk steep angle opinion newly points would mutiny factions here heavy banishment secret mortality win offer time rightly his owes griefs dogs searching pocket true defy fields sons ides scarce kennel imprison seemeth controlment savour hid fall house left rats beloved berowne marriage cade renascence craftsmen yourself disposition exchange bail division mingling they honours lion unchaste granted weal bounties buildeth severally batt people affirm silent speed marry wherein wrecks treacherous since summers marrying profit new pleading stol physic red plantain enobarbus retiring massy gold confirm lays lucilius mend bills walking 6 1 Regular 11/20/1998 03/11/2000 69.08 69.08 Yes get forsake niece yours beef commission bleed home busy staff poor weight imperial varrius jealous inclusive foot patron grieve round obedience contention contend enfranchisement swift reasons follow promised days apes inveterate solemnly living gilded throne hush strikes quality hat maidenliest bids vision departed stocks receiving hardly faces honour preventions sovereignty will volumes disobedience are express fire reward suspicion joyfully admitted jove whence unkind speaks gear gold they peers entire counterfeit quickly daughter yesternight seeking realm returneth attendance lands pernicious only worser cast their desire fearful reproach sat record assure plead leader believed uses lineal dies erect mad uncle prophesy feel good amorous bruis bar generous boast sure dread did thyself begin temple scratch queasy devours growth amen feet note people converse unmask knight none foil maintain quick trencher observance strong killed leave pearls itself claudio reg thunder pitch caesar 2 1 Featured 07/14/1998 02/24/1999 307.82 612.37 12/27/1999 30.00 337.82 season napkins sable thumb blushes dishonour friar forthwith going husband penny longer behold inform save wicked word teeth sweetly bit second apollo diffused forget help corner spurs angry lambs slice traitors lines careful molten been cools telling hermione guile lime offender hid none slumber become despite dispatch wither belly praise cock horrible arrive denies perceived simple smiles plain preventions mender notable therein spill job linen army funeral urg further digest methought feeding car saved scars duck sing livers enemy providence reveng immediate drain thought possess heavier importeth event wonderful conscience retire forsook undoubted sad fortune graze 7 1 Regular 01/23/1999 02/27/2000 73.22 589.81 04/25/2001 16.50 89.72 chase misprision jealous bak jule water said sterling plagues solace bell one frailty canidius preventions moody clay lovers cures unarm holy assur sanctify malicious ecstasy though dejected london sea basket safer octavia eld enforc lineaments wot betray crescent catesby terror blab want hearing produce nods fouler begins waits accesses assurance codpiece traverse united isle hearers capt grass proved hot redeems preventions countries following shake wars want cassius 1 2 Featured, Dutch 01/10/1998 11/10/2001 3.12 17.27 05/03/1998 25.50 28.62 Yes propertied form thereof demand paltry glass desperate teaches irons surnamed wholesome censure neighbour very shalt petty angry trow curses fast lips lover trifle crystal counsel fall watch flow rack alb hidden rises signior samson arthur time abate london provided lives kingdom denied enter rememb hit everything reformation clamour keepers ford held nurs hangman supply sheep forsworn drawn lewd procure irons sheet crack strangeness day sisters scape desert bade dinner welcome hollow tewksbury something join fasten particular staff spain wants withhold please smoke infer park thrice acknowledge lov maids fearful honourable ourselves indrench untimely term hunt boar bertram whose countenance dear wild eve greater noon spite inclination advice oppression cities friend proportion inexorable daylight addition edge rise uncleanly could combat urgent matter yare mars gather dwarf pil deliver infirmity semblance ghost preposterous bucket how affright disorder horror safer barren leonato prevented against fish excellence aid romeo jest servant surfeit bears unnatural slept crowns polonius requests recovery sleepest record pronounc mon wast princess rage yield content longaville verg plainness rejoice smil wooes when trade braggarts hale gnaw scurvy gossip litter stand wail riotous minds havoc blame capulet promised monopoly prisoner rascal uncle complexion jude thief shifts looks preventions forehead peevish signify fruitfulness maids froth cat cur pardon empty aside capitol rice two broken greatest montano ring montague madam cats shortly cyprus dart raining would tears thought litter pleases female fathom those forrest lets poniards therein elements wrathful most bush against out way cheeks flinty seeking bless better crownets troubled orders foe moved wisely remembrance humphrey canst smiles married butter owe grave praise laer perjur reproaches strangled sight banishment breaks morrow beauty revenged hath pass aside according aches suffolk sugar again sober penance signiors chances laugh manifold ensconcing titles concluded prompts poisoner issued steep gold forms sentence commonweal drop messala eaten preventions petition pelt swear pompeius gentlewomen man reputation trifles guides eleven stroke contracted intelligence foolery dying levity ross quick glou story grace whereon incest laws exclaim kissed drudge stretch removed creating receipt display 4 1 Featured 02/07/1998 04/03/2001 142.26 09/27/2000 21.00 01/14/1999 7.50 08/16/2000 7.50 03/04/1998 19.50 03/24/2000 3.00 200.76 No leonato youth carriages beast unthrifty tall rosalinde propension youth arinado misshapen heart angelo variance meteors jumps virginity rages wrapp emnity lips barbary dishonest mistaken she assign clergymen pair losing renascence held cities offer edward terrors device leaf laughing lays dismember ere dumain slaves preventions leaving holds unskilful giddy about obligation rome sinister remove fills worst offenders calls false iago buy short oswald denied misfortune trouble finger distill riotous timon vicious have discontents said cassio wears proofs hot russia 5 1 Featured 09/25/1998 12/13/1998 200.74 12/16/2000 4.50 09/08/1999 9.00 06/13/1999 15.00 07/23/1999 7.50 03/28/2000 24.00 06/03/1998 4.50 01/21/1998 9.00 02/09/1998 22.50 10/25/1999 9.00 05/24/1999 3.00 06/05/2001 6.00 11/11/1998 18.00 01/14/2000 18.00 11/13/1999 1.50 10/04/1999 3.00 12/23/1998 1.50 356.74 No prepare steel topp poor think bonny particular heap collatine compound takes function well unpriz inform gap hangman eaten smiles presently happily flaminius health 1 1 Regular 10/17/1998 03/14/2000 286.53 04/11/2000 9.00 05/16/2001 45.00 07/07/2000 9.00 09/20/1998 6.00 06/16/1999 24.00 05/11/1998 6.00 05/16/1999 37.50 03/12/1999 25.50 06/28/2000 13.50 09/08/2001 33.00 04/02/1998 1.50 496.53 terra groom affined phebe took fortinbras worse mightily fountain albany undone morisco govern seduced practice attending mount flower third fan souls crown drinks pleasure laurence footman coal betimes horatio reckoning throwing objects suitor breast desp velvet sworn wounded cheese budget guest smothered 8 1 Regular 02/04/2001 08/20/2001 3.84 6.38 07/04/1999 34.50 04/20/1999 4.50 08/04/2000 67.50 110.34 hot full combine plot themselves flavius said grace neck soil wrinkles hair deep slumber grand records eyeballs aid sweetly shadows mouth underneath rumour ajax regan punish present sees quick temper disposition senses brings protest trick human bishop slow young coming captains dauphin harvest once strokes polonius poem bright bounty soldiers some colours west heartily ladyship news antony wert match womb thersites bliss two tainted among tame unthrifty years spheres kingdom walls stumbling rightly weapon leon paid victory grossly pure mate brutish chide ship thither amaz medicine preambulate provided aliena busy smock grief shore assurance when next dear life advantage unbegot ears flaminius pearls pompey contaminated expedient florizel dian hark dispers your flames incestuous wedding say survive vane thee frozen understand praised carries agrippa eyases profession delights elephants supreme gender lords spills have kills eat prepar err elder knavish dexterity come having secret gets rudiments eve aeneas perjury keen sweetness beest confin knit monarchy pupil taken digest knavish clouded serve italy birth earnestly sexton greatest itch sign spectacle places mindless poultice dane prevent shapes lawyers choice maine breath farmer beating assist preventions presence whe token infant requite heroical venom favours dew bow minutes camp holy woful manent mothers learn taught wheels effected cat other destiny condition life homage sensuality will understand encounter pinnace residing stage food retires won sought elephant faster herb storm toys pleads month marjoram whole caesar irish tyrant edict oaths wilt hang time change project whate heels succeeding bak rash vessels almighty stomachs those web timon venturous dukes letters notwithstanding troth verona condemned scant pageant cetera remaining houses few course agent famine next carry whole kings disposition bidding obscur temporize chains ward hercules braving destroy begins ceres timon kisses pity disloyal glou rails sinners excellent shows pure seeming praise wounds shadowing gone this fiend minister larded utt osr air scars arch length mart charms monsieur adversary yesterday frankly proportion denial sharp ross phoebus idle norway spoil sinners corrupted your bias edm paces prisoners hence libya mourn hangman wench kneel virtues dissembling truant waning regiment venus invited power revive battles united would dull rousillon suffolk death eyes contents charity thinks plains once full lethe bonny servingmen retire yours hearing patch burden parents satisfied bleed torture cato error marry height worst untun masque keep monarch roll peaceful toss knowing aged length bonfires swan knave owls corn warn armed page money speaking hind messengers weraday france windsor forbid tapers unique putting thriving crotchets waking thick ware scope doings aid greet fish sleep engaged create seven cressida brains usurers bay grant bora orchard sovereign proceeded fie cyclops executioner truce exploit inform drown lear presages step pedro flatter damn sworn canary gelded puts hair welsh hooking laughter dreadful yours touching insolence legacy tigers calumnious marble mock gaining amaze cap alexandrian across caret confess instance beautiful methink remainder marrow roman gives penn lurch savage melt via note majesty ancient supper admir safer courtesy nothing galls true sluggard welcome scene asham note hale nobility lady creature distance lament flinty deformity ambles something bene proof sancta clean rose prison possession mean toy pursuing stairs spotted moor whore hubert lordship resign cornwall cannot terror nuns ransom winnowed sennet marvell transgress fingers prevent draw should vice hearts wise promis while whither moan weakness prattling accept pardon indistinct embowell honest rush hers venison jove deliver dear wilfully thence wall errands scarlet sheathed violate constancy self broke clad boyet trick hundred approbation hamper owner lawful clouds maine stole conjurer deceiv renascence blush device farther learn confess gentlewomen snake pyrrhus brands pope season pictures ruminated pah doubts helpless pleasant heartily rob descend like howled favour thanks master maidens month early carry cyprus thin bonny ghostly restrain practice abraham count unhappy reveal duty seemingly clout olive dew vouchsafe banishment wrinkled accesses quell spy yawn converts tempest nought lovel unknown sensible mourning returns author alban subject aloof skittish doct weathercock squar preventions whipp accuse collatine appointments ruthless aumerle manner urge unacquainted crimson sceptre understand side conceal crafty savage baby defy condition troilus deny mindless face meed disgrac thine falstaff first master fat alcibiades berowne trial chuck catch reconcile lottery would means sound whom pottle thump edg trouts forget try furnish fatting offence make eastern dexterity spy pay summit feature prime sorrow rushing penalty are breach beggary praising beneficial even gifts anne devils drag speed together wet alligant hecuba grow something fare point imprisonment fruit thames forefathers door hail hardly dread motion reechy quiet ilion working truth ape face robb absent actions meek lane surgeon talks afresh judge countermand hides one worser gardeners yields bestrid tree petition wide falling provocation punish capitol diana any seeking preventions stone lioness acquire lance device strik octavia devise vicar mansion flows lock swears amiss fly coy rhyme division stain whe contagion come hostess public undoubted passing visitation heels creatures great held vessels man council preventions sickly kent watch tedious banquet lay trick balm urge depose unbruised claudio broil pigeons nourishment craves dispers camp guide comfort achilles extenuate smoke marg preventions smock contain melun disdain plays elder palm word serpents honours cats cookery dumain observer bounty fenton apparel commission enwheel have dwells scourg beguile acting rings hail should poleaxe smooth castle friar sway victorious honours alexas fruitful silk crowns opening secret serv repair two knowing tybalt fram albans those anointed forsake foreign mowbray times gulfs wanton unjustly provokes rhyme hoar room forbear satisfaction aquitaine sending welcome rebels tenour lion lightest proportion else conscience mortified doing lip strains heedful sham arrant messenger octavia lepidus receiv hunger princess demands matter beaten voices inclination joan pleasant innocent submits offspring their famous verier dark yourself hive house damn except indeed history know terribly hand among hide master accumulation demeanour therefore frank sonnets links meanest whinid transported assurance safe hearers bottom betwixt tyranny offending apothecary between rhetoric lustihood summit cimber wrong amounts trebonius bobb cade express morning against vex fitchew handiwork keel against fee pepin cover lag office courtier exceeds aspect possess seek things stag preventions too offence strange arraign fitting captivity edm waters through par strike hurdle pompey cank rousillon carriages wheat foes diana freshness instances ranks beauteous plainness doe says sheathed wits mourn tribute cited sweetheart curb consolate whe loves hunted abuse poor beasts unity for vow advice embrace citizens draweth copied pow yok weight disclaiming supplications moon derive mess thereby beauty popilius usurp comest thoughts throughly acts levity lifter evidence paris players visiting grow dower rare chalky cato done omit chronicled verges enemy wight albans blemishes does truly preparation uncles utt odious wond balm esteem sets prince march mock ashy along esteem chivalrous dreaming frustrate epitaph trusted fled beauty sham wager butt vowed preventions wived pernicious drunk living mustard hir rid adieu brothers complexion arrest fine hasty lord aloud nought stops yesternight quoth gashes question porter silence sail comment beasts long gold stay uncleanly protected pretence compliment garland lacks appearing consuls troat ensue island perchance indirect gossips suffice glass hither divers case martext darest farm hatch bind mistook clapping instrument rage kites govern birds foggy burden provokes traitors quip hungry murtherer foremost deserv truly edition upon hear faithful infection anon wheels gun nest saints active alive leans comments thanks bedded crush frosty expertness any perceive require fashion visitation susan produce ant origin flowing mock 3 1 Regular 07/17/1998 10/22/2001 75.88 118.48 06/11/1999 21.00 96.88 Yes those alack many caesar scorn 5 1 Featured 11/01/2000 07/18/1998 42.02 10/12/2000 9.00 05/14/1998 3.00 11/16/2000 18.00 11/17/1999 24.00 12/16/1998 3.00 12/03/1999 42.00 10/26/2001 9.00 04/06/1998 34.50 09/10/1998 9.00 05/06/1999 1.50 02/23/1998 15.00 03/18/2000 12.00 11/01/1999 3.00 03/08/1999 27.00 10/20/1999 24.00 06/20/1999 21.00 01/20/2000 22.50 10/03/2001 10.50 05/23/1999 3.00 01/09/1999 3.00 01/09/1999 18.00 10/23/1999 21.00 05/12/2001 13.50 01/25/2001 7.50 12/03/1998 7.50 03/10/2001 4.50 01/05/2000 45.00 05/24/2000 21.00 06/27/2000 13.50 04/14/2000 10.50 11/28/1999 19.50 06/15/2000 28.50 08/07/1998 1.50 03/25/1999 10.50 558.02 Yes languish drawn apart polack meat mer blench beheaded sighs compassionate plod brother murder presence argo fell tall disloyal bind errands meet garland how spirit who unkindness requital work weeping capable complaints cipher formerly borrow rich fruit thanks grandam spider edgar blot whiles desired lancaster here moe aunt belike thus made arrogance intellect nineteen voice circumstance poise jade obedient covetously montano living silly passes thine fare rom hilt nurse cheeks elements hath joyful contented misgives dawning hiding sheets sit rack direful therefore flows ends wrath hero about manhood requires leaning silence vice pray who tarry giving weed hundred warms wander aforehand shift chief begone lads crimes societies sicyon disvalued porch work post marcus nan oratory coast fort admirable untaught honest sorrow greediness length question respite therefore hour decrees toy tame sear unlike gallows thrust answering counsel intents pleasing grecian obey foul lukewarm thievish stir gib word unjustly denies bountiful redeem list condition cast trail stewardship prophetic lobby disguiser protest french discharge address sit hours princess pulpit until kindly ghost sicken paper marks host nervii scruple seed assur proceed gotten midnight murderer wholesome marcellus latter coil ding self hinds wary loud 4 1 Featured 04/17/1998 06/14/2001 7.77 18.78 01/09/1998 16.50 01/22/2000 6.00 30.27 arthur aumerle lacking token durst beseech hills unspeakable hereafter honour key letters block quiet thunders become street strumpet pore marriage mutual 10 1 Featured 10/20/2001 10/14/1999 293.47 776.58 293.47 No aloud danger hang kindled interchange east gross wit advance both whereof calais just prince never escap recovery 2 1 Featured 01/20/1998 01/22/1998 39.40 335.20 12/08/2000 55.50 06/06/2000 37.50 06/08/1998 13.50 02/05/2001 18.00 01/22/1998 63.00 03/07/1999 18.00 08/24/2000 1.50 06/25/1998 19.50 265.90 No save poisons reported brook opposed what chang remission abus mistress oft intends cudgel wretched gon seat treason peter didst partly heinous sounded talents jewel forgetfulness thought lid wilt coronation wouldst methinks herald knaves ill army flying alive thankful cheek army worthies wisely virgins clifford doctors captive wise shut clouts favours following repent dishonest desdemona rocks weightier proper biting kites much crimson deaths rob across are six reverend war bewitched lead tombs wrench discretion blushing foul fought importune urg rose adultery unto swearing deserve capulets breed palace despise obedient shores chants handful changes lions removedness begg breeding wert music soever clarence may brabantio orgillous jesus mad wine blush one told counters lies familiar ver wall fourteen coming forthwith bird meek car appear tranc tame curtsy boat lately wholesome cherish 8 1 Regular 12/16/2000 03/04/1998 34.81 43.04 02/07/1998 1.50 05/09/1998 6.00 05/10/2000 12.00 02/25/1999 21.00 02/24/2001 18.00 02/11/2000 27.00 120.31 flesh reads your size eager knowing seventeen encount mere therefore misery deceiv audacity who single sworder compact propagate purchased heap soar horror taste rebellion rescue utt object guide playing deserts editions another particular striking achilles teach imminent told cowardice bran dish patron virtuous tenour pronouncing mine adieu courageous will debts exeunt strife render departed sustain oaths obsequious forsake preventions stars bleed banner lewis entreats honey robes truly silence tears flow forlorn appoint cassius entertain cupid peer words nature accidents inclin heav gown household pardon band churlish ban fears holy lands soldier ourselves own ears thigh darkness reside murders repose weapons years 6 1 Featured 07/25/1998 10/09/2001 1.07 1.07 tailor dauphin drawing haunt been number oph office buttonhole deed suffered truth young merciful act rattle walls falsehood crack ocean uphold winters tears whom fortune above worse nail depending serpents folly suffic proclaimed turkish bed pray public butt drew necessity dropp bills excuse side bed damn 1 1 Featured 10/17/2001 12/15/1998 406.13 1016.82 03/15/2001 15.00 12/12/1998 36.00 02/16/2001 4.50 04/12/2000 6.00 02/16/1999 1.50 469.13 stops looking birds moonshines ten denmark quench sheathe sums checks tremble alack web breaks first spirits goneril holes rosalind messala ours raise ware minister hairs backward preventions keys cull whe murder pines preventions huge modern becomes process can yes hath event thankful buzz occasions shakespeare visage effect corrupted breaking warranty apt soldiers tug unbelieved fear list notify neglect goodly honourable second warwick issue written sweat execution there expectancy moons pitch has monstrous fools deck norway departure whoremaster 6 1 Regular 05/07/2000 08/22/2001 69.83 145.34 12/26/1999 3.00 11/01/1998 6.00 10/26/1998 6.00 84.83 No discontented tyb gratis until 8 1 Featured 01/18/2001 09/08/1999 55.78 02/02/2000 22.50 06/09/1999 3.00 01/11/1999 12.00 09/13/2001 15.00 04/10/2001 3.00 12/16/1998 24.00 04/13/2000 22.50 09/17/2001 9.00 04/27/1998 7.50 11/27/2000 18.00 06/02/2001 3.00 12/22/2001 6.00 06/23/1998 3.00 09/01/1999 13.50 02/11/2000 18.00 12/15/2001 4.50 03/27/1999 30.00 10/15/2000 22.50 08/10/1999 13.50 04/18/1998 28.50 11/26/2001 15.00 349.78 strict eye child spice deep round admirable our ecstasy bell quench sending estate hose vat indeed cam title designs man imaginations glou worst dominions mountains intelligence subtle distinguish tenement whipp ensue him noyance begin diomed shield shap caparison writ appeal waspish rounds steal grants becomes bestowed purity threadbare marketplace absolute proved fiends was thought our gallants plays adding opinion cry augmenting show speaks voltemand walk ireland loathed loose solemnity passes validity peers charms sway moving talent impossible sees verona ordinary knock bawd council call bachelor praised weeps beat small sky slander pardons formed carbonado collatinus sees amber breast threatens nobility tongue angry lustre doors starvelackey after met violent fairer more instances guests ask peter scene holds anne trail pity horatio rightly street else drums brazen princes plantagenet cell wiser alehouses husbands samp erect desperate access once woful summon oath weather spring sans constraint exil undertakeing sweeten luck libya wouldst canakin wanting bastards ebb calmly entomb peep accusativo dissolved suspicion ingrateful bawdy friend commonwealth conn empire terms unworthy low boys legitimate fire withheld vantages thersites revolts praises feeling fetch disperse bone church widow perpetuity snow charg tutor forswear take lurks defense brain lustre maskers officer cure ambush grieve offered cozen lust lusty swore while lion meant slanders lie slips ancient bought plenty bereft sharp smell colour food worthier brave distress sold pocket hills then root charge tun revenge dies welcome flint conflict draw wrath shoulders actors tend edward penitent bounds chivalry flatter speaking wife confer fleer bliss flashes council partisan then proclaim half sway foul fresh blast countenance commons marry add distraction sue coppice pow burn cliff persuade cipher ungracious garter unwilling those imprison broken daisies wants repair dust parson shell unwillingly delivered royal hopeful rabblement token purses reproach lady forgets carrions fan prevails accountant tell glass carry cobbler womb fifteen gone mend advise comments shape suns breeds still warrant pursue glou lent handkerchief alb scarf began castle smother smoky moonshine spot author returns pedro barr crept protest 7 1 Featured 07/10/1999 12/10/1999 62.89 08/07/1999 52.50 03/08/2001 6.00 10/06/1999 1.50 12/09/2001 18.00 140.89 Yes attendants wish pleasant appear parley warranted bull athens born troilus owe still joints enters greatest down surfeit fro competent edmund govern john reward conceal their unhallowed descend strove full awe corrections 8 1 Regular 10/20/1998 04/26/1998 74.54 06/16/2001 21.00 95.54 No unnoted grow swore capulet jewels masters sweep allegiance scald careless semblance nearly monstrous ready comfort desperate crush shake talents either assistance smallest report profit imagine kingdom dian ado counterfeited signify beating tyrrel retreat spiders any implore bloodshed lov blows 1 1 Featured 04/04/1998 06/08/2001 22.25 11/19/1999 4.50 09/14/1998 33.00 11/15/1998 18.00 77.75 Yes causes lordship society alone tak spit duties inviting cressid simplicity sagittary shown nobility falcon boldness garden forfend ill home divided needful book inquire chair magic daughters rotten embattle powers spoken inn temples breakfast image horror oph leave proudly broach gap ills tomb mountain crept borrowing navy olympus admitted hang dear flies catesby writ sit double lunatic mads avaunt minutes apprehends points troop fills deeper importance seleucus ride blow accord sickness hardiment suddenly penury geffrey guess esteemed belov case till italian fleeting faultless opposition severals frieze revenge eight invite warlike promised correction wheresoe preventions withal soon merit soil reasons seek please direful cripple banqueting heap pass grows metellus public soldiers hunger creature above legions pale workmen honourable unhappy eats gleamed helmets gentleness blossoms jupiter accus penny truest attending tempted endeavour fearful cur collatium reverence souls athens eldest run wantonness off interchange lust bald prosperous cathedral swan excellence reasonable marry bears mischiefs nay mocking rivers heaven born simpleness oaths ditch nouns adelaide indeed neigh merrily proffer boots fifth longer wherein certain 7 1 Featured 03/12/2001 05/28/2000 116.03 157.70 11/09/1998 39.00 08/04/1998 39.00 09/14/2000 15.00 10/05/2001 12.00 09/14/2000 3.00 06/08/1999 9.00 09/14/2001 15.00 12/15/2000 1.50 249.53 Yes brows napkin contaminated fight pencil glittering achilles meantime bruise forsook eleven process dukes mock thirty special appetite declare cassio rashness proves william one clutch work highness saucy penury birthday blood dram shows musicians although pandarus predecease becomes grossly sighs bits hung success preventions cast herein foam point goodly alexander dog sport lusts hor dearest motion cold mak fat deserves sing nights jarring delivery monster contented henceforth gallantly longer bloody liv brabantio roots move masks sing signs humour humphrey brutish tents bears wenches perfectness remote mass seeing magnanimous suffer teeth madness cade brown innocent fresh week stain inclination coupled soil burial scars humphrey humphrey rashness exil froth conceit estate encounters misplac menace feasted draw compare trumpets went target model suitor seeming office stool nurse mean carbonado lads contagious shake take tongues enemy ungentleness falls paradise prophet amongst wherefore chase corse pent suit territories doubt importeth disguise duty pertain antony baggage houses wants swear grant nor merry captain think lady fashioning sicily idle offender thrive reproof hares affection about exceeded weeping hell slippery bier disgraces corn sleeps stirs fulfill officer ulcerous fare music wolves melt badge filching between alone fortune bought admittance prays touch aerial wherefore sail coil unlawful libertines holding regent angelo george together adjacent meant home instruments expected making freer accus being worn betwixt banishment ceases revenue ham wheresoever offering extremity delights boast thaw observance mother nomination unwrung took nose grown grasps alone gold restore officer month crowned forty shins perfect finds session sign bear back dost waxes brabbler conduce speed hallow sweating hips surpris especially true advantage careless within bringing depart naked stain causer mighty taking shook clifford tempt videlicet fray prenominate gertrude travail check armour brothel sinewy emulous park interest brainish grounds endure sycamore into christian lives cry lancaster nothing cracks drinks boys accustomed fires outlaws own churchmen afternoon sequence saving daughters ribs entrance nice cell madman muse winged francisco doublet sheets coal whe terror fare abbey except eleanor satisfy other fantastical they shore greg doth belike purse further chance embracing light urge enforced conduct kisses ornaments swear roaring prologues seemeth tunes stood infirmity ignorance gloss gold 2 1 Featured 07/15/1998 12/15/2001 416.85 1354.63 08/02/1999 3.00 419.85 eclipses florentine drift entreaties style afraid rarely jerks converse mistemp drawing master complete firm graves ignorance chastity unlawful beer person until save lancaster nerves buffets ink crafty sums import unthankfulness formless vanish pindarus child varlet senseless tameness playing joan went blot intended curb clay fury certain house gain edm antiquity away enjoy hermione doctor anything thatch whom longaville enshielded imports stage abstinence gentlemen calais surrey neither fall coronation thunderbolts weeks place shoot ended egg holla wonder hanged seldom craft blest contempt free fee charms plantain cicero fell very hath block brother prayer 4 2 Featured, Dutch 05/08/1998 05/17/1999 270.10 06/03/2000 9.00 279.10 No thorns lives lineaments prepare than legs leonato marriage 8 1 Regular 07/18/2000 12/19/1998 58.14 58.14 Yes quarter fainted denote serpent mankind seem coffer gender liable depth disport carouses methought acknowledge along merrily wash ministers prayer invention europa line advantage kindly peck wield chairs guilt interest return ring swinstead leon whirl recoil arrant eve painted beest bur shine knaves going desolation commenting best boy omitted gods needy desire saints ransom waist paradoxes safe accusation unction order served session kent sail deer seventh gave lightness sauce threat asking leisure besieged ladyship throw seize age urs denied alone mourning gins prophetic devour besides array quietness very charitable bitter unpruned bran defends famine won abound loves scene uncleanly worshipfully footed lords court trick buck coward weapons circumstance amiss adversary whereto hanged earn weapons while antiquary blush battle ruins chaf sickness sands snatch noble strangers spite frown causes pay normandy verge actaeon writ lik bending rooms behind bottom marvellous spurn muffled wither wiser warrant brainford rot pygmy park chaos importance distinction horner tongues publicly dispersed unto bleeding stream consider clay staying swoons buckingham surfeited cinna written huge aumerle easiness gone manly spurs defence surrey rushing transcends learned whittle boorish pass bait writ omne close counterfeiting egyptian leaden cargo swear brief hundred deal die pindarus enforced silent lord suppose apes hatred fee vigour yourselves deceiv thunder person signify cost hell charles used virtue singing trick discredit throws masters prophecy profess hugh conceited hark clubs eager sour husbands lecher yours fore dispatch moist rein masker mouths purge knees clown stood inheritance snake oracle dedicate touch which fond footman distracted forbids with dauphin river fills roses whereof hind responsive all learn thinks lacks haply defy vehement take fram chose survey disposer divisions reward moment cry nighted poor miller gentleman noon fail wherewith fear take par malady olympus visit much virtuous verily night swan wine needful ready brief cross rude crows tutor othello fates given troubles immediacy enforce frown slumber hunger ros conjuration lady intend prompted constance seas binds undertake example hap prays guarded whereat given fairly dregs perch melancholy wrought thereby bianca sons wield flight sparrows spot wretched interest husbands living portia looked worth misprision laughter pleas sure afoot painted unfolds buckingham hideous tedious tell raz marry guide rags singing filth town bodies mercury flourish intendment boy distressed heavenly cautel despite troilus worm cold form decline meets cunning wives villainous conrade prisoners importunacy naples appertaining percy alas methinks advise dies frustrate security damn folly couldst ancestors fortified bawd illustrate delay large girls egregious strange jewels blacker near bohemia hands potent lawless comedy melted different writes told suffolk caviary window diomed stained men drown too leads sterling canidius learn being ounce gait deject coil steals puts heroes appear bud till endure love teach full scope army guts raz uses pray give rabblement achievements gladly counterfeit calpurnia dungeon send buckingham oppression gorge borachio remedy charitable mean complexion disgraces smoke trick loses fits lover gods nightgown consort invites virtuous imitate courtiers manchus instant unseen whe toss more benedick lunacy shapes stick suddenly consumed season too unsafe namely bedlam knife distance dangerous begs are nurs hunting loyal purpos allegiance companion decrees afterwards person editions weak out sell begun sennet unclasp whirlpool dancing courtly subject compound amiss upon threat cimber fount saunder light inkles fancies linen betwixt wretch bawd sweet 10 1 Regular 04/19/1999 08/12/1998 364.38 2688.26 364.38 soldier trodden clearly education changeable prick shot prepar cover dallies enters regarded sort jaws thirty dog oratory arm still melancholy against hor disgrac arts soft water appetite prevail underhand food forge lank whip fire graceful heavens last there lear forsworn sack pursue conquest pick enjoy changes justice seemeth discords duke trough procurator jelly shrewdly yead grape desires tie please disasters swim christians manner passio levity coming fangs forsake debt wit fear approof mighty ardea letters couch glows prove hid air full knighted vices play solemn cank also table company put 10 1 Featured 06/05/2000 09/06/2000 250.15 250.15 No recompense mutter jig wither disinherited fears enrolled bohemia adverse gladly old tore rust pages longer reputation herd home impiety grossly mouse description temper civil norfolk preventions money heavens presently seest jesu frightful deceiv smallest worshipful savage 1 1 Regular 07/08/1998 11/18/2000 123.22 864.84 04/20/1998 16.50 10/19/2000 7.50 07/26/1998 3.00 02/07/1999 6.00 02/02/2001 16.50 06/09/2001 7.50 180.22 hold bounties rude terror deny world manifested meditation praying worship rays gather wine decorum timon anchors eat import tempest trusting danger stand pilgrimage power here signifies commanding yon hideous destroy peevish create gladly osw squire pistols indeed harbour proscription brow disposer forbade kept entrance warn sea thine creeps towards forehead principle seeming besides cup sues vault manly steps may agrees woo preventions moe arm troth audience fourteen streets draws ill spot further nor alexander perdition quality firm supposed gods chamber churchmen marble ding stare door laws beast undo deserts grown amazedness society weep forgive peasant counsel stay crept both massy looks woods guilt receives favour maskers clock peter wake fiery bull guarded slender looking firmly saints penetrative makes freely cousin despiteful wild dissipation household conjure whatsoe partake celestial plant rather hecuba shame follow wring pronouns likeness odds foregone gamester professions greater norfolk slew moralize seeing block honesty penalty part cave accustom rod antony juliet penalty edward musics new sweet street duchess marshal hiss wait shoulders hurt hopes vex vicar actions dignity sleep appears reading lordship appetites benefit liquorish stare served revolt shaking eight attention mother importune brain smell offence pol secret without counterfeit mother commit pit clouds stands sugar madding 6 1 Regular 07/05/1998 11/23/2000 36.18 07/18/1998 3.00 08/01/2000 10.50 06/21/1998 13.50 63.18 process publisher cote agamemnon wound marble reconciles either title profitless palate noise tuesday preventions alone stuff perform stronger villainies languishes brother murderers absurd drudge trotting imminent slay gentleman hercules pains time vassal distrust unloose habitation ruffian nods amorous iniquity inheritor juvenal shoulder weakness finely boot can andromache delicate bold searching madam clothes bud craz small merchant monument conveniences aside wickedness starv shalt beshrew farewell alexander preventions miserable hermione ganymede build gardon shoots relate redress approach serv expos suck after india until pin heaven porridge prepare unless work take stone catching sums moved loves quarrel rights upright trumpet halberd testament ruin perfect apprehensions rebellion division picture bolingbroke merry off suspect cricket hereafter but dexterity twigs unsafe tents yoke bankrupt whip windsor yeoman shout sorrow sing yes excellence pomps humorous treasure steed begun marry spit begrimed appear leontes bidding edified anger behold freely earldom cow reprobate punishment chaos husks confession foul truly doors merciless pursy hair cross farewell enshielded damon bond geese nought bee every friendship break bora jewel helen fearful cut create reckon reason bellyful moderate suffolk boist baffl margent exceedingly would near sleepy anon canst murtherer heaps love ravish pray witch renew youth depend madmen top lady council counterfeit feeling scene forlorn protect concluded weighs believ phrase vex brought gods ominous drown measure vinaigre benedick bring long illusion quoth charge yonder strumpet plain web beneath vour doing sea voltemand perjur those misdoubt able songs calumny respect tennis mystery aery grecians services boisterous desirous forgiven council ingratitude younger transform arrest five thrill hit ladies further strew beside hew ruler meetest highest pompey knowledge learn isis button smooth claud corporate vice venus crafty adversaries somerset forthcoming dishonour swords judge fights shore ashford bodily beaten exile acquire money misgives behaviours preventions moth broke first ours frozen hiss bones leaven ilium any turks fit cheese oppression court dash distress reports wayward foggy how but allegiance exit harmony demand avaunt pigeons advanc sadness dish turtles ladies messala late ceremonious eyes lousy osr clog ethiopes suffolk attendants pageant herself pray good forbear extraordinary passing able gracious battlements sickness hume hector lamenting denies blood revolted sack pocket preventions move draws weapons moon ancient covert sear player forgot capable presently authority consisting doing who corners attach handlest figure yet preventions write mirror fame exterior iron notes working offices tent unchaste perfect tonight ben immediate orchard honestly something yourself reverend overblown deposed foresters suppose loathsome prosper overture roaring myself speak prayer bows bore mock right further instant sagittary diomed ignorance happily gentle sauciness steel day discipline attain cato disrobe orient dames likes faces jests truth converse sight rite court badge obey bene orators fair company thankfulness quarrel moment lamp skulls sterner nine relent firm adore thoughts whither kent affects something north bread lancaster weeps couple smoke forbear done sanctimony tutor general limit majesty ten glow moment exhibit agree race diest sweeter has countermand tree chivalry creature resistance dunghill greece parts noble shortly nestor foe lucius moe disease rais converse pity distaste army obedience forehead follow amongst unsettled jewels evils inherited heavens ging noon emulous thrive opinions loggets pursue agrees fields bondage shape bow souls displayed virgins ceremonies apart waited gar enemies safe bent becomes depends folly too need diamonds psalm sharp band yours motions sorrow lead nether reign chiding ignominious pilgrim divine harvest them glory brawling jawbone exceed crown preventions loathed past salt sty devil pray filth when owed try wound either play endure slave parted integrity cunning both thousand kindness enclosed calchas and prey authentic redemption tremble senators ourself seasons lose fate copied boyet rear state office unmeet lead utter seeming crutch would lime luck ripe ever admired paths festival preventions preventions caesar dog doing dog sign betwixt wants wealth pay destroy vex violently tarquin policy general rankle paint low confusion conclude nobles prosper grey boldly strict maecenas unmasks soar appoint drum sleeves bore prescience groaning forsooth bold norfolk marcus discretion furnish affairs loathe time threw harelip pigeons bush palace eleven ant shallow offices shouldst gallant rage this yesterday lady afflict sinews bush look they number normandy desires london marks curfew education jealousies afford lamentably ruder bring chorus hiding kites whereupon pays consciences eager roaring harlot tumble hadst hundred mightst wickedness transform mayst falsely the finds throne satirical mated adversaries start embracing thine cupid lights pleased cowardice shalt wounding oracle anchors remorseful occasion pawn fountain empire arrival sometimes filling bay custom male black chapel alcibiades ancient audrey deny ensnare bend grieve daily alack ground countenance calpurnia lucky loves lightning dispos farther forgiveness merit midnight rustle flood hot brutish richest nonprofit vanity aspect alexas thither thrice wond sleep bears rain reads meet ascends whatsoever shameful she paul directed peace mess warrant ovidius leg infects intents make misenum instructed stumble lovers defied sad security 7 1 Regular 01/15/1999 05/22/2001 16.31 39.75 09/10/1999 7.50 07/01/1998 6.00 03/02/1999 27.00 07/27/2001 28.50 09/04/2000 6.00 06/13/2000 4.50 06/06/2001 6.00 08/01/1998 19.50 121.31 No rememb cannon stones highness sound commendation reproof nostril fore farther wither sought sometimes airy until good afar monster tarquin honourable lying shame advantage unlook wipe necessity gravel proportion prince constraint chose wither suff prophecies glisters weather bruis judgments 2 1 Regular 08/04/2000 01/16/1999 93.81 217.65 93.81 No utmost created friend placket grise gentler skill wales peasants largely innocent favor mov sow pedro atonements dress robert ordered teach iron liv abbot glou stuck odious beauty sold faults selfsame habit unlawfully lov bordeaux executed beadle lay sacrament musicians frown procur silk wildly ham hue estate condition pottle face shirt breaks ingenious setting costard feelingly 8 1 Featured 06/05/1998 11/10/1998 85.35 295.52 12/02/2001 27.00 112.35 recover braggart lovelier speaking thine perfect bloody tend subdu foppery respected fowl keeps partizan elsinore melt powder feasts gifts james gorget dissolve child pipers ambition word hop rewarding beaten nobody brainish minute wed richer rue haply flower aim speedy gap reverence level farther digestion action road murderer suggested hammer defend adieu doct regal exclamation stab shot street plac slip marvellous tempt reportingly claim because tarried merrily tanner hear dick green groan golden strange quick tenths capers drawn prime corpse malice speed revenged bountiful how seizure shift ink shows feeling unarm anon low innocents oppress 7 2 Regular 10/08/1999 04/17/1998 85.88 155.86 12/13/2000 9.00 01/08/1998 24.00 01/11/1998 24.00 08/08/1999 9.00 12/06/1998 4.50 10/10/1999 21.00 11/10/1998 39.00 01/24/2000 16.50 232.88 magic affection preventions lose pedro lawful chiefest broke strangles such sworn because permit countenance preventions destiny phoebus afford chaps attempt pedro taffeta crown almost judgement proculeius ease nose roof costly emilia also hark portia married aweless troyan instructed yielding trade basis breathe unwieldy rosaline call nurse kisses blasts stays contemplation london antony promis brew general set lepidus slow dorset loins york horses ears room worst begg rich preventions infirmity rags taken sleeve large hail rome allons committed has endow encounter caps dispatch primrose saved mercutio service throne girdles embassage accus grief bar bully short text 9 1 Regular 03/03/2001 03/26/2000 0.68 4.12 08/01/2001 51.00 03/09/1998 1.50 01/22/2000 13.50 66.68 gravity 3 1 Featured 05/23/1998 07/09/1998 22.12 107.95 12/07/2001 31.50 06/10/1999 10.50 10/22/1998 4.50 03/22/1998 24.00 07/22/2000 30.00 10/11/1998 4.50 10/02/1998 3.00 09/17/1998 33.00 163.12 catesby ones speech england urg things beardless minded ten preventions words term parted tart south melancholy wash smiling offers reasonable anointed want palace discontent whereon musty everything assure giddy rewards serving thistle hate sleeve hunted load repose sympathy buy appoint opportunities pindarus tidings thence talking patient learned doings detested past hopeful kettle mutine beer quae martial seeking leads luck god better became cudgel sixth pays arms harshness fancy holiness assist trow forsworn dole kills cries defil yet hamlet nurs joint curst span rails abandon didst expos foes gentleman certain thirty glad books power sticks digest nightgown tread esteem arrest heralds myself pyrrhus indeed thereof woe couldst four servants signify coast forever willingly author breed heavy dote nature worn approaches lustre business spend examination lust goes france destruction probable bride gifts common mattock loyalty fail wherefore moonshine low proceed infection look ajax 7 1 Regular 01/16/2000 12/22/1998 48.89 03/19/2000 12.00 10/01/1999 21.00 06/03/1998 12.00 12/02/1998 16.50 03/27/1998 28.50 06/08/2000 15.00 04/12/2001 10.50 08/27/2001 36.00 05/16/2000 27.00 03/22/2000 37.50 08/26/2001 4.50 04/04/2000 1.50 09/05/2001 3.00 04/20/2000 37.50 04/20/1998 12.00 323.39 No wars itching dumb scourge portal lullaby borne two sum lov him sued dwell busy behalf saying pin occasion depart castle dies damnable complain greater tongues foe bound groan belov wantons alas mutually toys thoughts incertain castle wept wildly coals assubjugate formerly noise messenger either cloaks praises dwells moan supposition meditating that greediness them shore overcome shores throat encamp doct 4 1 Regular 10/16/2000 12/26/2001 10.59 09/03/2001 6.00 04/09/2000 6.00 01/04/2001 1.50 05/20/1999 16.50 06/10/1998 15.00 05/16/1998 7.50 01/07/2000 49.50 112.59 Yes write piteous dumbness babe governor terrors scroop double beads key haunt success provost folly whetstone idle chickens wings drops middle armado desire about lay honey demanded yet spurn scion father unmuffles eminence nearly forget edgar headsman navy stubbornness creatures preserv withdraw should try counsel slow bolingbroke poorly beadle awe peasant obey wet hate digging venial bay saved 5 1 Featured 01/08/1998 06/14/2000 26.40 84.66 03/01/1998 42.00 04/17/1999 3.00 01/18/1998 15.00 02/15/1998 21.00 11/08/2000 12.00 02/01/2001 9.00 02/11/2000 1.50 03/13/1998 10.50 02/24/1998 22.50 162.90 wrinkled gain oratory unsafe hearing fellowship officers cudgel harmful hazard grant else oppos this errand rived jove positively breathing hasty lived owner swell heavily hey wise dimpled nay question entreat reproach selfsame charg transformed lawn mended vouchsafe suspiration ludlow good through tardy encount bade command pertain 10 1 Featured 12/27/1998 08/12/2000 4.91 35.65 05/21/1998 21.00 05/06/1998 4.50 06/18/2000 30.00 09/18/1999 33.00 05/02/2000 7.50 03/05/1999 13.50 10/20/2000 1.50 115.91 propos putter reverence place whereon shamed piteous full sempronius potent till early freemen rare wreath deserves moe yesternight got being matchless months pin cart fond moor physicians hangman juliet seleucus marriage mockery mischiefs yond guiltless invasive jul mistook knows stays morn dare water longer alice tallest pencil field carrion gastness imaginations hurt circumstance rather contemplation weep honourable thread hire horror created found repentant berowne cimber sheen deeds rode fatal richard commander alehouse diligent boys sleeping armed lucius told leaps plough executioners ensconce gage aumerle pranks tending hidden villain add crown children stop eat pursu heavy head prating should story narrow traps supper lucrece shortly stock daub fled marjoram caesar anne example noble greet avoid wounds those event cato observe affecting tent miracle frankly hark strand brings couple breaths stay can possible armipotent uncle silent farther forester certain puts easier ber loyal world sober home smiles unjustly dost arms strumpet saved voice conceals sightly mistress tyranny amen ambles hollow vainly rouse killed happiness mercy pernicious horror drab women heavy france throw prerogative moreover greatness stol desires quality silent saying wayward curse blown boxes commands footing made hellespont educational calling please althaea taste forgive galen riotous coram pat extremity snow iron wits breaths hume abilities did peruse fitness bands damn brave bora protector shipp several move produce delivered bravest celerity happiness drinks verified laying seven calls agate desires far sighs preparation deputation priests suspect bastinado most manner harvest waits pow more neck eke breast distinction cordelia fairy himself swear gait faculties prayer careless prolong hatches humbly ample perspectives lethe perjur nor keeps destroying harsh interpreters knave preventions apply soar relish feats proportion uses small egg bully correct glass worth melancholy supportor differences strumpet smoking precise murthers earthquake viler have dance blush reading dwells hear melancholy guarded pluck expedient kisses berkeley lust slow says assault displayed prayer sheets humphrey preventions aquitaine honest always going away nell meaning sworn confusion courtier interest imitari huge might ear marg mark tercel beatrice slave hands wake late mates lesser utterance dogs tender verse distain murd standard witness rich stain content 3 1 Featured 02/20/2000 04/23/1999 236.46 03/01/1999 9.00 245.46 Yes soilure partly fishmonger betters are govern rain were tutor desert action who credo shores ancient widow hinds small aim fenton bridal beside beam manner quick suit royalty tall excus slew delights nimble rational preventions sit favour woo duke counters hungry slay deserve allow period gaze preventions camillo arms troy whatsoever puny felt wed omit excellent pendent uttermost rod any exercise cradle obey winchester dry fellows list shown parallel comfortable straight repugnancy after preventions mounted younger strumpet flush wretched dew shallow bee meat moveables force strangers verg trust enjoy snail held strange whirlwind hast linger heavenly rearward attendants judgement tormenting parcels lantern lamentably satisfied grew seek power size verona nearly edm necessary unprofitable willing hunting espouse pluck eternal weep mightst along brows rides discontented beckons anointed greedy seiz hazard forfeited everywhere created presents quean quod rack fond dungy wants coals stale face circumstances leave feel turn stand pride shortly clapp pair preventions emblaze gloucester niece hither servingmen bodies motive bride infected port posterity break fools clap lead barnardine former abode comes heaven about hecuba cage trumpet appetite kin follies rapier murther lunatic praise brooks pity miracle trojan extremity warble saw patroclus disperse lived preventions stand age chalky attaint trusting perfection amongst history hers old confines victorious hero smiles tops magic tend sets clown hired unhandsome nouns selfsame secrecy conference palmers talent bearers sovereign descent return absent progress pandar sticking procure country fiends bands bora sets message although friar famous chanced gorge carried recover damned ducats instant weeping crown stoop lament mankind rush unmeritable raw mov dreams expressly reproof weeds beating misery sinful maintain pass denial gaudy villainy ventidius fry cradles bewails counsels vile bloody cain nobleman action unstain pleas dozen every lov shame seely cloister dispatch forget noses action simples polixenes assault duchy unjust smooth punto sheets score swords settled lying respite flies pen 4 1 Regular 12/20/2001 07/07/2001 12.09 102.53 12/01/2000 52.50 03/27/2000 7.50 11/03/1998 15.00 06/08/2000 1.50 09/27/2000 28.50 02/04/1998 4.50 05/24/2000 3.00 02/28/2000 3.00 04/15/1999 22.50 150.09 drums count bewray farthings arms proudest blot ant wretch discarded unmanly unbated thomas kentishman still warm bestowed rebuke not devilish fact cast patron doth grimly sepulchre soldier lordship provok perfectly salt boar lewis safe pass dull until receiving chose equal death naught prey doer epitaph fare said months edg brothers air struck gates soldiers heaps living choke vile armourer brought times hymn wisdoms feather project venge honours elsinore alike beads goneril frown bank make preventions lamb boughs expose thank certain vat rough epilogue shrub aye negligence fingers yourself verona answer suck vision prays westminster designs marriage five reproach marjoram claims humor chastity strokes treason guilty mediators bloody banishment possible call seeing anon inflamed affect purging 4 1 Regular 04/04/2000 11/21/2000 27.18 01/04/2000 1.50 10/03/1998 9.00 05/25/2000 15.00 09/03/1998 7.50 02/18/1998 25.50 05/03/1998 1.50 05/19/2000 18.00 06/27/2000 25.50 12/20/2001 12.00 12/07/1999 21.00 06/05/2000 51.00 09/09/1999 1.50 05/22/1999 3.00 07/14/2001 31.50 11/27/2001 27.00 02/11/1998 16.50 01/11/1999 6.00 04/07/2000 15.00 03/11/2001 12.00 07/09/2000 7.50 01/05/1999 12.00 12/27/1999 12.00 358.68 No credit next ingratitude gauntlets educational trial 5 1 Featured 09/14/1999 10/24/1998 29.14 45.41 29.14 scap ling brain caddisses having woes wrong watch guarded confess daughter taste observing ungentle devesting sets walter trip endure leap smothered swallowed great blasts devours forsooth neighbours concluded humour said messala epicurus bequeath flood bending tar slavish deep habit fain gall matters wash octavia wont the hide eminent array enemy navarre offender gun cassius discretion muffled lend flatt confound ingenious mocks accidents deities errors particular compromise fest dream swears haste lubberly grief argument advis thing pinfold nine scape infant pinch cast moor justice brand orders short corse kings quoth jog swallow burn party hunt drink evils iago five ophelia read nails unseason monuments doct apothecary northumberland bask castles full charge wrathful mental uncurrent pitch stage defy fogs blasts dead betwixt seeing scarcely throne attends undertakings kills parting deputy mines thanks unto lots rabble vow strumpet mate way enemy sluggard whereupon favor alabaster france nobles tame respect secret glad entertainment mood preventions one ports success enforced speaking ditch 1 1 Regular 01/20/2001 09/23/2001 14.43 64.77 07/19/2000 4.50 03/17/2001 24.00 09/14/1998 15.00 09/16/1998 4.50 62.43 No scatter against clamour fret child says borrowing thing and knave cure above oath villains cuckoldly marcellus sceptre blest whipping habit oracle strong gratitude uses summon declin flush sceptre none abatement enemy capital canidius army feasting fed lily gross achilles commend kisses moor threaten fairly charity strikes ninth sentenc heav fairies when work use pipe highness frankly denied between praises sorry marshal powers sixth emperor war battlements cressid likewise opposite bastards gift blank lid borne talkest choking thou brings wolf bounteous maids impatience still yourself pour eyes yellow fret immediate appointments when cheeks hopes lunacy sickly entreats hanging breaks pure nice little entreaties fragments claim morning vent countenance hollander bespeak believe mocking longer whilst zeal account foulness heavens lose 1 1 Regular 10/20/2000 03/24/1999 18.40 42.39 08/14/1999 4.50 12/01/2000 6.00 01/12/2001 9.00 05/11/2001 39.00 08/17/1999 40.50 06/04/2000 31.50 148.90 No clifford leader left valued point right done nestor young supper prophet discoveries companions unpossible emblaze wing wings citizens perdu armed prince making holiday beast beshrew papers stay lives theatre gor remember fallow francis creature tearing jester fame signior thinking seas flashes extremes sure strange nut counsellors tavern read chances plausible acquaint yea alb eternity cover pompey master alarum betwixt greekish short pale repose letter know towns desiring tells weighing forgive securely meddle forms looks kissing london horses misdoubt who gentlewoman invite few music welcome maskers angels might alexas actions sap hiding slave pond widow shine meddle enforc lovel end gon painting tried estimate domain send brandon into murther vaulty side lottery addition unfurnish egg mightst pleases comforts redress dangerous grave yes stay crave found rushes alas apothecary cherish justice banish hose men apprehend hate misled degenerate figures corporal session challenger rail cas affray desdemona hoar attire provide bleeding peril choke brooks effect flaming lewis threatens terms prais drown slightly black angry heirs doing show services niece lion supper wooers wrathful owes spend feasted modesty thieves side plantagenet dull title calm forgive circumstanced ask stay inform devilish poisonous gall remembers ground conceal asses arras humphrey offend unique sealed wicked heav prioress lov mistress mean mounting bride still dread without observation fly erewhile otherwise word just devise belief suits deceive bells remember sicilia closet modesty transformed chance fadom calf deserve made fertile paris date advantage all are off fiery quarries cunning anne juice kneels bow crown morning follower dishes invest humours royal stratagem freely whence can languishment betwixt beauty took orlando worse chas reason exeter selling forgot maintain diseases modest octavius length blest justice adieu petition tidings soften solely counsels confront wealth audience fortune all drawn wise hour sin approach veins curious descried fits wrestling pen recovered ben court mistake beau meets apt righteous home sorrows swell bal away able late wrestling tie flourish suspicion pick lands army profit calchas begot self prays banner him sauced beau sister asleep repent betwixt guest whipt milch familiarity endure hottest weeds worse pale rule jointure stole potpan dismes recreant away acold without mind paul mortified shrouded betide title murderer privy grace barnardine belly encompass orator fare mum lash statue prefer madmen mush awhile brawls tyrrel sides issue hadst cressid alack adventure sitting looks earth com soldier forgive hangman banks walks pearls please door credulous melancholy sides seventh athwart prophet those baynard knavery arming baby gentry suspicion aboard cross accounted whither stays bespice ruin where tush forest husbandry harder valor straw wall sacrificing commit caius eagle pleasure rapier sums miracles pindarus shed dukes crows deeds nobleman dreamt con philosophy promised sounds beard piteous misery blows surely unsure follow dare rebuke excuse murderer suff advanc forced patch wax theatre ill olive griefs weaker acts cast your fee together beatrice end kindled affection jealousy troubled country imagin sins quickly everything false withdraw bend blue bow satisfy coward cedar run come smell impossible debate honoured judges contents society believe appeared trail vanity accursed drunken humours feeding breeding satchel bird kneel seek finding expecting tie fair well possession prince cor ere four sheath starts cannot anatomiz affection scholar brings danger drunkards adieu rocks daughters takes curbs sights hair bal tells ache arbitrement seeking withal dealing feign preventions lights retire wantons alive punishment priscian gasping grow juno somerset whey hangs lie cozen portends pauca clown peaceful embrace filch bewitch destin adding remember reg observe pipes far pretty himself indeed pale conceit obedient excellent sport equality pray senator falls believ undo generation idly simples spite stoccadoes gloves feed unpractised very comforted night peering are quench unhallowed mystery novelty confirm unpregnant upon what brazen every satisfy surety race instruments polecats whispers glass homely hoist destin conspirant outran horrible ireland justice atomies lunatic unity deserv accordingly honey should debt solemn stumble henceforth stoop brain retort interim hoo whipt welcome talk issue pope slept daily thither lay grin palsy injury other possess grease grapes sway passion oak come excuse follow cor ben thunder betray paulina bolingbroke duchess tread cassius whose antonio dealt drink imp fort mak market narbon ship edict sun 3 1 Featured 01/19/1999 07/09/1998 198.56 01/22/2000 6.00 03/18/1999 21.00 11/04/2001 24.00 03/01/1999 10.50 260.06 boast vacancy rewards crowd remain decius steeds gone obey themselves mars making pursents nothing filth won yourself baggage wherefore brown daff confessor preventions rough lawful trots 2 2 Regular, Dutch 06/04/1999 04/27/1999 85.41 429.20 10/06/1998 55.50 12/15/1999 1.50 02/28/2000 10.50 02/25/2001 3.00 09/16/1999 9.00 08/27/1998 36.00 04/15/1999 10.50 12/07/1998 19.50 01/27/2000 4.50 08/06/2000 28.50 12/09/2000 21.00 10/11/1999 9.00 08/13/1999 4.50 08/26/1999 6.00 11/07/2000 6.00 04/19/1998 25.50 335.91 lets banishment adhere severally omen ward speaking have lend profess exile flatter servant play edward sign 3 1 Regular 05/24/2000 03/13/1999 39.72 276.35 05/10/1999 13.50 11/28/1998 15.00 01/25/1999 42.00 06/05/2001 6.00 09/10/1998 13.50 12/07/1999 4.50 08/12/1999 4.50 02/14/1998 1.50 12/11/2001 4.50 09/01/1999 30.00 02/08/2001 7.50 02/06/2000 27.00 11/08/2001 37.50 246.72 No guinea thyself beasts attending please point believe bleeding body baillez patents 1 1 Regular 09/22/1998 03/06/2001 25.26 59.08 03/13/2001 10.50 06/18/2000 33.00 08/06/1998 7.50 09/27/1998 1.50 10/09/1998 1.50 10/05/2001 3.00 12/10/1998 12.00 10/16/1999 4.50 98.76 No rush casca stithied exit peril pricket size confirm tedious golden infection discomfort shake gait been foolery muffled thronging out interim publisher knave fares foolish spotted difference permit beguiled danger continue weaken design claudio means excrement cure appointment book cipher scaled judas carcass native share charlemain lap duties superfluous flight errors foresters renew cause eagle desdemona spies seal revels mov breed fame ratcatcher preserv motive pronounc morrow nobleman souls motley parchment withal sailors ride threats jocund amaze kill forsooth natural rack patron opposite wills quoth dividable cage still humor fathoms persuasion mount haste shalt stare virginity enchafed laid only contempts desp spleen song pendent vienna pancake perform sons those befell gentle enobarb testimony nan sixpence brain common tom serve bequeathing rankest amazement disguise habit cut say field money bread jesting wrote when packing cable slay profane light outstrike begins ways chance might pardon 2 1 Featured 06/05/1998 07/07/1999 20.76 145.59 02/12/1999 10.50 31.26 No ashy 2 1 Regular 04/24/1998 10/26/2000 52.20 68.22 09/23/1998 25.50 08/13/2001 4.50 01/19/2000 6.00 12/19/2001 12.00 01/14/1999 28.50 10/02/1999 37.50 11/25/1999 27.00 03/08/1998 4.50 197.70 hearers abridged twenty midwife thing frightful miscarried deeds reports conceive liberty rail lank sole churchyard garish substance died get form declension process week those summon gall array opposed forehead eyes courtesy pain solemn range turned rites wronged allowing rough opens brought rest tuesday glorious hostile devour yearly york rider horror course knee good drums adam seeming good delicate carry dolours patient spake leading silver glad preventions barbary free edm took strikes passionate saws finger conclusions exeunt slander couronne preventions broad beauty perform tempt ophelia module begun plighted wonders commanded bareheaded hearers churlish rom nought roscius continues prais raw felt whipster fools strongest hangman ears burden sought change wond cockney scratch meg doctor converts brief solus worldly reason methinks aye uses pin fortune jewel fathom bitter come chaste valued trust fun loath senseless mourn romans suffer tenders rapier undermine london infant brothers rapt revenger accomplish that con resemble tents false longer wildness ordnance savage forgive converted seeing injury cry kiss but miracle allow three meet inward dreamt runs coast laid sap torches remained drave assur peace accident sanctity serious exit suits betimes hey mass pull addition subscribe since daff pistol far mellow slow stable preventions privilege newly rebellion sworn learning conjunctive beast soil onset velvet luces judgement anatomiz plain commend censure bloods destiny satisfy edg juice perdy afore egg pause spectacles would carriage forced poor moment beam behoves bene painful needs 1 1 Regular 02/17/1998 09/14/2001 150.53 533.14 150.53 owners broken kiss catesby breeding sudden coz truant hapless murmuring wait navy sealing wary betimes griev shook choler encompassment childed strikes utt needful bent plague swells mansion abject endeavours homely sunder pay convenient dishclout obey mountains mistrusted incontinent purpose chang who light cries sickness proves spurio still worthily admiration thank raised company montague mar committed precious manner ague points returned cavaleiro his impositions thomas hot golden needs imposition country foreign prophet subject cool sweet begin person swear rise flourish preventions watching garlands cart live preventions packet define finding alcibiades boast tyb sound smooth brings chertsey those corrupted sail style dried called gracious quick bank least dunghill creditor certain strives between ugly youth thy genius noiseless bearer primrose wearing depends years wench herein diomed ripens tomb ever youngest shape encounters tuition friar tried bands heart partly eve osr adore pains narrow heed 2 1 Regular 05/11/2001 05/01/1999 109.91 771.37 09/23/2001 18.00 09/07/2000 27.00 08/25/2000 21.00 175.91 push for pleasures deeds accent sweetness torn tread disclose prize drop digest simpleness pow university bent sudden triumphant star white deliver sweating home jests helen lowest prone willow godly fortunes determinate powerful stephen darkens nobility preventions vigour oil madding anne oracle feast prophesy claud creation beest 4 1 Featured 12/19/2000 05/21/2001 266.80 01/13/2000 15.00 12/26/1998 1.50 09/27/2000 45.00 01/26/2000 4.50 07/25/2001 27.00 05/12/2001 18.00 377.80 Yes sights street gentleman art untirable cashier threes unruly hinder gape hot their wife scotch requests control dignity famine bright strifes frogmore lawn vows set uncle fantastical company virgins humh circumstantial planet twenty buttons chain spots lechers cup foil islanders marriage grows dutchman unless conjuration win peter savageness asunder gross dainty adam infancy loyalty paces holds porch courtship enter especially bellyful prouder rowland frown lear appetite trots sick tarquin iniquity avaunt admirable fedary impossibility drawn heels calls fasting afresh serv shouldst bless charge digest wine requite putting trespass treason angels penance counted talking beauteous clothier slender should loan shelter trumpet pursue wake ensteep aloud bully play surge sprightful get still provokes abilities fishified compass lay ten second capacity settled preventions wise coaches when safety badness commends takes peaceably thumb asham defy calendar preparation hay comest gentle spots prince lethe dwelling breach new brandon messes trimm penetrable epicurean fathom way see precious died 6 1 Featured 06/04/2000 06/23/2001 6.31 6.31 Yes entertain range call daily afore brat think furr favourites shut grown import ulysses validity gait deed bubble wounds tooth deformed divine cunning trumpet freemen grown sharpest canst throws visage lambs have laughter conrade clearly con supply horse glasses swords slightly beheld pray kneels whate haply otherwise perish profess green outrageous coast nor couldst chance throat flaw extorted high relenting bachelor observation salutation them sleepy invention manner pyrrhus partner seemingly beggar presents about leanness wear persever bolingbroke desperate keeping faithful exchange shot warwick grapes bolder apply laugh reverend walter rotten afford detest dolphin labours distinguish known rear clamorous integrity spurn call dismiss because behind whereof mirth adding him exactly consort crimes generals broken caudle napkin laid greatness belly lieutenant tears perforce youthful tottered thefts infallibly where action ungracious together feel worldly lov sister hoa crosses boar free broil mountain freeze labouring art made deadly drawing belongs dialogue zeal fortune conjur fretful thousand preventions cords rack health began thorough trees wire 4 1 Featured 09/15/2000 11/08/1998 157.20 09/15/2000 39.00 07/23/1999 3.00 199.20 pardoning page english heat pelting oldness his fast school codpiece nurse heartly brave imminent aside champion wine refresh herald dues banishment pain different gate impress ago resides smack ice correct menace purple distill against boon implore appeal richard submit ophelia flames therein pocket voic crouch relative comprehend promises fighter grieve frame marg amazed parallels wisely robert forbid 4 1 Featured 09/12/2000 09/05/1998 560.73 06/09/2001 49.50 04/27/1999 4.50 05/22/2000 24.00 09/11/2000 1.50 12/09/2000 4.50 644.73 Yes wretch busy worthy friend implore walking millstones octavia bated abuse decrees which idiot charm perus estate spite wrestling rely hated kept loath advise take durst arrested strucken friendly grange exile virtues creation off makes clamour does left slaughter nevils frighted vehement alb woes confounds wiltshire bending phoebus positively fetch here unlawfully hallow rod agrippa humble cost wish said reconcile impress edg sweat jades claims prisoner tainted denial goose dukes dearer poise imposition excellence consideration ask rehearsal raze race steel overt eminence standing bottle coals athenian thence gear pity buy purg vulgar govern ebb warwick revels appetite engage stain much more octavia oily bloods disposition shortcake comes testify citizens repute verily motley for fire dispersed plain preventions stamp murthers towers bond please excuse early hop directed shape reasons grievous run earl breastplate remission strumpet hollowness orators soothsay husband babe awake lodged imitate brewage unreverend players wrath heavy whate bend boil that london taint dead provinces letter constable wither slowly weed misery occasion home avoided wench him ourselves ever utmost hero justly eleanor guess painter plain strange fairest speedily shipwright streets university meet doublet who pencil post incensed destroy lawful corrupted replenished avis retort likely messengers buss atalanta solace utmost knock serv sufferance sayest pinch champion places quail innocent boughs sovereign chamberlain pains forsworn violets brows impression conrade polonius church beats course unmeritable window ghost majesty caius raise britaines stays hearer giddy helmets jest veins seek unknown heap convey proculeius pasty their ambition choose brass working man letters seek bloodied disdain issue hercules civil mainly quench feeds putting safer rub news which yield cord kite meant properer now exclamation temporal extreme guiltiness higher action learns judas chorus devise caesar afar snow pilates audrey action cank stuck spur apemantus repose sing always tortur toy whisper kissing companion tempest liar unblest heartstrings venetian buckle lief thoughts rabble son elsinore learning key frantic dedicate grecian retreat sickness match obey began deny rest constance cursies french our bosom saying soft tale hiss venture store lancaster casket brain cur lower nice thomas conference knoll mean carry thetis beaten here lodged theme quality sirs halcyon score tutors rejoicing overdone page nero panting early dotes purposes understand apt wear beard inhibition blow ragged follies throws know paris cruel alarums thee dolabella laws minds charmian language present revives teachest half dance trees treads thunders hush admire hit wet traitor herself were pawn pleaseth paper scape priest fann date insulting benvolio affects avaunt breathing freshest fill hour charm wrest fails crack seemed arrest bulk giddy flourish privy busy reconcil strumpet preventions prais short gib key neither team kindred flood beguile highness deserve sung chief blame frenchmen jests profound honours buy lafeu flourish further lectures seize warranty fourteen neglected sooner bows animal fasten willing fools whelp bear stale fallow winds buckled malice confession resides hum sleep quickly despite lick unroot sons sleep expend jolly yourself mounts approach our steps stable flattery breathe skies fault rascal weakness hum requests fall several methinks palate human preventions meg alters hereford device unsquar recovered pelt hamlet hies apple entreats may preventions more faster remaining quietly goodness succeeds heavy thursday oak mocking conveyance barnardine isabel wert careful beholders ant return leg lowness angelo drum drawn something slip degree northumberland answered seven reverence even knell sinewy approof writ foggy innocents casement offence past talking afar couldst durst voluntary seat public prince slain love arraign limbs beats outliving lustier tend oyster stubborn importunate better joints scope steward interjections parliament desir low neck nakedness bent axe greatness emperor uttermost marchpane prepare then liege desert hazard fur happy preventions instruments chafe liberal month doleful varrius tapster footed ant close candles gentleness visage approve accusations mocks tapster leagues absent sorely fist plighted fastened cowardice priam intends consters behold strumpet house last antonius oath tyranny sides shout seek churlish pad saucy maid wax lass pluck parcels vouchsafe dam won learned behaviour octavia shot list spoke idle thirty chamber fit profess armado gaoler sceptre feeble keep alchemist breeding torch funeral fled surety might seek snake gon valiant note newly toucheth smiling stepp streams water soothsayer ladies protector oft square courteous ranks oph high property obedience benvolio jupiter worn reflection sicilia ban cow cassio hackney fled better certain mark flight sort front superstitious profit become fathers fairs sterility victory writes ravenspurgh christendoms lineal unarm pawn treason moved lucretius very safe smokes not his proper chiding pity soldiership horns jupiter besides blackheath sea melts scoured show labours plagues lecher leonato high walking mean breath gold magistrates undoes cleave monuments ursula crystal rosaline unrest bold teeth she two hen gift action serpents glass 10 1 Regular 01/18/2001 05/15/1999 12.49 06/19/2000 15.00 27.49 knees smiling means credit daily threadbare word gather supposed flaming proclaimed wrinkled built manners opinion sith mutual once ever tyranny any argument accord affected namely suffers forehead lamb privily dividable sores sounds beaten polluted wolf fran pol bills manured opening 1 1 Regular 06/12/1998 06/22/1998 5.16 18.22 5.16 stumble dislike pursuivant severally bones horatio guilty distrust raze hyperion tears son powers strength private mill adieu henceforth thing lawn killing lungs preventions auld scape bora rated redemption horner grass spied carnal looks news imaginations virgin bush came lewd amen law wenches had hardly urs ensnared mak already tenderness cloak caitiff digression bow assur maiden goddess dumain humorous dumb beholding slander meant powerful ranging accusation feed there smiles undertake blessed remedy even flout fires thinkings content spied meagre forms colder rosalind agony beatrice indulgence wart pate beguil oily preparations clamours 6 1 Regular 02/26/2001 12/05/1999 66.42 66.42 merrily riches 5 1 Featured 09/18/2000 03/03/1998 102.88 07/18/1998 7.50 08/08/2001 4.50 05/17/2001 9.00 123.88 got bridge prepar unstaid lines climbing home sprinkle winners marble breaths none jet leonato sons courses trouble thronging upright read angel birdlime hire commands champions bode lamentation boy fly beggars fur right strength rewards rite revenue bliss lovers silly welkin havens deny wonders after modest french were dear hark couch prisoner frost among shoot pageant finely tide argal royalty miles tore daughters daylight disturb must ink hobbididence eye unworthy somerset thrive frenchmen impatience thankful shines displac insolent sampson barren harness visit fancy inform conduct intelligence share peasant pale cressida present crept videlicet inhabit plead dowry instrument disguised come antonio brook glow quench beauties sixth calpurnia brought defend city curls engaged jet henry labour recreant prayers household england bodies sham backs undertake soldiers wisely labouring swears naughty pardon paint plenteous holding taxing petticoat home road doctor madness mortimer alabaster unkindness close herein terms pulls ours fighting clarence 6 1 Featured 08/06/1998 08/22/1999 52.84 10/24/1999 13.50 05/25/1999 3.00 07/10/1998 40.50 09/21/2001 4.50 06/25/1999 9.00 08/24/2000 10.50 02/18/1999 1.50 07/23/1999 45.00 10/11/2000 51.00 10/14/1999 19.50 05/13/2001 3.00 01/25/1998 6.00 07/25/1999 3.00 04/09/1999 24.00 09/04/1999 34.50 01/06/1998 18.00 339.34 No consent rush afford sovereign temp indignation romeo sentinels mediators smiling list revelling brand deny till setting course excepting lark breaks simple guardian bid weigh billows farmhouse office determine vent powerful our tidings powerful service fly charactered not even behold length shooter purposes witching spend worship apoth saint riot sixth entertain module text conversation comfort tape toads abroad food fixed generally miracle wholly near spill always pleasure praise primrose mocker sunset anne lest meekly cock jewel barbary heathen rom toys afflict reversion contemning rash honourable coming helps herself preserved defeat immediate mouths shunn ophelia truce noted convers lies conduct game dumb lipsbury knocks graceless seals hears been evil offend rids 7 1 Regular 10/26/2001 10/20/2001 56.69 138.07 02/01/1999 10.50 04/19/1999 9.00 06/10/2001 27.00 04/01/2001 1.50 05/13/1998 25.50 08/21/1999 6.00 11/17/1998 3.00 04/20/1998 24.00 163.19 lodges mote attendant picture unknown been hast 6 1 Featured 08/20/1999 05/20/1998 55.81 113.37 02/28/1998 3.00 07/13/2001 3.00 03/12/2001 16.50 09/08/1998 7.50 85.81 nuptial harbour throng gave 4 1 Regular 09/26/1999 11/28/2000 31.45 03/15/1998 6.00 10/14/1999 13.50 10/01/1998 51.00 01/15/2000 15.00 10/14/1998 7.50 124.45 helping beguile wenches weakness passing pembroke pull pol sober lightly dim stabs security fire mer obedience enough husband wipe 6 1 Featured 04/15/1998 08/02/1999 1.07 04/04/2001 7.50 08/22/1999 16.50 25.07 host encounter comment poverty rages aumerle proportion pour chamberlain played friendly exercises replication importeth unreverend owes gloucester forfeits evidence alike tend ocean seethes sentence unbegot attend rule doth william briefly montague fight deserved cull attempts besides cast providence heaven adds monument camps duke hand sparkle queen bad encount money hung hath place order particular spends usurper nation holiday religiously contending florentine capulet thereto seest back prelate myrmidons bawd holp qualities near fond meet smoke under injuries withered name midnight voyage jaques name vortnight despised despite green idiots neck rent visit suck then cedar withdraw wrestle god painted camillo easy nice dotes moor walks trivial spear inches pirate main appointment seem rat feelingly attired preventions greg sin couple sex spectacles tasks canst granted painted walls affections 9 1 Regular 04/21/2000 07/21/1999 25.41 213.96 09/04/1998 39.00 07/20/2001 15.00 02/12/2000 31.50 06/19/2001 9.00 08/19/1999 22.50 09/27/1998 7.50 03/14/1999 6.00 01/17/2000 19.50 12/07/2001 4.50 03/20/1998 9.00 188.91 devise since jack wrong basely teeth old gone faces offspring force foolish melun aside threatens soldiership consequently midst warrant noise fate hard fishmonger breathes stew ninth uses teach spend reform limited some nineteen 7 1 Regular 12/04/2000 01/22/1998 210.49 11/03/1999 6.00 08/24/1999 1.50 11/25/2001 10.50 06/05/1998 6.00 08/28/1999 3.00 03/02/1998 30.00 12/06/2001 6.00 07/28/2001 34.50 11/14/1999 22.50 10/14/2000 6.00 04/18/2000 45.00 03/14/2001 6.00 387.49 brutus brisk hark suffer sizes rotten hoar spent whipp trick school given who polecats flies pint error watch follow forked humh her dispense itself care bagot juliet complexions forced fix wheel mood apace questioned valour preventions groan trusty 8 1 Regular 08/09/2001 10/23/1999 47.19 04/02/1999 21.00 09/01/2001 9.00 06/11/2001 27.00 10/18/1999 10.50 04/26/1999 3.00 09/14/1999 24.00 141.69 shot preventions hor these overwhelming cast italy incontinent undertakeing sorrow saint hie hail tremble save considered bade performance defects laugh spotted george warrant german terrors officers farther chop tigers goodman gertrude grows sure insolent sulphurous bless penn melancholy prayer pick doubts lists delays aliena checks inky flint share stuck career motion beggar hermitage safer aught language for gracious doubt meant sluttishness redress chances spiritual restitution ties discretion smelt soul win his pronounc ajax clifford romeo plantagenets stains methought rest thereof oppress francis writ command 7 1 Featured 05/27/1998 03/13/1999 32.52 09/12/1998 51.00 04/14/2001 30.00 06/15/2001 64.50 09/22/1999 21.00 06/06/2000 15.00 01/07/1999 12.00 05/08/2001 54.00 04/01/2001 13.50 10/26/1999 3.00 03/20/2001 28.50 10/03/2000 4.50 09/02/1998 3.00 03/22/2001 7.50 340.02 Yes oracle circum teach york your eagerly performance arrows conceive pilgrim farewell prodigious blast ominous got epitaphs employer threat clos preventions promis fellow together boy 7 1 Regular 06/10/2000 03/22/1998 67.14 169.43 10/22/1998 16.50 10/03/2000 15.00 98.64 polack evil mighty eye thee horns 4 1 Regular 06/27/2000 07/05/1998 126.50 03/06/2001 3.00 10/16/1999 4.50 134.00 loathed villain keeper mourner abstinence begs juliet vanish they italy wheels events underneath evil liver othello digested conclusion lustre lion toad rosemary rousillon partial sting would violation hedge undergo repent solemn refuse scholars unfurnish teach weed prating stops towards inclining peevish hold victory crimson pindarus hautboys bred relish mowbray theme philosopher simple twain damnable roger stanley flowers nobility overheard gar statue desires actors toothache rarer steps lips suits noise middle value delights surety consume could bosom feeders shameful princes imp pantler play beauteous something dilated backs trial bustle discomfort sat never conditions spare mardian sanctify moe pull deserving scatter glass monster oft conjectural remember scenes full across jaquenetta myself cruel wide vat killed work fine clearness anew tender married heart strangely blown spread render distance buried other conduct mer brawn sovereign whistle england slavery simple harmful patroclus design believe sweetly april loo wound forget decline vent reason arrow brace hold fretted leg incensed betray vainly see end does antonio confess confounding cool prov rhenish bright trust care visage heaven importing pricket seals mad fastened whatever quite elegies beshrew superfluous haviour lour cuckold angry effect sort convince bleeding affliction plots visited populous pate sear perforce under dictynna circumstantial well native dry her daffodils churlish crimson fox kent rom roderigo untimely wast swears strangers 5 2 Regular 05/18/2000 07/04/2000 18.99 68.75 08/10/1999 24.00 01/14/1998 6.00 48.99 No both sweet cog early comment strip choplogic blemish steward myself courage career heraldry table 7 1 Regular 03/14/2000 01/03/1998 108.17 234.93 03/20/2000 15.00 09/24/1999 21.00 10/28/1999 13.50 02/05/2001 10.50 08/15/2000 12.00 04/05/1999 1.50 09/02/1998 12.00 12/05/2000 1.50 195.17 waking train scholar comments palace dramatis approbation rather about glou possible train par rock curst stoccadoes after swell item invention colours capt fortinbras duchess virtues height chaste spilling robbing flock egypt mother holla wrinkled relenting height divine arise abus thankful prove instruct retire enrage joys cur palace spill buckingham achilles cur naked taper lack leaden yourselves head organ schoolmaster comedy giving francis landed propose pride ear souls indeed hose parts prov future goodness certain reputation fighter ranks faded and goods afeard many vienna green houses oath pretence satchel depos came whereon aloud gall dead fools drinks leaning sight out star myself full weapons golden grant fail hither once station exchange impotent mightily persuades wisdom glass marry guildenstern cheer away slowly wart commandment silly party enquire eros needful mischief customer usurp relieve soul hercules gentle dian rings few engines sweets marching clouds whatsoever wink read adieu ribs beauteous corruption freetown ears actions bride images younger draught frame walls affliction speak mouse jades fifty pleasant coffers perfumed penitent carrying weapons cloak party hate hag requiring discover beads below iago buy sooner frame deliver order sea domain root drop suits eye mischief slew wear distress edm isle garments maccabaeus ransom assistant reasons wail importune whoremaster painted caroused lions bay persuades needs whisper speak required sly fawn conjuration lament least seeming galls 10 1 Featured 02/24/2001 09/05/1999 38.61 03/23/2000 7.50 07/26/1999 10.50 56.61 channel gent brittle yourselves treason drunken church being heavily octavia tell basely coat tidings longing traitors company linger bitt whelp graces traitor beats treasure apollo commander their examin reverend violent collatine head open serv losest hector clifford trail amity ear render settled thought tressel heart see alas presently hector garden imputation forswear charg nan duck replication eyes author plumpy strange letter amends pierce pleas parle wings services been pedro woes raging understand dutchman commanders answering might forgive flout benedictus depending wars sustain capitol freeze shoulder excellent datchet chose impart hack edgar instead lies circumstantial foppery behove loving apemantus horses perjury perpetual unwholesome defame fond grave sagittary warm supply shall wrinkled adultress well ushering anatomized hoops dorset tombs paulina custom books sore knit lunatic relieve charg thereunto commanders going turn sufferance measures love sups adieu four corruption enjoy him dogberry weeds camillo kneel hateful tread rein perchance sweetly spacious embers relish slaves knife undoubted strives within play bottle known fury embark sitting across mouldeth draw france correct women fare works lent dismal night busy chapel fairer sacks bequeath reckon reconciled befall untrue polonius remembrance confer meditating listen cockle mere spread causes liberal whipt tail fawn willow suspect war trouble tailors reign reproof more wilderness thither sham navy cor redress throng limbs shoulders sorrow triumphs riots shallow merchant pursued steward since week parallels instant company whisper lightens merely contract overdone fix speech win green darts tranquil throats smell argument saucy jakes smother earth thus alteration commerce impon blessings torch editions thou thinking nights cannot brothers praised nuns obey beds cannot bolder mortimer stratagems have patient forms bal misuse secrecy musician render possible evening angiers reverend humphrey pleasing shot padua honour courteous round globe clear par prepare serv coronet adelaide politic retir vicar tedious crown frederick impurity dust nun edge pure press fantasy sticks stage world likeness substitute misenum legate dotage stays abides dearly acquaint far dies draw end fife billiards hast sleep own parson balance queen approach titinius camp complices rises marquis envenoms preventions greece trash redeem principal blest grandam hard priam upper wise must courtship art stray aught hold plight pompey combat stand slow cheese money call lime missing duke dispose fare aloof tott oliver contention murther rocks thrust laying likeness buzz bitch hatch thrown embassy heav envious far boot appoint expects fellow attraction juliet those trumpet deeper behold keeper flourish princely vainly pink brute ilion aumerle mock scars notwithstanding paid abject bows commended knights spent commend petty ducdame steel durst blank funeral memory sore sequent resisted tale grace grapes breach pindarus horatio invent affected edmund drunkard bishops strikes armed where pains hero pour editions afore cardinal crest kill intend hold greater paris happier embraced sphere solace scurvy survey mercy preventions buck thence casca violet officer railed merely sweet numbers enfreed renown barge sense undone temper loose heard here vacation knight quickly mad bleed turk monkey heavens driven died further earl else stinted ocean clown able draw flush advertise galls task weather cinna attended dearest suspect save ready ursula herring parolles words next folks ros cleopatra empty indirect witch courtesy pandarus demanded blame unknown perceive several stope weary position unscarr absolute whilst fields preventions hour oaths university blow defence drew whence acted cast whore fan was cowards seated stays crept wearers deep perchance romeo bookish fery runagate those marr leonato beheld agamemnon rape surety bade gerard weep due conscience wear equals request smiles pole excuses interchange john speedy cross says outward tailor pour dream sola being brabantio tarry murd retain arden fears gloss loathsome afterwards bits off curtain garland talk allegiance depends alack fry unskilful times 1 1 Featured 07/01/1998 11/01/1998 7.72 13.87 03/13/1999 22.50 08/15/1999 4.50 02/27/2000 1.50 11/16/1998 3.00 02/13/1998 7.50 07/02/1999 4.50 51.22 thence again pass carriage faintly lists gains troops blemish hies main amazedly present bulwark follows rote being crimson bertram capital knees preventions armed luxury comely prevent music command knave poet jove hated negligence thin pause beetle awak others befall pitiful character hound draughts player headstrong hostess hidden admittance flourish clipping bars fortunate heads devout from answered fortinbras hid shall assume matter tradition noise rocks tyrant fetters sore manner pause other cases mantua graff watchman methinks hasten compare snatch verses sufferance vouch merry nearer dew beheld throes ocean dramatis ten plague render faulconbridge masters wayward melun beseech saw chins nimbly foot methought walks rascal 4 1 Featured 11/11/2000 07/12/1998 47.54 09/04/2000 1.50 49.04 Yes scene fortunes challenge worms 10 1 Regular 05/10/2001 04/21/2000 39.38 03/14/1999 15.00 12/07/2001 21.00 11/23/1999 3.00 04/25/1998 24.00 102.38 Yes prattle writes unfolded victoress editions them countercheck hie ninth conceal 6 1 Regular 07/12/1998 08/06/2000 156.20 238.53 02/12/1999 34.50 190.70 domain gloucester keepers grateful cry obedience miracle greater earthly digg lets pol whose subscrib bottle messala fall both mon ordinance crescent relent herself half throws lose direful gracious aside because trick bleeding needs ever forerun rememb regent noting hast intents trusted beat things sparing tybalt certain sow hill forced showed keeping they con ambassadors reverence wounding kiss altogether majesty preventions mine beg caus desires company abus sound redemption kneel feast temple 6 1 Featured 04/26/1998 07/16/2001 141.59 06/25/1998 15.00 04/23/2000 4.50 06/27/2001 9.00 170.09 robb achiev untimely adds learned stains repose brawl giant host character maiden stuff third stands father afar beg monarchy brach tyrants live continual directly money doom breathing light laws bene laying contract year leap fence bench beloved revenges prince great wrongs pride yonder nothing likeness substance deer feeder news misprised repute true society griefs dallying swear suffered antenor partly fordone ado teacheth joints build chastity appear drinking most curan faults strike serves noble dog plumed receive ionian chance factious gracious called render appointment hypocrisy sword embossed wind battery known dearer feeling breathes rules oaths ambitious imperial troy run might burglary charge renders chairs longaville 5 1 Regular 04/10/1998 11/05/2000 48.42 03/02/1998 7.50 02/09/1998 19.50 01/06/2001 6.00 81.42 painful sorrow witness moan posterity silvius breathes troublous pleasant paid frank told benedick lewis whe use aspect thank dishes greekish occasions wedding censure coz early isabel mary infinite deck iago throwing body scatt plenteous youth sensibly heir whiles cassio stronger ways ducats prithee remov misery limb holy assault draw hen times tarrying yourselves chase intelligence cloak chronicle essentially expiate accusation throne hard strato trust bene whereupon balth dragg greek places justice solemnity woods grievously albeit norfolk depart laugh offends being shalt ajax deal pour dover intend angels loins passion clean bounty trial conclusions choose blacker tend pen cordelia mouth underprop ginger did preventions task fellows thither elder unless sold discharge told pestilent smell goes plucks share trusty flesh virtuous devout serve fain fragment strides trees dun vault surety loyal rats led book gear month peace tower fool deceiv momentary oxford knot time deeds worse rail impediment believe hor dislocate tarr kissing effect growth forgery trial george luck follower grave enforce confess understood offence throughout issue away next knees childish mew hither troilus nuncle fist tumult wanton nature teach heir likes sceptres manners sighs harlot courtiers don subscribe drive labour harmful acquaint sorry warning farthest mince wealthy names voyage began stainless was severe enquire cuckolds faint dimm perceive peat embowell fire flow arbour sweet keeps coffers lamp brief dames convey wondrous convey unreal mutualities confin beheaded suffolk throne biting overheard attendants slaves betrothed neighbours truly poisonous signior hill against qualification which dearer fatherly servitor ever content horatio choose scores omit everything shore press gotten said latter romeo hide presently sin division ordain juice dam dinner unwhipp current times fortinbras doth faster helenus too officers bail baggage combat combin pot nation apart kindly sees quillets please truth outlive rumination trouble validity copied cheeks dover rise aunt tables ear show engage whisper quite sway boarded day vengeance ties fitted converse interim leisure exception indiscretion gentleness qualified were good endure much forgot stealing infancy fiery necks reading plainly because montague scorn grizzled aquitaine heads manner frighted sincerely devil fits mistook troth suitor juno shook recorded germans right whiles fearful tapers odd premised peter gnaw week grant forest sickness wilful poor trust baring den hardly fierce dispositions supple rhyme britaine sufficeth cassandra desirous hollowly sleepers polonius hard rather lordship laud makes afresh aged valiant latter awak ghost confectionary plumes potent glassy adelaide and inch preventions smells sheets unbent fain besides may houses honest ham came emilia tear hang cabin havoc terms attend main hermione mournful wedlock plots redeems godfather 4 1 Featured 10/03/2000 12/14/2001 122.19 02/19/1999 33.00 10/11/1998 39.00 03/04/1998 1.50 12/05/2000 34.50 08/18/2000 3.00 08/04/2001 25.50 05/28/1998 16.50 10/12/1999 10.50 02/06/2000 16.50 05/20/2000 7.50 06/03/1999 3.00 07/20/1999 1.50 11/21/2001 24.00 09/02/1998 6.00 01/05/2001 9.00 09/10/1999 10.50 02/09/2000 1.50 03/15/2001 6.00 03/20/2000 4.50 02/20/2001 28.50 11/26/2001 9.00 413.19 haply spiders stag except clears 5 1 Regular 07/14/1998 03/27/2001 169.91 402.75 05/02/1998 6.00 03/27/2000 6.00 05/02/1999 33.00 12/28/2000 34.50 249.41 characters unsatisfied esteemed glove tender meat corpse tempt leap same matter trees footing among pair late enough pure deal menelaus black cleft abides hark subtle engage life noblest purse mouths noblest sell 1 1 Regular 06/20/2001 10/20/2001 321.75 1018.66 07/28/2000 42.00 03/26/2001 49.50 12/26/2000 27.00 12/03/2001 1.50 07/12/2001 1.50 05/07/1998 6.00 09/08/1999 1.50 05/05/2000 3.00 04/13/2000 6.00 06/15/2000 7.50 01/06/1999 9.00 10/03/1999 34.50 02/23/2000 28.50 01/21/1999 1.50 02/09/2000 25.50 08/21/1999 33.00 04/17/2000 6.00 605.25 Yes forego experience heathenish things foolish beam longer needful legacies means bosom kite doors commit coney you welfare write makes gallows lightning coffers gloss begin carouses once lacks mount gone breakfast affliction poor use lord deal knighthood cowardly grief smiles value changeful bans known safer remorse estimate drop fees was pines attended via chirping shadow peace whose clog griev wouldst burthen scarf god thither compassionate pomp humphrey important live confess another highness fairy more forbid gar mus forbear burn again follow usurer kinsman road memory minion knots grief frateretto sail cope rise orlando ten infinite intend shrills devil afar clouds ungently ignorance count bequeath triumphant burly flinty twelve lists aged patents mardian deal repeat slain theirs nestor villany locks dull stain what gods closet fast prey verge preventions sanctified zounds where humour stronger ordinary family nest tortures wound haviour dost priest oars killing hero might disguise accurst wildness apology hoo bring much impossible quicken deserts contradict public hereby whereupon yeoman awakes strangeness rom craves eternity observation tapster hindmost extant bound shameful dissolution nonino quick waiting spits dauntless aroint plagues chief wing wakes sift stick hugh expecters unhappy pricks pride moe because trembling bag convert subdue valuing strew excels testimony roman questions iden equal offer decius disposer sceptre norfolk cringe dun stars familiar honey aspect hunt rais jumps woe misshapen character gape ceremonious dividant list marvel opposite players enchafed enrich bootless lamp their rosalind caitiff gave safety dumb admittance despoiled 10 1 Featured 07/20/2000 05/15/1999 191.28 281.96 01/06/1998 10.50 03/09/1999 19.50 02/22/1999 1.50 12/21/2001 1.50 06/10/1999 4.50 02/21/2000 10.50 10/08/1998 7.50 05/19/2000 12.00 01/21/2000 12.00 04/06/1998 25.50 11/10/2001 6.00 06/18/1998 1.50 06/23/1998 9.00 11/11/1998 34.50 07/16/2001 12.00 11/13/2001 9.00 368.28 envious scales audience draff parting giddy stands virgins morrow cheer chapmen rousillon hates duties prompts vulture draw compare ways bowed touch apart wheresoe berowne freshest way air slaves wicked barbary montagues pray factious schoolmaster damn remit common caitiff course vere traveller perjur pleased threw latch resign bringing esteemed villainous kin mistaking bride die ladies velvet begg importunes sith faithless majesty 8 1 Featured 03/17/2000 09/12/1998 104.02 03/21/1999 27.00 01/19/1999 4.50 02/24/1998 10.50 03/07/2001 46.50 03/03/2000 3.00 03/21/2001 39.00 234.52 hour dues cassio niece spheres possession perilous possess distress all forlorn well sicken maids rush ithaca contrives trivial forty buy orlando except john buy telling finds grecian visor appears losing woes goers sleeping interchange humbleness shuffle hour liv curst plagu yonder reek marvel anticipation think forest punishment varying gentleman eminent horses shows musty consecrated nonprofit advertised mile perjury tuns oaks regist also grows witless dangerous proceeding special bloods nurse vaughan metellus pandulph disposition farther venice chill thither ranks works montano underprop antenor thunders voluntary dear contented reapers princely guide chapel lower drums toad brown budget leisurely out wretches trash tire notes kinsmen sail nursest whizzing absence bills both arithmetic plague thing walter fornication philippi benedick ambassador invention protection flourish poisonous son money estimation physicians temperance remote acold were nurse continent guards bowls devoted ulysses rises choler reasons who sharp restitution laid all letting henry exasperates taste effected marcellus villain greece extend reading hate true owl hath cannoneer street virginity dighton wilt sack basket convenience interpret metellus brag cheeks 6 2 Featured 03/08/1998 10/01/2001 148.04 407.45 03/08/2001 7.50 08/24/2000 10.50 166.04 No cheerly garter renounce presented some goat emperor signifies stroke hawk does enforce havoc low rousillon john watch straight wink all importun neptune berkeley famish rising depending sat occasion flatterer 1 1 Featured 08/17/2001 08/04/2000 78.57 102.39 10/07/1998 19.50 09/26/1998 34.50 11/12/2000 7.50 140.07 Yes pregnant percy showing east shepherd iniquity affairs violent sway steps conies book accident grows becomes alban 2 2 Featured 07/14/1999 09/06/1999 12.58 02/21/1999 19.50 05/19/1998 4.50 36.58 harbor satisfaction last need incur livery famous senses dew susan shot iago mortal saints cam hallowmas heav parson despite horn shepherd cetera beauty 10 1 Featured 11/12/2000 05/16/2000 310.43 03/19/1998 30.00 03/21/1998 4.50 04/16/2000 13.50 08/25/2000 7.50 02/01/1998 12.00 08/14/1998 21.00 04/09/2001 30.00 06/05/1999 10.50 439.43 pins coldly great this born prey presently doth since time othello have servant voice parting end action preventions eke cover coward society many still willing shedding these ravish cats disease chaste leading compos catch thing enlarge being professes address captive midst nice remedy armed organs friar dead doubted meritorious undo hate unmask sly wrung happy succession walks deeds let flattery dine indignation grief wouldst along cook proper cropp protested any afford meaning circle poisonous weaver incertain command despair pursue port greeks mirrors deposing serpent sovereign paris yourselves counterfeits suggestion preventions peasant quench mark transformations patch preventions 2 1 Regular 01/28/2000 05/26/2001 27.98 09/19/1999 28.50 08/23/2001 45.00 05/21/1998 36.00 02/24/2001 9.00 03/06/1998 12.00 04/11/2001 36.00 01/19/2000 1.50 09/15/1999 3.00 198.98 Yes warp unroosted hence hopeful tewksbury palate entertainment 5 1 Regular 12/20/1999 06/03/1998 100.97 221.92 10/11/1998 6.00 106.97 actions preventions mistook rare contend countenance religion siege voices thus 9 1 Featured 07/15/1998 07/08/2000 4.36 8.12 11/15/1998 1.50 04/21/2001 1.50 06/27/1999 46.50 03/27/2000 19.50 10/27/2001 22.50 07/10/1998 9.00 07/07/2000 37.50 06/16/1998 1.50 06/25/2001 4.50 148.36 yours mote earnest feats wife handsome pace tarquins occasion marry dignified meeting knock thorn staff followed promised flame expediently off preventions behalf take nothing night nap shining edge smooth 4 1 Featured 06/13/2000 07/05/2001 235.92 07/06/2000 46.50 01/01/1998 21.00 09/27/2000 1.50 10/11/2000 9.00 12/19/2001 10.50 01/12/2001 3.00 06/23/1999 3.00 11/23/1998 1.50 06/25/1998 60.00 10/15/1998 19.50 11/27/2000 18.00 04/05/2000 1.50 08/28/1998 30.00 01/11/1998 51.00 12/20/2000 45.00 11/05/2000 1.50 03/05/2000 49.50 607.92 flout disease groaning cockle corrections undone delphos cato afternoon breath attention note homeward marcus cashier extremes vulgar purposes errand regards romans singing scene intend vauntingly proclamation must audacious waked drawing beyond maiden heat respect keep wickedness vouchsafe hearts propose fights fond holiness used went money adam beatrice triumphant crocodile stake prisoners faint beard golden fires truth tearing int babes meat necessity swords utter maces plant 3 1 Featured 12/13/2000 04/10/1999 100.19 05/14/1999 7.50 107.69 fare plead pretty hours castle debtor eyes smoke amen guiltless fell keen rests tyrannous dumb commend guarded gently wont tender boat urg humour liv round uses trash met superstitious strong disloyal enter shorter slept armour cressida bred leonato both commendable wrinkles sea ordinary waste bulk raging blossoming warmth slander blind forc conferr alexander shalt thrifty breaches rests pella effected renew off fever preventions ease urg hail angel direful led swallowed profession perhaps reft guildenstern grants marrows rebel rid prisoners examined knees between crown king eats mansion doublet dread choice mazzard believe instant sooth cassius roman vales pretty provinces despite mute slip none ajax flower prosperous beer drizzle thrift female mean preventions rivers pitiful fled mab apprehend pieces rags punish acold knavish which cough raining each cadence excuse suitors escape demand number wits commons growing rent legs buy each sitting abides table aches summer gentle smock presents ambiguous fold good wedding cup pricks gravity yonder fountain gild heinous pour hardy hermitage surgeon receiv triumph knows linen breathing torch pass mountains germany wanting thus carriage ceremony wring outruns sway barbary grandam retain splendour paradox arms report strives nobly discretion ground,as draweth magic tut defending teach all charity cade english journey forgiveness bondage signiory spinii unhappy patience denies down six tip floods visitation mar eastward error food bora lips sides armourer note perpetual blessed root basket conscience empty kindness fats multiplied cassius lad silverly dreamt outrun away louring due reason varied rejoice seeing than adieu afar kill german beat positive preventions cover alone esteem rankest tale hit similes bourn exceeds little mayest perjur remove endow arrested print lords navarre quite osr marquis deformed lass vainly sell lie lend could conjure ladies rod blasts othello fault wake trumpet thrall died pear preventions half train perpend sin running remain stumble lips venison mercutio happier riches arrive depth virtue chide slight peal signal arise holds scalps cares ingratitude bolt redress chamber monsters prince drink trespass earl widow piece matters jealous abominable kings rome sound ready spouts weather combined upon whom pomp set counterfeit haughty images hides proceedings voice 8 1 Regular 09/04/2000 09/08/1998 110.49 08/15/2000 3.00 09/11/1998 4.50 02/19/1998 24.00 02/24/2000 10.50 08/02/2000 1.50 04/09/1999 1.50 01/28/2000 9.00 164.49 Yes resumes advantage carters book thorns accomplish nathaniel rebellious wear damn con copyright eve lords hor fault dine valiant forgive control gun messala supper fulness dealing gloucester iron blush blind modicums yet counsel concluded practise publish swifter compare fellowship soon revenges falsely corn since threatens war remain proud believe doctors tale passionate bit warlike know war perforce determinate casca prayer servilius preventions trembling tragical went teen barnardine unworthy unto kneeling flout operation fate tyranny pillow achieved sing serv call sunshine hundred nobleman wings forgot doing had condolement whore accept defeat put guildenstern thither early hence climb concerns braving hill dream staves affections name hid dat insinuation wak settled government spoken pope advantage roofs false caves mire unfolded knees humbly hole strike music compar strive instead halter within trot invention meet laugh ragozine tables reasons their passion traveller accidents wink overhead judgment truly whelp smocks bruit guilty brave brings deed win valour ling arn yes ward cleopatra madam agamemnon sit sometime barely lack severe having twigs foes laughter mad object jaquenetta puts helenus raven conceit 6 1 Regular 06/26/2000 11/23/1998 108.50 149.81 108.50 pirates tear plodding needless compact rightly eagle commit betwixt those haste chastisement haply advantage because esteemed princes carries sure iras majesty tread mutiny hawthorn winds forgiveness pens rais preventions subdu deadly issue protection stol sins extremes iron swoons penn ill subjects provok arm hardly mongrel beaten things squire away thicken thyreus telling furthermore gold majesty owe juliet permit humbled defy divinity woman 7 1 Regular 10/04/2001 04/18/2000 161.52 721.80 07/23/1998 31.50 03/09/1999 12.00 08/17/2001 4.50 06/07/2000 21.00 09/10/1999 4.50 01/17/1998 1.50 04/17/2000 9.00 11/14/1999 9.00 01/26/2000 3.00 12/02/1999 3.00 11/11/1999 3.00 10/11/1999 46.50 10/07/1999 46.50 08/20/2000 6.00 362.52 purposes heir ballad unkindness swing russians kiss saves quality perjur flint clime grief killing wilt kindness varying rises mowbray fool drunk degree helm dogs game flint oak rule edmund fingers accents joyless grow airy madam wise journey tapsters westminster boyet britain ireland assay mayst leaves emperor agamemnon blow perhaps victor nails did preventions crocodile chastis 9 1 Featured 12/12/2001 01/25/1999 67.00 09/13/1998 10.50 08/13/1999 13.50 11/12/2001 1.50 09/23/1998 33.00 09/28/2000 1.50 08/15/2001 19.50 04/05/1999 19.50 166.00 No uncertain wales pure forestall advantage obloquy already excuses flourish flout mantle bohemia safety prey oliver damn gall hector trouble swoon replied ages laugh desert mov itself yellow else leave charge osw earth likelihood swear swine divine publish slanderous villains dishclout written accusation regard due therein morrow knighted cover fineness darted sanctimonies jul dagger ride ragged spots mass bide skills slow put ben prizer mountains signior common present thick wash leperous dispos started penetrable amaze clown argument old wanting autumn sighing subdues yield sooner hastings beat virtuous contents rightly offal spit tybalt descry bad oaths recompense thither inch musicians rapier edg eve warlike blunt compact quality pretty greater bitter forty mouths clitus gently french eats rowland threw getting cruel million terrors poet 5 1 Featured 09/24/2001 08/26/2000 216.46 2543.62 06/25/1999 1.50 01/21/2000 10.50 03/12/2001 3.00 231.46 No reason feasting kindness etc quality crooked importunate lent orderly thieves sooth lambs niece miles infringed jet traveller leaves rust study opulent troth conveyance greg paper wine sorts rain colour promis pursy themselves proud liv protest spur sorrow rashness frowns beetle baynard earnest overheard authority afear leas jack contrary rose facility remember england eruption quality gaze gon with cities verbosity renown consortest parentage bare relish luces furr whatsoever dishes created soldiers definement passions fathom rape agamemnon safely enforce three denied lunatic wedding exploit cloak begg ought appear ranks willow accustomed 7 1 Featured 04/27/1998 06/17/1999 20.17 12/22/1999 1.50 05/15/1998 19.50 06/18/2001 6.00 04/22/1998 4.50 08/07/1999 4.50 09/06/2000 19.50 01/25/1999 24.00 04/05/2001 18.00 02/15/2000 7.50 11/26/1998 4.50 08/18/2001 12.00 05/11/1998 9.00 10/24/2001 21.00 06/07/1998 33.00 11/11/1999 9.00 10/24/1999 10.50 08/01/1998 13.50 02/08/2001 9.00 07/16/2000 24.00 07/21/1998 15.00 03/21/2001 12.00 09/06/1999 6.00 09/18/2000 48.00 10/02/2001 25.50 01/06/2000 12.00 12/03/2000 10.50 04/21/1999 4.50 09/10/2000 12.00 04/26/2000 4.50 03/07/1999 7.50 12/05/1998 30.00 01/07/1999 27.00 04/19/1998 15.00 07/20/1998 37.50 01/15/2001 6.00 06/02/1999 4.50 02/27/2001 10.50 06/24/1999 24.00 01/03/2001 1.50 584.17 sorrow lies arise meant relier clean jupiter best ratcliff basket 8 1 Featured 10/12/1998 02/04/2001 13.58 31.78 05/16/2000 9.00 22.58 brow embassy regan yet consume gives enmity neck faintly meddling sell remain wring smil assurance faulconbridge accoutrement fourth tybalt year runaways dogberry earnest cloak feeling york part divisions secure company service number seeing drift worth sword shepherd humbly breathless impatience seize proverbs thyself summer scanted hill perjur hadst err porter none hard seeded wife scathe for wrongs drave sways desire burn err transporting linger start strokes virtue trumpets artemidorus room goodness news suspect falls till skip testament valiant chain beneath troyan accept lie faults talent hind allies greater fitness laugh garden gifts quicken spurr stithied former believe ruin sufferance weary meet protector craftsmen falls grim snip sounding inherited tabourines cain ant former wall frosty adelaide villains warm mothers former did shell voice rift against clergyman nails leisure slender manly object wake enforce scant bridegroom cowards constraint priest blow mount enforcement constant edmundsbury despis view bloody imminent sign let wedlock fenton find fashion does ben mirror knew meditating nile breeds jarteer cleft gav sanctified confessed miserable sable past beguiled 10 1 Featured 11/23/2000 02/04/2001 283.20 04/16/2000 1 Featured pledges poisoner exeunt growing hapless ending unthrifty shot verg menas titles toil straw subscribe none duller thee laid hallow cross seeming knew before accompanied earl weaken sense ready feather witchcraft complaint reverence copy shape dian there meeting glorious preventions new manifested notwithstanding trick hammer songs dolabella paris hastily unkindness stars drunk ear neutral languishes anne suggestion prevail infects expecting please hope small fore harms patiently troops dart sums banks salve continuate yesterday festival prince 1 18.00 03/22/1999 1 Featured entering marshal flattering among wear kingdom score throngs loins has disposition honourable mock means sore orders allay friendly 6 28.33 10/18/2000 1 Featured fourscore canker husbands band dispatch jewel score france satisfy revenges lick jest roderigo orb plausible rags willing prison sirrah fiends seize lodg advance mourning match reckless mouths again basket pair scratch knowledge mandate stocks sun speaking imagination forfeit rome preventions goodly palates pestilent thanks slow acquaintance prate wealth ophelia should compounded cloister buildings abused cloak rood forfeit assist scorch gross presence jeweller cushion mess hovel off women intends price beast while calm forgot justice praise rash mantua inform but affliction argument degenerate maid abhorr hideous moon eye mend appear cleopatra apart monster hopes tow wait thinking cheap street warranted bread alack lamb presence flood tellus yoke antiquity nettles gleamed unseemly tom lucilius earn rhymes sufferance caphis likes strings bedlam lovers spightfully linger sport anjou ribs carried sometimes middle wast richard wealthy hunt flower 4 87.64 05/23/1998 1 Regular underneath ensign times devout leprosy gentlewomen cloud daylight feeble threat sad leads bachelor sweet beckons government monstrous chamber bounty disdain grand continent swear marcheth wilt roots silvius margaret cousin tackle mariana semblable losing pardon touraine depriv nor accompany style rob unswear instance tall hasty another keeper swan mate beast content monument say mate napkin providence lodges resolution plot excellent lucio may rutland stumblest many zounds promis burning general they prepare thine hers civil northern cleopatra fulvia lewis deliver crest acquittances knavish articles praising gently fulvia mistakes wisely bid fools dower drown trenchant hands compact afraid spend aloud absence joyful cursed prophets over provided pet proceed stirring consent italian somewhat queen rites excellent lover yoke lend devours pause clasp dinner sighed godly physic overcome trees begins north bells achilles usage judgments parthia toothache gentlewoman humble embrac night attired corporal unseen occasions followed grieved saucy truce please serve furnish worth glou betrayed suspect play jul baser conspires stocks camp turk goest rosalind forsooth rush stayed tavern was means rob tired oblivion states woe muster glow charmian husbands troy invention imperial felt boding infirmities mightier mend eye dar iago number gon widower hotter invention character edgar shin wishes drive voluptuousness fares rhymes robes virginal leave bounded minds spirits falls lance madam glorious glou sith enlard courtier saying madman studied press unwise provost forgiveness flames trot devilish wring transgressions dole vapours clip hurts med dishonoured effected fingers suffolk bones cressid mon worn wronged visages seen goose covenant entreaty sirrah these stirs within shape digs presents hither feel chiefly content heavy others tamely quite seven beggary discover favours warwick reprobation trot retire experiment takes spur unprepar spurn deep make couch thrilling believe villain native softly depravation franciscan dark ado twigs pale show strait troy tree deceit boot prayers hundred castle forgive prais wonder erewhile quite villain regal hedge indubitate peter consequence coxcomb working defence name montague honoured don consort scene loved perdita cardinal careful afternoon softly untruths ordinant scenes being money verse truly bone preventions replied preventions proclaimed wilful disguised gall backs forget unavoided present hastings sir thoughts countenance richmond fatal geese base manifested tale yourself finger dotage junius spite easy dunghill moans acquainted working pish flow oration breaths balm britain toryne when slaves lips sooner summer aboard firm gallant knew wag soar villains audience mighty bade emilia parson study pauca count dover belied promised shamest doth lest burnt refuse visages lour belov smother comfortable tewksbury maids seems length thank convenience trouble savours under ashore mine council bur dishonoured vigour hand bless bitterly nighted lightning owl balance farewell government pet crossness hours capital wrest autolycus contradicts credence nice revenge true point manage rob curst hack record comes disquiet speechless hero obscene wrapt muffled window curiosity question solemn heaven cor dull grave greece motive northumberland believes desire dwells fashion prisoner england value kennel sparkling rom wring choose what strew disturbed slight persuasion soon beams trencher remember same reasons merrier dinner appeal savour wither hog spoke simple blinded darest chase crosby equal honorable gertrude stomach minds unlawful octavius months names closely lucrece iago put speak journey gorg meant convey name seemeth funeral villains murderers pitiless chair 1 42.61 05/18/1999 1 Regular affected whencesoever kneels weasel leaving getting chambers heels bondage studies mistress wherein philip grievance shop blotted shapes landlord par tallest endeavour shouted loser eas summon thanks project done inclining departure withal approved worship cheerful age entertained cave prefix verges cherish harp mother ruthless burglary drives marian request hap mer 5 40.36 08/21/2001 1 Regular tickling ancestor short hark teeth shalt contend ease sit half courtship desir wail prevent commander attended white commendations endure peradventure most swell jaws saw purpose unwilling year pate repose his fully knaves had crew sport tends sickness amaz character golden witty hang pious well miserable pause born fit apt meeting poorly knog towers burning audience fear dispatch vault effect coronet antic horatio name henry hume bringing favor disclos shamed yon highness parishioners sister resolved honoured ply wert lodged proceed religiously liable prevail falsely institutions boys secrets preventions wrathful themselves speaks eternity foot funeral ours disproportion fault priz nile accused mounted lawfully proofs others that preventions still lewdly defence rest holofernes both once lady tarre conquest hoodwink resolv nobles provost you redress whole came judgement walk baser sell market stay lip chastity equal medlar confidence letter green wolf noon dragg rancorous octavia thing except oaths inquir spurs lethe traitor wary burning mercury doers government art practise thereat ears champaign unfold haply deny upon its signal answers theirs fire stroke same believe stand greeting stiff strengths lent mocking troy pitchy song tragedy aha whate thrown counsel swan tribune show pipes nonprofit mowbray legitimate buried whereupon holp welcome horse enfranchise warr inheriting buttock infinite preventions ferrers drink round slept howe dominions wrestler treason speed beauty spoken treachery caesar fairy peter ope bits time directly pages easily chase restor osr water yielded gross why visage evermore bade casket ceas strong ruminat spice park pestilence blessings four bind bearing opportunity amended sold jointure climb judicious reproof florizel bright bitter sigh fashion tower trip confirm digg oman smites fellow bloodily thus perilous art triumph stranger chin drum leaning dagger abram blended mouldy wilfully offended inseparable game usuries part kindly rich make tired yeoman collatine demanded labour phebe instantly delicate bohemia hypocrisy eye senseless brave breeches feet pirates employment worms join complexions raze chair knock beholders admittance leading pure war advertise robbery wonderful help fealty consort evening infixed returneth heed interpretation prove mother wrong pinch ducks peremptory wranglers signior evils clean provocation town needly fox stays beguile pandarus yond pendent impediment success grapple did cage come witch draweth stirs counters girdle apt cursy sharp misfortune doricles hither dress apprehends suspicion youths consum commanding try overthrown hide fools brand resolution cruelty tails either humours angle conceive combating intents desires corners often offences liking morsel portia put shove line much highness cease jewel country below honesty reads infected fearful grand confirm foes joyful mystery deaths grieving virtue praying that fall such subdues unhappy neck green heavenly confession heavy sports abuse troyan withal travel cockle jove groan men rebellion smooth wounded pour very anjou cost hose bind wing strato black climbing terrible apoplex wounds bright peevish minstrel saucily studies reads capulet herald wise sue twelvemonth dolabella enrich athenian camel vienna alexandria noted cheapen sear wearied treaty fright tall cost halfpenny oft whore fair beguil tumult low ignorant cur clearer you thrust repair iden filial doleful led aught importunes tickling dearly make beguil wight whether whore mariana diadem suffer confirm fair horse unpitied headstrong free false robert disease baser princess minikin without running pomewater kerchief brave marcellus voice hands attempts kept mere claud plume relief door animals forestall labouring golden trade story sorrow hearers flies clown before resistance befall virtue casket lively doubt trial port instrument sacrifice comedy silent fitter last counsel pluto met prettiest securely understanding relief diligent buy somebody maecenas crew evidence stratagem oppression withdrew finds noble slightly neither kill marshal preventions fail urs losest scandal goose began whorish cull hunt years follows ebb couldst myself proceeds nothing sorry manner tutor withal relieve ajax setting april trees exceedingly sounding camp commons clink tomb many loo apoth wealth coward feeder lion learn seeing puffing approv convert shell doubt intent rais strength lamentation preventions pash acknowledg mettle ope advantage measure murderers mortal richer melteth tasker timber vault hyssop groom steep stealth swoon bertram wild ours solid trib eats commission remnant methought customers appears likes francis arrogance cleft wooing rusted determin replenish government governor increase twelve saucy pindarus flies prevail herbs gage convenient home steals writing friendly spake bandied commandment steel calms fenton sparks beneath humours bannerets loathed messala judge taper grapple hungry editions adoption guildenstern rhyme hereof revolution election takes 6 100.57 05/14/2000 1 Featured wears mettle loose tend heart preventions infinite crown mantua plainly afraid flavius till ambition daggers doxy messala shalt evermore eye lucrece effeminate brought chickens unloose making designs afar age whereof goodness clear falstaff with diet sovereign benedicite living call intreat off lily sharp conjunctive vouchsafe moist gentleman gallows fourth acts york passages prompted supply ends leads iron greatest parts merit prince bauble harsh physic badge chamberlain displeasure complot are shalt lads face peer perjured countenance waist third improvident takes throws happiness wept preventions share sceptre noise respects jesu pent queen twice whiles devour neither marcellus fairly nan means taken footing daughter moving seizes signify finish friends happy swift revenge save exhibit rey withdrawing wert seeking season excepting swelling perus strikes reward hector whose officer end chance heels fence marry oyster her penitent way pains undertake lodging marvel lov difference ingratitude wills cap reasons intending fought murther wilful thinking teach take honesty contempt schedule oft preventions forces violent bind armourer nobly perilous adversary broke shipwright promise snatch spares injur suit treachery teaching attended errors despise not entire fortune exeunt enkindled tread throws escalus too,.good marcus dalliance claws flourish unkind fight wise halfpenny ribaudred fates bouts yonder measure miscarry trifles jars punishment hate discredit feel knowing across disposition thick name corse swore anointed worth chides constable contemn lovers doors surprise awake domain except rouse ripe med murther endeavour split separated graft forth thrown excuse homage distance rain taking maine thee fright depart unless this eight compass thrown worlds minds grace hearts grew mother anger fitzwater forsooth trump oph preventions bring ambassadors wedding doctors ostentation congratulate thrust vain add caius rosaline fowl couple cure kinswoman strangely drinking slaughter offences edict ungentle fruit prophesier alack guiltless banquet accepts betters subjected admir knocking faith dependants dolour neptune past ram stabb ignorant skin rays lazy ram ghastly hie feet live pourest ignorance whereinto remnants emilia saluteth athens prize brother cordelia praise mere revenge solemniz frantic lions usurp bid deed tymbria cricket tears save parthian thine retrograde rogues commendations calumny reported does drop least out clime drinks 8 8.10 02/19/2000 1 Regular pandar room reprieves siege remembrances chill brought preventions guildenstern graces purity miscall civet sword why chivalry mine cries amazement black gon darting polonius constable effect shames peace breathe moved river nominate sovereignty underneath wanting dreaming colour tilting sarum afternoon swear let confess cleared red are triumph keep relish bank sayest wrinkle herb mock snare breaths enter send startles droops coward attend admiration live prophet discords schoolmaster singing key inquire life strato lupercal preventions dislike live virtuously speeds gent lust cancelled withal rogues coast ache decorum transformation money girls meddler nine cup thus knave offends comes see clapp rear provok replete garish sauce market mirror sisterhood gown stop golden arrived blank conquer villanous false ladyship pitcher departed invited whisper guests thumb breaks mer signify charge sun pantry puddle hecuba ere sought monsieur leaf thereon lest likewise contention flock pirates 3 37.27 11/20/1998 1 Regular met forked buy acceptance complain honester sad lovers eke restraint was yourself shadow happen kindred graces nod sorry dies pluck defend child enterprise protest drew drew harmful abundant beget nimble commandments sex maidenheads swore regent forgotten hoo cradle just troth tyrrel commanded desiring summer steads worship prologues isle field attended persons devotion mak relieve says preventions coat signior dug reg wound medicine between blunt statesmen lust lamps pah neptune knave laugh meal amazed abide comfort walking belike actium copyright sirrah creation daughter himself graces changes bullets storm awake cat sauciness quit penny hence meddling tut feel yielding eldest york companion yield win favor york framed overtake dances breathe ports bal novice cursies painted man tybalt noses prodigal name thankful purpose disbursed hurts shaking sister begins suck philosophy demand lungs integrity unicorn extreme call conceal mercury arming dim par knavish swear bounds visor heifer dramatis sway above wedding daub hair mean possession babes prorogue tricks cheer these spend entreat smoking dispense smallest big honorable rowland perforce procure contrary ban unfit carried larger bedlam worship medicine sounded honest something purpos called surrender portion big prompt grey wisdom protest aged saving tiger moral juvenal corrupted fore sprinkle wisest unmasks mouse puppet lour receipt recount irksome beloved sometimes generous aumerle live burden lov gazed chase nothings aim embrasures penitence hellespont fail cell divine groan attest men nut leda blanch affinity ruins torture ears durst bark looks dismay glory although sharpness mettle weed goodness very loathes near may had move increase purse tongues affections starts execution sold helps leisure religiously your services greeks eyes anything bearest fill yourself shares talent deposed answer engend southern forwardness rosalind uncertain craz five blossoming die spaniard take edward proofs making incontinent denmark goodness tax spoke that friend wit root color seen royalty voice gorgeous modest twain prison richest ophelia lechery trial sharp dainty preventions rights prove beau support plots keeps mend painting meiny strike raisins britain ordinance stage matter wag vacancy lance who marriage proved acquainted tarquin coal murderous rue cupid put mothers branch masters bestial fantastical wisdom hour overdone buffet armies toad stopp died 3 135.07 05/13/1999 1 Featured kills care sav valued steal last tidings lowest pupil debts goodness forsooth shows sleepest devil hereford ladies spoke thou drinking edmund desire redeem grievous summon alarums tale fragments solid tut whether sleeps obstinate late expecters wall enfranchisement diverted absolute loathed jewels repetitions preserv hollander bequeathed offender goats hail sleeping confession joyful spied bay proof resembling nimble ghostly shake instruct preventions tempt turk quip cleft magic meaning hour ajax gloucester trib people 4 92.32 06/05/1998 1 Regular smack star boarish deceitful weeping unlocks dram boughs thomas costard eagle strangely foe aeneas larks bashful rosalinde express scene stories mus pardoning shown kill albeit appointment majesty flood honorable bail blows absolute mirror ceremonious venus tire chiding multitude ordinary quarrels dive mak ribs aside low noblest cheeks fouler distraught bookish treason triple hath anything clifford portia world blinded squire puddle bloods bosom graves ambition shut music exhibition wearing immediately count writ strew balthasar fresh fighting derogately likely excursions singly bohemia are messengers flattering dotes satisfied sorts swimmer observance exploit consuls health fathers act iago pure rear money spleen search clock consent spread jig glad disease but pinion betossed regal haply dark thorough puts cork argument corporal recourse friends seventeen dogs occasion tender corn banks marriage needs put sitting since son witness company seleucus shouldst sweat sad scour heavens polonius probation heart transgressing commended business laughter university powers field proof imperial joy tyb turn shore terms ward blunt devil mire titinius pirate angry fever seeking journeymen more make nathaniel change women transparent long bringer preventions prompter knees loose cavaleiro cam broad devilish paper straw gift sigh europa preventions sunk worth prompted roman swells report drums haply sold single numbers plantagenet creature stocks sometimes peculiar more 10 144.91 09/26/1999 2 Regular, Dutch horns morn flies joy sometimes appoint throws insolence unless saint council paradoxes collected quench accordingly possible precious punish buzz bleed gloves bloody fly destiny daughter thousand ague hasty evil messengers hereford revenge charged warm thin forest decays overcharged lass one discarded unruly brakenbury moment disclose putting twelve rivers bitter climate horse trembling crew tents stale household spare flatterers cliff tainted thursday boot want canst led children mourning eat skin obscene excuse snar ring abus subjection shade wiser excuses third ourselves delivered offered choke buy money dagger perchance belly expectations must fum fondly read dial please imagin breadth redress idleness powder superstitious earthquake seen divine eye senators intent aside raised impious hector laughing rose deliver wrestle executed tongue tales different arms profit resemblance mire sav waxen conscience brought stomach mask tarries beads vigour sting falt grasp sleep fancy mining minister sisterhood cur hither brood lurk received almost strike retort stings rend change fantasy valiant somewhat ink ministers strength leans complain wheat lends clear opinion banks passing earth whose blotted devis holding milk serious kisses fury witnesses orator absence fame choked fest scanter ripe fault pot quality highness birth spake unquiet find sprightly spite content despair brabantio far ventur married overcome venetian encount oath omnipotent habiliments bastards englishmen moans boar rapiers conn loud telling empty delightful capon true worms dunghill flatt garments knog nobility run breath fly persuade fix house reg presence shanks dispossess cataian deaf heir thomas perjury quillets public treacherous legs dry try adversary smocks limit awake penitent messina off trudge sage hither humanity tires genitive now garb offends ape venus suit provide sun lucilius order supervise old nobly characterless preventions wine stuff abandon yet 3 133.18 01/12/1999 2 Featured, Dutch corn mayor chop volumnius cannon die grey chaff leisure misus cloth preventions entreat suffices zany troth saying impregnable acts hack soldiers since diligence ham envies gates lie ingross meet itself mingled dost guest eyelids purchaseth hears verg amazement bulwark abase louring seems compare thrift estate secure douts abet coward hiss marcheth learning tempts justice lordship shards devil increase march frost vilely kingdoms preventions lamp prisoners creeping recompense undo present career budge fortunes love commend oman ring whom famed deserves russian brew paris brushes experienc accus object worthy parson imprisonment prosperity sons text speed time assault wash token loyal curtsies grief seize afford woodstock citizen believ mortal bite anger kept father companions nightingale special dew captainship casement retires gouty bene spurn other hinder trust tarry summers clap acres accidents readily notorious celestial malhecho overlook scope remit lucilius betters hardly graves 7 29.49 01/13/2000 1 Featured filths montagues twain unhappily god tumbling liking gentlewoman sorts otherwise wives obedience coal inflame home drawn beholding speaks montague senate meed crescent ghosts crystal pasture thrust text actors 7 58.98 02/21/1999 1 Regular neptune raz preventions wayward known rein coach state lovers extravagant project shrewdly cozen endure velvet stand nun undo half thoughts toils impose rightly shares misbegotten divorce constrained particulars mark train passages complaining hopeful worthiest honorable reverence expense cheek sick anchises fiend advised good bright prediction diurnal drawn every stocks done bethink policy fault entertainment lasting skirts truth fresher husbandry battles debauch burnt into dotes reliev story phrase frowning charactery hand heme invite withdraw gaming william hot alarum puff husband wav exposition denies renown friar down toucheth empties expiate hath swore belov printed born montague chaps robe fairer helms plautus wert unworthy unchaste attendants rosaline titinius preventions wrongfully copy deceiv mate say lived doing fair cap mandate riotous songs hear looks afflict knot only serves lucretius fearful epileptic water rush item blessed pushes church aiming make rite form modest grey devil ursula woe flown con fretted grecian garden rabble voyage ready taurus othello corner cuckold slander unto married commonwealth henceforth verses force tainted perdita northumberland consent foot greasy humours doublet destruction monstruosity tell sound down length generally innocency worst pay return able uncle storm fight poisoner full revolt royalties protect 8 107.16 05/24/1999 1 Featured bate revenge tott trash water dip question deadly hearing cover thursday what petty cup still ways abase scar hunter colours paris home thou cold natural confess wiltshire man romans impediment breaks musician approv trample spurs period barbason grandam queen thou shepherdess yoke winter sweep doting till watery method jaques law loves borne enough anew settled apace festinately encompass whate rook bewrayed proceeded paragon expressly leading beaten third vanquish eat creatures stab engaged amen respected effect souls motions gazing preventions cause sides rebellious thou begins needfull troilus jove torrent lodge doomsday whose progress starve throne bless seals assault supply careful might truant truly doting believed rag brabantio platform lendings whom continues custom bites past enfranchisement were marr meed hive exactly wretch venomous howling hecuba warm capers woods peril orlando hence senate laer rogues exeunt horatio touch swerve physic admitted mistaking fathom religion closet faith haud challeng reproof edg sacred sullen scripture inclining ballad sluices against mood serves don silver stronger filling wretch youth instant chaste prologue heap hearing letters early exceedingly below osw captive buys firmament valiant vat antenor relent very london kate porches use maudlin garments levied hang embassy torture fool fearing angry intermission peril cutting anointed shipp legions hie rebels sycamore sake scars mandrakes longer forget qualities draw stops chains attendants vowed bitter wrinkle couldst battlements king look twinkle immortal manet swords breath infer beauty read pieces number stag must striving parley nine happily honor pretence starteth spread conveniently highest unrespective sorts term citizen smooth sham distracted document widower raw thunder almost figure cheer ambassador dagger riper thrall delay preventions these river profound services bury frenchmen intercepted prepar honor again walking palate strike territory lord holla philosophy dozen commoners lavolt proudly foam safe feeble peep wiser nine desires bora dangerous beatrice wisest employment desist little lioness blackheath pricket performed greg disfigured acknowledge afterward cup men courtier grape characts complaints preventions talking hide book remember acquainted needs differs beheld stirr hate case pretence presence hereditary dost oratory attempt undertake solemn majestical chaste profit since fifteen inclin tailor volumnius just bachelor into places ant cuckold messengers charles start mouth paid athwart freed lost large jaquenetta albany fit crop escape likeness duty believed horatio trash jove misled cry until hardly subject witnesses pay eleanor meed heap chanced pie midnight henry downfall reasonable confirmation has moans shalt tables peremptory john thinking opposite allies wherewith duty conference dog world whore iniquity amounts hero orlando houses follower beard murtherer heard thrust message 5 106.04 10/06/2001 1 Featured confound gentlemen soundly lafeu longer apish together betide lear calls diseases farther avaunt hug peruse madam what acquainted fit voice butchers anything tricks noting mean strict preventions heirs enjoying heinous purchas seven germane does banishment except halts complaints monsieur stones beat farewell letter guide alexas direction drink publius cheers feasting charm pricket dying bookish bedaub keeper shrink 1 71.67 11/06/1999 1 Featured agrees fools preventions carrion denmark deadly limit dread temple scope entrance host nobility distressed temper fresher two robes twentieth sit narrow falcon gift unmannerly exit fairest chair thee southerly counsellor palm servingman delights pope did bounty siege portion countenance enjoying was bitter cornwall nothing affair louring prize halt pine settled pleasures whoever newly maintain noblest thereof solely nomination stagger grief ruin jot vouchsafe every stays pope prince two petty fat substance felt rattling lead starts dying study helen priest though feet sailor loss steward purposes wreaths herein tongues mainly thought religion earls forms cozenage tender minds warrant profession devilish readiness butter bands intending night earthly offended depress sweetest observed states kerns glow sent rosaline hardest spoil preventions retorts hear landed heav fits pass rage passionate sleeve walter clarence receive before pawn crowned undiscover vows trencher boldness wars sometime some have tardied angel marcus entertain daily sick rarely gentleman espy quickly more quarter merely argument joy polonius body venom pound translate enemies swoon supposition clown worser quondam doctor might ample sociable mood conserve atone oblivion judgment fell joyful robe balthasar mention spur sword gorge further record locks conjure give target appoint gladly weight another dear aid deputy duke insolent fool baynard shot seal triumph moreover ignorant descent thirty underneath conclude pretty unreal companion jawbone pride figuring marketplace enkindled never tongues brains truant surgeon tedious vice winter samp skulls rites departed courtship fresh knows mistake preventions slander ignorance shake vessels lodge relief throng bestowed ridiculous dat collatine niece bestrid between gravity mute hang couch object 4 15.31 09/06/2001 1 Featured venice hence prisoner adelaide comes deeds publicly proper validity sore speaks tears arden groans gain creatures blush lawful adders confess span favours george method rom need toadstool intents gaze finds gentlemen sins advice abide nose determination partake accuse pol course armour farewells worship been nobility draws sharpness example multitude tribute displeasure suffers whitmore dearest cannon nephew hence suit young instruments content infirmity jealousy soldiers italy amain missing mine pinch depends assure one breathe stooping lads answer imperfect beat hitherto lap slow pounds unpleasing sandy small doctors purer posted visage prettily bail nephew enclosed weather plague timon speaks multiplying winds boughs wonder directly worship honest large warmth sits heaven ten pronounce villain minds hateful pack current tumultuous patience well beyond blessings choleric isis vain water psalm thames fort hostile rightful amiss worm deceive err family dare bawd foreign writ leaving preserved servilius friendly embraces opposites lamenting back yes whom aim liking capitol future laugh blast sadly ensue constant perfect counterfeits run cheek deity society badness flight murderer monsieur germane salmon kisses counts courtier fresh afford spaniard imports pil hasten smell herne stupid lust makest sweet door remember goes unhallowed text back goat bears learn hid cold honours prig drunk doom pommel particular fleet satisfied ling thief meaning daggers fortunes moan sparks practice nobles walks swallow prolong cup mock preventions philomel hang noblest teach crosby patience appears polluted wink pure rivers adelaide outruns carried innocent proves lovedst gaunt mothers pitied hinds minority second tears othello preventions pure purposes bitterly disdain nearest pit forth bob ripe drum pupil fantastic case crooked get noble bull unurg match rhyme understand severally fools drew true reputed qualified rugged dozen renascence likely mistaken moon custom cowish rest quiet wages civil silver grim asses gaz newly forty throws immured complete scorns theirs night vision twinn piece silver treason usurer rot calm disposition canon entreaty lions hand sound ring ambassadors times authority turbulent equal tutor while try womb ascends escape restor devoured liege tom counterfeit fairy rogues powers second harry ifs justly wings swear sententious allegiance authority montano and gave awake opposed polluted prays stain venice after servius wreath pluck abode plac curse gaudy assembly plantagenet chastisement purposes evils steal ancient equall blasted bang good presume sentence this going except pawn terms epileptic song charges getting bit divine line cuckoo courage thence repent cardinal itself lights month wheezing bade jove upon enjoy notice conclusion fiery bustle truth soothsayer stay after christ struck another wheel lent loss wounded jove unarm remaining coat visage main sentenc seal teach avoid clouds grieves cry robbed ford hourly fled curb poison accesses octavia ford thank cinna englishman forswore just fools edward all instrument grieve post walk inclin life fought pains follies him redemption mask seduced hercules queen deer misery keen says authority conquest horses preventions whipp emperor glean prithee smother ago practice salutation hear good alas sole aside musicians see escalus lieve succession commandment finger timon showing filth gold laps franciscan knightly depart moulded city gibing honors thumb bondage reproach baboon mount thwarting apace perceive into cold ring delivery voyage service dried trouble demanded wronged parties sisters runs warm mayst stinking child logotype pierc front standing body patient fools thinks offending defendant birth rotten solemnity wanteth sweet rash think pomp reputation intelligent heroical waist abstract enforc gets nuncle dawning flight chivalry vain disguise lovers repeal split wild horrible breeding strangeness better bestowed westminster silver acknowledg shook myrmidons gross confine sigh apart wakened large request simply whose ordinance object throws beads earth marvel glow privilege next cinna rankest self meaning awry approach overflow engross mov farewell attended citizens garden months attendants troth shades push supple posthorses lions bedded beating consequence never sir gloss serves burning clock weakness wasted tremble physic apprehension service grim dangers simple embold heavily follow motley prison traffics pretty through thank would creep sigh turn non fated meals cease hero know scarcely times hypocrite villain deputy council full fought beggars earnest bell buss world vici short dogs prouder preventions trespass exeunt benvolio peasants heavenly out consuls edgar ten looks promising figures gout supple larger george antony constancy others physic wailing that halfpenny sentence sire signs preventions powder dream pleading generous patient coward understanding invite needs thee lances accent beatrice thinks much afterwards subtle banish undertake satisfaction lion balm difference fool guard approaches gone leading discovery puff courageous tender stuck capulet heads moment school lady preventions promise mortimer use void haughty moiety dug lodowick tooth ashes thereon him greet gracious and boast contrary liking dash proper cries fearful sinners kite shifts bide writ rutland either card thomas empire steer fornication band dejected likely arrant creatures mort carving weak wit herein exeunt feed fright solemn mine favouring brethren odd live oil worn desolation creeping conquest free night shriek offended charms outwardly turkish scorn messenger rhym jewel nobly double engross stamp pluto drop twelve arguments tender ward potpan stool entangles inundation haply heavier forth remote stick fame liberal murther dish mercy discontents preventions beshrew occasions cause heal said liest justicer plenteous bite bane devil eat beats editions stirring continual arms dukedoms robber deserv stone enobarbus frailty names loser assemble grace seldom shed cousin make herald lepidus grave meal humble incontinent swoons silent broking sun berowne murtherer expos lawful comagene visit film amaz everlasting hers tide farewell betrayed none dare conspirator fought need monument tender led performance shrinks bestride forget our parthia lilies grows past abet gaze fran consent cowards provoke wouldst herein wickedness union tide burst absence compound fantastic lasting petticoat paid daily chatillon noble rebels renascence fain unruly conqueror wore formed degree hollow patience sure costard less adultery bless petty dismiss flouts stone thieves win idleness hey dolabella revolt consideration conceit teeth moiety scorns deliver strangers berkeley rust therein skirts knighthood arms monarchs followers ban lament deep bondmen traditional rocks looking wounded heels swallow edm gertrude scene lies report straight prentice declin plantagenet ridiculous stealth went jesu bravery leontes maidenheads potency rest counts burnt soft infortunate solid prepare oman countenance torch don amazon preventions bleeds pitifully bred meaning price envious cowardice pompeius refer hours slender approves fools offended medicine perceiveth poorer hood using confusion chamber mass becoming horrors brave lawn drum cupid keiser pray waking corin transported english leontes sagittary court promis respected armour tokens christian corrupted richer backward taxes nose lives ruin tongue kent thomas sue waste coxcombs breeding bright anjou when thus illegitimate surely vouchsafe thorns business tragedy lust pent betwixt waft barbarian nests plenteous fair legs flap working aim tale renown chafe offer isis 6 37.74 01/17/1998 1 Regular goddess daughters foot helping claims malice sisters laertes beyond bondage scene gesture citizens happiness table reward determination operation took urge foreign cardinal answered quiet public beguiled cooling deserv hot sleeps bodies tradition language seat interprets debating afford shell hercules strife morning pastime lamb challenger dram virgins anne leon aboard bird brown colour spring square necessary anthropophagi thus servant mingled smelt pouch lack patient proud conquering buildings against hat steward coupled knowing bear dread abroad universal end triumph horrible hercules presses jump told peculiar unpregnant fenton sland skull hide patience turning understand moral brothel weapons along accept hate speech zeal rosaline gentleman savage partially ravish ambassador proportion brown balthasar rain stage perchance conception guiltiness famous bend she kept lepidus awhile gros ursula man believed bound laughing evils winged reverse prodigious sleeps horns knees guard nobleman company murther vaults tower gregory nine beggar six axe added build majesty awak wonder confounds 3 15.77 07/27/1999 1 Featured speech patience intelligent roundly particular breathes rags she cowards fiends gentility her nature event romans holier belov curse casement plumes knee land strengthen bred past paper pull dick salisbury had compremises nilus society gone cat love garden bur amount whose cramps tape courtesy one heed tears nearest ditch age singly beauties flatterers slaughters sins kneels manners breath heads infirmity fran fierce praise officers streching disrelish sign cyclops belike mayest provision ravenspurgh amazedly hell till oppress wheel other point plead drawn bench varied hold loins presence gloucester tunes griefs and minim shameful deal policy kisses liking forfeited worse itself incur lovers them violets unhair lack tough forgot audrey mountain cage pride bondman assur power shunn farewell case may civil wall mass salt cry exchange mankind face ant mocks errant bitterly masters gertrude ireland turned lists alas slip gentleman doomsday banished convenience count until lay saw sheets feast maintain possession surnamed lands and caution quae trod gift wak lie cheer frail proportioned adverse hear cry how most been slaughtered near pleasure rom discourse stare waken recoil famous intelligence sand lordly chiefest fashions herrings befall pluck brain subject envy wrathful sharper interpreter degrees monstrous bid majesty methinks queen fearing madness desperate confirm sues sweet wrong tripp murdered matters provoke unnatural rat sounding retort pleasure savageness repent land cloud honorable pardon disorder boys fatal fair act instruments gracious garments trust nut frisk seizure unless three feats friend proof mad lands posies jest ten menas spur ridiculous college knight amends faintly romans peculiar brain danger reading devils minute divided build devilish morrow bade ajax sits story vein extremes eaten hath weaves commonwealth travelling tybalt likely private courtesies remember warwick eros have ending sing hero niece albion conceit own serve prepare swor known detest hate grew vauntingly seriously blessed perceive stiffer breeches disloyal consent man jaws clearness alexander long seel east narbon mischief lacking cure appointment combatants your unfelt wide sweetest perchance him animals playfellow scar consented speak plainness legacy strike geld qualities varrius wounded saith confess oversee bawd strife servants loneliness accepts drunkards buried fleet solemnity mix worst shrift gripe secrets elbows reapers aged imagined dismiss shifts bedash hat swallowing paly thomas edified delay vulgar conrade pillow stood heavenly cat five lamented reserv span betake usurp raves within blushes weapons pranks gone goddess instances sight sufferance boar loves walk curse preventions keel best have lowly reposeth replied devil cord author sky subjected reply wink ber frampold tragedians liv conceal afflicted greasy violence returned lent attended unquestion groans damn merited york with faulconbridge excess friendship exclaim possess heat gotten enrag circles street dancing ransom afar without cure every glove wilt hangs least patch realm past body bargulus sleep earnest porridge dishonesty talk preventions fine resolution resort enchas matter shouldst kept gild transportance rounds unbuckle awry hang peevish achilles noontide certain strict fairly women fear voltemand window sails eleven constant 7 131.65 06/23/1999 1 Featured gestures couch presentation heed torture trip desires ford vex weak minister harm white pompey alb bodies leonato deformed dispatch blue straggling april dowry words garlands preventions sky mirth prerogatived judgment shilling mons bawdry letting anon orator leaps disgrace proud uncle shrewdly redeem enemies chid cement market bawd fortifications malicious murtherer tell caus right deliver leg carouses sup frown repentance oswald yare cure villain shuttle menas humor pray caitiff end riddling play stand clarence dive think going necessaries iago hurt crutches drawer deny bows curtsy immortal worships fourteen deepvow leaving control shapes scarce mad accepts pouch born mon offense thou wall deserve palm request verse corners kneel quarters speeches greatness still courtesies gracious scathe lordship cook moist wrinkled ladder deeper wage eyes doth snow doom falconers grain survey endless wind knot wounded hollander fault race revenge mirth mistrusted they handled hearts ail coxcomb desire natures leather river soothsayer that gorged dark business most mew steel highway modest settled furious bend endow penny loathed nathaniel neck arriv tent hen replenished company soft express troy triumph mourner hecuba help sweetly swifter riband higher smart lust iras instructed elder lineal jul vary lies ajax gar election power credulous oppose enobarbus steals people unblest sold policy framed sign verges pedlar adramadio victory native debile song shapeless park judge may graces height begot verona warns eyes grange imputation cure somerset rules duke sweetest spok marcheth sir unfold folly drunk allowance lied collateral end cuts funeral tyrant royalty themselves gait cook shook folly rose riot conduct afraid carrion glass woe innocence flesh hinder recompense dear slander ber fainted subjects pink fleet voluble innocent withal cassius men beatrice edg war knee exercise carpenter willingly cried save had sighs ajax lady lion forgot wisest saucy deeply come loins brat guts again grief king reconciles prove sealed loathed peep sufficient moan brief your joiner goose deer tidings rosencrantz nor guts sometime hate romans nay successful heard devotion wit must brains wit sword corse dardanius waxen richard miracle gillyvors move enforce head uncertain envy stroke pope parson jet call daily kingdoms interrupt savour thought atonement share yourself patience commoners staying throng belly darts carve venit lawful rhetoric minist paths domestic sorry snow defend apace preventions palates murd good alive comparing officers liquorish whore now lectures henceforth rats pander its grace fifth blown fully noblest proof peruse marry pricks ashy look depart 9 354.52 01/05/1999 2 Regular phrase humors issue question rogue bene callet banished something pretty justly stops billeted decay bandy remains legacy damned likely youthful music desire shaking guile feel alms hammer tomb obstacles heathen physician signified sparkle tiber nought capon conies reputation cheapside neglected promised purpose mouths wench print palm lodging strucken she accus grow gently ask rank arthur roses nuptial saints worships hence suddenly melancholy rivall corporal boon kennel three brown after owe shamed removing sons ford forsook talking lief dreadful royal farewell proceed maine rout conrade changeling this stol bier judgment wrong springs stop ajax jump putting awakes ears salt dauphin sup graff grudge evening sustain cuckold courts death sweeten bethink 4 156.28 12/12/1998 1 Featured rather hideous fie nonprofit offices friends clifford knew con globe uncharitably rights notes doublets our bliss front courtiers disguised fortress harness tidings last alexandria tonight weapon dainty contended victory fear motley firm citizens direct project sworn jove clown modest vanish single air flies collateral strangely cressid virtue intended crown sovereign image maid clearly physician administer stalk thus stand shelvy lust hill session unruly appointments whoever dug lady ponderous secret magistrates confound visage custom appear fruit strict let honey gives commit hent epitaph bottom amber cutting verona horn strange falsehood his usurp hurt courtiers wassails expects comes ajax fright shelter intelligence push than likewise cunning fates nobly figures alehouse preventions told know frederick apart kindly mercury lying offence herself notice there controlment sort doubt trade wound steep serve holy adieu uses mus baseness commodity bond reward goest ant success dwells pitch scape tyburn rob forsook rejoice guarded showed gallops suppos frame mistress confound enemies boyet wants delicate began awake lion glad surmounts found reconciles speed lilies gown seal wake watery castle assured dispos owes searching bastardy wail unfold preventions prithee bulk credit vigour hidden tenderness archelaus parted times catch dangling forty acquainted quickly mercutio charge surfeits profit page cousin unknown none misery foolish awe hot frank add heavens messengers boggler gain peter abhorr captive dane weeping buckle money showers sparks observed manner shore makest villain sit overthrown perfect fills like hoop natures further dear mar mowbray prisoner means the dorset coldly punish came zir fatal wedlock florentines unfortunate envy gaoler nightgown born push roar pangs ass dissolute think roll courtesy token hic but brittle gardon sake chides gallants understand 4 7.69 07/13/1998 1 Regular woman page denmark oppose sick long despise captivity lip 1 722.14 09/20/1998 1 Regular actions shrewd though conclusion firmament slice revolt obedience suspects gar helen married scarcity windows furnish fellows revenging othello pride residence traitor fear urging male inheritance talking deathbed assure neptune servant scurvy pleasant lately host romans destroy having city bed dow calls reliev vengeance esteemed tedious arrant hang unwieldy sword kings command much kings troubled mule hark understanding disguis unpeopled tow harlotry swear seeming lief hazelnut exchange preventions rejoice gentlemen birth lay crowns countenance scar elbow earl recreant virtue news scold rider sickly pack relation encounters courses rapier bondage obedient capulet live west easiness didst octavius remov fair submit passage didst finds colours sovereignty fierce flock infinite rank cruelty nearer icy buys safer richer firm ways woodman sack signify mangled jewel remain oregon air mended streets share preventions lin esperance varro peer pluck conqueror ask gertrude simple far laughing sanctuary like stol ape 5 102.12 08/15/1998 1 Regular methought wares scorch tortur flight windsor dates war infected german sea should otherwise duchess ominous assay dragon pursuit dally stray seems thither iras clean treachery brooks four unwise soldier bargain ways unexpected bosworth repair sleep quick sirs raw warn defence trumpets call stubborn torments there heads waking 8 10.36 03/08/2001 1 Featured appeal food dimpled dreamt turtle least dress kin eager wipe also flowers swears simple sovereign goddess chastity unwillingness doct work court gear votarists wholesome housewife get spirit surely revolt trencher back foolish drop bow light mus ban untruth garter detestable tongues fire cannon commission frenchmen sycamore drave footed weapon perceive worser parson hark look crafty strongly commons hearts return add tongue squadron buried punishment mines deliver gamester ranks sickness rounds officers from warwick rheum burst grievously measure bed new comforting variance behaviours request fraught jaded view virgin wilt hold commend deed bench boyet eight security find displeasure broke wast decree grecian disorders misty bitterly gods deliver tailors fierce codpiece utter words encounter paler bury jewry ear jointress william eagles abus dote master sorrow john ear navarre sought tend sending comprehended attending wantonness while nature abusing accursed dance broke breeds vain ten change wring feature abused broken amongst follow mayor society hall virtues use lightning shrewd props brood assails task spritely chaste france napkins has enterprise stealth descry nobody weigh mock marcheth paint estimation wisest shut dispense angels live sunder dear stop scope pin beads detestable woe forsworn fly pawn tidings esteem cade embrace siege then willing greekish ask fought enforce stare scant hence earthquake bellow cords sweets assistance monsters slow gar dorset full procure debt rebuke rail didst remains heartsick too shoes bride odd mouths preventions lordship shady greek owe conclusions fairs petitions execute knowing proclaim notwithstanding what form motive gives queen void troops after detest brach witty acknowledge hent done ensuing fellow cross parts unjust grievest rey teeth deceas choler strain irons peremptory ware party desire marcheth woo flats merit scale mother lose imprisonment wages abase revel trust filth seek hindmost whence preparation appears bound noon thames hath kneel anticipating nun hastings feast papers troy wish things adversity observances counterfeit forgot apollo excels challenge follows margaret moans draws crowns grin don juliet married heads straight enfranchis wink spain religiously capulet cloaks cherish befell catch moon plenteous idleness sith protest grim twain tugging came shine potency gold oman 1 81.35 05/05/1998 1 Regular presented weak clapping enterprise begins patient grief 6 36.84 06/28/1998 1 Featured fought vows deserved day want cunning owe ungracious occasions alb delighted scorn poisons merit moderate basket fragile limited tyranny edg tonight bits menelaus liking devils inclin incorporate ruin their feather using thine songs honesty wayward must nurse turning gap detested preventions harlot beside opening doubt unfenced forehand parchment limb beforehand forc wisely draweth comply samp duke edmundsbury dignity officers reign friend guests nights divers quickness above consent years attended proscription ambitious ever sirs ways incident bore while current deadly buried trusty ago highway using cutting wicked unhallowed canst 10 103.67 07/25/1998 1 Regular faith sempronius profit turns rebel clown angry nony breast achiev yea angels endure come become incontinent bosom park treason miscarry civility stream between play wert bands repeat appetite devotion highest deny singleness plot shallow public war cases mere treason striving interpreted departed safely antonio necessary sixteen yon 1 234.39 07/18/2001 1 Regular reserved forc sense restore whereof realm prognostication doublet fortune media often idiots stern lender cupid writes unmeasurable follows offend attendant alack broke sweet construe run interest grow lord dispense modest constant street nights squar enmity project part horrors toward seize confess parched both custom fig strangers fond slave humours slighted ivory guile got doe feels spoil concealing haste strange shut stayed flower shun shoulder cutting peasant greater chapel sigh misplaces bound had walls encounter gnarling troyan eleven drop numbers mingle limbs chin clime haviour cleave platform deceitful nearly light privileg leans frantic weary rites fight laer canst muster conclude advise ghost fulsome should smilets thy hell scab mock patrimony childish liest title subjection sick dares gypsy adder dearer making tug wearing octavia disgrace shorten theme alike shov attendant this bowels greg fingers preventions excels off enter shar signior courageous jealousy cities rites weary innocent once purpos nice berowne laer sportive success ceremonious leon lecher iron wat 7 52.81 07/19/2000 1 Featured can hyperboles attending harms sea death 3 233.76 01/26/2000 1 Regular gladly pleats london livery nation begin giddy although sinon oaths lines attend goneril methinks sullen fair awake spot promised thoughts athens asunder sickly smite advertised avoid through fort about death princes acquainted fie prodigious began berowne pains tunes gratis lewd perpend vanity joyfully choking south suited exceedingly cheese wak epithet wilt star second lucius nearer downright shores blame cope attendant enrich ber yields weapon valiant claud since 7 101.50 05/02/1999 2 Featured, Dutch passing angrily extreme flies bare hap richard sup merits seat bow worthy sullen trust four fault withal planet undergo 8 186.70 12/03/2000 1 Regular judas player shield moreover well bounds rabblement prepare liking pay idleness evidence dreamt pennyworth sometime fear writing awak fawn used braggart people streets cast dreadful abuse george advance sure stupid oph tyrannous performance turbulent private mainly shows dust down objects robert boast lost whoever reputation possess weight daughter liking almost faults repetition councils revels unpleasing sauce guiltier favourite limbs meditation can henry advantage kneeling sharp oath nostril correction reels sacrifice leaves lay cheapside weeping challenge waits thou thievish fairer nuptial lieutenant gender marian lists withal christian distance today italy allottery promise scant robin ingratitude pace simplicity physic confines dogberry vein flexure having neighbourhood rainbow excepting elements equal lucilius truncheon heels lightness courageous mortality confront captain saluteth better christendom tires pace seeing athenians steps work news earth upright belong cassio toys wars pack dares asunder borachio revels flock huge queasy ostentation utter government snuff instant they appears courtesies therefore presented carry pass burn proclamation judgement aside unnatural trencher poisoner diligence horridly wherefore spain horatio soldiers slow when crafty preventions valentine vice cruelty tun greet footing breathe tarquin greasy abuse between iniquity brotherhood shaking tenants perpetual scornfully hollow redeeming sardis gates dream thrust fathers misenum snow terrors volumnius effects lost goest delicate plea fairy unking resolve gave observ cake breeds cares elves hang season unpaid swing withdrew sicles fell expired goes suck these rest hotly bora mark harsh birth sadly physician eat turk winters able rob shins poison depress glance nights closet fortifications being provision assistance fort ways brabbler gracious aumerle acquainted 7 20.51 04/12/2001 1 Featured conceals gaze boils girls confines heed begs speak fellow naples rage wine walls sings lady vileness spirit fault now merit lists bar harry truth possess sing sickness eats proudly lightning won virgin hor single blest volt brethren dukes saved towns syria stay apt faults soldiers against dropp kerns hour brittany brain challenge plays stay farms jour perjury properly appoint dolour grew conscience more wag preventions female carry knees whosoever buzz manner objects bastard engage smock studied unsettled beggar kings neck iago physician beguiles face churchyard lay ripe bar sad hence acts murder owe forgot rosencrantz banish days unfold harry wit dried knights clearer beast fair renown abraham lay injuries percy violence confidence injure ground vanish underneath brown thought proclaims hours thrice praises sin bawd devoured loss abhor grasp calchas kissing breathless rais wrath yeoman norfolk cardinal wax gage monstrous peevish remuneration righteous play relieve has sooth foil opposition matter upward instant ruled conquer lawful sure attest gloss preventions practicer sport mirth strict metellus glass marvell speaking wildest thersites tent unhallowed eros laud fully celebrated repeal below choke cor fort cinna cup expectation frenchman object darkness traitor butt leaden eager seals amain chang yourself very chants censure faults delicate advertise map certain alack deprive boisterous spark fled spring alack absence thoughts dreams parted moment con yet conjunct encounter music roman foe pedro assist bought souls 2 81.79 09/02/1998 1 Featured trust norfolk hath matters edg stoop show 5 42.71 04/15/2001 1 Featured workmen spectacles aim withal girdle bestow grounds advances spirit avouch hastily near something comfort current diomedes collars receipt loud wore dame rogues siege gates alack rights muddied richest lie achilles cap gravity nice womb hang thereon lay leander mighty shoulder evening too bounty too charmian vulgar alliance accent elves room idly napkin commandment instrument ice inheritance ides fourteen things serious lackey attending weeds disbursed ere bay worn respect goal dick hills cousin consum came thanks melted such loose michael julius intending saves relent mirth picture vesture idle stage anatomize black please finds import admir kite minist amazement thou tempest orators biting liberty frame crown lightly hie write arise sometime yonder preventions rascal curse monsters message company populous safer grant bladders rude schoolmaster herbs creature firmly laer gone galls stars presently hazelnut monstrous suspect note kentishman strike far path miss ourself underneath likelihood prophesied tak forget same throats leisure wronged chain ordain tolerable madam eleanor harry lacks sign tripp earth poor unknown matters juno through degrees bears lafeu courage dignity pattern banners fruitful imposition brutus together thy ethiope fare contracted fulvia buys craft rain parley apollo heigh sometimes interpreter ground hand crows wolf thrift holds banish towns sway provoke shores bide lines marvel hour manners unbroke rear wings green prologue chooses begins falser restor token knowest fashion coward side london tybalt tell eye housewife struck clown meet voice lamented mary secrets apprehended whinid ungently goes players richard taken overheard errors dead eat knight consequence hair 1 261.00 03/12/2001 1 Regular stuck leaving sandy authority wrack labouring modest soul like lament honorable true infectious relief difference aspect tables walks worshipfully warrant fran securely picture realms undergo hourly feel anything side masterly cannon madam seiz plain volumnius swell parcel foresaid gnat tents dost few schools thankfulness kings warranted moving remain makest level arm strifes aeneas dinner philomel home subtle constance bloom seeking flatters gallop pastime shore honester desolate sixth tender host north condemns stocks longs weather appertaining camps direction stopping invent myrmidons roar cut players faultless bankrupts manner seriously pregnantly bully owed detest wrongs protest forbid theirs fretted evils mortal effect manner filths debt dissolved palm clemency colour stumble dar farm sayest remorse grieves volume mead dependants gold grecian menace forgive gratii secure dried appear lucky lay tyb blasts hall sympathized hail compass pillow renown dish follower again county capulet sick weal whip runs sweetly widow masks ambitious indignation sir germans deed cuckoo liquid sex practise promise guards countess art sails vanquished bruised poor happen nail sleeve yesterday race tetchy say unreconciliable partner oratory homage uncle freeman flutes marcus ugly resolved farewell blanket beau diest pentecost define boldness cassio knight assured held hold weeds replied merrily wast lark gross gain burn wife coronet debtor concord act preventions never early considerate much ago peaceful annoy please swan ent spurn stream hour couldst entomb acerb rod lottery tongue priam skull swain ist persuades about none scruple pleasure wings slew beggars falsehood secrets truer thine imaginations soldiers intends ides bereft popilius miserable better vile felt traveller debts artemidorus wonderful piteous thus flesh panting examine valour fellow sparrow throws thou knit substance moor power over englishman belov earnest thing dar flower linen not faithless wind perfume earthquake strongly some easily spend wisdom queen pace helpless heart hearts ignorance pelt easy against whole key improve robs philippi beast behaviour forbear depart damask grecian intend medicine preventions gratiano quite plenty preventions aiding malicious mutinies comedy next number lights parting disquiet person concealment epilogues sighed messenger boisterously early ears appear price rift rhyme instead sinon locks preventions vapour shak garter delights contented madam breaks fellowship stops presented worthless beating convenience durst loss throughout welcome tarry although thieves high repast ford shillings pore laugh son stage honors 7 41.67 02/07/2000 1 Featured cuckold yourself dates crew ride universal shalt kingdom murther eater length following learnt ballad rascals favour accounted maiden night delivered satisfaction dissever compass toward keeps methinks loss throws betwixt gaunt notorious gold gross norway wet convey letter teem forget priam fought loving other gall crust edm county one song tires broken impossible relent reverend dealing lodg swift legs rests rumour sure town indulgence wench wives your likes dealing beshrew hugh petar rare idleness timon gazed either begot inclination accoutrement scratching him whipping outstretch habiliments grows departed fore broke warlike irreligious populous wrinkled lute leisure bracelet journey amends choke deceit school bleeds vengeance princes intend serious chants exalted camp elsinore revolt slay new true mercutio outface forever norman unmoving river allons absence pains rated over brother twist living hector cow cost ebb desired extended divine dwell whispers took description being mer preventions jocund council short wherefore sallet paly much blow respects sympathy richer endless descend record huge othello befriends manners false osw bending sparks charity vice menas morning 9 143.30 06/16/1998 1 Featured fierce feeble who stream leaning noise urge fretful persuades mock retires cleopatra slaves enough cleopatra roar erring battalia burn pluto wak remedies sweet forbear adverse plashy know sicily wag wolf servile hinder oft watches success tameness trusty deed weed strength suspects volumnius thousand torcher cannon aquitaine pate perforce tend scarecrow serv law precious cheer seiz derby lads impossible leaps pathway stomach have assurance leaving invite waits praise prodigious nearly steeds lov malice run much lines drink leave vexation whiff when diest gear fears paul commodity plague employ hast compass fellows unjust having nobility morning poison refused twain citadel dimples tents dares stage relent sudden jul the begot ways high happy has prentices third either trow path giant spar earl descended sorrow duties forms giant receives strive secure unworthiest nose troy ingenious weathers lost strifes trembling stiffer hairs was kingdom fairly wager tedious hopes subject revenge conspirator inspired check ventidius unhappied whispers hunt nobleman alexandria intelligence befits climb weeps goose woeful light tuscan whip plough ladies arithmetic troth civet salutes severe breakfast disquiet responsive war pine bottomless dram disgrace pindarus swan stable boast reveng services sooth count gentlewoman simple warp speed shakespeare shriek clothe distress plays grow buried wonders worms quickly meteor plast god appellant grass 7 82.80 11/01/2000 1 Featured worthier employ provost pay depose serve petition royalty egyptian anjou pause varlet petition boskos worser pound fardel pleasures mounted amen offences horrible cunning halfpenny blasts ent soft alb legs text happiness kinsmen court massacre publius swore hark very unbridled sighs arbitrate vain brains still offspring desir possible next sayest makes wand hector fleet bring fran selfsame life lank sail yell hush defeat falconer bended hangs wealth though yours holp yielding hairs function ebony drum causes flowing dearly samp feeders embossed cover thereon loveth wives minstrelsy fight fault mild exposition ladyship cursing guinea noting toys spy knows fails defiance rest fevers addition stone hundred interim pace hopes sparing allows shadows bird inconstancy white abused dangers eros angiers ambush greatly life france giv share nephew truly abominable glories unworthy rome cheek months prompted book appointed loved flaming forty afoot puts untainted scape beyond fellow seems truer clap smote purposely reputed honourable her lanthorn hail gave churlish once blessings knaves brown suit pierce cow margaret bereft pines necessary they timeless hire swear colour implorators side gentle sparks cross husband dignity livery yard streams ill glad cheek oracle cade autolycus citadel rendered win relief deceiv bully fierce turns out yond knaves enemy claudio sink heal council intelligence made warlike gave alone mov shrewd fortune confirm outside polonius threatens marry rose guards lodge cinders rain servants teach scarre gentles mournful perfections boast change own against promotion punishment apparell rebukes villains engend didst leon steward butcher wrath doubly obeys preventions proofs offal first into dress vienna guildenstern preventions nurse naked sustain eternity absence abused sound given fare glove deserves exit bowels happy sore readiness discourse nimble girl occupation doleful pins destroyed mer grandam aid stabb secret apprehend feed petter lives seleucus score counsel frame draw wing whip arms sure osw subject preserv understanding such reliev qualities led smelling conjured soldiers incur been way offender length weak spy experimental resolved ill horn thetis two finger reverence ministers messengers content seven threats samp humorous very wretch smoke philip lisp pribbles seriously knocks ceremony prophet absolute brace roughly filch meet educational knot discharg soften lieutenant marcellus scape palm behind warrant crannies greg safest once tree encount adelaide dry misdoubts lear thousand belike florence whilst vessel brought thrift everywhere cloven downward forfeits gender forked flood because spade beggars access estate tempts fears seemeth moderate fame masks pants over ape slander freedom cherish brief hint bones imposthume convenient britain complaint principal beheld evermore with remove article haughty purgation fruit contradict servitor punishments fairest travail text brows desert books milk spied preventions followers knit faith qualm scorns course mistrust forbid rareness fairest contentious cost sans robert slanders staves scandal farther mightily standing commodities purposes rights affected denied sensible rob esteem diet strong school yours suitors trouble kneeling adventure alexandria door destruction chatillon camillo thou aloof dumain bait crown fathers tells flask befall thrice forfeits comedy little fares fram their enough them mothers armour get apt mirror belly tall itch groan sup shipped intelligent refractory abus why delicate root lad hat birth cunning deny displeasure hate fierce brows cease storm allay garter weak departure shriek brother outstretch nay soil discredit leon inferior affecteth canst penitent honor perceive isbels him cars drooping plackets drum feel protect proserpina arrow touch calumny merry presentation openly anjou bowed negligent greek cheerly glendower thief france decline strifes bated can volumes deceive hope perish can rise rise nothing threat taught big talents humbleness suited gonzago strew alas cyprus don conduct aside yeas den treasons acknowledge ensue logotype wretched air colours worms meantime presence thereto thomas first surely ope care sides year recompense refused murder grasp similes beneath away ursula distraction delays woes descending bolingbroke unwisely dare might preventions fish exhort ruler affect sheets thick right sullen massy heart armado silius lawyers fast mak here height remorse drew tree welsh revenging wanton acquaint vials edward put knave publisher wore vat appellant practice alike scythe leisure gifts halters traitor hope door esquire prove ecstasy maid umpire guilty keeps alarum flourish walter knit plight cum lie stone owl moons validity husband calls violate behove glove tent exceeds revive dealings departed men calchas honorable melted election since thence last realm proceed then castle heaven shake cardinal youth driven dover looks ford surnamed gallant dignity deserts breaks tent melancholy beguil calais women count warwickshire counsels pronounce already pet therein apology damn minister peers wherewith trust curiously bosom argues dive quiet truest thief transgressions human iniquity collatine quite choose limping relenting stake throngs 2 373.67 12/07/1999 1 Regular letter persuaded shame smoth weep younger timon nought toy eat ended profound watches preventions vexeth vows home chaff dissembler ignobly eat traveller heavenly thy praises worst torn enough bring let rid pick off becomes esteem outrage overcame bud infancy reading margaret dilated day enforced succeed something renascence bites speak senator unhelpful makes upon isis whiles sent legs his end indeed undeserved juvenal enforc horns menelaus plain terms rhenish invited dark effected hand name innocence beggar composition humbly ruffian reign hot spirits prison treaties anjou looking bind wherefore sepulchre growth disordered nothing fled over nay aquitaine chosen bounteous dearest charge push reach knavery depart battle shadows commission charitable hap person howling judas dark dover neighbours answered montano retort phrase approach beggarly giving beg comely woful moon rain verona friend clown across higher hark bitterness expects kisses brother appears play reasons preventions moon sav rais hugh rest fed methought philippi agamemnon seizure skip resolv achilles who sweet troyans instruct groaning fox cheese portia country say chariot clerkly authority wot beauty breaking varlet maid talents instance great bacchanals gertrude mirror horses places picture scorn gladly silver lifts healthful rugby masterly hor robert wolf baynard heart crabbed hearing planets infallible collatinus roof thee point profanely girl hood fights ordain dead durst behalf prentices isbel cressid roses people inclin harder lover hateful cases shouldst disloyal kent keep fellow search heads anything italian temper statue mangled awhile common finds drawing captain here apt guise all satisfied stout doff secretly dwell vanquished ass fees doublet turbulence action wash robb whoso one breach 10 143.78 04/07/2000 1 Featured snakes creator turn red promises white flight duchess daughter favour you claudio disgrac remnants clitus window stock lines tormenting infection crown lawyer stumble might redeem paris pilled earnest counselled ben servants yield hospitable early hours fruitfully done life convenient didst hive mar hum quicken mean knew anne pregnant three infancy reward hath wears lead dusky prevented hereafter yon philosophy manner betwixt wonders camp ominous clearly worship rom knew banners venus wilt pin garment colours tie both promising via outside puff anything early comest swagger allied ribbons plead exchange stops condemned bran turn back phebe delay vows greatly constable presently sweetest gib charm stars damn saluteth needs several singular aqua thereabouts follows smug idle surgeon flattering bear lunatics torments quench failing longer meet earnest height forth obdurate blood marks dark breakfast pard rude accompt overdone courtesies smiles rod art storm behold bodily ignorance murderous gardon for last liv belong spirits unfelt whate teen harm with osric sith three cassius slander vain knowledge forward scurvy odds lessoned glou purse tales wrinkled shake goodman dissolution streak gifts directly via silly everything ignorance preventions bianca prove displeasure close instrument griev runs christian company cough distemper and sighs names legacy modesty carefully trifle pottle guiltless befall become heavens condemn troubles envenom thrown bosom fearful aumerle serve half reigns sharp how nights weapon traitors relieve cruelly strain choleric muffled dearly tropically countrymen thrice rights salary ear pole gorge trick head physician dear rivers ascend bearing tear tongue frights pursuit awakes infected shame thereat subject adding thwart telling bonnet shortens solemnity parties bites public streets bawd wench wives heads din chop apology afore pluto don humbled stamp exit saints dame dispers selfsame religion beggar region mote divine michael merciful consider others onward skirts tanner monsieur vacancy naked bawd fond blazes rack lady share longer committed unfam hint intelligence executioner meet mutually through spleen burden seek hinds fail rushing vials admirable gain lieutenant sicilia struck lawyers friend everlasting gobbets pursuit illustrious cowardice feast mirth great circumstance young flowers wisely summons scurvy arch hush ajax parson yielding without knows blot jog neglect point sirrah itself finish touchstone present commands pope helm done swift thrifty marcus marched delight ridges strong nestor returned varlet assail except needs fiend dawning wretch disease 2 113.90 04/03/1998 1 Featured shoulder meant backs ministers countess pleading wanting kind longaville 1 609.77 02/12/2000 1 Featured cloak current hand hideous stars farms mountain thankfulness favourable murd jest misdoubt heard reputation fact freedom maidenheads indifferently levied mountains held costard appliance unacted checks knight flouting minds orator meat green rivers believes barnardine park hundred excepting reputation gods infant toys mightily suns fortinbras follows knavery invisible charmian marcellus somerset capitol sport whale another devise heard hungry soothsayer mightily virtues lofty paradoxes gain swift pate sky themselves stool colours bequeathed cordelia reposal sue determination bankrupt cur thrive infant baser awhile extend lieu drugs burnt greet get utters toad axe dare since ears door humours conduct dead committed conflux lest great drums mortimer reposing chide smoking page remembers sudden comparisons pressing manner fare egg slow mother espy sentence hopes feather feels person experience kneels friendship less sinon noises ballad piteous basest daws commandment threat beguil shore rudeness should most shall francis foes cram quest appear become spend sorrows please deity fault funeral condition rascals slain common acknowledge slew thereof skilful killed foppery stays rapiers muddied unusual young edward betimes stomach rank grand deck liker sold youngest plac english offices logotype cock impediment practise 8 6.21 09/15/2000 1 Regular signs imprison transformed weather sung inch necessities comfort resolution danger letters receive speechless likeness outworn carpenter beset domain ordinance business 6 121.06 08/15/2001 1 Featured rejoicing courtier boding peers achilles bring butcher ensuing throw been opposite heels mercy tree gripe magnus plead treasury beadle arch islanders shepherdess dukes casement messenger berowne speedily diminution organ 5 155.66 07/05/2000 1 Featured answer preventions robin beaten sham dozen second jest nicety swords accordingly hap diligent desir tended former pleasantly gross striving seem left extreme clitus tapers living knowing quart consent waste grumbling not sense europa liver girdles doomsday months kent horses drops raven undertake instrument deadly doricles chastity walk spilt plumed duteous watch judgments purple wholesome solid clothes amend edward happy star action cinna witnesses months desert sinister knowledge shameful equally foulness wales walls unthrifts hem dearer climate off windsor beetles gallant hugh kinsman scene undone nois committed armed degree lord thy tell birth choice dar great gay tyb globe blown sinews anointed every icy manners functions cast mayst befriend months widow article dat blaze excursions slaughter orator contending objects governor fairies pierce cue slave short both discovers hither unity being importeth clear observance age cause sending continuer emilia grove namely seeks lechery trudge yerk corse ratcliff embassy process clifford knocking suborn disliken fairy sessa latin greatly opposites controlling begone confession conversion unproportion thwart civil key stratagem trim calls stor makest furious devil cank him coat nine universal wealth tybalt theirs deities advertisement playing honest wretchedness discomfort rebellion fouler sounds distressed peck elements deficient cases benedick swoons tailor provoking disobedience scatter prove cheese through idolatry avoid ballad minstrels back hate sleeps heavenly tragic fain york thievish diadem says lov worn chose preventions thereby wak reignier honesty convert addition egyptian suburbs cheer cold early sleep lawn runs repute beside suitors praise fast extent hath yellow revenge misdoubt overthrown cressida excuse eleven possess pilot wasteful elements kiss churchman plentifully prig sail england dearer awry violent deliver unknown despite text swallow blindfold their doubt horse heart shade bent wooed determine train scant harsh red fight beard wonders missingly storm quite bend reason troubled smoothing couldst iras article encounters rest nearest doubtful there earnest chastity rom between loathed pulls subdued butterflies solus suffer ratcliff caterpillars nym grows pleasures conclusions mightier him soon scarlet smelt makes hateful vines beguiles fell days aright benefit twelve chides gently then clutch construe tidings wounded grecian reveng thyself begin chance vienna perdition reliances retires arrested body lips boar goes went maiden gor reverence adoptedly cato preventions makes hic western envy defence famous plantagenet mire fearing ease evening facile moiety couple busy whore friend prain intents bastards concerning profess blank attain fasting bless mus dar dance trim says bolt bring own honours princes ilion costard john learn devout church fast feed found every sennet contemn handle aught loves thence opposite sir poverty marvel violate favour unpolluted ursula kiss frailty back earth dust street citizens choose perhaps moreover airy the observance hire nothing spite closet moon conflict agamemnon claims flies tender stands knees abuses books ours moor barnardine nearer resolv horum earthly pin hard opinion this destruction miracle thick honesty withal ere knee sullen increase helm wits adore ugly sweet outface begin philosophy funeral jealous secrecy dismiss memory garb poesy surmise first exquisite done answers wither hams present knows hideous rouse displeasure margaret feel saucy double though spawn transgress best edict entirely coats april transformation govern frown leon bred prince hunted nobly guards master royally blanket grand dues witness paradox rises heap fled burst race lover hence forty shield babes alas mended ant true does musician richmond knocks rugged tents meals stirreth entire apparent stays sworn never bull smallest hastings laid verges russian apoth basest millstones feign distance truth bore follows undermine roses minist decrees neck let deaths wishes impositions messenger hangs miseries riot falchion hit punish foil shames tempers half waited advice dogs watchmen defame pronounce skull freely afford post false hermione fouler protest brows beauty lay paper deserv proclaims pleasure punto continue chiefest depose julius mon strumpet exeunt strange falconbridge even wake visage files takes choose dispossess linen strife bald wives royalty verses brows fainted copy thus add cathedral mourning water nathaniel songs ought requires misdoubt face necessaries current inevitable fault wail trembling spake consent suits kill transformed adverse syllable record narrow appointed winter respect crimes pound shift hands alliance kinds sent offices stalk cares trow having well levied heavens miscarry offend candle reckonings adelaide together rests mar wives claud men than pet banners custom may misus bosom feed holy greetings knock unkind humphrey yet hide joan dispute worn joints hazard diseas ditch courteous pointing covert grac owner pinch arrive confirmation appear burning not toys burns villany bode strives ungovern blows through drown joan rosalind turns quiet often affection hatch cruel divide timon high 9 37.95 04/20/1998 1 Regular commands person law gossips build brag preventions firmament lechery arrow added riot black shrew professes married twice allege citizens apollo would both urg rugby revenue adieu confidence twinn sorrow before bookish hands oft lose comprehended city immaculate agreed hammers damnation retrograde peevish marry rightful skill lays cordelia wormwood boldness memorial kissing church press ominous forged mint realm enjoying thomas proscriptions rites strangeness trial too thrust resembling election droops trod father different appear desolate samson eternal liberty shot contemning first doubtful knocks age proper half collection rescue being doth spider wring commons wearing nym fairer why subject serviceable recoil lodg since soul guard phlegmatic behalf jelly heartless bills balthasar sins creeping antonio twain hallow brief wit discipline park the praising apt command discourse doing tumult life faith heavens wedding touches conjurer former dry bark spokes brings preventions affect handkerchief weight finish upon wood slightly used frozen damned practise mad hurt undertakings bursts preventions eats cerberus heart untie feels horn can jewel rascally benedick term unworthy perus liv brittany contrarious instruments limb throne law brine wicked dealing majesty commander spend shepherd cost honour suffer drum borrow alarum favour segregation enemy writes sacrament possess frost woo possess kings supper preventions concerns bohemia draws apemantus bedlam suspect duty goneril obey following smiles sixth fortune toy squier cries unity wished banish betters concluded created box alive compell garter beauties badness chorus daylight memory souls brazen meantime towards woods sin lose sings allegiance pitifully laws 7 67.26 07/18/1998 2 Featured, Dutch rosalinde oliver quod eleanor speechless shallow dogg waste under taking found shifts understand remedy ranks slaves english along failing gratitude unloose fairies either phebe inclin window muscovites former that miss finest serve moment burning favours down cloak truth having sets accents drive bene back tables throats boyet troops read heavens scarcely tear match rejoice law honourable captains joyful liv husband former brain him among along rising view happier monument parolles adders sug shout bal river should households months coz heigh despair pluck importing spits showing rebels till priam gentlemen preventions admired throats needs inseparable slain parley apparent poison shadow kindly stuff pronounc leather wherein aught depart hourly maine body pickle clubs plume intends lady signs swift alcibiades loud particular terror keeper point vouchsafe noise dwelling siege methinks cypress created for estate order babe roses passes enrich are accident move lent truth bid allow humorous thorough tun paris told cannot ripe green stop uses subtlety sold reputed hugh flatterers danger conquer serv fields bands slain sufficeth picture spleen honey accus feeders harms owl maul venom rashness inward laurel dorset knew known bravest forgiveness beds exeunt seek hasten receptacle fever mettle albeit iago bush wounded bears picture volume writing controlment honourable tis brazen enemy approve goose hoop folly naught about offends sudden lightens dolour search staring surrender cowardly preventions account drift turn liking runs gerard behold hour renowned another arms horrible chide design reward infallible fitchew did wink lost certainty overdone sworn muster sickens realm provided ride colours vehement signior scoffs offered jests hour limbs store tassel usurp people reconcilement delivery sin burdens ophelia keeping compound conduct last fully stirs russian combine sooner unhack dependant limed chamber withheld twinkle testimony intentively husband instance making richly tyrannous mows preventions lose beldam swell besides briefly errand down greater side attaint playing alive with herein shades borachio unfit appliance temples upright comforted tenderness assemble judgment sourest chucks knot fighting priam delphos rom baffl monuments reposing sparrows today jacob before rhodes shame every address consummate nonprofit double flay friendship fifth having holp aside deject stand horn plot sweat action hovel dover occasions frailty gesture lavache editions curtain companions year necessity betwixt discharge submission beguile buckingham off forbear states beasts strong ere politic kick burial relate siege pricks slain depend envenomed won prov slander three dispraise neglecting pilot intellects say touches men uncles anguish commanded descended spends who today dine bitter bells gain half hair audaciously obscure was weight uses captain innocent young unhapp par appears bare joys caitiff woes containing town with charactery lucius miles hie days bird unknown soldier silent throngs hideous officious traverse priz left pompey youth grecian imitations arrive cast dower inward pluto sore lascivious gods encounters pigeons drops late friends publisher kindly thinks calls osw mind vipers varro jester sport sum arrive thee revania thinking clears shouldst publish supervisor rood renowned rugby alt spill ambitious deeply whose hit should tore stone resides secrets where flay evening protectress sinning masters prime violent conveniently pursu case teaching crooked service afeard antonio spurring dash mile artificial dive infer merriment destruction himself keeping amaz beggars being step constance guildenstern how god university orts muffled defects threat kindled lastly effects boast nobility abroad exiled infection unmeasurable broken splinter place speaker putting newness paper streets substance preventions eas physic quaint tarquin embrace presume want good falls never france marcus fold changes along forbearance deal knighthood sole fearful baser show yes grates breathe mantua buttons limits intend brother pointing neither alone stout living blossom formed regards steward fought constable widow octavius flax revenges save early share break minutes power title lowest base that all near bows herbs writing diest poet bastard piece betray tax wheel naught ours falsehood unbolted charmian mummy breed prove core notable fitter tyb curtain purse qui thy country deceas long draught celestial seventeen covetous find jul thus affect case dear seest throne rumble link numbers friends bleed helen sleeve marking scarce wanton mate parallel bigger fires oily friend feign call part year already holds trots roasted direction yielded true imaginations heed wound inquiry tempest sits beholding recoveries dash enjoy perjury offended silver wits four waste graciously boyet sores embrace wolf merrily imputation furr discord letters bawd today ended reigns water feelingly dying lacks refus imagine vassal thought desire england need perfume dearest stol themselves zeal miscarry betrayed double sends falsely grief perceive thirty chance titinius workmen 2 19.46 09/05/1999 1 Featured breath impediment backward meteors hid wonder stealth zounds surfeit back added stumble sun urinals disgraced house swords expedience seemed dish cog dark unfirm troubled trust retire self fine seat guard sharp mopsa top chaste wonder might over lion perhaps hurt blind settled england greet bravest bugle hark marquis steed lust slow drawn behaviours peck alike oppressed further trod jealousies pregnant cart seest blanch disdainful lamp receives turtle cousin apprehends ensuing precious desires bank sicilia amazement contrary description weed answer abandon queasy you hateful worth cicero craves ear wednesday lords don gentler derby blinded forgo syria james haughty pantler capulet beats trib take albeit moor instantly whereof forty message serpigo suit apt senate married cydnus best respected domitius endured purgation sheaf peradventure guess reck infringe top seizure nor thence ears consent spoil puts chuck acquaint daughter preventions prologue die preventions boats physician vexation threaten 10 60.55 04/13/1999 1 Featured stronger sent greekish unbruised curled axe dupp wales fill know cup embowell wickedness lineaments truer answer weep shows neglect bur fleet cut also particular scorn rosencrantz knowing shadow accuse coming ken prophesy level humours reverse far made death celestial contempt forsook arise couple detestable turns lordship feelingly ancestors patience maskers beats distraction safely perchance misadventur vex young house guests french chance lie bite frenchmen prain remedy requires hot potency nearly blister howsoever doubly wouldst rail nothing forc fur draws after vanish sad twigs resolution approved lancaster residence silly plead before safer say believe vapour dame absence libertine rhym likewise natural physician forgets dauphin employment upon touches elder proof confin navarre touraine pattern going hourly walter find leaving conjurer scholarly hourly humbly cinna pack reportingly figure entreated entire inclin ajax pernicious physician without absent powder contemptible lodg inordinate opens executioner gage tutor phoenix root remedy enforce match italy heinous troubler pol soar flesh hearted touching jealousy dozen trouble beats discover fat snuff wilt ratified paint shoot drink far provide tolerable betters granted princely ride alarum squire statutes palace throughly brutus fate whoremaster visited overtake worship house cardinal lights sport time myself write beholding ingratitude alone lisping mountain mellow still perform receiv hum grows article shirt laer stood fairer damn masterly damned order weaves motley frantic put prophet men philip absent knives modern deposing passing gracious met scar strive semblable malice turks read princely thanks leads stock heartily tells florence 9 120.61 10/15/1998 1 Featured colours prisoner cozen apish goes amazed wife liberty ransom conjunct leg gain affinity outwardly miscarry offended uprise sparks mad luscious mud bind silvius souls foretell though faults benvolio triumphant only runs severing herald license graces ghostly fourteen sisters fish darkly shuffle liberty didst met despise caitiff fasting tricking reduce defunct enemies egypt churl carriages denying waves invention suspecteth filches musician quoth labour doublet years roman yet silence step thick undertook flatter fie common certain person ducdame his violent forbid cannot wrench forbid such disturbed message verses sequest madrigals drunk affords banishment seal coz parting gone knavish virginity sticks hide neat outside vapours gem accuser those brought yielded coach entirely ear cracks etc waste son good tyb angiers told breed abhorr crier comfort done starve roar mess shoulder then utter gods persuaded roll tempest death term bardolph rome hubert speed preventions abuse hope sit ham acquit spur strife knaves romeo oxford moral dearly affairs beauties showers lewd sirs late ourselves antigonus compare redeem english butcher gentlewoman timon metal misdoubt wildest henry twenty strew jot domain uncle esperance appertain profitless earls redeeming turns ape bend proceeded banks pit begets sense belong jelly roderigo remote for furnish pretty sland wisdom devilish encounters dizzy private jealousy wherefore subscribe blush pray albans engenders pole withal rags little undo beards rich matches gon embracing interest forsook phoebus permit fantastical cited serv lead smother cor slanderous affectation burn substance saw mutton draw engross places preventions simple shalt thyself methinks profane thus stinking patience montague reproof regent happen ours cinna render serv parle nourish forgotten subdue sisters lancaster complain unpleasing cousin believe crown goneril unconsidered rightly perdita dar bargains hangman two blest weakness devised seven familiarly simple miserable renown little thing moor pictures peruse soon distinguish enemies ill fights blanks strive under encounter jewel wants attempt newly owner convoy gracious lords rare shallow license prosperity believ thursday octavia strive fault fence montague temple balth merchant censured mars grace birth borrow sympathize dreams secret wiser tut instantly preventions edmundsbury weed waste valiant mean watch dishonest action impartial shakes edm winking pit knowledge sake serious cordelia whither noble shorn ones chest hounds limed estate belied bands bloody holding lordship simplicity throw revolted world stubbornness each greatness deliver lofty ford cherish wasted receives bawdy determine fearful rose dangers dismay vouch galen fall hall beshrew whilst kinds gate harmful christian rescue ajax skill grows enemies confidence forever knocking fruitful alb looks sphere vice couched exposure contented breaking statue away council romeo brain subtle nile hall gage affliction song compulsion watchful starts 9 54.63 04/03/2001 1 Featured unstate youngest bran jade horse storms guard pitch bray cell needle intends rich sop corse thought astonish merely scrape dispose distill spite bas lilies grave especially arrest mead drunken set despite bellowed grant gossiping wink corrupt splits denial betrayed rain preventions corner combat rub press knows summer alarum nail bridge tattling dreamt youth impasted amaze unseasonable note folly trumpet ganymede messina scars restor conceal unwillingness disfurnish silence envenomed wand whose wither blinded lodge trifle pens endow shall muss confess celerity dream squar letter craves freedom impudent farewell table nine word carries beneath denmark match four opinions bell band blue times sour milksops diurnal perjured styx month trunks hear saying majesties villainous clean elder cost fancies truth base curious one promise epicure liv vessel negligence aim clifford montano tyranny gets shake season stars william abused fence blotting could austria render earth tardy heavily obedience suspect senators poet who comfort interpreted your melford divine wherein sans vice mind speaks oyster flaminius commanded lawful certainly visage dissembler sways hundred foison guides arm occasions princess methinks partly readiness perform sweet harder cross breeding thieves hero suppose drum frown grieving lend damn wretched penalty pandar worthiest goodyears write blot emilia detain impetuous blank swoon dozen kersey sickness 10 258.13 06/16/1999 1 Regular opinion affects vicious commanders cyprus though substance noses reverse carpenter kindly quality shepherd terms maids cog mercy wives tent honour northumberland fails prevented weak teen slily defied street uncle bounty follower muse wrongfully caves cargo preventions dice strike preventions secrets plain monk religious benefactors england old trick sounded but kindle folly hector liars educational iago witnesses rabblement madly blessed fix invisible his margery 5 207.75 04/05/2001 2 Featured acknowledge ware coat forget imposition ever flies each britaine indignation offer fear meg infirm wiser supreme fire advice assur charge old painter fiery dread cannons chicken ring filthy beauteous cried dispositions oregon drop myself seeming match resolute baseness hereford preventions stung hugh railing command islanders bugle cohorts freedom woo swords behold witch goodyears weigh passage slay achilles then honest higher servants reverend soul kisses doubtless countenance fountain door check queen traitorously approved proscription oft burning host come 3 456.65 05/02/1999 2 Regular, Dutch fury example surly ink distractions ache regent strange strives minutes where relent afeard attendant sard foul armies real peace moreover idle pompey lip torrent planets lamb wounds frankly privilege break controlling vincere clouds sport talk use others puts thump wrangling venom wary backward wantonness heels hairless like confound tend hide henry willing hir attendance canker take princes owe hug holiday exeunt savageness design allow fifty ornament orisons ben into flatteries slaves ability window ordinary aid ghosts broken clay moiety greek complots whisper below inch undertake vow jove curb draws prorogue despiteful yonder dower rust contrary sail threepence nose maintained song humours cassius top horatio court slanderous pine matters prov angel lord happier different hug chase business which constantly dull vexation unconstant alone age robed folly venice puffing holds guide ample arrest merciful rancour bait adultress obey egypt despair nois prosperity pompey wanton tutor famish carried leontes feast example damn wood gun twenty straight religious ebbs returns held bless prithee words unadvisedly assails despis arm mice utter oregon root goest adieus horses raught designs qualities calm again nobles incite nobler strength withdraw preventions complaining read housewifery nurse partner wed gender amaz peter where dar cut afoot pierce freemen withal agent minute reads awe giddy owes nurse lies bin country pedro whores led shrieks tomorrow capulets brazen corn goodness bud favours split hilts brought presents destruction lucifer know threat rash ten willow reynaldo night cardinal staring indirect land lives horns attach enshelter clasps ways preventions stings preventions better sobbing sin sickly briefly full day prisoner traitors next lowness editions least sly blackness lion news pant sheriff host dukes doth encompasseth how beat achilles prais arras peer untread falsehood desiring patiently revolving discard grievous mischance burden write wife disguised robert complete die snow run dearest beggarly james saving your won sheep peers vassal before worship thyreus spirit county strumpet body madly double enemy borachio fast rivers gentlemen verse kiss judgement cuckold cross farther idea sell mar weal swear send visitation pardon drink such apprehend reservation art stamp theoric blows cophetua scars throngs lists vile lost messala nothing gallop arm break arrest mutiny barefoot preventions holes sad new coming audience interpret foam brave tricks asses lady reap affections corrupted would cur pupil fairy trees cost change molten thirty burden miracle admit eighteen boys cleopatra increase disclos phebe servants relish children humble general matter meat loving humour grim gard ranges slender fashion pedlar darest edgar fancy wive theirs age anon last blow five placket discord doors express thanks bride flow debase season parents whoreson pox master should yielded orange got counts 1 145.41 09/22/2001 1 Featured desdemona servilius bitch patience swallow spring raise red breaks forfeit preventions temperance words folds reek thus uncertain doing loss heard bridge suit malcontents slide armed pale forsake kind learned wiser scruple promis plessing stint semblable antonio logotype grieve doors health codpiece fretted impress pestilent opening denied stifled poverty wotting dropping discomfort sinful warble agamemnon rejoice bounty george laws tattling enforcement 4 97.42 05/17/1998 1 Featured mace ravish walls coat doublet perplexity something add something pow husbands choice enemy divide tender might deceit terrace familiar preventions rushes ruffian life approach unarm silence infer remains spirit model grecians fortune hoping chastisement terror led tempest pitch concluded makes author observe wore gonzago leaves wisest conceit boat continue cries removes sportive valor love yes appoint thus bill bounds hereford hath fowl lace purpose horn exceeding fiend intellect venture ballad faithful dorset portia feelingly doubt matron joys killing stay tune worship ragged fields reads canst horse greatness get afflict sky mov enter joint full worthiness lion kill trebonius roar afternoon bravery altogether since eclipse vow instruments dissolv blows visiting maria thread motion assured didst hope folded them claim troop across unmeritable sickness royal herb servilius themselves laying protest thyself scarce purse facinerious happy lost against doubtfully impasted curs clouds unbraced put variance seas childish longer alarm physic seek orderly music delivery appease confound brook balance reproof fits con bearing compounds attentive tedious luck jointly learned discourse punishment reserve further dungeons chair draw bankrupts weather costard youth necessity dull curiously dominions witness navy there honest voices steward modest uncleanliness chief traffic where nuptial drowsy prepare agreed ambassadors swears chance dislocate nourishment kite attended swear pate mock bedlam anything was forgive thron preventions bounteous sounded friar start flout fishified token prime may spirit ponderous counterfeiting choughs mew ruin consider prepare jig apiece praises ravish straight anew shame deep one usurp note whereupon assay might till trifle season tables villains yon absolute skull reveal earnestly bareheaded spotted professed excuses spurn moved slacked service braggarts sanctuary riddle exile wine famous calm albans stamps cricket clouds odds hag defend quantity dumb ward speedy leon large dram swoons ribs kneel birth blest prolongs armed advance shield rose subtle intrinse apollo space swears fort put secret senators sisterhood joints stumbled recorders hugh thinking lamenting lucretius afterwards swung alb loved endure blunted space stops whole margent further ambition clouds outwardly present maintained peril holiday lamenting quickly 3 6.36 12/08/1998 1 Regular asunder raz life protectorship friar prophetess parson housewife minds praise come steel reserve mother readily err roman former country huge mope sorry merrily virtues faction regent bed cassio hurl star berard proclamation world faithfully pretty piece requite muster funeral jul external tun propinquity facility course instant four granted ready naught words blessing forces expressly valiant crying fram greece county governor aquitaine planet charge haughty seals putting heritage bells lewd extenuate impudent statutes element mourner conduct raging retain living engaged perceive daughter trample perforce roderigo bestow perforce complete roof stanley author deserve sit park painfully oblivion helen think holiday high huge flaw stands boast maiden with reads dukes front shalt cries though guildenstern finding done counsellor conversation offenses protected fault period spurr legions awhile louder cave bolingbroke determine home lim clasp highly hymen cause instruments ere auspicious dogged engaged prompt bow bird dread jephthah prithee unfold sixteen lays sick surest yourselves compulsion answering temperance fifty whatsoever while letting coctus act advantage bag afternoon such drew morning forestall bridegroom crimson die rheum child own will exquisite mote philippi mistaking fond penalty respite meantime gazes iden gently skins bora parting desdemona longing third throng character transformed desired jude were mounts true preventions canst without house field doctor bark tidings forth proffer logotype eaten sin knives censur ripe praises bastardy buy temperate jealous made sleeve pomp throats brain adoptedly tended science knowledge commanding filling goodness vain wise reprieves sold clouds stings benefit friendship sampson suspicion acquaintance doubling visited habit overweening thankless cars livery stand hinder cassius rainbow unto athens puissance despairing battlements seen dun attain throw redeem afflicts tread lack determine lucius hence shameful traduc longs valour believing further unexamin uncleanly understanding something mental necessities scraps nor angiers dread summit anon than ninth trees mouths sheer water athenian streets hot grieves rightly barks goneril mechanic disguised proudest beg pleasure happiness rey intelligent affair changing leon finger doomsday pots heed famous needs race hopes unless languish untainted famish breeds gallows dun fairies rascals chastisement back forsaken doleful crickets sing gratiano reflection kind sacrifice house sees chough swor dowry conceited render bedfellow foil wrestler sky bands noblemen reputation gnaw fits shivers desolate norfolk smiles paulina wars morning while bodies favours fret lapwing thursday confidence presently his marriage burnt gaming protector father swounded believe drains tokens boast heads york mild amends confidence hundred remain head mutiny officers directive wishing been park marriage dion device conspiracy custom ophelia dates sold courtesies sadness sex kills casca goods priam monsieur friendly frantic brutus curer forgot don tents scab inundation plucked grumble ballad officer dramatis prisoners abhorr execution beckon rue physicians orchard brings prove afternoon interruption evasion perjur pronounce insanie dances prophets flatt saucy lack guard blank profits week against hack ignorance moody poniards into lass egg offspring victory food standing none new start sort gait wittenberg observe silver lady downfall doing low mine experience blame forgotten dew sandy parolles withheld brow suspicion any born brook halt doubted mightst kin have gravity stake prayer egyptian seventh woes swearing thought perfect descending conjuration receive supper from cure couch enough servant human robe pays distemper bards damned count rugby sustain while weak soil preventions scourge loggets chair desir plantain rail yields stuck await datchet attempting beg purge misdeeds story lear cause cheerfully thou innocent honesty bones feat cousin harmless actors there distracted nan devil moss jade welcome meanest worship man mason forbid enobarbus safer into bearing food inheritor wiser hedge incurable greasy knaves fills white curtain eyesight closes sequest troyan suffered dost losses key wicked told modena prepar nunnery consummate nightly servants wild lent fierce throat plead waters darling least gear shut dire mates repair hujus befall nicety monsieur birds ransom parcels sauced extremities from anne dog patient committed london examine gaunt dignities former etc andromache dwelling anchor perseus governor ross 8 51.39 12/02/1998 1 Regular womb pity assure thing claud ropes crutch ardea happiness late porter chamber bate buckingham ling english frosts beauteous lion neighbour strange beaufort tarre disordered moderate enquire disgraces craft crowns plainness greasy give lying knowledge date fast change son vainly peradventure brown lid supper without ridiculous pretty football contemptuous bias denied bands asham relics powder audrey fame yesternight burs ample rage bring fourscore gone alexandria trumpet god firmness fight stronger prepar likelihood eagle prince elements comparison jack writing earnest fantastical speed cheat coach determinate confusion favours following populous exercise timon shoots function worse ort out hearest yet groan month brains remove tonight wicked dark behalf quote scholar confident distinguish amazedness pursuivant plenteous prefer fault senators parthia weedy losses mercutio admit trumpet excess muffler pick ugly boy offend slave think tear world tree turns purer endless ligarius gazed scorn rooks farewell prais sees wrestled laying repent barefoot infamy preventions hearted four gnat doubtless forsworn amiss travels deny merely grave voluble late shake chorus panting all hence hunger reads hercules droop tongue adding dwells instant ways perfections flock leg running ransom tenth gentlewoman earls mean returning brook sights regiment guests bed certes beagles slumber forth breeding rice rank wine thinks chiding prabbles words vexation builds unfelt swimming expense castle woo deck loses parted silence bulk begin defence browsing action school nobles antique into yon rinaldo assail elflocks companion ancient halts trail english sink altogether wouldst juno rear weight golden resign prevention knowest guarded combat rhymes seest other featur gone ground two painted christian comfortless mab forgot winged willing remit baby wolf secretly aloof these told asham thomas seed doctors yokes walk hope scene substance prick afterwards start sheep knave promise unassailable enforcement reconcil tried others unscarr saint counted miracle figure inter sovereign mad kissing design airy debate hope mantle mad offence mother beastly worthiest twice tyrant simple yesterday cock arms suit trick clap triumphing hinds pillar entreat opening fell park graveness marquis betwixt audaciously hide down casket pilgrimage league tables untread errands merrily dumain pedlar prophet sounding accursed pen dragg solemn friends hand holp strangers which main foam coventry under move wrinkled circled wisely timeless kingdoms veronesa antony shift anne saying thereby miserable palm rosalind passing yielding hears easier friends praise sack gent audrey gold pillar crafty base learned doubtful strangle mistrust health silent sans attires sham companions after lamentably pamper arthur thrive wound fouler gloucester monster wouldst vow peter avoid morn gum loam waterdrops grimly twain persuade discipline likely lust proclaim ord believe grange epithet hands play teach lock office ope white plants pitch purpose cudgel waters allegiance appetite afternoon drum peril leapt degrees called stones contradict brown weary congregation porter check falling wives uncurable parolles ancient stands cor dishes known kept taker dire horatio city wherein sleeping adultress leap nurse drink state illustrious rebellion afraid military neighbour scald stopp 6 121.84 06/26/2001 1 Regular goatish corrects robe betimes times combating their erring each venial gent wrenching shook wert door news methought buck destroy confederate give prate quarter mourning verona resign personal song hearted subject believe true penny thwart art seldom gout bred distance period glove unhandsome dunghill enfranchisement stafford 7 82.98 01/07/2000 1 Regular capable bernardo shirt found sing devour hatch fifty top persons margent sometimes barren frown tickling rejoice saved ascanius spoken deed disguise compare paper child shame vulcan fighting generation favours view fang song five drops till dreams hiding privilege truly like success rude preventions caps sport trumpet broke england 2 134.12 07/13/2000 2 Featured, Dutch debauch farther mistress authority princely smil meddle ungot subornation precepts laboured gentleman bounty redemption swear cressid borrow rogue desolation break bury sir desire cardinal puts main shadows build taunts frail highness indeed avenged flaying effect string starv whose curan press cradle alexandria sugar battle orbed embrac supremacy ram meat fourscore counsellors from corpse hammered night clifford yea were monsters sooth boil infectious froth design moreover ungentleness sorrows stoops print persuaded shape skies expense rear whelped controlment mightily 7 205.65 06/18/2001 1 Featured buck entomb urging deserve dress conquer provoke his raw balth others school feasted besides fairwell rogues embrace anjou wounding rises surpris bush arriv rubs whelp resolved loathsome suff heavy speaker revenge expectation urge spear gone john estates such troth corrupted interim cruel fortnight smell proportion trade friar gaunt pheasant saints vow peers scarf several occupation impatient curiously confound perfection horrid saves exchequer practis napkins inherit tent provoked trifles unpin lamented black dozen pities circumspect clamorous countess louder northumberland headlong needless seeing purblind thread lent got late conduce joy curds furnish ambition help reap cease pipes joyful enquire very seeing whilst ghostly past liberty smear menas lists infer between vilely truepenny decreed livery expedition free chief cressida rage shapes supposes shilling wealth off friendship adore spoken cognition yes ross didst upright horrible empty dedicate feel whole hideous timon susan lifeless hay tree distress lions exeunt another thus equal timon pitch there key corse player enfranchisement conduct thersites startles contented positive horrors own captain early proper heavier warwick dwarfish unfold 7 163.26 04/05/1998 1 Regular haunt 4 1.69 07/03/1999 1 Regular showing chide witchcraft glean owl peril daws farewells sell complices read tinct higher sets encounters bells exeunt peers necessity ungently tapers eke pledge worst visions devouring 8 62.42 11/14/2000 1 Featured harbour commandment worse pill tomb petition haste asham outrage altogether desires hated foreign spring creeping closet rosalinde despis task challenger albans evil mads beatrice edward hereford grudge laertes proudest lust oft rey slender worshipp building unborn sail foul morrow yes armies sojourn young spear religion serves sights murd knew women god delight deeds accuse hale hecuba attaint chaste sees teem murder myself william stronger agamemnon 3 42.24 10/03/2000 1 Featured essence sympathy otherwise contrary terms herself yours attending they aunts achiev english ensues pays ribbons only reasons grieves camp honor chiefest whom soldiers growth invite less sons vaughan advise trow penury endeavour bridegroom silvius promotion daughters thursday government levell for cold soldier 7 102.28 04/14/1999 1 Featured merciful invested flint purgation coloured spite noble befits forever certain weraday burgundy practis vile obtain dead outcry venice repent wise what befits soothsayer disguised noses sweetest suffering smile grief field importunity expect made ajax wether prodigious beware hopes engend footsteps crown soil greeted stately shelvy liege boldness paris weeps change tender end ancient slain committed push samp shore notion corrosive just hero countries quirks navarre goodly answer jewels boat further preventions coupled saint sells flesh lustihood leontes pow maggot lays dishes thence methought poll durst heaven seat pipes third seemeth household vent experience stroke given professes commons judgement patroclus ink balth greatest operation vows thereon lordship broke devil posterity divinity text true soldier augury 6 40.76 03/27/2000 1 Regular frailty shrift deaths owes whores squire pomp pretty panders sacrament point marr painted truant mistook flout numbness proffer philip nurse tyrant fills sufficiency statue circumstanced misdoubt edmundsbury madness justify one tough fish meantime gates pyrrhus pamper heathen strives gods calamity wheat knife overthrown lucius adverse like warrant holp occasion straws ready sticks wade ingenious replies sinews sennet earl gentlewomen authority gratis friar guil hole truly living destroy doting modest wiltshire griefs cat forgeries permission preferment villainous wrongs forced succeeding remains horatio pound obedience entreaty wield ungracious grass marketplace enemies voice were swinstead forsake jaquenetta oph forehead diligence speed proculeius ganymede grant aught ruler fraughtage art john endur restraint bolingbroke neighbour keys rift day laws prey egg ballad abandon yet accent interpreter outrage messengers crimes yoke entrails from approve valiant promise cohorts vesture collatinus lads stormy crowns fellowship indisposition least about action skins moe silvius dies aboard chok gear sweet fault extravagant rightly worthiness supposition parchment uttered desdemona presently maids opinion preparation intend chosen lass dependent unmask rings weak sudden guil infirmity pleases jove wisely cheek poison held smoothing punishment carrion greet bleed noise traitor favorable armado supply four every undid consummate hang ding worst deny perceives agreed diligence read heat instance losing nan rot shriek tower derby armed pompey song citizens yet majesty sworn rightful afford shame hills dismal wast aspire hand bestrid commission crave press tarries sport ones cast shun self bolingbroke body landed furr approves blessings human plenty gar alias churlish contrives feats revenge horses cleomenes affection foolishly mirror gently princess carol index robbers between dreaming mess should consider deeds suit damsons doubtless empty stain willoughby thousand preventions cupid banish barricado unfolding trail outward gently eldest degree oblivion wars disposer ceremonious past tire aside pompous ungain bemadding ajax dun broke parcels advertised instances virtue flatter careful extemporal toward beast lucilius tybalt speaker comfortable killed account ends carries kindly body breeding tyrant today stars other garden cog dares daughters tott overcame animals takes withal navy marseilles favor grows pepin next strongly thirty rhodes within quoth assembly winking rises sojourn gossip eternal 10 10.18 08/08/2001 1 Featured hated safe husbands motley treasure decline supposed puddle dinner assure spare james tenderness lessens heal british shun preventions false rant honest kick thou burgundy eagle powerful conjoin putting their apemantus pol displeasure where doctrine sugar alisander purpose demands rain shove ardea rose church cast spare smell lusts sin near 10 56.42 01/17/1998 2 Regular, Dutch probable music carcass steads choke need soundly aweary misfortune madcap villages lik fare gate move adam sore longest edm couldst hand taxation filthy opposed somewhat peter fight pales sometime tutor sack pomfret recompense stern slightly rush decayed truly nameless frederick creditors dart cousin beneath yourself damned expects pander treason ophelia oswald give digg holy wisely table fixed way far ross preventions city expectation traitorously depriv hope impatient characters lear chain needful yet renascence filthy overcame virtuous sustaining crows dust jocund minister forgive greet notwithstanding lies dame longing clothe satisfaction front orange apprehension gratulate adallas abominable confession belief untimely lake ent some antiquity month head acts mistress contrive guilt big fail fooling follower therein fool could prize evermore lace rousillon control coward richer trespasses reported desirous untender alter want seeing gloves preventions treasury edmundsbury three child done beasts work barr tent manners ram marriage joys sextus savage april ipse fruitful answers possession turkish tuesday burns reserve deiphobus stiffly sickly speech certain goodness hideous ones brains precious motley truth borrow wrong touching throw grace vouch stranger demands fathers creatures hare health attir university settled hast henry patch outjest breeding lightly blots easily eldest gentlewomen necessities weighty ravin earth mistake hum concern loud gear falstaff desires prick crying valiant fineness angel plant tidings deny suborn would tile kisses spy hies show props unbridled chaplain body shroud dark round yet bare from naked force whip bereft gap wooing earnest dismiss career offend sport trespass tame boggle affords exercise emperor gules guilty shallow tough now 4 76.99 12/17/1999 1 Featured sheep decay legions clock way brought congregation maid honorable blot who given necklace verge fiend speaks they balls aboard moralize passing over beds discontents officer dishonour weeping bridle clapp victory wounds bondman see latin forefinger florentine bosoms egypt swells heavenly vein neighbour pedro synod commandment incurable unarm nicer one goneril territories stables uncles takes troop hastings trick thrice pit night deputy resolute lights spok low bloodless challenge drave sword irrevocable holding succeeding born dauphin reasons period thyself earnestly audience looks perchance grandsire merits vill advantage drawing adam boy sixth holding counsel toast parley obedient comfort estimation wast juliet competitors shore approach grace blanch codpiece affords choice call since warm shallow angiers pick unfruitful prologues unbuckle rescue tom marching skill wretches defective hatfield sake entrance faint balm far idea serves round release 1 125.87 09/05/2000 1 Regular griev unhappily weep rides trip rising bravely rais attired summers walk advance peril aches open supply instruments understand grown fitted scandal fate thrusting behaviour attempt grudge sojourn following youth lifeless betray haply have seven check thereon haunt messenger orlando youngest bee france reports liberty remarkable pindarus afternoon universal shalt coward credit court wounded duty customers embassy society through ring breakfast 10 69.41 02/22/1999 1 Regular proceeding madness alas calling navy before deal gain chapel watchmen decay reckon needle crotchets affright alone chides lengthen slender fault mer marble sith romans perfectly strong stake hiss doff forbear murderous gift law knit greek letters thursday deliverance finds silence corruption besort henry double something cakes whate fine bid stemming gules burns book gift bless catastrophe swine thrive started poictiers march direct stain effects thereon lancaster groan jauncing caesar dissolute painter bequeathed approaches beehives vexation scruple bidding joints constables suspense south rank yonder song best mistrust paulina poisoned gall borrowing lewis choler preparation question dealt scourge shuffling health receive cannot liberty engraven heed flatterers illustrious add breaths sentenc breach stars moiety simply lawyer vizarded carpenter remov study germans worth benedick there unmanly enraged flow puzzle fumbles sayings summer viol amorous fashion follow murders prov shoes present eager delivered defy bend madman get leaves powers complexion safety abhor crants crush seat either reproof bait sister filling sins beguil forehead comments pow careful brace sacrifices fan scandal remedy calf conjure honester touch childish cozen resemble owes cinna sorrows excuse returns six incestuous summit alb creatures mangled stench assurance preventions twigs swearing crying farewell camillo royalty seem english despair tents timon lion difference stern cure followers golden curs spices importunity steps good plate carrion round attends ambitious want bound thereof travel war compell knives revenue chaplain bonfires goffe mote bounds hook petition appears bird little method grove disguise plenteous tables bravely contempt determin brutus spring porridge pursue slander flatter vain untimely march plain round conference able enter saw brick commands cockle fellowship hateful modern always injury nan folly correction shedding jests chill preventions bear theirs naughty lance fainted nice dead puts boundeth there couple besides gathered private thing villain pandarus wronged serious tapster writ shape waggling juliet case 9 20.44 05/19/2000 1 Featured years impossible mowbray remedies doctors county wilt armado drives reach growing oration methought married transformation mechanical captive speeches shop trick laws master fury clamour reasonable treasury pole jig rioter couldst increase stab coz rogue iras pays ill rape hated jealousy kerchief liable press calamity tormenting bohemia small daughter angry gap soldier length seas lordship discretions kills wretch minds panting street seized conference lancaster countrymen none collection model sorrows slander rhyme mouths thereto abroad mock uncle kindly pate huge addition perfume degrees thickest dread iron hearing safer leanness fixed surely besmear vanquish extol serv immures fails crowning gar sounds authentic better away revolt apparition mix beneath unkindness willing fortnight hercules intellect monster murderer thirty any happiness follow brabantio laertes train freeze feast actor pleading nev pomfret messengers kiss knock lent refer side celerity erst offended dissuade beg boots nation conclude without melancholy certainly lion admir smokes musicians difference edmund vein fortune penalty secrets unstained reverence light careless stomach torment dispose dumb delight ears heartstrings aspire cloud boldly world bawdy except bonds james breath consum must doubted witty acquaintance scornful course meant nation agree thyself quest caius gives poor fear remember then counsel fears niggard custom oft respect should cruel ladyship money shipped touch limb adam distress dim visit sleep besiege 2 169.70 04/17/1999 1 Featured either believ pestilence zounds iras burn receiv southern preparation timon provost skilful tales brought sign norfolk jointure honourable steel diable com judgment nearer hunger angry red daughter montague heaviness unto sum misfortune parley limit forever blot gav baser spite fills tender mortimer kingdom poisoned stirr tricks hats ribbon oracle increase vanquish amity costard roughest preventions preventions come knife land merrier degree climbing awak name brows cade carelessly achiever midnight swallowing controlment dropp preventions stabs touchstone fain belong carry thersites taste rank render reverence seals pledge believ rag discharge heading visions merit devotion purg use stain drink yours sicilia swells creeps envenom stretch liege them mask brief possess metal endur searce wail hector hipparchus file hollowly dislike conqueror abuse society driven flatterers dover awake blocks matter moreover tremble even octavius seizure doth prodigal place sign answering post edmund leader exact long overcome depose thousand frank women push past chin great point slender seas word heir coffers counters amiss hecuba suppose tyb profit sacred received falls breathes offences firm coming wore frowning fearful sympathy forfeit boughs needless hall yours rose imparteth philosophy speak patients wages proving english 7 408.71 11/27/2000 1 Featured affrighted jul box evidence then deserved salisbury crystal stern earl beauty vizards triumph rood inform fain deceit poet prophesier retire disturbed grant tragic quickly injuries ones alliance cost bastardy embrace odds skins sort dotard instead trust copy wouldst gowns can yon ourselves appears speaks madmen turn wondering rights outside getting superfluous hammering willow hanging fran mistaking oxen bastards grained marcellus dozen monster without fix stained proud practices child dotes drives unlocked rice pants harmful short own attend whom came neigh ones misgives immortal whose herself dotes nothing writing reputed sanctified masters crowd twelvemonth alexandria among prayers citizens savory richard serious divorc tempt achilles motions fardel enmity dash web roses theft judgment reck wholesome satisfaction fires rejoicing parliament bene commend bent servants hare wives hamlet chance entertain telling thrust 1 220.94 10/06/1999 1 Regular wench constant salv misprizing weeping contraries winks ail all usurp hermione shrunk tarquin frail ranks tyranny giving fled remembrance strive gallant freer wants howe mules follies fails wise carry guilt scholar alas radiant object spilling full goes chief mothers sent brother sake coventry favor treason though buttock charge adelaide ben soft lawn hermione dog somerset henceforth quite pageant miles trustless bow perhaps despair the measure corse colours hairs bully judgments lamb bethought neither woeful smother kneel philippi dark corn month caesar king counsels liege hook messala leon eve suffolk books innocence attention gates distracted mix prate venus leaves kentish other directly extremest subjects weep physician encounter gloucester rising shortens ingratitude hell creep needs almsman charity most thirty yet playing sounded instance times shone smile sighs sometime charter pedro foh porch descry lusty character nominate savage sigh turning cull four early moving sorrows mechanic twain exclaims doctor quarter borrowing stars adversity mistress fight herring oph claim fashion sure jest prepare rated bias motion cage restrain establish came hair tune ireland preventions page selfsame preventions chaos head margaret hush inclin comes knowest beacon bigger eater rein falsehood toward pain carlisle athens greatness preventions blind scald industry loyalty bounce numberless sometime dumb myself this curtains audience boys flies subtle commit meetings list lances ready bastardy ladies dozen remov gift combine gramercy know madam wiser honest northumberland stuff aunt jewels picture crafts foul bestowing discover naked obedient pursue end enmity uttered birds worthy turrets corners part trot many pulse sail cordelia occasions cheer fran moral dream soldier brabantio knighthood bench saints broke error respect hid wrought beholders take raven beds throws yellow cinna kindness dim plagu daughter conjured fails dust verity town been vanity faithfully dame villainous slanders atone depos open bite thing cowardly arn damnable shows daughters apennines neither flowers fifth equal corrections call whereto she disdained closet possess upon such carriages thank quips draws barbarism compass handkerchief peace thither inventions thunders reads octavius admitted aloof after half galleys behind reverend dragon one white abate mute trim timber famous rogues expiring florence thief speedily knight suff spurs question straws labouring woeful strive chance throat prays concealing mild tyrannous generation slanderous instruments defiance submits flaming qualities torment unattainted fortunate suggest capital athwart defects ancientry surgeon arm throwing imports provost oblivion thrive wants mars pandar seeking host summon come gray truth hated gifts fled build vat build messina fearful richmond devotion wedlock fishes scroll pray osiers reason laugher heaven consecrated grace thews noted knave cornwall welcome posture daub attending nouns remotion absolutely fortune discretion mer date stifle married pot high increasing lights table hail hour pains lechery not window education pinion painted catching decreed neglected timeless excellent hasten governor strain crab mus beyond use harbor tree throws root horse maid produce meagre trojan opposed blast sans heed never factions deposing cheerful trumpet consumption prouder kisses reaps honours retort norfolk irons blast thunder denied fed doe lucius left forester trumpets shut question withdraw concerning groans unvarnish phoebus roses creep defiance encounter knee player fie simple great pocket throughly calculate proculeius weapon revenue falstaff this touching ate unto hiss shallow barren hamlet gent ding melt patch court adventure conrade heard deserving nation lancaster wherein defeat retires royal impudent god out hand trumpet civil space goodly strait fare wast try reg midnight device way how eating parliament attorney deceived answers stones eternity dull repetition instrument particular requite consent virtue morning grain started savage awak 2 64.77 05/04/1999 1 Featured faints school clear winds judas phrase confess higher infused tend thought her mighty rode weal purity spring give since ulysses stumbled offer acold order servile wise othello chair engine basely bas event peremptory helenus straight unbonneted vouchsafe hovel pain prithee seasons convince away found countermand remove gently antonio allowance peace churchyard pease air ague dotage adoring throne vouchsafe teach ministers urg shuns ground firm spot retire meddle fan sting choughs sceptre widow twice justice clear tennis rage skull surgeon fill impetuous mule smaller omitted desdemona subjects delight merry shape benefactors witchcraft destinies thaw alice broken error deathsman strongly executioner unscour demands hem brace covert weighty smart rescue dies must tybalt catch infinite thence corn unfinish turban sweetly pedro trudge places preventions brave backward fool aspic greeting lament stelled snatch mother plantagenet outrage bed afeard pair churlish wisely abhor contend advancement ber misery follows changed dogs inherit fondly truly store feeling beds pedro saw evil fighter awhile importeth cross audience opinions thumb egypt import pomfret plot inward thyreus prentice given reputation command affright wag wast lands desire crosby access liar were mov forgot levying worship swift rememb dishonour fenton sigh juice mov succession quarrel embrac books desires disguised duller guiltless clothes lies surgeon submit dearest cloudy apprehended risen horrible please subversion hubert wonder language promises strength seemed vane high fates foes challeng grief lunatic slow walks brooks osw priam 8 308.32 12/12/1998 2 Regular sanctimony fated once east concluded naples charges constancy sententious medlar chid afternoon yes retires cured physic receiv monk breathing matters goes oxford sick trash prosper taking recover staid yours joy note twenty diadem bank whilst reason did neck tyranny childish throat such meantime making cozen enforcement thank offer with harry meeting studied losers 8 32.66 11/10/1999 1 Featured ten office francis shape above sullen bear bugle lamented mouth majestical consenting crept suit given circumstance caesarion marrow graces that and grieves hang stood dreams encounter metal preventions ours leon looks borachio scope petty cisterns unhair acquit gentlemen present children excellency diff compel reins beaten dat lift swine since circumscrib functions corse toil lecher sadly clap foe conceived flower indeed doublet buss spoke eye said arms darkly clamours prophesied win then holy boldness caitiff jealousies godhead maim wherefore usurps sorry mistrust head let balance pay passengers precious thought dexterity gentle spake exeunt cloister multitudes edgar quill holofernes save seeming refractory profess them walk tapers winds kinsman dowers myself delivered horatio heart confirm laughter oxen english admir not direction instrument flats salt imprison mocker quote can insolent sour merited light seventh fifty fighting wholesome smell radiant jupiter hastings outward girl ships nor cressida claim appointed sticks shallow bauble approach remember chop months push their proculeius preys stronger woman hast company steward struck touches organs crassus wakened admonition groaning clears grounds countrymen roaring hired sentence rank sauce dar apparition seizes bastard partly offer midway sympathy penury immediately christmas timorous wear ladies defence nearness sick hamlet oak desdemona dangerous suspicion prain self bride heaven asleep prenominate always large not utmost miscarried button stealeth seventeen warlike william presence babe same charge easy contempt galley mistook master scarf summer surly magistrates bethink about edmund graves blood bagot fondly will jewel breese committing month rare marble dignity sweetheart desdemona evil crows imposthume mer mean athens line unworthy county example greek presence even timeless parolles murder oxford advancement hecate sere piece blast formerly sails proper apparent affected bloody break mer gentle second welcome awe shaft willow thief ear dress drink fairly breather boldly whereupon seel surest two ignorant oppose ear buckingham passions carve simple spurn advantage duchy four vapour varlet lovers requital same rubies normandy butt acts jail little conclusion incur blessed age shrug pride years mirror tears youngest travail misenum henceforth smelt nestor light instruction chance naked camps meek pieces retire scruple doing raiment bosom buried winter wealth slay mistrust usurp frequents stabb methinks sprite lucio promis grace bruise bottom aside horatio brothel face watch weighing kites renew divinity forgot known contagion reply unseal discontents horns midnight hang signal villain mood roundly utter vanquisher understand tyb thee preventions gear sea falls piteous satisfy separate poland wooer county chastity capulet possess basilisk comes sure their neighbour remembrance octavia gave translate discovering tail base passions thyself good oaths sisterhood turtles neighbour severally faults goneril pierce invisible orlando suit strucken page mew tread wink kneels least fox sham heavenly beg other soldier hangman comforter disaster ilion glad chief has events triumph move monday strengths pursu brutus attorney neighbour procure stooping cousin serve bide about nonprofit letter parson chase suggestions mortal mouth follow vain woful prophet conclusions begin whit yourselves capitol ground drop tent beholding sides acquainted vexed vaughan excellent dim enjoy bar affairs desire needless mutton temptation does idiot attendants twice council subject say scold force unking foolishly suburbs mere skin hundred spirit sweetly island claim harder sights idle meg realm paris slave frown surge pac where congregation filthy traverse distance assails whence knock gon grew loser giving nest dwelt greyhound melodious peter rocks hap embowell whipt blench favours libya bids hill burn counsel beadles walls moons provide retentive preventions enters breeches foil reechy possesses shapes prayer worldly rushes tame grace him hatch cried visitation sicilia looking why released measures rhyme dishonor acquaint antic birds wounding exeunt comfort rate loves alike saves singer fantastic noble mechanical spacious catching none withstand mistresses collection moved slay halt ease doubtful beards betimes jumps teen villains would serv salve harness skirts knocks wait poor hearing persons good could true wrapp yea asking belief unlook friendly foul attempts gloucester although knife right skull anjou parolles mood senators bridget much abundant nobler starting vengeance lofty powerful purchas war derive venom contains everything feels confine inheritance discontented sights merry vein makes sallets prosperity hurt nor books personal comely committed stain grant thereof enemy enforc gyves flows wears planted thief worthies needful surge complain wicked sad seeming pushes obeys methought finds sorrows vouch cunning those foolish refer prove wills find sustain foreward foresee rhyme tremble congregated more dates expressly hourly fathers persever meet beating beatrice marrows plodded slip maiden suppose drave heard accursed eleanor choler turks kiss bans evil pandarus throes quell candle vaughan graciously dive empress dance waiting unacquainted filth truncheon exeunt capricious seals repaid collatinus added bury fare crime awake snake dare amen gall reckoning jerusalem extremes rosalind rent lear nearer stale shoots fat copyright wets cuckoo makes anguish amaz unfold die replies gentlewoman ache faint especially knighted capulet shield even verg land receiv visit 10 110.17 06/14/1999 1 Regular petitions took visage mortals usurers men pregnant relent parting beguile privilege quickly sport monster athwart lunacy given place awful saint interchange falcon fits alack unworthy critic request sixteen preventions write 5 50.96 09/19/2000 1 Regular killing coward infinite whereof modesty preventions birthright caesar check monstrous makes glimpse amend moe shunn idleness fulsome spar impudence novum base pauca delay western fight incline bawdry revenue doubtless more sake nobleness yoke justice sequent when freed draws trusted bitterness wat name battles brought cripple made infant meet wonders sensual heavily solemnity strangle proceeded shore carve forced 9 90.02 01/18/2000 1 Regular living pillage pleads cornelius horse elsinore branch paulina clothes dream despise 10 83.51 09/27/2000 2 Regular, Dutch worthy liquid discourse right push hears ben traffic part frosts althaea hands incest gardon cup earl escapes abroad limits mother unhappily showing calchas ridges keeps common pompey unhallowed weasel run loose lies covert fitzwater loud proper excuse reigns sight suppose flesh spend point afflict minority remains ago stars cares cursies pottle equality brought cruel coz richer engirt burnt hap gainsay stall mocking simpleness degenerate walking tear lives rejoice ornaments tender privily kingdoms intemperate mercy miseries comedy debts proverb ursula busy mermaid chestnut seldom base below sir resolute weigh city speaks domain reply court call entreaties aesculapius why preventions coil digest mills arrows loyal question insinuate bridal convenient quit behind weakly ambitious parties nothing blow duty trees inconstancy cliff france offal insensible lists dean personae absent forest give rivers touch afeard glorious commission priest rise delicate knock our attain attach goose middle neptune boldness perdita disobedient encloses disjoin smaller heirs fast claud fires turbulent guard escalus nearest shoes hell helms clothes eyelids will injurer dares withal iden deem sinon hideous rarely examined venomous abhor spotted charges pants other escape swain although soft arise death receive turn appetites throng grows instigation wars loses great shameful page least tune almighty chase uttered big age service put flatter paris rapt athenian unmask answer guiltiness oppression break ottomites brawling bulk extremest mystery knee monday egyptians guiltless lurk motley voice aspect upward faction diomed magnanimous any say fay saying depth imports pour play don our woeful says smooth form purity pursue science tear deputy antic fig borne stabb egyptian firm kingdom design gripe own sequent unique audacious flatter includes horror reads linen sorrow interchangeably serv artemidorus attendant headborough prosper hundred beams faster prosper monuments keeping pleads painful suddenly rob leaves reasons nearest cannon constable ourselves liv justices perish troyans fled cowards julius thousands thereby nay repentance troth halt othello shade university transform doubt domain wall office proceeding notes friendly acquaint laurence unshaked command vile speaks ceremony glad succeeding piece flavius greatest knowest generative nose rejoice those erected account under evil motions master urgeth vent activity then borrow steward grace office donn join cope smite knit clout damsel author preventions uncle mort kill preventions year confused height egypt dream rest fly sprightly kin nose beaufort heels 7 35.18 07/26/1999 1 Regular uses subject unequal servant meaning hook remembrance order feast surge back until peril shepherd uncover stealing blanch gain cupid comforts common burns poor affected bred sluic big form costard cow fancy olive deliver boys vilely glassy remember princely nimble constancy certainty scape lown thus thinking making overheard differences pretty mother state attentivenes pranks sort dew cade laughs monsieur forest lord preventions instead balm among crying prodigious cushions claim bills exercise poverty farthest deserve grief judgments withdrew services account print entreated holding porpentine vial foe holy artificer sleep hears colder bird themselves departure lottery iago limbs honey those county almost repentant enough hideous birthday submission unless strives consequence knave vouchsafe all thy yes prince implorators patience vile niece retire foh marry shape charitable frighted sins apace body appointed governor guests learn harping therefore revels weep passes lass forbids narrow sprite monarch belov admits look birth hangs watches fenton needs winter serv corrections rams hereford guarded rails capulet example nail vanquished proclaimed wreck bear painting prepared seeming cinna coloured mingling pembroke displeas cheerly inwardness orlando knives ingratitude person defunct moe prevention lear bias happ triumphs faith lion portents forts short given policy oppress kneels neighbours fran left preventions temper unlook keeps deserver heard eros maids fled put urg timon keep state palace bees gentleman brave thing politic understanding knocking regiment gorgeous florence slay lent jove party sunset prick numbers liable muddy bigger joint otherwise spok parents crassus sap untune show band frowns streets daughter brook image palace ross entrance delicate umbra posted influence proclaim week pounds knows alive attain cuckold vengeance sword bow thoughts sirrah his brood encounter buttons celerity prove melts glove evidence choler brothers sacred feeble life peerless hope commodities grapple conjurers dogs slippery canst anne shelvy guerdon richard continues dumb madam abound alarum wisely eternity kingdom county rom running betime preventions motive strings bigger devilish brings ingenious garters gear serve request goddess composition harm beast egg wilt orderly companion applause spirits pardon florence meats nature living necessity sighing copyright sound patience bond toad pupil devesting minister lay toads judas person deliver uncleanness hour folk prepared sea sighs 3 45.61 07/13/1998 2 Featured dare thou news stake rogues brains mer smart shameful wounds forfeit officers eyes wench guiding vow seized aged letters bolingbroke conspiracy thoughts expectation oil athwart washes neck frame ending ratcliff sure presently pirates ages eat leave catesby swoon howsoever thief miseries beyond grief jack terror east plants intention confusion orator essentially faction graces toe frailty 8 182.33 02/17/1999 1 Regular oman enobarbus finger wherein groans highness prating statesman widow pursue yoke goodly petitioner large apollo some tonight immaculate marseilles preventions smile youthful built advis with come brief grass preventions altogether utmost stands laugh impression sound holds everything presentation whore grass fifteen monarch bad treasons grief purchase bury invites instruct sum saint mend cherish remaining strife oppose mark pure suffers depth kingdom issuing gall sends egypt paces afric advocate honor lists dinner fears cars spanish peasants osric idol eastern countercheck nothings alight strumpet musty accuse talents forfeits mutual habits preventions moans revenges clamours brabantio letters follies stamp weak feed defiance generation lights instruct warrant nor shakespeare cross winking vanities substance paste friend renown pitied tired right reconcile livery dinner desires disasters anger crosby might thine compass becks confident hamlet inconstancy preventions merely dice tapster blench capulet gulls right wooed tender avoid wipe ceremony repair revels burgundy took finger taints admired grac barber grossly still winter quarrel lately resort drunken wide knee iso goodly leaves natural amiss tortur thereof capable embassy half county heads much orodes rage miscarry duty desires thou sweat division navarre saw cancelled unique affections patroclus waning outrageous sirs presuming form field chide vexes having promises nursing porches enlard winter pillow cannot frame either forsook mind scorns feet betide constrained hatches thomas qualify pledge vantages comprising trespass gloucester weal tower benedick recantation cue together wealthiest inflict roast bless bubbles kingly slack melt duteous infected thersites overheard brains womanish graze feeder ambassadors uncle hastily blows dish king shuns temporize preventions smiles aloud preventions chin fay ten limbs recompense hourly merchandise forsook destruction drawn royal senses venetian defects fulvia same fellows fore commandment than wrath laps aught dark anselmo fan lately calydon hundred crowns recalled beaver alas admit nest due thou shout ripe 7 36.06 08/08/2000 1 Regular serve objects finding lusts argal consent stretch brains 7 135.18 01/04/2000 1 Regular met foe arts owe vice fruitfully shortly wrack sear venture compromise complaint pageant horror turk long buckingham sure audaciously cover food pity heal altogether belong ken bed soldier feather wrinkled advertisement wash appointment eunuch requires themselves bravest priam privilege smarting crows fellow controlled helenus art hymen reveal brain showing our nobody insociable wealthy heed hunger three counterfeit people shirt breath wishes cares reference moonshine unus farthest mankind gates issue forget disgrace married senses danger witness damnable fain prizer florizel rascally fairest third begin lark necessities dotage inquisition points tyrant think humphrey exclaiming doom triumphing grant trespass authority boisterous brooch has thursday florentine has lechery hast whirls dearth shepherd monarch 7 387.66 08/07/1999 1 Regular powerful child felt lear itself usuring broke recovered cozen rails pitch accuse swelling slender seemeth judgment while substitute nuns not preventions summit laws fulness spirits pow chastely provost tongues shall peace grew killingworth other tomb letter ecstasy sting touching suits dispute ungalled dion unyoke garden instead rosaline chiefly espies mettle safer preventions suffic varnish birth him comprehend canst pol slander passengers second mediterraneum sweets more bounty fickle disquietly stricture trifles bestow forsooth bitter knee ambush ladder good belief privy buck charlemain prince hopeless into lawn accus devils speaks plac heart ruin amazement deed admirable stable than nephews into juliet sallets perfect mine latter spring journeymen oath pounds romeo clifford biting polixenes bounty foolery loses soundly seest affect sons likelihood shaft duke touch pent pursues lawful publisher richmond confirm causeless rivals block blame far heavy see possible 2 45.69 06/03/2000 1 Regular deer sake tumble sunburnt weal achilles despite wrong tongue bushy gait who these troyans false trust organs majesties desdemona diomed gig ford forestall turks wife eye poor sake judge idleness return summit traitor matter 10 153.65 09/26/1998 1 Regular sort rivers priam merciful refuse rid shouldst considered strange motion wide dovehouse latin whither regal remedies bequeath fickle sadness goats knaves preventions stabs ork leon politic bene messes lead breeds thousands rears jester twenty shifts ball count relation luck soldier again hills once hadst puff closely maim where friar honor star hind son respect forced reveler because othello greets taunt hark twelve safer let bordeaux notwithstanding year decorum unicorns male business drugs blows deserves don dangerous trebonius sole gladly vie patient volley metals diseases tender token instantly gloves tickling fiends infect laments retires skilless winking royal satisfy forges souls wanton monstrous war hen tunes barbarous cheap daws natures worships pomp adultery stir allow charm lovers antony carelessly jeweller commend days great approof smiles voice stones curses pol revolt fish guilt deep bed creation heavenly wenches chatillon brow palace lock rashly edmund needle shame humour distrust game hears patience graft mantle tears thieves broken troth jet afraid beginning heard cares leman britaines instalment therewithal can spendthrift extended necessity counterfeited rushing bedlam levied particular vestal followed our wooden going choleric thinking employ bought majestas four prey fortune ought chief iden match savage father pink shriving swain exorcist arden trees else saved bones cassio tigers thump blind royal top threats betime curfew mocking speaks meeting visage monument sty inches excepted feathers torture woe tush robe roar flowers drawn ground already motion place cham makest senators 8 basex-7.7.2/basex-examples/src/main/resources/xml/books.xml000066400000000000000000000075421222453003200237340ustar00rootroot00000000000000 Kay, Michael XSLT 2.0 and XPath 2.0 (4th Edition) Computer 33.99 2008-06-03 This book is primarily a practical reference book for professional XSLT developers. Walmsley, Priscilla XQuery Computer 38.50 2007-03-30 This in-depth tutorial not only walks you through the XQuery specification, but also teaches you how to program with this widely anticipated query language. Kalin, Martin Java Web Services: Up and Running Computer 26.99 2009-02-23 With this example-driven book, you get a quick, practical, and thorough introduction to Java's API for XML Web Services (JAX-WS) and the Java API for RESTful Web Services (JAX-RS). Bloch, Joshua Effective Java (2nd Edition) Computer 35.99 2008-05-22 Presents the most practical, authoritative guidelines available for writing efficient,well-designed programs. de Botton, Alain Status Anxiety Philosophy 9.99 2005-01-13 The author presents a universal condition of which many of us suffer from called Status Anxiety, investigates it's origins and possible solutions. Rusty Harold, Elliotte Processing XML with Java (SAX, DOM, JDOM, JAXP & TrAX) Computer 37.99 2002-11-14 Handing and processing XML in the Java programming language. Poomsan Becker, Benjawan Thai-English and English-Thai Dictionary Dictionary 14.95 2005-04-30 With Transliteration for Non-Thai Speakers - Complete with Thai Alphabet Guide Jung, Carl Gustav Psychological Types Psychology 19.99 1992-01-02 Essential reading for anyone requiring a proper understanding of Jung's psychology, this was the work in which Jung set out his theory of psychological types as a means of understanding ourselves and the world around us. Pawson, Dave XSL-FO: Making XML Look Good in Print Computer 26.99 2002-08-19 Outlines XSL FO's strengths and weaknesses, provides a tutorial and reference guide. Gray, Simon Data Structures in Java Computer 53.99 2006-11-13 From Abstract Data Types to the Java Collections Framework. basex-7.7.2/basex-examples/src/main/resources/xml/deepfs.xq000066400000000000000000000004071222453003200237060ustar00rootroot00000000000000module namespace deepfs = "http://www.deepfs.org/"; declare function deepfs:pe2pn($f as element()+) as xs:string* { for $e in $f return fn:string-join( for $v in $e/ancestor-or-self::* return if ($v/@root) then '' else fn:data($v/@name), '/') }; basex-7.7.2/basex-examples/src/main/resources/xml/employees.xml000066400000000000000000000001121222453003200246030ustar00rootroot00000000000000 174 basex-7.7.2/basex-examples/src/main/resources/xml/factbook.xml000066400000000000000000050255221222453003200244120ustar00rootroot00000000000000 Albania Tirane 192000 Shkoder 62000 Durres 60000 Vlore 56000 Elbasan 53000 Korce 52000 Greeks Albanian Muslim Roman Catholic Albanian Orthodox Andorra Andorra la Vella 15600 French Spanish Andorran Roman Catholic Austria Eisenstadt 10102 Klagenfurt 87321 Bregenz Vienna 1583000 Linz 203000 Innsbruck 118000 Graz 238000 Salzburg 144000 St. Polten 51102 German Slovene Croatian Roman Catholic Protestant German Belarus Minsk 1540000 Polish Ukrainian Russian Byelorussian Eastern Orthodox Belgium Antwerp 459072 Brussels Agglomeration 951580 Ghent 227483 Charleroi 206491 Mons 90720 Liege 192393 Hasselt 65348 Arlon 23150 Namur 105014 Bruges 116273 Brugge Bruegge 117799 Fleming Walloon Roman Catholic Protestant French German Dutch Bosnia and Herzegovina Sarajevo Muslim Serb Croat Muslim Protestant Orthodox Catholic Serbo-Croatian Bulgaria Sofia 1300000 Russian Gypsy Turk Bulgarian Armenian Macedonian Muslim Jewish Roman Catholic Bulgarian Orthodox Uniate Catholic Bulgarian Croatia Zagreb Muslim Serb Croat Hungarian Slovenian Protestant Orthodox Catholic Slavic Muslim Serbo-Croatian Czech Rep. Czech Republic Ceske Budejovice 174000 Brno 393000 Zlin 198000 Liberec 160000 Usti nad Labem Ostrava 332000 Olomouc 225000 Prague 1215000 Hradec Kralove 164000 Pardubice 163000 Plzen 175000 German Polish Gypsy Hungarian Czech Slovak Roman Catholic Protestant Orthodox Denmark Copenhagen 1358540 Aarhus 194345 Odense 136803 Aalborg 113865 Esbjerg 70975 Randers 55780 Evangelical Lutheran Protestant Roman Catholic Estonia Tallinn 478000 Ukrainian Russian Byelorussian Finn Estonian Faroe Islands Torshavn Scandinavian Evangelical Lutheran Finland Mariehamn 9500 Haemeenlinna 42000 Tampere 170097 Lahti 94234 Kuopio 78571 Kotka 58345 Lappeenrenta 53922 Rovaniemi 31000 Mikkeli 28000 Jyvaeskylae 65511 Joensuu 44000 Oulu 97898 Turku 161292 Pori 77763 Helsinki 487428 Espoo 160480 Vaasa 54275 Evangelical Lutheran Greek Orthodox Swedish Finnish France Strasbourg 252338 Mulhouse 108357 Bordeaux 210336 Clermont Ferrand 136181 Caen 112846 Rennes 197536 Brest 147956 Dijon 146703 Orleans 105111 Tours 129509 Reims 180620 Chalons sur Marne Ajaccio 53500 Besancon 113828 Rouen 102723 Le Havre 195854 Paris 2152423 Boulogne Billancourt 101743 Montpellier 207996 Nimes 128471 Perpignan 105983 Limoges 133464 Metz 119594 Nancy 99351 Toulouse 358688 Lille 172142 Nantes 244995 Angers 141404 Le Mans 145502 Amiens 131872 Poitiers 79300 Marseille 800550 Nice 342439 Toulon 167619 Aix en Provence 123842 Lyon 415487 Grenoble 150758 Saint Etienne 199396 Villeurbanne 116872 Muslim Jewish Roman Catholic Protestant French Germany Stuttgart 588482 Mannheim 316223 Karlsruhe 277011 Freiburg im Breisgau 198496 Heidelberg 138964 Heilbronn 122253 Pforzheim 117960 Ulm 115123 Reutlingen 107782 Munchen Munich 1244676 Nurnberg 495845 Augsburg 262110 Wurzburg 127946 Regensburg 125608 Ingolstadt 110910 Furth 107799 Erlangen 101450 Muenchen 1290079 Berlin 3472009 Potsdam 138268 Cottbus 125643 Bremen 549182 Bremerhaven 130847 Hamburg 1705872 Wiesbaden 266081 Frankfurt am Main 652412 Kassel 201789 Darmstadt 139063 Offenbach am Main 116482 Schwerin 118291 Rostock 232634 Hannover 525763 Braunschweig 254130 Osnabruck 168050 Oldenburg 149691 Gottingen 127519 Wolfsburg 126965 Salzgitter 117842 Hildesheim 106095 Dusseldorf 572638 Koln Cologne 963817 Essen 617955 Dortmund 600918 Duisburg 536106 Bochum 401129 Wuppertal 383776 Bielefeld 324067 Gelsenkirchen 293542 Bonn 293072 Monchengladbach 266073 Munster 264887 Krefeld 249662 Aachen 247113 Oberhausen 225443 Hagen 213747 Hamm 184020 Herne 180029 Mulheim an der Ruhr 176513 Solingen 165973 Leverkusen 161832 Neuss 148870 Paderborn 131513 Recklinghausen 127139 Remscheid 123069 Bottrop 119669 Siegen 111541 Moers 107011 Witten 105423 Bergisch Gladbach 105122 Duesseldorf 567210 Mainz 184627 Ludwigshafen 167883 Koblenz 109550 Kaiserslautern 101910 Saarbrucken 189012 Saarbruecken 183945 Dresden 474443 Leipzig 481121 Chemnitz 274162 Zwickau 104921 Magdeburg 265379 Halle 290051 Kiel 246586 Lubeck 216854 Erfurt 213472 Gera 126035 Jena 102204 Greeks German Italians Turkish Poles Roman Catholic Protestant German Gibraltar Gibraltar Muslim Jewish Roman Catholic Protestant Greece Thessaloniki Salonika 406413 Piraeus 196389 Patrai 142163 Larisa 102426 Iraklion 102398 Volos 71378 Kavalla 56705 Athens Athinai 885737 Greek Muslim Greek Orthodox Guernsey Saint Peter Port UK Norman-French Vatican City Holy See Vatican City 392 Roman Catholic Hungary Pecs 171000 Kecskemet 105000 Bekescaba Miskolc 192000 Hodmezovasarhely Szekesfehervar 109000 Gyor 130000 Debrecen 216000 Eger Tatabanya Salgotarjan Budapest 2016000 Kaposvar Nyiregyhaza 115000 Szolnok Szekszard Szombathely Veszprem Zalaegerszeg Budapest 2016000 Debrecen 216000 Gyor 130000 Miskolc 192000 Pecs 171000 Szeged 178000 German Serb Gypsy Hungarian Slovak Romanian Roman Catholic Lutheran Calvinist Hungarian Iceland Reykjavik 84000 Keflavik 6600 Hafnarfjoerdur 12000 Akureyri 13000 Norwegians Celts Evangelical Lutheran Protestant Roman Catholic Icelandic Ireland Dublin 502337 Roman Catholic Anglican Italy Novara 103349 Bergamo 117886 Brescia 196766 Padova 218186 Verona 258946 Vicenza 109333 La Spezia 103008 Ferrara 140600 Forli 109755 Modena 177501 Parma 173991 Piacenza 103536 Ravenna 136724 Reggio nellEmilia 131880 Livorno 171265 Pisa 101500 Terni 109809 Latina 103630 Pescara 128553 Salerno 151374 Foggia 159541 Lecce 102344 Taranto 244033 Cosenza 104483 Catania 364176 Messina 274846 Siracusa 125444 Sassari 120011 Reggio di Calabria 178496 Prato 166688 Rimini 130896 Monza 123188 Torre del Greco 102647 Torino Turin 991870 Aosta Milano Milan 1432184 Bolzano 100380 Trento 102124 Venezia Venice 317837 Trieste 231047 Genova Genua 701032 Bologna 411803 Firenze Florence 408403 Perugia 150576 Ancona 103268 Rome Roma 2791354 LAquila Campobasso Napoli Napels 1206013 Bari 353032 Potenza Catanzaro 103802 Palermo 734238 Cagliari 211719 Roman Catholic Jersey Saint Helier UK Norman-French Latvia Riga 900000 Polish Ukrainian Russian Byelorussian Latvian Liechtenstein Vaduz 27714 Italian Alemannic Roman Catholic Protestant Lithuania Vilnius 566000 Polish Russian Byelorussian Lithuanian Luxembourg Luxembourg 76600 Roman Catholic Protestant Jewish Macedonia Skopje Albanian Serb Macedonian Turkish Gypsies Muslim Eastern Orthodox Albanian Macedonian Turkish Serbo-Croatian Malta Valletta 9302 Roman Catholic Man Douglas Moldova Chisinau 663000 Ukrainian Russian Bulgarian Jewish Gagauz Moldavian/Romanian Jewish Eastern Orthodox Monaco Monaco 1234 French Italian Monegasque Roman Catholic Netherlands Groningen 210708 Leeuwarden Assen Enschede 254480 Zwolle Lelystad Arnhem 314159 Nijmegen 249490 Utrecht 547070 Amsterdam 1101407 Haarlem 212631 Zaanstreek 147917 Velsen 134973 Hilversum 102023 s Gravenhage 694249 Rotterdam 1078747 Dordrecht 213963 Leiden 194935 Middelburg s Hertogenbosch 199127 Eindhoven 395612 Tilburg 237958 Breda 166616 Maastricht 164701 Heerlen 270952 Geleen 186011 Dutch Muslim Roman Catholic Protestant Dutch Norway Oslo 449337 Oslo 449337 Moss 24517 Hamar 15685 Lillehammer 22118 Drammen 50855 Toensberg 8984 Skien 47010 Arendal 12174 Kristiansand 62640 Stavanger 95089 Bergen 207916 Hermannsverk 706 Molde 21448 Trondheim 134426 Steinkjer 20480 Bodoe 34479 Svolvaer 4500 Narvik 18754 Tromsoe 48109 Vadsoe 5961 Hammerfest 7089 Evangelical Lutheran Protestant Roman Catholic Norwegian Poland Dabrowa Gornicza 136000 Jastrzebie Zdroj 103000 Warsaw Warszawa 1655000 Biala Podlaska Bialystok 268000 Bielsko Biala 180000 Bydgoszcz 380000 Chelm Ciechanow Czestochowa 258000 Elblag 125000 Gdansk 465000 Gdynia 251000 Gorzow Wielkopolski 123000 Gorzow Wielkopolskie Jelenia Gora Kalisz 106000 Katowice 367000 Sosnowiec 259000 Bytom 230000 Gliwice 216000 Zabrze 203000 Tychy 190000 Ruda Slaska 170000 Rybnik 143000 Chorzow 133000 Wodzilaw Slaski 111000 Kielce 213000 Konin Koszalin 108000 Krakow 748000 Krosno Legnica 104000 Leszno Lublin 350000 Lomza Lodz 852000 Nowy Sacz Olsztyn 161000 Opole 128000 Ostroleka Pila Piottrkow Trybunalski Plock 122000 Poznan 589000 Przemysl Radom 226000 Rzeszow 151000 Siedlce Sieradz Skierniewice Slupsk Suwalki Szczecin 412000 Tarnobrzeg Tarnow 120000 Torun 201000 Grudziadz 101000 Walbrzych 141000 Wloclawek 121000 Wroclaw 642000 Zamosc Zielona Gora 113000 German Polish Ukrainian Byelorussian Roman Catholic Polish Portugal Braga 63033 Coimbra 74616 Lisbon Lisboa 807937 Amadora 95518 Barreiro 50863 Almada 42607 Porto Oporto 327368 Vila Nova de Gaia 62468 Setubal 77885 Funchal 44111 Roman Catholic Protestant Portuguese Romania Alba Iulia Arad 191000 Pitesti 162000 Bacau 193000 Oradea 225000 Bistrita Botosani Braila 243000 Brasov 353000 Bucharest Bucuresti 2037000 Buzau 145000 Calarasi Resita Cluj Napoca 318000 Constanta 316000 Sfintu Gheorghe Tirgoviste Craiova 300000 Galati 307000 Giurgiu Tirgu Jiu Miercurea Ciuc Deva Slobozia Iasi 330000 Baia Mare 150000 Drobeta Turnu Severin Tirgu Mures 165000 Piatra Neamt Slatina Ploiesti Zalau Satu Mare 137000 Sibiu 184000 Suceava Alexandria Timisoara 333000 Tulcea Vaslui Rimnicu Vilcea Focsani German Gypsy Hungarian Romanian Roman Catholic Protestant Romanian Orthodox Russia Sergiev Posad Zagorsk 114000 Seversk 110000 Petrozavodsk 280000 Syktyvkar 229000 Ukhta 106000 Vorkuta 104000 Arkhangelsk 374000 Severodvinsk 241000 Vologda 299000 Cherepovets 320000 Murmansk 407000 Kaliningrad 419000 Sankt Peterburg 4838000 Sankt Peterburg 4838000 Kolpino 143000 Novgorod 233000 Pskov 207000 Velikiye Luki 116000 Bryansk 462000 Vladimir 339000 Kovrov 162000 Murom 126000 Ivanovo 474000 Kineshma 103000 Kaluga 347000 Obninsk 108000 Kostroma 285000 Moscow 8717000 Moscow 8717000 Podolsk 202000 Zelenograd 191000 Lyubertsy 166000 Kolomna 154000 Mytishchi 152000 Elektrostal 150000 Serpukhov 139000 Balashikha 136000 Khimki 134000 Odintsovo 129000 Orekhovo Zuyevo 126000 Noginsk 119000 Shchyolkovo 108000 Orel Oryol 348000 Ryazan 536000 Smolensk 355000 Tver 455000 Tula 532000 Novomoskovsk 144000 Yaroslavl 629000 Rybinsk 248000 Yoshkar Ola 251000 Saransk 320000 Cheboksary 450000 Novocheboksarsk 123000 Kirov 464000 Nizhniy Novgorod 1383000 Dzerzhinsk 285000 Arzamas 112000 Belgorod 322000 Stary Oskol 198000 Voronezh 908000 Kursk 442000 Lipetsk 474000 Yelets 119000 Tambov 316000 Michurinsk 108000 Elista Kazan 1085000 Naberezhnye Chelny 526000 Nizhnekamsk 210000 Almetyevsk 138000 Zelenodolysk 101000 Astrakhan 486000 Volgograd 1003000 Volzhsky 288000 Kamyshin 128000 Penza 534000 Kuznetsk 100000 Samara 1184000 Tolyatti 702000 Syzran 177000 Novokuybyshevsk 115000 Saratov 895000 Balakovo 206000 Engels 186000 Ulyanovsk Simbirsk 678000 Dimitrovgrad 135000 Rostov na Donu 1026000 Taganrog 292000 Shakhty 230000 Novocherkassk 190000 Volgodonsk 183000 Novoshakhtinsk 107000 Rostov no Donu Ufa 1094000 Sterlitamak 259000 Salavat 156000 Oktyabrsky 110000 Izhevsk 654000 Sarapul 109000 Glazov 107000 Votkinsk 104000 Orenburg 532000 Orsk 275000 Novotroitsk 110000 Perm 1032000 Berezniki 184000 Solikamsk 108000 Maykop 165000 Makhachkala 339000 Nazran Nalchik 239000 Cherkessk 119000 Vladikavkaz 312000 Grozny 364000 Krasnodar 646000 Sochi 355000 Novorossiysk 202000 Armavir 164000 Stavropol 342000 Pyatigorsk 133000 Nevinnomyssk 131000 Kislovodsk 120000 Neftekamsk Nikolo Beryozovka 117000 Kurgan 363000 Yekaterinburg 1280000 Nizhniy Tagil 409000 Kamensk Uralskiy 197000 Pervouralsk 137000 Serov 100000 Chelyabinsk 1086000 Magnitogorsk 427000 Zlatoust 203000 Miass 167000 Gorno Altaysk Barnaul 596000 Biysk 228000 Rubtsovsk 170000 Kemerovo 503000 Novokuznetsk 572000 Prokopyevsk 253000 Leninsk Kuznetskiy 121000 Kiselyovsk 116000 Mezhdurechensk 105000 Anzhero Sudzhensk 101000 Novosibirsk 1369000 Omsk 1163000 Tomsk 470000 Tyumen 494000 Surgut 263000 Nizhnevartovsk 238000 Ulan Ude 366000 Kyzyl Abakan 161000 Krasnoyarsk 869000 Norilsk 159000 Achinsk 123000 Kansk 109000 Irkutsk 585000 Angarsk 267000 Bratsk 257000 Ust Ilimsk 110000 Usolye Sibirskoye 106000 Chita 322000 Yakutsk 192000 Birobidzhan Anadyr Vladivostok 632000 Nakhodka 163000 Ussuriysk 162000 Khabarovsk 618000 Komsomolsk na Amure 309000 Blagoveshchensk 214000 Petropavlovsk Kamchatsky 210000 Magadan 128000 Yuzhno Sakhalinsk 160000 Ukrainian Russian Byelorussian Tatar Chuvash Bashkir Moldavian Russian San Marino San Marino 4416 Roman Catholic Italian Serbia and Montenegro Belgrade 1407073 Serbs Albanians Montenegrins Hungarians Muslim Roman Catholic Protestant Orthodox Albanian Serbo-Croatian Slovakia Bratislava German Polish Ukrainian Gypsy Hungarian Czech Slovak Ruthenian Roman Catholic Protestant Orthodox Slovenia Ljubljana Slovene Muslim Serb Croat Muslim Roman Catholic Slovenian Serbo-Croatian Spain Sevilla 714148 Almeria 167361 Cadiz 155438 Cordoba 315948 Granada 271180 Huelva 145049 Malaga 531443 Jerez de la Frontera 190390 Jaen 112772 Algeciras 103787 Zaragoza 606620 Oviedo 201712 Gijon 269644 Palma de Mallorca 322008 Vitoria Gasteiz 214148 Bilbao 371876 San Sebastian Donostia 177929 Santa Cruz de Tenerife 203929 Las Palmas de Gran Canaria 371787 La Laguna 125183 Santander 194822 Valladolid 336917 Albacete 141179 Burgos 166251 Leon 147311 Salamanca 167382 Toledo Barcelona 1630867 Lleida 114234 Tarragona 114630 Hospitalet de Llobregat 266242 Badalona 219340 Sabadell 189006 Terrassa 161428 Santa Coloma de Gramanet 131764 Baracaldo Barakaldo 103594 Mataro 102117 Badajoz 130153 Merida La Coruna 255087 Vigo 288573 Orense Ourense 108547 Santiago de Compostella Madrid 3041101 Mostoles 199141 Leganes 178162 Alcala de Henares 166250 Fuenlabrada 158212 Getafe 144368 Alcorcon 142165 Murcia 341531 Cartagena 179659 Pamplona 182465 Logrono 124823 Valencia 764293 Alicante Alacant 274964 Elche Elx 191305 Castellon de la Plana 139094 Mediterranean Nordic Roman Catholic Catalan Galician Basque Svalbard Longyearbyen Norwegian Russian Ukrainian Sweden Vanersborg 35804 Karlskrona 59007 Gavle 87431 Goteborg 449189 Visby 20000 Halmstad 77601 Ostersund 56662 Jonkoping 115429 Kalmar 54554 Falun 51900 Kristianstad 69941 Vaxjo 66925 Malmo 245699 Helsingborg 114339 Lulea 66526 Jokkmokk 6822 Orebro 119635 Linkoping 131370 Norrkoping 123795 Mariestad 24255 Nykoping 64199 Stockholm 711119 Uppsala 183472 Karlstad 74669 Umea 85698 Harnosand 27287 Vasteras 123728 foreign-born first-generation Roman Catholic Evangelical Lutheran Pentecostal Swedish Switzerland Aarau Herisau Appenzell Liestal Basel 172768 Bern 134393 Biel 53308 Fribourg Geneva 167697 Glarus Chur Delemont Luzern 59811 Neuchatel Stans Sarnen Sankt Gallen 74106 Schaffhausen Schwyz Solothurn Frauenfeld Bellinzona Altdorf Sion Lausanne 123149 Zug Zurich 343106 Winterthur 86340 Roman Catholic Protestant French German Italian Romansch Ukraine Cherkasy 297000 Chernihiv 301000 Chernivtsi 257000 Dnipropetrovsk 1187000 Kryvyy Rih 717000 Dniprodzerzhynsk 284000 Donetsk 1117000 Mariupol 520000 Makiyivka 427000 Horlivka 338000 Ivano Frankivsk 220000 Kharkiv 1618000 Kherson 361000 Khmelnytskyy 241000 Kiev Kyyiv 2616000 Kirovohrad 274000 Luhansk 501000 Lviv 798000 Mykolayiv 508000 Odesa 1106000 Poltava 317000 Kremenchuk 238000 Rivne 233000 Sumy 296000 Ternopil 212000 Vinnytsya 379000 Lutsk 204000 Uzhhorod Zaporizhzhya 891000 Zhytomyr 296000 Simferopol 349000 Sevastopol 361000 Ukrainian Russian Jewish United Kingdom Sandwell 293700 Wrexham Maelor 117100 Bristol 399200 Bedford 137300 Luton 178600 Reading 137700 Wokingham 142900 Newbury 141000 Windsor 136700 Slough 103500 Bracknell 101900 Aylesbury 151600 Milton Keynes 184400 Wycombe 161400 Cambridge 113800 Peterborough 156400 Huntingdon 148800 Chester 120800 Warrington 185000 Macclesfield 151400 Crewe 109500 Middlesbrough 145800 Stockton on Tees 177800 Truro Carlisle 102900 Derby 230500 Sutton in Ashfield 109800 Chesterfield 101200 Matlock Plymouth 255800 Exeter 105100 Bournemouth 159900 Poole 137200 Dorchester Darlington 100200 Durham Brighton 154400 Lewes Chelmsford 155700 Southend on Sea 167500 Basildon 161700 Colchester 149100 Braintree 121800 Epping Forest 118200 Cheltenham 106700 Stroud 105400 Gloucester 104800 Glouchester London 6967500 Manchester 431100 Wigan 310000 Stockport 291400 Bolton 265200 Salford 230700 Tameside 221800 Oldham 220400 Trafford 218100 Rochdale 207100 Bury 181400 Winchester 100500 Southampton 211700 Portsmouth 189100 Basingstoke 146500 Havant 117500 Eastleigh 109600 Fareham 101000 Worcester Saint Albans 127700 Hertford Kingston upon Hull 269100 Beverley 115800 Hull Newport 137000 Maidstone 138500 Rochester upon Medway 148200 Canterbury 132400 Swale 117200 Sevenoaks 109400 Dover 106100 Tonbridge 102100 Tunbridge Wells 101800 Preston 132200 Blackpool 153600 Blackburn 139500 Lancaster 133600 Leicester 293400 Leichester Lincoln Liverpool 474000 Wiral 331100 Sefton 292400 Saint Helens 180200 Knowsley 155300 Norwich 128100 Kings Lynn 131600 Northampton 187200 Newcastle Harrogate 146500 Scarborough 108700 York 104000 Northallerton Nottingham 282400 Newark on Trent 104400 Mansfield 102100 Oxford 132000 Shrewsbury Taunton Barnsley 226500 Sheffield 530100 Doncaster 292500 Rotherham 256300 Stafford 121500 Stoke on Trent 254200 Newcastle under Lyme 123000 Ipswich 114800 Guildford 126200 Reigate 118800 Elmbridge 117300 Kingston Sunderland 292200 Newcastle upon Tyne 283600 Gateshead 202400 Newcastle Warwick 118600 Nuneaton 118500 Stratford on Avon 108600 Birmingham 1008400 Dudley 312200 Coventry 302500 Walsall 263900 Wolverhampton 245100 Solihull 202000 West Bromwich 154500 Chichester 102500 Horsham 112300 Wakefield 317300 Leeds 724400 Bradford 481700 Kirklees 386900 Huddersfield 148500 Salisbury 109800 Trowbridge Newtown St. Boswells Stirling Dumfries Glenrothes Aberdeen 219100 Inverness Edinburgh 447600 Glasgow 674800 Renfrew 201700 Dundee 167600 Island Areas Colwyn Bay Llangefni Ebbw Vale Bridgend Ystrad Fawr Cardiff 300000 Carmarthen Aberystwyth Ruthin Mold Caernarfon Merthyr Tydfil Cwmbran Port Talbot Newport 137000 Haverfordwest Llandrindod Wells Rhondda Swansea 189300 Pontypool Rhymney Valley 104300 Barry Wrexham Belfast 297100 English Irish Welsh Scottish Ulster Afghanistan Kabul 892000 Tajik Pashtun Uzbek Hazara Sunni Muslim Shia Muslim Turkic Pashtu Afghan Persian Armenia Yerevan 1200000 Russian Armenian Azeri Armenian Orthodox Russian Armenian Azerbaijan Baku 1740000 Russian Armenian Azeri Dagestani Peoples Muslim Armenian Orthodox Russian Orthodox Russian Armenian Azeri Bahrain Manama 145000 Arab Asian Bahraini Iranian Sunni Muslim Shia Muslim Bangladesh Dhaka 3839000 Chittagong 1599000 Khulna 731000 Rajshahi 318000 Narayanganj 296000 Rangpur 207000 Mymensingh 202000 Barisal 188000 Tongi 181000 Comilla 156000 Jessore 154000 Nawabganj 141000 Dinajpur 138000 Bogra 130000 Brahmanbaria 125000 Savar 115000 Tangail 114000 Pabna 112000 Jamalpur 111000 Naogaon 110000 Sylhet 109000 Sirajganj 108000 Narsinghdi 106000 Saidpur 105000 Gazipur 104000 Bengali Muslim Hindu Bhutan Thimphu 20000 Bhote Nepalese Lamaistic Buddhism Indian- Nepalese-influenced Hinduism Brunei Bandar Seri Begawan 56300 Malay Chinese Muslim Christian Buddhism Myanmar Burma Monywa 106800 Pathein Bassein 144100 Magway Mandalay 532900 Bago Pegu 150500 Rangoon Yangon 2513000 Sagaing Tavoy Hakha Myitkyina Hpa an Loikaw Mawlamyine Moulmein 220000 Sittwe Akyab 107600 Taunggyi 108200 Indian Chinese Burman Shan Karen Rakhine Mon Muslim Buddhist Christian Burmese Cambodia Phnom Penh 400000 Chinese Khmer Vietnamese Theravada Buddhism China Macau 326460 Hong Kong 6218000 Hefei 1000000 Huainan 1200000 Suzhou 151862 Bengbu 449245 Wuhu 425740 Huaibei 366549 Maanshan 305421 Anqing 250718 Tongling 228017 Fuyang 179572 Luan 144248 Chuxian 125341 Chaoxian 123676 Xuancheng 112673 Fuzhou Fuzhou 874809 1290000 Xiamen 368786 Nanping 195064 Quanzhou 185154 Zhangzhou 181424 Sanming 160691 Longyan 134481 Yongan 111762 Lanzhou 1510000 Tianshui 244974 Baiyin 204970 Wuwei 133101 Yumen 109234 Guangzhou 3580000 Shantou 578630 Zhanjiang 400997 Shenzhen 350727 Shaoguan 350043 Chaozhou 313469 Dongguan 308669 Foshan 303160 Zhongshan 278829 Jiangmen 230587 Yangjiang 215196 Zhaoqing 194784 Maoming 178683 Zhuhai 164747 Huizhou 161023 Meixian 132156 Heyuan 120101 Shanwei 107847 Guiyang 1530000 Liupanshui 363954 Zunyi 261862 Anshun 174142 Duyun 132971 Kaili 113958 Haikou 280153 Sanya Ya Xian 102820 Shijiazhuang 1320000 Tangshan 1500000 Handan 1110000 Zhangjiakou 529136 Baoding 483155 Qinhuangdao 364972 Xingtai 302789 Chengde 246799 Renqiu 114256 Quzhou 112373 Hengshui 104269 Harbin 2830000 Qiqihar 1380000 Yichun 795789 Jixi 683885 Daqing 657297 Mudanjiang 571705 Hegang 522747 Jiamusi 493409 Shuangyashan 386081 Suihua 227881 Shangzhi 215373 Qitaihe 214957 Beian 204899 Acheng 197595 Zhaodong 179976 Fuling 173878 Shuangcheng 142659 Anda 136446 Mishan 132744 Zhengzhou 1710000 Luoyang 1190000 Kaifeng 507763 Xinxiang 473762 Anyang 420332 Pingdingshan 410775 Jiaozuo 409100 Nanyang 243303 Hebi 212976 Xuchang 208815 Xinyang 192509 Puyang 175988 Shangqiu 164880 Zhoukou 146288 Luohe 126438 Zhumadian 123232 Sanmenxia 120523 Wuhan 3750000 Huangshi 457601 Xiangfan 410407 Yichang 371601 Shashi 281352 Shiyan 273786 Cangzhou 242708 Honghu 190772 Echeng 190123 Tianmen 186332 Xiaogan 166280 Zaoyang 162198 Xianning 136811 Laohekou Guanghua 123366 Puqi 117264 Shishou 104571 Guangshui 102770 Changsha 1330000 Hengyang 487148 Xiangtan 441968 Zhuzhou 409924 Yueyang 302800 Changde 301276 Shaoyang 247227 Yiyang 185818 Lengshuijiang 137994 Leiyang 130115 Loudi 128418 Huaihua 126785 Zixing 110048 Liling 108504 Yuanjiang 107004 Nanjing 2500000 Wuxi 826833 Xuzhou 805695 Suzhou 706459 Changzhou 531470 Zhenjiang 368316 Lianyungang 354139 Nantong 343341 Yangzhou 312892 Yancheng 296831 Huaiyin 239675 Jiangyin 213659 Yixing 200824 Dongtai 192247 Changshu 181805 Danyang 169603 Xinghua 161910 Taizhou 152442 Huaian 131149 Liyang 109520 Yizheng 109268 Suqian 105021 Kunshan 102052 Fuzhou Fuzhou 874809 1290000 Nanchang 1350000 Yichun 151585 Pingxiang 425579 Jiujiang 291187 Jingdezhen 281183 Ganzhou 220129 Xinyu 173524 Shangrao 132455 Jilin 1270000 Changchun 2110000 Hunjiang 482043 Liaoyuan 354141 Tonghua 324600 Siping 317223 Dunhua 235100 Yanji 230892 Gongzhuling 226569 Baicheng 217987 Meihekou 209038 Fuyu 192981 Jiutai 180130 Huadian 175873 Longjing 139417 Daan 138963 Shenyang 4540000 Dalian 2400000 Anshan 1390000 Fushun 1350000 Benxi 768778 Fuxin 635473 Jinzhou 569518 Dandong 523699 Liaoyang 492559 Yingkou 421589 Panshan 362773 Jinxi 357052 Tieling 254842 Wafangdian 251733 Chaoyang 222394 Haicheng 205560 Beipiao 194301 Fengcheng 193784 Xingcheng 102384 Xining 551776 Yushu 131861 Xian 2760000 Xianyang 352125 Baoji 337765 Tongchuan 280657 Hanzhong 169930 Ankang 142170 Weinan 140169 Yanan 113277 Xi Jinan 2320000 Zibo 2460000 Qingdao 2060000 Yantai 452127 Weifang 428522 Zaozhuang 380846 Taian 350696 Linyi 324720 Tengxian 315083 Dongying 281728 Xintai 281248 Jining 265248 Laiwu 246833 Liaocheng 207844 Dezhou 195485 Heze 189293 Rizhao 185048 Liancheng 156307 Jiaoxian 153364 Pingdu 150123 Longkou 148362 Laiyang 137080 Wendeng 133910 Weihai 128888 Linqing 123958 Jiaonan 121397 Zhucheng 102134 Taiyuan 1960000 Datong 1110000 Yangquan 362268 Changzhi 317144 Yuci 191356 Linfen 187309 Jincheng 136396 Chengdu 2810000 Chongqing 2980000 Panzhihua Dukou 415466 Zigong 393184 Leshan 341128 Mianyang 262947 Luzhou 262892 Neijiang 256012 Yibin 241019 Qianjiang 205504 Daxian 188101 Deyang 182488 Guangyuan 182241 Nanchong 180273 Jiangyou 175753 Wanxian 156823 Xichang 134419 Kunming 1520000 Gejiu 214294 Qujing 178669 Hangzhou 1340000 Ningbo 1090000 Wenzhou 401871 Huzhou 218071 Jiaxing 211526 Shaoxing 179818 Xiaoshan 162930 Ruian 156468 Zhoushan 156317 Jinhua 144280 Yuyao 114056 Cixi 107329 Haining 100478 Nanning 1070000 Liuzhou 609320 Guilin 364130 Wuzhou 210452 Qinzhou 114586 Guixian 114025 Beihai 112673 Hohhot 652534 Baotou 1200000 Yakeshi 377869 Chifeng 350077 Jining 163552 Wuhai 264081 Tongliao 255129 Hailar 180650 Ulanhot 159538 Linhe 133183 Manzhouli 120023 Yinchuan 356652 Shizuishan 257862 Urumqi 1160000 Shihezi 299676 Karamay 197602 Yining 177193 Kashi 174570 Aksu 164092 Hami 161315 Korla 159344 Lhasa 106885 Beijing 7000000 Shanghai 7830000 Tianjin 5770000 Han Chinese Muslim Christian Cyprus Nicosia 161100 Muslim Greek Orthodox Georgia Tbilisi 1200000 Russian Armenian Azeri Georgian Ossetian Abkhaz Muslim Armenian Apostolic Christian Orthodox Russian Armenian Azeri Georgian India Pimpri Chinchwad 517083 Hyderabad 3145939 Vishakhapatnam 752037 Vijayawada 701827 Guntur 471051 Warangal 447653 Rajahmundry 324881 Itanagar Gauhati 584342 Dispur Patna 917243 Ranchi 599306 Jamshedpur 478950 Bokara Steel City 333683 Panaji Ahmadabad 2954526 Surat 1505872 Vadodara 1061598 Rajkot 612458 Bhavnagar 402338 Jamnagar 350544 Gandhinagar Chandigarh 510565 Simla Srinagar 594775 Jammu Bangalore 3302296 Hubli 648298 Mysore 606755 Trivandrum 699872 Cochin 582588 Kozhikode 456618 Bhopal 1062771 Indore 1091674 Jabalpur 764586 Gwalior 690765 Raipur 438639 Bhilai 395360 Ujjain 362633 Bhatpara 315976 Mumbai Greater 9925891 Nagpur 1624752 Pune 1566651 Kalyan 1014557 Thane 803389 Nasik 656925 Sholapur 604215 Aurangabad 573272 Amravati 421576 Kolhapur 406370 Bhiwandi 392214 Ulhasnagar 369077 New Bombay 307724 Bombay Imphal Shillong Aijal Kohima Bhubaneswar 411542 Cuttack 403418 Chandigarh 510565 Ludhiana 1042740 Amritsar 708835 Jalandhar 509510 Jaipur 1458183 Jodhpur 666279 Kota 537371 Bikaner 416289 Ajmer 402700 Gangtok Madras Chennai 3841396 Madurai 940989 Coimbatore 816321 Tiruchchirappalli 387223 Salem 366712 Agartala Lucknow 1619115 Kanpur 1879420 Varanasi 932399 Agra 891790 Allahabad 806486 Meerut 753778 Faridabad 617717 Bareilly 590661 Gorakhpur 505566 Aligarh 480520 Moradabad 429214 Saharanpur 374945 Jhansi 313491 Calcutta 4399819 Haora 950435 Durgapur 425836 Port Blair Chandigarh 510565 Silvassa Daman New Delhi Delhi 7206704 Ghaziabad 454156 Kavaratti Pondicherry Dravidian Indo-Aryan Mongoloid Muslim Buddhist Christian Hindu Sikh Jains Hindi Indonesia Jakarta 8259266 Bandung 2058649 Semarang 1250971 Surabaya 2483871 Yogyakarta 412392 Banda Aceh 184699 Bengkulu 170327 Jambi 339944 Bandar Lampung 636706 Padang 631543 Palembang 1144279 Medan 1730752 Pontianak 397343 Banjarmasin 481371 Palangkaraya 112562 Samarinda 407339 Ujung Pandang 944685 Ambon 276955 Malang 695618 Surakarta 504176 Pekan Baru 398694 Balikpapan 344405 Manado 320990 Bogor 271711 Cirebon 254878 Kediri 249807 Pekalongan 242874 Tegal 229713 Pematang Siantar 219328 Binjai 181904 Probolinggo 177120 Madiun 170242 Pasuruan 152409 Magelang 123213 Sukabumi 119981 Gorontalo 119780 Blitar 119011 Tebing Tinggi 116767 Pangkal Pinang 113163 Tanjung Balai 108202 Batam 106667 Pare Pare 101527 Javanese Sundanese Madurese Malays Muslim Roman Catholic Protestant Buddhist Hindu Iran Mehrshahr 413299 Islamshahr 239715 Rajaishahr 160362 Orumiyeh 396392 Khvoy 137885 Maragheh 117388 Tabriz 1166203 Ardabil 329869 Bakhtaran Kermanshah 665636 Yasuj Bandar e Bushehr 132824 Bushehr Shahr e Kord Esfahan 1220595 Najafabad 160004 Khomeynishahr 118348 Shiraz 1042801 Rasht 374475 Hamadan 406070 Malayer 130458 Bandar Abbas 383515 Ilam 116428 Kerman 349626 Sirjan 107887 Mashhad 1964489 Sabzevar 148065 Neyshabur 135681 Bojnurd 112426 Birjand 101177 Ahvaz 828380 Khorramshahr 197241 Dezful 181309 Masjed e Soleyman 107539 Sanandaj 277314 Khorramabad 277370 Borujerd 201016 Arak 378597 Sari 167602 Gorgan 162468 Amol 139923 Babol 137348 Qaemshahr 123684 Gonbad e Kavus 102768 Semnan Zahedan 419886 Tehran 6750043 Qom 780453 Karaj 588287 Qazvin 298705 Kashan 155188 Yazd 306268 Zanjan 280691 Arab Persian Baloch Azerbaijani Kurd Lur Turkmen Gilaki Mazandarani Sunni Muslim Shia Muslim Bahai Turkish Baloch Kurdish Arabic Luri Persian Persian Turkic Turkic Iraq Ar Ramadi 192556 Al Hillah 268834 Baghdad 4478000 Al Basrah 406296 An Nasiriyah 265937 Baqubah 114516 Karbala 296705 Al Amarah 208797 As Samawah An Najaf 309010 Mosul 664221 Al Mawsil Diwaniyah 196519 Ad Diwaniyah Samarra Kirkuk 418624 Al Kut 183183 Dahuk Irbil 485968 As Sulaymaniyah 364096 Arab Kurdish Assyrian Muslim Christian Israel Jerusalem 468900 Ramla Haifa Nazareth Tel Aviv Beer Sheva Jewish non-Jewish Christian Islam Druze Judaism Japan Sapporo 1748000 Aomori Morioka Sendai 967000 Akita Yamagata Fukushima Mito Utsonomiya Maebashi Urawa Chiba 843000 Tokyo 7843000 Yokohama 3256000 Kawasaki 1187000 Niigata Toyama Kanazawa Fukui Kofu Nagano Gifu Shizuoka Nagoya 2108000 Tsu Otsu Kyoto 1415000 Osaka 2492000 Kobe 1388000 Nara Wakayama Tottori Matsue Okayama Hiroshima 1099000 Yamaguchi Tokushima Takamatsu Matsuyama Kochi Fukuoka 1273000 Kita kyushu 1012000 Saga Nagasaki Kumamoto Oita Miyazaki Kagoshima Naha Japanese Shinto Buddhist Japanese Jordan Amman 777500 Armenian Arab Circassian Sunni Muslim Christian Kazakstan Almaty Alma Ata 1172400 Aqmola Tselinograd 280200 Aqtobe Aktyubinsk 258900 Atyrau Guryev 146900 Oral Uralsk 219100 Kokchetau 141400 Aqtau Shevchenko 151300 Shymkent Chimkent 397600 Pavlodar 340700 Ekibastuz 141100 Qaraghandy Karaganda 573700 Temirtau 206100 Qostanay 232100 Rudny 125700 Qyzylorda 162000 Semey Semipalatinsk 320200 Oskemen Ust Kamenogorsk 326300 Petropavl Petropavlovsk 239000 Taldyqorghan 116100 Arqalyq Auliye Ata Dzhambul 130600 Zhambyl Zhezqazghan 108700 Zhezkazghan Almaty Alma Ata 1172400 Leninsk German Ukrainian Russian Uzbek Tatar Kazak Muslim Protestant Russian Orthodox Kazak Korea North Korea Pyongyang 2335000 Hamhung Hungnam 701000 Chongjin 520000 Nampo 370000 Sunchon 356000 Sinuiju 289000 Tanchon 284000 Wonsan 274000 Tokchon 217000 Kanggye 211000 Haeju 195000 Anju 186000 Kimchaek Songjin 179000 Kusong 177000 Huichon 163000 Sinpo 158000 Kaesong 120000 Korean Korea South Korea Seoul 10229262 Pusan 3813814 Taegu 2449139 Inchon 2307618 Kwangju 1257504 Taejon 1272143 Ulsan 967394 Suwon 755502 Songnam 869243 Chonju 563406 Masan 441358 Chongju 531195 Chinju 329913 Mokpo 247524 Cheju 258509 Kunsan 266517 Chunchon 235067 Yosu 183557 Buddhism Christianity Confucianism Chondogyo Kuwait Kuwait 167768 Arab Iranian South Asian Kuwaiti Muslim Kyrgyzstan Bishkek 630000 German Ukrainian Russian Uzbek Kirghiz Laos Vientiane 377409 Lao Loum Lao Theung Lao Soung Hmong Yao Vietnamese/Chinese Buddhist Lebanon Beirut 702000 Armenian Arab Christian Islam Macau Macau Chinese Portuguese Roman Catholic Protestant Buddhist Portuguese Malaysia Seloyang Baru 124606 Johor Baharu 328646 Alor Setar 125026 Kota Baharu 219713 Melaka 295999 Seremban 182584 Kuantan 198356 Ipoh 382633 Taiping 183165 Kangar George Town 219376 Kota Kinabalu 208484 Tawai 244765 Sandakan 223432 Kuching 147729 Sibu 126384 Shah Alam 101733 Kelang 243698 Kuala Terengganu 228654 Kuala Lumpur 1145075 Petaling Jaya 254849 Labuan Indian Malay Chinese Mongolia Ulaanbaatar 479500 Russian Chinese Kazak Mongol Muslim Khalkha Mongol Nepal Kathmandu 393494 Muslim Buddhist Hindu Nepali Oman Muscat 30000 Ibadhi Muslim Pakistan Islamabad 204364 Hyderabad 1107000 Quetta 285719 Peshawar 1676000 Lahore 5085000 Karachi 9863000 Faisalabad Lyallpur 1875000 Gujranwala 1663000 Rawalpindi 1290000 Multan 1257000 Sialkot 302009 Sargodha 291362 Lahore Cantonment 237000 Jhang 195558 Sukkur 190551 Bahawalpur 180263 Kasur 155523 Gujrat 155058 Okara 153483 Sahiwal 150954 Mardan 147977 Sheikhupura 141168 Mirpur Khas 124371 Larkana 123890 Wah Cantonment 122335 Rahim Yar Khan 119036 Jhelum 106462 Chiniot 105559 Nawabshah 102139 Dera Ghazi Khan 102007 Muslim Pashtu Urdu Punjabi Sindhi Balochi Hindko Brahui Siraiki Papua New Guinea Port Moresby 141500 Roman Catholic Protestant Lutheran Anglican Seventh-Day Adventist Presbyterian/Methodist/London Missionary Society Evangelical Alliance English Philippines Manila 1655000 Quezon 1989000 Kalookan 1023000 Davao 1007000 Cebu 662000 Zamboanga 511000 Makati 484000 Pasig 471000 Cagayan de Oro 428000 Pasay 409000 Chinese Christian Malay Muslim Malay Muslim Roman Catholic Protestant Buddhist Qatar Doha 217294 Rayyan 91996 Wakrah 23682 Indian Pakistani Arab Iranian Muslim Saudi Arabia Riyadh 1250000 Jeddah Arab Afro-Asian Muslim Arabic Singapore Singapore 2558000 Indian Malay Chinese Sri Lanka Colombo 643000 Sinhalese Tamil Moor Vedda Muslim Buddhist Christian Hindu Tamil Sinhala Syria Damascus 1500000 Aleppo 976727 Homs 354508 Arab Muslim Sunni Muslim Christian Taiwan Chungho 387123 Sanchuung 382880 Hsinchuang 328758 Chungli 295825 Yungho 241104 Hsintien 248822 Changhua 221090 Chiai 261941 Hsinchu 341128 Hualien 107824 Ilan Fengshan 301374 Miaoli Nantou Makung Pingtung 214728 Fengyuan 157548 Hsinying Panchiao 539115 Taitung 109189 Taoyuan 260680 Touliu Chiai 261941 Chilung 370049 Hsinchu 341128 Kaohsiung 1426518 Taichung 857590 Tainan 707658 Taipei 2626138 Chinese Taiwanese Christian Taoist Tajikistan Khujand Leninabad 164500 Kulob 79300 Qurghonteppa 58400 Khorugh Dushanbe 582400 Russian Tajik Uzbek Sunni Muslim Shia Muslim Thailand Chiang Mai 167000 Nakhon Sawan 152000 Khon Kaen 206000 Nakhon Ratchasima 278000 Ubon Ratchathani 137000 Bangkok 5876000 Nonthaburi 233000 Saraburi 107000 Nakhon si Thammarat 112000 Songkhla 243000 Chinese Thai Muslim Buddhism Christianity Hinduism Turkey Icel 422357 Hatay 133474 Adana 1047300 Osmaniye 138000 Adiyaman 128000 Afyon Agri Aksaray Amasya Ankara 2782200 Antalya 497200 Artvin Aydin 121200 Balikesir 187600 Batman 182800 Bayburt Bilecik Bingol Bitlis Bolu Burdur Bursa 996600 Canakkale Cankiri Corum Denizli 234500 Diyarbakir 448300 Edirne 115500 Elazig 222800 Erzincan Erzurum 250100 Eskisehir 451000 Gaziantep 716000 Giresun Gumushane Hakkari Iskenderun 156800 Antakya 137200 Mersin 523000 Tarsus 225000 Isparta 120900 Istanbul 7615500 Izmir 1985300 Karaman Karaman Maras 242200 Kars Kastamonu Kayseri 454000 Kirikkale 170300 Kirklareli Kirsehir Izmit 275800 Kocaeli 256882 Gebze 237300 Adapazari 186000 Konya 576000 Kutahya 140700 Malatya 319700 Manisa 187500 Mardin Mugla Mus Nevsehir Nigde Ordu 121300 Rize Sakarya Samsun 326900 Sanliurfa Urfa 357900 Siirt Sinop Sirnak Sivas 240100 Tekirdag Tokat Trabzon 145400 Tunceli Usak 119900 Van 194600 Yozgat Zonguldak 115900 Karabuk 113900 Turkish Kurdish Muslim Turkmenistan Ashgabat 416400 Nebitdag 89100 Dashhowuz Tashauz 117000 Charjew Chardzhou 166400 Mary 94900 Russian Uzbek Turkmen Kazak Muslim Eastern Orthodox Russian Uzbek Turkmen UAE United Arab Emirates Abu Dhabi 363432 Dubai 585189 Al Ayn 176441 Sharjah 125123 South Asian Emiri Arab Iranian Muslim Uzbekistan Andijon 303000 Bukhoro 236000 Farghona 191000 Quqon Kokand 184000 Marghilon 129000 Jizzakh 116000 Urganch 135000 Namangan 341000 Nawoiy 115000 Qarshi 177000 Samarqand 368000 Guliston Termiz Tashkent Toshkent 2106000 Chirchiq 156000 Angren 132000 Olmaliq 116000 Nukus 185000 Russian Tajik Uzbek Tatar Kazak Karakalpak Muslim Eastern Orthodox Russian Tajik Uzbek Vietnam Hanoi 3056146 Haiphong 1447523 Can Tho 284306 Ho Chi Minh City Saigon 3924435 Da Nang 369734 Nha Trang 263093 Hue 260489 Nam Dinh 219615 Long Xuyen 214037 Qui Nhon 201912 Thai Nguyen 171815 Vung Tau 133558 Hong Gai 129394 Cam Pha 127408 Viet Tri 116084 Chinese Vietnamese Yemen Sanaa 427185 Arabic Anguilla The Valley African Roman Catholic Anglican Baptist Seventh-Day Adventist Methodist English Antigua and Barbuda Saint Johns 36000 English Argentina La Plata 642979 La Matanza 1111811 Moron 641541 Lomas de Zamoras 572769 Mar del Plata 512880 Quilmes 509445 Lanus 466755 General San Martin 407506 Avellaneda 346620 San Isidro 299022 Vicente Lopez 289142 Bahia Blanca 260096 San Nicolas de los Arroyos 119302 San Fernando del Valle de Catamarca 110269 San Fernando 132626 Resistencia 292350 Comodoro Rivadavia 124104 Rawson 52000 Cordoba 1208713 Rio Cuarto 138853 Corrientes 258103 Parana 211936 Concordia 116485 Formosa 148074 San Salvador de Jujuy 180102 Santa Rosa 107000 La Rioja 103727 Mendoza 773113 Posadas 210755 Neuquen 243803 Viedma 25000 Salta 370904 San Juan 352691 San Luis 110136 Rio Gallegos 43000 Santa Fe 406388 Rosario 1118984 Santiago del Estero La Banda 263471 Santiago del Estero 148000 Ushuaia 3000 San Miguel de Tucuman 622324 Buenos Aires 2988006 Indian Jewish Roman Catholic Protestant Aruba Oranjestad European/Caribbean Indian Roman Catholic Protestant Bahamas Nassau 140000 Roman Catholic Protestant Anglican Baptist Methodist Church God Barbados Bridgetown 10000 European African Roman Catholic Protestant English Belize Belmopan 3000 Creole Garifuna Maya Roman Catholic Protestant Bolivia La Paz 953400 Sucre 110000 Cochabamba 304000 European Quechua Aymara Roman Catholic Brazil Contagem 491268 Campos dos Goytacazes 391299 Betim 249795 Ribeirao das Neves 197147 Sumare 167751 Sao Jose dos Pinhais 167286 Santa Barbara dOeste 161020 Alvorada 160671 Cabo de Santo Agostinho 137295 Hortolandia 114885 Sapucaia do Sul 113992 Ibirite 106773 Abaetetuba 106753 Nossa Senhora do Socorro 103496 Rio Branco 228907 Maceio 723156 Macapa 214197 Manaus 1158265 Salvador 2209465 Feira de Santana 449960 Ilheus 242589 Vitoria da Conquista 241776 Itabuna 183237 Juazeiro 171904 Jequie 165361 Camacari 134768 Alagoinhas 122882 Barreiras 113544 Fortaleza 1967365 Caucaia 208902 Juazeiro do Norte 186490 Maracanau 160088 Sobral 138274 Cariacica 300085 Vila Velha 297052 Serra 266851 Vitoria 263708 Cachoeiro de Itapemirim 147283 Colatina 103621 Linhares 103030 Goiania 998520 Anapolis 264873 Araguaina 105000 Luziania 104840 Rio Verde 100223 Sao Luis 781068 Imperatriz 227731 Caxias 133710 Timon 118332 Codo 104825 Cuiaba 433101 Varzea Grande 190374 Rondonopolis 142221 Campo Grande 598216 Dourados 153165 Parnaiba 124641 Belo Horizonte 2091770 Uberlandia 437111 Juiz de Fora 423913 Montes Claros 271324 Uberaba 232134 Governador Valadares 231077 Ipatinga 195736 Divinopolis 171562 Sete Lagoas 167112 Teofilo Otoni 127214 Pocos de Caldas 121845 Patos de Minas 112690 Itapecerica da Serra 110362 Barbacena 107843 Sabara 100570 Varginha 100079 Belem 1142258 Ananindeua 342905 Santarem 242765 Maraba 147030 Castanhal 117747 Itaituba 104896 Joao Pessoa 549270 Campina Grande 340412 Santa Luzia 152682 Santa Rita 105584 Curitiba 1465698 Londrina 412894 Maringa 267878 Ponta Grossa 252674 Foz do Iguacu 231596 Cascavel 219623 Colombo 153583 Guarapuava 149158 Paranagua 115394 Apucarana 101005 Recife 1342877 Jaboatao dos Guararapes 528973 Paulista 234706 Caruaru 231874 Gravatai 205657 Petrolina 190453 Vitoria de Santo Antao 111575 Camaragibe 111190 Garanhuns 110190 Teresina 653994 Rio de Janeiro 5533011 Sao Goncalo 827967 Novo Iguacu 801036 Duque de Caxias 712370 Niteroi 450129 Sao Joao de Meriti 433713 Belfort Roxo 393520 Olinda 355741 Petropolis 267604 Volta Redonda 228939 Mage 180550 Nova Friburgo 169218 Barra Mansa 164768 Itaborai 156631 Nilopolis 155190 Teresopolis 122614 Macae 112966 Queimados 108531 Cabo Frio 101142 Natal 656244 Mossoro 205732 Porto Alegre 1286251 Caxias do Sul 326222 Pelotas 304285 Canoas 284114 Santa Maria 226226 Novo Hamburgo 225082 Viamao 195880 Sao Leopoldo 180741 Rio Grande 178223 Passo Fundo 156352 Uruguaiana 121825 Bage 114091 Santa Cruz do Sul 100562 Porto Velho 293815 Boa Vista 154166 Joinvile 397987 Florianopolis 268551 Blumenau 230988 Criciuma 159033 Praia Grande 150574 Sao Jose 147490 Lages 140005 Itajai 134797 Chapeco 130458 Sao Paulo 9811776 Guarulhos 972766 Campinas 907996 Sao Bernardo do Campo 658791 Santo Andre 625294 Osasco 622374 Sao Jose dos Campos 485780 Ribeirao Preto 452804 Sorocaba 431370 Santos 412288 Maua 344684 Carapicuiba 328015 Sao Jose do Rio Preto 323418 Diadema 323221 Moji das Cruzes 314947 Piracicaba 302605 Jundiai 293237 Bauru 293026 Sao Vicente 279620 Franca 266909 Aparecida de Goiania 265446 Limeira 230292 Itaquaquecetuba 228533 Guaruja 226185 Taubate 220179 Embu 195676 Taboao da Serra 182441 Suzano 180703 Marilia 177503 Presidente Prudente 177236 Barueri 176740 Sao Carlos 175295 Jacarei 168030 Americana 167901 Araraquara 163831 Aracatuba 162546 Rio Claro 153025 Sao Caetano do Sul 140808 Itapevi 133769 Cotia 127047 Itu 122544 Indaiatuba 122159 Ferraz de Vasconcelos 121992 Moji Guacu 114555 Pindamonhangaba 114092 Itapetininga 111909 Braganca Paulista 109863 Francisco Morato 106328 Barretos 104782 Jau 103605 Catanduva 100913 Botucatu 100826 Ribeirao Pires 100335 Aracaju 426580 Arapiraca 173351 Palmas Brasilia 1817001 African Roman Catholic British Virgin Islands Road Town Asian Roman Catholic Protestant English Canada Surrey 245173 Edmonton 616741 Calgary 710677 Vancouver 471844 Burnaby 158858 Victoria 263180 Winnipeg 616790 Fredericton 45248 Saint Johns 143390 Yellowknife 8256 Halifax 114455 Ottawa 313987 Glouchester 101677 Vaughan 111359 London 303165 Hamilton 318499 Scarborough 524598 York 140525 Toronto 635395 Kitchener 168282 Windsor 191435 Oshawa 129344 North York 562564 Mississauga 463388 Etobicoke 309993 Brampton 234445 Markham 153811 Burlington 129575 Saint Catharines 129300 Thunder Bay 113746 Nepean 107627 East York 102696 Charlottetown 24837 Laval 314398 Montreal 1017666 Quebec 167517 Longueuil 129874 Richmond 126624 Regina 179178 Saskatoon 186058 Whitehorse 13311 French Asian European British Isles Indian Eskimo Roman Catholic Anglican United Church Cayman Islands George Town English Chile Santiago 4318000 Valparaiso 267000 Indian European European-Indian Roman Catholic Protestant Spanish Colombia Leticia Medellin 1621356 Bello 304819 Itagui 169374 Turbo 127045 Envigado 109240 Arauca Barranquilla 1064255 Soledad 264583 Malambo 112289 Cartagena 745689 Mangangue 104496 Tunja 120210 Manizales 335125 Florencia 118027 Yopal Popayan 223128 Valledupar 265505 Quibdo 130921 Monteria 276074 Bogota 5237635 Soacha 266817 Puerto Inirida Cienaga 144340 Riohacha 142455 San Jose del Guaviare Neiva 248178 Santa Marta 309372 Villavicencio 252711 Pasto 325540 Tumaco 114802 Cucuta 479309 Mocoa Armenia 220303 Pereira 352530 Dosquebradas 163599 San Andres Bogota 5237635 Bucaramanga 351737 Floridablanca 246834 Barrancabermeja 180653 Sincelejo 180076 Ibague 346632 Cali 1718871 Buenaventura 266988 Palmira 256823 Tulua 138124 Cartago 117166 Mitu Puerto Carreno Indian black-Indian Roman Catholic Spanish Costa Rica San Jose 296600 Alajuela 158300 Cartago 109000 Heredia 67400 Liberia 36400 Puntarenas 92400 Limon 67800 Indian Chinese Roman Catholic Cuba Camaguey 293961 Ciego de Avila Cienfuegos 132038 Havana La Habana 2241000 Bayamo 137663 Manzanillo 107650 Guantanamo 207796 Holguin 242085 Havana La Habana 2241000 Victoria de las Tunas 126930 Matanzas 123843 Pinar del Rio 128570 Sancti Spiritus Santiago de Cuba 440084 Santa Clara 205400 Nueva Gerona Chinese Roman Catholic Spanish Dominica Roseau 11000 Carib Indians Roman Catholic Protestant Dominican Republic Santo Domingo 1400000 Roman Catholic Spanish Ecuador Quito 1200000 Guayaquil 1300868 Spanish Indian Roman Catholic El Salvador Soyapango 251811 Mejicanos 145000 Delgado 104790 Apopa 100763 Ahuachapan Sensuntepeque Cojutepeque Chalatenango Nueva San Salvador 116575 Zacatecoluca La Union San Francisco Gotera San Miguel 182817 San Salvador 422570 San Vicente Santa Ana 202337 Sonsonate Usulutan Indian Roman Catholic French Guiana Cayenne 38155 Amerindian Roman Catholic French Grenada Saint Georges 30000 African Guadeloupe Basse-Terre Chinese Roman Catholic Protestant Hindu African French Guatemala Guatemala Guatemala City 823301 Mixco 209791 Villa Nueva 101295 Mestizo - Amerindian-Spanish Amerindian Amerindian Spanish Indian Guyana Georgetown 170000 East Indian Amerindian European Chinese Muslim Christian Hindu Haiti Port-au-Prince 800000 European Roman Catholic Protestant French Honduras La Ceiba 77100 Tela 24000 Trujillo Comayagua 44300 Santa Rosa de Copan 21500 San Pedro Sula 325900 Puerto Cortes 32500 Choluteca 63200 Danli 35500 Yuscaran Tegucigalpa 670100 Siguatepeque 32200 Puerto Lempira La Esperanza Roatan La Paz Gracias Ocotepeque Jutigalpa 22500 Santa Barbara Nacaome El Progreso 70000 Olanchito 15900 Yoro Indian Roman Catholic Jamaica Kingston 101000 African Afro-European East Indian Afro-East Indian Chinese Afro-Chinese Roman Catholic Protestant Martinique Fort-de-France Chinese African African-white-Indian Roman Catholic Hindu African Mexico Veracruz Llave 438821 Atizapan de Zaragoza 315059 Soledad de Graciano Sanchez 123943 San Pedro Garza Garcia 113017 Ciudad Apodaca 103364 Aguascalientes 440425 Mexicali 438377 Tijuana 698752 Ensenada 169426 La Paz 137641 Campeche 150518 Tuxtla Gutierrez 289626 Nezahualcoyotl 1255456 Tonala 151190 Tapachula 138858 Chihuahua 516153 Juarez 789522 Saltillo 420947 Torreon 439436 Monclova 177792 Colima 106967 Victoria de Durango 348036 Gomez Palacio 164092 Durango 182600 Leon 758279 Salamanca 123190 Irapuato 265042 Celaya 214856 Guanajuato 36809 Acapulco 515374 Chilpancingo 36193 Pachuca 174013 Pachuca de Soto 83892 Guadalajara 1650042 Zapopan 668323 Tlaquepaque 328031 Cuautla 110242 Toluca 327865 Toluca de Lerdo 136100 Morelia 428486 Uruapan 187623 Zamora 109751 Cuernavaca 279187 Tepic 206967 Monterrey 1068996 Guadalupe 535332 San Nicolas de los Garza 436603 Ciudad Santa Catarina 162707 Oaxaca 212818 Puebla 1007170 Tehuacan 139450 Queretaro 385503 Cancun 167730 Chetumal 23685 San Luis Potosi 488238 Culiacan 415046 Mazatlan 262705 Los Mochis 162659 Hermosillo 406417 Ciudad Obregon 219980 Heroica Nogales 105873 Villahermosa 261231 Ciudad Victoria 194996 Tampico 272690 Matamoros 266055 Reynosa 265663 Nuevo Laredo 218413 Ciudad Madero 160331 Tlaxcala 116800 Cordoba 130695 Xalapa Enriquez 279451 Coatzacoalcos 198817 Poza Rica 151739 Minatitlan 142060 Orizaba 114216 Jalapa 161400 Merida 523422 Zacatecas 100051 Mexico Mexico City Ciudad de Mexico 9815795 Amerindian Amerindian Caucasian Caucasian Roman Catholic Protestant Montserrat Plymouth Europeans English Netherlands Antilles Willemstad African Nicaragua Managua 1195000 Leon 171375 Chinandega 101211 Masaya 100646 Indian Roman Catholic Protestant Spanish Panama Bocas del Toro Penonome 61000 Colon 140900 El Porvenir David 102700 La Palma Chitre 34700 Las Tablas 21100 Panama Panama City 594800 San Miguelito 243000 Santiago 61000 West Indian Indian Roman Catholic Protestant English Paraguay Asuncion 729307 Amerindians Roman Catholic Peru Chachapoyas Chimbote 268979 Huaraz Abancay Arequipa 619156 Ayacucho 105918 Cajamarca 92447 Callao Cuzco Cusco 255568 Huancavelica Huanuco 118814 Ica 161406 Chincha Alta 110016 Huancayo 258209 Trujillo 509312 Chiclayo 411536 Lima 6321173 Iquitos 274759 Puerto Maldonado Moquegua Cerro de Pasco Piura 277964 Sullana 147361 Talara 82228 Puno 91877 Juliaca 142576 Moyobamba Tacna 174336 Tumbes Pucallpa 172286 Indian Roman Catholic Puerto Rico San Juan Hispanic Roman Catholic Protestant Saint Kitts and Nevis Basseterre 14700 African English Saint Lucia Castries 49000 African East Indian Roman Catholic Protestant Anglican Saint Pierre and Miquelon Saint-Pierre Basques Bretons Roman Catholic French Saint Vincent and the Grenadines Kingstown 33694 Suriname Paramaribo 150000 Chinese Javanese Creole Europeans Amerindian Hindustani Muslim Roman Catholic Protestant Hindu Trinidad and Tobago Port-of-Spain 150000 Chinese East Indian Muslim Roman Catholic Protestant Anglican Hindu Turks and Caicos Islands Grand Turk African Anglican Baptist Seventh-Day Adventist Methodist English USA states United States Birmingham 265347 258543 Mobile 196263 202581 Montgomery 190350 196363 Huntsville 159880 170424 Anchorage 226338 250505 Juneau 19528 Phoenix 984310 1159014 Tucson 411480 449002 Mesa 289199 344764 Glendale 147864 182219 Scottsdale 130075 179012 Tempe 141993 162701 Chandler 89862 142918 Little Rock 175727 175752 Los Angeles 3485557 3553638 San Diego 1110623 1171121 San Jose 782224 838744 San Francisco 723959 735315 Long Beach 429321 421904 Fresno 354091 396011 Sacramento 369365 376243 Oakland 372242 367230 Santa Ana 293827 302419 Anaheim 266406 288945 Riverside 226546 255069 Stockton 210943 232660 Bakersfield 176264 205508 Huntington Beach 181519 190751 Fremont 173339 187800 Glendale 180038 184321 San Bernardino 170036 183474 Modesto 164746 178559 Chula Vista 135160 151963 Oxnard 142560 151009 Garden Grove 142965 149208 Oceanside 128090 145941 Ontario 133179 144854 Moreno Valley 118779 140932 Torrance 133107 136183 Pomona 131700 134706 Pasadena 131586 134116 Irvine 110330 127873 Sunnyvale 117324 125156 Santa Clarita 120050 125153 Santa Rosa 113261 121879 Hayward 114705 121631 Fullerton 114144 120188 Orange 110658 119890 Rancho Cucamonga 101409 116613 Escondido 108648 116184 Lancaster 97300 115675 Thousand Oaks 104381 113368 Salinas 108777 111757 Inglewood 109602 111040 El Monte 106162 110026 Vallejo 109199 109593 Simi Valley 100218 106974 Palmdale 70262 106540 Fontana 87535 104124 Berkeley 102724 103243 West Covina 96226 101526 Costa Mesa 96357 100938 Norwalk 94279 100209 Corona 75943 100208 Denver 467610 497840 Colorado Springs 280430 345127 Aurora 222103 252341 Lakewood 126475 134999 Fort Collins 87491 104196 Bridgeport 141686 137990 Hartford 139739 133086 New Haven 130474 124665 Stamford 108056 110056 Waterbury 108961 106412 Dover 23512 Jacksonville 635230 679792 Miami 358648 365127 Tampa 280015 285206 St. Petersburg 240318 235988 Hialeah 188008 204684 Orlando 164674 173902 Fort Lauderdale 149238 151805 Tallahassee 124773 136812 Hollywood 121720 127894 Coral Springs 78864 105275 Pembroke Pines 65566 100662 Clearwater 98669 100132 Columbus Columbus 632945 657053 178683 182828 Atlanta 393929 401907 Savannah 137812 136262 Macon 107365 113352 Honolulu 377059 423475 Hilo Boise City Boise 126685 152737 Chicago 2783726 2721547 Rockford 141787 143531 Aurora 99672 116405 Peoria 113513 112306 Naperville 85806 107001 Indianapolis 731278 746737 Fort Wayne 191839 184783 Evansville 126272 123456 Gary 116646 110975 South Bend 105511 102100 Des Moines 193189 193422 Cedar Rapids 108772 113482 Kansas City Kansas City 434829 441259 151521 142654 Wichita 304017 320395 Overland Park 111790 131053 Topeka 119883 119658 Louisville 269555 260689 Lexington Fayette 225366 239942 Frankfort 25973 New Orleans 496938 476625 Baton Rouge 219531 215882 Shreveport 198525 191558 Lafayette 101852 104899 Augusta 21819 Baltimore 736014 675401 Annapolis 31740 Boston 574283 558394 Worcester 169759 166350 Lowell 103439 100973 Detroit 1027974 1000272 Grand Rapids 189126 188242 Warren 144864 138078 Flint 140925 134881 Lansing 127321 125736 Sterling Heights 117810 118698 Ann Arbor 109608 108758 Livonia 100850 105099 Minneapolis 368383 358785 St. Paul 272235 259606 Jackson 202062 192923 Kansas City Kansas City 434829 441259 151521 142654 St. Louis 396685 351565 Independence 112301 110303 Jefferson City 33619 Helena 23938 Omaha 342862 364253 Lincoln 191972 209192 Las Vegas 258204 376906 Reno 133850 155499 Henderson 64948 122339 Carson City 32022 Manchester 99332 100967 Newark 275221 268510 Jersey City 228517 229039 Paterson 140891 150270 Elizabeth 110002 110149 Trenton 92124 Albuquerque 384915 419681 Santa Fe 48899 New York 7322564 7380906 Buffalo 328175 310548 Rochester 230356 221594 Yonkers 188082 190316 Syracuse 163860 155865 Albany 100031 103564 Charlotte 419539 441297 Raleigh 212092 243835 Greensboro 183894 195426 Winston Salem 150958 153541 Durham 138894 149799 Hendersonville 6862 Bismarck 44485 Columbus Columbus 632945 657053 178683 182828 Cleveland 505616 498246 Cincinnati 364114 345818 Toledo 332943 317606 Akron 223019 216882 Dayton 182005 172947 Oklahoma City 444724 469852 Tulsa 367302 378491 Portland 463634 480824 Eugene 112733 123718 Salem 107793 122566 Philadelphia 1585577 1478002 Pittsburgh 369879 350363 Erie 108718 105270 Allentown 105301 102211 Harrisburg 53264 Providence 160728 152558 Columbia 110734 112773 Sioux Falls 100836 113223 Pierre 11973 Rapid City 46492 Memphis 618652 596725 Nashville Davidson 488366 511263 Knoxville 169761 167535 Chattanooga 152393 150425 Nashville 455657 Houston 1637859 1744058 San Antonio 959295 1067816 Dallas 1007618 1053292 El Paso 515342 599865 Austin 472020 541278 Fort Worth 447619 479716 Arlington 261717 294816 Corpus Christi 257453 280260 Lubbock 186206 193565 Plano 127885 192280 Garland 180635 190055 Irving 155037 176993 Amarillo 157571 169588 Laredo 122899 164899 Brownsville 107027 132091 Pasadena 119604 131620 Mesquite 101484 111947 Beaumont 114323 111224 Grand Prairie 99606 109231 Abilene 106707 108476 Waco 103590 108412 McAllen 84021 103352 Wichita Falls 96259 100138 Paris Salt Lake City 159928 172575 Montpelier 8241 Virginia Beach 393089 430385 Norfolk 261250 233430 Richmond 202798 198267 Chesapeake 151982 192342 Newport News 171439 176122 Arlington 170897 175334 Hampton 133811 138757 Alexandria 111182 117586 Portsmouth 103910 101308 Williamsburg 9870 Seattle 516259 524704 Spokane 177165 186562 Tacoma 176664 179114 Olympia 27447 Charleston 63968 Milwaukee 628088 590503 Madison 190766 197630 Green Bay 96466 102076 Cheyenne 47283 Washington 606900 543213 Asian Native American Jewish Roman Catholic Protestant Uruguay Montevideo 1247000 Jewish Roman Catholic Protestant Venezuela Turmero 174280 Santa Ana de Coro 124506 Puerto Ayacucho Barcelona 221792 Puerto La Cruz 155731 San Fernando Maracay 354196 Barinas 153630 Ciudad Bolivar 225340 Ciudad Guayana 453047 Valencia 903621 Puerto Cabello 128825 Guacara 100766 San Carlos Tucupita Coro San Juan Barquisimeto 625450 Merida 170902 Los Teques 140617 Petare 338417 Baruta 182941 Guarenas 134158 Maturin 206654 La Ascuncion Acarigua 116551 Guanare Cumana 212432 San Cristobal 220675 Trujillo San Felipe Maracaibo 1249670 Cabimas 165755 Caracas 1822465 Catia La Mar 100104 Amerindian Roman Catholic Protestant Virgin Islands Charlotte Amalie Roman Catholic Baptist Episcopalian American Samoa Pago Pago Caucasian Tongan Samoan Roman Catholic Protestant Christian Congregationalist Australia Newcastle 429000 Sydney 3657000 Wollongong 238000 Geelong 151000 Sunshine Coast 110000 Darwin 68500 Brisbane 1302000 Gold Coast 266000 Townsville 114000 Adelaide 1050000 Hobart 184000 Melbourne 3081000 Perth 1193000 Albany Canberra 310000 Bantam Village Flying Fish Cove Kingston Asian Caucasian Roman Catholic Anglican Christian English Bermuda Hamilton Roman Catholic Anglican Seventh-Day Adventist Methodist African Methodist Episcopal English Christmas Island The Settlement Malay Chinese European Muslim Buddhist Christian English Cocos Islands West Island Sunni Muslim Christian English Cook Islands Avarua European Polynesian Polynesian European Polynesian non-European Christian Falkland Islands Stanley British English Fiji Suva 69481 Indian Fijian Muslim Christian Hindu French Polynesia Papeete French Chinese Polynesian Roman Catholic Protestant Greenland Nuuk Danish Greenlander Evangelical Lutheran Guam Agana Chamorro Filipino Roman Catholic Kiribati Tarawa 2100 Micronesian Roman Catholic Protestant Mormon Maldives Male 46334 Sunni Muslim Marshall Islands Majuro 7600 Micronesian Christian Mauritius Port Louis Creole Indo-Mauritian Sino-Mauritian Franco-Mauritian Muslim Christian Hindu Micronesia Kolonia 5500 Micronesian Polynesian Roman Catholic Protestant Nauru no official capital Chinese European Nauruan Pacific Islander Christian New Caledonia Noumea Vietnamese European Polynesian Melanesian Wallisian Indonesian Roman Catholic Protestant New Zealand Wellington 352030 Auckland 952600 European Pacific Islander Maori Roman Catholic Protestant Anglican Baptist Methodist Presbyterian Niue Alofi Polynesian Morman Ekalesia Nieue Norfolk Island Kingston Roman Catholic Anglican Seventh-Day Adventist Uniting Church Australia Northern Mariana Islands Saipan Christian Palau Koror 7685 Pitcairn Islands Adamstown Bounty Seventh-Day Adventist Reunion Saint-Denis Roman Catholic Saint Helena Jamestown NA English Seychelles Victoria Seychellois Roman Catholic Anglican Solomon Islands Honiara 26000 Chinese European Polynesian Micronesian Melanesian Roman Catholic Protestant Anglican Baptist Seventh-Day Adventist United English Tonga Nukualofa 28899 Christian Tuvalu Funafuti 2120 Polynesian Bahai Seventh-Day Adventist Church Tuvalu Vanuatu Port-Vila 15759 French Melanesian Catholic Anglican Seventh-Day Adventist Presbyterian Church Christ Wallis and Futuna Mata-Utu Polynesian Roman Catholic Western Samoa Apia 36000 Europeans Samoan Euronesians Christian Algeria Algiers 1507241 Annaba 222518 Batna 181601 Bechar 107311 Sidi bel Abbes 152778 Skikda 128747 Tebessa 107559 Oran 609823 Constantine 440842 Setif 170182 Blida 127284 Bejaia 114534 Mostaganem 114037 Tlemcen 107632 European Arab-Berber Sunni Muslim Christian Jewish Angola Cabinda Mbanza Congo Uige Luanda Ndalatando Sumbe Malanje Lucapa Saurimo Benguela Huambo Bie Luena Menongue Namibe Lubango Caxito Ngiva European Ovimbundu Kimbundu Bakongo Roman Catholic Protestant Benin Porto-Novo African Muslim Christian Botswana Gaborone Batswana Kgalagadi Christian Burkina Faso Ouagadougou Mossi Muslim Christian Burundi Bujumbura Muslim Christian Cameroon Ngaoundere Yaounde 750000 Bertoua Maroua 143000 Douala 884000 Garoua 177000 Bamenda 138000 Bafoussam 131000 Ebolowa Buea African Fulani Cameroon Highlanders Equatorial Bantu Kirdi Northwestern Bantu Eastern Nigritic non-African Muslim Christian Cape Verde Praia European African Creole Roman Catholicism Central African Republic Bangui Baya Banda Sara Mandjia Mboum MBaka Muslim Roman Catholic Protestant Chad NDjamena Muslim Christian Comoros Moroni Roman Catholic Sunni Muslim Congo Brazzaville Muslim Christian Cote dIvoire Yamoussoukro Abidjan Malinke Baoule Bete Senoufou Muslim Christian Djibouti Djibouti Italian Afar Somali Muslim Christian Egypt Hurghada Marsa Matruh El Tur El Arish El Kharga Damanhur 226000 Kafr el Dauwar 161000 El Mansura 358000 Dumyat 121000 Tanta 374000 El Mahalla el Kubra 385000 Ismailiya 236000 Kafr el Sheikh Shibin el Kom 136000 Benha 120000 Shubra el Kheima 533000 Zagazig 274000 Aswan 196000 Asyut 291000 Beni Suef 163000 El Faiyum 227000 El Giza 1671000 El Minya 203000 Qena 142000 El Uqsur 148000 Sohag 142000 Port Said 382000 Bur Said Alexandria 2917000 El Iskandariya Cairo 6053000 Helwan 352000 El Qahira Suez 265000 El Suweiz European Eastern Hamitic Muslim Coptic Christian Equatorial Guinea Malabo 33000 Sta. Isabel Christian Roman Catholic Eritrea Asmara Afar Tigrinya Tigre Kunama Saho Ethiopia Addis Ababa Addis Abeba 2316400 Dire Dawa 194587 Gonder 166593 Nazret 147088 Harer Harar 122932 Mekele 119779 Jima Jimma 119717 Dese 117268 Bahir Dar 115531 Debre Zevit Debrezit 105963 Afar Somali Oromo Sidamo Shankella Gurage Amhara Tigrean Muslim Ethiopian Orthodox Gabon Libreville Muslim Christian Ghana Accra 867459 Kumasi 376249 Cape Coast 57224 Tamale 135952 Tema 131528 Takoradi 61484 Sekondi 31916 European African Muslim Christian Guinea Conakry Malinke Peuhl Soussou Muslim Christian French Guinea-Bissau Bissau European African Muslim Christian Kenya Nyeri 88600 Thika 57100 Mombasa 465000 600000 Malindi 35200 Machakos 116100 Meru 78100 Embu Nairobi 1346000 2000000 Garissa Kisumu 185100 201100 Kisii 44000 Nakuru 162800 124200 Eldoret 104900 Kitale 53000 Kericho 40000 Kakamega 47300 Arab Kikuyu Luhya Luo Kalenjin Kamba Kisii Meru Roman Catholic Protestant Lesotho Maseru 75000 Sotho Christian Liberia Monrovia African Americo-Liberians Muslim Christian English Libya Tripoli Bengasi Berber Arab Sunni Muslim Madagascar Antsiranana Diego Suarez 220000 Antananarivo 1250000 Antsirabe 100000 Fianarantsoa 300000 Mahajanga Majunga 200000 Toamasina Tamatave 230000 Toliary 150000 Muslim Christian Malawi Lilongwe Muslim Roman Catholic Protestant Mali Bamako Mande Peul Voltaic Songhai Tuareg Moor Muslim Christian Bambara Mauritania Nouakchott Maur Maur/black Muslim Mayotte Mamoutzou NA Muslim Morocco Rabat 1385872 Agadir 550200 Fes 774754 Kenitra 448785 Khouribga 294680 Marrakech 745541 Meknes 530171 Oujda 678778 Safi 376038 Tanger 526215 Casablanca 2940623 Beni Mellal 386505 Tetouan 367349 Jewish Arab-Berber Muslim Jewish Christian Mozambique Matala 337239 Pemba Xai Xai Inhambane Chimoio 108818 Maputo 931591 Nacala 125208 Nampula 250473 Lichinga Beira 298847 Tete 112221 Quelimane 146206 Maputo 931591 Europeans Indians Euro-Africans Muslim Christian Portuguese Namibia Windhoek Lutheran German English Afrikaans Niger Niamey Fula Hausa Djerma Tuareg Beri Beri Gourmantche Muslim Nigeria Abuja Makurdi 109000 Maiduguri 282000 Calabar 154000 Benin City 203000 Enugu 279000 Kaduna 302000 Kano 595000 Katsina 182000 Ilorin 420000 Lagos 5686000 Minna 120000 Abeokuta 377000 Ondo 150000 Akure 143000 Oshogbo 421000 Oyo 226000 Ibadan 1263000 Jos 182000 Port Harcourt 362000 Sokoto 181000 Ogbomosho 644000 Zaria 335000 Ilesha 334000 Onitsha 328000 Iwo 320000 Ado Ekiti 317000 Mushin 294000 Ede 271000 Aba 264000 Ife 262000 Ila 233000 Ikerre 216000 Iseyin 192000 Ilobu 176000 Offa 175000 Ikorodu 163000 Ilawe Ekiti 163000 Owo 162000 Ikirun 160000 Shaki 154000 Gusau 139000 Ijebu Ode 138000 Effon Alaiye 135000 Kumo 131000 Shomolu 130000 Oka 126000 Ikare 124000 Sapele 123000 Deba Habe 122000 Aarri 111000 Bida 111000 Ikire 109000 Lafia 108000 Inisa 106000 Shagamu 104000 non-Africans 27000 Muslim Christian Rwanda Kigali Hutu Tutsi Twa Muslim Roman Catholic Protestant Sao Tome and Principe Sao Tome Europeans Portuguese Senegal Dakar 1382000 Diourbel Fatick Kaolack 132000 Kolda Louga Saint Louis 122000 Tambacounda Thies 156000 Ziguinchor 107000 Fulani Wolof Diola Mandingo Serer Toucouleur European Lebanese Muslim Christian Sierra Leone Freetown Asian African Muslim Christian Somalia Mogadishu Somali Sunni Muslim South Africa Ibhayi 257000 Diepmeadow 241000 Lekoa 218000 Tembisa 209000 Katlehong 202000 Evaton 201000 Khayalitsha 190000 Roodepoort 163000 Mamelodi 155000 Daveyton 152000 Soshanguve 146000 Germiston 134000 Mangaung 126000 Alexandra 125000 Boksburg 120000 Carletonville 119000 Benoni 114000 Kempton Park 107000 Sandton 101000 Port Elizabeth 303000 East London 102000 King Williams Town Bloemfontein 127000 Pretoria 526000 Johannesburg 713000 Soweto 597000 Pietermaritzburg 156000 Durban 716000 Nelspruit Kimberley Pietersburg Mmabatho Cape Town 855000 Indian Colored Muslim Sudan Malakal Waw Nyala 228778 al Fasher Juba 114980 Khartoum 924505 Omdurman 1267077 Khartoum North 879105 al Ubayyid 228096 ad Damir Kassala 234270 Port Sudan 305385 al Qadarif 189384 Wad Madani 218714 Arab Beja Sunni Muslim Christian Swaziland Mbabane European African Christian Tanzania Dodoma 203833 Arusha 134708 Moshi Tanga 187155 Morogoro 117760 Dar es Salaam 1360850 Dar es Salaam 1360850 Lindi Mtwara Mikandani Songea Iringa Mbeya 152844 Singida Tabora Sumbawanga Kigoma Ujiji Shinyanga 100724 Bukoba Mwanza 223013 Musoma Mkokotoni Koani Zanzibar 157634 Wete Chake Cahke Gambia Banjul African non-Gambian Muslim Christian Togo Lome African European Syrian-Lebanese Muslim Christian Tunisia Tunis Jewish European Arab-Berber Muslim Jewish Christian Uganda Kampala Rwanda Arab Baganda Karamojong Basogo Iteso Langi Bagisu Acholi Lugbara Bunyoro Batobo Muslim Roman Catholic Protestant Western Sahara El Aaiun Muslim Zaire Kikwit 182142 Bandundu Matadi 172730 Boma 135284 Mbandaka 169841 Kisangani 417517 Kananga 393030 Tshikapa 180860 Mbuji Mayi 806475 Mwene Ditu 137459 Kalemi 101309 Bukavu 201569 Uvira 115590 Butembo 109406 Goma 109094 Lubumbashi 851381 Kolwezi 417810 Likasi 299118 Kinshasa 4655313 Mangbetu-Azande Muslim Roman Catholic Protestant Kimbanguist Zambia Kabwe 166519 Ndola 376311 Kitwe 338207 Chingola 167954 Mufulira 152944 Luanshya 146275 Chipata Mansa Lusaka 982362 Kasama Solwezi Livingstone Mongu European African Christian Muslim Hindu Zimbabwe Harare Asian African Muslim Christian basex-7.7.2/basex-examples/src/main/resources/xml/ft.xml000066400000000000000000000015521222453003200232230ustar00rootroot00000000000000 Improving the Usability of a Web Site Through Expert Reviews and Usability Testing Millicent Marigold Montana Marigold Véra Tudor-Medina

    The usability of a Web site is how well the site supports the users in achieving specified goals. A Web site should facilitate learning, and enable efficient and effective task completion, while propagating few errors.

    This book has been approved by the Web Site Users Association. Certainly the retrieval of information is very important. But information retrievel covers the whole field.
    basex-7.7.2/basex-examples/src/main/resources/xml/input.xml000066400000000000000000000006371222453003200237540ustar00rootroot00000000000000 XML

    Databases & XML

    Assignments
    • Exercise 1
    • Exercise 2
    basex-7.7.2/basex-examples/src/main/resources/xml/orders.xml000066400000000000000000000001571222453003200241100ustar00rootroot00000000000000 174 30 basex-7.7.2/basex-examples/src/main/resources/xml/orders.xq000066400000000000000000000001761222453003200237410ustar00rootroot00000000000000 174 30 //order[id='174']basex-7.7.2/basex-examples/src/main/resources/xml/orders.xsl000066400000000000000000000002541222453003200241140ustar00rootroot00000000000000 basex-7.7.2/basex-examples/src/main/resources/xml/test.xml000066400000000000000000000006721222453003200235730ustar00rootroot00000000000000
    text in child 3 3.4 3 3 basex-7.7.2/basex-examples/src/main/resources/xml/xqft-usecases.xq000066400000000000000000000022441222453003200252340ustar00rootroot00000000000000declare default element namespace "http://www.w3.org/1999/xhtml"; declare variable $specs := "xqft-usecases"; declare variable $sample := "xqft"; declare variable $stopwords := "xqft-sw.txt"; declare function local:getQueries() { for $ex in doc($specs)//div[@class = 'div3'] let $header := normalize-space($ex/h4/text()) return { local:getQuery($ex, 'xquery') } { local:getQuery($ex, 'xpath') } }; declare function local:getQuery($node, $version) { let $string := concat('solution in ', $version, ':') let $qu := $node/p[lower-case(em) = $string]/following-sibling::*[1]/pre return replace(replace($qu, "http://bstore1.example.com/full-text.xml", $sample), "http://bstore1.example.com/StopWordList.xml", $stopwords) }; { for $query in local:getQueries() let $xquery := $query/xquery/text() return { $xquery }{ try { { basex:eval($xquery) } } catch *($error) { { $error } } } } basex-7.7.2/basex-examples/src/main/resources/xml/xqft.xml000066400000000000000000000403251222453003200235750ustar00rootroot00000000000000 Improving the Usability of a Web Site Through Expert Reviews and Usability Testing Millicent Marigold Montana Marigold New York Ersatz Publications 2001 2002 25.99 Usability testing Web site development Heuristic evaluation Cognitive walk-through Web site usability Tests d'ergonomie Développement de site web Évaluation heuristique Parcours cognitif Ergonomie de site web å¯ç”¨æ€§æµ‹è¯• 网站建置 å¯å‘å¼è¯„ä»· 认知推演 网站å¯ç”¨æ€§ Elina Rose

    The usability of a Web site is how well the site supports the user in achieving specified goals. A Web site should facilitate learning, and enable efficient and effective task completion, while propagating few errors. Satisfaction with the site is also important. The user must not only be well-served, but must feel well-served.

    Expert reviews and usability testing are methods of identifying problems in layout, terminology, and navigation before they frustrate users and drive them away from your site.

    The most successful projects employ multiple methods in multiple iterations. As Millicent Marigold remarked during a recent conference, "Don't stop. Iterate, iterate, then iterate again."

    This book has been approved by the Web Site Users Association.

    Expert Reviews

    Expert reviewers identify problems and recommend changes to web sites based on research in human computer interaction and their experience in the field.

    Two expert review methods are discussed here. They are heuristic evaluation and cognitive walk-through.

    Expert review methods should be initiated early in the development process, as soon as paper prototypes (hand-drawn pictures of Web pages) or wireframes (electronic mockups) are available. They should be conducted using the hardware and software similar to that employed by users.

    Heuristic Evaluation

    Expert reviewers critique an interface to determine conformance with recognized usability principles. One of the best known lists of heuristics is Ten Usability Heuristics by Jacob Nielson. Another is Research-Based Web Design and Usability Guidelines

    Cognitive Walk-Through

    Expert reviewers evaluate Web site understandability and ease of learning while performing specified tasks. They walk through the site answering questions such as "Would a user know by looking at the screen how to complete the first step of the task?" and "If the user completed the first step, would the user know what to do next?," with the goal of identifying any obstacles to completing the task and assessing whether the user would cognitively be aware that he was successful in completing a step in the process.

    Usability Testing

    Once the problems identified by expert reviews have been corrected, it is time to conduct some tests of the site with your unique audience or audiences by conducting usability testing.

    Users are asked to complete tasks which measure the success of the information architecture and navigational elements of the site.

    Then changes are made to improve service to users.

    Usability Basics: How to Plan for and Conduct Usability Tests on Web Site Thereby Improving the Usability of Your Web Site New York Ersatz Publications Electronic BookWorks 2000 2001 174.00 Usability testing Web site development Guides and finding aids Tests d'ergonomie Développement de site web Guides et outils de recherche å¯ç”¨æ€§æµ‹è¯• 网站建置 指å—和检索工具

    This is a basic handbook for planning and conducting usability tests on Web sites. Usability testing should be used in conjunction with other expert review methods.

    This book has not been approved by the Web Site Users Association.

    Planning then Conducting Usability Tests

    Take the following steps to plan usability testing. Clarify and articulate the goal of the usability testing. Identify tasks which are critical for users to be able to complete successfully. Compile a script of questions or instructions which will prompt the user to attempt those tasks. Identify your users and begin recruiting them. Conduct a pretest on a few users. Edit the script based on insights gleaned from the pretest. Resume testing.

    Conducting Usability Tests

    Users can be tested at any computer workstation They may be more comfortable at their own workstation than in a lab. or in a lab.

    Give the user the script, then assure them that you are testing the Web site, not them. Users are asked to verbalize their thoughts as they complete the tasks. The event is recorded or someone takes notes. It is often preferable to have two testers, Usability testing can be done at great expense or on a shoe string, using in-house expertise or contracting with human computer interaction professionals . one to ask the questions, another to take notes. Testers should offer no guidance or comments to the user. Mouse movements, typing, expressions, and the user's words should be recorded.

    Evaluating and Implementing Results

    Compile the results and review collectively. Make changes to the site to alleviate the problems found in Web site components which were propagating the largest number of or the most devastating errors. Begin new iterations of testing and changes, until users are successful in the accomplishing the tasks.

    John Wesley Usabilityguy: A Register of His Papers Millicent Marigold Morty Marigold Washington, D.C. Ersatz Manuscript Library 1998 2002 21.49 Computers Software evaluation Usability testing Manuscript collections Ordinateurs Évaluation de logiciels Tests d'ergonomie Collections de manuscrits 计算机 软件评价 å¯ç”¨æ€§æµ‹è¯• 手稿专è—

    The papers of John Wesley Usabilityguy span the years 1946-2001, with the bulk of the items concentrated in the period from 1985 to 2001. The papers feature his career as a developer of software applications and usability specialist. The collection consists of correspondence, memoranda, journals, speeches, article drafts, book drafts, notes, charts, graphs, family papers, clippings, printed matter, photographs, résumés and other materials.

    1-12 Subject File, <date normalize="1930/1974"> 1930-1974</date>

    Correspondence, telegrams, memoranda, journals, logs, testimony, approved travel orders, invitations, charts, graphs, forms, biographical data, photographs, book drafts, clippings and other printed matter, résumés and miscellaneous material. Organized by name of person or organization, topic, or type of material.

    1 Computers Software, 1946-1947 Human Computer Interaction research, 1945-1952 Flow diagram, 1950 General, 1947-1951 2 Eye Movement research, 1949-1950 User profiling, 1950s Web User Appreciation Award, 1956
    3-5 Writings File, <date normalize="1985/1999">1985-1999</date>

    Correspondence, articles, book drafts, notes, contracts, clippings, and printed matter. Arranged alphabetically by type (articles, books, reports, and miscellaneous) and therein alphabetically by type of material, subject, or title.

    Writings by Usabilityguy 1996 "How Many Users Are Enough for User Testing?" "How to Evaluate Results from User Tests." 5 "When Are You Done Testing?" "Do-It-Yourself User Testing" Charitable Contributions Diseases: AIDS, Hepatitis, Tuberculosis 1990-1999 Environmental Conservation: Rivers 1995
    basex-7.7.2/basex-examples/src/main/resources/xml/xqft.xq000066400000000000000000001722731222453003200234350ustar00rootroot00000000000000declare namespace fts="http://www.w3.org/2007/xpath-full-text"; declare function fts:matchTokenInfos ( $searchContext as item(), $matchOptions as element(fts:matchOptions), $stopWords as xs:string*, $queryTokens as element(fts:queryToken)* ) as element(fts:tokenInfo)* {()}; declare function fts:evaluate ( $ftSelection as element(*, fts:ftSelection), $searchContext as item(), $matchOptions as element(fts:matchOptions), $queryTokenNum as xs:integer ) as element(fts:allMatches) { if (fn:count($ftSelection/fts:matchOptions) > 0) then (: First we deal with all match options that the :) (: FTSelection might bear: we add the match options :) (: to the current match options structure, and :) (: pass the new structure to the recursive call. :) let $newFTSelection := {$ftSelection/* [fn:not(self::fts:matchOptions)]} return fts:evaluate($newFTSelection, $searchContext, fts:replaceMatchOptions($matchOptions, $ftSelection/fts:matchOptions), $queryTokenNum) else if (fn:count($ftSelection/fts:weight) > 0) then (: Weight has no bearing on semantics -- just :) (: call "evaluate" on nested FTSelection :) let $newFTSelection := $ftSelection/*[fn:not(self::fts:weight)] return fts:evaluate($newFTSelection, $searchContext, $matchOptions, $queryTokenNum) else typeswitch ($ftSelection/*[1]) case $nftSelection as element(fts:ftWords) return (: Apply the FTWords in the search context :) fts:ApplyFTWords($searchContext, $matchOptions, $nftSelection/@type, $nftSelection/fts:queryItem, $queryTokenNum + 1) case $nftSelection as element(fts:ftAnd) return let $left := fts:evaluate($nftSelection/fts:left, $searchContext, $matchOptions, $queryTokenNum) let $newQueryTokenNum := $left/@stokenNum let $right := fts:evaluate($nftSelection/fts:right, $searchContext, $matchOptions, $newQueryTokenNum) return fts:ApplyFTAnd($left, $right) case $nftSelection as element(fts:ftOr) return let $left := fts:evaluate($nftSelection/fts:left, $searchContext, $matchOptions, $queryTokenNum) let $newQueryTokenNum := $left/@stokenNum let $right := fts:evaluate($nftSelection/fts:right, $searchContext, $matchOptions, $newQueryTokenNum) return fts:ApplyFTOr($left, $right) case $nftSelection as element(fts:ftUnaryNot) return let $nested := fts:evaluate($nftSelection/fts:selection, $searchContext, $matchOptions, $queryTokenNum) return fts:ApplyFTUnaryNot($nested) case $nftSelection as element(fts:ftMildNot) return let $left := fts:evaluate($nftSelection/fts:left, $searchContext, $matchOptions, $queryTokenNum) let $newQueryTokenNum := $left/@stokenNum let $right := fts:evaluate($nftSelection/fts:right, $searchContext, $matchOptions, $newQueryTokenNum) return fts:ApplyFTMildNot($left, $right) case $nftSelection as element(fts:ftOrder) return let $nested := fts:evaluate($nftSelection/fts:selection, $searchContext, $matchOptions, $queryTokenNum) return fts:ApplyFTOrder($nested) case $nftSelection as element(fts:ftScope) return let $nested := fts:evaluate($nftSelection/fts:selection, $searchContext, $matchOptions, $queryTokenNum) return fts:ApplyFTScope($nftSelection/@type, $nftSelection/@scope, $nested) case $nftSelection as element(fts:ftContent) return let $nested := fts:evaluate($nftSelection/fts:selection, $searchContext, $matchOptions, $queryTokenNum) return fts:ApplyFTContent($searchContext, $nftSelection/@type, $nested) case $nftSelection as element(fts:ftDistance) return let $nested := fts:evaluate($nftSelection/fts:selection, $searchContext, $matchOptions, $queryTokenNum) return fts:ApplyFTDistance($nftSelection/@type, $nftSelection/fts:range, $nested) case $nftSelection as element(fts:ftWindow) return let $nested := fts:evaluate($nftSelection/fts:selection, $searchContext, $matchOptions, $queryTokenNum) return fts:ApplyFTWindow($nftSelection/@type, $nftSelection/@size, $nested) case $nftSelection as element(fts:ftTimes) return let $nested := fts:evaluate($nftSelection/fts:selection, $searchContext, $matchOptions, $queryTokenNum) return fts:ApplyFTTimes($nftSelection/fts:range, $nested) default return }; (: simplified version not dealing with special match options :) declare function fts:applyQueryTokensAsPhraseSimple ( $searchContext as item(), $matchOptions as element(fts:matchOptions), $queryTokens as element(fts:queryToken)*, $queryPos as xs:integer ) as element(fts:allMatches) { { for $tokenInfo in fts:matchTokenInfos( $searchContext, $matchOptions, (), $queryTokens ) return {$tokenInfo} } }; declare function fts:MakeDisjunction ( $curRes as element(fts:allMatches), $rest as element(fts:allMatches)* ) as element(fts:allMatches) { if (fn:count($rest) = 0) then $curRes else let $firstAllMatches := $rest[1] let $restAllMatches := fn:subsequence($rest, 2) let $newCurRes := fts:ApplyFTOr($curRes, $firstAllMatches) return fts:MakeDisjunction($newCurRes, $restAllMatches) }; declare function fts:ApplyFTWordsAnyWord ( $searchContext as item(), $matchOptions as element(fts:matchOptions), $queryItems as element(fts:queryItem)*, $queryPos as xs:integer ) as element(fts:allMatches) { (: Tokenization of query string has already occurred. :) (: Get sequence of QueryTokens over all query items. :) let $queryTokens := $queryItems/fts:queryToken return if (fn:count($queryItems) eq 0) then else let $allAllMatches := for $queryToken at $pos in $queryTokens return fts:applyQueryTokensAsPhrase($searchContext, $matchOptions, $queryToken, $queryPos + $pos - 1) let $firstAllMatches := $allAllMatches[1] let $restAllMatches := fn:subsequence($allAllMatches, 2) return fts:MakeDisjunction($firstAllMatches, $restAllMatches) }; declare function fts:MakeConjunction ( $curRes as element(fts:allMatches), $rest as element(fts:allMatches)* ) as element(fts:allMatches) { if (fn:count($rest) = 0) then $curRes else let $firstAllMatches := $rest[1] let $restAllMatches := fn:subsequence($rest, 2) let $newCurRes := fts:ApplyFTAnd($curRes, $firstAllMatches) return fts:MakeConjunction($newCurRes, $restAllMatches) }; declare function fts:ApplyFTWordsAllWord ( $searchContext as item(), $matchOptions as element(fts:matchOptions), $queryItems as element(fts:queryItem)*, $queryPos as xs:integer ) as element(fts:allMatches) { (: Tokenization of query strings has already occurred. :) (: Get sequence of QueryTokens over all query items :) let $queryTokens := $queryItems/fts:queryToken return if (fn:count($queryTokens) eq 0) then else let $allAllMatches := for $queryToken at $pos in $queryTokens return fts:applyQueryTokensAsPhrase($searchContext, $matchOptions, $queryToken, $queryPos + $pos - 1) let $firstAllMatches := $allAllMatches[1] let $restAllMatches := fn:subsequence($allAllMatches, 2) return fts:MakeConjunction($firstAllMatches, $restAllMatches) }; declare function fts:ApplyFTWordsPhrase ( $searchContext as item(), $matchOptions as element(fts:matchOptions), $queryItems as element(fts:queryItem)*, $queryPos as xs:integer ) as element(fts:allMatches) { (: Get sequence of QueryTokenInfos over all query items :) let $queryTokens := $queryItems/fts:queryToken return if (fn:count($queryTokens) eq 0) then else fts:applyQueryTokensAsPhrase($searchContext, $matchOptions, $queryTokens, $queryPos) }; declare function fts:ApplyFTWordsAny ( $searchContext as item(), $matchOptions as element(fts:matchOptions), $queryItems as element(fts:queryItem)*, $queryPos as xs:integer ) as element(fts:allMatches) { if (fn:count($queryItems) eq 0) then else let $firstQueryItem := $queryItems[1] let $restQueryItem := fn:subsequence($queryItems, 2) let $firstAllMatches := fts:ApplyFTWordsPhrase($searchContext, $matchOptions, $firstQueryItem, $queryPos) let $newQueryPos := if ($firstAllMatches//@queryPos) then fn:max($firstAllMatches//@queryPos) + 1 else $queryPos let $restAllMatches := fts:ApplyFTWordsAny($searchContext, $matchOptions, $restQueryItem, $newQueryPos) return fts:ApplyFTOr($firstAllMatches, $restAllMatches) }; declare function fts:ApplyFTWordsAll ( $searchContext as item(), $matchOptions as element(fts:matchOptions), $queryItems as element(fts:queryItem)*, $queryPos as xs:integer ) as element(fts:allMatches) { if (fn:count($queryItems) = 0) then else let $firstQueryItem := $queryItems[1] let $restQueryItem := fn:subsequence($queryItems, 2) let $firstAllMatches := fts:ApplyFTWordsPhrase($searchContext, $matchOptions, $firstQueryItem, $queryPos) return if ($restQueryItem) then let $newQueryPos := if ($firstAllMatches//@queryPos) then fn:max($firstAllMatches//@queryPos) + 1 else $queryPos let $restAllMatches := fts:ApplyFTWordsAll($searchContext, $matchOptions, $restQueryItem, $newQueryPos) return fts:ApplyFTAnd($firstAllMatches, $restAllMatches) else $firstAllMatches }; declare function fts:ApplyFTWords ( $searchContext as item(), $matchOptions as element(fts:matchOptions), $type as fts:ftWordsType, $queryItems as element(fts:queryItem)*, $queryPos as xs:integer ) as element(fts:allMatches) { if ($type eq "any word") then fts:ApplyFTWordsAnyWord($searchContext, $matchOptions, $queryItems, $queryPos) else if ($type eq "all word") then fts:ApplyFTWordsAllWord($searchContext, $matchOptions, $queryItems, $queryPos) else if ($type eq "phrase") then fts:ApplyFTWordsPhrase($searchContext, $matchOptions, $queryItems, $queryPos) else if ($type eq "any") then fts:ApplyFTWordsAny($searchContext, $matchOptions, $queryItems, $queryPos) else fts:ApplyFTWordsAll($searchContext, $matchOptions, $queryItems, $queryPos) }; declare function fts:applyQueryTokensAsPhrase ( $searchContext as item(), $matchOptions as element(fts:matchOptions), $queryTokens as element(fts:queryToken)*, $queryPos as xs:integer ) as element(fts:allMatches) { let $thesaurusOption := $matchOptions/fts:thesaurus[1] return if ($thesaurusOption and $thesaurusOption/@thesaurusIndicator eq "with") then let $noThesaurusOptions := { $matchOptions/*[fn:not(self::fts:thesaurus)] } let $lookupRes := fts:applyThesaurusOption($thesaurusOption, $queryTokens) return fts:ApplyFTWordsAny($searchContext, $noThesaurusOptions, $lookupRes, $queryPos) else (: from here on we have a single sequence of query tokens :) (: which is to be matched a phrase; no alternatives anymore :) { for $pos in fts:matchTokenInfos( $searchContext, $matchOptions, fts:applyStopWordOption($matchOptions/fts:stopwords), $queryTokens ) return {$pos} } }; declare function fts:replaceMatchOptions ( $matchOptions as element(fts:matchOptions), $newMatchOptions as element(fts:matchOptions) ) as element(fts:matchOptions) { { (if ($newMatchOptions/fts:thesaurus) then $newMatchOptions/fts:thesaurus else $matchOptions/fts:thesaurus), (if ($newMatchOptions/fts:stopwords) then $newMatchOptions/fts:stopwords else $matchOptions/fts:stopwords), (if ($newMatchOptions/fts:case) then $newMatchOptions/fts:case else $matchOptions/fts:case), (if ($newMatchOptions/fts:diacritics) then $newMatchOptions/fts:diacritics else $matchOptions/fts:diacritics), (if ($newMatchOptions/fts:stem) then $newMatchOptions/fts:stem else $matchOptions/fts:stem), (if ($newMatchOptions/fts:wildcard) then $newMatchOptions/fts:wildcard else $matchOptions/fts:wildcard), (if ($newMatchOptions/fts:language) then $newMatchOptions/fts:language else $matchOptions/fts:language) } }; declare function fts:resolveStopWordsUri ( $uri as xs:string? ) as xs:string* {()}; declare function fts:lookupThesaurus ( $tokens as element(fts:queryToken)*, $thesaurusName as xs:string?, $thesaurusLanguage as xs:string?, $relationship as xs:string?, $range as element(fts:range)? ) as element(fts:queryItem)* {()}; declare function fts:applyThesaurusOption ( $matchOption as element(fts:thesaurus), $queryTokens as element(fts:queryToken)* ) as element(fts:queryItem)* { if ($matchOption/@thesaurusIndicator = "with") then fts:lookupThesaurus( $queryTokens, $matchOption/fts:thesaurusName, $matchOption/@language, $matchOption/fts:relationship, $matchOption/fts:range ) else if ($matchOption/@thesaurusIndicator = "without") then {$queryTokens} else () }; declare function fts:applyStopWordOption ( $stopWordOption as element(fts:stopwords)? ) as xs:string* { if ($stopWordOption) then let $swords := typeswitch ($stopWordOption/*[1]) case $e as element(fts:stopword) return $e/text() case $e as element(fts:uri) return fts:resolveStopWordsUri($e/text()) case element(fts:default-stopwords) return fts:resolveStopWordsUri(()) default return () return fts:calcStopWords( $swords, $stopWordOption/fts:oper ) else () }; declare function fts:calcStopWords ( $stopWords as xs:string*, $opers as element(fts:oper)* ) as xs:string* { if ( fn:empty($opers) ) then $stopWords else let $swords := typeswitch ($opers[1]/*[1]) case $e as element(fts:stopword) return $e/text() case $e as element(fts:uri) return fts:resolveStopWordsUri($e/text()) default return () return if ($opers[1]/@type eq "union") then fts:calcStopWords( ($stopWords, $swords), $opers[fn:position() gt 2] ) else (: "except" :) fts:calcStopWords( $stopWords[fn:not(.)=$swords], $opers[fn:position() gt 2] ) }; declare function fts:ApplyFTOr ( $allMatches1 as element(fts:allMatches), $allMatches2 as element(fts:allMatches) ) as element(fts:allMatches) { {$allMatches1/fts:match,$allMatches2/fts:match} }; declare function fts:ApplyFTAnd ( $allMatches1 as element(fts:allMatches), $allMatches2 as element(fts:allMatches) ) as element(fts:allMatches) { { for $sm1 in $allMatches1/fts:match for $sm2 in $allMatches2/fts:match return {$sm1/*, $sm2/*} } }; declare function fts:InvertStringMatch ( $strm as element(*,fts:stringMatch) ) as element(*,fts:stringMatch) { if ($strm instance of element(fts:stringExclude)) then {$strm/fts:tokenInfo} else {$strm/fts:tokenInfo} }; declare function fts:UnaryNotHelper ( $matches as element(fts:match)* ) as element(fts:match)* { if (fn:empty($matches)) then else for $sm in $matches[1]/* for $rest in fts:UnaryNotHelper( fn:subsequence($matches, 2) ) return { fts:InvertStringMatch($sm), $rest/* } }; declare function fts:ApplyFTUnaryNot ( $allMatches as element(fts:allMatches) ) as element(fts:allMatches) { { fts:UnaryNotHelper($allMatches/fts:match) } }; declare function fts:CoveredIncludePositions ( $match as element(fts:match) ) as xs:integer* { for $strInclude in $match/fts:stringInclude return $strInclude/fts:tokenInfo/@startPos to $strInclude/fts:tokenInfo/@endPos }; declare function fts:ApplyFTMildNot ( $allMatches1 as element(fts:allMatches), $allMatches2 as element(fts:allMatches) ) as element(fts:allMatches) { if (fn:count($allMatches1//fts:stringExclude) gt 0) then fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'FTDY0017'), "Invalid expression on the left-hand side of a not-in") else if (fn:count($allMatches2//fts:stringExclude) gt 0) then fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'FTDY0017'), "Invalid expression on the right-hand side of a not-in") else if (fn:count($allMatches2//fts:stringInclude) eq 0) then $allMatches1 else { $allMatches1/fts:match[ every $matches2 in $allMatches2/fts:match satisfies let $posSet1 := fts:CoveredIncludePositions(.) let $posSet2 := fts:CoveredIncludePositions($matches2) return some $pos in $posSet1 satisfies fn:not($pos = $posSet2) ] } }; declare function fts:ApplyFTOrder ( $allMatches as element(fts:allMatches) ) as element(fts:allMatches) { { for $match in $allMatches/fts:match where every $stringInclude1 in $match/fts:stringInclude, $stringInclude2 in $match/fts:stringInclude satisfies (($stringInclude1/fts:tokenInfo/@startPos <= $stringInclude2/fts:tokenInfo/@startPos) and ($stringInclude1/@queryPos <= $stringInclude2/@queryPos)) or (($stringInclude1/fts:tokenInfo/@startPos>= $stringInclude2/fts:tokenInfo/@startPos) and ($stringInclude1/@queryPos >= $stringInclude2/@queryPos)) return { $match/fts:stringInclude, for $stringExcl in $match/fts:stringExclude where every $stringIncl in $match/fts:stringInclude satisfies (($stringExcl/fts:tokenInfo/@startPos <= $stringIncl/fts:tokenInfo/@startPos) and ($stringExcl/@queryPos <= $stringIncl/@queryPos)) or (($stringExcl/fts:tokenInfo/@startPos >= $stringIncl/fts:tokenInfo/@startPos) and ($stringExcl/@queryPos >= $stringIncl/@queryPos)) return $stringExcl } } }; declare function fts:ApplyFTScopeSameSentence ( $allMatches as element(fts:allMatches) ) as element(fts:allMatches) { { for $match in $allMatches/fts:match where every $stringInclude1 in $match/fts:stringInclude, $stringInclude2 in $match/fts:stringInclude satisfies $stringInclude1/fts:tokenInfo/@startSent = $stringInclude2/fts:tokenInfo/@startSent and $stringInclude1/fts:tokenInfo/@startSent = $stringInclude1/fts:tokenInfo/@endSent and $stringInclude2/fts:tokenInfo/@startSent = $stringInclude2/fts:tokenInfo/@endSent and $stringInclude1/fts:tokenInfo/@startSent > 0 and $stringInclude2/fts:tokenInfo/@startSent > 0 return { $match/fts:stringInclude, for $stringExcl in $match/fts:stringExclude where $stringExcl/fts:tokenInfo/@startSent = 0 or ($stringExcl/fts:tokenInfo/@startSent = $stringExcl/fts:tokenInfo/@endSent and (every $stringIncl in $match/fts:stringInclude satisfies $stringIncl/fts:tokenInfo/@startSent = $stringExcl/fts:tokenInfo/@startSent) ) return $stringExcl } } }; declare function fts:ApplyFTScopeDifferentSentence ( $allMatches as element(fts:allMatches) ) as element(fts:allMatches) { { for $match in $allMatches/fts:match where every $stringInclude1 in $match/fts:stringInclude, $stringInclude2 in $match/fts:stringInclude satisfies $stringInclude1 is $stringInclude2 or $stringInclude1/fts:tokenInfo/@endSent < $stringInclude2/fts:tokenInfo/@startSent or $stringInclude2/fts:tokenInfo/@endSent < $stringInclude1/fts:tokenInfo/@startSent return { $match/fts:stringInclude, for $stringExcl in $match/fts:stringExclude where every $stringIncl in $match/fts:stringInclude satisfies $stringExcl/fts:tokenInfo/@endSent < $stringIncl/fts:tokenInfo/@startSent or $stringIncl/fts:tokenInfo/@endSent < $stringExcl/fts:tokenInfo/@startSent return $stringExcl } } }; declare function fts:ApplyFTScopeSameParagraph ( $allMatches as element(fts:allMatches) ) as element(fts:allMatches) { { for $match in $allMatches/fts:match where every $stringInclude1 in $match/fts:stringInclude, $stringInclude2 in $match/fts:stringInclude satisfies $stringInclude1/fts:tokenInfo/@startPara = $stringInclude2/fts:tokenInfo/@startPara and $stringInclude1/fts:tokenInfo/@startPara = $stringInclude1/fts:tokenInfo/@endPara and $stringInclude2/fts:tokenInfo/@startPara = $stringInclude2/fts:tokenInfo/@endPara and $stringInclude1/fts:tokenInfo/@startPara > 0 and $stringInclude2/fts:tokenInfo/@endPara > 0 return { $match/fts:stringInclude, for $stringExcl in $match/fts:stringExclude where $stringExcl/fts:tokenInfo/@startPara = 0 or ($stringExcl/fts:tokenInfo/@startPara = $stringExcl/fts:tokenInfo/@endPara and (every $stringIncl in $match/fts:stringInclude satisfies $stringIncl/fts:tokenInfo/@startPara = $stringExcl/fts:tokenInfo/@startPara) ) return $stringExcl } } }; declare function fts:ApplyFTScopeDifferentParagraph ( $allMatches as element(fts:allMatches) ) as element(fts:allMatches) { { for $match in $allMatches/fts:match where every $stringInclude1 in $match/fts:stringInclude, $stringInclude2 in $match/fts:stringInclude satisfies $stringInclude1 is $stringInclude2 or $stringInclude1/fts:tokenInfo/@endPara < $stringInclude2/fts:tokenInfo/@startPara or $stringInclude2/fts:tokenInfo/@endPara < $stringInclude1/fts:tokenInfo/@startPara return { $match/fts:stringInclude, for $stringExcl in $match/fts:stringExclude where every $stringIncl in $match/fts:stringInclude satisfies $stringExcl/fts:tokenInfo/@endPara < $stringIncl/fts:tokenInfo/@startPara or $stringIncl/fts:tokenInfo/@endPara < $stringExcl/fts:tokenInfo/@startPara return $stringExcl } } }; declare function fts:ApplyFTScope ( $type as fts:scopeType, $selector as fts:scopeSelector, $allMatches as element(fts:allMatches) ) as element(fts:allMatches) { if ($type eq "same" and $selector eq "sentence") then fts:ApplyFTScopeSameSentence($allMatches) else if ($type eq "different" and $selector eq "sentence") then fts:ApplyFTScopeDifferentSentence($allMatches) else if ($type eq "same" and $selector eq "paragraph") then fts:ApplyFTScopeSameParagraph($allMatches) else fts:ApplyFTScopeDifferentParagraph($allMatches) }; declare function fts:ApplyFTContent ( $searchContext as item(), $type as fts:contentMatchType, $allMatches as element(fts:allMatches) ) as element(fts:allMatches) { { $allMatches/fts:match[ let $start_pos := fts:getLowestTokenPosition($searchContext), $end_pos := fts:getHighestTokenPosition($searchContext), $match := . return if ($type eq "entire content") then every $pos in $start_pos to $end_pos satisfies some $si in $match/fts:stringInclude[data(@isContiguous)] satisfies fts:TokenInfoCoversTokenPosition($si/fts:tokenInfo, $pos) else let $pos := if ($type eq "at start") then $start_pos else (: $type eq "at end" :) $end_pos return some $ti in $match/fts:stringInclude/fts:tokenInfo satisfies fts:TokenInfoCoversTokenPosition($ti, $pos) ] } }; declare function fts:TokenInfoCoversTokenPosition( $tokenInfo as element(fts:tokenInfo), $tokenPosition as xs:integer ) as xs:boolean { ($tokenPosition >= $tokenInfo/@startPos) and ($tokenPosition <= $tokenInfo/@endPos) }; declare function fts:getLowestTokenPosition( $searchContext as item() ) as xs:integer {3}; declare function fts:getHighestTokenPosition( $searchContext as item() ) as xs:integer {3}; declare function fts:joinIncludes( $strIncls as element(fts:stringInclude)* ) as element(fts:stringInclude)? { if (fn:empty($strIncls)) then $strIncls else let $posSet := fts:CoveredIncludePositions($strIncls), $minPos := fn:min($strIncls/fts:tokenInfo/@startPos), $maxPos := fn:max($strIncls/fts:tokenInfo/@endPos), $isContiguous := ( every $pos in $minPos to $maxPos satisfies ($pos = $posSet) ) and ( every $strIncl in $strIncls satisfies $strIncl/@isContiguous ) return }; declare function fts:ApplyFTWordWindow ( $allMatches as element(fts:allMatches), $n as xs:integer ) as element(fts:allMatches) { { for $match in $allMatches/fts:match let $minpos := fn:min($match/fts:stringInclude/fts:tokenInfo/@startPos), $maxpos := fn:max($match/fts:stringInclude/fts:tokenInfo/@endPos) for $windowStartPos in ($maxpos - $n + 1 to $minpos) let $windowEndPos := $windowStartPos + $n - 1 return { fts:joinIncludes($match/fts:stringInclude), for $stringExclude in $match/fts:stringExclude where $stringExclude/fts:tokenInfo/@startPos >= $windowStartPos and $stringExclude/fts:tokenInfo/@endPos <= $windowEndPos return $stringExclude } } }; declare function fts:ApplyFTSentenceWindow ( $allMatches as element(fts:allMatches), $n as xs:integer ) as element(fts:allMatches) { { for $match in $allMatches/fts:match let $minpos := fn:min($match/fts:stringInclude/fts:tokenInfo/@startSent), $maxpos := fn:max($match/fts:stringInclude/fts:tokenInfo/@endSent) for $windowStartPos in ($maxpos - $n + 1 to $minpos) let $windowEndPos := $windowStartPos + $n - 1 return { fts:joinIncludes($match/fts:stringInclude), for $stringExclude in $match/fts:stringExclude where $stringExclude/fts:tokenInfo/@startSent >= $windowStartPos and $stringExclude/fts:tokenInfo/@endSent <= $windowEndPos return $stringExclude } } }; declare function fts:ApplyFTParagraphWindow ( $allMatches as element(fts:allMatches), $n as xs:integer ) as element(fts:allMatches) { { for $match in $allMatches/fts:match let $minpos := fn:min($match/fts:stringInclude/fts:tokenInfo/@startPara), $maxpos := fn:max($match/fts:stringInclude/fts:tokenInfo/@endPara) for $windowStartPos in ($maxpos - $n + 1 to $minpos) let $windowEndPos := $windowStartPos + $n - 1 return { fts:joinIncludes($match/fts:stringInclude), for $stringExclude in $match/fts:stringExclude where $stringExclude/fts:tokenInfo/@startPara >= $windowStartPos and $stringExclude/fts:tokenInfo/@endPara <= $windowEndPos return $stringExclude } } }; declare function fts:ApplyFTWindow ( $type as fts:distanceType, $size as xs:integer, $allMatches as element(fts:allMatches) ) as element(fts:allMatches) { if ($type eq "word") then fts:ApplyFTWordWindow($allMatches, $size) else if ($type eq "sentence") then fts:ApplyFTSentenceWindow($allMatches, $size) else fts:ApplyFTParagraphWindow($allMatches, $size) }; declare function fts:ApplyFTDistance ( $type as fts:distanceType, $range as element(fts:range), $allMatches as element(fts:allMatches) ) as element(fts:allMatches) { if ($type eq "word") then if ($range/@type eq "exactly") then fts:ApplyFTWordDistanceExactly($allMatches, $range/@n) else if ($range/@type eq "at least") then fts:ApplyFTWordDistanceAtLeast($allMatches, $range/@n) else if ($range/@type eq "at most") then fts:ApplyFTWordDistanceAtMost( $allMatches, $range/@n) else fts:ApplyFTWordDistanceFromTo( $allMatches, $range/@m, $range/@n) else if ($type eq "sentence") then if ($range/@type eq "exactly") then fts:ApplyFTSentenceDistanceExactly($allMatches, $range/@n) else if ($range/@type eq "at least") then fts:ApplyFTSentenceDistanceAtLeast($allMatches, $range/@n) else if ($range/@type eq "at most") then fts:ApplyFTSentenceDistanceAtMost( $allMatches, $range/@n) else fts:ApplyFTSentenceDistanceFromTo( $allMatches, $range/@m, $range/@n) else if ($range/@type eq "exactly") then fts:ApplyFTParagraphDistanceExactly($allMatches, $range/@n) else if ($range/@type eq "at least") then fts:ApplyFTParagraphDistanceAtLeast($allMatches, $range/@n) else if ($range/@type eq "at most") then fts:ApplyFTParagraphDistanceAtMost( $allMatches, $range/@n) else fts:ApplyFTParagraphDistanceFromTo( $allMatches, $range/@m, $range/@n) }; declare function fts:ApplyFTWordDistanceExactly( $allMatches as element(fts:allMatches), $n as xs:integer ) as element(fts:allMatches) { { for $match in $allMatches/fts:match let $sorted := for $si in $match/fts:stringInclude order by $si/fts:tokenInfo/@startPos ascending, $si/fts:tokenInfo/@endPos ascending return $si where if (fn:count($sorted) le 1) then fn:true() else every $idx in 1 to fn:count($sorted) - 1 satisfies fts:wordDistance( $sorted[$idx]/fts:tokenInfo, $sorted[$idx+1]/fts:tokenInfo ) = $n return { fts:joinIncludes($match/fts:stringInclude), for $stringExcl in $match/fts:stringExclude where some $stringIncl in $match/fts:stringInclude satisfies fts:wordDistance( $stringIncl/fts:tokenInfo, $stringExcl/fts:tokenInfo ) = $n return $stringExcl } } }; declare function fts:ApplyFTWordDistanceAtLeast ( $allMatches as element(fts:allMatches), $n as xs:integer ) as element(fts:allMatches) { { for $match in $allMatches/fts:match let $sorted := for $si in $match/fts:stringInclude order by $si/fts:tokenInfo/@startPos ascending, $si/fts:tokenInfo/@endPos ascending return $si where if (fn:count($sorted) le 1) then fn:true() else every $index in (1 to fn:count($sorted) - 1) satisfies fts:wordDistance( $sorted[$index]/fts:tokenInfo, $sorted[$index+1]/fts:tokenInfo ) >= $n return { fts:joinIncludes($match/fts:stringInclude), for $stringExcl in $match/fts:stringExclude where some $stringIncl in $match/fts:stringInclude satisfies fts:wordDistance( $stringIncl/fts:tokenInfo, $stringExcl/fts:tokenInfo ) >= $n return $stringExcl } } }; declare function fts:ApplyFTWordDistanceAtMost ( $allMatches as element(fts:allMatches), $n as xs:integer ) as element(fts:allMatches) { { for $match in $allMatches/fts:match let $sorted := for $si in $match/fts:stringInclude order by $si/fts:tokenInfo/@startPos ascending, $si/fts:tokenInfo/@endPos ascending return $si where if (fn:count($sorted) le 1) then fn:true() else every $index in (1 to fn:count($sorted) - 1) satisfies fts:wordDistance( $sorted[$index]/fts:tokenInfo, $sorted[$index+1]/fts:tokenInfo ) <= $n return { fts:joinIncludes($match/fts:stringInclude), for $stringExcl in $match/fts:stringExclude where some $stringIncl in $match/fts:stringInclude satisfies fts:wordDistance( $stringIncl/fts:tokenInfo, $stringExcl/fts:tokenInfo ) <= $n return $stringExcl } } }; declare function fts:ApplyFTWordDistanceFromTo ( $allMatches as element(fts:allMatches), $m as xs:integer, $n as xs:integer ) as element(fts:allMatches) { { for $match in $allMatches/fts:match let $sorted := for $si in $match/fts:stringInclude order by $si/fts:tokenInfo/@startPos ascending, $si/fts:tokenInfo/@endPos ascending return $si where if (fn:count($sorted) le 1) then fn:true() else every $index in (1 to fn:count($sorted) - 1) satisfies fts:wordDistance( $sorted[$index]/fts:tokenInfo, $sorted[$index+1]/fts:tokenInfo ) >= $m and fts:wordDistance( $sorted[$index]/fts:tokenInfo, $sorted[$index+1]/fts:tokenInfo ) <= $n return { fts:joinIncludes($match/fts:stringInclude), for $stringExcl in $match/fts:stringExclude where some $stringIncl in $match/fts:stringInclude satisfies fts:wordDistance( $stringIncl/fts:tokenInfo, $stringExcl/fts:tokenInfo ) >= $m and fts:wordDistance( $stringIncl/fts:tokenInfo, $stringExcl/fts:tokenInfo ) <= $n return $stringExcl } } }; declare function fts:wordDistance ( $tokenInfo1 as element(fts:tokenInfo), $tokenInfo2 as element(fts:tokenInfo) ) as xs:integer { (: Ensure tokens are in order :) let $sorted := for $ti in ($tokenInfo1, $tokenInfo2) order by $ti/@startPos ascending, $ti/@endPos ascending return $ti return (: -1 because we count starting at 0 :) $sorted[2]/@startPos - $sorted[1]/@endPos - 1 }; declare function fts:ApplyFTSentenceDistanceExactly ( $allMatches as element(fts:allMatches), $n as xs:integer ) as element(fts:allMatches) { { for $match in $allMatches/fts:match let $sorted := for $si in $match/fts:stringInclude order by $si/fts:tokenInfo/@startSent ascending, $si/fts:tokenInfo/@endSent ascending return $si where if (fn:count($sorted) le 1) then fn:true() else every $index in (1 to fn:count($sorted) - 1) satisfies fts:sentenceDistance( $sorted[$index]/fts:tokenInfo, $sorted[$index+1]/fts:tokenInfo ) = $n return { fts:joinIncludes($match/fts:stringInclude), for $stringExcl in $match/fts:stringExclude where some $stringIncl in $match/fts:stringInclude satisfies fts:sentenceDistance( $stringIncl/fts:tokenInfo, $stringExcl/fts:tokenInfo ) = $n return $stringExcl } } }; declare function fts:ApplyFTSentenceDistanceAtLeast ( $allMatches as element(fts:allMatches), $n as xs:integer ) as element(fts:allMatches) { { for $match in $allMatches/fts:match let $sorted := for $si in $match/fts:stringInclude order by $si/fts:tokenInfo/@startSent ascending, $si/fts:tokenInfo/@endSent ascending return $si where if (fn:count($sorted) le 1) then fn:true() else every $index in (1 to fn:count($sorted) - 1) satisfies fts:sentenceDistance( $sorted[$index]/fts:tokenInfo, $sorted[$index+1]/fts:tokenInfo ) >= $n return { fts:joinIncludes($match/fts:stringInclude), for $stringExcl in $match/fts:stringExclude where some $stringIncl in $match/fts:stringInclude satisfies fts:sentenceDistance( $stringIncl/fts:tokenInfo, $stringExcl/fts:tokenInfo ) >= $n return $stringExcl } } }; declare function fts:ApplyFTSentenceDistanceAtMost ( $allMatches as element(fts:allMatches), $n as xs:integer ) as element(fts:allMatches) { { for $match in $allMatches/fts:match let $sorted := for $si in $match/fts:stringInclude order by $si/fts:tokenInfo/@startSent ascending, $si/fts:tokenInfo/@endSent ascending return $si where if (fn:count($sorted) le 1) then fn:true() else every $index in (1 to fn:count($sorted) - 1) satisfies fts:sentenceDistance( $sorted[$index]/fts:tokenInfo, $sorted[$index+1]/fts:tokenInfo ) <= $n return { fts:joinIncludes($match/fts:stringInclude), for $stringExcl in $match/fts:stringExclude where some $stringIncl in $match/fts:stringInclude satisfies fts:sentenceDistance( $stringIncl/fts:tokenInfo, $stringExcl/fts:tokenInfo ) <= $n return $stringExcl } } }; declare function fts:ApplyFTSentenceDistanceFromTo ( $allMatches as element(fts:allMatches), $m as xs:integer, $n as xs:integer ) as element(fts:allMatches) { { for $match in $allMatches/fts:match let $sorted := for $si in $match/fts:stringInclude order by $si/fts:tokenInfo/@startSent ascending, $si/fts:tokenInfo/@endSent ascending return $si where if (fn:count($sorted) le 1) then fn:true() else every $index in (1 to fn:count($sorted) - 1) satisfies fts:sentenceDistance( $sorted[$index]/fts:tokenInfo, $sorted[$index+1]/fts:tokenInfo ) >= $m and fts:sentenceDistance( $sorted[$index]/fts:tokenInfo, $sorted[$index+1]/fts:tokenInfo ) <= $n return { fts:joinIncludes($match/fts:stringInclude), for $stringExcl in $match/fts:stringExclude where some $stringIncl in $match/fts:stringInclude satisfies fts:sentenceDistance( $stringIncl/fts:tokenInfo, $stringExcl/fts:tokenInfo ) >= $m and fts:sentenceDistance( $stringIncl/fts:tokenInfo, $stringExcl/fts:tokenInfo ) <= $n return $stringExcl } } }; declare function fts:sentenceDistance ( $tokenInfo1 as element(fts:tokenInfo), $tokenInfo2 as element(fts:tokenInfo) ) as xs:integer { (: Ensure tokens are in order :) let $sorted := for $ti in ($tokenInfo1, $tokenInfo2) order by $ti/@startPos ascending, $ti/@endPos ascending return $ti return (: -1 because we count starting at 0 :) $sorted[2]/@startSent - $sorted[1]/@endSent - 1 }; declare function fts:ApplyFTParagraphDistanceExactly ( $allMatches as element(fts:allMatches), $n as xs:integer ) as element(fts:allMatches) { { for $match in $allMatches/fts:match let $sorted := for $si in $match/fts:stringInclude order by $si/fts:tokenInfo/@startPara ascending, $si/fts:tokenInfo/@endPara ascending return $si where if (fn:count($sorted) le 1) then fn:true() else every $index in (1 to fn:count($sorted) - 1) satisfies fts:paraDistance( $sorted[$index]/fts:tokenInfo, $sorted[$index+1]/fts:tokenInfo ) = $n return { fts:joinIncludes($match/fts:stringInclude), for $stringExcl in $match/fts:stringExclude where some $stringIncl in $match/fts:stringInclude satisfies fts:paraDistance( $stringIncl/fts:tokenInfo, $stringExcl/fts:tokenInfo ) = $n return $stringExcl } } }; declare function fts:ApplyFTParagraphDistanceAtLeast ( $allMatches as element(fts:allMatches), $n as xs:integer ) as element(fts:allMatches) { { for $match in $allMatches/fts:match let $sorted := for $si in $match/fts:stringInclude order by $si/fts:tokenInfo/@startPara ascending, $si/fts:tokenInfo/@endPara ascending return $si where if (fn:count($sorted) le 1) then fn:true() else every $index in (1 to fn:count($sorted) - 1) satisfies fts:paraDistance( $sorted[$index]/fts:tokenInfo, $sorted[$index+1]/fts:tokenInfo ) >= $n return { fts:joinIncludes($match/fts:stringInclude), for $stringExcl in $match/fts:stringExclude where some $stringIncl in $match/fts:stringInclude satisfies fts:paraDistance( $stringIncl/fts:tokenInfo, $stringExcl/fts:tokenInfo ) >= $n return $stringExcl } } }; declare function fts:ApplyFTParagraphDistanceAtMost ( $allMatches as element(fts:allMatches), $n as xs:integer ) as element(fts:allMatches) { { for $match in $allMatches/fts:match let $sorted := for $si in $match/fts:stringInclude order by $si/fts:tokenInfo/@startPara ascending, $si/fts:tokenInfo/@endPara ascending return $si where if (fn:count($sorted) le 1) then fn:true() else every $index in (1 to fn:count($sorted) - 1) satisfies fts:paraDistance( $sorted[$index]/fts:tokenInfo, $sorted[$index+1]/fts:tokenInfo ) <= $n return { fts:joinIncludes($match/fts:stringInclude), for $stringExcl in $match/fts:stringExclude where some $stringIncl in $match/fts:stringInclude satisfies fts:paraDistance( $stringIncl/fts:tokenInfo, $stringExcl/fts:tokenInfo ) <= $n return $stringExcl } } }; declare function fts:ApplyFTParagraphDistanceFromTo ( $allMatches as element(fts:allMatches), $m as xs:integer, $n as xs:integer ) as element(fts:allMatches) { { for $match in $allMatches/fts:match let $sorted := for $si in $match/fts:stringInclude order by $si/fts:tokenInfo/@startPara ascending, $si/fts:tokenInfo/@endPara ascending return $si where if (fn:count($sorted) le 1) then fn:true() else every $index in (1 to fn:count($sorted) - 1) satisfies fts:paraDistance( $sorted[$index]/fts:tokenInfo, $sorted[$index+1]/fts:tokenInfo ) >= $m and fts:paraDistance( $sorted[$index]/fts:tokenInfo, $sorted[$index+1]/fts:tokenInfo ) <= $n return { fts:joinIncludes($match/fts:stringInclude), for $stringExcl in $match/fts:stringExclude where some $stringIncl in $match/fts:stringInclude satisfies fts:paraDistance( $stringIncl/fts:tokenInfo, $stringExcl/fts:tokenInfo ) >= $m and fts:paraDistance( $stringIncl/fts:tokenInfo, $stringExcl/fts:tokenInfo ) <= $n return $stringExcl } } }; declare function fts:paraDistance ( $tokenInfo1 as element(fts:tokenInfo), $tokenInfo2 as element(fts:tokenInfo) ) as xs:integer { (: Ensure tokens are in order :) let $sorted := for $ti in ($tokenInfo1, $tokenInfo2) order by $ti/@startPos ascending, $ti/@endPos ascending return $ti return (: -1 because we count starting at 0 :) $sorted[2]/@startPara - $sorted[1]/@endPara - 1 }; declare function fts:FormCombinations ( $sms as element(fts:match)*, $k as xs:integer ) as element(fts:match)* (: Find all combinations of exactly $k elements from $sms, and for each such combination, construct a match whose children are copies of all the children of all the elements in the combination. Return the sequence of all such matches. :) { if ($k eq 0) then else if (fn:count($sms) lt $k) then () else if (fn:count($sms) eq $k) then {$sms/*} else let $first := $sms[1], $rest := fn:subsequence($sms, 2) return ( (: all the combinations that does not involve $first :) fts:FormCombinations($rest, $k), (: and all the combinations that do involve $first :) for $combination in fts:FormCombinations($rest, $k - 1) return { $first/*, $combination/* } ) }; declare function fts:FormCombinationsAtLeast ( $sms as element(fts:match)*, $times as xs:integer) as element(fts:match)* (: Find all combinations of $times or more elements from $sms, and for each such combination, construct a match whose children are copies of all the children of all the elements in the combination. Return the sequence of all such matches. :) { for $k in $times to fn:count($sms) return fts:FormCombinations($sms, $k) }; declare function fts:FormRange ( $sms as element(fts:match)*, $l as xs:integer, $u as xs:integer, $stokenNum as xs:integer ) as element(fts:allMatches) { if ($l > $u) then else let $am1 := {fts:FormCombinationsAtLeast($sms, $l)} let $am2 := {fts:FormCombinationsAtLeast($sms, $u+1)} return fts:ApplyFTAnd($am1, fts:ApplyFTUnaryNot($am2)) }; declare function fts:ApplyFTTimesExactly ( $allMatches as element(fts:allMatches), $n as xs:integer ) as element(fts:allMatches) { fts:FormRange($allMatches/fts:match, $n, $n, $allMatches/@stokenNum) }; declare function fts:ApplyFTTimesAtLeast ( $allMatches as element(fts:allMatches), $n as xs:integer ) as element(fts:allMatches) { {fts:FormCombinationsAtLeast($allMatches/fts:match, $n)} }; declare function fts:ApplyFTTimesAtMost ( $allMatches as element(fts:allMatches), $n as xs:integer ) as element(fts:allMatches) { fts:FormRange($allMatches/fts:match, 0, $n, $allMatches/@stokenNum) }; declare function fts:ApplyFTTimesFromTo ( $allMatches as element(fts:allMatches), $m as xs:integer, $n as xs:integer ) as element(fts:allMatches) { fts:FormRange($allMatches/fts:match, $m, $n, $allMatches/@stokenNum) }; declare function fts:ApplyFTTimes ( $range as element(fts:range), $allMatches as element(fts:allMatches) ) as element(fts:allMatches) { if (fn:count($allMatches//fts:stringExclude) gt 0) then fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'XPST0003')) else if ($range/@type eq "exactly") then fts:ApplyFTTimesExactly($allMatches, $range/@n) else if ($range/@type eq "at least") then fts:ApplyFTTimesAtLeast($allMatches, $range/@n) else if ($range/@type eq "at most") then fts:ApplyFTTimesAtMost($allMatches, $range/@n) else fts:ApplyFTTimesFromTo($allMatches, $range/@m, $range/@n) }; declare function fts:FTContainsExpr ( $searchContextItems as item()*, $ignoreNodes as node()*, $ftSelection as element(*,fts:ftSelection), $defOptions as element(fts:matchOptions) ) as xs:boolean { some $searchContext in $searchContextItems satisfies let $newSearchContext := fts:reconstruct( $searchContext, $ignoreNodes ) return if (fn:empty($newSearchContext)) then fn:false() else let $allMatches := fts:evaluate($ftSelection, $newSearchContext, $defOptions, 0) return some $match in $allMatches/fts:match satisfies fn:count($match/fts:stringExclude) eq 0 }; declare function fts:reconstruct ( $n as item(), $ignore as node()* ) as item()? { typeswitch ($n) case node() return if (some $i in $ignore satisfies $n is $i) then () else if ($n instance of element()) then let $nodeName := fn:node-name($n) let $nodeContent := for $nn in $n/node() return fts:reconstruct($nn,$ignore) return element {$nodeName} {$nodeContent} else if ($n instance of document-node()) then document { for $nn in $n/node() return fts:reconstruct($nn, $ignore) } else $n default return $n }; 1 basex-7.7.2/basex-examples/src/main/resources/xq/000077500000000000000000000000001222453003200217155ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/resources/xq/fots.xq000066400000000000000000000076211222453003200232500ustar00rootroot00000000000000(: global namespace of the test suite. :) declare namespace fots = "http://www.w3.org/2010/09/qt-fots-catalog"; (: prefix of catalog to test. :) declare variable $doc := doc('catalog.xml'); (: prefix of catalog to test. :) declare variable $catalog := ''; (: prefix of tests to test. :) declare variable $prefix := ''; (: loops throgh the test set and evaluates all test cases :) declare function fots:main() { let $env := $doc//*:environment for $set in $doc//*:test-set[starts-with(@name, $catalog)] let $href := $set/@href let $base-dir := replace($href, '/.*','/') let $doc := doc($href) for $case in $doc//*:test-case[starts-with(@name, $prefix)] let $env := $env | $doc//*:environment return fots:test($case, $env, $base-dir) }; (: runs a single test :) declare function fots:test($case, $envir, $base) { let $query := $case/*:test/text() let $env := $envir[@name = $case/*:environment/@ref]/*:source/@file let $result := $case/*:result let $prolog := if($env) then concat("declare context item := doc('", if(file:exists(concat($base, $env))) then $base else (), $env, "');") else () let $query := concat($prolog, $query) return try { let $val := xquery:eval($query) return if (fots:allof($result, $val) or fots:anyof($result, $val) or fots:true($result, $val) or fots:false($result, $val) or fots:eq($result, $val) or fots:string($result, $val)) then fots:wrong($case, $val, $result/*) else () } catch * { if(xs:string($err:code) = $result//*:error/@code) then () else fots:wrong($case, concat($err:code,': ',$err:description), $result/*) } }; (: gives feedback on an erroneous query :) declare function fots:wrong($test, $found, $exp) { { $test/*:test/text() } { $found } { if($exp/self::*:error) then data($exp/@code) else $exp } }; (: converts a value to the specified type :) declare function fots:convert($type, $val) { if($type) then try { xquery:eval(concat($type, '("', $val, '")')) } catch * { trace('', concat($err:code, ': ', $err:description)) } else $val }; (: checks if any of the given tests is wrong :) declare function fots:allof($result, $val) { let $type := $result//*:assert-type let $val := fots:convert($type, $val) for $c in $result/*:all-of/* let $eq := replace($c/self::*:assert-eq, "^('|"")|('|"")$", "") return if(not($eq) or fots:convert($type, $eq) eq $val) then () else false() }; (: checks if none of the given tests is true :) declare function fots:anyof($result, $val) { let $type := $result//*:assert-type let $val := fots:convert($type, $val) let $ok := for $c in $result/*:any-of/* return if( not(fots:true($c, $val)) and not(fots:false($c, $val)) and not(fots:string($c, $val))) then true() else () return exists($result/*:any-of) and empty($ok) }; (: checks if the given value is not true :) declare function fots:true($result, $val) { $result/*:assert-true and not($val) }; (: checks if the given value is not false :) declare function fots:false($result, $val) { $result/*:assert-false and $val }; (: checks if the given string is wrong :) declare function fots:string($result, $val) { $result/*:assert-string-value ne string($val) }; (: checks if the equality yields false :) declare function fots:eq($result, $val) { for $i in $result/*:assert-eq return try { let $r := xquery:eval($i) return (typeswitch($val) case xs:string return xs:string($r) case xs:double return xs:double($r) case xs:float return xs:float($r) case xs:integer return xs:integer($r) default return $val) ne $val } catch * { trace('', concat($err:code, ': ', $err:description)) } }; (: runs the main function :) fots:main() basex-7.7.2/basex-examples/src/main/resources/xq/higher-order/000077500000000000000000000000001222453003200242745ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/main/resources/xq/higher-order/binary-tree.xq000066400000000000000000000005231222453003200270670ustar00rootroot00000000000000import module namespace bin = "http://basex.org/bin-tree" at "binary-tree.xqm"; declare function local:randomize($seq) { for $x in $seq order by random:double() return $x }; let $seq := local:randomize(1 to 1000) return bin:serialize( fold-left( $seq, bin:empty(), function($tree, $x) { bin:insert($x, $tree) } ) ) basex-7.7.2/basex-examples/src/main/resources/xq/higher-order/binary-tree.xqm000066400000000000000000000021731222453003200272470ustar00rootroot00000000000000module namespace bin = "http://basex.org/bin-tree"; declare function bin:empty() { function($k) { () } }; declare function bin:left($tree) { $tree(1) }; declare function bin:key($tree) { $tree(2) }; declare function bin:right($tree) { $tree(3) }; declare function bin:is-empty($tree) { fn:empty(bin:key($tree)) }; declare function bin:tree($left, $key, $right) { function($k) { ($left, $key, $right)[$k] } }; declare function bin:insert($x, $tree) { let $l := bin:left($tree), $y := bin:key($tree), $r := bin:right($tree) return if(fn:empty($y)) then ( bin:tree(bin:empty(), $x, bin:empty()) ) else if($x lt $y) then ( bin:tree(bin:insert($x, $l), $y, $r) ) else if($x gt $y) then ( bin:tree($l, $y, bin:insert($x, $r)) ) else $tree }; declare function bin:to-seq($tree) { if(bin:is-empty($tree)) then () else (bin:to-seq(bin:left($tree)), bin:key($tree), bin:to-seq(bin:right($tree))) }; declare function bin:serialize($tree) { if(bin:is-empty($tree)) then else { bin:serialize(bin:left($tree)), bin:serialize(bin:right($tree)) } }; basex-7.7.2/basex-examples/src/main/resources/xq/higher-order/red-black-tree.xq000066400000000000000000000004431222453003200274300ustar00rootroot00000000000000import module namespace tree = "http://basex.org/red-black-tree" at "red-black-tree.xqm"; tree:serialize( fold-right( 1 to 1000, $tree:empty, function($x, $tree) { tree:insert( trace( $x, "insert: " ), $tree ) } ) )basex-7.7.2/basex-examples/src/main/resources/xq/higher-order/red-black-tree.xqm000066400000000000000000000107701222453003200276110ustar00rootroot00000000000000 module namespace tree = "http://basex.org/red-black-tree"; declare variable $tree:color := 1; declare variable $tree:left := 2; declare variable $tree:key := 3; declare variable $tree:right := 4; declare variable $tree:red := false(); declare variable $tree:black := true(); declare variable $tree:empty := function($i as xs:integer) as item()? { () }; declare function tree:branch( $c as xs:boolean, $l as function(xs:integer) as item()?, $x as item(), $r as function(xs:integer) as item()? ) as function(xs:integer) as item()? { function($i as xs:integer) as item()? { ($c, $l, $x, $r)[$i] } }; declare function tree:red( $l as function(xs:integer) as item()?, $x as item(), $r as function(xs:integer) as item()? ) as function(xs:integer) as item()? { tree:branch($tree:red, $l, $x, $r) }; declare function tree:black( $l as function(xs:integer) as item()?, $x as item(), $r as function(xs:integer) as item()? ) as function(xs:integer) as item()? { tree:branch($tree:black, $l, $x, $r) }; declare function tree:is-empty( $tree as function(xs:integer) as item()? ) as xs:boolean { fn:empty($tree($tree:key)) }; declare function tree:member( $x as item(), $tree as function(xs:integer) as item()? ) as xs:boolean { let $y := $tree($tree:key) return ( if(fn:empty($y)) then false() else if($x lt $y) then tree:member($x, $tree($tree:left)) else if($x eq $y) then true() else tree:member($x, $tree($tree:right)) ) }; declare function tree:is-red( $tree as function(xs:integer) as item()? ) as xs:boolean { $tree($tree:color) = $tree:red }; declare function tree:make-black( $tree as function(xs:integer) as item()? ) as function(xs:integer) as item()?? { if(tree:is-empty($tree)) then () else tree:black($tree($tree:left), $tree($tree:key), $tree($tree:right)) }; declare function tree:insert( $x as item(), $tree as function(xs:integer) as item()? ) as function(xs:integer) as item()? { tree:make-black(tree:ins($x, $tree)) }; declare function tree:ins( $x as item(), $tree as function(xs:integer) as item()? ) as function(xs:integer) as item()? { let $c := $tree($tree:color), $l := $tree($tree:left), $y := $tree($tree:key), $r := $tree($tree:right) return if(fn:empty($y)) then tree:red($tree:empty, $x, $tree:empty) else if($x lt $y) then tree:balance($c, tree:ins($x, $l), $y, $r) else if($x eq $y) then tree:branch($c, $l, $y, $r) else (: $x gt $y :) tree:balance($c, $l, $y, tree:ins($x, $r)) }; declare function tree:balance( $color as xs:boolean, $l as function(xs:integer) as item()?, $x as item(), $r as function(xs:integer) as item()? ) as function(xs:integer) as item()? { if($color eq $tree:black) then ( let $red-l := tree:is-red($l), $red-r := tree:is-red($r) return if($red-l and tree:is-red($l($tree:left))) then ( let $ll := $l($tree:left), $lr := $l($tree:right) return (: case 1: : [B [R [R a x b] y c] z d] : => [R [B a x b] y [B c z d]] :) tree:red( tree:make-black($ll), $l($tree:key), tree:black($lr, $x, $r) ) ) else if($red-l and tree:is-red($l($tree:right))) then ( let $ll := $l($tree:left), $lr := $l($tree:right) return (: case 2: : [B [R a x [R b y c]] z d] : => [R [B a x b] y [B c z d]] :) tree:red( tree:black($ll, $l($tree:key), $lr($tree:left)), $lr($tree:key), tree:black($lr($tree:right), $x, $r) ) ) else if($red-r and tree:is-red($r($tree:left))) then ( let $rl := $r($tree:left), $rr := $r($tree:right) return (: case 3: : [B a x [R [R b y c] z d]] : => [R [B a x b] y [B c z d]] :) tree:red( tree:black($l, $x, $rl($tree:left)), $rl($tree:key), tree:black($rl($tree:right), $r($tree:key), $rr) ) ) else if($red-r and tree:is-red($r($tree:right))) then ( let $rl := $r($tree:left), $rr := $r($tree:right) return (: case 4: : [B a x [R b y [R c z d]]] : => [R [B a x b] y [B c z d]] :) tree:red( tree:black($l, $x, $rl), $r($tree:key), tree:make-black($rr) ) ) else tree:branch($color, $l, $x, $r) ) else tree:branch($color, $l, $x, $r) }; declare function tree:serialize( $tree as function(xs:integer) as item()? ) as element() { if(tree:is-empty($tree)) then element leaf { } else element tree { attribute color { if($tree($tree:color)) then 'black' else 'red' }, attribute key { $tree($tree:key) }, tree:serialize($tree($tree:left)), tree:serialize($tree($tree:right)) } }; basex-7.7.2/basex-examples/src/test/000077500000000000000000000000001222453003200173065ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/test/java/000077500000000000000000000000001222453003200202275ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/test/java/.empty000066400000000000000000000000001222453003200213540ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/test/java/.gitignore000066400000000000000000000000001222453003200222050ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/test/resources/000077500000000000000000000000001222453003200213205ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/test/resources/.empty000066400000000000000000000000001222453003200224450ustar00rootroot00000000000000basex-7.7.2/basex-examples/src/test/resources/.gitignore000066400000000000000000000000001222453003200232760ustar00rootroot00000000000000basex-7.7.2/basex-parent.iml000066400000000000000000000011361222453003200157170ustar00rootroot00000000000000 basex-7.7.2/basex-tests/000077500000000000000000000000001222453003200150645ustar00rootroot00000000000000basex-7.7.2/basex-tests/.checkstyle000066400000000000000000000015601222453003200172250ustar00rootroot00000000000000 basex-7.7.2/basex-tests/.classpath000066400000000000000000000014041222453003200170460ustar00rootroot00000000000000 basex-7.7.2/basex-tests/.gitignore000066400000000000000000000000221222453003200170460ustar00rootroot00000000000000/doc /lib /target basex-7.7.2/basex-tests/.project000066400000000000000000000016371222453003200165420ustar00rootroot00000000000000 basex-tests org.eclipse.jdt.core.javabuilder org.maven.ide.eclipse.maven2Builder net.sf.eclipsecs.core.CheckstyleBuilder org.eclipse.m2e.core.maven2Builder org.eclipse.m2e.core.maven2Nature org.maven.ide.eclipse.maven2Nature org.eclipse.jdt.core.javanature net.sf.eclipsecs.core.CheckstyleNature basex-7.7.2/basex-tests/.settings/000077500000000000000000000000001222453003200170025ustar00rootroot00000000000000basex-7.7.2/basex-tests/.settings/checkstyle.xml000066400000000000000000000121161222453003200216630ustar00rootroot00000000000000 basex-7.7.2/basex-tests/.settings/org.eclipse.core.resources.prefs000066400000000000000000000002711222453003200252150ustar00rootroot00000000000000eclipse.preferences.version=1 encoding//src/main/java=UTF-8 encoding//src/main/resources=UTF-8 encoding//src/test/java=UTF-8 encoding//src/test/resources=UTF-8 encoding/=UTF-8 basex-7.7.2/basex-tests/.settings/org.eclipse.core.runtime.prefs000066400000000000000000000001211222453003200246600ustar00rootroot00000000000000#Mon Feb 14 18:03:25 CET 2011 eclipse.preferences.version=1 line.separator=\n basex-7.7.2/basex-tests/.settings/org.eclipse.jdt.core.prefs000066400000000000000000000713641222453003200237770ustar00rootroot00000000000000eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.doc.comment.support=enabled org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning org.eclipse.jdt.core.compiler.problem.deadCode=warning org.eclipse.jdt.core.compiler.problem.deprecation=warning org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled org.eclipse.jdt.core.compiler.problem.fieldHiding=warning org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=private org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=enabled org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore org.eclipse.jdt.core.compiler.problem.nullReference=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=enabled org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled org.eclipse.jdt.core.compiler.problem.unusedImport=warning org.eclipse.jdt.core.compiler.problem.unusedLabel=warning org.eclipse.jdt.core.compiler.problem.unusedLocal=warning org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore org.eclipse.jdt.core.compiler.problem.unusedParameter=warning org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.compiler.taskCaseSensitive=disabled org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL org.eclipse.jdt.core.compiler.taskTags=TODO,[CG],[AH],[LK],[CG],[MS],[DP],[LW],[JE],[DK],[MSG] org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=90 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=0 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.comment.clear_blank_lines=true org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false org.eclipse.jdt.core.formatter.comment.format_block_comments=true org.eclipse.jdt.core.formatter.comment.format_comments=false org.eclipse.jdt.core.formatter.comment.format_header=true org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true org.eclipse.jdt.core.formatter.comment.format_line_comments=true org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=do not insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert org.eclipse.jdt.core.formatter.comment.line_length=96 org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indentation.size=2 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true org.eclipse.jdt.core.formatter.lineSplit=96 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=space org.eclipse.jdt.core.formatter.tabulation.size=2 org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true basex-7.7.2/basex-tests/.settings/org.eclipse.jdt.ui.prefs000066400000000000000000000053341222453003200234560ustar00rootroot00000000000000#Sat Feb 04 16:59:42 CET 2012 cleanup.add_default_serial_version_id=true cleanup.add_generated_serial_version_id=false cleanup.add_missing_annotations=true cleanup.add_missing_deprecated_annotations=true cleanup.add_missing_methods=false cleanup.add_missing_nls_tags=false cleanup.add_missing_override_annotations=true cleanup.add_missing_override_annotations_interface_methods=true cleanup.add_serial_version_id=false cleanup.always_use_blocks=true cleanup.always_use_parentheses_in_expressions=false cleanup.always_use_this_for_non_static_field_access=false cleanup.always_use_this_for_non_static_method_access=false cleanup.convert_to_enhanced_for_loop=true cleanup.correct_indentation=false cleanup.format_source_code=false cleanup.format_source_code_changes_only=false cleanup.make_local_variable_final=true cleanup.make_parameters_final=true cleanup.make_private_fields_final=true cleanup.make_type_abstract_if_missing_method=false cleanup.make_variable_declarations_final=true cleanup.never_use_blocks=false cleanup.never_use_parentheses_in_expressions=true cleanup.organize_imports=false cleanup.qualify_static_field_accesses_with_declaring_class=false cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true cleanup.qualify_static_member_accesses_with_declaring_class=true cleanup.qualify_static_method_accesses_with_declaring_class=false cleanup.remove_private_constructors=true cleanup.remove_trailing_whitespaces=false cleanup.remove_trailing_whitespaces_all=true cleanup.remove_trailing_whitespaces_ignore_empty=false cleanup.remove_unnecessary_casts=true cleanup.remove_unnecessary_nls_tags=true cleanup.remove_unused_imports=true cleanup.remove_unused_local_variables=false cleanup.remove_unused_private_fields=true cleanup.remove_unused_private_members=false cleanup.remove_unused_private_methods=true cleanup.remove_unused_private_types=true cleanup.sort_members=false cleanup.sort_members_all=false cleanup.use_blocks=false cleanup.use_blocks_only_for_return_and_throw=false cleanup.use_parentheses_in_expressions=true cleanup.use_this_for_non_static_field_access=false cleanup.use_this_for_non_static_field_access_only_if_necessary=true cleanup.use_this_for_non_static_method_access=false cleanup.use_this_for_non_static_method_access_only_if_necessary=true cleanup_profile=_BaseX cleanup_settings_version=2 eclipse.preferences.version=1 formatter_profile=_BaseX Formatter Profile formatter_settings_version=11 org.eclipse.jdt.ui.ignorelowercasenames=true org.eclipse.jdt.ui.importorder=java;javax;org;com; org.eclipse.jdt.ui.ondemandthreshold=1 org.eclipse.jdt.ui.staticondemandthreshold=1 basex-7.7.2/basex-tests/.settings/org.eclipse.ltk.core.refactoring.prefs000066400000000000000000000002111222453003200262710ustar00rootroot00000000000000#Fri Mar 19 00:48:33 CET 2010 eclipse.preferences.version=1 org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false basex-7.7.2/basex-tests/.settings/org.eclipse.m2e.core.prefs000066400000000000000000000001321222453003200236620ustar00rootroot00000000000000activeProfiles= eclipse.preferences.version=1 resolveWorkspaceProjects=true version=1 basex-7.7.2/basex-tests/pom.xml000066400000000000000000000040221222453003200163770ustar00rootroot00000000000000 4.0.0 basex-tests org.basex basex-parent 7.7.2 .. org.basex basex-api ${project.version} junit junit org.eclipse.jetty jetty-server org.eclipse.jetty jetty-servlet org.eclipse.jetty jetty-webapp ${project.artifactId}-${project.version} org.apache.maven.plugins maven-compiler-plugin false org.apache.maven.plugins maven-jar-plugin org.apache.maven.plugins maven-surefire-plugin org.apache.maven.plugins maven-source-plugin org.apache.maven.plugins maven-checkstyle-plugin basex-7.7.2/basex-tests/readme.txt000066400000000000000000000012001222453003200170530ustar00rootroot00000000000000======================================================== BASEX TESTS === This package contains various tests that are used in BaseX development. These tests did not make it into the main repository because they are: * broken * stress tests that are intended to be run for a long time * in the making The former list is not exhaustive, so feel free to update this Readme. Tests are run with the help of maven: `mvn test` For questions or feedback, feel free to use the Tracker or our [Mailinglist](http://basex.org/open-source/ "BaseX | Open Source"). ======================================================================== basex-7.7.2/basex-tests/src/000077500000000000000000000000001222453003200156535ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/main/000077500000000000000000000000001222453003200165775ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/main/java/000077500000000000000000000000001222453003200175205ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/main/java/StartGUI.java000066400000000000000000000007101222453003200220230ustar00rootroot00000000000000/** * GUI start class, which includes all module libraries for convenient testing. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class StartGUI { /** Hidden constructor. */ private StartGUI() { } /** * Main method. * @param args command-line arguments * @throws Exception exception */ public static void main(final String... args) throws Exception { new org.basex.BaseXGUI(args); } } basex-7.7.2/basex-tests/src/main/java/org/000077500000000000000000000000001222453003200203075ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/main/java/org/basex/000077500000000000000000000000001222453003200214115ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/main/java/org/basex/test/000077500000000000000000000000001222453003200223705ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/main/java/org/basex/test/qt3ts/000077500000000000000000000000001222453003200234465ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/main/java/org/basex/test/qt3ts/QT3TSGenerator.java000066400000000000000000000027451222453003200270460ustar00rootroot00000000000000package org.basex.test.qt3ts; import java.io.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.util.*; /** * Generates the QT3TS JUnit tests from XML files. * For the resource files to be collected, the tests have to be run once with the * {@code QT3TS} property set to the path of the test suite files, e.g. by setting * {@code -DQT3TS=...} on the JVM. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ public final class QT3TSGenerator { /** Path to the XQuery files. */ private static final String XQ_PATH = "src/main/xquery"; /** Private default constructor. */ private QT3TSGenerator() { /* hidden */ } /** * Main method, initiates the generation of the test cases. * @param args command-line arguments * @throws BaseXException database exception */ public static void main(final String[] args) throws BaseXException { final File qt3ts = args.length > 0 ? new File(args[0]) : null; if(qt3ts == null || !qt3ts.isDirectory()) { Util.errln("Usage: java " + QT3TSGenerator.class.getName() + " []\n" + " - : Path to the QT3 test suite files"); System.exit(1); } System.setProperty("QT3TS", qt3ts.getAbsolutePath()); Util.outln(qt3ts.getAbsolutePath()); final Context ctx = new Context(); new Set("QUERYPATH", XQ_PATH).execute(ctx); new Set("BINDINGS", "QT3TS=" + qt3ts).execute(ctx); new Run(new File(XQ_PATH, "qt3ts.xq").getPath()).execute(ctx); } } basex-7.7.2/basex-tests/src/main/java/org/basex/test/qt3ts/QT3TestSet.java000066400000000000000000000334631222453003200262450ustar00rootroot00000000000000package org.basex.test.qt3ts; import static org.basex.core.Prop.*; import static org.basex.util.Token.*; import java.io.*; import java.util.*; import java.util.regex.*; import org.basex.core.*; import org.basex.core.cmd.Set; import org.basex.io.*; import org.basex.query.*; import org.basex.query.func.*; import org.basex.query.util.Compare.Mode; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.tests.bxapi.*; import org.basex.tests.bxapi.xdm.*; import org.basex.util.*; import org.junit.*; /** * Base class for generated QT3TS test sets. * * @author Leo Woerteler */ public abstract class QT3TestSet { /** EQName pattern. */ private static final Pattern BIND = Pattern.compile("^Q\\{(.*?)\\}(.+)$"); /** Database context. */ public Context ctx; /** Expected results. */ public final ArrayList expected = new ArrayList(); /** QT3TS path, possibly {@code null}. */ public static final String QT3TS = System.getenv("QT3TS"); /** The current query's result. */ public QT3Result result; /** * Initializes the context. * @throws BaseXException exception */ @Before public void buildUp() throws BaseXException { ctx = new Context(); new Set(Prop.CHOP, false).execute(ctx); new Set(Prop.INTPARSE, false).execute(ctx); new Set(Prop.XQUERY3, true).execute(ctx); result = null; } /** Closes the context. */ @After public void tearDown() { ctx.close(); ctx = null; result = null; } /** Sets the XQuery version to 1.0. */ protected void xquery10() { ctx.prop.set(Prop.XQUERY3, false); } /** * Tests assertion. * @param exp expected result * @return optional expected test suite result */ protected boolean assertQuery(final String exp) { final XdmValue value = result.value; if(value == null) return fail(exp); try { return result(new XQuery(exp, ctx).bind("result", value).value().getBoolean(), exp); } catch(final XQueryException ex) { // should not occur return fail(ex.getException().getMessage()); } } /** * Tests count. * @param exp expected result * @return optional expected test suite result */ protected boolean assertCount(final long exp) { final XdmValue value = result.value; if(value == null) return fail(exp + " items"); final int res = value.size(); return result(exp == res, Util.info("% items (% found)", exp, res)); } /** * Tests equality. * @param expect expected result * @return optional expected test suite result */ protected boolean assertEq(final String expect) { final XdmValue value = result.value; if(value == null) return fail(Util.info("Equal to: '%'", expect)); try { final XdmItem exp = new XQuery(expect, ctx).next(); final XdmItem res = value instanceof XdmItem ? (XdmItem) value : null; return result(exp.equal(res), exp.toString()); } catch(final XQueryException err) { return result(expect.equals(value.getString()), err.getException().getMessage()); } } /** * Tests deep equals. * @param expect expected result * @return optional expected test suite result */ protected boolean assertDeepEq(final String expect) { final XdmValue value = result.value; if(value == null) return fail(Util.info("Deep-equal to: '%'", expect)); final XdmValue exp = new XQuery(expect, ctx).value(); return result(exp.deepEqual(value), exp.toString()); } /** * Tests permutation. * [LW] wrong * @param expect expected result * @return optional expected test suite result */ protected boolean assertPermutation(final String expect) { final XdmValue value = result.value; if(value == null) return fail(Util.info("Permutation of: '%'", expect)); // cache expected results final HashSet exp = new HashSet(); for(final XdmItem it : new XQuery(expect, ctx)) exp.add(it.getString()); // cache actual results final HashSet res = new HashSet(); for(final XdmItem it : value) res.add(it.getString()); if(exp.size() != res.size()) return fail(Util.info("% results (found: %)", exp.size(), res.size())); for(final String s : exp.toArray(new String[exp.size()])) { if(!res.contains(s)) return fail(Util.info("% (missing)", s)); } for(final String s : res.toArray(new String[exp.size()])) { if(!exp.contains(s)) return fail(Util.info("% (missing in expected result)", s)); } return true; } /** * Tests the serialized result. * [LW] wrong * @param expect expected result * @param ignorePref ignore namespaces * @return optional expected test suite result */ protected boolean assertSerialization(final String expect, final boolean ignorePref) { final XdmValue value = result.value; if(value == null) return fail(Util.info("Serializes to: '%'", expect)); final String res = normNL(asString("serialize(.,map{'indent':='no'})", value)); if(expect.equals(res)) return true; // include check for comments, processing instructions and namespaces String flags = "'" + Mode.ALLNODES + "'"; if(!ignorePref) flags += ",'" + Mode.NAMESPACES + "'"; final String query = Function.DEEP_EQUAL_OPT.args("" + expect + "", "" + res + "" , "(" + flags + ")"); return result(asBoolean(query, null), expect); } /** * Tests a serialization error. * @param code expected error code * @return optional expected test suite result */ protected boolean assertSerialError(final String code) { final XdmValue value = result.value; if(value == null) return fail(Util.info("Serialization error: '%'", code)); try { value.toString(); return fail(code); } catch(final RuntimeException qe) { final String res = qe.getMessage().replaceAll("\\[|\\].*\r?\n?.*", ""); return result(code.equals("*") || code.equals(res), Util.info("% (found: %)", code, res)); } } /** * Tests a serialization error. * @param code expected error code * @return optional expected test suite result */ protected boolean error(final String code) { if(result.value != null) return fail(Util.info("Error: '%'", code)); if(code.equals("*")) return true; String name = code, uri = string(QueryText.ERRORURI); final Matcher m = BIND.matcher(code); if(m.find()) { uri = m.group(1); name = m.group(2); } final QNm err = new QNm(name, uri); if(result.exc != null) { final QueryException qe = result.exc.getException(); final QNm qn = qe.err() != null ? qe.err().qname() : qe.qname(); if(qn != null) return result(err.eq(qn), Util.info("% (found: %)", err, qn)); return fail(Util.info("% (found: %)", err, "?")); } final String msg = result.error.getMessage(); final String res = msg == null ? Util.name(result.error) : msg.replaceAll("\\[|\\].*\r?\n?.*", ""); return result(code.equals(res), Util.info("% (found: %)", code, res)); } /** * Tests string value. * @param norm normalize space * @param exp expected result * @return optional expected test suite result */ protected boolean assertStringValue(final boolean norm, final String exp) { final XdmValue value = result.value; if(value == null) return fail(Util.info("String value: '%'", exp)); final TokenBuilder tb = new TokenBuilder(); int c = 0; for(final XdmItem it : value) { if(c != 0) tb.add(' '); tb.add(it.getString()); c++; } return result(exp.equals(norm ? string(norm(tb.finish())) : tb.toString()), exp); } /** * Tests boolean. * @param exp expected * @return optional expected test suite result */ protected boolean assertBoolean(final boolean exp) { final XdmValue value = result.value; if(value == null) return fail(Util.info("Boolean result: %", exp)); return result(value.getType().eq(SeqType.BLN) && value.getBoolean() == exp, Util.info(exp)); } /** * Tests empty sequence. * @return optional expected test suite result */ protected boolean assertEmpty() { return result(result.value == XdmEmpty.EMPTY, "()"); } /** * Tests type. * @param exp expected result * @return optional expected test suite result */ protected boolean assertType(final String exp) { final XdmValue value = result.value; if(value == null) return fail(Util.info("Has type: '%'", exp)); try { final XQuery query = new XQuery("$result instance of " + exp, ctx); return result(query.bind("result", value).value().getBoolean(), Util.info("type '%' (found: '%')", exp, value.getType().toString())); } catch(final XQueryException ex) { // should not occur return fail(ex.getException().getMessage()); } } /** * Matches the serialized result against a regular expression. * @param pat regex pattern * @param flags matching flags * @return optional expected test suite result */ protected boolean serializationMatches(final String pat, final String flags) { final XdmValue value = result.value; if(value == null) return fail(Util.info("Matches: '%'", pat)); final XQuery match = new XQuery("fn:matches($in, $pat, $flags)", ctx); match.bind("in", value.toString()).bind("pat", pat).bind("flags", flags); return result(match.next().getBoolean(), Util.info("Matches: '%'", pat)); } /** * Returns the string representation of a query result. * @param query query string * @param value optional context value * @return optional expected test suite result */ private String asString(final String query, final XdmValue value) { return XQuery.string(query, value, ctx); } /** * Returns the boolean representation of a query result. * @param query query string * @param value optional context value * @return optional expected test suite result */ private boolean asBoolean(final String query, final XdmValue value) { final XdmValue xv = new XQuery(query, ctx).context(value).value(); return xv.size() != 0 && xv.getBoolean(); } /** * Removes comments from the specified string. * @param in input string * @return result */ private static String normNL(final String in) { return in.replaceAll("\r\n|\r|\n", NL); } /** * Adds the string to the expected results if {@code success} if {@code false} * and returns {@code success}. * @param success success flag * @param expect expected expression * @return {@code success} */ private boolean result(final boolean success, final String expect) { return success || fail(expect); } /** * Adds the string to the expected results. * @param expect expected string * @return {@code false} */ private boolean fail(final String expect) { return !expected.add(expect); } /** * Throws an {@link AssertionError} if the test failed. * @param success test success */ protected void test(final boolean success) { if(!success) { final StringBuilder sb = new StringBuilder("\nExpected:"); if(expected.size() == 1) { sb.append(' ' + expected.get(0)); } else { sb.append("one of..."); for(final String e : expected) sb.append("\n- " + e); } sb.append("\nFound: ").append(result); final AssertionError err = new AssertionError(sb); if(result.error != null) err.setStackTrace(result.error.getStackTrace()); else if(result.exc != null) err.setStackTrace(result.exc.getException().getStackTrace()); throw err; } } /** * Reads a query string from a file. * @param uri file URI * @return file contents */ protected String queryFile(final String uri) { try { return Token.string(IO.get(uri).read()); } catch(IOException e) { throw new AssertionError(e); } } /** * Creates an absolute file path for the given resource path. * @param path resource path * @return absolute file path */ protected String file(final String path) { final File f = new File("src/test/resources/qt3ts", path).getAbsoluteFile(); if(f.exists()) return f.getPath(); if(QT3TS == null) return null; final File dir = f.getParentFile(); if(!dir.exists()) dir.mkdirs(); final File qt3 = new File(QT3TS, path); if(!qt3.canRead()) return null; try { f.createNewFile(); final BufferedInputStream in = new BufferedInputStream(new FileInputStream(qt3)); final BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(f)); final byte[] buffer = new byte[1 << 13]; for(int len; (len = in.read(buffer)) >= 0;) { out.write(buffer, 0, len); } in.close(); out.close(); return f.getPath(); } catch(IOException e) { e.printStackTrace(); return null; } } /** * Creates a document node from the given file path. * @param file file path * @return document node */ protected XdmItem node(final String file) { return file == null ? null : new XQuery("doc('" + file + "')", ctx).next(); } /** * Structure for storing XQuery results. */ public static class QT3Result { /** Query result. */ XdmValue value; /** Query exception. */ XQueryException exc; /** Query error. */ Throwable error; /** * Constructor for successful evaluation. * @param val result value */ public QT3Result(final XdmValue val) { value = val; } /** * Constructor for externally thrown errors. * @param th cause */ public QT3Result(final Throwable th) { if(th instanceof XQueryException) exc = (XQueryException) th; else error = th; } @Override public String toString() { return value != null ? value.toString() : exc != null ? '[' + exc.getCode() + "] " + exc.toString() : error.toString(); } } } basex-7.7.2/basex-tests/src/main/java/org/basex/tests/000077500000000000000000000000001222453003200225535ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/main/java/org/basex/tests/Compare.java000066400000000000000000000114041222453003200250040ustar00rootroot00000000000000package org.basex.tests; import java.io.*; import java.util.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.io.*; import org.basex.util.*; import org.basex.util.list.*; /** * This class compares query results with other query processors. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public abstract class Compare { /** XSLT flag; not set to 'final' to circumvent dead-code warnings. */ private static boolean xsltMode; /** Verbose mode. */ private static final boolean VERBOSE = true; /** XSLT skeleton. */ private static final String XSLT = "" + "" + ""; /** Query file . */ private static final String QUERIES = "etc/queries.txt"; /** Temporary XSLT context. */ private static final String TMPCTX = Prop.TMP + "queries.xml"; /** Temporary query file . */ private static final String TMP = Prop.TMP + "queries.tmp"; /** Query processors. */ private static final String[][] XQUERYPROCS = { { "Saxon", "java", "-cp", "c:/Program Files/Saxon;c:/Program Files/Saxon/saxon9ee.jar", "net.sf.saxon.Query", "-qversion:1.1", "-sa", TMP, "!omit-xml-declaration=yes" }, /*{ "Saxon", "java", "-cp", "c:/Program Files/Saxon/saxon9he.jar", "net.sf.saxon.Query", TMP, "!omit-xml-declaration=yes" }, */ /*{ "XQSharp", "c:/Program Files (x86)/XQSharp/xquery.exe", TMP, "!omit-xml-declaration=yes" } */ }; /** XSLT processors. */ private static final String[][] XSLTPROCS = { { "Saxon", "java", "-jar", "c:/Program Files/Saxon/saxon9he.jar", TMPCTX, TMP, "!omit-xml-declaration=yes" }, { "XQShp", "c:/Program Files (x86)/XQSharp/xslt.exe", "-s", TMPCTX, TMP, "!omit-xml-declaration=yes" } }; /** Selected processors. */ private static final String[][] PROCS = xsltMode ? XSLTPROCS : XQUERYPROCS; /** Database context. */ private static Context context = new Context(); /** * Main method of the test class. * @param args command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { // write temporary XSLT query context to disk if(xsltMode) new IOFile(TMPCTX).write(Token.token("")); // loop through all queries final BufferedReader br = new BufferedReader( new InputStreamReader(new FileInputStream(QUERIES), Token.UTF8)); while(true) { final String line = br.readLine(); if(line == null) break; if(!line.isEmpty() && line.charAt(0) != '#') query(line); } br.close(); // delete temporary files new IOFile(TMP).delete(); new IOFile(TMPCTX).delete(); } /** * Runs a single query on all processors. * @param query query input * @throws Exception exception */ private static void query(final String query) throws Exception { final StringList sl = new StringList(); String result = ""; try { result = new XQuery(query).execute(context); } catch(final BaseXException ex) { result = ex.getMessage().replaceAll("[\\r\\n]+", " "); } // write XQuery or XSLT to temporary file new IOFile(TMP).write(xsltMode ? Util.inf(XSLT, query) : Token.token(query)); boolean same = true; for(final String[] proc : PROCS) { final String res = execute(proc); same &= result.equals(res); sl.add(res); } if(!same) { Util.outln("Query: %", query); Util.outln("BaseX: %", result); for(int p = 0; p < PROCS.length; p++) { Util.outln("%: %", PROCS[p][0], sl.get(p)); } Util.outln(); } else if(VERBOSE) { Util.outln("Query: %", query); Util.outln("Result: %", result); Util.outln(); } } /** * Runs a single processor. * @param proc query processor * @return string result */ private static String execute(final String[] proc) { try { final ArrayList al = new ArrayList(); al.addAll(Arrays.asList(proc).subList(1, proc.length)); final ProcessBuilder pb = new ProcessBuilder(al); pb.redirectErrorStream(true); final Process pr = pb.start(); final InputStream is = pr.getInputStream(); final ByteList bl = new ByteList(); while(true) { final int t = is.read(); if(t == -1) break; bl.add(t); } return bl.toString().replaceAll("[\\r\\n ]+", " "); } catch(final IOException ex) { return ex.getMessage(); } } } basex-7.7.2/basex-tests/src/main/java/org/basex/tests/bxapi/000077500000000000000000000000001222453003200236565ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/main/java/org/basex/tests/bxapi/XQuery.java000066400000000000000000000151451222453003200257640ustar00rootroot00000000000000package org.basex.tests.bxapi; import java.util.*; import javax.xml.namespace.*; import org.basex.core.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.iter.*; import org.basex.query.util.format.*; import org.basex.query.value.item.*; import org.basex.tests.bxapi.xdm.*; import org.basex.util.*; import org.basex.util.hash.*; import org.basex.util.list.*; /** * Wrapper for evaluating XQuery expressions. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class XQuery implements Iterable { /** Query processor. */ private final QueryProcessor qp; /** Query iterator. */ private Iter ir; /** * Constructor. * @param query query * @param ctx database context */ public XQuery(final String query, final Context ctx) { qp = new QueryProcessor(query, ctx); } /** * Binds an initial context. * @param value context value to be bound * @return self reference * @throws XQueryException exception */ public XQuery context(final Object value) { try { if(value != null) qp.context(value instanceof XdmValue ? ((XdmValue) value).internal() : value); return this; } catch(final QueryException ex) { Util.debug(ex); throw new XQueryException(ex); } } /** * Binds a variable. * @param key key * @param value value to be bound * @return self reference * @throws XQueryException exception */ public XQuery bind(final String key, final Object value) { try { qp.bind(key, value instanceof XdmValue ? ((XdmValue) value).internal() : value); return this; } catch(final QueryException ex) { Util.debug(ex); throw new XQueryException(ex); } } /** * Declares a namespace. * A namespace is undeclared if the {@code uri} is an empty string. * The default element namespaces is set if the {@code prefix} is empty. * @param prefix namespace prefix * @param uri namespace uri * @return self reference */ public XQuery namespace(final String prefix, final String uri) { try { qp.namespace(prefix, uri); return this; } catch(final QueryException ex) { Util.debug(ex); throw new XQueryException(ex); } } /** * Declares a decimal format. * @param name qname * @param map format * @return self reference */ public XQuery decimalFormat(final QName name, final HashMap map) { try { final TokenMap tm = new TokenMap(); for(final Map.Entry e : map.entrySet()) { tm.put(Token.token(e.getKey()), Token.token(e.getValue())); } qp.ctx.sc.decFormats.put(new QNm(name).id(), new DecFormatter(null, tm)); return this; } catch(final QueryException ex) { Util.debug(ex); throw new XQueryException(ex); } } /** * Adds a collection. * @param name name of the collection * @param paths document paths * @throws XQueryException exception */ public void addCollection(final String name, final String[] paths) { final StringList sl = new StringList(); for(final String p : paths) sl.add(p); try { qp.ctx.resource.addCollection(name, sl.toArray()); } catch(final QueryException ex) { Util.debug(ex); throw new XQueryException(ex); } } /** * Adds a document. * @param name name of the collection * @param path document path * @throws XQueryException exception */ public void addDocument(final String name, final String path) { try { qp.ctx.resource.addDoc(name, path); } catch(final QueryException ex) { Util.debug(ex); throw new XQueryException(ex); } } /** * Adds a resource. * @param name name of the collection * @param strings document path, encoding * @throws XQueryException exception */ public void addResource(final String name, final String... strings) { qp.ctx.resource.addResource(name, strings); } /** * Adds a module. * @param uri module uri * @param file file reference * @throws XQueryException exception */ public void addModule(final String uri, final String file) { qp.module(uri, file); } /** * Sets the base URI. * @param base base URI * @return self reference * @throws XQueryException exception */ public XQuery baseURI(final String base) { qp.ctx.sc.baseURI(base); return this; } /** * Returns the next item, or {@code null} if all items have been returned. * @return next result item * @throws XQueryException exception */ public XdmItem next() { Item it = null; try { if(ir == null) ir = qp.iter(); it = ir.next(); return it != null ? XdmItem.get(it) : null; } catch(final QueryException ex) { Util.debug(ex); throw new XQueryException(ex); } finally { if(it == null) qp.close(); } } /** * Returns the result value. * @return result value * @throws XQueryException exception */ public XdmValue value() { try { return XdmValue.get(qp.value()); } catch(final QueryException ex) { Util.debug(ex); throw new XQueryException(ex); } finally { qp.close(); } } /** * Returns serialization properties. * @return serialization properties * @throws XQueryException exception */ public SerializerProp serializer() { return qp.ctx.serParams(false); } /** * Closes the query; will be called whenever if items have been returned. * Should be manually called if not all items are retrieved. * @throws XQueryException exception */ public void close() { qp.close(); } @Override public Iterator iterator() { return new Iterator() { /** Current item. */ private XdmItem next; @Override public boolean hasNext() { if(next == null) next = XQuery.this.next(); return next != null; } @Override public XdmItem next() { final XdmItem it = hasNext() ? next : null; next = null; return it; } @Override public void remove() { Util.notexpected(); } }; } /** * Returns the string representation of a query result. * @param query query string * @param val optional context * @param ctx database context * @return optional expected test suite result */ public static String string(final String query, final XdmValue val, final Context ctx) { final XdmValue xv = new XQuery(query, ctx).context(val).value(); return xv.size() == 0 ? "" : xv.getString(); } @Override public String toString() { return qp.query(); } } basex-7.7.2/basex-tests/src/main/java/org/basex/tests/bxapi/XQueryException.java000066400000000000000000000020131222453003200276310ustar00rootroot00000000000000package org.basex.tests.bxapi; import org.basex.query.*; import org.basex.util.*; /** * XQuery error. Inherited from {@link RuntimeException} to provide * generic iterators. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class XQueryException extends RuntimeException { /** * Constructor. * @param ex exception */ public XQueryException(final QueryException ex) { super(ex); } /** * Returns the causing query exception. * @return query exception */ public QueryException getException() { return (QueryException) getCause(); } /** * Returns the error code. * @return error code */ public String getCode() { return Token.string(getException().qname().local()); } @Override public String getLocalizedMessage() { return getCause().getLocalizedMessage(); } @Override public String getMessage() { return getCause().getMessage(); } @Override public String toString() { return getCause().toString(); } } basex-7.7.2/basex-tests/src/main/java/org/basex/tests/bxapi/xdm/000077500000000000000000000000001222453003200244465ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/main/java/org/basex/tests/bxapi/xdm/XdmAtomic.java000066400000000000000000000021761222453003200272040ustar00rootroot00000000000000package org.basex.tests.bxapi.xdm; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.tests.bxapi.*; import org.basex.util.*; /** * Wrapper for representing XQuery items. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ final class XdmAtomic extends XdmItem { /** Wrapped item. */ private final Item item; /** * Constructor. * @param it item */ XdmAtomic(final Item it) { item = it; } @Override public boolean getBoolean() { try { return item.bool(null); } catch(final QueryException ex) { throw new XQueryException(ex); } } @Override public String getString() { try { return Token.string(item.string(null)); } catch(final QueryException ex) { throw new XQueryException(ex); } } @Override public SeqType getType() { return item.type(); } @Override public String toString() { return item.toString(); } // PACKAGE PROTECTED METHODS ================================================ @Override public Item internal() { return item; } } basex-7.7.2/basex-tests/src/main/java/org/basex/tests/bxapi/xdm/XdmEmpty.java000066400000000000000000000021141222453003200270560ustar00rootroot00000000000000package org.basex.tests.bxapi.xdm; import java.util.*; import org.basex.query.value.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Wrapper for representing an empty sequence. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class XdmEmpty extends XdmValue { /** Empty sequence. */ public static final XdmEmpty EMPTY = new XdmEmpty(); /** * Private Constructor. */ private XdmEmpty() { } @Override public SeqType getType() { return SeqType.EMP; } @Override public int size() { return 0; } @Override public Iterator iterator() { return new Iterator() { @Override public boolean hasNext() { return false; } @Override public XdmItem next() { return null; } @Override public void remove() { Util.notexpected(); } }; } @Override public Value internal() { return Empty.SEQ; } @Override public String toString() { return "()"; } } basex-7.7.2/basex-tests/src/main/java/org/basex/tests/bxapi/xdm/XdmItem.java000066400000000000000000000027361222453003200266700ustar00rootroot00000000000000package org.basex.tests.bxapi.xdm; import java.util.*; import org.basex.query.*; import org.basex.query.value.item.*; import org.basex.query.value.node.*; import org.basex.tests.bxapi.*; import org.basex.util.*; /** * Wrapper for representing XQuery items. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public abstract class XdmItem extends XdmValue { /** * Returns a new XQuery value. * @param val value * @return result */ public static XdmItem get(final Item val) { return val instanceof ANode ? new XdmNode((ANode) val) : new XdmAtomic(val); } @Override public int size() { return 1; } @Override public abstract Item internal(); /** * Checks if the two items are equal, according to XQuery. * @param item second item * @return result of check * @throws XQueryException exception */ public boolean equal(final XdmItem item) { try { return item != null && internal().eq(item.internal(), null, null); } catch(final QueryException ex) { throw new XQueryException(ex); } } @Override public final Iterator iterator() { return new Iterator() { private boolean more = true; @Override public boolean hasNext() { return more; } @Override public XdmItem next() { more = false; return XdmItem.this; } @Override public void remove() { Util.notexpected(); } }; } } basex-7.7.2/basex-tests/src/main/java/org/basex/tests/bxapi/xdm/XdmNode.java000066400000000000000000000023261222453003200266520ustar00rootroot00000000000000package org.basex.tests.bxapi.xdm; import javax.xml.namespace.*; import org.basex.query.*; import org.basex.query.value.node.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Wrapper for representing an XQuery node. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ final class XdmNode extends XdmItem { /** Wrapped node. */ private final ANode node; /** * Constructor. * @param n node */ XdmNode(final ANode n) { node = n; } @Override public String getBaseURI() { return Token.string(node.baseURI()); } @Override public QName getName() { return node.qname().toJava(); } @Override public String getString() { return Token.string(node.string()); } @Override public boolean getBoolean() { return node.bool(null); } @Override public SeqType getType() { return node.type(); } @Override public String toString() { try { return node.serialize().toString(); } catch(final QueryException ex) { throw Util.notexpected(ex.getMessage()); } } // PACKAGE PROTECTED METHODS ================================================ @Override public ANode internal() { return node; } } basex-7.7.2/basex-tests/src/main/java/org/basex/tests/bxapi/xdm/XdmSequence.java000066400000000000000000000025521222453003200275360ustar00rootroot00000000000000package org.basex.tests.bxapi.xdm; import java.util.*; import org.basex.query.value.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.util.*; /** * Wrapper for representing XQuery values. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ final class XdmSequence extends XdmValue { /** Wrapped sequence. */ final Seq sequence; /** * Constructor. * @param seq sequence */ XdmSequence(final Seq seq) { sequence = seq; } @Override public SeqType getType() { return sequence.type(); } @Override public int size() { return (int) sequence.size(); } @Override public Iterator iterator() { return new Iterator() { private int c; @Override public boolean hasNext() { return c < sequence.size(); } @Override public XdmItem next() { return XdmItem.get(sequence.itemAt(c++)); } @Override public void remove() { Util.notexpected(); } }; } @Override public Value internal() { return sequence; } @Override public String toString() { final StringBuilder sb = new StringBuilder("("); for(final XdmItem it : this) { if(sb.length() != 1) sb.append(','); sb.append(it.toString()); } return sb.append(')').toString(); } } basex-7.7.2/basex-tests/src/main/java/org/basex/tests/bxapi/xdm/XdmValue.java000066400000000000000000000051171222453003200270420ustar00rootroot00000000000000package org.basex.tests.bxapi.xdm; import javax.xml.namespace.*; import org.basex.query.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.seq.*; import org.basex.query.value.type.*; import org.basex.tests.bxapi.*; import org.basex.util.*; /** * Wrapper for representing XQuery values. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public abstract class XdmValue implements Iterable { /** * Returns a new XQuery value. * @param val value * @return result */ public static XdmValue get(final Value val) { return val instanceof Empty ? XdmEmpty.EMPTY : val instanceof Item ? XdmItem.get((Item) val) : new XdmSequence((Seq) val); } /** * Returns the base uri of a node. * @return node name */ public String getBaseURI() { throw Util.notexpected("Item must be a node."); } /** * Returns the name of a node. * @return node name */ public QName getName() { throw Util.notexpected("Item must be a node."); } /** * Returns the boolean value. * @return node name */ public boolean getBoolean() { throw Util.notexpected("Value has no boolean representation."); } /** * Returns the integer value. * @return node name */ public final long getInteger() { try { return Long.parseLong(getString()); } catch(final NumberFormatException ex) { throw Util.notexpected("Value has no integer representation."); } } /** * Returns the string value. * @return node name */ public String getString() { throw Util.notexpected("Value has no string representation."); } /** * Returns the number of items stored in the value. * @return number of items */ public abstract int size(); /** * Checks if the two values are deep-equal, according to XQuery. * @param value second value * @return result of check * @throws XQueryException exception */ public boolean deepEqual(final XdmValue value) { try { return Compare.deep(internal(), value.internal(), null); } catch(final QueryException ex) { throw new XQueryException(ex); } } /** * Returns the value type. * @return value type */ public abstract SeqType getType(); @Override public abstract String toString(); // PACKAGE PROTECTED METHODS ================================================ /** * Returns the internal value representation. * Should be made invisible to other packages. * @return value */ public abstract Value internal(); } basex-7.7.2/basex-tests/src/main/java/org/basex/tests/package.html000066400000000000000000000001011222453003200250240ustar00rootroot00000000000000 Contains classes for testing the project code. basex-7.7.2/basex-tests/src/main/java/org/basex/tests/w3c/000077500000000000000000000000001222453003200232475ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/main/java/org/basex/tests/w3c/QT3Constants.java000066400000000000000000000022411222453003200264150ustar00rootroot00000000000000package org.basex.tests.w3c; /** * Strings. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ interface QT3Constants { /** QT3TS String. */ String CATALOG = "catalog.xml"; /** QT3TS String. */ String NNAME = "name"; /** QT3TS String. */ String SOURCE = "source"; /** QT3TS String. */ String RESOURCE = "resource"; /** QT3TS String. */ String PARAM = "param"; /** QT3TS String. */ String NAMESPACE = "namespace"; /** QT3TS String. */ String SCHEMA = "schema"; /** QT3TS String. */ String COLLECTION = "collection"; /** QT3TS String. */ String COLLATION = "collation"; /** QT3TS String. */ String STATIC_BASE_URI = "static-base-uri"; /** QT3TS String. */ String FILE = "file"; /** QT3TS String. */ String ROLE = "role"; /** QT3TS String. */ String CODE = "code"; /** QT3TS String. */ String URI = "uri"; /** QT3TS String. */ String SELECT = "select"; /** QT3TS String. */ String PREFIX = "prefix"; /** QT3TS String. */ String ENCODING = "encoding"; /** QT3TS String. */ String SCHEMA_IMPORT = "schemaImport"; /** QT3TS String. */ String SCHEMA_VALIDATION = "schemaValidation"; } basex-7.7.2/basex-tests/src/main/java/org/basex/tests/w3c/QT3Env.java000066400000000000000000000114331222453003200251740ustar00rootroot00000000000000package org.basex.tests.w3c; import static org.basex.tests.w3c.QT3Constants.*; import java.util.*; import javax.xml.namespace.*; import org.basex.core.*; import org.basex.query.value.item.*; import org.basex.tests.bxapi.*; import org.basex.tests.bxapi.xdm.*; import org.basex.util.*; import org.basex.util.list.*; /** * Driver environment for the {@link QT3TS} test suite driver. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ final class QT3Env { /** Namespaces: prefix, uri. */ final ArrayList> namespaces; /** Sources: role, file, validation, uri, xml:id. */ final ArrayList> sources; /** Resources. */ final ArrayList> resources; /** Parameters: name, as, select, declared. */ final ArrayList> params; /** Schemas: uri, file, xml:id. */ final HashMap schemas; /** Collations: uri, default. */ final HashMap collations; /** Decimal Formats: decimal-separator, grouping-separator, digit, pattern-separator, infinity, NaN, per-mille, minus-sign, name, percent, zero-digit. */ final HashMap> decFormats; /** Static Base URI: uri. */ final String baseURI; /** Name. */ final String name; /** Collection uri. */ final String collURI; /** Initial context item. */ final XdmValue context; /** Collection context flag. */ final boolean collContext; /** Collection sources. */ final StringList collSources; /** * Constructor. * @param ctx database context * @param env environment item */ QT3Env(final Context ctx, final XdmValue env) { name = XQuery.string('@' + NNAME, env, ctx); sources = list(ctx, env, SOURCE); resources = list(ctx, env, RESOURCE); params = list(ctx, env, PARAM); namespaces = list(ctx, env, NAMESPACE); ArrayList> al = list(ctx, env, SCHEMA); schemas = al.isEmpty() ? null : al.get(0); al = list(ctx, env, COLLATION); collations = al.isEmpty() ? null : al.get(0); final String uri = string(STATIC_BASE_URI, ctx, env); baseURI = "#UNDEFINED".equals(uri) ? "" : uri; // collections collURI = XQuery.string("*:collection/@uri", env, ctx); collContext = new XQuery("*:collection/*:source/@role = '.'", ctx). context(env).value().getBoolean(); collSources = new StringList(); for(final XdmItem iatt : new XQuery("*:collection/*:source/@file", ctx).context(env)) collSources.add(iatt.getString()); decFormats = new HashMap>(); for(final XdmItem it : new XQuery("*:decimal-format", ctx).context(env)) { final XdmValue it1 = new XQuery( "for $n in @name " + "let $b := substring-before($n, ':') " + "return QName(if($b) then namespace-uri-for-prefix($b, .) else '', $n)", ctx).context(it).value(); final HashMap hm = new HashMap(); final QNm qnm = it1.size() != 0 ? (QNm) it1.internal() : new QNm(Token.EMPTY); decFormats.put(qnm.toJava(), hm); for(final XdmItem it2 : new XQuery("@*[name() != 'name']", ctx).context(it)) { hm.put(it2.getName().getLocalPart(), it2.getString()); } } final String c = XQuery.string("*:context-item/@select", env, ctx); context = c.isEmpty() ? null : new XQuery(c, ctx).value(); } /** * Returns a list of all attributes of the specified element in a map. * @param ctx database context * @param env root element * @param elem element to be parsed * @return map list */ static ArrayList> list(final Context ctx, final XdmValue env, final String elem) { final ArrayList> list = new ArrayList>(); for(final XdmItem it : new XQuery("*:" + elem, ctx).context(env)) { list.add(map(ctx, it)); } return list; } /** * Returns all attributes of the specified element in a map. * @param ctx database context * @param env root element * @return map */ static HashMap map(final Context ctx, final XdmValue env) { final HashMap map = new HashMap(); for(final XdmItem it : new XQuery("@*", ctx).context(env)) map.put(it.getName().getLocalPart(), it.getString()); return map; } /** * Returns a single attribute string. * @param elm name of element * @param ctx database context * @param env root element * @return map */ static String string(final String elm, final Context ctx, final XdmValue env) { final XdmItem it = new XQuery("*:" + elm, ctx).context(env).next(); return it == null ? null : new XQuery("string(@*)", ctx).context(it).next().getString(); } } basex-7.7.2/basex-tests/src/main/java/org/basex/tests/w3c/QT3TS.java000066400000000000000000000745471222453003200250110ustar00rootroot00000000000000package org.basex.tests.w3c; import static org.basex.core.Prop.NL; import static org.basex.tests.w3c.QT3Constants.*; import static org.basex.util.Token.*; import java.io.*; import java.lang.reflect.*; import java.util.*; import java.util.regex.*; import javax.xml.namespace.*; import org.basex.core.*; import org.basex.io.*; import org.basex.io.out.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.func.*; import org.basex.query.util.Compare.Mode; import org.basex.query.value.item.*; import org.basex.query.value.type.*; import org.basex.tests.bxapi.*; import org.basex.tests.bxapi.xdm.*; import org.basex.util.*; /** * Driver for the XQuery/XPath/XSLT 3.* Test Suite, located at * {@code http://dev.w3.org/2011/QT3-test-suite/}. The driver needs to be * executed from the test suite directory. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class QT3TS { /** EQName pattern. */ private static final Pattern BIND = Pattern.compile("^Q\\{(.*?)\\}(.+)$"); /** Test suite id. */ private final String testid = "qt3ts"; /** Path to the test suite (ignored if {@code null}). */ private String basePath; /** Maximum length of result output. */ private int maxout = 2000; /** Correct results. */ private final TokenBuilder right = new TokenBuilder(); /** Wrong results. */ private final TokenBuilder wrong = new TokenBuilder(); /** Ignored tests. */ private final TokenBuilder ignore = new TokenBuilder(); /** Report builder. */ private QT3TSReport report; /** Number of total queries. */ private int total; /** Number of tested queries. */ private int tested; /** Number of correct queries. */ private int correct; /** Number of ignored queries. */ private int ignored; /** Current base uri. */ private String baseURI; /** Current base directory. */ private String baseDir; /** Slow queries flag. */ private TreeMap slow; /** Query filter string. */ private String single = ""; /** Verbose flag. */ private boolean verbose; /** Error code flag. */ private boolean errors = true; /** Also print ignored files. */ private boolean ignoring; /** All flag. */ private boolean all; /** Database context. */ protected final Context ctx = new Context(); /** Global environments. */ private final ArrayList genvs = new ArrayList(); /** * Main method of the test class. * @param args command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { try { new QT3TS().run(args); } catch(final IOException ex) { Util.errln(ex); System.exit(1); } } /** * Runs all tests. * @param args command-line arguments * @throws Exception exception */ private void run(final String[] args) throws Exception { ctx.mprop.set(MainProp.DBPATH, sandbox().path() + "/data"); parseArguments(args); init(); final Performance perf = new Performance(); ctx.prop.set(Prop.CHOP, false); ctx.prop.set(Prop.INTPARSE, false); ctx.prop.set(Prop.SERIALIZER, "omit-xml-declaration=no,indent=no"); final XdmValue doc = new XQuery("doc('" + file(false, CATALOG) + "')", ctx).value(); final String version = asString("*:catalog/@version", doc); Util.outln(NL + "QT3 Test Suite " + version); Util.outln("Test directory: " + new File(".").getCanonicalPath()); Util.out("Parsing queries"); for(final XdmItem ienv : new XQuery("*:catalog/*:environment", ctx).context(doc)) genvs.add(new QT3Env(ctx, ienv)); for(final XdmItem it : new XQuery("for $f in //*:test-set/@file return string($f)", ctx).context(doc)) testSet(it.getString()); final StringBuilder result = new StringBuilder(); result.append(" Rate : ").append(pc(correct, tested)).append(NL); result.append(" Total : ").append(total).append(NL); result.append(" Tested : ").append(tested).append(NL); result.append(" Wrong : ").append(tested - correct).append(NL); result.append(" Ignored : ").append(ignored).append(NL); // save log data Util.outln(NL + "Writing log file '" + testid + ".log'..."); final PrintOutput po = new PrintOutput(testid + ".log"); po.println("QT3TS RESULTS __________________________" + NL); po.println(result.toString()); po.println("WRONG __________________________________" + NL); po.print(wrong.finish()); if(all || !single.isEmpty()) { po.println("CORRECT ________________________________" + NL); po.print(right.finish()); } if(ignoring) { po.println("IGNORED ________________________________" + NL); po.print(ignore.finish()); } po.close(); // save report if(report != null) { final String file = "ReportingResults/results_" + Prop.NAME + "_" + Prop.VERSION + IO.XMLSUFFIX; new IOFile(file).write(report.create(ctx).toArray()); Util.outln("Creating report '" + file + "'..."); } Util.out(NL + result); Util.outln(" Time : " + perf); if(slow != null && !slow.isEmpty()) { Util.outln(NL + "Slow queries:"); for(final Map.Entry l : slow.entrySet()) { Util.outln("- " + -(l.getKey() / 1000000) + " ms: " + l.getValue()); } } ctx.close(); sandbox().delete(); } /** * Runs a single test set. * @param name name of test set * @throws Exception exception */ private void testSet(final String name) throws Exception { final XdmValue doc = new XQuery("doc(' " + file(false, name) + "')", ctx).value(); final XdmValue set = new XQuery("*:test-set", ctx).context(doc).value(); final IO base = IO.get(doc.getBaseURI()); baseURI = base.path(); baseDir = base.dirPath(); if(supported(set)) { // parse environment of test-set final ArrayList envs = new ArrayList(); for(final XdmItem ienv : new XQuery("*:environment", ctx).context(set)) envs.add(new QT3Env(ctx, ienv)); if(report != null) report.addSet(asString("@name", set)); // run all test cases for(final XdmItem its : new XQuery("*:test-case", ctx).context(set)) { try { testCase(its, envs); } catch(final IOException ex) { Util.debug(ex); } } } } /** * Runs a single test case. * @param test node * @param envs environments * @throws Exception exception */ private void testCase(final XdmItem test, final ArrayList envs) throws Exception { if(total++ % 500 == 0) Util.out("."); if(!supported(test)) { if(ignoring) ignore.add(asString("@name", test)).add(NL); ignored++; return; } // skip queries that do not match filter final String name = asString("@name", test); if(!name.startsWith(single)) { if(ignoring) ignore.add(name).add(NL); ignored++; return; } tested++; // expected result final XdmValue expected = new XQuery("*:result/*[1]", ctx).context(test).value(); // use XQuery 1.0 if XQ10 or XP20 is specified if(new XQuery("*:dependency[@type='spec'][matches(@value,'(XQ10)([^+]|$)')]", ctx). context(test).next() != null) ctx.prop.set(Prop.XQUERY3, false); // check if environment is defined in test-case QT3Env e = null; final XdmValue ienv = new XQuery("*:environment[*]", ctx).context(test).value(); if(ienv.size() != 0) e = new QT3Env(ctx, ienv); // parse local environment boolean base = true; if(e == null) { final String env = asString("*:environment/@ref", test); if(!env.isEmpty()) { // check if environment is defined in test-set e = envs(envs, env); // check if environment is defined in catalog if(e == null) { e = envs(genvs, env); base = false; } if(e == null) Util.errln("%: environment '%' not found.", name, env); } } // retrieve query to be run final Performance perf = new Performance(); final String qfile = asString("*:test/@file", test); String string; if(qfile.isEmpty()) { // get query string string = asString("*:test", test); } else { // get query from file string = string(new IOFile(baseDir, qfile).read()); } if(verbose) Util.outln(name); final XQuery query = new XQuery(string, ctx); if(base) query.baseURI(baseURI); // add modules final String qm = "for $m in *:module return ($m/@uri, $m/@file)"; final XQuery qmod = new XQuery(qm, ctx).context(test); while(true) { final XdmItem uri = qmod.next(); if(uri == null) break; final XdmItem file = qmod.next(); if(file == null) break; query.addModule(uri.getString(), baseDir + file.getString()); } final QT3Result result = new QT3Result(); try { if(e != null) { // bind namespaces for(final HashMap ns : e.namespaces) { query.namespace(ns.get(PREFIX), ns.get(URI)); } // bind variables for(final HashMap par : e.params) { query.bind(par.get(NNAME), new XQuery(par.get(SELECT), ctx).value()); } // bind documents for(final HashMap src : e.sources) { // add document reference final String file = file(base, src.get(FILE)); query.addDocument(src.get(URI), file); final String role = src.get(ROLE); if(role == null) continue; final Object call = Function.DOC.get(Str.get(file)); if(role.equals(".")) query.context(call); else query.bind(role, call); } // bind resources for(final HashMap src : e.resources) { query.addResource(src.get(URI), file(base, src.get(FILE)), src.get(ENCODING)); } // bind collections query.addCollection(e.collURI, e.collSources.toArray()); if(e.collContext) { query.context(Function.COLLECTION.get(Str.get(e.collURI))); } // bind context item if(e.context != null) { query.context(e.context); } // set base uri if(e.baseURI != null) query.baseURI(e.baseURI); // bind decimal formats for(final Map.Entry> df : e.decFormats.entrySet()) { query.decimalFormat(df.getKey(), df.getValue()); } } // run query result.value = query.value(); result.sprop = query.serializer(); } catch(final XQueryException ex) { result.err = ex; result.value = null; } catch(final Throwable ex) { // unexpected error (potential bug) result.error = ex; Util.errln("Query: " + name); ex.printStackTrace(); } if(slow != null) { final long l = perf.time(); if(l > 100000000) slow.put(-l, name); } // revert to XQuery as default ctx.prop.set(Prop.XQUERY3, true); final String exp = test(result, expected); final TokenBuilder tmp = new TokenBuilder(); tmp.add(name).add(NL); tmp.add(noComments(string)).add(NL); boolean err = result.value == null; String res; try { if(result.error != null) { res = result.error.toString(); } else if(result.err != null) { res = result.err.getCode() + ": " + result.err.getLocalizedMessage(); } else { result.sprop.set(SerializerProp.S_OMIT_XML_DECLARATION, "yes"); res = serialize(result.value, result.sprop); } } catch(final XQueryException ex) { res = ex.getCode() + ": " + ex.getLocalizedMessage(); err = true; } catch(final Throwable ex) { res = "Unexpected: " + ex.toString(); err = true; } tmp.add(err ? "Error : " : "Result: ").add(noComments(res)).add(NL); if(exp == null) { tmp.add(NL); right.add(tmp.finish()); correct++; } else { tmp.add("Expect: " + noComments(exp)).add(NL).add(NL); wrong.add(tmp.finish()); } if(report != null) report.addTest(name, exp == null); } /** * Removes comments from the specified string. * @param in input string * @return result */ private String noComments(final String in) { return QueryProcessor.removeComments(in, maxout); } /** Flags for dependencies that are not supported. */ private static final String NOSUPPORT = "('schema-location-hint','schemaAware','schemaImport'," + "'schemaValidation','staticTyping')"; /** * Checks if the current test case is supported. * @param test test case * @return result of check */ private boolean supported(final XdmValue test) { // the following query generates a result if the specified test is not supported return new XQuery( "*:environment/*:collation |" + // skip collation tests "*:dependency[" + // skip schema imports, schema validation, namespace axis, static typing "@type = 'feature' and (" + " @value = " + NOSUPPORT + " and (@satisfied = 'true' or empty(@satisfied)) or" + " @value != " + NOSUPPORT + "and @satisfied = 'false') or " + // skip fully-normalized unicode tests "@type = 'unicode-normalization-form' and @value = 'FULLY-NORMALIZED' or " + // skip xml/xsd 1.1 tests "@type = ('xml-version', 'xsd-version') and @value = ('1.1', '1.0:4-') or " + // skip non-XQuery tests "@type = 'spec' and not(contains(@value, 'XQ'))" + "]", ctx).context(test).value().size() == 0; } /** * Returns the specified environment, or {@code null}. * @param envs environments * @param ref reference * @return environment */ private static QT3Env envs(final ArrayList envs, final String ref) { for(final QT3Env e : envs) if(e.name.equals(ref)) return e; return null; } /** * Tests the result of a test case. * @param result resulting value * @param expected expected result * @return {@code null} if test was successful; otherwise, expected test suite result */ private String test(final QT3Result result, final XdmValue expected) { final String type = expected.getName().getLocalPart(); final XdmValue value = result.value; try { String msg; if(type.equals("error")) { msg = assertError(result, expected); } else if(type.equals("all-of")) { msg = allOf(result, expected); } else if(type.equals("any-of")) { msg = anyOf(result, expected); } else if(value != null) { if(type.equals("assert")) { msg = assertQuery(value, expected); } else if(type.equals("assert-count")) { msg = assertCount(value, expected); } else if(type.equals("assert-deep-eq")) { msg = assertDeepEq(value, expected); } else if(type.equals("assert-empty")) { msg = assertEmpty(value); } else if(type.equals("assert-eq")) { msg = assertEq(value, expected); } else if(type.equals("assert-false")) { msg = assertBoolean(value, false); } else if(type.equals("assert-permutation")) { msg = assertPermutation(value, expected); } else if(type.equals("assert-xml")) { msg = assertXML(value, expected); } else if(type.equals("serialization-matches")) { msg = serializationMatches(value, expected, result.sprop); } else if(type.equals("assert-serialization-error")) { msg = assertSerializationError(value, expected, result.sprop); } else if(type.equals("assert-string-value")) { msg = assertStringValue(value, expected); } else if(type.equals("assert-true")) { msg = assertBoolean(value, true); } else if(type.equals("assert-type")) { msg = assertType(value, expected); } else { msg = "Test type not supported: " + type; } } else { msg = expected.toString(); } return msg; } catch(final Exception ex) { ex.printStackTrace(); return "Exception: " + ex.getMessage(); } } /** * Tests error. * @param result query result * @param expect expected result * @return optional expected test suite result */ private String assertError(final QT3Result result, final XdmValue expect) { final String exp = asString('@' + CODE, expect); if(result.err == null) return exp; if(!errors || exp.equals("*")) return null; final QNm resErr = result.err.getException().qname(); String name = exp, uri = string(QueryText.ERRORURI); final Matcher m = BIND.matcher(exp); if(m.find()) { uri = m.group(1); name = m.group(2); } final QNm expErr = new QNm(name, uri); return expErr.eq(resErr) ? null : exp; } /** * Tests all-of. * @param res resulting value * @param exp expected result * @return optional expected test suite result */ private String allOf(final QT3Result res, final XdmValue exp) { final TokenBuilder tb = new TokenBuilder(); for(final XdmItem it : new XQuery("*", ctx).context(exp)) { final String msg = test(res, it); if(msg != null) tb.add(tb.isEmpty() ? "" : ", ").add(msg); } return tb.isEmpty() ? null : tb.toString(); } /** * Tests any-of. * @param res resulting value * @param exp expected result * @return optional expected test suite result */ private String anyOf(final QT3Result res, final XdmValue exp) { final TokenBuilder tb = new TokenBuilder(); for(final XdmItem it : new XQuery("*", ctx).context(exp)) { final String msg = test(res, it); if(msg == null) return null; tb.add(tb.isEmpty() ? "" : ", ").add(msg); } return "any of { " + tb + " }"; } /** * Tests assertion. * @param value resulting value * @param expect expected result * @return optional expected test suite result */ private String assertQuery(final XdmValue value, final XdmValue expect) { final String exp = expect.getString(); try { return new XQuery(exp, ctx).bind("result", value).value().getBoolean() ? null : exp; } catch(final XQueryException ex) { // should not occur return ex.getException().getMessage(); } } /** * Tests count. * @param value resulting value * @param expect expected result * @return optional expected test suite result */ private static String assertCount(final XdmValue value, final XdmValue expect) { final long exp = expect.getInteger(); final int res = value.size(); return exp == res ? null : Util.info("% items (% found)", exp, res); } /** * Tests equality. * @param value resulting value * @param expect expected result * @return optional expected test suite result */ private String assertEq(final XdmValue value, final XdmValue expect) { try { final XdmItem exp = new XQuery(expect.getString(), ctx).next(); final XdmItem res = value instanceof XdmItem ? (XdmItem) value : null; return exp.equal(res) ? null : exp.toString(); } catch(final XQueryException err) { // try simple string comparison return expect.getString().equals(value.getString()) ? null : err.getException().getMessage(); } } /** * Tests deep equals. * @param value resulting value * @param expect expected result * @return optional expected test suite result */ private String assertDeepEq(final XdmValue value, final XdmValue expect) { final XdmValue exp = new XQuery(expect.getString(), ctx).value(); return exp.deepEqual(value) ? null : exp.toString(); } /** * Tests permutation. * @param value resulting value * @param expect expected result * @return optional expected test suite result */ private String assertPermutation(final XdmValue value, final XdmValue expect) { // cache expected results final HashSet exp = new HashSet(); for(final XdmItem it : new XQuery(expect.getString(), ctx)) exp.add(it.getString()); // cache actual results final HashSet res = new HashSet(); for(final XdmItem it : value) res.add(it.getString()); if(exp.size() != res.size()) return Util.info("% results (found: %)", exp.size(), res.size()); for(final String s : exp.toArray(new String[exp.size()])) { if(!res.contains(s)) return Util.info("% (missing)", s); } for(final String s : res.toArray(new String[exp.size()])) { if(!exp.contains(s)) return Util.info("% (missing in expected result)", s); } return null; } /** * Tests the serialized result. * @param value resulting value * @param expect expected result * @return optional expected test suite result */ private String assertXML(final XdmValue value, final XdmValue expect) { final String file = asString("@file", expect); final boolean norm = asBoolean("@normalize-space=('true','1')", expect); final boolean pref = asBoolean("@ignore-prefixes=('true','1')", expect); String exp = expect.getString(); try { if(!file.isEmpty()) exp = string(new IOFile(baseDir, file).read()); exp = normNL(exp); if(norm) exp = string(norm(token(exp))); final String res = normNL(asString("serialize(., map{ 'indent':='no' })", value)); if(exp.equals(res)) return null; final String r = normNL(asString( "serialize(., map{ 'indent':='no', 'omit-xml-declaration':='no' })", value)); if(exp.equals(r)) return null; // include check for comments, processing instructions and namespaces String flags = "'" + Mode.ALLNODES + "'"; if(!pref) flags += ",'" + Mode.NAMESPACES + "'"; final String query = Function.DEEP_EQUAL_OPT.args("" + exp + "", "" + res + "" , "(" + flags + ")"); return asBoolean(query, expect) ? null : exp; } catch(final IOException ex) { return Util.info("% (found: %)", exp, ex); } } /** * Tests the serialized result. * @param value resulting value * @param expect expected result * @param sprop serialization properties * @return optional expected test suite result */ private String serializationMatches(final XdmValue value, final XdmValue expect, final SerializerProp sprop) { final String exp = expect.getString(); final String flags = asString("@flags", expect); final int flgs = flags.contains("i") ? Pattern.CASE_INSENSITIVE : 0; final Pattern pat = Pattern.compile("^.*" + exp + ".*", flgs | Pattern.MULTILINE | Pattern.DOTALL); try { return pat.matcher(".*" + serialize(value, sprop) + ".*").matches() ? null : exp; } catch(final IOException ex) { return Util.info("% (found: %)", exp, ex); } } /** * Tests a serialization error. * @param value resulting value * @param expect expected result * @param sprop serialization properties * @return optional expected test suite result */ private String assertSerializationError(final XdmValue value, final XdmValue expect, final SerializerProp sprop) { final String exp = asString('@' + CODE, expect); try { serialize(value, sprop); return exp; } catch(final SerializerException ex) { if(!errors || exp.equals("*")) return null; final QueryException qe = ex.getCause(); final String code = string(qe.qname().local()); if(code.equals(exp)) return null; return Util.info("% (found: %)", exp, ex); } catch(final IOException ex) { return Util.info("% (found: %)", exp, ex); } } /** * Serializes values. * @param value resulting value * @param sprop serialization properties * @return optional expected test suite result * @throws IOException I/O exception */ private String serialize(final XdmValue value, final SerializerProp sprop) throws IOException { final ArrayOutput ao = new ArrayOutput(); final Serializer ser = Serializer.get(ao, sprop); for(final Item it : value.internal()) ser.serialize(it); ser.close(); return ao.toString(); } /** * Tests string value. * @param value resulting value * @param expect expected result * @return optional expected test suite result */ private String assertStringValue(final XdmValue value, final XdmValue expect) { String exp = expect.getString(); // normalize space final boolean norm = asBoolean("@normalize-space=('true','1')", expect); if(norm) exp = string(norm(token(exp))); final TokenBuilder tb = new TokenBuilder(); int c = 0; for(final XdmItem it : value) { if(c != 0) tb.add(' '); tb.add(it.getString()); c++; } final String res = norm ? string(norm(tb.finish())) : tb.toString(); return exp.equals(res) ? null : exp; } /** * Tests boolean. * @param value resulting value * @param exp expected * @return optional expected test suite result */ private static String assertBoolean(final XdmValue value, final boolean exp) { return value.getType().eq(SeqType.BLN) && value.getBoolean() == exp ? null : Util.info(exp); } /** * Tests empty sequence. * @param value resulting value * @return optional expected test suite result */ private static String assertEmpty(final XdmValue value) { return value == XdmEmpty.EMPTY ? null : ""; } /** * Tests type. * @param value resulting value * @param expect expected result * @return optional expected test suite result */ private String assertType(final XdmValue value, final XdmValue expect) { final String exp = expect.getString(); try { final XQuery query = new XQuery("$result instance of " + exp, ctx); return query.bind("result", value).value().getBoolean() ? null : Util.info("Type '%' (found: '%')", exp, value.getType().toString()); } catch(final XQueryException ex) { // should not occur return ex.getException().getMessage(); } } /** * Returns the string representation of a query result. * @param query query string * @param value optional context value * @return optional expected test suite result */ String asString(final String query, final XdmValue value) { return XQuery.string(query, value, ctx); } /** * Returns the boolean representation of a query result. * @param query query string * @param value optional context value * @return optional expected test suite result */ boolean asBoolean(final String query, final XdmValue value) { final XdmValue val = new XQuery(query, ctx).context(value).value(); return val.size() != 0 && val.getBoolean(); } /** * Returns the path to a given file. * @param base base flag. * @param file file name * @return path to the file */ private String file(final boolean base, final String file) { final String dir = base ? baseDir : basePath; return dir == null ? file : new File(dir, file).getAbsolutePath(); } /** * Calculates the percentage of correct queries. * @param v value * @param t total value * @return percentage */ private static String pc(final int v, final long t) { return (t == 0 ? 100 : v * 10000 / t / 100d) + "%"; } /** * Normalizes newline characters. * @param in input string * @return result */ private static String normNL(final String in) { return in.replaceAll("\r\n|\r|\n", NL); } /** * Parses the command-line arguments, specified by the user. * @param args command-line arguments * @throws IOException I/O exception */ private void parseArguments(final String[] args) throws IOException { final Args arg = new Args(args, this, " -v [pat]" + NL + " [pat] perform tests starting with a pattern" + NL + " -a save all tests" + NL + " -d debugging mode" + NL + " -e ignore error codes" + NL + " -i also save ignored files" + NL + " -p path to the test suite" + NL + " -r generate report file" + NL + " -s print slow queries" + NL + " -v verbose output", Util.info(Text.CONSOLE, Util.name(this))); while(arg.more()) { if(arg.dash()) { final char c = arg.next(); if(c == 'v') { verbose = true; } else if(c == 'a') { all = true; } else if(c == 'd') { ctx.mprop.set(MainProp.DEBUG, true); } else if(c == 'i') { ignoring = true; } else if(c == 'e') { errors = false; } else if(c == 'r') { report = new QT3TSReport(); } else if(c == 's') { slow = new TreeMap(); } else if(c == 'p') { final File f = new File(arg.string()); if(!f.isDirectory()) arg.usage(); basePath = f.getCanonicalPath(); } else { arg.usage(); } } else { single = arg.string(); maxout = Integer.MAX_VALUE; } } } /** * Adds an environment variable required for function tests. Reference: *http://stackoverflow.com/questions/318239/how-do-i-set-environment-variables-from-java */ @SuppressWarnings("unchecked") private static void init() { final Map ne = new HashMap(); ne.put("QTTEST", "42"); ne.put("QTTEST2", "other"); ne.put("QTTESTEMPTY", ""); try { final Class pe = Class.forName("java.lang.ProcessEnvironment"); final Field f = pe.getDeclaredField("theEnvironment"); f.setAccessible(true); ((Map) f.get(null)).putAll(ne); final Field f2 = pe.getDeclaredField("theCaseInsensitiveEnvironment"); f2.setAccessible(true); ((Map) f2.get(null)).putAll(ne); } catch(final NoSuchFieldException ex) { try { for(final Class cl : Collections.class.getDeclaredClasses()) { if("java.util.Collections$UnmodifiableMap".equals(cl.getName())) { final Field f = cl.getDeclaredField("m"); f.setAccessible(true); ((Map) f.get(System.getenv())).putAll(ne); } } } catch(final Exception e2) { Util.errln("Test environment variable could not be set:" + e2); } } catch(final Exception e1) { Util.errln("Test environment variable could not be set: " + e1); } } /** * Structure for storing XQuery results. */ static class QT3Result { /** Serialization parameters. */ SerializerProp sprop; /** Query result. */ XdmValue value; /** Query exception. */ XQueryException err; /** Query error. */ Throwable error; } /** * Returns the sandbox database path. * @return database path */ private IOFile sandbox() { return new IOFile(Prop.TMP, testid); } } basex-7.7.2/basex-tests/src/main/java/org/basex/tests/w3c/QT3TSReport.java000066400000000000000000000115371222453003200261730ustar00rootroot00000000000000package org.basex.tests.w3c; import java.util.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.io.out.*; import org.basex.query.value.node.*; /** * QT3TS Report builder. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class QT3TSReport { /** Dependencies. */ private static final String[][] DEPENDENCIES = { { "calendar", "CB", "true" }, { "default-language", "en", "true" }, { "feature", "collection-stability", "true" }, { "feature", "directory-as-collection-uri", "true" }, { "feature", "higherOrderFunctions", "true" }, { "feature", "moduleImport", "true" }, { "feature", "namespace-axis", "true" }, { "feature", "schemaAware", "false" }, { "feature", "schemaImport", "false" }, { "feature", "schema-location-hint", "false" }, { "feature", "schemaValidation", "false" }, { "feature", "staticTyping", "false" }, { "feature", "xpath-1.0-compatibility", "true" }, { "format-integer-sequence", "\u03B1", "true" }, { "format-integer-sequence", "\u0661", "true" }, { "format-integer-sequence", "\u2460", "true" }, { "format-integer-sequence", "\u2474", "true" }, { "format-integer-sequence", "\u2488", "true" }, { "format-integer-sequence", "\u4E00", "true" }, { "format-integer-sequence", "\uFBF4", "true" }, { "format-integer-sequence", "Α", "true" }, { "language", "de", "true" }, { "language", "xib", "true" }, { "limits", "year_lt_0", "true" }, { "unicode-normalization-form", "FULLY-NORMALIZED", "false" }, { "unicode-normalization-form", "NFD", "true" }, { "unicode-normalization-form", "NFKC", "true" }, { "unicode-normalization-form", "NFKD", "true" }, { "xml-version", "1.0", "true" }, { "xml-version", "1.0:4-", "false" }, { "xml-version", "1.0:5+ 1.1", "true" }, { "xml-version", "1.1", "false" } }; /** URI of test suite. */ private static final String URI = "http://www.w3.org/2012/08/qt-fots-results"; /** List of test sets and test cases (test sets only consist of a name; test cases * consist of a name and a result (pass/fail). */ private final ArrayList tests = new ArrayList(); /** * Adds the name of a test set. * @param name name of test set */ public void addSet(final String name) { tests.add(new String[] { name }); } /** * Adds the name and result of a test case. * @param name name of test case * @param ok success flag */ public void addTest(final String name, final boolean ok) { tests.add(new String[] { name, ok ? "pass" : "fail" }); } /** * Creates a report. * @param ctx database context * @return report stream * @throws Exception exception */ public ArrayOutput create(final Context ctx) throws Exception { final String dquery = "replace(string(current-date()),'\\+.*','')"; final String date = new XQuery(dquery).execute(ctx); final FElem root = element("test-suite-result"); // submission element final FElem submission = element("submission", root); submission.add("anonymous", "false"); final FElem created = element("created", submission); created.add("by", Prop.AUTHOR); created.add("email", "cg@basex.org"); created.add("organization", Prop.ENTITY); created.add("on", date); final FElem testRun = element("test-run", submission); testRun.add("test-suite-version", "CVS"); testRun.add("date-run", date); element("notes", submission); // product element final FElem product = element("product", root); product.add("vendor", Prop.ENTITY); product.add("name", Prop.NAME); product.add("version", Prop.VERSION); product.add("released", "true"); product.add("open-source", "true"); product.add("language", "XQ30"); // dependency element for(final String[] deps : DEPENDENCIES) { final FElem dependency = element("dependency", product); dependency.add("type", deps[0]); dependency.add("value", deps[1]); dependency.add("satisfied", deps[2]); } // test-set elements FElem ts = null; for(final String[] test : tests) { if(test.length == 1) { ts = element("test-set", root); ts.add("name", test[0]); } else { final FElem tc = element("test-case", ts); tc.add("name", test[0]); tc.add("result", test[1]); } } return root.serialize(); } /** * Creates a root element. * @param name name of element * @return element node */ private FElem element(final String name) { return new FElem(name, URI).declareNS(); } /** * Creates an element. * @param name name of element * @param parent parent node * @return element node */ private FElem element(final String name, final FElem parent) { final FElem elem = new FElem(name, URI); parent.add(elem); return elem; } } basex-7.7.2/basex-tests/src/main/java/org/basex/tests/w3c/W3CTS.java000066400000000000000000000625121222453003200247630ustar00rootroot00000000000000package org.basex.tests.w3c; import static org.basex.core.Text.*; import static org.basex.util.Token.*; import java.io.*; import java.util.*; import java.util.regex.*; import org.basex.core.*; import org.basex.core.Context; import org.basex.core.cmd.*; import org.basex.data.*; import org.basex.io.*; import org.basex.io.out.*; import org.basex.io.serial.*; import org.basex.query.*; import org.basex.query.expr.*; import org.basex.query.func.*; import org.basex.query.iter.*; import org.basex.query.util.*; import org.basex.query.value.*; import org.basex.query.value.item.*; import org.basex.query.value.seq.*; import org.basex.util.*; import org.basex.util.list.*; /** * XQuery Test Suite wrapper. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public abstract class W3CTS { // Try "ulimit -n 65536" if Linux tells you "Too many open files." /** Inspect flag. */ private static final byte[] INSPECT = token("Inspect"); /** Fragment flag. */ private static final byte[] FRAGMENT = token("Fragment"); /** XML flag. */ private static final byte[] XML = token("XML"); /** XML flag. */ private static final byte[] IGNORE = token("Ignore"); /** Replacement pattern. */ private static final Pattern SLASH = Pattern.compile("/", Pattern.LITERAL); /** Database context. */ protected final Context context = new Context(); /** Path to the XQuery Test Suite. */ protected String path = ""; /** Data reference. */ protected Data data; /** Log file. */ private final String pathlog; /** Test suite input. */ private final String input; /** Test suite id. */ private final String testid; /** Query path. */ private String queries; /** Expected results. */ private String expected; /** Reported results. */ private String results; /** Maximum length of result output. */ private int maxout = 500; /** Query filter string. */ private String single; /** Flag for printing current time functions into log file. */ private boolean currTime; /** Flag for creating report files. */ private boolean reporting; /** Verbose flag. */ private boolean verbose; /** Minimum time in ms to include query in performance statistics. */ private int timer = Integer.MAX_VALUE; /** Minimum conformance. */ private boolean minimum; /** Print compilation steps. */ private boolean compile; /** test-group to use. */ private String group; /** Cached source files. */ private final HashMap srcs = new HashMap(); /** Cached module files. */ private final HashMap mods = new HashMap(); /** Cached collections. */ private final HashMap colls = new HashMap(); /** OK log. */ private final StringBuilder logOK = new StringBuilder(); /** OK log. */ private final StringBuilder logOK2 = new StringBuilder(); /** Error log. */ private final StringBuilder logErr = new StringBuilder(); /** Error log. */ private final StringBuilder logErr2 = new StringBuilder(); /** File log. */ private final StringBuilder logReport = new StringBuilder(); /** Error counter. */ private int err; /** Error2 counter. */ private int err2; /** OK counter. */ private int ok; /** OK2 counter. */ private int ok2; /** * Constructor. * @param nm name of test */ protected W3CTS(final String nm) { input = nm + "Catalog" + IO.XMLSUFFIX; testid = nm.substring(0, 4); pathlog = testid.toLowerCase(Locale.ENGLISH) + ".log"; context.mprop.set(MainProp.DBPATH, sandbox().path() + "/data"); } /** * Runs the test suite. * @param args command-line arguments * @throws QueryException query exception * @throws IOException I/O exception */ void run(final String[] args) throws QueryException, IOException { try { parseArguments(args); } catch(final IOException ex) { Util.errln(ex); System.exit(1); } queries = path + "Queries/XQuery/"; expected = path + "ExpectedTestResults/"; results = path + "ReportingResults/Results/"; /* Reports. */ final String report = path + "ReportingResults/"; /* Test sources. */ final String sources = path + "TestSources/"; final Performance perf = new Performance(); context.prop.set(Prop.CHOP, false); //new Check(path + input).execute(context); data = CreateDB.mainMem(new IOFile(path + input), context); final Nodes root = new Nodes(0, data); Util.outln(NL + Util.name(this) + " Test Suite " + text("/*:test-suite/@version", root)); Util.outln("Caching Sources..."); for(final int s : nodes("//*:source", root).pres) { final Nodes srcRoot = new Nodes(s, data); final String val = (path + text("@FileName", srcRoot)).replace('\\', '/'); srcs.put(text("@ID", srcRoot), val); } Util.outln("Caching Modules..."); for(final int s : nodes("//*:module", root).pres) { final Nodes srcRoot = new Nodes(s, data); final String val = (path + text("@FileName", srcRoot)).replace('\\', '/'); mods.put(text("@ID", srcRoot), val); } Util.outln("Caching Collections..."); for(final int c : nodes("//*:collection", root).pres) { final Nodes nodes = new Nodes(c, data); final String cname = text("@ID", nodes); final StringList dl = new StringList(); final Nodes doc = nodes("*:input-document", nodes); for(int d = 0; d < doc.size(); ++d) { dl.add(sources + string(data.atom(doc.pres[d])) + IO.XMLSUFFIX); } colls.put(cname, dl.toArray()); } init(root); if(reporting) { Util.outln("Delete old results..."); new IOFile(results).delete(); } if(verbose) Util.outln(); final Nodes nodes = minimum ? nodes("//*:test-group[starts-with(@name, 'Minim')]//*:test-case", root) : group != null ? nodes("//*:test-group[@name eq '" + group + "']//*:test-case", root) : nodes("//*:test-case", root); long total = nodes.size(); Util.out("Parsing " + total + " Queries"); for(int t = 0; t < total; ++t) { if(!parse(new Nodes(nodes.pres[t], data))) break; if(!verbose && t % 500 == 0) Util.out("."); } Util.outln(); total = ok + ok2 + err + err2; final String time = perf.getTime(); Util.outln("Writing log file..." + NL); PrintOutput po = new PrintOutput(path + pathlog); po.println("TEST RESULTS ________________________________________________"); po.println(NL + "Total #Queries: " + total); po.println("Correct / Empty Results: " + ok + " / " + ok2); po.print("Conformance (w/Empty Results): "); po.println(pc(ok, total) + " / " + pc(ok + ok2, total)); po.println("Wrong Results / Errors: " + err + " / " + err2 + NL); po.println("WRONG _______________________________________________________"); po.print(NL + logErr); po.println("WRONG (ERRORS) ______________________________________________"); po.print(NL + logErr2); po.println("CORRECT? (EMPTY) ____________________________________________"); po.print(NL + logOK2); po.println("CORRECT _____________________________________________________"); po.print(NL + logOK); po.println("_____________________________________________________________"); po.close(); if(reporting) { po = new PrintOutput(report + Prop.NAME + IO.XMLSUFFIX); print(po, report + Prop.NAME + "Pre" + IO.XMLSUFFIX); po.print(logReport.toString()); print(po, report + Prop.NAME + "Pos" + IO.XMLSUFFIX); po.close(); } Util.outln("Total #Queries: " + total); Util.outln("Correct / Empty results: " + ok + " / " + ok2); Util.out("Conformance (w/empty results): "); Util.outln(pc(ok, total) + " / " + pc(ok + ok2, total)); Util.outln("Total Time: " + time); context.close(); sandbox().delete(); } /** * Calculates the percentage of correct queries. * @param v value * @param t total value * @return percentage */ private static String pc(final int v, final long t) { return (t == 0 ? 100 : v * 10000 / t / 100d) + "%"; } /** * Parses the specified test case. * @param root root node * @throws QueryException query exception * @throws IOException I/O exception * @return true if the query, specified by {@link #single}, was evaluated */ private boolean parse(final Nodes root) throws QueryException, IOException { final String pth = text("@FilePath", root); final String outname = text("@name", root); if(single != null && !outname.startsWith(single)) return true; final Performance perf = new Performance(); if(verbose) Util.out("- " + outname); boolean inspect = false; boolean correct = true; final Nodes nodes = states(root); for(int n = 0; n < nodes.size(); ++n) { final Nodes state = new Nodes(nodes.pres[n], nodes.data); final String inname = text("*:query/@name", state); final IOFile query = new IOFile(queries + pth + inname + IO.XQSUFFIX); context.prop.set(Prop.QUERYPATH, query.path()); final String in = read(query); String er = null; ValueBuilder iter = null; final Nodes cont = nodes("*:contextItem", state); Nodes curr = null; if(cont.size() != 0) { final String p = srcs.get(string(data.atom(cont.pres[0]))); final Data d = CreateDB.mainMem(IO.get(p), context); curr = new Nodes(d.resources.docs().toArray(), d); curr.root = true; } context.prop.set(Prop.QUERYINFO, compile); final QueryProcessor xq = new QueryProcessor(in, context).context(curr); context.prop.set(Prop.QUERYINFO, false); final ArrayOutput ao = new ArrayOutput(); final TokenBuilder files = new TokenBuilder(); try { files.add(file(nodes("*:input-file", state), nodes("*:input-file/@variable", state), xq, n == 0)); files.add(file(nodes("*:defaultCollection", state), null, xq, n == 0)); var(nodes("*:input-URI", state), nodes("*:input-URI/@variable", state), xq); eval(nodes("*:input-query/@name", state), nodes("*:input-query/@variable", state), pth, xq); parse(xq, state); for(final int p : nodes("*:module", root).pres) { final String uri = text("@namespace", new Nodes(p, data)); final String file = IO.get(mods.get(string(data.atom(p))) + IO.XQSUFFIX).path(); xq.module(uri, file); } // evaluate query iter = xq.value().cache(); // serialize query final SerializerProp sp = new SerializerProp(); sp.set(SerializerProp.S_INDENT, NO); final Serializer ser = Serializer.get(ao, sp); for(Item it; (it = iter.next()) != null;) ser.serialize(it); ser.close(); } catch(final Exception ex) { if(!(ex instanceof QueryException || ex instanceof IOException)) { Util.errln("\n*** " + outname + " ***"); Util.errln(in + '\n'); Util.stack(ex); } er = ex.getMessage(); if(er.startsWith(STOPPED_AT)) er = er.substring(er.indexOf('\n') + 1); if(!er.isEmpty() && er.charAt(0) == '[') er = er.replaceAll("\\[(.*?)\\] (.*)", "$1 $2"); // unexpected error - dump stack trace } // print compilation steps if(compile) { Util.errln("---------------------------------------------------------"); Util.err(xq.info()); Util.errln(in); } final Nodes expOut = nodes("*:output-file/text()", state); final TokenList result = new TokenList(); for(int o = 0; o < expOut.size(); ++o) { final String resFile = string(data.atom(expOut.pres[o])); final IOFile exp = new IOFile(expected + pth + resFile); result.add(read(exp).replaceAll("\r\n|\r|\n", Prop.NL)); } final Nodes cmpFiles = nodes("*:output-file/@compare", state); boolean xml = false; boolean frag = false; boolean ignore = false; for(int o = 0; o < cmpFiles.size(); ++o) { final byte[] type = data.atom(cmpFiles.pres[o]); xml |= eq(type, XML); frag |= eq(type, FRAGMENT); ignore |= eq(type, IGNORE); } String expError = text("*:expected-error/text()", state); final StringBuilder log = new StringBuilder(pth + inname + IO.XQSUFFIX); if(!files.isEmpty()) log.append(" [").append(files).append(']'); log.append(NL); /** Remove comments. */ log.append(norm(in)).append(NL); final String logStr = log.toString(); // skip queries with variable results final boolean print = currTime || !logStr.contains("current-"); boolean correctError = false; if(er != null && (expOut.size() == 0 || !expError.isEmpty())) { expError = error(pth + outname, expError); final String code = er.substring(0, Math.min(8, er.length())); for(final String e : SLASH.split(expError)) { if(code.equals(e)) { correctError = true; break; } } } if(correctError) { if(print) { logOK.append(logStr); logOK.append("[Right] "); logOK.append(norm(er)); logOK.append(NL); logOK.append(NL); addLog(pth, outname + ".log", er); } ++ok; } else if(er == null) { int s = -1; final int rs = result.size(); while(!ignore && ++s < rs) { inspect |= s < cmpFiles.pres.length && eq(data.atom(cmpFiles.pres[s]), INSPECT); final String expect = string(result.get(s)); final String actual = ao.toString(); if(expect.equals(actual)) break; if(xml || frag) { iter.reset(); try { final ValueIter vb = toIter(expect.replaceAll( "^<\\?xml.*?\\?>", "").trim(), frag); if(Compare.deep(iter, vb, (InputInfo) null)) break; vb.reset(); final ValueIter ia = toIter(actual, frag); if(Compare.deep(ia, vb, (InputInfo) null)) break; } catch(final Throwable ex) { Util.errln('\n' + outname + ':'); Util.stack(ex); } } } if((rs > 0 || !expError.isEmpty()) && s == rs && !inspect) { if(print) { if(expOut.size() == 0) result.add(error(pth + outname, expError)); logErr.append(logStr); logErr.append('[' + testid + " ] "); logErr.append(norm(string(result.get(0)))); logErr.append(NL); logErr.append("[Wrong] "); logErr.append(norm(ao.toString())); logErr.append(NL); logErr.append(NL); addLog(pth, outname + (xml ? IO.XMLSUFFIX : ".txt"), ao.toString()); } correct = false; ++err; } else { if(print) { logOK.append(logStr); logOK.append("[Right] "); logOK.append(norm(ao.toString())); logOK.append(NL); logOK.append(NL); addLog(pth, outname + (xml ? IO.XMLSUFFIX : ".txt"), ao.toString()); } ++ok; } } else { if(expOut.size() == 0 || !expError.isEmpty()) { if(print) { logOK2.append(logStr); logOK2.append('[' + testid + " ] "); logOK2.append(norm(expError)); logOK2.append(NL); logOK2.append("[Rght?] "); logOK2.append(norm(er)); logOK2.append(NL); logOK2.append(NL); addLog(pth, outname + ".log", er); } ++ok2; } else { if(print) { logErr2.append(logStr); logErr2.append('[' + testid + " ] "); logErr2.append(norm(string(result.get(0)))); logErr2.append(NL); logErr2.append("[Wrong] "); logErr2.append(norm(er)); logErr2.append(NL); logErr2.append(NL); addLog(pth, outname + ".log", er); } correct = false; ++err2; } } if(curr != null) Close.close(curr.data, context); xq.close(); } if(reporting) { logReport.append(" "); logReport.append(NL); } // print verbose/timing information final long nano = perf.time(); final boolean slow = nano / 1000000 > timer; if(verbose) { if(slow) Util.out(": " + Performance.getTime(nano, 1)); Util.outln(); } else if(slow) { Util.out(NL + "- " + outname + ": " + Performance.getTime(nano, 1)); } return single == null || !outname.equals(single); } /** * Creates an item iterator for the given XML fragment. * @param xml fragment * @param frag fragment flag * @return iterator */ private ValueIter toIter(final String xml, final boolean frag) { try { final String str = frag ? "" + xml + "" : xml; final Data d = CreateDB.mainMem(IO.get(str), context); final IntList il = new IntList(); for(int p = frag ? 2 : 0; p < d.meta.size; p += d.size(p, d.kind(p))) { il.add(p); } return DBNodeSeq.get(il, d, false, false).iter(); } catch(final IOException ex) { return Str.get(Long.toString(System.nanoTime())).iter(); } } /** * Removes comments from the specified string. * @param in input string * @return result */ private String norm(final String in) { return QueryProcessor.removeComments(in, maxout); } /** * Initializes the input files, specified by the context nodes. * @param nod variables * @param var documents * @param qp query processor * @param first call * @return string with input files * @throws QueryException query exception * @throws BaseXException database exception */ private byte[] file(final Nodes nod, final Nodes var, final QueryProcessor qp, final boolean first) throws QueryException, BaseXException { final TokenBuilder tb = new TokenBuilder(); for(int c = 0; c < nod.size(); ++c) { final byte[] nm = data.atom(nod.pres[c]); String src = srcs.get(string(nm)); if(!tb.isEmpty()) tb.add(", "); tb.add(nm); Expr expr = null; if(src == null) { // assign collection expr = coll(nm, qp); } else { // assign document final String dbname = new IOFile(src).dbname(); Function def = Function.DOC; // updates: drop updated document or open updated database if(updating()) { if(first) { new DropDB(dbname).execute(context); } else { def = Function._DB_OPEN; src = dbname; } } expr = def.get(Str.get(src)); } if(var != null) qp.bind(string(data.atom(var.pres[c])), expr); } return tb.finish(); } /** * Assigns the nodes to the specified variables. * @param nod nodes * @param var variables * @param qp query processor * @throws QueryException query exception */ private void var(final Nodes nod, final Nodes var, final QueryProcessor qp) throws QueryException { for(int c = 0; c < nod.size(); ++c) { final byte[] nm = data.atom(nod.pres[c]); final String src = srcs.get(string(nm)); final Item it = src == null ? coll(nm, qp) : Str.get(src); qp.bind(string(data.atom(var.pres[c])), it); } } /** * Assigns a collection. * @param name collection name * @param qp query processor * @return expression * @throws QueryException query exception */ private Uri coll(final byte[] name, final QueryProcessor qp) throws QueryException { qp.ctx.resource.addCollection(string(name), colls.get(string(name))); return Uri.uri(name); } /** * Evaluates the the input files and assigns the result to the specified * variables. * @param nod variables * @param var documents * @param pth file path * @param qp query processor * @throws QueryException query exception */ private void eval(final Nodes nod, final Nodes var, final String pth, final QueryProcessor qp) throws QueryException { for(int c = 0; c < nod.size(); ++c) { final String file = pth + string(data.atom(nod.pres[c])) + IO.XQSUFFIX; final String in = read(new IOFile(queries + file)); final QueryProcessor xq = new QueryProcessor(in, context); final Value val = xq.value(); qp.bind(string(data.atom(var.pres[c])), val); xq.close(); } } /** * Adds a log file. * @param pth file path * @param nm file name * @param msg message * @throws IOException I/O exception */ private void addLog(final String pth, final String nm, final String msg) throws IOException { if(reporting) { final File file = new File(results + pth); if(!file.exists()) file.mkdirs(); final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(results + pth + nm), UTF8)); bw.write(msg); bw.close(); } } /** * Returns an error message. * @param nm test name * @param error XQTS error * @return error message */ private String error(final String nm, final String error) { final String error2 = expected + nm + ".log"; final IO file = new IOFile(error2); return file.exists() ? error + '/' + read(file) : error; } /** * Returns the resulting query text (text node or attribute value). * @param qu query * @param root root node * @return attribute value * @throws QueryException query exception */ protected String text(final String qu, final Nodes root) throws QueryException { final Nodes n = nodes(qu, root); final TokenBuilder tb = new TokenBuilder(); for(int i = 0; i < n.size(); ++i) { if(i != 0) tb.add('/'); tb.add(data.atom(n.pres[i])); } return tb.toString(); } /** * Returns the resulting query nodes. * @param qu query * @param root root node * @return attribute value * @throws QueryException query exception */ protected Nodes nodes(final String qu, final Nodes root) throws QueryException { return new QueryProcessor(qu, context).context(root).queryNodes(); } /** * Adds the specified file to the writer. * @param po writer * @param f file path * @throws IOException I/O exception */ private static void print(final PrintOutput po, final String f) throws IOException { final BufferedReader br = new BufferedReader(new FileReader(f)); for(String line; (line = br.readLine()) != null;) po.println(line); br.close(); } /** * Returns the contents of the specified file. * @param fl file to be read * @return content */ private static String read(final IO fl) { try { return fl.string(); } catch(final IOException ex) { Util.errln(ex); return ""; } } /** * Initializes the test. * @param root root nodes reference * @throws QueryException query exception */ @SuppressWarnings("unused") protected void init(final Nodes root) throws QueryException { } /** * Performs test specific parsings. * @param qp query processor * @param root root nodes reference * @throws QueryException query exception */ @SuppressWarnings("unused") protected void parse(final QueryProcessor qp, final Nodes root) throws QueryException { } /** * Returns all query states. * @param root root node * @return states * @throws QueryException query exception */ @SuppressWarnings("unused") protected Nodes states(final Nodes root) throws QueryException { return root; } /** * Updating flag. * @return flag */ protected boolean updating() { return false; } /** * Parses the command-line arguments, specified by the user. * @param args command-line arguments * @throws IOException I/O exception */ protected final void parseArguments(final String[] args) throws IOException { final Args arg = new Args(args, this, " [options] [pat]" + NL + " [pat] perform tests starting with a pattern" + NL + " -c print compilation steps" + NL + " -C run tests depending on current time" + NL + " -g test group to test" + NL + " -h show this help" + NL + " -m minimum conformance" + NL + " -p change path" + NL + " -r create report" + NL + " -t[ms] list slowest queries" + NL + " -v verbose output", Util.info(CONSOLE, Util.name(this))); while(arg.more()) { if(arg.dash()) { final char c = arg.next(); if(c == 'r') { reporting = true; currTime = true; } else if(c == 'C') { currTime = true; } else if(c == 'c') { compile = true; } else if(c == 'm') { minimum = true; } else if(c == 'g') { group = arg.string(); } else if(c == 'p') { path = arg.string() + '/'; } else if(c == 't') { timer = arg.number(); } else if(c == 'v') { verbose = true; } else { arg.usage(); } } else { single = arg.string(); maxout = Integer.MAX_VALUE; } } } /** * Returns the sandbox database path. * @return database path */ private IOFile sandbox() { return new IOFile(Prop.TMP, testid); } } basex-7.7.2/basex-tests/src/main/java/org/basex/tests/w3c/XQFTTS.java000066400000000000000000000066371222453003200251570ustar00rootroot00000000000000package org.basex.tests.w3c; import java.util.*; import org.basex.data.*; import org.basex.io.*; import org.basex.query.*; import org.basex.query.ft.*; import org.basex.util.*; import org.basex.util.ft.*; /** * XQuery Full Text Test Suite wrapper. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class XQFTTS extends W3CTS { /** Cached stop word files. */ private final HashMap stop = new HashMap(); /** Cached stop word files. */ private final HashMap stop2 = new HashMap(); /** Cached stemming dictionaries. */ private final HashMap stem = new HashMap(); /** Cached thesaurus. */ private final HashMap thes = new HashMap(); /** Cached thesaurus. */ private final HashMap thes2 = new HashMap(); /** * Main method of the test class. * @param args command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { new XQFTTS().run(args); } /** * Constructor. */ public XQFTTS() { super(Util.name(XQFTTS.class)); //context.prop.set(Prop.FTINDEX, true); //context.prop.set(Prop.FORCECREATE, true); } @Override protected void init(final Nodes root) throws QueryException { Util.outln("Caching Full-text Structures..."); for(final int s : nodes("//*:stopwords", root).pres) { final Nodes srcRoot = new Nodes(s, data); final String val = (path + text("@FileName", srcRoot)).replace('\\', '/'); stop.put(text("@uri", srcRoot), IO.get(val)); stop2.put(text("@ID", srcRoot), IO.get(val)); } for(final int s : nodes("//*:stemming-dictionary", root).pres) { final Nodes srcRoot = new Nodes(s, data); final String val = (path + text("@FileName", srcRoot)).replace('\\', '/'); stem.put(text("@ID", srcRoot), IO.get(val)); } for(final int s : nodes("//*:thesaurus", root).pres) { final Nodes srcRoot = new Nodes(s, data); final String val = (path + text("@FileName", srcRoot)).replace('\\', '/'); thes.put(text("@uri", srcRoot), IO.get(val)); thes2.put(text("@ID", srcRoot), IO.get(val)); } } @Override protected void parse(final QueryProcessor qp, final Nodes root) throws QueryException { final QueryContext ctx = qp.ctx; ctx.stop = stop; ctx.thes = thes; final FTOpt opt = ctx.ftOpt(); for(final String s : aux("stopwords", root)) { final IO fn = stop2.get(s); if(fn != null) { if(opt.sw == null) opt.sw = new StopWords(); opt.sw.read(fn, false); } } for(final String s : aux("stemming-dictionary", root)) { final IO fn = stem.get(s); if(fn != null) { if(opt.sd == null) opt.sd = new StemDir(); opt.sd.read(fn); } } for(final String s : aux("thesaurus", root)) { final IO fn = thes2.get(s); if(fn != null) { if(opt.th == null) opt.th = new ThesQuery(); opt.th.add(new Thesaurus(fn, context)); } } } /** * Returns the resulting auxiliary uri in multiple strings. * @param role role * @param root root node * @return attribute value * @throws QueryException query exception */ private String[] aux(final String role, final Nodes root) throws QueryException { return text("*:aux-URI[@role = '" + role + "']", root).split("/"); } } basex-7.7.2/basex-tests/src/main/java/org/basex/tests/w3c/XQTS.java000066400000000000000000000011421222453003200247070ustar00rootroot00000000000000package org.basex.tests.w3c; import org.basex.core.*; import org.basex.util.*; /** * XQuery Test Suite wrapper. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class XQTS extends W3CTS { /** * Main method of the test class. * @param args command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { new XQTS().run(args); } /** * Constructor. */ public XQTS() { super(Util.name(XQTS.class)); context.prop.set(Prop.XQUERY3, false); } } basex-7.7.2/basex-tests/src/main/java/org/basex/tests/w3c/XQUTS.java000066400000000000000000000015511222453003200250400ustar00rootroot00000000000000package org.basex.tests.w3c; import org.basex.core.*; import org.basex.data.*; import org.basex.query.*; import org.basex.util.*; /** * XQuery Update Test Suite wrapper. * * @author BaseX Team 2005-13, BSD License * @author Christian Gruen */ public final class XQUTS extends W3CTS { /** * Main method of the test class. * @param args command-line arguments * @throws Exception exception */ public static void main(final String[] args) throws Exception { new XQUTS().run(args); } /** * Constructor. */ public XQUTS() { super(Util.name(XQUTS.class)); context.prop.set(Prop.FORCECREATE, true); } @Override protected Nodes states(final Nodes root) throws QueryException { return nodes("*:state", root); } @Override protected boolean updating() { return true; } } basex-7.7.2/basex-tests/src/main/java/org/basex/tests/w3c/package.html000066400000000000000000000001041222453003200255230ustar00rootroot00000000000000 Contains classes for running the W3C test suites. basex-7.7.2/basex-tests/src/main/resources/000077500000000000000000000000001222453003200206115ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/main/resources/.empty000066400000000000000000000000001222453003200217360ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/main/resources/.gitignore000066400000000000000000000000001222453003200225670ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/main/xquery/000077500000000000000000000000001222453003200201345ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/main/xquery/qt3ts.xq000066400000000000000000000025451222453003200215720ustar00rootroot00000000000000import module namespace qt3ts='http://www.basex.org/modules/qt3ts' at 'qt3ts/qt3ts.xqm'; declare option db:chop "off"; declare option db:intparse "off"; declare variable $QT3TS external; qt3ts:to-junit( $QT3TS, '*', 'org.basex.test.qt3ts', 'src/test/java/org/basex/test/qt3ts', function($type, $vals) { switch($type) case 'spec' return $vals = ('XQ10', 'XQ10+', 'XQ30', 'XQ30+') case 'xsd-version' return $vals = '1.0' case 'feature' return switch($vals) case 'collection-stability' case 'directory-as-collection-uri' case 'moduleImport' case 'higherOrderFunctions' return true() case 'schemaAware' case 'schemaValidation' case 'schemaImport' case 'staticTyping' case 'namespace-axis' case 'schema-location-hint' case 'xpath-1.0-compatibility' return false() default return (qt3ts:debug('Unknown feature', $vals), true()) case 'xml-version' return some $v in $vals satisfies tokenize($v, ':')[1] = '1.0' case 'default-language' case 'language' return $vals = 'en' case 'unicode-normalization-form' return $vals = ('NFD', 'NFC', 'NFKD', 'NFKC') default return (qt3ts:debug('Unknown dependency', $type), true()) } )basex-7.7.2/basex-tests/src/main/xquery/qt3ts/000077500000000000000000000000001222453003200212125ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/main/xquery/qt3ts/qt3ts-java.xqm000066400000000000000000000233051222453003200237410ustar00rootroot00000000000000(:~ : Serialization module. : @author Leo Woerteler : @version 0.1 :) module namespace qt3ts-java='http://www.basex.org/modules/qt3ts/java'; declare variable $qt3ts-java:not-supported := QName('http://www.basex.org/modules/qt3ts/java', 'NSUP0001'); declare function qt3ts-java:test-suites( $package, $test-sets ) as map(*) { map:new(( $test-sets, for $path in map:keys($test-sets) let $parts := tokenize($path, '/'), $classes := $parts[2] group by $suite := $parts[1] order by $suite return let $suite-name := qt3ts-java:class-name($suite || 'Tests') return map:entry( $suite-name, string-join(( 'package ', $package, '; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; import org.basex.test.qt3ts.', $suite, '.*; /** * Test suite for the "', $suite, '" test group. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @RunWith(Suite.class) @SuiteClasses({', string-join( for $class in $classes order by $class return ' ' || $class || '.class', ',' ), ' }) public class ', $suite-name, ' { } ' )) ) )) }; declare function qt3ts-java:test-set( $package as xs:string, $dir as xs:string, $name as xs:string, $comment as xs:string, $test-cases as map(*) ) as xs:string+ { let $class-name := qt3ts-java:class-name($name) return ( $class-name, string-join(( 'package ', $package, '.', $dir, '; import org.basex.tests.bxapi.XQuery; import ', $package, '.QT3TestSet; /** ', string-join( for $line in tokenize($comment, '\r?\n|\r') return concat(' * ', replace($line, '\*/', '* /')), ' ' ), '. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ', $class-name, ' extends QT3TestSet { ', for $name in map:keys($test-cases) let $test-case := $test-cases($name) order by $name return try {' /** ', string-join( for $line in tokenize($test-case('description'), '\r?\n|\r') return concat(' * ', replace($line, '\*/', '* /')), ' ' ), '. */ @org.junit.Test public void ', qt3ts-java:method-name($name), '() { ', ' xquery10(); '[$test-case('xq10')], ' final XQuery query = new XQuery( ', if($test-case('is_file')) then ( ' queryFile( file( ', qt3ts-java:string-literal($test-case('test'), ' '), ' ) )' ) else qt3ts-java:string-literal($test-case('test'), ' '), ', ctx); try { ', for $line in qt3ts-java:environment($test-case('environment')) return concat(' ', $line, ' '), let $mods := $test-case('modules') for $mod in map:keys($mods) return concat(' query.addModule("', qt3ts-java:escape-string($mod), '", file("', qt3ts-java:escape-string($mods($mod)), '")); '), ' result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ', for $line in qt3ts-java:result($test-case('result'), '') return concat(' ', $line, ' '), ' ); } ' } catch qt3ts-java:NSUP0001 { () (: trace($err:description, 'Skipped test "' || $name || '" because of environment: ')[2] :) }, '} '), '') ) }; declare function qt3ts-java:environment( $envs as map(*)* ) as xs:string* { for $env in $envs for $name in map:keys($env) let $vals := $env($name) return switch($name) case 'source' return if(exists($vals('validation'))) then error($qt3ts-java:not-supported, 'validation') else if($vals('role') = '.') then 'query.context(node(file("' || qt3ts-java:escape-string($vals('file')) || '")));' else if(exists($vals('role'))) then 'query.bind("' || qt3ts-java:escape-string($vals('role')) || '", ' || 'node(file("' || qt3ts-java:escape-string($vals('file')) || '")));' else 'query.addDocument("' || qt3ts-java:escape-string(($vals('uri'), $vals('file'))[1]) || '", ' || 'file("' || qt3ts-java:escape-string($vals('file')) || '"));' case 'namespace' return 'query.namespace("' || qt3ts-java:escape-string($vals('prefix')) || '", "' || qt3ts-java:escape-string($vals('uri')) || '");' case 'collation' return if($vals('uri') != 'http://www.w3.org/2005/xpath-functions/collation/codepoint') then error($qt3ts-java:not-supported, 'uri: ' || $vals('uri')) else () case 'collection' return 'query.addCollection("' || qt3ts-java:escape-string($vals('uri')) || '", ' || 'new String[] { file("' || string-join( for $doc in map:keys($vals('docs')) return qt3ts-java:escape-string($vals('docs')($doc)('file')) , '"), file("') || '") });' case 'decimal-format' return '// decimal format' case 'resource' return '// resource: ' || $vals('uri') case 'schema' return error($qt3ts-java:not-supported, 'schema') case 'static-base-uri' return 'query.baseURI("' || qt3ts-java:escape-string($vals) || '");' case 'param' return 'query.bind("' || qt3ts-java:escape-string($vals('name')) || '", ' || 'new XQuery("' || qt3ts-java:escape-string($vals('select')) || '", ctx).value());' (: map:entry($name, map{ 'name' := $env/@name/string(), 'select' := $env/@select/string(), 'as' := $env/@as/string(), 'declared' := $env/@declared != 'false' }) :) case 'context-item' return 'query.context(new XQuery("' || qt3ts-java:escape-string($vals) || '", ctx).value());' default return trace('', 'Unknown Java-serialization for: ')[2] }; declare function qt3ts-java:result( $result as map(*), $indent as xs:string ) as xs:string* { let $name := map:keys($result), $vals := $result($name) return switch($name) case 'assert-true' return $indent || 'assertBoolean(true)' case 'assert-false' return $indent || 'assertBoolean(false)' case 'assert-empty' return $indent || 'assertEmpty()' case 'assert' return $indent || 'assertQuery("' || qt3ts-java:escape-string($vals) || '")' case 'assert-eq' return $indent || 'assertEq("' || qt3ts-java:escape-string($vals) || '")' case 'assert-string-value' return $indent || 'assertStringValue(' || $vals('normalize-space') || ', "' || qt3ts-java:escape-string($vals('result')) || '")' case 'assert-permutation' return $indent || 'assertPermutation("' || qt3ts-java:escape-string($vals) || '")' case 'assert-type' return $indent || 'assertType("' || qt3ts-java:escape-string($vals) || '")' case 'assert-deep-eq' return $indent || 'assertDeepEq("' || qt3ts-java:escape-string($vals) || '")' case 'assert-count' return $indent || 'assertCount(' || $vals || ')' case 'error' return $indent || 'error("' || qt3ts-java:escape-string($vals) || '")' case 'assert-serialization-error' return $indent || 'assertSerialError("' || qt3ts-java:escape-string($vals) || '")' case 'assert-xml' return $indent || 'assertSerialization("' || qt3ts-java:escape-string($vals('result')) || '", ' || $vals('ignore-prefixes') || ')' case 'serialization-matches' return $indent || 'serializationMatches("' || qt3ts-java:escape-string($vals('regex')) || '", "' || qt3ts-java:escape-string($vals('flags')) || '")' case 'all-of' return ( $indent || '(', tail( for $sub in $vals return ( $indent || '&&', qt3ts-java:result($sub, ' ' || $indent) ) ), $indent || ')' ) case 'any-of' return ( $indent || '(', tail( for $sub in $vals return ( $indent || '||', qt3ts-java:result($sub, ' ' || $indent) ) ), $indent || ')' ) default return 'true' }; declare function qt3ts-java:string-literal( $str as xs:string, $indent as xs:string ) as xs:string { if(empty($str) or string-length($str) eq 0) then $indent || '""' else concat( string-join( for $line in qt3ts-java:lines($str) return concat($indent, '"', qt3ts-java:escape-string($line)), '\n" + ' ), '"' ) }; declare function qt3ts-java:method-name( $name as xs:string ) as xs:string { let $camel := qt3ts-java:class-name($name) return concat(lower-case(substring($camel, 1, 1)), substring($camel, 2)) }; declare function qt3ts-java:class-name( $name as xs:string ) as xs:string { string-join( for $part in tokenize($name, '\W') where string-length($part) gt 0 return concat(upper-case(substring($part, 1, 1)), substring($part, 2)) ) }; declare function qt3ts-java:escape-string( $str as xs:string ) as xs:string { string-join(( for $cp in string-to-codepoints($str) return switch($cp) case 9 return '\t' case 10 return '\n' case 11 return '\v' case 13 return '\r' case 34 return '\"' case 92 return '\\' default return if($cp ge 0 and $cp le 31 or $cp ge 127 and $cp le 159) then out:format('\u%04x', $cp) else let $ch := codepoints-to-string($cp) return if($cp le 255 or matches($ch, '\w')) then $ch else if($cp lt 65536) then out:format('\u%04x', $cp) else let $offset := $cp - 65536, $high := xs:int(($offset idiv 1024) + 55296), $low := xs:int(($offset mod 1024) + 56320) return out:format('\u%04x\u%04x', $high, $low) )) }; declare function qt3ts-java:lines( $str as xs:string ) as xs:string* { tokenize($str, ' ') }; basex-7.7.2/basex-tests/src/main/xquery/qt3ts/qt3ts.xqm000066400000000000000000000234431222453003200230250ustar00rootroot00000000000000(:~ : Conversion module for creating JUnit tests from the QT3TS test suite. : @author Leo Woerteler : @version 0.1 :) module namespace qt3ts='http://www.basex.org/modules/qt3ts'; import module namespace qt3ts-java='http://www.basex.org/modules/qt3ts/java' at 'qt3ts-java.xqm'; declare default element namespace 'http://www.w3.org/2010/09/qt-fots-catalog'; (:~ : Main entry point. : @param $path path to the test-suite : @param $test-sets to be converted : @param $package Java package : @param $out-path path for the generated Java files : @return nothing :) declare function qt3ts:to-junit( $path as xs:string, $test-sets as xs:string*, $package as xs:string, $out-path as xs:string, $supports as function(xs:string, xs:string*) as xs:boolean ) as empty-sequence() { let $catalog := doc($path || file:dir-separator() || 'catalog.xml'), $root := replace(base-uri($catalog), 'catalog\.xml$', ''), $files := qt3ts:get-files($root, $catalog), $envs := qt3ts:environments(map:new(), $catalog/catalog/environment, $files) let $files := qt3ts-java:test-suites( $package, map:new(( for $name in (if($test-sets = '*') then $catalog//test-set/@name else $test-sets) let $test-set := $catalog//test-set[@name = $name] return if(not($test-set)) then qt3ts:debug('Test-set not found', $name) else qt3ts:test-set($test-set, $root, $package, $supports, $envs) )) ) for $name in map:keys($files) let $path := $out-path || file:dir-separator() || $name || '.java' return ( file:create-dir(replace($path, '[^/\\]+$', '')), file:write($path, $files($name), map{ 'method' := 'text' }) ) }; (:~ : Processes a test-set. : @param $test-set the test-set element : @param $package Java package : @param $out-path path for the generated Java files : @return full class name :) declare function qt3ts:test-set( $test-set as element(test-set), $root as xs:string, $package as xs:string, $supports as function(xs:string, xs:string*) as xs:boolean, $envs as map(*) ) as map(*)? { let $name := $test-set/@name/string(), $dir := replace($test-set/@file, '/[^/]+$', ''), $path := $root || $test-set/@file, $doc := doc($path), $file := qt3ts:get-files($root, $doc), $envs := qt3ts:environments($envs, $doc/test-set/environment, $file), $desc := if($doc/test-set/description) then $doc/test-set/description/string() else 'Test-set ' || $name || '.' let $tests := map:new(( for $test-case in $doc/test-set/test-case where every $dep in $test-case/dependency satisfies $supports($dep/@type, tokenize($dep/@value, ' ')) return map{ $test-case/@name := qt3ts:test-case($test-set, $test-case, $root, $envs, $file) } )) return if($doc/*/dependency[not($supports(@type, tokenize(@value, ' ')))]) then qt3ts:debug('Test-set skipped because of dependency', $name) else if(map:size($tests) eq 0) then qt3ts:debug('Test-set skipped', $name) else let $ts := qt3ts-java:test-set($package, $dir, $name, $desc, $tests) return if(contains($ts[2], ' void ')) then map:entry($dir || '/' || $ts[1], $ts[2]) else () (: qt3ts:debug('Test-set skipped after serialization', $name) :) }; declare function qt3ts:test-case( $test-set as element(test-set), $test-case as element(test-case), $root as xs:string, $envs as map(*), $file as map(*) ) as map(*) { let $desc := $test-case/description/string(), $env := $test-case/environment, $mods := map:new(( for $mod in $test-case/module return map:entry( xs:anyURI($mod/@uri/string()), $file($mod/@file) ) )), $map := if($env) then if($env/@ref) then if(map:contains($envs, $env/@ref)) then $envs($env/@ref) else ( qt3ts:debug('Couldn''t find environment', $test-set/@name || ', ' || $env/@ref), map{} ) else qt3ts:environment($env, $file) else map{}, $is_file := exists($test-case/test/@file), $test := if($is_file) then $file($test-case/test/@file) else $test-case/test/string(), $result := qt3ts:result($test-case/result/*, $file, $root), $xq30 := every $dep in $test-case/dependency[@type = 'spec'] satisfies some $spec in $dep/tokenize(@value, ' ') satisfies contains(trace($spec, 'spec'), '30') or contains($spec, '+') return map{ 'description' := $desc, 'modules' := $mods, 'environment' := $map, 'is_file' := $is_file, 'test' := $test, 'result' := $result, 'xq10' := not($xq30) } }; declare function qt3ts:result( $assert as element(), $file as map(*), $root as xs:string ) as map(*) { let $name := $assert/local-name() return map:entry($name, switch($name) case 'assert-true' return () case 'assert-false' return () case 'assert-empty' return () case 'assert' return $assert/string() case 'assert-eq' return $assert/string() case 'assert-string-value' return map{ 'normalize-space' := $assert/@normalize-space = ('true', '1'), 'result' := $assert/string() } case 'assert-permutation' return $assert/string() case 'assert-type' return $assert/string() case 'assert-deep-eq' return $assert/string() case 'assert-count' return xs:integer($assert/string()) case 'error' return $assert/@code/string() case 'assert-serialization-error' return $assert/@code/string() case 'assert-xml' return map{ 'ignore-prefixes' := $assert/@ignore-prefixes = ('true', '1'), 'result' := if($assert/@file) then let $path := $root || $file($assert/@file) return file:read-text($path, 'UTF-8') else $assert/string() } case 'serialization-matches' return map{ 'flags' := ($assert/@flags/string(), '')[1], 'regex' := $assert/text()/string() } case 'all-of' return map($assert/*, qt3ts:result(?, $file, $root)) case 'any-of' return map($assert/*, qt3ts:result(?, $file, $root)) default return qt3ts:debug('Unknown assertion', $name) ) }; declare function qt3ts:environments( $map as map(*), $envs as element(environment)*, $file as map(*) ) as map(*) { map:new( ($map, for $env in $envs return if($env/@name) then map:entry($env/@name, qt3ts:environment($env, $file)) else qt3ts:debug('Environment has no name', serialize($env)) ) ) }; declare function qt3ts:environment( $envs as element(environment), $file as map(*) ) as map(*)* { for $env in $envs/* let $name := xs:string($env/local-name()) return switch($name) case 'source' return map:entry($name, map{ 'role' := $env/@role/string(), 'file' := $file($env/@file/string()), 'validation' := $env/@validation/string(), 'uri' := xs:anyURI($env/@uri/string()) }) case 'namespace' return map:entry($name, map{ 'prefix' := $env/@prefix/string(), 'uri' := xs:anyURI($env/@uri/string()) }) case 'collation' return map:entry($name, map{ 'uri' := xs:anyURI($env/@uri/string()), 'default' := $env/@default = 'true' }) case 'collection' return map:entry($name, map{ 'uri' := xs:anyURI($env/@uri/string()), 'docs' := map:new(( for $src in $env/source return map:entry($src/@file, map{ 'role' := $src/@role/string(), 'file' := $file($src/@file/string()), 'validation' := $src/@validation/string(), 'uri' := xs:anyURI($src/@uri/string()) }) )) }) case 'decimal-format' return map:entry($name, map:new(( for $att in $env/@* return map:entry($att/name(), $att/string()) ))) case 'resource' return map:entry($name, map{ 'file' := $file($env/@file/string()), 'media-type' := $env/@media-type/string(), 'encoding' := $env/@encoding/string(), 'uri' := xs:anyURI($env/@uri/string()) }) case 'schema' return map:entry($name, map{ 'uri' := xs:anyURI($env/@uri/string()), 'file' := $file($env/@file/string()) }) case 'static-base-uri' return map:entry($name, xs:anyURI($env/@uri/string())) case 'param' return map:entry($name, map{ 'name' := $env/@name/string(), 'select' := $env/@select/string(), 'as' := $env/@as/string(), 'declared' := $env/@declared != 'false' }) case 'context-item' return map:entry($name, $env/@select/string()) default return qt3ts:debug('Unknown environment parameter', $env) }; declare function qt3ts:get-files( $root as xs:string, $node as node() ) as map(*) { map:new(( let $root-len := string-length(file:path-to-native(substring($root, 9))) + 2, $uri := base-uri($node) for $file in $node//@file let $uri := replace($uri, '[^/]+$', $file) group by $path := replace(substring( file:path-to-native(substring($uri, 9)), $root-len), '\\', '/') return for $file in $file return map:entry($file, $path) )) }; declare function qt3ts:insert-with( $combine as function(item()*, item()*) as item()*, $map as map(*), $key as item(), $value as item()* ) as map(*) { map:new( ( $map, map:entry( $key, if(map:contains($map, $key)) then $combine(map:get($map, $key), $value) else $value ) ) ) }; declare function qt3ts:debug( $msg as xs:string, $itm as item() ) as empty-sequence() { trace($itm, $msg || ': ')[2] }; basex-7.7.2/basex-tests/src/test/000077500000000000000000000000001222453003200166325ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/test/java/000077500000000000000000000000001222453003200175535ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/test/java/org/000077500000000000000000000000001222453003200203425ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/test/java/org/basex/000077500000000000000000000000001222453003200214445ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/test/java/org/basex/test/000077500000000000000000000000001222453003200224235ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/test/java/org/basex/test/FNCryptoTest.java000066400000000000000000000121361222453003200256350ustar00rootroot00000000000000package org.basex.test; import static org.junit.Assert.*; import java.io.*; import java.security.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.util.*; import org.junit.*; /** * This class tests the functions of the EXPath Cryptographic module. The tests * in basex-test package are only executable after a java keystore has been * created. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public class FNCryptoTest { /** Database context. */ private static Context context; /** User home directory. */ private static final String KEYSTORE_DIR = System.getProperty("user.home"); /** Java home directory. */ private static final String JAVA_HOME = System.getProperty("java.home"); /** Keytool executable. */ private static final String KEYTOOL = JAVA_HOME + "/bin/keytool"; /** Key store file. */ private static final String KEYSTORE = KEYSTORE_DIR + "/keystore.jks"; /** Key alias. */ private static final String ALIAS = "basex"; /** Key store and key password. */ private static final String PASS = "password"; /** Shell command to create java keystore. */ private static final String[] GENKEY_CMD = { KEYTOOL, "-genkey", "-keyalg", "RSA", "-validity", "360", "-alias", ALIAS, "-keystore", KEYSTORE, "-storepass", PASS, "-keypass", PASS, "-dname", "CN=hans wurst, OU=dev, O=basex, L=konstanz, ST=bw, C=de" }; /** Digital certificate element. */ private static final String CT = "" + "JKS" + "" + PASS + "" + "" + ALIAS + "" + "" + PASS + "" + "" + KEYSTORE + "" + ""; /** * Tests whether validate-signature returns true for a certificate created * with generate-signature. */ @Test public void validateSignatureWithCertificate() { query("crypto:validate-signature(" + "crypto:generate-signature(,'','','','',''," + CT + "))", "true"); } /** * Tests whether validate-signature returns true for a certificate created * with generate-signature. */ @Test public void validateSignatureWithXPathAndCertificate() { query("crypto:validate-signature(crypto:generate-signature(," + "'','','','','','/a/n'," + CT + "))", "true"); } /** * Tests whether validate-signature returns true for a certificate created * with generate-signature. */ @Test public void validateSignatureFullySpecified() { query("crypto:validate-signature(crypto:generate-signature(," + "'exclusive','SHA512','RSA_SHA1','myPrefix','enveloped','/a/n'," + CT + "))", "true"); } /** * Test method for crypto:encrypt and crypto:decrypt with asymmetric keys. */ @Test public void encryptionAsym1() { final String msg = "messagemessagemessagemessagemessagemessagemessage"; PublicKey puk = null; PrivateKey prk = null; try { final KeyPairGenerator gen = KeyPairGenerator.getInstance("RSA"); final KeyPair kp = gen.generateKeyPair(); puk = kp.getPublic(); prk = kp.getPrivate(); } catch(final NoSuchAlgorithmException e) { e.printStackTrace(); } query("let $e := crypto:encrypt('" + msg + "','asymmetric','" + prk + "','RSA')" + "return crypto:decrypt($e,'asymmetric','" + puk + "','RSA')", msg); } /** * Creates the database context. * @throws Exception error during keystore generation or database exception */ @BeforeClass public static void start() throws Exception { new File(KEYSTORE).delete(); final Process proc = Runtime.getRuntime().exec(GENKEY_CMD); Thread.sleep(2000); // give the keytool some time to finish if(proc.exitValue() != 0) throw new RuntimeException("Cannot initialize keystore."); context = new Context(); // turn off pretty printing new Set(Prop.SERIALIZER, "indent=no").execute(context); } /** * Removes test databases and closes the database context. */ @AfterClass public static void finish() { context.close(); new File(KEYSTORE).delete(); } /** * Runs a query and matches the result against the expected output. * @param query query * @param expected expected output */ private static void query(final String query, final String expected) { query(null, query, expected); } /** * Runs an updating query and matches the result of the second query * against the expected output. * @param first first query * @param second second query * @param expected expected output */ private static void query(final String first, final String second, final String expected) { try { if(first != null) new XQuery(first).execute(context); final String result = new XQuery(second).execute(context); // quotes are replaced by apostrophes to simplify comparison assertEquals(expected.replaceAll("\"", "'"), result.replaceAll("\"", "'")); } catch(final BaseXException ex) { fail(Util.message(ex)); } } }basex-7.7.2/basex-tests/src/test/java/org/basex/test/SandboxTest.java000066400000000000000000000064471222453003200255370ustar00rootroot00000000000000package org.basex.test; import static org.basex.core.Text.*; import static org.junit.Assert.*; import java.io.*; import org.basex.*; import org.basex.core.*; import org.basex.io.*; import org.basex.io.out.*; import org.basex.server.*; import org.basex.util.*; import org.basex.util.list.*; import org.junit.*; /** * If this class is extended, tests will be run in a sandbox. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class SandboxTest { /** Default output stream. */ public static final PrintStream OUT = System.out; /** Default error stream. */ public static final PrintStream ERR = System.err; /** Null output stream. */ public static final PrintStream NULL = new PrintStream(new NullOutput()); /** Test name. */ public static final String NAME = Util.name(SandboxTest.class); /** Database context. */ public static Context context; /** Clean up files. */ public static boolean cleanup; /** * Creates the sandbox. */ @BeforeClass public static void createContext() { final IOFile sb = sandbox(); sb.delete(); assertTrue("Sandbox could not be created.", sb.md()); context = new Context(); initContext(context); cleanup = true; } /** * Initializes the specified context. * @param ctx context */ protected static void initContext(final Context ctx) { final IOFile sb = sandbox(); ctx.mprop.set(MainProp.DBPATH, sb.path() + "/data"); ctx.mprop.set(MainProp.WEBPATH, sb.path() + "/webapp"); ctx.mprop.set(MainProp.REPOPATH, sb.path() + "/repo"); } /** * Removes test databases and closes the database context. */ @AfterClass public static void closeContext() { if(cleanup) { context.close(); assertTrue("Sandbox could not be deleted.", sandbox().delete()); } } /** * Creates a new, sandboxed server instance. * @param args additional arguments * @return server instance * @throws IOException I/O exception */ protected static BaseXServer createServer(final String... args) throws IOException { System.setOut(NULL); try { final StringList sl = new StringList().add("-z").add("-p9999").add("-e9998"); for(final String a : args) sl.add(a); final BaseXServer server = new BaseXServer(sl.toArray()); server.context.mprop.set(MainProp.DBPATH, sandbox().path()); return server; } finally { System.setOut(OUT); } } /** * Stops a server instance. * @param server server * @throws IOException I/O exception */ protected static void stopServer(final BaseXServer server) throws IOException { System.setOut(NULL); try { if(server != null) server.stop(); } finally { System.setOut(OUT); } } /** * Creates a client instance. * @param login optional login data * @return client instance * @throws IOException I/O exception */ public static ClientSession createClient(final String... login) throws IOException { final String user = login.length > 0 ? login[0] : ADMIN; final String pass = login.length > 1 ? login[1] : ADMIN; return new ClientSession(LOCALHOST, 9999, user, pass); } /** * Returns the sandbox database path. * @return database path */ protected static IOFile sandbox() { return new IOFile(Prop.TMP, NAME); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/performance/000077500000000000000000000000001222453003200247245ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/test/java/org/basex/test/performance/Benchmark.java000066400000000000000000000051711222453003200274650ustar00rootroot00000000000000package org.basex.test.performance; import static org.basex.core.Text.*; import java.io.*; import org.basex.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.server.*; import org.basex.test.*; import org.junit.*; /** * This class offers utility methods to perform simple benchmarks. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public abstract class Benchmark extends SandboxTest { /** Test document. */ private static final String INPUT = "src/test/resources/factbook.zip"; /** Server reference. */ private static BaseXServer server; /** Session. */ private static Session session; /** Local vs server flag. */ private static boolean local; /** * Initializes the benchmark. * @throws IOException I/O exception */ @BeforeClass public static void init() throws IOException { // check if server is (not) running final int sp = context.mprop.num(MainProp.SERVERPORT); server = local || BaseXServer.ping(LOCALHOST, sp) ? null : createServer(); session = local ? new LocalSession(context) : createClient(); // create test database session.execute(new Set(Prop.QUERYINFO, true)); } /** * Stops the server. * @throws IOException I/O exception */ @AfterClass public static void stop() throws IOException { stopServer(server); } /** * Creates a new database instance and performs a query. * @param queries queries to be evaluated * @throws Exception exception */ protected static void update(final String queries) throws Exception { update(1, queries); } /** * Creates a new database instance and performs a query for the * specified number of runs. * @param query queries to be evaluated * @param r runs the number for the specified number of time * @throws IOException I/O exception */ protected static void update(final int r, final String query) throws IOException { // loop through number of runs for a single query check(); for(int rn = 0; rn < r; ++rn) session.execute(new XQuery(query)); } /** * Performs the specified query and returns the result. * @param query query to be evaluated * @return result * @throws IOException I/O exception */ protected static String query(final String query) throws IOException { check(); return session.execute(new XQuery(query)); } /** * Creates or opens the test database. * @throws IOException I/O exception */ private static void check() throws IOException { session.execute(new Check(INPUT)); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/performance/CollAddTest.java000066400000000000000000000041611222453003200277330ustar00rootroot00000000000000package org.basex.test.performance; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.test.*; import org.junit.*; /** * This class adds and retrieves documents in a collection. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class CollAddTest extends SandboxTest { /** * Initializes the tests. * @throws Exception exception */ @BeforeClass public static void init() throws Exception { new Set(Prop.INTPARSE, true).execute(context); } /** * Adds 100 documents. * @throws Exception exception */ @Test public void add100() throws Exception { add(100, false); } /** * Adds 1000 documents. * @throws Exception exception */ @Test public void add1000() throws Exception { add(1000, false); } /** * Adds 10000 documents. * @throws Exception exception */ @Test public void add10000() throws Exception { add(10000, false); } /** * Adds 100000 documents. * @throws Exception exception */ @Test public void add100000() throws Exception { add(100000, false); } /** * Adds 1000 documents. * @throws Exception exception */ @Test public void add100Force() throws Exception { add(100, true); } /** * Adds 1000 documents. * @throws Exception exception */ @Test public void add1000Force() throws Exception { add(1000, true); } /** * Adds 1000 documents. * @throws Exception exception */ @Test public void add10000Force() throws Exception { add(10000, true); } /** * Creates a database. * @param n number of documents to be added * @param flush force flush of updates * @throws Exception exception */ private static void add(final int n, final boolean flush) throws Exception { new Set(Prop.AUTOFLUSH, flush).execute(context); // Create test database final Command cmd = new CreateDB(NAME); cmd.execute(context); // Add documents for(int i = 0; i < n; i++) { new Add(Integer.toString(i), "").execute(context); } // Close database new DropDB(NAME).execute(context); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/performance/CollStressTest.java000066400000000000000000000045641222453003200305350ustar00rootroot00000000000000package org.basex.test.performance; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.test.*; import org.junit.*; /** * This class adds and retrieves documents in a collection. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class CollStressTest extends SandboxTest { /** Number of documents to be added. */ private static final int SIZE = 4000; /** * Initializes the tests. * @throws Exception exception */ @BeforeClass public static void init() throws Exception { final CreateDB cmd = new CreateDB(NAME); cmd.execute(context); // Speed up updates and add documents new Set(Prop.AUTOFLUSH, false).execute(context); new Set(Prop.INTPARSE, true).execute(context); for(int i = 0; i < SIZE; i++) { new Add(Integer.toString(i), "").execute(context); } new Set(Prop.AUTOFLUSH, true).execute(context); } /** * Finishes the tests. * @throws Exception exception */ @AfterClass public static void finish() throws Exception { new DropDB(NAME).execute(context); } /** * Requests specific documents. * @throws Exception exception */ @Test public void specificOpened() throws Exception { new Open(NAME).execute(context); for(int i = 0; i < SIZE; i++) { new XQuery("collection('" + NAME + '/' + i + "')").execute(context); } } /** * Requests specific documents from closed database. * @throws Exception exception */ @Test public void specificClosed() throws Exception { new Close().execute(context); for(int i = 0; i < SIZE; i++) { new XQuery("collection('" + NAME + '/' + i + "')").execute(context); } } /** * Requests all documents. * @throws Exception exception */ @Test public void allOpened() throws Exception { new Open(NAME).execute(context); new XQuery("for $i in 0 to " + (SIZE - 1) + ' ' + "return collection(concat('" + NAME + "/', $i))").execute(context); } /** * Requests all documents from closed database. * @throws Exception exception */ @Test public void allClosed() throws Exception { new Close().execute(context); new XQuery("for $i in 0 to " + (SIZE - 1) + ' ' + "return collection(concat('" + NAME + "/', $i))").execute(context); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/performance/Delete.java000066400000000000000000000027431222453003200267770ustar00rootroot00000000000000package org.basex.test.performance; import org.junit.*; /** * This class benchmarks delete operations. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class Delete extends Benchmark { /** * Deletes the root node. * @throws Exception exception */ @Test public void root() throws Exception { update("delete node /*"); } /** * Deletes all nodes. * @throws Exception exception */ @Test public void nodes() throws Exception { update("delete node //node()"); } /** * Deletes all element nodes. * @throws Exception exception */ @Test public void elements() throws Exception { update("delete node //*"); } /** * Deletes all text nodes. * @throws Exception exception */ @Test public void texts() throws Exception { update("delete node //text()"); } /** * Deletes first 1000 text nodes. * @throws Exception exception */ @Test public void texts1000() throws Exception { final String qu = query("count(//text())"); final int n = Math.min(1000, Integer.parseInt(qu.trim())); update(n, "delete node (//text())[1]"); } /** * Deletes first 1000 text nodes one by one. * @throws Exception exception */ @Test public void textsSingle1000() throws Exception { update("for $i in 1 to min((1000, count(//text()))) " + "return delete node /descendant::text()[$i]"); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/performance/DocReplaceTest.java000066400000000000000000000021041222453003200304250ustar00rootroot00000000000000package org.basex.test.performance; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.io.*; import org.basex.test.*; import org.junit.*; /** * This class replaces document nodes in a database. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class DocReplaceTest extends SandboxTest { /** Number of queries to be run. */ private static final int NQUERIES = 25000; /** * Runs the test. * @throws Exception exception */ @Test public void run() throws Exception { context.prop.set(Prop.TEXTINDEX, false); context.prop.set(Prop.ATTRINDEX, false); context.prop.set(Prop.AUTOFLUSH, false); // create test database new CreateDB(NAME).execute(context); // replace nodes for(int i = 0; i < NQUERIES; i++) { new Add(i + IO.XMLSUFFIX, "").execute(context); } // replace nodes with same content for(int i = 0; i < NQUERIES; i++) { new Replace(i + IO.XMLSUFFIX, "").execute(context); } // Drop database new DropDB(NAME).execute(context); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/performance/IncUpdateTest.java000066400000000000000000000103111222453003200302770ustar00rootroot00000000000000package org.basex.test.performance; import static org.junit.Assert.*; import java.util.*; import java.util.List; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.core.cmd.Set; import org.basex.query.*; import org.basex.test.*; import org.junit.*; import org.junit.runner.*; import org.junit.runners.*; import org.junit.runners.Parameterized.Parameters; /** * This test class performs some incremental updates. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ @RunWith(Parameterized.class) public final class IncUpdateTest extends SandboxTest { /** * Test parameters. * @return parameters */ @Parameters public static List params() { return Arrays.asList(new Object[][] { {false}, {true} }); } /** Number of steps. */ private static final int STEPS = 10; /** Maximum number of entries. */ private static final int MAX = 2000 / STEPS; /** Incremental index update flag. */ private final boolean ixupdate; /** * Constructor. * @param u incremental index update flag. */ public IncUpdateTest(final boolean u) { ixupdate = u; } /** * Initializes the test. * @throws Exception exception */ @Before public void init() throws Exception { new Set(Prop.UPDINDEX, ixupdate).execute(context); new CreateDB(NAME, "").execute(context); new Set(Prop.AUTOFLUSH, false).execute(context); } /** * Finishes the test. * @throws Exception exception */ @After public void finish() throws Exception { new DropDB(NAME).execute(context); } /** * Incremental test. * @throws Exception exception */ @Test public void insertInto() throws Exception { for(int a = 0; a < STEPS; a++) { final int n = MAX * a; for(int i = 0; i < n; i++) { query("insert node into /*"); } query("count(//x)", n); query("delete node //x"); query("count(//x)", 0); } } /** * Incremental test. * @throws Exception exception */ @Test public void insertBefore() throws Exception { for(int a = 0; a < STEPS; a++) { final int n = MAX * a; for(int i = 0; i < n; i++) { query("insert node before /*[1]"); } query("count(//x)", n); query("delete node //x"); query("count(//x)", 0); } } /** * Incremental test. * @throws Exception exception */ @Test public void insertAfter() throws Exception { for(int a = 0; a < STEPS; a++) { final int n = MAX * a; for(int i = 0; i < n; i++) { query("insert node after /*[last()]"); } query("count(//x)", n); query("delete node //x"); query("count(//x)", 0); } } /** * Incremental test. * @throws Exception exception */ @Test public void insertDeep() throws Exception { for(int a = 0; a < STEPS; a++) { final int n = MAX * a; for(int i = 0; i < n; i++) { query("insert node into //*[not(*)]"); } query("count(//x)", n); query("delete node //x"); query("count(//x)", 0); } } /** * Incremental test. * @throws Exception exception */ @Test public void replaceValue() throws Exception { final Random rnd = new Random(); final StringBuilder sb = new StringBuilder(); for(int i = 0; i < MAX * STEPS; i++) { sb.append((char) ('@' + (rnd.nextInt() & 0x1F))); query("replace value of node /* with '" + sb + '\''); query("string-length(/*)", sb.length()); } } /** * Runs the specified query. * @param query query string * @return result * @throws QueryException database exception */ protected static String query(final String query) throws QueryException { final QueryProcessor qp = new QueryProcessor(query, context); try { return qp.execute().toString().replaceAll("(\\r|\\n) *", ""); } finally { qp.close(); } } /** * Checks if a query yields the specified string. * @param query query to be run * @param result query result * @throws QueryException database exception */ protected static void query(final String query, final Object result) throws QueryException { assertEquals(result.toString(), query(query)); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/performance/LocalStressTest.java000066400000000000000000000054621222453003200306740ustar00rootroot00000000000000package org.basex.test.performance; import java.util.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.test.*; import org.basex.util.*; import org.junit.*; /** * This class performs a local stress tests with a specified * number of threads and queries. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class LocalStressTest extends SandboxTest { /** Input document. */ private static final String INPUT = "src/test/resources/factbook.zip"; /** Query to be run ("%" may be used as placeholder for dynamic content). */ private static final String QUERY = "(//text())[position() = %]"; /** Maximum position to retrieve. */ private static final int MAX = 1000; /** Random number generator. */ static final Random RND = new Random(); /** Result counter. */ static int counter; /** * Runs the test. * @throws Exception exception */ @Test public void clients10runs10() throws Exception { run(10, 10); } /** * Runs the test. * @throws Exception exception */ @Test public void clients10runs100() throws Exception { run(10, 100); } /** * Runs the test. * @throws Exception exception */ @Test public void clients100runs10() throws Exception { run(100, 10); } /** * Runs the test. * @throws Exception exception */ @Test public void clients100runs100() throws Exception { run(100, 100); } /** * Runs the stress test. * @param clients number of clients * @param runs number of runs per client * @throws Exception exception */ private static void run(final int clients, final int runs) throws Exception { // Create test database Command cmd = new CreateDB(NAME, INPUT); cmd.execute(context); // Start clients final Client[] cl = new Client[clients]; for(int i = 0; i < clients; ++i) cl[i] = new Client(runs); for(final Client c : cl) c.start(); for(final Client c : cl) c.join(); // Drop database cmd = new DropDB(NAME); cmd.execute(context); } /** Single client. */ static class Client extends Thread { /** Number of runs. */ private final int runs; /** * Constructor. * @param r number of runs */ Client(final int r) { runs = r; } @Override public void run() { try { for(int i = 0; i < runs; ++i) { Performance.sleep((long) (50 * RND.nextDouble())); // Return nth text of the database final int n = RND.nextInt() % MAX + 1; final String qu = Util.info(QUERY, n); new XQuery(qu).execute(context); } } catch(final BaseXException ex) { ex.printStackTrace(); } } } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/performance/RESTConcurrencyTest.java000066400000000000000000000263461222453003200314320ustar00rootroot00000000000000package org.basex.test.performance; import static org.basex.http.HTTPMethod.*; import static org.junit.Assert.*; import java.io.*; import java.net.*; import java.util.concurrent.*; import org.basex.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.http.*; import org.basex.io.*; import org.basex.util.*; import org.basex.util.list.*; import org.junit.*; /** * Concurrency tests of BaseX REST API. * * @author BaseX Team 2005-12, BSD License * @author Dimitar Popov */ public class RESTConcurrencyTest { /** Time-out in (ms): increase if running on a slower system. */ private static final long TIMEOUT = 600; /** Socket time-out in (ms). */ private static final int SOCKET_TIMEOUT = 3000; /** Test database name. */ private static final String DBNAME = Util.name(RESTConcurrencyTest.class); /** Context to create and drop the test database. */ private static final Context CTX = new Context(); /** BaseX HTTP base URL. */ static final String BASE_URL = "http://localhost:8984/rest/" + DBNAME; /** BaseX HTTP server instance under test. */ private Process basexHTTPServer; /** * Create a test database and start BaseXHTTP. * @throws Exception if database cannot be created or server cannot be started */ @Before public void setUp() throws Exception { createTestDatabase(DBNAME); startBaseXHTTP(); } /** * Drop the test database and stop BaseXHTTP. * @throws Exception if database cannot be dropped or server cannot be stopped */ @After public void tearDown() throws Exception { stopBaseXHTTP(); dropTestDatabase(DBNAME); } /** * Test 2 concurrent readers (GH-458). *

    Test case: *

      *
    1. start a long running reader; *
    2. start a fast reader: it should succeed. *
    * @throws Exception error during request execution */ @Test public void testMultipleReaders() throws Exception { final String number = "63177"; final String slowQuery = "?query=(1%20to%20100000000000000)%5b.=1%5d"; final String fastQuery = "?query=" + number; final Get slowAction = new Get(slowQuery); final Get fastAction = new Get(fastQuery); final ExecutorService exec = Executors.newFixedThreadPool(2); exec.submit(slowAction); Performance.sleep(TIMEOUT); // delay in order to be sure that the reader has started final Future fast = exec.submit(fastAction); try { final HTTPResponse result = fast.get(TIMEOUT, TimeUnit.MILLISECONDS); assertEquals(HTTPCode.OK, result.status); assertEquals(number, result.data); } finally { slowAction.stop = true; } } /** * Test concurrent reader and writer (GH-458). *

    Test case: *

      *
    1. start a long running reader; *
    2. try to start a writer: it should time out; *
    3. stop the reader; *
    4. start the writer again: it should succeed. *
    * @throws Exception error during request execution */ @Test @Ignore("There is no way to stop a query on the server!") public void testReaderWriter() throws Exception { final String readerQuery = "?query=(1%20to%20100000000000000)%5b.=1%5d"; final String writerQuery = "/test.xml"; final byte[] content = Token.token("
    "); final Get readerAction = new Get(readerQuery); final Put writerAction = new Put(writerQuery, content); final ExecutorService exec = Executors.newFixedThreadPool(2); // start reader exec.submit(readerAction); Performance.sleep(TIMEOUT); // delay in order to be sure that the reader has started // start writer Future writer = exec.submit(writerAction); try { final HTTPResponse result = writer.get(TIMEOUT, TimeUnit.MILLISECONDS); if(result.status.isSuccess()) fail("Database modified while a reader is running"); throw new Exception(result.toString()); } catch(final TimeoutException e) { // writer is blocked by the reader: stop it writerAction.stop = true; } // stop reader readerAction.stop = true; // start the writer again writer = exec.submit(writerAction); assertEquals(HTTPCode.CREATED, writer.get().status); } /** * Test concurrent writers (GH-458). *

    Test case: *

      *
    1. start several writers one after another; *
    2. all writers should succeed. *
    * @throws Exception error during request execution */ @Test public void testMultipleWriters() throws Exception { final int count = 10; final String template = "" + "" + "]]>"; @SuppressWarnings("unchecked") final Future[] tasks = new Future[count]; final ExecutorService exec = Executors.newFixedThreadPool(count); // start all writers (not at the same time, but still in parallel) for(int i = 0; i < count; i++) { final String command = String.format(template, i); tasks[i] = exec.submit(new Post("", Token.token(command))); } // check if all have finished successfully for(final Future task : tasks) { assertEquals(HTTPCode.OK, task.get(TIMEOUT, TimeUnit.MILLISECONDS).status); } } // private methods /** Start BaseX HTTP. */ private void startBaseXHTTP() { basexHTTPServer = Util.start(BaseXHTTP.class, "-U" + Text.ADMIN, "-P" + Text.ADMIN); Performance.sleep(TIMEOUT); // give the server some time to stop } /** Stop BaseX HTTP. */ private void stopBaseXHTTP() { Util.start(BaseXHTTP.class, "stop"); Performance.sleep(TIMEOUT); // give the server some time to stop basexHTTPServer.destroy(); Performance.sleep(TIMEOUT); // give the server some time to stop } /** * Create a database with the given name. * @param name database name * @throws IOException error during database creation */ private static void createTestDatabase(final String name) throws IOException { new CreateDB(name).execute(CTX); new Close().execute(CTX); } /** * Drop a database with the given name. * @param name database name * @throws IOException error during database drop */ private static void dropTestDatabase(final String name) throws IOException { new DropDB(name).execute(CTX); } // REST API: /** REST GET request. */ private static class Get implements Callable { /** Request URI. */ protected final URI uri; /** Stop signal. */ public volatile boolean stop; /** * Construct a new GET request. * @param request request string without the base URI */ public Get(final String request) { uri = URI.create(BASE_URL + request); } @Override public HTTPResponse call() throws Exception { final HttpURLConnection hc = (HttpURLConnection) uri.toURL().openConnection(); hc.setReadTimeout(SOCKET_TIMEOUT); try { while(!stop) { try { final int code = hc.getResponseCode(); final InputStream input = hc.getInputStream(); final ByteList bl = new ByteList(); for(int i; (i = input.read()) != -1;) bl.add(i); return new HTTPResponse(code, bl.toString()); } catch(final SocketTimeoutException e) { } } return null; } finally { hc.disconnect(); } } } /** REST PUT request. */ private static class Put implements Callable { /** Request URI. */ private final URI uri; /** Content to send to the server. */ private final byte[] content; /** HTTP method. */ protected HTTPMethod method; /** Stop signal. */ public volatile boolean stop; /** * Construct a new PUT request. * @param request request string without the base URI * @param data data to send to the server */ public Put(final String request, final byte[] data) { this(request, data, PUT); } /** * Construct a new request. * @param request request string without the base URI * @param data data to send to the server * @param m HTTP method */ protected Put(final String request, final byte[] data, final HTTPMethod m) { uri = URI.create(BASE_URL + request); content = data; method = m; } @Override public HTTPResponse call() throws Exception { final HttpURLConnection hc = (HttpURLConnection) uri.toURL().openConnection(); try { hc.setDoOutput(true); hc.setRequestMethod(method.name()); hc.setRequestProperty(MimeTypes.CONTENT_TYPE, MimeTypes.APP_XML); hc.getOutputStream().write(content); hc.getOutputStream().close(); hc.setReadTimeout(SOCKET_TIMEOUT); while(!stop) { try { return new HTTPResponse(hc.getResponseCode()); } catch(final SocketTimeoutException e) { } } return null; } finally { hc.disconnect(); } } } /** REST POST request. */ private static class Post extends Put { /** * Construct a new POST request. * @param request request string without the base URI * @param data data to send to the server */ public Post(final String request, final byte[] data) { super(request, data, POST); } } // Toolbox /** Simple HTTP response. */ private static class HTTPResponse { /** Status code. */ public final HTTPCode status; /** Response data or {@code null} if no data was returned. */ public final String data; /** * Constructor. * @param code HTTP response status code */ public HTTPResponse(final int code) { this(code, null); } /** * Constructor. * @param code HTTP response status code * @param d data */ public HTTPResponse(final int code, final String d) { status = HTTPCode.valueOf(code); data = d; } } /** HTTP response codes. */ private static enum HTTPCode { /** 100: Continue. */ CONTINUE(100, "Continue"), /** 200: OK. */ OK(200, "OK"), /** 201: Created. */ CREATED(201, "Created"), /** 400: Bad Request. */ BAD_REQUEST(400, "Bad Request"), /** 401: Unauthorized. */ UNAUTHORIZED(401, "Unauthorized"), /** 403: Forbidden. */ FORBIDDEN(403, "Forbidden"), /** 404: Not Found. */ NOT_FOUND(403, "Not Found"); /** HTTP response code. */ public final int code; /** HTTP response message. */ public final String message; /** * Constructor. * @param c code * @param m message */ private HTTPCode(final int c, final String m) { code = c; message = m; } /** * Is the current code a "Success" code? * @return {@code true} if the current code is a "Success" code */ public boolean isSuccess() { return 200 <= code && code < 300; } @Override public String toString() { return code + ": " + message; } /** * Get the enum value given the numeric code. * @param code HTTP response code * @return enum value */ public static HTTPCode valueOf(final int code) { for(final HTTPCode h : HTTPCode.values()) { if(h.code == code) return h; } return null; } } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/performance/ReplaceInPlaceTest.java000066400000000000000000000032231222453003200312360ustar00rootroot00000000000000package org.basex.test.performance; import java.util.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.test.*; import org.junit.*; /** * This test replaces texts in-place and checks if the database text files increase * in size. Currently, the actual test is wrapped in comments. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ReplaceInPlaceTest extends SandboxTest { /** Number of queries to be run. */ private static final int NQUERIES = 10000; /** Random number generator. */ static final Random RND = new Random(); /** Result counter. */ static int counter; /** * Runs the test. * @throws Exception exception */ @Test public void run() throws Exception { context.prop.set(Prop.TEXTINDEX, false); context.prop.set(Prop.ATTRINDEX, false); context.prop.set(Prop.AUTOFLUSH, false); // create test database new CreateDB(NAME, "" + "
    x.xxxxxxxxxxxxxxxxxx" + "x.xxxxxxxxxxxxxxxxxx
    ").execute(context); //final long len1 = CONTEXT.data().meta.dbfile(DataText.DATATXT).length(); // replace texts with random doubles final Random rnd = new Random(); for(int i = 0; i < NQUERIES; i++) { final double d = rnd.nextDouble(); final String qu = "for $a in //A return replace node $a/text() with " + d; new XQuery(qu).execute(context); } // perform final, flushed replacement new Flush().execute(context); //final long len2 = CONTEXT.data().meta.dbfile(DataText.DATATXT).length(); //assertEquals(len1, len2); // Drop database new DropDB(NAME).execute(context); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/performance/ScanTest.java000066400000000000000000000067321222453003200273230ustar00rootroot00000000000000package org.basex.test.performance; import java.io.*; import java.util.*; import org.basex.core.*; import org.basex.core.cmd.*; import org.basex.io.*; import org.basex.io.out.*; import org.basex.test.*; import org.basex.util.*; import org.junit.*; /** * This class benchmarks simple table scans. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ScanTest extends SandboxTest { /** Number of elements to be created. */ private static final int ELEMENTS = 1000000; /** Number of loops. */ private static final int LOOPS = 3; /** * Initializes the test database. * @throws IOException I/O exception */ @BeforeClass public static void initDB() throws IOException { /* generate test file. example: * * ndjkeibjmfeg * ppoapcefcf * */ final IOFile dbfile = new IOFile(sandbox(), NAME); final BufferOutput bo = new BufferOutput(dbfile.path()); final int max = 16; final byte[] cache = new byte[max]; // use constant seed to create same test document every time final Random rnd = new Random(0); try { bo.write(Token.token("")); final byte[] start = Token.token(""); final byte[] end = Token.token(""); for(int e = 0; e < ELEMENTS; e++) { bo.write(start); final int rl = rnd.nextInt(max) + 1; for(int r = 0; r < rl; r++) cache[r] = (byte) ('a' + rnd.nextInt(max)); bo.write(cache, 0, rl); bo.write(end); } bo.write(Token.token("")); } finally { bo.close(); } // create database new CreateDB(NAME, dbfile.path()).execute(context); // print file contents //Util.outln(dbfile.string()); // print database info //Util.outln(new InfoDB().execute(context)); // delete generated file //assertTrue(dbfile.delete()); } /** * Initializes the benchmark. * @throws BaseXException database exception */ @AfterClass public static void finishDB() throws BaseXException { new DropDB(NAME).execute(context); } /** * Counts the number of elements with text node as child. * @throws BaseXException database exception */ @Test public void elementsWithText() throws BaseXException { query("count( //*[text()] )"); } /** * Counts the number of elements with text node or attribute as child. * @throws BaseXException database exception */ @Test public void elementsWithTextOrAttribute() throws BaseXException { query("count( descendant::*//(*|@*) )"); } /** * Counts the number of elements the text of which does not equal a given string. * @throws BaseXException database exception */ @Test public void textNotEquals() throws BaseXException { query("count( //*[text() != ' '] )"); } /** * Performs the specified query; some performance measurements are output and * the result is ignored. * @param query query to be evaluated * @throws BaseXException database exception */ private void query(final String query) throws BaseXException { Util.outln("Query: " + query); // warm up new XQuery(query).execute(context); final Performance p = new Performance(); // run query and dump required time final Performance pl = new Performance(); for(int l = 0; l < LOOPS; l++) { new XQuery(query).execute(context); Util.outln(pl); } // print average runtime Util.outln(p.getTime(LOOPS)); Util.outln(); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/performance/ServerMemTest.java000066400000000000000000000035441222453003200303420ustar00rootroot00000000000000package org.basex.test.performance; import org.basex.*; import org.basex.server.*; import org.basex.test.*; import org.junit.*; /** * This class performs a client/server memory stress tests with a specified * number of threads and queries. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ServerMemTest extends SandboxTest { /** Query to be run. */ private static final String QUERY = "(for $i in 1 to 50000 order by $i return $i)[1]"; /** Server reference. */ BaseXServer server; /** * Runs the test. * @throws Exception exception */ @Test public void clients10() throws Exception { run(10); } /** * Runs the test. * @throws Exception exception */ @Test public void clients100() throws Exception { run(100); } /** * Runs the stress test. * @param clients number of clients * @throws Exception exception */ private void run(final int clients) throws Exception { //run server instance server = createServer(); // run clients final Client[] cl = new Client[clients]; for(int i = 0; i < clients; ++i) cl[i] = new Client(); for(final Client c : cl) c.start(); for(final Client c : cl) c.join(); // stop server stopServer(server); } /** Single client. */ static final class Client extends Thread { /** Client session. */ private final ClientSession session; /** * Default constructor. * @throws Exception exception */ public Client() throws Exception { session = createClient(); } @Override public void run() { try { // Perform query session.execute("xquery " + QUERY); session.close(); } catch(final Exception ex) { ex.printStackTrace(); } } } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/performance/ServerStressTest.java000066400000000000000000000062571222453003200311130ustar00rootroot00000000000000package org.basex.test.performance; import java.util.*; import org.basex.*; import org.basex.server.*; import org.basex.test.*; import org.basex.util.*; import org.junit.*; /** * This class performs a client/server stress tests with a specified * number of threads and queries. * * @author BaseX Team 2005-12, BSD License * @author Christian Gruen */ public final class ServerStressTest extends SandboxTest { /** Input document. */ private static final String INPUT = "src/test/resources/factbook.zip"; /** Query to be run ("%" may be used as placeholder for dynamic content). */ private static final String QUERY = "(doc('test')//text())[position() = %]"; /** Maximum position to retrieve. */ private static final int MAX = 1000; /** Random number generator. */ static final Random RND = new Random(); /** Server reference. */ BaseXServer server; /** Result counter. */ int counter; /** * Runs the test. * @throws Exception exception */ @Test public void clients20runs20() throws Exception { run(20, 20); } /** * Runs the test. * @throws Exception exception */ @Test public void clients20runs200() throws Exception { run(20, 200); } /** * Runs the test. * @throws Exception exception */ @Test public void clients200runs20() throws Exception { run(200, 20); } /** * Runs the test. * @throws Exception exception */ @Test public void clients200runs200() throws Exception { run(200, 200); } /** * Runs the stress test. * @param clients number of clients * @param runs number of runs per client * @throws Exception exception */ private void run(final int clients, final int runs) throws Exception { // run server instance server = createServer(); // create test database final ClientSession cs = createClient(); cs.execute("create db test " + INPUT); // run clients final Client[] cl = new Client[clients]; for(int i = 0; i < clients; ++i) cl[i] = new Client(runs); for(final Client c : cl) c.start(); for(final Client c : cl) c.join(); // drop database and stop server cs.execute("drop db test"); cs.close(); stopServer(server); } /** Single client. */ static final class Client extends Thread { /** Client session. */ private final ClientSession session; /** Number of runs. */ private final int runs; /** * Constructor. * @param r number of runs * @throws Exception exception */ public Client(final int r) throws Exception { runs = r; session = createClient(); } @Override public void run() { try { // Perform some queries for(int i = 0; i < runs; ++i) { Performance.sleep((long) (50 * RND.nextDouble())); // Return nth text of the database final int n = RND.nextInt() % MAX + 1; final String qu = Util.info(QUERY, n); session.execute("xquery " + qu); } session.close(); } catch(final Exception ex) { ex.printStackTrace(); } } } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/performance/XQUFServerStressTest.java000066400000000000000000000072161222453003200316130ustar00rootroot00000000000000package org.basex.test.performance; import org.basex.*; import org.basex.core.cmd.*; import org.basex.server.*; import org.basex.test.*; import org.basex.util.*; import org.junit.*; /** * Testing concurrent XQUF statements on a single database. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class XQUFServerStressTest extends SandboxTest { /** * Runs the test. * @throws Exception exception */ @Test public void clients10runs10() throws Exception { run(10, 10); } /** * Runs the test. * @throws Exception exception */ @Test public void clients10runs50() throws Exception { run(10, 50); } /** * Runs the test. * @throws Exception exception */ @Test public void clients50runs10() throws Exception { run(50, 10); } /** * Runs the test. * @throws Exception exception */ @Test public void clients50runs50() throws Exception { run(50, 50); } /** * Runs the stress test. * @param clients number of clients * @param runs number of runs per client * @throws Exception exception */ private void run(final int clients, final int runs) throws Exception { // run server instance final BaseXServer server = createServer(); insert(clients, runs); delete(clients, runs); final ClientSession s = createClient(); s.execute(new DropDB(NAME)); s.close(); stopServer(server); } /** * Performs the query. * @param clients number of clients * @param runs number of runs * @throws Exception exception */ private static void insert(final int clients, final int runs) throws Exception { final ClientSession s = createClient(); s.execute(new CreateDB(NAME, "")); s.close(); run("insert node into doc('" + NAME + "')/doc", clients, runs); } /** * Performs the query. * @param clients number of clients * @param runs number of runs * @throws Exception exception */ private static void delete(final int clients, final int runs) throws Exception { final ClientSession s = createClient(); s.execute(new CreateDB(NAME, "")); final int c = 100 + clients * clients; s.execute(new XQuery("for $i in 1 to " + c + " return insert node into doc('" + NAME + "')/doc")); s.close(); run("delete nodes (doc('" + NAME + "')/doc/node)[1]", clients, runs); } /** * Starts concurrent client operations. * @param query test query * @param clt number of clients * @param runs number of runs * @throws Exception exception */ private static void run(final String query, final int clt, final int runs) throws Exception { final Client[] cl = new Client[clt]; for(int i = 0; i < clt; ++i) cl[i] = new Client(query, runs); for(final Client c : cl) c.start(); for(final Client c : cl) c.join(); } /** Single client. */ static final class Client extends Thread { /** Client session. */ private final ClientSession session; /** Query to be executed by this client. */ final String query; /** Number of runs. */ private final int runs; /** * Default constructor. * @param qu query string * @param r number of runs * @throws Exception exception */ Client(final String qu, final int r) throws Exception { session = createClient(); query = qu; runs = r; } @Override public void run() { try { for(int i = 0; i < runs; ++i) { Performance.sleep(100); session.execute("xquery " + query); } session.close(); } catch(final Exception ex) { ex.printStackTrace(); } } } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/performance/XQUFStressTest.java000066400000000000000000000046131222453003200304220ustar00rootroot00000000000000package org.basex.test.performance; import org.basex.core.cmd.*; import org.basex.test.*; import org.junit.*; /** * Performs bulk updates with standalone version. * * @author BaseX Team 2005-12, BSD License * @author Lukas Kircher */ public final class XQUFStressTest extends SandboxTest { /** Number of node updates. */ private static final int NRNODES = 100; /** * Tests the insert statement. * @throws Exception exception */ @Test public void insert10() throws Exception { insert(10); } /** * Tests the insert statement. * @throws Exception exception */ @Test public void insert100() throws Exception { insert(100); } /** * Tests the insert statement. * @throws Exception exception */ @Test public void insert1000() throws Exception { insert(1000); } /** * Tests the insert statement. * @param runs number of runs * @throws Exception exception */ private void insert(final int runs) throws Exception { for(int r = 0; r < runs; r++) { new CreateDB(NAME, "").execute(context); // insert query new XQuery("for $i in 1 to " + NRNODES + " return insert node " + "
    into /doc").execute(context); // actual query new XQuery( "for $page in //page " + "let $par := $page/.. " + "return (delete node $page, insert node $page before $par)"). execute(context); new DropDB(NAME).execute(context); } } /** * Tests the delete statement. * @throws Exception exception */ @Test public void delete10() throws Exception { delete(10); } /** * Tests the delete statement. * @throws Exception exception */ @Test public void delete100() throws Exception { delete(100); } /** * Tests the delete statement. * @throws Exception exception */ @Test public void delete1000() throws Exception { delete(1000); } /** * Tests the delete statement. * @param runs number of runs * @throws Exception exception */ private void delete(final int runs) throws Exception { new CreateDB(NAME, "").execute(context); for(int r = 0; r < runs; r++) { new XQuery("for $i in 1 to " + NRNODES + " return insert node into /doc").execute(context); new XQuery("delete nodes //node").execute(context); } new DropDB(NAME).execute(context); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/performance/package.html000066400000000000000000000001011222453003200271750ustar00rootroot00000000000000 Contains examples for doing performance tests. basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/000077500000000000000000000000001222453003200235015ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/AppTests.java000066400000000000000000000011711222453003200261070ustar00rootroot00000000000000package org.basex.test.qt3ts; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; import org.basex.test.qt3ts.app.*; /** * Test suite for the "app" test group. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @RunWith(Suite.class) @SuiteClasses({ AppDemos.class, AppFunctxFn.class, AppFunctxFunctx.class, AppUseCaseNS.class, AppUseCasePARTS.class, AppUseCaseR.class, AppUseCaseSEQ.class, AppUseCaseSGML.class, AppUseCaseSTRING.class, AppUseCaseTREE.class, AppUseCaseXMP.class, AppXMark.class }) public class AppTests { } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/FnTests.java000066400000000000000000000070251222453003200257360ustar00rootroot00000000000000package org.basex.test.qt3ts; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; import org.basex.test.qt3ts.fn.*; /** * Test suite for the "fn" test group. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @RunWith(Suite.class) @SuiteClasses({ FnAbs.class, FnAdjustDateTimeToTimezone.class, FnAdjustDateToTimezone.class, FnAdjustTimeToTimezone.class, FnAnalyzeString.class, FnAvailableEnvironmentVariables.class, FnAvg.class, FnBaseUri.class, FnBoolean.class, FnCeiling.class, FnCodepointEqual.class, FnCodepointsToString.class, FnCollection.class, FnCompare.class, FnConcat.class, FnContains.class, FnCount.class, FnCurrentDate.class, FnCurrentDateTime.class, FnCurrentTime.class, FnData.class, FnDateTime.class, FnDayFromDate.class, FnDayFromDateTime.class, FnDaysFromDuration.class, FnDeepEqual.class, FnDefaultCollation.class, FnDistinctValues.class, FnDoc.class, FnDocAvailable.class, FnDocumentUri.class, FnEmpty.class, FnEncodeForUri.class, FnEndsWith.class, FnEnvironmentVariable.class, FnError.class, FnEscapeHtmlUri.class, FnExactlyOne.class, FnExists.class, FnFalse.class, FnFilter.class, FnFloor.class, FnFoldLeft.class, FnFoldRight.class, FnFormatDate.class, FnFormatDateTime.class, FnFormatInteger.class, FnFormatNumber.class, FnFormatTime.class, FnFunctionArity.class, FnFunctionLookup.class, FnFunctionName.class, FnGenerateId.class, FnHasChildren.class, FnHead.class, FnHoursFromDateTime.class, FnHoursFromDuration.class, FnHoursFromTime.class, FnId.class, FnIdref.class, FnImplicitTimezone.class, FnInScopePrefixes.class, FnIndexOf.class, FnInnermost.class, FnInsertBefore.class, FnIriToUri.class, FnLang.class, FnLast.class, FnLocalName.class, FnLocalNameFromQName.class, FnLowerCase.class, FnMap.class, FnMapPairs.class, FnMatches.class, FnMatchesRe.class, FnMax.class, FnMin.class, FnMinutesFromDateTime.class, FnMinutesFromDuration.class, FnMinutesFromTime.class, FnMonthFromDate.class, FnMonthFromDateTime.class, FnMonthsFromDuration.class, FnName.class, FnNamespaceUri.class, FnNamespaceUriForPrefix.class, FnNamespaceUriFromQName.class, FnNilled.class, FnNodeName.class, FnNormalizeSpace.class, FnNormalizeUnicode.class, FnNot.class, FnNumber.class, FnOneOrMore.class, FnOutermost.class, FnParseXml.class, FnParseXmlFragment.class, FnPath.class, FnPosition.class, FnPrefixFromQName.class, FnQName.class, FnRemove.class, FnReplace.class, FnResolveQName.class, FnResolveUri.class, FnReverse.class, FnRoot.class, FnRound.class, FnRoundHalfToEven.class, FnSecondsFromDateTime.class, FnSecondsFromDuration.class, FnSecondsFromTime.class, FnSerialize.class, FnStartsWith.class, FnStaticBaseUri.class, FnString.class, FnStringJoin.class, FnStringLength.class, FnStringToCodepoints.class, FnSubsequence.class, FnSubstring.class, FnSubstringAfter.class, FnSubstringBefore.class, FnSum.class, FnTail.class, FnTimezoneFromDate.class, FnTimezoneFromDateTime.class, FnTimezoneFromTime.class, FnTokenize.class, FnTrace.class, FnTranslate.class, FnTrue.class, FnUnordered.class, FnUnparsedText.class, FnUnparsedTextAvailable.class, FnUnparsedTextLines.class, FnUpperCase.class, FnUriCollection.class, FnYearFromDate.class, FnYearFromDateTime.class, FnYearsFromDuration.class, FnZeroOrOne.class }) public class FnTests { } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/MathTests.java000066400000000000000000000011451222453003200262610ustar00rootroot00000000000000package org.basex.test.qt3ts; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; import org.basex.test.qt3ts.math.*; /** * Test suite for the "math" test group. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @RunWith(Suite.class) @SuiteClasses({ MathAcos.class, MathAsin.class, MathAtan.class, MathAtan2.class, MathCos.class, MathExp.class, MathExp10.class, MathLog.class, MathLog10.class, MathPi.class, MathPow.class, MathSin.class, MathSqrt.class, MathTan.class }) public class MathTests { } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/MiscTests.java000066400000000000000000000011451222453003200262630ustar00rootroot00000000000000package org.basex.test.qt3ts; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; import org.basex.test.qt3ts.misc.*; /** * Test suite for the "misc" test group. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @RunWith(Suite.class) @SuiteClasses({ MiscAnnexE.class, MiscAppendixA4.class, MiscCombinedErrorCodes.class, MiscErrorsAndOptimization.class, MiscHigherOrderFunctions.class, MiscSerialization.class, MiscStaticContext.class, MiscSurrogates.class, MiscXMLEdition.class }) public class MiscTests { } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/OpTests.java000066400000000000000000000050011222453003200257410ustar00rootroot00000000000000package org.basex.test.qt3ts; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; import org.basex.test.qt3ts.op.*; /** * Test suite for the "op" test group. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @RunWith(Suite.class) @SuiteClasses({ OpAddDayTimeDurationToDate.class, OpAddDayTimeDurationToDateTime.class, OpAddDayTimeDurationToTime.class, OpAddDayTimeDurations.class, OpAddYearMonthDurationToDate.class, OpAddYearMonthDurationToDateTime.class, OpAddYearMonthDurations.class, OpAnyURIEqual.class, OpAnyURIGreaterThan.class, OpAnyURILessThan.class, OpBang.class, OpBase64BinaryEqual.class, OpBooleanEqual.class, OpBooleanGreaterThan.class, OpBooleanLessThan.class, OpConcat.class, OpConcatenate.class, OpDateEqual.class, OpDateGreaterThan.class, OpDateLessThan.class, OpDateTimeEqual.class, OpDateTimeGreaterThan.class, OpDateTimeLessThan.class, OpDayTimeDurationGreaterThan.class, OpDayTimeDurationLessThan.class, OpDivideDayTimeDuration.class, OpDivideDayTimeDurationByDayTimeDuration.class, OpDivideYearMonthDuration.class, OpDivideYearMonthDurationByYearMonthDuration.class, OpDurationEqual.class, OpExcept.class, OpGDayEqual.class, OpGMonthDayEqual.class, OpGMonthEqual.class, OpGYearEqual.class, OpGYearMonthEqual.class, OpHexBinaryEqual.class, OpIntersect.class, OpIsSameNode.class, OpMultiplyDayTimeDuration.class, OpMultiplyYearMonthDuration.class, OpNodeAfter.class, OpNodeBefore.class, OpNumericAdd.class, OpNumericDivide.class, OpNumericEqual.class, OpNumericGreaterThan.class, OpNumericIntegerDivide.class, OpNumericLessThan.class, OpNumericMod.class, OpNumericMultiply.class, OpNumericSubtract.class, OpNumericUnaryMinus.class, OpNumericUnaryPlus.class, OpQNameEqual.class, OpStringEqual.class, OpStringGreaterThan.class, OpStringLessThan.class, OpSubtractDateTimes.class, OpSubtractDates.class, OpSubtractDayTimeDurationFromDate.class, OpSubtractDayTimeDurationFromDateTime.class, OpSubtractDayTimeDurationFromTime.class, OpSubtractDayTimeDurations.class, OpSubtractTimes.class, OpSubtractYearMonthDurationFromDate.class, OpSubtractYearMonthDurationFromDateTime.class, OpSubtractYearMonthDurations.class, OpTimeEqual.class, OpTimeGreaterThan.class, OpTimeLessThan.class, OpTo.class, OpUnion.class, OpYearMonthDurationGreaterThan.class, OpYearMonthDurationLessThan.class }) public class OpTests { } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/ProdTests.java000066400000000000000000000053221222453003200262750ustar00rootroot00000000000000package org.basex.test.qt3ts; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; import org.basex.test.qt3ts.prod.*; /** * Test suite for the "prod" test group. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @RunWith(Suite.class) @SuiteClasses({ ProdAllowingEmpty.class, ProdAnnotation.class, ProdAxisStep.class, ProdAxisStepAbbr.class, ProdAxisStepAncestor.class, ProdAxisStepAncestorOrSelf.class, ProdAxisStepFollowing.class, ProdAxisStepFollowingSibling.class, ProdAxisStepPreceding.class, ProdAxisStepPrecedingSibling.class, ProdAxisStepUnabbr.class, ProdBaseURIDecl.class, ProdBoundarySpaceDecl.class, ProdCastExpr.class, ProdCastExprDerived.class, ProdCastableExpr.class, ProdComment.class, ProdCompAttrConstructor.class, ProdCompCommentConstructor.class, ProdCompDocConstructor.class, ProdCompElemConstructor.class, ProdCompNamespaceConstructor.class, ProdCompPIConstructor.class, ProdCompTextConstructor.class, ProdConstructionDecl.class, ProdContextItemDecl.class, ProdContextItemExpr.class, ProdCopyNamespacesDecl.class, ProdCountClause.class, ProdDecimalFormatDecl.class, ProdDefaultCollationDecl.class, ProdDefaultNamespaceDecl.class, ProdDirAttributeList.class, ProdDirElemConstructor.class, ProdDirElemContent.class, ProdDirElemContentNamespace.class, ProdDirElemContentWhitespace.class, ProdDirectConstructor.class, ProdEQName.class, ProdEmptyOrderDecl.class, ProdExtensionExpr.class, ProdForClause.class, ProdFunctionCall.class, ProdFunctionDecl.class, ProdGeneralCompEq.class, ProdGeneralCompGe.class, ProdGeneralCompGt.class, ProdGeneralCompLe.class, ProdGeneralCompLt.class, ProdGeneralCompNe.class, ProdGroupByClause.class, ProdIfExpr.class, ProdInstanceofExpr.class, ProdLetClause.class, ProdLiteral.class, ProdModuleImport.class, ProdNameTest.class, ProdNamedFunctionRef.class, ProdNamespaceDecl.class, ProdNodeTest.class, ProdOptionDecl.class, ProdOptionDeclSerialization.class, ProdOrExpr.class, ProdOrderByClause.class, ProdOrderingModeDecl.class, ProdParenthesizedExpr.class, ProdPathExpr.class, ProdPositionalVar.class, ProdPredicate.class, ProdQuantifiedExpr.class, ProdRequireProhibitFeature.class, ProdReturnClause.class, ProdSequenceType.class, ProdStepExpr.class, ProdSwitchExpr.class, ProdTreatExpr.class, ProdTryCatchExpr.class, ProdTypeswitchExpr.class, ProdUnorderedExpr.class, ProdValueComp.class, ProdVarDecl.class, ProdVarDeclExternal.class, ProdVarDefaultValue.class, ProdVersionDecl.class, ProdWhereClause.class, ProdWindowClause.class }) public class ProdTests { } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/XsTests.java000066400000000000000000000007671222453003200257730ustar00rootroot00000000000000package org.basex.test.qt3ts; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; import org.basex.test.qt3ts.xs.*; /** * Test suite for the "xs" test group. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @RunWith(Suite.class) @SuiteClasses({ XsAnyURI.class, XsBase64Binary.class, XsDouble.class, XsFloat.class, XsHexBinary.class, XsNormalizedString.class, XsToken.class }) public class XsTests { } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/app/000077500000000000000000000000001222453003200242615ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/app/AppDemos.java000066400000000000000000002417431222453003200266470ustar00rootroot00000000000000package org.basex.test.qt3ts.app; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Some XQuery demonstration programs from CBCL. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class AppDemos extends QT3TestSet { /** * Draw an SVG of currency exchange data.. */ @org.junit.Test public void currencysvg() { final XQuery query = new XQuery( queryFile( file( "app/Demos/currencysvg.xq" ) ), ctx); try { query.context(node(file("app/Demos/GBPNoon.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Foreign Exchange UK Pound Noon RatesGenerated by XQSharp1994-01-062008-10-292.11041.373AverageLargest 1-day riseLargest 1-day fallLargest 5-day riseLargest 5-day fallLargest 90-day riseLargest 90-day fallLargest 365-day riseLargest 365-day fall", false) ); } /** * Magic number identifying the file as a "plain" ppm file width and height Maximum color value : Now the pixel data. We take each pixel in the image, and recenter it, so that the : y co-ordinate ($y-recentered) ranges from -0.5 at the bottom of the image, to 0.5 : at the top of the image. : : The aspect ratio is used to "stretch" the range of x-coordinate values to stop the : image from being skewed. plot-pixel returns us the rgb values of the color of this pixel. We convert these to an integer value in the range [0, 255], and output them. . */ @org.junit.Test public void raytracer() { final XQuery query = new XQuery( "\n" + " import module namespace raytracer=\"http://www.xqsharp.com/raytracer\";\n" + " import module namespace scene=\"http://www.xqsharp.com/raytracer/scene\";\n" + " declare variable $width := 64;\n" + " declare variable $height := 64;\n" + " declare variable $input-context := .;\n" + " declare variable $scene := scene:prepare-scene($input-context/scene);\n" + " string-join( ( \"P3\", string-join((string($width), string($height)), \" \"), \"255\", (: : Now the pixel data. We take each pixel in the image, and recenter it, so that the : y co-ordinate ($y-recentered) ranges from -0.5 at the bottom of the image, to 0.5 : at the top of the image. : : The aspect ratio is used to \"stretch\" the range of x-coordinate values to stop the : image from being skewed. :) \n" + " let $aspect-ratio := $width div $height \n" + " for $y in 1 to $height \n" + " let $y-recentered := ((-$y div $height) + 0.5) \n" + " for $x in 1 to $width \n" + " let $x-recentered := (($x div $width) - 0.5) * $aspect-ratio \n" + " return (: plot-pixel returns us the rgb values of the color of this pixel. \n" + " \t\t We convert these to an integer value in the range [0, 255], and output them. :) \n" + " \tstring-join( for $channel in raytracer:plot-pixel($scene, $x-recentered, $y-recentered) \n" + " \t\t\t return string(floor($channel * 255)), \" \") ), \" \" )\n" + " ", ctx); try { query.context(node(file("app/Demos/scene.xml"))); query.addModule("http://www.xqsharp.com/raytracer/materials", file("app/Demos/materials.xq")); query.addModule("http://www.xqsharp.com/raytracer/scene", file("app/Demos/scene.xq")); query.addModule("http://www.xqsharp.com/raytracer", file("app/Demos/raytracer.xq")); query.addModule("http://www.xqsharp.com/raytracer/vector", file("app/Demos/vector.xq")); query.addModule("http://www.xqsharp.com/raytracer/math", file("app/Demos/math.xq")); query.addModule("http://www.xqsharp.com/raytracer/shapes", file("app/Demos/shapes.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertQuery("starts-with(normalize-space(string-join($result, ' ')), 'P3 64 64 255 0 0 0')") && assertQuery("ends-with(normalize-space(string-join($result, ' ')), '125 119 179 125 118 178 124 118 177 124 117 176')") ) ); } /** * A sudoku solver . */ @org.junit.Test public void sudoku() { final XQuery query = new XQuery( "\n" + " declare namespace fn = \"sudoku\";\n" + " declare variable $board as xs:integer+ := \n" + " \t( 1,0,0, 3,0,0, 6,0,0, 0,2,0, 5,0,0, 0,0,4, 0,0,9, 0,0,0, \n" + " \t5,2,0, 0,0,0, 9,6,3, 0,0,0, 7,1,6, 0,0,0, 0,0,0, 0,0,0, \n" + " \t0,8,0, 0,4,0, 9,0,0, 0,0,5, 3,0,7, 8,0,0, 4,0,6, 0,0,0, \n" + " \t3,5,0, 0,0,0, 0,0,1);\n" + " declare variable $rowStarts as xs:integer+ := (1, 10, 19, 28, 37, 46, 55, 64,73);\n" + " declare variable $groups as xs:integer+ := \n" + " \t( 1,1,1, 2,2,2, 3,3,3, 1,1,1, 2,2,2, 3,3,3, 1,1,1, 2,2,2, 3,3,3, 4,4,4, \n" + " \t5,5,5, 6,6,6, 4,4,4, 5,5,5, 6,6,6, 4,4,4, 5,5,5, 6,6,6, 7,7,7, 8,8,8, \n" + " \t9,9,9, 7,7,7, 8,8,8, 9,9,9, 7,7,7, 8,8,8, 9,9,9 );\n" + " declare function fn:getRow ($board as xs:integer+, $index as xs:integer) as xs:integer+ { \n" + " \tlet $rowStart := floor(($index - 1) div 9) * 9 \n" + " \treturn one-or-more($board[position() > $rowStart and position() <= $rowStart + 9]) \n" + " };\n" + " declare function fn:getCol ($board as xs:integer+, $index as xs:integer) as xs:integer+ { \n" + " \tlet $gap := ($index - 1) mod 9, \n" + " \t $colIndexes := for $x in $rowStarts \n" + " \t \t\t return $x + $gap \n" + " \treturn one-or-more($board[position() = $colIndexes]) \n" + " };\n" + " declare function fn:getGroup ($board as xs:integer+, $index as xs:integer) as xs:integer+ { \n" + " \tlet $group := $groups[$index] \n" + " \treturn one-or-more($board[for $x in position() return $groups[$x]= $group]) \n" + " };\n" + " declare function fn:getAllowedValues ($board as xs:integer+, $index as xs:integer) as xs:integer* { \n" + " \tlet $existingValues := (fn:getRow($board, $index), fn:getCol($board, $index), fn:getGroup($board, $index)) \n" + " \treturn for $x in (1 to 9) return if (not($x = $existingValues)) then $x else () \n" + " };\n" + " declare function fn:tryValues($board as xs:integer+, $emptyCells as xs:integer+, $possibleValues as xs:integer+) as xs:integer* { \n" + " \tlet $index as xs:integer := $emptyCells[1], \n" + " \t $newBoard as xs:integer+ := ($board[position() <$index], $possibleValues[1], $board[position() > $index]), \n" + " \t $result as xs:integer* := fn:populateValues($newBoard, $emptyCells[position() != 1]) \n" + " \treturn if (empty($result)) then if (count($possibleValues) > 1) then fn:tryValues($board, $emptyCells, one-or-more($possibleValues[position() != 1])) else () else $result \n" + " };\n" + " declare function fn:populateValues($board as xs:integer+, $emptyCells as xs:integer*) as xs:integer*{ \n" + " \tif (not(empty($emptyCells))) \n" + " \tthen let $index as xs:integer := exactly-one($emptyCells[1]), \n" + " \t\t\t $possibleValues as xs:integer* := distinct-values(fn:getAllowedValues($board, $index)) \n" + " \t\t return if (count($possibleValues) > 1) \n" + " \t\t then fn:tryValues($board, one-or-more($emptyCells), one-or-more($possibleValues)) \n" + " \t\t else if (count($possibleValues) = 1) \n" + " \t\t then let $newBoard as xs:integer+ :=($board[position() < $index], \n" + " \t\t exactly-one($possibleValues[1]), $board[position() > $index]) \n" + " \t\t return fn:populateValues($newBoard, $emptyCells[position() != 1]) \n" + " \t\t else () \n" + " \telse $board \n" + " };\n" + " declare function fn:solveSudoku ($startBoard as xs:integer+) as xs:integer+{ \n" + " \tlet $emptyCells as xs:integer* :=\n" + " \t\t\tfor $x in (1 to 81) \n" + " \t\t\treturn if ($startBoard[$x] = 0) then $x else (), \n" + " \t\t$endBoard as xs:integer* :=fn:populateValues($startBoard,$emptyCells) \n" + " \treturn if (empty($endBoard)) then $startBoard else one-or-more($endBoard)\n" + " };\n" + " declare function fn:drawResult ($board as xs:integer+) as element(){ \n" + " \tSudoku - XSLT{fn:drawBoard($board)} };\n" + " declare function fn:drawBoard ($board as xs:integer+) as element(){ \n" + " \t{for $i in 1 to 9 return \n" + " \t\t{for $j at $p in 1 to 9 \n" + " \t\t\t let $pos := (($i - 1) * 9) + $j \n" + " \t\t\t return \n" + " \t\t\t } }
    {$board[$pos]}
    \n" + " };\n" + " fn:drawResult(fn:solveSudoku($board))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Sudoku - XSLT
    185342679
    627598134
    439617528
    248963715
    716254893
    593781246
    964125387
    871436952
    352879461
    ", false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/app/AppFunctxFn.java000066400000000000000000007171171222453003200273360ustar00rootroot00000000000000package org.basex.test.qt3ts.app; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests derived from the functx library . * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class AppFunctxFn extends QT3TestSet { /** . */ @org.junit.Test public void functxFnQName1() { final XQuery query = new XQuery( "(QName('http://datypic.com/prod','product'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "product") ); } /** . */ @org.junit.Test public void functxFnQName2() { final XQuery query = new XQuery( "(QName('http://datypic.com/prod', 'pre:product'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "pre:product") ); } /** . */ @org.junit.Test public void functxFnQName3() { final XQuery query = new XQuery( "(QName('', 'product'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "product") ); } /** . */ @org.junit.Test public void functxFnQNameAll() { final XQuery query = new XQuery( "(QName('http://datypic.com/prod','product'), QName('http://datypic.com/prod', 'pre:product'), QName('', 'product'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "product pre:product product") ); } /** . */ @org.junit.Test public void functxFnAbs1() { final XQuery query = new XQuery( "(abs(3.5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3.5") ); } /** . */ @org.junit.Test public void functxFnAbs2() { final XQuery query = new XQuery( "(abs(-4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("4") ); } /** . */ @org.junit.Test public void functxFnAbs3() { final XQuery query = new XQuery( "(abs(xs:float('-INF')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** . */ @org.junit.Test public void functxFnAbsAll() { final XQuery query = new XQuery( "(abs(3.5), abs(-4), abs(xs:float('-INF')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3.5 4 INF") ); } /** . */ @org.junit.Test public void functxFnAdjustDateToTimezone1() { final XQuery query = new XQuery( "(adjust-date-to-timezone( xs:date('2006-02-15'), xs:dayTimeDuration('-PT8H')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2006-02-15-08:00") ); } /** . */ @org.junit.Test public void functxFnAdjustDateToTimezone2() { final XQuery query = new XQuery( "(adjust-date-to-timezone( xs:date('2006-02-15-03:00'), xs:dayTimeDuration('-PT8H')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2006-02-14-08:00") ); } /** . */ @org.junit.Test public void functxFnAdjustDateToTimezone3() { final XQuery query = new XQuery( "(adjust-date-to-timezone( xs:date('2006-02-15'), ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2006-02-15") ); } /** . */ @org.junit.Test public void functxFnAdjustDateToTimezone4() { final XQuery query = new XQuery( "(adjust-date-to-timezone( xs:date('2006-02-15-03:00'), ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2006-02-15") ); } /** . */ @org.junit.Test public void functxFnAdjustDateToTimezoneAll() { final XQuery query = new XQuery( "(adjust-date-to-timezone( xs:date('2006-02-15'), xs:dayTimeDuration('-PT8H')), adjust-date-to-timezone( xs:date('2006-02-15-03:00'), xs:dayTimeDuration('-PT8H')), adjust-date-to-timezone( xs:date('2006-02-15'), ()), adjust-date-to-timezone( xs:date('2006-02-15-03:00'), ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2006-02-15-08:00 2006-02-14-08:00 2006-02-15 2006-02-15") ); } /** . */ @org.junit.Test public void functxFnAdjustDateTimeToTimezone1() { final XQuery query = new XQuery( "(adjust-dateTime-to-timezone( xs:dateTime('2006-02-15T17:00:00'), xs:dayTimeDuration('-PT7H')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2006-02-15T17:00:00-07:00") ); } /** . */ @org.junit.Test public void functxFnAdjustDateTimeToTimezone2() { final XQuery query = new XQuery( "(adjust-dateTime-to-timezone( xs:dateTime('2006-02-15T17:00:00-03:00'), xs:dayTimeDuration('-PT7H')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2006-02-15T13:00:00-07:00") ); } /** . */ @org.junit.Test public void functxFnAdjustDateTimeToTimezone3() { final XQuery query = new XQuery( "(adjust-dateTime-to-timezone( xs:dateTime('2006-02-15T17:00:00'), ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2006-02-15T17:00:00") ); } /** . */ @org.junit.Test public void functxFnAdjustDateTimeToTimezone4() { final XQuery query = new XQuery( "(adjust-dateTime-to-timezone( xs:dateTime('2006-02-15T17:00:00-03:00'), ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2006-02-15T17:00:00") ); } /** . */ @org.junit.Test public void functxFnAdjustDateTimeToTimezone5() { final XQuery query = new XQuery( "(adjust-dateTime-to-timezone( xs:dateTime('2006-02-15T01:00:00-03:00'), xs:dayTimeDuration('-PT7H')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2006-02-14T21:00:00-07:00") ); } /** . */ @org.junit.Test public void functxFnAdjustDateTimeToTimezoneAll() { final XQuery query = new XQuery( "(adjust-dateTime-to-timezone( xs:dateTime('2006-02-15T17:00:00'), xs:dayTimeDuration('-PT7H')), adjust-dateTime-to-timezone( xs:dateTime('2006-02-15T17:00:00-03:00'), xs:dayTimeDuration('-PT7H')), adjust-dateTime-to-timezone( xs:dateTime('2006-02-15T17:00:00'), ()), adjust-dateTime-to-timezone( xs:dateTime('2006-02-15T17:00:00-03:00'), ()), adjust-dateTime-to-timezone( xs:dateTime('2006-02-15T01:00:00-03:00'), xs:dayTimeDuration('-PT7H')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2006-02-15T17:00:00-07:00 2006-02-15T13:00:00-07:00 2006-02-15T17:00:00 2006-02-15T17:00:00 2006-02-14T21:00:00-07:00") ); } /** . */ @org.junit.Test public void functxFnAdjustTimeToTimezone1() { final XQuery query = new XQuery( "(adjust-time-to-timezone( xs:time('17:00:00'), xs:dayTimeDuration('-PT7H')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "17:00:00-07:00") ); } /** . */ @org.junit.Test public void functxFnAdjustTimeToTimezone2() { final XQuery query = new XQuery( "(adjust-time-to-timezone( xs:time('17:00:00-03:00'), xs:dayTimeDuration('-PT7H')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "13:00:00-07:00") ); } /** . */ @org.junit.Test public void functxFnAdjustTimeToTimezone3() { final XQuery query = new XQuery( "(adjust-time-to-timezone( xs:time('17:00:00'), ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "17:00:00") ); } /** . */ @org.junit.Test public void functxFnAdjustTimeToTimezone4() { final XQuery query = new XQuery( "(adjust-time-to-timezone( xs:time('17:00:00-03:00'), ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "17:00:00") ); } /** . */ @org.junit.Test public void functxFnAdjustTimeToTimezoneAll() { final XQuery query = new XQuery( "(adjust-time-to-timezone( xs:time('17:00:00'), xs:dayTimeDuration('-PT7H')), adjust-time-to-timezone( xs:time('17:00:00-03:00'), xs:dayTimeDuration('-PT7H')), adjust-time-to-timezone( xs:time('17:00:00'), ()), adjust-time-to-timezone( xs:time('17:00:00-03:00'), ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "17:00:00-07:00 13:00:00-07:00 17:00:00 17:00:00") ); } /** . */ @org.junit.Test public void functxFnAvg1() { final XQuery query = new XQuery( "(avg( (1, 2, 3, 4, 5) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** . */ @org.junit.Test public void functxFnAvg2() { final XQuery query = new XQuery( "(avg( (1, 2, 3, (), 4, 5) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** . */ @org.junit.Test public void functxFnAvg3() { final XQuery query = new XQuery( "(avg( (xs:yearMonthDuration('P4M'), xs:yearMonthDuration('P6M') ) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P5M") ); } /** . */ @org.junit.Test public void functxFnAvg4() { final XQuery query = new XQuery( "let $ordDoc := (/) return (avg($ordDoc//item/@quantity))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.1666666666666667") ); } /** . */ @org.junit.Test public void functxFnAvg5() { final XQuery query = new XQuery( "let $ordDoc := (/) return (avg( () ))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnAvgAll() { final XQuery query = new XQuery( "let $ordDoc := (/) return (avg( (1, 2, 3, 4, 5) ), avg( (1, 2, 3, (), 4, 5) ), avg( (xs:yearMonthDuration('P4M'), xs:yearMonthDuration('P6M') ) ), avg($ordDoc//item/@quantity), avg( () ))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("3, 3, xs:yearMonthDuration('P5M'), 1.1666666666666667") ); } /** . */ @org.junit.Test public void functxFnBaseUri1() { final XQuery query = new XQuery( "let $cats := (/) return (base-uri($cats//catalog[1]))", ctx); try { query.context(node(file("app/FunctxFn/functx_cats.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.org/ACC/") ); } /** . */ @org.junit.Test public void functxFnBaseUri2() { final XQuery query = new XQuery( "let $cats := (/) return (base-uri($cats//catalog[2]/product))", ctx); try { query.context(node(file("app/FunctxFn/functx_cats.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.org/WMN/") ); } /** . */ @org.junit.Test public void functxFnBaseUri3() { final XQuery query = new XQuery( "let $cats := (/) return (base-uri($cats//catalog[2]/product/@href))", ctx); try { query.context(node(file("app/FunctxFn/functx_cats.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.org/WMN/") ); } /** . */ @org.junit.Test public void functxFnBaseUriAll() { final XQuery query = new XQuery( "let $cats := (/) return (base-uri($cats//catalog[1]), base-uri($cats//catalog[2]/product), base-uri($cats//catalog[2]/product/@href))", ctx); try { query.context(node(file("app/FunctxFn/functx_cats.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.org/ACC/ http://example.org/WMN/ http://example.org/WMN/") ); } /** . */ @org.junit.Test public void functxFnBoolean1() { final XQuery query = new XQuery( "let $ordDoc := (/) return (boolean( () ))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnBoolean2() { final XQuery query = new XQuery( "let $ordDoc := (/) return (boolean(''))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnBoolean3() { final XQuery query = new XQuery( "let $ordDoc := (/) return (boolean(0))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnBoolean4() { final XQuery query = new XQuery( "let $ordDoc := (/) return (boolean('0'))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnBoolean5() { final XQuery query = new XQuery( "let $ordDoc := (/) return (boolean('false'))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnBoolean6() { final XQuery query = new XQuery( "let $ordDoc := (/) return (boolean(xs:float('NaN')))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnBoolean7() { final XQuery query = new XQuery( "let $ordDoc := (/) return (boolean($ordDoc/order[1]))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnBoolean8() { final XQuery query = new XQuery( "let $ordDoc := (/) return (boolean($ordDoc/noSuchChild))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnBoolean9() { final XQuery query = new XQuery( "let $ordDoc := (/) return (boolean(false))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnBooleanAll() { final XQuery query = new XQuery( "let $ordDoc := (/) return (boolean( () ), boolean(''), boolean(0), boolean('0'), boolean('false'), boolean(xs:float('NaN')), boolean($ordDoc/order[1]), boolean($ordDoc/noSuchChild), boolean(false))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "false false false true true false true false true") ); } /** . */ @org.junit.Test public void functxFnCeiling1() { final XQuery query = new XQuery( "(ceiling(5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** . */ @org.junit.Test public void functxFnCeiling2() { final XQuery query = new XQuery( "(ceiling(5.1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("6") ); } /** . */ @org.junit.Test public void functxFnCeiling3() { final XQuery query = new XQuery( "(ceiling(5.5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("6") ); } /** . */ @org.junit.Test public void functxFnCeiling4() { final XQuery query = new XQuery( "(ceiling(-5.5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-5") ); } /** . */ @org.junit.Test public void functxFnCeiling5() { final XQuery query = new XQuery( "(ceiling(-5.51))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-5") ); } /** . */ @org.junit.Test public void functxFnCeiling6() { final XQuery query = new XQuery( "(ceiling( () ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnCeilingAll() { final XQuery query = new XQuery( "(ceiling(5), ceiling(5.1), ceiling(5.5), ceiling(-5.5), ceiling(-5.51), ceiling( () ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5 6 6 -5 -5") ); } /** . */ @org.junit.Test public void functxFnCodepointEqual1() { final XQuery query = new XQuery( "(codepoint-equal('abc', 'abc'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnCodepointEqual2() { final XQuery query = new XQuery( "(codepoint-equal('abc', 'ab c'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnCodepointEqual3() { final XQuery query = new XQuery( "(codepoint-equal('abc', ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnCodepointEqualAll() { final XQuery query = new XQuery( "(codepoint-equal('abc', 'abc'), codepoint-equal('abc', 'ab c'), codepoint-equal('abc', ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true false") ); } /** . */ @org.junit.Test public void functxFnCodepointsToString1() { final XQuery query = new XQuery( "(codepoints-to-string((97, 32, 98, 32, 99)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b c") ); } /** . */ @org.junit.Test public void functxFnCodepointsToString2() { final XQuery query = new XQuery( "(codepoints-to-string(97))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a") ); } /** . */ @org.junit.Test public void functxFnCodepointsToString3() { final XQuery query = new XQuery( "(codepoints-to-string(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnCodepointsToStringAll() { final XQuery query = new XQuery( "(codepoints-to-string((97, 32, 98, 32, 99)), codepoints-to-string(97), codepoints-to-string(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b c a ") ); } /** . */ @org.junit.Test public void functxFnCompare1() { final XQuery query = new XQuery( "(compare('a', 'b'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** . */ @org.junit.Test public void functxFnCompare2() { final XQuery query = new XQuery( "(compare('a', 'a'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** . */ @org.junit.Test public void functxFnCompare3() { final XQuery query = new XQuery( "(compare('b', 'a'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** . */ @org.junit.Test public void functxFnCompare4() { final XQuery query = new XQuery( "(compare('ab', 'abc'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** . */ @org.junit.Test public void functxFnCompare5() { final XQuery query = new XQuery( "(compare('a', 'B'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** . */ @org.junit.Test public void functxFnCompare6() { final XQuery query = new XQuery( "(compare(upper-case('a'), upper-case('B')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** . */ @org.junit.Test public void functxFnCompare7() { final XQuery query = new XQuery( "(compare('a', ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnCompareAll() { final XQuery query = new XQuery( "(compare('a', 'b'), compare('a', 'a'), compare('b', 'a'), compare('ab', 'abc'), compare('a', 'B'), compare(upper-case('a'), upper-case('B')), compare('a', ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1 0 1 -1 1 -1") ); } /** . */ @org.junit.Test public void functxFnConcat1() { final XQuery query = new XQuery( "(concat('a', 'b'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ab") ); } /** . */ @org.junit.Test public void functxFnConcat2() { final XQuery query = new XQuery( "(concat('a', 'b', 'c'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc") ); } /** . */ @org.junit.Test public void functxFnConcat3() { final XQuery query = new XQuery( "(concat('a', (), 'b', '', 'c'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc") ); } /** . */ @org.junit.Test public void functxFnConcat4() { final XQuery query = new XQuery( "(concat('a', b, 'c'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc") ); } /** . */ @org.junit.Test public void functxFnConcatAll() { final XQuery query = new XQuery( "(concat('a', 'b'), concat('a', 'b', 'c'), concat('a', (), 'b', '', 'c'), concat('a', b, 'c'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ab abc abc abc") ); } /** . */ @org.junit.Test public void functxFnContains1() { final XQuery query = new XQuery( "(contains('query', 'e'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnContains2() { final XQuery query = new XQuery( "(contains('query', 'ery'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnContains3() { final XQuery query = new XQuery( "(contains('query', 'query'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnContains4() { final XQuery query = new XQuery( "(contains('query', 'x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnContains5() { final XQuery query = new XQuery( "(contains('query', ''))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnContains6() { final XQuery query = new XQuery( "(contains('query', ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnContains7() { final XQuery query = new XQuery( "(contains( (), 'q'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnContainsAll() { final XQuery query = new XQuery( "(contains('query', 'e'), contains('query', 'ery'), contains('query', 'query'), contains('query', 'x'), contains('query', ''), contains('query', ()), contains( (), 'q'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true true false true true false") ); } /** . */ @org.junit.Test public void functxFnCount1() { final XQuery query = new XQuery( "let $ordDoc := (/) return (count( (1, 2, 3) ))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** . */ @org.junit.Test public void functxFnCount2() { final XQuery query = new XQuery( "let $ordDoc := (/) return (count($ordDoc//item))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("6") ); } /** . */ @org.junit.Test public void functxFnCount3() { final XQuery query = new XQuery( "let $ordDoc := (/) return (count( distinct-values($ordDoc//item/@num)))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("4") ); } /** . */ @org.junit.Test public void functxFnCount4() { final XQuery query = new XQuery( "let $ordDoc := (/) return (count( (1, 2, 3, () ) ))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** . */ @org.junit.Test public void functxFnCount5() { final XQuery query = new XQuery( "let $ordDoc := (/) return (count( () ))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** . */ @org.junit.Test public void functxFnCountAll() { final XQuery query = new XQuery( "let $ordDoc := (/) return (count( (1, 2, 3) ), count($ordDoc//item), count( distinct-values($ordDoc//item/@num)), count( (1, 2, 3, () ) ), count( () ))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3 6 4 3 0") ); } /** . */ @org.junit.Test public void functxFnData1() { final XQuery query = new XQuery( "let $cat := (/) return (data($cat//product[1]/number))", ctx); try { query.context(node(file("app/FunctxFn/functx_catalog.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "557") ); } /** . */ @org.junit.Test public void functxFnData2() { final XQuery query = new XQuery( "let $cat := (/) return (data($cat//number))", ctx); try { query.context(node(file("app/FunctxFn/functx_catalog.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "557 563 443 784") ); } /** . */ @org.junit.Test public void functxFnData3() { final XQuery query = new XQuery( "let $cat := (/) return (data($cat//product[1]/@dept))", ctx); try { query.context(node(file("app/FunctxFn/functx_catalog.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "WMN") ); } /** . */ @org.junit.Test public void functxFnData4() { final XQuery query = new XQuery( "let $cat := (/) return (data($cat//product[1]/colorChoices))", ctx); try { query.context(node(file("app/FunctxFn/functx_catalog.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "navy black") ); } /** . */ @org.junit.Test public void functxFnData5() { final XQuery query = new XQuery( "let $cat := (/) return (data($cat//product[1]))", ctx); try { query.context(node(file("app/FunctxFn/functx_catalog.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "557 Fleece Pullover navy black") ); } /** . */ @org.junit.Test public void functxFnData6() { final XQuery query = new XQuery( "let $cat := (/) return (data($cat//product[4]/desc))", ctx); try { query.context(node(file("app/FunctxFn/functx_catalog.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Our favorite shirt!") ); } /** . */ @org.junit.Test public void functxFnDataAll() { final XQuery query = new XQuery( "let $cat := (/) return (data($cat//product[1]/number), data($cat//number), data($cat//product[1]/@dept), data($cat//product[1]/colorChoices), data($cat//product[1]), data($cat//product[4]/desc))", ctx); try { query.context(node(file("app/FunctxFn/functx_catalog.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "557 557 563 443 784 WMN navy black 557 Fleece Pullover navy black Our favorite shirt!") ); } /** . */ @org.junit.Test public void functxFnDateTime1() { final XQuery query = new XQuery( "(dateTime(xs:date('2006-08-15'), xs:time('12:30:45-05:00')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2006-08-15T12:30:45-05:00") ); } /** . */ @org.junit.Test public void functxFnDayFromDate1() { final XQuery query = new XQuery( "(day-from-date(xs:date('2006-08-15')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("15") ); } /** . */ @org.junit.Test public void functxFnDayFromDateTime1() { final XQuery query = new XQuery( "(day-from-dateTime( xs:dateTime('2006-08-15T10:30:23')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("15") ); } /** . */ @org.junit.Test public void functxFnDaysFromDuration1() { final XQuery query = new XQuery( "(days-from-duration( xs:dayTimeDuration('P5D')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** . */ @org.junit.Test public void functxFnDaysFromDuration2() { final XQuery query = new XQuery( "(days-from-duration( xs:dayTimeDuration('-PT24H')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** . */ @org.junit.Test public void functxFnDaysFromDuration3() { final XQuery query = new XQuery( "(days-from-duration( xs:dayTimeDuration('PT23H')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** . */ @org.junit.Test public void functxFnDaysFromDuration4() { final XQuery query = new XQuery( "(days-from-duration( xs:dayTimeDuration('P1DT36H')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** . */ @org.junit.Test public void functxFnDaysFromDuration5() { final XQuery query = new XQuery( "(days-from-duration( xs:dayTimeDuration('PT1440M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** . */ @org.junit.Test public void functxFnDaysFromDurationAll() { final XQuery query = new XQuery( "(days-from-duration( xs:dayTimeDuration('P5D')), days-from-duration( xs:dayTimeDuration('-PT24H')), days-from-duration( xs:dayTimeDuration('PT23H')), days-from-duration( xs:dayTimeDuration('P1DT36H')), days-from-duration( xs:dayTimeDuration('PT1440M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5 -1 0 2 1") ); } /** . */ @org.junit.Test public void functxFnDeepEqual1() { final XQuery query = new XQuery( "let $prod1 := 784 return let $prod2 := 784 return (deep-equal( 1, 1 ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnDeepEqual2() { final XQuery query = new XQuery( "let $prod1 := 784 return let $prod2 := 784 return (deep-equal( (1, 1), (1, 1) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnDeepEqual3() { final XQuery query = new XQuery( "let $prod1 := 784 return let $prod2 := 784 return (deep-equal( (1, 2), (1.0, 2.0) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnDeepEqual4() { final XQuery query = new XQuery( "let $prod1 := 784 return let $prod2 := 784 return (deep-equal( (1, 2), (2, 1) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnDeepEqual5() { final XQuery query = new XQuery( "let $prod1 := 784 return let $prod2 := 784 return (deep-equal( $prod1, $prod2 ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnDeepEqual6() { final XQuery query = new XQuery( "let $prod1 := 784 return let $prod2 := 784 return (deep-equal( $prod1/number, $prod2/number ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnDeepEqualAll() { final XQuery query = new XQuery( "let $prod1 := 784 return let $prod2 := 784 return (deep-equal( 1, 1 ), deep-equal( (1, 1), (1, 1) ), deep-equal( (1, 2), (1.0, 2.0) ), deep-equal( (1, 2), (2, 1) ), deep-equal( $prod1, $prod2 ), deep-equal( $prod1/number, $prod2/number ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true true false true true") ); } /** . */ @org.junit.Test public void functxFnDefaultCollation1() { final XQuery query = new XQuery( "(default-collation())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.w3.org/2005/xpath-functions/collation/codepoint") ); } /** . */ @org.junit.Test public void functxFnDistinctValues1() { final XQuery query = new XQuery( "let $in-xml := 3 5 3 return (distinct-values( ('a', 'b', 'a') ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b") ); } /** . */ @org.junit.Test public void functxFnDistinctValues2() { final XQuery query = new XQuery( "let $in-xml := 3 5 3 return (distinct-values( (1, 2, 3) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3") ); } /** . */ @org.junit.Test public void functxFnDistinctValues3() { final XQuery query = new XQuery( "let $in-xml := 3 5 3 return (distinct-values( ('a', 2, 3) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a 2 3") ); } /** . */ @org.junit.Test public void functxFnDistinctValues4() { final XQuery query = new XQuery( "let $in-xml := 3 5 3 return (distinct-values( (xs:integer('1'), xs:decimal('1.0'), xs:float('1.0E0') ) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** . */ @org.junit.Test public void functxFnDistinctValues5() { final XQuery query = new XQuery( "let $in-xml := 3 5 3 return (distinct-values($in-xml/*))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3 5") ); } /** . */ @org.junit.Test public void functxFnDistinctValues6() { final XQuery query = new XQuery( "let $in-xml := 3 5 3 return (distinct-values( () ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnDistinctValuesAll() { final XQuery query = new XQuery( "let $in-xml := 3 5 3 return (distinct-values( ('a', 'b', 'a') ), distinct-values( (1, 2, 3) ), distinct-values( ('a', 2, 3) ), distinct-values( (xs:integer('1'), xs:decimal('1.0'), xs:float('1.0E0') ) ), distinct-values($in-xml/*), distinct-values( () ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b 1 2 3 a 2 3 1 3 5") ); } /** . */ @org.junit.Test public void functxFnDocAvailable1() { final XQuery query = new XQuery( "(doc-available( document-uri(/) ))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnEmpty1() { final XQuery query = new XQuery( "let $in-xml := xyz return (empty( ('a', 'b', 'c') ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnEmpty2() { final XQuery query = new XQuery( "let $in-xml := xyz return (empty( () ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnEmpty3() { final XQuery query = new XQuery( "let $in-xml := xyz return (empty(0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnEmpty4() { final XQuery query = new XQuery( "let $in-xml := xyz return (empty($in-xml/a))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnEmpty5() { final XQuery query = new XQuery( "let $in-xml := xyz return (empty($in-xml/b))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnEmpty6() { final XQuery query = new XQuery( "let $in-xml := xyz return (empty($in-xml/c))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnEmpty7() { final XQuery query = new XQuery( "let $in-xml := xyz return (empty($in-xml/foo))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnEmptyAll() { final XQuery query = new XQuery( "let $in-xml := xyz return (empty( ('a', 'b', 'c') ), empty( () ), empty(0), empty($in-xml/a), empty($in-xml/b), empty($in-xml/c), empty($in-xml/foo))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "false true false false false false true") ); } /** . */ @org.junit.Test public void functxFnEncodeForUri1() { final XQuery query = new XQuery( "(encode-for-uri( 'Sales % Numbers.pdf'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Sales%20%25%20Numbers.pdf") ); } /** . */ @org.junit.Test public void functxFnEncodeForUri2() { final XQuery query = new XQuery( "(encode-for-uri( 'http://datypic.com/a%20URI#frag'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http%3A%2F%2Fdatypic.com%2Fa%2520URI%23frag") ); } /** . */ @org.junit.Test public void functxFnEncodeForUriAll() { final XQuery query = new XQuery( "(encode-for-uri( 'Sales % Numbers.pdf'), encode-for-uri( 'http://datypic.com/a%20URI#frag'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Sales%20%25%20Numbers.pdf http%3A%2F%2Fdatypic.com%2Fa%2520URI%23frag") ); } /** . */ @org.junit.Test public void functxFnEndsWith1() { final XQuery query = new XQuery( "(ends-with('query', 'y'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnEndsWith2() { final XQuery query = new XQuery( "(ends-with('query', 'query'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnEndsWith3() { final XQuery query = new XQuery( "(ends-with('query', ''))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnEndsWith4() { final XQuery query = new XQuery( "(ends-with('query ', 'y'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnEndsWith5() { final XQuery query = new XQuery( "(ends-with('', 'y'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnEndsWithAll() { final XQuery query = new XQuery( "(ends-with('query', 'y'), ends-with('query', 'query'), ends-with('query', ''), ends-with('query ', 'y'), ends-with('', 'y'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true true false false") ); } /** . */ @org.junit.Test public void functxFnEscapeHtmlUri1() { final XQuery query = new XQuery( "(escape-html-uri( 'http://datypic.com/a%20URI#frag'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://datypic.com/a%20URI#frag") ); } /** . */ @org.junit.Test public void functxFnEscapeHtmlUri2() { final XQuery query = new XQuery( "(escape-html-uri('http://datypic.com'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://datypic.com") ); } /** . */ @org.junit.Test public void functxFnEscapeHtmlUriAll() { final XQuery query = new XQuery( "(escape-html-uri( 'http://datypic.com/a%20URI#frag'), escape-html-uri('http://datypic.com'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://datypic.com/a%20URI#frag http://datypic.com") ); } /** . */ @org.junit.Test public void functxFnExactlyOne1() { final XQuery query = new XQuery( "(exactly-one('a'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a") ); } /** . */ @org.junit.Test public void functxFnExists1() { final XQuery query = new XQuery( "(exists( ('a', 'b', 'c') ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnExists2() { final XQuery query = new XQuery( "(exists( '' ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnExists3() { final XQuery query = new XQuery( "(exists( () ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnExists4() { final XQuery query = new XQuery( "(exists( false() ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnExistsAll() { final XQuery query = new XQuery( "(exists( ('a', 'b', 'c') ), exists( '' ), exists( () ), exists( false() ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true false true") ); } /** . */ @org.junit.Test public void functxFnFalse1() { final XQuery query = new XQuery( "(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnFloor1() { final XQuery query = new XQuery( "(floor(5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** . */ @org.junit.Test public void functxFnFloor2() { final XQuery query = new XQuery( "(floor(5.1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** . */ @org.junit.Test public void functxFnFloor3() { final XQuery query = new XQuery( "(floor(5.7))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** . */ @org.junit.Test public void functxFnFloor4() { final XQuery query = new XQuery( "(floor(-5.1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-6") ); } /** . */ @org.junit.Test public void functxFnFloor5() { final XQuery query = new XQuery( "(floor(-5.7))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-6") ); } /** . */ @org.junit.Test public void functxFnFloor6() { final XQuery query = new XQuery( "(floor( () ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnFloorAll() { final XQuery query = new XQuery( "(floor(5), floor(5.1), floor(5.7), floor(-5.1), floor(-5.7), floor( () ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5 5 5 -6 -6") ); } /** . */ @org.junit.Test public void functxFnHoursFromDateTime1() { final XQuery query = new XQuery( "(hours-from-dateTime( xs:dateTime('2006-08-15T10:30:23')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** . */ @org.junit.Test public void functxFnHoursFromDateTime2() { final XQuery query = new XQuery( "(hours-from-dateTime( xs:dateTime('2006-08-15T10:30:23-05:00')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** . */ @org.junit.Test public void functxFnHoursFromDateTimeAll() { final XQuery query = new XQuery( "(hours-from-dateTime( xs:dateTime('2006-08-15T10:30:23')), hours-from-dateTime( xs:dateTime('2006-08-15T10:30:23-05:00')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10 10") ); } /** . */ @org.junit.Test public void functxFnHoursFromDuration1() { final XQuery query = new XQuery( "(hours-from-duration( xs:dayTimeDuration('P1DT5H')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** . */ @org.junit.Test public void functxFnHoursFromDuration2() { final XQuery query = new XQuery( "(hours-from-duration( xs:dayTimeDuration('-PT36H')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-12") ); } /** . */ @org.junit.Test public void functxFnHoursFromDuration3() { final XQuery query = new XQuery( "(hours-from-duration( xs:dayTimeDuration('PT1H90M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** . */ @org.junit.Test public void functxFnHoursFromDuration4() { final XQuery query = new XQuery( "(hours-from-duration( xs:dayTimeDuration('PT2H59M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** . */ @org.junit.Test public void functxFnHoursFromDuration5() { final XQuery query = new XQuery( "(hours-from-duration( xs:dayTimeDuration('PT3600S')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** . */ @org.junit.Test public void functxFnHoursFromDurationAll() { final XQuery query = new XQuery( "(hours-from-duration( xs:dayTimeDuration('P1DT5H')), hours-from-duration( xs:dayTimeDuration('-PT36H')), hours-from-duration( xs:dayTimeDuration('PT1H90M')), hours-from-duration( xs:dayTimeDuration('PT2H59M')), hours-from-duration( xs:dayTimeDuration('PT3600S')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5 -12 2 2 1") ); } /** . */ @org.junit.Test public void functxFnHoursFromTime1() { final XQuery query = new XQuery( "(hours-from-time( xs:time('10:30:23')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** . */ @org.junit.Test public void functxFnHoursFromTime2() { final XQuery query = new XQuery( "(hours-from-time( xs:time('10:30:23-05:00')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** . */ @org.junit.Test public void functxFnHoursFromTimeAll() { final XQuery query = new XQuery( "(hours-from-time( xs:time('10:30:23')), hours-from-time( xs:time('10:30:23-05:00')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10 10") ); } /** . */ @org.junit.Test public void functxFnIndexOf1() { final XQuery query = new XQuery( "(index-of( ('a', 'b', 'c'), 'a'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** . */ @org.junit.Test public void functxFnIndexOf2() { final XQuery query = new XQuery( "(index-of( ('a', 'b', 'c'), 'd'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnIndexOf3() { final XQuery query = new XQuery( "(index-of( (4, 5, 6, 4), 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 4") ); } /** . */ @org.junit.Test public void functxFnIndexOf4() { final XQuery query = new XQuery( "(index-of( (4, 5, 6, 4), 04.0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 4") ); } /** . */ @org.junit.Test public void functxFnIndexOf5() { final XQuery query = new XQuery( "(index-of( ('a', 5, 6), 'a'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** . */ @org.junit.Test public void functxFnIndexOf6() { final XQuery query = new XQuery( "(index-of( (), 'a'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnIndexOf7() { final XQuery query = new XQuery( "(index-of( (1, 1), 1 ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2") ); } /** . */ @org.junit.Test public void functxFnIndexOfAll() { final XQuery query = new XQuery( "(index-of( ('a', 'b', 'c'), 'a'), index-of( ('a', 'b', 'c'), 'd'), index-of( (4, 5, 6, 4), 4), index-of( (4, 5, 6, 4), 04.0), index-of( ('a', 5, 6), 'a'), index-of( (), 'a'), index-of( (1, 1), 1 ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 1 4 1 4 1 1 2") ); } /** . */ @org.junit.Test public void functxFnInsertBefore1() { final XQuery query = new XQuery( "(insert-before( ('a', 'b', 'c'), 1, ('x', 'y')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "x y a b c") ); } /** . */ @org.junit.Test public void functxFnInsertBefore2() { final XQuery query = new XQuery( "(insert-before( ('a', 'b', 'c'), 2, ('x', 'y')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a x y b c") ); } /** . */ @org.junit.Test public void functxFnInsertBefore3() { final XQuery query = new XQuery( "(insert-before( ('a', 'b', 'c'), 10, ('x', 'y')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b c x y") ); } /** . */ @org.junit.Test public void functxFnInsertBefore4() { final XQuery query = new XQuery( "(insert-before( ('a', 'b', 'c'), 0, ('x', 'y')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "x y a b c") ); } /** . */ @org.junit.Test public void functxFnInsertBefore5() { final XQuery query = new XQuery( "(insert-before( ('a', 'b', 'c'), 2, ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b c") ); } /** . */ @org.junit.Test public void functxFnInsertBefore6() { final XQuery query = new XQuery( "(insert-before( (), 3, ('a', 'b', 'c') ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b c") ); } /** . */ @org.junit.Test public void functxFnInsertBeforeAll() { final XQuery query = new XQuery( "(insert-before( ('a', 'b', 'c'), 1, ('x', 'y')), insert-before( ('a', 'b', 'c'), 2, ('x', 'y')), insert-before( ('a', 'b', 'c'), 10, ('x', 'y')), insert-before( ('a', 'b', 'c'), 0, ('x', 'y')), insert-before( ('a', 'b', 'c'), 2, ()), insert-before( (), 3, ('a', 'b', 'c') ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "x y a b c a x y b c a b c x y x y a b c a b c a b c") ); } /** . */ @org.junit.Test public void functxFnIriToUri1() { final XQuery query = new XQuery( "(iri-to-uri( 'http://datypic.com/Sales Numbers.pdf'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://datypic.com/Sales%20Numbers.pdf") ); } /** . */ @org.junit.Test public void functxFnLang1() { final XQuery query = new XQuery( "let $in-xml := A line of text. Une ligne de texte. return ($in-xml// desc[lang('en')])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("A line of text.", false) ); } /** . */ @org.junit.Test public void functxFnLang2() { final XQuery query = new XQuery( "let $in-xml := A line of text. Une ligne de texte. return ($in-xml// desc[lang('en-US')])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("A line of text.", false) ); } /** . */ @org.junit.Test public void functxFnLang3() { final XQuery query = new XQuery( "let $in-xml := A line of text. Une ligne de texte. return ($in-xml// desc[lang('fr')])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Une ligne de texte.", false) ); } /** . */ @org.junit.Test public void functxFnLang4() { final XQuery query = new XQuery( "let $in-xml := A line of text. Une ligne de texte. return ($in-xml// desc/line[lang('en')])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("A line of text.", false) ); } /** . */ @org.junit.Test public void functxFnLang5() { final XQuery query = new XQuery( "let $in-xml := A line of text. Une ligne de texte. return ($in-xml[lang('en-US')])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnLang6() { final XQuery query = new XQuery( "let $in-xml := A line of text. Une ligne de texte. return ($in-xml// desc[lang('FR')])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Une ligne de texte.", false) ); } /** . */ @org.junit.Test public void functxFnLangAll() { final XQuery query = new XQuery( "let $in-xml := A line of text. Une ligne de texte. return ($in-xml// desc[lang('en')], $in-xml// desc[lang('en-US')], $in-xml// desc[lang('fr')], $in-xml// desc/line[lang('en')], $in-xml[lang('en-US')], $in-xml// desc[lang('FR')])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("A line of text.A line of text.Une ligne de texte.A line of text.Une ligne de texte.", false) ); } /** . */ @org.junit.Test public void functxFnLast1() { final XQuery query = new XQuery( "(/ catalog/product[last()])", ctx); try { query.context(node(file("app/FunctxFn/functx_catalog.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n 784\n Cotton Dress Shirt\n white gray\n Our favorite shirt!\n ", false) ); } /** . */ @org.junit.Test public void functxFnLocalName1() { final XQuery query = new XQuery( "declare namespace pre = \"http://datypic.com/pre\";\n" + " declare namespace unpre = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (local-name($in-xml))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "noNamespace") ); } /** . */ @org.junit.Test public void functxFnLocalName2() { final XQuery query = new XQuery( "declare namespace pre = \"http://datypic.com/pre\";\n" + " declare namespace unpre = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (local-name($in-xml//pre:prefixed))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "prefixed") ); } /** . */ @org.junit.Test public void functxFnLocalName3() { final XQuery query = new XQuery( "declare namespace pre = \"http://datypic.com/pre\";\n" + " declare namespace unpre = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (local-name($in-xml//unpre:unprefixed))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "unprefixed") ); } /** . */ @org.junit.Test public void functxFnLocalName4() { final XQuery query = new XQuery( "declare namespace pre = \"http://datypic.com/pre\";\n" + " declare namespace unpre = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (local-name($in-xml//@pre:prefAttr))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "prefAttr") ); } /** . */ @org.junit.Test public void functxFnLocalName5() { final XQuery query = new XQuery( "declare namespace pre = \"http://datypic.com/pre\";\n" + " declare namespace unpre = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (local-name($in-xml//@noNSAttr))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "noNSAttr") ); } /** . */ @org.junit.Test public void functxFnLocalNameAll() { final XQuery query = new XQuery( "declare namespace pre = \"http://datypic.com/pre\";\n" + " declare namespace unpre = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (local-name($in-xml), local-name($in-xml//pre:prefixed), local-name($in-xml//unpre:unprefixed), local-name($in-xml//@pre:prefAttr), local-name($in-xml//@noNSAttr))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "noNamespace prefixed unprefixed prefAttr noNSAttr") ); } /** . */ @org.junit.Test public void functxFnLocalNameFromQName1() { final XQuery query = new XQuery( "(local-name-from-QName( QName('http://datypic.com/prod', 'number')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "number") ); } /** . */ @org.junit.Test public void functxFnLocalNameFromQName2() { final XQuery query = new XQuery( "(local-name-from-QName(QName ('', 'number')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "number") ); } /** . */ @org.junit.Test public void functxFnLocalNameFromQName3() { final XQuery query = new XQuery( "(local-name-from-QName( () ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnLocalNameFromQNameAll() { final XQuery query = new XQuery( "(local-name-from-QName( QName('http://datypic.com/prod', 'number')), local-name-from-QName(QName ('', 'number')), local-name-from-QName( () ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "number number") ); } /** . */ @org.junit.Test public void functxFnLowerCase1() { final XQuery query = new XQuery( "(lower-case('QUERY'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "query") ); } /** . */ @org.junit.Test public void functxFnLowerCase2() { final XQuery query = new XQuery( "(lower-case('Query'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "query") ); } /** . */ @org.junit.Test public void functxFnLowerCase3() { final XQuery query = new XQuery( "(lower-case('QUERY123'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "query123") ); } /** . */ @org.junit.Test public void functxFnLowerCaseAll() { final XQuery query = new XQuery( "(lower-case('QUERY'), lower-case('Query'), lower-case('QUERY123'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "query query query123") ); } /** . */ @org.junit.Test public void functxFnMatches1() { final XQuery query = new XQuery( "let $address := '123 Main Street Traverse City, MI 49684' return (matches('query', 'q'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnMatches10() { final XQuery query = new XQuery( "let $address := '123 Main Street Traverse City, MI 49684' return (matches($address, 'Street.*City', 's'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnMatches11() { final XQuery query = new XQuery( "let $address := '123 Main Street\n" + "Traverse City, MI 49684' return (matches($address, 'Street$'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnMatches12() { final XQuery query = new XQuery( "let $address := '123 Main Street\n" + "Traverse City, MI 49684' return (matches($address, 'Street$', 'm'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnMatches13() { final XQuery query = new XQuery( "let $address := '123 Main Street\n" + "Traverse City, MI 49684' return (matches($address, 'street'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnMatches14() { final XQuery query = new XQuery( "let $address := '123 Main Street\n" + "Traverse City, MI 49684' return (matches($address, 'street', 'i'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnMatches15() { final XQuery query = new XQuery( "let $address := '123 Main Street\n" + "Traverse City, MI 49684' return (matches($address, 'Main Street'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnMatches16() { final XQuery query = new XQuery( "let $address := '123 Main Street\n" + "Traverse City, MI 49684' return (matches($address, 'Main Street', 'x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnMatches17() { final XQuery query = new XQuery( "let $address := '123 Main Street\n" + "Traverse City, MI 49684' return (matches($address, 'Main \\s Street', 'x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnMatches18() { final XQuery query = new XQuery( "let $address := '123 Main Street\n" + "Traverse City, MI 49684' return (matches($address, 'street$', 'im'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnMatches2() { final XQuery query = new XQuery( "let $address := '123 Main Street Traverse City, MI 49684' return (matches('query', 'ue'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnMatches3() { final XQuery query = new XQuery( "let $address := '123 Main Street Traverse City, MI 49684' return (matches('query', '^qu'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnMatches4() { final XQuery query = new XQuery( "let $address := '123 Main Street Traverse City, MI 49684' return (matches('query', 'qu$'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnMatches5() { final XQuery query = new XQuery( "let $address := '123 Main Street Traverse City, MI 49684' return (matches('query', '[ux]'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnMatches6() { final XQuery query = new XQuery( "let $address := '123 Main Street Traverse City, MI 49684' return (matches('query', 'q.*'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnMatches7() { final XQuery query = new XQuery( "let $address := '123 Main Street Traverse City, MI 49684' return (matches('query', '[a-z]{5}'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnMatches8() { final XQuery query = new XQuery( "let $address := '123 Main Street Traverse City, MI 49684' return (matches((), 'q' ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnMatches9() { final XQuery query = new XQuery( "let $address := '123 Main Street\n" + "Traverse City, MI 49684' return (matches($address, 'Street.*City'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnMatchesAll() { final XQuery query = new XQuery( "\n" + " let $address := '123 Main Street\n" + "Traverse City, MI 49684' \n" + " return (matches('query', 'q'), matches('query', 'ue'), matches('query', '^qu'), \n" + " matches('query', 'qu$'), matches('query', '[ux]'), matches('query', 'q.*'), \n" + " matches('query', '[a-z]{5}'), matches((), 'q' ), matches($address, 'Street.*City'), \n" + " matches($address, 'Street.*City', 's'), matches($address, 'Street$'), \n" + " matches($address, 'Street$', 'm'), matches($address, 'street'), \n" + " matches($address, 'street', 'i'), matches($address, 'Main Street'), \n" + " matches($address, 'Main Street', 'x'), matches($address, 'Main \\s Street', 'x'), \n" + " matches($address, 'street$', 'im'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true true false true true true false false true false true false true true false true true") ); } /** . */ @org.junit.Test public void functxFnMax1() { final XQuery query = new XQuery( "let $ordDoc := (/) return (max( (2, 1, 5, 4, 3) ))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** . */ @org.junit.Test public void functxFnMax2() { final XQuery query = new XQuery( "let $ordDoc := (/) return (max( ('a', 'b', 'c') ))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "c") ); } /** . */ @org.junit.Test public void functxFnMax3() { final XQuery query = new XQuery( "let $ordDoc := (/) return (max( 2 ))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** . */ @org.junit.Test public void functxFnMax4() { final XQuery query = new XQuery( "let $ordDoc := (/) return (max($ordDoc//item/string(@dept)))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "WMN") ); } /** . */ @org.junit.Test public void functxFnMaxAll() { final XQuery query = new XQuery( "let $ordDoc := (/) return (max( (2, 1, 5, 4, 3) ), max( ('a', 'b', 'c') ), max( 2 ), max($ordDoc//item/string(@dept)))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5 c 2 WMN") ); } /** . */ @org.junit.Test public void functxFnMin1() { final XQuery query = new XQuery( "let $ordDoc := (/) return (min( (2.0, 1, 3.5, 4) ))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** . */ @org.junit.Test public void functxFnMin2() { final XQuery query = new XQuery( "let $ordDoc := (/) return (min( ('a', 'b', 'c') ))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a") ); } /** . */ @org.junit.Test public void functxFnMin3() { final XQuery query = new XQuery( "let $ordDoc := (/) return (min($ordDoc//item//string(@color)))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnMin4() { final XQuery query = new XQuery( "let $ordDoc := (/) return (min($ordDoc//item/@color/string(.)))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "beige") ); } /** . */ @org.junit.Test public void functxFnMinAll() { final XQuery query = new XQuery( "let $ordDoc := (/) return (min( (2.0, 1, 3.5, 4) ), min( ('a', 'b', 'c') ), min($ordDoc//item//string(@color)), min($ordDoc//item/@color/string(.)))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 a beige") ); } /** . */ @org.junit.Test public void functxFnMinutesFromDateTime1() { final XQuery query = new XQuery( "(minutes-from-dateTime( xs:dateTime('2006-08-15T10:30:23')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("30") ); } /** . */ @org.junit.Test public void functxFnMinutesFromDuration1() { final XQuery query = new XQuery( "(minutes-from-duration( xs:dayTimeDuration('PT30M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("30") ); } /** . */ @org.junit.Test public void functxFnMinutesFromDuration2() { final XQuery query = new XQuery( "(minutes-from-duration( xs:dayTimeDuration('-PT90M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-30") ); } /** . */ @org.junit.Test public void functxFnMinutesFromDuration3() { final XQuery query = new XQuery( "(minutes-from-duration( xs:dayTimeDuration('PT1M90S')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** . */ @org.junit.Test public void functxFnMinutesFromDuration4() { final XQuery query = new XQuery( "(minutes-from-duration( xs:dayTimeDuration('PT3H')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** . */ @org.junit.Test public void functxFnMinutesFromDuration5() { final XQuery query = new XQuery( "(minutes-from-duration( xs:dayTimeDuration('PT60M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** . */ @org.junit.Test public void functxFnMinutesFromDurationAll() { final XQuery query = new XQuery( "(minutes-from-duration( xs:dayTimeDuration('PT30M')), minutes-from-duration( xs:dayTimeDuration('-PT90M')), minutes-from-duration( xs:dayTimeDuration('PT1M90S')), minutes-from-duration( xs:dayTimeDuration('PT3H')), minutes-from-duration( xs:dayTimeDuration('PT60M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "30 -30 2 0 0") ); } /** . */ @org.junit.Test public void functxFnMinutesFromTime1() { final XQuery query = new XQuery( "(minutes-from-time(xs:time('10:30:23')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("30") ); } /** . */ @org.junit.Test public void functxFnMonthFromDate1() { final XQuery query = new XQuery( "(month-from-date(xs:date('2006-08-15')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("8") ); } /** . */ @org.junit.Test public void functxFnMonthFromDateTime1() { final XQuery query = new XQuery( "(month-from-dateTime( xs:dateTime('2006-08-15T10:30:23')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("8") ); } /** . */ @org.junit.Test public void functxFnMonthsFromDuration1() { final XQuery query = new XQuery( "(months-from-duration( xs:yearMonthDuration('P3M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** . */ @org.junit.Test public void functxFnMonthsFromDuration2() { final XQuery query = new XQuery( "(months-from-duration( xs:yearMonthDuration('-P18M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-6") ); } /** . */ @org.junit.Test public void functxFnMonthsFromDuration3() { final XQuery query = new XQuery( "(months-from-duration( xs:yearMonthDuration('P1Y')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** . */ @org.junit.Test public void functxFnMonthsFromDuration4() { final XQuery query = new XQuery( "(months-from-duration( xs:yearMonthDuration('P12M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** . */ @org.junit.Test public void functxFnMonthsFromDurationAll() { final XQuery query = new XQuery( "(months-from-duration( xs:yearMonthDuration('P3M')), months-from-duration( xs:yearMonthDuration('-P18M')), months-from-duration( xs:yearMonthDuration('P1Y')), months-from-duration( xs:yearMonthDuration('P12M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3 -6 0 0") ); } /** . */ @org.junit.Test public void functxFnName1() { final XQuery query = new XQuery( "declare namespace pre2 = \"http://datypic.com/pre\";\n" + " declare namespace unpre2 = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (name($in-xml))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "noNamespace") ); } /** . */ @org.junit.Test public void functxFnName2() { final XQuery query = new XQuery( "declare namespace pre2 = \"http://datypic.com/pre\";\n" + " declare namespace unpre2 = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (name($in-xml//pre2:prefixed))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "pre:prefixed") ); } /** . */ @org.junit.Test public void functxFnName3() { final XQuery query = new XQuery( "declare namespace pre2 = \"http://datypic.com/pre\";\n" + " declare namespace unpre2 = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (name($in-xml//unpre2:unprefixed))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "unprefixed") ); } /** . */ @org.junit.Test public void functxFnName4() { final XQuery query = new XQuery( "declare namespace pre2 = \"http://datypic.com/pre\";\n" + " declare namespace unpre2 = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (name($in-xml//@pre2:prefAttr))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "pre:prefAttr") ); } /** . */ @org.junit.Test public void functxFnName5() { final XQuery query = new XQuery( "declare namespace pre2 = \"http://datypic.com/pre\";\n" + " declare namespace unpre2 = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (name($in-xml//@noNSAttr))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "noNSAttr") ); } /** . */ @org.junit.Test public void functxFnNameAll() { final XQuery query = new XQuery( "declare namespace pre2 = \"http://datypic.com/pre\";\n" + " declare namespace unpre2 = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (name($in-xml), name($in-xml//pre2:prefixed), name($in-xml//unpre2:unprefixed), name($in-xml//@pre2:prefAttr), name($in-xml//@noNSAttr))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "noNamespace pre:prefixed unprefixed pre:prefAttr noNSAttr") ); } /** . */ @org.junit.Test public void functxFnNamespaceUri1() { final XQuery query = new XQuery( "declare namespace pre = \"http://datypic.com/pre\";\n" + " declare namespace unpre = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (namespace-uri($in-xml))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnNamespaceUri2() { final XQuery query = new XQuery( "declare namespace pre = \"http://datypic.com/pre\";\n" + " declare namespace unpre = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (namespace-uri($in-xml//pre:prefixed))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://datypic.com/pre") ); } /** . */ @org.junit.Test public void functxFnNamespaceUri3() { final XQuery query = new XQuery( "declare namespace pre = \"http://datypic.com/pre\";\n" + " declare namespace unpre = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (namespace-uri($in-xml//unpre:unprefixed))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://datypic.com/unpre") ); } /** . */ @org.junit.Test public void functxFnNamespaceUri4() { final XQuery query = new XQuery( "declare namespace pre = \"http://datypic.com/pre\";\n" + " declare namespace unpre = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (namespace-uri($in-xml//@pre:prefAttr))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://datypic.com/pre") ); } /** . */ @org.junit.Test public void functxFnNamespaceUri5() { final XQuery query = new XQuery( "declare namespace pre = \"http://datypic.com/pre\";\n" + " declare namespace unpre = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (namespace-uri($in-xml//@noNSAttr))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnNamespaceUriAll() { final XQuery query = new XQuery( "declare namespace pre = \"http://datypic.com/pre\";\n" + " declare namespace unpre = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (namespace-uri($in-xml), namespace-uri($in-xml//pre:prefixed), namespace-uri($in-xml//unpre:unprefixed), namespace-uri($in-xml//@pre:prefAttr), namespace-uri($in-xml//@noNSAttr))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, " http://datypic.com/pre http://datypic.com/unpre http://datypic.com/pre ") ); } /** . */ @org.junit.Test public void functxFnNamespaceUriForPrefix1() { final XQuery query = new XQuery( "declare namespace pre = \"http://datypic.com/pre\";\n" + " declare namespace unpre = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (namespace-uri-for-prefix( '', $in-xml))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnNamespaceUriForPrefix2() { final XQuery query = new XQuery( "declare namespace pre = \"http://datypic.com/pre\";\n" + " declare namespace unpre = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (namespace-uri-for-prefix( 'pre',$in-xml//pre:prefixed))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://datypic.com/pre") ); } /** . */ @org.junit.Test public void functxFnNamespaceUriForPrefix3() { final XQuery query = new XQuery( "declare namespace pre = \"http://datypic.com/pre\";\n" + " declare namespace unpre = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (namespace-uri-for-prefix( '',$in-xml//unpre:unprefixed))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://datypic.com/unpre") ); } /** . */ @org.junit.Test public void functxFnNamespaceUriForPrefix4() { final XQuery query = new XQuery( "declare namespace pre = \"http://datypic.com/pre\";\n" + " declare namespace unpre = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (namespace-uri-for-prefix( 'pre',$in-xml//unpre:unprefixed))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://datypic.com/pre") ); } /** . */ @org.junit.Test public void functxFnNamespaceUriForPrefixAll() { final XQuery query = new XQuery( "declare namespace pre = \"http://datypic.com/pre\";\n" + " declare namespace unpre = \"http://datypic.com/unpre\";\n" + " let $in-xml := \n" + " \n" + " \n" + " 123 \n" + " \n" + " \n" + " return (namespace-uri-for-prefix('', $in-xml),\n" + " namespace-uri-for-prefix('pre',$in-xml//pre:prefixed),\n" + " namespace-uri-for-prefix('',$in-xml//unpre:unprefixed),\n" + " namespace-uri-for-prefix('pre',$in-xml//unpre:unprefixed))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://datypic.com/pre http://datypic.com/unpre http://datypic.com/pre") ); } /** . */ @org.junit.Test public void functxFnNamespaceUriFromQName1() { final XQuery query = new XQuery( "(namespace-uri-from-QName( QName ('http://datypic.com/pre', 'prefixed')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://datypic.com/pre") ); } /** . */ @org.junit.Test public void functxFnNamespaceUriFromQName2() { final XQuery query = new XQuery( "(namespace-uri-from-QName( QName ('', 'unprefixed')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnNamespaceUriFromQName3() { final XQuery query = new XQuery( "(namespace-uri-from-QName( () ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnNamespaceUriFromQNameAll() { final XQuery query = new XQuery( "(namespace-uri-from-QName( QName ('http://datypic.com/pre', 'prefixed')), namespace-uri-from-QName( QName ('', 'unprefixed')), namespace-uri-from-QName( () ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://datypic.com/pre ") ); } /** . */ @org.junit.Test public void functxFnNilled1() { final XQuery query = new XQuery( "let $in-xml := 12 return (nilled($in-xml//child[1]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnNilled2() { final XQuery query = new XQuery( "let $in-xml := 12 return (nilled($in-xml//child[3]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnNilled3() { final XQuery query = new XQuery( "let $in-xml := 12 return (nilled($in-xml//child[4]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnNilled4() { final XQuery query = new XQuery( "let $in-xml := 12 return (nilled($in-xml//child[5]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnNilledAll() { final XQuery query = new XQuery( "let $in-xml := 12 return (nilled($in-xml//child[1]), nilled($in-xml//child[3]), nilled($in-xml//child[4]), nilled($in-xml//child[5]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "false false false false") ); } /** . */ @org.junit.Test public void functxFnNodeName1() { final XQuery query = new XQuery( "declare namespace pre2 = \"http://datypic.com/pre\";\n" + " declare namespace unpre2 = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (node-name($in-xml))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "noNamespace") ); } /** . */ @org.junit.Test public void functxFnNodeName2() { final XQuery query = new XQuery( "declare namespace pre2 = \"http://datypic.com/pre\";\n" + " declare namespace unpre2 = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (node-name($in-xml/pre2:prefixed))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "pre:prefixed") ); } /** . */ @org.junit.Test public void functxFnNodeName3() { final XQuery query = new XQuery( "declare namespace pre2 = \"http://datypic.com/pre\";\n" + " declare namespace unpre2 = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (node-name($in-xml//unpre2:unprefixed))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "unprefixed") ); } /** . */ @org.junit.Test public void functxFnNodeName4() { final XQuery query = new XQuery( "declare namespace pre2 = \"http://datypic.com/pre\";\n" + " declare namespace unpre2 = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (node-name($in-xml//@pre2:prefAttr))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "pre:prefAttr") ); } /** . */ @org.junit.Test public void functxFnNodeName5() { final XQuery query = new XQuery( "declare namespace pre2 = \"http://datypic.com/pre\";\n" + " declare namespace unpre2 = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (node-name($in-xml//@noNSAttr))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "noNSAttr") ); } /** . */ @org.junit.Test public void functxFnNodeNameAll() { final XQuery query = new XQuery( "declare namespace pre2 = \"http://datypic.com/pre\";\n" + " declare namespace unpre2 = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (node-name($in-xml), node-name($in-xml/pre2:prefixed), node-name($in-xml//unpre2:unprefixed), node-name($in-xml//@pre2:prefAttr), node-name($in-xml//@noNSAttr))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "noNamespace pre:prefixed unprefixed pre:prefAttr noNSAttr") ); } /** . */ @org.junit.Test public void functxFnNormalizeSpace1() { final XQuery query = new XQuery( "(normalize-space('query'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "query") ); } /** . */ @org.junit.Test public void functxFnNormalizeSpace2() { final XQuery query = new XQuery( "(normalize-space(' query '))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "query") ); } /** . */ @org.junit.Test public void functxFnNormalizeSpace3() { final XQuery query = new XQuery( "(normalize-space('xml query'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xml query") ); } /** . */ @org.junit.Test public void functxFnNormalizeSpace4() { final XQuery query = new XQuery( "(normalize-space('xml query'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xml query") ); } /** . */ @org.junit.Test public void functxFnNormalizeSpace5() { final XQuery query = new XQuery( "(normalize-space('xml query'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xml query") ); } /** . */ @org.junit.Test public void functxFnNormalizeSpace6() { final XQuery query = new XQuery( "(normalize-space(''))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnNormalizeSpace7() { final XQuery query = new XQuery( "(normalize-space(' '))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnNormalizeSpace8() { final XQuery query = new XQuery( "(normalize-space(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnNormalizeSpace9() { final XQuery query = new XQuery( "(normalize-space( query ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "query") ); } /** . */ @org.junit.Test public void functxFnNormalizeSpaceAll() { final XQuery query = new XQuery( "(normalize-space('query'), normalize-space(' query '), normalize-space('xml query'), normalize-space('xml query'), normalize-space('xml query'), normalize-space(''), normalize-space(' '), normalize-space(()), normalize-space( query ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "query query xml query xml query xml query query") ); } /** . */ @org.junit.Test public void functxFnNormalizeUnicode1() { final XQuery query = new XQuery( "(normalize-unicode('query'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "query") ); } /** . */ @org.junit.Test public void functxFnNormalizeUnicode2() { final XQuery query = new XQuery( "(normalize-unicode('query', ''))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "query") ); } /** . */ @org.junit.Test public void functxFnNormalizeUnicodeAll() { final XQuery query = new XQuery( "(normalize-unicode('query'), normalize-unicode('query', ''))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "query query") ); } /** . */ @org.junit.Test public void functxFnNot1() { final XQuery query = new XQuery( "(not(32 >\n" + " 20))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnNot2() { final XQuery query = new XQuery( "(not((/) //product))", ctx); try { query.context(node(file("app/FunctxFn/functx_catalog.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnNot3() { final XQuery query = new XQuery( "(not(true()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnNot4() { final XQuery query = new XQuery( "(not(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnNot5() { final XQuery query = new XQuery( "(not(''))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnNot6() { final XQuery query = new XQuery( "(not(0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnNot7() { final XQuery query = new XQuery( "(not(false))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnNotAll() { final XQuery query = new XQuery( "(not(32 > 20), not((/) //product), not(true()), not(()), not(''), not(0), not(false))", ctx); try { query.context(node(file("app/FunctxFn/functx_catalog.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "false false false true true true false") ); } /** . */ @org.junit.Test public void functxFnNumber1() { final XQuery query = new XQuery( "let $priceDoc := (/) return (number( $priceDoc//prod[1]/price))", ctx); try { query.context(node(file("app/FunctxFn/functx_prices.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "29.99") ); } /** . */ @org.junit.Test public void functxFnNumber2() { final XQuery query = new XQuery( "let $priceDoc := (/) return (number( $priceDoc//prod[1]/@currency))", ctx); try { query.context(node(file("app/FunctxFn/functx_prices.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** . */ @org.junit.Test public void functxFnNumber3() { final XQuery query = new XQuery( "let $priceDoc := (/) return (number('29.99'))", ctx); try { query.context(node(file("app/FunctxFn/functx_prices.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "29.99") ); } /** . */ @org.junit.Test public void functxFnNumber4() { final XQuery query = new XQuery( "let $priceDoc := (/) return (number('ABC'))", ctx); try { query.context(node(file("app/FunctxFn/functx_prices.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** . */ @org.junit.Test public void functxFnNumber5() { final XQuery query = new XQuery( "let $priceDoc := (/) return (number( () ))", ctx); try { query.context(node(file("app/FunctxFn/functx_prices.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** . */ @org.junit.Test public void functxFnNumber6() { final XQuery query = new XQuery( "let $priceDoc := (/) return ($priceDoc// prod/price[number() >\n" + " 35])", ctx); try { query.context(node(file("app/FunctxFn/functx_prices.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("69.9939.99", false) ); } /** . */ @org.junit.Test public void functxFnNumberAll() { final XQuery query = new XQuery( "let $priceDoc := (/) return (number( $priceDoc//prod[1]/price), number( $priceDoc//prod[1]/@currency), number('29.99'), number('ABC'), number( () ), $priceDoc// prod/price[number() >\n" + " 35])", ctx); try { query.context(node(file("app/FunctxFn/functx_prices.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("29.99 NaN 29.99 NaN NaN69.9939.99", false) ); } /** . */ @org.junit.Test public void functxFnOneOrMore1() { final XQuery query = new XQuery( "(one-or-more('a'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a") ); } /** . */ @org.junit.Test public void functxFnOneOrMore2() { final XQuery query = new XQuery( "(one-or-more( ('a', 'b') ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b") ); } /** . */ @org.junit.Test public void functxFnOneOrMoreAll() { final XQuery query = new XQuery( "(one-or-more('a'), one-or-more( ('a', 'b') ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a a b") ); } /** . */ @org.junit.Test public void functxFnPosition1() { final XQuery query = new XQuery( "let $in-xml := 1 2 3 4 5 return ($in-xml/*[position() > 2])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("345", false) ); } /** . */ @org.junit.Test public void functxFnPosition2() { final XQuery query = new XQuery( "let $in-xml := 1 2 3 4 5 return ($in-xml/a[position() > 2])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("45", false) ); } /** . */ @org.junit.Test public void functxFnPosition3() { final XQuery query = new XQuery( "let $in-xml := 1 2 3 4 5 return ($in-xml/a[position() = 3])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("4", false) ); } /** . */ @org.junit.Test public void functxFnPositionAll() { final XQuery query = new XQuery( "let $in-xml := 1 2 3 4 5 return ($in-xml/*[position() > 2], $in-xml/a[position() > 2], $in-xml/a[position() = 3])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("345454", false) ); } /** . */ @org.junit.Test public void functxFnPrefixFromQName1() { final XQuery query = new XQuery( "declare namespace pre2 = \"http://datypic.com/pre\";\n" + " declare namespace unpre = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (prefix-from-QName( node-name($in-xml)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnPrefixFromQName2() { final XQuery query = new XQuery( "declare namespace pre2 = \"http://datypic.com/pre\";\n" + " declare namespace unpre = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (prefix-from-QName( node-name($in-xml//pre2:prefixed)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "pre") ); } /** . */ @org.junit.Test public void functxFnPrefixFromQName3() { final XQuery query = new XQuery( "declare namespace pre2 = \"http://datypic.com/pre\";\n" + " declare namespace unpre = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (prefix-from-QName( node-name($in-xml//unpre:unprefixed)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnPrefixFromQName4() { final XQuery query = new XQuery( "declare namespace pre2 = \"http://datypic.com/pre\";\n" + " declare namespace unpre = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (prefix-from-QName( node-name($in-xml//@pre2:prefAttr)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "pre") ); } /** . */ @org.junit.Test public void functxFnPrefixFromQName5() { final XQuery query = new XQuery( "declare namespace pre2 = \"http://datypic.com/pre\";\n" + " declare namespace unpre = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (prefix-from-QName( node-name($in-xml//@noNSAttr)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnPrefixFromQName6() { final XQuery query = new XQuery( "declare namespace pre2 = \"http://datypic.com/pre\";\n" + " declare namespace unpre = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (prefix-from-QName( node-name(xyz)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "pre2") ); } /** . */ @org.junit.Test public void functxFnPrefixFromQNameAll() { final XQuery query = new XQuery( "declare namespace pre2 = \"http://datypic.com/pre\";\n" + " declare namespace unpre = \"http://datypic.com/unpre\";\n" + " let $in-xml := 123 return (prefix-from-QName( node-name($in-xml)), prefix-from-QName( node-name($in-xml//pre2:prefixed)), prefix-from-QName( node-name($in-xml//unpre:unprefixed)), prefix-from-QName( node-name($in-xml//@pre2:prefAttr)), prefix-from-QName( node-name($in-xml//@noNSAttr)), prefix-from-QName( node-name(xyz)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "pre pre pre2") ); } /** . */ @org.junit.Test public void functxFnRemove1() { final XQuery query = new XQuery( "(remove( ('a', 'b', 'c'), 2) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a c") ); } /** . */ @org.junit.Test public void functxFnRemove2() { final XQuery query = new XQuery( "(remove( ('a', 'b', 'c'), 10))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b c") ); } /** . */ @org.junit.Test public void functxFnRemove3() { final XQuery query = new XQuery( "(remove( ('a', 'b', 'c'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b c") ); } /** . */ @org.junit.Test public void functxFnRemoveAll() { final XQuery query = new XQuery( "(remove( ('a', 'b', 'c'), 2) , remove( ('a', 'b', 'c'), 10), remove( ('a', 'b', 'c'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a c a b c a b c") ); } /** . */ @org.junit.Test public void functxFnReplace1() { final XQuery query = new XQuery( "(replace('query', 'r', 'as'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "queasy") ); } /** . */ @org.junit.Test public void functxFnReplace10() { final XQuery query = new XQuery( "(replace('reluctant', 'r.*?t', 'X'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Xant") ); } /** . */ @org.junit.Test public void functxFnReplace11() { final XQuery query = new XQuery( "(replace('aaah', 'a{2,3}', 'X'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Xh") ); } /** . */ @org.junit.Test public void functxFnReplace12() { final XQuery query = new XQuery( "(replace('aaah', 'a{2,3}?', 'X'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Xah") ); } /** . */ @org.junit.Test public void functxFnReplace13() { final XQuery query = new XQuery( "(replace('aaaah', 'a{2,3}', 'X'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Xah") ); } /** . */ @org.junit.Test public void functxFnReplace14() { final XQuery query = new XQuery( "(replace('aaaah', 'a{2,3}?', 'X'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "XXh") ); } /** . */ @org.junit.Test public void functxFnReplace15() { final XQuery query = new XQuery( "(replace('Chap 2...Chap 3...Chap 4...', 'Chap (\\d)', 'Sec $1.0'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Sec 2.0...Sec 3.0...Sec 4.0...") ); } /** . */ @org.junit.Test public void functxFnReplace16() { final XQuery query = new XQuery( "(replace('abc123', '([a-z])', '$1x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "axbxcx123") ); } /** . */ @org.junit.Test public void functxFnReplace17() { final XQuery query = new XQuery( "(replace('2315551212', '(\\d{3})(\\d{3})(\\d{4})', '($1) $2-$3'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "(231) 555-1212") ); } /** . */ @org.junit.Test public void functxFnReplace18() { final XQuery query = new XQuery( "(replace('2006-10-18', '\\d{2}(\\d{2})-(\\d{2})-(\\d{2})', '$2/$3/$1'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10/18/06") ); } /** . */ @org.junit.Test public void functxFnReplace19() { final XQuery query = new XQuery( "(replace('25', '(\\d+)', '\\$$1.00'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "$25.00") ); } /** . */ @org.junit.Test public void functxFnReplace2() { final XQuery query = new XQuery( "(replace('query', 'qu', 'quack'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "quackery") ); } /** . */ @org.junit.Test public void functxFnReplace3() { final XQuery query = new XQuery( "(replace('query', '[ry]', 'l'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "quell") ); } /** . */ @org.junit.Test public void functxFnReplace4() { final XQuery query = new XQuery( "(replace('query', '[ry]+', 'l'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "quel") ); } /** . */ @org.junit.Test public void functxFnReplace5() { final XQuery query = new XQuery( "(replace('query', 'z', 'a'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "query") ); } /** . */ @org.junit.Test public void functxFnReplace6() { final XQuery query = new XQuery( "(replace('query', 'query', ''))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnReplace7() { final XQuery query = new XQuery( "(replace( (), 'r', 'as'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnReplace8() { final XQuery query = new XQuery( "(replace('Chapter', '(Chap)|(Chapter)', 'x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xter") ); } /** . */ @org.junit.Test public void functxFnReplace9() { final XQuery query = new XQuery( "(replace('reluctant', 'r.*t', 'X'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "X") ); } /** . */ @org.junit.Test public void functxFnReplaceAll() { final XQuery query = new XQuery( "(replace('query', 'r', 'as'), replace('query', 'qu', 'quack'), replace('query', '[ry]', 'l'), replace('query', '[ry]+', 'l'), replace('query', 'z', 'a'), replace('query', 'query', ''), replace( (), 'r', 'as'), replace('Chapter', '(Chap)|(Chapter)', 'x'), replace('reluctant', 'r.*t', 'X'), replace('reluctant', 'r.*?t', 'X'), replace('aaah', 'a{2,3}', 'X'), replace('aaah', 'a{2,3}?', 'X'), replace('aaaah', 'a{2,3}', 'X'), replace('aaaah', 'a{2,3}?', 'X'), replace('Chap 2...Chap 3...Chap 4...', 'Chap (\\d)', 'Sec $1.0'), replace('abc123', '([a-z])', '$1x'), replace('2315551212', '(\\d{3})(\\d{3})(\\d{4})', '($1) $2-$3'), replace('2006-10-18', '\\d{2}(\\d{2})-(\\d{2})-(\\d{2})', '$2/$3/$1'), replace('25', '(\\d+)', '\\$$1.00'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "queasy quackery quell quel query xter X Xant Xh Xah Xah XXh Sec 2.0...Sec 3.0...Sec 4.0... axbxcx123 (231) 555-1212 10/18/06 $25.00") ); } /** . */ @org.junit.Test public void functxFnResolveQName1() { final XQuery query = new XQuery( "declare namespace ord = \"http://datypic.com/ord\";\n" + " declare namespace dty = \"http://datypic.com\";\n" + " declare namespace dty2 = \"http://datypic.com/ns2\";\n" + " let $root := return (resolve-QName('myName', $root))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "myName") ); } /** . */ @org.junit.Test public void functxFnResolveQName2() { final XQuery query = new XQuery( "declare namespace ord = \"http://datypic.com/ord\";\n" + " declare namespace dty = \"http://datypic.com\";\n" + " declare namespace dty2 = \"http://datypic.com/ns2\";\n" + " let $root := return (resolve-QName('myName', $root/dty:order))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "myName") ); } /** . */ @org.junit.Test public void functxFnResolveQName3() { final XQuery query = new XQuery( "declare namespace ord = \"http://datypic.com/ord\";\n" + " declare namespace dty = \"http://datypic.com\";\n" + " declare namespace dty2 = \"http://datypic.com/ns2\";\n" + " let $root := return (resolve-QName( 'ord:myName', $root/dty:order))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ord:myName") ); } /** . */ @org.junit.Test public void functxFnResolveQNameAll() { final XQuery query = new XQuery( "declare namespace ord = \"http://datypic.com/ord\";\n" + " declare namespace dty = \"http://datypic.com\";\n" + " declare namespace dty2 = \"http://datypic.com/ns2\";\n" + " let $root := return (resolve-QName('myName', $root), resolve-QName('myName', $root/dty:order), resolve-QName( 'ord:myName', $root/dty:order))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "myName myName ord:myName") ); } /** . */ @org.junit.Test public void functxFnResolveUri1() { final XQuery query = new XQuery( "(resolve-uri('prod', 'http://datypic.com/'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://datypic.com/prod") ); } /** . */ @org.junit.Test public void functxFnResolveUri2() { final XQuery query = new XQuery( "(resolve-uri('prod2', 'http://datypic.com/prod1'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://datypic.com/prod2") ); } /** . */ @org.junit.Test public void functxFnResolveUri3() { final XQuery query = new XQuery( "(resolve-uri( 'http://example.org','http://datypic.com'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.org") ); } /** . */ @org.junit.Test public void functxFnResolveUri4() { final XQuery query = new XQuery( "(resolve-uri( 'http://datypic.com', '../base'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "http://datypic.com") || error("FORG0002") ) ); } /** . */ @org.junit.Test public void functxFnResolveUri5() { final XQuery query = new XQuery( "(resolve-uri( '', 'http://datypic.com'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://datypic.com") ); } /** . */ @org.junit.Test public void functxFnResolveUriAll() { final XQuery query = new XQuery( "(resolve-uri('prod', 'http://datypic.com/'), resolve-uri('prod2', 'http://datypic.com/prod1'), resolve-uri( 'http://example.org','http://datypic.com'), resolve-uri( 'http://datypic.com', '../base'), resolve-uri( '', 'http://datypic.com'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://datypic.com/prod http://datypic.com/prod2 http://example.org http://datypic.com http://datypic.com") ); } /** . */ @org.junit.Test public void functxFnReverse1() { final XQuery query = new XQuery( "(reverse( (1, 2, 3, 4, 5) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5 4 3 2 1") ); } /** . */ @org.junit.Test public void functxFnReverse2() { final XQuery query = new XQuery( "(reverse( (6, 2, 4) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4 2 6") ); } /** . */ @org.junit.Test public void functxFnReverse3() { final XQuery query = new XQuery( "(reverse( () ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnReverseAll() { final XQuery query = new XQuery( "(reverse( (1, 2, 3, 4, 5) ), reverse( (6, 2, 4) ), reverse( () ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5 4 3 2 1 4 2 6") ); } /** . */ @org.junit.Test public void functxFnRoot1() { final XQuery query = new XQuery( "let $in-xml := 123 return (root( (/) //item[1]))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n \n \n \n \n \n \n", false) ); } /** . */ @org.junit.Test public void functxFnRoot2() { final XQuery query = new XQuery( "let $in-xml := 123 return (root($in-xml/x))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("123", false) ); } /** . */ @org.junit.Test public void functxFnRootAll() { final XQuery query = new XQuery( "let $in-xml := 123 return (root( (/) //item[1]), root($in-xml/x))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n \n \n \n \n \n \n123", false) ); } /** . */ @org.junit.Test public void functxFnRound1() { final XQuery query = new XQuery( "(round(5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** . */ @org.junit.Test public void functxFnRound2() { final XQuery query = new XQuery( "(round(5.1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** . */ @org.junit.Test public void functxFnRound3() { final XQuery query = new XQuery( "(round(5.5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("6") ); } /** . */ @org.junit.Test public void functxFnRound4() { final XQuery query = new XQuery( "(round(-5.5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-5") ); } /** . */ @org.junit.Test public void functxFnRound5() { final XQuery query = new XQuery( "(round(-5.51))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-6") ); } /** . */ @org.junit.Test public void functxFnRoundAll() { final XQuery query = new XQuery( "(round(5), round(5.1), round(5.5), round(-5.5), round(-5.51))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5 5 6 -5 -6") ); } /** . */ @org.junit.Test public void functxFnRoundHalfToEven1() { final XQuery query = new XQuery( "(round-half-to-even(5.5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("6") ); } /** . */ @org.junit.Test public void functxFnRoundHalfToEven2() { final XQuery query = new XQuery( "(round-half-to-even(6.5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("6") ); } /** . */ @org.junit.Test public void functxFnRoundHalfToEven3() { final XQuery query = new XQuery( "(round-half-to-even(9372.253, 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9372.25") ); } /** . */ @org.junit.Test public void functxFnRoundHalfToEven4() { final XQuery query = new XQuery( "(round-half-to-even(9372.253, 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("9372") ); } /** . */ @org.junit.Test public void functxFnRoundHalfToEven5() { final XQuery query = new XQuery( "(round-half-to-even(9372.253, -3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("9000") ); } /** . */ @org.junit.Test public void functxFnRoundHalfToEvenAll() { final XQuery query = new XQuery( "(round-half-to-even(5.5), round-half-to-even(6.5), round-half-to-even(9372.253, 2), round-half-to-even(9372.253, 0), round-half-to-even(9372.253, -3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "6 6 9372.25 9372 9000") ); } /** . */ @org.junit.Test public void functxFnSecondsFromDateTime1() { final XQuery query = new XQuery( "(seconds-from-dateTime( xs:dateTime('2006-08-15T10:30:23.5')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "23.5") ); } /** . */ @org.junit.Test public void functxFnSecondsFromDuration1() { final XQuery query = new XQuery( "(seconds-from-duration( xs:dayTimeDuration('PT30.5S')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "30.5") ); } /** . */ @org.junit.Test public void functxFnSecondsFromDuration2() { final XQuery query = new XQuery( "(seconds-from-duration( xs:dayTimeDuration('-PT90.5S')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-30.5") ); } /** . */ @org.junit.Test public void functxFnSecondsFromDuration3() { final XQuery query = new XQuery( "(seconds-from-duration( xs:dayTimeDuration('PT1M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** . */ @org.junit.Test public void functxFnSecondsFromDuration4() { final XQuery query = new XQuery( "(seconds-from-duration( xs:dayTimeDuration('PT60S')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** . */ @org.junit.Test public void functxFnSecondsFromDurationAll() { final XQuery query = new XQuery( "(seconds-from-duration( xs:dayTimeDuration('PT30.5S')), seconds-from-duration( xs:dayTimeDuration('-PT90.5S')), seconds-from-duration( xs:dayTimeDuration('PT1M')), seconds-from-duration( xs:dayTimeDuration('PT60S')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "30.5 -30.5 0 0") ); } /** . */ @org.junit.Test public void functxFnSecondsFromTime1() { final XQuery query = new XQuery( "(seconds-from-time(xs:time('10:30:23.5')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "23.5") ); } /** . */ @org.junit.Test public void functxFnStartsWith1() { final XQuery query = new XQuery( "(starts-with('query', 'que'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnStartsWith2() { final XQuery query = new XQuery( "(starts-with('query', 'query'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnStartsWith3() { final XQuery query = new XQuery( "(starts-with('query', 'u'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnStartsWith4() { final XQuery query = new XQuery( "(starts-with('query', ''))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnStartsWith5() { final XQuery query = new XQuery( "(starts-with('', 'query'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnStartsWith6() { final XQuery query = new XQuery( "(starts-with('', ''))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnStartsWith7() { final XQuery query = new XQuery( "(starts-with('query', ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnStartsWith8() { final XQuery query = new XQuery( "(starts-with(' query', 'q'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void functxFnStartsWithAll() { final XQuery query = new XQuery( "(starts-with('query', 'que'), starts-with('query', 'query'), starts-with('query', 'u'), starts-with('query', ''), starts-with('', 'query'), starts-with('', ''), starts-with('query', ()), starts-with(' query', 'q'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true false true false true true false") ); } /** . */ @org.junit.Test public void functxFnString1() { final XQuery query = new XQuery( "let $in-xml-2 := 784 Cotton Dress Shirt white gray Our favorite shirt! return (string($in-xml-2/number))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "784") ); } /** . */ @org.junit.Test public void functxFnString2() { final XQuery query = new XQuery( "let $in-xml-2 := 784 Cotton Dress Shirt white gray Our favorite shirt! return (string($in-xml-2/desc))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Our favorite shirt!") ); } /** . */ @org.junit.Test public void functxFnString3() { final XQuery query = new XQuery( "let $in-xml-2 := 784 Cotton Dress Shirt white gray Our favorite shirt! return (string($in-xml-2/@dept))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "MEN") ); } /** . */ @org.junit.Test public void functxFnStringAll() { final XQuery query = new XQuery( "let $in-xml-2 := 784 Cotton Dress Shirt white gray Our favorite shirt! return (string($in-xml-2/number), string($in-xml-2/desc), string($in-xml-2/@dept))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "784 Our favorite shirt! MEN") ); } /** . */ @org.junit.Test public void functxFnStringJoin1() { final XQuery query = new XQuery( "(string-join( ('a', 'b', 'c'), ''))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc") ); } /** . */ @org.junit.Test public void functxFnStringJoin2() { final XQuery query = new XQuery( "(string-join( ('a', 'b', 'c'), '/*'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a/*b/*c") ); } /** . */ @org.junit.Test public void functxFnStringJoin3() { final XQuery query = new XQuery( "(string-join( ('a', '', 'c'), '/*'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a/*/*c") ); } /** . */ @org.junit.Test public void functxFnStringJoin4() { final XQuery query = new XQuery( "(string-join( 'a', '/*'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a") ); } /** . */ @org.junit.Test public void functxFnStringJoin5() { final XQuery query = new XQuery( "(string-join((), '/*'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnStringJoinAll() { final XQuery query = new XQuery( "(string-join( ('a', 'b', 'c'), ''), string-join( ('a', 'b', 'c'), '/*'), string-join( ('a', '', 'c'), '/*'), string-join( 'a', '/*'), string-join((), '/*'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc a/*b/*c a/*/*c a ") ); } /** . */ @org.junit.Test public void functxFnStringLength1() { final XQuery query = new XQuery( "(string-length('query'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** . */ @org.junit.Test public void functxFnStringLength2() { final XQuery query = new XQuery( "(string-length(' \n" + "query\n" + " '))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("9") ); } /** . */ @org.junit.Test public void functxFnStringLength3() { final XQuery query = new XQuery( "(string-length(normalize-space(' query ')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** . */ @org.junit.Test public void functxFnStringLength4() { final XQuery query = new XQuery( "(string-length('xml query'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("9") ); } /** . */ @org.junit.Test public void functxFnStringLength5() { final XQuery query = new XQuery( "(string-length(''))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** . */ @org.junit.Test public void functxFnStringLength6() { final XQuery query = new XQuery( "(string-length(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** . */ @org.junit.Test public void functxFnStringLengthAll() { final XQuery query = new XQuery( "(string-length('query'), string-length(' \n" + "query \n" + " '), string-length(normalize-space(' \n" + "query \n" + " ')), string-length('xml query'), string-length(''), string-length(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5 10 5 9 0 0") ); } /** . */ @org.junit.Test public void functxFnStringToCodepoints1() { final XQuery query = new XQuery( "(string-to-codepoints('abc'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "97 98 99") ); } /** . */ @org.junit.Test public void functxFnStringToCodepoints2() { final XQuery query = new XQuery( "(string-to-codepoints('a'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("97") ); } /** . */ @org.junit.Test public void functxFnStringToCodepoints3() { final XQuery query = new XQuery( "(string-to-codepoints(''))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnStringToCodepointsAll() { final XQuery query = new XQuery( "(string-to-codepoints('abc'), string-to-codepoints('a'), string-to-codepoints(''))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "97 98 99 97") ); } /** . */ @org.junit.Test public void functxFnSubsequence1() { final XQuery query = new XQuery( "(subsequence( ('a', 'b', 'c', 'd', 'e'), 3) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "c d e") ); } /** . */ @org.junit.Test public void functxFnSubsequence2() { final XQuery query = new XQuery( "(subsequence( ('a', 'b', 'c', 'd', 'e'), 3, 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "c d") ); } /** . */ @org.junit.Test public void functxFnSubsequence3() { final XQuery query = new XQuery( "(subsequence( ('a', 'b', 'c', 'd', 'e'), 3, 10))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "c d e") ); } /** . */ @org.junit.Test public void functxFnSubsequence4() { final XQuery query = new XQuery( "(subsequence( ('a', 'b', 'c', 'd', 'e'), 10))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnSubsequence5() { final XQuery query = new XQuery( "(subsequence( ('a', 'b', 'c', 'd', 'e'), -2, 5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b") ); } /** . */ @org.junit.Test public void functxFnSubsequence6() { final XQuery query = new XQuery( "(subsequence( (), 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnSubsequenceAll() { final XQuery query = new XQuery( "(subsequence( ('a', 'b', 'c', 'd', 'e'), 3) , subsequence( ('a', 'b', 'c', 'd', 'e'), 3, 2), subsequence( ('a', 'b', 'c', 'd', 'e'), 3, 10), subsequence( ('a', 'b', 'c', 'd', 'e'), 10), subsequence( ('a', 'b', 'c', 'd', 'e'), -2, 5), subsequence( (), 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "c d e c d c d e a b") ); } /** . */ @org.junit.Test public void functxFnSubstring1() { final XQuery query = new XQuery( "(substring('query', 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "query") ); } /** . */ @org.junit.Test public void functxFnSubstring10() { final XQuery query = new XQuery( "(substring('', 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnSubstring11() { final XQuery query = new XQuery( "(substring((), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnSubstring2() { final XQuery query = new XQuery( "(substring('query', 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ery") ); } /** . */ @org.junit.Test public void functxFnSubstring3() { final XQuery query = new XQuery( "(substring('query', 1, 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "q") ); } /** . */ @org.junit.Test public void functxFnSubstring4() { final XQuery query = new XQuery( "(substring('query', 2, 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "uer") ); } /** . */ @org.junit.Test public void functxFnSubstring5() { final XQuery query = new XQuery( "(substring('query', 2, 850))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "uery") ); } /** . */ @org.junit.Test public void functxFnSubstring6() { final XQuery query = new XQuery( "(substring('query', 6, 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnSubstring7() { final XQuery query = new XQuery( "(substring('query', -2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "query") ); } /** . */ @org.junit.Test public void functxFnSubstring8() { final XQuery query = new XQuery( "(substring('query', -2, 5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "qu") ); } /** . */ @org.junit.Test public void functxFnSubstring9() { final XQuery query = new XQuery( "(substring('query', 1, 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnSubstringAfter1() { final XQuery query = new XQuery( "(substring-after('query', 'u'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ery") ); } /** . */ @org.junit.Test public void functxFnSubstringAfter2() { final XQuery query = new XQuery( "(substring-after('queryquery', 'ue'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ryquery") ); } /** . */ @org.junit.Test public void functxFnSubstringAfter3() { final XQuery query = new XQuery( "(substring-after('query', 'y'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnSubstringAfter4() { final XQuery query = new XQuery( "(substring-after('query', 'x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnSubstringAfter5() { final XQuery query = new XQuery( "(substring-after('query', ''))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "query") ); } /** . */ @org.junit.Test public void functxFnSubstringAfter6() { final XQuery query = new XQuery( "(substring-after('', 'x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnSubstringAfterAll() { final XQuery query = new XQuery( "(substring-after('query', 'u'), substring-after('queryquery', 'ue'), substring-after('query', 'y'), substring-after('query', 'x'), substring-after('query', ''), substring-after('', 'x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ery ryquery query ") ); } /** . */ @org.junit.Test public void functxFnSubstringAll() { final XQuery query = new XQuery( "(substring('query', 1), substring('query', 3), substring('query', 1, 1), substring('query', 2, 3), substring('query', 2, 850), substring('query', 6, 2), substring('query', -2), substring('query', -2, 5), substring('query', 1, 0), substring('', 1), substring((), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "query ery q uer uery query qu ") ); } /** . */ @org.junit.Test public void functxFnSubstringBefore1() { final XQuery query = new XQuery( "(substring-before('query', 'r'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "que") ); } /** . */ @org.junit.Test public void functxFnSubstringBefore2() { final XQuery query = new XQuery( "(substring-before('query', 'ery'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "qu") ); } /** . */ @org.junit.Test public void functxFnSubstringBefore3() { final XQuery query = new XQuery( "(substring-before('queryquery', 'ery'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "qu") ); } /** . */ @org.junit.Test public void functxFnSubstringBefore4() { final XQuery query = new XQuery( "(substring-before('query', 'query'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnSubstringBefore5() { final XQuery query = new XQuery( "(substring-before('query', 'x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnSubstringBefore6() { final XQuery query = new XQuery( "(substring-before('query', ''))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnSubstringBefore7() { final XQuery query = new XQuery( "(substring-before('query', ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnSubstringBeforeAll() { final XQuery query = new XQuery( "(substring-before('query', 'r'), substring-before('query', 'ery'), substring-before('queryquery', 'ery'), substring-before('query', 'query'), substring-before('query', 'x'), substring-before('query', ''), substring-before('query', ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "que qu qu ") ); } /** . */ @org.junit.Test public void functxFnSum1() { final XQuery query = new XQuery( "let $ordDoc := (/) return (sum( (1, 2, 3) ))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("6") ); } /** . */ @org.junit.Test public void functxFnSum2() { final XQuery query = new XQuery( "let $ordDoc := (/) return (sum($ordDoc//item/@quantity))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("7") ); } /** . */ @org.junit.Test public void functxFnSum3() { final XQuery query = new XQuery( "let $ordDoc := (/) return (sum( (xs:yearMonthDuration('P1Y2M'), xs:yearMonthDuration('P2Y3M')) ))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P3Y5M") ); } /** . */ @org.junit.Test public void functxFnSum4() { final XQuery query = new XQuery( "let $ordDoc := (/) return (sum( (1, 2, 3, () ) ))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("6") ); } /** . */ @org.junit.Test public void functxFnSum5() { final XQuery query = new XQuery( "let $ordDoc := (/) return (sum( () ))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** . */ @org.junit.Test public void functxFnSum6() { final XQuery query = new XQuery( "let $ordDoc := (/) return (sum( (), () ))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnSumAll() { final XQuery query = new XQuery( "let $ordDoc := (/) return (sum( (1, 2, 3) ), sum($ordDoc//item/@quantity), sum( (xs:yearMonthDuration('P1Y2M'), xs:yearMonthDuration('P2Y3M')) ), sum( (1, 2, 3, () ) ), sum( () ), sum( (), () ))", ctx); try { query.context(node(file("app/FunctxFn/functx_order.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "6 7 P3Y5M 6 0") ); } /** . */ @org.junit.Test public void functxFnTimezoneFromDate1() { final XQuery query = new XQuery( "(timezone-from-date( xs:date('2006-08-15-05:00')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-PT5H") ); } /** . */ @org.junit.Test public void functxFnTimezoneFromDate2() { final XQuery query = new XQuery( "(timezone-from-date( xs:date('2006-08-15')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnTimezoneFromDateAll() { final XQuery query = new XQuery( "(timezone-from-date( xs:date('2006-08-15-05:00')), timezone-from-date( xs:date('2006-08-15')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-PT5H") ); } /** . */ @org.junit.Test public void functxFnTimezoneFromDateTime1() { final XQuery query = new XQuery( "(timezone-from-dateTime( xs:dateTime('2006-08-15T10:30:23-05:00')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-PT5H") ); } /** . */ @org.junit.Test public void functxFnTimezoneFromDateTime2() { final XQuery query = new XQuery( "(timezone-from-dateTime( xs:dateTime('2006-08-15T10:30:23')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnTimezoneFromDateTimeAll() { final XQuery query = new XQuery( "(timezone-from-dateTime( xs:dateTime('2006-08-15T10:30:23-05:00')), timezone-from-dateTime( xs:dateTime('2006-08-15T10:30:23')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-PT5H") ); } /** . */ @org.junit.Test public void functxFnTimezoneFromTime1() { final XQuery query = new XQuery( "(timezone-from-time( xs:time('09:54:00-05:00')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-PT5H") ); } /** . */ @org.junit.Test public void functxFnTimezoneFromTime2() { final XQuery query = new XQuery( "(timezone-from-time( xs:time('09:54:00+05:00')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT5H") ); } /** . */ @org.junit.Test public void functxFnTimezoneFromTime3() { final XQuery query = new XQuery( "(timezone-from-time( xs:time('09:54:00Z')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** . */ @org.junit.Test public void functxFnTimezoneFromTime4() { final XQuery query = new XQuery( "(timezone-from-time( xs:time('09:54:00')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnTimezoneFromTimeAll() { final XQuery query = new XQuery( "(timezone-from-time( xs:time('09:54:00-05:00')), timezone-from-time( xs:time('09:54:00+05:00')), timezone-from-time( xs:time('09:54:00Z')), timezone-from-time( xs:time('09:54:00')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-PT5H PT5H PT0S") ); } /** . */ @org.junit.Test public void functxFnTokenize1() { final XQuery query = new XQuery( "(tokenize( 'a b c', '\\s'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b c") ); } /** . */ @org.junit.Test public void functxFnTokenize10() { final XQuery query = new XQuery( "(tokenize( (), '\\s+'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnTokenize11() { final XQuery query = new XQuery( "(tokenize( 'abc', '\\s'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc") ); } /** . */ @org.junit.Test public void functxFnTokenize12() { final XQuery query = new XQuery( "(tokenize( 'a,xb,xc', ',|,x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a xb xc") ); } /** . */ @org.junit.Test public void functxFnTokenize2() { final XQuery query = new XQuery( "string-join(tokenize( 'a b c', '\\s'), '|')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a||||b|c") ); } /** . */ @org.junit.Test public void functxFnTokenize3() { final XQuery query = new XQuery( "(tokenize( 'a b c', '\\s+'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b c") ); } /** . */ @org.junit.Test public void functxFnTokenize4() { final XQuery query = new XQuery( "(tokenize( ' b c', '\\s'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, " b c") ); } /** . */ @org.junit.Test public void functxFnTokenize5() { final XQuery query = new XQuery( "(tokenize( 'a,b,c', ','))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b c") ); } /** . */ @org.junit.Test public void functxFnTokenize6() { final XQuery query = new XQuery( "(tokenize( 'a,b,,c', ','))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b c") ); } /** . */ @org.junit.Test public void functxFnTokenize7() { final XQuery query = new XQuery( "(tokenize( 'a, b, c', '[,\\s]+'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b c") ); } /** . */ @org.junit.Test public void functxFnTokenize8() { final XQuery query = new XQuery( "(tokenize( '2006-12-25T12:15:00', '[\\-T:]'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2006 12 25 12 15 00") ); } /** . */ @org.junit.Test public void functxFnTokenize9() { final XQuery query = new XQuery( "(tokenize( 'Hello, there.', '\\W+'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Hello there ") ); } /** . */ @org.junit.Test public void functxFnTokenizeAll() { final XQuery query = new XQuery( "(tokenize( 'a b c', '\\s'), tokenize( 'a b c', '\\s'), tokenize( 'a b c', '\\s+'), tokenize( ' b c', '\\s'), tokenize( 'a,b,c', ','), tokenize( 'a,b,,c', ','), tokenize( 'a, b, c', '[,\\s]+'), tokenize( '2006-12-25T12:15:00', '[\\-T:]'), tokenize( 'Hello, there.', '\\W+'), tokenize( (), '\\s+'), tokenize( 'abc', '\\s'), tokenize( 'a,xb,xc', ',|,x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b c a b c a b c b c a b c a b c a b c 2006 12 25 12 15 00 Hello there abc a xb xc") ); } /** . */ @org.junit.Test public void functxFnTranslate1() { final XQuery query = new XQuery( "(translate('1999/01/02', '/', '-'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-01-02") ); } /** . */ @org.junit.Test public void functxFnTranslate2() { final XQuery query = new XQuery( "(translate('xml query', 'qlmx', 'QLMX'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "XML Query") ); } /** . */ @org.junit.Test public void functxFnTranslate3() { final XQuery query = new XQuery( "(translate('xml query', 'qlmx ', 'Q'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Query") ); } /** . */ @org.junit.Test public void functxFnTranslate4() { final XQuery query = new XQuery( "(translate('xml query', 'qlmx ', ''))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "uery") ); } /** . */ @org.junit.Test public void functxFnTranslate5() { final XQuery query = new XQuery( "(translate('xml query', 'abcd', 'ABCD'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xml query") ); } /** . */ @org.junit.Test public void functxFnTranslate6() { final XQuery query = new XQuery( "(translate('', 'qlmx ', 'Q'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnTranslate7() { final XQuery query = new XQuery( "(translate((), 'qlmx ', 'Q'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnTranslateAll() { final XQuery query = new XQuery( "(translate('1999/01/02', '/', '-'), translate('xml query', 'qlmx', 'QLMX'), translate('xml query', 'qlmx ', 'Q'), translate('xml query', 'qlmx ', ''), translate('xml query', 'abcd', 'ABCD'), translate('', 'qlmx ', 'Q'), translate((), 'qlmx ', 'Q'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-01-02 XML Query Query uery xml query ") ); } /** . */ @org.junit.Test public void functxFnTrue1() { final XQuery query = new XQuery( "(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void functxFnUpperCase1() { final XQuery query = new XQuery( "(upper-case('query'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "QUERY") ); } /** . */ @org.junit.Test public void functxFnUpperCase2() { final XQuery query = new XQuery( "(upper-case('QUERY'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "QUERY") ); } /** . */ @org.junit.Test public void functxFnUpperCase3() { final XQuery query = new XQuery( "(upper-case('Query'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "QUERY") ); } /** . */ @org.junit.Test public void functxFnUpperCase4() { final XQuery query = new XQuery( "(upper-case('query-123'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "QUERY-123") ); } /** . */ @org.junit.Test public void functxFnUpperCaseAll() { final XQuery query = new XQuery( "(upper-case('query'), upper-case('QUERY'), upper-case('Query'), upper-case('query-123'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "QUERY QUERY QUERY QUERY-123") ); } /** . */ @org.junit.Test public void functxFnYearFromDate1() { final XQuery query = new XQuery( "(year-from-date(xs:date('2006-08-15')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2006") ); } /** . */ @org.junit.Test public void functxFnYearFromDateTime1() { final XQuery query = new XQuery( "(year-from-dateTime( xs:dateTime('2006-08-15T10:30:23')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2006") ); } /** . */ @org.junit.Test public void functxFnYearsFromDuration1() { final XQuery query = new XQuery( "(years-from-duration( xs:yearMonthDuration('P3Y')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** . */ @org.junit.Test public void functxFnYearsFromDuration2() { final XQuery query = new XQuery( "(years-from-duration( xs:yearMonthDuration('P3Y11M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** . */ @org.junit.Test public void functxFnYearsFromDuration3() { final XQuery query = new XQuery( "(years-from-duration( xs:yearMonthDuration('-P18M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** . */ @org.junit.Test public void functxFnYearsFromDuration4() { final XQuery query = new XQuery( "(years-from-duration( xs:yearMonthDuration('P1Y18M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** . */ @org.junit.Test public void functxFnYearsFromDuration5() { final XQuery query = new XQuery( "(years-from-duration( xs:yearMonthDuration('P12M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** . */ @org.junit.Test public void functxFnYearsFromDurationAll() { final XQuery query = new XQuery( "(years-from-duration( xs:yearMonthDuration('P3Y')), years-from-duration( xs:yearMonthDuration('P3Y11M')), years-from-duration( xs:yearMonthDuration('-P18M')), years-from-duration( xs:yearMonthDuration('P1Y18M')), years-from-duration( xs:yearMonthDuration('P12M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3 3 -1 2 1") ); } /** . */ @org.junit.Test public void functxFnZeroOrOne1() { final XQuery query = new XQuery( "(zero-or-one( () ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void functxFnZeroOrOne2() { final XQuery query = new XQuery( "(zero-or-one('a'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a") ); } /** . */ @org.junit.Test public void functxFnZeroOrOneAll() { final XQuery query = new XQuery( "(zero-or-one( () ), zero-or-one('a'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/app/AppFunctxFunctx.java000066400000000000000000043175451222453003200302470ustar00rootroot00000000000000package org.basex.test.qt3ts.app; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests derived from the functx library . * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class AppFunctxFunctx extends QT3TestSet { /** * ~ : Adds attributes to XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-attributes.html : @param $elements the element(s) to which you wish to add the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add . */ @org.junit.Test public void functxFunctxAddAttributes1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " declare namespace new = \"http://new\";\n" + " (:~ \n" + " : Adds attributes to XML elements : \n" + " : @author Priscilla Walmsley, Datypic \n" + " : @version 1.0 \n" + " : @see http://www.xqueryfunctions.com/xq/functx_add-attributes.html \n" + " : @param $elements the element(s) to which you wish to add the attribute \n" + " : @param $attrNames the name(s) of the attribute(s) to add \n" + " : @param $attrValues the value(s) of the attribute(s) to add :)\n" + " declare function functx:add-attributes ( $elements as element()* , $attrNames as xs:QName* , $attrValues as xs:anyAtomicType* ) as element()? { \n" + " for $element in $elements return element { node-name($element)} { \n" + " for $attrName at $seq in $attrNames return \n" + " if ($element/@*[node-name(.) = $attrName]) then () else attribute {$attrName} {$attrValues[$seq]}, $element/@*, $element/node() } \n" + " } ;\n" + " let $in-xml := x x \n" + " return (functx:add-attributes( $in-xml/a, xs:QName('att1'), 1))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("x", false) ); } /** * ~ : Adds attributes to XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-attributes.html : @param $elements the element(s) to which you wish to add the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add . */ @org.junit.Test public void functxFunctxAddAttributes2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " declare namespace new = \"http://new\";\n" + " (:~ \n" + " : Adds attributes to XML elements : \n" + " : @author Priscilla Walmsley, Datypic \n" + " : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-attributes.html \n" + " : @param $elements the element(s) to which you wish to add the attribute \n" + " : @param $attrNames the name(s) of the attribute(s) to add \n" + " : @param $attrValues the value(s) of the attribute(s) to add :)\n" + " declare function functx:add-attributes ( $elements as element()* , $attrNames as xs:QName* , $attrValues as xs:anyAtomicType* ) as element()? { \n" + " for $element in $elements \n" + " return element { node-name($element)} { \n" + " for $attrName at $seq in $attrNames \n" + " return if ($element/@*[node-name(.) = $attrName]) then () else attribute {$attrName} {$attrValues[$seq]}, $element/@*, $element/node() } \n" + " } ;\n" + " let $in-xml := x x \n" + " return (functx:add-attributes( $in-xml/a, (xs:QName('att1'),xs:QName('att2')), (1,2)))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("x", false) ); } /** * ~ : Adds attributes to XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-attributes.html : @param $elements the element(s) to which you wish to add the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add . */ @org.junit.Test public void functxFunctxAddAttributes3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " declare namespace new = \"http://new\";\n" + " (:~ \n" + " : Adds attributes to XML elements : \n" + " : @author Priscilla Walmsley, Datypic \n" + " : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-attributes.html \n" + " : @param $elements the element(s) to which you wish to add the attribute \n" + " : @param $attrNames the name(s) of the attribute(s) to add \n" + " : @param $attrValues the value(s) of the attribute(s) to add :)\n" + " declare function functx:add-attributes ( $elements as element()* , $attrNames as xs:QName* , $attrValues as xs:anyAtomicType* ) as element()? { \n" + " for $element in $elements \n" + " return element { node-name($element)} { \n" + " for $attrName at $seq in $attrNames \n" + " return if ($element/@*[node-name(.) = $attrName]) then () else attribute {$attrName} {$attrValues[$seq]}, $element/@*, $element/node() } \n" + " } ;\n" + " let $in-xml := x x \n" + " return (functx:add-attributes( $in-xml/b, (xs:QName('att1'),xs:QName('att2')), (1,2)))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("x", false) ); } /** * ~ : Adds attributes to XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-attributes.html : @param $elements the element(s) to which you wish to add the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add . */ @org.junit.Test public void functxFunctxAddAttributes4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " declare namespace new = \"http://new\";\n" + " (:~ : Adds attributes to XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-attributes.html : @param $elements the element(s) to which you wish to add the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add :)\n" + " declare function functx:add-attributes ( $elements as element()* , $attrNames as xs:QName* , $attrValues as xs:anyAtomicType* ) as element()? { \n" + " for $element in $elements return element { node-name($element)} { \n" + " for $attrName at $seq in $attrNames \n" + " return if ($element/@*[node-name(.) = $attrName]) then () else attribute {$attrName} {$attrValues[$seq]}, $element/@*, $element/node() } \n" + " } ;\n" + " let $in-xml := x x \n" + " return (functx:add-attributes( $in-xml/a, xs:QName('new:att1'), 1))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("x", false) ); } /** * ~ : Adds attributes to XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-attributes.html : @param $elements the element(s) to which you wish to add the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add . */ @org.junit.Test public void functxFunctxAddAttributes5() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " declare namespace new = \"http://new\";\n" + " (:~ : Adds attributes to XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-attributes.html : @param $elements the element(s) to which you wish to add the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add :)\n" + " declare function functx:add-attributes ( $elements as element()* , $attrNames as xs:QName* , $attrValues as xs:anyAtomicType* ) as element()? { \n" + " for $element in $elements \n" + " return element { node-name($element)} { \n" + " for $attrName at $seq in $attrNames \n" + " return if ($element/@*[node-name(.) = $attrName]) then () else attribute {$attrName} {$attrValues[$seq]}, $element/@*, $element/node() } \n" + " } ;\n" + " let $in-xml := x x \n" + " return (functx:add-attributes( $in-xml/a, QName('http://new','new:att1'), 1))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("x", false) ); } /** * ~ : Adds attributes to XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-attributes.html : @param $elements the element(s) to which you wish to add the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add . */ @org.junit.Test public void functxFunctxAddAttributesAll() { final XQuery query = new XQuery( "\n" + " declare namespace functx = \"http://www.example.com/\";\n" + " declare namespace new = \"http://new\";\n" + " (:~ \n" + " : Adds attributes to XML elements : \n" + " : @author Priscilla Walmsley, Datypic \n" + " : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-attributes.html \n" + " : @param $elements the element(s) to which you wish to add the attribute \n" + " : @param $attrNames the name(s) of the attribute(s) to add \n" + " : @param $attrValues the value(s) of the attribute(s) to add :)\n" + " declare function functx:add-attributes ( $elements as element()* , $attrNames as xs:QName* , $attrValues as xs:anyAtomicType* ) as element()? { \n" + " for $element in $elements \n" + " return element { node-name($element)} { \n" + " for $attrName at $seq in $attrNames \n" + " return if ($element/@*[node-name(.) = $attrName]) then () else attribute {$attrName} {$attrValues[$seq]}, $element/@*, $element/node() } \n" + " } ;\n" + " let $in-xml := x x \n" + " return (functx:add-attributes( $in-xml/a, xs:QName('att1'), 1), \n" + " functx:add-attributes( $in-xml/a, (xs:QName('att1'),xs:QName('att2')), (1,2)), \n" + " functx:add-attributes( $in-xml/b, (xs:QName('att1'),xs:QName('att2')), (1,2)), \n" + " functx:add-attributes( $in-xml/a, xs:QName('new:att1'), 1), \n" + " functx:add-attributes( $in-xml/a, QName('http://new','new:att1'), 1))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("xxxxx", false) ); } /** * ~ : Adds months to a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-months.html : @param $date the date : @param $months the number of months to add ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty ~ : Construct a yearMonthDuration from a number of years and months : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_yearmonthduration.html : @param $years the number of years : @param $months the number of months . */ @org.junit.Test public void functxFunctxAddMonths1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Adds months to a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-months.html : @param $date the date : @param $months the number of months to add :)\n" + " declare function functx:add-months ( $date as xs:anyAtomicType? , $months as xs:integer ) as xs:date? { xs:date($date) + functx:yearMonthDuration(0,$months) } ;\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " (:~ : Construct a yearMonthDuration from a number of years and months : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_yearmonthduration.html : @param $years the number of years : @param $months the number of months :)\n" + " declare function functx:yearMonthDuration ( $years as xs:decimal? , $months as xs:integer? ) as xs:yearMonthDuration { (xs:yearMonthDuration('P1M') * functx:if-empty($months,0)) + (xs:yearMonthDuration('P1Y') * functx:if-empty($years,0)) } ;\n" + " (functx:add-months(xs:date('2004-01-23'),1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-02-23") ); } /** * ~ : Adds months to a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-months.html : @param $date the date : @param $months the number of months to add ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty ~ : Construct a yearMonthDuration from a number of years and months : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_yearmonthduration.html : @param $years the number of years : @param $months the number of months . */ @org.junit.Test public void functxFunctxAddMonths2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Adds months to a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-months.html : @param $date the date : @param $months the number of months to add :)\n" + " declare function functx:add-months ( $date as xs:anyAtomicType? , $months as xs:integer ) as xs:date? { xs:date($date) + functx:yearMonthDuration(0,$months) } ;\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " (:~ : Construct a yearMonthDuration from a number of years and months : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_yearmonthduration.html : @param $years the number of years : @param $months the number of months :)\n" + " declare function functx:yearMonthDuration ( $years as xs:decimal? , $months as xs:integer? ) as xs:yearMonthDuration { (xs:yearMonthDuration('P1M') * functx:if-empty($months,0)) + (xs:yearMonthDuration('P1Y') * functx:if-empty($years,0)) } ;\n" + " (functx:add-months( xs:dateTime('2005-12-31T12:00:13'),2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2006-02-28") ); } /** * ~ : Adds months to a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-months.html : @param $date the date : @param $months the number of months to add ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty ~ : Construct a yearMonthDuration from a number of years and months : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_yearmonthduration.html : @param $years the number of years : @param $months the number of months . */ @org.junit.Test public void functxFunctxAddMonths3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Adds months to a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-months.html : @param $date the date : @param $months the number of months to add :)\n" + " declare function functx:add-months ( $date as xs:anyAtomicType? , $months as xs:integer ) as xs:date? { xs:date($date) + functx:yearMonthDuration(0,$months) } ;\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " (:~ : Construct a yearMonthDuration from a number of years and months : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_yearmonthduration.html : @param $years the number of years : @param $months the number of months :)\n" + " declare function functx:yearMonthDuration ( $years as xs:decimal? , $months as xs:integer? ) as xs:yearMonthDuration { (xs:yearMonthDuration('P1M') * functx:if-empty($months,0)) + (xs:yearMonthDuration('P1Y') * functx:if-empty($years,0)) } ;\n" + " (functx:add-months('2005-12-31',-3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2005-09-30") ); } /** * ~ : Adds months to a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-months.html : @param $date the date : @param $months the number of months to add ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty ~ : Construct a yearMonthDuration from a number of years and months : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_yearmonthduration.html : @param $years the number of years : @param $months the number of months . */ @org.junit.Test public void functxFunctxAddMonthsAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Adds months to a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-months.html : @param $date the date : @param $months the number of months to add :)\n" + " declare function functx:add-months ( $date as xs:anyAtomicType? , $months as xs:integer ) as xs:date? { xs:date($date) + functx:yearMonthDuration(0,$months) } ;\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " (:~ : Construct a yearMonthDuration from a number of years and months : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_yearmonthduration.html : @param $years the number of years : @param $months the number of months :)\n" + " declare function functx:yearMonthDuration ( $years as xs:decimal? , $months as xs:integer? ) as xs:yearMonthDuration { (xs:yearMonthDuration('P1M') * functx:if-empty($months,0)) + (xs:yearMonthDuration('P1Y') * functx:if-empty($years,0)) } ;\n" + " (functx:add-months(xs:date('2004-01-23'),1), functx:add-months( xs:dateTime('2005-12-31T12:00:13'),2), functx:add-months('2005-12-31',-3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-02-23 2006-02-28 2005-09-30") ); } /** * ~ : Adds attributes to XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-or-update-attributes.html : @param $elements the element(s) to which you wish to add the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add . */ @org.junit.Test public void functxFunctxAddOrUpdateAttributes1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " declare namespace new = \"http://new\";\n" + " (:~ : Adds attributes to XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-or-update-attributes.html : @param $elements the element(s) to which you wish to add the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add :)\n" + " declare function functx:add-or-update-attributes ( $elements as element()* , $attrNames as xs:QName* , $attrValues as xs:anyAtomicType* ) as element()? { for $element in $elements return element { node-name($element)} { for $attrName at $seq in $attrNames return attribute {$attrName} {$attrValues[$seq]}, $element/@*[not(node-name(.) = $attrNames)], $element/node() } } ;\n" + " let $in-xml := x x return (functx:add-or-update-attributes( $in-xml/a, xs:QName('att1'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("x", false) ); } /** * ~ : Adds attributes to XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-or-update-attributes.html : @param $elements the element(s) to which you wish to add the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add . */ @org.junit.Test public void functxFunctxAddOrUpdateAttributes2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " declare namespace new = \"http://new\";\n" + " (:~ : Adds attributes to XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-or-update-attributes.html : @param $elements the element(s) to which you wish to add the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add :)\n" + " declare function functx:add-or-update-attributes ( $elements as element()* , $attrNames as xs:QName* , $attrValues as xs:anyAtomicType* ) as element()? { for $element in $elements return element { node-name($element)} { for $attrName at $seq in $attrNames return attribute {$attrName} {$attrValues[$seq]}, $element/@*[not(node-name(.) = $attrNames)], $element/node() } } ;\n" + " let $in-xml := x x return (functx:add-or-update-attributes( $in-xml/a, (xs:QName('att1'),xs:QName('att2')), (1,2)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("x", false) ); } /** * ~ : Adds attributes to XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-or-update-attributes.html : @param $elements the element(s) to which you wish to add the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add . */ @org.junit.Test public void functxFunctxAddOrUpdateAttributes3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " declare namespace new = \"http://new\";\n" + " (:~ : Adds attributes to XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-or-update-attributes.html : @param $elements the element(s) to which you wish to add the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add :)\n" + " declare function functx:add-or-update-attributes ( $elements as element()* , $attrNames as xs:QName* , $attrValues as xs:anyAtomicType* ) as element()? { for $element in $elements return element { node-name($element)} { for $attrName at $seq in $attrNames return attribute {$attrName} {$attrValues[$seq]}, $element/@*[not(node-name(.) = $attrNames)], $element/node() } } ;\n" + " let $in-xml := x x return (functx:add-or-update-attributes( $in-xml/b, (xs:QName('att1'),xs:QName('att2')), (1,2)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("x", false) ); } /** * ~ : Adds attributes to XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-or-update-attributes.html : @param $elements the element(s) to which you wish to add the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add . */ @org.junit.Test public void functxFunctxAddOrUpdateAttributes4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " declare namespace new = \"http://new\";\n" + " (:~ : Adds attributes to XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-or-update-attributes.html : @param $elements the element(s) to which you wish to add the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add :)\n" + " declare function functx:add-or-update-attributes ( $elements as element()* , $attrNames as xs:QName* , $attrValues as xs:anyAtomicType* ) as element()? { for $element in $elements return element { node-name($element)} { for $attrName at $seq in $attrNames return attribute {$attrName} {$attrValues[$seq]}, $element/@*[not(node-name(.) = $attrNames)], $element/node() } } ;\n" + " let $in-xml := x x return (functx:add-or-update-attributes( $in-xml/a, xs:QName('new:att1'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("x", false) ); } /** * ~ : Adds attributes to XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-or-update-attributes.html : @param $elements the element(s) to which you wish to add the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add . */ @org.junit.Test public void functxFunctxAddOrUpdateAttributes5() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " declare namespace new = \"http://new\";\n" + " (:~ : Adds attributes to XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-or-update-attributes.html : @param $elements the element(s) to which you wish to add the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add :)\n" + " declare function functx:add-or-update-attributes ( $elements as element()* , $attrNames as xs:QName* , $attrValues as xs:anyAtomicType* ) as element()? { for $element in $elements return element { node-name($element)} { for $attrName at $seq in $attrNames return attribute {$attrName} {$attrValues[$seq]}, $element/@*[not(node-name(.) = $attrNames)], $element/node() } } ;\n" + " let $in-xml := x x return (functx:add-or-update-attributes( $in-xml/a, QName('http://new','new:att1'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("x", false) ); } /** * ~ : Adds attributes to XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-or-update-attributes.html : @param $elements the element(s) to which you wish to add the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add . */ @org.junit.Test public void functxFunctxAddOrUpdateAttributesAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " declare namespace new = \"http://new\";\n" + " (:~ : Adds attributes to XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_add-or-update-attributes.html : @param $elements the element(s) to which you wish to add the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add :)\n" + " declare function functx:add-or-update-attributes ( $elements as element()* , $attrNames as xs:QName* , $attrValues as xs:anyAtomicType* ) as element()? { for $element in $elements return element { node-name($element)} { for $attrName at $seq in $attrNames return attribute {$attrName} {$attrValues[$seq]}, $element/@*[not(node-name(.) = $attrNames)], $element/node() } } ;\n" + " let $in-xml := x x return (functx:add-or-update-attributes( $in-xml/a, xs:QName('att1'), 1), functx:add-or-update-attributes( $in-xml/a, (xs:QName('att1'),xs:QName('att2')), (1,2)), functx:add-or-update-attributes( $in-xml/b, (xs:QName('att1'),xs:QName('att2')), (1,2)), functx:add-or-update-attributes( $in-xml/a, xs:QName('new:att1'), 1), functx:add-or-update-attributes( $in-xml/a, QName('http://new','new:att1'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("xxxxx", false) ); } /** * ~ : Whether a value is all whitespace or a zero-length string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_all-whitespace.html : @param $arg the string (or node) to test . */ @org.junit.Test public void functxFunctxAllWhitespace1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is all whitespace or a zero-length string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_all-whitespace.html : @param $arg the string (or node) to test :)\n" + " declare function functx:all-whitespace ( $arg as xs:string? ) as xs:boolean { normalize-space($arg) = '' } ;\n" + " let $in-xml := x x return (functx:all-whitespace(' '))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether a value is all whitespace or a zero-length string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_all-whitespace.html : @param $arg the string (or node) to test . */ @org.junit.Test public void functxFunctxAllWhitespace2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is all whitespace or a zero-length string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_all-whitespace.html : @param $arg the string (or node) to test :)\n" + " declare function functx:all-whitespace ( $arg as xs:string? ) as xs:boolean { normalize-space($arg) = '' } ;\n" + " let $in-xml := x x return (functx:all-whitespace(' x '))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether a value is all whitespace or a zero-length string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_all-whitespace.html : @param $arg the string (or node) to test . */ @org.junit.Test public void functxFunctxAllWhitespace3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is all whitespace or a zero-length string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_all-whitespace.html : @param $arg the string (or node) to test :)\n" + " declare function functx:all-whitespace ( $arg as xs:string? ) as xs:boolean { normalize-space($arg) = '' } ;\n" + " let $in-xml := x x return (functx:all-whitespace($in-xml/a))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether a value is all whitespace or a zero-length string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_all-whitespace.html : @param $arg the string (or node) to test . */ @org.junit.Test public void functxFunctxAllWhitespace4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is all whitespace or a zero-length string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_all-whitespace.html : @param $arg the string (or node) to test :)\n" + " declare function functx:all-whitespace ( $arg as xs:string? ) as xs:boolean { normalize-space($arg) = '' } ;\n" + " let $in-xml := x x return (functx:all-whitespace($in-xml/b))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether a value is all whitespace or a zero-length string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_all-whitespace.html : @param $arg the string (or node) to test . */ @org.junit.Test public void functxFunctxAllWhitespace5() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is all whitespace or a zero-length string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_all-whitespace.html : @param $arg the string (or node) to test :)\n" + " declare function functx:all-whitespace ( $arg as xs:string? ) as xs:boolean { normalize-space($arg) = '' } ;\n" + " let $in-xml := x x return (functx:all-whitespace($in-xml/c))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether a value is all whitespace or a zero-length string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_all-whitespace.html : @param $arg the string (or node) to test . */ @org.junit.Test public void functxFunctxAllWhitespace6() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is all whitespace or a zero-length string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_all-whitespace.html : @param $arg the string (or node) to test :)\n" + " declare function functx:all-whitespace ( $arg as xs:string? ) as xs:boolean { normalize-space($arg) = '' } ;\n" + " let $in-xml := x x return (functx:all-whitespace($in-xml/c/text()[1]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether a value is all whitespace or a zero-length string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_all-whitespace.html : @param $arg the string (or node) to test . */ @org.junit.Test public void functxFunctxAllWhitespaceAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is all whitespace or a zero-length string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_all-whitespace.html : @param $arg the string (or node) to test :)\n" + " declare function functx:all-whitespace ( $arg as xs:string? ) as xs:boolean { normalize-space($arg) = '' } ;\n" + " let $in-xml := x x return (functx:all-whitespace(' '), functx:all-whitespace(' x '), functx:all-whitespace($in-xml/a), functx:all-whitespace($in-xml/b), functx:all-whitespace($in-xml/c), functx:all-whitespace($in-xml/c/text()[1]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true false true false false true") ); } /** * ~ : Whether all the values in a sequence are distinct : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_are-distinct-values.html : @param $seq the sequence of values . */ @org.junit.Test public void functxFunctxAreDistinctValues1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether all the values in a sequence are distinct : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_are-distinct-values.html : @param $seq the sequence of values :)\n" + " declare function functx:are-distinct-values ( $seq as xs:anyAtomicType* ) as xs:boolean { count(distinct-values($seq)) = count($seq) } ;\n" + " (functx:are-distinct-values( (1,2,1,3)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether all the values in a sequence are distinct : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_are-distinct-values.html : @param $seq the sequence of values . */ @org.junit.Test public void functxFunctxAreDistinctValues2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether all the values in a sequence are distinct : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_are-distinct-values.html : @param $seq the sequence of values :)\n" + " declare function functx:are-distinct-values ( $seq as xs:anyAtomicType* ) as xs:boolean { count(distinct-values($seq)) = count($seq) } ;\n" + " (functx:are-distinct-values( (1,2,1,3,2.0)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether all the values in a sequence are distinct : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_are-distinct-values.html : @param $seq the sequence of values . */ @org.junit.Test public void functxFunctxAreDistinctValues3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether all the values in a sequence are distinct : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_are-distinct-values.html : @param $seq the sequence of values :)\n" + " declare function functx:are-distinct-values ( $seq as xs:anyAtomicType* ) as xs:boolean { count(distinct-values($seq)) = count($seq) } ;\n" + " (functx:are-distinct-values( (1,2,3) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether all the values in a sequence are distinct : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_are-distinct-values.html : @param $seq the sequence of values . */ @org.junit.Test public void functxFunctxAreDistinctValuesAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether all the values in a sequence are distinct : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_are-distinct-values.html : @param $seq the sequence of values :)\n" + " declare function functx:are-distinct-values ( $seq as xs:anyAtomicType* ) as xs:boolean { count(distinct-values($seq)) = count($seq) } ;\n" + " (functx:are-distinct-values( (1,2,1,3)), functx:are-distinct-values( (1,2,1,3,2.0)), functx:are-distinct-values( (1,2,3) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "false false true") ); } /** * ~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine . */ @org.junit.Test public void functxFunctxAtomicType1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine :)\n" + " declare function functx:atomic-type ( $values as xs:anyAtomicType* ) as xs:string* { for $val in $values return (if ($val instance of xs:untypedAtomic) then 'xs:untypedAtomic' else if ($val instance of xs:anyURI) then 'xs:anyURI' else if ($val instance of xs:ENTITY) then 'xs:ENTITY' else if ($val instance of xs:ID) then 'xs:ID' else if ($val instance of xs:NMTOKEN) then 'xs:NMTOKEN' else if ($val instance of xs:language) then 'xs:language' else if ($val instance of xs:NCName) then 'xs:NCName' else if ($val instance of xs:Name) then 'xs:Name' else if ($val instance of xs:token) then 'xs:token' else if ($val instance of xs:normalizedString) then 'xs:normalizedString' else if ($val instance of xs:string) then 'xs:string' else if ($val instance of xs:QName) then 'xs:QName' else if ($val instance of xs:boolean) then 'xs:boolean' else if ($val instance of xs:base64Binary) then 'xs:base64Binary' else if ($val instance of xs:hexBinary) then 'xs:hexBinary' else if ($val instance of xs:byte) then 'xs:byte' else if ($val instance of xs:short) then 'xs:short' else if ($val instance of xs:int) then 'xs:int' else if ($val instance of xs:long) then 'xs:long' else if ($val instance of xs:unsignedByte) then 'xs:unsignedByte' else if ($val instance of xs:unsignedShort) then 'xs:unsignedShort' else if ($val instance of xs:unsignedInt) then 'xs:unsignedInt' else if ($val instance of xs:unsignedLong) then 'xs:unsignedLong' else if ($val instance of xs:positiveInteger) then 'xs:positiveInteger' else if ($val instance of xs:nonNegativeInteger) then 'xs:nonNegativeInteger' else if ($val instance of xs:negativeInteger) then 'xs:negativeInteger' else if ($val instance of xs:nonPositiveInteger) then 'xs:nonPositiveInteger' else if ($val instance of xs:integer) then 'xs:integer' else if ($val instance of xs:decimal) then 'xs:decimal' else if ($val instance of xs:float) then 'xs:float' else if ($val instance of xs:double) then 'xs:double' else if ($val instance of xs:date) then 'xs:date' else if ($val instance of xs:time) then 'xs:time' else if ($val instance of xs:dateTime) then 'xs:dateTime' else if ($val instance of xs:dayTimeDuration) then 'xs:dayTimeDuration' else if ($val instance of xs:yearMonthDuration) then 'xs:yearMonthDuration' else if ($val instance of xs:duration) then 'xs:duration' else if ($val instance of xs:gMonth) then 'xs:gMonth' else if ($val instance of xs:gYear) then 'xs:gYear' else if ($val instance of xs:gYearMonth) then 'xs:gYearMonth' else if ($val instance of xs:gDay) then 'xs:gDay' else if ($val instance of xs:gMonthDay) then 'xs:gMonthDay' else 'unknown') } ;\n" + " (functx:atomic-type(2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xs:integer") ); } /** * ~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine . */ @org.junit.Test public void functxFunctxAtomicType2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine :)\n" + " declare function functx:atomic-type ( $values as xs:anyAtomicType* ) as xs:string* { for $val in $values return (if ($val instance of xs:untypedAtomic) then 'xs:untypedAtomic' else if ($val instance of xs:anyURI) then 'xs:anyURI' else if ($val instance of xs:ENTITY) then 'xs:ENTITY' else if ($val instance of xs:ID) then 'xs:ID' else if ($val instance of xs:NMTOKEN) then 'xs:NMTOKEN' else if ($val instance of xs:language) then 'xs:language' else if ($val instance of xs:NCName) then 'xs:NCName' else if ($val instance of xs:Name) then 'xs:Name' else if ($val instance of xs:token) then 'xs:token' else if ($val instance of xs:normalizedString) then 'xs:normalizedString' else if ($val instance of xs:string) then 'xs:string' else if ($val instance of xs:QName) then 'xs:QName' else if ($val instance of xs:boolean) then 'xs:boolean' else if ($val instance of xs:base64Binary) then 'xs:base64Binary' else if ($val instance of xs:hexBinary) then 'xs:hexBinary' else if ($val instance of xs:byte) then 'xs:byte' else if ($val instance of xs:short) then 'xs:short' else if ($val instance of xs:int) then 'xs:int' else if ($val instance of xs:long) then 'xs:long' else if ($val instance of xs:unsignedByte) then 'xs:unsignedByte' else if ($val instance of xs:unsignedShort) then 'xs:unsignedShort' else if ($val instance of xs:unsignedInt) then 'xs:unsignedInt' else if ($val instance of xs:unsignedLong) then 'xs:unsignedLong' else if ($val instance of xs:positiveInteger) then 'xs:positiveInteger' else if ($val instance of xs:nonNegativeInteger) then 'xs:nonNegativeInteger' else if ($val instance of xs:negativeInteger) then 'xs:negativeInteger' else if ($val instance of xs:nonPositiveInteger) then 'xs:nonPositiveInteger' else if ($val instance of xs:integer) then 'xs:integer' else if ($val instance of xs:decimal) then 'xs:decimal' else if ($val instance of xs:float) then 'xs:float' else if ($val instance of xs:double) then 'xs:double' else if ($val instance of xs:date) then 'xs:date' else if ($val instance of xs:time) then 'xs:time' else if ($val instance of xs:dateTime) then 'xs:dateTime' else if ($val instance of xs:dayTimeDuration) then 'xs:dayTimeDuration' else if ($val instance of xs:yearMonthDuration) then 'xs:yearMonthDuration' else if ($val instance of xs:duration) then 'xs:duration' else if ($val instance of xs:gMonth) then 'xs:gMonth' else if ($val instance of xs:gYear) then 'xs:gYear' else if ($val instance of xs:gYearMonth) then 'xs:gYearMonth' else if ($val instance of xs:gDay) then 'xs:gDay' else if ($val instance of xs:gMonthDay) then 'xs:gMonthDay' else 'unknown') } ;\n" + " (functx:atomic-type('abc'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xs:string") ); } /** * ~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine . */ @org.junit.Test public void functxFunctxAtomicType3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine :)\n" + " declare function functx:atomic-type ( $values as xs:anyAtomicType* ) as xs:string* { for $val in $values return (if ($val instance of xs:untypedAtomic) then 'xs:untypedAtomic' else if ($val instance of xs:anyURI) then 'xs:anyURI' else if ($val instance of xs:ENTITY) then 'xs:ENTITY' else if ($val instance of xs:ID) then 'xs:ID' else if ($val instance of xs:NMTOKEN) then 'xs:NMTOKEN' else if ($val instance of xs:language) then 'xs:language' else if ($val instance of xs:NCName) then 'xs:NCName' else if ($val instance of xs:Name) then 'xs:Name' else if ($val instance of xs:token) then 'xs:token' else if ($val instance of xs:normalizedString) then 'xs:normalizedString' else if ($val instance of xs:string) then 'xs:string' else if ($val instance of xs:QName) then 'xs:QName' else if ($val instance of xs:boolean) then 'xs:boolean' else if ($val instance of xs:base64Binary) then 'xs:base64Binary' else if ($val instance of xs:hexBinary) then 'xs:hexBinary' else if ($val instance of xs:byte) then 'xs:byte' else if ($val instance of xs:short) then 'xs:short' else if ($val instance of xs:int) then 'xs:int' else if ($val instance of xs:long) then 'xs:long' else if ($val instance of xs:unsignedByte) then 'xs:unsignedByte' else if ($val instance of xs:unsignedShort) then 'xs:unsignedShort' else if ($val instance of xs:unsignedInt) then 'xs:unsignedInt' else if ($val instance of xs:unsignedLong) then 'xs:unsignedLong' else if ($val instance of xs:positiveInteger) then 'xs:positiveInteger' else if ($val instance of xs:nonNegativeInteger) then 'xs:nonNegativeInteger' else if ($val instance of xs:negativeInteger) then 'xs:negativeInteger' else if ($val instance of xs:nonPositiveInteger) then 'xs:nonPositiveInteger' else if ($val instance of xs:integer) then 'xs:integer' else if ($val instance of xs:decimal) then 'xs:decimal' else if ($val instance of xs:float) then 'xs:float' else if ($val instance of xs:double) then 'xs:double' else if ($val instance of xs:date) then 'xs:date' else if ($val instance of xs:time) then 'xs:time' else if ($val instance of xs:dateTime) then 'xs:dateTime' else if ($val instance of xs:dayTimeDuration) then 'xs:dayTimeDuration' else if ($val instance of xs:yearMonthDuration) then 'xs:yearMonthDuration' else if ($val instance of xs:duration) then 'xs:duration' else if ($val instance of xs:gMonth) then 'xs:gMonth' else if ($val instance of xs:gYear) then 'xs:gYear' else if ($val instance of xs:gYearMonth) then 'xs:gYearMonth' else if ($val instance of xs:gDay) then 'xs:gDay' else if ($val instance of xs:gMonthDay) then 'xs:gMonthDay' else 'unknown') } ;\n" + " (functx:atomic-type(xs:date('2005-12-15')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xs:date") ); } /** * ~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine . */ @org.junit.Test public void functxFunctxAtomicType4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine :)\n" + " declare function functx:atomic-type ( $values as xs:anyAtomicType* ) as xs:string* { for $val in $values return (if ($val instance of xs:untypedAtomic) then 'xs:untypedAtomic' else if ($val instance of xs:anyURI) then 'xs:anyURI' else if ($val instance of xs:ENTITY) then 'xs:ENTITY' else if ($val instance of xs:ID) then 'xs:ID' else if ($val instance of xs:NMTOKEN) then 'xs:NMTOKEN' else if ($val instance of xs:language) then 'xs:language' else if ($val instance of xs:NCName) then 'xs:NCName' else if ($val instance of xs:Name) then 'xs:Name' else if ($val instance of xs:token) then 'xs:token' else if ($val instance of xs:normalizedString) then 'xs:normalizedString' else if ($val instance of xs:string) then 'xs:string' else if ($val instance of xs:QName) then 'xs:QName' else if ($val instance of xs:boolean) then 'xs:boolean' else if ($val instance of xs:base64Binary) then 'xs:base64Binary' else if ($val instance of xs:hexBinary) then 'xs:hexBinary' else if ($val instance of xs:byte) then 'xs:byte' else if ($val instance of xs:short) then 'xs:short' else if ($val instance of xs:int) then 'xs:int' else if ($val instance of xs:long) then 'xs:long' else if ($val instance of xs:unsignedByte) then 'xs:unsignedByte' else if ($val instance of xs:unsignedShort) then 'xs:unsignedShort' else if ($val instance of xs:unsignedInt) then 'xs:unsignedInt' else if ($val instance of xs:unsignedLong) then 'xs:unsignedLong' else if ($val instance of xs:positiveInteger) then 'xs:positiveInteger' else if ($val instance of xs:nonNegativeInteger) then 'xs:nonNegativeInteger' else if ($val instance of xs:negativeInteger) then 'xs:negativeInteger' else if ($val instance of xs:nonPositiveInteger) then 'xs:nonPositiveInteger' else if ($val instance of xs:integer) then 'xs:integer' else if ($val instance of xs:decimal) then 'xs:decimal' else if ($val instance of xs:float) then 'xs:float' else if ($val instance of xs:double) then 'xs:double' else if ($val instance of xs:date) then 'xs:date' else if ($val instance of xs:time) then 'xs:time' else if ($val instance of xs:dateTime) then 'xs:dateTime' else if ($val instance of xs:dayTimeDuration) then 'xs:dayTimeDuration' else if ($val instance of xs:yearMonthDuration) then 'xs:yearMonthDuration' else if ($val instance of xs:duration) then 'xs:duration' else if ($val instance of xs:gMonth) then 'xs:gMonth' else if ($val instance of xs:gYear) then 'xs:gYear' else if ($val instance of xs:gYearMonth) then 'xs:gYearMonth' else if ($val instance of xs:gDay) then 'xs:gDay' else if ($val instance of xs:gMonthDay) then 'xs:gMonthDay' else 'unknown') } ;\n" + " (functx:atomic-type( (2,'abc',xs:date('2005-12-15'))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xs:integer xs:string xs:date") ); } /** * ~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine . */ @org.junit.Test public void functxFunctxAtomicTypeAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine :)\n" + " declare function functx:atomic-type ( $values as xs:anyAtomicType* ) as xs:string* { for $val in $values return (if ($val instance of xs:untypedAtomic) then 'xs:untypedAtomic' else if ($val instance of xs:anyURI) then 'xs:anyURI' else if ($val instance of xs:ENTITY) then 'xs:ENTITY' else if ($val instance of xs:ID) then 'xs:ID' else if ($val instance of xs:NMTOKEN) then 'xs:NMTOKEN' else if ($val instance of xs:language) then 'xs:language' else if ($val instance of xs:NCName) then 'xs:NCName' else if ($val instance of xs:Name) then 'xs:Name' else if ($val instance of xs:token) then 'xs:token' else if ($val instance of xs:normalizedString) then 'xs:normalizedString' else if ($val instance of xs:string) then 'xs:string' else if ($val instance of xs:QName) then 'xs:QName' else if ($val instance of xs:boolean) then 'xs:boolean' else if ($val instance of xs:base64Binary) then 'xs:base64Binary' else if ($val instance of xs:hexBinary) then 'xs:hexBinary' else if ($val instance of xs:byte) then 'xs:byte' else if ($val instance of xs:short) then 'xs:short' else if ($val instance of xs:int) then 'xs:int' else if ($val instance of xs:long) then 'xs:long' else if ($val instance of xs:unsignedByte) then 'xs:unsignedByte' else if ($val instance of xs:unsignedShort) then 'xs:unsignedShort' else if ($val instance of xs:unsignedInt) then 'xs:unsignedInt' else if ($val instance of xs:unsignedLong) then 'xs:unsignedLong' else if ($val instance of xs:positiveInteger) then 'xs:positiveInteger' else if ($val instance of xs:nonNegativeInteger) then 'xs:nonNegativeInteger' else if ($val instance of xs:negativeInteger) then 'xs:negativeInteger' else if ($val instance of xs:nonPositiveInteger) then 'xs:nonPositiveInteger' else if ($val instance of xs:integer) then 'xs:integer' else if ($val instance of xs:decimal) then 'xs:decimal' else if ($val instance of xs:float) then 'xs:float' else if ($val instance of xs:double) then 'xs:double' else if ($val instance of xs:date) then 'xs:date' else if ($val instance of xs:time) then 'xs:time' else if ($val instance of xs:dateTime) then 'xs:dateTime' else if ($val instance of xs:dayTimeDuration) then 'xs:dayTimeDuration' else if ($val instance of xs:yearMonthDuration) then 'xs:yearMonthDuration' else if ($val instance of xs:duration) then 'xs:duration' else if ($val instance of xs:gMonth) then 'xs:gMonth' else if ($val instance of xs:gYear) then 'xs:gYear' else if ($val instance of xs:gYearMonth) then 'xs:gYearMonth' else if ($val instance of xs:gDay) then 'xs:gDay' else if ($val instance of xs:gMonthDay) then 'xs:gMonthDay' else 'unknown') } ;\n" + " (functx:atomic-type(2), functx:atomic-type('abc'), functx:atomic-type(xs:date('2005-12-15')), functx:atomic-type( (2,'abc',xs:date('2005-12-15'))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xs:integer xs:string xs:date xs:integer xs:string xs:date") ); } /** * ~ : The average, counting "empty" values as zero : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_avg-empty-is-zero.html : @param $values the values to be averaged : @param $allNodes the sequence of all nodes to find the average over . */ @org.junit.Test public void functxFunctxAvgEmptyIsZero1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The average, counting \"empty\" values as zero : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_avg-empty-is-zero.html : @param $values the values to be averaged : @param $allNodes the sequence of all nodes to find the average over :)\n" + " declare function functx:avg-empty-is-zero ( $values as xs:anyAtomicType* , $allNodes as node()* ) as xs:double { if (empty($allNodes)) then 0 else sum($values[string(.) != '']) div count($allNodes) } ;\n" + " let $in-xml := return (functx:avg-empty-is-zero( $in-xml//price/@discount, $in-xml//price))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("4") ); } /** * ~ : Whether a value is between two provided values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_between-exclusive.html : @param $value the value to be tested : @param $minValue the minimum value : @param $maxValue the maximum value . */ @org.junit.Test public void functxFunctxBetweenExclusive1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is between two provided values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_between-exclusive.html : @param $value the value to be tested : @param $minValue the minimum value : @param $maxValue the maximum value :)\n" + " declare function functx:between-exclusive ( $value as xs:anyAtomicType? , $minValue as xs:anyAtomicType , $maxValue as xs:anyAtomicType ) as xs:boolean { $value > $minValue and $value < $maxValue } ;\n" + " (functx:between-exclusive(55, 1, 1000))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether a value is between two provided values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_between-exclusive.html : @param $value the value to be tested : @param $minValue the minimum value : @param $maxValue the maximum value . */ @org.junit.Test public void functxFunctxBetweenExclusive2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is between two provided values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_between-exclusive.html : @param $value the value to be tested : @param $minValue the minimum value : @param $maxValue the maximum value :)\n" + " declare function functx:between-exclusive ( $value as xs:anyAtomicType? , $minValue as xs:anyAtomicType , $maxValue as xs:anyAtomicType ) as xs:boolean { $value > $minValue and $value < $maxValue } ;\n" + " (functx:between-exclusive(1, 1, 1000))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether a value is between two provided values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_between-exclusive.html : @param $value the value to be tested : @param $minValue the minimum value : @param $maxValue the maximum value . */ @org.junit.Test public void functxFunctxBetweenExclusive3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is between two provided values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_between-exclusive.html : @param $value the value to be tested : @param $minValue the minimum value : @param $maxValue the maximum value :)\n" + " declare function functx:between-exclusive ( $value as xs:anyAtomicType? , $minValue as xs:anyAtomicType , $maxValue as xs:anyAtomicType ) as xs:boolean { $value > $minValue and $value < $maxValue } ;\n" + " (functx:between-exclusive(1200, 1, 1000))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether a value is between two provided values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_between-exclusive.html : @param $value the value to be tested : @param $minValue the minimum value : @param $maxValue the maximum value . */ @org.junit.Test public void functxFunctxBetweenExclusive4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is between two provided values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_between-exclusive.html : @param $value the value to be tested : @param $minValue the minimum value : @param $maxValue the maximum value :)\n" + " declare function functx:between-exclusive ( $value as xs:anyAtomicType? , $minValue as xs:anyAtomicType , $maxValue as xs:anyAtomicType ) as xs:boolean { $value > $minValue and $value < $maxValue } ;\n" + " (functx:between-exclusive('b', 'a', 'c'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether a value is between two provided values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_between-exclusive.html : @param $value the value to be tested : @param $minValue the minimum value : @param $maxValue the maximum value . */ @org.junit.Test public void functxFunctxBetweenExclusive5() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is between two provided values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_between-exclusive.html : @param $value the value to be tested : @param $minValue the minimum value : @param $maxValue the maximum value :)\n" + " declare function functx:between-exclusive ( $value as xs:anyAtomicType? , $minValue as xs:anyAtomicType , $maxValue as xs:anyAtomicType ) as xs:boolean { $value > $minValue and $value < $maxValue } ;\n" + " (functx:between-exclusive(xs:date('2004-10-31'), xs:date('2004-10-15'), xs:date('2004-11-01')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether a value is between two provided values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_between-exclusive.html : @param $value the value to be tested : @param $minValue the minimum value : @param $maxValue the maximum value . */ @org.junit.Test public void functxFunctxBetweenExclusiveAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is between two provided values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_between-exclusive.html : @param $value the value to be tested : @param $minValue the minimum value : @param $maxValue the maximum value :)\n" + " declare function functx:between-exclusive ( $value as xs:anyAtomicType? , $minValue as xs:anyAtomicType , $maxValue as xs:anyAtomicType ) as xs:boolean { $value > $minValue and $value < $maxValue } ;\n" + " (functx:between-exclusive(55, 1, 1000), functx:between-exclusive(1, 1, 1000), functx:between-exclusive(1200, 1, 1000), functx:between-exclusive('b', 'a', 'c'), functx:between-exclusive(xs:date('2004-10-31'), xs:date('2004-10-15'), xs:date('2004-11-01')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true false false true true") ); } /** * ~ : Whether a value is between two provided values, or equal to one of them : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_between-inclusive.html : @param $value the value to be tested : @param $minValue the minimum value : @param $maxValue the maximum value . */ @org.junit.Test public void functxFunctxBetweenInclusive1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is between two provided values, or equal to one of them : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_between-inclusive.html : @param $value the value to be tested : @param $minValue the minimum value : @param $maxValue the maximum value :)\n" + " declare function functx:between-inclusive ( $value as xs:anyAtomicType? , $minValue as xs:anyAtomicType , $maxValue as xs:anyAtomicType ) as xs:boolean { $value >= $minValue and $value <= $maxValue } ;\n" + " (functx:between-inclusive(55, 1, 1000))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether a value is between two provided values, or equal to one of them : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_between-inclusive.html : @param $value the value to be tested : @param $minValue the minimum value : @param $maxValue the maximum value . */ @org.junit.Test public void functxFunctxBetweenInclusive2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is between two provided values, or equal to one of them : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_between-inclusive.html : @param $value the value to be tested : @param $minValue the minimum value : @param $maxValue the maximum value :)\n" + " declare function functx:between-inclusive ( $value as xs:anyAtomicType? , $minValue as xs:anyAtomicType , $maxValue as xs:anyAtomicType ) as xs:boolean { $value >= $minValue and $value <= $maxValue } ;\n" + " (functx:between-inclusive(1, 1, 1000))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether a value is between two provided values, or equal to one of them : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_between-inclusive.html : @param $value the value to be tested : @param $minValue the minimum value : @param $maxValue the maximum value . */ @org.junit.Test public void functxFunctxBetweenInclusive3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is between two provided values, or equal to one of them : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_between-inclusive.html : @param $value the value to be tested : @param $minValue the minimum value : @param $maxValue the maximum value :)\n" + " declare function functx:between-inclusive ( $value as xs:anyAtomicType? , $minValue as xs:anyAtomicType , $maxValue as xs:anyAtomicType ) as xs:boolean { $value >= $minValue and $value <= $maxValue } ;\n" + " (functx:between-inclusive(1200, 1, 1000))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether a value is between two provided values, or equal to one of them : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_between-inclusive.html : @param $value the value to be tested : @param $minValue the minimum value : @param $maxValue the maximum value . */ @org.junit.Test public void functxFunctxBetweenInclusive4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is between two provided values, or equal to one of them : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_between-inclusive.html : @param $value the value to be tested : @param $minValue the minimum value : @param $maxValue the maximum value :)\n" + " declare function functx:between-inclusive ( $value as xs:anyAtomicType? , $minValue as xs:anyAtomicType , $maxValue as xs:anyAtomicType ) as xs:boolean { $value >= $minValue and $value <= $maxValue } ;\n" + " (functx:between-inclusive('b', 'b', 'd'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether a value is between two provided values, or equal to one of them : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_between-inclusive.html : @param $value the value to be tested : @param $minValue the minimum value : @param $maxValue the maximum value . */ @org.junit.Test public void functxFunctxBetweenInclusive5() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is between two provided values, or equal to one of them : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_between-inclusive.html : @param $value the value to be tested : @param $minValue the minimum value : @param $maxValue the maximum value :)\n" + " declare function functx:between-inclusive ( $value as xs:anyAtomicType? , $minValue as xs:anyAtomicType , $maxValue as xs:anyAtomicType ) as xs:boolean { $value >= $minValue and $value <= $maxValue } ;\n" + " (functx:between-inclusive(xs:date('2004-10-31'), xs:date('2004-10-15'), xs:date('2004-11-01')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether a value is between two provided values, or equal to one of them : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_between-inclusive.html : @param $value the value to be tested : @param $minValue the minimum value : @param $maxValue the maximum value . */ @org.junit.Test public void functxFunctxBetweenInclusiveAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is between two provided values, or equal to one of them : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_between-inclusive.html : @param $value the value to be tested : @param $minValue the minimum value : @param $maxValue the maximum value :)\n" + " declare function functx:between-inclusive ( $value as xs:anyAtomicType? , $minValue as xs:anyAtomicType , $maxValue as xs:anyAtomicType ) as xs:boolean { $value >= $minValue and $value <= $maxValue } ;\n" + " (functx:between-inclusive(55, 1, 1000), functx:between-inclusive(1, 1, 1000), functx:between-inclusive(1200, 1, 1000), functx:between-inclusive('b', 'b', 'd'), functx:between-inclusive(xs:date('2004-10-31'), xs:date('2004-10-15'), xs:date('2004-11-01')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true false true true") ); } /** * ~ : Turns a camelCase string into space-separated words : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_camel-case-to-words.html : @param $arg the string to modify : @param $delim the delimiter for the words (e.g. a space) . */ @org.junit.Test public void functxFunctxCamelCaseToWords1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Turns a camelCase string into space-separated words : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_camel-case-to-words.html : @param $arg the string to modify : @param $delim the delimiter for the words (e.g. a space) :)\n" + " declare function functx:camel-case-to-words ( $arg as xs:string? , $delim as xs:string ) as xs:string { concat(substring($arg,1,1), replace(substring($arg,2),'(\\p{Lu})', concat($delim, '$1'))) } ;\n" + " (functx:camel-case-to-words( 'thisIsACamelCaseTerm',' '))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "this Is A Camel Case Term") ); } /** * ~ : Turns a camelCase string into space-separated words : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_camel-case-to-words.html : @param $arg the string to modify : @param $delim the delimiter for the words (e.g. a space) . */ @org.junit.Test public void functxFunctxCamelCaseToWords2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Turns a camelCase string into space-separated words : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_camel-case-to-words.html : @param $arg the string to modify : @param $delim the delimiter for the words (e.g. a space) :)\n" + " declare function functx:camel-case-to-words ( $arg as xs:string? , $delim as xs:string ) as xs:string { concat(substring($arg,1,1), replace(substring($arg,2),'(\\p{Lu})', concat($delim, '$1'))) } ;\n" + " (functx:camel-case-to-words( 'thisIsACamelCaseTerm',','))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "this,Is,A,Camel,Case,Term") ); } /** * ~ : Turns a camelCase string into space-separated words : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_camel-case-to-words.html : @param $arg the string to modify : @param $delim the delimiter for the words (e.g. a space) . */ @org.junit.Test public void functxFunctxCamelCaseToWordsAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Turns a camelCase string into space-separated words : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_camel-case-to-words.html : @param $arg the string to modify : @param $delim the delimiter for the words (e.g. a space) :)\n" + " declare function functx:camel-case-to-words ( $arg as xs:string? , $delim as xs:string ) as xs:string { concat(substring($arg,1,1), replace(substring($arg,2),'(\\p{Lu})', concat($delim, '$1'))) } ;\n" + " (functx:camel-case-to-words( 'thisIsACamelCaseTerm',' '), functx:camel-case-to-words( 'thisIsACamelCaseTerm',','))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "this Is A Camel Case Term this,Is,A,Camel,Case,Term") ); } /** * ~ : Capitalizes the first character of a string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_capitalize-first.html : @param $arg the word or phrase to capitalize . */ @org.junit.Test public void functxFunctxCapitalizeFirst1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Capitalizes the first character of a string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_capitalize-first.html : @param $arg the word or phrase to capitalize :)\n" + " declare function functx:capitalize-first ( $arg as xs:string? ) as xs:string? { concat(upper-case(substring($arg,1,1)), substring($arg,2)) } ;\n" + " (functx:capitalize-first('hello'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Hello") ); } /** * ~ : Capitalizes the first character of a string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_capitalize-first.html : @param $arg the word or phrase to capitalize . */ @org.junit.Test public void functxFunctxCapitalizeFirst2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Capitalizes the first character of a string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_capitalize-first.html : @param $arg the word or phrase to capitalize :)\n" + " declare function functx:capitalize-first ( $arg as xs:string? ) as xs:string? { concat(upper-case(substring($arg,1,1)), substring($arg,2)) } ;\n" + " (functx:capitalize-first('hello world'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Hello world") ); } /** * ~ : Capitalizes the first character of a string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_capitalize-first.html : @param $arg the word or phrase to capitalize . */ @org.junit.Test public void functxFunctxCapitalizeFirst3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Capitalizes the first character of a string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_capitalize-first.html : @param $arg the word or phrase to capitalize :)\n" + " declare function functx:capitalize-first ( $arg as xs:string? ) as xs:string? { concat(upper-case(substring($arg,1,1)), substring($arg,2)) } ;\n" + " (functx:capitalize-first('Hello world'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Hello world") ); } /** * ~ : Capitalizes the first character of a string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_capitalize-first.html : @param $arg the word or phrase to capitalize . */ @org.junit.Test public void functxFunctxCapitalizeFirstAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Capitalizes the first character of a string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_capitalize-first.html : @param $arg the word or phrase to capitalize :)\n" + " declare function functx:capitalize-first ( $arg as xs:string? ) as xs:string? { concat(upper-case(substring($arg,1,1)), substring($arg,2)) } ;\n" + " (functx:capitalize-first('hello'), functx:capitalize-first('hello world'), functx:capitalize-first('Hello world'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Hello Hello world Hello world") ); } /** * ~ : Changes the names of elements in an XML fragment : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_change-element-names-deep.html : @param $nodes the element(s) to change : @param $oldNames the sequence of names to change from : @param $newNames the sequence of names to change to ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty . */ @org.junit.Test public void functxFunctxChangeElementNamesDeep1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " declare namespace dty = \"http://datypic.com\";\n" + " (:~ : Changes the names of elements in an XML fragment : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_change-element-names-deep.html : @param $nodes the element(s) to change : @param $oldNames the sequence of names to change from : @param $newNames the sequence of names to change to :)\n" + " declare function functx:change-element-names-deep ( $nodes as node()* , $oldNames as xs:QName* , $newNames as xs:QName* ) as node()* { if (count($oldNames) != count($newNames)) then error(xs:QName('functx:Different_number_of_names')) else for $node in $nodes return if ($node instance of element()) then element {functx:if-empty ($newNames[index-of($oldNames, node-name($node))], node-name($node)) } {$node/@*, functx:change-element-names-deep($node/node(), $oldNames, $newNames)} else if ($node instance of document-node()) then functx:change-element-names-deep($node/node(), $oldNames, $newNames) else $node } ;\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " let $in-xml-1 := b c return let $in-xml-2 := b c return (functx:change-element-names-deep( $in-xml-1, xs:QName('b'), xs:QName('y')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("bc", false) ); } /** * ~ : Changes the names of elements in an XML fragment : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_change-element-names-deep.html : @param $nodes the element(s) to change : @param $oldNames the sequence of names to change from : @param $newNames the sequence of names to change to ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty . */ @org.junit.Test public void functxFunctxChangeElementNamesDeep2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " declare namespace dty = \"http://datypic.com\";\n" + " (:~ : Changes the names of elements in an XML fragment : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_change-element-names-deep.html : @param $nodes the element(s) to change : @param $oldNames the sequence of names to change from : @param $newNames the sequence of names to change to :)\n" + " declare function functx:change-element-names-deep ( $nodes as node()* , $oldNames as xs:QName* , $newNames as xs:QName* ) as node()* { if (count($oldNames) != count($newNames)) then error(xs:QName('functx:Different_number_of_names')) else for $node in $nodes return if ($node instance of element()) then element {functx:if-empty ($newNames[index-of($oldNames, node-name($node))], node-name($node)) } {$node/@*, functx:change-element-names-deep($node/node(), $oldNames, $newNames)} else if ($node instance of document-node()) then functx:change-element-names-deep($node/node(), $oldNames, $newNames) else $node } ;\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " let $in-xml-1 := b c return let $in-xml-2 := b c return (functx:change-element-names-deep( $in-xml-1, (xs:QName('a'), xs:QName('b'),xs:QName('c')), (xs:QName('x'), xs:QName('y'),xs:QName('z'))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("bc", false) ); } /** * ~ : Changes the names of elements in an XML fragment : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_change-element-names-deep.html : @param $nodes the element(s) to change : @param $oldNames the sequence of names to change from : @param $newNames the sequence of names to change to ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty . */ @org.junit.Test public void functxFunctxChangeElementNamesDeep3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " declare namespace dty = \"http://datypic.com\";\n" + " (:~ : Changes the names of elements in an XML fragment : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_change-element-names-deep.html : @param $nodes the element(s) to change : @param $oldNames the sequence of names to change from : @param $newNames the sequence of names to change to :)\n" + " declare function functx:change-element-names-deep ( $nodes as node()* , $oldNames as xs:QName* , $newNames as xs:QName* ) as node()* { if (count($oldNames) != count($newNames)) then error(xs:QName('functx:Different_number_of_names')) else for $node in $nodes return if ($node instance of element()) then element {functx:if-empty ($newNames[index-of($oldNames, node-name($node))], node-name($node)) } {$node/@*, functx:change-element-names-deep($node/node(), $oldNames, $newNames)} else if ($node instance of document-node()) then functx:change-element-names-deep($node/node(), $oldNames, $newNames) else $node } ;\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " let $in-xml-1 := b c return let $in-xml-2 := b c return (functx:change-element-names-deep( $in-xml-2, (xs:QName('dty:b'),xs:QName('c')), (xs:QName('q'), QName('http://new','new:c'))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("bc", false) ); } /** * ~ : Changes the names of elements in an XML fragment : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_change-element-names-deep.html : @param $nodes the element(s) to change : @param $oldNames the sequence of names to change from : @param $newNames the sequence of names to change to ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty . */ @org.junit.Test public void functxFunctxChangeElementNamesDeepAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " declare namespace dty = \"http://datypic.com\";\n" + " (:~ : Changes the names of elements in an XML fragment : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_change-element-names-deep.html : @param $nodes the element(s) to change : @param $oldNames the sequence of names to change from : @param $newNames the sequence of names to change to :)\n" + " declare function functx:change-element-names-deep ( $nodes as node()* , $oldNames as xs:QName* , $newNames as xs:QName* ) as node()* { if (count($oldNames) != count($newNames)) then error(xs:QName('functx:Different_number_of_names')) else for $node in $nodes return if ($node instance of element()) then element {functx:if-empty ($newNames[index-of($oldNames, node-name($node))], node-name($node)) } {$node/@*, functx:change-element-names-deep($node/node(), $oldNames, $newNames)} else if ($node instance of document-node()) then functx:change-element-names-deep($node/node(), $oldNames, $newNames) else $node } ;\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " let $in-xml-1 := b c return let $in-xml-2 := b c return (functx:change-element-names-deep( $in-xml-1, xs:QName('b'), xs:QName('y')), functx:change-element-names-deep( $in-xml-1, (xs:QName('a'), xs:QName('b'),xs:QName('c')), (xs:QName('x'), xs:QName('y'),xs:QName('z'))), functx:change-element-names-deep( $in-xml-2, (xs:QName('dty:b'),xs:QName('c')), (xs:QName('q'), QName('http://new','new:c'))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("bcbcbc", false) ); } /** * ~ : Changes the namespace of XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_change-element-ns.html : @param $elements the elements to change : @param $newns the new namespace : @param $prefix the prefix to use for the new namespace . */ @org.junit.Test public void functxFunctxChangeElementNs1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Changes the namespace of XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_change-element-ns.html : @param $elements the elements to change : @param $newns the new namespace : @param $prefix the prefix to use for the new namespace :)\n" + " declare function functx:change-element-ns ( $elements as element()* , $newns as xs:string , $prefix as xs:string ) as element()? { for $element in $elements return element {QName ($newns, concat($prefix, if ($prefix = '') then '' else ':', local-name($element)))} {$element/@*, $element/node()} } ;\n" + " let $in-xml := 557 xyz return (functx:change-element-ns( $in-xml, 'http://foo',''))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("557xyz", false) ); } /** * ~ : Changes the namespace of XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_change-element-ns.html : @param $elements the elements to change : @param $newns the new namespace : @param $prefix the prefix to use for the new namespace . */ @org.junit.Test public void functxFunctxChangeElementNs2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Changes the namespace of XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_change-element-ns.html : @param $elements the elements to change : @param $newns the new namespace : @param $prefix the prefix to use for the new namespace :)\n" + " declare function functx:change-element-ns ( $elements as element()* , $newns as xs:string , $prefix as xs:string ) as element()? { for $element in $elements return element {QName ($newns, concat($prefix, if ($prefix = '') then '' else ':', local-name($element)))} {$element/@*, $element/node()} } ;\n" + " let $in-xml := 557 xyz return (functx:change-element-ns( $in-xml, 'http://foo','foo'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("557xyz", false) ); } /** * ~ : Changes the namespace of XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_change-element-ns.html : @param $elements the elements to change : @param $newns the new namespace : @param $prefix the prefix to use for the new namespace . */ @org.junit.Test public void functxFunctxChangeElementNsAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Changes the namespace of XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_change-element-ns.html : @param $elements the elements to change : @param $newns the new namespace : @param $prefix the prefix to use for the new namespace :)\n" + " declare function functx:change-element-ns ( $elements as element()* , $newns as xs:string , $prefix as xs:string ) as element()? { for $element in $elements return element {QName ($newns, concat($prefix, if ($prefix = '') then '' else ':', local-name($element)))} {$element/@*, $element/node()} } ;\n" + " let $in-xml := 557 xyz return (functx:change-element-ns( $in-xml, 'http://foo',''), functx:change-element-ns( $in-xml, 'http://foo','foo'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("557xyz557xyz", false) ); } /** * ~ : Changes the namespace of XML elements and its descendants : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_change-element-ns-deep.html : @param $nodes the nodes to change : @param $newns the new namespace : @param $prefix the prefix to use for the new namespace . */ @org.junit.Test public void functxFunctxChangeElementNsDeep1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Changes the namespace of XML elements and its descendants : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_change-element-ns-deep.html : @param $nodes the nodes to change : @param $newns the new namespace : @param $prefix the prefix to use for the new namespace :)\n" + " declare function functx:change-element-ns-deep ( $nodes as node()* , $newns as xs:string , $prefix as xs:string ) as node()* { for $node in $nodes return if ($node instance of element()) then (element {QName ($newns, concat($prefix, if ($prefix = '') then '' else ':', local-name($node)))} {$node/@*, functx:change-element-ns-deep($node/node(), $newns, $prefix)}) else if ($node instance of document-node()) then functx:change-element-ns-deep($node/node(), $newns, $prefix) else $node } ;\n" + " let $in-xml := 557 xyz return (functx:change-element-ns-deep( $in-xml, 'http://foo',''))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("557xyz", false) ); } /** * ~ : Changes the namespace of XML elements and its descendants : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_change-element-ns-deep.html : @param $nodes the nodes to change : @param $newns the new namespace : @param $prefix the prefix to use for the new namespace . */ @org.junit.Test public void functxFunctxChangeElementNsDeep2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Changes the namespace of XML elements and its descendants : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_change-element-ns-deep.html : @param $nodes the nodes to change : @param $newns the new namespace : @param $prefix the prefix to use for the new namespace :)\n" + " declare function functx:change-element-ns-deep ( $nodes as node()* , $newns as xs:string , $prefix as xs:string ) as node()* { for $node in $nodes return if ($node instance of element()) then (element {QName ($newns, concat($prefix, if ($prefix = '') then '' else ':', local-name($node)))} {$node/@*, functx:change-element-ns-deep($node/node(), $newns, $prefix)}) else if ($node instance of document-node()) then functx:change-element-ns-deep($node/node(), $newns, $prefix) else $node } ;\n" + " let $in-xml := 557 xyz return (functx:change-element-ns-deep( $in-xml, 'http://foo','foo'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("557xyz", false) ); } /** * ~ : Changes the namespace of XML elements and its descendants : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_change-element-ns-deep.html : @param $nodes the nodes to change : @param $newns the new namespace : @param $prefix the prefix to use for the new namespace . */ @org.junit.Test public void functxFunctxChangeElementNsDeepAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Changes the namespace of XML elements and its descendants : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_change-element-ns-deep.html : @param $nodes the nodes to change : @param $newns the new namespace : @param $prefix the prefix to use for the new namespace :)\n" + " declare function functx:change-element-ns-deep ( $nodes as node()* , $newns as xs:string , $prefix as xs:string ) as node()* { for $node in $nodes return if ($node instance of element()) then (element {QName ($newns, concat($prefix, if ($prefix = '') then '' else ':', local-name($node)))} {$node/@*, functx:change-element-ns-deep($node/node(), $newns, $prefix)}) else if ($node instance of document-node()) then functx:change-element-ns-deep($node/node(), $newns, $prefix) else $node } ;\n" + " let $in-xml := 557 xyz return (functx:change-element-ns-deep( $in-xml, 'http://foo',''), functx:change-element-ns-deep( $in-xml, 'http://foo','foo'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("557xyz557xyz", false) ); } /** * ~ : Converts a string to a sequence of characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_chars.html : @param $arg the string to split . */ @org.junit.Test public void functxFunctxChars1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Converts a string to a sequence of characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_chars.html : @param $arg the string to split :)\n" + " declare function functx:chars ( $arg as xs:string? ) as xs:string* { for $ch in string-to-codepoints($arg) return codepoints-to-string($ch) } ;\n" + " (functx:chars('abc'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b c") ); } /** * ~ : Converts a string to a sequence of characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_chars.html : @param $arg the string to split . */ @org.junit.Test public void functxFunctxChars2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Converts a string to a sequence of characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_chars.html : @param $arg the string to split :)\n" + " declare function functx:chars ( $arg as xs:string? ) as xs:string* { for $ch in string-to-codepoints($arg) return codepoints-to-string($ch) } ;\n" + " (functx:chars('a b c'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b c") ); } /** * ~ : Converts a string to a sequence of characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_chars.html : @param $arg the string to split . */ @org.junit.Test public void functxFunctxCharsAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Converts a string to a sequence of characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_chars.html : @param $arg the string to split :)\n" + " declare function functx:chars ( $arg as xs:string? ) as xs:string* { for $ch in string-to-codepoints($arg) return codepoints-to-string($ch) } ;\n" + " (functx:chars('abc'), functx:chars('a b c'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b c a b c") ); } /** * ~ : Whether a string contains any of a sequence of strings : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_contains-any-of.html : @param $arg the string to test : @param $searchStrings the strings to look for . */ @org.junit.Test public void functxFunctxContainsAnyOf1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a string contains any of a sequence of strings : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_contains-any-of.html : @param $arg the string to test : @param $searchStrings the strings to look for :)\n" + " declare function functx:contains-any-of ( $arg as xs:string? , $searchStrings as xs:string* ) as xs:boolean { some $searchString in $searchStrings satisfies contains($arg,$searchString) } ;\n" + " (functx:contains-any-of('abc',('bc','xy')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether a string contains any of a sequence of strings : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_contains-any-of.html : @param $arg the string to test : @param $searchStrings the strings to look for . */ @org.junit.Test public void functxFunctxContainsAnyOf2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a string contains any of a sequence of strings : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_contains-any-of.html : @param $arg the string to test : @param $searchStrings the strings to look for :)\n" + " declare function functx:contains-any-of ( $arg as xs:string? , $searchStrings as xs:string* ) as xs:boolean { some $searchString in $searchStrings satisfies contains($arg,$searchString) } ;\n" + " (functx:contains-any-of('abc',('de','xy')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether a string contains any of a sequence of strings : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_contains-any-of.html : @param $arg the string to test : @param $searchStrings the strings to look for . */ @org.junit.Test public void functxFunctxContainsAnyOfAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a string contains any of a sequence of strings : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_contains-any-of.html : @param $arg the string to test : @param $searchStrings the strings to look for :)\n" + " declare function functx:contains-any-of ( $arg as xs:string? , $searchStrings as xs:string* ) as xs:boolean { some $searchString in $searchStrings satisfies contains($arg,$searchString) } ;\n" + " (functx:contains-any-of('abc',('bc','xy')), functx:contains-any-of('abc',('de','xy')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true false") ); } /** * ~ : Whether one string contains another, without regard to case : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_contains-case-insensitive.html : @param $arg the string to search : @param $substring the substring to find . */ @org.junit.Test public void functxFunctxContainsCaseInsensitive1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether one string contains another, without regard to case : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_contains-case-insensitive.html : @param $arg the string to search : @param $substring the substring to find :)\n" + " declare function functx:contains-case-insensitive ( $arg as xs:string? , $substring as xs:string ) as xs:boolean? { contains(upper-case($arg), upper-case($substring)) } ;\n" + " (functx:contains-case-insensitive( 'abcdef', 'def'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether one string contains another, without regard to case : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_contains-case-insensitive.html : @param $arg the string to search : @param $substring the substring to find . */ @org.junit.Test public void functxFunctxContainsCaseInsensitive2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether one string contains another, without regard to case : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_contains-case-insensitive.html : @param $arg the string to search : @param $substring the substring to find :)\n" + " declare function functx:contains-case-insensitive ( $arg as xs:string? , $substring as xs:string ) as xs:boolean? { contains(upper-case($arg), upper-case($substring)) } ;\n" + " (functx:contains-case-insensitive( 'abcdEF', 'def'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether one string contains another, without regard to case : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_contains-case-insensitive.html : @param $arg the string to search : @param $substring the substring to find . */ @org.junit.Test public void functxFunctxContainsCaseInsensitiveAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether one string contains another, without regard to case : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_contains-case-insensitive.html : @param $arg the string to search : @param $substring the substring to find :)\n" + " declare function functx:contains-case-insensitive ( $arg as xs:string? , $substring as xs:string ) as xs:boolean? { contains(upper-case($arg), upper-case($substring)) } ;\n" + " (functx:contains-case-insensitive( 'abcdef', 'def'), functx:contains-case-insensitive( 'abcdEF', 'def'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true") ); } /** * ~ : Whether one string contains another, as a separate word : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_contains-word.html : @param $arg the string to search : @param $word the word to find ~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape . */ @org.junit.Test public void functxFunctxContainsWord1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether one string contains another, as a separate word : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_contains-word.html : @param $arg the string to search : @param $word the word to find :)\n" + " declare function functx:contains-word ( $arg as xs:string? , $word as xs:string ) as xs:boolean { matches(upper-case($arg), concat('^(.*\\W)?', upper-case(functx:escape-for-regex($word)), '(\\W.*)?$')) } ;\n" + " (:~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape :)\n" + " declare function functx:escape-for-regex ( $arg as xs:string? ) as xs:string { replace($arg, '(\\.|\\[|\\]|\\\\|\\||\\-|\\^|\\$|\\?|\\*|\\+|\\{|\\}|\\(|\\))','\\\\$1') } ;\n" + " (functx:contains-word('abc def ghi', 'def'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether one string contains another, as a separate word : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_contains-word.html : @param $arg the string to search : @param $word the word to find ~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape . */ @org.junit.Test public void functxFunctxContainsWord2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether one string contains another, as a separate word : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_contains-word.html : @param $arg the string to search : @param $word the word to find :)\n" + " declare function functx:contains-word ( $arg as xs:string? , $word as xs:string ) as xs:boolean { matches(upper-case($arg), concat('^(.*\\W)?', upper-case(functx:escape-for-regex($word)), '(\\W.*)?$')) } ;\n" + " (:~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape :)\n" + " declare function functx:escape-for-regex ( $arg as xs:string? ) as xs:string { replace($arg, '(\\.|\\[|\\]|\\\\|\\||\\-|\\^|\\$|\\?|\\*|\\+|\\{|\\}|\\(|\\))','\\\\$1') } ;\n" + " (functx:contains-word('abc.def\\ghi', 'def'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether one string contains another, as a separate word : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_contains-word.html : @param $arg the string to search : @param $word the word to find ~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape . */ @org.junit.Test public void functxFunctxContainsWord3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether one string contains another, as a separate word : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_contains-word.html : @param $arg the string to search : @param $word the word to find :)\n" + " declare function functx:contains-word ( $arg as xs:string? , $word as xs:string ) as xs:boolean { matches(upper-case($arg), concat('^(.*\\W)?', upper-case(functx:escape-for-regex($word)), '(\\W.*)?$')) } ;\n" + " (:~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape :)\n" + " declare function functx:escape-for-regex ( $arg as xs:string? ) as xs:string { replace($arg, '(\\.|\\[|\\]|\\\\|\\||\\-|\\^|\\$|\\?|\\*|\\+|\\{|\\}|\\(|\\))','\\\\$1') } ;\n" + " (functx:contains-word('abc def ghi', 'abc'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether one string contains another, as a separate word : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_contains-word.html : @param $arg the string to search : @param $word the word to find ~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape . */ @org.junit.Test public void functxFunctxContainsWord4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether one string contains another, as a separate word : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_contains-word.html : @param $arg the string to search : @param $word the word to find :)\n" + " declare function functx:contains-word ( $arg as xs:string? , $word as xs:string ) as xs:boolean { matches(upper-case($arg), concat('^(.*\\W)?', upper-case(functx:escape-for-regex($word)), '(\\W.*)?$')) } ;\n" + " (:~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape :)\n" + " declare function functx:escape-for-regex ( $arg as xs:string? ) as xs:string { replace($arg, '(\\.|\\[|\\]|\\\\|\\||\\-|\\^|\\$|\\?|\\*|\\+|\\{|\\}|\\(|\\))','\\\\$1') } ;\n" + " (functx:contains-word('abc', 'abc'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether one string contains another, as a separate word : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_contains-word.html : @param $arg the string to search : @param $word the word to find ~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape . */ @org.junit.Test public void functxFunctxContainsWord5() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether one string contains another, as a separate word : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_contains-word.html : @param $arg the string to search : @param $word the word to find :)\n" + " declare function functx:contains-word ( $arg as xs:string? , $word as xs:string ) as xs:boolean { matches(upper-case($arg), concat('^(.*\\W)?', upper-case(functx:escape-for-regex($word)), '(\\W.*)?$')) } ;\n" + " (:~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape :)\n" + " declare function functx:escape-for-regex ( $arg as xs:string? ) as xs:string { replace($arg, '(\\.|\\[|\\]|\\\\|\\||\\-|\\^|\\$|\\?|\\*|\\+|\\{|\\}|\\(|\\))','\\\\$1') } ;\n" + " (functx:contains-word('abcdef', 'abc'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether one string contains another, as a separate word : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_contains-word.html : @param $arg the string to search : @param $word the word to find ~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape . */ @org.junit.Test public void functxFunctxContainsWordAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether one string contains another, as a separate word : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_contains-word.html : @param $arg the string to search : @param $word the word to find :)\n" + " declare function functx:contains-word ( $arg as xs:string? , $word as xs:string ) as xs:boolean { matches(upper-case($arg), concat('^(.*\\W)?', upper-case(functx:escape-for-regex($word)), '(\\W.*)?$')) } ;\n" + " (:~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape :)\n" + " declare function functx:escape-for-regex ( $arg as xs:string? ) as xs:string { replace($arg, '(\\.|\\[|\\]|\\\\|\\||\\-|\\^|\\$|\\?|\\*|\\+|\\{|\\}|\\(|\\))','\\\\$1') } ;\n" + " (functx:contains-word('abc def ghi', 'def'), functx:contains-word('abc.def\\ghi', 'def'), functx:contains-word('abc def ghi', 'abc'), functx:contains-word('abc', 'abc'), functx:contains-word('abcdef', 'abc'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true true true false") ); } /** * ~ : Copies attributes from one element to another : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_copy-attributes.html : @param $copyTo the element to copy attributes to : @param $copyFrom the element to copy attributes from . */ @org.junit.Test public void functxFunctxCopyAttributes1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Copies attributes from one element to another : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_copy-attributes.html : @param $copyTo the element to copy attributes to : @param $copyFrom the element to copy attributes from :)\n" + " declare function functx:copy-attributes ( $copyTo as element() , $copyFrom as element() ) as element() { element { node-name($copyTo)} { $copyTo/@*[not(node-name(.) = $copyFrom/@*/node-name(.))], $copyFrom/@*, $copyTo/node() } } ;\n" + " let $in-xml := 123> 456 123 123 return (functx:copy-attributes( $in-xml/a, $in-xml/b))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("123", false) ); } /** * ~ : Copies attributes from one element to another : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_copy-attributes.html : @param $copyTo the element to copy attributes to : @param $copyFrom the element to copy attributes from . */ @org.junit.Test public void functxFunctxCopyAttributes2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Copies attributes from one element to another : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_copy-attributes.html : @param $copyTo the element to copy attributes to : @param $copyFrom the element to copy attributes from :)\n" + " declare function functx:copy-attributes ( $copyTo as element() , $copyFrom as element() ) as element() { element { node-name($copyTo)} { $copyTo/@*[not(node-name(.) = $copyFrom/@*/node-name(.))], $copyFrom/@*, $copyTo/node() } } ;\n" + " let $in-xml := 123> 456 123 123 return (functx:copy-attributes( $in-xml/b, $in-xml/c))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("456", false) ); } /** * ~ : Copies attributes from one element to another : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_copy-attributes.html : @param $copyTo the element to copy attributes to : @param $copyFrom the element to copy attributes from . */ @org.junit.Test public void functxFunctxCopyAttributes3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Copies attributes from one element to another : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_copy-attributes.html : @param $copyTo the element to copy attributes to : @param $copyFrom the element to copy attributes from :)\n" + " declare function functx:copy-attributes ( $copyTo as element() , $copyFrom as element() ) as element() { element { node-name($copyTo)} { $copyTo/@*[not(node-name(.) = $copyFrom/@*/node-name(.))], $copyFrom/@*, $copyTo/node() } } ;\n" + " let $in-xml := 123> 456 123 123 return (functx:copy-attributes( $in-xml/d, $in-xml/c))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("123", false) ); } /** * ~ : Copies attributes from one element to another : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_copy-attributes.html : @param $copyTo the element to copy attributes to : @param $copyFrom the element to copy attributes from . */ @org.junit.Test public void functxFunctxCopyAttributesAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Copies attributes from one element to another : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_copy-attributes.html : @param $copyTo the element to copy attributes to : @param $copyFrom the element to copy attributes from :)\n" + " declare function functx:copy-attributes ( $copyTo as element() , $copyFrom as element() ) as element() { element { node-name($copyTo)} { $copyTo/@*[not(node-name(.) = $copyFrom/@*/node-name(.))], $copyFrom/@*, $copyTo/node() } } ;\n" + " let $in-xml := 123> 456 123 123 return (functx:copy-attributes( $in-xml/a, $in-xml/b), functx:copy-attributes( $in-xml/b, $in-xml/c), functx:copy-attributes( $in-xml/d, $in-xml/c))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("123456123", false) ); } /** * ~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxDate1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day :)\n" + " declare function functx:date ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType ) as xs:date { xs:date( concat( functx:pad-integer-to-length(xs:integer($year),4),'-', functx:pad-integer-to-length(xs:integer($month),2),'-', functx:pad-integer-to-length(xs:integer($day),2))) } ;\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:date(2006,6,12))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2006-06-12") ); } /** * ~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxDate2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day :)\n" + " declare function functx:date ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType ) as xs:date { xs:date( concat( functx:pad-integer-to-length(xs:integer($year),4),'-', functx:pad-integer-to-length(xs:integer($month),2),'-', functx:pad-integer-to-length(xs:integer($day),2))) } ;\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:date('2006','06','12'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2006-06-12") ); } /** * ~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxDateAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day :)\n" + " declare function functx:date ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType ) as xs:date { xs:date( concat( functx:pad-integer-to-length(xs:integer($year),4),'-', functx:pad-integer-to-length(xs:integer($month),2),'-', functx:pad-integer-to-length(xs:integer($day),2))) } ;\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:date(2006,6,12), functx:date('2006','06','12'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2006-06-12 2006-06-12") ); } /** * ~ : Construct a date/time from individual components : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_datetime.html : @param $year the year : @param $month the month : @param $day the day : @param $hour the hour : @param $minute the minute : @param $second the second ~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies ~ : Construct a time from an hour, minute and second : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_time.html : @param $hour the hour : @param $minute the minute : @param $second the second . */ @org.junit.Test public void functxFunctxDateTime1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a date/time from individual components : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_datetime.html : @param $year the year : @param $month the month : @param $day the day : @param $hour the hour : @param $minute the minute : @param $second the second :)\n" + " declare function functx:dateTime ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType , $hour as xs:anyAtomicType , $minute as xs:anyAtomicType , $second as xs:anyAtomicType ) as xs:dateTime { xs:dateTime( concat(functx:date($year,$month,$day),'T', functx:time($hour,$minute,$second))) } ;\n" + " (:~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day :)\n" + " declare function functx:date ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType ) as xs:date { xs:date( concat( functx:pad-integer-to-length(xs:integer($year),4),'-', functx:pad-integer-to-length(xs:integer($month),2),'-', functx:pad-integer-to-length(xs:integer($day),2))) } ;\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (:~ : Construct a time from an hour, minute and second : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_time.html : @param $hour the hour : @param $minute the minute : @param $second the second :)\n" + " declare function functx:time ( $hour as xs:anyAtomicType , $minute as xs:anyAtomicType , $second as xs:anyAtomicType ) as xs:time { xs:time( concat( functx:pad-integer-to-length(xs:integer($hour),2),':', functx:pad-integer-to-length(xs:integer($minute),2),':', functx:pad-integer-to-length(xs:integer($second),2))) } ;\n" + " (functx:dateTime(2006,6,12,20,6,12))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2006-06-12T20:06:12") ); } /** * ~ : Construct a date/time from individual components : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_datetime.html : @param $year the year : @param $month the month : @param $day the day : @param $hour the hour : @param $minute the minute : @param $second the second ~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies ~ : Construct a time from an hour, minute and second : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_time.html : @param $hour the hour : @param $minute the minute : @param $second the second . */ @org.junit.Test public void functxFunctxDateTime2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a date/time from individual components : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_datetime.html : @param $year the year : @param $month the month : @param $day the day : @param $hour the hour : @param $minute the minute : @param $second the second :)\n" + " declare function functx:dateTime ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType , $hour as xs:anyAtomicType , $minute as xs:anyAtomicType , $second as xs:anyAtomicType ) as xs:dateTime { xs:dateTime( concat(functx:date($year,$month,$day),'T', functx:time($hour,$minute,$second))) } ;\n" + " (:~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day :)\n" + " declare function functx:date ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType ) as xs:date { xs:date( concat( functx:pad-integer-to-length(xs:integer($year),4),'-', functx:pad-integer-to-length(xs:integer($month),2),'-', functx:pad-integer-to-length(xs:integer($day),2))) } ;\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (:~ : Construct a time from an hour, minute and second : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_time.html : @param $hour the hour : @param $minute the minute : @param $second the second :)\n" + " declare function functx:time ( $hour as xs:anyAtomicType , $minute as xs:anyAtomicType , $second as xs:anyAtomicType ) as xs:time { xs:time( concat( functx:pad-integer-to-length(xs:integer($hour),2),':', functx:pad-integer-to-length(xs:integer($minute),2),':', functx:pad-integer-to-length(xs:integer($second),2))) } ;\n" + " (functx:dateTime('2006','6','12','20','6','12'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2006-06-12T20:06:12") ); } /** * ~ : Construct a date/time from individual components : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_datetime.html : @param $year the year : @param $month the month : @param $day the day : @param $hour the hour : @param $minute the minute : @param $second the second ~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies ~ : Construct a time from an hour, minute and second : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_time.html : @param $hour the hour : @param $minute the minute : @param $second the second . */ @org.junit.Test public void functxFunctxDateTimeAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a date/time from individual components : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_datetime.html : @param $year the year : @param $month the month : @param $day the day : @param $hour the hour : @param $minute the minute : @param $second the second :)\n" + " declare function functx:dateTime ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType , $hour as xs:anyAtomicType , $minute as xs:anyAtomicType , $second as xs:anyAtomicType ) as xs:dateTime { xs:dateTime( concat(functx:date($year,$month,$day),'T', functx:time($hour,$minute,$second))) } ;\n" + " (:~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day :)\n" + " declare function functx:date ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType ) as xs:date { xs:date( concat( functx:pad-integer-to-length(xs:integer($year),4),'-', functx:pad-integer-to-length(xs:integer($month),2),'-', functx:pad-integer-to-length(xs:integer($day),2))) } ;\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (:~ : Construct a time from an hour, minute and second : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_time.html : @param $hour the hour : @param $minute the minute : @param $second the second :)\n" + " declare function functx:time ( $hour as xs:anyAtomicType , $minute as xs:anyAtomicType , $second as xs:anyAtomicType ) as xs:time { xs:time( concat( functx:pad-integer-to-length(xs:integer($hour),2),':', functx:pad-integer-to-length(xs:integer($minute),2),':', functx:pad-integer-to-length(xs:integer($second),2))) } ;\n" + " (functx:dateTime(2006,6,12,20,6,12), functx:dateTime('2006','6','12','20','6','12'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2006-06-12T20:06:12 2006-06-12T20:06:12") ); } /** * ~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day ~ : The day of the year (a number between 1 and 366) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-in-year.html : @param $date the date ~ : The first day of the year of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-day-of-year.html : @param $date the date ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxDayInYear1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day :)\n" + " declare function functx:date ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType ) as xs:date { xs:date( concat( functx:pad-integer-to-length(xs:integer($year),4),'-', functx:pad-integer-to-length(xs:integer($month),2),'-', functx:pad-integer-to-length(xs:integer($day),2))) } ;\n" + " (:~ : The day of the year (a number between 1 and 366) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-in-year.html : @param $date the date :)\n" + " declare function functx:day-in-year ( $date as xs:anyAtomicType? ) as xs:integer? { days-from-duration( xs:date($date) - functx:first-day-of-year($date)) + 1 } ;\n" + " (:~ : The first day of the year of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-day-of-year.html : @param $date the date :)\n" + " declare function functx:first-day-of-year ( $date as xs:anyAtomicType? ) as xs:date? { functx:date(year-from-date(xs:date($date)), 1, 1) } ;\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:day-in-year(xs:date('2004-01-01')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * ~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day ~ : The day of the year (a number between 1 and 366) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-in-year.html : @param $date the date ~ : The first day of the year of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-day-of-year.html : @param $date the date ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxDayInYear2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day :)\n" + " declare function functx:date ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType ) as xs:date { xs:date( concat( functx:pad-integer-to-length(xs:integer($year),4),'-', functx:pad-integer-to-length(xs:integer($month),2),'-', functx:pad-integer-to-length(xs:integer($day),2))) } ;\n" + " (:~ : The day of the year (a number between 1 and 366) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-in-year.html : @param $date the date :)\n" + " declare function functx:day-in-year ( $date as xs:anyAtomicType? ) as xs:integer? { days-from-duration( xs:date($date) - functx:first-day-of-year($date)) + 1 } ;\n" + " (:~ : The first day of the year of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-day-of-year.html : @param $date the date :)\n" + " declare function functx:first-day-of-year ( $date as xs:anyAtomicType? ) as xs:date? { functx:date(year-from-date(xs:date($date)), 1, 1) } ;\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:day-in-year( xs:dateTime('2004-02-01T12:00:13')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("32") ); } /** * ~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day ~ : The day of the year (a number between 1 and 366) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-in-year.html : @param $date the date ~ : The first day of the year of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-day-of-year.html : @param $date the date ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxDayInYear3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day :)\n" + " declare function functx:date ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType ) as xs:date { xs:date( concat( functx:pad-integer-to-length(xs:integer($year),4),'-', functx:pad-integer-to-length(xs:integer($month),2),'-', functx:pad-integer-to-length(xs:integer($day),2))) } ;\n" + " (:~ : The day of the year (a number between 1 and 366) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-in-year.html : @param $date the date :)\n" + " declare function functx:day-in-year ( $date as xs:anyAtomicType? ) as xs:integer? { days-from-duration( xs:date($date) - functx:first-day-of-year($date)) + 1 } ;\n" + " (:~ : The first day of the year of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-day-of-year.html : @param $date the date :)\n" + " declare function functx:first-day-of-year ( $date as xs:anyAtomicType? ) as xs:date? { functx:date(year-from-date(xs:date($date)), 1, 1) } ;\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:day-in-year('2004-02-05'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("36") ); } /** * ~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day ~ : The day of the year (a number between 1 and 366) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-in-year.html : @param $date the date ~ : The first day of the year of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-day-of-year.html : @param $date the date ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxDayInYearAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day :)\n" + " declare function functx:date ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType ) as xs:date { xs:date( concat( functx:pad-integer-to-length(xs:integer($year),4),'-', functx:pad-integer-to-length(xs:integer($month),2),'-', functx:pad-integer-to-length(xs:integer($day),2))) } ;\n" + " (:~ : The day of the year (a number between 1 and 366) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-in-year.html : @param $date the date :)\n" + " declare function functx:day-in-year ( $date as xs:anyAtomicType? ) as xs:integer? { days-from-duration( xs:date($date) - functx:first-day-of-year($date)) + 1 } ;\n" + " (:~ : The first day of the year of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-day-of-year.html : @param $date the date :)\n" + " declare function functx:first-day-of-year ( $date as xs:anyAtomicType? ) as xs:date? { functx:date(year-from-date(xs:date($date)), 1, 1) } ;\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:day-in-year(xs:date('2004-01-01')), functx:day-in-year( xs:dateTime('2004-02-01T12:00:13')), functx:day-in-year('2004-02-05'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 32 36") ); } /** * ~ : The day of the week, from a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week.html : @param $date the date . */ @org.junit.Test public void functxFunctxDayOfWeek1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The day of the week, from a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week.html : @param $date the date :)\n" + " declare function functx:day-of-week ( $date as xs:anyAtomicType? ) as xs:integer? { if (empty($date)) then () else xs:integer((xs:date($date) - xs:date('1901-01-06')) div xs:dayTimeDuration('P1D')) mod 7 } ;\n" + " (functx:day-of-week( xs:date('2004-11-04')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("4") ); } /** * ~ : The day of the week, from a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week.html : @param $date the date . */ @org.junit.Test public void functxFunctxDayOfWeek2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The day of the week, from a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week.html : @param $date the date :)\n" + " declare function functx:day-of-week ( $date as xs:anyAtomicType? ) as xs:integer? { if (empty($date)) then () else xs:integer((xs:date($date) - xs:date('1901-01-06')) div xs:dayTimeDuration('P1D')) mod 7 } ;\n" + " (functx:day-of-week( xs:dateTime('2004-11-04T12:00:13')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("4") ); } /** * ~ : The day of the week, from a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week.html : @param $date the date . */ @org.junit.Test public void functxFunctxDayOfWeek3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The day of the week, from a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week.html : @param $date the date :)\n" + " declare function functx:day-of-week ( $date as xs:anyAtomicType? ) as xs:integer? { if (empty($date)) then () else xs:integer((xs:date($date) - xs:date('1901-01-06')) div xs:dayTimeDuration('P1D')) mod 7 } ;\n" + " (functx:day-of-week('2004-11-04'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("4") ); } /** * ~ : The abbreviated day of the week, from a date, in English : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week-abbrev-en.html : @param $date the date ~ : The day of the week, from a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week.html : @param $date the date . */ @org.junit.Test public void functxFunctxDayOfWeekAbbrevEn1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The abbreviated day of the week, from a date, in English : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week-abbrev-en.html : @param $date the date :)\n" + " declare function functx:day-of-week-abbrev-en ( $date as xs:anyAtomicType? ) as xs:string? { ('Sun', 'Mon', 'Tues', 'Wed', 'Thurs', 'Fri', 'Sat') [functx:day-of-week($date) + 1] } ;\n" + " (:~ : The day of the week, from a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week.html : @param $date the date :)\n" + " declare function functx:day-of-week ( $date as xs:anyAtomicType? ) as xs:integer? { if (empty($date)) then () else xs:integer((xs:date($date) - xs:date('1901-01-06')) div xs:dayTimeDuration('P1D')) mod 7 } ;\n" + " (functx:day-of-week-abbrev-en( xs:date('2004-11-04')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Thurs") ); } /** * ~ : The abbreviated day of the week, from a date, in English : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week-abbrev-en.html : @param $date the date ~ : The day of the week, from a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week.html : @param $date the date . */ @org.junit.Test public void functxFunctxDayOfWeekAbbrevEn2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The abbreviated day of the week, from a date, in English : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week-abbrev-en.html : @param $date the date :)\n" + " declare function functx:day-of-week-abbrev-en ( $date as xs:anyAtomicType? ) as xs:string? { ('Sun', 'Mon', 'Tues', 'Wed', 'Thurs', 'Fri', 'Sat') [functx:day-of-week($date) + 1] } ;\n" + " (:~ : The day of the week, from a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week.html : @param $date the date :)\n" + " declare function functx:day-of-week ( $date as xs:anyAtomicType? ) as xs:integer? { if (empty($date)) then () else xs:integer((xs:date($date) - xs:date('1901-01-06')) div xs:dayTimeDuration('P1D')) mod 7 } ;\n" + " (functx:day-of-week-abbrev-en('2004-11-04'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Thurs") ); } /** * ~ : The abbreviated day of the week, from a date, in English : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week-abbrev-en.html : @param $date the date ~ : The day of the week, from a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week.html : @param $date the date . */ @org.junit.Test public void functxFunctxDayOfWeekAbbrevEnAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The abbreviated day of the week, from a date, in English : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week-abbrev-en.html : @param $date the date :)\n" + " declare function functx:day-of-week-abbrev-en ( $date as xs:anyAtomicType? ) as xs:string? { ('Sun', 'Mon', 'Tues', 'Wed', 'Thurs', 'Fri', 'Sat') [functx:day-of-week($date) + 1] } ;\n" + " (:~ : The day of the week, from a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week.html : @param $date the date :)\n" + " declare function functx:day-of-week ( $date as xs:anyAtomicType? ) as xs:integer? { if (empty($date)) then () else xs:integer((xs:date($date) - xs:date('1901-01-06')) div xs:dayTimeDuration('P1D')) mod 7 } ;\n" + " (functx:day-of-week-abbrev-en( xs:date('2004-11-04')), functx:day-of-week-abbrev-en('2004-11-04'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Thurs Thurs") ); } /** * ~ : The day of the week, from a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week.html : @param $date the date . */ @org.junit.Test public void functxFunctxDayOfWeekAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The day of the week, from a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week.html : @param $date the date :)\n" + " declare function functx:day-of-week ( $date as xs:anyAtomicType? ) as xs:integer? { if (empty($date)) then () else xs:integer((xs:date($date) - xs:date('1901-01-06')) div xs:dayTimeDuration('P1D')) mod 7 } ;\n" + " (functx:day-of-week( xs:date('2004-11-04')), functx:day-of-week( xs:dateTime('2004-11-04T12:00:13')), functx:day-of-week('2004-11-04'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4 4 4") ); } /** * ~ : The name of the day of the week, from a date, in English : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week-name-en.html : @param $date the date ~ : The day of the week, from a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week.html : @param $date the date . */ @org.junit.Test public void functxFunctxDayOfWeekNameEn1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The name of the day of the week, from a date, in English : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week-name-en.html : @param $date the date :)\n" + " declare function functx:day-of-week-name-en ( $date as xs:anyAtomicType? ) as xs:string? { ('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday') [functx:day-of-week($date) + 1] } ;\n" + " (:~ : The day of the week, from a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week.html : @param $date the date :)\n" + " declare function functx:day-of-week ( $date as xs:anyAtomicType? ) as xs:integer? { if (empty($date)) then () else xs:integer((xs:date($date) - xs:date('1901-01-06')) div xs:dayTimeDuration('P1D')) mod 7 } ;\n" + " (functx:day-of-week-name-en( xs:date('2004-11-04')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Thursday") ); } /** * ~ : The name of the day of the week, from a date, in English : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week-name-en.html : @param $date the date ~ : The day of the week, from a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week.html : @param $date the date . */ @org.junit.Test public void functxFunctxDayOfWeekNameEn2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The name of the day of the week, from a date, in English : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week-name-en.html : @param $date the date :)\n" + " declare function functx:day-of-week-name-en ( $date as xs:anyAtomicType? ) as xs:string? { ('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday') [functx:day-of-week($date) + 1] } ;\n" + " (:~ : The day of the week, from a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week.html : @param $date the date :)\n" + " declare function functx:day-of-week ( $date as xs:anyAtomicType? ) as xs:integer? { if (empty($date)) then () else xs:integer((xs:date($date) - xs:date('1901-01-06')) div xs:dayTimeDuration('P1D')) mod 7 } ;\n" + " (functx:day-of-week-name-en('2004-11-04'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Thursday") ); } /** * ~ : The name of the day of the week, from a date, in English : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week-name-en.html : @param $date the date ~ : The day of the week, from a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week.html : @param $date the date . */ @org.junit.Test public void functxFunctxDayOfWeekNameEnAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The name of the day of the week, from a date, in English : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week-name-en.html : @param $date the date :)\n" + " declare function functx:day-of-week-name-en ( $date as xs:anyAtomicType? ) as xs:string? { ('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday') [functx:day-of-week($date) + 1] } ;\n" + " (:~ : The day of the week, from a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_day-of-week.html : @param $date the date :)\n" + " declare function functx:day-of-week ( $date as xs:anyAtomicType? ) as xs:integer? { if (empty($date)) then () else xs:integer((xs:date($date) - xs:date('1901-01-06')) div xs:dayTimeDuration('P1D')) mod 7 } ;\n" + " (functx:day-of-week-name-en( xs:date('2004-11-04')), functx:day-of-week-name-en('2004-11-04'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Thursday Thursday") ); } /** * ~ : Construct a dayTimeDuration from a number of days, hours, etc. : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_daytimeduration.html : @param $days the number of days : @param $hours the number of hours : @param $minutes the number of minutes : @param $seconds the number of seconds ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty . */ @org.junit.Test public void functxFunctxDayTimeDuration1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a dayTimeDuration from a number of days, hours, etc. : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_daytimeduration.html : @param $days the number of days : @param $hours the number of hours : @param $minutes the number of minutes : @param $seconds the number of seconds :)\n" + " declare function functx:dayTimeDuration ( $days as xs:decimal? , $hours as xs:decimal? , $minutes as xs:decimal? , $seconds as xs:decimal? ) as xs:dayTimeDuration { (xs:dayTimeDuration('P1D') * functx:if-empty($days,0)) + (xs:dayTimeDuration('PT1H') * functx:if-empty($hours,0)) + (xs:dayTimeDuration('PT1M') * functx:if-empty($minutes,0)) + (xs:dayTimeDuration('PT1S') * functx:if-empty($seconds,0)) } ;\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " (functx:dayTimeDuration(1,6,0,0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1DT6H") ); } /** * ~ : Construct a dayTimeDuration from a number of days, hours, etc. : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_daytimeduration.html : @param $days the number of days : @param $hours the number of hours : @param $minutes the number of minutes : @param $seconds the number of seconds ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty . */ @org.junit.Test public void functxFunctxDayTimeDuration2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a dayTimeDuration from a number of days, hours, etc. : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_daytimeduration.html : @param $days the number of days : @param $hours the number of hours : @param $minutes the number of minutes : @param $seconds the number of seconds :)\n" + " declare function functx:dayTimeDuration ( $days as xs:decimal? , $hours as xs:decimal? , $minutes as xs:decimal? , $seconds as xs:decimal? ) as xs:dayTimeDuration { (xs:dayTimeDuration('P1D') * functx:if-empty($days,0)) + (xs:dayTimeDuration('PT1H') * functx:if-empty($hours,0)) + (xs:dayTimeDuration('PT1M') * functx:if-empty($minutes,0)) + (xs:dayTimeDuration('PT1S') * functx:if-empty($seconds,0)) } ;\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " (functx:dayTimeDuration(2.5,0,0,0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P2DT12H") ); } /** * ~ : Construct a dayTimeDuration from a number of days, hours, etc. : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_daytimeduration.html : @param $days the number of days : @param $hours the number of hours : @param $minutes the number of minutes : @param $seconds the number of seconds ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty . */ @org.junit.Test public void functxFunctxDayTimeDuration3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a dayTimeDuration from a number of days, hours, etc. : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_daytimeduration.html : @param $days the number of days : @param $hours the number of hours : @param $minutes the number of minutes : @param $seconds the number of seconds :)\n" + " declare function functx:dayTimeDuration ( $days as xs:decimal? , $hours as xs:decimal? , $minutes as xs:decimal? , $seconds as xs:decimal? ) as xs:dayTimeDuration { (xs:dayTimeDuration('P1D') * functx:if-empty($days,0)) + (xs:dayTimeDuration('PT1H') * functx:if-empty($hours,0)) + (xs:dayTimeDuration('PT1M') * functx:if-empty($minutes,0)) + (xs:dayTimeDuration('PT1S') * functx:if-empty($seconds,0)) } ;\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " (functx:dayTimeDuration(1,(),3,5.6))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1DT3M5.6S") ); } /** * ~ : Construct a dayTimeDuration from a number of days, hours, etc. : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_daytimeduration.html : @param $days the number of days : @param $hours the number of hours : @param $minutes the number of minutes : @param $seconds the number of seconds ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty . */ @org.junit.Test public void functxFunctxDayTimeDuration4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a dayTimeDuration from a number of days, hours, etc. : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_daytimeduration.html : @param $days the number of days : @param $hours the number of hours : @param $minutes the number of minutes : @param $seconds the number of seconds :)\n" + " declare function functx:dayTimeDuration ( $days as xs:decimal? , $hours as xs:decimal? , $minutes as xs:decimal? , $seconds as xs:decimal? ) as xs:dayTimeDuration { (xs:dayTimeDuration('P1D') * functx:if-empty($days,0)) + (xs:dayTimeDuration('PT1H') * functx:if-empty($hours,0)) + (xs:dayTimeDuration('PT1M') * functx:if-empty($minutes,0)) + (xs:dayTimeDuration('PT1S') * functx:if-empty($seconds,0)) } ;\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " (functx:dayTimeDuration(0,0,5,0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT5M") ); } /** * ~ : Construct a dayTimeDuration from a number of days, hours, etc. : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_daytimeduration.html : @param $days the number of days : @param $hours the number of hours : @param $minutes the number of minutes : @param $seconds the number of seconds ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty . */ @org.junit.Test public void functxFunctxDayTimeDuration5() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a dayTimeDuration from a number of days, hours, etc. : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_daytimeduration.html : @param $days the number of days : @param $hours the number of hours : @param $minutes the number of minutes : @param $seconds the number of seconds :)\n" + " declare function functx:dayTimeDuration ( $days as xs:decimal? , $hours as xs:decimal? , $minutes as xs:decimal? , $seconds as xs:decimal? ) as xs:dayTimeDuration { (xs:dayTimeDuration('P1D') * functx:if-empty($days,0)) + (xs:dayTimeDuration('PT1H') * functx:if-empty($hours,0)) + (xs:dayTimeDuration('PT1M') * functx:if-empty($minutes,0)) + (xs:dayTimeDuration('PT1S') * functx:if-empty($seconds,0)) } ;\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " (functx:dayTimeDuration(0,0,0,0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * ~ : Construct a dayTimeDuration from a number of days, hours, etc. : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_daytimeduration.html : @param $days the number of days : @param $hours the number of hours : @param $minutes the number of minutes : @param $seconds the number of seconds ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty . */ @org.junit.Test public void functxFunctxDayTimeDurationAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a dayTimeDuration from a number of days, hours, etc. : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_daytimeduration.html : @param $days the number of days : @param $hours the number of hours : @param $minutes the number of minutes : @param $seconds the number of seconds :)\n" + " declare function functx:dayTimeDuration ( $days as xs:decimal? , $hours as xs:decimal? , $minutes as xs:decimal? , $seconds as xs:decimal? ) as xs:dayTimeDuration { (xs:dayTimeDuration('P1D') * functx:if-empty($days,0)) + (xs:dayTimeDuration('PT1H') * functx:if-empty($hours,0)) + (xs:dayTimeDuration('PT1M') * functx:if-empty($minutes,0)) + (xs:dayTimeDuration('PT1S') * functx:if-empty($seconds,0)) } ;\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " (functx:dayTimeDuration(1,6,0,0), functx:dayTimeDuration(2.5,0,0,0), functx:dayTimeDuration(1,(),3,5.6), functx:dayTimeDuration(0,0,5,0), functx:dayTimeDuration(0,0,0,0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1DT6H P2DT12H P1DT3M5.6S PT5M PT0S") ); } /** * ~ : Number of days in the month : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_days-in-month.html : @param $date the date ~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year . */ @org.junit.Test public void functxFunctxDaysInMonth1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Number of days in the month : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_days-in-month.html : @param $date the date :)\n" + " declare function functx:days-in-month ( $date as xs:anyAtomicType? ) as xs:integer? { if (month-from-date(xs:date($date)) = 2 and functx:is-leap-year($date)) then 29 else (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) [month-from-date(xs:date($date))] } ;\n" + " (:~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year :)\n" + " declare function functx:is-leap-year ( $date as xs:anyAtomicType? ) as xs:boolean { for $year in xs:integer(substring(string($date),1,4)) return ($year mod 4 = 0 and $year mod 100 != 0) or $year mod 400 = 0 } ;\n" + " (functx:days-in-month(xs:date('2004-01-23')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("31") ); } /** * ~ : Number of days in the month : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_days-in-month.html : @param $date the date ~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year . */ @org.junit.Test public void functxFunctxDaysInMonth2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Number of days in the month : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_days-in-month.html : @param $date the date :)\n" + " declare function functx:days-in-month ( $date as xs:anyAtomicType? ) as xs:integer? { if (month-from-date(xs:date($date)) = 2 and functx:is-leap-year($date)) then 29 else (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) [month-from-date(xs:date($date))] } ;\n" + " (:~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year :)\n" + " declare function functx:is-leap-year ( $date as xs:anyAtomicType? ) as xs:boolean { for $year in xs:integer(substring(string($date),1,4)) return ($year mod 4 = 0 and $year mod 100 != 0) or $year mod 400 = 0 } ;\n" + " (functx:days-in-month( xs:dateTime('2004-02-15T12:00:13')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("29") ); } /** * ~ : Number of days in the month : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_days-in-month.html : @param $date the date ~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year . */ @org.junit.Test public void functxFunctxDaysInMonth3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Number of days in the month : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_days-in-month.html : @param $date the date :)\n" + " declare function functx:days-in-month ( $date as xs:anyAtomicType? ) as xs:integer? { if (month-from-date(xs:date($date)) = 2 and functx:is-leap-year($date)) then 29 else (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) [month-from-date(xs:date($date))] } ;\n" + " (:~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year :)\n" + " declare function functx:is-leap-year ( $date as xs:anyAtomicType? ) as xs:boolean { for $year in xs:integer(substring(string($date),1,4)) return ($year mod 4 = 0 and $year mod 100 != 0) or $year mod 400 = 0 } ;\n" + " (functx:days-in-month('2005-02-15'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("28") ); } /** * ~ : Number of days in the month : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_days-in-month.html : @param $date the date ~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year . */ @org.junit.Test public void functxFunctxDaysInMonthAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Number of days in the month : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_days-in-month.html : @param $date the date :)\n" + " declare function functx:days-in-month ( $date as xs:anyAtomicType? ) as xs:integer? { if (month-from-date(xs:date($date)) = 2 and functx:is-leap-year($date)) then 29 else (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) [month-from-date(xs:date($date))] } ;\n" + " (:~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year :)\n" + " declare function functx:is-leap-year ( $date as xs:anyAtomicType? ) as xs:boolean { for $year in xs:integer(substring(string($date),1,4)) return ($year mod 4 = 0 and $year mod 100 != 0) or $year mod 400 = 0 } ;\n" + " (functx:days-in-month(xs:date('2004-01-23')), functx:days-in-month( xs:dateTime('2004-02-15T12:00:13')), functx:days-in-month('2005-02-15'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "31 29 28") ); } /** * ~ : Converts a string with format DDMMYYYY (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.1 : @see http://www.xqueryfunctions.com/xq/functx_ddmmyyyy-to-date.html : @param $dateString the DDMMYYYY string . */ @org.junit.Test public void functxFunctxDdmmyyyyToDate1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Converts a string with format DDMMYYYY (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.1 : @see http://www.xqueryfunctions.com/xq/functx_ddmmyyyy-to-date.html : @param $dateString the DDMMYYYY string :)\n" + " declare function functx:ddmmyyyy-to-date ( $dateString as xs:string? ) as xs:date? { if (empty($dateString)) then () else if (not(matches($dateString, '^\\D*(\\d{2})\\D*(\\d{2})\\D*(\\d{4})\\D*$'))) then error(xs:QName('functx:Invalid_Date_Format')) else xs:date(replace($dateString, '^\\D*(\\d{2})\\D*(\\d{2})\\D*(\\d{4})\\D*$', '$3-$2-$1')) } ;\n" + " (functx:ddmmyyyy-to-date('15-12-2004'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-12-15") ); } /** * ~ : Converts a string with format DDMMYYYY (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.1 : @see http://www.xqueryfunctions.com/xq/functx_ddmmyyyy-to-date.html : @param $dateString the DDMMYYYY string . */ @org.junit.Test public void functxFunctxDdmmyyyyToDate2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Converts a string with format DDMMYYYY (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.1 : @see http://www.xqueryfunctions.com/xq/functx_ddmmyyyy-to-date.html : @param $dateString the DDMMYYYY string :)\n" + " declare function functx:ddmmyyyy-to-date ( $dateString as xs:string? ) as xs:date? { if (empty($dateString)) then () else if (not(matches($dateString, '^\\D*(\\d{2})\\D*(\\d{2})\\D*(\\d{4})\\D*$'))) then error(xs:QName('functx:Invalid_Date_Format')) else xs:date(replace($dateString, '^\\D*(\\d{2})\\D*(\\d{2})\\D*(\\d{4})\\D*$', '$3-$2-$1')) } ;\n" + " (functx:ddmmyyyy-to-date('15122004'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-12-15") ); } /** * ~ : Converts a string with format DDMMYYYY (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.1 : @see http://www.xqueryfunctions.com/xq/functx_ddmmyyyy-to-date.html : @param $dateString the DDMMYYYY string . */ @org.junit.Test public void functxFunctxDdmmyyyyToDate3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Converts a string with format DDMMYYYY (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.1 : @see http://www.xqueryfunctions.com/xq/functx_ddmmyyyy-to-date.html : @param $dateString the DDMMYYYY string :)\n" + " declare function functx:ddmmyyyy-to-date ( $dateString as xs:string? ) as xs:date? { if (empty($dateString)) then () else if (not(matches($dateString, '^\\D*(\\d{2})\\D*(\\d{2})\\D*(\\d{4})\\D*$'))) then error(xs:QName('functx:Invalid_Date_Format')) else xs:date(replace($dateString, '^\\D*(\\d{2})\\D*(\\d{2})\\D*(\\d{4})\\D*$', '$3-$2-$1')) } ;\n" + " (functx:ddmmyyyy-to-date('15/12/2004'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-12-15") ); } /** * ~ : Converts a string with format DDMMYYYY (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.1 : @see http://www.xqueryfunctions.com/xq/functx_ddmmyyyy-to-date.html : @param $dateString the DDMMYYYY string . */ @org.junit.Test public void functxFunctxDdmmyyyyToDateAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Converts a string with format DDMMYYYY (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.1 : @see http://www.xqueryfunctions.com/xq/functx_ddmmyyyy-to-date.html : @param $dateString the DDMMYYYY string :)\n" + " declare function functx:ddmmyyyy-to-date ( $dateString as xs:string? ) as xs:date? { if (empty($dateString)) then () else if (not(matches($dateString, '^\\D*(\\d{2})\\D*(\\d{2})\\D*(\\d{4})\\D*$'))) then error(xs:QName('functx:Invalid_Date_Format')) else xs:date(replace($dateString, '^\\D*(\\d{2})\\D*(\\d{2})\\D*(\\d{4})\\D*$', '$3-$2-$1')) } ;\n" + " (functx:ddmmyyyy-to-date('15-12-2004'), functx:ddmmyyyy-to-date('15122004'), functx:ddmmyyyy-to-date('15/12/2004'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-12-15 2004-12-15 2004-12-15") ); } /** * ~ : The depth (level) of a node in an XML tree : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_depth-of-node.html : @param $node the node to check . */ @org.junit.Test public void functxFunctxDepthOfNode1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The depth (level) of a node in an XML tree : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_depth-of-node.html : @param $node the node to check :)\n" + " declare function functx:depth-of-node ( $node as node()? ) as xs:integer { count($node/ancestor-or-self::node()) } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:depth-of-node($in-xml))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * ~ : The depth (level) of a node in an XML tree : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_depth-of-node.html : @param $node the node to check . */ @org.junit.Test public void functxFunctxDepthOfNode2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The depth (level) of a node in an XML tree : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_depth-of-node.html : @param $node the node to check :)\n" + " declare function functx:depth-of-node ( $node as node()? ) as xs:integer { count($node/ancestor-or-self::node()) } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:depth-of-node($in-xml/author[1]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * ~ : The depth (level) of a node in an XML tree : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_depth-of-node.html : @param $node the node to check . */ @org.junit.Test public void functxFunctxDepthOfNode3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The depth (level) of a node in an XML tree : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_depth-of-node.html : @param $node the node to check :)\n" + " declare function functx:depth-of-node ( $node as node()? ) as xs:integer { count($node/ancestor-or-self::node()) } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:depth-of-node( $in-xml/author[1]/fName/text()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("4") ); } /** * ~ : The depth (level) of a node in an XML tree : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_depth-of-node.html : @param $node the node to check . */ @org.junit.Test public void functxFunctxDepthOfNodeAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The depth (level) of a node in an XML tree : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_depth-of-node.html : @param $node the node to check :)\n" + " declare function functx:depth-of-node ( $node as node()? ) as xs:integer { count($node/ancestor-or-self::node()) } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:depth-of-node($in-xml), functx:depth-of-node($in-xml/author[1]), functx:depth-of-node( $in-xml/author[1]/fName/text()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 4") ); } /** * ~ : The distinct names of all attributes in an XML fragment : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-attribute-names.html : @param $nodes the root to start from . */ @org.junit.Test public void functxFunctxDistinctAttributeNames1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The distinct names of all attributes in an XML fragment : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-attribute-names.html : @param $nodes the root to start from :)\n" + " declare function functx:distinct-attribute-names ( $nodes as node()* ) as xs:string* { distinct-values($nodes//@*/name(.)) } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:distinct-attribute-names($in-xml))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a1 a2 a3") ); } /** * ~ : The XML nodes with distinct values, taking into account attributes and descendants : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-deep.html : @param $nodes the sequence of nodes to test ~ : Whether an XML node is in a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence-deep-equal.html : @param $node the node to test : @param $seq the sequence of nodes to search . */ @org.junit.Test public void functxFunctxDistinctDeep1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The XML nodes with distinct values, taking into account attributes and descendants : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-deep.html : @param $nodes the sequence of nodes to test :)\n" + " declare function functx:distinct-deep ( $nodes as node()* ) as node()* { for $seq in (1 to count($nodes)) return $nodes[$seq][not(functx:is-node-in-sequence-deep-equal( .,$nodes[position() < $seq]))] } ;\n" + " (:~ : Whether an XML node is in a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence-deep-equal.html : @param $node the node to test : @param $seq the sequence of nodes to search :)\n" + " declare function functx:is-node-in-sequence-deep-equal ( $node as node()? , $seq as node()* ) as xs:boolean { some $nodeInSeq in $seq satisfies deep-equal($nodeInSeq,$node) } ;\n" + " let $in-xml := Kate Jones Kate Jones Kate Doe return (functx:distinct-deep($in-xml//author))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("KateJonesKateDoe", false) ); } /** * ~ : The XML nodes with distinct values, taking into account attributes and descendants : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-deep.html : @param $nodes the sequence of nodes to test ~ : Whether an XML node is in a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence-deep-equal.html : @param $node the node to test : @param $seq the sequence of nodes to search . */ @org.junit.Test public void functxFunctxDistinctDeep2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The XML nodes with distinct values, taking into account attributes and descendants : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-deep.html : @param $nodes the sequence of nodes to test :)\n" + " declare function functx:distinct-deep ( $nodes as node()* ) as node()* { for $seq in (1 to count($nodes)) return $nodes[$seq][not(functx:is-node-in-sequence-deep-equal( .,$nodes[position() < $seq]))] } ;\n" + " (:~ : Whether an XML node is in a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence-deep-equal.html : @param $node the node to test : @param $seq the sequence of nodes to search :)\n" + " declare function functx:is-node-in-sequence-deep-equal ( $node as node()? , $seq as node()* ) as xs:boolean { some $nodeInSeq in $seq satisfies deep-equal($nodeInSeq,$node) } ;\n" + " let $in-xml := Kate Jones Kate Jones Kate Doe return (functx:distinct-deep($in-xml//lName))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("JonesDoe", false) ); } /** * ~ : The XML nodes with distinct values, taking into account attributes and descendants : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-deep.html : @param $nodes the sequence of nodes to test ~ : Whether an XML node is in a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence-deep-equal.html : @param $node the node to test : @param $seq the sequence of nodes to search . */ @org.junit.Test public void functxFunctxDistinctDeep3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The XML nodes with distinct values, taking into account attributes and descendants : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-deep.html : @param $nodes the sequence of nodes to test :)\n" + " declare function functx:distinct-deep ( $nodes as node()* ) as node()* { for $seq in (1 to count($nodes)) return $nodes[$seq][not(functx:is-node-in-sequence-deep-equal( .,$nodes[position() < $seq]))] } ;\n" + " (:~ : Whether an XML node is in a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence-deep-equal.html : @param $node the node to test : @param $seq the sequence of nodes to search :)\n" + " declare function functx:is-node-in-sequence-deep-equal ( $node as node()? , $seq as node()* ) as xs:boolean { some $nodeInSeq in $seq satisfies deep-equal($nodeInSeq,$node) } ;\n" + " let $in-xml := Kate Jones Kate Jones Kate Doe return (functx:distinct-deep($in-xml//fName))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Kate", false) ); } /** * ~ : The XML nodes with distinct values, taking into account attributes and descendants : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-deep.html : @param $nodes the sequence of nodes to test ~ : Whether an XML node is in a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence-deep-equal.html : @param $node the node to test : @param $seq the sequence of nodes to search . */ @org.junit.Test public void functxFunctxDistinctDeepAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The XML nodes with distinct values, taking into account attributes and descendants : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-deep.html : @param $nodes the sequence of nodes to test :)\n" + " declare function functx:distinct-deep ( $nodes as node()* ) as node()* { for $seq in (1 to count($nodes)) return $nodes[$seq][not(functx:is-node-in-sequence-deep-equal( .,$nodes[position() < $seq]))] } ;\n" + " (:~ : Whether an XML node is in a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence-deep-equal.html : @param $node the node to test : @param $seq the sequence of nodes to search :)\n" + " declare function functx:is-node-in-sequence-deep-equal ( $node as node()? , $seq as node()* ) as xs:boolean { some $nodeInSeq in $seq satisfies deep-equal($nodeInSeq,$node) } ;\n" + " let $in-xml := Kate Jones Kate Jones Kate Doe return (functx:distinct-deep($in-xml//author), functx:distinct-deep($in-xml//lName), functx:distinct-deep($in-xml//fName))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("KateJonesKateDoeJonesDoeKate", false) ); } /** * ~ : The distinct names of all elements in an XML fragment : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-element-names.html : @param $nodes the root(s) to start from ~ : A path to an XML node (or sequence of nodes) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_path-to-node.html : @param $nodes the node sequence . */ @org.junit.Test public void functxFunctxDistinctElementNames1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The distinct names of all elements in an XML fragment : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-element-names.html : @param $nodes the root(s) to start from :)\n" + " declare function functx:distinct-element-names ( $nodes as node()* ) as xs:string* { distinct-values($nodes/descendant-or-self::*/name(.)) } ;\n" + " (:~ : A path to an XML node (or sequence of nodes) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_path-to-node.html : @param $nodes the node sequence :)\n" + " declare function functx:path-to-node ( $nodes as node()* ) as xs:string* { $nodes/string-join(ancestor-or-self::*/name(.), '/') } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:distinct-element-names($in-xml))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "authors author fName lName") ); } /** * ~ : The distinct names of all elements in an XML fragment : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-element-names.html : @param $nodes the root(s) to start from ~ : A path to an XML node (or sequence of nodes) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_path-to-node.html : @param $nodes the node sequence . */ @org.junit.Test public void functxFunctxDistinctElementNames2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The distinct names of all elements in an XML fragment : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-element-names.html : @param $nodes the root(s) to start from :)\n" + " declare function functx:distinct-element-names ( $nodes as node()* ) as xs:string* { distinct-values($nodes/descendant-or-self::*/name(.)) } ;\n" + " (:~ : A path to an XML node (or sequence of nodes) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_path-to-node.html : @param $nodes the node sequence :)\n" + " declare function functx:path-to-node ( $nodes as node()* ) as xs:string* { $nodes/string-join(ancestor-or-self::*/name(.), '/') } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:distinct-element-names( $in-xml/author[1]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "author fName lName") ); } /** * ~ : The distinct names of all elements in an XML fragment : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-element-names.html : @param $nodes the root(s) to start from ~ : A path to an XML node (or sequence of nodes) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_path-to-node.html : @param $nodes the node sequence . */ @org.junit.Test public void functxFunctxDistinctElementNamesAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The distinct names of all elements in an XML fragment : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-element-names.html : @param $nodes the root(s) to start from :)\n" + " declare function functx:distinct-element-names ( $nodes as node()* ) as xs:string* { distinct-values($nodes/descendant-or-self::*/name(.)) } ;\n" + " (:~ : A path to an XML node (or sequence of nodes) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_path-to-node.html : @param $nodes the node sequence :)\n" + " declare function functx:path-to-node ( $nodes as node()* ) as xs:string* { $nodes/string-join(ancestor-or-self::*/name(.), '/') } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:distinct-element-names($in-xml), functx:distinct-element-names( $in-xml/author[1]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "authors author fName lName author fName lName") ); } /** * ~ : The distinct paths of all descendant elements in an XML fragment : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-element-paths.html : @param $nodes the root(s) to start from ~ : A path to an XML node (or sequence of nodes) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_path-to-node.html : @param $nodes the node sequence . */ @org.junit.Test public void functxFunctxDistinctElementPaths1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The distinct paths of all descendant elements in an XML fragment : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-element-paths.html : @param $nodes the root(s) to start from :)\n" + " declare function functx:distinct-element-paths ( $nodes as node()* ) as xs:string* { distinct-values(functx:path-to-node($nodes/descendant-or-self::*)) } ;\n" + " (:~ : A path to an XML node (or sequence of nodes) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_path-to-node.html : @param $nodes the node sequence :)\n" + " declare function functx:path-to-node ( $nodes as node()* ) as xs:string* { $nodes/string-join(ancestor-or-self::*/name(.), '/') } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:distinct-element-paths( $in-xml))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "authors authors/author authors/author/fName authors/author/lName") ); } /** * ~ : The distinct paths of all descendant elements in an XML fragment : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-element-paths.html : @param $nodes the root(s) to start from ~ : A path to an XML node (or sequence of nodes) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_path-to-node.html : @param $nodes the node sequence . */ @org.junit.Test public void functxFunctxDistinctElementPaths2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The distinct paths of all descendant elements in an XML fragment : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-element-paths.html : @param $nodes the root(s) to start from :)\n" + " declare function functx:distinct-element-paths ( $nodes as node()* ) as xs:string* { distinct-values(functx:path-to-node($nodes/descendant-or-self::*)) } ;\n" + " (:~ : A path to an XML node (or sequence of nodes) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_path-to-node.html : @param $nodes the node sequence :)\n" + " declare function functx:path-to-node ( $nodes as node()* ) as xs:string* { $nodes/string-join(ancestor-or-self::*/name(.), '/') } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:distinct-element-paths( $in-xml/author[1]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "authors/author authors/author/fName authors/author/lName") ); } /** * ~ : The distinct paths of all descendant elements in an XML fragment : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-element-paths.html : @param $nodes the root(s) to start from ~ : A path to an XML node (or sequence of nodes) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_path-to-node.html : @param $nodes the node sequence . */ @org.junit.Test public void functxFunctxDistinctElementPathsAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The distinct paths of all descendant elements in an XML fragment : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-element-paths.html : @param $nodes the root(s) to start from :)\n" + " declare function functx:distinct-element-paths ( $nodes as node()* ) as xs:string* { distinct-values(functx:path-to-node($nodes/descendant-or-self::*)) } ;\n" + " (:~ : A path to an XML node (or sequence of nodes) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_path-to-node.html : @param $nodes the node sequence :)\n" + " declare function functx:path-to-node ( $nodes as node()* ) as xs:string* { $nodes/string-join(ancestor-or-self::*/name(.), '/') } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:distinct-element-paths( $in-xml), functx:distinct-element-paths( $in-xml/author[1]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "authors authors/author authors/author/fName authors/author/lName authors/author authors/author/fName authors/author/lName") ); } /** * ~ : The distinct XML nodes in a sequence (by node identity) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-nodes.html : @param $nodes the node sequence ~ : Whether an XML node is in a sequence, based on node identity : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence.html : @param $node the node to test : @param $seq the sequence of nodes to search . */ @org.junit.Test public void functxFunctxDistinctNodes1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The distinct XML nodes in a sequence (by node identity) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-nodes.html : @param $nodes the node sequence :)\n" + " declare function functx:distinct-nodes ( $nodes as node()* ) as node()* { for $seq in (1 to count($nodes)) return $nodes[$seq][not(functx:is-node-in-sequence( .,$nodes[position() < $seq]))] } ;\n" + " (:~ : Whether an XML node is in a sequence, based on node identity : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence.html : @param $node the node to test : @param $seq the sequence of nodes to search :)\n" + " declare function functx:is-node-in-sequence ( $node as node()? , $seq as node()* ) as xs:boolean { some $nodeInSeq in $seq satisfies $nodeInSeq is $node } ;\n" + " let $in-xml := 1 2 3 3 return (functx:distinct-nodes( ($in-xml/child, $in-xml/*) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1233", false) ); } /** * ~ : The distinct XML nodes in a sequence (by node identity) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-nodes.html : @param $nodes the node sequence ~ : Whether an XML node is in a sequence, based on node identity : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence.html : @param $node the node to test : @param $seq the sequence of nodes to search . */ @org.junit.Test public void functxFunctxDistinctNodes2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The distinct XML nodes in a sequence (by node identity) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-nodes.html : @param $nodes the node sequence :)\n" + " declare function functx:distinct-nodes ( $nodes as node()* ) as node()* { for $seq in (1 to count($nodes)) return $nodes[$seq][not(functx:is-node-in-sequence( .,$nodes[position() < $seq]))] } ;\n" + " (:~ : Whether an XML node is in a sequence, based on node identity : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence.html : @param $node the node to test : @param $seq the sequence of nodes to search :)\n" + " declare function functx:is-node-in-sequence ( $node as node()? , $seq as node()* ) as xs:boolean { some $nodeInSeq in $seq satisfies $nodeInSeq is $node } ;\n" + " let $in-xml := 1 2 3 3 return (functx:distinct-nodes( ($in-xml/child[3], $in-xml/*) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("3123", false) ); } /** * ~ : The distinct XML nodes in a sequence (by node identity) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-nodes.html : @param $nodes the node sequence ~ : Whether an XML node is in a sequence, based on node identity : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence.html : @param $node the node to test : @param $seq the sequence of nodes to search . */ @org.junit.Test public void functxFunctxDistinctNodesAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The distinct XML nodes in a sequence (by node identity) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_distinct-nodes.html : @param $nodes the node sequence :)\n" + " declare function functx:distinct-nodes ( $nodes as node()* ) as node()* { for $seq in (1 to count($nodes)) return $nodes[$seq][not(functx:is-node-in-sequence( .,$nodes[position() < $seq]))] } ;\n" + " (:~ : Whether an XML node is in a sequence, based on node identity : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence.html : @param $node the node to test : @param $seq the sequence of nodes to search :)\n" + " declare function functx:is-node-in-sequence ( $node as node()? , $seq as node()* ) as xs:boolean { some $nodeInSeq in $seq satisfies $nodeInSeq is $node } ;\n" + " let $in-xml := 1 2 3 3 return (functx:distinct-nodes( ($in-xml/child, $in-xml/*) ), functx:distinct-nodes( ($in-xml/child[3], $in-xml/*) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("12333123", false) ); } /** * ~ : Converts a timezone like "-05:00" or "Z" into xs:dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_duration-from-timezone.html : @param $timezone the time zone, in (+|-)HH:MM format . */ @org.junit.Test public void functxFunctxDurationFromTimezone1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Converts a timezone like \"-05:00\" or \"Z\" into xs:dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_duration-from-timezone.html : @param $timezone the time zone, in (+|-)HH:MM format :)\n" + " declare function functx:duration-from-timezone ( $timezone as xs:string ) as xs:dayTimeDuration { xs:dayTimeDuration( if (not(matches($timezone,'Z|[\\+\\-]\\d{2}:\\d{2}'))) then error(xs:QName('functx:Invalid_Timezone_Value')) else if ($timezone = 'Z') then 'PT0S' else replace($timezone,'\\+?(\\d{2}):\\d{2}','PT$1H') ) } ;\n" + " (functx:duration-from-timezone('Z'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * ~ : Converts a timezone like "-05:00" or "Z" into xs:dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_duration-from-timezone.html : @param $timezone the time zone, in (+|-)HH:MM format . */ @org.junit.Test public void functxFunctxDurationFromTimezone2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Converts a timezone like \"-05:00\" or \"Z\" into xs:dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_duration-from-timezone.html : @param $timezone the time zone, in (+|-)HH:MM format :)\n" + " declare function functx:duration-from-timezone ( $timezone as xs:string ) as xs:dayTimeDuration { xs:dayTimeDuration( if (not(matches($timezone,'Z|[\\+\\-]\\d{2}:\\d{2}'))) then error(xs:QName('functx:Invalid_Timezone_Value')) else if ($timezone = 'Z') then 'PT0S' else replace($timezone,'\\+?(\\d{2}):\\d{2}','PT$1H') ) } ;\n" + " (functx:duration-from-timezone('-05:00'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-PT5H") ); } /** * ~ : Converts a timezone like "-05:00" or "Z" into xs:dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_duration-from-timezone.html : @param $timezone the time zone, in (+|-)HH:MM format . */ @org.junit.Test public void functxFunctxDurationFromTimezone3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Converts a timezone like \"-05:00\" or \"Z\" into xs:dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_duration-from-timezone.html : @param $timezone the time zone, in (+|-)HH:MM format :)\n" + " declare function functx:duration-from-timezone ( $timezone as xs:string ) as xs:dayTimeDuration { xs:dayTimeDuration( if (not(matches($timezone,'Z|[\\+\\-]\\d{2}:\\d{2}'))) then error(xs:QName('functx:Invalid_Timezone_Value')) else if ($timezone = 'Z') then 'PT0S' else replace($timezone,'\\+?(\\d{2}):\\d{2}','PT$1H') ) } ;\n" + " (functx:duration-from-timezone('+09:00'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT9H") ); } /** * ~ : Converts a timezone like "-05:00" or "Z" into xs:dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_duration-from-timezone.html : @param $timezone the time zone, in (+|-)HH:MM format . */ @org.junit.Test public void functxFunctxDurationFromTimezoneAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Converts a timezone like \"-05:00\" or \"Z\" into xs:dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_duration-from-timezone.html : @param $timezone the time zone, in (+|-)HH:MM format :)\n" + " declare function functx:duration-from-timezone ( $timezone as xs:string ) as xs:dayTimeDuration { xs:dayTimeDuration( if (not(matches($timezone,'Z|[\\+\\-]\\d{2}:\\d{2}'))) then error(xs:QName('functx:Invalid_Timezone_Value')) else if ($timezone = 'Z') then 'PT0S' else replace($timezone,'\\+?(\\d{2}):\\d{2}','PT$1H') ) } ;\n" + " (functx:duration-from-timezone('Z'), functx:duration-from-timezone('-05:00'), functx:duration-from-timezone('+09:00'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S -PT5H PT9H") ); } /** * ~ : Dynamically evaluates a simple XPath path : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_dynamic-path.html : @param $parent the root to start from : @param $path the path expression ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter ~ : Performs substring-before, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxDynamicPath1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Dynamically evaluates a simple XPath path : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_dynamic-path.html : @param $parent the root to start from : @param $path the path expression :)\n" + " declare function functx:dynamic-path ( $parent as node() , $path as xs:string ) as item()* { let $nextStep := functx:substring-before-if-contains($path,'/') let $restOfSteps := substring-after($path,'/') for $child in ($parent/*[functx:name-test(name(),$nextStep)], $parent/@*[functx:name-test(name(), substring-after($nextStep,'@'))]) return if ($restOfSteps) then functx:dynamic-path($child, $restOfSteps) else $child } ;\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " (:~ : Performs substring-before, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-before-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-before($arg,$delim) else $arg } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:dynamic-path( $in-xml,'author/first'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("KateJohn", false) ); } /** * ~ : Dynamically evaluates a simple XPath path : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_dynamic-path.html : @param $parent the root to start from : @param $path the path expression ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter ~ : Performs substring-before, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxDynamicPath2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Dynamically evaluates a simple XPath path : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_dynamic-path.html : @param $parent the root to start from : @param $path the path expression :)\n" + " declare function functx:dynamic-path ( $parent as node() , $path as xs:string ) as item()* { let $nextStep := functx:substring-before-if-contains($path,'/') let $restOfSteps := substring-after($path,'/') for $child in ($parent/*[functx:name-test(name(),$nextStep)], $parent/@*[functx:name-test(name(), substring-after($nextStep,'@'))]) return if ($restOfSteps) then functx:dynamic-path($child, $restOfSteps) else $child } ;\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " (:~ : Performs substring-before, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-before-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-before($arg,$delim) else $arg } ;\n" + " let $in-xml := Kate Jones John Doe return (name(functx:dynamic-path( $in-xml,'author/@test')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "test") ); } /** * ~ : Dynamically evaluates a simple XPath path : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_dynamic-path.html : @param $parent the root to start from : @param $path the path expression ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter ~ : Performs substring-before, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxDynamicPath3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Dynamically evaluates a simple XPath path : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_dynamic-path.html : @param $parent the root to start from : @param $path the path expression :)\n" + " declare function functx:dynamic-path ( $parent as node() , $path as xs:string ) as item()* { let $nextStep := functx:substring-before-if-contains($path,'/') let $restOfSteps := substring-after($path,'/') for $child in ($parent/*[functx:name-test(name(),$nextStep)], $parent/@*[functx:name-test(name(), substring-after($nextStep,'@'))]) return if ($restOfSteps) then functx:dynamic-path($child, $restOfSteps) else $child } ;\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " (:~ : Performs substring-before, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-before-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-before($arg,$delim) else $arg } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:dynamic-path( $in-xml,'author'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("KateJonesJohnDoe", false) ); } /** * ~ : Dynamically evaluates a simple XPath path : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_dynamic-path.html : @param $parent the root to start from : @param $path the path expression ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter ~ : Performs substring-before, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxDynamicPath4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Dynamically evaluates a simple XPath path : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_dynamic-path.html : @param $parent the root to start from : @param $path the path expression :)\n" + " declare function functx:dynamic-path ( $parent as node() , $path as xs:string ) as item()* { let $nextStep := functx:substring-before-if-contains($path,'/') let $restOfSteps := substring-after($path,'/') for $child in ($parent/*[functx:name-test(name(),$nextStep)], $parent/@*[functx:name-test(name(), substring-after($nextStep,'@'))]) return if ($restOfSteps) then functx:dynamic-path($child, $restOfSteps) else $child } ;\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " (:~ : Performs substring-before, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-before-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-before($arg,$delim) else $arg } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:dynamic-path( $in-xml,'author/a:last'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Doe", false) ); } /** * ~ : Dynamically evaluates a simple XPath path : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_dynamic-path.html : @param $parent the root to start from : @param $path the path expression ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter ~ : Performs substring-before, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxDynamicPathAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Dynamically evaluates a simple XPath path : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_dynamic-path.html : @param $parent the root to start from : @param $path the path expression :)\n" + " declare function functx:dynamic-path ( $parent as node() , $path as xs:string ) as item()* { let $nextStep := functx:substring-before-if-contains($path,'/') let $restOfSteps := substring-after($path,'/') for $child in ($parent/*[functx:name-test(name(),$nextStep)], $parent/@*[functx:name-test(name(), substring-after($nextStep,'@'))]) return if ($restOfSteps) then functx:dynamic-path($child, $restOfSteps) else $child } ;\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " (:~ : Performs substring-before, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-before-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-before($arg,$delim) else $arg } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:dynamic-path( $in-xml,'author/first'), name(functx:dynamic-path( $in-xml,'author/@test')), functx:dynamic-path( $in-xml,'author'), functx:dynamic-path( $in-xml,'author/a:last'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("KateJohntestKateJonesJohnDoeDoe", false) ); } /** * ~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape . */ @org.junit.Test public void functxFunctxEscapeForRegex1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape :)\n" + " declare function functx:escape-for-regex ( $arg as xs:string? ) as xs:string { replace($arg, '(\\.|\\[|\\]|\\\\|\\||\\-|\\^|\\$|\\?|\\*|\\+|\\{|\\}|\\(|\\))','\\\\$1') } ;\n" + " (functx:escape-for-regex('5.55'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5\\.55") ); } /** * ~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape . */ @org.junit.Test public void functxFunctxEscapeForRegex2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape :)\n" + " declare function functx:escape-for-regex ( $arg as xs:string? ) as xs:string { replace($arg, '(\\.|\\[|\\]|\\\\|\\||\\-|\\^|\\$|\\?|\\*|\\+|\\{|\\}|\\(|\\))','\\\\$1') } ;\n" + " (functx:escape-for-regex('[abc]'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "\\[abc\\]") ); } /** * ~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape . */ @org.junit.Test public void functxFunctxEscapeForRegexAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape :)\n" + " declare function functx:escape-for-regex ( $arg as xs:string? ) as xs:string { replace($arg, '(\\.|\\[|\\]|\\\\|\\||\\-|\\^|\\$|\\?|\\*|\\+|\\{|\\}|\\(|\\))','\\\\$1') } ;\n" + " (functx:escape-for-regex('5.55'), functx:escape-for-regex('[abc]'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5\\.55 \\[abc\\]") ); } /** * ~ : Whether one (and only one) of two boolean values is true : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_exclusive-or.html : @param $arg1 the first boolean value : @param $arg2 the second boolean value . */ @org.junit.Test public void functxFunctxExclusiveOr1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether one (and only one) of two boolean values is true : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_exclusive-or.html : @param $arg1 the first boolean value : @param $arg2 the second boolean value :)\n" + " declare function functx:exclusive-or ( $arg1 as xs:boolean? , $arg2 as xs:boolean? ) as xs:boolean? { $arg1 != $arg2 } ;\n" + " (functx:exclusive-or(true(),false()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether one (and only one) of two boolean values is true : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_exclusive-or.html : @param $arg1 the first boolean value : @param $arg2 the second boolean value . */ @org.junit.Test public void functxFunctxExclusiveOr2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether one (and only one) of two boolean values is true : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_exclusive-or.html : @param $arg1 the first boolean value : @param $arg2 the second boolean value :)\n" + " declare function functx:exclusive-or ( $arg1 as xs:boolean? , $arg2 as xs:boolean? ) as xs:boolean? { $arg1 != $arg2 } ;\n" + " (functx:exclusive-or(true(),true()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether one (and only one) of two boolean values is true : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_exclusive-or.html : @param $arg1 the first boolean value : @param $arg2 the second boolean value . */ @org.junit.Test public void functxFunctxExclusiveOr3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether one (and only one) of two boolean values is true : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_exclusive-or.html : @param $arg1 the first boolean value : @param $arg2 the second boolean value :)\n" + " declare function functx:exclusive-or ( $arg1 as xs:boolean? , $arg2 as xs:boolean? ) as xs:boolean? { $arg1 != $arg2 } ;\n" + " (functx:exclusive-or(4 >\n" + " 3,1 >\n" + " 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether one (and only one) of two boolean values is true : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_exclusive-or.html : @param $arg1 the first boolean value : @param $arg2 the second boolean value . */ @org.junit.Test public void functxFunctxExclusiveOrAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether one (and only one) of two boolean values is true : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_exclusive-or.html : @param $arg1 the first boolean value : @param $arg2 the second boolean value :)\n" + " declare function functx:exclusive-or ( $arg1 as xs:boolean? , $arg2 as xs:boolean? ) as xs:boolean? { $arg1 != $arg2 } ;\n" + " (functx:exclusive-or(true(),false()), functx:exclusive-or(true(),true()), functx:exclusive-or(4 >\n" + " 3,1 >\n" + " 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true false true") ); } /** * ~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day ~ : The first day of the month of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-day-of-month.html : @param $date the date ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxFirstDayOfMonth1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day :)\n" + " declare function functx:date ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType ) as xs:date { xs:date( concat( functx:pad-integer-to-length(xs:integer($year),4),'-', functx:pad-integer-to-length(xs:integer($month),2),'-', functx:pad-integer-to-length(xs:integer($day),2))) } ;\n" + " (:~ : The first day of the month of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-day-of-month.html : @param $date the date :)\n" + " declare function functx:first-day-of-month ( $date as xs:anyAtomicType? ) as xs:date? { functx:date(year-from-date(xs:date($date)), month-from-date(xs:date($date)), 1) } ;\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:first-day-of-month( xs:date('2004-01-23')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-01-01") ); } /** * ~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day ~ : The first day of the month of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-day-of-month.html : @param $date the date ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxFirstDayOfMonth2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day :)\n" + " declare function functx:date ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType ) as xs:date { xs:date( concat( functx:pad-integer-to-length(xs:integer($year),4),'-', functx:pad-integer-to-length(xs:integer($month),2),'-', functx:pad-integer-to-length(xs:integer($day),2))) } ;\n" + " (:~ : The first day of the month of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-day-of-month.html : @param $date the date :)\n" + " declare function functx:first-day-of-month ( $date as xs:anyAtomicType? ) as xs:date? { functx:date(year-from-date(xs:date($date)), month-from-date(xs:date($date)), 1) } ;\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:first-day-of-month( xs:dateTime('2004-01-23T12:00:13')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-01-01") ); } /** * ~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day ~ : The first day of the month of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-day-of-month.html : @param $date the date ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxFirstDayOfMonth3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day :)\n" + " declare function functx:date ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType ) as xs:date { xs:date( concat( functx:pad-integer-to-length(xs:integer($year),4),'-', functx:pad-integer-to-length(xs:integer($month),2),'-', functx:pad-integer-to-length(xs:integer($day),2))) } ;\n" + " (:~ : The first day of the month of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-day-of-month.html : @param $date the date :)\n" + " declare function functx:first-day-of-month ( $date as xs:anyAtomicType? ) as xs:date? { functx:date(year-from-date(xs:date($date)), month-from-date(xs:date($date)), 1) } ;\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:first-day-of-month('2004-03-23'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-03-01") ); } /** * ~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day ~ : The first day of the month of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-day-of-month.html : @param $date the date ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxFirstDayOfMonthAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day :)\n" + " declare function functx:date ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType ) as xs:date { xs:date( concat( functx:pad-integer-to-length(xs:integer($year),4),'-', functx:pad-integer-to-length(xs:integer($month),2),'-', functx:pad-integer-to-length(xs:integer($day),2))) } ;\n" + " (:~ : The first day of the month of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-day-of-month.html : @param $date the date :)\n" + " declare function functx:first-day-of-month ( $date as xs:anyAtomicType? ) as xs:date? { functx:date(year-from-date(xs:date($date)), month-from-date(xs:date($date)), 1) } ;\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:first-day-of-month( xs:date('2004-01-23')), functx:first-day-of-month( xs:dateTime('2004-01-23T12:00:13')), functx:first-day-of-month('2004-03-23'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-01-01 2004-01-01 2004-03-01") ); } /** * ~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day ~ : The first day of the year of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-day-of-year.html : @param $date the date ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxFirstDayOfYear1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day :)\n" + " declare function functx:date ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType ) as xs:date { xs:date( concat( functx:pad-integer-to-length(xs:integer($year),4),'-', functx:pad-integer-to-length(xs:integer($month),2),'-', functx:pad-integer-to-length(xs:integer($day),2))) } ;\n" + " (:~ : The first day of the year of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-day-of-year.html : @param $date the date :)\n" + " declare function functx:first-day-of-year ( $date as xs:anyAtomicType? ) as xs:date? { functx:date(year-from-date(xs:date($date)), 1, 1) } ;\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:first-day-of-year(xs:date('2004-01-23')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-01-01") ); } /** * ~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day ~ : The first day of the year of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-day-of-year.html : @param $date the date ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxFirstDayOfYear2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day :)\n" + " declare function functx:date ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType ) as xs:date { xs:date( concat( functx:pad-integer-to-length(xs:integer($year),4),'-', functx:pad-integer-to-length(xs:integer($month),2),'-', functx:pad-integer-to-length(xs:integer($day),2))) } ;\n" + " (:~ : The first day of the year of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-day-of-year.html : @param $date the date :)\n" + " declare function functx:first-day-of-year ( $date as xs:anyAtomicType? ) as xs:date? { functx:date(year-from-date(xs:date($date)), 1, 1) } ;\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:first-day-of-year( xs:dateTime('2004-01-23T12:00:13')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-01-01") ); } /** * ~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day ~ : The first day of the year of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-day-of-year.html : @param $date the date ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxFirstDayOfYear3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day :)\n" + " declare function functx:date ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType ) as xs:date { xs:date( concat( functx:pad-integer-to-length(xs:integer($year),4),'-', functx:pad-integer-to-length(xs:integer($month),2),'-', functx:pad-integer-to-length(xs:integer($day),2))) } ;\n" + " (:~ : The first day of the year of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-day-of-year.html : @param $date the date :)\n" + " declare function functx:first-day-of-year ( $date as xs:anyAtomicType? ) as xs:date? { functx:date(year-from-date(xs:date($date)), 1, 1) } ;\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:first-day-of-year('2004-03-23'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-01-01") ); } /** * ~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day ~ : The first day of the year of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-day-of-year.html : @param $date the date ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxFirstDayOfYearAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day :)\n" + " declare function functx:date ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType ) as xs:date { xs:date( concat( functx:pad-integer-to-length(xs:integer($year),4),'-', functx:pad-integer-to-length(xs:integer($month),2),'-', functx:pad-integer-to-length(xs:integer($day),2))) } ;\n" + " (:~ : The first day of the year of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-day-of-year.html : @param $date the date :)\n" + " declare function functx:first-day-of-year ( $date as xs:anyAtomicType? ) as xs:date? { functx:date(year-from-date(xs:date($date)), 1, 1) } ;\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:first-day-of-year(xs:date('2004-01-23')), functx:first-day-of-year( xs:dateTime('2004-01-23T12:00:13')), functx:first-day-of-year('2004-03-23'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-01-01 2004-01-01 2004-01-01") ); } /** * ~ : The XML node in a sequence that appears first in document order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-node.html : @param $nodes the sequence of nodes . */ @org.junit.Test public void functxFunctxFirstNode1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The XML node in a sequence that appears first in document order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-node.html : @param $nodes the sequence of nodes :)\n" + " declare function functx:first-node ( $nodes as node()* ) as node()? { ($nodes/.)[1] } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:first-node($in-xml//fName))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Kate", false) ); } /** * ~ : The XML node in a sequence that appears first in document order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-node.html : @param $nodes the sequence of nodes . */ @org.junit.Test public void functxFunctxFirstNode2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The XML node in a sequence that appears first in document order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-node.html : @param $nodes the sequence of nodes :)\n" + " declare function functx:first-node ( $nodes as node()* ) as node()? { ($nodes/.)[1] } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:first-node( ($in-xml//lName, $in-xml//fName) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Kate", false) ); } /** * ~ : The XML node in a sequence that appears first in document order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-node.html : @param $nodes the sequence of nodes . */ @org.junit.Test public void functxFunctxFirstNodeAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The XML node in a sequence that appears first in document order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_first-node.html : @param $nodes the sequence of nodes :)\n" + " declare function functx:first-node ( $nodes as node()* ) as node()? { ($nodes/.)[1] } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:first-node($in-xml//fName), functx:first-node( ($in-xml//lName, $in-xml//fName) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("KateKate", false) ); } /** * ~ : Whether an XML node follows another without being its descendant : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_follows-not-descendant.html : @param $a the first node : @param $b the second node . */ @org.junit.Test public void functxFunctxFollowsNotDescendant1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node follows another without being its descendant : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_follows-not-descendant.html : @param $a the first node : @param $b the second node :)\n" + " declare function functx:follows-not-descendant ( $a as node()? , $b as node()? ) as xs:boolean { $a >> $b and empty($b intersect $a/ancestor::node()) } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:follows-not-descendant( $in-xml//author[2],$in-xml//author[1]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether an XML node follows another without being its descendant : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_follows-not-descendant.html : @param $a the first node : @param $b the second node . */ @org.junit.Test public void functxFunctxFollowsNotDescendant2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node follows another without being its descendant : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_follows-not-descendant.html : @param $a the first node : @param $b the second node :)\n" + " declare function functx:follows-not-descendant ( $a as node()? , $b as node()? ) as xs:boolean { $a >> $b and empty($b intersect $a/ancestor::node()) } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:follows-not-descendant( $in-xml//author[1]/fName, $in-xml//author[1]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an XML node follows another without being its descendant : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_follows-not-descendant.html : @param $a the first node : @param $b the second node . */ @org.junit.Test public void functxFunctxFollowsNotDescendant3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node follows another without being its descendant : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_follows-not-descendant.html : @param $a the first node : @param $b the second node :)\n" + " declare function functx:follows-not-descendant ( $a as node()? , $b as node()? ) as xs:boolean { $a >> $b and empty($b intersect $a/ancestor::node()) } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:follows-not-descendant( $in-xml//author[1],$in-xml//author[2]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an XML node follows another without being its descendant : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_follows-not-descendant.html : @param $a the first node : @param $b the second node . */ @org.junit.Test public void functxFunctxFollowsNotDescendantAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node follows another without being its descendant : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_follows-not-descendant.html : @param $a the first node : @param $b the second node :)\n" + " declare function functx:follows-not-descendant ( $a as node()? , $b as node()? ) as xs:boolean { $a >> $b and empty($b intersect $a/ancestor::node()) } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:follows-not-descendant( $in-xml//author[2],$in-xml//author[1]), functx:follows-not-descendant( $in-xml//author[1]/fName, $in-xml//author[1]), functx:follows-not-descendant( $in-xml//author[1],$in-xml//author[2]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true false false") ); } /** * ~ : Moves title words like "the" and "a" to the end of strings : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_format-as-title-en.html : @param $titles the titles to format ~ : The substring before the first text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-match.html : @param $arg the string to substring : @param $regex the regular expression . */ @org.junit.Test public void functxFunctxFormatAsTitleEn1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Moves title words like \"the\" and \"a\" to the end of strings : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_format-as-title-en.html : @param $titles the titles to format :)\n" + " declare function functx:format-as-title-en ( $titles as xs:string* ) as xs:string* { let $wordsToMoveToEnd := ('A', 'An', 'The') for $title in $titles let $firstWord := functx:substring-before-match($title,'\\W') return if ($firstWord = $wordsToMoveToEnd) then replace($title,'(.*?)\\W(.*)', '$2, $1') else $title } ;\n" + " (:~ : The substring before the first text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-match.html : @param $arg the string to substring : @param $regex the regular expression :)\n" + " declare function functx:substring-before-match ( $arg as xs:string? , $regex as xs:string ) as xs:string? { tokenize($arg,$regex)[1] } ;\n" + " (functx:format-as-title-en( ('A Midsummer Night''s Dream', 'The Merchant of Venice', 'Hamlet')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Midsummer Night's Dream, A Merchant of Venice, The Hamlet") ); } /** * ~ : Returns the fragment from a URI : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_fragment-from-uri.html : @param $uri the URI . */ @org.junit.Test public void functxFunctxFragmentFromUri1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Returns the fragment from a URI : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_fragment-from-uri.html : @param $uri the URI :)\n" + " declare function functx:fragment-from-uri ( $uri as xs:string? ) as xs:string? { substring-after($uri,'#') } ;\n" + " (functx:fragment-from-uri( 'http://datypic.com/index.htm#abc'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc") ); } /** * ~ : Returns the fragment from a URI : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_fragment-from-uri.html : @param $uri the URI . */ @org.junit.Test public void functxFunctxFragmentFromUri2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Returns the fragment from a URI : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_fragment-from-uri.html : @param $uri the URI :)\n" + " declare function functx:fragment-from-uri ( $uri as xs:string? ) as xs:string? { substring-after($uri,'#') } ;\n" + " (functx:fragment-from-uri( 'http://datypic.com/index.htm'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * ~ : Returns the fragment from a URI : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_fragment-from-uri.html : @param $uri the URI . */ @org.junit.Test public void functxFunctxFragmentFromUriAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Returns the fragment from a URI : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_fragment-from-uri.html : @param $uri the URI :)\n" + " declare function functx:fragment-from-uri ( $uri as xs:string? ) as xs:string? { substring-after($uri,'#') } ;\n" + " (functx:fragment-from-uri( 'http://datypic.com/index.htm#abc'), functx:fragment-from-uri( 'http://datypic.com/index.htm'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc ") ); } /** * ~ : Splits a string into matching and non-matching regions : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_get-matches-and-non-matches.html : @param $string the string to split : @param $regex the pattern ~ : Return the matching regions of a string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_get-matches.html : @param $string the string to split : @param $regex the pattern ~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match ~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string . */ @org.junit.Test public void functxFunctxGetMatches1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Splits a string into matching and non-matching regions : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_get-matches-and-non-matches.html : @param $string the string to split : @param $regex the pattern :)\n" + " declare function functx:get-matches-and-non-matches ( $string as xs:string? , $regex as xs:string ) as element()* { let $iomf := functx:index-of-match-first($string, $regex) return if (empty($iomf)) then {$string} else if ($iomf > 1) then ({substring($string,1,$iomf - 1)}, functx:get-matches-and-non-matches( substring($string,$iomf),$regex)) else let $length := string-length($string) - string-length(functx:replace-first($string, $regex,'')) return ({substring($string,1,$length)}, if (string-length($string) > $length) then functx:get-matches-and-non-matches( substring($string,$length + 1),$regex) else ()) } ;\n" + " (:~ : Return the matching regions of a string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_get-matches.html : @param $string the string to split : @param $regex the pattern :)\n" + " declare function functx:get-matches ( $string as xs:string? , $regex as xs:string ) as xs:string* { functx:get-matches-and-non-matches($string,$regex)/ string(self::match) } ;\n" + " (:~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match :)\n" + " declare function functx:index-of-match-first ( $arg as xs:string? , $pattern as xs:string ) as xs:integer? { if (matches($arg,$pattern)) then string-length(tokenize($arg, $pattern)[1]) + 1 else () } ;\n" + " (:~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string :)\n" + " declare function functx:replace-first ( $arg as xs:string? , $pattern as xs:string , $replacement as xs:string ) as xs:string { replace($arg, concat('(^.*?)', $pattern), concat('$1',$replacement)) } ;\n" + " (functx:get-matches( 'abc123def', '\\d+'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, " 123 ") ); } /** * ~ : Splits a string into matching and non-matching regions : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_get-matches-and-non-matches.html : @param $string the string to split : @param $regex the pattern ~ : Return the matching regions of a string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_get-matches.html : @param $string the string to split : @param $regex the pattern ~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match ~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string . */ @org.junit.Test public void functxFunctxGetMatches2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Splits a string into matching and non-matching regions : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_get-matches-and-non-matches.html : @param $string the string to split : @param $regex the pattern :)\n" + " declare function functx:get-matches-and-non-matches ( $string as xs:string? , $regex as xs:string ) as element()* { let $iomf := functx:index-of-match-first($string, $regex) return if (empty($iomf)) then {$string} else if ($iomf > 1) then ({substring($string,1,$iomf - 1)}, functx:get-matches-and-non-matches( substring($string,$iomf),$regex)) else let $length := string-length($string) - string-length(functx:replace-first($string, $regex,'')) return ({substring($string,1,$length)}, if (string-length($string) > $length) then functx:get-matches-and-non-matches( substring($string,$length + 1),$regex) else ()) } ;\n" + " (:~ : Return the matching regions of a string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_get-matches.html : @param $string the string to split : @param $regex the pattern :)\n" + " declare function functx:get-matches ( $string as xs:string? , $regex as xs:string ) as xs:string* { functx:get-matches-and-non-matches($string,$regex)/ string(self::match) } ;\n" + " (:~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match :)\n" + " declare function functx:index-of-match-first ( $arg as xs:string? , $pattern as xs:string ) as xs:integer? { if (matches($arg,$pattern)) then string-length(tokenize($arg, $pattern)[1]) + 1 else () } ;\n" + " (:~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string :)\n" + " declare function functx:replace-first ( $arg as xs:string? , $pattern as xs:string , $replacement as xs:string ) as xs:string { replace($arg, concat('(^.*?)', $pattern), concat('$1',$replacement)) } ;\n" + " (functx:get-matches( 'abc123def', '\\d'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, " 1 2 3 ") ); } /** * ~ : Splits a string into matching and non-matching regions : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_get-matches-and-non-matches.html : @param $string the string to split : @param $regex the pattern ~ : Return the matching regions of a string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_get-matches.html : @param $string the string to split : @param $regex the pattern ~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match ~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string . */ @org.junit.Test public void functxFunctxGetMatches3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Splits a string into matching and non-matching regions : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_get-matches-and-non-matches.html : @param $string the string to split : @param $regex the pattern :)\n" + " declare function functx:get-matches-and-non-matches ( $string as xs:string? , $regex as xs:string ) as element()* { let $iomf := functx:index-of-match-first($string, $regex) return if (empty($iomf)) then {$string} else if ($iomf > 1) then ({substring($string,1,$iomf - 1)}, functx:get-matches-and-non-matches( substring($string,$iomf),$regex)) else let $length := string-length($string) - string-length(functx:replace-first($string, $regex,'')) return ({substring($string,1,$length)}, if (string-length($string) > $length) then functx:get-matches-and-non-matches( substring($string,$length + 1),$regex) else ()) } ;\n" + " (:~ : Return the matching regions of a string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_get-matches.html : @param $string the string to split : @param $regex the pattern :)\n" + " declare function functx:get-matches ( $string as xs:string? , $regex as xs:string ) as xs:string* { functx:get-matches-and-non-matches($string,$regex)/ string(self::match) } ;\n" + " (:~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match :)\n" + " declare function functx:index-of-match-first ( $arg as xs:string? , $pattern as xs:string ) as xs:integer? { if (matches($arg,$pattern)) then string-length(tokenize($arg, $pattern)[1]) + 1 else () } ;\n" + " (:~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string :)\n" + " declare function functx:replace-first ( $arg as xs:string? , $pattern as xs:string , $replacement as xs:string ) as xs:string { replace($arg, concat('(^.*?)', $pattern), concat('$1',$replacement)) } ;\n" + " (functx:get-matches( 'abc123def', '[a-z]{2}'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ab de ") ); } /** * ~ : Splits a string into matching and non-matching regions : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_get-matches-and-non-matches.html : @param $string the string to split : @param $regex the pattern ~ : Return the matching regions of a string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_get-matches.html : @param $string the string to split : @param $regex the pattern ~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match ~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string . */ @org.junit.Test public void functxFunctxGetMatchesAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Splits a string into matching and non-matching regions : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_get-matches-and-non-matches.html : @param $string the string to split : @param $regex the pattern :)\n" + " declare function functx:get-matches-and-non-matches ( $string as xs:string? , $regex as xs:string ) as element()* { let $iomf := functx:index-of-match-first($string, $regex) return if (empty($iomf)) then {$string} else if ($iomf > 1) then ({substring($string,1,$iomf - 1)}, functx:get-matches-and-non-matches( substring($string,$iomf),$regex)) else let $length := string-length($string) - string-length(functx:replace-first($string, $regex,'')) return ({substring($string,1,$length)}, if (string-length($string) > $length) then functx:get-matches-and-non-matches( substring($string,$length + 1),$regex) else ()) } ;\n" + " (:~ : Return the matching regions of a string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_get-matches.html : @param $string the string to split : @param $regex the pattern :)\n" + " declare function functx:get-matches ( $string as xs:string? , $regex as xs:string ) as xs:string* { functx:get-matches-and-non-matches($string,$regex)/ string(self::match) } ;\n" + " (:~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match :)\n" + " declare function functx:index-of-match-first ( $arg as xs:string? , $pattern as xs:string ) as xs:integer? { if (matches($arg,$pattern)) then string-length(tokenize($arg, $pattern)[1]) + 1 else () } ;\n" + " (:~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string :)\n" + " declare function functx:replace-first ( $arg as xs:string? , $pattern as xs:string , $replacement as xs:string ) as xs:string { replace($arg, concat('(^.*?)', $pattern), concat('$1',$replacement)) } ;\n" + " (functx:get-matches( 'abc123def', '\\d+'), functx:get-matches( 'abc123def', '\\d'), functx:get-matches( 'abc123def', '[a-z]{2}'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, " 123 1 2 3 ab de ") ); } /** * ~ : Splits a string into matching and non-matching regions : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_get-matches-and-non-matches.html : @param $string the string to split : @param $regex the pattern ~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match ~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string . */ @org.junit.Test public void functxFunctxGetMatchesAndNonMatches1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Splits a string into matching and non-matching regions : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_get-matches-and-non-matches.html : @param $string the string to split : @param $regex the pattern :)\n" + " declare function functx:get-matches-and-non-matches ( $string as xs:string? , $regex as xs:string ) as element()* { let $iomf := functx:index-of-match-first($string, $regex) return if (empty($iomf)) then {$string} else if ($iomf > 1) then ({substring($string,1,$iomf - 1)}, functx:get-matches-and-non-matches( substring($string,$iomf),$regex)) else let $length := string-length($string) - string-length(functx:replace-first($string, $regex,'')) return ({substring($string,1,$length)}, if (string-length($string) > $length) then functx:get-matches-and-non-matches( substring($string,$length + 1),$regex) else ()) } ;\n" + " (:~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match :)\n" + " declare function functx:index-of-match-first ( $arg as xs:string? , $pattern as xs:string ) as xs:integer? { if (matches($arg,$pattern)) then string-length(tokenize($arg, $pattern)[1]) + 1 else () } ;\n" + " (:~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string :)\n" + " declare function functx:replace-first ( $arg as xs:string? , $pattern as xs:string , $replacement as xs:string ) as xs:string { replace($arg, concat('(^.*?)', $pattern), concat('$1',$replacement)) } ;\n" + " (functx:get-matches-and-non-matches( 'abc123def', '\\d+'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("abc123def", false) ); } /** * ~ : Splits a string into matching and non-matching regions : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_get-matches-and-non-matches.html : @param $string the string to split : @param $regex the pattern ~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match ~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string . */ @org.junit.Test public void functxFunctxGetMatchesAndNonMatches2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Splits a string into matching and non-matching regions : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_get-matches-and-non-matches.html : @param $string the string to split : @param $regex the pattern :)\n" + " declare function functx:get-matches-and-non-matches ( $string as xs:string? , $regex as xs:string ) as element()* { let $iomf := functx:index-of-match-first($string, $regex) return if (empty($iomf)) then {$string} else if ($iomf > 1) then ({substring($string,1,$iomf - 1)}, functx:get-matches-and-non-matches( substring($string,$iomf),$regex)) else let $length := string-length($string) - string-length(functx:replace-first($string, $regex,'')) return ({substring($string,1,$length)}, if (string-length($string) > $length) then functx:get-matches-and-non-matches( substring($string,$length + 1),$regex) else ()) } ;\n" + " (:~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match :)\n" + " declare function functx:index-of-match-first ( $arg as xs:string? , $pattern as xs:string ) as xs:integer? { if (matches($arg,$pattern)) then string-length(tokenize($arg, $pattern)[1]) + 1 else () } ;\n" + " (:~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string :)\n" + " declare function functx:replace-first ( $arg as xs:string? , $pattern as xs:string , $replacement as xs:string ) as xs:string { replace($arg, concat('(^.*?)', $pattern), concat('$1',$replacement)) } ;\n" + " (functx:get-matches-and-non-matches( 'abc123def', '\\d'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("abc123def", false) ); } /** * ~ : Splits a string into matching and non-matching regions : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_get-matches-and-non-matches.html : @param $string the string to split : @param $regex the pattern ~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match ~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string . */ @org.junit.Test public void functxFunctxGetMatchesAndNonMatches3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Splits a string into matching and non-matching regions : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_get-matches-and-non-matches.html : @param $string the string to split : @param $regex the pattern :)\n" + " declare function functx:get-matches-and-non-matches ( $string as xs:string? , $regex as xs:string ) as element()* { let $iomf := functx:index-of-match-first($string, $regex) return if (empty($iomf)) then {$string} else if ($iomf > 1) then ({substring($string,1,$iomf - 1)}, functx:get-matches-and-non-matches( substring($string,$iomf),$regex)) else let $length := string-length($string) - string-length(functx:replace-first($string, $regex,'')) return ({substring($string,1,$length)}, if (string-length($string) > $length) then functx:get-matches-and-non-matches( substring($string,$length + 1),$regex) else ()) } ;\n" + " (:~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match :)\n" + " declare function functx:index-of-match-first ( $arg as xs:string? , $pattern as xs:string ) as xs:integer? { if (matches($arg,$pattern)) then string-length(tokenize($arg, $pattern)[1]) + 1 else () } ;\n" + " (:~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string :)\n" + " declare function functx:replace-first ( $arg as xs:string? , $pattern as xs:string , $replacement as xs:string ) as xs:string { replace($arg, concat('(^.*?)', $pattern), concat('$1',$replacement)) } ;\n" + " (functx:get-matches-and-non-matches( 'abc123def', '[a-z]{2}'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("abc123def", false) ); } /** * ~ : Splits a string into matching and non-matching regions : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_get-matches-and-non-matches.html : @param $string the string to split : @param $regex the pattern ~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match ~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string . */ @org.junit.Test public void functxFunctxGetMatchesAndNonMatchesAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Splits a string into matching and non-matching regions : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_get-matches-and-non-matches.html : @param $string the string to split : @param $regex the pattern :)\n" + " declare function functx:get-matches-and-non-matches ( $string as xs:string? , $regex as xs:string ) as element()* { let $iomf := functx:index-of-match-first($string, $regex) return if (empty($iomf)) then {$string} else if ($iomf > 1) then ({substring($string,1,$iomf - 1)}, functx:get-matches-and-non-matches( substring($string,$iomf),$regex)) else let $length := string-length($string) - string-length(functx:replace-first($string, $regex,'')) return ({substring($string,1,$length)}, if (string-length($string) > $length) then functx:get-matches-and-non-matches( substring($string,$length + 1),$regex) else ()) } ;\n" + " (:~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match :)\n" + " declare function functx:index-of-match-first ( $arg as xs:string? , $pattern as xs:string ) as xs:integer? { if (matches($arg,$pattern)) then string-length(tokenize($arg, $pattern)[1]) + 1 else () } ;\n" + " (:~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string :)\n" + " declare function functx:replace-first ( $arg as xs:string? , $pattern as xs:string , $replacement as xs:string ) as xs:string { replace($arg, concat('(^.*?)', $pattern), concat('$1',$replacement)) } ;\n" + " (functx:get-matches-and-non-matches( 'abc123def', '\\d+'), functx:get-matches-and-non-matches( 'abc123def', '\\d'), functx:get-matches-and-non-matches( 'abc123def', '[a-z]{2}'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("abc123defabc123defabc123def", false) ); } /** * ~ : Whether an element has element-only content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-element-only-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasElementOnlyContent1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has element-only content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-element-only-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-element-only-content ( $element as element() ) as xs:boolean { not($element/text()[normalize-space(.) != '']) and $element/* } ;\n" + " let $in-xml := xml xml mixed xml xml xmlxml xml xml return (functx:has-element-only-content($in-xml/a))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an element has element-only content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-element-only-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasElementOnlyContent2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has element-only content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-element-only-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-element-only-content ( $element as element() ) as xs:boolean { not($element/text()[normalize-space(.) != '']) and $element/* } ;\n" + " let $in-xml := xml xml mixed xml xml xmlxml xml xml return (functx:has-element-only-content($in-xml/b))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an element has element-only content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-element-only-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasElementOnlyContent3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has element-only content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-element-only-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-element-only-content ( $element as element() ) as xs:boolean { not($element/text()[normalize-space(.) != '']) and $element/* } ;\n" + " let $in-xml := xml xml mixed xml xml xmlxml xml xml return (functx:has-element-only-content($in-xml/c))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an element has element-only content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-element-only-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasElementOnlyContent4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has element-only content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-element-only-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-element-only-content ( $element as element() ) as xs:boolean { not($element/text()[normalize-space(.) != '']) and $element/* } ;\n" + " let $in-xml := xml xml mixed xml xml xmlxml xml xml return (functx:has-element-only-content($in-xml/d))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an element has element-only content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-element-only-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasElementOnlyContent5() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has element-only content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-element-only-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-element-only-content ( $element as element() ) as xs:boolean { not($element/text()[normalize-space(.) != '']) and $element/* } ;\n" + " let $in-xml := xml xml mixed xml xml xmlxml xml xml return (functx:has-element-only-content($in-xml/e))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether an element has element-only content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-element-only-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasElementOnlyContent6() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has element-only content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-element-only-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-element-only-content ( $element as element() ) as xs:boolean { not($element/text()[normalize-space(.) != '']) and $element/* } ;\n" + " let $in-xml := xml xml mixed xml xml xmlxml xml xml return (functx:has-element-only-content($in-xml/f))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an element has element-only content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-element-only-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasElementOnlyContent7() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has element-only content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-element-only-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-element-only-content ( $element as element() ) as xs:boolean { not($element/text()[normalize-space(.) != '']) and $element/* } ;\n" + " let $in-xml := xml xml mixed xml xml xmlxml xml xml return (functx:has-element-only-content($in-xml/g))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether an element has element-only content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-element-only-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasElementOnlyContent8() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has element-only content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-element-only-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-element-only-content ( $element as element() ) as xs:boolean { not($element/text()[normalize-space(.) != '']) and $element/* } ;\n" + " let $in-xml := xml xml mixed xml xml xmlxml xml xml return (functx:has-element-only-content($in-xml/h))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether an element has element-only content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-element-only-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasElementOnlyContent9() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has element-only content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-element-only-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-element-only-content ( $element as element() ) as xs:boolean { not($element/text()[normalize-space(.) != '']) and $element/* } ;\n" + " let $in-xml := xml xml mixed xml xml xmlxml xml xml return (functx:has-element-only-content($in-xml/i))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether an element has element-only content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-element-only-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasElementOnlyContentAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has element-only content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-element-only-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-element-only-content ( $element as element() ) as xs:boolean { not($element/text()[normalize-space(.) != '']) and $element/* } ;\n" + " let $in-xml := xml xml mixed xml xml xmlxml xml xml return (functx:has-element-only-content($in-xml/a), functx:has-element-only-content($in-xml/b), functx:has-element-only-content($in-xml/c), functx:has-element-only-content($in-xml/d), functx:has-element-only-content($in-xml/e), functx:has-element-only-content($in-xml/f), functx:has-element-only-content($in-xml/g), functx:has-element-only-content($in-xml/h), functx:has-element-only-content($in-xml/i))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "false false false false true false true true true") ); } /** * ~ : Whether an element has empty content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-empty-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasEmptyContent1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has empty content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-empty-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-empty-content ( $element as element() ) as xs:boolean { not($element/node()) } ;\n" + " let $in-xml := xml xml mixed xml xml return (functx:has-empty-content($in-xml/a))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether an element has empty content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-empty-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasEmptyContent2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has empty content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-empty-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-empty-content ( $element as element() ) as xs:boolean { not($element/node()) } ;\n" + " let $in-xml := xml xml mixed xml xml return (functx:has-empty-content($in-xml/b))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether an element has empty content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-empty-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasEmptyContent3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has empty content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-empty-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-empty-content ( $element as element() ) as xs:boolean { not($element/node()) } ;\n" + " let $in-xml := xml xml mixed xml xml return (functx:has-empty-content($in-xml/c))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether an element has empty content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-empty-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasEmptyContent4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has empty content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-empty-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-empty-content ( $element as element() ) as xs:boolean { not($element/node()) } ;\n" + " let $in-xml := xml xml mixed xml xml return (functx:has-empty-content($in-xml/d))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an element has empty content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-empty-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasEmptyContent5() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has empty content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-empty-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-empty-content ( $element as element() ) as xs:boolean { not($element/node()) } ;\n" + " let $in-xml := xml xml mixed xml xml return (functx:has-empty-content($in-xml/e))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an element has empty content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-empty-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasEmptyContent6() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has empty content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-empty-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-empty-content ( $element as element() ) as xs:boolean { not($element/node()) } ;\n" + " let $in-xml := xml xml mixed xml xml return (functx:has-empty-content($in-xml/f))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an element has empty content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-empty-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasEmptyContent7() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has empty content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-empty-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-empty-content ( $element as element() ) as xs:boolean { not($element/node()) } ;\n" + " let $in-xml := xml xml mixed xml xml return (functx:has-empty-content($in-xml/g))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an element has empty content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-empty-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasEmptyContentAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has empty content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-empty-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-empty-content ( $element as element() ) as xs:boolean { not($element/node()) } ;\n" + " let $in-xml := xml xml mixed xml xml return (functx:has-empty-content($in-xml/a), functx:has-empty-content($in-xml/b), functx:has-empty-content($in-xml/c), functx:has-empty-content($in-xml/d), functx:has-empty-content($in-xml/e), functx:has-empty-content($in-xml/f), functx:has-empty-content($in-xml/g))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true true false false false false") ); } /** * ~ : Whether an element has mixed content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-mixed-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasMixedContent1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has mixed content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-mixed-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-mixed-content ( $element as element() ) as xs:boolean { $element/text()[normalize-space(.) != ''] and $element/* } ;\n" + " let $in-xml := xml xml mixed xml xml return (functx:has-mixed-content($in-xml/a))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an element has mixed content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-mixed-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasMixedContent2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has mixed content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-mixed-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-mixed-content ( $element as element() ) as xs:boolean { $element/text()[normalize-space(.) != ''] and $element/* } ;\n" + " let $in-xml := xml xml mixed xml xml return (functx:has-mixed-content($in-xml/b))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an element has mixed content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-mixed-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasMixedContent3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has mixed content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-mixed-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-mixed-content ( $element as element() ) as xs:boolean { $element/text()[normalize-space(.) != ''] and $element/* } ;\n" + " let $in-xml := xml xml mixed xml xml return (functx:has-mixed-content($in-xml/c))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an element has mixed content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-mixed-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasMixedContent4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has mixed content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-mixed-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-mixed-content ( $element as element() ) as xs:boolean { $element/text()[normalize-space(.) != ''] and $element/* } ;\n" + " let $in-xml := xml xml mixed xml xml return (functx:has-mixed-content($in-xml/d))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an element has mixed content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-mixed-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasMixedContent5() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has mixed content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-mixed-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-mixed-content ( $element as element() ) as xs:boolean { $element/text()[normalize-space(.) != ''] and $element/* } ;\n" + " let $in-xml := xml xml mixed xml xml return (functx:has-mixed-content($in-xml/e))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an element has mixed content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-mixed-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasMixedContent6() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has mixed content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-mixed-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-mixed-content ( $element as element() ) as xs:boolean { $element/text()[normalize-space(.) != ''] and $element/* } ;\n" + " let $in-xml := xml xml mixed xml xml return (functx:has-mixed-content($in-xml/f))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether an element has mixed content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-mixed-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasMixedContent7() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has mixed content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-mixed-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-mixed-content ( $element as element() ) as xs:boolean { $element/text()[normalize-space(.) != ''] and $element/* } ;\n" + " let $in-xml := xml xml mixed xml xml return (functx:has-mixed-content($in-xml/g))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an element has mixed content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-mixed-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasMixedContentAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has mixed content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-mixed-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-mixed-content ( $element as element() ) as xs:boolean { $element/text()[normalize-space(.) != ''] and $element/* } ;\n" + " let $in-xml := xml xml mixed xml xml return (functx:has-mixed-content($in-xml/a), functx:has-mixed-content($in-xml/b), functx:has-mixed-content($in-xml/c), functx:has-mixed-content($in-xml/d), functx:has-mixed-content($in-xml/e), functx:has-mixed-content($in-xml/f), functx:has-mixed-content($in-xml/g))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "false false false false false true false") ); } /** * ~ : Whether an element has simple content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-simple-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasSimpleContent1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has simple content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-simple-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-simple-content ( $element as element() ) as xs:boolean { $element/text() and not($element/*) } ;\n" + " let $in-xml := xml xml mixed xml return (functx:has-simple-content($in-xml/a))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an element has simple content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-simple-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasSimpleContent2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has simple content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-simple-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-simple-content ( $element as element() ) as xs:boolean { $element/text() and not($element/*) } ;\n" + " let $in-xml := xml xml mixed xml return (functx:has-simple-content($in-xml/b))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an element has simple content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-simple-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasSimpleContent3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has simple content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-simple-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-simple-content ( $element as element() ) as xs:boolean { $element/text() and not($element/*) } ;\n" + " let $in-xml := xml xml mixed xml return (functx:has-simple-content($in-xml/c))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an element has simple content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-simple-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasSimpleContent4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has simple content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-simple-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-simple-content ( $element as element() ) as xs:boolean { $element/text() and not($element/*) } ;\n" + " let $in-xml := xml xml mixed xml return (functx:has-simple-content($in-xml/d))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether an element has simple content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-simple-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasSimpleContent5() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has simple content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-simple-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-simple-content ( $element as element() ) as xs:boolean { $element/text() and not($element/*) } ;\n" + " let $in-xml := xml xml mixed xml return (functx:has-simple-content($in-xml/e))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an element has simple content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-simple-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasSimpleContent6() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has simple content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-simple-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-simple-content ( $element as element() ) as xs:boolean { $element/text() and not($element/*) } ;\n" + " let $in-xml := xml xml mixed xml return (functx:has-simple-content($in-xml/f))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an element has simple content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-simple-content.html : @param $element the XML element to test . */ @org.junit.Test public void functxFunctxHasSimpleContentAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an element has simple content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_has-simple-content.html : @param $element the XML element to test :)\n" + " declare function functx:has-simple-content ( $element as element() ) as xs:boolean { $element/text() and not($element/*) } ;\n" + " let $in-xml := xml xml mixed xml return (functx:has-simple-content($in-xml/a), functx:has-simple-content($in-xml/b), functx:has-simple-content($in-xml/c), functx:has-simple-content($in-xml/d), functx:has-simple-content($in-xml/e), functx:has-simple-content($in-xml/f))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "false false false true false false") ); } /** * ~ : Gets the ID of an XML element : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_id-from-element.html : @param $element the element . */ @org.junit.Test public void functxFunctxIdFromElement1() { final XQuery query = new XQuery( "\n" + " declare namespace functx = \"http://www.example.com/\";\n" + " declare function functx:id-from-element ( $element as element()? ) as xs:string? { data(($element/@*[id(.) is ..])[1]) } ;\n" + " let $book := (/) return (functx:id-from-element($book/book/section[1]))", ctx); try { query.context(node(file("app/FunctxFn/functx_book.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "preface") ); } /** * ~ : Gets XML element(s) that have an attribute with a particular value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_id-untyped.html : @param $node the root node(s) to start from : @param $id the "id" to find . */ @org.junit.Test public void functxFunctxIdUntyped1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Gets XML element(s) that have an attribute with a particular value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_id-untyped.html : @param $node the root node(s) to start from : @param $id the \"id\" to find :)\n" + " declare function functx:id-untyped ( $node as node()* , $id as xs:anyAtomicType ) as element()* { $node//*[@* = $id] } ;\n" + " let $in-xml := abc def ghi return (functx:id-untyped($in-xml,'B001'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("ghi", false) ); } /** * ~ : Gets XML element(s) that have an attribute with a particular value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_id-untyped.html : @param $node the root node(s) to start from : @param $id the "id" to find . */ @org.junit.Test public void functxFunctxIdUntyped2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Gets XML element(s) that have an attribute with a particular value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_id-untyped.html : @param $node the root node(s) to start from : @param $id the \"id\" to find :)\n" + " declare function functx:id-untyped ( $node as node()* , $id as xs:anyAtomicType ) as element()* { $node//*[@* = $id] } ;\n" + " let $in-xml := abc def ghi return (functx:id-untyped($in-xml,'A001'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("abcdef", false) ); } /** * ~ : Gets XML element(s) that have an attribute with a particular value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_id-untyped.html : @param $node the root node(s) to start from : @param $id the "id" to find . */ @org.junit.Test public void functxFunctxIdUntyped3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Gets XML element(s) that have an attribute with a particular value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_id-untyped.html : @param $node the root node(s) to start from : @param $id the \"id\" to find :)\n" + " declare function functx:id-untyped ( $node as node()* , $id as xs:anyAtomicType ) as element()* { $node//*[@* = $id] } ;\n" + " let $in-xml := abc def ghi return (functx:id-untyped($in-xml,'C001'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * ~ : Gets XML element(s) that have an attribute with a particular value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_id-untyped.html : @param $node the root node(s) to start from : @param $id the "id" to find . */ @org.junit.Test public void functxFunctxIdUntypedAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Gets XML element(s) that have an attribute with a particular value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_id-untyped.html : @param $node the root node(s) to start from : @param $id the \"id\" to find :)\n" + " declare function functx:id-untyped ( $node as node()* , $id as xs:anyAtomicType ) as element()* { $node//*[@* = $id] } ;\n" + " let $in-xml := abc def ghi return (functx:id-untyped($in-xml,'B001'), functx:id-untyped($in-xml,'A001'), functx:id-untyped($in-xml,'C001'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("ghiabcdef", false) ); } /** * ~ : The first argument if it is not empty, otherwise the second argument : : @author W3C XML Query WG : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-absent.html : @param $arg the item(s) that may be absent : @param $value the item(s) to use if the item is absent . */ @org.junit.Test public void functxFunctxIfAbsent1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first argument if it is not empty, otherwise the second argument : : @author W3C XML Query WG : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-absent.html : @param $arg the item(s) that may be absent : @param $value the item(s) to use if the item is absent :)\n" + " declare function functx:if-absent ( $arg as item()* , $value as item()* ) as item()* { if (exists($arg)) then $arg else $value } ;\n" + " let $in-xml := return (data(functx:if-absent( $in-xml//price[1]/@discount, 0)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10.00") ); } /** * ~ : The first argument if it is not empty, otherwise the second argument : : @author W3C XML Query WG : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-absent.html : @param $arg the item(s) that may be absent : @param $value the item(s) to use if the item is absent . */ @org.junit.Test public void functxFunctxIfAbsent2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first argument if it is not empty, otherwise the second argument : : @author W3C XML Query WG : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-absent.html : @param $arg the item(s) that may be absent : @param $value the item(s) to use if the item is absent :)\n" + " declare function functx:if-absent ( $arg as item()* , $value as item()* ) as item()* { if (exists($arg)) then $arg else $value } ;\n" + " let $in-xml := return (data(functx:if-absent( $in-xml//price[3]/@discount, 0)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * ~ : The first argument if it is not empty, otherwise the second argument : : @author W3C XML Query WG : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-absent.html : @param $arg the item(s) that may be absent : @param $value the item(s) to use if the item is absent . */ @org.junit.Test public void functxFunctxIfAbsent3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first argument if it is not empty, otherwise the second argument : : @author W3C XML Query WG : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-absent.html : @param $arg the item(s) that may be absent : @param $value the item(s) to use if the item is absent :)\n" + " declare function functx:if-absent ( $arg as item()* , $value as item()* ) as item()* { if (exists($arg)) then $arg else $value } ;\n" + " let $in-xml := return (data(functx:if-absent( $in-xml//price[4]/@discount, 0)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * ~ : The first argument if it is not empty, otherwise the second argument : : @author W3C XML Query WG : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-absent.html : @param $arg the item(s) that may be absent : @param $value the item(s) to use if the item is absent . */ @org.junit.Test public void functxFunctxIfAbsentAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first argument if it is not empty, otherwise the second argument : : @author W3C XML Query WG : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-absent.html : @param $arg the item(s) that may be absent : @param $value the item(s) to use if the item is absent :)\n" + " declare function functx:if-absent ( $arg as item()* , $value as item()* ) as item()* { if (exists($arg)) then $arg else $value } ;\n" + " let $in-xml := return (data(functx:if-absent( $in-xml//price[1]/@discount, 0)), data(functx:if-absent( $in-xml//price[3]/@discount, 0)), data(functx:if-absent( $in-xml//price[4]/@discount, 0)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10.00 0 ") ); } /** * ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty . */ @org.junit.Test public void functxFunctxIfEmpty1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " let $in-xml := 29.99 39.99 49.99 return (functx:if-empty($in-xml//price[1], 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "29.99") ); } /** * ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty . */ @org.junit.Test public void functxFunctxIfEmpty2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " let $in-xml := 29.99 39.99 49.99 return (functx:if-empty($in-xml//price[3], 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty . */ @org.junit.Test public void functxFunctxIfEmpty3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " let $in-xml := 29.99 39.99 49.99 return (functx:if-empty($in-xml//price[99], 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty . */ @org.junit.Test public void functxFunctxIfEmpty4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " let $in-xml := 29.99 39.99 49.99 return (functx:if-empty($in-xml//price[1]/@discount, 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10.00") ); } /** * ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty . */ @org.junit.Test public void functxFunctxIfEmpty5() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " let $in-xml := 29.99 39.99 49.99 return (functx:if-empty($in-xml//price[3]/@discount, 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty . */ @org.junit.Test public void functxFunctxIfEmpty6() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " let $in-xml := 29.99 39.99 49.99 return (functx:if-empty($in-xml//price[4]/@discount, 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty . */ @org.junit.Test public void functxFunctxIfEmptyAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " let $in-xml := 29.99 39.99 49.99 return (functx:if-empty($in-xml//price[1], 0), functx:if-empty($in-xml//price[3], 0), functx:if-empty($in-xml//price[99], 0), functx:if-empty($in-xml//price[1]/@discount, 0), functx:if-empty($in-xml//price[3]/@discount, 0), functx:if-empty($in-xml//price[4]/@discount, 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "29.99 0 0 10.00 0 0") ); } /** * ~ : The position of a node in a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-deep-equal-node.html : @param $nodes the node sequence : @param $nodeToFind the node to find in the sequence . */ @org.junit.Test public void functxFunctxIndexOfDeepEqualNode1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The position of a node in a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-deep-equal-node.html : @param $nodes the node sequence : @param $nodeToFind the node to find in the sequence :)\n" + " declare function functx:index-of-deep-equal-node ( $nodes as node()* , $nodeToFind as node() ) as xs:integer* { for $seq in (1 to count($nodes)) return $seq[deep-equal($nodes[$seq],$nodeToFind)] } ;\n" + " let $in-xml := Smith Kate Jones John Doe return let $anAuthor := Kate Jones return let $anotherAuthor := John Smith return (functx:index-of-deep-equal-node( $in-xml/author,$anAuthor))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * ~ : The position of a node in a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-deep-equal-node.html : @param $nodes the node sequence : @param $nodeToFind the node to find in the sequence . */ @org.junit.Test public void functxFunctxIndexOfDeepEqualNode2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The position of a node in a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-deep-equal-node.html : @param $nodes the node sequence : @param $nodeToFind the node to find in the sequence :)\n" + " declare function functx:index-of-deep-equal-node ( $nodes as node()* , $nodeToFind as node() ) as xs:integer* { for $seq in (1 to count($nodes)) return $seq[deep-equal($nodes[$seq],$nodeToFind)] } ;\n" + " let $in-xml := Smith Kate Jones John Doe return let $anAuthor := Kate Jones return let $anotherAuthor := John Smith return (functx:index-of-deep-equal-node( $in-xml/author,$anotherAuthor))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * ~ : The position of a node in a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-deep-equal-node.html : @param $nodes the node sequence : @param $nodeToFind the node to find in the sequence . */ @org.junit.Test public void functxFunctxIndexOfDeepEqualNode3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The position of a node in a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-deep-equal-node.html : @param $nodes the node sequence : @param $nodeToFind the node to find in the sequence :)\n" + " declare function functx:index-of-deep-equal-node ( $nodes as node()* , $nodeToFind as node() ) as xs:integer* { for $seq in (1 to count($nodes)) return $seq[deep-equal($nodes[$seq],$nodeToFind)] } ;\n" + " let $in-xml := Smith Kate Jones John Doe return let $anAuthor := Kate Jones return let $anotherAuthor := John Smith return (functx:index-of-deep-equal-node( $in-xml/author/lName,$anAuthor/lName))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * ~ : The position of a node in a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-deep-equal-node.html : @param $nodes the node sequence : @param $nodeToFind the node to find in the sequence . */ @org.junit.Test public void functxFunctxIndexOfDeepEqualNodeAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The position of a node in a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-deep-equal-node.html : @param $nodes the node sequence : @param $nodeToFind the node to find in the sequence :)\n" + " declare function functx:index-of-deep-equal-node ( $nodes as node()* , $nodeToFind as node() ) as xs:integer* { for $seq in (1 to count($nodes)) return $seq[deep-equal($nodes[$seq],$nodeToFind)] } ;\n" + " let $in-xml := Smith Kate Jones John Doe return let $anAuthor := Kate Jones return let $anotherAuthor := John Smith return (functx:index-of-deep-equal-node( $in-xml/author,$anAuthor), functx:index-of-deep-equal-node( $in-xml/author,$anotherAuthor), functx:index-of-deep-equal-node( $in-xml/author/lName,$anAuthor/lName))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2 2") ); } /** * ~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match . */ @org.junit.Test public void functxFunctxIndexOfMatchFirst1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match :)\n" + " declare function functx:index-of-match-first ( $arg as xs:string? , $pattern as xs:string ) as xs:integer? { if (matches($arg,$pattern)) then string-length(tokenize($arg, $pattern)[1]) + 1 else () } ;\n" + " (functx:index-of-match-first( 'abcdabcdabcd','abc'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * ~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match . */ @org.junit.Test public void functxFunctxIndexOfMatchFirst2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match :)\n" + " declare function functx:index-of-match-first ( $arg as xs:string? , $pattern as xs:string ) as xs:integer? { if (matches($arg,$pattern)) then string-length(tokenize($arg, $pattern)[1]) + 1 else () } ;\n" + " (functx:index-of-match-first( 'abcdabcdabcd','bcd'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * ~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match . */ @org.junit.Test public void functxFunctxIndexOfMatchFirst3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match :)\n" + " declare function functx:index-of-match-first ( $arg as xs:string? , $pattern as xs:string ) as xs:integer? { if (matches($arg,$pattern)) then string-length(tokenize($arg, $pattern)[1]) + 1 else () } ;\n" + " (functx:index-of-match-first('a1234','\\d'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * ~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match . */ @org.junit.Test public void functxFunctxIndexOfMatchFirst4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match :)\n" + " declare function functx:index-of-match-first ( $arg as xs:string? , $pattern as xs:string ) as xs:integer? { if (matches($arg,$pattern)) then string-length(tokenize($arg, $pattern)[1]) + 1 else () } ;\n" + " (functx:index-of-match-first('abc abc','\\s'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("4") ); } /** * ~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match . */ @org.junit.Test public void functxFunctxIndexOfMatchFirst5() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match :)\n" + " declare function functx:index-of-match-first ( $arg as xs:string? , $pattern as xs:string ) as xs:integer? { if (matches($arg,$pattern)) then string-length(tokenize($arg, $pattern)[1]) + 1 else () } ;\n" + " (functx:index-of-match-first('abc abc','z'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * ~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match . */ @org.junit.Test public void functxFunctxIndexOfMatchFirstAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first position of a matching substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-match-first.html : @param $arg the string : @param $pattern the pattern to match :)\n" + " declare function functx:index-of-match-first ( $arg as xs:string? , $pattern as xs:string ) as xs:integer? { if (matches($arg,$pattern)) then string-length(tokenize($arg, $pattern)[1]) + 1 else () } ;\n" + " (functx:index-of-match-first( 'abcdabcdabcd','abc'), functx:index-of-match-first( 'abcdabcdabcd','bcd'), functx:index-of-match-first('a1234','\\d'), functx:index-of-match-first('abc abc','\\s'), functx:index-of-match-first('abc abc','z'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 2 4") ); } /** * ~ : The position of a node in a sequence, based on node identity : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-node.html : @param $nodes the node sequence : @param $nodeToFind the node to find in the sequence . */ @org.junit.Test public void functxFunctxIndexOfNode1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The position of a node in a sequence, based on node identity : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-node.html : @param $nodes the node sequence : @param $nodeToFind the node to find in the sequence :)\n" + " declare function functx:index-of-node ( $nodes as node()* , $nodeToFind as node() ) as xs:integer* { for $seq in (1 to count($nodes)) return $seq[$nodes[$seq] is $nodeToFind] } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:index-of-node( $in-xml/author,$in-xml/author[1]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * ~ : The position of a node in a sequence, based on node identity : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-node.html : @param $nodes the node sequence : @param $nodeToFind the node to find in the sequence . */ @org.junit.Test public void functxFunctxIndexOfNode2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The position of a node in a sequence, based on node identity : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-node.html : @param $nodes the node sequence : @param $nodeToFind the node to find in the sequence :)\n" + " declare function functx:index-of-node ( $nodes as node()* , $nodeToFind as node() ) as xs:integer* { for $seq in (1 to count($nodes)) return $seq[$nodes[$seq] is $nodeToFind] } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:index-of-node( $in-xml/author,$in-xml/author[2]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * ~ : The position of a node in a sequence, based on node identity : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-node.html : @param $nodes the node sequence : @param $nodeToFind the node to find in the sequence . */ @org.junit.Test public void functxFunctxIndexOfNode3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The position of a node in a sequence, based on node identity : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-node.html : @param $nodes the node sequence : @param $nodeToFind the node to find in the sequence :)\n" + " declare function functx:index-of-node ( $nodes as node()* , $nodeToFind as node() ) as xs:integer* { for $seq in (1 to count($nodes)) return $seq[$nodes[$seq] is $nodeToFind] } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:index-of-node( $in-xml/author, $in-xml/author[lName='Doe']))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * ~ : The position of a node in a sequence, based on node identity : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-node.html : @param $nodes the node sequence : @param $nodeToFind the node to find in the sequence . */ @org.junit.Test public void functxFunctxIndexOfNodeAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The position of a node in a sequence, based on node identity : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-node.html : @param $nodes the node sequence : @param $nodeToFind the node to find in the sequence :)\n" + " declare function functx:index-of-node ( $nodes as node()* , $nodeToFind as node() ) as xs:integer* { for $seq in (1 to count($nodes)) return $seq[$nodes[$seq] is $nodeToFind] } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:index-of-node( $in-xml/author,$in-xml/author[1]), functx:index-of-node( $in-xml/author,$in-xml/author[2]), functx:index-of-node( $in-xml/author, $in-xml/author[lName='Doe']))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 2") ); } /** * ~ : The position(s) of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string.html : @param $arg the string : @param $substring the substring to find . */ @org.junit.Test public void functxFunctxIndexOfString1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The position(s) of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string.html : @param $arg the string : @param $substring the substring to find :)\n" + " declare function functx:index-of-string ( $arg as xs:string? , $substring as xs:string ) as xs:integer* { if (contains($arg, $substring)) then (string-length(substring-before($arg, $substring))+1, for $other in functx:index-of-string(substring-after($arg, $substring), $substring) return $other + string-length(substring-before($arg, $substring)) + string-length($substring)) else () } ;\n" + " (functx:index-of-string('abcdabcdabcd','abc'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 5 9") ); } /** * ~ : The position(s) of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string.html : @param $arg the string : @param $substring the substring to find . */ @org.junit.Test public void functxFunctxIndexOfString2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The position(s) of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string.html : @param $arg the string : @param $substring the substring to find :)\n" + " declare function functx:index-of-string ( $arg as xs:string? , $substring as xs:string ) as xs:integer* { if (contains($arg, $substring)) then (string-length(substring-before($arg, $substring))+1, for $other in functx:index-of-string(substring-after($arg, $substring), $substring) return $other + string-length(substring-before($arg, $substring)) + string-length($substring)) else () } ;\n" + " (functx:index-of-string('abcd','abc'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * ~ : The position(s) of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string.html : @param $arg the string : @param $substring the substring to find . */ @org.junit.Test public void functxFunctxIndexOfString3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The position(s) of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string.html : @param $arg the string : @param $substring the substring to find :)\n" + " declare function functx:index-of-string ( $arg as xs:string? , $substring as xs:string ) as xs:integer* { if (contains($arg, $substring)) then (string-length(substring-before($arg, $substring))+1, for $other in functx:index-of-string(substring-after($arg, $substring), $substring) return $other + string-length(substring-before($arg, $substring)) + string-length($substring)) else () } ;\n" + " (functx:index-of-string('xxx','abc'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * ~ : The position(s) of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string.html : @param $arg the string : @param $substring the substring to find . */ @org.junit.Test public void functxFunctxIndexOfStringAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The position(s) of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string.html : @param $arg the string : @param $substring the substring to find :)\n" + " declare function functx:index-of-string ( $arg as xs:string? , $substring as xs:string ) as xs:integer* { if (contains($arg, $substring)) then (string-length(substring-before($arg, $substring))+1, for $other in functx:index-of-string(substring-after($arg, $substring), $substring) return $other + string-length(substring-before($arg, $substring)) + string-length($substring)) else () } ;\n" + " (functx:index-of-string('abcdabcdabcd','abc'), functx:index-of-string('abcd','abc'), functx:index-of-string('xxx','abc'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 5 9 1") ); } /** * ~ : The first position of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string-first.html : @param $arg the string : @param $substring the substring to find . */ @org.junit.Test public void functxFunctxIndexOfStringFirst1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first position of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string-first.html : @param $arg the string : @param $substring the substring to find :)\n" + " declare function functx:index-of-string-first ( $arg as xs:string? , $substring as xs:string ) as xs:integer? { if (contains($arg, $substring)) then string-length(substring-before($arg, $substring))+1 else () } ;\n" + " (functx:index-of-string-first( 'abcdabcdabcd','abc'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * ~ : The first position of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string-first.html : @param $arg the string : @param $substring the substring to find . */ @org.junit.Test public void functxFunctxIndexOfStringFirst2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first position of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string-first.html : @param $arg the string : @param $substring the substring to find :)\n" + " declare function functx:index-of-string-first ( $arg as xs:string? , $substring as xs:string ) as xs:integer? { if (contains($arg, $substring)) then string-length(substring-before($arg, $substring))+1 else () } ;\n" + " (functx:index-of-string-first( 'abcd','abc'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * ~ : The first position of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string-first.html : @param $arg the string : @param $substring the substring to find . */ @org.junit.Test public void functxFunctxIndexOfStringFirst3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first position of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string-first.html : @param $arg the string : @param $substring the substring to find :)\n" + " declare function functx:index-of-string-first ( $arg as xs:string? , $substring as xs:string ) as xs:integer? { if (contains($arg, $substring)) then string-length(substring-before($arg, $substring))+1 else () } ;\n" + " (functx:index-of-string-first( 'xxx','abc'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * ~ : The first position of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string-first.html : @param $arg the string : @param $substring the substring to find . */ @org.junit.Test public void functxFunctxIndexOfStringFirstAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first position of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string-first.html : @param $arg the string : @param $substring the substring to find :)\n" + " declare function functx:index-of-string-first ( $arg as xs:string? , $substring as xs:string ) as xs:integer? { if (contains($arg, $substring)) then string-length(substring-before($arg, $substring))+1 else () } ;\n" + " (functx:index-of-string-first( 'abcdabcdabcd','abc'), functx:index-of-string-first( 'abcd','abc'), functx:index-of-string-first( 'xxx','abc'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 1") ); } /** * ~ : The last position of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string-last.html : @param $arg the string : @param $substring the substring to find ~ : The position(s) of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string.html : @param $arg the string : @param $substring the substring to find . */ @org.junit.Test public void functxFunctxIndexOfStringLast1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The last position of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string-last.html : @param $arg the string : @param $substring the substring to find :)\n" + " declare function functx:index-of-string-last ( $arg as xs:string? , $substring as xs:string ) as xs:integer? { functx:index-of-string($arg, $substring)[last()] } ;\n" + " (:~ : The position(s) of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string.html : @param $arg the string : @param $substring the substring to find :)\n" + " declare function functx:index-of-string ( $arg as xs:string? , $substring as xs:string ) as xs:integer* { if (contains($arg, $substring)) then (string-length(substring-before($arg, $substring))+1, for $other in functx:index-of-string(substring-after($arg, $substring), $substring) return $other + string-length(substring-before($arg, $substring)) + string-length($substring)) else () } ;\n" + " (functx:index-of-string-last( 'abcdabcdabcd','abc'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("9") ); } /** * ~ : The last position of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string-last.html : @param $arg the string : @param $substring the substring to find ~ : The position(s) of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string.html : @param $arg the string : @param $substring the substring to find . */ @org.junit.Test public void functxFunctxIndexOfStringLast2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The last position of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string-last.html : @param $arg the string : @param $substring the substring to find :)\n" + " declare function functx:index-of-string-last ( $arg as xs:string? , $substring as xs:string ) as xs:integer? { functx:index-of-string($arg, $substring)[last()] } ;\n" + " (:~ : The position(s) of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string.html : @param $arg the string : @param $substring the substring to find :)\n" + " declare function functx:index-of-string ( $arg as xs:string? , $substring as xs:string ) as xs:integer* { if (contains($arg, $substring)) then (string-length(substring-before($arg, $substring))+1, for $other in functx:index-of-string(substring-after($arg, $substring), $substring) return $other + string-length(substring-before($arg, $substring)) + string-length($substring)) else () } ;\n" + " (functx:index-of-string-last( 'abcd','abc'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * ~ : The last position of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string-last.html : @param $arg the string : @param $substring the substring to find ~ : The position(s) of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string.html : @param $arg the string : @param $substring the substring to find . */ @org.junit.Test public void functxFunctxIndexOfStringLast3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The last position of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string-last.html : @param $arg the string : @param $substring the substring to find :)\n" + " declare function functx:index-of-string-last ( $arg as xs:string? , $substring as xs:string ) as xs:integer? { functx:index-of-string($arg, $substring)[last()] } ;\n" + " (:~ : The position(s) of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string.html : @param $arg the string : @param $substring the substring to find :)\n" + " declare function functx:index-of-string ( $arg as xs:string? , $substring as xs:string ) as xs:integer* { if (contains($arg, $substring)) then (string-length(substring-before($arg, $substring))+1, for $other in functx:index-of-string(substring-after($arg, $substring), $substring) return $other + string-length(substring-before($arg, $substring)) + string-length($substring)) else () } ;\n" + " (functx:index-of-string-last( 'xxx','abc'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * ~ : The last position of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string-last.html : @param $arg the string : @param $substring the substring to find ~ : The position(s) of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string.html : @param $arg the string : @param $substring the substring to find . */ @org.junit.Test public void functxFunctxIndexOfStringLastAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The last position of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string-last.html : @param $arg the string : @param $substring the substring to find :)\n" + " declare function functx:index-of-string-last ( $arg as xs:string? , $substring as xs:string ) as xs:integer? { functx:index-of-string($arg, $substring)[last()] } ;\n" + " (:~ : The position(s) of a substring : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-string.html : @param $arg the string : @param $substring the substring to find :)\n" + " declare function functx:index-of-string ( $arg as xs:string? , $substring as xs:string ) as xs:integer* { if (contains($arg, $substring)) then (string-length(substring-before($arg, $substring))+1, for $other in functx:index-of-string(substring-after($arg, $substring), $substring) return $other + string-length(substring-before($arg, $substring)) + string-length($substring)) else () } ;\n" + " (functx:index-of-string-last( 'abcdabcdabcd','abc'), functx:index-of-string-last( 'abcd','abc'), functx:index-of-string-last( 'xxx','abc'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9 1") ); } /** * ~ : Inserts a string at a specified position : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_insert-string.html : @param $originalString the original string to insert into : @param $stringToInsert the string to insert : @param $pos the position . */ @org.junit.Test public void functxFunctxInsertString1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Inserts a string at a specified position : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_insert-string.html : @param $originalString the original string to insert into : @param $stringToInsert the string to insert : @param $pos the position :)\n" + " declare function functx:insert-string ( $originalString as xs:string? , $stringToInsert as xs:string? , $pos as xs:integer ) as xs:string { concat(substring($originalString,1,$pos - 1), $stringToInsert, substring($originalString,$pos)) } ;\n" + " (functx:insert-string('xyz','def',2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xdefyz") ); } /** * ~ : Inserts a string at a specified position : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_insert-string.html : @param $originalString the original string to insert into : @param $stringToInsert the string to insert : @param $pos the position . */ @org.junit.Test public void functxFunctxInsertString2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Inserts a string at a specified position : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_insert-string.html : @param $originalString the original string to insert into : @param $stringToInsert the string to insert : @param $pos the position :)\n" + " declare function functx:insert-string ( $originalString as xs:string? , $stringToInsert as xs:string? , $pos as xs:integer ) as xs:string { concat(substring($originalString,1,$pos - 1), $stringToInsert, substring($originalString,$pos)) } ;\n" + " (functx:insert-string('xyz','def',5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xyzdef") ); } /** * ~ : Inserts a string at a specified position : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_insert-string.html : @param $originalString the original string to insert into : @param $stringToInsert the string to insert : @param $pos the position . */ @org.junit.Test public void functxFunctxInsertString3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Inserts a string at a specified position : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_insert-string.html : @param $originalString the original string to insert into : @param $stringToInsert the string to insert : @param $pos the position :)\n" + " declare function functx:insert-string ( $originalString as xs:string? , $stringToInsert as xs:string? , $pos as xs:integer ) as xs:string { concat(substring($originalString,1,$pos - 1), $stringToInsert, substring($originalString,$pos)) } ;\n" + " (functx:insert-string('xyz','',2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xyz") ); } /** * ~ : Inserts a string at a specified position : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_insert-string.html : @param $originalString the original string to insert into : @param $stringToInsert the string to insert : @param $pos the position . */ @org.junit.Test public void functxFunctxInsertString4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Inserts a string at a specified position : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_insert-string.html : @param $originalString the original string to insert into : @param $stringToInsert the string to insert : @param $pos the position :)\n" + " declare function functx:insert-string ( $originalString as xs:string? , $stringToInsert as xs:string? , $pos as xs:integer ) as xs:string { concat(substring($originalString,1,$pos - 1), $stringToInsert, substring($originalString,$pos)) } ;\n" + " (functx:insert-string('','def',2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "def") ); } /** * ~ : Inserts a string at a specified position : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_insert-string.html : @param $originalString the original string to insert into : @param $stringToInsert the string to insert : @param $pos the position . */ @org.junit.Test public void functxFunctxInsertStringAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Inserts a string at a specified position : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_insert-string.html : @param $originalString the original string to insert into : @param $stringToInsert the string to insert : @param $pos the position :)\n" + " declare function functx:insert-string ( $originalString as xs:string? , $stringToInsert as xs:string? , $pos as xs:integer ) as xs:string { concat(substring($originalString,1,$pos - 1), $stringToInsert, substring($originalString,$pos)) } ;\n" + " (functx:insert-string('xyz','def',2), functx:insert-string('xyz','def',5), functx:insert-string('xyz','',2), functx:insert-string('','def',2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xdefyz xyzdef xyz def") ); } /** * ~ : Whether a value is numeric : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-a-number.html : @param $value the value to test . */ @org.junit.Test public void functxFunctxIsANumber1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is numeric : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-a-number.html : @param $value the value to test :)\n" + " declare function functx:is-a-number ( $value as xs:anyAtomicType? ) as xs:boolean { string(number($value)) != 'NaN' } ;\n" + " let $in-xml := 123 abc return (functx:is-a-number('123'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether a value is numeric : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-a-number.html : @param $value the value to test . */ @org.junit.Test public void functxFunctxIsANumber2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is numeric : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-a-number.html : @param $value the value to test :)\n" + " declare function functx:is-a-number ( $value as xs:anyAtomicType? ) as xs:boolean { string(number($value)) != 'NaN' } ;\n" + " let $in-xml := 123 abc return (functx:is-a-number(123))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether a value is numeric : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-a-number.html : @param $value the value to test . */ @org.junit.Test public void functxFunctxIsANumber3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is numeric : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-a-number.html : @param $value the value to test :)\n" + " declare function functx:is-a-number ( $value as xs:anyAtomicType? ) as xs:boolean { string(number($value)) != 'NaN' } ;\n" + " let $in-xml := 123 abc return (functx:is-a-number(' 123 '))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether a value is numeric : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-a-number.html : @param $value the value to test . */ @org.junit.Test public void functxFunctxIsANumber4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is numeric : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-a-number.html : @param $value the value to test :)\n" + " declare function functx:is-a-number ( $value as xs:anyAtomicType? ) as xs:boolean { string(number($value)) != 'NaN' } ;\n" + " let $in-xml := 123 abc return (functx:is-a-number(''))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether a value is numeric : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-a-number.html : @param $value the value to test . */ @org.junit.Test public void functxFunctxIsANumber5() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is numeric : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-a-number.html : @param $value the value to test :)\n" + " declare function functx:is-a-number ( $value as xs:anyAtomicType? ) as xs:boolean { string(number($value)) != 'NaN' } ;\n" + " let $in-xml := 123 abc return (functx:is-a-number('123abc'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether a value is numeric : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-a-number.html : @param $value the value to test . */ @org.junit.Test public void functxFunctxIsANumber6() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is numeric : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-a-number.html : @param $value the value to test :)\n" + " declare function functx:is-a-number ( $value as xs:anyAtomicType? ) as xs:boolean { string(number($value)) != 'NaN' } ;\n" + " let $in-xml := 123 abc return (functx:is-a-number('NaN'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether a value is numeric : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-a-number.html : @param $value the value to test . */ @org.junit.Test public void functxFunctxIsANumber7() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is numeric : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-a-number.html : @param $value the value to test :)\n" + " declare function functx:is-a-number ( $value as xs:anyAtomicType? ) as xs:boolean { string(number($value)) != 'NaN' } ;\n" + " let $in-xml := 123 abc return (functx:is-a-number($in-xml/a))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether a value is numeric : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-a-number.html : @param $value the value to test . */ @org.junit.Test public void functxFunctxIsANumber8() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is numeric : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-a-number.html : @param $value the value to test :)\n" + " declare function functx:is-a-number ( $value as xs:anyAtomicType? ) as xs:boolean { string(number($value)) != 'NaN' } ;\n" + " let $in-xml := 123 abc return (functx:is-a-number($in-xml/b))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether a value is numeric : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-a-number.html : @param $value the value to test . */ @org.junit.Test public void functxFunctxIsANumberAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a value is numeric : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-a-number.html : @param $value the value to test :)\n" + " declare function functx:is-a-number ( $value as xs:anyAtomicType? ) as xs:boolean { string(number($value)) != 'NaN' } ;\n" + " let $in-xml := 123 abc return (functx:is-a-number('123'), functx:is-a-number(123), functx:is-a-number(' 123 '), functx:is-a-number(''), functx:is-a-number('123abc'), functx:is-a-number('NaN'), functx:is-a-number($in-xml/a), functx:is-a-number($in-xml/b))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true true false false false true false") ); } /** * ~ : Whether a URI is absolute : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-absolute-uri.html : @param $uri the URI to test . */ @org.junit.Test public void functxFunctxIsAbsoluteUri1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a URI is absolute : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-absolute-uri.html : @param $uri the URI to test :)\n" + " declare function functx:is-absolute-uri ( $uri as xs:string? ) as xs:boolean { matches($uri,'^[a-z]+:') } ;\n" + " (functx:is-absolute-uri( 'http://www.datypic.com'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether a URI is absolute : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-absolute-uri.html : @param $uri the URI to test . */ @org.junit.Test public void functxFunctxIsAbsoluteUri2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a URI is absolute : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-absolute-uri.html : @param $uri the URI to test :)\n" + " declare function functx:is-absolute-uri ( $uri as xs:string? ) as xs:boolean { matches($uri,'^[a-z]+:') } ;\n" + " (functx:is-absolute-uri( 'ftp://ftp.datypic.com'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether a URI is absolute : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-absolute-uri.html : @param $uri the URI to test . */ @org.junit.Test public void functxFunctxIsAbsoluteUri3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a URI is absolute : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-absolute-uri.html : @param $uri the URI to test :)\n" + " declare function functx:is-absolute-uri ( $uri as xs:string? ) as xs:boolean { matches($uri,'^[a-z]+:') } ;\n" + " (functx:is-absolute-uri('ftp.datypic.com'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether a URI is absolute : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-absolute-uri.html : @param $uri the URI to test . */ @org.junit.Test public void functxFunctxIsAbsoluteUri4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a URI is absolute : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-absolute-uri.html : @param $uri the URI to test :)\n" + " declare function functx:is-absolute-uri ( $uri as xs:string? ) as xs:boolean { matches($uri,'^[a-z]+:') } ;\n" + " (functx:is-absolute-uri('www.datypic.com'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether a URI is absolute : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-absolute-uri.html : @param $uri the URI to test . */ @org.junit.Test public void functxFunctxIsAbsoluteUri5() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a URI is absolute : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-absolute-uri.html : @param $uri the URI to test :)\n" + " declare function functx:is-absolute-uri ( $uri as xs:string? ) as xs:boolean { matches($uri,'^[a-z]+:') } ;\n" + " (functx:is-absolute-uri('prod.html'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether a URI is absolute : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-absolute-uri.html : @param $uri the URI to test . */ @org.junit.Test public void functxFunctxIsAbsoluteUriAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a URI is absolute : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-absolute-uri.html : @param $uri the URI to test :)\n" + " declare function functx:is-absolute-uri ( $uri as xs:string? ) as xs:boolean { matches($uri,'^[a-z]+:') } ;\n" + " (functx:is-absolute-uri( 'http://www.datypic.com'), functx:is-absolute-uri( 'ftp://ftp.datypic.com'), functx:is-absolute-uri('ftp.datypic.com'), functx:is-absolute-uri('www.datypic.com'), functx:is-absolute-uri('prod.html'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true false false false") ); } /** * ~ : Whether an XML node is an ancestor of another node : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-ancestor.html : @param $node1 the first node : @param $node2 the second node . */ @org.junit.Test public void functxFunctxIsAncestor1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is an ancestor of another node : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-ancestor.html : @param $node1 the first node : @param $node2 the second node :)\n" + " declare function functx:is-ancestor ( $node1 as node() , $node2 as node() ) as xs:boolean { exists($node1 intersect $node2/ancestor::node()) } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:is-ancestor( $in-xml//author[1], $in-xml//author[1]/fName))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether an XML node is an ancestor of another node : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-ancestor.html : @param $node1 the first node : @param $node2 the second node . */ @org.junit.Test public void functxFunctxIsAncestor2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is an ancestor of another node : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-ancestor.html : @param $node1 the first node : @param $node2 the second node :)\n" + " declare function functx:is-ancestor ( $node1 as node() , $node2 as node() ) as xs:boolean { exists($node1 intersect $node2/ancestor::node()) } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:is-ancestor( $in-xml//author[1]/fName, $in-xml//author[1]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an XML node is an ancestor of another node : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-ancestor.html : @param $node1 the first node : @param $node2 the second node . */ @org.junit.Test public void functxFunctxIsAncestor3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is an ancestor of another node : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-ancestor.html : @param $node1 the first node : @param $node2 the second node :)\n" + " declare function functx:is-ancestor ( $node1 as node() , $node2 as node() ) as xs:boolean { exists($node1 intersect $node2/ancestor::node()) } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:is-ancestor( $in-xml//author[1]/fName, $in-xml//author[1]/fName/text()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether an XML node is an ancestor of another node : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-ancestor.html : @param $node1 the first node : @param $node2 the second node . */ @org.junit.Test public void functxFunctxIsAncestor4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is an ancestor of another node : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-ancestor.html : @param $node1 the first node : @param $node2 the second node :)\n" + " declare function functx:is-ancestor ( $node1 as node() , $node2 as node() ) as xs:boolean { exists($node1 intersect $node2/ancestor::node()) } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:is-ancestor( $in-xml//author[1], $in-xml//author[2]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an XML node is an ancestor of another node : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-ancestor.html : @param $node1 the first node : @param $node2 the second node . */ @org.junit.Test public void functxFunctxIsAncestorAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is an ancestor of another node : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-ancestor.html : @param $node1 the first node : @param $node2 the second node :)\n" + " declare function functx:is-ancestor ( $node1 as node() , $node2 as node() ) as xs:boolean { exists($node1 intersect $node2/ancestor::node()) } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:is-ancestor( $in-xml//author[1], $in-xml//author[1]/fName), functx:is-ancestor( $in-xml//author[1]/fName, $in-xml//author[1]), functx:is-ancestor( $in-xml//author[1]/fName, $in-xml//author[1]/fName/text()), functx:is-ancestor( $in-xml//author[1], $in-xml//author[2]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true false true false") ); } /** * ~ : Whether an XML node is a descendant of another node : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-descendant.html : @param $node1 the first node : @param $node2 the second node . */ @org.junit.Test public void functxFunctxIsDescendant1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is a descendant of another node : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-descendant.html : @param $node1 the first node : @param $node2 the second node :)\n" + " declare function functx:is-descendant ( $node1 as node() , $node2 as node() ) as xs:boolean { boolean($node2 intersect $node1/ancestor::node()) } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:is-descendant( $in-xml//author[1]/fName, $in-xml//author[1]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether an XML node is a descendant of another node : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-descendant.html : @param $node1 the first node : @param $node2 the second node . */ @org.junit.Test public void functxFunctxIsDescendant2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is a descendant of another node : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-descendant.html : @param $node1 the first node : @param $node2 the second node :)\n" + " declare function functx:is-descendant ( $node1 as node() , $node2 as node() ) as xs:boolean { boolean($node2 intersect $node1/ancestor::node()) } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:is-descendant( $in-xml//author[1], $in-xml//author[1]/fName))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an XML node is a descendant of another node : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-descendant.html : @param $node1 the first node : @param $node2 the second node . */ @org.junit.Test public void functxFunctxIsDescendant3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is a descendant of another node : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-descendant.html : @param $node1 the first node : @param $node2 the second node :)\n" + " declare function functx:is-descendant ( $node1 as node() , $node2 as node() ) as xs:boolean { boolean($node2 intersect $node1/ancestor::node()) } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:is-descendant( $in-xml//author[1]/fName/text(), $in-xml//author[1]/fName))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether an XML node is a descendant of another node : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-descendant.html : @param $node1 the first node : @param $node2 the second node . */ @org.junit.Test public void functxFunctxIsDescendant4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is a descendant of another node : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-descendant.html : @param $node1 the first node : @param $node2 the second node :)\n" + " declare function functx:is-descendant ( $node1 as node() , $node2 as node() ) as xs:boolean { boolean($node2 intersect $node1/ancestor::node()) } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:is-descendant( $in-xml//author[1], $in-xml//author[2]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an XML node is a descendant of another node : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-descendant.html : @param $node1 the first node : @param $node2 the second node . */ @org.junit.Test public void functxFunctxIsDescendantAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is a descendant of another node : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-descendant.html : @param $node1 the first node : @param $node2 the second node :)\n" + " declare function functx:is-descendant ( $node1 as node() , $node2 as node() ) as xs:boolean { boolean($node2 intersect $node1/ancestor::node()) } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:is-descendant( $in-xml//author[1]/fName, $in-xml//author[1]), functx:is-descendant( $in-xml//author[1], $in-xml//author[1]/fName), functx:is-descendant( $in-xml//author[1]/fName/text(), $in-xml//author[1]/fName), functx:is-descendant( $in-xml//author[1], $in-xml//author[2]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true false true false") ); } /** * ~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year . */ @org.junit.Test public void functxFunctxIsLeapYear1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year :)\n" + " declare function functx:is-leap-year ( $date as xs:anyAtomicType? ) as xs:boolean { for $year in xs:integer(substring(string($date),1,4)) return ($year mod 4 = 0 and $year mod 100 != 0) or $year mod 400 = 0 } ;\n" + " (functx:is-leap-year(xs:date('2004-01-23')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year . */ @org.junit.Test public void functxFunctxIsLeapYear2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year :)\n" + " declare function functx:is-leap-year ( $date as xs:anyAtomicType? ) as xs:boolean { for $year in xs:integer(substring(string($date),1,4)) return ($year mod 4 = 0 and $year mod 100 != 0) or $year mod 400 = 0 } ;\n" + " (functx:is-leap-year(2004))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year . */ @org.junit.Test public void functxFunctxIsLeapYear3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year :)\n" + " declare function functx:is-leap-year ( $date as xs:anyAtomicType? ) as xs:boolean { for $year in xs:integer(substring(string($date),1,4)) return ($year mod 4 = 0 and $year mod 100 != 0) or $year mod 400 = 0 } ;\n" + " (functx:is-leap-year('2005-02-15'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year . */ @org.junit.Test public void functxFunctxIsLeapYearAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year :)\n" + " declare function functx:is-leap-year ( $date as xs:anyAtomicType? ) as xs:boolean { for $year in xs:integer(substring(string($date),1,4)) return ($year mod 4 = 0 and $year mod 100 != 0) or $year mod 400 = 0 } ;\n" + " (functx:is-leap-year(xs:date('2004-01-23')), functx:is-leap-year(2004), functx:is-leap-year('2005-02-15'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true false") ); } /** * ~ : Whether an XML node is among the descendants of a sequence, based on node identity : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-among-descendants.html : @param $node the node to test : @param $seq the sequence of nodes to search . */ @org.junit.Test public void functxFunctxIsNodeAmongDescendants1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is among the descendants of a sequence, based on node identity : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-among-descendants.html : @param $node the node to test : @param $seq the sequence of nodes to search :)\n" + " declare function functx:is-node-among-descendants ( $node as node()? , $seq as node()* ) as xs:boolean { some $nodeInSeq in $seq/descendant-or-self::*/(.|@*) satisfies $nodeInSeq is $node } ;\n" + " let $in-xml := return let $aPrice := return (functx:is-node-among-descendants( $in-xml/price[1],$in-xml))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether an XML node is among the descendants of a sequence, based on node identity : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-among-descendants.html : @param $node the node to test : @param $seq the sequence of nodes to search . */ @org.junit.Test public void functxFunctxIsNodeAmongDescendants2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is among the descendants of a sequence, based on node identity : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-among-descendants.html : @param $node the node to test : @param $seq the sequence of nodes to search :)\n" + " declare function functx:is-node-among-descendants ( $node as node()? , $seq as node()* ) as xs:boolean { some $nodeInSeq in $seq/descendant-or-self::*/(.|@*) satisfies $nodeInSeq is $node } ;\n" + " let $in-xml := return let $aPrice := return (functx:is-node-among-descendants( $in-xml,$in-xml/price[1]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an XML node is among the descendants of a sequence, based on node identity : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-among-descendants.html : @param $node the node to test : @param $seq the sequence of nodes to search . */ @org.junit.Test public void functxFunctxIsNodeAmongDescendants3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is among the descendants of a sequence, based on node identity : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-among-descendants.html : @param $node the node to test : @param $seq the sequence of nodes to search :)\n" + " declare function functx:is-node-among-descendants ( $node as node()? , $seq as node()* ) as xs:boolean { some $nodeInSeq in $seq/descendant-or-self::*/(.|@*) satisfies $nodeInSeq is $node } ;\n" + " let $in-xml := return let $aPrice := return (functx:is-node-among-descendants( $in-xml,$in-xml))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether an XML node is among the descendants of a sequence, based on node identity : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-among-descendants.html : @param $node the node to test : @param $seq the sequence of nodes to search . */ @org.junit.Test public void functxFunctxIsNodeAmongDescendants4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is among the descendants of a sequence, based on node identity : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-among-descendants.html : @param $node the node to test : @param $seq the sequence of nodes to search :)\n" + " declare function functx:is-node-among-descendants ( $node as node()? , $seq as node()* ) as xs:boolean { some $nodeInSeq in $seq/descendant-or-self::*/(.|@*) satisfies $nodeInSeq is $node } ;\n" + " let $in-xml := return let $aPrice := return (functx:is-node-among-descendants( $aPrice,$in-xml))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an XML node is among the descendants of a sequence, based on node identity : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-among-descendants.html : @param $node the node to test : @param $seq the sequence of nodes to search . */ @org.junit.Test public void functxFunctxIsNodeAmongDescendantsAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is among the descendants of a sequence, based on node identity : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-among-descendants.html : @param $node the node to test : @param $seq the sequence of nodes to search :)\n" + " declare function functx:is-node-among-descendants ( $node as node()? , $seq as node()* ) as xs:boolean { some $nodeInSeq in $seq/descendant-or-self::*/(.|@*) satisfies $nodeInSeq is $node } ;\n" + " let $in-xml := return let $aPrice := return (functx:is-node-among-descendants( $in-xml/price[1],$in-xml), functx:is-node-among-descendants( $in-xml,$in-xml/price[1]), functx:is-node-among-descendants( $in-xml,$in-xml), functx:is-node-among-descendants( $aPrice,$in-xml))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true false true false") ); } /** * ~ : Whether an XML node is among the descendants of a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-among-descendants-deep-equal.html : @param $node the node to test : @param $seq the sequence of nodes to search . */ @org.junit.Test public void functxFunctxIsNodeAmongDescendantsDeepEqual1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is among the descendants of a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-among-descendants-deep-equal.html : @param $node the node to test : @param $seq the sequence of nodes to search :)\n" + " declare function functx:is-node-among-descendants-deep-equal ( $node as node()? , $seq as node()* ) as xs:boolean { some $nodeInSeq in $seq/descendant-or-self::*/(.|@*) satisfies deep-equal($nodeInSeq,$node) } ;\n" + " let $in-xml := Kate Jones John Doe return let $anAuthor := John Doe return let $anotherAuthor := Doe John return (functx:is-node-among-descendants-deep-equal( $in-xml/author[1],$in-xml))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether an XML node is among the descendants of a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-among-descendants-deep-equal.html : @param $node the node to test : @param $seq the sequence of nodes to search . */ @org.junit.Test public void functxFunctxIsNodeAmongDescendantsDeepEqual2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is among the descendants of a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-among-descendants-deep-equal.html : @param $node the node to test : @param $seq the sequence of nodes to search :)\n" + " declare function functx:is-node-among-descendants-deep-equal ( $node as node()? , $seq as node()* ) as xs:boolean { some $nodeInSeq in $seq/descendant-or-self::*/(.|@*) satisfies deep-equal($nodeInSeq,$node) } ;\n" + " let $in-xml := Kate Jones John Doe return let $anAuthor := John Doe return let $anotherAuthor := Doe John return (functx:is-node-among-descendants-deep-equal( $anAuthor,$in-xml))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether an XML node is among the descendants of a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-among-descendants-deep-equal.html : @param $node the node to test : @param $seq the sequence of nodes to search . */ @org.junit.Test public void functxFunctxIsNodeAmongDescendantsDeepEqual3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is among the descendants of a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-among-descendants-deep-equal.html : @param $node the node to test : @param $seq the sequence of nodes to search :)\n" + " declare function functx:is-node-among-descendants-deep-equal ( $node as node()? , $seq as node()* ) as xs:boolean { some $nodeInSeq in $seq/descendant-or-self::*/(.|@*) satisfies deep-equal($nodeInSeq,$node) } ;\n" + " let $in-xml := Kate Jones John Doe return let $anAuthor := John Doe return let $anotherAuthor := Doe John return (functx:is-node-among-descendants-deep-equal( $anotherAuthor,$in-xml))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an XML node is among the descendants of a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-among-descendants-deep-equal.html : @param $node the node to test : @param $seq the sequence of nodes to search . */ @org.junit.Test public void functxFunctxIsNodeAmongDescendantsDeepEqual4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is among the descendants of a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-among-descendants-deep-equal.html : @param $node the node to test : @param $seq the sequence of nodes to search :)\n" + " declare function functx:is-node-among-descendants-deep-equal ( $node as node()? , $seq as node()* ) as xs:boolean { some $nodeInSeq in $seq/descendant-or-self::*/(.|@*) satisfies deep-equal($nodeInSeq,$node) } ;\n" + " let $in-xml := Kate Jones John Doe return let $anAuthor := John Doe return let $anotherAuthor := Doe John return (functx:is-node-among-descendants-deep-equal( $anAuthor,$in-xml/author))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether an XML node is among the descendants of a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-among-descendants-deep-equal.html : @param $node the node to test : @param $seq the sequence of nodes to search . */ @org.junit.Test public void functxFunctxIsNodeAmongDescendantsDeepEqualAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is among the descendants of a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-among-descendants-deep-equal.html : @param $node the node to test : @param $seq the sequence of nodes to search :)\n" + " declare function functx:is-node-among-descendants-deep-equal ( $node as node()? , $seq as node()* ) as xs:boolean { some $nodeInSeq in $seq/descendant-or-self::*/(.|@*) satisfies deep-equal($nodeInSeq,$node) } ;\n" + " let $in-xml := Kate Jones John Doe return let $anAuthor := John Doe return let $anotherAuthor := Doe John return (functx:is-node-among-descendants-deep-equal( $in-xml/author[1],$in-xml), functx:is-node-among-descendants-deep-equal( $anAuthor,$in-xml), functx:is-node-among-descendants-deep-equal( $anotherAuthor,$in-xml), functx:is-node-among-descendants-deep-equal( $anAuthor,$in-xml/author))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true false true") ); } /** * ~ : Whether an XML node is in a sequence, based on node identity : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence.html : @param $node the node to test : @param $seq the sequence of nodes to search . */ @org.junit.Test public void functxFunctxIsNodeInSequence1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is in a sequence, based on node identity : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence.html : @param $node the node to test : @param $seq the sequence of nodes to search :)\n" + " declare function functx:is-node-in-sequence ( $node as node()? , $seq as node()* ) as xs:boolean { some $nodeInSeq in $seq satisfies $nodeInSeq is $node } ;\n" + " let $in-xml := return let $aPrice := return (functx:is-node-in-sequence( $in-xml/price[1],$in-xml/price))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether an XML node is in a sequence, based on node identity : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence.html : @param $node the node to test : @param $seq the sequence of nodes to search . */ @org.junit.Test public void functxFunctxIsNodeInSequence2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is in a sequence, based on node identity : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence.html : @param $node the node to test : @param $seq the sequence of nodes to search :)\n" + " declare function functx:is-node-in-sequence ( $node as node()? , $seq as node()* ) as xs:boolean { some $nodeInSeq in $seq satisfies $nodeInSeq is $node } ;\n" + " let $in-xml := return let $aPrice := return (functx:is-node-in-sequence( $in-xml/price[1],$in-xml))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an XML node is in a sequence, based on node identity : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence.html : @param $node the node to test : @param $seq the sequence of nodes to search . */ @org.junit.Test public void functxFunctxIsNodeInSequence3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is in a sequence, based on node identity : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence.html : @param $node the node to test : @param $seq the sequence of nodes to search :)\n" + " declare function functx:is-node-in-sequence ( $node as node()? , $seq as node()* ) as xs:boolean { some $nodeInSeq in $seq satisfies $nodeInSeq is $node } ;\n" + " let $in-xml := return let $aPrice := return (functx:is-node-in-sequence( $aPrice,$in-xml/price))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an XML node is in a sequence, based on node identity : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence.html : @param $node the node to test : @param $seq the sequence of nodes to search . */ @org.junit.Test public void functxFunctxIsNodeInSequenceAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is in a sequence, based on node identity : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence.html : @param $node the node to test : @param $seq the sequence of nodes to search :)\n" + " declare function functx:is-node-in-sequence ( $node as node()? , $seq as node()* ) as xs:boolean { some $nodeInSeq in $seq satisfies $nodeInSeq is $node } ;\n" + " let $in-xml := return let $aPrice := return (functx:is-node-in-sequence( $in-xml/price[1],$in-xml/price), functx:is-node-in-sequence( $in-xml/price[1],$in-xml), functx:is-node-in-sequence( $aPrice,$in-xml/price))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true false false") ); } /** * ~ : Whether an XML node is in a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence-deep-equal.html : @param $node the node to test : @param $seq the sequence of nodes to search . */ @org.junit.Test public void functxFunctxIsNodeInSequenceDeepEqual1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is in a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence-deep-equal.html : @param $node the node to test : @param $seq the sequence of nodes to search :)\n" + " declare function functx:is-node-in-sequence-deep-equal ( $node as node()? , $seq as node()* ) as xs:boolean { some $nodeInSeq in $seq satisfies deep-equal($nodeInSeq,$node) } ;\n" + " let $in-xml := Kate Jones John Doe return let $anAuthor := John Doe return (functx:is-node-in-sequence-deep-equal( $in-xml/author[1],$in-xml/author))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether an XML node is in a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence-deep-equal.html : @param $node the node to test : @param $seq the sequence of nodes to search . */ @org.junit.Test public void functxFunctxIsNodeInSequenceDeepEqual2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is in a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence-deep-equal.html : @param $node the node to test : @param $seq the sequence of nodes to search :)\n" + " declare function functx:is-node-in-sequence-deep-equal ( $node as node()? , $seq as node()* ) as xs:boolean { some $nodeInSeq in $seq satisfies deep-equal($nodeInSeq,$node) } ;\n" + " let $in-xml := Kate Jones John Doe return let $anAuthor := John Doe return (functx:is-node-in-sequence-deep-equal( $anAuthor,$in-xml/author))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether an XML node is in a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence-deep-equal.html : @param $node the node to test : @param $seq the sequence of nodes to search . */ @org.junit.Test public void functxFunctxIsNodeInSequenceDeepEqual3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is in a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence-deep-equal.html : @param $node the node to test : @param $seq the sequence of nodes to search :)\n" + " declare function functx:is-node-in-sequence-deep-equal ( $node as node()? , $seq as node()* ) as xs:boolean { some $nodeInSeq in $seq satisfies deep-equal($nodeInSeq,$node) } ;\n" + " let $in-xml := Kate Jones John Doe return let $anAuthor := John Doe return (functx:is-node-in-sequence-deep-equal( $in-xml/author[1],$in-xml))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an XML node is in a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence-deep-equal.html : @param $node the node to test : @param $seq the sequence of nodes to search . */ @org.junit.Test public void functxFunctxIsNodeInSequenceDeepEqualAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node is in a sequence, based on contents and attributes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-node-in-sequence-deep-equal.html : @param $node the node to test : @param $seq the sequence of nodes to search :)\n" + " declare function functx:is-node-in-sequence-deep-equal ( $node as node()? , $seq as node()* ) as xs:boolean { some $nodeInSeq in $seq satisfies deep-equal($nodeInSeq,$node) } ;\n" + " let $in-xml := Kate Jones John Doe return let $anAuthor := John Doe return (functx:is-node-in-sequence-deep-equal( $in-xml/author[1],$in-xml/author), functx:is-node-in-sequence-deep-equal( $anAuthor,$in-xml/author), functx:is-node-in-sequence-deep-equal( $in-xml/author[1],$in-xml))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true false") ); } /** * ~ : Whether an atomic value appears in a sequence : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-value-in-sequence.html : @param $value the atomic value to test : @param $seq the sequence of values to search . */ @org.junit.Test public void functxFunctxIsValueInSequence1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an atomic value appears in a sequence : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-value-in-sequence.html : @param $value the atomic value to test : @param $seq the sequence of values to search :)\n" + " declare function functx:is-value-in-sequence ( $value as xs:anyAtomicType? , $seq as xs:anyAtomicType* ) as xs:boolean { $value = $seq } ;\n" + " (functx:is-value-in-sequence(1,(1,2,3)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether an atomic value appears in a sequence : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-value-in-sequence.html : @param $value the atomic value to test : @param $seq the sequence of values to search . */ @org.junit.Test public void functxFunctxIsValueInSequence2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an atomic value appears in a sequence : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-value-in-sequence.html : @param $value the atomic value to test : @param $seq the sequence of values to search :)\n" + " declare function functx:is-value-in-sequence ( $value as xs:anyAtomicType? , $seq as xs:anyAtomicType* ) as xs:boolean { $value = $seq } ;\n" + " (functx:is-value-in-sequence(5,(1,2,3)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an atomic value appears in a sequence : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-value-in-sequence.html : @param $value the atomic value to test : @param $seq the sequence of values to search . */ @org.junit.Test public void functxFunctxIsValueInSequence3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an atomic value appears in a sequence : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-value-in-sequence.html : @param $value the atomic value to test : @param $seq the sequence of values to search :)\n" + " declare function functx:is-value-in-sequence ( $value as xs:anyAtomicType? , $seq as xs:anyAtomicType* ) as xs:boolean { $value = $seq } ;\n" + " (functx:is-value-in-sequence(1.0,(1,2,3)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether an atomic value appears in a sequence : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-value-in-sequence.html : @param $value the atomic value to test : @param $seq the sequence of values to search . */ @org.junit.Test public void functxFunctxIsValueInSequenceAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an atomic value appears in a sequence : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-value-in-sequence.html : @param $value the atomic value to test : @param $seq the sequence of values to search :)\n" + " declare function functx:is-value-in-sequence ( $value as xs:anyAtomicType? , $seq as xs:anyAtomicType* ) as xs:boolean { $value = $seq } ;\n" + " (functx:is-value-in-sequence(1,(1,2,3)), functx:is-value-in-sequence(5,(1,2,3)), functx:is-value-in-sequence(1.0,(1,2,3)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true false true") ); } /** * ~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day ~ : Number of days in the month : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_days-in-month.html : @param $date the date ~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year ~ : The last day of the month of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_last-day-of-month.html : @param $date the date ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxLastDayOfMonth1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day :)\n" + " declare function functx:date ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType ) as xs:date { xs:date( concat( functx:pad-integer-to-length(xs:integer($year),4),'-', functx:pad-integer-to-length(xs:integer($month),2),'-', functx:pad-integer-to-length(xs:integer($day),2))) } ;\n" + " (:~ : Number of days in the month : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_days-in-month.html : @param $date the date :)\n" + " declare function functx:days-in-month ( $date as xs:anyAtomicType? ) as xs:integer? { if (month-from-date(xs:date($date)) = 2 and functx:is-leap-year($date)) then 29 else (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) [month-from-date(xs:date($date))] } ;\n" + " (:~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year :)\n" + " declare function functx:is-leap-year ( $date as xs:anyAtomicType? ) as xs:boolean { for $year in xs:integer(substring(string($date),1,4)) return ($year mod 4 = 0 and $year mod 100 != 0) or $year mod 400 = 0 } ;\n" + " (:~ : The last day of the month of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_last-day-of-month.html : @param $date the date :)\n" + " declare function functx:last-day-of-month ( $date as xs:anyAtomicType? ) as xs:date? { functx:date(year-from-date(xs:date($date)), month-from-date(xs:date($date)), functx:days-in-month($date)) } ;\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:last-day-of-month(xs:date('2004-01-23')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-01-31") ); } /** * ~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day ~ : Number of days in the month : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_days-in-month.html : @param $date the date ~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year ~ : The last day of the month of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_last-day-of-month.html : @param $date the date ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxLastDayOfMonth2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day :)\n" + " declare function functx:date ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType ) as xs:date { xs:date( concat( functx:pad-integer-to-length(xs:integer($year),4),'-', functx:pad-integer-to-length(xs:integer($month),2),'-', functx:pad-integer-to-length(xs:integer($day),2))) } ;\n" + " (:~ : Number of days in the month : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_days-in-month.html : @param $date the date :)\n" + " declare function functx:days-in-month ( $date as xs:anyAtomicType? ) as xs:integer? { if (month-from-date(xs:date($date)) = 2 and functx:is-leap-year($date)) then 29 else (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) [month-from-date(xs:date($date))] } ;\n" + " (:~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year :)\n" + " declare function functx:is-leap-year ( $date as xs:anyAtomicType? ) as xs:boolean { for $year in xs:integer(substring(string($date),1,4)) return ($year mod 4 = 0 and $year mod 100 != 0) or $year mod 400 = 0 } ;\n" + " (:~ : The last day of the month of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_last-day-of-month.html : @param $date the date :)\n" + " declare function functx:last-day-of-month ( $date as xs:anyAtomicType? ) as xs:date? { functx:date(year-from-date(xs:date($date)), month-from-date(xs:date($date)), functx:days-in-month($date)) } ;\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:last-day-of-month( xs:dateTime('2004-09-23T12:00:13')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-09-30") ); } /** * ~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day ~ : Number of days in the month : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_days-in-month.html : @param $date the date ~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year ~ : The last day of the month of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_last-day-of-month.html : @param $date the date ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxLastDayOfMonth3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day :)\n" + " declare function functx:date ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType ) as xs:date { xs:date( concat( functx:pad-integer-to-length(xs:integer($year),4),'-', functx:pad-integer-to-length(xs:integer($month),2),'-', functx:pad-integer-to-length(xs:integer($day),2))) } ;\n" + " (:~ : Number of days in the month : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_days-in-month.html : @param $date the date :)\n" + " declare function functx:days-in-month ( $date as xs:anyAtomicType? ) as xs:integer? { if (month-from-date(xs:date($date)) = 2 and functx:is-leap-year($date)) then 29 else (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) [month-from-date(xs:date($date))] } ;\n" + " (:~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year :)\n" + " declare function functx:is-leap-year ( $date as xs:anyAtomicType? ) as xs:boolean { for $year in xs:integer(substring(string($date),1,4)) return ($year mod 4 = 0 and $year mod 100 != 0) or $year mod 400 = 0 } ;\n" + " (:~ : The last day of the month of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_last-day-of-month.html : @param $date the date :)\n" + " declare function functx:last-day-of-month ( $date as xs:anyAtomicType? ) as xs:date? { functx:date(year-from-date(xs:date($date)), month-from-date(xs:date($date)), functx:days-in-month($date)) } ;\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:last-day-of-month('2004-03-23'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-03-31") ); } /** * ~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day ~ : Number of days in the month : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_days-in-month.html : @param $date the date ~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year ~ : The last day of the month of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_last-day-of-month.html : @param $date the date ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxLastDayOfMonthAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day :)\n" + " declare function functx:date ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType ) as xs:date { xs:date( concat( functx:pad-integer-to-length(xs:integer($year),4),'-', functx:pad-integer-to-length(xs:integer($month),2),'-', functx:pad-integer-to-length(xs:integer($day),2))) } ;\n" + " (:~ : Number of days in the month : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_days-in-month.html : @param $date the date :)\n" + " declare function functx:days-in-month ( $date as xs:anyAtomicType? ) as xs:integer? { if (month-from-date(xs:date($date)) = 2 and functx:is-leap-year($date)) then 29 else (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) [month-from-date(xs:date($date))] } ;\n" + " (:~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year :)\n" + " declare function functx:is-leap-year ( $date as xs:anyAtomicType? ) as xs:boolean { for $year in xs:integer(substring(string($date),1,4)) return ($year mod 4 = 0 and $year mod 100 != 0) or $year mod 400 = 0 } ;\n" + " (:~ : The last day of the month of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_last-day-of-month.html : @param $date the date :)\n" + " declare function functx:last-day-of-month ( $date as xs:anyAtomicType? ) as xs:date? { functx:date(year-from-date(xs:date($date)), month-from-date(xs:date($date)), functx:days-in-month($date)) } ;\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:last-day-of-month(xs:date('2004-01-23')), functx:last-day-of-month( xs:dateTime('2004-09-23T12:00:13')), functx:last-day-of-month('2004-03-23'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-01-31 2004-09-30 2004-03-31") ); } /** * ~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day ~ : Number of days in the month : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_days-in-month.html : @param $date the date ~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year ~ : The last day of the month of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_last-day-of-year.html : @param $date the date ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxLastDayOfYear1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day :)\n" + " declare function functx:date ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType ) as xs:date { xs:date( concat( functx:pad-integer-to-length(xs:integer($year),4),'-', functx:pad-integer-to-length(xs:integer($month),2),'-', functx:pad-integer-to-length(xs:integer($day),2))) } ;\n" + " (:~ : Number of days in the month : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_days-in-month.html : @param $date the date :)\n" + " declare function functx:days-in-month ( $date as xs:anyAtomicType? ) as xs:integer? { if (month-from-date(xs:date($date)) = 2 and functx:is-leap-year($date)) then 29 else (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) [month-from-date(xs:date($date))] } ;\n" + " (:~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year :)\n" + " declare function functx:is-leap-year ( $date as xs:anyAtomicType? ) as xs:boolean { for $year in xs:integer(substring(string($date),1,4)) return ($year mod 4 = 0 and $year mod 100 != 0) or $year mod 400 = 0 } ;\n" + " (:~ : The last day of the month of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_last-day-of-year.html : @param $date the date :)\n" + " declare function functx:last-day-of-year ( $date as xs:anyAtomicType? ) as xs:date? { functx:date(year-from-date(xs:date($date)), 12, 31) } ;\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:last-day-of-year(xs:date('2004-01-23')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-12-31") ); } /** * ~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day ~ : Number of days in the month : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_days-in-month.html : @param $date the date ~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year ~ : The last day of the month of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_last-day-of-year.html : @param $date the date ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxLastDayOfYear2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day :)\n" + " declare function functx:date ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType ) as xs:date { xs:date( concat( functx:pad-integer-to-length(xs:integer($year),4),'-', functx:pad-integer-to-length(xs:integer($month),2),'-', functx:pad-integer-to-length(xs:integer($day),2))) } ;\n" + " (:~ : Number of days in the month : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_days-in-month.html : @param $date the date :)\n" + " declare function functx:days-in-month ( $date as xs:anyAtomicType? ) as xs:integer? { if (month-from-date(xs:date($date)) = 2 and functx:is-leap-year($date)) then 29 else (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) [month-from-date(xs:date($date))] } ;\n" + " (:~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year :)\n" + " declare function functx:is-leap-year ( $date as xs:anyAtomicType? ) as xs:boolean { for $year in xs:integer(substring(string($date),1,4)) return ($year mod 4 = 0 and $year mod 100 != 0) or $year mod 400 = 0 } ;\n" + " (:~ : The last day of the month of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_last-day-of-year.html : @param $date the date :)\n" + " declare function functx:last-day-of-year ( $date as xs:anyAtomicType? ) as xs:date? { functx:date(year-from-date(xs:date($date)), 12, 31) } ;\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:last-day-of-year( xs:dateTime('2004-12-23T12:00:13')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-12-31") ); } /** * ~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day ~ : Number of days in the month : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_days-in-month.html : @param $date the date ~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year ~ : The last day of the month of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_last-day-of-year.html : @param $date the date ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxLastDayOfYear3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day :)\n" + " declare function functx:date ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType ) as xs:date { xs:date( concat( functx:pad-integer-to-length(xs:integer($year),4),'-', functx:pad-integer-to-length(xs:integer($month),2),'-', functx:pad-integer-to-length(xs:integer($day),2))) } ;\n" + " (:~ : Number of days in the month : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_days-in-month.html : @param $date the date :)\n" + " declare function functx:days-in-month ( $date as xs:anyAtomicType? ) as xs:integer? { if (month-from-date(xs:date($date)) = 2 and functx:is-leap-year($date)) then 29 else (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) [month-from-date(xs:date($date))] } ;\n" + " (:~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year :)\n" + " declare function functx:is-leap-year ( $date as xs:anyAtomicType? ) as xs:boolean { for $year in xs:integer(substring(string($date),1,4)) return ($year mod 4 = 0 and $year mod 100 != 0) or $year mod 400 = 0 } ;\n" + " (:~ : The last day of the month of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_last-day-of-year.html : @param $date the date :)\n" + " declare function functx:last-day-of-year ( $date as xs:anyAtomicType? ) as xs:date? { functx:date(year-from-date(xs:date($date)), 12, 31) } ;\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:last-day-of-year('2004-03-23'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-12-31") ); } /** * ~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day ~ : Number of days in the month : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_days-in-month.html : @param $date the date ~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year ~ : The last day of the month of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_last-day-of-year.html : @param $date the date ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxLastDayOfYearAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Construct a date from a year, month and day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_date.html : @param $year the year : @param $month the month : @param $day the day :)\n" + " declare function functx:date ( $year as xs:anyAtomicType , $month as xs:anyAtomicType , $day as xs:anyAtomicType ) as xs:date { xs:date( concat( functx:pad-integer-to-length(xs:integer($year),4),'-', functx:pad-integer-to-length(xs:integer($month),2),'-', functx:pad-integer-to-length(xs:integer($day),2))) } ;\n" + " (:~ : Number of days in the month : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_days-in-month.html : @param $date the date :)\n" + " declare function functx:days-in-month ( $date as xs:anyAtomicType? ) as xs:integer? { if (month-from-date(xs:date($date)) = 2 and functx:is-leap-year($date)) then 29 else (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) [month-from-date(xs:date($date))] } ;\n" + " (:~ : Whether a date falls in a leap year : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_is-leap-year.html : @param $date the date or year :)\n" + " declare function functx:is-leap-year ( $date as xs:anyAtomicType? ) as xs:boolean { for $year in xs:integer(substring(string($date),1,4)) return ($year mod 4 = 0 and $year mod 100 != 0) or $year mod 400 = 0 } ;\n" + " (:~ : The last day of the month of a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_last-day-of-year.html : @param $date the date :)\n" + " declare function functx:last-day-of-year ( $date as xs:anyAtomicType? ) as xs:date? { functx:date(year-from-date(xs:date($date)), 12, 31) } ;\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:last-day-of-year(xs:date('2004-01-23')), functx:last-day-of-year( xs:dateTime('2004-12-23T12:00:13')), functx:last-day-of-year('2004-03-23'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-12-31 2004-12-31 2004-12-31") ); } /** * ~ : The XML node in a sequence that is last in document order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_last-node.html : @param $nodes the sequence of nodes . */ @org.junit.Test public void functxFunctxLastNode1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The XML node in a sequence that is last in document order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_last-node.html : @param $nodes the sequence of nodes :)\n" + " declare function functx:last-node ( $nodes as node()* ) as node()? { ($nodes/.)[last()] } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:last-node($in-xml//fName))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("John", false) ); } /** * ~ : The XML node in a sequence that is last in document order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_last-node.html : @param $nodes the sequence of nodes . */ @org.junit.Test public void functxFunctxLastNode2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The XML node in a sequence that is last in document order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_last-node.html : @param $nodes the sequence of nodes :)\n" + " declare function functx:last-node ( $nodes as node()* ) as node()? { ($nodes/.)[last()] } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:last-node( ($in-xml//lName, $in-xml//fName) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Doe", false) ); } /** * ~ : The XML node in a sequence that is last in document order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_last-node.html : @param $nodes the sequence of nodes . */ @org.junit.Test public void functxFunctxLastNodeAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The XML node in a sequence that is last in document order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_last-node.html : @param $nodes the sequence of nodes :)\n" + " declare function functx:last-node ( $nodes as node()* ) as node()? { ($nodes/.)[last()] } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:last-node($in-xml//fName), functx:last-node( ($in-xml//lName, $in-xml//fName) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("JohnDoe", false) ); } /** * * All XML elements that don't have any child elements * @author Priscilla Walmsley, Datypic * @version 1.0 * @see http://www.xqueryfunctions.com/xq/functx_leaf-elements.html * @param $root the root * . */ @org.junit.Test public void functxFunctxLeafElements1() { final XQuery query = new XQuery( "\n" + " \tdeclare namespace functx = \"http://www.example.com/\";\n" + " \tdeclare function functx:leaf-elements ( $root as node()? ) as element()* { $root/descendant-or-self::*[not(*)] } ;\n" + " let $in-xml := Kate Jones \n" + " John Doe \n" + " \n" + " return (functx:leaf-elements($in-xml))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("KateJonesJohnDoe", false) ); } /** * * All XML elements that don't have any child elements * @author Priscilla Walmsley, Datypic * @version 1.0 * @see http://www.xqueryfunctions.com/xq/functx_leaf-elements.html * @param $root the root * . */ @org.junit.Test public void functxFunctxLeafElements2() { final XQuery query = new XQuery( "\n" + " \tdeclare namespace functx = \"http://www.example.com/\";\n" + " declare function functx:leaf-elements ( $root as node()? ) as element()* { $root/descendant-or-self::*[not(*)] } ;\n" + " let $in-xml := Kate Jones \n" + " John Doe \n" + " \n" + " return (functx:leaf-elements($in-xml/author[1]))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("KateJones", false) ); } /** * * All XML elements that don't have any child elements * @author Priscilla Walmsley, Datypic * @version 1.0 * @see http://www.xqueryfunctions.com/xq/functx_leaf-elements.html * @param $root the root * . */ @org.junit.Test public void functxFunctxLeafElementsAll() { final XQuery query = new XQuery( "\n" + " \tdeclare namespace functx = \"http://www.example.com/\";\n" + " declare function functx:leaf-elements ( $root as node()? ) as element()* { $root/descendant-or-self::*[not(*)] } ;\n" + " let $in-xml := Kate Jones \n" + " John Doe \n" + " \n" + " return (functx:leaf-elements($in-xml), functx:leaf-elements($in-xml/author[1]))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("KateJonesJohnDoeKateJones", false) ); } /** * ~ : Trims leading whitespace : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_left-trim.html : @param $arg the string to trim . */ @org.junit.Test public void functxFunctxLeftTrim1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Trims leading whitespace : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_left-trim.html : @param $arg the string to trim :)\n" + " declare function functx:left-trim ( $arg as xs:string? ) as xs:string { replace($arg,'^\\s+','') } ;\n" + " (functx:left-trim(' xyz'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xyz") ); } /** * ~ : Trims leading whitespace : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_left-trim.html : @param $arg the string to trim . */ @org.junit.Test public void functxFunctxLeftTrim2() { final XQuery query = new XQuery( "\n" + " declare namespace functx = \"http://www.example.com/\";\n" + " declare function functx:left-trim ( $arg as xs:string? ) as xs:string { replace($arg,'^\\s+','') } ;\n" + " (functx:left-trim(' xyz x'))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xyz x") ); } /** * ~ : Trims leading whitespace : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_left-trim.html : @param $arg the string to trim . */ @org.junit.Test public void functxFunctxLeftTrim3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Trims leading whitespace : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_left-trim.html : @param $arg the string to trim :)\n" + " declare function functx:left-trim ( $arg as xs:string? ) as xs:string { replace($arg,'^\\s+','') } ;\n" + " (functx:left-trim('xyz'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xyz") ); } /** * ~ : Trims leading whitespace : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_left-trim.html : @param $arg the string to trim . */ @org.junit.Test public void functxFunctxLeftTrimAll() { final XQuery query = new XQuery( "\n" + " declare namespace functx = \"http://www.example.com/\";\n" + " declare function functx:left-trim ( $arg as xs:string? ) as xs:string { replace($arg,'^\\s+','') } ;\n" + " (functx:left-trim(' xyz'), functx:left-trim(' xyz x'), functx:left-trim('xyz'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xyz xyz x xyz") ); } /** * ~ : The number of lines : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_line-count.html : @param $arg the string to test ~ : Split a string into separate lines : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_lines.html : @param $arg the string to split . */ @org.junit.Test public void functxFunctxLineCount1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The number of lines : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_line-count.html : @param $arg the string to test :)\n" + " declare function functx:line-count ( $arg as xs:string? ) as xs:integer { count(functx:lines($arg)) } ;\n" + " (:~ : Split a string into separate lines : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_lines.html : @param $arg the string to split :)\n" + " declare function functx:lines ( $arg as xs:string? ) as xs:string* { tokenize($arg, '(\\r\\n?|\\n\\r?)') } ;\n" + " let $lines := 'a value on many lines' return (functx:line-count('a value'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * ~ : The number of lines : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_line-count.html : @param $arg the string to test ~ : Split a string into separate lines : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_lines.html : @param $arg the string to split . */ @org.junit.Test public void functxFunctxLineCount2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The number of lines : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_line-count.html : @param $arg the string to test :)\n" + " declare function functx:line-count ( $arg as xs:string? ) as xs:integer { count(functx:lines($arg)) } ;\n" + " (:~ : Split a string into separate lines : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_lines.html : @param $arg the string to split :)\n" + " declare function functx:lines ( $arg as xs:string? ) as xs:string* { tokenize($arg, '(\\r\\n?|\\n\\r?)') } ;\n" + " let $lines := 'a \n" + " value \n" + " on \n" + " many \n" + " lines' return (functx:line-count($lines))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** * ~ : The number of lines : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_line-count.html : @param $arg the string to test ~ : Split a string into separate lines : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_lines.html : @param $arg the string to split . */ @org.junit.Test public void functxFunctxLineCountAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The number of lines : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_line-count.html : @param $arg the string to test :)\n" + " declare function functx:line-count ( $arg as xs:string? ) as xs:integer { count(functx:lines($arg)) } ;\n" + " (:~ : Split a string into separate lines : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_lines.html : @param $arg the string to split :)\n" + " declare function functx:lines ( $arg as xs:string? ) as xs:string* { tokenize($arg, '(\\r\\n?|\\n\\r?)') } ;\n" + " let $lines := 'a \n" + " value \n" + " on \n" + " many \n" + " lines' \n" + " return (functx:line-count('a value'), functx:line-count($lines))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 5") ); } /** * ~ : Split a string into separate lines : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_lines.html : @param $arg the string to split . */ @org.junit.Test public void functxFunctxLines1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Split a string into separate lines : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_lines.html : @param $arg the string to split :)\n" + " declare function functx:lines ( $arg as xs:string? ) as xs:string* { tokenize($arg, '(\\r\\n?|\\n\\r?)') } ;\n" + " let $in-xml := a value on many lines return (functx:lines('a value'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a value") ); } /** * ~ : Split a string into separate lines : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_lines.html : @param $arg the string to split . */ @org.junit.Test public void functxFunctxLines2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Split a string into separate lines : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_lines.html : @param $arg the string to split :)\n" + " declare function functx:lines ( $arg as xs:string? ) as xs:string* { tokenize($arg, '(\\r\\n?|\\n\\r?)') } ;\n" + " let $in-xml := a value on many lines return (functx:lines($in-xml))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a value on many lines") ); } /** * ~ : Split a string into separate lines : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_lines.html : @param $arg the string to split . */ @org.junit.Test public void functxFunctxLinesAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Split a string into separate lines : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_lines.html : @param $arg the string to split :)\n" + " declare function functx:lines ( $arg as xs:string? ) as xs:string* { tokenize($arg, '(\\r\\n?|\\n\\r?)') } ;\n" + " let $in-xml := a value on many lines return (functx:lines('a value'), functx:lines($in-xml))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a value a value on many lines") ); } /** * ~ : The maximum depth of elements in an XML tree : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-depth.html : @param $root the root to start from . */ @org.junit.Test public void functxFunctxMaxDepth1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The maximum depth of elements in an XML tree : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-depth.html : @param $root the root to start from :)\n" + " declare function functx:max-depth ( $root as node()? ) as xs:integer? { if ($root/*) then max($root/*/functx:max-depth(.)) + 1 else 1 } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:max-depth($in-xml))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * ~ : The maximum depth of elements in an XML tree : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-depth.html : @param $root the root to start from . */ @org.junit.Test public void functxFunctxMaxDepth2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The maximum depth of elements in an XML tree : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-depth.html : @param $root the root to start from :)\n" + " declare function functx:max-depth ( $root as node()? ) as xs:integer? { if ($root/*) then max($root/*/functx:max-depth(.)) + 1 else 1 } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:max-depth($in-xml/author[1]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * ~ : The maximum depth of elements in an XML tree : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-depth.html : @param $root the root to start from . */ @org.junit.Test public void functxFunctxMaxDepthAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The maximum depth of elements in an XML tree : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-depth.html : @param $root the root to start from :)\n" + " declare function functx:max-depth ( $root as node()? ) as xs:integer? { if ($root/*) then max($root/*/functx:max-depth(.)) + 1 else 1 } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:max-depth($in-xml), functx:max-depth($in-xml/author[1]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3 2") ); } /** * ~ : The maximum value in a sequence, figuring out its type (numeric or string) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-determine-type.html : @param $seq the sequence of values to test . */ @org.junit.Test public void functxFunctxMaxDetermineType1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The maximum value in a sequence, figuring out its type (numeric or string) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-determine-type.html : @param $seq the sequence of values to test :)\n" + " declare function functx:max-determine-type ( $seq as xs:anyAtomicType* ) as xs:anyAtomicType? { if (every $value in $seq satisfies ($value castable as xs:double)) then max(for $value in $seq return xs:double($value)) else max(for $value in $seq return xs:string($value)) } ;\n" + " let $in-xml := 12 23 115 12.5 def abc return (functx:max-determine-type($in-xml//num))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("115") ); } /** * ~ : The maximum value in a sequence, figuring out its type (numeric or string) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-determine-type.html : @param $seq the sequence of values to test . */ @org.junit.Test public void functxFunctxMaxDetermineType2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The maximum value in a sequence, figuring out its type (numeric or string) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-determine-type.html : @param $seq the sequence of values to test :)\n" + " declare function functx:max-determine-type ( $seq as xs:anyAtomicType* ) as xs:anyAtomicType? { if (every $value in $seq satisfies ($value castable as xs:double)) then max(for $value in $seq return xs:double($value)) else max(for $value in $seq return xs:string($value)) } ;\n" + " let $in-xml := 12 23 115 12.5 def abc return (functx:max-determine-type($in-xml//string))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "def") ); } /** * ~ : The maximum value in a sequence, figuring out its type (numeric or string) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-determine-type.html : @param $seq the sequence of values to test . */ @org.junit.Test public void functxFunctxMaxDetermineType3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The maximum value in a sequence, figuring out its type (numeric or string) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-determine-type.html : @param $seq the sequence of values to test :)\n" + " declare function functx:max-determine-type ( $seq as xs:anyAtomicType* ) as xs:anyAtomicType? { if (every $value in $seq satisfies ($value castable as xs:double)) then max(for $value in $seq return xs:double($value)) else max(for $value in $seq return xs:string($value)) } ;\n" + " let $in-xml := 12 23 115 12.5 def abc return (functx:max-determine-type( $in-xml//(num|string)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "def") ); } /** * ~ : The maximum value in a sequence, figuring out its type (numeric or string) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-determine-type.html : @param $seq the sequence of values to test . */ @org.junit.Test public void functxFunctxMaxDetermineTypeAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The maximum value in a sequence, figuring out its type (numeric or string) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-determine-type.html : @param $seq the sequence of values to test :)\n" + " declare function functx:max-determine-type ( $seq as xs:anyAtomicType* ) as xs:anyAtomicType? { if (every $value in $seq satisfies ($value castable as xs:double)) then max(for $value in $seq return xs:double($value)) else max(for $value in $seq return xs:string($value)) } ;\n" + " let $in-xml := 12 23 115 12.5 def abc return (functx:max-determine-type($in-xml//num), functx:max-determine-type($in-xml//string), functx:max-determine-type( $in-xml//(num|string)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "115 def def") ); } /** * ~ : Split a string into separate lines : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_lines.html : @param $arg the string to split ~ : The maximum line length : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-line-length.html : @param $arg the string to test . */ @org.junit.Test public void functxFunctxMaxLineLength1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Split a string into separate lines : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_lines.html : @param $arg the string to split :)\n" + " declare function functx:lines ( $arg as xs:string? ) as xs:string* { tokenize($arg, '(\\r\\n?|\\n\\r?)') } ;\n" + " (:~ : The maximum line length : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-line-length.html : @param $arg the string to test :)\n" + " declare function functx:max-line-length ( $arg as xs:string? ) as xs:integer? { max( for $line in functx:lines($arg) return string-length($line)) } ;\n" + " let $lines := 'a value on several lines' return (functx:max-line-length('a value'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("7") ); } /** * ~ : Split a string into separate lines : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_lines.html : @param $arg the string to split ~ : The maximum line length : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-line-length.html : @param $arg the string to test . */ @org.junit.Test public void functxFunctxMaxLineLength2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Split a string into separate lines : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_lines.html : @param $arg the string to split :)\n" + " declare function functx:lines ( $arg as xs:string? ) as xs:string* { tokenize($arg, '(\\r\\n?|\\n\\r?)') } ;\n" + " (:~ : The maximum line length : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-line-length.html : @param $arg the string to test :)\n" + " declare function functx:max-line-length ( $arg as xs:string? ) as xs:integer? { max( for $line in functx:lines($arg) return string-length($line)) } ;\n" + " let $lines := 'a \n" + " value \n" + " on \n" + " several\n" + " lines' \n" + " return (functx:max-line-length($lines))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("12") ); } /** * ~ : Split a string into separate lines : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_lines.html : @param $arg the string to split ~ : The maximum line length : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-line-length.html : @param $arg the string to test . */ @org.junit.Test public void functxFunctxMaxLineLengthAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Split a string into separate lines : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_lines.html : @param $arg the string to split :)\n" + " declare function functx:lines ( $arg as xs:string? ) as xs:string* { tokenize($arg, '(\\r\\n?|\\n\\r?)') } ;\n" + " (:~ : The maximum line length : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-line-length.html : @param $arg the string to test :)\n" + " declare function functx:max-line-length ( $arg as xs:string? ) as xs:integer? { max( for $line in functx:lines($arg) return string-length($line)) } ;\n" + "let $lines := 'a \n" + " value \n" + " on \n" + " several\n" + " lines' \n" + " return (functx:max-line-length('a value'), functx:max-line-length($lines))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "7 12") ); } /** * ~ : The XML node whose typed value is the maximum : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-node.html : @param $nodes the sequence of nodes to test . */ @org.junit.Test public void functxFunctxMaxNode1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The XML node whose typed value is the maximum : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-node.html : @param $nodes the sequence of nodes to test :)\n" + " declare function functx:max-node ( $nodes as node()* ) as node()* { $nodes[. = max($nodes)] } ;\n" + " let $in-xml := 1 23 115 return (functx:max-node($in-xml//int))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("115", false) ); } /** * ~ : The maximum of a sequence of values, treating them like strings : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-string.html : @param $strings the sequence of values . */ @org.junit.Test public void functxFunctxMaxString1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The maximum of a sequence of values, treating them like strings : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-string.html : @param $strings the sequence of values :)\n" + " declare function functx:max-string ( $strings as xs:anyAtomicType* ) as xs:string? { max(for $string in $strings return string($string)) } ;\n" + " let $in-xml := a c b return (functx:max-string( $in-xml/* ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "c") ); } /** * ~ : The maximum of a sequence of values, treating them like strings : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-string.html : @param $strings the sequence of values . */ @org.junit.Test public void functxFunctxMaxString2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The maximum of a sequence of values, treating them like strings : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-string.html : @param $strings the sequence of values :)\n" + " declare function functx:max-string ( $strings as xs:anyAtomicType* ) as xs:string? { max(for $string in $strings return string($string)) } ;\n" + " let $in-xml := a c b return (functx:max-string( (100,25,3) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * ~ : The maximum of a sequence of values, treating them like strings : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-string.html : @param $strings the sequence of values . */ @org.junit.Test public void functxFunctxMaxStringAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The maximum of a sequence of values, treating them like strings : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_max-string.html : @param $strings the sequence of values :)\n" + " declare function functx:max-string ( $strings as xs:anyAtomicType* ) as xs:string? { max(for $string in $strings return string($string)) } ;\n" + " let $in-xml := a c b return (functx:max-string( $in-xml/* ), functx:max-string( (100,25,3) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "c 3") ); } /** * ~ : The minimum value in a sequence, figuring out its type (numeric or string) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_min-determine-type.html : @param $seq the sequence of values to test . */ @org.junit.Test public void functxFunctxMinDetermineType1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The minimum value in a sequence, figuring out its type (numeric or string) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_min-determine-type.html : @param $seq the sequence of values to test :)\n" + " declare function functx:min-determine-type ( $seq as xs:anyAtomicType* ) as xs:anyAtomicType? { if (every $value in $seq satisfies ($value castable as xs:double)) then min(for $value in $seq return xs:double($value)) else min(for $value in $seq return xs:string($value)) } ;\n" + " let $in-xml := 12 23 115 12.5 def abc return (functx:min-determine-type($in-xml//num))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("12") ); } /** * ~ : The minimum value in a sequence, figuring out its type (numeric or string) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_min-determine-type.html : @param $seq the sequence of values to test . */ @org.junit.Test public void functxFunctxMinDetermineType2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The minimum value in a sequence, figuring out its type (numeric or string) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_min-determine-type.html : @param $seq the sequence of values to test :)\n" + " declare function functx:min-determine-type ( $seq as xs:anyAtomicType* ) as xs:anyAtomicType? { if (every $value in $seq satisfies ($value castable as xs:double)) then min(for $value in $seq return xs:double($value)) else min(for $value in $seq return xs:string($value)) } ;\n" + " let $in-xml := 12 23 115 12.5 def abc return (functx:min-determine-type($in-xml//str))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc") ); } /** * ~ : The minimum value in a sequence, figuring out its type (numeric or string) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_min-determine-type.html : @param $seq the sequence of values to test . */ @org.junit.Test public void functxFunctxMinDetermineType3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The minimum value in a sequence, figuring out its type (numeric or string) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_min-determine-type.html : @param $seq the sequence of values to test :)\n" + " declare function functx:min-determine-type ( $seq as xs:anyAtomicType* ) as xs:anyAtomicType? { if (every $value in $seq satisfies ($value castable as xs:double)) then min(for $value in $seq return xs:double($value)) else min(for $value in $seq return xs:string($value)) } ;\n" + " let $in-xml := 12 23 115 12.5 def abc return (functx:min-determine-type($in-xml//(num|str)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "115") ); } /** * ~ : The minimum value in a sequence, figuring out its type (numeric or string) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_min-determine-type.html : @param $seq the sequence of values to test . */ @org.junit.Test public void functxFunctxMinDetermineTypeAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The minimum value in a sequence, figuring out its type (numeric or string) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_min-determine-type.html : @param $seq the sequence of values to test :)\n" + " declare function functx:min-determine-type ( $seq as xs:anyAtomicType* ) as xs:anyAtomicType? { if (every $value in $seq satisfies ($value castable as xs:double)) then min(for $value in $seq return xs:double($value)) else min(for $value in $seq return xs:string($value)) } ;\n" + " let $in-xml := 12 23 115 12.5 def abc return (functx:min-determine-type($in-xml//num), functx:min-determine-type($in-xml//str), functx:min-determine-type($in-xml//(num|str)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12 abc 115") ); } /** * ~ : The XML node whose typed value is the minimum : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_min-node.html : @param $nodes the sequence of nodes to test . */ @org.junit.Test public void functxFunctxMinNode1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The XML node whose typed value is the minimum : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_min-node.html : @param $nodes the sequence of nodes to test :)\n" + " declare function functx:min-node ( $nodes as node()* ) as node()* { $nodes[. = min($nodes)] } ;\n" + " let $in-xml := 1 23 115 return (functx:min-node($in-xml//int))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1", false) ); } /** * ~ : The minimum of a sequence of strings, ignoring "empty" values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_min-non-empty-string.html : @param $strings the sequence of strings to search . */ @org.junit.Test public void functxFunctxMinNonEmptyString1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The minimum of a sequence of strings, ignoring \"empty\" values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_min-non-empty-string.html : @param $strings the sequence of strings to search :)\n" + " declare function functx:min-non-empty-string ( $strings as xs:string* ) as xs:string? { min($strings[. != '']) } ;\n" + " let $in-xml := Smith Kate Jones John Doe return (functx:min-non-empty-string( $in-xml//fName ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "John") ); } /** * ~ : The minimum of a sequence of values, treating them like strings : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_min-string.html : @param $strings the sequence of strings . */ @org.junit.Test public void functxFunctxMinString1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The minimum of a sequence of values, treating them like strings : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_min-string.html : @param $strings the sequence of strings :)\n" + " declare function functx:min-string ( $strings as xs:anyAtomicType* ) as xs:string? { min(for $string in $strings return string($string)) } ;\n" + " let $in-xml := a c b return (functx:min-string( $in-xml/* ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a") ); } /** * ~ : The minimum of a sequence of values, treating them like strings : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_min-string.html : @param $strings the sequence of strings . */ @org.junit.Test public void functxFunctxMinString2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The minimum of a sequence of values, treating them like strings : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_min-string.html : @param $strings the sequence of strings :)\n" + " declare function functx:min-string ( $strings as xs:anyAtomicType* ) as xs:string? { min(for $string in $strings return string($string)) } ;\n" + " let $in-xml := a c b return (functx:min-string( (100,25,3) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "100") ); } /** * ~ : The minimum of a sequence of values, treating them like strings : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_min-string.html : @param $strings the sequence of strings . */ @org.junit.Test public void functxFunctxMinStringAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The minimum of a sequence of values, treating them like strings : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_min-string.html : @param $strings the sequence of strings :)\n" + " declare function functx:min-string ( $strings as xs:anyAtomicType* ) as xs:string? { min(for $string in $strings return string($string)) } ;\n" + " let $in-xml := a c b return (functx:min-string( $in-xml/* ), functx:min-string( (100,25,3) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a 100") ); } /** * ~ : Converts a string with format MMDDYYYY (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_mmddyyyy-to-date.html : @param $dateString the MMDDYYYY string . */ @org.junit.Test public void functxFunctxMmddyyyyToDate1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Converts a string with format MMDDYYYY (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_mmddyyyy-to-date.html : @param $dateString the MMDDYYYY string :)\n" + " declare function functx:mmddyyyy-to-date ( $dateString as xs:string? ) as xs:date? { if (empty($dateString)) then () else if (not(matches($dateString, '^\\D*(\\d{2})\\D*(\\d{2})\\D*(\\d{4})\\D*$'))) then error(xs:QName('functx:Invalid_Date_Format')) else xs:date(replace($dateString, '^\\D*(\\d{2})\\D*(\\d{2})\\D*(\\d{4})\\D*$', '$3-$1-$2')) } ;\n" + " (functx:mmddyyyy-to-date('12-15-2004'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-12-15") ); } /** * ~ : Converts a string with format MMDDYYYY (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_mmddyyyy-to-date.html : @param $dateString the MMDDYYYY string . */ @org.junit.Test public void functxFunctxMmddyyyyToDate2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Converts a string with format MMDDYYYY (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_mmddyyyy-to-date.html : @param $dateString the MMDDYYYY string :)\n" + " declare function functx:mmddyyyy-to-date ( $dateString as xs:string? ) as xs:date? { if (empty($dateString)) then () else if (not(matches($dateString, '^\\D*(\\d{2})\\D*(\\d{2})\\D*(\\d{4})\\D*$'))) then error(xs:QName('functx:Invalid_Date_Format')) else xs:date(replace($dateString, '^\\D*(\\d{2})\\D*(\\d{2})\\D*(\\d{4})\\D*$', '$3-$1-$2')) } ;\n" + " (functx:mmddyyyy-to-date('12152004'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-12-15") ); } /** * ~ : Converts a string with format MMDDYYYY (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_mmddyyyy-to-date.html : @param $dateString the MMDDYYYY string . */ @org.junit.Test public void functxFunctxMmddyyyyToDate3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Converts a string with format MMDDYYYY (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_mmddyyyy-to-date.html : @param $dateString the MMDDYYYY string :)\n" + " declare function functx:mmddyyyy-to-date ( $dateString as xs:string? ) as xs:date? { if (empty($dateString)) then () else if (not(matches($dateString, '^\\D*(\\d{2})\\D*(\\d{2})\\D*(\\d{4})\\D*$'))) then error(xs:QName('functx:Invalid_Date_Format')) else xs:date(replace($dateString, '^\\D*(\\d{2})\\D*(\\d{2})\\D*(\\d{4})\\D*$', '$3-$1-$2')) } ;\n" + " (functx:mmddyyyy-to-date('12/15/2004'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-12-15") ); } /** * ~ : Converts a string with format MMDDYYYY (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_mmddyyyy-to-date.html : @param $dateString the MMDDYYYY string . */ @org.junit.Test public void functxFunctxMmddyyyyToDateAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Converts a string with format MMDDYYYY (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_mmddyyyy-to-date.html : @param $dateString the MMDDYYYY string :)\n" + " declare function functx:mmddyyyy-to-date ( $dateString as xs:string? ) as xs:date? { if (empty($dateString)) then () else if (not(matches($dateString, '^\\D*(\\d{2})\\D*(\\d{2})\\D*(\\d{4})\\D*$'))) then error(xs:QName('functx:Invalid_Date_Format')) else xs:date(replace($dateString, '^\\D*(\\d{2})\\D*(\\d{2})\\D*(\\d{4})\\D*$', '$3-$1-$2')) } ;\n" + " (functx:mmddyyyy-to-date('12-15-2004'), functx:mmddyyyy-to-date('12152004'), functx:mmddyyyy-to-date('12/15/2004'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-12-15 2004-12-15 2004-12-15") ); } /** * ~ : The month of a date as an abbreviated word (Jan, Feb, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_month-abbrev-en.html : @param $date the date . */ @org.junit.Test public void functxFunctxMonthAbbrevEn1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The month of a date as an abbreviated word (Jan, Feb, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_month-abbrev-en.html : @param $date the date :)\n" + " declare function functx:month-abbrev-en ( $date as xs:anyAtomicType? ) as xs:string? { ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec') [month-from-date(xs:date($date))] } ;\n" + " (functx:month-abbrev-en(xs:date('2004-01-23')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jan") ); } /** * ~ : The month of a date as an abbreviated word (Jan, Feb, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_month-abbrev-en.html : @param $date the date . */ @org.junit.Test public void functxFunctxMonthAbbrevEn2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The month of a date as an abbreviated word (Jan, Feb, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_month-abbrev-en.html : @param $date the date :)\n" + " declare function functx:month-abbrev-en ( $date as xs:anyAtomicType? ) as xs:string? { ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec') [month-from-date(xs:date($date))] } ;\n" + " (functx:month-abbrev-en( xs:dateTime('2004-01-23T12:00:13')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jan") ); } /** * ~ : The month of a date as an abbreviated word (Jan, Feb, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_month-abbrev-en.html : @param $date the date . */ @org.junit.Test public void functxFunctxMonthAbbrevEn3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The month of a date as an abbreviated word (Jan, Feb, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_month-abbrev-en.html : @param $date the date :)\n" + " declare function functx:month-abbrev-en ( $date as xs:anyAtomicType? ) as xs:string? { ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec') [month-from-date(xs:date($date))] } ;\n" + " (functx:month-abbrev-en('2004-01-23'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jan") ); } /** * ~ : The month of a date as an abbreviated word (Jan, Feb, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_month-abbrev-en.html : @param $date the date . */ @org.junit.Test public void functxFunctxMonthAbbrevEnAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The month of a date as an abbreviated word (Jan, Feb, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_month-abbrev-en.html : @param $date the date :)\n" + " declare function functx:month-abbrev-en ( $date as xs:anyAtomicType? ) as xs:string? { ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec') [month-from-date(xs:date($date))] } ;\n" + " (functx:month-abbrev-en(xs:date('2004-01-23')), functx:month-abbrev-en( xs:dateTime('2004-01-23T12:00:13')), functx:month-abbrev-en('2004-01-23'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jan Jan Jan") ); } /** * ~ : The month of a date as a word (January, February, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_month-name-en.html : @param $date the date . */ @org.junit.Test public void functxFunctxMonthNameEn1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The month of a date as a word (January, February, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_month-name-en.html : @param $date the date :)\n" + " declare function functx:month-name-en ( $date as xs:anyAtomicType? ) as xs:string? { ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December') [month-from-date(xs:date($date))] } ;\n" + " (functx:month-name-en(xs:date('2004-01-23')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "January") ); } /** * ~ : The month of a date as a word (January, February, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_month-name-en.html : @param $date the date . */ @org.junit.Test public void functxFunctxMonthNameEn2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The month of a date as a word (January, February, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_month-name-en.html : @param $date the date :)\n" + " declare function functx:month-name-en ( $date as xs:anyAtomicType? ) as xs:string? { ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December') [month-from-date(xs:date($date))] } ;\n" + " (functx:month-name-en( xs:dateTime('2004-01-23T12:00:13')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "January") ); } /** * ~ : The month of a date as a word (January, February, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_month-name-en.html : @param $date the date . */ @org.junit.Test public void functxFunctxMonthNameEn3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The month of a date as a word (January, February, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_month-name-en.html : @param $date the date :)\n" + " declare function functx:month-name-en ( $date as xs:anyAtomicType? ) as xs:string? { ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December') [month-from-date(xs:date($date))] } ;\n" + " (functx:month-name-en('2004-01-23'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "January") ); } /** * ~ : The month of a date as a word (January, February, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_month-name-en.html : @param $date the date . */ @org.junit.Test public void functxFunctxMonthNameEnAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The month of a date as a word (January, February, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_month-name-en.html : @param $date the date :)\n" + " declare function functx:month-name-en ( $date as xs:anyAtomicType? ) as xs:string? { ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December') [month-from-date(xs:date($date))] } ;\n" + " (functx:month-name-en(xs:date('2004-01-23')), functx:month-name-en( xs:dateTime('2004-01-23T12:00:13')), functx:month-name-en('2004-01-23'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "January January January") ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxNameTest1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml := abc return (functx:name-test(name($in-xml),('*')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxNameTest2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml := abc return (functx:name-test(name($in-xml),('pre:*')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxNameTest3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml := abc return (functx:name-test(name($in-xml),('*:a')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxNameTest4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml := abc return (functx:name-test( name($in-xml),('pre:a','pre:b')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxNameTest5() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml := abc return (functx:name-test( name($in-xml),('a','b','c')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxNameTestAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml := abc return (functx:name-test(name($in-xml),('*')), functx:name-test(name($in-xml),('pre:*')), functx:name-test(name($in-xml),('*:a')), functx:name-test( name($in-xml),('pre:a','pre:b')), functx:name-test( name($in-xml),('a','b','c')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true true true false") ); } /** * ~ : A list of namespaces used in element/attribute names in an XML fragment : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_namespaces-in-use.html : @param $root the root node to start from . */ @org.junit.Test public void functxFunctxNamespacesInUse1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : A list of namespaces used in element/attribute names in an XML fragment : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_namespaces-in-use.html : @param $root the root node to start from :)\n" + " declare function functx:namespaces-in-use ( $root as node()? ) as xs:anyURI* { distinct-values( $root/descendant-or-self::*/(.|@*)/namespace-uri(.)) } ;\n" + " let $in-xml := Kate Jones return (functx:namespaces-in-use($in-xml))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://ns.example.com/abc http://ns.example.com/ghi http://ns.example.com/xyz") ); } /** * ~ : The next day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_next-day.html : @param $date the date . */ @org.junit.Test public void functxFunctxNextDay1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The next day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_next-day.html : @param $date the date :)\n" + " declare function functx:next-day ( $date as xs:anyAtomicType? ) as xs:date? { xs:date($date) + xs:dayTimeDuration('P1D') } ;\n" + " (functx:next-day(xs:date('2004-01-23')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-01-24") ); } /** * ~ : The next day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_next-day.html : @param $date the date . */ @org.junit.Test public void functxFunctxNextDay2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The next day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_next-day.html : @param $date the date :)\n" + " declare function functx:next-day ( $date as xs:anyAtomicType? ) as xs:date? { xs:date($date) + xs:dayTimeDuration('P1D') } ;\n" + " (functx:next-day( xs:dateTime('2005-12-31T12:00:13')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2006-01-01") ); } /** * ~ : The next day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_next-day.html : @param $date the date . */ @org.junit.Test public void functxFunctxNextDayAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The next day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_next-day.html : @param $date the date :)\n" + " declare function functx:next-day ( $date as xs:anyAtomicType? ) as xs:date? { xs:date($date) + xs:dayTimeDuration('P1D') } ;\n" + " (functx:next-day(xs:date('2004-01-23')), functx:next-day( xs:dateTime('2005-12-31T12:00:13')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-01-24 2006-01-01") ); } /** * ~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine . */ @org.junit.Test public void functxFunctxNodeKind1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine :)\n" + " declare function functx:node-kind ( $nodes as node()* ) as xs:string* { for $node in $nodes return if ($node instance of element()) then 'element' else if ($node instance of attribute()) then 'attribute' else if ($node instance of text()) then 'text' else if ($node instance of document-node()) then 'document-node' else if ($node instance of comment()) then 'comment' else if ($node instance of processing-instruction()) then 'processing-instruction' else 'unknown' } ;\n" + " let $in-xml := xyz return (functx:node-kind($in-xml/a))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "element") ); } /** * ~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine . */ @org.junit.Test public void functxFunctxNodeKind2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine :)\n" + " declare function functx:node-kind ( $nodes as node()* ) as xs:string* { for $node in $nodes return if ($node instance of element()) then 'element' else if ($node instance of attribute()) then 'attribute' else if ($node instance of text()) then 'text' else if ($node instance of document-node()) then 'document-node' else if ($node instance of comment()) then 'comment' else if ($node instance of processing-instruction()) then 'processing-instruction' else 'unknown' } ;\n" + " let $in-xml := xyz return (functx:node-kind($in-xml/a/@z))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "attribute") ); } /** * ~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine . */ @org.junit.Test public void functxFunctxNodeKind3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine :)\n" + " declare function functx:node-kind ( $nodes as node()* ) as xs:string* { for $node in $nodes return if ($node instance of element()) then 'element' else if ($node instance of attribute()) then 'attribute' else if ($node instance of text()) then 'text' else if ($node instance of document-node()) then 'document-node' else if ($node instance of comment()) then 'comment' else if ($node instance of processing-instruction()) then 'processing-instruction' else 'unknown' } ;\n" + " let $in-xml := xyz return (functx:node-kind($in-xml/comment()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "comment") ); } /** * ~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine . */ @org.junit.Test public void functxFunctxNodeKind4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine :)\n" + " declare function functx:node-kind ( $nodes as node()* ) as xs:string* { for $node in $nodes return if ($node instance of element()) then 'element' else if ($node instance of attribute()) then 'attribute' else if ($node instance of text()) then 'text' else if ($node instance of document-node()) then 'document-node' else if ($node instance of comment()) then 'comment' else if ($node instance of processing-instruction()) then 'processing-instruction' else 'unknown' } ;\n" + " let $in-xml := xyz return (functx:node-kind( $in-xml/processing-instruction()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "processing-instruction") ); } /** * ~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine . */ @org.junit.Test public void functxFunctxNodeKind5() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine :)\n" + " declare function functx:node-kind ( $nodes as node()* ) as xs:string* { for $node in $nodes return if ($node instance of element()) then 'element' else if ($node instance of attribute()) then 'attribute' else if ($node instance of text()) then 'text' else if ($node instance of document-node()) then 'document-node' else if ($node instance of comment()) then 'comment' else if ($node instance of processing-instruction()) then 'processing-instruction' else 'unknown' } ;\n" + " let $in-xml := xyz return (functx:node-kind($in-xml/a/text()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "text") ); } /** * ~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine . */ @org.junit.Test public void functxFunctxNodeKind6() { final XQuery query = new XQuery( "\n" + " declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine :)\n" + " declare function functx:node-kind ( $nodes as node()* ) as xs:string* { for $node in $nodes return if ($node instance of element()) then 'element' else if ($node instance of attribute()) then 'attribute' else if ($node instance of text()) then 'text' else if ($node instance of document-node()) then 'document-node' else if ($node instance of comment()) then 'comment' else if ($node instance of processing-instruction()) then 'processing-instruction' else 'unknown' } ;\n" + " let $in-xml := xyz \n" + " return (functx:node-kind(/))\n" + " ", ctx); try { query.context(node(file("app/FunctxFn/functx_book.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "document-node") ); } /** * ~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine . */ @org.junit.Test public void functxFunctxNodeKindAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " declare variable $input-context1 external;\n" + " (:~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine :)\n" + " declare function functx:node-kind ( $nodes as node()* ) as xs:string* { for $node in $nodes return if ($node instance of element()) then 'element' else if ($node instance of attribute()) then 'attribute' else if ($node instance of text()) then 'text' else if ($node instance of document-node()) then 'document-node' else if ($node instance of comment()) then 'comment' else if ($node instance of processing-instruction()) then 'processing-instruction' else 'unknown' } ;\n" + " let $in-xml := xyz \n" + " return (functx:node-kind($in-xml/a), \n" + " functx:node-kind($in-xml/a/@z), \n" + " functx:node-kind($in-xml/comment()), \n" + " functx:node-kind( $in-xml/processing-instruction()), \n" + " functx:node-kind($in-xml/a/text()), \n" + " functx:node-kind(/))", ctx); try { query.context(node(file("app/FunctxFn/functx_book.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "element attribute comment processing-instruction text document-node") ); } /** * ~ : Returns any values that appear more than once in a sequence : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_non-distinct-values.html : @param $seq the sequence of values . */ @org.junit.Test public void functxFunctxNonDistinctValues1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Returns any values that appear more than once in a sequence : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_non-distinct-values.html : @param $seq the sequence of values :)\n" + " declare function functx:non-distinct-values ( $seq as xs:anyAtomicType* ) as xs:anyAtomicType* { for $val in distinct-values($seq) return $val[count($seq[. = $val]) >\n" + " 1] } ;\n" + " (functx:non-distinct-values( (1,2,1,3)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * ~ : Returns any values that appear more than once in a sequence : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_non-distinct-values.html : @param $seq the sequence of values . */ @org.junit.Test public void functxFunctxNonDistinctValues2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Returns any values that appear more than once in a sequence : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_non-distinct-values.html : @param $seq the sequence of values :)\n" + " declare function functx:non-distinct-values ( $seq as xs:anyAtomicType* ) as xs:anyAtomicType* { for $val in distinct-values($seq) return $val[count($seq[. = $val]) >\n" + " 1] } ;\n" + " (functx:non-distinct-values( (1,2,1,3,2.0)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2") ); } /** * ~ : Returns any values that appear more than once in a sequence : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_non-distinct-values.html : @param $seq the sequence of values . */ @org.junit.Test public void functxFunctxNonDistinctValues3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Returns any values that appear more than once in a sequence : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_non-distinct-values.html : @param $seq the sequence of values :)\n" + " declare function functx:non-distinct-values ( $seq as xs:anyAtomicType* ) as xs:anyAtomicType* { for $val in distinct-values($seq) return $val[count($seq[. = $val]) >\n" + " 1] } ;\n" + " (functx:non-distinct-values( (1,2,3) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * ~ : Returns any values that appear more than once in a sequence : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_non-distinct-values.html : @param $seq the sequence of values . */ @org.junit.Test public void functxFunctxNonDistinctValuesAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Returns any values that appear more than once in a sequence : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_non-distinct-values.html : @param $seq the sequence of values :)\n" + " declare function functx:non-distinct-values ( $seq as xs:anyAtomicType* ) as xs:anyAtomicType* { for $val in distinct-values($seq) return $val[count($seq[. = $val]) >\n" + " 1] } ;\n" + " (functx:non-distinct-values( (1,2,1,3)), functx:non-distinct-values( (1,2,1,3,2.0)), functx:non-distinct-values( (1,2,3) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 1 2") ); } /** * ~ : The number of regions that match a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_number-of-matches.html : @param $arg the string to test : @param $pattern the regular expression . */ @org.junit.Test public void functxFunctxNumberOfMatches1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The number of regions that match a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_number-of-matches.html : @param $arg the string to test : @param $pattern the regular expression :)\n" + " declare function functx:number-of-matches ( $arg as xs:string? , $pattern as xs:string ) as xs:integer { count(tokenize($arg,$pattern)) - 1 } ;\n" + " (functx:number-of-matches('abcabc','ab'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * ~ : The number of regions that match a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_number-of-matches.html : @param $arg the string to test : @param $pattern the regular expression . */ @org.junit.Test public void functxFunctxNumberOfMatches2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The number of regions that match a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_number-of-matches.html : @param $arg the string to test : @param $pattern the regular expression :)\n" + " declare function functx:number-of-matches ( $arg as xs:string? , $pattern as xs:string ) as xs:integer { count(tokenize($arg,$pattern)) - 1 } ;\n" + " (functx:number-of-matches('12345','\\d'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** * ~ : The number of regions that match a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_number-of-matches.html : @param $arg the string to test : @param $pattern the regular expression . */ @org.junit.Test public void functxFunctxNumberOfMatches3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The number of regions that match a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_number-of-matches.html : @param $arg the string to test : @param $pattern the regular expression :)\n" + " declare function functx:number-of-matches ( $arg as xs:string? , $pattern as xs:string ) as xs:integer { count(tokenize($arg,$pattern)) - 1 } ;\n" + " (functx:number-of-matches('aaaaaa','aaa'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * ~ : The number of regions that match a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_number-of-matches.html : @param $arg the string to test : @param $pattern the regular expression . */ @org.junit.Test public void functxFunctxNumberOfMatchesAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The number of regions that match a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_number-of-matches.html : @param $arg the string to test : @param $pattern the regular expression :)\n" + " declare function functx:number-of-matches ( $arg as xs:string? , $pattern as xs:string ) as xs:integer { count(tokenize($arg,$pattern)) - 1 } ;\n" + " (functx:number-of-matches('abcabc','ab'), functx:number-of-matches('12345','\\d'), functx:number-of-matches('aaaaaa','aaa'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2 5 2") ); } /** * ~ : Reformats a number as an ordinal number, e.g. 1st, 2nd, 3rd. : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_ordinal-number-en.html : @param $num the number . */ @org.junit.Test public void functxFunctxOrdinalNumberEn1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Reformats a number as an ordinal number, e.g. 1st, 2nd, 3rd. : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_ordinal-number-en.html : @param $num the number :)\n" + " declare function functx:ordinal-number-en ( $num as xs:integer? ) as xs:string { concat(xs:string($num), if (matches(xs:string($num),'[04-9]$|1[1-3]$')) then 'th' else if (ends-with(xs:string($num),'1')) then 'st' else if (ends-with(xs:string($num),'2')) then 'nd' else if (ends-with(xs:string($num),'3')) then 'rd' else '') } ;\n" + " (functx:ordinal-number-en(1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1st") ); } /** * ~ : Reformats a number as an ordinal number, e.g. 1st, 2nd, 3rd. : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_ordinal-number-en.html : @param $num the number . */ @org.junit.Test public void functxFunctxOrdinalNumberEn2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Reformats a number as an ordinal number, e.g. 1st, 2nd, 3rd. : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_ordinal-number-en.html : @param $num the number :)\n" + " declare function functx:ordinal-number-en ( $num as xs:integer? ) as xs:string { concat(xs:string($num), if (matches(xs:string($num),'[04-9]$|1[1-3]$')) then 'th' else if (ends-with(xs:string($num),'1')) then 'st' else if (ends-with(xs:string($num),'2')) then 'nd' else if (ends-with(xs:string($num),'3')) then 'rd' else '') } ;\n" + " (functx:ordinal-number-en(12))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12th") ); } /** * ~ : Reformats a number as an ordinal number, e.g. 1st, 2nd, 3rd. : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_ordinal-number-en.html : @param $num the number . */ @org.junit.Test public void functxFunctxOrdinalNumberEnAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Reformats a number as an ordinal number, e.g. 1st, 2nd, 3rd. : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_ordinal-number-en.html : @param $num the number :)\n" + " declare function functx:ordinal-number-en ( $num as xs:integer? ) as xs:string { concat(xs:string($num), if (matches(xs:string($num),'[04-9]$|1[1-3]$')) then 'th' else if (ends-with(xs:string($num),'1')) then 'st' else if (ends-with(xs:string($num),'2')) then 'nd' else if (ends-with(xs:string($num),'3')) then 'rd' else '') } ;\n" + " (functx:ordinal-number-en(1), functx:ordinal-number-en(12))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1st 12th") ); } /** * ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxPadIntegerToLength1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:pad-integer-to-length(12, 6))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "000012") ); } /** * ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxPadIntegerToLength2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:pad-integer-to-length(1, 6))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "000001") ); } /** * ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxPadIntegerToLength3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:pad-integer-to-length(12, 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12") ); } /** * ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxPadIntegerToLengthAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:pad-integer-to-length(12, 6), functx:pad-integer-to-length(1, 6), functx:pad-integer-to-length(12, 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "000012 000001 12") ); } /** * ~ : Pads a string to a desired length : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-string-to-length.html : @param $stringToPad the string to pad : @param $padChar the character(s) to use as padding : @param $length the desired length . */ @org.junit.Test public void functxFunctxPadStringToLength1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Pads a string to a desired length : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-string-to-length.html : @param $stringToPad the string to pad : @param $padChar the character(s) to use as padding : @param $length the desired length :)\n" + " declare function functx:pad-string-to-length ( $stringToPad as xs:string? , $padChar as xs:string , $length as xs:integer ) as xs:string { substring( string-join ( ($stringToPad, for $i in (1 to $length) return $padChar) ,'') ,1,$length) } ;\n" + " (functx:pad-string-to-length('abc', '*', 6))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc***") ); } /** * ~ : Pads a string to a desired length : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-string-to-length.html : @param $stringToPad the string to pad : @param $padChar the character(s) to use as padding : @param $length the desired length . */ @org.junit.Test public void functxFunctxPadStringToLength2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Pads a string to a desired length : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-string-to-length.html : @param $stringToPad the string to pad : @param $padChar the character(s) to use as padding : @param $length the desired length :)\n" + " declare function functx:pad-string-to-length ( $stringToPad as xs:string? , $padChar as xs:string , $length as xs:integer ) as xs:string { substring( string-join ( ($stringToPad, for $i in (1 to $length) return $padChar) ,'') ,1,$length) } ;\n" + " (functx:pad-string-to-length('abcdef', '*', 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcd") ); } /** * ~ : Pads a string to a desired length : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-string-to-length.html : @param $stringToPad the string to pad : @param $padChar the character(s) to use as padding : @param $length the desired length . */ @org.junit.Test public void functxFunctxPadStringToLength3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Pads a string to a desired length : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-string-to-length.html : @param $stringToPad the string to pad : @param $padChar the character(s) to use as padding : @param $length the desired length :)\n" + " declare function functx:pad-string-to-length ( $stringToPad as xs:string? , $padChar as xs:string , $length as xs:integer ) as xs:string { substring( string-join ( ($stringToPad, for $i in (1 to $length) return $padChar) ,'') ,1,$length) } ;\n" + " (functx:pad-string-to-length('', '*', 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "****") ); } /** * ~ : Pads a string to a desired length : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-string-to-length.html : @param $stringToPad the string to pad : @param $padChar the character(s) to use as padding : @param $length the desired length . */ @org.junit.Test public void functxFunctxPadStringToLengthAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Pads a string to a desired length : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-string-to-length.html : @param $stringToPad the string to pad : @param $padChar the character(s) to use as padding : @param $length the desired length :)\n" + " declare function functx:pad-string-to-length ( $stringToPad as xs:string? , $padChar as xs:string , $length as xs:integer ) as xs:string { substring( string-join ( ($stringToPad, for $i in (1 to $length) return $padChar) ,'') ,1,$length) } ;\n" + " (functx:pad-string-to-length('abc', '*', 6), functx:pad-string-to-length('abcdef', '*', 4), functx:pad-string-to-length('', '*', 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc*** abcd ****") ); } /** * ~ : A path to an XML node (or sequence of nodes) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_path-to-node.html : @param $nodes the node sequence . */ @org.junit.Test public void functxFunctxPathToNode1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : A path to an XML node (or sequence of nodes) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_path-to-node.html : @param $nodes the node sequence :)\n" + " declare function functx:path-to-node ( $nodes as node()* ) as xs:string* { $nodes/string-join(ancestor-or-self::*/name(.), '/') } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:path-to-node($in-xml//lName[. = 'Doe']))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "authors/author/lName") ); } /** * ~ : A path to an XML node (or sequence of nodes) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_path-to-node.html : @param $nodes the node sequence . */ @org.junit.Test public void functxFunctxPathToNode2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : A path to an XML node (or sequence of nodes) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_path-to-node.html : @param $nodes the node sequence :)\n" + " declare function functx:path-to-node ( $nodes as node()* ) as xs:string* { $nodes/string-join(ancestor-or-self::*/name(.), '/') } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:path-to-node($in-xml/*[1]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "authors/author") ); } /** * ~ : A path to an XML node (or sequence of nodes) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_path-to-node.html : @param $nodes the node sequence . */ @org.junit.Test public void functxFunctxPathToNodeAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : A path to an XML node (or sequence of nodes) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_path-to-node.html : @param $nodes the node sequence :)\n" + " declare function functx:path-to-node ( $nodes as node()* ) as xs:string* { $nodes/string-join(ancestor-or-self::*/name(.), '/') } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:path-to-node($in-xml//lName[. = 'Doe']), functx:path-to-node($in-xml/*[1]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "authors/author/lName authors/author") ); } /** * ~ : The position of a node in a sequence, based on node identity : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-node.html : @param $nodes the node sequence : @param $nodeToFind the node to find in the sequence ~ : A unique path to an XML node (or sequence of nodes) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_path-to-node-with-pos.html : @param $node the node sequence . */ @org.junit.Test public void functxFunctxPathToNodeWithPos1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The position of a node in a sequence, based on node identity : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-node.html : @param $nodes the node sequence : @param $nodeToFind the node to find in the sequence :)\n" + " declare function functx:index-of-node ( $nodes as node()* , $nodeToFind as node() ) as xs:integer* { for $seq in (1 to count($nodes)) return $seq[$nodes[$seq] is $nodeToFind] } ;\n" + " (:~ : A unique path to an XML node (or sequence of nodes) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_path-to-node-with-pos.html : @param $node the node sequence :)\n" + " declare function functx:path-to-node-with-pos ( $node as node()? ) as xs:string { string-join( for $ancestor in $node/ancestor-or-self::* let $sibsOfSameName := $ancestor/../*[name() = name($ancestor)] return concat(name($ancestor), if (count($sibsOfSameName) <= 1) then '' else concat( '[',functx:index-of-node($sibsOfSameName,$ancestor),']')) , '/') } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:path-to-node-with-pos( $in-xml//lName[. = 'Doe']))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "authors/author[2]/lName") ); } /** * ~ : The position of a node in a sequence, based on node identity : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-node.html : @param $nodes the node sequence : @param $nodeToFind the node to find in the sequence ~ : A unique path to an XML node (or sequence of nodes) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_path-to-node-with-pos.html : @param $node the node sequence . */ @org.junit.Test public void functxFunctxPathToNodeWithPos2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The position of a node in a sequence, based on node identity : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-node.html : @param $nodes the node sequence : @param $nodeToFind the node to find in the sequence :)\n" + " declare function functx:index-of-node ( $nodes as node()* , $nodeToFind as node() ) as xs:integer* { for $seq in (1 to count($nodes)) return $seq[$nodes[$seq] is $nodeToFind] } ;\n" + " (:~ : A unique path to an XML node (or sequence of nodes) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_path-to-node-with-pos.html : @param $node the node sequence :)\n" + " declare function functx:path-to-node-with-pos ( $node as node()? ) as xs:string { string-join( for $ancestor in $node/ancestor-or-self::* let $sibsOfSameName := $ancestor/../*[name() = name($ancestor)] return concat(name($ancestor), if (count($sibsOfSameName) <= 1) then '' else concat( '[',functx:index-of-node($sibsOfSameName,$ancestor),']')) , '/') } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:path-to-node-with-pos($in-xml/*[1]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "authors/author[1]") ); } /** * ~ : The position of a node in a sequence, based on node identity : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-node.html : @param $nodes the node sequence : @param $nodeToFind the node to find in the sequence ~ : A unique path to an XML node (or sequence of nodes) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_path-to-node-with-pos.html : @param $node the node sequence . */ @org.junit.Test public void functxFunctxPathToNodeWithPosAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The position of a node in a sequence, based on node identity : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_index-of-node.html : @param $nodes the node sequence : @param $nodeToFind the node to find in the sequence :)\n" + " declare function functx:index-of-node ( $nodes as node()* , $nodeToFind as node() ) as xs:integer* { for $seq in (1 to count($nodes)) return $seq[$nodes[$seq] is $nodeToFind] } ;\n" + " (:~ : A unique path to an XML node (or sequence of nodes) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_path-to-node-with-pos.html : @param $node the node sequence :)\n" + " declare function functx:path-to-node-with-pos ( $node as node()? ) as xs:string { string-join( for $ancestor in $node/ancestor-or-self::* let $sibsOfSameName := $ancestor/../*[name() = name($ancestor)] return concat(name($ancestor), if (count($sibsOfSameName) <= 1) then '' else concat( '[',functx:index-of-node($sibsOfSameName,$ancestor),']')) , '/') } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:path-to-node-with-pos( $in-xml//lName[. = 'Doe']), functx:path-to-node-with-pos($in-xml/*[1]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "authors/author[2]/lName authors/author[1]") ); } /** * ~ : Whether an XML node precedes another without being its ancestor : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_precedes-not-ancestor.html : @param $a the first node : @param $b the second node . */ @org.junit.Test public void functxFunctxPrecedesNotAncestor1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node precedes another without being its ancestor : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_precedes-not-ancestor.html : @param $a the first node : @param $b the second node :)\n" + " declare function functx:precedes-not-ancestor ( $a as node()? , $b as node()? ) as xs:boolean { $a << $b and empty($a intersect $b/ancestor::node()) } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:precedes-not-ancestor( $in-xml//author[1],$in-xml//author[2]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether an XML node precedes another without being its ancestor : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_precedes-not-ancestor.html : @param $a the first node : @param $b the second node . */ @org.junit.Test public void functxFunctxPrecedesNotAncestor2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node precedes another without being its ancestor : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_precedes-not-ancestor.html : @param $a the first node : @param $b the second node :)\n" + " declare function functx:precedes-not-ancestor ( $a as node()? , $b as node()? ) as xs:boolean { $a << $b and empty($a intersect $b/ancestor::node()) } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:precedes-not-ancestor( $in-xml//author[1], $in-xml//author[1]/fName))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an XML node precedes another without being its ancestor : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_precedes-not-ancestor.html : @param $a the first node : @param $b the second node . */ @org.junit.Test public void functxFunctxPrecedesNotAncestor3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node precedes another without being its ancestor : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_precedes-not-ancestor.html : @param $a the first node : @param $b the second node :)\n" + " declare function functx:precedes-not-ancestor ( $a as node()? , $b as node()? ) as xs:boolean { $a << $b and empty($a intersect $b/ancestor::node()) } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:precedes-not-ancestor( $in-xml//author[2],$in-xml//author[1]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether an XML node precedes another without being its ancestor : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_precedes-not-ancestor.html : @param $a the first node : @param $b the second node . */ @org.junit.Test public void functxFunctxPrecedesNotAncestorAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether an XML node precedes another without being its ancestor : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_precedes-not-ancestor.html : @param $a the first node : @param $b the second node :)\n" + " declare function functx:precedes-not-ancestor ( $a as node()? , $b as node()? ) as xs:boolean { $a << $b and empty($a intersect $b/ancestor::node()) } ;\n" + " let $in-xml := Kate Jones John Doe return (functx:precedes-not-ancestor( $in-xml//author[1],$in-xml//author[2]), functx:precedes-not-ancestor( $in-xml//author[1], $in-xml//author[1]/fName), functx:precedes-not-ancestor( $in-xml//author[2],$in-xml//author[1]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true false false") ); } /** * ~ : The previous day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_previous-day.html : @param $date the date . */ @org.junit.Test public void functxFunctxPreviousDay1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The previous day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_previous-day.html : @param $date the date :)\n" + " declare function functx:previous-day ( $date as xs:anyAtomicType? ) as xs:date? { xs:date($date) - xs:dayTimeDuration('P1D') } ;\n" + " (functx:previous-day(xs:date('2004-01-23')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-01-22") ); } /** * ~ : The previous day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_previous-day.html : @param $date the date . */ @org.junit.Test public void functxFunctxPreviousDay2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The previous day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_previous-day.html : @param $date the date :)\n" + " declare function functx:previous-day ( $date as xs:anyAtomicType? ) as xs:date? { xs:date($date) - xs:dayTimeDuration('P1D') } ;\n" + " (functx:previous-day( xs:dateTime('2005-01-01T12:00:13')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-12-31") ); } /** * ~ : The previous day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_previous-day.html : @param $date the date . */ @org.junit.Test public void functxFunctxPreviousDayAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The previous day : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_previous-day.html : @param $date the date :)\n" + " declare function functx:previous-day ( $date as xs:anyAtomicType? ) as xs:date? { xs:date($date) - xs:dayTimeDuration('P1D') } ;\n" + " (functx:previous-day(xs:date('2004-01-23')), functx:previous-day( xs:dateTime('2005-01-01T12:00:13')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-01-22 2004-12-31") ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Removes attributes from an XML element, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-attributes.html : @param $elements the element(s) from which to remove the attributes : @param $names the names of the attributes to remove, or * for all attributes ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxRemoveAttributes1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Removes attributes from an XML element, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-attributes.html : @param $elements the element(s) from which to remove the attributes : @param $names the names of the attributes to remove, or * for all attributes :)\n" + " declare function functx:remove-attributes ( $elements as element()* , $names as xs:string* ) as element() { for $element in $elements return element {node-name($element)} {$element/@*[not(functx:name-test(name(),$names))], $element/node() } } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml-1 := abc return let $in-xml-2 := abc return (functx:remove-attributes( $in-xml-1, ('attr1','attr2')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("abc", false) ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Removes attributes from an XML element, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-attributes.html : @param $elements the element(s) from which to remove the attributes : @param $names the names of the attributes to remove, or * for all attributes ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxRemoveAttributes2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Removes attributes from an XML element, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-attributes.html : @param $elements the element(s) from which to remove the attributes : @param $names the names of the attributes to remove, or * for all attributes :)\n" + " declare function functx:remove-attributes ( $elements as element()* , $names as xs:string* ) as element() { for $element in $elements return element {node-name($element)} {$element/@*[not(functx:name-test(name(),$names))], $element/node() } } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml-1 := abc return let $in-xml-2 := abc return (functx:remove-attributes( $in-xml-1, ('attr1','attr3')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("abc", false) ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Removes attributes from an XML element, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-attributes.html : @param $elements the element(s) from which to remove the attributes : @param $names the names of the attributes to remove, or * for all attributes ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxRemoveAttributes3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Removes attributes from an XML element, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-attributes.html : @param $elements the element(s) from which to remove the attributes : @param $names the names of the attributes to remove, or * for all attributes :)\n" + " declare function functx:remove-attributes ( $elements as element()* , $names as xs:string* ) as element() { for $element in $elements return element {node-name($element)} {$element/@*[not(functx:name-test(name(),$names))], $element/node() } } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml-1 := abc return let $in-xml-2 := abc return (functx:remove-attributes($in-xml-1, '*'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("abc", false) ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Removes attributes from an XML element, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-attributes.html : @param $elements the element(s) from which to remove the attributes : @param $names the names of the attributes to remove, or * for all attributes ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxRemoveAttributes4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Removes attributes from an XML element, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-attributes.html : @param $elements the element(s) from which to remove the attributes : @param $names the names of the attributes to remove, or * for all attributes :)\n" + " declare function functx:remove-attributes ( $elements as element()* , $names as xs:string* ) as element() { for $element in $elements return element {node-name($element)} {$element/@*[not(functx:name-test(name(),$names))], $element/node() } } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml-1 := abc return let $in-xml-2 := abc return (functx:remove-attributes( $in-xml-2, ('a:attr1')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("abc", false) ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Removes attributes from an XML element, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-attributes.html : @param $elements the element(s) from which to remove the attributes : @param $names the names of the attributes to remove, or * for all attributes ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxRemoveAttributesAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Removes attributes from an XML element, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-attributes.html : @param $elements the element(s) from which to remove the attributes : @param $names the names of the attributes to remove, or * for all attributes :)\n" + " declare function functx:remove-attributes ( $elements as element()* , $names as xs:string* ) as element() { for $element in $elements return element {node-name($element)} {$element/@*[not(functx:name-test(name(),$names))], $element/node() } } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml-1 := abc return let $in-xml-2 := abc return (functx:remove-attributes( $in-xml-1, ('attr1','attr2')), functx:remove-attributes( $in-xml-1, ('attr1','attr3')), functx:remove-attributes($in-xml-1, '*'), functx:remove-attributes( $in-xml-2, ('a:attr1')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("abcabcabcabc", false) ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Removes attributes from an XML fragment, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-attributes-deep.html : @param $nodes the root(s) to start from : @param $names the names of the attributes to remove, or * for all attributes ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxRemoveAttributesDeep1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Removes attributes from an XML fragment, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-attributes-deep.html : @param $nodes the root(s) to start from : @param $names the names of the attributes to remove, or * for all attributes :)\n" + " declare function functx:remove-attributes-deep ( $nodes as node()* , $names as xs:string* ) as node()* { for $node in $nodes return if ($node instance of element()) then element { node-name($node)} { $node/@*[not(functx:name-test(name(),$names))], functx:remove-attributes-deep($node/node(), $names)} else if ($node instance of document-node()) then functx:remove-attributes-deep($node/node(), $names) else $node } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml-1 := abc return let $in-xml-2 := abc return (functx:remove-attributes-deep( $in-xml-1, ('attr1','attr2')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("abc", false) ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Removes attributes from an XML fragment, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-attributes-deep.html : @param $nodes the root(s) to start from : @param $names the names of the attributes to remove, or * for all attributes ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxRemoveAttributesDeep2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Removes attributes from an XML fragment, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-attributes-deep.html : @param $nodes the root(s) to start from : @param $names the names of the attributes to remove, or * for all attributes :)\n" + " declare function functx:remove-attributes-deep ( $nodes as node()* , $names as xs:string* ) as node()* { for $node in $nodes return if ($node instance of element()) then element { node-name($node)} { $node/@*[not(functx:name-test(name(),$names))], functx:remove-attributes-deep($node/node(), $names)} else if ($node instance of document-node()) then functx:remove-attributes-deep($node/node(), $names) else $node } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml-1 := abc return let $in-xml-2 := abc return (functx:remove-attributes-deep( $in-xml-1, ('attr1','attr3')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("abc", false) ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Removes attributes from an XML fragment, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-attributes-deep.html : @param $nodes the root(s) to start from : @param $names the names of the attributes to remove, or * for all attributes ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxRemoveAttributesDeep3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Removes attributes from an XML fragment, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-attributes-deep.html : @param $nodes the root(s) to start from : @param $names the names of the attributes to remove, or * for all attributes :)\n" + " declare function functx:remove-attributes-deep ( $nodes as node()* , $names as xs:string* ) as node()* { for $node in $nodes return if ($node instance of element()) then element { node-name($node)} { $node/@*[not(functx:name-test(name(),$names))], functx:remove-attributes-deep($node/node(), $names)} else if ($node instance of document-node()) then functx:remove-attributes-deep($node/node(), $names) else $node } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml-1 := abc return let $in-xml-2 := abc return (functx:remove-attributes-deep( $in-xml-2, 'a:attr1'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("abc", false) ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Removes attributes from an XML fragment, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-attributes-deep.html : @param $nodes the root(s) to start from : @param $names the names of the attributes to remove, or * for all attributes ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxRemoveAttributesDeepAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Removes attributes from an XML fragment, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-attributes-deep.html : @param $nodes the root(s) to start from : @param $names the names of the attributes to remove, or * for all attributes :)\n" + " declare function functx:remove-attributes-deep ( $nodes as node()* , $names as xs:string* ) as node()* { for $node in $nodes return if ($node instance of element()) then element { node-name($node)} { $node/@*[not(functx:name-test(name(),$names))], functx:remove-attributes-deep($node/node(), $names)} else if ($node instance of document-node()) then functx:remove-attributes-deep($node/node(), $names) else $node } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml-1 := abc return let $in-xml-2 := abc return (functx:remove-attributes-deep( $in-xml-1, ('attr1','attr2')), functx:remove-attributes-deep( $in-xml-1, ('attr1','attr3')), functx:remove-attributes-deep( $in-xml-2, 'a:attr1'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("abcabcabc", false) ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Removes child elements from an XML node, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements.html : @param $elements the element(s) from which you wish to remove the children : @param $names the names of the child elements to remove ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxRemoveElements1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Removes child elements from an XML node, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements.html : @param $elements the element(s) from which you wish to remove the children : @param $names the names of the child elements to remove :)\n" + " declare function functx:remove-elements ( $elements as element()* , $names as xs:string* ) as element()* { for $element in $elements return element {node-name($element)} {$element/@*, $element/node()[not(functx:name-test(name(),$names))] } } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml-1 := 123 456 Mixed content return let $in-xml-2 := 123 456 Mixed content return (functx:remove-elements( $in-xml-1, 'c'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("123456", false) ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Removes child elements from an XML node, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements.html : @param $elements the element(s) from which you wish to remove the children : @param $names the names of the child elements to remove ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxRemoveElements2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Removes child elements from an XML node, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements.html : @param $elements the element(s) from which you wish to remove the children : @param $names the names of the child elements to remove :)\n" + " declare function functx:remove-elements ( $elements as element()* , $names as xs:string* ) as element()* { for $element in $elements return element {node-name($element)} {$element/@*, $element/node()[not(functx:name-test(name(),$names))] } } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml-1 := 123 456 Mixed content return let $in-xml-2 := 123 456 Mixed content return (functx:remove-elements( $in-xml-1, ('a','b')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Mixed content", false) ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Removes child elements from an XML node, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements.html : @param $elements the element(s) from which you wish to remove the children : @param $names the names of the child elements to remove ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxRemoveElements3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Removes child elements from an XML node, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements.html : @param $elements the element(s) from which you wish to remove the children : @param $names the names of the child elements to remove :)\n" + " declare function functx:remove-elements ( $elements as element()* , $names as xs:string* ) as element()* { for $element in $elements return element {node-name($element)} {$element/@*, $element/node()[not(functx:name-test(name(),$names))] } } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml-1 := 123 456 Mixed content return let $in-xml-2 := 123 456 Mixed content return (functx:remove-elements( $in-xml-2, 'x:a'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("123Mixed content", false) ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Removes child elements from an XML node, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements.html : @param $elements the element(s) from which you wish to remove the children : @param $names the names of the child elements to remove ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxRemoveElementsAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Removes child elements from an XML node, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements.html : @param $elements the element(s) from which you wish to remove the children : @param $names the names of the child elements to remove :)\n" + " declare function functx:remove-elements ( $elements as element()* , $names as xs:string* ) as element()* { for $element in $elements return element {node-name($element)} {$element/@*, $element/node()[not(functx:name-test(name(),$names))] } } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml-1 := 123 456 Mixed content return let $in-xml-2 := 123 456 Mixed content return (functx:remove-elements( $in-xml-1, 'c'), functx:remove-elements( $in-xml-1, ('a','b')), functx:remove-elements( $in-xml-2, 'x:a'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("123456Mixed content123Mixed content", false) ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Removes descendant elements from an XML node, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements-deep.html : @param $nodes root(s) to start from : @param $names the names of the elements to remove ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxRemoveElementsDeep1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Removes descendant elements from an XML node, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements-deep.html : @param $nodes root(s) to start from : @param $names the names of the elements to remove :)\n" + " declare function functx:remove-elements-deep ( $nodes as node()* , $names as xs:string* ) as node()* { for $node in $nodes return if ($node instance of element()) then if (functx:name-test(name($node),$names)) then () else element { node-name($node)} { $node/@*, functx:remove-elements-deep($node/node(), $names)} else if ($node instance of document-node()) then functx:remove-elements-deep($node/node(), $names) else $node } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml-1 := b1 c1 Mixed content return let $in-xml-2 := b1 c1 Mixed content return (functx:remove-elements-deep( $in-xml-1, 'b'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("c1Mixed ", false) ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Removes descendant elements from an XML node, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements-deep.html : @param $nodes root(s) to start from : @param $names the names of the elements to remove ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxRemoveElementsDeep2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Removes descendant elements from an XML node, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements-deep.html : @param $nodes root(s) to start from : @param $names the names of the elements to remove :)\n" + " declare function functx:remove-elements-deep ( $nodes as node()* , $names as xs:string* ) as node()* { for $node in $nodes return if ($node instance of element()) then if (functx:name-test(name($node),$names)) then () else element { node-name($node)} { $node/@*, functx:remove-elements-deep($node/node(), $names)} else if ($node instance of document-node()) then functx:remove-elements-deep($node/node(), $names) else $node } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml-1 := b1 c1 Mixed content return let $in-xml-2 := b1 c1 Mixed content return (functx:remove-elements-deep( $in-xml-1, 'a'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Mixed content", false) ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Removes descendant elements from an XML node, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements-deep.html : @param $nodes root(s) to start from : @param $names the names of the elements to remove ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxRemoveElementsDeep3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Removes descendant elements from an XML node, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements-deep.html : @param $nodes root(s) to start from : @param $names the names of the elements to remove :)\n" + " declare function functx:remove-elements-deep ( $nodes as node()* , $names as xs:string* ) as node()* { for $node in $nodes return if ($node instance of element()) then if (functx:name-test(name($node),$names)) then () else element { node-name($node)} { $node/@*, functx:remove-elements-deep($node/node(), $names)} else if ($node instance of document-node()) then functx:remove-elements-deep($node/node(), $names) else $node } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml-1 := b1 c1 Mixed content return let $in-xml-2 := b1 c1 Mixed content return (functx:remove-elements-deep( $in-xml-1, ('b','c')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Removes descendant elements from an XML node, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements-deep.html : @param $nodes root(s) to start from : @param $names the names of the elements to remove ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxRemoveElementsDeep4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Removes descendant elements from an XML node, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements-deep.html : @param $nodes root(s) to start from : @param $names the names of the elements to remove :)\n" + " declare function functx:remove-elements-deep ( $nodes as node()* , $names as xs:string* ) as node()* { for $node in $nodes return if ($node instance of element()) then if (functx:name-test(name($node),$names)) then () else element { node-name($node)} { $node/@*, functx:remove-elements-deep($node/node(), $names)} else if ($node instance of document-node()) then functx:remove-elements-deep($node/node(), $names) else $node } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml-1 := b1 c1 Mixed content return let $in-xml-2 := b1 c1 Mixed content return (functx:remove-elements-deep( $in-xml-2, 'x:b'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("c1Mixed content", false) ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Removes descendant elements from an XML node, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements-deep.html : @param $nodes root(s) to start from : @param $names the names of the elements to remove ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxRemoveElementsDeepAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Removes descendant elements from an XML node, based on name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements-deep.html : @param $nodes root(s) to start from : @param $names the names of the elements to remove :)\n" + " declare function functx:remove-elements-deep ( $nodes as node()* , $names as xs:string* ) as node()* { for $node in $nodes return if ($node instance of element()) then if (functx:name-test(name($node),$names)) then () else element { node-name($node)} { $node/@*, functx:remove-elements-deep($node/node(), $names)} else if ($node instance of document-node()) then functx:remove-elements-deep($node/node(), $names) else $node } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml-1 := b1 c1 Mixed content return let $in-xml-2 := b1 c1 Mixed content return (functx:remove-elements-deep( $in-xml-1, 'b'), functx:remove-elements-deep( $in-xml-1, 'a'), functx:remove-elements-deep( $in-xml-1, ('b','c')), functx:remove-elements-deep( $in-xml-2, 'x:b'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("c1Mixed Mixed contentc1Mixed content", false) ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Removes descendant XML elements but keeps their content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements-not-contents.html : @param $nodes the root(s) to start from : @param $names the names of the elements to remove ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxRemoveElementsNotContents1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Removes descendant XML elements but keeps their content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements-not-contents.html : @param $nodes the root(s) to start from : @param $names the names of the elements to remove :)\n" + " declare function functx:remove-elements-not-contents ( $nodes as node()* , $names as xs:string* ) as node()* { for $node in $nodes return if ($node instance of element()) then if (functx:name-test(name($node),$names)) then functx:remove-elements-not-contents($node/node(), $names) else element {node-name($node)} {$node/@*, functx:remove-elements-not-contents($node/node(),$names)} else if ($node instance of document-node()) then functx:remove-elements-not-contents($node/node(), $names) else $node } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml-1 := b1 c1 Mixed content return let $in-xml-2 := b1 c1 Mixed content return (functx:remove-elements-not-contents( $in-xml-1, 'b'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("b1c1Mixed content", false) ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Removes descendant XML elements but keeps their content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements-not-contents.html : @param $nodes the root(s) to start from : @param $names the names of the elements to remove ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxRemoveElementsNotContents2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Removes descendant XML elements but keeps their content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements-not-contents.html : @param $nodes the root(s) to start from : @param $names the names of the elements to remove :)\n" + " declare function functx:remove-elements-not-contents ( $nodes as node()* , $names as xs:string* ) as node()* { for $node in $nodes return if ($node instance of element()) then if (functx:name-test(name($node),$names)) then functx:remove-elements-not-contents($node/node(), $names) else element {node-name($node)} {$node/@*, functx:remove-elements-not-contents($node/node(),$names)} else if ($node instance of document-node()) then functx:remove-elements-not-contents($node/node(), $names) else $node } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml-1 := b1 c1 Mixed content return let $in-xml-2 := b1 c1 Mixed content return (functx:remove-elements-not-contents( $in-xml-1, ('b','c')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("b1c1Mixed content", false) ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Removes descendant XML elements but keeps their content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements-not-contents.html : @param $nodes the root(s) to start from : @param $names the names of the elements to remove ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxRemoveElementsNotContents3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Removes descendant XML elements but keeps their content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements-not-contents.html : @param $nodes the root(s) to start from : @param $names the names of the elements to remove :)\n" + " declare function functx:remove-elements-not-contents ( $nodes as node()* , $names as xs:string* ) as node()* { for $node in $nodes return if ($node instance of element()) then if (functx:name-test(name($node),$names)) then functx:remove-elements-not-contents($node/node(), $names) else element {node-name($node)} {$node/@*, functx:remove-elements-not-contents($node/node(),$names)} else if ($node instance of document-node()) then functx:remove-elements-not-contents($node/node(), $names) else $node } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml-1 := b1 c1 Mixed content return let $in-xml-2 := b1 c1 Mixed content return (functx:remove-elements-not-contents( $in-xml-1, 'a'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("b1c1Mixed content", false) ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Removes descendant XML elements but keeps their content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements-not-contents.html : @param $nodes the root(s) to start from : @param $names the names of the elements to remove ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxRemoveElementsNotContents4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Removes descendant XML elements but keeps their content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements-not-contents.html : @param $nodes the root(s) to start from : @param $names the names of the elements to remove :)\n" + " declare function functx:remove-elements-not-contents ( $nodes as node()* , $names as xs:string* ) as node()* { for $node in $nodes return if ($node instance of element()) then if (functx:name-test(name($node),$names)) then functx:remove-elements-not-contents($node/node(), $names) else element {node-name($node)} {$node/@*, functx:remove-elements-not-contents($node/node(),$names)} else if ($node instance of document-node()) then functx:remove-elements-not-contents($node/node(), $names) else $node } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml-1 := b1 c1 Mixed content return let $in-xml-2 := b1 c1 Mixed content return (functx:remove-elements-not-contents( $in-xml-2, 'x:b'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("b1c1Mixed content", false) ); } /** * ~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards ~ : Removes descendant XML elements but keeps their content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements-not-contents.html : @param $nodes the root(s) to start from : @param $names the names of the elements to remove ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxRemoveElementsNotContentsAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether a name matches a list of names or name wildcards : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_name-test.html : @param $testname the name to test : @param $names the list of names or name wildcards :)\n" + " declare function functx:name-test ( $testname as xs:string? , $names as xs:string* ) as xs:boolean { $testname = $names or $names = '*' or functx:substring-after-if-contains($testname,':') = (for $name in $names return substring-after($name,'*:')) or substring-before($testname,':') = (for $name in $names[contains(.,':*')] return substring-before($name,':*')) } ;\n" + " (:~ : Removes descendant XML elements but keeps their content : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_remove-elements-not-contents.html : @param $nodes the root(s) to start from : @param $names the names of the elements to remove :)\n" + " declare function functx:remove-elements-not-contents ( $nodes as node()* , $names as xs:string* ) as node()* { for $node in $nodes return if ($node instance of element()) then if (functx:name-test(name($node),$names)) then functx:remove-elements-not-contents($node/node(), $names) else element {node-name($node)} {$node/@*, functx:remove-elements-not-contents($node/node(),$names)} else if ($node instance of document-node()) then functx:remove-elements-not-contents($node/node(), $names) else $node } ;\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " let $in-xml-1 := b1 c1 Mixed content return let $in-xml-2 := b1 c1 Mixed content return (functx:remove-elements-not-contents( $in-xml-1, 'b'), functx:remove-elements-not-contents( $in-xml-1, ('b','c')), functx:remove-elements-not-contents( $in-xml-1, 'a'), functx:remove-elements-not-contents( $in-xml-2, 'x:b'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("b1c1Mixed contentb1c1Mixed contentb1c1Mixed contentb1c1Mixed content", false) ); } /** * ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxRepeatString1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:repeat-string('*', 6))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "******") ); } /** * ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxRepeatString2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:repeat-string('abc', 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcabcabc") ); } /** * ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies . */ @org.junit.Test public void functxFunctxRepeatStringAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (functx:repeat-string('*', 6), functx:repeat-string('abc', 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "****** abcabcabc") ); } /** * ~ : Replaces the beginning of a string, up to a matched pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-beginning.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace up to : @param $replacement the replacement string . */ @org.junit.Test public void functxFunctxReplaceBeginning1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Replaces the beginning of a string, up to a matched pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-beginning.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace up to : @param $replacement the replacement string :)\n" + " declare function functx:replace-beginning ( $arg as xs:string? , $pattern as xs:string , $replacement as xs:string ) as xs:string { replace($arg, concat('^.*?', $pattern), $replacement) } ;\n" + " (functx:replace-beginning('abc-def', '-', 'xxx'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xxxdef") ); } /** * ~ : Replaces the beginning of a string, up to a matched pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-beginning.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace up to : @param $replacement the replacement string . */ @org.junit.Test public void functxFunctxReplaceBeginning2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Replaces the beginning of a string, up to a matched pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-beginning.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace up to : @param $replacement the replacement string :)\n" + " declare function functx:replace-beginning ( $arg as xs:string? , $pattern as xs:string , $replacement as xs:string ) as xs:string { replace($arg, concat('^.*?', $pattern), $replacement) } ;\n" + " (functx:replace-beginning('abc-def', '-', ''))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "def") ); } /** * ~ : Replaces the beginning of a string, up to a matched pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-beginning.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace up to : @param $replacement the replacement string . */ @org.junit.Test public void functxFunctxReplaceBeginning3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Replaces the beginning of a string, up to a matched pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-beginning.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace up to : @param $replacement the replacement string :)\n" + " declare function functx:replace-beginning ( $arg as xs:string? , $pattern as xs:string , $replacement as xs:string ) as xs:string { replace($arg, concat('^.*?', $pattern), $replacement) } ;\n" + " (functx:replace-beginning( '---abc', '[a-z]', 'x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xbc") ); } /** * ~ : Replaces the beginning of a string, up to a matched pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-beginning.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace up to : @param $replacement the replacement string . */ @org.junit.Test public void functxFunctxReplaceBeginning4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Replaces the beginning of a string, up to a matched pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-beginning.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace up to : @param $replacement the replacement string :)\n" + " declare function functx:replace-beginning ( $arg as xs:string? , $pattern as xs:string , $replacement as xs:string ) as xs:string { replace($arg, concat('^.*?', $pattern), $replacement) } ;\n" + " (functx:replace-beginning( '2004-12-05', '-', '2005-'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2005-12-05") ); } /** * ~ : Replaces the beginning of a string, up to a matched pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-beginning.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace up to : @param $replacement the replacement string . */ @org.junit.Test public void functxFunctxReplaceBeginningAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Replaces the beginning of a string, up to a matched pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-beginning.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace up to : @param $replacement the replacement string :)\n" + " declare function functx:replace-beginning ( $arg as xs:string? , $pattern as xs:string , $replacement as xs:string ) as xs:string { replace($arg, concat('^.*?', $pattern), $replacement) } ;\n" + " (functx:replace-beginning('abc-def', '-', 'xxx'), functx:replace-beginning('abc-def', '-', ''), functx:replace-beginning( '---abc', '[a-z]', 'x'), functx:replace-beginning( '2004-12-05', '-', '2005-'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xxxdef def xbc 2005-12-05") ); } /** * ~ : Updates the content of one or more elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-element-values.html : @param $elements the elements whose content you wish to replace : @param $values the replacement values . */ @org.junit.Test public void functxFunctxReplaceElementValues1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Updates the content of one or more elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-element-values.html : @param $elements the elements whose content you wish to replace : @param $values the replacement values :)\n" + " declare function functx:replace-element-values ( $elements as element()* , $values as xs:anyAtomicType* ) as element()* { for $element at $seq in $elements return element { node-name($element)} { $element/@*, $values[$seq] } } ;\n" + " let $in-xml := 12 20 5 return (functx:replace-element-values( $in-xml/price, for $p in $in-xml/price return $p * 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("244010", false) ); } /** * ~ : Updates the content of one or more elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-element-values.html : @param $elements the elements whose content you wish to replace : @param $values the replacement values . */ @org.junit.Test public void functxFunctxReplaceElementValues2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Updates the content of one or more elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-element-values.html : @param $elements the elements whose content you wish to replace : @param $values the replacement values :)\n" + " declare function functx:replace-element-values ( $elements as element()* , $values as xs:anyAtomicType* ) as element()* { for $element at $seq in $elements return element { node-name($element)} { $element/@*, $values[$seq] } } ;\n" + " let $in-xml := 12 20 5 return (for $p in $in-xml/price return functx:replace-element-values( $p,concat($p,'.0')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("12.020.05.0", false) ); } /** * ~ : Updates the content of one or more elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-element-values.html : @param $elements the elements whose content you wish to replace : @param $values the replacement values . */ @org.junit.Test public void functxFunctxReplaceElementValuesAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Updates the content of one or more elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-element-values.html : @param $elements the elements whose content you wish to replace : @param $values the replacement values :)\n" + " declare function functx:replace-element-values ( $elements as element()* , $values as xs:anyAtomicType* ) as element()* { for $element at $seq in $elements return element { node-name($element)} { $element/@*, $values[$seq] } } ;\n" + " let $in-xml := 12 20 5 return (functx:replace-element-values( $in-xml/price, for $p in $in-xml/price return $p * 2), for $p in $in-xml/price return functx:replace-element-values( $p,concat($p,'.0')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("24401012.020.05.0", false) ); } /** * ~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string . */ @org.junit.Test public void functxFunctxReplaceFirst1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string :)\n" + " declare function functx:replace-first ( $arg as xs:string? , $pattern as xs:string , $replacement as xs:string ) as xs:string { replace($arg, concat('(^.*?)', $pattern), concat('$1',$replacement)) } ;\n" + " (functx:replace-first('abcabcabc', 'ab', 'x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xcabcabc") ); } /** * ~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string . */ @org.junit.Test public void functxFunctxReplaceFirst2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string :)\n" + " declare function functx:replace-first ( $arg as xs:string? , $pattern as xs:string , $replacement as xs:string ) as xs:string { replace($arg, concat('(^.*?)', $pattern), concat('$1',$replacement)) } ;\n" + " (functx:replace-first('elementary', 'e.*e', 'x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xntary") ); } /** * ~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string . */ @org.junit.Test public void functxFunctxReplaceFirst3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string :)\n" + " declare function functx:replace-first ( $arg as xs:string? , $pattern as xs:string , $replacement as xs:string ) as xs:string { replace($arg, concat('(^.*?)', $pattern), concat('$1',$replacement)) } ;\n" + " (functx:replace-first( 'elementary', 'e.*?e', 'x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xmentary") ); } /** * ~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string . */ @org.junit.Test public void functxFunctxReplaceFirst4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string :)\n" + " declare function functx:replace-first ( $arg as xs:string? , $pattern as xs:string , $replacement as xs:string ) as xs:string { replace($arg, concat('(^.*?)', $pattern), concat('$1',$replacement)) } ;\n" + " (functx:replace-first('9999-9999', '\\d+', 'X'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "X-9999") ); } /** * ~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string . */ @org.junit.Test public void functxFunctxReplaceFirst5() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string :)\n" + " declare function functx:replace-first ( $arg as xs:string? , $pattern as xs:string , $replacement as xs:string ) as xs:string { replace($arg, concat('(^.*?)', $pattern), concat('$1',$replacement)) } ;\n" + " (functx:replace-first('9999-9999', '\\d{3}', 'X'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "X9-9999") ); } /** * ~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string . */ @org.junit.Test public void functxFunctxReplaceFirstAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Replaces the first match of a pattern : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-first.html : @param $arg the entire string to change : @param $pattern the pattern of characters to replace : @param $replacement the replacement string :)\n" + " declare function functx:replace-first ( $arg as xs:string? , $pattern as xs:string , $replacement as xs:string ) as xs:string { replace($arg, concat('(^.*?)', $pattern), concat('$1',$replacement)) } ;\n" + " (functx:replace-first('abcabcabc', 'ab', 'x'), functx:replace-first('elementary', 'e.*e', 'x'), functx:replace-first( 'elementary', 'e.*?e', 'x'), functx:replace-first('9999-9999', '\\d+', 'X'), functx:replace-first('9999-9999', '\\d{3}', 'X'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xcabcabc xntary xmentary X-9999 X9-9999") ); } /** * ~ : The first argument if it is not empty, otherwise the second argument : : @author W3C XML Query WG : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-absent.html : @param $arg the item(s) that may be absent : @param $value the item(s) to use if the item is absent ~ : Performs multiple replacements, using pairs of replace parameters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-multi.html : @param $arg the string to manipulate : @param $changeFrom the sequence of strings or patterns to change from : @param $changeTo the sequence of strings to change to . */ @org.junit.Test public void functxFunctxReplaceMulti1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first argument if it is not empty, otherwise the second argument : : @author W3C XML Query WG : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-absent.html : @param $arg the item(s) that may be absent : @param $value the item(s) to use if the item is absent :)\n" + " declare function functx:if-absent\n" + " ( $arg as item()* , $value as item()* ) as item()* {\n" + " if (exists($arg)) then $arg else $value } ;\n" + " (:~ : Performs multiple replacements, using pairs of replace parameters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_replace-multi.html : @param $arg the string to manipulate : @param $changeFrom the sequence of strings or patterns to change from : @param $changeTo the sequence of strings to change to :)\n" + " declare function functx:replace-multi ( $arg as xs:string? , $changeFrom as xs:string* , $changeTo as xs:string* ) as xs:string? {\n" + " if (count($changeFrom) > 0)\n" + " then functx:replace-multi( replace($arg, $changeFrom[1], functx:if-absent($changeTo[1],'')), $changeFrom[position() > 1], $changeTo[position() > 1])\n" + " else $arg\n" + " } ;\n" + " let $fr := ('[a-c]', 'def', '\\d+')\n" + " return let $to := ('x', 'y', '0')\n" + " return (functx:replace-multi('abcdef123',$fr,$to))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xxxy0") ); } /** * ~ : Reverses the order of characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_reverse-string.html : @param $arg the string to reverse . */ @org.junit.Test public void functxFunctxReverseString1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Reverses the order of characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_reverse-string.html : @param $arg the string to reverse :)\n" + " declare function functx:reverse-string ( $arg as xs:string? ) as xs:string { codepoints-to-string(reverse(string-to-codepoints($arg))) } ;\n" + " (functx:reverse-string('abc'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "cba") ); } /** * ~ : Reverses the order of characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_reverse-string.html : @param $arg the string to reverse . */ @org.junit.Test public void functxFunctxReverseString2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Reverses the order of characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_reverse-string.html : @param $arg the string to reverse :)\n" + " declare function functx:reverse-string ( $arg as xs:string? ) as xs:string { codepoints-to-string(reverse(string-to-codepoints($arg))) } ;\n" + " (functx:reverse-string('a'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a") ); } /** * ~ : Reverses the order of characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_reverse-string.html : @param $arg the string to reverse . */ @org.junit.Test public void functxFunctxReverseStringAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Reverses the order of characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_reverse-string.html : @param $arg the string to reverse :)\n" + " declare function functx:reverse-string ( $arg as xs:string? ) as xs:string { codepoints-to-string(reverse(string-to-codepoints($arg))) } ;\n" + " (functx:reverse-string('abc'), functx:reverse-string('a'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "cba a") ); } /** * ~ : Trims trailing whitespace : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_right-trim.html : @param $arg the string to trim . */ @org.junit.Test public void functxFunctxRightTrim1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Trims trailing whitespace : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_right-trim.html : @param $arg the string to trim :)\n" + " declare function functx:right-trim ( $arg as xs:string? ) as xs:string { replace($arg,'\\s+$','') } ;\n" + " (functx:right-trim('xyz '))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xyz") ); } /** * ~ : Trims trailing whitespace : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_right-trim.html : @param $arg the string to trim . */ @org.junit.Test public void functxFunctxRightTrim2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Trims trailing whitespace : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_right-trim.html : @param $arg the string to trim :)\n" + " declare function functx:right-trim ( $arg as xs:string? ) as xs:string { replace($arg,'\\s+$','') } ;\n" + " (functx:right-trim(' x xyz '))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, " x xyz") ); } /** * ~ : Trims trailing whitespace : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_right-trim.html : @param $arg the string to trim . */ @org.junit.Test public void functxFunctxRightTrim3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Trims trailing whitespace : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_right-trim.html : @param $arg the string to trim :)\n" + " declare function functx:right-trim ( $arg as xs:string? ) as xs:string { replace($arg,'\\s+$','') } ;\n" + " (functx:right-trim('xyz'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xyz") ); } /** * ~ : Trims trailing whitespace : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_right-trim.html : @param $arg the string to trim . */ @org.junit.Test public void functxFunctxRightTrimAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Trims trailing whitespace : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_right-trim.html : @param $arg the string to trim :)\n" + " declare function functx:right-trim ( $arg as xs:string? ) as xs:string { replace($arg,'\\s+$','') } ;\n" + " (functx:right-trim('xyz '), functx:right-trim(' x xyz '), functx:right-trim('xyz'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"xyz\", \" x xyz\", \"xyz\"") ); } /** * ~ : Returns the scheme from a URI : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_scheme-from-uri.html : @param $uri the URI . */ @org.junit.Test public void functxFunctxSchemeFromUri1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Returns the scheme from a URI : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_scheme-from-uri.html : @param $uri the URI :)\n" + " declare function functx:scheme-from-uri ( $uri as xs:string? ) as xs:string? { substring-before($uri,':') } ;\n" + " (functx:scheme-from-uri( 'http://www.datypic.com'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http") ); } /** * ~ : Returns the scheme from a URI : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_scheme-from-uri.html : @param $uri the URI . */ @org.junit.Test public void functxFunctxSchemeFromUri2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Returns the scheme from a URI : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_scheme-from-uri.html : @param $uri the URI :)\n" + " declare function functx:scheme-from-uri ( $uri as xs:string? ) as xs:string? { substring-before($uri,':') } ;\n" + " (functx:scheme-from-uri( 'ftp://ftp.datypic.com'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ftp") ); } /** * ~ : Returns the scheme from a URI : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_scheme-from-uri.html : @param $uri the URI . */ @org.junit.Test public void functxFunctxSchemeFromUri3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Returns the scheme from a URI : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_scheme-from-uri.html : @param $uri the URI :)\n" + " declare function functx:scheme-from-uri ( $uri as xs:string? ) as xs:string? { substring-before($uri,':') } ;\n" + " (functx:scheme-from-uri('ftp.datypic.com'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * ~ : Returns the scheme from a URI : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_scheme-from-uri.html : @param $uri the URI . */ @org.junit.Test public void functxFunctxSchemeFromUri4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Returns the scheme from a URI : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_scheme-from-uri.html : @param $uri the URI :)\n" + " declare function functx:scheme-from-uri ( $uri as xs:string? ) as xs:string? { substring-before($uri,':') } ;\n" + " (functx:scheme-from-uri('www.datypic.com'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * ~ : Returns the scheme from a URI : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_scheme-from-uri.html : @param $uri the URI . */ @org.junit.Test public void functxFunctxSchemeFromUri5() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Returns the scheme from a URI : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_scheme-from-uri.html : @param $uri the URI :)\n" + " declare function functx:scheme-from-uri ( $uri as xs:string? ) as xs:string? { substring-before($uri,':') } ;\n" + " (functx:scheme-from-uri('prod.html'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * ~ : Returns the scheme from a URI : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_scheme-from-uri.html : @param $uri the URI . */ @org.junit.Test public void functxFunctxSchemeFromUriAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Returns the scheme from a URI : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_scheme-from-uri.html : @param $uri the URI :)\n" + " declare function functx:scheme-from-uri ( $uri as xs:string? ) as xs:string? { substring-before($uri,':') } ;\n" + " (functx:scheme-from-uri( 'http://www.datypic.com'), functx:scheme-from-uri( 'ftp://ftp.datypic.com'), functx:scheme-from-uri('ftp.datypic.com'), functx:scheme-from-uri('www.datypic.com'), functx:scheme-from-uri('prod.html'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http ftp ") ); } /** * ~ : Whether two sequences have the same XML node content and/or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-deep-equal.html : @param $seq1 the first sequence : @param $seq2 the second sequence . */ @org.junit.Test public void functxFunctxSequenceDeepEqual1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether two sequences have the same XML node content and/or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-deep-equal.html : @param $seq1 the first sequence : @param $seq2 the second sequence :)\n" + " declare function functx:sequence-deep-equal ( $seq1 as item()* , $seq2 as item()* ) as xs:boolean { every $i in 1 to max((count($seq1),count($seq2))) satisfies deep-equal($seq1[$i],$seq2[$i]) } ;\n" + " let $in-xml := Kate Jones John Doe return let $anAuthor := Kate Jones return (functx:sequence-deep-equal( $in-xml/author/*, $in-xml/*/*))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether two sequences have the same XML node content and/or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-deep-equal.html : @param $seq1 the first sequence : @param $seq2 the second sequence . */ @org.junit.Test public void functxFunctxSequenceDeepEqual2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether two sequences have the same XML node content and/or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-deep-equal.html : @param $seq1 the first sequence : @param $seq2 the second sequence :)\n" + " declare function functx:sequence-deep-equal ( $seq1 as item()* , $seq2 as item()* ) as xs:boolean { every $i in 1 to max((count($seq1),count($seq2))) satisfies deep-equal($seq1[$i],$seq2[$i]) } ;\n" + " let $in-xml := Kate Jones John Doe return let $anAuthor := Kate Jones return (functx:sequence-deep-equal( $in-xml/author[1], $anAuthor))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether two sequences have the same XML node content and/or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-deep-equal.html : @param $seq1 the first sequence : @param $seq2 the second sequence . */ @org.junit.Test public void functxFunctxSequenceDeepEqual3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether two sequences have the same XML node content and/or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-deep-equal.html : @param $seq1 the first sequence : @param $seq2 the second sequence :)\n" + " declare function functx:sequence-deep-equal ( $seq1 as item()* , $seq2 as item()* ) as xs:boolean { every $i in 1 to max((count($seq1),count($seq2))) satisfies deep-equal($seq1[$i],$seq2[$i]) } ;\n" + " let $in-xml := Kate Jones John Doe return let $anAuthor := Kate Jones return (functx:sequence-deep-equal( (1,2,3), (1.0,2.0,3.0)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether two sequences have the same XML node content and/or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-deep-equal.html : @param $seq1 the first sequence : @param $seq2 the second sequence . */ @org.junit.Test public void functxFunctxSequenceDeepEqualAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether two sequences have the same XML node content and/or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-deep-equal.html : @param $seq1 the first sequence : @param $seq2 the second sequence :)\n" + " declare function functx:sequence-deep-equal ( $seq1 as item()* , $seq2 as item()* ) as xs:boolean { every $i in 1 to max((count($seq1),count($seq2))) satisfies deep-equal($seq1[$i],$seq2[$i]) } ;\n" + " let $in-xml := Kate Jones John Doe return let $anAuthor := Kate Jones return (functx:sequence-deep-equal( $in-xml/author/*, $in-xml/*/*), functx:sequence-deep-equal( $in-xml/author[1], $anAuthor), functx:sequence-deep-equal( (1,2,3), (1.0,2.0,3.0)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true true") ); } /** * ~ : Whether two sequences contain the same XML nodes, in the same order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-node-equal.html : @param $seq1 the first sequence of nodes : @param $seq2 the second sequence of nodes . */ @org.junit.Test public void functxFunctxSequenceNodeEqual1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether two sequences contain the same XML nodes, in the same order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-node-equal.html : @param $seq1 the first sequence of nodes : @param $seq2 the second sequence of nodes :)\n" + " declare function functx:sequence-node-equal ( $seq1 as node()* , $seq2 as node()* ) as xs:boolean { every $i in 1 to max((count($seq1),count($seq2))) satisfies $seq1[$i] is $seq2[$i] } ;\n" + " let $in-xml := Kate Jones John Doe return let $anAuthor := Kate Jones return (functx:sequence-node-equal( $in-xml/author/*, $in-xml/*/*))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether two sequences contain the same XML nodes, in the same order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-node-equal.html : @param $seq1 the first sequence of nodes : @param $seq2 the second sequence of nodes . */ @org.junit.Test public void functxFunctxSequenceNodeEqual2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether two sequences contain the same XML nodes, in the same order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-node-equal.html : @param $seq1 the first sequence of nodes : @param $seq2 the second sequence of nodes :)\n" + " declare function functx:sequence-node-equal ( $seq1 as node()* , $seq2 as node()* ) as xs:boolean { every $i in 1 to max((count($seq1),count($seq2))) satisfies $seq1[$i] is $seq2[$i] } ;\n" + " let $in-xml := Kate Jones John Doe return let $anAuthor := Kate Jones return (functx:sequence-node-equal( $in-xml/author, ($in-xml/author[2],$in-xml/author[1])))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether two sequences contain the same XML nodes, in the same order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-node-equal.html : @param $seq1 the first sequence of nodes : @param $seq2 the second sequence of nodes . */ @org.junit.Test public void functxFunctxSequenceNodeEqual3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether two sequences contain the same XML nodes, in the same order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-node-equal.html : @param $seq1 the first sequence of nodes : @param $seq2 the second sequence of nodes :)\n" + " declare function functx:sequence-node-equal ( $seq1 as node()* , $seq2 as node()* ) as xs:boolean { every $i in 1 to max((count($seq1),count($seq2))) satisfies $seq1[$i] is $seq2[$i] } ;\n" + " let $in-xml := Kate Jones John Doe return let $anAuthor := Kate Jones return (functx:sequence-node-equal( $in-xml/author[1],$anAuthor))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether two sequences contain the same XML nodes, in the same order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-node-equal.html : @param $seq1 the first sequence of nodes : @param $seq2 the second sequence of nodes . */ @org.junit.Test public void functxFunctxSequenceNodeEqualAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether two sequences contain the same XML nodes, in the same order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-node-equal.html : @param $seq1 the first sequence of nodes : @param $seq2 the second sequence of nodes :)\n" + " declare function functx:sequence-node-equal ( $seq1 as node()* , $seq2 as node()* ) as xs:boolean { every $i in 1 to max((count($seq1),count($seq2))) satisfies $seq1[$i] is $seq2[$i] } ;\n" + " let $in-xml := Kate Jones John Doe return let $anAuthor := Kate Jones return (functx:sequence-node-equal( $in-xml/author/*, $in-xml/*/*), functx:sequence-node-equal( $in-xml/author, ($in-xml/author[2],$in-xml/author[1])), functx:sequence-node-equal( $in-xml/author[1],$anAuthor))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true false false") ); } /** * ~ : Whether two sequences contain the same XML nodes, regardless of order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-node-equal-any-order.html : @param $seq1 the first sequence of nodes : @param $seq2 the second sequence of nodes . */ @org.junit.Test public void functxFunctxSequenceNodeEqualAnyOrder1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether two sequences contain the same XML nodes, regardless of order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-node-equal-any-order.html : @param $seq1 the first sequence of nodes : @param $seq2 the second sequence of nodes :)\n" + " declare function functx:sequence-node-equal-any-order ( $seq1 as node()* , $seq2 as node()* ) as xs:boolean { not( ($seq1 except $seq2, $seq2 except $seq1)) } ;\n" + " let $in-xml := Kate Jones John Doe return let $anAuthor := Kate Jones return (functx:sequence-node-equal-any-order( $in-xml/author, $in-xml/*))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether two sequences contain the same XML nodes, regardless of order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-node-equal-any-order.html : @param $seq1 the first sequence of nodes : @param $seq2 the second sequence of nodes . */ @org.junit.Test public void functxFunctxSequenceNodeEqualAnyOrder2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether two sequences contain the same XML nodes, regardless of order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-node-equal-any-order.html : @param $seq1 the first sequence of nodes : @param $seq2 the second sequence of nodes :)\n" + " declare function functx:sequence-node-equal-any-order ( $seq1 as node()* , $seq2 as node()* ) as xs:boolean { not( ($seq1 except $seq2, $seq2 except $seq1)) } ;\n" + " let $in-xml := Kate Jones John Doe return let $anAuthor := Kate Jones return (functx:sequence-node-equal-any-order( $in-xml/author, ($in-xml/author[2],$in-xml/author[1])))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ~ : Whether two sequences contain the same XML nodes, regardless of order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-node-equal-any-order.html : @param $seq1 the first sequence of nodes : @param $seq2 the second sequence of nodes . */ @org.junit.Test public void functxFunctxSequenceNodeEqualAnyOrder3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether two sequences contain the same XML nodes, regardless of order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-node-equal-any-order.html : @param $seq1 the first sequence of nodes : @param $seq2 the second sequence of nodes :)\n" + " declare function functx:sequence-node-equal-any-order ( $seq1 as node()* , $seq2 as node()* ) as xs:boolean { not( ($seq1 except $seq2, $seq2 except $seq1)) } ;\n" + " let $in-xml := Kate Jones John Doe return let $anAuthor := Kate Jones return (functx:sequence-node-equal-any-order( $in-xml/author[1],$anAuthor))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * ~ : Whether two sequences contain the same XML nodes, regardless of order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-node-equal-any-order.html : @param $seq1 the first sequence of nodes : @param $seq2 the second sequence of nodes . */ @org.junit.Test public void functxFunctxSequenceNodeEqualAnyOrderAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Whether two sequences contain the same XML nodes, regardless of order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-node-equal-any-order.html : @param $seq1 the first sequence of nodes : @param $seq2 the second sequence of nodes :)\n" + " declare function functx:sequence-node-equal-any-order ( $seq1 as node()* , $seq2 as node()* ) as xs:boolean { not( ($seq1 except $seq2, $seq2 except $seq1)) } ;\n" + " let $in-xml := Kate Jones John Doe return let $anAuthor := Kate Jones return (functx:sequence-node-equal-any-order( $in-xml/author, $in-xml/*), functx:sequence-node-equal-any-order( $in-xml/author, ($in-xml/author[2],$in-xml/author[1])), functx:sequence-node-equal-any-order( $in-xml/author[1],$anAuthor))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true false") ); } /** * ~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine ~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine ~ : The sequence type that represents a sequence of nodes or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-type.html : @param $items the items whose sequence type you want to determine . */ @org.junit.Test public void functxFunctxSequenceType1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine :)\n" + " declare function functx:atomic-type ( $values as xs:anyAtomicType* ) as xs:string* { for $val in $values return (if ($val instance of xs:untypedAtomic) then 'xs:untypedAtomic' else if ($val instance of xs:anyURI) then 'xs:anyURI' else if ($val instance of xs:ENTITY) then 'xs:ENTITY' else if ($val instance of xs:ID) then 'xs:ID' else if ($val instance of xs:NMTOKEN) then 'xs:NMTOKEN' else if ($val instance of xs:language) then 'xs:language' else if ($val instance of xs:NCName) then 'xs:NCName' else if ($val instance of xs:Name) then 'xs:Name' else if ($val instance of xs:token) then 'xs:token' else if ($val instance of xs:normalizedString) then 'xs:normalizedString' else if ($val instance of xs:string) then 'xs:string' else if ($val instance of xs:QName) then 'xs:QName' else if ($val instance of xs:boolean) then 'xs:boolean' else if ($val instance of xs:base64Binary) then 'xs:base64Binary' else if ($val instance of xs:hexBinary) then 'xs:hexBinary' else if ($val instance of xs:byte) then 'xs:byte' else if ($val instance of xs:short) then 'xs:short' else if ($val instance of xs:int) then 'xs:int' else if ($val instance of xs:long) then 'xs:long' else if ($val instance of xs:unsignedByte) then 'xs:unsignedByte' else if ($val instance of xs:unsignedShort) then 'xs:unsignedShort' else if ($val instance of xs:unsignedInt) then 'xs:unsignedInt' else if ($val instance of xs:unsignedLong) then 'xs:unsignedLong' else if ($val instance of xs:positiveInteger) then 'xs:positiveInteger' else if ($val instance of xs:nonNegativeInteger) then 'xs:nonNegativeInteger' else if ($val instance of xs:negativeInteger) then 'xs:negativeInteger' else if ($val instance of xs:nonPositiveInteger) then 'xs:nonPositiveInteger' else if ($val instance of xs:integer) then 'xs:integer' else if ($val instance of xs:decimal) then 'xs:decimal' else if ($val instance of xs:float) then 'xs:float' else if ($val instance of xs:double) then 'xs:double' else if ($val instance of xs:date) then 'xs:date' else if ($val instance of xs:time) then 'xs:time' else if ($val instance of xs:dateTime) then 'xs:dateTime' else if ($val instance of xs:dayTimeDuration) then 'xs:dayTimeDuration' else if ($val instance of xs:yearMonthDuration) then 'xs:yearMonthDuration' else if ($val instance of xs:duration) then 'xs:duration' else if ($val instance of xs:gMonth) then 'xs:gMonth' else if ($val instance of xs:gYear) then 'xs:gYear' else if ($val instance of xs:gYearMonth) then 'xs:gYearMonth' else if ($val instance of xs:gDay) then 'xs:gDay' else if ($val instance of xs:gMonthDay) then 'xs:gMonthDay' else 'unknown') } ;\n" + " (:~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine :)\n" + " declare function functx:node-kind ( $nodes as node()* ) as xs:string* { for $node in $nodes return if ($node instance of element()) then 'element' else if ($node instance of attribute()) then 'attribute' else if ($node instance of text()) then 'text' else if ($node instance of document-node()) then 'document-node' else if ($node instance of comment()) then 'comment' else if ($node instance of processing-instruction()) then 'processing-instruction' else 'unknown' } ;\n" + " (:~ : The sequence type that represents a sequence of nodes or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-type.html : @param $items the items whose sequence type you want to determine :)\n" + " declare function functx:sequence-type ( $items as item()* ) as xs:string { concat( if (empty($items)) then 'empty-sequence()' else if (every $val in $items satisfies $val instance of xs:anyAtomicType) then if (count(distinct-values(functx:atomic-type($items))) > 1) then 'xs:anyAtomicType' else functx:atomic-type($items[1]) else if (some $val in $items satisfies $val instance of xs:anyAtomicType) then 'item()' else if (count(distinct-values(functx:node-kind($items))) > 1) then 'node()' else concat(functx:node-kind($items[1]),'()') , if (count($items) > 1) then '+' else '') } ;\n" + " let $in-xml := x x return (functx:sequence-type(2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xs:integer") ); } /** * ~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine ~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine ~ : The sequence type that represents a sequence of nodes or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-type.html : @param $items the items whose sequence type you want to determine . */ @org.junit.Test public void functxFunctxSequenceType10() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine :)\n" + " declare function functx:atomic-type ( $values as xs:anyAtomicType* ) as xs:string* { for $val in $values return (if ($val instance of xs:untypedAtomic) then 'xs:untypedAtomic' else if ($val instance of xs:anyURI) then 'xs:anyURI' else if ($val instance of xs:ENTITY) then 'xs:ENTITY' else if ($val instance of xs:ID) then 'xs:ID' else if ($val instance of xs:NMTOKEN) then 'xs:NMTOKEN' else if ($val instance of xs:language) then 'xs:language' else if ($val instance of xs:NCName) then 'xs:NCName' else if ($val instance of xs:Name) then 'xs:Name' else if ($val instance of xs:token) then 'xs:token' else if ($val instance of xs:normalizedString) then 'xs:normalizedString' else if ($val instance of xs:string) then 'xs:string' else if ($val instance of xs:QName) then 'xs:QName' else if ($val instance of xs:boolean) then 'xs:boolean' else if ($val instance of xs:base64Binary) then 'xs:base64Binary' else if ($val instance of xs:hexBinary) then 'xs:hexBinary' else if ($val instance of xs:byte) then 'xs:byte' else if ($val instance of xs:short) then 'xs:short' else if ($val instance of xs:int) then 'xs:int' else if ($val instance of xs:long) then 'xs:long' else if ($val instance of xs:unsignedByte) then 'xs:unsignedByte' else if ($val instance of xs:unsignedShort) then 'xs:unsignedShort' else if ($val instance of xs:unsignedInt) then 'xs:unsignedInt' else if ($val instance of xs:unsignedLong) then 'xs:unsignedLong' else if ($val instance of xs:positiveInteger) then 'xs:positiveInteger' else if ($val instance of xs:nonNegativeInteger) then 'xs:nonNegativeInteger' else if ($val instance of xs:negativeInteger) then 'xs:negativeInteger' else if ($val instance of xs:nonPositiveInteger) then 'xs:nonPositiveInteger' else if ($val instance of xs:integer) then 'xs:integer' else if ($val instance of xs:decimal) then 'xs:decimal' else if ($val instance of xs:float) then 'xs:float' else if ($val instance of xs:double) then 'xs:double' else if ($val instance of xs:date) then 'xs:date' else if ($val instance of xs:time) then 'xs:time' else if ($val instance of xs:dateTime) then 'xs:dateTime' else if ($val instance of xs:dayTimeDuration) then 'xs:dayTimeDuration' else if ($val instance of xs:yearMonthDuration) then 'xs:yearMonthDuration' else if ($val instance of xs:duration) then 'xs:duration' else if ($val instance of xs:gMonth) then 'xs:gMonth' else if ($val instance of xs:gYear) then 'xs:gYear' else if ($val instance of xs:gYearMonth) then 'xs:gYearMonth' else if ($val instance of xs:gDay) then 'xs:gDay' else if ($val instance of xs:gMonthDay) then 'xs:gMonthDay' else 'unknown') } ;\n" + " (:~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine :)\n" + " declare function functx:node-kind ( $nodes as node()* ) as xs:string* { for $node in $nodes return if ($node instance of element()) then 'element' else if ($node instance of attribute()) then 'attribute' else if ($node instance of text()) then 'text' else if ($node instance of document-node()) then 'document-node' else if ($node instance of comment()) then 'comment' else if ($node instance of processing-instruction()) then 'processing-instruction' else 'unknown' } ;\n" + " (:~ : The sequence type that represents a sequence of nodes or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-type.html : @param $items the items whose sequence type you want to determine :)\n" + " declare function functx:sequence-type ( $items as item()* ) as xs:string { concat( if (empty($items)) then 'empty-sequence()' else if (every $val in $items satisfies $val instance of xs:anyAtomicType) then if (count(distinct-values(functx:atomic-type($items))) > 1) then 'xs:anyAtomicType' else functx:atomic-type($items[1]) else if (some $val in $items satisfies $val instance of xs:anyAtomicType) then 'item()' else if (count(distinct-values(functx:node-kind($items))) > 1) then 'node()' else concat(functx:node-kind($items[1]),'()') , if (count($items) > 1) then '+' else '') } ;\n" + " let $in-xml := x x return (functx:sequence-type($in-xml/node()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "node()+") ); } /** * ~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine ~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine ~ : The sequence type that represents a sequence of nodes or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-type.html : @param $items the items whose sequence type you want to determine . */ @org.junit.Test public void functxFunctxSequenceType11() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine :)\n" + " declare function functx:atomic-type ( $values as xs:anyAtomicType* ) as xs:string* { for $val in $values return (if ($val instance of xs:untypedAtomic) then 'xs:untypedAtomic' else if ($val instance of xs:anyURI) then 'xs:anyURI' else if ($val instance of xs:ENTITY) then 'xs:ENTITY' else if ($val instance of xs:ID) then 'xs:ID' else if ($val instance of xs:NMTOKEN) then 'xs:NMTOKEN' else if ($val instance of xs:language) then 'xs:language' else if ($val instance of xs:NCName) then 'xs:NCName' else if ($val instance of xs:Name) then 'xs:Name' else if ($val instance of xs:token) then 'xs:token' else if ($val instance of xs:normalizedString) then 'xs:normalizedString' else if ($val instance of xs:string) then 'xs:string' else if ($val instance of xs:QName) then 'xs:QName' else if ($val instance of xs:boolean) then 'xs:boolean' else if ($val instance of xs:base64Binary) then 'xs:base64Binary' else if ($val instance of xs:hexBinary) then 'xs:hexBinary' else if ($val instance of xs:byte) then 'xs:byte' else if ($val instance of xs:short) then 'xs:short' else if ($val instance of xs:int) then 'xs:int' else if ($val instance of xs:long) then 'xs:long' else if ($val instance of xs:unsignedByte) then 'xs:unsignedByte' else if ($val instance of xs:unsignedShort) then 'xs:unsignedShort' else if ($val instance of xs:unsignedInt) then 'xs:unsignedInt' else if ($val instance of xs:unsignedLong) then 'xs:unsignedLong' else if ($val instance of xs:positiveInteger) then 'xs:positiveInteger' else if ($val instance of xs:nonNegativeInteger) then 'xs:nonNegativeInteger' else if ($val instance of xs:negativeInteger) then 'xs:negativeInteger' else if ($val instance of xs:nonPositiveInteger) then 'xs:nonPositiveInteger' else if ($val instance of xs:integer) then 'xs:integer' else if ($val instance of xs:decimal) then 'xs:decimal' else if ($val instance of xs:float) then 'xs:float' else if ($val instance of xs:double) then 'xs:double' else if ($val instance of xs:date) then 'xs:date' else if ($val instance of xs:time) then 'xs:time' else if ($val instance of xs:dateTime) then 'xs:dateTime' else if ($val instance of xs:dayTimeDuration) then 'xs:dayTimeDuration' else if ($val instance of xs:yearMonthDuration) then 'xs:yearMonthDuration' else if ($val instance of xs:duration) then 'xs:duration' else if ($val instance of xs:gMonth) then 'xs:gMonth' else if ($val instance of xs:gYear) then 'xs:gYear' else if ($val instance of xs:gYearMonth) then 'xs:gYearMonth' else if ($val instance of xs:gDay) then 'xs:gDay' else if ($val instance of xs:gMonthDay) then 'xs:gMonthDay' else 'unknown') } ;\n" + " (:~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine :)\n" + " declare function functx:node-kind ( $nodes as node()* ) as xs:string* { for $node in $nodes return if ($node instance of element()) then 'element' else if ($node instance of attribute()) then 'attribute' else if ($node instance of text()) then 'text' else if ($node instance of document-node()) then 'document-node' else if ($node instance of comment()) then 'comment' else if ($node instance of processing-instruction()) then 'processing-instruction' else 'unknown' } ;\n" + " (:~ : The sequence type that represents a sequence of nodes or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-type.html : @param $items the items whose sequence type you want to determine :)\n" + " declare function functx:sequence-type ( $items as item()* ) as xs:string { concat( if (empty($items)) then 'empty-sequence()' else if (every $val in $items satisfies $val instance of xs:anyAtomicType) then if (count(distinct-values(functx:atomic-type($items))) > 1) then 'xs:anyAtomicType' else functx:atomic-type($items[1]) else if (some $val in $items satisfies $val instance of xs:anyAtomicType) then 'item()' else if (count(distinct-values(functx:node-kind($items))) > 1) then 'node()' else concat(functx:node-kind($items[1]),'()') , if (count($items) > 1) then '+' else '') } ;\n" + " let $in-xml := x x return (functx:sequence-type(($in-xml/*,'2')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "item()+") ); } /** * ~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine ~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine ~ : The sequence type that represents a sequence of nodes or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-type.html : @param $items the items whose sequence type you want to determine . */ @org.junit.Test public void functxFunctxSequenceType2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine :)\n" + " declare function functx:atomic-type ( $values as xs:anyAtomicType* ) as xs:string* { for $val in $values return (if ($val instance of xs:untypedAtomic) then 'xs:untypedAtomic' else if ($val instance of xs:anyURI) then 'xs:anyURI' else if ($val instance of xs:ENTITY) then 'xs:ENTITY' else if ($val instance of xs:ID) then 'xs:ID' else if ($val instance of xs:NMTOKEN) then 'xs:NMTOKEN' else if ($val instance of xs:language) then 'xs:language' else if ($val instance of xs:NCName) then 'xs:NCName' else if ($val instance of xs:Name) then 'xs:Name' else if ($val instance of xs:token) then 'xs:token' else if ($val instance of xs:normalizedString) then 'xs:normalizedString' else if ($val instance of xs:string) then 'xs:string' else if ($val instance of xs:QName) then 'xs:QName' else if ($val instance of xs:boolean) then 'xs:boolean' else if ($val instance of xs:base64Binary) then 'xs:base64Binary' else if ($val instance of xs:hexBinary) then 'xs:hexBinary' else if ($val instance of xs:byte) then 'xs:byte' else if ($val instance of xs:short) then 'xs:short' else if ($val instance of xs:int) then 'xs:int' else if ($val instance of xs:long) then 'xs:long' else if ($val instance of xs:unsignedByte) then 'xs:unsignedByte' else if ($val instance of xs:unsignedShort) then 'xs:unsignedShort' else if ($val instance of xs:unsignedInt) then 'xs:unsignedInt' else if ($val instance of xs:unsignedLong) then 'xs:unsignedLong' else if ($val instance of xs:positiveInteger) then 'xs:positiveInteger' else if ($val instance of xs:nonNegativeInteger) then 'xs:nonNegativeInteger' else if ($val instance of xs:negativeInteger) then 'xs:negativeInteger' else if ($val instance of xs:nonPositiveInteger) then 'xs:nonPositiveInteger' else if ($val instance of xs:integer) then 'xs:integer' else if ($val instance of xs:decimal) then 'xs:decimal' else if ($val instance of xs:float) then 'xs:float' else if ($val instance of xs:double) then 'xs:double' else if ($val instance of xs:date) then 'xs:date' else if ($val instance of xs:time) then 'xs:time' else if ($val instance of xs:dateTime) then 'xs:dateTime' else if ($val instance of xs:dayTimeDuration) then 'xs:dayTimeDuration' else if ($val instance of xs:yearMonthDuration) then 'xs:yearMonthDuration' else if ($val instance of xs:duration) then 'xs:duration' else if ($val instance of xs:gMonth) then 'xs:gMonth' else if ($val instance of xs:gYear) then 'xs:gYear' else if ($val instance of xs:gYearMonth) then 'xs:gYearMonth' else if ($val instance of xs:gDay) then 'xs:gDay' else if ($val instance of xs:gMonthDay) then 'xs:gMonthDay' else 'unknown') } ;\n" + " (:~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine :)\n" + " declare function functx:node-kind ( $nodes as node()* ) as xs:string* { for $node in $nodes return if ($node instance of element()) then 'element' else if ($node instance of attribute()) then 'attribute' else if ($node instance of text()) then 'text' else if ($node instance of document-node()) then 'document-node' else if ($node instance of comment()) then 'comment' else if ($node instance of processing-instruction()) then 'processing-instruction' else 'unknown' } ;\n" + " (:~ : The sequence type that represents a sequence of nodes or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-type.html : @param $items the items whose sequence type you want to determine :)\n" + " declare function functx:sequence-type ( $items as item()* ) as xs:string { concat( if (empty($items)) then 'empty-sequence()' else if (every $val in $items satisfies $val instance of xs:anyAtomicType) then if (count(distinct-values(functx:atomic-type($items))) > 1) then 'xs:anyAtomicType' else functx:atomic-type($items[1]) else if (some $val in $items satisfies $val instance of xs:anyAtomicType) then 'item()' else if (count(distinct-values(functx:node-kind($items))) > 1) then 'node()' else concat(functx:node-kind($items[1]),'()') , if (count($items) > 1) then '+' else '') } ;\n" + " let $in-xml := x x return (functx:sequence-type(('abc','def')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xs:string+") ); } /** * ~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine ~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine ~ : The sequence type that represents a sequence of nodes or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-type.html : @param $items the items whose sequence type you want to determine . */ @org.junit.Test public void functxFunctxSequenceType3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine :)\n" + " declare function functx:atomic-type ( $values as xs:anyAtomicType* ) as xs:string* { for $val in $values return (if ($val instance of xs:untypedAtomic) then 'xs:untypedAtomic' else if ($val instance of xs:anyURI) then 'xs:anyURI' else if ($val instance of xs:ENTITY) then 'xs:ENTITY' else if ($val instance of xs:ID) then 'xs:ID' else if ($val instance of xs:NMTOKEN) then 'xs:NMTOKEN' else if ($val instance of xs:language) then 'xs:language' else if ($val instance of xs:NCName) then 'xs:NCName' else if ($val instance of xs:Name) then 'xs:Name' else if ($val instance of xs:token) then 'xs:token' else if ($val instance of xs:normalizedString) then 'xs:normalizedString' else if ($val instance of xs:string) then 'xs:string' else if ($val instance of xs:QName) then 'xs:QName' else if ($val instance of xs:boolean) then 'xs:boolean' else if ($val instance of xs:base64Binary) then 'xs:base64Binary' else if ($val instance of xs:hexBinary) then 'xs:hexBinary' else if ($val instance of xs:byte) then 'xs:byte' else if ($val instance of xs:short) then 'xs:short' else if ($val instance of xs:int) then 'xs:int' else if ($val instance of xs:long) then 'xs:long' else if ($val instance of xs:unsignedByte) then 'xs:unsignedByte' else if ($val instance of xs:unsignedShort) then 'xs:unsignedShort' else if ($val instance of xs:unsignedInt) then 'xs:unsignedInt' else if ($val instance of xs:unsignedLong) then 'xs:unsignedLong' else if ($val instance of xs:positiveInteger) then 'xs:positiveInteger' else if ($val instance of xs:nonNegativeInteger) then 'xs:nonNegativeInteger' else if ($val instance of xs:negativeInteger) then 'xs:negativeInteger' else if ($val instance of xs:nonPositiveInteger) then 'xs:nonPositiveInteger' else if ($val instance of xs:integer) then 'xs:integer' else if ($val instance of xs:decimal) then 'xs:decimal' else if ($val instance of xs:float) then 'xs:float' else if ($val instance of xs:double) then 'xs:double' else if ($val instance of xs:date) then 'xs:date' else if ($val instance of xs:time) then 'xs:time' else if ($val instance of xs:dateTime) then 'xs:dateTime' else if ($val instance of xs:dayTimeDuration) then 'xs:dayTimeDuration' else if ($val instance of xs:yearMonthDuration) then 'xs:yearMonthDuration' else if ($val instance of xs:duration) then 'xs:duration' else if ($val instance of xs:gMonth) then 'xs:gMonth' else if ($val instance of xs:gYear) then 'xs:gYear' else if ($val instance of xs:gYearMonth) then 'xs:gYearMonth' else if ($val instance of xs:gDay) then 'xs:gDay' else if ($val instance of xs:gMonthDay) then 'xs:gMonthDay' else 'unknown') } ;\n" + " (:~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine :)\n" + " declare function functx:node-kind ( $nodes as node()* ) as xs:string* { for $node in $nodes return if ($node instance of element()) then 'element' else if ($node instance of attribute()) then 'attribute' else if ($node instance of text()) then 'text' else if ($node instance of document-node()) then 'document-node' else if ($node instance of comment()) then 'comment' else if ($node instance of processing-instruction()) then 'processing-instruction' else 'unknown' } ;\n" + " (:~ : The sequence type that represents a sequence of nodes or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-type.html : @param $items the items whose sequence type you want to determine :)\n" + " declare function functx:sequence-type ( $items as item()* ) as xs:string { concat( if (empty($items)) then 'empty-sequence()' else if (every $val in $items satisfies $val instance of xs:anyAtomicType) then if (count(distinct-values(functx:atomic-type($items))) > 1) then 'xs:anyAtomicType' else functx:atomic-type($items[1]) else if (some $val in $items satisfies $val instance of xs:anyAtomicType) then 'item()' else if (count(distinct-values(functx:node-kind($items))) > 1) then 'node()' else concat(functx:node-kind($items[1]),'()') , if (count($items) > 1) then '+' else '') } ;\n" + " let $in-xml := x x return (functx:sequence-type(('abc',2)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xs:anyAtomicType+") ); } /** * ~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine ~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine ~ : The sequence type that represents a sequence of nodes or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-type.html : @param $items the items whose sequence type you want to determine . */ @org.junit.Test public void functxFunctxSequenceType4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine :)\n" + " declare function functx:atomic-type ( $values as xs:anyAtomicType* ) as xs:string* { for $val in $values return (if ($val instance of xs:untypedAtomic) then 'xs:untypedAtomic' else if ($val instance of xs:anyURI) then 'xs:anyURI' else if ($val instance of xs:ENTITY) then 'xs:ENTITY' else if ($val instance of xs:ID) then 'xs:ID' else if ($val instance of xs:NMTOKEN) then 'xs:NMTOKEN' else if ($val instance of xs:language) then 'xs:language' else if ($val instance of xs:NCName) then 'xs:NCName' else if ($val instance of xs:Name) then 'xs:Name' else if ($val instance of xs:token) then 'xs:token' else if ($val instance of xs:normalizedString) then 'xs:normalizedString' else if ($val instance of xs:string) then 'xs:string' else if ($val instance of xs:QName) then 'xs:QName' else if ($val instance of xs:boolean) then 'xs:boolean' else if ($val instance of xs:base64Binary) then 'xs:base64Binary' else if ($val instance of xs:hexBinary) then 'xs:hexBinary' else if ($val instance of xs:byte) then 'xs:byte' else if ($val instance of xs:short) then 'xs:short' else if ($val instance of xs:int) then 'xs:int' else if ($val instance of xs:long) then 'xs:long' else if ($val instance of xs:unsignedByte) then 'xs:unsignedByte' else if ($val instance of xs:unsignedShort) then 'xs:unsignedShort' else if ($val instance of xs:unsignedInt) then 'xs:unsignedInt' else if ($val instance of xs:unsignedLong) then 'xs:unsignedLong' else if ($val instance of xs:positiveInteger) then 'xs:positiveInteger' else if ($val instance of xs:nonNegativeInteger) then 'xs:nonNegativeInteger' else if ($val instance of xs:negativeInteger) then 'xs:negativeInteger' else if ($val instance of xs:nonPositiveInteger) then 'xs:nonPositiveInteger' else if ($val instance of xs:integer) then 'xs:integer' else if ($val instance of xs:decimal) then 'xs:decimal' else if ($val instance of xs:float) then 'xs:float' else if ($val instance of xs:double) then 'xs:double' else if ($val instance of xs:date) then 'xs:date' else if ($val instance of xs:time) then 'xs:time' else if ($val instance of xs:dateTime) then 'xs:dateTime' else if ($val instance of xs:dayTimeDuration) then 'xs:dayTimeDuration' else if ($val instance of xs:yearMonthDuration) then 'xs:yearMonthDuration' else if ($val instance of xs:duration) then 'xs:duration' else if ($val instance of xs:gMonth) then 'xs:gMonth' else if ($val instance of xs:gYear) then 'xs:gYear' else if ($val instance of xs:gYearMonth) then 'xs:gYearMonth' else if ($val instance of xs:gDay) then 'xs:gDay' else if ($val instance of xs:gMonthDay) then 'xs:gMonthDay' else 'unknown') } ;\n" + " (:~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine :)\n" + " declare function functx:node-kind ( $nodes as node()* ) as xs:string* { for $node in $nodes return if ($node instance of element()) then 'element' else if ($node instance of attribute()) then 'attribute' else if ($node instance of text()) then 'text' else if ($node instance of document-node()) then 'document-node' else if ($node instance of comment()) then 'comment' else if ($node instance of processing-instruction()) then 'processing-instruction' else 'unknown' } ;\n" + " (:~ : The sequence type that represents a sequence of nodes or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-type.html : @param $items the items whose sequence type you want to determine :)\n" + " declare function functx:sequence-type ( $items as item()* ) as xs:string { concat( if (empty($items)) then 'empty-sequence()' else if (every $val in $items satisfies $val instance of xs:anyAtomicType) then if (count(distinct-values(functx:atomic-type($items))) > 1) then 'xs:anyAtomicType' else functx:atomic-type($items[1]) else if (some $val in $items satisfies $val instance of xs:anyAtomicType) then 'item()' else if (count(distinct-values(functx:node-kind($items))) > 1) then 'node()' else concat(functx:node-kind($items[1]),'()') , if (count($items) > 1) then '+' else '') } ;\n" + " let $in-xml := x x return (functx:sequence-type( () ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "empty-sequence()") ); } /** * ~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine ~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine ~ : The sequence type that represents a sequence of nodes or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-type.html : @param $items the items whose sequence type you want to determine . */ @org.junit.Test public void functxFunctxSequenceType5() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine :)\n" + " declare function functx:atomic-type ( $values as xs:anyAtomicType* ) as xs:string* { for $val in $values return (if ($val instance of xs:untypedAtomic) then 'xs:untypedAtomic' else if ($val instance of xs:anyURI) then 'xs:anyURI' else if ($val instance of xs:ENTITY) then 'xs:ENTITY' else if ($val instance of xs:ID) then 'xs:ID' else if ($val instance of xs:NMTOKEN) then 'xs:NMTOKEN' else if ($val instance of xs:language) then 'xs:language' else if ($val instance of xs:NCName) then 'xs:NCName' else if ($val instance of xs:Name) then 'xs:Name' else if ($val instance of xs:token) then 'xs:token' else if ($val instance of xs:normalizedString) then 'xs:normalizedString' else if ($val instance of xs:string) then 'xs:string' else if ($val instance of xs:QName) then 'xs:QName' else if ($val instance of xs:boolean) then 'xs:boolean' else if ($val instance of xs:base64Binary) then 'xs:base64Binary' else if ($val instance of xs:hexBinary) then 'xs:hexBinary' else if ($val instance of xs:byte) then 'xs:byte' else if ($val instance of xs:short) then 'xs:short' else if ($val instance of xs:int) then 'xs:int' else if ($val instance of xs:long) then 'xs:long' else if ($val instance of xs:unsignedByte) then 'xs:unsignedByte' else if ($val instance of xs:unsignedShort) then 'xs:unsignedShort' else if ($val instance of xs:unsignedInt) then 'xs:unsignedInt' else if ($val instance of xs:unsignedLong) then 'xs:unsignedLong' else if ($val instance of xs:positiveInteger) then 'xs:positiveInteger' else if ($val instance of xs:nonNegativeInteger) then 'xs:nonNegativeInteger' else if ($val instance of xs:negativeInteger) then 'xs:negativeInteger' else if ($val instance of xs:nonPositiveInteger) then 'xs:nonPositiveInteger' else if ($val instance of xs:integer) then 'xs:integer' else if ($val instance of xs:decimal) then 'xs:decimal' else if ($val instance of xs:float) then 'xs:float' else if ($val instance of xs:double) then 'xs:double' else if ($val instance of xs:date) then 'xs:date' else if ($val instance of xs:time) then 'xs:time' else if ($val instance of xs:dateTime) then 'xs:dateTime' else if ($val instance of xs:dayTimeDuration) then 'xs:dayTimeDuration' else if ($val instance of xs:yearMonthDuration) then 'xs:yearMonthDuration' else if ($val instance of xs:duration) then 'xs:duration' else if ($val instance of xs:gMonth) then 'xs:gMonth' else if ($val instance of xs:gYear) then 'xs:gYear' else if ($val instance of xs:gYearMonth) then 'xs:gYearMonth' else if ($val instance of xs:gDay) then 'xs:gDay' else if ($val instance of xs:gMonthDay) then 'xs:gMonthDay' else 'unknown') } ;\n" + " (:~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine :)\n" + " declare function functx:node-kind ( $nodes as node()* ) as xs:string* { for $node in $nodes return if ($node instance of element()) then 'element' else if ($node instance of attribute()) then 'attribute' else if ($node instance of text()) then 'text' else if ($node instance of document-node()) then 'document-node' else if ($node instance of comment()) then 'comment' else if ($node instance of processing-instruction()) then 'processing-instruction' else 'unknown' } ;\n" + " (:~ : The sequence type that represents a sequence of nodes or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-type.html : @param $items the items whose sequence type you want to determine :)\n" + " declare function functx:sequence-type ( $items as item()* ) as xs:string { concat( if (empty($items)) then 'empty-sequence()' else if (every $val in $items satisfies $val instance of xs:anyAtomicType) then if (count(distinct-values(functx:atomic-type($items))) > 1) then 'xs:anyAtomicType' else functx:atomic-type($items[1]) else if (some $val in $items satisfies $val instance of xs:anyAtomicType) then 'item()' else if (count(distinct-values(functx:node-kind($items))) > 1) then 'node()' else concat(functx:node-kind($items[1]),'()') , if (count($items) > 1) then '+' else '') } ;\n" + " let $in-xml := x x return (functx:sequence-type($in-xml/*[1]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "element()") ); } /** * ~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine ~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine ~ : The sequence type that represents a sequence of nodes or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-type.html : @param $items the items whose sequence type you want to determine . */ @org.junit.Test public void functxFunctxSequenceType6() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine :)\n" + " declare function functx:atomic-type ( $values as xs:anyAtomicType* ) as xs:string* { for $val in $values return (if ($val instance of xs:untypedAtomic) then 'xs:untypedAtomic' else if ($val instance of xs:anyURI) then 'xs:anyURI' else if ($val instance of xs:ENTITY) then 'xs:ENTITY' else if ($val instance of xs:ID) then 'xs:ID' else if ($val instance of xs:NMTOKEN) then 'xs:NMTOKEN' else if ($val instance of xs:language) then 'xs:language' else if ($val instance of xs:NCName) then 'xs:NCName' else if ($val instance of xs:Name) then 'xs:Name' else if ($val instance of xs:token) then 'xs:token' else if ($val instance of xs:normalizedString) then 'xs:normalizedString' else if ($val instance of xs:string) then 'xs:string' else if ($val instance of xs:QName) then 'xs:QName' else if ($val instance of xs:boolean) then 'xs:boolean' else if ($val instance of xs:base64Binary) then 'xs:base64Binary' else if ($val instance of xs:hexBinary) then 'xs:hexBinary' else if ($val instance of xs:byte) then 'xs:byte' else if ($val instance of xs:short) then 'xs:short' else if ($val instance of xs:int) then 'xs:int' else if ($val instance of xs:long) then 'xs:long' else if ($val instance of xs:unsignedByte) then 'xs:unsignedByte' else if ($val instance of xs:unsignedShort) then 'xs:unsignedShort' else if ($val instance of xs:unsignedInt) then 'xs:unsignedInt' else if ($val instance of xs:unsignedLong) then 'xs:unsignedLong' else if ($val instance of xs:positiveInteger) then 'xs:positiveInteger' else if ($val instance of xs:nonNegativeInteger) then 'xs:nonNegativeInteger' else if ($val instance of xs:negativeInteger) then 'xs:negativeInteger' else if ($val instance of xs:nonPositiveInteger) then 'xs:nonPositiveInteger' else if ($val instance of xs:integer) then 'xs:integer' else if ($val instance of xs:decimal) then 'xs:decimal' else if ($val instance of xs:float) then 'xs:float' else if ($val instance of xs:double) then 'xs:double' else if ($val instance of xs:date) then 'xs:date' else if ($val instance of xs:time) then 'xs:time' else if ($val instance of xs:dateTime) then 'xs:dateTime' else if ($val instance of xs:dayTimeDuration) then 'xs:dayTimeDuration' else if ($val instance of xs:yearMonthDuration) then 'xs:yearMonthDuration' else if ($val instance of xs:duration) then 'xs:duration' else if ($val instance of xs:gMonth) then 'xs:gMonth' else if ($val instance of xs:gYear) then 'xs:gYear' else if ($val instance of xs:gYearMonth) then 'xs:gYearMonth' else if ($val instance of xs:gDay) then 'xs:gDay' else if ($val instance of xs:gMonthDay) then 'xs:gMonthDay' else 'unknown') } ;\n" + " (:~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine :)\n" + " declare function functx:node-kind ( $nodes as node()* ) as xs:string* { for $node in $nodes return if ($node instance of element()) then 'element' else if ($node instance of attribute()) then 'attribute' else if ($node instance of text()) then 'text' else if ($node instance of document-node()) then 'document-node' else if ($node instance of comment()) then 'comment' else if ($node instance of processing-instruction()) then 'processing-instruction' else 'unknown' } ;\n" + " (:~ : The sequence type that represents a sequence of nodes or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-type.html : @param $items the items whose sequence type you want to determine :)\n" + " declare function functx:sequence-type ( $items as item()* ) as xs:string { concat( if (empty($items)) then 'empty-sequence()' else if (every $val in $items satisfies $val instance of xs:anyAtomicType) then if (count(distinct-values(functx:atomic-type($items))) > 1) then 'xs:anyAtomicType' else functx:atomic-type($items[1]) else if (some $val in $items satisfies $val instance of xs:anyAtomicType) then 'item()' else if (count(distinct-values(functx:node-kind($items))) > 1) then 'node()' else concat(functx:node-kind($items[1]),'()') , if (count($items) > 1) then '+' else '') } ;\n" + " let $in-xml := x x return (functx:sequence-type($in-xml/*))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "element()+") ); } /** * ~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine ~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine ~ : The sequence type that represents a sequence of nodes or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-type.html : @param $items the items whose sequence type you want to determine . */ @org.junit.Test public void functxFunctxSequenceType7() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine :)\n" + " declare function functx:atomic-type ( $values as xs:anyAtomicType* ) as xs:string* { for $val in $values return (if ($val instance of xs:untypedAtomic) then 'xs:untypedAtomic' else if ($val instance of xs:anyURI) then 'xs:anyURI' else if ($val instance of xs:ENTITY) then 'xs:ENTITY' else if ($val instance of xs:ID) then 'xs:ID' else if ($val instance of xs:NMTOKEN) then 'xs:NMTOKEN' else if ($val instance of xs:language) then 'xs:language' else if ($val instance of xs:NCName) then 'xs:NCName' else if ($val instance of xs:Name) then 'xs:Name' else if ($val instance of xs:token) then 'xs:token' else if ($val instance of xs:normalizedString) then 'xs:normalizedString' else if ($val instance of xs:string) then 'xs:string' else if ($val instance of xs:QName) then 'xs:QName' else if ($val instance of xs:boolean) then 'xs:boolean' else if ($val instance of xs:base64Binary) then 'xs:base64Binary' else if ($val instance of xs:hexBinary) then 'xs:hexBinary' else if ($val instance of xs:byte) then 'xs:byte' else if ($val instance of xs:short) then 'xs:short' else if ($val instance of xs:int) then 'xs:int' else if ($val instance of xs:long) then 'xs:long' else if ($val instance of xs:unsignedByte) then 'xs:unsignedByte' else if ($val instance of xs:unsignedShort) then 'xs:unsignedShort' else if ($val instance of xs:unsignedInt) then 'xs:unsignedInt' else if ($val instance of xs:unsignedLong) then 'xs:unsignedLong' else if ($val instance of xs:positiveInteger) then 'xs:positiveInteger' else if ($val instance of xs:nonNegativeInteger) then 'xs:nonNegativeInteger' else if ($val instance of xs:negativeInteger) then 'xs:negativeInteger' else if ($val instance of xs:nonPositiveInteger) then 'xs:nonPositiveInteger' else if ($val instance of xs:integer) then 'xs:integer' else if ($val instance of xs:decimal) then 'xs:decimal' else if ($val instance of xs:float) then 'xs:float' else if ($val instance of xs:double) then 'xs:double' else if ($val instance of xs:date) then 'xs:date' else if ($val instance of xs:time) then 'xs:time' else if ($val instance of xs:dateTime) then 'xs:dateTime' else if ($val instance of xs:dayTimeDuration) then 'xs:dayTimeDuration' else if ($val instance of xs:yearMonthDuration) then 'xs:yearMonthDuration' else if ($val instance of xs:duration) then 'xs:duration' else if ($val instance of xs:gMonth) then 'xs:gMonth' else if ($val instance of xs:gYear) then 'xs:gYear' else if ($val instance of xs:gYearMonth) then 'xs:gYearMonth' else if ($val instance of xs:gDay) then 'xs:gDay' else if ($val instance of xs:gMonthDay) then 'xs:gMonthDay' else 'unknown') } ;\n" + " (:~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine :)\n" + " declare function functx:node-kind ( $nodes as node()* ) as xs:string* { for $node in $nodes return if ($node instance of element()) then 'element' else if ($node instance of attribute()) then 'attribute' else if ($node instance of text()) then 'text' else if ($node instance of document-node()) then 'document-node' else if ($node instance of comment()) then 'comment' else if ($node instance of processing-instruction()) then 'processing-instruction' else 'unknown' } ;\n" + " (:~ : The sequence type that represents a sequence of nodes or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-type.html : @param $items the items whose sequence type you want to determine :)\n" + " declare function functx:sequence-type ( $items as item()* ) as xs:string { concat( if (empty($items)) then 'empty-sequence()' else if (every $val in $items satisfies $val instance of xs:anyAtomicType) then if (count(distinct-values(functx:atomic-type($items))) > 1) then 'xs:anyAtomicType' else functx:atomic-type($items[1]) else if (some $val in $items satisfies $val instance of xs:anyAtomicType) then 'item()' else if (count(distinct-values(functx:node-kind($items))) > 1) then 'node()' else concat(functx:node-kind($items[1]),'()') , if (count($items) > 1) then '+' else '') } ;\n" + " let $in-xml := x x return (functx:sequence-type($in-xml/*/@*))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "attribute()+") ); } /** * ~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine ~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine ~ : The sequence type that represents a sequence of nodes or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-type.html : @param $items the items whose sequence type you want to determine . */ @org.junit.Test public void functxFunctxSequenceType8() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine :)\n" + " declare function functx:atomic-type ( $values as xs:anyAtomicType* ) as xs:string* { for $val in $values return (if ($val instance of xs:untypedAtomic) then 'xs:untypedAtomic' else if ($val instance of xs:anyURI) then 'xs:anyURI' else if ($val instance of xs:ENTITY) then 'xs:ENTITY' else if ($val instance of xs:ID) then 'xs:ID' else if ($val instance of xs:NMTOKEN) then 'xs:NMTOKEN' else if ($val instance of xs:language) then 'xs:language' else if ($val instance of xs:NCName) then 'xs:NCName' else if ($val instance of xs:Name) then 'xs:Name' else if ($val instance of xs:token) then 'xs:token' else if ($val instance of xs:normalizedString) then 'xs:normalizedString' else if ($val instance of xs:string) then 'xs:string' else if ($val instance of xs:QName) then 'xs:QName' else if ($val instance of xs:boolean) then 'xs:boolean' else if ($val instance of xs:base64Binary) then 'xs:base64Binary' else if ($val instance of xs:hexBinary) then 'xs:hexBinary' else if ($val instance of xs:byte) then 'xs:byte' else if ($val instance of xs:short) then 'xs:short' else if ($val instance of xs:int) then 'xs:int' else if ($val instance of xs:long) then 'xs:long' else if ($val instance of xs:unsignedByte) then 'xs:unsignedByte' else if ($val instance of xs:unsignedShort) then 'xs:unsignedShort' else if ($val instance of xs:unsignedInt) then 'xs:unsignedInt' else if ($val instance of xs:unsignedLong) then 'xs:unsignedLong' else if ($val instance of xs:positiveInteger) then 'xs:positiveInteger' else if ($val instance of xs:nonNegativeInteger) then 'xs:nonNegativeInteger' else if ($val instance of xs:negativeInteger) then 'xs:negativeInteger' else if ($val instance of xs:nonPositiveInteger) then 'xs:nonPositiveInteger' else if ($val instance of xs:integer) then 'xs:integer' else if ($val instance of xs:decimal) then 'xs:decimal' else if ($val instance of xs:float) then 'xs:float' else if ($val instance of xs:double) then 'xs:double' else if ($val instance of xs:date) then 'xs:date' else if ($val instance of xs:time) then 'xs:time' else if ($val instance of xs:dateTime) then 'xs:dateTime' else if ($val instance of xs:dayTimeDuration) then 'xs:dayTimeDuration' else if ($val instance of xs:yearMonthDuration) then 'xs:yearMonthDuration' else if ($val instance of xs:duration) then 'xs:duration' else if ($val instance of xs:gMonth) then 'xs:gMonth' else if ($val instance of xs:gYear) then 'xs:gYear' else if ($val instance of xs:gYearMonth) then 'xs:gYearMonth' else if ($val instance of xs:gDay) then 'xs:gDay' else if ($val instance of xs:gMonthDay) then 'xs:gMonthDay' else 'unknown') } ;\n" + " (:~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine :)\n" + " declare function functx:node-kind ( $nodes as node()* ) as xs:string* { for $node in $nodes return if ($node instance of element()) then 'element' else if ($node instance of attribute()) then 'attribute' else if ($node instance of text()) then 'text' else if ($node instance of document-node()) then 'document-node' else if ($node instance of comment()) then 'comment' else if ($node instance of processing-instruction()) then 'processing-instruction' else 'unknown' } ;\n" + " (:~ : The sequence type that represents a sequence of nodes or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-type.html : @param $items the items whose sequence type you want to determine :)\n" + " declare function functx:sequence-type ( $items as item()* ) as xs:string { concat( if (empty($items)) then 'empty-sequence()' else if (every $val in $items satisfies $val instance of xs:anyAtomicType) then if (count(distinct-values(functx:atomic-type($items))) > 1) then 'xs:anyAtomicType' else functx:atomic-type($items[1]) else if (some $val in $items satisfies $val instance of xs:anyAtomicType) then 'item()' else if (count(distinct-values(functx:node-kind($items))) > 1) then 'node()' else concat(functx:node-kind($items[1]),'()') , if (count($items) > 1) then '+' else '') } ;\n" + " let $in-xml := x x return (functx:sequence-type($in-xml/*/text()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "text()+") ); } /** * ~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine ~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine ~ : The sequence type that represents a sequence of nodes or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-type.html : @param $items the items whose sequence type you want to determine . */ @org.junit.Test public void functxFunctxSequenceType9() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine :)\n" + " declare function functx:atomic-type ( $values as xs:anyAtomicType* ) as xs:string* { for $val in $values return (if ($val instance of xs:untypedAtomic) then 'xs:untypedAtomic' else if ($val instance of xs:anyURI) then 'xs:anyURI' else if ($val instance of xs:ENTITY) then 'xs:ENTITY' else if ($val instance of xs:ID) then 'xs:ID' else if ($val instance of xs:NMTOKEN) then 'xs:NMTOKEN' else if ($val instance of xs:language) then 'xs:language' else if ($val instance of xs:NCName) then 'xs:NCName' else if ($val instance of xs:Name) then 'xs:Name' else if ($val instance of xs:token) then 'xs:token' else if ($val instance of xs:normalizedString) then 'xs:normalizedString' else if ($val instance of xs:string) then 'xs:string' else if ($val instance of xs:QName) then 'xs:QName' else if ($val instance of xs:boolean) then 'xs:boolean' else if ($val instance of xs:base64Binary) then 'xs:base64Binary' else if ($val instance of xs:hexBinary) then 'xs:hexBinary' else if ($val instance of xs:byte) then 'xs:byte' else if ($val instance of xs:short) then 'xs:short' else if ($val instance of xs:int) then 'xs:int' else if ($val instance of xs:long) then 'xs:long' else if ($val instance of xs:unsignedByte) then 'xs:unsignedByte' else if ($val instance of xs:unsignedShort) then 'xs:unsignedShort' else if ($val instance of xs:unsignedInt) then 'xs:unsignedInt' else if ($val instance of xs:unsignedLong) then 'xs:unsignedLong' else if ($val instance of xs:positiveInteger) then 'xs:positiveInteger' else if ($val instance of xs:nonNegativeInteger) then 'xs:nonNegativeInteger' else if ($val instance of xs:negativeInteger) then 'xs:negativeInteger' else if ($val instance of xs:nonPositiveInteger) then 'xs:nonPositiveInteger' else if ($val instance of xs:integer) then 'xs:integer' else if ($val instance of xs:decimal) then 'xs:decimal' else if ($val instance of xs:float) then 'xs:float' else if ($val instance of xs:double) then 'xs:double' else if ($val instance of xs:date) then 'xs:date' else if ($val instance of xs:time) then 'xs:time' else if ($val instance of xs:dateTime) then 'xs:dateTime' else if ($val instance of xs:dayTimeDuration) then 'xs:dayTimeDuration' else if ($val instance of xs:yearMonthDuration) then 'xs:yearMonthDuration' else if ($val instance of xs:duration) then 'xs:duration' else if ($val instance of xs:gMonth) then 'xs:gMonth' else if ($val instance of xs:gYear) then 'xs:gYear' else if ($val instance of xs:gYearMonth) then 'xs:gYearMonth' else if ($val instance of xs:gDay) then 'xs:gDay' else if ($val instance of xs:gMonthDay) then 'xs:gMonthDay' else 'unknown') } ;\n" + " (:~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine :)\n" + " declare function functx:node-kind ( $nodes as node()* ) as xs:string* { for $node in $nodes return if ($node instance of element()) then 'element' else if ($node instance of attribute()) then 'attribute' else if ($node instance of text()) then 'text' else if ($node instance of document-node()) then 'document-node' else if ($node instance of comment()) then 'comment' else if ($node instance of processing-instruction()) then 'processing-instruction' else 'unknown' } ;\n" + " (:~ : The sequence type that represents a sequence of nodes or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-type.html : @param $items the items whose sequence type you want to determine :)\n" + " declare function functx:sequence-type ( $items as item()* ) as xs:string { concat( if (empty($items)) then 'empty-sequence()' else if (every $val in $items satisfies $val instance of xs:anyAtomicType) then if (count(distinct-values(functx:atomic-type($items))) > 1) then 'xs:anyAtomicType' else functx:atomic-type($items[1]) else if (some $val in $items satisfies $val instance of xs:anyAtomicType) then 'item()' else if (count(distinct-values(functx:node-kind($items))) > 1) then 'node()' else concat(functx:node-kind($items[1]),'()') , if (count($items) > 1) then '+' else '') } ;\n" + " let $in-xml := x x return (functx:sequence-type($in-xml/comment()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "comment()") ); } /** * ~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine ~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine ~ : The sequence type that represents a sequence of nodes or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-type.html : @param $items the items whose sequence type you want to determine . */ @org.junit.Test public void functxFunctxSequenceTypeAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The built-in type of an atomic value : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_atomic-type.html : @param $values the value(s) whose type you want to determine :)\n" + " declare function functx:atomic-type ( $values as xs:anyAtomicType* ) as xs:string* { for $val in $values return (if ($val instance of xs:untypedAtomic) then 'xs:untypedAtomic' else if ($val instance of xs:anyURI) then 'xs:anyURI' else if ($val instance of xs:ENTITY) then 'xs:ENTITY' else if ($val instance of xs:ID) then 'xs:ID' else if ($val instance of xs:NMTOKEN) then 'xs:NMTOKEN' else if ($val instance of xs:language) then 'xs:language' else if ($val instance of xs:NCName) then 'xs:NCName' else if ($val instance of xs:Name) then 'xs:Name' else if ($val instance of xs:token) then 'xs:token' else if ($val instance of xs:normalizedString) then 'xs:normalizedString' else if ($val instance of xs:string) then 'xs:string' else if ($val instance of xs:QName) then 'xs:QName' else if ($val instance of xs:boolean) then 'xs:boolean' else if ($val instance of xs:base64Binary) then 'xs:base64Binary' else if ($val instance of xs:hexBinary) then 'xs:hexBinary' else if ($val instance of xs:byte) then 'xs:byte' else if ($val instance of xs:short) then 'xs:short' else if ($val instance of xs:int) then 'xs:int' else if ($val instance of xs:long) then 'xs:long' else if ($val instance of xs:unsignedByte) then 'xs:unsignedByte' else if ($val instance of xs:unsignedShort) then 'xs:unsignedShort' else if ($val instance of xs:unsignedInt) then 'xs:unsignedInt' else if ($val instance of xs:unsignedLong) then 'xs:unsignedLong' else if ($val instance of xs:positiveInteger) then 'xs:positiveInteger' else if ($val instance of xs:nonNegativeInteger) then 'xs:nonNegativeInteger' else if ($val instance of xs:negativeInteger) then 'xs:negativeInteger' else if ($val instance of xs:nonPositiveInteger) then 'xs:nonPositiveInteger' else if ($val instance of xs:integer) then 'xs:integer' else if ($val instance of xs:decimal) then 'xs:decimal' else if ($val instance of xs:float) then 'xs:float' else if ($val instance of xs:double) then 'xs:double' else if ($val instance of xs:date) then 'xs:date' else if ($val instance of xs:time) then 'xs:time' else if ($val instance of xs:dateTime) then 'xs:dateTime' else if ($val instance of xs:dayTimeDuration) then 'xs:dayTimeDuration' else if ($val instance of xs:yearMonthDuration) then 'xs:yearMonthDuration' else if ($val instance of xs:duration) then 'xs:duration' else if ($val instance of xs:gMonth) then 'xs:gMonth' else if ($val instance of xs:gYear) then 'xs:gYear' else if ($val instance of xs:gYearMonth) then 'xs:gYearMonth' else if ($val instance of xs:gDay) then 'xs:gDay' else if ($val instance of xs:gMonthDay) then 'xs:gMonthDay' else 'unknown') } ;\n" + " (:~ : The XML node kind (element, attribute, text, etc.) : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_node-kind.html : @param $nodes the node(s) whose kind you want to determine :)\n" + " declare function functx:node-kind ( $nodes as node()* ) as xs:string* { for $node in $nodes return if ($node instance of element()) then 'element' else if ($node instance of attribute()) then 'attribute' else if ($node instance of text()) then 'text' else if ($node instance of document-node()) then 'document-node' else if ($node instance of comment()) then 'comment' else if ($node instance of processing-instruction()) then 'processing-instruction' else 'unknown' } ;\n" + " (:~ : The sequence type that represents a sequence of nodes or values : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sequence-type.html : @param $items the items whose sequence type you want to determine :)\n" + " declare function functx:sequence-type ( $items as item()* ) as xs:string { concat( if (empty($items)) then 'empty-sequence()' else if (every $val in $items satisfies $val instance of xs:anyAtomicType) then if (count(distinct-values(functx:atomic-type($items))) > 1) then 'xs:anyAtomicType' else functx:atomic-type($items[1]) else if (some $val in $items satisfies $val instance of xs:anyAtomicType) then 'item()' else if (count(distinct-values(functx:node-kind($items))) > 1) then 'node()' else concat(functx:node-kind($items[1]),'()') , if (count($items) > 1) then '+' else '') } ;\n" + " let $in-xml := x x return (functx:sequence-type(2), functx:sequence-type(('abc','def')), functx:sequence-type(('abc',2)), functx:sequence-type( () ), functx:sequence-type($in-xml/*[1]), functx:sequence-type($in-xml/*), functx:sequence-type($in-xml/*/@*), functx:sequence-type($in-xml/*/text()), functx:sequence-type($in-xml/comment()), functx:sequence-type($in-xml/node()), functx:sequence-type(($in-xml/*,'2')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xs:integer xs:string+ xs:anyAtomicType+ empty-sequence() element() element()+ attribute()+ text()+ comment() node()+ item()+") ); } /** * ~ : The siblings of an XML node : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_siblings.html : @param $node the node . */ @org.junit.Test public void functxFunctxSiblings1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The siblings of an XML node : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_siblings.html : @param $node the node :)\n" + " declare function functx:siblings ( $node as node()? ) as node()* { $node/../node() except $node } ;\n" + " let $in-xml := Kate Jane Jones John Doe return (functx:siblings( $in-xml/author[1]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("JohnDoe", false) ); } /** * ~ : The siblings of an XML node : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_siblings.html : @param $node the node . */ @org.junit.Test public void functxFunctxSiblings2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The siblings of an XML node : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_siblings.html : @param $node the node :)\n" + " declare function functx:siblings ( $node as node()? ) as node()* { $node/../node() except $node } ;\n" + " let $in-xml := Kate Jane Jones John Doe return (functx:siblings( $in-xml/author[1]/fName[2]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("KateJones", false) ); } /** * ~ : The siblings of an XML node : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_siblings.html : @param $node the node . */ @org.junit.Test public void functxFunctxSiblingsAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The siblings of an XML node : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_siblings.html : @param $node the node :)\n" + " declare function functx:siblings ( $node as node()? ) as node()* { $node/../node() except $node } ;\n" + " let $in-xml := Kate Jane Jones John Doe return (functx:siblings( $in-xml/author[1]), functx:siblings( $in-xml/author[1]/fName[2]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("JohnDoeKateJones", false) ); } /** * ~ : The siblings of an XML element that have the same name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_siblings-same-name.html : @param $element the node . */ @org.junit.Test public void functxFunctxSiblingsSameName1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The siblings of an XML element that have the same name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_siblings-same-name.html : @param $element the node :)\n" + " declare function functx:siblings-same-name ( $element as element()? ) as element()* { $element/../*[node-name(.) = node-name($element)] except $element } ;\n" + " let $in-xml := Kate Jane Jones John Doe return (functx:siblings-same-name( $in-xml/author[1]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("JohnDoe", false) ); } /** * ~ : The siblings of an XML element that have the same name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_siblings-same-name.html : @param $element the node . */ @org.junit.Test public void functxFunctxSiblingsSameName2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The siblings of an XML element that have the same name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_siblings-same-name.html : @param $element the node :)\n" + " declare function functx:siblings-same-name ( $element as element()? ) as element()* { $element/../*[node-name(.) = node-name($element)] except $element } ;\n" + " let $in-xml := Kate Jane Jones John Doe return (functx:siblings-same-name( $in-xml/author[1]/fName[2]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Kate", false) ); } /** * ~ : The siblings of an XML element that have the same name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_siblings-same-name.html : @param $element the node . */ @org.junit.Test public void functxFunctxSiblingsSameNameAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The siblings of an XML element that have the same name : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_siblings-same-name.html : @param $element the node :)\n" + " declare function functx:siblings-same-name ( $element as element()? ) as element()* { $element/../*[node-name(.) = node-name($element)] except $element } ;\n" + " let $in-xml := Kate Jane Jones John Doe return (functx:siblings-same-name( $in-xml/author[1]), functx:siblings-same-name( $in-xml/author[1]/fName[2]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("JohnDoeKate", false) ); } /** * ~ : Sorts a sequence of values or nodes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sort.html : @param $seq the sequence to sort . */ @org.junit.Test public void functxFunctxSort1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Sorts a sequence of values or nodes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sort.html : @param $seq the sequence to sort :)\n" + " declare function functx:sort ( $seq as item()* ) as item()* { for $item in $seq order by $item return $item } ;\n" + " let $in-xml := c a b return (functx:sort(('c','a','b')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b c") ); } /** * ~ : Sorts a sequence of values or nodes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sort.html : @param $seq the sequence to sort . */ @org.junit.Test public void functxFunctxSort2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Sorts a sequence of values or nodes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sort.html : @param $seq the sequence to sort :)\n" + " declare function functx:sort ( $seq as item()* ) as item()* { for $item in $seq order by $item return $item } ;\n" + " let $in-xml := c a b return (functx:sort($in-xml/*))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("abc", false) ); } /** * ~ : Sorts a sequence of values or nodes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sort.html : @param $seq the sequence to sort . */ @org.junit.Test public void functxFunctxSortAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Sorts a sequence of values or nodes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sort.html : @param $seq the sequence to sort :)\n" + " declare function functx:sort ( $seq as item()* ) as item()* { for $item in $seq order by $item return $item } ;\n" + " let $in-xml := c a b return (functx:sort(('c','a','b')), functx:sort($in-xml/*))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("a b cabc", false) ); } /** * ~ : Sorts a sequence of numeric values or nodes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sort-as-numeric.html : @param $seq the sequence to sort . */ @org.junit.Test public void functxFunctxSortAsNumeric1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Sorts a sequence of numeric values or nodes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sort-as-numeric.html : @param $seq the sequence to sort :)\n" + " declare function functx:sort-as-numeric ( $seq as item()* ) as item()* { for $item in $seq order by number($item) return $item } ;\n" + " let $in-xml := 1 35 4 return (functx:sort-as-numeric(('1','100','99')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 99 100") ); } /** * ~ : Sorts a sequence of numeric values or nodes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sort-as-numeric.html : @param $seq the sequence to sort . */ @org.junit.Test public void functxFunctxSortAsNumeric2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Sorts a sequence of numeric values or nodes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sort-as-numeric.html : @param $seq the sequence to sort :)\n" + " declare function functx:sort-as-numeric ( $seq as item()* ) as item()* { for $item in $seq order by number($item) return $item } ;\n" + " let $in-xml := 1 35 4 return (functx:sort-as-numeric($in-xml/*))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1435", false) ); } /** * ~ : Sorts a sequence of numeric values or nodes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sort-as-numeric.html : @param $seq the sequence to sort . */ @org.junit.Test public void functxFunctxSortAsNumericAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Sorts a sequence of numeric values or nodes : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sort-as-numeric.html : @param $seq the sequence to sort :)\n" + " declare function functx:sort-as-numeric ( $seq as item()* ) as item()* { for $item in $seq order by number($item) return $item } ;\n" + " let $in-xml := 1 35 4 return (functx:sort-as-numeric(('1','100','99')), functx:sort-as-numeric($in-xml/*))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1 99 1001435", false) ); } /** * ~ : Sorts a sequence of values or nodes regardless of capitalization : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sort-case-insensitive.html : @param $seq the sequence to sort . */ @org.junit.Test public void functxFunctxSortCaseInsensitive1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Sorts a sequence of values or nodes regardless of capitalization : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sort-case-insensitive.html : @param $seq the sequence to sort :)\n" + " declare function functx:sort-case-insensitive ( $seq as item()* ) as item()* { for $item in $seq order by upper-case(string($item)) return $item } ;\n" + " let $in-xml := a c B return (functx:sort-case-insensitive(('a','c','B')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a B c") ); } /** * ~ : Sorts a sequence of values or nodes regardless of capitalization : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sort-case-insensitive.html : @param $seq the sequence to sort . */ @org.junit.Test public void functxFunctxSortCaseInsensitive2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Sorts a sequence of values or nodes regardless of capitalization : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sort-case-insensitive.html : @param $seq the sequence to sort :)\n" + " declare function functx:sort-case-insensitive ( $seq as item()* ) as item()* { for $item in $seq order by upper-case(string($item)) return $item } ;\n" + " let $in-xml := a c B return (functx:sort-case-insensitive($in-xml/*))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("aBc", false) ); } /** * ~ : Sorts a sequence of values or nodes regardless of capitalization : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sort-case-insensitive.html : @param $seq the sequence to sort . */ @org.junit.Test public void functxFunctxSortCaseInsensitiveAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Sorts a sequence of values or nodes regardless of capitalization : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sort-case-insensitive.html : @param $seq the sequence to sort :)\n" + " declare function functx:sort-case-insensitive ( $seq as item()* ) as item()* { for $item in $seq order by upper-case(string($item)) return $item } ;\n" + " let $in-xml := a c B return (functx:sort-case-insensitive(('a','c','B')), functx:sort-case-insensitive($in-xml/*))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("a B caBc", false) ); } /** * ~ : Sorts a sequence of nodes in document order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sort-document-order.html : @param $seq the sequence to sort . */ @org.junit.Test public void functxFunctxSortDocumentOrder1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Sorts a sequence of nodes in document order : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_sort-document-order.html : @param $seq the sequence to sort :)\n" + " declare function functx:sort-document-order ( $seq as node()* ) as node()* { $seq/. } ;\n" + " let $in-xml := 123 456 789 return (functx:sort-document-order( ($in-xml/c,$in-xml/a)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("123789", false) ); } /** * ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxSubstringAfterIfContains1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " (functx:substring-after-if-contains('abcd','b'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "cd") ); } /** * ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxSubstringAfterIfContains2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " (functx:substring-after-if-contains('abcd','x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcd") ); } /** * ~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxSubstringAfterIfContainsAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Performs substring-after, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-after($arg,$delim) else $arg } ;\n" + " (functx:substring-after-if-contains('abcd','b'), functx:substring-after-if-contains('abcd','x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "cd abcd") ); } /** * ~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape ~ : The substring after the last occurrence of a delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-last.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxSubstringAfterLast1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape :)\n" + " declare function functx:escape-for-regex ( $arg as xs:string? ) as xs:string { replace($arg, '(\\.|\\[|\\]|\\\\|\\||\\-|\\^|\\$|\\?|\\*|\\+|\\{|\\}|\\(|\\))','\\\\$1') } ;\n" + " (:~ : The substring after the last occurrence of a delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-last.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-last ( $arg as xs:string? , $delim as xs:string ) as xs:string { replace ($arg,concat('^.*',functx:escape-for-regex($delim)),'') } ;\n" + " (functx:substring-after-last('abc-def-ghi', '-'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ghi") ); } /** * ~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape ~ : The substring after the last occurrence of a delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-last.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxSubstringAfterLast2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape :)\n" + " declare function functx:escape-for-regex ( $arg as xs:string? ) as xs:string { replace($arg, '(\\.|\\[|\\]|\\\\|\\||\\-|\\^|\\$|\\?|\\*|\\+|\\{|\\}|\\(|\\))','\\\\$1') } ;\n" + " (:~ : The substring after the last occurrence of a delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-last.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-last ( $arg as xs:string? , $delim as xs:string ) as xs:string { replace ($arg,concat('^.*',functx:escape-for-regex($delim)),'') } ;\n" + " (functx:substring-after-last('abcd-abcd', 'ab'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "cd") ); } /** * ~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape ~ : The substring after the last occurrence of a delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-last.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxSubstringAfterLast3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape :)\n" + " declare function functx:escape-for-regex ( $arg as xs:string? ) as xs:string { replace($arg, '(\\.|\\[|\\]|\\\\|\\||\\-|\\^|\\$|\\?|\\*|\\+|\\{|\\}|\\(|\\))','\\\\$1') } ;\n" + " (:~ : The substring after the last occurrence of a delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-last.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-last ( $arg as xs:string? , $delim as xs:string ) as xs:string { replace ($arg,concat('^.*',functx:escape-for-regex($delim)),'') } ;\n" + " (functx:substring-after-last('abcd-abcd', 'x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcd-abcd") ); } /** * ~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape ~ : The substring after the last occurrence of a delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-last.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxSubstringAfterLastAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape :)\n" + " declare function functx:escape-for-regex ( $arg as xs:string? ) as xs:string { replace($arg, '(\\.|\\[|\\]|\\\\|\\||\\-|\\^|\\$|\\?|\\*|\\+|\\{|\\}|\\(|\\))','\\\\$1') } ;\n" + " (:~ : The substring after the last occurrence of a delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-last.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-after-last ( $arg as xs:string? , $delim as xs:string ) as xs:string { replace ($arg,concat('^.*',functx:escape-for-regex($delim)),'') } ;\n" + " (functx:substring-after-last('abc-def-ghi', '-'), functx:substring-after-last('abcd-abcd', 'ab'), functx:substring-after-last('abcd-abcd', 'x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ghi cd abcd-abcd") ); } /** * ~ : The substring after the last text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-last-match.html : @param $arg the string to substring : @param $regex the regular expression . */ @org.junit.Test public void functxFunctxSubstringAfterLastMatch1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The substring after the last text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-last-match.html : @param $arg the string to substring : @param $regex the regular expression :)\n" + " declare function functx:substring-after-last-match ( $arg as xs:string? , $regex as xs:string ) as xs:string { replace($arg,concat('^.*',$regex),'') } ;\n" + " (functx:substring-after-last-match( 'abc-def-ghi', '[ad]'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ef-ghi") ); } /** * ~ : The substring after the last text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-last-match.html : @param $arg the string to substring : @param $regex the regular expression . */ @org.junit.Test public void functxFunctxSubstringAfterLastMatch2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The substring after the last text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-last-match.html : @param $arg the string to substring : @param $regex the regular expression :)\n" + " declare function functx:substring-after-last-match ( $arg as xs:string? , $regex as xs:string ) as xs:string { replace($arg,concat('^.*',$regex),'') } ;\n" + " (functx:substring-after-last-match( 'abcd-abcd', 'bc?'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "d") ); } /** * ~ : The substring after the last text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-last-match.html : @param $arg the string to substring : @param $regex the regular expression . */ @org.junit.Test public void functxFunctxSubstringAfterLastMatch3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The substring after the last text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-last-match.html : @param $arg the string to substring : @param $regex the regular expression :)\n" + " declare function functx:substring-after-last-match ( $arg as xs:string? , $regex as xs:string ) as xs:string { replace($arg,concat('^.*',$regex),'') } ;\n" + " (functx:substring-after-last-match( 'abcd-abcd', 'x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcd-abcd") ); } /** * ~ : The substring after the last text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-last-match.html : @param $arg the string to substring : @param $regex the regular expression . */ @org.junit.Test public void functxFunctxSubstringAfterLastMatchAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The substring after the last text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-last-match.html : @param $arg the string to substring : @param $regex the regular expression :)\n" + " declare function functx:substring-after-last-match ( $arg as xs:string? , $regex as xs:string ) as xs:string { replace($arg,concat('^.*',$regex),'') } ;\n" + " (functx:substring-after-last-match( 'abc-def-ghi', '[ad]'), functx:substring-after-last-match( 'abcd-abcd', 'bc?'), functx:substring-after-last-match( 'abcd-abcd', 'x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ef-ghi d abcd-abcd") ); } /** * ~ : The substring after the first text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-match.html : @param $arg the string to substring : @param $regex the regular expression . */ @org.junit.Test public void functxFunctxSubstringAfterMatch1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The substring after the first text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-match.html : @param $arg the string to substring : @param $regex the regular expression :)\n" + " declare function functx:substring-after-match ( $arg as xs:string? , $regex as xs:string ) as xs:string? { replace($arg,concat('^.*?',$regex),'') } ;\n" + " (functx:substring-after-match( 'abc-def-ghi', '[ce]'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-def-ghi") ); } /** * ~ : The substring after the first text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-match.html : @param $arg the string to substring : @param $regex the regular expression . */ @org.junit.Test public void functxFunctxSubstringAfterMatch2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The substring after the first text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-match.html : @param $arg the string to substring : @param $regex the regular expression :)\n" + " declare function functx:substring-after-match ( $arg as xs:string? , $regex as xs:string ) as xs:string? { replace($arg,concat('^.*?',$regex),'') } ;\n" + " (functx:substring-after-match( 'abcd-abcd', 'ab?'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "cd-abcd") ); } /** * ~ : The substring after the first text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-match.html : @param $arg the string to substring : @param $regex the regular expression . */ @org.junit.Test public void functxFunctxSubstringAfterMatch3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The substring after the first text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-match.html : @param $arg the string to substring : @param $regex the regular expression :)\n" + " declare function functx:substring-after-match ( $arg as xs:string? , $regex as xs:string ) as xs:string? { replace($arg,concat('^.*?',$regex),'') } ;\n" + " (functx:substring-after-match( 'abcd-abcd', 'x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcd-abcd") ); } /** * ~ : The substring after the first text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-match.html : @param $arg the string to substring : @param $regex the regular expression . */ @org.junit.Test public void functxFunctxSubstringAfterMatchAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The substring after the first text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-after-match.html : @param $arg the string to substring : @param $regex the regular expression :)\n" + " declare function functx:substring-after-match ( $arg as xs:string? , $regex as xs:string ) as xs:string? { replace($arg,concat('^.*?',$regex),'') } ;\n" + " (functx:substring-after-match( 'abc-def-ghi', '[ce]'), functx:substring-after-match( 'abcd-abcd', 'ab?'), functx:substring-after-match( 'abcd-abcd', 'x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-def-ghi cd-abcd abcd-abcd") ); } /** * ~ : Performs substring-before, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxSubstringBeforeIfContains1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Performs substring-before, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-before-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-before($arg,$delim) else $arg } ;\n" + " (functx:substring-before-if-contains('abcd','c'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ab") ); } /** * ~ : Performs substring-before, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxSubstringBeforeIfContains2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Performs substring-before, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-before-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-before($arg,$delim) else $arg } ;\n" + " (functx:substring-before-if-contains('abcd','x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcd") ); } /** * ~ : Performs substring-before, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-if-contains.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxSubstringBeforeIfContainsAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Performs substring-before, returning the entire string if it does not contain the delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-if-contains.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-before-if-contains ( $arg as xs:string? , $delim as xs:string ) as xs:string? { if (contains($arg,$delim)) then substring-before($arg,$delim) else $arg } ;\n" + " (functx:substring-before-if-contains('abcd','c'), functx:substring-before-if-contains('abcd','x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ab abcd") ); } /** * ~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape ~ : The substring before the last occurrence of a delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-last.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxSubstringBeforeLast1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape :)\n" + " declare function functx:escape-for-regex ( $arg as xs:string? ) as xs:string { replace($arg, '(\\.|\\[|\\]|\\\\|\\||\\-|\\^|\\$|\\?|\\*|\\+|\\{|\\}|\\(|\\))','\\\\$1') } ;\n" + " (:~ : The substring before the last occurrence of a delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-last.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-before-last ( $arg as xs:string? , $delim as xs:string ) as xs:string { if (matches($arg, functx:escape-for-regex($delim))) then replace($arg, concat('^(.*)', functx:escape-for-regex($delim),'.*'), '$1') else '' } ;\n" + " (functx:substring-before-last( 'abc-def-ghi', '-'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc-def") ); } /** * ~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape ~ : The substring before the last occurrence of a delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-last.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxSubstringBeforeLast2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape :)\n" + " declare function functx:escape-for-regex ( $arg as xs:string? ) as xs:string { replace($arg, '(\\.|\\[|\\]|\\\\|\\||\\-|\\^|\\$|\\?|\\*|\\+|\\{|\\}|\\(|\\))','\\\\$1') } ;\n" + " (:~ : The substring before the last occurrence of a delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-last.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-before-last ( $arg as xs:string? , $delim as xs:string ) as xs:string { if (matches($arg, functx:escape-for-regex($delim))) then replace($arg, concat('^(.*)', functx:escape-for-regex($delim),'.*'), '$1') else '' } ;\n" + " (functx:substring-before-last('abcd-abcd', 'ab'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcd-") ); } /** * ~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape ~ : The substring before the last occurrence of a delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-last.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxSubstringBeforeLast3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape :)\n" + " declare function functx:escape-for-regex ( $arg as xs:string? ) as xs:string { replace($arg, '(\\.|\\[|\\]|\\\\|\\||\\-|\\^|\\$|\\?|\\*|\\+|\\{|\\}|\\(|\\))','\\\\$1') } ;\n" + " (:~ : The substring before the last occurrence of a delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-last.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-before-last ( $arg as xs:string? , $delim as xs:string ) as xs:string { if (matches($arg, functx:escape-for-regex($delim))) then replace($arg, concat('^(.*)', functx:escape-for-regex($delim),'.*'), '$1') else '' } ;\n" + " (functx:substring-before-last('abcd-abcd', 'x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * ~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape ~ : The substring before the last occurrence of a delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-last.html : @param $arg the string to substring : @param $delim the delimiter . */ @org.junit.Test public void functxFunctxSubstringBeforeLastAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Escapes regex special characters : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html : @param $arg the string to escape :)\n" + " declare function functx:escape-for-regex ( $arg as xs:string? ) as xs:string { replace($arg, '(\\.|\\[|\\]|\\\\|\\||\\-|\\^|\\$|\\?|\\*|\\+|\\{|\\}|\\(|\\))','\\\\$1') } ;\n" + " (:~ : The substring before the last occurrence of a delimiter : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-last.html : @param $arg the string to substring : @param $delim the delimiter :)\n" + " declare function functx:substring-before-last ( $arg as xs:string? , $delim as xs:string ) as xs:string { if (matches($arg, functx:escape-for-regex($delim))) then replace($arg, concat('^(.*)', functx:escape-for-regex($delim),'.*'), '$1') else '' } ;\n" + " (functx:substring-before-last( 'abc-def-ghi', '-'), functx:substring-before-last('abcd-abcd', 'ab'), functx:substring-before-last('abcd-abcd', 'x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc-def abcd- ") ); } /** * ~ : The substring before the last text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-last-match.html : @param $arg the string to substring : @param $regex the regular expression . */ @org.junit.Test public void functxFunctxSubstringBeforeLastMatch1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The substring before the last text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-last-match.html : @param $arg the string to substring : @param $regex the regular expression :)\n" + " declare function functx:substring-before-last-match ( $arg as xs:string? , $regex as xs:string ) as xs:string? { replace($arg,concat('^(.*)',$regex,'.*'),'$1') } ;\n" + " (functx:substring-before-last-match( 'abc-def-ghi', '[ce]'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc-d") ); } /** * ~ : The substring before the last text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-last-match.html : @param $arg the string to substring : @param $regex the regular expression . */ @org.junit.Test public void functxFunctxSubstringBeforeLastMatch2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The substring before the last text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-last-match.html : @param $arg the string to substring : @param $regex the regular expression :)\n" + " declare function functx:substring-before-last-match ( $arg as xs:string? , $regex as xs:string ) as xs:string? { replace($arg,concat('^(.*)',$regex,'.*'),'$1') } ;\n" + " (functx:substring-before-last-match( 'abcd-abcd', 'ab?'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcd-") ); } /** * ~ : The substring before the last text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-last-match.html : @param $arg the string to substring : @param $regex the regular expression . */ @org.junit.Test public void functxFunctxSubstringBeforeLastMatch3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The substring before the last text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-last-match.html : @param $arg the string to substring : @param $regex the regular expression :)\n" + " declare function functx:substring-before-last-match ( $arg as xs:string? , $regex as xs:string ) as xs:string? { replace($arg,concat('^(.*)',$regex,'.*'),'$1') } ;\n" + " (functx:substring-before-last-match( 'abcd-abcd', 'x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcd-abcd") ); } /** * ~ : The substring before the last text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-last-match.html : @param $arg the string to substring : @param $regex the regular expression . */ @org.junit.Test public void functxFunctxSubstringBeforeLastMatchAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The substring before the last text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-last-match.html : @param $arg the string to substring : @param $regex the regular expression :)\n" + " declare function functx:substring-before-last-match ( $arg as xs:string? , $regex as xs:string ) as xs:string? { replace($arg,concat('^(.*)',$regex,'.*'),'$1') } ;\n" + " (functx:substring-before-last-match( 'abc-def-ghi', '[ce]'), functx:substring-before-last-match( 'abcd-abcd', 'ab?'), functx:substring-before-last-match( 'abcd-abcd', 'x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc-d abcd- abcd-abcd") ); } /** * ~ : The substring before the first text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-match.html : @param $arg the string to substring : @param $regex the regular expression . */ @org.junit.Test public void functxFunctxSubstringBeforeMatch1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The substring before the first text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-match.html : @param $arg the string to substring : @param $regex the regular expression :)\n" + " declare function functx:substring-before-match ( $arg as xs:string? , $regex as xs:string ) as xs:string? { tokenize($arg,$regex)[1] } ;\n" + " (functx:substring-before-match( 'abc-def-ghi', '[dg]'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc-") ); } /** * ~ : The substring before the first text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-match.html : @param $arg the string to substring : @param $regex the regular expression . */ @org.junit.Test public void functxFunctxSubstringBeforeMatch2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The substring before the first text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-match.html : @param $arg the string to substring : @param $regex the regular expression :)\n" + " declare function functx:substring-before-match ( $arg as xs:string? , $regex as xs:string ) as xs:string? { tokenize($arg,$regex)[1] } ;\n" + " (functx:substring-before-match( 'abcd-abcd', 'bc?'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a") ); } /** * ~ : The substring before the first text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-match.html : @param $arg the string to substring : @param $regex the regular expression . */ @org.junit.Test public void functxFunctxSubstringBeforeMatch3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The substring before the first text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-match.html : @param $arg the string to substring : @param $regex the regular expression :)\n" + " declare function functx:substring-before-match ( $arg as xs:string? , $regex as xs:string ) as xs:string? { tokenize($arg,$regex)[1] } ;\n" + " (functx:substring-before-match( 'abcd-abcd', 'x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcd-abcd") ); } /** * ~ : The substring before the first text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-match.html : @param $arg the string to substring : @param $regex the regular expression . */ @org.junit.Test public void functxFunctxSubstringBeforeMatchAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The substring before the first text that matches a regex : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_substring-before-match.html : @param $arg the string to substring : @param $regex the regular expression :)\n" + " declare function functx:substring-before-match ( $arg as xs:string? , $regex as xs:string ) as xs:string? { tokenize($arg,$regex)[1] } ;\n" + " (functx:substring-before-match( 'abc-def-ghi', '[dg]'), functx:substring-before-match( 'abcd-abcd', 'bc?'), functx:substring-before-match( 'abcd-abcd', 'x'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc- a abcd-abcd") ); } /** * ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies ~ : Construct a time from an hour, minute and second : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_time.html : @param $hour the hour : @param $minute the minute : @param $second the second . */ @org.junit.Test public void functxFunctxTime1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (:~ : Construct a time from an hour, minute and second : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_time.html : @param $hour the hour : @param $minute the minute : @param $second the second :)\n" + " declare function functx:time ( $hour as xs:anyAtomicType , $minute as xs:anyAtomicType , $second as xs:anyAtomicType ) as xs:time { xs:time( concat( functx:pad-integer-to-length(xs:integer($hour),2),':', functx:pad-integer-to-length(xs:integer($minute),2),':', functx:pad-integer-to-length(xs:integer($second),2))) } ;\n" + " (functx:time(20,6,12))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "20:06:12") ); } /** * ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies ~ : Construct a time from an hour, minute and second : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_time.html : @param $hour the hour : @param $minute the minute : @param $second the second . */ @org.junit.Test public void functxFunctxTime2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (:~ : Construct a time from an hour, minute and second : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_time.html : @param $hour the hour : @param $minute the minute : @param $second the second :)\n" + " declare function functx:time ( $hour as xs:anyAtomicType , $minute as xs:anyAtomicType , $second as xs:anyAtomicType ) as xs:time { xs:time( concat( functx:pad-integer-to-length(xs:integer($hour),2),':', functx:pad-integer-to-length(xs:integer($minute),2),':', functx:pad-integer-to-length(xs:integer($second),2))) } ;\n" + " (functx:time('20','6','12'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "20:06:12") ); } /** * ~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length ~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies ~ : Construct a time from an hour, minute and second : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_time.html : @param $hour the hour : @param $minute the minute : @param $second the second . */ @org.junit.Test public void functxFunctxTimeAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Pads an integer to a desired length by adding leading zeros : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_pad-integer-to-length.html : @param $integerToPad the integer to pad : @param $length the desired length :)\n" + " declare function functx:pad-integer-to-length ( $integerToPad as xs:anyAtomicType? , $length as xs:integer ) as xs:string { if ($length < string-length(string($integerToPad))) then error(xs:QName('functx:Integer_Longer_Than_Length')) else concat (functx:repeat-string( '0',$length - string-length(string($integerToPad))), string($integerToPad)) } ;\n" + " (:~ : Repeats a string a given number of times : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_repeat-string.html : @param $stringToRepeat the string to repeat : @param $count the desired number of copies :)\n" + " declare function functx:repeat-string ( $stringToRepeat as xs:string? , $count as xs:integer ) as xs:string { string-join((for $i in 1 to $count return $stringToRepeat), '') } ;\n" + " (:~ : Construct a time from an hour, minute and second : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_time.html : @param $hour the hour : @param $minute the minute : @param $second the second :)\n" + " declare function functx:time ( $hour as xs:anyAtomicType , $minute as xs:anyAtomicType , $second as xs:anyAtomicType ) as xs:time { xs:time( concat( functx:pad-integer-to-length(xs:integer($hour),2),':', functx:pad-integer-to-length(xs:integer($minute),2),':', functx:pad-integer-to-length(xs:integer($second),2))) } ;\n" + " (functx:time(20,6,12), functx:time('20','6','12'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "20:06:12 20:06:12") ); } /** * ~ : Converts an xs:dayTimeDuration into a timezone like "-05:00" or "Z" : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_timezone-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTimezoneFromDuration1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Converts an xs:dayTimeDuration into a timezone like \"-05:00\" or \"Z\" : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_timezone-from-duration.html : @param $duration the duration :)\n" + " declare function functx:timezone-from-duration ( $duration as xs:dayTimeDuration ) as xs:string { if (string($duration) = ('PT0S','-PT0S')) then 'Z' else if (matches(string($duration),'-PT[1-9]H')) then replace(string($duration),'PT([1-9])H','0$1:00') else if (matches(string($duration),'PT[1-9]H')) then replace(string($duration),'PT([1-9])H','+0$1:00') else if (matches(string($duration),'-PT1[0-4]H')) then replace(string($duration),'PT(1[0-4])H','$1:00') else if (matches(string($duration),'PT1[0-4]H')) then replace(string($duration),'PT(1[0-4])H','+$1:00') else error(xs:QName('functx:Invalid_Duration_Value')) } ;\n" + " (functx:timezone-from-duration( xs:dayTimeDuration('PT0S')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Z") ); } /** * ~ : Converts an xs:dayTimeDuration into a timezone like "-05:00" or "Z" : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_timezone-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTimezoneFromDuration2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Converts an xs:dayTimeDuration into a timezone like \"-05:00\" or \"Z\" : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_timezone-from-duration.html : @param $duration the duration :)\n" + " declare function functx:timezone-from-duration ( $duration as xs:dayTimeDuration ) as xs:string { if (string($duration) = ('PT0S','-PT0S')) then 'Z' else if (matches(string($duration),'-PT[1-9]H')) then replace(string($duration),'PT([1-9])H','0$1:00') else if (matches(string($duration),'PT[1-9]H')) then replace(string($duration),'PT([1-9])H','+0$1:00') else if (matches(string($duration),'-PT1[0-4]H')) then replace(string($duration),'PT(1[0-4])H','$1:00') else if (matches(string($duration),'PT1[0-4]H')) then replace(string($duration),'PT(1[0-4])H','+$1:00') else error(xs:QName('functx:Invalid_Duration_Value')) } ;\n" + " (functx:timezone-from-duration( xs:dayTimeDuration('-PT5H')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-05:00") ); } /** * ~ : Converts an xs:dayTimeDuration into a timezone like "-05:00" or "Z" : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_timezone-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTimezoneFromDuration3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Converts an xs:dayTimeDuration into a timezone like \"-05:00\" or \"Z\" : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_timezone-from-duration.html : @param $duration the duration :)\n" + " declare function functx:timezone-from-duration ( $duration as xs:dayTimeDuration ) as xs:string { if (string($duration) = ('PT0S','-PT0S')) then 'Z' else if (matches(string($duration),'-PT[1-9]H')) then replace(string($duration),'PT([1-9])H','0$1:00') else if (matches(string($duration),'PT[1-9]H')) then replace(string($duration),'PT([1-9])H','+0$1:00') else if (matches(string($duration),'-PT1[0-4]H')) then replace(string($duration),'PT(1[0-4])H','$1:00') else if (matches(string($duration),'PT1[0-4]H')) then replace(string($duration),'PT(1[0-4])H','+$1:00') else error(xs:QName('functx:Invalid_Duration_Value')) } ;\n" + " (functx:timezone-from-duration( xs:dayTimeDuration('PT9H')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "+09:00") ); } /** * ~ : Converts an xs:dayTimeDuration into a timezone like "-05:00" or "Z" : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_timezone-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTimezoneFromDurationAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Converts an xs:dayTimeDuration into a timezone like \"-05:00\" or \"Z\" : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_timezone-from-duration.html : @param $duration the duration :)\n" + " declare function functx:timezone-from-duration ( $duration as xs:dayTimeDuration ) as xs:string { if (string($duration) = ('PT0S','-PT0S')) then 'Z' else if (matches(string($duration),'-PT[1-9]H')) then replace(string($duration),'PT([1-9])H','0$1:00') else if (matches(string($duration),'PT[1-9]H')) then replace(string($duration),'PT([1-9])H','+0$1:00') else if (matches(string($duration),'-PT1[0-4]H')) then replace(string($duration),'PT(1[0-4])H','$1:00') else if (matches(string($duration),'PT1[0-4]H')) then replace(string($duration),'PT(1[0-4])H','+$1:00') else error(xs:QName('functx:Invalid_Duration_Value')) } ;\n" + " (functx:timezone-from-duration( xs:dayTimeDuration('PT0S')), functx:timezone-from-duration( xs:dayTimeDuration('-PT5H')), functx:timezone-from-duration( xs:dayTimeDuration('PT9H')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Z -05:00 +09:00") ); } /** * ~ : The total number of days in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-days-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalDaysFromDuration1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of days in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-days-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-days-from-duration ( $duration as xs:dayTimeDuration? ) as xs:decimal? { $duration div xs:dayTimeDuration('P1D') } ;\n" + " (functx:total-days-from-duration( xs:dayTimeDuration('PT24H')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * ~ : The total number of days in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-days-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalDaysFromDuration2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of days in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-days-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-days-from-duration ( $duration as xs:dayTimeDuration? ) as xs:decimal? { $duration div xs:dayTimeDuration('P1D') } ;\n" + " (functx:total-days-from-duration( xs:dayTimeDuration('P1D')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * ~ : The total number of days in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-days-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalDaysFromDuration3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of days in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-days-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-days-from-duration ( $duration as xs:dayTimeDuration? ) as xs:decimal? { $duration div xs:dayTimeDuration('P1D') } ;\n" + " (functx:total-days-from-duration( xs:dayTimeDuration('PT36H')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.5") ); } /** * ~ : The total number of days in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-days-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalDaysFromDuration4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of days in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-days-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-days-from-duration ( $duration as xs:dayTimeDuration? ) as xs:decimal? { $duration div xs:dayTimeDuration('P1D') } ;\n" + " (functx:total-days-from-duration( xs:dayTimeDuration('PT48H')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * ~ : The total number of days in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-days-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalDaysFromDurationAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of days in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-days-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-days-from-duration ( $duration as xs:dayTimeDuration? ) as xs:decimal? { $duration div xs:dayTimeDuration('P1D') } ;\n" + " (functx:total-days-from-duration( xs:dayTimeDuration('PT24H')), functx:total-days-from-duration( xs:dayTimeDuration('P1D')), functx:total-days-from-duration( xs:dayTimeDuration('PT36H')), functx:total-days-from-duration( xs:dayTimeDuration('PT48H')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 1 1.5 2") ); } /** * ~ : The total number of hours in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-hours-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalHoursFromDuration1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of hours in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-hours-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-hours-from-duration ( $duration as xs:dayTimeDuration? ) as xs:decimal? { $duration div xs:dayTimeDuration('PT1H') } ;\n" + " (functx:total-hours-from-duration( xs:dayTimeDuration('PT26H')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("26") ); } /** * ~ : The total number of hours in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-hours-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalHoursFromDuration2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of hours in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-hours-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-hours-from-duration ( $duration as xs:dayTimeDuration? ) as xs:decimal? { $duration div xs:dayTimeDuration('PT1H') } ;\n" + " (functx:total-hours-from-duration( xs:dayTimeDuration('PT1H30M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.5") ); } /** * ~ : The total number of hours in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-hours-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalHoursFromDuration3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of hours in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-hours-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-hours-from-duration ( $duration as xs:dayTimeDuration? ) as xs:decimal? { $duration div xs:dayTimeDuration('PT1H') } ;\n" + " (functx:total-hours-from-duration( xs:dayTimeDuration('-PT3H')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-3") ); } /** * ~ : The total number of hours in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-hours-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalHoursFromDuration4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of hours in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-hours-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-hours-from-duration ( $duration as xs:dayTimeDuration? ) as xs:decimal? { $duration div xs:dayTimeDuration('PT1H') } ;\n" + " (functx:total-hours-from-duration( xs:dayTimeDuration('P1D')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("24") ); } /** * ~ : The total number of hours in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-hours-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalHoursFromDuration5() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of hours in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-hours-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-hours-from-duration ( $duration as xs:dayTimeDuration? ) as xs:decimal? { $duration div xs:dayTimeDuration('PT1H') } ;\n" + " (functx:total-hours-from-duration( xs:dayTimeDuration('P1DT2H')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("26") ); } /** * ~ : The total number of hours in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-hours-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalHoursFromDurationAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of hours in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-hours-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-hours-from-duration ( $duration as xs:dayTimeDuration? ) as xs:decimal? { $duration div xs:dayTimeDuration('PT1H') } ;\n" + " (functx:total-hours-from-duration( xs:dayTimeDuration('PT26H')), functx:total-hours-from-duration( xs:dayTimeDuration('PT1H30M')), functx:total-hours-from-duration( xs:dayTimeDuration('-PT3H')), functx:total-hours-from-duration( xs:dayTimeDuration('P1D')), functx:total-hours-from-duration( xs:dayTimeDuration('P1DT2H')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "26 1.5 -3 24 26") ); } /** * ~ : The total number of minutes in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-minutes-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalMinutesFromDuration1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of minutes in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-minutes-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-minutes-from-duration ( $duration as xs:dayTimeDuration? ) as xs:decimal? { $duration div xs:dayTimeDuration('PT1M') } ;\n" + " (functx:total-minutes-from-duration( xs:dayTimeDuration('PT90M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("90") ); } /** * ~ : The total number of minutes in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-minutes-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalMinutesFromDuration2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of minutes in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-minutes-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-minutes-from-duration ( $duration as xs:dayTimeDuration? ) as xs:decimal? { $duration div xs:dayTimeDuration('PT1M') } ;\n" + " (functx:total-minutes-from-duration( xs:dayTimeDuration('PT1H90M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("150") ); } /** * ~ : The total number of minutes in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-minutes-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalMinutesFromDuration3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of minutes in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-minutes-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-minutes-from-duration ( $duration as xs:dayTimeDuration? ) as xs:decimal? { $duration div xs:dayTimeDuration('PT1M') } ;\n" + " (functx:total-minutes-from-duration( xs:dayTimeDuration('PT3H')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("180") ); } /** * ~ : The total number of minutes in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-minutes-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalMinutesFromDuration4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of minutes in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-minutes-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-minutes-from-duration ( $duration as xs:dayTimeDuration? ) as xs:decimal? { $duration div xs:dayTimeDuration('PT1M') } ;\n" + " (functx:total-minutes-from-duration( xs:dayTimeDuration('PT1M30S')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.5") ); } /** * ~ : The total number of minutes in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-minutes-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalMinutesFromDurationAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of minutes in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-minutes-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-minutes-from-duration ( $duration as xs:dayTimeDuration? ) as xs:decimal? { $duration div xs:dayTimeDuration('PT1M') } ;\n" + " (functx:total-minutes-from-duration( xs:dayTimeDuration('PT90M')), functx:total-minutes-from-duration( xs:dayTimeDuration('PT1H90M')), functx:total-minutes-from-duration( xs:dayTimeDuration('PT3H')), functx:total-minutes-from-duration( xs:dayTimeDuration('PT1M30S')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "90 150 180 1.5") ); } /** * ~ : The total number of months in a yearMonthDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-months-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalMonthsFromDuration1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of months in a yearMonthDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-months-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-months-from-duration ( $duration as xs:yearMonthDuration? ) as xs:decimal? { $duration div xs:yearMonthDuration('P1M') } ;\n" + " (functx:total-months-from-duration( xs:yearMonthDuration('P18M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("18") ); } /** * ~ : The total number of months in a yearMonthDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-months-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalMonthsFromDuration2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of months in a yearMonthDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-months-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-months-from-duration ( $duration as xs:yearMonthDuration? ) as xs:decimal? { $duration div xs:yearMonthDuration('P1M') } ;\n" + " (functx:total-months-from-duration( xs:yearMonthDuration('P1Y')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("12") ); } /** * ~ : The total number of months in a yearMonthDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-months-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalMonthsFromDuration3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of months in a yearMonthDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-months-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-months-from-duration ( $duration as xs:yearMonthDuration? ) as xs:decimal? { $duration div xs:yearMonthDuration('P1M') } ;\n" + " (functx:total-months-from-duration( xs:yearMonthDuration('P1Y6M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("18") ); } /** * ~ : The total number of months in a yearMonthDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-months-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalMonthsFromDurationAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of months in a yearMonthDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-months-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-months-from-duration ( $duration as xs:yearMonthDuration? ) as xs:decimal? { $duration div xs:yearMonthDuration('P1M') } ;\n" + " (functx:total-months-from-duration( xs:yearMonthDuration('P18M')), functx:total-months-from-duration( xs:yearMonthDuration('P1Y')), functx:total-months-from-duration( xs:yearMonthDuration('P1Y6M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "18 12 18") ); } /** * ~ : The total number of seconds in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-seconds-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalSecondsFromDuration1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of seconds in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-seconds-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-seconds-from-duration ( $duration as xs:dayTimeDuration? ) as xs:decimal? { $duration div xs:dayTimeDuration('PT1S') } ;\n" + " (functx:total-seconds-from-duration( xs:dayTimeDuration('PT90S')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("90") ); } /** * ~ : The total number of seconds in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-seconds-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalSecondsFromDuration2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of seconds in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-seconds-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-seconds-from-duration ( $duration as xs:dayTimeDuration? ) as xs:decimal? { $duration div xs:dayTimeDuration('PT1S') } ;\n" + " (functx:total-seconds-from-duration( xs:dayTimeDuration('PT90.5S')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "90.5") ); } /** * ~ : The total number of seconds in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-seconds-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalSecondsFromDuration3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of seconds in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-seconds-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-seconds-from-duration ( $duration as xs:dayTimeDuration? ) as xs:decimal? { $duration div xs:dayTimeDuration('PT1S') } ;\n" + " (functx:total-seconds-from-duration( xs:dayTimeDuration('PT1M30S')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("90") ); } /** * ~ : The total number of seconds in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-seconds-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalSecondsFromDuration4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of seconds in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-seconds-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-seconds-from-duration ( $duration as xs:dayTimeDuration? ) as xs:decimal? { $duration div xs:dayTimeDuration('PT1S') } ;\n" + " (functx:total-seconds-from-duration( xs:dayTimeDuration('PT3M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("180") ); } /** * ~ : The total number of seconds in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-seconds-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalSecondsFromDurationAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of seconds in a dayTimeDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-seconds-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-seconds-from-duration ( $duration as xs:dayTimeDuration? ) as xs:decimal? { $duration div xs:dayTimeDuration('PT1S') } ;\n" + " (functx:total-seconds-from-duration( xs:dayTimeDuration('PT90S')), functx:total-seconds-from-duration( xs:dayTimeDuration('PT90.5S')), functx:total-seconds-from-duration( xs:dayTimeDuration('PT1M30S')), functx:total-seconds-from-duration( xs:dayTimeDuration('PT3M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "90 90.5 90 180") ); } /** * ~ : The total number of years in a yearMonthDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-years-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalYearsFromDuration1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of years in a yearMonthDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-years-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-years-from-duration ( $duration as xs:yearMonthDuration? ) as xs:decimal? { $duration div xs:yearMonthDuration('P1Y') } ;\n" + " (functx:total-years-from-duration( xs:yearMonthDuration('P18M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.5") ); } /** * ~ : The total number of years in a yearMonthDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-years-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalYearsFromDuration2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of years in a yearMonthDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-years-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-years-from-duration ( $duration as xs:yearMonthDuration? ) as xs:decimal? { $duration div xs:yearMonthDuration('P1Y') } ;\n" + " (functx:total-years-from-duration( xs:yearMonthDuration('P1Y')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * ~ : The total number of years in a yearMonthDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-years-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalYearsFromDuration3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of years in a yearMonthDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-years-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-years-from-duration ( $duration as xs:yearMonthDuration? ) as xs:decimal? { $duration div xs:yearMonthDuration('P1Y') } ;\n" + " (functx:total-years-from-duration( xs:yearMonthDuration('P1Y6M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.5") ); } /** * ~ : The total number of years in a yearMonthDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-years-from-duration.html : @param $duration the duration . */ @org.junit.Test public void functxFunctxTotalYearsFromDurationAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The total number of years in a yearMonthDuration : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_total-years-from-duration.html : @param $duration the duration :)\n" + " declare function functx:total-years-from-duration ( $duration as xs:yearMonthDuration? ) as xs:decimal? { $duration div xs:yearMonthDuration('P1Y') } ;\n" + " (functx:total-years-from-duration( xs:yearMonthDuration('P18M')), functx:total-years-from-duration( xs:yearMonthDuration('P1Y')), functx:total-years-from-duration( xs:yearMonthDuration('P1Y6M')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.5 1 1.5") ); } /** * ~ : Trims leading and trailing whitespace : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_trim.html : @param $arg the string to trim . */ @org.junit.Test public void functxFunctxTrim1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Trims leading and trailing whitespace : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_trim.html : @param $arg the string to trim :)\n" + " declare function functx:trim ( $arg as xs:string? ) as xs:string { replace(replace($arg,'\\s+$',''),'^\\s+','') } ;\n" + " (functx:trim(' xyz '))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xyz") ); } /** * ~ : Trims leading and trailing whitespace : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_trim.html : @param $arg the string to trim . */ @org.junit.Test public void functxFunctxTrim2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Trims leading and trailing whitespace : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_trim.html : @param $arg the string to trim :)\n" + " declare function functx:trim ( $arg as xs:string? ) as xs:string { replace(replace($arg,'\\s+$',''),'^\\s+','') } ;\n" + " (functx:trim(' xyz'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xyz") ); } /** * ~ : Trims leading and trailing whitespace : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_trim.html : @param $arg the string to trim . */ @org.junit.Test public void functxFunctxTrim3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Trims leading and trailing whitespace : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_trim.html : @param $arg the string to trim :)\n" + " declare function functx:trim ( $arg as xs:string? ) as xs:string { replace(replace($arg,'\\s+$',''),'^\\s+','') } ;\n" + " (functx:trim('x xyz '))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "x xyz") ); } /** * ~ : Trims leading and trailing whitespace : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_trim.html : @param $arg the string to trim . */ @org.junit.Test public void functxFunctxTrimAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Trims leading and trailing whitespace : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_trim.html : @param $arg the string to trim :)\n" + " declare function functx:trim ( $arg as xs:string? ) as xs:string { replace(replace($arg,'\\s+$',''),'^\\s+','') } ;\n" + " (functx:trim(' xyz '), functx:trim(' xyz'), functx:trim('x xyz '))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"xyz\", \"xyz\", \"x xyz\"") ); } /** * ~ : Updates the attribute value of an XML element : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_update-attributes.html : @param $elements the element(s) for which you wish to update the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add . */ @org.junit.Test public void functxFunctxUpdateAttributes1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Updates the attribute value of an XML element : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_update-attributes.html : @param $elements the element(s) for which you wish to update the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add :)\n" + " declare function functx:update-attributes ( $elements as element()* , $attrNames as xs:QName* , $attrValues as xs:anyAtomicType* ) as element()? { for $element in $elements return element { node-name($element)} { for $attrName at $seq in $attrNames return if ($element/@*[node-name(.) = $attrName]) then attribute {$attrName} {$attrValues[$seq]} else (), $element/@*[not(node-name(.) = $attrNames)], $element/node() } } ;\n" + " let $in-xml := x x x return (functx:update-attributes( $in-xml/a, xs:QName('att1'), 123))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("x", false) ); } /** * ~ : Updates the attribute value of an XML element : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_update-attributes.html : @param $elements the element(s) for which you wish to update the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add . */ @org.junit.Test public void functxFunctxUpdateAttributes2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Updates the attribute value of an XML element : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_update-attributes.html : @param $elements the element(s) for which you wish to update the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add :)\n" + " declare function functx:update-attributes ( $elements as element()* , $attrNames as xs:QName* , $attrValues as xs:anyAtomicType* ) as element()? { for $element in $elements return element { node-name($element)} { for $attrName at $seq in $attrNames return if ($element/@*[node-name(.) = $attrName]) then attribute {$attrName} {$attrValues[$seq]} else (), $element/@*[not(node-name(.) = $attrNames)], $element/node() } } ;\n" + " let $in-xml := x x x return (functx:update-attributes( $in-xml/a, (xs:QName('att1'),xs:QName('att2')), (1,2)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("x", false) ); } /** * ~ : Updates the attribute value of an XML element : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_update-attributes.html : @param $elements the element(s) for which you wish to update the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add . */ @org.junit.Test public void functxFunctxUpdateAttributes3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Updates the attribute value of an XML element : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_update-attributes.html : @param $elements the element(s) for which you wish to update the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add :)\n" + " declare function functx:update-attributes ( $elements as element()* , $attrNames as xs:QName* , $attrValues as xs:anyAtomicType* ) as element()? { for $element in $elements return element { node-name($element)} { for $attrName at $seq in $attrNames return if ($element/@*[node-name(.) = $attrName]) then attribute {$attrName} {$attrValues[$seq]} else (), $element/@*[not(node-name(.) = $attrNames)], $element/node() } } ;\n" + " let $in-xml := x x x return (functx:update-attributes( $in-xml/b, xs:QName('att1'), 123))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("x", false) ); } /** * ~ : Updates the attribute value of an XML element : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_update-attributes.html : @param $elements the element(s) for which you wish to update the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add . */ @org.junit.Test public void functxFunctxUpdateAttributes4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Updates the attribute value of an XML element : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_update-attributes.html : @param $elements the element(s) for which you wish to update the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add :)\n" + " declare function functx:update-attributes ( $elements as element()* , $attrNames as xs:QName* , $attrValues as xs:anyAtomicType* ) as element()? { for $element in $elements return element { node-name($element)} { for $attrName at $seq in $attrNames return if ($element/@*[node-name(.) = $attrName]) then attribute {$attrName} {$attrValues[$seq]} else (), $element/@*[not(node-name(.) = $attrNames)], $element/node() } } ;\n" + " let $in-xml := x x x return (functx:update-attributes( $in-xml/c, QName('http://new','prefix:att1'), 123))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("x", false) ); } /** * ~ : Updates the attribute value of an XML element : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_update-attributes.html : @param $elements the element(s) for which you wish to update the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add . */ @org.junit.Test public void functxFunctxUpdateAttributesAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Updates the attribute value of an XML element : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_update-attributes.html : @param $elements the element(s) for which you wish to update the attribute : @param $attrNames the name(s) of the attribute(s) to add : @param $attrValues the value(s) of the attribute(s) to add :)\n" + " declare function functx:update-attributes ( $elements as element()* , $attrNames as xs:QName* , $attrValues as xs:anyAtomicType* ) as element()? { for $element in $elements return element { node-name($element)} { for $attrName at $seq in $attrNames return if ($element/@*[node-name(.) = $attrName]) then attribute {$attrName} {$attrValues[$seq]} else (), $element/@*[not(node-name(.) = $attrNames)], $element/node() } } ;\n" + " let $in-xml := x x x return (functx:update-attributes( $in-xml/a, xs:QName('att1'), 123), functx:update-attributes( $in-xml/a, (xs:QName('att1'),xs:QName('att2')), (1,2)), functx:update-attributes( $in-xml/b, xs:QName('att1'), 123), functx:update-attributes( $in-xml/c, QName('http://new','prefix:att1'), 123))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("xxxx", false) ); } /** * ~ : The values in one sequence that aren't in another sequence : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-except.html : @param $arg1 the first sequence : @param $arg2 the second sequence . */ @org.junit.Test public void functxFunctxValueExcept1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The values in one sequence that aren't in another sequence : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-except.html : @param $arg1 the first sequence : @param $arg2 the second sequence :)\n" + " declare function functx:value-except ( $arg1 as xs:anyAtomicType* , $arg2 as xs:anyAtomicType* ) as xs:anyAtomicType* { distinct-values($arg1[not(.=$arg2)]) } ;\n" + " (functx:value-except((1,2,3),(3,4,5)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2") ); } /** * ~ : The values in one sequence that aren't in another sequence : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-except.html : @param $arg1 the first sequence : @param $arg2 the second sequence . */ @org.junit.Test public void functxFunctxValueExcept2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The values in one sequence that aren't in another sequence : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-except.html : @param $arg1 the first sequence : @param $arg2 the second sequence :)\n" + " declare function functx:value-except ( $arg1 as xs:anyAtomicType* , $arg2 as xs:anyAtomicType* ) as xs:anyAtomicType* { distinct-values($arg1[not(.=$arg2)]) } ;\n" + " (functx:value-except((1,1,2,3),(2,3)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * ~ : The values in one sequence that aren't in another sequence : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-except.html : @param $arg1 the first sequence : @param $arg2 the second sequence . */ @org.junit.Test public void functxFunctxValueExcept3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The values in one sequence that aren't in another sequence : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-except.html : @param $arg1 the first sequence : @param $arg2 the second sequence :)\n" + " declare function functx:value-except ( $arg1 as xs:anyAtomicType* , $arg2 as xs:anyAtomicType* ) as xs:anyAtomicType* { distinct-values($arg1[not(.=$arg2)]) } ;\n" + " (functx:value-except((1,2),(3,4)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2") ); } /** * ~ : The values in one sequence that aren't in another sequence : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-except.html : @param $arg1 the first sequence : @param $arg2 the second sequence . */ @org.junit.Test public void functxFunctxValueExcept4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The values in one sequence that aren't in another sequence : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-except.html : @param $arg1 the first sequence : @param $arg2 the second sequence :)\n" + " declare function functx:value-except ( $arg1 as xs:anyAtomicType* , $arg2 as xs:anyAtomicType* ) as xs:anyAtomicType* { distinct-values($arg1[not(.=$arg2)]) } ;\n" + " (functx:value-except((1,2,2,3),()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3") ); } /** * ~ : The values in one sequence that aren't in another sequence : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-except.html : @param $arg1 the first sequence : @param $arg2 the second sequence . */ @org.junit.Test public void functxFunctxValueExceptAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The values in one sequence that aren't in another sequence : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-except.html : @param $arg1 the first sequence : @param $arg2 the second sequence :)\n" + " declare function functx:value-except ( $arg1 as xs:anyAtomicType* , $arg2 as xs:anyAtomicType* ) as xs:anyAtomicType* { distinct-values($arg1[not(.=$arg2)]) } ;\n" + " (functx:value-except((1,2,3),(3,4,5)), functx:value-except((1,1,2,3),(2,3)), functx:value-except((1,2),(3,4)), functx:value-except((1,2,2,3),()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 1 1 2 1 2 3") ); } /** * ~ : The intersection of two sequences of values : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-intersect.html : @param $arg1 the first sequence : @param $arg2 the second sequence . */ @org.junit.Test public void functxFunctxValueIntersect1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The intersection of two sequences of values : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-intersect.html : @param $arg1 the first sequence : @param $arg2 the second sequence :)\n" + " declare function functx:value-intersect ( $arg1 as xs:anyAtomicType* , $arg2 as xs:anyAtomicType* ) as xs:anyAtomicType* { distinct-values($arg1[.=$arg2]) } ;\n" + " (functx:value-intersect((1,2),(2,3)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * ~ : The intersection of two sequences of values : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-intersect.html : @param $arg1 the first sequence : @param $arg2 the second sequence . */ @org.junit.Test public void functxFunctxValueIntersect2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The intersection of two sequences of values : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-intersect.html : @param $arg1 the first sequence : @param $arg2 the second sequence :)\n" + " declare function functx:value-intersect ( $arg1 as xs:anyAtomicType* , $arg2 as xs:anyAtomicType* ) as xs:anyAtomicType* { distinct-values($arg1[.=$arg2]) } ;\n" + " (functx:value-intersect((1,2,3),(2,3,4)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2 3") ); } /** * ~ : The intersection of two sequences of values : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-intersect.html : @param $arg1 the first sequence : @param $arg2 the second sequence . */ @org.junit.Test public void functxFunctxValueIntersect3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The intersection of two sequences of values : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-intersect.html : @param $arg1 the first sequence : @param $arg2 the second sequence :)\n" + " declare function functx:value-intersect ( $arg1 as xs:anyAtomicType* , $arg2 as xs:anyAtomicType* ) as xs:anyAtomicType* { distinct-values($arg1[.=$arg2]) } ;\n" + " (functx:value-intersect((1,2,2,3),(2,3)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2 3") ); } /** * ~ : The intersection of two sequences of values : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-intersect.html : @param $arg1 the first sequence : @param $arg2 the second sequence . */ @org.junit.Test public void functxFunctxValueIntersect4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The intersection of two sequences of values : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-intersect.html : @param $arg1 the first sequence : @param $arg2 the second sequence :)\n" + " declare function functx:value-intersect ( $arg1 as xs:anyAtomicType* , $arg2 as xs:anyAtomicType* ) as xs:anyAtomicType* { distinct-values($arg1[.=$arg2]) } ;\n" + " (functx:value-intersect((1,2,2,3),()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * ~ : The intersection of two sequences of values : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-intersect.html : @param $arg1 the first sequence : @param $arg2 the second sequence . */ @org.junit.Test public void functxFunctxValueIntersectAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The intersection of two sequences of values : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-intersect.html : @param $arg1 the first sequence : @param $arg2 the second sequence :)\n" + " declare function functx:value-intersect ( $arg1 as xs:anyAtomicType* , $arg2 as xs:anyAtomicType* ) as xs:anyAtomicType* { distinct-values($arg1[.=$arg2]) } ;\n" + " (functx:value-intersect((1,2),(2,3)), functx:value-intersect((1,2,3),(2,3,4)), functx:value-intersect((1,2,2,3),(2,3)), functx:value-intersect((1,2,2,3),()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2 2 3 2 3") ); } /** * ~ : The union of two sequences of values : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-union.html : @param $arg1 the first sequence : @param $arg2 the second sequence . */ @org.junit.Test public void functxFunctxValueUnion1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The union of two sequences of values : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-union.html : @param $arg1 the first sequence : @param $arg2 the second sequence :)\n" + " declare function functx:value-union ( $arg1 as xs:anyAtomicType* , $arg2 as xs:anyAtomicType* ) as xs:anyAtomicType* { distinct-values(($arg1, $arg2)) } ;\n" + " (functx:value-union((1,2),(3,4)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 4") ); } /** * ~ : The union of two sequences of values : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-union.html : @param $arg1 the first sequence : @param $arg2 the second sequence . */ @org.junit.Test public void functxFunctxValueUnion2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The union of two sequences of values : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-union.html : @param $arg1 the first sequence : @param $arg2 the second sequence :)\n" + " declare function functx:value-union ( $arg1 as xs:anyAtomicType* , $arg2 as xs:anyAtomicType* ) as xs:anyAtomicType* { distinct-values(($arg1, $arg2)) } ;\n" + " (functx:value-union((1,2,3),(2,3,4)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 4") ); } /** * ~ : The union of two sequences of values : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-union.html : @param $arg1 the first sequence : @param $arg2 the second sequence . */ @org.junit.Test public void functxFunctxValueUnion3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The union of two sequences of values : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-union.html : @param $arg1 the first sequence : @param $arg2 the second sequence :)\n" + " declare function functx:value-union ( $arg1 as xs:anyAtomicType* , $arg2 as xs:anyAtomicType* ) as xs:anyAtomicType* { distinct-values(($arg1, $arg2)) } ;\n" + " (functx:value-union((1,2,2,3),(3,4)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 4") ); } /** * ~ : The union of two sequences of values : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-union.html : @param $arg1 the first sequence : @param $arg2 the second sequence . */ @org.junit.Test public void functxFunctxValueUnion4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The union of two sequences of values : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-union.html : @param $arg1 the first sequence : @param $arg2 the second sequence :)\n" + " declare function functx:value-union ( $arg1 as xs:anyAtomicType* , $arg2 as xs:anyAtomicType* ) as xs:anyAtomicType* { distinct-values(($arg1, $arg2)) } ;\n" + " (functx:value-union((1,2,2,3),()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3") ); } /** * ~ : The union of two sequences of values : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-union.html : @param $arg1 the first sequence : @param $arg2 the second sequence . */ @org.junit.Test public void functxFunctxValueUnionAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The union of two sequences of values : : @author W3C XML Query Working Group : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_value-union.html : @param $arg1 the first sequence : @param $arg2 the second sequence :)\n" + " declare function functx:value-union ( $arg1 as xs:anyAtomicType* , $arg2 as xs:anyAtomicType* ) as xs:anyAtomicType* { distinct-values(($arg1, $arg2)) } ;\n" + " (functx:value-union((1,2),(3,4)), functx:value-union((1,2,3),(2,3,4)), functx:value-union((1,2,2,3),(3,4)), functx:value-union((1,2,2,3),()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 4 1 2 3 4 1 2 3 4 1 2 3") ); } /** * ~ : The number of words : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_word-count.html : @param $arg the string to measure . */ @org.junit.Test public void functxFunctxWordCount1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The number of words : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_word-count.html : @param $arg the string to measure :)\n" + " declare function functx:word-count ( $arg as xs:string? ) as xs:integer { count(tokenize($arg, '\\W+')[. != '']) } ;\n" + " (functx:word-count('hello there world'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * ~ : The number of words : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_word-count.html : @param $arg the string to measure . */ @org.junit.Test public void functxFunctxWordCount2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The number of words : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_word-count.html : @param $arg the string to measure :)\n" + " declare function functx:word-count ( $arg as xs:string? ) as xs:integer { count(tokenize($arg, '\\W+')[. != '']) } ;\n" + " (functx:word-count(' hello world '))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * ~ : The number of words : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_word-count.html : @param $arg the string to measure . */ @org.junit.Test public void functxFunctxWordCount3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The number of words : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_word-count.html : @param $arg the string to measure :)\n" + " declare function functx:word-count ( $arg as xs:string? ) as xs:integer { count(tokenize($arg, '\\W+')[. != '']) } ;\n" + " (functx:word-count('a.b.c'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * ~ : The number of words : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_word-count.html : @param $arg the string to measure . */ @org.junit.Test public void functxFunctxWordCountAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The number of words : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_word-count.html : @param $arg the string to measure :)\n" + " declare function functx:word-count ( $arg as xs:string? ) as xs:integer { count(tokenize($arg, '\\W+')[. != '']) } ;\n" + " (functx:word-count('hello there world'), functx:word-count(' hello world '), functx:word-count('a.b.c'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3 2 3") ); } /** * ~ : Capitalizes the first character of a string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_capitalize-first.html : @param $arg the word or phrase to capitalize ~ : Turns a string of words into camelCase : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_words-to-camel-case.html : @param $arg the string to modify . */ @org.junit.Test public void functxFunctxWordsToCamelCase1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Capitalizes the first character of a string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_capitalize-first.html : @param $arg the word or phrase to capitalize :)\n" + " declare function functx:capitalize-first ( $arg as xs:string? ) as xs:string? { concat(upper-case(substring($arg,1,1)), substring($arg,2)) } ;\n" + " (:~ : Turns a string of words into camelCase : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_words-to-camel-case.html : @param $arg the string to modify :)\n" + " declare function functx:words-to-camel-case ( $arg as xs:string? ) as xs:string { string-join((tokenize($arg,'\\s+')[1], for $word in tokenize($arg,'\\s+')[position() >\n" + " 1] return functx:capitalize-first($word)) ,'') } ;\n" + " (functx:words-to-camel-case('this Is A Term'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "thisIsATerm") ); } /** * ~ : Capitalizes the first character of a string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_capitalize-first.html : @param $arg the word or phrase to capitalize ~ : Turns a string of words into camelCase : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_words-to-camel-case.html : @param $arg the string to modify . */ @org.junit.Test public void functxFunctxWordsToCamelCase2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Capitalizes the first character of a string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_capitalize-first.html : @param $arg the word or phrase to capitalize :)\n" + " declare function functx:capitalize-first ( $arg as xs:string? ) as xs:string? { concat(upper-case(substring($arg,1,1)), substring($arg,2)) } ;\n" + " (:~ : Turns a string of words into camelCase : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_words-to-camel-case.html : @param $arg the string to modify :)\n" + " declare function functx:words-to-camel-case ( $arg as xs:string? ) as xs:string { string-join((tokenize($arg,'\\s+')[1], for $word in tokenize($arg,'\\s+')[position() >\n" + " 1] return functx:capitalize-first($word)) ,'') } ;\n" + " (functx:words-to-camel-case( 'This is a term'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ThisIsATerm") ); } /** * ~ : Capitalizes the first character of a string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_capitalize-first.html : @param $arg the word or phrase to capitalize ~ : Turns a string of words into camelCase : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_words-to-camel-case.html : @param $arg the string to modify . */ @org.junit.Test public void functxFunctxWordsToCamelCaseAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Capitalizes the first character of a string : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_capitalize-first.html : @param $arg the word or phrase to capitalize :)\n" + " declare function functx:capitalize-first ( $arg as xs:string? ) as xs:string? { concat(upper-case(substring($arg,1,1)), substring($arg,2)) } ;\n" + " (:~ : Turns a string of words into camelCase : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_words-to-camel-case.html : @param $arg the string to modify :)\n" + " declare function functx:words-to-camel-case ( $arg as xs:string? ) as xs:string { string-join((tokenize($arg,'\\s+')[1], for $word in tokenize($arg,'\\s+')[position() >\n" + " 1] return functx:capitalize-first($word)) ,'') } ;\n" + " (functx:words-to-camel-case('this Is A Term'), functx:words-to-camel-case( 'This is a term'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "thisIsATerm ThisIsATerm") ); } /** * ~ : Wraps a sequence of atomic values in XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_wrap-values-in-elements.html : @param $values the values to wrap in elements : @param $elementName the name of the elements to construct . */ @org.junit.Test public void functxFunctxWrapValuesInElements1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " declare namespace new = \"http://newns\";\n" + " (:~ : Wraps a sequence of atomic values in XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_wrap-values-in-elements.html : @param $values the values to wrap in elements : @param $elementName the name of the elements to construct :)\n" + " declare function functx:wrap-values-in-elements ( $values as xs:anyAtomicType* , $elementName as xs:QName ) as element()* { for $value in $values return element {$elementName} {$value} } ;\n" + " (functx:wrap-values-in-elements( (1,2,3), xs:QName('num')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("123", false) ); } /** * ~ : Wraps a sequence of atomic values in XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_wrap-values-in-elements.html : @param $values the values to wrap in elements : @param $elementName the name of the elements to construct . */ @org.junit.Test public void functxFunctxWrapValuesInElements2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " declare namespace new = \"http://newns\";\n" + " (:~ : Wraps a sequence of atomic values in XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_wrap-values-in-elements.html : @param $values the values to wrap in elements : @param $elementName the name of the elements to construct :)\n" + " declare function functx:wrap-values-in-elements ( $values as xs:anyAtomicType* , $elementName as xs:QName ) as element()* { for $value in $values return element {$elementName} {$value} } ;\n" + " (functx:wrap-values-in-elements( (1,2,3), xs:QName('new:num')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("123", false) ); } /** * ~ : Wraps a sequence of atomic values in XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_wrap-values-in-elements.html : @param $values the values to wrap in elements : @param $elementName the name of the elements to construct . */ @org.junit.Test public void functxFunctxWrapValuesInElements3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " declare namespace new = \"http://newns\";\n" + " (:~ : Wraps a sequence of atomic values in XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_wrap-values-in-elements.html : @param $values the values to wrap in elements : @param $elementName the name of the elements to construct :)\n" + " declare function functx:wrap-values-in-elements ( $values as xs:anyAtomicType* , $elementName as xs:QName ) as element()* { for $value in $values return element {$elementName} {$value} } ;\n" + " (functx:wrap-values-in-elements( (1,2,3), QName('http://newns','num')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("123", false) ); } /** * ~ : Wraps a sequence of atomic values in XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_wrap-values-in-elements.html : @param $values the values to wrap in elements : @param $elementName the name of the elements to construct . */ @org.junit.Test public void functxFunctxWrapValuesInElements4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " declare namespace new = \"http://newns\";\n" + " (:~ : Wraps a sequence of atomic values in XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_wrap-values-in-elements.html : @param $values the values to wrap in elements : @param $elementName the name of the elements to construct :)\n" + " declare function functx:wrap-values-in-elements ( $values as xs:anyAtomicType* , $elementName as xs:QName ) as element()* { for $value in $values return element {$elementName} {$value} } ;\n" + " (functx:wrap-values-in-elements( (1,2,3), QName('http://newns','new:num')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("123", false) ); } /** * ~ : Wraps a sequence of atomic values in XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_wrap-values-in-elements.html : @param $values the values to wrap in elements : @param $elementName the name of the elements to construct . */ @org.junit.Test public void functxFunctxWrapValuesInElementsAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " declare namespace new = \"http://newns\";\n" + " (:~ : Wraps a sequence of atomic values in XML elements : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_wrap-values-in-elements.html : @param $values the values to wrap in elements : @param $elementName the name of the elements to construct :)\n" + " declare function functx:wrap-values-in-elements ( $values as xs:anyAtomicType* , $elementName as xs:QName ) as element()* { for $value in $values return element {$elementName} {$value} } ;\n" + " (functx:wrap-values-in-elements( (1,2,3), xs:QName('num')), functx:wrap-values-in-elements( (1,2,3), xs:QName('new:num')), functx:wrap-values-in-elements( (1,2,3), QName('http://newns','num')), functx:wrap-values-in-elements( (1,2,3), QName('http://newns','new:num')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("123123123123", false) ); } /** * ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty ~ : Construct a yearMonthDuration from a number of years and months : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_yearmonthduration.html : @param $years the number of years : @param $months the number of months . */ @org.junit.Test public void functxFunctxYearMonthDuration1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " (:~ : Construct a yearMonthDuration from a number of years and months : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_yearmonthduration.html : @param $years the number of years : @param $months the number of months :)\n" + " declare function functx:yearMonthDuration ( $years as xs:decimal? , $months as xs:integer? ) as xs:yearMonthDuration { (xs:yearMonthDuration('P1M') * functx:if-empty($months,0)) + (xs:yearMonthDuration('P1Y') * functx:if-empty($years,0)) } ;\n" + " (functx:yearMonthDuration(1,6))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1Y6M") ); } /** * ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty ~ : Construct a yearMonthDuration from a number of years and months : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_yearmonthduration.html : @param $years the number of years : @param $months the number of months . */ @org.junit.Test public void functxFunctxYearMonthDuration2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " (:~ : Construct a yearMonthDuration from a number of years and months : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_yearmonthduration.html : @param $years the number of years : @param $months the number of months :)\n" + " declare function functx:yearMonthDuration ( $years as xs:decimal? , $months as xs:integer? ) as xs:yearMonthDuration { (xs:yearMonthDuration('P1M') * functx:if-empty($months,0)) + (xs:yearMonthDuration('P1Y') * functx:if-empty($years,0)) } ;\n" + " (functx:yearMonthDuration(1.5,0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1Y6M") ); } /** * ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty ~ : Construct a yearMonthDuration from a number of years and months : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_yearmonthduration.html : @param $years the number of years : @param $months the number of months . */ @org.junit.Test public void functxFunctxYearMonthDuration3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " (:~ : Construct a yearMonthDuration from a number of years and months : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_yearmonthduration.html : @param $years the number of years : @param $months the number of months :)\n" + " declare function functx:yearMonthDuration ( $years as xs:decimal? , $months as xs:integer? ) as xs:yearMonthDuration { (xs:yearMonthDuration('P1M') * functx:if-empty($months,0)) + (xs:yearMonthDuration('P1Y') * functx:if-empty($years,0)) } ;\n" + " (functx:yearMonthDuration(1,()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1Y") ); } /** * ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty ~ : Construct a yearMonthDuration from a number of years and months : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_yearmonthduration.html : @param $years the number of years : @param $months the number of months . */ @org.junit.Test public void functxFunctxYearMonthDuration4() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " (:~ : Construct a yearMonthDuration from a number of years and months : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_yearmonthduration.html : @param $years the number of years : @param $months the number of months :)\n" + " declare function functx:yearMonthDuration ( $years as xs:decimal? , $months as xs:integer? ) as xs:yearMonthDuration { (xs:yearMonthDuration('P1M') * functx:if-empty($months,0)) + (xs:yearMonthDuration('P1Y') * functx:if-empty($years,0)) } ;\n" + " (functx:yearMonthDuration(1,0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1Y") ); } /** * ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty ~ : Construct a yearMonthDuration from a number of years and months : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_yearmonthduration.html : @param $years the number of years : @param $months the number of months . */ @org.junit.Test public void functxFunctxYearMonthDuration5() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " (:~ : Construct a yearMonthDuration from a number of years and months : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_yearmonthduration.html : @param $years the number of years : @param $months the number of months :)\n" + " declare function functx:yearMonthDuration ( $years as xs:decimal? , $months as xs:integer? ) as xs:yearMonthDuration { (xs:yearMonthDuration('P1M') * functx:if-empty($months,0)) + (xs:yearMonthDuration('P1Y') * functx:if-empty($years,0)) } ;\n" + " (functx:yearMonthDuration(-1,-3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P1Y3M") ); } /** * ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty ~ : Construct a yearMonthDuration from a number of years and months : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_yearmonthduration.html : @param $years the number of years : @param $months the number of months . */ @org.junit.Test public void functxFunctxYearMonthDuration6() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " (:~ : Construct a yearMonthDuration from a number of years and months : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_yearmonthduration.html : @param $years the number of years : @param $months the number of months :)\n" + " declare function functx:yearMonthDuration ( $years as xs:decimal? , $months as xs:integer? ) as xs:yearMonthDuration { (xs:yearMonthDuration('P1M') * functx:if-empty($months,0)) + (xs:yearMonthDuration('P1Y') * functx:if-empty($years,0)) } ;\n" + " (functx:yearMonthDuration(-1,3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P9M") ); } /** * ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty ~ : Construct a yearMonthDuration from a number of years and months : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_yearmonthduration.html : @param $years the number of years : @param $months the number of months . */ @org.junit.Test public void functxFunctxYearMonthDuration7() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " (:~ : Construct a yearMonthDuration from a number of years and months : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_yearmonthduration.html : @param $years the number of years : @param $months the number of months :)\n" + " declare function functx:yearMonthDuration ( $years as xs:decimal? , $months as xs:integer? ) as xs:yearMonthDuration { (xs:yearMonthDuration('P1M') * functx:if-empty($months,0)) + (xs:yearMonthDuration('P1Y') * functx:if-empty($years,0)) } ;\n" + " (functx:yearMonthDuration(0,0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P0M") ); } /** * ~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty ~ : Construct a yearMonthDuration from a number of years and months : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_yearmonthduration.html : @param $years the number of years : @param $months the number of months . */ @org.junit.Test public void functxFunctxYearMonthDurationAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : The first argument if it is not blank, otherwise the second argument : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_if-empty.html : @param $arg the node that may be empty : @param $value the item(s) to use if the node is empty :)\n" + " declare function functx:if-empty ( $arg as item()? , $value as item()* ) as item()* { if (string($arg) != '') then data($arg) else $value } ;\n" + " (:~ : Construct a yearMonthDuration from a number of years and months : : @author Priscilla Walmsley, Datypic : @version 1.0 : @see http://www.xqueryfunctions.com/xq/functx_yearmonthduration.html : @param $years the number of years : @param $months the number of months :)\n" + " declare function functx:yearMonthDuration ( $years as xs:decimal? , $months as xs:integer? ) as xs:yearMonthDuration { (xs:yearMonthDuration('P1M') * functx:if-empty($months,0)) + (xs:yearMonthDuration('P1Y') * functx:if-empty($years,0)) } ;\n" + " (functx:yearMonthDuration(1,6), functx:yearMonthDuration(1.5,0), functx:yearMonthDuration(1,()), functx:yearMonthDuration(1,0), functx:yearMonthDuration(-1,-3), functx:yearMonthDuration(-1,3), functx:yearMonthDuration(0,0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1Y6M P1Y6M P1Y P1Y -P1Y3M -P9M P0M") ); } /** * ~ : Converts a string with format YYYYDDMM (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.1 : @see http://www.xqueryfunctions.com/xq/functx_yyyyddmm-to-date.html : @param $dateString the YYYYDDMM string . */ @org.junit.Test public void functxFunctxYyyyddmmToDate1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Converts a string with format YYYYDDMM (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.1 : @see http://www.xqueryfunctions.com/xq/functx_yyyyddmm-to-date.html : @param $dateString the YYYYDDMM string :)\n" + " declare function functx:yyyyddmm-to-date ( $dateString as xs:string? ) as xs:date? { if (empty($dateString)) then () else if (not(matches($dateString, '^\\D*(\\d{4})\\D*(\\d{2})\\D*(\\d{2})\\D*$'))) then error(xs:QName('functx:Invalid_Date_Format')) else xs:date(replace($dateString, '^\\D*(\\d{4})\\D*(\\d{2})\\D*(\\d{2})\\D*$', '$1-$3-$2')) } ;\n" + " (functx:yyyyddmm-to-date('2004-15-12'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-12-15") ); } /** * ~ : Converts a string with format YYYYDDMM (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.1 : @see http://www.xqueryfunctions.com/xq/functx_yyyyddmm-to-date.html : @param $dateString the YYYYDDMM string . */ @org.junit.Test public void functxFunctxYyyyddmmToDate2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Converts a string with format YYYYDDMM (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.1 : @see http://www.xqueryfunctions.com/xq/functx_yyyyddmm-to-date.html : @param $dateString the YYYYDDMM string :)\n" + " declare function functx:yyyyddmm-to-date ( $dateString as xs:string? ) as xs:date? { if (empty($dateString)) then () else if (not(matches($dateString, '^\\D*(\\d{4})\\D*(\\d{2})\\D*(\\d{2})\\D*$'))) then error(xs:QName('functx:Invalid_Date_Format')) else xs:date(replace($dateString, '^\\D*(\\d{4})\\D*(\\d{2})\\D*(\\d{2})\\D*$', '$1-$3-$2')) } ;\n" + " (functx:yyyyddmm-to-date('20041512'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-12-15") ); } /** * ~ : Converts a string with format YYYYDDMM (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.1 : @see http://www.xqueryfunctions.com/xq/functx_yyyyddmm-to-date.html : @param $dateString the YYYYDDMM string . */ @org.junit.Test public void functxFunctxYyyyddmmToDate3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Converts a string with format YYYYDDMM (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.1 : @see http://www.xqueryfunctions.com/xq/functx_yyyyddmm-to-date.html : @param $dateString the YYYYDDMM string :)\n" + " declare function functx:yyyyddmm-to-date ( $dateString as xs:string? ) as xs:date? { if (empty($dateString)) then () else if (not(matches($dateString, '^\\D*(\\d{4})\\D*(\\d{2})\\D*(\\d{2})\\D*$'))) then error(xs:QName('functx:Invalid_Date_Format')) else xs:date(replace($dateString, '^\\D*(\\d{4})\\D*(\\d{2})\\D*(\\d{2})\\D*$', '$1-$3-$2')) } ;\n" + " (functx:yyyyddmm-to-date('2004/15/12'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-12-15") ); } /** * ~ : Converts a string with format YYYYDDMM (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.1 : @see http://www.xqueryfunctions.com/xq/functx_yyyyddmm-to-date.html : @param $dateString the YYYYDDMM string . */ @org.junit.Test public void functxFunctxYyyyddmmToDateAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Converts a string with format YYYYDDMM (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.1 : @see http://www.xqueryfunctions.com/xq/functx_yyyyddmm-to-date.html : @param $dateString the YYYYDDMM string :)\n" + " declare function functx:yyyyddmm-to-date ( $dateString as xs:string? ) as xs:date? { if (empty($dateString)) then () else if (not(matches($dateString, '^\\D*(\\d{4})\\D*(\\d{2})\\D*(\\d{2})\\D*$'))) then error(xs:QName('functx:Invalid_Date_Format')) else xs:date(replace($dateString, '^\\D*(\\d{4})\\D*(\\d{2})\\D*(\\d{2})\\D*$', '$1-$3-$2')) } ;\n" + " (functx:yyyyddmm-to-date('2004-15-12'), functx:yyyyddmm-to-date('20041512'), functx:yyyyddmm-to-date('2004/15/12'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-12-15 2004-12-15 2004-12-15") ); } /** * ~ : Converts a string with format YYYYMMDD (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.1 : @see http://www.xqueryfunctions.com/xq/functx_yyyymmdd-to-date.html : @param $dateString the YYYYMMDD string . */ @org.junit.Test public void functxFunctxYyyymmddToDate1() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Converts a string with format YYYYMMDD (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.1 : @see http://www.xqueryfunctions.com/xq/functx_yyyymmdd-to-date.html : @param $dateString the YYYYMMDD string :)\n" + " declare function functx:yyyymmdd-to-date ( $dateString as xs:string? ) as xs:date? { if (empty($dateString)) then () else if (not(matches($dateString, '^\\D*(\\d{4})\\D*(\\d{2})\\D*(\\d{2})\\D*$'))) then error(xs:QName('functx:Invalid_Date_Format')) else xs:date(replace($dateString, '^\\D*(\\d{4})\\D*(\\d{2})\\D*(\\d{2})\\D*$', '$1-$2-$3')) } ;\n" + " (functx:yyyymmdd-to-date('2004-12-15'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-12-15") ); } /** * ~ : Converts a string with format YYYYMMDD (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.1 : @see http://www.xqueryfunctions.com/xq/functx_yyyymmdd-to-date.html : @param $dateString the YYYYMMDD string . */ @org.junit.Test public void functxFunctxYyyymmddToDate2() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Converts a string with format YYYYMMDD (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.1 : @see http://www.xqueryfunctions.com/xq/functx_yyyymmdd-to-date.html : @param $dateString the YYYYMMDD string :)\n" + " declare function functx:yyyymmdd-to-date ( $dateString as xs:string? ) as xs:date? { if (empty($dateString)) then () else if (not(matches($dateString, '^\\D*(\\d{4})\\D*(\\d{2})\\D*(\\d{2})\\D*$'))) then error(xs:QName('functx:Invalid_Date_Format')) else xs:date(replace($dateString, '^\\D*(\\d{4})\\D*(\\d{2})\\D*(\\d{2})\\D*$', '$1-$2-$3')) } ;\n" + " (functx:yyyymmdd-to-date('20041215'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-12-15") ); } /** * ~ : Converts a string with format YYYYMMDD (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.1 : @see http://www.xqueryfunctions.com/xq/functx_yyyymmdd-to-date.html : @param $dateString the YYYYMMDD string . */ @org.junit.Test public void functxFunctxYyyymmddToDate3() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Converts a string with format YYYYMMDD (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.1 : @see http://www.xqueryfunctions.com/xq/functx_yyyymmdd-to-date.html : @param $dateString the YYYYMMDD string :)\n" + " declare function functx:yyyymmdd-to-date ( $dateString as xs:string? ) as xs:date? { if (empty($dateString)) then () else if (not(matches($dateString, '^\\D*(\\d{4})\\D*(\\d{2})\\D*(\\d{2})\\D*$'))) then error(xs:QName('functx:Invalid_Date_Format')) else xs:date(replace($dateString, '^\\D*(\\d{4})\\D*(\\d{2})\\D*(\\d{2})\\D*$', '$1-$2-$3')) } ;\n" + " (functx:yyyymmdd-to-date('2004/12/15'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-12-15") ); } /** * ~ : Converts a string with format YYYYMMDD (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.1 : @see http://www.xqueryfunctions.com/xq/functx_yyyymmdd-to-date.html : @param $dateString the YYYYMMDD string . */ @org.junit.Test public void functxFunctxYyyymmddToDateAll() { final XQuery query = new XQuery( "declare namespace functx = \"http://www.example.com/\";\n" + " (:~ : Converts a string with format YYYYMMDD (with any delimiters) to a date : : @author Priscilla Walmsley, Datypic : @version 1.1 : @see http://www.xqueryfunctions.com/xq/functx_yyyymmdd-to-date.html : @param $dateString the YYYYMMDD string :)\n" + " declare function functx:yyyymmdd-to-date ( $dateString as xs:string? ) as xs:date? { if (empty($dateString)) then () else if (not(matches($dateString, '^\\D*(\\d{4})\\D*(\\d{2})\\D*(\\d{2})\\D*$'))) then error(xs:QName('functx:Invalid_Date_Format')) else xs:date(replace($dateString, '^\\D*(\\d{4})\\D*(\\d{2})\\D*(\\d{2})\\D*$', '$1-$2-$3')) } ;\n" + " (functx:yyyymmdd-to-date('2004-12-15'), functx:yyyymmdd-to-date('20041215'), functx:yyyymmdd-to-date('2004/12/15'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-12-15 2004-12-15 2004-12-15") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/app/AppUseCaseNS.java000066400000000000000000000270251222453003200273640ustar00rootroot00000000000000package org.basex.test.qt3ts.app; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the UseCaseNS. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class AppUseCaseNS extends QT3TestSet { /** . */ @org.junit.Test public void nsQueriesResultsQ1() { final XQuery query = new XQuery( "\n" + " { for $n in distinct-values( for $i in (//* | //@*) return namespace-uri($i) ) return {$n} } ", ctx); try { query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("http://www.example.com/AuctionWatchhttp://www.example.com/auctioneers#anyzonehttp://www.w3.org/1999/xlinkhttp://www.w3.org/2001/XMLSchemahttp://www.example.com/auctioneers#eachbayhttp://www.example.org/music/recordshttp://www.example.com/auctioneers#yabadoohttp://www.w3.org/XML/1998/namespace", false) ); } /** . */ @org.junit.Test public void nsQueriesResultsQ2() { final XQuery query = new XQuery( "\n" + " declare namespace music = \"http://www.example.org/music/records\"; \n" + " { //music:title } \n" + " ", ctx); try { query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("In a Silent WayThink of One ...", false) ); } /** . */ @org.junit.Test public void nsQueriesResultsQ3() { final XQuery query = new XQuery( "\n" + " declare namespace dt = \"http://www.w3.org/2001/XMLSchema\"; \n" + " { //*[@dt:*] } ", ctx); try { query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("2000-03-21:07:41:34-05:002000-03-23:07:41:34-05:002000-03-19:17:03:00-04:002000-03-29:17:03:00-04:00", false) ); } /** . */ @org.junit.Test public void nsQueriesResultsQ4() { final XQuery query = new XQuery( "\n" + " declare namespace xlink = \"http://www.w3.org/1999/xlink\"; \n" + " { for $hr in //@xlink:href return { $hr } } \n" + " ", ctx); try { query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** . */ @org.junit.Test public void nsQueriesResultsQ5() { final XQuery query = new XQuery( "\n" + " declare namespace music = \"http://www.example.org/music/records\"; \n" + " { //music:record[music:remark/@xml:lang = \"de\"] } \n" + " ", ctx); try { query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n Wynton Marsalis\n Think of One ...\n 1983\n \n Columbia Records 12\" 33-1/3 rpm LP,\n #FC-38641, Stereo. The record is still clean and shiny\n and looks unplayed (looks like NM condition). The\n cover has very light surface and edge wear.\n \n Columbia Records 12\" 33-1/3 rpm LP,\n #FC-38641, Stereo. Die Platte ist noch immer sauber\n und glänzend und sieht ungespielt aus\n (NM Zustand). Das Cover hat leichte Abnutzungen an\n Oberfläche und Ecken.\n \n ", false) ); } /** . */ @org.junit.Test public void nsQueriesResultsQ6() { final XQuery query = new XQuery( "\n" + " declare namespace ma = \"http://www.example.com/AuctionWatch\"; \n" + " declare namespace anyzone = \"http://www.example.com/auctioneers#anyzone\"; \n" + " { //ma:Auction[@anyzone:ID]/ma:Schedule/ma:Close } \n" + " ", ctx); try { query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("2000-03-23:07:41:34-05:00", false) ); } /** . */ @org.junit.Test public void nsQueriesResultsQ7() { final XQuery query = new XQuery( "\n" + " declare namespace ma = \"http://www.example.com/AuctionWatch\"; \n" + " { \n" + " for $a in //ma:Auction \n" + " let $seller_id := $a/ma:Trading_Partners/ma:Seller/*:ID, \n" + " $buyer_id := $a/ma:Trading_Partners/ma:High_Bidder/*:ID \n" + " where namespace-uri(exactly-one($seller_id)) = namespace-uri($buyer_id) \n" + " return $a/ma:AuctionHomepage } \n" + " ", ctx); try { query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** . */ @org.junit.Test public void nsQueriesResultsQ8() { final XQuery query = new XQuery( "\n" + " declare namespace ma = \"http://www.example.com/AuctionWatch\"; \n" + " { \n" + " for $s in //ma:Trading_Partners/(ma:Seller | ma:High_Bidder) \n" + " where $s/*:NegativeComments = 0 \n" + " return $s } \n" + " ", ctx); try { query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n VintageRecordFreak\n 232\n 0\n 0\n \n ", false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/app/AppUseCasePARTS.java000066400000000000000000000033201222453003200277250ustar00rootroot00000000000000package org.basex.test.qt3ts.app; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the UseCasePARTS. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class AppUseCasePARTS extends QT3TestSet { /** . */ @org.junit.Test public void partsQueriesResultsQ1() { final XQuery query = new XQuery( "\n" + " declare variable $input-context := .;\n" + " declare function local:one_level($p as element()) as element() { \n" + " { \n" + " for $s in ($input-context//part)\n" + " where $s/@partof = $p/@partid \n" + " return local:one_level($s) } }; \n" + " { for $p in //part[empty(@partof)] \n" + " return local:one_level($p) } \n" + " ", ctx); try { query.context(node(file("docs/partlist.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("", false) || error("XPTY0004") ) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/app/AppUseCaseR.java000066400000000000000000000577231222453003200272550ustar00rootroot00000000000000package org.basex.test.qt3ts.app; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the UseCaseR. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class AppUseCaseR extends QT3TestSet { /** . */ @org.junit.Test public void rdbQueriesResultsQ1() { final XQuery query = new XQuery( "\n" + " { \n" + " for $i in $items//item_tuple \n" + " where $i/start_date <= xs:date(\"1999-01-31\") \n" + " and $i/end_date >= xs:date(\"1999-01-31\") \n" + " and contains(exactly-one($i/description), \"Bicycle\") \n" + " order by $i/itemno \n" + " return { $i/itemno } { $i/description } } \n" + " \n" + " ", ctx); try { query.bind("$users", node(file("docs/users.xml"))); query.bind("$items", node(file("docs/items.xml"))); query.bind("$bids", node(file("docs/bids.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1003Old Bicycle1007Racing Bicycle", false) ); } /** . */ @org.junit.Test public void rdbQueriesResultsQ10() { final XQuery query = new XQuery( "\n" + " { \n" + " for $highbid in $bids//bid_tuple, \n" + " $user in $users//user_tuple \n" + " where $user/userid = $highbid/userid and $highbid/bid = max($bids//bid_tuple[itemno=$highbid/itemno]/bid) \n" + " order by exactly-one($highbid/itemno) \n" + " return { $highbid/itemno } { $highbid/bid } \n" + " { $user/name/text() } \n" + " \n" + " } \n" + " ", ctx); try { query.bind("$users", node(file("docs/users.xml"))); query.bind("$items", node(file("docs/items.xml"))); query.bind("$bids", node(file("docs/bids.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("100155Mary Doe10021200Mary Doe100320Jack Sprat100440Tom Jones1007225Roger Smith", false) ); } /** . */ @org.junit.Test public void rdbQueriesResultsQ11() { final XQuery query = new XQuery( "\n" + " let $highbid := max($bids//bid_tuple/bid) \n" + " return { for $item in $items//item_tuple, \n" + " $b in $bids//bid_tuple[itemno = $item/itemno] \n" + " where $b/bid = $highbid \n" + " return { $item/itemno } { $item/description } \n" + " { $highbid } \n" + " \n" + " } \n" + " ", ctx); try { query.bind("$users", node(file("docs/users.xml"))); query.bind("$items", node(file("docs/items.xml"))); query.bind("$bids", node(file("docs/bids.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1002Motorcycle1200", false) ); } /** . */ @org.junit.Test public void rdbQueriesResultsQ12() { final XQuery query = new XQuery( "\n" + " declare function local:bid_summary() as element()* { \n" + " for $i in distinct-values($bids//itemno) \n" + " let $b := $bids//bid_tuple[itemno = $i] \n" + " return \n" + " { $i } \n" + " { count($b) } \n" + " };\n" + " { \n" + " let $bid_counts := local:bid_summary(), \n" + " $maxbids := max($bid_counts/nbids), \n" + " $maxitemnos := $bid_counts[nbids = $maxbids] \n" + " for $item in $items//item_tuple, \n" + " $bc in $bid_counts \n" + " where $bc/nbids = $maxbids and $item/itemno = $bc/itemno \n" + " return { $item/itemno } { $item/description } \n" + " { $bc/nbids/text() } \n" + " \n" + " } \n" + " ", ctx); try { query.bind("$users", node(file("docs/users.xml"))); query.bind("$items", node(file("docs/items.xml"))); query.bind("$bids", node(file("docs/bids.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1001Red Bicycle51002Motorcycle5", false) ); } /** . */ @org.junit.Test public void rdbQueriesResultsQ13() { final XQuery query = new XQuery( "\n" + " { \n" + " for $uid in distinct-values($bids//userid), \n" + " $u in $users//user_tuple[userid = $uid] \n" + " let $b := $bids//bid_tuple[userid = $uid] \n" + " order by exactly-one($u/userid) \n" + " return { $u/userid } { $u/name } { count($b) } { avg($b/bid) } \n" + " } \n" + " ", ctx); try { query.bind("$users", node(file("docs/users.xml"))); query.bind("$items", node(file("docs/items.xml"))); query.bind("$bids", node(file("docs/bids.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("U01Tom Jones2220U02Mary Doe5387U03Dee Linquent2487.5U04Roger Smith5266U05Jack Sprat2110", false) ); } /** . */ @org.junit.Test public void rdbQueriesResultsQ14() { final XQuery query = new XQuery( "\n" + " { \n" + " for $i in distinct-values($items//itemno) \n" + " let $b := $bids//bid_tuple[itemno = $i] \n" + " let $avgbid := avg($b/bid) \n" + " where count($b) >= 3 \n" + " order by $avgbid descending \n" + " return { $i } { $avgbid } \n" + " } \n" + " ", ctx); try { query.bind("$users", node(file("docs/users.xml"))); query.bind("$items", node(file("docs/items.xml"))); query.bind("$bids", node(file("docs/bids.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("10028001007200100145", false) ); } /** . */ @org.junit.Test public void rdbQueriesResultsQ15() { final XQuery query = new XQuery( "\n" + " { \n" + " for $u in $users//user_tuple \n" + " let $b := $bids//bid_tuple[userid=$u/userid and bid>=100] \n" + " where count($b) > 1 \n" + " return { $u/name/text() } \n" + " } \n" + " ", ctx); try { query.bind("$users", node(file("docs/users.xml"))); query.bind("$items", node(file("docs/items.xml"))); query.bind("$bids", node(file("docs/bids.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Mary DoeDee LinquentRoger Smith", false) ); } /** . */ @org.junit.Test public void rdbQueriesResultsQ16() { final XQuery query = new XQuery( "\n" + " { \n" + " for $u in $users//user_tuple \n" + " let $b := $bids//bid_tuple[userid = $u/userid] \n" + " order by exactly-one($u/userid) \n" + " return { $u/userid } { $u/name } { \n" + " if (empty($b)) \n" + " then inactive \n" + " else active } \n" + " } ", ctx); try { query.bind("$users", node(file("docs/users.xml"))); query.bind("$items", node(file("docs/items.xml"))); query.bind("$bids", node(file("docs/bids.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("U01Tom JonesactiveU02Mary DoeactiveU03Dee LinquentactiveU04Roger SmithactiveU05Jack SpratactiveU06Rip Van Winkleinactive", false) ); } /** . */ @org.junit.Test public void rdbQueriesResultsQ17() { final XQuery query = new XQuery( "\n" + " { \n" + " for $u in $users//user_tuple \n" + " where every $item in $items//item_tuple \n" + " satisfies some $b in $bids//bid_tuple \n" + " satisfies ($item/itemno = $b/itemno and $u/userid = $b/userid) \n" + " return $u/name \n" + " } \n" + " ", ctx); try { query.bind("$users", node(file("docs/users.xml"))); query.bind("$items", node(file("docs/items.xml"))); query.bind("$bids", node(file("docs/bids.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** . */ @org.junit.Test public void rdbQueriesResultsQ18() { final XQuery query = new XQuery( "\n" + " { \n" + " for $u in $users//user_tuple \n" + " order by $u/name \n" + " return { $u/name } { \n" + " for $b in distinct-values($bids//bid_tuple [userid = $u/userid]/itemno) \n" + " for $i in $items//item_tuple[itemno = $b] \n" + " let $descr := $i/description/text() \n" + " order by exactly-one($descr) \n" + " return { $descr } } \n" + " } \n" + " ", ctx); try { query.bind("$users", node(file("docs/users.xml"))); query.bind("$items", node(file("docs/items.xml"))); query.bind("$bids", node(file("docs/bids.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Dee LinquentMotorcycleRacing BicycleJack SpratOld BicycleRacing BicycleMary DoeMotorcycleRed BicycleRip Van WinkleRoger SmithMotorcycleOld BicycleRacing BicycleRed BicycleTom JonesMotorcycleTricycle", false) ); } /** . */ @org.junit.Test public void rdbQueriesResultsQ2() { final XQuery query = new XQuery( "\n" + " { \n" + " for $i in $items//item_tuple \n" + " let $b := $bids//bid_tuple[itemno = $i/itemno] \n" + " where contains(exactly-one($i/description), \"Bicycle\") \n" + " order by $i/itemno \n" + " return { $i/itemno } { $i/description } { max($b/bid) } } \n" + " \n" + " ", ctx); try { query.bind("$users", node(file("docs/users.xml"))); query.bind("$items", node(file("docs/items.xml"))); query.bind("$bids", node(file("docs/bids.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1001Red Bicycle551003Old Bicycle201007Racing Bicycle2251008Broken Bicycle", false) ); } /** . */ @org.junit.Test public void rdbQueriesResultsQ3() { final XQuery query = new XQuery( "\n" + " { \n" + " for $u in $users//user_tuple \n" + " for $i in $items//item_tuple \n" + " where $u/rating > \"C\" and $i/reserve_price > 1000 and $i/offered_by = $u/userid \n" + " return { $u/name } { $u/rating } { $i/description } { $i/reserve_price } } \n" + " \n" + " ", ctx); try { query.bind("$users", node(file("docs/users.xml"))); query.bind("$items", node(file("docs/items.xml"))); query.bind("$bids", node(file("docs/bids.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Dee LinquentDHelicopter50000", false) ); } /** . */ @org.junit.Test public void rdbQueriesResultsQ4() { final XQuery query = new XQuery( "\n" + " { \n" + " for $i in $items//item_tuple \n" + " where empty ($bids//bid_tuple[itemno = $i/itemno]) \n" + " return { $i/itemno } { $i/description } \n" + " } \n" + " ", ctx); try { query.bind("$users", node(file("docs/users.xml"))); query.bind("$items", node(file("docs/items.xml"))); query.bind("$bids", node(file("docs/bids.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1005Tennis Racket1006Helicopter1008Broken Bicycle", false) ); } /** . */ @org.junit.Test public void rdbQueriesResultsQ5() { final XQuery query = new XQuery( "\n" + " { \n" + " unordered ( \n" + " for $seller in $users//user_tuple, \n" + " $buyer in $users//user_tuple, \n" + " $item in $items//item_tuple, \n" + " $highbid in $bids//bid_tuple \n" + " where $seller/name = \"Tom Jones\" \n" + " and $seller/userid = $item/offered_by \n" + " and contains(exactly-one($item/description), \"Bicycle\") \n" + " and $item/itemno = $highbid/itemno \n" + " and $highbid/userid = $buyer/userid \n" + " and $highbid/bid = max( $bids//bid_tuple [itemno = $item/itemno]/bid ) \n" + " return { $item/itemno } { $item/description } \n" + " { $highbid/bid } \n" + " { $buyer/name } \n" + " ) \n" + " } \n" + " ", ctx); try { query.bind("$users", node(file("docs/users.xml"))); query.bind("$items", node(file("docs/items.xml"))); query.bind("$bids", node(file("docs/bids.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1001Red Bicycle55Mary Doe", false) ); } /** . */ @org.junit.Test public void rdbQueriesResultsQ6() { final XQuery query = new XQuery( "\n" + " { \n" + " for $item in $items//item_tuple \n" + " let $b := $bids//bid_tuple[itemno = $item/itemno] \n" + " let $z := max($b/bid) \n" + " where exactly-one($item/reserve_price) * 2 < $z \n" + " return { $item/itemno } { $item/description } { $item/reserve_price } \n" + " {$z } \n" + " \n" + " } \n" + " ", ctx); try { query.bind("$users", node(file("docs/users.xml"))); query.bind("$items", node(file("docs/items.xml"))); query.bind("$bids", node(file("docs/bids.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1002Motorcycle50012001004Tricycle1540", false) ); } /** . */ @org.junit.Test public void rdbQueriesResultsQ7() { final XQuery query = new XQuery( "\n" + " let $allbikes := $items//item_tuple [contains(exactly-one(description), \"Bicycle\") or contains(exactly-one(description), \"Tricycle\")] \n" + " let $bikebids := $bids//bid_tuple[itemno = $allbikes/itemno] \n" + " return { max($bikebids/bid) } \n" + " ", ctx); try { query.bind("$users", node(file("docs/users.xml"))); query.bind("$items", node(file("docs/items.xml"))); query.bind("$bids", node(file("docs/bids.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("225", false) ); } /** . */ @org.junit.Test public void rdbQueriesResultsQ8() { final XQuery query = new XQuery( "\n" + " let $item := $items//item_tuple [end_date >= xs:date(\"1999-03-01\") and end_date <= xs:date(\"1999-03-31\")] \n" + " return { count($item) } \n" + " ", ctx); try { query.bind("$users", node(file("docs/users.xml"))); query.bind("$items", node(file("docs/items.xml"))); query.bind("$bids", node(file("docs/bids.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("3", false) ); } /** . */ @org.junit.Test public void rdbQueriesResultsQ9() { final XQuery query = new XQuery( "\n" + " { \n" + " let $end_dates := $items//item_tuple/end_date \n" + " for $m in distinct-values(\n" + " for $e in $end_dates \n" + " return month-from-date($e)) \n" + " let $item := $items//item_tuple[year-from-date(exactly-one(end_date)) = 1999 and month-from-date(exactly-one(end_date)) = $m] \n" + " order by $m \n" + " return \n" + " { $m } \n" + " { count($item) }\n" + " \n" + " } \n" + " ", ctx); try { query.bind("$users", node(file("docs/users.xml"))); query.bind("$items", node(file("docs/items.xml"))); query.bind("$bids", node(file("docs/bids.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1122334151", false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/app/AppUseCaseSEQ.java000066400000000000000000000065421222453003200274750ustar00rootroot00000000000000package org.basex.test.qt3ts.app; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the UseCaseSEQ. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class AppUseCaseSEQ extends QT3TestSet { /** . */ @org.junit.Test public void seqQueriesResultsQ1() { final XQuery query = new XQuery( "for $s in //section[section.title = \"Procedure\"] return ($s//incision)[2]/instrument", ctx); try { query.context(node(file("docs/report1.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("electrocautery", false) ); } /** . */ @org.junit.Test public void seqQueriesResultsQ2() { final XQuery query = new XQuery( "for $s in //section[section.title = \"Procedure\"] return ($s//instrument)[position()<=2]", ctx); try { query.context(node(file("docs/report1.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("using electrocautery.electrocautery", false) ); } /** . */ @org.junit.Test public void seqQueriesResultsQ3() { final XQuery query = new XQuery( "let $i2 := (//incision)[2] for $a in (//action)[. >> $i2][position()<=2] return $a//instrument", ctx); try { query.context(node(file("docs/report1.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Hasson trocartrocar", false) ); } /** . */ @org.junit.Test public void seqQueriesResultsQ4() { final XQuery query = new XQuery( "for $p in //section[section.title = \"Procedure\"] where not(some $a in $p//anesthesia satisfies $a << ($p//incision)[1] ) return $p", ctx); try { query.context(node(file("docs/report1.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** . */ @org.junit.Test public void seqQueriesResultsQ5() { final XQuery query = new XQuery( " { let $proc := //section[section.title=\"Procedure\"][1], $i1 := ($proc//incision)[1], $i2 := ($proc//incision)[2] for $n in $proc//node() except $i1//node() where $n >> $i1 and $n << $i2 return $n } ", ctx); try { query.context(node(file("docs/report1.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n The fascia was identified and\n #2 0 Maxon stay sutures were placed on each side of the midline.\n #2 0 Maxon stay sutures were placed on each side of the midline.\n \n ", false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/app/AppUseCaseSGML.java000066400000000000000000000404201222453003200276000ustar00rootroot00000000000000package org.basex.test.qt3ts.app; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the UseCaseSGML. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class AppUseCaseSGML extends QT3TestSet { /** . */ @org.junit.Test public void sgmlQueriesResultsQ1() { final XQuery query = new XQuery( " { //report//para } ", ctx); try { query.context(node(file("docs/sgml.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("With the ever-changing and growing global market, companies and\n large organizations are searching for ways to become more viable and\n competitive. Downsizing and other cost-cutting measures demand more\n efficient use of corporate resources. One very important resource is\n an organization's information.As part of the move toward integrated information management,\n whole industries are developing and implementing standards for\n exchanging technical information. This report describes how one such\n standard, the Standard Generalized Markup Language (SGML), works as\n part of an overall information management strategy.While SGML is a fairly recent technology, the use of\n markup in computer-generated documents has existed for a\n while.Markup is everything in a document that is not content. The\n traditional meaning of markup is the manual marking up\n of typewritten text to give instructions for a typesetter or\n compositor about how to fit the text on a page and what typefaces to\n use. This kind of markup is known as procedural markup.Most electronic publishing systems today use some form of\n procedural markup. Procedural markup codes are good for one\n presentation of the information.Generic markup (also known as descriptive markup) describes the\n purpose of the text in a document. A basic concept of\n generic markup is that the content of a document must be separate from\n the style. Generic markup allows for multiple presentations of the\n information.Industries involved in technical documentation increasingly\n prefer generic over procedural markup schemes. When a company changes\n software or hardware systems, enormous data translation tasks arise,\n often resulting in errors.SGML defines a strict markup scheme with a syntax for defining\n document data elements and an overall framework for marking up\n documents.SGML can describe and create documents that are not dependent on\n any hardware, software, formatter, or operating system. Since SGML documents\n conform to an international standard, they are portable.You can break a typical document into three layers: structure,\n content, and style. SGML works by separating these three aspects and\n deals mainly with the relationship between structure and content.At the heart of an SGML application is a file called the DTD, or\n Document Type Definition. The DTD sets up the structure of a document,\n much like a database schema describes the types of information it\n handles.A database schema also defines the relationships between the\n various types of data. Similarly, a DTD specifies rules\n to help ensure documents have a consistent, logical structure.Content is the information itself. The method for identifying\n the information and its meaning within this framework is called\n tagging. Tagging must\n conform to the rules established in the DTD (see ).SGML does not standardize style or other processing methods for\n information stored in SGML.The Graphic Communications Association has been\n instrumental in the development of SGML. GCA provides conferences,\n tutorials, newsletters, and publication sales for both members and\n non-members.Exiled members of the former Soviet Union's secret\n police, the KGB, have infiltrated the upper ranks of the GCA and are\n planning the Final Revolution as soon as DSSSL is completed.", false) ); } /** . */ @org.junit.Test public void sgmlQueriesResultsQ10() { final XQuery query = new XQuery( " { let $x := //xref[@xrefid = \"top4\"], $t := //title[. << exactly-one($x)] return $t[last()] } ", ctx); try { query.context(node(file("docs/sgml.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Content", false) ); } /** . */ @org.junit.Test public void sgmlQueriesResultsQ2() { final XQuery query = new XQuery( " { //intro/para } ", ctx); try { query.context(node(file("docs/sgml.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("With the ever-changing and growing global market, companies and\n large organizations are searching for ways to become more viable and\n competitive. Downsizing and other cost-cutting measures demand more\n efficient use of corporate resources. One very important resource is\n an organization's information.As part of the move toward integrated information management,\n whole industries are developing and implementing standards for\n exchanging technical information. This report describes how one such\n standard, the Standard Generalized Markup Language (SGML), works as\n part of an overall information management strategy.While SGML is a fairly recent technology, the use of\n markup in computer-generated documents has existed for a\n while.Markup is everything in a document that is not content. The\n traditional meaning of markup is the manual marking up\n of typewritten text to give instructions for a typesetter or\n compositor about how to fit the text on a page and what typefaces to\n use. This kind of markup is known as procedural markup.SGML defines a strict markup scheme with a syntax for defining\n document data elements and an overall framework for marking up\n documents.SGML can describe and create documents that are not dependent on\n any hardware, software, formatter, or operating system. Since SGML documents\n conform to an international standard, they are portable.You can break a typical document into three layers: structure,\n content, and style. SGML works by separating these three aspects and\n deals mainly with the relationship between structure and content.The Graphic Communications Association has been\n instrumental in the development of SGML. GCA provides conferences,\n tutorials, newsletters, and publication sales for both members and\n non-members.Exiled members of the former Soviet Union's secret\n police, the KGB, have infiltrated the upper ranks of the GCA and are\n planning the Final Revolution as soon as DSSSL is completed.", false) ); } /** . */ @org.junit.Test public void sgmlQueriesResultsQ3() { final XQuery query = new XQuery( " { for $c in //chapter where empty($c/intro) return $c/section/intro/para } ", ctx); try { query.context(node(file("docs/sgml.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("The Graphic Communications Association has been\n instrumental in the development of SGML. GCA provides conferences,\n tutorials, newsletters, and publication sales for both members and\n non-members.Exiled members of the former Soviet Union's secret\n police, the KGB, have infiltrated the upper ranks of the GCA and are\n planning the Final Revolution as soon as DSSSL is completed.", false) ); } /** . */ @org.junit.Test public void sgmlQueriesResultsQ4() { final XQuery query = new XQuery( " { (((//chapter)[2]//section)[3]//para)[2] } ", ctx); try { query.context(node(file("docs/sgml.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("At the heart of an SGML application is a file called the DTD, or\n Document Type Definition. The DTD sets up the structure of a document,\n much like a database schema describes the types of information it\n handles.", false) ); } /** . */ @org.junit.Test public void sgmlQueriesResultsQ5() { final XQuery query = new XQuery( " { //para[@security = \"c\"] } ", ctx); try { query.context(node(file("docs/sgml.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Exiled members of the former Soviet Union's secret\n police, the KGB, have infiltrated the upper ranks of the GCA and are\n planning the Final Revolution as soon as DSSSL is completed.", false) ); } /** . */ @org.junit.Test public void sgmlQueriesResultsQ6() { final XQuery query = new XQuery( " { for $s in //section/@shorttitle return { $s } } ", ctx); try { query.context(node(file("docs/sgml.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** . */ @org.junit.Test public void sgmlQueriesResultsQ7() { final XQuery query = new XQuery( " { for $i in //intro/para[1] return { substring(string($i), 1, 1) } } ", ctx); try { query.context(node(file("docs/sgml.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("WWMSYT", false) ); } /** . */ @org.junit.Test public void sgmlQueriesResultsQ8a() { final XQuery query = new XQuery( " { //section[.//title[contains(., \"is SGML\")]] } ", ctx); try { query.context(node(file("docs/sgml.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("
    \n What <emph>is</emph> SGML in the grand scheme of the universe, anyway?\n \n SGML defines a strict markup scheme with a syntax for defining\n document data elements and an overall framework for marking up\n documents.\n SGML can describe and create documents that are not dependent on\n any hardware, software, formatter, or operating system. Since SGML documents\n conform to an international standard, they are portable.
    \n How is SGML and would you recommend it to your grandmother?\n \n You can break a typical document into three layers: structure,\n content, and style. SGML works by separating these three aspects and\n deals mainly with the relationship between structure and content.\n \n Structure\n At the heart of an SGML application is a file called the DTD, or\n Document Type Definition. The DTD sets up the structure of a document,\n much like a database schema describes the types of information it\n handles.\n A database schema also defines the relationships between the\n various types of data. Similarly, a DTD specifies rules\n to help ensure documents have a consistent, logical structure.\n \n Content\n Content is the information itself. The method for identifying\n the information and its meaning within this framework is called\n tagging. Tagging must\n conform to the rules established in the DTD (see ).\n \n \n Style\n SGML does not standardize style or other processing methods for\n information stored in SGML.
    ", false) ); } /** . */ @org.junit.Test public void sgmlQueriesResultsQ8b() { final XQuery query = new XQuery( " { //section[.//title/text()[contains(., \"is SGML\")]] } ", ctx); try { query.context(node(file("docs/sgml.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("
    \n How is SGML and would you recommend it to your grandmother?\n \n You can break a typical document into three layers: structure,\n content, and style. SGML works by separating these three aspects and\n deals mainly with the relationship between structure and content.\n \n Structure\n At the heart of an SGML application is a file called the DTD, or\n Document Type Definition. The DTD sets up the structure of a document,\n much like a database schema describes the types of information it\n handles.\n A database schema also defines the relationships between the\n various types of data. Similarly, a DTD specifies rules\n to help ensure documents have a consistent, logical structure.\n \n Content\n Content is the information itself. The method for identifying\n the information and its meaning within this framework is called\n tagging. Tagging must\n conform to the rules established in the DTD (see ).\n \n \n Style\n SGML does not standardize style or other processing methods for\n information stored in SGML.
    ", false) || error("XPST0005") ) ); } /** . */ @org.junit.Test public void sgmlQueriesResultsQ9() { final XQuery query = new XQuery( " { for $id in //xref/@xrefid return //topic[@topicid = $id] } ", ctx); try { query.context(node(file("docs/sgml.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n Structure\n At the heart of an SGML application is a file called the DTD, or\n Document Type Definition. The DTD sets up the structure of a document,\n much like a database schema describes the types of information it\n handles.\n A database schema also defines the relationships between the\n various types of data. Similarly, a DTD specifies rules\n to help ensure documents have a consistent, logical structure.", false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/app/AppUseCaseSTRING.java000066400000000000000000000200651222453003200300470ustar00rootroot00000000000000package org.basex.test.qt3ts.app; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the UseCaseSTRING. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class AppUseCaseSTRING extends QT3TestSet { /** . */ @org.junit.Test public void stringQueriesResultsQ1() { final XQuery query = new XQuery( "//news_item/title[contains(., \"Foobar Corporation\")]", ctx); try { query.context(node(file("docs/string.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Foobar Corporation releases its new line of Foo products\r\n todayFoobar Corporation is suing Gorilla Corporation for\r\n patent infringement ", false) ); } /** . */ @org.junit.Test public void stringQueriesResultsQ2() { final XQuery query = new XQuery( "\n" + " declare variable $input-context1 := $string;\n" + " declare variable $input-context2 := $company-data;\n" + "\n" + " declare function local:partners($company as xs:string) as element()*\n" + " {\n" + " let $c := $input-context2//company[name = $company]\n" + " return $c//partner\n" + " };\n" + "\n" + " let $foobar_partners := local:partners(\"Foobar Corporation\")\n" + "\n" + " for $item in $input-context1//news_item\n" + " where\n" + " some $t in $item//title satisfies\n" + " (contains(exactly-one($t/text()), \"Foobar Corporation\")\n" + " and (some $partner in $foobar_partners satisfies\n" + " contains(exactly-one($t/text()), $partner/text())))\n" + " or (some $par in $item//par satisfies\n" + " (contains(string($par), \"Foobar Corporation\")\n" + " and (some $partner in $foobar_partners satisfies\n" + " contains(string($par), $partner/text()))))\n" + " return\n" + " \n" + " { $item/title }\n" + " { $item/date }\n" + " \n" + " ", ctx); try { query.bind("$string", node(file("docs/string.xml"))); query.bind("$company-data", node(file("docs/company-data.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" Gorilla Corporation acquires YouNameItWeIntegrateIt.com 1-20-2000Foobar Corporation releases its new line of Foo products\r\n today1-20-2000Foobar Corporation is suing Gorilla Corporation for\r\n patent infringement 1-20-2000", false) ); } /** . */ @org.junit.Test public void stringQueriesResultsQ4() { final XQuery query = new XQuery( "\n" + " declare function local:partners($c as xs:string) as element()* { \n" + " let $c := $company-data//company[name = $c] \n" + " return $c//partner \n" + " }; \n" + " for $item in $string//news_item, \n" + " $c in $company-data//company \n" + " let $partners := local:partners(exactly-one($c/name)) \n" + " where contains(string($item), $c/name) \n" + " and (some $p in $partners satisfies contains(string($item), $p) and $item/news_agent != $c/name) \n" + " return $item", ctx); try { query.bind("$string", node(file("docs/string.xml"))); query.bind("$company-data", node(file("docs/company-data.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\r\n Gorilla Corporation acquires YouNameItWeIntegrateIt.com \r\n \r\n Today, Gorilla Corporation announced that it will purchase\r\n YouNameItWeIntegrateIt.com. The shares of\r\n YouNameItWeIntegrateIt.com dropped $3.00 as a result of this\r\n announcement.\r\n \r\n\r\n As a result of this acquisition, the CEO of\r\n YouNameItWeIntegrateIt.com Bill Smarts resigned. He did not\r\n announce what he will do next. Sources close to\r\n YouNameItWeIntegrateIt.com hint that Bill Smarts might be\r\n taking a position in Foobar Corporation.\r\n \r\n\r\n YouNameItWeIntegrateIt.com is a leading systems integrator\r\n that enables brick and mortar companies to\r\n have a presence on the web.\r\n \r\n\r\n \r\n 1-20-2000\r\n Mark Davis\r\n News Online\r\n Foobar Corporation is suing Gorilla Corporation for\r\n patent infringement \r\n \r\n In surprising developments today, Foobar Corporation\r\n announced that it is suing Gorilla Corporation for patent\r\n infringement. The patents that were mentioned as part of the\r\n lawsuit are considered to be the basis of Foobar\r\n Corporation's Wireless Foo line of products.\r\n \r\n The tension between Foobar and Gorilla Corporations has\r\n been increasing ever since the Gorilla Corporation acquired\r\n more than 40 engineers who have left Foobar Corporation,\r\n TheAppCompany Inc. and YouNameItWeIntegrateIt.com over the\r\n past 3 months. The engineers who have left the Foobar\r\n corporation and its partners were rumored to be working on\r\n the next generation of server products and applications which\r\n will directly compete with Foobar's Foo 20.9 servers. Most of\r\n the engineers have relocated to Hawaii where the Gorilla\r\n Corporation's server development is located.\r\n \r\n \r\n 1-20-2000\r\n Reliable News Corporation\r\n", false) ); } /** . */ @org.junit.Test public void stringQueriesResultsQ5() { final XQuery query = new XQuery( "\n" + " for $item in //news_item \n" + " where contains(string(exactly-one($item/content)), \"Gorilla Corporation\") \n" + " return { concat($item/title,\". \") } \n" + " { concat($item/date,\". \") } \n" + " { string(($item//par)[1]) } \n" + " \n" + " ", ctx); try { query.context(node(file("docs/string.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" Gorilla Corporation acquires YouNameItWeIntegrateIt.com . 1-20-2000. Today, Gorilla Corporation announced that it will purchase\r\n YouNameItWeIntegrateIt.com. The shares of\r\n YouNameItWeIntegrateIt.com dropped $3.00 as a result of this\r\n announcement.\r\n Foobar Corporation is suing Gorilla Corporation for\r\n patent infringement . 1-20-2000. In surprising developments today, Foobar Corporation\r\n announced that it is suing Gorilla Corporation for patent\r\n infringement. The patents that were mentioned as part of the\r\n lawsuit are considered to be the basis of Foobar\r\n Corporation's Wireless Foo line of products.\r\n ", false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/app/AppUseCaseTREE.java000066400000000000000000000134761222453003200276100ustar00rootroot00000000000000package org.basex.test.qt3ts.app; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the UseCaseTREE. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class AppUseCaseTREE extends QT3TestSet { /** . */ @org.junit.Test public void treeQueriesResultsQ1() { final XQuery query = new XQuery( "\n" + " declare function local:toc($book-or-section as element()) as element()* { \n" + " for $section in $book-or-section/section \n" + " return
    { $section/@* , $section/title , local:toc($section) }
    };\n" + " { for $s in /book return local:toc($s) } \n" + " ", ctx); try { query.context(node(file("docs/book.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("
    Introduction
    Audience
    Web Data and the Two Cultures
    A Syntax For Data
    Base Types
    Representing Relational Databases
    Representing Object Databases
    ", false) ); } /** . */ @org.junit.Test public void treeQueriesResultsQ2() { final XQuery query = new XQuery( " { for $f in //figure return
    { $f/@* } { $f/title }
    }
    ", ctx); try { query.context(node(file("docs/book.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("
    Traditional client/server architecture
    Graph representations of structures
    Examples of Relations
    ", false) ); } /** . */ @org.junit.Test public void treeQueriesResultsQ3() { final XQuery query = new XQuery( "{ count(//section) }, { count(//figure) }", ctx); try { query.context(node(file("docs/book.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("73", false) ); } /** . */ @org.junit.Test public void treeQueriesResultsQ4() { final XQuery query = new XQuery( " { count(/book/section) } ", ctx); try { query.context(node(file("docs/book.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("2", false) ); } /** . */ @org.junit.Test public void treeQueriesResultsQ5() { final XQuery query = new XQuery( " { for $s in //section let $f := $s/figure return
    } ", ctx); try { query.context(node(file("docs/book.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("
    ", false) ); } /** . */ @org.junit.Test public void treeQueriesResultsQ6() { final XQuery query = new XQuery( "\n" + " declare function local:section-summary($book-or-section as element()*) as element()* { \n" + " for $section in $book-or-section \n" + " return
    { $section/@* } { $section/title } { count($section/figure) } { local:section-summary($section/section) }
    \n" + " }; \n" + " { \n" + " for $s in /book/section \n" + " return local:section-summary($s) \n" + " } \n" + " ", ctx); try { query.context(node(file("docs/book.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("
    Introduction0
    Audience0
    Web Data and the Two Cultures1
    A Syntax For Data1
    Base Types0
    Representing Relational Databases1
    Representing Object Databases0
    ", false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/app/AppUseCaseXMP.java000066400000000000000000000324131222453003200275050ustar00rootroot00000000000000package org.basex.test.qt3ts.app; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the UseCaseXMP. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class AppUseCaseXMP extends QT3TestSet { /** . */ @org.junit.Test public void xmpQueriesResultsQ1() { final XQuery query = new XQuery( "\n" + " \t { \n" + " \t\tfor $b in /bib/book \n" + " \t\twhere $b/publisher = \"Addison-Wesley\" and $b/@year > 1991 \n" + " \t\treturn { $b/title } } \n" + " \t", ctx); try { query.context(node(file("docs/bib.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("TCP/IP IllustratedAdvanced Programming in the Unix environment", false) ); } /** . */ @org.junit.Test public void xmpQueriesResultsQ10() { final XQuery query = new XQuery( "\n" + " \t { \n" + " \t\tlet $doc := (/) \n" + " \t\tfor $t in distinct-values($doc//book/title) \n" + " \t\tlet $p := $doc//book[title = $t]/price \n" + " \t\treturn { min($p) } } \n" + " \t\n" + " ", ctx); try { query.context(node(file("docs/prices.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("65.9565.9534.95", false) ); } /** . */ @org.junit.Test public void xmpQueriesResultsQ11() { final XQuery query = new XQuery( "\n" + " \t { \n" + " \t\tfor $b in //book[author] \n" + " \t\treturn \n" + " \t\t\t{ $b/title } { $b/author } } \n" + " \t\t\t{ for $b in //book[editor] \n" + " \t\t\t\treturn { $b/title } {$b/editor/affiliation} } \n" + " \t\n" + " ", ctx); try { query.context(node(file("docs/bib.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("TCP/IP IllustratedStevensW.Advanced Programming in the Unix environmentStevensW.Data on the WebAbiteboulSergeBunemanPeterSuciuDanThe Economics of Technology and Content for Digital TVCITI", false) ); } /** . */ @org.junit.Test public void xmpQueriesResultsQ12() { final XQuery query = new XQuery( "\n" + " \t { \n" + " \t\tfor $book1 in //book, $book2 in //book \n" + " \t\tlet $aut1 := \n" + " \t\t\tfor $a in $book1/author \n" + " \t\t\torder by exactly-one($a/last), exactly-one($a/first) \n" + " \t\t\treturn $a \n" + " \t\tlet $aut2 := \n" + " \t\t\tfor $a in $book2/author \n" + " \t\t\torder by exactly-one($a/last), exactly-one($a/first) \n" + " \t\t\treturn $a \n" + " \t\twhere $book1 << $book2 and not($book1/title = $book2/title) and deep-equal($aut1, $aut2) \n" + " \t\treturn { $book1/title } { $book2/title } } \n" + " \t\n" + " ", ctx); try { query.context(node(file("docs/bib.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("TCP/IP IllustratedAdvanced Programming in the Unix environment", false) ); } /** . */ @org.junit.Test public void xmpQueriesResultsQ2() { final XQuery query = new XQuery( "\n" + " \t { \n" + " \t\tfor $b in /bib/book, $t in $b/title, $a in $b/author \n" + " \t\treturn { $t } { $a } } \n" + " \t", ctx); try { query.context(node(file("docs/bib.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("TCP/IP IllustratedStevensW.Advanced Programming in the Unix environmentStevensW.Data on the WebAbiteboulSergeData on the WebBunemanPeterData on the WebSuciuDan", false) ); } /** . */ @org.junit.Test public void xmpQueriesResultsQ3() { final XQuery query = new XQuery( "\n" + " \t { \n" + " \t\tfor $b in /bib/book \n" + " \t\treturn { $b/title } { $b/author } } \n" + " \t\n" + " ", ctx); try { query.context(node(file("docs/bib.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("TCP/IP IllustratedStevensW.Advanced Programming in the Unix environmentStevensW.Data on the WebAbiteboulSergeBunemanPeterSuciuDanThe Economics of Technology and Content for Digital TV", false) ); } /** . */ @org.junit.Test public void xmpQueriesResultsQ4() { final XQuery query = new XQuery( "\n" + " \t { \n" + " \t\tlet $a := //author \n" + " \t\tfor $last in distinct-values($a/last), $first in distinct-values($a[last=$last]/first) \n" + " \t\torder by $last, $first \n" + " \t\treturn \n" + " \t\t\t\t { $last } { $first } \n" + " \t\t\t\t{ for $b in /bib/book \n" + " \t\t\t\t\twhere some $ba in $b/author satisfies ($ba/last = $last and $ba/first=$first) \n" + " \t\t\t\t\treturn $b/title } \n" + " \t\t\t } \n" + " \t\n" + " ", ctx); try { query.context(node(file("docs/bib.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("AbiteboulSergeData on the WebBunemanPeterData on the WebStevensW.TCP/IP IllustratedAdvanced Programming in the Unix environmentSuciuDanData on the Web", false) ); } /** . */ @org.junit.Test public void xmpQueriesResultsQ5() { final XQuery query = new XQuery( " { \n" + " for $b in $bib//book, $a in $reviews//entry \n" + " where $b/title = $a/title \n" + " return { $b/title } { $a/price/text() } { $b/price/text() } } \n" + " ", ctx); try { query.bind("$bib", node(file("docs/bib.xml"))); query.bind("$reviews", node(file("docs/reviews.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("TCP/IP Illustrated65.9565.95Advanced Programming in the Unix environment65.9565.95Data on the Web34.9539.95", false) ); } /** . */ @org.junit.Test public void xmpQueriesResultsQ6() { final XQuery query = new XQuery( "\n" + " \t { \n" + " \t\tfor $b in //book \n" + " \t\twhere count($b/author) > 0 \n" + " \t\treturn \n" + " \t\t\t{ $b/title } \n" + " \t\t\t{ for $a in $b/author[position()<=2] return $a } \n" + " \t\t\t{ if (count($b/author) > 2) then else () } \n" + " \t\t\t } \n" + " \t\n" + " ", ctx); try { query.context(node(file("docs/bib.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("TCP/IP IllustratedStevensW.Advanced Programming in the Unix environmentStevensW.Data on the WebAbiteboulSergeBunemanPeter", false) ); } /** . */ @org.junit.Test public void xmpQueriesResultsQ7() { final XQuery query = new XQuery( "\n" + " \t { \n" + " \t\tfor $b in //book \n" + " \t\twhere $b/publisher = \"Addison-Wesley\" and $b/@year > 1991 \n" + " \t\torder by exactly-one($b/title) \n" + " \t\treturn { $b/@year } { $b/title } } \n" + " \t\n" + " ", ctx); try { query.context(node(file("docs/bib.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Advanced Programming in the Unix environmentTCP/IP Illustrated", false) ); } /** . */ @org.junit.Test public void xmpQueriesResultsQ8() { final XQuery query = new XQuery( "\n" + " \tfor $b in //book \n" + " \tlet $e := $b/*[contains(string(.), \"Suciu\") and ends-with(local-name(.), \"or\")] \n" + " \twhere exists($e) \n" + " \treturn { $b/title } { $e } \n" + " ", ctx); try { query.context(node(file("docs/bib.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Data on the WebSuciuDan", false) ); } /** . */ @org.junit.Test public void xmpQueriesResultsQ9() { final XQuery query = new XQuery( "\n" + " \t { \n" + " \t\tfor $t in //(chapter | section)/title \n" + " \t\twhere contains(exactly-one($t/text()), \"XML\") \n" + " \t\treturn $t } \n" + " \t\n" + " ", ctx); try { query.context(node(file("docs/books.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("XMLXML and Semistructured Data", false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/app/AppXMark.java000066400000000000000000051240471222453003200266240ustar00rootroot00000000000000package org.basex.test.qt3ts.app; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the EQName. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class AppXMark extends QT3TestSet { /** * Return the name of the person with ID `person0'. convert Dfl to Euro . */ @org.junit.Test public void xMarkAll() { final XQuery query = new XQuery( queryFile( file( "app/XMark/XMark-All.xq" ) ), ctx); try { query.context(node(file("app/XMark/XMarkAuction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Seongtaek Mattern10.503.0015.0025.506.0061.5034.5012.0010.503.0013.503.0042.0027.001.5039.007.5012.009.0015.0051.0012.0012.0013.503.009.0021.007.5015.009.003.003.0010.5015.0016.5033.009.0048.0031.501.5052.507.506.0015.003.0016.5013.501.5031.503.0031.5021.0015.003.006.0033.0025.507.5015.0057.004.5012.003.007.504.503.0019.509.001.5036.0025.5010.5012.009.006.009.0016.509.009.004.5028.5021.0051.007.501.509.0021.0031.5010.5013.507.5018.003.0028.501.5030.0013.5042.001.5021.0031.5022.507.501.501.501.5051.004.503.0049.503.003.0022.506.0051.006.0021.0013.5016.5025.5010.504.5031.5010.5024.0010.506.004.506.0013.509.0013.503.006.004.5045.0022.504.501.5019.5025.507.506.0024.006.003.009.003.001.5012.004.5022.5052.5027.004.5033.0022.506.0013.5019.506.0075.003.006.0025.509.001.503.004.503.0039.0094.5013.5045.006.0022.5016.5019.5040.506.007.5028.501.507.501.5016.5015.006.003.0033.004.5025.5034.5030.006.007.5018.0039.006.0013.507.5015.006.0016.5012.0015.006.0034.5025.503.0039.0018.0049.504.5018.003.0021.006.0022.501.5018.007.5022.5019.5010.5019.507.509.001.504.503.0052.507.506.007.5058.5031.506.0022.503.0021.007.503.001.501.503.009.007.503.0019.5018.004.509.0058.504.5027.007.509.0025.501.509.0016.5024.0036.0016.5010.501.5016.504.5069.004.507.5010.5015.003.0027.006.001.5025.506.0061.503.003.0031.507.5027.0015.001.5018.001.507.5013.5013.5094.5013.5012.004.509.009.0030.003.009.0025.5016.506.0036.0021.001.5058.5010.5064.5025.5022.5027.0030.0064.504.50200647273400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010010000000000000000000000001001000000010000010001100000001000000010000000000301100000040011000000010202001010021000212103000001210113000100121200120020010002312202121120311101413120500112211131016300302021301200312300420100103410121313101110112033001102131211201003033002220111201222123000001121111112003004100102010030000101000021110000010000000000010000100100000100000010012000000010000100000110000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000rights midwife embark learned ashy wither well over blister eros wench nails leisure slender manly leperous breathing put blush doing ford instantly copied boyet rear state amend issu dirt knows hovel towards apart drunk desartless not thunder exil round suits close reprove youths varying dallying deed blowing mistook sire sons grown earliest affliction earth flatterest fifty protector vessels almighty stomachs gentleman whom pity humbly shallow themselves mean bestow past burn coronet debtor concord quips slanders lust uncover zeal foolish against mightst winnowed greg remedy decorum inheritance legate tush mightier thereby bianca sons absurd fairly charity strikes inherited sorry argument amended full hast sempronius potent gracious fixture think mercutio goose peruse finding window sails assay excels burn preventions affects longaville fall mournings citizens revels utter revenged news milan despised spits fines watch flow rack dangers action seldom undid door becomes bestow held vessels ugly plenteous sold mingle singing sweetest several spok defeat gallant preventions tent day villainous oblivion shalt elbow provost lionel properer wooing ocean riot down retir protectorship confronted charg losing title barefac impostor anchises fiend advised particular pregnantly category0female39585.93Birkett Zedlitzmailto:Zedlitz@yorku.camaleCollege9876.00Kagan Takanomailto:Takano@uni-sb.defemale63811.82Lon Leifert45 McKenna StKansasUnited Statesmailto:Leifert@sunysb.eduhttp://www.sunysb.edu/~Leifert6789 8467 1353 5816male9876.00Zhensheng Laulheremailto:Laulhere@ucla.edu8065 4460 9357 8496male2621142.02Elihu Lorys60 Jantke StGenevaUnited Statesmailto:Lorys@berkeley.eduhttp://www.berkeley.edu/~Lorysmale2885711.23Maung Rainmailto:Rain@cas.czmale479876.00Zeljko Wolford13 Leaver StWorcesterUnited Statesmailto:Wolford@umd.eduhttp://www.umd.edu/~Wolford3364225.11Arjen Emden44 Goos StLexingtonUnited Statesmailto:Emden@forwiss.dehttp://www.forwiss.de/~Emden2468 4642 9646 5367female25High School9876.00Kendra Dunanmailto:Dunan@conclusivestrategies.com7343 3711 8611 7955maleGraduate School18103.99Raja Schroermailto:Schroer@ac.krmale69930.56Xiaoyu Willamowski48 Stefano StCharlestonUnited Statesmailto:Willamowski@bellatlantic.netfemaleCollege52198.30Eleanna Loulerguemailto:Loulergue@imag.fr29College85365.36Sushant Baransky39 Varpaaniemi StChicagoZambiamailto:Baransky@du.edu18Other9995.92Martial Chorvat65 Campadelli StMonterreyUnited Statesmailto:Chorvat@zambeel.com4079 3475 5627 8448female34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 629873540.90Angel Kanamorimailto:Kanamori@telcordia.comhttp://www.telcordia.com/~KanamorimaleOther147002.31Nikolaos Birdsall20 Morillo StGrenadaUnited Statesmailto:Birdsall@clarkson.edufemale2933284.56Chams Michailidis11 Davoren StGainesvilleTanzaniamailto:Michailidis@ntua.grfemaleOther63285.36Roseane Henton21 Falkerngerg StArubaUnited Statesmailto:Henton@csufresno.eduhttp://www.csufresno.edu/~Hentonmale25728.38Priyadarshan Burgert53 Liberman StCorpusReunionmailto:Burgert@savera.comhttp://www.savera.com/~Burgertmale189876.00Ruben Paczkowski42 Osmani StKievUnited Statesmailto:Paczkowski@ac.jphttp://www.ac.jp/~Paczkowski5171 8849 3355 1220male88737.57Vanathi Takano39 Borowsky StIstanbulUnited Statesmailto:Takano@baylor.edu9748 8717 5684 69901867501.36Terunao Veccia53 Brightwell StToulouseHondurasmailto:Veccia@sbphrd.comGraduate School34738.51Singaravel Skurczynski41 Zhongxiu StPortlandSwitzerlandmailto:Skurczynski@ntua.grhttp://www.ntua.gr/~Skurczynski53Other48773.68Tetsurou Caugne19 Falgout StWorcesterUnited Statesmailto:Caugne@columbia.edu8535 6273 6608 32639876.00Dhritiman Schapiremailto:Schapire@ucd.iehttp://www.ucd.ie/~Schapire7089 9225 8648 445732Graduate School21453.40Kyujin Thenmozhimailto:Thenmozhi@sbphrd.comhttp://www.sbphrd.com/~Thenmozhi5667 1325 6395 3905679876.00Mehrdad Holldobler38 Delaune StMontrealUnited Statesmailto:Holldobler@sunysb.edufemale2425157.94Terrill Uchoamailto:Uchoa@co.inmale1821628.35Mehrdad Granlund2 Huttel StMontgomeryUnited Statesmailto:Granlund@concentric.net6039 9126 8908 863446College9876.00Ennio Fanchon44 Beeferman StStockholmVatican City Statemailto:Fanchon@bellatlantic.nethttp://www.bellatlantic.net/~FanchonmaleGraduate School23261.52Gioia Mulkersmailto:Mulkers@mitre.orghttp://www.mitre.org/~Mulkers3207 9504 9402 94403324186.28Marco Meszaros49 Wohn StKievSt. Vincent and Grenadinesmailto:Meszaros@ac.athttp://www.ac.at/~Meszaros6309 7243 2721 1636category11female39585.93Birkett Zedlitzmailto:Zedlitz@yorku.camaleCollege9876.00Kagan Takanomailto:Takano@uni-sb.defemale63811.82Lon Leifert45 McKenna StKansasUnited Statesmailto:Leifert@sunysb.eduhttp://www.sunysb.edu/~Leifert6789 8467 1353 581615620.89Frieder Basumailto:Basu@edu.aumale38High School35391.33Samson Scopinich22 Luit StNassauLithuaniamailto:Scopinich@forth.grhttp://www.forth.gr/~Scopinich7744 1014 3146 578752743.14Angel McDermid56 Deves StStockholmUnited Statesmailto:McDermid@ucdavis.eduhttp://www.ucdavis.edu/~McDermidfemale29College109893.20Bevin Keustermans55 Kluthe StCharlestonUnited Statesmailto:Keustermans@cwru.edu33857.61Kristof Pittmailto:Pitt@unf.edu6369 9760 9277 8247High School52123.17Athomas Roubieremailto:Roubiere@yorku.cafemale33532.36Ravindran Yacobi90 Cools StAlbanyLithuaniamailto:Yacobi@emc.commaleHigh School29348.51Yael Ritceymailto:Ritcey@csufresno.eduhttp://www.csufresno.edu/~Ritcey4175 3581 3728 53201880569.02Junzhong Hananimailto:Hanani@unizh.ch1828898.01Mimmo Stiftermailto:Stifter@edu.cnhttp://www.edu.cn/~Stifter3829 2675 8446 5011male72247.13Djordje Milesmailto:Miles@att.com4147 2060 2989 7208femaleOther76543.02Arno Takano2 Jezioranski StAkronUnited Statesmailto:Takano@uwo.cahttp://www.uwo.ca/~Takano1059 2269 8254 7515femaleHigh School95732.32Hagen Artosimailto:Artosi@clustra.comhttp://www.clustra.com/~Artosi7136 1358 8743 5847female3943323.95Mitsugu Thobenmailto:Thoben@sbphrd.com4537 1155 4156 664924141.45Yuan Tayara48 Kurita StPittsburghUnited Statesmailto:Tayara@purdue.eduhttp://www.purdue.edu/~TayaraHigh School32535.03Drago Showaltermailto:Showalter@auc.dk25High School36970.64Elihu Salinasmailto:Salinas@ucdavis.eduhttp://www.ucdavis.edu/~Salinasfemale17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edumale18Graduate School61397.86Atreye Livari18 Sangal StCincinnatiSenegalmailto:Livari@msn.comhttp://www.msn.com/~Livarimale1947616.43Gurmeet Beounesmailto:Beounes@yorku.camaleHigh School61094.02Mehrdad Bierbaum77 Heyderhoff StIdahoUnited Statesmailto:Bierbaum@sdsc.edu5223 3221 1166 7010female34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 6298male26099.90Sheilah Takano27 Chandna StToledoUnited Statesmailto:Takano@neu.eduhttp://www.neu.edu/~Takano5166 3645 9483 2416maleOther147002.31Nikolaos Birdsall20 Morillo StGrenadaUnited Statesmailto:Birdsall@clarkson.edu48128.34Martien Noortwijk25 Melski StProvidencialesUnited Statesmailto:Noortwijk@co.inhttp://www.co.in/~Noortwijk3902 2842 7544 6492maleGraduate School48463.16Geraldine Relihan23 Meketon StKahuluiUnited Statesmailto:Relihan@toronto.eduhttp://www.toronto.edu/~Relihan24Graduate School20808.47Felip Veevers60 Gobioff StZihuatenejoIrelandmailto:Veevers@ualberta.ca2147 4781 9975 1452male32039.10Guanshan Keustermans5 Hazony StBudapestUnited Statesmailto:Keustermans@upenn.eduhttp://www.upenn.edu/~Keustermans7994 4699 1996 9940female31313.14Upendra Sueyoshi100 Iwayama StPensacolaUnited Statesmailto:Sueyoshi@msstate.edufemale2933284.56Chams Michailidis11 Davoren StGainesvilleTanzaniamailto:Michailidis@ntua.grHigh School22905.31Merce Beoumes17 Lattin StLawtonQatarmailto:Beoumes@washington.eduhttp://www.washington.edu/~BeoumesfemaleHigh School27442.54Linore Pradomailto:Prado@uta.edu3098 3930 3792 434943968.43Hausi Henriksson11 Shiota StSeattleUnited Statesmailto:Henriksson@uqam.cahttp://www.uqam.ca/~Henriksson27Graduate School35214.05Tobias Veeraraghavan41 Cavedoni StAguascalientesUnited Statesmailto:Veeraraghavan@umb.edu8969 5456 9679 133626College13999.18Yoko Meursmailto:Meurs@rpi.edu4761 5609 3284 980131377.71Douadi Newton100 Deb StTexarkanaUnited Statesmailto:Newton@acm.org42High School63869.30Waiman Sakomotomailto:Sakomoto@crossgain.commale1821628.35Mehrdad Granlund2 Huttel StMontgomeryUnited Statesmailto:Granlund@concentric.net6039 9126 8908 8634category2565739.54Niraj Fergany55 Rheingans StSaltGuineamailto:Fergany@uni-mb.simale64243.77Huican Szmurlo52 Ternovskaia StCodyUnited Statesmailto:Szmurlo@ucsd.eduhttp://www.ucsd.edu/~Szmurlo2217 9440 7362 340518College23941.65Rajaram Lease100 Preishuber StEastUnited Statesmailto:Lease@imag.frhttp://www.imag.fr/~Lease4948 9378 8238 360026770.70Fun Lattin93 Mutschke StPascoUnited Statesmailto:Lattin@forth.grhttp://www.forth.gr/~Lattinmale479876.00Zeljko Wolford13 Leaver StWorcesterUnited Statesmailto:Wolford@umd.eduhttp://www.umd.edu/~Wolfordfemale1866561.70Mara Tchuentemailto:Tchuente@telcordia.comhttp://www.telcordia.com/~Tchuentefemale29College109893.20Bevin Keustermans55 Kluthe StCharlestonUnited Statesmailto:Keustermans@cwru.edufemale9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~Koszlajda18Other9876.00Jessie Goodrum33 Grabe StGulfportAfghanistanmailto:Goodrum@smu.eduhttp://www.smu.edu/~Goodrum4135 6305 3725 5036femaleGraduate School54668.95Joey Girouxmailto:Giroux@crossgain.comhttp://www.crossgain.com/~Giroux6425 5745 4662 1727female21College20347.38Isamu Kupiecmailto:Kupiec@twsu.eduhttp://www.twsu.edu/~Kupiec6071 5377 9019 296359420.56Ziqiang Businaro21 Coatta StMontrealUnited Statesmailto:Businaro@indiana.eduhttp://www.indiana.edu/~Businaromale70373.08Mehrdad Sevcikovamailto:Sevcikova@sds.nohttp://www.sds.no/~SevcikovafemaleCollege19207.80Bahaa Lortz24 Zaimov StAnchorageUnited Statesmailto:Lortz@toronto.edu1432 1375 9826 3007male1835487.60Mehrdad Huhdanpaamailto:Huhdanpaa@itc.ithttp://www.itc.it/~Huhdanpaamale3760708.89Nobuko Manara39 Pigeon StMontgomeryUnited Statesmailto:Manara@imag.frhttp://www.imag.fr/~Manara8751 5605 9270 8646College9876.00Odoardo Rajaraman39 Backelin StVillahermosaUnited Statesmailto:Rajaraman@ul.pthttp://www.ul.pt/~Rajaramanmale36914.75Howell Motley64 Lafortune StAthensUnited Statesmailto:Motley@uic.eduhttp://www.uic.edu/~Motley1828245.16Sachem Grab29 Fegeas StSalvadorUnited Statesmailto:Grab@indiana.edufemale3943323.95Mitsugu Thobenmailto:Thoben@sbphrd.com4537 1155 4156 6649female29High School44522.39Rupal Takanomailto:Takano@conclusivestrategies.comfemale459876.00Mehrdad Apperley12 Vinar StBucharestUnited Statesmailto:Apperley@ibm.com18109944.80Boon Oestreicher12 Moshman StMunichCroatiamailto:Oestreicher@ucf.eduhttp://www.ucf.edu/~Oestreicher9680 1053 2022 9885maleCollege62028.39Lucien Cunliffe11 Smotroff StMeridianVatican City Statemailto:Cunliffe@mit.edu2139 7205 4141 4885female34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 629875125.30Randal Roushmailto:Roush@msstate.edu6224 7382 7689 876618High School47967.41Naoki Osterloh7 Ghandeharizadeh StCairoTanzaniamailto:Osterloh@ask.comhttp://www.ask.com/~Osterloh7741 8229 7494 194344100064.62Oddvar Kamijomailto:Kamijo@ou.eduhttp://www.ou.edu/~Kamijo4434 7244 4200 847924Graduate School20808.47Felip Veevers60 Gobioff StZihuatenejoIrelandmailto:Veevers@ualberta.ca2147 4781 9975 1452femaleHigh School57624.85Srihari Murrillmailto:Murrill@edu.cnfemale2933284.56Chams Michailidis11 Davoren StGainesvilleTanzaniamailto:Michailidis@ntua.grmaleGraduate School43412.47Mehrdad Ewards9 Mosedale StMumbaiUnited Statesmailto:Ewards@edu.hkhttp://www.edu.hk/~Ewardsmale45100.26Knuth Grandbois27 Newton StBudapestUnited Statesmailto:Grandbois@ibm.com3277 5711 2104 1479female18High School32207.29Jessie Courymailto:Coury@computer.orghttp://www.computer.org/~Coury3948 9942 2047 3209maleOther9876.00Benny Maraist38 Coscoy StVeniceUnited Statesmailto:Maraist@acm.org1444 4160 5898 7668female2425157.94Terrill Uchoamailto:Uchoa@co.infemale19Other49367.09Armond Hebert54 Cooley StFrankfurtCanadamailto:Hebert@rpi.eduhttp://www.rpi.edu/~Hebertfemale67651.65Yoshinari Rajamailto:Raja@nodak.eduhttp://www.nodak.edu/~Raja7807 3048 4554 4266maleCollege94906.70Maura Clasenmailto:Clasen@ucf.eduhttp://www.ucf.edu/~Clasen5915 1705 9308 1877category865739.54Niraj Fergany55 Rheingans StSaltGuineamailto:Fergany@uni-mb.si4137695.50Miron Rivals33 Besancenot StShannonUnited Statesmailto:Rivals@ac.be5183 2729 4304 4288male64243.77Huican Szmurlo52 Ternovskaia StCodyUnited Statesmailto:Szmurlo@ucsd.eduhttp://www.ucsd.edu/~Szmurlo2217 9440 7362 340515620.89Frieder Basumailto:Basu@edu.au34High School9876.00Fazli Elsanadidimailto:Elsanadidi@memphis.eduhttp://www.memphis.edu/~Elsanadidi3924 1056 9280 8856male4522589.34Noelle Ramrasmailto:Ramras@dauphine.fr1834791.61Limor Schlichtermailto:Schlichter@dauphine.fr2262 3605 4735 371526770.70Fun Lattin93 Mutschke StPascoUnited Statesmailto:Lattin@forth.grhttp://www.forth.gr/~Lattinfemale63Other71946.13Herbert Kleiser100 Raghavendra StGeorgeUnited Statesmailto:Kleiser@washington.eduhttp://www.washington.edu/~Kleiser4454 8668 5057 15745018437.40Vinot Thomsen2 Kishida StChattanoogaUnited Statesmailto:Thomsen@cornell.eduhttp://www.cornell.edu/~Thomsen33857.61Kristof Pittmailto:Pitt@unf.edu6369 9760 9277 8247female9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~Koszlajdafemale80670.94Shiquan Wixonmailto:Wixon@pi.it40268.84Zosimo Basmailto:Bas@uta.edu3953 1957 8995 9210maleGraduate School18103.99Raja Schroermailto:Schroer@ac.krmale4262287.09Suvo Fiutem69 Luff StWindhoekSouth Africamailto:Fiutem@co.jp5089 1407 5205 539135Other95431.89Raimondas Holtmanmailto:Holtman@indiana.eduhttp://www.indiana.edu/~Holtmanmale3760708.89Nobuko Manara39 Pigeon StMontgomeryUnited Statesmailto:Manara@imag.frhttp://www.imag.fr/~Manara8751 5605 9270 864618Graduate School30851.14LouAnn Mulvany13 Whitt StBarcelonaUnited Statesmailto:Mulvany@ucla.eduhttp://www.ucla.edu/~Mulvany6788 3544 7141 9025College9876.00Odoardo Rajaraman39 Backelin StVillahermosaUnited Statesmailto:Rajaraman@ul.pthttp://www.ul.pt/~Rajaramanmale22Graduate School36448.54Alassane Brown19 Steingart StTallahasseeTurkeymailto:Brown@ac.be4583 2923 3450 3894male19764.36Jacky Kunieda31 Malabarba StGuaymasUnited Statesmailto:Kunieda@uni-mannheim.de4090 9244 8696 7598female44Graduate School62236.54Fano Usmanimailto:Usmani@unf.eduhttp://www.unf.edu/~Usmani4826 7793 3421 79141889413.77Rosalyn Borrowman71 Mekaouche StCasperUnited Statesmailto:Borrowman@panasonic.comOther18748.51Honari Vendrig59 Dougherty StBolognaUnited Statesmailto:Vendrig@bell-labs.comhttp://www.bell-labs.com/~VendrigmaleHigh School22127.36Yannik Hamblinmailto:Hamblin@cohera.commaleOther147002.31Nikolaos Birdsall20 Morillo StGrenadaUnited Statesmailto:Birdsall@clarkson.eduOther12631.68Jawed Grundmannmailto:Grundmann@purdue.edu29Other56634.76Lai Greenwaldmailto:Greenwald@filelmaker.comhttp://www.filelmaker.com/~Greenwald9722 4263 8015 608351Other23226.04Yoshiki Blumbergmailto:Blumberg@ask.com2926 2408 8275 2143maleGraduate School48463.16Geraldine Relihan23 Meketon StKahuluiUnited Statesmailto:Relihan@toronto.eduhttp://www.toronto.edu/~Relihanmale1835295.10Navdeep Tyszermailto:Tyszer@utexas.edufemale31313.14Upendra Sueyoshi100 Iwayama StPensacolaUnited Statesmailto:Sueyoshi@msstate.edufemale2933284.56Chams Michailidis11 Davoren StGainesvilleTanzaniamailto:Michailidis@ntua.gr9876.00Renzo Collavizzamailto:Collavizza@ul.pt6044 5884 4789 419831377.71Douadi Newton100 Deb StTexarkanaUnited Statesmailto:Newton@acm.org34032.09Francesca Weismantelmailto:Weismantel@ucla.edu2763 1794 7943 4753female2425157.94Terrill Uchoamailto:Uchoa@co.infemaleOther98527.30Witold Straneymailto:Straney@cas.cz2461 6546 4698 2228female67651.65Yoshinari Rajamailto:Raja@nodak.eduhttp://www.nodak.edu/~Raja7807 3048 4554 4266category1065739.54Niraj Fergany55 Rheingans StSaltGuineamailto:Fergany@uni-mb.simale64243.77Huican Szmurlo52 Ternovskaia StCodyUnited Statesmailto:Szmurlo@ucsd.eduhttp://www.ucsd.edu/~Szmurlo2217 9440 7362 340561161.12Shiby Ginneken58 Nisonger StNewcastleUnited Statesmailto:Ginneken@yorku.cahttp://www.yorku.ca/~Ginneken5020 5482 5482 3578Other9876.00Bharadwaj Nozawa58 Regoli StWarsawUnited Statesmailto:Nozawa@cas.czhttp://www.cas.cz/~Nozawa3284 7939 4808 3523Other9876.00Shuji Kandlur84 Ullah StCasperUnited Statesmailto:Kandlur@usa.nethttp://www.usa.net/~Kandlur2302 1799 1932 631134High School9876.00Fazli Elsanadidimailto:Elsanadidi@memphis.eduhttp://www.memphis.edu/~Elsanadidi3924 1056 9280 8856male2885711.23Maung Rainmailto:Rain@cas.czfemale3449147.80Frantisek Speltmailto:Spelt@versata.comhttp://www.versata.com/~Spelt27College40010.92Prabuddha Chattopadhyaymailto:Chattopadhyay@nwu.edufemale1866561.70Mara Tchuentemailto:Tchuente@telcordia.comhttp://www.telcordia.com/~Tchuente5018437.40Vinot Thomsen2 Kishida StChattanoogaUnited Statesmailto:Thomsen@cornell.eduhttp://www.cornell.edu/~Thomsenfemale18Other50634.45Sidd Zfiramailto:Zfira@uga.eduhttp://www.uga.edu/~Zfira33857.61Kristof Pittmailto:Pitt@unf.edu6369 9760 9277 8247male19High School38050.91Mauri Takanomailto:Takano@sbphrd.comhttp://www.sbphrd.com/~Takanofemale9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~KoszlajdaGraduate School9876.00Kristof Grafe94 Ingolfsdottir StCopenhagenZimbabwemailto:Grafe@lante.comhttp://www.lante.com/~Grafefemale80670.94Shiquan Wixonmailto:Wixon@pi.itCollege106547.20Khatoun Rankamailto:Ranka@clarkson.eduhttp://www.clarkson.edu/~Rankamale72247.13Djordje Milesmailto:Miles@att.com4147 2060 2989 7208male69930.56Xiaoyu Willamowski48 Stefano StCharlestonUnited Statesmailto:Willamowski@bellatlantic.netmaleGraduate School9876.00Andreas Weijland80 Okasaki StBatonUnited Statesmailto:Weijland@conclusivestrategies.comhttp://www.conclusivestrategies.com/~Weijlandmale3760708.89Nobuko Manara39 Pigeon StMontgomeryUnited Statesmailto:Manara@imag.frhttp://www.imag.fr/~Manara8751 5605 9270 864618Other32519.99Merrick Rapin78 Melcarne StMobileParaguaymailto:Rapin@csufresno.eduCollege9876.00Odoardo Rajaraman39 Backelin StVillahermosaUnited Statesmailto:Rajaraman@ul.pthttp://www.ul.pt/~Rajaramanfemale3943323.95Mitsugu Thobenmailto:Thoben@sbphrd.com4537 1155 4156 6649femaleOther44792.93Hagbae Gershkovich62 Soinard StBrusselsAmerican Samoamailto:Gershkovich@llnl.govhttp://www.llnl.gov/~Gershkovich36Other62943.64Bartek Schumaker83 Kumaresan StLimaArgentinamailto:Schumaker@labs.comhttp://www.labs.com/~Schumaker3597 8655 2603 6797female459876.00Mehrdad Apperley12 Vinar StBucharestUnited Statesmailto:Apperley@ibm.comfemale19High School47409.99Wieb Baummailto:Baum@bell-labs.comhttp://www.bell-labs.com/~BaumHigh School32535.03Drago Showaltermailto:Showalter@auc.dk28College22854.05Mas Bretthauermailto:Bretthauer@uu.se6903 3735 8900 1605male18Graduate School61397.86Atreye Livari18 Sangal StCincinnatiSenegalmailto:Livari@msn.comhttp://www.msn.com/~LivarimaleCollege62028.39Lucien Cunliffe11 Smotroff StMeridianVatican City Statemailto:Cunliffe@mit.edu2139 7205 4141 4885female34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 629818High School47967.41Naoki Osterloh7 Ghandeharizadeh StCairoTanzaniamailto:Osterloh@ask.comhttp://www.ask.com/~Osterloh7741 8229 7494 194351Other23226.04Yoshiki Blumbergmailto:Blumberg@ask.com2926 2408 8275 214344100064.62Oddvar Kamijomailto:Kamijo@ou.eduhttp://www.ou.edu/~Kamijo4434 7244 4200 8479female26High School9876.00Etsuo Plessier50 Littlestone StLorientUnited Statesmailto:Plessier@labs.comhttp://www.labs.com/~Plessier26419.07Yukata Beauducel47 Araya StCharlottesvilleUnited Statesmailto:Beauducel@poznan.plhttp://www.poznan.pl/~Beauducel7393 8354 9466 4534female18Graduate School36875.04Vwani Guck59 Carapuca StTulsaUnited Statesmailto:Guck@ubs.comhttp://www.ubs.com/~Guck8540 5460 1107 6135maleGraduate School43412.47Mehrdad Ewards9 Mosedale StMumbaiUnited Statesmailto:Ewards@edu.hkhttp://www.edu.hk/~Ewardsfemale18129137.70Khedija Yonezawa57 Naixiao StToulouseChilemailto:Yonezawa@clustra.comhttp://www.clustra.com/~Yonezawa2333 2094 5586 4351femaleHigh School27442.54Linore Pradomailto:Prado@uta.edu3098 3930 3792 434929College10406.64Mingzeng Uchoa76 Vongsathorn StAcapulcoUnited Statesmailto:Uchoa@baylor.edu8084 7023 9186 61281867501.36Terunao Veccia53 Brightwell StToulouseHondurasmailto:Veccia@sbphrd.com32College31589.10Daria McDermid79 Harllee StCalgaryTurkeymailto:McDermid@acm.orghttp://www.acm.org/~McDermid42High School63869.30Waiman Sakomotomailto:Sakomoto@crossgain.com34032.09Francesca Weismantelmailto:Weismantel@ucla.edu2763 1794 7943 4753female2425157.94Terrill Uchoamailto:Uchoa@co.inmaleGraduate School23261.52Gioia Mulkersmailto:Mulkers@mitre.orghttp://www.mitre.org/~Mulkers3207 9504 9402 9440Other49831.44Shyam Taganskymailto:Tagansky@cwru.eduhttp://www.cwru.edu/~Tagansky78286.48Kunimasa Useltonmailto:Uselton@utexas.edu8164 1978 5759 3010category1865739.54Niraj Fergany55 Rheingans StSaltGuineamailto:Fergany@uni-mb.sifemale28College23070.82Hakim Savarammailto:Savaram@nyu.eduhttp://www.nyu.edu/~SavaramHigh School46542.05Leighton Odbergmailto:Odberg@cwi.nlhttp://www.cwi.nl/~Odberg55498.73Mehrdad Barroso23 Grabner StRapidUnited Statesmailto:Barroso@uwo.caHigh School52123.17Athomas Roubieremailto:Roubiere@yorku.camale18Other84592.63Jayakrishnan Turakainenmailto:Turakainen@evergreen.edu50Other55383.43Nidapan Stassinopoulosmailto:Stassinopoulos@lante.comCollege106547.20Khatoun Rankamailto:Ranka@clarkson.eduhttp://www.clarkson.edu/~Ranka40268.84Zosimo Basmailto:Bas@uta.edu3953 1957 8995 92101944492.43Sajoong Bottoni56 Isman StWashingtonUnited Statesmailto:Bottoni@ucsd.eduhttp://www.ucsd.edu/~Bottoni4979 4485 7219 1879male72247.13Djordje Milesmailto:Miles@att.com4147 2060 2989 720818Graduate School41595.76Nevio Drashansky60 Petry StElUnited Statesmailto:Drashansky@evergreen.edu7712 4592 2474 5574female46814.24Keumog Gellerich43 Gove StGenevaKenyamailto:Gellerich@ab.cafemale18High School57378.24Joonsoo Pollaciamailto:Pollacia@co.inmale36Other46000.68Sudip Rekhtermailto:Rekhter@cas.cz4959 8573 1371 9567femaleHigh School95732.32Hagen Artosimailto:Artosi@clustra.comhttp://www.clustra.com/~Artosi7136 1358 8743 584728College22854.05Mas Bretthauermailto:Bretthauer@uu.se6903 3735 8900 1605female44Graduate School62236.54Fano Usmanimailto:Usmani@unf.eduhttp://www.unf.edu/~Usmani4826 7793 3421 7914female24High School53332.77Berardo Radwanmailto:Radwan@clarkson.eduhttp://www.clarkson.edu/~Radwan5362 4892 6180 721418Other9995.92Martial Chorvat65 Campadelli StMonterreyUnited Statesmailto:Chorvat@zambeel.com4079 3475 5627 84482739491.29Hideo Korachmailto:Korach@cas.czhttp://www.cas.cz/~Korach8091 7556 8996 4369female34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 629830College9876.00Asha Dumasmailto:Dumas@twsu.edu9876.00Pragnesh Takanomailto:Takano@labs.comhttp://www.labs.com/~Takano8238 8564 3820 4678maleOther147002.31Nikolaos Birdsall20 Morillo StGrenadaUnited Statesmailto:Birdsall@clarkson.edufemale209876.00Alban Kossowskimailto:Kossowski@emc.com2606 3971 1356 1048male32039.10Guanshan Keustermans5 Hazony StBudapestUnited Statesmailto:Keustermans@upenn.eduhttp://www.upenn.edu/~Keustermans7994 4699 1996 9940male3959387.85Allison Balazsmailto:Balazs@ibm.comhttp://www.ibm.com/~Balazsfemale2933284.56Chams Michailidis11 Davoren StGainesvilleTanzaniamailto:Michailidis@ntua.grHigh School22905.31Merce Beoumes17 Lattin StLawtonQatarmailto:Beoumes@washington.eduhttp://www.washington.edu/~Beoumes18High School31438.50Yeogirl Wing3 Tambouris StTwinUnited Statesmailto:Wing@csufresno.eduhttp://www.csufresno.edu/~Wingmale88737.57Vanathi Takano39 Borowsky StIstanbulUnited Statesmailto:Takano@baylor.edu9748 8717 5684 6990femaleHigh School27442.54Linore Pradomailto:Prado@uta.edu3098 3930 3792 434943968.43Hausi Henriksson11 Shiota StSeattleUnited Statesmailto:Henriksson@uqam.cahttp://www.uqam.ca/~Henriksson39920.17Leslie Trystrammailto:Trystram@yahoo.com1867501.36Terunao Veccia53 Brightwell StToulouseHondurasmailto:Veccia@sbphrd.commale58High School53088.84Honglan Hagimontmailto:Hagimont@edu.auhttp://www.edu.au/~HagimontGraduate School52300.25Berto Parisi18 Cagley StColumbusTaiwanmailto:Parisi@sfu.cahttp://www.sfu.ca/~Parisi2059 3864 2375 29749876.00Dhritiman Schapiremailto:Schapire@ucd.iehttp://www.ucd.ie/~Schapire7089 9225 8648 4457female2425157.94Terrill Uchoamailto:Uchoa@co.infemaleOther98527.30Witold Straneymailto:Straney@cas.cz2461 6546 4698 2228female36High School37546.25Masali Ruedamailto:Rueda@cwi.nlhttp://www.cwi.nl/~Rueda7296 2605 7171 67983324186.28Marco Meszaros49 Wohn StKievSt. Vincent and Grenadinesmailto:Meszaros@ac.athttp://www.ac.at/~Meszaros6309 7243 2721 1636category2765739.54Niraj Fergany55 Rheingans StSaltGuineamailto:Fergany@uni-mb.si61161.12Shiby Ginneken58 Nisonger StNewcastleUnited Statesmailto:Ginneken@yorku.cahttp://www.yorku.ca/~Ginneken5020 5482 5482 3578male12885.30Mehrdad Schimmler76 McMorrow StAlbuquerqueUnited Statesmailto:Schimmler@evergreen.eduhttp://www.evergreen.edu/~Schimmler5264 9278 9093 16322870444.29Mountaz Ossenbruggenmailto:Ossenbruggen@whizbang.com15620.89Frieder Basumailto:Basu@edu.au1852503.82Garnik Takano43 Hendren StMexicoEl Salvadormailto:Takano@ask.comhttp://www.ask.com/~Takano6865 4881 8965 2217male38High School35391.33Samson Scopinich22 Luit StNassauLithuaniamailto:Scopinich@forth.grhttp://www.forth.gr/~Scopinich7744 1014 3146 5787female18Graduate School24387.33Mehrdad Christ96 Servatius StMilwaukeeIndonesiamailto:Christ@newpaltz.eduhttp://www.newpaltz.edu/~Christmale4522589.34Noelle Ramrasmailto:Ramras@dauphine.fr1834791.61Limor Schlichtermailto:Schlichter@dauphine.fr2262 3605 4735 3715female20230.96Radhia Lakshmipathymailto:Lakshmipathy@clustra.com5449328.84Von Hancox55 Pollermann StMelbourneUnited Statesmailto:Hancox@versata.com27College40010.92Prabuddha Chattopadhyaymailto:Chattopadhyay@nwu.edufemale1866561.70Mara Tchuentemailto:Tchuente@telcordia.comhttp://www.telcordia.com/~Tchuentefemale28College23070.82Hakim Savarammailto:Savaram@nyu.eduhttp://www.nyu.edu/~Savaramfemale33532.36Ravindran Yacobi90 Cools StAlbanyLithuaniamailto:Yacobi@emc.comfemale9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~Koszlajda50Other55383.43Nidapan Stassinopoulosmailto:Stassinopoulos@lante.com1944492.43Sajoong Bottoni56 Isman StWashingtonUnited Statesmailto:Bottoni@ucsd.eduhttp://www.ucsd.edu/~Bottoni4979 4485 7219 1879male70373.08Mehrdad Sevcikovamailto:Sevcikova@sds.nohttp://www.sds.no/~Sevcikova35Other95431.89Raimondas Holtmanmailto:Holtman@indiana.eduhttp://www.indiana.edu/~HoltmanfemaleHigh School9901.94Kaisa McNaught60 Kader StButteUnited Statesmailto:McNaught@ufl.edu18High School23748.90Bette Erevmailto:Erev@nyu.eduhttp://www.nyu.edu/~Erev4584 3851 4962 47661828245.16Sachem Grab29 Fegeas StSalvadorUnited Statesmailto:Grab@indiana.edu36Other62943.64Bartek Schumaker83 Kumaresan StLimaArgentinamailto:Schumaker@labs.comhttp://www.labs.com/~Schumaker3597 8655 2603 6797Graduate School69779.69Nathalie Rychlymailto:Rychly@cti.grmale22Graduate School36448.54Alassane Brown19 Steingart StTallahasseeTurkeymailto:Brown@ac.be4583 2923 3450 3894female56Graduate School9876.00Ardaman Underwood6 Anrig StBerlinUnited Statesmailto:Underwood@ucdavis.edufemale17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edu1889413.77Rosalyn Borrowman71 Mekaouche StCasperUnited Statesmailto:Borrowman@panasonic.comOther18748.51Honari Vendrig59 Dougherty StBolognaUnited Statesmailto:Vendrig@bell-labs.comhttp://www.bell-labs.com/~Vendrig56Other9876.00Magy Yuval52 Penniman StDothanUnited Statesmailto:Yuval@sds.nohttp://www.sds.no/~Yuval6960 5979 2083 3011maleOther147002.31Nikolaos Birdsall20 Morillo StGrenadaUnited Statesmailto:Birdsall@clarkson.edumaleGraduate School48463.16Geraldine Relihan23 Meketon StKahuluiUnited Statesmailto:Relihan@toronto.eduhttp://www.toronto.edu/~RelihanmaleGraduate School28135.59Arup Zhongxiumailto:Zhongxiu@savera.comhttp://www.savera.com/~Zhongxiu8907 5377 1768 2366femaleOther63285.36Roseane Henton21 Falkerngerg StArubaUnited Statesmailto:Henton@csufresno.eduhttp://www.csufresno.edu/~HentonmaleGraduate School43412.47Mehrdad Ewards9 Mosedale StMumbaiUnited Statesmailto:Ewards@edu.hkhttp://www.edu.hk/~Ewards18Graduate School45123.63Radhia Tamches63 Kitano StHonoluluUnited Statesmailto:Tamches@uni-trier.dehttp://www.uni-trier.de/~Tamches6565 7684 2833 7108femaleHigh School27442.54Linore Pradomailto:Prado@uta.edu3098 3930 3792 4349male319876.00Gita Polstermailto:Polster@ask.comhttp://www.ask.com/~Polster52371.54Georgi Adolphe74 Marzullo StCharlestonUnited Statesmailto:Adolphe@verity.comGraduate School34738.51Singaravel Skurczynski41 Zhongxiu StPortlandSwitzerlandmailto:Skurczynski@ntua.grhttp://www.ntua.gr/~Skurczynski9876.00Dhritiman Schapiremailto:Schapire@ucd.iehttp://www.ucd.ie/~Schapire7089 9225 8648 445732Graduate School21453.40Kyujin Thenmozhimailto:Thenmozhi@sbphrd.comhttp://www.sbphrd.com/~Thenmozhi5667 1325 6395 3905femaleCollege18089.31Newton Geibel55 McKinley StWestUnited Statesmailto:Geibel@lbl.gov6955 5513 9649 3373female36High School37546.25Masali Ruedamailto:Rueda@cwi.nlhttp://www.cwi.nl/~Rueda7296 2605 7171 679818College9876.00Mehrdad Abdennadher46 Machin StPortEgyptmailto:Abdennadher@co.inhttp://www.co.in/~Abdennadher4565 8396 6582 1590female19Other49367.09Armond Hebert54 Cooley StFrankfurtCanadamailto:Hebert@rpi.eduhttp://www.rpi.edu/~Hebertfemale67651.65Yoshinari Rajamailto:Raja@nodak.eduhttp://www.nodak.edu/~Raja7807 3048 4554 4266category19female63811.82Lon Leifert45 McKenna StKansasUnited Statesmailto:Leifert@sunysb.eduhttp://www.sunysb.edu/~Leifert6789 8467 1353 581615620.89Frieder Basumailto:Basu@edu.aumale1857760.56Shinji Varhegyi60 Candan StDothanUnited Statesmailto:Varhegyi@forth.grhttp://www.forth.gr/~Varhegyi6982 5985 8455 8370male4522589.34Noelle Ramrasmailto:Ramras@dauphine.frfemale63Other71946.13Herbert Kleiser100 Raghavendra StGeorgeUnited Statesmailto:Kleiser@washington.eduhttp://www.washington.edu/~Kleiser4454 8668 5057 1574female1866561.70Mara Tchuentemailto:Tchuente@telcordia.comhttp://www.telcordia.com/~Tchuentefemale4268999.45Quinlong Usdinmailto:Usdin@imag.fr18High School9876.00Avshalom Attimonellimailto:Attimonelli@uic.eduhttp://www.uic.edu/~Attimonelli7686 9066 7885 14095018437.40Vinot Thomsen2 Kishida StChattanoogaUnited Statesmailto:Thomsen@cornell.eduhttp://www.cornell.edu/~Thomsenfemale33532.36Ravindran Yacobi90 Cools StAlbanyLithuaniamailto:Yacobi@emc.com49Graduate School71359.18Felip Fujisakimailto:Fujisaki@itc.itfemale9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~KoszlajdaGraduate School9876.00Kristof Grafe94 Ingolfsdottir StCopenhagenZimbabwemailto:Grafe@lante.comhttp://www.lante.com/~Grafemale4262287.09Suvo Fiutem69 Luff StWindhoekSouth Africamailto:Fiutem@co.jp5089 1407 5205 5391College9876.00Avinash McNeillmailto:McNeill@verity.com8232 2154 3640 2295femaleOther76543.02Arno Takano2 Jezioranski StAkronUnited Statesmailto:Takano@uwo.cahttp://www.uwo.ca/~Takano1059 2269 8254 75152948525.86Jens Rodigermailto:Rodiger@uqam.cahttp://www.uqam.ca/~Rodiger7366 1702 9623 9871female46814.24Keumog Gellerich43 Gove StGenevaKenyamailto:Gellerich@ab.caGraduate School31807.68Kendra Kumaresan85 Metze StBerlinChristmas Islandmailto:Kumaresan@llnl.govhttp://www.llnl.gov/~Kumaresan3525 1127 3070 9580femaleGraduate School56956.07Sukhmay Schwartzbauermailto:Schwartzbauer@purdue.edu4381 3385 4917 12801830444.53Tamitha Iwanski39 Falgout StFlorenceUnited Statesmailto:Iwanski@auth.grfemale76520.37Yahui Tanemomailto:Tanemo@uqam.ca9174 1888 2967 7251High School48609.71Neelam Passafiumemailto:Passafiume@hitachi.comhttp://www.hitachi.com/~Passafiume2967 5196 1495 5214female459876.00Mehrdad Apperley12 Vinar StBucharestUnited Statesmailto:Apperley@ibm.commale19764.36Jacky Kunieda31 Malabarba StGuaymasUnited Statesmailto:Kunieda@uni-mannheim.de4090 9244 8696 7598male18Graduate School61397.86Atreye Livari18 Sangal StCincinnatiSenegalmailto:Livari@msn.comhttp://www.msn.com/~Livarifemale66College23852.19Nataraj Tasistromailto:Tasistro@ac.jphttp://www.ac.jp/~Tasistro9876.00Pragnesh Takanomailto:Takano@labs.comhttp://www.labs.com/~Takano8238 8564 3820 467851Other23226.04Yoshiki Blumbergmailto:Blumberg@ask.com2926 2408 8275 214344100064.62Oddvar Kamijomailto:Kamijo@ou.eduhttp://www.ou.edu/~Kamijo4434 7244 4200 8479female1848441.07Marleen Hancartmailto:Hancart@unical.it8644 5992 4180 8611High School44591.54Thyagaraju Papadias36 Razdan StProvidencialesUnited Statesmailto:Papadias@uni-mb.si9846 8257 2339 235339920.17Leslie Trystrammailto:Trystram@yahoo.com52371.54Georgi Adolphe74 Marzullo StCharlestonUnited Statesmailto:Adolphe@verity.comfemale48896.64Tinko Reinhart100 Dhagat StZihuatenejoBahrainmailto:Reinhart@crossgain.comhttp://www.crossgain.com/~Reinhart9876.00Dhritiman Schapiremailto:Schapire@ucd.iehttp://www.ucd.ie/~Schapire7089 9225 8648 445746College9876.00Ennio Fanchon44 Beeferman StStockholmVatican City Statemailto:Fanchon@bellatlantic.nethttp://www.bellatlantic.net/~Fanchon78286.48Kunimasa Useltonmailto:Uselton@utexas.edu8164 1978 5759 301018Graduate School61430.09Sabrina Blackallmailto:Blackall@poly.eduhttp://www.poly.edu/~Blackallfemale22High School9876.00Narcis Theodoratos93 Sudkamp StOrlandoDenmarkmailto:Theodoratos@berkeley.educategory2female63811.82Lon Leifert45 McKenna StKansasUnited Statesmailto:Leifert@sunysb.eduhttp://www.sunysb.edu/~Leifert6789 8467 1353 58162920536.39Marit Ozols39 Olivo StViennaUnited Statesmailto:Ozols@clarkson.eduhttp://www.clarkson.edu/~Ozols7994 7972 6209 734915620.89Frieder Basumailto:Basu@edu.au18College23941.65Rajaram Lease100 Preishuber StEastUnited Statesmailto:Lease@imag.frhttp://www.imag.fr/~Lease4948 9378 8238 3600female18Graduate School24387.33Mehrdad Christ96 Servatius StMilwaukeeIndonesiamailto:Christ@newpaltz.eduhttp://www.newpaltz.edu/~Christ52743.14Angel McDermid56 Deves StStockholmUnited Statesmailto:McDermid@ucdavis.eduhttp://www.ucdavis.edu/~McDermidmale2885711.23Maung Rainmailto:Rain@cas.czfemale1866561.70Mara Tchuentemailto:Tchuente@telcordia.comhttp://www.telcordia.com/~Tchuente1875013.99Filipe Pappasmailto:Pappas@ac.at5070 6126 9654 699535Other95431.89Raimondas Holtmanmailto:Holtman@indiana.eduhttp://www.indiana.edu/~Holtman59596.19Jurgen Desprez10 Jushchenko StHarrisburgUnited Statesmailto:Desprez@nyu.edufemaleOther44792.93Hagbae Gershkovich62 Soinard StBrusselsAmerican Samoamailto:Gershkovich@llnl.govhttp://www.llnl.gov/~Gershkovichmale19764.36Jacky Kunieda31 Malabarba StGuaymasUnited Statesmailto:Kunieda@uni-mannheim.de4090 9244 8696 7598female17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edu30Graduate School46548.36Suneeta Baptiste47 Decugis StDurangoUnited Statesmailto:Baptiste@neu.edumaleCollege62028.39Lucien Cunliffe11 Smotroff StMeridianVatican City Statemailto:Cunliffe@mit.edu2139 7205 4141 4885male18College44173.97Takaaki Carrick53 Blom StBrunswickUnited Statesmailto:Carrick@washington.eduhttp://www.washington.edu/~Carrickmale13990.17Faraz Kendallmailto:Kendall@ucf.eduhttp://www.ucf.edu/~Kendall5984 6936 6736 385475125.30Randal Roushmailto:Roush@msstate.edu6224 7382 7689 8766maleCollege45623.75Shooichi Raither67 Andernach StZihuatenejoUnited Statesmailto:Raither@concordia.caOther18748.51Honari Vendrig59 Dougherty StBolognaUnited Statesmailto:Vendrig@bell-labs.comhttp://www.bell-labs.com/~Vendrig9876.00Pragnesh Takanomailto:Takano@labs.comhttp://www.labs.com/~Takano8238 8564 3820 4678maleOther147002.31Nikolaos Birdsall20 Morillo StGrenadaUnited Statesmailto:Birdsall@clarkson.edu18High School47967.41Naoki Osterloh7 Ghandeharizadeh StCairoTanzaniamailto:Osterloh@ask.comhttp://www.ask.com/~Osterloh7741 8229 7494 194329Other56634.76Lai Greenwaldmailto:Greenwald@filelmaker.comhttp://www.filelmaker.com/~Greenwald9722 4263 8015 6083maleGraduate School48463.16Geraldine Relihan23 Meketon StKahuluiUnited Statesmailto:Relihan@toronto.eduhttp://www.toronto.edu/~RelihanOther69247.75Sanford Mergenmailto:Mergen@msstate.edu34032.09Francesca Weismantelmailto:Weismantel@ucla.edu2763 1794 7943 4753female2425157.94Terrill Uchoamailto:Uchoa@co.in2219500.74Fons Grabnermailto:Grabner@indiana.eduhttp://www.indiana.edu/~Grabnerfemale18Other59467.28Hiroyoshi Takanomailto:Takano@utexas.eduhttp://www.utexas.edu/~Takano4727 1469 2323 6305category24female63811.82Lon Leifert45 McKenna StKansasUnited Statesmailto:Leifert@sunysb.eduhttp://www.sunysb.edu/~Leifert6789 8467 1353 581661161.12Shiby Ginneken58 Nisonger StNewcastleUnited Statesmailto:Ginneken@yorku.cahttp://www.yorku.ca/~Ginneken5020 5482 5482 357834541.24Emilo Schahnmailto:Schahn@filemaker.comhttp://www.filemaker.com/~Schahn5877 8225 7127 2717female18Graduate School24387.33Mehrdad Christ96 Servatius StMilwaukeeIndonesiamailto:Christ@newpaltz.eduhttp://www.newpaltz.edu/~Christfemale29College109893.20Bevin Keustermans55 Kluthe StCharlestonUnited Statesmailto:Keustermans@cwru.edu5018437.40Vinot Thomsen2 Kishida StChattanoogaUnited Statesmailto:Thomsen@cornell.eduhttp://www.cornell.edu/~ThomsenHigh School52123.17Athomas Roubieremailto:Roubiere@yorku.cafemale33532.36Ravindran Yacobi90 Cools StAlbanyLithuaniamailto:Yacobi@emc.commale19High School38050.91Mauri Takanomailto:Takano@sbphrd.comhttp://www.sbphrd.com/~Takanomale70373.08Mehrdad Sevcikovamailto:Sevcikova@sds.nohttp://www.sds.no/~Sevcikovamale45College81262.14Changsik Demirozmailto:Demiroz@umd.edu2601 7963 2940 9617female459876.00Mehrdad Apperley12 Vinar StBucharestUnited Statesmailto:Apperley@ibm.comfemale19High School47409.99Wieb Baummailto:Baum@bell-labs.comhttp://www.bell-labs.com/~BaumHigh School32535.03Drago Showaltermailto:Showalter@auc.dkmale19764.36Jacky Kunieda31 Malabarba StGuaymasUnited Statesmailto:Kunieda@uni-mannheim.de4090 9244 8696 7598female17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edumaleCollege9876.00Asmus Hanekemailto:Haneke@unical.ithttp://www.unical.it/~Haneke6994 8976 8481 7963female34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 62989876.00Pragnesh Takanomailto:Takano@labs.comhttp://www.labs.com/~Takano8238 8564 3820 467818High School47967.41Naoki Osterloh7 Ghandeharizadeh StCairoTanzaniamailto:Osterloh@ask.comhttp://www.ask.com/~Osterloh7741 8229 7494 1943femaleCollege32788.80Mitchel Cunliffemailto:Cunliffe@dauphine.frhttp://www.dauphine.fr/~Cunliffe44100064.62Oddvar Kamijomailto:Kamijo@ou.eduhttp://www.ou.edu/~Kamijo4434 7244 4200 8479male3959387.85Allison Balazsmailto:Balazs@ibm.comhttp://www.ibm.com/~Balazs26419.07Yukata Beauducel47 Araya StCharlottesvilleUnited Statesmailto:Beauducel@poznan.plhttp://www.poznan.pl/~Beauducel7393 8354 9466 4534male88737.57Vanathi Takano39 Borowsky StIstanbulUnited Statesmailto:Takano@baylor.edu9748 8717 5684 699032College31589.10Daria McDermid79 Harllee StCalgaryTurkeymailto:McDermid@acm.orghttp://www.acm.org/~McDermidfemale21High School43968.24Yelena Takano10 Luit StAmarilloSaudi Arabiamailto:Takano@uga.edufemaleCollege18089.31Newton Geibel55 McKinley StWestUnited Statesmailto:Geibel@lbl.gov6955 5513 9649 3373female2425157.94Terrill Uchoamailto:Uchoa@co.infemaleCollege66111.11Quanfeng Grahn1 Billinghurst StOrlandoUnited Statesmailto:Grahn@edu.cnhttp://www.edu.cn/~Grahn6176 5125 1462 2376category6female63811.82Lon Leifert45 McKenna StKansasUnited Statesmailto:Leifert@sunysb.eduhttp://www.sunysb.edu/~Leifert6789 8467 1353 5816male71962.16Fillia Wichlaczmailto:Wichlacz@ou.eduhttp://www.ou.edu/~Wichlacz1848 6469 5307 63722920536.39Marit Ozols39 Olivo StViennaUnited Statesmailto:Ozols@clarkson.eduhttp://www.clarkson.edu/~Ozols7994 7972 6209 7349male12885.30Mehrdad Schimmler76 McMorrow StAlbuquerqueUnited Statesmailto:Schimmler@evergreen.eduhttp://www.evergreen.edu/~Schimmler5264 9278 9093 16321852503.82Garnik Takano43 Hendren StMexicoEl Salvadormailto:Takano@ask.comhttp://www.ask.com/~Takano6865 4881 8965 221718College23941.65Rajaram Lease100 Preishuber StEastUnited Statesmailto:Lease@imag.frhttp://www.imag.fr/~Lease4948 9378 8238 3600male2885711.23Maung Rainmailto:Rain@cas.czfemale63Other71946.13Herbert Kleiser100 Raghavendra StGeorgeUnited Statesmailto:Kleiser@washington.eduhttp://www.washington.edu/~Kleiser4454 8668 5057 15743364225.11Arjen Emden44 Goos StLexingtonUnited Statesmailto:Emden@forwiss.dehttp://www.forwiss.de/~Emden2468 4642 9646 5367female1866561.70Mara Tchuentemailto:Tchuente@telcordia.comhttp://www.telcordia.com/~Tchuentefemale24039.95May Ramsden33 Tano StCaracasGeorgiamailto:Ramsden@brandeis.edufemale4268999.45Quinlong Usdinmailto:Usdin@imag.frfemale29College109893.20Bevin Keustermans55 Kluthe StCharlestonUnited Statesmailto:Keustermans@cwru.edu5018437.40Vinot Thomsen2 Kishida StChattanoogaUnited Statesmailto:Thomsen@cornell.eduhttp://www.cornell.edu/~Thomsen49Graduate School71359.18Felip Fujisakimailto:Fujisaki@itc.itfemale9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~Koszlajda32165.04Margrethe Dowellmailto:Dowell@brandeis.eduGraduate School9876.00Kristof Grafe94 Ingolfsdottir StCopenhagenZimbabwemailto:Grafe@lante.comhttp://www.lante.com/~Grafefemale80670.94Shiquan Wixonmailto:Wixon@pi.it47Graduate School9876.00Ebbe Kawashima23 Rinn StHelenaUnited Statesmailto:Kawashima@gmu.edumaleGraduate School18103.99Raja Schroermailto:Schroer@ac.kr35Other95431.89Raimondas Holtmanmailto:Holtman@indiana.eduhttp://www.indiana.edu/~HoltmanfemaleOther76543.02Arno Takano2 Jezioranski StAkronUnited Statesmailto:Takano@uwo.cahttp://www.uwo.ca/~Takano1059 2269 8254 7515male3760708.89Nobuko Manara39 Pigeon StMontgomeryUnited Statesmailto:Manara@imag.frhttp://www.imag.fr/~Manara8751 5605 9270 864618High School23748.90Bette Erevmailto:Erev@nyu.eduhttp://www.nyu.edu/~Erev4584 3851 4962 4766female19High School47409.99Wieb Baummailto:Baum@bell-labs.comhttp://www.bell-labs.com/~Baumfemale44Graduate School62236.54Fano Usmanimailto:Usmani@unf.eduhttp://www.unf.edu/~Usmani4826 7793 3421 79141889413.77Rosalyn Borrowman71 Mekaouche StCasperUnited Statesmailto:Borrowman@panasonic.comfemale24High School53332.77Berardo Radwanmailto:Radwan@clarkson.eduhttp://www.clarkson.edu/~Radwan5362 4892 6180 7214male1947616.43Gurmeet Beounesmailto:Beounes@yorku.camaleCollege62028.39Lucien Cunliffe11 Smotroff StMeridianVatican City Statemailto:Cunliffe@mit.edu2139 7205 4141 4885Other18748.51Honari Vendrig59 Dougherty StBolognaUnited Statesmailto:Vendrig@bell-labs.comhttp://www.bell-labs.com/~VendrigmaleHigh School22127.36Yannik Hamblinmailto:Hamblin@cohera.com56Other9876.00Magy Yuval52 Penniman StDothanUnited Statesmailto:Yuval@sds.nohttp://www.sds.no/~Yuval6960 5979 2083 301118High School47967.41Naoki Osterloh7 Ghandeharizadeh StCairoTanzaniamailto:Osterloh@ask.comhttp://www.ask.com/~Osterloh7741 8229 7494 1943female31313.14Upendra Sueyoshi100 Iwayama StPensacolaUnited Statesmailto:Sueyoshi@msstate.edu1867501.36Terunao Veccia53 Brightwell StToulouseHondurasmailto:Veccia@sbphrd.comfemale48896.64Tinko Reinhart100 Dhagat StZihuatenejoBahrainmailto:Reinhart@crossgain.comhttp://www.crossgain.com/~ReinhartfemaleOther98527.30Witold Straneymailto:Straney@cas.cz2461 6546 4698 2228Other49831.44Shyam Taganskymailto:Tagansky@cwru.eduhttp://www.cwru.edu/~Tagansky44103147.12Jamaludin Pigeot64 Gire StMonroeZambiamailto:Pigeot@toronto.eduhttp://www.toronto.edu/~Pigeot6115 7380 3797 5687female22High School9876.00Narcis Theodoratos93 Sudkamp StOrlandoDenmarkmailto:Theodoratos@berkeley.educategory154137695.50Miron Rivals33 Besancenot StShannonUnited Statesmailto:Rivals@ac.be5183 2729 4304 4288male4522589.34Noelle Ramrasmailto:Ramras@dauphine.frfemale1866561.70Mara Tchuentemailto:Tchuente@telcordia.comhttp://www.telcordia.com/~Tchuentemale18Other84592.63Jayakrishnan Turakainenmailto:Turakainen@evergreen.edu1828898.01Mimmo Stiftermailto:Stifter@edu.cnhttp://www.edu.cn/~Stifter3829 2675 8446 50113456260.67Liesbeth Slutz5 Seneviratne StOntarioUnited Statesmailto:Slutz@berkeley.edu5271 5154 7113 9635Graduate School9876.00Kristof Grafe94 Ingolfsdottir StCopenhagenZimbabwemailto:Grafe@lante.comhttp://www.lante.com/~GrafefemaleGraduate School54668.95Joey Girouxmailto:Giroux@crossgain.comhttp://www.crossgain.com/~Giroux6425 5745 4662 1727female309876.00Gertrud Zschoche77 Lyle StMexicoMacaumailto:Zschoche@microsoft.comhttp://www.microsoft.com/~ZschocheCollege48030.11Apostol Federico100 Fussichen StDublinUnited Statesmailto:Federico@duke.edu9540 9764 8697 345418Graduate School41595.76Nevio Drashansky60 Petry StElUnited Statesmailto:Drashansky@evergreen.edu7712 4592 2474 5574High School9876.00Guoping Ghazaliemailto:Ghazalie@sunysb.eduCollege26548.80Martial Miaramailto:Miara@lante.comfemaleHigh School11071.29Grady Bitnermailto:Bitner@uwindsor.cafemaleHigh School95732.32Hagen Artosimailto:Artosi@clustra.comhttp://www.clustra.com/~Artosi7136 1358 8743 5847female76520.37Yahui Tanemomailto:Tanemo@uqam.ca9174 1888 2967 7251femaleOther44792.93Hagbae Gershkovich62 Soinard StBrusselsAmerican Samoamailto:Gershkovich@llnl.govhttp://www.llnl.gov/~Gershkovichfemale459876.00Mehrdad Apperley12 Vinar StBucharestUnited Statesmailto:Apperley@ibm.comHigh School32535.03Drago Showaltermailto:Showalter@auc.dk23Other32990.55Endre Schmeck91 Hokimoto StKansasUnited Statesmailto:Schmeck@ucf.edu6028 9130 7525 92761835873.68Hercules Fornemailto:Forne@ac.krmale18Other78929.23Pierrette Valiente10 Gurevitch StMulhouseRussian Federationmailto:Valiente@ask.comfemaleCollege32788.80Mitchel Cunliffemailto:Cunliffe@dauphine.frhttp://www.dauphine.fr/~CunliffeCollege79398.49Remigijus Przuljmailto:Przulj@rwth-aachen.defemale2933284.56Chams Michailidis11 Davoren StGainesvilleTanzaniamailto:Michailidis@ntua.grmaleGraduate School43412.47Mehrdad Ewards9 Mosedale StMumbaiUnited Statesmailto:Ewards@edu.hkhttp://www.edu.hk/~Ewardsmale5438040.25Mehrdad Dundas48 Junior StRoanokeUnited Statesmailto:Dundas@ac.ukfemale18129137.70Khedija Yonezawa57 Naixiao StToulouseChilemailto:Yonezawa@clustra.comhttp://www.clustra.com/~Yonezawa2333 2094 5586 4351Graduate School46598.25Adonios Genssler37 Fadgyas StMeridaUnited Statesmailto:Genssler@ou.edu9347 7564 5309 6289Graduate School52300.25Berto Parisi18 Cagley StColumbusTaiwanmailto:Parisi@sfu.cahttp://www.sfu.ca/~Parisi2059 3864 2375 29742983848.21Yuguang Uhrik44 Dahlhaus StVeniceUnited Statesmailto:Uhrik@telcordia.comhttp://www.telcordia.com/~Uhrikfemale21High School43968.24Yelena Takano10 Luit StAmarilloSaudi Arabiamailto:Takano@uga.edufemale67651.65Yoshinari Rajamailto:Raja@nodak.eduhttp://www.nodak.edu/~Raja7807 3048 4554 4266female1857957.32Shiquan Cappellimailto:Cappelli@uiuc.educategory13female9876.00Hiro Bergere94 Nissenbaum StMelbourneUnited Statesmailto:Bergere@prc.comhttp://www.prc.com/~Bergere9941 5989 9575 1127male64243.77Huican Szmurlo52 Ternovskaia StCodyUnited Statesmailto:Szmurlo@ucsd.eduhttp://www.ucsd.edu/~Szmurlo2217 9440 7362 3405female93942.48Abdelilah Chepyzhov93 Milgrom StHuntsvilleUnited Statesmailto:Chepyzhov@fsu.edu8729 1525 7474 9453male14407.23Ljupco Cappello55 Lotkin StConakryBelgiummailto:Cappello@zambeel.comhttp://www.zambeel.com/~Cappello2870444.29Mountaz Ossenbruggenmailto:Ossenbruggen@whizbang.comfemale21Graduate School34281.58Lilly Zuiderveld62 Lamma StElUnited Statesmailto:Zuiderveld@computer.orghttp://www.computer.org/~Zuiderveld26770.70Fun Lattin93 Mutschke StPascoUnited Statesmailto:Lattin@forth.grhttp://www.forth.gr/~LattinOther54432.83Charlotte Clasenmailto:Clasen@evergreen.eduhttp://www.evergreen.edu/~Clasen8141 8906 4540 295733857.61Kristof Pittmailto:Pitt@unf.edu6369 9760 9277 8247female33532.36Ravindran Yacobi90 Cools StAlbanyLithuaniamailto:Yacobi@emc.comGraduate School10605.72Katashi Landymailto:Landy@wisc.eduGraduate School9876.00Kristof Grafe94 Ingolfsdottir StCopenhagenZimbabwemailto:Grafe@lante.comhttp://www.lante.com/~GrafemaleGraduate School18103.99Raja Schroermailto:Schroer@ac.krmale1835487.60Mehrdad Huhdanpaamailto:Huhdanpaa@itc.ithttp://www.itc.it/~Huhdanpaa18Graduate School41595.76Nevio Drashansky60 Petry StElUnited Statesmailto:Drashansky@evergreen.edu7712 4592 2474 5574High School27555.24Rosli Horndaschmailto:Horndasch@bell-labs.com1669 2715 2205 1746female46814.24Keumog Gellerich43 Gove StGenevaKenyamailto:Gellerich@ab.ca3222366.88Eneko Leask63 Lester StAmsterdamMarshall Islandsmailto:Leask@versata.com3921 5024 9469 9080Graduate School9876.00Tokinori Pinzanimailto:Pinzani@forth.grhttp://www.forth.gr/~Pinzani7965 8729 6099 5583femaleHigh School11071.29Grady Bitnermailto:Bitner@uwindsor.cafemale3943323.95Mitsugu Thobenmailto:Thoben@sbphrd.com4537 1155 4156 6649femaleOther44792.93Hagbae Gershkovich62 Soinard StBrusselsAmerican Samoamailto:Gershkovich@llnl.govhttp://www.llnl.gov/~Gershkovichfemale29High School44522.39Rupal Takanomailto:Takano@conclusivestrategies.comfemale459876.00Mehrdad Apperley12 Vinar StBucharestUnited Statesmailto:Apperley@ibm.comfemale14853.15Rostam Littlestone64 Pokoski StParisUnited Statesmailto:Littlestone@sdsc.edu9723 1922 2703 4762female34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 6298male26099.90Sheilah Takano27 Chandna StToledoUnited Statesmailto:Takano@neu.eduhttp://www.neu.edu/~Takano5166 3645 9483 2416female3889088.09Masamitsu Andaleonmailto:Andaleon@cti.grfemaleHigh School57624.85Srihari Murrillmailto:Murrill@edu.cnfemale2933284.56Chams Michailidis11 Davoren StGainesvilleTanzaniamailto:Michailidis@ntua.grfemale18129137.70Khedija Yonezawa57 Naixiao StToulouseChilemailto:Yonezawa@clustra.comhttp://www.clustra.com/~Yonezawa2333 2094 5586 435139920.17Leslie Trystrammailto:Trystram@yahoo.commale58High School53088.84Honglan Hagimontmailto:Hagimont@edu.auhttp://www.edu.au/~Hagimontmale34Other41124.07Hongsheng Marrakchimailto:Marrakchi@edu.au4697 8715 7524 3687male3318777.80Wil Herleymailto:Herley@brown.eduhttp://www.brown.edu/~Herley9077 3456 8000 1843female2425157.94Terrill Uchoamailto:Uchoa@co.in44103147.12Jamaludin Pigeot64 Gire StMonroeZambiamailto:Pigeot@toronto.eduhttp://www.toronto.edu/~Pigeot6115 7380 3797 568735High School104197.29Arne Ohori80 Belleghem StManchesterUnited Statesmailto:Ohori@concordia.ca5057 7242 3265 1360category14male71962.16Fillia Wichlaczmailto:Wichlacz@ou.eduhttp://www.ou.edu/~Wichlacz1848 6469 5307 6372male64243.77Huican Szmurlo52 Ternovskaia StCodyUnited Statesmailto:Szmurlo@ucsd.eduhttp://www.ucsd.edu/~Szmurlo2217 9440 7362 3405male12885.30Mehrdad Schimmler76 McMorrow StAlbuquerqueUnited Statesmailto:Schimmler@evergreen.eduhttp://www.evergreen.edu/~Schimmler5264 9278 9093 16322870444.29Mountaz Ossenbruggenmailto:Ossenbruggen@whizbang.comOther9876.00Bharadwaj Nozawa58 Regoli StWarsawUnited Statesmailto:Nozawa@cas.czhttp://www.cas.cz/~Nozawa3284 7939 4808 3523female3449147.80Frantisek Speltmailto:Spelt@versata.comhttp://www.versata.com/~Spelt3364225.11Arjen Emden44 Goos StLexingtonUnited Statesmailto:Emden@forwiss.dehttp://www.forwiss.de/~Emden2468 4642 9646 5367female28College23070.82Hakim Savarammailto:Savaram@nyu.eduhttp://www.nyu.edu/~Savaramfemale4268999.45Quinlong Usdinmailto:Usdin@imag.fr18High School9876.00Avshalom Attimonellimailto:Attimonelli@uic.eduhttp://www.uic.edu/~Attimonelli7686 9066 7885 1409female29College109893.20Bevin Keustermans55 Kluthe StCharlestonUnited Statesmailto:Keustermans@cwru.edu5018437.40Vinot Thomsen2 Kishida StChattanoogaUnited Statesmailto:Thomsen@cornell.eduhttp://www.cornell.edu/~Thomsen55498.73Mehrdad Barroso23 Grabner StRapidUnited Statesmailto:Barroso@uwo.cafemale33532.36Ravindran Yacobi90 Cools StAlbanyLithuaniamailto:Yacobi@emc.comGraduate School10605.72Katashi Landymailto:Landy@wisc.edufemale70860.02Horward Hammerschmidtmailto:Hammerschmidt@uni-mannheim.defemaleGraduate School54668.95Joey Girouxmailto:Giroux@crossgain.comhttp://www.crossgain.com/~Giroux6425 5745 4662 1727female21College20347.38Isamu Kupiecmailto:Kupiec@twsu.eduhttp://www.twsu.edu/~Kupiec6071 5377 9019 2963College106547.20Khatoun Rankamailto:Ranka@clarkson.eduhttp://www.clarkson.edu/~Ranka38High School50055.21Ermanno Shilovmailto:Shilov@uta.edu9902 7401 7046 402579483.09Rafik Mahmudmailto:Mahmud@sleepycat.comhttp://www.sleepycat.com/~Mahmud18Graduate School30851.14LouAnn Mulvany13 Whitt StBarcelonaUnited Statesmailto:Mulvany@ucla.eduhttp://www.ucla.edu/~Mulvany6788 3544 7141 902541Other9876.00Rattasit Brookman3 Heiman StCalgaryUnited Statesmailto:Brookman@edu.sg8108 2667 4487 40983432403.38Subash Takano2 Stranks StKalamazooSan Marinomailto:Takano@sybase.com8809 7276 9678 1558femaleOther44792.93Hagbae Gershkovich62 Soinard StBrusselsAmerican Samoamailto:Gershkovich@llnl.govhttp://www.llnl.gov/~Gershkovichfemale459876.00Mehrdad Apperley12 Vinar StBucharestUnited Statesmailto:Apperley@ibm.com28College22854.05Mas Bretthauermailto:Bretthauer@uu.se6903 3735 8900 1605male19764.36Jacky Kunieda31 Malabarba StGuaymasUnited Statesmailto:Kunieda@uni-mannheim.de4090 9244 8696 7598female17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edu29864.60Staphane Ariola92 Philbin StAbuGuatemalamailto:Ariola@unf.eduhttp://www.unf.edu/~Ariola8610 1268 6870 4995College79398.49Remigijus Przuljmailto:Przulj@rwth-aachen.demaleGraduate School28135.59Arup Zhongxiumailto:Zhongxiu@savera.comhttp://www.savera.com/~Zhongxiu8907 5377 1768 236626419.07Yukata Beauducel47 Araya StCharlottesvilleUnited Statesmailto:Beauducel@poznan.plhttp://www.poznan.pl/~Beauducel7393 8354 9466 4534High School22905.31Merce Beoumes17 Lattin StLawtonQatarmailto:Beoumes@washington.eduhttp://www.washington.edu/~BeoumesHigh School44591.54Thyagaraju Papadias36 Razdan StProvidencialesUnited Statesmailto:Papadias@uni-mb.si9846 8257 2339 235339920.17Leslie Trystrammailto:Trystram@yahoo.com1867501.36Terunao Veccia53 Brightwell StToulouseHondurasmailto:Veccia@sbphrd.com26College13999.18Yoko Meursmailto:Meurs@rpi.edu4761 5609 3284 980131109.71Stefano Veselmailto:Vesel@hp.comfemale2425157.94Terrill Uchoamailto:Uchoa@co.infemaleOther98527.30Witold Straneymailto:Straney@cas.cz2461 6546 4698 2228Other49831.44Shyam Taganskymailto:Tagansky@cwru.eduhttp://www.cwru.edu/~Tagansky2219500.74Fons Grabnermailto:Grabner@indiana.eduhttp://www.indiana.edu/~Grabner53Graduate School33338.11Kwangjo Benainimailto:Benaini@uga.edufemale22High School9876.00Narcis Theodoratos93 Sudkamp StOrlandoDenmarkmailto:Theodoratos@berkeley.edufemale24Graduate School50690.73Tevfik Shumilov79 Nisiyama StCincinnatiUnited Statesmailto:Shumilov@ou.edu7217 8872 1602 19673324186.28Marco Meszaros49 Wohn StKievSt. Vincent and Grenadinesmailto:Meszaros@ac.athttp://www.ac.at/~Meszaros6309 7243 2721 1636category17male71962.16Fillia Wichlaczmailto:Wichlacz@ou.eduhttp://www.ou.edu/~Wichlacz1848 6469 5307 637234541.24Emilo Schahnmailto:Schahn@filemaker.comhttp://www.filemaker.com/~Schahn5877 8225 7127 2717male2885711.23Maung Rainmailto:Rain@cas.czmale4522589.34Noelle Ramrasmailto:Ramras@dauphine.fr1834791.61Limor Schlichtermailto:Schlichter@dauphine.fr2262 3605 4735 3715female63Other71946.13Herbert Kleiser100 Raghavendra StGeorgeUnited Statesmailto:Kleiser@washington.eduhttp://www.washington.edu/~Kleiser4454 8668 5057 15743364225.11Arjen Emden44 Goos StLexingtonUnited Statesmailto:Emden@forwiss.dehttp://www.forwiss.de/~Emden2468 4642 9646 53672868050.59Rogerio Kuemmerle97 McAfee StStockholmUnited Statesmailto:Kuemmerle@njit.edu4349 1772 6659 58015018437.40Vinot Thomsen2 Kishida StChattanoogaUnited Statesmailto:Thomsen@cornell.eduhttp://www.cornell.edu/~Thomsenfemale33532.36Ravindran Yacobi90 Cools StAlbanyLithuaniamailto:Yacobi@emc.comGraduate School9876.00Kristof Grafe94 Ingolfsdottir StCopenhagenZimbabwemailto:Grafe@lante.comhttp://www.lante.com/~GrafefemaleGraduate School54668.95Joey Girouxmailto:Giroux@crossgain.comhttp://www.crossgain.com/~Giroux6425 5745 4662 17271944492.43Sajoong Bottoni56 Isman StWashingtonUnited Statesmailto:Bottoni@ucsd.eduhttp://www.ucsd.edu/~Bottoni4979 4485 7219 1879College48030.11Apostol Federico100 Fussichen StDublinUnited Statesmailto:Federico@duke.edu9540 9764 8697 3454female49245.92Yongjian Dechter88 Schwederski StGreatUnited Statesmailto:Dechter@ernet.in3385 8194 5484 288579483.09Rafik Mahmudmailto:Mahmud@sleepycat.comhttp://www.sleepycat.com/~Mahmud2948525.86Jens Rodigermailto:Rodiger@uqam.cahttp://www.uqam.ca/~Rodiger7366 1702 9623 987141Other9876.00Rattasit Brookman3 Heiman StCalgaryUnited Statesmailto:Brookman@edu.sg8108 2667 4487 4098Graduate School9876.00Tokinori Pinzanimailto:Pinzani@forth.grhttp://www.forth.gr/~Pinzani7965 8729 6099 55831828245.16Sachem Grab29 Fegeas StSalvadorUnited Statesmailto:Grab@indiana.edu29College85365.36Sushant Baransky39 Varpaaniemi StChicagoZambiamailto:Baransky@du.eduCollege56284.41Burkhard Guardalben83 Iliopoulos StMeridianUnited Statesmailto:Guardalben@nodak.edu4905 6016 2395 4392High School32535.03Drago Showaltermailto:Showalter@auc.dk1889413.77Rosalyn Borrowman71 Mekaouche StCasperUnited Statesmailto:Borrowman@panasonic.com2739491.29Hideo Korachmailto:Korach@cas.czhttp://www.cas.cz/~Korach8091 7556 8996 4369105623.69Yanni Montemayormailto:Montemayor@ac.athttp://www.ac.at/~MontemayormaleCollege9876.00Asmus Hanekemailto:Haneke@unical.ithttp://www.unical.it/~Haneke6994 8976 8481 796329864.60Staphane Ariola92 Philbin StAbuGuatemalamailto:Ariola@unf.eduhttp://www.unf.edu/~Ariola8610 1268 6870 499573540.90Angel Kanamorimailto:Kanamori@telcordia.comhttp://www.telcordia.com/~Kanamori29Other56634.76Lai Greenwaldmailto:Greenwald@filelmaker.comhttp://www.filelmaker.com/~Greenwald9722 4263 8015 6083femaleCollege32788.80Mitchel Cunliffemailto:Cunliffe@dauphine.frhttp://www.dauphine.fr/~CunliffeCollege79398.49Remigijus Przuljmailto:Przulj@rwth-aachen.de44100064.62Oddvar Kamijomailto:Kamijo@ou.eduhttp://www.ou.edu/~Kamijo4434 7244 4200 8479Other69247.75Sanford Mergenmailto:Mergen@msstate.edumale32039.10Guanshan Keustermans5 Hazony StBudapestUnited Statesmailto:Keustermans@upenn.eduhttp://www.upenn.edu/~Keustermans7994 4699 1996 9940579876.00Mandayam Wittlichmailto:Wittlich@ogi.eduhttp://www.ogi.edu/~WittlichmaleGraduate School43412.47Mehrdad Ewards9 Mosedale StMumbaiUnited Statesmailto:Ewards@edu.hkhttp://www.edu.hk/~Ewards29College10406.64Mingzeng Uchoa76 Vongsathorn StAcapulcoUnited Statesmailto:Uchoa@baylor.edu8084 7023 9186 612839920.17Leslie Trystrammailto:Trystram@yahoo.commale4641437.21Chanderjit Takanomailto:Takano@savera.comhttp://www.savera.com/~Takano5097 6993 1970 6644male58High School53088.84Honglan Hagimontmailto:Hagimont@edu.auhttp://www.edu.au/~HagimontOther9876.00Tsunehiro Erdogan58 Tedijanto StCairoUnited Statesmailto:Erdogan@prc.com679876.00Mehrdad Holldobler38 Delaune StMontrealUnited Statesmailto:Holldobler@sunysb.edumale3318777.80Wil Herleymailto:Herley@brown.eduhttp://www.brown.edu/~Herley9077 3456 8000 1843female2425157.94Terrill Uchoamailto:Uchoa@co.inHigh School21237.58Masahito Bratsberg81 Nakatani StBamakoIvory Coastmailto:Bratsberg@savera.comhttp://www.savera.com/~Bratsbergfemale36High School37546.25Masali Ruedamailto:Rueda@cwi.nlhttp://www.cwi.nl/~Rueda7296 2605 7171 679818Graduate School61430.09Sabrina Blackallmailto:Blackall@poly.eduhttp://www.poly.edu/~Blackallcategory1male64243.77Huican Szmurlo52 Ternovskaia StCodyUnited Statesmailto:Szmurlo@ucsd.eduhttp://www.ucsd.edu/~Szmurlo2217 9440 7362 3405male38High School35391.33Samson Scopinich22 Luit StNassauLithuaniamailto:Scopinich@forth.grhttp://www.forth.gr/~Scopinich7744 1014 3146 57873960267.78Sahrah Takano64 Csaba StGuatemalaNepalmailto:Takano@concordia.cahttp://www.concordia.ca/~Takano5018437.40Vinot Thomsen2 Kishida StChattanoogaUnited Statesmailto:Thomsen@cornell.eduhttp://www.cornell.edu/~Thomsenfemale9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~KoszlajdafemaleCollege29478.84Panayotis Kuemmerlemailto:Kuemmerle@edu.sgfemale49245.92Yongjian Dechter88 Schwederski StGreatUnited Statesmailto:Dechter@ernet.in3385 8194 5484 2885female32High School47370.23Manish Jupinmailto:Jupin@uni-muenster.de18Graduate School41595.76Nevio Drashansky60 Petry StElUnited Statesmailto:Drashansky@evergreen.edu7712 4592 2474 5574High School27555.24Rosli Horndaschmailto:Horndasch@bell-labs.com1669 2715 2205 17462948525.86Jens Rodigermailto:Rodiger@uqam.cahttp://www.uqam.ca/~Rodiger7366 1702 9623 9871High School9876.00Guoping Ghazaliemailto:Ghazalie@sunysb.eduCollege9876.00Odoardo Rajaraman39 Backelin StVillahermosaUnited Statesmailto:Rajaraman@ul.pthttp://www.ul.pt/~RajaramanfemaleHigh School95732.32Hagen Artosimailto:Artosi@clustra.comhttp://www.clustra.com/~Artosi7136 1358 8743 5847High School32535.03Drago Showaltermailto:Showalter@auc.dkfemale17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edufemale2652187.04Bokyung Ranganath63 Lanteri StEvansvilleUnited Statesmailto:Ranganath@lante.com6624 8488 5785 495418Other9995.92Martial Chorvat65 Campadelli StMonterreyUnited Statesmailto:Chorvat@zambeel.com4079 3475 5627 8448maleCollege9876.00Asmus Hanekemailto:Haneke@unical.ithttp://www.unical.it/~Haneke6994 8976 8481 7963female34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 6298Other18748.51Honari Vendrig59 Dougherty StBolognaUnited Statesmailto:Vendrig@bell-labs.comhttp://www.bell-labs.com/~Vendrig9876.00Pragnesh Takanomailto:Takano@labs.comhttp://www.labs.com/~Takano8238 8564 3820 4678maleOther147002.31Nikolaos Birdsall20 Morillo StGrenadaUnited Statesmailto:Birdsall@clarkson.edu48128.34Martien Noortwijk25 Melski StProvidencialesUnited Statesmailto:Noortwijk@co.inhttp://www.co.in/~Noortwijk3902 2842 7544 649218High School47967.41Naoki Osterloh7 Ghandeharizadeh StCairoTanzaniamailto:Osterloh@ask.comhttp://www.ask.com/~Osterloh7741 8229 7494 1943female3889088.09Masamitsu Andaleonmailto:Andaleon@cti.grmaleGraduate School28135.59Arup Zhongxiumailto:Zhongxiu@savera.comhttp://www.savera.com/~Zhongxiu8907 5377 1768 2366female17100.56Kyosun Takanomailto:Takano@umb.eduhttp://www.umb.edu/~Takano4914 3209 2337 5612male5438040.25Mehrdad Dundas48 Junior StRoanokeUnited Statesmailto:Dundas@ac.ukmale88737.57Vanathi Takano39 Borowsky StIstanbulUnited Statesmailto:Takano@baylor.edu9748 8717 5684 699043968.43Hausi Henriksson11 Shiota StSeattleUnited Statesmailto:Henriksson@uqam.cahttp://www.uqam.ca/~Henriksson27Graduate School35214.05Tobias Veeraraghavan41 Cavedoni StAguascalientesUnited Statesmailto:Veeraraghavan@umb.edu8969 5456 9679 1336female21High School43968.24Yelena Takano10 Luit StAmarilloSaudi Arabiamailto:Takano@uga.edufemale2425157.94Terrill Uchoamailto:Uchoa@co.inmaleCollege79622.37Yehuda Benkahlamailto:Benkahla@ac.krhttp://www.ac.kr/~Benkahla4916 7773 2536 95043324186.28Marco Meszaros49 Wohn StKievSt. Vincent and Grenadinesmailto:Meszaros@ac.athttp://www.ac.at/~Meszaros6309 7243 2721 1636category20male64243.77Huican Szmurlo52 Ternovskaia StCodyUnited Statesmailto:Szmurlo@ucsd.eduhttp://www.ucsd.edu/~Szmurlo2217 9440 7362 340561161.12Shiby Ginneken58 Nisonger StNewcastleUnited Statesmailto:Ginneken@yorku.cahttp://www.yorku.ca/~Ginneken5020 5482 5482 35782870444.29Mountaz Ossenbruggenmailto:Ossenbruggen@whizbang.commale1857760.56Shinji Varhegyi60 Candan StDothanUnited Statesmailto:Varhegyi@forth.grhttp://www.forth.gr/~Varhegyi6982 5985 8455 837034541.24Emilo Schahnmailto:Schahn@filemaker.comhttp://www.filemaker.com/~Schahn5877 8225 7127 2717maleGraduate School47377.02Sanjai Dangedejmailto:Dangedej@unf.eduhttp://www.unf.edu/~Dangedej1212 9452 9839 41591834791.61Limor Schlichtermailto:Schlichter@dauphine.fr2262 3605 4735 3715female1866561.70Mara Tchuentemailto:Tchuente@telcordia.comhttp://www.telcordia.com/~TchuentemaleHigh School30401.42Yonghoan Baba95 Shioya StGuangzhouUnited Statesmailto:Baba@llnl.govfemale9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~KoszlajdafemaleGraduate School54668.95Joey Girouxmailto:Giroux@crossgain.comhttp://www.crossgain.com/~Giroux6425 5745 4662 172740268.84Zosimo Basmailto:Bas@uta.edu3953 1957 8995 9210maleGraduate School18103.99Raja Schroermailto:Schroer@ac.krfemaleCollege19207.80Bahaa Lortz24 Zaimov StAnchorageUnited Statesmailto:Lortz@toronto.edu1432 1375 9826 3007male72247.13Djordje Milesmailto:Miles@att.com4147 2060 2989 7208High School66838.04Claudine Mihalisinmailto:Mihalisin@cabofalso.comhttp://www.cabofalso.com/~Mihalisin6184 8660 1839 1662female29Other34068.64Katsumasa Takano61 Claudson StKilleenUnited Statesmailto:Takano@uni-mb.sihttp://www.uni-mb.si/~Takano9056 8763 7140 1944female62083.70Jaejin Hauswirth32 Zrehen StJacksonUnited Statesmailto:Hauswirth@pitt.eduhttp://www.pitt.edu/~Hauswirth6218 3179 2347 5721female3943323.95Mitsugu Thobenmailto:Thoben@sbphrd.com4537 1155 4156 6649femaleOther44792.93Hagbae Gershkovich62 Soinard StBrusselsAmerican Samoamailto:Gershkovich@llnl.govhttp://www.llnl.gov/~Gershkovich36Other62943.64Bartek Schumaker83 Kumaresan StLimaArgentinamailto:Schumaker@labs.comhttp://www.labs.com/~Schumaker3597 8655 2603 679761041.02Baruch Karcichmailto:Karcich@inria.frhttp://www.inria.fr/~Karcich28College22854.05Mas Bretthauermailto:Bretthauer@uu.se6903 3735 8900 1605male19764.36Jacky Kunieda31 Malabarba StGuaymasUnited Statesmailto:Kunieda@uni-mannheim.de4090 9244 8696 7598Other20588.39Elham Pelletreau10 Rodding StHermosilloQatarmailto:Pelletreau@ul.ptfemale17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edu18Other9995.92Martial Chorvat65 Campadelli StMonterreyUnited Statesmailto:Chorvat@zambeel.com4079 3475 5627 8448Other18748.51Honari Vendrig59 Dougherty StBolognaUnited Statesmailto:Vendrig@bell-labs.comhttp://www.bell-labs.com/~Vendrigfemale3192544.56Kalappa Melkman4 Bober StJohannesburgFrench Southern Territorymailto:Melkman@uu.sehttp://www.uu.se/~Melkmanfemale2933284.56Chams Michailidis11 Davoren StGainesvilleTanzaniamailto:Michailidis@ntua.grmale319876.00Gita Polstermailto:Polster@ask.comhttp://www.ask.com/~Polster43968.43Hausi Henriksson11 Shiota StSeattleUnited Statesmailto:Henriksson@uqam.cahttp://www.uqam.ca/~Henrikssonmale4641437.21Chanderjit Takanomailto:Takano@savera.comhttp://www.savera.com/~Takano5097 6993 1970 664442High School63869.30Waiman Sakomotomailto:Sakomoto@crossgain.comfemale55Other67566.93Tran Babayanmailto:Babayan@informix.commale1821628.35Mehrdad Granlund2 Huttel StMontgomeryUnited Statesmailto:Granlund@concentric.net6039 9126 8908 863453Graduate School33338.11Kwangjo Benainimailto:Benaini@uga.edu44103147.12Jamaludin Pigeot64 Gire StMonroeZambiamailto:Pigeot@toronto.eduhttp://www.toronto.edu/~Pigeot6115 7380 3797 5687category4male64243.77Huican Szmurlo52 Ternovskaia StCodyUnited Statesmailto:Szmurlo@ucsd.eduhttp://www.ucsd.edu/~Szmurlo2217 9440 7362 34052870444.29Mountaz Ossenbruggenmailto:Ossenbruggen@whizbang.commale2621142.02Elihu Lorys60 Jantke StGenevaUnited Statesmailto:Lorys@berkeley.eduhttp://www.berkeley.edu/~Lorys1834791.61Limor Schlichtermailto:Schlichter@dauphine.fr2262 3605 4735 3715female28College23070.82Hakim Savarammailto:Savaram@nyu.eduhttp://www.nyu.edu/~Savaramfemale29College109893.20Bevin Keustermans55 Kluthe StCharlestonUnited Statesmailto:Keustermans@cwru.edu55498.73Mehrdad Barroso23 Grabner StRapidUnited Statesmailto:Barroso@uwo.cafemale33532.36Ravindran Yacobi90 Cools StAlbanyLithuaniamailto:Yacobi@emc.comfemale9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~Koszlajda50Other55383.43Nidapan Stassinopoulosmailto:Stassinopoulos@lante.com59420.56Ziqiang Businaro21 Coatta StMontrealUnited Statesmailto:Businaro@indiana.eduhttp://www.indiana.edu/~Businaro1875013.99Filipe Pappasmailto:Pappas@ac.at5070 6126 9654 6995maleGraduate School18103.99Raja Schroermailto:Schroer@ac.krmale70373.08Mehrdad Sevcikovamailto:Sevcikova@sds.nohttp://www.sds.no/~Sevcikovamale3760708.89Nobuko Manara39 Pigeon StMontgomeryUnited Statesmailto:Manara@imag.frhttp://www.imag.fr/~Manara8751 5605 9270 8646femaleHigh School9901.94Kaisa McNaught60 Kader StButteUnited Statesmailto:McNaught@ufl.edu2948525.86Jens Rodigermailto:Rodiger@uqam.cahttp://www.uqam.ca/~Rodiger7366 1702 9623 9871College26548.80Martial Miaramailto:Miara@lante.comfemale3943323.95Mitsugu Thobenmailto:Thoben@sbphrd.com4537 1155 4156 6649female459876.00Mehrdad Apperley12 Vinar StBucharestUnited Statesmailto:Apperley@ibm.commale71019.05Ayakannu Stemannmailto:Stemann@unizh.ch25High School36970.64Elihu Salinasmailto:Salinas@ucdavis.eduhttp://www.ucdavis.edu/~Salinas1889413.77Rosalyn Borrowman71 Mekaouche StCasperUnited Statesmailto:Borrowman@panasonic.commaleCollege9876.00Asmus Hanekemailto:Haneke@unical.ithttp://www.unical.it/~Haneke6994 8976 8481 7963maleCollege62028.39Lucien Cunliffe11 Smotroff StMeridianVatican City Statemailto:Cunliffe@mit.edu2139 7205 4141 4885male18College44173.97Takaaki Carrick53 Blom StBrunswickUnited Statesmailto:Carrick@washington.eduhttp://www.washington.edu/~Carrick75125.30Randal Roushmailto:Roush@msstate.edu6224 7382 7689 8766Other18748.51Honari Vendrig59 Dougherty StBolognaUnited Statesmailto:Vendrig@bell-labs.comhttp://www.bell-labs.com/~Vendrigmale32039.10Guanshan Keustermans5 Hazony StBudapestUnited Statesmailto:Keustermans@upenn.eduhttp://www.upenn.edu/~Keustermans7994 4699 1996 9940female1848441.07Marleen Hancartmailto:Hancart@unical.it8644 5992 4180 8611female2933284.56Chams Michailidis11 Davoren StGainesvilleTanzaniamailto:Michailidis@ntua.gr42582.85Herb Heisermanmailto:Heiserman@gatech.edu1770 6901 9126 7641male319876.00Gita Polstermailto:Polster@ask.comhttp://www.ask.com/~Polsterfemale18High School32207.29Jessie Courymailto:Coury@computer.orghttp://www.computer.org/~Coury3948 9942 2047 3209maleOther9876.00Benny Maraist38 Coscoy StVeniceUnited Statesmailto:Maraist@acm.org1444 4160 5898 766831377.71Douadi Newton100 Deb StTexarkanaUnited Statesmailto:Newton@acm.org34College71769.15LuoQuan Takano94 Cejtlin StToulouseSomaliamailto:Takano@lbl.gov3815 2171 1002 1862female2425157.94Terrill Uchoamailto:Uchoa@co.in9876.00Bernd Kruschinski16 Dienes StChicagoUnited Statesmailto:Kruschinski@unizh.chhttp://www.unizh.ch/~Kruschinskimale259876.00Hava Sieglmailto:Siegl@sun.com46College9876.00Ennio Fanchon44 Beeferman StStockholmVatican City Statemailto:Fanchon@bellatlantic.nethttp://www.bellatlantic.net/~Fanchon18Graduate School61430.09Sabrina Blackallmailto:Blackall@poly.eduhttp://www.poly.edu/~Blackallcategory3female93942.48Abdelilah Chepyzhov93 Milgrom StHuntsvilleUnited Statesmailto:Chepyzhov@fsu.edu8729 1525 7474 9453female32289.52Lynne Chongmailto:Chong@brandeis.edu52743.14Angel McDermid56 Deves StStockholmUnited Statesmailto:McDermid@ucdavis.eduhttp://www.ucdavis.edu/~McDermidfemale21Graduate School34281.58Lilly Zuiderveld62 Lamma StElUnited Statesmailto:Zuiderveld@computer.orghttp://www.computer.org/~Zuiderveldmale4522589.34Noelle Ramrasmailto:Ramras@dauphine.frfemale20230.96Radhia Lakshmipathymailto:Lakshmipathy@clustra.comfemale3449147.80Frantisek Speltmailto:Spelt@versata.comhttp://www.versata.com/~Speltfemale21College20347.38Isamu Kupiecmailto:Kupiec@twsu.eduhttp://www.twsu.edu/~Kupiec6071 5377 9019 296340268.84Zosimo Basmailto:Bas@uta.edu3953 1957 8995 92101944492.43Sajoong Bottoni56 Isman StWashingtonUnited Statesmailto:Bottoni@ucsd.eduhttp://www.ucsd.edu/~Bottoni4979 4485 7219 1879High School66838.04Claudine Mihalisinmailto:Mihalisin@cabofalso.comhttp://www.cabofalso.com/~Mihalisin6184 8660 1839 166218Graduate School41595.76Nevio Drashansky60 Petry StElUnited Statesmailto:Drashansky@evergreen.edu7712 4592 2474 557418Graduate School30851.14LouAnn Mulvany13 Whitt StBarcelonaUnited Statesmailto:Mulvany@ucla.eduhttp://www.ucla.edu/~Mulvany6788 3544 7141 9025female29Other34068.64Katsumasa Takano61 Claudson StKilleenUnited Statesmailto:Takano@uni-mb.sihttp://www.uni-mb.si/~Takano9056 8763 7140 1944College26548.80Martial Miaramailto:Miara@lante.comfemale76520.37Yahui Tanemomailto:Tanemo@uqam.ca9174 1888 2967 7251femaleOther44792.93Hagbae Gershkovich62 Soinard StBrusselsAmerican Samoamailto:Gershkovich@llnl.govhttp://www.llnl.gov/~Gershkovichfemale29High School44522.39Rupal Takanomailto:Takano@conclusivestrategies.comHigh School48609.71Neelam Passafiumemailto:Passafiume@hitachi.comhttp://www.hitachi.com/~Passafiume2967 5196 1495 5214female19High School47409.99Wieb Baummailto:Baum@bell-labs.comhttp://www.bell-labs.com/~Baummale22Graduate School36448.54Alassane Brown19 Steingart StTallahasseeTurkeymailto:Brown@ac.be4583 2923 3450 38941889413.77Rosalyn Borrowman71 Mekaouche StCasperUnited Statesmailto:Borrowman@panasonic.com18Graduate School21774.64Odinaldo Couclelismailto:Couclelis@savera.com4312 2173 2656 5795female24High School53332.77Berardo Radwanmailto:Radwan@clarkson.eduhttp://www.clarkson.edu/~Radwan5362 4892 6180 7214maleCollege62028.39Lucien Cunliffe11 Smotroff StMeridianVatican City Statemailto:Cunliffe@mit.edu2139 7205 4141 4885male18College44173.97Takaaki Carrick53 Blom StBrunswickUnited Statesmailto:Carrick@washington.eduhttp://www.washington.edu/~CarrickHigh School12698.35Willemien Nollmann94 Finsterwalder StMinneapolisUnited Statesmailto:Nollmann@ucd.iehttp://www.ucd.ie/~Nollmann1120 5614 6835 1026Other18748.51Honari Vendrig59 Dougherty StBolognaUnited Statesmailto:Vendrig@bell-labs.comhttp://www.bell-labs.com/~VendrigmaleHigh School22127.36Yannik Hamblinmailto:Hamblin@cohera.commaleOther147002.31Nikolaos Birdsall20 Morillo StGrenadaUnited Statesmailto:Birdsall@clarkson.edumale32039.10Guanshan Keustermans5 Hazony StBudapestUnited Statesmailto:Keustermans@upenn.eduhttp://www.upenn.edu/~Keustermans7994 4699 1996 9940female1848441.07Marleen Hancartmailto:Hancart@unical.it8644 5992 4180 8611male25728.38Priyadarshan Burgert53 Liberman StCorpusReunionmailto:Burgert@savera.comhttp://www.savera.com/~BurgertmaleGraduate School43412.47Mehrdad Ewards9 Mosedale StMumbaiUnited Statesmailto:Ewards@edu.hkhttp://www.edu.hk/~Ewardsfemale319876.00Arvola Takanomailto:Takano@fernuni-hagen.demale5438040.25Mehrdad Dundas48 Junior StRoanokeUnited Statesmailto:Dundas@ac.ukfemale18129137.70Khedija Yonezawa57 Naixiao StToulouseChilemailto:Yonezawa@clustra.comhttp://www.clustra.com/~Yonezawa2333 2094 5586 4351male88737.57Vanathi Takano39 Borowsky StIstanbulUnited Statesmailto:Takano@baylor.edu9748 8717 5684 699043968.43Hausi Henriksson11 Shiota StSeattleUnited Statesmailto:Henriksson@uqam.cahttp://www.uqam.ca/~HenrikssonfemaleHigh School38558.87Samantha Lofgrenmailto:Lofgren@telcordia.comhttp://www.telcordia.com/~Lofgrenmale4641437.21Chanderjit Takanomailto:Takano@savera.comhttp://www.savera.com/~Takano5097 6993 1970 6644female1837579.45Lena Haworth55 Sanabria StMoscowUnited Statesmailto:Haworth@ac.behttp://www.ac.be/~Haworthfemale2425157.94Terrill Uchoamailto:Uchoa@co.inOther49831.44Shyam Taganskymailto:Tagansky@cwru.eduhttp://www.cwru.edu/~Taganskycategory5female93942.48Abdelilah Chepyzhov93 Milgrom StHuntsvilleUnited Statesmailto:Chepyzhov@fsu.edu8729 1525 7474 94532920536.39Marit Ozols39 Olivo StViennaUnited Statesmailto:Ozols@clarkson.eduhttp://www.clarkson.edu/~Ozols7994 7972 6209 7349male38High School35391.33Samson Scopinich22 Luit StNassauLithuaniamailto:Scopinich@forth.grhttp://www.forth.gr/~Scopinich7744 1014 3146 5787female21Graduate School34281.58Lilly Zuiderveld62 Lamma StElUnited Statesmailto:Zuiderveld@computer.orghttp://www.computer.org/~Zuiderveldmale2885711.23Maung Rainmailto:Rain@cas.czfemale9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~Koszlajda59420.56Ziqiang Businaro21 Coatta StMontrealUnited Statesmailto:Businaro@indiana.eduhttp://www.indiana.edu/~Businarofemale72664.29Celia Bahk32 Knauer StOuagadougouUnited Statesmailto:Bahk@fsu.eduhttp://www.fsu.edu/~Bahk1944492.43Sajoong Bottoni56 Isman StWashingtonUnited Statesmailto:Bottoni@ucsd.eduhttp://www.ucsd.edu/~Bottoni4979 4485 7219 187935Other95431.89Raimondas Holtmanmailto:Holtman@indiana.eduhttp://www.indiana.edu/~HoltmanmaleGraduate School9876.00Andreas Weijland80 Okasaki StBatonUnited Statesmailto:Weijland@conclusivestrategies.comhttp://www.conclusivestrategies.com/~Weijland59596.19Jurgen Desprez10 Jushchenko StHarrisburgUnited Statesmailto:Desprez@nyu.edu18Graduate School41595.76Nevio Drashansky60 Petry StElUnited Statesmailto:Drashansky@evergreen.edu7712 4592 2474 55742487581.80Kazuyo Mouzakismailto:Mouzakis@ucla.eduhttp://www.ucla.edu/~Mouzakis1208 4748 3095 6188High School27555.24Rosli Horndaschmailto:Horndasch@bell-labs.com1669 2715 2205 1746femaleHigh School9901.94Kaisa McNaught60 Kader StButteUnited Statesmailto:McNaught@ufl.edumale3727628.58Duri Allisonmailto:Allison@microsoft.comhttp://www.microsoft.com/~AllisonfemaleCollege52198.30Eleanna Loulerguemailto:Loulergue@imag.fr32College9876.00Lizya Takanomailto:Takano@sbphrd.comhttp://www.sbphrd.com/~Takano1201 1542 8852 7037male45College81262.14Changsik Demirozmailto:Demiroz@umd.edu2601 7963 2940 9617female76520.37Yahui Tanemomailto:Tanemo@uqam.ca9174 1888 2967 7251female17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edu1889413.77Rosalyn Borrowman71 Mekaouche StCasperUnited Statesmailto:Borrowman@panasonic.com30Graduate School46548.36Suneeta Baptiste47 Decugis StDurangoUnited Statesmailto:Baptiste@neu.edumaleCollege62028.39Lucien Cunliffe11 Smotroff StMeridianVatican City Statemailto:Cunliffe@mit.edu2139 7205 4141 4885female34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 6298Other18748.51Honari Vendrig59 Dougherty StBolognaUnited Statesmailto:Vendrig@bell-labs.comhttp://www.bell-labs.com/~Vendrig18High School47967.41Naoki Osterloh7 Ghandeharizadeh StCairoTanzaniamailto:Osterloh@ask.comhttp://www.ask.com/~Osterloh7741 8229 7494 1943male32039.10Guanshan Keustermans5 Hazony StBudapestUnited Statesmailto:Keustermans@upenn.eduhttp://www.upenn.edu/~Keustermans7994 4699 1996 9940maleGraduate School28135.59Arup Zhongxiumailto:Zhongxiu@savera.comhttp://www.savera.com/~Zhongxiu8907 5377 1768 2366female18Graduate School36875.04Vwani Guck59 Carapuca StTulsaUnited Statesmailto:Guck@ubs.comhttp://www.ubs.com/~Guck8540 5460 1107 6135male5438040.25Mehrdad Dundas48 Junior StRoanokeUnited Statesmailto:Dundas@ac.uk42582.85Herb Heisermanmailto:Heiserman@gatech.edu1770 6901 9126 764139920.17Leslie Trystrammailto:Trystram@yahoo.comfemale1837579.45Lena Haworth55 Sanabria StMoscowUnited Statesmailto:Haworth@ac.behttp://www.ac.be/~HaworthfemaleOther9876.00Ashish Rattanmailto:Rattan@hp.comhttp://www.hp.com/~Rattan32Graduate School21453.40Kyujin Thenmozhimailto:Thenmozhi@sbphrd.comhttp://www.sbphrd.com/~Thenmozhi5667 1325 6395 3905female2425157.94Terrill Uchoamailto:Uchoa@co.in28036.78Sadegh Borgelt96 Tapken StCopenhagenUnited Statesmailto:Borgelt@yahoo.comhttp://www.yahoo.com/~Borgelt3641 4212 4374 193053Graduate School33338.11Kwangjo Benainimailto:Benaini@uga.edu44103147.12Jamaludin Pigeot64 Gire StMonroeZambiamailto:Pigeot@toronto.eduhttp://www.toronto.edu/~Pigeot6115 7380 3797 5687female67651.65Yoshinari Rajamailto:Raja@nodak.eduhttp://www.nodak.edu/~Raja7807 3048 4554 4266category232920536.39Marit Ozols39 Olivo StViennaUnited Statesmailto:Ozols@clarkson.eduhttp://www.clarkson.edu/~Ozols7994 7972 6209 7349male14407.23Ljupco Cappello55 Lotkin StConakryBelgiummailto:Cappello@zambeel.comhttp://www.zambeel.com/~CappellofemaleOther40371.20Tonia Kamble69 Westby StAnchorageMyanmarmailto:Kamble@cmu.edu4335 3345 5137 36373210607.38Benedita Matternmailto:Mattern@evergreen.eduhttp://www.evergreen.edu/~Mattern3960267.78Sahrah Takano64 Csaba StGuatemalaNepalmailto:Takano@concordia.cahttp://www.concordia.ca/~Takano5018437.40Vinot Thomsen2 Kishida StChattanoogaUnited Statesmailto:Thomsen@cornell.eduhttp://www.cornell.edu/~Thomsen33857.61Kristof Pittmailto:Pitt@unf.edu6369 9760 9277 824755498.73Mehrdad Barroso23 Grabner StRapidUnited Statesmailto:Barroso@uwo.camale19High School38050.91Mauri Takanomailto:Takano@sbphrd.comhttp://www.sbphrd.com/~Takanomale34Graduate School9876.00Keijo Hmelo11 Dulong StGuatemalaNigermailto:Hmelo@cnr.ithttp://www.cnr.it/~Hmelo8292 3598 3299 9658female9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~KoszlajdafemaleGraduate School54668.95Joey Girouxmailto:Giroux@crossgain.comhttp://www.crossgain.com/~Giroux6425 5745 4662 172747Graduate School9876.00Ebbe Kawashima23 Rinn StHelenaUnited Statesmailto:Kawashima@gmu.edumale72247.13Djordje Milesmailto:Miles@att.com4147 2060 2989 7208Graduate School61917.13Isidore Takano32 Sambasivam StMinneapolisUnited Statesmailto:Takano@computer.orghttp://www.computer.org/~Takano9963 9779 2196 523218Graduate School41595.76Nevio Drashansky60 Petry StElUnited Statesmailto:Drashansky@evergreen.edu7712 4592 2474 5574femaleOther76543.02Arno Takano2 Jezioranski StAkronUnited Statesmailto:Takano@uwo.cahttp://www.uwo.ca/~Takano1059 2269 8254 7515459876.00Innes Ulfberg13 Kabat StSantiagoUnited Statesmailto:Ulfberg@propel.comhttp://www.propel.com/~UlfbergfemaleGraduate School56956.07Sukhmay Schwartzbauermailto:Schwartzbauer@purdue.edu4381 3385 4917 1280female3943323.95Mitsugu Thobenmailto:Thoben@sbphrd.com4537 1155 4156 6649High School48609.71Neelam Passafiumemailto:Passafiume@hitachi.comhttp://www.hitachi.com/~Passafiume2967 5196 1495 5214male19764.36Jacky Kunieda31 Malabarba StGuaymasUnited Statesmailto:Kunieda@uni-mannheim.de4090 9244 8696 7598female17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edufemale3550655.89Liujian Stanger11 Nollmann StKahuluiMayottemailto:Stanger@ubs.com1889413.77Rosalyn Borrowman71 Mekaouche StCasperUnited Statesmailto:Borrowman@panasonic.commaleCollege62028.39Lucien Cunliffe11 Smotroff StMeridianVatican City Statemailto:Cunliffe@mit.edu2139 7205 4141 4885male13990.17Faraz Kendallmailto:Kendall@ucf.eduhttp://www.ucf.edu/~Kendall5984 6936 6736 3854maleOther147002.31Nikolaos Birdsall20 Morillo StGrenadaUnited Statesmailto:Birdsall@clarkson.eduCollege79398.49Remigijus Przuljmailto:Przulj@rwth-aachen.demaleGraduate School48463.16Geraldine Relihan23 Meketon StKahuluiUnited Statesmailto:Relihan@toronto.eduhttp://www.toronto.edu/~Relihanmale32039.10Guanshan Keustermans5 Hazony StBudapestUnited Statesmailto:Keustermans@upenn.eduhttp://www.upenn.edu/~Keustermans7994 4699 1996 9940579876.00Mandayam Wittlichmailto:Wittlich@ogi.eduhttp://www.ogi.edu/~Wittlichfemale1848441.07Marleen Hancartmailto:Hancart@unical.it8644 5992 4180 8611Graduate School21339.80Vesna Stabell42 Trauth StPragueLatviamailto:Stabell@yahoo.comhttp://www.yahoo.com/~StabellfemaleCollege41385.84Xuejia Matternmailto:Mattern@sun.comhttp://www.sun.com/~Mattern5224 7860 2997 1000male88737.57Vanathi Takano39 Borowsky StIstanbulUnited Statesmailto:Takano@baylor.edu9748 8717 5684 6990High School44591.54Thyagaraju Papadias36 Razdan StProvidencialesUnited Statesmailto:Papadias@uni-mb.si9846 8257 2339 2353male319876.00Gita Polstermailto:Polster@ask.comhttp://www.ask.com/~Polsterfemale53Other9876.00Michaela DeMori24 Schmidmaier StLaUnited Statesmailto:DeMori@mit.eduhttp://www.mit.edu/~DeMoriGraduate School86363.75Sinisa Takano20 Philipose StBaselUnited Statesmailto:Takano@uwo.cahttp://www.uwo.ca/~Takano2838 1561 4278 7793male34Other41124.07Hongsheng Marrakchimailto:Marrakchi@edu.au4697 8715 7524 368734032.09Francesca Weismantelmailto:Weismantel@ucla.edu2763 1794 7943 475331109.71Stefano Veselmailto:Vesel@hp.commale18High School11680.33Hairuo Babymailto:Baby@compaq.comhttp://www.compaq.com/~Baby5040 8822 2575 9695College9876.00Siau Luskmailto:Lusk@dauphine.frhttp://www.dauphine.fr/~Lusk9351 9086 1389 9982female36High School37546.25Masali Ruedamailto:Rueda@cwi.nlhttp://www.cwi.nl/~Rueda7296 2605 7171 67983324186.28Marco Meszaros49 Wohn StKievSt. Vincent and Grenadinesmailto:Meszaros@ac.athttp://www.ac.at/~Meszaros6309 7243 2721 1636category212870444.29Mountaz Ossenbruggenmailto:Ossenbruggen@whizbang.com52743.14Angel McDermid56 Deves StStockholmUnited Statesmailto:McDermid@ucdavis.eduhttp://www.ucdavis.edu/~McDermid3831289.78Yongqiao Shanbhoguemailto:Shanbhogue@newpaltz.edufemale3949111.85Mohammad Varker71 Linzer StLomeUnited Statesmailto:Varker@panasonic.com2868050.59Rogerio Kuemmerle97 McAfee StStockholmUnited Statesmailto:Kuemmerle@njit.edu4349 1772 6659 5801female1866561.70Mara Tchuentemailto:Tchuente@telcordia.comhttp://www.telcordia.com/~Tchuentefemale29College109893.20Bevin Keustermans55 Kluthe StCharlestonUnited Statesmailto:Keustermans@cwru.edu5018437.40Vinot Thomsen2 Kishida StChattanoogaUnited Statesmailto:Thomsen@cornell.eduhttp://www.cornell.edu/~Thomsenfemale18Other50634.45Sidd Zfiramailto:Zfira@uga.eduhttp://www.uga.edu/~ZfiramaleHigh School29348.51Yael Ritceymailto:Ritcey@csufresno.eduhttp://www.csufresno.edu/~Ritcey4175 3581 3728 5320femaleGraduate School54668.95Joey Girouxmailto:Giroux@crossgain.comhttp://www.crossgain.com/~Giroux6425 5745 4662 1727College106547.20Khatoun Rankamailto:Ranka@clarkson.eduhttp://www.clarkson.edu/~RankafemaleOther44792.93Hagbae Gershkovich62 Soinard StBrusselsAmerican Samoamailto:Gershkovich@llnl.govhttp://www.llnl.gov/~Gershkovichfemale29High School44522.39Rupal Takanomailto:Takano@conclusivestrategies.comHigh School32535.03Drago Showaltermailto:Showalter@auc.dkfemale56Graduate School9876.00Ardaman Underwood6 Anrig StBerlinUnited Statesmailto:Underwood@ucdavis.edu25High School36970.64Elihu Salinasmailto:Salinas@ucdavis.eduhttp://www.ucdavis.edu/~SalinasOther20588.39Elham Pelletreau10 Rodding StHermosilloQatarmailto:Pelletreau@ul.ptfemale17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.eduCollege20705.54Jianli Gide15 Bergevin StToledoUnited Statesmailto:Gide@fsu.eduhttp://www.fsu.edu/~Gide6804 8139 3232 3580maleHigh School61094.02Mehrdad Bierbaum77 Heyderhoff StIdahoUnited Statesmailto:Bierbaum@sdsc.edu5223 3221 1166 7010female34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 629830College9876.00Asha Dumasmailto:Dumas@twsu.edufemale3889088.09Masamitsu Andaleonmailto:Andaleon@cti.grmale25728.38Priyadarshan Burgert53 Liberman StCorpusReunionmailto:Burgert@savera.comhttp://www.savera.com/~Burgertmale88737.57Vanathi Takano39 Borowsky StIstanbulUnited Statesmailto:Takano@baylor.edu9748 8717 5684 699043968.43Hausi Henriksson11 Shiota StSeattleUnited Statesmailto:Henriksson@uqam.cahttp://www.uqam.ca/~HenrikssonOther9876.00Tsunehiro Erdogan58 Tedijanto StCairoUnited Statesmailto:Erdogan@prc.comfemaleCollege18089.31Newton Geibel55 McKinley StWestUnited Statesmailto:Geibel@lbl.gov6955 5513 9649 3373female2425157.94Terrill Uchoamailto:Uchoa@co.in28036.78Sadegh Borgelt96 Tapken StCopenhagenUnited Statesmailto:Borgelt@yahoo.comhttp://www.yahoo.com/~Borgelt3641 4212 4374 1930College9876.00Siau Luskmailto:Lusk@dauphine.frhttp://www.dauphine.fr/~Lusk9351 9086 1389 998241High School90426.38Nieves Wicklinemailto:Wickline@oracle.com1216 7004 4794 4730female67651.65Yoshinari Rajamailto:Raja@nodak.eduhttp://www.nodak.edu/~Raja7807 3048 4554 4266category162870444.29Mountaz Ossenbruggenmailto:Ossenbruggen@whizbang.comfemale32289.52Lynne Chongmailto:Chong@brandeis.edumale4522589.34Noelle Ramrasmailto:Ramras@dauphine.fr26770.70Fun Lattin93 Mutschke StPascoUnited Statesmailto:Lattin@forth.grhttp://www.forth.gr/~Lattin3364225.11Arjen Emden44 Goos StLexingtonUnited Statesmailto:Emden@forwiss.dehttp://www.forwiss.de/~Emden2468 4642 9646 5367female28College23070.82Hakim Savarammailto:Savaram@nyu.eduhttp://www.nyu.edu/~SavarammaleHigh School30401.42Yonghoan Baba95 Shioya StGuangzhouUnited Statesmailto:Baba@llnl.gov3960267.78Sahrah Takano64 Csaba StGuatemalaNepalmailto:Takano@concordia.cahttp://www.concordia.ca/~Takanofemale9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~Koszlajdafemale21College20347.38Isamu Kupiecmailto:Kupiec@twsu.eduhttp://www.twsu.edu/~Kupiec6071 5377 9019 2963High School41734.15Jago Mayerwiesermailto:Mayerwieser@arizona.edu1875013.99Filipe Pappasmailto:Pappas@ac.at5070 6126 9654 6995female49245.92Yongjian Dechter88 Schwederski StGreatUnited Statesmailto:Dechter@ernet.in3385 8194 5484 2885male72247.13Djordje Milesmailto:Miles@att.com4147 2060 2989 7208female46814.24Keumog Gellerich43 Gove StGenevaKenyamailto:Gellerich@ab.caCollege26548.80Martial Miaramailto:Miara@lante.commale22Graduate School36448.54Alassane Brown19 Steingart StTallahasseeTurkeymailto:Brown@ac.be4583 2923 3450 389424College44907.27Chinya Uludagmailto:Uludag@airmail.netfemale17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edufemale24High School53332.77Berardo Radwanmailto:Radwan@clarkson.eduhttp://www.clarkson.edu/~Radwan5362 4892 6180 72142739491.29Hideo Korachmailto:Korach@cas.czhttp://www.cas.cz/~Korach8091 7556 8996 4369maleCollege9876.00Asmus Hanekemailto:Haneke@unical.ithttp://www.unical.it/~Haneke6994 8976 8481 7963Other18748.51Honari Vendrig59 Dougherty StBolognaUnited Statesmailto:Vendrig@bell-labs.comhttp://www.bell-labs.com/~Vendrig56Other9876.00Magy Yuval52 Penniman StDothanUnited Statesmailto:Yuval@sds.nohttp://www.sds.no/~Yuval6960 5979 2083 3011maleOther147002.31Nikolaos Birdsall20 Morillo StGrenadaUnited Statesmailto:Birdsall@clarkson.edu29Other56634.76Lai Greenwaldmailto:Greenwald@filelmaker.comhttp://www.filelmaker.com/~Greenwald9722 4263 8015 6083female19Graduate School17213.74Murthy Kobsa3 Marefat StFortalezaUnited Statesmailto:Kobsa@cmu.eduhttp://www.cmu.edu/~Kobsa9601 9505 5627 9097female31313.14Upendra Sueyoshi100 Iwayama StPensacolaUnited Statesmailto:Sueyoshi@msstate.edufemale18129137.70Khedija Yonezawa57 Naixiao StToulouseChilemailto:Yonezawa@clustra.comhttp://www.clustra.com/~Yonezawa2333 2094 5586 4351femaleOther9876.00Mehrdad Osgood18 Bias StRoanokePortugalmailto:Osgood@gte.comhttp://www.gte.com/~Osgood39920.17Leslie Trystrammailto:Trystram@yahoo.commale58High School53088.84Honglan Hagimontmailto:Hagimont@edu.auhttp://www.edu.au/~HagimontGraduate School52300.25Berto Parisi18 Cagley StColumbusTaiwanmailto:Parisi@sfu.cahttp://www.sfu.ca/~Parisi2059 3864 2375 2974female2425157.94Terrill Uchoamailto:Uchoa@co.infemale4430932.28Mingzeng Fanchonmailto:Fanchon@ucsb.eduhttp://www.ucsb.edu/~Fanchon2370 1296 2256 476935High School104197.29Arne Ohori80 Belleghem StManchesterUnited Statesmailto:Ohori@concordia.ca5057 7242 3265 136041High School90426.38Nieves Wicklinemailto:Wickline@oracle.com1216 7004 4794 4730female61896.87Gor Pratimailto:Prati@uni-muenchen.decategory72870444.29Mountaz Ossenbruggenmailto:Ossenbruggen@whizbang.comfemale21Graduate School34281.58Lilly Zuiderveld62 Lamma StElUnited Statesmailto:Zuiderveld@computer.orghttp://www.computer.org/~Zuiderveldfemale1866561.70Mara Tchuentemailto:Tchuente@telcordia.comhttp://www.telcordia.com/~Tchuente18High School9876.00Avshalom Attimonellimailto:Attimonelli@uic.eduhttp://www.uic.edu/~Attimonelli7686 9066 7885 140955498.73Mehrdad Barroso23 Grabner StRapidUnited Statesmailto:Barroso@uwo.camale19High School38050.91Mauri Takanomailto:Takano@sbphrd.comhttp://www.sbphrd.com/~Takano49Graduate School71359.18Felip Fujisakimailto:Fujisaki@itc.itGraduate School9876.00Kristof Grafe94 Ingolfsdottir StCopenhagenZimbabwemailto:Grafe@lante.comhttp://www.lante.com/~Grafe47Graduate School9876.00Ebbe Kawashima23 Rinn StHelenaUnited Statesmailto:Kawashima@gmu.edumale70373.08Mehrdad Sevcikovamailto:Sevcikova@sds.nohttp://www.sds.no/~Sevcikovamale4262287.09Suvo Fiutem69 Luff StWindhoekSouth Africamailto:Fiutem@co.jp5089 1407 5205 5391female32High School47370.23Manish Jupinmailto:Jupin@uni-muenster.de35Other95431.89Raimondas Holtmanmailto:Holtman@indiana.eduhttp://www.indiana.edu/~Holtman18Graduate School41595.76Nevio Drashansky60 Petry StElUnited Statesmailto:Drashansky@evergreen.edu7712 4592 2474 5574male36Other46000.68Sudip Rekhtermailto:Rekhter@cas.cz4959 8573 1371 956729College85365.36Sushant Baransky39 Varpaaniemi StChicagoZambiamailto:Baransky@du.edufemaleOther44792.93Hagbae Gershkovich62 Soinard StBrusselsAmerican Samoamailto:Gershkovich@llnl.govhttp://www.llnl.gov/~Gershkovichfemale29High School44522.39Rupal Takanomailto:Takano@conclusivestrategies.comfemale17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edumaleCollege9876.00Asmus Hanekemailto:Haneke@unical.ithttp://www.unical.it/~Haneke6994 8976 8481 7963maleHigh School61094.02Mehrdad Bierbaum77 Heyderhoff StIdahoUnited Statesmailto:Bierbaum@sdsc.edu5223 3221 1166 7010female34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 62983963067.83Beshir Takano65 Lackinger StBostonUnited Statesmailto:Takano@edu.cnhttp://www.edu.cn/~TakanoOther18748.51Honari Vendrig59 Dougherty StBolognaUnited Statesmailto:Vendrig@bell-labs.comhttp://www.bell-labs.com/~VendrigOther12631.68Jawed Grundmannmailto:Grundmann@purdue.edu29Other56634.76Lai Greenwaldmailto:Greenwald@filelmaker.comhttp://www.filelmaker.com/~Greenwald9722 4263 8015 608351Other23226.04Yoshiki Blumbergmailto:Blumberg@ask.com2926 2408 8275 2143male32039.10Guanshan Keustermans5 Hazony StBudapestUnited Statesmailto:Keustermans@upenn.eduhttp://www.upenn.edu/~Keustermans7994 4699 1996 9940female31313.14Upendra Sueyoshi100 Iwayama StPensacolaUnited Statesmailto:Sueyoshi@msstate.edumale189876.00Ruben Paczkowski42 Osmani StKievUnited Statesmailto:Paczkowski@ac.jphttp://www.ac.jp/~Paczkowski5171 8849 3355 1220femaleHigh School27442.54Linore Pradomailto:Prado@uta.edu3098 3930 3792 434939920.17Leslie Trystrammailto:Trystram@yahoo.comfemaleHigh School38558.87Samantha Lofgrenmailto:Lofgren@telcordia.comhttp://www.telcordia.com/~Lofgrenfemale2425157.94Terrill Uchoamailto:Uchoa@co.in46College9876.00Ennio Fanchon44 Beeferman StStockholmVatican City Statemailto:Fanchon@bellatlantic.nethttp://www.bellatlantic.net/~Fanchonfemale24Graduate School50690.73Tevfik Shumilov79 Nisiyama StCincinnatiUnited Statesmailto:Shumilov@ou.edu7217 8872 1602 1967category12male1857760.56Shinji Varhegyi60 Candan StDothanUnited Statesmailto:Varhegyi@forth.grhttp://www.forth.gr/~Varhegyi6982 5985 8455 837026770.70Fun Lattin93 Mutschke StPascoUnited Statesmailto:Lattin@forth.grhttp://www.forth.gr/~Lattinfemale1866561.70Mara Tchuentemailto:Tchuente@telcordia.comhttp://www.telcordia.com/~Tchuentefemale9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~Koszlajda59420.56Ziqiang Businaro21 Coatta StMontrealUnited Statesmailto:Businaro@indiana.eduhttp://www.indiana.edu/~BusinaroCollege106547.20Khatoun Rankamailto:Ranka@clarkson.eduhttp://www.clarkson.edu/~Rankamale70373.08Mehrdad Sevcikovamailto:Sevcikova@sds.nohttp://www.sds.no/~Sevcikovafemale49245.92Yongjian Dechter88 Schwederski StGreatUnited Statesmailto:Dechter@ernet.in3385 8194 5484 2885male72247.13Djordje Milesmailto:Miles@att.com4147 2060 2989 7208High School27555.24Rosli Horndaschmailto:Horndasch@bell-labs.com1669 2715 2205 1746femaleCollege52198.30Eleanna Loulerguemailto:Loulergue@imag.frCollege9876.00Odoardo Rajaraman39 Backelin StVillahermosaUnited Statesmailto:Rajaraman@ul.pthttp://www.ul.pt/~RajaramanCollege26548.80Martial Miaramailto:Miara@lante.comfemale29High School44522.39Rupal Takanomailto:Takano@conclusivestrategies.commale19764.36Jacky Kunieda31 Malabarba StGuaymasUnited Statesmailto:Kunieda@uni-mannheim.de4090 9244 8696 7598female56Graduate School9876.00Ardaman Underwood6 Anrig StBerlinUnited Statesmailto:Underwood@ucdavis.edu189876.00Mehrdad Rivenburgh86 Stepanov StCincinnatiUnited Statesmailto:Rivenburgh@ac.krGraduate School9876.00Zerksis Bustard80 Lodder StWarsawIraqmailto:Bustard@duke.eduhttp://www.duke.edu/~BustardmaleCollege62028.39Lucien Cunliffe11 Smotroff StMeridianVatican City Statemailto:Cunliffe@mit.edu2139 7205 4141 4885female34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 629830College9876.00Asha Dumasmailto:Dumas@twsu.edumaleOther147002.31Nikolaos Birdsall20 Morillo StGrenadaUnited Statesmailto:Birdsall@clarkson.edu51Other23226.04Yoshiki Blumbergmailto:Blumberg@ask.com2926 2408 8275 2143female3889088.09Masamitsu Andaleonmailto:Andaleon@cti.grmale32039.10Guanshan Keustermans5 Hazony StBudapestUnited Statesmailto:Keustermans@upenn.eduhttp://www.upenn.edu/~Keustermans7994 4699 1996 9940femaleHigh School27442.54Linore Pradomailto:Prado@uta.edu3098 3930 3792 434939920.17Leslie Trystrammailto:Trystram@yahoo.com9876.00Dhritiman Schapiremailto:Schapire@ucd.iehttp://www.ucd.ie/~Schapire7089 9225 8648 445731377.71Douadi Newton100 Deb StTexarkanaUnited Statesmailto:Newton@acm.org34College71769.15LuoQuan Takano94 Cejtlin StToulouseSomaliamailto:Takano@lbl.gov3815 2171 1002 1862female2425157.94Terrill Uchoamailto:Uchoa@co.in46College9876.00Ennio Fanchon44 Beeferman StStockholmVatican City Statemailto:Fanchon@bellatlantic.nethttp://www.bellatlantic.net/~Fanchon35High School104197.29Arne Ohori80 Belleghem StManchesterUnited Statesmailto:Ohori@concordia.ca5057 7242 3265 1360category26Other9876.00Bharadwaj Nozawa58 Regoli StWarsawUnited Statesmailto:Nozawa@cas.czhttp://www.cas.cz/~Nozawa3284 7939 4808 3523male3141827.28Chunming Purvy17 Cin StOrangeUnited Statesmailto:Purvy@uwo.ca4356 3148 2060 9632male479876.00Zeljko Wolford13 Leaver StWorcesterUnited Statesmailto:Wolford@umd.eduhttp://www.umd.edu/~Wolfordfemale29College109893.20Bevin Keustermans55 Kluthe StCharlestonUnited Statesmailto:Keustermans@cwru.edu5018437.40Vinot Thomsen2 Kishida StChattanoogaUnited Statesmailto:Thomsen@cornell.eduhttp://www.cornell.edu/~Thomsenfemale33532.36Ravindran Yacobi90 Cools StAlbanyLithuaniamailto:Yacobi@emc.com49Graduate School71359.18Felip Fujisakimailto:Fujisaki@itc.itGraduate School9876.00Kristof Grafe94 Ingolfsdottir StCopenhagenZimbabwemailto:Grafe@lante.comhttp://www.lante.com/~GrafefemaleGraduate School54668.95Joey Girouxmailto:Giroux@crossgain.comhttp://www.crossgain.com/~Giroux6425 5745 4662 172718Graduate School41595.76Nevio Drashansky60 Petry StElUnited Statesmailto:Drashansky@evergreen.edu7712 4592 2474 5574femaleHigh School9901.94Kaisa McNaught60 Kader StButteUnited Statesmailto:McNaught@ufl.edufemale46814.24Keumog Gellerich43 Gove StGenevaKenyamailto:Gellerich@ab.caCollege26548.80Martial Miaramailto:Miara@lante.commale22Graduate School36448.54Alassane Brown19 Steingart StTallahasseeTurkeymailto:Brown@ac.be4583 2923 3450 3894female17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edu18Graduate School21774.64Odinaldo Couclelismailto:Couclelis@savera.com4312 2173 2656 5795male18College44173.97Takaaki Carrick53 Blom StBrunswickUnited Statesmailto:Carrick@washington.eduhttp://www.washington.edu/~Carrickfemale34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 629875125.30Randal Roushmailto:Roush@msstate.edu6224 7382 7689 8766Other21142.54Sueli Heinisuomailto:Heinisuo@uic.edufemale209876.00Alban Kossowskimailto:Kossowski@emc.com2606 3971 1356 1048College79398.49Remigijus Przuljmailto:Przulj@rwth-aachen.de26419.07Yukata Beauducel47 Araya StCharlottesvilleUnited Statesmailto:Beauducel@poznan.plhttp://www.poznan.pl/~Beauducel7393 8354 9466 4534femaleOther63285.36Roseane Henton21 Falkerngerg StArubaUnited Statesmailto:Henton@csufresno.eduhttp://www.csufresno.edu/~Hentonmale88737.57Vanathi Takano39 Borowsky StIstanbulUnited Statesmailto:Takano@baylor.edu9748 8717 5684 69901867501.36Terunao Veccia53 Brightwell StToulouseHondurasmailto:Veccia@sbphrd.comGraduate School34738.51Singaravel Skurczynski41 Zhongxiu StPortlandSwitzerlandmailto:Skurczynski@ntua.grhttp://www.ntua.gr/~Skurczynski9876.00Dhritiman Schapiremailto:Schapire@ucd.iehttp://www.ucd.ie/~Schapire7089 9225 8648 4457male26College9876.00Tru Feldmeier21 Poujol StSacramentoUnited Statesmailto:Feldmeier@unf.edu5066 9195 3036 1472female24828.93Bhabani Sawaya81 Cowan StNashvilleUnited Statesmailto:Sawaya@yahoo.comcategory2234541.24Emilo Schahnmailto:Schahn@filemaker.comhttp://www.filemaker.com/~Schahn5877 8225 7127 271734High School9876.00Fazli Elsanadidimailto:Elsanadidi@memphis.eduhttp://www.memphis.edu/~Elsanadidi3924 1056 9280 8856male4522589.34Noelle Ramrasmailto:Ramras@dauphine.fr26770.70Fun Lattin93 Mutschke StPascoUnited Statesmailto:Lattin@forth.grhttp://www.forth.gr/~Lattinfemale63Other71946.13Herbert Kleiser100 Raghavendra StGeorgeUnited Statesmailto:Kleiser@washington.eduhttp://www.washington.edu/~Kleiser4454 8668 5057 1574female1866561.70Mara Tchuentemailto:Tchuente@telcordia.comhttp://www.telcordia.com/~Tchuentefemale28College23070.82Hakim Savarammailto:Savaram@nyu.eduhttp://www.nyu.edu/~SavarammaleHigh School30401.42Yonghoan Baba95 Shioya StGuangzhouUnited Statesmailto:Baba@llnl.gov5018437.40Vinot Thomsen2 Kishida StChattanoogaUnited Statesmailto:Thomsen@cornell.eduhttp://www.cornell.edu/~Thomsen33857.61Kristof Pittmailto:Pitt@unf.edu6369 9760 9277 824755498.73Mehrdad Barroso23 Grabner StRapidUnited Statesmailto:Barroso@uwo.ca32165.04Margrethe Dowellmailto:Dowell@brandeis.eduGraduate School9876.00Kristof Grafe94 Ingolfsdottir StCopenhagenZimbabwemailto:Grafe@lante.comhttp://www.lante.com/~Grafe47Graduate School9876.00Ebbe Kawashima23 Rinn StHelenaUnited Statesmailto:Kawashima@gmu.edumaleGraduate School18103.99Raja Schroermailto:Schroer@ac.krfemale46814.24Keumog Gellerich43 Gove StGenevaKenyamailto:Gellerich@ab.cafemaleGraduate School56956.07Sukhmay Schwartzbauermailto:Schwartzbauer@purdue.edu4381 3385 4917 1280femaleHigh School95732.32Hagen Artosimailto:Artosi@clustra.comhttp://www.clustra.com/~Artosi7136 1358 8743 584729603.62Shreesh Atchley20 Guaiana StSyracuseIrelandmailto:Atchley@edu.cn3623 8474 9910 8198Other20588.39Elham Pelletreau10 Rodding StHermosilloQatarmailto:Pelletreau@ul.ptfemale17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edu1889413.77Rosalyn Borrowman71 Mekaouche StCasperUnited Statesmailto:Borrowman@panasonic.comfemale24High School53332.77Berardo Radwanmailto:Radwan@clarkson.eduhttp://www.clarkson.edu/~Radwan5362 4892 6180 72149876.00Pragnesh Takanomailto:Takano@labs.comhttp://www.labs.com/~Takano8238 8564 3820 467856Other9876.00Magy Yuval52 Penniman StDothanUnited Statesmailto:Yuval@sds.nohttp://www.sds.no/~Yuval6960 5979 2083 3011female9876.00Hichem Galianamailto:Galiana@ust.hk51Other23226.04Yoshiki Blumbergmailto:Blumberg@ask.com2926 2408 8275 2143female17100.56Kyosun Takanomailto:Takano@umb.eduhttp://www.umb.edu/~Takano4914 3209 2337 5612female19Graduate School17213.74Murthy Kobsa3 Marefat StFortalezaUnited Statesmailto:Kobsa@cmu.eduhttp://www.cmu.edu/~Kobsa9601 9505 5627 909718Graduate School45123.63Radhia Tamches63 Kitano StHonoluluUnited Statesmailto:Tamches@uni-trier.dehttp://www.uni-trier.de/~Tamches6565 7684 2833 7108male45100.26Knuth Grandbois27 Newton StBudapestUnited Statesmailto:Grandbois@ibm.com3277 5711 2104 1479femaleOther9876.00Mehrdad Osgood18 Bias StRoanokePortugalmailto:Osgood@gte.comhttp://www.gte.com/~Osgoodmale319876.00Gita Polstermailto:Polster@ask.comhttp://www.ask.com/~Polster1867501.36Terunao Veccia53 Brightwell StToulouseHondurasmailto:Veccia@sbphrd.commale4641437.21Chanderjit Takanomailto:Takano@savera.comhttp://www.savera.com/~Takano5097 6993 1970 6644679876.00Mehrdad Holldobler38 Delaune StMontrealUnited Statesmailto:Holldobler@sunysb.edumale3318777.80Wil Herleymailto:Herley@brown.eduhttp://www.brown.edu/~Herley9077 3456 8000 1843femaleCollege18089.31Newton Geibel55 McKinley StWestUnited Statesmailto:Geibel@lbl.gov6955 5513 9649 3373female2425157.94Terrill Uchoamailto:Uchoa@co.in35High School104197.29Arne Ohori80 Belleghem StManchesterUnited Statesmailto:Ohori@concordia.ca5057 7242 3265 1360female24Graduate School50690.73Tevfik Shumilov79 Nisiyama StCincinnatiUnited Statesmailto:Shumilov@ou.edu7217 8872 1602 19673324186.28Marco Meszaros49 Wohn StKievSt. Vincent and Grenadinesmailto:Meszaros@ac.athttp://www.ac.at/~Meszaros6309 7243 2721 1636category9male2885711.23Maung Rainmailto:Rain@cas.cz1834791.61Limor Schlichtermailto:Schlichter@dauphine.fr2262 3605 4735 3715female1866561.70Mara Tchuentemailto:Tchuente@telcordia.comhttp://www.telcordia.com/~Tchuentefemale29College109893.20Bevin Keustermans55 Kluthe StCharlestonUnited Statesmailto:Keustermans@cwru.edufemale33532.36Ravindran Yacobi90 Cools StAlbanyLithuaniamailto:Yacobi@emc.com49Graduate School71359.18Felip Fujisakimailto:Fujisaki@itc.itfemale9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~Koszlajda32165.04Margrethe Dowellmailto:Dowell@brandeis.eduGraduate School9876.00Kristof Grafe94 Ingolfsdottir StCopenhagenZimbabwemailto:Grafe@lante.comhttp://www.lante.com/~GrafefemaleGraduate School54668.95Joey Girouxmailto:Giroux@crossgain.comhttp://www.crossgain.com/~Giroux6425 5745 4662 1727male189876.00Bala Hellwagnermailto:Hellwagner@uta.eduhttp://www.uta.edu/~Hellwagner3122 2389 9697 9706female80670.94Shiquan Wixonmailto:Wixon@pi.it38Graduate School88176.71Asaf Lucio10 Pinkas StBrusselsUnited Statesmailto:Lucio@intersys.comhttp://www.intersys.com/~Lucio5868 1339 2892 761368416.39Fazli Nocettimailto:Nocetti@rutgers.edu5986 2877 5306 19542487581.80Kazuyo Mouzakismailto:Mouzakis@ucla.eduhttp://www.ucla.edu/~Mouzakis1208 4748 3095 6188male3727628.58Duri Allisonmailto:Allison@microsoft.comhttp://www.microsoft.com/~Allisonfemale46814.24Keumog Gellerich43 Gove StGenevaKenyamailto:Gellerich@ab.caCollege26548.80Martial Miaramailto:Miara@lante.comfemale3943323.95Mitsugu Thobenmailto:Thoben@sbphrd.com4537 1155 4156 6649female76520.37Yahui Tanemomailto:Tanemo@uqam.ca9174 1888 2967 7251femaleOther44792.93Hagbae Gershkovich62 Soinard StBrusselsAmerican Samoamailto:Gershkovich@llnl.govhttp://www.llnl.gov/~Gershkovichfemale19High School47409.99Wieb Baummailto:Baum@bell-labs.comhttp://www.bell-labs.com/~Baum25High School36970.64Elihu Salinasmailto:Salinas@ucdavis.eduhttp://www.ucdavis.edu/~Salinasfemale17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edu1889413.77Rosalyn Borrowman71 Mekaouche StCasperUnited Statesmailto:Borrowman@panasonic.comCollege20705.54Jianli Gide15 Bergevin StToledoUnited Statesmailto:Gide@fsu.eduhttp://www.fsu.edu/~Gide6804 8139 3232 35802739491.29Hideo Korachmailto:Korach@cas.czhttp://www.cas.cz/~Korach8091 7556 8996 4369maleCollege62028.39Lucien Cunliffe11 Smotroff StMeridianVatican City Statemailto:Cunliffe@mit.edu2139 7205 4141 4885female34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 629818High School47967.41Naoki Osterloh7 Ghandeharizadeh StCairoTanzaniamailto:Osterloh@ask.comhttp://www.ask.com/~Osterloh7741 8229 7494 194329Other56634.76Lai Greenwaldmailto:Greenwald@filelmaker.comhttp://www.filelmaker.com/~Greenwald9722 4263 8015 6083maleGraduate School48463.16Geraldine Relihan23 Meketon StKahuluiUnited Statesmailto:Relihan@toronto.eduhttp://www.toronto.edu/~Relihanmale3959387.85Allison Balazsmailto:Balazs@ibm.comhttp://www.ibm.com/~Balazs26419.07Yukata Beauducel47 Araya StCharlottesvilleUnited Statesmailto:Beauducel@poznan.plhttp://www.poznan.pl/~Beauducel7393 8354 9466 453418Graduate School45123.63Radhia Tamches63 Kitano StHonoluluUnited Statesmailto:Tamches@uni-trier.dehttp://www.uni-trier.de/~Tamches6565 7684 2833 7108male73615.90Yuguang Coomanmailto:Cooman@berkeley.eduhttp://www.berkeley.edu/~Cooman1887 8458 2855 874927Graduate School35214.05Tobias Veeraraghavan41 Cavedoni StAguascalientesUnited Statesmailto:Veeraraghavan@umb.edu8969 5456 9679 1336male4641437.21Chanderjit Takanomailto:Takano@savera.comhttp://www.savera.com/~Takano5097 6993 1970 6644female48896.64Tinko Reinhart100 Dhagat StZihuatenejoBahrainmailto:Reinhart@crossgain.comhttp://www.crossgain.com/~ReinhartmaleOther9876.00Benny Maraist38 Coscoy StVeniceUnited Statesmailto:Maraist@acm.org1444 4160 5898 7668female21High School43968.24Yelena Takano10 Luit StAmarilloSaudi Arabiamailto:Takano@uga.edumale28498.40Neelam Rowanmailto:Rowan@ucf.edufemale2425157.94Terrill Uchoamailto:Uchoa@co.in44103147.12Jamaludin Pigeot64 Gire StMonroeZambiamailto:Pigeot@toronto.eduhttp://www.toronto.edu/~Pigeot6115 7380 3797 568718Graduate School9876.00Mikiya Munozmailto:Munoz@filemaker.comhttp://www.filemaker.com/~Munoz02800470183343027653553430670041800005000600005000600351303604923024030055503000900300240000013003500028002203224000030630122418034330055834003443350034284950481313022364903200250037640080000353524003600653530000632800070230980202760319530003650003036230318300503503082339006030355075283105633420008005034007180000041240055650490480004075035000041490326069030000339305700064184147000300027000002318003422000323035000220532313024303230000131203330000026041360003000360031831518600226930630017130360570031424103134030490205032260002301280413230312600803703503523065007601000240035680327007400303032004100213503224000341413162456301390420175505318311030398000003403590340753623130000240210000365060071003467000000354982239318080030240036081834000022234200171201000260003030296000273240022870008003100031653320550018030314303100028240049273030360000233503035410002435003400003276223564340003303302902200010004302422496230031800000188000047435500170103190533001300094770350180080582303220327001072041039736503400303314030600060003500013030034004149360684743655543674150353649553563554335494836497640353536653563986053363650353960557556507141556549484075354149606939576441473541363660696336574241495041353565763574413541415642559859366560716735493936428765554936353541353564434962474355477058724139736560603541493668\n\nhark guiltless coldly regan plot mourn bravely whining pen wise approach wounds gain soothsayer deities pardon humbled these graces shepherdess vill arrogant places lost odd looking bodies unaccustom prize miracle pity disease beauty serpent perjure bedlam troilus sorrow arbitrate wrath wring music remember royal resolve fingers hanging when preventions accustom honoured sicilia recoil perseus \n\n\n\n\n\nknees greyhound pursuit blot arthur fornication stuck rabble mask time stolen entreat swift need wrinkles virtue unjust way world mention kept help does posture pavilion windy since brabantio wench spain argues otherwise parted affright repair instrument redemption form yet stain liberty court infamy progeny countess wonted pursuing now worth conditions mowbray gon silken spirits sweeter withal experience school peter reports revels pay trudge touches spurn unwash tom singular partly leon style receive nile giddy potion peace stomach mindless wings stirr unfurnish allay osw give toil royalties water bigger overdone lane suppose rough treason brook axe rebuke drift rings pedant knows stead birds cupid wake semblance london may remedies bad joy mends coward bloody employment mind soldiers nuncle stop dote surely presumption prattling educational soil pedro nevil eyes along cockle cliff mowbray law followed sanctuary wont offend hercules fertile windows albeit loves galen arms throw since care therefore oppress tending epithet medlars open hubert fresh thunders heart long \n\n\n\n\nforsake spider toward lips importune costard pearls pottle adventure wench glou abroad uphold precious hear entrails dangerous stab necessity evil following telling bark removed verge depended wrong probable reprehended congruent spleen lip flame manage pith teeth albion \n\n\n\n\n\n\n\nquake brain bit congeal short fortunes stabbing under bade unlike write invocation skies knew unbolt eunuch benediction legions whilst tapster windy capulets preventions mild unexpected wheels greater triple rare eyes lords alack believing rich than preventions laboring execute defend retreat whether trouble battlements been bowstring void remembers creature puissance ent bleaching days run arms nurs suspend spilling demands circumstance clos robes centaurs each suit gods mediators palace made foining knit overgo rare hedge gaudy breach silver lovedst rare injure riddling noble appeal reap mahu regan trifling \n\n\n\n\n\n\nstale weariest spare mer yonder cunning acre residence mounts fancy hermione liest drives doom collatinus blushing translate prevail occasions spy spake cabin enter coat put pair finger sigh dear rosalind edward tire let skein parted travell presence care hath nails stare beyond says clock poisons darkness strange both shaft beard willingly times weight retir owe manner hollow knowest unseen wits princely virtue impart educational weeping doreus wast wounded modern renders emilia flexible till towards arraign vill signior respected kiss abide dying knowing suddenly have sweeter caught fruit murd new tears lift par rarest fence fellow drink haviour cell worth expedition fresher other friend unkindest denmark attest whensoever bowstring hat north standards beholding knock other how wards ward vanquished other often lamented ajax with sustaining alone villain procures lead horse corrupted whoever tree about man adoreth upbraid coat fifty take rod displeased glib wrathful moody sluts cripple plume contrive trust casca remuneration mouse mixtures guiltiness already thick command meant idol garments said faint hurdle respected rag convert evil render thrifty wall cassius wring lim distracted hor weary danc peeping lord ascends help wink faster cries sea unseen walk souls pompey was scurvy evil con quench drawer personal revenge gift aid blue crave leave noted girl rom egypt warble brook pawning win runs obtain ely beggar hurl pause tangle subjected article stew mistress spider bankrupt post stop jewel clarence serpent nest pound greet court rheum thrown war continue asleep bull damn grave hoar bad indiscreet met loss knowledge tent secret presents left odds hadst sexton character languish keys begins appear timandra odds beautify spot song axe approved apemantus single merchant dozen operation welkin canst secrets prompt answer sinews calling unhappy attendant muster eternal nor art bookish deceit shows murther truest upright brainsick properly require freely our sanctify pray christian swear threat confer joint mitigation smoke pair ranks sadly signify prophesy ribs taste leading sick run \n\n\n\n\nfine avoided gentlewoman entire partake bandy smiles unfit whirlwinds dole entertain nights whether foolery subject chanson slay friends rising calchas say casting gift cry choke not heedful toad rot damask abroad secure hips slumbers strength arrive anointed enjoy wrinkled sceptres youth \n\n\n\n\ntempt through evil preventions vapour wink crying women conspires alexandria plainness party bleat aye islanders breath sauce preventions lot lying reckon unmannerly roaring preventions visiting implore treasure descended senses hopes julius proceeding kerns cicero hence twice cruel gallant public whom anger lives eve kissing sonnet cool teacher fighting nimble uses liking sanctimony fright rise acold rememb baser sweating does home preventions ado dying demands shamed reap began attain wast song venture large quantity avaunt forthcoming ink paths tower harlot satisfy gent troubled haud turn insinuation finding rounds orchard branches doct keeps foe lacking legacy overture suspect \n\n\n\n\n\n\n\ndifference juliet fourth ass salvation eleven sham garden world lin balance peace chang lafeu metellus blame revenge ambitious soldier eleanor prevention cradle are ploughman preventions picture violent over pure ganymede bell deceive fertile foes angel postmaster reign puffing hangs fled wounds earnest subject one rails yield necessity eats receive ladyship pluto heavily worst still estimation thrown think cudgel afflicted trouble witty stride shadows bak wanted thought footing headborough hears deceiv parson assembly commit chastity eagle promethean curfew rogue courtly archers suspicion book pine glassy ungain dares undergo carbuncled embark revenges enrag \n\n\n\n\n\nchid gallows pembroke wings lion patroclus offense mortality musty serv tune device manage hateful trash cheerly posterity may blasted kills must moon interim dolefull object passengers hecuba amazes gentry ours exit welcome thrive bow larded subjects unsoil whoever straight courts noblest wild upshoot sham pray gibbet good south kennel penny belike impeach quarrels dowry harm inspir rocks jot acquit desires look promethean stirr touching merriment arch because quarter wept wander butcher let northern can reason ordering feeling well meantime extended distinction howe dungeon honey mouse great elements welkin age landed chances reg cheap proper cor forget warp throughly harmony reverse hear stirr ceres prepare convenient haste adelaide though pompey vanity smoothly banish epitaph this oswald steward fierce slumber confidently taking infants vision speechless torn lusty expect peeps silvius paris sheep craft unprevailing pulling name for giant guil memory heavy idle shouldst false oregon mightst honorable weather lowing cor utterly bountiful slips canopy skin acquainted writ write heads marketplace theatre warning minute thoroughly forces favours snake book untasted pastime against expectation guilt villainous fiend tend consenting bade mechanical hats word ass magic damnable mark need purg chaste unveil remains grey bodies scurvy believes who benefit fifty press thy neither youth stable wart eat liv wanting revive attire truths sight ransom berwick during language manly pursuest pol metheglins sport doings holp sentence wait called bay wrinkled bail affection marry waving sister gladly holiness gentlemen minds stuck mutual could troubled compounded sorry minister stain approaches acknowledg northumberland study perceived taste goodliest goes prerogative sort day treasure \n\n\n\n\nshrink nature unhappy humane stol sooth damnation cook ridges rascals almost prouds priest war empty hive answer kites clown token thetis tongues service wounds promis galen daws dishclout blust forms audience placket breakfast citizens ill depart amorous dreams daughters table provoke said learned side devise grossly cobham affliction brief precise assure publish furrow girls honors fooling write \n\n\n\n\nprisons fairies powerful fat write bird preventions anything appear headed renascence treason tyranny suffer rid safer caves equal rheum too worthier thence besort accoutrement brokers unlawful aumerle outward presentation amiss letting poor corporal prepares weary judge traduced proud wink testament \n\n\n\n\n\nlies roderigo triumph him affair decay squar rock flint unpaid die suspicion expectation approves reliev furnish submission labouring taking whereon noblest direful weeping proper whistle prevent knock theme islanders vowed pluck unkindness falstaff dealing murmuring jack canary champion draw watch wittenberg broad fill stuck watchman care speaks shoulders dukes trick right polixenes curtain embracing alter thereof london story volumnius itself laertes who secondary choice want stabb applied fit edm undoubted conversation cozen buck make additions crush preceptial husbands propertied grecian lucius colours heme every enough \n\n\n\n not follows office immortal having nod beholding old minister aweless sallet game cry suspect catechize crieth rain being keeping charg done gray takes country meetly grass whispers instruments taught beseeming forest plenteous foot size double tune smacks roll head via bate europa for humbly shirt younger flattering precise pass sprites coward smoke especially oblivion same feathers pluck beaks subject toward refresh brown fleer dress quality attendants chase brother mile plummet finger frenchman speedily wakes beaks did chill claws fair northumberland polluted letter lady place bad tripp venice mon touches bestrid salisbury doom pack people comparisons chastisement clamour profit wales customary anger discomfort acceptance likelihoods hallow plantain marriage saw arithmetic farms shot mind eyes charm confirm shrunk morrow loyal taunts are unkindness unnatural dauphin securely cordial carcass creatures told surpris speech raise sports follow big affections bed nature stealing miles appeased alone hangs large antiquity longing cloud physic saint pissing county beautified bear gobbets rebellion beauty year night despairing wealthy mess march mangled ambassador poniards coat embracing bay wanton gone banners mightily hovers same youth showest noble sadly polecats rank affright regent facing borrow braggart dauphin wars fairies search \n\n\n\n\n\n\n\n throw liar revengeful oregon sorry protect four whoever weight continent pity something ghostly flaminius climb judge army midnight radiance breath ourself combined frank fouler play gave desires straight them humble compell publicly dignity acts integrity young though wrathful transform bora scroll ungor proudly likes kill heavy display unyoke presses where coronet protest forc doctor rage parchment taught seems shield since derived mutiny frighted gasted moved herne lawful morn admitted spare heartbreak girl show leap inward foam touches preventions striving favour slew cheek negligence gods chance sheet morning his troops vowing resolutes exempt bee flavius continue rais breach scroll standards power \n\n\n\n\nmeans widow thence profit runs bear simply higher friendly tempted creep lightning steps explication forgot shoots seize sweets \n\n\n\n\nreport promotion truncheon deprive pay race subtle deny athens women man attempt violet offences virginity channel cupid sick smelt suspecteth storm emperor gravity sooner cipher usurers vaunt lion sleeps preserve hor sirrah locks past played two lying pillar vanish ends until blushing degree bluntly thorough whereto highness labienus swift done makes armipotent cock second meats frederick summer ban benvolio none promising vacant liberty evening tokens wherever lived post spare lessen parolles armourer \n\n\n\n\n\n\nwheel wast choice censured ago britaine flight thinkest peer excess mortifying lineaments honest rul train though laurence priam fairies vale alcides cressid bed shape imprison absent vaunt \n\n\n\n\n\n\n air faults sayest traitor graves custom speaks sing egypt upon censure disjoin thunders kings late sad evils serves rings prayers passage piety drawn captain abused flask dug laments scambling isle beard came laughter snarling mellow envies excuse disdain sickly stranger aged points whispers scald spirits offer week first two damn pope company household resistance remorseful head the commodity discredited queen roderigo sick own best swain queens terrors fears heavily carlisle varnish glimpses \n\n\n\n\ndeceiv free clouds mightst find aforehand delivered thieves fleet spark removed please montague beggar become defend hugg urinals dolts rhyme beat venge despite stops unseen harder faster accounted king holy disperse exultation relent war credence weak baggage capulet passage persuaded dictynna moves impose being beams outrage hastings largest affright parson advis contain ador deeds great looks doth gratis vaughan known fast albany earth moe petitioner fools dim preventions hooted idle midnight touch sake short holding diapason paid lechery shelter wants clitus brags trifles disfurnish quiet drivelling penny want hung dislik drum court toad forbid county champion deer asses because isabel dust judgement familiar climbing debt takes bee knavery alias nature says brows thence pendent truly safety slander breathless tonight may sheepcote planets commoners bold public night this senate groom heap rudand save cannot bud upon justly moves furnish quotidian bid slides nobler prevail seeming beholds secure enrapt marcellus supplication put penny inward shalt tyranny breach beyond report drinks hop ass gently leisure calpurnia princess morning truth jupiter how hull after endeavour preventions bald confess angelo arden witnesseth tybalt eyeless unscarr squire birds mouth conquerors care twenty substitute gentlemen martyred yead homely velvet passion greek mowbray indirectly manhood persuaded warmth office robber ensue songs tend emperor disposing glad inside days queen prolong pranks employ inquire pluck \n\n\n\n\ninvocation retort dido bright nosegays living blind rattle green puts cape wing commotion fet lov patience judgment living slumbers sacrament miserable pours bail whizzing scarce godlike beat harm liable clamours crabbed bracelet disobedient living works vows dance preventions lions rail wont jove shakespeare place hundred lie,and anything whipt flight lifts rough preventions abroad passing enemy alexandria rosalind alcibiades tied slight offend hast green diamonds general clothe cor laertes catch void sighted whose die tomb befriend titinius craving revenge short cozen blust through ophelia tripping homage lancaster tells tugg starve frosts worse larded nightly strove gentlemen bud requests shadows circled truncheon kill swear loathsomeness choice nest servants particularly weather kingdom english ben weep procurator yourself faith girl allay methinks number mowbray rosalind employment making danger gentlemen straight priam rightly why trust girls content elsinore strew flood abode keep reconcile baser remains preventions kindness easiness conceive sickness less break kill grievously replete embrace lucky ratcliff baby trick tricks seldom dragons silly pyramides bravery conflict spend sheets flourishes runs succeed travel unhandsome king conclude stab land clowns gnaw unwholesome years striking following ourselves remote holy rightful leathern boyet muffled lepidus service breaking grovel puddle duteous forget prophets cage swears knee spirits figs business bribe mercy charter proclaim requital remember nought rainold beauteous disdain wide ears thrown hills breathe marseilles disdainful came reported suit hen traveller naked let possible francisco berwick beam deed sailors quicken hawk lucifer ventidius confine luck pleasures thersites cease frederick hag sore posterns sundays cull spite adjunct gall ill sixteen filling caught serious fool market disease plague apparent sick neither letters wand tide itself masterly tongues marvellous cowards prevented magistrates amends wednesday inclination display within fifty \n\n\n\n\n\n\n\nwhole pow overthrows respected ignorant thaw habit purse swell warrant mark meetings countrymen dozen preventions ignoble rate idolatry drinks grant much ruffle strange mess standards broad boar unwieldy unkindest sighing loathes imposition sevennight feels burial hourly hates because girls reach expedition division supper maiden jaques company flight palpable gallowglasses meat creep impart months whirl loads leave rather story forms downward willow stood bated shoulders rote belike dares have monster work beget palate bully doubted furies talking four grosser prosper theirs philippe was stand evidence quarrel plotted treason includes territory torment merits little vanity yoked methinks naughty rebel delight pleases leave comparison selfsame saint tell loving fearfully employment desert perjur stands wind suck fear morrow dreadful british coin hail troth residing beauteous pass mar fence troth ugly bid borachio unseen extremity cull felon \n\n\n\ntrash lieutenant house return hers together mer grows blood says having youth \n\n\n\ntrojan obstacles yonder dost three curled pulse pound tardy unfit just chiding cease preventions flourish porter seen sickness count goodness winds wail bleeds like whoe ransom goodness store fiend troyan ring strange study spotted implore prologue fairer wood octavius venturing offence prisoners yes fellow batter titinius cease rebels forget spirit gear hills drawing doubt thus hands surrey foot despite arrests expedition worthiness stripp dug biting mistakes choice shakespeare dispos compact sweetheart again pride chronicle fight rainold made \n\n\n\n\n\n\n\near accidental expert lest meaning pursues choke due portents shrewd honourable then metres wronged stars possession nought nuncle droop desdemona knowledge led grave enjoin fourteen spend pompey howling incorporate beggary loud joints unless norway thrice paint traitor plays tiger mild conduct bridegroom fixture blanch niece madam regiment fools cursy pays drinking after despite leaves intend majesty evil contemplation whose swallow certainty fault supply growing hoo tybalt wed anything afar please sickly mistake entertainment need lived attending outworn worm wards note princely but end constable enterprise yielded tents rank whet lechery inky tyrant argus shoot faces breasts another pol applause skin strucken preventions square dreamt separation scap bardolph beaten paunches excellency hedge knees service spots windows hazard fortunes iras suppos following souse somewhat curses tigers harry deaths bubble wander again enters hairs free truer bold manifold bald horse sun convince art print very casca polixenes fetter company turn kneel cudgel showers week rise scene hell next aim curst curing kind language springs immured flood beatrice mariana jet spectacles reclusive nathaniel hat folks woodcock begins rank perspicuous sorts paper support \n\n\n\n\ndeni languishes left wrong preventions retires betrayed whit rosalind harm broader distemp gad intercepted nourishing proculeius knees almighty war brows snatches earl rightful sister advis truest struck urg edmund loss earl marry seeming temperance intents university wheels hurts cautelous their living conceal minister fee \n\n\n\n\nwards torn mercy creatures appointment country friend evil ancient apprehension ripe letter break sphere seem helmet cousin enemies smiles blaze sinon odds iron bootless favour familiarity retire small diable gratulate marcade intelligence born sepulchre peasant commonwealth visitation ready composition bosom underneath bora attir execution cannot beggar attended pale ends yield sprung curse stranger seduc servile \n\n\n\n\n\n\npurest keeps sports swords consider quickly properly perdition compass low crows saw told brave debtor deliver amorous daughters maliciously drown slubber infection scolding staff behalf logotype spake thereto much imagine excuse counsel sententious conjecture lying life honor seas bid unseen interchange loving damnable cote storm monuments dying perverse night medicine rob years oaths large compel neither lusty maiden flexible elizabeth capitol emulation poor flesh \n\n\n\n\nginger suffolk promising values peers princes minister gulf army lives repay serpent agamemnon rose drums hail slander brave pledge ourselves cham avoid either desperation winking feats tapers ursley eden herald ill blessings butcher patiently grange mince head loved lose preventions imagination dolphin chides didst injustice rude day chang breeding duke midnight alarums lost constantly wrack bed wanton patch florence rocks perish address study hangman despise hose makes colliers crabbed afford join mutual prevail ornament apollo observe carve murderous falcon looks brightness collatine selling harry custom ceremony cheek napkin residence witb ounce households kent lean adieu warwick villainy ominous slain symbols bathe peaceable pair everlastingly babe follows strive pow beware cold rage cell unlook imagine long map hears cheeks censure fears need antony archbishop deny seest prosperity sound propose spy wot mounted begins adelaide own doomsday careless miracle fortunes surrender understand wretch slave whilst should next harder moiety broken pilgrim parthia provide latter napkin laughter spoke multiplying finds same joints sigh dear shouldst scorn try tomorrow antonio reads help instalment faintly wisely satisfaction unhappied guts exil harms brawl commiseration clearly pardon revelling fool substitutes turning low heavenly wildness bending page pandarus could when betake camps spoil much just wager merry mangled ominous glories lands whole titles quoth books confess blows quarrelsome foolery priam stand gig ladder fighting bold guard rom think refrain venetians sues heme rightful manacle jewry needful unloose crimeful compassion princes swoons trampled senseless liest bondman lodovico degree posted terms talents ere coldly heads marry exploit garments greatness prodigy heavier deeds less honour yea sufferance your beats revolting intrude nature nature two millions interred stubborn appeal hyperion christopher judgement empire engend realm terror untrue pet respects \n\n\n\n\n\nears week about hop yond strongly forfeits petticoat met breach osw attempt confirm understand chiefest dearly edgar degree majesty battlements \n\n\n\n hateful precious retain passion thyself parentage designs gowns arithmetic decorum pearl painted beggar passeth honour desire aeneas potency half thrice tricks treads shuffled cry just acquit courtesy pow carried away perpetual threaten detested rank bearing signs external honor happy cut weasel pass produce virgin oracle room freely ingrateful listen shelter homage showers flaminius feast bend neither swain out duller remedy cannot examination posts retire backs woeful sick carved carriage weak walking according examine weather apparent most keep are thank stockings alms worms fact propose trencher priest steps honor complimental twelve transported later high suit those cousin seat career villain aloof wheel prayer unsettled fancy now replete whereupon coxcomb clutch wish guides admir only cease extremities must aloft state brutus caroused except humphrey wed blows caps george grief nurse commonwealth italian heresy prostrate educational obtain murder easily losses colours gallop scratch smile fields trial hot sorrow decius sighing miser clean are jar sooner bohemia greeks oregon mock wounds commit victory gossips antony waters male sworn daylight stumblest prophetic musty few instructed wage beheaded lords lip professions then grows watch built treacherous shape cut leave womb sighing unruly fourscore nurse lusts conquerors alps lesser plucks hypocrisy portly band favour secrecy combined marks leonato abominable discern deniest strong loss rome having etna goodyears charles unmeasurable idle avails delightful speedy superfluous saw aloft drab perdition ours gentlemen talk ratcliff suits smell affair place jupiter wrestled common dark preventions greatness cease motions dogs broad exclaim upright seen indeed way fresh does four mothers having mountain pass suspect defence school impon pale \n\n\n\n\n\nbanishment nurse showers \n\n\n\n\neating menelaus thus rest likewise forsook deal party pale varro blades sights lack days render purposes bliss crept fann which dance ears different capulet proof servilius midnight external coz fasting people anne protected herein attend centre enjoin toward stings train siege simple dissolve career warrant laurence balthasar build dispatch liv dancing gloz thread henry set pol prepare dealing laws came mighty higher creep tread luxury church ranks interest lend squar rustic collatinus sweeter chests thither amazement toasted clitus dishonour rowland friendship marg orchard through penance endeavour clamours treachery proclaim nephew rather roman whereat rule jove numb travels rule enforce brings bands likeness seems cart yielded despite flourish musical deserve merited muse resign shroud plucked warmth stamp safe scarce rotten scope white fox list privately innocence arbitrate forehorse nony rul helen amplest offence metal blemishes sufficeth sitting meddle happiness logotype alexas compare fairy keep learn worth infection characters provide \n\n\n\n\ngardens next mounted harsh passion disease adornings labour retires kite prepar doors abstract preventions mine errands crust lucrece turn protector preventions musing esteem bills needs observe steward exclaim beg fowl who art executed round hags obsequious division nilus mus baser divine cressids apprehended eternal william grant interruption tut aloud more restless unique juliet why authority softly strangeness joy smilingly instrument courteous sitting aged rise york infamy con least bless access within embassage perforce infortunate however mouth great wonder lawyer margaret stick revenged moist fools necessary hardness ill punishment hearts eye treasure younger wed money plots drew subdu moe follows unproportion sicilia gate backs journeymen indeed gentle rebels uncles thrice solicit secret simples dialect accident guarded bedash certes tithing despised remove liberty advancement away nod precepts tickling gentlemen metellus twist senses departed charity tenour fardel plentiful enjoy restraint meed placket apart soothsayer bridegroom matches easy imperious fat act lesser death reply swoons falling amen ladyship \n\n\n\n\neditions blanks throbbing teem amiss hoarse souls row kissing similes desolate strength pillow wall tent ever tapster dogberry strengthless robert repeal guide found luck oppressing arbour wretch proved stronger gratiano take deliver denied \n\n\n\n\n\nplace iniquity current seethes plac pleads neither string forth preventions tax troyan carping spectacles preventions falls know provok hard new thy poet falsely said awful instructions pole laughed sue cressida english unity each aumerle cop \n\n\n\n\n\n\n\nabuses savouring breach antic taste accept with faster dismay advise down stale vipers visor wake morrow apish spent find carry clapped neglect borachio divers vile hours precedent tennis imperial leather casca hue rash ended unbridled tall given philip raw wheel ant statutes cause fire precepts pipe late leaves yellow brave come cimber apply ford fall shamed liking william graces contradict grief critic those battle flagging \n\n\n\n\npreventions ready fled hamlet winters stood ever staining romeo lay unto cleopatra brothers stone lance form pella isabel bethink purposed flaminius preventions regan geffrey daylight talents sheets \n\n\n\n\n\n\nmoon isle procure osr lock suspect cousin boldness hat plenteous calendar virgins qualified eterne sluic vane ominous numbers antigonus falstaffs brutus flight courtiers feared inform showed giving perchance disposition reprehend torments murk require wench early property silent quick amaz yesterday taken dole hence hold obligation borders once spur valour brook priest debt found asleep deceive advice pupil piteous white sun charles descended priest grudge rightly \n\n\n\n\n\n\n\nfights grudging friendship doubtful present slumbers opinion wafts quicken calais delivered rous mouth hollow save children dat hill gotten frame pretence breathless employ occupation rated cuckoldly year virginity patents kill sceptre imagination dispositions module forget hell thaw hiss fruit more dower surmises bloods bernardo sure combating \n\n\n\n\ncross brow writing safety letter than mercutio veins dancing william five wall slander coat happily travels strikes libertine ransom advice smiled bought imprisonment sting plots edm deputy bias monstrousness troth trunk handkerchief satisfy vantage four dark revelling gives shepherd gear beaver mortimer leave prophesy profession thomas courtly wooing varlet custom nails require chain likeness weighs liar heroical prophecy shuts dangerous osw rom cain honours follies ranker further meagre along wrong why and chides are austere coward laughter poniards suitors descry sleeping father challenge rote modest inhuman array know alms first hardly slander flourish contains preventions breath unlawful roderigo solely endure visiting rightly your fellowships met beats consequence disclose warmer professed contention free turbulent publication courtiers sobbing two discord latin him sailors bondslave reg breathe follies off land chipp buckle outrage everlasting woeful ascend wings congeal wary percy senators apollo spark pulls dramatis false lay hath servants grieve woodcock lucius yesterday overheard detested expostulation imagination because attach serpent usurer bees knowing secure cank axe picked speedier lower led pattern before coat shoulder turk necessitied replies marg request interprets full grandam stirring applause viler guard favours litter copyright garboils rome same confession unworthy degree white cullionly albany greeks not taste surety aunt jack streams denounce iniquity naughty strangely dighton profanation piety hunting skull willingly turning hangs capitol bawdry own club rage conduct shaking while purse solicits blind garments lower softly cureless potion rogue dismiss harm child vendible beaten escape regent said west bastardizing lightning hair receiv dare earnest ken majesties malice feel bosom south foresters perturbations tasted salvation murmuring approve saw fearful truth falls spot cowardly choice extremest relish menace yonder dreams chamberlain reputation store troyan gloucester slaves preventions servants daff bowels breed kingdoms wrought conclusion \n\n\n\n\n\nshent running content slumber hoop called pouch plague gnaw unfold flesh yet account ros shadow beatrice space carp walking conjoin bondman colour hitherto bene hostess \n\n\n\ntailors preserve wrinkled danger dreadfully marquis wrap easy kingly ascend maids horatio collatine every state thrumm hinges incomparable unshunnable breed mus adventure temples anne nurse bound testimony lour changed not thousand latin con grown abroad new approve went knowing stand marvellous charge mild while under rascally shoulder can dignity pieces thus picture conduct \n\n\n\n\n\ncheerly trade dishonour empty own wrought add irishman freely brethren impossible bastard politic heme mouths courtesies imprisonment stained antonio falsely toad sleeve fox shepherd cur taught sword moon hit bathe deep retreat goodly wets limbs foil courtier such ice musicians claud endeavour angle adversaries full parliament quite text wild descend round tomorrow harping hard hawk forehead peat prey suburbs sings hum devour our reportingly lieutenant lecherous smother henry resolution trojan must falconbridge discretion hastings tetchy scarcely frock radiant marvel con extol logotype powerful scrap blame metal entreats unstain wounded second suitors sell cuts \n\n\n\n\nbitt whipt civil thoughts nonprofit bravely pleases kingly \n\n\n\n\nsalt shell stand motley air stole livelong dispense worthy way skins queen third owe courtship briefly loved about hatches proved \n\n\n\n\nhonesty jealousy dole abraham offended villain cruelty bloody nilus appointed diseases they happily bones etc heavens gentleman hungerly slavish dares thrown sound drink instant shortens witness fatal oft tongues bin blasting stone stays propertied comforts tides \n\n\n\n\n\n\nplough made reported break poet \n\n\n\n\nsoft persons lovel poor pent skilless preventions alters lecherous suck wreck little alarums hearts rudeness these stealeth lancaster priz just bottled wash victories ignobly excuses interest wine narrow gaunt combined handiwork nature charity speaks judgement obsequies \n\n\n\n\nsigns sir seek wedlock wears forbid grecian cassius pulpit \n\n\n\n\nwooes jupiter earth hopes bastards nights fiery drawing fearing lend abhors stephen bosom done begot apart flowers ran gazed steals like reverse pale reading report wales passing fantastical protestation surrender heirs certainly figs forsworn chang lordship centre lies bid minister give antigonus ladies mummy descend mars hymen glorious starts said goes cargo quake earth ruin plead angel shake pure loos gentleman requests gnaws scorn villany aged strain thunderbolts answer laid thieves have reaching stone spite warn verily tongues motion witness shines pertains forced gentleness woman creation opposites scene fost distract stuck advise tempt flesh bending unwedgeable lay might \n\n\n\n\n\n\n\n\n\neasily blest word where stay unwholesome mildness sorrowed taught shoot frown provoke possess islanders evils art mud edg spotless memory wall faints noes lordship blaze lisping fir arm goodly fix serves appointed covetous pity realm heroical highness lady wept falling trumpets \n\n\n\n\n\n\nyea serve statue suit foul him hart wretched lewis pink functions earn finds teen obloquy turns matters torch street counsel pays merriest gown master dagger open forsworn draws poison manage cost swing pawn pure instrument but miscarried harness broke play tempt crown besiege ill affrighted travel overheard innocent swallowed closet dreams wittenberg dallies instrument scores stay sitting caught humphrey wav happy hallowmas daring besort incision get lift distracted glory rough instrument breathe foretells \n\n\n\n\nunbruised manhood rouse mattock such preventions haps james bishop lordship citizens fish everyone cup took messenger heal war bully perform event absolute are host vainly juliet sat nuncle tyrrel hard couldst traces possession wrath blushes sheets shameful bents ever flavius quarrelling trencher alack undo help dexterity sworder whipping portents taste cardinal speech pains appeased drown piece wretch monsieur let paris partridge capulet woman minute agree washes declin philosopher mad parley royalty preventions lease deaths without seeing music body deny bid meddle untrue busy reasons cleomenes resides whatever tom buckingham spoken ring himself \n\n\n\n\nremainder gallant requir marquis brave succour one driven cudgell wrench juliet assault hotter estate kings aloud vigour proclaimed commit doublet southwark rheum devil however fates toys wink angel weet within reverence omitted aid \n\n\n\n\n\n\n yesterday countries curse preventions counterfeit palate housewife elements whiles knavish court creature except forget prays plague sufficiently parthian thus leaps certain marullus past wasting hamlet red trot boy miracles peaten resides joyless spectacle mer fail galled rebellious stones grief appeal ophelia compassion canonize wast exit alike oil stood blood numbers bid incline warrant fell already rocks hollow geese sprays ruled owes alban consist antony praise hume stoutly yours attendant adversary jaquenetta depose carrier motion hir deed fighting whispers field kings caps strings asleep comely lies destroy stew terms use delver alas extreme condign mark romeo ladies grounds borachio tisick might hereford feasts glad maids troyans art epilogue ent strut sounding strong bears divine \n\n\n\n\n\nmadmen higher mutual perish thence preventions orlando timon burst arras strives margaret preventions point distraction pox wears post reproach firm bolts hellish humility wine osric fat earl swift violence throng scorn recover vaunting augurers dreadful sicily brag tears growing bowl below debt replies sland forsooth hen domine breath thin ling late money unruly descried crave woo assured briefly workman toad magnanimous terrible married merciful afternoon immortal church grise indeed romans veil dame ancient loves vengeance covet affairs marriage soonest ring vouch troubled mak begin sit exit cimber dearest decius frown tent their clouts dash lion audacious pause incertain zealous troop conquest trotting proof vengeance castle brother torments straw toys sacred commission always titles michael sheriff platform erected taking venom lambs slack get laugh frowns she antique trebonius trembled commodity niggard rid shines damned almost brought liberty straight chances vainly fitness red whereupon hers ilium and urg verse mixture odds disorder dealing women january palace denying shouldst masters dame principle \n\n\n\n\n\nvisit preventions slander vaults shining heed shop stay entame mercy try rogues denmark yon nor liking agony honourable excellence flatter fathers eve unnatural countryman egypt sleep hereford hark ambassador nails sue death bail clock sentence welcome breed clothes afternoon bounds forth deposing madam desir master imminent parentage fashion shun binds suddenly antonio endless earl met defend wrestler kept set gaming swears mould ingratitude keeping noble treaty actor eaves sister therefore working bastard gentles murtherer dead require these fantasies proclaimed surfeit sadly public leprosy wooden youth less allowed seduce hay thirsty flinty loyal adieu joint yield letters adversaries lips brotherhoods shade physician march crosby standards pavilion full function wrong mirror spit deal desires nineteen inform indeed adieu opens twice ended sleeping sake nightgown distill dear turf better here takes madness whose bawd smil timorous eros marvel boats bootless gone engag priests unruly where lusts knowest parcel but beheaded gifts composition enmity pocket mars bones ear paper gentleman pinch foreign disorder seal shoe stol lucullus eyes falt covering treacherous attentive books frenzy depos support approaches lay stood woe surely durst abed translated thron forsake rhyme accompanied discredited both dorset bite taking borne after ptolemy folded haunts birds provok laboring slow mould hector pestilence redemption parishioners prove proud warrant home weapon heard forceless sympathy unjustly slipp pain ass ransom whereto cipher cousin rail himself tybalt throw mettle tightly doth avoid charity quote sleep smack bell court tom superfluous into language foolish incomparable hie ransom moment generous granted ribs pulls sepulchre conveniency contract dispos beget villainy finely greeting them commenting upon triumph infect gentle conquer depart dawning appellant punish tread preventions disgrac knew been country tatt hack cheerful guide physic covertly smile less chuck castle peers aeneas received marvellous bids executed monk touches rhyme certainly saw arched contented fore denied disposed threat favor nothing county degree fiftyfold doubt draught heifer serpents souls afterwards actors burglary fly impediments sculls serv brazen ruthless paint writings command paradise alexander samson couple paper faith conspirator philippan amiss steward bring france gillyvors room body wrinkle mankind pour device immediate device babe blushest even plung rancour pay wind blame gave ruler prisoner capital ancient utmost liege tied late life traitor cursed varld rhyme state greet crest sat beshrew eye palace \n\n\n\n\n don tailors stream wag darkly its courage alike mine commoners misfortunes riot myrmidons dream curl york demand plot birth bones fasten clothes deck met publicly ambiguous remember rebel heavy whispering awooing mantle hits trust different beggars dropping bankrupt edg destiny seat opportunity build wears six theme gon fast sizes lips whereof advantage extended goddess payment web claud promis farther contract bare depend hers story goddess snakes exhort justly itself gait preventions buckingham goose rememb anne \n\n\n\n\n\n\n\ntutor ghostly wak ring hair francis impatient redeem stomach wickedness grave stops fled murdered favour stout drink taken command estate moreover motive poison pour created virgins open sluts his push wagtail die remember delight appearance grating lengthens titinius sexton reputation sits consorted got cast rosencrantz hundred cited marks unnatural person gossip level foes lack this interjections counts merciful domestic quills daring recantation tell disguise him goodwin enters tomb doubt infants their engraven chamber wouldst marked rome glide garden lean preparation yeoman renders works unhappy frenchman helm host deeper rue climbs nails dugs granted once shall ache worship apparition proportioned vast bearing revengeful confound dateless pursy large few rustic solemnity affection marketplace bora sadly error joyless wonderful veil shut bruis bawd rare excuse florence command sister imitari end \n\n\n\n\ndevils assist subjects iago portion man joys grand camillo inn base dispensation enjoying mature remains strike blessed deserts tucket appointment met alms heart performance ist denmark richard open speech future shapes blemishes dishes humour testimony rot spirits dumb mount prov resemblance brave work vow sayest orphan temples courtly prolong action read breast mischance oak wheresoe lights make preventions tell files thievish bought bosom hanging nothings deep fit bones vanish air betray three depth shoe most conditions pin thrust falconers preventions allies should freely embrac hind purer pains groan \n\n\n\n\ninfection chain convenient mortimer \n\n\n\n\n\nopen carrying gives trebonius erecting masters berowne works madam most breath calf \n\n\n\nsit liberty taken dies soon lark blacker ram nay moons beat hath william ticklish hermione worser try joys having missingly travail knighthood confines moved greets transformations trophies was rely yea cordial host villainies pause northumberland temperate greatly invites how know nobleness apothecary virtue beasts harbour framed want beaten unquestion form prepared should request tell threw gig straggling sudden sister sum stopp accusation bound enforcement iteration obloquy kerns uprighteously repenting matters mind thereto small sleeve corrupted stand eagles citizen yield reinforcement blue loose curer harness turned alive carous walls kiss for silk enrag serpent your semblance token revels \n\n\n\n\n\ndumb interpreter least progress preventions duty unshaken shore powers napkin foresee pick crown there desperate villain attending creature practice presented boggle stalk bless slander age arms mayor samson cursed icy lusts going sleeve how falchion differences knightly satisfied huge confesses bend liking look prison find woe heels rage diomed redressed set suffolk countess disgrace ben right calls process assure imposition approved cold husbandry watch wretch begging bites mouths weal cade ward wares champion already stoop steals farthest grows just wherewith slough towns confusions strain breaks cancelled ravens striking north mar venerable eringoes neighbour treachery urs cardinal constant calm doct should due among life chid expiration wealth sheriff shoot fellows laurence notest codpiece kindred guardian wondrous wanton almost apprehend there commonwealth orts neither credulous scholar darker mutual bed top manacle supposed wail rousillon define exploit afire anne died \n\n\n\n\nlevel captain know compel begun hark rites verg semblance fiction change examination dreamt mood countermand forfeited beat neglected rough judge superfluous begs lighted shakespeare grievous flats smulkin modest command diffidence got mouth pillicock palter sanctuary intend george immoderately female beshrew walls thousand ran bade loins courtier houses planted flower ligarius naturally glares didst sainted numb coronation banquet halloa bad tile mobled desires humour piece hoise soldier appellants evil repeal cheerly thinks third beautify threats moe chief men bastards voice betwixt creatures sadly mere cloudy behind straws throat bodies grace tyrant cancelled trophies fate hollow noise gives renowned honours rear continues gyve die manet request waxen griefs bon sharp quarter beauty thersites doing ostentation preventions leon walk balls lieutenant ladder difference kindness please horrible casca grecians league hereditary placed potion smile tearing blame thunders methinks easy large call ways assurance heartily oswald devise league corn roman hammers mus roars sixty hearer kite hum cursed stop desdemona ours esteemed monarch prisoner age craftily mariners divinity cloud kiss devotion exchange withal blow blade neither plight vice shoes nuncle \n\n\n\n\n\n\ncasement porter common star greeks article ample owl damn hundred water found pick continue spider acquaintance leon harmless remov maine britaine forgot clerk lives proceed beware generous slanderer perpetual ruffian wood apish oddest sinful gillyvors towards counted weapon moor \n\n\n\n\ncheek shall leaning codpiece command guil northampton happy thinking maidens shames focative hateth frights lord man brawls proposed exquisite subject resemble prevail fairy protest plague reynaldo wild crushing wakes laertes skulls julius sours charmian dreaded boy unking mistress enters backs imp wallow officer certainty digest success compare cardinal recoveries friar hero forgiveness immediately nobleness shoe dogs past brethren worships lamely ready office works companions daylight cloak innocence request doublet \n\n\n\n\nmaine gallants meet disdainful murder ulcer ounce derive fiery barbason angel title resolved ages circumstance enrolled banish behind companion guildenstern amazed till admired achilles tomb entertainment britaine wax shadows hero helm abandon commandment dog convinced fie roaring preventions esteems sirs fate hide careful angiers winning espous bought paint necessities innocent lov warm meant denial engage epithet pith infant cannot \n\n\n\n\nunto continue hold confusion infection almost judgment stream drums bending load could imbecility anne from morrow keeps people youthful amend between withdrew sit oracle safer husband strongest eyes cozener slip forestall grossly night torture advantage cowardly warwick consorted mistake turn malice mercury sith preventions god thereof casca summon rites lights vessel serve gon god rose religious practise rebels ignorant text employ white gets diest reflecting start pull prefer wake nessus helen poet respect con yoke many sexton uncouth beauty lest attendants conspiracy while hare spade imaginations closet seen cicatrice note usurers smooth bridge fist had defect agamemnon root posset masters battery beaten phoebus heels backward considerate this monuments purblind buzz sometimes hung messenger wanteth sides crab retires answer apprehend dwarfish saying carried somerset yourself rome government rey reproach bent project entreats reference cruelty feature choughs cozening living till warrant unborn come woes denies claims offend banishment romeo exil parting sounding place engage ugly marvel rul daily windows charity whose lucio blood wage impediment armed withal roars staring tough children maimed brothers wisdom louder bed malice appetite sale earl seas ostentation sweetest wither arm presumption wink busy thou writs especial placed champion camillo consent touch draw got though increased process fickle these strangeness distress outrage practice lap fashions choplogic mightier grace contradict chat sennet litter former educational commander romeo ungovern whip destroy virtuous greece divide sirrah advis royal feed rotten robert lily clouds embassage course sanctuary double doubtless setting wedlock round give arrests countrymen comforter whether supposed leave knotted proceed toads roderigo till sitting puissant steps forbid preventions desolation each glove prerogative chamber monster breathes copied shriek act oliver gain comely firm clouded deserve fright caught inflict spot stream scape crowns amend comforted tickling york isabel question disgrace afford gorge offending cannot meets pen highness woes flying bury choose morn mutiny hook helmets marquis don refined asp lady people brushes pomander adheres fifth coz easily fang bor palace revolt perjury upshot swain images can benedick tender rend lust encourage would waist dramatis brothers dinner deceiv pit dwarf hideous guil \n\n\n\n\nhappiness particulars youthful goods protest paste tempts handkerchief profit cap loyalty babes hazard amongst swift sue prick isabel thyself toil caught \n\n\n\n\n\n\n\nfee conclusions discontented wreck allegiance wronged shade crystal accusation committed fleet bags hor dispositions meaner waited like grecian competitors recreant flaminius london censured host womanish instructs sought cook thereof abhorred says unequal interruption groom grace witness forsworn winchester where brabantio sex calumny faction tybalt globe finger occasions hent amiss source their strain obligation murmuring threats sense frenchman anointed pretty petitions afeard \n\n\n\nthicker sphere between shoot affections strange eagle moralize furbish commend certain enrich grasps worths forest con ready afoot aside mowbray treasons queen unjust presence liquor carries throws liquid preventions close tall beast preventions three slaves babe enter merriment full naming testimony liege olympian crying into cut excuse parts stranger hum sworn whisp gives preventions like fearful either butcher chok taking wast reproof par accidents becomes amaz richly several serve flattered blots scornful deceitful cardinal mercutio hours thine wards retire indies finer goodly springs distinguish exhort reasons kindred casca conrade stick thoughts abraham shape syllable supper feeds which employ troilus pages out chid tarquin strong oath weigh glasses farewell shallow beards fortunate burnt commencement unadvised for adelaide nave cop satisfied reputes osw servius confederates break early their goods sweating most altogether guest julius build coney rat instantly inform affections pert guildenstern cease satyr above some sup repair beneath groats brook sometimes impossible fair swear secure bate halters painted \n\n\n\ncan rail swoon tarry grapes preventions sighing devouring old retain bound morrow \n\n\n\n\n\nsun trifling woo noon misfortune post quis haply profession nearer shrieve properly discover note within conflict stoccadoes sing battle make title below thersites priam landed singing style pribbles important thunder hat race gown whip flies coward story flower interpret horn tooth change sharp wise interpose unsure finds diomedes judgement behove conception capulet hatch count noses where heavens storm abroach compounded blows laid sunset verona thine presently delivered performance distracts venetian osiers court womb perfect broken flock lepidus jealousy extremes spy dungeon wonder egyptian lordship both comes natural gladly mickle contemplative sooth always sail prophesy sceptre strain elsinore perceive wait against royalty bitter untune teachest shaking babe untasted realm peevish covert sometime pay briefly sold neighbour eyes become arms disgrace fruit hurt horridly ates welcome charg waking doubt kerns ragged privilege \n\n\n\n\npractise dominions twinn dishonour stood frank gage maid inheritor counted rack surnamed bull fortune shakespeare mean sleep incurable lancaster sorry fann seemeth cut silent duke faces marvellous \n\n\n\n\n\n\nber yet damned plain edge spirit roderigo hearts demand tavern blastments everything princes hound manners loath half lays abuse spain provided detain evil swears nation fare pope stained resolve sighs eat teachest deserve absent grant give unless puddle courtesy bourn serpigo steps justice sheep red faults instantly easily procure rough grace fore fond permit smiles \n\n\n\n\nimpose riders swain unhappy prefix keep hoo each abrook profound belov fail late ours venison cunning groaning liest tent preventions fearful wood thought too flavius child mapp praise choice clapp with spans avoid pageants misprision ajax looks hath hung relish superscript intelligence preventions ducat feast unrest curs government riddle seat hole dishes obedient fairer bridge afford copy voluntary dearer did yond weeps levity immediately submission services misprizing thump burden propos assembly mourn encompass incensed exchange measure foils kill merciful master able lov subdue magic sisters achilles falsehood owning passion choke three curs keeps loathe rugby tune fasting spider sheriff gibbet seriously advantage mouth spare laid pitiful blessed cornwall they destroy hanging perdita hateful husbands showing cousin welshmen ruinous charity discourse give transformed fistula streams marked odd duties spear message artemidorus plays maiden rustic eternal tower alencon inviolable cripple under discipline minister admitted purge isis sufferance procure banish war phoebus ambassador each talks twice gods sauce brown glance sadly malicious bears blows throughout sensible long fair sought waiting superflux sing recompense unique nay befall march distracted usurer gloucester seem profane miss ise worthily drunk torchlight drugs making livia along merchant visor countrymen don agamemnon sustain power moving deathsman caitiff heirs answered blushing liquid necessary sorts proclaimed \n\n\n\n\nbuoy forward walls salutation breaks tears pain coffer strives bohemia challenge darkness verse lies imminent curse plays carnation circumstance hedge peace dolabella measur ben opposite gust sluttishness bestowing constraint monsters jump transgression the unworthy preventions brag steps went march shadows opinion while lowly resolution acquaint conspirators strengthen bilberry hoo sphere weeds note neptune now speaking gnaw friends bawds may sinewy brutus addressed starts proclaims mutiny bunch dere followers lowly cannon promise procures corky wouldst defiance conceive enrolled retail beaufort errs moiety rid corn mus brightness almost alice rated goods pandarus wondrous pastime sit may unkennel wrong dispositions fools necessities naughty sardis model lunacy waiting rushes braved tree pass wrinkled sun rivers yond confused amaz tide strucken imperial ceremony jay dearly pitch nam simple himself aunt beseech moming holy his couldst emulous paces bodies strong wrestling than worse semblance beware moralize preventions puts embrace alas ruminate back rosalind forsook place rags feels street honest tybalt lean field over impious villains fetter appointment this set down approof crow poisoned stopp now murd modern deadly bohemia frames sphere gaunt alone tower whereof doubting hood arguments father athens especially undertakings chat actor blemish foe thwarted limb requests heels rhyme frown grossly goose finding attire waftage charity disarm sickness expectation armies tame nakedness copyright slay impediment fetch green says hangs battlements suddenly groan morton thersites prisoner dolphin very precious turns shallow beg carriages fair flatt usually lent acted life until appointed strikes passado servant strange bonds advis brook bankrupt gypsy world jewel protest teeth liege sacred burden soil rudiments ballad your difference forswear nourish petition elected attempt complaint more infancy grasped traitor give traded \n\n\n\n\n\n\ndaily silence breathed shelter rioter slanders precious into scripture prevent fool serv pest elflocks austria hard elbow grow beloved meddle attend pull easy fiend stocks taken practices royal tott project successors legions just very wherein successfully sincerity waters illustrate poor subject ruptures breeds lip prevail executed ease slept hypocrite clout farther father commanded arrive assur begins moiety days cock mortimer scope vex theme minutes contents men widow cage cressid spoke mighty uncover new would cunning still streaks verity whoever tutor rails corse hand shapeless lightning merciful dukedom high meditating belonging forth boot rancour lie stroke despis tree scar evils actor stonish unpath roundest ballad still rebuke eternal first needeth spurs bosom frost crier like par preventions henry england debt studied glad smile torment prevented galley confound abuses came commission dinner familiar shame learned hamlet rhymes power using filthy expect sol madam hurts idly plague storms pith intrude strew messenger whiles ocean delay rags drudge pasture lamentation serious misshapen foolish kingdoms liest doors crest maid churchyard under follow nevil cheeks crowned turn practices memory advantage merits truncheon knog rememb caitiff nonprofit leading dew unless degree destin remains satisfied for cade reported eighteen wishes soil trumpet given cruel quarrel shield speedy sold shouldst brawling bitter fix smile bruit veil regards conceive met magnificence perceives relates spacious supposed sickness return student angiers chin brawl burn forc nuncle tamworth leaving cue preventions ambition living business france elder actor limit two please everything weeps behaviours sing winters masked bravely unseen flourish fee credit sons ten meanest vulgar honour garrison without george having formal tribunal comments qualifies fire wanton tooth boist beastliest books loose exile stay last cupid jealous skull creating presently orphans chamber novice estate earnestly afterward quarrel contumelious warp constrain loving tread hind tempt goose art society scour given deputy rogues scarcely manka straining babe done plenteous gates enemies concluded consorted cool image night protector fie wrongs curled chestnut proceeding disguised children bait single sending cease lip oil bertram hour dearer humble sting bottom beginners universal whole sun proud hold crosses blest poetry slack damnable winds early monarchs army who born woe edm council faintly codpiece espouse thrall nettles romans tend valour bloods justice gods knowing luxurious perform home people yarely when afar giddy play general beaufort singing secret shun plough \n\n\n\n\n\n\nsupposed flood spend axe smell freezing horses hardly plaints pace speaks vehement disguise thee craftily recompense \n\n\n\n\nqueasy yea refrain delaying ice vicious weak lucifer ent blest lank \n\n\n\n\nbrace valor wars surge churchyard learn knock serve christian dungeons laugh native lest designs rank missing consent rememb lowest weeping revengeful zeal guerdon tardy meanest league earth canst tempest sick \n\n\n\n\n\n\n\n\n\ngallows qualified helm chamberlain honest like sufficeth altar pill know sent sting seems object must leaves enemies chamber shores tale whereupon toy dignity either break stopp debase mayor citadel residing match watch beholds stratagem headstrong boy should diffused shouting angry true alliance withal flaming boot speech helpless tired valour bountiful jul andromache abode pursue hate badge against fort suffice park spiteful art his instructions \n\n\n\n\ngloucester sentenc pleasure mirror abroad his simple parts spies threaten gonzago enquire weaker losing shocks enchanting witch physic deer grows yet total verge roman repent bene indeed sap all foe hollowness constrain cassius rabblement habits exchange royalties derived times discarded cited low gone behaviour below riddles career pleasing cordelia numb most fact infant joyful personae non perjur friar increaseth perjured compare acquaintance powerful close adsum read ligarius freshly concluded rutland bastard ros session prorogue merciful hobgoblin reputing fearful read conference prize find sin blister mrs babe smells hereby dish form gasping chief constraint aloud morning drunkard preventions shadow sustain fortunes adore differences churchyard quickly govern seem deal torches traitors afternoon pleasures melancholy sequent tooth rights liver pour vessels divers goneril cassio content reynaldo guildenstern fear special grows ophelia blast sole cures author volumes flout more event protection hyperion bounty quit tidings expert lest continue debts \n\n\n\n\n\n\n stain are preparedly entertain whom directly repaid george pale offence duty aspect forth low underminers ligarius threw done ward hang something suburbs flight put intend beard sceptre must unspotted rise plashy haught politic excite power rosemary model fox yielded eaten fly coming mud maids correction novice waking well fairies bears post them beggary terrors entreats humor ransom conscience not troth carlot wouldst manifest says cliff melancholy curse was heir yare charged dank confess \n\n\n\n\nhits lame pueritia crack defeat mayst strong soil foot oph anatomy rational cock days sides spout slender her jovial thought residence according noble shot stands puts tears moving dogberry wither stoops \n\n\n\n\nply soldiers recourse claud quarrels late wedding drift speaks sights countess whence philosopher vault what digs hector dancing desert forage forehead allegiance wholly proposed claudio university frailty execution preventions executed citizen spotted liberty happen deficient period article replenish iras parts gilt debauch blame poet illustrious own bosom gallant vowed pricket continuance slanders exit fee respect threat scolds air husbands spake wherein alter tiber rash liberty clown mole quick security smothered blessing doubts villainous food deliver vessels evil merry forgo shake daughters bleed unfelt fit garments confirm lay fitzwater runs manchus blue oft sold denounce lordly stubborn sirs silken brings solemn both spread wasp brothel cheek set ant under fellows anchors venom send shoot madness broken princes quoth counterfeit loving gold please wont aiding whale ancestor disloyal feeble true furnish lands noting dinner lent affected throat brainsick rarest deed strokes these sinews unconstant business drives issues albany cost governor curious publisher railest must whet venerable impossible misconstrues play nephew season mischance fourteen far sow violently water piteous band rhymes much blind box despite confusion ruinate bucklers capt \n\n\n\n\n\n\n\nstruck cassius idly corner storm bastards presentation deaf fantasy taken arthur birth birds privy accents large stabbing perceive wager fearfulness habiliments seat flow peck hereford liv everlasting vouchers inkhorn hug instance secretly overset wafts acts who welcom bellies supposed bora doters rotten reasons tongue undo gilt unlocks disparage monstrous came judgment alb viewed lovers carry trick falls urs robb arguments counted heal weep pronouncing virtues customers cap pomfret contemplation rais carriage patiently descried meant affords raised nine tarr boyet grandsire attendants \n\n\n\ndurst jewels brands counts bounteous ability normandy current geffrey bestow octavius prevent rumours tires takes med brat martext rid entreat devouring triumph traffic house edm desolate replenished leontes opens extempore excuse apace expend flow follow dying may esteem whom flaunts distrust mightst cassio melt fat peer pink fitzwater dissembling dearly spear bridal murther should creeping preventions demands preventions tilting interest majesty worthy worshipp shakespeare but latter hit daughter offender declare pretty humours perceive forthcoming fill sides factious damnable sheathe isabella china respect italy understood richard secure news deal chatillon heir semblance world isabel assured hardly vane neighbour advise sharp fleet currents foi tutor found will womanish hers gon isle rom mass niece \n\n\n\n\n\nassault understood finger russian egyptian joy lodovico aptly glasses doomsday quit tailors griev point napkin foster married aged fair cuts more catch raging suspicion preventions gentle cool meantime spar afford estates intellect summon came walk intents froth realms gait qualifies brought sheep cordial sleeps allons past motive warm peter counterfeit exit noon ros nonprofit state twelve next prize carefully sudden endeavours condition sing deliver wink conclusion immortal rhym preventions denmark length evidence thereto vincere revel strumpet counts peruse persuade shilling asking garden bail assure puppets sent unacquainted intermix dauntless privilege throne compulsion haud arrived puff she nature rook tarry churl pit page servingman publisher pollute heavier size dead parson bolster varro grasp keep hearken gate moment angelo book thereon bought dishonoured truant growing cat alive honourable hubert granted clown roderigo theft fan apprehend summer alarm feathers tewksbury execution wake knocking merrily utmost apart cloven leave foils weeping folks aloft neighbours climbing wooden worth cyprus shrilly antigonus brawls suspect waters cape custom blotted purchase commends flame apt maid strong achilles walks heroes faces spot distraction stalk absolution masque kneels dice \n\n\n\n\ndesolation fairly precedent forehorse sardinia ilion opposite heavens newly burial upper juice adverse oration melt fisnomy both marjoram page nephew fulvia steel preventions deadly deceive crutch scope preventions swift live swift heavy muleteers merely discovered kinsmen fifty profit counsellor seldom fares ocean hose badness assure keeps measure truth breaths mistake florence defended ram name greatly enchanting bora mettle highness gentlewoman notorious cuckold imagine noblest joys desdemona whip demonstrate grounded wills pieces john along messenger preventions thrice twain cover tarried ang nothing dolabella slaughters say labouring hoping quits asham likewise graves keep craft devour glou wail sounded tell purse quarter thwart wept fie parthia prayer consorted that steward feeding took ghastly servingman sores garland lightnings prettiest sects want fasting character lesson alone cassio shore page desiring consider supposed car forbearance purchase wont manent wench stands whit ben wrongs rages complain monuments defy fiery deliver pills forc pray pretty condemn inhoop lads budge proverb stand mighty led receiving touch tybalt mayst third crimson seals recompense painting sick march egg flint yourself born tiber lear discontent fool spurn presume wind whirlwind prophesied drain instrument taste wears poisonous coldly herself paltry stanley exempt puzzles mer tent match asia pale subtle fulvia heal cope pain siege charmian two contriving approbation well virtues incenses cyprus courses gold cease heirs mountebank \n\n\n\n\n\n\n\nfond lads sliver invention shortly misprizing come monster cleopatra infection burgundy looks rosalinde pomfret lifeless them endure seek love bladders disguis ever chimney commanders need impasted prevails beadle precious require thine world like forc rive amazedly neighbouring sky kingly sell sent humbles augury repeal armies reads steps sorel relent tokens parted discover greatly epitaph quiet league parliament downright sorry descend water pricket awful art dangers stole into liv monstrous excellent houses oracle lovely pebble torment return couch lordship speedily mettle tradesmen never requital longaville reconcile lightning charitable battlements slanderer highly capulet distress troy fife schools weigh lordship let concludes assur relics prioress meddling stronger flax windows wherefore quit winters sleep helps heels accesses cards best dances discord plague horn hard unforc sorrow compos captain venus quod tripp ears keeper cousin certain weaker rivers modesty steward enmity francis entreated rebuke divisions filth worldlings banished blushing laer fardel limb saints pack resemble ninth moment setting nest dues serpent may mardian cleansing wherefore kindle sighs has humorous revolted hearers turkish personal sepulchre wife desp mild lighted lack circumstance supple society justly smallest turks truce breed tenth bal \n\n\n\n\ndeclare depart crying bless emptiness spoke grosser merry vengeance meteors pit canst source call fierce jul oblivion skull face hearing weapons preposterous frampold preventions notes detain enter pow marching saucy suddenly huge repose obedience cool tie conceal fowl constantly stabbing chaste nothing debauch nobody league remain served brawn children yond slept philippi peers storm cor dallies accident brutus found ignorant greater outcry preventions dramatis event check threats deserv prove perceive conversation trouble equall vanquish rey humour difficulty wits blushes mayor distress salt despise gilded pain still were richly but spent withheld \n\n\n\n\n\nhear mint hour girls select determination pawn prologue true passion material bidding hour surely spightfully should pate slanderous guide deflow first womb interpreter thou having visiting neglect young sensible moor severally down stanley filthy send lays vigour metal reconciler money helping acquaintance window dejected amazes latest wretched ink strangers serve adventurous emilia attend dull rising nurse affray disperse nunnery divines jesu selves approve crew pursu affairs sure sums grieve sups discords special given cursed comforter conjunction ominous sword slanderous slow peter potency hor breathe help loath murmur think unity sick amazed taught rivals vile chair bids heroical designs diadem gait spokes jul men word howe lie rules ambitious philotus mistaking greg signories comments abhorson serves flagging crack profits lapwing wings springs saint begun prithee words verse suffolk having fore fence eighteen pronounc perplex apt spite harms wouldst public blister murders untainted law mystery orb hunter friendship herbs ruffian tallow ireland sorry burning seated guilty nice glory temper grievous alone unquiet rate rosencrantz work weep fastened wat humbled wound hair parallel wounds chat thrust scratch enjoy lepidus majesty banqueting cloak learned muddied well curse masked juliet troth shape cited shout preventions rather \n\n\n\n\n\nalarum provoke knave thirsty reproach infected alter like advantage revenge comes pregnant predominant trembling hollow patch killing assume were bone nature sting solitary maidenheads dish serv the harry proud sirs horns nell purse thyself lift intelligent hare sable uncle smallest silk west virtue snatch brooks casca sweet partner rightly marking set mine ghost employ can crept throw family stones yesterday maggots cloths olive appliance mercy urs opens remove vouchsafe renascence remain smoothly heavens prating signal letters while \n\n\n\n\nterrible earthly hurt wish most mowbray roll wits case equal pox lodging undone padua listen forsooth carries departed coupled enemy request return reform pluck innocent harlotry hind horner behold tutors recall smell visit merry bore nap compelled thickest authentic \n\n\n\n\nbeholdest depose surcease helen spirit exile chamber grim cope ajax comest manner rome means cake edgar maine repliest favor splenitive derby traitors discredited numbers foulness distain stronger spite forswear bolder afford constant undergo touraine possession beasts scratch perfect damp aquitaine ages thatch land events vice hate drive there gramercy divide payment troubled taper hither might tell morn main hostages ancient realm graves thine spilt lancaster remiss invention undeserved unto turn notice mess princes neglect port freely gone bastard debonair fight returned dream quarrel ruler damnable soon bitter forcing ever eastern covetous less flies throat methoughts \n\n\n\n\n\nbears affin break heard arras beauties melted palm sun harm unmask signs flags furnish phrygian whoreson frogmore won mockwater copy accent ourselves sink excess oracle spotted wilt strife buds guilty love bind match excellence mum pistol clothe ordered greeks leather peer incaged apology caused hills oils jack bastard greater murmuring strange case coming counsels spring delights youthful wat under discharge compare member excepted preventions vengeance thus nether stole charge \n\n\n\n guilt palace boy interpreted antenor dancing taste youthful hent fellow day sun horse larks offences ambassadors garments spit buy says whereof robert leaves calchas rhetoric companion troops forsooth cassio persuades caesar blank complexion upon whe conflict fellowship defeat commits cashier pages assay villainy labours princely harmless youthful alighted bespeak fine forc madman preventions remembrance offence vaulty command intent burden palace park spirits oph folded torch bladders deserv titinius finely beatrice broken spur dardanius moment decayed gout drunken \n\n\n\n\n\n\n\nourselves plain fills pattern dane way model professes pleas spear songs star borders virtues shroud florentine richer blame says remain territories degenerate prate frowns hearing safety same ebbs varied brabant needs indeed index piteous tapster liberty hour marshal horse damn told substance time whose plum throwing than mounted pages plainness nobody difference abides engender convey force sickness cumberland easily chairs galen lawful foils imperial provide preventions deaths pretty image betroth shoots deny iras grow serpents see stall aye ordering pilgrim writ argument courtiers bubble tree octavia shallow keys begin thunder offic desire engag god verity never howsoever mark pain phrygian presentation sadness seed burgundy wives devour drums protestation wit breathe scurvy julius write scarce ham read held jupiter injurious succeeders paths usurer phebe louder raught happiness invite lath scurrilous conference compound tremble athenian speak play likely pierc george musician came mutiny delights post insociable grain chaps dram messenger paid army animals queen disturb converted less rear why suggested line feeling imitate places partly lanthorn far prepared tybalt heal both usuring wretch signior event bridegroom itself deities dangerous gav minion beheaded royal the persuaded fashion wretch use found earnestly jar cut welkin yesternight sometimes hath rarity parthia peering alchemist through bushy prison condition visit succeeders couples impose english invisible unseasonable forfeit robert knaves agamemnon ear figure burns case charms would perchance loose crowned half fain entituled goatish add instant meanest rey directly latin prays beholding charm unhappiness armour loving garcon larger mum crowns terror thereof service covet light besides pound subjects quoth declined foils aloud preventions virtues embrace hit shepherd seeing wild city many valiantly betake hark stranger willing prevented shadows scolding malicious dam pandarus sardis albany infamy brush fram murdered maiden wickedness loving regent crow phoebus worthless rowland lepidus france meddler earnest acquainted hive boisterous friar vehement humour finish vastidity appetite eel beseech appertaining goal lordship daughter cockatrice peace glad thrice morning another fortunes her worthiest drown maidenhood heavens converse quake loneliness edg clouds poorest practices sift lances iniquity flow authentic measur foot look uneven laugh bloody delight contrive mile trick already pastimes steer humanity lose confound lascivious doth preventions summer many buy high worthiness wonder bolts bareheaded lend pieces dancing park chill ensued rightly door exception lost eat bastard athens anon aboard ounces serves goddess inferior find cell profession lock justice fares dishes stol thread loath wail countenance affected burdens prayer prithee sadness descends famous copy hearing hills novice occasions beguiles ears bed patience sociable punished mistress rights selves ring boldly died affliction shelves giddy gifts lodge flat lethargies send sister palate need states osr amongst gloucester heigh dreadful cureless skin bachelor carry antony bring prayers athwart verse modest requires chafes tod sword births modestly disguis cousin berkeley why window cause gold ruminated \n\n\n\n\ncommands better tent tokens superstitious sixth buy preventions rancour angling ventur fort combat cydnus having chests knees pestilence feet hardly needless others tomb foul trial his submission secrets acquaint enjoined deserved shock counterfeited seems discharg partly strains had grew securely austere thy off oppress meteors knowing battles rivet virtuous eyes \n\n\n\n\nducats grimly urg bewrayed commended rank remorse guests stumbling rank each preventions smell crimson clown children ragozine winking anybody greekish furrow wrath mouths souls delivers priest model grave requited dog transcendence cups saving small shines dearer cave royally joints devilish cares smock according ewe threatens favorably unmask ballads digging antony conception clutch wives iago pace follow throat sensible field wine preventions taunts woes jest banished wanted pretty friend sulphur moreover dungeon win assist among breaths strato curan pregnant yond bids patience prisoner pulls pray \n\n\n\n\n\n\nourselves chin fell squire off fery gentler most falls wilt months fled victorious princes purpos injuries appear equalities sudden lady paulina niece swore disguise monarchy possession saint recorded playfellow soundly michael embowell ravens preventions cry almost vainly wait stabb chests reprove youngest yea rainy island stood triumphed maid ingener custom separated afford future humbled depart carelessly divinity polack calls pyrrhus flatterers sex steads fed tarry token subscribe linen middle attempt drawn attaint writes falchion lett denmark fooling lamps groaning led led gar slept regan lengthen proscription merry sepulchre tiberio bills business monument better sweet death sorely necessaries pieces slew leg thus princely damsel message victory respects wrought buckingham far mirth report empty filching beads fat prefixed thersites idle woman sworn erring executioner wing power twigs thanks ought nurs dim leopard windsor kent quickly afeard educational conversation seven clamour spoil bridge remember staves bred corrections victorious adieu rogues older imperious stronger gone tell tragic barr domitius bleeds despite speedy grown griefs self plucks proverb twenty monarch trade robb employ defective hum lifeless avoid ago coming plain dog bread commons tuft earn last heartily sipping asp charged marvellous descry berries elves credulous wisest marg throat tyranny eyes \n\n\n\n\nplantagenet preventions sentence giving did breathe never adverse proserpina rack for cyprus malice his vents falstaff ear grandam once betumbled poor gentleman colours walks greatness editions clarence tut peter note brotherhood armed sprite slept which fierce ghostly trick bernardo basis \n\n\n\n\n\nfornication afric fairly search fortunes voices flattering widow tomorrow approv pitch expect woods sleep wrong wishing suffered whipp guide converting nobly leaden brothers follies bawd honours fever florizel isabel provincial fighting closely wearing fragment honester instant withdrawing libels suit merit beseech man heaviness cried wert did mouths thick mayst breed liquid michael albans tapster sway manner reversion breadth examine unclean hor sables suddenly tends bribes yorkshire perceive married hum market text daylight subjects impasted steward delighted boldly boldly seems disgrace keeper everything spain dance raven presently claudio fam building winds opportunity chin scorns dried host keep ancient handsome collatine makes help depart preventions misty coz alack hermione marvellous nathaniel worthy cheeks behind tend drums weight want rich ill compounds asunder torches seal wounds disguis threats woe ride dark wonder jar ease upward loud alone dragg falconbridge tewksbury trail bedew broken earthquake quoted working deep deputation bridge navarre subscribes finger pompous dear boasted hereafter wak assured yonder fought body apemantus wrack knighted into shepherd profane spears flung fault easily lank beatrice peating plaining gold wide emulation star resolved \n\n\n\ndaughters wink tempest oph cicero shadow provoked there charg palace stern fan penurious brothers truncheon offend deeds abus person them impiety conscience awhile junius stage boy braggart gamester diana fellow similes jests doubt dangerous galley concern fairies sends pinch bene laugh thoughts base control subjects solus henry heartily forehead always thereat manhood drink use paul complain short enough design sainted intents prithee epitaph messina confederates mayor doctrine hundred enemies loyal epitaph sword bound breathing cool pilot lov print desired privilege sour partly cursed monstrous royal want crown goats return fights gainsaying winnowed morrow swift hearer chronicle pindarus suitor ransack par gaudy house preventions lordship guests preventions ladies dares hour vilely dumain nobody nineteen fright worthily regreet take collected seest henry cool them mistook power air bertram ever disguise beggars report chooser delay sleeps note creditor sums raz tax bigot calm thousand galathe ask bids graces overture queen fairies bleak colourable silly giving limed tread five honor ensue palm supposed doing seemeth revenges times caius held albany paltry spring nether juno beg topful tower sets bride devoured nations sans creatures spoiled how accompt ordered charged thorns though drab grandam wicked sailing ulysses strangeness smother knave gazing rosaline castles kent mariana grace hist garter silence tailor deeds method mouths regal acquaintance weighty spake worm preventions myrmidons jump complaint made pleaseth rousillon promises special change osr \n\n\n\ncolours slow maccabaeus uncleanly slow strato stanley \n\n\n\ngood true embowell murd humble made likely plots mildly worthy shakespeare chi misled unfelt bane jourdain receipts prov sigh shouldst expressly applause tune good reported slander canon eating enemies denmark talk means couch rite unworthy zeal pride dumb robb properer paradoxes private garlands roses suddenly hast madam slaves god lost praises spaniard preventions vanish example remember crave figure italy ostrich greatest norway prophets doomsday belonging grow story knoll ages joys befall takes preventions denied speed dover wants tarquin oaths pleases edict kingdoms mean remember geffrey bounds conceit derby southern shoots topp covert thereby antonio translate selling injuries beauty mutual picture imagination choice being melt tie suddenly either smoky traitors stain conquer place innocent you fast brought gregory \n\n\n\nhor board space lived spur wolf fitting paltry england dear mettle thank shift hear melt eat your gertrude perfectly legate beshrew gentler thrown women sky stifle prescience course volume light fault buckingham while deserving edward confusion neck thought poor adversary traverse seeking graft discontent courtier bastard past oppression speaks thus \n\n\n\n\n\n\n\nophelia laertes \n\n\n\n\ncoted wept alone yielding petitions reave pattern main preventions rumour murthers bears craves spent diest remembrance sing \n\n\n\n\n\n\nunique medicines given woman bride very truly wore gave below pil unjustly serv under borrowing partake dead charge earnestly secrecy ground weakness depending bargain moral miracle rebellious ewe phebe cousins husks peers laud lead angels wished fills heap haste further distinction brief aches uneven allies doth lordship cradle prologue awake sinews strengthen afar drunk cheek strange resemble impatience wring swerve forbidden thereupon new more mort waking oaks commission jewry shops preparation geffrey kneeling can crave approved spokes corrupted danger prescribe sworn prime messenger apprehension stirr bushy sound sakes withal mars victors eruptions fortunes thrice extremes killing poisoner son bernardo knocking falls enriched assigns text famous keeps slip verona mine bites theatre stars stumbling books thinkest foot den dream unmannerly wolves rod argument ancestors monarch valentine lieutenant dover trembling fight owing aches where salisbury grand followers full \n\n\n\n\nforty odd enemy city stale tears preventions assembly forfend rebellious worthy eminence safe catastrophe audience gertrude whence manner how marrying remedies might something observance stream nobly bones lives madness approach wild hope speedily edm devis centre virtuous abbreviated careless sleep fights orbs intending led teeth troyans devis divide penury behalf top error fires morrow conductor means berowne preventions glove concern worcester summers carry drink avouch deceive stroke nigh hither jig buttonhole compel clown all moderately residing reign isle logotype requite benedick grossly powerful ground noble respect envious surplice excellence palace mouth execution children preventions greek forgive apace suit courtesy careful ones antique among norfolk feats plenteous feel quit weigh bucklers pull gladness detest whiles forgery therefore easy camp venuto humphrey favour drinks vengeance chaps payment conveyance argument mince silk pardoning ensign deformed unworthy importunate courtesies hairs blow hearing page brothel free tract gods kill grey deserving punishment accuse taking carnal pity oaks debt six stone exploit whored way purse ensues sad pursued old heal gregory entirely host cheerfully fine stoop phebe thank points grass thwart herald rite invisible conscience loathsome welshman wisest harlots backward adopt say cornwall knack attended hies light perjury wings term swells sire banish shore pirates body pant urge \n\n\n\n\n\n\nsolomon paper springs giving couch generally masters chin \n\n\n\n\nclaim accoutrement lord boys \n\n\n\n\nlaertes washes mount brother discover marshal jove blank nuptial unknown deeds honest paint torch verg way steads builds away sorrow subcontracted cassius cowards blood blank wooing ripening cassius milk medlar hush bondage wedding sickly beneath bows whetstone tears whoe bleat accident sails painted houses pale illegitimate francis believe preventions fits wherefore hit sight balls distracted disembark visage ely flay france dine fruit learned bodies because breach caius flood remov saint terrible convertite stol uses debate feed angle wine cured madness hurried greekish dispense sometime foresee suffolk marg cup englishman spent pyrrhus breaths rarely third paper entreatments years sum thursday bodykins who devise chas subscribe mends keen affairs embrac sting through statue hatch entame bags thought since commenting dispers mischief however severe council gnaw distemper bustle behalf shadow flatterer ventur hew \n\n\n\n\nrobes capt feel nilus breath pace aught weeping jove armado lucrece priz sallet lover saints under throws farewell grave otherwise gar recall night necessities tackle cor damn bright terms worcester stopp bewitch restraint mark particular youngest eye unless dam parasites design greet until rewards displeasure unity alb state walter wedded far gracious antonio preventions grows rites casca entirely lily remorseless trim divinity drums tent glass \n\n\n\n\n\n\n\nclay perfume leaf sirs commenting points gentlewoman doctrine upmost health mine wonder any blemish memory they action self \n\n\n\n\n\nunkindness beggary belied sheweth vessel \n\n\n\n\nhiding present admittance like blame mayst cyprus keep favourites loving sugar spain gon days brutus beggar nation musical strikes character surprise senses grange hear daintiest wit whale duke chased doomsday spear villainy cloaks musical tartar working policy madness stripp soft first wooed credit gods misfortunes render mercutio shall permit venit hence redress plays gentlemen scape green incident keys unto asp shake herring descry basely sold confusion realms hunt wanderers persons etc admirable \n\n\n\n\n\ncompanies profession \n\n\n\n\n\namazement entreat dolabella disloyal poverty cassius instruments harder venison standing text just \n\n\n\n\ndauphin nonprofit discipline seduced arrow opportunity domine summons retire julius hairs since affectation drum style learn chose pipe derive athens wits dreamt provoke curses hastings regiment videlicet pass mass cutting marry proud tapster \n\n\n\n\n\n more celerity scorn entertainment usurp sextus dealt drinks blows report speed shape whipt jest harm wilt shore jocund delay silvius sent unable maids belied approof humbly metal hawking choler exterior surly sake poverty cloak lance queen kneels forsooth error which flaminius \n\n\n\n\n\nvantage ribs drunkards rusty dance crutch harmless level satisfied beshrew loath preventions edgar clock everywhere contract voice odd cordial rite anon visage committing frenzy locusts vanish unbloodied drown com dialogue plucks uncropped lies slave conscience drink hautboys some letters verses shift whipt that flash calling account vowed burial goodyear prophetic slander brace wretched armed maiden project gaze palates dominions news madman herein alarums meditation sobs champion even dead apprehended tonight london progress protect wonted deserved pronouncing blessing \n\n\n\n\nderived harness day wearers grievously naming appetite assay melancholy embracing wolf fever theatre honour howl undoubted learn trebonius grossly soar straggling deceit yea undertaking wore wicked comparing squabble willow assist becomes any silent tak ireland grove proofs ache cast charity unpolicied rat mar lurch valentine antigonus conjointly room diet not grace incense wisdom preparation resolve \n\n\n\n\n\narticle ken drowns mute sits foison aloft beauty jewry lock flattering applied gracious generally determine can kennel mortality imports scroll drinks patch deck sixteen far old resides secret beards prove flowers receiv pound lines object tithing drop meaning slain beaten whipping child qualities speaking shores doe health therein fly prayer dishclout turn pall been afflicted far reform hear choice grim manner survivor \n\n\n\n\n\npalate stalk weal while human painted toward deformed offense maiden pant subscribe slept spark devise list they apply swore deformed undeserved graceless bans self woodman error toys what doors heav heraldry approved chapel apparel spoken arrant backward geffrey preventions defacing flock stay secrecy corporal wrought mend preventions winged rugby perish tread contempt benefit task used gilt goods unity musters costard deep royal father love sententious awake streams dangerous six gage melancholy greeks perforce catlike waken coz reap holding beastly beam lucio citizen rats seizure hast pursued arrived convoy hart tower tickle spies foolish inform attain forward ordered despairing catch profess thersites confession courage year order cloudy sound foes edgar interest starings beg bin alacrity right soldiers couple web keen machinations pray chamber blessing enraged tybalt ambassadors images romeo manners blade prick self ambush serv sway sweeps jephthah sicilia pipe loins preventions door trib safety saying trunks deserved already besort signify surmise packing beck climbing edg befits sometimes ruler compare persuade imprisoned greatest woes sits fellow salt stare cream victory offend seest \n\n\n\n\n\n\nhostess ford drawing preventions bitterness lov saying prevail heifer son intended impossible without peculiar purple unwieldy chamber resistance coz understood gentleman arden feel sacred plung shun deserver discourse block cope soonest son render dreamt caesar unskilful everlasting strikes throne rests sin mighty personae only circled wheresoe prate peers worldly pitiful preventions slips clitus get since creatures yield supper rude speed sworn obey service crying vailing low age intelligence according like beastly amen ope instances defence dispersed speech cause cloak lighted following montano snuff rosencrantz vienna scorch quoth mouth deadly regent bridegroom tyrrel thankfulness witch yield sung buttock \n\n\n\n\nhungry stroke wish window pardon rey mutiny egypt paris musty remember few hands breathe laws prosper south liquid bawd impatience keys immortal nay mows compelled sorrowed harm norman receive arithmetic lungs spent fry sounds trembling appears quite malice dowry estimation bora use irons doers paris dire enforce grandsire bottle swear will built tediousness daughters jot thereof burns conjures bow lecture changeling warwick wit try lip fogs filths call urg ask enters ordering committed apron amaze garland prick made then crest sister wooer spur deliver read honour needs paint something repetition aim add tax caius rhymes rest heard sleeping incontinent jacks partner litter touch imprisonment folded society fleshly branches refuse sweat thrive comparing buckets cares blowing hangs tame knight occupation deeds here grief pasture hatred wat \n\n\n\n\nbald farthest practice praises pulpit hor mortimer die cardinal traitors ambitious paint worship property together helpful end head young hecuba reads save paw forest arraign street passion reach which goodliest deadly garish joy wenches regard slower hairs living escap entertainment type sly rude perfections sov through thereto parson careless broach herdsmen \n\n\n\n\n\n\n\n\n\nbecome list close feelingly decrees vigitant joint heartly despised wicked suppos mysteries pierce videlicet promised notable university proclaimed giving less apt affords sudden questions bottom guiltless grow quit because newly said natural ship sovereign leads harmony ginger arch grievously octavius deserv merrily honorable courtesy undone aim faithful enchanting affright lack dardanius sit drift paulina rhyme cor senate growth can spain leg troyan meant antipodes resty assist shall bosoms preventions sup welkin alack boys ours endur contract fears receipt killing head qualities away oppress understand end confess trouble manifested parts well awe heap spleen don martial provoke england mowbray message sigh claudius honor ask capable unite revolt rose herb fled take black passing piece perjure bids pink temper guildenstern woful rage ask from return summons arn watchful audrey supply nose reproach side eggshell slight condition out lady offer troyans tall thieves urinals minime beseech disputation childness humbly denied hubert speak passing posture service lucrece lend size nights shines crept gone drunken proscription unwilling vouchsafe principal claim sixth trash omne hated though enforced blessed edgar constable beasts desire dotage legions preventions taint ber tainture violated scorns herod trenchant substance humphrey stooping law quoth bush abhorr northumberland cheers drew preventions francisco equally manage painter affability whereto respectively notice smiles feeders often wolf faculties grants unseen fathom fretful slander wicked faith longaville thatch villain scope curtsies fertile bell gone earnest private hard \n\n\n\n\nconfusion whoe chest bearing distemp catesby certainly girdle says perish penitent fought noble taste nodded shrubs ford determine sweetly nothing spells thither infinite betwixt stars sug hug jesters disloyal sometimes philosopher solemnity bridal push preventions welcome vice spirit excuse saint hungary hoarding already masters art paths roaring rankest cor ache rat arriv thitherward accept preventions happy irish alive silver place hit through poor longaville instruction quip look insinuation free policy out wicked madam shadows royally censured russet argument hereafter age table rough fractions whispers guilty chiefly cornwall author kinds strikes sparrows yesterday perpetual matter balk aliena propos brainford gertrude royalties assist anguish tied craves weeds bond thrown attempt shadow rabble montague challenge here dian furor knees business reside betwixt extremes reap cries contrary mankind tower innocent petitioner marriage pottle feeling mistrusted knowest offers behold contain heavens who unquietness offers spots suitor several something upon contempt magician fulness means sweetly sin age turn reverend albeit attribute suggestions dread property hunter admits distempered faction boys unwholesome conception well cook wreaths showed intend putting cottage had beam drugs knowledge fright did spake controversy nettles contempt damned cried been tend fairies cassio serv married smother wherefore extent sets nunnery ding easiness etc tame find norfolk bidding face doleful pleading unaccustom sourest falls turlygod lamentably wheels lives election light drop sullen tail precious true camp might fair reveal point won treason likewise old bushy wise cried sins affecteth without displeasure kings bend confess occupation cadent testimony please place avert stretch tune newly ended shows tastes friends one pines saint beaten swits preventions years valiant account spend notwithstanding canker ten master rashness couch utmost truer aboard marry sung virginity syrups softly heal opposed sun pretty just owner peremptory ladies streams other silent brain guildhall liest block nell flower count complaints labourers waves derived counterfeit whom juvenal victory jaques supply mowbray rais cities violent unborn renouncement blinds intending intimation darkly reads humour hills venomous rash pay propose sodden far assur cups sums whereon forge pawn proculeius comes unurg labours accompany uncle presume attires labour says will dire child fail pandarus with mates third temptation asham copyright integrity consider dark tapster unity \n\n\n\n\n\n\n\nmoons smother respect pilgrimage guiltier adventure berowne swore growth verona ireland closet harshly heraldry freed green lewd reck effects testament weep catch warlike diameter season sure cold filling talk anybody \n\n\n\n\n\n\n britaine purse washes loads public name windows interchangeably attending defend tully gave gets honourable galls champion access bold separate beguile morning rivers fret bounteous night duke admir hurricanoes sooth vilely thread holds bargain dine weight wedded yawn transcends audience graves sue content deathsman complexions talent struck sometimes tooth praying sailing blame receiv questions doth brook foe buckingham concerns courtier lov soul kindred gentlemen resolve pedro con antony garden benefactors share safety freely deputy policy conquering foretell prison rousillon welcome direct nephew customary medicine heavy toys blind \n\n\n\n\ncaius wisdom pawn dane answers adheres yet amen cross folly antenor canst prophesier hisperia posset marcellus bending evidence food moe piety betide thankful joyful thing dare baseness properer ancient couple nights dog runs weary how fault eagle valour till blemishes form assault plain cato none drave borne matter gualtier affect \n\n\n\n\ncassius measure honors weaves service count sinon trifles whole fix hold uncles sorry war soul seventh rome gotten galen innocent earnest attend unconstrained away tediousness trumpet royalty borne cover rack revolt sleep ber constant days trial plants abhor peradventure dozen loathe well whom apollo mote ten mercy project exhibition cold mystery torn diminution suspicion faint went provide fat bawd clown ago shamefully bosoms curtains treads martial preventions character hive wanton hush hell higher difference part aloft disdain bent iden melted parolles thirsty swing quickly brutus rampir robb lowness whipp pure crutches bessy along thatch bears iago planted rosalinda hercules misery process chants spotted wrack charmian snake laboured thee russians households wedded her romeo bethink gash joyful casca jays \n\n\n\n\n releas strange ranting darts wine judge paint appoint shown brabantio \n\n\n\n\n\n\n\nweary counsel formal unto image surrey skittish monsieur punish rapiers home insolence wishes perform ruffian sulphurous joyful birth april shortly boarded force battlements bequeathed notice scratch lubber smelt removed fill ways safety suppose discourse indistinct chance velvet eyesight modestly toads troublesome sprung arm drawn tales fault nurse then sins edmund perceive finds bachelor pains pair speech follow masters piteous grove feel \n\n\n\nmethought had term edition accusers cap norfolk despite commodity \n\n\n\nstay senses does fenton denied wrought hector fond affairs manly alarum horrible built vassals gold cassio danish daws sells menelaus own hurl tide roar torch snarleth peasant instrument justly deem priam \n\n\n\n\n\nunderprop corrigible corruption dwells liege england fret tut hinder befits capulets pray united supernatural corse beasts unless exceeds strange venus blood proceeding gift reckonings ancient boot such crowd doctor end misconster all maine nemean preventions kent unquestionable discover fell toward blush less tickling passing fairy wenches vow varnish bora sixth fright forfeited protestations pick visage brain sign parcel hidest endeared hands edm rememb biscuit bloody cares besiege journey locks fie whirl shakespeare suffolk aweary town thumb gap ambassadors abed wooers thy sleeve gets wretches melancholy naked worn spent qui coming mercy armed paris decay hercules shalt hence rash gav streets sum dull \n\n\n\n\nused fifty date measures hangs avert fares fathers adelaide warrant virginity parted defunct dispraise abbey enter prosper staying wrongfully bridegroom unthankfulness justice assembly rocks threatens matters hand noise repair custom mus sisters birth minstrels prattling reasons dram wander aquitaine bed metal signior conscience crows assured truly foolery leonato earl eagle verity garlands argument believe smoothing spring hearts brutus poor jealous dinner prisons upward time hoodwink william gold along humane fact project hate dispatch son whiles rested weedy idly \n\n\n\n\nfit motley ours mirth recover untrue allow dramatis cables follies red servant debtors purg haughty hasten applause comfortable guts dare yea anjou grant scarce mule pattern bears ides field proves wild sable speeds flourish party innocent dim greatly rais whose rul forsooth princes instruct prevail likelihood revolt commendations whey especially pandulph regent wealth blessing mingle devotion search under rise procure undertakes spoke crafty thence awry ache familiar exeter wed swords passage cheerly scratching thank special root weapon jot pilgrim speaking isabel darker staff press amiss edm itself joys torches dukes pale refuse ample reconcile city phrygian number subdu tent fetch married prison kindred beau bedew tyranny alone outward large marks direction hue logotype gave bind disjoint balm cliff power part suggestions elder cock provided monarch geffrey honors discreet born lanthorn birth nimbly bawd mongrel catch denote performance cure chastely venge can blot mon love quietly demands elbow dwarf supper stomach masker breeding attend lip huge there humbleness straight words perform belie charity bowl warwick blush william fifth fitzwater rid mask fist preventions thefts forsake beget leans monster hams pair motion nails course meeting hymen war goneril ere cast parching upon halters labouring imagin cardinal differences comes dogged west judge watches greatly angling troilus flourish inclining haunt fed france despised retirement spied scar longing heel feature watch what seem palmers sap surfeit longaville monument stables life bag italian met envy back sup angel coldly armour reg sanctuary exterior discretion wall plants advancing king proceed reputation employment stage touching aumerle defeat slender which conduct tough beats heave borne preventions attending proud troyan abuse some willow reproach platform thrusting nest makes afoot loud dispossess pranks stops esteem compounded care lowness loo close was alt cannot exacted norway thine calls german letter bruit service aspic hark liv younger rugged constable web spurn resign mines promis wisdom dishonest blunt stones imagination rein testament form yielding sits teach faults grapes liquor tall unfurnish invade reported sirs young bolingbroke ours buckingham rank vici consent open drum limbs rogue countrymen certain apparition araise kings fairest yicld naughty nobody sups \n\n\n\n\n\n spite constance ballads worth breath treacherous contented dick vial had cure detestable thine wretchedness news fulness nan etc lamentation brain critic call guiding ducats cheapside smart midnight earth roofs speaks gods threats southerly thou asleep wasteful married council opportunity dear \n\n\n\nvariance impetuous alarums spirit odd beating first prove dogged well rare mind liar wenches severity knavery eyes oracle plain touches distinguish inch preventions worldly bliss meant \n\n\n\nbetrothed authentic blackheath pluck towns rivers chief quiet exhales scope sixteen lenity white patience princely mere desdemona travail hang march reverence blush wait fat need impon thanks circumstance poverty goal reignier strumpet knights thenceforth snares withal kiss pin kin worst together multitude cloud ransom bear malice admitted wimpled pomp lion serv exclaims trudge somewhat but urs pernicious gave hates blind soundly ladies containing quench spend grapple steal bosom soften master followed teeth messenger proposes combat dozen amend clients flew preventions \n\ncondemn approves unloose freshness swallowing low house tougher stayed surly ready fight dare following england sing editions gets falcon tells henry mocks sadness wrought sentence fall mournings hovel towards utter revenged news genius judgment mask done sway join fasten regard whisper fruitful suggest nervii dealing session sign crack cursy dangers uncover action seldom called ranks lies faded merry cherry citizens revels simple mace muddy fair horse letter spring ransom tenth hands dishonour beheld discourse cried whipping attempt northumberland makes aquitaine ivory lift looks doth gratis rate hither cordelia calamity gone loss pace flint marvel mettle bound peremptory dearest fitting rocks rotten betwixt already fail bleeding ability secure pleading custom except lately brows sees note kissing falls deserts rock tunes gain lands appetite ground hercules palace went bows hercules pillars reversion angel songs defy hast success 546.7845252 487.1741697 286.8128565 35.920473 76.3585515 597.0070761 11.1287355 419.5423098 788.0907702 198.2457516 54.0570063 78.7165212 815.4608484 104.9186331 22.4117307 647.8246287 482.1276738 636.4534851 114.9014394 468.1120782 1236.3033471 1076.4462237 637.2468207 172.3521591 32.9013903 586.3631568 563.7971664 592.8861384 21.9930258 1213.2745776 1420.731837 1319.4713625 1383.5772864 175.5475386 1013.9490081 828.0881067 496.1653065 267.9931731 43.6775322 840.054252 17.9161623 1322.3361855 240.2484642 381.1096074 52.9110771 1126.1398842 2660.7153798 53.0653368 1404.3362346 991.3609806 496.8704937 2414.5168986 151.6593222 360.526956 1503.6354072 566.7721749 12.0322566 781.9424193 1039.1374134 1867.3577427 91.7845215 226.3650912 1058.0232081 142.1613321 109.7006838 109.4582757 328.7274207 33.8489856 119.2427481 3859.0047294 192.0533265 333.200952 24.1967358 72.0833541 901.0088706 149.5217235 1110.890211 20.4063546 1521.4193469 790.9996674 204.9229929 56.3488647 81.2948619 281.8104348 659.7466998 1221.9131208 348.9354414 259.9716687 165.7410291 539.1376515 30.2789754 372.8456949 445.4579394 175.1508708 874.5202764 2120.1673539 2047.4008497 339.37134 2125.6105176 5819.5132938 369.9808719 1648.3310058 876.0849105 538.1239449 2418.5496879 955.7931012 7205.8452177 697.2979182 129.7764819 289.8099021 2041.1863875 133.8313083 356.1856473 369.121425 28.8245268 223.676565 2015.8216854 107.1443802 130.4375949 692.8023498 606.3728436 458.6140881 363.3697419 832.1870073 406.584495 666.2256072 71.5324266 1002.1371225 735.0474705 498.8097585 193.7722203 3815.2170117 2456.1449805 611.970267 643.1527635 187.6459065 117.1492236 40.8567834 34.9508406 2419.8058026 1744.5229473 173.6082738 821.4769767 127.154067 2173.519173 325.3116702 171.0740073 1412.4458874 2032.7461782 349.5745173 435.1666137 1607.0995917 108.4445691 83.8070913 131.0766708 29.4856398 127.8592542 70.9374249 648.4416675 672.3078468 100.5112131 36.7358457 333.641694 56.9659035 896.1607086 273.6346707 861.209868 56.7234954 366.2786391 259.6411122 1310.1717063 1211.2251273 923.6850465 1136.012505 299.8808568 415.3772979 447.4633155 393.3842721 200.9122407 208.691337AlbaniaAlbaniaAlgeriaAmerican SamoaAngolaAngolaAntarcticaAntiguaArmeniaArubaAustriaAzerbaijanBahamasBahamasBahrainBangladeshBangladeshBarbadosBarbadosBelarusBelarusBelgiumBelgiumBelgiumBermudaBhutanBotswanaBritish Virgin IslandsBrunei DarussalamBrunei DarussalamBulgariaBurundiBurundiCacos IslandsCambodiaCameroonCameroonCape VerdeCayman IslandsChadChinaColombiaColombiaCosta RicaCroatiaCyprusCzech RepublicCzech RepublicDenmarkDjiboutiDjiboutiDjiboutiDominicaEast TimorEgyptEgyptEgyptEl SalvadorEquatorial GuineaEritreaEstoniaEthiopiaFaroe IslandsFaroe IslandsFaroe IslandsFutuna IslandsFutuna IslandsGabonGambiaGambiaGeorgiaGermanyGreeceGrenadaGuatemalaHong KongHong KongHong KongHungaryIndiaIndonesiaIraqIrelandIsraelIvory CoastJapanJordanKazakhstanKenyaKorea, Democratic People's RepKorea, Democratic People's RepKuwaitLao People's Democratic RepublLebanonLesothoLibyan Arab JamahiriyaMalaysiaMaliMaltaMarshall IslandsMarshall IslandsMartiniqueMauritaniaMayotteMexicoMicronesiaMoldova, Republic OfMoldova, Republic OfMontserratMoroccoMyanmarMyanmarMyanmarNamibiaNauruNepalNetherlandsNew CaledoniaNew ZealandNorfolk IslandNorwayNorwayOmanPakistanPakistanPakistanPalauPalauPalauParaguayPhilippinesPuerto RicoRomaniaRussian FederationSaint KittsSamoaSan MarinoSao TomeSingaporeSolomon IslandsSomaliaSouth AfricaSouth AfricaSouth GeorgiaSri LankaSri LankaSri LankaSt. HelenaSt. PierreSt. PierreSt. Vincent and GrenadinesSudanSurinameSvalbard and Jan Mayen IslandSvalbard and Jan Mayen IslandSwazilandTaiwanTaiwanTanzaniaThailandTogoTogoTokelauTokelauTrinidadTrinidadTunisiaTurkeyTurkmenistanTurks IslandsTuvaluUgandaUgandaUgandaUkraineUnited Arab EmiratesUnited KingdomUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUs Virgin IslandsUs Virgin IslandsVanuatuVatican City StateVatican City StateVenezuelaViet NamZimbabweZimbabwe12227150375", false) ); } /** * Return the name of the person with ID `person0'. . */ @org.junit.Test public void xMarkQ1() { final XQuery query = new XQuery( "\n" + " { \n" + " let $auction := (/)\n" + " return for $b in $auction/site/people/person[@id = \"person0\"] \n" + " return $b/name/text() } ", ctx); try { query.context(node(file("app/XMark/XMarkAuction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Seongtaek Mattern", false) ); } /** * List all persons according to their interest; use French markup in the result. . */ @org.junit.Test public void xMarkQ10() { final XQuery query = new XQuery( "(: Purpose: List all persons according to their interest; use French markup in the result. :) \n" + " { let $auction := (/) \n" + " return for $i in distinct-values($auction/site/people/person/profile/interest/@category) \n" + " let $p := for $t in $auction/site/people/person where $t/profile/interest/@category = $i \n" + " return \n" + " \n" + " {$t/profile/gender/text()} \n" + " {$t/profile/age/text()} \n" + " {$t/profile/education/text()} \n" + " {fn:data($t/profile/@income)} \n" + " \n" + " \n" + " {$t/name/text()} \n" + " {$t/address/street/text()} \n" + " {$t/address/city/text()} \n" + " {$t/address/country/text()} \n" + " \n" + " {$t/emailaddress/text()} \n" + " {$t/homepage/text()} \n" + " \n" + " \n" + " {$t/creditcard/text()} \n" + " \n" + " return {{$i}, $p} } ", ctx); try { query.context(node(file("app/XMark/XMarkAuction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("category0female39585.93Birkett Zedlitzmailto:Zedlitz@yorku.camaleCollege9876.00Kagan Takanomailto:Takano@uni-sb.defemale63811.82Lon Leifert45 McKenna StKansasUnited Statesmailto:Leifert@sunysb.eduhttp://www.sunysb.edu/~Leifert6789 8467 1353 5816male9876.00Zhensheng Laulheremailto:Laulhere@ucla.edu8065 4460 9357 8496male2621142.02Elihu Lorys60 Jantke StGenevaUnited Statesmailto:Lorys@berkeley.eduhttp://www.berkeley.edu/~Lorysmale2885711.23Maung Rainmailto:Rain@cas.czmale479876.00Zeljko Wolford13 Leaver StWorcesterUnited Statesmailto:Wolford@umd.eduhttp://www.umd.edu/~Wolford3364225.11Arjen Emden44 Goos StLexingtonUnited Statesmailto:Emden@forwiss.dehttp://www.forwiss.de/~Emden2468 4642 9646 5367female25High School9876.00Kendra Dunanmailto:Dunan@conclusivestrategies.com7343 3711 8611 7955maleGraduate School18103.99Raja Schroermailto:Schroer@ac.krmale69930.56Xiaoyu Willamowski48 Stefano StCharlestonUnited Statesmailto:Willamowski@bellatlantic.netfemaleCollege52198.30Eleanna Loulerguemailto:Loulergue@imag.fr29College85365.36Sushant Baransky39 Varpaaniemi StChicagoZambiamailto:Baransky@du.edu18Other9995.92Martial Chorvat65 Campadelli StMonterreyUnited Statesmailto:Chorvat@zambeel.com4079 3475 5627 8448female34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 629873540.90Angel Kanamorimailto:Kanamori@telcordia.comhttp://www.telcordia.com/~KanamorimaleOther147002.31Nikolaos Birdsall20 Morillo StGrenadaUnited Statesmailto:Birdsall@clarkson.edufemale2933284.56Chams Michailidis11 Davoren StGainesvilleTanzaniamailto:Michailidis@ntua.grfemaleOther63285.36Roseane Henton21 Falkerngerg StArubaUnited Statesmailto:Henton@csufresno.eduhttp://www.csufresno.edu/~Hentonmale25728.38Priyadarshan Burgert53 Liberman StCorpusReunionmailto:Burgert@savera.comhttp://www.savera.com/~Burgertmale189876.00Ruben Paczkowski42 Osmani StKievUnited Statesmailto:Paczkowski@ac.jphttp://www.ac.jp/~Paczkowski5171 8849 3355 1220male88737.57Vanathi Takano39 Borowsky StIstanbulUnited Statesmailto:Takano@baylor.edu9748 8717 5684 69901867501.36Terunao Veccia53 Brightwell StToulouseHondurasmailto:Veccia@sbphrd.comGraduate School34738.51Singaravel Skurczynski41 Zhongxiu StPortlandSwitzerlandmailto:Skurczynski@ntua.grhttp://www.ntua.gr/~Skurczynski53Other48773.68Tetsurou Caugne19 Falgout StWorcesterUnited Statesmailto:Caugne@columbia.edu8535 6273 6608 32639876.00Dhritiman Schapiremailto:Schapire@ucd.iehttp://www.ucd.ie/~Schapire7089 9225 8648 445732Graduate School21453.40Kyujin Thenmozhimailto:Thenmozhi@sbphrd.comhttp://www.sbphrd.com/~Thenmozhi5667 1325 6395 3905679876.00Mehrdad Holldobler38 Delaune StMontrealUnited Statesmailto:Holldobler@sunysb.edufemale2425157.94Terrill Uchoamailto:Uchoa@co.inmale1821628.35Mehrdad Granlund2 Huttel StMontgomeryUnited Statesmailto:Granlund@concentric.net6039 9126 8908 863446College9876.00Ennio Fanchon44 Beeferman StStockholmVatican City Statemailto:Fanchon@bellatlantic.nethttp://www.bellatlantic.net/~FanchonmaleGraduate School23261.52Gioia Mulkersmailto:Mulkers@mitre.orghttp://www.mitre.org/~Mulkers3207 9504 9402 94403324186.28Marco Meszaros49 Wohn StKievSt. Vincent and Grenadinesmailto:Meszaros@ac.athttp://www.ac.at/~Meszaros6309 7243 2721 1636category11female39585.93Birkett Zedlitzmailto:Zedlitz@yorku.camaleCollege9876.00Kagan Takanomailto:Takano@uni-sb.defemale63811.82Lon Leifert45 McKenna StKansasUnited Statesmailto:Leifert@sunysb.eduhttp://www.sunysb.edu/~Leifert6789 8467 1353 581615620.89Frieder Basumailto:Basu@edu.aumale38High School35391.33Samson Scopinich22 Luit StNassauLithuaniamailto:Scopinich@forth.grhttp://www.forth.gr/~Scopinich7744 1014 3146 578752743.14Angel McDermid56 Deves StStockholmUnited Statesmailto:McDermid@ucdavis.eduhttp://www.ucdavis.edu/~McDermidfemale29College109893.20Bevin Keustermans55 Kluthe StCharlestonUnited Statesmailto:Keustermans@cwru.edu33857.61Kristof Pittmailto:Pitt@unf.edu6369 9760 9277 8247High School52123.17Athomas Roubieremailto:Roubiere@yorku.cafemale33532.36Ravindran Yacobi90 Cools StAlbanyLithuaniamailto:Yacobi@emc.commaleHigh School29348.51Yael Ritceymailto:Ritcey@csufresno.eduhttp://www.csufresno.edu/~Ritcey4175 3581 3728 53201880569.02Junzhong Hananimailto:Hanani@unizh.ch1828898.01Mimmo Stiftermailto:Stifter@edu.cnhttp://www.edu.cn/~Stifter3829 2675 8446 5011male72247.13Djordje Milesmailto:Miles@att.com4147 2060 2989 7208femaleOther76543.02Arno Takano2 Jezioranski StAkronUnited Statesmailto:Takano@uwo.cahttp://www.uwo.ca/~Takano1059 2269 8254 7515femaleHigh School95732.32Hagen Artosimailto:Artosi@clustra.comhttp://www.clustra.com/~Artosi7136 1358 8743 5847female3943323.95Mitsugu Thobenmailto:Thoben@sbphrd.com4537 1155 4156 664924141.45Yuan Tayara48 Kurita StPittsburghUnited Statesmailto:Tayara@purdue.eduhttp://www.purdue.edu/~TayaraHigh School32535.03Drago Showaltermailto:Showalter@auc.dk25High School36970.64Elihu Salinasmailto:Salinas@ucdavis.eduhttp://www.ucdavis.edu/~Salinasfemale17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edumale18Graduate School61397.86Atreye Livari18 Sangal StCincinnatiSenegalmailto:Livari@msn.comhttp://www.msn.com/~Livarimale1947616.43Gurmeet Beounesmailto:Beounes@yorku.camaleHigh School61094.02Mehrdad Bierbaum77 Heyderhoff StIdahoUnited Statesmailto:Bierbaum@sdsc.edu5223 3221 1166 7010female34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 6298male26099.90Sheilah Takano27 Chandna StToledoUnited Statesmailto:Takano@neu.eduhttp://www.neu.edu/~Takano5166 3645 9483 2416maleOther147002.31Nikolaos Birdsall20 Morillo StGrenadaUnited Statesmailto:Birdsall@clarkson.edu48128.34Martien Noortwijk25 Melski StProvidencialesUnited Statesmailto:Noortwijk@co.inhttp://www.co.in/~Noortwijk3902 2842 7544 6492maleGraduate School48463.16Geraldine Relihan23 Meketon StKahuluiUnited Statesmailto:Relihan@toronto.eduhttp://www.toronto.edu/~Relihan24Graduate School20808.47Felip Veevers60 Gobioff StZihuatenejoIrelandmailto:Veevers@ualberta.ca2147 4781 9975 1452male32039.10Guanshan Keustermans5 Hazony StBudapestUnited Statesmailto:Keustermans@upenn.eduhttp://www.upenn.edu/~Keustermans7994 4699 1996 9940female31313.14Upendra Sueyoshi100 Iwayama StPensacolaUnited Statesmailto:Sueyoshi@msstate.edufemale2933284.56Chams Michailidis11 Davoren StGainesvilleTanzaniamailto:Michailidis@ntua.grHigh School22905.31Merce Beoumes17 Lattin StLawtonQatarmailto:Beoumes@washington.eduhttp://www.washington.edu/~BeoumesfemaleHigh School27442.54Linore Pradomailto:Prado@uta.edu3098 3930 3792 434943968.43Hausi Henriksson11 Shiota StSeattleUnited Statesmailto:Henriksson@uqam.cahttp://www.uqam.ca/~Henriksson27Graduate School35214.05Tobias Veeraraghavan41 Cavedoni StAguascalientesUnited Statesmailto:Veeraraghavan@umb.edu8969 5456 9679 133626College13999.18Yoko Meursmailto:Meurs@rpi.edu4761 5609 3284 980131377.71Douadi Newton100 Deb StTexarkanaUnited Statesmailto:Newton@acm.org42High School63869.30Waiman Sakomotomailto:Sakomoto@crossgain.commale1821628.35Mehrdad Granlund2 Huttel StMontgomeryUnited Statesmailto:Granlund@concentric.net6039 9126 8908 8634category2565739.54Niraj Fergany55 Rheingans StSaltGuineamailto:Fergany@uni-mb.simale64243.77Huican Szmurlo52 Ternovskaia StCodyUnited Statesmailto:Szmurlo@ucsd.eduhttp://www.ucsd.edu/~Szmurlo2217 9440 7362 340518College23941.65Rajaram Lease100 Preishuber StEastUnited Statesmailto:Lease@imag.frhttp://www.imag.fr/~Lease4948 9378 8238 360026770.70Fun Lattin93 Mutschke StPascoUnited Statesmailto:Lattin@forth.grhttp://www.forth.gr/~Lattinmale479876.00Zeljko Wolford13 Leaver StWorcesterUnited Statesmailto:Wolford@umd.eduhttp://www.umd.edu/~Wolfordfemale1866561.70Mara Tchuentemailto:Tchuente@telcordia.comhttp://www.telcordia.com/~Tchuentefemale29College109893.20Bevin Keustermans55 Kluthe StCharlestonUnited Statesmailto:Keustermans@cwru.edufemale9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~Koszlajda18Other9876.00Jessie Goodrum33 Grabe StGulfportAfghanistanmailto:Goodrum@smu.eduhttp://www.smu.edu/~Goodrum4135 6305 3725 5036femaleGraduate School54668.95Joey Girouxmailto:Giroux@crossgain.comhttp://www.crossgain.com/~Giroux6425 5745 4662 1727female21College20347.38Isamu Kupiecmailto:Kupiec@twsu.eduhttp://www.twsu.edu/~Kupiec6071 5377 9019 296359420.56Ziqiang Businaro21 Coatta StMontrealUnited Statesmailto:Businaro@indiana.eduhttp://www.indiana.edu/~Businaromale70373.08Mehrdad Sevcikovamailto:Sevcikova@sds.nohttp://www.sds.no/~SevcikovafemaleCollege19207.80Bahaa Lortz24 Zaimov StAnchorageUnited Statesmailto:Lortz@toronto.edu1432 1375 9826 3007male1835487.60Mehrdad Huhdanpaamailto:Huhdanpaa@itc.ithttp://www.itc.it/~Huhdanpaamale3760708.89Nobuko Manara39 Pigeon StMontgomeryUnited Statesmailto:Manara@imag.frhttp://www.imag.fr/~Manara8751 5605 9270 8646College9876.00Odoardo Rajaraman39 Backelin StVillahermosaUnited Statesmailto:Rajaraman@ul.pthttp://www.ul.pt/~Rajaramanmale36914.75Howell Motley64 Lafortune StAthensUnited Statesmailto:Motley@uic.eduhttp://www.uic.edu/~Motley1828245.16Sachem Grab29 Fegeas StSalvadorUnited Statesmailto:Grab@indiana.edufemale3943323.95Mitsugu Thobenmailto:Thoben@sbphrd.com4537 1155 4156 6649female29High School44522.39Rupal Takanomailto:Takano@conclusivestrategies.comfemale459876.00Mehrdad Apperley12 Vinar StBucharestUnited Statesmailto:Apperley@ibm.com18109944.80Boon Oestreicher12 Moshman StMunichCroatiamailto:Oestreicher@ucf.eduhttp://www.ucf.edu/~Oestreicher9680 1053 2022 9885maleCollege62028.39Lucien Cunliffe11 Smotroff StMeridianVatican City Statemailto:Cunliffe@mit.edu2139 7205 4141 4885female34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 629875125.30Randal Roushmailto:Roush@msstate.edu6224 7382 7689 876618High School47967.41Naoki Osterloh7 Ghandeharizadeh StCairoTanzaniamailto:Osterloh@ask.comhttp://www.ask.com/~Osterloh7741 8229 7494 194344100064.62Oddvar Kamijomailto:Kamijo@ou.eduhttp://www.ou.edu/~Kamijo4434 7244 4200 847924Graduate School20808.47Felip Veevers60 Gobioff StZihuatenejoIrelandmailto:Veevers@ualberta.ca2147 4781 9975 1452femaleHigh School57624.85Srihari Murrillmailto:Murrill@edu.cnfemale2933284.56Chams Michailidis11 Davoren StGainesvilleTanzaniamailto:Michailidis@ntua.grmaleGraduate School43412.47Mehrdad Ewards9 Mosedale StMumbaiUnited Statesmailto:Ewards@edu.hkhttp://www.edu.hk/~Ewardsmale45100.26Knuth Grandbois27 Newton StBudapestUnited Statesmailto:Grandbois@ibm.com3277 5711 2104 1479female18High School32207.29Jessie Courymailto:Coury@computer.orghttp://www.computer.org/~Coury3948 9942 2047 3209maleOther9876.00Benny Maraist38 Coscoy StVeniceUnited Statesmailto:Maraist@acm.org1444 4160 5898 7668female2425157.94Terrill Uchoamailto:Uchoa@co.infemale19Other49367.09Armond Hebert54 Cooley StFrankfurtCanadamailto:Hebert@rpi.eduhttp://www.rpi.edu/~Hebertfemale67651.65Yoshinari Rajamailto:Raja@nodak.eduhttp://www.nodak.edu/~Raja7807 3048 4554 4266maleCollege94906.70Maura Clasenmailto:Clasen@ucf.eduhttp://www.ucf.edu/~Clasen5915 1705 9308 1877category865739.54Niraj Fergany55 Rheingans StSaltGuineamailto:Fergany@uni-mb.si4137695.50Miron Rivals33 Besancenot StShannonUnited Statesmailto:Rivals@ac.be5183 2729 4304 4288male64243.77Huican Szmurlo52 Ternovskaia StCodyUnited Statesmailto:Szmurlo@ucsd.eduhttp://www.ucsd.edu/~Szmurlo2217 9440 7362 340515620.89Frieder Basumailto:Basu@edu.au34High School9876.00Fazli Elsanadidimailto:Elsanadidi@memphis.eduhttp://www.memphis.edu/~Elsanadidi3924 1056 9280 8856male4522589.34Noelle Ramrasmailto:Ramras@dauphine.fr1834791.61Limor Schlichtermailto:Schlichter@dauphine.fr2262 3605 4735 371526770.70Fun Lattin93 Mutschke StPascoUnited Statesmailto:Lattin@forth.grhttp://www.forth.gr/~Lattinfemale63Other71946.13Herbert Kleiser100 Raghavendra StGeorgeUnited Statesmailto:Kleiser@washington.eduhttp://www.washington.edu/~Kleiser4454 8668 5057 15745018437.40Vinot Thomsen2 Kishida StChattanoogaUnited Statesmailto:Thomsen@cornell.eduhttp://www.cornell.edu/~Thomsen33857.61Kristof Pittmailto:Pitt@unf.edu6369 9760 9277 8247female9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~Koszlajdafemale80670.94Shiquan Wixonmailto:Wixon@pi.it40268.84Zosimo Basmailto:Bas@uta.edu3953 1957 8995 9210maleGraduate School18103.99Raja Schroermailto:Schroer@ac.krmale4262287.09Suvo Fiutem69 Luff StWindhoekSouth Africamailto:Fiutem@co.jp5089 1407 5205 539135Other95431.89Raimondas Holtmanmailto:Holtman@indiana.eduhttp://www.indiana.edu/~Holtmanmale3760708.89Nobuko Manara39 Pigeon StMontgomeryUnited Statesmailto:Manara@imag.frhttp://www.imag.fr/~Manara8751 5605 9270 864618Graduate School30851.14LouAnn Mulvany13 Whitt StBarcelonaUnited Statesmailto:Mulvany@ucla.eduhttp://www.ucla.edu/~Mulvany6788 3544 7141 9025College9876.00Odoardo Rajaraman39 Backelin StVillahermosaUnited Statesmailto:Rajaraman@ul.pthttp://www.ul.pt/~Rajaramanmale22Graduate School36448.54Alassane Brown19 Steingart StTallahasseeTurkeymailto:Brown@ac.be4583 2923 3450 3894male19764.36Jacky Kunieda31 Malabarba StGuaymasUnited Statesmailto:Kunieda@uni-mannheim.de4090 9244 8696 7598female44Graduate School62236.54Fano Usmanimailto:Usmani@unf.eduhttp://www.unf.edu/~Usmani4826 7793 3421 79141889413.77Rosalyn Borrowman71 Mekaouche StCasperUnited Statesmailto:Borrowman@panasonic.comOther18748.51Honari Vendrig59 Dougherty StBolognaUnited Statesmailto:Vendrig@bell-labs.comhttp://www.bell-labs.com/~VendrigmaleHigh School22127.36Yannik Hamblinmailto:Hamblin@cohera.commaleOther147002.31Nikolaos Birdsall20 Morillo StGrenadaUnited Statesmailto:Birdsall@clarkson.eduOther12631.68Jawed Grundmannmailto:Grundmann@purdue.edu29Other56634.76Lai Greenwaldmailto:Greenwald@filelmaker.comhttp://www.filelmaker.com/~Greenwald9722 4263 8015 608351Other23226.04Yoshiki Blumbergmailto:Blumberg@ask.com2926 2408 8275 2143maleGraduate School48463.16Geraldine Relihan23 Meketon StKahuluiUnited Statesmailto:Relihan@toronto.eduhttp://www.toronto.edu/~Relihanmale1835295.10Navdeep Tyszermailto:Tyszer@utexas.edufemale31313.14Upendra Sueyoshi100 Iwayama StPensacolaUnited Statesmailto:Sueyoshi@msstate.edufemale2933284.56Chams Michailidis11 Davoren StGainesvilleTanzaniamailto:Michailidis@ntua.gr9876.00Renzo Collavizzamailto:Collavizza@ul.pt6044 5884 4789 419831377.71Douadi Newton100 Deb StTexarkanaUnited Statesmailto:Newton@acm.org34032.09Francesca Weismantelmailto:Weismantel@ucla.edu2763 1794 7943 4753female2425157.94Terrill Uchoamailto:Uchoa@co.infemaleOther98527.30Witold Straneymailto:Straney@cas.cz2461 6546 4698 2228female67651.65Yoshinari Rajamailto:Raja@nodak.eduhttp://www.nodak.edu/~Raja7807 3048 4554 4266category1065739.54Niraj Fergany55 Rheingans StSaltGuineamailto:Fergany@uni-mb.simale64243.77Huican Szmurlo52 Ternovskaia StCodyUnited Statesmailto:Szmurlo@ucsd.eduhttp://www.ucsd.edu/~Szmurlo2217 9440 7362 340561161.12Shiby Ginneken58 Nisonger StNewcastleUnited Statesmailto:Ginneken@yorku.cahttp://www.yorku.ca/~Ginneken5020 5482 5482 3578Other9876.00Bharadwaj Nozawa58 Regoli StWarsawUnited Statesmailto:Nozawa@cas.czhttp://www.cas.cz/~Nozawa3284 7939 4808 3523Other9876.00Shuji Kandlur84 Ullah StCasperUnited Statesmailto:Kandlur@usa.nethttp://www.usa.net/~Kandlur2302 1799 1932 631134High School9876.00Fazli Elsanadidimailto:Elsanadidi@memphis.eduhttp://www.memphis.edu/~Elsanadidi3924 1056 9280 8856male2885711.23Maung Rainmailto:Rain@cas.czfemale3449147.80Frantisek Speltmailto:Spelt@versata.comhttp://www.versata.com/~Spelt27College40010.92Prabuddha Chattopadhyaymailto:Chattopadhyay@nwu.edufemale1866561.70Mara Tchuentemailto:Tchuente@telcordia.comhttp://www.telcordia.com/~Tchuente5018437.40Vinot Thomsen2 Kishida StChattanoogaUnited Statesmailto:Thomsen@cornell.eduhttp://www.cornell.edu/~Thomsenfemale18Other50634.45Sidd Zfiramailto:Zfira@uga.eduhttp://www.uga.edu/~Zfira33857.61Kristof Pittmailto:Pitt@unf.edu6369 9760 9277 8247male19High School38050.91Mauri Takanomailto:Takano@sbphrd.comhttp://www.sbphrd.com/~Takanofemale9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~KoszlajdaGraduate School9876.00Kristof Grafe94 Ingolfsdottir StCopenhagenZimbabwemailto:Grafe@lante.comhttp://www.lante.com/~Grafefemale80670.94Shiquan Wixonmailto:Wixon@pi.itCollege106547.20Khatoun Rankamailto:Ranka@clarkson.eduhttp://www.clarkson.edu/~Rankamale72247.13Djordje Milesmailto:Miles@att.com4147 2060 2989 7208male69930.56Xiaoyu Willamowski48 Stefano StCharlestonUnited Statesmailto:Willamowski@bellatlantic.netmaleGraduate School9876.00Andreas Weijland80 Okasaki StBatonUnited Statesmailto:Weijland@conclusivestrategies.comhttp://www.conclusivestrategies.com/~Weijlandmale3760708.89Nobuko Manara39 Pigeon StMontgomeryUnited Statesmailto:Manara@imag.frhttp://www.imag.fr/~Manara8751 5605 9270 864618Other32519.99Merrick Rapin78 Melcarne StMobileParaguaymailto:Rapin@csufresno.eduCollege9876.00Odoardo Rajaraman39 Backelin StVillahermosaUnited Statesmailto:Rajaraman@ul.pthttp://www.ul.pt/~Rajaramanfemale3943323.95Mitsugu Thobenmailto:Thoben@sbphrd.com4537 1155 4156 6649femaleOther44792.93Hagbae Gershkovich62 Soinard StBrusselsAmerican Samoamailto:Gershkovich@llnl.govhttp://www.llnl.gov/~Gershkovich36Other62943.64Bartek Schumaker83 Kumaresan StLimaArgentinamailto:Schumaker@labs.comhttp://www.labs.com/~Schumaker3597 8655 2603 6797female459876.00Mehrdad Apperley12 Vinar StBucharestUnited Statesmailto:Apperley@ibm.comfemale19High School47409.99Wieb Baummailto:Baum@bell-labs.comhttp://www.bell-labs.com/~BaumHigh School32535.03Drago Showaltermailto:Showalter@auc.dk28College22854.05Mas Bretthauermailto:Bretthauer@uu.se6903 3735 8900 1605male18Graduate School61397.86Atreye Livari18 Sangal StCincinnatiSenegalmailto:Livari@msn.comhttp://www.msn.com/~LivarimaleCollege62028.39Lucien Cunliffe11 Smotroff StMeridianVatican City Statemailto:Cunliffe@mit.edu2139 7205 4141 4885female34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 629818High School47967.41Naoki Osterloh7 Ghandeharizadeh StCairoTanzaniamailto:Osterloh@ask.comhttp://www.ask.com/~Osterloh7741 8229 7494 194351Other23226.04Yoshiki Blumbergmailto:Blumberg@ask.com2926 2408 8275 214344100064.62Oddvar Kamijomailto:Kamijo@ou.eduhttp://www.ou.edu/~Kamijo4434 7244 4200 8479female26High School9876.00Etsuo Plessier50 Littlestone StLorientUnited Statesmailto:Plessier@labs.comhttp://www.labs.com/~Plessier26419.07Yukata Beauducel47 Araya StCharlottesvilleUnited Statesmailto:Beauducel@poznan.plhttp://www.poznan.pl/~Beauducel7393 8354 9466 4534female18Graduate School36875.04Vwani Guck59 Carapuca StTulsaUnited Statesmailto:Guck@ubs.comhttp://www.ubs.com/~Guck8540 5460 1107 6135maleGraduate School43412.47Mehrdad Ewards9 Mosedale StMumbaiUnited Statesmailto:Ewards@edu.hkhttp://www.edu.hk/~Ewardsfemale18129137.70Khedija Yonezawa57 Naixiao StToulouseChilemailto:Yonezawa@clustra.comhttp://www.clustra.com/~Yonezawa2333 2094 5586 4351femaleHigh School27442.54Linore Pradomailto:Prado@uta.edu3098 3930 3792 434929College10406.64Mingzeng Uchoa76 Vongsathorn StAcapulcoUnited Statesmailto:Uchoa@baylor.edu8084 7023 9186 61281867501.36Terunao Veccia53 Brightwell StToulouseHondurasmailto:Veccia@sbphrd.com32College31589.10Daria McDermid79 Harllee StCalgaryTurkeymailto:McDermid@acm.orghttp://www.acm.org/~McDermid42High School63869.30Waiman Sakomotomailto:Sakomoto@crossgain.com34032.09Francesca Weismantelmailto:Weismantel@ucla.edu2763 1794 7943 4753female2425157.94Terrill Uchoamailto:Uchoa@co.inmaleGraduate School23261.52Gioia Mulkersmailto:Mulkers@mitre.orghttp://www.mitre.org/~Mulkers3207 9504 9402 9440Other49831.44Shyam Taganskymailto:Tagansky@cwru.eduhttp://www.cwru.edu/~Tagansky78286.48Kunimasa Useltonmailto:Uselton@utexas.edu8164 1978 5759 3010category1865739.54Niraj Fergany55 Rheingans StSaltGuineamailto:Fergany@uni-mb.sifemale28College23070.82Hakim Savarammailto:Savaram@nyu.eduhttp://www.nyu.edu/~SavaramHigh School46542.05Leighton Odbergmailto:Odberg@cwi.nlhttp://www.cwi.nl/~Odberg55498.73Mehrdad Barroso23 Grabner StRapidUnited Statesmailto:Barroso@uwo.caHigh School52123.17Athomas Roubieremailto:Roubiere@yorku.camale18Other84592.63Jayakrishnan Turakainenmailto:Turakainen@evergreen.edu50Other55383.43Nidapan Stassinopoulosmailto:Stassinopoulos@lante.comCollege106547.20Khatoun Rankamailto:Ranka@clarkson.eduhttp://www.clarkson.edu/~Ranka40268.84Zosimo Basmailto:Bas@uta.edu3953 1957 8995 92101944492.43Sajoong Bottoni56 Isman StWashingtonUnited Statesmailto:Bottoni@ucsd.eduhttp://www.ucsd.edu/~Bottoni4979 4485 7219 1879male72247.13Djordje Milesmailto:Miles@att.com4147 2060 2989 720818Graduate School41595.76Nevio Drashansky60 Petry StElUnited Statesmailto:Drashansky@evergreen.edu7712 4592 2474 5574female46814.24Keumog Gellerich43 Gove StGenevaKenyamailto:Gellerich@ab.cafemale18High School57378.24Joonsoo Pollaciamailto:Pollacia@co.inmale36Other46000.68Sudip Rekhtermailto:Rekhter@cas.cz4959 8573 1371 9567femaleHigh School95732.32Hagen Artosimailto:Artosi@clustra.comhttp://www.clustra.com/~Artosi7136 1358 8743 584728College22854.05Mas Bretthauermailto:Bretthauer@uu.se6903 3735 8900 1605female44Graduate School62236.54Fano Usmanimailto:Usmani@unf.eduhttp://www.unf.edu/~Usmani4826 7793 3421 7914female24High School53332.77Berardo Radwanmailto:Radwan@clarkson.eduhttp://www.clarkson.edu/~Radwan5362 4892 6180 721418Other9995.92Martial Chorvat65 Campadelli StMonterreyUnited Statesmailto:Chorvat@zambeel.com4079 3475 5627 84482739491.29Hideo Korachmailto:Korach@cas.czhttp://www.cas.cz/~Korach8091 7556 8996 4369female34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 629830College9876.00Asha Dumasmailto:Dumas@twsu.edu9876.00Pragnesh Takanomailto:Takano@labs.comhttp://www.labs.com/~Takano8238 8564 3820 4678maleOther147002.31Nikolaos Birdsall20 Morillo StGrenadaUnited Statesmailto:Birdsall@clarkson.edufemale209876.00Alban Kossowskimailto:Kossowski@emc.com2606 3971 1356 1048male32039.10Guanshan Keustermans5 Hazony StBudapestUnited Statesmailto:Keustermans@upenn.eduhttp://www.upenn.edu/~Keustermans7994 4699 1996 9940male3959387.85Allison Balazsmailto:Balazs@ibm.comhttp://www.ibm.com/~Balazsfemale2933284.56Chams Michailidis11 Davoren StGainesvilleTanzaniamailto:Michailidis@ntua.grHigh School22905.31Merce Beoumes17 Lattin StLawtonQatarmailto:Beoumes@washington.eduhttp://www.washington.edu/~Beoumes18High School31438.50Yeogirl Wing3 Tambouris StTwinUnited Statesmailto:Wing@csufresno.eduhttp://www.csufresno.edu/~Wingmale88737.57Vanathi Takano39 Borowsky StIstanbulUnited Statesmailto:Takano@baylor.edu9748 8717 5684 6990femaleHigh School27442.54Linore Pradomailto:Prado@uta.edu3098 3930 3792 434943968.43Hausi Henriksson11 Shiota StSeattleUnited Statesmailto:Henriksson@uqam.cahttp://www.uqam.ca/~Henriksson39920.17Leslie Trystrammailto:Trystram@yahoo.com1867501.36Terunao Veccia53 Brightwell StToulouseHondurasmailto:Veccia@sbphrd.commale58High School53088.84Honglan Hagimontmailto:Hagimont@edu.auhttp://www.edu.au/~HagimontGraduate School52300.25Berto Parisi18 Cagley StColumbusTaiwanmailto:Parisi@sfu.cahttp://www.sfu.ca/~Parisi2059 3864 2375 29749876.00Dhritiman Schapiremailto:Schapire@ucd.iehttp://www.ucd.ie/~Schapire7089 9225 8648 4457female2425157.94Terrill Uchoamailto:Uchoa@co.infemaleOther98527.30Witold Straneymailto:Straney@cas.cz2461 6546 4698 2228female36High School37546.25Masali Ruedamailto:Rueda@cwi.nlhttp://www.cwi.nl/~Rueda7296 2605 7171 67983324186.28Marco Meszaros49 Wohn StKievSt. Vincent and Grenadinesmailto:Meszaros@ac.athttp://www.ac.at/~Meszaros6309 7243 2721 1636category2765739.54Niraj Fergany55 Rheingans StSaltGuineamailto:Fergany@uni-mb.si61161.12Shiby Ginneken58 Nisonger StNewcastleUnited Statesmailto:Ginneken@yorku.cahttp://www.yorku.ca/~Ginneken5020 5482 5482 3578male12885.30Mehrdad Schimmler76 McMorrow StAlbuquerqueUnited Statesmailto:Schimmler@evergreen.eduhttp://www.evergreen.edu/~Schimmler5264 9278 9093 16322870444.29Mountaz Ossenbruggenmailto:Ossenbruggen@whizbang.com15620.89Frieder Basumailto:Basu@edu.au1852503.82Garnik Takano43 Hendren StMexicoEl Salvadormailto:Takano@ask.comhttp://www.ask.com/~Takano6865 4881 8965 2217male38High School35391.33Samson Scopinich22 Luit StNassauLithuaniamailto:Scopinich@forth.grhttp://www.forth.gr/~Scopinich7744 1014 3146 5787female18Graduate School24387.33Mehrdad Christ96 Servatius StMilwaukeeIndonesiamailto:Christ@newpaltz.eduhttp://www.newpaltz.edu/~Christmale4522589.34Noelle Ramrasmailto:Ramras@dauphine.fr1834791.61Limor Schlichtermailto:Schlichter@dauphine.fr2262 3605 4735 3715female20230.96Radhia Lakshmipathymailto:Lakshmipathy@clustra.com5449328.84Von Hancox55 Pollermann StMelbourneUnited Statesmailto:Hancox@versata.com27College40010.92Prabuddha Chattopadhyaymailto:Chattopadhyay@nwu.edufemale1866561.70Mara Tchuentemailto:Tchuente@telcordia.comhttp://www.telcordia.com/~Tchuentefemale28College23070.82Hakim Savarammailto:Savaram@nyu.eduhttp://www.nyu.edu/~Savaramfemale33532.36Ravindran Yacobi90 Cools StAlbanyLithuaniamailto:Yacobi@emc.comfemale9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~Koszlajda50Other55383.43Nidapan Stassinopoulosmailto:Stassinopoulos@lante.com1944492.43Sajoong Bottoni56 Isman StWashingtonUnited Statesmailto:Bottoni@ucsd.eduhttp://www.ucsd.edu/~Bottoni4979 4485 7219 1879male70373.08Mehrdad Sevcikovamailto:Sevcikova@sds.nohttp://www.sds.no/~Sevcikova35Other95431.89Raimondas Holtmanmailto:Holtman@indiana.eduhttp://www.indiana.edu/~HoltmanfemaleHigh School9901.94Kaisa McNaught60 Kader StButteUnited Statesmailto:McNaught@ufl.edu18High School23748.90Bette Erevmailto:Erev@nyu.eduhttp://www.nyu.edu/~Erev4584 3851 4962 47661828245.16Sachem Grab29 Fegeas StSalvadorUnited Statesmailto:Grab@indiana.edu36Other62943.64Bartek Schumaker83 Kumaresan StLimaArgentinamailto:Schumaker@labs.comhttp://www.labs.com/~Schumaker3597 8655 2603 6797Graduate School69779.69Nathalie Rychlymailto:Rychly@cti.grmale22Graduate School36448.54Alassane Brown19 Steingart StTallahasseeTurkeymailto:Brown@ac.be4583 2923 3450 3894female56Graduate School9876.00Ardaman Underwood6 Anrig StBerlinUnited Statesmailto:Underwood@ucdavis.edufemale17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edu1889413.77Rosalyn Borrowman71 Mekaouche StCasperUnited Statesmailto:Borrowman@panasonic.comOther18748.51Honari Vendrig59 Dougherty StBolognaUnited Statesmailto:Vendrig@bell-labs.comhttp://www.bell-labs.com/~Vendrig56Other9876.00Magy Yuval52 Penniman StDothanUnited Statesmailto:Yuval@sds.nohttp://www.sds.no/~Yuval6960 5979 2083 3011maleOther147002.31Nikolaos Birdsall20 Morillo StGrenadaUnited Statesmailto:Birdsall@clarkson.edumaleGraduate School48463.16Geraldine Relihan23 Meketon StKahuluiUnited Statesmailto:Relihan@toronto.eduhttp://www.toronto.edu/~RelihanmaleGraduate School28135.59Arup Zhongxiumailto:Zhongxiu@savera.comhttp://www.savera.com/~Zhongxiu8907 5377 1768 2366femaleOther63285.36Roseane Henton21 Falkerngerg StArubaUnited Statesmailto:Henton@csufresno.eduhttp://www.csufresno.edu/~HentonmaleGraduate School43412.47Mehrdad Ewards9 Mosedale StMumbaiUnited Statesmailto:Ewards@edu.hkhttp://www.edu.hk/~Ewards18Graduate School45123.63Radhia Tamches63 Kitano StHonoluluUnited Statesmailto:Tamches@uni-trier.dehttp://www.uni-trier.de/~Tamches6565 7684 2833 7108femaleHigh School27442.54Linore Pradomailto:Prado@uta.edu3098 3930 3792 4349male319876.00Gita Polstermailto:Polster@ask.comhttp://www.ask.com/~Polster52371.54Georgi Adolphe74 Marzullo StCharlestonUnited Statesmailto:Adolphe@verity.comGraduate School34738.51Singaravel Skurczynski41 Zhongxiu StPortlandSwitzerlandmailto:Skurczynski@ntua.grhttp://www.ntua.gr/~Skurczynski9876.00Dhritiman Schapiremailto:Schapire@ucd.iehttp://www.ucd.ie/~Schapire7089 9225 8648 445732Graduate School21453.40Kyujin Thenmozhimailto:Thenmozhi@sbphrd.comhttp://www.sbphrd.com/~Thenmozhi5667 1325 6395 3905femaleCollege18089.31Newton Geibel55 McKinley StWestUnited Statesmailto:Geibel@lbl.gov6955 5513 9649 3373female36High School37546.25Masali Ruedamailto:Rueda@cwi.nlhttp://www.cwi.nl/~Rueda7296 2605 7171 679818College9876.00Mehrdad Abdennadher46 Machin StPortEgyptmailto:Abdennadher@co.inhttp://www.co.in/~Abdennadher4565 8396 6582 1590female19Other49367.09Armond Hebert54 Cooley StFrankfurtCanadamailto:Hebert@rpi.eduhttp://www.rpi.edu/~Hebertfemale67651.65Yoshinari Rajamailto:Raja@nodak.eduhttp://www.nodak.edu/~Raja7807 3048 4554 4266category19female63811.82Lon Leifert45 McKenna StKansasUnited Statesmailto:Leifert@sunysb.eduhttp://www.sunysb.edu/~Leifert6789 8467 1353 581615620.89Frieder Basumailto:Basu@edu.aumale1857760.56Shinji Varhegyi60 Candan StDothanUnited Statesmailto:Varhegyi@forth.grhttp://www.forth.gr/~Varhegyi6982 5985 8455 8370male4522589.34Noelle Ramrasmailto:Ramras@dauphine.frfemale63Other71946.13Herbert Kleiser100 Raghavendra StGeorgeUnited Statesmailto:Kleiser@washington.eduhttp://www.washington.edu/~Kleiser4454 8668 5057 1574female1866561.70Mara Tchuentemailto:Tchuente@telcordia.comhttp://www.telcordia.com/~Tchuentefemale4268999.45Quinlong Usdinmailto:Usdin@imag.fr18High School9876.00Avshalom Attimonellimailto:Attimonelli@uic.eduhttp://www.uic.edu/~Attimonelli7686 9066 7885 14095018437.40Vinot Thomsen2 Kishida StChattanoogaUnited Statesmailto:Thomsen@cornell.eduhttp://www.cornell.edu/~Thomsenfemale33532.36Ravindran Yacobi90 Cools StAlbanyLithuaniamailto:Yacobi@emc.com49Graduate School71359.18Felip Fujisakimailto:Fujisaki@itc.itfemale9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~KoszlajdaGraduate School9876.00Kristof Grafe94 Ingolfsdottir StCopenhagenZimbabwemailto:Grafe@lante.comhttp://www.lante.com/~Grafemale4262287.09Suvo Fiutem69 Luff StWindhoekSouth Africamailto:Fiutem@co.jp5089 1407 5205 5391College9876.00Avinash McNeillmailto:McNeill@verity.com8232 2154 3640 2295femaleOther76543.02Arno Takano2 Jezioranski StAkronUnited Statesmailto:Takano@uwo.cahttp://www.uwo.ca/~Takano1059 2269 8254 75152948525.86Jens Rodigermailto:Rodiger@uqam.cahttp://www.uqam.ca/~Rodiger7366 1702 9623 9871female46814.24Keumog Gellerich43 Gove StGenevaKenyamailto:Gellerich@ab.caGraduate School31807.68Kendra Kumaresan85 Metze StBerlinChristmas Islandmailto:Kumaresan@llnl.govhttp://www.llnl.gov/~Kumaresan3525 1127 3070 9580femaleGraduate School56956.07Sukhmay Schwartzbauermailto:Schwartzbauer@purdue.edu4381 3385 4917 12801830444.53Tamitha Iwanski39 Falgout StFlorenceUnited Statesmailto:Iwanski@auth.grfemale76520.37Yahui Tanemomailto:Tanemo@uqam.ca9174 1888 2967 7251High School48609.71Neelam Passafiumemailto:Passafiume@hitachi.comhttp://www.hitachi.com/~Passafiume2967 5196 1495 5214female459876.00Mehrdad Apperley12 Vinar StBucharestUnited Statesmailto:Apperley@ibm.commale19764.36Jacky Kunieda31 Malabarba StGuaymasUnited Statesmailto:Kunieda@uni-mannheim.de4090 9244 8696 7598male18Graduate School61397.86Atreye Livari18 Sangal StCincinnatiSenegalmailto:Livari@msn.comhttp://www.msn.com/~Livarifemale66College23852.19Nataraj Tasistromailto:Tasistro@ac.jphttp://www.ac.jp/~Tasistro9876.00Pragnesh Takanomailto:Takano@labs.comhttp://www.labs.com/~Takano8238 8564 3820 467851Other23226.04Yoshiki Blumbergmailto:Blumberg@ask.com2926 2408 8275 214344100064.62Oddvar Kamijomailto:Kamijo@ou.eduhttp://www.ou.edu/~Kamijo4434 7244 4200 8479female1848441.07Marleen Hancartmailto:Hancart@unical.it8644 5992 4180 8611High School44591.54Thyagaraju Papadias36 Razdan StProvidencialesUnited Statesmailto:Papadias@uni-mb.si9846 8257 2339 235339920.17Leslie Trystrammailto:Trystram@yahoo.com52371.54Georgi Adolphe74 Marzullo StCharlestonUnited Statesmailto:Adolphe@verity.comfemale48896.64Tinko Reinhart100 Dhagat StZihuatenejoBahrainmailto:Reinhart@crossgain.comhttp://www.crossgain.com/~Reinhart9876.00Dhritiman Schapiremailto:Schapire@ucd.iehttp://www.ucd.ie/~Schapire7089 9225 8648 445746College9876.00Ennio Fanchon44 Beeferman StStockholmVatican City Statemailto:Fanchon@bellatlantic.nethttp://www.bellatlantic.net/~Fanchon78286.48Kunimasa Useltonmailto:Uselton@utexas.edu8164 1978 5759 301018Graduate School61430.09Sabrina Blackallmailto:Blackall@poly.eduhttp://www.poly.edu/~Blackallfemale22High School9876.00Narcis Theodoratos93 Sudkamp StOrlandoDenmarkmailto:Theodoratos@berkeley.educategory2female63811.82Lon Leifert45 McKenna StKansasUnited Statesmailto:Leifert@sunysb.eduhttp://www.sunysb.edu/~Leifert6789 8467 1353 58162920536.39Marit Ozols39 Olivo StViennaUnited Statesmailto:Ozols@clarkson.eduhttp://www.clarkson.edu/~Ozols7994 7972 6209 734915620.89Frieder Basumailto:Basu@edu.au18College23941.65Rajaram Lease100 Preishuber StEastUnited Statesmailto:Lease@imag.frhttp://www.imag.fr/~Lease4948 9378 8238 3600female18Graduate School24387.33Mehrdad Christ96 Servatius StMilwaukeeIndonesiamailto:Christ@newpaltz.eduhttp://www.newpaltz.edu/~Christ52743.14Angel McDermid56 Deves StStockholmUnited Statesmailto:McDermid@ucdavis.eduhttp://www.ucdavis.edu/~McDermidmale2885711.23Maung Rainmailto:Rain@cas.czfemale1866561.70Mara Tchuentemailto:Tchuente@telcordia.comhttp://www.telcordia.com/~Tchuente1875013.99Filipe Pappasmailto:Pappas@ac.at5070 6126 9654 699535Other95431.89Raimondas Holtmanmailto:Holtman@indiana.eduhttp://www.indiana.edu/~Holtman59596.19Jurgen Desprez10 Jushchenko StHarrisburgUnited Statesmailto:Desprez@nyu.edufemaleOther44792.93Hagbae Gershkovich62 Soinard StBrusselsAmerican Samoamailto:Gershkovich@llnl.govhttp://www.llnl.gov/~Gershkovichmale19764.36Jacky Kunieda31 Malabarba StGuaymasUnited Statesmailto:Kunieda@uni-mannheim.de4090 9244 8696 7598female17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edu30Graduate School46548.36Suneeta Baptiste47 Decugis StDurangoUnited Statesmailto:Baptiste@neu.edumaleCollege62028.39Lucien Cunliffe11 Smotroff StMeridianVatican City Statemailto:Cunliffe@mit.edu2139 7205 4141 4885male18College44173.97Takaaki Carrick53 Blom StBrunswickUnited Statesmailto:Carrick@washington.eduhttp://www.washington.edu/~Carrickmale13990.17Faraz Kendallmailto:Kendall@ucf.eduhttp://www.ucf.edu/~Kendall5984 6936 6736 385475125.30Randal Roushmailto:Roush@msstate.edu6224 7382 7689 8766maleCollege45623.75Shooichi Raither67 Andernach StZihuatenejoUnited Statesmailto:Raither@concordia.caOther18748.51Honari Vendrig59 Dougherty StBolognaUnited Statesmailto:Vendrig@bell-labs.comhttp://www.bell-labs.com/~Vendrig9876.00Pragnesh Takanomailto:Takano@labs.comhttp://www.labs.com/~Takano8238 8564 3820 4678maleOther147002.31Nikolaos Birdsall20 Morillo StGrenadaUnited Statesmailto:Birdsall@clarkson.edu18High School47967.41Naoki Osterloh7 Ghandeharizadeh StCairoTanzaniamailto:Osterloh@ask.comhttp://www.ask.com/~Osterloh7741 8229 7494 194329Other56634.76Lai Greenwaldmailto:Greenwald@filelmaker.comhttp://www.filelmaker.com/~Greenwald9722 4263 8015 6083maleGraduate School48463.16Geraldine Relihan23 Meketon StKahuluiUnited Statesmailto:Relihan@toronto.eduhttp://www.toronto.edu/~RelihanOther69247.75Sanford Mergenmailto:Mergen@msstate.edu34032.09Francesca Weismantelmailto:Weismantel@ucla.edu2763 1794 7943 4753female2425157.94Terrill Uchoamailto:Uchoa@co.in2219500.74Fons Grabnermailto:Grabner@indiana.eduhttp://www.indiana.edu/~Grabnerfemale18Other59467.28Hiroyoshi Takanomailto:Takano@utexas.eduhttp://www.utexas.edu/~Takano4727 1469 2323 6305category24female63811.82Lon Leifert45 McKenna StKansasUnited Statesmailto:Leifert@sunysb.eduhttp://www.sunysb.edu/~Leifert6789 8467 1353 581661161.12Shiby Ginneken58 Nisonger StNewcastleUnited Statesmailto:Ginneken@yorku.cahttp://www.yorku.ca/~Ginneken5020 5482 5482 357834541.24Emilo Schahnmailto:Schahn@filemaker.comhttp://www.filemaker.com/~Schahn5877 8225 7127 2717female18Graduate School24387.33Mehrdad Christ96 Servatius StMilwaukeeIndonesiamailto:Christ@newpaltz.eduhttp://www.newpaltz.edu/~Christfemale29College109893.20Bevin Keustermans55 Kluthe StCharlestonUnited Statesmailto:Keustermans@cwru.edu5018437.40Vinot Thomsen2 Kishida StChattanoogaUnited Statesmailto:Thomsen@cornell.eduhttp://www.cornell.edu/~ThomsenHigh School52123.17Athomas Roubieremailto:Roubiere@yorku.cafemale33532.36Ravindran Yacobi90 Cools StAlbanyLithuaniamailto:Yacobi@emc.commale19High School38050.91Mauri Takanomailto:Takano@sbphrd.comhttp://www.sbphrd.com/~Takanomale70373.08Mehrdad Sevcikovamailto:Sevcikova@sds.nohttp://www.sds.no/~Sevcikovamale45College81262.14Changsik Demirozmailto:Demiroz@umd.edu2601 7963 2940 9617female459876.00Mehrdad Apperley12 Vinar StBucharestUnited Statesmailto:Apperley@ibm.comfemale19High School47409.99Wieb Baummailto:Baum@bell-labs.comhttp://www.bell-labs.com/~BaumHigh School32535.03Drago Showaltermailto:Showalter@auc.dkmale19764.36Jacky Kunieda31 Malabarba StGuaymasUnited Statesmailto:Kunieda@uni-mannheim.de4090 9244 8696 7598female17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edumaleCollege9876.00Asmus Hanekemailto:Haneke@unical.ithttp://www.unical.it/~Haneke6994 8976 8481 7963female34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 62989876.00Pragnesh Takanomailto:Takano@labs.comhttp://www.labs.com/~Takano8238 8564 3820 467818High School47967.41Naoki Osterloh7 Ghandeharizadeh StCairoTanzaniamailto:Osterloh@ask.comhttp://www.ask.com/~Osterloh7741 8229 7494 1943femaleCollege32788.80Mitchel Cunliffemailto:Cunliffe@dauphine.frhttp://www.dauphine.fr/~Cunliffe44100064.62Oddvar Kamijomailto:Kamijo@ou.eduhttp://www.ou.edu/~Kamijo4434 7244 4200 8479male3959387.85Allison Balazsmailto:Balazs@ibm.comhttp://www.ibm.com/~Balazs26419.07Yukata Beauducel47 Araya StCharlottesvilleUnited Statesmailto:Beauducel@poznan.plhttp://www.poznan.pl/~Beauducel7393 8354 9466 4534male88737.57Vanathi Takano39 Borowsky StIstanbulUnited Statesmailto:Takano@baylor.edu9748 8717 5684 699032College31589.10Daria McDermid79 Harllee StCalgaryTurkeymailto:McDermid@acm.orghttp://www.acm.org/~McDermidfemale21High School43968.24Yelena Takano10 Luit StAmarilloSaudi Arabiamailto:Takano@uga.edufemaleCollege18089.31Newton Geibel55 McKinley StWestUnited Statesmailto:Geibel@lbl.gov6955 5513 9649 3373female2425157.94Terrill Uchoamailto:Uchoa@co.infemaleCollege66111.11Quanfeng Grahn1 Billinghurst StOrlandoUnited Statesmailto:Grahn@edu.cnhttp://www.edu.cn/~Grahn6176 5125 1462 2376category6female63811.82Lon Leifert45 McKenna StKansasUnited Statesmailto:Leifert@sunysb.eduhttp://www.sunysb.edu/~Leifert6789 8467 1353 5816male71962.16Fillia Wichlaczmailto:Wichlacz@ou.eduhttp://www.ou.edu/~Wichlacz1848 6469 5307 63722920536.39Marit Ozols39 Olivo StViennaUnited Statesmailto:Ozols@clarkson.eduhttp://www.clarkson.edu/~Ozols7994 7972 6209 7349male12885.30Mehrdad Schimmler76 McMorrow StAlbuquerqueUnited Statesmailto:Schimmler@evergreen.eduhttp://www.evergreen.edu/~Schimmler5264 9278 9093 16321852503.82Garnik Takano43 Hendren StMexicoEl Salvadormailto:Takano@ask.comhttp://www.ask.com/~Takano6865 4881 8965 221718College23941.65Rajaram Lease100 Preishuber StEastUnited Statesmailto:Lease@imag.frhttp://www.imag.fr/~Lease4948 9378 8238 3600male2885711.23Maung Rainmailto:Rain@cas.czfemale63Other71946.13Herbert Kleiser100 Raghavendra StGeorgeUnited Statesmailto:Kleiser@washington.eduhttp://www.washington.edu/~Kleiser4454 8668 5057 15743364225.11Arjen Emden44 Goos StLexingtonUnited Statesmailto:Emden@forwiss.dehttp://www.forwiss.de/~Emden2468 4642 9646 5367female1866561.70Mara Tchuentemailto:Tchuente@telcordia.comhttp://www.telcordia.com/~Tchuentefemale24039.95May Ramsden33 Tano StCaracasGeorgiamailto:Ramsden@brandeis.edufemale4268999.45Quinlong Usdinmailto:Usdin@imag.frfemale29College109893.20Bevin Keustermans55 Kluthe StCharlestonUnited Statesmailto:Keustermans@cwru.edu5018437.40Vinot Thomsen2 Kishida StChattanoogaUnited Statesmailto:Thomsen@cornell.eduhttp://www.cornell.edu/~Thomsen49Graduate School71359.18Felip Fujisakimailto:Fujisaki@itc.itfemale9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~Koszlajda32165.04Margrethe Dowellmailto:Dowell@brandeis.eduGraduate School9876.00Kristof Grafe94 Ingolfsdottir StCopenhagenZimbabwemailto:Grafe@lante.comhttp://www.lante.com/~Grafefemale80670.94Shiquan Wixonmailto:Wixon@pi.it47Graduate School9876.00Ebbe Kawashima23 Rinn StHelenaUnited Statesmailto:Kawashima@gmu.edumaleGraduate School18103.99Raja Schroermailto:Schroer@ac.kr35Other95431.89Raimondas Holtmanmailto:Holtman@indiana.eduhttp://www.indiana.edu/~HoltmanfemaleOther76543.02Arno Takano2 Jezioranski StAkronUnited Statesmailto:Takano@uwo.cahttp://www.uwo.ca/~Takano1059 2269 8254 7515male3760708.89Nobuko Manara39 Pigeon StMontgomeryUnited Statesmailto:Manara@imag.frhttp://www.imag.fr/~Manara8751 5605 9270 864618High School23748.90Bette Erevmailto:Erev@nyu.eduhttp://www.nyu.edu/~Erev4584 3851 4962 4766female19High School47409.99Wieb Baummailto:Baum@bell-labs.comhttp://www.bell-labs.com/~Baumfemale44Graduate School62236.54Fano Usmanimailto:Usmani@unf.eduhttp://www.unf.edu/~Usmani4826 7793 3421 79141889413.77Rosalyn Borrowman71 Mekaouche StCasperUnited Statesmailto:Borrowman@panasonic.comfemale24High School53332.77Berardo Radwanmailto:Radwan@clarkson.eduhttp://www.clarkson.edu/~Radwan5362 4892 6180 7214male1947616.43Gurmeet Beounesmailto:Beounes@yorku.camaleCollege62028.39Lucien Cunliffe11 Smotroff StMeridianVatican City Statemailto:Cunliffe@mit.edu2139 7205 4141 4885Other18748.51Honari Vendrig59 Dougherty StBolognaUnited Statesmailto:Vendrig@bell-labs.comhttp://www.bell-labs.com/~VendrigmaleHigh School22127.36Yannik Hamblinmailto:Hamblin@cohera.com56Other9876.00Magy Yuval52 Penniman StDothanUnited Statesmailto:Yuval@sds.nohttp://www.sds.no/~Yuval6960 5979 2083 301118High School47967.41Naoki Osterloh7 Ghandeharizadeh StCairoTanzaniamailto:Osterloh@ask.comhttp://www.ask.com/~Osterloh7741 8229 7494 1943female31313.14Upendra Sueyoshi100 Iwayama StPensacolaUnited Statesmailto:Sueyoshi@msstate.edu1867501.36Terunao Veccia53 Brightwell StToulouseHondurasmailto:Veccia@sbphrd.comfemale48896.64Tinko Reinhart100 Dhagat StZihuatenejoBahrainmailto:Reinhart@crossgain.comhttp://www.crossgain.com/~ReinhartfemaleOther98527.30Witold Straneymailto:Straney@cas.cz2461 6546 4698 2228Other49831.44Shyam Taganskymailto:Tagansky@cwru.eduhttp://www.cwru.edu/~Tagansky44103147.12Jamaludin Pigeot64 Gire StMonroeZambiamailto:Pigeot@toronto.eduhttp://www.toronto.edu/~Pigeot6115 7380 3797 5687female22High School9876.00Narcis Theodoratos93 Sudkamp StOrlandoDenmarkmailto:Theodoratos@berkeley.educategory154137695.50Miron Rivals33 Besancenot StShannonUnited Statesmailto:Rivals@ac.be5183 2729 4304 4288male4522589.34Noelle Ramrasmailto:Ramras@dauphine.frfemale1866561.70Mara Tchuentemailto:Tchuente@telcordia.comhttp://www.telcordia.com/~Tchuentemale18Other84592.63Jayakrishnan Turakainenmailto:Turakainen@evergreen.edu1828898.01Mimmo Stiftermailto:Stifter@edu.cnhttp://www.edu.cn/~Stifter3829 2675 8446 50113456260.67Liesbeth Slutz5 Seneviratne StOntarioUnited Statesmailto:Slutz@berkeley.edu5271 5154 7113 9635Graduate School9876.00Kristof Grafe94 Ingolfsdottir StCopenhagenZimbabwemailto:Grafe@lante.comhttp://www.lante.com/~GrafefemaleGraduate School54668.95Joey Girouxmailto:Giroux@crossgain.comhttp://www.crossgain.com/~Giroux6425 5745 4662 1727female309876.00Gertrud Zschoche77 Lyle StMexicoMacaumailto:Zschoche@microsoft.comhttp://www.microsoft.com/~ZschocheCollege48030.11Apostol Federico100 Fussichen StDublinUnited Statesmailto:Federico@duke.edu9540 9764 8697 345418Graduate School41595.76Nevio Drashansky60 Petry StElUnited Statesmailto:Drashansky@evergreen.edu7712 4592 2474 5574High School9876.00Guoping Ghazaliemailto:Ghazalie@sunysb.eduCollege26548.80Martial Miaramailto:Miara@lante.comfemaleHigh School11071.29Grady Bitnermailto:Bitner@uwindsor.cafemaleHigh School95732.32Hagen Artosimailto:Artosi@clustra.comhttp://www.clustra.com/~Artosi7136 1358 8743 5847female76520.37Yahui Tanemomailto:Tanemo@uqam.ca9174 1888 2967 7251femaleOther44792.93Hagbae Gershkovich62 Soinard StBrusselsAmerican Samoamailto:Gershkovich@llnl.govhttp://www.llnl.gov/~Gershkovichfemale459876.00Mehrdad Apperley12 Vinar StBucharestUnited Statesmailto:Apperley@ibm.comHigh School32535.03Drago Showaltermailto:Showalter@auc.dk23Other32990.55Endre Schmeck91 Hokimoto StKansasUnited Statesmailto:Schmeck@ucf.edu6028 9130 7525 92761835873.68Hercules Fornemailto:Forne@ac.krmale18Other78929.23Pierrette Valiente10 Gurevitch StMulhouseRussian Federationmailto:Valiente@ask.comfemaleCollege32788.80Mitchel Cunliffemailto:Cunliffe@dauphine.frhttp://www.dauphine.fr/~CunliffeCollege79398.49Remigijus Przuljmailto:Przulj@rwth-aachen.defemale2933284.56Chams Michailidis11 Davoren StGainesvilleTanzaniamailto:Michailidis@ntua.grmaleGraduate School43412.47Mehrdad Ewards9 Mosedale StMumbaiUnited Statesmailto:Ewards@edu.hkhttp://www.edu.hk/~Ewardsmale5438040.25Mehrdad Dundas48 Junior StRoanokeUnited Statesmailto:Dundas@ac.ukfemale18129137.70Khedija Yonezawa57 Naixiao StToulouseChilemailto:Yonezawa@clustra.comhttp://www.clustra.com/~Yonezawa2333 2094 5586 4351Graduate School46598.25Adonios Genssler37 Fadgyas StMeridaUnited Statesmailto:Genssler@ou.edu9347 7564 5309 6289Graduate School52300.25Berto Parisi18 Cagley StColumbusTaiwanmailto:Parisi@sfu.cahttp://www.sfu.ca/~Parisi2059 3864 2375 29742983848.21Yuguang Uhrik44 Dahlhaus StVeniceUnited Statesmailto:Uhrik@telcordia.comhttp://www.telcordia.com/~Uhrikfemale21High School43968.24Yelena Takano10 Luit StAmarilloSaudi Arabiamailto:Takano@uga.edufemale67651.65Yoshinari Rajamailto:Raja@nodak.eduhttp://www.nodak.edu/~Raja7807 3048 4554 4266female1857957.32Shiquan Cappellimailto:Cappelli@uiuc.educategory13female9876.00Hiro Bergere94 Nissenbaum StMelbourneUnited Statesmailto:Bergere@prc.comhttp://www.prc.com/~Bergere9941 5989 9575 1127male64243.77Huican Szmurlo52 Ternovskaia StCodyUnited Statesmailto:Szmurlo@ucsd.eduhttp://www.ucsd.edu/~Szmurlo2217 9440 7362 3405female93942.48Abdelilah Chepyzhov93 Milgrom StHuntsvilleUnited Statesmailto:Chepyzhov@fsu.edu8729 1525 7474 9453male14407.23Ljupco Cappello55 Lotkin StConakryBelgiummailto:Cappello@zambeel.comhttp://www.zambeel.com/~Cappello2870444.29Mountaz Ossenbruggenmailto:Ossenbruggen@whizbang.comfemale21Graduate School34281.58Lilly Zuiderveld62 Lamma StElUnited Statesmailto:Zuiderveld@computer.orghttp://www.computer.org/~Zuiderveld26770.70Fun Lattin93 Mutschke StPascoUnited Statesmailto:Lattin@forth.grhttp://www.forth.gr/~LattinOther54432.83Charlotte Clasenmailto:Clasen@evergreen.eduhttp://www.evergreen.edu/~Clasen8141 8906 4540 295733857.61Kristof Pittmailto:Pitt@unf.edu6369 9760 9277 8247female33532.36Ravindran Yacobi90 Cools StAlbanyLithuaniamailto:Yacobi@emc.comGraduate School10605.72Katashi Landymailto:Landy@wisc.eduGraduate School9876.00Kristof Grafe94 Ingolfsdottir StCopenhagenZimbabwemailto:Grafe@lante.comhttp://www.lante.com/~GrafemaleGraduate School18103.99Raja Schroermailto:Schroer@ac.krmale1835487.60Mehrdad Huhdanpaamailto:Huhdanpaa@itc.ithttp://www.itc.it/~Huhdanpaa18Graduate School41595.76Nevio Drashansky60 Petry StElUnited Statesmailto:Drashansky@evergreen.edu7712 4592 2474 5574High School27555.24Rosli Horndaschmailto:Horndasch@bell-labs.com1669 2715 2205 1746female46814.24Keumog Gellerich43 Gove StGenevaKenyamailto:Gellerich@ab.ca3222366.88Eneko Leask63 Lester StAmsterdamMarshall Islandsmailto:Leask@versata.com3921 5024 9469 9080Graduate School9876.00Tokinori Pinzanimailto:Pinzani@forth.grhttp://www.forth.gr/~Pinzani7965 8729 6099 5583femaleHigh School11071.29Grady Bitnermailto:Bitner@uwindsor.cafemale3943323.95Mitsugu Thobenmailto:Thoben@sbphrd.com4537 1155 4156 6649femaleOther44792.93Hagbae Gershkovich62 Soinard StBrusselsAmerican Samoamailto:Gershkovich@llnl.govhttp://www.llnl.gov/~Gershkovichfemale29High School44522.39Rupal Takanomailto:Takano@conclusivestrategies.comfemale459876.00Mehrdad Apperley12 Vinar StBucharestUnited Statesmailto:Apperley@ibm.comfemale14853.15Rostam Littlestone64 Pokoski StParisUnited Statesmailto:Littlestone@sdsc.edu9723 1922 2703 4762female34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 6298male26099.90Sheilah Takano27 Chandna StToledoUnited Statesmailto:Takano@neu.eduhttp://www.neu.edu/~Takano5166 3645 9483 2416female3889088.09Masamitsu Andaleonmailto:Andaleon@cti.grfemaleHigh School57624.85Srihari Murrillmailto:Murrill@edu.cnfemale2933284.56Chams Michailidis11 Davoren StGainesvilleTanzaniamailto:Michailidis@ntua.grfemale18129137.70Khedija Yonezawa57 Naixiao StToulouseChilemailto:Yonezawa@clustra.comhttp://www.clustra.com/~Yonezawa2333 2094 5586 435139920.17Leslie Trystrammailto:Trystram@yahoo.commale58High School53088.84Honglan Hagimontmailto:Hagimont@edu.auhttp://www.edu.au/~Hagimontmale34Other41124.07Hongsheng Marrakchimailto:Marrakchi@edu.au4697 8715 7524 3687male3318777.80Wil Herleymailto:Herley@brown.eduhttp://www.brown.edu/~Herley9077 3456 8000 1843female2425157.94Terrill Uchoamailto:Uchoa@co.in44103147.12Jamaludin Pigeot64 Gire StMonroeZambiamailto:Pigeot@toronto.eduhttp://www.toronto.edu/~Pigeot6115 7380 3797 568735High School104197.29Arne Ohori80 Belleghem StManchesterUnited Statesmailto:Ohori@concordia.ca5057 7242 3265 1360category14male71962.16Fillia Wichlaczmailto:Wichlacz@ou.eduhttp://www.ou.edu/~Wichlacz1848 6469 5307 6372male64243.77Huican Szmurlo52 Ternovskaia StCodyUnited Statesmailto:Szmurlo@ucsd.eduhttp://www.ucsd.edu/~Szmurlo2217 9440 7362 3405male12885.30Mehrdad Schimmler76 McMorrow StAlbuquerqueUnited Statesmailto:Schimmler@evergreen.eduhttp://www.evergreen.edu/~Schimmler5264 9278 9093 16322870444.29Mountaz Ossenbruggenmailto:Ossenbruggen@whizbang.comOther9876.00Bharadwaj Nozawa58 Regoli StWarsawUnited Statesmailto:Nozawa@cas.czhttp://www.cas.cz/~Nozawa3284 7939 4808 3523female3449147.80Frantisek Speltmailto:Spelt@versata.comhttp://www.versata.com/~Spelt3364225.11Arjen Emden44 Goos StLexingtonUnited Statesmailto:Emden@forwiss.dehttp://www.forwiss.de/~Emden2468 4642 9646 5367female28College23070.82Hakim Savarammailto:Savaram@nyu.eduhttp://www.nyu.edu/~Savaramfemale4268999.45Quinlong Usdinmailto:Usdin@imag.fr18High School9876.00Avshalom Attimonellimailto:Attimonelli@uic.eduhttp://www.uic.edu/~Attimonelli7686 9066 7885 1409female29College109893.20Bevin Keustermans55 Kluthe StCharlestonUnited Statesmailto:Keustermans@cwru.edu5018437.40Vinot Thomsen2 Kishida StChattanoogaUnited Statesmailto:Thomsen@cornell.eduhttp://www.cornell.edu/~Thomsen55498.73Mehrdad Barroso23 Grabner StRapidUnited Statesmailto:Barroso@uwo.cafemale33532.36Ravindran Yacobi90 Cools StAlbanyLithuaniamailto:Yacobi@emc.comGraduate School10605.72Katashi Landymailto:Landy@wisc.edufemale70860.02Horward Hammerschmidtmailto:Hammerschmidt@uni-mannheim.defemaleGraduate School54668.95Joey Girouxmailto:Giroux@crossgain.comhttp://www.crossgain.com/~Giroux6425 5745 4662 1727female21College20347.38Isamu Kupiecmailto:Kupiec@twsu.eduhttp://www.twsu.edu/~Kupiec6071 5377 9019 2963College106547.20Khatoun Rankamailto:Ranka@clarkson.eduhttp://www.clarkson.edu/~Ranka38High School50055.21Ermanno Shilovmailto:Shilov@uta.edu9902 7401 7046 402579483.09Rafik Mahmudmailto:Mahmud@sleepycat.comhttp://www.sleepycat.com/~Mahmud18Graduate School30851.14LouAnn Mulvany13 Whitt StBarcelonaUnited Statesmailto:Mulvany@ucla.eduhttp://www.ucla.edu/~Mulvany6788 3544 7141 902541Other9876.00Rattasit Brookman3 Heiman StCalgaryUnited Statesmailto:Brookman@edu.sg8108 2667 4487 40983432403.38Subash Takano2 Stranks StKalamazooSan Marinomailto:Takano@sybase.com8809 7276 9678 1558femaleOther44792.93Hagbae Gershkovich62 Soinard StBrusselsAmerican Samoamailto:Gershkovich@llnl.govhttp://www.llnl.gov/~Gershkovichfemale459876.00Mehrdad Apperley12 Vinar StBucharestUnited Statesmailto:Apperley@ibm.com28College22854.05Mas Bretthauermailto:Bretthauer@uu.se6903 3735 8900 1605male19764.36Jacky Kunieda31 Malabarba StGuaymasUnited Statesmailto:Kunieda@uni-mannheim.de4090 9244 8696 7598female17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edu29864.60Staphane Ariola92 Philbin StAbuGuatemalamailto:Ariola@unf.eduhttp://www.unf.edu/~Ariola8610 1268 6870 4995College79398.49Remigijus Przuljmailto:Przulj@rwth-aachen.demaleGraduate School28135.59Arup Zhongxiumailto:Zhongxiu@savera.comhttp://www.savera.com/~Zhongxiu8907 5377 1768 236626419.07Yukata Beauducel47 Araya StCharlottesvilleUnited Statesmailto:Beauducel@poznan.plhttp://www.poznan.pl/~Beauducel7393 8354 9466 4534High School22905.31Merce Beoumes17 Lattin StLawtonQatarmailto:Beoumes@washington.eduhttp://www.washington.edu/~BeoumesHigh School44591.54Thyagaraju Papadias36 Razdan StProvidencialesUnited Statesmailto:Papadias@uni-mb.si9846 8257 2339 235339920.17Leslie Trystrammailto:Trystram@yahoo.com1867501.36Terunao Veccia53 Brightwell StToulouseHondurasmailto:Veccia@sbphrd.com26College13999.18Yoko Meursmailto:Meurs@rpi.edu4761 5609 3284 980131109.71Stefano Veselmailto:Vesel@hp.comfemale2425157.94Terrill Uchoamailto:Uchoa@co.infemaleOther98527.30Witold Straneymailto:Straney@cas.cz2461 6546 4698 2228Other49831.44Shyam Taganskymailto:Tagansky@cwru.eduhttp://www.cwru.edu/~Tagansky2219500.74Fons Grabnermailto:Grabner@indiana.eduhttp://www.indiana.edu/~Grabner53Graduate School33338.11Kwangjo Benainimailto:Benaini@uga.edufemale22High School9876.00Narcis Theodoratos93 Sudkamp StOrlandoDenmarkmailto:Theodoratos@berkeley.edufemale24Graduate School50690.73Tevfik Shumilov79 Nisiyama StCincinnatiUnited Statesmailto:Shumilov@ou.edu7217 8872 1602 19673324186.28Marco Meszaros49 Wohn StKievSt. Vincent and Grenadinesmailto:Meszaros@ac.athttp://www.ac.at/~Meszaros6309 7243 2721 1636category17male71962.16Fillia Wichlaczmailto:Wichlacz@ou.eduhttp://www.ou.edu/~Wichlacz1848 6469 5307 637234541.24Emilo Schahnmailto:Schahn@filemaker.comhttp://www.filemaker.com/~Schahn5877 8225 7127 2717male2885711.23Maung Rainmailto:Rain@cas.czmale4522589.34Noelle Ramrasmailto:Ramras@dauphine.fr1834791.61Limor Schlichtermailto:Schlichter@dauphine.fr2262 3605 4735 3715female63Other71946.13Herbert Kleiser100 Raghavendra StGeorgeUnited Statesmailto:Kleiser@washington.eduhttp://www.washington.edu/~Kleiser4454 8668 5057 15743364225.11Arjen Emden44 Goos StLexingtonUnited Statesmailto:Emden@forwiss.dehttp://www.forwiss.de/~Emden2468 4642 9646 53672868050.59Rogerio Kuemmerle97 McAfee StStockholmUnited Statesmailto:Kuemmerle@njit.edu4349 1772 6659 58015018437.40Vinot Thomsen2 Kishida StChattanoogaUnited Statesmailto:Thomsen@cornell.eduhttp://www.cornell.edu/~Thomsenfemale33532.36Ravindran Yacobi90 Cools StAlbanyLithuaniamailto:Yacobi@emc.comGraduate School9876.00Kristof Grafe94 Ingolfsdottir StCopenhagenZimbabwemailto:Grafe@lante.comhttp://www.lante.com/~GrafefemaleGraduate School54668.95Joey Girouxmailto:Giroux@crossgain.comhttp://www.crossgain.com/~Giroux6425 5745 4662 17271944492.43Sajoong Bottoni56 Isman StWashingtonUnited Statesmailto:Bottoni@ucsd.eduhttp://www.ucsd.edu/~Bottoni4979 4485 7219 1879College48030.11Apostol Federico100 Fussichen StDublinUnited Statesmailto:Federico@duke.edu9540 9764 8697 3454female49245.92Yongjian Dechter88 Schwederski StGreatUnited Statesmailto:Dechter@ernet.in3385 8194 5484 288579483.09Rafik Mahmudmailto:Mahmud@sleepycat.comhttp://www.sleepycat.com/~Mahmud2948525.86Jens Rodigermailto:Rodiger@uqam.cahttp://www.uqam.ca/~Rodiger7366 1702 9623 987141Other9876.00Rattasit Brookman3 Heiman StCalgaryUnited Statesmailto:Brookman@edu.sg8108 2667 4487 4098Graduate School9876.00Tokinori Pinzanimailto:Pinzani@forth.grhttp://www.forth.gr/~Pinzani7965 8729 6099 55831828245.16Sachem Grab29 Fegeas StSalvadorUnited Statesmailto:Grab@indiana.edu29College85365.36Sushant Baransky39 Varpaaniemi StChicagoZambiamailto:Baransky@du.eduCollege56284.41Burkhard Guardalben83 Iliopoulos StMeridianUnited Statesmailto:Guardalben@nodak.edu4905 6016 2395 4392High School32535.03Drago Showaltermailto:Showalter@auc.dk1889413.77Rosalyn Borrowman71 Mekaouche StCasperUnited Statesmailto:Borrowman@panasonic.com2739491.29Hideo Korachmailto:Korach@cas.czhttp://www.cas.cz/~Korach8091 7556 8996 4369105623.69Yanni Montemayormailto:Montemayor@ac.athttp://www.ac.at/~MontemayormaleCollege9876.00Asmus Hanekemailto:Haneke@unical.ithttp://www.unical.it/~Haneke6994 8976 8481 796329864.60Staphane Ariola92 Philbin StAbuGuatemalamailto:Ariola@unf.eduhttp://www.unf.edu/~Ariola8610 1268 6870 499573540.90Angel Kanamorimailto:Kanamori@telcordia.comhttp://www.telcordia.com/~Kanamori29Other56634.76Lai Greenwaldmailto:Greenwald@filelmaker.comhttp://www.filelmaker.com/~Greenwald9722 4263 8015 6083femaleCollege32788.80Mitchel Cunliffemailto:Cunliffe@dauphine.frhttp://www.dauphine.fr/~CunliffeCollege79398.49Remigijus Przuljmailto:Przulj@rwth-aachen.de44100064.62Oddvar Kamijomailto:Kamijo@ou.eduhttp://www.ou.edu/~Kamijo4434 7244 4200 8479Other69247.75Sanford Mergenmailto:Mergen@msstate.edumale32039.10Guanshan Keustermans5 Hazony StBudapestUnited Statesmailto:Keustermans@upenn.eduhttp://www.upenn.edu/~Keustermans7994 4699 1996 9940579876.00Mandayam Wittlichmailto:Wittlich@ogi.eduhttp://www.ogi.edu/~WittlichmaleGraduate School43412.47Mehrdad Ewards9 Mosedale StMumbaiUnited Statesmailto:Ewards@edu.hkhttp://www.edu.hk/~Ewards29College10406.64Mingzeng Uchoa76 Vongsathorn StAcapulcoUnited Statesmailto:Uchoa@baylor.edu8084 7023 9186 612839920.17Leslie Trystrammailto:Trystram@yahoo.commale4641437.21Chanderjit Takanomailto:Takano@savera.comhttp://www.savera.com/~Takano5097 6993 1970 6644male58High School53088.84Honglan Hagimontmailto:Hagimont@edu.auhttp://www.edu.au/~HagimontOther9876.00Tsunehiro Erdogan58 Tedijanto StCairoUnited Statesmailto:Erdogan@prc.com679876.00Mehrdad Holldobler38 Delaune StMontrealUnited Statesmailto:Holldobler@sunysb.edumale3318777.80Wil Herleymailto:Herley@brown.eduhttp://www.brown.edu/~Herley9077 3456 8000 1843female2425157.94Terrill Uchoamailto:Uchoa@co.inHigh School21237.58Masahito Bratsberg81 Nakatani StBamakoIvory Coastmailto:Bratsberg@savera.comhttp://www.savera.com/~Bratsbergfemale36High School37546.25Masali Ruedamailto:Rueda@cwi.nlhttp://www.cwi.nl/~Rueda7296 2605 7171 679818Graduate School61430.09Sabrina Blackallmailto:Blackall@poly.eduhttp://www.poly.edu/~Blackallcategory1male64243.77Huican Szmurlo52 Ternovskaia StCodyUnited Statesmailto:Szmurlo@ucsd.eduhttp://www.ucsd.edu/~Szmurlo2217 9440 7362 3405male38High School35391.33Samson Scopinich22 Luit StNassauLithuaniamailto:Scopinich@forth.grhttp://www.forth.gr/~Scopinich7744 1014 3146 57873960267.78Sahrah Takano64 Csaba StGuatemalaNepalmailto:Takano@concordia.cahttp://www.concordia.ca/~Takano5018437.40Vinot Thomsen2 Kishida StChattanoogaUnited Statesmailto:Thomsen@cornell.eduhttp://www.cornell.edu/~Thomsenfemale9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~KoszlajdafemaleCollege29478.84Panayotis Kuemmerlemailto:Kuemmerle@edu.sgfemale49245.92Yongjian Dechter88 Schwederski StGreatUnited Statesmailto:Dechter@ernet.in3385 8194 5484 2885female32High School47370.23Manish Jupinmailto:Jupin@uni-muenster.de18Graduate School41595.76Nevio Drashansky60 Petry StElUnited Statesmailto:Drashansky@evergreen.edu7712 4592 2474 5574High School27555.24Rosli Horndaschmailto:Horndasch@bell-labs.com1669 2715 2205 17462948525.86Jens Rodigermailto:Rodiger@uqam.cahttp://www.uqam.ca/~Rodiger7366 1702 9623 9871High School9876.00Guoping Ghazaliemailto:Ghazalie@sunysb.eduCollege9876.00Odoardo Rajaraman39 Backelin StVillahermosaUnited Statesmailto:Rajaraman@ul.pthttp://www.ul.pt/~RajaramanfemaleHigh School95732.32Hagen Artosimailto:Artosi@clustra.comhttp://www.clustra.com/~Artosi7136 1358 8743 5847High School32535.03Drago Showaltermailto:Showalter@auc.dkfemale17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edufemale2652187.04Bokyung Ranganath63 Lanteri StEvansvilleUnited Statesmailto:Ranganath@lante.com6624 8488 5785 495418Other9995.92Martial Chorvat65 Campadelli StMonterreyUnited Statesmailto:Chorvat@zambeel.com4079 3475 5627 8448maleCollege9876.00Asmus Hanekemailto:Haneke@unical.ithttp://www.unical.it/~Haneke6994 8976 8481 7963female34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 6298Other18748.51Honari Vendrig59 Dougherty StBolognaUnited Statesmailto:Vendrig@bell-labs.comhttp://www.bell-labs.com/~Vendrig9876.00Pragnesh Takanomailto:Takano@labs.comhttp://www.labs.com/~Takano8238 8564 3820 4678maleOther147002.31Nikolaos Birdsall20 Morillo StGrenadaUnited Statesmailto:Birdsall@clarkson.edu48128.34Martien Noortwijk25 Melski StProvidencialesUnited Statesmailto:Noortwijk@co.inhttp://www.co.in/~Noortwijk3902 2842 7544 649218High School47967.41Naoki Osterloh7 Ghandeharizadeh StCairoTanzaniamailto:Osterloh@ask.comhttp://www.ask.com/~Osterloh7741 8229 7494 1943female3889088.09Masamitsu Andaleonmailto:Andaleon@cti.grmaleGraduate School28135.59Arup Zhongxiumailto:Zhongxiu@savera.comhttp://www.savera.com/~Zhongxiu8907 5377 1768 2366female17100.56Kyosun Takanomailto:Takano@umb.eduhttp://www.umb.edu/~Takano4914 3209 2337 5612male5438040.25Mehrdad Dundas48 Junior StRoanokeUnited Statesmailto:Dundas@ac.ukmale88737.57Vanathi Takano39 Borowsky StIstanbulUnited Statesmailto:Takano@baylor.edu9748 8717 5684 699043968.43Hausi Henriksson11 Shiota StSeattleUnited Statesmailto:Henriksson@uqam.cahttp://www.uqam.ca/~Henriksson27Graduate School35214.05Tobias Veeraraghavan41 Cavedoni StAguascalientesUnited Statesmailto:Veeraraghavan@umb.edu8969 5456 9679 1336female21High School43968.24Yelena Takano10 Luit StAmarilloSaudi Arabiamailto:Takano@uga.edufemale2425157.94Terrill Uchoamailto:Uchoa@co.inmaleCollege79622.37Yehuda Benkahlamailto:Benkahla@ac.krhttp://www.ac.kr/~Benkahla4916 7773 2536 95043324186.28Marco Meszaros49 Wohn StKievSt. Vincent and Grenadinesmailto:Meszaros@ac.athttp://www.ac.at/~Meszaros6309 7243 2721 1636category20male64243.77Huican Szmurlo52 Ternovskaia StCodyUnited Statesmailto:Szmurlo@ucsd.eduhttp://www.ucsd.edu/~Szmurlo2217 9440 7362 340561161.12Shiby Ginneken58 Nisonger StNewcastleUnited Statesmailto:Ginneken@yorku.cahttp://www.yorku.ca/~Ginneken5020 5482 5482 35782870444.29Mountaz Ossenbruggenmailto:Ossenbruggen@whizbang.commale1857760.56Shinji Varhegyi60 Candan StDothanUnited Statesmailto:Varhegyi@forth.grhttp://www.forth.gr/~Varhegyi6982 5985 8455 837034541.24Emilo Schahnmailto:Schahn@filemaker.comhttp://www.filemaker.com/~Schahn5877 8225 7127 2717maleGraduate School47377.02Sanjai Dangedejmailto:Dangedej@unf.eduhttp://www.unf.edu/~Dangedej1212 9452 9839 41591834791.61Limor Schlichtermailto:Schlichter@dauphine.fr2262 3605 4735 3715female1866561.70Mara Tchuentemailto:Tchuente@telcordia.comhttp://www.telcordia.com/~TchuentemaleHigh School30401.42Yonghoan Baba95 Shioya StGuangzhouUnited Statesmailto:Baba@llnl.govfemale9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~KoszlajdafemaleGraduate School54668.95Joey Girouxmailto:Giroux@crossgain.comhttp://www.crossgain.com/~Giroux6425 5745 4662 172740268.84Zosimo Basmailto:Bas@uta.edu3953 1957 8995 9210maleGraduate School18103.99Raja Schroermailto:Schroer@ac.krfemaleCollege19207.80Bahaa Lortz24 Zaimov StAnchorageUnited Statesmailto:Lortz@toronto.edu1432 1375 9826 3007male72247.13Djordje Milesmailto:Miles@att.com4147 2060 2989 7208High School66838.04Claudine Mihalisinmailto:Mihalisin@cabofalso.comhttp://www.cabofalso.com/~Mihalisin6184 8660 1839 1662female29Other34068.64Katsumasa Takano61 Claudson StKilleenUnited Statesmailto:Takano@uni-mb.sihttp://www.uni-mb.si/~Takano9056 8763 7140 1944female62083.70Jaejin Hauswirth32 Zrehen StJacksonUnited Statesmailto:Hauswirth@pitt.eduhttp://www.pitt.edu/~Hauswirth6218 3179 2347 5721female3943323.95Mitsugu Thobenmailto:Thoben@sbphrd.com4537 1155 4156 6649femaleOther44792.93Hagbae Gershkovich62 Soinard StBrusselsAmerican Samoamailto:Gershkovich@llnl.govhttp://www.llnl.gov/~Gershkovich36Other62943.64Bartek Schumaker83 Kumaresan StLimaArgentinamailto:Schumaker@labs.comhttp://www.labs.com/~Schumaker3597 8655 2603 679761041.02Baruch Karcichmailto:Karcich@inria.frhttp://www.inria.fr/~Karcich28College22854.05Mas Bretthauermailto:Bretthauer@uu.se6903 3735 8900 1605male19764.36Jacky Kunieda31 Malabarba StGuaymasUnited Statesmailto:Kunieda@uni-mannheim.de4090 9244 8696 7598Other20588.39Elham Pelletreau10 Rodding StHermosilloQatarmailto:Pelletreau@ul.ptfemale17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edu18Other9995.92Martial Chorvat65 Campadelli StMonterreyUnited Statesmailto:Chorvat@zambeel.com4079 3475 5627 8448Other18748.51Honari Vendrig59 Dougherty StBolognaUnited Statesmailto:Vendrig@bell-labs.comhttp://www.bell-labs.com/~Vendrigfemale3192544.56Kalappa Melkman4 Bober StJohannesburgFrench Southern Territorymailto:Melkman@uu.sehttp://www.uu.se/~Melkmanfemale2933284.56Chams Michailidis11 Davoren StGainesvilleTanzaniamailto:Michailidis@ntua.grmale319876.00Gita Polstermailto:Polster@ask.comhttp://www.ask.com/~Polster43968.43Hausi Henriksson11 Shiota StSeattleUnited Statesmailto:Henriksson@uqam.cahttp://www.uqam.ca/~Henrikssonmale4641437.21Chanderjit Takanomailto:Takano@savera.comhttp://www.savera.com/~Takano5097 6993 1970 664442High School63869.30Waiman Sakomotomailto:Sakomoto@crossgain.comfemale55Other67566.93Tran Babayanmailto:Babayan@informix.commale1821628.35Mehrdad Granlund2 Huttel StMontgomeryUnited Statesmailto:Granlund@concentric.net6039 9126 8908 863453Graduate School33338.11Kwangjo Benainimailto:Benaini@uga.edu44103147.12Jamaludin Pigeot64 Gire StMonroeZambiamailto:Pigeot@toronto.eduhttp://www.toronto.edu/~Pigeot6115 7380 3797 5687category4male64243.77Huican Szmurlo52 Ternovskaia StCodyUnited Statesmailto:Szmurlo@ucsd.eduhttp://www.ucsd.edu/~Szmurlo2217 9440 7362 34052870444.29Mountaz Ossenbruggenmailto:Ossenbruggen@whizbang.commale2621142.02Elihu Lorys60 Jantke StGenevaUnited Statesmailto:Lorys@berkeley.eduhttp://www.berkeley.edu/~Lorys1834791.61Limor Schlichtermailto:Schlichter@dauphine.fr2262 3605 4735 3715female28College23070.82Hakim Savarammailto:Savaram@nyu.eduhttp://www.nyu.edu/~Savaramfemale29College109893.20Bevin Keustermans55 Kluthe StCharlestonUnited Statesmailto:Keustermans@cwru.edu55498.73Mehrdad Barroso23 Grabner StRapidUnited Statesmailto:Barroso@uwo.cafemale33532.36Ravindran Yacobi90 Cools StAlbanyLithuaniamailto:Yacobi@emc.comfemale9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~Koszlajda50Other55383.43Nidapan Stassinopoulosmailto:Stassinopoulos@lante.com59420.56Ziqiang Businaro21 Coatta StMontrealUnited Statesmailto:Businaro@indiana.eduhttp://www.indiana.edu/~Businaro1875013.99Filipe Pappasmailto:Pappas@ac.at5070 6126 9654 6995maleGraduate School18103.99Raja Schroermailto:Schroer@ac.krmale70373.08Mehrdad Sevcikovamailto:Sevcikova@sds.nohttp://www.sds.no/~Sevcikovamale3760708.89Nobuko Manara39 Pigeon StMontgomeryUnited Statesmailto:Manara@imag.frhttp://www.imag.fr/~Manara8751 5605 9270 8646femaleHigh School9901.94Kaisa McNaught60 Kader StButteUnited Statesmailto:McNaught@ufl.edu2948525.86Jens Rodigermailto:Rodiger@uqam.cahttp://www.uqam.ca/~Rodiger7366 1702 9623 9871College26548.80Martial Miaramailto:Miara@lante.comfemale3943323.95Mitsugu Thobenmailto:Thoben@sbphrd.com4537 1155 4156 6649female459876.00Mehrdad Apperley12 Vinar StBucharestUnited Statesmailto:Apperley@ibm.commale71019.05Ayakannu Stemannmailto:Stemann@unizh.ch25High School36970.64Elihu Salinasmailto:Salinas@ucdavis.eduhttp://www.ucdavis.edu/~Salinas1889413.77Rosalyn Borrowman71 Mekaouche StCasperUnited Statesmailto:Borrowman@panasonic.commaleCollege9876.00Asmus Hanekemailto:Haneke@unical.ithttp://www.unical.it/~Haneke6994 8976 8481 7963maleCollege62028.39Lucien Cunliffe11 Smotroff StMeridianVatican City Statemailto:Cunliffe@mit.edu2139 7205 4141 4885male18College44173.97Takaaki Carrick53 Blom StBrunswickUnited Statesmailto:Carrick@washington.eduhttp://www.washington.edu/~Carrick75125.30Randal Roushmailto:Roush@msstate.edu6224 7382 7689 8766Other18748.51Honari Vendrig59 Dougherty StBolognaUnited Statesmailto:Vendrig@bell-labs.comhttp://www.bell-labs.com/~Vendrigmale32039.10Guanshan Keustermans5 Hazony StBudapestUnited Statesmailto:Keustermans@upenn.eduhttp://www.upenn.edu/~Keustermans7994 4699 1996 9940female1848441.07Marleen Hancartmailto:Hancart@unical.it8644 5992 4180 8611female2933284.56Chams Michailidis11 Davoren StGainesvilleTanzaniamailto:Michailidis@ntua.gr42582.85Herb Heisermanmailto:Heiserman@gatech.edu1770 6901 9126 7641male319876.00Gita Polstermailto:Polster@ask.comhttp://www.ask.com/~Polsterfemale18High School32207.29Jessie Courymailto:Coury@computer.orghttp://www.computer.org/~Coury3948 9942 2047 3209maleOther9876.00Benny Maraist38 Coscoy StVeniceUnited Statesmailto:Maraist@acm.org1444 4160 5898 766831377.71Douadi Newton100 Deb StTexarkanaUnited Statesmailto:Newton@acm.org34College71769.15LuoQuan Takano94 Cejtlin StToulouseSomaliamailto:Takano@lbl.gov3815 2171 1002 1862female2425157.94Terrill Uchoamailto:Uchoa@co.in9876.00Bernd Kruschinski16 Dienes StChicagoUnited Statesmailto:Kruschinski@unizh.chhttp://www.unizh.ch/~Kruschinskimale259876.00Hava Sieglmailto:Siegl@sun.com46College9876.00Ennio Fanchon44 Beeferman StStockholmVatican City Statemailto:Fanchon@bellatlantic.nethttp://www.bellatlantic.net/~Fanchon18Graduate School61430.09Sabrina Blackallmailto:Blackall@poly.eduhttp://www.poly.edu/~Blackallcategory3female93942.48Abdelilah Chepyzhov93 Milgrom StHuntsvilleUnited Statesmailto:Chepyzhov@fsu.edu8729 1525 7474 9453female32289.52Lynne Chongmailto:Chong@brandeis.edu52743.14Angel McDermid56 Deves StStockholmUnited Statesmailto:McDermid@ucdavis.eduhttp://www.ucdavis.edu/~McDermidfemale21Graduate School34281.58Lilly Zuiderveld62 Lamma StElUnited Statesmailto:Zuiderveld@computer.orghttp://www.computer.org/~Zuiderveldmale4522589.34Noelle Ramrasmailto:Ramras@dauphine.frfemale20230.96Radhia Lakshmipathymailto:Lakshmipathy@clustra.comfemale3449147.80Frantisek Speltmailto:Spelt@versata.comhttp://www.versata.com/~Speltfemale21College20347.38Isamu Kupiecmailto:Kupiec@twsu.eduhttp://www.twsu.edu/~Kupiec6071 5377 9019 296340268.84Zosimo Basmailto:Bas@uta.edu3953 1957 8995 92101944492.43Sajoong Bottoni56 Isman StWashingtonUnited Statesmailto:Bottoni@ucsd.eduhttp://www.ucsd.edu/~Bottoni4979 4485 7219 1879High School66838.04Claudine Mihalisinmailto:Mihalisin@cabofalso.comhttp://www.cabofalso.com/~Mihalisin6184 8660 1839 166218Graduate School41595.76Nevio Drashansky60 Petry StElUnited Statesmailto:Drashansky@evergreen.edu7712 4592 2474 557418Graduate School30851.14LouAnn Mulvany13 Whitt StBarcelonaUnited Statesmailto:Mulvany@ucla.eduhttp://www.ucla.edu/~Mulvany6788 3544 7141 9025female29Other34068.64Katsumasa Takano61 Claudson StKilleenUnited Statesmailto:Takano@uni-mb.sihttp://www.uni-mb.si/~Takano9056 8763 7140 1944College26548.80Martial Miaramailto:Miara@lante.comfemale76520.37Yahui Tanemomailto:Tanemo@uqam.ca9174 1888 2967 7251femaleOther44792.93Hagbae Gershkovich62 Soinard StBrusselsAmerican Samoamailto:Gershkovich@llnl.govhttp://www.llnl.gov/~Gershkovichfemale29High School44522.39Rupal Takanomailto:Takano@conclusivestrategies.comHigh School48609.71Neelam Passafiumemailto:Passafiume@hitachi.comhttp://www.hitachi.com/~Passafiume2967 5196 1495 5214female19High School47409.99Wieb Baummailto:Baum@bell-labs.comhttp://www.bell-labs.com/~Baummale22Graduate School36448.54Alassane Brown19 Steingart StTallahasseeTurkeymailto:Brown@ac.be4583 2923 3450 38941889413.77Rosalyn Borrowman71 Mekaouche StCasperUnited Statesmailto:Borrowman@panasonic.com18Graduate School21774.64Odinaldo Couclelismailto:Couclelis@savera.com4312 2173 2656 5795female24High School53332.77Berardo Radwanmailto:Radwan@clarkson.eduhttp://www.clarkson.edu/~Radwan5362 4892 6180 7214maleCollege62028.39Lucien Cunliffe11 Smotroff StMeridianVatican City Statemailto:Cunliffe@mit.edu2139 7205 4141 4885male18College44173.97Takaaki Carrick53 Blom StBrunswickUnited Statesmailto:Carrick@washington.eduhttp://www.washington.edu/~CarrickHigh School12698.35Willemien Nollmann94 Finsterwalder StMinneapolisUnited Statesmailto:Nollmann@ucd.iehttp://www.ucd.ie/~Nollmann1120 5614 6835 1026Other18748.51Honari Vendrig59 Dougherty StBolognaUnited Statesmailto:Vendrig@bell-labs.comhttp://www.bell-labs.com/~VendrigmaleHigh School22127.36Yannik Hamblinmailto:Hamblin@cohera.commaleOther147002.31Nikolaos Birdsall20 Morillo StGrenadaUnited Statesmailto:Birdsall@clarkson.edumale32039.10Guanshan Keustermans5 Hazony StBudapestUnited Statesmailto:Keustermans@upenn.eduhttp://www.upenn.edu/~Keustermans7994 4699 1996 9940female1848441.07Marleen Hancartmailto:Hancart@unical.it8644 5992 4180 8611male25728.38Priyadarshan Burgert53 Liberman StCorpusReunionmailto:Burgert@savera.comhttp://www.savera.com/~BurgertmaleGraduate School43412.47Mehrdad Ewards9 Mosedale StMumbaiUnited Statesmailto:Ewards@edu.hkhttp://www.edu.hk/~Ewardsfemale319876.00Arvola Takanomailto:Takano@fernuni-hagen.demale5438040.25Mehrdad Dundas48 Junior StRoanokeUnited Statesmailto:Dundas@ac.ukfemale18129137.70Khedija Yonezawa57 Naixiao StToulouseChilemailto:Yonezawa@clustra.comhttp://www.clustra.com/~Yonezawa2333 2094 5586 4351male88737.57Vanathi Takano39 Borowsky StIstanbulUnited Statesmailto:Takano@baylor.edu9748 8717 5684 699043968.43Hausi Henriksson11 Shiota StSeattleUnited Statesmailto:Henriksson@uqam.cahttp://www.uqam.ca/~HenrikssonfemaleHigh School38558.87Samantha Lofgrenmailto:Lofgren@telcordia.comhttp://www.telcordia.com/~Lofgrenmale4641437.21Chanderjit Takanomailto:Takano@savera.comhttp://www.savera.com/~Takano5097 6993 1970 6644female1837579.45Lena Haworth55 Sanabria StMoscowUnited Statesmailto:Haworth@ac.behttp://www.ac.be/~Haworthfemale2425157.94Terrill Uchoamailto:Uchoa@co.inOther49831.44Shyam Taganskymailto:Tagansky@cwru.eduhttp://www.cwru.edu/~Taganskycategory5female93942.48Abdelilah Chepyzhov93 Milgrom StHuntsvilleUnited Statesmailto:Chepyzhov@fsu.edu8729 1525 7474 94532920536.39Marit Ozols39 Olivo StViennaUnited Statesmailto:Ozols@clarkson.eduhttp://www.clarkson.edu/~Ozols7994 7972 6209 7349male38High School35391.33Samson Scopinich22 Luit StNassauLithuaniamailto:Scopinich@forth.grhttp://www.forth.gr/~Scopinich7744 1014 3146 5787female21Graduate School34281.58Lilly Zuiderveld62 Lamma StElUnited Statesmailto:Zuiderveld@computer.orghttp://www.computer.org/~Zuiderveldmale2885711.23Maung Rainmailto:Rain@cas.czfemale9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~Koszlajda59420.56Ziqiang Businaro21 Coatta StMontrealUnited Statesmailto:Businaro@indiana.eduhttp://www.indiana.edu/~Businarofemale72664.29Celia Bahk32 Knauer StOuagadougouUnited Statesmailto:Bahk@fsu.eduhttp://www.fsu.edu/~Bahk1944492.43Sajoong Bottoni56 Isman StWashingtonUnited Statesmailto:Bottoni@ucsd.eduhttp://www.ucsd.edu/~Bottoni4979 4485 7219 187935Other95431.89Raimondas Holtmanmailto:Holtman@indiana.eduhttp://www.indiana.edu/~HoltmanmaleGraduate School9876.00Andreas Weijland80 Okasaki StBatonUnited Statesmailto:Weijland@conclusivestrategies.comhttp://www.conclusivestrategies.com/~Weijland59596.19Jurgen Desprez10 Jushchenko StHarrisburgUnited Statesmailto:Desprez@nyu.edu18Graduate School41595.76Nevio Drashansky60 Petry StElUnited Statesmailto:Drashansky@evergreen.edu7712 4592 2474 55742487581.80Kazuyo Mouzakismailto:Mouzakis@ucla.eduhttp://www.ucla.edu/~Mouzakis1208 4748 3095 6188High School27555.24Rosli Horndaschmailto:Horndasch@bell-labs.com1669 2715 2205 1746femaleHigh School9901.94Kaisa McNaught60 Kader StButteUnited Statesmailto:McNaught@ufl.edumale3727628.58Duri Allisonmailto:Allison@microsoft.comhttp://www.microsoft.com/~AllisonfemaleCollege52198.30Eleanna Loulerguemailto:Loulergue@imag.fr32College9876.00Lizya Takanomailto:Takano@sbphrd.comhttp://www.sbphrd.com/~Takano1201 1542 8852 7037male45College81262.14Changsik Demirozmailto:Demiroz@umd.edu2601 7963 2940 9617female76520.37Yahui Tanemomailto:Tanemo@uqam.ca9174 1888 2967 7251female17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edu1889413.77Rosalyn Borrowman71 Mekaouche StCasperUnited Statesmailto:Borrowman@panasonic.com30Graduate School46548.36Suneeta Baptiste47 Decugis StDurangoUnited Statesmailto:Baptiste@neu.edumaleCollege62028.39Lucien Cunliffe11 Smotroff StMeridianVatican City Statemailto:Cunliffe@mit.edu2139 7205 4141 4885female34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 6298Other18748.51Honari Vendrig59 Dougherty StBolognaUnited Statesmailto:Vendrig@bell-labs.comhttp://www.bell-labs.com/~Vendrig18High School47967.41Naoki Osterloh7 Ghandeharizadeh StCairoTanzaniamailto:Osterloh@ask.comhttp://www.ask.com/~Osterloh7741 8229 7494 1943male32039.10Guanshan Keustermans5 Hazony StBudapestUnited Statesmailto:Keustermans@upenn.eduhttp://www.upenn.edu/~Keustermans7994 4699 1996 9940maleGraduate School28135.59Arup Zhongxiumailto:Zhongxiu@savera.comhttp://www.savera.com/~Zhongxiu8907 5377 1768 2366female18Graduate School36875.04Vwani Guck59 Carapuca StTulsaUnited Statesmailto:Guck@ubs.comhttp://www.ubs.com/~Guck8540 5460 1107 6135male5438040.25Mehrdad Dundas48 Junior StRoanokeUnited Statesmailto:Dundas@ac.uk42582.85Herb Heisermanmailto:Heiserman@gatech.edu1770 6901 9126 764139920.17Leslie Trystrammailto:Trystram@yahoo.comfemale1837579.45Lena Haworth55 Sanabria StMoscowUnited Statesmailto:Haworth@ac.behttp://www.ac.be/~HaworthfemaleOther9876.00Ashish Rattanmailto:Rattan@hp.comhttp://www.hp.com/~Rattan32Graduate School21453.40Kyujin Thenmozhimailto:Thenmozhi@sbphrd.comhttp://www.sbphrd.com/~Thenmozhi5667 1325 6395 3905female2425157.94Terrill Uchoamailto:Uchoa@co.in28036.78Sadegh Borgelt96 Tapken StCopenhagenUnited Statesmailto:Borgelt@yahoo.comhttp://www.yahoo.com/~Borgelt3641 4212 4374 193053Graduate School33338.11Kwangjo Benainimailto:Benaini@uga.edu44103147.12Jamaludin Pigeot64 Gire StMonroeZambiamailto:Pigeot@toronto.eduhttp://www.toronto.edu/~Pigeot6115 7380 3797 5687female67651.65Yoshinari Rajamailto:Raja@nodak.eduhttp://www.nodak.edu/~Raja7807 3048 4554 4266category232920536.39Marit Ozols39 Olivo StViennaUnited Statesmailto:Ozols@clarkson.eduhttp://www.clarkson.edu/~Ozols7994 7972 6209 7349male14407.23Ljupco Cappello55 Lotkin StConakryBelgiummailto:Cappello@zambeel.comhttp://www.zambeel.com/~CappellofemaleOther40371.20Tonia Kamble69 Westby StAnchorageMyanmarmailto:Kamble@cmu.edu4335 3345 5137 36373210607.38Benedita Matternmailto:Mattern@evergreen.eduhttp://www.evergreen.edu/~Mattern3960267.78Sahrah Takano64 Csaba StGuatemalaNepalmailto:Takano@concordia.cahttp://www.concordia.ca/~Takano5018437.40Vinot Thomsen2 Kishida StChattanoogaUnited Statesmailto:Thomsen@cornell.eduhttp://www.cornell.edu/~Thomsen33857.61Kristof Pittmailto:Pitt@unf.edu6369 9760 9277 824755498.73Mehrdad Barroso23 Grabner StRapidUnited Statesmailto:Barroso@uwo.camale19High School38050.91Mauri Takanomailto:Takano@sbphrd.comhttp://www.sbphrd.com/~Takanomale34Graduate School9876.00Keijo Hmelo11 Dulong StGuatemalaNigermailto:Hmelo@cnr.ithttp://www.cnr.it/~Hmelo8292 3598 3299 9658female9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~KoszlajdafemaleGraduate School54668.95Joey Girouxmailto:Giroux@crossgain.comhttp://www.crossgain.com/~Giroux6425 5745 4662 172747Graduate School9876.00Ebbe Kawashima23 Rinn StHelenaUnited Statesmailto:Kawashima@gmu.edumale72247.13Djordje Milesmailto:Miles@att.com4147 2060 2989 7208Graduate School61917.13Isidore Takano32 Sambasivam StMinneapolisUnited Statesmailto:Takano@computer.orghttp://www.computer.org/~Takano9963 9779 2196 523218Graduate School41595.76Nevio Drashansky60 Petry StElUnited Statesmailto:Drashansky@evergreen.edu7712 4592 2474 5574femaleOther76543.02Arno Takano2 Jezioranski StAkronUnited Statesmailto:Takano@uwo.cahttp://www.uwo.ca/~Takano1059 2269 8254 7515459876.00Innes Ulfberg13 Kabat StSantiagoUnited Statesmailto:Ulfberg@propel.comhttp://www.propel.com/~UlfbergfemaleGraduate School56956.07Sukhmay Schwartzbauermailto:Schwartzbauer@purdue.edu4381 3385 4917 1280female3943323.95Mitsugu Thobenmailto:Thoben@sbphrd.com4537 1155 4156 6649High School48609.71Neelam Passafiumemailto:Passafiume@hitachi.comhttp://www.hitachi.com/~Passafiume2967 5196 1495 5214male19764.36Jacky Kunieda31 Malabarba StGuaymasUnited Statesmailto:Kunieda@uni-mannheim.de4090 9244 8696 7598female17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edufemale3550655.89Liujian Stanger11 Nollmann StKahuluiMayottemailto:Stanger@ubs.com1889413.77Rosalyn Borrowman71 Mekaouche StCasperUnited Statesmailto:Borrowman@panasonic.commaleCollege62028.39Lucien Cunliffe11 Smotroff StMeridianVatican City Statemailto:Cunliffe@mit.edu2139 7205 4141 4885male13990.17Faraz Kendallmailto:Kendall@ucf.eduhttp://www.ucf.edu/~Kendall5984 6936 6736 3854maleOther147002.31Nikolaos Birdsall20 Morillo StGrenadaUnited Statesmailto:Birdsall@clarkson.eduCollege79398.49Remigijus Przuljmailto:Przulj@rwth-aachen.demaleGraduate School48463.16Geraldine Relihan23 Meketon StKahuluiUnited Statesmailto:Relihan@toronto.eduhttp://www.toronto.edu/~Relihanmale32039.10Guanshan Keustermans5 Hazony StBudapestUnited Statesmailto:Keustermans@upenn.eduhttp://www.upenn.edu/~Keustermans7994 4699 1996 9940579876.00Mandayam Wittlichmailto:Wittlich@ogi.eduhttp://www.ogi.edu/~Wittlichfemale1848441.07Marleen Hancartmailto:Hancart@unical.it8644 5992 4180 8611Graduate School21339.80Vesna Stabell42 Trauth StPragueLatviamailto:Stabell@yahoo.comhttp://www.yahoo.com/~StabellfemaleCollege41385.84Xuejia Matternmailto:Mattern@sun.comhttp://www.sun.com/~Mattern5224 7860 2997 1000male88737.57Vanathi Takano39 Borowsky StIstanbulUnited Statesmailto:Takano@baylor.edu9748 8717 5684 6990High School44591.54Thyagaraju Papadias36 Razdan StProvidencialesUnited Statesmailto:Papadias@uni-mb.si9846 8257 2339 2353male319876.00Gita Polstermailto:Polster@ask.comhttp://www.ask.com/~Polsterfemale53Other9876.00Michaela DeMori24 Schmidmaier StLaUnited Statesmailto:DeMori@mit.eduhttp://www.mit.edu/~DeMoriGraduate School86363.75Sinisa Takano20 Philipose StBaselUnited Statesmailto:Takano@uwo.cahttp://www.uwo.ca/~Takano2838 1561 4278 7793male34Other41124.07Hongsheng Marrakchimailto:Marrakchi@edu.au4697 8715 7524 368734032.09Francesca Weismantelmailto:Weismantel@ucla.edu2763 1794 7943 475331109.71Stefano Veselmailto:Vesel@hp.commale18High School11680.33Hairuo Babymailto:Baby@compaq.comhttp://www.compaq.com/~Baby5040 8822 2575 9695College9876.00Siau Luskmailto:Lusk@dauphine.frhttp://www.dauphine.fr/~Lusk9351 9086 1389 9982female36High School37546.25Masali Ruedamailto:Rueda@cwi.nlhttp://www.cwi.nl/~Rueda7296 2605 7171 67983324186.28Marco Meszaros49 Wohn StKievSt. Vincent and Grenadinesmailto:Meszaros@ac.athttp://www.ac.at/~Meszaros6309 7243 2721 1636category212870444.29Mountaz Ossenbruggenmailto:Ossenbruggen@whizbang.com52743.14Angel McDermid56 Deves StStockholmUnited Statesmailto:McDermid@ucdavis.eduhttp://www.ucdavis.edu/~McDermid3831289.78Yongqiao Shanbhoguemailto:Shanbhogue@newpaltz.edufemale3949111.85Mohammad Varker71 Linzer StLomeUnited Statesmailto:Varker@panasonic.com2868050.59Rogerio Kuemmerle97 McAfee StStockholmUnited Statesmailto:Kuemmerle@njit.edu4349 1772 6659 5801female1866561.70Mara Tchuentemailto:Tchuente@telcordia.comhttp://www.telcordia.com/~Tchuentefemale29College109893.20Bevin Keustermans55 Kluthe StCharlestonUnited Statesmailto:Keustermans@cwru.edu5018437.40Vinot Thomsen2 Kishida StChattanoogaUnited Statesmailto:Thomsen@cornell.eduhttp://www.cornell.edu/~Thomsenfemale18Other50634.45Sidd Zfiramailto:Zfira@uga.eduhttp://www.uga.edu/~ZfiramaleHigh School29348.51Yael Ritceymailto:Ritcey@csufresno.eduhttp://www.csufresno.edu/~Ritcey4175 3581 3728 5320femaleGraduate School54668.95Joey Girouxmailto:Giroux@crossgain.comhttp://www.crossgain.com/~Giroux6425 5745 4662 1727College106547.20Khatoun Rankamailto:Ranka@clarkson.eduhttp://www.clarkson.edu/~RankafemaleOther44792.93Hagbae Gershkovich62 Soinard StBrusselsAmerican Samoamailto:Gershkovich@llnl.govhttp://www.llnl.gov/~Gershkovichfemale29High School44522.39Rupal Takanomailto:Takano@conclusivestrategies.comHigh School32535.03Drago Showaltermailto:Showalter@auc.dkfemale56Graduate School9876.00Ardaman Underwood6 Anrig StBerlinUnited Statesmailto:Underwood@ucdavis.edu25High School36970.64Elihu Salinasmailto:Salinas@ucdavis.eduhttp://www.ucdavis.edu/~SalinasOther20588.39Elham Pelletreau10 Rodding StHermosilloQatarmailto:Pelletreau@ul.ptfemale17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.eduCollege20705.54Jianli Gide15 Bergevin StToledoUnited Statesmailto:Gide@fsu.eduhttp://www.fsu.edu/~Gide6804 8139 3232 3580maleHigh School61094.02Mehrdad Bierbaum77 Heyderhoff StIdahoUnited Statesmailto:Bierbaum@sdsc.edu5223 3221 1166 7010female34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 629830College9876.00Asha Dumasmailto:Dumas@twsu.edufemale3889088.09Masamitsu Andaleonmailto:Andaleon@cti.grmale25728.38Priyadarshan Burgert53 Liberman StCorpusReunionmailto:Burgert@savera.comhttp://www.savera.com/~Burgertmale88737.57Vanathi Takano39 Borowsky StIstanbulUnited Statesmailto:Takano@baylor.edu9748 8717 5684 699043968.43Hausi Henriksson11 Shiota StSeattleUnited Statesmailto:Henriksson@uqam.cahttp://www.uqam.ca/~HenrikssonOther9876.00Tsunehiro Erdogan58 Tedijanto StCairoUnited Statesmailto:Erdogan@prc.comfemaleCollege18089.31Newton Geibel55 McKinley StWestUnited Statesmailto:Geibel@lbl.gov6955 5513 9649 3373female2425157.94Terrill Uchoamailto:Uchoa@co.in28036.78Sadegh Borgelt96 Tapken StCopenhagenUnited Statesmailto:Borgelt@yahoo.comhttp://www.yahoo.com/~Borgelt3641 4212 4374 1930College9876.00Siau Luskmailto:Lusk@dauphine.frhttp://www.dauphine.fr/~Lusk9351 9086 1389 998241High School90426.38Nieves Wicklinemailto:Wickline@oracle.com1216 7004 4794 4730female67651.65Yoshinari Rajamailto:Raja@nodak.eduhttp://www.nodak.edu/~Raja7807 3048 4554 4266category162870444.29Mountaz Ossenbruggenmailto:Ossenbruggen@whizbang.comfemale32289.52Lynne Chongmailto:Chong@brandeis.edumale4522589.34Noelle Ramrasmailto:Ramras@dauphine.fr26770.70Fun Lattin93 Mutschke StPascoUnited Statesmailto:Lattin@forth.grhttp://www.forth.gr/~Lattin3364225.11Arjen Emden44 Goos StLexingtonUnited Statesmailto:Emden@forwiss.dehttp://www.forwiss.de/~Emden2468 4642 9646 5367female28College23070.82Hakim Savarammailto:Savaram@nyu.eduhttp://www.nyu.edu/~SavarammaleHigh School30401.42Yonghoan Baba95 Shioya StGuangzhouUnited Statesmailto:Baba@llnl.gov3960267.78Sahrah Takano64 Csaba StGuatemalaNepalmailto:Takano@concordia.cahttp://www.concordia.ca/~Takanofemale9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~Koszlajdafemale21College20347.38Isamu Kupiecmailto:Kupiec@twsu.eduhttp://www.twsu.edu/~Kupiec6071 5377 9019 2963High School41734.15Jago Mayerwiesermailto:Mayerwieser@arizona.edu1875013.99Filipe Pappasmailto:Pappas@ac.at5070 6126 9654 6995female49245.92Yongjian Dechter88 Schwederski StGreatUnited Statesmailto:Dechter@ernet.in3385 8194 5484 2885male72247.13Djordje Milesmailto:Miles@att.com4147 2060 2989 7208female46814.24Keumog Gellerich43 Gove StGenevaKenyamailto:Gellerich@ab.caCollege26548.80Martial Miaramailto:Miara@lante.commale22Graduate School36448.54Alassane Brown19 Steingart StTallahasseeTurkeymailto:Brown@ac.be4583 2923 3450 389424College44907.27Chinya Uludagmailto:Uludag@airmail.netfemale17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edufemale24High School53332.77Berardo Radwanmailto:Radwan@clarkson.eduhttp://www.clarkson.edu/~Radwan5362 4892 6180 72142739491.29Hideo Korachmailto:Korach@cas.czhttp://www.cas.cz/~Korach8091 7556 8996 4369maleCollege9876.00Asmus Hanekemailto:Haneke@unical.ithttp://www.unical.it/~Haneke6994 8976 8481 7963Other18748.51Honari Vendrig59 Dougherty StBolognaUnited Statesmailto:Vendrig@bell-labs.comhttp://www.bell-labs.com/~Vendrig56Other9876.00Magy Yuval52 Penniman StDothanUnited Statesmailto:Yuval@sds.nohttp://www.sds.no/~Yuval6960 5979 2083 3011maleOther147002.31Nikolaos Birdsall20 Morillo StGrenadaUnited Statesmailto:Birdsall@clarkson.edu29Other56634.76Lai Greenwaldmailto:Greenwald@filelmaker.comhttp://www.filelmaker.com/~Greenwald9722 4263 8015 6083female19Graduate School17213.74Murthy Kobsa3 Marefat StFortalezaUnited Statesmailto:Kobsa@cmu.eduhttp://www.cmu.edu/~Kobsa9601 9505 5627 9097female31313.14Upendra Sueyoshi100 Iwayama StPensacolaUnited Statesmailto:Sueyoshi@msstate.edufemale18129137.70Khedija Yonezawa57 Naixiao StToulouseChilemailto:Yonezawa@clustra.comhttp://www.clustra.com/~Yonezawa2333 2094 5586 4351femaleOther9876.00Mehrdad Osgood18 Bias StRoanokePortugalmailto:Osgood@gte.comhttp://www.gte.com/~Osgood39920.17Leslie Trystrammailto:Trystram@yahoo.commale58High School53088.84Honglan Hagimontmailto:Hagimont@edu.auhttp://www.edu.au/~HagimontGraduate School52300.25Berto Parisi18 Cagley StColumbusTaiwanmailto:Parisi@sfu.cahttp://www.sfu.ca/~Parisi2059 3864 2375 2974female2425157.94Terrill Uchoamailto:Uchoa@co.infemale4430932.28Mingzeng Fanchonmailto:Fanchon@ucsb.eduhttp://www.ucsb.edu/~Fanchon2370 1296 2256 476935High School104197.29Arne Ohori80 Belleghem StManchesterUnited Statesmailto:Ohori@concordia.ca5057 7242 3265 136041High School90426.38Nieves Wicklinemailto:Wickline@oracle.com1216 7004 4794 4730female61896.87Gor Pratimailto:Prati@uni-muenchen.decategory72870444.29Mountaz Ossenbruggenmailto:Ossenbruggen@whizbang.comfemale21Graduate School34281.58Lilly Zuiderveld62 Lamma StElUnited Statesmailto:Zuiderveld@computer.orghttp://www.computer.org/~Zuiderveldfemale1866561.70Mara Tchuentemailto:Tchuente@telcordia.comhttp://www.telcordia.com/~Tchuente18High School9876.00Avshalom Attimonellimailto:Attimonelli@uic.eduhttp://www.uic.edu/~Attimonelli7686 9066 7885 140955498.73Mehrdad Barroso23 Grabner StRapidUnited Statesmailto:Barroso@uwo.camale19High School38050.91Mauri Takanomailto:Takano@sbphrd.comhttp://www.sbphrd.com/~Takano49Graduate School71359.18Felip Fujisakimailto:Fujisaki@itc.itGraduate School9876.00Kristof Grafe94 Ingolfsdottir StCopenhagenZimbabwemailto:Grafe@lante.comhttp://www.lante.com/~Grafe47Graduate School9876.00Ebbe Kawashima23 Rinn StHelenaUnited Statesmailto:Kawashima@gmu.edumale70373.08Mehrdad Sevcikovamailto:Sevcikova@sds.nohttp://www.sds.no/~Sevcikovamale4262287.09Suvo Fiutem69 Luff StWindhoekSouth Africamailto:Fiutem@co.jp5089 1407 5205 5391female32High School47370.23Manish Jupinmailto:Jupin@uni-muenster.de35Other95431.89Raimondas Holtmanmailto:Holtman@indiana.eduhttp://www.indiana.edu/~Holtman18Graduate School41595.76Nevio Drashansky60 Petry StElUnited Statesmailto:Drashansky@evergreen.edu7712 4592 2474 5574male36Other46000.68Sudip Rekhtermailto:Rekhter@cas.cz4959 8573 1371 956729College85365.36Sushant Baransky39 Varpaaniemi StChicagoZambiamailto:Baransky@du.edufemaleOther44792.93Hagbae Gershkovich62 Soinard StBrusselsAmerican Samoamailto:Gershkovich@llnl.govhttp://www.llnl.gov/~Gershkovichfemale29High School44522.39Rupal Takanomailto:Takano@conclusivestrategies.comfemale17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edumaleCollege9876.00Asmus Hanekemailto:Haneke@unical.ithttp://www.unical.it/~Haneke6994 8976 8481 7963maleHigh School61094.02Mehrdad Bierbaum77 Heyderhoff StIdahoUnited Statesmailto:Bierbaum@sdsc.edu5223 3221 1166 7010female34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 62983963067.83Beshir Takano65 Lackinger StBostonUnited Statesmailto:Takano@edu.cnhttp://www.edu.cn/~TakanoOther18748.51Honari Vendrig59 Dougherty StBolognaUnited Statesmailto:Vendrig@bell-labs.comhttp://www.bell-labs.com/~VendrigOther12631.68Jawed Grundmannmailto:Grundmann@purdue.edu29Other56634.76Lai Greenwaldmailto:Greenwald@filelmaker.comhttp://www.filelmaker.com/~Greenwald9722 4263 8015 608351Other23226.04Yoshiki Blumbergmailto:Blumberg@ask.com2926 2408 8275 2143male32039.10Guanshan Keustermans5 Hazony StBudapestUnited Statesmailto:Keustermans@upenn.eduhttp://www.upenn.edu/~Keustermans7994 4699 1996 9940female31313.14Upendra Sueyoshi100 Iwayama StPensacolaUnited Statesmailto:Sueyoshi@msstate.edumale189876.00Ruben Paczkowski42 Osmani StKievUnited Statesmailto:Paczkowski@ac.jphttp://www.ac.jp/~Paczkowski5171 8849 3355 1220femaleHigh School27442.54Linore Pradomailto:Prado@uta.edu3098 3930 3792 434939920.17Leslie Trystrammailto:Trystram@yahoo.comfemaleHigh School38558.87Samantha Lofgrenmailto:Lofgren@telcordia.comhttp://www.telcordia.com/~Lofgrenfemale2425157.94Terrill Uchoamailto:Uchoa@co.in46College9876.00Ennio Fanchon44 Beeferman StStockholmVatican City Statemailto:Fanchon@bellatlantic.nethttp://www.bellatlantic.net/~Fanchonfemale24Graduate School50690.73Tevfik Shumilov79 Nisiyama StCincinnatiUnited Statesmailto:Shumilov@ou.edu7217 8872 1602 1967category12male1857760.56Shinji Varhegyi60 Candan StDothanUnited Statesmailto:Varhegyi@forth.grhttp://www.forth.gr/~Varhegyi6982 5985 8455 837026770.70Fun Lattin93 Mutschke StPascoUnited Statesmailto:Lattin@forth.grhttp://www.forth.gr/~Lattinfemale1866561.70Mara Tchuentemailto:Tchuente@telcordia.comhttp://www.telcordia.com/~Tchuentefemale9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~Koszlajda59420.56Ziqiang Businaro21 Coatta StMontrealUnited Statesmailto:Businaro@indiana.eduhttp://www.indiana.edu/~BusinaroCollege106547.20Khatoun Rankamailto:Ranka@clarkson.eduhttp://www.clarkson.edu/~Rankamale70373.08Mehrdad Sevcikovamailto:Sevcikova@sds.nohttp://www.sds.no/~Sevcikovafemale49245.92Yongjian Dechter88 Schwederski StGreatUnited Statesmailto:Dechter@ernet.in3385 8194 5484 2885male72247.13Djordje Milesmailto:Miles@att.com4147 2060 2989 7208High School27555.24Rosli Horndaschmailto:Horndasch@bell-labs.com1669 2715 2205 1746femaleCollege52198.30Eleanna Loulerguemailto:Loulergue@imag.frCollege9876.00Odoardo Rajaraman39 Backelin StVillahermosaUnited Statesmailto:Rajaraman@ul.pthttp://www.ul.pt/~RajaramanCollege26548.80Martial Miaramailto:Miara@lante.comfemale29High School44522.39Rupal Takanomailto:Takano@conclusivestrategies.commale19764.36Jacky Kunieda31 Malabarba StGuaymasUnited Statesmailto:Kunieda@uni-mannheim.de4090 9244 8696 7598female56Graduate School9876.00Ardaman Underwood6 Anrig StBerlinUnited Statesmailto:Underwood@ucdavis.edu189876.00Mehrdad Rivenburgh86 Stepanov StCincinnatiUnited Statesmailto:Rivenburgh@ac.krGraduate School9876.00Zerksis Bustard80 Lodder StWarsawIraqmailto:Bustard@duke.eduhttp://www.duke.edu/~BustardmaleCollege62028.39Lucien Cunliffe11 Smotroff StMeridianVatican City Statemailto:Cunliffe@mit.edu2139 7205 4141 4885female34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 629830College9876.00Asha Dumasmailto:Dumas@twsu.edumaleOther147002.31Nikolaos Birdsall20 Morillo StGrenadaUnited Statesmailto:Birdsall@clarkson.edu51Other23226.04Yoshiki Blumbergmailto:Blumberg@ask.com2926 2408 8275 2143female3889088.09Masamitsu Andaleonmailto:Andaleon@cti.grmale32039.10Guanshan Keustermans5 Hazony StBudapestUnited Statesmailto:Keustermans@upenn.eduhttp://www.upenn.edu/~Keustermans7994 4699 1996 9940femaleHigh School27442.54Linore Pradomailto:Prado@uta.edu3098 3930 3792 434939920.17Leslie Trystrammailto:Trystram@yahoo.com9876.00Dhritiman Schapiremailto:Schapire@ucd.iehttp://www.ucd.ie/~Schapire7089 9225 8648 445731377.71Douadi Newton100 Deb StTexarkanaUnited Statesmailto:Newton@acm.org34College71769.15LuoQuan Takano94 Cejtlin StToulouseSomaliamailto:Takano@lbl.gov3815 2171 1002 1862female2425157.94Terrill Uchoamailto:Uchoa@co.in46College9876.00Ennio Fanchon44 Beeferman StStockholmVatican City Statemailto:Fanchon@bellatlantic.nethttp://www.bellatlantic.net/~Fanchon35High School104197.29Arne Ohori80 Belleghem StManchesterUnited Statesmailto:Ohori@concordia.ca5057 7242 3265 1360category26Other9876.00Bharadwaj Nozawa58 Regoli StWarsawUnited Statesmailto:Nozawa@cas.czhttp://www.cas.cz/~Nozawa3284 7939 4808 3523male3141827.28Chunming Purvy17 Cin StOrangeUnited Statesmailto:Purvy@uwo.ca4356 3148 2060 9632male479876.00Zeljko Wolford13 Leaver StWorcesterUnited Statesmailto:Wolford@umd.eduhttp://www.umd.edu/~Wolfordfemale29College109893.20Bevin Keustermans55 Kluthe StCharlestonUnited Statesmailto:Keustermans@cwru.edu5018437.40Vinot Thomsen2 Kishida StChattanoogaUnited Statesmailto:Thomsen@cornell.eduhttp://www.cornell.edu/~Thomsenfemale33532.36Ravindran Yacobi90 Cools StAlbanyLithuaniamailto:Yacobi@emc.com49Graduate School71359.18Felip Fujisakimailto:Fujisaki@itc.itGraduate School9876.00Kristof Grafe94 Ingolfsdottir StCopenhagenZimbabwemailto:Grafe@lante.comhttp://www.lante.com/~GrafefemaleGraduate School54668.95Joey Girouxmailto:Giroux@crossgain.comhttp://www.crossgain.com/~Giroux6425 5745 4662 172718Graduate School41595.76Nevio Drashansky60 Petry StElUnited Statesmailto:Drashansky@evergreen.edu7712 4592 2474 5574femaleHigh School9901.94Kaisa McNaught60 Kader StButteUnited Statesmailto:McNaught@ufl.edufemale46814.24Keumog Gellerich43 Gove StGenevaKenyamailto:Gellerich@ab.caCollege26548.80Martial Miaramailto:Miara@lante.commale22Graduate School36448.54Alassane Brown19 Steingart StTallahasseeTurkeymailto:Brown@ac.be4583 2923 3450 3894female17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edu18Graduate School21774.64Odinaldo Couclelismailto:Couclelis@savera.com4312 2173 2656 5795male18College44173.97Takaaki Carrick53 Blom StBrunswickUnited Statesmailto:Carrick@washington.eduhttp://www.washington.edu/~Carrickfemale34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 629875125.30Randal Roushmailto:Roush@msstate.edu6224 7382 7689 8766Other21142.54Sueli Heinisuomailto:Heinisuo@uic.edufemale209876.00Alban Kossowskimailto:Kossowski@emc.com2606 3971 1356 1048College79398.49Remigijus Przuljmailto:Przulj@rwth-aachen.de26419.07Yukata Beauducel47 Araya StCharlottesvilleUnited Statesmailto:Beauducel@poznan.plhttp://www.poznan.pl/~Beauducel7393 8354 9466 4534femaleOther63285.36Roseane Henton21 Falkerngerg StArubaUnited Statesmailto:Henton@csufresno.eduhttp://www.csufresno.edu/~Hentonmale88737.57Vanathi Takano39 Borowsky StIstanbulUnited Statesmailto:Takano@baylor.edu9748 8717 5684 69901867501.36Terunao Veccia53 Brightwell StToulouseHondurasmailto:Veccia@sbphrd.comGraduate School34738.51Singaravel Skurczynski41 Zhongxiu StPortlandSwitzerlandmailto:Skurczynski@ntua.grhttp://www.ntua.gr/~Skurczynski9876.00Dhritiman Schapiremailto:Schapire@ucd.iehttp://www.ucd.ie/~Schapire7089 9225 8648 4457male26College9876.00Tru Feldmeier21 Poujol StSacramentoUnited Statesmailto:Feldmeier@unf.edu5066 9195 3036 1472female24828.93Bhabani Sawaya81 Cowan StNashvilleUnited Statesmailto:Sawaya@yahoo.comcategory2234541.24Emilo Schahnmailto:Schahn@filemaker.comhttp://www.filemaker.com/~Schahn5877 8225 7127 271734High School9876.00Fazli Elsanadidimailto:Elsanadidi@memphis.eduhttp://www.memphis.edu/~Elsanadidi3924 1056 9280 8856male4522589.34Noelle Ramrasmailto:Ramras@dauphine.fr26770.70Fun Lattin93 Mutschke StPascoUnited Statesmailto:Lattin@forth.grhttp://www.forth.gr/~Lattinfemale63Other71946.13Herbert Kleiser100 Raghavendra StGeorgeUnited Statesmailto:Kleiser@washington.eduhttp://www.washington.edu/~Kleiser4454 8668 5057 1574female1866561.70Mara Tchuentemailto:Tchuente@telcordia.comhttp://www.telcordia.com/~Tchuentefemale28College23070.82Hakim Savarammailto:Savaram@nyu.eduhttp://www.nyu.edu/~SavarammaleHigh School30401.42Yonghoan Baba95 Shioya StGuangzhouUnited Statesmailto:Baba@llnl.gov5018437.40Vinot Thomsen2 Kishida StChattanoogaUnited Statesmailto:Thomsen@cornell.eduhttp://www.cornell.edu/~Thomsen33857.61Kristof Pittmailto:Pitt@unf.edu6369 9760 9277 824755498.73Mehrdad Barroso23 Grabner StRapidUnited Statesmailto:Barroso@uwo.ca32165.04Margrethe Dowellmailto:Dowell@brandeis.eduGraduate School9876.00Kristof Grafe94 Ingolfsdottir StCopenhagenZimbabwemailto:Grafe@lante.comhttp://www.lante.com/~Grafe47Graduate School9876.00Ebbe Kawashima23 Rinn StHelenaUnited Statesmailto:Kawashima@gmu.edumaleGraduate School18103.99Raja Schroermailto:Schroer@ac.krfemale46814.24Keumog Gellerich43 Gove StGenevaKenyamailto:Gellerich@ab.cafemaleGraduate School56956.07Sukhmay Schwartzbauermailto:Schwartzbauer@purdue.edu4381 3385 4917 1280femaleHigh School95732.32Hagen Artosimailto:Artosi@clustra.comhttp://www.clustra.com/~Artosi7136 1358 8743 584729603.62Shreesh Atchley20 Guaiana StSyracuseIrelandmailto:Atchley@edu.cn3623 8474 9910 8198Other20588.39Elham Pelletreau10 Rodding StHermosilloQatarmailto:Pelletreau@ul.ptfemale17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edu1889413.77Rosalyn Borrowman71 Mekaouche StCasperUnited Statesmailto:Borrowman@panasonic.comfemale24High School53332.77Berardo Radwanmailto:Radwan@clarkson.eduhttp://www.clarkson.edu/~Radwan5362 4892 6180 72149876.00Pragnesh Takanomailto:Takano@labs.comhttp://www.labs.com/~Takano8238 8564 3820 467856Other9876.00Magy Yuval52 Penniman StDothanUnited Statesmailto:Yuval@sds.nohttp://www.sds.no/~Yuval6960 5979 2083 3011female9876.00Hichem Galianamailto:Galiana@ust.hk51Other23226.04Yoshiki Blumbergmailto:Blumberg@ask.com2926 2408 8275 2143female17100.56Kyosun Takanomailto:Takano@umb.eduhttp://www.umb.edu/~Takano4914 3209 2337 5612female19Graduate School17213.74Murthy Kobsa3 Marefat StFortalezaUnited Statesmailto:Kobsa@cmu.eduhttp://www.cmu.edu/~Kobsa9601 9505 5627 909718Graduate School45123.63Radhia Tamches63 Kitano StHonoluluUnited Statesmailto:Tamches@uni-trier.dehttp://www.uni-trier.de/~Tamches6565 7684 2833 7108male45100.26Knuth Grandbois27 Newton StBudapestUnited Statesmailto:Grandbois@ibm.com3277 5711 2104 1479femaleOther9876.00Mehrdad Osgood18 Bias StRoanokePortugalmailto:Osgood@gte.comhttp://www.gte.com/~Osgoodmale319876.00Gita Polstermailto:Polster@ask.comhttp://www.ask.com/~Polster1867501.36Terunao Veccia53 Brightwell StToulouseHondurasmailto:Veccia@sbphrd.commale4641437.21Chanderjit Takanomailto:Takano@savera.comhttp://www.savera.com/~Takano5097 6993 1970 6644679876.00Mehrdad Holldobler38 Delaune StMontrealUnited Statesmailto:Holldobler@sunysb.edumale3318777.80Wil Herleymailto:Herley@brown.eduhttp://www.brown.edu/~Herley9077 3456 8000 1843femaleCollege18089.31Newton Geibel55 McKinley StWestUnited Statesmailto:Geibel@lbl.gov6955 5513 9649 3373female2425157.94Terrill Uchoamailto:Uchoa@co.in35High School104197.29Arne Ohori80 Belleghem StManchesterUnited Statesmailto:Ohori@concordia.ca5057 7242 3265 1360female24Graduate School50690.73Tevfik Shumilov79 Nisiyama StCincinnatiUnited Statesmailto:Shumilov@ou.edu7217 8872 1602 19673324186.28Marco Meszaros49 Wohn StKievSt. Vincent and Grenadinesmailto:Meszaros@ac.athttp://www.ac.at/~Meszaros6309 7243 2721 1636category9male2885711.23Maung Rainmailto:Rain@cas.cz1834791.61Limor Schlichtermailto:Schlichter@dauphine.fr2262 3605 4735 3715female1866561.70Mara Tchuentemailto:Tchuente@telcordia.comhttp://www.telcordia.com/~Tchuentefemale29College109893.20Bevin Keustermans55 Kluthe StCharlestonUnited Statesmailto:Keustermans@cwru.edufemale33532.36Ravindran Yacobi90 Cools StAlbanyLithuaniamailto:Yacobi@emc.com49Graduate School71359.18Felip Fujisakimailto:Fujisaki@itc.itfemale9876.00Mehrdad Koszlajdamailto:Koszlajda@inria.frhttp://www.inria.fr/~Koszlajda32165.04Margrethe Dowellmailto:Dowell@brandeis.eduGraduate School9876.00Kristof Grafe94 Ingolfsdottir StCopenhagenZimbabwemailto:Grafe@lante.comhttp://www.lante.com/~GrafefemaleGraduate School54668.95Joey Girouxmailto:Giroux@crossgain.comhttp://www.crossgain.com/~Giroux6425 5745 4662 1727male189876.00Bala Hellwagnermailto:Hellwagner@uta.eduhttp://www.uta.edu/~Hellwagner3122 2389 9697 9706female80670.94Shiquan Wixonmailto:Wixon@pi.it38Graduate School88176.71Asaf Lucio10 Pinkas StBrusselsUnited Statesmailto:Lucio@intersys.comhttp://www.intersys.com/~Lucio5868 1339 2892 761368416.39Fazli Nocettimailto:Nocetti@rutgers.edu5986 2877 5306 19542487581.80Kazuyo Mouzakismailto:Mouzakis@ucla.eduhttp://www.ucla.edu/~Mouzakis1208 4748 3095 6188male3727628.58Duri Allisonmailto:Allison@microsoft.comhttp://www.microsoft.com/~Allisonfemale46814.24Keumog Gellerich43 Gove StGenevaKenyamailto:Gellerich@ab.caCollege26548.80Martial Miaramailto:Miara@lante.comfemale3943323.95Mitsugu Thobenmailto:Thoben@sbphrd.com4537 1155 4156 6649female76520.37Yahui Tanemomailto:Tanemo@uqam.ca9174 1888 2967 7251femaleOther44792.93Hagbae Gershkovich62 Soinard StBrusselsAmerican Samoamailto:Gershkovich@llnl.govhttp://www.llnl.gov/~Gershkovichfemale19High School47409.99Wieb Baummailto:Baum@bell-labs.comhttp://www.bell-labs.com/~Baum25High School36970.64Elihu Salinasmailto:Salinas@ucdavis.eduhttp://www.ucdavis.edu/~Salinasfemale17088.62Zicheng Raupp43 Clarke StTriUnited Statesmailto:Raupp@umd.edu1889413.77Rosalyn Borrowman71 Mekaouche StCasperUnited Statesmailto:Borrowman@panasonic.comCollege20705.54Jianli Gide15 Bergevin StToledoUnited Statesmailto:Gide@fsu.eduhttp://www.fsu.edu/~Gide6804 8139 3232 35802739491.29Hideo Korachmailto:Korach@cas.czhttp://www.cas.cz/~Korach8091 7556 8996 4369maleCollege62028.39Lucien Cunliffe11 Smotroff StMeridianVatican City Statemailto:Cunliffe@mit.edu2139 7205 4141 4885female34591.18Roar Tepfenhart14 Marinissen StGuangzhouUnited Statesmailto:Tepfenhart@duke.eduhttp://www.duke.edu/~Tepfenhart1685 4065 5136 629818High School47967.41Naoki Osterloh7 Ghandeharizadeh StCairoTanzaniamailto:Osterloh@ask.comhttp://www.ask.com/~Osterloh7741 8229 7494 194329Other56634.76Lai Greenwaldmailto:Greenwald@filelmaker.comhttp://www.filelmaker.com/~Greenwald9722 4263 8015 6083maleGraduate School48463.16Geraldine Relihan23 Meketon StKahuluiUnited Statesmailto:Relihan@toronto.eduhttp://www.toronto.edu/~Relihanmale3959387.85Allison Balazsmailto:Balazs@ibm.comhttp://www.ibm.com/~Balazs26419.07Yukata Beauducel47 Araya StCharlottesvilleUnited Statesmailto:Beauducel@poznan.plhttp://www.poznan.pl/~Beauducel7393 8354 9466 453418Graduate School45123.63Radhia Tamches63 Kitano StHonoluluUnited Statesmailto:Tamches@uni-trier.dehttp://www.uni-trier.de/~Tamches6565 7684 2833 7108male73615.90Yuguang Coomanmailto:Cooman@berkeley.eduhttp://www.berkeley.edu/~Cooman1887 8458 2855 874927Graduate School35214.05Tobias Veeraraghavan41 Cavedoni StAguascalientesUnited Statesmailto:Veeraraghavan@umb.edu8969 5456 9679 1336male4641437.21Chanderjit Takanomailto:Takano@savera.comhttp://www.savera.com/~Takano5097 6993 1970 6644female48896.64Tinko Reinhart100 Dhagat StZihuatenejoBahrainmailto:Reinhart@crossgain.comhttp://www.crossgain.com/~ReinhartmaleOther9876.00Benny Maraist38 Coscoy StVeniceUnited Statesmailto:Maraist@acm.org1444 4160 5898 7668female21High School43968.24Yelena Takano10 Luit StAmarilloSaudi Arabiamailto:Takano@uga.edumale28498.40Neelam Rowanmailto:Rowan@ucf.edufemale2425157.94Terrill Uchoamailto:Uchoa@co.in44103147.12Jamaludin Pigeot64 Gire StMonroeZambiamailto:Pigeot@toronto.eduhttp://www.toronto.edu/~Pigeot6115 7380 3797 568718Graduate School9876.00Mikiya Munozmailto:Munoz@filemaker.comhttp://www.filemaker.com/~Munoz", false) ); } /** * Purpoose: For each person, list the number of items currently on sale whose price * does not exceed 0.02% of the person's income. . */ @org.junit.Test public void xMarkQ11() { final XQuery query = new XQuery( "(: Purpoose: For each person, list the number of items currently on sale \n" + " whose price does not exceed 0.02% of the person's income. :) \n" + " { \n" + " let $auction := (/) return \n" + " for $p in $auction/site/people/person \n" + " let $l := for $i in $auction/site/open_auctions/open_auction/initial \n" + " where $p/profile/@income > 5000 * exactly-one($i/text()) \n" + " return $i return {count($l)} } ", ctx); try { query.context(node(file("app/XMark/XMarkAuction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("0280047018334302765355343067004180000500060000500060035130360492302403005550300090030024000001300350002800220322400003063012241803433005583400344335003428495048131302236490320025003764008000035352400360065353000063280007023098020276031953000365000303623031830050350308233900603035507528310563342000800503400718000004124005565049048000407503500004149032606903000033930570006418414700030002700000231800342200032303500022053231302430323000013120333000002604136000300036003183151860022693063001713036057003142410313403049020503226000230128041323031260080370350352306500760100024003568032700740030303200410021350322400034141316245630139042017550531831103039800000340359034075362313000024021000036506007100346700000035498223931808003024003608183400002223420017120100026000303029600027324002287000800310003165332055001803031430310002824004927303036000023350303541000243500340000327622356434000330330290220001000430242249623003180000018800004743550017010319053300130009477035018008058230322032700107204103973650340030331403060006000350001303003400414936068", false) ); } /** * For each richer-than-average person, list the number of items currently on sale * whose price does not exceed 0.02% of the person's income. . */ @org.junit.Test public void xMarkQ12() { final XQuery query = new XQuery( "(: Purpose: For each richer-than-average person, list the \n" + " number of items currently on sale whose price does not exceed 0.02% of the person's income. :) \n" + " { \n" + " let $auction := (/) return \n" + " for $p in $auction/site/people/person \n" + " let $l := for $i in $auction/site/open_auctions/open_auction/initial \n" + " where $p/profile/@income > 5000.0 * exactly-one($i/text()) \n" + " return $i where $p/profile/@income > 50000.0 \n" + " return {count($l)} } ", ctx); try { query.context(node(file("app/XMark/XMarkAuction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("4743655543674150353649553563554335494836497640353536653563986053363650353960557556507141556549484075354149606939576441473541363660696336574241495041353565763574413541415642559859366560716735493936428765554936353541353564434962474355477058724139736560603541493668", false) ); } /** * List the names of items registered in Australia along with their descriptions. . */ @org.junit.Test public void xMarkQ13() { final XQuery query = new XQuery( "(: Purpose: List the names of items registered in Australia along with their descriptions. :) \n" + " { \n" + " let $auction := (/) return \n" + " for $i in $auction/site/regions/australia/item \n" + " return {$i/description} } ", ctx); try { query.context(node(file("app/XMark/XMarkAuction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n\nhark guiltless coldly regan plot mourn bravely whining pen wise approach wounds gain soothsayer deities pardon humbled these graces shepherdess vill arrogant places lost odd looking bodies unaccustom prize miracle pity disease beauty serpent perjure bedlam troilus sorrow arbitrate wrath wring music remember royal resolve fingers hanging when preventions accustom honoured sicilia recoil perseus \n\n\n\n\n\nknees greyhound pursuit blot arthur fornication stuck rabble mask time stolen entreat swift need wrinkles virtue unjust way world mention kept help does posture pavilion windy since brabantio wench spain argues otherwise parted affright repair instrument redemption form yet stain liberty court infamy progeny countess wonted pursuing now worth conditions mowbray gon silken spirits sweeter withal experience school peter reports revels pay trudge touches spurn unwash tom singular partly leon style receive nile giddy potion peace stomach mindless wings stirr unfurnish allay osw give toil royalties water bigger overdone lane suppose rough treason brook axe rebuke drift rings pedant knows stead birds cupid wake semblance london may remedies bad joy mends coward bloody employment mind soldiers nuncle stop dote surely presumption prattling educational soil pedro nevil eyes along cockle cliff mowbray law followed sanctuary wont offend hercules fertile windows albeit loves galen arms throw since care therefore oppress tending epithet medlars open hubert fresh thunders heart long \n\n\n\n\nforsake spider toward lips importune costard pearls pottle adventure wench glou abroad uphold precious hear entrails dangerous stab necessity evil following telling bark removed verge depended wrong probable reprehended congruent spleen lip flame manage pith teeth albion \n\n\n\n\n\n\n\nquake brain bit congeal short fortunes stabbing under bade unlike write invocation skies knew unbolt eunuch benediction legions whilst tapster windy capulets preventions mild unexpected wheels greater triple rare eyes lords alack believing rich than preventions laboring execute defend retreat whether trouble battlements been bowstring void remembers creature puissance ent bleaching days run arms nurs suspend spilling demands circumstance clos robes centaurs each suit gods mediators palace made foining knit overgo rare hedge gaudy breach silver lovedst rare injure riddling noble appeal reap mahu regan trifling \n\n\n\n\n\n\nstale weariest spare mer yonder cunning acre residence mounts fancy hermione liest drives doom collatinus blushing translate prevail occasions spy spake cabin enter coat put pair finger sigh dear rosalind edward tire let skein parted travell presence care hath nails stare beyond says clock poisons darkness strange both shaft beard willingly times weight retir owe manner hollow knowest unseen wits princely virtue impart educational weeping doreus wast wounded modern renders emilia flexible till towards arraign vill signior respected kiss abide dying knowing suddenly have sweeter caught fruit murd new tears lift par rarest fence fellow drink haviour cell worth expedition fresher other friend unkindest denmark attest whensoever bowstring hat north standards beholding knock other how wards ward vanquished other often lamented ajax with sustaining alone villain procures lead horse corrupted whoever tree about man adoreth upbraid coat fifty take rod displeased glib wrathful moody sluts cripple plume contrive trust casca remuneration mouse mixtures guiltiness already thick command meant idol garments said faint hurdle respected rag convert evil render thrifty wall cassius wring lim distracted hor weary danc peeping lord ascends help wink faster cries sea unseen walk souls pompey was scurvy evil con quench drawer personal revenge gift aid blue crave leave noted girl rom egypt warble brook pawning win runs obtain ely beggar hurl pause tangle subjected article stew mistress spider bankrupt post stop jewel clarence serpent nest pound greet court rheum thrown war continue asleep bull damn grave hoar bad indiscreet met loss knowledge tent secret presents left odds hadst sexton character languish keys begins appear timandra odds beautify spot song axe approved apemantus single merchant dozen operation welkin canst secrets prompt answer sinews calling unhappy attendant muster eternal nor art bookish deceit shows murther truest upright brainsick properly require freely our sanctify pray christian swear threat confer joint mitigation smoke pair ranks sadly signify prophesy ribs taste leading sick run \n\n\n\n\nfine avoided gentlewoman entire partake bandy smiles unfit whirlwinds dole entertain nights whether foolery subject chanson slay friends rising calchas say casting gift cry choke not heedful toad rot damask abroad secure hips slumbers strength arrive anointed enjoy wrinkled sceptres youth \n\n\n\n\ntempt through evil preventions vapour wink crying women conspires alexandria plainness party bleat aye islanders breath sauce preventions lot lying reckon unmannerly roaring preventions visiting implore treasure descended senses hopes julius proceeding kerns cicero hence twice cruel gallant public whom anger lives eve kissing sonnet cool teacher fighting nimble uses liking sanctimony fright rise acold rememb baser sweating does home preventions ado dying demands shamed reap began attain wast song venture large quantity avaunt forthcoming ink paths tower harlot satisfy gent troubled haud turn insinuation finding rounds orchard branches doct keeps foe lacking legacy overture suspect \n\n\n\n\n\n\n\ndifference juliet fourth ass salvation eleven sham garden world lin balance peace chang lafeu metellus blame revenge ambitious soldier eleanor prevention cradle are ploughman preventions picture violent over pure ganymede bell deceive fertile foes angel postmaster reign puffing hangs fled wounds earnest subject one rails yield necessity eats receive ladyship pluto heavily worst still estimation thrown think cudgel afflicted trouble witty stride shadows bak wanted thought footing headborough hears deceiv parson assembly commit chastity eagle promethean curfew rogue courtly archers suspicion book pine glassy ungain dares undergo carbuncled embark revenges enrag \n\n\n\n\n\nchid gallows pembroke wings lion patroclus offense mortality musty serv tune device manage hateful trash cheerly posterity may blasted kills must moon interim dolefull object passengers hecuba amazes gentry ours exit welcome thrive bow larded subjects unsoil whoever straight courts noblest wild upshoot sham pray gibbet good south kennel penny belike impeach quarrels dowry harm inspir rocks jot acquit desires look promethean stirr touching merriment arch because quarter wept wander butcher let northern can reason ordering feeling well meantime extended distinction howe dungeon honey mouse great elements welkin age landed chances reg cheap proper cor forget warp throughly harmony reverse hear stirr ceres prepare convenient haste adelaide though pompey vanity smoothly banish epitaph this oswald steward fierce slumber confidently taking infants vision speechless torn lusty expect peeps silvius paris sheep craft unprevailing pulling name for giant guil memory heavy idle shouldst false oregon mightst honorable weather lowing cor utterly bountiful slips canopy skin acquainted writ write heads marketplace theatre warning minute thoroughly forces favours snake book untasted pastime against expectation guilt villainous fiend tend consenting bade mechanical hats word ass magic damnable mark need purg chaste unveil remains grey bodies scurvy believes who benefit fifty press thy neither youth stable wart eat liv wanting revive attire truths sight ransom berwick during language manly pursuest pol metheglins sport doings holp sentence wait called bay wrinkled bail affection marry waving sister gladly holiness gentlemen minds stuck mutual could troubled compounded sorry minister stain approaches acknowledg northumberland study perceived taste goodliest goes prerogative sort day treasure \n\n\n\n\nshrink nature unhappy humane stol sooth damnation cook ridges rascals almost prouds priest war empty hive answer kites clown token thetis tongues service wounds promis galen daws dishclout blust forms audience placket breakfast citizens ill depart amorous dreams daughters table provoke said learned side devise grossly cobham affliction brief precise assure publish furrow girls honors fooling write \n\n\n\n\nprisons fairies powerful fat write bird preventions anything appear headed renascence treason tyranny suffer rid safer caves equal rheum too worthier thence besort accoutrement brokers unlawful aumerle outward presentation amiss letting poor corporal prepares weary judge traduced proud wink testament \n\n\n\n\n\nlies roderigo triumph him affair decay squar rock flint unpaid die suspicion expectation approves reliev furnish submission labouring taking whereon noblest direful weeping proper whistle prevent knock theme islanders vowed pluck unkindness falstaff dealing murmuring jack canary champion draw watch wittenberg broad fill stuck watchman care speaks shoulders dukes trick right polixenes curtain embracing alter thereof london story volumnius itself laertes who secondary choice want stabb applied fit edm undoubted conversation cozen buck make additions crush preceptial husbands propertied grecian lucius colours heme every enough \n\n\n\n not follows office immortal having nod beholding old minister aweless sallet game cry suspect catechize crieth rain being keeping charg done gray takes country meetly grass whispers instruments taught beseeming forest plenteous foot size double tune smacks roll head via bate europa for humbly shirt younger flattering precise pass sprites coward smoke especially oblivion same feathers pluck beaks subject toward refresh brown fleer dress quality attendants chase brother mile plummet finger frenchman speedily wakes beaks did chill claws fair northumberland polluted letter lady place bad tripp venice mon touches bestrid salisbury doom pack people comparisons chastisement clamour profit wales customary anger discomfort acceptance likelihoods hallow plantain marriage saw arithmetic farms shot mind eyes charm confirm shrunk morrow loyal taunts are unkindness unnatural dauphin securely cordial carcass creatures told surpris speech raise sports follow big affections bed nature stealing miles appeased alone hangs large antiquity longing cloud physic saint pissing county beautified bear gobbets rebellion beauty year night despairing wealthy mess march mangled ambassador poniards coat embracing bay wanton gone banners mightily hovers same youth showest noble sadly polecats rank affright regent facing borrow braggart dauphin wars fairies search \n\n\n\n\n\n\n\n throw liar revengeful oregon sorry protect four whoever weight continent pity something ghostly flaminius climb judge army midnight radiance breath ourself combined frank fouler play gave desires straight them humble compell publicly dignity acts integrity young though wrathful transform bora scroll ungor proudly likes kill heavy display unyoke presses where coronet protest forc doctor rage parchment taught seems shield since derived mutiny frighted gasted moved herne lawful morn admitted spare heartbreak girl show leap inward foam touches preventions striving favour slew cheek negligence gods chance sheet morning his troops vowing resolutes exempt bee flavius continue rais breach scroll standards power \n\n\n\n\nmeans widow thence profit runs bear simply higher friendly tempted creep lightning steps explication forgot shoots seize sweets \n\n\n\n\nreport promotion truncheon deprive pay race subtle deny athens women man attempt violet offences virginity channel cupid sick smelt suspecteth storm emperor gravity sooner cipher usurers vaunt lion sleeps preserve hor sirrah locks past played two lying pillar vanish ends until blushing degree bluntly thorough whereto highness labienus swift done makes armipotent cock second meats frederick summer ban benvolio none promising vacant liberty evening tokens wherever lived post spare lessen parolles armourer \n\n\n\n\n\n\nwheel wast choice censured ago britaine flight thinkest peer excess mortifying lineaments honest rul train though laurence priam fairies vale alcides cressid bed shape imprison absent vaunt \n\n\n\n\n\n\n air faults sayest traitor graves custom speaks sing egypt upon censure disjoin thunders kings late sad evils serves rings prayers passage piety drawn captain abused flask dug laments scambling isle beard came laughter snarling mellow envies excuse disdain sickly stranger aged points whispers scald spirits offer week first two damn pope company household resistance remorseful head the commodity discredited queen roderigo sick own best swain queens terrors fears heavily carlisle varnish glimpses \n\n\n\n\ndeceiv free clouds mightst find aforehand delivered thieves fleet spark removed please montague beggar become defend hugg urinals dolts rhyme beat venge despite stops unseen harder faster accounted king holy disperse exultation relent war credence weak baggage capulet passage persuaded dictynna moves impose being beams outrage hastings largest affright parson advis contain ador deeds great looks doth gratis vaughan known fast albany earth moe petitioner fools dim preventions hooted idle midnight touch sake short holding diapason paid lechery shelter wants clitus brags trifles disfurnish quiet drivelling penny want hung dislik drum court toad forbid county champion deer asses because isabel dust judgement familiar climbing debt takes bee knavery alias nature says brows thence pendent truly safety slander breathless tonight may sheepcote planets commoners bold public night this senate groom heap rudand save cannot bud upon justly moves furnish quotidian bid slides nobler prevail seeming beholds secure enrapt marcellus supplication put penny inward shalt tyranny breach beyond report drinks hop ass gently leisure calpurnia princess morning truth jupiter how hull after endeavour preventions bald confess angelo arden witnesseth tybalt eyeless unscarr squire birds mouth conquerors care twenty substitute gentlemen martyred yead homely velvet passion greek mowbray indirectly manhood persuaded warmth office robber ensue songs tend emperor disposing glad inside days queen prolong pranks employ inquire pluck \n\n\n\n\ninvocation retort dido bright nosegays living blind rattle green puts cape wing commotion fet lov patience judgment living slumbers sacrament miserable pours bail whizzing scarce godlike beat harm liable clamours crabbed bracelet disobedient living works vows dance preventions lions rail wont jove shakespeare place hundred lie,and anything whipt flight lifts rough preventions abroad passing enemy alexandria rosalind alcibiades tied slight offend hast green diamonds general clothe cor laertes catch void sighted whose die tomb befriend titinius craving revenge short cozen blust through ophelia tripping homage lancaster tells tugg starve frosts worse larded nightly strove gentlemen bud requests shadows circled truncheon kill swear loathsomeness choice nest servants particularly weather kingdom english ben weep procurator yourself faith girl allay methinks number mowbray rosalind employment making danger gentlemen straight priam rightly why trust girls content elsinore strew flood abode keep reconcile baser remains preventions kindness easiness conceive sickness less break kill grievously replete embrace lucky ratcliff baby trick tricks seldom dragons silly pyramides bravery conflict spend sheets flourishes runs succeed travel unhandsome king conclude stab land clowns gnaw unwholesome years striking following ourselves remote holy rightful leathern boyet muffled lepidus service breaking grovel puddle duteous forget prophets cage swears knee spirits figs business bribe mercy charter proclaim requital remember nought rainold beauteous disdain wide ears thrown hills breathe marseilles disdainful came reported suit hen traveller naked let possible francisco berwick beam deed sailors quicken hawk lucifer ventidius confine luck pleasures thersites cease frederick hag sore posterns sundays cull spite adjunct gall ill sixteen filling caught serious fool market disease plague apparent sick neither letters wand tide itself masterly tongues marvellous cowards prevented magistrates amends wednesday inclination display within fifty \n\n\n\n\n\n\n\nwhole pow overthrows respected ignorant thaw habit purse swell warrant mark meetings countrymen dozen preventions ignoble rate idolatry drinks grant much ruffle strange mess standards broad boar unwieldy unkindest sighing loathes imposition sevennight feels burial hourly hates because girls reach expedition division supper maiden jaques company flight palpable gallowglasses meat creep impart months whirl loads leave rather story forms downward willow stood bated shoulders rote belike dares have monster work beget palate bully doubted furies talking four grosser prosper theirs philippe was stand evidence quarrel plotted treason includes territory torment merits little vanity yoked methinks naughty rebel delight pleases leave comparison selfsame saint tell loving fearfully employment desert perjur stands wind suck fear morrow dreadful british coin hail troth residing beauteous pass mar fence troth ugly bid borachio unseen extremity cull felon \n\n\n\ntrash lieutenant house return hers together mer grows blood says having youth \n\n\n\ntrojan obstacles yonder dost three curled pulse pound tardy unfit just chiding cease preventions flourish porter seen sickness count goodness winds wail bleeds like whoe ransom goodness store fiend troyan ring strange study spotted implore prologue fairer wood octavius venturing offence prisoners yes fellow batter titinius cease rebels forget spirit gear hills drawing doubt thus hands surrey foot despite arrests expedition worthiness stripp dug biting mistakes choice shakespeare dispos compact sweetheart again pride chronicle fight rainold made \n\n\n\n\n\n\n\near accidental expert lest meaning pursues choke due portents shrewd honourable then metres wronged stars possession nought nuncle droop desdemona knowledge led grave enjoin fourteen spend pompey howling incorporate beggary loud joints unless norway thrice paint traitor plays tiger mild conduct bridegroom fixture blanch niece madam regiment fools cursy pays drinking after despite leaves intend majesty evil contemplation whose swallow certainty fault supply growing hoo tybalt wed anything afar please sickly mistake entertainment need lived attending outworn worm wards note princely but end constable enterprise yielded tents rank whet lechery inky tyrant argus shoot faces breasts another pol applause skin strucken preventions square dreamt separation scap bardolph beaten paunches excellency hedge knees service spots windows hazard fortunes iras suppos following souse somewhat curses tigers harry deaths bubble wander again enters hairs free truer bold manifold bald horse sun convince art print very casca polixenes fetter company turn kneel cudgel showers week rise scene hell next aim curst curing kind language springs immured flood beatrice mariana jet spectacles reclusive nathaniel hat folks woodcock begins rank perspicuous sorts paper support \n\n\n\n\ndeni languishes left wrong preventions retires betrayed whit rosalind harm broader distemp gad intercepted nourishing proculeius knees almighty war brows snatches earl rightful sister advis truest struck urg edmund loss earl marry seeming temperance intents university wheels hurts cautelous their living conceal minister fee \n\n\n\n\nwards torn mercy creatures appointment country friend evil ancient apprehension ripe letter break sphere seem helmet cousin enemies smiles blaze sinon odds iron bootless favour familiarity retire small diable gratulate marcade intelligence born sepulchre peasant commonwealth visitation ready composition bosom underneath bora attir execution cannot beggar attended pale ends yield sprung curse stranger seduc servile \n\n\n\n\n\n\npurest keeps sports swords consider quickly properly perdition compass low crows saw told brave debtor deliver amorous daughters maliciously drown slubber infection scolding staff behalf logotype spake thereto much imagine excuse counsel sententious conjecture lying life honor seas bid unseen interchange loving damnable cote storm monuments dying perverse night medicine rob years oaths large compel neither lusty maiden flexible elizabeth capitol emulation poor flesh \n\n\n\n\nginger suffolk promising values peers princes minister gulf army lives repay serpent agamemnon rose drums hail slander brave pledge ourselves cham avoid either desperation winking feats tapers ursley eden herald ill blessings butcher patiently grange mince head loved lose preventions imagination dolphin chides didst injustice rude day chang breeding duke midnight alarums lost constantly wrack bed wanton patch florence rocks perish address study hangman despise hose makes colliers crabbed afford join mutual prevail ornament apollo observe carve murderous falcon looks brightness collatine selling harry custom ceremony cheek napkin residence witb ounce households kent lean adieu warwick villainy ominous slain symbols bathe peaceable pair everlastingly babe follows strive pow beware cold rage cell unlook imagine long map hears cheeks censure fears need antony archbishop deny seest prosperity sound propose spy wot mounted begins adelaide own doomsday careless miracle fortunes surrender understand wretch slave whilst should next harder moiety broken pilgrim parthia provide latter napkin laughter spoke multiplying finds same joints sigh dear shouldst scorn try tomorrow antonio reads help instalment faintly wisely satisfaction unhappied guts exil harms brawl commiseration clearly pardon revelling fool substitutes turning low heavenly wildness bending page pandarus could when betake camps spoil much just wager merry mangled ominous glories lands whole titles quoth books confess blows quarrelsome foolery priam stand gig ladder fighting bold guard rom think refrain venetians sues heme rightful manacle jewry needful unloose crimeful compassion princes swoons trampled senseless liest bondman lodovico degree posted terms talents ere coldly heads marry exploit garments greatness prodigy heavier deeds less honour yea sufferance your beats revolting intrude nature nature two millions interred stubborn appeal hyperion christopher judgement empire engend realm terror untrue pet respects \n\n\n\n\n\nears week about hop yond strongly forfeits petticoat met breach osw attempt confirm understand chiefest dearly edgar degree majesty battlements \n\n\n\n hateful precious retain passion thyself parentage designs gowns arithmetic decorum pearl painted beggar passeth honour desire aeneas potency half thrice tricks treads shuffled cry just acquit courtesy pow carried away perpetual threaten detested rank bearing signs external honor happy cut weasel pass produce virgin oracle room freely ingrateful listen shelter homage showers flaminius feast bend neither swain out duller remedy cannot examination posts retire backs woeful sick carved carriage weak walking according examine weather apparent most keep are thank stockings alms worms fact propose trencher priest steps honor complimental twelve transported later high suit those cousin seat career villain aloof wheel prayer unsettled fancy now replete whereupon coxcomb clutch wish guides admir only cease extremities must aloft state brutus caroused except humphrey wed blows caps george grief nurse commonwealth italian heresy prostrate educational obtain murder easily losses colours gallop scratch smile fields trial hot sorrow decius sighing miser clean are jar sooner bohemia greeks oregon mock wounds commit victory gossips antony waters male sworn daylight stumblest prophetic musty few instructed wage beheaded lords lip professions then grows watch built treacherous shape cut leave womb sighing unruly fourscore nurse lusts conquerors alps lesser plucks hypocrisy portly band favour secrecy combined marks leonato abominable discern deniest strong loss rome having etna goodyears charles unmeasurable idle avails delightful speedy superfluous saw aloft drab perdition ours gentlemen talk ratcliff suits smell affair place jupiter wrestled common dark preventions greatness cease motions dogs broad exclaim upright seen indeed way fresh does four mothers having mountain pass suspect defence school impon pale \n\n\n\n\n\nbanishment nurse showers \n\n\n\n\neating menelaus thus rest likewise forsook deal party pale varro blades sights lack days render purposes bliss crept fann which dance ears different capulet proof servilius midnight external coz fasting people anne protected herein attend centre enjoin toward stings train siege simple dissolve career warrant laurence balthasar build dispatch liv dancing gloz thread henry set pol prepare dealing laws came mighty higher creep tread luxury church ranks interest lend squar rustic collatinus sweeter chests thither amazement toasted clitus dishonour rowland friendship marg orchard through penance endeavour clamours treachery proclaim nephew rather roman whereat rule jove numb travels rule enforce brings bands likeness seems cart yielded despite flourish musical deserve merited muse resign shroud plucked warmth stamp safe scarce rotten scope white fox list privately innocence arbitrate forehorse nony rul helen amplest offence metal blemishes sufficeth sitting meddle happiness logotype alexas compare fairy keep learn worth infection characters provide \n\n\n\n\ngardens next mounted harsh passion disease adornings labour retires kite prepar doors abstract preventions mine errands crust lucrece turn protector preventions musing esteem bills needs observe steward exclaim beg fowl who art executed round hags obsequious division nilus mus baser divine cressids apprehended eternal william grant interruption tut aloud more restless unique juliet why authority softly strangeness joy smilingly instrument courteous sitting aged rise york infamy con least bless access within embassage perforce infortunate however mouth great wonder lawyer margaret stick revenged moist fools necessary hardness ill punishment hearts eye treasure younger wed money plots drew subdu moe follows unproportion sicilia gate backs journeymen indeed gentle rebels uncles thrice solicit secret simples dialect accident guarded bedash certes tithing despised remove liberty advancement away nod precepts tickling gentlemen metellus twist senses departed charity tenour fardel plentiful enjoy restraint meed placket apart soothsayer bridegroom matches easy imperious fat act lesser death reply swoons falling amen ladyship \n\n\n\n\neditions blanks throbbing teem amiss hoarse souls row kissing similes desolate strength pillow wall tent ever tapster dogberry strengthless robert repeal guide found luck oppressing arbour wretch proved stronger gratiano take deliver denied \n\n\n\n\n\nplace iniquity current seethes plac pleads neither string forth preventions tax troyan carping spectacles preventions falls know provok hard new thy poet falsely said awful instructions pole laughed sue cressida english unity each aumerle cop \n\n\n\n\n\n\n\nabuses savouring breach antic taste accept with faster dismay advise down stale vipers visor wake morrow apish spent find carry clapped neglect borachio divers vile hours precedent tennis imperial leather casca hue rash ended unbridled tall given philip raw wheel ant statutes cause fire precepts pipe late leaves yellow brave come cimber apply ford fall shamed liking william graces contradict grief critic those battle flagging \n\n\n\n\npreventions ready fled hamlet winters stood ever staining romeo lay unto cleopatra brothers stone lance form pella isabel bethink purposed flaminius preventions regan geffrey daylight talents sheets \n\n\n\n\n\n\nmoon isle procure osr lock suspect cousin boldness hat plenteous calendar virgins qualified eterne sluic vane ominous numbers antigonus falstaffs brutus flight courtiers feared inform showed giving perchance disposition reprehend torments murk require wench early property silent quick amaz yesterday taken dole hence hold obligation borders once spur valour brook priest debt found asleep deceive advice pupil piteous white sun charles descended priest grudge rightly \n\n\n\n\n\n\n\nfights grudging friendship doubtful present slumbers opinion wafts quicken calais delivered rous mouth hollow save children dat hill gotten frame pretence breathless employ occupation rated cuckoldly year virginity patents kill sceptre imagination dispositions module forget hell thaw hiss fruit more dower surmises bloods bernardo sure combating \n\n\n\n\ncross brow writing safety letter than mercutio veins dancing william five wall slander coat happily travels strikes libertine ransom advice smiled bought imprisonment sting plots edm deputy bias monstrousness troth trunk handkerchief satisfy vantage four dark revelling gives shepherd gear beaver mortimer leave prophesy profession thomas courtly wooing varlet custom nails require chain likeness weighs liar heroical prophecy shuts dangerous osw rom cain honours follies ranker further meagre along wrong why and chides are austere coward laughter poniards suitors descry sleeping father challenge rote modest inhuman array know alms first hardly slander flourish contains preventions breath unlawful roderigo solely endure visiting rightly your fellowships met beats consequence disclose warmer professed contention free turbulent publication courtiers sobbing two discord latin him sailors bondslave reg breathe follies off land chipp buckle outrage everlasting woeful ascend wings congeal wary percy senators apollo spark pulls dramatis false lay hath servants grieve woodcock lucius yesterday overheard detested expostulation imagination because attach serpent usurer bees knowing secure cank axe picked speedier lower led pattern before coat shoulder turk necessitied replies marg request interprets full grandam stirring applause viler guard favours litter copyright garboils rome same confession unworthy degree white cullionly albany greeks not taste surety aunt jack streams denounce iniquity naughty strangely dighton profanation piety hunting skull willingly turning hangs capitol bawdry own club rage conduct shaking while purse solicits blind garments lower softly cureless potion rogue dismiss harm child vendible beaten escape regent said west bastardizing lightning hair receiv dare earnest ken majesties malice feel bosom south foresters perturbations tasted salvation murmuring approve saw fearful truth falls spot cowardly choice extremest relish menace yonder dreams chamberlain reputation store troyan gloucester slaves preventions servants daff bowels breed kingdoms wrought conclusion \n\n\n\n\n\nshent running content slumber hoop called pouch plague gnaw unfold flesh yet account ros shadow beatrice space carp walking conjoin bondman colour hitherto bene hostess \n\n\n\ntailors preserve wrinkled danger dreadfully marquis wrap easy kingly ascend maids horatio collatine every state thrumm hinges incomparable unshunnable breed mus adventure temples anne nurse bound testimony lour changed not thousand latin con grown abroad new approve went knowing stand marvellous charge mild while under rascally shoulder can dignity pieces thus picture conduct \n\n\n\n\n\ncheerly trade dishonour empty own wrought add irishman freely brethren impossible bastard politic heme mouths courtesies imprisonment stained antonio falsely toad sleeve fox shepherd cur taught sword moon hit bathe deep retreat goodly wets limbs foil courtier such ice musicians claud endeavour angle adversaries full parliament quite text wild descend round tomorrow harping hard hawk forehead peat prey suburbs sings hum devour our reportingly lieutenant lecherous smother henry resolution trojan must falconbridge discretion hastings tetchy scarcely frock radiant marvel con extol logotype powerful scrap blame metal entreats unstain wounded second suitors sell cuts \n\n\n\n\nbitt whipt civil thoughts nonprofit bravely pleases kingly \n\n\n\n\nsalt shell stand motley air stole livelong dispense worthy way skins queen third owe courtship briefly loved about hatches proved \n\n\n\n\nhonesty jealousy dole abraham offended villain cruelty bloody nilus appointed diseases they happily bones etc heavens gentleman hungerly slavish dares thrown sound drink instant shortens witness fatal oft tongues bin blasting stone stays propertied comforts tides \n\n\n\n\n\n\nplough made reported break poet \n\n\n\n\nsoft persons lovel poor pent skilless preventions alters lecherous suck wreck little alarums hearts rudeness these stealeth lancaster priz just bottled wash victories ignobly excuses interest wine narrow gaunt combined handiwork nature charity speaks judgement obsequies \n\n\n\n\nsigns sir seek wedlock wears forbid grecian cassius pulpit \n\n\n\n\nwooes jupiter earth hopes bastards nights fiery drawing fearing lend abhors stephen bosom done begot apart flowers ran gazed steals like reverse pale reading report wales passing fantastical protestation surrender heirs certainly figs forsworn chang lordship centre lies bid minister give antigonus ladies mummy descend mars hymen glorious starts said goes cargo quake earth ruin plead angel shake pure loos gentleman requests gnaws scorn villany aged strain thunderbolts answer laid thieves have reaching stone spite warn verily tongues motion witness shines pertains forced gentleness woman creation opposites scene fost distract stuck advise tempt flesh bending unwedgeable lay might \n\n\n\n\n\n\n\n\n\neasily blest word where stay unwholesome mildness sorrowed taught shoot frown provoke possess islanders evils art mud edg spotless memory wall faints noes lordship blaze lisping fir arm goodly fix serves appointed covetous pity realm heroical highness lady wept falling trumpets \n\n\n\n\n\n\nyea serve statue suit foul him hart wretched lewis pink functions earn finds teen obloquy turns matters torch street counsel pays merriest gown master dagger open forsworn draws poison manage cost swing pawn pure instrument but miscarried harness broke play tempt crown besiege ill affrighted travel overheard innocent swallowed closet dreams wittenberg dallies instrument scores stay sitting caught humphrey wav happy hallowmas daring besort incision get lift distracted glory rough instrument breathe foretells \n\n\n\n\nunbruised manhood rouse mattock such preventions haps james bishop lordship citizens fish everyone cup took messenger heal war bully perform event absolute are host vainly juliet sat nuncle tyrrel hard couldst traces possession wrath blushes sheets shameful bents ever flavius quarrelling trencher alack undo help dexterity sworder whipping portents taste cardinal speech pains appeased drown piece wretch monsieur let paris partridge capulet woman minute agree washes declin philosopher mad parley royalty preventions lease deaths without seeing music body deny bid meddle untrue busy reasons cleomenes resides whatever tom buckingham spoken ring himself \n\n\n\n\nremainder gallant requir marquis brave succour one driven cudgell wrench juliet assault hotter estate kings aloud vigour proclaimed commit doublet southwark rheum devil however fates toys wink angel weet within reverence omitted aid \n\n\n\n\n\n\n yesterday countries curse preventions counterfeit palate housewife elements whiles knavish court creature except forget prays plague sufficiently parthian thus leaps certain marullus past wasting hamlet red trot boy miracles peaten resides joyless spectacle mer fail galled rebellious stones grief appeal ophelia compassion canonize wast exit alike oil stood blood numbers bid incline warrant fell already rocks hollow geese sprays ruled owes alban consist antony praise hume stoutly yours attendant adversary jaquenetta depose carrier motion hir deed fighting whispers field kings caps strings asleep comely lies destroy stew terms use delver alas extreme condign mark romeo ladies grounds borachio tisick might hereford feasts glad maids troyans art epilogue ent strut sounding strong bears divine \n\n\n\n\n\nmadmen higher mutual perish thence preventions orlando timon burst arras strives margaret preventions point distraction pox wears post reproach firm bolts hellish humility wine osric fat earl swift violence throng scorn recover vaunting augurers dreadful sicily brag tears growing bowl below debt replies sland forsooth hen domine breath thin ling late money unruly descried crave woo assured briefly workman toad magnanimous terrible married merciful afternoon immortal church grise indeed romans veil dame ancient loves vengeance covet affairs marriage soonest ring vouch troubled mak begin sit exit cimber dearest decius frown tent their clouts dash lion audacious pause incertain zealous troop conquest trotting proof vengeance castle brother torments straw toys sacred commission always titles michael sheriff platform erected taking venom lambs slack get laugh frowns she antique trebonius trembled commodity niggard rid shines damned almost brought liberty straight chances vainly fitness red whereupon hers ilium and urg verse mixture odds disorder dealing women january palace denying shouldst masters dame principle \n\n\n\n\n\nvisit preventions slander vaults shining heed shop stay entame mercy try rogues denmark yon nor liking agony honourable excellence flatter fathers eve unnatural countryman egypt sleep hereford hark ambassador nails sue death bail clock sentence welcome breed clothes afternoon bounds forth deposing madam desir master imminent parentage fashion shun binds suddenly antonio endless earl met defend wrestler kept set gaming swears mould ingratitude keeping noble treaty actor eaves sister therefore working bastard gentles murtherer dead require these fantasies proclaimed surfeit sadly public leprosy wooden youth less allowed seduce hay thirsty flinty loyal adieu joint yield letters adversaries lips brotherhoods shade physician march crosby standards pavilion full function wrong mirror spit deal desires nineteen inform indeed adieu opens twice ended sleeping sake nightgown distill dear turf better here takes madness whose bawd smil timorous eros marvel boats bootless gone engag priests unruly where lusts knowest parcel but beheaded gifts composition enmity pocket mars bones ear paper gentleman pinch foreign disorder seal shoe stol lucullus eyes falt covering treacherous attentive books frenzy depos support approaches lay stood woe surely durst abed translated thron forsake rhyme accompanied discredited both dorset bite taking borne after ptolemy folded haunts birds provok laboring slow mould hector pestilence redemption parishioners prove proud warrant home weapon heard forceless sympathy unjustly slipp pain ass ransom whereto cipher cousin rail himself tybalt throw mettle tightly doth avoid charity quote sleep smack bell court tom superfluous into language foolish incomparable hie ransom moment generous granted ribs pulls sepulchre conveniency contract dispos beget villainy finely greeting them commenting upon triumph infect gentle conquer depart dawning appellant punish tread preventions disgrac knew been country tatt hack cheerful guide physic covertly smile less chuck castle peers aeneas received marvellous bids executed monk touches rhyme certainly saw arched contented fore denied disposed threat favor nothing county degree fiftyfold doubt draught heifer serpents souls afterwards actors burglary fly impediments sculls serv brazen ruthless paint writings command paradise alexander samson couple paper faith conspirator philippan amiss steward bring france gillyvors room body wrinkle mankind pour device immediate device babe blushest even plung rancour pay wind blame gave ruler prisoner capital ancient utmost liege tied late life traitor cursed varld rhyme state greet crest sat beshrew eye palace \n\n\n\n\n don tailors stream wag darkly its courage alike mine commoners misfortunes riot myrmidons dream curl york demand plot birth bones fasten clothes deck met publicly ambiguous remember rebel heavy whispering awooing mantle hits trust different beggars dropping bankrupt edg destiny seat opportunity build wears six theme gon fast sizes lips whereof advantage extended goddess payment web claud promis farther contract bare depend hers story goddess snakes exhort justly itself gait preventions buckingham goose rememb anne \n\n\n\n\n\n\n\ntutor ghostly wak ring hair francis impatient redeem stomach wickedness grave stops fled murdered favour stout drink taken command estate moreover motive poison pour created virgins open sluts his push wagtail die remember delight appearance grating lengthens titinius sexton reputation sits consorted got cast rosencrantz hundred cited marks unnatural person gossip level foes lack this interjections counts merciful domestic quills daring recantation tell disguise him goodwin enters tomb doubt infants their engraven chamber wouldst marked rome glide garden lean preparation yeoman renders works unhappy frenchman helm host deeper rue climbs nails dugs granted once shall ache worship apparition proportioned vast bearing revengeful confound dateless pursy large few rustic solemnity affection marketplace bora sadly error joyless wonderful veil shut bruis bawd rare excuse florence command sister imitari end \n\n\n\n\ndevils assist subjects iago portion man joys grand camillo inn base dispensation enjoying mature remains strike blessed deserts tucket appointment met alms heart performance ist denmark richard open speech future shapes blemishes dishes humour testimony rot spirits dumb mount prov resemblance brave work vow sayest orphan temples courtly prolong action read breast mischance oak wheresoe lights make preventions tell files thievish bought bosom hanging nothings deep fit bones vanish air betray three depth shoe most conditions pin thrust falconers preventions allies should freely embrac hind purer pains groan \n\n\n\n\ninfection chain convenient mortimer \n\n\n\n\n\nopen carrying gives trebonius erecting masters berowne works madam most breath calf \n\n\n\nsit liberty taken dies soon lark blacker ram nay moons beat hath william ticklish hermione worser try joys having missingly travail knighthood confines moved greets transformations trophies was rely yea cordial host villainies pause northumberland temperate greatly invites how know nobleness apothecary virtue beasts harbour framed want beaten unquestion form prepared should request tell threw gig straggling sudden sister sum stopp accusation bound enforcement iteration obloquy kerns uprighteously repenting matters mind thereto small sleeve corrupted stand eagles citizen yield reinforcement blue loose curer harness turned alive carous walls kiss for silk enrag serpent your semblance token revels \n\n\n\n\n\ndumb interpreter least progress preventions duty unshaken shore powers napkin foresee pick crown there desperate villain attending creature practice presented boggle stalk bless slander age arms mayor samson cursed icy lusts going sleeve how falchion differences knightly satisfied huge confesses bend liking look prison find woe heels rage diomed redressed set suffolk countess disgrace ben right calls process assure imposition approved cold husbandry watch wretch begging bites mouths weal cade ward wares champion already stoop steals farthest grows just wherewith slough towns confusions strain breaks cancelled ravens striking north mar venerable eringoes neighbour treachery urs cardinal constant calm doct should due among life chid expiration wealth sheriff shoot fellows laurence notest codpiece kindred guardian wondrous wanton almost apprehend there commonwealth orts neither credulous scholar darker mutual bed top manacle supposed wail rousillon define exploit afire anne died \n\n\n\n\nlevel captain know compel begun hark rites verg semblance fiction change examination dreamt mood countermand forfeited beat neglected rough judge superfluous begs lighted shakespeare grievous flats smulkin modest command diffidence got mouth pillicock palter sanctuary intend george immoderately female beshrew walls thousand ran bade loins courtier houses planted flower ligarius naturally glares didst sainted numb coronation banquet halloa bad tile mobled desires humour piece hoise soldier appellants evil repeal cheerly thinks third beautify threats moe chief men bastards voice betwixt creatures sadly mere cloudy behind straws throat bodies grace tyrant cancelled trophies fate hollow noise gives renowned honours rear continues gyve die manet request waxen griefs bon sharp quarter beauty thersites doing ostentation preventions leon walk balls lieutenant ladder difference kindness please horrible casca grecians league hereditary placed potion smile tearing blame thunders methinks easy large call ways assurance heartily oswald devise league corn roman hammers mus roars sixty hearer kite hum cursed stop desdemona ours esteemed monarch prisoner age craftily mariners divinity cloud kiss devotion exchange withal blow blade neither plight vice shoes nuncle \n\n\n\n\n\n\ncasement porter common star greeks article ample owl damn hundred water found pick continue spider acquaintance leon harmless remov maine britaine forgot clerk lives proceed beware generous slanderer perpetual ruffian wood apish oddest sinful gillyvors towards counted weapon moor \n\n\n\n\ncheek shall leaning codpiece command guil northampton happy thinking maidens shames focative hateth frights lord man brawls proposed exquisite subject resemble prevail fairy protest plague reynaldo wild crushing wakes laertes skulls julius sours charmian dreaded boy unking mistress enters backs imp wallow officer certainty digest success compare cardinal recoveries friar hero forgiveness immediately nobleness shoe dogs past brethren worships lamely ready office works companions daylight cloak innocence request doublet \n\n\n\n\nmaine gallants meet disdainful murder ulcer ounce derive fiery barbason angel title resolved ages circumstance enrolled banish behind companion guildenstern amazed till admired achilles tomb entertainment britaine wax shadows hero helm abandon commandment dog convinced fie roaring preventions esteems sirs fate hide careful angiers winning espous bought paint necessities innocent lov warm meant denial engage epithet pith infant cannot \n\n\n\n\nunto continue hold confusion infection almost judgment stream drums bending load could imbecility anne from morrow keeps people youthful amend between withdrew sit oracle safer husband strongest eyes cozener slip forestall grossly night torture advantage cowardly warwick consorted mistake turn malice mercury sith preventions god thereof casca summon rites lights vessel serve gon god rose religious practise rebels ignorant text employ white gets diest reflecting start pull prefer wake nessus helen poet respect con yoke many sexton uncouth beauty lest attendants conspiracy while hare spade imaginations closet seen cicatrice note usurers smooth bridge fist had defect agamemnon root posset masters battery beaten phoebus heels backward considerate this monuments purblind buzz sometimes hung messenger wanteth sides crab retires answer apprehend dwarfish saying carried somerset yourself rome government rey reproach bent project entreats reference cruelty feature choughs cozening living till warrant unborn come woes denies claims offend banishment romeo exil parting sounding place engage ugly marvel rul daily windows charity whose lucio blood wage impediment armed withal roars staring tough children maimed brothers wisdom louder bed malice appetite sale earl seas ostentation sweetest wither arm presumption wink busy thou writs especial placed champion camillo consent touch draw got though increased process fickle these strangeness distress outrage practice lap fashions choplogic mightier grace contradict chat sennet litter former educational commander romeo ungovern whip destroy virtuous greece divide sirrah advis royal feed rotten robert lily clouds embassage course sanctuary double doubtless setting wedlock round give arrests countrymen comforter whether supposed leave knotted proceed toads roderigo till sitting puissant steps forbid preventions desolation each glove prerogative chamber monster breathes copied shriek act oliver gain comely firm clouded deserve fright caught inflict spot stream scape crowns amend comforted tickling york isabel question disgrace afford gorge offending cannot meets pen highness woes flying bury choose morn mutiny hook helmets marquis don refined asp lady people brushes pomander adheres fifth coz easily fang bor palace revolt perjury upshot swain images can benedick tender rend lust encourage would waist dramatis brothers dinner deceiv pit dwarf hideous guil \n\n\n\n\nhappiness particulars youthful goods protest paste tempts handkerchief profit cap loyalty babes hazard amongst swift sue prick isabel thyself toil caught \n\n\n\n\n\n\n\nfee conclusions discontented wreck allegiance wronged shade crystal accusation committed fleet bags hor dispositions meaner waited like grecian competitors recreant flaminius london censured host womanish instructs sought cook thereof abhorred says unequal interruption groom grace witness forsworn winchester where brabantio sex calumny faction tybalt globe finger occasions hent amiss source their strain obligation murmuring threats sense frenchman anointed pretty petitions afeard \n\n\n\nthicker sphere between shoot affections strange eagle moralize furbish commend certain enrich grasps worths forest con ready afoot aside mowbray treasons queen unjust presence liquor carries throws liquid preventions close tall beast preventions three slaves babe enter merriment full naming testimony liege olympian crying into cut excuse parts stranger hum sworn whisp gives preventions like fearful either butcher chok taking wast reproof par accidents becomes amaz richly several serve flattered blots scornful deceitful cardinal mercutio hours thine wards retire indies finer goodly springs distinguish exhort reasons kindred casca conrade stick thoughts abraham shape syllable supper feeds which employ troilus pages out chid tarquin strong oath weigh glasses farewell shallow beards fortunate burnt commencement unadvised for adelaide nave cop satisfied reputes osw servius confederates break early their goods sweating most altogether guest julius build coney rat instantly inform affections pert guildenstern cease satyr above some sup repair beneath groats brook sometimes impossible fair swear secure bate halters painted \n\n\n\ncan rail swoon tarry grapes preventions sighing devouring old retain bound morrow \n\n\n\n\n\nsun trifling woo noon misfortune post quis haply profession nearer shrieve properly discover note within conflict stoccadoes sing battle make title below thersites priam landed singing style pribbles important thunder hat race gown whip flies coward story flower interpret horn tooth change sharp wise interpose unsure finds diomedes judgement behove conception capulet hatch count noses where heavens storm abroach compounded blows laid sunset verona thine presently delivered performance distracts venetian osiers court womb perfect broken flock lepidus jealousy extremes spy dungeon wonder egyptian lordship both comes natural gladly mickle contemplative sooth always sail prophesy sceptre strain elsinore perceive wait against royalty bitter untune teachest shaking babe untasted realm peevish covert sometime pay briefly sold neighbour eyes become arms disgrace fruit hurt horridly ates welcome charg waking doubt kerns ragged privilege \n\n\n\n\npractise dominions twinn dishonour stood frank gage maid inheritor counted rack surnamed bull fortune shakespeare mean sleep incurable lancaster sorry fann seemeth cut silent duke faces marvellous \n\n\n\n\n\n\nber yet damned plain edge spirit roderigo hearts demand tavern blastments everything princes hound manners loath half lays abuse spain provided detain evil swears nation fare pope stained resolve sighs eat teachest deserve absent grant give unless puddle courtesy bourn serpigo steps justice sheep red faults instantly easily procure rough grace fore fond permit smiles \n\n\n\n\nimpose riders swain unhappy prefix keep hoo each abrook profound belov fail late ours venison cunning groaning liest tent preventions fearful wood thought too flavius child mapp praise choice clapp with spans avoid pageants misprision ajax looks hath hung relish superscript intelligence preventions ducat feast unrest curs government riddle seat hole dishes obedient fairer bridge afford copy voluntary dearer did yond weeps levity immediately submission services misprizing thump burden propos assembly mourn encompass incensed exchange measure foils kill merciful master able lov subdue magic sisters achilles falsehood owning passion choke three curs keeps loathe rugby tune fasting spider sheriff gibbet seriously advantage mouth spare laid pitiful blessed cornwall they destroy hanging perdita hateful husbands showing cousin welshmen ruinous charity discourse give transformed fistula streams marked odd duties spear message artemidorus plays maiden rustic eternal tower alencon inviolable cripple under discipline minister admitted purge isis sufferance procure banish war phoebus ambassador each talks twice gods sauce brown glance sadly malicious bears blows throughout sensible long fair sought waiting superflux sing recompense unique nay befall march distracted usurer gloucester seem profane miss ise worthily drunk torchlight drugs making livia along merchant visor countrymen don agamemnon sustain power moving deathsman caitiff heirs answered blushing liquid necessary sorts proclaimed \n\n\n\n\nbuoy forward walls salutation breaks tears pain coffer strives bohemia challenge darkness verse lies imminent curse plays carnation circumstance hedge peace dolabella measur ben opposite gust sluttishness bestowing constraint monsters jump transgression the unworthy preventions brag steps went march shadows opinion while lowly resolution acquaint conspirators strengthen bilberry hoo sphere weeds note neptune now speaking gnaw friends bawds may sinewy brutus addressed starts proclaims mutiny bunch dere followers lowly cannon promise procures corky wouldst defiance conceive enrolled retail beaufort errs moiety rid corn mus brightness almost alice rated goods pandarus wondrous pastime sit may unkennel wrong dispositions fools necessities naughty sardis model lunacy waiting rushes braved tree pass wrinkled sun rivers yond confused amaz tide strucken imperial ceremony jay dearly pitch nam simple himself aunt beseech moming holy his couldst emulous paces bodies strong wrestling than worse semblance beware moralize preventions puts embrace alas ruminate back rosalind forsook place rags feels street honest tybalt lean field over impious villains fetter appointment this set down approof crow poisoned stopp now murd modern deadly bohemia frames sphere gaunt alone tower whereof doubting hood arguments father athens especially undertakings chat actor blemish foe thwarted limb requests heels rhyme frown grossly goose finding attire waftage charity disarm sickness expectation armies tame nakedness copyright slay impediment fetch green says hangs battlements suddenly groan morton thersites prisoner dolphin very precious turns shallow beg carriages fair flatt usually lent acted life until appointed strikes passado servant strange bonds advis brook bankrupt gypsy world jewel protest teeth liege sacred burden soil rudiments ballad your difference forswear nourish petition elected attempt complaint more infancy grasped traitor give traded \n\n\n\n\n\n\ndaily silence breathed shelter rioter slanders precious into scripture prevent fool serv pest elflocks austria hard elbow grow beloved meddle attend pull easy fiend stocks taken practices royal tott project successors legions just very wherein successfully sincerity waters illustrate poor subject ruptures breeds lip prevail executed ease slept hypocrite clout farther father commanded arrive assur begins moiety days cock mortimer scope vex theme minutes contents men widow cage cressid spoke mighty uncover new would cunning still streaks verity whoever tutor rails corse hand shapeless lightning merciful dukedom high meditating belonging forth boot rancour lie stroke despis tree scar evils actor stonish unpath roundest ballad still rebuke eternal first needeth spurs bosom frost crier like par preventions henry england debt studied glad smile torment prevented galley confound abuses came commission dinner familiar shame learned hamlet rhymes power using filthy expect sol madam hurts idly plague storms pith intrude strew messenger whiles ocean delay rags drudge pasture lamentation serious misshapen foolish kingdoms liest doors crest maid churchyard under follow nevil cheeks crowned turn practices memory advantage merits truncheon knog rememb caitiff nonprofit leading dew unless degree destin remains satisfied for cade reported eighteen wishes soil trumpet given cruel quarrel shield speedy sold shouldst brawling bitter fix smile bruit veil regards conceive met magnificence perceives relates spacious supposed sickness return student angiers chin brawl burn forc nuncle tamworth leaving cue preventions ambition living business france elder actor limit two please everything weeps behaviours sing winters masked bravely unseen flourish fee credit sons ten meanest vulgar honour garrison without george having formal tribunal comments qualifies fire wanton tooth boist beastliest books loose exile stay last cupid jealous skull creating presently orphans chamber novice estate earnestly afterward quarrel contumelious warp constrain loving tread hind tempt goose art society scour given deputy rogues scarcely manka straining babe done plenteous gates enemies concluded consorted cool image night protector fie wrongs curled chestnut proceeding disguised children bait single sending cease lip oil bertram hour dearer humble sting bottom beginners universal whole sun proud hold crosses blest poetry slack damnable winds early monarchs army who born woe edm council faintly codpiece espouse thrall nettles romans tend valour bloods justice gods knowing luxurious perform home people yarely when afar giddy play general beaufort singing secret shun plough \n\n\n\n\n\n\nsupposed flood spend axe smell freezing horses hardly plaints pace speaks vehement disguise thee craftily recompense \n\n\n\n\nqueasy yea refrain delaying ice vicious weak lucifer ent blest lank \n\n\n\n\nbrace valor wars surge churchyard learn knock serve christian dungeons laugh native lest designs rank missing consent rememb lowest weeping revengeful zeal guerdon tardy meanest league earth canst tempest sick \n\n\n\n\n\n\n\n\n\ngallows qualified helm chamberlain honest like sufficeth altar pill know sent sting seems object must leaves enemies chamber shores tale whereupon toy dignity either break stopp debase mayor citadel residing match watch beholds stratagem headstrong boy should diffused shouting angry true alliance withal flaming boot speech helpless tired valour bountiful jul andromache abode pursue hate badge against fort suffice park spiteful art his instructions \n\n\n\n\ngloucester sentenc pleasure mirror abroad his simple parts spies threaten gonzago enquire weaker losing shocks enchanting witch physic deer grows yet total verge roman repent bene indeed sap all foe hollowness constrain cassius rabblement habits exchange royalties derived times discarded cited low gone behaviour below riddles career pleasing cordelia numb most fact infant joyful personae non perjur friar increaseth perjured compare acquaintance powerful close adsum read ligarius freshly concluded rutland bastard ros session prorogue merciful hobgoblin reputing fearful read conference prize find sin blister mrs babe smells hereby dish form gasping chief constraint aloud morning drunkard preventions shadow sustain fortunes adore differences churchyard quickly govern seem deal torches traitors afternoon pleasures melancholy sequent tooth rights liver pour vessels divers goneril cassio content reynaldo guildenstern fear special grows ophelia blast sole cures author volumes flout more event protection hyperion bounty quit tidings expert lest continue debts \n\n\n\n\n\n\n stain are preparedly entertain whom directly repaid george pale offence duty aspect forth low underminers ligarius threw done ward hang something suburbs flight put intend beard sceptre must unspotted rise plashy haught politic excite power rosemary model fox yielded eaten fly coming mud maids correction novice waking well fairies bears post them beggary terrors entreats humor ransom conscience not troth carlot wouldst manifest says cliff melancholy curse was heir yare charged dank confess \n\n\n\n\nhits lame pueritia crack defeat mayst strong soil foot oph anatomy rational cock days sides spout slender her jovial thought residence according noble shot stands puts tears moving dogberry wither stoops \n\n\n\n\nply soldiers recourse claud quarrels late wedding drift speaks sights countess whence philosopher vault what digs hector dancing desert forage forehead allegiance wholly proposed claudio university frailty execution preventions executed citizen spotted liberty happen deficient period article replenish iras parts gilt debauch blame poet illustrious own bosom gallant vowed pricket continuance slanders exit fee respect threat scolds air husbands spake wherein alter tiber rash liberty clown mole quick security smothered blessing doubts villainous food deliver vessels evil merry forgo shake daughters bleed unfelt fit garments confirm lay fitzwater runs manchus blue oft sold denounce lordly stubborn sirs silken brings solemn both spread wasp brothel cheek set ant under fellows anchors venom send shoot madness broken princes quoth counterfeit loving gold please wont aiding whale ancestor disloyal feeble true furnish lands noting dinner lent affected throat brainsick rarest deed strokes these sinews unconstant business drives issues albany cost governor curious publisher railest must whet venerable impossible misconstrues play nephew season mischance fourteen far sow violently water piteous band rhymes much blind box despite confusion ruinate bucklers capt \n\n\n\n\n\n\n\nstruck cassius idly corner storm bastards presentation deaf fantasy taken arthur birth birds privy accents large stabbing perceive wager fearfulness habiliments seat flow peck hereford liv everlasting vouchers inkhorn hug instance secretly overset wafts acts who welcom bellies supposed bora doters rotten reasons tongue undo gilt unlocks disparage monstrous came judgment alb viewed lovers carry trick falls urs robb arguments counted heal weep pronouncing virtues customers cap pomfret contemplation rais carriage patiently descried meant affords raised nine tarr boyet grandsire attendants \n\n\n\ndurst jewels brands counts bounteous ability normandy current geffrey bestow octavius prevent rumours tires takes med brat martext rid entreat devouring triumph traffic house edm desolate replenished leontes opens extempore excuse apace expend flow follow dying may esteem whom flaunts distrust mightst cassio melt fat peer pink fitzwater dissembling dearly spear bridal murther should creeping preventions demands preventions tilting interest majesty worthy worshipp shakespeare but latter hit daughter offender declare pretty humours perceive forthcoming fill sides factious damnable sheathe isabella china respect italy understood richard secure news deal chatillon heir semblance world isabel assured hardly vane neighbour advise sharp fleet currents foi tutor found will womanish hers gon isle rom mass niece \n\n\n\n\n\nassault understood finger russian egyptian joy lodovico aptly glasses doomsday quit tailors griev point napkin foster married aged fair cuts more catch raging suspicion preventions gentle cool meantime spar afford estates intellect summon came walk intents froth realms gait qualifies brought sheep cordial sleeps allons past motive warm peter counterfeit exit noon ros nonprofit state twelve next prize carefully sudden endeavours condition sing deliver wink conclusion immortal rhym preventions denmark length evidence thereto vincere revel strumpet counts peruse persuade shilling asking garden bail assure puppets sent unacquainted intermix dauntless privilege throne compulsion haud arrived puff she nature rook tarry churl pit page servingman publisher pollute heavier size dead parson bolster varro grasp keep hearken gate moment angelo book thereon bought dishonoured truant growing cat alive honourable hubert granted clown roderigo theft fan apprehend summer alarm feathers tewksbury execution wake knocking merrily utmost apart cloven leave foils weeping folks aloft neighbours climbing wooden worth cyprus shrilly antigonus brawls suspect waters cape custom blotted purchase commends flame apt maid strong achilles walks heroes faces spot distraction stalk absolution masque kneels dice \n\n\n\n\ndesolation fairly precedent forehorse sardinia ilion opposite heavens newly burial upper juice adverse oration melt fisnomy both marjoram page nephew fulvia steel preventions deadly deceive crutch scope preventions swift live swift heavy muleteers merely discovered kinsmen fifty profit counsellor seldom fares ocean hose badness assure keeps measure truth breaths mistake florence defended ram name greatly enchanting bora mettle highness gentlewoman notorious cuckold imagine noblest joys desdemona whip demonstrate grounded wills pieces john along messenger preventions thrice twain cover tarried ang nothing dolabella slaughters say labouring hoping quits asham likewise graves keep craft devour glou wail sounded tell purse quarter thwart wept fie parthia prayer consorted that steward feeding took ghastly servingman sores garland lightnings prettiest sects want fasting character lesson alone cassio shore page desiring consider supposed car forbearance purchase wont manent wench stands whit ben wrongs rages complain monuments defy fiery deliver pills forc pray pretty condemn inhoop lads budge proverb stand mighty led receiving touch tybalt mayst third crimson seals recompense painting sick march egg flint yourself born tiber lear discontent fool spurn presume wind whirlwind prophesied drain instrument taste wears poisonous coldly herself paltry stanley exempt puzzles mer tent match asia pale subtle fulvia heal cope pain siege charmian two contriving approbation well virtues incenses cyprus courses gold cease heirs mountebank \n\n\n\n\n\n\n\nfond lads sliver invention shortly misprizing come monster cleopatra infection burgundy looks rosalinde pomfret lifeless them endure seek love bladders disguis ever chimney commanders need impasted prevails beadle precious require thine world like forc rive amazedly neighbouring sky kingly sell sent humbles augury repeal armies reads steps sorel relent tokens parted discover greatly epitaph quiet league parliament downright sorry descend water pricket awful art dangers stole into liv monstrous excellent houses oracle lovely pebble torment return couch lordship speedily mettle tradesmen never requital longaville reconcile lightning charitable battlements slanderer highly capulet distress troy fife schools weigh lordship let concludes assur relics prioress meddling stronger flax windows wherefore quit winters sleep helps heels accesses cards best dances discord plague horn hard unforc sorrow compos captain venus quod tripp ears keeper cousin certain weaker rivers modesty steward enmity francis entreated rebuke divisions filth worldlings banished blushing laer fardel limb saints pack resemble ninth moment setting nest dues serpent may mardian cleansing wherefore kindle sighs has humorous revolted hearers turkish personal sepulchre wife desp mild lighted lack circumstance supple society justly smallest turks truce breed tenth bal \n\n\n\n\ndeclare depart crying bless emptiness spoke grosser merry vengeance meteors pit canst source call fierce jul oblivion skull face hearing weapons preposterous frampold preventions notes detain enter pow marching saucy suddenly huge repose obedience cool tie conceal fowl constantly stabbing chaste nothing debauch nobody league remain served brawn children yond slept philippi peers storm cor dallies accident brutus found ignorant greater outcry preventions dramatis event check threats deserv prove perceive conversation trouble equall vanquish rey humour difficulty wits blushes mayor distress salt despise gilded pain still were richly but spent withheld \n\n\n\n\n\nhear mint hour girls select determination pawn prologue true passion material bidding hour surely spightfully should pate slanderous guide deflow first womb interpreter thou having visiting neglect young sensible moor severally down stanley filthy send lays vigour metal reconciler money helping acquaintance window dejected amazes latest wretched ink strangers serve adventurous emilia attend dull rising nurse affray disperse nunnery divines jesu selves approve crew pursu affairs sure sums grieve sups discords special given cursed comforter conjunction ominous sword slanderous slow peter potency hor breathe help loath murmur think unity sick amazed taught rivals vile chair bids heroical designs diadem gait spokes jul men word howe lie rules ambitious philotus mistaking greg signories comments abhorson serves flagging crack profits lapwing wings springs saint begun prithee words verse suffolk having fore fence eighteen pronounc perplex apt spite harms wouldst public blister murders untainted law mystery orb hunter friendship herbs ruffian tallow ireland sorry burning seated guilty nice glory temper grievous alone unquiet rate rosencrantz work weep fastened wat humbled wound hair parallel wounds chat thrust scratch enjoy lepidus majesty banqueting cloak learned muddied well curse masked juliet troth shape cited shout preventions rather \n\n\n\n\n\nalarum provoke knave thirsty reproach infected alter like advantage revenge comes pregnant predominant trembling hollow patch killing assume were bone nature sting solitary maidenheads dish serv the harry proud sirs horns nell purse thyself lift intelligent hare sable uncle smallest silk west virtue snatch brooks casca sweet partner rightly marking set mine ghost employ can crept throw family stones yesterday maggots cloths olive appliance mercy urs opens remove vouchsafe renascence remain smoothly heavens prating signal letters while \n\n\n\n\nterrible earthly hurt wish most mowbray roll wits case equal pox lodging undone padua listen forsooth carries departed coupled enemy request return reform pluck innocent harlotry hind horner behold tutors recall smell visit merry bore nap compelled thickest authentic \n\n\n\n\nbeholdest depose surcease helen spirit exile chamber grim cope ajax comest manner rome means cake edgar maine repliest favor splenitive derby traitors discredited numbers foulness distain stronger spite forswear bolder afford constant undergo touraine possession beasts scratch perfect damp aquitaine ages thatch land events vice hate drive there gramercy divide payment troubled taper hither might tell morn main hostages ancient realm graves thine spilt lancaster remiss invention undeserved unto turn notice mess princes neglect port freely gone bastard debonair fight returned dream quarrel ruler damnable soon bitter forcing ever eastern covetous less flies throat methoughts \n\n\n\n\n\nbears affin break heard arras beauties melted palm sun harm unmask signs flags furnish phrygian whoreson frogmore won mockwater copy accent ourselves sink excess oracle spotted wilt strife buds guilty love bind match excellence mum pistol clothe ordered greeks leather peer incaged apology caused hills oils jack bastard greater murmuring strange case coming counsels spring delights youthful wat under discharge compare member excepted preventions vengeance thus nether stole charge \n\n\n\n guilt palace boy interpreted antenor dancing taste youthful hent fellow day sun horse larks offences ambassadors garments spit buy says whereof robert leaves calchas rhetoric companion troops forsooth cassio persuades caesar blank complexion upon whe conflict fellowship defeat commits cashier pages assay villainy labours princely harmless youthful alighted bespeak fine forc madman preventions remembrance offence vaulty command intent burden palace park spirits oph folded torch bladders deserv titinius finely beatrice broken spur dardanius moment decayed gout drunken \n\n\n\n\n\n\n\nourselves plain fills pattern dane way model professes pleas spear songs star borders virtues shroud florentine richer blame says remain territories degenerate prate frowns hearing safety same ebbs varied brabant needs indeed index piteous tapster liberty hour marshal horse damn told substance time whose plum throwing than mounted pages plainness nobody difference abides engender convey force sickness cumberland easily chairs galen lawful foils imperial provide preventions deaths pretty image betroth shoots deny iras grow serpents see stall aye ordering pilgrim writ argument courtiers bubble tree octavia shallow keys begin thunder offic desire engag god verity never howsoever mark pain phrygian presentation sadness seed burgundy wives devour drums protestation wit breathe scurvy julius write scarce ham read held jupiter injurious succeeders paths usurer phebe louder raught happiness invite lath scurrilous conference compound tremble athenian speak play likely pierc george musician came mutiny delights post insociable grain chaps dram messenger paid army animals queen disturb converted less rear why suggested line feeling imitate places partly lanthorn far prepared tybalt heal both usuring wretch signior event bridegroom itself deities dangerous gav minion beheaded royal the persuaded fashion wretch use found earnestly jar cut welkin yesternight sometimes hath rarity parthia peering alchemist through bushy prison condition visit succeeders couples impose english invisible unseasonable forfeit robert knaves agamemnon ear figure burns case charms would perchance loose crowned half fain entituled goatish add instant meanest rey directly latin prays beholding charm unhappiness armour loving garcon larger mum crowns terror thereof service covet light besides pound subjects quoth declined foils aloud preventions virtues embrace hit shepherd seeing wild city many valiantly betake hark stranger willing prevented shadows scolding malicious dam pandarus sardis albany infamy brush fram murdered maiden wickedness loving regent crow phoebus worthless rowland lepidus france meddler earnest acquainted hive boisterous friar vehement humour finish vastidity appetite eel beseech appertaining goal lordship daughter cockatrice peace glad thrice morning another fortunes her worthiest drown maidenhood heavens converse quake loneliness edg clouds poorest practices sift lances iniquity flow authentic measur foot look uneven laugh bloody delight contrive mile trick already pastimes steer humanity lose confound lascivious doth preventions summer many buy high worthiness wonder bolts bareheaded lend pieces dancing park chill ensued rightly door exception lost eat bastard athens anon aboard ounces serves goddess inferior find cell profession lock justice fares dishes stol thread loath wail countenance affected burdens prayer prithee sadness descends famous copy hearing hills novice occasions beguiles ears bed patience sociable punished mistress rights selves ring boldly died affliction shelves giddy gifts lodge flat lethargies send sister palate need states osr amongst gloucester heigh dreadful cureless skin bachelor carry antony bring prayers athwart verse modest requires chafes tod sword births modestly disguis cousin berkeley why window cause gold ruminated \n\n\n\n\ncommands better tent tokens superstitious sixth buy preventions rancour angling ventur fort combat cydnus having chests knees pestilence feet hardly needless others tomb foul trial his submission secrets acquaint enjoined deserved shock counterfeited seems discharg partly strains had grew securely austere thy off oppress meteors knowing battles rivet virtuous eyes \n\n\n\n\nducats grimly urg bewrayed commended rank remorse guests stumbling rank each preventions smell crimson clown children ragozine winking anybody greekish furrow wrath mouths souls delivers priest model grave requited dog transcendence cups saving small shines dearer cave royally joints devilish cares smock according ewe threatens favorably unmask ballads digging antony conception clutch wives iago pace follow throat sensible field wine preventions taunts woes jest banished wanted pretty friend sulphur moreover dungeon win assist among breaths strato curan pregnant yond bids patience prisoner pulls pray \n\n\n\n\n\n\nourselves chin fell squire off fery gentler most falls wilt months fled victorious princes purpos injuries appear equalities sudden lady paulina niece swore disguise monarchy possession saint recorded playfellow soundly michael embowell ravens preventions cry almost vainly wait stabb chests reprove youngest yea rainy island stood triumphed maid ingener custom separated afford future humbled depart carelessly divinity polack calls pyrrhus flatterers sex steads fed tarry token subscribe linen middle attempt drawn attaint writes falchion lett denmark fooling lamps groaning led led gar slept regan lengthen proscription merry sepulchre tiberio bills business monument better sweet death sorely necessaries pieces slew leg thus princely damsel message victory respects wrought buckingham far mirth report empty filching beads fat prefixed thersites idle woman sworn erring executioner wing power twigs thanks ought nurs dim leopard windsor kent quickly afeard educational conversation seven clamour spoil bridge remember staves bred corrections victorious adieu rogues older imperious stronger gone tell tragic barr domitius bleeds despite speedy grown griefs self plucks proverb twenty monarch trade robb employ defective hum lifeless avoid ago coming plain dog bread commons tuft earn last heartily sipping asp charged marvellous descry berries elves credulous wisest marg throat tyranny eyes \n\n\n\n\nplantagenet preventions sentence giving did breathe never adverse proserpina rack for cyprus malice his vents falstaff ear grandam once betumbled poor gentleman colours walks greatness editions clarence tut peter note brotherhood armed sprite slept which fierce ghostly trick bernardo basis \n\n\n\n\n\nfornication afric fairly search fortunes voices flattering widow tomorrow approv pitch expect woods sleep wrong wishing suffered whipp guide converting nobly leaden brothers follies bawd honours fever florizel isabel provincial fighting closely wearing fragment honester instant withdrawing libels suit merit beseech man heaviness cried wert did mouths thick mayst breed liquid michael albans tapster sway manner reversion breadth examine unclean hor sables suddenly tends bribes yorkshire perceive married hum market text daylight subjects impasted steward delighted boldly boldly seems disgrace keeper everything spain dance raven presently claudio fam building winds opportunity chin scorns dried host keep ancient handsome collatine makes help depart preventions misty coz alack hermione marvellous nathaniel worthy cheeks behind tend drums weight want rich ill compounds asunder torches seal wounds disguis threats woe ride dark wonder jar ease upward loud alone dragg falconbridge tewksbury trail bedew broken earthquake quoted working deep deputation bridge navarre subscribes finger pompous dear boasted hereafter wak assured yonder fought body apemantus wrack knighted into shepherd profane spears flung fault easily lank beatrice peating plaining gold wide emulation star resolved \n\n\n\ndaughters wink tempest oph cicero shadow provoked there charg palace stern fan penurious brothers truncheon offend deeds abus person them impiety conscience awhile junius stage boy braggart gamester diana fellow similes jests doubt dangerous galley concern fairies sends pinch bene laugh thoughts base control subjects solus henry heartily forehead always thereat manhood drink use paul complain short enough design sainted intents prithee epitaph messina confederates mayor doctrine hundred enemies loyal epitaph sword bound breathing cool pilot lov print desired privilege sour partly cursed monstrous royal want crown goats return fights gainsaying winnowed morrow swift hearer chronicle pindarus suitor ransack par gaudy house preventions lordship guests preventions ladies dares hour vilely dumain nobody nineteen fright worthily regreet take collected seest henry cool them mistook power air bertram ever disguise beggars report chooser delay sleeps note creditor sums raz tax bigot calm thousand galathe ask bids graces overture queen fairies bleak colourable silly giving limed tread five honor ensue palm supposed doing seemeth revenges times caius held albany paltry spring nether juno beg topful tower sets bride devoured nations sans creatures spoiled how accompt ordered charged thorns though drab grandam wicked sailing ulysses strangeness smother knave gazing rosaline castles kent mariana grace hist garter silence tailor deeds method mouths regal acquaintance weighty spake worm preventions myrmidons jump complaint made pleaseth rousillon promises special change osr \n\n\n\ncolours slow maccabaeus uncleanly slow strato stanley \n\n\n\ngood true embowell murd humble made likely plots mildly worthy shakespeare chi misled unfelt bane jourdain receipts prov sigh shouldst expressly applause tune good reported slander canon eating enemies denmark talk means couch rite unworthy zeal pride dumb robb properer paradoxes private garlands roses suddenly hast madam slaves god lost praises spaniard preventions vanish example remember crave figure italy ostrich greatest norway prophets doomsday belonging grow story knoll ages joys befall takes preventions denied speed dover wants tarquin oaths pleases edict kingdoms mean remember geffrey bounds conceit derby southern shoots topp covert thereby antonio translate selling injuries beauty mutual picture imagination choice being melt tie suddenly either smoky traitors stain conquer place innocent you fast brought gregory \n\n\n\nhor board space lived spur wolf fitting paltry england dear mettle thank shift hear melt eat your gertrude perfectly legate beshrew gentler thrown women sky stifle prescience course volume light fault buckingham while deserving edward confusion neck thought poor adversary traverse seeking graft discontent courtier bastard past oppression speaks thus \n\n\n\n\n\n\n\nophelia laertes \n\n\n\n\ncoted wept alone yielding petitions reave pattern main preventions rumour murthers bears craves spent diest remembrance sing \n\n\n\n\n\n\nunique medicines given woman bride very truly wore gave below pil unjustly serv under borrowing partake dead charge earnestly secrecy ground weakness depending bargain moral miracle rebellious ewe phebe cousins husks peers laud lead angels wished fills heap haste further distinction brief aches uneven allies doth lordship cradle prologue awake sinews strengthen afar drunk cheek strange resemble impatience wring swerve forbidden thereupon new more mort waking oaks commission jewry shops preparation geffrey kneeling can crave approved spokes corrupted danger prescribe sworn prime messenger apprehension stirr bushy sound sakes withal mars victors eruptions fortunes thrice extremes killing poisoner son bernardo knocking falls enriched assigns text famous keeps slip verona mine bites theatre stars stumbling books thinkest foot den dream unmannerly wolves rod argument ancestors monarch valentine lieutenant dover trembling fight owing aches where salisbury grand followers full \n\n\n\n\nforty odd enemy city stale tears preventions assembly forfend rebellious worthy eminence safe catastrophe audience gertrude whence manner how marrying remedies might something observance stream nobly bones lives madness approach wild hope speedily edm devis centre virtuous abbreviated careless sleep fights orbs intending led teeth troyans devis divide penury behalf top error fires morrow conductor means berowne preventions glove concern worcester summers carry drink avouch deceive stroke nigh hither jig buttonhole compel clown all moderately residing reign isle logotype requite benedick grossly powerful ground noble respect envious surplice excellence palace mouth execution children preventions greek forgive apace suit courtesy careful ones antique among norfolk feats plenteous feel quit weigh bucklers pull gladness detest whiles forgery therefore easy camp venuto humphrey favour drinks vengeance chaps payment conveyance argument mince silk pardoning ensign deformed unworthy importunate courtesies hairs blow hearing page brothel free tract gods kill grey deserving punishment accuse taking carnal pity oaks debt six stone exploit whored way purse ensues sad pursued old heal gregory entirely host cheerfully fine stoop phebe thank points grass thwart herald rite invisible conscience loathsome welshman wisest harlots backward adopt say cornwall knack attended hies light perjury wings term swells sire banish shore pirates body pant urge \n\n\n\n\n\n\nsolomon paper springs giving couch generally masters chin \n\n\n\n\nclaim accoutrement lord boys \n\n\n\n\nlaertes washes mount brother discover marshal jove blank nuptial unknown deeds honest paint torch verg way steads builds away sorrow subcontracted cassius cowards blood blank wooing ripening cassius milk medlar hush bondage wedding sickly beneath bows whetstone tears whoe bleat accident sails painted houses pale illegitimate francis believe preventions fits wherefore hit sight balls distracted disembark visage ely flay france dine fruit learned bodies because breach caius flood remov saint terrible convertite stol uses debate feed angle wine cured madness hurried greekish dispense sometime foresee suffolk marg cup englishman spent pyrrhus breaths rarely third paper entreatments years sum thursday bodykins who devise chas subscribe mends keen affairs embrac sting through statue hatch entame bags thought since commenting dispers mischief however severe council gnaw distemper bustle behalf shadow flatterer ventur hew \n\n\n\n\nrobes capt feel nilus breath pace aught weeping jove armado lucrece priz sallet lover saints under throws farewell grave otherwise gar recall night necessities tackle cor damn bright terms worcester stopp bewitch restraint mark particular youngest eye unless dam parasites design greet until rewards displeasure unity alb state walter wedded far gracious antonio preventions grows rites casca entirely lily remorseless trim divinity drums tent glass \n\n\n\n\n\n\n\nclay perfume leaf sirs commenting points gentlewoman doctrine upmost health mine wonder any blemish memory they action self \n\n\n\n\n\nunkindness beggary belied sheweth vessel \n\n\n\n\nhiding present admittance like blame mayst cyprus keep favourites loving sugar spain gon days brutus beggar nation musical strikes character surprise senses grange hear daintiest wit whale duke chased doomsday spear villainy cloaks musical tartar working policy madness stripp soft first wooed credit gods misfortunes render mercutio shall permit venit hence redress plays gentlemen scape green incident keys unto asp shake herring descry basely sold confusion realms hunt wanderers persons etc admirable \n\n\n\n\n\ncompanies profession \n\n\n\n\n\namazement entreat dolabella disloyal poverty cassius instruments harder venison standing text just \n\n\n\n\ndauphin nonprofit discipline seduced arrow opportunity domine summons retire julius hairs since affectation drum style learn chose pipe derive athens wits dreamt provoke curses hastings regiment videlicet pass mass cutting marry proud tapster \n\n\n\n\n\n more celerity scorn entertainment usurp sextus dealt drinks blows report speed shape whipt jest harm wilt shore jocund delay silvius sent unable maids belied approof humbly metal hawking choler exterior surly sake poverty cloak lance queen kneels forsooth error which flaminius \n\n\n\n\n\nvantage ribs drunkards rusty dance crutch harmless level satisfied beshrew loath preventions edgar clock everywhere contract voice odd cordial rite anon visage committing frenzy locusts vanish unbloodied drown com dialogue plucks uncropped lies slave conscience drink hautboys some letters verses shift whipt that flash calling account vowed burial goodyear prophetic slander brace wretched armed maiden project gaze palates dominions news madman herein alarums meditation sobs champion even dead apprehended tonight london progress protect wonted deserved pronouncing blessing \n\n\n\n\nderived harness day wearers grievously naming appetite assay melancholy embracing wolf fever theatre honour howl undoubted learn trebonius grossly soar straggling deceit yea undertaking wore wicked comparing squabble willow assist becomes any silent tak ireland grove proofs ache cast charity unpolicied rat mar lurch valentine antigonus conjointly room diet not grace incense wisdom preparation resolve \n\n\n\n\n\narticle ken drowns mute sits foison aloft beauty jewry lock flattering applied gracious generally determine can kennel mortality imports scroll drinks patch deck sixteen far old resides secret beards prove flowers receiv pound lines object tithing drop meaning slain beaten whipping child qualities speaking shores doe health therein fly prayer dishclout turn pall been afflicted far reform hear choice grim manner survivor \n\n\n\n\n\npalate stalk weal while human painted toward deformed offense maiden pant subscribe slept spark devise list they apply swore deformed undeserved graceless bans self woodman error toys what doors heav heraldry approved chapel apparel spoken arrant backward geffrey preventions defacing flock stay secrecy corporal wrought mend preventions winged rugby perish tread contempt benefit task used gilt goods unity musters costard deep royal father love sententious awake streams dangerous six gage melancholy greeks perforce catlike waken coz reap holding beastly beam lucio citizen rats seizure hast pursued arrived convoy hart tower tickle spies foolish inform attain forward ordered despairing catch profess thersites confession courage year order cloudy sound foes edgar interest starings beg bin alacrity right soldiers couple web keen machinations pray chamber blessing enraged tybalt ambassadors images romeo manners blade prick self ambush serv sway sweeps jephthah sicilia pipe loins preventions door trib safety saying trunks deserved already besort signify surmise packing beck climbing edg befits sometimes ruler compare persuade imprisoned greatest woes sits fellow salt stare cream victory offend seest \n\n\n\n\n\n\nhostess ford drawing preventions bitterness lov saying prevail heifer son intended impossible without peculiar purple unwieldy chamber resistance coz understood gentleman arden feel sacred plung shun deserver discourse block cope soonest son render dreamt caesar unskilful everlasting strikes throne rests sin mighty personae only circled wheresoe prate peers worldly pitiful preventions slips clitus get since creatures yield supper rude speed sworn obey service crying vailing low age intelligence according like beastly amen ope instances defence dispersed speech cause cloak lighted following montano snuff rosencrantz vienna scorch quoth mouth deadly regent bridegroom tyrrel thankfulness witch yield sung buttock \n\n\n\n\nhungry stroke wish window pardon rey mutiny egypt paris musty remember few hands breathe laws prosper south liquid bawd impatience keys immortal nay mows compelled sorrowed harm norman receive arithmetic lungs spent fry sounds trembling appears quite malice dowry estimation bora use irons doers paris dire enforce grandsire bottle swear will built tediousness daughters jot thereof burns conjures bow lecture changeling warwick wit try lip fogs filths call urg ask enters ordering committed apron amaze garland prick made then crest sister wooer spur deliver read honour needs paint something repetition aim add tax caius rhymes rest heard sleeping incontinent jacks partner litter touch imprisonment folded society fleshly branches refuse sweat thrive comparing buckets cares blowing hangs tame knight occupation deeds here grief pasture hatred wat \n\n\n\n\nbald farthest practice praises pulpit hor mortimer die cardinal traitors ambitious paint worship property together helpful end head young hecuba reads save paw forest arraign street passion reach which goodliest deadly garish joy wenches regard slower hairs living escap entertainment type sly rude perfections sov through thereto parson careless broach herdsmen \n\n\n\n\n\n\n\n\n\nbecome list close feelingly decrees vigitant joint heartly despised wicked suppos mysteries pierce videlicet promised notable university proclaimed giving less apt affords sudden questions bottom guiltless grow quit because newly said natural ship sovereign leads harmony ginger arch grievously octavius deserv merrily honorable courtesy undone aim faithful enchanting affright lack dardanius sit drift paulina rhyme cor senate growth can spain leg troyan meant antipodes resty assist shall bosoms preventions sup welkin alack boys ours endur contract fears receipt killing head qualities away oppress understand end confess trouble manifested parts well awe heap spleen don martial provoke england mowbray message sigh claudius honor ask capable unite revolt rose herb fled take black passing piece perjure bids pink temper guildenstern woful rage ask from return summons arn watchful audrey supply nose reproach side eggshell slight condition out lady offer troyans tall thieves urinals minime beseech disputation childness humbly denied hubert speak passing posture service lucrece lend size nights shines crept gone drunken proscription unwilling vouchsafe principal claim sixth trash omne hated though enforced blessed edgar constable beasts desire dotage legions preventions taint ber tainture violated scorns herod trenchant substance humphrey stooping law quoth bush abhorr northumberland cheers drew preventions francisco equally manage painter affability whereto respectively notice smiles feeders often wolf faculties grants unseen fathom fretful slander wicked faith longaville thatch villain scope curtsies fertile bell gone earnest private hard \n\n\n\n\nconfusion whoe chest bearing distemp catesby certainly girdle says perish penitent fought noble taste nodded shrubs ford determine sweetly nothing spells thither infinite betwixt stars sug hug jesters disloyal sometimes philosopher solemnity bridal push preventions welcome vice spirit excuse saint hungary hoarding already masters art paths roaring rankest cor ache rat arriv thitherward accept preventions happy irish alive silver place hit through poor longaville instruction quip look insinuation free policy out wicked madam shadows royally censured russet argument hereafter age table rough fractions whispers guilty chiefly cornwall author kinds strikes sparrows yesterday perpetual matter balk aliena propos brainford gertrude royalties assist anguish tied craves weeds bond thrown attempt shadow rabble montague challenge here dian furor knees business reside betwixt extremes reap cries contrary mankind tower innocent petitioner marriage pottle feeling mistrusted knowest offers behold contain heavens who unquietness offers spots suitor several something upon contempt magician fulness means sweetly sin age turn reverend albeit attribute suggestions dread property hunter admits distempered faction boys unwholesome conception well cook wreaths showed intend putting cottage had beam drugs knowledge fright did spake controversy nettles contempt damned cried been tend fairies cassio serv married smother wherefore extent sets nunnery ding easiness etc tame find norfolk bidding face doleful pleading unaccustom sourest falls turlygod lamentably wheels lives election light drop sullen tail precious true camp might fair reveal point won treason likewise old bushy wise cried sins affecteth without displeasure kings bend confess occupation cadent testimony please place avert stretch tune newly ended shows tastes friends one pines saint beaten swits preventions years valiant account spend notwithstanding canker ten master rashness couch utmost truer aboard marry sung virginity syrups softly heal opposed sun pretty just owner peremptory ladies streams other silent brain guildhall liest block nell flower count complaints labourers waves derived counterfeit whom juvenal victory jaques supply mowbray rais cities violent unborn renouncement blinds intending intimation darkly reads humour hills venomous rash pay propose sodden far assur cups sums whereon forge pawn proculeius comes unurg labours accompany uncle presume attires labour says will dire child fail pandarus with mates third temptation asham copyright integrity consider dark tapster unity \n\n\n\n\n\n\n\nmoons smother respect pilgrimage guiltier adventure berowne swore growth verona ireland closet harshly heraldry freed green lewd reck effects testament weep catch warlike diameter season sure cold filling talk anybody \n\n\n\n\n\n\n britaine purse washes loads public name windows interchangeably attending defend tully gave gets honourable galls champion access bold separate beguile morning rivers fret bounteous night duke admir hurricanoes sooth vilely thread holds bargain dine weight wedded yawn transcends audience graves sue content deathsman complexions talent struck sometimes tooth praying sailing blame receiv questions doth brook foe buckingham concerns courtier lov soul kindred gentlemen resolve pedro con antony garden benefactors share safety freely deputy policy conquering foretell prison rousillon welcome direct nephew customary medicine heavy toys blind \n\n\n\n\ncaius wisdom pawn dane answers adheres yet amen cross folly antenor canst prophesier hisperia posset marcellus bending evidence food moe piety betide thankful joyful thing dare baseness properer ancient couple nights dog runs weary how fault eagle valour till blemishes form assault plain cato none drave borne matter gualtier affect \n\n\n\n\ncassius measure honors weaves service count sinon trifles whole fix hold uncles sorry war soul seventh rome gotten galen innocent earnest attend unconstrained away tediousness trumpet royalty borne cover rack revolt sleep ber constant days trial plants abhor peradventure dozen loathe well whom apollo mote ten mercy project exhibition cold mystery torn diminution suspicion faint went provide fat bawd clown ago shamefully bosoms curtains treads martial preventions character hive wanton hush hell higher difference part aloft disdain bent iden melted parolles thirsty swing quickly brutus rampir robb lowness whipp pure crutches bessy along thatch bears iago planted rosalinda hercules misery process chants spotted wrack charmian snake laboured thee russians households wedded her romeo bethink gash joyful casca jays \n\n\n\n\n releas strange ranting darts wine judge paint appoint shown brabantio \n\n\n\n\n\n\n\nweary counsel formal unto image surrey skittish monsieur punish rapiers home insolence wishes perform ruffian sulphurous joyful birth april shortly boarded force battlements bequeathed notice scratch lubber smelt removed fill ways safety suppose discourse indistinct chance velvet eyesight modestly toads troublesome sprung arm drawn tales fault nurse then sins edmund perceive finds bachelor pains pair speech follow masters piteous grove feel \n\n\n\nmethought had term edition accusers cap norfolk despite commodity \n\n\n\nstay senses does fenton denied wrought hector fond affairs manly alarum horrible built vassals gold cassio danish daws sells menelaus own hurl tide roar torch snarleth peasant instrument justly deem priam \n\n\n\n\n\nunderprop corrigible corruption dwells liege england fret tut hinder befits capulets pray united supernatural corse beasts unless exceeds strange venus blood proceeding gift reckonings ancient boot such crowd doctor end misconster all maine nemean preventions kent unquestionable discover fell toward blush less tickling passing fairy wenches vow varnish bora sixth fright forfeited protestations pick visage brain sign parcel hidest endeared hands edm rememb biscuit bloody cares besiege journey locks fie whirl shakespeare suffolk aweary town thumb gap ambassadors abed wooers thy sleeve gets wretches melancholy naked worn spent qui coming mercy armed paris decay hercules shalt hence rash gav streets sum dull \n\n\n\n\nused fifty date measures hangs avert fares fathers adelaide warrant virginity parted defunct dispraise abbey enter prosper staying wrongfully bridegroom unthankfulness justice assembly rocks threatens matters hand noise repair custom mus sisters birth minstrels prattling reasons dram wander aquitaine bed metal signior conscience crows assured truly foolery leonato earl eagle verity garlands argument believe smoothing spring hearts brutus poor jealous dinner prisons upward time hoodwink william gold along humane fact project hate dispatch son whiles rested weedy idly \n\n\n\n\nfit motley ours mirth recover untrue allow dramatis cables follies red servant debtors purg haughty hasten applause comfortable guts dare yea anjou grant scarce mule pattern bears ides field proves wild sable speeds flourish party innocent dim greatly rais whose rul forsooth princes instruct prevail likelihood revolt commendations whey especially pandulph regent wealth blessing mingle devotion search under rise procure undertakes spoke crafty thence awry ache familiar exeter wed swords passage cheerly scratching thank special root weapon jot pilgrim speaking isabel darker staff press amiss edm itself joys torches dukes pale refuse ample reconcile city phrygian number subdu tent fetch married prison kindred beau bedew tyranny alone outward large marks direction hue logotype gave bind disjoint balm cliff power part suggestions elder cock provided monarch geffrey honors discreet born lanthorn birth nimbly bawd mongrel catch denote performance cure chastely venge can blot mon love quietly demands elbow dwarf supper stomach masker breeding attend lip huge there humbleness straight words perform belie charity bowl warwick blush william fifth fitzwater rid mask fist preventions thefts forsake beget leans monster hams pair motion nails course meeting hymen war goneril ere cast parching upon halters labouring imagin cardinal differences comes dogged west judge watches greatly angling troilus flourish inclining haunt fed france despised retirement spied scar longing heel feature watch what seem palmers sap surfeit longaville monument stables life bag italian met envy back sup angel coldly armour reg sanctuary exterior discretion wall plants advancing king proceed reputation employment stage touching aumerle defeat slender which conduct tough beats heave borne preventions attending proud troyan abuse some willow reproach platform thrusting nest makes afoot loud dispossess pranks stops esteem compounded care lowness loo close was alt cannot exacted norway thine calls german letter bruit service aspic hark liv younger rugged constable web spurn resign mines promis wisdom dishonest blunt stones imagination rein testament form yielding sits teach faults grapes liquor tall unfurnish invade reported sirs young bolingbroke ours buckingham rank vici consent open drum limbs rogue countrymen certain apparition araise kings fairest yicld naughty nobody sups \n\n\n\n\n\n spite constance ballads worth breath treacherous contented dick vial had cure detestable thine wretchedness news fulness nan etc lamentation brain critic call guiding ducats cheapside smart midnight earth roofs speaks gods threats southerly thou asleep wasteful married council opportunity dear \n\n\n\nvariance impetuous alarums spirit odd beating first prove dogged well rare mind liar wenches severity knavery eyes oracle plain touches distinguish inch preventions worldly bliss meant \n\n\n\nbetrothed authentic blackheath pluck towns rivers chief quiet exhales scope sixteen lenity white patience princely mere desdemona travail hang march reverence blush wait fat need impon thanks circumstance poverty goal reignier strumpet knights thenceforth snares withal kiss pin kin worst together multitude cloud ransom bear malice admitted wimpled pomp lion serv exclaims trudge somewhat but urs pernicious gave hates blind soundly ladies containing quench spend grapple steal bosom soften master followed teeth messenger proposes combat dozen amend clients flew preventions \n\n", false) ); } /** * Return the names of all items whose description contains the word `gold'. . */ @org.junit.Test public void xMarkQ14() { final XQuery query = new XQuery( "(: Purpose: Return the names of all items whose description contains the word `gold'. :) \n" + " { \n" + " let $auction := (/) return \n" + " for $i in $auction/site//item \n" + " where contains(string(exactly-one($i/description)), \"gold\") \n" + " return $i/name/text() } ", ctx); try { query.context(node(file("app/XMark/XMarkAuction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("condemn approves unloose freshness swallowing low house tougher stayed surly ready fight dare following england sing editions gets falcon tells henry mocks sadness wrought sentence fall mournings hovel towards utter revenged news genius judgment mask done sway join fasten regard whisper fruitful suggest nervii dealing session sign crack cursy dangers uncover action seldom called ranks lies faded merry cherry citizens revels simple mace muddy fair horse letter spring ransom tenth hands dishonour beheld discourse cried whipping attempt northumberland makes aquitaine ivory lift looks doth gratis rate hither cordelia calamity gone loss pace flint marvel mettle bound peremptory dearest fitting rocks rotten betwixt already fail bleeding ability secure pleading custom except lately brows sees note kissing falls deserts rock tunes gain lands appetite ground hercules palace ", false) ); } /** * Print the keywords in emphasis in annotations of closed auctions. . */ @org.junit.Test public void xMarkQ15() { final XQuery query = new XQuery( " { \n" + " let $auction := (/) return \n" + " for $a in $auction/site/closed_auctions/closed_auction/annotation/description/parlist/ \n" + " listitem/ parlist/ listitem/ text/ emph/ keyword/ text() \n" + " return {$a} } ", ctx); try { query.context(node(file("app/XMark/XMarkAuction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" went bows hercules pillars reversion angel songs defy hast success ", false) ); } /** * Return the IDs of those auctions that have one or more keywords in emphasis. * (cf. Q15) . */ @org.junit.Test public void xMarkQ16() { final XQuery query = new XQuery( "(: Purpose: Return the IDs of those auctions that have one or more keywords in emphasis. (cf. Q15) :) \n" + " { \n" + " let $auction := (/) return \n" + " for $a in $auction/site/closed_auctions/closed_auction \n" + " where not( empty( $a/annotation/description/parlist/listitem/parlist/listitem/text/emph/ keyword/ text() ) ) \n" + " return } ", ctx); try { query.context(node(file("app/XMark/XMarkAuction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Which persons don't have a homepage? . */ @org.junit.Test public void xMarkQ17() { final XQuery query = new XQuery( " { \n" + " let $auction := (/) \n" + " return for $p in $auction/site/people/person \n" + " where empty($p/homepage/text()) \n" + " return } ", ctx); try { query.context(node(file("app/XMark/XMarkAuction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Convert the currency of the reserve of all open auctions to another currency. * convert Dfl to Euro . */ @org.junit.Test public void xMarkQ18() { final XQuery query = new XQuery( "(: Purpose: Convert the currency of the reserve of all open auctions to another currency. :) \n" + " declare namespace local = \"http://www.example.com/\"; \n" + " declare function local:convert($v as xs:decimal?) as xs:decimal? { 2.20371 * $v }; \n" + " { \n" + " let $auction := (/) return \n" + " for $i in $auction/site/open_auctions/open_auction \n" + " return local:convert(zero-or-one($i/reserve)) } ", ctx); try { query.context(node(file("app/XMark/XMarkAuction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("546.7845252 487.1741697 286.8128565 35.920473 76.3585515 597.0070761 11.1287355 419.5423098 788.0907702 198.2457516 54.0570063 78.7165212 815.4608484 104.9186331 22.4117307 647.8246287 482.1276738 636.4534851 114.9014394 468.1120782 1236.3033471 1076.4462237 637.2468207 172.3521591 32.9013903 586.3631568 563.7971664 592.8861384 21.9930258 1213.2745776 1420.731837 1319.4713625 1383.5772864 175.5475386 1013.9490081 828.0881067 496.1653065 267.9931731 43.6775322 840.054252 17.9161623 1322.3361855 240.2484642 381.1096074 52.9110771 1126.1398842 2660.7153798 53.0653368 1404.3362346 991.3609806 496.8704937 2414.5168986 151.6593222 360.526956 1503.6354072 566.7721749 12.0322566 781.9424193 1039.1374134 1867.3577427 91.7845215 226.3650912 1058.0232081 142.1613321 109.7006838 109.4582757 328.7274207 33.8489856 119.2427481 3859.0047294 192.0533265 333.200952 24.1967358 72.0833541 901.0088706 149.5217235 1110.890211 20.4063546 1521.4193469 790.9996674 204.9229929 56.3488647 81.2948619 281.8104348 659.7466998 1221.9131208 348.9354414 259.9716687 165.7410291 539.1376515 30.2789754 372.8456949 445.4579394 175.1508708 874.5202764 2120.1673539 2047.4008497 339.37134 2125.6105176 5819.5132938 369.9808719 1648.3310058 876.0849105 538.1239449 2418.5496879 955.7931012 7205.8452177 697.2979182 129.7764819 289.8099021 2041.1863875 133.8313083 356.1856473 369.121425 28.8245268 223.676565 2015.8216854 107.1443802 130.4375949 692.8023498 606.3728436 458.6140881 363.3697419 832.1870073 406.584495 666.2256072 71.5324266 1002.1371225 735.0474705 498.8097585 193.7722203 3815.2170117 2456.1449805 611.970267 643.1527635 187.6459065 117.1492236 40.8567834 34.9508406 2419.8058026 1744.5229473 173.6082738 821.4769767 127.154067 2173.519173 325.3116702 171.0740073 1412.4458874 2032.7461782 349.5745173 435.1666137 1607.0995917 108.4445691 83.8070913 131.0766708 29.4856398 127.8592542 70.9374249 648.4416675 672.3078468 100.5112131 36.7358457 333.641694 56.9659035 896.1607086 273.6346707 861.209868 56.7234954 366.2786391 259.6411122 1310.1717063 1211.2251273 923.6850465 1136.012505 299.8808568 415.3772979 447.4633155 393.3842721 200.9122407 208.691337", false) ); } /** * Give an alphabetically ordered list of all items along with their location. . */ @org.junit.Test public void xMarkQ19() { final XQuery query = new XQuery( "(: Purpose: Give an alphabetically ordered list of all items along with their location. :) \n" + " { \n" + " let $auction := (/) return \n" + " for $b in $auction/site/regions//item \n" + " let $k := $b/name/text() stable order by zero-or-one($b/location) ascending empty greatest \n" + " return {$b/location/text()} } ", ctx); try { query.context(node(file("app/XMark/XMarkAuction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("AlbaniaAlbaniaAlgeriaAmerican SamoaAngolaAngolaAntarcticaAntiguaArmeniaArubaAustriaAzerbaijanBahamasBahamasBahrainBangladeshBangladeshBarbadosBarbadosBelarusBelarusBelgiumBelgiumBelgiumBermudaBhutanBotswanaBritish Virgin IslandsBrunei DarussalamBrunei DarussalamBulgariaBurundiBurundiCacos IslandsCambodiaCameroonCameroonCape VerdeCayman IslandsChadChinaColombiaColombiaCosta RicaCroatiaCyprusCzech RepublicCzech RepublicDenmarkDjiboutiDjiboutiDjiboutiDominicaEast TimorEgyptEgyptEgyptEl SalvadorEquatorial GuineaEritreaEstoniaEthiopiaFaroe IslandsFaroe IslandsFaroe IslandsFutuna IslandsFutuna IslandsGabonGambiaGambiaGeorgiaGermanyGreeceGrenadaGuatemalaHong KongHong KongHong KongHungaryIndiaIndonesiaIraqIrelandIsraelIvory CoastJapanJordanKazakhstanKenyaKorea, Democratic People's RepKorea, Democratic People's RepKuwaitLao People's Democratic RepublLebanonLesothoLibyan Arab JamahiriyaMalaysiaMaliMaltaMarshall IslandsMarshall IslandsMartiniqueMauritaniaMayotteMexicoMicronesiaMoldova, Republic OfMoldova, Republic OfMontserratMoroccoMyanmarMyanmarMyanmarNamibiaNauruNepalNetherlandsNew CaledoniaNew ZealandNorfolk IslandNorwayNorwayOmanPakistanPakistanPakistanPalauPalauPalauParaguayPhilippinesPuerto RicoRomaniaRussian FederationSaint KittsSamoaSan MarinoSao TomeSingaporeSolomon IslandsSomaliaSouth AfricaSouth AfricaSouth GeorgiaSri LankaSri LankaSri LankaSt. HelenaSt. PierreSt. PierreSt. Vincent and GrenadinesSudanSurinameSvalbard and Jan Mayen IslandSvalbard and Jan Mayen IslandSwazilandTaiwanTaiwanTanzaniaThailandTogoTogoTokelauTokelauTrinidadTrinidadTunisiaTurkeyTurkmenistanTurks IslandsTuvaluUgandaUgandaUgandaUkraineUnited Arab EmiratesUnited KingdomUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUnited StatesUs Virgin IslandsUs Virgin IslandsVanuatuVatican City StateVatican City StateVenezuelaViet NamZimbabweZimbabwe", false) ); } /** * Return the initial increases of all open auctions. . */ @org.junit.Test public void xMarkQ2() { final XQuery query = new XQuery( "\n" + " { \n" + " let $auction := (/) \n" + " return for $b in $auction/site/open_auctions/open_auction \n" + " return {$b/bidder[1]/increase/text()} } ", ctx); try { query.context(node(file("app/XMark/XMarkAuction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("10.503.0015.0025.506.0061.5034.5012.0010.503.0013.503.0042.0027.001.5039.007.5012.009.0015.0051.0012.0012.0013.503.009.0021.007.5015.009.003.003.0010.5015.0016.5033.009.0048.0031.501.5052.507.506.0015.003.0016.5013.501.5031.503.0031.5021.0015.003.006.0033.0025.507.5015.0057.004.5012.003.007.504.503.0019.509.001.5036.0025.5010.5012.009.006.009.0016.509.009.004.5028.5021.0051.007.501.509.0021.0031.5010.5013.507.5018.003.0028.501.5030.0013.5042.001.5021.0031.5022.507.501.501.501.5051.004.503.0049.503.003.0022.506.0051.006.0021.0013.5016.5025.5010.504.5031.5010.5024.0010.506.004.506.0013.509.0013.503.006.004.5045.0022.504.501.5019.5025.507.506.0024.006.003.009.003.001.5012.004.5022.5052.5027.004.5033.0022.506.0013.5019.506.0075.003.006.0025.509.001.503.004.503.0039.0094.5013.5045.006.0022.5016.5019.5040.506.007.5028.501.507.501.5016.5015.006.003.0033.004.5025.5034.5030.006.007.5018.0039.006.0013.507.5015.006.0016.5012.0015.006.0034.5025.503.0039.0018.0049.504.5018.003.0021.006.0022.501.5018.007.5022.5019.5010.5019.507.509.001.504.503.0052.507.506.007.5058.5031.506.0022.503.0021.007.503.001.501.503.009.007.503.0019.5018.004.509.0058.504.5027.007.509.0025.501.509.0016.5024.0036.0016.5010.501.5016.504.5069.004.507.5010.5015.003.0027.006.001.5025.506.0061.503.003.0031.507.5027.0015.001.5018.001.507.5013.5013.5094.5013.5012.004.509.009.0030.003.009.0025.5016.506.0036.0021.001.5058.5010.5064.5025.5022.5027.0030.0064.504.50", false) ); } /** * Group customers by their income and output the cardinality of each group. . */ @org.junit.Test public void xMarkQ20() { final XQuery query = new XQuery( " { \n" + " let $auction := (/) return \n" + " \n" + " {count($auction/site/people/person/profile[@income >= 100000.0])} \n" + " { count( $auction/site/people/person/ profile[@income < 100000.0 and @income >= 30000.0] ) } \n" + " {count($auction/site/people/person/profile[@income < 30000.0])} \n" + " { count( for $p in $auction/site/people/person where empty($p/profile/@income) return $p ) } \n" + " } ", ctx); try { query.context(node(file("app/XMark/XMarkAuction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("12227150375", false) ); } /** * Return the IDs of all open auctions whose current increase is at least twice as * high as the initial increase. . */ @org.junit.Test public void xMarkQ3() { final XQuery query = new XQuery( "(: Purpose: Return the IDs of all open auctions whose current increase is at least twice as high as the initial increase. :) \n" + " { \n" + " let $auction := (/) \n" + " return for $b in $auction/site/open_auctions/open_auction \n" + " where zero-or-one($b/bidder[1]/increase/text()) * 2.0 <= $b/bidder[last()]/increase/text() \n" + " return } \n" + " ", ctx); try { query.context(node(file("app/XMark/XMarkAuction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * List the reserves of those open auctions where a certain person issued a bid * before another person. . */ @org.junit.Test public void xMarkQ4() { final XQuery query = new XQuery( "(: Purpose: List the reserves of those open auctions where a certain person issued a bid before another person. :) \n" + " { \n" + " let $auction := (/) return \n" + " for $b in $auction/site/open_auctions/open_auction \n" + " where some $pr1 in $b/bidder/personref[@person = \"person20\"], $pr2 in $b/bidder/personref[@person = \"person51\"] satisfies $pr1 << $pr2 \n" + " return {$b/reserve/text()} } \n" + " ", ctx); try { query.context(node(file("app/XMark/XMarkAuction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * How many sold items cost more than 40? . */ @org.junit.Test public void xMarkQ5() { final XQuery query = new XQuery( "\n" + " { \n" + " let $auction := (/) return count(\n" + " for $i in $auction/site/closed_auctions/closed_auction \n" + " where $i/price/text() >= 40.0 return $i/price) } \n" + " ", ctx); try { query.context(node(file("app/XMark/XMarkAuction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("200", false) ); } /** * How many items are listed on all continents? . */ @org.junit.Test public void xMarkQ6() { final XQuery query = new XQuery( "\n" + " { \n" + " let $auction := (/) return for $b in $auction//site/regions return count($b//item) } \n" + " ", ctx); try { query.context(node(file("app/XMark/XMarkAuction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("647", false) ); } /** * How many pieces of prose are in our database? . */ @org.junit.Test public void xMarkQ7() { final XQuery query = new XQuery( " { let $auction := (/) return for $p in $auction/site return count($p//description) + count($p//annotation) + count($p//emailaddress) } ", ctx); try { query.context(node(file("app/XMark/XMarkAuction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("2734", false) ); } /** * List the names of persons and the number of items they bought. (joins person, * closed\_auction). . */ @org.junit.Test public void xMarkQ8() { final XQuery query = new XQuery( "(: Purpose: List the names of persons and the number of items they bought. (joins person, closed\\_auction). :) \n" + " { let $auction := (/) return \n" + " for $p in $auction/site/people/person \n" + " let $a := for $t in $auction/site/closed_auctions/closed_auction \n" + " where $t/buyer/@person = $p/@id return $t \n" + " return {count($a)} } ", ctx); try { query.context(node(file("app/XMark/XMarkAuction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010010000000000000000000000001001000000010000010001100000001000000010000000000301100000040011000000010202001010021000212103000001210113000100121200120020010002312202121120311101413120500112211131016300302021301200312300420100103410121313101110112033001102131211201003033002220111201222123000001121111112003004100102010030000101000021110000010000000000010000100100000100000010012000000010000100000110000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", false) ); } /** * List the names of persons and the names of the items they bought in Europe(joins * person, closed auction, item). . */ @org.junit.Test public void xMarkQ9() { final XQuery query = new XQuery( "(: Purpose: List the names of persons and the names of the items \n" + " they bought in Europe(joins person, closed auction, item). :) \n" + " { \n" + " let $auction := (/) \n" + " return let $ca := $auction/site/closed_auctions/closed_auction \n" + " return let $ei := $auction/site/regions/europe/item \n" + " for $p in $auction/site/people/person \n" + " let $a := for $t in $ca where $p/@id = $t/buyer/@person \n" + " return let $n := for $t2 in $ei where $t/itemref/@item = $t2/@id \n" + " return $t2 return {$n/name/text()} \n" + " return {$a} } ", ctx); try { query.context(node(file("app/XMark/XMarkAuction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("rights midwife embark learned ashy wither well over blister eros wench nails leisure slender manly leperous breathing put blush doing ford instantly copied boyet rear state amend issu dirt knows hovel towards apart drunk desartless not thunder exil round suits close reprove youths varying dallying deed blowing mistook sire sons grown earliest affliction earth flatterest fifty protector vessels almighty stomachs gentleman whom pity humbly shallow themselves mean bestow past burn coronet debtor concord quips slanders lust uncover zeal foolish against mightst winnowed greg remedy decorum inheritance legate tush mightier thereby bianca sons absurd fairly charity strikes inherited sorry argument amended full hast sempronius potent gracious fixture think mercutio goose peruse finding window sails assay excels burn preventions affects longaville fall mournings citizens revels utter revenged news milan despised spits fines watch flow rack dangers action seldom undid door becomes bestow held vessels ugly plenteous sold mingle singing sweetest several spok defeat gallant preventions tent day villainous oblivion shalt elbow provost lionel properer wooing ocean riot down retir protectorship confronted charg losing title barefac impostor anchises fiend advised particular pregnantly ", false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/000077500000000000000000000000001222453003200241045ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnAbs.java000066400000000000000000002653521222453003200257550ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** . * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnAbs extends QT3TestSet { /** * Test: K-ABSFunc-1 `abs()`. . */ @org.junit.Test public void kABSFunc1() { final XQuery query = new XQuery( "abs()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Test: K-ABSFunc-2 `abs(1, 2)`. . */ @org.junit.Test public void kABSFunc2() { final XQuery query = new XQuery( "abs(1, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Test: K-ABSFunc-3 `empty(abs(()))`. . */ @org.junit.Test public void kABSFunc3() { final XQuery query = new XQuery( "empty(abs(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K-ABSFunc-4 `abs(10.5) eq 10.5`. . */ @org.junit.Test public void kABSFunc4() { final XQuery query = new XQuery( "abs(10.5) eq 10.5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K-ABSFunc-5 `abs(-10.5) eq 10.5`. . */ @org.junit.Test public void kABSFunc5() { final XQuery query = new XQuery( "abs(-10.5) eq 10.5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K-ABSFunc-6 `abs("a string")`. . */ @org.junit.Test public void kABSFunc6() { final XQuery query = new XQuery( "abs(\"a string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test: K2-ABSFunc-1 type xs:integer. . */ @org.junit.Test public void k2ABSFunc1() { final XQuery query = new XQuery( "fn:abs(xs:integer(-4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4") ); } /** * Test: K2-ABSFunc-10 type xs:unsignedInt. . */ @org.junit.Test public void k2ABSFunc10() { final XQuery query = new XQuery( "fn:abs(xs:unsignedInt(4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4") ); } /** * Test: K2-ABSFunc-11 type xs:unsignedShort. . */ @org.junit.Test public void k2ABSFunc11() { final XQuery query = new XQuery( "fn:abs(xs:unsignedShort(4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4") ); } /** * Test: K2-ABSFunc-12 type xs:unsignedByte. . */ @org.junit.Test public void k2ABSFunc12() { final XQuery query = new XQuery( "fn:abs(xs:unsignedByte(4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4") ); } /** * Test: K2-ABSFunc-13 type xs:positiveInteger. . */ @org.junit.Test public void k2ABSFunc13() { final XQuery query = new XQuery( "fn:abs(xs:positiveInteger(4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4") ); } /** * Test: K2-ABSFunc-14 xs:integer and check the return type. . */ @org.junit.Test public void k2ABSFunc14() { final XQuery query = new XQuery( "fn:abs(xs:integer(-4)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K2-ABSFunc-15 xs:nonPositiveInteger and check the return type. . */ @org.junit.Test public void k2ABSFunc15() { final XQuery query = new XQuery( "fn:abs(xs:nonPositiveInteger(-4)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K2-ABSFunc-16 xs:negativeInteger and check the return type. . */ @org.junit.Test public void k2ABSFunc16() { final XQuery query = new XQuery( "fn:abs(xs:negativeInteger(-4)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K2-ABSFunc-17 xs:long and check the return type. . */ @org.junit.Test public void k2ABSFunc17() { final XQuery query = new XQuery( "fn:abs(xs:long(-4)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K2-ABSFunc-18 xs:int and check the return type. . */ @org.junit.Test public void k2ABSFunc18() { final XQuery query = new XQuery( "fn:abs(xs:int(-4)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K2-ABSFunc-19 xs:short and check the return type. . */ @org.junit.Test public void k2ABSFunc19() { final XQuery query = new XQuery( "fn:abs(xs:short(-4)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K2-ABSFunc-2 type xs:nonPositiveInteger. . */ @org.junit.Test public void k2ABSFunc2() { final XQuery query = new XQuery( "fn:abs(xs:nonPositiveInteger(-4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4") ); } /** * Test: K2-ABSFunc-20 xs:byte and check the return type. . */ @org.junit.Test public void k2ABSFunc20() { final XQuery query = new XQuery( "fn:abs(xs:byte(-4)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K2-ABSFunc-21 xs:nonNegativeInteger and check the return type. . */ @org.junit.Test public void k2ABSFunc21() { final XQuery query = new XQuery( "fn:abs(xs:nonNegativeInteger(4)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K2-ABSFunc-22 xs:unsignedLong and check the return type. . */ @org.junit.Test public void k2ABSFunc22() { final XQuery query = new XQuery( "fn:abs(xs:unsignedLong(4)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K2-ABSFunc-23 xs:unsignedInt and check the return type. . */ @org.junit.Test public void k2ABSFunc23() { final XQuery query = new XQuery( "fn:abs(xs:unsignedInt(4)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K2-ABSFunc-24 xs:unsignedShort and check the return type. . */ @org.junit.Test public void k2ABSFunc24() { final XQuery query = new XQuery( "fn:abs(xs:unsignedShort(4)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K2-ABSFunc-25 xs:unsignedByte and check the return type. . */ @org.junit.Test public void k2ABSFunc25() { final XQuery query = new XQuery( "fn:abs(xs:unsignedByte(4)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K2-ABSFunc-26 xs:positiveInteger and check the return type. . */ @org.junit.Test public void k2ABSFunc26() { final XQuery query = new XQuery( "fn:abs(xs:positiveInteger(4)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K2-ABSFunc-27 xs:decimal and check the return type(negative test). . */ @org.junit.Test public void k2ABSFunc27() { final XQuery query = new XQuery( "fn:abs(1.1) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test: K2-ABSFunc-28 xs:double and check the return type(negative test). . */ @org.junit.Test public void k2ABSFunc28() { final XQuery query = new XQuery( "fn:abs(1e1) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test: K2-ABSFunc-29 xs:float and check the return type(negative test). . */ @org.junit.Test public void k2ABSFunc29() { final XQuery query = new XQuery( "fn:abs(xs:float(1)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test: K2-ABSFunc-3 type xs:negativeInteger. . */ @org.junit.Test public void k2ABSFunc3() { final XQuery query = new XQuery( "fn:abs(xs:negativeInteger(-4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4") ); } /** * Test: K2-ABSFunc-30 xs:integer and check the return type(negative test). . */ @org.junit.Test public void k2ABSFunc30() { final XQuery query = new XQuery( "fn:abs(xs:float(1)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test: K2-ABSFunc-31 xs:decimal and check the return type. . */ @org.junit.Test public void k2ABSFunc31() { final XQuery query = new XQuery( "fn:abs(1.1) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K2-ABSFunc-32 xs:double and check the return type. . */ @org.junit.Test public void k2ABSFunc32() { final XQuery query = new XQuery( "fn:abs(1e1) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K2-ABSFunc-33 xs:float and check the return type. . */ @org.junit.Test public void k2ABSFunc33() { final XQuery query = new XQuery( "fn:abs(xs:float(1)) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K2-ABSFunc-34 xs:integer and check the return type. . */ @org.junit.Test public void k2ABSFunc34() { final XQuery query = new XQuery( "fn:abs(xs:integer(1)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K2-ABSFunc-35 is properly inferred for unsignedShort. . */ @org.junit.Test public void k2ABSFunc35() { final XQuery query = new XQuery( "abs(xs:unsignedShort(.)) instance of xs:unsignedShort", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Test: K2-ABSFunc-36 is properly inferred for unsignedLong. . */ @org.junit.Test public void k2ABSFunc36() { final XQuery query = new XQuery( "abs(xs:unsignedLong(.)) instance of xs:unsignedLong", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Test: K2-ABSFunc-37 is properly inferred for unsignedInt. . */ @org.junit.Test public void k2ABSFunc37() { final XQuery query = new XQuery( "abs(xs:unsignedInt(.)) instance of xs:unsignedInt", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Test: K2-ABSFunc-38 is properly inferred for unsignedByte. . */ @org.junit.Test public void k2ABSFunc38() { final XQuery query = new XQuery( "abs(xs:unsignedByte(.)) instance of xs:unsignedByte", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Test: K2-ABSFunc-39 is properly inferred for positiveInteger. . */ @org.junit.Test public void k2ABSFunc39() { final XQuery query = new XQuery( "abs(xs:positiveInteger(.)) instance of xs:positiveInteger", ctx); try { query.context(node(file("fn/abs/e1.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Test: K2-ABSFunc-4 type xs:long. . */ @org.junit.Test public void k2ABSFunc4() { final XQuery query = new XQuery( "fn:abs(xs:long(-4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4") ); } /** * Test: K2-ABSFunc-40 is properly inferred for nonPositiveInteger. . */ @org.junit.Test public void k2ABSFunc40() { final XQuery query = new XQuery( "abs(xs:nonPositiveInteger(.)) instance of\n" + " xs:nonPositiveInteger", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Test: K2-ABSFunc-41 is properly inferred for nonNegativeInteger. . */ @org.junit.Test public void k2ABSFunc41() { final XQuery query = new XQuery( "abs(xs:nonNegativeInteger(.)) instance of\n" + " xs:nonNegativeInteger", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Test: K2-ABSFunc-42 is properly inferred for negativeInteger. . */ @org.junit.Test public void k2ABSFunc42() { final XQuery query = new XQuery( "abs(xs:negativeInteger(.)) instance of xs:negativeInteger", ctx); try { query.context(node(file("fn/abs/e-1.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Test: K2-ABSFunc-43 is properly inferred for long. . */ @org.junit.Test public void k2ABSFunc43() { final XQuery query = new XQuery( "abs(xs:long(.)) instance of xs:long", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Test: K2-ABSFunc-44 is properly inferred for int. . */ @org.junit.Test public void k2ABSFunc44() { final XQuery query = new XQuery( "abs(xs:int(.)) instance of xs:int", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Test: K2-ABSFunc-45 is properly inferred for short. . */ @org.junit.Test public void k2ABSFunc45() { final XQuery query = new XQuery( "abs(xs:short(.)) instance of xs:short", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Test: K2-ABSFunc-46 is properly inferred for byte. . */ @org.junit.Test public void k2ABSFunc46() { final XQuery query = new XQuery( "abs(xs:byte(.)) instance of xs:byte", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Test: K2-ABSFunc-47 . */ @org.junit.Test public void k2ABSFunc47() { final XQuery query = new XQuery( "fn:abs(xs:float(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** * Test: K2-ABSFunc-48 -INF/xs:double. . */ @org.junit.Test public void k2ABSFunc48() { final XQuery query = new XQuery( "fn:abs(xs:double(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** * Test: K2-ABSFunc-49 . */ @org.junit.Test public void k2ABSFunc49() { final XQuery query = new XQuery( "fn:abs(xs:float(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** * Test: K2-ABSFunc-5 type xs:int. . */ @org.junit.Test public void k2ABSFunc5() { final XQuery query = new XQuery( "fn:abs(xs:int(-4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4") ); } /** * Test: K2-ABSFunc-50 -INF/xs:double. . */ @org.junit.Test public void k2ABSFunc50() { final XQuery query = new XQuery( "fn:abs(xs:double(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** * Test: K2-ABSFunc-6 type xs:short. . */ @org.junit.Test public void k2ABSFunc6() { final XQuery query = new XQuery( "fn:abs(xs:short(-4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4") ); } /** * Test: K2-ABSFunc-7 type xs:byte. . */ @org.junit.Test public void k2ABSFunc7() { final XQuery query = new XQuery( "fn:abs(xs:byte(-4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4") ); } /** * Test: K2-ABSFunc-8 type xs:nonNegativeInteger. . */ @org.junit.Test public void k2ABSFunc8() { final XQuery query = new XQuery( "fn:abs(xs:nonNegativeInteger(4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4") ); } /** * Test: K2-ABSFunc-9 type xs:unsignedLong. . */ @org.junit.Test public void k2ABSFunc9() { final XQuery query = new XQuery( "fn:abs(xs:unsignedLong(4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4") ); } /** * test fn:abs where input type is uncertain. */ @org.junit.Test public void cbclAbs001() { final XQuery query = new XQuery( "fn:abs( fn:reverse( (1, xs:decimal(2.2), xs:float(3.3), xs:double(4.4)) )[2] )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3.3") ); } /** * numeric types. Author: Oliver Hallam Date: 2010-03-15. */ @org.junit.Test public void fnAbs1() { final XQuery query = new XQuery( "string-join(for $x in (1, xs:decimal(2), xs:float(3), xs:double(4)) return \n" + " if ((abs($x)) instance of xs:integer) then \"integer\" \n" + " else if ((abs($x)) instance of xs:decimal) then \"decimal\" \n" + " else if ((abs($x)) instance of xs:float) then \"float\"\n" + " else if ((abs($x)) instance of xs:double) then \"double\" else error(), \" \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"integer decimal float double\"") ); } /** * Test: fn-abs-more-args-001.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: arg: double . */ @org.junit.Test public void fnAbsMoreArgs001() { final XQuery query = new XQuery( "fn:abs(xs:double(\"-0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") && assertType("xs:double") ) ); } /** * Test: fn-abs-more-args-002.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: arg: double . */ @org.junit.Test public void fnAbsMoreArgs002() { final XQuery query = new XQuery( "fn:abs(xs:double(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "INF") && assertType("xs:double") ) ); } /** * Test: fn-abs-more-args-003.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: arg: double . */ @org.junit.Test public void fnAbsMoreArgs003() { final XQuery query = new XQuery( "fn:abs(xs:double(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "INF") && assertType("xs:double") ) ); } /** * Test: fn-abs-more-args-004.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: arg: double . */ @org.junit.Test public void fnAbsMoreArgs004() { final XQuery query = new XQuery( "fn:abs(xs:double(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "NaN") && assertType("xs:double") ) ); } /** * Test: fn-abs-more-args-005.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: arg: double . */ @org.junit.Test public void fnAbsMoreArgs005() { final XQuery query = new XQuery( "fn:abs(xs:double(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "NaN") && assertType("xs:double") ) ); } /** * Test: fn-abs-more-args-006.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: arg: decimal . */ @org.junit.Test public void fnAbsMoreArgs006() { final XQuery query = new XQuery( "fn:abs(xs:decimal(\"-0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") && assertType("xs:decimal") ) ); } /** * Test: fn-abs-more-args-007.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: arg: decimal . */ @org.junit.Test public void fnAbsMoreArgs007() { final XQuery query = new XQuery( "fn:abs(xs:decimal(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") && assertType("xs:decimal") ) ); } /** * Test: fn-abs-more-args-008.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: arg: float . */ @org.junit.Test public void fnAbsMoreArgs008() { final XQuery query = new XQuery( "fn:abs(xs:float(\"-0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") && assertType("xs:float") ) ); } /** * Test: fn-abs-more-args-009.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: arg: float . */ @org.junit.Test public void fnAbsMoreArgs009() { final XQuery query = new XQuery( "fn:abs(xs:float(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "INF") && assertType("xs:float") ) ); } /** * Test: fn-abs-more-args-010.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: arg: float . */ @org.junit.Test public void fnAbsMoreArgs010() { final XQuery query = new XQuery( "fn:abs(xs:float(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "INF") && assertType("xs:float") ) ); } /** * Test: fn-abs-more-args-011.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: arg: float . */ @org.junit.Test public void fnAbsMoreArgs011() { final XQuery query = new XQuery( "fn:abs(xs:float(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "NaN") && assertType("xs:float") ) ); } /** * Test: fn-abs-more-args-012.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: arg: float . */ @org.junit.Test public void fnAbsMoreArgs012() { final XQuery query = new XQuery( "fn:abs(xs:float(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "NaN") && assertType("xs:float") ) ); } /** * Test: fn-abs-more-args-013.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: arg: int . */ @org.junit.Test public void fnAbsMoreArgs013() { final XQuery query = new XQuery( "fn:abs(xs:int(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") && assertType("xs:integer") ) ); } /** * Test: fn-abs-more-args-014.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: arg: int . */ @org.junit.Test public void fnAbsMoreArgs014() { final XQuery query = new XQuery( "fn:abs(xs:int(\"-0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") && assertType("xs:integer") ) ); } /** * Test: fn-abs-more-args-015.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: arg: integer . */ @org.junit.Test public void fnAbsMoreArgs015() { final XQuery query = new XQuery( "fn:abs(xs:integer(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") && assertType("xs:integer") ) ); } /** * Test: fn-abs-more-args-016.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: arg: integer . */ @org.junit.Test public void fnAbsMoreArgs016() { final XQuery query = new XQuery( "fn:abs(xs:integer(\"-0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") && assertType("xs:integer") ) ); } /** * Test: fn-abs-more-args-017.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: arg: long . */ @org.junit.Test public void fnAbsMoreArgs017() { final XQuery query = new XQuery( "fn:abs(xs:long(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") && assertType("xs:integer") ) ); } /** * Test: fn-abs-more-args-018.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: arg: long . */ @org.junit.Test public void fnAbsMoreArgs018() { final XQuery query = new XQuery( "fn:abs(xs:long(\"-0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") && assertType("xs:integer") ) ); } /** * Test: fn-abs-more-args-019.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: arg: nonNegativeInteger . */ @org.junit.Test public void fnAbsMoreArgs019() { final XQuery query = new XQuery( "fn:abs(xs:nonNegativeInteger(\"-0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") && assertType("xs:integer") ) ); } /** * Test: fn-abs-more-args-020.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: arg: nonPositiveIntege . */ @org.junit.Test public void fnAbsMoreArgs020() { final XQuery query = new XQuery( "fn:abs(xs:nonPositiveInteger(\"-0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") && assertType("xs:integer") ) ); } /** * Test: fn-abs-more-args-021.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: arg: short . */ @org.junit.Test public void fnAbsMoreArgs021() { final XQuery query = new XQuery( "fn:abs(xs:short(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") && assertType("xs:integer") ) ); } /** * Test: fn-abs-more-args-022.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: arg: short . */ @org.junit.Test public void fnAbsMoreArgs022() { final XQuery query = new XQuery( "fn:abs(xs:short(\"-0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") && assertType("xs:integer") ) ); } /** * Test: fn-abs-more-args-023.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: arg: unsignedLong . */ @org.junit.Test public void fnAbsMoreArgs023() { final XQuery query = new XQuery( "fn:abs(xs:unsignedLong(\"-0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") && assertType("xs:integer") ) ); } /** * Test: fn-abs-more-args-024.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: arg: unsignedShort . */ @org.junit.Test public void fnAbsMoreArgs024() { final XQuery query = new XQuery( "fn:abs(xs:unsignedShort(\"-0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") && assertType("xs:integer") ) ); } /** * Test: fn-abs-more-args-025.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs025() { final XQuery query = new XQuery( "fn:abs(xs:decimal(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-026.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs026() { final XQuery query = new XQuery( "fn:abs(xs:decimal(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-027.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs027() { final XQuery query = new XQuery( "fn:abs(xs:decimal(\"-NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-028.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs028() { final XQuery query = new XQuery( "fn:abs(xs:decimal(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-029.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs029() { final XQuery query = new XQuery( "fn:abs(xs:int(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-030.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs030() { final XQuery query = new XQuery( "fn:abs(xs:int(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-031.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs031() { final XQuery query = new XQuery( "fn:abs(xs:int(\"-NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-032.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs032() { final XQuery query = new XQuery( "fn:abs(xs:int(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-033.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs033() { final XQuery query = new XQuery( "fn:abs(xs:integer(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-034.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs034() { final XQuery query = new XQuery( "fn:abs(xs:integer(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-035.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs035() { final XQuery query = new XQuery( "fn:abs(xs:integer(\"-NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-036.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs036() { final XQuery query = new XQuery( "fn:abs(xs:integer(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-037.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs037() { final XQuery query = new XQuery( "fn:abs(xs:long(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-038.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs038() { final XQuery query = new XQuery( "fn:abs(xs:long(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-039.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs039() { final XQuery query = new XQuery( "fn:abs(xs:long(\"-NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-040.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs040() { final XQuery query = new XQuery( "fn:abs(xs:long(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-041.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs041() { final XQuery query = new XQuery( "fn:abs(xs:negativeInteger(\"-0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-042.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs042() { final XQuery query = new XQuery( "fn:abs(xs:negativeInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-043.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs043() { final XQuery query = new XQuery( "fn:abs(xs:negativeInteger(\"2\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-044.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs044() { final XQuery query = new XQuery( "fn:abs(xs:negativeInteger(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-045.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs045() { final XQuery query = new XQuery( "fn:abs(xs:negativeInteger(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-046.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs046() { final XQuery query = new XQuery( "fn:abs(xs:negativeInteger(\"-NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-047.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs047() { final XQuery query = new XQuery( "fn:abs(xs:negativeInteger(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-048.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs048() { final XQuery query = new XQuery( "fn:abs(xs:nonNegativeInteger(\"-2\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-049.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs049() { final XQuery query = new XQuery( "fn:abs(xs:nonNegativeInteger(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-050.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs050() { final XQuery query = new XQuery( "fn:abs(xs:nonNegativeInteger(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-051.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs051() { final XQuery query = new XQuery( "fn:abs(xs:nonNegativeInteger(\"-NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-052.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs052() { final XQuery query = new XQuery( "fn:abs(xs:nonNegativeInteger(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-053.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs053() { final XQuery query = new XQuery( "fn:abs(xs:nonPositiveInteger(\"2\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-054.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs054() { final XQuery query = new XQuery( "fn:abs(xs:nonPositiveInteger(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-055.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs055() { final XQuery query = new XQuery( "fn:abs(xs:nonPositiveInteger(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-056.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs056() { final XQuery query = new XQuery( "fn:abs(xs:nonPositiveInteger(\"-NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-057.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs057() { final XQuery query = new XQuery( "fn:abs(xs:nonPositiveInteger(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-058.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs058() { final XQuery query = new XQuery( "fn:abs(xs:positiveInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-059.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs059() { final XQuery query = new XQuery( "fn:abs(xs:positiveInteger(\"-0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-060.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs060() { final XQuery query = new XQuery( "fn:abs(xs:positiveInteger(\"-2\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-061.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs061() { final XQuery query = new XQuery( "fn:abs(xs:positiveInteger(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-062.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs062() { final XQuery query = new XQuery( "fn:abs(xs:positiveInteger(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-063.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs063() { final XQuery query = new XQuery( "fn:abs(xs:positiveInteger(\"-NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-064.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs064() { final XQuery query = new XQuery( "fn:abs(xs:positiveInteger(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-065.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs065() { final XQuery query = new XQuery( "fn:abs(xs:short(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-066.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs066() { final XQuery query = new XQuery( "fn:abs(xs:short(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-067.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs067() { final XQuery query = new XQuery( "fn:abs(xs:short(\"-NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-068.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs068() { final XQuery query = new XQuery( "fn:abs(xs:short(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-069.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs069() { final XQuery query = new XQuery( "fn:abs(xs:unsignedLong(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-070.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs070() { final XQuery query = new XQuery( "fn:abs(xs:unsignedLong(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-071.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs071() { final XQuery query = new XQuery( "fn:abs(xs:unsignedLong(\"-NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-072.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs072() { final XQuery query = new XQuery( "fn:abs(xs:unsignedLong(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-073.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs073() { final XQuery query = new XQuery( "fn:abs(xs:unsignedShort(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-074.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs074() { final XQuery query = new XQuery( "fn:abs(xs:unsignedShort(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-075.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs075() { final XQuery query = new XQuery( "fn:abs(xs:unsignedShort(\"-NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-076.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives FORG0001 . */ @org.junit.Test public void fnAbsMoreArgs076() { final XQuery query = new XQuery( "fn:abs(xs:unsignedShort(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Test: fn-abs-more-args-077.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives XPTY0004 . */ @org.junit.Test public void fnAbsMoreArgs077() { final XQuery query = new XQuery( "fn:abs(xs:string(\"1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test: fn-abs-more-args-078.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives XPTY0004 . */ @org.junit.Test public void fnAbsMoreArgs078() { final XQuery query = new XQuery( "fn:abs(xs:string(\"hello\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test: fn-abs-more-args-079.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives XPTY0004 . */ @org.junit.Test public void fnAbsMoreArgs079() { final XQuery query = new XQuery( "fn:abs(xs:boolean(\"1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test: fn-abs-more-args-080.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives XPTY0004 . */ @org.junit.Test public void fnAbsMoreArgs080() { final XQuery query = new XQuery( "fn:abs(xs:boolean(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test: fn-abs-more-args-081.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives XPTY0004 . */ @org.junit.Test public void fnAbsMoreArgs081() { final XQuery query = new XQuery( "fn:abs(xs:boolean(fn:true()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test: fn-abs-more-args-082.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives XPTY0004 . */ @org.junit.Test public void fnAbsMoreArgs082() { final XQuery query = new XQuery( "fn:abs(xs:boolean(fn:false()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test: fn-abs-more-args-083.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives XPTY0004 . */ @org.junit.Test public void fnAbsMoreArgs083() { final XQuery query = new XQuery( "fn:abs(xs:date(\"2002-10-09\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test: fn-abs-more-args-084.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives XPTY0004 . */ @org.junit.Test public void fnAbsMoreArgs084() { final XQuery query = new XQuery( "fn:abs(xs:time(\"13:20:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test: fn-abs-more-args-085.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives XPTY0004 . */ @org.junit.Test public void fnAbsMoreArgs085() { final XQuery query = new XQuery( "fn:abs(xs:dateTime(\"2002-10-10T12:00:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test: fn-abs-more-args-086.xq Written By: Pulkita Tyagi Date: Thu Oct 27 03:56:31 2005 Purpose: Negative Test gives XPTY0004 . */ @org.junit.Test public void fnAbsMoreArgs086() { final XQuery query = new XQuery( "fn:abs(xs:anyURI(\"www.examples.org\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test: absdbl1args-1 The "abs" function with the arguments set as follows: $arg = xs:double(lower bound) . */ @org.junit.Test public void fnAbsdbl1args1() { final XQuery query = new XQuery( "fn:abs(xs:double(\"-1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1.7976931348623157E308") && assertType("xs:double") ) ); } /** * Test: absdbl1args-2 The "abs" function with the arguments set as follows: $arg = xs:double(mid range) . */ @org.junit.Test public void fnAbsdbl1args2() { final XQuery query = new XQuery( "fn:abs(xs:double(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0.0e0") && assertType("xs:double") ) ); } /** * Test: absdbl1args-3 The "abs" function with the arguments set as follows: $arg = xs:double(upper bound) . */ @org.junit.Test public void fnAbsdbl1args3() { final XQuery query = new XQuery( "fn:abs(xs:double(\"1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1.7976931348623157E308") && assertType("xs:double") ) ); } /** * Test: absdec1args-1 The "abs" function with the arguments set as follows: $arg = xs:decimal(lower bound) . */ @org.junit.Test public void fnAbsdec1args1() { final XQuery query = new XQuery( "fn:abs(xs:decimal(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("999999999999999999") && assertType("xs:decimal") ) ); } /** * Test: absdec1args-2 The "abs" function with the arguments set as follows: $arg = xs:decimal(mid range) . */ @org.junit.Test public void fnAbsdec1args2() { final XQuery query = new XQuery( "fn:abs(xs:decimal(\"617375191608514839\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("617375191608514839") && assertType("xs:decimal") ) ); } /** * Test: absdec1args-3 The "abs" function with the arguments set as follows: $arg = xs:decimal(upper bound) . */ @org.junit.Test public void fnAbsdec1args3() { final XQuery query = new XQuery( "fn:abs(xs:decimal(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("999999999999999999") && assertType("xs:decimal") ) ); } /** * Test: absflt1args-1 The "abs" function with the arguments set as follows: $arg = xs:float(lower bound) . */ @org.junit.Test public void fnAbsflt1args1() { final XQuery query = new XQuery( "fn:abs(xs:float(\"-3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("xs:float(3.4028235E38)") && assertType("xs:float") ) ); } /** * Test: absflt1args-2 The "abs" function with the arguments set as follows: $arg = xs:float(mid range) . */ @org.junit.Test public void fnAbsflt1args2() { final XQuery query = new XQuery( "fn:abs(xs:float(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0.0e0") && assertType("xs:float") ) ); } /** * Test: absflt1args-3 The "abs" function with the arguments set as follows: $arg = xs:float(upper bound) . */ @org.junit.Test public void fnAbsflt1args3() { final XQuery query = new XQuery( "fn:abs(xs:float(\"3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("xs:float(3.4028235E38)") && assertType("xs:float") ) ); } /** * Test: absint1args-1 The "abs" function with the arguments set as follows: $arg = xs:int(lower bound) . */ @org.junit.Test public void fnAbsint1args1() { final XQuery query = new XQuery( "fn:abs(xs:int(\"-2147483648\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("2147483648") && assertType("xs:integer") ) ); } /** * Test: absint1args-2 The "abs" function with the arguments set as follows: $arg = xs:int(mid range) . */ @org.junit.Test public void fnAbsint1args2() { final XQuery query = new XQuery( "fn:abs(xs:int(\"-1873914410\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1873914410") && assertType("xs:integer") ) ); } /** * Test: absint1args-3 The "abs" function with the arguments set as follows: $arg = xs:int(upper bound) . */ @org.junit.Test public void fnAbsint1args3() { final XQuery query = new XQuery( "fn:abs(xs:int(\"2147483647\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("2147483647") && assertType("xs:integer") ) ); } /** * Test: absintg1args-1 The "abs" function with the arguments set as follows: $arg = xs:integer(lower bound) . */ @org.junit.Test public void fnAbsintg1args1() { final XQuery query = new XQuery( "fn:abs(xs:integer(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("999999999999999999") && assertType("xs:integer") ) ); } /** * Test: absintg1args-2 The "abs" function with the arguments set as follows: $arg = xs:integer(mid range) . */ @org.junit.Test public void fnAbsintg1args2() { final XQuery query = new XQuery( "fn:abs(xs:integer(\"830993497117024304\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("830993497117024304") && assertType("xs:integer") ) ); } /** * Test: absintg1args-3 The "abs" function with the arguments set as follows: $arg = xs:integer(upper bound) . */ @org.junit.Test public void fnAbsintg1args3() { final XQuery query = new XQuery( "fn:abs(xs:integer(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("999999999999999999") && assertType("xs:integer") ) ); } /** * Test: abslng1args-1 The "abs" function with the arguments set as follows: $arg = xs:long(lower bound) . */ @org.junit.Test public void fnAbslng1args1() { final XQuery query = new XQuery( "fn:abs(xs:long(\"-92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("92233720368547758") && assertType("xs:integer") ) ); } /** * Test: abslng1args-2 The "abs" function with the arguments set as follows: $arg = xs:long(mid range) . */ @org.junit.Test public void fnAbslng1args2() { final XQuery query = new XQuery( "fn:abs(xs:long(\"-47175562203048468\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("47175562203048468") && assertType("xs:integer") ) ); } /** * Test: abslng1args-3 The "abs" function with the arguments set as follows: $arg = xs:long(upper bound) . */ @org.junit.Test public void fnAbslng1args3() { final XQuery query = new XQuery( "fn:abs(xs:long(\"92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("92233720368547758") && assertType("xs:integer") ) ); } /** * Test: absnint1args-1 The "abs" function with the arguments set as follows: $arg = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnAbsnint1args1() { final XQuery query = new XQuery( "fn:abs(xs:negativeInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("999999999999999999") && assertType("xs:integer") ) ); } /** * Test: absnint1args-2 The "abs" function with the arguments set as follows: $arg = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnAbsnint1args2() { final XQuery query = new XQuery( "fn:abs(xs:negativeInteger(\"-297014075999096793\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("297014075999096793") && assertType("xs:integer") ) ); } /** * Test: absnint1args-3 The "abs" function with the arguments set as follows: $arg = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnAbsnint1args3() { final XQuery query = new XQuery( "fn:abs(xs:negativeInteger(\"-1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1") && assertType("xs:integer") ) ); } /** * Test: absnni1args-1 The "abs" function with the arguments set as follows: $arg = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnAbsnni1args1() { final XQuery query = new XQuery( "fn:abs(xs:nonNegativeInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") && assertType("xs:integer") ) ); } /** * Test: absnni1args-2 The "abs" function with the arguments set as follows: $arg = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnAbsnni1args2() { final XQuery query = new XQuery( "fn:abs(xs:nonNegativeInteger(\"303884545991464527\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("303884545991464527") && assertType("xs:integer") ) ); } /** * Test: absnni1args-3 The "abs" function with the arguments set as follows: $arg = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnAbsnni1args3() { final XQuery query = new XQuery( "fn:abs(xs:nonNegativeInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("999999999999999999") && assertType("xs:integer") ) ); } /** * Test: absnpi1args-1 The "abs" function with the arguments set as follows: $arg = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnAbsnpi1args1() { final XQuery query = new XQuery( "fn:abs(xs:nonPositiveInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("999999999999999999") && assertType("xs:integer") ) ); } /** * Test: absnpi1args-2 The "abs" function with the arguments set as follows: $arg = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnAbsnpi1args2() { final XQuery query = new XQuery( "fn:abs(xs:nonPositiveInteger(\"-475688437271870490\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("475688437271870490") && assertType("xs:integer") ) ); } /** * Test: absnpi1args-3 The "abs" function with the arguments set as follows: $arg = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnAbsnpi1args3() { final XQuery query = new XQuery( "fn:abs(xs:nonPositiveInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") && assertType("xs:integer") ) ); } /** * Test: abspint1args-1 The "abs" function with the arguments set as follows: $arg = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnAbspint1args1() { final XQuery query = new XQuery( "fn:abs(xs:positiveInteger(\"1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1") && assertType("xs:integer") ) ); } /** * Test: abspint1args-2 The "abs" function with the arguments set as follows: $arg = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnAbspint1args2() { final XQuery query = new XQuery( "fn:abs(xs:positiveInteger(\"52704602390610033\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("52704602390610033") && assertType("xs:integer") ) ); } /** * Test: abspint1args-3 The "abs" function with the arguments set as follows: $arg = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnAbspint1args3() { final XQuery query = new XQuery( "fn:abs(xs:positiveInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("999999999999999999") && assertType("xs:integer") ) ); } /** * Test: abssht1args-1 The "abs" function with the arguments set as follows: $arg = xs:short(lower bound) . */ @org.junit.Test public void fnAbssht1args1() { final XQuery query = new XQuery( "fn:abs(xs:short(\"-32768\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("32768") && assertType("xs:integer") ) ); } /** * Test: abssht1args-2 The "abs" function with the arguments set as follows: $arg = xs:short(mid range) . */ @org.junit.Test public void fnAbssht1args2() { final XQuery query = new XQuery( "fn:abs(xs:short(\"-5324\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("5324") && assertType("xs:integer") ) ); } /** * Test: abssht1args-3 The "abs" function with the arguments set as follows: $arg = xs:short(upper bound) . */ @org.junit.Test public void fnAbssht1args3() { final XQuery query = new XQuery( "fn:abs(xs:short(\"32767\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("32767") && assertType("xs:integer") ) ); } /** * Test: absulng1args-1 The "abs" function with the arguments set as follows: $arg = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnAbsulng1args1() { final XQuery query = new XQuery( "fn:abs(xs:unsignedLong(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") && assertType("xs:integer") ) ); } /** * Test: absulng1args-2 The "abs" function with the arguments set as follows: $arg = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnAbsulng1args2() { final XQuery query = new XQuery( "fn:abs(xs:unsignedLong(\"130747108607674654\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("130747108607674654") && assertType("xs:integer") ) ); } /** * Test: absulng1args-3 The "abs" function with the arguments set as follows: $arg = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnAbsulng1args3() { final XQuery query = new XQuery( "fn:abs(xs:unsignedLong(\"184467440737095516\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("184467440737095516") && assertType("xs:integer") ) ); } /** * Test: absusht1args-1 The "abs" function with the arguments set as follows: $arg = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnAbsusht1args1() { final XQuery query = new XQuery( "fn:abs(xs:unsignedShort(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") && assertType("xs:integer") ) ); } /** * Test: absusht1args-2 The "abs" function with the arguments set as follows: $arg = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnAbsusht1args2() { final XQuery query = new XQuery( "fn:abs(xs:unsignedShort(\"44633\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("44633") && assertType("xs:integer") ) ); } /** * Test: absusht1args-3 The "abs" function with the arguments set as follows: $arg = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnAbsusht1args3() { final XQuery query = new XQuery( "fn:abs(xs:unsignedShort(\"65535\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("65535") && assertType("xs:integer") ) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnAdjustDateTimeToTimezone.java000066400000000000000000000653021222453003200321260ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the adjust-dateTime-to-timeZone() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnAdjustDateTimeToTimezone extends QT3TestSet { /** * A test whose essence is: `adjust-dateTime-to-timezone()`. . */ @org.junit.Test public void kAdjDateTimeToTimezoneFunc1() { final XQuery query = new XQuery( "adjust-dateTime-to-timezone()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Example from F&O. . */ @org.junit.Test public void kAdjDateTimeToTimezoneFunc10() { final XQuery query = new XQuery( "adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00\"), xs:dayTimeDuration(\"-PT5H0M\")) eq xs:dateTime(\"2002-03-07T10:00:00-05:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Example from F&O. . */ @org.junit.Test public void kAdjDateTimeToTimezoneFunc11() { final XQuery query = new XQuery( "adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00-07:00\"), xs:dayTimeDuration(\"-PT5H0M\")) eq xs:dateTime(\"2002-03-07T12:00:00-05:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Example from F&O. . */ @org.junit.Test public void kAdjDateTimeToTimezoneFunc12() { final XQuery query = new XQuery( "adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00\"), xs:dayTimeDuration(\"-PT10H\")) eq xs:dateTime(\"2002-03-07T10:00:00-10:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Example from F&O. . */ @org.junit.Test public void kAdjDateTimeToTimezoneFunc13() { final XQuery query = new XQuery( "adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00-07:00\"), xs:dayTimeDuration(\"-PT10H\")) eq xs:dateTime(\"2002-03-07T07:00:00-10:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Example from F&O. . */ @org.junit.Test public void kAdjDateTimeToTimezoneFunc14() { final XQuery query = new XQuery( "adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00-07:00\"), xs:dayTimeDuration(\"PT10H\")) eq xs:dateTime(\"2002-03-08T03:00:00+10:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Example from F&O. . */ @org.junit.Test public void kAdjDateTimeToTimezoneFunc15() { final XQuery query = new XQuery( "adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T00:00:00+01:00\"), xs:dayTimeDuration(\"-PT8H\")) eq xs:dateTime(\"2002-03-06T15:00:00-08:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Example from F&O. . */ @org.junit.Test public void kAdjDateTimeToTimezoneFunc16() { final XQuery query = new XQuery( "adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00\"), ()) eq xs:dateTime(\"2002-03-07T10:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `adjust-dateTime-to-timezone((), (), "WRONG PARAM")`. . */ @org.junit.Test public void kAdjDateTimeToTimezoneFunc2() { final XQuery query = new XQuery( "adjust-dateTime-to-timezone((), (), \"WRONG PARAM\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(adjust-dateTime-to-timezone(()))`. . */ @org.junit.Test public void kAdjDateTimeToTimezoneFunc3() { final XQuery query = new XQuery( "empty(adjust-dateTime-to-timezone(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(adjust-dateTime-to-timezone((), ()))`. . */ @org.junit.Test public void kAdjDateTimeToTimezoneFunc4() { final XQuery query = new XQuery( "empty(adjust-dateTime-to-timezone((), ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `adjust-dateTime-to-timezone(()) instance of xs:dateTime?`. . */ @org.junit.Test public void kAdjDateTimeToTimezoneFunc5() { final XQuery query = new XQuery( "adjust-dateTime-to-timezone(()) instance of xs:dateTime?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that the implicit timezone in the dynamic context is used if $timezone is empty; indirectly also tests context stability. . */ @org.junit.Test public void kAdjDateTimeToTimezoneFunc6() { final XQuery query = new XQuery( "timezone-from-dateTime(adjust-dateTime-to-timezone(xs:dateTime(\"2001-02-03T00:00:00\"))) eq implicit-timezone()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Passing a too large xs:dayTimeDuration as timezone to adjust-dateTime-to-timezone(). . */ @org.junit.Test public void kAdjDateTimeToTimezoneFunc7() { final XQuery query = new XQuery( "adjust-dateTime-to-timezone(xs:dateTime(\"2001-02-03T08:02:00\"), xs:dayTimeDuration(\"PT14H1M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0003") ); } /** * Passing a too small xs:dayTimeDuration as timezone to adjust-dateTime-to-timezone(). . */ @org.junit.Test public void kAdjDateTimeToTimezoneFunc8() { final XQuery query = new XQuery( "adjust-dateTime-to-timezone(xs:dateTime(\"2001-02-03T08:02:00\"), xs:dayTimeDuration(\"-PT14H1M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0003") ); } /** * Passing a xs:dayTimeDuration as timezone to adjust-dateTime-to-timezone() which isn't an integral number of minutes. . */ @org.junit.Test public void kAdjDateTimeToTimezoneFunc9() { final XQuery query = new XQuery( "adjust-dateTime-to-timezone(xs:dateTime(\"2001-02-03T08:02:00\"), xs:dayTimeDuration(\"PT14H0M0.001S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0003") ); } /** * Ensure dateTime values are properly normalized. . */ @org.junit.Test public void k2AdjDateTimeToTimezoneFunc1() { final XQuery query = new XQuery( "fn:adjust-dateTime-to-timezone(xs:dateTime(\"1999-12-31T24:00:00\"), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2000-01-01T00:00:00") ); } /** * Check optimization codepath in adjust-dateTime-to-timezone. */ @org.junit.Test public void cbclAdjustDateTimeToTimezone001() { final XQuery query = new XQuery( "adjust-dateTime-to-timezone(current-dateTime(), implicit-timezone()) eq current-dateTime()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that adjust-dateTime-to-timezone underflows nicely. . */ @org.junit.Test public void cbclAdjustDateTimeToTimezone002() { final XQuery query = new XQuery( "adjust-dateTime-to-timezone(xs:dateTime(\"-25252734927766555-06-07T01:00:00+02:00\"), xs:dayTimeDuration(\"PT0S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * A query testing that adjust-dateTime-to-timezone overflows nicely. . */ @org.junit.Test public void cbclAdjustDateTimeToTimezone003() { final XQuery query = new XQuery( "adjust-dateTime-to-timezone(xs:dateTime(\"25252734927766555-07-28T23:00:00-02:00\"), xs:dayTimeDuration(\"PT0S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * Check optimization codepath in adjust-dateTime-to-timezone . */ @org.junit.Test public void cbclAdjustDateTimeToTimezone004() { final XQuery query = new XQuery( "adjust-dateTime-to-timezone(current-dateTime(), xs:dayTimeDuration(\"PT2H\")) eq adjust-dateTime-to-timezone(current-dateTime(), xs:dayTimeDuration(\"-PT2H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test Description: Evaluates The "adjust-dateTime-to-timezone" function as per example 1 (for this function) of the F&O specs. . */ @org.junit.Test public void fnAdjustDateTimeToTimezone1() { final XQuery query = new XQuery( "fn:adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00-05:00\"),xs:dayTimeDuration(\"-PT5H0M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2002-03-07T10:00:00-05:00") ); } /** * Test Description: Evaluates The "adjust-dateTime-to-timezone" function as part of an subtraction expression. . */ @org.junit.Test public void fnAdjustDateTimeToTimezone10() { final XQuery query = new XQuery( "fn:adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00-07:00\")) - fn:adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00-07:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Test Description: Evaluates The "adjust-dateTime-to-timezone" function as an argument to a string function. . */ @org.junit.Test public void fnAdjustDateTimeToTimezone11() { final XQuery query = new XQuery( "fn:string(fn:adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00-04:00\"),()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2002-03-07T10:00:00") ); } /** * Test Description: Evaluates string value The "adjust-dateTime-to-timezone" function as an argument to a boolean function. . */ @org.junit.Test public void fnAdjustDateTimeToTimezone12() { final XQuery query = new XQuery( "fn:boolean(fn:string(fn:adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00-04:00\"),())))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test Description: Evaluates The string value of "adjust-dateTime-to-timezone" function as an argument to the "fn:not" function. . */ @org.junit.Test public void fnAdjustDateTimeToTimezone13() { final XQuery query = new XQuery( "fn:not(fn:string(fn:adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00-04:00\"),())))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test Description: Evaluates The string value "adjust-dateTime-to-timezone" function as part of a boolean (or) expression and the fn:true function. . */ @org.junit.Test public void fnAdjustDateTimeToTimezone14() { final XQuery query = new XQuery( "fn:string(fn:adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00-04:00\"),())) or fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test Description: Evaluates The string value "adjust-dateTime-to-timezone" function as part of a boolean (or) expression and the fn:false function. . */ @org.junit.Test public void fnAdjustDateTimeToTimezone15() { final XQuery query = new XQuery( "fn:string(fn:adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00-04:00\"),())) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test Description: Evaluates string value The "adjust-dateTime-to-timezone" function as part of a boolean (and) expression and the fn:true function. . */ @org.junit.Test public void fnAdjustDateTimeToTimezone16() { final XQuery query = new XQuery( "fn:string(fn:adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00-04:00\"),())) and fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test Description: Evaluates The string value of "adjust-dateTime-to-timezone" function as part of a boolean (and) expression and the fn:false function. . */ @org.junit.Test public void fnAdjustDateTimeToTimezone17() { final XQuery query = new XQuery( "fn:string(fn:adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00-04:00\"),())) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test Description: Evaluates The "adjust-dateTime-to-timezone" function as part of a subtraction expression, whicg results on a negative number. Uses one adjust-dateTime-to-timezone function and one xs:dateTime constructor. . */ @org.junit.Test public void fnAdjustDateTimeToTimezone18() { final XQuery query = new XQuery( "fn:adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00-04:00\")) - xs:dateTime(\"2006-03-07T10:00:00-05:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P1461DT1H") ); } /** * Test Description: Evaluates The "adjust-dateTime-to-timezone" function where an xs:dateTime value is subtracted. . */ @org.junit.Test public void fnAdjustDateTimeToTimezone19() { final XQuery query = new XQuery( "fn:adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00-04:00\")) - xs:dateTime(\"2001-03-07T10:00:00-05:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P364DT23H") ); } /** * Test Description: Evaluates The "adjust-dateTime-to-timezone" function as per example 2 (for this function) of the F&O specs. . */ @org.junit.Test public void fnAdjustDateTimeToTimezone2() { final XQuery query = new XQuery( "fn:adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00-07:00\"),xs:dayTimeDuration(\"-PT5H0M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2002-03-07T12:00:00-05:00") ); } /** * Test Description: Evaluates The "adjust-dateTime-to-timezone" function as part of a comparisson expression (ge operator). . */ @org.junit.Test public void fnAdjustDateTimeToTimezone20() { final XQuery query = new XQuery( "fn:adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00-04:00\")) ge fn:adjust-dateTime-to-timezone(xs:dateTime(\"2005-03-07T10:00:00-04:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test Description: Evaluates The "adjust-dateTime-to-timezone" function using the empty sequence as a value to the first argument. Uses "fn:count" to avoid empty file. . */ @org.junit.Test public void fnAdjustDateTimeToTimezone21() { final XQuery query = new XQuery( "fn:count(fn:adjust-dateTime-to-timezone(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Test Description: Evaluates The "adjust-dateTime-to-timezone" function with value of $timezone less than -PT14H. Should raise error. . */ @org.junit.Test public void fnAdjustDateTimeToTimezone22() { final XQuery query = new XQuery( "fn:adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00-04:00\"),xs:dayTimeDuration(\"-PT15H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0003") ); } /** * Test Description: Evaluates The "adjust-dateTime-to-timezone" function with value of $timezone greater than PT14H. Should raise error. . */ @org.junit.Test public void fnAdjustDateTimeToTimezone23() { final XQuery query = new XQuery( "fn:adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00-04:00\"),xs:dayTimeDuration(\"PT15H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0003") ); } /** * Test Description: Evaluates The "adjust-dateTime-to-timezone" function as per example 3 (for this function) of the F&O specs. . */ @org.junit.Test public void fnAdjustDateTimeToTimezone3() { final XQuery query = new XQuery( "let $tz := xs:dayTimeDuration(\"-PT10H\") return fn:adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00\"), $tz)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2002-03-07T10:00:00-10:00") ); } /** * Test Description: Evaluates The "adjust-dateTime-to-timezone" function as per example 4 (for this function) of the F&O specs. . */ @org.junit.Test public void fnAdjustDateTimeToTimezone4() { final XQuery query = new XQuery( "let $tz := xs:dayTimeDuration(\"-PT10H\") return fn:adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00-07:00\"), $tz)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2002-03-07T07:00:00-10:00") ); } /** * Test Description: Evaluates The "adjust-dateTime-to-timezone" function as per example 5 (for this function) of the F&O specs. . */ @org.junit.Test public void fnAdjustDateTimeToTimezone5() { final XQuery query = new XQuery( "fn:adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00-07:00\"), xs:dayTimeDuration(\"PT10H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2002-03-08T03:00:00+10:00") ); } /** * Test Description: Evaluates The "adjust-dateTime-to-timezone" function as per example 6 (for this function) of the F&O specs. . */ @org.junit.Test public void fnAdjustDateTimeToTimezone6() { final XQuery query = new XQuery( "fn:adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T00:00:00+01:00\"), xs:dayTimeDuration(\"-PT8H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2002-03-06T15:00:00-08:00") ); } /** * Test Description: Evaluates The "adjust-dateTime-to-timezone" function as per example 7 (for this function) of the F&O specs. . */ @org.junit.Test public void fnAdjustDateTimeToTimezone7() { final XQuery query = new XQuery( "fn:adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00\"), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2002-03-07T10:00:00") ); } /** * Test Description: Evaluates The "adjust-dateTime-to-timezone" function as per example 8 (for this function) of the F&O specs. . */ @org.junit.Test public void fnAdjustDateTimeToTimezone8() { final XQuery query = new XQuery( "fn:adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00-07:00\"), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2002-03-07T10:00:00") ); } /** * Test Description: Evaluates The "adjust-dateTime-to-timezone" function as part of a subtraction expression, whicg results on a negative number. Uses two adjust-dateTime-to-timezone functions. . */ @org.junit.Test public void fnAdjustDateTimeToTimezone9() { final XQuery query = new XQuery( "fn:adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00-07:00\")) - fn:adjust-dateTime-to-timezone(xs:dateTime(\"2006-03-07T10:00:00-07:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P1461D") ); } /** * Evaluates The "adjust-dateTime-to-timezone" function with the arguments set as follows: $arg = xs:dateTime(lower bound) . */ @org.junit.Test public void fnAdjustDateTimeToTimezone1args1() { final XQuery query = new XQuery( "fn:adjust-dateTime-to-timezone(xs:dateTime(\"1970-01-01T00:00:00Z\"),xs:dayTimeDuration(\"-PT10H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1969-12-31T14:00:00-10:00") ); } /** * Evaluates The "adjust-dateTime-to-timezone" function with the arguments set as follows: $arg = xs:dateTime(mid range) . */ @org.junit.Test public void fnAdjustDateTimeToTimezone1args2() { final XQuery query = new XQuery( "fn:adjust-dateTime-to-timezone(xs:dateTime(\"1996-04-07T01:40:52Z\"),xs:dayTimeDuration(\"-PT10H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1996-04-06T15:40:52-10:00") ); } /** * Evaluates The "adjust-dateTime-to-timezone" function with the arguments set as follows: $arg = xs:dateTime(upper bound) . */ @org.junit.Test public void fnAdjustDateTimeToTimezone1args3() { final XQuery query = new XQuery( "fn:adjust-dateTime-to-timezone(xs:dateTime(\"2030-12-31T23:59:59Z\"),xs:dayTimeDuration(\"-PT10H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2030-12-31T13:59:59-10:00") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnAdjustDateToTimezone.java000066400000000000000000000534241222453003200313110ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the adjust-date-to-timezone() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnAdjustDateToTimezone extends QT3TestSet { /** * A test whose essence is: `adjust-date-to-timezone()`. . */ @org.junit.Test public void kAdjDateToTimezoneFunc1() { final XQuery query = new XQuery( "adjust-date-to-timezone()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Example from F&O. . */ @org.junit.Test public void kAdjDateToTimezoneFunc10() { final XQuery query = new XQuery( "adjust-date-to-timezone(xs:date(\"2002-03-07-07:00\"), xs:dayTimeDuration(\"-PT5H0M\")) eq xs:date(\"2002-03-07-05:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Example from F&O. . */ @org.junit.Test public void kAdjDateToTimezoneFunc11() { final XQuery query = new XQuery( "adjust-date-to-timezone(xs:date(\"2002-03-07\"), xs:dayTimeDuration(\"-PT10H\")) eq xs:date(\"2002-03-07-10:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Example from F&O. . */ @org.junit.Test public void kAdjDateToTimezoneFunc12() { final XQuery query = new XQuery( "adjust-date-to-timezone(xs:date(\"2002-03-07-07:00\"), xs:dayTimeDuration(\"-PT10H\")) eq xs:date(\"2002-03-06-10:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Example from F&O. . */ @org.junit.Test public void kAdjDateToTimezoneFunc13() { final XQuery query = new XQuery( "adjust-date-to-timezone(xs:date(\"2002-03-07\"), ()) eq xs:date(\"2002-03-07\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Example from F&O. . */ @org.junit.Test public void kAdjDateToTimezoneFunc14() { final XQuery query = new XQuery( "adjust-date-to-timezone(xs:date(\"2002-03-07-07:00\"), ()) eq xs:date(\"2002-03-07\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `adjust-date-to-timezone((), (), "WRONG PARAM")`. . */ @org.junit.Test public void kAdjDateToTimezoneFunc2() { final XQuery query = new XQuery( "adjust-date-to-timezone((), (), \"WRONG PARAM\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(adjust-date-to-timezone(()))`. . */ @org.junit.Test public void kAdjDateToTimezoneFunc3() { final XQuery query = new XQuery( "empty(adjust-date-to-timezone(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(adjust-date-to-timezone((), ()))`. . */ @org.junit.Test public void kAdjDateToTimezoneFunc4() { final XQuery query = new XQuery( "empty(adjust-date-to-timezone((), ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `adjust-date-to-timezone(()) instance of xs:date?`. . */ @org.junit.Test public void kAdjDateToTimezoneFunc5() { final XQuery query = new XQuery( "adjust-date-to-timezone(()) instance of xs:date?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Passing a too large xs:dayTimeDuration as timezone to adjust-date-to-timezone(). . */ @org.junit.Test public void kAdjDateToTimezoneFunc6() { final XQuery query = new XQuery( "adjust-date-to-timezone(xs:date(\"2001-02-03\"), xs:dayTimeDuration(\"PT14H1M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0003") ); } /** * Passing a too small xs:dayTimeDuration as timezone to adjust-date-to-timezone(). . */ @org.junit.Test public void kAdjDateToTimezoneFunc7() { final XQuery query = new XQuery( "adjust-date-to-timezone(xs:date(\"2001-02-03\"), xs:dayTimeDuration(\"-PT14H1M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0003") ); } /** * Passing a xs:dayTimeDuration as timezone to adjust-date-to-timezone() which isn't an integral number of minutes. . */ @org.junit.Test public void kAdjDateToTimezoneFunc8() { final XQuery query = new XQuery( "adjust-date-to-timezone(xs:date(\"2001-02-03\"), xs:dayTimeDuration(\"PT14H0M0.001S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0003") ); } /** * Example from F&O. . */ @org.junit.Test public void kAdjDateToTimezoneFunc9() { final XQuery query = new XQuery( "adjust-date-to-timezone(xs:date(\"2002-03-07\"), xs:dayTimeDuration(\"-PT5H0M\")) eq xs:date(\"2002-03-07-05:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check optimization codepath in adjust-date-to-timezone . */ @org.junit.Test public void cbclAdjustDateToTimezone001() { final XQuery query = new XQuery( "adjust-date-to-timezone(current-date(), implicit-timezone()) eq current-date()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that adjust-date-to-timezone underflows nicely. . */ @org.junit.Test public void cbclAdjustDateToTimezone002() { final XQuery query = new XQuery( "adjust-date-to-timezone(xs:date(\"-25252734927766555-06-07+02:00\"), xs:dayTimeDuration(\"PT0S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * A query testing that adjust-date-to-timezone overflows nicely. . */ @org.junit.Test public void cbclAdjustDateToTimezone003() { final XQuery query = new XQuery( "adjust-date-to-timezone(xs:date(\"25252734927766555-07-28-12:00\"), xs:dayTimeDuration(\"PT12H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * Check optimization codepath in adjust-date-to-timezone . */ @org.junit.Test public void cbclAdjustDateToTimezone004() { final XQuery query = new XQuery( "adjust-date-to-timezone(current-date(), xs:dayTimeDuration(\"PT12H\")) eq adjust-date-to-timezone(current-date(), xs:dayTimeDuration(\"-PT12H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test Description: Evaluates The "adjust-date-to-timezone" function as per example 1 (for this function) of the F&O specs. . */ @org.junit.Test public void fnAdjustDateToTimezone1() { final XQuery query = new XQuery( "fn:adjust-date-to-timezone(xs:date(\"2002-03-07-05:00\"),xs:dayTimeDuration(\"-PT5H0M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2002-03-07-05:00") ); } /** * Test Description: Evaluates The "adjust-date-to-timezone" function as part of an subtraction expression. . */ @org.junit.Test public void fnAdjustDateToTimezone10() { final XQuery query = new XQuery( "fn:adjust-date-to-timezone(xs:date(\"2002-03-07-07:00\")) - fn:adjust-date-to-timezone(xs:date(\"2002-03-07-07:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Test Description: Evaluates The "adjust-date-to-timezone" function as an argument to a string function. . */ @org.junit.Test public void fnAdjustDateToTimezone11() { final XQuery query = new XQuery( "fn:string(fn:adjust-date-to-timezone(xs:date(\"2002-03-07-04:00\"),()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2002-03-07") ); } /** * Test Description: Evaluates the string value The "adjust-date-to-timezone" function as an argument to a boolean function. . */ @org.junit.Test public void fnAdjustDateToTimezone12() { final XQuery query = new XQuery( "fn:boolean(fn:string(fn:adjust-date-to-timezone(xs:date(\"2002-03-07-04:00\"),())))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test Description: Evaluates The string value of "adjust-date-to-timezone" function as an argument to the "fn:not" function. . */ @org.junit.Test public void fnAdjustDateToTimezone13() { final XQuery query = new XQuery( "fn:not(fn:string(fn:adjust-date-to-timezone(xs:date(\"2002-03-07-04:00\"),())))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test Description: Evaluates The string value of "adjust-date-to-timezone" function as part of a boolean (or) expression and the fn:true function. . */ @org.junit.Test public void fnAdjustDateToTimezone14() { final XQuery query = new XQuery( "fn:string(fn:adjust-date-to-timezone(xs:date(\"2002-03-07-04:00\"),())) or fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test Description: Evaluates The string value of "adjust-date-to-timezone" function as part of a boolean (or) expression and the fn:false function. . */ @org.junit.Test public void fnAdjustDateToTimezone15() { final XQuery query = new XQuery( "fn:string(fn:adjust-date-to-timezone(xs:date(\"2002-03-07-04:00\"),())) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test Description: Evaluates The string value of "adjust-date-to-timezone" function as part of a boolean (and) expression and the fn:true function. . */ @org.junit.Test public void fnAdjustDateToTimezone16() { final XQuery query = new XQuery( "fn:string(fn:adjust-date-to-timezone(xs:date(\"2002-03-07-04:00\"),())) and fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test Description: Evaluates The string value of "adjust-date-to-timezone" function as part of a boolean (and) expression and the fn:false function. . */ @org.junit.Test public void fnAdjustDateToTimezone17() { final XQuery query = new XQuery( "fn:string(fn:adjust-date-to-timezone(xs:date(\"2002-03-07-04:00\"),())) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test Description: Evaluates The "adjust-date-to-timezone" function as part of a subtraction expression, which results on a negative number. Uses one adjust-date-to-timezone function and one xs:date constructor. . */ @org.junit.Test public void fnAdjustDateToTimezone18() { final XQuery query = new XQuery( "let $tz := xs:dayTimeDuration(\"PT10H\") \n" + " return fn:adjust-date-to-timezone(xs:date(\"2002-03-07Z\"),$tz) - xs:date(\"2006-03-07Z\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P1461DT10H") ); } /** * Test Description: Evaluates The "adjust-date-to-timezone" function where an xs:date value is subtracted. . */ @org.junit.Test public void fnAdjustDateToTimezone19() { final XQuery query = new XQuery( "let $tz := xs:dayTimeDuration(\"PT10H\") \n" + " return fn:adjust-date-to-timezone(xs:date(\"2004-03-07Z\"),$tz) - xs:date(\"2001-03-07Z\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1095DT14H") ); } /** * Test Description: Evaluates The "adjust-date-to-timezone" function as per example 2 (for this function) of the F&O specs. . */ @org.junit.Test public void fnAdjustDateToTimezone2() { final XQuery query = new XQuery( "fn:adjust-date-to-timezone(xs:date(\"2002-03-07-07:00\"),xs:dayTimeDuration(\"-PT5H0M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2002-03-07-05:00") ); } /** * Test Description: Evaluates The "adjust-date-to-timezone" function as part of a comparisson expression (ge operator). . */ @org.junit.Test public void fnAdjustDateToTimezone20() { final XQuery query = new XQuery( "fn:adjust-date-to-timezone(xs:date(\"2002-03-07-04:00\")) ge fn:adjust-date-to-timezone(xs:date(\"2005-03-07-04:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test Description: Evaluates The "adjust-date-to-timezone" function as per example 3 (for this function) of the F&O specs. . */ @org.junit.Test public void fnAdjustDateToTimezone3() { final XQuery query = new XQuery( "let $tz := xs:dayTimeDuration(\"-PT10H\") \n" + " return fn:adjust-date-to-timezone(xs:date(\"2002-03-07\"), $tz)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2002-03-07-10:00") ); } /** * Test Description: Evaluates The "adjust-date-to-timezone" function as per example 4 (for this function) of the F&O specs. . */ @org.junit.Test public void fnAdjustDateToTimezone4() { final XQuery query = new XQuery( "let $tz := xs:dayTimeDuration(\"-PT10H\") \n" + " return fn:adjust-date-to-timezone(xs:date(\"2002-03-07-07:00\"), $tz)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2002-03-06-10:00") ); } /** * Test Description: Evaluates The "adjust-date-to-timezone" function as per example 5 (for this function) of the F&O specs. . */ @org.junit.Test public void fnAdjustDateToTimezone5() { final XQuery query = new XQuery( "fn:adjust-date-to-timezone(xs:date(\"2002-03-07\"), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2002-03-07") ); } /** * Test Description: Evaluates The "adjust-date-to-timezone" function as per example 6 (for this function) of the F&O specs. . */ @org.junit.Test public void fnAdjustDateToTimezone6() { final XQuery query = new XQuery( "fn:adjust-date-to-timezone(xs:date(\"2002-03-07-07:00\"), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2002-03-07") ); } /** * Test Description: Evaluates The "adjust-date-to-timezone" function using the empty sequence as a value to the first argument. Uses "fn:count" to avoid empty file. . */ @org.junit.Test public void fnAdjustDateToTimezone7() { final XQuery query = new XQuery( "fn:count(fn:adjust-date-to-timezone(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Test Description: Evaluates The "adjust-date-to-timezone" function as part of a subtraction expression, whicg results on a negative number. Uses two adjust-date-to-timezone functions. . */ @org.junit.Test public void fnAdjustDateToTimezone9() { final XQuery query = new XQuery( "fn:adjust-date-to-timezone(xs:date(\"2002-03-07-07:00\")) - fn:adjust-date-to-timezone(xs:date(\"2006-03-07-07:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P1461D") ); } /** * Evaluates The "adjust-date-to-timezone" function with the arguments set as follows: $arg = xs:date(lower bound) . */ @org.junit.Test public void fnAdjustDateToTimezone1args1() { final XQuery query = new XQuery( "fn:adjust-date-to-timezone(xs:date(\"1970-01-01Z\"),xs:dayTimeDuration(\"-PT10H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1969-12-31-10:00") ); } /** * Evaluates The "adjust-date-to-timezone" function with the arguments set as follows: $arg = xs:date(mid range) . */ @org.junit.Test public void fnAdjustDateToTimezone1args2() { final XQuery query = new XQuery( "fn:adjust-date-to-timezone(xs:date(\"1983-11-17Z\"),xs:dayTimeDuration(\"-PT10H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1983-11-16-10:00") ); } /** * Evaluates The "adjust-date-to-timezone" function with the arguments set as follows: $arg = xs:date(upper bound) . */ @org.junit.Test public void fnAdjustDateToTimezone1args3() { final XQuery query = new XQuery( "fn:adjust-date-to-timezone(xs:date(\"2030-12-31Z\"),xs:dayTimeDuration(\"-PT10H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2030-12-30-10:00") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnAdjustTimeToTimezone.java000066400000000000000000000554561222453003200313410ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the adjust-time-to-timezone() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnAdjustTimeToTimezone extends QT3TestSet { /** * A test whose essence is: `adjust-time-to-timezone()`. . */ @org.junit.Test public void kAdjTimeToTimezoneFunc1() { final XQuery query = new XQuery( "adjust-time-to-timezone()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Example from F&O. . */ @org.junit.Test public void kAdjTimeToTimezoneFunc10() { final XQuery query = new XQuery( "adjust-time-to-timezone(xs:time(\"10:00:00\"), xs:dayTimeDuration(\"-PT5H0M\")) eq xs:time(\"10:00:00-05:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Example from F&O. . */ @org.junit.Test public void kAdjTimeToTimezoneFunc11() { final XQuery query = new XQuery( "adjust-time-to-timezone(xs:time(\"10:00:00-07:00\"), xs:dayTimeDuration(\"-PT5H0M\")) eq xs:time(\"12:00:00-05:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Example from F&O. . */ @org.junit.Test public void kAdjTimeToTimezoneFunc12() { final XQuery query = new XQuery( "adjust-time-to-timezone(xs:time(\"10:00:00\"), xs:dayTimeDuration(\"-PT10H\")) eq xs:time(\"10:00:00-10:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Example from F&O. . */ @org.junit.Test public void kAdjTimeToTimezoneFunc13() { final XQuery query = new XQuery( "adjust-time-to-timezone(xs:time(\"10:00:00-07:00\"), xs:dayTimeDuration(\"-PT10H\")) eq xs:time(\"07:00:00-10:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Example from F&O. . */ @org.junit.Test public void kAdjTimeToTimezoneFunc14() { final XQuery query = new XQuery( "adjust-time-to-timezone(xs:time(\"10:00:00\"), ()) eq xs:time(\"10:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Example from F&O. . */ @org.junit.Test public void kAdjTimeToTimezoneFunc15() { final XQuery query = new XQuery( "adjust-time-to-timezone(xs:time(\"10:00:00-07:00\"), ()) eq xs:time(\"10:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Example from F&O. . */ @org.junit.Test public void kAdjTimeToTimezoneFunc16() { final XQuery query = new XQuery( "adjust-time-to-timezone(xs:time(\"10:00:00-07:00\"), xs:dayTimeDuration(\"PT10H\")) eq xs:time(\"03:00:00+10:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `adjust-time-to-timezone((), (), "WRONG PARAM")`. . */ @org.junit.Test public void kAdjTimeToTimezoneFunc2() { final XQuery query = new XQuery( "adjust-time-to-timezone((), (), \"WRONG PARAM\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(adjust-time-to-timezone(()))`. . */ @org.junit.Test public void kAdjTimeToTimezoneFunc3() { final XQuery query = new XQuery( "empty(adjust-time-to-timezone(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(adjust-time-to-timezone((), ()))`. . */ @org.junit.Test public void kAdjTimeToTimezoneFunc4() { final XQuery query = new XQuery( "empty(adjust-time-to-timezone((), ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `adjust-time-to-timezone(()) instance of xs:time?`. . */ @org.junit.Test public void kAdjTimeToTimezoneFunc5() { final XQuery query = new XQuery( "adjust-time-to-timezone(()) instance of xs:time?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Passing a too large xs:dayTimeDuration as timezone to adjust-time-to-timezone(). . */ @org.junit.Test public void kAdjTimeToTimezoneFunc6() { final XQuery query = new XQuery( "adjust-time-to-timezone(xs:time(\"08:02:00\"), xs:dayTimeDuration(\"PT14H1M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0003") ); } /** * Passing a too small xs:dayTimeDuration as timezone to adjust-time-to-timezone(). . */ @org.junit.Test public void kAdjTimeToTimezoneFunc7() { final XQuery query = new XQuery( "adjust-time-to-timezone(xs:time(\"08:02:00\"), xs:dayTimeDuration(\"-PT14H1M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0003") ); } /** * Passing a xs:dayTimeDuration as timezone to adjust-time-to-timezone() which isn't an integral number of minutes. . */ @org.junit.Test public void kAdjTimeToTimezoneFunc8() { final XQuery query = new XQuery( "adjust-time-to-timezone(xs:time(\"08:02:00\"), xs:dayTimeDuration(\"PT14H0M0.001S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0003") ); } /** * Test that the implicit timezone in the dynamic context is used if $timezone is empty; indirectly also tests context stability. . */ @org.junit.Test public void kAdjTimeToTimezoneFunc9() { final XQuery query = new XQuery( "timezone-from-time(adjust-time-to-timezone(xs:time(\"00:00:00\"))) eq implicit-timezone()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check optimization codepath in adjust-time-to-timezone . */ @org.junit.Test public void cbclAdjustTimeToTimezone001() { final XQuery query = new XQuery( "adjust-time-to-timezone(current-time(), implicit-timezone()) eq current-time()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Trigger EvaluateToItem in adjust-time-to-timezone . */ @org.junit.Test public void cbclAdjustTimeToTimezone002() { final XQuery query = new XQuery( "adjust-time-to-timezone(xs:time(\"12:00:00Z\")) eq adjust-time-to-timezone(xs:time(\"13:00:00+01:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test Description: Evaluates The "adjust-time-to-timezone" function as per example 1 (for this function) of the F&O specs. . */ @org.junit.Test public void fnAdjustTimeToTimezone1() { final XQuery query = new XQuery( "fn:adjust-time-to-timezone(xs:time(\"10:00:00-05:00\"),xs:dayTimeDuration(\"-PT5H0M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10:00:00-05:00") ); } /** * Test Description: Evaluates The "adjust-time-to-timezone" function as part of an subtraction expression. Use zulu timezone and empty sequence for 2nd argument. . */ @org.junit.Test public void fnAdjustTimeToTimezone10() { final XQuery query = new XQuery( "fn:adjust-time-to-timezone(xs:time(\"10:00:00Z\"),()) - fn:adjust-time-to-timezone(xs:time(\"10:00:00Z\"),())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Test Description: Evaluates The "adjust-time-to-timezone" function as an argument to a string function. Use zulu timezone and empty sequence for 2nd argument. . */ @org.junit.Test public void fnAdjustTimeToTimezone11() { final XQuery query = new XQuery( "fn:string(fn:adjust-time-to-timezone(xs:time(\"10:00:00Z\"),()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10:00:00") ); } /** * Test Description: Evaluates The string value "adjust-time-to-timezone" function as an argument to a boolean function. Use zulu timezone and empty sequence for 2nd argument. . */ @org.junit.Test public void fnAdjustTimeToTimezone12() { final XQuery query = new XQuery( "fn:boolean(fn:string(fn:adjust-time-to-timezone(xs:time(\"10:00:00Z\"),())))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test Description: Evaluates The string value of "adjust-time-to-timezone" function as an argument to the "fn:not" function. Use zulu timezone and empty sequence for 2nd argument. . */ @org.junit.Test public void fnAdjustTimeToTimezone13() { final XQuery query = new XQuery( "fn:not(fn:string(fn:adjust-time-to-timezone(xs:time(\"10:00:00Z\"),())))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test Description: Evaluates The string value of "adjust-time-to-timezone" function part of a boolean (or) expression and the fn:true function. Use zulu timezone and empty sequence for 2nd argument. . */ @org.junit.Test public void fnAdjustTimeToTimezone14() { final XQuery query = new XQuery( "fn:string(fn:adjust-time-to-timezone(xs:time(\"10:00:00Z\"),())) or fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test Description: Evaluates The string value of "adjust-time-to-timezone" function as part of a boolean (or) expression and the fn:false function. Use zulu timezone and empty sequence for 2nd argument. . */ @org.junit.Test public void fnAdjustTimeToTimezone15() { final XQuery query = new XQuery( "fn:string(fn:adjust-time-to-timezone(xs:time(\"10:00:00Z\"),())) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test Description: Evaluates The string value of "adjust-time-to-timezone" function as part of a boolean (and) expression and the fn:true function. Use zulu timezone and empty sequence for 2nd argument. . */ @org.junit.Test public void fnAdjustTimeToTimezone16() { final XQuery query = new XQuery( "fn:string(fn:adjust-time-to-timezone(xs:time(\"10:00:00Z\"),())) and fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test Description: Evaluates The string value of "adjust-time-to-timezone" function as part of a boolean (and) expression and the fn:false function. Use zulu timezone and empty sequence for 2nd argument. . */ @org.junit.Test public void fnAdjustTimeToTimezone17() { final XQuery query = new XQuery( "fn:string(fn:adjust-time-to-timezone(xs:time(\"10:00:00Z\"),())) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test Description: Evaluates The "adjust-time-to-timezone" function as part of a subtraction expression, which results on a negative number. Uses one adjust-time-to-timezone function and one xs:time constructor. Use zulu timezone and empty sequence for 2nd argument. . */ @org.junit.Test public void fnAdjustTimeToTimezone18() { final XQuery query = new XQuery( "let $tz := xs:dayTimeDuration(\"PT10H\") \n" + " return fn:adjust-time-to-timezone(xs:time(\"01:00:00Z\"),$tz) - xs:time(\"10:00:00Z\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-PT9H") ); } /** * Test Description: Evaluates The "adjust-time-to-timezone" function where an xs:time value is subtracted. Use zulu timezone and empty sequence for 2nd argument. . */ @org.junit.Test public void fnAdjustTimeToTimezone19() { final XQuery query = new XQuery( "let $tz := xs:dayTimeDuration(\"PT10H\") \n" + " return fn:adjust-time-to-timezone(xs:time(\"10:00:00Z\"),$tz) - xs:time(\"09:00:00Z\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT1H") ); } /** * Test Description: Evaluates The "adjust-time-to-timezone" function as per example 2 (for this function) of the F&O specs. . */ @org.junit.Test public void fnAdjustTimeToTimezone2() { final XQuery query = new XQuery( "fn:adjust-time-to-timezone(xs:time(\"10:00:00-07:00\"),xs:dayTimeDuration(\"-PT5H0M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12:00:00-05:00") ); } /** * Test Description: Evaluates The "adjust-time-to-timezone" function as part of a comparisson expression (ge operator). Use zulu timezone and empty sequence for 2nd argument. . */ @org.junit.Test public void fnAdjustTimeToTimezone20() { final XQuery query = new XQuery( "fn:adjust-time-to-timezone(xs:time(\"10:00:00Z\"),()) ge fn:adjust-time-to-timezone(xs:time(\"11:00:00Z\"),())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test Description: Evaluates The "adjust-time-to-timezone" function as per example 3 (for this function) of the F&O specs. . */ @org.junit.Test public void fnAdjustTimeToTimezone3() { final XQuery query = new XQuery( "let $tz := xs:dayTimeDuration(\"-PT10H\") \n" + " return fn:adjust-time-to-timezone(xs:time(\"10:00:00\"), $tz)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10:00:00-10:00") ); } /** * Test Description: Evaluates The "adjust-time-to-timezone" function as per example 4 (for this function) of the F&O specs. . */ @org.junit.Test public void fnAdjustTimeToTimezone4() { final XQuery query = new XQuery( "let $tz := xs:dayTimeDuration(\"-PT10H\") \n" + " return fn:adjust-time-to-timezone(xs:time(\"10:00:00-07:00\"), $tz)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "07:00:00-10:00") ); } /** * Test Description: Evaluates The "adjust-time-to-timezone" function as per example 5 (for this function) of the F&O specs. . */ @org.junit.Test public void fnAdjustTimeToTimezone5() { final XQuery query = new XQuery( "fn:adjust-time-to-timezone(xs:time(\"10:00:00-05:00\"),())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10:00:00") ); } /** * Test Description: Evaluates The "adjust-time-to-timezone" function as per example 6 (for this function) of the F&O specs. . */ @org.junit.Test public void fnAdjustTimeToTimezone6() { final XQuery query = new XQuery( "fn:adjust-time-to-timezone(xs:time(\"10:00:00-07:00\"), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10:00:00") ); } /** * Test Description: Evaluates The "adjust-time-to-timezone" function as per example 7 (for this function) of the F&O specs. . */ @org.junit.Test public void fnAdjustTimeToTimezone7() { final XQuery query = new XQuery( "fn:adjust-time-to-timezone(xs:time(\"10:00:00-07:00\"), xs:dayTimeDuration(\"PT10H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "03:00:00+10:00") ); } /** * Test Description: Evaluates The "adjust-time-to-timezone" function using the empty sequence as the first argument, Uses the count function to avoid empty file. . */ @org.junit.Test public void fnAdjustTimeToTimezone8() { final XQuery query = new XQuery( "fn:count(fn:adjust-time-to-timezone((),()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Test Description: Evaluates The "adjust-time-to-timezone" function as part of a subtraction expression, whicg results on a negative number. Uses two adjust-time-to-timezone functions. . */ @org.junit.Test public void fnAdjustTimeToTimezone9() { final XQuery query = new XQuery( "fn:adjust-time-to-timezone(xs:time(\"09:00:00Z\"),()) - fn:adjust-time-to-timezone(xs:time(\"10:00:00Z\"),())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-PT1H") ); } /** * Evaluates The "adjust-time-to-timezone" function with the arguments set as follows: $arg = xs:time(lower bound) . */ @org.junit.Test public void fnAdjustTimeToTimezone1args1() { final XQuery query = new XQuery( "fn:adjust-time-to-timezone(xs:time(\"00:00:00Z\"),xs:dayTimeDuration(\"-PT10H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "14:00:00-10:00") ); } /** * Evaluates The "adjust-time-to-timezone" function with the arguments set as follows: $arg = xs:time(mid range) . */ @org.junit.Test public void fnAdjustTimeToTimezone1args2() { final XQuery query = new XQuery( "fn:adjust-time-to-timezone(xs:time(\"08:03:35Z\"),xs:dayTimeDuration(\"-PT10H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "22:03:35-10:00") ); } /** * Evaluates The "adjust-time-to-timezone" function with the arguments set as follows: $arg = xs:time(upper bound) . */ @org.junit.Test public void fnAdjustTimeToTimezone1args3() { final XQuery query = new XQuery( "fn:adjust-time-to-timezone(xs:time(\"23:59:59Z\"),xs:dayTimeDuration(\"-PT10H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "13:59:59-10:00") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnAnalyzeString.java000066400000000000000000000447571222453003200300460ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the analyze-string() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnAnalyzeString extends QT3TestSet { /** * analyze-string with empty string. */ @org.junit.Test public void analyzeString001() { final XQuery query = new XQuery( "analyze-string(\"\", \"abc\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", true) ); } /** * analyze-string with empty sequence . */ @org.junit.Test public void analyzeString002() { final XQuery query = new XQuery( "analyze-string((), \"abc\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", true) ); } /** * analyze-string with empty sequence . */ @org.junit.Test public void analyzeString002a() { final XQuery query = new XQuery( "count(analyze-string((), \"abc\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * analyze-string with a mix of matching and non-matching strings. */ @org.junit.Test public void analyzeString003() { final XQuery query = new XQuery( "analyze-string(\"banana\", \"a\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("banana", true) ); } /** * analyze-string with a single non-matching string. */ @org.junit.Test public void analyzeString004() { final XQuery query = new XQuery( "analyze-string(\"banana\", \"custard\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("banana", true) ); } /** * analyze-string with a single matching string. */ @org.junit.Test public void analyzeString005() { final XQuery query = new XQuery( "analyze-string(\"banana\", \".+\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("banana", true) ); } /** * analyze-string with a adjacent matching strings. */ @org.junit.Test public void analyzeString006() { final XQuery query = new XQuery( "analyze-string(\"banana\", \"an\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("banana", true) ) ); } /** * analyze-string with a single captured group. */ @org.junit.Test public void analyzeString007() { final XQuery query = new XQuery( "analyze-string(\"banana\", \"a(n)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("banana", true) ); } /** * analyze-string with nested captured groups. */ @org.junit.Test public void analyzeString008() { final XQuery query = new XQuery( "analyze-string(\"banana\", \"(a(n?))\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("banana", true) ); } /** * analyze-string, groups in alternatives . */ @org.junit.Test public void analyzeString009() { final XQuery query = new XQuery( "analyze-string(\"how now brown cow\", \"(how)|(now)|(brown)|(cow)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("how now brown cow", true) ); } /** * analyze-string, with i flag . */ @org.junit.Test public void analyzeString010() { final XQuery query = new XQuery( "analyze-string(\"how now brown cow\", \"(HOW)|(NOW)|(BROWN)|(COW)\", \"i\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("how now brown cow", true) ); } /** * analyze-string, with i and x flag . */ @org.junit.Test public void analyzeString011() { final XQuery query = new XQuery( "analyze-string(\"how now brown cow\", \" (HOW) | (NOW) \n" + "| (BROWN) | (COW) \", \"ix\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("how now brown cow", true) ); } /** * analyze-string, with flags set to empty string. */ @org.junit.Test public void analyzeString012() { final XQuery query = new XQuery( "analyze-string(\"how now brown cow\", \"(.*?ow\\s+)+\", \"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("how now brown cow", true) ); } /** * analyze-string, with "s" flag. */ @org.junit.Test public void analyzeString013() { final XQuery query = new XQuery( "let $in := \n" + "\"Mary had a little lamb,\n" + "it's fleece was black as soot,\n" + "and everywhere that Mary went,\n" + "it put its sooty foot.\"\n" + " return analyze-string($in, \"Mary.*foot\", \"s\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Mary had a little lamb,\nit's fleece was black as soot,\nand everywhere that Mary went,\nit put its sooty foot.", true) ); } /** * analyze-string, multiple lines without "s" flag . */ @org.junit.Test public void analyzeString014() { final XQuery query = new XQuery( "let $in := \n" + "\"Mary had a little lamb,\n" + "it's fleece was black as soot,\n" + "and everywhere that Mary went,\n" + "it put its sooty foot.\"\n" + " return analyze-string($in, \".+\", \"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("Mary had a little lamb,\nit's fleece was black as soot,\nand everywhere that Mary went,\nit put its sooty foot.", true) ) ); } /** * analyze-string, multiple lines with "m" flag . */ @org.junit.Test public void analyzeString015() { final XQuery query = new XQuery( "let $in := \n" + "\"Mary had a little lamb,\n" + "it's fleece was black as soot,\n" + "and everywhere that Mary went,\n" + "it put its sooty foot.\"\n" + " return analyze-string($in, \"^.+$\", \"m\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("Mary had a little lamb,\nit's fleece was black as soot,\nand everywhere that Mary went,\nit put its sooty foot.", true) ) ); } /** * * analyze-string, multiple lines with "m" flag * . */ @org.junit.Test public void analyzeString016() { final XQuery query = new XQuery( "let $in := \n" + "\"Mary had a little lamb,\n" + "it's fleece was black as soot,\n" + "and everywhere that Mary went,\n" + "it put its sooty foot.\"\n" + " return analyze-string($in, \"^.+$\", \"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("Mary had a little lamb,\nit's fleece was black as soot,\nand everywhere that Mary went,\nit put its sooty foot.", true) ) ); } /** * subtle distinction in the positioning of an empty captured group . */ @org.junit.Test public void analyzeString017() { final XQuery query = new XQuery( "analyze-string(\"banana\", \"(b)(x?)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("banana", true) ); } /** * subtle distinction in the positioning of an empty captured group. */ @org.junit.Test public void analyzeString017a() { final XQuery query = new XQuery( "analyze-string(\"banana\", \"(b(x?))\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("banana", true) ); } /** * non-capturing group indicated by "(?:...)" . */ @org.junit.Test public void analyzeString018() { final XQuery query = new XQuery( "analyze-string(\"banana\", \"(?:b(an)*a)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("banana", true) ); } /** * "q" flag suppresses grouping. */ @org.junit.Test public void analyzeString019() { final XQuery query = new XQuery( "analyze-string(\"((banana))\", \"(banana)\", \"q\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("((banana))", true) ); } /** * test string value of result of analyze-string . */ @org.junit.Test public void analyzeString022() { final XQuery query = new XQuery( "let $result := analyze-string(\"banana\", \"(b)(anana)\") return string($result)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "banana") ); } /** * test string value of result of analyze-string . */ @org.junit.Test public void analyzeString023() { final XQuery query = new XQuery( "let $result := analyze-string(\"banana\", \"(b)(anana)\") return string($result/fn:match[1])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "banana") ); } /** * "." does NOT match CR in default mode. */ @org.junit.Test public void analyzeString026() { final XQuery query = new XQuery( "exactly-one(fn:analyze-string(concat('Mary', codepoints-to-string(13), 'Jones'), 'y.J')/fn:non-match)/string()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("concat('Mary', codepoints-to-string(13), 'Jones')") ); } /** * "." does NOT match CR in default mode. */ @org.junit.Test public void analyzeString027() { final XQuery query = new XQuery( "exactly-one(fn:analyze-string(concat('Mary', codepoints-to-string(13), 'Jones'), 'y.J', 's')/fn:match)/string()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("concat('y', codepoints-to-string(13), 'J')") ); } /** * analyze-string, error, bad regex pattern. */ @org.junit.Test public void analyzeString901() { final XQuery query = new XQuery( "analyze-string(\"abc\", \")-(\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * analyze-string, error, bad flags . */ @org.junit.Test public void analyzeString902() { final XQuery query = new XQuery( "analyze-string(\"abc\", \"abc\", \"w\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0001") ); } /** * analyze-string, error, pattern matches a zero-length string . */ @org.junit.Test public void analyzeString903() { final XQuery query = new XQuery( "analyze-string(\"abc\", \"a|b|c?\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0003") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnAvailableEnvironmentVariables.java000066400000000000000000000155401222453003200331760ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the available-environment-variables() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnAvailableEnvironmentVariables extends QT3TestSet { /** * Check that the function exists. */ @org.junit.Test public void fnAvailableEnvironmentVariables001() { final XQuery query = new XQuery( "fn:exists(fn:available-environment-variables#0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that we can look the function up. */ @org.junit.Test public void fnAvailableEnvironmentVariables002() { final XQuery query = new XQuery( "not(fn:empty(fn:function-lookup(\n" + "\t fn:QName('http://www.w3.org/2005/xpath-functions',\n" + "\t 'available-environment-variables'), 0)))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that it has arity 0, not 1. */ @org.junit.Test public void fnAvailableEnvironmentVariables003() { final XQuery query = new XQuery( "fn:available-environment-variables#1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Check that it has arity 0, not 2. */ @org.junit.Test public void fnAvailableEnvironmentVariables004() { final XQuery query = new XQuery( "fn:available-environment-variables#2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Check that we get back () or a sequence that accepts a predicate. */ @org.junit.Test public void fnAvailableEnvironmentVariables005() { final XQuery query = new XQuery( "let $all := fn:available-environment-variables()\n" + "\t return empty($all) or ($all[1] ne \"\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that no returned values are non-strings. */ @org.junit.Test public void fnAvailableEnvironmentVariables006() { final XQuery query = new XQuery( "\n" + "\t (for $e in fn:available-environment-variables()\n" + "\t return fn:environment-variable($e) instance of xs:string) = (false())\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Check that we can call environment-variable on each returned result. */ @org.junit.Test public void fnAvailableEnvironmentVariables007() { final XQuery query = new XQuery( "\n" + "\t let $all := fn:available-environment-variables(), \n" + "\t $n := count(fn:available-environment-variables())\n" + "\t return\n" + "\t count(\n" + "\t\t for $e in $all return fn:environment-variable($e)\n" + "\t ) eq $n\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * check there are no duplicates in the variable names. */ @org.junit.Test public void fnAvailableEnvironmentVariables008() { final XQuery query = new XQuery( "\n" + "\t let $all := fn:available-environment-variables()\n" + "\t return count($all) eq count(distinct-values($all))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * check that the result is at least moderately stable. */ @org.junit.Test public void fnAvailableEnvironmentVariables009() { final XQuery query = new XQuery( "\n" + " \n" + "\t let $first := {\n" + "\t\t for $e in fn:available-environment-variables()\n" + "\t\t order by $e\n" + "\t\t return { fn:environment-variable($e) }\n" + "\t },\n" + "\t $second := {\n" + "\t\t for $e in fn:available-environment-variables()\n" + "\t\t order by $e\n" + "\t\t return { fn:environment-variable($e) }\n" + "\t }\n" + "\t return deep-equal($first, $second)\n" + "\t \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * check that requesting a not-available variable returns (). */ @org.junit.Test public void fnAvailableEnvironmentVariables010() { final XQuery query = new XQuery( "\n" + "\t let $all := fn:available-environment-variables()\n" + "\t return if (fn:empty($all)) then true()\n" + "\t else fn:empty(fn:environment-variable(fn:string-join($all)))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * check that if any env var is available, QTTEST is a string, "42". */ @org.junit.Test public void fnAvailableEnvironmentVariables011() { final XQuery query = new XQuery( "\n" + "\t let $all := fn:available-environment-variables()\n" + "\t return if (fn:empty($all)) then true()\n" + "\t else if ($all = \"QTTEST\")\n" + "\t then fn:environment-variable(\"QTTEST\") eq \"42\"\n" + "\t else false()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnAvg.java000066400000000000000000003441521222453003200257610ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the avg() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnAvg extends QT3TestSet { /** * A test whose essence is: `avg()`. . */ @org.junit.Test public void kSeqAVGFunc1() { final XQuery query = new XQuery( "avg()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `avg((xs:float(1), xs:integer(0), xs:float(5))) eq 2.0`. . */ @org.junit.Test public void kSeqAVGFunc10() { final XQuery query = new XQuery( "avg((xs:float(1), xs:integer(0), xs:float(5))) eq 2.0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `avg((xs:float(1), xs:integer(0), xs:untypedAtomic(-4))) eq -1`. . */ @org.junit.Test public void kSeqAVGFunc11() { final XQuery query = new XQuery( "avg((xs:float(1), xs:integer(0), xs:untypedAtomic(-4))) eq -1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `avg((xs:float(1), xs:integer(0), xs:untypedAtomic(3))) instance of xs:double`. . */ @org.junit.Test public void kSeqAVGFunc12() { final XQuery query = new XQuery( "avg((xs:float(1), xs:integer(0), xs:untypedAtomic(3))) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `avg((xs:untypedAtomic(3), xs:integer(0), xs:decimal(1))) instance of xs:double`. . */ @org.junit.Test public void kSeqAVGFunc13() { final XQuery query = new XQuery( "avg((xs:untypedAtomic(3), xs:integer(0), xs:decimal(1))) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(avg((3, 3, xs:double("NaN")))) eq "NaN"`. . */ @org.junit.Test public void kSeqAVGFunc14() { final XQuery query = new XQuery( "string(avg((3, 3, xs:double(\"NaN\")))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(avg((3, xs:double("NaN"), 3))) eq "NaN"`. . */ @org.junit.Test public void kSeqAVGFunc15() { final XQuery query = new XQuery( "string(avg((3, xs:double(\"NaN\"), 3))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(avg((xs:double("NaN"), 3, 3))) eq "NaN"`. . */ @org.junit.Test public void kSeqAVGFunc16() { final XQuery query = new XQuery( "string(avg((xs:double(\"NaN\"), 3, 3))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(avg(()))`. . */ @org.junit.Test public void kSeqAVGFunc17() { final XQuery query = new XQuery( "empty(avg(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(avg(((), ())))`. . */ @org.junit.Test public void kSeqAVGFunc18() { final XQuery query = new XQuery( "empty(avg(((), ())))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `avg((-5, -0, -3, -6)) eq -3.5`. . */ @org.junit.Test public void kSeqAVGFunc19() { final XQuery query = new XQuery( "avg((-5, -0, -3, -6)) eq -3.5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `avg(1, "wrong param")`. . */ @org.junit.Test public void kSeqAVGFunc2() { final XQuery query = new XQuery( "avg(1, \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `string(avg((1, 2, 3, xs:float("NaN")))) eq "NaN"`. . */ @org.junit.Test public void kSeqAVGFunc20() { final XQuery query = new XQuery( "string(avg((1, 2, 3, xs:float(\"NaN\")))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(avg((1, 2, 3, xs:double("NaN")))) eq "NaN"`. . */ @org.junit.Test public void kSeqAVGFunc21() { final XQuery query = new XQuery( "string(avg((1, 2, 3, xs:double(\"NaN\")))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(avg((xs:double("NaN"), 1, 2, 3))) eq "NaN"`. . */ @org.junit.Test public void kSeqAVGFunc22() { final XQuery query = new XQuery( "string(avg((xs:double(\"NaN\"), 1, 2, 3))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(avg((xs:float("NaN"), 1, 2, 3))) eq "NaN"`. . */ @org.junit.Test public void kSeqAVGFunc23() { final XQuery query = new XQuery( "string(avg((xs:float(\"NaN\"), 1, 2, 3))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(avg((1, 2, xs:double("NaN"), 1, 2, 3))) eq "NaN"`. . */ @org.junit.Test public void kSeqAVGFunc24() { final XQuery query = new XQuery( "string(avg((1, 2, xs:double(\"NaN\"), 1, 2, 3))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(avg((1, 2, xs:float("NaN"), 1, 2, 3))) eq "NaN"`. . */ @org.junit.Test public void kSeqAVGFunc25() { final XQuery query = new XQuery( "string(avg((1, 2, xs:float(\"NaN\"), 1, 2, 3))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `avg(xs:untypedAtomic("3")) instance of xs:double`. . */ @org.junit.Test public void kSeqAVGFunc26() { final XQuery query = new XQuery( "avg(xs:untypedAtomic(\"3\")) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `avg((1, 2, xs:untypedAtomic("3"))) instance of xs:double`. . */ @org.junit.Test public void kSeqAVGFunc27() { final XQuery query = new XQuery( "avg((1, 2, xs:untypedAtomic(\"3\"))) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `avg((1, 2, xs:untypedAtomic("3"))) eq 2`. . */ @org.junit.Test public void kSeqAVGFunc28() { final XQuery query = new XQuery( "avg((1, 2, xs:untypedAtomic(\"3\"))) eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `avg((xs:float(1), 2, xs:untypedAtomic("3"))) eq 2`. . */ @org.junit.Test public void kSeqAVGFunc29() { final XQuery query = new XQuery( "avg((xs:float(1), 2, xs:untypedAtomic(\"3\"))) eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(avg(()))`. . */ @org.junit.Test public void kSeqAVGFunc3() { final XQuery query = new XQuery( "empty(avg(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `avg((xs:float(1), 2, xs:untypedAtomic("3"))) instance of xs:double`. . */ @org.junit.Test public void kSeqAVGFunc30() { final XQuery query = new XQuery( "avg((xs:float(1), 2, xs:untypedAtomic(\"3\"))) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `avg("a string")`. . */ @org.junit.Test public void kSeqAVGFunc31() { final XQuery query = new XQuery( "avg(\"a string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A test whose essence is: `avg(xs:anyURI("a string"))`. . */ @org.junit.Test public void kSeqAVGFunc32() { final XQuery query = new XQuery( "avg(xs:anyURI(\"a string\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A test whose essence is: `avg((1, 2, 3, xs:anyURI("a string"), xs:double("NaN")))`. . */ @org.junit.Test public void kSeqAVGFunc33() { final XQuery query = new XQuery( "avg((1, 2, 3, xs:anyURI(\"a string\"), xs:double(\"NaN\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A test whose essence is: `avg("a string")`. . */ @org.junit.Test public void kSeqAVGFunc34() { final XQuery query = new XQuery( "avg(\"a string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A test whose essence is: `avg((xs:untypedAtomic(3), xs:integer(3), xs:string(1)))`. . */ @org.junit.Test public void kSeqAVGFunc35() { final XQuery query = new XQuery( "avg((xs:untypedAtomic(3), xs:integer(3), xs:string(1)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A test whose essence is: `avg((xs:string(1), xs:integer(3), xs:untypedAtomic(3)))`. . */ @org.junit.Test public void kSeqAVGFunc36() { final XQuery query = new XQuery( "avg((xs:string(1), xs:integer(3), xs:untypedAtomic(3)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A test whose essence is: `avg((xs:float(2), xs:integer(3), "a string", xs:double(2)))`. . */ @org.junit.Test public void kSeqAVGFunc37() { final XQuery query = new XQuery( "avg((xs:float(2), xs:integer(3), \"a string\", xs:double(2)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A test whose essence is: `avg((xs:yearMonthDuration("P20Y"), (3, 4, 5)))`. . */ @org.junit.Test public void kSeqAVGFunc38() { final XQuery query = new XQuery( "avg((xs:yearMonthDuration(\"P20Y\"), (3, 4, 5)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A test whose essence is: `avg((xs:yearMonthDuration("P20Y"), xs:yearMonthDuration("P10M"))) eq xs:yearMonthDuration("P125M")`. . */ @org.junit.Test public void kSeqAVGFunc39() { final XQuery query = new XQuery( "avg((xs:yearMonthDuration(\"P20Y\"), xs:yearMonthDuration(\"P10M\"))) eq xs:yearMonthDuration(\"P125M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `avg((3, 3, 3)) eq 3`. . */ @org.junit.Test public void kSeqAVGFunc4() { final XQuery query = new XQuery( "avg((3, 3, 3)) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(avg( () ))`. . */ @org.junit.Test public void kSeqAVGFunc40() { final XQuery query = new XQuery( "empty(avg( () ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(avg((xs:float('INF'), xs:float('-INF')))) eq "NaN"`. . */ @org.junit.Test public void kSeqAVGFunc41() { final XQuery query = new XQuery( "string(avg((xs:float('INF'), xs:float('-INF')))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(avg(((3, 4, 5), xs:float('NaN')))) eq "NaN"`. . */ @org.junit.Test public void kSeqAVGFunc42() { final XQuery query = new XQuery( "string(avg(((3, 4, 5), xs:float('NaN')))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `avg((3, 4, 5)) eq 4.0`. . */ @org.junit.Test public void kSeqAVGFunc43() { final XQuery query = new XQuery( "avg((3, 4, 5)) eq 4.0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `avg((-3, -3, -3)) eq -3`. . */ @org.junit.Test public void kSeqAVGFunc5() { final XQuery query = new XQuery( "avg((-3, -3, -3)) eq -3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `avg((xs:float(1), xs:integer(3), xs:float(3))) instance of xs:float`. . */ @org.junit.Test public void kSeqAVGFunc6() { final XQuery query = new XQuery( "avg((xs:float(1), xs:integer(3), xs:float(3))) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `avg((xs:float(1), xs:integer(3), xs:decimal(3))) instance of xs:float`. . */ @org.junit.Test public void kSeqAVGFunc7() { final XQuery query = new XQuery( "avg((xs:float(1), xs:integer(3), xs:decimal(3))) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `avg((xs:float(1), xs:integer(3), xs:double(3))) instance of xs:double`. . */ @org.junit.Test public void kSeqAVGFunc8() { final XQuery query = new XQuery( "avg((xs:float(1), xs:integer(3), xs:double(3))) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `avg((xs:integer(1), xs:integer(3), xs:decimal(3))) instance of xs:decimal`. . */ @org.junit.Test public void kSeqAVGFunc9() { final XQuery query = new XQuery( "avg((xs:integer(1), xs:integer(3), xs:decimal(3))) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is correct when type promotion is required. . */ @org.junit.Test public void k2SeqAVGFunc1() { final XQuery query = new XQuery( "avg((xs:float('NaN'), 2, 3, 4, xs:double('NaN'))) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is correct when type promotion is required(#2). . */ @org.junit.Test public void k2SeqAVGFunc2() { final XQuery query = new XQuery( "avg((xs:float('NaN'), 2, 3.3, 4, xs:double('NaN'))) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check the average of two integers. . */ @org.junit.Test public void k2SeqAVGFunc3() { final XQuery query = new XQuery( "avg((1, 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Testing fn:avg overflows correctly with xs:decimals . */ @org.junit.Test public void cbclAvg001() { final XQuery query = new XQuery( "fn:avg((xs:decimal(\"79000000000000000000000000000\"),\n" + " xs:decimal(\"79000000000000000000000000000\")))\n" + " eq 79000000000000000000000000000\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOAR0002") ) ); } /** * Test fn:avg overflows correctly with xs:dayTimeDurations. */ @org.junit.Test public void cbclAvg002() { final XQuery query = new XQuery( "fn:avg((xs:dayTimeDuration(\"P9223372036854775807D\"), xs:dayTimeDuration(\"P1D\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * Test fn:avg overflows correctly with xs:yearMonthDurations . */ @org.junit.Test public void cbclAvg003() { final XQuery query = new XQuery( "fn:avg((xs:yearMonthDuration(\"P768614336404564650Y\"), xs:yearMonthDuration(\"P1Y\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * Test fn:avg on xs:dayTimeDurations . */ @org.junit.Test public void cbclAvg004() { final XQuery query = new XQuery( "fn:avg((xs:dayTimeDuration(\"P1DT2H\"), xs:dayTimeDuration(\"PT22H\"), xs:dayTimeDuration(\"P1D\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1D") ); } /** * Test fn:avg raises error with xs:dayTimeDurations followed by xs:yearMonthDuration . */ @org.junit.Test public void cbclAvg005() { final XQuery query = new XQuery( "fn:avg((xs:dayTimeDuration(\"P1DT2H\"), xs:dayTimeDuration(\"PT22H\"), xs:yearMonthDuration(\"P1M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Test fn:avg on xs:yearMonthDurations . */ @org.junit.Test public void cbclAvg006() { final XQuery query = new XQuery( "fn:avg((xs:yearMonthDuration(\"P1Y1M\"), xs:yearMonthDuration(\"P11M\"), xs:yearMonthDuration(\"P1Y\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1Y") ); } /** * Test fn:avg raises error with xs:yearMonthDurations followed by xs:dayTimeDuration. */ @org.junit.Test public void cbclAvg007() { final XQuery query = new XQuery( "fn:avg((xs:yearMonthDuration(\"P1Y1M\"), xs:yearMonthDuration(\"P11M\"), xs:dayTimeDuration(\"P1D\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Test fn:avg on mixed numeric types. . */ @org.junit.Test public void cbclAvg008() { final XQuery query = new XQuery( "typeswitch (fn:avg((xs:float(1), xs:double(2), xs:float(3)))) case $x as xs:double return $x default return \"FAIL\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Test boolean(avg) and avg(()).. */ @org.junit.Test public void cbclAvg009() { final XQuery query = new XQuery( "boolean(avg(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || error("XPST0005") ) ); } /** * Test tpe checking is performed when optimizin fn:avg to NaN. . */ @org.junit.Test public void cbclAvg010() { final XQuery query = new XQuery( "avg((xs:double(\"NaN\"), current-date() - xs:date(\"1997-01-01\") ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Test fn:avg returning double NaN.. */ @org.junit.Test public void cbclAvg011() { final XQuery query = new XQuery( "avg((xs:double(\"NaN\"), day-from-date(current-date())))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Test fn:avg returning float NaN. . */ @org.junit.Test public void cbclAvg012() { final XQuery query = new XQuery( "avg((xs:float(\"NaN\"), day-from-date(current-date())))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Test fn:avg on (). . */ @org.junit.Test public void cbclAvg013() { final XQuery query = new XQuery( "empty(avg(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Evaluation of the fn:avg function with argument to sequence of strings. . */ @org.junit.Test public void fnAvg1() { final XQuery query = new XQuery( "fn:avg((\"a\",\"b\",\"c\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Evaluation of the fn:avg function with argument to empty sequence. . */ @org.junit.Test public void fnAvg2() { final XQuery query = new XQuery( "fn:avg(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Test fn:sum on a sequence of xs:dayTimeDuration arguments . */ @org.junit.Test public void fnAvg3() { final XQuery query = new XQuery( "avg((xs:dayTimeDuration(\"P1D\"), xs:dayTimeDuration(\"PT2H\"))) instance of xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test fn:avg on a sequence of xs:dayTimeDuration arguments . */ @org.junit.Test public void fnAvg4() { final XQuery query = new XQuery( "avg(for $x in 1 to 10 return xs:dayTimeDuration(concat(\"PT\",$x,\"H\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT5H30M") ); } /** * Test fn:avg on a sequence of xs:yearMonthDuration arguments . */ @org.junit.Test public void fnAvg5() { final XQuery query = new XQuery( "avg((xs:yearMonthDuration(\"P1Y\"), xs:yearMonthDuration(\"P1M\"))) instance of xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test fn:sum on a sequence of xs:yearMonthDuration arguments . */ @org.junit.Test public void fnAvg6() { final XQuery query = new XQuery( "avg(for $x in 1 to 9 return xs:yearMonthDuration(concat(\"P\",$x,\"M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P5M") ); } /** * Test fn:sum on a sequence of xs:yearMonthDuration and xs:dayTimeDuration arguments . */ @org.junit.Test public void fnAvg7() { final XQuery query = new XQuery( "avg((xs:yearMonthDuration(\"P1Y\"), xs:dayTimeDuration(\"P1D\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FORG0006") || error("XPTY0004") ) ); } /** * Test fn:sum on a sequence of xs:duration arguments . */ @org.junit.Test public void fnAvg8() { final XQuery query = new XQuery( "avg(xs:duration(\"P1Y1M1D\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FORG0006") || error("XPTY0004") ) ); } /** * arg: seq of integer . */ @org.junit.Test public void fnAvgMixArgs001() { final XQuery query = new XQuery( "fn:avg( (3, 4, 5) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("4") ); } /** * arg: yearMonthDuration . */ @org.junit.Test public void fnAvgMixArgs002() { final XQuery query = new XQuery( "fn:avg(( xs:yearMonthDuration(\"P20Y\") , xs:yearMonthDuration(\"P10M\") ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P10Y5M") ); } /** * arg: empty seq . */ @org.junit.Test public void fnAvgMixArgs003() { final XQuery query = new XQuery( "fn:avg(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * arg: float . */ @org.junit.Test public void fnAvgMixArgs004() { final XQuery query = new XQuery( "fn:avg(( xs:float('INF'), xs:float('-INF')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * arg: seq of integer, float . */ @org.junit.Test public void fnAvgMixArgs005() { final XQuery query = new XQuery( "fn:avg(( (3, 4, 5), xs:float('NaN') ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * arg: seq of integer . */ @org.junit.Test public void fnAvgMixArgs006() { final XQuery query = new XQuery( "fn:avg(( fn:string-length(\"Hello\") ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** * arg: seq of integer . */ @org.junit.Test public void fnAvgMixArgs007() { final XQuery query = new XQuery( "fn:avg(( fn:count(\"Hello\") ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * arg: seq of integer . */ @org.junit.Test public void fnAvgMixArgs008() { final XQuery query = new XQuery( "fn:avg( ( ( xs:integer(\"100\"), xs:integer(\"-100\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * arg: seq of integer,decimal . */ @org.junit.Test public void fnAvgMixArgs009() { final XQuery query = new XQuery( "fn:avg( ( ( xs:decimal(\"-1.000000000001\"), xs:integer(\"-100\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-50.5000000000005") || assertEq("-50.5") ) ); } /** * arg: seq of integer,decimal . */ @org.junit.Test public void fnAvgMixArgs010() { final XQuery query = new XQuery( "fn:avg(( (xs:decimal(\"1.01\"), xs:integer(\"12\") )))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("6.505") ); } /** * arg: seq of integer,float,empty seq . */ @org.junit.Test public void fnAvgMixArgs011() { final XQuery query = new XQuery( "fn:avg(( (xs:float(\"NaN\"), 100, (), 2)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * arg: seq of float,decimal . */ @org.junit.Test public void fnAvgMixArgs012() { final XQuery query = new XQuery( "fn:avg(( (xs:float(\"-3.4028235E38\"), xs:decimal(\"-999999999999999999\") )))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(\"-1.7014117E38\")") ); } /** * arg: seq of float,decimal . */ @org.junit.Test public void fnAvgMixArgs013() { final XQuery query = new XQuery( "fn:avg(( (xs:float(\"0\"), xs:decimal(\"-999999999999999999\") ))) eq xs:float(\"-4.9999999999999999E17\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * arg: seq of float,decimal . */ @org.junit.Test public void fnAvgMixArgs014() { final XQuery query = new XQuery( "fn:avg(( (xs:float(\"3.4028235E38\"), xs:decimal(\"-999999999999999999\") )))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(\"1.7014117E38\")") ); } /** * arg: seq of float,decimal . */ @org.junit.Test public void fnAvgMixArgs015() { final XQuery query = new XQuery( "fn:avg(( (xs:float(\"-0\"), xs:decimal(\"-999999999999999999\") ))) eq xs:float(\"-4.9999999999999999E17\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * arg: seq of float,decimal . */ @org.junit.Test public void fnAvgMixArgs016() { final XQuery query = new XQuery( "fn:avg(( (xs:float(\"NaN\"), xs:decimal(\"-999999999999999999\") )))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * arg: seq of float,decimal . */ @org.junit.Test public void fnAvgMixArgs017() { final XQuery query = new XQuery( "fn:avg(( (xs:float(\"INF\"), xs:decimal(\"-999999999999999999\") )))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** * arg: seq of float . */ @org.junit.Test public void fnAvgMixArgs018() { final XQuery query = new XQuery( "fn:avg(( (xs:float(\"1.01\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.01") ); } /** * arg: seq of float,decimal . */ @org.junit.Test public void fnAvgMixArgs019() { final XQuery query = new XQuery( "fn:avg(( (xs:float(\"-INF\"), xs:decimal(\"2.34\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-INF") ); } /** * arg: seq of double,integer . */ @org.junit.Test public void fnAvgMixArgs020() { final XQuery query = new XQuery( "fn:avg(( (xs:double(\"-1.7976931348623157E308\"), xs:integer(\"-999999999999999999\") ) )) eq xs:double(\"-8.988465674311579E307\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * arg: seq of double,integer . */ @org.junit.Test public void fnAvgMixArgs021() { final XQuery query = new XQuery( "fn:avg(( (xs:double(\"0\"), xs:integer(\"-999999999999999999\") ) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-5.0E17") ); } /** * arg: seq of double,integer . */ @org.junit.Test public void fnAvgMixArgs022() { final XQuery query = new XQuery( "fn:avg(( (xs:double(\"1.7976931348623157E308\"), xs:integer(\"-999999999999999999\") ) )) eq xs:double(\"8.988465674311579E307\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * arg: seq of double,integer . */ @org.junit.Test public void fnAvgMixArgs023() { final XQuery query = new XQuery( "fn:avg(( (xs:double(\"-0\"), xs:integer(\"-999999999999999999\") ) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-5.0E17") ); } /** * arg: seq of double,integer . */ @org.junit.Test public void fnAvgMixArgs024() { final XQuery query = new XQuery( "fn:avg(( (xs:double(\"-INF\"), xs:integer(\"-999999999999999999\") ) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-INF") ); } /** * arg: seq of double,integer . */ @org.junit.Test public void fnAvgMixArgs025() { final XQuery query = new XQuery( "fn:avg(( (xs:double(\"NaN\"), xs:integer(\"-999999999999999999\") ) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * arg: seq of double,float . */ @org.junit.Test public void fnAvgMixArgs026() { final XQuery query = new XQuery( "fn:avg(( (xs:double(\"1.34\"), xs:float(\"INF\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** * arg: seq of double,integer . */ @org.junit.Test public void fnAvgMixArgs027() { final XQuery query = new XQuery( "fn:avg(( (xs:double(\"INF\"), 2, 3)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs028() { final XQuery query = new XQuery( "fn:avg((xs:yearMonthDuration(\"P20Y\") , (3, 4, 5)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs029() { final XQuery query = new XQuery( "fn:avg(( fn:empty(\"Hello\")) or fn:boolean(fn:count(\"Hello\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs030() { final XQuery query = new XQuery( "fn:avg(( concat('hi',' all') ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs031() { final XQuery query = new XQuery( "fn:avg(( fn:empty(\"Hello\") ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs032() { final XQuery query = new XQuery( "fn:avg(( (\"a\", \"b\", \"c\", true()) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs033() { final XQuery query = new XQuery( "fn:avg(( (xs:string(\"xyz\"), (), (), \"a\" , \"b\") ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs034() { final XQuery query = new XQuery( "fn:avg(( (xs:anyURI(\"www.example.com\"), \"a\", (\"\"), \"b\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs035() { final XQuery query = new XQuery( "fn:avg(( (xs:integer(\"100\"), xs:string(\"abc\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs036() { final XQuery query = new XQuery( "fn:avg(( (xs:integer(\"-999999999999999999\") , \"a\", (), \"3\") ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs037() { final XQuery query = new XQuery( "fn:avg(( (xs:integer(\"830993497117024304\"), \"a\", (), \"3\") ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs038() { final XQuery query = new XQuery( "fn:avg(( (xs:integer(\"999999999999999999\"), \"a\", (), \"3\") ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs039() { final XQuery query = new XQuery( "fn:avg(( (xs:decimal(\"-999999999999999999\") , \"a\", (), \"3\") ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs040() { final XQuery query = new XQuery( "fn:avg(( (xs:decimal(\"617375191608514839\"), \"a\", (), \"3\") ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs041() { final XQuery query = new XQuery( "fn:avg(( (xs:decimal(\"999999999999999999\"), \"a\", (), \"3\") ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs042() { final XQuery query = new XQuery( "fn:avg(( (xs:decimal(\"1.01\"), xs:integer(\"12\"), xs:anyURI(\"www.example.com\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs043() { final XQuery query = new XQuery( "fn:avg(( (xs:float(\"-3.4028235E38\"), xs:decimal(\"-999999999999999999\") , \"a\", (), \"3\") ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs044() { final XQuery query = new XQuery( "fn:avg(( (xs:float(\"0\"), xs:decimal(\"-999999999999999999\") , \"a\", (), \"3\") ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs045() { final XQuery query = new XQuery( "fn:avg(( (xs:float(\"3.4028235E38\"), xs:decimal(\"-999999999999999999\") , \"a\", (), \"3\") ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs046() { final XQuery query = new XQuery( "fn:avg(( (xs:float(\"-0\"), xs:decimal(\"-999999999999999999\") , \"a\", (), \"3\") ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs047() { final XQuery query = new XQuery( "fn:avg(( (xs:float(\"NaN\"), xs:decimal(\"-999999999999999999\") , \"a\", (), \"3\") ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "NaN") || error("FORG0006") ) ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs048() { final XQuery query = new XQuery( "fn:avg(( (xs:float(\"INF\"), xs:decimal(\"-999999999999999999\") , \"a\", (), \"3\") ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs049() { final XQuery query = new XQuery( "fn:avg(( (xs:float(\"1.01\"), xs:string(\"a\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs050() { final XQuery query = new XQuery( "fn:avg(( (xs:float(\"-INF\"), xs:decimal(\"2.34\"), \"abc\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs051() { final XQuery query = new XQuery( "fn:avg(( (xs:double(\"-1.7976931348623157E308\"), xs:integer(\"-999999999999999999\") , \"a\", (), \"3\") ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs052() { final XQuery query = new XQuery( "fn:avg(( (xs:double(\"0\"), xs:integer(\"-999999999999999999\") , \"a\", (), \"3\") ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs053() { final XQuery query = new XQuery( "fn:avg(( (xs:double(\"1.7976931348623157E308\"), xs:integer(\"-999999999999999999\") , \"a\", (), \"3\") ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs054() { final XQuery query = new XQuery( "fn:avg(( (xs:double(\"-0\"), xs:integer(\"-999999999999999999\") , \"a\", (), \"3\") ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs055() { final XQuery query = new XQuery( "fn:avg(( (xs:double(\"-INF\"), xs:integer(\"-999999999999999999\") , \"a\", (), \"3\") ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs056() { final XQuery query = new XQuery( "fn:avg(( (xs:double(\"NaN\"), xs:integer(\"-999999999999999999\") , \"a\", (), \"3\") ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "NaN") || error("FORG0006") ) ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs057() { final XQuery query = new XQuery( "fn:avg(( (xs:double(\"1.34\"), xs:float(\"INF\"), true())))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs058() { final XQuery query = new XQuery( "fn:avg(( (xs:boolean(\"false\"), xs:string(\"xyz\"), (), (), \"a\" , \"b\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs059() { final XQuery query = new XQuery( "fn:avg(( (true(), xs:string(\"xyz\"), (), (), \"a\" , \"b\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs060() { final XQuery query = new XQuery( "fn:avg(( (false(), xs:string(\"xyz\"), (), (), \"a\" , \"b\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs061() { final XQuery query = new XQuery( "fn:avg(( (xs:boolean(\"1\"), xs:double(\"-INF\"), \"s\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs062() { final XQuery query = new XQuery( "fn:avg(( (xs:boolean(\"true\"), xs:date(\"1993-03-31\"), 4, \"a\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs063() { final XQuery query = new XQuery( "fn:avg(( (xs:date(\"1993-03-31\"), xs:string(\"xyz\"), (), (), \"a\" , \"b\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs064() { final XQuery query = new XQuery( "fn:avg(( (xs:dateTime(\"1972-12-31T00:00:00\"), xs:boolean(\"false\"), (), (\" \")) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0006 . */ @org.junit.Test public void fnAvgMixArgs065() { final XQuery query = new XQuery( "fn:avg(( (xs:time(\"12:30:00\"), xs:decimal(\"2.000003\"), 2)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Negative test gives FORG0001 . */ @org.junit.Test public void fnAvgMixArgs066() { final XQuery query = new XQuery( "fn:avg(/works/employee[1])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:double(lower bound) . */ @org.junit.Test public void fnAvgdbl1args1() { final XQuery query = new XQuery( "fn:avg((xs:double(\"-1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.7976931348623157E308") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:double(mid range) . */ @org.junit.Test public void fnAvgdbl1args2() { final XQuery query = new XQuery( "fn:avg((xs:double(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:double(upper bound) . */ @org.junit.Test public void fnAvgdbl1args3() { final XQuery query = new XQuery( "fn:avg((xs:double(\"1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.7976931348623157E308") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void fnAvgdbl2args1() { final XQuery query = new XQuery( "fn:avg((xs:double(\"-1.7976931348623157E150\"),xs:double(\"-1.7976931348623157E150\"))) eq -1.7976931348623157E150", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:double(mid range) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void fnAvgdbl2args2() { final XQuery query = new XQuery( "fn:avg((xs:double(\"0\"),xs:double(\"-1.7976931348623157E308\"))) eq -8.9884656743115785E307", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:double(upper bound) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void fnAvgdbl2args3() { final XQuery query = new XQuery( "fn:avg((xs:double(\"1.7976931348623157E308\"),xs:double(\"-1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(mid range) . */ @org.junit.Test public void fnAvgdbl2args4() { final XQuery query = new XQuery( "fn:avg((xs:double(\"-1.7976931348623157E308\"),xs:double(\"0\"))) eq -8.9884656743115785E307", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(upper bound) . */ @org.junit.Test public void fnAvgdbl2args5() { final XQuery query = new XQuery( "fn:avg((xs:double(\"-1.7976931348623157E308\"),xs:double(\"1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:decimal(lower bound) . */ @org.junit.Test public void fnAvgdec1args1() { final XQuery query = new XQuery( "fn:avg((xs:decimal(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:decimal(mid range) . */ @org.junit.Test public void fnAvgdec1args2() { final XQuery query = new XQuery( "fn:avg((xs:decimal(\"617375191608514839\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("617375191608514839") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:decimal(upper bound) . */ @org.junit.Test public void fnAvgdec1args3() { final XQuery query = new XQuery( "fn:avg((xs:decimal(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void fnAvgdec2args1() { final XQuery query = new XQuery( "fn:avg((xs:decimal(\"-999999999999999999\"),xs:decimal(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:decimal(mid range) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void fnAvgdec2args2() { final XQuery query = new XQuery( "fn:avg((xs:decimal(\"617375191608514839\"),xs:decimal(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-191312404195742580") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:decimal(upper bound) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void fnAvgdec2args3() { final XQuery query = new XQuery( "fn:avg((xs:decimal(\"999999999999999999\"),xs:decimal(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(mid range) . */ @org.junit.Test public void fnAvgdec2args4() { final XQuery query = new XQuery( "fn:avg((xs:decimal(\"-999999999999999999\"),xs:decimal(\"617375191608514839\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-191312404195742580") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(upper bound) . */ @org.junit.Test public void fnAvgdec2args5() { final XQuery query = new XQuery( "fn:avg((xs:decimal(\"-999999999999999999\"),xs:decimal(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:float(lower bound) . */ @org.junit.Test public void fnAvgflt1args1() { final XQuery query = new XQuery( "fn:avg((xs:float(\"-3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float('-3.4028235E38')") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:float(mid range) . */ @org.junit.Test public void fnAvgflt1args2() { final XQuery query = new XQuery( "fn:avg((xs:float(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:float(upper bound) . */ @org.junit.Test public void fnAvgflt1args3() { final XQuery query = new XQuery( "fn:avg((xs:float(\"3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(\"3.4028235E38\")") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void fnAvgflt2args1() { final XQuery query = new XQuery( "fn:avg((xs:float(\"-3.4028235E38\"),xs:float(\"-3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "-INF") || assertEq("-3.4028235E38") || error("FOAR0002") ) ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:float(mid range) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void fnAvgflt2args2() { final XQuery query = new XQuery( "fn:avg((xs:float(\"0\"),xs:float(\"-3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float('-1.7014117E38')") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:float(upper bound) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void fnAvgflt2args3() { final XQuery query = new XQuery( "fn:avg((xs:float(\"3.4028235E38\"),xs:float(\"-3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(mid range) . */ @org.junit.Test public void fnAvgflt2args4() { final XQuery query = new XQuery( "fn:avg((xs:float(\"-3.4028235E38\"),xs:float(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float('-1.7014117E38')") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(upper bound) . */ @org.junit.Test public void fnAvgflt2args5() { final XQuery query = new XQuery( "fn:avg((xs:float(\"-3.4028235E38\"),xs:float(\"3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:int(lower bound) . */ @org.junit.Test public void fnAvgint1args1() { final XQuery query = new XQuery( "fn:avg((xs:int(\"-2147483648\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2147483648") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:int(mid range) . */ @org.junit.Test public void fnAvgint1args2() { final XQuery query = new XQuery( "fn:avg((xs:int(\"-1873914410\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1873914410") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:int(upper bound) . */ @org.junit.Test public void fnAvgint1args3() { final XQuery query = new XQuery( "fn:avg((xs:int(\"2147483647\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2147483647") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void fnAvgint2args1() { final XQuery query = new XQuery( "fn:avg((xs:int(\"-2147483648\"),xs:int(\"-2147483648\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2147483648") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:int(mid range) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void fnAvgint2args2() { final XQuery query = new XQuery( "fn:avg((xs:int(\"-1873914410\"),xs:int(\"-2147483648\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2010699029") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:int(upper bound) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void fnAvgint2args3() { final XQuery query = new XQuery( "fn:avg((xs:int(\"2147483647\"),xs:int(\"-2147483648\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0.5") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(mid range) . */ @org.junit.Test public void fnAvgint2args4() { final XQuery query = new XQuery( "fn:avg((xs:int(\"-2147483648\"),xs:int(\"-1873914410\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2010699029") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(upper bound) . */ @org.junit.Test public void fnAvgint2args5() { final XQuery query = new XQuery( "fn:avg((xs:int(\"-2147483648\"),xs:int(\"2147483647\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0.5") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:integer(lower bound) . */ @org.junit.Test public void fnAvgintg1args1() { final XQuery query = new XQuery( "fn:avg((xs:integer(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:integer(mid range) . */ @org.junit.Test public void fnAvgintg1args2() { final XQuery query = new XQuery( "fn:avg((xs:integer(\"830993497117024304\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("830993497117024304") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:integer(upper bound) . */ @org.junit.Test public void fnAvgintg1args3() { final XQuery query = new XQuery( "fn:avg((xs:integer(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void fnAvgintg2args1() { final XQuery query = new XQuery( "fn:avg((xs:integer(\"-999999999999999999\"),xs:integer(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:integer(mid range) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void fnAvgintg2args2() { final XQuery query = new XQuery( "fn:avg((xs:integer(\"830993497117024304\"),xs:integer(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-84503251441487847.5") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:integer(upper bound) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void fnAvgintg2args3() { final XQuery query = new XQuery( "fn:avg((xs:integer(\"999999999999999999\"),xs:integer(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(mid range) . */ @org.junit.Test public void fnAvgintg2args4() { final XQuery query = new XQuery( "fn:avg((xs:integer(\"-999999999999999999\"),xs:integer(\"830993497117024304\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-84503251441487847.5") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(upper bound) . */ @org.junit.Test public void fnAvgintg2args5() { final XQuery query = new XQuery( "fn:avg((xs:integer(\"-999999999999999999\"),xs:integer(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:long(lower bound) . */ @org.junit.Test public void fnAvglng1args1() { final XQuery query = new XQuery( "fn:avg((xs:long(\"-92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:long(mid range) . */ @org.junit.Test public void fnAvglng1args2() { final XQuery query = new XQuery( "fn:avg((xs:long(\"-47175562203048468\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-47175562203048468") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:long(upper bound) . */ @org.junit.Test public void fnAvglng1args3() { final XQuery query = new XQuery( "fn:avg((xs:long(\"92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("92233720368547758") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void fnAvglng2args1() { final XQuery query = new XQuery( "fn:avg((xs:long(\"-92233720368547758\"),xs:long(\"-92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:long(mid range) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void fnAvglng2args2() { final XQuery query = new XQuery( "fn:avg((xs:long(\"-47175562203048468\"),xs:long(\"-92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-69704641285798113") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:long(upper bound) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void fnAvglng2args3() { final XQuery query = new XQuery( "fn:avg((xs:long(\"92233720368547758\"),xs:long(\"-92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(mid range) . */ @org.junit.Test public void fnAvglng2args4() { final XQuery query = new XQuery( "fn:avg((xs:long(\"-92233720368547758\"),xs:long(\"-47175562203048468\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-69704641285798113") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(upper bound) . */ @org.junit.Test public void fnAvglng2args5() { final XQuery query = new XQuery( "fn:avg((xs:long(\"-92233720368547758\"),xs:long(\"92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnAvgnint1args1() { final XQuery query = new XQuery( "fn:avg((xs:negativeInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnAvgnint1args2() { final XQuery query = new XQuery( "fn:avg((xs:negativeInteger(\"-297014075999096793\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-297014075999096793") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnAvgnint1args3() { final XQuery query = new XQuery( "fn:avg((xs:negativeInteger(\"-1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnAvgnint2args1() { final XQuery query = new XQuery( "fn:avg((xs:negativeInteger(\"-999999999999999999\"),xs:negativeInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:negativeInteger(mid range) $arg2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnAvgnint2args2() { final XQuery query = new XQuery( "fn:avg((xs:negativeInteger(\"-297014075999096793\"),xs:negativeInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-648507037999548396") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:negativeInteger(upper bound) $arg2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnAvgnint2args3() { final XQuery query = new XQuery( "fn:avg((xs:negativeInteger(\"-1\"),xs:negativeInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-500000000000000000") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnAvgnint2args4() { final XQuery query = new XQuery( "fn:avg((xs:negativeInteger(\"-999999999999999999\"),xs:negativeInteger(\"-297014075999096793\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-648507037999548396") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnAvgnint2args5() { final XQuery query = new XQuery( "fn:avg((xs:negativeInteger(\"-999999999999999999\"),xs:negativeInteger(\"-1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-500000000000000000") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnAvgnni1args1() { final XQuery query = new XQuery( "fn:avg((xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnAvgnni1args2() { final XQuery query = new XQuery( "fn:avg((xs:nonNegativeInteger(\"303884545991464527\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("303884545991464527") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnAvgnni1args3() { final XQuery query = new XQuery( "fn:avg((xs:nonNegativeInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnAvgnni2args1() { final XQuery query = new XQuery( "fn:avg((xs:nonNegativeInteger(\"0\"),xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:nonNegativeInteger(mid range) $arg2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnAvgnni2args2() { final XQuery query = new XQuery( "fn:avg((xs:nonNegativeInteger(\"303884545991464527\"),xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("151942272995732263.5") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:nonNegativeInteger(upper bound) $arg2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnAvgnni2args3() { final XQuery query = new XQuery( "fn:avg((xs:nonNegativeInteger(\"999999999999999999\"),xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("499999999999999999.5") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnAvgnni2args4() { final XQuery query = new XQuery( "fn:avg((xs:nonNegativeInteger(\"0\"),xs:nonNegativeInteger(\"303884545991464527\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("151942272995732263.5") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnAvgnni2args5() { final XQuery query = new XQuery( "fn:avg((xs:nonNegativeInteger(\"0\"),xs:nonNegativeInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("499999999999999999.5") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnAvgnpi1args1() { final XQuery query = new XQuery( "fn:avg((xs:nonPositiveInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnAvgnpi1args2() { final XQuery query = new XQuery( "fn:avg((xs:nonPositiveInteger(\"-475688437271870490\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-475688437271870490") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnAvgnpi1args3() { final XQuery query = new XQuery( "fn:avg((xs:nonPositiveInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnAvgnpi2args1() { final XQuery query = new XQuery( "fn:avg((xs:nonPositiveInteger(\"-999999999999999999\"),xs:nonPositiveInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:nonPositiveInteger(mid range) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnAvgnpi2args2() { final XQuery query = new XQuery( "fn:avg((xs:nonPositiveInteger(\"-475688437271870490\"),xs:nonPositiveInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-737844218635935244.5") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:nonPositiveInteger(upper bound) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnAvgnpi2args3() { final XQuery query = new XQuery( "fn:avg((xs:nonPositiveInteger(\"0\"),xs:nonPositiveInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-499999999999999999.5") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnAvgnpi2args4() { final XQuery query = new XQuery( "fn:avg((xs:nonPositiveInteger(\"-999999999999999999\"),xs:nonPositiveInteger(\"-475688437271870490\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-737844218635935244.5") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnAvgnpi2args5() { final XQuery query = new XQuery( "fn:avg((xs:nonPositiveInteger(\"-999999999999999999\"),xs:nonPositiveInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-499999999999999999.5") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnAvgpint1args1() { final XQuery query = new XQuery( "fn:avg((xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnAvgpint1args2() { final XQuery query = new XQuery( "fn:avg((xs:positiveInteger(\"52704602390610033\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("52704602390610033") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnAvgpint1args3() { final XQuery query = new XQuery( "fn:avg((xs:positiveInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnAvgpint2args1() { final XQuery query = new XQuery( "fn:avg((xs:positiveInteger(\"1\"),xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:positiveInteger(mid range) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnAvgpint2args2() { final XQuery query = new XQuery( "fn:avg((xs:positiveInteger(\"52704602390610033\"),xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("26352301195305017") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:positiveInteger(upper bound) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnAvgpint2args3() { final XQuery query = new XQuery( "fn:avg((xs:positiveInteger(\"999999999999999999\"),xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("500000000000000000") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnAvgpint2args4() { final XQuery query = new XQuery( "fn:avg((xs:positiveInteger(\"1\"),xs:positiveInteger(\"52704602390610033\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("26352301195305017") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnAvgpint2args5() { final XQuery query = new XQuery( "fn:avg((xs:positiveInteger(\"1\"),xs:positiveInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("500000000000000000") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:short(lower bound) . */ @org.junit.Test public void fnAvgsht1args1() { final XQuery query = new XQuery( "fn:avg((xs:short(\"-32768\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-32768") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:short(mid range) . */ @org.junit.Test public void fnAvgsht1args2() { final XQuery query = new XQuery( "fn:avg((xs:short(\"-5324\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-5324") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:short(upper bound) . */ @org.junit.Test public void fnAvgsht1args3() { final XQuery query = new XQuery( "fn:avg((xs:short(\"32767\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("32767") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void fnAvgsht2args1() { final XQuery query = new XQuery( "fn:avg((xs:short(\"-32768\"),xs:short(\"-32768\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-32768") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:short(mid range) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void fnAvgsht2args2() { final XQuery query = new XQuery( "fn:avg((xs:short(\"-5324\"),xs:short(\"-32768\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-19046") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:short(upper bound) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void fnAvgsht2args3() { final XQuery query = new XQuery( "fn:avg((xs:short(\"32767\"),xs:short(\"-32768\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0.5") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(mid range) . */ @org.junit.Test public void fnAvgsht2args4() { final XQuery query = new XQuery( "fn:avg((xs:short(\"-32768\"),xs:short(\"-5324\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-19046") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(upper bound) . */ @org.junit.Test public void fnAvgsht2args5() { final XQuery query = new XQuery( "fn:avg((xs:short(\"-32768\"),xs:short(\"32767\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0.5") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnAvgulng1args1() { final XQuery query = new XQuery( "fn:avg((xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnAvgulng1args2() { final XQuery query = new XQuery( "fn:avg((xs:unsignedLong(\"130747108607674654\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("130747108607674654") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnAvgulng1args3() { final XQuery query = new XQuery( "fn:avg((xs:unsignedLong(\"184467440737095516\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("184467440737095516") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnAvgulng2args1() { final XQuery query = new XQuery( "fn:avg((xs:unsignedLong(\"0\"),xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:unsignedLong(mid range) $arg2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnAvgulng2args2() { final XQuery query = new XQuery( "fn:avg((xs:unsignedLong(\"130747108607674654\"),xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("65373554303837327") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:unsignedLong(upper bound) $arg2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnAvgulng2args3() { final XQuery query = new XQuery( "fn:avg((xs:unsignedLong(\"184467440737095516\"),xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("92233720368547758") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnAvgulng2args4() { final XQuery query = new XQuery( "fn:avg((xs:unsignedLong(\"0\"),xs:unsignedLong(\"130747108607674654\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("65373554303837327") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnAvgulng2args5() { final XQuery query = new XQuery( "fn:avg((xs:unsignedLong(\"0\"),xs:unsignedLong(\"184467440737095516\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("92233720368547758") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnAvgusht1args1() { final XQuery query = new XQuery( "fn:avg((xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnAvgusht1args2() { final XQuery query = new XQuery( "fn:avg((xs:unsignedShort(\"44633\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("44633") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnAvgusht1args3() { final XQuery query = new XQuery( "fn:avg((xs:unsignedShort(\"65535\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("65535") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnAvgusht2args1() { final XQuery query = new XQuery( "fn:avg((xs:unsignedShort(\"0\"),xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:unsignedShort(mid range) $arg2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnAvgusht2args2() { final XQuery query = new XQuery( "fn:avg((xs:unsignedShort(\"44633\"),xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("22316.5") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:unsignedShort(upper bound) $arg2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnAvgusht2args3() { final XQuery query = new XQuery( "fn:avg((xs:unsignedShort(\"65535\"),xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("32767.5") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnAvgusht2args4() { final XQuery query = new XQuery( "fn:avg((xs:unsignedShort(\"0\"),xs:unsignedShort(\"44633\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("22316.5") ); } /** * Evaluates The "avg" function with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnAvgusht2args5() { final XQuery query = new XQuery( "fn:avg((xs:unsignedShort(\"0\"),xs:unsignedShort(\"65535\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("32767.5") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnBaseUri.java000066400000000000000000001354371222453003200266020ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the base-uri() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnBaseUri extends QT3TestSet { /** * A test whose essence is: `base-uri((), "wrong param")`. . */ @org.junit.Test public void kBaseURIFunc1() { final XQuery query = new XQuery( "base-uri((), \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(base-uri(()))`. . */ @org.junit.Test public void kBaseURIFunc2() { final XQuery query = new XQuery( "empty(base-uri(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke on a comment node. . */ @org.junit.Test public void k2BaseURIFunc1() { final XQuery query = new XQuery( "empty(document-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure computed processing-instructions pick up the correct xml:base value. . */ @org.junit.Test public void k2BaseURIFunc10() { final XQuery query = new XQuery( "let $i := {processing-instruction target {\"data\"}} return base-uri($i/processing-instruction()[1])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/") ); } /** * Ensure comments pick up the correct xml:base value. . */ @org.junit.Test public void k2BaseURIFunc11() { final XQuery query = new XQuery( "let $i := return base-uri($i/comment()[1])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/") ); } /** * Ensure computed comments pick up the correct xml:base value. . */ @org.junit.Test public void k2BaseURIFunc12() { final XQuery query = new XQuery( "let $i := {comment {\"content\"}} return base-uri($i/comment()[1])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/") ); } /** * Ensure computed comments don't pick up the base-uri from the static context. . */ @org.junit.Test public void k2BaseURIFunc13() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com\"; empty(base-uri(comment {\"content\"}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure computed comments don't pick up the base-uri from the static context. . */ @org.junit.Test public void k2BaseURIFunc14() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com\"; empty(base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure computed processing-instructions don't pick up the base-uri from the static context. . */ @org.junit.Test public void k2BaseURIFunc15() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com\"; empty(base-uri(processing-instruction target {\"data\"}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure processing-instructions don't pick up the base-uri from the static context. . */ @org.junit.Test public void k2BaseURIFunc16() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com\"; empty(base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure computed attributes don't pick up the base-uri from the static context. . */ @org.junit.Test public void k2BaseURIFunc17() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com\"; empty(base-uri(attribute name {\"data\"}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure computed attributes pick up the base-uri from parent. . */ @org.junit.Test public void k2BaseURIFunc18() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com\"; let $i := return base-uri($i/@attr)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com") ); } /** * Ensure computed attributes pick up the resolved base-uri of the parent. . */ @org.junit.Test public void k2BaseURIFunc19() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com/\"; let $i := return base-uri($i/@attr)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/xml") ); } /** * Invoke on an attribute node. . */ @org.junit.Test public void k2BaseURIFunc2() { final XQuery query = new XQuery( "empty(document-uri(attribute name {\"content\"}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure computed attributes pick up the resolved base-uri of the parent(#2). . */ @org.junit.Test public void k2BaseURIFunc20() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com/\"; let $i := return base-uri($i/@xml:base)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/xml") ); } /** * Ensure that the return value of document-uri() is of correct type. . */ @org.junit.Test public void k2BaseURIFunc21() { final XQuery query = new XQuery( "for $i in (1, base-uri(.), 3) return \n" + " typeswitch($i) \n" + " case xs:anyURI return \"xs:anyURI\" \n" + " case xs:integer return \"xs:integer\" \n" + " default return \"FAILURE\"", ctx); try { query.context(node(file("prod/AxisStep/TopMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xs:integer xs:anyURI xs:integer") ); } /** * Ensure that the base URI is empty for direct PI constructors. . */ @org.junit.Test public void k2BaseURIFunc22() { final XQuery query = new XQuery( "declare base-uri \"http://example.com/baseURI\"; empty(base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that the base URI is empty for computed PI constructors. . */ @org.junit.Test public void k2BaseURIFunc23() { final XQuery query = new XQuery( "declare base-uri \"http://example.com/baseURI\"; empty(base-uri(processing-instruction target {\"data\"}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that the base URI is empty for direct PI constructors, with no base-uri declaration. . */ @org.junit.Test public void k2BaseURIFunc24() { final XQuery query = new XQuery( "empty(base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that the base URI is empty for computed PI constructors, with no base-uri declaration. . */ @org.junit.Test public void k2BaseURIFunc25() { final XQuery query = new XQuery( "empty(base-uri(processing-instruction target {\"data\"}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that the base URI is empty for computed attribute constructors, with no base-uri declaration. . */ @org.junit.Test public void k2BaseURIFunc26() { final XQuery query = new XQuery( "empty(base-uri(attribute name {\"value\"}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that the base URI is set for computed documents. . */ @org.junit.Test public void k2BaseURIFunc27() { final XQuery query = new XQuery( "declare base-uri \"http://example.com/BASEURI\"; base-uri(document {()})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.com/BASEURI") ); } /** * Check the document URI and base URI simultaneously for a computed document node. . */ @org.junit.Test public void k2BaseURIFunc28() { final XQuery query = new XQuery( "declare base-uri \"http://example.com/\"; let $i := document {()} return (\"Base URI:\", base-uri($i), \"Document URI:\", document-uri($i))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Base URI: http://example.com/ Document URI:") ); } /** * Use an URI in an xml:base element that is a valid URI, but an invalid HTTP URL. Since implementations aren't required to validate specific schemes but allowed to, this may either raise an error or return the URI. . */ @org.junit.Test public void k2BaseURIFunc29() { final XQuery query = new XQuery( "let $i := fn:base-uri(Element content) return $i eq \"http:\\\\example.com\\\\examples\" or empty($i)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke on a processing instruction node. . */ @org.junit.Test public void k2BaseURIFunc3() { final XQuery query = new XQuery( "empty(document-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use an empty xml:base attribute. . */ @org.junit.Test public void k2BaseURIFunc30() { final XQuery query = new XQuery( "fn:base-uri(Element content/b)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.com/examples") ); } /** * Compute the base URI from a processing instruction. . */ @org.junit.Test public void k2BaseURIFunc31() { final XQuery query = new XQuery( "fn:base-uri(exactly-one(/processing-instruction()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.com/examples") ); } /** * Compute the base URI from a comment. . */ @org.junit.Test public void k2BaseURIFunc32() { final XQuery query = new XQuery( "fn:base-uri(exactly-one(/comment()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.com/examples") ); } /** * Ensure recursive resolution works. . */ @org.junit.Test public void k2BaseURIFunc33() { final XQuery query = new XQuery( " /a/b/base-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.com/DEF/file.test") ); } /** * Invoke on a processing instruction node. . */ @org.junit.Test public void k2BaseURIFunc4() { final XQuery query = new XQuery( "empty(document-uri(processing-instruction name {123}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke on a text node. . */ @org.junit.Test public void k2BaseURIFunc5() { final XQuery query = new XQuery( "empty(document-uri(text {123}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke on a single element node. . */ @org.junit.Test public void k2BaseURIFunc6() { final XQuery query = new XQuery( "empty(document-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke on a single attribute node. . */ @org.junit.Test public void k2BaseURIFunc7() { final XQuery query = new XQuery( "empty(document-uri(/@attr))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke on a single document node. . */ @org.junit.Test public void k2BaseURIFunc8() { final XQuery query = new XQuery( "empty(document-uri(document {1}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure processing-instructions pick up the correct xml:base value. . */ @org.junit.Test public void k2BaseURIFunc9() { final XQuery query = new XQuery( "let $i := \n" + " return base-uri($i/processing-instruction()[1])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/") ); } /** * The base-uri property of the copied node, and of each of its descendants, * is set to be the same as that of its new parent, unless it (the child node) has an xml:base attribute, * in which case its base-uri property is set to the value of that attribute, resolved (if it is relative) * against the base-uri property of its new parent node. * . */ @org.junit.Test public void cbclBaseUri001() { final XQuery query = new XQuery( "\n" + " \tlet $d := document { } \n" + " \treturn let $y := { $d/root/explicit-base } return fn:base-uri(($y/explicit-base)[1])\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.w3.org/TR/xquery") ); } /** * * The base-uri property of the copied node, and of each of its descendants, is set to be the same as * that of its new parent, unless it (the child node) has an xml:base attribute, in which case its * base-uri property is set to the value of that attribute, resolved (if it is relative) against * the base-uri property of its new parent node. * . */ @org.junit.Test public void cbclBaseUri002() { final XQuery query = new XQuery( "\n" + " let $d := document { } \n" + " return let $y := { $d/root/explicit-base } \n" + " return fn:base-uri(($y/explicit-base/child)[1])\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.w3.org/TR/xquery") ); } /** * * The base-uri property of the copied node, and of each of its descendants, is set to be the * same as that of its new parent, unless it (the child node) has an xml:base attribute, * in which case its base-uri property is set to the value of that attribute, resolved * (if it is relative) against the base-uri property of its new parent node. * . */ @org.junit.Test public void cbclBaseUri003() { final XQuery query = new XQuery( "\n" + " let $d := document { } \n" + " return let $y := { $d/root/implicit-base } \n" + " return fn:base-uri(($y/implicit-base)[1])\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.org") ); } /** * * The base-uri property of the copied node, and of each of its descendants, is set to be the * same as that of its new parent, unless it (the child node) has an xml:base attribute, * in which case its base-uri property is set to the value of that attribute, resolved * (if it is relative) against the base-uri property of its new parent node. * . */ @org.junit.Test public void cbclBaseUri004() { final XQuery query = new XQuery( "\n" + " let $d := document { } \n" + " return let $y := { $d/root/implicit-base } \n" + " return fn:base-uri(($y/implicit-base/child)[1])\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.org") ); } /** * Evaluation of base-uri function with no arguments and no context item . */ @org.junit.Test public void fnBaseUri1() { final XQuery query = new XQuery( "declare namespace eg = \"http://example.org\"; declare function eg:noContextFunction() { fn:base-uri() }; declare variable $input-context1 external; eg:noContextFunction()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Evaluation of base-uri function with argument set to a directly constructed Element node with base-xml argument (no escaping). Use fn:string . */ @org.junit.Test public void fnBaseUri10() { final XQuery query = new XQuery( "fn:string(fn:base-uri(Element content))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com") ); } /** * Evaluation of base-uri function with argument set to a computed constructed Document node with no base-xml argument. Use fn:count . */ @org.junit.Test public void fnBaseUri11() { final XQuery query = new XQuery( "fn:count(fn:base-uri(document {some content}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || assertEq("1") ) ); } /** * Evaluation of base-uri function with argument set to a computed constructed Document node argument. Uses declared base uri property Use fn:string . */ @org.junit.Test public void fnBaseUri12() { final XQuery query = new XQuery( "declare base-uri \"http://example.org\"; \n" + " fn:string(fn:base-uri(document {some content}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.org") ); } /** * Evaluation of base-uri function with argument set to a directly constructed element node argument. Should not declared base uri property Use fn:string . */ @org.junit.Test public void fnBaseUri13() { final XQuery query = new XQuery( "declare base-uri \"http://example.org\"; fn:string(fn:base-uri(some content))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.org") ); } /** * Evaluation of base-uri function with argument set to a computed constructed attribute node argument. . */ @org.junit.Test public void fnBaseUri14() { final XQuery query = new XQuery( "fn:base-uri(attribute anAttribute{\"attribute value\"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of base-uri function with argument set to a directly constructed PI node argument. . */ @org.junit.Test public void fnBaseUri15() { final XQuery query = new XQuery( "fn:base-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of base-uri function with argument set to a computed constructed PI node argument. Use fn:count to avoid empty file . */ @org.junit.Test public void fnBaseUri16() { final XQuery query = new XQuery( "fn:base-uri(processing-instruction {\"PItarget\"} {\"PIcontent\"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of base-uri function with argument set to a computed constructed PI node argument. Use fn:count to avoid empty file. Should not use the declare base-uri . */ @org.junit.Test public void fnBaseUri17() { final XQuery query = new XQuery( "\n" + " declare base-uri \"http://example.org\"; \n" + " fn:base-uri(processing-instruction {\"PItarget\"} {\"PIcontent\"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of base-uri function with argument set to a directly constructed element node (via FLOWR expr). Use the declare base-uri . */ @org.junit.Test public void fnBaseUri18() { final XQuery query = new XQuery( "declare base-uri \"http://example.org\"; \n" + " let $var := With some contexnt \n" + " return fn:string(fn:base-uri($var))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.org") ); } /** * Evaluation of base-uri function with argument set to a directly constructed element node (via FLOWR expr). Use the xml-base attribute . */ @org.junit.Test public void fnBaseUri19() { final XQuery query = new XQuery( "let $var := With some content \n" + " return fn:string(fn:base-uri($var))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.examples.com") ); } /** * Evaluation of base-uri function with context item not a node . */ @org.junit.Test public void fnBaseUri2() { final XQuery query = new XQuery( "(1 to 100)[fn:base-uri()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluation of base-uri function with argument set to a directly constructed element node (via FLOWR expr). Use the xml-base attribute and should ignore declared base uri property. . */ @org.junit.Test public void fnBaseUri20() { final XQuery query = new XQuery( "declare base-uri \"http://example.org\"; \n" + " let $var := With some content \n" + " return fn:string(fn:base-uri($var))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.examples.com") ); } /** * Evaluation of base-uri function with argument set to a directly constructed comment node (via FLOWR expr). Should ignore declared base uri property. . */ @org.junit.Test public void fnBaseUri21() { final XQuery query = new XQuery( "declare base-uri \"http://example.org\"; \n" + " let $var := return fn:base-uri($var)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of base-uri function using the "." and no context item. . */ @org.junit.Test public void fnBaseUri22() { final XQuery query = new XQuery( "declare namespace eg = \"http://example.org\"; \n" + " declare function eg:noContextFunction() { fn:base-uri(.) }; \n" + " eg:noContextFunction()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Evaluation of base-uri function with argument set to a directly constructed Element node with base-xml argument that needs escaping. Uses fn:string. . */ @org.junit.Test public void fnBaseUri23() { final XQuery query = new XQuery( "fn:string(fn:base-uri(Element content))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.com/examples") ); } /** * Evaluation of base-uri#0 function with context item set to a directly constructed comment . */ @org.junit.Test public void fnBaseUri24() { final XQuery query = new XQuery( "()/base-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of base-uri#0 function with context item set to a computed constructed comment . */ @org.junit.Test public void fnBaseUri25() { final XQuery query = new XQuery( "(comment {\"A Comment Node \"})/fn:base-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of base-uri#0 function with context item set to a computed constructed Text node. . */ @org.junit.Test public void fnBaseUri26() { final XQuery query = new XQuery( "(text {\"A Text Node\"})/fn:base-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of base-uri#0 function with context item set to a computed constructed Element node with not base-xml argument. . */ @org.junit.Test public void fnBaseUri27() { final XQuery query = new XQuery( "fn:count((element anElement {\"An Element Node\"})/base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1") || assertEq("0") ) ); } /** * Evaluation of base-uri#0 function with context item set to a directly constructed Element node with not base-xml argument. Use fn:count to avoid empty file. . */ @org.junit.Test public void fnBaseUri28() { final XQuery query = new XQuery( "fn:count((Element content)/fn:base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1") || assertEq("0") ) ); } /** * Evaluation of base-uri#0 function with context item set to a directly constructed Element node with base-xml argument. Use fn:string . */ @org.junit.Test public void fnBaseUri29() { final XQuery query = new XQuery( "fn:string((Element content)/fn:base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.com/examples") ); } /** * Evaluation of base-uri function with argument set to empty sequence Use fn:count to avoid empty file. . */ @org.junit.Test public void fnBaseUri3() { final XQuery query = new XQuery( "fn:count(fn:base-uri(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of base-uri#0 function with context item set to a directly constructed Element node with base-xml argument (no escaping). Use fn:string . */ @org.junit.Test public void fnBaseUri30() { final XQuery query = new XQuery( "fn:string((Element content)/base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com") ); } /** * Evaluation of base-uri#0 function with context item set to a computed constructed Document node with no base-xml argument. Use fn:count . */ @org.junit.Test public void fnBaseUri31() { final XQuery query = new XQuery( "fn:count((document {some content})/base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || assertEq("1") ) ); } /** * Evaluation of base-uri#0 function with context item set to a computed constructed Document node argument. Uses declared base uri property Use fn:string . */ @org.junit.Test public void fnBaseUri32() { final XQuery query = new XQuery( "declare base-uri \"http://example.org\"; \n" + " fn:string((document {some content})/base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.org") ); } /** * Evaluation of base-uri#0 function with context item set to a directly constructed element node argument. Should not declared base uri property Use fn:string . */ @org.junit.Test public void fnBaseUri33() { final XQuery query = new XQuery( "declare base-uri \"http://example.org\"; fn:string((some content)/fn:base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.org") ); } /** * Evaluation of base-uri#0 function with context item set to a computed constructed attribute node argument. . */ @org.junit.Test public void fnBaseUri34() { final XQuery query = new XQuery( "(attribute anAttribute{\"attribute value\"})/fn:base-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of base-uri#0 function with context item set to a directly constructed PI node argument. . */ @org.junit.Test public void fnBaseUri35() { final XQuery query = new XQuery( "()/fn:base-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of base-uri#0 function with context item set to a computed constructed PI node argument. Use fn:count to avoid empty file . */ @org.junit.Test public void fnBaseUri36() { final XQuery query = new XQuery( "(processing-instruction {\"PItarget\"} {\"PIcontent\"})/base-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of base-uri#0 function with context item set to a computed constructed PI node argument. Use fn:count to avoid empty file. Should not use the declare base-uri . */ @org.junit.Test public void fnBaseUri37() { final XQuery query = new XQuery( "\n" + " declare base-uri \"http://example.org\"; \n" + " (processing-instruction {\"PItarget\"} {\"PIcontent\"})/base-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of base-uri#0 function with context item set to a directly constructed element node (via FLOWR expr). Use the declare base-uri . */ @org.junit.Test public void fnBaseUri38() { final XQuery query = new XQuery( "declare base-uri \"http://example.org\"; \n" + " let $var := With some contexnt \n" + " return fn:string(($var)/base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.org") ); } /** * Evaluation of base-uri#0 function with context item set to a directly constructed element node (via FLOWR expr). Use the xml-base attribute . */ @org.junit.Test public void fnBaseUri39() { final XQuery query = new XQuery( "let $var := With some content \n" + " return fn:string(($var)/base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.examples.com") ); } /** * Evaluation of base-uri function with argument set to a directly constructed comment . */ @org.junit.Test public void fnBaseUri4() { final XQuery query = new XQuery( "fn:base-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of base-uri#0 function with context item set to a directly constructed element node (via FLOWR expr). Use the xml-base attribute and should ignore declared base uri property. . */ @org.junit.Test public void fnBaseUri40() { final XQuery query = new XQuery( "declare base-uri \"http://example.org\"; \n" + " let $var := With some content \n" + " return fn:string(($var)/base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.examples.com") ); } /** * Evaluation of base-uri#0 function with context item set to a directly constructed comment node (via FLOWR expr). Should ignore declared base uri property. . */ @org.junit.Test public void fnBaseUri41() { final XQuery query = new XQuery( "declare base-uri \"http://example.org\"; \n" + " let $var := return ($var)/base-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of base-uri#0 function using undefined context item. . */ @org.junit.Test public void fnBaseUri42() { final XQuery query = new XQuery( "declare namespace eg = \"http://example.org\"; \n" + " declare function eg:noContextFunction() { fn:base-uri() }; \n" + " eg:noContextFunction()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Evaluation of base-uri#0 function with context item set to a directly constructed Element node with base-xml argument that needs escaping. Uses fn:string. . */ @org.junit.Test public void fnBaseUri43() { final XQuery query = new XQuery( "fn:string((Element content)/fn:base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.com/examples") ); } /** * Evaluation of base-uri function with argument set to a computed constructed comment . */ @org.junit.Test public void fnBaseUri5() { final XQuery query = new XQuery( "fn:base-uri(comment {\"A Comment Node \"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of base-uri function with argument set to a computed constructed Text node. . */ @org.junit.Test public void fnBaseUri6() { final XQuery query = new XQuery( "fn:base-uri(text {\"A Text Node\"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of base-uri function with argument set to a computed constructed Element node with not base-xml argument. . */ @org.junit.Test public void fnBaseUri7() { final XQuery query = new XQuery( "fn:count(fn:base-uri(element anElement {\"An Element Node\"}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1") || assertEq("0") ) ); } /** * Evaluation of base-uri function with argument set to a directly constructed Element node with not base-xml argument. Use fn:count to avoid empty file. . */ @org.junit.Test public void fnBaseUri8() { final XQuery query = new XQuery( "fn:count(fn:base-uri(Element content))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1") || assertEq("0") ) ); } /** * Evaluation of base-uri function with argument set to a directly constructed Element node with base-xml argument. Use fn:string . */ @org.junit.Test public void fnBaseUri9() { final XQuery query = new XQuery( "fn:string(fn:base-uri(Element content))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.com/examples") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnBoolean.java000066400000000000000000002167521222453003200266270ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the boolean() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnBoolean extends QT3TestSet { /** * Test: K-SeqBooleanFunc-1 Purpose: A test whose essence is: `boolean()`. . */ @org.junit.Test public void kSeqBooleanFunc1() { final XQuery query = new XQuery( "boolean()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Test: K-SeqBooleanFunc-10 Purpose: fn:boolean() invoked on an non-empty * xs:untypedAtomic should return true. . */ @org.junit.Test public void kSeqBooleanFunc10() { final XQuery query = new XQuery( "boolean(xs:untypedAtomic(\"string\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K-SeqBooleanFunc-11 Purpose: fn:boolean() invoked on an non-empty * xs:untypedAtomic should return false. . */ @org.junit.Test public void kSeqBooleanFunc11() { final XQuery query = new XQuery( "not(boolean(xs:untypedAtomic(\"\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K-SeqBooleanFunc-12 Purpose: A test whose essence is: `boolean(1)`. . */ @org.junit.Test public void kSeqBooleanFunc12() { final XQuery query = new XQuery( "boolean(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K-SeqBooleanFunc-13 Purpose: A test whose essence is: `not(boolean(""))`. . */ @org.junit.Test public void kSeqBooleanFunc13() { final XQuery query = new XQuery( "not(boolean(\"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K-SeqBooleanFunc-14 Purpose: A test whose essence is: * `not(boolean(false()))`. . */ @org.junit.Test public void kSeqBooleanFunc14() { final XQuery query = new XQuery( "not(boolean(false()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K-SeqBooleanFunc-15 Purpose: A test whose essence is: `boolean(true())`. . */ @org.junit.Test public void kSeqBooleanFunc15() { final XQuery query = new XQuery( "boolean(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K-SeqBooleanFunc-16 Purpose: A test whose essence is: `true() eq * boolean(remove((xs:hexBinary("FF"), 1), 1) treat as xs:integer)`. . */ @org.junit.Test public void kSeqBooleanFunc16() { final XQuery query = new XQuery( "true() eq boolean(remove((xs:hexBinary(\"FF\"), 1), 1) treat as xs:integer)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K-SeqBooleanFunc-17 Purpose: A test whose essence is: `not(0)`. . */ @org.junit.Test public void kSeqBooleanFunc17() { final XQuery query = new XQuery( "not(0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * zzzA test whose essence is: `boolean(1)`. . */ @org.junit.Test public void kSeqBooleanFunc18() { final XQuery query = new XQuery( "boolean(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * zzzA test whose essence is: `boolean(1.1)`. . */ @org.junit.Test public void kSeqBooleanFunc19() { final XQuery query = new XQuery( "boolean(1.1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K-SeqBooleanFunc-2 Purpose: A test whose essence is: `boolean(1, "wrong * param")`. . */ @org.junit.Test public void kSeqBooleanFunc2() { final XQuery query = new XQuery( "boolean(1, \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * sA test whose essence is: `boolean(1.1e1)`. . */ @org.junit.Test public void kSeqBooleanFunc20() { final XQuery query = new XQuery( "boolean(1.1e1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * sA test whose essence is: `not(0.0e0)`. . */ @org.junit.Test public void kSeqBooleanFunc21() { final XQuery query = new XQuery( "not(0.0e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * sA test whose essence is: `not(0.0)`. . */ @org.junit.Test public void kSeqBooleanFunc22() { final XQuery query = new XQuery( "not(0.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * sA test whose essence is: `boolean(-1)`. . */ @org.junit.Test public void kSeqBooleanFunc23() { final XQuery query = new XQuery( "boolean(-1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(())`. . */ @org.junit.Test public void kSeqBooleanFunc24() { final XQuery query = new XQuery( "not(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(boolean(()))`. . */ @org.junit.Test public void kSeqBooleanFunc25() { final XQuery query = new XQuery( "not(boolean(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(())`. . */ @org.junit.Test public void kSeqBooleanFunc26() { final XQuery query = new XQuery( "not(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(empty((1, 2)))`. . */ @org.junit.Test public void kSeqBooleanFunc27() { final XQuery query = new XQuery( "not(empty((1, 2)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(empty(((), 1, 2)))`. . */ @org.junit.Test public void kSeqBooleanFunc28() { final XQuery query = new XQuery( "not(empty(((), 1, 2)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `boolean('nada')`. . */ @org.junit.Test public void kSeqBooleanFunc29() { final XQuery query = new XQuery( "boolean('nada')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K-SeqBooleanFunc-3 Purpose: A test whose essence is: `boolean((1, 2))`. . */ @org.junit.Test public void kSeqBooleanFunc3() { final XQuery query = new XQuery( "boolean((1, 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A test whose essence is: `boolean('""')`. . */ @org.junit.Test public void kSeqBooleanFunc30() { final XQuery query = new XQuery( "boolean('\"\"')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not('')`.. */ @org.junit.Test public void kSeqBooleanFunc31() { final XQuery query = new XQuery( "not('')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Apply fn:boolean() on fn:count(). . */ @org.junit.Test public void kSeqBooleanFunc32() { final XQuery query = new XQuery( "fn:boolean(count((1, 2, 3, timezone-from-time(current-time()), 4)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K-SeqBooleanFunc-4 Purpose: A test whose essence is: * `boolean(xs:QName("valid-local-name"))`. . */ @org.junit.Test public void kSeqBooleanFunc4() { final XQuery query = new XQuery( "boolean(xs:QName(\"valid-local-name\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Test: K-SeqBooleanFunc-5 Purpose: A test whose essence is: * `boolean(xs:hexBinary("03"))`. . */ @org.junit.Test public void kSeqBooleanFunc5() { final XQuery query = new XQuery( "boolean(xs:hexBinary(\"03\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Test: K-SeqBooleanFunc-6 Purpose: A test whose essence is: * `boolean(xs:base64Binary("aaaa"))`. . */ @org.junit.Test public void kSeqBooleanFunc6() { final XQuery query = new XQuery( "boolean(xs:base64Binary(\"aaaa\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Test: K-SeqBooleanFunc-7 Purpose: Extracting EBV from xs:anyURI is allowed. . */ @org.junit.Test public void kSeqBooleanFunc7() { final XQuery query = new XQuery( "boolean(xs:anyURI(\"example.com/\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K-SeqBooleanFunc-8 Purpose: Extracting EBV from xs:anyURI is allowed. . */ @org.junit.Test public void kSeqBooleanFunc8() { final XQuery query = new XQuery( "not(boolean(xs:anyURI(\"\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: K-SeqBooleanFunc-9 Purpose: fn:boolean() invoked on an non-empty xs:string * should return true. . */ @org.junit.Test public void kSeqBooleanFunc9() { final XQuery query = new XQuery( "boolean(\"string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * boolean() applied to a node sequence. */ @org.junit.Test public void boolean001() { final XQuery query = new XQuery( "boolean(//*:Open)", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * boolean() applied to an empty node sequence. */ @org.junit.Test public void boolean002() { final XQuery query = new XQuery( "boolean(//*:NotAtAllOpen)", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * boolean() applied to a sequence whose first item is a node. */ @org.junit.Test public void boolean003() { final XQuery query = new XQuery( "boolean((/, 93.7))", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * boolean() applied to a sequence whose second item is a node. */ @org.junit.Test public void boolean004() { final XQuery query = new XQuery( "boolean((93.7, /))", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * boolean() applied to a sequence of two booleans. */ @org.junit.Test public void boolean005() { final XQuery query = new XQuery( "boolean((true(), false()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * boolean() applied to a sequence of two integers. */ @org.junit.Test public void boolean006() { final XQuery query = new XQuery( "boolean((1, 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * boolean() applied to a sequence of two strings. */ @org.junit.Test public void boolean007() { final XQuery query = new XQuery( "boolean((\"\", \"a\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * boolean() applied to a sequence of of a boolean and then an empty * node-set. */ @org.junit.Test public void boolean008() { final XQuery query = new XQuery( "boolean((true(), //aspidistra))", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * boolean() applied to the string "false". */ @org.junit.Test public void boolean009() { final XQuery query = new XQuery( "boolean(string(false()))", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:boolean on a count-preserving function . */ @org.junit.Test public void cbclBoolean001() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:generate($count as xs:integer) {\n" + " \t\tif ($count < 0) then \"string\" \n" + " \t\telse for $x in 1 to $count \n" + " \t\t\t return \n" + " \t\t\t \tif ($x mod 3 = 0) then \n" + " \t\t\t \telse if ($x mod 3 = 1) then \n" + " \t\t\t \telse \n" + " \t}; \n" + " \tfn:boolean(fn:reverse( local:generate(5) ))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:boolean on fn:count function. */ @org.junit.Test public void cbclBoolean002() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:generate($count as xs:integer) {\n" + " \t\tfor $x in 1 to $count \n" + " \t\treturn \n" + " \t\t\tif ($x mod 3 = 0) then \n" + " \t\t\telse if ($x mod 3 = 1) then \n" + " \t\t\telse \n" + " \t}; \n" + " \tfn:boolean(fn:count( local:generate(5) ))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test fn:boolean on sequence of node and string. */ @org.junit.Test public void cbclBoolean003() { final XQuery query = new XQuery( "declare function local:f() { (, \"a\") }; boolean(local:f())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FORG0006") ) ); } /** * Tests negation of fn:boolean . */ @org.junit.Test public void cbclBoolean004() { final XQuery query = new XQuery( "not(boolean(for $x in 1 to 10 return $x * $x))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * test fn:boolean on a text node. */ @org.junit.Test public void cbclBoolean005() { final XQuery query = new XQuery( "\n" + " declare function local:repeat($count as xs:integer, $arg as xs:string) { for $x in 1 to $count return $arg }; \n" + " fn:boolean( text { local:repeat(0, \"string\") } )\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:boolean on a text node . */ @org.junit.Test public void cbclBoolean006() { final XQuery query = new XQuery( "\n" + " declare function local:repeat($count as xs:integer, $arg as xs:string) as item()* { \n" + " \tif ($count lt 0) then '$count must not be negative' \n" + " \telse text { for $x in 1 to $count return $arg }\n" + " }; \n" + " fn:boolean( local:repeat(0, \"string\") )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Name: context-item-1 Description: Evaluation of contect item expression for * which the context item is not defined. . */ @org.junit.Test public void contextItem1() { final XQuery query = new XQuery( "let $f := function() { fn:boolean(.) } return $f()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Test: fn-boolean-050.xq Written By: Carmelo Montanez Date: February 6, 2006 * Purpose: Raise error condition FORG0006 for fn:boolean. . */ @org.junit.Test public void fnBoolean050() { final XQuery query = new XQuery( "fn:boolean(xs:dateTime(\"1999-12-31T00:00:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Test: fn-boolean-mixed-args-001.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: empty sequence . */ @org.junit.Test public void fnBooleanMixedArgs001() { final XQuery query = new XQuery( "fn:boolean(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test: fn-boolean-mixed-args-002.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: string . */ @org.junit.Test public void fnBooleanMixedArgs002() { final XQuery query = new XQuery( "fn:boolean(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test: fn-boolean-mixed-args-003.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: boolean function . */ @org.junit.Test public void fnBooleanMixedArgs003() { final XQuery query = new XQuery( "fn:boolean(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test: fn-boolean-mixed-args-004.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: boolean function . */ @org.junit.Test public void fnBooleanMixedArgs004() { final XQuery query = new XQuery( "fn:boolean(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-005.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: string . */ @org.junit.Test public void fnBooleanMixedArgs005() { final XQuery query = new XQuery( "fn:boolean(xs:string(\"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test: fn-boolean-mixed-args-006.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: string . */ @org.junit.Test public void fnBooleanMixedArgs006() { final XQuery query = new XQuery( "fn:boolean(('a'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-007.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: string . */ @org.junit.Test public void fnBooleanMixedArgs007() { final XQuery query = new XQuery( "fn:boolean(xs:string('abc'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-008.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: integer . */ @org.junit.Test public void fnBooleanMixedArgs008() { final XQuery query = new XQuery( "fn:boolean(0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test: fn-boolean-mixed-args-009.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: integer . */ @org.junit.Test public void fnBooleanMixedArgs009() { final XQuery query = new XQuery( "fn:boolean(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-010.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: integer . */ @org.junit.Test public void fnBooleanMixedArgs010() { final XQuery query = new XQuery( "fn:boolean(-1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-011.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: float . */ @org.junit.Test public void fnBooleanMixedArgs011() { final XQuery query = new XQuery( "fn:boolean(xs:float('NaN'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test: fn-boolean-mixed-args-012.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: float . */ @org.junit.Test public void fnBooleanMixedArgs012() { final XQuery query = new XQuery( "fn:boolean(xs:float('-INF'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-013.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: float . */ @org.junit.Test public void fnBooleanMixedArgs013() { final XQuery query = new XQuery( "fn:boolean(xs:float('INF'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-014.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: float . */ @org.junit.Test public void fnBooleanMixedArgs014() { final XQuery query = new XQuery( "fn:boolean(xs:float(0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test: fn-boolean-mixed-args-015.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: float . */ @org.junit.Test public void fnBooleanMixedArgs015() { final XQuery query = new XQuery( "fn:boolean(xs:float(1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-016.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: float . */ @org.junit.Test public void fnBooleanMixedArgs016() { final XQuery query = new XQuery( "fn:boolean(xs:float(-1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-017.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: double . */ @org.junit.Test public void fnBooleanMixedArgs017() { final XQuery query = new XQuery( "fn:boolean(xs:double('NaN'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test: fn-boolean-mixed-args-018.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: double . */ @org.junit.Test public void fnBooleanMixedArgs018() { final XQuery query = new XQuery( "fn:boolean(xs:double('-INF'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-019.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: double . */ @org.junit.Test public void fnBooleanMixedArgs019() { final XQuery query = new XQuery( "fn:boolean(xs:double('INF'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-020.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: double . */ @org.junit.Test public void fnBooleanMixedArgs020() { final XQuery query = new XQuery( "fn:boolean(xs:double(0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test: fn-boolean-mixed-args-021.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: double . */ @org.junit.Test public void fnBooleanMixedArgs021() { final XQuery query = new XQuery( "fn:boolean(xs:double(1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-022.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: double . */ @org.junit.Test public void fnBooleanMixedArgs022() { final XQuery query = new XQuery( "fn:boolean(xs:double('1'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-023.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: double . */ @org.junit.Test public void fnBooleanMixedArgs023() { final XQuery query = new XQuery( "fn:boolean(xs:double('NaN'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test: fn-boolean-mixed-args-024.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: decimal . */ @org.junit.Test public void fnBooleanMixedArgs024() { final XQuery query = new XQuery( "fn:boolean(xs:decimal('9.99999999999999999999999999'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-025.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: decimal . */ @org.junit.Test public void fnBooleanMixedArgs025() { final XQuery query = new XQuery( "fn:boolean(xs:decimal('-123456789.123456789123456789'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-026.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: decimal . */ @org.junit.Test public void fnBooleanMixedArgs026() { final XQuery query = new XQuery( "fn:boolean(xs:decimal('0'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test: fn-boolean-mixed-args-027.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: decimal . */ @org.junit.Test public void fnBooleanMixedArgs027() { final XQuery query = new XQuery( "fn:boolean(xs:decimal('1'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-028.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: decimal . */ @org.junit.Test public void fnBooleanMixedArgs028() { final XQuery query = new XQuery( "fn:boolean(xs:decimal('-1'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-029.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: integer . */ @org.junit.Test public void fnBooleanMixedArgs029() { final XQuery query = new XQuery( "fn:boolean(xs:integer('0'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test: fn-boolean-mixed-args-030.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: integer . */ @org.junit.Test public void fnBooleanMixedArgs030() { final XQuery query = new XQuery( "fn:boolean(xs:integer('1'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-031.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: integer . */ @org.junit.Test public void fnBooleanMixedArgs031() { final XQuery query = new XQuery( "fn:boolean(xs:integer('-1'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-032.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: nonPositiveInteger . */ @org.junit.Test public void fnBooleanMixedArgs032() { final XQuery query = new XQuery( "fn:boolean(xs:nonPositiveInteger('-99999999999999999'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-033.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: nonPositiveInteger . */ @org.junit.Test public void fnBooleanMixedArgs033() { final XQuery query = new XQuery( "fn:boolean(xs:nonPositiveInteger('0'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test: fn-boolean-mixed-args-034.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: nonPositiveInteger . */ @org.junit.Test public void fnBooleanMixedArgs034() { final XQuery query = new XQuery( "fn:boolean(xs:nonPositiveInteger('-1'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-035.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: negativeInteger . */ @org.junit.Test public void fnBooleanMixedArgs035() { final XQuery query = new XQuery( "fn:boolean(xs:negativeInteger('-99999999999999999'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-036.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: negativeInteger . */ @org.junit.Test public void fnBooleanMixedArgs036() { final XQuery query = new XQuery( "fn:boolean(xs:negativeInteger('-1'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-037.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: positiveInteger . */ @org.junit.Test public void fnBooleanMixedArgs037() { final XQuery query = new XQuery( "fn:boolean(xs:positiveInteger('99999999999999999'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-038.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: positiveInteger . */ @org.junit.Test public void fnBooleanMixedArgs038() { final XQuery query = new XQuery( "fn:boolean(xs:positiveInteger('1'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-039.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: long . */ @org.junit.Test public void fnBooleanMixedArgs039() { final XQuery query = new XQuery( "fn:boolean(xs:long('9223372036854775807'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-040.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: long . */ @org.junit.Test public void fnBooleanMixedArgs040() { final XQuery query = new XQuery( "fn:boolean(xs:long('-9223372036854775808'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-041.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: long . */ @org.junit.Test public void fnBooleanMixedArgs041() { final XQuery query = new XQuery( "fn:boolean(xs:long('0'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test: fn-boolean-mixed-args-042.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: long . */ @org.junit.Test public void fnBooleanMixedArgs042() { final XQuery query = new XQuery( "fn:boolean(xs:long('1'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-043.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: long . */ @org.junit.Test public void fnBooleanMixedArgs043() { final XQuery query = new XQuery( "fn:boolean(xs:long('-1'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-044.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: int . */ @org.junit.Test public void fnBooleanMixedArgs044() { final XQuery query = new XQuery( "fn:boolean(xs:int('2147483647'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-045.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: int . */ @org.junit.Test public void fnBooleanMixedArgs045() { final XQuery query = new XQuery( "fn:boolean(xs:int('-2147483648'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-046.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: int . */ @org.junit.Test public void fnBooleanMixedArgs046() { final XQuery query = new XQuery( "fn:boolean(xs:int('0'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test: fn-boolean-mixed-args-047.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: int . */ @org.junit.Test public void fnBooleanMixedArgs047() { final XQuery query = new XQuery( "fn:boolean(xs:int('1'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-048.xq Written By: Pulkita Tyagi Date: Mon May 23 * 04:50:42 2005 Purpose: arg: int . */ @org.junit.Test public void fnBooleanMixedArgs048() { final XQuery query = new XQuery( "fn:boolean(xs:int('-1'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: fn-boolean-mixed-args-049.xq Written By: Carmelo Montanez Date: January, * 19, 2006 Purpose: arg: anyURI . */ @org.junit.Test public void fnBooleanMixedArgs049() { final XQuery query = new XQuery( "fn:boolean(xs:anyURI(\"http://www.example.org/examples\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "boolean" function with the arguments set as follows: $arg = * xs:double(lower bound) . */ @org.junit.Test public void fnBooleandbl1args1() { final XQuery query = new XQuery( "fn:boolean(xs:double(\"-1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "boolean" function with the arguments set as follows: $arg = * xs:double(mid range) . */ @org.junit.Test public void fnBooleandbl1args2() { final XQuery query = new XQuery( "fn:boolean(xs:double(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "boolean" function with the arguments set as follows: $arg = * xs:double(upper bound) . */ @org.junit.Test public void fnBooleandbl1args3() { final XQuery query = new XQuery( "fn:boolean(xs:double(\"1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "boolean" function with the arguments set as follows: $arg = * xs:decimal(lower bound) . */ @org.junit.Test public void fnBooleandec1args1() { final XQuery query = new XQuery( "fn:boolean(xs:decimal(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "boolean" function with the arguments set as follows: $arg = * xs:decimal(mid range) . */ @org.junit.Test public void fnBooleandec1args2() { final XQuery query = new XQuery( "fn:boolean(xs:decimal(\"617375191608514839\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "boolean" function with the arguments set as follows: $arg = * xs:decimal(upper bound) . */ @org.junit.Test public void fnBooleandec1args3() { final XQuery query = new XQuery( "fn:boolean(xs:decimal(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "boolean" function with the arguments set as follows: $arg = * xs:float(lower bound) . */ @org.junit.Test public void fnBooleanflt1args1() { final XQuery query = new XQuery( "fn:boolean(xs:float(\"-3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "boolean" function with the arguments set as follows: $arg = * xs:float(mid range) . */ @org.junit.Test public void fnBooleanflt1args2() { final XQuery query = new XQuery( "fn:boolean(xs:float(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "boolean" function with the arguments set as follows: $arg = * xs:float(upper bound) . */ @org.junit.Test public void fnBooleanflt1args3() { final XQuery query = new XQuery( "fn:boolean(xs:float(\"3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "boolean" function with the arguments set as follows: $arg = * xs:int(lower bound) . */ @org.junit.Test public void fnBooleanint1args1() { final XQuery query = new XQuery( "fn:boolean(xs:int(\"-2147483648\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "boolean" function with the arguments set as follows: $arg = * xs:int(mid range) . */ @org.junit.Test public void fnBooleanint1args2() { final XQuery query = new XQuery( "fn:boolean(xs:int(\"-1873914410\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "boolean" function with the arguments set as follows: $arg = * xs:int(upper bound) . */ @org.junit.Test public void fnBooleanint1args3() { final XQuery query = new XQuery( "fn:boolean(xs:int(\"2147483647\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "boolean" function with the arguments set as follows: $arg = * xs:integer(lower bound) . */ @org.junit.Test public void fnBooleanintg1args1() { final XQuery query = new XQuery( "fn:boolean(xs:integer(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "boolean" function with the arguments set as follows: $arg = * xs:integer(mid range) . */ @org.junit.Test public void fnBooleanintg1args2() { final XQuery query = new XQuery( "fn:boolean(xs:integer(\"830993497117024304\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "boolean" function with the arguments set as follows: $arg = * xs:integer(upper bound) . */ @org.junit.Test public void fnBooleanintg1args3() { final XQuery query = new XQuery( "fn:boolean(xs:integer(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "boolean" function with the arguments set as follows: $arg = * xs:long(lower bound) . */ @org.junit.Test public void fnBooleanlng1args1() { final XQuery query = new XQuery( "fn:boolean(xs:long(\"-92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: booleanlng1args-2 Written By: Carmelo Montanez Date: Fri Dec 10 10:15:47 * GMT-05:00 2004 Purpose: Evaluates The "boolean" function with the arguments set as follows: * $arg = xs:long(mid range) . */ @org.junit.Test public void fnBooleanlng1args2() { final XQuery query = new XQuery( "fn:boolean(xs:long(\"-47175562203048468\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: booleanlng1args-3 Written By: Carmelo Montanez Date: Fri Dec 10 10:15:47 * GMT-05:00 2004 Purpose: Evaluates The "boolean" function with the arguments set as follows: * $arg = xs:long(upper bound) . */ @org.junit.Test public void fnBooleanlng1args3() { final XQuery query = new XQuery( "fn:boolean(xs:long(\"92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: booleannint1args-1 Written By: Carmelo Montanez Date: Fri Dec 10 10:15:47 * GMT-05:00 2004 Purpose: Evaluates The "boolean" function with the arguments set as follows: * $arg = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnBooleannint1args1() { final XQuery query = new XQuery( "fn:boolean(xs:negativeInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: booleannint1args-2 Written By: Carmelo Montanez Date: Fri Dec 10 10:15:47 * GMT-05:00 2004 Purpose: Evaluates The "boolean" function with the arguments set as follows: * $arg = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnBooleannint1args2() { final XQuery query = new XQuery( "fn:boolean(xs:negativeInteger(\"-297014075999096793\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: booleannint1args-3 Written By: Carmelo Montanez Date: Fri Dec 10 10:15:47 * GMT-05:00 2004 Purpose: Evaluates The "boolean" function with the arguments set as follows: * $arg = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnBooleannint1args3() { final XQuery query = new XQuery( "fn:boolean(xs:negativeInteger(\"-1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: booleannni1args-1 Written By: Carmelo Montanez Date: Fri Dec 10 10:15:47 * GMT-05:00 2004 Purpose: Evaluates The "boolean" function with the arguments set as follows: * $arg = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnBooleannni1args1() { final XQuery query = new XQuery( "fn:boolean(xs:nonNegativeInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test: booleannni1args-2 Written By: Carmelo Montanez Date: Fri Dec 10 10:15:47 * GMT-05:00 2004 Purpose: Evaluates The "boolean" function with the arguments set as follows: * $arg = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnBooleannni1args2() { final XQuery query = new XQuery( "fn:boolean(xs:nonNegativeInteger(\"303884545991464527\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: booleannni1args-3 Written By: Carmelo Montanez Date: Fri Dec 10 10:15:47 * GMT-05:00 2004 Purpose: Evaluates The "boolean" function with the arguments set as follows: * $arg = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnBooleannni1args3() { final XQuery query = new XQuery( "fn:boolean(xs:nonNegativeInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: booleannpi1args-1 Written By: Carmelo Montanez Date: Fri Dec 10 10:15:47 * GMT-05:00 2004 Purpose: Evaluates The "boolean" function with the arguments set as follows: * $arg = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnBooleannpi1args1() { final XQuery query = new XQuery( "fn:boolean(xs:nonPositiveInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: booleannpi1args-2 Written By: Carmelo Montanez Date: Fri Dec 10 10:15:47 * GMT-05:00 2004 Purpose: Evaluates The "boolean" function with the arguments set as follows: * $arg = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnBooleannpi1args2() { final XQuery query = new XQuery( "fn:boolean(xs:nonPositiveInteger(\"-475688437271870490\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: booleannpi1args-3 Written By: Carmelo Montanez Date: Fri Dec 10 10:15:47 * GMT-05:00 2004 Purpose: Evaluates The "boolean" function with the arguments set as follows: * $arg = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnBooleannpi1args3() { final XQuery query = new XQuery( "fn:boolean(xs:nonPositiveInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test: booleanpint1args-1 Written By: Carmelo Montanez Date: Fri Dec 10 10:15:47 * GMT-05:00 2004 Purpose: Evaluates The "boolean" function with the arguments set as follows: * $arg = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnBooleanpint1args1() { final XQuery query = new XQuery( "fn:boolean(xs:positiveInteger(\"1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: booleanpint1args-2 Written By: Carmelo Montanez Date: Fri Dec 10 10:15:47 * GMT-05:00 2004 Purpose: Evaluates The "boolean" function with the arguments set as follows: * $arg = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnBooleanpint1args2() { final XQuery query = new XQuery( "fn:boolean(xs:positiveInteger(\"52704602390610033\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: booleanpint1args-3 Written By: Carmelo Montanez Date: Fri Dec 10 10:15:47 * GMT-05:00 2004 Purpose: Evaluates The "boolean" function with the arguments set as follows: * $arg = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnBooleanpint1args3() { final XQuery query = new XQuery( "fn:boolean(xs:positiveInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: booleansht1args-1 Written By: Carmelo Montanez Date: Fri Dec 10 10:15:47 * GMT-05:00 2004 Purpose: Evaluates The "boolean" function with the arguments set as follows: * $arg = xs:short(lower bound) . */ @org.junit.Test public void fnBooleansht1args1() { final XQuery query = new XQuery( "fn:boolean(xs:short(\"-32768\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: booleansht1args-2 Written By: Carmelo Montanez Date: Fri Dec 10 10:15:47 * GMT-05:00 2004 Purpose: Evaluates The "boolean" function with the arguments set as follows: * $arg = xs:short(mid range) . */ @org.junit.Test public void fnBooleansht1args2() { final XQuery query = new XQuery( "fn:boolean(xs:short(\"-5324\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: booleansht1args-3 Written By: Carmelo Montanez Date: Fri Dec 10 10:15:47 * GMT-05:00 2004 Purpose: Evaluates The "boolean" function with the arguments set as follows: * $arg = xs:short(upper bound) . */ @org.junit.Test public void fnBooleansht1args3() { final XQuery query = new XQuery( "fn:boolean(xs:short(\"32767\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: booleanulng1args-1 Written By: Carmelo Montanez Date: Fri Dec 10 10:15:47 * GMT-05:00 2004 Purpose: Evaluates The "boolean" function with the arguments set as follows: * $arg = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnBooleanulng1args1() { final XQuery query = new XQuery( "fn:boolean(xs:unsignedLong(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test: booleanulng1args-2 Written By: Carmelo Montanez Date: Fri Dec 10 10:15:47 * GMT-05:00 2004 Purpose: Evaluates The "boolean" function with the arguments set as follows: * $arg = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnBooleanulng1args2() { final XQuery query = new XQuery( "fn:boolean(xs:unsignedLong(\"130747108607674654\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: booleanulng1args-3 Written By: Carmelo Montanez Date: Fri Dec 10 10:15:47 * GMT-05:00 2004 Purpose: Evaluates The "boolean" function with the arguments set as follows: * $arg = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnBooleanulng1args3() { final XQuery query = new XQuery( "fn:boolean(xs:unsignedLong(\"184467440737095516\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: booleanusht1args-1 Written By: Carmelo Montanez Date: Fri Dec 10 10:15:47 * GMT-05:00 2004 Purpose: Evaluates The "boolean" function with the arguments set as follows: * $arg = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnBooleanusht1args1() { final XQuery query = new XQuery( "fn:boolean(xs:unsignedShort(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test: booleanusht1args-2 Written By: Carmelo Montanez Date: Fri Dec 10 10:15:47 * GMT-05:00 2004 Purpose: Evaluates The "boolean" function with the arguments set as follows: * $arg = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnBooleanusht1args2() { final XQuery query = new XQuery( "fn:boolean(xs:unsignedShort(\"44633\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test: booleanusht1args-3 Written By: Carmelo Montanez Date: Fri Dec 10 10:15:47 * GMT-05:00 2004 Purpose: Evaluates The "boolean" function with the arguments set as follows: * $arg = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnBooleanusht1args3() { final XQuery query = new XQuery( "fn:boolean(xs:unsignedShort(\"65535\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnCeiling.java000066400000000000000000001233211222453003200266070ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** . * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnCeiling extends QT3TestSet { /** * A test whose essence is: `ceiling()`. . */ @org.junit.Test public void kCeilingFunc1() { final XQuery query = new XQuery( "ceiling()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `ceiling(1, 2)`. . */ @org.junit.Test public void kCeilingFunc2() { final XQuery query = new XQuery( "ceiling(1, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(ceiling(()))`. . */ @org.junit.Test public void kCeilingFunc3() { final XQuery query = new XQuery( "empty(ceiling(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `ceiling(10.5) eq 11`. . */ @org.junit.Test public void kCeilingFunc4() { final XQuery query = new XQuery( "ceiling(10.5) eq 11", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `ceiling(-10.5) eq -10`. . */ @org.junit.Test public void kCeilingFunc5() { final XQuery query = new XQuery( "ceiling(-10.5) eq -10", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `ceiling("a string")`. . */ @org.junit.Test public void kCeilingFunc6() { final XQuery query = new XQuery( "ceiling(\"a string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Ensure the return type is properly inferred for unsignedShort. . */ @org.junit.Test public void k2CeilingFunc1() { final XQuery query = new XQuery( "ceiling(xs:unsignedShort(.)) instance of xs:integer", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is properly inferred for int. . */ @org.junit.Test public void k2CeilingFunc10() { final XQuery query = new XQuery( "ceiling(xs:int(.)) instance of xs:integer", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is properly inferred for short. . */ @org.junit.Test public void k2CeilingFunc11() { final XQuery query = new XQuery( "ceiling(xs:short(.)) instance of xs:integer", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is properly inferred for byte. . */ @org.junit.Test public void k2CeilingFunc12() { final XQuery query = new XQuery( "ceiling(xs:byte(.)) instance of xs:integer", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is properly inferred for unsignedLong. . */ @org.junit.Test public void k2CeilingFunc2() { final XQuery query = new XQuery( "ceiling(xs:unsignedLong(.)) instance of xs:integer", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is properly inferred for unsignedInt. . */ @org.junit.Test public void k2CeilingFunc3() { final XQuery query = new XQuery( "ceiling(xs:unsignedInt(.)) instance of xs:integer", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is properly inferred for unsignedByte. . */ @org.junit.Test public void k2CeilingFunc4() { final XQuery query = new XQuery( "ceiling(xs:unsignedByte(.)) instance of xs:integer", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is properly inferred for positiveInteger. . */ @org.junit.Test public void k2CeilingFunc5() { final XQuery query = new XQuery( "ceiling(xs:positiveInteger(.)) instance of xs:integer", ctx); try { query.context(node(file("fn/abs/e1.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is properly inferred for nonPositiveInteger. . */ @org.junit.Test public void k2CeilingFunc6() { final XQuery query = new XQuery( "ceiling(xs:nonPositiveInteger(.)) instance of xs:integer", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is properly inferred for nonNegativeInteger. . */ @org.junit.Test public void k2CeilingFunc7() { final XQuery query = new XQuery( "ceiling(xs:nonNegativeInteger(.)) instance of xs:integer", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is properly inferred for negativeInteger. . */ @org.junit.Test public void k2CeilingFunc8() { final XQuery query = new XQuery( "ceiling(xs:negativeInteger(.)) instance of xs:integer", ctx); try { query.context(node(file("fn/abs/e-1.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is properly inferred for long. . */ @org.junit.Test public void k2CeilingFunc9() { final XQuery query = new XQuery( "ceiling(xs:long(.)) instance of xs:integer", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * check dynamic type of fn:ceiling on argument of union of numeric types. . */ @org.junit.Test public void fnCeiling1() { final XQuery query = new XQuery( "for $x in (1, xs:decimal(2), xs:float(3), xs:double(4)) return \n" + " if ((ceiling($x)) instance of xs:integer) then \"integer\" \n" + " else if ((ceiling($x)) instance of xs:decimal) then \"decimal\" \n" + " else if ((ceiling($x)) instance of xs:float) then \"float\"\n" + " else if ((ceiling($x)) instance of xs:double) then \"double\" \n" + " else error()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"integer\", \"decimal\", \"float\", \"double\"") ); } /** * Basic test of ceiling(decimal). */ @org.junit.Test public void fnCeilingDecimal1() { final XQuery query = new XQuery( "ceiling(12.5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("13.0") && assertType("xs:decimal") ) ); } /** * Basic test of ceiling(decimal). */ @org.junit.Test public void fnCeilingDecimal2() { final XQuery query = new XQuery( "ceiling(12.9)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("13.0") && assertType("xs:decimal") ) ); } /** * Basic test of ceiling(decimal). */ @org.junit.Test public void fnCeilingDecimal3() { final XQuery query = new XQuery( "ceiling(0.000000001)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1.0") && assertType("xs:decimal") ) ); } /** * Basic test of ceiling(decimal). */ @org.junit.Test public void fnCeilingDecimal4() { final XQuery query = new XQuery( "ceiling(0.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0.0") && assertType("xs:decimal") ) ); } /** * Basic test of ceiling(decimal). */ @org.junit.Test public void fnCeilingDecimal5() { final XQuery query = new XQuery( "ceiling(-0.1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0.0") && assertType("xs:decimal") ) ); } /** * Basic test of ceiling(decimal). */ @org.junit.Test public void fnCeilingDecimal6() { final XQuery query = new XQuery( "ceiling(-12345678.567890)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-12345678") && assertType("xs:decimal") ) ); } /** * Basic test of ceiling(decimal). */ @org.junit.Test public void fnCeilingDecimal7() { final XQuery query = new XQuery( "ceiling(-1234567891234567.2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-1234567891234567.0") && assertType("xs:decimal") ) ); } /** * Basic test of ceiling(double). */ @org.junit.Test public void fnCeilingDouble1() { final XQuery query = new XQuery( "ceiling(12.5e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("13.0e0") && assertType("xs:double") ) ); } /** * Basic test of ceiling(double). */ @org.junit.Test public void fnCeilingDouble10() { final XQuery query = new XQuery( "ceiling(xs:double('-INF'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "-INF") && assertType("xs:double") ) ); } /** * Basic test of ceiling(double). */ @org.junit.Test public void fnCeilingDouble11() { final XQuery query = new XQuery( "ceiling(xs:double('-0'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-0") && assertType("xs:double") ) ); } /** * Basic test of ceiling(double). */ @org.junit.Test public void fnCeilingDouble2() { final XQuery query = new XQuery( "ceiling(12.9e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("13.0e0") && assertType("xs:double") ) ); } /** * Basic test of ceiling(double). */ @org.junit.Test public void fnCeilingDouble3() { final XQuery query = new XQuery( "ceiling(0.000000001e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1.0e0") && assertType("xs:double") ) ); } /** * Basic test of ceiling(double). */ @org.junit.Test public void fnCeilingDouble4() { final XQuery query = new XQuery( "ceiling(0.0e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0.0e0") && assertType("xs:double") ) ); } /** * Basic test of ceiling(double). */ @org.junit.Test public void fnCeilingDouble5() { final XQuery query = new XQuery( "ceiling(-0.1e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-0.0e0") && assertEq("-0") && assertType("xs:double") ) ); } /** * Basic test of ceiling(double). */ @org.junit.Test public void fnCeilingDouble6() { final XQuery query = new XQuery( "ceiling(-12345678.567890e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-12345678e0") && assertType("xs:double") ) ); } /** * Basic test of ceiling(double). */ @org.junit.Test public void fnCeilingDouble7() { final XQuery query = new XQuery( "ceiling(-1234567891234567.2e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-1234567891234567.0e0") && assertType("xs:double") ) ); } /** * Basic test of ceiling(double). */ @org.junit.Test public void fnCeilingDouble8() { final XQuery query = new XQuery( "ceiling(xs:double('NaN'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "NaN") && assertType("xs:double") ) ); } /** * Basic test of ceiling(double). */ @org.junit.Test public void fnCeilingDouble9() { final XQuery query = new XQuery( "ceiling(xs:double('INF'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "INF") && assertType("xs:double") ) ); } /** * Basic test of ceiling(float)). */ @org.junit.Test public void fnCeilingFloat1() { final XQuery query = new XQuery( "ceiling(xs:float(12.5e0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("13.0e0") && assertType("xs:float") ) ); } /** * Basic test of ceiling(float)). */ @org.junit.Test public void fnCeilingFloat10() { final XQuery query = new XQuery( "ceiling(xs:float(xs:float('-INF')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "-INF") && assertType("xs:float") ) ); } /** * Basic test of ceiling(float)). */ @org.junit.Test public void fnCeilingFloat11() { final XQuery query = new XQuery( "ceiling(xs:float(xs:float('-0')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-0") && assertType("xs:float") ) ); } /** * Basic test of ceiling(float)). */ @org.junit.Test public void fnCeilingFloat2() { final XQuery query = new XQuery( "ceiling(xs:float(12.9e0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("13.0e0") && assertType("xs:float") ) ); } /** * Basic test of ceiling(float)). */ @org.junit.Test public void fnCeilingFloat3() { final XQuery query = new XQuery( "ceiling(xs:float(0.000000001e0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1.0e0") && assertType("xs:float") ) ); } /** * Basic test of ceiling(float)). */ @org.junit.Test public void fnCeilingFloat4() { final XQuery query = new XQuery( "ceiling(xs:float(0.0e0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0.0e0") && assertType("xs:float") ) ); } /** * Basic test of ceiling(float)). */ @org.junit.Test public void fnCeilingFloat5() { final XQuery query = new XQuery( "ceiling(xs:float(-0.1e0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0.0e0") && assertEq("-0") && assertType("xs:float") ) ); } /** * Basic test of ceiling(float)). */ @org.junit.Test public void fnCeilingFloat6() { final XQuery query = new XQuery( "ceiling(xs:float(-12345678.1e0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-12345678e0") && assertType("xs:float") ) ); } /** * Basic test of ceiling(float)). */ @org.junit.Test public void fnCeilingFloat7() { final XQuery query = new XQuery( "ceiling(xs:float(-1234567.2e0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-1234567e0") && assertType("xs:float") ) ); } /** * Basic test of ceiling(float)). */ @org.junit.Test public void fnCeilingFloat8() { final XQuery query = new XQuery( "ceiling(xs:float(xs:float('NaN')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "NaN") && assertType("xs:float") ) ); } /** * Basic test of ceiling(float)). */ @org.junit.Test public void fnCeilingFloat9() { final XQuery query = new XQuery( "ceiling(xs:float(xs:float('INF')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "INF") && assertType("xs:float") ) ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:double(lower bound) . */ @org.junit.Test public void fnCeilingdbl1args1() { final XQuery query = new XQuery( "fn:ceiling(xs:double(\"-1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.7976931348623157E308") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:double(mid range) . */ @org.junit.Test public void fnCeilingdbl1args2() { final XQuery query = new XQuery( "fn:ceiling(xs:double(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:double(upper bound) . */ @org.junit.Test public void fnCeilingdbl1args3() { final XQuery query = new XQuery( "fn:ceiling(xs:double(\"1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.7976931348623157E308") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:decimal(lower bound) . */ @org.junit.Test public void fnCeilingdec1args1() { final XQuery query = new XQuery( "fn:ceiling(xs:decimal(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:decimal(mid range) . */ @org.junit.Test public void fnCeilingdec1args2() { final XQuery query = new XQuery( "fn:ceiling(xs:decimal(\"617375191608514839\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("617375191608514839") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:decimal(upper bound) . */ @org.junit.Test public void fnCeilingdec1args3() { final XQuery query = new XQuery( "fn:ceiling(xs:decimal(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:float(lower bound) . */ @org.junit.Test public void fnCeilingflt1args1() { final XQuery query = new XQuery( "fn:ceiling(xs:float(\"-3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-3.4028235E38") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:float(mid range) . */ @org.junit.Test public void fnCeilingflt1args2() { final XQuery query = new XQuery( "fn:ceiling(xs:float(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:float(upper bound) . */ @org.junit.Test public void fnCeilingflt1args3() { final XQuery query = new XQuery( "fn:ceiling(xs:float(\"3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3.4028235E38") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:int(lower bound) . */ @org.junit.Test public void fnCeilingint1args1() { final XQuery query = new XQuery( "fn:ceiling(xs:int(\"-2147483648\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2147483648") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:int(mid range) . */ @org.junit.Test public void fnCeilingint1args2() { final XQuery query = new XQuery( "fn:ceiling(xs:int(\"-1873914410\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1873914410") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:int(upper bound) . */ @org.junit.Test public void fnCeilingint1args3() { final XQuery query = new XQuery( "fn:ceiling(xs:int(\"2147483647\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2147483647") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:integer(lower bound) . */ @org.junit.Test public void fnCeilingintg1args1() { final XQuery query = new XQuery( "fn:ceiling(xs:integer(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:integer(mid range) . */ @org.junit.Test public void fnCeilingintg1args2() { final XQuery query = new XQuery( "fn:ceiling(xs:integer(\"830993497117024304\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("830993497117024304") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:integer(upper bound) . */ @org.junit.Test public void fnCeilingintg1args3() { final XQuery query = new XQuery( "fn:ceiling(xs:integer(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:long(lower bound) . */ @org.junit.Test public void fnCeilinglng1args1() { final XQuery query = new XQuery( "fn:ceiling(xs:long(\"-92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:long(mid range) . */ @org.junit.Test public void fnCeilinglng1args2() { final XQuery query = new XQuery( "fn:ceiling(xs:long(\"-47175562203048468\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-47175562203048468") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:long(upper bound) . */ @org.junit.Test public void fnCeilinglng1args3() { final XQuery query = new XQuery( "fn:ceiling(xs:long(\"92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("92233720368547758") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnCeilingnint1args1() { final XQuery query = new XQuery( "fn:ceiling(xs:negativeInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnCeilingnint1args2() { final XQuery query = new XQuery( "fn:ceiling(xs:negativeInteger(\"-297014075999096793\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-297014075999096793") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnCeilingnint1args3() { final XQuery query = new XQuery( "fn:ceiling(xs:negativeInteger(\"-1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnCeilingnni1args1() { final XQuery query = new XQuery( "fn:ceiling(xs:nonNegativeInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnCeilingnni1args2() { final XQuery query = new XQuery( "fn:ceiling(xs:nonNegativeInteger(\"303884545991464527\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("303884545991464527") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnCeilingnni1args3() { final XQuery query = new XQuery( "fn:ceiling(xs:nonNegativeInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnCeilingnpi1args1() { final XQuery query = new XQuery( "fn:ceiling(xs:nonPositiveInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnCeilingnpi1args2() { final XQuery query = new XQuery( "fn:ceiling(xs:nonPositiveInteger(\"-475688437271870490\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-475688437271870490") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnCeilingnpi1args3() { final XQuery query = new XQuery( "fn:ceiling(xs:nonPositiveInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnCeilingpint1args1() { final XQuery query = new XQuery( "fn:ceiling(xs:positiveInteger(\"1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnCeilingpint1args2() { final XQuery query = new XQuery( "fn:ceiling(xs:positiveInteger(\"52704602390610033\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("52704602390610033") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnCeilingpint1args3() { final XQuery query = new XQuery( "fn:ceiling(xs:positiveInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:short(lower bound) . */ @org.junit.Test public void fnCeilingsht1args1() { final XQuery query = new XQuery( "fn:ceiling(xs:short(\"-32768\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-32768") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:short(mid range) . */ @org.junit.Test public void fnCeilingsht1args2() { final XQuery query = new XQuery( "fn:ceiling(xs:short(\"-5324\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-5324") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:short(upper bound) . */ @org.junit.Test public void fnCeilingsht1args3() { final XQuery query = new XQuery( "fn:ceiling(xs:short(\"32767\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("32767") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnCeilingulng1args1() { final XQuery query = new XQuery( "fn:ceiling(xs:unsignedLong(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnCeilingulng1args2() { final XQuery query = new XQuery( "fn:ceiling(xs:unsignedLong(\"130747108607674654\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("130747108607674654") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnCeilingulng1args3() { final XQuery query = new XQuery( "fn:ceiling(xs:unsignedLong(\"184467440737095516\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("184467440737095516") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnCeilingusht1args1() { final XQuery query = new XQuery( "fn:ceiling(xs:unsignedShort(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnCeilingusht1args2() { final XQuery query = new XQuery( "fn:ceiling(xs:unsignedShort(\"44633\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("44633") ); } /** * Evaluates The "ceiling" function with the arguments set as follows: $arg = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnCeilingusht1args3() { final XQuery query = new XQuery( "fn:ceiling(xs:unsignedShort(\"65535\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("65535") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnCodepointEqual.java000066400000000000000000000450741222453003200301610ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** . * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnCodepointEqual extends QT3TestSet { /** * Compare two values returned from fn:lower-case(). . */ @org.junit.Test public void k2CodepointEqual1() { final XQuery query = new XQuery( "codepoint-equal(lower-case(concat(\"B STRING\", current-time())), \n" + " lower-case(concat(\"b string\", current-time())))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Compare two values returned from fn:upper-case(). . */ @org.junit.Test public void k2CodepointEqual2() { final XQuery query = new XQuery( "codepoint-equal(upper-case(concat(\"B STRING\", current-time())), \n" + " upper-case(concat(\"b string\", current-time())))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Compare two non-matching values returned from fn:lower-case(). . */ @org.junit.Test public void k2CodepointEqual3() { final XQuery query = new XQuery( "codepoint-equal(lower-case(concat(\"B STRING\", current-time())), \n" + " lower-case(concat(\"no match\", current-time())))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Compare two non-matching values returned from fn:upper-case(). . */ @org.junit.Test public void k2CodepointEqual4() { final XQuery query = new XQuery( "codepoint-equal(upper-case(concat(\"B STRING\", current-time())), \n" + " upper-case(concat(\"no match\", current-time())))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Compare two non-matching values returned from fn:lower-case() and fn:upper-case(). . */ @org.junit.Test public void k2CodepointEqual5() { final XQuery query = new XQuery( "codepoint-equal(upper-case(concat(\"B STRING\", current-time())), \n" + " lower-case(concat(\"no match\", current-time())))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Compare two non-matching values returned from fn:lower-case() and fn:upper-case(). . */ @org.junit.Test public void k2CodepointEqual6() { final XQuery query = new XQuery( "codepoint-equal(lower-case(concat(\"B STRING\", current-time())), \n" + " upper-case(concat(\"no match\", current-time())))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:codepoint-equal with empty $arg1 . */ @org.junit.Test public void cbclCodepointEqual001() { final XQuery query = new XQuery( "declare function local:yes-empty($arg as xs:boolean) as xs:string? { if ($arg) then 'yes' else () }; \n" + " empty(fn:codepoint-equal( local:yes-empty(fn:false()), local:yes-empty(fn:true()) ) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:codepoint-equal with empty $arg2 . */ @org.junit.Test public void cbclCodepointEqual002() { final XQuery query = new XQuery( "declare function local:yes-empty($arg as xs:boolean) as xs:string? { if ($arg) then 'yes' else () }; \n" + " empty(fn:codepoint-equal( local:yes-empty(fn:true()), local:yes-empty(fn:false()) ) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:codepoint-equal with non-empty arguments . */ @org.junit.Test public void cbclCodepointEqual003() { final XQuery query = new XQuery( "declare function local:yes-no($arg as xs:boolean) as xs:string { if ($arg) then 'yes' else 'no' }; \n" + " fn:codepoint-equal( local:yes-no(fn:true()), local:yes-no(fn:false()) ) = false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:boolean on fn:codepoint-equal with empty $arg2 . */ @org.junit.Test public void cbclCodepointEqual004() { final XQuery query = new XQuery( "declare function local:yes-empty($arg as xs:boolean) as xs:string? { if ($arg) then 'yes' else () }; \n" + " boolean(fn:codepoint-equal( local:yes-empty(fn:true()), local:yes-empty(fn:false()) ) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:boolean on fn:codepoint-equal with empty $arg1 . */ @org.junit.Test public void cbclCodepointEqual005() { final XQuery query = new XQuery( "declare function local:yes-empty($arg as xs:boolean) as xs:string? { if ($arg) then 'yes' else () }; \n" + " boolean(fn:codepoint-equal( local:yes-empty(fn:false()), local:yes-empty(fn:true()) ) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:codepoint-equal evaluate to item . */ @org.junit.Test public void cbclCodepointEqual006() { final XQuery query = new XQuery( "declare function local:yes-no($arg as xs:boolean) as xs:string { if ($arg) then 'yes' else 'no' }; \n" + " fn:index-of( (fn:true(), fn:false()), fn:codepoint-equal( local:yes-no(fn:false()), local:yes-no(fn:true()) ) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Evaluation of an "fn:codepoint-equal" with wrong arity. . */ @org.junit.Test public void fnCodepointEqual1() { final XQuery query = new XQuery( "fn:codepoint-equal(\"a\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Evaluation of an "fn:codepoint-equal" with wrong argument type. . */ @org.junit.Test public void fnCodepointEqual10() { final XQuery query = new XQuery( "fn:codepoint-equal(xs:integer(1),xs:integer(1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluation of an "fn:codepoint-equal" with wrong argument type (only second argument). . */ @org.junit.Test public void fnCodepointEqual11() { final XQuery query = new XQuery( "fn:codepoint-equal(\"aa\",xs:integer(1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluation of an "fn:codepoint-equal" with arguments set to "aa" and "AA" respectively. . */ @org.junit.Test public void fnCodepointEqual12() { final XQuery query = new XQuery( "fn:codepoint-equal(\"aa\",\"AA\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of an "fn:codepoint-equal" with arguments set to "aa" and lower-case("AA") respectively. . */ @org.junit.Test public void fnCodepointEqual13() { final XQuery query = new XQuery( "fn:codepoint-equal(\"aa\",fn:lower-case(\"AA\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an "fn:codepoint-equal" with arguments set to "aa" and upper-case("aa") respectively. . */ @org.junit.Test public void fnCodepointEqual14() { final XQuery query = new XQuery( "fn:codepoint-equal(\"aa\",fn:upper-case(\"aa\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of an "fn:codepoint-equal" as an argument to xs:boolean. . */ @org.junit.Test public void fnCodepointEqual15() { final XQuery query = new XQuery( "xs:boolean(fn:codepoint-equal(\"aa\",\"aa\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an "fn:codepoint-equal" as part of boolean expression ("and" and fn:true()). . */ @org.junit.Test public void fnCodepointEqual16() { final XQuery query = new XQuery( "fn:codepoint-equal(\"aa\",\"aa\") and fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an "fn:codepoint-equal" as part of boolean expression ("and" and fn:false()). . */ @org.junit.Test public void fnCodepointEqual17() { final XQuery query = new XQuery( "fn:codepoint-equal(\"aa\",\"aa\") and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of an "fn:codepoint-equal" as part of boolean expression ("or" and fn:true()). . */ @org.junit.Test public void fnCodepointEqual18() { final XQuery query = new XQuery( "fn:codepoint-equal(\"aa\",\"aa\") or fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an "fn:codepoint-equal" as part of boolean expression ("or" and fn:false()). . */ @org.junit.Test public void fnCodepointEqual19() { final XQuery query = new XQuery( "fn:codepoint-equal(\"aa\",\"aa\") or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an "fn:codepoint-equal" with arguments set to empty sequence . */ @org.junit.Test public void fnCodepointEqual2() { final XQuery query = new XQuery( "fn:codepoint-equal((),())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of an "fn:codepoint-equal" as part of boolean expression involving two fn:codepoint-equal ("and" operator). . */ @org.junit.Test public void fnCodepointEqual20() { final XQuery query = new XQuery( "fn:codepoint-equal(\"aa\",\"aa\") and fn:codepoint-equal(\"aa\",\"aa\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an "fn:codepoint-equal" as part of boolean expression involving two fn:codepoint-equal ("or" operator). . */ @org.junit.Test public void fnCodepointEqual21() { final XQuery query = new XQuery( "fn:codepoint-equal(\"aa\",\"aa\") or fn:codepoint-equal(\"aa\",\"aa\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Different normalization forms of the same string are not codepoint-equal . */ @org.junit.Test public void fnCodepointEqual22() { final XQuery query = new XQuery( "fn:codepoint-equal(normalize-unicode(\"garçon\", \"NFC\"), normalize-unicode(\"garçon\", \"NFD\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of an "fn:codepoint-equal" with one argument set to empty sequence Use fn:count to avoid empty file. . */ @org.junit.Test public void fnCodepointEqual2a() { final XQuery query = new XQuery( "fn:codepoint-equal(\"abc\",())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of an "fn:codepoint-equal" with one argument set to empty sequence Use fn:count to avoid empty file. . */ @org.junit.Test public void fnCodepointEqual2b() { final XQuery query = new XQuery( "fn:codepoint-equal((), \"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of an "fn:codepoint-equal" with arguments set to zero length string. . */ @org.junit.Test public void fnCodepointEqual3() { final XQuery query = new XQuery( "fn:codepoint-equal(\"\",\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an "fn:codepoint-equal" with arguments set to same value "a". . */ @org.junit.Test public void fnCodepointEqual4() { final XQuery query = new XQuery( "fn:codepoint-equal(\"a\",\"a\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an "fn:codepoint-equal" with arguments set to different values "a", "b" respectively. . */ @org.junit.Test public void fnCodepointEqual5() { final XQuery query = new XQuery( "fn:codepoint-equal(\"a\",\"b\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of an "fn:codepoint-equal" as argument to fn:not. Returns true . */ @org.junit.Test public void fnCodepointEqual6() { final XQuery query = new XQuery( "fn:not(fn:codepoint-equal(\"a\",\"b\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an "fn:codepoint-equal" as argument to fn:not. Returns false . */ @org.junit.Test public void fnCodepointEqual7() { final XQuery query = new XQuery( "fn:not(fn:codepoint-equal(\"a\",\"a\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of an "fn:codepoint-equal" whose arguments use fn:string() for a number . */ @org.junit.Test public void fnCodepointEqual8() { final XQuery query = new XQuery( "fn:codepoint-equal(fn:string(1),fn:string(1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an "fn:codepoint-equal" whose arguments use fn:string() for a string. . */ @org.junit.Test public void fnCodepointEqual9() { final XQuery query = new XQuery( "fn:codepoint-equal(fn:string(\"aa\"),fn:string(\"aa\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnCodepointsToString.java000066400000000000000000001116761222453003200310500ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** . * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnCodepointsToString extends QT3TestSet { /** * A test whose essence is: `codepoints-to-string()`. . */ @org.junit.Test public void kCodepointToStringFunc1() { final XQuery query = new XQuery( "codepoints-to-string()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `codepoints-to-string(10) eq " "`. . */ @org.junit.Test public void kCodepointToStringFunc10() { final XQuery query = new XQuery( "codepoints-to-string(10) eq \"\n" + "\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Codepoint 11 is invalid in XML 1.0 but valid in XML 1.1. . */ @org.junit.Test public void kCodepointToStringFunc11() { final XQuery query = new XQuery( "codepoints-to-string(11)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * Codepoint 12 is invalid in XML 1.0 but valid in XML 1.1. . */ @org.junit.Test public void kCodepointToStringFunc12() { final XQuery query = new XQuery( "codepoints-to-string(12)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * A test whose essence is: `codepoints-to-string(13) eq " "`. . */ @org.junit.Test public void kCodepointToStringFunc13() { final XQuery query = new XQuery( "codepoints-to-string(13) eq \" \"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Codepoint 14 is invalid in XML 1.0 but valid in XML 1.1. . */ @org.junit.Test public void kCodepointToStringFunc14() { final XQuery query = new XQuery( "string-to-codepoints(codepoints-to-string(14))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("14") || error("FOCH0001") ) ); } /** * Codepoint 31 is invalid in XML 1.0 but valid in XML 1.1. . */ @org.junit.Test public void kCodepointToStringFunc15() { final XQuery query = new XQuery( "string-to-codepoints(codepoints-to-string(31))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("31") || error("FOCH0001") ) ); } /** * A test whose essence is: `codepoints-to-string(32) eq " "`. . */ @org.junit.Test public void kCodepointToStringFunc16() { final XQuery query = new XQuery( "codepoints-to-string(32) eq \" \"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `codepoints-to-string(27637) eq "毵"`. . */ @org.junit.Test public void kCodepointToStringFunc17() { final XQuery query = new XQuery( "codepoints-to-string(27637) eq \"毵\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `codepoints-to-string(55295) eq "퟿"`. . */ @org.junit.Test public void kCodepointToStringFunc18() { final XQuery query = new XQuery( "codepoints-to-string(55295) eq \"\ud7ff\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `codepoints-to-string(55296)`. . */ @org.junit.Test public void kCodepointToStringFunc19() { final XQuery query = new XQuery( "codepoints-to-string(55296)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * A test whose essence is: `codepoints-to-string((84, 104), "INVALID")`. . */ @org.junit.Test public void kCodepointToStringFunc2() { final XQuery query = new XQuery( "codepoints-to-string((84, 104), \"INVALID\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `codepoints-to-string(57343)`. . */ @org.junit.Test public void kCodepointToStringFunc20() { final XQuery query = new XQuery( "codepoints-to-string(57343)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * A test whose essence is: `codepoints-to-string(57344) eq ""`. . */ @org.junit.Test public void kCodepointToStringFunc21() { final XQuery query = new XQuery( "codepoints-to-string(57344) eq \"\ue000\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `codepoints-to-string(61438) eq ""`. . */ @org.junit.Test public void kCodepointToStringFunc22() { final XQuery query = new XQuery( "codepoints-to-string(61438) eq \"\ueffe\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `codepoints-to-string(65533) eq "�"`. . */ @org.junit.Test public void kCodepointToStringFunc23() { final XQuery query = new XQuery( "codepoints-to-string(65533) eq \"�\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `codepoints-to-string(65534)`. . */ @org.junit.Test public void kCodepointToStringFunc24() { final XQuery query = new XQuery( "codepoints-to-string(65534)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * A test whose essence is: `codepoints-to-string(65535)`. . */ @org.junit.Test public void kCodepointToStringFunc25() { final XQuery query = new XQuery( "codepoints-to-string(65535)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * A test whose essence is: `codepoints-to-string(65536) eq "𐀀"`. . */ @org.junit.Test public void kCodepointToStringFunc26() { final XQuery query = new XQuery( "codepoints-to-string(65536) eq \"ð€€\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `codepoints-to-string(589823) eq "򏿿"`. . */ @org.junit.Test public void kCodepointToStringFunc27() { final XQuery query = new XQuery( "codepoints-to-string(589823) eq \"ò¿¿\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `codepoints-to-string(1114111) eq "􏿿"`. . */ @org.junit.Test public void kCodepointToStringFunc28() { final XQuery query = new XQuery( "codepoints-to-string(1114111) eq \"ô¿¿\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `codepoints-to-string(1114112)`. . */ @org.junit.Test public void kCodepointToStringFunc29() { final XQuery query = new XQuery( "codepoints-to-string(1114112)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * A test whose essence is: `codepoints-to-string(()) eq ""`. . */ @org.junit.Test public void kCodepointToStringFunc3() { final XQuery query = new XQuery( "codepoints-to-string(()) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `codepoints-to-string((87, 36, 56, 87, 102, 96)) eq "W$8Wf`"`. . */ @org.junit.Test public void kCodepointToStringFunc4() { final XQuery query = new XQuery( "codepoints-to-string((87, 36, 56, 87, 102, 96)) eq \"W$8Wf`\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `codepoints-to-string(57343)`. . */ @org.junit.Test public void kCodepointToStringFunc5() { final XQuery query = new XQuery( "codepoints-to-string(57343)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * A test whose essence is: `codepoints-to-string(-500)`. . */ @org.junit.Test public void kCodepointToStringFunc6() { final XQuery query = new XQuery( "codepoints-to-string(-500)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * A test whose essence is: `codepoints-to-string(0)`. . */ @org.junit.Test public void kCodepointToStringFunc7() { final XQuery query = new XQuery( "codepoints-to-string(0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * Codepoint 8 is invalid in XML 1.0 but valid in XML 1.1. . */ @org.junit.Test public void kCodepointToStringFunc8() { final XQuery query = new XQuery( "codepoints-to-string(8)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "") || error("FOCH0001") ) ); } /** * A test whose essence is: `codepoints-to-string(9) eq " "`. . */ @org.junit.Test public void kCodepointToStringFunc9() { final XQuery query = new XQuery( "codepoints-to-string(9) eq \"\t\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:codepoints-to-string with invalid control character . */ @org.junit.Test public void cbclCodepointsToString001() { final XQuery query = new XQuery( "\n" + " declare function local:test($test as xs:integer) as xs:integer? { \n" + " if ($test = 1) then ( 0 ) else if ($test = 2) then ( 9 ) else if ($test = 3) then ( 13 ) else if ($test = 4) then ( 16 ) else () \n" + " }; \n" + " fn:codepoints-to-string( local:test(1) to 32 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * test fn:codepoints-to-string with invalid control character . */ @org.junit.Test public void cbclCodepointsToString002() { final XQuery query = new XQuery( "\n" + " declare function local:test($test as xs:integer) as xs:integer? { \n" + " if ($test = 1) then ( 0 ) else if ($test = 2) then ( 9 ) else if ($test = 3) then ( 13 ) else if ($test = 4) then ( 16 ) else () \n" + " }; \n" + " fn:codepoints-to-string( local:test(2) to 32 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * test fn:codepoints-to-string with invalid control character . */ @org.junit.Test public void cbclCodepointsToString003() { final XQuery query = new XQuery( "\n" + " declare function local:test($test as xs:integer) as xs:integer? { \n" + " if ($test = 1) then ( 0 ) else if ($test = 2) then ( 9 ) else if ($test = 3) then ( 13 )else if ($test = 4) then ( 16 ) else () \n" + " }; \n" + " fn:codepoints-to-string( local:test(3) to 32 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * test fn:codepoints-to-string with invalid control character . */ @org.junit.Test public void cbclCodepointsToString004() { final XQuery query = new XQuery( "declare function local:test($test as xs:integer) as xs:integer? { \n" + " if ($test = 1) then ( 0 ) else if ($test = 2) then ( 9 ) else if ($test = 3) then ( 13 ) else if ($test = 4) then ( 16 ) else () \n" + " }; \n" + " fn:codepoints-to-string( local:test(4) to 32 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * test fn:codepoints-to-string with codepoints above 0x10FFFF . */ @org.junit.Test public void cbclCodepointsToString005() { final XQuery query = new XQuery( "fn:codepoints-to-string( 65536 to 1114112 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * test fn:codepoints-to-string spanning surrogate characters . */ @org.junit.Test public void cbclCodepointsToString006() { final XQuery query = new XQuery( "fn:codepoints-to-string( 55295 to 55297 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * test fn:codepoints-to-string spanning surrogate characters . */ @org.junit.Test public void cbclCodepointsToString007() { final XQuery query = new XQuery( "fn:codepoints-to-string( 55296 to 57343 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * test fn:codepoints-to-string spanning surrogate characters . */ @org.junit.Test public void cbclCodepointsToString008() { final XQuery query = new XQuery( "fn:codepoints-to-string( 65535 to 70000 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * test fn:codepoints-to-string spanning surrogate characters . */ @org.junit.Test public void cbclCodepointsToString009() { final XQuery query = new XQuery( "fn:codepoints-to-string( 65530 to 70000 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * test fn:boolean on fn:codepoints-to-string . */ @org.junit.Test public void cbclCodepointsToString010() { final XQuery query = new XQuery( "fn:boolean(fn:codepoints-to-string( 65 to 76 ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:boolean on fn:codepoints-to-string . */ @org.junit.Test public void cbclCodepointsToString011() { final XQuery query = new XQuery( "fn:boolean(fn:codepoints-to-string( 0 ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * test fn:boolean on fn:codepoints-to-string . */ @org.junit.Test public void cbclCodepointsToString012() { final XQuery query = new XQuery( "fn:boolean(fn:codepoints-to-string( 999999999 ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * test fn:boolean on fn:codepoints-to-string . */ @org.junit.Test public void cbclCodepointsToString013() { final XQuery query = new XQuery( "fn:boolean(fn:codepoints-to-string( 65 ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:boolean on fn:codepoints-to-string . */ @org.junit.Test public void cbclCodepointsToString014() { final XQuery query = new XQuery( "fn:boolean(fn:codepoints-to-string( () ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * fn:codepoints-to-string on multibyte ranges . */ @org.junit.Test public void cbclCodepointsToString015() { final XQuery query = new XQuery( "deep-equal( fn:string-to-codepoints(fn:codepoints-to-string(65536 to 66000)), 65536 to 66000 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:codepoints-to-string on multibyte ranges . */ @org.junit.Test public void cbclCodepointsToString016() { final XQuery query = new XQuery( "deep-equal( fn:string-to-codepoints(fn:codepoints-to-string(65536 to 100000)), 65536 to 100000 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test codepoints to string on a range, returning a boolean . */ @org.junit.Test public void cbclCodepointsToString017() { final XQuery query = new XQuery( "for $x in 32 to 64 return boolean(codepoints-to-string($x to $x + 10))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true true") ); } /** * Tries to force evaluate to item on codepoint-to-string . */ @org.junit.Test public void cbclCodepointsToString018() { final XQuery query = new XQuery( "if(5 < exactly-one((1 to 10)[. div 2 = 5])) then codepoints-to-string(32 to exactly-one((1 to 100)[. div 2 = 40])) else ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOP") ); } /** * Tests for calling EvaluateToOptionalItem . */ @org.junit.Test public void cbclCodepointsToString019() { final XQuery query = new XQuery( "for $x in 65 to 75 return string-length(codepoints-to-string($x to $x+10))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "11 11 11 11 11 11 11 11 11 11 11") ); } /** * Tests false returns from TryArguments . */ @org.junit.Test public void cbclCodepointsToString020() { final XQuery query = new XQuery( "for $x in 65 to 75 return boolean(codepoints-to-string($x[. mod 2 = 0] to ($x+9)[. mod 2 = 0]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "false false false false false false false false false false false") ); } /** * Tests overflows . */ @org.junit.Test public void cbclCodepointsToString021() { final XQuery query = new XQuery( "let $y := 65536*65536 return for $x in $y to $y+10 return codepoints-to-string(65 to $x)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * Tests overflows . */ @org.junit.Test public void cbclCodepointsToString022() { final XQuery query = new XQuery( "let $y := 65536*65536 return for $x in $y to $y+10 return codepoints-to-string($x to $x+10)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * Tests invalid codepoint 0xB . */ @org.junit.Test public void cbclCodepointsToString023() { final XQuery query = new XQuery( "for $x in 9 to 15 return codepoints-to-string($x to $x)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * Tests invalid codepoint 0xE . */ @org.junit.Test public void cbclCodepointsToString024() { final XQuery query = new XQuery( "for $x in 13 to 15 return codepoints-to-string($x to $x)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * Tests valid codepoints 0x9, 0xA . */ @org.junit.Test public void cbclCodepointsToString025() { final XQuery query = new XQuery( "for $x in 9 to 9 return codepoints-to-string($x to $x+1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'\t\n'") ); } /** * Tests valid codepoint 0xD . */ @org.junit.Test public void cbclCodepointsToString026() { final XQuery query = new XQuery( "for $x in 13 to 13 return codepoints-to-string($x to $x)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "\r") ); } /** * Tests last lower codepoint case . */ @org.junit.Test public void cbclCodepointsToString027() { final XQuery query = new XQuery( "for $x in (13), $y in (13,9,10) return codepoints-to-string($x to $y)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "\r ") ); } /** * Invalid XML character codepoint as part of "code-points-to-string" function. . */ @org.junit.Test public void fnCodepointsToString1() { final XQuery query = new XQuery( "fn:codepoints-to-string(0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * Evaluation of an "fn:codepoints-to-string" used as argument to the "fn:lower-case" function and use * codepoints 97,32,115,116,114,105,110,103 (String "a string"). . */ @org.junit.Test public void fnCodepointsToString10() { final XQuery query = new XQuery( "fn:lower-case(fn:codepoints-to-string((97,32,115,116,114,105,110,103)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a string") ); } /** * Evaluation of an "fn:codepoints-to-string" that uses xs:integer as argument and codepoints 97. . */ @org.junit.Test public void fnCodepointsToString11() { final XQuery query = new XQuery( "fn:codepoints-to-string(xs:integer(97))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a") ); } /** * Evaluation of an "fn:codepoints-to-string" that uses fn:avg/xs:integer function and codepoints 65,32,83,116,114,105,110,103. . */ @org.junit.Test public void fnCodepointsToString12() { final XQuery query = new XQuery( "fn:codepoints-to-string(xs:integer(fn:avg((65,32,83,116,114,105,110,103))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "[") ); } /** * Evaluation of an "fn:codepoints-to-string" that is used as argument to fn:concat function. . */ @org.junit.Test public void fnCodepointsToString13() { final XQuery query = new XQuery( "fn:concat(fn:codepoints-to-string((49,97)),\"1a\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1a1a") ); } /** * Evaluation of an "fn:codepoints-to-string" that is used as argument to fn:string-to-codepoints function. . */ @org.junit.Test public void fnCodepointsToString14() { final XQuery query = new XQuery( "fn:string-to-codepoints(fn:codepoints-to-string((49,97)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("49, 97") ); } /** * Evaluation of an "fn:codepoints-to-string" that is used as argument to fn:string-length function. . */ @org.junit.Test public void fnCodepointsToString15() { final XQuery query = new XQuery( "fn:string-length(fn:codepoints-to-string((49,97)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Evaluation of an "fn:codepoints-to-string" that is used as argument to fn:string-join function. . */ @org.junit.Test public void fnCodepointsToString16() { final XQuery query = new XQuery( "fn:string-join((fn:codepoints-to-string((49,97)),'ab'),'')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1aab") ); } /** * Invalid XML character codepoint as part of "code-points-to-string" function. . */ @org.junit.Test public void fnCodepointsToString2() { final XQuery query = new XQuery( "fn:codepoints-to-string(10000000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * Evaluation of an "fn:codepoints-to-string" with argument set to codepoint 49 (single character ('1')). . */ @org.junit.Test public void fnCodepointsToString3() { final XQuery query = new XQuery( "fn:codepoints-to-string(49)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluation of an "fn-codepoints-to-string" with argument set to codepoint 97 (a single character 'a'). . */ @org.junit.Test public void fnCodepointsToString4() { final XQuery query = new XQuery( "fn:codepoints-to-string(97)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a") ); } /** * Evaluation of an "fn:codepoints-to-string" with argument set to codepoints 49, 97 (combination of number/character '1a'). . */ @org.junit.Test public void fnCodepointsToString5() { final XQuery query = new XQuery( "fn:codepoints-to-string((49,97))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1a") ); } /** * Evaluation of an "fn:codepoints-to-string" with argument set to the codepoints 35, 42, 94 36 (characters "#*^$"). . */ @org.junit.Test public void fnCodepointsToString6() { final XQuery query = new XQuery( "fn:codepoints-to-string((35, 42, 94, 36))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "#*^$") ); } /** * Evaluation of an "fn:codepoints-to-string" with argument set to codepoints * 99 111 100 101 112 111 105 110 116 115 45 116 111 45 115 116 114 105 110 103 (string "codepoints-to-string"). . */ @org.junit.Test public void fnCodepointsToString7() { final XQuery query = new XQuery( "fn:codepoints-to-string((99,111,100,101,112,111,105,110,116,115,45,116,111,45,115,116,114,105,110,103))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "codepoints-to-string") ); } /** * Evaluation of an "fn:codepoints-to-string" used as argument to "xs:string()" function and uses * codepoints 65, 32, 83 116, 114, 105, 110, 103 ("A String") . . */ @org.junit.Test public void fnCodepointsToString8() { final XQuery query = new XQuery( "xs:string(fn:codepoints-to-string((65,32,83,116,114,105,110,103)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "A String") ); } /** * Evaluation of an "fn:codepoints-to-string" used as argument to the "fn:upper-case" function and use * codepoints 65,32,83,84,82,73,78,71 (string "A STRING"). . */ @org.junit.Test public void fnCodepointsToString9() { final XQuery query = new XQuery( "fn:upper-case(fn:codepoints-to-string((65,32,83,84,82,73,78,71)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "A STRING") ); } /** * Test codepoints-to-string with variety of characters . */ @org.junit.Test public void fnCodepointsToString1args1() { final XQuery query = new XQuery( "codepoints-to-string((98,223,1682,12365,63744))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "bßڒã豈") ); } /** * Test codepoints-to-string with an empty sequence argument . */ @org.junit.Test public void fnCodepointsToString1args2() { final XQuery query = new XQuery( "codepoints-to-string(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * Test invalid type in argument for codepoints-to-string . */ @org.junit.Test public void fnCodepointsToString1args3() { final XQuery query = new XQuery( "codepoints-to-string('hello')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test incorrect arity for codepoints-to-string . */ @org.junit.Test public void fnCodepointsToString1args4() { final XQuery query = new XQuery( "codepoints-to-string((),())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnCollection.java000066400000000000000000000503741222453003200273370ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the collection function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnCollection extends QT3TestSet { /** * Pass an invalid xs:anyURI to fn:collection(). . */ @org.junit.Test public void k2SeqCollectionFunc1() { final XQuery query = new XQuery( "collection(\"http:\\\\invalidURI\\someURI%gg\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0004") ); } /** * ':/ is an invalid URI. . */ @org.junit.Test public void k2SeqCollectionFunc2() { final XQuery query = new XQuery( "collection(\":/\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0004") ); } /** * test fn:collection with invalid input . */ @org.junit.Test public void cbclCollection001() { final XQuery query = new XQuery( "fn:collection('%gg')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0004") ); } /** * default collection. */ @org.junit.Test public void collection001() { final XQuery query = new XQuery( "collection()", ctx); try { query.addCollection("", new String[] { file("docs/bib.xml"), file("docs/reviews.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( ( assertQuery("count($result) = 2") && assertType("document-node()*") ) || error("FODC0003") ) ); } /** * default collection selected by supplying empty sequence. */ @org.junit.Test public void collection002() { final XQuery query = new XQuery( "collection(())", ctx); try { query.addCollection("", new String[] { file("docs/bib.xml"), file("docs/reviews.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( ( assertQuery("count($result) = 2") && assertType("document-node()*") ) || error("FODC0003") ) ); } /** * default collection is stable. */ @org.junit.Test public void collection003() { final XQuery query = new XQuery( "collection() | collection(())", ctx); try { query.addCollection("", new String[] { file("docs/books.xml"), file("docs/bib.xml"), file("docs/reviews.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( ( assertQuery("count($result) = 3") && assertType("document-node()*") ) || error("FODC0003") ) ); } /** * default collection is not guaranteed stable if an appropriate user option is set. */ @org.junit.Test public void collection004() { final XQuery query = new XQuery( "collection() | collection(())", ctx); try { query.addCollection("", new String[] { file("docs/bib.xml"), file("docs/reviews.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( ( assertQuery("count($result) = 2") && assertType("document-node()*") ) || ( assertQuery("count($result) = 4") && assertType("document-node()*") ) ) ); } /** * simple collection, absolute URI. */ @org.junit.Test public void collection005() { final XQuery query = new XQuery( "collection(\"http://www.w3.org/2010/09/qt-fots-catalog/collection1\")", ctx); try { query.addCollection("http://www.w3.org/2010/09/qt-fots-catalog/collection1", new String[] { file("docs/bib.xml"), file("docs/reviews.xml") }); query.baseURI("http://www.w3.org/2010/09/qt-fots-catalog/"); query.bind("collection-uri", new XQuery("'http://www.w3.org/2010/09/qt-fots-catalog/collection1'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( ( assertQuery("count($result) = 2") && assertType("document-node()*") ) || error("FODC0003") ) ); } /** * simple collection, relative URI. */ @org.junit.Test public void collection006() { final XQuery query = new XQuery( "collection(\"collection1\")", ctx); try { query.addCollection("http://www.w3.org/2010/09/qt-fots-catalog/collection1", new String[] { file("docs/bib.xml"), file("docs/reviews.xml") }); query.baseURI("http://www.w3.org/2010/09/qt-fots-catalog/"); query.bind("collection-uri", new XQuery("'http://www.w3.org/2010/09/qt-fots-catalog/collection1'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( ( assertQuery("count($result) = 2") && assertType("document-node()*") ) || error("FODC0003") ) ); } /** * simple collection, results are stable. */ @org.junit.Test public void collection007() { final XQuery query = new XQuery( "collection(\"http://www.w3.org/2010/09/qt-fots-catalog/collection1\") | collection(\"collection1\")", ctx); try { query.addCollection("http://www.w3.org/2010/09/qt-fots-catalog/collection1", new String[] { file("docs/bib.xml"), file("docs/reviews.xml") }); query.baseURI("http://www.w3.org/2010/09/qt-fots-catalog/"); query.bind("collection-uri", new XQuery("'http://www.w3.org/2010/09/qt-fots-catalog/collection1'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( ( assertQuery("count($result) = 2") && assertType("document-node()*") ) || error("FODC0003") ) ); } /** * simple collection, results are not stable at user option. */ @org.junit.Test public void collection008() { final XQuery query = new XQuery( "collection(\"http://www.w3.org/2010/09/qt-fots-catalog/collection1\") | collection(\"collection1\")", ctx); try { query.addCollection("http://www.w3.org/2010/09/qt-fots-catalog/collection1", new String[] { file("docs/bib.xml"), file("docs/reviews.xml") }); query.baseURI("http://www.w3.org/2010/09/qt-fots-catalog/"); query.bind("collection-uri", new XQuery("'http://www.w3.org/2010/09/qt-fots-catalog/collection1'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( ( assertQuery("count($result) = 2") && assertType("document-node()*") ) || ( assertQuery("count($result) = 4") && assertType("document-node()*") ) ) ); } /** * simple collection, interaction with document-uri(). */ @org.junit.Test public void collection009() { final XQuery query = new XQuery( "let $c := collection(\"http://www.w3.org/2010/09/qt-fots-catalog/collection1\") \n" + " return $c | (for $doc in $c return doc(document-uri($doc)))", ctx); try { query.addCollection("http://www.w3.org/2010/09/qt-fots-catalog/collection1", new String[] { file("docs/bib.xml"), file("docs/reviews.xml") }); query.baseURI("http://www.w3.org/2010/09/qt-fots-catalog/"); query.bind("collection-uri", new XQuery("'http://www.w3.org/2010/09/qt-fots-catalog/collection1'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( ( assertQuery("count($result) = 2") && assertType("document-node()*") ) || error("FODC0003") ) ); } /** * Use a directory URI as a collection URI, if supported. */ @org.junit.Test public void collection010() { final XQuery query = new XQuery( "collection(\"collection/one/\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( ( assertQuery("count($result) = 3") && assertQuery("sum($result/*/number()) = 6") && assertType("document-node()*") ) || error("FODC0003") ) ); } /** * Unknown collection URI. */ @org.junit.Test public void collection900() { final XQuery query = new XQuery( "collection(\"nonexistent\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0002") ); } /** * Unknown default collection. */ @org.junit.Test public void collection901() { final XQuery query = new XQuery( "collection()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0002") ); } /** * Invalid collection URI. */ @org.junit.Test public void collection902() { final XQuery query = new XQuery( "collection(\"##invalid\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0004") ); } /** * Unknown default collection. */ @org.junit.Test public void collection903() { final XQuery query = new XQuery( "collection(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0002") ); } /** * Evaluation of an fn:collection function with wrong arity. . */ @org.junit.Test public void fnCollection1() { final XQuery query = new XQuery( "fn:collection(\"argument1\",\"argument2\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Test that two uses of fn:collection are stable. . */ @org.junit.Test public void fnCollection10() { final XQuery query = new XQuery( "\n" + " let $c1 := fn:collection($collection-uri) \n" + " let $c2 := fn:collection($collection-uri) \n" + " for $c at $p in $c1 \n" + " return $c is exactly-one($c2[$p])", ctx); try { query.addCollection("http://www.w3.org/2010/09/qt-fots-catalog/collection2", new String[] { file("docs/books.xml"), file("docs/bib.xml"), file("docs/reviews.xml") }); query.bind("collection-uri", new XQuery("'http://www.w3.org/2010/09/qt-fots-catalog/collection2'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true true") ); } /** * Test that two uses of fn:collection are stable. . */ @org.junit.Test public void fnCollection10d() { final XQuery query = new XQuery( "\n" + " let $c1 := fn:collection() \n" + " let $c2 := fn:collection() \n" + " for $c at $p in $c1 \n" + " return $c is exactly-one($c2[$p])", ctx); try { query.addCollection("", new String[] { file("docs/books.xml"), file("docs/bib.xml"), file("docs/reviews.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true true") ); } /** * Evaluation of ana fn:collection, which tries to retrieve a non-existent resource. . */ @org.junit.Test public void fnCollection2() { final XQuery query = new XQuery( "fn:collection(\"thisfileshouldnotexists\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0002") ); } /** * Evaluation of ana fn:collection with argument set to an invalid URI. . */ @org.junit.Test public void fnCollection3() { final XQuery query = new XQuery( "fn:collection(\"invalidURI%gg\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0004") ); } /** * Count the number of nodes in a named collection. . */ @org.junit.Test public void fnCollection4() { final XQuery query = new XQuery( "count(fn:collection($collection-uri))", ctx); try { query.addCollection("http://www.w3.org/2010/09/qt-fots-catalog/collection1", new String[] { file("docs/bib.xml"), file("docs/reviews.xml") }); query.baseURI("http://www.w3.org/2010/09/qt-fots-catalog/"); query.bind("collection-uri", new XQuery("'http://www.w3.org/2010/09/qt-fots-catalog/collection1'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Count the number of nodes in the default collection. . */ @org.junit.Test public void fnCollection4d() { final XQuery query = new XQuery( "count(fn:collection())", ctx); try { query.addCollection("", new String[] { file("docs/bib.xml"), file("docs/reviews.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Count the number of nodes in the collection. . */ @org.junit.Test public void fnCollection5() { final XQuery query = new XQuery( "count(fn:collection($collection-uri))", ctx); try { query.addCollection("http://www.w3.org/2010/09/qt-fots-catalog/collection2", new String[] { file("docs/books.xml"), file("docs/bib.xml"), file("docs/reviews.xml") }); query.bind("collection-uri", new XQuery("'http://www.w3.org/2010/09/qt-fots-catalog/collection2'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Count the number of nodes in the collection. . */ @org.junit.Test public void fnCollection5d() { final XQuery query = new XQuery( "count(fn:collection())", ctx); try { query.addCollection("", new String[] { file("docs/books.xml"), file("docs/bib.xml"), file("docs/reviews.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Return the titles in the collection ordered by the title. . */ @org.junit.Test public void fnCollection6() { final XQuery query = new XQuery( "for $x in fn:collection($collection-uri)//title order by string($x) return $x", ctx); try { query.addCollection("http://www.w3.org/2010/09/qt-fots-catalog/collection2", new String[] { file("docs/books.xml"), file("docs/bib.xml"), file("docs/reviews.xml") }); query.bind("collection-uri", new XQuery("'http://www.w3.org/2010/09/qt-fots-catalog/collection2'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Advanced Programming in the Unix environmentAdvanced Programming in the Unix environmentBasic SyntaxData ModelData on the WebData on the WebSyntax For Data ModelTCP/IP IllustratedTCP/IP IllustratedThe Economics of Technology and Content for Digital TVXMLXML and Semistructured Data", false) ); } /** * Return elements that immediately contain TCP/IP. . */ @org.junit.Test public void fnCollection7() { final XQuery query = new XQuery( "distinct-values(fn:collection($collection-uri)//*[text()[contains(.,\"TCP/IP\")]]/normalize-space())", ctx); try { query.addCollection("http://www.w3.org/2010/09/qt-fots-catalog/collection2", new String[] { file("docs/books.xml"), file("docs/bib.xml"), file("docs/reviews.xml") }); query.bind("collection-uri", new XQuery("'http://www.w3.org/2010/09/qt-fots-catalog/collection2'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertPermutation("\"TCP/IP Illustrated\", \"One of the best books on TCP/IP.\"") || error("XPST0005") ) ); } /** * Return the first title element in each document. . */ @org.junit.Test public void fnCollection8() { final XQuery query = new XQuery( "for $d in fn:collection($collection-uri) return ($d//title)[1]", ctx); try { query.addCollection("http://www.w3.org/2010/09/qt-fots-catalog/collection1", new String[] { file("docs/bib.xml"), file("docs/reviews.xml") }); query.baseURI("http://www.w3.org/2010/09/qt-fots-catalog/"); query.bind("collection-uri", new XQuery("'http://www.w3.org/2010/09/qt-fots-catalog/collection1'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("TCP/IP IllustratedData on the Web", false) || assertSerialization("Data on the WebTCP/IP Illustrated", false) ) ); } /** * Count the title elements in each document. . */ @org.junit.Test public void fnCollection9() { final XQuery query = new XQuery( "for $d in fn:collection($collection-uri) order by count($d//title) return count($d//title)", ctx); try { query.addCollection("http://www.w3.org/2010/09/qt-fots-catalog/collection2", new String[] { file("docs/books.xml"), file("docs/bib.xml"), file("docs/reviews.xml") }); query.bind("collection-uri", new XQuery("'http://www.w3.org/2010/09/qt-fots-catalog/collection2'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3 4 5") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnCompare.java000066400000000000000000000737561222453003200266430ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the compare() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnCompare extends QT3TestSet { /** * A test whose essence is: `codepoint-equal()`.. */ @org.junit.Test public void kCompareFunc1() { final XQuery query = new XQuery( "codepoint-equal()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `compare((), (), "http://www.w3.org/2005/xpath-functions/collation/codepoint", "wrong param")`.. */ @org.junit.Test public void kCompareFunc10() { final XQuery query = new XQuery( "compare((), (), \"http://www.w3.org/2005/xpath-functions/collation/codepoint\", \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(compare((), "a string"))`.. */ @org.junit.Test public void kCompareFunc11() { final XQuery query = new XQuery( "empty(compare((), \"a string\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(compare("a string", ()))`.. */ @org.junit.Test public void kCompareFunc12() { final XQuery query = new XQuery( "empty(compare(\"a string\", ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(compare("a string", (), "http://www.w3.org/2005/xpath-functions/collation/codepoint"))`.. */ @org.junit.Test public void kCompareFunc13() { final XQuery query = new XQuery( "empty(compare(\"a string\", (), \"http://www.w3.org/2005/xpath-functions/collation/codepoint\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `compare("str", "str") instance of xs:integer`.. */ @org.junit.Test public void kCompareFunc14() { final XQuery query = new XQuery( "compare(\"str\", \"str\") instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(compare("a string", "a string", "http://www.example.com/COLLATION/NOT/SUPPORTED"))`.. */ @org.junit.Test public void kCompareFunc15() { final XQuery query = new XQuery( "empty(compare(\"a string\", \"a string\", \"http://www.example.com/COLLATION/NOT/SUPPORTED\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || error("FOCH0002") ) ); } /** * A test whose essence is: `codepoint-equal(())`.. */ @org.junit.Test public void kCompareFunc2() { final XQuery query = new XQuery( "codepoint-equal(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `codepoint-equal((), (), ())`.. */ @org.junit.Test public void kCompareFunc3() { final XQuery query = new XQuery( "codepoint-equal((), (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(codepoint-equal((), "a string"))`.. */ @org.junit.Test public void kCompareFunc4() { final XQuery query = new XQuery( "empty(codepoint-equal((), \"a string\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(codepoint-equal("a string", ()))`.. */ @org.junit.Test public void kCompareFunc5() { final XQuery query = new XQuery( "empty(codepoint-equal(\"a string\", ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `codepoint-equal("a string", "a string")`.. */ @org.junit.Test public void kCompareFunc6() { final XQuery query = new XQuery( "codepoint-equal(\"a string\", \"a string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(codepoint-equal("cow", "a string"))`.. */ @org.junit.Test public void kCompareFunc7() { final XQuery query = new XQuery( "not(codepoint-equal(\"cow\", \"a string\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `compare()`.. */ @org.junit.Test public void kCompareFunc8() { final XQuery query = new XQuery( "compare()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `compare(())`.. */ @org.junit.Test public void kCompareFunc9() { final XQuery query = new XQuery( "compare(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Use a complex collation argument.. */ @org.junit.Test public void k2CompareFunc1() { final XQuery query = new XQuery( "compare(\"a\", \"a\", (\"http://www.w3.org/2005/xpath-functions/collation/codepoint\", ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Use a complex collation argument.. */ @org.junit.Test public void k2CompareFunc2() { final XQuery query = new XQuery( "compare(\"a\", \"a\", ((), \"http://www.w3.org/2005/xpath-functions/collation/codepoint\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Use a complex collation argument. . */ @org.junit.Test public void k2CompareFunc3() { final XQuery query = new XQuery( "compare(\"a\", \"a\", ((), \"http://www.w3.org/2005/xpath-functions/collation/codepoint\", ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Compare two values returned from fn:lower-case(). . */ @org.junit.Test public void k2CompareFunc4() { final XQuery query = new XQuery( "let $vA := (\"B STRING\", current-time())[1] treat as xs:string, \n" + " $vB := (\"b string\", current-time())[1] treat as xs:string\n" + " return compare(lower-case($vA), lower-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Compare two values returned from fn:upper-case(). . */ @org.junit.Test public void k2CompareFunc5() { final XQuery query = new XQuery( "let $vA := (\"B STRING\", current-time())[1] treat as xs:string, \n" + " $vB := (\"b string\", current-time())[1] treat as xs:string \n" + " return compare(upper-case($vA), upper-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Compare two non-matching values returned from fn:lower-case(). . */ @org.junit.Test public void k2CompareFunc6() { final XQuery query = new XQuery( "let $vA := (\"B STRING\", current-time())[1] treat as xs:string, \n" + " $vB := (\"no match\", current-time())[1] treat as xs:string \n" + " return compare(lower-case($vA), lower-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Compare two non-matching values returned from fn:upper-case(). . */ @org.junit.Test public void k2CompareFunc7() { final XQuery query = new XQuery( "let $vA := (\"B STRING\", current-time())[1] treat as xs:string, \n" + " $vB := (\"no match\", current-time())[1] treat as xs:string \n" + " return compare(upper-case($vA), upper-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Compare two non-matching values returned from fn:lower-case() and fn:upper-case(). . */ @org.junit.Test public void k2CompareFunc8() { final XQuery query = new XQuery( "let $vA := (\"B STRING\", current-time())[1] treat as xs:string, \n" + " $vB := (\"no match\", current-time())[1] treat as xs:string \n" + " return compare(upper-case($vA), lower-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Compare two non-matching values returned from fn:lower-case() and fn:upper-case(). . */ @org.junit.Test public void k2CompareFunc9() { final XQuery query = new XQuery( "let $vA := (\"B STRING\", current-time())[1] treat as xs:string, \n" + " $vB := (\"no match\", current-time())[1] treat as xs:string \n" + " return compare(lower-case($vA), upper-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Simple use of compare to compare strings. */ @org.junit.Test public void compare001() { final XQuery query = new XQuery( "compare(\"a\", \"b\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-1") && assertType("xs:integer") ) ); } /** * Simple use of compare to compare strings. */ @org.junit.Test public void compare002() { final XQuery query = new XQuery( "compare(\"b\", \"a\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Simple use of compare to compare strings. */ @org.junit.Test public void compare003() { final XQuery query = new XQuery( "compare(\"b\", \"b\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * compare() with empty sequence as argument. */ @org.junit.Test public void compare004() { final XQuery query = new XQuery( "compare(\"b\", ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * compare() with empty sequence as argument. */ @org.junit.Test public void compare005() { final XQuery query = new XQuery( "compare((), \"b\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * compare() with empty sequence as argument. */ @org.junit.Test public void compare006() { final XQuery query = new XQuery( "compare((), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * compare() with non-BMP characters. */ @org.junit.Test public void compare007() { final XQuery query = new XQuery( "compare(\"ð€\", \"ð€‚\", \"http://www.w3.org/2005/xpath-functions/collation/codepoint\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * check that Unicode codepoint collation is used, not comparison of UTF16 surrogates. */ @org.junit.Test public void compare008() { final XQuery query = new XQuery( "compare(\"ð€\", \"\ufff0\", \"http://www.w3.org/2005/xpath-functions/collation/codepoint\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * check that Unicode codepoint collation is used, not comparison of UTF16 surrogates. */ @org.junit.Test public void compare009() { final XQuery query = new XQuery( "compare(\"ð€\", \"\ufff0\", \"http://www.w3.org/2005/xpath-functions/collation/codepoint\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * compare() only works on strings. */ @org.junit.Test public void compare011() { final XQuery query = new XQuery( "compare(123, 456)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * compare() only works on strings, but xs:anyURI gets promoted. */ @org.junit.Test public void compare012() { final XQuery query = new XQuery( "compare(xs:anyURI('http://www.example.com/'), 'http://www.example.com/')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * compare() only works on strings, but xs:untypedAtomic gets promoted. */ @org.junit.Test public void compare013() { final XQuery query = new XQuery( "compare(xs:untypedAtomic('http://www.example.com/'), 'http://www.example.com/')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "compare" function with the arguments set as follows: $arg1 = "" $arg2 = "". */ @org.junit.Test public void fnCompare1() { final XQuery query = new XQuery( "fn:compare(\"\",\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "compare" function with the arguments set as follows: $arg1 = " " $arg2 = " AAAAABBBBB". */ @org.junit.Test public void fnCompare10() { final XQuery query = new XQuery( "fn:compare(\" \",\"AAAAABBBBB\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "compare" function using it as a argument of a fn:not - returns true. */ @org.junit.Test public void fnCompare11() { final XQuery query = new XQuery( "fn:not(fn:compare(\"A\",\"A\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "compare" function using it as a argument of a fn:not - returns false. */ @org.junit.Test public void fnCompare12() { final XQuery query = new XQuery( "fn:not(fn:compare(\"A\",\"B\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "compare" function with the arguments set as follows: $arg1 = xs:string("A") $arg2 = "A". */ @org.junit.Test public void fnCompare13() { final XQuery query = new XQuery( "fn:compare(xs:string(\"A\"),\"A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "compare" function with the arguments set as follows: $arg1 = "A" $arg2 = xs:string("A"). */ @org.junit.Test public void fnCompare14() { final XQuery query = new XQuery( "fn:compare(\"A\",xs:string(\"A\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "compare" function with the arguments set as follows: $arg1 = "A" $arg2 = "a". */ @org.junit.Test public void fnCompare15() { final XQuery query = new XQuery( "fn:compare(\"A\",\"a\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "compare" function with the arguments set as follows: $arg1 = "a" $arg2 = "A". */ @org.junit.Test public void fnCompare16() { final XQuery query = new XQuery( "fn:compare(\"a\",\"A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "compare" function with the arguments set as follows: $arg1 = "compare" $arg2 = "compare". */ @org.junit.Test public void fnCompare17() { final XQuery query = new XQuery( "fn:compare(\"compare\",\"compare\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "compare" function with the arguments set as follows: $arg1 = "comparecompare" $arg2 = "compare". */ @org.junit.Test public void fnCompare18() { final XQuery query = new XQuery( "fn:compare(\"comparecompare\",\"compare\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "compare" function with the arguments set as follows: $arg1 = "****" $arg2 = "***". */ @org.junit.Test public void fnCompare19() { final XQuery query = new XQuery( "fn:compare(\"****\",\"***\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "compare" function with the arguments set as follows: $arg1 = "" $arg2 = "A Character String". */ @org.junit.Test public void fnCompare2() { final XQuery query = new XQuery( "fn:compare(\"\",\"A Character String\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "compare" function with the arguments set as follows: $arg1 = "12345" $arg2 = "1234". */ @org.junit.Test public void fnCompare20() { final XQuery query = new XQuery( "fn:compare(\"12345\",\"1234\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "compare" function with the arguments set as follows: $arg1 = "compare" $arg2 = "erapmoc" ("compare" backwards). */ @org.junit.Test public void fnCompare21() { final XQuery query = new XQuery( "fn:compare(\"compare\",\"erapmoc\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Description Evaluates The "compare" function with a nonexistent collation.. */ @org.junit.Test public void fnCompare22() { final XQuery query = new XQuery( "fn:compare(\"a\",\"a\",\"CollationA\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0002") ); } /** * Evaluates The "compare" function with the arguments set as follows: $arg1 = "A Character String" $arg2 = "". */ @org.junit.Test public void fnCompare3() { final XQuery query = new XQuery( "fn:compare(\"A Character String\",\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "compare" function with the arguments set as follows: $arg1 = () $arg2 = "". */ @org.junit.Test public void fnCompare4() { final XQuery query = new XQuery( "fn:count(fn:compare((),\"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "compare" function with the arguments set as follows: $arg1 = "" $arg2 = (). */ @org.junit.Test public void fnCompare5() { final XQuery query = new XQuery( "fn:count(fn:compare(\"\",()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "compare" function with the arguments set as follows: $arg1 = "A Character String" $arg2 = (). */ @org.junit.Test public void fnCompare6() { final XQuery query = new XQuery( "fn:count(fn:compare(\"A Character String\",()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "compare" function with the arguments set as follows: $arg1 = () $arg2 = "A Character String". */ @org.junit.Test public void fnCompare7() { final XQuery query = new XQuery( "fn:count(fn:compare((),\"A Character String\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "compare" function with the arguments set as follows: $arg1 = "AAAAABBBBBCCCCC" $arg2 = "BBBBB". */ @org.junit.Test public void fnCompare8() { final XQuery query = new XQuery( "fn:compare(\"AAAAABBBBBCCCCC\",\"BBBBB\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "compare" function with the arguments set as follows: $arg1 = "AAAAABBBBB" $arg2 = " ". */ @org.junit.Test public void fnCompare9() { final XQuery query = new XQuery( "fn:compare(\"AAAAABBBBB\",\" \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "compare" function with the arguments set as follows: $comparand1 = xs:string(lower bound) $comparand2 = xs:string(lower bound). */ @org.junit.Test public void fnCompare2args1() { final XQuery query = new XQuery( "fn:compare(xs:string(\"This is a characte\"),xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "compare" function with the arguments set as follows: $comparand1 = xs:string(mid range) $comparand2 = xs:string(lower bound). */ @org.junit.Test public void fnCompare2args2() { final XQuery query = new XQuery( "fn:compare(xs:string(\"This is a characte\"),xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "compare" function with the arguments set as follows: $comparand1 = xs:string(upper bound) $comparand2 = xs:string(lower bound). */ @org.junit.Test public void fnCompare2args3() { final XQuery query = new XQuery( "fn:compare(xs:string(\"This is a characte\"),xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "compare" function with the arguments set as follows: $comparand1 = xs:string(lower bound) $comparand2 = xs:string(mid range). */ @org.junit.Test public void fnCompare2args4() { final XQuery query = new XQuery( "fn:compare(xs:string(\"This is a characte\"),xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "compare" function with the arguments set as follows: $comparand1 = xs:string(lower bound) $comparand2 = xs:string(upper bound). */ @org.junit.Test public void fnCompare2args5() { final XQuery query = new XQuery( "fn:compare(xs:string(\"This is a characte\"),xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnConcat.java000066400000000000000000001473351222453003200264570ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** . * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnConcat extends QT3TestSet { /** * A test whose essence is: `concat()`. . */ @org.junit.Test public void kConcatFunc1() { final XQuery query = new XQuery( "concat()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `concat("a string")`. . */ @org.junit.Test public void kConcatFunc2() { final XQuery query = new XQuery( "concat(\"a string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `concat("ab", "c") eq "abc"`. . */ @org.junit.Test public void kConcatFunc3() { final XQuery query = new XQuery( "concat(\"ab\", \"c\") eq \"abc\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `concat("ab", "c") instance of xs:string`. . */ @org.junit.Test public void kConcatFunc4() { final XQuery query = new XQuery( "concat(\"ab\", \"c\") instance of xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `concat((), ()) instance of xs:string`. . */ @org.junit.Test public void kConcatFunc5() { final XQuery query = new XQuery( "concat((), ()) instance of xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `concat((), ()) eq ""`. . */ @org.junit.Test public void kConcatFunc6() { final XQuery query = new XQuery( "concat((), ()) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `concat('a', 'b', 'c', (), 'd', 'e', 'f', 'g', 'h', ' ', 'i', 'j', 'k l') eq "abcdefgh ijk l"`. . */ @org.junit.Test public void kConcatFunc7() { final XQuery query = new XQuery( "concat('a', 'b', 'c', (), 'd', 'e', 'f', 'g', 'h', ' ', 'i', 'j', 'k l') eq \"abcdefgh ijk l\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `concat(1, 2, 3) eq "123"`. . */ @org.junit.Test public void kConcatFunc8() { final XQuery query = new XQuery( "concat(1, 2, 3) eq \"123\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `concat(1, "2", 3) eq "123"`. . */ @org.junit.Test public void kConcatFunc9() { final XQuery query = new XQuery( "concat(1, \"2\", 3) eq \"123\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invalid amount of arguments to fn:concat(). . */ @org.junit.Test public void k2ConcatFunc1() { final XQuery query = new XQuery( "concat((\"a\", \"b\"), \"c\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Invalid amount of arguments to fn:concat(). . */ @org.junit.Test public void k2ConcatFunc2() { final XQuery query = new XQuery( "concat(\"1\", \"2\", \"3\", (\"a\", \"b\"), \"c\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Invalid arguments to fn:concat(). . */ @org.junit.Test public void k2ConcatFunc3() { final XQuery query = new XQuery( "concat(\"1\", \"2\", \"3\", \"c\", (\"a\", \"b\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test fn:boolean(fn:concat()) where concat returns empty string . */ @org.junit.Test public void cbclConcat001() { final XQuery query = new XQuery( "fn:boolean(fn:concat('', ''))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of concat function as per example 1 (for this function) from the F&O specs. . */ @org.junit.Test public void fnConcat1() { final XQuery query = new XQuery( "fn:concat('un', 'grateful')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ungrateful") ); } /** * Evaluation of concat function with argument set to "*****" . */ @org.junit.Test public void fnConcat10() { final XQuery query = new XQuery( "fn:concat(\"**\",\"***\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "*****") ); } /** * Evaluation of concat function with argument that uses another concat function . */ @org.junit.Test public void fnConcat11() { final XQuery query = new XQuery( "fn:concat(fn:concat(\"zzz\",\"zz\"),\"123\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "zzzzz123") ); } /** * Evaluation of concat function as an argument to the "fn:boolean" function . */ @org.junit.Test public void fnConcat12() { final XQuery query = new XQuery( "fn:boolean(fn:concat(\"ab\",\"cde\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of concat function as an argument to the "fn:string" function . */ @org.junit.Test public void fnConcat13() { final XQuery query = new XQuery( "fn:string(fn:concat(\"abc\",\"de\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcde") ); } /** * Evaluation of concat function as an argument to the "fn:not" function . */ @org.junit.Test public void fnConcat14() { final XQuery query = new XQuery( "fn:not(fn:concat(\"ab\",\"cde\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of concat function with argument set to "%$",#@!" . */ @org.junit.Test public void fnConcat15() { final XQuery query = new XQuery( "fn:concat(\"%$\",\"#@!\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "%$#@!") ); } /** * Evaluation of concat function with argument set to "concat","concat" . */ @org.junit.Test public void fnConcat16() { final XQuery query = new XQuery( "fn:concat(\"concat\",\"concat\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "concatconcat") ); } /** * Evaluation of concat function as part of a boolean expression . */ @org.junit.Test public void fnConcat17() { final XQuery query = new XQuery( "fn:concat(\"abc\",\"abc\") and fn:concat(\"abc\",\"abc\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Can't have a function item as an argument to concat . */ @org.junit.Test public void fnConcat18() { final XQuery query = new XQuery( "fn:concat(\"abc\",\"abc\", fn:concat#3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOTY0013") ); } /** * Evaluation of concat function as per example 2 (for this function) from the F&O specs. . */ @org.junit.Test public void fnConcat2() { final XQuery query = new XQuery( "fn:concat('Thy ', (), 'old ', \"groans\", \"\", ' ring', ' yet', ' in', ' my', ' ancient',' ears.')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Thy old groans ring yet in my ancient ears.") ); } /** * Evaluation of concat function as per example 3 (for this function) from the F&O specs. . */ @org.junit.Test public void fnConcat3() { final XQuery query = new XQuery( "fn:concat('Ciao!',())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Ciao!") ); } /** * Evaluation of concat function as per example 4 (for this function) from the F&O specs. . */ @org.junit.Test public void fnConcat4() { final XQuery query = new XQuery( "fn:concat('Ingratitude, ', 'thou ', 'marble-hearted', ' fiend!')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Ingratitude, thou marble-hearted fiend!") ); } /** * Evaluation of concat function that uses only upper case letters as part of argument . */ @org.junit.Test public void fnConcat5() { final XQuery query = new XQuery( "fn:concat(\"AB\",\"CD\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ABCD") ); } /** * Evaluation of concat function that uses only lower case letters as part of argument . */ @org.junit.Test public void fnConcat6() { final XQuery query = new XQuery( "fn:concat(\"abc\",\"de\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcde") ); } /** * Evaluation of concat function that uses both upper and lower case letters as part of argument . */ @org.junit.Test public void fnConcat7() { final XQuery query = new XQuery( "fn:concat(\"ABCDE\",\"abcde\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ABCDEabcde") ); } /** * Evaluation of concat function that uses the empty string as part of argument Uses "fn:count" to avoid the empty file . */ @org.junit.Test public void fnConcat8() { final XQuery query = new XQuery( "fn:count(fn:concat(\"\",\"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluation of concat function that uses the "upper-case" function as part of argument . */ @org.junit.Test public void fnConcat9() { final XQuery query = new XQuery( "fn:concat(fn:upper-case(\"Abc\"),fn:upper-case(\"DH\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ABCDH") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void fnConcatdbl2args1() { final XQuery query = new XQuery( "fn:concat(xs:double(\"-1.7976931348623157E308\"),xs:double(\"-1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.7976931348623157E308-1.7976931348623157E308") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:double(mid range) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void fnConcatdbl2args2() { final XQuery query = new XQuery( "fn:concat(xs:double(\"0\"),xs:double(\"-1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0-1.7976931348623157E308") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:double(upper bound) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void fnConcatdbl2args3() { final XQuery query = new XQuery( "fn:concat(xs:double(\"1.7976931348623157E308\"),xs:double(\"-1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.7976931348623157E308-1.7976931348623157E308") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(mid range) . */ @org.junit.Test public void fnConcatdbl2args4() { final XQuery query = new XQuery( "fn:concat(xs:double(\"-1.7976931348623157E308\"),xs:double(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.7976931348623157E3080") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(upper bound) . */ @org.junit.Test public void fnConcatdbl2args5() { final XQuery query = new XQuery( "fn:concat(xs:double(\"-1.7976931348623157E308\"),xs:double(\"1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.7976931348623157E3081.7976931348623157E308") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void fnConcatdec2args1() { final XQuery query = new XQuery( "fn:concat(xs:decimal(\"-999999999999999999\"),xs:decimal(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999-999999999999999999") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:decimal(mid range) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void fnConcatdec2args2() { final XQuery query = new XQuery( "fn:concat(xs:decimal(\"617375191608514839\"),xs:decimal(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "617375191608514839-999999999999999999") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:decimal(upper bound) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void fnConcatdec2args3() { final XQuery query = new XQuery( "fn:concat(xs:decimal(\"999999999999999999\"),xs:decimal(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "999999999999999999-999999999999999999") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(mid range) . */ @org.junit.Test public void fnConcatdec2args4() { final XQuery query = new XQuery( "fn:concat(xs:decimal(\"-999999999999999999\"),xs:decimal(\"617375191608514839\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999617375191608514839") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(upper bound) . */ @org.junit.Test public void fnConcatdec2args5() { final XQuery query = new XQuery( "fn:concat(xs:decimal(\"-999999999999999999\"),xs:decimal(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999999999999999999999") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void fnConcatflt2args1() { final XQuery query = new XQuery( "fn:concat(xs:float(\"-3.4028235E38\"),xs:float(\"-3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-3.4028235E38-3.4028235E38") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:float(mid range) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void fnConcatflt2args2() { final XQuery query = new XQuery( "fn:concat(xs:float(\"0\"),xs:float(\"-3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0-3.4028235E38") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:float(upper bound) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void fnConcatflt2args3() { final XQuery query = new XQuery( "fn:concat(xs:float(\"3.4028235E38\"),xs:float(\"-3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3.4028235E38-3.4028235E38") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(mid range) . */ @org.junit.Test public void fnConcatflt2args4() { final XQuery query = new XQuery( "fn:concat(xs:float(\"-3.4028235E38\"),xs:float(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-3.4028235E380") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(upper bound) . */ @org.junit.Test public void fnConcatflt2args5() { final XQuery query = new XQuery( "fn:concat(xs:float(\"-3.4028235E38\"),xs:float(\"3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-3.4028235E383.4028235E38") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void fnConcatint2args1() { final XQuery query = new XQuery( "fn:concat(xs:int(\"-2147483648\"),xs:int(\"-2147483648\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-2147483648-2147483648") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:int(mid range) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void fnConcatint2args2() { final XQuery query = new XQuery( "fn:concat(xs:int(\"-1873914410\"),xs:int(\"-2147483648\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1873914410-2147483648") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:int(upper bound) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void fnConcatint2args3() { final XQuery query = new XQuery( "fn:concat(xs:int(\"2147483647\"),xs:int(\"-2147483648\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2147483647-2147483648") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(mid range) . */ @org.junit.Test public void fnConcatint2args4() { final XQuery query = new XQuery( "fn:concat(xs:int(\"-2147483648\"),xs:int(\"-1873914410\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-2147483648-1873914410") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(upper bound) . */ @org.junit.Test public void fnConcatint2args5() { final XQuery query = new XQuery( "fn:concat(xs:int(\"-2147483648\"),xs:int(\"2147483647\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-21474836482147483647") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void fnConcatintg2args1() { final XQuery query = new XQuery( "fn:concat(xs:integer(\"-999999999999999999\"),xs:integer(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999-999999999999999999") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:integer(mid range) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void fnConcatintg2args2() { final XQuery query = new XQuery( "fn:concat(xs:integer(\"830993497117024304\"),xs:integer(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "830993497117024304-999999999999999999") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:integer(upper bound) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void fnConcatintg2args3() { final XQuery query = new XQuery( "fn:concat(xs:integer(\"999999999999999999\"),xs:integer(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "999999999999999999-999999999999999999") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(mid range) . */ @org.junit.Test public void fnConcatintg2args4() { final XQuery query = new XQuery( "fn:concat(xs:integer(\"-999999999999999999\"),xs:integer(\"830993497117024304\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999830993497117024304") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(upper bound) . */ @org.junit.Test public void fnConcatintg2args5() { final XQuery query = new XQuery( "fn:concat(xs:integer(\"-999999999999999999\"),xs:integer(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999999999999999999999") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void fnConcatlng2args1() { final XQuery query = new XQuery( "fn:concat(xs:long(\"-92233720368547758\"),xs:long(\"-92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-92233720368547758-92233720368547758") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:long(mid range) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void fnConcatlng2args2() { final XQuery query = new XQuery( "fn:concat(xs:long(\"-47175562203048468\"),xs:long(\"-92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-47175562203048468-92233720368547758") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:long(upper bound) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void fnConcatlng2args3() { final XQuery query = new XQuery( "fn:concat(xs:long(\"92233720368547758\"),xs:long(\"-92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "92233720368547758-92233720368547758") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(mid range) . */ @org.junit.Test public void fnConcatlng2args4() { final XQuery query = new XQuery( "fn:concat(xs:long(\"-92233720368547758\"),xs:long(\"-47175562203048468\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-92233720368547758-47175562203048468") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(upper bound) . */ @org.junit.Test public void fnConcatlng2args5() { final XQuery query = new XQuery( "fn:concat(xs:long(\"-92233720368547758\"),xs:long(\"92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-9223372036854775892233720368547758") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnConcatnint2args1() { final XQuery query = new XQuery( "fn:concat(xs:negativeInteger(\"-999999999999999999\"),xs:negativeInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999-999999999999999999") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:negativeInteger(mid range) $arg2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnConcatnint2args2() { final XQuery query = new XQuery( "fn:concat(xs:negativeInteger(\"-297014075999096793\"),xs:negativeInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-297014075999096793-999999999999999999") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:negativeInteger(upper bound) $arg2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnConcatnint2args3() { final XQuery query = new XQuery( "fn:concat(xs:negativeInteger(\"-1\"),xs:negativeInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1-999999999999999999") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnConcatnint2args4() { final XQuery query = new XQuery( "fn:concat(xs:negativeInteger(\"-999999999999999999\"),xs:negativeInteger(\"-297014075999096793\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999-297014075999096793") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnConcatnint2args5() { final XQuery query = new XQuery( "fn:concat(xs:negativeInteger(\"-999999999999999999\"),xs:negativeInteger(\"-1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999-1") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnConcatnni2args1() { final XQuery query = new XQuery( "fn:concat(xs:nonNegativeInteger(\"0\"),xs:nonNegativeInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "00") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:nonNegativeInteger(mid range) $arg2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnConcatnni2args2() { final XQuery query = new XQuery( "fn:concat(xs:nonNegativeInteger(\"303884545991464527\"),xs:nonNegativeInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3038845459914645270") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:nonNegativeInteger(upper bound) $arg2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnConcatnni2args3() { final XQuery query = new XQuery( "fn:concat(xs:nonNegativeInteger(\"999999999999999999\"),xs:nonNegativeInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9999999999999999990") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnConcatnni2args4() { final XQuery query = new XQuery( "fn:concat(xs:nonNegativeInteger(\"0\"),xs:nonNegativeInteger(\"303884545991464527\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0303884545991464527") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnConcatnni2args5() { final XQuery query = new XQuery( "fn:concat(xs:nonNegativeInteger(\"0\"),xs:nonNegativeInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0999999999999999999") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnConcatnpi2args1() { final XQuery query = new XQuery( "fn:concat(xs:nonPositiveInteger(\"-999999999999999999\"),xs:nonPositiveInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999-999999999999999999") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:nonPositiveInteger(mid range) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnConcatnpi2args2() { final XQuery query = new XQuery( "fn:concat(xs:nonPositiveInteger(\"-475688437271870490\"),xs:nonPositiveInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-475688437271870490-999999999999999999") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:nonPositiveInteger(upper bound) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnConcatnpi2args3() { final XQuery query = new XQuery( "fn:concat(xs:nonPositiveInteger(\"0\"),xs:nonPositiveInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0-999999999999999999") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnConcatnpi2args4() { final XQuery query = new XQuery( "fn:concat(xs:nonPositiveInteger(\"-999999999999999999\"),xs:nonPositiveInteger(\"-475688437271870490\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999-475688437271870490") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnConcatnpi2args5() { final XQuery query = new XQuery( "fn:concat(xs:nonPositiveInteger(\"-999999999999999999\"),xs:nonPositiveInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-9999999999999999990") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnConcatpint2args1() { final XQuery query = new XQuery( "fn:concat(xs:positiveInteger(\"1\"),xs:positiveInteger(\"1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "11") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:positiveInteger(mid range) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnConcatpint2args2() { final XQuery query = new XQuery( "fn:concat(xs:positiveInteger(\"52704602390610033\"),xs:positiveInteger(\"1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "527046023906100331") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:positiveInteger(upper bound) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnConcatpint2args3() { final XQuery query = new XQuery( "fn:concat(xs:positiveInteger(\"999999999999999999\"),xs:positiveInteger(\"1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9999999999999999991") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnConcatpint2args4() { final XQuery query = new XQuery( "fn:concat(xs:positiveInteger(\"1\"),xs:positiveInteger(\"52704602390610033\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "152704602390610033") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnConcatpint2args5() { final XQuery query = new XQuery( "fn:concat(xs:positiveInteger(\"1\"),xs:positiveInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999999999999999999") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void fnConcatsht2args1() { final XQuery query = new XQuery( "fn:concat(xs:short(\"-32768\"),xs:short(\"-32768\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-32768-32768") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:short(mid range) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void fnConcatsht2args2() { final XQuery query = new XQuery( "fn:concat(xs:short(\"-5324\"),xs:short(\"-32768\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-5324-32768") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:short(upper bound) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void fnConcatsht2args3() { final XQuery query = new XQuery( "fn:concat(xs:short(\"32767\"),xs:short(\"-32768\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "32767-32768") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(mid range) . */ @org.junit.Test public void fnConcatsht2args4() { final XQuery query = new XQuery( "fn:concat(xs:short(\"-32768\"),xs:short(\"-5324\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-32768-5324") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(upper bound) . */ @org.junit.Test public void fnConcatsht2args5() { final XQuery query = new XQuery( "fn:concat(xs:short(\"-32768\"),xs:short(\"32767\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-3276832767") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnConcatulng2args1() { final XQuery query = new XQuery( "fn:concat(xs:unsignedLong(\"0\"),xs:unsignedLong(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "00") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:unsignedLong(mid range) $arg2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnConcatulng2args2() { final XQuery query = new XQuery( "fn:concat(xs:unsignedLong(\"130747108607674654\"),xs:unsignedLong(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1307471086076746540") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:unsignedLong(upper bound) $arg2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnConcatulng2args3() { final XQuery query = new XQuery( "fn:concat(xs:unsignedLong(\"184467440737095516\"),xs:unsignedLong(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1844674407370955160") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnConcatulng2args4() { final XQuery query = new XQuery( "fn:concat(xs:unsignedLong(\"0\"),xs:unsignedLong(\"130747108607674654\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0130747108607674654") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnConcatulng2args5() { final XQuery query = new XQuery( "fn:concat(xs:unsignedLong(\"0\"),xs:unsignedLong(\"184467440737095516\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0184467440737095516") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnConcatusht2args1() { final XQuery query = new XQuery( "fn:concat(xs:unsignedShort(\"0\"),xs:unsignedShort(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "00") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:unsignedShort(mid range) $arg2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnConcatusht2args2() { final XQuery query = new XQuery( "fn:concat(xs:unsignedShort(\"44633\"),xs:unsignedShort(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "446330") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:unsignedShort(upper bound) $arg2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnConcatusht2args3() { final XQuery query = new XQuery( "fn:concat(xs:unsignedShort(\"65535\"),xs:unsignedShort(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "655350") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnConcatusht2args4() { final XQuery query = new XQuery( "fn:concat(xs:unsignedShort(\"0\"),xs:unsignedShort(\"44633\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "044633") ); } /** * Evaluates The "concat" function with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnConcatusht2args5() { final XQuery query = new XQuery( "fn:concat(xs:unsignedShort(\"0\"),xs:unsignedShort(\"65535\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "065535") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnContains.java000066400000000000000000000515401222453003200270160ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the contains() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnContains extends QT3TestSet { /** * A test whose essence is: `contains()`. . */ @org.junit.Test public void kContainsFunc1() { final XQuery query = new XQuery( "contains()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `contains("foo", "foo")`. . */ @org.junit.Test public void kContainsFunc10() { final XQuery query = new XQuery( "contains(\"foo\", \"foo\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(contains("", "a string"))`. . */ @org.junit.Test public void kContainsFunc11() { final XQuery query = new XQuery( "not(contains(\"\", \"a string\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `contains(())`. . */ @org.junit.Test public void kContainsFunc2() { final XQuery query = new XQuery( "contains(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `contains((), (), "http://www.w3.org/2005/xpath-functions/collation/codepoint", "wrong param")`. . */ @org.junit.Test public void kContainsFunc3() { final XQuery query = new XQuery( "contains((), (), \"http://www.w3.org/2005/xpath-functions/collation/codepoint\", \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `contains("a string", "a string", "http://www.example.com/COLLATION/NOT/SUPPORTED")`. . */ @org.junit.Test public void kContainsFunc4() { final XQuery query = new XQuery( "contains(\"a string\", \"a string\", \"http://www.example.com/COLLATION/NOT/SUPPORTED\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0002") ); } /** * A test whose essence is: `contains("foo", "foo", "http://www.w3.org/2005/xpath-functions/collation/codepoint")`. . */ @org.junit.Test public void kContainsFunc5() { final XQuery query = new XQuery( "contains(\"foo\", \"foo\", \"http://www.w3.org/2005/xpath-functions/collation/codepoint\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `contains("tattoo", "t")`. . */ @org.junit.Test public void kContainsFunc6() { final XQuery query = new XQuery( "contains(\"tattoo\", \"t\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(contains("tattoo", "ttt"))`. . */ @org.junit.Test public void kContainsFunc7() { final XQuery query = new XQuery( "not(contains(\"tattoo\", \"ttt\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `contains("", ())`. . */ @org.junit.Test public void kContainsFunc8() { final XQuery query = new XQuery( "contains(\"\", ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `contains("a string", ())`. . */ @org.junit.Test public void kContainsFunc9() { final XQuery query = new XQuery( "contains(\"a string\", ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Compare two values returned from fn:lower-case(). . */ @org.junit.Test public void k2ContainsFunc1() { final XQuery query = new XQuery( "let $vA := (\"B STRING\", current-time(), string(\"content\"))[1] treat as xs:string,\n" + " $vB := (\"b string\", current-time(), string(\"content\"))[1] treat as xs:string\n" + " return contains(lower-case($vA), lower-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Compare two values returned from fn:upper-case(). . */ @org.junit.Test public void k2ContainsFunc2() { final XQuery query = new XQuery( "let $vA := (\"B STRING\", current-time(), string(\"content\"))[1] treat as xs:string,\n" + " $vB := (\"b string\", current-time(), string(\"content\"))[1] treat as xs:string\n" + " return contains(upper-case($vA), upper-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Compare two non-matching values returned from fn:lower-case(). . */ @org.junit.Test public void k2ContainsFunc3() { final XQuery query = new XQuery( "let $vA := (\"B STRING\", current-time(), string(\"content\"))[1] treat as xs:string,\n" + " $vB := (\"no match\", current-time(), string(\"content\"))[1] treat as xs:string\n" + " return contains(lower-case($vA), lower-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Compare two non-matching values returned from fn:upper-case(). . */ @org.junit.Test public void k2ContainsFunc4() { final XQuery query = new XQuery( "let $vA := (\"B STRING\", current-time(), string(\"content\"))[1] treat as xs:string,\n" + " $vB := (\"no match\", current-time(), string(\"content\"))[1] treat as xs:string\n" + " return contains(upper-case($vA), upper-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Compare two non-matching values returned from fn:lower-case() and fn:upper-case(). . */ @org.junit.Test public void k2ContainsFunc5() { final XQuery query = new XQuery( "let $vA := (\"B STRING\", current-time(), string(\"content\"))[1] treat as xs:string,\n" + " $vB := (\"b string\", current-time(), string(\"content\"))[1] treat as xs:string\n" + " return contains(upper-case($vA), lower-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Compare two non-matching values returned from fn:lower-case() and fn:upper-case(). . */ @org.junit.Test public void k2ContainsFunc6() { final XQuery query = new XQuery( "let $vA := (\"B STRING\", current-time(), string(\"content\"))[1] treat as xs:string,\n" + " $vB := (\"b string\", current-time(), string(\"content\"))[1] treat as xs:string\n" + " return contains(lower-case($vA), upper-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:contains with collation and $arg2 as empty string . */ @org.junit.Test public void cbclContains001() { final XQuery query = new XQuery( "fn:boolean(fn:contains('input', '', 'http://www.w3.org/2005/xpath-functions/collation/codepoint'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:contains with collation and $arg1 as empty string Author: Tim Mills . */ @org.junit.Test public void cbclContains002() { final XQuery query = new XQuery( "fn:boolean(fn:contains('', 'empty', 'http://www.w3.org/2005/xpath-functions/collation/codepoint'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test evaluation of fn:contains to exactly one item Author: Tim Mills . */ @org.junit.Test public void cbclContains003() { final XQuery query = new XQuery( "fn:index-of( ( fn:true(), fn:false()), fn:contains('input', 'in', 'http://www.w3.org/2005/xpath-functions/collation/codepoint'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "contains" function with the arguments set as follows: $arg1 = "" $arg2 = "" . */ @org.junit.Test public void fnContains1() { final XQuery query = new XQuery( "fn:contains(\"\",\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "contains" function with the arguments set as follows: $arg1 = " " $arg2 = " AAAAABBBBB" . */ @org.junit.Test public void fnContains10() { final XQuery query = new XQuery( "fn:contains(\" \",\"AAAAABBBBB\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "contains" function using it as a argument of a fn:not - returns false . */ @org.junit.Test public void fnContains11() { final XQuery query = new XQuery( "fn:not(fn:contains(\"A\",\"A\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "contains" function using it as a argument of a fn:not - returns true . */ @org.junit.Test public void fnContains12() { final XQuery query = new XQuery( "fn:not(fn:contains(\"A\",\"B\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "contains" function with the arguments set as follows: $arg1 = xs:string("A") $arg2 = "A" . */ @org.junit.Test public void fnContains13() { final XQuery query = new XQuery( "fn:contains(xs:string(\"A\"),\"A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "contains" function with the arguments set as follows: $arg1 = "A" $arg2 = xs:string("A") . */ @org.junit.Test public void fnContains14() { final XQuery query = new XQuery( "fn:contains(\"A\",xs:string(\"A\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "contains" function with the arguments set as follows: $arg1 = "A" $arg2 = "a" . */ @org.junit.Test public void fnContains15() { final XQuery query = new XQuery( "fn:contains(\"A\",\"a\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "contains" function with the arguments set as follows: $arg1 = "a" $arg2 = "A" . */ @org.junit.Test public void fnContains16() { final XQuery query = new XQuery( "fn:contains(\"a\",\"A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "contains" function with the arguments set as follows: $arg1 = "" $arg2 = "A Character String" . */ @org.junit.Test public void fnContains2() { final XQuery query = new XQuery( "fn:contains(\"\",\"A Character String\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "contains" function with the arguments set as follows: $arg1 = "" $arg2 = "A Character String" . */ @org.junit.Test public void fnContains3() { final XQuery query = new XQuery( "fn:contains(\"A Character String\",\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "contains" function with the arguments set as follows: $arg1 = () $arg2 = "" . */ @org.junit.Test public void fnContains4() { final XQuery query = new XQuery( "fn:contains((),\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "contains" function with the arguments set as follows: $arg1 = "" $arg2 = () . */ @org.junit.Test public void fnContains5() { final XQuery query = new XQuery( "fn:contains(\"\",())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "contains" function with the arguments set as follows: $arg1 = "A Character String" $arg2 = () . */ @org.junit.Test public void fnContains6() { final XQuery query = new XQuery( "fn:contains(\"A Character String\",())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "contains" function with the arguments set as follows: $arg1 = () $arg2 = "A Character String" . */ @org.junit.Test public void fnContains7() { final XQuery query = new XQuery( "fn:contains((),\"A Character String\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "contains" function with the arguments set as follows: $arg1 = "AAAAABBBBBCCCCC" $arg2 = "BBBBB" . */ @org.junit.Test public void fnContains8() { final XQuery query = new XQuery( "fn:contains(\"AAAAABBBBBCCCCC\",\"BBBBB\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "contains" function with the arguments set as follows: $arg1 = "AAAAABBBBB" $arg2 = " " . */ @org.junit.Test public void fnContains9() { final XQuery query = new XQuery( "fn:contains(\"AAAAABBBBB\",\" \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "contains" function with the arguments set as follows: $arg1 = xs:string(lower bound) $arg2 = xs:string(lower bound) . */ @org.junit.Test public void fnContains2args1() { final XQuery query = new XQuery( "fn:contains(xs:string(\"This is a characte\"),xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "contains" function with the arguments set as follows: $arg1 = xs:string(mid range) $arg2 = xs:string(lower bound) . */ @org.junit.Test public void fnContains2args2() { final XQuery query = new XQuery( "fn:contains(xs:string(\"This is a characte\"),xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "contains" function with the arguments set as follows: $arg1 = xs:string(upper bound) $arg2 = xs:string(lower bound) . */ @org.junit.Test public void fnContains2args3() { final XQuery query = new XQuery( "fn:contains(xs:string(\"This is a characte\"),xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "contains" function with the arguments set as follows: $arg1 = xs:string(lower bound) $arg2 = xs:string(mid range) . */ @org.junit.Test public void fnContains2args4() { final XQuery query = new XQuery( "fn:contains(xs:string(\"This is a characte\"),xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "contains" function with the arguments set as follows: $arg1 = xs:string(lower bound) $arg2 = xs:string(upper bound) . */ @org.junit.Test public void fnContains2args5() { final XQuery query = new XQuery( "fn:contains(xs:string(\"This is a characte\"),xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnCount.java000066400000000000000000005413331222453003200263340ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the count() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnCount extends QT3TestSet { /** * count() applied to nodes (with optimization opportunities) . */ @org.junit.Test public void count001() { final XQuery query = new XQuery( "count(//employee[@name='John Doe 4']) = 1", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * count() applied to nodes (with optimization opportunities) . */ @org.junit.Test public void count002() { final XQuery query = new XQuery( "count(//employee[@name='John Doe 4']) < 2", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * count() applied to nodes (with optimization opportunities) . */ @org.junit.Test public void count003() { final XQuery query = new XQuery( "count(//employee[@name='John Doe 4']) > 0", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * count() applied to nodes (with optimization opportunities) . */ @org.junit.Test public void count004() { final XQuery query = new XQuery( "count(//employee[@name='John Doe 4']/@name) > 0.5", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * count() applied to nodes (with optimization opportunities) . */ @org.junit.Test public void count005() { final XQuery query = new XQuery( "count(//*[@name='John Doe 4']) lt 1.5", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * count() applied to nodes (with optimization opportunities) . */ @org.junit.Test public void count006() { final XQuery query = new XQuery( "count(//*[@name='John Doe 4']) eq 0", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * count() applied to nodes (with optimization opportunities) . */ @org.junit.Test public void count007() { final XQuery query = new XQuery( "count(//*[@name='John Doe 498']) eq 0", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * count() applied to nodes (with optimization opportunities) . */ @org.junit.Test public void count008() { final XQuery query = new XQuery( "count(//*[@name='John Doe 4']) lt 1000000000000", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * count() applied to nodes (with optimization opportunities) . */ @org.junit.Test public void count009() { final XQuery query = new XQuery( "count(//*[@name='John Doe 4']) gt -5", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * count() applied to nodes (with optimization opportunities) . */ @org.junit.Test public void count010() { final XQuery query = new XQuery( "count(//*[@name='John Doe 4']) eq 0.3", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * count() applied to nodes (with optimization opportunities) . */ @org.junit.Test public void count011() { final XQuery query = new XQuery( "count(//node()) gt 40", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * count() applied to nodes (with optimization opportunities) . */ @org.junit.Test public void count012() { final XQuery query = new XQuery( "count(//node()) ne -1", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * count() applied to nodes (with optimization opportunities) . */ @org.junit.Test public void count013() { final XQuery query = new XQuery( "0 = count(//node())", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * count() applied to nodes (with optimization opportunities) . */ @org.junit.Test public void count014() { final XQuery query = new XQuery( "40 gt count(//node())", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * A test whose essence is: `count()`. . */ @org.junit.Test public void kSeqCountFunc1() { final XQuery query = new XQuery( "count()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `count( ((), "one", 2, "three")) eq 3`. . */ @org.junit.Test public void kSeqCountFunc10() { final XQuery query = new XQuery( "count( ((), \"one\", 2, \"three\")) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count( ("one", (2, "three")) ) eq 3`. . */ @org.junit.Test public void kSeqCountFunc11() { final XQuery query = new XQuery( "count( (\"one\", (2, \"three\")) ) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count((1, 2)) eq 2`. . */ @org.junit.Test public void kSeqCountFunc12() { final XQuery query = new XQuery( "count((1, 2)) eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count((1, 2, 3, "four")) eq 4`. . */ @org.junit.Test public void kSeqCountFunc13() { final XQuery query = new XQuery( "count((1, 2, 3, \"four\")) eq 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count((1, 2, 3, "four")) eq 4`. . */ @org.junit.Test public void kSeqCountFunc14() { final XQuery query = new XQuery( "count((1, 2, 3, \"four\")) eq 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(1 to 3) eq 3`. . */ @org.junit.Test public void kSeqCountFunc15() { final XQuery query = new XQuery( "count(1 to 3) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(reverse((1, 2, 3))) eq 3`. . */ @org.junit.Test public void kSeqCountFunc16() { final XQuery query = new XQuery( "count(reverse((1, 2, 3))) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(reverse((1, 2, 3))) eq 3`. . */ @org.junit.Test public void kSeqCountFunc17() { final XQuery query = new XQuery( "count(reverse((1, 2, 3))) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(count((1, 2, current-time(), 4))) eq false()`. . */ @org.junit.Test public void kSeqCountFunc18() { final XQuery query = new XQuery( "not(count((1, 2, current-time(), 4))) eq false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(1, ())`. . */ @org.junit.Test public void kSeqCountFunc2() { final XQuery query = new XQuery( "count(1, ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `count( () ) eq 0`. . */ @org.junit.Test public void kSeqCountFunc3() { final XQuery query = new XQuery( "count( () ) eq 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count( (1, 2, 3) ) eq 3`. . */ @org.junit.Test public void kSeqCountFunc4() { final XQuery query = new XQuery( "count( (1, 2, 3) ) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count( (1, 2, ()) ) eq 2`. . */ @org.junit.Test public void kSeqCountFunc5() { final XQuery query = new XQuery( "count( (1, 2, ()) ) eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(()) eq 0`. . */ @org.junit.Test public void kSeqCountFunc6() { final XQuery query = new XQuery( "count(()) eq 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(((((()))))) eq 0`. . */ @org.junit.Test public void kSeqCountFunc7() { final XQuery query = new XQuery( "count(((((()))))) eq 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count( (((), (), ()), (), (), (), ()) ) eq 0`. . */ @org.junit.Test public void kSeqCountFunc8() { final XQuery query = new XQuery( "count( (((), (), ()), (), (), (), ()) ) eq 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count( (1, 2, 3) ) eq 3`. . */ @org.junit.Test public void kSeqCountFunc9() { final XQuery query = new XQuery( "count( (1, 2, 3) ) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:count() doesn't implicitly get the context node. . */ @org.junit.Test public void k2SeqCountFunc1() { final XQuery query = new XQuery( "(1 to 10)/count()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * test fn:count on a range . */ @org.junit.Test public void cbclCount001() { final XQuery query = new XQuery( "fn:count(1 to 10000000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10000000") ); } /** * test fn:count on a mix of values and expressions . */ @org.junit.Test public void cbclCount002() { final XQuery query = new XQuery( "declare function local:generate($arg as xs:integer?) { if ($arg = 0) then (1, 2, 3) else $arg }; fn:count( ( (), local:generate( () ), local:generate( 0 ), (1 to 10000000), local:generate( () ), local:generate(1)) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10000004") ); } /** * Test fn:count on a range . */ @org.junit.Test public void cbclCount003() { final XQuery query = new XQuery( "let $x := year-from-date(current-date()) return count( 1 to $x ) = $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount005() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) lt 25", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount006() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) le 25", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount007() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) eq 25", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount008() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ge 25", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount009() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) gt 25", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount010() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ne 25", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount011() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(100)) lt 25)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount012() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(100)) le 25)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount013() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(100)) eq 25)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount014() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(100)) ge 25)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount015() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(100)) gt 25)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount016() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(100)) ne 25)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount017() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; 25 lt count(local:primes(100))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount018() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; 25 le count(local:primes(100))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount019() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; 25 eq count(local:primes(100))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount020() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; 25 ge count(local:primes(100))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount021() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; 25 gt count(local:primes(100))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount022() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; 25 ne count(local:primes(100))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount023() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(25 lt count(local:primes(100)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount024() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(25 le count(local:primes(100)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount025() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(25 eq count(local:primes(100)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount026() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(25 ge count(local:primes(100)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount027() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(25 gt count(local:primes(100)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount028() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(25 ne count(local:primes(100)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount029() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:integer) { $n * $n }; count(local:primes(100)) lt local:square(5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount030() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:integer) { $n * $n }; count(local:primes(100)) le local:square(5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount031() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:integer) { $n * $n }; count(local:primes(100)) eq local:square(5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount032() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:integer) { $n * $n }; count(local:primes(100)) ge local:square(5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount033() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:integer) { $n * $n }; count(local:primes(100)) gt local:square(5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount034() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:integer) { $n * $n }; count(local:primes(100)) ne local:square(5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount035() { final XQuery query = new XQuery( "declare function local:primes($s as xs:integer, $n as xs:integer) { let $start := if ($s lt 2) then 2 else $s return for $i in $s to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(2, 100)) lt count(local:primes(100, 200))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount036() { final XQuery query = new XQuery( "declare function local:primes($s as xs:integer, $n as xs:integer) { let $start := if ($s lt 2) then 2 else $s return for $i in $s to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(2, 100)) le count(local:primes(100, 200))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount037() { final XQuery query = new XQuery( "declare function local:primes($s as xs:integer, $n as xs:integer) { let $start := if ($s lt 2) then 2 else $s return for $i in $s to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(2, 100)) eq count(local:primes(100, 200))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount038() { final XQuery query = new XQuery( "declare function local:primes($s as xs:integer, $n as xs:integer) { let $start := if ($s lt 2) then 2 else $s return for $i in $s to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(2, 100)) ge count(local:primes(100, 200))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount039() { final XQuery query = new XQuery( "declare function local:primes($s as xs:integer, $n as xs:integer) { let $start := if ($s lt 2) then 2 else $s return for $i in $s to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(2, 100)) gt count(local:primes(100, 200))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount040() { final XQuery query = new XQuery( "declare function local:primes($s as xs:integer, $n as xs:integer) { let $start := if ($s lt 2) then 2 else $s return for $i in $s to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(2, 100)) ne count(local:primes(100, 200))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount041() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) lt -1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount042() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) le -1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount043() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) eq -1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount044() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ge -1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount045() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) gt -1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount046() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ne -1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount047() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:integer) { $n * $n }; count(local:primes(100)) lt -local:square(5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount048() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:integer) { $n * $n }; count(local:primes(100)) le -local:square(5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount049() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:integer) { $n * $n }; count(local:primes(100)) eq -local:square(5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount050() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:integer) { $n * $n }; count(local:primes(100)) ge -local:square(5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount051() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:integer) { $n * $n }; count(local:primes(100)) gt -local:square(5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount052() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:integer) { $n * $n }; count(local:primes(100)) ne -local:square(5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount053() { final XQuery query = new XQuery( "declare function local:primes($s as xs:integer, $n as xs:integer) { let $start := if ($s lt 2) then 2 else $s return for $i in $s to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(2, 100)) lt count(local:primes(100, 200)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount054() { final XQuery query = new XQuery( "declare function local:primes($s as xs:integer, $n as xs:integer) { let $start := if ($s lt 2) then 2 else $s return for $i in $s to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(2, 100)) le count(local:primes(100, 200)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount055() { final XQuery query = new XQuery( "declare function local:primes($s as xs:integer, $n as xs:integer) { let $start := if ($s lt 2) then 2 else $s return for $i in $s to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(2, 100)) eq count(local:primes(100, 200)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount056() { final XQuery query = new XQuery( "declare function local:primes($s as xs:integer, $n as xs:integer) { let $start := if ($s lt 2) then 2 else $s return for $i in $s to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(2, 100)) ge count(local:primes(100, 200)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount057() { final XQuery query = new XQuery( "declare function local:primes($s as xs:integer, $n as xs:integer) { let $start := if ($s lt 2) then 2 else $s return for $i in $s to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(2, 100)) gt count(local:primes(100, 200)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount058() { final XQuery query = new XQuery( "declare function local:primes($s as xs:integer, $n as xs:integer) { let $start := if ($s lt 2) then 2 else $s return for $i in $s to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(2, 100)) ne count(local:primes(100, 200)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount059() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) lt 25.5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount060() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) le 25.5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount061() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) eq 25.5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount062() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ge 25.5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount063() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) gt 25.5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount064() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ne 25.5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount065() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(100)) lt 25.5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount066() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(100)) le 25.5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount067() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(100)) eq 25.5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount068() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(100)) ge 25.5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount069() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(100)) gt 25.5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount070() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(100)) ne 25.5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount071() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; 24.5 lt count(local:primes(100))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount072() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; 24.5 le count(local:primes(100))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount073() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; 24.5 eq count(local:primes(100))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount074() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; 24.5 ge count(local:primes(100))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount075() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; 24.5 gt count(local:primes(100))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount076() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; 24.5 ne count(local:primes(100))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount077() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(24.5 lt count(local:primes(100)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount078() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(24.5 le count(local:primes(100)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount079() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(24.5 eq count(local:primes(100)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount080() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(24.5 ge count(local:primes(100)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount081() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(24.5 gt count(local:primes(100)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount082() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(24.5 ne count(local:primes(100)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount083() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:decimal) { $n * $n }; count(local:primes(100)) lt local:square(5.1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount084() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:decimal) { $n * $n }; count(local:primes(100)) le local:square(5.1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount085() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:decimal) { $n * $n }; count(local:primes(100)) eq local:square(5.1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount086() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:decimal) { $n * $n }; count(local:primes(100)) ge local:square(5.1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount087() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:decimal) { $n * $n }; count(local:primes(100)) gt local:square(5.1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount088() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:decimal) { $n * $n }; count(local:primes(100)) ne local:square(5.1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount089() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) lt -1.5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount090() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) le -1.5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount091() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) eq -1.5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount092() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ge -1.5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount093() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) gt -1.5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount094() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ne -1.5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount095() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:decimal) { $n * $n }; count(local:primes(100)) lt -local:square(5.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount096() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:decimal) { $n * $n }; count(local:primes(100)) le -local:square(5.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount097() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:decimal) { $n * $n }; count(local:primes(100)) eq -local:square(5.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount098() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:decimal) { $n * $n }; count(local:primes(100)) ge -local:square(5.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount099() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:decimal) { $n * $n }; count(local:primes(100)) gt -local:square(5.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount100() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:decimal) { $n * $n }; count(local:primes(100)) ne -local:square(5.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount101() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:decimal) { $n * $n }; count(local:primes(100)) ge 1.0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount102() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) lt xs:float(\"25.5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount103() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) le xs:float(\"25.5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount104() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) eq xs:float(\"25.5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount105() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ge xs:float(\"25.5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount106() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) gt xs:float(\"25.5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount107() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ne xs:float(\"25.5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount108() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(100)) lt xs:float(\"25.5\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount109() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(100)) le xs:float(\"25.5\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount110() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(100)) eq xs:float(\"25.5\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount111() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(100)) ge xs:float(\"25.5\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount112() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(100)) gt xs:float(\"25.5\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount113() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(100)) ne xs:float(\"25.5\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount114() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; xs:float(\"24.5\") lt count(local:primes(100))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount115() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; xs:float(\"24.5\") le count(local:primes(100))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount116() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; xs:float(\"24.5\") eq count(local:primes(100))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount117() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; xs:float(\"24.5\") ge count(local:primes(100))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount118() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; xs:float(\"24.5\") gt count(local:primes(100))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount119() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; xs:float(\"24.5\") ne count(local:primes(100))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount120() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(xs:float(\"24.5\") lt count(local:primes(100)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount121() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(xs:float(\"24.5\") le count(local:primes(100)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount122() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(xs:float(\"24.5\") eq count(local:primes(100)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount123() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(xs:float(\"24.5\") ge count(local:primes(100)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount124() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(xs:float(\"24.5\") gt count(local:primes(100)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount125() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(xs:float(\"24.5\") ne count(local:primes(100)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount126() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:float) { $n * $n }; count(local:primes(100)) lt local:square(xs:float(\"4.9\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount127() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:float) { $n * $n }; count(local:primes(100)) le local:square(xs:float(\"4.9\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount128() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:float) { $n * $n }; count(local:primes(100)) eq local:square(xs:float(\"4.9\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount129() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:float) { $n * $n }; count(local:primes(100)) ge local:square(xs:float(\"4.9\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount130() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:float) { $n * $n }; count(local:primes(100)) gt local:square(xs:float(\"4.9\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount131() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:float) { $n * $n }; count(local:primes(100)) ne local:square(xs:float(\"4.9\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount132() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) lt xs:float(\"-1.5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount133() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) le xs:float(\"-1.5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount134() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) eq xs:float(\"-1.5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount135() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ge xs:float(\"-1.5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount136() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) gt xs:float(\"-1.5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount137() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ne xs:float(\"-1.5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount138() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:float) { $n * $n }; count(local:primes(100)) lt -local:square(5.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount139() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:float) { $n * $n }; count(local:primes(100)) le -local:square(5.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount140() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:float) { $n * $n }; count(local:primes(100)) eq -local:square(5.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount141() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:float) { $n * $n }; count(local:primes(100)) ge -local:square(5.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount142() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:float) { $n * $n }; count(local:primes(100)) gt -local:square(5.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount143() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:float) { $n * $n }; count(local:primes(100)) ne -local:square(5.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount144() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ge xs:float(\"1.0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount145() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) lt xs:double(\"25.5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount146() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) le xs:double(\"25.5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount147() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) eq xs:double(\"25.5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount148() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ge xs:double(\"25.5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount149() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) gt xs:double(\"25.5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount150() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ne xs:double(\"25.5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount151() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(100)) lt xs:double(\"25.5\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount152() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(100)) le xs:double(\"25.5\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount153() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(100)) eq xs:double(\"25.5\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount154() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(100)) ge xs:double(\"25.5\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount155() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(100)) gt xs:double(\"25.5\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount156() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(count(local:primes(100)) ne xs:double(\"25.5\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount157() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; xs:double(\"24.5\") lt count(local:primes(100))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount158() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; xs:double(\"24.5\") le count(local:primes(100))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount159() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; xs:double(\"24.5\") eq count(local:primes(100))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount160() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; xs:double(\"24.5\") ge count(local:primes(100))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount161() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; xs:double(\"24.5\") gt count(local:primes(100))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount162() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; xs:double(\"24.5\") ne count(local:primes(100))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount163() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(xs:double(\"24.5\") lt count(local:primes(100)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount164() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(xs:double(\"24.5\") le count(local:primes(100)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount165() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(xs:double(\"24.5\") eq count(local:primes(100)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount166() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(xs:double(\"24.5\") ge count(local:primes(100)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount167() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(xs:double(\"24.5\") gt count(local:primes(100)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount168() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; not(xs:double(\"24.5\") ne count(local:primes(100)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount169() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:double) { $n * $n }; count(local:primes(100)) lt local:square(xs:double(\"4.9\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount170() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:double) { $n * $n }; count(local:primes(100)) le local:square(xs:double(\"4.9\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount171() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:double) { $n * $n }; count(local:primes(100)) eq local:square(xs:double(\"4.9\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount172() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:double) { $n * $n }; count(local:primes(100)) ge local:square(xs:double(\"4.9\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount173() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:double) { $n * $n }; count(local:primes(100)) gt local:square(xs:double(\"4.9\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount174() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:double) { $n * $n }; count(local:primes(100)) ne local:square(xs:double(\"4.9\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount175() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) lt xs:double(\"-1.5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount176() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) le xs:double(\"-1.5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount177() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) eq xs:double(\"-1.5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount178() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ge xs:double(\"-1.5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount179() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) gt xs:double(\"-1.5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount180() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ne xs:double(\"-1.5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount181() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:double) { $n * $n }; count(local:primes(100)) lt -local:square(5.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount182() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:double) { $n * $n }; count(local:primes(100)) le -local:square(5.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount183() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:double) { $n * $n }; count(local:primes(100)) eq -local:square(5.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount184() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:double) { $n * $n }; count(local:primes(100)) ge -local:square(5.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount185() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:double) { $n * $n }; count(local:primes(100)) gt -local:square(5.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount186() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:square($n as xs:double) { $n * $n }; count(local:primes(100)) ne -local:square(5.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount187() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ge xs:double(\"1.0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount188() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ge 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount189() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) lt xs:double(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount190() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) le xs:double(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount191() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) eq xs:double(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount192() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ge xs:double(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount193() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) gt xs:double(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount194() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ne xs:double(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount195() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) lt xs:double(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount196() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) le xs:double(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount197() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) eq xs:double(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount198() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ge xs:double(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount199() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) gt xs:double(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount200() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ne xs:double(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount201() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) lt xs:float(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount202() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) le xs:float(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount203() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) eq xs:float(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount204() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ge xs:float(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount205() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) gt xs:float(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount206() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ne xs:float(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount207() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) lt xs:float(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount208() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) le xs:float(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount209() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) eq xs:float(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount210() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ge xs:float(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount211() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) gt xs:float(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount212() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ne xs:float(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount213() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:strange($n as xs:boolean) as xs:double { if ($n) then xs:double('NaN') else xs:double('INF') }; count(local:primes(100)) lt local:strange(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount214() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:strange($n as xs:boolean) as xs:double { if ($n) then xs:double('NaN') else xs:double('INF') }; count(local:primes(100)) le local:strange(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount215() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:strange($n as xs:boolean) as xs:double { if ($n) then xs:double('NaN') else xs:double('INF') }; count(local:primes(100)) eq local:strange(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount216() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:strange($n as xs:boolean) as xs:double { if ($n) then xs:double('NaN') else xs:double('INF') }; count(local:primes(100)) ge local:strange(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount217() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:strange($n as xs:boolean) as xs:double { if ($n) then xs:double('NaN') else xs:double('INF') }; count(local:primes(100)) gt local:strange(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount218() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:strange($n as xs:boolean) as xs:double { if ($n) then xs:double('NaN') else xs:double('INF') }; count(local:primes(100)) ne local:strange(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount219() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:strange($n as xs:boolean) as xs:double { if ($n) then xs:double('NaN') else xs:double('INF') }; count(local:primes(100)) lt local:strange(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount220() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:strange($n as xs:boolean) as xs:double { if ($n) then xs:double('NaN') else xs:double('INF') }; count(local:primes(100)) le local:strange(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount221() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:strange($n as xs:boolean) as xs:double { if ($n) then xs:double('NaN') else xs:double('INF') }; count(local:primes(100)) eq local:strange(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount222() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:strange($n as xs:boolean) as xs:double { if ($n) then xs:double('NaN') else xs:double('INF') }; count(local:primes(100)) ge local:strange(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount223() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:strange($n as xs:boolean) as xs:double { if ($n) then xs:double('NaN') else xs:double('INF') }; count(local:primes(100)) gt local:strange(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount224() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:strange($n as xs:boolean) as xs:double { if ($n) then xs:double('NaN') else xs:double('INF') }; count(local:primes(100)) ne local:strange(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount225() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:strange($n as xs:boolean) as xs:float { if ($n) then xs:float('NaN') else xs:float('INF') }; count(local:primes(100)) lt local:strange(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount226() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:strange($n as xs:boolean) as xs:float { if ($n) then xs:float('NaN') else xs:float('INF') }; count(local:primes(100)) le local:strange(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount227() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:strange($n as xs:boolean) as xs:float { if ($n) then xs:float('NaN') else xs:float('INF') }; count(local:primes(100)) eq local:strange(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount228() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:strange($n as xs:boolean) as xs:float { if ($n) then xs:float('NaN') else xs:float('INF') }; count(local:primes(100)) ge local:strange(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount229() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:strange($n as xs:boolean) as xs:float { if ($n) then xs:float('NaN') else xs:float('INF') }; count(local:primes(100)) gt local:strange(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount230() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:strange($n as xs:boolean) as xs:float { if ($n) then xs:float('NaN') else xs:float('INF') }; count(local:primes(100)) ne local:strange(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount231() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:strange($n as xs:boolean) as xs:float { if ($n) then xs:float('NaN') else xs:float('INF') }; count(local:primes(100)) lt local:strange(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount232() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:strange($n as xs:boolean) as xs:float { if ($n) then xs:float('NaN') else xs:float('INF') }; count(local:primes(100)) le local:strange(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount233() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:strange($n as xs:boolean) as xs:float { if ($n) then xs:float('NaN') else xs:float('INF') }; count(local:primes(100)) eq local:strange(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount234() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:strange($n as xs:boolean) as xs:float { if ($n) then xs:float('NaN') else xs:float('INF') }; count(local:primes(100)) ge local:strange(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount235() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:strange($n as xs:boolean) as xs:float { if ($n) then xs:float('NaN') else xs:float('INF') }; count(local:primes(100)) gt local:strange(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount236() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; declare function local:strange($n as xs:boolean) as xs:float { if ($n) then xs:float('NaN') else xs:float('INF') }; count(local:primes(100)) ne local:strange(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Tests a count of initial subsequence . */ @org.junit.Test public void cbclCount237() { final XQuery query = new XQuery( "count((for $x in 1 to 10 return $x * $x)[position() < 3])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * test fn:count . */ @org.junit.Test public void cbclCount238() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) lt -1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount239() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) le -1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount240() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) eq -1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount241() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ge -1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount242() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) gt -1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount243() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ne -1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:count . */ @org.junit.Test public void cbclCount244() { final XQuery query = new XQuery( "declare function local:primes($n as xs:integer) { if ($n lt 2) then 1 else for $i in 2 to $n return if (every $x in 2 to ($i - 1) satisfies ($i mod $x ne 0)) then $i else () }; count(local:primes(100)) ge 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:double(lower bound) . */ @org.junit.Test public void fnCountdbl1args1() { final XQuery query = new XQuery( "fn:count((xs:double(\"-1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:double(mid range) . */ @org.junit.Test public void fnCountdbl1args2() { final XQuery query = new XQuery( "fn:count((xs:double(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:double(upper bound) . */ @org.junit.Test public void fnCountdbl1args3() { final XQuery query = new XQuery( "fn:count((xs:double(\"1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:decimal(lower bound) . */ @org.junit.Test public void fnCountdec1args1() { final XQuery query = new XQuery( "fn:count((xs:decimal(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:decimal(mid range) . */ @org.junit.Test public void fnCountdec1args2() { final XQuery query = new XQuery( "fn:count((xs:decimal(\"617375191608514839\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:decimal(upper bound) . */ @org.junit.Test public void fnCountdec1args3() { final XQuery query = new XQuery( "fn:count((xs:decimal(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:float(lower bound) . */ @org.junit.Test public void fnCountflt1args1() { final XQuery query = new XQuery( "fn:count((xs:float(\"-3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:float(mid range) . */ @org.junit.Test public void fnCountflt1args2() { final XQuery query = new XQuery( "fn:count((xs:float(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:float(upper bound) . */ @org.junit.Test public void fnCountflt1args3() { final XQuery query = new XQuery( "fn:count((xs:float(\"3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:int(lower bound) . */ @org.junit.Test public void fnCountint1args1() { final XQuery query = new XQuery( "fn:count((xs:int(\"-2147483648\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:int(mid range) . */ @org.junit.Test public void fnCountint1args2() { final XQuery query = new XQuery( "fn:count((xs:int(\"-1873914410\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:int(upper bound) . */ @org.junit.Test public void fnCountint1args3() { final XQuery query = new XQuery( "fn:count((xs:int(\"2147483647\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:integer(lower bound) . */ @org.junit.Test public void fnCountintg1args1() { final XQuery query = new XQuery( "fn:count((xs:integer(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:integer(mid range) . */ @org.junit.Test public void fnCountintg1args2() { final XQuery query = new XQuery( "fn:count((xs:integer(\"830993497117024304\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:integer(upper bound) . */ @org.junit.Test public void fnCountintg1args3() { final XQuery query = new XQuery( "fn:count((xs:integer(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:long(lower bound) . */ @org.junit.Test public void fnCountlng1args1() { final XQuery query = new XQuery( "fn:count((xs:long(\"-92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:long(mid range) . */ @org.junit.Test public void fnCountlng1args2() { final XQuery query = new XQuery( "fn:count((xs:long(\"-47175562203048468\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:long(upper bound) . */ @org.junit.Test public void fnCountlng1args3() { final XQuery query = new XQuery( "fn:count((xs:long(\"92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnCountnint1args1() { final XQuery query = new XQuery( "fn:count((xs:negativeInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnCountnint1args2() { final XQuery query = new XQuery( "fn:count((xs:negativeInteger(\"-297014075999096793\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnCountnint1args3() { final XQuery query = new XQuery( "fn:count((xs:negativeInteger(\"-1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnCountnni1args1() { final XQuery query = new XQuery( "fn:count((xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnCountnni1args2() { final XQuery query = new XQuery( "fn:count((xs:nonNegativeInteger(\"303884545991464527\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnCountnni1args3() { final XQuery query = new XQuery( "fn:count((xs:nonNegativeInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnCountnpi1args1() { final XQuery query = new XQuery( "fn:count((xs:nonPositiveInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnCountnpi1args2() { final XQuery query = new XQuery( "fn:count((xs:nonPositiveInteger(\"-475688437271870490\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnCountnpi1args3() { final XQuery query = new XQuery( "fn:count((xs:nonPositiveInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnCountpint1args1() { final XQuery query = new XQuery( "fn:count((xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnCountpint1args2() { final XQuery query = new XQuery( "fn:count((xs:positiveInteger(\"52704602390610033\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnCountpint1args3() { final XQuery query = new XQuery( "fn:count((xs:positiveInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:short(lower bound) . */ @org.junit.Test public void fnCountsht1args1() { final XQuery query = new XQuery( "fn:count((xs:short(\"-32768\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:short(mid range) . */ @org.junit.Test public void fnCountsht1args2() { final XQuery query = new XQuery( "fn:count((xs:short(\"-5324\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:short(upper bound) . */ @org.junit.Test public void fnCountsht1args3() { final XQuery query = new XQuery( "fn:count((xs:short(\"32767\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnCountulng1args1() { final XQuery query = new XQuery( "fn:count((xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnCountulng1args2() { final XQuery query = new XQuery( "fn:count((xs:unsignedLong(\"130747108607674654\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnCountulng1args3() { final XQuery query = new XQuery( "fn:count((xs:unsignedLong(\"184467440737095516\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnCountusht1args1() { final XQuery query = new XQuery( "fn:count((xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnCountusht1args2() { final XQuery query = new XQuery( "fn:count((xs:unsignedShort(\"44633\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "count" function with the arguments set as follows: $arg = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnCountusht1args3() { final XQuery query = new XQuery( "fn:count((xs:unsignedShort(\"65535\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnCurrentDate.java000066400000000000000000000306571222453003200274660ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the current-date() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnCurrentDate extends QT3TestSet { /** * A test whose essence is: `current-date("WRONG PARAM")`. . */ @org.junit.Test public void kContextCurrentDateFunc1() { final XQuery query = new XQuery( "current-date(\"WRONG PARAM\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Test that the Dynamic Context property 'current dateTime' when presented as a xs:date is stable during execution. . */ @org.junit.Test public void kContextCurrentDateFunc2() { final XQuery query = new XQuery( "current-date() eq current-date()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates a simple call to the fn:current-date" function. Uses a String Value. . */ @org.junit.Test public void fnCurrentDate1() { final XQuery query = new XQuery( "fn:current-date()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:date") ); } /** * Evaluates The "current-date" function as an argument to the xs:string function. . */ @org.junit.Test public void fnCurrentDate10() { final XQuery query = new XQuery( "xs:string(fn:current-date())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:string") ); } /** * Evaluates The "current-date" function as an argument to the timezone-from-date function. . */ @org.junit.Test public void fnCurrentDate11() { final XQuery query = new XQuery( "fn:timezone-from-date(current-date())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:dayTimeDuration") ); } /** * Evaluates string value The "current-date" as part of an equal expression (eq operator) . */ @org.junit.Test public void fnCurrentDate12() { final XQuery query = new XQuery( "fn:string(fn:current-date()) eq fn:string(fn:current-date())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "current-date" function as part of an equal expression (ne operator) . */ @org.junit.Test public void fnCurrentDate13() { final XQuery query = new XQuery( "fn:string(fn:current-date()) ne fn:string(fn:current-date())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "current-date" function as part of an equal expression (le operator) . */ @org.junit.Test public void fnCurrentDate14() { final XQuery query = new XQuery( "fn:string(fn:current-date()) le fn:string(fn:current-date())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "current-date" function as part of an equal expression (ge operator) . */ @org.junit.Test public void fnCurrentDate15() { final XQuery query = new XQuery( "fn:string(fn:current-date()) ge fn:string(fn:current-date())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "current-date" function as part of a boolean expression ("and" operator and fn:true function. . */ @org.junit.Test public void fnCurrentDate16() { final XQuery query = new XQuery( "fn:string(fn:current-date()) and fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "current-date" function as part of a boolean expression ("and" operator and fn:false function. . */ @org.junit.Test public void fnCurrentDate17() { final XQuery query = new XQuery( "fn:string(fn:current-date()) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "current-date" function as part of a boolean expression ("or" operator and fn:true function. . */ @org.junit.Test public void fnCurrentDate18() { final XQuery query = new XQuery( "fn:string(fn:current-date()) or fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "current-date" function as part of a boolean expression ("or" operator and fn:false function. . */ @org.junit.Test public void fnCurrentDate19() { final XQuery query = new XQuery( "fn:string(fn:current-date()) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "current-date" function as argument to fn:hours-from-date function. . */ @org.junit.Test public void fnCurrentDate2() { final XQuery query = new XQuery( "fn:year-from-date(fn:current-date())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:integer") ); } /** * Evaluates The "current-date" function (string value)as an argument to the fn:not function. . */ @org.junit.Test public void fnCurrentDate20() { final XQuery query = new XQuery( "fn:not(fn:string(fn:current-date()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "fn-current-date" function used as part of a "-" operation and a yearMonthDuration. . */ @org.junit.Test public void fnCurrentDate21() { final XQuery query = new XQuery( "fn:current-date() - xs:yearMonthDuration(\"P1Y2M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:date") ); } /** * Test that current date is after 1 Jan 2010. */ @org.junit.Test public void fnCurrentDate22() { final XQuery query = new XQuery( "fn:current-date() gt xs:date('2010-01-01')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that current date has a timezone. */ @org.junit.Test public void fnCurrentDate23() { final XQuery query = new XQuery( "exists(timezone-from-date(current-date()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "current-date" function as argument to fn-month-from-date function. . */ @org.junit.Test public void fnCurrentDate3() { final XQuery query = new XQuery( "fn:month-from-date(fn:current-date())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:integer") ); } /** * Evaluates The "current-date" function used as as argument to "day-from-date" function. . */ @org.junit.Test public void fnCurrentDate4() { final XQuery query = new XQuery( "fn:day-from-date(fn:current-date())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:integer") ); } /** * Evaluates The "current-date" function as part of a "-" operation. . */ @org.junit.Test public void fnCurrentDate5() { final XQuery query = new XQuery( "fn:current-date() - fn:current-date()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Evaluates The "fn-current-date" function used as part of a "+" expression and a dayTimeDuration. . */ @org.junit.Test public void fnCurrentDate6() { final XQuery query = new XQuery( "fn:current-date() + xs:dayTimeDuration(\"P3DT1H15M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:date") ); } /** * Evaluates The "fn-current-date" function used as part of a "-" expression and a dayTimeDuration. . */ @org.junit.Test public void fnCurrentDate7() { final XQuery query = new XQuery( "fn:current-date() - xs:dayTimeDuration(\"P3DT1H15M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:date") ); } /** * Evaluates The "current-date" function invoked with incorrect arity. . */ @org.junit.Test public void fnCurrentDate8() { final XQuery query = new XQuery( "fn:current-date(\"Argument 1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Evaluates The "current-date" function as part of of a subtraction expression. Both operands are the equal to "current-time". . */ @org.junit.Test public void fnCurrentDate9() { final XQuery query = new XQuery( "fn:current-date() - fn:current-date()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Test that the current date is the same as the date part of current dateTime. */ @org.junit.Test public void fnCurrentTime24() { final XQuery query = new XQuery( "current-date() = xs:date(current-dateTime())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnCurrentDateTime.java000066400000000000000000000340051222453003200302740ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the current-dateTime() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnCurrentDateTime extends QT3TestSet { /** * A test whose essence is: `current-dateTime("WRONG PARAM")`. . */ @org.junit.Test public void kContextCurrentDatetimeFunc1() { final XQuery query = new XQuery( "current-dateTime(\"WRONG PARAM\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Test that the Dynamic Context property 'current dateTime' when presented as a xs:dateTime is stable during execution. . */ @org.junit.Test public void kContextCurrentDatetimeFunc2() { final XQuery query = new XQuery( "current-dateTime() eq current-dateTime()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * dateTime: December 1, 2005 Evaluates a simple call to the fn:current-dateTime" function. Uses a String Value. . */ @org.junit.Test public void fnCurrentDateTime1() { final XQuery query = new XQuery( "fn:current-dateTime()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:dateTime") ); } /** * dateTime: December 5, 2005 Evaluates The "current-dateTime" function as an argument to the xs:string function. . */ @org.junit.Test public void fnCurrentDateTime10() { final XQuery query = new XQuery( "xs:string(fn:current-dateTime())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:string") ); } /** * dateTime: December 5, 2005 Evaluates The "current-dateTime" function as an argument to the timezone-from-dateTime function. . */ @org.junit.Test public void fnCurrentDateTime11() { final XQuery query = new XQuery( "fn:timezone-from-dateTime(current-dateTime())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:dayTimeDuration") ); } /** * dateTime: December 5, 2005 Evaluates string value The "current-dateTime" as part of an equal expression (eq operator) . */ @org.junit.Test public void fnCurrentDateTime12() { final XQuery query = new XQuery( "fn:string(fn:current-dateTime()) eq fn:string(fn:current-dateTime())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * dateTime: December 5, 2005 Evaluates The "current-dateTime" function as part of an equal expression (ne operator) . */ @org.junit.Test public void fnCurrentDateTime13() { final XQuery query = new XQuery( "fn:string(fn:current-dateTime()) ne fn:string(fn:current-dateTime())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * dateTime: December 5, 2005 Evaluates The "current-dateTime" function as part of an equal expression (le operator) . */ @org.junit.Test public void fnCurrentDateTime14() { final XQuery query = new XQuery( "fn:string(fn:current-dateTime()) le fn:string(fn:current-dateTime())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * dateTime: December 5, 2005 Evaluates The "current-dateTime" function as part of an equal expression (ge operator) . */ @org.junit.Test public void fnCurrentDateTime15() { final XQuery query = new XQuery( "fn:string(fn:current-dateTime()) ge fn:string(fn:current-dateTime())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * dateTime: December 5, 2005 Evaluates The "current-dateTime" function as part of a boolean expression ("and" operator and fn:true function. . */ @org.junit.Test public void fnCurrentDateTime16() { final XQuery query = new XQuery( "fn:string(fn:current-dateTime()) and fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * dateTime: December 5, 2005 Evaluates The "current-dateTime" function as part of a boolean expression ("and" operator and fn:false function. . */ @org.junit.Test public void fnCurrentDateTime17() { final XQuery query = new XQuery( "fn:string(fn:current-dateTime()) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * dateTime: December 5, 2005 Evaluates The "current-dateTime" function as part of a boolean expression ("or" operator and fn:true function. . */ @org.junit.Test public void fnCurrentDateTime18() { final XQuery query = new XQuery( "fn:string(fn:current-dateTime()) or fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * dateTime: December 5, 2005 Evaluates The "current-dateTime" function as part of a boolean expression ("or" operator and fn:false function. . */ @org.junit.Test public void fnCurrentDateTime19() { final XQuery query = new XQuery( "fn:string(fn:current-dateTime()) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * dateTime: December 1, 2005 Evaluates The "current-dateTime" function as argument to fn:year-from-dateTime function. . */ @org.junit.Test public void fnCurrentDateTime2() { final XQuery query = new XQuery( "fn:year-from-dateTime(fn:current-dateTime())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:integer") ); } /** * dateTime: December 5, 2005 Evaluates The "current-dateTime" function (string value)as an argument to the fn:not function. . */ @org.junit.Test public void fnCurrentDateTime20() { final XQuery query = new XQuery( "fn:not(fn:string(fn:current-dateTime()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * dateTime: December 5, 2005 Evaluates The "fn-current-dateTime" function used as part of a "-" operation and a yearMonthDuration. . */ @org.junit.Test public void fnCurrentDateTime21() { final XQuery query = new XQuery( "fn:current-dateTime() - xs:yearMonthDuration(\"P1Y2M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:dateTime") ); } /** * dateTime: December 1, 2005 Evaluates The "current-dateTime" function as argument to fn:hours-from-dateTime function. . */ @org.junit.Test public void fnCurrentDateTime22() { final XQuery query = new XQuery( "fn:hours-from-dateTime(fn:current-dateTime())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:integer") ); } /** * dateTime: December 1, 2005 Evaluates The "current-dateTime" function as argument to fn-minutes-from-dateTime function. . */ @org.junit.Test public void fnCurrentDateTime23() { final XQuery query = new XQuery( "fn:minutes-from-dateTime(fn:current-dateTime())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:integer") ); } /** * dateTime: December 1, 2005 Evaluates The "current-dateTime" function used as as argument to "seconds-from-dateTime" function . */ @org.junit.Test public void fnCurrentDateTime24() { final XQuery query = new XQuery( "fn:seconds-from-dateTime(fn:current-dateTime())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:decimal") ); } /** * Test that the current dateTime has a timezone. */ @org.junit.Test public void fnCurrentDateTime25() { final XQuery query = new XQuery( "exists(timezone-from-dateTime(current-dateTime()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * dateTime: December 1, 2005 Evaluates The "current-dateTime" function as argument to fn-month-from-dateTime function. . */ @org.junit.Test public void fnCurrentDateTime3() { final XQuery query = new XQuery( "fn:month-from-dateTime(fn:current-dateTime())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:integer") ); } /** * dateTime: December 1, 2005 Evaluates The "current-dateTime" function used as as argument to "day-from-dateTime" function . */ @org.junit.Test public void fnCurrentDateTime4() { final XQuery query = new XQuery( "fn:day-from-dateTime(fn:current-dateTime())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:integer") ); } /** * dateTime: December 1, 2005 Evaluates The "current-dateTime" function as part of a "-" operation. . */ @org.junit.Test public void fnCurrentDateTime5() { final XQuery query = new XQuery( "fn:current-dateTime() - fn:current-dateTime()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * dateTime: December 5, 2005 Evaluates The "fn-current-dateTime" function used as part of a "+" expression and a dayTimeDuration. . */ @org.junit.Test public void fnCurrentDateTime6() { final XQuery query = new XQuery( "fn:current-dateTime() + xs:dayTimeDuration(\"P3DT1H15M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:dateTime") ); } /** * dateTime: December 5, 2005 Evaluates The "current-dateTime" function invoked with incorrect arity. . */ @org.junit.Test public void fnCurrentDateTime8() { final XQuery query = new XQuery( "fn:current-dateTime(\"Argument 1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * dateTime: December 5, 2005 Evaluates The "current-dateTime" function as part of of a subtraction expression. Both operands are the equal to "current-dateTime". . */ @org.junit.Test public void fnCurrentDateTime9() { final XQuery query = new XQuery( "fn:current-dateTime() - fn:current-dateTime()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * dateTime: December 5, 2005 Evaluates The "fn-current-dateTime" function used as part of a "-" expression and a dayTimeDuration. . */ @org.junit.Test public void fnCurrentDatetime7() { final XQuery query = new XQuery( "fn:current-dateTime() - xs:dayTimeDuration(\"P3DT1H15M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:dateTime") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnCurrentTime.java000066400000000000000000000270511222453003200275010ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the current-time() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnCurrentTime extends QT3TestSet { /** * A test whose essence is: `current-time("WRONG PARAM")`. . */ @org.junit.Test public void kContextCurrentTimeFunc1() { final XQuery query = new XQuery( "current-time(\"WRONG PARAM\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Test that the Dynamic Context property 'current dateTime' when presented as a xs:time is stable during execution. . */ @org.junit.Test public void kContextCurrentTimeFunc2() { final XQuery query = new XQuery( "current-time() eq current-time()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates a simple call to the fn:current-time" function. Uses a String Value. . */ @org.junit.Test public void fnCurrentTime1() { final XQuery query = new XQuery( "fn:current-time()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:time") ); } /** * Evaluates The "current-time" function as an argument to the xs:string function. . */ @org.junit.Test public void fnCurrentTime10() { final XQuery query = new XQuery( "xs:string(fn:current-time())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:string") ); } /** * Evaluates The "current-time" function as an argument to the timezone-from-time function. . */ @org.junit.Test public void fnCurrentTime11() { final XQuery query = new XQuery( "fn:timezone-from-time(current-time())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:dayTimeDuration") ); } /** * Evaluates string value The "current-time" as part of a "numeric-equal" expression (eq operator) . */ @org.junit.Test public void fnCurrentTime12() { final XQuery query = new XQuery( "fn:string(fn:current-time()) eq fn:string(fn:current-time())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "current-time" function as part of an equal expression (ne operator) . */ @org.junit.Test public void fnCurrentTime13() { final XQuery query = new XQuery( "fn:string(fn:current-time()) ne fn:string(fn:current-time())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "current-time" function as part of an equal expression (le operator) . */ @org.junit.Test public void fnCurrentTime14() { final XQuery query = new XQuery( "fn:string(fn:current-time()) le fn:string(fn:current-time())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "current-time" function as part of an equal expression (ge operator) . */ @org.junit.Test public void fnCurrentTime15() { final XQuery query = new XQuery( "fn:string(fn:current-time()) ge fn:string(fn:current-time())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "current-time" function as part of a boolean expression ("and" opeartor and fn:true function. . */ @org.junit.Test public void fnCurrentTime16() { final XQuery query = new XQuery( "fn:string(fn:current-time()) and fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "current-time" function as part of a boolean expression ("and" opeartor and fn:false function. . */ @org.junit.Test public void fnCurrentTime17() { final XQuery query = new XQuery( "fn:string(fn:current-time()) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "current-time" function as part of a boolean expression ("or" opeartor and fn:true function. . */ @org.junit.Test public void fnCurrentTime18() { final XQuery query = new XQuery( "fn:string(fn:current-time()) or fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "current-time" function as part of a boolean expression ("or" opeartor and fn:false function. . */ @org.junit.Test public void fnCurrentTime19() { final XQuery query = new XQuery( "fn:string(fn:current-time()) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "current-time" function as argument to fn:hours-from-time function. . */ @org.junit.Test public void fnCurrentTime2() { final XQuery query = new XQuery( "fn:hours-from-time(fn:current-time())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:integer") ); } /** * Evaluates The "current-time" function (string value)as an argument to the fn:not function. . */ @org.junit.Test public void fnCurrentTime20() { final XQuery query = new XQuery( "fn:not(fn:string(fn:current-time()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test that the current time has a timezone. */ @org.junit.Test public void fnCurrentTime21() { final XQuery query = new XQuery( "exists(timezone-from-time(current-time()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that the current time is the same as the time part of current dateTime. */ @org.junit.Test public void fnCurrentTime22() { final XQuery query = new XQuery( "current-time() = xs:time(current-dateTime())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "current-time" function as argument to fn-minutes-from-time-function. . */ @org.junit.Test public void fnCurrentTime3() { final XQuery query = new XQuery( "fn:minutes-from-time(fn:current-time())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:integer") ); } /** * Evaluates The "current-time" function used as as argument to "seconds-from-time" function. . */ @org.junit.Test public void fnCurrentTime4() { final XQuery query = new XQuery( "fn:seconds-from-time(fn:current-time())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:decimal") ); } /** * Evaluates The "current-time" function as part of a "-" operation. . */ @org.junit.Test public void fnCurrentTime5() { final XQuery query = new XQuery( "fn:current-time() - fn:current-time()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Evaluates The "fn-current-time" function used as part of a "+" expression and a dayTimeDuration. . */ @org.junit.Test public void fnCurrentTime6() { final XQuery query = new XQuery( "fn:current-time() + xs:dayTimeDuration(\"P3DT1H15M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:time") ); } /** * Evaluates The "fn-current-time" function used as part of a "-" expression and a dayTimeDuration. . */ @org.junit.Test public void fnCurrentTime7() { final XQuery query = new XQuery( "fn:current-time() - xs:dayTimeDuration(\"P3DT1H15M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:time") ); } /** * Evaluates The "current-time" function invoked with incorrect arity. . */ @org.junit.Test public void fnCurrentTime8() { final XQuery query = new XQuery( "fn:current-time(\"Argument 1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Evaluates The "current-time" function as part of of a subtraction expression. Both operands are the equal to "current-time". . */ @org.junit.Test public void fnCurrentTime9() { final XQuery query = new XQuery( "fn:current-time() - fn:current-time()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnData.java000066400000000000000000000570061222453003200261140ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the data() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnData extends QT3TestSet { /** * A test whose essence is: `data()`. . */ @org.junit.Test public void kDataFunc1() { xquery10(); final XQuery query = new XQuery( "data()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `data(1, "wrong param")`. . */ @org.junit.Test public void kDataFunc2() { final XQuery query = new XQuery( "data(1, \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `count(data((1, 2, 3, 4, 5))) eq 5`. . */ @org.junit.Test public void kDataFunc3() { final XQuery query = new XQuery( "count(data((1, 2, 3, 4, 5))) eq 5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(data( () ))`. . */ @org.junit.Test public void kDataFunc4() { final XQuery query = new XQuery( "empty(data( () ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:data() allows zero arguments in XP30/XQ30. . */ @org.junit.Test public void k2DataFunc1() { final XQuery query = new XQuery( "1!data()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * fn:data() must be passed at most one argument. . */ @org.junit.Test public void k2DataFunc2() { final XQuery query = new XQuery( "data(1, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * fn:data() allows zero arguments in XP30/XQ30. . */ @org.junit.Test public void k2DataFunc3() { final XQuery query = new XQuery( "\n" + " \tlet $x := 1\n" + " \treturn $x/data()\n" + " \t\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "1") && assertType("xs:untypedAtomic") ) ); } /** * fn:data() allows zero arguments in XP30/XQ30. No context item. */ @org.junit.Test public void k2DataFunc4() { final XQuery query = new XQuery( "\n" + " \tdata()\n" + " \t\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * fn:data() allows zero arguments in XP30/XQ30. Context item is a function item. */ @org.junit.Test public void k2DataFunc5() { final XQuery query = new XQuery( "\n" + " \t(1, data#0)[data()]\n" + " \t\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOTY0013") ); } /** * test fn:data on fn:error Author: Tim Mills . */ @org.junit.Test public void cbclData001() { final XQuery query = new XQuery( "fn:data(fn:error()) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:double(lower bound) . */ @org.junit.Test public void fnDatadbl1args1() { final XQuery query = new XQuery( "fn:data((xs:double(\"-1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.7976931348623157E308") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:double(mid range) . */ @org.junit.Test public void fnDatadbl1args2() { final XQuery query = new XQuery( "fn:data((xs:double(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:double(upper bound) . */ @org.junit.Test public void fnDatadbl1args3() { final XQuery query = new XQuery( "fn:data((xs:double(\"1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.7976931348623157E308") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:decimal(lower bound) . */ @org.junit.Test public void fnDatadec1args1() { final XQuery query = new XQuery( "fn:data((xs:decimal(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:decimal(mid range) . */ @org.junit.Test public void fnDatadec1args2() { final XQuery query = new XQuery( "fn:data((xs:decimal(\"617375191608514839\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("617375191608514839") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:decimal(upper bound) . */ @org.junit.Test public void fnDatadec1args3() { final XQuery query = new XQuery( "fn:data((xs:decimal(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:float(lower bound) . */ @org.junit.Test public void fnDataflt1args1() { final XQuery query = new XQuery( "fn:data((xs:float(\"-3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-3.4028235E38") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:float(mid range) . */ @org.junit.Test public void fnDataflt1args2() { final XQuery query = new XQuery( "fn:data((xs:float(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:float(upper bound) . */ @org.junit.Test public void fnDataflt1args3() { final XQuery query = new XQuery( "fn:data((xs:float(\"3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3.4028235E38") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:int(lower bound) . */ @org.junit.Test public void fnDataint1args1() { final XQuery query = new XQuery( "fn:data((xs:int(\"-2147483648\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2147483648") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:int(mid range) . */ @org.junit.Test public void fnDataint1args2() { final XQuery query = new XQuery( "fn:data((xs:int(\"-1873914410\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1873914410") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:int(upper bound) . */ @org.junit.Test public void fnDataint1args3() { final XQuery query = new XQuery( "fn:data((xs:int(\"2147483647\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2147483647") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:integer(lower bound) . */ @org.junit.Test public void fnDataintg1args1() { final XQuery query = new XQuery( "fn:data((xs:integer(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:integer(mid range) . */ @org.junit.Test public void fnDataintg1args2() { final XQuery query = new XQuery( "fn:data((xs:integer(\"830993497117024304\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("830993497117024304") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:integer(upper bound) . */ @org.junit.Test public void fnDataintg1args3() { final XQuery query = new XQuery( "fn:data((xs:integer(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:long(lower bound) . */ @org.junit.Test public void fnDatalng1args1() { final XQuery query = new XQuery( "fn:data((xs:long(\"-92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:long(mid range) . */ @org.junit.Test public void fnDatalng1args2() { final XQuery query = new XQuery( "fn:data((xs:long(\"-47175562203048468\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-47175562203048468") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:long(upper bound) . */ @org.junit.Test public void fnDatalng1args3() { final XQuery query = new XQuery( "fn:data((xs:long(\"92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("92233720368547758") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnDatanint1args1() { final XQuery query = new XQuery( "fn:data((xs:negativeInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnDatanint1args2() { final XQuery query = new XQuery( "fn:data((xs:negativeInteger(\"-297014075999096793\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-297014075999096793") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnDatanint1args3() { final XQuery query = new XQuery( "fn:data((xs:negativeInteger(\"-1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnDatanni1args1() { final XQuery query = new XQuery( "fn:data((xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnDatanni1args2() { final XQuery query = new XQuery( "fn:data((xs:nonNegativeInteger(\"303884545991464527\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("303884545991464527") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnDatanni1args3() { final XQuery query = new XQuery( "fn:data((xs:nonNegativeInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnDatanpi1args1() { final XQuery query = new XQuery( "fn:data((xs:nonPositiveInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnDatanpi1args2() { final XQuery query = new XQuery( "fn:data((xs:nonPositiveInteger(\"-475688437271870490\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-475688437271870490") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnDatanpi1args3() { final XQuery query = new XQuery( "fn:data((xs:nonPositiveInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnDatapint1args1() { final XQuery query = new XQuery( "fn:data((xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnDatapint1args2() { final XQuery query = new XQuery( "fn:data((xs:positiveInteger(\"52704602390610033\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("52704602390610033") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnDatapint1args3() { final XQuery query = new XQuery( "fn:data((xs:positiveInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:short(lower bound) . */ @org.junit.Test public void fnDatasht1args1() { final XQuery query = new XQuery( "fn:data((xs:short(\"-32768\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-32768") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:short(mid range) . */ @org.junit.Test public void fnDatasht1args2() { final XQuery query = new XQuery( "fn:data((xs:short(\"-5324\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-5324") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:short(upper bound) . */ @org.junit.Test public void fnDatasht1args3() { final XQuery query = new XQuery( "fn:data((xs:short(\"32767\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("32767") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnDataulng1args1() { final XQuery query = new XQuery( "fn:data((xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnDataulng1args2() { final XQuery query = new XQuery( "fn:data((xs:unsignedLong(\"130747108607674654\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("130747108607674654") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnDataulng1args3() { final XQuery query = new XQuery( "fn:data((xs:unsignedLong(\"184467440737095516\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("184467440737095516") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnDatausht1args1() { final XQuery query = new XQuery( "fn:data((xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnDatausht1args2() { final XQuery query = new XQuery( "fn:data((xs:unsignedShort(\"44633\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("44633") ); } /** * Evaluates The "data" function with the arguments set as follows: $arg = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnDatausht1args3() { final XQuery query = new XQuery( "fn:data((xs:unsignedShort(\"65535\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("65535") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnDateTime.java000066400000000000000000000663761222453003200267510ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** . * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnDateTime extends QT3TestSet { /** * Passing too few parameters(none) to fn:dateTime().. */ @org.junit.Test public void kDateTimeFunc1() { final XQuery query = new XQuery( "dateTime()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Invoke fn:dateTime() with the first value having no timezone.. */ @org.junit.Test public void kDateTimeFunc10() { final XQuery query = new XQuery( "dateTime(xs:date(\"2004-03-04\"), xs:time(\"08:05:23-05:00\")) eq xs:dateTime(\"2004-03-04T08:05:23-05:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke fn:dateTime() with the second value having no timezone.. */ @org.junit.Test public void kDateTimeFunc11() { final XQuery query = new XQuery( "dateTime(xs:date(\"2004-03-04+11:00\"), xs:time(\"08:05:23\")) eq xs:dateTime(\"2004-03-04T08:05:23+11:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke fn:dateTime() with the time value being 24:00:00. . */ @org.junit.Test public void kDateTimeFunc12() { final XQuery query = new XQuery( "xs:string(dateTime(xs:date(\"1999-12-31\"), xs:time(\"24:00:00\"))) eq \"1999-12-31T00:00:00\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke fn:dateTime() with timezones being canonical UTC('Z').. */ @org.junit.Test public void kDateTimeFunc13() { final XQuery query = new XQuery( "dateTime(xs:date(\"2004-03-04Z\"), xs:time(\"08:05:23Z\")) eq xs:dateTime(\"2004-03-04T08:05:23Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke fn:dateTime() with the first value's timezone being canonical UTC('Z'). . */ @org.junit.Test public void kDateTimeFunc14() { final XQuery query = new XQuery( "dateTime(xs:date(\"2004-03-04Z\"), xs:time(\"08:05:23\")) eq xs:dateTime(\"2004-03-04T08:05:23Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke fn:dateTime() with the first value's timezone being an arbitrary value.. */ @org.junit.Test public void kDateTimeFunc15() { final XQuery query = new XQuery( "dateTime(xs:date(\"2004-03-04+13:07\"), xs:time(\"08:05:23\")) eq xs:dateTime(\"2004-03-04T08:05:23+13:07\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke fn:dateTime() with the second value's timezone being an arbitrary value.. */ @org.junit.Test public void kDateTimeFunc16() { final XQuery query = new XQuery( "dateTime(xs:date(\"2004-03-04\"), xs:time(\"08:05:23+13:07\")) eq xs:dateTime(\"2004-03-04T08:05:23+13:07\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke fn:dateTime() where none of its values has a timezone. . */ @org.junit.Test public void kDateTimeFunc17() { final XQuery query = new XQuery( "dateTime(xs:date(\"2004-03-04\"), xs:time(\"08:05:23\")) eq xs:dateTime(\"2004-03-04T08:05:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke fn:dateTime() with the first value's timezone being canonical UTC('Z'). . */ @org.junit.Test public void kDateTimeFunc18() { final XQuery query = new XQuery( "dateTime(xs:date(\"2004-03-04\"), xs:time(\"08:05:23Z\")) eq xs:dateTime(\"2004-03-04T08:05:23Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Passing too few parameters(only one) to fn:dateTime().. */ @org.junit.Test public void kDateTimeFunc2() { final XQuery query = new XQuery( "dateTime(xs:date(\"2004-03-04\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Passing too many parameters to fn:dateTime().. */ @org.junit.Test public void kDateTimeFunc3() { final XQuery query = new XQuery( "dateTime(xs:date(\"2004-03-04\"), xs:time(\"08:05:23\"), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Passing the empty sequence as second argument is allowed(recent change in the specification).. */ @org.junit.Test public void kDateTimeFunc4() { final XQuery query = new XQuery( "empty(dateTime(xs:date(\"2004-03-04\"), ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Passing the empty sequence as first argument is allowed(recent change in the specification). . */ @org.junit.Test public void kDateTimeFunc5() { final XQuery query = new XQuery( "empty(dateTime((), xs:time(\"08:05:23\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Passing different timezones to fn:dateTime() is an error. . */ @org.junit.Test public void kDateTimeFunc6() { final XQuery query = new XQuery( "dateTime(xs:date(\"2004-03-04-00:01\"), xs:time(\"08:05:23+00:01\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0008") ); } /** * Passing different timezones to fn:dateTime() is an error. . */ @org.junit.Test public void kDateTimeFunc7() { final XQuery query = new XQuery( "dateTime(xs:date(\"2004-03-04-00:01\"), xs:time(\"08:05:23Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0008") ); } /** * Invoke fn:dateTime() with timezones +00:00 and -00:00.. */ @org.junit.Test public void kDateTimeFunc8() { final XQuery query = new XQuery( "dateTime(xs:date(\"2004-03-04-00:00\"), xs:time(\"08:05:23+00:00\")) eq xs:dateTime(\"2004-03-04T08:05:23Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke fn:dateTime() with identical timezones.. */ @org.junit.Test public void kDateTimeFunc9() { final XQuery query = new XQuery( "dateTime(xs:date(\"2004-03-04+11:00\"), xs:time(\"08:05:23+11:00\")) eq xs:dateTime(\"2004-03-04T08:05:23+11:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Passing the empty sequence as both arguments is allowed(recent change in the specification). . */ @org.junit.Test public void k2DateTimeFunc1() { final XQuery query = new XQuery( "empty(dateTime((), ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test evaluation of fn:dateTime to exactly one item Author: Tim Mills . */ @org.junit.Test public void cbclDateTime001() { final XQuery query = new XQuery( "fn:index-of( ( 'A', fn:current-dateTime(), 'B' ), fn:dateTime(fn:current-date(), fn:current-time()) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * test evaluation of fn:dateTime to exactly one item with invalid timezones . */ @org.junit.Test public void cbclDateTime002() { final XQuery query = new XQuery( "fn:index-of( ( 'A', fn:current-dateTime(), 'B' ), fn:dateTime(adjust-date-to-timezone(fn:current-date(), xs:dayTimeDuration(\"PT1H\")), adjust-time-to-timezone(fn:current-time(), xs:dayTimeDuration(\"PT2H\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0008") ); } /** * Evaluation of "fn:dateTime" function as per example 1 of the F & O Specs. for this function. * . */ @org.junit.Test public void fnDateTime1() { final XQuery query = new XQuery( "fn:dateTime(xs:date(\"1999-12-31\"), xs:time(\"12:00:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-12-31T12:00:00") ); } /** * Evaluation of "fn:dateTime" function together together with the op:dateTime-equal operator(ge). * . */ @org.junit.Test public void fnDateTime10() { final XQuery query = new XQuery( "fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\")) ge fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of "fn:dateTime" function together together with the op:dateTime-equal operator(lt). * . */ @org.junit.Test public void fnDateTime11() { final XQuery query = new XQuery( "fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\")) lt fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of "fn:dateTime" function together together with the op:dateTime-equal operator(le). * . */ @org.junit.Test public void fnDateTime12() { final XQuery query = new XQuery( "fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\")) le fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of "fn:dateTime" function together together with the op:dateTime-equal operator(gt). * . */ @org.junit.Test public void fnDateTime13() { final XQuery query = new XQuery( "fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\")) gt fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of "fn:dateTime" function together together with the op:dateTime-equal operator(ge). * . */ @org.junit.Test public void fnDateTime14() { final XQuery query = new XQuery( "fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\")) ge fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of "fn:dateTime" as an argument to the function "year-from-dateTime". * . */ @org.junit.Test public void fnDateTime15() { final XQuery query = new XQuery( "fn:year-from-dateTime(fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999") ); } /** * Evaluation of "fn:dateTime" as an argument to the function "month-from-dateTime". * . */ @org.junit.Test public void fnDateTime16() { final XQuery query = new XQuery( "fn:month-from-dateTime(fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12") ); } /** * Evaluation of "fn:dateTime" as an argument to the function "day-from-dateTime". * . */ @org.junit.Test public void fnDateTime17() { final XQuery query = new XQuery( "fn:day-from-dateTime(fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "31") ); } /** * Evaluation of "fn:dateTime" as an argument to the function "hours-from-dateTime". * . */ @org.junit.Test public void fnDateTime18() { final XQuery query = new XQuery( "fn:hours-from-dateTime(fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "23") ); } /** * Evaluation of "fn:dateTime" as an argument to the function "minutes-from-dateTime". * . */ @org.junit.Test public void fnDateTime19() { final XQuery query = new XQuery( "fn:minutes-from-dateTime(fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluation of "fn:dateTime" function as per example 2 of the F & O Specs. for this function. * . */ @org.junit.Test public void fnDateTime2() { final XQuery query = new XQuery( "fn:dateTime(xs:date(\"1999-12-31\"), xs:time(\"24:00:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-12-31T00:00:00") ); } /** * Evaluation of "fn:dateTime" as an argument to the function "seconds-from-dateTime". * . */ @org.junit.Test public void fnDateTime20() { final XQuery query = new XQuery( "fn:seconds-from-dateTime(fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluation of "fn:dateTime" as an argument to the function "timezone-from-dateTime". * . */ @org.junit.Test public void fnDateTime21() { final XQuery query = new XQuery( "fn:timezone-from-dateTime(fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT10H") ); } /** * Evaluation of "fn:dateTime" as an argument to the function "adjust-dateTime-to-timezone". * . */ @org.junit.Test public void fnDateTime22() { final XQuery query = new XQuery( "fn:adjust-dateTime-to-timezone(fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\")),xs:dayTimeDuration(\"PT10H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-12-31T23:00:00+10:00") ); } /** * Evaluation of "fn:dateTime" as part of a subtraction operation. * . */ @org.junit.Test public void fnDateTime23() { final XQuery query = new XQuery( "fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\")) - fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"22:00:00+10:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT1H") ); } /** * Evaluation of "fn:dateTime" used together with the "op:add-yearMonthDuration-to-dateTime" operator * . */ @org.junit.Test public void fnDateTime24() { final XQuery query = new XQuery( " fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\")) + xs:yearMonthDuration(\"P1Y2M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2001-02-28T23:00:00+10:00") ); } /** * Evaluation of "fn:dateTime" used together with the "op:add-dayTimeDuration-to-dateTime" operator * . */ @org.junit.Test public void fnDateTime25() { final XQuery query = new XQuery( " fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\")) + xs:dayTimeDuration(\"P3DT1H15M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2000-01-04T00:15:00+10:00") ); } /** * Evaluation of "fn:dateTime" used together with the "subtract-yearMonthDuration-from-dateTime" operator * . */ @org.junit.Test public void fnDateTime26() { final XQuery query = new XQuery( " fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\")) - xs:yearMonthDuration(\"P1Y2M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1998-10-31T23:00:00+10:00") ); } /** * Evaluation of "fn:dateTime" used together with the "subtract-dayTimeDuration-from-dateTime" operator * . */ @org.junit.Test public void fnDateTime27() { final XQuery query = new XQuery( " fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\")) - xs:dayTimeDuration(\"P3DT1H15M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-12-28T21:45:00+10:00") ); } /** * Evaluation of "fn:dateTime" where first argument is empty sequence * . */ @org.junit.Test public void fnDateTime28() { final XQuery query = new XQuery( " fn:count(fn:dateTime((), xs:time(\"23:00:00+10:00\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluation of "fn:dateTime" where second argument is empty sequence * . */ @org.junit.Test public void fnDateTime29() { final XQuery query = new XQuery( " fn:count(fn:dateTime(xs:date(\"1999-12-31+10:00\"), ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluation of "fn:dateTime" function, where only the first argument have a timezone. * . */ @org.junit.Test public void fnDateTime3() { final XQuery query = new XQuery( "fn:dateTime(xs:date(\"1999-12-31Z\"), xs:time(\"23:00:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-12-31T23:00:00Z") ); } /** * Evaluation of "fn:dateTime" where both arguments are equal to the empty sequence * . */ @org.junit.Test public void fnDateTime30() { final XQuery query = new XQuery( " fn:count(fn:dateTime((),()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluation of "fn:dateTime" function, where only the second argument have a timezone. * . */ @org.junit.Test public void fnDateTime4() { final XQuery query = new XQuery( "fn:dateTime(xs:date(\"1999-12-31\"), xs:time(\"23:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-12-31T23:00:00Z") ); } /** * Evaluation of "fn:dateTime" function, where both arguments have the same timezone (Z). * . */ @org.junit.Test public void fnDateTime5() { final XQuery query = new XQuery( "fn:dateTime(xs:date(\"1999-12-31Z\"), xs:time(\"23:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-12-31T23:00:00Z") ); } /** * Evaluation of "fn:dateTime" function, where both arguments have the same timezone (+10:00). * . */ @org.junit.Test public void fnDateTime6() { final XQuery query = new XQuery( "fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-12-31T23:00:00+10:00") ); } /** * Evaluation of "fn:dateTime" function together together with the op:dateTime-equal operator(eq). * . */ @org.junit.Test public void fnDateTime7() { final XQuery query = new XQuery( "fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\")) eq fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of "fn:dateTime" function together together with the op:dateTime-equal operator(ne). * . */ @org.junit.Test public void fnDateTime8() { final XQuery query = new XQuery( "fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\")) ne fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of "fn:dateTime" function together together with the op:dateTime-equal operator(le). * . */ @org.junit.Test public void fnDateTime9() { final XQuery query = new XQuery( "fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\")) le fn:dateTime(xs:date(\"1999-12-31+10:00\"), xs:time(\"23:00:00+10:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of "fn:dateTime" function, where the two arguments have different timezones. * . */ @org.junit.Test public void forg00081() { final XQuery query = new XQuery( " fn:dateTime(xs:date(\"1999-12-31Z\"), xs:time(\"12:00:00+10:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0008") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnDayFromDate.java000066400000000000000000000326031222453003200273760ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the day-from-date() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnDayFromDate extends QT3TestSet { /** * A test whose essence is: `day-from-date()`. . */ @org.junit.Test public void kDayFromDateFunc1() { final XQuery query = new XQuery( "day-from-date()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `day-from-date((), "Wrong param")`. . */ @org.junit.Test public void kDayFromDateFunc2() { final XQuery query = new XQuery( "day-from-date((), \"Wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(day-from-date(()))`. . */ @org.junit.Test public void kDayFromDateFunc3() { final XQuery query = new XQuery( "empty(day-from-date(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `day-from-date(()) instance of xs:integer?`. . */ @org.junit.Test public void kDayFromDateFunc4() { final XQuery query = new XQuery( "day-from-date(()) instance of xs:integer?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `day-from-date(xs:date("2000-02-03")) eq 3`. . */ @org.junit.Test public void kDayFromDateFunc5() { final XQuery query = new XQuery( "day-from-date(xs:date(\"2000-02-03\")) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "day-from-date" function As per example 1 of the F&O specs . */ @org.junit.Test public void fnDayFromDate1() { final XQuery query = new XQuery( "fn:day-from-date(xs:date(\"1999-05-31-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "31") ); } /** * Evaluates The "day-from-date" function as part of a "*" expression. . */ @org.junit.Test public void fnDayFromDate10() { final XQuery query = new XQuery( "fn:day-from-date(xs:date(\"1970-01-03Z\")) * fn:day-from-date(xs:date(\"0002-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Evaluates The "day-from-date" function as part of a "div" expression. . */ @org.junit.Test public void fnDayFromDate11() { final XQuery query = new XQuery( "fn:day-from-date(xs:date(\"1970-01-02Z\")) div fn:day-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Evaluates The "day-from-date" function as part of a "idiv" expression. . */ @org.junit.Test public void fnDayFromDate12() { final XQuery query = new XQuery( "fn:day-from-date(xs:date(\"1970-01-02Z\")) idiv fn:day-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Evaluates The "day-from-date" function as part of a "mod" expression. . */ @org.junit.Test public void fnDayFromDate13() { final XQuery query = new XQuery( "fn:day-from-date(xs:date(\"1970-01-02Z\")) mod fn:day-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "day-from-date" function as part of a "numeric-unary-plus" expression. . */ @org.junit.Test public void fnDayFromDate14() { final XQuery query = new XQuery( "+fn:day-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "day-from-date" function as part of a "numeric-unary-minus" expression. . */ @org.junit.Test public void fnDayFromDate15() { final XQuery query = new XQuery( "-fn:day-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1") ); } /** * Evaluates The "day-from-date" function as part of a "numeric-equal" expression (eq operator) . */ @org.junit.Test public void fnDayFromDate16() { final XQuery query = new XQuery( "fn:day-from-date(xs:date(\"1970-01-02Z\")) eq fn:day-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "month-from-date" function as part of a "numeric-equal" expression (ne operator) . */ @org.junit.Test public void fnDayFromDate17() { final XQuery query = new XQuery( "fn:month-from-date(xs:date(\"1970-01-01Z\")) ne fn:month-from-date(xs:date(\"1970-01-03Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "day-from-date" function as part of a "numeric-equal" expression (le operator) . */ @org.junit.Test public void fnDayFromDate18() { final XQuery query = new XQuery( "fn:day-from-date(xs:date(\"1970-01-01Z\")) le fn:day-from-date(xs:date(\"1970-01-02Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "day-from-date" function as part of a "numeric-equal" expression (ge operator) . */ @org.junit.Test public void fnDayFromDate19() { final XQuery query = new XQuery( "fn:day-from-date(xs:date(\"1970-01-03Z\")) ge fn:day-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "day-from-date" function As per example 2 of the F&O specs . */ @org.junit.Test public void fnDayFromDate2() { final XQuery query = new XQuery( "fn:day-from-date(xs:date(\"2000-01-01+05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "day-from-date" function involving a "numeric-less-than" operation (lt operator) . */ @org.junit.Test public void fnDayFromDate3() { final XQuery query = new XQuery( "fn:day-from-date(xs:date(\"1999-12-31Z\")) lt fn:day-from-date(xs:date(\"1999-12-31Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "day-from-date" function involving a "numeric-less-than" operation (le operator) . */ @org.junit.Test public void fnDayFromDate4() { final XQuery query = new XQuery( "fn:day-from-date(xs:date(\"1999-12-31Z\")) le fn:day-from-date(xs:date(\"1999-12-31Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "day-from-date" function using the empty sequence as an argument. Use count function to avoid empty file. . */ @org.junit.Test public void fnDayFromDate5() { final XQuery query = new XQuery( "fn:count(fn:day-from-date(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "day-from-date" function that returns 31. . */ @org.junit.Test public void fnDayFromDate6() { final XQuery query = new XQuery( "fn:day-from-date(xs:date(\"1999-05-31Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "31") ); } /** * Evaluates The "day-from-date" function used as arguments to an avg function . . */ @org.junit.Test public void fnDayFromDate7() { final XQuery query = new XQuery( "fn:avg((fn:day-from-date(xs:date(\"1999-12-31Z\")),fn:day-from-date(xs:date(\"1999-12-29Z\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "30") ); } /** * Evaluates The "day-from-date" function as part of a "+" expression. . */ @org.junit.Test public void fnDayFromDate8() { final XQuery query = new XQuery( "fn:day-from-date(xs:date(\"1970-01-01Z\")) + fn:day-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Evaluates The "day-from-date" function as part of a "-" expression. . */ @org.junit.Test public void fnDayFromDate9() { final XQuery query = new XQuery( "fn:day-from-date(xs:date(\"1970-01-01Z\")) - fn:day-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "day-from-date" function with the arguments set as follows: $arg = xs:date(lower bound) . */ @org.junit.Test public void fnDayFromDate1args1() { final XQuery query = new XQuery( "fn:day-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "day-from-date" function with the arguments set as follows: $arg = xs:date(mid range) . */ @org.junit.Test public void fnDayFromDate1args2() { final XQuery query = new XQuery( "fn:day-from-date(xs:date(\"1983-11-17Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "17") ); } /** * Evaluates The "day-from-date" function with the arguments set as follows: $arg = xs:date(upper bound) . */ @org.junit.Test public void fnDayFromDate1args3() { final XQuery query = new XQuery( "fn:day-from-date(xs:date(\"2030-12-31Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "31") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnDayFromDateTime.java000066400000000000000000000343101222453003200302120ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the day-from-dateTime() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnDayFromDateTime extends QT3TestSet { /** * A test whose essence is: `day-from-dateTime()`. . */ @org.junit.Test public void kDayFromDateTimeFunc1() { final XQuery query = new XQuery( "day-from-dateTime()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `day-from-dateTime((), "Wrong param")`. . */ @org.junit.Test public void kDayFromDateTimeFunc2() { final XQuery query = new XQuery( "day-from-dateTime((), \"Wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(day-from-dateTime(()))`. . */ @org.junit.Test public void kDayFromDateTimeFunc3() { final XQuery query = new XQuery( "empty(day-from-dateTime(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `day-from-dateTime(()) instance of xs:integer?`. . */ @org.junit.Test public void kDayFromDateTimeFunc4() { final XQuery query = new XQuery( "day-from-dateTime(()) instance of xs:integer?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `day-from-dateTime(xs:dateTime("2001-02-03T08:23:12.43")) eq 3`. . */ @org.junit.Test public void kDayFromDateTimeFunc5() { final XQuery query = new XQuery( "day-from-dateTime(xs:dateTime(\"2001-02-03T08:23:12.43\")) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "day-from-dateTime" function As per example 1 (of this fucntion) of the F&O specs . */ @org.junit.Test public void fnDayFromDateTime1() { final XQuery query = new XQuery( "fn:day-from-dateTime(xs:dateTime(\"1999-05-31T13:20:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "31") ); } /** * Evaluates The "day-from-dateTime" function as part of a "div" expression. . */ @org.junit.Test public void fnDayFromDateTime11() { final XQuery query = new XQuery( "fn:day-from-dateTime(xs:dateTime(\"1000-01-10T02:00:00Z\")) div fn:day-from-dateTime(xs:dateTime(\"0050-01-05T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Evaluates The "day-from-dateTime" function as part of a "idiv" expression. . */ @org.junit.Test public void fnDayFromDateTime12() { final XQuery query = new XQuery( "fn:day-from-dateTime(xs:dateTime(\"1970-01-10T10:00:00Z\")) idiv fn:day-from-dateTime(xs:dateTime(\"1970-01-10T02:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "day-from-dateTime" function as part of a "mod" expression. . */ @org.junit.Test public void fnDayFromDateTime13() { final XQuery query = new XQuery( "fn:day-from-dateTime(xs:dateTime(\"1970-01-10T10:00:00Z\")) mod fn:day-from-dateTime(xs:dateTime(\"1970-01-03T03:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "day-from-dateTime" function as part of a "numeric-unary-plus" expression. . */ @org.junit.Test public void fnDayFromDateTime14() { final XQuery query = new XQuery( "+fn:day-from-dateTime(xs:dateTime(\"1971-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "day-from-dateTime" function as part of a "numeric-unary-minus" expression. . */ @org.junit.Test public void fnDayFromDateTime15() { final XQuery query = new XQuery( "-fn:day-from-dateTime(xs:dateTime(\"1970-01-03T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-3") ); } /** * Evaluates The "day-from-dateTime" function as part of a "numeric-equal" expression (eq operator) . */ @org.junit.Test public void fnDayFromDateTime16() { final XQuery query = new XQuery( "fn:day-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\")) eq fn:day-from-dateTime(xs:dateTime(\"1970-01-02T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "day-from-dateTime" function as part of a "numeric-equal" expression (ne operator) . */ @org.junit.Test public void fnDayFromDateTime17() { final XQuery query = new XQuery( "fn:day-from-dateTime(xs:dateTime(\"1970-01-02T10:00:00Z\")) ne fn:day-from-dateTime(xs:dateTime(\"1970-02-02T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "day-from-dateTime" function as part of a "numeric-equal" expression (ge operator) . */ @org.junit.Test public void fnDayFromDateTime18() { final XQuery query = new XQuery( "fn:day-from-dateTime(xs:dateTime(\"1971-01-03T10:00:00Z\")) ge fn:day-from-dateTime(xs:dateTime(\"1970-01-03T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "day-from-dateTime" function as part of a "numeric-equal" expression (ge operator) . */ @org.junit.Test public void fnDayFromDateTime19() { final XQuery query = new XQuery( "fn:day-from-dateTime(xs:dateTime(\"1971-01-10T10:00:00Z\")) ge fn:day-from-dateTime(xs:dateTime(\"1970-01-11T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "day-from-dateTime" function As per example 2 (for this function)of the F&O specs . */ @org.junit.Test public void fnDayFromDateTime2() { final XQuery query = new XQuery( "fn:day-from-dateTime(xs:dateTime(\"1999-12-31T20:00:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "31") ); } /** * Evaluates The "day-from-dateTime" function As per example 3 (for this function) of the F&O specs . */ @org.junit.Test public void fnDayFromDateTime3() { final XQuery query = new XQuery( "fn:day-from-dateTime(fn:adjust-dateTime-to-timezone(xs:dateTime(\"1999-12-31T19:20:00-05:00\"), xs:dayTimeDuration(\"PT0H\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "day-from-dateTime" function used as an argument to an "avg" function. . */ @org.junit.Test public void fnDayFromDateTime4() { final XQuery query = new XQuery( "fn:avg((fn:day-from-dateTime(xs:dateTime(\"1996-12-10T12:00:00Z\")),fn:day-from-dateTime(xs:dateTime(\"2000-12-20T12:00:00Z\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "15") ); } /** * Evaluates The "day-from-dateTime" function using the empty sequence as an argument. Use count function to avoid empty file. . */ @org.junit.Test public void fnDayFromDateTime5() { final XQuery query = new XQuery( "fn:count(fn:day-from-dateTime(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "day-from-dateTime" function that returns 1. . */ @org.junit.Test public void fnDayFromDateTime6() { final XQuery query = new XQuery( "fn:day-from-dateTime(xs:dateTime(\"1999-01-01T00:20:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "day-from-dateTime" function that returns 31. . */ @org.junit.Test public void fnDayFromDateTime7() { final XQuery query = new XQuery( "fn:day-from-dateTime(xs:dateTime(\"0001-05-31T23:20:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "31") ); } /** * Evaluates The "day-from-dateTime" function as part of a "+" expression. . */ @org.junit.Test public void fnDayFromDateTime8() { final XQuery query = new XQuery( "fn:day-from-dateTime(xs:dateTime(\"1970-01-03T00:00:00Z\")) + fn:day-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4") ); } /** * Evaluates The "day-from-dateTime" function as part of a "-" expression. . */ @org.junit.Test public void fnDayFromDateTime9() { final XQuery query = new XQuery( "fn:day-from-dateTime(xs:dateTime(\"1970-01-10T00:00:00Z\")) - fn:day-from-dateTime(xs:dateTime(\"1969-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9") ); } /** * Evaluates The "day-from-dateTime" function with the arguments set as follows: $arg = xs:dateTime(lower bound) . */ @org.junit.Test public void fnDayFromDateTime1args1() { final XQuery query = new XQuery( "fn:day-from-dateTime(xs:dateTime(\"1970-01-01T00:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "day-from-dateTime" function with the arguments set as follows: $arg = xs:dateTime(mid range) . */ @org.junit.Test public void fnDayFromDateTime1args2() { final XQuery query = new XQuery( "fn:day-from-dateTime(xs:dateTime(\"1996-04-07T01:40:52Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "7") ); } /** * Evaluates The "day-from-dateTime" function with the arguments set as follows: $arg = xs:dateTime(upper bound) . */ @org.junit.Test public void fnDayFromDateTime1args3() { final XQuery query = new XQuery( "fn:day-from-dateTime(xs:dateTime(\"2030-12-31T23:59:59Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "31") ); } /** * Evaluates The "day-from-dateTime" function as part of a "*" expression. . */ @org.junit.Test public void fnDayFromDateTimeNew10() { final XQuery query = new XQuery( "fn:day-from-dateTime(xs:dateTime(\"1970-01-02T02:00:00Z\")) * fn:day-from-dateTime(xs:dateTime(\"0002-01-04T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "8") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnDaysFromDuration.java000066400000000000000000000375311222453003200304760ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the days-from-duration() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnDaysFromDuration extends QT3TestSet { /** * A test whose essence is: `days-from-duration()`. . */ @org.junit.Test public void kDaysFromDurationFunc1() { final XQuery query = new XQuery( "days-from-duration()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `days-from-duration((), "Wrong param")`. . */ @org.junit.Test public void kDaysFromDurationFunc2() { final XQuery query = new XQuery( "days-from-duration((), \"Wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(days-from-duration(()))`. . */ @org.junit.Test public void kDaysFromDurationFunc3() { final XQuery query = new XQuery( "empty(days-from-duration(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `days-from-duration(()) instance of xs:integer?`. . */ @org.junit.Test public void kDaysFromDurationFunc4() { final XQuery query = new XQuery( "days-from-duration(()) instance of xs:integer?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `days-from-duration(xs:dayTimeDuration("P45678DT8H2M1.03S")) eq 45678`. . */ @org.junit.Test public void kDaysFromDurationFunc5() { final XQuery query = new XQuery( "days-from-duration(xs:dayTimeDuration(\"P45678DT8H2M1.03S\")) eq 45678", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test invoking days-from-duration() on a negative duration. . */ @org.junit.Test public void kDaysFromDurationFunc6() { final XQuery query = new XQuery( "days-from-duration(xs:dayTimeDuration(\"-P45678DT8H2M1.03S\")) eq -45678", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test invoking days-from-duration() on an negative xs:duration. . */ @org.junit.Test public void kDaysFromDurationFunc7() { final XQuery query = new XQuery( "days-from-duration(xs:duration(\"-P3Y4M8DT1H23M2.34S\")) eq -8", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:days-from-duration on xs:yearMonthDuration . */ @org.junit.Test public void cbclDaysFromDuration001() { final XQuery query = new XQuery( "fn:days-from-duration(xs:yearMonthDuration('P1Y'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "days-from-duration" function As per example 1 (for this function)of the F&O specs . */ @org.junit.Test public void fnDaysFromDuration1() { final XQuery query = new XQuery( "fn:days-from-duration(xs:dayTimeDuration(\"P3DT10H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Evaluates The "days-from-duration" function as part of a "*" expression. . */ @org.junit.Test public void fnDaysFromDuration10() { final XQuery query = new XQuery( "fn:days-from-duration(xs:dayTimeDuration(\"P20DT09H\")) * fn:days-from-duration(xs:dayTimeDuration(\"P03DT10H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("60") ); } /** * Evaluates The "days-from-duration" function as part of a "div" expression. . */ @org.junit.Test public void fnDaysFromDuration11() { final XQuery query = new XQuery( "fn:days-from-duration(xs:dayTimeDuration(\"P20DT10H\")) div fn:days-from-duration(xs:dayTimeDuration(\"P05DT05H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("4") ); } /** * Evaluates The "days-from-duration" function as part of a "idiv" expression. . */ @org.junit.Test public void fnDaysFromDuration12() { final XQuery query = new XQuery( "fn:days-from-duration(xs:dayTimeDuration(\"P25DT10H\")) idiv fn:days-from-duration(xs:dayTimeDuration(\"P05DT02H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** * Evaluates The "days-from-duration" function as part of a "mod" expression. . */ @org.junit.Test public void fnDaysFromDuration13() { final XQuery query = new XQuery( "fn:days-from-duration(xs:dayTimeDuration(\"P10DT10H\")) mod fn:days-from-duration(xs:dayTimeDuration(\"P03DT03H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "days-from-duration" function as part of a "numeric-unary-plus" expression. . */ @org.junit.Test public void fnDaysFromDuration14() { final XQuery query = new XQuery( "+fn:days-from-duration(xs:dayTimeDuration(\"P21DT10H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("21") ); } /** * Evaluates The "days-from-duration" function as part of a "numeric-unary-minus" expression. . */ @org.junit.Test public void fnDaysFromDuration15() { final XQuery query = new XQuery( "-fn:days-from-duration(xs:dayTimeDuration(\"P20DT03H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-20") ); } /** * Evaluates The "days-from-duration" function as part of a "numeric-equal" expression (eq operator) . */ @org.junit.Test public void fnDaysFromDuration16() { final XQuery query = new XQuery( "fn:days-from-duration(xs:dayTimeDuration(\"P22DT10H\")) eq fn:days-from-duration(xs:dayTimeDuration(\"P22DT09H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "days-from-duration" function as part of a "numeric-equal" expression (ne operator) . */ @org.junit.Test public void fnDaysFromDuration17() { final XQuery query = new XQuery( "fn:days-from-duration(xs:dayTimeDuration(\"P23DT08H\")) ne fn:days-from-duration(xs:dayTimeDuration(\"P12DT05H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "days-from-duration" function as part of a "numeric-equal" expression (le operator) . */ @org.junit.Test public void fnDaysFromDuration18() { final XQuery query = new XQuery( "fn:days-from-duration(xs:dayTimeDuration(\"P20DT03H\")) le fn:days-from-duration(xs:dayTimeDuration(\"P21DT15H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "days-from-duration" function as part of a "numeric-equal" expression (ge operator) . */ @org.junit.Test public void fnDaysFromDuration19() { final XQuery query = new XQuery( "fn:days-from-duration(xs:dayTimeDuration(\"P21DT07H\")) ge fn:days-from-duration(xs:dayTimeDuration(\"P20DT01H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "days-from-duration" function As per example 2 (for this function) of the F&O specs . */ @org.junit.Test public void fnDaysFromDuration2() { final XQuery query = new XQuery( "fn:days-from-duration(xs:dayTimeDuration(\"P3DT55H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** * Evaluates The "days-from-duration" function with invalid argument. . */ @org.junit.Test public void fnDaysFromDuration20() { final XQuery query = new XQuery( "fn:days-from-duration(xs:duration(\"P1Y2M3DT10H30M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Evaluates The "days-from-duration" function involving a "numeric-less-than" operation (lt operator) . */ @org.junit.Test public void fnDaysFromDuration3() { final XQuery query = new XQuery( "fn:days-from-duration(xs:dayTimeDuration(\"P20DT20H\")) lt fn:days-from-duration(xs:dayTimeDuration(\"P03DT02H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "days-from-duration" function involving a "numeric-less-than" operation (le operator) . */ @org.junit.Test public void fnDaysFromDuration4() { final XQuery query = new XQuery( "fn:days-from-duration(xs:dayTimeDuration(\"P21DT10H\")) le fn:days-from-duration(xs:dayTimeDuration(\"P22DT10H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "days-from-duration" function using the empty sequence as an argument. Use count function to avoid empty file. . */ @org.junit.Test public void fnDaysFromDuration5() { final XQuery query = new XQuery( "fn:count(fn:days-from-duration(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "days-from-duration" function that returns 1. . */ @org.junit.Test public void fnDaysFromDuration6() { final XQuery query = new XQuery( "fn:days-from-duration(xs:dayTimeDuration(\"P01DT01H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "days-from-duration" function used as arguments to an avg function. . */ @org.junit.Test public void fnDaysFromDuration7() { final XQuery query = new XQuery( "fn:avg((fn:days-from-duration(xs:dayTimeDuration(\"P23DT10H\")),fn:days-from-duration(xs:dayTimeDuration(\"P21DT10H\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("22") ); } /** * Evaluates The "days-from-duration" function as part of a "+" expression. . */ @org.junit.Test public void fnDaysFromDuration8() { final XQuery query = new XQuery( "fn:days-from-duration(xs:dayTimeDuration(\"P21DT10H\")) + fn:days-from-duration(xs:dayTimeDuration(\"P22DT11H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("43") ); } /** * Evaluates The "days-from-duration" function as part of a "-" expression. . */ @org.junit.Test public void fnDaysFromDuration9() { final XQuery query = new XQuery( "fn:days-from-duration(xs:dayTimeDuration(\"P30DT10H\")) - fn:days-from-duration(xs:dayTimeDuration(\"P10DT09H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("20") ); } /** * Evaluates The "days-from-duration" function with the arguments set as follows: $arg = xs:dayTimeDuration(lower bound) . */ @org.junit.Test public void fnDaysFromDuration1args1() { final XQuery query = new XQuery( "fn:days-from-duration(xs:dayTimeDuration(\"P0DT0H0M0S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "days-from-duration" function with the arguments set as follows: $arg = xs:dayTimeDuration(mid range) . */ @org.junit.Test public void fnDaysFromDuration1args2() { final XQuery query = new XQuery( "fn:days-from-duration(xs:dayTimeDuration(\"P15DT11H59M59S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("15") ); } /** * Evaluates The "days-from-duration" function with the arguments set as follows: $arg = xs:dayTimeDuration(upper bound) . */ @org.junit.Test public void fnDaysFromDuration1args3() { final XQuery query = new XQuery( "fn:days-from-duration(xs:dayTimeDuration(\"P31DT23H59M59S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("31") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnDeepEqual.java000066400000000000000000003116231222453003200271060ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the deep-equal() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnDeepEqual extends QT3TestSet { /** * A test whose essence is: `deep-equal()`. . */ @org.junit.Test public void kSeqDeepEqualFunc1() { final XQuery query = new XQuery( "deep-equal()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `deep-equal(xs:float("NaN"), xs:double("NaN"))`. . */ @org.junit.Test public void kSeqDeepEqualFunc10() { final XQuery query = new XQuery( "deep-equal(xs:float(\"NaN\"), xs:double(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal(xs:double("NaN"), xs:float("NaN"))`. . */ @org.junit.Test public void kSeqDeepEqualFunc11() { final XQuery query = new XQuery( "deep-equal(xs:double(\"NaN\"), xs:float(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(deep-equal(xs:float("NaN"), xs:float(0)))`. . */ @org.junit.Test public void kSeqDeepEqualFunc12() { final XQuery query = new XQuery( "not(deep-equal(xs:float(\"NaN\"), xs:float(0)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(deep-equal(xs:float(0), xs:float("NaN")))`. . */ @org.junit.Test public void kSeqDeepEqualFunc13() { final XQuery query = new XQuery( "not(deep-equal(xs:float(0), xs:float(\"NaN\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(deep-equal(xs:double(0), xs:double("NaN")))`. . */ @org.junit.Test public void kSeqDeepEqualFunc14() { final XQuery query = new XQuery( "not(deep-equal(xs:double(0), xs:double(\"NaN\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(deep-equal(xs:double("NaN"), xs:double(0)))`. . */ @org.junit.Test public void kSeqDeepEqualFunc15() { final XQuery query = new XQuery( "not(deep-equal(xs:double(\"NaN\"), xs:double(0)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(deep-equal(xs:decimal("1"), xs:anyURI("example.com")))`. . */ @org.junit.Test public void kSeqDeepEqualFunc16() { final XQuery query = new XQuery( "not(deep-equal(xs:decimal(\"1\"), xs:anyURI(\"example.com\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(deep-equal(QName("example.com", "ncname"), 3e2))`. . */ @org.junit.Test public void kSeqDeepEqualFunc17() { final XQuery query = new XQuery( "not(deep-equal(QName(\"example.com\", \"ncname\"), 3e2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(deep-equal((1, 2, xs:anyURI("example.com")), (1, 2, 3)))`. . */ @org.junit.Test public void kSeqDeepEqualFunc18() { final XQuery query = new XQuery( "not(deep-equal((1, 2, xs:anyURI(\"example.com\")), (1, 2, 3)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(deep-equal((1, xs:decimal("2.2"), 3), (1, 2, 3)))`. . */ @org.junit.Test public void kSeqDeepEqualFunc19() { final XQuery query = new XQuery( "not(deep-equal((1, xs:decimal(\"2.2\"), 3), (1, 2, 3)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal("a string")`. . */ @org.junit.Test public void kSeqDeepEqualFunc2() { final XQuery query = new XQuery( "deep-equal(\"a string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `not(deep-equal((true(), 2, 3), (1, 2, 3)))`. . */ @org.junit.Test public void kSeqDeepEqualFunc20() { final XQuery query = new XQuery( "not(deep-equal((true(), 2, 3), (1, 2, 3)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(deep-equal((1, 2, 3), (1, 2, QName("example.com", "ncname"))))`. . */ @org.junit.Test public void kSeqDeepEqualFunc21() { final XQuery query = new XQuery( "not(deep-equal((1, 2, 3), (1, 2, QName(\"example.com\", \"ncname\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(deep-equal((1, 2, 3), (1, xs:hexBinary("FF"), 3)))`. . */ @org.junit.Test public void kSeqDeepEqualFunc22() { final XQuery query = new XQuery( "not(deep-equal((1, 2, 3), (1, xs:hexBinary(\"FF\"), 3)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(deep-equal((1, 2, 3), (xs:base64Binary("FFFF"), 2, 3)))`. . */ @org.junit.Test public void kSeqDeepEqualFunc23() { final XQuery query = new XQuery( "not(deep-equal((1, 2, 3), (xs:base64Binary(\"FFFF\"), 2, 3)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal((1, 2, xs:base64Binary("FFFF")), (1, 2, xs:base64Binary("FFFF")))`. . */ @org.junit.Test public void kSeqDeepEqualFunc24() { final XQuery query = new XQuery( "deep-equal((1, 2, xs:base64Binary(\"FFFF\")), (1, 2, xs:base64Binary(\"FFFF\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal((1, 1, 1), (1, 1, 1))`. . */ @org.junit.Test public void kSeqDeepEqualFunc25() { final XQuery query = new XQuery( "deep-equal((1, 1, 1), (1, 1, 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(deep-equal((1, 1, 3), (1, 1, 1)))`. . */ @org.junit.Test public void kSeqDeepEqualFunc26() { final XQuery query = new XQuery( "not(deep-equal((1, 1, 3), (1, 1, 1)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(deep-equal((1, 3, 1), (1, 1, 1)))`. . */ @org.junit.Test public void kSeqDeepEqualFunc27() { final XQuery query = new XQuery( "not(deep-equal((1, 3, 1), (1, 1, 1)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(deep-equal((3, 1, 1), (1, 1, 1)))`. . */ @org.junit.Test public void kSeqDeepEqualFunc28() { final XQuery query = new XQuery( "not(deep-equal((3, 1, 1), (1, 1, 1)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(deep-equal((1, 1, 1), (3, 1, 1)))`. . */ @org.junit.Test public void kSeqDeepEqualFunc29() { final XQuery query = new XQuery( "not(deep-equal((1, 1, 1), (3, 1, 1)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal("a string", "a string", "http://www.w3.org/2005/xpath-functions/collation/codepoint", "wrong param")`. . */ @org.junit.Test public void kSeqDeepEqualFunc3() { final XQuery query = new XQuery( "deep-equal(\"a string\", \"a string\", \"http://www.w3.org/2005/xpath-functions/collation/codepoint\", \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `not(deep-equal((1, 1, 1), (1, 3, 1)))`. . */ @org.junit.Test public void kSeqDeepEqualFunc30() { final XQuery query = new XQuery( "not(deep-equal((1, 1, 1), (1, 3, 1)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(deep-equal((1, 1, 1), (1, 1, 3)))`. . */ @org.junit.Test public void kSeqDeepEqualFunc31() { final XQuery query = new XQuery( "not(deep-equal((1, 1, 1), (1, 1, 3)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal(index-of(20, 20), (1))`. . */ @org.junit.Test public void kSeqDeepEqualFunc32() { final XQuery query = new XQuery( "deep-equal(index-of(20, 20), (1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal(index-of((20, 40), 20), (1))`. . */ @org.junit.Test public void kSeqDeepEqualFunc33() { final XQuery query = new XQuery( "deep-equal(index-of((20, 40), 20), (1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal(index-of((20, 20), 20), (1, 2))`. . */ @org.junit.Test public void kSeqDeepEqualFunc34() { final XQuery query = new XQuery( "deep-equal(index-of((20, 20), 20), (1, 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal(index-of((20, 40, 20), 20), (1, 3))`. . */ @org.junit.Test public void kSeqDeepEqualFunc35() { final XQuery query = new XQuery( "deep-equal(index-of((20, 40, 20), 20), (1, 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal((1, 1, "str"), (1, 1, "str"))`. . */ @org.junit.Test public void kSeqDeepEqualFunc36() { final XQuery query = new XQuery( "deep-equal((1, 1, \"str\"), (1, 1, \"str\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal((1, "str", 1), (1, "str", 1))`. . */ @org.junit.Test public void kSeqDeepEqualFunc37() { final XQuery query = new XQuery( "deep-equal((1, \"str\", 1), (1, \"str\", 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal(("str", 1, 1), ("str", 1, 1))`. . */ @org.junit.Test public void kSeqDeepEqualFunc38() { final XQuery query = new XQuery( "deep-equal((\"str\", 1, 1), (\"str\", 1, 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal((1, 1, ()), (1, 1, ()))`. . */ @org.junit.Test public void kSeqDeepEqualFunc39() { final XQuery query = new XQuery( "deep-equal((1, 1, ()), (1, 1, ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal("a string", "a string", "http://www.example.com/COLLATION/NOT/SUPPORTED")`. . */ @org.junit.Test public void kSeqDeepEqualFunc4() { final XQuery query = new XQuery( "deep-equal(\"a string\", \"a string\", \"http://www.example.com/COLLATION/NOT/SUPPORTED\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0002") ); } /** * A test whose essence is: `deep-equal((1, (), 1), (1, (), 1))`. . */ @org.junit.Test public void kSeqDeepEqualFunc40() { final XQuery query = new XQuery( "deep-equal((1, (), 1), (1, (), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal(((), 1, 1), ((), 1, 1))`. . */ @org.junit.Test public void kSeqDeepEqualFunc41() { final XQuery query = new XQuery( "deep-equal(((), 1, 1), ((), 1, 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(deep-equal((1, 1, ()), (1, 1, 1)))`. . */ @org.junit.Test public void kSeqDeepEqualFunc42() { final XQuery query = new XQuery( "not(deep-equal((1, 1, ()), (1, 1, 1)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(deep-equal((1, (), 1), (1, 1, 1)))`. . */ @org.junit.Test public void kSeqDeepEqualFunc43() { final XQuery query = new XQuery( "not(deep-equal((1, (), 1), (1, 1, 1)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(deep-equal(((), 1, 1), (1, 1, 1)))`. . */ @org.junit.Test public void kSeqDeepEqualFunc44() { final XQuery query = new XQuery( "not(deep-equal(((), 1, 1), (1, 1, 1)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(deep-equal((1, 1, 1), (1, 1, ())))`. . */ @org.junit.Test public void kSeqDeepEqualFunc45() { final XQuery query = new XQuery( "not(deep-equal((1, 1, 1), (1, 1, ())))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(deep-equal((1, 1, 1), (1, (), 1)))`. . */ @org.junit.Test public void kSeqDeepEqualFunc46() { final XQuery query = new XQuery( "not(deep-equal((1, 1, 1), (1, (), 1)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(deep-equal((1, 1, 1), ((), 1, 1)))`. . */ @org.junit.Test public void kSeqDeepEqualFunc47() { final XQuery query = new XQuery( "not(deep-equal((1, 1, 1), ((), 1, 1)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(deep-equal((1, 1), (1, 1, 1)))`. . */ @org.junit.Test public void kSeqDeepEqualFunc48() { final XQuery query = new XQuery( "not(deep-equal((1, 1), (1, 1, 1)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(deep-equal((1, 1, 1), (1, 1)))`. . */ @org.junit.Test public void kSeqDeepEqualFunc49() { final XQuery query = new XQuery( "not(deep-equal((1, 1, 1), (1, 1)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal("a string", "a string", ())`. . */ @org.junit.Test public void kSeqDeepEqualFunc5() { final XQuery query = new XQuery( "deep-equal(\"a string\", \"a string\", ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A test whose essence is: `not(deep-equal((), (1, 1, 1)))`. . */ @org.junit.Test public void kSeqDeepEqualFunc50() { final XQuery query = new XQuery( "not(deep-equal((), (1, 1, 1)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(deep-equal((1, 1, 1), ()))`. . */ @org.junit.Test public void kSeqDeepEqualFunc51() { final XQuery query = new XQuery( "not(deep-equal((1, 1, 1), ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal((), reverse(0 to -5))`. . */ @org.junit.Test public void kSeqDeepEqualFunc52() { final XQuery query = new XQuery( "deep-equal((), reverse(0 to -5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal((), 0 to -5)`. . */ @org.junit.Test public void kSeqDeepEqualFunc53() { final XQuery query = new XQuery( "deep-equal((), 0 to -5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal(reverse(0 to -5), ())`. . */ @org.junit.Test public void kSeqDeepEqualFunc54() { final XQuery query = new XQuery( "deep-equal(reverse(0 to -5), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal(0 to -5, ())`. . */ @org.junit.Test public void kSeqDeepEqualFunc55() { final XQuery query = new XQuery( "deep-equal(0 to -5, ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal("a string", "a string", "http://www.w3.org/2005/xpath-functions/collation/codepoint")`. . */ @org.junit.Test public void kSeqDeepEqualFunc6() { final XQuery query = new XQuery( "deep-equal(\"a string\", \"a string\", \"http://www.w3.org/2005/xpath-functions/collation/codepoint\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal((), ()) eq true()`. . */ @org.junit.Test public void kSeqDeepEqualFunc7() { final XQuery query = new XQuery( "deep-equal((), ()) eq true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal(xs:float("NaN"), xs:float("NaN"))`. . */ @org.junit.Test public void kSeqDeepEqualFunc8() { final XQuery query = new XQuery( "deep-equal(xs:float(\"NaN\"), xs:float(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal(xs:double("NaN"), xs:double("NaN"))`. . */ @org.junit.Test public void kSeqDeepEqualFunc9() { final XQuery query = new XQuery( "deep-equal(xs:double(\"NaN\"), xs:double(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Two date/time values that never will compare equal. . */ @org.junit.Test public void k2SeqDeepEqualFunc1() { final XQuery query = new XQuery( "not(deep-equal(current-time(), current-date()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:deep-equal() with two sequence of nodes. . */ @org.junit.Test public void k2SeqDeepEqualFunc10() { final XQuery query = new XQuery( "deep-equal((, , ), (, , ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:deep-equal() with two sequence of nodes(#2). . */ @org.junit.Test public void k2SeqDeepEqualFunc11() { final XQuery query = new XQuery( "deep-equal((, , ), (, , ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * fn:deep-equal() with two sequence of nodes(#3). . */ @org.junit.Test public void k2SeqDeepEqualFunc12() { final XQuery query = new XQuery( "deep-equal((, ), (, , ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * fn:deep-equal() with two sequence of nodes(#4). . */ @org.junit.Test public void k2SeqDeepEqualFunc13() { final XQuery query = new XQuery( "deep-equal((, , ), (, ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Ensure processing instructions are ignored if children of a document node. . */ @org.junit.Test public void k2SeqDeepEqualFunc14() { final XQuery query = new XQuery( "declare variable $d1 := document { , text{\"some text\"}}; declare variable $d2 := document {text{\"some text\"}}; deep-equal($d1, $d2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure processing instructions are ignored if children of a document node(#2). . */ @org.junit.Test public void k2SeqDeepEqualFunc15() { final XQuery query = new XQuery( "declare variable $d1 := document {()}; declare variable $d2 := document {}; deep-equal($d1, $d2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure processing instructions are ignored if children of a document node. . */ @org.junit.Test public void k2SeqDeepEqualFunc16() { final XQuery query = new XQuery( "declare variable $d1 := document { , text{\"some text\"}}; declare variable $d2 := document {text{\"some text\"}}; deep-equal($d1, $d2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure processing instructions are ignored if children of a document node(#2). . */ @org.junit.Test public void k2SeqDeepEqualFunc17() { final XQuery query = new XQuery( "declare variable $d1 := document {()}; declare variable $d2 := document {}; deep-equal($d1, $d2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:deep-equal() with mixed content. . */ @org.junit.Test public void k2SeqDeepEqualFunc18() { final XQuery query = new XQuery( "deep-equal(1, 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * fn:deep-equal() with mixed content(#2). . */ @org.junit.Test public void k2SeqDeepEqualFunc19() { final XQuery query = new XQuery( "deep-equal(1, 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * A date and node value that never will compare equal. . */ @org.junit.Test public void k2SeqDeepEqualFunc2() { final XQuery query = new XQuery( "deep-equal(current-time(), )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * One of the operands has two text nodes, and hence it evaluate to false. . */ @org.junit.Test public void k2SeqDeepEqualFunc20() { final XQuery query = new XQuery( "declare variable $d1 := text; declare variable $d2 := text; deep-equal($d1, $d2), deep-equal($d2, $d1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "false false") ); } /** * Processing instructions inside elements are ignored. . */ @org.junit.Test public void k2SeqDeepEqualFunc21() { final XQuery query = new XQuery( "declare variable $d1 := text; declare variable $d2 := text; deep-equal($d1, $d2), deep-equal($d2, $d1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true") ); } /** * One of the operands has two text nodes besides the comment, and hence it evaluate to false. . */ @org.junit.Test public void k2SeqDeepEqualFunc22() { final XQuery query = new XQuery( "declare variable $d1 := text; declare variable $d2 := text; deep-equal($d1, $d2), deep-equal($d2, $d1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "false false") ); } /** * Comments inside elements are ignored. . */ @org.junit.Test public void k2SeqDeepEqualFunc23() { final XQuery query = new XQuery( "declare variable $d1 := text; declare variable $d2 := text; deep-equal($d1, $d2), deep-equal($d2, $d1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true") ); } /** * Compare attribute nodes. . */ @org.junit.Test public void k2SeqDeepEqualFunc24() { final XQuery query = new XQuery( "deep-equal(attribute name {\"content\"}, attribute name {\"content\"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Compare attribute nodes in a weird order. . */ @org.junit.Test public void k2SeqDeepEqualFunc25() { final XQuery query = new XQuery( "deep-equal((attribute name2 {\"content\"}, attribute name {\"content\"}), (attribute name {\"content\"}, attribute name2 {\"content\"}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Compare operands with attributes nodes of different size. . */ @org.junit.Test public void k2SeqDeepEqualFunc26() { final XQuery query = new XQuery( "deep-equal((attribute name {\"content\"}, attribute name {\"content\"}), (attribute name {\"content\"}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Compare operands with attributes nodes of different size(#2). . */ @org.junit.Test public void k2SeqDeepEqualFunc27() { final XQuery query = new XQuery( "deep-equal((attribute name {\"content\"}, attribute name {\"content\"}), attribute name {\"content\"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test deep-equalness of two attribute nodes. . */ @org.junit.Test public void k2SeqDeepEqualFunc28() { final XQuery query = new XQuery( "deep-equal(attribute name {}, attribute name {})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test deep-equalness of two attribute nodes. . */ @org.junit.Test public void k2SeqDeepEqualFunc29() { final XQuery query = new XQuery( "deep-equal(attribute name {\"content\"}, attribute name {\"content\"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A date and node value that never will compare equal(#2). . */ @org.junit.Test public void k2SeqDeepEqualFunc3() { final XQuery query = new XQuery( "deep-equal(, current-time())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test deep-equalness of two attribute nodes that has the same name, but different string values. . */ @org.junit.Test public void k2SeqDeepEqualFunc30() { final XQuery query = new XQuery( "deep-equal(attribute name {\"content\"}, attribute name {})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test deep-equalness of two attribute nodes that has same text content but different names. . */ @org.junit.Test public void k2SeqDeepEqualFunc31() { final XQuery query = new XQuery( "deep-equal(attribute name {}, attribute name2 {})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test deep-equalness of two attribute nodes that has identical text content but different names. . */ @org.junit.Test public void k2SeqDeepEqualFunc32() { final XQuery query = new XQuery( "deep-equal(attribute name {\"content \"}, attribute name2 {\"content \"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Namespace prefixes and namespace nodes are ignored. */ @org.junit.Test public void k2SeqDeepEqualFunc33() { final XQuery query = new XQuery( "\n" + " deep-equal(, )\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Parent node is ignored. */ @org.junit.Test public void k2SeqDeepEqualFunc34() { final XQuery query = new XQuery( "\n" + " deep-equal(12/*, 12/*)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Type annotation is ignored for atomic values. */ @org.junit.Test public void k2SeqDeepEqualFunc35() { final XQuery query = new XQuery( "\n" + " deep-equal(\"a\", xs:NCName(\"a\"))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Time values that never will compare equal. . */ @org.junit.Test public void k2SeqDeepEqualFunc4() { final XQuery query = new XQuery( "deep-equal((current-time(), current-time(), current-time()), (current-time(), current-time()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Handle dependency on implicit timezone . */ @org.junit.Test public void k2SeqDeepEqualFunc40() { final XQuery query = new XQuery( "\n" + " deep-equal(xs:dateTime('2012-05-30T12:00:00'), xs:dateTime('2012-05-30T12:00:00Z') - implicit-timezone())\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Comparing mixed content. . */ @org.junit.Test public void k2SeqDeepEqualFunc5() { final XQuery query = new XQuery( "deep-equal((1, , 2), (1, , 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Comparing mixed content(#2). . */ @org.junit.Test public void k2SeqDeepEqualFunc6() { final XQuery query = new XQuery( "deep-equal((1, , 2), (1, , 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Comparing mixed content(#3). . */ @org.junit.Test public void k2SeqDeepEqualFunc7() { final XQuery query = new XQuery( "deep-equal((, , 4), (, , 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * fn:deep-equal() takes two arguments, not zero. . */ @org.junit.Test public void k2SeqDeepEqualFunc8() { final XQuery query = new XQuery( "deep-equal()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * fn:deep-equal() takes two arguments, not one. . */ @org.junit.Test public void k2SeqDeepEqualFunc9() { final XQuery query = new XQuery( "deep-equal((1, 2, 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Test deep-equal ignores processing instructions and comments in elements. . */ @org.junit.Test public void cbclDeepEqual001() { final XQuery query = new XQuery( "let $doc1 := let $doc2 := return deep-equal($doc1, $doc2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test deep-equal on processing instructions with different values. . */ @org.junit.Test public void cbclDeepEqual002() { final XQuery query = new XQuery( "let $doc1 := let $doc2 := return deep-equal($doc1, $doc2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test deep-equal on processing instructions with different names. . */ @org.junit.Test public void cbclDeepEqual003() { final XQuery query = new XQuery( "let $doc1 := let $doc2 := return deep-equal($doc1, $doc2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test deep-equal on equal processing instructions . */ @org.junit.Test public void cbclDeepEqual004() { final XQuery query = new XQuery( "let $doc1 := let $doc2 := return deep-equal($doc1, $doc2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test deep-equal simplifying to fn:empty . */ @org.junit.Test public void cbclDeepEqual005() { final XQuery query = new XQuery( "declare function local:f($x as xs:integer)as xs:integer* { 1 to $x }; deep-equal((local:f(3), 2, local:f(1)), (local:f(3), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test deep-equal simplifying to fn:empty . */ @org.junit.Test public void cbclDeepEqual006() { final XQuery query = new XQuery( "declare function local:f($x as xs:integer) as xs:integer* { 1 to $x }; deep-equal((local:f(3), 2), (local:f(3), 2, local:f(1)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test deep-equal on comparison requiring dynamic context . */ @org.junit.Test public void cbclDeepEqual007() { final XQuery query = new XQuery( "deep-equal(xs:gMonth(\"--12+03:00\"), xs:gMonth(\"--12\")) eq (implicit-timezone() eq xs:dayTimeDuration(\"PT3H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that deep equal compares untypedAtomic values correctly . */ @org.junit.Test public void cbclDeepEqual008() { final XQuery query = new XQuery( "deep-equal((xs:untypedAtomic(\"a\"), xs:untypedAtomic(\"P1Y\"), 2.0), (xs:untypedAtomic(\"a\"), xs:yearMonthDuration(\"P12M\"), xs:untypedAtomic(\" 2\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:deep equal (was duplicate cbcl-deep-equal-001). */ @org.junit.Test public void cbclDeepEqual009() { final XQuery query = new XQuery( "fn:deep-equal(, )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test that deep equal compares untypedAtomic values correctly . */ @org.junit.Test public void cbclDeepEqual010() { final XQuery query = new XQuery( "deep-equal((, xs:untypedAtomic(\"a\"), xs:untypedAtomic(\"P1Y\"), 2.0), (, xs:untypedAtomic(\"a\"), xs:yearMonthDuration(\"P12M\"), xs:untypedAtomic(\" 2\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * The order of elements in sequence is important . */ @org.junit.Test public void fnDeepEqualMixArgs001() { final XQuery query = new XQuery( "fn:deep-equal( (1,2) , (2,1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Two sequences are fn:deep-equal if items have same value and same order . */ @org.junit.Test public void fnDeepEqualMixArgs002() { final XQuery query = new XQuery( "fn:deep-equal( (1,2) , (1,2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * comparing arguments of type string . */ @org.junit.Test public void fnDeepEqualMixArgs003() { final XQuery query = new XQuery( "fn:deep-equal( xs:string(\"A\") , \"A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * arg of type string, but case is different . */ @org.junit.Test public void fnDeepEqualMixArgs004() { final XQuery query = new XQuery( "fn:deep-equal( xs:string(\"A\") , \"a\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * arg1: string, arg2: sequence with 1 element of type string . */ @org.junit.Test public void fnDeepEqualMixArgs005() { final XQuery query = new XQuery( "fn:deep-equal( xs:string(\"A\") , (\"A\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Comparing null strings . */ @org.junit.Test public void fnDeepEqualMixArgs006() { final XQuery query = new XQuery( "fn:deep-equal( xs:string(\"\") , (\"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Comparing null sequences . */ @org.junit.Test public void fnDeepEqualMixArgs007() { final XQuery query = new XQuery( "fn:deep-equal( () , ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Comparing nested null & a null sequence . */ @org.junit.Test public void fnDeepEqualMixArgs008() { final XQuery query = new XQuery( "fn:deep-equal( (()) , ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Comparing arg1: sequence with a space with agr2: empty sequence . */ @org.junit.Test public void fnDeepEqualMixArgs009() { final XQuery query = new XQuery( "fn:deep-equal( ( ) , ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Comparing strings with different value . */ @org.junit.Test public void fnDeepEqualMixArgs010() { final XQuery query = new XQuery( "fn:deep-equal(xs:string(\"abc\"), xs:string(\"cba\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Comparing arg1: anyURI, arg2: string . */ @org.junit.Test public void fnDeepEqualMixArgs011() { final XQuery query = new XQuery( "fn:deep-equal( xs:anyURI(\"www.example.com\") , \"www.example.com\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Comparing arg1:anyURI and arg2:string . */ @org.junit.Test public void fnDeepEqualMixArgs012() { final XQuery query = new XQuery( "fn:deep-equal( xs:anyURI(\"www.example.com\") , xs:string(\"www.example.com\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Comparing arg1:integer and arg2:decimal . */ @org.junit.Test public void fnDeepEqualMixArgs013() { final XQuery query = new XQuery( "fn:deep-equal( xs:integer(1) , xs:decimal(1.0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Comapring integer args with different values . */ @org.junit.Test public void fnDeepEqualMixArgs014() { final XQuery query = new XQuery( "fn:deep-equal( xs:integer(1) , xs:integer(-1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Comparing arg1:integer and arg2:float . */ @org.junit.Test public void fnDeepEqualMixArgs015() { final XQuery query = new XQuery( "fn:deep-equal( xs:integer(1) , xs:float(1.0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Comparing arg1:integer, arg2:double . */ @org.junit.Test public void fnDeepEqualMixArgs016() { final XQuery query = new XQuery( "fn:deep-equal( xs:integer(1) , xs:double(1.0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Comparing arg1:decimal , arg2:float . */ @org.junit.Test public void fnDeepEqualMixArgs017() { final XQuery query = new XQuery( "fn:deep-equal( xs:decimal(1.01) , xs:float(1.01))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Comparing arg1:decimal, arg2:double . */ @org.junit.Test public void fnDeepEqualMixArgs018() { final XQuery query = new XQuery( "fn:deep-equal( xs:decimal(1.01) , xs:double(1.01))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Comparing arg1:float , arg2:double . */ @org.junit.Test public void fnDeepEqualMixArgs019() { final XQuery query = new XQuery( "fn:deep-equal( xs:float(1.01) , xs:double(1.01))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Comparing arg1:float, arg2:double values INF . */ @org.junit.Test public void fnDeepEqualMixArgs020() { final XQuery query = new XQuery( "fn:deep-equal( xs:float(\"INF\") , xs:double(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Comparing arg1:float, arg2:double values -INF . */ @org.junit.Test public void fnDeepEqualMixArgs021() { final XQuery query = new XQuery( "fn:deep-equal( xs:float(\"-INF\") , xs:double(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Comparing arg1:float, arg2:double values NaN . */ @org.junit.Test public void fnDeepEqualMixArgs022() { final XQuery query = new XQuery( "fn:deep-equal( xs:float(\"NaN\") , xs:double(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Comparing two boolean args . */ @org.junit.Test public void fnDeepEqualMixArgs023() { final XQuery query = new XQuery( "fn:deep-equal( xs:boolean(\"1\") , xs:boolean(\"true\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Comparing two boolean args . */ @org.junit.Test public void fnDeepEqualMixArgs024() { final XQuery query = new XQuery( "fn:deep-equal( xs:boolean(\"true\") , xs:boolean(\"true\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Comparing arg1:boolean arg2:value returned by true fn . */ @org.junit.Test public void fnDeepEqualMixArgs025() { final XQuery query = new XQuery( "fn:deep-equal( xs:boolean(\"true\") , true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Comparing two boolean args . */ @org.junit.Test public void fnDeepEqualMixArgs026() { final XQuery query = new XQuery( "fn:deep-equal( xs:boolean(\"0\") , xs:boolean(\"false\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Comparing arg1:boolean arg2:value of false fn . */ @org.junit.Test public void fnDeepEqualMixArgs027() { final XQuery query = new XQuery( "fn:deep-equal( xs:boolean(\"false\") , false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Comparing arg1:date, arg2: string . */ @org.junit.Test public void fnDeepEqualMixArgs028() { final XQuery query = new XQuery( "fn:deep-equal( xs:date(\"1993-03-31\") , \"1993-03-31\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Comparing arg1:date, arg2: string . */ @org.junit.Test public void fnDeepEqualMixArgs029() { final XQuery query = new XQuery( "fn:deep-equal( xs:date(\"1993-03-31\") , xs:string(\"1993-03-31\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Comparing arg1:dateTime, arg2: string . */ @org.junit.Test public void fnDeepEqualMixArgs030() { final XQuery query = new XQuery( "fn:deep-equal(xs:dateTime(\"1972-12-31T00:00:00\"), \"1972-12-31T00:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Comparing arg1:time, arg2: string . */ @org.junit.Test public void fnDeepEqualMixArgs031() { final XQuery query = new XQuery( "fn:deep-equal(xs:time(\"12:30:00\"), \"12:30:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Apply deep-equal to nodes . */ @org.junit.Test public void fnDeepEqualNodeArgs1() { final XQuery query = new XQuery( "fn:deep-equal( {/bib/node()} /node(), {/bib/node()} /node() )", ctx); try { query.context(node(file("docs/bib.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Apply deep-equal to nodes . */ @org.junit.Test public void fnDeepEqualNodeArgs2() { final XQuery query = new XQuery( "fn:deep-equal( {/bib/node(), /bib/node()} /node(), {/bib/node(), , /bib/node()} /node() )", ctx); try { query.context(node(file("docs/bib.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Apply deep-equal to nodes . */ @org.junit.Test public void fnDeepEqualNodeArgs3() { final XQuery query = new XQuery( "fn:deep-equal( {/node(), /node()} /node(), {/node(), 'difference', /node()} /node() )", ctx); try { query.context(node(file("docs/bib.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Apply deep-equal to nodes . */ @org.junit.Test public void fnDeepEqualNodeArgs4() { final XQuery query = new XQuery( "fn:deep-equal( {/node(), , /node()} /node(), {/node(), , /node()} /node() )", ctx); try { query.context(node(file("docs/bib.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Apply deep-equal to nodes . */ @org.junit.Test public void fnDeepEqualNodeArgs5() { final XQuery query = new XQuery( "fn:deep-equal( {/node(), , /node()} /node(), {/node(), , /node()} /node() )", ctx); try { query.context(node(file("docs/bib.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:double(lower bound) $parameter2 = xs:double(lower bound) . */ @org.junit.Test public void fnDeepEqualdbl2args1() { final XQuery query = new XQuery( "fn:deep-equal((xs:double(\"-1.7976931348623157E308\")),(xs:double(\"-1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:double(mid range) $parameter2 = xs:double(lower bound) . */ @org.junit.Test public void fnDeepEqualdbl2args2() { final XQuery query = new XQuery( "fn:deep-equal((xs:double(\"0\")),(xs:double(\"-1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:double(upper bound) $parameter2 = xs:double(lower bound) . */ @org.junit.Test public void fnDeepEqualdbl2args3() { final XQuery query = new XQuery( "fn:deep-equal((xs:double(\"1.7976931348623157E308\")),(xs:double(\"-1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:double(lower bound) $parameter2 = xs:double(mid range) . */ @org.junit.Test public void fnDeepEqualdbl2args4() { final XQuery query = new XQuery( "fn:deep-equal((xs:double(\"-1.7976931348623157E308\")),(xs:double(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:double(lower bound) $parameter2 = xs:double(upper bound) . */ @org.junit.Test public void fnDeepEqualdbl2args5() { final XQuery query = new XQuery( "fn:deep-equal((xs:double(\"-1.7976931348623157E308\")),(xs:double(\"1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:decimal(lower bound) $parameter2 = xs:decimal(lower bound) . */ @org.junit.Test public void fnDeepEqualdec2args1() { final XQuery query = new XQuery( "fn:deep-equal((xs:decimal(\"-999999999999999999\")),(xs:decimal(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:decimal(mid range) $parameter2 = xs:decimal(lower bound) . */ @org.junit.Test public void fnDeepEqualdec2args2() { final XQuery query = new XQuery( "fn:deep-equal((xs:decimal(\"617375191608514839\")),(xs:decimal(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:decimal(upper bound) $parameter2 = xs:decimal(lower bound) . */ @org.junit.Test public void fnDeepEqualdec2args3() { final XQuery query = new XQuery( "fn:deep-equal((xs:decimal(\"999999999999999999\")),(xs:decimal(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:decimal(lower bound) $parameter2 = xs:decimal(mid range) . */ @org.junit.Test public void fnDeepEqualdec2args4() { final XQuery query = new XQuery( "fn:deep-equal((xs:decimal(\"-999999999999999999\")),(xs:decimal(\"617375191608514839\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:decimal(lower bound) $parameter2 = xs:decimal(upper bound) . */ @org.junit.Test public void fnDeepEqualdec2args5() { final XQuery query = new XQuery( "fn:deep-equal((xs:decimal(\"-999999999999999999\")),(xs:decimal(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:float(lower bound) $parameter2 = xs:float(lower bound) . */ @org.junit.Test public void fnDeepEqualflt2args1() { final XQuery query = new XQuery( "fn:deep-equal((xs:float(\"-3.4028235E38\")),(xs:float(\"-3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:float(mid range) $parameter2 = xs:float(lower bound) . */ @org.junit.Test public void fnDeepEqualflt2args2() { final XQuery query = new XQuery( "fn:deep-equal((xs:float(\"0\")),(xs:float(\"-3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:float(upper bound) $parameter2 = xs:float(lower bound) . */ @org.junit.Test public void fnDeepEqualflt2args3() { final XQuery query = new XQuery( "fn:deep-equal((xs:float(\"3.4028235E38\")),(xs:float(\"-3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:float(lower bound) $parameter2 = xs:float(mid range) . */ @org.junit.Test public void fnDeepEqualflt2args4() { final XQuery query = new XQuery( "fn:deep-equal((xs:float(\"-3.4028235E38\")),(xs:float(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:float(lower bound) $parameter2 = xs:float(upper bound) . */ @org.junit.Test public void fnDeepEqualflt2args5() { final XQuery query = new XQuery( "fn:deep-equal((xs:float(\"-3.4028235E38\")),(xs:float(\"3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:int(lower bound) $parameter2 = xs:int(lower bound) . */ @org.junit.Test public void fnDeepEqualint2args1() { final XQuery query = new XQuery( "fn:deep-equal((xs:int(\"-2147483648\")),(xs:int(\"-2147483648\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:int(mid range) $parameter2 = xs:int(lower bound) . */ @org.junit.Test public void fnDeepEqualint2args2() { final XQuery query = new XQuery( "fn:deep-equal((xs:int(\"-1873914410\")),(xs:int(\"-2147483648\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:int(upper bound) $parameter2 = xs:int(lower bound) . */ @org.junit.Test public void fnDeepEqualint2args3() { final XQuery query = new XQuery( "fn:deep-equal((xs:int(\"2147483647\")),(xs:int(\"-2147483648\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:int(lower bound) $parameter2 = xs:int(mid range) . */ @org.junit.Test public void fnDeepEqualint2args4() { final XQuery query = new XQuery( "fn:deep-equal((xs:int(\"-2147483648\")),(xs:int(\"-1873914410\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:int(lower bound) $parameter2 = xs:int(upper bound) . */ @org.junit.Test public void fnDeepEqualint2args5() { final XQuery query = new XQuery( "fn:deep-equal((xs:int(\"-2147483648\")),(xs:int(\"2147483647\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:integer(lower bound) $parameter2 = xs:integer(lower bound) . */ @org.junit.Test public void fnDeepEqualintg2args1() { final XQuery query = new XQuery( "fn:deep-equal((xs:integer(\"-999999999999999999\")),(xs:integer(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:integer(mid range) $parameter2 = xs:integer(lower bound) . */ @org.junit.Test public void fnDeepEqualintg2args2() { final XQuery query = new XQuery( "fn:deep-equal((xs:integer(\"830993497117024304\")),(xs:integer(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:integer(upper bound) $parameter2 = xs:integer(lower bound) . */ @org.junit.Test public void fnDeepEqualintg2args3() { final XQuery query = new XQuery( "fn:deep-equal((xs:integer(\"999999999999999999\")),(xs:integer(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:integer(lower bound) $parameter2 = xs:integer(mid range) . */ @org.junit.Test public void fnDeepEqualintg2args4() { final XQuery query = new XQuery( "fn:deep-equal((xs:integer(\"-999999999999999999\")),(xs:integer(\"830993497117024304\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:integer(lower bound) $parameter2 = xs:integer(upper bound) . */ @org.junit.Test public void fnDeepEqualintg2args5() { final XQuery query = new XQuery( "fn:deep-equal((xs:integer(\"-999999999999999999\")),(xs:integer(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:long(lower bound) $parameter2 = xs:long(lower bound) . */ @org.junit.Test public void fnDeepEquallng2args1() { final XQuery query = new XQuery( "fn:deep-equal((xs:long(\"-92233720368547758\")),(xs:long(\"-92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:long(mid range) $parameter2 = xs:long(lower bound) . */ @org.junit.Test public void fnDeepEquallng2args2() { final XQuery query = new XQuery( "fn:deep-equal((xs:long(\"-47175562203048468\")),(xs:long(\"-92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:long(upper bound) $parameter2 = xs:long(lower bound) . */ @org.junit.Test public void fnDeepEquallng2args3() { final XQuery query = new XQuery( "fn:deep-equal((xs:long(\"92233720368547758\")),(xs:long(\"-92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:long(lower bound) $parameter2 = xs:long(mid range) . */ @org.junit.Test public void fnDeepEquallng2args4() { final XQuery query = new XQuery( "fn:deep-equal((xs:long(\"-92233720368547758\")),(xs:long(\"-47175562203048468\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:long(lower bound) $parameter2 = xs:long(upper bound) . */ @org.junit.Test public void fnDeepEquallng2args5() { final XQuery query = new XQuery( "fn:deep-equal((xs:long(\"-92233720368547758\")),(xs:long(\"92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:negativeInteger(lower bound) $parameter2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnDeepEqualnint2args1() { final XQuery query = new XQuery( "fn:deep-equal((xs:negativeInteger(\"-999999999999999999\")),(xs:negativeInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:negativeInteger(mid range) $parameter2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnDeepEqualnint2args2() { final XQuery query = new XQuery( "fn:deep-equal((xs:negativeInteger(\"-297014075999096793\")),(xs:negativeInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:negativeInteger(upper bound) $parameter2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnDeepEqualnint2args3() { final XQuery query = new XQuery( "fn:deep-equal((xs:negativeInteger(\"-1\")),(xs:negativeInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:negativeInteger(lower bound) $parameter2 = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnDeepEqualnint2args4() { final XQuery query = new XQuery( "fn:deep-equal((xs:negativeInteger(\"-999999999999999999\")),(xs:negativeInteger(\"-297014075999096793\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:negativeInteger(lower bound) $parameter2 = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnDeepEqualnint2args5() { final XQuery query = new XQuery( "fn:deep-equal((xs:negativeInteger(\"-999999999999999999\")),(xs:negativeInteger(\"-1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:nonNegativeInteger(lower bound) $parameter2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnDeepEqualnni2args1() { final XQuery query = new XQuery( "fn:deep-equal((xs:nonNegativeInteger(\"0\")),(xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:nonNegativeInteger(mid range) $parameter2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnDeepEqualnni2args2() { final XQuery query = new XQuery( "fn:deep-equal((xs:nonNegativeInteger(\"303884545991464527\")),(xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:nonNegativeInteger(upper bound) $parameter2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnDeepEqualnni2args3() { final XQuery query = new XQuery( "fn:deep-equal((xs:nonNegativeInteger(\"999999999999999999\")),(xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:nonNegativeInteger(lower bound) $parameter2 = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnDeepEqualnni2args4() { final XQuery query = new XQuery( "fn:deep-equal((xs:nonNegativeInteger(\"0\")),(xs:nonNegativeInteger(\"303884545991464527\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:nonNegativeInteger(lower bound) $parameter2 = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnDeepEqualnni2args5() { final XQuery query = new XQuery( "fn:deep-equal((xs:nonNegativeInteger(\"0\")),(xs:nonNegativeInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:nonPositiveInteger(lower bound) $parameter2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnDeepEqualnpi2args1() { final XQuery query = new XQuery( "fn:deep-equal((xs:nonPositiveInteger(\"-999999999999999999\")),(xs:nonPositiveInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:nonPositiveInteger(mid range) $parameter2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnDeepEqualnpi2args2() { final XQuery query = new XQuery( "fn:deep-equal((xs:nonPositiveInteger(\"-475688437271870490\")),(xs:nonPositiveInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:nonPositiveInteger(upper bound) $parameter2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnDeepEqualnpi2args3() { final XQuery query = new XQuery( "fn:deep-equal((xs:nonPositiveInteger(\"0\")),(xs:nonPositiveInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:nonPositiveInteger(lower bound) $parameter2 = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnDeepEqualnpi2args4() { final XQuery query = new XQuery( "fn:deep-equal((xs:nonPositiveInteger(\"-999999999999999999\")),(xs:nonPositiveInteger(\"-475688437271870490\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:nonPositiveInteger(lower bound) $parameter2 = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnDeepEqualnpi2args5() { final XQuery query = new XQuery( "fn:deep-equal((xs:nonPositiveInteger(\"-999999999999999999\")),(xs:nonPositiveInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:positiveInteger(lower bound) $parameter2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnDeepEqualpint2args1() { final XQuery query = new XQuery( "fn:deep-equal((xs:positiveInteger(\"1\")),(xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:positiveInteger(mid range) $parameter2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnDeepEqualpint2args2() { final XQuery query = new XQuery( "fn:deep-equal((xs:positiveInteger(\"52704602390610033\")),(xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:positiveInteger(upper bound) $parameter2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnDeepEqualpint2args3() { final XQuery query = new XQuery( "fn:deep-equal((xs:positiveInteger(\"999999999999999999\")),(xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:positiveInteger(lower bound) $parameter2 = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnDeepEqualpint2args4() { final XQuery query = new XQuery( "fn:deep-equal((xs:positiveInteger(\"1\")),(xs:positiveInteger(\"52704602390610033\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:positiveInteger(lower bound) $parameter2 = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnDeepEqualpint2args5() { final XQuery query = new XQuery( "fn:deep-equal((xs:positiveInteger(\"1\")),(xs:positiveInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:short(lower bound) $parameter2 = xs:short(lower bound) . */ @org.junit.Test public void fnDeepEqualsht2args1() { final XQuery query = new XQuery( "fn:deep-equal((xs:short(\"-32768\")),(xs:short(\"-32768\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:short(mid range) $parameter2 = xs:short(lower bound) . */ @org.junit.Test public void fnDeepEqualsht2args2() { final XQuery query = new XQuery( "fn:deep-equal((xs:short(\"-5324\")),(xs:short(\"-32768\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:short(upper bound) $parameter2 = xs:short(lower bound) . */ @org.junit.Test public void fnDeepEqualsht2args3() { final XQuery query = new XQuery( "fn:deep-equal((xs:short(\"32767\")),(xs:short(\"-32768\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:short(lower bound) $parameter2 = xs:short(mid range) . */ @org.junit.Test public void fnDeepEqualsht2args4() { final XQuery query = new XQuery( "fn:deep-equal((xs:short(\"-32768\")),(xs:short(\"-5324\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:short(lower bound) $parameter2 = xs:short(upper bound) . */ @org.junit.Test public void fnDeepEqualsht2args5() { final XQuery query = new XQuery( "fn:deep-equal((xs:short(\"-32768\")),(xs:short(\"32767\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:unsignedLong(lower bound) $parameter2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnDeepEqualulng2args1() { final XQuery query = new XQuery( "fn:deep-equal((xs:unsignedLong(\"0\")),(xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:unsignedLong(mid range) $parameter2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnDeepEqualulng2args2() { final XQuery query = new XQuery( "fn:deep-equal((xs:unsignedLong(\"130747108607674654\")),(xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:unsignedLong(upper bound) $parameter2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnDeepEqualulng2args3() { final XQuery query = new XQuery( "fn:deep-equal((xs:unsignedLong(\"184467440737095516\")),(xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:unsignedLong(lower bound) $parameter2 = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnDeepEqualulng2args4() { final XQuery query = new XQuery( "fn:deep-equal((xs:unsignedLong(\"0\")),(xs:unsignedLong(\"130747108607674654\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:unsignedLong(lower bound) $parameter2 = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnDeepEqualulng2args5() { final XQuery query = new XQuery( "fn:deep-equal((xs:unsignedLong(\"0\")),(xs:unsignedLong(\"184467440737095516\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:unsignedShort(lower bound) $parameter2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnDeepEqualusht2args1() { final XQuery query = new XQuery( "fn:deep-equal((xs:unsignedShort(\"0\")),(xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:unsignedShort(mid range) $parameter2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnDeepEqualusht2args2() { final XQuery query = new XQuery( "fn:deep-equal((xs:unsignedShort(\"44633\")),(xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:unsignedShort(upper bound) $parameter2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnDeepEqualusht2args3() { final XQuery query = new XQuery( "fn:deep-equal((xs:unsignedShort(\"65535\")),(xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:unsignedShort(lower bound) $parameter2 = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnDeepEqualusht2args4() { final XQuery query = new XQuery( "fn:deep-equal((xs:unsignedShort(\"0\")),(xs:unsignedShort(\"44633\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "deep-equal" function with the arguments set as follows: $parameter1 = xs:unsignedShort(lower bound) $parameter2 = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnDeepEqualusht2args5() { final XQuery query = new XQuery( "fn:deep-equal((xs:unsignedShort(\"0\")),(xs:unsignedShort(\"65535\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnDefaultCollation.java000066400000000000000000000070561222453003200304740ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the default-collation() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnDefaultCollation extends QT3TestSet { /** * A test whose essence is: `default-collation(.)`. . */ @org.junit.Test public void kContextDefaultCollationFunc1() { final XQuery query = new XQuery( "default-collation(.)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `default-collation(1, 2)`. . */ @org.junit.Test public void kContextDefaultCollationFunc2() { final XQuery query = new XQuery( "default-collation(1, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `default-collation() eq "http://www.w3.org/2005/xpath-functions/collation/codepoint"`. . */ @org.junit.Test public void kContextDefaultCollationFunc3() { final XQuery query = new XQuery( "default-collation() eq \"http://www.w3.org/2005/xpath-functions/collation/codepoint\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test evalaution of fn:default-collation Author: Tim Mills . */ @org.junit.Test public void cbclDefaultCollation001() { final XQuery query = new XQuery( "fn:count(fn:default-collation())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * test evalaution of fn:boolean on fn:default-collation Author: Tim Mills . */ @org.junit.Test public void cbclDefaultCollation002() { final XQuery query = new XQuery( "fn:boolean(fn:default-collation())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an fn:default-collation function with wrong arity. . */ @org.junit.Test public void fnDefaultCollation1() { final XQuery query = new XQuery( "fn:default-collation(\"An Argument\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Evaluation of an fn:default-collation function that retrieves the default collation. . */ @org.junit.Test public void fnDefaultCollation2() { final XQuery query = new XQuery( "fn:default-collation()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.w3.org/2005/xpath-functions/collation/codepoint") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnDistinctValues.java000066400000000000000000002107201222453003200301760ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the distinct-values() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnDistinctValues extends QT3TestSet { /** * A test whose essence is: `distinct-values()`. . */ @org.junit.Test public void kSeqDistinctValuesFunc1() { final XQuery query = new XQuery( "distinct-values()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `deep-equal(distinct-values((1, 2.0, 3, 2)), (1, 2.0, 3))`. . */ @org.junit.Test public void kSeqDistinctValuesFunc10() { final XQuery query = new XQuery( "deep-equal(distinct-values((1, 2.0, 3, 2)), (1, 2.0, 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `exists(distinct-values((1, 2, 3, 1)))`. . */ @org.junit.Test public void kSeqDistinctValuesFunc11() { final XQuery query = new XQuery( "exists(distinct-values((1, 2, 3, 1)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(empty(distinct-values((1, 1))))`. . */ @org.junit.Test public void kSeqDistinctValuesFunc12() { final XQuery query = new XQuery( "not(empty(distinct-values((1, 1))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(distinct-values((1, 2, 2, current-time()))) eq 3`. . */ @org.junit.Test public void kSeqDistinctValuesFunc13() { final XQuery query = new XQuery( "count(distinct-values((1, 2, 2, current-time()))) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(distinct-values(())) eq 0`. . */ @org.junit.Test public void kSeqDistinctValuesFunc14() { final XQuery query = new XQuery( "count(distinct-values(())) eq 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * fn:distinct-values() applied on an argument of cardinality exactly-one. . */ @org.junit.Test public void kSeqDistinctValuesFunc15() { final XQuery query = new XQuery( "count(distinct-values(current-time())) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke fn:distinct-values() with a collation argument, although the function does not perform string comparison. For that reason, output is valid as well. . */ @org.junit.Test public void kSeqDistinctValuesFunc2() { final XQuery query = new XQuery( "deep-equal(distinct-values((1, 2, 3), \"http://www.example.com/COLLATION/NOT/SUPPORTED\"), (1, 2, 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOCH0002") ) ); } /** * A test whose essence is: `distinct-values("a string", "http://www.w3.org/2005/xpath-functions/collation/codepoint", "wrong param")`. . */ @org.junit.Test public void kSeqDistinctValuesFunc3() { final XQuery query = new XQuery( "distinct-values(\"a string\", \"http://www.w3.org/2005/xpath-functions/collation/codepoint\", \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `distinct-values("a string", "http://www.w3.org/2005/xpath-functions/collation/codepoint") eq "a string"`. . */ @org.junit.Test public void kSeqDistinctValuesFunc4() { final XQuery query = new XQuery( "distinct-values(\"a string\", \"http://www.w3.org/2005/xpath-functions/collation/codepoint\") eq \"a string\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(distinct-values(()))`. . */ @org.junit.Test public void kSeqDistinctValuesFunc5() { final XQuery query = new XQuery( "empty(distinct-values(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * A test whose essence is: `deep-equal(distinct-values( ("1", 1, 2, 1, 1, 3, 1, 1, 3, xs:anyURI("example.com/"), xs:anyURI("example.com/"))), ("1", 1, 2, 3, xs:anyURI("example.com/")))`. . */ @org.junit.Test public void kSeqDistinctValuesFunc6() { final XQuery query = new XQuery( "\n" + " declare function local:canon($arg) {\n" + " for $i in \n" + " for $s in $arg \n" + " return string($s) \n" + " order by $i \n" + " return $i \n" + " }; \n" + " deep-equal(\n" + " local:canon(\n" + " distinct-values((\"1\", 1, 2, 1, 1, 3, 1, 1, 3, xs:anyURI(\"example.com/\"), xs:anyURI(\"example.com/\")))), \n" + " local:canon((\"1\", 1, 2, 3, xs:anyURI(\"example.com/\"))))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `distinct-values((1, 1))`. . */ @org.junit.Test public void kSeqDistinctValuesFunc7() { final XQuery query = new XQuery( "distinct-values((1, 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1") || error("XPTY0004") ) ); } /** * A test whose essence is: `distinct-values((-3, -3))`. . */ @org.junit.Test public void kSeqDistinctValuesFunc8() { final XQuery query = new XQuery( "distinct-values((-3, -3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-3") || error("XPTY0004") ) ); } /** * A test whose essence is: `count(distinct-values((1, 2.0, 3, 2))) eq 3`. . */ @org.junit.Test public void kSeqDistinctValuesFunc9() { final XQuery query = new XQuery( "count(distinct-values((1, 2.0, 3, 2))) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke fn:distinct-values() with an invalid collation. . */ @org.junit.Test public void k2SeqDistinctValuesFunc1() { final XQuery query = new XQuery( "fn:distinct-values((\"1\", \"2\", \"3\"), \"http://www.example.com/COLLATION/NOT/SUPPORTED\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0002") ); } /** * Test fn:distinct-values on a mixture of numeric types containing several NaN values. . */ @org.junit.Test public void cbclDistinctValues001() { final XQuery query = new XQuery( "count(distinct-values((xs:integer(\"3\"), xs:float(\"3\"), xs:float(\"NaN\"), xs:double(\"3\"), xs:double(\"NaN\"), xs:decimal(\"3\"), xs:float(\"3\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * test fn:distinct-values with a mix of types . */ @org.junit.Test public void cbclDistinctValues002() { xquery10(); final XQuery query = new XQuery( "\n" + " \tdeclare function local:create($arg) as xs:anyAtomicType* {\n" + " \t\t( if ($arg castable as xs:untypedAtomic) \n" + " \t\t \tthen $arg cast as xs:untypedAtomic else () ), \n" + " \t\t( if ($arg castable as xs:dateTime) \n" + " \t\t \tthen $arg cast as xs:dateTime else () ), \n" + " \t\t( if ($arg castable as xs:date) \n" + " \t\t \tthen $arg cast as xs:date else () ), \n" + " \t\t( if ($arg castable as xs:time) \n" + " \t\t\tthen $arg cast as xs:time else () ), \n" + " \t\t( if ($arg castable as xs:time) \n" + " \t\t\tthen $arg cast as xs:time else () ), \n" + " \t\t( if ($arg castable as xs:duration) \n" + " \t\t\tthen $arg cast as xs:duration else () ), \n" + " \t\t( if ($arg castable as xs:yearMonthDuration) \n" + " \t\t\tthen $arg cast as xs:yearMonthDuration else () ), \n" + " \t\t( if ($arg castable as xs:dayTimeDuration) \n" + " \t\t\tthen $arg cast as xs:dayTimeDuration else () ), \n" + " \t\t( if ($arg castable as xs:float) \n" + " \t\t\tthen $arg cast as xs:float else () ), \n" + " \t\t( if ($arg castable as xs:double) \n" + " \t\t\tthen $arg cast as xs:double else () ), \n" + " \t\t( if ($arg castable as xs:decimal) \n" + " \t\t\tthen $arg cast as xs:decimal else () ), \n" + " \t\t( if ($arg castable as xs:integer) \n" + " \t\t\tthen $arg cast as xs:integer else () ), \n" + " \t\t( if ($arg castable as xs:nonPositiveInteger) \n" + " \t\t\tthen $arg cast as xs:nonPositiveInteger else () ), \n" + " \t\t( if ($arg castable as xs:negativeInteger) \n" + " \t\t\tthen $arg cast as xs:negativeInteger else () ), \n" + " \t\t( if ($arg castable as xs:long) \n" + " \t\t\tthen $arg cast as xs:long else () ), \n" + " \t\t( if ($arg castable as xs:int) \n" + " \t\t\tthen $arg cast as xs:int else () ), \n" + " \t\t( if ($arg castable as xs:short) \n" + " \t\t\tthen $arg cast as xs:short else () ), \n" + " \t\t( if ($arg castable as xs:byte) \n" + " \t\t\tthen $arg cast as xs:byte else () ), \n" + " \t\t( if ($arg castable as xs:byte) \n" + " \t\t\tthen $arg cast as xs:byte else () ), \n" + " \t\t( if ($arg castable as xs:nonNegativeInteger) \n" + " \t\t\tthen $arg cast as xs:nonNegativeInteger else () ), \n" + " \t\t( if ($arg castable as xs:unsignedLong) \n" + " \t\t\tthen $arg cast as xs:unsignedLong else () ), \n" + " \t\t( if ($arg castable as xs:unsignedInt) \n" + " \t\t\tthen $arg cast as xs:unsignedInt else () ), \n" + " \t\t( if ($arg castable as xs:unsignedShort) \n" + " \t\t\tthen $arg cast as xs:unsignedShort else () ), \n" + " \t\t( if ($arg castable as xs:unsignedByte) \n" + " \t\t\tthen $arg cast as xs:unsignedByte else () ), \n" + " \t\t( if ($arg castable as xs:positiveInteger) \n" + " \t\t\tthen $arg cast as xs:positiveInteger else () ), \n" + " \t\t( if ($arg castable as xs:gYearMonth) \n" + " \t\t\tthen $arg cast as xs:gYearMonth else () ), \n" + " \t\t( if ($arg castable as xs:gYear) \n" + " \t\t\tthen $arg cast as xs:gYear else () ), \n" + " \t\t( if ($arg castable as xs:gMonthDay) \n" + " \t\t\tthen $arg cast as xs:gMonthDay else () ), \n" + " \t\t( if ($arg castable as xs:gDay) \n" + " \t\t\tthen $arg cast as xs:gDay else () ), \n" + " \t\t( if ($arg castable as xs:gMonth) \n" + " \t\t\tthen $arg cast as xs:gMonth else () ), \n" + " \t\t( if ($arg castable as xs:string) \n" + " \t\t\tthen $arg cast as xs:string else () ), \n" + " \t\t( if ($arg castable as xs:normalizedString) \n" + " \t\t\tthen $arg cast as xs:normalizedString else () ), \n" + " \t\t( if ($arg castable as xs:token) \n" + " \t\t\tthen $arg cast as xs:token else () ), \n" + " \t\t( if ($arg castable as xs:language) \n" + " \t\t\tthen $arg cast as xs:language else () ), \n" + " \t\t( if ($arg castable as xs:NMTOKEN) \n" + " \t\t\tthen $arg cast as xs:NMTOKEN else () ), \n" + " \t\t( if ($arg castable as xs:Name) \n" + " \t\t\tthen $arg cast as xs:Name else () ), \n" + " \t\t( if ($arg castable as xs:NCName) \n" + " \t\t\tthen $arg cast as xs:NCName else () ), \n" + " \t\t( if ($arg castable as xs:ID) \n" + " \t\t\tthen $arg cast as xs:ID else () ), \n" + " \t\t( if ($arg castable as xs:IDREF) \n" + " \t\t\tthen $arg cast as xs:IDREF else () ), \n" + " \t\t( if ($arg castable as xs:ENTITY) \n" + " \t\t\tthen $arg cast as xs:ENTITY else () ), \n" + " \t\t( if ($arg castable as xs:boolean) \n" + " \t\t\tthen $arg cast as xs:boolean else () ), \n" + " \t\t( if ($arg castable as xs:base64Binary) \n" + " \t\t\tthen $arg cast as xs:base64Binary else () ), \n" + " \t\t( if ($arg castable as xs:hexBinary) \n" + " \t\t\tthen $arg cast as xs:hexBinary else () ), \n" + " \t\t( if ($arg castable as xs:QName) \n" + " \t\t\tthen $arg cast as xs:QName else () ) \n" + " \t}; \n" + " \tfor $value in fn:distinct-values( ( local:create(0), local:create(-1), local:create(1), local:create(3.141),\n" + " \t \tlocal:create(3.141e0), local:create(3.333), local:create(3.141e0), local:create(3.333e2),\n" + " \t \tlocal:create('NaN'), local:create('zero'), local:create('false'), local:create('true'),\n" + " \t \tlocal:create('http://www.example.com/'), local:create('2008-06-01'), local:create('1972-06-01Z'), \n" + " \t \tlocal:create('2008-06-01T12:00:00'), local:create('1972-06-01T12:00:00+01:00'), \n" + " \t \tlocal:create('00:00:00'), local:create('12:00:00'), local:create('2008'), local:create('1972Z'), \n" + " \t \tlocal:create('--06'), local:create('--12Z'), local:create('2008-06'), local:create('1972-12Z'), \n" + " \t \tlocal:create('--06-01'), local:create('--12-15Z'), local:create('---01'), local:create('---15Z'), \n" + " \t \tlocal:create('P20Y15M'), local:create('P10Y15M'), local:create('-P2DT15H0M0S'), \n" + " \t \tlocal:create('-P1DT15H0M0S'), local:create(fn:QName(\"http://www.example.com/example\", \"person\")), \n" + " \t \tlocal:create(fn:QName(\"http://www.example.com/example\", \"ht:person\")), local:create('-P2DT15H0M0S'), \n" + " \t \tlocal:create('FFFEFDFC'), local:create('aGVsbG8=') )) \n" + " \t order by string($value) return $value", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "---01 ---01 ---15Z ---15Z --06 --06 --06-01 --06-01 --12-15Z --12-15Z --12Z --12Z -1 -1 -P1DT15H -P1DT15H0M0S -P2DT15H -P2DT15H0M0S 0 0 00:00:00 00:00:00 1 1 12:00:00 12:00:00 1972-06-01T12:00:00+01:00 1972-06-01T12:00:00+01:00 1972-06-01Z 1972-06-01Z 1972-12Z 1972-12Z 1972Z 1972Z 2008 2008 2008 2008 2008 2008-06 2008-06 2008-06-01 2008-06-01 2008-06-01T12:00:00 2008-06-01T12:00:00 3 3.141 3.141 3.141 3.333 3.333 3.333 333 333.3 333.3 333.3 FFFEFDFC FFFEFDFC FFFEFDFC NaN NaN P10Y15M P11Y3M P20Y15M P21Y3M aGVsbG8= aGVsbG8= false false ht:person ht:person http://www.example.com/ person true true true zero zero") || assertStringValue(false, "---01 ---01 ---15Z ---15Z --06 --06 --06-01 --06-01 --12-15Z --12-15Z --12Z --12Z -1 -1 -P1DT15H -P1DT15H0M0S -P2DT15H -P2DT15H0M0S 0 0 00:00:00 00:00:00 1 1 12:00:00 12:00:00 1972-06-01T12:00:00+01:00 1972-06-01T12:00:00+01:00 1972-06-01Z 1972-06-01Z 1972-12Z 1972-12Z 1972Z 1972Z 2008 2008 2008 2008 2008 2008-06 2008-06 2008-06-01 2008-06-01 2008-06-01T12:00:00 2008-06-01T12:00:00 3 3.141 3.141 3.141 3.333 3.333 3.333 333 333.3 333.3 333.3 FFFEFDFC FFFEFDFC FFFEFDFC NaN NaN P10Y15M P11Y3M P20Y15M P21Y3M aGVsbG8= aGVsbG8= false false ht:person http://www.example.com/ person person true true true zero zero") || assertStringValue(false, "---01 ---01 ---15Z ---15Z --06 --06 --06-01 --06-01 --12-15Z --12-15Z --12Z --12Z -1 -1 -P1DT15H -P1DT15H0M0S -P2DT15H -P2DT15H0M0S 0 0 00:00:00 00:00:00 1 1 12:00:00 12:00:00 1972-06-01T12:00:00+01:00 1972-06-01T12:00:00+01:00 1972-06-01Z 1972-06-01Z 1972-12Z 1972-12Z 1972Z 1972Z 2008 2008 2008 2008 2008 2008-06 2008-06 2008-06-01 2008-06-01 2008-06-01T12:00:00 2008-06-01T12:00:00 3 3.141 3.141 3.141 3.333 3.333 3.333 333 333.3 333.3 333.3 FFFEFDFC FFFEFDFC FFFEFDFC FFFEFDFC NaN NaN NaN P10Y15M P10Y15M P11Y3M P20Y15M P20Y15M P21Y3M aGVsbG8= aGVsbG8= false false false ht:person http://www.example.com/ person person true true true true zero zero zero") ) ); } /** * test fn:distinct-values with a mix of types . */ @org.junit.Test public void cbclDistinctValues002b() { final XQuery query = new XQuery( "declare function local:create($arg) as xs:anyAtomicType* { ( if ($arg castable as xs:untypedAtomic) then $arg cast as xs:untypedAtomic else () ), ( if ($arg castable as xs:dateTime) then $arg cast as xs:dateTime else () ), ( if ($arg castable as xs:date) then $arg cast as xs:date else () ), ( if ($arg castable as xs:time) then $arg cast as xs:time else () ), ( if ($arg castable as xs:time) then $arg cast as xs:time else () ), ( if ($arg castable as xs:duration) then $arg cast as xs:duration else () ), ( if ($arg castable as xs:yearMonthDuration) then $arg cast as xs:yearMonthDuration else () ), ( if ($arg castable as xs:dayTimeDuration) then $arg cast as xs:dayTimeDuration else () ), ( if ($arg castable as xs:float) then $arg cast as xs:float else () ), ( if ($arg castable as xs:double) then $arg cast as xs:double else () ), ( if ($arg castable as xs:decimal) then $arg cast as xs:decimal else () ), ( if ($arg castable as xs:integer) then $arg cast as xs:integer else () ), ( if ($arg castable as xs:nonPositiveInteger) then $arg cast as xs:nonPositiveInteger else () ), ( if ($arg castable as xs:negativeInteger) then $arg cast as xs:negativeInteger else () ), ( if ($arg castable as xs:long) then $arg cast as xs:long else () ), ( if ($arg castable as xs:int) then $arg cast as xs:int else () ), ( if ($arg castable as xs:short) then $arg cast as xs:short else () ), ( if ($arg castable as xs:byte) then $arg cast as xs:byte else () ), ( if ($arg castable as xs:byte) then $arg cast as xs:byte else () ), ( if ($arg castable as xs:nonNegativeInteger) then $arg cast as xs:nonNegativeInteger else () ), ( if ($arg castable as xs:unsignedLong) then $arg cast as xs:unsignedLong else () ), ( if ($arg castable as xs:unsignedInt) then $arg cast as xs:unsignedInt else () ), ( if ($arg castable as xs:unsignedShort) then $arg cast as xs:unsignedShort else () ), ( if ($arg castable as xs:unsignedByte) then $arg cast as xs:unsignedByte else () ), ( if ($arg castable as xs:positiveInteger) then $arg cast as xs:positiveInteger else () ), ( if ($arg castable as xs:gYearMonth) then $arg cast as xs:gYearMonth else () ), ( if ($arg castable as xs:gYear) then $arg cast as xs:gYear else () ), ( if ($arg castable as xs:gMonthDay) then $arg cast as xs:gMonthDay else () ), ( if ($arg castable as xs:gDay) then $arg cast as xs:gDay else () ), ( if ($arg castable as xs:gMonth) then $arg cast as xs:gMonth else () ), ( if ($arg castable as xs:string) then $arg cast as xs:string else () ), ( if ($arg castable as xs:normalizedString) then $arg cast as xs:normalizedString else () ), ( if ($arg castable as xs:token) then $arg cast as xs:token else () ), ( if ($arg castable as xs:language) then $arg cast as xs:language else () ), ( if ($arg castable as xs:NMTOKEN) then $arg cast as xs:NMTOKEN else () ), ( if ($arg castable as xs:Name) then $arg cast as xs:Name else () ), ( if ($arg castable as xs:NCName) then $arg cast as xs:NCName else () ), ( if ($arg castable as xs:ID) then $arg cast as xs:ID else () ), ( if ($arg castable as xs:IDREF) then $arg cast as xs:IDREF else () ), ( if ($arg castable as xs:ENTITY) then $arg cast as xs:ENTITY else () ), ( if ($arg castable as xs:boolean) then $arg cast as xs:boolean else () ), ( if ($arg castable as xs:base64Binary) then $arg cast as xs:base64Binary else () ), ( if ($arg castable as xs:hexBinary) then $arg cast as xs:hexBinary else () ), ( if ($arg castable as xs:QName) then $arg cast as xs:QName else () ) }; for $value in fn:distinct-values( ( local:create(0), local:create(-1), local:create(1), local:create(3.141), local:create(3.141e0), local:create(3.333), local:create(3.141e0), local:create(3.333e2), local:create('NaN'), local:create('zero'), local:create('false'), local:create('true'), local:create('http://www.example.com/'), local:create('2008-06-01'), local:create('1972-06-01Z'), local:create('2008-06-01T12:00:00'), local:create('1972-06-01T12:00:00+01:00'), local:create('00:00:00'), local:create('12:00:00'), local:create('2008'), local:create('1972Z'), local:create('--06'), local:create('--12Z'), local:create('2008-06'), local:create('1972-12Z'), local:create('--06-01'), local:create('--12-15Z'), local:create('---01'), local:create('---15Z'), local:create('P20Y15M'), local:create('P10Y15M'), local:create('-P2DT15H0M0S'), local:create('-P1DT15H0M0S'), local:create(fn:QName(\"http://www.example.com/example\", \"person\")), local:create(fn:QName(\"http://www.example.com/example\", \"ht:person\")), local:create('-P2DT15H0M0S'), local:create('FFFEFDFC'), local:create('aGVsbG8=') )) order by string($value) return $value", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "---01 ---01 ---15Z ---15Z --06 --06 --06-01 --06-01 --12-15Z --12-15Z --12Z --12Z -1 -1 -P1DT15H -P1DT15H0M0S -P2DT15H -P2DT15H0M0S 0 0 00:00:00 00:00:00 1 1 12:00:00 12:00:00 1972-06-01T12:00:00+01:00 1972-06-01T12:00:00+01:00 1972-06-01Z 1972-06-01Z 1972-12Z 1972-12Z 1972Z 1972Z 2008 2008 2008 2008 2008 2008-06 2008-06 2008-06-01 2008-06-01 2008-06-01T12:00:00 2008-06-01T12:00:00 3 3.141 3.141 3.141 3.333 3.333 3.333 333 333.3 333.3 333.3 FFFEFDFC FFFEFDFC FFFEFDFC FFFEFDFC NaN NaN NaN P10Y15M P10Y15M P11Y3M P20Y15M P20Y15M P21Y3M aGVsbG8= aGVsbG8= false false false ht:person http://www.example.com/ person person true true true true zero zero zero") ); } /** * Test with static context dependant values . */ @org.junit.Test public void cbclDistinctValues003() { final XQuery query = new XQuery( "distinct-values(\n" + " (xs:dateTime(\"2008-01-01T13:00:00\"),\n" + " adjust-dateTime-to-timezone(xs:dateTime(\"2008-01-01T13:00:00\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(1) ); } /** * test fn:distinct-values with xs:date . */ @org.junit.Test public void cbclDistinctValues004() { final XQuery query = new XQuery( "for $value in fn:distinct-values(( xs:date('2008-06-01'), xs:date('2008-06-01'), xs:date('2012-06-01'), xs:date('1918-11-11Z'), xs:date('1972-06-01Z'), xs:date('1972-06-01Z') )) order by $value return $value", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1918-11-11Z 1972-06-01Z 2008-06-01 2012-06-01") ); } /** * test fn:distinct-values with xs:dateTime . */ @org.junit.Test public void cbclDistinctValues005() { final XQuery query = new XQuery( "for $value in fn:distinct-values(( xs:dateTime('2008-06-01T12:00:00'), xs:dateTime('2008-06-01T12:00:00'), xs:dateTime('2008-06-01T00:00:00'), xs:dateTime('2008-06-02T00:00:00'), xs:dateTime('1918-11-11T11:00:00Z'), xs:dateTime('1972-06-01T13:00:00Z'), xs:dateTime('1972-06-01T13:00:00Z') )) order by $value return $value", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1918-11-11T11:00:00Z 1972-06-01T13:00:00Z 2008-06-01T00:00:00 2008-06-01T12:00:00 2008-06-02T00:00:00") ); } /** * test fn:distinct-values with xs:time . */ @org.junit.Test public void cbclDistinctValues006() { final XQuery query = new XQuery( "for $value in fn:distinct-values(( xs:time('12:00:00'), xs:time('11:00:00'), xs:time('12:00:00'))) order by $value return $value", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "11:00:00 12:00:00") ); } /** * test fn:distinct-values with xs:time . */ @org.junit.Test public void cbclDistinctValues007() { final XQuery query = new XQuery( "for $value at $p in ( for $time in fn:distinct-values(( xs:time('12:00:00'), xs:time('12:00:00'), xs:time('20:00:00'), xs:time('01:00:00+12:00'), xs:time('02:00:00+13:00'))) order by $time return $time ) return adjust-time-to-timezone($value, (xs:dayTimeDuration(\"PT0S\")[$p]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "13:00:00Z 12:00:00 20:00:00") ); } /** * test fn:distinct-values with xs:hexBinary . */ @org.junit.Test public void cbclDistinctValues008() { final XQuery query = new XQuery( "for $value in fn:distinct-values(( xs:hexBinary('FFFF'), xs:hexBinary('FFFF'), xs:hexBinary('FFFE'), xs:hexBinary('FF'))) order by string($value) return $value", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "FF FFFE FFFF") ); } /** * test fn:distinct-values with xs:base64Binary . */ @org.junit.Test public void cbclDistinctValues009() { final XQuery query = new XQuery( "for $value in fn:distinct-values(( xs:base64Binary('aGVsbG8NCg=='), xs:base64Binary('aGVsbG8NCg=='), xs:base64Binary('aGFsbG8NCg=='), xs:base64Binary('aGkNCg=='))) order by string($value) return $value", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "aGFsbG8NCg== aGVsbG8NCg== aGkNCg==") ); } /** * test fn:distinct-values with xs:untypedAtomic . */ @org.junit.Test public void cbclDistinctValues010() { final XQuery query = new XQuery( "for $value in fn:distinct-values(( xs:untypedAtomic('a'), xs:untypedAtomic('a'), xs:untypedAtomic('b'), xs:untypedAtomic(''))) order by string($value) return $value", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, " a b") ); } /** * test fn:distinct-values with xs:string . */ @org.junit.Test public void cbclDistinctValues011() { final XQuery query = new XQuery( "for $value in fn:distinct-values(( xs:string('a'), xs:string('a'), xs:string('b'), xs:string(''))) order by string($value) return $value", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, " a b") ); } /** * test fn:distinct-values with xs:gYear . */ @org.junit.Test public void cbclDistinctValues012() { final XQuery query = new XQuery( "for $value in fn:distinct-values(( xs:gYear('2008'), xs:gYear('2008'), xs:gYear('1972'))) order by string($value) return $value", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1972 2008") ); } /** * test fn:distinct-values with durations . */ @org.junit.Test public void cbclDistinctValues013() { final XQuery query = new XQuery( "for $value in fn:distinct-values(( xs:dayTimeDuration('P0D'), xs:yearMonthDuration('P0Y'), xs:duration('P0Y'), xs:duration('P0Y'), xs:yearMonthDuration('P0Y'), xs:dayTimeDuration('P0D'), xs:dayTimeDuration('P1D'), xs:yearMonthDuration('P1Y'), xs:duration('P1Y'))) order by string($value) return $value", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1D P1Y PT0S") ); } /** * test fn:distinct-values with xs:gMnnthDay . */ @org.junit.Test public void cbclDistinctValues014() { final XQuery query = new XQuery( "for $value in fn:distinct-values(( xs:gMonthDay('--06-16'), xs:gMonthDay('--06-16'), xs:gMonthDay('--12-15'))) order by string($value) return $value", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--06-16 --12-15") ); } /** * Tests distinct values with unknown, but unneeded collation . */ @org.junit.Test public void cbclDistinctValues016() { final XQuery query = new XQuery( "for $x in 65 to 75 return distinct-values(1 to 10,codepoints-to-string($x to $x+10))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10") || error("FOCH0002") ) ); } /** * Test Bugzilla #5183, [FO] Effect of type promotion in fn:distinct-values . */ @org.junit.Test public void fnDistinctValues1() { final XQuery query = new XQuery( "\n" + " let $input := (xs:float('1.0'), xs:decimal('1.0000000000100000000001'), \n" + " xs:double( '1.00000000001'), xs:float('2.0'), \n" + " xs:decimal('2.0000000000100000000001'), xs:double( '2.00000000001')), \n" + " $distinct := distinct-values($input) \n" + " return ( (every $n in $input satisfies $n = $distinct) and \n" + " (every $bool in (for $d1 at $p in $distinct, $d2 in $distinct [position() > $p] return $d1 eq $d2) satisfies not($bool)) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * distinct-values() on a somewhat larger set of values. */ @org.junit.Test public void fnDistinctValues2() { final XQuery query = new XQuery( "distinct-values((1 to 300, 100 to 400, 29, 145, 20 to 50, for $x in (30 to 40) return xs:string($x), \"foo\", \"bar\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("1 to 400, \"30\", \"31\", \"32\", \"33\", \"34\", \"35\", \"36\", \"37\", \"38\", \"39\", \"40\", \"foo\", \"bar\"") ); } /** * arg: sequence of integer & decimal . */ @org.junit.Test public void fnDistinctValuesMixedArgs001() { final XQuery query = new XQuery( "fn:distinct-values((1, 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "2 1") || assertStringValue(false, "1 2") ) ); } /** * arg: sequence of integer . */ @org.junit.Test public void fnDistinctValuesMixedArgs002() { final XQuery query = new XQuery( "fn:distinct-values(( 1, (1), ((1)) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * arg: sequence of integer & double . */ @org.junit.Test public void fnDistinctValuesMixedArgs003() { final XQuery query = new XQuery( "fn:distinct-values(( 1, 1.0e0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertCount(1) && assertEq("1") && ( assertType("xs:integer") || assertType("xs:double") ) ) ); } /** * arg: sequence of integer . */ @org.junit.Test public void fnDistinctValuesMixedArgs004() { final XQuery query = new XQuery( "fn:distinct-values(( xs:integer(1), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * arg: sequence of integer & double . */ @org.junit.Test public void fnDistinctValuesMixedArgs005() { final XQuery query = new XQuery( "fn:distinct-values(( 0e0, -0, 0, 1 ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("1, 0") ); } /** * arg: sequence of string . */ @org.junit.Test public void fnDistinctValuesMixedArgs006() { final XQuery query = new XQuery( "fn:distinct-values(( \"cat\", 'CAT' ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"cat\", \"CAT\"") ); } /** * arg: sequence of string . */ @org.junit.Test public void fnDistinctValuesMixedArgs007() { final XQuery query = new XQuery( "fn:distinct-values(( xs:string(\"hello\"), \"hello\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "hello") ); } /** * arg: sequence of string . */ @org.junit.Test public void fnDistinctValuesMixedArgs008() { final XQuery query = new XQuery( "fn:distinct-values(( xs:string(\"\"), \"\", ''))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * arg: sequence of integer,decimal,boolean,string . */ @org.junit.Test public void fnDistinctValuesMixedArgs009() { final XQuery query = new XQuery( "fn:distinct-values((1, true(), true(), ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("1, true()") ); } /** * arg: sequence of decimal . */ @org.junit.Test public void fnDistinctValuesMixedArgs010() { final XQuery query = new XQuery( "fn:distinct-values((xs:decimal('1.2'), xs:decimal('1.2000000000000001')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("1.2000000000000001, 1.2") ); } /** * arg: sequence of decimal & string . */ @org.junit.Test public void fnDistinctValuesMixedArgs011() { final XQuery query = new XQuery( "fn:distinct-values((xs:decimal('1.2'), '1.2'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"1.2\", 1.2") ); } /** * arg: sequence of decimal & float . */ @org.junit.Test public void fnDistinctValuesMixedArgs012() { final XQuery query = new XQuery( "fn:distinct-values((xs:decimal('1.2'), xs:float('1.2')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.2") ); } /** * arg: sequence of decimal & double . */ @org.junit.Test public void fnDistinctValuesMixedArgs013() { final XQuery query = new XQuery( "fn:distinct-values((xs:decimal('1.2'), xs:double('1.2')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.2") ); } /** * arg: sequence of float & string . */ @org.junit.Test public void fnDistinctValuesMixedArgs014() { final XQuery query = new XQuery( "fn:distinct-values((xs:float('NaN'), 'NaN'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN NaN") ); } /** * arg: sequence of float & string . */ @org.junit.Test public void fnDistinctValuesMixedArgs015() { final XQuery query = new XQuery( "fn:distinct-values((xs:float('INF'), 'INF'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF INF") ); } /** * arg: sequence of float & string . */ @org.junit.Test public void fnDistinctValuesMixedArgs016() { final XQuery query = new XQuery( "fn:distinct-values((xs:float('-INF'), '-INF'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-INF -INF") ); } /** * arg: sequence of float & float . */ @org.junit.Test public void fnDistinctValuesMixedArgs017() { final XQuery query = new XQuery( "fn:distinct-values((xs:float('INF'), xs:float('INF')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** * arg: sequence of float & float . */ @org.junit.Test public void fnDistinctValuesMixedArgs018() { final XQuery query = new XQuery( "fn:distinct-values((xs:float('-INF'), xs:float('INF')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("xs:float('-INF'), xs:float('INF')") ); } /** * arg: sequence of float & float . */ @org.junit.Test public void fnDistinctValuesMixedArgs019() { final XQuery query = new XQuery( "fn:distinct-values((xs:float('NaN'), xs:float('NaN')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * arg: sequence of float & float . */ @org.junit.Test public void fnDistinctValuesMixedArgs020() { final XQuery query = new XQuery( "fn:distinct-values((xs:float('NaN'), xs:float('NaN')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * arg: sequence of float & double . */ @org.junit.Test public void fnDistinctValuesMixedArgs021() { final XQuery query = new XQuery( "fn:distinct-values((xs:float('NaN'), xs:double('NaN')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * arg: sequence of float & double . */ @org.junit.Test public void fnDistinctValuesMixedArgs022() { final XQuery query = new XQuery( "fn:distinct-values((xs:float('INF'), xs:double('INF')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** * arg: sequence of float & double . */ @org.junit.Test public void fnDistinctValuesMixedArgs023() { final XQuery query = new XQuery( "fn:distinct-values((xs:float('-INF'), xs:double('-INF')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-INF") ); } /** * arg: sequence of double & double . */ @org.junit.Test public void fnDistinctValuesMixedArgs024() { final XQuery query = new XQuery( "fn:distinct-values((xs:double('-INF'), xs:double('INF')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "INF -INF") || assertStringValue(false, "-INF INF") ) ); } /** * arg: sequence of double & double . */ @org.junit.Test public void fnDistinctValuesMixedArgs025() { final XQuery query = new XQuery( "fn:distinct-values((xs:double('NaN'), xs:double('NaN')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * arg: sequence of double & double . */ @org.junit.Test public void fnDistinctValuesMixedArgs026() { final XQuery query = new XQuery( "fn:distinct-values((xs:double('NaN'), xs:double('NaN')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * arg: sequence of string . */ @org.junit.Test public void fnDistinctValuesMixedArgs027() { final XQuery query = new XQuery( "fn:distinct-values((\"NaN\", \"-NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "NaN -NaN") || assertStringValue(false, "-NaN NaN") ) ); } /** * arg: sequence of string . */ @org.junit.Test public void fnDistinctValuesMixedArgs028() { final XQuery query = new XQuery( "fn:distinct-values((\"-INF\", \"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "INF -INF") || assertStringValue(false, "-INF INF") ) ); } /** * arg: sequence of boolean . */ @org.junit.Test public void fnDistinctValuesMixedArgs029() { final XQuery query = new XQuery( "fn:distinct-values((xs:boolean('true'), true()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * arg: sequence of boolean . */ @org.junit.Test public void fnDistinctValuesMixedArgs030() { final XQuery query = new XQuery( "fn:distinct-values((xs:boolean('true'), xs:boolean('1')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * arg: sequence of boolean . */ @org.junit.Test public void fnDistinctValuesMixedArgs031() { final XQuery query = new XQuery( "fn:distinct-values((xs:boolean('false'), xs:boolean('0')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * arg: sequence of boolean . */ @org.junit.Test public void fnDistinctValuesMixedArgs032() { final XQuery query = new XQuery( "fn:distinct-values(( true(), false(), () ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("true(), false()") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:double(lower bound) . */ @org.junit.Test public void fnDistinctValuesdbl1args1() { final XQuery query = new XQuery( "fn:distinct-values((xs:double(\"-1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.7976931348623157E308") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:double(mid range) . */ @org.junit.Test public void fnDistinctValuesdbl1args2() { final XQuery query = new XQuery( "fn:distinct-values((xs:double(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:double(upper bound) . */ @org.junit.Test public void fnDistinctValuesdbl1args3() { final XQuery query = new XQuery( "fn:distinct-values((xs:double(\"1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.7976931348623157E308") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:decimal(lower bound) . */ @org.junit.Test public void fnDistinctValuesdec1args1() { final XQuery query = new XQuery( "fn:distinct-values((xs:decimal(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:decimal(mid range) . */ @org.junit.Test public void fnDistinctValuesdec1args2() { final XQuery query = new XQuery( "fn:distinct-values((xs:decimal(\"617375191608514839\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("617375191608514839") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:decimal(upper bound) . */ @org.junit.Test public void fnDistinctValuesdec1args3() { final XQuery query = new XQuery( "fn:distinct-values((xs:decimal(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:float(lower bound) . */ @org.junit.Test public void fnDistinctValuesflt1args1() { final XQuery query = new XQuery( "fn:distinct-values((xs:float(\"-3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(\"-3.4028235E38\")") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:float(mid range) . */ @org.junit.Test public void fnDistinctValuesflt1args2() { final XQuery query = new XQuery( "fn:distinct-values((xs:float(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:float(upper bound) . */ @org.junit.Test public void fnDistinctValuesflt1args3() { final XQuery query = new XQuery( "fn:distinct-values((xs:float(\"3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(\"3.4028235E38\")") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:int(lower bound) . */ @org.junit.Test public void fnDistinctValuesint1args1() { final XQuery query = new XQuery( "fn:distinct-values((xs:int(\"-2147483648\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2147483648") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:int(mid range) . */ @org.junit.Test public void fnDistinctValuesint1args2() { final XQuery query = new XQuery( "fn:distinct-values((xs:int(\"-1873914410\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1873914410") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:int(upper bound) . */ @org.junit.Test public void fnDistinctValuesint1args3() { final XQuery query = new XQuery( "fn:distinct-values((xs:int(\"2147483647\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2147483647") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:integer(lower bound) . */ @org.junit.Test public void fnDistinctValuesintg1args1() { final XQuery query = new XQuery( "fn:distinct-values((xs:integer(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:integer(mid range) . */ @org.junit.Test public void fnDistinctValuesintg1args2() { final XQuery query = new XQuery( "fn:distinct-values((xs:integer(\"830993497117024304\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("830993497117024304") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:integer(upper bound) . */ @org.junit.Test public void fnDistinctValuesintg1args3() { final XQuery query = new XQuery( "fn:distinct-values((xs:integer(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:long(lower bound) . */ @org.junit.Test public void fnDistinctValueslng1args1() { final XQuery query = new XQuery( "fn:distinct-values((xs:long(\"-92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:long(mid range) . */ @org.junit.Test public void fnDistinctValueslng1args2() { final XQuery query = new XQuery( "fn:distinct-values((xs:long(\"-47175562203048468\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-47175562203048468") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:long(upper bound) . */ @org.junit.Test public void fnDistinctValueslng1args3() { final XQuery query = new XQuery( "fn:distinct-values((xs:long(\"92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("92233720368547758") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnDistinctValuesnint1args1() { final XQuery query = new XQuery( "fn:distinct-values((xs:negativeInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnDistinctValuesnint1args2() { final XQuery query = new XQuery( "fn:distinct-values((xs:negativeInteger(\"-297014075999096793\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-297014075999096793") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnDistinctValuesnint1args3() { final XQuery query = new XQuery( "fn:distinct-values((xs:negativeInteger(\"-1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnDistinctValuesnni1args1() { final XQuery query = new XQuery( "fn:distinct-values((xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnDistinctValuesnni1args2() { final XQuery query = new XQuery( "fn:distinct-values((xs:nonNegativeInteger(\"303884545991464527\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("303884545991464527") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnDistinctValuesnni1args3() { final XQuery query = new XQuery( "fn:distinct-values((xs:nonNegativeInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnDistinctValuesnpi1args1() { final XQuery query = new XQuery( "fn:distinct-values((xs:nonPositiveInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnDistinctValuesnpi1args2() { final XQuery query = new XQuery( "fn:distinct-values((xs:nonPositiveInteger(\"-475688437271870490\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-475688437271870490") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnDistinctValuesnpi1args3() { final XQuery query = new XQuery( "fn:distinct-values((xs:nonPositiveInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnDistinctValuespint1args1() { final XQuery query = new XQuery( "fn:distinct-values((xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnDistinctValuespint1args2() { final XQuery query = new XQuery( "fn:distinct-values((xs:positiveInteger(\"52704602390610033\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("52704602390610033") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnDistinctValuespint1args3() { final XQuery query = new XQuery( "fn:distinct-values((xs:positiveInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:short(lower bound) . */ @org.junit.Test public void fnDistinctValuessht1args1() { final XQuery query = new XQuery( "fn:distinct-values((xs:short(\"-32768\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-32768") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:short(mid range) . */ @org.junit.Test public void fnDistinctValuessht1args2() { final XQuery query = new XQuery( "fn:distinct-values((xs:short(\"-5324\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-5324") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:short(upper bound) . */ @org.junit.Test public void fnDistinctValuessht1args3() { final XQuery query = new XQuery( "fn:distinct-values((xs:short(\"32767\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("32767") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnDistinctValuesulng1args1() { final XQuery query = new XQuery( "fn:distinct-values((xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnDistinctValuesulng1args2() { final XQuery query = new XQuery( "fn:distinct-values((xs:unsignedLong(\"130747108607674654\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("130747108607674654") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnDistinctValuesulng1args3() { final XQuery query = new XQuery( "fn:distinct-values((xs:unsignedLong(\"184467440737095516\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("184467440737095516") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnDistinctValuesusht1args1() { final XQuery query = new XQuery( "fn:distinct-values((xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnDistinctValuesusht1args2() { final XQuery query = new XQuery( "fn:distinct-values((xs:unsignedShort(\"44633\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("44633") ); } /** * Evaluates The "distinct-values" function with the arguments set as follows: $arg = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnDistinctValuesusht1args3() { final XQuery query = new XQuery( "fn:distinct-values((xs:unsignedShort(\"65535\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("65535") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnDoc.java000066400000000000000000000761211222453003200257470ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the doc() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnDoc extends QT3TestSet { /** * Invoke fn:doc() on the empty sequence. . */ @org.junit.Test public void k2SeqDocFunc1() { final XQuery query = new XQuery( "empty(fn:doc(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke fn:doc() with a static base-uri that is complete, but doesn't point to a file. . */ @org.junit.Test public void k2SeqDocFunc10() { final XQuery query = new XQuery( "doc(\"\")", ctx); try { query.baseURI("file:///directory/directory/example.com/www.example.com/thisFileDoesNotExist.xml"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0002") ); } /** * Invoke fn:doc() with a static base-uri that points to a non-existent directory. . */ @org.junit.Test public void k2SeqDocFunc11() { final XQuery query = new XQuery( "doc(\"\")", ctx); try { query.baseURI("file:///directory/directory/example.com/"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0002") ); } /** * General query complexity, combined with a call to fn:doc() that is never evaluated. . */ @org.junit.Test public void k2SeqDocFunc12() { final XQuery query = new XQuery( "\n" + " declare variable $fileToOpen := ; \n" + " empty($fileToOpen//*[let $i := @type return doc($fileToOpen)//*[$i]])\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Never use the result of calls to fn:doc. Since implementations are allowed to dereference the sources in any case, an error is allowed. . */ @org.junit.Test public void k2SeqDocFunc13() { final XQuery query = new XQuery( "\n" + " declare variable $doc1 := doc(\"http://example.com\"); \n" + " let $doc2 := doc(\"ftp://example.com/\") \n" + " for $i in doc(\"localFile.xml\") \n" + " return (1, 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "1 2 3") || error("FODC0002") ) ); } /** * ':/' is an invalid URI, no scheme. . */ @org.junit.Test public void k2SeqDocFunc14() { final XQuery query = new XQuery( "doc(':/')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0005") ); } /** * Invoke fn:doc() on the empty sequence(#2). . */ @org.junit.Test public void k2SeqDocFunc2() { final XQuery query = new XQuery( "{fn:doc(())}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Load an unexisting file via the file:// protocol. . */ @org.junit.Test public void k2SeqDocFunc3() { final XQuery query = new XQuery( "fn:doc(xs:untypedAtomic(\"file:///example.com/does/not/exist/xqts-testing.xml\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0002") ); } /** * Invoke fn:doc with a relative, Unix-like URI. Since it's relative, and the base-uri may be undefined, XPST0001 is allowed. . */ @org.junit.Test public void k2SeqDocFunc4() { final XQuery query = new XQuery( "doc(\"/example.com/example.org/does/not/exist/doesNotExist/works-mod.xml\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FODC0002") || error("XPST0001") ) ); } /** * Invoke fn:doc with a relative, Unix-like URI and a declared base-uri. . */ @org.junit.Test public void k2SeqDocFunc5() { final XQuery query = new XQuery( "doc(\"/example.com/example.org/does/not/exist/doesNotExist/works-mod.xml\")", ctx); try { query.baseURI("http://www.example.invalid"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0002") ); } /** * Invoke fn:doc with a relative, Unix-like URI and a declared base-uri. . */ @org.junit.Test public void k2SeqDocFunc6() { final XQuery query = new XQuery( "doc(\"/example.com/example.org/does/not/exist/doesNotExist/works-mod.xml\")", ctx); try { query.baseURI("file:///"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0002") ); } /** * A windows file path is an invalid URI to fn:doc(). . */ @org.junit.Test public void k2SeqDocFunc7() { final XQuery query = new XQuery( "doc(\"example.com\\example.org\\does\\not\\exist\\doesNotExist\\works-mod.xml\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0002") ); } /** * A windows file path is an invalid URI to fn:doc()(#2). . */ @org.junit.Test public void k2SeqDocFunc8() { final XQuery query = new XQuery( "doc(\"\\example.com\\example.org\\does\\not\\exist\\doesNotExist\\works-mod.xml\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0002") ); } /** * A windows file path is an invalid URI to fn:doc()(#3). . */ @org.junit.Test public void k2SeqDocFunc9() { final XQuery query = new XQuery( "doc(\"C:\\example.com\\example.org\\does\\not\\exist\\doesNotExist\\works-mod.xml\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FODC0002") || error("FODC0005") ) ); } /** * Evaluation of fn:doc function with an invalid argument. . */ @org.junit.Test public void fnDoc1() { final XQuery query = new XQuery( "fn:doc(\"http:\\\\invalid>URI\\someURI\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FODC0005") || error("FODC0002") ) ); } /** * Evaluation of fn:doc as an argument to the fn:nilled function. . */ @org.junit.Test public void fnDoc15() { final XQuery query = new XQuery( "fn:count(fn:nilled(fn:doc($uri)))", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.bind("uri", new XQuery("'http://www.w3.org/fots/docs/works-mod.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of fn:doc as an argument to the fn:node-name function. Use fn:count to avoid empty file. . */ @org.junit.Test public void fnDoc16() { final XQuery query = new XQuery( "fn:count(fn:node-name(fn:doc($uri)))", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.bind("uri", new XQuery("'http://www.w3.org/fots/docs/works-mod.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of fn:doc with argument set to an invalid URI. . */ @org.junit.Test public void fnDoc17() { final XQuery query = new XQuery( "fn:doc(\"%gg\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FODC0002") || error("FODC0005") ) ); } /** * Evaluation of fn:doc used with "is" operator and the fn:not function. . */ @org.junit.Test public void fnDoc18() { final XQuery query = new XQuery( "fn:not(fn:doc($uri) is fn:doc($uri))", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.bind("uri", new XQuery("'http://www.w3.org/fots/docs/works-mod.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of fn:doc used with "is" operator and the fn:true function with "and" operator. . */ @org.junit.Test public void fnDoc19() { final XQuery query = new XQuery( "(fn:doc($uri) is fn:doc($uri)) and fn:true()", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.bind("uri", new XQuery("'http://www.w3.org/fots/docs/works-mod.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of fn:doc function with wrong arity. . */ @org.junit.Test public void fnDoc2() { final XQuery query = new XQuery( "fn:doc(\"argument1\",\"argument2\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Evaluation of fn:doc used with "is" operator and the fn:false function with "and" operator. . */ @org.junit.Test public void fnDoc20() { final XQuery query = new XQuery( "(fn:doc($uri) is fn:doc($uri)) and fn:false()", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.bind("uri", new XQuery("'http://www.w3.org/fots/docs/works-mod.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of fn:doc used with "is" operator and the fn:true function with "or" operator. . */ @org.junit.Test public void fnDoc21() { final XQuery query = new XQuery( "(fn:doc($uri) is fn:doc($uri)) or fn:true()", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.bind("uri", new XQuery("'http://www.w3.org/fots/docs/works-mod.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of fn:doc used with "is" operator and the fn:false function with "or" operator. . */ @org.junit.Test public void fnDoc22() { final XQuery query = new XQuery( "(fn:doc($uri) is fn:doc($uri)) or fn:false()", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.bind("uri", new XQuery("'http://www.w3.org/fots/docs/works-mod.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Open a document that has a text node containing ' ]'. Use a relative URI.. */ @org.junit.Test public void fnDoc24() { final XQuery query = new XQuery( "fn:doc($uri)", ctx); try { query.addDocument("id/SpaceBracket.xml", file("fn/id/SpaceBracket.xml")); query.bind("uri", new XQuery("'id/SpaceBracket.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("

    ]

    ", false) ); } /** * Open a document that has an element node with an unusual name. . */ @org.junit.Test public void fnDoc25() { final XQuery query = new XQuery( "fn:doc($uri)", ctx); try { query.addDocument("id/HighUnicode.xml", file("fn/id/HighUnicode.xml")); query.bind("uri", new XQuery("'id/HighUnicode.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("<เจมส์>", false) ); } /** * Open a document that has a text node containing ' ]'. . */ @org.junit.Test public void fnDoc26() { final XQuery query = new XQuery( "fn:doc($uri)", ctx); try { query.addDocument("id/HighUnicode2.xml", file("fn/id/HighUnicode2.xml")); query.bind("uri", new XQuery("'id/HighUnicode2.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("<เจมส์/>", false) ); } /** * Use a series of corner case Unicode codepoints. . */ @org.junit.Test public void fnDoc27() { final XQuery query = new XQuery( "fn:doc($uri)", ctx); try { query.addDocument("id/BCisInvalid.xml", file("fn/id/BCisInvalid.xml")); query.bind("uri", new XQuery("'id/BCisInvalid.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0002") ); } /** * Open a document which contains the codepoint 188 in an NCName. . */ @org.junit.Test public void fnDoc28() { final XQuery query = new XQuery( "fn:doc($uri)", ctx); try { query.addDocument("id/InvalidUmlaut.xml", file("fn/id/InvalidUmlaut.xml")); query.bind("uri", new XQuery("'id/InvalidUmlaut.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0002") ); } /** * Use a namespace declaration which is available in the subset. . */ @org.junit.Test public void fnDoc29() { final XQuery query = new XQuery( "fn:doc($uri)", ctx); try { query.addDocument("id/NamespaceSuppliedInternally.xml", file("fn/id/NamespaceSuppliedInternally.xml")); query.bind("uri", new XQuery("'id/NamespaceSuppliedInternally.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Evaluation of fn:doc, which tries to retrieve a non-existent resourse. . */ @org.junit.Test public void fnDoc3() { final XQuery query = new XQuery( "fn:doc(\"thisfileshouldnotexists.xml\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0002") ); } /** * Open an XML document that has an xml:id attribute duplicated. . */ @org.junit.Test public void fnDoc30() { final XQuery query = new XQuery( "local-name(fn:doc($uri)/*)", ctx); try { query.addDocument("id/XMLIdDuplicated.xml", file("fn/id/XMLIdDuplicated.xml")); query.bind("uri", new XQuery("'id/XMLIdDuplicated.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "schema") || error("FODC0002") ) ); } /** * Open an XML document that has an invald xml:id attribute. . */ @org.junit.Test public void fnDoc31() { final XQuery query = new XQuery( "local-name(fn:doc($uri)/*)", ctx); try { query.addDocument("id/InvalidXMLId.xml", file("fn/id/InvalidXMLId.xml")); query.bind("uri", new XQuery("'id/InvalidXMLId.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "schema") || error("FODC0002") ) ); } /** * Open an XML document that has ISO-8859-1 as encoding. . */ @org.junit.Test public void fnDoc32() { final XQuery query = new XQuery( "string(fn:doc($uri)), string(exactly-one(fn:doc($uri)/*))", ctx); try { query.addDocument("id/Books2.xml", file("fn/id/Books2.xml")); query.bind("uri", new XQuery("'id/Books2.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "\n Everyday Italian\n Giada De Laurentiis\n \n Everyday Italian\n Giada De Laurentiis\n") ); } /** * A moderately complex query. , local:recurseMetaObject($metaObjects[@superClass = $object/@className], $count + 1) Output an xml:id attribute on each group element, if we have a name. . */ @org.junit.Test public void fnDoc33() { final XQuery query = new XQuery( "\n" + " declare namespace s = \"http://www.w3.org/2000/svg\"; \n" + " declare variable $uri external; \n" + " declare variable $root := doc($uri)/root/QObject; \n" + " declare variable $metaObjects := $root/preceding-sibling::metaObjects/metaObject; \n" + " declare function local:recurseMetaObject($object as element(metaObject), $count as xs:integer) { \n" + " {\n" + " string($object/@className)} \n" + " }; \n" + " declare function local:drawDiagram($object as element(QObject)) as element(s:g) { \n" + " { if(string($object/@objectName)) \n" + " then attribute xml:id {$object/@objectName} \n" + " else (), \n" + " $metaObjects[@className = $object/@className]/local:recurseMetaObject(., 1) } \n" + " }; \n" + " { \n" + " , \n" + " , \n" + " for $object in $root//QObject for $i in local:drawDiagram($object) stable order by string($i) return $i \n" + " } \n" + " ", ctx); try { query.addDocument("id/QObject.xml", file("fn/id/QObject.xml")); query.bind("uri", new XQuery("'id/QObject.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("QBoxLayoutQBoxLayoutQBoxLayoutQBoxLayoutQBoxLayoutQBoxLayoutQBoxLayoutQBoxLayoutQHBoxLayoutQHBoxLayoutQHBoxLayoutQSizeGripQTabWidgetQTimerQTimerQToolButtonQToolButtonQToolButtonQWidgetQWidgetQWidgetQWidgetQWidgetQWidgetQWidgetQWidgetQWidgetQWidgetQWidgetQWidgetQWidgetQWidgetQWidgetQWidgetQWidgetAnimator", false) ); } /** * A moderately complex query. . */ @org.junit.Test public void fnDoc34() { final XQuery query = new XQuery( "doc($uri)", ctx); try { query.addDocument("id/0x010D.xml", file("fn/id/0x010D.xml")); query.bind("uri", new XQuery("'id/0x010D.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Load a not-wellformed XML file. . */ @org.junit.Test public void fnDoc35() { final XQuery query = new XQuery( "doc('id/badxml.xml')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0002") ); } /** * Count text nodes in a document containing character references. . */ @org.junit.Test public void fnDoc36() { final XQuery query = new XQuery( "count(doc($uri)//text())", ctx); try { query.addDocument("id/builtinEntities.xml", file("fn/id/builtinEntities.xml")); query.bind("uri", new XQuery("'id/builtinEntities.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("9") ); } /** * Use an xml:id attribute that has whitespace, whitespace normalization is performed. . */ @org.junit.Test public void fnDoc37() { final XQuery query = new XQuery( "let $result := id(\"idABC\", doc($uri)) return (empty($result), $result)", ctx); try { query.addDocument("id/XMLIdWhitespace.xml", file("fn/id/XMLIdWhitespace.xml")); query.bind("uri", new XQuery("'id/XMLIdWhitespace.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || assertSerialization("false", false) ) ); } /** * Evaluation of fn:doc with argument set to empty sequence. . */ @org.junit.Test public void fnDoc4() { final XQuery query = new XQuery( "fn:doc(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of fn:doc as per example 1 from the functions and Ops. for this function. . */ @org.junit.Test public void fnDoc5() { final XQuery query = new XQuery( "fn:doc($uri) is fn:doc($uri)", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.bind("uri", new XQuery("'http://www.w3.org/fots/docs/works-mod.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of fn:doc used with different resourses and the "is" operator. . */ @org.junit.Test public void fnDoc6() { final XQuery query = new XQuery( "fn:doc($works) is fn:doc($staff)", ctx); try { query.addDocument("http://www.w3.org/fots/docs/works.xml", file("docs/works.xml")); query.addDocument("http://www.w3.org/fots/docs/staff.xml", file("docs/staff.xml")); query.bind("works", new XQuery("'http://www.w3.org/fots/docs/works.xml'", ctx).value()); query.bind("staff", new XQuery("'http://www.w3.org/fots/docs/staff.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Typical usage of fn:doc. Retrieve a part of the resources. . */ @org.junit.Test public void fnDoc7() { final XQuery query = new XQuery( "fn:doc($uri)//day/string()", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.bind("uri", new XQuery("'http://www.w3.org/fots/docs/works-mod.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"Monday\", \"Tuesday\"") ); } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnDocAvailable.java�������������������0000664�0000000�0000000�00000015133�12224530032�0027544�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the doc-available() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnDocAvailable extends QT3TestSet { /** * ':/' is an invalid URI, no scheme. Under erratum FO.E26, this may either throw FODC0005, or return false . */ @org.junit.Test public void k2SeqDocAvailableFunc1() { final XQuery query = new XQuery( "doc-available(':/')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || error("FODC0005") ) ); } /** * test fn:doc-available on () . */ @org.junit.Test public void cbclDocAvailable001() { final XQuery query = new XQuery( "fn:doc-available( () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:doc-available on invalid input . */ @org.junit.Test public void cbclDocAvailable002() { final XQuery query = new XQuery( "fn:doc-available( '%gg' )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FODC0005") || assertBoolean(false) ) ); } /** * test fn:doc-available on a URI which is not that of a document . */ @org.junit.Test public void cbclDocAvailable003() { final XQuery query = new XQuery( "fn:doc-available( 'collection1' )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test doc-available with a URL . */ @org.junit.Test public void cbclDocAvailable004() { final XQuery query = new XQuery( "doc-available(\"%gg\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FODC0005") || assertBoolean(false) ) ); } /** * Evaluation of ana fn:doc-available function with wrong arity. . */ @org.junit.Test public void fnDocAvailable1() { final XQuery query = new XQuery( "fn:doc-available(\"http://example.com\",\"string 2\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Evaluation of ana fn:doc-available function with wrong argument type. . */ @org.junit.Test public void fnDocAvailable2() { final XQuery query = new XQuery( "fn:doc-available(xs:integer(2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Check that a document with duplicated xml:id attributes is flagged. . */ @org.junit.Test public void fnDocAvailable3() { final XQuery query = new XQuery( "fn:doc-available($uri)", ctx); try { query.addDocument("id/XMLIdDuplicated.xml", file("fn/id/XMLIdDuplicated.xml")); query.bind("uri", new XQuery("'id/XMLIdDuplicated.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Check that a document with an invalid xml:id attribute is flagged. . */ @org.junit.Test public void fnDocAvailable4() { final XQuery query = new XQuery( "fn:doc-available($uri)", ctx); try { query.addDocument("id/InvalidXMLId.xml", file("fn/id/InvalidXMLId.xml")); query.bind("uri", new XQuery("'id/InvalidXMLId.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || assertBoolean(false) ) ); } /** * Evaluation of fn:doc-available function using document URI of a known document. . */ @org.junit.Test public void fnDocAvailable5() { final XQuery query = new XQuery( "fn:doc-available(document-uri(/))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of fn:doc-available function using a URI that does not exist. . */ @org.junit.Test public void fnDocAvailable6() { final XQuery query = new XQuery( "fn:doc-available(\"file:///a/b/c/wefdobqciyvdsoihnfcpinads.xml\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of fn:doc-available function using an empty sequence. . */ @org.junit.Test public void fnDocAvailable7() { final XQuery query = new XQuery( "fn:doc-available(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of fn:doc-available function using a URI that exists but is not XML. . */ @org.junit.Test public void fnDocAvailable8() { final XQuery query = new XQuery( "fn:doc-available(\"../prod/ModuleImport/module1-lib.xq\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnDocumentUri.java��������������������0000664�0000000�0000000�00000073202�12224530032�0027475�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the document-uri() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnDocumentUri extends QT3TestSet { /** * A test whose essence is: `document-uri((), "wrong param")`. . */ @org.junit.Test public void kDocumentURIFunc1() { final XQuery query = new XQuery( "document-uri((), \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `document-uri()`. . */ @org.junit.Test public void kDocumentURIFunc2() { xquery10(); final XQuery query = new XQuery( "document-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `document-uri()`. . */ @org.junit.Test public void kDocumentURIFunc2a() { final XQuery query = new XQuery( "ends-with(document-uri(),\"works-mod.xml\")", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.bind("uri", new XQuery("'http://www.w3.org/fots/docs/works-mod.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `document-uri()`. . */ @org.junit.Test public void kDocumentURIFunc2b() { final XQuery query = new XQuery( "document-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * A test whose essence is: `empty(document-uri(()))`. . */ @org.junit.Test public void kDocumentURIFunc3() { final XQuery query = new XQuery( "empty(document-uri(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke on a comment node. . */ @org.junit.Test public void k2DocumentURIFunc1() { final XQuery query = new XQuery( "empty(document-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke on a tree document node with fn:root(). . */ @org.junit.Test public void k2DocumentURIFunc10() { final XQuery query = new XQuery( "let $i := document {
    } return empty(document-uri(root(($i/a/b)[1])))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Ensure that the return value of document-uri() is of correct type. . */ @org.junit.Test public void k2DocumentURIFunc11() { final XQuery query = new XQuery( "for $i in (1, document-uri(.), 3) return typeswitch($i) case xs:anyURI return \"xs:anyURI\" case xs:integer return \"int\" default return \"FAILURE\"", ctx); try { query.context(node(file("prod/AxisStep/TopMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "int xs:anyURI int") ); } /** * Invoke on an attribute node. . */ @org.junit.Test public void k2DocumentURIFunc2() { final XQuery query = new XQuery( "empty(document-uri(attribute name {\"content\"}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke on a processing instruction node. . */ @org.junit.Test public void k2DocumentURIFunc3() { final XQuery query = new XQuery( "empty(document-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke on a processing instruction node. . */ @org.junit.Test public void k2DocumentURIFunc4() { final XQuery query = new XQuery( "empty(document-uri(processing-instruction name {123}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke on a text node. . */ @org.junit.Test public void k2DocumentURIFunc5() { final XQuery query = new XQuery( "empty(document-uri(text {123}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke on a single element node. . */ @org.junit.Test public void k2DocumentURIFunc6() { final XQuery query = new XQuery( "empty(document-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke on a single attribute node. . */ @org.junit.Test public void k2DocumentURIFunc7() { final XQuery query = new XQuery( "empty(document-uri(/@attr))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke on a single document node. . */ @org.junit.Test public void k2DocumentURIFunc8() { final XQuery query = new XQuery( "empty(document-uri(document {1}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke on a tree document node. . */ @org.junit.Test public void k2DocumentURIFunc9() { final XQuery query = new XQuery( "let $i := document {
    } return empty(document-uri($i))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:document-uri with zero arguments given context via a predicate - predicate should be () and hense false in all cases except the document root. */ @org.junit.Test public void fnDocumentUri0Ok() { final XQuery query = new XQuery( "empty(//works[fn:document-uri()])", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.bind("uri", new XQuery("'http://www.w3.org/fots/docs/works-mod.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of fn:document-uri with incorrect arity. . */ @org.junit.Test public void fnDocumentUri1() { final XQuery query = new XQuery( "fn:document-uri(contenty,\"Argument 2\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Evaluation of fn:document-uri with argument set to a directly constructed element node. Use the fn:count to avoid the empty file. . */ @org.junit.Test public void fnDocumentUri10() { final XQuery query = new XQuery( "fn:count(fn:document-uri(element content))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of fn:document-uri with argument set to a directly constructed document node. Use the fn:count to avoid the empty file. . */ @org.junit.Test public void fnDocumentUri11() { final XQuery query = new XQuery( "fn:count(fn:document-uri(document {element content}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of fn:document-uri with argument set to document node from xml file. . */ @org.junit.Test public void fnDocumentUri12() { final XQuery query = new XQuery( "fn:contains(fn:document-uri(fn:doc($uri)),$uri) or (fn:document-uri(fn:doc($uri)) = \"\")", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.bind("uri", new XQuery("'http://www.w3.org/fots/docs/works-mod.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || assertBoolean(false) ) ); } /** * Evaluation of fn:document-uri with argument set to element node from xml file. Use fn:count to avoid empty file. . */ @org.junit.Test public void fnDocumentUri13() { final XQuery query = new XQuery( "fn:count(fn:document-uri(/works[1]/employee[1]))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of fn:document-uri with argument set to an attribute node from xml file. Use fn:count to avoid empty file. . */ @org.junit.Test public void fnDocumentUri14() { final XQuery query = new XQuery( "fn:count(fn:document-uri(/works[1]/employee[1]/@name))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of fn:document-uri used as argument to an fn:string-length function. . */ @org.junit.Test public void fnDocumentUri15() { final XQuery query = new XQuery( "fn:string-length(fn:string(fn:contains(fn:document-uri(fn:doc($uri)),$uri)))", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.bind("uri", new XQuery("'http://www.w3.org/fots/docs/works-mod.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("4") || assertEq("5") ) ); } /** * Evaluation of fn:document-uri used as argument to an fn:upper-case function. . */ @org.junit.Test public void fnDocumentUri16() { final XQuery query = new XQuery( "fn:upper-case(fn:string(fn:contains(fn:document-uri(fn:doc($uri)),$uri)))", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.bind("uri", new XQuery("'http://www.w3.org/fots/docs/works-mod.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "TRUE") || assertStringValue(false, "FALSE") ) ); } /** * Evaluation of fn:document-uri used as argument to an fn:lower-case function. . */ @org.junit.Test public void fnDocumentUri17() { final XQuery query = new XQuery( "fn:lower-case(fn:string(fn:contains(fn:document-uri(fn:doc($uri)),$uri)))", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.bind("uri", new XQuery("'http://www.w3.org/fots/docs/works-mod.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "true") || assertStringValue(false, "false") ) ); } /** * Evaluation of fn:document-uri used as argument to an fn:concat function. . */ @org.junit.Test public void fnDocumentUri18() { final XQuery query = new XQuery( "fn:concat(fn:string(fn:contains(fn:document-uri(fn:doc($uri)),$uri)),\" A String\")", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.bind("uri", new XQuery("'http://www.w3.org/fots/docs/works-mod.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "true A String") || assertStringValue(false, "false A String") ) ); } /** * Evaluation of fn:document-uri used as argument to an fn:string-join function.. */ @org.junit.Test public void fnDocumentUri19() { final XQuery query = new XQuery( "fn:string-join((fn:string(fn:contains(fn:document-uri(fn:doc($uri)),$uri)),\" A String\"),\"\")", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.bind("uri", new XQuery("'http://www.w3.org/fots/docs/works-mod.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "true A String") || assertStringValue(false, "false A String") ) ); } /** * Evaluation of fn:document-uri with argument set to empty sequence. Use the fn:count to avoid the empty file. . */ @org.junit.Test public void fnDocumentUri2() { final XQuery query = new XQuery( "fn:count(fn:document-uri(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of fn:document-uri used as argument to an fn:substring-before function. . */ @org.junit.Test public void fnDocumentUri20() { final XQuery query = new XQuery( "fn:substring-before(fn:string(fn:contains(fn:document-uri(/),\"works-mod\")),\"e\")", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "tru") ); } /** * Evaluation of fn:document-uri used as argument to an fn:substring-after function. Use string. . */ @org.junit.Test public void fnDocumentUri21() { final XQuery query = new XQuery( "fn:substring-after(fn:string(fn:contains(fn:document-uri(/),\"works-mod\")),\"t\")", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "rue") ); } /** * Evaluation of fn:document-uri#0 with context item set to a computed attribute node. . */ @org.junit.Test public void fnDocumentUri22() { final XQuery query = new XQuery( "(attribute anAttribute {\"an attribute node\"})/document-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of fn:document-uri#0 with context item set to a computed PI node. . */ @org.junit.Test public void fnDocumentUri23() { final XQuery query = new XQuery( "(processing-instruction {\"PITarget\"} {\"PIContent\"})/document-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of fn:document-uri#0 with context item set to a directly constructed PI node. . */ @org.junit.Test public void fnDocumentUri24() { final XQuery query = new XQuery( "()/document-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of fn:document-uri#0 with context item set to a directly constructed comment node. . */ @org.junit.Test public void fnDocumentUri25() { final XQuery query = new XQuery( "()/document-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of fn:document-uri#0 with context item set to a directly constructed element node. . */ @org.junit.Test public void fnDocumentUri26() { final XQuery query = new XQuery( "(element content)/document-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of fn:document-uri#0 with context item set to a directly constructed document node. . */ @org.junit.Test public void fnDocumentUri27() { final XQuery query = new XQuery( "(document {element content})/document-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of fn:document-uri#0 with context item set to document node from xml file. . */ @org.junit.Test public void fnDocumentUri28() { final XQuery query = new XQuery( "fn:contains((fn:doc($uri))/document-uri(),$uri) or ((fn:doc($uri))/document-uri() = \"\")", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.bind("uri", new XQuery("'http://www.w3.org/fots/docs/works-mod.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || assertBoolean(false) ) ); } /** * Evaluation of fn:document-uri#0 with context item set to element node from xml file. Use fn:count to avoid empty file. . */ @org.junit.Test public void fnDocumentUri29() { final XQuery query = new XQuery( "fn:count((/works[1]/employee[1])/document-uri())", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of fn:document-uri with argument set to a computed element node. Use the fn:count to avoid the empty file. . */ @org.junit.Test public void fnDocumentUri3() { final XQuery query = new XQuery( "fn:count(fn:document-uri(element anElement {\"some content\"}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of fn:document-uri#0 with context item set to an attribute node from xml file. Use fn:count to avoid empty file. . */ @org.junit.Test public void fnDocumentUri30() { final XQuery query = new XQuery( "fn:count((/works[1]/employee[1]/@name)/document-uri())", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of fn:document-uri#0 used as argument to an fn:string-length function. . */ @org.junit.Test public void fnDocumentUri31() { final XQuery query = new XQuery( "fn:string-length(fn:string(fn:contains((fn:doc($uri))/document-uri(),$uri)))", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.bind("uri", new XQuery("'http://www.w3.org/fots/docs/works-mod.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("4") || assertEq("5") ) ); } /** * Evaluation of fn:document-uri#0 used as argument to an fn:upper-case function. . */ @org.junit.Test public void fnDocumentUri32() { final XQuery query = new XQuery( "fn:upper-case(fn:string(fn:contains((fn:doc($uri))/document-uri(),$uri)))", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.bind("uri", new XQuery("'http://www.w3.org/fots/docs/works-mod.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "TRUE") || assertStringValue(false, "FALSE") ) ); } /** * Evaluation of fn:document-uri#0 used as argument to an fn:lower-case function. . */ @org.junit.Test public void fnDocumentUri33() { final XQuery query = new XQuery( "fn:lower-case(fn:string(fn:contains((fn:doc($uri))/document-uri(),$uri)))", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.bind("uri", new XQuery("'http://www.w3.org/fots/docs/works-mod.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "true") || assertStringValue(false, "false") ) ); } /** * Evaluation of fn:document-uri#0 used as argument to an fn:concat function. . */ @org.junit.Test public void fnDocumentUri34() { final XQuery query = new XQuery( "fn:concat(fn:string(fn:contains((fn:doc($uri))/document-uri(),$uri)),\" A String\")", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.bind("uri", new XQuery("'http://www.w3.org/fots/docs/works-mod.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "true A String") || assertStringValue(false, "false A String") ) ); } /** * Evaluation of fn:document-uri#0 used as argument to an fn:string-join function.. */ @org.junit.Test public void fnDocumentUri35() { final XQuery query = new XQuery( "fn:string-join((fn:string(fn:contains((fn:doc($uri))/document-uri(),$uri)),\" A String\"),\"\")", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.bind("uri", new XQuery("'http://www.w3.org/fots/docs/works-mod.xml'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "true A String") || assertStringValue(false, "false A String") ) ); } /** * Evaluation of fn:document-uri#0 used as argument to an fn:substring-before function. . */ @org.junit.Test public void fnDocumentUri36() { final XQuery query = new XQuery( "fn:substring-before(fn:string(fn:contains((/)/document-uri(),\"works-mod\")),\"e\")", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "tru") ); } /** * Evaluation of fn:document-uri#0 used as argument to an fn:substring-after function. Use string. . */ @org.junit.Test public void fnDocumentUri37() { final XQuery query = new XQuery( "fn:substring-after(fn:string(fn:contains((/)/document-uri(),\"works-mod\")),\"t\")", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "rue") ); } /** * Evaluation of fn:document-uri with argument set to a computed comment node. Use the fn:count to avoid the empty file. . */ @org.junit.Test public void fnDocumentUri4() { final XQuery query = new XQuery( "fn:count(fn:document-uri(comment {\"a comment node\"}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of fn:document-uri with argument set to a computed text node. Use the fn:count to avoid the empty file. . */ @org.junit.Test public void fnDocumentUri5() { final XQuery query = new XQuery( "fn:count(fn:document-uri(text {\"a text node\"}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of fn:document-uri with argument set to a computed attribute node. Use the fn:count to avoid the empty file. . */ @org.junit.Test public void fnDocumentUri6() { final XQuery query = new XQuery( "fn:count(fn:document-uri(attribute anAttribute {\"an attribute node\"}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of fn:document-uri with argument set to a computed PI node. Use the fn:count to avoid the empty file. . */ @org.junit.Test public void fnDocumentUri7() { final XQuery query = new XQuery( "fn:count(fn:document-uri(processing-instruction {\"PITarget\"} {\"PIContent\"}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of fn:document-uri with argument set to a directly constructed PI node. Use the fn:count to avoid the empty file. . */ @org.junit.Test public void fnDocumentUri8() { final XQuery query = new XQuery( "fn:count(fn:document-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of fn:document-uri with argument set to a directly constructed comment node. Use the fn:count to avoid the empty file. . */ @org.junit.Test public void fnDocumentUri9() { final XQuery query = new XQuery( "fn:count(fn:document-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnEmpty.java000066400000000000000000000627151222453003200263440ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the empty() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnEmpty extends QT3TestSet { /** * A test whose essence is: `empty(1, 2)`. . */ @org.junit.Test public void kSeqEmptyFunc1() { final XQuery query = new XQuery( "empty(1, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty()`. . */ @org.junit.Test public void kSeqEmptyFunc2() { final XQuery query = new XQuery( "empty()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `not(empty("string"))`. . */ @org.junit.Test public void kSeqEmptyFunc3() { final XQuery query = new XQuery( "not(empty(\"string\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(empty((1, (), "string")))`. . */ @org.junit.Test public void kSeqEmptyFunc4() { final XQuery query = new XQuery( "not(empty((1, (), \"string\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(empty((1, "string")))`. . */ @org.junit.Test public void kSeqEmptyFunc5() { final XQuery query = new XQuery( "not(empty((1, \"string\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(empty( ((), 1, "string") ))`. . */ @org.junit.Test public void kSeqEmptyFunc6() { final XQuery query = new XQuery( "not(empty( ((), 1, \"string\") ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(())`. . */ @org.junit.Test public void kSeqEmptyFunc7() { final XQuery query = new XQuery( "empty(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty( ((), (), ()) )`. . */ @org.junit.Test public void kSeqEmptyFunc8() { final XQuery query = new XQuery( "empty( ((), (), ()) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:empty combined with fn:remove and fn:not. . */ @org.junit.Test public void kSeqEmptyFunc9() { final XQuery query = new XQuery( "not(exists(remove(remove((current-time(), 1), 1), 1)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:empty on a mix of values and expressions . */ @org.junit.Test public void cbclEmptyFunc001() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:generate($arg as xs:integer?) { if ($arg = 0) then (1, 2, 3) else $arg }; \n" + " \tfn:empty( ((), local:generate( () ), local:generate( 0 ), (1 to 10000000), local:generate( () ), local:generate(1)) )\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test empty with foreach . */ @org.junit.Test public void cbclEmptyFunc002() { final XQuery query = new XQuery( "empty(for $x in (1 to 10)[. mod 2 = 0] return \"blah\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test empty with foreach . */ @org.junit.Test public void cbclEmptyFunc003() { final XQuery query = new XQuery( "boolean(empty(for $x in (1 to 10)[. mod 2 = 0] return \"blah\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Tests empty on text node . */ @org.junit.Test public void cbclEmptyFunc004() { final XQuery query = new XQuery( "empty(text {(1 to 10)[. mod 2 = 0]})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Tests on optimization as aggregate function . */ @org.junit.Test public void cbclEmptyFunc005() { final XQuery query = new XQuery( "empty(for $x in (1 to 10)[. mod 2 = 0] return true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Tests empty on a map expression . */ @org.junit.Test public void cbclEmptyFunc006() { final XQuery query = new XQuery( "empty(for $x in (1 to 10)[. mod 2 = 0] return floor($x))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:double(lower bound) . */ @org.junit.Test public void fnEmptydbl1args1() { final XQuery query = new XQuery( "fn:empty((xs:double(\"-1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:double(mid range) . */ @org.junit.Test public void fnEmptydbl1args2() { final XQuery query = new XQuery( "fn:empty((xs:double(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:double(upper bound) . */ @org.junit.Test public void fnEmptydbl1args3() { final XQuery query = new XQuery( "fn:empty((xs:double(\"1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:decimal(lower bound) . */ @org.junit.Test public void fnEmptydec1args1() { final XQuery query = new XQuery( "fn:empty((xs:decimal(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:decimal(mid range) . */ @org.junit.Test public void fnEmptydec1args2() { final XQuery query = new XQuery( "fn:empty((xs:decimal(\"617375191608514839\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:decimal(upper bound) . */ @org.junit.Test public void fnEmptydec1args3() { final XQuery query = new XQuery( "fn:empty((xs:decimal(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:float(lower bound) . */ @org.junit.Test public void fnEmptyflt1args1() { final XQuery query = new XQuery( "fn:empty((xs:float(\"-3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:float(mid range) . */ @org.junit.Test public void fnEmptyflt1args2() { final XQuery query = new XQuery( "fn:empty((xs:float(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:float(upper bound) . */ @org.junit.Test public void fnEmptyflt1args3() { final XQuery query = new XQuery( "fn:empty((xs:float(\"3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:int(lower bound) . */ @org.junit.Test public void fnEmptyint1args1() { final XQuery query = new XQuery( "fn:empty((xs:int(\"-2147483648\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:int(mid range) . */ @org.junit.Test public void fnEmptyint1args2() { final XQuery query = new XQuery( "fn:empty((xs:int(\"-1873914410\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:int(upper bound) . */ @org.junit.Test public void fnEmptyint1args3() { final XQuery query = new XQuery( "fn:empty((xs:int(\"2147483647\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:integer(lower bound) . */ @org.junit.Test public void fnEmptyintg1args1() { final XQuery query = new XQuery( "fn:empty((xs:integer(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:integer(mid range) . */ @org.junit.Test public void fnEmptyintg1args2() { final XQuery query = new XQuery( "fn:empty((xs:integer(\"830993497117024304\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:integer(upper bound) . */ @org.junit.Test public void fnEmptyintg1args3() { final XQuery query = new XQuery( "fn:empty((xs:integer(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:long(lower bound) . */ @org.junit.Test public void fnEmptylng1args1() { final XQuery query = new XQuery( "fn:empty((xs:long(\"-92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:long(mid range) . */ @org.junit.Test public void fnEmptylng1args2() { final XQuery query = new XQuery( "fn:empty((xs:long(\"-47175562203048468\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:long(upper bound) . */ @org.junit.Test public void fnEmptylng1args3() { final XQuery query = new XQuery( "fn:empty((xs:long(\"92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnEmptynint1args1() { final XQuery query = new XQuery( "fn:empty((xs:negativeInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnEmptynint1args2() { final XQuery query = new XQuery( "fn:empty((xs:negativeInteger(\"-297014075999096793\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnEmptynint1args3() { final XQuery query = new XQuery( "fn:empty((xs:negativeInteger(\"-1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnEmptynni1args1() { final XQuery query = new XQuery( "fn:empty((xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnEmptynni1args2() { final XQuery query = new XQuery( "fn:empty((xs:nonNegativeInteger(\"303884545991464527\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnEmptynni1args3() { final XQuery query = new XQuery( "fn:empty((xs:nonNegativeInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnEmptynpi1args1() { final XQuery query = new XQuery( "fn:empty((xs:nonPositiveInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnEmptynpi1args2() { final XQuery query = new XQuery( "fn:empty((xs:nonPositiveInteger(\"-475688437271870490\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnEmptynpi1args3() { final XQuery query = new XQuery( "fn:empty((xs:nonPositiveInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnEmptypint1args1() { final XQuery query = new XQuery( "fn:empty((xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnEmptypint1args2() { final XQuery query = new XQuery( "fn:empty((xs:positiveInteger(\"52704602390610033\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnEmptypint1args3() { final XQuery query = new XQuery( "fn:empty((xs:positiveInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:short(lower bound) . */ @org.junit.Test public void fnEmptysht1args1() { final XQuery query = new XQuery( "fn:empty((xs:short(\"-32768\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:short(mid range) . */ @org.junit.Test public void fnEmptysht1args2() { final XQuery query = new XQuery( "fn:empty((xs:short(\"-5324\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:short(upper bound) . */ @org.junit.Test public void fnEmptysht1args3() { final XQuery query = new XQuery( "fn:empty((xs:short(\"32767\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnEmptyulng1args1() { final XQuery query = new XQuery( "fn:empty((xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnEmptyulng1args2() { final XQuery query = new XQuery( "fn:empty((xs:unsignedLong(\"130747108607674654\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnEmptyulng1args3() { final XQuery query = new XQuery( "fn:empty((xs:unsignedLong(\"184467440737095516\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnEmptyusht1args1() { final XQuery query = new XQuery( "fn:empty((xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnEmptyusht1args2() { final XQuery query = new XQuery( "fn:empty((xs:unsignedShort(\"44633\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "empty" function with the arguments set as follows: $arg = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnEmptyusht1args3() { final XQuery query = new XQuery( "fn:empty((xs:unsignedShort(\"65535\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnEncodeForUri.java000066400000000000000000000335141222453003200275650ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the encode-for-uri() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnEncodeForUri extends QT3TestSet { /** * A test whose essence is: `encode-for-uri()`. . */ @org.junit.Test public void kEncodeURIfunc1() { final XQuery query = new XQuery( "encode-for-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `encode-for-uri("http://example.com/", "wrong param")`. . */ @org.junit.Test public void kEncodeURIfunc2() { final XQuery query = new XQuery( "encode-for-uri(\"http://example.com/\", \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `encode-for-uri(()) eq ""`. . */ @org.junit.Test public void kEncodeURIfunc3() { final XQuery query = new XQuery( "encode-for-uri(()) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Combine fn:concat and fn:encode-for-uri. . */ @org.junit.Test public void kEncodeURIfunc4() { final XQuery query = new XQuery( "concat(\"http://www.example.com/\", encode-for-uri(\"~bébé\")) eq \"http://www.example.com/~b%C3%A9b%C3%A9\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Combine fn:concat and fn:encode-for-uri. . */ @org.junit.Test public void kEncodeURIfunc5() { final XQuery query = new XQuery( "concat(\"http://www.example.com/\", encode-for-uri(\"100% organic\")) eq \"http://www.example.com/100%25%20organic\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke fn:normalize-space() on the return value of fn:encode-for-uri(). . */ @org.junit.Test public void kEncodeURIfunc6() { final XQuery query = new XQuery( "normalize-space(encode-for-uri((\"some string\", current-time())[1] treat as xs:string))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "some%20string") ); } /** * Evaluation of fn-encode-for-uri function with argument thast ha nothing to encode. . */ @org.junit.Test public void fnEncodeForUri1() { final XQuery query = new XQuery( "(fn:encode-for-uri(\"example\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example") ); } /** * Examines that fn-encode-for-uri function does escape the "(" symbol. . */ @org.junit.Test public void fnEncodeForUri10() { final XQuery query = new XQuery( "(fn:encode-for-uri(\"examples(example\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "examples%28example") ); } /** * Examines that fn-encode-for-uri function does escape the ")" symbol. . */ @org.junit.Test public void fnEncodeForUri11() { final XQuery query = new XQuery( "(fn:encode-for-uri(\"examples)example\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "examples%29example") ); } /** * Examines that fn-encode-for-uri function does not escape numbers. . */ @org.junit.Test public void fnEncodeForUri12() { final XQuery query = new XQuery( "(fn:encode-for-uri(\"examples0123456789example\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "examples0123456789example") ); } /** * Examines that fn-encode-for-uri function escapes the space. . */ @org.junit.Test public void fnEncodeForUri13() { final XQuery query = new XQuery( "(fn:encode-for-uri(\"examples example\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "examples%20example") ); } /** * Examines that fn-encode-for-uri function escapes the "/" character. . */ @org.junit.Test public void fnEncodeForUri14() { final XQuery query = new XQuery( "(fn:encode-for-uri(\"examples/example\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "examples%2Fexample") ); } /** * Examines that fn-encode-for-uri function escapes the ":" character. . */ @org.junit.Test public void fnEncodeForUri15() { final XQuery query = new XQuery( "(fn:encode-for-uri(\"http:examples\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http%3Aexamples") ); } /** * Examines that fn-encode-for-uri function escapes the "%" character. . */ @org.junit.Test public void fnEncodeForUri16() { final XQuery query = new XQuery( "(fn:encode-for-uri(\"http%20examples\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http%2520examples") ); } /** * Examines that fn-encode-for-uri function does escape the "#" symbol. . */ @org.junit.Test public void fnEncodeForUri2() { final XQuery query = new XQuery( "(fn:encode-for-uri(\"examples#example\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "examples%23example") ); } /** * Examines that fn-encode-for-uri function does not escape the "-" symbol. . */ @org.junit.Test public void fnEncodeForUri3() { final XQuery query = new XQuery( "(fn:encode-for-uri(\"examples-example\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "examples-example") ); } /** * Examines that fn-encode-for-uri function does not escape the "_" symbol. . */ @org.junit.Test public void fnEncodeForUri4() { final XQuery query = new XQuery( "(fn:encode-for-uri(\"examples_example\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "examples_example") ); } /** * Examines that fn-encode-for-uri function does not escape the "." symbol. . */ @org.junit.Test public void fnEncodeForUri5() { final XQuery query = new XQuery( "(fn:encode-for-uri(\"examples.example\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "examples.example") ); } /** * Examines that fn-encode-for-uri function does escapes the "!" symbol. . */ @org.junit.Test public void fnEncodeForUri6() { final XQuery query = new XQuery( "(fn:encode-for-uri(\"examples!example\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "examples%21example") ); } /** * Examines that fn-encode-for-uri function does not escape the "~" symbol. . */ @org.junit.Test public void fnEncodeForUri7() { final XQuery query = new XQuery( "(fn:encode-for-uri(\"examples~example\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "examples~example") ); } /** * Examines that fn-encode-for-uri function does escape the "*" symbol. . */ @org.junit.Test public void fnEncodeForUri8() { final XQuery query = new XQuery( "(fn:encode-for-uri(\"examples*example\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "examples%2Aexample") ); } /** * Examines that fn-encode-for-uri function does escape the "'" symbol. . */ @org.junit.Test public void fnEncodeForUri9() { final XQuery query = new XQuery( "(fn:encode-for-uri(\"examples'example\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "examples%27example") ); } /** * Test encode-for-uri from example defined in functions and operators specification . */ @org.junit.Test public void fnEncodeForUri1args1() { final XQuery query = new XQuery( "fn:encode-for-uri (\"http://www.example.com/00/Weather/CA/Los%20Angeles#ocean\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http%3A%2F%2Fwww.example.com%2F00%2FWeather%2FCA%2FLos%2520Angeles%23ocean") ); } /** * Test encode-for-uri from example defined in functions and operators specification . */ @org.junit.Test public void fnEncodeForUri1args2() { final XQuery query = new XQuery( "encode-for-uri(\"~bébé\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "~b%C3%A9b%C3%A9") ); } /** * Test encode-for-uri from example defined in functions and operators specification . */ @org.junit.Test public void fnEncodeForUri1args3() { final XQuery query = new XQuery( "encode-for-uri(\"100% organic\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "100%25%20organic") ); } /** * Test encode-for-uri with zero-length string argument . */ @org.junit.Test public void fnEncodeForUri1args4() { final XQuery query = new XQuery( "encode-for-uri('')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * Test encode-for-uri with empty sequence argument . */ @org.junit.Test public void fnEncodeForUri1args5() { final XQuery query = new XQuery( "encode-for-uri(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * Test encode-for-uri with invalid argument type . */ @org.junit.Test public void fnEncodeForUri1args6() { final XQuery query = new XQuery( "encode-for-uri(12)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test encode-for-uri with incorrect arity . */ @org.junit.Test public void fnEncodeForUri1args7() { final XQuery query = new XQuery( "encode-for-uri('',())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnEndsWith.java000066400000000000000000000470421222453003200267670ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the ends-with() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnEndsWith extends QT3TestSet { /** * A test whose essence is: `ends-with()`. . */ @org.junit.Test public void kEndsWithFunc1() { final XQuery query = new XQuery( "ends-with()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `not(ends-with ((), "a string"))`. . */ @org.junit.Test public void kEndsWithFunc10() { final XQuery query = new XQuery( "not(ends-with ((), \"a string\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `ends-with(())`. . */ @org.junit.Test public void kEndsWithFunc2() { final XQuery query = new XQuery( "ends-with(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `ends-with((), (), "http://www.w3.org/2005/xpath-functions/collation/codepoint", "wrong param")`. . */ @org.junit.Test public void kEndsWithFunc3() { final XQuery query = new XQuery( "ends-with((), (), \"http://www.w3.org/2005/xpath-functions/collation/codepoint\", \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `ends-with("a string", "a string", "http://www.example.com/COLLATION/NOT/SUPPORTED")`. . */ @org.junit.Test public void kEndsWithFunc4() { final XQuery query = new XQuery( "ends-with(\"a string\", \"a string\", \"http://www.example.com/COLLATION/NOT/SUPPORTED\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0002") ); } /** * A test whose essence is: `ends-with("foo", "foo", "http://www.w3.org/2005/xpath-functions/collation/codepoint")`. . */ @org.junit.Test public void kEndsWithFunc5() { final XQuery query = new XQuery( "ends-with(\"foo\", \"foo\", \"http://www.w3.org/2005/xpath-functions/collation/codepoint\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `ends-with("tattoo", "tattoo")`. . */ @org.junit.Test public void kEndsWithFunc6() { final XQuery query = new XQuery( "ends-with(\"tattoo\", \"tattoo\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(ends-with("tattoo", "atto"))`. . */ @org.junit.Test public void kEndsWithFunc7() { final XQuery query = new XQuery( "not(ends-with(\"tattoo\", \"atto\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(ends-with("tattoo", "atto"))`. . */ @org.junit.Test public void kEndsWithFunc8() { final XQuery query = new XQuery( "not(ends-with(\"tattoo\", \"atto\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `ends-with((), ())`. . */ @org.junit.Test public void kEndsWithFunc9() { final XQuery query = new XQuery( "ends-with((), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Compare two values returned from fn:lower-case(). . */ @org.junit.Test public void k2EndsWithFunc1() { final XQuery query = new XQuery( "let $vA := (\"B STRING\", current-time(), string(\"content\"))[1] treat as xs:string, \n" + " $vB := (\"b string\", current-time(), string(\"content\"))[1] treat as xs:string\n" + " return ends-with(lower-case($vA), lower-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Compare two values returned from fn:upper-case(). . */ @org.junit.Test public void k2EndsWithFunc2() { final XQuery query = new XQuery( "\n" + " let $vA := (\"B STRING\", current-time(), string(\"content\"))[1] treat as xs:string,\n" + " $vB := (\"b string\", current-time(), string(\"content\"))[1] treat as xs:string\n" + " return ends-with(upper-case($vA), upper-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Compare two non-matching values returned from fn:lower-case(). . */ @org.junit.Test public void k2EndsWithFunc3() { final XQuery query = new XQuery( "\n" + " let $vA := (\"B STRING\", current-time(), string(\"content\"))[1] treat as xs:string,\n" + " $vB := (\"no match\", current-time(), string(\"content\"))[1] treat as xs:string\n" + " return ends-with(lower-case($vA), lower-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Compare two non-matching values returned from fn:upper-case(). . */ @org.junit.Test public void k2EndsWithFunc4() { final XQuery query = new XQuery( "\n" + " let $vA := (\"B STRING\", current-time(), string(\"content\"))[1] treat as xs:string,\n" + " $vB := (\"no match\", current-time(), string(\"content\"))[1] treat as xs:string\n" + " return ends-with(upper-case($vA), upper-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Compare two non-matching values returned from fn:lower-case() and fn:upper-case(). . */ @org.junit.Test public void k2EndsWithFunc5() { final XQuery query = new XQuery( "\n" + " let $vA := (\"B STRING\", current-time(), string(\"content\"))[1] treat as xs:string, \n" + " $vB := (\"b string\", current-time(), string(\"content\"))[1] treat as xs:string\n" + " return ends-with(upper-case($vA), lower-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Compare two non-matching values returned from fn:lower-case() and fn:upper-case(). . */ @org.junit.Test public void k2EndsWithFunc6() { final XQuery query = new XQuery( "\n" + " let $vA := (\"B STRING\", current-time(), string(\"content\"))[1] treat as xs:string, \n" + " $vB := (\"b string\", current-time(), string(\"content\"))[1] treat as xs:string\n" + " return ends-with(lower-case($vA), upper-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:ends-with with collation and empty string . */ @org.junit.Test public void cbclEndsWith001() { final XQuery query = new XQuery( "fn:boolean(fn:ends-with('input', '', 'http://www.w3.org/2005/xpath-functions/collation/codepoint'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "ends-with" function with the arguments set as follows: $arg1 = "" $arg2 = "" . */ @org.junit.Test public void fnEndsWith1() { final XQuery query = new XQuery( "fn:ends-with(\"\",\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "ends-with" function with the arguments set as follows: $arg1 = " " $arg2 = " AAAAABBBBB" . */ @org.junit.Test public void fnEndsWith10() { final XQuery query = new XQuery( "fn:ends-with(\" \",\"AAAAABBBBB\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "ends-with" function using it as a argument of a fn:not - returns false . */ @org.junit.Test public void fnEndsWith11() { final XQuery query = new XQuery( "fn:not(fn:ends-with(\"A\",\"A\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "ends-with" function using it as a argument of a fn:not - returns true . */ @org.junit.Test public void fnEndsWith12() { final XQuery query = new XQuery( "fn:not(fn:ends-with(\"A\",\"B\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "ends-with" function with the arguments set as follows: $arg1 = xs:string("A") $arg2 = "A" . */ @org.junit.Test public void fnEndsWith13() { final XQuery query = new XQuery( "fn:ends-with(xs:string(\"A\"),\"A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "ends-with" function with the arguments set as follows: $arg1 = "A" $arg2 = xs:string("A") . */ @org.junit.Test public void fnEndsWith14() { final XQuery query = new XQuery( "fn:ends-with(\"A\",xs:string(\"A\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "ends-with" function with the arguments set as follows: $arg1 = "A" $arg2 = "a" . */ @org.junit.Test public void fnEndsWith15() { final XQuery query = new XQuery( "fn:ends-with(\"A\",\"a\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "ends-with" function with the arguments set as follows: $arg1 = "a" $arg2 = "A" . */ @org.junit.Test public void fnEndsWith16() { final XQuery query = new XQuery( "fn:ends-with(\"a\",\"A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "ends-with" function with the arguments set as follows: $arg1 = "" $arg2 = "A Character String" . */ @org.junit.Test public void fnEndsWith2() { final XQuery query = new XQuery( "fn:ends-with(\"\",\"A Character String\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "ends-with" function with the arguments set as follows: $arg1 = "" $arg2 = "A Character String" . */ @org.junit.Test public void fnEndsWith3() { final XQuery query = new XQuery( "fn:ends-with(\"A Character String\",\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "ends-with" function with the arguments set as follows: $arg1 = () $arg2 = "" . */ @org.junit.Test public void fnEndsWith4() { final XQuery query = new XQuery( "fn:ends-with((),\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "ends-with" function with the arguments set as follows: $arg1 = "" $arg2 = () . */ @org.junit.Test public void fnEndsWith5() { final XQuery query = new XQuery( "fn:ends-with(\"\",())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "ends-with" function with the arguments set as follows: $arg1 = "A Character String" $arg2 = () . */ @org.junit.Test public void fnEndsWith6() { final XQuery query = new XQuery( "fn:ends-with(\"A Character String\",())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "ends-with" function with the arguments set as follows: $arg1 = () $arg2 = "A Character String" . */ @org.junit.Test public void fnEndsWith7() { final XQuery query = new XQuery( "fn:ends-with((),\"A Character String\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "ends-with" function with the arguments set as follows: $arg1 = "AAAAABBBBBCCCCC" $arg2 = "BBBBB" . */ @org.junit.Test public void fnEndsWith8() { final XQuery query = new XQuery( "fn:ends-with(\"AAAAABBBBBCCCCC\",\"BBBBB\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "ends-with" function with the arguments set as follows: $arg1 = "AAAAABBBBB" $arg2 = " " . */ @org.junit.Test public void fnEndsWith9() { final XQuery query = new XQuery( "fn:ends-with(\"AAAAABBBBB\",\" \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "ends-with" function with the arguments set as follows: $arg1 = xs:string(lower bound) $arg2 = xs:string(lower bound) . */ @org.junit.Test public void fnEndsWith2args1() { final XQuery query = new XQuery( "fn:ends-with(xs:string(\"This is a characte\"),xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "ends-with" function with the arguments set as follows: $arg1 = xs:string(mid range) $arg2 = xs:string(lower bound) . */ @org.junit.Test public void fnEndsWith2args2() { final XQuery query = new XQuery( "fn:ends-with(xs:string(\"This is a characte\"),xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "ends-with" function with the arguments set as follows: $arg1 = xs:string(upper bound) $arg2 = xs:string(lower bound) . */ @org.junit.Test public void fnEndsWith2args3() { final XQuery query = new XQuery( "fn:ends-with(xs:string(\"This is a characte\"),xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "ends-with" function with the arguments set as follows: $arg1 = xs:string(lower bound) $arg2 = xs:string(mid range) . */ @org.junit.Test public void fnEndsWith2args4() { final XQuery query = new XQuery( "fn:ends-with(xs:string(\"This is a characte\"),xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "ends-with" function with the arguments set as follows: $arg1 = xs:string(lower bound) $arg2 = xs:string(upper bound) . */ @org.junit.Test public void fnEndsWith2args5() { final XQuery query = new XQuery( "fn:ends-with(xs:string(\"This is a characte\"),xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnEnvironmentVariable.java000066400000000000000000000143031222453003200312060ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the environment-variable() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnEnvironmentVariable extends QT3TestSet { /** * Check that the function exists. */ @org.junit.Test public void environmentVariable001() { final XQuery query = new XQuery( "fn:exists(environment-variable#1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that we can look the function up. */ @org.junit.Test public void environmentVariable002() { final XQuery query = new XQuery( "not(fn:empty(fn:function-lookup(\n" + "\t fn:QName('http://www.w3.org/2005/xpath-functions',\n" + "\t 'environment-variable') , 1)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that it has arity 1, not 0. */ @org.junit.Test public void environmentVariable003() { final XQuery query = new XQuery( "fn:environment-variables#0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Check that it has arity 1, not 2. */ @org.junit.Test public void environmentVariable004() { final XQuery query = new XQuery( "fn:environment-variables#2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Check that we get back () or $QTTEST = 42. */ @org.junit.Test public void environmentVariable005() { final XQuery query = new XQuery( "let $all := fn:available-environment-variables()\n" + "\t return empty($all) or ($all = \"QTTEST\" and fn:environment-variable(\"QTTEST\") eq \"42\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that $QTTEST2 is "other". */ @org.junit.Test public void environmentVariable006() { final XQuery query = new XQuery( "let $all := fn:available-environment-variables()\n" + "\t return empty($all) or\n" + "\t ($all = \"QTTEST2\"\n" + "\t and (fn:environment-variable(\"QTTEST2\") eq \"other\")\n" + "\t and (not(\"other\" eq \"42\")))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check we can distinguish an unset variable from an empty one. */ @org.junit.Test public void environmentVariable007() { final XQuery query = new XQuery( "let $all := fn:available-environment-variables()\n" + "\t return empty($all) or ($all = \"QTTESTEMPTY\" and fn:environment-variable(\"QTTESTEMPTY\") eq \"\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * environment-variable arg must be supplied. */ @org.junit.Test public void environmentVariable008() { final XQuery query = new XQuery( "\n" + "\t fn:environment-variable()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * environment-variable arg must be a string. */ @org.junit.Test public void environmentVariable009() { final XQuery query = new XQuery( "\n" + "\t fn:environment-variable(1)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * environment-variable arg must be a string. */ @org.junit.Test public void environmentVariable010() { final XQuery query = new XQuery( "\n" + "\t fn:environment-variable(())\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * environment-variable arg must be a string. */ @org.junit.Test public void environmentVariable011() { final XQuery query = new XQuery( "\n" + "\t fn:environment-variable(true())\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * check for overflow by constructing a one-megabyte name. */ @org.junit.Test public void environmentVariable012() { final XQuery query = new XQuery( "\n" + "\tlet $var := string-join(\n" + "\t for $i in (1 to (1024 * 1024)) return \"x\"\n" + "\t) \n" + "\treturn empty(fn:environment-variable($var))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnError.java000066400000000000000000001324101222453003200263250ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the error() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnError extends QT3TestSet { /** * A test whose essence is: `if(true()) then true() else error()`. . */ @org.junit.Test public void kErrorFunc1() { final XQuery query = new XQuery( "if(true()) then true() else error()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `exactly-one((true(), error()))`. . */ @org.junit.Test public void kErrorFunc10() { final XQuery query = new XQuery( "exactly-one((true(), error()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * A test whose essence is: `if(true()) then true() else error(QName("", "local"), "description")`. . */ @org.junit.Test public void kErrorFunc2() { final XQuery query = new XQuery( "if(true()) then true() else error(QName(\"\", \"local\"), \"description\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `error(QName("", "local"), "description", "object", "wrong param")`. . */ @org.junit.Test public void kErrorFunc3() { final XQuery query = new XQuery( "error(QName(\"\", \"local\"), \"description\", \"object\", \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `error( () )`. . */ @org.junit.Test public void kErrorFunc4() { final XQuery query = new XQuery( "error( () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A test whose essence is: `error(QName('http://www.w3.org/2005/xqt-errors', 'err:FOER0000'))`. . */ @org.junit.Test public void kErrorFunc5() { final XQuery query = new XQuery( "error(QName('http://www.w3.org/2005/xqt-errors', 'err:FOER0000'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * When fn:error() is passed a description, the first argument may be an empty sequence. . */ @org.junit.Test public void kErrorFunc6() { final XQuery query = new XQuery( "error((), \"description\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * A test whose essence is: `if(false()) then error((), "description") else true()`. . */ @org.junit.Test public void kErrorFunc7() { final XQuery query = new XQuery( "if(false()) then error((), \"description\") else true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `error()`. . */ @org.junit.Test public void kErrorFunc8() { final XQuery query = new XQuery( "error()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * A test whose essence is: `error(QName("", "XPDY6666"), "description", "error object")`. . */ @org.junit.Test public void kErrorFunc9() { final XQuery query = new XQuery( "error(QName(\"\", \"XPDY6666\"), \"description\", \"error object\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("*") ); } /** * Combine fn:error() with a predicate. . */ @org.junit.Test public void k2ErrorFunc1() { final XQuery query = new XQuery( "(1, 2, error())[2]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "2") || error("FOER0000") ) ); } /** * Using a QName with namespace 'none' as identifier. . */ @org.junit.Test public void k2ErrorFunc2() { final XQuery query = new XQuery( "declare default element namespace \"\"; fn:error(xs:QName(\"onlyAnNCName\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("*") ); } /** * Use a QName with no namespace URI. . */ @org.junit.Test public void k2ErrorFunc3() { final XQuery query = new XQuery( "error(QName(\"\", \"FOO\"), \"DESCRIPTION\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("*") ); } /** * fn:error() may never be evaluated here . */ @org.junit.Test public void cbclError001() { final XQuery query = new XQuery( "declare function local:ignore($arg) { true() }; local:ignore( fn:error() )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here . */ @org.junit.Test public void cbclError002() { final XQuery query = new XQuery( "empty(() + fn:error())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here . */ @org.junit.Test public void cbclError003() { final XQuery query = new XQuery( "empty(fn:error() + ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here . */ @org.junit.Test public void cbclError004() { final XQuery query = new XQuery( "empty(() eq fn:error())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here . */ @org.junit.Test public void cbclError005() { final XQuery query = new XQuery( "empty(fn:error() eq ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here . */ @org.junit.Test public void cbclError006() { final XQuery query = new XQuery( "fn:error() = ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here . */ @org.junit.Test public void cbclError007() { final XQuery query = new XQuery( "() = fn:error()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here . */ @org.junit.Test public void cbclError008() { final XQuery query = new XQuery( "empty(fn:error() is ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here . */ @org.junit.Test public void cbclError009() { final XQuery query = new XQuery( "empty(() is fn:error())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here . */ @org.junit.Test public void cbclError010() { final XQuery query = new XQuery( "fn:error() and false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here . */ @org.junit.Test public void cbclError011() { final XQuery query = new XQuery( "false() and fn:error()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here . */ @org.junit.Test public void cbclError012() { final XQuery query = new XQuery( "fn:error() or true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here . */ @org.junit.Test public void cbclError013() { final XQuery query = new XQuery( "true() or fn:error()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here . */ @org.junit.Test public void cbclError014() { final XQuery query = new XQuery( "for $x in fn:error() return true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here . */ @org.junit.Test public void cbclError015() { final XQuery query = new XQuery( "for $x at $p in fn:error() return true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here . */ @org.junit.Test public void cbclError016() { final XQuery query = new XQuery( "let $x := fn:error() return true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here . */ @org.junit.Test public void cbclError017() { final XQuery query = new XQuery( "if (fn:error()) then true() else true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here . */ @org.junit.Test public void cbclError018() { final XQuery query = new XQuery( "some $x in fn:error() satisfies false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here . */ @org.junit.Test public void cbclError019() { final XQuery query = new XQuery( "every $x in fn:error() satisfies true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here . */ @org.junit.Test public void cbclError020() { final XQuery query = new XQuery( "fn:error() instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here . */ @org.junit.Test public void cbclError021() { final XQuery query = new XQuery( "typeswitch ( fn:error() ) case xs:integer return true() default return false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here . */ @org.junit.Test public void cbclError022() { final XQuery query = new XQuery( "typeswitch ( fn:error() ) case xs:integer return true() default return false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here . */ @org.junit.Test public void cbclError023() { final XQuery query = new XQuery( "empty(fn:error()[2])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here . */ @org.junit.Test public void cbclError024() { final XQuery query = new XQuery( "empty(fn:error()[false()])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here . */ @org.junit.Test public void cbclError025() { final XQuery query = new XQuery( "empty((1 div 0)[false()])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOAR0001") ) ); } /** * fn:error() may never be evaluated here the static type of the conditional expression is empty . */ @org.junit.Test public void cbclError026() { final XQuery query = new XQuery( "empty( if (current-date() lt xs:date('2009-01-01')) then fn:error() else ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here the static type of the conditional expression is empty . */ @org.junit.Test public void cbclError027() { final XQuery query = new XQuery( "empty( if (current-date() lt xs:date('2009-01-01')) then () else fn:error())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here the static type of the typeswitch expression is empty . */ @org.junit.Test public void cbclError028() { final XQuery query = new XQuery( "declare function local:item() { if (current-date() lt xs:date('2012-10-10')) then 1 else \"one\" }; empty( typeswitch ( local:item() ) case xs:integer return fn:error() default return ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here the static type of the typeswitch expression is empty . */ @org.junit.Test public void cbclError029() { final XQuery query = new XQuery( "declare function local:item() { if (current-date() gt xs:date('1900-01-01')) then 1 else \"one\" }; empty( typeswitch ( local:item() ) case xs:integer return () default return fn:error())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:error() may never be evaluated here the static type of the fn:remove call is empty . */ @org.junit.Test public void cbclError030() { final XQuery query = new XQuery( "empty(fn:remove( fn:error(), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here the static type of the fn:remove call is empty . */ @org.junit.Test public void cbclError031() { final XQuery query = new XQuery( "empty(fn:subsequence( fn:error(), 2, 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here the static type of the except operator is empty . */ @org.junit.Test public void cbclError032() { final XQuery query = new XQuery( "empty(fn:error() except fn:error() )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here the static type of the intersect operator is empty . */ @org.junit.Test public void cbclError033() { final XQuery query = new XQuery( "empty(fn:error() intersect fn:error() )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here the static type of fn:zero-or-one call is empty . */ @org.junit.Test public void cbclError034() { final XQuery query = new XQuery( "empty( fn:zero-or-one(fn:error()) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * fn:error() may never be evaluated here the static type of the treat as expression is empty . */ @org.junit.Test public void cbclError035() { final XQuery query = new XQuery( "empty( fn:error() treat as empty-sequence() )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * Evaluation of "fn:error" function with no arguments . */ @org.junit.Test public void fnError1() { final XQuery query = new XQuery( "fn:error()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * Evaluation of "fn:error" set to raise error "SENR0001". . */ @org.junit.Test public void fnError10() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:SENR0001'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("SENR0001") ); } /** * Evaluation of "fn:error" set to raise error "SEPM0004". . */ @org.junit.Test public void fnError11() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:SEPM0004'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("SEPM0004") ); } /** * Evaluation of "fn:error" set to raise error "SEPM0009". . */ @org.junit.Test public void fnError12() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:SEPM0009'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("SEPM0009") ); } /** * Evaluation of "fn:error" set to raise error "SEPM0010". . */ @org.junit.Test public void fnError13() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:SEPM0010'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("SEPM0010") ); } /** * Evaluation of "fn:error" set to raise error "SEPM0016". . */ @org.junit.Test public void fnError14() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:SEPM0016'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("SEPM0016") ); } /** * Evaluation of "fn:error" set to raise error "SERE0003". . */ @org.junit.Test public void fnError15() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:SERE0003'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("SERE0003") ); } /** * Evaluation of "fn:error" set to raise error "SERE0005". . */ @org.junit.Test public void fnError16() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:SERE0005'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("SERE0005") ); } /** * Evaluation of "fn:error" set to raise error "SERE0006". . */ @org.junit.Test public void fnError17() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:SERE0006'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("SERE0006") ); } /** * Evaluation of "fn:error" set to raise error "SERE0008". . */ @org.junit.Test public void fnError18() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:SERE0008'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("SERE0008") ); } /** * Evaluation of "fn:error" set to raise error "SERE0012". . */ @org.junit.Test public void fnError19() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:SERE0012'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("SERE0012") ); } /** * Evaluation of "fn:error" function as per example 2 from the Funcs. and Ops. Specifications. . */ @org.junit.Test public void fnError2() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.example.com/HR', 'myerr:toohighsal'), 'Does not apply because salary is too high')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("*") ); } /** * Evaluation of "fn:error" set to raise error "SERE0014". . */ @org.junit.Test public void fnError20() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:SERE0014'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("SERE0014") ); } /** * Evaluation of "fn:error" set to raise error "SESU0007". . */ @org.junit.Test public void fnError22() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:SESU0007'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("SESU0007") ); } /** * Evaluation of "fn:error" set to raise error "SESU0011". . */ @org.junit.Test public void fnError23() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:SESU0011'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("SESU0011") ); } /** * Evaluation of "fn:error" set to raise error "XPDY0002". . */ @org.junit.Test public void fnError25() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:XPDY0002'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Evaluation of "fn:error" set to raise error "XPST0010". . */ @org.junit.Test public void fnError26() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:XPST0010'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0010") ); } /** * Evaluation of "fn:error" set to raise error "XPST0080". . */ @org.junit.Test public void fnError27() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:XPST0080'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * Evaluation of "fn:error" set to raise error "XPTY0018". . */ @org.junit.Test public void fnError28() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:XPTY0018'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0018") ); } /** * Evaluation of "fn:error" set to raise error "XQDY0027". . */ @org.junit.Test public void fnError29() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:XQDY0027'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0027") ); } /** * Evaluation of "fn:error" function with wrong argument type. . */ @org.junit.Test public void fnError3() { final XQuery query = new XQuery( "fn:error('Wrong Argument Type')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluation of "fn:error" set to raise error "XQDY0061". . */ @org.junit.Test public void fnError30() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:XQDY0061'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0061") ); } /** * Evaluation of "fn:error" set to raise error "XQDY0084". . */ @org.junit.Test public void fnError31() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:XQDY0084'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0084") ); } /** * Evaluation of "fn:error" set to raise error "XQST0009". . */ @org.junit.Test public void fnError32() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:XQST0009'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0009") ); } /** * Evaluation of "fn:error" set to raise error "XQST0012". . */ @org.junit.Test public void fnError33() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:XQST0012'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0012") ); } /** * Evaluation of "fn:error" set to raise error "XQST0013". . */ @org.junit.Test public void fnError34() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:XQST0013'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0013") ); } /** * Evaluation of "fn:error" set to raise error "XQST0016". . */ @org.junit.Test public void fnError35() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:XQST0016'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0016") ); } /** * Evaluation of "fn:error" set to raise error "XQST0035". . */ @org.junit.Test public void fnError36() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:XQST0035'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0035") ); } /** * Evaluation of "fn:error" set to raise error "XQST0036". . */ @org.junit.Test public void fnError37() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:XQST0036'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0036") ); } /** * Evaluation of "fn:error" set to raise error "XQST0046". . */ @org.junit.Test public void fnError38() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:XQST0046'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0046") ); } /** * Evaluation of "fn:error" set to raise error "XQST0047". . */ @org.junit.Test public void fnError39() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:XQST0047'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0047") ); } /** * Evaluation of "fn:error" for error code "FOCH0004". . */ @org.junit.Test public void fnError4() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:FOCH0004'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0004") ); } /** * Evaluation of "fn:error" set to raise error "XQST0048". . */ @org.junit.Test public void fnError40() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:XQST0048'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0048") ); } /** * Evaluation of "fn:error" set to raise error "XQST0054". . */ @org.junit.Test public void fnError41() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:XQST0054'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0054") ); } /** * Evaluation of "fn:error" set to raise error "XQST0055". . */ @org.junit.Test public void fnError42() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:XQST0055'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0055") ); } /** * Evaluation of "fn:error" set to raise error "XQST0057". . */ @org.junit.Test public void fnError43() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:XQST0057'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0057") ); } /** * Evaluation of "fn:error" set to raise error "XQST0058". . */ @org.junit.Test public void fnError44() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:XQST0058'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0058") ); } /** * Evaluation of "fn:error" set to raise error "XQST0060". . */ @org.junit.Test public void fnError45() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:XQST0060'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0060") ); } /** * Evaluation of "fn:error" set to raise error "XQST0073. . */ @org.junit.Test public void fnError46() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:XQST0073'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0073") ); } /** * Evaluation of "fn:error" set to raise error "XQST0075". . */ @org.junit.Test public void fnError47() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:XQST0075'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0075") ); } /** * Evaluation of "fn:error" set to raise error "XQST0076". . */ @org.junit.Test public void fnError48() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:XQST0076'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0076") ); } /** * Evaluation of "fn:error" set to raise error "XQST0079". . */ @org.junit.Test public void fnError49() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:XQST0079'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0079") ); } /** * Evaluation of "fn:error" with first argument set to empty string for 3rd signature. . */ @org.junit.Test public void fnError5() { final XQuery query = new XQuery( "fn:error((), 'err:FOER0000')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * Evaluation of "fn:error" set to raise error "XQST0087". . */ @org.junit.Test public void fnError50() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:XQST0087'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0087") ); } /** * Evaluation of "fn:error" set to raise error "XQTY0030". . */ @org.junit.Test public void fnError51() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:XQTY0030'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0030") ); } /** * Evaluation of "fn:error" with first argument set to empty string for 4rd signature. . */ @org.junit.Test public void fnError6() { final XQuery query = new XQuery( "fn:error((), 'err:FOER0000','error raised by this test by setting first argument to empty sequence')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * Evaluation of "fn:error" set to raise error "FODT0001". . */ @org.junit.Test public void fnError7() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:FODT0001'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * Evaluation of "fn:error" set to raise error "FORG0009". . */ @org.junit.Test public void fnError8() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:FORG0009'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0009") ); } /** * Evaluation of "fn:error" set to raise error "FOTY0012". . */ @org.junit.Test public void fnError9() { final XQuery query = new XQuery( "fn:error(fn:QName('http://www.w3.org/2005/xqt-errors', 'err:FOTY0012'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOTY0012") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnEscapeHtmlUri.java000066400000000000000000000412731222453003200277470ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the escape-html-uri() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnEscapeHtmlUri extends QT3TestSet { /** * A test whose essence is: `escape-html-uri()`. . */ @org.junit.Test public void kEscapeHTMLURIFunc1() { final XQuery query = new XQuery( "escape-html-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `escape-html-uri("http://example.com/", "wrong param")`. . */ @org.junit.Test public void kEscapeHTMLURIFunc2() { final XQuery query = new XQuery( "escape-html-uri(\"http://example.com/\", \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `escape-html-uri(()) eq ""`. . */ @org.junit.Test public void kEscapeHTMLURIFunc3() { final XQuery query = new XQuery( "escape-html-uri(()) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Combine fn:concat and fn:escape-html-uri. . */ @org.junit.Test public void kEscapeHTMLURIFunc4() { final XQuery query = new XQuery( "escape-html-uri(\"http://www.example.com/00/Weather/CA/Los Angeles#ocean\") eq \"http://www.example.com/00/Weather/CA/Los Angeles#ocean\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Combine fn:concat and fn:escape-html-uri. . */ @org.junit.Test public void kEscapeHTMLURIFunc5() { final XQuery query = new XQuery( "escape-html-uri(\"javascript:if (navigator.browserLanguage == 'fr') window.open('http://www.example.com/~bébé');\") eq \"javascript:if (navigator.browserLanguage == 'fr') window.open('http://www.example.com/~b%C3%A9b%C3%A9');\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke fn:normalize-space() on the return value of fn:escape-html-uri(). . */ @org.junit.Test public void kEscapeHTMLURIFunc6() { final XQuery query = new XQuery( "normalize-space(iri-to-uri((\"example.com\", current-time())[1] treat as xs:string))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example.com") ); } /** * test fn:escape-html-uri with a variety of characters . */ @org.junit.Test public void cbclEscapeHtmlUri001() { final XQuery query = new XQuery( "fn:escape-html-uri(codepoints-to-string((9, 65, 128)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "%09A%C2%80") ); } /** * Examines that the fn:escape-html-uri function does not escape the lower cases letters. . */ @org.junit.Test public void fnEscapeHtmlUri1() { final XQuery query = new XQuery( "fn:escape-html-uri(\"abcdedfghijklmnopqrstuvwxyz\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcdedfghijklmnopqrstuvwxyz") ); } /** * Examines that the fn:escape-html-uri function does not escape the ")" symbol. . */ @org.junit.Test public void fnEscapeHtmlUri10() { final XQuery query = new XQuery( "fn:escape-html-uri(\"example)example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example)example") ); } /** * Examines that the fn:escape-html-uri function does not escape the "*" symbol. . */ @org.junit.Test public void fnEscapeHtmlUri11() { final XQuery query = new XQuery( "fn:escape-html-uri(\"example*example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example*example") ); } /** * Examines that the fn:escape-html-uri function does not escape the "+" symbol. . */ @org.junit.Test public void fnEscapeHtmlUri12() { final XQuery query = new XQuery( "fn:escape-html-uri(\"example+example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example+example") ); } /** * Examines that the fn:escape-html-uri function does not escape the "," symbol. . */ @org.junit.Test public void fnEscapeHtmlUri13() { final XQuery query = new XQuery( "fn:escape-html-uri(\"example,example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example,example") ); } /** * Examines that the fn:escape-html-uri function does not escape the "-" symbol. . */ @org.junit.Test public void fnEscapeHtmlUri14() { final XQuery query = new XQuery( "fn:escape-html-uri(\"example-example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example-example") ); } /** * Examines that the fn:escape-html-uri function does not escape the "." symbol. . */ @org.junit.Test public void fnEscapeHtmlUri15() { final XQuery query = new XQuery( "fn:escape-html-uri(\"example.example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example.example") ); } /** * Examines that the fn:escape-html-uri function does not escape the "/" symbol. . */ @org.junit.Test public void fnEscapeHtmlUri16() { final XQuery query = new XQuery( "fn:escape-html-uri(\"example/example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example/example") ); } /** * Examines that the fn:escape-html-uri function does not escape the ";" symbol. . */ @org.junit.Test public void fnEscapeHtmlUri17() { final XQuery query = new XQuery( "fn:escape-html-uri(\"example;example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example;example") ); } /** * Examines that the fn:escape-html-uri function does not escape the ":" symbol. . */ @org.junit.Test public void fnEscapeHtmlUri18() { final XQuery query = new XQuery( "fn:escape-html-uri(\"example:example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example:example") ); } /** * Examines that the fn:escape-html-uri function does not escape the "@" symbol. . */ @org.junit.Test public void fnEscapeHtmlUri19() { final XQuery query = new XQuery( "fn:escape-html-uri(\"example@example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example@example") ); } /** * Examines that the fn:escape-html-uri function does not escape the upper cases letters. . */ @org.junit.Test public void fnEscapeHtmlUri2() { final XQuery query = new XQuery( "fn:escape-html-uri(\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ABCDEFGHIJKLMNOPQRSTUVWXYZ") ); } /** * Examines that the fn:escape-html-uri function does escape the euro symbol. . */ @org.junit.Test public void fnEscapeHtmlUri20() { final XQuery query = new XQuery( "fn:escape-html-uri(\"exampleé€example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example%C3%A9%E2%82%ACexample") ); } /** * Examines that the fn:escape-html-uri function does escape the euro symbol. . */ @org.junit.Test public void fnEscapeHtmlUri21() { final XQuery query = new XQuery( "fn:escape-html-uri(\"example€example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example%E2%82%ACexample") ); } /** * Examines that the fn:escape-html-uri function does not escape digits. . */ @org.junit.Test public void fnEscapeHtmlUri3() { final XQuery query = new XQuery( "fn:escape-html-uri(\"a0123456789\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a0123456789") ); } /** * Examines that the fn:escape-html-uri function does not escape the space. . */ @org.junit.Test public void fnEscapeHtmlUri4() { final XQuery query = new XQuery( "fn:escape-html-uri(\"example example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example example") ); } /** * Examines that the fn:escape-html-uri function does not escape the "!" symbol. . */ @org.junit.Test public void fnEscapeHtmlUri5() { final XQuery query = new XQuery( "fn:escape-html-uri(\"example!example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example!example") ); } /** * Examines that the fn:escape-html-uri function does not escape the "#" symbol. . */ @org.junit.Test public void fnEscapeHtmlUri6() { final XQuery query = new XQuery( "fn:escape-html-uri(\"example#example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example#example") ); } /** * Examines that the fn:escape-html-uri function does not escape the "$" symbol. . */ @org.junit.Test public void fnEscapeHtmlUri7() { final XQuery query = new XQuery( "fn:escape-html-uri(\"example$example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example$example") ); } /** * Examines that the fn:escape-html-uri function does not escape the "'" symbol. . */ @org.junit.Test public void fnEscapeHtmlUri8() { final XQuery query = new XQuery( "fn:escape-html-uri(\"example'example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example'example") ); } /** * Examines that the fn:escape-html-uri function does not escape the "(" symbol. . */ @org.junit.Test public void fnEscapeHtmlUri9() { final XQuery query = new XQuery( "fn:escape-html-uri(\"example(example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example(example") ); } /** * Test escape-html-uri from example defined in functions and operators specification . */ @org.junit.Test public void fnEscapeHtmlUri1args1() { final XQuery query = new XQuery( "escape-html-uri(\"http://www.example.com/00/Weather/CA/Los Angeles#ocean\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/00/Weather/CA/Los Angeles#ocean") ); } /** * Test escape-html-uri from example defined in functions and operators specification . */ @org.junit.Test public void fnEscapeHtmlUri1args2() { final XQuery query = new XQuery( "escape-html-uri(\"javascript:if (navigator.browserLanguage == 'fr') window.open('http://www.example.com/~bébé');\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "javascript:if (navigator.browserLanguage == 'fr') window.open('http://www.example.com/~b%C3%A9b%C3%A9');") ); } /** * Test escape-html-uri with zero-length string argument . */ @org.junit.Test public void fnEscapeHtmlUri1args3() { final XQuery query = new XQuery( "escape-html-uri('')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * Test escape-html-uri with empty sequence argument . */ @org.junit.Test public void fnEscapeHtmlUri1args4() { final XQuery query = new XQuery( "escape-html-uri(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * Test escape-html-uri with invalid argument types . */ @org.junit.Test public void fnEscapeHtmlUri1args5() { final XQuery query = new XQuery( "escape-html-uri(12)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test escape-html-uri with incorrect arity . */ @org.junit.Test public void fnEscapeHtmlUri1args6() { final XQuery query = new XQuery( "escape-html-uri('',())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnExactlyOne.java000066400000000000000000000664221222453003200273200ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the exactly-one() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnExactlyOne extends QT3TestSet { /** * A test whose essence is: `exactly-one(1, 2)`. . */ @org.junit.Test public void kSeqExactlyOneFunc1() { final XQuery query = new XQuery( "exactly-one(1, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No function by name zero-or-more exists. . */ @org.junit.Test public void kSeqExactlyOneFunc10() { final XQuery query = new XQuery( "zero-or-more(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `exactly-one()`. . */ @org.junit.Test public void kSeqExactlyOneFunc2() { final XQuery query = new XQuery( "exactly-one()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `exactly-one( (1, 2, 3) )`. . */ @org.junit.Test public void kSeqExactlyOneFunc3() { final XQuery query = new XQuery( "exactly-one( (1, 2, 3) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0005") ); } /** * A test whose essence is: `exactly-one("one") eq "one"`. . */ @org.junit.Test public void kSeqExactlyOneFunc4() { final XQuery query = new XQuery( "exactly-one(\"one\") eq \"one\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(exactly-one( "one" )) eq 1`. . */ @org.junit.Test public void kSeqExactlyOneFunc5() { final XQuery query = new XQuery( "count(exactly-one( \"one\" )) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `exactly-one(error())`. . */ @org.junit.Test public void kSeqExactlyOneFunc6() { final XQuery query = new XQuery( "exactly-one(error())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * A test whose essence is: `exactly-one((true(), error()))`. . */ @org.junit.Test public void kSeqExactlyOneFunc7() { final XQuery query = new XQuery( "exactly-one((true(), error()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * A test whose essence is: `exactly-one(( error(), true()))`. . */ @org.junit.Test public void kSeqExactlyOneFunc8() { final XQuery query = new XQuery( "exactly-one(( error(), true()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * A test whose essence is: `exactly-one( () )`. . */ @org.junit.Test public void kSeqExactlyOneFunc9() { final XQuery query = new XQuery( "exactly-one( () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0005") ); } /** * Test fn:boolean(fn:exactly-one). . */ @org.junit.Test public void cbclExactlyOne001() { final XQuery query = new XQuery( "boolean( exactly-one( remove( (, 1), 1 ) ) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:exactly-one on a count-preserving function . */ @org.junit.Test public void cbclExactlyOne002() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:generate($arg as xs:integer) { if ($arg = 0) then (1, 2, 3) else $arg }; \n" + " \tfn:exactly-one(fn:unordered( local:generate(1) ))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * test fn:exactly-one on a sequence of one-or-more items . */ @org.junit.Test public void cbclExactlyOne003() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:generate($arg as xs:integer?) { if ($arg = 0) then () else if ($arg = 1) then $arg else ($arg, $arg) }; \n" + " \t1 + fn:exactly-one(fn:one-or-more( local:generate( 1 ) ))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * test fn:exactly-one on a sequence of zero-or-one items . */ @org.junit.Test public void cbclExactlyOne004() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:generate($arg as xs:integer?) { if ($arg = 0) then () else if ($arg = 1) then $arg else ($arg, $arg) }; \n" + " \t1 + fn:exactly-one(fn:zero-or-one( local:generate( 1 ) ))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Evaluation of the fn:exactly-one function with argument to sequence with two arguments. . */ @org.junit.Test public void fnExactlyOne1() { final XQuery query = new XQuery( "fn:exactly-one((1,2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0005") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:double(lower bound) . */ @org.junit.Test public void fnExactlyOnedbl1args1() { final XQuery query = new XQuery( "fn:exactly-one(xs:double(\"-1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.7976931348623157E308") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:double(mid range) . */ @org.junit.Test public void fnExactlyOnedbl1args2() { final XQuery query = new XQuery( "fn:exactly-one(xs:double(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:double(upper bound) . */ @org.junit.Test public void fnExactlyOnedbl1args3() { final XQuery query = new XQuery( "fn:exactly-one(xs:double(\"1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.7976931348623157E308") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:decimal(lower bound) . */ @org.junit.Test public void fnExactlyOnedec1args1() { final XQuery query = new XQuery( "fn:exactly-one(xs:decimal(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:decimal(mid range) . */ @org.junit.Test public void fnExactlyOnedec1args2() { final XQuery query = new XQuery( "fn:exactly-one(xs:decimal(\"617375191608514839\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "617375191608514839") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:decimal(upper bound) . */ @org.junit.Test public void fnExactlyOnedec1args3() { final XQuery query = new XQuery( "fn:exactly-one(xs:decimal(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "999999999999999999") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:float(lower bound) . */ @org.junit.Test public void fnExactlyOneflt1args1() { final XQuery query = new XQuery( "fn:exactly-one(xs:float(\"-3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-3.4028235E38") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:float(mid range) . */ @org.junit.Test public void fnExactlyOneflt1args2() { final XQuery query = new XQuery( "fn:exactly-one(xs:float(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:float(upper bound) . */ @org.junit.Test public void fnExactlyOneflt1args3() { final XQuery query = new XQuery( "fn:exactly-one(xs:float(\"3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3.4028235E38") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:int(lower bound) . */ @org.junit.Test public void fnExactlyOneint1args1() { final XQuery query = new XQuery( "fn:exactly-one(xs:int(\"-2147483648\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-2147483648") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:int(mid range) . */ @org.junit.Test public void fnExactlyOneint1args2() { final XQuery query = new XQuery( "fn:exactly-one(xs:int(\"-1873914410\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1873914410") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:int(upper bound) . */ @org.junit.Test public void fnExactlyOneint1args3() { final XQuery query = new XQuery( "fn:exactly-one(xs:int(\"2147483647\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2147483647") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:integer(lower bound) . */ @org.junit.Test public void fnExactlyOneintg1args1() { final XQuery query = new XQuery( "fn:exactly-one(xs:integer(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:integer(mid range) . */ @org.junit.Test public void fnExactlyOneintg1args2() { final XQuery query = new XQuery( "fn:exactly-one(xs:integer(\"830993497117024304\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "830993497117024304") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:integer(upper bound) . */ @org.junit.Test public void fnExactlyOneintg1args3() { final XQuery query = new XQuery( "fn:exactly-one(xs:integer(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "999999999999999999") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:long(lower bound) . */ @org.junit.Test public void fnExactlyOnelng1args1() { final XQuery query = new XQuery( "fn:exactly-one(xs:long(\"-92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-92233720368547758") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:long(mid range) . */ @org.junit.Test public void fnExactlyOnelng1args2() { final XQuery query = new XQuery( "fn:exactly-one(xs:long(\"-47175562203048468\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-47175562203048468") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:long(upper bound) . */ @org.junit.Test public void fnExactlyOnelng1args3() { final XQuery query = new XQuery( "fn:exactly-one(xs:long(\"92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "92233720368547758") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnExactlyOnenint1args1() { final XQuery query = new XQuery( "fn:exactly-one(xs:negativeInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnExactlyOnenint1args2() { final XQuery query = new XQuery( "fn:exactly-one(xs:negativeInteger(\"-297014075999096793\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-297014075999096793") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnExactlyOnenint1args3() { final XQuery query = new XQuery( "fn:exactly-one(xs:negativeInteger(\"-1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnExactlyOnenni1args1() { final XQuery query = new XQuery( "fn:exactly-one(xs:nonNegativeInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnExactlyOnenni1args2() { final XQuery query = new XQuery( "fn:exactly-one(xs:nonNegativeInteger(\"303884545991464527\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "303884545991464527") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnExactlyOnenni1args3() { final XQuery query = new XQuery( "fn:exactly-one(xs:nonNegativeInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "999999999999999999") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnExactlyOnenpi1args1() { final XQuery query = new XQuery( "fn:exactly-one(xs:nonPositiveInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnExactlyOnenpi1args2() { final XQuery query = new XQuery( "fn:exactly-one(xs:nonPositiveInteger(\"-475688437271870490\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-475688437271870490") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnExactlyOnenpi1args3() { final XQuery query = new XQuery( "fn:exactly-one(xs:nonPositiveInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnExactlyOnepint1args1() { final XQuery query = new XQuery( "fn:exactly-one(xs:positiveInteger(\"1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnExactlyOnepint1args2() { final XQuery query = new XQuery( "fn:exactly-one(xs:positiveInteger(\"52704602390610033\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "52704602390610033") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnExactlyOnepint1args3() { final XQuery query = new XQuery( "fn:exactly-one(xs:positiveInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "999999999999999999") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:short(lower bound) . */ @org.junit.Test public void fnExactlyOnesht1args1() { final XQuery query = new XQuery( "fn:exactly-one(xs:short(\"-32768\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-32768") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:short(mid range) . */ @org.junit.Test public void fnExactlyOnesht1args2() { final XQuery query = new XQuery( "fn:exactly-one(xs:short(\"-5324\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-5324") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:short(upper bound) . */ @org.junit.Test public void fnExactlyOnesht1args3() { final XQuery query = new XQuery( "fn:exactly-one(xs:short(\"32767\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "32767") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnExactlyOneulng1args1() { final XQuery query = new XQuery( "fn:exactly-one(xs:unsignedLong(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnExactlyOneulng1args2() { final XQuery query = new XQuery( "fn:exactly-one(xs:unsignedLong(\"130747108607674654\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "130747108607674654") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnExactlyOneulng1args3() { final XQuery query = new XQuery( "fn:exactly-one(xs:unsignedLong(\"184467440737095516\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "184467440737095516") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnExactlyOneusht1args1() { final XQuery query = new XQuery( "fn:exactly-one(xs:unsignedShort(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnExactlyOneusht1args2() { final XQuery query = new XQuery( "fn:exactly-one(xs:unsignedShort(\"44633\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "44633") ); } /** * Evaluates The "exactly-one" function with the arguments set as follows: $arg = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnExactlyOneusht1args3() { final XQuery query = new XQuery( "fn:exactly-one(xs:unsignedShort(\"65535\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "65535") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnExists.java000066400000000000000000000664711222453003200265300ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the iexists() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnExists extends QT3TestSet { /** * A test whose essence is: `exists(1, 2)`. . */ @org.junit.Test public void kSeqExistsFunc1() { final XQuery query = new XQuery( "exists(1, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * The Dynamic Context property 'current dateTime' must have an explicit timezone when presented as a xs:dateTime. . */ @org.junit.Test public void kSeqExistsFunc10() { final XQuery query = new XQuery( "exists(timezone-from-dateTime(current-dateTime()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The Dynamic Context property 'current dateTime' must have an explicit timezone when presented as a xs:date. . */ @org.junit.Test public void kSeqExistsFunc11() { final XQuery query = new XQuery( "exists(timezone-from-date(current-date()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The Dynamic Context property 'current dateTime' must have an explicit timezone when presented as a xs:time. . */ @org.junit.Test public void kSeqExistsFunc12() { final XQuery query = new XQuery( "exists(timezone-from-time(current-time()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:empty combined with fn:remove. . */ @org.junit.Test public void kSeqExistsFunc13() { final XQuery query = new XQuery( "empty(remove(current-time(), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:empty combined with fn:remove and fn:not. . */ @org.junit.Test public void kSeqExistsFunc14() { final XQuery query = new XQuery( "not(empty(remove((current-time(), 1), 1)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `exists()`. . */ @org.junit.Test public void kSeqExistsFunc2() { final XQuery query = new XQuery( "exists()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `not(exists(()))`. . */ @org.junit.Test public void kSeqExistsFunc3() { final XQuery query = new XQuery( "not(exists(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `exists(1)`. . */ @org.junit.Test public void kSeqExistsFunc4() { final XQuery query = new XQuery( "exists(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `exists((1))`. . */ @org.junit.Test public void kSeqExistsFunc5() { final XQuery query = new XQuery( "exists((1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `exists((1, 2, 3))`. . */ @org.junit.Test public void kSeqExistsFunc6() { final XQuery query = new XQuery( "exists((1, 2, 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(exists(()))`. . */ @org.junit.Test public void kSeqExistsFunc7() { final XQuery query = new XQuery( "not(exists(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(exists( ((), (), (), ()) ))`. . */ @org.junit.Test public void kSeqExistsFunc8() { final XQuery query = new XQuery( "not(exists( ((), (), (), ()) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `exists(reverse((1, 2, 3)))`. . */ @org.junit.Test public void kSeqExistsFunc9() { final XQuery query = new XQuery( "exists(reverse((1, 2, 3)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:exists on a mix of values and expressions . */ @org.junit.Test public void cbclExists001() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:generate($arg as xs:integer?) { if ($arg = 0) then (1, 2, 3) else $arg }; \n" + " \tfn:exists( ( (), local:generate( () ), local:generate( 0 ), (1 to 10000000), local:generate( () ), local:generate(1)) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Tests aggregation optimizations for exists . */ @org.junit.Test public void cbclExists002() { final XQuery query = new XQuery( "exists(for $x in (1 to 10)[. mod 2 = 0] return \"blah\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Tests exists on text node . */ @org.junit.Test public void cbclExists003() { final XQuery query = new XQuery( "exists(text {(1 to 10)[. mod 2 = 0]})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test on optimization as aggregate function . */ @org.junit.Test public void cbclExists004() { final XQuery query = new XQuery( "exists(for $x in (1 to 10)[. mod 2 = 0] return true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Tests exists on a map expression . */ @org.junit.Test public void cbclExists005() { final XQuery query = new XQuery( "exists(for $x in (1 to 10)[. mod 2 = 0] return floor($x))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:double(lower bound) . */ @org.junit.Test public void fnExistsdbl1args1() { final XQuery query = new XQuery( "fn:exists((xs:double(\"-1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:double(mid range) . */ @org.junit.Test public void fnExistsdbl1args2() { final XQuery query = new XQuery( "fn:exists((xs:double(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:double(upper bound) . */ @org.junit.Test public void fnExistsdbl1args3() { final XQuery query = new XQuery( "fn:exists((xs:double(\"1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:decimal(lower bound) . */ @org.junit.Test public void fnExistsdec1args1() { final XQuery query = new XQuery( "fn:exists((xs:decimal(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:decimal(mid range) . */ @org.junit.Test public void fnExistsdec1args2() { final XQuery query = new XQuery( "fn:exists((xs:decimal(\"617375191608514839\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:decimal(upper bound) . */ @org.junit.Test public void fnExistsdec1args3() { final XQuery query = new XQuery( "fn:exists((xs:decimal(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:float(lower bound) . */ @org.junit.Test public void fnExistsflt1args1() { final XQuery query = new XQuery( "fn:exists((xs:float(\"-3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:float(mid range) . */ @org.junit.Test public void fnExistsflt1args2() { final XQuery query = new XQuery( "fn:exists((xs:float(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:float(upper bound) . */ @org.junit.Test public void fnExistsflt1args3() { final XQuery query = new XQuery( "fn:exists((xs:float(\"3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:int(lower bound) . */ @org.junit.Test public void fnExistsint1args1() { final XQuery query = new XQuery( "fn:exists((xs:int(\"-2147483648\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:int(mid range) . */ @org.junit.Test public void fnExistsint1args2() { final XQuery query = new XQuery( "fn:exists((xs:int(\"-1873914410\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:int(upper bound) . */ @org.junit.Test public void fnExistsint1args3() { final XQuery query = new XQuery( "fn:exists((xs:int(\"2147483647\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:integer(lower bound) . */ @org.junit.Test public void fnExistsintg1args1() { final XQuery query = new XQuery( "fn:exists((xs:integer(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:integer(mid range) . */ @org.junit.Test public void fnExistsintg1args2() { final XQuery query = new XQuery( "fn:exists((xs:integer(\"830993497117024304\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:integer(upper bound) . */ @org.junit.Test public void fnExistsintg1args3() { final XQuery query = new XQuery( "fn:exists((xs:integer(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:long(lower bound) . */ @org.junit.Test public void fnExistslng1args1() { final XQuery query = new XQuery( "fn:exists((xs:long(\"-92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:long(mid range) . */ @org.junit.Test public void fnExistslng1args2() { final XQuery query = new XQuery( "fn:exists((xs:long(\"-47175562203048468\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:long(upper bound) . */ @org.junit.Test public void fnExistslng1args3() { final XQuery query = new XQuery( "fn:exists((xs:long(\"92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnExistsnint1args1() { final XQuery query = new XQuery( "fn:exists((xs:negativeInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnExistsnint1args2() { final XQuery query = new XQuery( "fn:exists((xs:negativeInteger(\"-297014075999096793\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnExistsnint1args3() { final XQuery query = new XQuery( "fn:exists((xs:negativeInteger(\"-1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnExistsnni1args1() { final XQuery query = new XQuery( "fn:exists((xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnExistsnni1args2() { final XQuery query = new XQuery( "fn:exists((xs:nonNegativeInteger(\"303884545991464527\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnExistsnni1args3() { final XQuery query = new XQuery( "fn:exists((xs:nonNegativeInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnExistsnpi1args1() { final XQuery query = new XQuery( "fn:exists((xs:nonPositiveInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnExistsnpi1args2() { final XQuery query = new XQuery( "fn:exists((xs:nonPositiveInteger(\"-475688437271870490\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnExistsnpi1args3() { final XQuery query = new XQuery( "fn:exists((xs:nonPositiveInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnExistspint1args1() { final XQuery query = new XQuery( "fn:exists((xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnExistspint1args2() { final XQuery query = new XQuery( "fn:exists((xs:positiveInteger(\"52704602390610033\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnExistspint1args3() { final XQuery query = new XQuery( "fn:exists((xs:positiveInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:short(lower bound) . */ @org.junit.Test public void fnExistssht1args1() { final XQuery query = new XQuery( "fn:exists((xs:short(\"-32768\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:short(mid range) . */ @org.junit.Test public void fnExistssht1args2() { final XQuery query = new XQuery( "fn:exists((xs:short(\"-5324\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:short(upper bound) . */ @org.junit.Test public void fnExistssht1args3() { final XQuery query = new XQuery( "fn:exists((xs:short(\"32767\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnExistsulng1args1() { final XQuery query = new XQuery( "fn:exists((xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnExistsulng1args2() { final XQuery query = new XQuery( "fn:exists((xs:unsignedLong(\"130747108607674654\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnExistsulng1args3() { final XQuery query = new XQuery( "fn:exists((xs:unsignedLong(\"184467440737095516\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnExistsusht1args1() { final XQuery query = new XQuery( "fn:exists((xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnExistsusht1args2() { final XQuery query = new XQuery( "fn:exists((xs:unsignedShort(\"44633\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "exists" function with the arguments set as follows: $arg = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnExistsusht1args3() { final XQuery query = new XQuery( "fn:exists((xs:unsignedShort(\"65535\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnFalse.java000066400000000000000000000263701222453003200262750ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the function false(). * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnFalse extends QT3TestSet { /** * A test whose essence is: `false(1)`. . */ @org.junit.Test public void kFalseFunc1() { final XQuery query = new XQuery( "false(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `false() eq false()`. . */ @org.junit.Test public void kFalseFunc2() { final XQuery query = new XQuery( "false() eq false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(false())`. . */ @org.junit.Test public void kFalseFunc3() { final XQuery query = new XQuery( "not(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple call to an "fn:false" function. . */ @org.junit.Test public void fnFalse1() { final XQuery query = new XQuery( "fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) && assertType("xs:boolean") ) ); } /** * Evaluation of an "fn:false" function with a comparison expression involving the "ge" operator. . */ @org.junit.Test public void fnFalse10() { final XQuery query = new XQuery( "fn:false() ge fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an "fn:false" function with a comparison expression involving the "=" operator. . */ @org.junit.Test public void fnFalse11() { final XQuery query = new XQuery( "fn:false() = fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an "fn:false" function with a comparison expression involving the "!=" operator. . */ @org.junit.Test public void fnFalse12() { final XQuery query = new XQuery( "fn:false() != fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of an "fn:false" function with a comparison expression involving the "<" operator. . */ @org.junit.Test public void fnFalse13() { final XQuery query = new XQuery( "fn:false() < fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of an "fn:false" function with a comparison expression involving the "<=" operator. . */ @org.junit.Test public void fnFalse14() { final XQuery query = new XQuery( "fn:false() <= fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an "fn:false" function with a comparison expression involving the ">" operator. . */ @org.junit.Test public void fnFalse15() { final XQuery query = new XQuery( "fn:false() > fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of an "fn:false" function with a comparison expression involving the ">=" operator. . */ @org.junit.Test public void fnFalse16() { final XQuery query = new XQuery( "fn:false() >= fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an "fn:false" function as an argument to an "xs:boolean" function. . */ @org.junit.Test public void fnFalse17() { final XQuery query = new XQuery( "xs:boolean(fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of an "fn:false" function as an argument to an "fn:string" function. . */ @org.junit.Test public void fnFalse18() { final XQuery query = new XQuery( "fn:string(fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"false\"") ); } /** * Evaluation of an "fn:false" function as arguments to an "fn:concat" function. . */ @org.junit.Test public void fnFalse19() { final XQuery query = new XQuery( "fn:concat(xs:string(fn:false()),xs:string(fn:false()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "falsefalse") ); } /** * Evaliation of "fn:false" function as argument to fn:not function. . */ @org.junit.Test public void fnFalse2() { final XQuery query = new XQuery( "fn:not(fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an "fn:false" function as arguments to an "fn:contains" function. . */ @org.junit.Test public void fnFalse20() { final XQuery query = new XQuery( "fn:contains(xs:string(fn:false()),xs:string(fn:false()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an "fn:false" function as an argument to an "fn:string-length" function. . */ @org.junit.Test public void fnFalse21() { final XQuery query = new XQuery( "fn:string-length(xs:string(fn:false()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5") ); } /** * false() as a function item. */ @org.junit.Test public void fnFalse22() { final XQuery query = new XQuery( "let $f := false#0 return 3[$f()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of a "false" function with a logical expression involving the "and" operator. . */ @org.junit.Test public void fnFalse3() { final XQuery query = new XQuery( "fn:false() and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of a "fn:false" function with a logical expression involving the "or" operator. . */ @org.junit.Test public void fnFalse4() { final XQuery query = new XQuery( "fn:false() or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of an "fn:false" function with a comparison expression involving the "eq" operator. . */ @org.junit.Test public void fnFalse5() { final XQuery query = new XQuery( "fn:false() eq fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an "fn:false" function with a comparison expression involving the "ne" operator. . */ @org.junit.Test public void fnFalse6() { final XQuery query = new XQuery( "fn:false() ne fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of an "fn:false" function with a comparison expression involving the "lt" operator. . */ @org.junit.Test public void fnFalse7() { final XQuery query = new XQuery( "fn:false() lt fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of an "fn:false" function with a comparison expression involving the "le" operator. . */ @org.junit.Test public void fnFalse8() { final XQuery query = new XQuery( "fn:false() le fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an "fn:false" function with a comparison expression involving the "gt" operator. . */ @org.junit.Test public void fnFalse9() { final XQuery query = new XQuery( "fn:false() gt fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnFilter.java000066400000000000000000000311031222453003200264560ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the higher-order fn:filter function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnFilter extends QT3TestSet { /** * Basic test using starts-with(). */ @org.junit.Test public void filter001() { final XQuery query = new XQuery( "filter(starts-with(?, \"a\"), (\"apple\", \"pear\", \"apricot\", \"advocado\", \"orange\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"apple\", \"apricot\", \"advocado\"") ); } /** * Test using an inline user-defined function. */ @org.junit.Test public void filter002() { final XQuery query = new XQuery( "filter(function($x){$x gt 10}, (12, 4, 46, 23, -8))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("12, 46, 23") ); } /** * Test using an inline user-defined function. */ @org.junit.Test public void filter003() { final XQuery query = new XQuery( "let $data := (/employees)\n" + " return filter(function($x as element(emp)){xs:int($x/@salary) lt 300}, $data/emp)", ctx); try { query.context(node(file("fn/filter/filter003.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertCount(3) && assertType("element(emp)*") && assertQuery("$result/@name = 'john'") && assertQuery("$result/@name = 'anne'") && assertQuery("$result/@name = 'kumar'") ) ); } /** * Test using an inline user-defined function. */ @org.junit.Test public void filter004() { final XQuery query = new XQuery( "(1 to 20)[. = filter(function($x){$x idiv 2 * 2 = $x}, 1 to position())]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("2, 4, 6, 8, 10, 12, 14, 16, 18, 20") ); } /** * implement eg:index-of-node(). */ @org.junit.Test public void filter005() { final XQuery query = new XQuery( "let $index-of-node := function($seqParam as node()*, $srchParam as node()) as xs:integer* \n" + " { filter( function($this as xs:integer) as xs:boolean \n" + " {$seqParam[$this] is $srchParam}, 1 to count($seqParam) ) },\n" + " $nodes := /*/*,\n" + " $perm := ($nodes[1], $nodes[2], $nodes[3], $nodes[1], $nodes[2], $nodes[4], $nodes[2], $nodes[1]) \n" + " return $index-of-node($perm, $nodes[2]) ", ctx); try { query.context(node(file("fn/filter/filter005.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("2, 5, 7") ); } /** * filter function - not a boolean. */ @org.junit.Test public void filter901() { final XQuery query = new XQuery( "filter(normalize-space#1, (\"apple\", \"pear\", \"apricot\", \"advocado\", \"orange\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * filter function - returns empty sequence . */ @org.junit.Test public void filter902() { final XQuery query = new XQuery( "filter(function($x){if(starts-with($x,'a')) then true() else ()}, (\"apple\", \"pear\", \"apricot\", \"advocado\", \"orange\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * filter function - returns non-singleton sequence. */ @org.junit.Test public void filter903() { final XQuery query = new XQuery( "filter(function($x){if(starts-with($x,'a')) then (true(), true()) else false()}, (\"apple\", \"pear\", \"apricot\", \"advocado\", \"orange\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * filter function - item in sequence is of wrong type. */ @org.junit.Test public void filter904() { final XQuery query = new XQuery( "filter(ends-with(?, 'e'), (\"apple\", \"pear\", \"apricot\", \"advocado\", \"orange\", current-date()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Attempts to evaluate the "filter" function with no arguments.. */ @org.junit.Test public void fnFilter001() { final XQuery query = new XQuery( "fn:filter()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "filter" function with arity zero.. */ @org.junit.Test public void fnFilter002() { final XQuery query = new XQuery( "fn:filter#0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to evaluate the "filter" function with one argument.. */ @org.junit.Test public void fnFilter003() { final XQuery query = new XQuery( "fn:filter( fn:boolean#1 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "filter" function with arity one.. */ @org.junit.Test public void fnFilter004() { final XQuery query = new XQuery( "fn:filter#1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "filter" function with arity two.. */ @org.junit.Test public void fnFilter005() { final XQuery query = new XQuery( "fn:exists( fn:filter#2 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Tests the type checking of the $f argument.. */ @org.junit.Test public void fnFilter010() { final XQuery query = new XQuery( "fn:filter( function($a as item()) as xs:boolean* { fn:boolean($a), fn:boolean($a) }, () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0005") || assertEmpty() ) ); } /** * Tests the type checking of the $f argument.. */ @org.junit.Test public void fnFilter011() { final XQuery query = new XQuery( "fn:filter( function($a as item()) as xs:boolean? { () }, () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0005") || assertEmpty() ) ); } /** * Tests the type checking of the $f argument.. */ @org.junit.Test public void fnFilter012() { final XQuery query = new XQuery( "fn:filter( fn:string#1, () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || error("XPST0005") || assertEmpty() ) ); } /** * Evaluates the "filter" function with $seq set to a mix of item types . */ @org.junit.Test public void fnFilter013() { final XQuery query = new XQuery( "fn:filter( function($arg) { $arg instance of function(*) }, (//node(), 1, \"string\", 3.14, 2.7e0, fn:exists#1) )", ctx); try { query.context(node(file("fn/filter/fn-filter-012.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(1) ); } /** * Evaluates the "filter" function with $f set to a function which _could_ (but doesn't) return a non-boolean value . */ @org.junit.Test public void fnFilter014() { final XQuery query = new XQuery( "fn:filter( function($arg) { if ($arg eq 100) then () else fn:true()}, 1 to 10)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(10) ); } /** * Evaluates the "filter" function with $f set to a function which _could_ (and does) return a non-boolean value . */ @org.junit.Test public void fnFilter015() { final XQuery query = new XQuery( "fn:filter( function($arg) { if ($arg eq 10) then () else fn:true()}, 1 to 10)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluates the "filter" function with $f set to a function which _could_ (but doesn't) return a non-boolean value . */ @org.junit.Test public void fnFilter017() { final XQuery query = new XQuery( "fn:filter( function($arg) { if ($arg eq 100) then 0 else fn:true()}, 1 to 10)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(10) ); } /** * Evaluates the "filter" function with $f set to a function which _could_ (and does) return a non-boolean value . */ @org.junit.Test public void fnFilter018() { final XQuery query = new XQuery( "fn:filter( function($arg) { if ($arg eq 10) then 0 else fn:true()}, 1 to 10)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluates the "filter" function with $f set to a function which _could_ (but doesn't) return a non-boolean value . */ @org.junit.Test public void fnFilter020() { final XQuery query = new XQuery( "fn:filter( function($arg) { if ($arg eq 100) then (fn:true(), fn:false()) else fn:true()}, 1 to 10)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(10) ); } /** * Evaluates the "filter" function with $f set to a function which _could_ (and does) return a non-boolean value . */ @org.junit.Test public void fnFilter021() { final XQuery query = new XQuery( "fn:filter( function($arg) { if ($arg eq 10) then (fn:true(), fn:false()) else fn:true()}, 1 to 10)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnFloor.java000066400000000000000000001243751222453003200263300ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the fn:floor() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnFloor extends QT3TestSet { /** * A test whose essence is: `floor()`. . */ @org.junit.Test public void kFloorFunc1() { final XQuery query = new XQuery( "floor()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `floor(1, 2)`. . */ @org.junit.Test public void kFloorFunc2() { final XQuery query = new XQuery( "floor(1, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(floor(()))`. . */ @org.junit.Test public void kFloorFunc3() { final XQuery query = new XQuery( "empty(floor(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `floor(10.5) eq 10`. . */ @org.junit.Test public void kFloorFunc4() { final XQuery query = new XQuery( "floor(10.5) eq 10", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `floor(-10.5) eq -11`. . */ @org.junit.Test public void kFloorFunc5() { final XQuery query = new XQuery( "floor(-10.5) eq -11", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `floor("a string")`. . */ @org.junit.Test public void kFloorFunc6() { final XQuery query = new XQuery( "floor(\"a string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Ensure the return type is properly inferred. . */ @org.junit.Test public void k2FloorFunc1() { final XQuery query = new XQuery( "floor(xs:unsignedShort(.)) instance of xs:integer", ctx); try { query.context(node(file("fn/abs/e1.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is properly inferred for long. . */ @org.junit.Test public void k2FloorFunc10() { final XQuery query = new XQuery( "floor(xs:long(.)) instance of xs:integer", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is properly inferred for int. . */ @org.junit.Test public void k2FloorFunc11() { final XQuery query = new XQuery( "floor(xs:int(.)) instance of xs:integer", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is properly inferred for short. . */ @org.junit.Test public void k2FloorFunc12() { final XQuery query = new XQuery( "floor(xs:short(.)) instance of xs:integer", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is properly inferred for byte. . */ @org.junit.Test public void k2FloorFunc13() { final XQuery query = new XQuery( "floor(xs:byte(.)) instance of xs:integer", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is properly inferred for unsignedShort. . */ @org.junit.Test public void k2FloorFunc2() { final XQuery query = new XQuery( "floor(xs:unsignedShort(.)) instance of xs:integer", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is properly inferred for unsignedLong. . */ @org.junit.Test public void k2FloorFunc3() { final XQuery query = new XQuery( "floor(xs:unsignedLong(.)) instance of xs:integer", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is properly inferred for unsignedInt. . */ @org.junit.Test public void k2FloorFunc4() { final XQuery query = new XQuery( "floor(xs:unsignedInt(.)) instance of xs:integer", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is properly inferred for unsignedByte. . */ @org.junit.Test public void k2FloorFunc5() { final XQuery query = new XQuery( "floor(xs:unsignedByte(.)) instance of xs:integer", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is properly inferred for positiveInteger. . */ @org.junit.Test public void k2FloorFunc6() { final XQuery query = new XQuery( "floor(xs:positiveInteger(.)) instance of xs:integer", ctx); try { query.context(node(file("fn/abs/e1.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is properly inferred for nonPositiveInteger. . */ @org.junit.Test public void k2FloorFunc7() { final XQuery query = new XQuery( "floor(xs:nonPositiveInteger(.)) instance of xs:integer", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is properly inferred for nonNegativeInteger. . */ @org.junit.Test public void k2FloorFunc8() { final XQuery query = new XQuery( "floor(xs:nonNegativeInteger(.)) instance of xs:integer", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is properly inferred for negativeInteger. . */ @org.junit.Test public void k2FloorFunc9() { final XQuery query = new XQuery( "floor(xs:negativeInteger(.)) instance of xs:integer", ctx); try { query.context(node(file("fn/abs/e-1.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * check dynamic type of fn:floor on argument of union of numeric types. . */ @org.junit.Test public void fnFloor1() { final XQuery query = new XQuery( "for $x in (1, xs:decimal(2), xs:float(3), xs:double(4)) return \n" + " if ((floor($x)) instance of xs:integer) then \"integer\" \n" + " else if ((floor($x)) instance of xs:decimal) then \"decimal\" \n" + " else if ((floor($x)) instance of xs:float) then \"float\"\n" + " else if ((floor($x)) instance of xs:double) then \"double\" \n" + " else error()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"integer\", \"decimal\", \"float\", \"double\"") ); } /** * Basic test of floor(decimal). */ @org.junit.Test public void fnFloorDecimal1() { final XQuery query = new XQuery( "floor(12.5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("12.0") && assertType("xs:decimal") ) ); } /** * Basic test of floor(decimal). */ @org.junit.Test public void fnFloorDecimal2() { final XQuery query = new XQuery( "floor(12.9)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("12.0") && assertType("xs:decimal") ) ); } /** * Basic test of floor(decimal). */ @org.junit.Test public void fnFloorDecimal3() { final XQuery query = new XQuery( "floor(0.000000001)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0.0") && assertType("xs:decimal") ) ); } /** * Basic test of floor(decimal). */ @org.junit.Test public void fnFloorDecimal4() { final XQuery query = new XQuery( "floor(0.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0.0") && assertType("xs:decimal") ) ); } /** * Basic test of floor(decimal). */ @org.junit.Test public void fnFloorDecimal5() { final XQuery query = new XQuery( "floor(-0.1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-1.0") && assertType("xs:decimal") ) ); } /** * Basic test of floor(decimal). */ @org.junit.Test public void fnFloorDecimal6() { final XQuery query = new XQuery( "floor(-12345678.567890)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-12345679") && assertType("xs:decimal") ) ); } /** * Basic test of floor(decimal). */ @org.junit.Test public void fnFloorDecimal7() { final XQuery query = new XQuery( "floor(-1234567891234567.2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-1234567891234568.0") && assertType("xs:decimal") ) ); } /** * Basic test of floor(double). */ @org.junit.Test public void fnFloorDouble1() { final XQuery query = new XQuery( "floor(12.5e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("12.0e0") && assertType("xs:double") ) ); } /** * Basic test of floor(double). */ @org.junit.Test public void fnFloorDouble10() { final XQuery query = new XQuery( "floor(xs:double('-INF'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "-INF") && assertType("xs:double") ) ); } /** * Basic test of floor(double). */ @org.junit.Test public void fnFloorDouble11() { final XQuery query = new XQuery( "floor(xs:double('-0'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "-0") && assertType("xs:double") ) ); } /** * Basic test of floor(double). */ @org.junit.Test public void fnFloorDouble2() { final XQuery query = new XQuery( "floor(12.9e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("12.0e0") && assertType("xs:double") ) ); } /** * Basic test of floor(double). */ @org.junit.Test public void fnFloorDouble3() { final XQuery query = new XQuery( "floor(0.000000001e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0.0e0") && assertType("xs:double") ) ); } /** * Basic test of floor(double). */ @org.junit.Test public void fnFloorDouble4() { final XQuery query = new XQuery( "floor(0.0e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0.0e0") && assertType("xs:double") ) ); } /** * Basic test of floor(double). */ @org.junit.Test public void fnFloorDouble5() { final XQuery query = new XQuery( "floor(-0.1e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-1.0e0") && assertType("xs:double") ) ); } /** * Basic test of floor(double). */ @org.junit.Test public void fnFloorDouble6() { final XQuery query = new XQuery( "floor(-12345678.567890e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-12345679e0") && assertType("xs:double") ) ); } /** * Basic test of floor(double). */ @org.junit.Test public void fnFloorDouble7() { final XQuery query = new XQuery( "floor(-1234567891234567.2e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-1234567891234568.0e0") && assertType("xs:double") ) ); } /** * Basic test of floor(double). */ @org.junit.Test public void fnFloorDouble8() { final XQuery query = new XQuery( "floor(xs:double('NaN'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "NaN") && assertType("xs:double") ) ); } /** * Basic test of floor(double). */ @org.junit.Test public void fnFloorDouble9() { final XQuery query = new XQuery( "floor(xs:double('INF'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "INF") && assertType("xs:double") ) ); } /** * Basic test of floor(float)). */ @org.junit.Test public void fnFloorFloat1() { final XQuery query = new XQuery( "floor(xs:float(12.5e0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("12.0e0") && assertType("xs:float") ) ); } /** * Basic test of floor(float)). */ @org.junit.Test public void fnFloorFloat10() { final XQuery query = new XQuery( "floor(xs:float(xs:float('-INF')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "-INF") && assertType("xs:float") ) ); } /** * Basic test of floor(float)). */ @org.junit.Test public void fnFloorFloat11() { final XQuery query = new XQuery( "floor(xs:float(xs:float('-0')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "-0") && assertType("xs:float") ) ); } /** * Basic test of floor(float)). */ @org.junit.Test public void fnFloorFloat2() { final XQuery query = new XQuery( "floor(xs:float(12.9e0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("12.0e0") && assertType("xs:float") ) ); } /** * Basic test of floor(float)). */ @org.junit.Test public void fnFloorFloat3() { final XQuery query = new XQuery( "floor(xs:float(0.000000001e0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0.0e0") && assertType("xs:float") ) ); } /** * Basic test of floor(float)). */ @org.junit.Test public void fnFloorFloat4() { final XQuery query = new XQuery( "floor(xs:float(0.0e0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0.0e0") && assertType("xs:float") ) ); } /** * Basic test of floor(float)). */ @org.junit.Test public void fnFloorFloat5() { final XQuery query = new XQuery( "floor(xs:float(-0.1e0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-1.0e0") && assertType("xs:float") ) ); } /** * Basic test of floor(float)). */ @org.junit.Test public void fnFloorFloat6() { final XQuery query = new XQuery( "floor(xs:float(-12345678.567890e0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-12345679e0") && assertType("xs:float") ) ); } /** * Basic test of floor(float)). */ @org.junit.Test public void fnFloorFloat7() { final XQuery query = new XQuery( "floor(xs:float(-1234567.2e0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-1234568e0") && assertType("xs:float") ) ); } /** * Basic test of floor(float)). */ @org.junit.Test public void fnFloorFloat8() { final XQuery query = new XQuery( "floor(xs:float(xs:float('NaN')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "NaN") && assertType("xs:float") ) ); } /** * Basic test of floor(float)). */ @org.junit.Test public void fnFloorFloat9() { final XQuery query = new XQuery( "floor(xs:float(xs:float('INF')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "INF") && assertType("xs:float") ) ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:double(lower bound) . */ @org.junit.Test public void fnFloordbl1args1() { final XQuery query = new XQuery( "fn:floor(xs:double(\"-1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.7976931348623157E308") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:double(mid range) . */ @org.junit.Test public void fnFloordbl1args2() { final XQuery query = new XQuery( "fn:floor(xs:double(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:double(upper bound) . */ @org.junit.Test public void fnFloordbl1args3() { final XQuery query = new XQuery( "fn:floor(xs:double(\"1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.7976931348623157E308") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:decimal(lower bound) . */ @org.junit.Test public void fnFloordec1args1() { final XQuery query = new XQuery( "fn:floor(xs:decimal(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:decimal(mid range) . */ @org.junit.Test public void fnFloordec1args2() { final XQuery query = new XQuery( "fn:floor(xs:decimal(\"617375191608514839\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "617375191608514839") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:decimal(upper bound) . */ @org.junit.Test public void fnFloordec1args3() { final XQuery query = new XQuery( "fn:floor(xs:decimal(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "999999999999999999") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:float(lower bound) . */ @org.junit.Test public void fnFloorflt1args1() { final XQuery query = new XQuery( "fn:floor(xs:float(\"-3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-3.4028235E38") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:float(mid range) . */ @org.junit.Test public void fnFloorflt1args2() { final XQuery query = new XQuery( "fn:floor(xs:float(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:float(upper bound) . */ @org.junit.Test public void fnFloorflt1args3() { final XQuery query = new XQuery( "fn:floor(xs:float(\"3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3.4028235E38") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:int(lower bound) . */ @org.junit.Test public void fnFloorint1args1() { final XQuery query = new XQuery( "fn:floor(xs:int(\"-2147483648\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-2147483648") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:int(mid range) . */ @org.junit.Test public void fnFloorint1args2() { final XQuery query = new XQuery( "fn:floor(xs:int(\"-1873914410\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1873914410") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:int(upper bound) . */ @org.junit.Test public void fnFloorint1args3() { final XQuery query = new XQuery( "fn:floor(xs:int(\"2147483647\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2147483647") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:integer(lower bound) . */ @org.junit.Test public void fnFloorintg1args1() { final XQuery query = new XQuery( "fn:floor(xs:integer(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:integer(mid range) . */ @org.junit.Test public void fnFloorintg1args2() { final XQuery query = new XQuery( "fn:floor(xs:integer(\"830993497117024304\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "830993497117024304") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:integer(upper bound) . */ @org.junit.Test public void fnFloorintg1args3() { final XQuery query = new XQuery( "fn:floor(xs:integer(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "999999999999999999") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:long(lower bound) . */ @org.junit.Test public void fnFloorlng1args1() { final XQuery query = new XQuery( "fn:floor(xs:long(\"-92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-92233720368547758") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:long(mid range) . */ @org.junit.Test public void fnFloorlng1args2() { final XQuery query = new XQuery( "fn:floor(xs:long(\"-47175562203048468\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-47175562203048468") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:long(upper bound) . */ @org.junit.Test public void fnFloorlng1args3() { final XQuery query = new XQuery( "fn:floor(xs:long(\"92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "92233720368547758") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnFloornint1args1() { final XQuery query = new XQuery( "fn:floor(xs:negativeInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnFloornint1args2() { final XQuery query = new XQuery( "fn:floor(xs:negativeInteger(\"-297014075999096793\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-297014075999096793") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnFloornint1args3() { final XQuery query = new XQuery( "fn:floor(xs:negativeInteger(\"-1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnFloornni1args1() { final XQuery query = new XQuery( "fn:floor(xs:nonNegativeInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnFloornni1args2() { final XQuery query = new XQuery( "fn:floor(xs:nonNegativeInteger(\"303884545991464527\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "303884545991464527") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnFloornni1args3() { final XQuery query = new XQuery( "fn:floor(xs:nonNegativeInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "999999999999999999") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnFloornpi1args1() { final XQuery query = new XQuery( "fn:floor(xs:nonPositiveInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnFloornpi1args2() { final XQuery query = new XQuery( "fn:floor(xs:nonPositiveInteger(\"-475688437271870490\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-475688437271870490") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnFloornpi1args3() { final XQuery query = new XQuery( "fn:floor(xs:nonPositiveInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnFloorpint1args1() { final XQuery query = new XQuery( "fn:floor(xs:positiveInteger(\"1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnFloorpint1args2() { final XQuery query = new XQuery( "fn:floor(xs:positiveInteger(\"52704602390610033\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "52704602390610033") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnFloorpint1args3() { final XQuery query = new XQuery( "fn:floor(xs:positiveInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "999999999999999999") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:short(lower bound) . */ @org.junit.Test public void fnFloorsht1args1() { final XQuery query = new XQuery( "fn:floor(xs:short(\"-32768\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-32768") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:short(mid range) . */ @org.junit.Test public void fnFloorsht1args2() { final XQuery query = new XQuery( "fn:floor(xs:short(\"-5324\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-5324") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:short(upper bound) . */ @org.junit.Test public void fnFloorsht1args3() { final XQuery query = new XQuery( "fn:floor(xs:short(\"32767\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "32767") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnFloorulng1args1() { final XQuery query = new XQuery( "fn:floor(xs:unsignedLong(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnFloorulng1args2() { final XQuery query = new XQuery( "fn:floor(xs:unsignedLong(\"130747108607674654\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "130747108607674654") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnFloorulng1args3() { final XQuery query = new XQuery( "fn:floor(xs:unsignedLong(\"184467440737095516\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "184467440737095516") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnFloorusht1args1() { final XQuery query = new XQuery( "fn:floor(xs:unsignedShort(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnFloorusht1args2() { final XQuery query = new XQuery( "fn:floor(xs:unsignedShort(\"44633\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "44633") ); } /** * Evaluates The "floor" function with the arguments set as follows: $arg = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnFloorusht1args3() { final XQuery query = new XQuery( "fn:floor(xs:unsignedShort(\"65535\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "65535") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnFoldLeft.java000066400000000000000000000322201222453003200267310ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the fn:fold-left() higher-order function introduced in XPath 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnFoldLeft extends QT3TestSet { /** * Higher Order Functions fold-left function . */ @org.junit.Test public void foldLeft001() { final XQuery query = new XQuery( "fold-left(function($a, $b) { $a + $b }, 0, 1 to 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("15") ); } /** * Higher Order Functions fold-left function . */ @org.junit.Test public void foldLeft002() { final XQuery query = new XQuery( "fold-left(function($a, $b) { $a * $b }, 1, (2,3,5,7))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("210") ); } /** * Higher Order Functions fold-left function . */ @org.junit.Test public void foldLeft003() { final XQuery query = new XQuery( "fold-left(function($a, $b) { $a or $b }, false(), (true(), false(), false()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Higher Order Functions fold-left function . */ @org.junit.Test public void foldLeft004() { final XQuery query = new XQuery( "fold-left(function($a, $b) { $a and $b }, false(), (true(), false(), false()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Higher Order Functions fold-left function . */ @org.junit.Test public void foldLeft005() { final XQuery query = new XQuery( "fold-left(function($a, $b) {($b, $a)}, (), 1 to 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("5, 4, 3, 2, 1") ); } /** * Higher Order Functions fold-left function . */ @org.junit.Test public void foldLeft006() { final XQuery query = new XQuery( "fold-left(fn:concat(?, \".\", ?), \"\", 1 to 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'.1.2.3.4.5'") ); } /** * Higher Order Functions fold-left function . */ @org.junit.Test public void foldLeft007() { final XQuery query = new XQuery( "fold-left(fn:concat(\"$f(\", ?, \", \", ?, \")\"), \"$zero\", 1 to 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "$f($f($f($f($f($zero, 1), 2), 3), 4), 5)") ); } /** * get the employees who worked the maximum number of hours . */ @org.junit.Test public void foldLeft008() { final XQuery query = new XQuery( "\n" + " let $hours := function ($emp as element(employee)) as xs:integer { sum($emp/hours/xs:integer(.)) },\n" + " $highest := function ($f as function(item()) as xs:anyAtomicType, $seq as item()*) { \n" + " fold-left(\n" + " function($highestSoFar as item()*, $this as item()*) as item()* {\n" + " if (empty($highestSoFar))\n" + " then $this\n" + " else let $thisValue := $f($this),\n" + " $highestValue := $f($highestSoFar[1])\n" + " return if ($thisValue gt $highestValue)\n" + " then $this\n" + " else if ($thisValue eq $highestValue)\n" + " then ($highestSoFar, $this)\n" + " else $highestSoFar\n" + " }, (), $seq)\n" + " }\n" + " \n" + " return $highest($hours, /works/employee) \n" + " ", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertCount(1) && assertType("element(employee)") && assertQuery("$result/@name = \"John Doe 2\"") ) ); } /** * fold-left-009 author Michael Kay, Saxonica implement eg:distinct-nodes-stable() . */ @org.junit.Test public void foldLeft009() { final XQuery query = new XQuery( "\n" + " declare function local:distinct-nodes-stable($seq as node()*) { \n" + " fold-left( function($foundSoFar as node()*, $this as node()) as node()* { \n" + " if ($foundSoFar intersect $this) \n" + " then $foundSoFar \n" + " else ($foundSoFar, $this) }, (), $seq) \n" + " }; \n" + " let $nodes := (, , , , , ) \n" + " let $perm := ($nodes[1], $nodes[2], $nodes[4], $nodes[1], $nodes[2], $nodes[3], $nodes[2], $nodes[1]) \n" + " return local:distinct-nodes-stable($perm)/local-name()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b d c") ); } /** * Higher Order Functions fold-left function: supplied function has wrong arity. */ @org.junit.Test public void foldLeft010() { final XQuery query = new XQuery( "fold-left(function($a, $b, $c){ $a + $b + $c }, 1, 1 to 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Higher Order Functions fold-left function: supplied function delivers result of wrong type. */ @org.junit.Test public void foldLeft011() { final XQuery query = new XQuery( "fold-left(function($a, $b) as element(foo) { $a + $b }, 1, 1 to 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Higher Order Functions fold-left function: 'zero' value is of wrong type. */ @org.junit.Test public void foldLeft012() { final XQuery query = new XQuery( "fold-left(function($a, $b) { $a + $b }, \"\", 1 to 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Higher Order Functions fold-left function: second argument is of wrong type. */ @org.junit.Test public void foldLeft013() { final XQuery query = new XQuery( "fold-left(function($a, $b as element(foo)) { $a + $b }, 1, 1 to 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Higher Order Functions fold-left function: first argument is of wrong type. */ @org.junit.Test public void foldLeft014() { final XQuery query = new XQuery( "fold-left(function($a as element(bar), $b) { $a + $b }, 1, 1 to 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Higher Order Functions fold-left function. */ @org.junit.Test public void foldLeft015() { final XQuery query = new XQuery( "fold-left(function($a, $b){ ($a, $b) }, 1, 1 to 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1, 1, 2") ); } /** * Higher Order Functions fold-left function. Dynamic node selection.. */ @org.junit.Test public void foldLeft016() { final XQuery query = new XQuery( "\n" + "let $html := \n" + " \n" + "\t
    \n" + "\t

    Hello World!

    \t\n" + "\t
    \n" + "\t

    Goodbye!

    \t\n" + " \n" + "\n" + "let $css-selectors := \n" + " main\n" + " para\n" + "/*\n" + "let $interpreter := function($ctx, $selector){\n" + " typeswitch($selector)\n" + " case $a as element(id) return $ctx//*[@id = $a/text()]\n" + " case $a as element(class) return $ctx//*[@class = $a/text()]\n" + " default return ()\n" + "}\n" + "let $result := fold-left($interpreter, $html, $css-selectors)\n" + "return\n" + " $result/text()\n" + "\t ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Hello World!") ); } /** * Higher Order Functions fold-left function. Display fold-left structural transformation.. */ @org.junit.Test public void foldLeft017() { final XQuery query = new XQuery( "fold-left(concat(\"(\", ?, \"+\", ?, \")\"), 0, 1 to 13)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "(((((((((((((0+1)+2)+3)+4)+5)+6)+7)+8)+9)+10)+11)+12)+13)") ); } /** * Higher Order Functions fold-left function. Count the number of words in a sentence.. */ @org.junit.Test public void foldLeft018() { final XQuery query = new XQuery( "\n" + "let $text := \"Peter Piper picked a peck of pickled peppers A peck of pickled peppers Peter Piper picked\"\n" + "let $tokens := tokenize($text, '\\s')\n" + "let $counter := function($result, $word){\n" + " let $word-count := $result[@value = $word]\n" + " return\n" + " if(empty($word-count)) then\n" + " ($result, )\n" + " else\n" + " (\n" + " $result except $word-count,\n" + " \n" + " )\n" + "}\n" + "let $words := fold-left($counter, (), $tokens)\n" + "return (\n" + " number($words[@value=\"Peter\"]/@count),\n" + " number($words[@value=\"Piper\"]/@count),\n" + " number($words[@value=\"pickled\"]/@count)\n" + ")\n" + "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("2, 2, 2") ); } /** * Higher Order Functions fold-left function. Returns the average of the sequence values.. */ @org.junit.Test public void foldLeft019() { final XQuery query = new XQuery( "fold-left(function($a, $b){ if(empty($a)) then $b else ($a + $b) div 2 }, (), (13, 14, 9, 6))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "8.625") ); } /** * Higher Order Functions fold-left function. Count the number of items in a sequence.. */ @org.junit.Test public void foldLeft020() { final XQuery query = new XQuery( "fold-left(function($a, $b){ $a + 1}, 0, 1 to 1000000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1000000") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnFoldRight.java000066400000000000000000000261501222453003200271210ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the fn:fold-left() higher-order function introduced in XPath 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnFoldRight extends QT3TestSet { /** * * Higher Order Functions * fold-right function * Author - Michael Kay, Saxonica * . */ @org.junit.Test public void foldRight001() { final XQuery query = new XQuery( "fold-right(function($a, $b) { $a + $b }, 0, 1 to 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("15") ); } /** * * Higher Order Functions * fold-right function * Author - Michael Kay, Saxonica * . */ @org.junit.Test public void foldRight002() { final XQuery query = new XQuery( "fold-right(function($a, $b) { $a * $b }, 1, (2,3,5,7))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("210") ); } /** * * Higher Order Functions * fold-right function * Author - Michael Kay, Saxonica * . */ @org.junit.Test public void foldRight003() { final XQuery query = new XQuery( "fold-right(function($a, $b) { $a or $b }, false(), (true(), false(), false()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Higher Order Functions * fold-right function * Author - Michael Kay, Saxonica * . */ @org.junit.Test public void foldRight004() { final XQuery query = new XQuery( "fold-right(function($a, $b) { $a and $b }, false(), (true(), false(), false()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Higher Order Functions * fold-right function * Author - Michael Kay, Saxonica * . */ @org.junit.Test public void foldRight005() { final XQuery query = new XQuery( "let $f := function($a, $b){($b, $a)} return fold-right($f, (), 1 to 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("5,4,3,2,1") ); } /** * * Higher Order Functions * fold-right function * Author - Michael Kay, Saxonica * . */ @org.junit.Test public void foldRight006() { final XQuery query = new XQuery( "fold-right(fn:concat(?, \".\", ?), \"\", 1 to 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'1.2.3.4.5.'") ); } /** * * Higher Order Functions * fold-right function * Author - Michael Kay, Saxonica * . */ @org.junit.Test public void foldRight007() { final XQuery query = new XQuery( "fold-right(fn:concat(\"$f(\", ?, \", \", ?, \")\"), \"$zero\", 1 to 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "$f(1, $f(2, $f(3, $f(4, $f(5, $zero)))))") ); } /** * * Higher Order Functions * fold-right function * . */ @org.junit.Test public void foldRight008() { final XQuery query = new XQuery( "fold-right(function($a, $b, $c){ $a + $b + $c }, 0, 1 to 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * Higher Order Functions * fold-right function * . */ @org.junit.Test public void foldRight009() { final XQuery query = new XQuery( "fold-right(function($a, $b){ $a + $b }, \"\", 1 to 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * Higher Order Functions * fold-right function * . */ @org.junit.Test public void foldRight010() { final XQuery query = new XQuery( "fold-right(function($a as xs:string, $b){ $a + $b }, 0, 1 to 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * Higher Order Functions * fold-right function * . */ @org.junit.Test public void foldRight011() { final XQuery query = new XQuery( "fold-right(function($a, $b as xs:string){ $a + $b }, 0, 1 to 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * Higher Order Functions * fold-right function * . */ @org.junit.Test public void foldRight012() { final XQuery query = new XQuery( "fold-right(function($a, $b) as xs:string { $a + $b }, 0, 1 to 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * Higher Order Functions * fold-right function * Count the number of items in a sequence * . */ @org.junit.Test public void foldRight013() { final XQuery query = new XQuery( "fold-right(function($a, $b){ $b + 1 }, 0, 1 to 1000000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1000000") ); } /** * * Higher Order Functions * fold-right function * Reverse the sequence order * . */ @org.junit.Test public void foldRight014() { final XQuery query = new XQuery( "fold-right(function($a , $b){ ($b, $a) }, (), (1 to 5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("5, 4, 3, 2, 1") ); } /** * * Higher Order Functions * fold-right function * Remove duplicate values in a sequence * . */ @org.junit.Test public void foldRight015() { final XQuery query = new XQuery( "fold-right(function($a, $b){ if(exists($b[. eq $a])) then $b else ($a, $b) }, (), (1, 2, 2, 3, 3, 3, 4, 5, 5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1, 2, 3, 4, 5") ); } /** * * Higher Order Functions * fold-right function * Double each value in a sequence * . */ @org.junit.Test public void foldRight016() { final XQuery query = new XQuery( "fold-right(function($a, $b){ ($a, $a, $b) }, (), (1 to 5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1, 1, 2, 2, 3, 3, 4, 4, 5, 5") ); } /** * * Higher Order Functions * fold-right function * Show fold-right structural transformation * . */ @org.junit.Test public void foldRight017() { final XQuery query = new XQuery( "fold-right(concat(\"(\", ?, \"+\", ?, \")\"), 0, (1 to 13))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "(1+(2+(3+(4+(5+(6+(7+(8+(9+(10+(11+(12+(13+0)))))))))))))") ); } /** * * Higher Order Functions * fold-right function * Returns the accumulated length of all strings * . */ @org.junit.Test public void foldRight018() { final XQuery query = new XQuery( "fold-right(function($a, $b){ string-length($a) + $b }, 0, (\"Hello\", \"World\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10") ); } /** * * Higher Order Functions * fold-right function * Max() function * . */ @org.junit.Test public void foldRight019() { final XQuery query = new XQuery( "fold-right(function($a, $b){ if(empty($b)) then $a else if($a lt $b) then $b else $a }, (), 1 to 10)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10") ); } /** * * Higher Order Functions * fold-right function * Min() function * . */ @org.junit.Test public void foldRight020() { final XQuery query = new XQuery( "fold-right(function($a, $b){ if(empty($b)) then $a else if($a gt $b) then $b else $a }, (), 1 to 10)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnFormatDate.java000066400000000000000000002105361222453003200272700ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the format-date() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnFormatDate extends QT3TestSet { /** * test format-date: basic numeric formats. */ @org.junit.Test public void formatDate001a() { final XQuery query = new XQuery( "format-date($d,\"[Y]-[M01]-[D]\")", ctx); try { query.bind("d", new XQuery("xs:date('2003-09-07')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2003-09-7") ); } /** * test format-date: basic numeric formats. */ @org.junit.Test public void formatDate001b() { final XQuery query = new XQuery( "format-date($d,\"[M]-[D]-[Y]\")", ctx); try { query.bind("d", new XQuery("xs:date('2003-09-07')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9-7-2003") ); } /** * test format-date: basic numeric formats. */ @org.junit.Test public void formatDate001c() { final XQuery query = new XQuery( "format-date($d,\"[D]-[M]-[Y]\")", ctx); try { query.bind("d", new XQuery("xs:date('2003-09-07')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "7-9-2003") ); } /** * test format-date: basic numeric formats. */ @org.junit.Test public void formatDate001d() { final XQuery query = new XQuery( "format-date($d,\"[D1] [MI] [Y]\")", ctx); try { query.bind("d", new XQuery("xs:date('2003-09-07')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "7 IX 2003") ); } /** * test format-date: basic numeric formats. */ @org.junit.Test public void formatDate001e() { final XQuery query = new XQuery( "format-date($d,\"[[[Y]-[M01]-[D01]]]\")", ctx); try { query.bind("d", new XQuery("xs:date('2003-09-07')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "[2003-09-07]") ); } /** * test format-date: basic numeric formats. */ @org.junit.Test public void formatDate001f() { final XQuery query = new XQuery( "format-date($d,\"[[[Y0001]-[M01]-[D01]]]\")", ctx); try { query.bind("d", new XQuery("xs:date('2003-09-07')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "[2003-09-07]") ); } /** * test format-date: basic numeric formats. */ @org.junit.Test public void formatDate001g() { final XQuery query = new XQuery( "format-date($d,\"([Y01]-[M01]-[D01])\")", ctx); try { query.bind("d", new XQuery("xs:date('2003-09-07')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "(03-09-07)") ); } /** * Test format-date: upper-case roman numerals for year. */ @org.junit.Test public void formatDate005() { final XQuery query = new XQuery( " string-join( for $i in 1 to 100 return format-date($t + xs:yearMonthDuration('P1Y')*$i,\n" + " '[YI]'), ' ')", ctx); try { query.bind("t", new XQuery("xs:date('1950-01-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "MCMLI MCMLII MCMLIII MCMLIV MCMLV MCMLVI MCMLVII MCMLVIII\n MCMLIX MCMLX MCMLXI MCMLXII MCMLXIII MCMLXIV MCMLXV MCMLXVI MCMLXVII MCMLXVIII\n MCMLXIX MCMLXX MCMLXXI MCMLXXII MCMLXXIII MCMLXXIV MCMLXXV MCMLXXVI MCMLXXVII\n MCMLXXVIII MCMLXXIX MCMLXXX MCMLXXXI MCMLXXXII MCMLXXXIII MCMLXXXIV MCMLXXXV\n MCMLXXXVI MCMLXXXVII MCMLXXXVIII MCMLXXXIX MCMXC MCMXCI MCMXCII MCMXCIII\n MCMXCIV MCMXCV MCMXCVI MCMXCVII MCMXCVIII MCMXCIX MM MMI MMII MMIII MMIV MMV\n MMVI MMVII MMVIII MMIX MMX MMXI MMXII MMXIII MMXIV MMXV MMXVI MMXVII\n MMXVIII MMXIX MMXX MMXXI MMXXII MMXXIII MMXXIV MMXXV MMXXVI MMXXVII MMXXVIII\n MMXXIX MMXXX MMXXXI MMXXXII MMXXXIII MMXXXIV MMXXXV MMXXXVI MMXXXVII MMXXXVIII\n MMXXXIX MMXL MMXLI MMXLII MMXLIII MMXLIV MMXLV MMXLVI MMXLVII MMXLVIII MMXLIX\n MML") ); } /** * Test format-date: lower-case roman numerals for year (width specifier ignored). */ @org.junit.Test public void formatDate006() { final XQuery query = new XQuery( " string-join( for $i in 1 to 100 return format-date($t +\n" + " xs:yearMonthDuration('P17Y')*$i, '[Yi,4-4]'), ' ')", ctx); try { query.bind("t", new XQuery("xs:date('0800-01-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "dcccxvii dcccxxxiv dcccli dccclxviii dccclxxxv cmii cmxix\n cmxxxvi cmliii cmlxx cmlxxxvii miv mxxi mxxxviii mlv mlxxii mlxxxix mcvi\n mcxxiii mcxl mclvii mclxxiv mcxci mccviii mccxxv mccxlii mcclix mcclxxvi\n mccxciii mcccx mcccxxvii mcccxliv mccclxi mccclxxviii mcccxcv mcdxii mcdxxix\n mcdxlvi mcdlxiii mcdlxxx mcdxcvii mdxiv mdxxxi mdxlviii mdlxv mdlxxxii mdxcix\n mdcxvi mdcxxxiii mdcl mdclxvii mdclxxxiv mdcci mdccxviii mdccxxxv mdcclii\n mdcclxix mdcclxxxvi mdccciii mdcccxx mdcccxxxvii mdcccliv mdccclxxi\n mdccclxxxviii mcmv mcmxxii mcmxxxix mcmlvi mcmlxxiii mcmxc mmvii mmxxiv mmxli\n mmlviii mmlxxv mmxcii mmcix mmcxxvi mmcxliii mmclx mmclxxvii mmcxciv mmccxi\n mmccxxviii mmccxlv mmcclxii mmcclxxix mmccxcvi mmcccxiii mmcccxxx mmcccxlvii\n mmccclxiv mmccclxxxi mmcccxcviii mmcdxv mmcdxxxii mmcdxlix mmcdlxvi mmcdlxxxiii\n mmd") ); } /** * Test format-date: numeric formats using Thai digits. */ @org.junit.Test public void formatDate007a() { final XQuery query = new XQuery( "format-date($d,\"[Yà¹à¹à¹à¹‘]-[Mà¹à¹‘]-[D๑]\")", ctx); try { query.bind("d", new XQuery("xs:date('2003-09-07')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "๒à¹à¹à¹“-à¹à¹™-๗") ); } /** * Test format-date: numeric formats using Thai digits. */ @org.junit.Test public void formatDate007b() { final XQuery query = new XQuery( "format-date($d,\"[M๑]-[D๑]-[Yà¹à¹à¹à¹‘]\")", ctx); try { query.bind("d", new XQuery("xs:date('2003-09-07')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "๙-๗-๒à¹à¹à¹“") ); } /** * Test format-date: numeric formats using Thai digits. */ @org.junit.Test public void formatDate007c() { final XQuery query = new XQuery( "format-date($d,\"([Yà¹à¹‘]-[Mà¹à¹‘]-[Dà¹à¹‘])\")", ctx); try { query.bind("d", new XQuery("xs:date('2003-09-07')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "(à¹à¹“-à¹à¹™-à¹à¹—)") ); } /** * Test format-date: numeric formats using Osmanya (non-BMP) digits. */ @org.junit.Test public void formatDate008a() { final XQuery query = new XQuery( "format-date($d,\"[Yð’ ð’ ð’ ð’¡]-[Mð’ ð’¡]-[Dð’¡]\")", ctx); try { query.bind("d", new XQuery("xs:date('2003-09-07')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ð’¢ð’ ð’ ð’£-ð’ ð’©-ð’§") ); } /** * Test format-date: numeric formats using Osmanya (non-BMP) digits. */ @org.junit.Test public void formatDate008b() { final XQuery query = new XQuery( "format-date($d,\"[Mð’¡]-[Dð’¡]-[Yð’ ð’ ð’ ð’¡]\")", ctx); try { query.bind("d", new XQuery("xs:date('2003-09-07')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ð’©-ð’§-ð’¢ð’ ð’ ð’£") ); } /** * Test format-date: numeric formats using Osmanya (non-BMP) digits. */ @org.junit.Test public void formatDate008c() { final XQuery query = new XQuery( "format-date($d,\"([Yð’ ð’¡]-[Mð’ ð’¡]-[Dð’ ð’¡])\")", ctx); try { query.bind("d", new XQuery("xs:date('2003-09-07')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "(ð’ ð’£-ð’ ð’©-ð’ ð’§)") ); } /** * Test format-date: test format-date: ISO week numbers Specifically, in the ISO calendar the days of the week are numbered from 1 (Monday) to 7 (Sunday), and week 1 in any calendar year is the week (from Monday to Sunday) that includes the first Thursday of that year.. */ @org.junit.Test public void formatDate009() { final XQuery query = new XQuery( "\n" + " for $i in 1 to 48, $d in $t + xs:yearMonthDuration('P1M')*$i \n" + " return concat(\"[\", $d, \":\", format-date($d, '[W]', (), 'ISO', ()), \"]\")\n" + " ", ctx); try { query.bind("t", new XQuery("xs:date('2004-04-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n [2004-05-01:18] [2004-06-01:23] [2004-07-01:27] [2004-08-01:31] [2004-09-01:36] [2004-10-01:40] [2004-11-01:45] \n [2004-12-01:49] [2005-01-01:53] [2005-02-01:5] [2005-03-01:9] [2005-04-01:13] [2005-05-01:17] [2005-06-01:22] \n [2005-07-01:26] [2005-08-01:31] [2005-09-01:35] [2005-10-01:39] [2005-11-01:44] [2005-12-01:48] [2006-01-01:52] \n [2006-02-01:5] [2006-03-01:9] [2006-04-01:13] [2006-05-01:18] [2006-06-01:22] [2006-07-01:26] [2006-08-01:31] \n [2006-09-01:35] [2006-10-01:39] [2006-11-01:44] [2006-12-01:48] [2007-01-01:1] [2007-02-01:5] [2007-03-01:9] \n [2007-04-01:13] [2007-05-01:18] [2007-06-01:22] [2007-07-01:26] [2007-08-01:31] [2007-09-01:35] [2007-10-01:40] \n [2007-11-01:44] [2007-12-01:48] [2008-01-01:1] [2008-02-01:5] [2008-03-01:9] [2008-04-01:14]\n ") ); } /** * test format-date: ISO day within week Specifically, in the ISO calendar the days of the week are numbered from 1 (Monday) to 7 (Sunday), and week 1 in any calendar year is the week (from Monday to Sunday) that includes the first Thursday of that year.. */ @org.junit.Test public void formatDate010() { final XQuery query = new XQuery( "for $i in 1 to 48, $d in $t + xs:yearMonthDuration('P1M')*$i \n" + " return concat(\"[\", $d, \":\", format-date($d, '[F01]', (), 'ISO', ()), ']')\n" + " ", ctx); try { query.bind("t", new XQuery("xs:date('2003-12-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n [2004-01-01:04] [2004-02-01:07] [2004-03-01:01] [2004-04-01:04] [2004-05-01:06] [2004-06-01:02] \n [2004-07-01:04] [2004-08-01:07] [2004-09-01:03] [2004-10-01:05] [2004-11-01:01] [2004-12-01:03] \n [2005-01-01:06] [2005-02-01:02] [2005-03-01:02] [2005-04-01:05] [2005-05-01:07] [2005-06-01:03] \n [2005-07-01:05] [2005-08-01:01] [2005-09-01:04] [2005-10-01:06] [2005-11-01:02] [2005-12-01:04] \n [2006-01-01:07] [2006-02-01:03] [2006-03-01:03] [2006-04-01:06] [2006-05-01:01] [2006-06-01:04] \n [2006-07-01:06] [2006-08-01:02] [2006-09-01:05] [2006-10-01:07] [2006-11-01:03] [2006-12-01:05] \n [2007-01-01:01] [2007-02-01:04] [2007-03-01:04] [2007-04-01:07] [2007-05-01:02] [2007-06-01:05] \n [2007-07-01:07] [2007-08-01:03] [2007-09-01:06] [2007-10-01:01] [2007-11-01:04] [2007-12-01:06] \n ") ); } /** * test format-date: ISO week number within month --> Specifically, in the ISO calendar the days of the week are numbered from 1 (Monday) to 7 (Sunday), and week 1 in any calendar year is the week (from Monday to Sunday) that includes the first Thursday of that year.. */ @org.junit.Test public void formatDate011() { final XQuery query = new XQuery( "\n" + " for $i in 1 to 48, $d in $t + xs:dayTimeDuration('P3D')*$i \n" + " return concat(\"[\", $d, \":\", format-date($d, '[w]', (), 'ISO', ()), ']')", ctx); try { query.bind("t", new XQuery("xs:date('2005-12-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n [2005-12-04:1] [2005-12-07:2] [2005-12-10:2] [2005-12-13:3] [2005-12-16:3] [2005-12-19:4] [2005-12-22:4] \n [2005-12-25:4] [2005-12-28:5] [2005-12-31:5] [2006-01-03:1] [2006-01-06:1] [2006-01-09:2] [2006-01-12:2] \n [2006-01-15:2] [2006-01-18:3] [2006-01-21:3] [2006-01-24:4] [2006-01-27:4] [2006-01-30:5] [2006-02-02:1] \n [2006-02-05:1] [2006-02-08:2] [2006-02-11:2] [2006-02-14:3] [2006-02-17:3] [2006-02-20:4] [2006-02-23:4] \n [2006-02-26:4] [2006-03-01:1] [2006-03-04:1] [2006-03-07:2] [2006-03-10:2] [2006-03-13:3] [2006-03-16:3] \n [2006-03-19:3] [2006-03-22:4] [2006-03-25:4] [2006-03-28:5] [2006-03-31:5] [2006-04-03:1] [2006-04-06:1] \n [2006-04-09:1] [2006-04-12:2] [2006-04-15:2] [2006-04-18:3] [2006-04-21:3] [2006-04-24:4] \n ") ); } /** * test format-date(): effect of width specifiers. */ @org.junit.Test public void formatDate013L() { final XQuery query = new XQuery( "format-date($t, '[M,1-*]')", ctx); try { query.bind("t", new XQuery("xs:date('0985-03-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * test format-date(): effect of width specifiers. */ @org.junit.Test public void formatDate013a() { final XQuery query = new XQuery( "format-date($t, '[Y,4-4]')", ctx); try { query.bind("t", new XQuery("xs:date('0985-03-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0985") ); } /** * test format-date(): effect of width specifiers. */ @org.junit.Test public void formatDate013b() { final XQuery query = new XQuery( "format-date($t, '[Y,3-4]')", ctx); try { query.bind("t", new XQuery("xs:date('0985-03-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "985") ); } /** * test format-date(): effect of width specifiers. */ @org.junit.Test public void formatDate013c() { final XQuery query = new XQuery( "format-date($t, '[Y,2-5]')", ctx); try { query.bind("t", new XQuery("xs:date('0985-03-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "985") ); } /** * test format-date(): effect of width specifiers. */ @org.junit.Test public void formatDate013d() { final XQuery query = new XQuery( "format-date($t, '[Y,2-2]')", ctx); try { query.bind("t", new XQuery("xs:date('0985-03-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "85") ); } /** * test format-date(): effect of width specifiers. */ @org.junit.Test public void formatDate013e() { final XQuery query = new XQuery( "format-date($t, '[Y,2-*]')", ctx); try { query.bind("t", new XQuery("xs:date('0985-03-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "985") ); } /** * test format-date(): effect of width specifiers. */ @org.junit.Test public void formatDate013f() { final XQuery query = new XQuery( "format-date($t, '[Y,*-4]')", ctx); try { query.bind("t", new XQuery("xs:date('0985-03-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "985") ); } /** * test format-date(): effect of width specifiers. */ @org.junit.Test public void formatDate013g() { final XQuery query = new XQuery( "format-date($t, '[Y,3]')", ctx); try { query.bind("t", new XQuery("xs:date('0985-03-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "985") ); } /** * test format-date(): effect of width specifiers. */ @org.junit.Test public void formatDate013h() { final XQuery query = new XQuery( "format-date($t, '[M,4-4]')", ctx); try { query.bind("t", new XQuery("xs:date('0985-03-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0003") ); } /** * test format-date(): effect of width specifiers. */ @org.junit.Test public void formatDate013i() { final XQuery query = new XQuery( "format-date($t, '[M,1-4]')", ctx); try { query.bind("t", new XQuery("xs:date('0985-03-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * test format-date(): effect of width specifiers. */ @org.junit.Test public void formatDate013j() { final XQuery query = new XQuery( "format-date($t, '[M,2-5]')", ctx); try { query.bind("t", new XQuery("xs:date('0985-03-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "03") ); } /** * test format-date(): effect of width specifiers. */ @org.junit.Test public void formatDate013k() { final XQuery query = new XQuery( "format-date($t, '[M,2-2]')", ctx); try { query.bind("t", new XQuery("xs:date('0985-03-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "03") ); } /** * test format-date(): effect of width specifiers. */ @org.junit.Test public void formatDate013m() { final XQuery query = new XQuery( "format-date($t, '[M,*-2]')", ctx); try { query.bind("t", new XQuery("xs:date('0985-03-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * test format-date(): effect of width specifiers. */ @org.junit.Test public void formatDate013n() { final XQuery query = new XQuery( "format-date($t, '[M,3]')", ctx); try { query.bind("t", new XQuery("xs:date('0985-03-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "003") ); } /** * test format-date(): timezones in +nn:nn notation. */ @org.junit.Test public void formatDate014() { final XQuery query = new XQuery( "string-join( for $z in -28 to +28 return format-date(adjust-date-to-timezone($t,\n" + " $z*xs:dayTimeDuration('PT30M')), '[Z]'), ' ')", ctx); try { query.bind("t", new XQuery("xs:date('1985-03-01Z')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "-14:00 -13:30 -13:00 -12:30 -12:00 -11:30 -11:00 -10:30 -10:00\n -09:30 -09:00 -08:30 -08:00 -07:30 -07:00 -06:30 -06:00 -05:30 -05:00 -04:30\n -04:00 -03:30 -03:00 -02:30 -02:00 -01:30 -01:00 -00:30 +00:00 +00:30 +01:00\n +01:30 +02:00 +02:30 +03:00 +03:30 +04:00 +04:30 +05:00 +05:30 +06:00 +06:30\n +07:00 +07:30 +08:00 +08:30 +09:00 +09:30 +10:00 +10:30 +11:00 +11:30 +12:00\n +12:30 +13:00 +13:30 +14:00") ); } /** * test format-date(): timezones in GMT+x notation. */ @org.junit.Test public void formatDate015() { final XQuery query = new XQuery( "string-join( for $z in -28 to +28 return format-date(adjust-date-to-timezone($t,\n" + " $z*xs:dayTimeDuration('PT30M')), '[z0]'), '; ')", ctx); try { query.bind("t", new XQuery("xs:date('1985-03-01Z')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "GMT-14; GMT-13:30; GMT-13; GMT-12:30; GMT-12; GMT-11:30; GMT-11;\n GMT-10:30; GMT-10; GMT-9:30; GMT-9; GMT-8:30; GMT-8; GMT-7:30; GMT-7; GMT-6:30; GMT-6;\n GMT-5:30; GMT-5; GMT-4:30; GMT-4; GMT-3:30; GMT-3; GMT-2:30; GMT-2; GMT-1:30; GMT-1;\n GMT-0:30; GMT+0; GMT+0:30; GMT+1; GMT+1:30; GMT+2; GMT+2:30; GMT+3; GMT+3:30; GMT+4;\n GMT+4:30; GMT+5; GMT+5:30; GMT+6; GMT+6:30; GMT+7; GMT+7:30; GMT+8; GMT+8:30; GMT+9;\n GMT+9:30; GMT+10; GMT+10:30; GMT+11; GMT+11:30; GMT+12; GMT+12:30; GMT+13; GMT+13:30;\n GMT+14") ); } /** * test format-date(): timezones in GMT+x notation. */ @org.junit.Test public void formatDate016() { final XQuery query = new XQuery( "string-join( for $z in -28 to +28 return format-date(adjust-date-to-timezone($t,\n" + " $z*xs:dayTimeDuration('PT30M')), '[z]'), '; ')", ctx); try { query.bind("t", new XQuery("xs:date('1985-03-01Z')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n \tGMT-14:00; GMT-13:30; GMT-13:00; GMT-12:30; GMT-12:00; GMT-11:30; GMT-11:00;\n\t\t\tGMT-10:30; GMT-10:00; GMT-09:30; GMT-09:00; GMT-08:30; GMT-08:00; GMT-07:30;\n\t\t\tGMT-07:00; GMT-06:30; GMT-06:00; GMT-05:30; GMT-05:00; GMT-04:30; GMT-04:00;\n\t\t\tGMT-03:30; GMT-03:00; GMT-02:30; GMT-02:00; GMT-01:30; GMT-01:00; GMT-00:30;\n\t\t\tGMT+00:00; GMT+00:30; GMT+01:00; GMT+01:30; GMT+02:00; GMT+02:30; GMT+03:00;\n\t\t\tGMT+03:30; GMT+04:00; GMT+04:30; GMT+05:00; GMT+05:30; GMT+06:00; GMT+06:30;\n\t\t\tGMT+07:00; GMT+07:30; GMT+08:00; GMT+08:30; GMT+09:00; GMT+09:30; GMT+10:00;\n\t\t\tGMT+10:30; GMT+11:00; GMT+11:30; GMT+12:00; GMT+12:30; GMT+13:00; GMT+13:30;\n\t\t\tGMT+14:00\n\t\t ") ); } /** * test format-date(): timezones in military notation. */ @org.junit.Test public void formatDate017() { final XQuery query = new XQuery( "string-join( for $z in -12 to +12 return format-date(adjust-date-to-timezone($t,\n" + " $z*xs:dayTimeDuration('PT1H')), '[ZZ]'), ' ')", ctx); try { query.bind("t", new XQuery("xs:date('1985-03-01Z')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n \tY X W V U T S R Q P O N Z A B C D E F G H I K L M\n\t\t ") ); } /** * test format-date(): timezone-less date in military notation. */ @org.junit.Test public void formatDate018() { final XQuery query = new XQuery( "format-date(xs:date('1987-12-13'), '[ZZ]')", ctx); try { query.bind("t", new XQuery("xs:date('1985-03-01Z')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "J") ); } /** * test format-date(): non-integral timezone in military notation. */ @org.junit.Test public void formatDate019() { final XQuery query = new XQuery( "format-date(xs:date('1987-12-13+05:30'), '[ZZ]')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "+05:30") ); } /** * test format-date(): extreme timezone in military notation. */ @org.junit.Test public void formatDate020() { final XQuery query = new XQuery( "format-date(xs:date('1987-12-13+13:00'), '[ZZ]')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "+13:00") ); } /** * test format-date(): timezones with an alternate separator. */ @org.junit.Test public void formatDate021() { final XQuery query = new XQuery( "string-join( for $z in -28 to +28 return format-date(adjust-date-to-timezone($t,\n" + " $z*xs:dayTimeDuration('PT30M')), '[z00~00]'), '; ')", ctx); try { query.bind("t", new XQuery("xs:date('1985-03-01Z')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n \tGMT-14~00; GMT-13~30; GMT-13~00; GMT-12~30; GMT-12~00; GMT-11~30; GMT-11~00; GMT-10~30; \n \tGMT-10~00; GMT-09~30; GMT-09~00; GMT-08~30; GMT-08~00; GMT-07~30; GMT-07~00; GMT-06~30; \n \tGMT-06~00; GMT-05~30; GMT-05~00; GMT-04~30; GMT-04~00; GMT-03~30; GMT-03~00; GMT-02~30; \n \tGMT-02~00; GMT-01~30; GMT-01~00; GMT-00~30; GMT+00~00; GMT+00~30; GMT+01~00; GMT+01~30; \n \tGMT+02~00; GMT+02~30; GMT+03~00; GMT+03~30; GMT+04~00; GMT+04~30; GMT+05~00; GMT+05~30; \n \tGMT+06~00; GMT+06~30; GMT+07~00; GMT+07~30; GMT+08~00; GMT+08~30; GMT+09~00; GMT+09~30; \n \tGMT+10~00; GMT+10~30; GMT+11~00; GMT+11~30; GMT+12~00; GMT+12~30; GMT+13~00; GMT+13~30; \n \tGMT+14~00\n\t\t ") ); } /** * test format-date(): timezones with non-ASCII digits. */ @org.junit.Test public void formatDate022() { final XQuery query = new XQuery( "format-date(xs:date('2012-05-18+05:30'), '[Z٠٠:٠٠]')", ctx); try { query.bind("t", new XQuery("xs:date('1985-03-01Z')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "+٠٥:٣٠") ); } /** * test format-date(): timezones with three-digit format. */ @org.junit.Test public void formatDate023() { final XQuery query = new XQuery( "string-join( for $z in -28 to +28 return format-date(adjust-date-to-timezone($t,\n" + " $z*xs:dayTimeDuration('PT30M')), '[Z0:01]'), '; ')", ctx); try { query.bind("t", new XQuery("xs:date('1985-03-01Z')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n \t-14:00; -13:30; -13:00; -12:30; -12:00; -11:30; -11:00; -10:30; -10:00; -9:30; -9:00;\n \t-8:30; -8:00; -7:30; -7:00; -6:30; -6:00; -5:30; -5:00; -4:30; -4:00; -3:30; -3:00;\n \t-2:30; -2:00; -1:30; -1:00; -0:30; +0:00; +0:30; +1:00; +1:30; +2:00; +2:30; +3:00;\n \t+3:30; +4:00; +4:30; +5:00; +5:30; +6:00; +6:30; +7:00; +7:30; +8:00; +8:30; +9:00;\n \t+9:30; +10:00; +10:30; +11:00; +11:30; +12:00; +12:30; +13:00; +13:30; +14:00\n\t\t ") ); } /** * test format-date(): timezones with three-digit format, no separator. */ @org.junit.Test public void formatDate024() { final XQuery query = new XQuery( "string-join( for $z in -28 to +28 return format-date(adjust-date-to-timezone($t,\n" + " $z*xs:dayTimeDuration('PT30M')), '[Z999]'), '; ')", ctx); try { query.bind("t", new XQuery("xs:date('1985-03-01Z')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n \t-1400; -1330; -1300; -1230; -1200; -1130; -1100; -1030; -1000; -930; -900; -830; \n \t-800; -730; -700; -630; -600; -530; -500; -430; -400; -330; -300; -230; -200; \n \t-130; -100; -030; +000; +030; +100; +130; +200; +230; +300; +330; +400; +430; \n \t+500; +530; +600; +630; +700; +730; +800; +830; +900; +930; +1000; +1030; +1100; \n \t+1130; +1200; +1230; +1300; +1330; +1400\n\t\t ") ); } /** * test format-date(): timezones with two-digit format, no separator. */ @org.junit.Test public void formatDate025() { final XQuery query = new XQuery( "string-join( for $z in -28 to +28 return format-date(adjust-date-to-timezone($t,\n" + " $z*xs:dayTimeDuration('PT30M')), '[Z99]'), '; ')", ctx); try { query.bind("t", new XQuery("xs:date('1985-03-01Z')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n \t-14; -13:30; -13; -12:30; -12; -11:30; -11; -10:30; -10; -09:30; -09; -08:30; -08;\n \t-07:30; -07; -06:30; -06; -05:30; -05; -04:30; -04; -03:30; -03; -02:30; -02; -01:30;\n \t-01; -00:30; +00; +00:30; +01; +01:30; +02; +02:30; +03; +03:30; +04; +04:30; +05;\n \t+05:30; +06; +06:30; +07; +07:30; +08; +08:30; +09; +09:30; +10; +10:30; +11; +11:30;\n \t+12; +12:30; +13; +13:30; +14\n\t\t ") ); } /** * test format-date(): timezones with one-digit format, no separator, t modifier. */ @org.junit.Test public void formatDate026() { final XQuery query = new XQuery( "string-join( for $z in -28 to +28 return format-date(adjust-date-to-timezone($t,\n" + " $z*xs:dayTimeDuration('PT30M')), '[Z0t]'), '; ')", ctx); try { query.bind("t", new XQuery("xs:date('1985-03-01Z')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n \t-14; -13:30; -13; -12:30; -12; -11:30; -11; -10:30; -10; -9:30; -9; -8:30; -8;\n \t-7:30; -7; -6:30; -6; -5:30; -5; -4:30; -4; -3:30; -3; -2:30; -2; -1:30; -1; -0:30;\n \tZ; +0:30; +1; +1:30; +2; +2:30; +3; +3:30; +4; +4:30; +5; +5:30; +6; +6:30; +7;\n \t+7:30; +8; +8:30; +9; +9:30; +10; +10:30; +11; +11:30; +12; +12:30; +13;\n \t+13:30; +14\n\t\t ") ); } /** * test format-date(): timezones with astral plane digits. */ @org.junit.Test public void formatDate027() { final XQuery query = new XQuery( "format-date(xs:date('2012-05-18+05:30'), '[Zð’¡:ð’ ð’¡]')", ctx); try { query.bind("t", new XQuery("xs:date('1985-03-01Z')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "+ð’¥:ð’£ð’ ") ); } /** * Error FOFD1340 syntax of picture is incorrect. */ @org.junit.Test public void formatDate1340err() { final XQuery query = new XQuery( "format-date(current-date(), '[yY]', 'en', (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOFD1340") ); } /** * Error XTDE1340 incorrect picture string. */ @org.junit.Test public void formatDate801err() { final XQuery query = new XQuery( "format-date(current-date(), '[bla]', 'en', (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XTDE1340") || error("FOFD1340") ) ); } /** * Error XTDE1350 component in picture string not available in value. */ @org.junit.Test public void formatDate802err() { final XQuery query = new XQuery( "format-date(current-date(), '[H]', 'en', (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XTDE1350") || error("FOFD1350") ) ); } /** * Error XTDE1350 component in picture string not available in value. */ @org.junit.Test public void formatDate803err() { final XQuery query = new XQuery( "format-date(current-date(), '[h]', 'en', (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XTDE1350") || error("FOFD1350") ) ); } /** * Error XTDE1350 component in picture string not available in value. */ @org.junit.Test public void formatDate804err() { final XQuery query = new XQuery( "format-date(current-date(), '[P]', 'en', (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XTDE1350") || error("FOFD1350") ) ); } /** * Error XTDE1350 component in picture string not available in value. */ @org.junit.Test public void formatDate805err() { final XQuery query = new XQuery( "format-date(current-date(), '[m]', 'en', (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XTDE1350") || error("FOFD1350") ) ); } /** * Error XTDE1350 component in picture string not available in value. */ @org.junit.Test public void formatDate806err() { final XQuery query = new XQuery( "format-date(current-date(), '[s]', 'en', (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XTDE1350") || error("FOFD1350") ) ); } /** * Error XTDE1350 component in picture string not available in value. */ @org.junit.Test public void formatDate807err() { final XQuery query = new XQuery( "format-date(current-date(), '[f]', 'en', (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XTDE1350") || error("FOFD1350") ) ); } /** * Error XTDE1340 incorrect picture string. */ @org.junit.Test public void formatDate808err() { final XQuery query = new XQuery( "format-date(current-date(), '[bla]', 'en', (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XTDE1340") || error("FOFD1340") ) ); } /** * English month names. */ @org.junit.Test public void formatDateEn101() { final XQuery query = new XQuery( "for $i in 1 to 12 return let $d2 := $d + xs:yearMonthDuration('P1M')*$i return\n" + " format-date($d2, '[MN]', 'en', (), ()) ", ctx); try { query.bind("d", new XQuery("xs:date('2003-12-07')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n JANUARY FEBRUARY MARCH APRIL MAY JUNE JULY AUGUST SEPTEMBER OCTOBER NOVEMBER DECEMBER\n ") ); } /** * English month names. */ @org.junit.Test public void formatDateEn102() { final XQuery query = new XQuery( "for $i in 1 to 12 return let $d2 := $d + xs:yearMonthDuration('P1M')*$i return\n" + " format-date($d2, '[Mn]', 'en', (), ()) ", ctx); try { query.bind("d", new XQuery("xs:date('2003-12-07')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n january february march april may june july august september october november december\n ") ); } /** * English month names. */ @org.junit.Test public void formatDateEn103() { final XQuery query = new XQuery( "\n" + " for $i in 1 to 12 \n" + " return let $d2 := $d + xs:yearMonthDuration('P1M')*$i \n" + " return format-date($d2, '[MNn]', 'en', (), ()) ", ctx); try { query.bind("d", new XQuery("xs:date('2003-12-07')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n January February March April May June July August September October November December\n ") ); } /** * English month names. */ @org.junit.Test public void formatDateEn104() { final XQuery query = new XQuery( "\n" + " for $i in 1 to 12 \n" + " return let $d2 := $d + xs:yearMonthDuration('P1M')*$i \n" + " return format-date($d2, '[MN,3-3]', 'en', (), ()) \n" + " ", ctx); try { query.bind("d", new XQuery("xs:date('2003-12-07')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC") ); } /** * English month names. */ @org.junit.Test public void formatDateEn105() { final XQuery query = new XQuery( "\n" + " for $i in 1 to 12 \n" + " return let $d2 := $d + xs:yearMonthDuration('P1M')*$i \n" + " return format-date($d2, '[Mn,3-3]', 'en', (), ()) \n" + " ", ctx); try { query.bind("d", new XQuery("xs:date('2003-12-07')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "jan feb mar apr may jun jul aug sep oct nov dec") ); } /** * English month names. */ @org.junit.Test public void formatDateEn106() { final XQuery query = new XQuery( "\n" + " for $i in 1 to 12 \n" + " return let $d2 := $d + xs:yearMonthDuration('P1M')*$i \n" + " return format-date($d2, '[MNn,3-3]', 'en', (), ()) \n" + " ", ctx); try { query.bind("d", new XQuery("xs:date('2003-12-07')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec") ); } /** * English weekday names. */ @org.junit.Test public void formatDateEn111() { final XQuery query = new XQuery( "for $i in 1 to 7 return let $d2 := $d + xs:dayTimeDuration('P1D')*$i return\n" + " format-date($d2, '[FN]', 'en', (), ()) ", ctx); try { query.bind("d", new XQuery("xs:date('2003-12-07')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY SATURDAY SUNDAY\n ") ); } /** * English weekday names. */ @org.junit.Test public void formatDateEn112() { final XQuery query = new XQuery( "for $i in 1 to 7 return let $d2 := $d + xs:dayTimeDuration('P1D')*$i return\n" + " format-date($d2, '[Fn]', 'en', (), ()) ", ctx); try { query.bind("d", new XQuery("xs:date('2003-12-07')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n monday tuesday wednesday thursday friday saturday sunday\n ") ); } /** * English weekday names. */ @org.junit.Test public void formatDateEn113() { final XQuery query = new XQuery( "for $i in 1 to 7 return let $d2 := $d + xs:dayTimeDuration('P1D')*$i return\n" + " format-date($d2, '[FNn]', 'en', (), ()) ", ctx); try { query.bind("d", new XQuery("xs:date('2003-12-07')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n Monday Tuesday Wednesday Thursday Friday Saturday Sunday\n ") ); } /** * English weekday names. */ @org.junit.Test public void formatDateEn114() { final XQuery query = new XQuery( "for $i in 1 to 7 return let $d2 := $d + xs:dayTimeDuration('P1D')*$i return\n" + " format-date($d2, '[FN,3-3]', 'en', (), ()) ", ctx); try { query.bind("d", new XQuery("xs:date('2003-12-07')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "MON TUE WED THU FRI SAT SUN") ); } /** * English weekday names. */ @org.junit.Test public void formatDateEn115() { final XQuery query = new XQuery( "for $i in 1 to 7 return let $d2 := $d + xs:dayTimeDuration('P1D')*$i return\n" + " format-date($d2, '[Fn,3-3]', 'en', (), ()) ", ctx); try { query.bind("d", new XQuery("xs:date('2003-12-07')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "mon tue wed thu fri sat sun") ); } /** * English weekday names. */ @org.junit.Test public void formatDateEn116() { final XQuery query = new XQuery( "for $i in 1 to 7 return let $d2 := $d + xs:dayTimeDuration('P1D')*$i return\n" + " format-date($d2, '[FNn,3-3]', 'en', (), ()) ", ctx); try { query.bind("d", new XQuery("xs:date('2003-12-07')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Mon Tue Wed Thu Fri Sat Sun") ); } /** * English weekday names, abbreviated, variable length. */ @org.junit.Test public void formatDateEn117() { final XQuery query = new XQuery( "for $i in 1 to 7 return let $d2 := $d + xs:dayTimeDuration('P1D')*$i return let $abb :=\n" + " format-date($d2, '[FNn,3-4]', 'en', (), ()) return let $expected := ('Mon', 'Tues', 'Weds',\n" + " 'Thur', 'Fri', 'Sat', 'Sun') return (substring($abb, 1, 3), starts-with($expected[$i],\n" + " $abb) and string-length($abb) le 4 and string-length($abb) ge 3) ", ctx); try { query.bind("d", new XQuery("xs:date('2003-12-07')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n Mon true Tue true Wed true Thu true Fri true Sat true Sun true\n ") ); } /** * English weekday names, abbreviated, variable length. */ @org.junit.Test public void formatDateEn118() { final XQuery query = new XQuery( "for $i in 1 to 7 return let $d2 := $d + xs:dayTimeDuration('P1D')*$i return let $abb :=\n" + " format-date($d2, '[FNn,3-5]', 'en', (), ()) return let $expected := ('Mon', 'Tues', 'Weds',\n" + " 'Thurs', 'Fri', 'Sat', 'Sun') return (substring($abb, 1, 3), starts-with($expected[$i],\n" + " $abb) and string-length($abb) le 5 and string-length($abb) ge 3) ", ctx); try { query.bind("d", new XQuery("xs:date('2003-12-07')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n Mon true Tue true Wed true Thu true Fri true Sat true Sun true\n ") ); } /** * English ordinal numbers 1-31. */ @org.junit.Test public void formatDateEn121() { final XQuery query = new XQuery( "for $i in 0 to 30 return let $d2 := $d + xs:dayTimeDuration('P1D')*$i return\n" + " format-date($d2, '[D1o]', 'en', (), ()) ", ctx); try { query.bind("d", new XQuery("xs:date('2003-12-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th 13th 14th 15th\n 16th 17th 18th 19th 20th 21st 22nd 23rd 24th 25th 26th 27th 28th 29th 30th\n 31st\n ") ); } /** * English ordinal numbers 1990-2020. */ @org.junit.Test public void formatDateEn122() { final XQuery query = new XQuery( "for $i in 0 to 30 return let $d2 := $d + xs:yearMonthDuration('P1Y')*$i return\n" + " format-date($d2, '[Y1o]', 'en', (), ()) ", ctx); try { query.bind("d", new XQuery("xs:date('1990-12-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n 1990th 1991st 1992nd 1993rd 1994th 1995th 1996th 1997th 1998th 1999th\n 2000th 2001st 2002nd 2003rd 2004th 2005th 2006th 2007th 2008th 2009th 2010th 2011th\n 2012th 2013th 2014th 2015th 2016th 2017th 2018th 2019th 2020th\n ") ); } /** * English cardinal words 1-31 upper case. */ @org.junit.Test public void formatDateEn123() { final XQuery query = new XQuery( " string-join( for $i in 0 to 30 return let $d2 := $d + xs:dayTimeDuration('P1D')*$i\n" + " return format-date($d2, '[DW]', 'en', (), ()), ' ') ", ctx); try { query.bind("d", new XQuery("xs:date('1990-12-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n ONE TWO THREE FOUR FIVE SIX SEVEN EIGHT NINE TEN ELEVEN\n TWELVE THIRTEEN FOURTEEN FIFTEEN SIXTEEN SEVENTEEN EIGHTEEN NINETEEN TWENTY\n TWENTY ONE TWENTY TWO TWENTY THREE TWENTY FOUR TWENTY FIVE TWENTY SIX TWENTY\n SEVEN TWENTY EIGHT TWENTY NINE THIRTY THIRTY ONE\n ") ); } /** * English cardinal words 1-31 lower case. */ @org.junit.Test public void formatDateEn124() { final XQuery query = new XQuery( " string-join( for $i in 0 to 30 return let $d2 := $d + xs:dayTimeDuration('P1D')*$i\n" + " return format-date($d2, '[Dw]', 'en', (), ()), ' ') ", ctx); try { query.bind("d", new XQuery("xs:date('1990-12-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n one two three four five six seven eight nine ten eleven\n twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty\n twenty one twenty two twenty three twenty four twenty five twenty six twenty\n seven twenty eight twenty nine thirty thirty one\n ") ); } /** * English cardinal words 1-31 title case. */ @org.junit.Test public void formatDateEn125() { final XQuery query = new XQuery( " string-join( for $i in 0 to 30 return let $d2 := $d + xs:dayTimeDuration('P1D')*$i\n" + " return format-date($d2, '[DWw]', 'en', (), ()), '; ') ", ctx); try { query.bind("d", new XQuery("xs:date('1990-12-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n One; Two; Three; Four; Five; Six; Seven; Eight; Nine; Ten; Eleven;\n Twelve; Thirteen; Fourteen; Fifteen; Sixteen; Seventeen; Eighteen; Nineteen; Twenty;\n Twenty One; Twenty Two; Twenty Three; Twenty Four; Twenty Five; Twenty Six; Twenty\n Seven; Twenty Eight; Twenty Nine; Thirty; Thirty One\n ") ); } /** * English cardinal words 1990-2020 upper case. */ @org.junit.Test public void formatDateEn126() { final XQuery query = new XQuery( " string-join( for $i in 0 to 30 return let $d2 := $d + xs:yearMonthDuration('P1Y')*$i\n" + " return format-date($d2, '[YW]', 'en', (), ()), '; ') ", ctx); try { query.bind("d", new XQuery("xs:date('1990-12-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n ONE THOUSAND NINE HUNDRED AND NINETY; ONE THOUSAND NINE HUNDRED AND\n NINETY ONE; ONE THOUSAND NINE HUNDRED AND NINETY TWO; ONE THOUSAND NINE HUNDRED AND\n NINETY THREE; ONE THOUSAND NINE HUNDRED AND NINETY FOUR; ONE THOUSAND NINE HUNDRED AND\n NINETY FIVE; ONE THOUSAND NINE HUNDRED AND NINETY SIX; ONE THOUSAND NINE HUNDRED AND\n NINETY SEVEN; ONE THOUSAND NINE HUNDRED AND NINETY EIGHT; ONE THOUSAND NINE HUNDRED AND\n NINETY NINE; TWO THOUSAND; TWO THOUSAND AND ONE; TWO THOUSAND AND TWO; TWO THOUSAND AND\n THREE; TWO THOUSAND AND FOUR; TWO THOUSAND AND FIVE; TWO THOUSAND AND SIX; TWO THOUSAND\n AND SEVEN; TWO THOUSAND AND EIGHT; TWO THOUSAND AND NINE; TWO THOUSAND AND TEN; TWO\n THOUSAND AND ELEVEN; TWO THOUSAND AND TWELVE; TWO THOUSAND AND THIRTEEN; TWO THOUSAND\n AND FOURTEEN; TWO THOUSAND AND FIFTEEN; TWO THOUSAND AND SIXTEEN; TWO THOUSAND AND\n SEVENTEEN; TWO THOUSAND AND EIGHTEEN; TWO THOUSAND AND NINETEEN; TWO THOUSAND AND\n TWENTY\n ") ); } /** * English cardinal words 1990-2020 lowerr case. */ @org.junit.Test public void formatDateEn127() { final XQuery query = new XQuery( " string-join( for $i in 0 to 30 return let $d2 := $d + xs:yearMonthDuration('P1Y')*$i\n" + " return format-date($d2, '[Yw]', 'en', (), ()), '; ') ", ctx); try { query.bind("d", new XQuery("xs:date('1990-12-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n one thousand nine hundred and ninety; one thousand nine hundred and\n ninety one; one thousand nine hundred and ninety two; one thousand nine hundred and\n ninety three; one thousand nine hundred and ninety four; one thousand nine hundred and\n ninety five; one thousand nine hundred and ninety six; one thousand nine hundred and\n ninety seven; one thousand nine hundred and ninety eight; one thousand nine hundred and\n ninety nine; two thousand; two thousand and one; two thousand and two; two thousand and\n three; two thousand and four; two thousand and five; two thousand and six; two thousand\n and seven; two thousand and eight; two thousand and nine; two thousand and ten; two\n thousand and eleven; two thousand and twelve; two thousand and thirteen; two thousand\n and fourteen; two thousand and fifteen; two thousand and sixteen; two thousand and\n seventeen; two thousand and eighteen; two thousand and nineteen; two thousand and\n twenty\n ") ); } /** * English cardinal words 1990-2020 title case. */ @org.junit.Test public void formatDateEn128() { final XQuery query = new XQuery( " string-join( for $i in 0 to 30 return let $d2 := $d + xs:yearMonthDuration('P1Y')*$i\n" + " return format-date($d2, '[YWw]', 'en', (), ()), '; ') ", ctx); try { query.bind("d", new XQuery("xs:date('1990-12-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n One Thousand Nine Hundred and Ninety; One Thousand Nine Hundred and\n Ninety One; One Thousand Nine Hundred and Ninety Two; One Thousand Nine Hundred and\n Ninety Three; One Thousand Nine Hundred and Ninety Four; One Thousand Nine Hundred and\n Ninety Five; One Thousand Nine Hundred and Ninety Six; One Thousand Nine Hundred and\n Ninety Seven; One Thousand Nine Hundred and Ninety Eight; One Thousand Nine Hundred and\n Ninety Nine; Two Thousand; Two Thousand and One; Two Thousand and Two; Two Thousand and\n Three; Two Thousand and Four; Two Thousand and Five; Two Thousand and Six; Two Thousand\n and Seven; Two Thousand and Eight; Two Thousand and Nine; Two Thousand and Ten; Two\n Thousand and Eleven; Two Thousand and Twelve; Two Thousand and Thirteen; Two Thousand\n and Fourteen; Two Thousand and Fifteen; Two Thousand and Sixteen; Two Thousand and\n Seventeen; Two Thousand and Eighteen; Two Thousand and Nineteen; Two Thousand and\n Twenty\n ") ); } /** * English ordinal words 1-31 upper case. */ @org.junit.Test public void formatDateEn129() { final XQuery query = new XQuery( " string-join( for $i in 0 to 30 return let $d2 := $d + xs:dayTimeDuration('P1D')*$i\n" + " return translate(format-date($d2, '[DWo]', 'en', (), ()), '- ', ''), '; ') ", ctx); try { query.bind("d", new XQuery("xs:date('1990-12-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n FIRST; SECOND; THIRD; FOURTH; FIFTH; SIXTH; SEVENTH; EIGHTH; NINTH;\n TENTH; ELEVENTH; TWELFTH; THIRTEENTH; FOURTEENTH; FIFTEENTH; SIXTEENTH; SEVENTEENTH;\n EIGHTEENTH; NINETEENTH; TWENTIETH; TWENTYFIRST; TWENTYSECOND; TWENTYTHIRD; TWENTYFOURTH;\n TWENTYFIFTH; TWENTYSIXTH; TWENTYSEVENTH; TWENTYEIGHTH; TWENTYNINTH; THIRTIETH;\n THIRTYFIRST\n ") ); } /** * English ordinal words 1-31 lower case. */ @org.junit.Test public void formatDateEn130() { final XQuery query = new XQuery( " string-join( for $i in 0 to 30 return let $d2 := $d + xs:dayTimeDuration('P1D')*$i\n" + " return translate(format-date($d2, '[Dwo]', 'en', (), ()), '- ', ''), '; ') ", ctx); try { query.bind("d", new XQuery("xs:date('1990-12-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n first; second; third; fourth; fifth; sixth; seventh; eighth; ninth;\n tenth; eleventh; twelfth; thirteenth; fourteenth; fifteenth; sixteenth; seventeenth;\n eighteenth; nineteenth; twentieth; twentyfirst; twentysecond; twentythird; twentyfourth;\n twentyfifth; twentysixth; twentyseventh; twentyeighth; twentyninth; thirtieth;\n thirtyfirst\n ") ); } /** * English ordinal words 1-31 title case. */ @org.junit.Test public void formatDateEn131() { final XQuery query = new XQuery( " string-join( for $i in 0 to 30 return let $d2 := $d + xs:dayTimeDuration('P1D')*$i\n" + " return translate(format-date($d2, '[DWwo]', 'en', (), ()), '- ', ''), '; ') ", ctx); try { query.bind("d", new XQuery("xs:date('1990-12-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n First; Second; Third; Fourth; Fifth; Sixth; Seventh; Eighth; Ninth;\n Tenth; Eleventh; Twelfth; Thirteenth; Fourteenth; Fifteenth; Sixteenth; Seventeenth;\n Eighteenth; Nineteenth; Twentieth; TwentyFirst; TwentySecond; TwentyThird; TwentyFourth;\n TwentyFifth; TwentySixth; TwentySeventh; TwentyEighth; TwentyNinth; Thirtieth;\n ThirtyFirst\n ") ); } /** * English ordinal words 1990-2020 upper case. */ @org.junit.Test public void formatDateEn132() { final XQuery query = new XQuery( " string-join( for $i in 0 to 30 return let $d2 := $d + xs:yearMonthDuration('P1Y')*$i\n" + " return translate(format-date($d2, '[YWo]', 'en', (), ()), '- ', ''), '; ') ", ctx); try { query.bind("d", new XQuery("xs:date('1990-12-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "ONETHOUSANDNINEHUNDREDANDNINETIETH;\n ONETHOUSANDNINEHUNDREDANDNINETYFIRST; ONETHOUSANDNINEHUNDREDANDNINETYSECOND;\n ONETHOUSANDNINEHUNDREDANDNINETYTHIRD; ONETHOUSANDNINEHUNDREDANDNINETYFOURTH;\n ONETHOUSANDNINEHUNDREDANDNINETYFIFTH; ONETHOUSANDNINEHUNDREDANDNINETYSIXTH;\n ONETHOUSANDNINEHUNDREDANDNINETYSEVENTH; ONETHOUSANDNINEHUNDREDANDNINETYEIGHTH;\n ONETHOUSANDNINEHUNDREDANDNINETYNINTH; TWOTHOUSANDTH; TWOTHOUSANDANDFIRST;\n TWOTHOUSANDANDSECOND; TWOTHOUSANDANDTHIRD; TWOTHOUSANDANDFOURTH; TWOTHOUSANDANDFIFTH;\n TWOTHOUSANDANDSIXTH; TWOTHOUSANDANDSEVENTH; TWOTHOUSANDANDEIGHTH; TWOTHOUSANDANDNINTH;\n TWOTHOUSANDANDTENTH; TWOTHOUSANDANDELEVENTH; TWOTHOUSANDANDTWELFTH;\n TWOTHOUSANDANDTHIRTEENTH; TWOTHOUSANDANDFOURTEENTH; TWOTHOUSANDANDFIFTEENTH;\n TWOTHOUSANDANDSIXTEENTH; TWOTHOUSANDANDSEVENTEENTH; TWOTHOUSANDANDEIGHTEENTH;\n TWOTHOUSANDANDNINETEENTH; TWOTHOUSANDANDTWENTIETH") ); } /** * English ordinal words 1990-2020 lower case. */ @org.junit.Test public void formatDateEn133() { final XQuery query = new XQuery( " string-join( for $i in 0 to 30 return let $d2 := $d + xs:yearMonthDuration('P1Y')*$i\n" + " return translate(format-date($d2, '[Ywo]', 'en', (), ()), '- ', ''), '; ') ", ctx); try { query.bind("d", new XQuery("xs:date('1990-12-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "onethousandninehundredandninetieth;\n onethousandninehundredandninetyfirst; onethousandninehundredandninetysecond;\n onethousandninehundredandninetythird; onethousandninehundredandninetyfourth;\n onethousandninehundredandninetyfifth; onethousandninehundredandninetysixth;\n onethousandninehundredandninetyseventh; onethousandninehundredandninetyeighth;\n onethousandninehundredandninetyninth; twothousandth; twothousandandfirst;\n twothousandandsecond; twothousandandthird; twothousandandfourth; twothousandandfifth;\n twothousandandsixth; twothousandandseventh; twothousandandeighth; twothousandandninth;\n twothousandandtenth; twothousandandeleventh; twothousandandtwelfth;\n twothousandandthirteenth; twothousandandfourteenth; twothousandandfifteenth;\n twothousandandsixteenth; twothousandandseventeenth; twothousandandeighteenth;\n twothousandandnineteenth; twothousandandtwentieth") ); } /** * English ordinal words 1990-2020 title case. */ @org.junit.Test public void formatDateEn134() { final XQuery query = new XQuery( " string-join( for $i in 0 to 30 return let $d2 := $d + xs:yearMonthDuration('P1Y')*$i\n" + " return translate(format-date($d2, '[YWwo]', 'en', (), ()), '- ', ''), '; ') ", ctx); try { query.bind("d", new XQuery("xs:date('1990-12-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "OneThousandNineHundredandNinetieth;\n OneThousandNineHundredandNinetyFirst; OneThousandNineHundredandNinetySecond;\n OneThousandNineHundredandNinetyThird; OneThousandNineHundredandNinetyFourth;\n OneThousandNineHundredandNinetyFifth; OneThousandNineHundredandNinetySixth;\n OneThousandNineHundredandNinetySeventh; OneThousandNineHundredandNinetyEighth;\n OneThousandNineHundredandNinetyNinth; TwoThousandth; TwoThousandandFirst;\n TwoThousandandSecond; TwoThousandandThird; TwoThousandandFourth; TwoThousandandFifth;\n TwoThousandandSixth; TwoThousandandSeventh; TwoThousandandEighth; TwoThousandandNinth;\n TwoThousandandTenth; TwoThousandandEleventh; TwoThousandandTwelfth;\n TwoThousandandThirteenth; TwoThousandandFourteenth; TwoThousandandFifteenth;\n TwoThousandandSixteenth; TwoThousandandSeventeenth; TwoThousandandEighteenth;\n TwoThousandandNineteenth; TwoThousandandTwentieth") ); } /** * English BC/AD. */ @org.junit.Test public void formatDateEn141() { final XQuery query = new XQuery( " format-date($d1, '[Y][EN]', 'en', (), ()), format-date($d2, '[Y][EN]', 'en', (), ()) ", ctx); try { query.bind("d1", new XQuery("xs:date('1990-12-01')", ctx).value()); query.bind("d2", new XQuery("xs:date('-0055-12-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertDeepEq("\"1990AD\", \"55BC\"") || assertDeepEq("\"1990CE\", \"55BCE\"") || assertDeepEq("\"1990A.D.\", \"55B.C.\"") || assertDeepEq("\"1990C.E.\", \"55B.C.E.\"") ) ); } /** . */ @org.junit.Test public void formatDateEn152() { final XQuery query = new XQuery( "format-date($b, '[M01]', 'en', 'CB', ())", ctx); try { query.bind("b", new XQuery("xs:date('2006-03-01')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "[Calendar: AD]03") ); } /** * wrong arg input to format-date(). */ @org.junit.Test public void formatDateInptEr1() { final XQuery query = new XQuery( "format-date('abc', '[bla]', 'en', (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * wrong number of args to format-date(). */ @org.junit.Test public void formatDateInptEr2() { final XQuery query = new XQuery( "format-date(current-date(), '[bla]', 'en', (), (), 6)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * wrong number of args to format-date(). */ @org.junit.Test public void formatDateInptEr3() { final XQuery query = new XQuery( "format-date(current-date(), '[bla]', 'en', (), 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnFormatDateTime.java000066400000000000000000001540151222453003200301060ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the format-dateTime() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnFormatDateTime extends QT3TestSet { /** * test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime001a() { final XQuery query = new XQuery( "format-dateTime($d,\"[Y]-[M01]-[D]\")", ctx); try { query.bind("d", new XQuery("xs:dateTime('2003-09-07T12:00:00')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2003-09-7") ); } /** * test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime001b() { final XQuery query = new XQuery( "format-dateTime($d,\"[M]-[D]-[Y]\")", ctx); try { query.bind("d", new XQuery("xs:dateTime('2003-09-07T12:00:00')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9-7-2003") ); } /** * test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime001c() { final XQuery query = new XQuery( "format-dateTime($d,\"[D]-[M]-[Y]\")", ctx); try { query.bind("d", new XQuery("xs:dateTime('2003-09-07T12:00:00')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "7-9-2003") ); } /** * test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime001d() { final XQuery query = new XQuery( "format-dateTime($d,\"[D1] [MI] [Y]\")", ctx); try { query.bind("d", new XQuery("xs:dateTime('2003-09-07T12:00:00')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "7 IX 2003") ); } /** * test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime001e() { final XQuery query = new XQuery( "format-dateTime($d,\"[[[Y]-[M01]-[D01]]]\")", ctx); try { query.bind("d", new XQuery("xs:dateTime('2003-09-07T12:00:00')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "[2003-09-07]") ); } /** * test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime001f() { final XQuery query = new XQuery( "format-dateTime($d,\"[[[Y0001]-[M01]-[D01]]]\")", ctx); try { query.bind("d", new XQuery("xs:dateTime('2003-09-07T12:00:00')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "[2003-09-07]") ); } /** * test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime001g() { final XQuery query = new XQuery( "format-dateTime($d,\"([Y01]-[M01]-[D01])\")", ctx); try { query.bind("d", new XQuery("xs:dateTime('2003-09-07T12:00:00')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "(03-09-07)") ); } /** * Test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime002a() { final XQuery query = new XQuery( "format-dateTime($t,\"[H01]:[m01]\")", ctx); try { query.bind("t", new XQuery("xs:dateTime('2011-07-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "09:15") ); } /** * Test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime002b() { final XQuery query = new XQuery( "format-dateTime($t,\"[H]:[m]\")", ctx); try { query.bind("t", new XQuery("xs:dateTime('2011-07-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9:15") ); } /** * Test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime002c() { final XQuery query = new XQuery( "format-dateTime($t,\"[H01]:[m01]:[s01]\")", ctx); try { query.bind("t", new XQuery("xs:dateTime('2011-07-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "09:15:06") ); } /** * Test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime002d() { final XQuery query = new XQuery( "format-dateTime($t,\"[H]:[m]:[s]\")", ctx); try { query.bind("t", new XQuery("xs:dateTime('2011-07-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9:15:06") ); } /** * Test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime002e() { final XQuery query = new XQuery( "format-dateTime($t,\"[H]:[m]:[s1]\")", ctx); try { query.bind("t", new XQuery("xs:dateTime('2011-07-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9:15:6") ); } /** * Test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime002f() { final XQuery query = new XQuery( "format-dateTime($t,\"[H]:[m]:[s01]:[f001]\")", ctx); try { query.bind("t", new XQuery("xs:dateTime('2011-07-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9:15:06:456") ); } /** * Test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime002g() { final XQuery query = new XQuery( "format-dateTime($t,\"[H]:[m]:[s].[f,1-1]\")", ctx); try { query.bind("t", new XQuery("xs:dateTime('2011-07-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9:15:06.5") ); } /** * Test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime002h() { final XQuery query = new XQuery( "format-dateTime($t,\"[H]:[m]:[s].[f1,1-1]\")", ctx); try { query.bind("t", new XQuery("xs:dateTime('2011-07-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9:15:06.5") ); } /** * Test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime002i() { final XQuery query = new XQuery( "format-dateTime($t,\"[H]:[m]:[s].[f01]\")", ctx); try { query.bind("t", new XQuery("xs:dateTime('2011-07-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9:15:06.46") ); } /** * Test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime002j() { final XQuery query = new XQuery( "format-dateTime($t,\"[H]:[m]:[s].[f001]\")", ctx); try { query.bind("t", new XQuery("xs:dateTime('2011-07-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9:15:06.456") ); } /** * Test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime003L() { final XQuery query = new XQuery( "format-dateTime($t,\"[H]:[m]:[s1]\")", ctx); try { query.bind("t", new XQuery("xs:dateTime('2003-09-07T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9:15:6") ); } /** * Test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime003a() { final XQuery query = new XQuery( "format-dateTime($t,\"[Y]-[M01]-[D]\")", ctx); try { query.bind("t", new XQuery("xs:dateTime('2003-09-07T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2003-09-7") ); } /** * Test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime003b() { final XQuery query = new XQuery( "format-dateTime($t,\"[M]-[D]-[Y]\")", ctx); try { query.bind("t", new XQuery("xs:dateTime('2003-09-07T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9-7-2003") ); } /** * Test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime003c() { final XQuery query = new XQuery( "format-dateTime($t,\"[D]-[M]-[Y]\")", ctx); try { query.bind("t", new XQuery("xs:dateTime('2003-09-07T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "7-9-2003") ); } /** * Test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime003d() { final XQuery query = new XQuery( "format-dateTime($t,\"[D1] [MI] [Y]\")", ctx); try { query.bind("t", new XQuery("xs:dateTime('2003-09-07T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "7 IX 2003") ); } /** * Test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime003e() { final XQuery query = new XQuery( "format-dateTime($t,\"[[[Y]-[M01]-[D01]]]\")", ctx); try { query.bind("t", new XQuery("xs:dateTime('2003-09-07T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "[2003-09-07]") ); } /** * Test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime003f() { final XQuery query = new XQuery( "format-dateTime($t,\"[[[Y0001]-[M01]-[D01]]]\")", ctx); try { query.bind("t", new XQuery("xs:dateTime('2003-09-07T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "[2003-09-07]") ); } /** * Test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime003g() { final XQuery query = new XQuery( "format-dateTime($t,\"([Y01]-[M01]-[D01])\")", ctx); try { query.bind("t", new XQuery("xs:dateTime('2003-09-07T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "(03-09-07)") ); } /** * Test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime003h() { final XQuery query = new XQuery( "format-dateTime($t,\"[H01]:[m01]\")", ctx); try { query.bind("t", new XQuery("xs:dateTime('2003-09-07T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "09:15") ); } /** * Test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime003i() { final XQuery query = new XQuery( "format-dateTime($t,\"[H]:[m]\")", ctx); try { query.bind("t", new XQuery("xs:dateTime('2003-09-07T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9:15") ); } /** * Test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime003j() { final XQuery query = new XQuery( "format-dateTime($t,\"[H01]:[m01]:[s01]\")", ctx); try { query.bind("t", new XQuery("xs:dateTime('2003-09-07T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "09:15:06") ); } /** * Test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime003k() { final XQuery query = new XQuery( "format-dateTime($t,\"[H]:[m]:[s]\")", ctx); try { query.bind("t", new XQuery("xs:dateTime('2003-09-07T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9:15:06") ); } /** * Test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime003m() { final XQuery query = new XQuery( "format-dateTime($t,\"[H]:[m]:[s].[f,1-1]\")", ctx); try { query.bind("t", new XQuery("xs:dateTime('2003-09-07T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9:15:06.5") ); } /** * Test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime003n() { final XQuery query = new XQuery( "format-dateTime($t,\"[H]:[m]:[s].[f1,1-1]\")", ctx); try { query.bind("t", new XQuery("xs:dateTime('2003-09-07T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9:15:06.5") ); } /** * Test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime003p() { final XQuery query = new XQuery( "format-dateTime($t,\"[H]:[m]:[s].[f01]\")", ctx); try { query.bind("t", new XQuery("xs:dateTime('2003-09-07T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9:15:06.46") ); } /** * Test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime003q() { final XQuery query = new XQuery( "format-dateTime($t,\"[H]:[m]:[s].[f001]\")", ctx); try { query.bind("t", new XQuery("xs:dateTime('2003-09-07T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9:15:06.456") ); } /** * Test format-dateTime: basic numeric formats. */ @org.junit.Test public void formatDateTime003r() { final XQuery query = new XQuery( "format-dateTime($t,'[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01].[f001]')", ctx); try { query.bind("t", new XQuery("xs:dateTime('2003-09-07T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2003-09-07T09:15:06.456") ); } /** * Test format-dateTime: 12-hour clock. */ @org.junit.Test public void formatDateTime004() { final XQuery query = new XQuery( "\n" + " for $i in 1 to 24 return\n" + " format-dateTime($t + xs:dayTimeDuration('PT1H')*$i, '[h].[m]')", ctx); try { query.bind("t", new XQuery("xs:dateTime('2003-09-07T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "10.15 11.15 12.15 1.15 2.15 3.15 4.15 5.15 6.15 7.15 8.15 9.15 10.15 11.15 12.15 \n 1.15 2.15 3.15 4.15 5.15 6.15 7.15 8.15 9.15") ); } /** * Test format-dateTime: upper-case roman numerals for year. */ @org.junit.Test public void formatDateTime005() { final XQuery query = new XQuery( "\n" + " string-join(\n" + " for $i in 1 to 100 return\n" + " format-dateTime($t + xs:yearMonthDuration('P1Y')*$i, '[YI]'), '; ')", ctx); try { query.bind("t", new XQuery("xs:dateTime('1950-01-01T12:00:00')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n MCMLI; MCMLII; MCMLIII; MCMLIV; MCMLV; MCMLVI; MCMLVII; MCMLVIII; MCMLIX; MCMLX; MCMLXI; MCMLXII; MCMLXIII; MCMLXIV; MCMLXV; MCMLXVI; MCMLXVII; MCMLXVIII; MCMLXIX; MCMLXX; MCMLXXI; MCMLXXII; MCMLXXIII; MCMLXXIV; MCMLXXV; MCMLXXVI; MCMLXXVII; MCMLXXVIII; MCMLXXIX; MCMLXXX; MCMLXXXI; MCMLXXXII; MCMLXXXIII; MCMLXXXIV; MCMLXXXV; MCMLXXXVI; MCMLXXXVII; MCMLXXXVIII; MCMLXXXIX; MCMXC; MCMXCI; MCMXCII; MCMXCIII; MCMXCIV; MCMXCV; MCMXCVI; MCMXCVII; MCMXCVIII; MCMXCIX; MM; MMI; MMII; MMIII; MMIV; MMV; MMVI; MMVII; MMVIII; MMIX; MMX; MMXI; MMXII; MMXIII; MMXIV; MMXV; MMXVI; MMXVII; MMXVIII; MMXIX; MMXX; MMXXI; MMXXII; MMXXIII; MMXXIV; MMXXV; MMXXVI; MMXXVII; MMXXVIII; MMXXIX; MMXXX; MMXXXI; MMXXXII; MMXXXIII; MMXXXIV; MMXXXV; MMXXXVI; MMXXXVII; MMXXXVIII; MMXXXIX; MMXL; MMXLI; MMXLII; MMXLIII; MMXLIV; MMXLV; MMXLVI; MMXLVII; MMXLVIII; MMXLIX; MML\n ") ); } /** * Test format-dateTime: lower-case roman numerals for year (width specifier ignored). */ @org.junit.Test public void formatDateTime006() { final XQuery query = new XQuery( "\n" + " string-join(\n" + " for $i in 1 to 100 return\n" + " format-dateTime($t + xs:yearMonthDuration('P17Y')*$i, '[Yi,4-4]'), '; ')", ctx); try { query.bind("t", new XQuery("xs:dateTime('0800-01-01T12:00:00')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n dcccxvii; dcccxxxiv; dcccli; dccclxviii; dccclxxxv; cmii; cmxix; cmxxxvi; cmliii; cmlxx; cmlxxxvii; miv; mxxi; mxxxviii; mlv; mlxxii; mlxxxix; mcvi; mcxxiii; mcxl; mclvii; mclxxiv; mcxci; mccviii; mccxxv; mccxlii; mcclix; mcclxxvi; mccxciii; mcccx; mcccxxvii; mcccxliv; mccclxi; mccclxxviii; mcccxcv; mcdxii; mcdxxix; mcdxlvi; mcdlxiii; mcdlxxx; mcdxcvii; mdxiv; mdxxxi; mdxlviii; mdlxv; mdlxxxii; mdxcix; mdcxvi; mdcxxxiii; mdcl; mdclxvii; mdclxxxiv; mdcci; mdccxviii; mdccxxxv; mdcclii; mdcclxix; mdcclxxxvi; mdccciii; mdcccxx; mdcccxxxvii; mdcccliv; mdccclxxi; mdccclxxxviii; mcmv; mcmxxii; mcmxxxix; mcmlvi; mcmlxxiii; mcmxc; mmvii; mmxxiv; mmxli; mmlviii; mmlxxv; mmxcii; mmcix; mmcxxvi; mmcxliii; mmclx; mmclxxvii; mmcxciv; mmccxi; mmccxxviii; mmccxlv; mmcclxii; mmcclxxix; mmccxcvi; mmcccxiii; mmcccxxx; mmcccxlvii; mmccclxiv; mmccclxxxi; mmcccxcviii; mmcdxv; mmcdxxxii; mmcdxlix; mmcdlxvi; mmcdlxxxiii; mmd\n ") ); } /** * Test format-dateTime: test format-dateTime: ISO week numbers Specifically, in the ISO calendar the days of the week are numbered from 1 (Monday) to 7 (Sunday), and week 1 in any calendar year is the week (from Monday to Sunday) that includes the first Thursday of that year. . */ @org.junit.Test public void formatDateTime009() { final XQuery query = new XQuery( "for $i in 1 to 48,\n" + " $d in $t + xs:yearMonthDuration('P1M')*$i\n" + " return concat(\"[\", $d, \": \", format-dateTime($d, '[W]', (), 'ISO', ()), \"]\")", ctx); try { query.bind("t", new XQuery("xs:dateTime('2003-12-01T12:00:00')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n [2004-01-01T12:00:00: 1] [2004-02-01T12:00:00: 5] [2004-03-01T12:00:00: 10] [2004-04-01T12:00:00: 14] \n [2004-05-01T12:00:00: 18] [2004-06-01T12:00:00: 23] [2004-07-01T12:00:00: 27] [2004-08-01T12:00:00: 31] \n [2004-09-01T12:00:00: 36] [2004-10-01T12:00:00: 40] [2004-11-01T12:00:00: 45] [2004-12-01T12:00:00: 49] \n [2005-01-01T12:00:00: 53] [2005-02-01T12:00:00: 5] [2005-03-01T12:00:00: 9] [2005-04-01T12:00:00: 13] \n [2005-05-01T12:00:00: 17] [2005-06-01T12:00:00: 22] [2005-07-01T12:00:00: 26] [2005-08-01T12:00:00: 31] \n [2005-09-01T12:00:00: 35] [2005-10-01T12:00:00: 39] [2005-11-01T12:00:00: 44] [2005-12-01T12:00:00: 48] \n [2006-01-01T12:00:00: 52] [2006-02-01T12:00:00: 5] [2006-03-01T12:00:00: 9] [2006-04-01T12:00:00: 13] \n [2006-05-01T12:00:00: 18] [2006-06-01T12:00:00: 22] [2006-07-01T12:00:00: 26] [2006-08-01T12:00:00: 31] \n [2006-09-01T12:00:00: 35] [2006-10-01T12:00:00: 39] [2006-11-01T12:00:00: 44] [2006-12-01T12:00:00: 48] \n [2007-01-01T12:00:00: 1] [2007-02-01T12:00:00: 5] [2007-03-01T12:00:00: 9] [2007-04-01T12:00:00: 13] \n [2007-05-01T12:00:00: 18] [2007-06-01T12:00:00: 22] [2007-07-01T12:00:00: 26] [2007-08-01T12:00:00: 31] \n [2007-09-01T12:00:00: 35] [2007-10-01T12:00:00: 40] [2007-11-01T12:00:00: 44] [2007-12-01T12:00:00: 48]\n ") ); } /** * test format-dateTime: ISO day within week Specifically, in the ISO calendar the days of the week are numbered from 1 (Monday) to 7 (Sunday), and week 1 in any calendar year is the week (from Monday to Sunday) that includes the first Thursday of that year. . */ @org.junit.Test public void formatDateTime010() { final XQuery query = new XQuery( "for $i in 1 to 48,\n" + " $d in $t + xs:yearMonthDuration('P1M')*$i\n" + " return concat(\"[\", $d, \": \", format-dateTime($d, '[F01]', (), 'ISO', ()))", ctx); try { query.bind("t", new XQuery("xs:dateTime('2003-12-01T12:00:00')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n [2004-01-01T12:00:00: 04 [2004-02-01T12:00:00: 07 [2004-03-01T12:00:00: 01 [2004-04-01T12:00:00: 04 \n [2004-05-01T12:00:00: 06 [2004-06-01T12:00:00: 02 [2004-07-01T12:00:00: 04 [2004-08-01T12:00:00: 07 \n [2004-09-01T12:00:00: 03 [2004-10-01T12:00:00: 05 [2004-11-01T12:00:00: 01 [2004-12-01T12:00:00: 03 \n [2005-01-01T12:00:00: 06 [2005-02-01T12:00:00: 02 [2005-03-01T12:00:00: 02 [2005-04-01T12:00:00: 05 \n [2005-05-01T12:00:00: 07 [2005-06-01T12:00:00: 03 [2005-07-01T12:00:00: 05 [2005-08-01T12:00:00: 01 \n [2005-09-01T12:00:00: 04 [2005-10-01T12:00:00: 06 [2005-11-01T12:00:00: 02 [2005-12-01T12:00:00: 04 \n [2006-01-01T12:00:00: 07 [2006-02-01T12:00:00: 03 [2006-03-01T12:00:00: 03 [2006-04-01T12:00:00: 06 \n [2006-05-01T12:00:00: 01 [2006-06-01T12:00:00: 04 [2006-07-01T12:00:00: 06 [2006-08-01T12:00:00: 02 \n [2006-09-01T12:00:00: 05 [2006-10-01T12:00:00: 07 [2006-11-01T12:00:00: 03 [2006-12-01T12:00:00: 05 \n [2007-01-01T12:00:00: 01 [2007-02-01T12:00:00: 04 [2007-03-01T12:00:00: 04 [2007-04-01T12:00:00: 07 \n [2007-05-01T12:00:00: 02 [2007-06-01T12:00:00: 05 [2007-07-01T12:00:00: 07 [2007-08-01T12:00:00: 03 \n [2007-09-01T12:00:00: 06 [2007-10-01T12:00:00: 01 [2007-11-01T12:00:00: 04 [2007-12-01T12:00:00: 06\n ") ); } /** * test format-dateTime: ISO week number within month --> Specifically, in the ISO calendar the days of the week are numbered from 1 (Monday) to 7 (Sunday), and week 1 in any calendar year is the week (from Monday to Sunday) that includes the first Thursday of that year. . */ @org.junit.Test public void formatDateTime011() { final XQuery query = new XQuery( "for $i in 1 to 48,\n" + " $d in $t + xs:yearMonthDuration('P1M')*$i\n" + " return concat(\"[\", $d, \": \", format-dateTime($d, '[w]', (), 'ISO', ()))", ctx); try { query.bind("t", new XQuery("xs:dateTime('2005-12-01T12:00:00')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n [2006-01-01T12:00:00: 0 [2006-02-01T12:00:00: 1 [2006-03-01T12:00:00: 1 [2006-04-01T12:00:00: 0 \n [2006-05-01T12:00:00: 1 [2006-06-01T12:00:00: 1 [2006-07-01T12:00:00: 0 [2006-08-01T12:00:00: 1 \n [2006-09-01T12:00:00: 0 [2006-10-01T12:00:00: 0 [2006-11-01T12:00:00: 1 [2006-12-01T12:00:00: 0 \n [2007-01-01T12:00:00: 1 [2007-02-01T12:00:00: 1 [2007-03-01T12:00:00: 1 [2007-04-01T12:00:00: 0 \n [2007-05-01T12:00:00: 1 [2007-06-01T12:00:00: 0 [2007-07-01T12:00:00: 0 [2007-08-01T12:00:00: 1 \n [2007-09-01T12:00:00: 0 [2007-10-01T12:00:00: 1 [2007-11-01T12:00:00: 1 [2007-12-01T12:00:00: 0 \n [2008-01-01T12:00:00: 1 [2008-02-01T12:00:00: 0 [2008-03-01T12:00:00: 0 [2008-04-01T12:00:00: 1 \n [2008-05-01T12:00:00: 1 [2008-06-01T12:00:00: 0 [2008-07-01T12:00:00: 1 [2008-08-01T12:00:00: 0 \n [2008-09-01T12:00:00: 1 [2008-10-01T12:00:00: 1 [2008-11-01T12:00:00: 0 [2008-12-01T12:00:00: 1 \n [2009-01-01T12:00:00: 1 [2009-02-01T12:00:00: 0 [2009-03-01T12:00:00: 0 [2009-04-01T12:00:00: 1 \n [2009-05-01T12:00:00: 0 [2009-06-01T12:00:00: 1 [2009-07-01T12:00:00: 1 [2009-08-01T12:00:00: 0 \n [2009-09-01T12:00:00: 1 [2009-10-01T12:00:00: 1 [2009-11-01T12:00:00: 0 [2009-12-01T12:00:00: 1\n ") ); } /** * test format-dateTime(): a,b,c... numbering sequence (not actually useful but allowed by the spec... . */ @org.junit.Test public void formatDateTime012() { final XQuery query = new XQuery( "for $i in 1 to 60 return\n" + " format-dateTime($t + xs:dayTimeDuration('PT61S')*$i, '[mA].[sa]')", ctx); try { query.bind("t", new XQuery("xs:dateTime('2011-07-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n P.g Q.h R.i S.j T.k U.l V.m W.n X.o Y.p Z.q AA.r AB.s AC.t AD.u AE.v AF.w AG.x AH.y AI.z AJ.aa \n AK.ab AL.ac AM.ad AN.ae AO.af AP.ag AQ.ah AR.ai AS.aj AT.ak AU.al AV.am AW.an AX.ao AY.ap AZ.aq \n BA.ar BB.as BC.at BD.au BE.av BF.aw BG.ax \n 0.ay A.az B.ba C.bb D.bc E.bd F.be G.bf H.bg J.0 K.a L.b M.c N.d O.e P.f\n ") ); } /** * test format-dateTime(): effect of width specifiers . */ @org.junit.Test public void formatDateTime013L() { final XQuery query = new XQuery( "format-dateTime($t, '[M,1-*]')", ctx); try { query.bind("t", new XQuery("xs:dateTime('0985-03-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * test format-dateTime(): effect of width specifiers . */ @org.junit.Test public void formatDateTime013a() { final XQuery query = new XQuery( "format-dateTime($t, '[Y,4-4]')", ctx); try { query.bind("t", new XQuery("xs:dateTime('0985-03-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0985") ); } /** * test format-dateTime(): effect of width specifiers . */ @org.junit.Test public void formatDateTime013b() { final XQuery query = new XQuery( "format-dateTime($t, '[Y,3-4]')", ctx); try { query.bind("t", new XQuery("xs:dateTime('0985-03-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "985") ); } /** * test format-dateTime(): effect of width specifiers . */ @org.junit.Test public void formatDateTime013c() { final XQuery query = new XQuery( "format-dateTime($t, '[Y,2-5]')", ctx); try { query.bind("t", new XQuery("xs:dateTime('0985-03-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "985") ); } /** * test format-dateTime(): effect of width specifiers . */ @org.junit.Test public void formatDateTime013d() { final XQuery query = new XQuery( "format-dateTime($t, '[Y,2-2]')", ctx); try { query.bind("t", new XQuery("xs:dateTime('0985-03-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "85") ); } /** * test format-dateTime(): effect of width specifiers . */ @org.junit.Test public void formatDateTime013e() { final XQuery query = new XQuery( "format-dateTime($t, '[Y,2-*]')", ctx); try { query.bind("t", new XQuery("xs:dateTime('0985-03-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "985") ); } /** * test format-dateTime(): effect of width specifiers . */ @org.junit.Test public void formatDateTime013f() { final XQuery query = new XQuery( "format-dateTime($t, '[Y,*-4]')", ctx); try { query.bind("t", new XQuery("xs:dateTime('0985-03-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "985") ); } /** * test format-dateTime(): effect of width specifiers . */ @org.junit.Test public void formatDateTime013g() { final XQuery query = new XQuery( "format-dateTime($t, '[Y,3]')", ctx); try { query.bind("t", new XQuery("xs:dateTime('0985-03-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "985") ); } /** * test format-dateTime(): effect of width specifiers . */ @org.junit.Test public void formatDateTime013h() { final XQuery query = new XQuery( "format-dateTime($t, '[M,4-4]')", ctx); try { query.bind("t", new XQuery("xs:dateTime('0985-03-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0003") ); } /** * test format-dateTime(): effect of width specifiers . */ @org.junit.Test public void formatDateTime013i() { final XQuery query = new XQuery( "format-dateTime($t, '[M,1-4]')", ctx); try { query.bind("t", new XQuery("xs:dateTime('0985-03-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * test format-dateTime(): effect of width specifiers . */ @org.junit.Test public void formatDateTime013j() { final XQuery query = new XQuery( "format-dateTime($t, '[M,2-5]')", ctx); try { query.bind("t", new XQuery("xs:dateTime('0985-03-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "03") ); } /** * test format-dateTime(): effect of width specifiers . */ @org.junit.Test public void formatDateTime013k() { final XQuery query = new XQuery( "format-dateTime($t, '[M,2-2]')", ctx); try { query.bind("t", new XQuery("xs:dateTime('0985-03-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "03") ); } /** * test format-dateTime(): effect of width specifiers . */ @org.junit.Test public void formatDateTime013m() { final XQuery query = new XQuery( "format-dateTime($t, '[M,*-2]')", ctx); try { query.bind("t", new XQuery("xs:dateTime('0985-03-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * test format-dateTime(): effect of width specifiers . */ @org.junit.Test public void formatDateTime013n() { final XQuery query = new XQuery( "format-dateTime($t, '[M,3]')", ctx); try { query.bind("t", new XQuery("xs:dateTime('0985-03-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "003") ); } /** * test format-dateTime(): effect of width specifiers . */ @org.junit.Test public void formatDateTime013p() { final XQuery query = new XQuery( "format-dateTime($t, '[f,4-4]')", ctx); try { query.bind("t", new XQuery("xs:dateTime('0985-03-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4560") ); } /** * test format-dateTime(): effect of width specifiers . */ @org.junit.Test public void formatDateTime013q() { final XQuery query = new XQuery( "format-dateTime($t, '[f,1-4]')", ctx); try { query.bind("t", new XQuery("xs:dateTime('0985-03-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "456") ); } /** * test format-dateTime(): effect of width specifiers . */ @org.junit.Test public void formatDateTime013r() { final XQuery query = new XQuery( "format-dateTime($t, '[f,2-5]')", ctx); try { query.bind("t", new XQuery("xs:dateTime('0985-03-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "456") ); } /** * test format-dateTime(): effect of width specifiers . */ @org.junit.Test public void formatDateTime013s() { final XQuery query = new XQuery( "format-dateTime($t, '[f,2-2]')", ctx); try { query.bind("t", new XQuery("xs:dateTime('0985-03-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "46") ); } /** * test format-dateTime(): effect of width specifiers . */ @org.junit.Test public void formatDateTime013t() { final XQuery query = new XQuery( "format-dateTime($t, '[f,1-*]')", ctx); try { query.bind("t", new XQuery("xs:dateTime('0985-03-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "456") ); } /** * test format-dateTime(): effect of width specifiers . */ @org.junit.Test public void formatDateTime013u() { final XQuery query = new XQuery( "format-dateTime($t, '[f,*-2]')", ctx); try { query.bind("t", new XQuery("xs:dateTime('0985-03-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "46") ); } /** * test format-dateTime(): effect of width specifiers . */ @org.junit.Test public void formatDateTime013v() { final XQuery query = new XQuery( "format-dateTime($t, '[f,3]')", ctx); try { query.bind("t", new XQuery("xs:dateTime('0985-03-01T09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "456") ); } /** * test format-dateTime(): timezones in +nn:nn notation. */ @org.junit.Test public void formatDateTime014() { final XQuery query = new XQuery( "string-join(\n" + " for $z in -28 to +28\n" + " return format-dateTime(adjust-dateTime-to-timezone(\n" + " $t, $z*xs:dayTimeDuration('PT30M')), '[h01][m01][Z]'), '; ')\n" + " ", ctx); try { query.bind("t", new XQuery("xs:dateTime('0985-03-01T09:15:06.456Z')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n 0715-14:00; 0745-13:30; 0815-13:00; 0845-12:30; 0915-12:00; 0945-11:30; 1015-11:00; 1045-10:30; 1115-10:00; \n 1145-09:30; 1215-09:00; 1245-08:30; 0115-08:00; 0145-07:30; 0215-07:00; 0245-06:30; 0315-06:00; 0345-05:30;\n 0415-05:00; 0445-04:30; 0515-04:00; 0545-03:30; 0615-03:00; 0645-02:30; 0715-02:00; 0745-01:30; 0815-01:00;\n 0845-00:30; 0915+00:00; 0945+00:30; 1015+01:00; 1045+01:30; 1115+02:00; 1145+02:30; 1215+03:00; 1245+03:30;\n 0115+04:00; 0145+04:30; 0215+05:00; 0245+05:30; 0315+06:00; 0345+06:30; 0415+07:00; 0445+07:30; 0515+08:00;\n 0545+08:30; 0615+09:00; 0645+09:30; 0715+10:00; 0745+10:30; 0815+11:00; 0845+11:30; 0915+12:00; 0945+12:30;\n 1015+13:00; 1045+13:30; 1115+14:00\n ") ); } /** * test format-dateTime(): timezones in GMT+x notation. */ @org.junit.Test public void formatDateTime015() { final XQuery query = new XQuery( "string-join(\n" + " for $z in -28 to +28\n" + " return format-dateTime(adjust-dateTime-to-timezone(\n" + " $t, $z*xs:dayTimeDuration('PT30M')), '[h01][m01][z0]'), '; ')", ctx); try { query.bind("t", new XQuery("xs:dateTime('0985-03-01T09:15:06.456Z')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n 0715GMT-14; 0745GMT-13:30; 0815GMT-13; 0845GMT-12:30; 0915GMT-12; 0945GMT-11:30; 1015GMT-11; 1045GMT-10:30;\n 1115GMT-10; 1145GMT-9:30; 1215GMT-9; 1245GMT-8:30; 0115GMT-8; 0145GMT-7:30; 0215GMT-7; 0245GMT-6:30; 0315GMT-6;\n 0345GMT-5:30; 0415GMT-5; 0445GMT-4:30; 0515GMT-4; 0545GMT-3:30; 0615GMT-3; 0645GMT-2:30; 0715GMT-2; 0745GMT-1:30;\n 0815GMT-1; 0845GMT-0:30; 0915GMT+0; 0945GMT+0:30; 1015GMT+1; 1045GMT+1:30; 1115GMT+2; 1145GMT+2:30; 1215GMT+3; \n 1245GMT+3:30; 0115GMT+4; 0145GMT+4:30; 0215GMT+5; 0245GMT+5:30; 0315GMT+6; 0345GMT+6:30; 0415GMT+7; 0445GMT+7:30; \n 0515GMT+8; 0545GMT+8:30; 0615GMT+9; 0645GMT+9:30; 0715GMT+10; 0745GMT+10:30; 0815GMT+11; 0845GMT+11:30; 0915GMT+12; \n 0945GMT+12:30; 1015GMT+13; 1045GMT+13:30; 1115GMT+14\n ") ); } /** * test format-dateTime(): timezones in GMT+x notation. */ @org.junit.Test public void formatDateTime016() { final XQuery query = new XQuery( "string-join(\n" + " for $z in -28 to +28\n" + " return format-dateTime(adjust-dateTime-to-timezone(\n" + " $t, $z*xs:dayTimeDuration('PT30M')), '[h01][m01][z00:00]'), '; ')\n" + " ", ctx); try { query.bind("t", new XQuery("xs:dateTime('0985-03-01T09:15:06.456Z')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n 0715GMT-14:00; 0745GMT-13:30; 0815GMT-13:00; 0845GMT-12:30; 0915GMT-12:00; 0945GMT-11:30; 1015GMT-11:00; \n 1045GMT-10:30; 1115GMT-10:00; 1145GMT-09:30; 1215GMT-09:00; 1245GMT-08:30; 0115GMT-08:00; 0145GMT-07:30; \n 0215GMT-07:00; 0245GMT-06:30; 0315GMT-06:00; 0345GMT-05:30; 0415GMT-05:00; 0445GMT-04:30; 0515GMT-04:00; \n 0545GMT-03:30; 0615GMT-03:00; 0645GMT-02:30; 0715GMT-02:00; 0745GMT-01:30; 0815GMT-01:00; 0845GMT-00:30; \n 0915GMT+00:00; 0945GMT+00:30; 1015GMT+01:00; 1045GMT+01:30; 1115GMT+02:00; 1145GMT+02:30; 1215GMT+03:00; 1245GMT+03:30; \n 0115GMT+04:00; 0145GMT+04:30; 0215GMT+05:00; 0245GMT+05:30; 0315GMT+06:00; 0345GMT+06:30; 0415GMT+07:00; \n 0445GMT+07:30; 0515GMT+08:00; 0545GMT+08:30; 0615GMT+09:00; 0645GMT+09:30; 0715GMT+10:00; 0745GMT+10:30; \n 0815GMT+11:00; 0845GMT+11:30; 0915GMT+12:00; 0945GMT+12:30; 1015GMT+13:00; 1045GMT+13:30; 1115GMT+14:00\n ") ); } /** * test format-dateTime(): timezones in GMT+x notation. */ @org.junit.Test public void formatDateTime017() { final XQuery query = new XQuery( "string-join(\n" + " for $z in -28 to +28\n" + " return format-dateTime(adjust-dateTime-to-timezone($t, $z*xs:dayTimeDuration('PT30M')), '[h01][m01][z00]'), '; ')", ctx); try { query.bind("t", new XQuery("xs:dateTime('0985-03-01T09:15:06.456Z')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n 0715GMT-14; 0745GMT-13:30; 0815GMT-13; 0845GMT-12:30; 0915GMT-12; 0945GMT-11:30; 1015GMT-11; 1045GMT-10:30; \n 1115GMT-10; 1145GMT-09:30; 1215GMT-09; 1245GMT-08:30; 0115GMT-08; 0145GMT-07:30; 0215GMT-07; 0245GMT-06:30;\n 0315GMT-06; 0345GMT-05:30; 0415GMT-05; 0445GMT-04:30; 0515GMT-04; 0545GMT-03:30; 0615GMT-03; 0645GMT-02:30;\n 0715GMT-02; 0745GMT-01:30; 0815GMT-01; 0845GMT-00:30; 0915GMT+00; 0945GMT+00:30; 1015GMT+01; 1045GMT+01:30; 1115GMT+02;\n 1145GMT+02:30; 1215GMT+03; 1245GMT+03:30; 0115GMT+04; 0145GMT+04:30; 0215GMT+05; 0245GMT+05:30; 0315GMT+06;\n 0345GMT+06:30; 0415GMT+07; 0445GMT+07:30; 0515GMT+08; 0545GMT+08:30; 0615GMT+09; 0645GMT+09:30; 0715GMT+10;\n 0745GMT+10:30; 0815GMT+11; 0845GMT+11:30; 0915GMT+12; 0945GMT+12:30; 1015GMT+13; 1045GMT+13:30; 1115GMT+14\n ") ); } /** * test format-dateTime(): timezones in GMT+x notation. */ @org.junit.Test public void formatDateTime018() { final XQuery query = new XQuery( "string-join(\n" + " for $z in -28 to +28\n" + " return format-dateTime(adjust-dateTime-to-timezone($t, $z*xs:dayTimeDuration('PT30M')), '[h01][m01][z00]'), '; ')", ctx); try { query.bind("t", new XQuery("xs:dateTime('0985-03-01T09:15:06.456Z')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n 0715GMT-14; 0745GMT-13:30; 0815GMT-13; 0845GMT-12:30; 0915GMT-12; 0945GMT-11:30; 1015GMT-11; 1045GMT-10:30;\n 1115GMT-10; 1145GMT-09:30; 1215GMT-09; 1245GMT-08:30; 0115GMT-08; 0145GMT-07:30; 0215GMT-07; 0245GMT-06:30; 0315GMT-06;\n 0345GMT-05:30; 0415GMT-05; 0445GMT-04:30; 0515GMT-04; 0545GMT-03:30; 0615GMT-03; 0645GMT-02:30; 0715GMT-02; 0745GMT-01:30;\n 0815GMT-01; 0845GMT-00:30; 0915GMT+00; 0945GMT+00:30; 1015GMT+01; 1045GMT+01:30; 1115GMT+02; 1145GMT+02:30; 1215GMT+03;\n 1245GMT+03:30; 0115GMT+04; 0145GMT+04:30; 0215GMT+05; 0245GMT+05:30; 0315GMT+06; 0345GMT+06:30; 0415GMT+07; 0445GMT+07:30;\n 0515GMT+08; 0545GMT+08:30; 0615GMT+09; 0645GMT+09:30; 0715GMT+10; 0745GMT+10:30; 0815GMT+11; 0845GMT+11:30; 0915GMT+12;\n 0945GMT+12:30; 1015GMT+13; 1045GMT+13:30; 1115GMT+14\n ") ); } /** * Error FOFD1340 syntax of picture is incorrect. */ @org.junit.Test public void formatDateTime1340err() { final XQuery query = new XQuery( "format-dateTime(current-dateTime(), '[yY]', 'en', (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOFD1340") ); } /** * Error XTDE1340 incorrect picture string. */ @org.junit.Test public void formatDateTime801err() { final XQuery query = new XQuery( "format-dateTime(current-dateTime(), '[bla]', 'en', (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XTDE1340") || error("FOFD1340") ) ); } /** * English BC/AD. */ @org.junit.Test public void formatDateTimeEn141() { final XQuery query = new XQuery( "\n" + " format-dateTime($d1, '[Y][EN]', 'en', (), ()),\n" + " format-dateTime($d2, '[Y][EN]', 'en', (), ())\n" + " ", ctx); try { query.bind("d1", new XQuery("xs:dateTime('1990-12-01T12:00:00')", ctx).value()); query.bind("d2", new XQuery("xs:dateTime('-0055-12-01T12:00:00')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertDeepEq("\"1990AD\", \"55BC\"") || assertDeepEq("\"1990CE\", \"55BCE\"") || assertDeepEq("\"1990A.D.\", \"55B.C.\"") || assertDeepEq("\"1990C.E.\", \"55B.C.E.\"") ) ); } /** * English AM/PM. */ @org.junit.Test public void formatDateTimeEn142() { final XQuery query = new XQuery( "\n" + " for $i in 0 to 23 return\n" + " let $t := $b + xs:dayTimeDuration('PT1H')*$i return\n" + " translate(format-dateTime($t, '[h]~[m][P]', 'en', (), ()), '.- ', '')\n" + " ", ctx); try { query.bind("b", new XQuery("xs:dateTime('2011-07-01T00:10:00')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n 12~10am 1~10am 2~10am 3~10am 4~10am 5~10am 6~10am 7~10am 8~10am 9~10am 10~10am 11~10am 12~10pm \n 1~10pm 2~10pm 3~10pm 4~10pm 5~10pm 6~10pm 7~10pm 8~10pm 9~10pm 10~10pm 11~10pm\n ") ); } /** * English noon/midnight. The US convention seems to be noon=AM, midnight=PM, * and as no-one except the US uses the 12-hour clock these days, we'll go with that.. */ @org.junit.Test public void formatDateTimeEn143() { final XQuery query = new XQuery( "\n" + " for $i in 0 to 1 return\n" + " let $t := $b + xs:dayTimeDuration('PT12H')*$i return\n" + " translate(format-dateTime($t, '[h]~[m][P]', 'en', (), ()), '.- ', '')\n" + " ", ctx); try { query.bind("b", new XQuery("xs:dateTime('2011-07-01T00:00:00')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12~00am 12~00pm") ); } /** . */ @org.junit.Test public void formatDateTimeEn152() { final XQuery query = new XQuery( "format-dateTime($b, '[M01]', 'en', 'CB', ())", ctx); try { query.bind("b", new XQuery("xs:dateTime('2006-03-01T12:00:00')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "[Calendar: AD]03") ); } /** * wrong arg input to format-date(). */ @org.junit.Test public void formatDateTimeInptEr1() { final XQuery query = new XQuery( "format-dateTime('abc', '[bla]', 'en', (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * wrong number of args to format-date(). */ @org.junit.Test public void formatDateTimeInptEr2() { final XQuery query = new XQuery( "format-dateTime(current-dateTime(), '[bla]', 'en', (), (), 6)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * wrong type of args to format-date(). */ @org.junit.Test public void formatDateTimeInptEr3() { final XQuery query = new XQuery( "format-dateTime(current-dateTime(), '[bla]', 'en', (), 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnFormatInteger.java000066400000000000000000000674431222453003200300170ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the fn:format-integer function introduced in XPath 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnFormatInteger extends QT3TestSet { /** * format-integer with picture="1". */ @org.junit.Test public void formatInteger001() { final XQuery query = new XQuery( "format-integer(123, '1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'123'") ); } /** * format-integer with picture="001". */ @org.junit.Test public void formatInteger002() { final XQuery query = new XQuery( "format-integer(123, '001')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'123'") ); } /** * format-integer with picture="00001". */ @org.junit.Test public void formatInteger003() { final XQuery query = new XQuery( "format-integer(123, '00001')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'00123'") ); } /** * format-integer negative integer with picture="9". */ @org.junit.Test public void formatInteger004() { final XQuery query = new XQuery( "format-integer(-123, '9')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'-123'") ); } /** * format-integer negative integer with picture="999". */ @org.junit.Test public void formatInteger005() { final XQuery query = new XQuery( "format-integer(-123, '999')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'-123'") ); } /** * format-integer negative integer with picture="99999". */ @org.junit.Test public void formatInteger006() { final XQuery query = new XQuery( "format-integer(-123, '99999')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'-00123'") ); } /** * format-integer zero with picture="0". */ @org.junit.Test public void formatInteger007() { final XQuery query = new XQuery( "format-integer(0, '0')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'0'") ); } /** * format-integer zero with picture="000". */ @org.junit.Test public void formatInteger008() { final XQuery query = new XQuery( "format-integer(0, '000')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'000'") ); } /** * format-integer zero with picture="00000". */ @org.junit.Test public void formatInteger009() { final XQuery query = new XQuery( "format-integer(0, '00000')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'00000'") ); } /** * format-integer with picture="a". */ @org.junit.Test public void formatInteger010() { final XQuery query = new XQuery( "string-join(for $i in 1 to 4 return format-integer($i, 'a'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'abcd'") ); } /** * format-integer with picture="A". */ @org.junit.Test public void formatInteger011() { final XQuery query = new XQuery( "string-join(for $i in 1 to 4 return format-integer($i, 'A'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'ABCD'") ); } /** * format-integer with picture="i" (lower-case roman numerals). */ @org.junit.Test public void formatInteger012() { final XQuery query = new XQuery( "string-join(for $i in 1 to 20 return format-integer($i, 'i'), '|')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'i|ii|iii|iv|v|vi|vii|viii|ix|x|xi|xii|xiii|xiv|xv|xvi|xvii|xviii|xix|xx'") ); } /** * format-integer with picture="I" (upper-case roman numerals). */ @org.junit.Test public void formatInteger013() { final XQuery query = new XQuery( "string-join(for $i in 1 to 20 return format-integer($i, 'I'), '|')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'I|II|III|IV|V|VI|VII|VIII|IX|X|XI|XII|XIII|XIV|XV|XVI|XVII|XVIII|XIX|XX'") ); } /** * format-integer using Arabic digits. */ @org.junit.Test public void formatInteger014() { final XQuery query = new XQuery( "string-join(for $i in 1 to 20 return format-integer($i, 'Ù¡'), '|')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'Ù¡|Ù¢|Ù£|Ù¤|Ù¥|Ù¦|Ù§|Ù¨|Ù©|١٠|١١|١٢|١٣|١٤|١٥|١٦|Ù¡Ù§|١٨|١٩|٢٠'") ); } /** * format-integer using Arabic digits. */ @org.junit.Test public void formatInteger015() { final XQuery query = new XQuery( "string-join(for $i in 1 to 20 return format-integer($i, 'Ù©'), '|')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'Ù¡|Ù¢|Ù£|Ù¤|Ù¥|Ù¦|Ù§|Ù¨|Ù©|١٠|١١|١٢|١٣|١٤|١٥|١٦|Ù¡Ù§|١٨|١٩|٢٠'") ); } /** * format-integer with title case words. */ @org.junit.Test public void formatInteger016() { final XQuery query = new XQuery( "string-join(for $i in 1 to 10 return format-integer($i, 'Ww'), '|')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'One|Two|Three|Four|Five|Six|Seven|Eight|Nine|Ten'") ); } /** * format-integer with upper-case words. */ @org.junit.Test public void formatInteger017() { final XQuery query = new XQuery( "string-join(for $i in 1 to 10 return format-integer($i, 'W'), '|')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'ONE|TWO|THREE|FOUR|FIVE|SIX|SEVEN|EIGHT|NINE|TEN'") ); } /** * format-integer with lower-case words. */ @org.junit.Test public void formatInteger018() { final XQuery query = new XQuery( "string-join(for $i in 1 to 10 return format-integer($i, 'w'), '|')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'one|two|three|four|five|six|seven|eight|nine|ten'") ); } /** * format-integer - Error case. */ @org.junit.Test public void formatInteger019() { final XQuery query = new XQuery( "format-integer(a, 'w')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * format-integer - Error case with empty picture. */ @org.junit.Test public void formatInteger020() { final XQuery query = new XQuery( "format-integer(1, '')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODF1310") ); } /** * format-integer - picture grouping. */ @org.junit.Test public void formatInteger021() { final XQuery query = new XQuery( "format-integer(1500000, '0,000')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'1,500,000'") ); } /** * format-integer - picture grouping, with hash symbols at the end. */ @org.junit.Test public void formatInteger022() { final XQuery query = new XQuery( "format-integer(1500000, '#,###,000')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'1,500,000'") ); } /** * format-integer - picture grouping. */ @org.junit.Test public void formatInteger023() { final XQuery query = new XQuery( "format-integer(1500000, '0,000,')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODF1310") ); } /** * format-integer - picture grouping error. */ @org.junit.Test public void formatInteger024() { final XQuery query = new XQuery( "format-integer(1500000, '11#0,000')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODF1310") ); } /** * format-integer - picture grouping error. */ @org.junit.Test public void formatInteger025() { final XQuery query = new XQuery( "format-integer(1500000, '#')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'1500000'") ); } /** * format-integer - picture grouping error. */ @org.junit.Test public void formatInteger026() { final XQuery query = new XQuery( "format-integer(1500000, '#a')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'1500000'") ); } /** * format-integer - picture grouping error. */ @org.junit.Test public void formatInteger027() { final XQuery query = new XQuery( "format-integer(1500000, ',123')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODF1310") ); } /** * format-integer - picture grouping error. */ @org.junit.Test public void formatInteger028() { final XQuery query = new XQuery( "format-integer(1500000, '0,00,,000')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODF1310") ); } /** * format-integer - picture grouping, with hash symbols at the end; non-BMP grouping separator. */ @org.junit.Test public void formatInteger029() { final XQuery query = new XQuery( "format-integer(1500000, '###\ud800\udd000,00')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'1500\ud800\udd000,00'") ); } /** * format-integer - picture with different separators, which are irregular. */ @org.junit.Test public void formatInteger030() { final XQuery query = new XQuery( "format-integer(602347826, '#(000)000-000')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'(602)347-826'") ); } /** * format-integer - Ordinal number output request. */ @org.junit.Test public void formatInteger031() { final XQuery query = new XQuery( "format-integer(2, 'W;o')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'SECOND'") ); } /** * format-integer - Ordinal number output request. */ @org.junit.Test public void formatInteger033() { final XQuery query = new XQuery( "format-integer(1, '1;o(-en)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'1st'") ); } /** * format-integer - ordinal number request format modifier, with invalid picture. */ @org.junit.Test public void formatInteger034() { final XQuery query = new XQuery( "format-integer(1, '1;o(-er)z')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODF1310") ); } /** * format-integer - format modifier t. */ @org.junit.Test public void formatInteger035() { final XQuery query = new XQuery( "format-integer(1, 'Ww;t')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'One'") ); } /** * format-integer - empty sequence. */ @org.junit.Test public void formatInteger036() { final XQuery query = new XQuery( "format-integer((), 'Ww')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("''") && assertType("xs:string") && assertQuery("count($result) = 1") ) ); } /** * format-integer - mismatched parens in picture. */ @org.junit.Test public void formatInteger037() { final XQuery query = new XQuery( "format-integer(1234, 'Ww;o()(')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODF1310") ); } /** * format-integer - misplaced parens in picture. */ @org.junit.Test public void formatInteger038() { final XQuery query = new XQuery( "format-integer(1234, '()Ww;o')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1234th") ); } /** * format-integer - disallowed characters in picture. */ @org.junit.Test public void formatInteger039() { final XQuery query = new XQuery( "format-integer(1234, '\n" + "')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1234") ); } /** * format-integer - mixed digits in picture. */ @org.junit.Test public void formatInteger040() { final XQuery query = new XQuery( "format-integer(1234, '123Ù¡')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODF1310") ); } /** * format-integer - non-BMP digits (Osmanya digits). */ @org.junit.Test public void formatInteger041() { final XQuery query = new XQuery( "format-integer(1234, '#,ð’ ð’ ð’ ')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'ð’¡,ð’¢ð’£ð’¤'") ); } /** * format-integer - unrecognized numbering sequence - fallback. */ @org.junit.Test public void formatInteger042() { final XQuery query = new XQuery( "format-integer(1234, 'ﯴ')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'1234'") ); } /** * format-integer - negative ordinal. */ @org.junit.Test public void formatInteger043() { final XQuery query = new XQuery( "format-integer(-85, '1;o')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'-85th'") ); } /** * format-integer - negative ordinal in words. */ @org.junit.Test public void formatInteger044() { final XQuery query = new XQuery( "format-integer(-5, 'Ww;o')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'-Fifth'") ); } /** * format-integer - zero in words. */ @org.junit.Test public void formatInteger045() { final XQuery query = new XQuery( "format-integer(0, 'Ww')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'Zero'") ); } /** * format-integer with circled digits. */ @org.junit.Test public void formatInteger046() { final XQuery query = new XQuery( "string-join(for $i in 1 to 5 return format-integer($i, 'â‘ '), '|')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'â‘ |â‘¡|â‘¢|â‘£|⑤'") ); } /** * format-integer with parenthesized digits. */ @org.junit.Test public void formatInteger047() { final XQuery query = new XQuery( "string-join(for $i in 1 to 5 return format-integer($i, 'â‘´'), '|')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'â‘´|⑵|â‘¶|â‘·|⑸'") ); } /** * format-integer with full-stopped digits. */ @org.junit.Test public void formatInteger048() { final XQuery query = new XQuery( "string-join(for $i in 1 to 5 return format-integer($i, 'â’ˆ'), '|')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'â’ˆ|â’‰|â’Š|â’‹|â’Œ'") ); } /** * format-integer with greek uppercase. */ @org.junit.Test public void formatInteger049() { final XQuery query = new XQuery( "string-join(for $i in 1 to 5 return format-integer($i, 'Α'), '|')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'Α|Î’|Γ|Δ|Ε'") ); } /** * format-integer with greek lowercase. */ @org.junit.Test public void formatInteger050() { final XQuery query = new XQuery( "string-join(for $i in 1 to 5 return format-integer($i,'α'), '|')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'α|β|γ|δ|ε'") ); } /** * format-integer with space as separator. */ @org.junit.Test public void formatInteger051() { final XQuery query = new XQuery( "format-integer(12345678901,'# 000')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'12 345 678 901'") ); } /** * format-integer using Kanji sequence (see http://en.wikipedia.org/wiki/Japanese_numerals). */ @org.junit.Test public void formatInteger052() { final XQuery query = new XQuery( "string-join(\n" + " for $i in (1 to 23, 151, 302, 469, 2025) \n" + " return concat($i, '=', format-integer($i, '一')), '|')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'1=一|2=二|3=三|4=å››|5=五|6=å…­|7=七|8=å…«|9=ä¹|10=å|11=å一|12=å二|13=å三|14=åå››|15=å五|16=åå…­|17=å七|18=åå…«|19=åä¹|20=二å|21=二å一|22=二å二|23=二å三|151=百五å一|302=三百二|469=四百六åä¹|2025=二åƒäºŒå五'") ); } /** * format-integer with leading optional-digit-sign. */ @org.junit.Test public void formatInteger053() { final XQuery query = new XQuery( "format-integer(123,'#0')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'123'") ); } /** * format-integer - trailing optional-digit-sign error. */ @org.junit.Test public void formatInteger054() { final XQuery query = new XQuery( "format-integer(123,'0#')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODF1310") ); } /** * format-integer - test case relates to Bug #12280 in bugzilla. */ @org.junit.Test public void formatInteger055() { final XQuery query = new XQuery( "format-integer(1,'b;o')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:string") ); } /** * format-integer - test case relates to Bug #12280 in bugzilla. */ @org.junit.Test public void formatInteger056() { final XQuery query = new XQuery( "format-integer(1,'o;o')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:string") ); } /** * format-integer - test case relates to Bug #12280 in bugzilla. */ @org.junit.Test public void formatInteger057() { final XQuery query = new XQuery( "format-integer(1,'bo;o')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:string") ); } /** * format-integer - test case relates to Bug #12280 in bugzilla. */ @org.junit.Test public void formatInteger058() { final XQuery query = new XQuery( "format-integer(1,'bb')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:string") ); } /** * format-integer - semicolon at end is ignored. */ @org.junit.Test public void formatInteger059() { final XQuery query = new XQuery( "format-integer(1,'001;')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'001'") ); } /** * format-integer - semicolon as grouping separator. */ @org.junit.Test public void formatInteger060() { final XQuery query = new XQuery( "format-integer(1234,'#;##1;')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'1;234'") ); } /** * format-integer - Lone semicolon * (unrecognized format token, defaults to "1"). */ @org.junit.Test public void formatInteger061() { final XQuery query = new XQuery( "format-integer(1, ';')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODF1310") ); } /** * Third argument as a string in the form of a language code. */ @org.junit.Test public void formatInteger062() { final XQuery query = new XQuery( "format-integer(11, 'Ww', 'en')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'Eleven'") ); } /** * Third argument as a string not in the form of a language code. */ @org.junit.Test public void formatInteger063() { final XQuery query = new XQuery( "format-integer(11, 'Ww', '@*!+%')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'Eleven'") ); } /** * Error case with missing format modifier separator. */ @org.junit.Test public void formatInteger064() { final XQuery query = new XQuery( "format-integer(-1, '1o')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODF1310") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnFormatNumber.java000066400000000000000000001203151222453003200276360ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the format-number() function transferred from XSLT 1.0/2.0 to XPath 3.0/XQuery 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnFormatNumber extends QT3TestSet { /** * * Creator: David Marston * Purpose: Test of format-number with 2 arguments, showing zeroes. . */ @org.junit.Test public void numberformat01() { final XQuery query = new XQuery( "format-number(2392.14*36.58,'000,000.000000')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "087,504.481200") ); } /** * * Creator: David Marston * Purpose: Test of format-number and # and 0 in format string. . */ @org.junit.Test public void numberformat02() { final XQuery query = new XQuery( "format-number(12792.14*96.58,'##,###,000.000###')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1,235,464.8812") ); } /** * * Creator: David Marston * Purpose: Test of format-number on a negative number. . */ @org.junit.Test public void numberformat03() { final XQuery query = new XQuery( "format-number(2792.14*(-36.58),'000,000.000###')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-102,136.4812") ); } /** * * Creator: David Marston * Purpose: Test of format-number on a negative number; should choose second pattern. . */ @org.junit.Test public void numberformat04() { final XQuery query = new XQuery( "format-number(2392.14*(-36.58),'000,000.000###;###,###.000###')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "87,504.4812") ); } /** * * Creator: David Marston * Purpose: Test of format-number percentage format. . */ @org.junit.Test public void numberformat05() { final XQuery query = new XQuery( "format-number(0.4857,'###.###%')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "48.57%") ); } /** * * Creator: David Marston * Purpose: Test of format-number per-mille format. . */ @org.junit.Test public void numberformat06() { final XQuery query = new XQuery( "format-number(0.4857,'###.###\u2030')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "485.7\u2030") ); } /** * * Creator: David Marston * Purpose: Test of format-number currency symbol, which is not supposed to be there. . */ @org.junit.Test public void numberformat07() { final XQuery query = new XQuery( "format-number(95.4857,'¤###.####')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "¤95.4857") ); } /** * * Creator: David Marston * Purpose: Test of format-number with prefix and suffix in format string. . */ @org.junit.Test public void numberformat08() { final XQuery query = new XQuery( "format-number(2.14*86.58,'PREFIX##00.000###SUFFIX')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PREFIX185.2812SUFFIX") ); } /** * * Creator: David Marston * Purpose: Test default decimal-format on separator characters, changing both. . */ @org.junit.Test public void numberformat09() { final XQuery query = new XQuery( "format-number(931.4857,'000.000|###')", ctx); try { // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "000.931|486") ); } /** * * Creator: David Marston * Purpose: Test default decimal-format on pattern-only characters, positive number. . */ @org.junit.Test public void numberformat11() { final XQuery query = new XQuery( "format-number(26931.4,'+!!!,!!!.!!!\\-!!,!!!.!!!')", ctx); try { // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "+26,931.4") ); } /** * * Creator: David Marston * Purpose: Test default decimal-format on pattern-only characters, negative number. . */ @org.junit.Test public void numberformat12() { final XQuery query = new XQuery( "format-number(-26931.4,'+!!,!!!.!!!\\-!!!,!!!.!!!')", ctx); try { // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-26,931.4") ); } /** * * Creator: David Marston * Purpose: Test default decimal-format on pattern-only characters, negative number and one pattern. . */ @org.junit.Test public void numberformat13() { final XQuery query = new XQuery( "format-number(-26931.4,'!!!,!!!.!!!')", ctx); try { // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-26,931.4") ); } /** * * Creator: David Marston * Purpose: Test specified result pattern for infinity. . */ @org.junit.Test public void numberformat14() { final XQuery query = new XQuery( "format-number(1 div 0e0,'###############################')", ctx); try { // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "off-the-scale") ); } /** * * Creator: David Marston * Purpose: Test of decimal-format per-mille format with character being changed. . */ @org.junit.Test public void numberformat16() { final XQuery query = new XQuery( "format-number(0.4857,'###.###m')", ctx); try { // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "485.7m") ); } /** * * Creator: David Marston * Purpose: Test decimal-format output character for negative, 2 patterns. . */ @org.junit.Test public void numberformat17() { final XQuery query = new XQuery( "format-number(-26931.4,'+###,###.###;-###,###.###')", ctx); try { // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-26,931.4") ); } /** * * Creator: David Marston * Purpose: Test decimal-format output character for negative, one pattern. . */ @org.junit.Test public void numberformat18() { final XQuery query = new XQuery( "format-number(-26931.4,'###,###.###')", ctx); try { // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "_26,931.4") ); } /** * * Creator: David Marston * Purpose: Test decimal-format declaration with a name. . */ @org.junit.Test public void numberformat19() { final XQuery query = new XQuery( "concat(format-number(-26931.4,'###,###.###','myminus'), '/',\n" + " format-number(-42857.1,'###,###.###'))", ctx); try { // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "_26,931.4/-42,857.1") ); } /** * * Creator: David Marston * Purpose: Test of decimal-format with qualified name. Unqualified name provided as a trap. . */ @org.junit.Test public void numberformat20() { final XQuery query = new XQuery( "format-number(1234.567,'#*###*###!###','foo:decimal1')", ctx); try { query.namespace("foo", "http://foo.ns"); // decimal format // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1*234!567") ); } /** * * Creator: David Marston * Purpose: Designate a space as the grouping separator. . */ @org.junit.Test public void numberformat26() { final XQuery query = new XQuery( "format-number(7654321.4857,'### ### ###,#####')", ctx); try { // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "7 654 321,4857") ); } /** * * Creator: David Marston * Purpose: Test of format-number minus-sign behavior on positive numbers. . */ @org.junit.Test public void numberformat27() { final XQuery query = new XQuery( "string-join((format-number(2392.14*36.58,'000,000.000000','myminus'),\n" + " format-number(2392.14*36.58,'000,000.000000;###,###.000###'),\n" + " format-number(2392.14*36.58,'000,000.000000;###,###.000###','myminus')), ' ')\n" + " ", ctx); try { // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "087,504.481200 087,504.481200 087,504.481200") ); } /** * * Creator: David Marston * Purpose: Test what happens to minus sign embedded in second pattern. . */ @org.junit.Test public void numberformat28() { final XQuery query = new XQuery( "format-number(2392.14*(-36.58),'000,000.000###;-###,###.000###')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-87,504.4812") ); } /** * * Creator: David Marston * Purpose: Test decimal-format output character does not influence input. . */ @org.junit.Test public void numberformat29() { final XQuery query = new XQuery( "format-number(-26931.4,'+###,###.###;_###,###.###')", ctx); try { // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "_26,931.4") ); } /** * * Creator: David Marston * Purpose: Test effects of minus-sign in one pattern. . */ @org.junit.Test public void numberformat30() { final XQuery query = new XQuery( "string-join((\n" + " format-number(-26931.4,'-###,###.###'),\n" + " format-number(-26931.4,'zzz-###,###.###','myminus'),\n" + " format-number(-26931.4,'_###,###.###','myminus')), ' ')", ctx); try { // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--26,931.4 _zzz-26,931.4 __26,931.4") ); } /** * * Creator: David Marston * Purpose: Test output of altered minus, 2 patterns but no sign marker in pattern. . */ @org.junit.Test public void numberformat31() { final XQuery query = new XQuery( "format-number(-26931.4,'###,###.###;###,###.###')", ctx); try { // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "26,931.4") ); } /** * * Creator: David Marston * Purpose: Test of format-number percent format with character being changed. . */ @org.junit.Test public void numberformat32() { final XQuery query = new XQuery( "format-number(0.4857,'###.###c')", ctx); try { // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "48.57c") ); } /** * * Creator: David Marston (modified by MHK because there are now rules on choosing a zero-digit) * Purpose: Test changing both digit and zero-digit in format string. . */ @org.junit.Test public void numberformat34() { final XQuery query = new XQuery( "format-number(4030201.0506,'#!!!,!!!,٠٠٠.٠٠٠٠٠٠0')", ctx); try { // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "#Ù¤,٠٣٠,٢٠١.٠٥٠٦٠٠0") ); } /** * * Creator: David Marston * Purpose: Test of unequal spacing of grouping-separator. . */ @org.junit.Test public void numberformat35() { final XQuery query = new XQuery( "format-number(987654321,'###,##0,00.00')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9876,543,21.00") ); } /** * * Creator: David Marston * Purpose: Test what happens when we overflow available digits on the left. . */ @org.junit.Test public void numberformat36() { final XQuery query = new XQuery( "format-number(239236.588,'00000.00')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "239236.59") ); } /** * * Creator: David Marston * Purpose: Test result pattern for infinity, unchanged. . */ @org.junit.Test public void numberformat37() { final XQuery query = new XQuery( "format-number(1 div 0e0,'###############################')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Infinity") ); } /** * * Creator: David Marston * Purpose: Test result pattern for negative infinity, unchanged. . */ @org.junit.Test public void numberformat39() { final XQuery query = new XQuery( "format-number(-1 div 0e0,'###############################')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-Infinity") ); } /** * * Creator: David Marston * Purpose: Test specification of result pattern for infinity. */ @org.junit.Test public void numberformat40() { final XQuery query = new XQuery( "format-number(-1 div 0e0,'###############################')", ctx); try { // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-huge") ); } /** * * Test format-number() applied to large numbers (test how good the rounding is) * Bug report from Pedro Christian against Saxon 7.8 * . */ @org.junit.Test public void numberformat60a() { final XQuery query = new XQuery( "format-number(1E25,'#,######')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10,000000,000000,000000,000000") ); } /** * * Test format-number() applied to large numbers (test how good the rounding is) * Bug report from Pedro Christian against Saxon 7.8 * . */ @org.junit.Test public void numberformat60b() { final XQuery query = new XQuery( "format-number(1E10,'#####################')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10000000000") ); } /** * * Test format-number() applied to large numbers (test how good the rounding is) * Bug report from Pedro Christian against Saxon 7.8 * . */ @org.junit.Test public void numberformat60c() { final XQuery query = new XQuery( "format-number(1E11,'#####################')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "100000000000") ); } /** * * Test format-number() applied to large numbers (test how good the rounding is) * Bug report from Pedro Christian against Saxon 7.8 * . */ @org.junit.Test public void numberformat60d() { final XQuery query = new XQuery( "format-number(1E12,'#####################')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1000000000000") ); } /** * * Test format-number() applied to large numbers (test how good the rounding is) * Bug report from Pedro Christian against Saxon 7.8 * . */ @org.junit.Test public void numberformat60e() { final XQuery query = new XQuery( "format-number(1E13,'#####################')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10000000000000") ); } /** * * Test format-number() applied to large numbers (test how good the rounding is) * Bug report from Pedro Christian against Saxon 7.8 * . */ @org.junit.Test public void numberformat60f() { final XQuery query = new XQuery( "format-number(1E14,'#####################')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "100000000000000") ); } /** * * Test format-number() applied to large numbers (test how good the rounding is) * Bug report from Pedro Christian against Saxon 7.8 * . */ @org.junit.Test public void numberformat60g() { final XQuery query = new XQuery( "format-number(1E15,'#####################')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1000000000000000") ); } /** * * Test format-number() applied to large numbers (test how good the rounding is) * Bug report from Pedro Christian against Saxon 7.8 * . */ @org.junit.Test public void numberformat60h() { final XQuery query = new XQuery( "format-number(1E16,'#####################')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10000000000000000") ); } /** * * Test format-number() applied to large numbers (test how good the rounding is) * Bug report from Pedro Christian against Saxon 7.8 * . */ @org.junit.Test public void numberformat60i() { final XQuery query = new XQuery( "format-number(1E17,'#####################')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "100000000000000000") ); } /** * * Test format-number() applied to large numbers (test how good the rounding is) * Bug report from Pedro Christian against Saxon 7.8 * . */ @org.junit.Test public void numberformat60j() { final XQuery query = new XQuery( "format-number(1E18,'#####################')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1000000000000000000") ); } /** * * Test format-number() applied to large numbers (test how good the rounding is) * Bug report from Pedro Christian against Saxon 7.8 * . */ @org.junit.Test public void numberformat60k() { final XQuery query = new XQuery( "format-number(1E19,'#####################')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10000000000000000000") ); } /** * * Test format-number() applied to large numbers (test how good the rounding is) * Bug report from Pedro Christian against Saxon 7.8 * . */ @org.junit.Test public void numberformat60l() { final XQuery query = new XQuery( "format-number(1E20,'#####################')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "100000000000000000000") ); } /** * * Test format-number() applied to large numbers (test how good the rounding is) * Bug report from Pedro Christian against Saxon 7.8 * . */ @org.junit.Test public void numberformat60m() { final XQuery query = new XQuery( "format-number(1E25,'#####################')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10000000000000000000000000") ); } /** * * Test format-number() applied to large numbers (test how good the rounding is) * Bug report from Pedro Christian against Saxon 7.8 * . */ @org.junit.Test public void numberformat60n() { final XQuery query = new XQuery( "format-number(1E30,'#####################')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1000000000000000000000000000000") ); } /** * * Test format-number() applied to large numbers (test how good the rounding is) * Bug report from Pedro Christian against Saxon 7.8 * . */ @org.junit.Test public void numberformat60o() { final XQuery query = new XQuery( "format-number(1E35,'#####################')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "100000000000000000000000000000000000") ); } /** * * Test format-number() applied to large numbers (test how good the rounding is) * Bug report from Pedro Christian against Saxon 7.8 * . */ @org.junit.Test public void numberformat60p() { final XQuery query = new XQuery( "format-number(1E100,'#####################')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000") ); } /** * * Test format-number() applied to large numbers (test how good the rounding is) * Bug report from Pedro Christian against Saxon 7.8 * . */ @org.junit.Test public void numberformat60q() { final XQuery query = new XQuery( "format-number(1E100 div 3,'#####################')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3333333333333333000000000000000000000000000000000000000000000000000000000000000000000000000000000000") ); } /** * * format-number() applied to an empty sequence * . */ @org.junit.Test public void numberformat61() { final XQuery query = new XQuery( "format-number((),'###.###')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * * Purpose: Test formatting of a high-precision decimal value. . */ @org.junit.Test public void numberformat63() { final XQuery query = new XQuery( "format-number(000123456789012345678901234567890.123456789012345678900000, '##0.0####################################################')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "123456789012345678901234567890.1234567890123456789") || error("FOAR0002") ) ); } /** * * Purpose: Test formatting of a high-precision integer value. . */ @org.junit.Test public void numberformat64() { final XQuery query = new XQuery( "format-number(000123456789012345678901234567890123456789012345678900000, '# #0.0####################################################')", ctx); try { // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "12 34 56 78 90 12 34 56 78 90 12 34 56 78 90 12 34 56 78 90 12 34 56 78 90 00 00.0") || error("FOAR0002") ) ); } /** * * Purpose: Test that a trailing decimalpoint is removed. * . */ @org.junit.Test public void numberformat65() { final XQuery query = new XQuery( "concat(format-number(1234e0, '0000.####'), '|',\n" + " format-number(1234.00, '0000.####'))", ctx); try { // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1234|1234") ); } /** * * Decimal separator and grouping separator in the astral planes * . */ @org.junit.Test public void numberformat70() { final XQuery query = new XQuery( "format-number(1234567890.123456,'\ud82b\uddb1000\ud82b\uddb0000')", ctx); try { // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1\ud82b\uddb1234\ud82b\uddb1567\ud82b\uddb1890\ud82b\uddb0123") ); } /** * * Use Osmanya digits (non-BMP) in formatted output * . */ @org.junit.Test public void numberformat71() { final XQuery query = new XQuery( "format-number(1234567890.123456,'##########ð’ .ð’ #####')", ctx); try { // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ð’¡ð’¢ð’£ð’¤ð’¥ð’¦ð’§ð’¨ð’©ð’ .ð’¡ð’¢ð’£ð’¤ð’¥ð’¦") ); } /** * * Check that overflow isn't an error * . */ @org.junit.Test public void numberformat72() { final XQuery query = new XQuery( "format-number(1234567890.123456,'000.000')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1234567890.123") ); } /** * * PURPOSE: test format-number() with two arguments * . */ @org.junit.Test public void numberformat80() { final XQuery query = new XQuery( "format-number(12.34, '##.##')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12.34") ); } /** * * PURPOSE: test format-number() with three arguments; also tests use of whitespace in name * . */ @org.junit.Test public void numberformat81() { final XQuery query = new XQuery( "format-number(12.34, '0.000,00', ' b:test ')", ctx); try { query.namespace("a", "http://a.ns/"); query.namespace("b", "http://a.ns/"); // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0.012,34") ); } /** * * PURPOSE: test format-number() where third argument is not known statically * . */ @org.junit.Test public void numberformat82() { final XQuery query = new XQuery( "format-number(12.34, '0.000,00', if (current-date() gt xs:date('1900-01-01')) then 'two' else 'one')", ctx); try { // decimal format // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0.012,34") ); } /** * * PURPOSE: test format-number() where third argument is not known statically and depends on namespace context; * also tests use of whitespace in name * . */ @org.junit.Test public void numberformat83() { final XQuery query = new XQuery( "format-number(12.34, '0.000,00', concat(if (current-date() lt xs:date('1900-01-01')) then ' a' else ' b', ':one '))", ctx); try { query.namespace("a", "http://a.ns/"); query.namespace("b", "http://b.ns/"); // decimal format // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0.012,34") ); } /** * * PURPOSE: test format-number() with grouping separator * . */ @org.junit.Test public void numberformat84() { final XQuery query = new XQuery( "format-number(123456789.34, '#,###.##')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "123,456,789.34") ); } /** * * PURPOSE: test special case of format-number() imposing minWholePartSize = 1 with different data types * . */ @org.junit.Test public void numberformat85() { final XQuery query = new XQuery( "string-join((\n" + " format-number(0, '#'),\n" + " format-number(0.0, '#'),\n" + " format-number(0.0e0, '#'),\n" + " format-number(xs:float(0), '#')), '|')\n" + " \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0|0|0|0") ); } /** * In 3.0, () allowed as third argument (bug 14931). */ @org.junit.Test public void numberformat86() { final XQuery query = new XQuery( "format-number(0.4857,'###.###%', ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "48.57%") ); } /** * * PURPOSE: test format-number() with EQName for third argument, known statically; also tests use of whitespace in name * . */ @org.junit.Test public void numberformat87() { final XQuery query = new XQuery( "format-number(12.34, '0.000,00', 'Q{http://a.ns/}test ')", ctx); try { // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0.012,34") ); } /** * * PURPOSE: test format-number() with EQName for third argument, not known statically; also tests use of whitespace in name * . */ @org.junit.Test public void numberformat88() { final XQuery query = new XQuery( "format-number(12.34, '0.000,00', if (current-date() lt xs:date('1900-01-01')) then () else ' Q{http://a.ns/}test')", ctx); try { // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0.012,34") ); } /** * * Creator: David Marston * Purpose: Create a conflict in the use of the '!' character. * . */ @org.junit.Test public void numberformat901err() { final XQuery query = new XQuery( "\n" + " declare default decimal-format decimal-separator=\"!\" grouping-separator=\"!\";\n" + " format-number(931.4857,'###!###!###')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0098") ); } /** * * Creator: Michael Kay (bug report from doerschlein) * Purpose: Test use of an illegal picture. . */ @org.junit.Test public void numberformat902err() { final XQuery query = new XQuery( "format-number(931.4857,'000.##0')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODF1310") ); } /** * * Purpose: test error condition: no digit or zero-digit in picture. . */ @org.junit.Test public void numberformat905err() { final XQuery query = new XQuery( "format-number(931.4857,'fred.ginger', 'q')", ctx); try { // decimal format result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODF1310") ); } /** * * Creator: Zhen Hua Liu * Purpose: Test wrong arg datatype inputs for format-number. . */ @org.junit.Test public void numberformat906InputErr() { final XQuery query = new XQuery( "format-number('abc','000.##0')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * Creator: Zhen Hua Liu * Purpose: Test wrong arg datatype inputs for format-number. . */ @org.junit.Test public void numberformat907InputErr() { final XQuery query = new XQuery( "format-number(931.45, 931.45)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * Creator: Zhen Hua Liu * Purpose: Test raising error FODF1280. . */ @org.junit.Test public void numberformatFODF1280() { final XQuery query = new XQuery( "format-number(931.45, '000.##0', 'foo:bar')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODF1280") ); } /** * * Creator: Zhen Hua Liu * Purpose: NaN input from number("abc"). . */ @org.junit.Test public void numberformatNaN() { final XQuery query = new XQuery( "format-number(number(\"abc\"),'#############')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnFormatTime.java000066400000000000000000000602411222453003200273050ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the format-time() function transferred from XSLT 2.0 to XPath 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnFormatTime extends QT3TestSet { /** * Test format-time: basic numeric formats. */ @org.junit.Test public void formatTime002a() { final XQuery query = new XQuery( "format-time($t,\"[H01]:[m01]\")", ctx); try { query.bind("t", new XQuery("xs:time('09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "09:15") ); } /** * Test format-time: basic numeric formats. */ @org.junit.Test public void formatTime002b() { final XQuery query = new XQuery( "format-time($t,\"[H]:[m]\")", ctx); try { query.bind("t", new XQuery("xs:time('09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9:15") ); } /** * Test format-time: basic numeric formats. */ @org.junit.Test public void formatTime002c() { final XQuery query = new XQuery( "format-time($t,\"[H01]:[m01]:[s01]\")", ctx); try { query.bind("t", new XQuery("xs:time('09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "09:15:06") ); } /** * Test format-time: basic numeric formats. */ @org.junit.Test public void formatTime002d() { final XQuery query = new XQuery( "format-time($t,\"[H]:[m]:[s]\")", ctx); try { query.bind("t", new XQuery("xs:time('09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9:15:06") ); } /** * Test format-time: basic numeric formats. */ @org.junit.Test public void formatTime002e() { final XQuery query = new XQuery( "format-time($t,\"[H]:[m]:[s1]\")", ctx); try { query.bind("t", new XQuery("xs:time('09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9:15:6") ); } /** * Test format-time: basic numeric formats. */ @org.junit.Test public void formatTime002f() { final XQuery query = new XQuery( "format-time($t,\"[H]:[m]:[s01]:[f001]\")", ctx); try { query.bind("t", new XQuery("xs:time('09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9:15:06:456") ); } /** * Test format-time: basic numeric formats. */ @org.junit.Test public void formatTime002g() { final XQuery query = new XQuery( "format-time($t,\"[H]:[m]:[s].[f,1-1]\")", ctx); try { query.bind("t", new XQuery("xs:time('09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9:15:06.5") ); } /** * Test format-time: basic numeric formats. */ @org.junit.Test public void formatTime002h() { final XQuery query = new XQuery( "format-time($t,\"[H]:[m]:[s].[f1,1-1]\")", ctx); try { query.bind("t", new XQuery("xs:time('09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9:15:06.5") ); } /** * Test format-time: basic numeric formats. */ @org.junit.Test public void formatTime002i() { final XQuery query = new XQuery( "format-time($t,\"[H]:[m]:[s].[f01]\")", ctx); try { query.bind("t", new XQuery("xs:time('09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9:15:06.46") ); } /** * Test format-time: basic numeric formats. */ @org.junit.Test public void formatTime002j() { final XQuery query = new XQuery( "format-time($t,\"[H]:[m]:[s].[f001]\")", ctx); try { query.bind("t", new XQuery("xs:time('09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9:15:06.456") ); } /** * Test format-time: 12-hour clock. */ @org.junit.Test public void formatTime004() { final XQuery query = new XQuery( "\n" + " for $i in 1 to 24 return\n" + " format-time($t + xs:dayTimeDuration('PT1H')*$i, '[h].[m]')", ctx); try { query.bind("t", new XQuery("xs:time('09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n 10.15 11.15 12.15 1.15 2.15 3.15 4.15 5.15 6.15 7.15 8.15 9.15 10.15 11.15 \n 12.15 1.15 2.15 3.15 4.15 5.15 6.15 7.15 8.15 9.15\n ") ); } /** * test format-time(): effect of width specifiers . */ @org.junit.Test public void formatTime013n() { final XQuery query = new XQuery( "format-time($t, '[m,3]')", ctx); try { query.bind("t", new XQuery("xs:time('09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "015") ); } /** * test format-time(): effect of width specifiers . */ @org.junit.Test public void formatTime013p() { final XQuery query = new XQuery( "format-time($t, '[f,4-4]')", ctx); try { query.bind("t", new XQuery("xs:time('09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4560") ); } /** * test format-time(): effect of width specifiers . */ @org.junit.Test public void formatTime013q() { final XQuery query = new XQuery( "format-time($t, '[f,1-4]')", ctx); try { query.bind("t", new XQuery("xs:time('09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "456") ); } /** * test format-time(): effect of width specifiers . */ @org.junit.Test public void formatTime013r() { final XQuery query = new XQuery( "format-time($t, '[f,2-5]')", ctx); try { query.bind("t", new XQuery("xs:time('09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "456") ); } /** * test format-time(): effect of width specifiers . */ @org.junit.Test public void formatTime013s() { final XQuery query = new XQuery( "format-time($t, '[f,2-2]')", ctx); try { query.bind("t", new XQuery("xs:time('09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "46") ); } /** * test format-time(): effect of width specifiers . */ @org.junit.Test public void formatTime013t() { final XQuery query = new XQuery( "format-time($t, '[f,1-*]')", ctx); try { query.bind("t", new XQuery("xs:time('09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "456") ); } /** * test format-time(): effect of width specifiers . */ @org.junit.Test public void formatTime013u() { final XQuery query = new XQuery( "format-time($t, '[f,*-2]')", ctx); try { query.bind("t", new XQuery("xs:time('09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "46") ); } /** * test format-time(): effect of width specifiers . */ @org.junit.Test public void formatTime013v() { final XQuery query = new XQuery( "format-time($t, '[f,3]')", ctx); try { query.bind("t", new XQuery("xs:time('09:15:06.456')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "456") ); } /** * test format-time(): timezones in +nn:nn notation. */ @org.junit.Test public void formatTime014() { final XQuery query = new XQuery( "string-join(\n" + " for $z in -28 to +28\n" + " return format-time(adjust-time-to-timezone(\n" + " $t, $z*xs:dayTimeDuration('PT30M')), '[h01][m01][Z]'), '; ')", ctx); try { query.bind("t", new XQuery("xs:time('09:15:06.456Z')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n 0715-14:00; 0745-13:30; 0815-13:00; 0845-12:30; 0915-12:00; 0945-11:30; 1015-11:00; 1045-10:30; 1115-10:00; \n 1145-09:30; 1215-09:00; 1245-08:30; 0115-08:00; 0145-07:30; 0215-07:00; 0245-06:30; 0315-06:00; 0345-05:30; \n 0415-05:00; 0445-04:30; 0515-04:00; 0545-03:30; 0615-03:00; 0645-02:30; 0715-02:00; 0745-01:30; 0815-01:00; \n 0845-00:30; 0915+00:00; 0945+00:30; 1015+01:00; 1045+01:30; 1115+02:00; 1145+02:30; 1215+03:00; 1245+03:30;\n 0115+04:00; 0145+04:30; 0215+05:00; 0245+05:30; 0315+06:00; 0345+06:30; 0415+07:00; 0445+07:30; 0515+08:00; \n 0545+08:30; 0615+09:00; 0645+09:30; 0715+10:00; 0745+10:30; 0815+11:00; 0845+11:30; 0915+12:00; 0945+12:30; \n 1015+13:00; 1045+13:30; 1115+14:00\n ") ); } /** * test format-time(): timezones in GMT+x notation. */ @org.junit.Test public void formatTime015() { final XQuery query = new XQuery( "string-join(\n" + " for $z in -28 to +28\n" + " return format-time(adjust-time-to-timezone(\n" + " $t, $z*xs:dayTimeDuration('PT30M')), '[h01][m01][z]'), '; ')", ctx); try { query.bind("t", new XQuery("xs:time('09:15:06.456Z')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n 0715GMT-14:00; 0745GMT-13:30; 0815GMT-13:00; 0845GMT-12:30; 0915GMT-12:00; 0945GMT-11:30; 1015GMT-11:00; 1045GMT-10:30;\n 1115GMT-10:00; 1145GMT-09:30; 1215GMT-09:00; 1245GMT-08:30; 0115GMT-08:00; 0145GMT-07:30; 0215GMT-07:00; 0245GMT-06:30;\n 0315GMT-06:00; 0345GMT-05:30; 0415GMT-05:00; 0445GMT-04:30; 0515GMT-04:00; 0545GMT-03:30; 0615GMT-03:00; 0645GMT-02:30;\n 0715GMT-02:00; 0745GMT-01:30; 0815GMT-01:00; 0845GMT-00:30; 0915GMT+00:00; 0945GMT+00:30; 1015GMT+01:00; 1045GMT+01:30; 1115GMT+02:00;\n 1145GMT+02:30; 1215GMT+03:00; 1245GMT+03:30; 0115GMT+04:00; 0145GMT+04:30; 0215GMT+05:00; 0245GMT+05:30; 0315GMT+06:00;\n 0345GMT+06:30; 0415GMT+07:00; 0445GMT+07:30; 0515GMT+08:00; 0545GMT+08:30; 0615GMT+09:00; 0645GMT+09:30; 0715GMT+10:00;\n 0745GMT+10:30; 0815GMT+11:00; 0845GMT+11:30; 0915GMT+12:00; 0945GMT+12:30; 1015GMT+13:00; 1045GMT+13:30;\n 1115GMT+14:00\n ") ); } /** * test format-time(): timezones in GMT+x notation. */ @org.junit.Test public void formatTime016() { final XQuery query = new XQuery( "string-join(\n" + " for $z in -28 to +28\n" + " return format-time(adjust-time-to-timezone(\n" + " $t, $z*xs:dayTimeDuration('PT30M')), '[h01][m01][z,6-6]'), '; ')", ctx); try { query.bind("t", new XQuery("xs:time('09:15:06.456Z')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n 0715GMT-14:00; 0745GMT-13:30; 0815GMT-13:00; 0845GMT-12:30; 0915GMT-12:00; 0945GMT-11:30; 1015GMT-11:00; 1045GMT-10:30;\n 1115GMT-10:00; 1145GMT-09:30; 1215GMT-09:00; 1245GMT-08:30; 0115GMT-08:00; 0145GMT-07:30; 0215GMT-07:00; 0245GMT-06:30;\n 0315GMT-06:00; 0345GMT-05:30; 0415GMT-05:00; 0445GMT-04:30; 0515GMT-04:00; 0545GMT-03:30; 0615GMT-03:00; 0645GMT-02:30;\n 0715GMT-02:00; 0745GMT-01:30; 0815GMT-01:00; 0845GMT-00:30; 0915GMT+00:00; 0945GMT+00:30; 1015GMT+01:00; 1045GMT+01:30; 1115GMT+02:00;\n 1145GMT+02:30; 1215GMT+03:00; 1245GMT+03:30; 0115GMT+04:00; 0145GMT+04:30; 0215GMT+05:00; 0245GMT+05:30; 0315GMT+06:00;\n 0345GMT+06:30; 0415GMT+07:00; 0445GMT+07:30; 0515GMT+08:00; 0545GMT+08:30; 0615GMT+09:00; 0645GMT+09:30; 0715GMT+10:00;\n 0745GMT+10:30; 0815GMT+11:00; 0845GMT+11:30; 0915GMT+12:00; 0945GMT+12:30; 1015GMT+13:00; 1045GMT+13:30;\n 1115GMT+14:00\n ") ); } /** * test format-time(): timezones in GMT+x notation. */ @org.junit.Test public void formatTime017() { final XQuery query = new XQuery( "string-join(\n" + " for $z in -28 to +28\n" + " return format-time(adjust-time-to-timezone($t, $z*xs:dayTimeDuration('PT30M')), '[h01][m01][z,5-6]'), '; ')", ctx); try { query.bind("t", new XQuery("xs:time('09:15:06.456Z')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n 0715GMT-14:00; 0745GMT-13:30; 0815GMT-13:00; 0845GMT-12:30; 0915GMT-12:00; 0945GMT-11:30; 1015GMT-11:00; 1045GMT-10:30;\n 1115GMT-10:00; 1145GMT-09:30; 1215GMT-09:00; 1245GMT-08:30; 0115GMT-08:00; 0145GMT-07:30; 0215GMT-07:00; 0245GMT-06:30;\n 0315GMT-06:00; 0345GMT-05:30; 0415GMT-05:00; 0445GMT-04:30; 0515GMT-04:00; 0545GMT-03:30; 0615GMT-03:00; 0645GMT-02:30;\n 0715GMT-02:00; 0745GMT-01:30; 0815GMT-01:00; 0845GMT-00:30; 0915GMT+00:00; 0945GMT+00:30; 1015GMT+01:00; 1045GMT+01:30; 1115GMT+02:00;\n 1145GMT+02:30; 1215GMT+03:00; 1245GMT+03:30; 0115GMT+04:00; 0145GMT+04:30; 0215GMT+05:00; 0245GMT+05:30; 0315GMT+06:00;\n 0345GMT+06:30; 0415GMT+07:00; 0445GMT+07:30; 0515GMT+08:00; 0545GMT+08:30; 0615GMT+09:00; 0645GMT+09:30; 0715GMT+10:00;\n 0745GMT+10:30; 0815GMT+11:00; 0845GMT+11:30; 0915GMT+12:00; 0945GMT+12:30; 1015GMT+13:00; 1045GMT+13:30;\n 1115GMT+14:00\n ") ); } /** * test format-time(): timezones in GMT+x notation. */ @org.junit.Test public void formatTime018() { final XQuery query = new XQuery( "string-join(\n" + " for $z in -28 to +28\n" + " return format-time(adjust-time-to-timezone($t, $z*xs:dayTimeDuration('PT30M')), '[h01][m01][z,2-6]'), '; ')", ctx); try { query.bind("t", new XQuery("xs:time('09:15:06.456Z')", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n 0715GMT-14:00; 0745GMT-13:30; 0815GMT-13:00; 0845GMT-12:30; 0915GMT-12:00; 0945GMT-11:30; 1015GMT-11:00; 1045GMT-10:30;\n 1115GMT-10:00; 1145GMT-09:30; 1215GMT-09:00; 1245GMT-08:30; 0115GMT-08:00; 0145GMT-07:30; 0215GMT-07:00; 0245GMT-06:30;\n 0315GMT-06:00; 0345GMT-05:30; 0415GMT-05:00; 0445GMT-04:30; 0515GMT-04:00; 0545GMT-03:30; 0615GMT-03:00; 0645GMT-02:30;\n 0715GMT-02:00; 0745GMT-01:30; 0815GMT-01:00; 0845GMT-00:30; 0915GMT+00:00; 0945GMT+00:30; 1015GMT+01:00; 1045GMT+01:30; 1115GMT+02:00;\n 1145GMT+02:30; 1215GMT+03:00; 1245GMT+03:30; 0115GMT+04:00; 0145GMT+04:30; 0215GMT+05:00; 0245GMT+05:30; 0315GMT+06:00;\n 0345GMT+06:30; 0415GMT+07:00; 0445GMT+07:30; 0515GMT+08:00; 0545GMT+08:30; 0615GMT+09:00; 0645GMT+09:30; 0715GMT+10:00;\n 0745GMT+10:30; 0815GMT+11:00; 0845GMT+11:30; 0915GMT+12:00; 0945GMT+12:30; 1015GMT+13:00; 1045GMT+13:30;\n 1115GMT+14:00\n ") ); } /** * Error FOFD1340 syntax of picture is incorrect. */ @org.junit.Test public void formatTime1340err() { final XQuery query = new XQuery( "format-time(current-time(), '[y]', 'en', (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XTDE1340") || error("FOFD1340") ) ); } /** * Error XTDE1350 component in picture string not available in value. */ @org.junit.Test public void formatTime809err() { final XQuery query = new XQuery( "format-time(current-time(), '[Y]', 'en', (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XTDE1350") || error("FOFD1350") ) ); } /** * Error XTDE1350 component in picture string not available in value. */ @org.junit.Test public void formatTime810err() { final XQuery query = new XQuery( "format-time(current-time(), '[M]', 'en', (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XTDE1350") || error("FOFD1350") ) ); } /** * Error XTDE1350 component in picture string not available in value. */ @org.junit.Test public void formatTime811err() { final XQuery query = new XQuery( "format-time(current-time(), '[d]', 'en', (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XTDE1350") || error("FOFD1350") ) ); } /** * Error XTDE1350 component in picture string not available in value. */ @org.junit.Test public void formatTime812err() { final XQuery query = new XQuery( "format-time(current-time(), '[d]', 'en', (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XTDE1350") || error("FOFD1350") ) ); } /** * Error XTDE1350 component in picture string not available in value. */ @org.junit.Test public void formatTime813err() { final XQuery query = new XQuery( "format-time(current-time(), '[F]', 'en', (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XTDE1350") || error("FOFD1350") ) ); } /** * Error XTDE1350 component in picture string not available in value. */ @org.junit.Test public void formatTime814err() { final XQuery query = new XQuery( "format-time(current-time(), '[W]', 'en', (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XTDE1350") || error("FOFD1350") ) ); } /** * Error XTDE1350 component in picture string not available in value. */ @org.junit.Test public void formatTime815err() { final XQuery query = new XQuery( "format-time(current-time(), '[w]', 'en', (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XTDE1350") || error("FOFD1350") ) ); } /** * Error XTDE1350 component in picture string not available in value. */ @org.junit.Test public void formatTime816err() { final XQuery query = new XQuery( "format-time(current-time(), '[E]', 'en', (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XTDE1350") || error("FOFD1350") ) ); } /** * Error XTDE1340 component in picture string not available in value. */ @org.junit.Test public void formatTime817err() { final XQuery query = new XQuery( "format-time(current-time(), '[bla]', 'en', (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XTDE1340") || error("FOFD1340") ) ); } /** * wrong arg input to format-time(). */ @org.junit.Test public void formatTimeInptEr1() { final XQuery query = new XQuery( "format-time('abc', '[bla]', 'en', (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * wrong number of args to format-time(). */ @org.junit.Test public void formatTimeInptEr2() { final XQuery query = new XQuery( "format-time(current-time(), '[bla]', 'en', (), (), 6)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * wrong number of args to format-time(). */ @org.junit.Test public void formatTimeInptEr3() { final XQuery query = new XQuery( "format-time(current-time(), '[bla]', 'en', (), (), 6)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnFunctionArity.java000066400000000000000000000265611222453003200300430ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the function-arity() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnFunctionArity extends QT3TestSet { /** * Attempts to evaluate the "function-arity" function with no arguments.. */ @org.junit.Test public void fnFunctionArity001() { final XQuery query = new XQuery( "fn:function-arity()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "function-arity" function with arity zero.. */ @org.junit.Test public void fnFunctionArity002() { final XQuery query = new XQuery( "fn:function-arity#0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to evaluate the "function-arity" function with two arguments.. */ @org.junit.Test public void fnFunctionArity003() { final XQuery query = new XQuery( "fn:function-arity( fn:dateTime#2, fn:dateTime#2 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "function-arity" function with arity two.. */ @org.junit.Test public void fnFunctionArity004() { final XQuery query = new XQuery( "fn:function-arity#2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "function-arity" function with arity one.. */ @org.junit.Test public void fnFunctionArity005() { final XQuery query = new XQuery( "exists(fn:function-arity#1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "function-arity" function with the argument set as follows: $func = () . */ @org.junit.Test public void fnFunctionArity006() { final XQuery query = new XQuery( "fn:function-arity( () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluates the "function-arity" function with an argument of type xs:anyAtomicType.. */ @org.junit.Test public void fnFunctionArity007() { final XQuery query = new XQuery( "fn:function-arity( 1 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluates the "function-arity" function with an argument of type node().. */ @org.junit.Test public void fnFunctionArity008() { final XQuery query = new XQuery( "fn:function-arity( fn:analyze-string((), \"unused\") )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the type checking of the argument.. */ @org.junit.Test public void fnFunctionArity009() { final XQuery query = new XQuery( "fn:function-arity( (fn:concat#2, fn:concat#3) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the type checking of the argument.. */ @org.junit.Test public void fnFunctionArity011() { final XQuery query = new XQuery( "( fn:function-arity( if (current-date() eq xs:date('1900-01-01'))\n" + " then fn:dateTime#2\n" + " else 1 ),\n" + " fn:function-arity( if (current-date() eq xs:date('1900-01-01'))\n" + " then 1\n" + " else fn:dateTime#2 ) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the type checking of the argument.. */ @org.junit.Test public void fnFunctionArity013() { final XQuery query = new XQuery( "( fn:function-arity( if (current-date() eq xs:date('1900-01-01'))\n" + " then fn:dateTime#2\n" + " else () ),\n" + " fn:function-arity( if (current-date() eq xs:date('1900-01-01'))\n" + " then ()\n" + " else fn:dateTime#2 ) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the return type of the "function-arity" function.. */ @org.junit.Test public void fnFunctionArity014() { final XQuery query = new XQuery( "fn:function-arity( fn:substring#2 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:integer") ); } /** * Evaluates the "function-arity" function with the argument set as follows: $func = fn:dateTime#2 . */ @org.junit.Test public void fnFunctionArity015() { final XQuery query = new XQuery( "fn:function-arity( fn:dateTime#2 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Evaluates the "function-arity" function with the argument set as follows: $func = fn:concat#99 . */ @org.junit.Test public void fnFunctionArity016() { final XQuery query = new XQuery( "fn:function-arity( fn:concat#99 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "99") ); } /** * Evaluates the "function-arity" function with the argument set as follows: $func = fn:concat#340282366920938463463374607431768211456. */ @org.junit.Test public void fnFunctionArity017() { final XQuery query = new XQuery( "fn:function-arity( fn:concat#340282366920938463463374607431768211456 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FOAR0002") || assertStringValue(false, "340282366920938463463374607431768211456") ) ); } /** * Evaluates the "function-arity" function with the argument set as follows: function($node){name($node)} . */ @org.junit.Test public void fnFunctionArity018() { final XQuery query = new XQuery( "fn:function-arity( function($node){name($node)} )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates the "function-arity" function with the argument set as follows: function($arg1, $arg2){subsequence($arg1, $arg2, 1)} . */ @org.junit.Test public void fnFunctionArity019() { final XQuery query = new XQuery( "fn:function-arity( function($arg1, $arg2)\n" + " { subsequence($arg1, $arg2, 1) } )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Evaluates the "function-arity" function with the argument refereing to a partial function application.. */ @org.junit.Test public void fnFunctionArity020() { final XQuery query = new XQuery( "let $initial := fn:substring(?, 1, 1) \n" + " return fn:function-arity( $initial )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates the "function-arity" function with the argument refereing to a partial function application.. */ @org.junit.Test public void fnFunctionArity021() { final XQuery query = new XQuery( "fn:function-arity( math:pow(?, 10) )", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates the "function-arity" function with the argument refereing a global user-defined function.. */ @org.junit.Test public void fnFunctionArity022() { final XQuery query = new XQuery( "\n" + "\tdeclare function local:add($arg1, $arg2, $arg3)\n" + " {\n" + " $arg1 + $arg2 + $arg3\n" + " };\n" + "\n" + "\tfn:function-arity( local:add#3 )\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Evaluates the "function-arity" function with the argument refereing a partial application of a global user-defined function.. */ @org.junit.Test public void fnFunctionArity023() { final XQuery query = new XQuery( "\n" + "\tdeclare function local:add($arg1, $arg2, $arg3)\n" + " {\n" + " $arg1 + $arg2 + $arg3\n" + " };\n" + "\n" + "\tfn:function-arity( local:add(1, 2, ?) )\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnFunctionLookup.java000066400000000000000000011000521222453003200302110ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the fn:function-lookup() function introduced in XPath 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnFunctionLookup extends QT3TestSet { /** * Attempts to look up function fn:node-name.. */ @org.junit.Test public void fnFunctionLookup001() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'node-name'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:node-name.. */ @org.junit.Test public void fnFunctionLookup002() { final XQuery query = new XQuery( "/root/function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'node-name'), 0)()", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "root") ); } /** * Attempts to look up function fn:node-name.. */ @org.junit.Test public void fnFunctionLookup003() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'node-name'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:node-name.. */ @org.junit.Test public void fnFunctionLookup004() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'node-name'), 1)(/root)", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "root") ); } /** * Attempts to look up function fn:nilled.. */ @org.junit.Test public void fnFunctionLookup005() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'nilled'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:nilled.. */ @org.junit.Test public void fnFunctionLookup006() { final XQuery query = new XQuery( "/root/function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'nilled'), 0)()", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "false") ); } /** * Attempts to look up function fn:nilled.. */ @org.junit.Test public void fnFunctionLookup007() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'nilled'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:nilled.. */ @org.junit.Test public void fnFunctionLookup008() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'nilled'), 1)(/root)", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "false") ); } /** * Attempts to look up function fn:string.. */ @org.junit.Test public void fnFunctionLookup009() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'string'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:string.. */ @org.junit.Test public void fnFunctionLookup010() { final XQuery query = new XQuery( "/root/child/function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'string'), 0)()", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:string.. */ @org.junit.Test public void fnFunctionLookup011() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'string'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:string.. */ @org.junit.Test public void fnFunctionLookup012() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'string'), 1)(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:data.. */ @org.junit.Test public void fnFunctionLookup013() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'data'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:data.. */ @org.junit.Test public void fnFunctionLookup014() { final XQuery query = new XQuery( "/root/child/function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'data'), 0)()", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:data.. */ @org.junit.Test public void fnFunctionLookup015() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'data'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:data.. */ @org.junit.Test public void fnFunctionLookup016() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'data'), 1)(/root/child[1])", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:base-uri.. */ @org.junit.Test public void fnFunctionLookup017() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'base-uri'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:base-uri.. */ @org.junit.Test public void fnFunctionLookup018() { final XQuery query = new XQuery( "/root/function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'base-uri'), 0)()", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.w3.org/fots/fn/function-lookup/function-lookup.xml") ); } /** * Attempts to look up function fn:base-uri.. */ @org.junit.Test public void fnFunctionLookup019() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'base-uri'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:base-uri.. */ @org.junit.Test public void fnFunctionLookup020() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'base-uri'), 1)(/)", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.w3.org/fots/fn/function-lookup/function-lookup.xml") ); } /** * Attempts to look up function fn:document-uri.. */ @org.junit.Test public void fnFunctionLookup021() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'document-uri'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:document-uri.. */ @org.junit.Test public void fnFunctionLookup022() { final XQuery query = new XQuery( "/function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'document-uri'), 0)()", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.w3.org/fots/fn/function-lookup/function-lookup.xml") ); } /** * Attempts to look up function fn:document-uri.. */ @org.junit.Test public void fnFunctionLookup023() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'document-uri'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:document-uri.. */ @org.junit.Test public void fnFunctionLookup024() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'document-uri'), 1)(/)", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.w3.org/fots/fn/function-lookup/function-lookup.xml") ); } /** * Attempts to look up function fn:error.. */ @org.junit.Test public void fnFunctionLookup025() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'error'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:error.. */ @org.junit.Test public void fnFunctionLookup026() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'error'), 0)()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * Attempts to look up function fn:error.. */ @org.junit.Test public void fnFunctionLookup027() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'error'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:error.. */ @org.junit.Test public void fnFunctionLookup028() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'error'), 1)(fn:QName('http://www.w3.org/2005/xqt-errors', 'foo:XXXX0000'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XXXX0000") ); } /** * Attempts to look up function fn:error.. */ @org.junit.Test public void fnFunctionLookup029() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'error'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:error.. */ @org.junit.Test public void fnFunctionLookup030() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'error'), 2)(fn:QName('http://www.w3.org/2005/xqt-errors', 'foo:XXXX0000'), 'string')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XXXX0000") ); } /** * Attempts to look up function fn:error.. */ @org.junit.Test public void fnFunctionLookup031() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'error'), 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:error.. */ @org.junit.Test public void fnFunctionLookup032() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'error'), 3)(fn:QName('http://www.w3.org/2005/xqt-errors', 'foo:XXXX0000'), 'string', (1, true()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XXXX0000") ); } /** * Attempts to look up function fn:trace.. */ @org.junit.Test public void fnFunctionLookup033() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'trace'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:trace.. */ @org.junit.Test public void fnFunctionLookup034() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'trace'), 2)(1, 'label')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:abs.. */ @org.junit.Test public void fnFunctionLookup035() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'abs'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:abs.. */ @org.junit.Test public void fnFunctionLookup036() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'abs'), 1)(-1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:ceiling.. */ @org.junit.Test public void fnFunctionLookup037() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'ceiling'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:ceiling.. */ @org.junit.Test public void fnFunctionLookup038() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'ceiling'), 1)(0.9)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:floor.. */ @org.junit.Test public void fnFunctionLookup039() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'floor'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:floor.. */ @org.junit.Test public void fnFunctionLookup040() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'floor'), 1)(1.1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:round.. */ @org.junit.Test public void fnFunctionLookup041() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'round'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:round.. */ @org.junit.Test public void fnFunctionLookup042() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'round'), 1)(1.1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:round.. */ @org.junit.Test public void fnFunctionLookup043() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'round'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:round.. */ @org.junit.Test public void fnFunctionLookup044() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'round'), 2)(1.1, 0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:round-half-to-even.. */ @org.junit.Test public void fnFunctionLookup045() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'round-half-to-even'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:round-half-to-even.. */ @org.junit.Test public void fnFunctionLookup046() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'round-half-to-even'), 1)(1.1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:round-half-to-even.. */ @org.junit.Test public void fnFunctionLookup047() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'round-half-to-even'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:round-half-to-even.. */ @org.junit.Test public void fnFunctionLookup048() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'round-half-to-even'), 2)(1.1, 0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:number.. */ @org.junit.Test public void fnFunctionLookup049() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'number'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:number.. */ @org.junit.Test public void fnFunctionLookup050() { final XQuery query = new XQuery( "/root/child/function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'number'), 0)()", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:number.. */ @org.junit.Test public void fnFunctionLookup051() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'number'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:number.. */ @org.junit.Test public void fnFunctionLookup052() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'number'), 1)('1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:format-integer.. */ @org.junit.Test public void fnFunctionLookup053() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'format-integer'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:format-integer.. */ @org.junit.Test public void fnFunctionLookup054() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'format-integer'), 2)(1, '0')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:format-integer.. */ @org.junit.Test public void fnFunctionLookup055() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'format-integer'), 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:format-integer.. */ @org.junit.Test public void fnFunctionLookup056() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'format-integer'), 3)(1, '0', 'en')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:format-number.. */ @org.junit.Test public void fnFunctionLookup057() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'format-number'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:format-number.. */ @org.junit.Test public void fnFunctionLookup058() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'format-number'), 2)(1, '0')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:format-number.. */ @org.junit.Test public void fnFunctionLookup059() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'format-number'), 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:format-number.. */ @org.junit.Test public void fnFunctionLookup060() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'format-number'), 3)(1, '0', ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function math:pi.. */ @org.junit.Test public void fnFunctionLookup061() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'pi'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function math:pi.. */ @org.junit.Test public void fnFunctionLookup062() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'pi'), 0)()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3.141592653589793") ); } /** * Attempts to look up function math:exp.. */ @org.junit.Test public void fnFunctionLookup063() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'exp'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function math:exp.. */ @org.junit.Test public void fnFunctionLookup064() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'exp'), 1)(1e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("abs($result - 2.71828182845) lt 1e-10") ); } /** * Attempts to look up function math:exp10.. */ @org.junit.Test public void fnFunctionLookup065() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'exp10'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function math:exp10.. */ @org.junit.Test public void fnFunctionLookup066() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'exp10'), 1)(1e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10") ); } /** * Attempts to look up function math:log.. */ @org.junit.Test public void fnFunctionLookup067() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'log'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function math:log.. */ @org.junit.Test public void fnFunctionLookup068() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'log'), 1)(1e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Attempts to look up function math:log10.. */ @org.junit.Test public void fnFunctionLookup069() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'log10'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function math:log10.. */ @org.junit.Test public void fnFunctionLookup070() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'log10'), 1)(1e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Attempts to look up function math:pow.. */ @org.junit.Test public void fnFunctionLookup071() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'pow'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function math:pow.. */ @org.junit.Test public void fnFunctionLookup072() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'pow'), 2)(1e0, 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function math:sqrt.. */ @org.junit.Test public void fnFunctionLookup073() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'sqrt'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function math:sqrt.. */ @org.junit.Test public void fnFunctionLookup074() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'sqrt'), 1)(1e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function math:sin.. */ @org.junit.Test public void fnFunctionLookup075() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'sin'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function math:sin.. */ @org.junit.Test public void fnFunctionLookup076() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'sin'), 1)(1e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0.8414709848078965") ); } /** * Attempts to look up function math:cos.. */ @org.junit.Test public void fnFunctionLookup077() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'cos'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function math:cos.. */ @org.junit.Test public void fnFunctionLookup078() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'cos'), 1)(1e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0.5403023058681398") ); } /** * Attempts to look up function math:tan.. */ @org.junit.Test public void fnFunctionLookup079() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'tan'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function math:tan.. */ @org.junit.Test public void fnFunctionLookup080() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'tan'), 1)(1e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.5574077246549023") ); } /** * Attempts to look up function math:asin.. */ @org.junit.Test public void fnFunctionLookup081() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'asin'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function math:asin.. */ @org.junit.Test public void fnFunctionLookup082() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'asin'), 1)(1e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.5707963267948966") ); } /** * Attempts to look up function math:acos.. */ @org.junit.Test public void fnFunctionLookup083() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'acos'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function math:acos.. */ @org.junit.Test public void fnFunctionLookup084() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'acos'), 1)(1e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Attempts to look up function math:atan.. */ @org.junit.Test public void fnFunctionLookup085() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'atan'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function math:atan.. */ @org.junit.Test public void fnFunctionLookup086() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'atan'), 1)(1e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0.7853981633974483") ); } /** * Attempts to look up function math:atan2.. */ @org.junit.Test public void fnFunctionLookup087() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'atan2'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function math:atan2.. */ @org.junit.Test public void fnFunctionLookup088() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions/math', 'atan2'), 2)(1e0, 1e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0.7853981633974483") ); } /** * Attempts to look up function fn:codepoints-to-string.. */ @org.junit.Test public void fnFunctionLookup089() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'codepoints-to-string'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:codepoints-to-string.. */ @org.junit.Test public void fnFunctionLookup090() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'codepoints-to-string'), 1)((65, 66))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "AB") ); } /** * Attempts to look up function fn:string-to-codepoints.. */ @org.junit.Test public void fnFunctionLookup091() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'string-to-codepoints'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:string-to-codepoints.. */ @org.junit.Test public void fnFunctionLookup092() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'string-to-codepoints'), 1)('A')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "65") ); } /** * Attempts to look up function fn:compare.. */ @org.junit.Test public void fnFunctionLookup093() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'compare'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:compare.. */ @org.junit.Test public void fnFunctionLookup094() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'compare'), 2)('string', 'string')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Attempts to look up function fn:compare.. */ @org.junit.Test public void fnFunctionLookup095() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'compare'), 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:compare.. */ @org.junit.Test public void fnFunctionLookup096() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'compare'), 3)('string', 'string', 'http://www.w3.org/2005/xpath-functions/collation/codepoint')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Attempts to look up function fn:codepoint-equal.. */ @org.junit.Test public void fnFunctionLookup097() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'codepoint-equal'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:codepoint-equal.. */ @org.junit.Test public void fnFunctionLookup098() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'codepoint-equal'), 2)('string', 'string')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to look up function fn:concat.. */ @org.junit.Test public void fnFunctionLookup099() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'concat'), 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:concat.. */ @org.junit.Test public void fnFunctionLookup100() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'concat'), 3)('a', 'bc', 'def')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcdef") ); } /** * Attempts to look up function fn:string-join.. */ @org.junit.Test public void fnFunctionLookup101() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'string-join'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:string-join.. */ @org.junit.Test public void fnFunctionLookup102() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'string-join'), 1)(('abc', 'def'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcdef") ); } /** * Attempts to look up function fn:string-join.. */ @org.junit.Test public void fnFunctionLookup103() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'string-join'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:string-join.. */ @org.junit.Test public void fnFunctionLookup104() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'string-join'), 2)(('abc', 'def'), '-')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc-def") ); } /** * Attempts to look up function fn:substring.. */ @org.junit.Test public void fnFunctionLookup105() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'substring'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:substring.. */ @org.junit.Test public void fnFunctionLookup106() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'substring'), 2)('string', 2e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "tring") ); } /** * Attempts to look up function fn:substring.. */ @org.junit.Test public void fnFunctionLookup107() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'substring'), 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:substring.. */ @org.junit.Test public void fnFunctionLookup108() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'substring'), 3)('string', 1e0, 1e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "s") ); } /** * Attempts to look up function fn:string-length.. */ @org.junit.Test public void fnFunctionLookup109() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'string-length'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:string-length.. */ @org.junit.Test public void fnFunctionLookup110() { final XQuery query = new XQuery( "/root/child/function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'string-length'), 0)()", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:string-length.. */ @org.junit.Test public void fnFunctionLookup111() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'string-length'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:string-length.. */ @org.junit.Test public void fnFunctionLookup112() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'string-length'), 1)('string')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "6") ); } /** * Attempts to look up function fn:normalize-space.. */ @org.junit.Test public void fnFunctionLookup113() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'normalize-space'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:normalize-space.. */ @org.junit.Test public void fnFunctionLookup114() { final XQuery query = new XQuery( "/root/child/function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'normalize-space'), 0)()", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:normalize-space.. */ @org.junit.Test public void fnFunctionLookup115() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'normalize-space'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:normalize-space.. */ @org.junit.Test public void fnFunctionLookup116() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'normalize-space'), 1)(' string ')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "string") ); } /** * Attempts to look up function fn:normalize-unicode.. */ @org.junit.Test public void fnFunctionLookup117() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'normalize-unicode'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:normalize-unicode.. */ @org.junit.Test public void fnFunctionLookup118() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'normalize-unicode'), 1)('string')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "string") ); } /** * Attempts to look up function fn:normalize-unicode.. */ @org.junit.Test public void fnFunctionLookup119() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'normalize-unicode'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:normalize-unicode.. */ @org.junit.Test public void fnFunctionLookup120() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'normalize-unicode'), 2)('string', 'NFC')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "string") ); } /** * Attempts to look up function fn:upper-case.. */ @org.junit.Test public void fnFunctionLookup121() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'upper-case'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:upper-case.. */ @org.junit.Test public void fnFunctionLookup122() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'upper-case'), 1)('string')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "STRING") ); } /** * Attempts to look up function fn:lower-case.. */ @org.junit.Test public void fnFunctionLookup123() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'lower-case'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:lower-case.. */ @org.junit.Test public void fnFunctionLookup124() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'lower-case'), 1)('STRING')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "string") ); } /** * Attempts to look up function fn:translate.. */ @org.junit.Test public void fnFunctionLookup125() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'translate'), 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:translate.. */ @org.junit.Test public void fnFunctionLookup126() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'translate'), 3)('string', 'i', 'o')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "strong") ); } /** * Attempts to look up function fn:contains.. */ @org.junit.Test public void fnFunctionLookup127() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'contains'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:contains.. */ @org.junit.Test public void fnFunctionLookup128() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'contains'), 2)('string', 'rin')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to look up function fn:contains.. */ @org.junit.Test public void fnFunctionLookup129() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'contains'), 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:contains.. */ @org.junit.Test public void fnFunctionLookup130() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'contains'), 3)('string', 'RIN', 'http://www.w3.org/2005/xpath-functions/collation/codepoint')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Attempts to look up function fn:starts-with.. */ @org.junit.Test public void fnFunctionLookup131() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'starts-with'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:starts-with.. */ @org.junit.Test public void fnFunctionLookup132() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'starts-with'), 2)('string', 'str')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to look up function fn:starts-with.. */ @org.junit.Test public void fnFunctionLookup133() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'starts-with'), 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:starts-with.. */ @org.junit.Test public void fnFunctionLookup134() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'starts-with'), 3)('string', 'ing', 'http://www.w3.org/2005/xpath-functions/collation/codepoint')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Attempts to look up function fn:ends-with.. */ @org.junit.Test public void fnFunctionLookup135() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'ends-with'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:ends-with.. */ @org.junit.Test public void fnFunctionLookup136() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'ends-with'), 2)('string', 'ing')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to look up function fn:ends-with.. */ @org.junit.Test public void fnFunctionLookup137() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'ends-with'), 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:ends-with.. */ @org.junit.Test public void fnFunctionLookup138() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'ends-with'), 3)('string', 'str', 'http://www.w3.org/2005/xpath-functions/collation/codepoint')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Attempts to look up function fn:substring-before.. */ @org.junit.Test public void fnFunctionLookup139() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'substring-before'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:substring-before.. */ @org.junit.Test public void fnFunctionLookup140() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'substring-before'), 2)('string', 'ing')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "str") ); } /** * Attempts to look up function fn:substring-before.. */ @org.junit.Test public void fnFunctionLookup141() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'substring-before'), 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:substring-before.. */ @org.junit.Test public void fnFunctionLookup142() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'substring-before'), 3)('string', 'ing', 'http://www.w3.org/2005/xpath-functions/collation/codepoint')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "str") ); } /** * Attempts to look up function fn:substring-after.. */ @org.junit.Test public void fnFunctionLookup143() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'substring-after'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:substring-after.. */ @org.junit.Test public void fnFunctionLookup144() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'substring-after'), 2)('string', 'str')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ing") ); } /** * Attempts to look up function fn:substring-after.. */ @org.junit.Test public void fnFunctionLookup145() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'substring-after'), 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:substring-after.. */ @org.junit.Test public void fnFunctionLookup146() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'substring-after'), 3)('string', 'str', 'http://www.w3.org/2005/xpath-functions/collation/codepoint')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ing") ); } /** * Attempts to look up function fn:matches.. */ @org.junit.Test public void fnFunctionLookup147() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'matches'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:matches.. */ @org.junit.Test public void fnFunctionLookup148() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'matches'), 2)('string', 'string')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to look up function fn:matches.. */ @org.junit.Test public void fnFunctionLookup149() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'matches'), 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:matches.. */ @org.junit.Test public void fnFunctionLookup150() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'matches'), 3)('string', 'STRING', 'i')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to look up function fn:replace.. */ @org.junit.Test public void fnFunctionLookup151() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'replace'), 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:replace.. */ @org.junit.Test public void fnFunctionLookup152() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'replace'), 3)('string', 'i', 'o')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "strong") ); } /** * Attempts to look up function fn:replace.. */ @org.junit.Test public void fnFunctionLookup153() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'replace'), 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:replace.. */ @org.junit.Test public void fnFunctionLookup154() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'replace'), 4)('string', 'I', 'o', 'i')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "strong") ); } /** * Attempts to look up function fn:tokenize.. */ @org.junit.Test public void fnFunctionLookup155() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'tokenize'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:tokenize.. */ @org.junit.Test public void fnFunctionLookup156() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'tokenize'), 2)('string', 'i')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "str ng") ); } /** * Attempts to look up function fn:tokenize.. */ @org.junit.Test public void fnFunctionLookup157() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'tokenize'), 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:tokenize.. */ @org.junit.Test public void fnFunctionLookup158() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'tokenize'), 3)('string', 'i', 'i')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "str ng") ); } /** * Attempts to look up function fn:analyze-string.. */ @org.junit.Test public void fnFunctionLookup159() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'analyze-string'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:analyze-string.. */ @org.junit.Test public void fnFunctionLookup160() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'analyze-string'), 2)('', 'abc')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", true) ); } /** * Attempts to look up function fn:analyze-string.. */ @org.junit.Test public void fnFunctionLookup161() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'analyze-string'), 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:analyze-string.. */ @org.junit.Test public void fnFunctionLookup162() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'analyze-string'), 3)('', 'abc', 'i')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", true) ); } /** * Attempts to look up function fn:resolve-uri.. */ @org.junit.Test public void fnFunctionLookup163() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'resolve-uri'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:resolve-uri.. */ @org.junit.Test public void fnFunctionLookup164() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'resolve-uri'), 1)('http://www.w3.org/2005/xpath-functions')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:anyURI") ); } /** * Attempts to look up function fn:resolve-uri.. */ @org.junit.Test public void fnFunctionLookup165() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'resolve-uri'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:resolve-uri.. */ @org.junit.Test public void fnFunctionLookup166() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'resolve-uri'), 2)('/2005/xpath-functions', 'http://www.w3.org/')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.w3.org/2005/xpath-functions") ); } /** * Attempts to look up function fn:encode-for-uri.. */ @org.junit.Test public void fnFunctionLookup167() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'encode-for-uri'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:encode-for-uri.. */ @org.junit.Test public void fnFunctionLookup168() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'encode-for-uri'), 1)(' ')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "%20") ); } /** * Attempts to look up function fn:iri-to-uri.. */ @org.junit.Test public void fnFunctionLookup169() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'iri-to-uri'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:iri-to-uri.. */ @org.junit.Test public void fnFunctionLookup170() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'iri-to-uri'), 1)('http://www.example.com/')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/") ); } /** * Attempts to look up function fn:escape-html-uri.. */ @org.junit.Test public void fnFunctionLookup171() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'escape-html-uri'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:escape-html-uri.. */ @org.junit.Test public void fnFunctionLookup172() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'escape-html-uri'), 1)('http://www.example.com/')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/") ); } /** * Attempts to look up function fn:true.. */ @org.junit.Test public void fnFunctionLookup173() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'true'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:true.. */ @org.junit.Test public void fnFunctionLookup174() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'true'), 0)()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to look up function fn:false.. */ @org.junit.Test public void fnFunctionLookup175() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'false'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:false.. */ @org.junit.Test public void fnFunctionLookup176() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'false'), 0)()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Attempts to look up function fn:boolean.. */ @org.junit.Test public void fnFunctionLookup177() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'boolean'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:boolean.. */ @org.junit.Test public void fnFunctionLookup178() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'boolean'), 1)(\"string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to look up function fn:not.. */ @org.junit.Test public void fnFunctionLookup179() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'not'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:not.. */ @org.junit.Test public void fnFunctionLookup180() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'not'), 1)(\"string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Attempts to look up function fn:years-from-duration.. */ @org.junit.Test public void fnFunctionLookup181() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'years-from-duration'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:years-from-duration.. */ @org.junit.Test public void fnFunctionLookup182() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'years-from-duration'), 1)(xs:yearMonthDuration(\"P20Y15M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "21") ); } /** * Attempts to look up function fn:months-from-duration.. */ @org.junit.Test public void fnFunctionLookup183() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'months-from-duration'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:months-from-duration.. */ @org.junit.Test public void fnFunctionLookup184() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'months-from-duration'), 1)(xs:yearMonthDuration(\"P20Y15M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Attempts to look up function fn:days-from-duration.. */ @org.junit.Test public void fnFunctionLookup185() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'days-from-duration'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:days-from-duration.. */ @org.junit.Test public void fnFunctionLookup186() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'days-from-duration'), 1)(xs:dayTimeDuration(\"P3DT10H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Attempts to look up function fn:hours-from-duration.. */ @org.junit.Test public void fnFunctionLookup187() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'hours-from-duration'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:hours-from-duration.. */ @org.junit.Test public void fnFunctionLookup188() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'hours-from-duration'), 1)(xs:dayTimeDuration(\"P3DT10H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10") ); } /** * Attempts to look up function fn:minutes-from-duration.. */ @org.junit.Test public void fnFunctionLookup189() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'minutes-from-duration'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:minutes-from-duration.. */ @org.junit.Test public void fnFunctionLookup190() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'minutes-from-duration'), 1)(xs:dayTimeDuration(\"P3DT10H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Attempts to look up function fn:seconds-from-duration.. */ @org.junit.Test public void fnFunctionLookup191() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'seconds-from-duration'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:seconds-from-duration.. */ @org.junit.Test public void fnFunctionLookup192() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'seconds-from-duration'), 1)(xs:dayTimeDuration(\"P3DT10H12.5S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12.5") ); } /** * Attempts to look up function fn:dateTime.. */ @org.junit.Test public void fnFunctionLookup193() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'dateTime'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:dateTime.. */ @org.junit.Test public void fnFunctionLookup194() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'dateTime'), 2)(xs:date('2012-01-01Z'), xs:time('00:00:00Z'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2012-01-01T00:00:00Z") ); } /** * Attempts to look up function fn:year-from-dateTime.. */ @org.junit.Test public void fnFunctionLookup195() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'year-from-dateTime'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:year-from-dateTime.. */ @org.junit.Test public void fnFunctionLookup196() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'year-from-dateTime'), 1)(xs:dateTime('2012-04-03T02:01:00Z'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2012") ); } /** * Attempts to look up function fn:month-from-dateTime.. */ @org.junit.Test public void fnFunctionLookup197() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'month-from-dateTime'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:month-from-dateTime.. */ @org.junit.Test public void fnFunctionLookup198() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'month-from-dateTime'), 1)(xs:dateTime('2012-04-03T02:01:00Z'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4") ); } /** * Attempts to look up function fn:day-from-dateTime.. */ @org.junit.Test public void fnFunctionLookup199() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'day-from-dateTime'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:day-from-dateTime.. */ @org.junit.Test public void fnFunctionLookup200() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'day-from-dateTime'), 1)(xs:dateTime('2012-04-03T02:01:00Z'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Attempts to look up function fn:hours-from-dateTime.. */ @org.junit.Test public void fnFunctionLookup201() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'hours-from-dateTime'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:hours-from-dateTime.. */ @org.junit.Test public void fnFunctionLookup202() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'hours-from-dateTime'), 1)(xs:dateTime('2012-04-03T02:01:00Z'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Attempts to look up function fn:minutes-from-dateTime.. */ @org.junit.Test public void fnFunctionLookup203() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'minutes-from-dateTime'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:minutes-from-dateTime.. */ @org.junit.Test public void fnFunctionLookup204() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'minutes-from-dateTime'), 1)(xs:dateTime('2012-04-03T02:01:00Z'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:seconds-from-dateTime.. */ @org.junit.Test public void fnFunctionLookup205() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'seconds-from-dateTime'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:seconds-from-dateTime.. */ @org.junit.Test public void fnFunctionLookup206() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'seconds-from-dateTime'), 1)(xs:dateTime('2012-04-03T02:01:00Z'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Attempts to look up function fn:timezone-from-dateTime.. */ @org.junit.Test public void fnFunctionLookup207() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'timezone-from-dateTime'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:timezone-from-dateTime.. */ @org.junit.Test public void fnFunctionLookup208() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'timezone-from-dateTime'), 1)(xs:dateTime('2012-01-01T00:00:00Z'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Attempts to look up function fn:year-from-date.. */ @org.junit.Test public void fnFunctionLookup209() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'year-from-date'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:year-from-date.. */ @org.junit.Test public void fnFunctionLookup210() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'year-from-date'), 1)(xs:date('2012-02-01Z'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2012") ); } /** * Attempts to look up function fn:month-from-date.. */ @org.junit.Test public void fnFunctionLookup211() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'month-from-date'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:month-from-date.. */ @org.junit.Test public void fnFunctionLookup212() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'month-from-date'), 1)(xs:date('2012-02-01Z'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Attempts to look up function fn:day-from-date.. */ @org.junit.Test public void fnFunctionLookup213() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'day-from-date'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:day-from-date.. */ @org.junit.Test public void fnFunctionLookup214() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'day-from-date'), 1)(xs:date('2012-02-01Z'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:timezone-from-date.. */ @org.junit.Test public void fnFunctionLookup215() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'timezone-from-date'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:timezone-from-date.. */ @org.junit.Test public void fnFunctionLookup216() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'timezone-from-date'), 1)(xs:date('2012-01-01Z'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Attempts to look up function fn:hours-from-time.. */ @org.junit.Test public void fnFunctionLookup217() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'hours-from-time'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:hours-from-time.. */ @org.junit.Test public void fnFunctionLookup218() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'hours-from-time'), 1)(xs:time('02:01:00Z'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Attempts to look up function fn:minutes-from-time.. */ @org.junit.Test public void fnFunctionLookup219() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'minutes-from-time'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:minutes-from-time.. */ @org.junit.Test public void fnFunctionLookup220() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'minutes-from-time'), 1)(xs:time('02:01:00Z'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:seconds-from-time.. */ @org.junit.Test public void fnFunctionLookup221() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'seconds-from-time'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:seconds-from-time.. */ @org.junit.Test public void fnFunctionLookup222() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'seconds-from-time'), 1)(xs:time('02:01:00Z'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Attempts to look up function fn:timezone-from-time.. */ @org.junit.Test public void fnFunctionLookup223() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'timezone-from-time'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:timezone-from-time.. */ @org.junit.Test public void fnFunctionLookup224() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'timezone-from-time'), 1)(xs:time('02:01:00Z'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Attempts to look up function fn:adjust-dateTime-to-timezone.. */ @org.junit.Test public void fnFunctionLookup225() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'adjust-dateTime-to-timezone'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:adjust-dateTime-to-timezone.. */ @org.junit.Test public void fnFunctionLookup226() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'adjust-dateTime-to-timezone'), 1)(xs:dateTime('2012-01-01T00:00:00Z'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:dateTime") ); } /** * Attempts to look up function fn:adjust-dateTime-to-timezone.. */ @org.junit.Test public void fnFunctionLookup227() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'adjust-dateTime-to-timezone'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:adjust-dateTime-to-timezone.. */ @org.junit.Test public void fnFunctionLookup228() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'adjust-dateTime-to-timezone'), 2)(xs:dateTime(\"1970-01-01T00:00:00Z\"),xs:dayTimeDuration(\"-PT10H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1969-12-31T14:00:00-10:00") ); } /** * Attempts to look up function fn:adjust-date-to-timezone.. */ @org.junit.Test public void fnFunctionLookup229() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'adjust-date-to-timezone'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:adjust-date-to-timezone.. */ @org.junit.Test public void fnFunctionLookup230() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'adjust-date-to-timezone'), 1)(xs:date('2012-01-01Z'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:date") ); } /** * Attempts to look up function fn:adjust-date-to-timezone.. */ @org.junit.Test public void fnFunctionLookup231() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'adjust-date-to-timezone'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:adjust-date-to-timezone.. */ @org.junit.Test public void fnFunctionLookup232() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'adjust-date-to-timezone'), 2)(xs:date(\"1970-01-01Z\"),xs:dayTimeDuration(\"-PT10H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1969-12-31-10:00") ); } /** * Attempts to look up function fn:adjust-time-to-timezone.. */ @org.junit.Test public void fnFunctionLookup233() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'adjust-time-to-timezone'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:adjust-time-to-timezone.. */ @org.junit.Test public void fnFunctionLookup234() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'adjust-time-to-timezone'), 1)(xs:time('00:00:00Z'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:time") ); } /** * Attempts to look up function fn:adjust-time-to-timezone.. */ @org.junit.Test public void fnFunctionLookup235() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'adjust-time-to-timezone'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:adjust-time-to-timezone.. */ @org.junit.Test public void fnFunctionLookup236() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'adjust-time-to-timezone'), 2)(xs:time(\"00:00:00Z\"),xs:dayTimeDuration(\"-PT10H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "14:00:00-10:00") ); } /** * Attempts to look up function fn:format-dateTime.. */ @org.junit.Test public void fnFunctionLookup237() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'format-dateTime'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:format-dateTime.. */ @org.junit.Test public void fnFunctionLookup238() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'format-dateTime'), 2)(xs:dateTime('2012-01-01T00:00:00Z'), '[Y]')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:string") ); } /** * Attempts to look up function fn:format-dateTime.. */ @org.junit.Test public void fnFunctionLookup239() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'format-dateTime'), 5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:format-dateTime.. */ @org.junit.Test public void fnFunctionLookup240() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'format-dateTime'), 5)(xs:dateTime('2012-01-01T00:00:00Z'), '[Y]', 'en', (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2012") ); } /** * Attempts to look up function fn:format-date.. */ @org.junit.Test public void fnFunctionLookup241() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'format-date'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:format-date.. */ @org.junit.Test public void fnFunctionLookup242() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'format-date'), 2)(xs:date('2012-01-01Z'), '[Y]')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:string") ); } /** * Attempts to look up function fn:format-date.. */ @org.junit.Test public void fnFunctionLookup243() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'format-date'), 5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:format-date.. */ @org.junit.Test public void fnFunctionLookup244() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'format-date'), 5)(xs:date('2012-01-01Z'), '[Y]', 'en', (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2012") ); } /** * Attempts to look up function fn:format-time.. */ @org.junit.Test public void fnFunctionLookup245() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'format-time'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:format-time.. */ @org.junit.Test public void fnFunctionLookup246() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'format-time'), 2)(xs:time('00:00:00Z'), '[H01]')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:string") ); } /** * Attempts to look up function fn:format-time.. */ @org.junit.Test public void fnFunctionLookup247() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'format-time'), 5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:format-time.. */ @org.junit.Test public void fnFunctionLookup248() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'format-time'), 5)(xs:time('00:00:00Z'), '[H01]', 'en', (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "00") ); } /** * Attempts to look up function fn:resolve-QName.. */ @org.junit.Test public void fnFunctionLookup249() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'resolve-QName'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:resolve-QName.. */ @org.junit.Test public void fnFunctionLookup250() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'resolve-QName'), 2)('ns:local', /root/*[2])", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ns:local") ); } /** * Attempts to look up function fn:QName.. */ @org.junit.Test public void fnFunctionLookup251() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'QName'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:QName.. */ @org.junit.Test public void fnFunctionLookup252() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'QName'), 2)('http://www.example.org/', 'ns:local')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ns:local") ); } /** * Attempts to look up function fn:prefix-from-QName.. */ @org.junit.Test public void fnFunctionLookup253() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'prefix-from-QName'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:prefix-from-QName.. */ @org.junit.Test public void fnFunctionLookup254() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'prefix-from-QName'), 1)(fn:QName('http://www.example.org', 'foo:bar'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "foo") ); } /** * Attempts to look up function fn:local-name-from-QName.. */ @org.junit.Test public void fnFunctionLookup255() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'local-name-from-QName'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:local-name-from-QName.. */ @org.junit.Test public void fnFunctionLookup256() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'local-name-from-QName'), 1)(fn:QName('http://www.example.org', 'foo:bar'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "bar") ); } /** * Attempts to look up function fn:namespace-uri-from-QName.. */ @org.junit.Test public void fnFunctionLookup257() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'namespace-uri-from-QName'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:namespace-uri-from-QName.. */ @org.junit.Test public void fnFunctionLookup258() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'namespace-uri-from-QName'), 1)(fn:QName('http://www.example.org', 'foo:bar'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.org") ); } /** * Attempts to look up function fn:namespace-uri-for-prefix.. */ @org.junit.Test public void fnFunctionLookup259() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'namespace-uri-for-prefix'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:namespace-uri-for-prefix.. */ @org.junit.Test public void fnFunctionLookup260() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'namespace-uri-for-prefix'), 2)('ns', /root/*[2])", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.org/") ); } /** * Attempts to look up function fn:in-scope-prefixes.. */ @org.junit.Test public void fnFunctionLookup261() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'in-scope-prefixes'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:in-scope-prefixes.. */ @org.junit.Test public void fnFunctionLookup262() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'in-scope-prefixes'), 1)(/root)", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xml") ); } /** * Attempts to look up function fn:name.. */ @org.junit.Test public void fnFunctionLookup263() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'name'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:name.. */ @org.junit.Test public void fnFunctionLookup264() { final XQuery query = new XQuery( "/root/function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'name'), 0)()", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "root") ); } /** * Attempts to look up function fn:name.. */ @org.junit.Test public void fnFunctionLookup265() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'name'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:name.. */ @org.junit.Test public void fnFunctionLookup266() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'name'), 1)(/root)", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "root") ); } /** * Attempts to look up function fn:local-name.. */ @org.junit.Test public void fnFunctionLookup267() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'local-name'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:local-name.. */ @org.junit.Test public void fnFunctionLookup268() { final XQuery query = new XQuery( "/root/function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'local-name'), 0)()", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "root") ); } /** * Attempts to look up function fn:local-name.. */ @org.junit.Test public void fnFunctionLookup269() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'local-name'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:local-name.. */ @org.junit.Test public void fnFunctionLookup270() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'local-name'), 1)(/root)", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "root") ); } /** * Attempts to look up function fn:namespace-uri.. */ @org.junit.Test public void fnFunctionLookup271() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'namespace-uri'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:namespace-uri.. */ @org.junit.Test public void fnFunctionLookup272() { final XQuery query = new XQuery( "/root/*[2]/function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'namespace-uri'), 0)()", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.org/") ); } /** * Attempts to look up function fn:namespace-uri.. */ @org.junit.Test public void fnFunctionLookup273() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'namespace-uri'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:namespace-uri.. */ @org.junit.Test public void fnFunctionLookup274() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'namespace-uri'), 1)(/root/*[2])", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.org/") ); } /** * Attempts to look up function fn:lang.. */ @org.junit.Test public void fnFunctionLookup275() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'lang'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:lang.. */ @org.junit.Test public void fnFunctionLookup276() { final XQuery query = new XQuery( "/root/function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'lang'), 1)('en')", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Attempts to look up function fn:lang.. */ @org.junit.Test public void fnFunctionLookup277() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'lang'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:lang.. */ @org.junit.Test public void fnFunctionLookup278() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'lang'), 2)('en', /root)", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Attempts to look up function fn:root.. */ @org.junit.Test public void fnFunctionLookup279() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'root'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:root.. */ @org.junit.Test public void fnFunctionLookup280() { final XQuery query = new XQuery( "/root/function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'root'), 0)()", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("document-node()") ); } /** * Attempts to look up function fn:root.. */ @org.junit.Test public void fnFunctionLookup281() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'root'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:root.. */ @org.junit.Test public void fnFunctionLookup282() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'root'), 1)(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Attempts to look up function fn:path.. */ @org.junit.Test public void fnFunctionLookup283() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'path'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:path.. */ @org.junit.Test public void fnFunctionLookup284() { final XQuery query = new XQuery( "/function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'path'), 0)()", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "/") ); } /** * Attempts to look up function fn:path.. */ @org.junit.Test public void fnFunctionLookup285() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'path'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:path.. */ @org.junit.Test public void fnFunctionLookup286() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'path'), 1)(/)", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "/") ); } /** * Attempts to look up function fn:has-children.. */ @org.junit.Test public void fnFunctionLookup287() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'has-children'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:has-children.. */ @org.junit.Test public void fnFunctionLookup288() { final XQuery query = new XQuery( "/function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'has-children'), 0)()", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to look up function fn:has-children.. */ @org.junit.Test public void fnFunctionLookup289() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'has-children'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:has-children.. */ @org.junit.Test public void fnFunctionLookup290() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'has-children'), 1)(/)", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to look up function fn:innermost.. */ @org.junit.Test public void fnFunctionLookup291() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'innermost'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:innermost.. */ @org.junit.Test public void fnFunctionLookup292() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'innermost'), 1)(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Attempts to look up function fn:outermost.. */ @org.junit.Test public void fnFunctionLookup293() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'outermost'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:outermost.. */ @org.junit.Test public void fnFunctionLookup294() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'outermost'), 1)(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Attempts to look up function fn:empty.. */ @org.junit.Test public void fnFunctionLookup295() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'empty'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:empty.. */ @org.junit.Test public void fnFunctionLookup296() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'empty'), 1)((1, true()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Attempts to look up function fn:exists.. */ @org.junit.Test public void fnFunctionLookup297() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'exists'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:exists.. */ @org.junit.Test public void fnFunctionLookup298() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'exists'), 1)((1, true()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to look up function fn:head.. */ @org.junit.Test public void fnFunctionLookup299() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'head'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:head.. */ @org.junit.Test public void fnFunctionLookup300() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'head'), 1)((1, true()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:tail.. */ @org.junit.Test public void fnFunctionLookup301() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'tail'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:tail.. */ @org.junit.Test public void fnFunctionLookup302() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'tail'), 1)((1, true()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true") ); } /** * Attempts to look up function fn:insert-before.. */ @org.junit.Test public void fnFunctionLookup303() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'insert-before'), 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:insert-before.. */ @org.junit.Test public void fnFunctionLookup304() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'insert-before'), 3)((1, 2, 3), 2, ('a', 'b', 'c'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 a b c 2 3") ); } /** * Attempts to look up function fn:remove.. */ @org.junit.Test public void fnFunctionLookup305() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'remove'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:remove.. */ @org.junit.Test public void fnFunctionLookup306() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'remove'), 2)(('a', 'b', 'c'), 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a c") ); } /** * Attempts to look up function fn:reverse.. */ @org.junit.Test public void fnFunctionLookup307() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'reverse'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:reverse.. */ @org.junit.Test public void fnFunctionLookup308() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'reverse'), 1)(1 to 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3 2 1") ); } /** * Attempts to look up function fn:subsequence.. */ @org.junit.Test public void fnFunctionLookup309() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'subsequence'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:subsequence.. */ @org.junit.Test public void fnFunctionLookup310() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'subsequence'), 2)((1, true()), 2e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true") ); } /** * Attempts to look up function fn:subsequence.. */ @org.junit.Test public void fnFunctionLookup311() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'subsequence'), 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:subsequence.. */ @org.junit.Test public void fnFunctionLookup312() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'subsequence'), 3)((1, true()), 1e0, 1e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:unordered.. */ @org.junit.Test public void fnFunctionLookup313() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'unordered'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:unordered.. */ @org.junit.Test public void fnFunctionLookup314() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'unordered'), 1)(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:distinct-values.. */ @org.junit.Test public void fnFunctionLookup315() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'distinct-values'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:distinct-values.. */ @org.junit.Test public void fnFunctionLookup316() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'distinct-values'), 1)((1, 1, 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:distinct-values.. */ @org.junit.Test public void fnFunctionLookup317() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'distinct-values'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:distinct-values.. */ @org.junit.Test public void fnFunctionLookup318() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'distinct-values'), 2)((1, 1, 1), 'http://www.w3.org/2005/xpath-functions/collation/codepoint')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:index-of.. */ @org.junit.Test public void fnFunctionLookup319() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'index-of'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:index-of.. */ @org.junit.Test public void fnFunctionLookup320() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'index-of'), 2)((1, 'string'), 'string')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Attempts to look up function fn:index-of.. */ @org.junit.Test public void fnFunctionLookup321() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'index-of'), 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:index-of.. */ @org.junit.Test public void fnFunctionLookup322() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'index-of'), 3)((1, 'string'), 'string', 'http://www.w3.org/2005/xpath-functions/collation/codepoint')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Attempts to look up function fn:deep-equal.. */ @org.junit.Test public void fnFunctionLookup323() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'deep-equal'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:deep-equal.. */ @org.junit.Test public void fnFunctionLookup324() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'deep-equal'), 2)((1, true()), (1, true()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to look up function fn:deep-equal.. */ @org.junit.Test public void fnFunctionLookup325() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'deep-equal'), 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:deep-equal.. */ @org.junit.Test public void fnFunctionLookup326() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'deep-equal'), 3)((1, true()), (1, true()), 'http://www.w3.org/2005/xpath-functions/collation/codepoint')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to look up function fn:zero-or-one.. */ @org.junit.Test public void fnFunctionLookup327() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'zero-or-one'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:zero-or-one.. */ @org.junit.Test public void fnFunctionLookup328() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'zero-or-one'), 1)(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:one-or-more.. */ @org.junit.Test public void fnFunctionLookup329() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'one-or-more'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:one-or-more.. */ @org.junit.Test public void fnFunctionLookup330() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'one-or-more'), 1)(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:exactly-one.. */ @org.junit.Test public void fnFunctionLookup331() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'exactly-one'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:exactly-one.. */ @org.junit.Test public void fnFunctionLookup332() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'exactly-one'), 1)(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:count.. */ @org.junit.Test public void fnFunctionLookup333() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'count'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:count.. */ @org.junit.Test public void fnFunctionLookup334() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'count'), 1)((1, true()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Attempts to look up function fn:avg.. */ @org.junit.Test public void fnFunctionLookup335() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'avg'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:avg.. */ @org.junit.Test public void fnFunctionLookup336() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'avg'), 1)((1, 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Attempts to look up function fn:max.. */ @org.junit.Test public void fnFunctionLookup337() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'max'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:max.. */ @org.junit.Test public void fnFunctionLookup338() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'max'), 1)((1, 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Attempts to look up function fn:max.. */ @org.junit.Test public void fnFunctionLookup339() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'max'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:max.. */ @org.junit.Test public void fnFunctionLookup340() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'max'), 2)((1, 3), 'http://www.w3.org/2005/xpath-functions/collation/codepoint')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Attempts to look up function fn:min.. */ @org.junit.Test public void fnFunctionLookup341() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'min'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:min.. */ @org.junit.Test public void fnFunctionLookup342() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'min'), 1)((1, 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:min.. */ @org.junit.Test public void fnFunctionLookup343() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'min'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:min.. */ @org.junit.Test public void fnFunctionLookup344() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'min'), 2)((1, 3), 'http://www.w3.org/2005/xpath-functions/collation/codepoint')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:sum.. */ @org.junit.Test public void fnFunctionLookup345() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'sum'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:sum.. */ @org.junit.Test public void fnFunctionLookup346() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'sum'), 1)((1, 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Attempts to look up function fn:sum.. */ @org.junit.Test public void fnFunctionLookup347() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'sum'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:sum.. */ @org.junit.Test public void fnFunctionLookup348() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'sum'), 2)((1, 2), 0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Attempts to look up function fn:id.. */ @org.junit.Test public void fnFunctionLookup349() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'id'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:id.. */ @org.junit.Test public void fnFunctionLookup350() { final XQuery query = new XQuery( "/function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'id'), 1)(('id1', 'id2'))", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Attempts to look up function fn:id.. */ @org.junit.Test public void fnFunctionLookup351() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'id'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:id.. */ @org.junit.Test public void fnFunctionLookup352() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'id'), 2)(('id1', 'id2'), /)", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Attempts to look up function fn:element-with-id.. */ @org.junit.Test public void fnFunctionLookup353() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'element-with-id'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:element-with-id.. */ @org.junit.Test public void fnFunctionLookup354() { final XQuery query = new XQuery( "/function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'element-with-id'), 1)(('id1', 'id2'))", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Attempts to look up function fn:element-with-id.. */ @org.junit.Test public void fnFunctionLookup355() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'element-with-id'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:element-with-id.. */ @org.junit.Test public void fnFunctionLookup356() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'element-with-id'), 2)(('id1', 'id2'), /)", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Attempts to look up function fn:idref.. */ @org.junit.Test public void fnFunctionLookup357() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'idref'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:idref.. */ @org.junit.Test public void fnFunctionLookup358() { final XQuery query = new XQuery( "/function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'idref'), 1)(('id1', 'id2'))", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Attempts to look up function fn:idref.. */ @org.junit.Test public void fnFunctionLookup359() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'idref'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:idref.. */ @org.junit.Test public void fnFunctionLookup360() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'idref'), 2)(('id1', 'id2'), /)", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Attempts to look up function fn:generate-id.. */ @org.junit.Test public void fnFunctionLookup361() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'generate-id'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:generate-id.. */ @org.junit.Test public void fnFunctionLookup362() { final XQuery query = new XQuery( "/function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'generate-id'), 0)()", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:string") ); } /** * Attempts to look up function fn:generate-id.. */ @org.junit.Test public void fnFunctionLookup363() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'generate-id'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:generate-id.. */ @org.junit.Test public void fnFunctionLookup364() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'generate-id'), 1)(())", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertType("xs:string") && assertEq("\"\"") ) ); } /** * Attempts to look up function fn:doc.. */ @org.junit.Test public void fnFunctionLookup365() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'doc'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:doc.. */ @org.junit.Test public void fnFunctionLookup366() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'doc'), 1)('http://www.w3.org/fots/fn/function-lookup/function-lookup.xml')", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("document-node()") ); } /** * Attempts to look up function fn:doc-available.. */ @org.junit.Test public void fnFunctionLookup367() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'doc-available'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:doc-available.. */ @org.junit.Test public void fnFunctionLookup368() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'doc-available'), 1)('http://www.example.org/unknown-document')", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Attempts to look up function fn:collection.. */ @org.junit.Test public void fnFunctionLookup369() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'collection'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:collection.. */ @org.junit.Test public void fnFunctionLookup370() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'collection'), 0)()", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("node()+") ); } /** * Attempts to look up function fn:collection.. */ @org.junit.Test public void fnFunctionLookup371() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'collection'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:collection.. */ @org.junit.Test public void fnFunctionLookup372() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'collection'), 1)(())", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("node()+") ); } /** * Attempts to look up function fn:uri-collection.. */ @org.junit.Test public void fnFunctionLookup373() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'uri-collection'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:uri-collection.. */ @org.junit.Test public void fnFunctionLookup374() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'uri-collection'), 0)()", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:anyURI+") ); } /** * Attempts to look up function fn:uri-collection.. */ @org.junit.Test public void fnFunctionLookup375() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'uri-collection'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:uri-collection.. */ @org.junit.Test public void fnFunctionLookup376() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'uri-collection'), 1)(())", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:anyURI+") ); } /** * Attempts to look up function fn:unparsed-text.. */ @org.junit.Test public void fnFunctionLookup377() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'unparsed-text'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:unparsed-text.. */ @org.junit.Test public void fnFunctionLookup378() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'unparsed-text'), 1)('http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt')", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:string") ); } /** * Attempts to look up function fn:unparsed-text.. */ @org.junit.Test public void fnFunctionLookup379() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'unparsed-text'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:unparsed-text.. */ @org.junit.Test public void fnFunctionLookup380() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'unparsed-text'), 2)('http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt', 'utf-8')", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:string") ); } /** * Attempts to look up function fn:unparsed-text-lines.. */ @org.junit.Test public void fnFunctionLookup381() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'unparsed-text-lines'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:unparsed-text-lines.. */ @org.junit.Test public void fnFunctionLookup382() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'unparsed-text-lines'), 1)('http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt')", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:string+") ); } /** * Attempts to look up function fn:unparsed-text-lines.. */ @org.junit.Test public void fnFunctionLookup383() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'unparsed-text-lines'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:unparsed-text-lines.. */ @org.junit.Test public void fnFunctionLookup384() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'unparsed-text-lines'), 2)('http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt', 'utf-8')", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:string+") ); } /** * Attempts to look up function fn:unparsed-text-available.. */ @org.junit.Test public void fnFunctionLookup385() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'unparsed-text-available'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:unparsed-text-available.. */ @org.junit.Test public void fnFunctionLookup386() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'unparsed-text-available'), 1)('http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt')", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to look up function fn:unparsed-text-available.. */ @org.junit.Test public void fnFunctionLookup387() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'unparsed-text-available'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:unparsed-text-available.. */ @org.junit.Test public void fnFunctionLookup388() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'unparsed-text-available'), 2)('http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt', 'utf-8')", ctx); try { query.context(node(file("fn/function-lookup/function-lookup.xml"))); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt query.addCollection("", new String[] { file("fn/function-lookup/collection-1.xml"), file("fn/function-lookup/collection-2.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to look up function fn:environment-variable.. */ @org.junit.Test public void fnFunctionLookup389() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'environment-variable'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:environment-variable.. */ @org.junit.Test public void fnFunctionLookup390() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'environment-variable'), 1)('should-not-exist')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Attempts to look up function fn:available-environment-variables.. */ @org.junit.Test public void fnFunctionLookup391() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'available-environment-variables'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:available-environment-variables.. */ @org.junit.Test public void fnFunctionLookup392() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'available-environment-variables'), 0)()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:string*") ); } /** * Attempts to look up function fn:parse-xml.. */ @org.junit.Test public void fnFunctionLookup393() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'parse-xml'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:parse-xml.. */ @org.junit.Test public void fnFunctionLookup394() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'parse-xml'), 1)('')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("node()") ); } /** * Attempts to look up function fn:parse-xml-fragment.. */ @org.junit.Test public void fnFunctionLookup395() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'parse-xml-fragment'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:parse-xml-fragment.. */ @org.junit.Test public void fnFunctionLookup396() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'parse-xml-fragment'), 1)('')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("node()") ); } /** * Attempts to look up function fn:serialize.. */ @org.junit.Test public void fnFunctionLookup397() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'serialize'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:serialize.. */ @org.junit.Test public void fnFunctionLookup398() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'serialize'), 1)((1, true()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 true") ); } /** * Attempts to look up function fn:serialize.. */ @org.junit.Test public void fnFunctionLookup399() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'serialize'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:serialize.. */ @org.junit.Test public void fnFunctionLookup400() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'serialize'), 2)((1, false()), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 false") ); } /** * Attempts to look up function fn:position.. */ @org.junit.Test public void fnFunctionLookup401() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'position'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:position.. */ @org.junit.Test public void fnFunctionLookup402() { final XQuery query = new XQuery( "(2, 4, 6)!function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'position'), 0)()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3") ); } /** * Attempts to look up function fn:last.. */ @org.junit.Test public void fnFunctionLookup403() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'last'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:last.. */ @org.junit.Test public void fnFunctionLookup404() { final XQuery query = new XQuery( "(2, 4, 6)!function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'last'), 0)()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3 3 3") ); } /** * Attempts to look up function fn:current-dateTime.. */ @org.junit.Test public void fnFunctionLookup405() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'current-dateTime'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:current-dateTime.. */ @org.junit.Test public void fnFunctionLookup406() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'current-dateTime'), 0)()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:dateTime") ); } /** * Attempts to look up function fn:current-date.. */ @org.junit.Test public void fnFunctionLookup407() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'current-date'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:current-date.. */ @org.junit.Test public void fnFunctionLookup408() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'current-date'), 0)()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:date") ); } /** * Attempts to look up function fn:current-time.. */ @org.junit.Test public void fnFunctionLookup409() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'current-time'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:current-time.. */ @org.junit.Test public void fnFunctionLookup410() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'current-time'), 0)()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:time") ); } /** * Attempts to look up function fn:implicit-timezone.. */ @org.junit.Test public void fnFunctionLookup411() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'implicit-timezone'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:implicit-timezone.. */ @org.junit.Test public void fnFunctionLookup412() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'implicit-timezone'), 0)()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:dayTimeDuration") ); } /** * Attempts to look up function fn:default-collation.. */ @org.junit.Test public void fnFunctionLookup413() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'default-collation'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:default-collation.. */ @org.junit.Test public void fnFunctionLookup414() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'default-collation'), 0)()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.w3.org/2005/xpath-functions/collation/codepoint") ); } /** * Attempts to look up function fn:static-base-uri.. */ @org.junit.Test public void fnFunctionLookup415() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'static-base-uri'), 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:static-base-uri. Note that this actually returns a property of the dynamic context!. */ @org.junit.Test public void fnFunctionLookup416() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'static-base-uri'), 0)()", ctx); try { query.baseURI("http://www.example.com"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:anyURI?") ); } /** * Attempts to look up function fn:function-lookup.. */ @org.junit.Test public void fnFunctionLookup417() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'function-lookup'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:function-lookup.. */ @org.junit.Test public void fnFunctionLookup418() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'function-lookup'), 2)(fn:QName('http://www.example.org', 'foo:bar'), 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Attempts to look up function fn:function-name.. */ @org.junit.Test public void fnFunctionLookup419() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'function-name'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:function-name.. */ @org.junit.Test public void fnFunctionLookup420() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'function-name'), 1)(fn:abs#1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("fn:QName('http://www.w3.org/2005/xpath-functions', 'fn:abs')") ); } /** * Attempts to look up function fn:function-arity.. */ @org.junit.Test public void fnFunctionLookup421() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'function-arity'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:function-arity.. */ @org.junit.Test public void fnFunctionLookup422() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'function-arity'), 1)(fn:abs#1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function fn:map.. */ @org.junit.Test public void fnFunctionLookup423() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'map'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:map.. */ @org.junit.Test public void fnFunctionLookup424() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'map'), 2)(xs:int#1, (\"23\", \"29\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("(23, 29)") ); } /** * Attempts to look up function fn:filter.. */ @org.junit.Test public void fnFunctionLookup425() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'filter'), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:filter.. */ @org.junit.Test public void fnFunctionLookup426() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'filter'), 2)(function($a) {$a mod 2 = 0}, 1 to 10)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("(2, 4, 6, 8, 10)") ); } /** * Attempts to look up function fn:fold-left.. */ @org.junit.Test public void fnFunctionLookup427() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'fold-left'), 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:fold-left.. */ @org.junit.Test public void fnFunctionLookup428() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'fold-left'), 3)(fn:concat(?, \".\", ?), \"\", 1 to 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, ".1.2.3.4.5") ); } /** * Attempts to look up function fn:fold-right.. */ @org.junit.Test public void fnFunctionLookup429() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'fold-right'), 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:fold-right.. */ @org.junit.Test public void fnFunctionLookup430() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'fold-right'), 3)(fn:concat(?, \".\", ?), \"\", 1 to 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.2.3.4.5.") ); } /** * Attempts to look up function fn:map-pairs.. */ @org.junit.Test public void fnFunctionLookup431() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'map-pairs'), 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function fn:map-pairs.. */ @org.junit.Test public void fnFunctionLookup432() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'map-pairs'), 3)(concat#2, (\"a\", \"b\", \"c\"), (\"x\", \"y\", \"z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("(\"ax\", \"by\", \"cz\")") ); } /** * Attempts to look up function xs:untypedAtomic.. */ @org.junit.Test public void fnFunctionLookup433() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'untypedAtomic'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:untypedAtomic.. */ @org.junit.Test public void fnFunctionLookup434() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'untypedAtomic'), 1)('string')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "string") ); } /** * Attempts to look up function xs:dateTime.. */ @org.junit.Test public void fnFunctionLookup435() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'dateTime'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:dateTime.. */ @org.junit.Test public void fnFunctionLookup436() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'dateTime'), 1)('1970-01-02T04:05:06Z')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1970-01-02T04:05:06Z") ); } /** * Attempts to look up function xs:date.. */ @org.junit.Test public void fnFunctionLookup437() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'date'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:date.. */ @org.junit.Test public void fnFunctionLookup438() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'date'), 1)('1970-01-02Z')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1970-01-02Z") ); } /** * Attempts to look up function xs:time.. */ @org.junit.Test public void fnFunctionLookup439() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'time'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:time.. */ @org.junit.Test public void fnFunctionLookup440() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'time'), 1)('01:02:03Z')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "01:02:03Z") ); } /** * Attempts to look up function xs:duration.. */ @org.junit.Test public void fnFunctionLookup441() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'duration'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:duration.. */ @org.junit.Test public void fnFunctionLookup442() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'duration'), 1)('P5Y2M10DT15H')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P5Y2M10DT15H") ); } /** * Attempts to look up function xs:yearMonthDuration.. */ @org.junit.Test public void fnFunctionLookup443() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'yearMonthDuration'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:yearMonthDuration.. */ @org.junit.Test public void fnFunctionLookup444() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'yearMonthDuration'), 1)('P1Y')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1Y") ); } /** * Attempts to look up function xs:dayTimeDuration.. */ @org.junit.Test public void fnFunctionLookup445() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'dayTimeDuration'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:dayTimeDuration.. */ @org.junit.Test public void fnFunctionLookup446() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'dayTimeDuration'), 1)('PT15H')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT15H") ); } /** * Attempts to look up function xs:float.. */ @org.junit.Test public void fnFunctionLookup447() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'float'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:float.. */ @org.junit.Test public void fnFunctionLookup448() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'float'), 1)('1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function xs:double.. */ @org.junit.Test public void fnFunctionLookup449() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'double'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:double.. */ @org.junit.Test public void fnFunctionLookup450() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'double'), 1)('1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function xs:decimal.. */ @org.junit.Test public void fnFunctionLookup451() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'decimal'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:decimal.. */ @org.junit.Test public void fnFunctionLookup452() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'decimal'), 1)('1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function xs:integer.. */ @org.junit.Test public void fnFunctionLookup453() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'integer'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:integer.. */ @org.junit.Test public void fnFunctionLookup454() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'integer'), 1)('1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function xs:nonPositiveInteger.. */ @org.junit.Test public void fnFunctionLookup455() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'nonPositiveInteger'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:nonPositiveInteger.. */ @org.junit.Test public void fnFunctionLookup456() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'nonPositiveInteger'), 1)('-1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1") ); } /** * Attempts to look up function xs:negativeInteger.. */ @org.junit.Test public void fnFunctionLookup457() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'negativeInteger'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:negativeInteger.. */ @org.junit.Test public void fnFunctionLookup458() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'negativeInteger'), 1)('-1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1") ); } /** * Attempts to look up function xs:long.. */ @org.junit.Test public void fnFunctionLookup459() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'long'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:long.. */ @org.junit.Test public void fnFunctionLookup460() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'long'), 1)('1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function xs:int.. */ @org.junit.Test public void fnFunctionLookup461() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'int'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:int.. */ @org.junit.Test public void fnFunctionLookup462() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'int'), 1)('1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function xs:short.. */ @org.junit.Test public void fnFunctionLookup463() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'short'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:short.. */ @org.junit.Test public void fnFunctionLookup464() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'short'), 1)('1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function xs:byte.. */ @org.junit.Test public void fnFunctionLookup465() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'byte'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:byte.. */ @org.junit.Test public void fnFunctionLookup466() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'byte'), 1)('1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function xs:nonNegativeInteger.. */ @org.junit.Test public void fnFunctionLookup467() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'nonNegativeInteger'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:nonNegativeInteger.. */ @org.junit.Test public void fnFunctionLookup468() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'nonNegativeInteger'), 1)('1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function xs:unsignedLong.. */ @org.junit.Test public void fnFunctionLookup469() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'unsignedLong'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:unsignedLong.. */ @org.junit.Test public void fnFunctionLookup470() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'unsignedLong'), 1)('1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function xs:unsignedInt.. */ @org.junit.Test public void fnFunctionLookup471() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'unsignedInt'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:unsignedInt.. */ @org.junit.Test public void fnFunctionLookup472() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'unsignedInt'), 1)('1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function xs:unsignedShort.. */ @org.junit.Test public void fnFunctionLookup473() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'unsignedShort'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:unsignedShort.. */ @org.junit.Test public void fnFunctionLookup474() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'unsignedShort'), 1)('1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function xs:unsignedByte.. */ @org.junit.Test public void fnFunctionLookup475() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'unsignedByte'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:unsignedByte.. */ @org.junit.Test public void fnFunctionLookup476() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'unsignedByte'), 1)('1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function xs:nonNegativeInteger.. */ @org.junit.Test public void fnFunctionLookup477() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'nonNegativeInteger'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:nonNegativeInteger.. */ @org.junit.Test public void fnFunctionLookup478() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'nonNegativeInteger'), 1)('1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function xs:positiveInteger.. */ @org.junit.Test public void fnFunctionLookup479() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'positiveInteger'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:positiveInteger.. */ @org.junit.Test public void fnFunctionLookup480() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'positiveInteger'), 1)('1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Attempts to look up function xs:gYearMonth.. */ @org.junit.Test public void fnFunctionLookup481() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'gYearMonth'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:gYearMonth.. */ @org.junit.Test public void fnFunctionLookup482() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'gYearMonth'), 1)('2001-10Z')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2001-10Z") ); } /** * Attempts to look up function xs:gYear.. */ @org.junit.Test public void fnFunctionLookup483() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'gYear'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:gYear.. */ @org.junit.Test public void fnFunctionLookup484() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'gYear'), 1)('2012Z')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2012Z") ); } /** * Attempts to look up function xs:gMonthDay.. */ @org.junit.Test public void fnFunctionLookup485() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'gMonthDay'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:gMonthDay.. */ @org.junit.Test public void fnFunctionLookup486() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'gMonthDay'), 1)('--11-01Z')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--11-01Z") ); } /** * Attempts to look up function xs:gDay.. */ @org.junit.Test public void fnFunctionLookup487() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'gDay'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:gDay.. */ @org.junit.Test public void fnFunctionLookup488() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'gDay'), 1)('---01Z')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "---01Z") ); } /** * Attempts to look up function xs:gMonth.. */ @org.junit.Test public void fnFunctionLookup489() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'gMonth'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:gMonth.. */ @org.junit.Test public void fnFunctionLookup490() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'gMonth'), 1)('--11Z')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--11Z") ); } /** * Attempts to look up function xs:string.. */ @org.junit.Test public void fnFunctionLookup491() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'string'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:string.. */ @org.junit.Test public void fnFunctionLookup492() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'string'), 1)('string')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "string") ); } /** * Attempts to look up function xs:normalizeString.. */ @org.junit.Test public void fnFunctionLookup493() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'normalizedString'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:normalizeString.. */ @org.junit.Test public void fnFunctionLookup494() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'normalizedString'), 1)('normalized\n" + "string')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "normalized string") ); } /** * Attempts to look up function xs:token.. */ @org.junit.Test public void fnFunctionLookup495() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'token'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:token.. */ @org.junit.Test public void fnFunctionLookup496() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'token'), 1)('token')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "token") ); } /** * Attempts to look up function xs:language.. */ @org.junit.Test public void fnFunctionLookup497() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'language'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:language.. */ @org.junit.Test public void fnFunctionLookup498() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'language'), 1)('en')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "en") ); } /** * Attempts to look up function xs:NMTOKEN.. */ @org.junit.Test public void fnFunctionLookup499() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'NMTOKEN'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:NMTOKEN.. */ @org.junit.Test public void fnFunctionLookup500() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'NMTOKEN'), 1)('NMTOKEN')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NMTOKEN") ); } /** * Attempts to look up function xs:Name.. */ @org.junit.Test public void fnFunctionLookup501() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'Name'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:Name.. */ @org.junit.Test public void fnFunctionLookup502() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'Name'), 1)('Name')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Name") ); } /** * Attempts to look up function xs:NCName.. */ @org.junit.Test public void fnFunctionLookup503() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'NCName'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:NCName.. */ @org.junit.Test public void fnFunctionLookup504() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'NCName'), 1)('NCName')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NCName") ); } /** * Attempts to look up function xs:ID.. */ @org.junit.Test public void fnFunctionLookup505() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'ID'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:ID.. */ @org.junit.Test public void fnFunctionLookup506() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'ID'), 1)('ID')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ID") ); } /** * Attempts to look up function xs:IDREF.. */ @org.junit.Test public void fnFunctionLookup507() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'IDREF'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:IDREF.. */ @org.junit.Test public void fnFunctionLookup508() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'IDREF'), 1)('IDREF')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "IDREF") ); } /** * Attempts to look up function xs:ENTITY.. */ @org.junit.Test public void fnFunctionLookup509() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'ENTITY'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:ENTITY.. */ @org.junit.Test public void fnFunctionLookup510() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'ENTITY'), 1)('ENTITY')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ENTITY") ); } /** * Attempts to look up function xs:boolean.. */ @org.junit.Test public void fnFunctionLookup511() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'boolean'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:boolean.. */ @org.junit.Test public void fnFunctionLookup512() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'boolean'), 1)('1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true") ); } /** * Attempts to look up function xs:base64Binary.. */ @org.junit.Test public void fnFunctionLookup513() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'base64Binary'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:base64Binary.. */ @org.junit.Test public void fnFunctionLookup514() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'base64Binary'), 1)('D74D35D35D35')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "D74D35D35D35") ); } /** * Attempts to look up function xs:hexBinary.. */ @org.junit.Test public void fnFunctionLookup515() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'hexBinary'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:hexBinary.. */ @org.junit.Test public void fnFunctionLookup516() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'hexBinary'), 1)('0fb7')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0FB7") ); } /** * Attempts to look up function xs:anyURI.. */ @org.junit.Test public void fnFunctionLookup517() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'anyURI'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:anyURI.. */ @org.junit.Test public void fnFunctionLookup518() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'anyURI'), 1)('http://www.example.org/')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.org/") ); } /** * Attempts to look up function xs:QName.. */ @org.junit.Test public void fnFunctionLookup519() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'QName'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:QName.. */ @org.junit.Test public void fnFunctionLookup520() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'QName'), 1)('fn:QName')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "fn:QName") ); } /** * Attempts to look up function xs:dateTimeStamp.. */ @org.junit.Test public void fnFunctionLookup521() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'dateTimeStamp'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:boolean") ); } /** * Attempts to invoke function xs:dateTimeStamp.. */ @org.junit.Test public void fnFunctionLookup522() { final XQuery query = new XQuery( "\n" + " let $f := function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'dateTimeStamp'), 1)\n" + " return if (exists($f)) then year-from-dateTime($f('2012-05-25T11:42:00+01:00')) else 2012", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2012") ); } /** * Attempts to look up function xs:IDREFS.. */ @org.junit.Test public void fnFunctionLookup523() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'IDREFS'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:IDREFS.. */ @org.junit.Test public void fnFunctionLookup524() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'IDREFS'), 1)('ID1 ID2 ID3')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ID1 ID2 ID3") ); } /** * Attempts to look up function xs:NMTOKENS.. */ @org.junit.Test public void fnFunctionLookup525() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'NMTOKENS'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:NMTOKENS.. */ @org.junit.Test public void fnFunctionLookup526() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'NMTOKENS'), 1)('NMTOKEN1 NMTOKEN2 NMTOKEN3')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NMTOKEN1 NMTOKEN2 NMTOKEN3") ); } /** * Attempts to look up function xs:ENTITES.. */ @org.junit.Test public void fnFunctionLookup527() { final XQuery query = new XQuery( "exists(function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'ENTITIES'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke function xs:ENTITIES.. */ @org.junit.Test public void fnFunctionLookup528() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2001/XMLSchema', 'ENTITIES'), 1)('ENTITY1 ENTITY2 ENTITY3')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ENTITY1 ENTITY2 ENTITY3") ); } /** * Attempts to look up non-existant function local:missing.. */ @org.junit.Test public void fnFunctionLookup529() { final XQuery query = new XQuery( "empty(function-lookup(fn:QName('http://www.w3.org/2005/xquery-local-functions', 'missing'), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to invoke the non-existant function local:missing.. */ @org.junit.Test public void fnFunctionLookup530() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xquery-local-functions', 'missing'), 1)(\"arg\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Applied to a built-in function. */ @org.junit.Test public void fnFunctionLookup601() { final XQuery query = new XQuery( "function-lookup(QName(\"http://www.w3.org/2005/xpath-functions\", \"abs\"), 1)(-3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Applied to a built-in function with variable arity. */ @org.junit.Test public void fnFunctionLookup602() { final XQuery query = new XQuery( "function-lookup(QName(\"http://www.w3.org/2005/xpath-functions\", \"concat\"), 3)(\"a\", \"b\", \"c\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc") ); } /** * Applied to a built-in function with zero arity. */ @org.junit.Test public void fnFunctionLookup603() { final XQuery query = new XQuery( "function-lookup(QName(\"http://www.w3.org/2005/xpath-functions/math\", \"pi\"), 0)() idiv 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Applied to a constructor function. */ @org.junit.Test public void fnFunctionLookup604() { final XQuery query = new XQuery( "function-lookup(QName(\"http://www.w3.org/2001/XMLSchema\", \"time\"), 1)(\"12:30:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:time(\"12:30:00Z\")") ); } /** * Applied to a user-defined function. */ @org.junit.Test public void fnFunctionLookup605() { final XQuery query = new XQuery( "\n" + " xquery version \"3.0\";\n" + " \tdeclare function local:square($i as xs:integer) as xs:integer { $i*$i };\n" + " function-lookup(QName(\"http://www.w3.org/2005/xquery-local-functions\", \"square\"), 1)(13)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("169") ); } /** * Applied to a private user-defined function in the same module. */ @org.junit.Test public void fnFunctionLookup606() { final XQuery query = new XQuery( "\n" + " xquery version \"3.0\";\n" + " \tdeclare %private function local:square($i as xs:integer) as xs:integer { $i*$i };\n" + " function-lookup(QName(\"http://www.w3.org/2005/xquery-local-functions\", \"square\"), 1)(13)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("169") ); } /** * Applied to a non-existent function. */ @org.junit.Test public void fnFunctionLookup607() { final XQuery query = new XQuery( "\n" + " function-lookup(QName(\"http://www.w3.org/2005/xquery-local-functions\", \"cube\"), 1)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Applied to a non-existent function (no namespace URI). */ @org.junit.Test public void fnFunctionLookup608() { final XQuery query = new XQuery( "\n" + " function-lookup(QName(\"\", \"round\"), 2)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Get the name and arity of the result. */ @org.junit.Test public void fnFunctionLookup609() { final XQuery query = new XQuery( "\n" + " function-lookup(QName(\"http://www.w3.org/2005/xpath-functions\", \"round\"), 2) ! \n" + " (function-name(.) ! (namespace-uri-from-QName(.), local-name-from-QName(.)), function-arity(.))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.w3.org/2005/xpath-functions round 2") ); } /** * Call the function with the wrong number of arguments. */ @org.junit.Test public void fnFunctionLookup610() { final XQuery query = new XQuery( "\n" + " xquery version \"3.0\";\n" + " \tdeclare %private function local:square($i as xs:integer) as xs:integer { $i*$i };\n" + " function-lookup(QName(\"http://www.w3.org/2005/xquery-local-functions\", \"square\"), 1)(13, 12)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Call the function with the wrong type of argument. */ @org.junit.Test public void fnFunctionLookup611() { final XQuery query = new XQuery( "\n" + " xquery version \"3.0\";\n" + " \tdeclare %private function local:square($i as xs:integer) as xs:integer { $i*$i };\n" + " function-lookup(QName(\"http://www.w3.org/2005/xquery-local-functions\", \"square\"), 1)(\"banana\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Curry the resulting function. */ @org.junit.Test public void fnFunctionLookup612() { final XQuery query = new XQuery( "function-lookup(QName(\"http://www.w3.org/2005/xpath-functions\", \"round\"), 2)(?, 3)(1.2345678)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.235") ); } /** * Function lookup creating a circular dependency (see bug 15791 - provisional outcome). */ @org.junit.Test public void fnFunctionLookup613() { final XQuery query = new XQuery( "\n" + " declare variable $n external := xs:QName('local:return-v');\n" + " declare variable $v := function-lookup($n, 0)();\n" + " declare function local:return-v() {$v + 1};\n" + " $v\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0054") ); } /** * Function lookup accessing an EXSLT extension function, with two possible results. */ @org.junit.Test public void fnFunctionLookup614() { final XQuery query = new XQuery( "\n" + " let $f := function-lookup(QName(\"http://exslt.org/dates-and-times\", \"month-abbreviation\"), 1)\n" + " return if (exists($f)) then $f(\"2012-02-28\") else \"not-available\"\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "not-available") || assertStringValue(false, "Feb") ) ); } /** * Function lookup accessing an eXist extension function, with two possible results. */ @org.junit.Test public void fnFunctionLookup615() { final XQuery query = new XQuery( "\n" + " let $f := function-lookup(QName(\"http://exist-db.org/xquery/datetime\", \"days-in-month\"), 1)\n" + " return if (exists($f)) then $f(xs:date(\"2012-02-28\")) else \"not-available\"\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "not-available") || assertStringValue(false, "29") ) ); } /** * Attempts to evaluate the "function-lookup" function with no arguments.. */ @org.junit.Test public void fnFunctionLookup701() { final XQuery query = new XQuery( "fn:function-lookup()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "function-lookup" function with arity zero.. */ @org.junit.Test public void fnFunctionLookup702() { final XQuery query = new XQuery( "fn:function-lookup#0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to evaluate the "function-lookup" function with one argument.. */ @org.junit.Test public void fnFunctionLookup703() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'node-name'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "function-lookup" function with arity one.. */ @org.junit.Test public void fnFunctionLookup704() { final XQuery query = new XQuery( "fn:function-lookup#1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to evaluate the "function-lookup" function with three argument.. */ @org.junit.Test public void fnFunctionLookup705() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'node-name'), 1, ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "function-lookup" function with arity three.. */ @org.junit.Test public void fnFunctionLookup706() { final XQuery query = new XQuery( "fn:function-lookup#3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Evaluates the "function-lookup" function with the argument set as follows: $name = () . */ @org.junit.Test public void fnFunctionLookup707() { final XQuery query = new XQuery( "fn:function-lookup( (), 1 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluates the "function-lookup" function with the argument set as follows: $arity = () . */ @org.junit.Test public void fnFunctionLookup708() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'node-name'), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Attempts to evaluate the "function-lookup" function with invalid arguments.. */ @org.junit.Test public void fnFunctionLookup709() { final XQuery query = new XQuery( "function-lookup((fn:QName('http://www.w3.org/2005/xpath-functions', 'node-name'), fn:QName('http://www.w3.org/2005/xpath-functions', 'node-name')), 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Attempts to evaluate the "function-lookup" function with invalid arguments.. */ @org.junit.Test public void fnFunctionLookup710() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'node-name'), (1, 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the type checking of the argument.. */ @org.junit.Test public void fnFunctionLookup712() { final XQuery query = new XQuery( "( fn:function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'node-name'),\n" + " if (current-date() eq xs:date('1900-01-01'))\n" + " then ()\n" + " else 1 ),\n" + " fn:function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'node-name'),\n" + " if (current-date() eq xs:date('1900-01-01'))\n" + " then 1\n" + " else () ) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the type checking of the argument.. */ @org.junit.Test public void fnFunctionLookup714() { final XQuery query = new XQuery( "( fn:function-lookup((if (current-date() eq xs:date('1900-01-01'))\n" + " then fn:QName('http://www.w3.org/2005/xpath-functions', 'node-name')\n" + " else ()), 1),\n" + " fn:function-lookup((if (current-date() eq xs:date('1900-01-01'))\n" + " then ()\n" + " else fn:QName('http://www.w3.org/2005/xpath-functions', 'node-name')), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the return type of the "function-lookup" function.. */ @org.junit.Test public void fnFunctionLookup715() { final XQuery query = new XQuery( "function-lookup(fn:QName('http://www.w3.org/2005/xpath-functions', 'node-name'), 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("function(*)") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnFunctionName.java000066400000000000000000000315431222453003200276270ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the function-name() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnFunctionName extends QT3TestSet { /** * Attempts to evaluate the "function-name" function with no arguments.. */ @org.junit.Test public void fnFunctionName001() { final XQuery query = new XQuery( "fn:function-name()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "function-name" function with arity zero.. */ @org.junit.Test public void fnFunctionName002() { final XQuery query = new XQuery( "fn:function-name#0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to evaluate the "function-name" function with two arguments.. */ @org.junit.Test public void fnFunctionName003() { final XQuery query = new XQuery( "fn:function-name( fn:dateTime#2, fn:dateTime#2 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "function-name" function with arity two.. */ @org.junit.Test public void fnFunctionName004() { final XQuery query = new XQuery( "fn:function-name#2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "function-name" function with arity one.. */ @org.junit.Test public void fnFunctionName005() { final XQuery query = new XQuery( "exists(fn:function-name#1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "function-name" function with the argument set as follows: $func = () . */ @org.junit.Test public void fnFunctionName006() { final XQuery query = new XQuery( "fn:function-name( () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluates the "function-name" function with an argument of type xs:anyAtomicType.. */ @org.junit.Test public void fnFunctionName007() { final XQuery query = new XQuery( "fn:function-name( 1 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluates the "function-name" function with an argument of type node().. */ @org.junit.Test public void fnFunctionName008() { final XQuery query = new XQuery( "fn:function-name( fn:analyze-string((), \"unused\") )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the type checking of the argument.. */ @org.junit.Test public void fnFunctionName009() { final XQuery query = new XQuery( "fn:function-name( (fn:dateTime#2, fn:dateTime#2) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the type checking of the argument.. */ @org.junit.Test public void fnFunctionName011() { final XQuery query = new XQuery( "( fn:function-name( if (current-date() eq xs:date('1900-01-01'))\n" + " then fn:dateTime#2\n" + " else 1 ),\n" + " fn:function-name( if (current-date() eq xs:date('1900-01-01'))\n" + " then 1\n" + " else fn:dateTime#2 ) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the return type of the "function-name" function.. */ @org.junit.Test public void fnFunctionName012() { final XQuery query = new XQuery( "fn:function-name( fn:substring#2 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:QName") ); } /** * Tests the return type of the "function-name" function.. */ @org.junit.Test public void fnFunctionName013() { final XQuery query = new XQuery( "fn:function-name( fn:substring(?, 1) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertType("empty-sequence()") || error("XPST0005") ) ); } /** * Tests the return type of the "function-name" function.. */ @org.junit.Test public void fnFunctionName014() { final XQuery query = new XQuery( "fn:function-name( function($node){count($node/*)} )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertType("empty-sequence()") || error("XPST0005") ) ); } /** * Evaluates the "function-name" function with the argument set as follows: $func = dateTime#2 . */ @org.junit.Test public void fnFunctionName015() { final XQuery query = new XQuery( "fn:function-name( dateTime#2 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("fn:QName(\"http://www.w3.org/2005/xpath-functions\", \n \"fn:dateTime\")") ); } /** * Evaluates the "function-name" function with the argument set as follows: $func = math:pow#2 . */ @org.junit.Test public void fnFunctionName016() { final XQuery query = new XQuery( "fn:function-name( math:pow#2 )", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("fn:QName(\"http://www.w3.org/2005/xpath-functions/math\", \n \"math:pow\")") ); } /** * Evaluates the "function-name" function with the argument set as follows: $func = concat#99 . */ @org.junit.Test public void fnFunctionName017() { final XQuery query = new XQuery( "fn:function-name( concat#99 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("fn:QName(\"http://www.w3.org/2005/xpath-functions\", \n \"fn:concat\")") ); } /** * Evaluates the "function-name" function with the argument set as follows: $func = concat#340282366920938463463374607431768211456. */ @org.junit.Test public void fnFunctionName018() { final XQuery query = new XQuery( "fn:function-name( concat#340282366920938463463374607431768211456 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FOAR0002") || assertEq("fn:QName(\"http://www.w3.org/2005/xpath-functions\", \n \"fn:concat\")") ) ); } /** * Evaluates the "function-name" function with the argument set as follows: function($node){name($node)} . */ @org.junit.Test public void fnFunctionName019() { final XQuery query = new XQuery( "fn:function-name( function($node){name($node)} )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluates the "function-name" function with the argument set as follows: function($arg1, $arg2){subsequence($arg1, $arg2, 1)} . */ @org.junit.Test public void fnFunctionName020() { final XQuery query = new XQuery( "fn:function-name( function($arg1, $arg2)\n" + " { subsequence($arg1, $arg2, 1) } )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluates the "function-name" function with the argument refereing to a partial function application.. */ @org.junit.Test public void fnFunctionName021() { final XQuery query = new XQuery( "let $initial := fn:substring(?, 1, 1) \n" + " return fn:function-name( $initial )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluates the "function-name" function with the argument refereing a global user-defined function.. */ @org.junit.Test public void fnFunctionName022() { final XQuery query = new XQuery( "\n" + "\tdeclare function local:add($arg1, $arg2, $arg3)\n" + " {\n" + " $arg1 + $arg2 + $arg3\n" + " };\n" + "\n" + "\tfn:function-name( local:add#3 )\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("fn:QName(\"http://www.w3.org/2005/xquery-local-functions\",\n \"local:add\")") ); } /** * Evaluates the "function-name" function with the argument refereing a partial application of a global user-defined function.. */ @org.junit.Test public void fnFunctionName023() { final XQuery query = new XQuery( "\n" + "\tdeclare function local:add($arg1, $arg2, $arg3)\n" + " {\n" + " $arg1 + $arg2 + $arg3\n" + " };\n" + "\n" + "\tfn:function-name( local:add(1, 2, ?) )\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluates the "function-name" function with the argument refereing to a function item returned by function coercion.. */ @org.junit.Test public void fnFunctionName024() { final XQuery query = new XQuery( "\n" + "\tdeclare function local:coerce($arg as function(item()*) as item()*)\n" + " as function(item()*) as item()*\n" + " {\n" + " $arg\n" + " };\n" + " \n" + " let $coerced := local:coerce(fn:abs#1)\n" + " return if ($coerced instance of function(item()*) as item()*)\n" + " then fn:function-name( local:coerce(fn:abs#1) )\n" + " else \"error\"\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("fn:QName(\"http://www.w3.org/2005/xpath-functions\", \n \"fn:abs\")") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnGenerateId.java000066400000000000000000000353341222453003200272520ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the generate-id() function transferred from the XSLT 2.0 specification to XPath/XQuery 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnGenerateId extends QT3TestSet { /** * generate-id() applied to an empty sequence. */ @org.junit.Test public void generateId000() { final XQuery query = new XQuery( "generate-id(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertType("xs:string") && assertEq("\"\"") ) ); } /** * generate-id() applied to an element node. */ @org.junit.Test public void generateId001() { final XQuery query = new XQuery( "generate-id(/*)", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("matches($result, '^[A-Za-z][A-Za-z0-9]*$')") ); } /** * generate-id() applied to an attribute node. */ @org.junit.Test public void generateId002() { final XQuery query = new XQuery( "generate-id((//@*)[1])", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("matches($result, '^[A-Za-z][A-Za-z0-9]*$')") ); } /** * generate-id() applied to a document node. */ @org.junit.Test public void generateId003() { final XQuery query = new XQuery( "generate-id(/)", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("matches($result, '^[A-Za-z][A-Za-z0-9]*$')") ); } /** * generate-id() applied to a comment node. */ @org.junit.Test public void generateId004() { final XQuery query = new XQuery( "generate-id((//comment())[1])", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("matches($result, '^[A-Za-z][A-Za-z0-9]*$')") ); } /** * generate-id() applied to a processing instruction node. */ @org.junit.Test public void generateId005() { final XQuery query = new XQuery( "generate-id((//processing-instruction())[1])", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("matches($result, '^[A-Za-z][A-Za-z0-9]*$')") ); } /** * generate-id() applied to a text node. */ @org.junit.Test public void generateId006() { final XQuery query = new XQuery( "generate-id((//text())[1])", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("matches($result, '^[A-Za-z][A-Za-z0-9]*$')") ); } /** * generate-id() with no arguments applied to a document node. */ @org.junit.Test public void generateId008() { final XQuery query = new XQuery( "generate-id() eq generate-id(/)", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * generate-id() with no arguments applied to an element node. */ @org.junit.Test public void generateId009() { final XQuery query = new XQuery( "/*/(generate-id() eq generate-id(.))", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Uniqueness of generated IDs. */ @org.junit.Test public void generateId010() { final XQuery query = new XQuery( "let $nodes := (/ | //*/(.|@*|comment()|processing-instruction()|text())) \n" + " return count($nodes) eq count(distinct-values($nodes/generate-id()))", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Uniqueness of generated IDs for document nodes across multiple documents. */ @org.junit.Test public void generateId012() { final XQuery query = new XQuery( "let $nodes := collection()\n" + " return count($nodes) eq count(distinct-values($nodes/generate-id()))", ctx); try { query.addCollection("", new String[] { file("docs/auction.xml"), file("docs/works-mod.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Uniqueness of generated IDs for element nodes across multiple documents. */ @org.junit.Test public void generateId013() { final XQuery query = new XQuery( "let $nodes := collection()//*\n" + " return count($nodes) eq count(distinct-values($nodes/generate-id()))", ctx); try { query.addCollection("", new String[] { file("docs/auction.xml"), file("docs/works-mod.xml") }); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * generate-id() applied to a parentless element node. */ @org.junit.Test public void generateId014() { final XQuery query = new XQuery( "\n" + " import module namespace copy=\"http://www.w3.org/QT3/copy\";\n" + " generate-id(copy:copy(/*))\n" + " ", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.addModule("http://www.w3.org/QT3/copy", file("fn/id/copy.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("matches($result, '^[A-Za-z][A-Za-z0-9]*$')") ); } /** * generate-id() applied to a parentless attribute node. */ @org.junit.Test public void generateId015() { final XQuery query = new XQuery( "\n" + " import module namespace copy=\"http://www.w3.org/QT3/copy\";\n" + " generate-id(copy:copy((//@*)[1]))\n" + " ", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.addModule("http://www.w3.org/QT3/copy", file("fn/id/copy.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("matches($result, '^[A-Za-z][A-Za-z0-9]*$')") ); } /** * generate-id() changes when a node is copied. */ @org.junit.Test public void generateId016() { final XQuery query = new XQuery( "\n" + " import module namespace copy=\"http://www.w3.org/QT3/copy\";\n" + " generate-id(copy:copy(/*)) eq generate-id(/*)\n" + " ", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.addModule("http://www.w3.org/QT3/copy", file("fn/id/copy.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * generate-id() applied to a parentless attribute node. */ @org.junit.Test public void generateId017() { final XQuery query = new XQuery( "\n" + " import module namespace copy=\"http://www.w3.org/QT3/copy\";\n" + " let $att := (//@*)[1] return generate-id(copy:copy($att)) eq generate-id($att)\n" + " ", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.addModule("http://www.w3.org/QT3/copy", file("fn/id/copy.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * generate-id() with no context item. */ @org.junit.Test public void generateId901() { final XQuery query = new XQuery( "let $f := function() {generate-id()} return $f()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * generate-id() with context item not a node. */ @org.junit.Test public void generateId902() { final XQuery query = new XQuery( "let $f := function($x as item()) {generate-id($x)} return $f(3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * generate-id() with context item not a node. */ @org.junit.Test public void generateId903() { final XQuery query = new XQuery( "for $i in 1 to 20 return generate-id($i)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * generate-id() with context item not a node. */ @org.junit.Test public void generateId904() { final XQuery query = new XQuery( "let $f := function($x as item()) {\"\"} return generate-id($f)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * generate-id() applied to a sequence of nodes. */ @org.junit.Test public void generateId905() { final XQuery query = new XQuery( "generate-id(//*)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnHasChildren.java000066400000000000000000000415061222453003200274250ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the has-children() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnHasChildren extends QT3TestSet { /** * Attempts to reference the "has-children" function with arity zero.. */ @org.junit.Test public void fnHasChildren001() { final XQuery query = new XQuery( "fn:exists( fn:has-children#0 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to reference the "has-children" function with arity one.. */ @org.junit.Test public void fnHasChildren002() { final XQuery query = new XQuery( "fn:exists( fn:has-children#1 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to evaluate the "has-children" function with two arguments.. */ @org.junit.Test public void fnHasChildren003() { final XQuery query = new XQuery( "fn:has-children( fn:contains#2, fn:contains#2 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "has-children" function with arity two.. */ @org.junit.Test public void fnHasChildren004() { final XQuery query = new XQuery( "fn:has-children#2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Evaluates the zero-arity "has-children" function with absent context item.. */ @org.junit.Test public void fnHasChildren005() { final XQuery query = new XQuery( "fn:has-children()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPDY0002") || error("XPTY0004") ) ); } /** * Evaluates the (arity one) "has-children" function with absent context item.. */ @org.junit.Test public void fnHasChildren006() { final XQuery query = new XQuery( "fn:has-children(.)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPDY0002") || error("XPTY0004") ) ); } /** * Evaluates the zero-arity "has-children" function with context item which is not a node.. */ @org.junit.Test public void fnHasChildren007() { final XQuery query = new XQuery( "(1)[fn:has-children()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") ) ); } /** * Evaluates the zero-arity "has-children" function with context item which is not a node.. */ @org.junit.Test public void fnHasChildren008() { final XQuery query = new XQuery( "(fn:concat#2)[fn:has-children()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") ) ); } /** * Tests the type checking of the argument.. */ @org.junit.Test public void fnHasChildren009() { final XQuery query = new XQuery( "fn:has-children(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the type checking of the argument.. */ @org.junit.Test public void fnHasChildren010() { final XQuery query = new XQuery( "fn:has-children(fn:concat#2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the type checking of the argument.. */ @org.junit.Test public void fnHasChildren011() { final XQuery query = new XQuery( "fn:has-children( (.,.) )", ctx); try { query.context(node(file("fn/has-children/has-children.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the type checking of the argument.. */ @org.junit.Test public void fnHasChildren014() { final XQuery query = new XQuery( "(., 1) ! fn:has-children()", ctx); try { query.context(node(file("fn/has-children/has-children.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the type checking of the argument.. */ @org.junit.Test public void fnHasChildren015() { final XQuery query = new XQuery( "(., 1) ! fn:has-children(.)", ctx); try { query.context(node(file("fn/has-children/has-children.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the return type of the "has-children" function.. */ @org.junit.Test public void fnHasChildren016() { final XQuery query = new XQuery( "fn:has-children()", ctx); try { query.context(node(file("fn/has-children/has-children.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:boolean") ); } /** * Tests the return type of the "has-children" function.. */ @org.junit.Test public void fnHasChildren017() { final XQuery query = new XQuery( "fn:has-children(.)", ctx); try { query.context(node(file("fn/has-children/has-children.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:boolean") ); } /** * Evaluates the "has-children" function with the argument set as follows: context item of type attribute() . */ @org.junit.Test public void fnHasChildren018() { final XQuery query = new XQuery( "/root/@attribute/fn:has-children()", ctx); try { query.context(node(file("fn/has-children/has-children.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "has-children" function with the argument set as follows: $node of type attribute() . */ @org.junit.Test public void fnHasChildren019() { final XQuery query = new XQuery( "fn:has-children( /root/@attribute )", ctx); try { query.context(node(file("fn/has-children/has-children.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "has-children" function with the argument set as follows: context item of type comment() . */ @org.junit.Test public void fnHasChildren022() { final XQuery query = new XQuery( "/root/comment()/fn:has-children()", ctx); try { query.context(node(file("fn/has-children/has-children.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "has-children" function with the argument set as follows: $node of type comment() . */ @org.junit.Test public void fnHasChildren023() { final XQuery query = new XQuery( "fn:has-children( /root/comment() )", ctx); try { query.context(node(file("fn/has-children/has-children.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "has-children" function with the argument set as follows: context item of type processing-instruction() . */ @org.junit.Test public void fnHasChildren024() { final XQuery query = new XQuery( "/root/processing-instruction()/fn:has-children()", ctx); try { query.context(node(file("fn/has-children/has-children.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "has-children" function with the argument set as follows: $node of type processing-instruction() . */ @org.junit.Test public void fnHasChildren025() { final XQuery query = new XQuery( "fn:has-children( /root/processing-instruction() )", ctx); try { query.context(node(file("fn/has-children/has-children.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "has-children" function with the argument set as follows: context item of type text() . */ @org.junit.Test public void fnHasChildren026() { final XQuery query = new XQuery( "/root/text()/fn:has-children()", ctx); try { query.context(node(file("fn/has-children/has-children.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "has-children" function with the argument set as follows: $node of type text() . */ @org.junit.Test public void fnHasChildren027() { final XQuery query = new XQuery( "fn:has-children( /root/text() )", ctx); try { query.context(node(file("fn/has-children/has-children.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "has-children" function with the argument set as follows: context item of type element() . */ @org.junit.Test public void fnHasChildren028() { final XQuery query = new XQuery( "/root/empty/fn:has-children()", ctx); try { query.context(node(file("fn/has-children/has-children.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "has-children" function with the argument set as follows: context item of type element() . */ @org.junit.Test public void fnHasChildren029() { final XQuery query = new XQuery( "fn:has-children( /root/empty )", ctx); try { query.context(node(file("fn/has-children/has-children.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "has-children" function with the argument set as follows: context item of type element() . */ @org.junit.Test public void fnHasChildren030() { final XQuery query = new XQuery( "/root/fn:has-children()", ctx); try { query.context(node(file("fn/has-children/has-children.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "has-children" function with the argument set as follows: $node of type element() . */ @org.junit.Test public void fnHasChildren031() { final XQuery query = new XQuery( "fn:has-children( /root )", ctx); try { query.context(node(file("fn/has-children/has-children.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "has-children" function with the argument set as follows: context item of type element() . */ @org.junit.Test public void fnHasChildren032() { final XQuery query = new XQuery( "/root/non-empty/fn:has-children()", ctx); try { query.context(node(file("fn/has-children/has-children.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "has-children" function with the argument set as follows: $node of type element() . */ @org.junit.Test public void fnHasChildren033() { final XQuery query = new XQuery( "fn:has-children( /root/non-empty )", ctx); try { query.context(node(file("fn/has-children/has-children.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "has-children" function with the argument set as follows: context item of type document-node() . */ @org.junit.Test public void fnHasChildren034() { final XQuery query = new XQuery( "/fn:has-children()", ctx); try { query.context(node(file("fn/has-children/has-children.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "has-children" function with the argument set as follows: $node of type document-node() . */ @org.junit.Test public void fnHasChildren035() { final XQuery query = new XQuery( "fn:has-children( / )", ctx); try { query.context(node(file("fn/has-children/has-children.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "has-children" function with the argument set as follows: context item of type node() . */ @org.junit.Test public void fnHasChildren036() { final XQuery query = new XQuery( "/root/node()/fn:has-children()", ctx); try { query.context(node(file("fn/has-children/has-children.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "false false false false true") ); } /** * Evaluates the "has-children" function with the argument set as follows: $node of type node() . */ @org.junit.Test public void fnHasChildren037() { final XQuery query = new XQuery( "/root/node()/fn:has-children(.)", ctx); try { query.context(node(file("fn/has-children/has-children.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "false false false false true") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnHead.java000066400000000000000000000055721222453003200261050ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the head() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnHead extends QT3TestSet { /** * head() of a simple sequence . */ @org.junit.Test public void head001() { final XQuery query = new XQuery( "head(3 to 10)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * head() of a simple sequence . */ @org.junit.Test public void head002() { final XQuery query = new XQuery( "head((\"a\", \"b\", current-dateTime()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"a\"") ); } /** * head() of a node sequence . */ @org.junit.Test public void head003() { final XQuery query = new XQuery( "let $a := /works return head($a/*)/string(@name)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 1") ); } /** * head() of a singleton sequence . */ @org.junit.Test public void head004() { final XQuery query = new XQuery( "let $a := /works return name(head($a))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "works") ); } /** * head() of an empty sequence . */ @org.junit.Test public void head005() { final XQuery query = new XQuery( "head(/works/cucumber)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * head() preserves identity . */ @org.junit.Test public void head006() { final XQuery query = new XQuery( "let $a := /works/* return (head($a) is $a[1])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnHoursFromDateTime.java000066400000000000000000000343701222453003200306030ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the hours-from-dateTime() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnHoursFromDateTime extends QT3TestSet { /** * A test whose essence is: `hours-from-dateTime()`. . */ @org.junit.Test public void kHoursFromDateTimeFunc1() { final XQuery query = new XQuery( "hours-from-dateTime()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `hours-from-dateTime((), "Wrong param")`. . */ @org.junit.Test public void kHoursFromDateTimeFunc2() { final XQuery query = new XQuery( "hours-from-dateTime((), \"Wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(hours-from-dateTime(()))`. . */ @org.junit.Test public void kHoursFromDateTimeFunc3() { final XQuery query = new XQuery( "empty(hours-from-dateTime(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `hours-from-dateTime(()) instance of xs:integer?`. . */ @org.junit.Test public void kHoursFromDateTimeFunc4() { final XQuery query = new XQuery( "hours-from-dateTime(()) instance of xs:integer?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `hours-from-dateTime(xs:dateTime("2001-02-03T08:23:12.43")) eq 8`. . */ @org.junit.Test public void kHoursFromDateTimeFunc5() { final XQuery query = new XQuery( "hours-from-dateTime(xs:dateTime(\"2001-02-03T08:23:12.43\")) eq 8", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "hours-from-dateTime" function As per example 1 of the F&O specs . */ @org.junit.Test public void fnHoursFromDateTime1() { final XQuery query = new XQuery( "fn:hours-from-dateTime(xs:dateTime(\"1999-05-31T08:20:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "8") ); } /** * Evaluates The "hours-from-dateTime" function as part of a "*" expression. . */ @org.junit.Test public void fnHoursFromDateTime10() { final XQuery query = new XQuery( "fn:hours-from-dateTime(xs:dateTime(\"1970-01-01T02:00:00Z\")) * fn:hours-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "20") ); } /** * Evaluates The "hours-from-dateTime" function as part of a "div" expression. . */ @org.junit.Test public void fnHoursFromDateTime11() { final XQuery query = new XQuery( "fn:hours-from-dateTime(xs:dateTime(\"1970-01-01T02:00:00Z\")) div fn:hours-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0.2") ); } /** * Evaluates The "hours-from-dateTime" function as part of a "idiv" expression. . */ @org.junit.Test public void fnHoursFromDateTime12() { final XQuery query = new XQuery( "fn:hours-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\")) idiv fn:hours-from-dateTime(xs:dateTime(\"1970-01-01T02:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5") ); } /** * Evaluates The "hours-from-dateTime" function as part of a "mod" expression. . */ @org.junit.Test public void fnHoursFromDateTime13() { final XQuery query = new XQuery( "fn:hours-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\")) mod fn:hours-from-dateTime(xs:dateTime(\"1970-01-01T03:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "hours-from-dateTime" function as part of a "numeric-unary-plus" expression. . */ @org.junit.Test public void fnHoursFromDateTime14() { final XQuery query = new XQuery( "+fn:hours-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10") ); } /** * Evaluates The "hours-from-dateTime" function as part of a "numeric-unary-minus" expression. . */ @org.junit.Test public void fnHoursFromDateTime15() { final XQuery query = new XQuery( "-fn:hours-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-10") ); } /** * Evaluates The "hours-from-dateTime" function as part of a "numeric-equal" expression (eq operator) . */ @org.junit.Test public void fnHoursFromDateTime16() { final XQuery query = new XQuery( "fn:hours-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\")) eq fn:hours-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "hours-from-dateTime" function as part of a "numeric-equal" expression (ne operator) . */ @org.junit.Test public void fnHoursFromDateTime17() { final XQuery query = new XQuery( "fn:hours-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\")) ne fn:hours-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "hours-from-dateTime" function as part of a "numeric-equal" expression (le operator) . */ @org.junit.Test public void fnHoursFromDateTime18() { final XQuery query = new XQuery( "fn:hours-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\")) le fn:hours-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "hours-from-dateTime" function as part of a "numeric-equal" expression (ge operator) . */ @org.junit.Test public void fnHoursFromDateTime19() { final XQuery query = new XQuery( "fn:hours-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\")) ge fn:hours-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "hours-from-dateTime" function As per example 2 of the F&O specs . */ @org.junit.Test public void fnHoursFromDateTime2() { final XQuery query = new XQuery( "fn:hours-from-dateTime(xs:dateTime(\"1999-12-31T21:20:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "21") ); } /** * Evaluates The "hours-from-dateTime" function As per example 3 of the F&O specs . */ @org.junit.Test public void fnHoursFromDateTime3() { final XQuery query = new XQuery( "fn:hours-from-dateTime(fn:adjust-dateTime-to-timezone(xs:dateTime(\"1999-12-31T21:20:00-05:00\"), xs:dayTimeDuration(\"PT0H\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Evaluates The "hours-from-dateTime" function As per example 4 of the F&O specs . */ @org.junit.Test public void fnHoursFromDateTime4() { final XQuery query = new XQuery( "fn:hours-from-dateTime(xs:dateTime(\"1999-12-31T12:00:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12") ); } /** * Evaluates The "hours-from-dateTime" function using the empty sequence as an argument. Use count function to avoid empty file. . */ @org.junit.Test public void fnHoursFromDateTime5() { final XQuery query = new XQuery( "fn:count(fn:hours-from-dateTime(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "hours-from-dateTime" function that returns 0. . */ @org.junit.Test public void fnHoursFromDateTime6() { final XQuery query = new XQuery( "fn:hours-from-dateTime(xs:dateTime(\"1999-05-31T00:20:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "hours-from-dateTime" function that returns 23. . */ @org.junit.Test public void fnHoursFromDateTime7() { final XQuery query = new XQuery( "fn:hours-from-dateTime(xs:dateTime(\"1999-05-31T23:20:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "23") ); } /** * Evaluates The "hours-from-dateTime" function as part of a "+" expression. . */ @org.junit.Test public void fnHoursFromDateTime8() { final XQuery query = new XQuery( "fn:hours-from-dateTime(xs:dateTime(\"1970-01-01T00:00:00Z\")) + fn:hours-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10") ); } /** * Evaluates The "hours-from-dateTime" function as part of a "-" expression. . */ @org.junit.Test public void fnHoursFromDateTime9() { final XQuery query = new XQuery( "fn:hours-from-dateTime(xs:dateTime(\"1970-01-01T00:00:00Z\")) - fn:hours-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-10") ); } /** * Evaluates The "hours-from-dateTime" function with the arguments set as follows: $arg = xs:dateTime(lower bound) . */ @org.junit.Test public void fnHoursFromDateTime1args1() { final XQuery query = new XQuery( "fn:hours-from-dateTime(xs:dateTime(\"1970-01-01T00:00:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "hours-from-dateTime" function with the arguments set as follows: $arg = xs:dateTime(mid range) . */ @org.junit.Test public void fnHoursFromDateTime1args2() { final XQuery query = new XQuery( "fn:hours-from-dateTime(xs:dateTime(\"1996-04-07T01:40:52\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "hours-from-dateTime" function with the arguments set as follows: $arg = xs:dateTime(upper bound) . */ @org.junit.Test public void fnHoursFromDateTime1args3() { final XQuery query = new XQuery( "fn:hours-from-dateTime(xs:dateTime(\"2030-12-31T23:59:59\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "23") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnHoursFromDuration.java000066400000000000000000000374521222453003200307000ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the hours-from-duration() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnHoursFromDuration extends QT3TestSet { /** * A test whose essence is: `hours-from-duration()`. . */ @org.junit.Test public void kHoursFromDurationFunc1() { final XQuery query = new XQuery( "hours-from-duration()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `hours-from-duration((), "Wrong param")`. . */ @org.junit.Test public void kHoursFromDurationFunc2() { final XQuery query = new XQuery( "hours-from-duration((), \"Wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(hours-from-duration(()))`. . */ @org.junit.Test public void kHoursFromDurationFunc3() { final XQuery query = new XQuery( "empty(hours-from-duration(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `hours-from-duration(()) instance of xs:integer?`. . */ @org.junit.Test public void kHoursFromDurationFunc4() { final XQuery query = new XQuery( "hours-from-duration(()) instance of xs:integer?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `hours-from-duration(xs:dayTimeDuration("P3DT8H2M1.03S")) eq 8`. . */ @org.junit.Test public void kHoursFromDurationFunc5() { final XQuery query = new XQuery( "hours-from-duration(xs:dayTimeDuration(\"P3DT8H2M1.03S\")) eq 8", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test invoking hours-from-duration() on a negative duration. . */ @org.junit.Test public void kHoursFromDurationFunc6() { final XQuery query = new XQuery( "hours-from-duration(xs:dayTimeDuration(\"-P3DT8H2M1.03S\")) eq -8", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test invoking days-from-hours() on an negative xs:duration. . */ @org.junit.Test public void kHoursFromDurationFunc7() { final XQuery query = new XQuery( "hours-from-duration(xs:duration(\"-P3Y4M8DT1H23M2.34S\")) eq -1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:hours-from-duration on xs:yearMonthDuration . */ @org.junit.Test public void cbclHoursFromDuration001() { final XQuery query = new XQuery( "fn:hours-from-duration(xs:yearMonthDuration('P1Y'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "hours-from-duration" function As per example 1 (for this function)of the F&O specs . */ @org.junit.Test public void fnHoursFromDuration1() { final XQuery query = new XQuery( "fn:hours-from-duration(xs:dayTimeDuration(\"P3DT10H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Evaluates The "hours-from-duration" function as part of a "*" expression. . */ @org.junit.Test public void fnHoursFromDuration10() { final XQuery query = new XQuery( "fn:hours-from-duration(xs:dayTimeDuration(\"P20DT05H\")) * fn:hours-from-duration(xs:dayTimeDuration(\"P03DT08H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("40") ); } /** * Evaluates The "hours-from-duration" function as part of a "div" expression. . */ @org.junit.Test public void fnHoursFromDuration11() { final XQuery query = new XQuery( "fn:hours-from-duration(xs:dayTimeDuration(\"P20DT10H\")) div fn:hours-from-duration(xs:dayTimeDuration(\"P05DT05H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Evaluates The "hours-from-duration" function as part of a "idiv" expression. . */ @org.junit.Test public void fnHoursFromDuration12() { final XQuery query = new XQuery( "fn:hours-from-duration(xs:dayTimeDuration(\"P25DT10H\")) idiv fn:hours-from-duration(xs:dayTimeDuration(\"P05DT02H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** * Evaluates The "hours-from-duration" function as part of a "mod" expression. . */ @org.junit.Test public void fnHoursFromDuration13() { final XQuery query = new XQuery( "fn:hours-from-duration(xs:dayTimeDuration(\"P10DT10H\")) mod fn:hours-from-duration(xs:dayTimeDuration(\"P03DT02H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "hours-from-duration" function as part of a "numeric-unary-plus" expression. . */ @org.junit.Test public void fnHoursFromDuration14() { final XQuery query = new XQuery( "+fn:hours-from-duration(xs:dayTimeDuration(\"P21DT10H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Evaluates The "hours-from-duration" function as part of a "numeric-unary-minus" expression. . */ @org.junit.Test public void fnHoursFromDuration15() { final XQuery query = new XQuery( "-fn:hours-from-duration(xs:dayTimeDuration(\"P20DT02H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2") ); } /** * Evaluates The "hours-from-duration" function as part of a "numeric-equal" expression (eq operator) . */ @org.junit.Test public void fnHoursFromDuration16() { final XQuery query = new XQuery( "fn:hours-from-duration(xs:dayTimeDuration(\"P22DT09H\")) eq fn:hours-from-duration(xs:dayTimeDuration(\"P22DT09H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "hours-from-duration" function as part of a "numeric-equal" expression (ne operator) . */ @org.junit.Test public void fnHoursFromDuration17() { final XQuery query = new XQuery( "fn:hours-from-duration(xs:dayTimeDuration(\"P23DT07H\")) ne fn:hours-from-duration(xs:dayTimeDuration(\"P12DT05H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "hours-from-duration" function as part of a "numeric-equal" expression (le operator) . */ @org.junit.Test public void fnHoursFromDuration18() { final XQuery query = new XQuery( "fn:hours-from-duration(xs:dayTimeDuration(\"P20DT03H\")) le fn:hours-from-duration(xs:dayTimeDuration(\"P21DT01H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "hours-from-duration" function as part of a "numeric-equal" expression (ge operator) . */ @org.junit.Test public void fnHoursFromDuration19() { final XQuery query = new XQuery( "fn:hours-from-duration(xs:dayTimeDuration(\"P21DT07H\")) ge fn:hours-from-duration(xs:dayTimeDuration(\"P20DT08H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "hours-from-duration" function As per example 2 (for this function) of the F&O specs . */ @org.junit.Test public void fnHoursFromDuration2() { final XQuery query = new XQuery( "fn:hours-from-duration(xs:dayTimeDuration(\"P3DT12H32M12S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("12") ); } /** * Evaluates The "hours-from-duration" function with wrong argument type. . */ @org.junit.Test public void fnHoursFromDuration20() { final XQuery query = new XQuery( "fn:hours-from-duration(xs:duration(\"P1Y2M3DT10H30M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Evaluates The "hours-from-duration" function as per example 3 of this function on the F&O specs. . */ @org.junit.Test public void fnHoursFromDuration3() { final XQuery query = new XQuery( "fn:hours-from-duration(xs:dayTimeDuration(\"PT123H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Evaluates The "hours-from-duration" function as per example 4 (for this function) in the F&O specs. . */ @org.junit.Test public void fnHoursFromDuration4() { final XQuery query = new XQuery( "fn:hours-from-duration(xs:dayTimeDuration(\"-P3DT10H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-10") ); } /** * Evaluates The "hours-from-duration" function using the empty sequence as an argument. Use count function to avoid empty file. . */ @org.junit.Test public void fnHoursFromDuration5() { final XQuery query = new XQuery( "fn:count(fn:hours-from-duration(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "hours-from-duration" function that returns 1. . */ @org.junit.Test public void fnHoursFromDuration6() { final XQuery query = new XQuery( "fn:hours-from-duration(xs:dayTimeDuration(\"P01DT01H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "hours-from-duration" function used as arguments to an avg function. . */ @org.junit.Test public void fnHoursFromDuration7() { final XQuery query = new XQuery( "fn:avg((fn:hours-from-duration(xs:dayTimeDuration(\"P23DT10H\")),fn:hours-from-duration(xs:dayTimeDuration(\"P21DT08H\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("9") ); } /** * Evaluates The "hours-from-duration" function as part of a "+" expression. . */ @org.junit.Test public void fnHoursFromDuration8() { final XQuery query = new XQuery( "fn:hours-from-duration(xs:dayTimeDuration(\"P21DT10H\")) + fn:hours-from-duration(xs:dayTimeDuration(\"P22DT20H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("30") ); } /** * Evaluates The "hours-from-duration" function as part of a "-" expression. . */ @org.junit.Test public void fnHoursFromDuration9() { final XQuery query = new XQuery( "fn:hours-from-duration(xs:dayTimeDuration(\"P30DT10H\")) - fn:hours-from-duration(xs:dayTimeDuration(\"P10DT02H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("8") ); } /** * Evaluates The "hours-from-duration" function with the arguments set as follows: $arg = xs:dayTimeDuration(lower bound) . */ @org.junit.Test public void fnHoursFromDuration1args1() { final XQuery query = new XQuery( "fn:hours-from-duration(xs:dayTimeDuration(\"P0DT0H0M0S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "hours-from-duration" function with the arguments set as follows: $arg = xs:dayTimeDuration(mid range) . */ @org.junit.Test public void fnHoursFromDuration1args2() { final XQuery query = new XQuery( "fn:hours-from-duration(xs:dayTimeDuration(\"P15DT11H59M59S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("11") ); } /** * Evaluates The "hours-from-duration" function with the arguments set as follows: $arg = xs:dayTimeDuration(upper bound) . */ @org.junit.Test public void fnHoursFromDuration1args3() { final XQuery query = new XQuery( "fn:hours-from-duration(xs:dayTimeDuration(\"P31DT23H59M59S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("23") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnHoursFromTime.java000066400000000000000000000325711222453003200300060ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the hours-from-time() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnHoursFromTime extends QT3TestSet { /** * A test whose essence is: `hours-from-time()`. . */ @org.junit.Test public void kHoursFromTimeFunc1() { final XQuery query = new XQuery( "hours-from-time()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `hours-from-time((), "Wrong param")`. . */ @org.junit.Test public void kHoursFromTimeFunc2() { final XQuery query = new XQuery( "hours-from-time((), \"Wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(hours-from-time(()))`. . */ @org.junit.Test public void kHoursFromTimeFunc3() { final XQuery query = new XQuery( "empty(hours-from-time(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `hours-from-time(()) instance of xs:integer?`. . */ @org.junit.Test public void kHoursFromTimeFunc4() { final XQuery query = new XQuery( "hours-from-time(()) instance of xs:integer?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `hours-from-time(xs:time("23:11:12.43")) eq 23`. . */ @org.junit.Test public void kHoursFromTimeFunc5() { final XQuery query = new XQuery( "hours-from-time(xs:time(\"23:11:12.43\")) eq 23", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "hours-from-time" function As per example 1 of the F&O specs . */ @org.junit.Test public void fnHoursFromTime1() { final XQuery query = new XQuery( "fn:hours-from-time(xs:time(\"11:23:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "11") ); } /** * Evaluates The "hours-from-time" function as part of a "*" expression. . */ @org.junit.Test public void fnHoursFromTime10() { final XQuery query = new XQuery( "fn:hours-from-time(xs:time(\"02:00:00Z\")) * fn:hours-from-time(xs:time(\"10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "20") ); } /** * Evaluates The "hours-from-time" function as part of a "div" expression. . */ @org.junit.Test public void fnHoursFromTime11() { final XQuery query = new XQuery( "fn:hours-from-time(xs:time(\"22:00:00Z\")) div fn:hours-from-time(xs:time(\"02:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "11") ); } /** * Evaluates The "hours-from-time" function as part of a "idiv" expression. . */ @org.junit.Test public void fnHoursFromTime12() { final XQuery query = new XQuery( "fn:hours-from-time(xs:time(\"10:00:00Z\")) idiv fn:hours-from-time(xs:time(\"02:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5") ); } /** * Evaluates The "hours-from-time" function as part of a "mod" expression. . */ @org.junit.Test public void fnHoursFromTime13() { final XQuery query = new XQuery( "fn:hours-from-time(xs:time(\"10:00:00Z\")) mod fn:hours-from-time(xs:time(\"03:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "hours-from-time" function as part of a "numeric-unary-plus" expression. . */ @org.junit.Test public void fnHoursFromTime14() { final XQuery query = new XQuery( "+fn:hours-from-time(xs:time(\"10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10") ); } /** * Evaluates The "hours-from-time" function as part of a "numeric-unary-minus" expression. . */ @org.junit.Test public void fnHoursFromTime15() { final XQuery query = new XQuery( "-fn:hours-from-time(xs:time(\"10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-10") ); } /** * Evaluates The "hours-from-time" function as part of a "numeric-equal" expression (eq operator) . */ @org.junit.Test public void fnHoursFromTime16() { final XQuery query = new XQuery( "fn:hours-from-time(xs:time(\"10:00:00Z\")) eq fn:hours-from-time(xs:time(\"10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "hours-from-time" function as part of a "numeric-equal" expression (ne operator) . */ @org.junit.Test public void fnHoursFromTime17() { final XQuery query = new XQuery( "fn:hours-from-time(xs:time(\"10:00:00Z\")) ne fn:hours-from-time(xs:time(\"01:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "hours-from-time" function as part of a "numeric-equal" expression (le operator) . */ @org.junit.Test public void fnHoursFromTime18() { final XQuery query = new XQuery( "fn:hours-from-time(xs:time(\"10:00:00Z\")) le fn:hours-from-time(xs:time(\"10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "hours-from-time" function as part of a "numeric-equal" expression (ge operator) . */ @org.junit.Test public void fnHoursFromTime19() { final XQuery query = new XQuery( "fn:hours-from-time(xs:time(\"10:00:00Z\")) ge fn:hours-from-time(xs:time(\"10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "hours-from-time" function As per example 2 of the F&O specs . */ @org.junit.Test public void fnHoursFromTime2() { final XQuery query = new XQuery( "fn:hours-from-time(xs:time(\"21:23:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "21") ); } /** * Evaluates The "hours-from-time" function As per example 3 of the F&O specs . */ @org.junit.Test public void fnHoursFromTime3() { final XQuery query = new XQuery( "fn:hours-from-time(xs:time(\"01:23:00+05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "hours-from-time" function As per example 4 of the F&O specs . */ @org.junit.Test public void fnHoursFromTime4() { final XQuery query = new XQuery( "fn:hours-from-time(fn:adjust-time-to-timezone(xs:time(\"01:23:00+05:00\"), xs:dayTimeDuration(\"PT0H\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "20") ); } /** * Evaluates The "hours-from-time" function using the empty sequence as an argument. Use count function to avoid empty file. . */ @org.junit.Test public void fnHoursFromTime5() { final XQuery query = new XQuery( "fn:count(fn:hours-from-time(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "hours-from-time" function that returns 0. . */ @org.junit.Test public void fnHoursFromTime6() { final XQuery query = new XQuery( "fn:hours-from-time(xs:time(\"00:20:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "hours-from-time" function that returns 23. . */ @org.junit.Test public void fnHoursFromTime7() { final XQuery query = new XQuery( "fn:hours-from-time(xs:time(\"23:20:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "23") ); } /** * Evaluates The "hours-from-time" function as part of a "+" expression. . */ @org.junit.Test public void fnHoursFromTime8() { final XQuery query = new XQuery( "fn:hours-from-time(xs:time(\"02:00:00Z\")) + fn:hours-from-time(xs:time(\"10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12") ); } /** * Evaluates The "hours-from-time" function as part of a "-" expression. . */ @org.junit.Test public void fnHoursFromTime9() { final XQuery query = new XQuery( "fn:hours-from-time(xs:time(\"10:00:00Z\")) - fn:hours-from-time(xs:time(\"09:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "hours-from-time" function with the arguments set as follows: $arg = xs:time(lower bound) . */ @org.junit.Test public void fnHoursFromTime1args1() { final XQuery query = new XQuery( "fn:hours-from-time(xs:time(\"00:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "hours-from-time" function with the arguments set as follows: $arg = xs:time(mid range) . */ @org.junit.Test public void fnHoursFromTime1args2() { final XQuery query = new XQuery( "fn:hours-from-time(xs:time(\"08:03:35Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "8") ); } /** * Evaluates The "hours-from-time" function with the arguments set as follows: $arg = xs:time(upper bound) . */ @org.junit.Test public void fnHoursFromTime1args3() { final XQuery query = new XQuery( "fn:hours-from-time(xs:time(\"23:59:59Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "23") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnId.java000066400000000000000000000530761222453003200256020ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the id() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnId extends QT3TestSet { /** * Wrong arguments to fn:id().. */ @org.junit.Test public void k2SeqIDFunc1() { final XQuery query = new XQuery( "id((), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Select elements with xml:id, and trigger node sorting.. */ @org.junit.Test public void k2SeqIDFunc10() { final XQuery query = new XQuery( "for $i in id((\"short\", \"positiveInteger\")) return $i/@name/string()", ctx); try { query.context(node(file("fn/id/UsingXMLId.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "positiveInteger short") ); } /** * Select elements with xml:id, and trigger node sorting.. */ @org.junit.Test public void k2SeqIDFunc11() { final XQuery query = new XQuery( "id((\"short\"), //xs:element/@name[. = \"positiveInteger\"])/@name", ctx); try { query.context(node(file("fn/id/UsingXMLId.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "short") ); } /** * Select elements with xml:id, trigger node sorting, and use an invalid NCName in the lookup.. */ @org.junit.Test public void k2SeqIDFunc12() { final XQuery query = new XQuery( "id((\".\", \"short\", \"123\"), //xs:element/@name[. = \"positiveInteger\"])/@name", ctx); try { query.context(node(file("fn/id/UsingXMLId.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "short") ); } /** * Use on xml:id with input strings which contains many IDREFs, and invalid ones too.. */ @org.junit.Test public void k2SeqIDFunc13() { final XQuery query = new XQuery( "fn:id(//b/@ref)/data(exactly-one(@*))", ctx); try { query.context(node(file("fn/id/XMLIDMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b c d e f i") ); } /** * Select elements with xml:id, and trigger node sorting: space-separated id list. */ @org.junit.Test public void k2SeqIDFunc14() { final XQuery query = new XQuery( "for $i in id((\"short positiveInteger\")) return $i/@name/string()", ctx); try { query.context(node(file("fn/id/UsingXMLId.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "positiveInteger short") ); } /** * Use on xml:id with input strings which contains many IDREFs, and invalid ones too; tab-separated id list. */ @org.junit.Test public void k2SeqIDFunc15() { final XQuery query = new XQuery( "fn:id(string-join(reverse(//b/@ref), '\t'))/data(exactly-one(@*))", ctx); try { query.context(node(file("fn/id/XMLIDMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b c d e f i") ); } /** * Wrong arguments to fn:id().. */ @org.junit.Test public void k2SeqIDFunc2() { final XQuery query = new XQuery( "(1, 2, 3)[id(\"ncname\", .)]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Wrong arguments to fn:id().. */ @org.junit.Test public void k2SeqIDFunc3() { final XQuery query = new XQuery( "(1, 2, 3)[id(\"ncname\")]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Use an invalid target node.. */ @org.junit.Test public void k2SeqIDFunc4() { final XQuery query = new XQuery( "\n" + " import module namespace copy=\"http://www.w3.org/QT3/copy\";\n" + " id(\"id\", copy:copy((//comment())[1]))\n" + " ", ctx); try { query.context(node(file("docs/auction.xml"))); query.addModule("http://www.w3.org/QT3/copy", file("fn/id/copy.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0001") ); } /** * Use an invalid target node.. */ @org.junit.Test public void k2SeqIDFunc5() { final XQuery query = new XQuery( "\n" + " import module namespace copy=\"http://www.w3.org/QT3/copy\";\n" + " id(\"id\", copy:copy((//processing-instruction())[1]))\n" + " ", ctx); try { query.context(node(file("docs/auction.xml"))); query.addModule("http://www.w3.org/QT3/copy", file("fn/id/copy.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0001") ); } /** * Use an invalid target node. */ @org.junit.Test public void k2SeqIDFunc6() { final XQuery query = new XQuery( "\n" + " import module namespace copy=\"http://www.w3.org/QT3/copy\";\n" + " id(\"id\", copy:copy(/*))\n" + " ", ctx); try { query.context(node(file("docs/auction.xml"))); query.addModule("http://www.w3.org/QT3/copy", file("fn/id/copy.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0001") ); } /** * Use an invalid target node. */ @org.junit.Test public void k2SeqIDFunc7() { final XQuery query = new XQuery( "\n" + " import module namespace copy=\"http://www.w3.org/QT3/copy\";\n" + " id(\"id\", (copy:copy(/*)//*:NegativeComments)[last()])\n" + " ", ctx); try { query.context(node(file("docs/auction.xml"))); query.addModule("http://www.w3.org/QT3/copy", file("fn/id/copy.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0001") ); } /** * Use an invalid target node.. */ @org.junit.Test public void k2SeqIDFunc8() { final XQuery query = new XQuery( "let $i := return id(\"foo\", $i)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0001") ); } /** * Use a constructed document node with xml:id.. */ @org.junit.Test public void k2SeqIDFunc9() { final XQuery query = new XQuery( "let $i := document { } return id(\"foo\", $i)/name()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "b") ); } /** * test fn:id on the empty sequence . */ @org.junit.Test public void cbclId001() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:generate($arg as xs:integer?) as xs:string* { if ($arg = 0) then () else 'id1', 'id2' }; \n" + " \tlet $doc := document { } return fn:empty( fn:id( local:generate(0), $doc) )\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:id on the empty sequence . */ @org.junit.Test public void cbclId002() { final XQuery query = new XQuery( "\n" + " \tlet $doc := document { } return fn:empty( fn:id( (), $doc) )\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * test fn:id in an axis expression . */ @org.junit.Test public void cbclId003() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:generate($arg as xs:integer?) as xs:string* { if ($arg = 0) then () else 'id1', 'id2' }; \n" + " \tlet $doc := document { } return fn:empty( $doc/fn:id( local:generate(0)) )\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of fn:id with incorrect arity.. */ @org.junit.Test public void fnId1() { final XQuery query = new XQuery( "fn:id(\"argument 1\", / ,\"Argument 3\")", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Evaluation of fn:id with context item not a node.. */ @org.junit.Test public void fnId2() { final XQuery query = new XQuery( "(1 to 5)[fn:id(\"argument1\")]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluation of fn:id with context item not a node and second argument set to ".".. */ @org.junit.Test public void fnId22() { final XQuery query = new XQuery( "(1 to 5)[ fn:id(\"argument1\",.)]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluation of fn:id with second argument not a node.. */ @org.junit.Test public void fnId3() { final XQuery query = new XQuery( "fn:id(\"argument1\", \"A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluation of fn:id with node not being from document where root is the document element.. */ @org.junit.Test public void fnId4() { final XQuery query = new XQuery( "\n" + " import module namespace copy=\"http://www.w3.org/QT3/copy\";\n" + " let $var := copy:copy(/*) return fn:id(\"argument1\", $var)\n" + " ", ctx); try { query.context(node(file("docs/auction.xml"))); query.addModule("http://www.w3.org/QT3/copy", file("fn/id/copy.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0001") ); } /** * Evaluation of fn:id with multiple IDREF, but none matching one element.. */ @org.junit.Test public void fnIdDtd10() { final XQuery query = new XQuery( "fn:count(fn:id(\"nomatching1 nomatching2\", /IDS[1]))", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of fn:id with IDREF set to empty string.. */ @org.junit.Test public void fnIdDtd11() { final XQuery query = new XQuery( "fn:id(\"\", /IDS[1])", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of fn:id function that give first argument as argument to fn:substring.. */ @org.junit.Test public void fnIdDtd12() { final XQuery query = new XQuery( "fn:id(fn:substring(\"1id3\",2), /IDS[1])/name()", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "elementwithid-3") ); } /** * Evaluation of fn:id, where the same IDREF makes reference to the same element.. */ @org.junit.Test public void fnIdDtd13() { final XQuery query = new XQuery( "fn:id(\"id4\", /IDS[1])/name()", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "elementwithid-4") ); } /** * Evaluation of fn:id for which the given IDREF contains a prefix.. */ @org.junit.Test public void fnIdDtd14() { final XQuery query = new XQuery( "fn:id(\"p1:id5\", /IDS[1])", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of fn:id for which IDREF list have the same value for all its members.. */ @org.junit.Test public void fnIdDtd15() { final XQuery query = new XQuery( "fn:id(\"id1 id1\", /IDS[1])/name()", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "elementwithid-1") ); } /** * Evaluation of fn:id for which IDREF list have the same value for all its members but different case.. */ @org.junit.Test public void fnIdDtd16() { final XQuery query = new XQuery( "fn:id(\"id1 ID1\", /IDS[1])/name()", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "elementwithid-1") ); } /** * Evaluation of fn:id for which IDREF uses the fn lower case function.. */ @org.junit.Test public void fnIdDtd17() { final XQuery query = new XQuery( "fn:id(fn:lower-case(\"ID1\"), /IDS[1])/name()", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "elementwithid-1") ); } /** * Evaluation of fn:id for which IDREF uses the fn:upper-case function.. */ @org.junit.Test public void fnIdDtd18() { final XQuery query = new XQuery( "fn:id(fn:upper-case(\"id5\"), /IDS[1])/name()", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "elementwithid-6") ); } /** * Evaluation of fn:id for which $arg uses the fn:concat function.. */ @org.junit.Test public void fnIdDtd19() { final XQuery query = new XQuery( "fn:id(fn:concat(\"i\",\"d1\"), /IDS[1])/name()", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "elementwithid-1") ); } /** * Evaluation of fn:id for which $arg uses the xs:string function.. */ @org.junit.Test public void fnIdDtd20() { final XQuery query = new XQuery( "fn:id(xs:string(\"id1\"), /IDS[1])/name()", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "elementwithid-1") ); } /** * Evaluation of fn:id for which $arg uses the fn:string-join function.. */ @org.junit.Test public void fnIdDtd21() { final XQuery query = new XQuery( "fn:id(fn:string-join((\"id\",\"1\"),\"\"), /IDS[1])/name()", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "elementwithid-1") ); } /** * Evaluation of fn:id together with declare ordering.. */ @org.junit.Test public void fnIdDtd23() { final XQuery query = new XQuery( "declare ordering ordered; fn:id(\"id1 id2\", /IDS[1])/name()", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "elementwithid-1 elementwithid-2") ); } /** * Evaluation of fn:id with given IDREF matching a single element.. */ @org.junit.Test public void fnIdDtd5() { final XQuery query = new XQuery( "fn:id(\"id1\", /IDS[1])/string(@anId)", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "id1") ); } /** * Evaluation of fn:id with given IDREF not matching a single element.. */ @org.junit.Test public void fnIdDtd6() { final XQuery query = new XQuery( "fn:count(fn:id(\"nomatchingid\", /IDS[1]))", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of fn:id with given IDREF matching same element.. */ @org.junit.Test public void fnIdDtd7() { final XQuery query = new XQuery( "fn:id(\"id2 id2\", /IDS[1])/name()", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "elementwithid-2") ); } /** * Evaluation of fn:id with multiple IDREF matching multiple elements.. */ @org.junit.Test public void fnIdDtd8() { final XQuery query = new XQuery( "fn:id(\"id1 id2\", /IDS[1])/name()", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "elementwithid-1 elementwithid-2") ); } /** * Evaluation of fn:id with multiple IDREF, but only one matching one element.. */ @org.junit.Test public void fnIdDtd9() { final XQuery query = new XQuery( "fn:id(\"id1 nomatching\", /IDS[1])/name()", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "elementwithid-1") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnIdref.java000066400000000000000000000403031222453003200262640ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the idref() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnIdref extends QT3TestSet { /** * Wrong arguments to fn:idref(). . */ @org.junit.Test public void k2SeqIDREFFunc1() { final XQuery query = new XQuery( "idref((), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Wrong arguments to fn:idref(). . */ @org.junit.Test public void k2SeqIDREFFunc2() { final XQuery query = new XQuery( "(1, 2, 3)[idref(\"ncname\", .)]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Wrong arguments to fn:idref(). . */ @org.junit.Test public void k2SeqIDREFFunc3() { final XQuery query = new XQuery( "(1, 2, 3)[idref(\"ncname\")]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test fn:idref on the empty sequence . */ @org.junit.Test public void cbclIdref001() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:generate($arg as xs:integer?) as xs:string* { if ($arg = 0) then () else 'id1', 'id2' }; \n" + " \tlet $doc := document { } return fn:empty( fn:idref( local:generate(0), $doc) )\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:idref on the empty sequence . */ @org.junit.Test public void cbclIdref002() { final XQuery query = new XQuery( "\n" + " \tlet $doc := document { } return fn:empty( fn:idref( (), $doc) )\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * test fn:idref in an axis expression . */ @org.junit.Test public void cbclIdref003() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:generate($arg as xs:integer?) as xs:string* { if ($arg = 0) then () else 'id1', 'id2' }; \n" + " \tlet $doc := document { } return fn:empty( $doc/fn:idref( local:generate(0)) )\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of fn:idref with incorrect arity.. */ @org.junit.Test public void fnIdref1() { final XQuery query = new XQuery( "fn:idref(\"argument 1\", / ,\"Argument 3\")", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Evaluation of fn:idref with context item not a node. . */ @org.junit.Test public void fnIdref2() { final XQuery query = new XQuery( "(1 to 10)[fn:idref(\"argument1\")]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluation of fn:idref with context item not a node and second argument set to ".". . */ @org.junit.Test public void fnIdref22() { final XQuery query = new XQuery( "fn:idref(\"argument1\",.)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Evaluation of fn:idref with second argument not a node. . */ @org.junit.Test public void fnIdref3() { final XQuery query = new XQuery( "fn:idref(\"argument1\", \"A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluation of fn:idref with node not being from document where root is the document element. . */ @org.junit.Test public void fnIdref4() { final XQuery query = new XQuery( "\n" + " import module namespace copy=\"http://www.w3.org/QT3/copy\";\n" + " let $var := copy:copy(/*) return fn:idref(\"argument1\", $var)\n" + " ", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.addModule("http://www.w3.org/QT3/copy", file("fn/id/copy.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0001") ); } /** * Evaluation of fn:idref with multiple ID, but none matching one element. . */ @org.junit.Test public void fnIdrefDtd10() { final XQuery query = new XQuery( "fn:count(fn:idref(\"nomatching1 nomatching2\", /IDS[1]))", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of fn:idref with ID set to empty string. . */ @org.junit.Test public void fnIdrefDtd11() { final XQuery query = new XQuery( "fn:count(fn:idref(\"\", /IDS[1]))", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluation of fn:idref used as an argument to function fn:node-name() . */ @org.junit.Test public void fnIdrefDtd12() { final XQuery query = new XQuery( "fn:node-name(fn:idref(\"id2\", /IDS[1]))", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "anIdRef") ); } /** * Evaluation of fn:idref used as part of a node expression ("is" operand). Compare same elements. . */ @org.junit.Test public void fnIdrefDtd13() { final XQuery query = new XQuery( "(fn:idref(\"id1\", /IDS[1])) is (fn:idref(\"id1\", /IDS[1]))", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of fn:idref used as part of a node expression ("is" operand). Compare different elements. . */ @org.junit.Test public void fnIdrefDtd14() { final XQuery query = new XQuery( "(fn:idref(\"id1\", /IDS[1])) is (fn:idref(\"id2\", /IDS[1]))", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of fn:idref for which ID list have the same value for all its members. . */ @org.junit.Test public void fnIdrefDtd15() { final XQuery query = new XQuery( "count(fn:idref((\"id1\",\"id1\"), /IDS[1]))", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluation of fn:idref for which ID list have the same value for all its members but different case. . */ @org.junit.Test public void fnIdrefDtd16() { final XQuery query = new XQuery( "count(fn:idref((\"id1\",\"ID1\"), /IDS[1]))", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluation of fn:idref for which ID uses the fn lower case function. . */ @org.junit.Test public void fnIdrefDtd17() { final XQuery query = new XQuery( "fn:idref(fn:lower-case(\"ID1\"), /IDS[1])/name(..)", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "elementwithidrefattr-1") ); } /** * Evaluation of fn:idref for which ID uses the fn:upper-case function. . */ @org.junit.Test public void fnIdrefDtd18() { final XQuery query = new XQuery( "fn:idref(fn:upper-case(\"id5\"), /IDS[1])/name(..)", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "elementwithidrefattr-6") ); } /** * Evaluation of fn:idref for which $arg uses the fn:concat function. . */ @org.junit.Test public void fnIdrefDtd19() { final XQuery query = new XQuery( "fn:idref(fn:concat(\"i\",\"d1\"), /IDS[1])/name(..)", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "elementwithidrefattr-1") ); } /** * Evaluation of fn:idref for which $arg uses the xs:string function. . */ @org.junit.Test public void fnIdrefDtd20() { final XQuery query = new XQuery( "fn:idref(xs:string(\"id1\"), /IDS[1])/name(..)", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "elementwithidrefattr-1") ); } /** * Evaluation of fn:idref for which $arg uses the fn:string-join function. . */ @org.junit.Test public void fnIdrefDtd21() { final XQuery query = new XQuery( "fn:idref(fn:string-join((\"id\",\"1\"),\"\"), /IDS[1])/name(..)", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "elementwithidrefattr-1") ); } /** * Evaluation of fn:idref with declare ordering. . */ @org.junit.Test public void fnIdrefDtd23() { final XQuery query = new XQuery( "declare ordering ordered; \n" + " {fn:idref(\"id4\", /IDS[1])}", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Evaluation of fn:idref, where an IDREFS node contains multiple IDREFs. For errata FO.E29. . */ @org.junit.Test public void fnIdrefDtd24() { final XQuery query = new XQuery( "{fn:idref(\"language\", /)}", ctx); try { query.context(node(file("app/FunctxFn/functx_book.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Evaluation of fn:idref with no second argument.. */ @org.junit.Test public void fnIdrefDtd25() { final XQuery query = new XQuery( "fn:idref(\"id1\")/name(..)", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "elementwithidrefattr-1") ); } /** * Evaluation of fn:idref with given ID matching a single element. . */ @org.junit.Test public void fnIdrefDtd5() { final XQuery query = new XQuery( "fn:idref(\"id1\",/IDS[1])/name(..)", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "elementwithidrefattr-1") ); } /** * Evaluation of fn:idref with given ID not matching a single element. . */ @org.junit.Test public void fnIdrefDtd6() { final XQuery query = new XQuery( "fn:idref(\"nomatchingid\", /IDS[1])", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of fn:idref with given ID matching multiple elements. . */ @org.junit.Test public void fnIdrefDtd7() { final XQuery query = new XQuery( "fn:idref(\"id4\", /IDS[1])/name(..)", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "elementwithidrefattr-4") ); } /** * Evaluation of fn:idref function, which attempts to create element with two attributes with same name. . */ @org.junit.Test public void fnIdrefDtd8() { final XQuery query = new XQuery( "{fn:idref((\"id1\", \"id2\"), /IDS[1])}", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0025") ); } /** * Evaluation of fn:idref with multiple ID, but only one matching one element. . */ @org.junit.Test public void fnIdrefDtd9() { final XQuery query = new XQuery( "fn:idref((\"id1\", \"nomatching\"), /IDS[1])/name(..)", ctx); try { query.context(node(file("fn/id/iddtd.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "elementwithidrefattr-1") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnImplicitTimezone.java000066400000000000000000000331051222453003200305220ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the implicit-timezone() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnImplicitTimezone extends QT3TestSet { /** * A test whose essence is: `implicit-timezone("WRONG PARAM")`. . */ @org.junit.Test public void kContextImplicitTimezoneFunc1() { final XQuery query = new XQuery( "implicit-timezone(\"WRONG PARAM\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Simple test of implicit-timezone(). . */ @org.junit.Test public void kContextImplicitTimezoneFunc2() { final XQuery query = new XQuery( "seconds-from-duration(implicit-timezone()) le 0 or seconds-from-duration(implicit-timezone()) gt 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that implicit-timezone() do return a value. . */ @org.junit.Test public void kContextImplicitTimezoneFunc3() { final XQuery query = new XQuery( "exists(seconds-from-duration(implicit-timezone()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Description Evaluation of "fn:implicit-timezone" with incorrect arity. . */ @org.junit.Test public void fnImplicitTimezone1() { final XQuery query = new XQuery( "fn:implicit-timezone(\"Argument 1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Evaluation of "fn:implicit-timezone" as part of a division operation. Second argument results in NaN . */ @org.junit.Test public void fnImplicitTimezone10() { final XQuery query = new XQuery( "fn:string(fn:implicit-timezone() div ( 0 div 0E0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0005") ); } /** * Evaluation of "fn:implicit-timezone" as part of a division operation. Second argument is 0. . */ @org.junit.Test public void fnImplicitTimezone11() { final XQuery query = new XQuery( "fn:string(fn:implicit-timezone() div 0 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * Evaluation of "fn:implicit-timezone" as part of a division operation. Second argument is -0. . */ @org.junit.Test public void fnImplicitTimezone12() { final XQuery query = new XQuery( "fn:string(fn:implicit-timezone() div -0 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * Evaluation of "fn:implicit-timezone" as part of a division operation. Both operands includes the fn:implicit-timezone. . */ @org.junit.Test public void fnImplicitTimezone13() { final XQuery query = new XQuery( "(implicit-timezone() + xs:dayTimeDuration('PT1S')) div (implicit-timezone() + xs:dayTimeDuration('PT1S'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluation of "fn:implicit-timezone" as part of a division operation. Second operand is a call to xs:dayTimeDuration function. . */ @org.junit.Test public void fnImplicitTimezone14() { final XQuery query = new XQuery( "fn:string(fn:implicit-timezone() div xs:dayTimeDuration(\"P0DT60M00S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:string") ); } /** * Evaluation of "fn:implicit-timezone" as part of an addition operation. First operand is a call to xs:time function. . */ @org.junit.Test public void fnImplicitTimezone15() { final XQuery query = new XQuery( "xs:time(\"05:00:00\") + fn:implicit-timezone()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:time") ); } /** * Evaluation of "fn:implicit-timezone" as part of a subtraction operation. First operand is a call to xs:time function. . */ @org.junit.Test public void fnImplicitTimezone16() { final XQuery query = new XQuery( "xs:time(\"05:00:00\") - fn:implicit-timezone()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:time") ); } /** * Evaluation of "fn:implicit-timezone" as part of a subtraction operation. First operand is a call to xs:date function. . */ @org.junit.Test public void fnImplicitTimezone17() { final XQuery query = new XQuery( "(xs:date(\"2000-10-30\") - fn:implicit-timezone())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:date") ); } /** * Evaluation of "fn:implicit-timezone" as part of an addition operation. First operand is a call to xs:date function. . */ @org.junit.Test public void fnImplicitTimezone18() { final XQuery query = new XQuery( "(xs:date(\"2000-10-30\") + fn:implicit-timezone())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:date") ); } /** * Evaluation of "fn:implicit-timezone" as part of a subtraction operation. First operand is a call to xs:dateTime function. . */ @org.junit.Test public void fnImplicitTimezone19() { final XQuery query = new XQuery( "(xs:dateTime(\"2000-10-30T11:12:00\") - fn:implicit-timezone())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:dateTime") ); } /** * Normal call to "fn:implicit-timezone". . */ @org.junit.Test public void fnImplicitTimezone2() { final XQuery query = new XQuery( "fn:implicit-timezone()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:dayTimeDuration") ); } /** * Evaluation of "fn:implicit-timezone" as part of an addition operation. First operand is a call to xs:dateTime function. . */ @org.junit.Test public void fnImplicitTimezone20() { final XQuery query = new XQuery( "(xs:dateTime(\"2000-10-30T11:12:00\") + fn:implicit-timezone())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:dateTime") ); } /** * Evaluation of "fn:implicit-timezone" as an an argument to the adjust-date-to-timezone function. . */ @org.junit.Test public void fnImplicitTimezone21() { final XQuery query = new XQuery( "(fn:adjust-date-to-timezone(xs:date(\"2000-10-30\"),fn:implicit-timezone()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:date") ); } /** * Evaluation of "fn:implicit-timezone" as an an argument to the adjust-time-to-timezone function. . */ @org.junit.Test public void fnImplicitTimezone22() { final XQuery query = new XQuery( "(fn:adjust-time-to-timezone(xs:time(\"10:00:00\"),fn:implicit-timezone()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:time") ); } /** * Evaluation of "fn:implicit-timezone" as an an argument to the adjust-dateTime-to-timezone function. . */ @org.junit.Test public void fnImplicitTimezone23() { final XQuery query = new XQuery( "(fn:adjust-dateTime-to-timezone(xs:dateTime(\"2002-03-07T10:00:00\"),fn:implicit-timezone()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:dateTime") ); } /** * Test that implicit timezone is in range -14h to +14h. */ @org.junit.Test public void fnImplicitTimezone24() { final XQuery query = new XQuery( "implicit-timezone() ge xs:dayTimeDuration('-PT14H') and implicit-timezone() le xs:dayTimeDuration('PT14H')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of "fn:implicit-timezone" as part of an addition operation. . */ @org.junit.Test public void fnImplicitTimezone3() { final XQuery query = new XQuery( "fn:string(fn:implicit-timezone() + fn:implicit-timezone())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:string") ); } /** * Evaluation of "fn:implicit-timezone" as part of a subtraction operation. . */ @org.junit.Test public void fnImplicitTimezone4() { final XQuery query = new XQuery( "fn:string(fn:implicit-timezone() - fn:implicit-timezone())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Evaluation of "fn:implicit-timezone" as part of a multiplication operation. . */ @org.junit.Test public void fnImplicitTimezone5() { final XQuery query = new XQuery( "fn:implicit-timezone() * xs:double(2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:dayTimeDuration") ); } /** * Evaluation of "fn:implicit-timezone" as part of a multiplication operation. Second argument is NaN . */ @org.junit.Test public void fnImplicitTimezone6() { final XQuery query = new XQuery( "fn:string(fn:implicit-timezone() * (0 div 0E0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0005") ); } /** * Evaluation of "fn:implicit-timezone" as part of a multiplication operation. Second argument is 0 . */ @org.junit.Test public void fnImplicitTimezone7() { final XQuery query = new XQuery( "fn:string(fn:implicit-timezone() * 0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Evaluation of "fn:implicit-timezone" as part of a multiplication operation. Second argument is -0 . */ @org.junit.Test public void fnImplicitTimezone8() { final XQuery query = new XQuery( "fn:string(fn:implicit-timezone() * -0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Evaluation of "fn:implicit-timezone" as part of a division operation. . */ @org.junit.Test public void fnImplicitTimezone9() { final XQuery query = new XQuery( "fn:string(fn:implicit-timezone() div xs:double(2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:string") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnInScopePrefixes.java000066400000000000000000001034001222453003200302770ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the in-scope-prefixes() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnInScopePrefixes extends QT3TestSet { /** * A test whose essence is: `in-scope-prefixes()`. . */ @org.junit.Test public void kInScopePrefixesFunc1() { final XQuery query = new XQuery( "in-scope-prefixes()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `in-scope-prefixes("string", "nodetest", "wrong param")`. . */ @org.junit.Test public void kInScopePrefixesFunc2() { final XQuery query = new XQuery( "in-scope-prefixes(\"string\", \"nodetest\", \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * For a directly constructed element fn:in-scope-prefixes() returns 'xml' and the zero length string for the default element namespace. . */ @org.junit.Test public void k2InScopePrefixesFunc1() { final XQuery query = new XQuery( "count(in-scope-prefixes())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Check that a default namespace declaration is picked up. . */ @org.junit.Test public void k2InScopePrefixesFunc10() { final XQuery query = new XQuery( "declare default element namespace \"http://www.example.com\"; count(fn:in-scope-prefixes())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Check the in-scope namespaces of different elements, constructed with direct constructors. . */ @org.junit.Test public void k2InScopePrefixesFunc11() { final XQuery query = new XQuery( "declare default element namespace \"http://www.example.com/\"; let $i :=
    return (count(in-scope-prefixes($i)), count(in-scope-prefixes(exactly-one($i/*[namespace-uri() eq \"\"]))), count(in-scope-prefixes(exactly-one($i/b))), count(in-scope-prefixes(exactly-one($i/*[namespace-uri() eq \"http://www.example.com/Second\"]))), $i)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("2 1 2 2", false) ); } /** * Check the in-scope namespaces of different elements, constructed with computed constructors. . */ @org.junit.Test public void k2InScopePrefixesFunc12() { final XQuery query = new XQuery( "declare default element namespace \"http://www.example.com/\"; let $i := element e { element {QName(\"\", \"a\")} {}, element {QName(\"http://www.example.com/\", \"b\")} {}, element {QName(\"http://www.example.com/Second\", \"c\")} {} } return (count(in-scope-prefixes($i)), count(in-scope-prefixes(exactly-one($i/*[namespace-uri() eq \"\"]))), count(in-scope-prefixes(exactly-one($i/b))), count(in-scope-prefixes(exactly-one($i/*[namespace-uri() eq \"http://www.example.com/Second\"]))), $i)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("2 1 2 2", false) ); } /** * Ensure the in-scope prefixes are correct with computed constructors when combined with a default element namespace declaration. . */ @org.junit.Test public void k2InScopePrefixesFunc13() { final XQuery query = new XQuery( "declare default element namespace \"http://www.example.com/\"; let $i := element e { element b {()} } return (count(in-scope-prefixes($i/b)), count(in-scope-prefixes($i)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2 2") ); } /** * Check the in-scope namespaces of a single, computed element. . */ @org.junit.Test public void k2InScopePrefixesFunc14() { final XQuery query = new XQuery( "count(in-scope-prefixes(element e{()}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Ensure the in-scope prefixes are correct with computed constructors. . */ @org.junit.Test public void k2InScopePrefixesFunc15() { final XQuery query = new XQuery( "let $i := element e { element b {()} } return (count(in-scope-prefixes($i/b)), count(in-scope-prefixes($i)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 1") ); } /** * Check that a default namespace declaration attribute on a direct element constructor * correctly affect a computed child constructor. . */ @org.junit.Test public void k2InScopePrefixesFunc16() { final XQuery query = new XQuery( "\n" + " let $i := \n" + " {element a {()}} \n" + " \n" + " return (count(in-scope-prefixes($i)), count(in-scope-prefixes(exactly-one($i/*))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2 2") ); } /** * Ensure the namespace used in the name is part of the in-scope prefixes. . */ @org.junit.Test public void k2InScopePrefixesFunc17() { final XQuery query = new XQuery( "declare namespace p = \"http://example.com/\"; count(in-scope-prefixes()), count(in-scope-prefixes(element p:e {()}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2 2") ); } /** * Ensure prefix namespace declarations are counted as in-scope bindings. . */ @org.junit.Test public void k2InScopePrefixesFunc18() { final XQuery query = new XQuery( "declare default element namespace \"http://example.com/\"; { count(in-scope-prefixes()), count(in-scope-prefixes(element e {()})) } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("3 3", false) ); } /** * Count the in-scope namespaces of a node with name xml:space. . */ @org.junit.Test public void k2InScopePrefixesFunc19() { final XQuery query = new XQuery( "count(in-scope-prefixes(element xml:space {()}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * For a computed element fn:in-scope-prefixes() returns 'xml'. . */ @org.junit.Test public void k2InScopePrefixesFunc2() { final XQuery query = new XQuery( "count(in-scope-prefixes(element name {7}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Count the in-scope namespaces of a node with name fn:space. . */ @org.junit.Test public void k2InScopePrefixesFunc20() { final XQuery query = new XQuery( "count(in-scope-prefixes(element fn:space {()}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Count the in-scope namespaces of a node with name fn:space. . */ @org.junit.Test public void k2InScopePrefixesFunc21() { final XQuery query = new XQuery( "count(in-scope-prefixes(element xs:space {()}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Count the in-scope namespaces of a node with name fn:space(#2). . */ @org.junit.Test public void k2InScopePrefixesFunc22() { final XQuery query = new XQuery( "count(in-scope-prefixes())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Count the in-scope namespaces of a node with name fn:space(#2). . */ @org.junit.Test public void k2InScopePrefixesFunc23() { final XQuery query = new XQuery( "count(in-scope-prefixes())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Ensure a prolog namespace declaration isn't in the in-scope bindings unless it's used. . */ @org.junit.Test public void k2InScopePrefixesFunc24() { final XQuery query = new XQuery( "declare namespace p = \"http://example.com/\"; count(in-scope-prefixes())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Check the in-scope namespaces of two nodes. . */ @org.junit.Test public void k2InScopePrefixesFunc25() { final XQuery query = new XQuery( "\n" + " declare namespace a = \"http://example.com/1\"; \n" + " declare namespace b = \"http://example.com/2\"; \n" + " declare namespace unused = \"http://example.com/3\"; \n" + " declare namespace unused2 = \"http://example.com/4\"; \n" + " [2], \n" + " /\n" + " (for $i in in-scope-prefixes(.) order by $i return $i, \n" + " '|', \n" + " for $i in a:n1/in-scope-prefixes(.) order by $i return $i)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b xml | a b xml") ); } /** * . . */ @org.junit.Test public void k2InScopePrefixesFunc26() { final XQuery query = new XQuery( "let $i := { attribute {QName(\"http://example.com/\", \"prefix:attributeName\")} {()} } return ($i, for $ps in in-scope-prefixes($i) order by $ps return $ps)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("prefix xml", false) ); } /** * Check in scope namespaces. . */ @org.junit.Test public void k2InScopePrefixesFunc27() { final XQuery query = new XQuery( "declare namespace a = \"http://example.com/1\"; declare namespace b = \"http://example.com/2\"; /(for $i in in-scope-prefixes(.) order by $i return $i)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b xml") ); } /** * Check in-scope declaration of a tree fragment overriding and undeclaration the default namespace. . */ @org.junit.Test public void k2InScopePrefixesFunc28() { final XQuery query = new XQuery( "declare default element namespace \"http://www.example.com/\"; let $i := return (count(in-scope-prefixes($i)), count(in-scope-prefixes(exactly-one($i/*[namespace-uri() eq \"\"]))), count(in-scope-prefixes(exactly-one($i/b))), count(in-scope-prefixes(exactly-one($i/*[namespace-uri() eq \"http://www.example.com/Second\"]))), $i)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("2 1 2 2", false) ); } /** * Use a computed element constructor which undeclares the default namespace, as operand to a path expression. . */ @org.junit.Test public void k2InScopePrefixesFunc29() { final XQuery query = new XQuery( "declare default element namespace \"http://www.example.com/\"; /element e { element {QName(\"\", \"a\")} {} }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * in-scope-prefixes() can't take text nodes. . */ @org.junit.Test public void k2InScopePrefixesFunc3() { final XQuery query = new XQuery( "in-scope-prefixes(text {\"some text\"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Use a computed element constructor which undeclares the default namespace, as operand to a path expression(#2). . */ @org.junit.Test public void k2InScopePrefixesFunc30() { final XQuery query = new XQuery( "declare default element namespace \"http://www.example.com/\"; /element e { element {QName(\"http://example.com/2\", \"p:a\")} {} }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * in-scope-prefixes() can't take text nodes. . */ @org.junit.Test public void k2InScopePrefixesFunc4() { final XQuery query = new XQuery( "in-scope-prefixes(comment {\"content\"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * in-scope-prefixes() can't take processing instructions. . */ @org.junit.Test public void k2InScopePrefixesFunc5() { final XQuery query = new XQuery( "in-scope-prefixes()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Ensure the default element namespace is in-scope properly. . */ @org.junit.Test public void k2InScopePrefixesFunc6() { final XQuery query = new XQuery( "count(in-scope-prefixes())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("4") ); } /** * Ensure the default namespace is properly handled. . */ @org.junit.Test public void k2InScopePrefixesFunc7() { final XQuery query = new XQuery( "count(in-scope-prefixes())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Ensure the in-scope prefixes dealt with correctly for double default namespace declarations of different kinds. . */ @org.junit.Test public void k2InScopePrefixesFunc8() { final XQuery query = new XQuery( "declare default element namespace \"http://www.example.com/A\"; count(in-scope-prefixes())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Check that a prefix declaration is in scope in a sub-node. . */ @org.junit.Test public void k2InScopePrefixesFunc9() { final XQuery query = new XQuery( "for $i in fn:in-scope-prefixes( /b) order by $i return $i", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a p xml") ); } /** * Evaluation of fn:in-scope-prefixes function with incorrect arity. . */ @org.junit.Test public void fnInScopePrefixes1() { final XQuery query = new XQuery( "fn:in-scope-prefixes(,\"Second Argument\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Evaluation of fn:in-scope-prefixes function for a directly constructed element used as argument to fn:string-length. . */ @org.junit.Test public void fnInScopePrefixes10() { final XQuery query = new XQuery( "fn:string-length(fn:in-scope-prefixes(Some content)[1])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Evaluation of fn:in-scope-prefixes function for a directly constructed element used as argument to fn:upper-case. . */ @org.junit.Test public void fnInScopePrefixes11() { final XQuery query = new XQuery( "fn:upper-case(fn:in-scope-prefixes(Some content)[1])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "XML") ); } /** * Evaluation of fn:in-scope-prefixes function for a directly constructed element used as argument to fn:lower-case. . */ @org.junit.Test public void fnInScopePrefixes12() { final XQuery query = new XQuery( "fn:lower-case(fn:in-scope-prefixes(Some content)[1])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xml") ); } /** * Evaluation of fn:in-scope-prefixes function for a directly constructed element used as argument to fn:string-to-codepoints. . */ @org.junit.Test public void fnInScopePrefixes13() { final XQuery query = new XQuery( "fn:string-to-codepoints(fn:in-scope-prefixes(Some content)[1])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "120 109 108") ); } /** * Evaluation of fn:in-scope-prefixes function for a directly constructed element used as argument to xs:string. . */ @org.junit.Test public void fnInScopePrefixes14() { final XQuery query = new XQuery( "xs:string(fn:in-scope-prefixes(Some content)[1])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xml") ); } /** * Evaluation of fn:in-scope-prefixes function for a directly constructed element used as argument to fn:substring-before. . */ @org.junit.Test public void fnInScopePrefixes15() { final XQuery query = new XQuery( "fn:substring-before(fn:in-scope-prefixes(Some content)[1],\"m\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "x") ); } /** * Evaluation of fn:in-scope-prefixes function for a directly constructed element used as argument to fn:substring-after. . */ @org.junit.Test public void fnInScopePrefixes16() { final XQuery query = new XQuery( "fn:substring-after(fn:in-scope-prefixes(Some content)[1],\"m\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "l") ); } /** * Evaluation of fn:in-scope-prefixes function for a directly constructed element used as argument to fn:concat. . */ @org.junit.Test public void fnInScopePrefixes17() { final XQuery query = new XQuery( "fn:concat(fn:in-scope-prefixes(Some content),\"m\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xmlm") ); } /** * Evaluation of fn:in-scope-prefixes function for a directly constructed element used as argument to fn:string-join. . */ @org.junit.Test public void fnInScopePrefixes18() { final XQuery query = new XQuery( "fn:string-join((fn:in-scope-prefixes(Some content),\"xml\"),\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xmlxml") ); } /** * Evaluation of fn:in-scope-prefixes function for a directly constructed element used as argument to fn:susbtring. . */ @org.junit.Test public void fnInScopePrefixes19() { final XQuery query = new XQuery( "fn:substring(fn:in-scope-prefixes(Some content)[1],2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ml") ); } /** * Evaluation of fn:in-scope-prefixes function with incorrect argument type. . */ @org.junit.Test public void fnInScopePrefixes2() { final XQuery query = new XQuery( "fn:in-scope-prefixes(200)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluation of fn:in-scope-prefixes function for a directly constructed element used as argument to fn:contains. . */ @org.junit.Test public void fnInScopePrefixes20() { final XQuery query = new XQuery( "fn:contains(fn:in-scope-prefixes(Some content)[1],\"l\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of fn:in-scope-prefixes function for an external document. . */ @org.junit.Test public void fnInScopePrefixes21() { final XQuery query = new XQuery( "in-scope-prefixes(/*)", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"ma\", \"xlink\", \"anyzone\", \"eachbay\", \"yabadoo\", \"xml\"") ); } /** * Evaluation of fn:in-scope-prefixes function for an external document. . */ @org.junit.Test public void fnInScopePrefixes22() { final XQuery query = new XQuery( "in-scope-prefixes((//*)[19])", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"ma\", \"xlink\", \"anyzone\", \"eachbay\", \"yabadoo\", \"xml\"") ); } /** * Evaluation of fn:in-scope-prefixes function for an external document. . */ @org.junit.Test public void fnInScopePrefixes23() { final XQuery query = new XQuery( "in-scope-prefixes(/)", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluation of fn:in-scope-prefixes function for a document with namespaces declared in the DTD. . */ @org.junit.Test public void fnInScopePrefixes25() { final XQuery query = new XQuery( "in-scope-prefixes(/*)", ctx); try { query.context(node(file("fn/in-scope-prefixes/NamespaceSuppliedInternally.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"\", \"xml\", \"xlink\"") ); } /** * Evaluation of fn:in-scope-prefixes function for a document that undeclares the default namespace. . */ @org.junit.Test public void fnInScopePrefixes26() { final XQuery query = new XQuery( "in-scope-prefixes(/*/p)", ctx); try { query.context(node(file("fn/path/pathdata.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xml") ); } /** * Evaluation of fn:in-scope-prefixes function for a directly constructed element node. . */ @org.junit.Test public void fnInScopePrefixes3() { final XQuery query = new XQuery( "fn:in-scope-prefixes(some content)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xml") ); } /** * Evaluation of fn:in-scope-prefixes function for a directly constructed element node with a namespace declaration. . */ @org.junit.Test public void fnInScopePrefixes4() { final XQuery query = new XQuery( "fn:in-scope-prefixes(some content)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "xml p1") || assertStringValue(false, "p1 xml") ) ); } /** * Evaluation of fn:in-scope-prefixes function for a computed constructed element node with no namespace declaration. . */ @org.junit.Test public void fnInScopePrefixes5() { final XQuery query = new XQuery( "fn:in-scope-prefixes(element anElement {\"Some content\"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xml") ); } /** * Evaluation of fn:in-scope-prefixes function for a computed constructed element node and a default namesapce declaration. . */ @org.junit.Test public void fnInScopePrefixes6() { final XQuery query = new XQuery( "declare default element namespace \"http://www.example.com\"; let $seq := fn:in-scope-prefixes(element anElement {\"Some content\"}) return (count($seq),$seq=(\"xml\",\"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2 true") ); } /** * Evaluation of fn:in-scope-prefixes function for a directly constructed element node and a default namesapce declaration. . */ @org.junit.Test public void fnInScopePrefixes7() { final XQuery query = new XQuery( "declare default element namespace \"http://www.example.com\"; let $seq := fn:in-scope-prefixes(Some content) return (count($seq),$seq=(\"xml\",\"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2 true") ); } /** * Evaluation of fn:in-scope-prefixes function for a directly constructed element node with xmlns attribute and a prolog namesapce declaration. . */ @org.junit.Test public void fnInScopePrefixes8() { final XQuery query = new XQuery( "declare namespace p1 = \"http://www.example.com\"; fn:in-scope-prefixes(Some content)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "xml p1") || assertStringValue(false, "p1 xml") ) ); } /** * Evaluation of fn:in-scope-prefixes function for a directly constructed element node without xmlns attribute and a prolog namesapce declaration. . */ @org.junit.Test public void fnInScopePrefixes9() { final XQuery query = new XQuery( "declare namespace p1 = \"http://www.example.com\"; fn:in-scope-prefixes(Some content)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xml") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnIndexOf.java000066400000000000000000000606311222453003200265750ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the index-of function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnIndexOf extends QT3TestSet { /** * A test whose essence is: `index-of()`. . */ @org.junit.Test public void kSeqIndexOfFunc1() { final XQuery query = new XQuery( "index-of()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(index-of(xs:double("NaN"), xs:double("NaN")))`. . */ @org.junit.Test public void kSeqIndexOfFunc10() { final XQuery query = new XQuery( "empty(index-of(xs:double(\"NaN\"), xs:double(\"NaN\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(index-of(4, "4"))`. . */ @org.junit.Test public void kSeqIndexOfFunc11() { final XQuery query = new XQuery( "empty(index-of(4, \"4\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `index-of(4, 4)`. . */ @org.junit.Test public void kSeqIndexOfFunc12() { final XQuery query = new XQuery( "index-of(4, 4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * A test whose essence is: `empty(index-of((), 4))`. . */ @org.junit.Test public void kSeqIndexOfFunc13() { final XQuery query = new XQuery( "empty(index-of((), 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `index-of(4, 4)`. . */ @org.junit.Test public void kSeqIndexOfFunc14() { final XQuery query = new XQuery( "index-of(4, 4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * A test whose essence is: `deep-equal((1, 2, 3, 4, 5, 6), index-of((4, 4, 4, 4, 4, 4), 4))`. . */ @org.junit.Test public void kSeqIndexOfFunc15() { final XQuery query = new XQuery( "deep-equal((1, 2, 3, 4, 5, 6), index-of((4, 4, 4, 4, 4, 4), 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(index-of(xs:anyURI("example.com/"), xs:hexBinary("FF")))`. . */ @org.junit.Test public void kSeqIndexOfFunc16() { final XQuery query = new XQuery( "empty(index-of(xs:anyURI(\"example.com/\"), xs:hexBinary(\"FF\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `index-of(xs:untypedAtomic("example.com/"), xs:anyURI("example.com/"))`. . */ @org.junit.Test public void kSeqIndexOfFunc17() { final XQuery query = new XQuery( "index-of(xs:untypedAtomic(\"example.com/\"), xs:anyURI(\"example.com/\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * A test whose essence is: `deep-equal(index-of((1, 2, "three", 5, 5, 6), 5), (4, 5))`. . */ @org.junit.Test public void kSeqIndexOfFunc18() { final XQuery query = new XQuery( "deep-equal(index-of((1, 2, \"three\", 5, 5, 6), 5), (4, 5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(index-of((10, 20, 30, 40), 35))`. . */ @org.junit.Test public void kSeqIndexOfFunc19() { final XQuery query = new XQuery( "empty(index-of((10, 20, 30, 40), 35))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `index-of(1)`. . */ @org.junit.Test public void kSeqIndexOfFunc2() { final XQuery query = new XQuery( "index-of(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `deep-equal(index-of((10, 20, 30, 30, 20, 10), 20), (2, 5))`. . */ @org.junit.Test public void kSeqIndexOfFunc20() { final XQuery query = new XQuery( "deep-equal(index-of((10, 20, 30, 30, 20, 10), 20), (2, 5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal(index-of(("a", "sport", "and", "a", "pastime"), "a"), (1, 4))`. . */ @org.junit.Test public void kSeqIndexOfFunc21() { final XQuery query = new XQuery( "deep-equal(index-of((\"a\", \"sport\", \"and\", \"a\", \"pastime\"), \"a\"), (1, 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(index-of((1, 2, 3, 2, 1), 2)) eq 2`. . */ @org.junit.Test public void kSeqIndexOfFunc22() { final XQuery query = new XQuery( "count(index-of((1, 2, 3, 2, 1), 2)) eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(index-of((1, 2, 3, 2, 1), 1)) eq 2`. . */ @org.junit.Test public void kSeqIndexOfFunc23() { final XQuery query = new XQuery( "count(index-of((1, 2, 3, 2, 1), 1)) eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(index-of((1, 2, 3, 2, 1), 3)) eq 1`. . */ @org.junit.Test public void kSeqIndexOfFunc24() { final XQuery query = new XQuery( "count(index-of((1, 2, 3, 2, 1), 3)) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(index-of((1, 2, 3, 2, 1), 4)) eq 0`. . */ @org.junit.Test public void kSeqIndexOfFunc25() { final XQuery query = new XQuery( "count(index-of((1, 2, 3, 2, 1), 4)) eq 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `index-of((1, 2, 3), 1, ())`. . */ @org.junit.Test public void kSeqIndexOfFunc3() { final XQuery query = new XQuery( "index-of((1, 2, 3), 1, ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A test whose essence is: `index-of("a string", "a string", "http://www.example.com/COLLATION/NOT/SUPPORTED")`. . */ @org.junit.Test public void kSeqIndexOfFunc4() { final XQuery query = new XQuery( "index-of(\"a string\", \"a string\", \"http://www.example.com/COLLATION/NOT/SUPPORTED\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0002") ); } /** * A test whose essence is: `index-of("a string", "a string", "http://www.w3.org/2005/xpath-functions/collation/codepoint", "wrong param")`. . */ @org.junit.Test public void kSeqIndexOfFunc5() { final XQuery query = new XQuery( "index-of(\"a string\", \"a string\", \"http://www.w3.org/2005/xpath-functions/collation/codepoint\", \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `index-of("a string", "a string", "http://www.w3.org/2005/xpath-functions/collation/codepoint")`. . */ @org.junit.Test public void kSeqIndexOfFunc6() { final XQuery query = new XQuery( "index-of(\"a string\", \"a string\", \"http://www.w3.org/2005/xpath-functions/collation/codepoint\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * A test whose essence is: `empty(index-of(xs:double("NaN"), xs:float("NaN")))`. . */ @org.junit.Test public void kSeqIndexOfFunc7() { final XQuery query = new XQuery( "empty(index-of(xs:double(\"NaN\"), xs:float(\"NaN\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(index-of(xs:float("NaN"), xs:double("NaN")))`. . */ @org.junit.Test public void kSeqIndexOfFunc8() { final XQuery query = new XQuery( "empty(index-of(xs:float(\"NaN\"), xs:double(\"NaN\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(index-of(xs:float("NaN"), xs:float("NaN")))`. . */ @org.junit.Test public void kSeqIndexOfFunc9() { final XQuery query = new XQuery( "empty(index-of(xs:float(\"NaN\"), xs:float(\"NaN\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Tests corner case . */ @org.junit.Test public void cbclFnIndexof006() { final XQuery query = new XQuery( "index-of(1 to 10,(1 to 10)[. div 2 = 0][1])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test an index-of on a range expression . */ @org.junit.Test public void cbclFnIndexof1() { final XQuery query = new XQuery( "index-of(1 to 5,4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4") ); } /** * Test optimization of index-of to equal . */ @org.junit.Test public void cbclFnIndexof2() { final XQuery query = new XQuery( "index-of(exactly-one((1 to 10)[. div 5 = 1]),5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Test boolean of indexof . */ @org.junit.Test public void cbclFnIndexof3() { final XQuery query = new XQuery( "boolean(index-of((1 to 10)[. mod 2 = 0],4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Tests false boolean of indexof . */ @org.junit.Test public void cbclFnIndexof4() { final XQuery query = new XQuery( "boolean(index-of((1 to 10)[. mod 2 = 0],5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Tests fn:index-of of a range value followed by an sequence . */ @org.junit.Test public void cbclFnIndexof5() { final XQuery query = new XQuery( "index-of((1 to 10,(1 to 10)[. mod 2 = 0]),4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4 12") ); } /** * arg1: Sequence of integers , arg2: integer . */ @org.junit.Test public void fnIndexofMixArgs001() { final XQuery query = new XQuery( "fn:index-of ((10, 20, 30, 30, 20, 10), 20)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2 5") ); } /** * arg1: Sequence of integers , arg2: integer . */ @org.junit.Test public void fnIndexofMixArgs002() { final XQuery query = new XQuery( "fn:index-of ((10, 20, 30, 40), 35)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * arg1: Sequence of string , arg2: string . */ @org.junit.Test public void fnIndexofMixArgs003() { final XQuery query = new XQuery( "fn:index-of ((\"a\", \"sport\", \"and\", \"a\", \"pastime\"), \"a\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 4") ); } /** * arg1: Sequence of string , arg2: string . */ @org.junit.Test public void fnIndexofMixArgs004() { final XQuery query = new XQuery( "fn:index-of((\"sport\", \"\", \"and\", \"\", \"\", \"pastime\"), \"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2 4 5") ); } /** * arg1: empty Sequence , arg2: string . */ @org.junit.Test public void fnIndexofMixArgs005() { final XQuery query = new XQuery( "fn:index-of((),\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * arg1: Sequence of string , arg2: string . */ @org.junit.Test public void fnIndexofMixArgs006() { final XQuery query = new XQuery( "fn:index-of((\"sport\"), \"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * arg1: empty Sequence , arg2: untypedAtomic . */ @org.junit.Test public void fnIndexofMixArgs007() { final XQuery query = new XQuery( "fn:index-of((),fn:exactly-one(xs:untypedAtomic('')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * arg1: Sequence of float , arg2: float . */ @org.junit.Test public void fnIndexofMixArgs008() { final XQuery query = new XQuery( "fn:index-of((xs:float('NaN')), fn:exactly-one(xs:float('NaN')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * arg1: Sequence of double , arg2: double . */ @org.junit.Test public void fnIndexofMixArgs009() { final XQuery query = new XQuery( "fn:index-of((xs:double('NaN')), fn:exactly-one(xs:double('NaN')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * arg1: Sequence of double, arg2: double . */ @org.junit.Test public void fnIndexofMixArgs010() { final XQuery query = new XQuery( "fn:index-of((xs:double('INF')), fn:exactly-one(xs:double('INF')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * arg1: Sequence of double, arg2: double . */ @org.junit.Test public void fnIndexofMixArgs011() { final XQuery query = new XQuery( "fn:index-of((xs:double('-INF')), fn:exactly-one(xs:double('-INF')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * arg1: Sequence of decimal, arg2: decimal . */ @org.junit.Test public void fnIndexofMixArgs012() { final XQuery query = new XQuery( "fn:index-of((xs:decimal('9.99999999999999999999999999')), fn:exactly-one(xs:decimal('9.99999999999999999999999999')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * arg1: Sequence of decimal, arg2: decimal . */ @org.junit.Test public void fnIndexofMixArgs013() { final XQuery query = new XQuery( "fn:index-of((xs:decimal('9.99999999999999999999999999')), fn:exactly-one(xs:decimal('9.9999999999999999999999999')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * arg1: Sequence of positiveInteger, arg2: positiveInteger . */ @org.junit.Test public void fnIndexofMixArgs014() { final XQuery query = new XQuery( "fn:index-of((xs:positiveInteger('1'),xs:positiveInteger('2')), fn:exactly-one(xs:positiveInteger('2')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * arg1: Sequence of negativeInteger, arg2: negativeInteger . */ @org.junit.Test public void fnIndexofMixArgs015() { final XQuery query = new XQuery( "fn:index-of((xs:negativeInteger('-2'), xs:negativeInteger('-1')), fn:exactly-one(xs:negativeInteger('-1')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Use a nested sequence in the sequence to search . */ @org.junit.Test public void fnIndexofMixArgs016() { final XQuery query = new XQuery( "fn:index-of((1, (1,2,3)),1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2") ); } /** * Use multiple nested sequence in the sequence to search . */ @org.junit.Test public void fnIndexofMixArgs017() { final XQuery query = new XQuery( "fn:index-of(((1),(1), (2,1), (0,1)),1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 4 6") ); } /** * Use external variable for the sequence parameter . */ @org.junit.Test public void fnIndexofMixArgs018() { final XQuery query = new XQuery( "fn:index-of((/bib/book/publisher), \"Addison-Wesley\")", ctx); try { query.context(node(file("docs/bib.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2") ); } /** * Use external variable both in sequence and search parameter . */ @org.junit.Test public void fnIndexofMixArgs019() { final XQuery query = new XQuery( "fn:index-of((/bib/book/publisher), /bib/book[1]/publisher[1]/text() cast as xs:string)", ctx); try { query.context(node(file("docs/bib.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2") ); } /** * Use empty string with other strings in sequence . */ @org.junit.Test public void fnIndexofMixArgs020() { final XQuery query = new XQuery( "fn:index-of((\"sport\", \"\", \"and\", \"\", \"\", \"pastime\"), \"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2 4 5") ); } /** * Use empty string with integers in the sequence parameter . */ @org.junit.Test public void fnIndexofMixArgs021() { final XQuery query = new XQuery( "fn:index-of( (\"\", 1, \"\"), \"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 3") ); } /** * Use no search parameter . */ @org.junit.Test public void fnIndexofMixArgs022() { final XQuery query = new XQuery( "fn:index-of((1,2,3,4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnInnermost.java000066400000000000000000001057121222453003200272170ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the innermost() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnInnermost extends QT3TestSet { /** * Attempts to evaluate the "innermost" function with no arguments.. */ @org.junit.Test public void fnInnermost001() { final XQuery query = new XQuery( "fn:innermost()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "innermost" function with arity zero.. */ @org.junit.Test public void fnInnermost002() { final XQuery query = new XQuery( "fn:innermost#0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to evaluate the "innermost" function with two arguments.. */ @org.junit.Test public void fnInnermost003() { final XQuery query = new XQuery( "fn:innermost( (), 1 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "innermost" function with arity two.. */ @org.junit.Test public void fnInnermost004() { final XQuery query = new XQuery( "fn:innermost#2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "innermost" function with arity one.. */ @org.junit.Test public void fnInnermost005() { final XQuery query = new XQuery( "fn:exists( fn:innermost#1 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "innermost" function with an argument of type xs:anyAtomicType.. */ @org.junit.Test public void fnInnermost006() { final XQuery query = new XQuery( "fn:innermost( 1 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluates the "innermost" function with an argument of type function().. */ @org.junit.Test public void fnInnermost007() { final XQuery query = new XQuery( "fn:innermost( fn:dateTime#2 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the type checking of the argument.. */ @org.junit.Test public void fnInnermost009() { final XQuery query = new XQuery( "( fn:innermost( if (current-date() eq xs:date('1900-01-01'))\n" + " then .\n" + " else 1 ),\n" + " fn:innermost( if (current-date() eq xs:date('1900-01-01'))\n" + " then 1\n" + " else . ) )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the type checking of the argument.. */ @org.junit.Test public void fnInnermost011() { final XQuery query = new XQuery( "( fn:innermost( if (current-date() eq xs:date('1900-01-01'))\n" + " then .\n" + " else fn:dateTime#2 ),\n" + " fn:innermost( if (current-date() eq xs:date('1900-01-01'))\n" + " then fn:dateTime#2\n" + " else . ) )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type document-node() . */ @org.junit.Test public void fnInnermost012() { final XQuery query = new XQuery( "fn:innermost( / )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(1) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type document-node() . */ @org.junit.Test public void fnInnermost013() { final XQuery query = new XQuery( "fn:deep-equal(fn:innermost( / ), / )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type attribute()* . */ @org.junit.Test public void fnInnermost014() { final XQuery query = new XQuery( "fn:innermost( //*/@* )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(7) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type attribute()* . */ @org.junit.Test public void fnInnermost015() { final XQuery query = new XQuery( "fn:innermost( //*/@* ) ! string()", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("('0a','00a','000a','01a','010a','02a','020a')") ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type attribute()* . */ @org.junit.Test public void fnInnermost016() { final XQuery query = new XQuery( "deep-equal(fn:innermost( //*/@* ), //*/@*)", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type processing-instruction()* . */ @org.junit.Test public void fnInnermost023() { final XQuery query = new XQuery( "fn:innermost( //processing-instruction() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(7) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type processing-instruction()* . */ @org.junit.Test public void fnInnermost024() { final XQuery query = new XQuery( "fn:innermost( //processing-instruction() ) ! local-name() ", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("('level-0','level-00','level-000','level-01','level-010','level-02','level-020')") ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type processing-instruction()* . */ @org.junit.Test public void fnInnermost025() { final XQuery query = new XQuery( "fn:deep-equal( fn:innermost( //processing-instruction() ), \n" + " //processing-instruction() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type comment()* . */ @org.junit.Test public void fnInnermost026() { final XQuery query = new XQuery( "fn:innermost( //comment() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(7) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type comment()* . */ @org.junit.Test public void fnInnermost027() { final XQuery query = new XQuery( "fn:innermost( //comment() ) ! string()", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("('0c','00c','000c','01c','010c','02c','020c')") ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type comment()* . */ @org.junit.Test public void fnInnermost028() { final XQuery query = new XQuery( "fn:deep-equal( fn:innermost( //comment() ),\n" + " //comment() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type text()* . */ @org.junit.Test public void fnInnermost029() { final XQuery query = new XQuery( "fn:innermost( //text() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(14) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type text()* . */ @org.junit.Test public void fnInnermost030() { final XQuery query = new XQuery( "fn:innermost( //text() ) ! string() ", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("('0t',' ',\n '00t',' ','000t',' ',\n '01t',' ','010t',' ',\n '02t',' ','020t',' ')") ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type text()* . */ @org.junit.Test public void fnInnermost031() { final XQuery query = new XQuery( "fn:deep-equal( fn:innermost( //text() ),\n" + " //text() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type element()* . */ @org.junit.Test public void fnInnermost032() { final XQuery query = new XQuery( "fn:innermost( //* )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(14) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type element()* . */ @org.junit.Test public void fnInnermost033() { final XQuery query = new XQuery( "fn:innermost( //* ) ! local-name(.)", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("('empty-level-0', 'non-empty-level-0',\n 'empty-level-00', 'non-empty-level-00',\n 'empty-level-000', 'non-empty-level-000',\n 'empty-level-01', 'non-empty-level-01',\n 'empty-level-010', 'non-empty-level-010',\n 'empty-level-02', 'non-empty-level-02',\n 'empty-level-020', 'non-empty-level-020')") ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type element()* . */ @org.junit.Test public void fnInnermost034() { final XQuery query = new XQuery( "fn:deep-equal( fn:innermost( //* ), \n" + " let $nodes := //*\n" + " return $nodes except $nodes/ancestor::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnInnermost035() { final XQuery query = new XQuery( "fn:innermost( //node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(35) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnInnermost036() { final XQuery query = new XQuery( "fn:deep-equal( fn:innermost( //node() ), \n" + " let $nodes := //node()\n" + " return $nodes except $nodes/ancestor::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnInnermost037() { final XQuery query = new XQuery( "fn:innermost( /root/node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(8) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnInnermost038() { final XQuery query = new XQuery( "fn:deep-equal( fn:innermost( /root/node() ), \n" + " let $nodes := /root/node()\n" + " return $nodes except $nodes/ancestor::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnInnermost039() { final XQuery query = new XQuery( "fn:innermost( /root/descendant::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(35) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnInnermost040() { final XQuery query = new XQuery( "fn:deep-equal( fn:innermost( /root/descendant::node() ), \n" + " let $nodes := /root/descendant::node()\n" + " return $nodes except $nodes/ancestor::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnInnermost041() { final XQuery query = new XQuery( "fn:innermost( /root/level[1]/level[1]/ancestor::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(1) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnInnermost042() { final XQuery query = new XQuery( "fn:deep-equal( fn:innermost( /root/level[1]/level[1]/ancestor::node() ), \n" + " let $nodes := /root/level[1]/level[1]/ancestor::node()\n" + " return $nodes except $nodes/ancestor::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnInnermost043() { final XQuery query = new XQuery( "fn:innermost( /root/level[1]/level[last()]/preceding-sibling::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(5) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnInnermost044() { final XQuery query = new XQuery( "fn:deep-equal( fn:innermost( /root/level[1]/level[last()]/preceding-sibling::node() ), \n" + " let $nodes := /root/level[1]/level[last()]/preceding-sibling::node()\n" + " return $nodes except $nodes/ancestor::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnInnermost045() { final XQuery query = new XQuery( "fn:innermost( /root/level[1]/level[last()]/preceding::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(10) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnInnermost046() { final XQuery query = new XQuery( "fn:deep-equal( fn:innermost( /root/level[1]/level[last()]/preceding::node() ), \n" + " let $nodes := /root/level[1]/level[last()]/preceding::node()\n" + " return $nodes except $nodes/ancestor::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnInnermost047() { final XQuery query = new XQuery( "fn:innermost( /root/level[1]/following-sibling::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(2) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnInnermost048() { final XQuery query = new XQuery( "fn:deep-equal( fn:innermost( /root/level[1]/following-sibling::node() ), \n" + " let $nodes := /root/level[1]/following-sibling::node()\n" + " return $nodes except $nodes/ancestor::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnInnermost049() { final XQuery query = new XQuery( "fn:innermost( /root/level[1]/level[1]/following::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(20) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnInnermost050() { final XQuery query = new XQuery( "fn:deep-equal( fn:innermost( /root/level[1]/level[1]/following::node() ), \n" + " let $nodes := /root/level[1]/level[1]/following::node()\n" + " return $nodes except $nodes/ancestor::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnInnermost051() { final XQuery query = new XQuery( "fn:innermost( /root/node()/.. )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(1) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnInnermost052() { final XQuery query = new XQuery( "fn:deep-equal( fn:innermost( /root/node()/.. ), \n" + " let $nodes := /root/node()/..\n" + " return $nodes except $nodes/ancestor::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type node()* from two documents . */ @org.junit.Test public void fnInnermost053() { final XQuery query = new XQuery( "fn:innermost( ($doc1//node(), $doc2//node()) )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(26) ); } /** * Evaluates the "innermost" function with the argument set as follows: $nodes of type node()* from two documents . */ @org.junit.Test public void fnInnermost054() { final XQuery query = new XQuery( "fn:deep-equal( fn:innermost( ($doc1//node(), $doc2//node()) ),\n" + " let $nodes := ($doc1//node(), $doc2//node())\n" + " return $nodes except $nodes/ancestor::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "innermost" function with the input sequence not in document order . */ @org.junit.Test public void fnInnermost055() { final XQuery query = new XQuery( "let $in := for $x in //* order by local-name($x) return $x\n" + " return deep-equal(fn:innermost($in)/local-name(), fn:innermost(//*)/local-name())", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "innermost" function with the input sequence containing duplicates . */ @org.junit.Test public void fnInnermost056() { final XQuery query = new XQuery( "let $in := for $x in //* order by local-name($x) return $x\n" + " return deep-equal(fn:innermost(($in, $in))/local-name(), fn:innermost(//*)/local-name())", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "innermost" function with the input sequence empty . */ @org.junit.Test public void fnInnermost057() { final XQuery query = new XQuery( "innermost(//rubbish)", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Check that "innermost" doesn't change node identity . */ @org.junit.Test public void fnInnermost058() { final XQuery query = new XQuery( "innermost(//*) except //*", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnInsertBefore.java000066400000000000000000000514531222453003200276320ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the insert-before() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnInsertBefore extends QT3TestSet { /** * A test whose essence is: `insert-before()`. . */ @org.junit.Test public void kSeqInsertBeforeFunc1() { final XQuery query = new XQuery( "insert-before()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `insert-before((), 30, 7) eq 7`. . */ @org.junit.Test public void kSeqInsertBeforeFunc10() { final XQuery query = new XQuery( "insert-before((), 30, 7) eq 7", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(insert-before((1, 2, 3, 4), 30, ())) eq 4`. . */ @org.junit.Test public void kSeqInsertBeforeFunc11() { final XQuery query = new XQuery( "count(insert-before((1, 2, 3, 4), 30, ())) eq 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `insert-before(9, 30, ()) eq 9`. . */ @org.junit.Test public void kSeqInsertBeforeFunc12() { final XQuery query = new XQuery( "insert-before(9, 30, ()) eq 9", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(insert-before((1, 2, 3, 4), 1, ())) eq 4`. . */ @org.junit.Test public void kSeqInsertBeforeFunc13() { final XQuery query = new XQuery( "count(insert-before((1, 2, 3, 4), 1, ())) eq 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(insert-before((1, 2, 3), 30, (4, 5, 6))) eq 6`. . */ @org.junit.Test public void kSeqInsertBeforeFunc14() { final XQuery query = new XQuery( "count(insert-before((1, 2, 3), 30, (4, 5, 6))) eq 6", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(insert-before((), 30, (1, 2, 3))) eq 3`. . */ @org.junit.Test public void kSeqInsertBeforeFunc15() { final XQuery query = new XQuery( "count(insert-before((), 30, (1, 2, 3))) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(insert-before((error(), 1), 1, (1, "two", 3))) > 1`. . */ @org.junit.Test public void kSeqInsertBeforeFunc16() { final XQuery query = new XQuery( "count(insert-before((error(), 1), 1, (1, \"two\", 3))) > 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * Apply a predicate to the result of fn:insert-before(). . */ @org.junit.Test public void kSeqInsertBeforeFunc17() { final XQuery query = new XQuery( "(insert-before((1, current-time(), 3), 1, (4, 5, 6))[last()] treat as xs:integer) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Apply a predicate to the result of fn:insert-before(). . */ @org.junit.Test public void kSeqInsertBeforeFunc18() { final XQuery query = new XQuery( "(insert-before((1, current-time(), 3), 10, (4, 5, 6))[last()] treat as xs:integer) eq 6", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Apply a predicate to the result of fn:insert-before(). . */ @org.junit.Test public void kSeqInsertBeforeFunc19() { final XQuery query = new XQuery( "(insert-before((1, current-time(), 3), 10, (4, 5, 6))[last() - 3] treat as xs:integer) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `insert-before("wrong params", 2)`. . */ @org.junit.Test public void kSeqInsertBeforeFunc2() { final XQuery query = new XQuery( "insert-before(\"wrong params\", 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Apply a predicate to the result of fn:insert-before(). . */ @org.junit.Test public void kSeqInsertBeforeFunc20() { final XQuery query = new XQuery( "(insert-before((1, current-time(), 3), 10, ())[last()] treat as xs:integer) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Apply a predicate to the result of fn:insert-before(). . */ @org.junit.Test public void kSeqInsertBeforeFunc21() { final XQuery query = new XQuery( "empty(insert-before((1, current-time(), 3), 0, (4, 5, 6))[last() - 10])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `insert-before("wrong params", 2, 3, 4)`. . */ @org.junit.Test public void kSeqInsertBeforeFunc3() { final XQuery query = new XQuery( "insert-before(\"wrong params\", 2, 3, 4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * The second argument to fn:insert-before cannot be the empty sequence. . */ @org.junit.Test public void kSeqInsertBeforeFunc4() { final XQuery query = new XQuery( "insert-before((), (), \"a string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A test whose essence is: `insert-before((), -31, "a string") eq "a string"`. . */ @org.junit.Test public void kSeqInsertBeforeFunc5() { final XQuery query = new XQuery( "insert-before((), -31, \"a string\") eq \"a string\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(insert-before((1, 2, 3), 1, (4, 5, 6))) eq 6`. . */ @org.junit.Test public void kSeqInsertBeforeFunc6() { final XQuery query = new XQuery( "count(insert-before((1, 2, 3), 1, (4, 5, 6))) eq 6", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `insert-before((), 1, 3) eq 3`. . */ @org.junit.Test public void kSeqInsertBeforeFunc7() { final XQuery query = new XQuery( "insert-before((), 1, 3) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `insert-before((), 1, "a string") eq "a string"`. . */ @org.junit.Test public void kSeqInsertBeforeFunc8() { final XQuery query = new XQuery( "insert-before((), 1, \"a string\") eq \"a string\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(insert-before((), 1, (1, 2, 3))) eq 3`. . */ @org.junit.Test public void kSeqInsertBeforeFunc9() { final XQuery query = new XQuery( "count(insert-before((), 1, (1, 2, 3))) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * tests insert-before at known positions . */ @org.junit.Test public void cbclFnInsertBefore001() { final XQuery query = new XQuery( "insert-before(1 to 10,5,20 to 30)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 4 20 21 22 23 24 25 26 27 28 29 30 5 6 7 8 9 10") ); } /** * Tests insert-before for known positions . */ @org.junit.Test public void cbclFnInsertBefore002() { final XQuery query = new XQuery( "\n" + " insert-before((1 to 10,(20 to 30)[. mod 2 = 0],30 to 40),12,\"blah\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 4 5 6 7 8 9 10 20 blah 22 24 26 28 30 30 31 32 33 34 35 36 37 38 39 40") ); } /** * arg1: Sequence of string, arg2:integer, arg3: string . */ @org.junit.Test public void fnInsertBeforeMixArgs001() { final XQuery query = new XQuery( "fn:insert-before( (\"a\", \"b\", \"c\"),1, \"z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"z\", \"a\", \"b\", \"c\"") ); } /** * arg1: Sequence of string, arg2:integer, arg3: empty sequence . */ @org.junit.Test public void fnInsertBeforeMixArgs002() { final XQuery query = new XQuery( "fn:insert-before( (\"a\", \"b\", \"c\"),0, ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", \"b\", \"c\"") ); } /** * arg1: Sequence of string, arg2:integer, arg3: empty sequence . */ @org.junit.Test public void fnInsertBeforeMixArgs003() { final XQuery query = new XQuery( "fn:insert-before( (\"a\", \"b\", \"c\"),2, ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", \"b\", \"c\"") ); } /** * arg1: Sequence of string, arg2:integer, arg3: string . */ @org.junit.Test public void fnInsertBeforeMixArgs004() { final XQuery query = new XQuery( "fn:insert-before( (\"a\", \"b\", \"c\"),2, xs:string(\" \"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", \" \", \"b\", \"c\"") ); } /** * arg1: Sequence of string, arg2:integer, arg3: anyURI . */ @org.junit.Test public void fnInsertBeforeMixArgs005() { final XQuery query = new XQuery( "fn:insert-before( (\"a\", \"b\", \"c\"),2, xs:anyURI(\"www.example.com\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", \"www.example.com\", \"b\", \"c\"") ); } /** * arg1: Sequence of string, arg2:integer, arg3: integer . */ @org.junit.Test public void fnInsertBeforeMixArgs006() { final XQuery query = new XQuery( "fn:insert-before( (\"a\", \"b\", \"c\"),2, xs:integer(\"100\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", 100, \"b\", \"c\"") ); } /** * arg1: Sequence of string, arg2:integer, arg3: decimal . */ @org.junit.Test public void fnInsertBeforeMixArgs007() { final XQuery query = new XQuery( "fn:insert-before( (\"a\", \"b\", \"c\"),2, xs:decimal(\"1.1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", 1.1, \"b\", \"c\"") ); } /** * arg1: Sequence of string, arg2:integer, arg3: float . */ @org.junit.Test public void fnInsertBeforeMixArgs008() { final XQuery query = new XQuery( "fn:insert-before( (\"a\", \"b\", \"c\"),2, xs:float(\"1.1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", 1.1, \"b\", \"c\"") ); } /** * arg1: Sequence of string, arg2:integer, arg3: float . */ @org.junit.Test public void fnInsertBeforeMixArgs009() { final XQuery query = new XQuery( "fn:insert-before( (\"a\", \"b\", \"c\"),2, xs:float(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", xs:float('NaN'), \"b\", \"c\"") ); } /** * arg1: Sequence of string, arg2:integer, arg3: float . */ @org.junit.Test public void fnInsertBeforeMixArgs010() { final XQuery query = new XQuery( "fn:insert-before( (\"a\", \"b\", \"c\"),2, xs:float(\"-0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", 0, \"b\", \"c\"") ); } /** * arg1: Sequence of string, arg2:integer, arg3: float . */ @org.junit.Test public void fnInsertBeforeMixArgs011() { final XQuery query = new XQuery( "fn:insert-before( (\"a\", \"b\", \"c\"),2, xs:float(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", xs:float('-INF'), \"b\", \"c\"") ); } /** * arg1: Sequence of string, arg2:integer, arg3: double . */ @org.junit.Test public void fnInsertBeforeMixArgs012() { final XQuery query = new XQuery( "fn:insert-before( (\"a\", \"b\", \"c\"),2, xs:double(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", xs:double('NaN'), \"b\", \"c\"") ); } /** * arg1: Sequence of string, arg2:integer, arg3: double . */ @org.junit.Test public void fnInsertBeforeMixArgs013() { final XQuery query = new XQuery( "fn:insert-before( (\"a\", \"b\", \"c\"),2, xs:double(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", xs:double('INF'), \"b\", \"c\"") ); } /** * arg1: Sequence of string, arg2:integer, arg3: boolean . */ @org.junit.Test public void fnInsertBeforeMixArgs014() { final XQuery query = new XQuery( "fn:insert-before( (\"a\", \"b\", \"c\"),2, xs:boolean(\"1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", true(), \"b\", \"c\"") ); } /** * arg1: Sequence of string, arg2:integer, arg3: boolean . */ @org.junit.Test public void fnInsertBeforeMixArgs015() { final XQuery query = new XQuery( "fn:insert-before( (\"a\", \"b\", \"c\"),2, xs:boolean(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", false(), \"b\", \"c\"") ); } /** * arg1: Sequence of string, arg2:integer, arg3: boolean . */ @org.junit.Test public void fnInsertBeforeMixArgs016() { final XQuery query = new XQuery( "fn:insert-before( (\"a\", \"b\", \"c\"),2, xs:boolean(\"true\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", true(), \"b\", \"c\"") ); } /** * arg1: Sequence of string, arg2:integer, arg3: boolean . */ @org.junit.Test public void fnInsertBeforeMixArgs017() { final XQuery query = new XQuery( "fn:insert-before( (\"a\", \"b\", \"c\"),2, xs:boolean(\"false\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", false(), \"b\", \"c\"") ); } /** * arg1: Sequence of string, arg2:integer, arg3: date . */ @org.junit.Test public void fnInsertBeforeMixArgs018() { final XQuery query = new XQuery( "fn:insert-before( (\"a\", \"b\", \"c\"),4, xs:date(\"1993-03-31\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", \"b\", \"c\", xs:date('1993-03-31')") ); } /** * arg1: Sequence of string, arg2:integer, arg3: dateTime . */ @org.junit.Test public void fnInsertBeforeMixArgs019() { final XQuery query = new XQuery( "fn:insert-before( (\"a\", \"b\", \"c\"),4, xs:dateTime(\"1972-12-31T00:00:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", \"b\", \"c\", xs:dateTime('1972-12-31T00:00:00')") ); } /** * arg1: Sequence of string, arg2:integer, arg3: time . */ @org.junit.Test public void fnInsertBeforeMixArgs020() { final XQuery query = new XQuery( "fn:insert-before( (\"a\", \"b\", \"c\"),4, xs:time(\"12:30:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", \"b\", \"c\", xs:time('12:30:00')") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnIriToUri.java000066400000000000000000000757651222453003200267650ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the iri-to-uri() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnIriToUri extends QT3TestSet { /** * A test whose essence is: `iri-to-uri()`. . */ @org.junit.Test public void kIRIToURIfunc1() { final XQuery query = new XQuery( "iri-to-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `iri-to-uri("http://example.com/", "wrong param")`. . */ @org.junit.Test public void kIRIToURIfunc2() { final XQuery query = new XQuery( "iri-to-uri(\"http://example.com/\", \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `iri-to-uri(()) eq ""`. . */ @org.junit.Test public void kIRIToURIfunc3() { final XQuery query = new XQuery( "iri-to-uri(()) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke fn:normalize-space() on the return value of fn:iri-to-uri(). Implementations supporting the static typing feature may raise XPTY0004. . */ @org.junit.Test public void kIRIToURIfunc4() { final XQuery query = new XQuery( "normalize-space(iri-to-uri((\"somestring\", current-time())[1])) eq \"somestring\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * Must be passed at least one argument. . */ @org.junit.Test public void k2IRIToURIfunc1() { final XQuery query = new XQuery( "iri-to-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Pass a relatively high range of unicode characters. 0x32 to 0x126 in hexa decimal . */ @org.junit.Test public void k2IRIToURIfunc10() { final XQuery query = new XQuery( "iri-to-uri(codepoints-to-string(15000 to 16000))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "%E3%AA%98%E3%AA%99%E3%AA%9A%E3%AA%9B%E3%AA%9C%E3%AA%9D%E3%AA%9E%E3%AA%9F%E3%AA%A0%E3%AA%A1%E3%AA%A2%E3%AA%A3%E3%AA%A4%E3%AA%A5%E3%AA%A6%E3%AA%A7%E3%AA%A8%E3%AA%A9%E3%AA%AA%E3%AA%AB%E3%AA%AC%E3%AA%AD%E3%AA%AE%E3%AA%AF%E3%AA%B0%E3%AA%B1%E3%AA%B2%E3%AA%B3%E3%AA%B4%E3%AA%B5%E3%AA%B6%E3%AA%B7%E3%AA%B8%E3%AA%B9%E3%AA%BA%E3%AA%BB%E3%AA%BC%E3%AA%BD%E3%AA%BE%E3%AA%BF%E3%AB%80%E3%AB%81%E3%AB%82%E3%AB%83%E3%AB%84%E3%AB%85%E3%AB%86%E3%AB%87%E3%AB%88%E3%AB%89%E3%AB%8A%E3%AB%8B%E3%AB%8C%E3%AB%8D%E3%AB%8E%E3%AB%8F%E3%AB%90%E3%AB%91%E3%AB%92%E3%AB%93%E3%AB%94%E3%AB%95%E3%AB%96%E3%AB%97%E3%AB%98%E3%AB%99%E3%AB%9A%E3%AB%9B%E3%AB%9C%E3%AB%9D%E3%AB%9E%E3%AB%9F%E3%AB%A0%E3%AB%A1%E3%AB%A2%E3%AB%A3%E3%AB%A4%E3%AB%A5%E3%AB%A6%E3%AB%A7%E3%AB%A8%E3%AB%A9%E3%AB%AA%E3%AB%AB%E3%AB%AC%E3%AB%AD%E3%AB%AE%E3%AB%AF%E3%AB%B0%E3%AB%B1%E3%AB%B2%E3%AB%B3%E3%AB%B4%E3%AB%B5%E3%AB%B6%E3%AB%B7%E3%AB%B8%E3%AB%B9%E3%AB%BA%E3%AB%BB%E3%AB%BC%E3%AB%BD%E3%AB%BE%E3%AB%BF%E3%AC%80%E3%AC%81%E3%AC%82%E3%AC%83%E3%AC%84%E3%AC%85%E3%AC%86%E3%AC%87%E3%AC%88%E3%AC%89%E3%AC%8A%E3%AC%8B%E3%AC%8C%E3%AC%8D%E3%AC%8E%E3%AC%8F%E3%AC%90%E3%AC%91%E3%AC%92%E3%AC%93%E3%AC%94%E3%AC%95%E3%AC%96%E3%AC%97%E3%AC%98%E3%AC%99%E3%AC%9A%E3%AC%9B%E3%AC%9C%E3%AC%9D%E3%AC%9E%E3%AC%9F%E3%AC%A0%E3%AC%A1%E3%AC%A2%E3%AC%A3%E3%AC%A4%E3%AC%A5%E3%AC%A6%E3%AC%A7%E3%AC%A8%E3%AC%A9%E3%AC%AA%E3%AC%AB%E3%AC%AC%E3%AC%AD%E3%AC%AE%E3%AC%AF%E3%AC%B0%E3%AC%B1%E3%AC%B2%E3%AC%B3%E3%AC%B4%E3%AC%B5%E3%AC%B6%E3%AC%B7%E3%AC%B8%E3%AC%B9%E3%AC%BA%E3%AC%BB%E3%AC%BC%E3%AC%BD%E3%AC%BE%E3%AC%BF%E3%AD%80%E3%AD%81%E3%AD%82%E3%AD%83%E3%AD%84%E3%AD%85%E3%AD%86%E3%AD%87%E3%AD%88%E3%AD%89%E3%AD%8A%E3%AD%8B%E3%AD%8C%E3%AD%8D%E3%AD%8E%E3%AD%8F%E3%AD%90%E3%AD%91%E3%AD%92%E3%AD%93%E3%AD%94%E3%AD%95%E3%AD%96%E3%AD%97%E3%AD%98%E3%AD%99%E3%AD%9A%E3%AD%9B%E3%AD%9C%E3%AD%9D%E3%AD%9E%E3%AD%9F%E3%AD%A0%E3%AD%A1%E3%AD%A2%E3%AD%A3%E3%AD%A4%E3%AD%A5%E3%AD%A6%E3%AD%A7%E3%AD%A8%E3%AD%A9%E3%AD%AA%E3%AD%AB%E3%AD%AC%E3%AD%AD%E3%AD%AE%E3%AD%AF%E3%AD%B0%E3%AD%B1%E3%AD%B2%E3%AD%B3%E3%AD%B4%E3%AD%B5%E3%AD%B6%E3%AD%B7%E3%AD%B8%E3%AD%B9%E3%AD%BA%E3%AD%BB%E3%AD%BC%E3%AD%BD%E3%AD%BE%E3%AD%BF%E3%AE%80%E3%AE%81%E3%AE%82%E3%AE%83%E3%AE%84%E3%AE%85%E3%AE%86%E3%AE%87%E3%AE%88%E3%AE%89%E3%AE%8A%E3%AE%8B%E3%AE%8C%E3%AE%8D%E3%AE%8E%E3%AE%8F%E3%AE%90%E3%AE%91%E3%AE%92%E3%AE%93%E3%AE%94%E3%AE%95%E3%AE%96%E3%AE%97%E3%AE%98%E3%AE%99%E3%AE%9A%E3%AE%9B%E3%AE%9C%E3%AE%9D%E3%AE%9E%E3%AE%9F%E3%AE%A0%E3%AE%A1%E3%AE%A2%E3%AE%A3%E3%AE%A4%E3%AE%A5%E3%AE%A6%E3%AE%A7%E3%AE%A8%E3%AE%A9%E3%AE%AA%E3%AE%AB%E3%AE%AC%E3%AE%AD%E3%AE%AE%E3%AE%AF%E3%AE%B0%E3%AE%B1%E3%AE%B2%E3%AE%B3%E3%AE%B4%E3%AE%B5%E3%AE%B6%E3%AE%B7%E3%AE%B8%E3%AE%B9%E3%AE%BA%E3%AE%BB%E3%AE%BC%E3%AE%BD%E3%AE%BE%E3%AE%BF%E3%AF%80%E3%AF%81%E3%AF%82%E3%AF%83%E3%AF%84%E3%AF%85%E3%AF%86%E3%AF%87%E3%AF%88%E3%AF%89%E3%AF%8A%E3%AF%8B%E3%AF%8C%E3%AF%8D%E3%AF%8E%E3%AF%8F%E3%AF%90%E3%AF%91%E3%AF%92%E3%AF%93%E3%AF%94%E3%AF%95%E3%AF%96%E3%AF%97%E3%AF%98%E3%AF%99%E3%AF%9A%E3%AF%9B%E3%AF%9C%E3%AF%9D%E3%AF%9E%E3%AF%9F%E3%AF%A0%E3%AF%A1%E3%AF%A2%E3%AF%A3%E3%AF%A4%E3%AF%A5%E3%AF%A6%E3%AF%A7%E3%AF%A8%E3%AF%A9%E3%AF%AA%E3%AF%AB%E3%AF%AC%E3%AF%AD%E3%AF%AE%E3%AF%AF%E3%AF%B0%E3%AF%B1%E3%AF%B2%E3%AF%B3%E3%AF%B4%E3%AF%B5%E3%AF%B6%E3%AF%B7%E3%AF%B8%E3%AF%B9%E3%AF%BA%E3%AF%BB%E3%AF%BC%E3%AF%BD%E3%AF%BE%E3%AF%BF%E3%B0%80%E3%B0%81%E3%B0%82%E3%B0%83%E3%B0%84%E3%B0%85%E3%B0%86%E3%B0%87%E3%B0%88%E3%B0%89%E3%B0%8A%E3%B0%8B%E3%B0%8C%E3%B0%8D%E3%B0%8E%E3%B0%8F%E3%B0%90%E3%B0%91%E3%B0%92%E3%B0%93%E3%B0%94%E3%B0%95%E3%B0%96%E3%B0%97%E3%B0%98%E3%B0%99%E3%B0%9A%E3%B0%9B%E3%B0%9C%E3%B0%9D%E3%B0%9E%E3%B0%9F%E3%B0%A0%E3%B0%A1%E3%B0%A2%E3%B0%A3%E3%B0%A4%E3%B0%A5%E3%B0%A6%E3%B0%A7%E3%B0%A8%E3%B0%A9%E3%B0%AA%E3%B0%AB%E3%B0%AC%E3%B0%AD%E3%B0%AE%E3%B0%AF%E3%B0%B0%E3%B0%B1%E3%B0%B2%E3%B0%B3%E3%B0%B4%E3%B0%B5%E3%B0%B6%E3%B0%B7%E3%B0%B8%E3%B0%B9%E3%B0%BA%E3%B0%BB%E3%B0%BC%E3%B0%BD%E3%B0%BE%E3%B0%BF%E3%B1%80%E3%B1%81%E3%B1%82%E3%B1%83%E3%B1%84%E3%B1%85%E3%B1%86%E3%B1%87%E3%B1%88%E3%B1%89%E3%B1%8A%E3%B1%8B%E3%B1%8C%E3%B1%8D%E3%B1%8E%E3%B1%8F%E3%B1%90%E3%B1%91%E3%B1%92%E3%B1%93%E3%B1%94%E3%B1%95%E3%B1%96%E3%B1%97%E3%B1%98%E3%B1%99%E3%B1%9A%E3%B1%9B%E3%B1%9C%E3%B1%9D%E3%B1%9E%E3%B1%9F%E3%B1%A0%E3%B1%A1%E3%B1%A2%E3%B1%A3%E3%B1%A4%E3%B1%A5%E3%B1%A6%E3%B1%A7%E3%B1%A8%E3%B1%A9%E3%B1%AA%E3%B1%AB%E3%B1%AC%E3%B1%AD%E3%B1%AE%E3%B1%AF%E3%B1%B0%E3%B1%B1%E3%B1%B2%E3%B1%B3%E3%B1%B4%E3%B1%B5%E3%B1%B6%E3%B1%B7%E3%B1%B8%E3%B1%B9%E3%B1%BA%E3%B1%BB%E3%B1%BC%E3%B1%BD%E3%B1%BE%E3%B1%BF%E3%B2%80%E3%B2%81%E3%B2%82%E3%B2%83%E3%B2%84%E3%B2%85%E3%B2%86%E3%B2%87%E3%B2%88%E3%B2%89%E3%B2%8A%E3%B2%8B%E3%B2%8C%E3%B2%8D%E3%B2%8E%E3%B2%8F%E3%B2%90%E3%B2%91%E3%B2%92%E3%B2%93%E3%B2%94%E3%B2%95%E3%B2%96%E3%B2%97%E3%B2%98%E3%B2%99%E3%B2%9A%E3%B2%9B%E3%B2%9C%E3%B2%9D%E3%B2%9E%E3%B2%9F%E3%B2%A0%E3%B2%A1%E3%B2%A2%E3%B2%A3%E3%B2%A4%E3%B2%A5%E3%B2%A6%E3%B2%A7%E3%B2%A8%E3%B2%A9%E3%B2%AA%E3%B2%AB%E3%B2%AC%E3%B2%AD%E3%B2%AE%E3%B2%AF%E3%B2%B0%E3%B2%B1%E3%B2%B2%E3%B2%B3%E3%B2%B4%E3%B2%B5%E3%B2%B6%E3%B2%B7%E3%B2%B8%E3%B2%B9%E3%B2%BA%E3%B2%BB%E3%B2%BC%E3%B2%BD%E3%B2%BE%E3%B2%BF%E3%B3%80%E3%B3%81%E3%B3%82%E3%B3%83%E3%B3%84%E3%B3%85%E3%B3%86%E3%B3%87%E3%B3%88%E3%B3%89%E3%B3%8A%E3%B3%8B%E3%B3%8C%E3%B3%8D%E3%B3%8E%E3%B3%8F%E3%B3%90%E3%B3%91%E3%B3%92%E3%B3%93%E3%B3%94%E3%B3%95%E3%B3%96%E3%B3%97%E3%B3%98%E3%B3%99%E3%B3%9A%E3%B3%9B%E3%B3%9C%E3%B3%9D%E3%B3%9E%E3%B3%9F%E3%B3%A0%E3%B3%A1%E3%B3%A2%E3%B3%A3%E3%B3%A4%E3%B3%A5%E3%B3%A6%E3%B3%A7%E3%B3%A8%E3%B3%A9%E3%B3%AA%E3%B3%AB%E3%B3%AC%E3%B3%AD%E3%B3%AE%E3%B3%AF%E3%B3%B0%E3%B3%B1%E3%B3%B2%E3%B3%B3%E3%B3%B4%E3%B3%B5%E3%B3%B6%E3%B3%B7%E3%B3%B8%E3%B3%B9%E3%B3%BA%E3%B3%BB%E3%B3%BC%E3%B3%BD%E3%B3%BE%E3%B3%BF%E3%B4%80%E3%B4%81%E3%B4%82%E3%B4%83%E3%B4%84%E3%B4%85%E3%B4%86%E3%B4%87%E3%B4%88%E3%B4%89%E3%B4%8A%E3%B4%8B%E3%B4%8C%E3%B4%8D%E3%B4%8E%E3%B4%8F%E3%B4%90%E3%B4%91%E3%B4%92%E3%B4%93%E3%B4%94%E3%B4%95%E3%B4%96%E3%B4%97%E3%B4%98%E3%B4%99%E3%B4%9A%E3%B4%9B%E3%B4%9C%E3%B4%9D%E3%B4%9E%E3%B4%9F%E3%B4%A0%E3%B4%A1%E3%B4%A2%E3%B4%A3%E3%B4%A4%E3%B4%A5%E3%B4%A6%E3%B4%A7%E3%B4%A8%E3%B4%A9%E3%B4%AA%E3%B4%AB%E3%B4%AC%E3%B4%AD%E3%B4%AE%E3%B4%AF%E3%B4%B0%E3%B4%B1%E3%B4%B2%E3%B4%B3%E3%B4%B4%E3%B4%B5%E3%B4%B6%E3%B4%B7%E3%B4%B8%E3%B4%B9%E3%B4%BA%E3%B4%BB%E3%B4%BC%E3%B4%BD%E3%B4%BE%E3%B4%BF%E3%B5%80%E3%B5%81%E3%B5%82%E3%B5%83%E3%B5%84%E3%B5%85%E3%B5%86%E3%B5%87%E3%B5%88%E3%B5%89%E3%B5%8A%E3%B5%8B%E3%B5%8C%E3%B5%8D%E3%B5%8E%E3%B5%8F%E3%B5%90%E3%B5%91%E3%B5%92%E3%B5%93%E3%B5%94%E3%B5%95%E3%B5%96%E3%B5%97%E3%B5%98%E3%B5%99%E3%B5%9A%E3%B5%9B%E3%B5%9C%E3%B5%9D%E3%B5%9E%E3%B5%9F%E3%B5%A0%E3%B5%A1%E3%B5%A2%E3%B5%A3%E3%B5%A4%E3%B5%A5%E3%B5%A6%E3%B5%A7%E3%B5%A8%E3%B5%A9%E3%B5%AA%E3%B5%AB%E3%B5%AC%E3%B5%AD%E3%B5%AE%E3%B5%AF%E3%B5%B0%E3%B5%B1%E3%B5%B2%E3%B5%B3%E3%B5%B4%E3%B5%B5%E3%B5%B6%E3%B5%B7%E3%B5%B8%E3%B5%B9%E3%B5%BA%E3%B5%BB%E3%B5%BC%E3%B5%BD%E3%B5%BE%E3%B5%BF%E3%B6%80%E3%B6%81%E3%B6%82%E3%B6%83%E3%B6%84%E3%B6%85%E3%B6%86%E3%B6%87%E3%B6%88%E3%B6%89%E3%B6%8A%E3%B6%8B%E3%B6%8C%E3%B6%8D%E3%B6%8E%E3%B6%8F%E3%B6%90%E3%B6%91%E3%B6%92%E3%B6%93%E3%B6%94%E3%B6%95%E3%B6%96%E3%B6%97%E3%B6%98%E3%B6%99%E3%B6%9A%E3%B6%9B%E3%B6%9C%E3%B6%9D%E3%B6%9E%E3%B6%9F%E3%B6%A0%E3%B6%A1%E3%B6%A2%E3%B6%A3%E3%B6%A4%E3%B6%A5%E3%B6%A6%E3%B6%A7%E3%B6%A8%E3%B6%A9%E3%B6%AA%E3%B6%AB%E3%B6%AC%E3%B6%AD%E3%B6%AE%E3%B6%AF%E3%B6%B0%E3%B6%B1%E3%B6%B2%E3%B6%B3%E3%B6%B4%E3%B6%B5%E3%B6%B6%E3%B6%B7%E3%B6%B8%E3%B6%B9%E3%B6%BA%E3%B6%BB%E3%B6%BC%E3%B6%BD%E3%B6%BE%E3%B6%BF%E3%B7%80%E3%B7%81%E3%B7%82%E3%B7%83%E3%B7%84%E3%B7%85%E3%B7%86%E3%B7%87%E3%B7%88%E3%B7%89%E3%B7%8A%E3%B7%8B%E3%B7%8C%E3%B7%8D%E3%B7%8E%E3%B7%8F%E3%B7%90%E3%B7%91%E3%B7%92%E3%B7%93%E3%B7%94%E3%B7%95%E3%B7%96%E3%B7%97%E3%B7%98%E3%B7%99%E3%B7%9A%E3%B7%9B%E3%B7%9C%E3%B7%9D%E3%B7%9E%E3%B7%9F%E3%B7%A0%E3%B7%A1%E3%B7%A2%E3%B7%A3%E3%B7%A4%E3%B7%A5%E3%B7%A6%E3%B7%A7%E3%B7%A8%E3%B7%A9%E3%B7%AA%E3%B7%AB%E3%B7%AC%E3%B7%AD%E3%B7%AE%E3%B7%AF%E3%B7%B0%E3%B7%B1%E3%B7%B2%E3%B7%B3%E3%B7%B4%E3%B7%B5%E3%B7%B6%E3%B7%B7%E3%B7%B8%E3%B7%B9%E3%B7%BA%E3%B7%BB%E3%B7%BC%E3%B7%BD%E3%B7%BE%E3%B7%BF%E3%B8%80%E3%B8%81%E3%B8%82%E3%B8%83%E3%B8%84%E3%B8%85%E3%B8%86%E3%B8%87%E3%B8%88%E3%B8%89%E3%B8%8A%E3%B8%8B%E3%B8%8C%E3%B8%8D%E3%B8%8E%E3%B8%8F%E3%B8%90%E3%B8%91%E3%B8%92%E3%B8%93%E3%B8%94%E3%B8%95%E3%B8%96%E3%B8%97%E3%B8%98%E3%B8%99%E3%B8%9A%E3%B8%9B%E3%B8%9C%E3%B8%9D%E3%B8%9E%E3%B8%9F%E3%B8%A0%E3%B8%A1%E3%B8%A2%E3%B8%A3%E3%B8%A4%E3%B8%A5%E3%B8%A6%E3%B8%A7%E3%B8%A8%E3%B8%A9%E3%B8%AA%E3%B8%AB%E3%B8%AC%E3%B8%AD%E3%B8%AE%E3%B8%AF%E3%B8%B0%E3%B8%B1%E3%B8%B2%E3%B8%B3%E3%B8%B4%E3%B8%B5%E3%B8%B6%E3%B8%B7%E3%B8%B8%E3%B8%B9%E3%B8%BA%E3%B8%BB%E3%B8%BC%E3%B8%BD%E3%B8%BE%E3%B8%BF%E3%B9%80%E3%B9%81%E3%B9%82%E3%B9%83%E3%B9%84%E3%B9%85%E3%B9%86%E3%B9%87%E3%B9%88%E3%B9%89%E3%B9%8A%E3%B9%8B%E3%B9%8C%E3%B9%8D%E3%B9%8E%E3%B9%8F%E3%B9%90%E3%B9%91%E3%B9%92%E3%B9%93%E3%B9%94%E3%B9%95%E3%B9%96%E3%B9%97%E3%B9%98%E3%B9%99%E3%B9%9A%E3%B9%9B%E3%B9%9C%E3%B9%9D%E3%B9%9E%E3%B9%9F%E3%B9%A0%E3%B9%A1%E3%B9%A2%E3%B9%A3%E3%B9%A4%E3%B9%A5%E3%B9%A6%E3%B9%A7%E3%B9%A8%E3%B9%A9%E3%B9%AA%E3%B9%AB%E3%B9%AC%E3%B9%AD%E3%B9%AE%E3%B9%AF%E3%B9%B0%E3%B9%B1%E3%B9%B2%E3%B9%B3%E3%B9%B4%E3%B9%B5%E3%B9%B6%E3%B9%B7%E3%B9%B8%E3%B9%B9%E3%B9%BA%E3%B9%BB%E3%B9%BC%E3%B9%BD%E3%B9%BE%E3%B9%BF%E3%BA%80") ); } /** * Must be passed at most one argument. . */ @org.junit.Test public void k2IRIToURIfunc2() { final XQuery query = new XQuery( "iri-to-uri(\"a string\", \"a string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Must be passed a string. . */ @org.junit.Test public void k2IRIToURIfunc3() { final XQuery query = new XQuery( "iri-to-uri(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Must be passed at most one string. . */ @org.junit.Test public void k2IRIToURIfunc4() { final XQuery query = new XQuery( "iri-to-uri((\"a string\", \"a string\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Passing xs:anyURI causes type promotion. . */ @org.junit.Test public void k2IRIToURIfunc5() { final XQuery query = new XQuery( "iri-to-uri(xs:anyURI(\"a string\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a%20string") ); } /** * Passing xs:untypedAtomic causes type promotion. . */ @org.junit.Test public void k2IRIToURIfunc6() { final XQuery query = new XQuery( "iri-to-uri(xs:untypedAtomic(\"a string\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a%20string") ); } /** * Check some ASCII characters that must be escaped. . */ @org.junit.Test public void k2IRIToURIfunc7() { final XQuery query = new XQuery( "iri-to-uri(\"<> \"\"{}|\\^`\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "%3C%3E%20%22%7B%7D%7C%5C%5E%60") ); } /** * Pass a new-line character. . */ @org.junit.Test public void k2IRIToURIfunc8() { final XQuery query = new XQuery( "iri-to-uri(\"\n" + "\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "%0A") ); } /** * Pass the range of 0x20 to 0x126(hexa decimals). 0x32 to 0x126 in hexa decimal . */ @org.junit.Test public void k2IRIToURIfunc9() { final XQuery query = new XQuery( "iri-to-uri(codepoints-to-string(32 to 294))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "%20!%22#$%&'()*+,-./0123456789:;%3C=%3E?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[%5C]%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F%C2%80%C2%81%C2%82%C2%83%C2%84%C2%85%C2%86%C2%87%C2%88%C2%89%C2%8A%C2%8B%C2%8C%C2%8D%C2%8E%C2%8F%C2%90%C2%91%C2%92%C2%93%C2%94%C2%95%C2%96%C2%97%C2%98%C2%99%C2%9A%C2%9B%C2%9C%C2%9D%C2%9E%C2%9F%C2%A0%C2%A1%C2%A2%C2%A3%C2%A4%C2%A5%C2%A6%C2%A7%C2%A8%C2%A9%C2%AA%C2%AB%C2%AC%C2%AD%C2%AE%C2%AF%C2%B0%C2%B1%C2%B2%C2%B3%C2%B4%C2%B5%C2%B6%C2%B7%C2%B8%C2%B9%C2%BA%C2%BB%C2%BC%C2%BD%C2%BE%C2%BF%C3%80%C3%81%C3%82%C3%83%C3%84%C3%85%C3%86%C3%87%C3%88%C3%89%C3%8A%C3%8B%C3%8C%C3%8D%C3%8E%C3%8F%C3%90%C3%91%C3%92%C3%93%C3%94%C3%95%C3%96%C3%97%C3%98%C3%99%C3%9A%C3%9B%C3%9C%C3%9D%C3%9E%C3%9F%C3%A0%C3%A1%C3%A2%C3%A3%C3%A4%C3%A5%C3%A6%C3%A7%C3%A8%C3%A9%C3%AA%C3%AB%C3%AC%C3%AD%C3%AE%C3%AF%C3%B0%C3%B1%C3%B2%C3%B3%C3%B4%C3%B5%C3%B6%C3%B7%C3%B8%C3%B9%C3%BA%C3%BB%C3%BC%C3%BD%C3%BE%C3%BF%C4%80%C4%81%C4%82%C4%83%C4%84%C4%85%C4%86%C4%87%C4%88%C4%89%C4%8A%C4%8B%C4%8C%C4%8D%C4%8E%C4%8F%C4%90%C4%91%C4%92%C4%93%C4%94%C4%95%C4%96%C4%97%C4%98%C4%99%C4%9A%C4%9B%C4%9C%C4%9D%C4%9E%C4%9F%C4%A0%C4%A1%C4%A2%C4%A3%C4%A4%C4%A5%C4%A6") ); } /** * Examines the fn:iri-to-uri function with nothing to escape. . */ @org.junit.Test public void fnIriToUri1() { final XQuery query = new XQuery( "fn:iri-to-uri(\"example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example") ); } /** * Examines that the fn:iri-to-uri function does not escape the "'" symbol. . */ @org.junit.Test public void fnIriToUri10() { final XQuery query = new XQuery( "fn:iri-to-uri(\"example'example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example'example") ); } /** * Examines that the fn:iri-to-uri function does not escape the "(" symbol. . */ @org.junit.Test public void fnIriToUri11() { final XQuery query = new XQuery( "fn:iri-to-uri(\"example(example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example(example") ); } /** * Examines that the fn:iri-to-uri function does not escape the ")" symbol. . */ @org.junit.Test public void fnIriToUri12() { final XQuery query = new XQuery( "fn:iri-to-uri(\"example)example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example)example") ); } /** * Examines that the fn:iri-to-uri function does not escape the ";" symbol. . */ @org.junit.Test public void fnIriToUri13() { final XQuery query = new XQuery( "fn:iri-to-uri(\"example;example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example;example") ); } /** * Examines that the fn:iri-to-uri function does not escape the "/" symbol. . */ @org.junit.Test public void fnIriToUri14() { final XQuery query = new XQuery( "fn:iri-to-uri(\"example/example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example/example") ); } /** * Examines that the fn:iri-to-uri function does not escape the "?" symbol. . */ @org.junit.Test public void fnIriToUri15() { final XQuery query = new XQuery( "fn:iri-to-uri(\"example?example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example?example") ); } /** * Examines that the fn:iri-to-uri function does not escape the ":" symbol. . */ @org.junit.Test public void fnIriToUri16() { final XQuery query = new XQuery( "fn:iri-to-uri(\"example:example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example:example") ); } /** * Examines that the fn:iri-to-uri function does not escape the "@" symbol. . */ @org.junit.Test public void fnIriToUri17() { final XQuery query = new XQuery( "fn:iri-to-uri(\"example@example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example@example") ); } /** * Examines that the fn:iri-to-uri function does escape not the "&" symbol. . */ @org.junit.Test public void fnIriToUri18() { final XQuery query = new XQuery( "fn:iri-to-uri(\"example&amp;example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example&example") ); } /** * Examines that the fn:iri-to-uri function does not escape the "=" symbol. . */ @org.junit.Test public void fnIriToUri19() { final XQuery query = new XQuery( "fn:iri-to-uri(\"example=example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example=example") ); } /** * Examines that the fn:iri-to-uri function does not escape numbers. . */ @org.junit.Test public void fnIriToUri2() { final XQuery query = new XQuery( "fn:iri-to-uri(\"example0123456789\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example0123456789") ); } /** * Examines that the fn:iri-to-uri function does not escape "+" symbol. . */ @org.junit.Test public void fnIriToUri20() { final XQuery query = new XQuery( "fn:iri-to-uri(\"example+example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example+example") ); } /** * Examines that the fn:iri-to-uri function does not escape the "$" symbol. . */ @org.junit.Test public void fnIriToUri21() { final XQuery query = new XQuery( "fn:iri-to-uri(\"example$example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example$example") ); } /** * Examines that the fn:iri-to-uri function does not escape the "," symbol. . */ @org.junit.Test public void fnIriToUri22() { final XQuery query = new XQuery( "fn:iri-to-uri(\"example,example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example,example") ); } /** * Examines that the fn:iri-to-uri function does not escape the "[" symbol. . */ @org.junit.Test public void fnIriToUri23() { final XQuery query = new XQuery( "fn:iri-to-uri(\"example[example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example[example") ); } /** * Examines that the fn:iri-to-uri function does not escape the "]" symbol. . */ @org.junit.Test public void fnIriToUri24() { final XQuery query = new XQuery( "fn:iri-to-uri(\"example]example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example]example") ); } /** * Examines that the fn:iri-to-uri function does not escape the "%" symbol. . */ @org.junit.Test public void fnIriToUri25() { final XQuery query = new XQuery( "fn:iri-to-uri(\"example%example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example%example") ); } /** * Examines that the fn:iri-to-uri with an iri that contains a space. . */ @org.junit.Test public void fnIriToUri26() { final XQuery query = new XQuery( "fn:iri-to-uri(\"example example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example%20example") ); } /** * Examines that the fn:iri-to-uri function does not escapes the "#" symbol. . */ @org.junit.Test public void fnIriToUri3() { final XQuery query = new XQuery( "fn:iri-to-uri(\"example#example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example#example") ); } /** * Examines that the fn:iri-to-uri function does not escapes the "-" symbol. . */ @org.junit.Test public void fnIriToUri4() { final XQuery query = new XQuery( "fn:iri-to-uri(\"example-example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example-example") ); } /** * Examines that the fn:iri-to-uri function does not escape the "_" symbol. . */ @org.junit.Test public void fnIriToUri5() { final XQuery query = new XQuery( "fn:iri-to-uri(\"example_example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example_example") ); } /** * Examines that the fn:iri-to-uri function does not escapes the "." symbol. . */ @org.junit.Test public void fnIriToUri6() { final XQuery query = new XQuery( "fn:iri-to-uri(\"example.example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example.example") ); } /** * Examines that the fn:iri-to-uri function does escape not the "!" symbol. . */ @org.junit.Test public void fnIriToUri7() { final XQuery query = new XQuery( "fn:iri-to-uri(\"example!example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example!example") ); } /** * Examines that the fn:iri-to-uri function does not escape the "~" symbol. . */ @org.junit.Test public void fnIriToUri8() { final XQuery query = new XQuery( "fn:iri-to-uri(\"example~example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example~example") ); } /** * Examines that the fn:iri-to-uri function does not escape the "*" symbol. . */ @org.junit.Test public void fnIriToUri9() { final XQuery query = new XQuery( "fn:iri-to-uri(\"example*example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "example*example") ); } /** * Test iri-to-uri from example defined in functions and operators specification . */ @org.junit.Test public void fnIriToUri1args1() { final XQuery query = new XQuery( "iri-to-uri(\"http://www.example.com/00/Weather/CA/Los%20Angeles#ocean\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/00/Weather/CA/Los%20Angeles#ocean") ); } /** * Test iri-to-uri from example defined in functions and operators specification . */ @org.junit.Test public void fnIriToUri1args2() { final XQuery query = new XQuery( "iri-to-uri(\"http://www.example.com/~bébé\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/~b%C3%A9b%C3%A9") ); } /** * Test iri-to-uri with zero-length string argument . */ @org.junit.Test public void fnIriToUri1args3() { final XQuery query = new XQuery( "iri-to-uri('')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * Test iri-to-uri with empty sequence argument . */ @org.junit.Test public void fnIriToUri1args4() { final XQuery query = new XQuery( "iri-to-uri(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * test iri-to-uri with invalid argument type . */ @org.junit.Test public void fnIriToUri1args5() { final XQuery query = new XQuery( "iri-to-uri(12)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test iri-to-uri with incorrect arity . */ @org.junit.Test public void fnIriToUri1args6() { final XQuery query = new XQuery( "iri-to-uri('',())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnLang.java000066400000000000000000000453361222453003200261270ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** . * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnLang extends QT3TestSet { /** * A test whose essence is: `lang()`. . */ @org.junit.Test public void kNodeLangFunc1() { final XQuery query = new XQuery( "lang()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `if(false()) then lang("en", .) else true()`. . */ @org.junit.Test public void kNodeLangFunc2() { final XQuery query = new XQuery( "if(false()) then lang(\"en\", .) else true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPDY0002") ) ); } /** * A test whose essence is: `if(false()) then lang("en") else true()`. . */ @org.junit.Test public void kNodeLangFunc3() { final XQuery query = new XQuery( "if(false()) then lang(\"en\") else true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPDY0002") ) ); } /** * A test whose essence is: `lang("en", 2)`. . */ @org.junit.Test public void kNodeLangFunc4() { final XQuery query = new XQuery( "lang(\"en\", 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Invoke fn:lang from the top and bottom of a tree. . */ @org.junit.Test public void k2NodeLangFunc1() { final XQuery query = new XQuery( "let $i := return (lang(\"de\", $i/b), lang(\"de\", $i))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true false") ); } /** * Start navigating from the actual attribute node. . */ @org.junit.Test public void k2NodeLangFunc2() { final XQuery query = new XQuery( "let $i := return lang(\"de\", $i/b/@xml:lang)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Navigate a single, empty attribute. . */ @org.junit.Test public void k2NodeLangFunc3() { final XQuery query = new XQuery( "lang(\"de\", attribute xml:lang {()})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Sub-languages must be separated with dashes. . */ @org.junit.Test public void k2NodeLangFunc4() { final XQuery query = new XQuery( "lang(\"en\", )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Use a single attribute node as input. . */ @org.junit.Test public void k2NodeLangFunc5() { final XQuery query = new XQuery( "fn:lang(\"fr\", attribute xml:lang {\"fr\"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Use a single attribute node as input. . */ @org.junit.Test public void k2NodeLangFunc6() { final XQuery query = new XQuery( "fn:lang(\"fr\", attribute xml:lang {()})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try to force optional item call on fn:lang . */ @org.junit.Test public void cbclFnLang001() { final XQuery query = new XQuery( "\n" + " \tif(current-date() > xs:date(\"2000-01-01\")) then lang(\"en\",) else ()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the fn:lang function with no second argument and no context node. . */ @org.junit.Test public void fnLang1() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.org\"; \n" + " declare function eg:noContextFunction() { fn:lang(\"en\") }; \n" + " eg:noContextFunction()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Evaluation of the fn:lang function with testlang set to "EN". Context node is '' . */ @org.junit.Test public void fnLang10() { final XQuery query = new XQuery( "for $x in /langs/para[3] return $x/fn:lang(\"EN\")", ctx); try { query.context(node(file("fn/lang/lang.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the fn:lang function with testlang set to "En". Context node is '' . */ @org.junit.Test public void fnLang11() { final XQuery query = new XQuery( "for $x in /langs/para[3] return $x/fn:lang(\"En\")", ctx); try { query.context(node(file("fn/lang/lang.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the fn:lang function with testlang set to "eN". Context node is '' . */ @org.junit.Test public void fnLang12() { final XQuery query = new XQuery( "for $x in /langs/para[3] return $x/fn:lang(\"eN\")", ctx); try { query.context(node(file("fn/lang/lang.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the fn:lang function with testlang set to "en". Context node is '' . */ @org.junit.Test public void fnLang13() { final XQuery query = new XQuery( "for $x in /langs/para[3] return $x/fn:lang(\"en\")", ctx); try { query.context(node(file("fn/lang/lang.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the fn:lang function with testlang set to "en-us". Context node is '' . */ @org.junit.Test public void fnLang14() { final XQuery query = new XQuery( "for $x in /langs/para[3] return $x/fn:lang(\"en-us\")", ctx); try { query.context(node(file("fn/lang/lang.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the fn:lang function with testlang set to "en-us" and context node. is not a node. . */ @org.junit.Test public void fnLang15() { final XQuery query = new XQuery( "1[fn:lang(\"en-us\")]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluation of the fn:lang function with testlang set to "us-en" and context node has xml:lang attribute set to "en-us". . */ @org.junit.Test public void fnLang16() { final XQuery query = new XQuery( "for $x in /langs/para[3] return $x/fn:lang(\"us-us\")", ctx); try { query.context(node(file("fn/lang/lang.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the fn:lang function with testlang set to "fr" and context node has xml:lang attribute set to "EN". . */ @org.junit.Test public void fnLang17() { final XQuery query = new XQuery( "for $x in /langs/para[2] return $x/fn:lang(\"fr\")", ctx); try { query.context(node(file("fn/lang/lang.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the fn:lang function with testlang set to "en" and specified node (second argument) has xml:lang attribute set to "en". . */ @org.junit.Test public void fnLang18() { final XQuery query = new XQuery( "fn:lang(\"en\",fn:exactly-one(/langs/para[1]))", ctx); try { query.context(node(file("fn/lang/lang.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the fn:lang function with testlang set to "fr" and specified node (second argument) has xml:lang attribute set to "en". . */ @org.junit.Test public void fnLang19() { final XQuery query = new XQuery( "fn:lang(\"fr\",fn:exactly-one(/langs/para[1]))", ctx); try { query.context(node(file("fn/lang/lang.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the fn:lang function with testlang set to empty sequence Uses fn:count to avoid empty file. . */ @org.junit.Test public void fnLang2() { final XQuery query = new XQuery( "fn:count(fn:lang((), ./langs[1]/para[1]))", ctx); try { query.context(node(file("fn/lang/lang.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluation of the fn:lang function with testlang set to "en" and specified node (second argument) has xml:lang attribute set to "en-us". . */ @org.junit.Test public void fnLang20() { final XQuery query = new XQuery( "fn:lang(\"en\",fn:exactly-one(/langs/para[3]))", ctx); try { query.context(node(file("fn/lang/lang.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the fn:lang function with testlang set to "en" and specified node (second argument) has xml:lang attribute set to "EN". . */ @org.junit.Test public void fnLang21() { final XQuery query = new XQuery( "fn:lang(\"en\",fn:exactly-one(/langs/para[2]))", ctx); try { query.context(node(file("fn/lang/lang.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the fn:lang function with second argument set to "." and no context node. (second argument) has xml:lang attribute set to "EN". . */ @org.junit.Test public void fnLang22() { final XQuery query = new XQuery( "fn:lang(\"en\",.)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Evaluation of the fn:lang function with testlang set to "en" as per example 1 for this function Context node is 'para xml:lang="en"' . */ @org.junit.Test public void fnLang3() { final XQuery query = new XQuery( " for $x in /langs/para[1] return $x/fn:lang(\"en\")", ctx); try { query.context(node(file("fn/lang/lang.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the fn:lang function with testlang set to "en" as per example 2 for this function Context node is '
    And now, and forever!
    ' . */ @org.junit.Test public void fnLang4() { final XQuery query = new XQuery( "for $x in /langs/div[1]/para return $x/fn:lang(\"en\")", ctx); try { query.context(node(file("fn/lang/lang.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the fn:lang function with testlang set to "EN". Context node is '' . */ @org.junit.Test public void fnLang5() { final XQuery query = new XQuery( "for $x in /langs/para[2] return $x/fn:lang(\"EN\")", ctx); try { query.context(node(file("fn/lang/lang.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the fn:lang function with testlang set to "En". Context node is '' . */ @org.junit.Test public void fnLang6() { final XQuery query = new XQuery( " for $x in /langs/para[2] return $x/fn:lang(\"En\")", ctx); try { query.context(node(file("fn/lang/lang.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the fn:lang function with testlang set to "eN". Context node is '' . */ @org.junit.Test public void fnLang7() { final XQuery query = new XQuery( "for $x in /langs/para[2] return $x/fn:lang(\"eN\")", ctx); try { query.context(node(file("fn/lang/lang.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the fn:lang function with testlang set to "en". Context node is '' . */ @org.junit.Test public void fnLang8() { final XQuery query = new XQuery( "for $x in /langs/para[2] return $x/fn:lang(\"en\")", ctx); try { query.context(node(file("fn/lang/lang.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the fn:lang function with testlang set to "en". Context node is '' . */ @org.junit.Test public void fnLang9() { final XQuery query = new XQuery( "for $x in /langs/para[3] return $x/fn:lang(\"en-us\")", ctx); try { query.context(node(file("fn/lang/lang.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "lang" function with the arguments set as follows: $testlang = "en", node with no "xml:lang" attribute . */ @org.junit.Test public void fnLang1args1() { final XQuery query = new XQuery( "fn:lang(xs:string(\"en\"),/root[1]/time[1])", ctx); try { query.context(node(file("docs/atomicns.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "lang" function with the arguments set as follows: $testlang = "EN", node with no "xml:lang" attribute . */ @org.junit.Test public void fnLang1args2() { final XQuery query = new XQuery( "fn:lang(xs:string(\"EN\"),./root[1]/time[1])", ctx); try { query.context(node(file("docs/atomicns.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "lang" function with the arguments set as follows: $testlang = "eN", node with no "xml:lang" attribute . */ @org.junit.Test public void fnLang1args3() { final XQuery query = new XQuery( "fn:lang(xs:string(\"eN\"),./root[1]/time[1])", ctx); try { query.context(node(file("docs/atomicns.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnLast.java000066400000000000000000001047051222453003200261450ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the last() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnLast extends QT3TestSet { /** * A test whose essence is: `last(1)`. . */ @org.junit.Test public void kContextLastFunc1() { final XQuery query = new XQuery( "last(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * fn:last() can never return 0('eq'), #2. . */ @org.junit.Test public void kContextLastFunc10() { final XQuery query = new XQuery( "empty((1, 2, 3, current-time(), current-date(), 6, 7, 8) [0 eq last()])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * fn:last() can never return 0('!='). . */ @org.junit.Test public void kContextLastFunc11() { final XQuery query = new XQuery( "deep-equal( (1, 2, 3, remove((current-time(), 4), 1)) [last() != 0], (1, 2, 3, 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:last() can never return 0('ne'). . */ @org.junit.Test public void kContextLastFunc12() { final XQuery query = new XQuery( "deep-equal( (1, 2, 3, remove((current-time(), 4), 1)) [last() ne 0], (1, 2, 3, 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:last() can never return 0('!='). . */ @org.junit.Test public void kContextLastFunc13() { final XQuery query = new XQuery( "deep-equal( (1, 2, 3, remove((current-time(), 4), 1)) [0 != last()], (1, 2, 3, 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:last() can never return 0('ne'), #2. . */ @org.junit.Test public void kContextLastFunc14() { final XQuery query = new XQuery( "deep-equal( (1, 2, 3, remove((current-time(), 4), 1)) [0 ne last()], (1, 2, 3, 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:last() can never return anything less than 1(lt). . */ @org.junit.Test public void kContextLastFunc15() { final XQuery query = new XQuery( "empty((1, 2, 3, current-time(), current-date(), 6, 7, 8) [last() lt 1])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * fn:last() can never return anything less than 1(<). . */ @org.junit.Test public void kContextLastFunc16() { final XQuery query = new XQuery( "empty((1, 2, 3, current-time(), current-date(), 6, 7, 8) [last() < 1])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * fn:last() can never return anything less or equal to 0(le). . */ @org.junit.Test public void kContextLastFunc17() { final XQuery query = new XQuery( "empty((1, 2, 3, current-time(), current-date(), 6, 7, 8) [last() le 0])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * fn:last() can never return anything less or equal to 0(<=). . */ @org.junit.Test public void kContextLastFunc18() { final XQuery query = new XQuery( "empty((1, 2, 3, current-time(), current-date(), 6, 7, 8) [last() <= 0])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * The return value of fn:last() is always greater than 0('ne'). . */ @org.junit.Test public void kContextLastFunc19() { final XQuery query = new XQuery( "deep-equal( (1, 2, 3, remove((current-time(), 4), 1)) [last() > 0], (1, 2, 3, 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(1, 2, 3)[if(1) then 1 else last()]`. . */ @org.junit.Test public void kContextLastFunc2() { final XQuery query = new XQuery( "(1, 2, 3)[if(1) then 1 else last()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * The return value of fn:last() is always greater than 0('>'). . */ @org.junit.Test public void kContextLastFunc20() { final XQuery query = new XQuery( "deep-equal( (1, 2, 3, remove((current-time(), 4), 1)) [last() > 0], (1, 2, 3, 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The return value of fn:last() is always greater than 0('gt'). . */ @org.junit.Test public void kContextLastFunc21() { final XQuery query = new XQuery( "deep-equal( (1, 2, 3, remove((current-time(), 4), 1)) [last() gt 0], (1, 2, 3, 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The return value of fn:last() is always greater or equal to 0('>='). . */ @org.junit.Test public void kContextLastFunc22() { final XQuery query = new XQuery( "deep-equal( (1, 2, 3, remove((current-time(), 4), 1)) [last() >= 1], (1, 2, 3, 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The return value of fn:last() is always greater or equal to 0('ge'). . */ @org.junit.Test public void kContextLastFunc23() { final XQuery query = new XQuery( "deep-equal( (1, 2, 3, remove((current-time(), 4), 1)) [last() ge 1], (1, 2, 3, 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:last() inside a predicate combined with a offset. . */ @org.junit.Test public void kContextLastFunc24() { final XQuery query = new XQuery( "(1, 2, 3, 4, current-time(), 4, 5, 6)[last() - 2] treat as xs:integer eq 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:last() inside a predicate combined with a offset. . */ @org.junit.Test public void kContextLastFunc25() { final XQuery query = new XQuery( "(1, 2, 3, 4, current-time(), 4, 5, 6)[last() - 1] treat as xs:integer eq 5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:last() inside a predicate. . */ @org.junit.Test public void kContextLastFunc26() { final XQuery query = new XQuery( "(1, 2, 3, 4, current-time(), 4, 5, 6)[last()] treat as xs:integer eq 6", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:last() inside a predicate and an insignificant offset. . */ @org.junit.Test public void kContextLastFunc27() { final XQuery query = new XQuery( "(1, 2, 3, 4, current-time(), 4, 5, 6)[last() - 0] treat as xs:integer eq 6", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:last() inside a predicate combined with a range expression. . */ @org.junit.Test public void kContextLastFunc28() { final XQuery query = new XQuery( "(1 to 6)[last()] eq 6", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:last() inside a predicate combined with a range expression and offset. . */ @org.junit.Test public void kContextLastFunc29() { final XQuery query = new XQuery( "(-20 to -5)[last() - 3]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-8") ); } /** * A test whose essence is: `deep-equal((1, 2, 3)[count((last(), last())) eq 2], (1, 2, 3))`. . */ @org.junit.Test public void kContextLastFunc3() { final XQuery query = new XQuery( "deep-equal((1, 2, 3)[count((last(), last())) eq 2], (1, 2, 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal((1, 2, 3)[last() eq last()], (1, 2, 3))`. . */ @org.junit.Test public void kContextLastFunc4() { final XQuery query = new XQuery( "deep-equal((1, 2, 3)[last() eq last()], (1, 2, 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(1, 2, 3, current-time())[last() - 1] treat as xs:integer eq 3`. . */ @org.junit.Test public void kContextLastFunc5() { final XQuery query = new XQuery( "(1, 2, 3, current-time())[last() - 1] treat as xs:integer eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty((1, 2, 3, current-time())[last() + 1])`. . */ @org.junit.Test public void kContextLastFunc6() { final XQuery query = new XQuery( "empty((1, 2, 3, current-time())[last() + 1])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:last() can never return 0('='). . */ @org.junit.Test public void kContextLastFunc7() { final XQuery query = new XQuery( "empty((1, 2, 3, current-time(), current-date(), 6, 7, 8) [last() = 0])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * fn:last() can never return 0('='), #2. . */ @org.junit.Test public void kContextLastFunc8() { final XQuery query = new XQuery( "empty((1, 2, 3, current-time(), current-date(), 6, 7, 8) [0 = last()])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * fn:last() can never return 0('eq'). . */ @org.junit.Test public void kContextLastFunc9() { final XQuery query = new XQuery( "empty((1, 2, 3, current-time(), current-date(), 6, 7, 8) [last() eq 0])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * test fn:first-in-sequence on sub-expression where quant = 1 . */ @org.junit.Test public void cbclLastInSequence001() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:generate($arg as xs:integer?) { if ($arg = 0) then (1, 2, 3) else () }; \n" + " \t( local:generate(0), 1, local:generate(0) )[last()]\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * test fn:first-in-sequence on a for expression . */ @org.junit.Test public void cbclLastInSequence002() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:generate($arg as xs:integer?) as xs:integer* { if ($arg = 0) then (1, 2, 3) else $arg }; \n" + " \t( local:generate(()), for $x in local:generate(0) return $x + 2 )[last()]\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5") ); } /** * test fn:first-in-sequence on a for expression . */ @org.junit.Test public void cbclLastInSequence003() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:generate($arg as xs:integer?) as xs:integer? { if ($arg = 0) then 0 else () }; \n" + " \t( local:generate(()), for $x in local:generate(0) return $x + 2 )[last()]\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * test fn:first-in-sequence on a for-at expression . */ @org.junit.Test public void cbclLastInSequence004() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:generate($arg as xs:integer?) as xs:integer* { if ($arg = 0) then ( 1, 2, 3 ) else ( $arg ) }; \n" + " \t( local:generate(()), for $x at $p in local:generate(0) return $p + $x)[last()]\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "6") ); } /** * test fn:first-in-sequence on a for-at expression . */ @org.junit.Test public void cbclLastInSequence005() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:generate($arg as xs:integer?) as xs:integer? { if ($arg = 0) then 1 else $arg }; \n" + " \t( local:generate(()), for $x at $p in local:generate(0) return $p + $x)[last()]\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * test fn:first-in-sequence on a map expression . */ @org.junit.Test public void cbclLastInSequence006() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:generate($arg as xs:integer?) as xs:string* { if ($arg = 0) then ('a', 'b', 'c') else ('d' ) }; \n" + " \t( if (local:generate(1) = 'd') then () else 1, for $x in local:generate(0) return fn:lower-case($x))[last()]\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "c") ); } /** * test fn:first-in-sequence on a map expression . */ @org.junit.Test public void cbclLastInSequence007() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:generate($arg as xs:integer?) as xs:integer? { $arg }; \n" + " \t( if (local:generate(0) = 0) then () else 1, for $x in local:generate(0) return -$x)[last()]\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * test fn:first-in-sequence on a distinct-doc-order . */ @org.junit.Test public void cbclLastInSequence008() { final XQuery query = new XQuery( "( (
    cheese)/b )[last()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("cheese", false) ); } /** * test fn:first-in-sequence on a for-each expression Author: Tim Mills . */ @org.junit.Test public void cbclLastInSequence009() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:generate($arg as xs:integer?) as xs:string* { if ($arg = 0) then ('a', 'b', 'c') else () }; \n" + " \t( local:generate(()), for $x in local:generate(0) return 3)[last()]\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * test fn:boolean on fn:first-in-sequence . */ @org.junit.Test public void cbclLastInSequence010() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:generate($arg as xs:integer?) as xs:string* { if ($arg = 0) then ('a', 'b', 'c') else () }; \n" + " \tboolean(local:generate(0)[last()])\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:boolean on fn:first-in-sequence . */ @org.junit.Test public void cbclLastInSequence011() { final XQuery query = new XQuery( "declare function local:generate($arg as xs:integer?) as xs:string* { if ($arg = 0) then ('a', 'b', 'c') else () }; boolean(local:generate(1)[last()])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:first-in-sequence on a for-each expression . */ @org.junit.Test public void cbclLastInSequence012() { final XQuery query = new XQuery( "declare function local:generate($arg as xs:boolean) as xs:string+ { if ($arg) then ('a', 'b', 'c') else ('A', 'B', 'C') }; ( for $x in local:generate(true()) return 3)[last()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Evaluation of "fn:last", where context function is an element node and the position is last. . */ @org.junit.Test public void last1() { final XQuery query = new XQuery( "for $h in (/works) return $h//employee[last()]/string(@name)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 13") ); } /** * Evaluation of "fn:last" where the last function is used inside the first predicate. . */ @org.junit.Test public void last10() { final XQuery query = new XQuery( "for $h in (/works) return $h//employee[last() = 13][@name = \"Jane Doe 13\"]/string(@name)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 13") ); } /** * Evaluation of "fn:position" used in conjunction with the fn:not function . */ @org.junit.Test public void last11() { final XQuery query = new XQuery( "for $h in (/works/employee[12]/overtime) return $h/day[not(position() = 1)]", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Tuesday") ); } /** * Evaluation of "fn:position" as a predicate to a wildcard (*). . */ @org.junit.Test public void last12() { final XQuery query = new XQuery( "for $h in (/works/employee[12]/overtime) return $h/*[position() = position()]/string()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"Monday\", \"Tuesday\"") ); } /** * Evaluation of "fn:position" used together with an addition operation. . */ @org.junit.Test public void last13() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[position() = (2 + 2)]/string(@name)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "John Doe 4") ); } /** * Evaluation of "fn:position" used together with a subtraction operation. . */ @org.junit.Test public void last14() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[position() = (5 - 2)]/string(@name)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 3") ); } /** * Evaluation of "fn:position" used together with a multiplication operation. . */ @org.junit.Test public void last15() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[position() = (3 * 2)]/string(@name)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "John Doe 6") ); } /** * Evaluation of "fn:position" used together with a division (div) operation. . */ @org.junit.Test public void last16() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[position() = (6 div 2)]/string(@name)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 3") ); } /** * Evaluation of "fn:position" used together with a division (idiv) operation. . */ @org.junit.Test public void last17() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[position() = (6 idiv 2)]/string(@name)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 3") ); } /** * Evaluation of "fn:position" used together with a logical expression ("and" operator and "true" function). . */ @org.junit.Test public void last18() { final XQuery query = new XQuery( "for $h in (/works/employee[12]) return ($h/overtime[position() and fn:true()]/*/string())", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"Monday\", \"Tuesday\"") ); } /** * Evaluation of "fn:position" used together with a logical expression ("and" operator and "false" function). . */ @org.junit.Test public void last19() { final XQuery query = new XQuery( "for $h in (/works/employee[12]) return $h/overtime[position() and fn:false()]", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEmpty() || error("XPST0005") ) ); } /** * Evaluation of "fn:last", where the context node is not defined. . */ @org.junit.Test public void last2() { final XQuery query = new XQuery( "last()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Evaluation of "fn:position" used together with a logical expression ("or" operator and "true" function). . */ @org.junit.Test public void last20() { final XQuery query = new XQuery( "for $h in (/works/employee[12]) return $h/overtime[position() or fn:true()]/*/string()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"Monday\", \"Tuesday\"") ); } /** * Evaluation of "fn:position" used together with a logical expression ("or" operator and "false" function). . */ @org.junit.Test public void last21() { final XQuery query = new XQuery( "for $h in (/works/employee[12]) return $h/overtime[position() or fn:false()]/*/string()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"Monday\", \"Tuesday\"") ); } /** * Evaluation of "fn:position" used in the middle of a path expression. . */ @org.junit.Test public void last22() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[position() = 12]/overtime/*/string()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"Monday\", \"Tuesday\"") ); } /** * Evaluation of "last()" within a positional predicate . */ @org.junit.Test public void last23() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[position() = 5 to last()]/@name/string()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"Jane Doe 5\", \"John Doe 6\", \"Jane Doe 7\", \"John Doe 8\", \n \"Jane Doe 9\", \"John Doe 10\", \"Jane Doe 11\", \"John Doe 12\", \"Jane Doe 13\"") ); } /** * Top-level call on last(). */ @org.junit.Test public void last24() { final XQuery query = new XQuery( "last()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluation of "fn:last", where the first item is selected. . */ @org.junit.Test public void last3() { final XQuery query = new XQuery( "for $h in (/works/employee[12]) return $h/overtime[last() = 1]/*/string()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"Monday\", \"Tuesday\"") ); } /** * Evaluation of "fn:last" together with "fn:position". . */ @org.junit.Test public void last4() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[position() = last()]/string(@name)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 13") ); } /** * Evaluation of "fn:last" together with "fn:position" (format last() = position()). . */ @org.junit.Test public void last5() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[last() = position()]/string(@name)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 13") ); } /** * Evaluation of "fn:last" together with the "<<" node operator . */ @org.junit.Test public void last6() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[last()] << $h/employee[last()]", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of "fn:last" together with the "is" node operator casted to integer inside the predicate. . */ @org.junit.Test public void last7() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[last()] is $h/employee[last()]", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of "fn:last" where two last functions are used inside the predicate. . */ @org.junit.Test public void last8() { final XQuery query = new XQuery( "for $h in (/works/employee[12]) return $h/overtime[last() = last()]/*/string()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"Monday\", \"Tuesday\"") ); } /** * Evaluation of "fn:last" where the last function is used inside a second predicate. . */ @org.junit.Test public void last9() { final XQuery query = new XQuery( "for $h in (/works) return $h//employee[@name=\"Jane Doe 13\"][last() = 1]/string(@name)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 13") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnLocalName.java000066400000000000000000001013521222453003200270700ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** . * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnLocalName extends QT3TestSet { /** * A test whose essence is: `local-name((), "wrong param")`.. */ @org.junit.Test public void kNodeLocalNameFunc1() { final XQuery query = new XQuery( "local-name((), \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `if(false()) then local-name() else true()`.. */ @org.junit.Test public void kNodeLocalNameFunc2() { final XQuery query = new XQuery( "if(false()) then local-name() else true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPDY0002") ) ); } /** * A test whose essence is: `local-name(()) eq ""`.. */ @org.junit.Test public void kNodeLocalNameFunc3() { final XQuery query = new XQuery( "local-name(()) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Call fn:local-name() on an attribute node.. */ @org.junit.Test public void k2NodeLocalNameFunc1() { final XQuery query = new XQuery( "local-name(/works/employee[1]/@name)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "name") ); } /** * Evaluation of the fn:local-name function with an undefined context node and no argument. . */ @org.junit.Test public void fnLocalName1() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.org\"; \n" + " declare function eg:noContextFunction() { fn:local-name() }; \n" + " eg:noContextFunction()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Evaluation of the fn:local-name function argument set to a directly constructed element node with no prefix. Use fn:string. . */ @org.junit.Test public void fnLocalName10() { final XQuery query = new XQuery( "fn:string(fn:local-name(Some content))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "anElement") ); } /** * Evaluation of the fn:local-name function argument set to a directly constructed element node with a prefix. Use fn:string. . */ @org.junit.Test public void fnLocalName11() { final XQuery query = new XQuery( "fn:string(fn:local-name(Some content))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "anElement") ); } /** * Evaluation of the fn:local-name function argument set to a computed attribute node with no prefix. Use fn:string. . */ @org.junit.Test public void fnLocalName12() { final XQuery query = new XQuery( "fn:string(fn:local-name(attribute anAttribute {\"Attribute Value\"}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "anAttribute") ); } /** * Evaluation of the fn:local-name function argument set to a computed attribute node with a prefix. Use fn:string. . */ @org.junit.Test public void fnLocalName13() { final XQuery query = new XQuery( "declare namespace p1 = \"http://example.org\"; \n" + " fn:string(fn:local-name(attribute p1:anAttribute {\"Attribute Value\"}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "anAttribute") ); } /** * Evaluation of the fn:local-name function argument set to a computed PI node with no prefix. Use fn:string. . */ @org.junit.Test public void fnLocalName14() { final XQuery query = new XQuery( "fn:string(fn:local-name(processing-instruction PITarget {\"PIcontent\"}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PITarget") ); } /** * Evaluation of the fn:local-name function argument set to a directly constructed PI node. Use fn:string. . */ @org.junit.Test public void fnLocalName15() { final XQuery query = new XQuery( "fn:string(fn:local-name())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "format") ); } /** * Evaluation of the fn:local-name function argument set to a directly constructed element node with prefix and a declare namespace declaration. Use fn:string. . */ @org.junit.Test public void fnLocalName16() { final XQuery query = new XQuery( "declare namespace p1 = \"http://example.org\"; fn:string(fn:local-name(Some content))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "anElement") ); } /** * Evaluation of the fn:local-name function argument set to a directly constructed element node with no prefix used as argument to string-length function. Use fn:string. . */ @org.junit.Test public void fnLocalName17() { final XQuery query = new XQuery( "fn:string-length(fn:string(fn:local-name(Some content)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("9") ); } /** * Evaluation of the fn:local-name function argument set to a computed element node with prefix and a declare namespace declaration. Use fn:string. . */ @org.junit.Test public void fnLocalName18() { final XQuery query = new XQuery( "\n" + " declare namespace p1 = \"http://example.org\"; \n" + " fn:string(fn:local-name(element p1:anElement{\"Some content\"}))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "anElement") ); } /** * Evaluation of the fn:local-name function argument set to a directly constructed element node with no prefix used as argument to upper-case function. Use fn:string. . */ @org.junit.Test public void fnLocalName19() { final XQuery query = new XQuery( "fn:upper-case(fn:string(fn:local-name(Some content)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ANELEMENT") ); } /** * Name: fn-local-name-1 Description: Evaluation of the fn:local-name function with * an undefined context node and no argument. . */ @org.junit.Test public void fnLocalName1a() { final XQuery query = new XQuery( "fn:local-name()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Name: fn-local-name-2 Description: Evaluation of the fn:local-name function with * context item not a node. . */ @org.junit.Test public void fnLocalName2() { final XQuery query = new XQuery( "(1 to 100)[fn:local-name()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluation of the fn:local-name function argument set to a directly constructed element node with no prefix used as argument to lower-case function. Use fn:string. . */ @org.junit.Test public void fnLocalName20() { final XQuery query = new XQuery( "fn:lower-case(fn:string(fn:local-name(Some content)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "anelement") ); } /** * Evaluation of the fn:local-name function argument set to a computed attribite node with no prefix used as argument to upper-case function. Use fn:string. . */ @org.junit.Test public void fnLocalName21() { final XQuery query = new XQuery( "fn:upper-case(fn:string(fn:local-name(attribute anAttribute {\"Some content\"})))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ANATTRIBUTE") ); } /** * Evaluation of the fn:local-name function argument set to a computed attribite node with no prefix used as argument to lower-case function. Use fn:string. . */ @org.junit.Test public void fnLocalName22() { final XQuery query = new XQuery( "fn:lower-case(fn:string(fn:local-name(attribute anAttribute {\"Some content\"})))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "anattribute") ); } /** * Evaluation of the fn:local-name function with second argument set to "." and no context node set. Use fn:string. . */ @org.junit.Test public void fnLocalName23() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.org\"; \n" + " declare function eg:noContextFunction() { fn:local-name(.) }; \n" + " eg:noContextFunction()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Name: fn-local-name-51 Description: Evaluation of the fn:local-name function * with the argument set to the empty sequence. Uses the fn:string-length function to avoid * empty file. . */ @org.junit.Test public void fnLocalName51() { final XQuery query = new XQuery( "fn:string-length(fn:local-name(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Name: fn-local-name-52 Description: Evaluation of the fn:local-name function * with the argument set to an element node. . */ @org.junit.Test public void fnLocalName52() { final XQuery query = new XQuery( "(fn:local-name(./works[1]/employee[1]))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "employee") ); } /** * Name: fn-local-name-53 Description: Evaluation of the fn:local-name function * with the argument set to an attribute node. insert-start insert-end . */ @org.junit.Test public void fnLocalName53() { final XQuery query = new XQuery( "(fn:local-name(./works[1]/employee[1]/@name))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "name") ); } /** * Name: fn-local-name-54 Description: Evaluation of the fn:local-name function * with the argument set to a document node. Use of "fn:string-length" to avoid empty file. * insert-start insert-end . */ @org.junit.Test public void fnLocalName54() { final XQuery query = new XQuery( "fn:string-length(fn:local-name(.))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Name: fn-local-name-55 Description: Evaluation of the fn:local-name function * with the argument set to a non existing element. Use of "fn:string-length" to avoid empty * file. insert-start insert-end . */ @org.junit.Test public void fnLocalName55() { final XQuery query = new XQuery( "fn:string-length(fn:local-name(./works[1]/nonexistent[1]))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Name: fn-local-name-56 Description: Evaluation of the fn:local-name function * with the argument set to a non existing element. Use of "fn:string-length" to avoid empty * file. . */ @org.junit.Test public void fnLocalName56() { final XQuery query = new XQuery( "for $h in ./works[1]/employee[2] return\n" + " fn:string-length(fn:local-name($h/child::text()[last()]))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Name: fn-local-name-57 Description: Evaluation of the fn:local-name function * with an undefined context node. . */ @org.junit.Test public void fnLocalName57() { final XQuery query = new XQuery( "fn:local-name()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Name: fn-local-name-58 Description: Evaluation of the fn:local-name function * used as an argument to the fn:upper-case function . */ @org.junit.Test public void fnLocalName58() { final XQuery query = new XQuery( "for $h in (./works/employee[2]) return fn:upper-case(fn:local-name($h))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "EMPLOYEE") ); } /** * Name: fn-local-name-59 Description: Evaluation of the fn:local-name function * used as an argument to the fn:lower-case function . */ @org.junit.Test public void fnLocalName59() { final XQuery query = new XQuery( "for $h in (./works/employee[2]) return fn:lower-case(fn:local-name($h))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "employee") ); } /** * Evaluation of the fn:local-name function argument set computed comment node. Use fn:count to avoid empty file . */ @org.junit.Test public void fnLocalName6() { final XQuery query = new XQuery( "fn:count(fn:local-name((comment {\"A Comment Node\"})))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Name: fn-local-name-60 Description: Evaluation of the fn:local-name function * with argument that uses the "parent" axes . */ @org.junit.Test public void fnLocalName60() { final XQuery query = new XQuery( "for $h in (./works/employee[2]) return fn:local-name($h/parent::node())", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "works") ); } /** * Name: fn-local-name-61 Description: Evaluation of the fn:local-name function * with argument that uses the "descendant" axes . */ @org.junit.Test public void fnLocalName61() { final XQuery query = new XQuery( "for $h in (./works/employee[2]) return fn:local-name($h/descendant::empnum[position() =\n" + " 1])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "empnum") ); } /** * Name: fn-local-name-62 Description: Evaluation of the fn:local-name function * with argument that uses the "descendant-or-self" axes . */ @org.junit.Test public void fnLocalName62() { final XQuery query = new XQuery( "for $h in (./works/employee[2]) return\n" + " fn:local-name($h/descendant-or-self::empnum[position() = 1])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "empnum") ); } /** * Name: fn-local-name-63 Description: Evaluation of the fn:local-name function * used as argument to the fn-subtstring function. . */ @org.junit.Test public void fnLocalName63() { final XQuery query = new XQuery( "for $h in (./works/employee[2]) return fn:substring(fn:local-name($h),2)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "mployee") ); } /** * Name: fn-local-name-64 Description: Evaluation of the fn:local-name function * used as argument to the fn:concat function. . */ @org.junit.Test public void fnLocalName64() { final XQuery query = new XQuery( "for $h in (/works/employee[2]) return fn:concat(fn:local-name($h),\"A String\")", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "employeeA String") ); } /** * Name: fn-local-name-65 Description: Evaluation of the fn:local-name function * with argument that uses the "self" axes. Returns a string . */ @org.junit.Test public void fnLocalName65() { final XQuery query = new XQuery( "for $h in (./works/employee[2]) return fn:local-name($h/self::employee)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "employee") ); } /** * Name: fn-local-name-66 Description: Evaluation of the fn:local-name function * with argument that uses the "self" axes. Returns a empty sequence Uses fn:count to avoid * empty file. . */ @org.junit.Test public void fnLocalName66() { final XQuery query = new XQuery( "for $h in (./works/employee[2]) return fn:count(fn:local-name($h/self::div))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "1") || error("XPST0005") ) ); } /** * Name: fn-local-name-67 Description: Evaluation of the fn:local-name function * with argument that uses the "parent::node()". The context node is an attribute node. . */ @org.junit.Test public void fnLocalName67() { final XQuery query = new XQuery( " for $h in (/works/employee[2]/@name) return fn:local-name($h/parent::node())", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "employee") ); } /** * Name: fn-local-name-68 Description: Evaluation of the fn:local-name function as * an argument to the string-length function. The context node is an attribute node. . */ @org.junit.Test public void fnLocalName68() { final XQuery query = new XQuery( "fn:string-length(fn:local-name(./works[1]/employee[2]/@name))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4") ); } /** * Evaluation of the fn:local-name function argument set to a directly constructed comment node. Use fn:count to avoid empty file . */ @org.junit.Test public void fnLocalName7() { final XQuery query = new XQuery( "fn:count(fn:local-name())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Name: fn-local-name-71 Description: Evaluation of the fn:local-name function * used as part of a sequence. . */ @org.junit.Test public void fnLocalName71() { final XQuery query = new XQuery( "string-join((fn:local-name(./works[1]/employee[1]),fn:local-name(./works[1]/employee[2])),\n" + " ' ')", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "employee employee") ); } /** * Name: fn-local-name-72 Description: Evaluation of the fn:local-name function as * argument to fn:count. . */ @org.junit.Test public void fnLocalName72() { final XQuery query = new XQuery( "fn:count(((fn:local-name(/works[1]/employee[1]),fn:local-name(/works[1]/employee[2]))))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Name: fn-local-name-73 Description: Evaluation of the fn:local-name function * with an undefined context node and argument set to ".". . */ @org.junit.Test public void fnLocalName73() { final XQuery query = new XQuery( "fn:local-name(.)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Name: fn-local-name-74 Description: Get the name of an element in a namespace. . */ @org.junit.Test public void fnLocalName74() { final XQuery query = new XQuery( "name(/*)", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ma:AuctionWatchList") ); } /** * Name: fn-local-name-75 Description: Get the name of an attribute in a namespace. . */ @org.junit.Test public void fnLocalName75() { final XQuery query = new XQuery( "name((//*:Start)[1]/@*)", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ma:currency") ); } /** * Name: fn-local-name-76 Description: Get the name of the xml:lang attribute. . */ @org.junit.Test public void fnLocalName76() { final XQuery query = new XQuery( "name((//@xml:*)[1])", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xml:lang") ); } /** * Get the name of a processing-instruction node. . */ @org.junit.Test public void fnLocalName78() { final XQuery query = new XQuery( "name((//processing-instruction())[1])", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xml-stylesheet") ); } /** * Get the name of an element in a default but non-null namespace. . */ @org.junit.Test public void fnLocalName79() { final XQuery query = new XQuery( "name((//*[.='1983'])[1])", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "recorded") ); } /** * Evaluation of the fn:local-name function argument set to a directly constructed Document node. Use fn:count to avoid empty file . */ @org.junit.Test public void fnLocalName8() { final XQuery query = new XQuery( "fn:count(fn:local-name(document {some content}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Get the name of a comment node . */ @org.junit.Test public void fnLocalName80() { final XQuery query = new XQuery( "name((//comment())[1]) = ''", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Get the name of a text node . */ @org.junit.Test public void fnLocalName81() { final XQuery query = new XQuery( "name((//text())[1]) = ''", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the fn:local-name function argument set to a computed element node with no prefix. Use fn:string. . */ @org.junit.Test public void fnLocalName9() { final XQuery query = new XQuery( "fn:string(fn:local-name(element anElement {\"Some content\"}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "anElement") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnLocalNameFromQName.java000066400000000000000000000136751222453003200306500ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the local-name-from-qname() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnLocalNameFromQName extends QT3TestSet { /** * A test whose essence is: `local-name-from-QName()`. . */ @org.junit.Test public void kLocalNameFromQNameFunc1() { final XQuery query = new XQuery( "local-name-from-QName()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `local-name-from-QName(1, 2)`. . */ @org.junit.Test public void kLocalNameFromQNameFunc2() { final XQuery query = new XQuery( "local-name-from-QName(1, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(local-name-from-QName( () ))`. . */ @org.junit.Test public void kLocalNameFromQNameFunc3() { final XQuery query = new XQuery( "empty(local-name-from-QName( () ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `local-name-from-QName( QName("example.com/", "pre:lname")) eq "lname"`. . */ @org.junit.Test public void kLocalNameFromQNameFunc4() { final XQuery query = new XQuery( "local-name-from-QName( QName(\"example.com/\", \"pre:lname\")) eq \"lname\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test function fn:local-name-from-QName. Empty sequence literal as input . */ @org.junit.Test public void localNameFromQNameFunc006() { final XQuery query = new XQuery( "fn:local-name-from-QName(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Test function fn:local-name-from-QName. Empty sequence literal as input . */ @org.junit.Test public void localNameFromQNameFunc007() { final XQuery query = new XQuery( "fn:local-name-from-QName(((),()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Test function fn:local-name-from-QName. Error case - invalid parameter type (string) . */ @org.junit.Test public void localNameFromQNameFunc009() { final XQuery query = new XQuery( "fn:local-name-from-QName(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test function fn:local-name-from-QName. Error case - no input parameter . */ @org.junit.Test public void localNameFromQNameFunc011() { final XQuery query = new XQuery( "fn:local-name-from-QName()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Test function fn:local-name-from-QName. Error case - invalid parameter type (simple type) . */ @org.junit.Test public void localNameFromQNameFunc015() { xquery10(); final XQuery query = new XQuery( "fn:local-name-from-QName((//Folder)[1])", ctx); try { query.context(node(file("prod/ForClause/fsx.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test function fn:local-name-from-QName. Error case - invalid parameter type (simple type) . */ @org.junit.Test public void localNameFromQNameFunc015a() { final XQuery query = new XQuery( "fn:local-name-from-QName((//Folder)[1])", ctx); try { query.context(node(file("prod/ForClause/fsx.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0117") ); } /** * Test function fn:local-name-from-QName. Error case - invalid parameter type (integer) . */ @org.junit.Test public void localNameFromQNameFunc016() { final XQuery query = new XQuery( "fn:local-name-from-QName(xs:integer(\"100\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test function fn:local-name-from-QName. Error case - invalid parameter type (time) . */ @org.junit.Test public void localNameFromQNameFunc017() { final XQuery query = new XQuery( "fn:local-name-from-QName(xs:time(\"12:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnLowerCase.java000066400000000000000000000265551222453003200271340ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the lower-case() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnLowerCase extends QT3TestSet { /** * A test whose essence is: `lower-case()`. . */ @org.junit.Test public void kLowerCaseFunc1() { final XQuery query = new XQuery( "lower-case()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `lower-case("string", "wrong param")`. . */ @org.junit.Test public void kLowerCaseFunc2() { final XQuery query = new XQuery( "lower-case(\"string\", \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `lower-case(()) eq ""`. . */ @org.junit.Test public void kLowerCaseFunc3() { final XQuery query = new XQuery( "lower-case(()) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `upper-case("abCd0") eq "ABCD0"`. . */ @org.junit.Test public void kLowerCaseFunc4() { final XQuery query = new XQuery( "upper-case(\"abCd0\") eq \"ABCD0\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of lower-case function as per example 1 (for this function) from the F&O specs. . */ @org.junit.Test public void fnLowerCase1() { final XQuery query = new XQuery( "fn:lower-case(\"ABc!D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc!d") ); } /** * Evaluation of lower-case function with argument set to "*****" . */ @org.junit.Test public void fnLowerCase10() { final XQuery query = new XQuery( "fn:lower-case(\"*****\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "*****") ); } /** * Evaluation of lower-case function with argument set to another lower-case function . */ @org.junit.Test public void fnLowerCase11() { final XQuery query = new XQuery( "fn:lower-case(lower-case(\"zzzzz\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "zzzzz") ); } /** * Evaluation of lower-case function as an argument to the "fn:boolean" function . */ @org.junit.Test public void fnLowerCase12() { final XQuery query = new XQuery( "fn:boolean(fn:lower-case(\"abcde\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of lower-case function as an argument to the "fn:concat" function . */ @org.junit.Test public void fnLowerCase13() { final XQuery query = new XQuery( "fn:concat(fn:lower-case(\"abcde\"), fn:lower-case(\"fghi\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcdefghi") ); } /** * Evaluation of lower-case function as an argument to the "fn:not" function . */ @org.junit.Test public void fnLowerCase14() { final XQuery query = new XQuery( "fn:not(fn:lower-case(\"abcde\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of lower-case function with argument set to "%$#@!" . */ @org.junit.Test public void fnLowerCase15() { final XQuery query = new XQuery( "fn:lower-case(\"%$#@!\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "%$#@!") ); } /** * Evaluation of lower-case function with argument set to "lower-case" . */ @org.junit.Test public void fnLowerCase16() { final XQuery query = new XQuery( "fn:lower-case(\"lower-case\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "lower-case") ); } /** * Evaluation of lower-case function as part of a boolean expression . */ @org.junit.Test public void fnLowerCase17() { final XQuery query = new XQuery( "fn:lower-case(\"abc\") and fn:lower-case(\"abc\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of lower-case function using the empty sequence Uses the count function to avoid empty file. . */ @org.junit.Test public void fnLowerCase2() { final XQuery query = new XQuery( "fn:count(fn:lower-case(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluation of lower-case function that uses only numbers as part of argument Use of count function to avoid empty file. . */ @org.junit.Test public void fnLowerCase3() { final XQuery query = new XQuery( "fn:lower-case(\"12345\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12345") ); } /** * Evaluation of lower-case function that uses both numbers and letters as part of argument . */ @org.junit.Test public void fnLowerCase4() { final XQuery query = new XQuery( "fn:lower-case(\"12345abcd\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12345abcd") ); } /** * Evaluation of lower-case function that uses only upper case letters as part of argument . */ @org.junit.Test public void fnLowerCase5() { final XQuery query = new XQuery( "fn:lower-case(\"ABCD\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcd") ); } /** * Evaluation of lower-case function that uses only lower case letters as part of argument . */ @org.junit.Test public void fnLowerCase6() { final XQuery query = new XQuery( "fn:lower-case(\"abcde\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcde") ); } /** * Evaluation of lower-case function that uses both upper and lower case letters as part of argument . */ @org.junit.Test public void fnLowerCase7() { final XQuery query = new XQuery( "fn:lower-case(\"ABCDEabcde\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcdeabcde") ); } /** * Evaluation of lower-case function that uses the empty string as part of argument Uses "fn:count" to avoid the empty file . */ @org.junit.Test public void fnLowerCase8() { final XQuery query = new XQuery( "fn:count(fn:lower-case(\"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluation of lower-case function that uses the "upper-case" as part of argument . */ @org.junit.Test public void fnLowerCase9() { final XQuery query = new XQuery( "fn:lower-case(upper-case(\"AbcDH\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcdh") ); } /** * Evaluates The "lower-case" function with the arguments set as follows: $arg = xs:string(lower bound) . */ @org.junit.Test public void fnLowerCase1args1() { final XQuery query = new XQuery( "fn:lower-case(xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "this is a characte") ); } /** * Evaluates The "lower-case" function with the arguments set as follows: $arg = xs:string(mid range) . */ @org.junit.Test public void fnLowerCase1args2() { final XQuery query = new XQuery( "fn:lower-case(xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "this is a characte") ); } /** * Evaluates The "lower-case" function with the arguments set as follows: $arg = xs:string(upper bound) . */ @org.junit.Test public void fnLowerCase1args3() { final XQuery query = new XQuery( "fn:lower-case(xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "this is a characte") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnMap.java000066400000000000000000000147621222453003200257620ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * tests for the fn:map() higher-order function introduced in XPath 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnMap extends QT3TestSet { /** * Convert names to upper-case (one-to-one mapping). */ @org.junit.Test public void map001() { final XQuery query = new XQuery( "map(upper-case#1, (\"aa\", \"bb\", \"cc\", \"dd\", \"ee\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"AA\", \"BB\", \"CC\", \"DD\", \"EE\"") ); } /** * Get lengths of names (one-to-many mapping). */ @org.junit.Test public void map002() { final XQuery query = new XQuery( "map(string-to-codepoints#1, (\"john\", \"jane\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("106, 111, 104, 110, 106, 97, 110, 101") ); } /** * Use map function as a filter. */ @org.junit.Test public void map003() { final XQuery query = new XQuery( "map(function($x){$x[contains(., 'e')]}, (\"john\", \"mary\", \"jane\", \"anne\", \"peter\", \"ian\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"jane\", \"anne\", \"peter\"") ); } /** * Map using user-defined anonymous function. */ @org.junit.Test public void map004() { final XQuery query = new XQuery( "map(function($x){upper-case($x)} , (\"john\", \"mary\", \"jane\", \"anne\", \"peter\", \"ian\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"JOHN\", \"MARY\", \"JANE\", \"ANNE\", \"PETER\", \"IAN\"") ); } /** * Map using user-defined anonymous function. */ @org.junit.Test public void map005() { final XQuery query = new XQuery( "\n" + " map(function($e as xs:string) as xs:string { lower-case($e) }, map(function($n as xs:string){upper-case($n)},(\"john\", \"mary\", \"jane\", \"anne\", \"peter\", \"ian\")))\n" + " ", ctx); try { query.addDocument("fn/higherOrder/names.xml", file("fn/higherOrder/names.xml")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"john\", \"mary\", \"jane\", \"anne\", \"peter\", \"ian\"") ); } /** * Map using a named recursive function. */ @org.junit.Test public void map006() { final XQuery query = new XQuery( "\n" + " declare function local:children($n as node()) as node()* \n" + " { $n/child::node() }; \n" + " declare function local:attributes($e as node()) as node()* \n" + " { $e/attribute::node() }; \n" + " declare function local:self($e as node()) as node() \n" + " { $e }; \n" + " declare function local:union(\n" + " $f as function(node()) as node()*, \n" + " $g as function(node()) as node()*) as function(node()) as node()* { \n" + " function($a) {$f($a) | $g($a)} };\n" + " let $data := (/a), \n" + " $f := local:union(local:children#1, local:union(local:attributes#1, local:self#1)) \n" + " return map($f, $data/*)[not(. instance of attribute())]\n" + " ", ctx); try { query.context(node(file("fn/higherOrder/doc1.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * map function - input is an empty sequence. */ @org.junit.Test public void map007() { final XQuery query = new XQuery( "map(round#1, ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * map function - partial application. */ @org.junit.Test public void map008() { final XQuery query = new XQuery( "let $f := function($x as xs:double*){map(round#1, $x)} return $f((1.2345, 6.789))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1, 7") ); } /** * map function - error, function has the wrong arity. */ @org.junit.Test public void map901() { final XQuery query = new XQuery( "map(starts-with#2, (\"aa\", \"bb\", \"cc\", \"dd\", \"ee\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * map function - error, function can't handle one item in the sequence. */ @org.junit.Test public void map902() { final XQuery query = new XQuery( "map(upper-case#1, (\"aa\", \"bb\", \"cc\", \"dd\", 12))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * map function - error, first argument is not a function. */ @org.junit.Test public void map903() { final XQuery query = new XQuery( "map((), (\"aa\", \"bb\", \"cc\", \"dd\", 12))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnMapPairs.java000066400000000000000000000613321222453003200267540ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests the fn:map-pairs() function introduced in XPath 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnMapPairs extends QT3TestSet { /** * Attempts to evaluate the "map-pairs" function with no arguments.. */ @org.junit.Test public void fnMapPairs001() { final XQuery query = new XQuery( "fn:map-pairs()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "map-pairs" function with arity zero.. */ @org.junit.Test public void fnMapPairs002() { final XQuery query = new XQuery( "fn:map-pairs#0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to evaluate the "map-pairs" function with one argument.. */ @org.junit.Test public void fnMapPairs003() { final XQuery query = new XQuery( "fn:map-pairs( fn:concat#2 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "map-pairs" function with arity one.. */ @org.junit.Test public void fnMapPairs004() { final XQuery query = new XQuery( "fn:map-pairs#1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to evaluate the "map-pairs" function with two arguments.. */ @org.junit.Test public void fnMapPairs005() { final XQuery query = new XQuery( "fn:map-pairs( fn:concat#2, () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "map-pairs" function with arity one.. */ @org.junit.Test public void fnMapPairs006() { final XQuery query = new XQuery( "fn:map-pairs#2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to evaluate the "map-pairs" function with three arguments.. */ @org.junit.Test public void fnMapPairs007() { final XQuery query = new XQuery( "fn:map-pairs( fn:concat#2, (), () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEmpty() || error("XPST0005") ) ); } /** * Attempts to reference the "map-pairs" function with arity three.. */ @org.junit.Test public void fnMapPairs008() { final XQuery query = new XQuery( "fn:exists( fn:map-pairs#3 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Tests the type checking of the $f argument.. */ @org.junit.Test public void fnMapPairs009() { final XQuery query = new XQuery( "( fn:map-pairs( if ( fn:current-dateTime() eq\n" + " fn:dateTime( fn:current-date(),\n" + " fn:current-time() ))\n" + " then fn:concat#2 \n" + " else (),\n" + " (), () ),\n" + " fn:map-pairs( if ( fn:current-dateTime() eq\n" + " fn:dateTime( fn:current-date(),\n" + " fn:current-time() ))\n" + " then () \n" + " else fn:concat#2,\n" + " (), () ) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || error("XPST0005") || assertEmpty() ) ); } /** * Tests the type checking of the $f argument.. */ @org.junit.Test public void fnMapPairs011() { final XQuery query = new XQuery( "fn:map-pairs( (fn:concat#2, fn:concat#2), (), () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || error("XPST0005") || assertEmpty() ) ); } /** * Tests the type checking of the $f argument.. */ @org.junit.Test public void fnMapPairs012() { final XQuery query = new XQuery( "fn:map-pairs( fn:true(), (), () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || error("XPST0005") || assertEmpty() ) ); } /** * Tests the type checking of the $f argument.. */ @org.junit.Test public void fnMapPairs013() { final XQuery query = new XQuery( " fn:map-pairs( /root, (), () )", ctx); try { query.context(node(file("fn/map-pairs/fn-map-pairs-013.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || error("XPST0005") || assertEmpty() ) ); } /** * Tests the type checking of the $f argument.. */ @org.junit.Test public void fnMapPairs014() { final XQuery query = new XQuery( "fn:map-pairs( fn:boolean#1, (), () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || error("XPST0005") || assertEmpty() ) ); } /** * Tests the type checking of the $f argument.. */ @org.junit.Test public void fnMapPairs015() { final XQuery query = new XQuery( "fn:map-pairs( fn:concat#3, (), () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || error("XPST0005") || assertEmpty() ) ); } /** * Tests the type checking of the $f argument.. */ @org.junit.Test public void fnMapPairs016() { final XQuery query = new XQuery( "fn:map-pairs( function($a as item(), $b as item()) as item()* { fn:boolean($a), fn:boolean($b) }, (), () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || error("XPST0005") || assertEmpty() ) ); } /** * Evaluates the "map-pairs" function with $seq1, $seq2 set to a mix of item types . */ @org.junit.Test public void fnMapPairs017() { final XQuery query = new XQuery( "fn:map-pairs( function($a, $b) \n" + " { if ($a instance of function(*))\n" + " then $b instance of function(*)\n" + " else if ($b instance of function(*))\n" + " then false()\n" + " else deep-equal($a, $b)\n" + " },\n" + " (//node(), 1, \"string\", 3.14, 2.7e0, fn:exists#1),\n" + " (//node(), 1, \"string\", 3.14, 2.7e0, fn:exists#1) )", ctx); try { query.context(node(file("fn/map-pairs/fn-map-pairs-013.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true true true true true true true true true true true true true") ); } /** * Evaluates the "map-pairs" function with empty $seq1 and error in $seq2 . */ @org.junit.Test public void fnMapPairs018() { final XQuery query = new XQuery( "fn:map-pairs( concat#2, (), fn:error())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEmpty() || error("FOER0000") || error("XPST0005") ) ); } /** * Evaluates the "map-pairs" function with empty $seq2 and error in $seq1 . */ @org.junit.Test public void fnMapPairs019() { final XQuery query = new XQuery( "fn:map-pairs( concat#2, fn:error(), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEmpty() || error("FOER0000") || error("XPST0005") ) ); } /** * Evaluates the "map-pairs" function with a function which raises an error, $seq1 and $seq2 empty.. */ @org.junit.Test public void fnMapPairs020() { final XQuery query = new XQuery( "fn:map-pairs( function($arg, $arg2) { fn:error() }, (), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEmpty() || error("XPST0005") ) ); } /** * Evaluates the "map-pairs" function with a function which raises an error. */ @org.junit.Test public void fnMapPairs021() { final XQuery query = new XQuery( "fn:map-pairs( function($arg, $arg2) { fn:error() }, 1 to 10, 1 to 10)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * Evaluates the "map-pairs" function with a function which returns the empty sequence, $seq1 and $seq2 raise errors. */ @org.junit.Test public void fnMapPairs022() { final XQuery query = new XQuery( "fn:map-pairs( function($arg1, $arg2) { () }, fn:error(), fn:error())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEmpty() || error("XPST0005") || error("FOER0000") ) ); } /** * Evaluates the "map-pairs" function with a function which returns the empty sequence, $seq1 and $seq2 raise errors. */ @org.junit.Test public void fnMapPairs023() { final XQuery query = new XQuery( "fn:map-pairs( function($arg1, $arg2) { ($arg1, $arg2) }, (1, fn:error()), 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "1") || error("FOER0000") ) ); } /** * Evaluates the "map-pairs" function with a function which returns the empty sequence, $seq1 and $seq2 raise errors. */ @org.junit.Test public void fnMapPairs024() { final XQuery query = new XQuery( "fn:map-pairs( function($arg1, $arg2) { ($arg1, $arg2) }, 1, (1, fn:error()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "1 1") || error("FOER0000") ) ); } /** * Evaluates the "map-pairs" function with a function which returns exactly one item per call. */ @org.junit.Test public void fnMapPairs025() { final XQuery query = new XQuery( "fn:map-pairs( function($arg1, $arg2) { ($arg1 + $arg2) }, 1 to 3, 1 to 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2 4 6") ); } /** * Evaluates the "map-pairs" function with a function which returns zero or one item per call. */ @org.junit.Test public void fnMapPairs026() { final XQuery query = new XQuery( "fn:map-pairs( function($arg1, $arg2) { if ($arg1) then $arg2 else () }, (true(), false(), true()), 1 to 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 3") ); } /** * Evaluates the "map-pairs" function with a function which returns more than one item per call. */ @org.junit.Test public void fnMapPairs027() { final XQuery query = new XQuery( "fn:map-pairs( function($arg1, $arg2) { ($arg1, $arg2) }, 1 to 3, 1 to 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 1 2 2 3 3") ); } /** * Evaluates the "map-pairs" function with $f set to a function which expects integers, but is supplied with strings.. */ @org.junit.Test public void fnMapPairs028() { final XQuery query = new XQuery( "fn:map-pairs( function($arg1 as xs:integer, $arg2 as xs:integer) { $arg1 + $arg2 }, (\"1\", \"2\"), (1, 2) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluates the "map-pairs" function with $f set to a function which expects integers, but is supplied with strings.. */ @org.junit.Test public void fnMapPairs029() { final XQuery query = new XQuery( "fn:map-pairs( function($arg1 as xs:integer, $arg2 as xs:integer) { $arg1 + $arg2 }, (1, 2), (\"1\", \"2\") )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluates the "map-pairs" function with $f set to a function which expects integers, but is supplied with strings.. */ @org.junit.Test public void fnMapPairs030() { final XQuery query = new XQuery( "fn:map-pairs( function($arg1 as xs:integer, $arg2 as xs:integer) { $arg1 + $arg2 }, (\"1\", \"2\"), (\"1\", \"2\") )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the typ checking of the $f argument.. */ @org.junit.Test public void fnMapPairs031() { final XQuery query = new XQuery( "( fn:map-pairs( if ( fn:current-dateTime() eq\n" + " fn:dateTime( fn:current-date(),\n" + " fn:current-time() ))\n" + " then fn:concat#2 \n" + " else (),\n" + " (\"a\"), (\"b\") ),\n" + " fn:map-pairs( if ( fn:current-dateTime() eq\n" + " fn:dateTime( fn:current-date(),\n" + " fn:current-time() ))\n" + " then () \n" + " else fn:concat#2,\n" + " \"a\", \"b\" ) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the type checking of the $f argument.. */ @org.junit.Test public void fnMapPairs033() { final XQuery query = new XQuery( "fn:map-pairs( (fn:concat#2, fn:concat#2), \"a\", \"b\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the type checking of the $f argument.. */ @org.junit.Test public void fnMapPairs034() { final XQuery query = new XQuery( "fn:map-pairs( fn:true(), \"a\", \"b\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the type checking of the $f argument.. */ @org.junit.Test public void fnMapPairs035() { final XQuery query = new XQuery( " fn:map-pairs( /root, \"a\", \"b\" )", ctx); try { query.context(node(file("fn/map-pairs/fn-map-pairs-013.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the type checking of the $f argument.. */ @org.junit.Test public void fnMapPairs036() { final XQuery query = new XQuery( "fn:map-pairs( fn:boolean#1, \"a\", \"b\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the type checking of the $f argument.. */ @org.junit.Test public void fnMapPairs037() { final XQuery query = new XQuery( "fn:map-pairs( fn:concat#3, \"a\", \"b\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Apply deep-equal to corresponding pairs. */ @org.junit.Test public void mapPairs001() { final XQuery query = new XQuery( "map-pairs(deep-equal#2, (\"aa\", \"bb\", \"cc\", \"dd\", \"ee\"), (\"AA\", \"BB\", \"cc\", \"dd\", \"EE\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("false(), false(), true(), true(), false()") ); } /** * Apply deep-equal to corresponding pairs. */ @org.junit.Test public void mapPairs002() { final XQuery query = new XQuery( "map-pairs(deep-equal#2, (\"aa\", \"bb\", \"cc\", \"dd\", \"ee\", \"ff\"), (\"AA\", \"BB\", \"cc\", \"dd\", \"EE\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("false(), false(), true(), true(), false()") ); } /** * Apply deep-equal to corresponding pairs. */ @org.junit.Test public void mapPairs003() { final XQuery query = new XQuery( "map-pairs(deep-equal#2, (\"aa\", \"bb\", \"cc\", \"dd\", \"ee\"), (\"AA\", \"BB\", \"cc\", \"dd\", \"EE\", \"ff\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("false(), false(), true(), true(), false()") ); } /** * Apply concat to corresponding pairs. */ @org.junit.Test public void mapPairs004() { final XQuery query = new XQuery( "map-pairs(concat(?, '-', ?), (\"aa\", \"bb\", \"cc\", \"dd\", \"ee\"), (\"AA\", \"BB\", \"cc\", \"dd\", \"EE\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("'aa-AA', 'bb-BB', 'cc-cc', 'dd-dd', 'ee-EE'") ); } /** * Apply user-defined anonymous function to corresponding pairs. */ @org.junit.Test public void mapPairs005() { final XQuery query = new XQuery( "map-pairs(function($a as xs:integer, $b as xs:integer) as xs:integer{$a + $b}, 1 to 5, 1 to 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("2, 4, 6, 8, 10") ); } /** * Use a function that has a closure. */ @org.junit.Test public void mapPairs006() { final XQuery query = new XQuery( " \n" + " let $millenium := year-from-date(current-date()) idiv 1000 \n" + " return map-pairs(function($a as xs:integer, $b as xs:integer) as xs:integer{$a + $b + $millenium}, 1 to 5, 2 to 6)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("5, 7, 9, 11, 13") ); } /** * Use a function that has a closure. */ @org.junit.Test public void mapPairs007() { final XQuery query = new XQuery( " \n" + " let $millenium := year-from-date(current-date()) idiv 1000 \n" + " return map-pairs(function($a, $b) as xs:integer* {1 to (string-length($a) + string-length($b))}, (\"a\", \"ab\", \"abc\", \"\"), (\"\", \"\", \"\", \"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1, 1, 2, 1, 2, 3") ); } /** * map-pairs function - exercise from XML Prague 2010: * form sum of adjacent values in an input sequence. */ @org.junit.Test public void mapPairs008() { final XQuery query = new XQuery( " let $in := 1 to 5 return map-pairs(function($a, $b){$a+$b}, $in, tail($in)) ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("3, 5, 7, 9") ); } /** * map-pairs function, wrong arity function. */ @org.junit.Test public void mapPairs901() { final XQuery query = new XQuery( "map-pairs(deep-equal#3, (\"aa\", \"bb\", \"cc\", \"dd\", \"ee\"), (\"AA\", \"BB\", \"cc\", \"dd\", \"EE\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * map-pairs function, wrong input to function. */ @org.junit.Test public void mapPairs902() { final XQuery query = new XQuery( "map-pairs(contains#2, (\"aa\", \"bb\", \"cc\", \"dd\", \"ee\"), (\"AA\", \"BB\", \"cc\", \"dd\", 12))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnMatches.java000066400000000000000000002062451222453003200266300ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Test the fn:matches() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnMatches extends QT3TestSet { /** * The pattern can't be the empty sequence. . */ @org.junit.Test public void kMatchesFunc1() { final XQuery query = new XQuery( "matches(\"input\", ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * fn:matches() takes at least two arguments, not one. . */ @org.junit.Test public void kMatchesFunc2() { final XQuery query = new XQuery( "matches(\"input\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * The third argument cannot be the empty sequence. . */ @org.junit.Test public void kMatchesFunc3() { final XQuery query = new XQuery( "matches(\"input\", \"pattern\", ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Only three arguments are accepted. . */ @org.junit.Test public void kMatchesFunc4() { final XQuery query = new XQuery( "matches(\"input\", \"pattern\", \"\", ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * The flags argument cannot contain whitespace. . */ @org.junit.Test public void kMatchesFunc5() { final XQuery query = new XQuery( "matches(\"input\", \"pattern\", \" \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0001") ); } /** * The flags argument cannot contain 'X'. . */ @org.junit.Test public void kMatchesFunc6() { final XQuery query = new XQuery( "matches(\"input\", \"pattern\", \"X\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0001") ); } /** * Whitespace in the regexp is collapsed. . */ @org.junit.Test public void k2MatchesFunc1() { final XQuery query = new XQuery( "fn:matches(\"hello world\", \"hello\\ sworld\", \"x\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A non-matching backwards-reference matches the empty string. . */ @org.junit.Test public void k2MatchesFunc10() { final XQuery query = new XQuery( "matches(\"input\", \"\\3\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Use a back reference inside a character class. . */ @org.junit.Test public void k2MatchesFunc11() { final XQuery query = new XQuery( "matches(\"abcd\", \"(asd)[\\1]\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Use a back reference inside a character class(#2). . */ @org.junit.Test public void k2MatchesFunc12() { final XQuery query = new XQuery( "matches(\"abcd\", \"(asd)[asd\\1]\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Use a back reference inside a character class(#3). . */ @org.junit.Test public void k2MatchesFunc13() { final XQuery query = new XQuery( "matches(\"abcd\", \"(asd)[asd\\0]\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Use a back reference inside a character class(#3). . */ @org.junit.Test public void k2MatchesFunc14() { final XQuery query = new XQuery( "matches(\"abcd\", \"1[asd\\0]\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * A negative character class never match a non-character. . */ @org.junit.Test public void k2MatchesFunc15() { final XQuery query = new XQuery( "fn:matches(\"a\", \"a[^b]\"), fn:matches(\"a \", \"a[^b]\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("false(), true()") ); } /** * Use a pattern whose interpretation is unknown. See public report 4466. . */ @org.junit.Test public void k2MatchesFunc16() { final XQuery query = new XQuery( "fn:matches(\"input\", \"[0-9-.]*/\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "false") || error("FORG0001") ) ); } /** * Caseless match with back-reference. . */ @org.junit.Test public void k2MatchesFunc17() { final XQuery query = new XQuery( "matches('aA', '(a)\\1', 'i')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Whitespace(before) in the regexp is collapsed, but not inside a character class. . */ @org.junit.Test public void k2MatchesFunc2() { final XQuery query = new XQuery( "fn:matches(\"hello world\", \" hello[ ]world\", \"x\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Whitespace(after) in the regexp is collapsed, but not inside a character class. . */ @org.junit.Test public void k2MatchesFunc3() { final XQuery query = new XQuery( "fn:matches(\"hello world\", \"hello[ ]world \", \"x\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Whitespace(in the middle) in the regexp is collapsed, but not inside a character class. . */ @org.junit.Test public void k2MatchesFunc4() { final XQuery query = new XQuery( "fn:matches(\"hello world\", \"he ll o[ ]worl d\", \"x\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * whitespace in the regexp is collapsed, and should therefore compile. . */ @org.junit.Test public void k2MatchesFunc5() { final XQuery query = new XQuery( "fn:matches(\"hello world\", \"\\p{ IsBasicLatin}+\", \"x\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * whitespace in the regexp is collapsed completely, and should therefore compile and match. . */ @org.junit.Test public void k2MatchesFunc6() { final XQuery query = new XQuery( "fn:matches(\"hello world\", \"\\p{ I s B a s i c L a t i n }+\", \"x\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * whitespace in the regexp is not collapsed, and should therefore not compile. . */ @org.junit.Test public void k2MatchesFunc7() { final XQuery query = new XQuery( "fn:matches(\"hello world\", \"\\p{ IsBasicLatin}+\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Since no string is captured by the back-reference, the single character is matched. . */ @org.junit.Test public void k2MatchesFunc8() { final XQuery query = new XQuery( "fn:matches(\"h\", \"(.)\\3\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Since no string is captured by the back-reference, the single character is matched(#2). . */ @org.junit.Test public void k2MatchesFunc9() { final XQuery query = new XQuery( "fn:matches(\"h\", \"(.)\\2\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Simple call of matches() with "i" flag . */ @org.junit.Test public void caselessmatch01() { final XQuery query = new XQuery( "matches('abc', 'ABC', 'i')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Call of matches() with "i" flag and a character range . */ @org.junit.Test public void caselessmatch02() { final XQuery query = new XQuery( "matches('abZ', '[A-Z]*', 'i')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Call of matches() with "i" flag and a character range . */ @org.junit.Test public void caselessmatch03() { final XQuery query = new XQuery( "matches('abZ', '[a-z]*', 'i')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Call of matches() with "i" flag and Kelvin sign Kelvin sign . */ @org.junit.Test public void caselessmatch04() { final XQuery query = new XQuery( "matches(codepoints-to-string(8490), '[A-Z]', 'i')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Call of matches() with "i" flag and Kelvin sign Kelvin sign . */ @org.junit.Test public void caselessmatch05() { final XQuery query = new XQuery( "matches(codepoints-to-string(8490), '[a-z]', 'i')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Call of matches() with "i" flag and Kelvin sign Kelvin sign . */ @org.junit.Test public void caselessmatch06() { final XQuery query = new XQuery( "matches(codepoints-to-string(8490), 'K', 'i')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Call of matches() with "i" flag and Kelvin sign Kelvin sign . */ @org.junit.Test public void caselessmatch07() { final XQuery query = new XQuery( "matches(codepoints-to-string(8490), 'k', 'i')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Call of matches() with "i" flag and range subtraction . */ @org.junit.Test public void caselessmatch08() { final XQuery query = new XQuery( "matches('x', '[A-Z-[OI]]', 'i')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Call of matches() with "i" flag and range subtraction . */ @org.junit.Test public void caselessmatch09() { final XQuery query = new XQuery( "matches('X', '[A-Z-[OI]]', 'i')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Call of matches() with "i" flag and range subtraction . */ @org.junit.Test public void caselessmatch10() { final XQuery query = new XQuery( "matches('O', '[A-Z-[OI]]', 'i')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Call of matches() with "i" flag and range subtraction . */ @org.junit.Test public void caselessmatch11() { final XQuery query = new XQuery( "matches('i', '[A-Z-[OI]]', 'i')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Call of matches() with "i" flag and negation . */ @org.junit.Test public void caselessmatch12() { final XQuery query = new XQuery( "matches('Q', '[^Q]', 'i')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Call of matches() with "i" flag and negation . */ @org.junit.Test public void caselessmatch13() { final XQuery query = new XQuery( "matches('q', '[^Q]', 'i')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Call of matches() with "i" flag and upper-case category . */ @org.junit.Test public void caselessmatch14() { final XQuery query = new XQuery( "matches('m', '\\p{Lu}', 'i')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Call of matches() with "i" flag and upper-case category . */ @org.junit.Test public void caselessmatch15() { final XQuery query = new XQuery( "matches('m', '\\P{Lu}', 'i')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test an invalid negative pos char group . */ @org.junit.Test public void cbclMatches001() { final XQuery query = new XQuery( "fn:matches('foo', '[^]')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * test an invalid char range . */ @org.junit.Test public void cbclMatches002() { final XQuery query = new XQuery( "fn:matches('foo', '[a-\\b]')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * test a two-digit back reference . */ @org.junit.Test public void cbclMatches003() { final XQuery query = new XQuery( "fn:matches('abcdefghijkabcdefghijk', '(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\\1\\2\\3\\4\\5\\6\\7\\8\\9\\10\\11')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test a very large exact quantifier . */ @org.junit.Test public void cbclMatches004() { final XQuery query = new XQuery( "fn:matches('aaa', 'a{99999999999999999999999999}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * test with an invalid character range . */ @org.junit.Test public void cbclMatches005() { final XQuery query = new XQuery( "fn:matches('a', '[a--]')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * test with a character class containing an escaped character . */ @org.junit.Test public void cbclMatches006() { final XQuery query = new XQuery( "fn:matches(' ', '[\\t]')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test with a character class beginning with a '-' . */ @org.junit.Test public void cbclMatches007() { final XQuery query = new XQuery( "fn:matches('-abba-', '[-ab]+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test a badly formed category name . */ @org.junit.Test public void cbclMatches008() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{L')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * test a badly formed category name . */ @org.junit.Test public void cbclMatches009() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{M')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * test a badly formed category name . */ @org.junit.Test public void cbclMatches010() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{N')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * test a badly formed category name . */ @org.junit.Test public void cbclMatches011() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{P')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * test a badly formed category name . */ @org.junit.Test public void cbclMatches012() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{Z')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * test a badly formed category name . */ @org.junit.Test public void cbclMatches013() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{S')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * test a badly formed category name . */ @org.junit.Test public void cbclMatches014() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{C')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * test category name L . */ @org.junit.Test public void cbclMatches015() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{L}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test category name M . */ @org.junit.Test public void cbclMatches016() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{M}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test category name N . */ @org.junit.Test public void cbclMatches017() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{N}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test category name P . */ @org.junit.Test public void cbclMatches018() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{P}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test category name Z . */ @org.junit.Test public void cbclMatches019() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{Z}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test category name S . */ @org.junit.Test public void cbclMatches020() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{S}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test category name C . */ @org.junit.Test public void cbclMatches021() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{C}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test category name Lu . */ @org.junit.Test public void cbclMatches022() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{Lu}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test category name Me . */ @org.junit.Test public void cbclMatches023() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{Me}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test category name No . */ @org.junit.Test public void cbclMatches024() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{No}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test category name Pf . */ @org.junit.Test public void cbclMatches025() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{Pf}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test category name Zs . */ @org.junit.Test public void cbclMatches026() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{Zs}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test category name Sk . */ @org.junit.Test public void cbclMatches027() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{Sk}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test category name Cc . */ @org.junit.Test public void cbclMatches028() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{Cc}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test invalid category name La . */ @org.junit.Test public void cbclMatches029() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{La}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * test invalid category name Ma . */ @org.junit.Test public void cbclMatches030() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{Ma}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * test invalid category name Na . */ @org.junit.Test public void cbclMatches031() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{Na}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * test invalid category name Pa . */ @org.junit.Test public void cbclMatches032() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{Pa}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * test invalid category name Za . */ @org.junit.Test public void cbclMatches033() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{Za}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * test invalid category name Sa . */ @org.junit.Test public void cbclMatches034() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{Sa}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * test invalid category name Ca . */ @org.junit.Test public void cbclMatches035() { final XQuery query = new XQuery( "fn:matches('foo', '\\P{Ca}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * test an empty branch . */ @org.junit.Test public void cbclMatches036() { final XQuery query = new XQuery( "fn:matches('foo', 'a()b')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test a multibyte Unicode character . */ @org.junit.Test public void cbclMatches037() { final XQuery query = new XQuery( "fn:matches('𐀀', '𐀀')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test a large exact quantifier . */ @org.junit.Test public void cbclMatches038() { final XQuery query = new XQuery( "fn:matches('aaa', 'a{2147483647}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test a two-digit back reference . */ @org.junit.Test public void cbclMatches039() { final XQuery query = new XQuery( "fn:matches('abcdefghiabcdefghia0a1', '(a)(b)(c)(d)(e)(f)(g)(h)(i)\\1\\2\\3\\4\\5\\6\\7\\8\\9\\10\\11')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test the multi-character escape \S . */ @org.junit.Test public void cbclMatches040() { final XQuery query = new XQuery( "fn:matches('abc', '\\S+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test the multi-character escape \S . */ @org.junit.Test public void cbclMatches041() { final XQuery query = new XQuery( "fn:matches(' ', '\\S+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test the multi-character escape \i . */ @org.junit.Test public void cbclMatches042() { final XQuery query = new XQuery( "fn:matches('a_:', '\\i+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test the multi-character escape \i . */ @org.junit.Test public void cbclMatches043() { final XQuery query = new XQuery( "fn:matches('1.0', '\\i+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test the multi-character escape \I . */ @org.junit.Test public void cbclMatches044() { final XQuery query = new XQuery( "fn:matches('1.0', '\\I+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test the multi-character escape \I . */ @org.junit.Test public void cbclMatches045() { final XQuery query = new XQuery( "fn:matches('a_:', '\\I+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test the multi-character escape \c . */ @org.junit.Test public void cbclMatches046() { final XQuery query = new XQuery( "fn:matches('abc', '\\c+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test the multi-character escape \c . */ @org.junit.Test public void cbclMatches047() { final XQuery query = new XQuery( "fn:matches(' ', '\\c+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test the multi-character escape \C . */ @org.junit.Test public void cbclMatches048() { final XQuery query = new XQuery( "fn:matches(' ', '\\C+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test the multi-character escape \C . */ @org.junit.Test public void cbclMatches049() { final XQuery query = new XQuery( "fn:matches('abc', '\\C+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * A back-reference is compared using case-blind comparison: that is, each character must either be the same as the corresponding character of the previously matched string, or must be a case-variant of that character. the back reference. For example, the strings "Mum", "mom", "Dad", and "DUD" all match the regular expression "([md])[aeiou]\1" when the "i" flag is used. . */ @org.junit.Test public void cbclMatches050() { final XQuery query = new XQuery( "fn:matches('Mum', '([md])[aeiou]\\1', 'i')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test back-reference to character above &#FFFF; . */ @org.junit.Test public void cbclMatches051() { final XQuery query = new XQuery( "fn:matches('𐀀𐀀', '(𐀀)\\1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test back-reference to character above &#FFFF; . */ @org.junit.Test public void cbclMatches052() { final XQuery query = new XQuery( "fn:matches('𐀀𐀁', '(𐀀)\\1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * A back-reference is compared using case-blind comparison: that is, each character must either be the same as the corresponding character of the previously matched string, or must be a case-variant of that character. the back reference. For example, the strings "Mum", "mom", "Dad", and "DUD" all match the regular expression "([md])[aeiou]\1" when the "i" flag is used. . */ @org.junit.Test public void cbclMatches053() { final XQuery query = new XQuery( "fn:matches('Mud', '([md])[aeiou]\\1', 'i')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of matches function as per example 1 (for this function) . */ @org.junit.Test public void fnMatches1() { final XQuery query = new XQuery( "fn:matches(\"abracadabra\", \"bra\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of matches function with pattern set to "\{" for an input string that contains "}". . */ @org.junit.Test public void fnMatches10() { final XQuery query = new XQuery( "fn:matches(\"abracadabra{abracadabra\", \"\\{\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of matches function with pattern set to "\}" for an input string that contains "}". . */ @org.junit.Test public void fnMatches11() { final XQuery query = new XQuery( "fn:matches(\"abracadabra}abracadabra\", \"\\}\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of matches function with pattern set to "\(" for an input string that contains "(". . */ @org.junit.Test public void fnMatches12() { final XQuery query = new XQuery( "fn:matches(\"abracadabra(abracadabra\", \"\\(\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of matches function with pattern set to "\)" for an input string that contains ")". . */ @org.junit.Test public void fnMatches13() { final XQuery query = new XQuery( "fn:matches(\"abracadabra)abracadabra\", \"\\)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of matches function with pattern set to "\[" for an input string that contains "[". . */ @org.junit.Test public void fnMatches14() { final XQuery query = new XQuery( "fn:matches(\"abracadabra[abracadabra\", \"\\[\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of matches function with pattern set to "\]" for an input string that contains "]". . */ @org.junit.Test public void fnMatches15() { final XQuery query = new XQuery( "fn:matches(\"abracadabra]abracadabra\", \"\\]\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of matches function with pattern set to "\-" for an input string that contains "-". . */ @org.junit.Test public void fnMatches16() { final XQuery query = new XQuery( "fn:matches(\"abracadabra-abracadabra\", \"\\-\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of matches function with pattern set to "\." for an input string that contains ".". . */ @org.junit.Test public void fnMatches17() { final XQuery query = new XQuery( "fn:matches(\"abracadabra.abracadabra\", \"\\.\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of matches function with pattern set to "\|" for an input string that contains "|". . */ @org.junit.Test public void fnMatches18() { final XQuery query = new XQuery( "fn:matches(\"abracadabra|abracadabra\", \"\\|\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of matches function with pattern set to "\\" for an input string that contains "\". . */ @org.junit.Test public void fnMatches19() { final XQuery query = new XQuery( "fn:matches(\"abracadabra\\abracadabra\", \"\\\\\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of matches function as per example 2 (for this function). Pattern set to "^a.*a$". . */ @org.junit.Test public void fnMatches2() { final XQuery query = new XQuery( "fn:matches(\"abracadabra\", \"^a.*a$\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of matches function with pattern set to "\t" for an input string that contains the tab character. . */ @org.junit.Test public void fnMatches20() { final XQuery query = new XQuery( "fn:matches(\"abracadabra\tabracadabra\", \"\\t\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of matches function with pattern set to "\n" for an input string that contains the newline character. . */ @org.junit.Test public void fnMatches21() { final XQuery query = new XQuery( "fn:matches(\"abracadabra\n" + "abracadabra\", \"\\n\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of matches function with pattern set to "aa{1}" (exact quantity) for an input string that contains the "aa" string. . */ @org.junit.Test public void fnMatches22() { final XQuery query = new XQuery( "fn:matches(\"abracadabraabracadabra\", \"aa{1}\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of matches function with pattern set to "aa{1,}" (min quantity) for an input string that contains the "aa" string twice. . */ @org.junit.Test public void fnMatches23() { final XQuery query = new XQuery( "fn:matches(\"abracadabraabracadabraabracadabra\", \"aa{1,}\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of matches function with pattern set to "aa{1,2}" (range quantity) for an input string that contains the "aa" string twice. . */ @org.junit.Test public void fnMatches24() { final XQuery query = new XQuery( "fn:matches(\"abracadabraabracadabraabracadabra\", \"aa{1,2}\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of matches function with invalid regular expression . */ @org.junit.Test public void fnMatches25() { final XQuery query = new XQuery( "fn:matches(\"abracadabra\", \"**%%\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Check for the correct behavior of ^ and $ in multi-line mode This test case was motivated by the resolution of Bug Report 4543. * Note that '^' matches the position after any newline other than a newline that is the last character in the input string.. */ @org.junit.Test public void fnMatches26() { final XQuery query = new XQuery( "fn:matches(concat('abcd', codepoints-to-string(10), 'defg', codepoints-to-string(10)), \"^$\", \"m\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Check for the correct behavior of ^ and $ in multi-line mode This test case was motivated by the resolution of Bug Report 4543 . */ @org.junit.Test public void fnMatches27() { final XQuery query = new XQuery( "fn:matches(\"\n" + "abcd\n" + "defg\n" + "\", \"^$\", \"m\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check for the correct behavior of ^ and $ in multi-line mode This test case was motivated by the resolution of Bug Report 4543 . */ @org.junit.Test public void fnMatches28() { final XQuery query = new XQuery( "fn:matches(\"abcd\n" + "\n" + "defg\n" + "\", \"^$\", \"m\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 2-digits not treated as a back-reference See erratum FO.E24 . */ @org.junit.Test public void fnMatches29() { final XQuery query = new XQuery( "fn:matches(\"#abc#1\", \"^(#)abc\\11$\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of matches function as per example 3 (for this function). Pattern set to "^bra" . */ @org.junit.Test public void fnMatches3() { final XQuery query = new XQuery( "fn:matches(\"abracadabra\", \"^bra\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * 2-digits treated as a back-reference See erratum FO.E24 . */ @org.junit.Test public void fnMatches30() { final XQuery query = new XQuery( "fn:matches(\"#abcdefghijklmnopq#1\", \"^(#)(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)(m)(n)(o)(p)(q)\\11$\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of matches function with non-capturing groups (allowed in XPath 3.0) . */ @org.junit.Test public void fnMatches31() { final XQuery query = new XQuery( "fn:matches(\"abracadabra\", \"(?:abra(?:cad)?)*\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of matches function with "q" flag (allowed in XQuery 3.0) . */ @org.junit.Test public void fnMatches32() { final XQuery query = new XQuery( "fn:matches(\"abracadabra\", \"(?:abra(?:cad)?)*\", \"q\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of matches function with "q" flag (allowed in XQuery 3.0) . */ @org.junit.Test public void fnMatches33() { final XQuery query = new XQuery( "fn:matches(\"x[y-z]\", \"x[y-z]\", \"q\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of matches function with "q" and "i" flags (allowed in XQuery 3.0) . */ @org.junit.Test public void fnMatches34() { final XQuery query = new XQuery( "fn:matches(\"x[Y-z]\", \"X[y-Z]\", \"qi\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test for bug fix of 5348 in Errata for F+O. Expect FORX0002 err because \99 is an invalid reference as 99th subexpression does not exist . */ @org.junit.Test public void fnMatches35() { final XQuery query = new XQuery( "fn:matches('aA', '(a)\\99')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test for bug fix of 5348 in Errata for F+O. ok match here . */ @org.junit.Test public void fnMatches36() { final XQuery query = new XQuery( "fn:matches('abcdefghijj', '(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)\\10')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test for bug fix of 5348 in Errata for F+O. Expect FORX0002 err because \11 reference is made before the closing right parenthesis of 11th reference . */ @org.junit.Test public void fnMatches37() { final XQuery query = new XQuery( "fn:matches('abcdefghijk', '(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k\\11)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test for bug fix of 5348 in Errata for F+O. Expect FORX0002 err because \10 reference is made before the closing right parenthesis of 10th reference . */ @org.junit.Test public void fnMatches38() { final XQuery query = new XQuery( "fn:matches('abcdefghijj', '(a)(b)(c)(d)(e)(f)(g)(h)(i)(j\\10)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test for bug fix of 5348 in Errata for F+O. Expect FORX0002 err because \9 reference is made before the closing right parenthesis of 9th reference . */ @org.junit.Test public void fnMatches39() { final XQuery query = new XQuery( "fn:matches('abcdefghii', '(a)(b)(c)(d)(e)(f)(g)(h)(i\\9)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test that calling the function with flags set to the empty string is the same as ommiting the flags. . */ @org.junit.Test public void fnMatches4() { final XQuery query = new XQuery( "fn:concat(fn:matches(\"abracadabra\", \"^bra\"),fn:matches(\"abracadabra\", \"^bra\", \"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "falsefalse") ); } /** * Test for bug fix of 5348 in Errata for F+O. Expect FORX0002 err because \1 reference is made before the closing right parenthesis of 1st reference . */ @org.junit.Test public void fnMatches40() { final XQuery query = new XQuery( "fn:matches('aa', '(a\\1)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Handling of final newline with non-multiline mode . */ @org.junit.Test public void fnMatches41() { final XQuery query = new XQuery( "fn:matches(concat('Mary', codepoints-to-string(10)), 'Mary$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Handling of final newline with $ in dot-all mode . */ @org.junit.Test public void fnMatches42() { final XQuery query = new XQuery( "fn:matches(concat('Mary', codepoints-to-string(10)), 'Mary$', 's')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * "." doesn't normally match newline . */ @org.junit.Test public void fnMatches43() { final XQuery query = new XQuery( "fn:matches(concat('Mary', codepoints-to-string(10), 'Jones'), 'Mary.Jones')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * "." does match newline in dot-all mode. */ @org.junit.Test public void fnMatches44() { final XQuery query = new XQuery( "fn:matches(concat('Mary', codepoints-to-string(10), 'Jones'), 'Mary.Jones', 's')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * "." does NOT match CR in default mode. */ @org.junit.Test public void fnMatches45() { final XQuery query = new XQuery( "fn:matches(concat('Mary', codepoints-to-string(13), 'Jones'), 'Mary.Jones')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * "." does match CR in dot-all mode. */ @org.junit.Test public void fnMatches46() { final XQuery query = new XQuery( "fn:matches(concat('Mary', codepoints-to-string(13), 'Jones'), 'Mary.Jones', 's')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check for the correct behavior of $ when not in multi-line mode. * The correct answer according to the spec is false; though some regex engines * are known to report true.. */ @org.junit.Test public void fnMatches47() { final XQuery query = new XQuery( "fn:matches(concat('abcd', codepoints-to-string(10), 'defg', codepoints-to-string(10)), \"g$\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Edge condition: match occurs at last character. . */ @org.junit.Test public void fnMatches48() { final XQuery query = new XQuery( "fn:matches(\"abracadabra-abracadabra.\", \"\\.\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Edge condition: match occurs at last character. . */ @org.junit.Test public void fnMatches49() { final XQuery query = new XQuery( "fn:matches(\"abracadabra-abracadabra-3\", \"(124|864|377|3)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluate the fn:mathes function with the input string set to the empty sequence. fn:count used to avoid empty file. . */ @org.junit.Test public void fnMatches5() { final XQuery query = new XQuery( "fn:count(fn:matches(\"()\", \"^bra\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluation of matches function with pattern set to "\^". . */ @org.junit.Test public void fnMatches6() { final XQuery query = new XQuery( "fn:matches(\"abracadabra^abracadabra\", \"\\^\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of matches function with pattern set to "\?" for an input string that contains "?". . */ @org.junit.Test public void fnMatches7() { final XQuery query = new XQuery( "fn:matches(\"abracadabra?abracadabra\", \"\\?\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of matches function with pattern set to "\*" for an input string that contains "*". . */ @org.junit.Test public void fnMatches8() { final XQuery query = new XQuery( "fn:matches(\"abracadabra*abracadabra\", \"\\*\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of matches function with pattern set to "\+" for an input string that contains "+". . */ @org.junit.Test public void fnMatches9() { final XQuery query = new XQuery( "fn:matches(\"abracadabra+abracadabra\", \"\\+\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "matches" function with the arguments set as follows: $input = xs:string(lower bound) $pattern = xs:string(lower bound) . */ @org.junit.Test public void fnMatches2args1() { final XQuery query = new XQuery( "fn:matches(\"This is a characte\",\"This is a characte\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "matches" function with the arguments set as follows: $input = xs:string(mid range) $pattern = xs:string(lower bound) . */ @org.junit.Test public void fnMatches2args2() { final XQuery query = new XQuery( "fn:matches(\"This is a characte\",\"This is a characte\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "matches" function with the arguments set as follows: $input = xs:string(upper bound) $pattern = xs:string(lower bound) . */ @org.junit.Test public void fnMatches2args3() { final XQuery query = new XQuery( "fn:matches(\"This is a characte\",\"This is a characte\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "matches" function with the arguments set as follows: $input = xs:string(lower bound) $pattern = xs:string(mid range) . */ @org.junit.Test public void fnMatches2args4() { final XQuery query = new XQuery( "fn:matches(\"This is a characte\",\"This is a characte\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "matches" function with the arguments set as follows: $input = xs:string(lower bound) $pattern = xs:string(upper bound) . */ @org.junit.Test public void fnMatches2args5() { final XQuery query = new XQuery( "fn:matches(\"This is a characte\",\"This is a characte\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invalid flag for third argument of fn:matches. . */ @org.junit.Test public void fnMatchesErr1() { final XQuery query = new XQuery( "fn:matches(\"abracadabra\", \"bra\", \"p\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0001") ); } /** * back-reference illegal in square brackets See erratum FO.E24 . */ @org.junit.Test public void fnMatchesErr2() { final XQuery query = new XQuery( "fn:matches(\"#abc#1\", \"^(#)abc[\\1]1$\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * single-digit back-reference to non-existent group See erratum FO.E24 . */ @org.junit.Test public void fnMatchesErr3() { final XQuery query = new XQuery( "fn:matches(\"#abc#1\", \"^(#)abc\\2$\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * single-digit back-reference to group not yet closed See erratum FO.E24 . */ @org.junit.Test public void fnMatchesErr4() { final XQuery query = new XQuery( "fn:matches(\"#abc#1\", \"^((#)abc\\1)$\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * double-digit back-reference to group not yet closed See erratum FO.E24 . */ @org.junit.Test public void fnMatchesErr5() { final XQuery query = new XQuery( "fn:matches(\"abcdefghijklmnopq\", \"(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)((m)(n)(o)(p)(q)\\13)$\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnMatchesRe.java000066400000000000000000023574631222453003200271320ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Test regular expression syntax in the fn:matches() function. * These tests are created from the XSLT test suite, which in turn are derived * from the Microsoft regular expression tests submitted to W3C as part of the * XML Schema test suite, with expected results added based on actual Saxon results. * * Because the tests have been generated to use non-capturing groups, they require * support for XPath 3.0 regular expressions.. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnMatchesRe extends QT3TestSet { /** * Test regex syntax. */ @org.junit.Test public void re00001() { final XQuery query = new XQuery( "(every $s in tokenize(',', ',') satisfies matches($s, '^(?:)$')) and (every $s in tokenize('a,#x20;,#xD;,#x9;,#xA;', ',') satisfies not(matches($s, '^(?:)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00002() { final XQuery query = new XQuery( "(every $s in tokenize('a', ',') satisfies matches($s, '^(?:a)$')) and (every $s in tokenize('aa,b,', ',') satisfies not(matches($s, '^(?:a)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00003() { final XQuery query = new XQuery( "(every $s in tokenize('a', ',') satisfies matches($s, '^(?:a|a)$')) and (every $s in tokenize('aa,b,', ',') satisfies not(matches($s, '^(?:a|a)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00004() { final XQuery query = new XQuery( "(every $s in tokenize('a,b', ',') satisfies matches($s, '^(?:a|b)$')) and (every $s in tokenize('aa,bb,ab,', ',') satisfies not(matches($s, '^(?:a|b)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00005() { final XQuery query = new XQuery( "(every $s in tokenize('ab', ',') satisfies matches($s, '^(?:ab)$')) and (every $s in tokenize('a,b,aa,bb,', ',') satisfies not(matches($s, '^(?:ab)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00006() { final XQuery query = new XQuery( "(every $s in tokenize('a,b,c,d', ',') satisfies matches($s, '^(?:a|b|a|c|b|d|a)$')) and (every $s in tokenize('aa,ac,e', ',') satisfies not(matches($s, '^(?:a|b|a|c|b|d|a)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00007() { final XQuery query = new XQuery( "(every $s in tokenize(' a', ',') satisfies matches($s, '^(?: a|b )$')) and (every $s in tokenize('abc', ',') satisfies not(matches($s, '^(?: a|b )$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00008() { final XQuery query = new XQuery( "(every $s in tokenize('ac,abc', ',') satisfies matches($s, '^(?:ab?c)$')) and (every $s in tokenize('a,ab,bc,', ',') satisfies not(matches($s, '^(?:ab?c)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00009() { final XQuery query = new XQuery( "(every $s in tokenize('ab,abc', ',') satisfies matches($s, '^(?:abc?)$')) and (every $s in tokenize('a,bc,abcc,', ',') satisfies not(matches($s, '^(?:abc?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00010() { final XQuery query = new XQuery( "(every $s in tokenize('abc,abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbc', ',') satisfies matches($s, '^(?:ab+c)$')) and (every $s in tokenize('ac,bbbc,abbb,', ',') satisfies not(matches($s, '^(?:ab+c)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00011() { final XQuery query = new XQuery( "(every $s in tokenize('abc,abccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', ',') satisfies matches($s, '^(?:abc+)$')) and (every $s in tokenize('a,ab,abcd', ',') satisfies not(matches($s, '^(?:abc+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00012() { final XQuery query = new XQuery( "(every $s in tokenize('abc,abbbbbbbc,ac', ',') satisfies matches($s, '^(?:ab*c)$')) and (every $s in tokenize('a,ab,bc,c,abcb,', ',') satisfies not(matches($s, '^(?:ab*c)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00013() { final XQuery query = new XQuery( "(every $s in tokenize('abc,ab,abccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc', ',') satisfies matches($s, '^(?:abc*)$')) and (every $s in tokenize('a,abcd,abbc,', ',') satisfies not(matches($s, '^(?:abc*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00014() { final XQuery query = new XQuery( "(every $s in tokenize('b,ab,bcccccc,abc,abbbc', ',') satisfies matches($s, '^(?:a?b+c*)$')) and (every $s in tokenize('aabc,a,c,ac,', ',') satisfies not(matches($s, '^(?:a?b+c*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00015() { final XQuery query = new XQuery( "(every $s in tokenize('abc?,abbbc??,abca??,abbbbca?', ',') satisfies matches($s, '^(?:(ab+c)a?\\?\\??)$')) and (every $s in tokenize('ac??,bc??,abc,abc???', ',') satisfies not(matches($s, '^(?:(ab+c)a?\\?\\??)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00016() { final XQuery query = new XQuery( "matches('qwerty','?a')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00017() { final XQuery query = new XQuery( "matches('qwerty','+a')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00018() { final XQuery query = new XQuery( "matches('qwerty','*a')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00019() { final XQuery query = new XQuery( "matches('qwerty','{1}a')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00020() { final XQuery query = new XQuery( "(every $s in tokenize(',', ',') satisfies matches($s, '^(?:a{0})$')) and (every $s in tokenize('a', ',') satisfies not(matches($s, '^(?:a{0})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00021() { final XQuery query = new XQuery( "matches('qwerty','a{2,1}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00022() { final XQuery query = new XQuery( "matches('qwerty','a{1,0}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00023() { final XQuery query = new XQuery( "(every $s in tokenize('abab,', ',') satisfies matches($s, '^(?:((ab){2})?)$')) and (every $s in tokenize('a,ab,ababa,abababab', ',') satisfies not(matches($s, '^(?:((ab){2})?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00024() { final XQuery query = new XQuery( "(every $s in tokenize('aa,aaaa,aaaaaaaaaaaaaaaaaaaa', ',') satisfies matches($s, '^(?:(a{2})+)$')) and (every $s in tokenize(',a,a2,aaa', ',') satisfies not(matches($s, '^(?:(a{2})+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00025() { final XQuery query = new XQuery( "(every $s in tokenize(',aa,aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', ',') satisfies matches($s, '^(?:(a{2})*)$')) and (every $s in tokenize('a,aaa,aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', ',') satisfies not(matches($s, '^(?:(a{2})*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00026() { final XQuery query = new XQuery( "(every $s in tokenize('abbc', ',') satisfies matches($s, '^(?:ab{2}c)$')) and (every $s in tokenize('ac,abc,abbbc,a,', ',') satisfies not(matches($s, '^(?:ab{2}c)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00027() { final XQuery query = new XQuery( "(every $s in tokenize('abcc', ',') satisfies matches($s, '^(?:abc{2})$')) and (every $s in tokenize('abc,abccc,', ',') satisfies not(matches($s, '^(?:abc{2})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00028() { final XQuery query = new XQuery( "(every $s in tokenize('aaabbb,bb,bbb,bbbb', ',') satisfies matches($s, '^(?:a*b{2,4}c{0})$')) and (every $s in tokenize('ab,abbc,bbc,abbbbb,', ',') satisfies not(matches($s, '^(?:a*b{2,4}c{0})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00029() { final XQuery query = new XQuery( "(every $s in tokenize('ab,abac,abacac', ',') satisfies matches($s, '^(?:((ab)(ac){0,2})?)$')) and (every $s in tokenize('ac,abacacac,abaca,abab,abacabac', ',') satisfies not(matches($s, '^(?:((ab)(ac){0,2})?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00030() { final XQuery query = new XQuery( "(every $s in tokenize(',a b,a ba b', ',') satisfies matches($s, '^(?:(a\\sb){0,2})$')) and (every $s in tokenize('a ba ba b,ab,a b a b,a b', ',') satisfies not(matches($s, '^(?:(a\\sb){0,2})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00031() { final XQuery query = new XQuery( "(every $s in tokenize('abab,ababab,ababababababababababababababababababababababababababababababababab', ',') satisfies matches($s, '^(?:(ab){2,})$')) and (every $s in tokenize('ab,ababa,ababaa,ababababa,abab abab,', ',') satisfies not(matches($s, '^(?:(ab){2,})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00032() { final XQuery query = new XQuery( "matches('qwerty','a{,2}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00033() { final XQuery query = new XQuery( "matches('qwerty','(ab){2,0}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00034() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(ab){0,0})$')) and (every $s in tokenize('a,ab', ',') satisfies not(matches($s, '^(?:(ab){0,0})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00035() { final XQuery query = new XQuery( "(every $s in tokenize('abcc,abccc,abbcc,abbccc,bbcc,bbccc', ',') satisfies matches($s, '^(?:a{0,1}b{1,2}c{2,3})$')) and (every $s in tokenize('aabcc,bbbcc,acc,aabcc,abbc,abbcccc', ',') satisfies not(matches($s, '^(?:a{0,1}b{1,2}c{2,3})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00036() { final XQuery query = new XQuery( "(every $s in tokenize(',boy0xx,woman1y,girl1xymany,boy0xxwoman1ygirl1xymany,boy0xxwoman1ygirl1xymanyboy0xxwoman1ygirl1xymany', ',') satisfies matches($s, '^(?:(((((boy)|(girl))[0-1][x-z]{2})?)|(man|woman)[0-1]?[y|n])*)$')) and (every $s in tokenize('boy0xxwoman1ygirl1xyman,boyxx', ',') satisfies not(matches($s, '^(?:(((((boy)|(girl))[0-1][x-z]{2})?)|(man|woman)[0-1]?[y|n])*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00037() { final XQuery query = new XQuery( "matches('qwerty','((a)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00038() { final XQuery query = new XQuery( "matches('qwerty','(a))')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00039() { final XQuery query = new XQuery( "matches('qwerty','ab|(d))')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00040() { final XQuery query = new XQuery( "matches('qwerty','((a*(b*)((a))*(a))))')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00041() { final XQuery query = new XQuery( "matches('qwerty','\\')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00042() { final XQuery query = new XQuery( "matches('qwerty','?')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00043() { final XQuery query = new XQuery( "matches('qwerty','*')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00044() { final XQuery query = new XQuery( "matches('qwerty','+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00045() { final XQuery query = new XQuery( "matches('qwerty','(')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00046() { final XQuery query = new XQuery( "matches('qwerty',')')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00047() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:|)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:|)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00048() { final XQuery query = new XQuery( "matches('qwerty','[')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00049() { final XQuery query = new XQuery( "(every $s in tokenize('.\\?*+{}[]()|', ',') satisfies matches($s, '^(?:\\.\\\\\\?\\*\\+\\{\\}\\[\\]\\(\\)\\|)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\.\\\\\\?\\*\\+\\{\\}\\[\\]\\(\\)\\|)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00050() { final XQuery query = new XQuery( "(every $s in tokenize('.\\?*+{}[]()|.\\?*+{}[]()|.\\?*+{}[]()|', ',') satisfies matches($s, '^(?:(([\\.\\\\\\?\\*\\+\\{\\}\\[\\]\\(\\)\\|]?)*)+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(([\\.\\\\\\?\\*\\+\\{\\}\\[\\]\\(\\)\\|]?)*)+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00051() { final XQuery query = new XQuery( "(every $s in tokenize('1z', ',') satisfies matches($s, '^(?:[^2-9a-x]{2})$')) and (every $s in tokenize('1x', ',') satisfies not(matches($s, '^(?:[^2-9a-x]{2})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00052() { final XQuery query = new XQuery( "(every $s in tokenize('abc', ',') satisfies matches($s, '^(?:[^\\s]{3})$')) and (every $s in tokenize('a c', ',') satisfies not(matches($s, '^(?:[^\\s]{3})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00053() { final XQuery query = new XQuery( "(every $s in tokenize(',a,ab, a', ',') satisfies matches($s, '^(?:[^@]{0,2})$')) and (every $s in tokenize('@', ',') satisfies not(matches($s, '^(?:[^@]{0,2})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00054() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[^-z]+)$')) and (every $s in tokenize('aaz,a-z', ',') satisfies not(matches($s, '^(?:[^-z]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00055() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[a-d-[b-c]])$')) and (every $s in tokenize('b,c', ',') satisfies not(matches($s, '^(?:[a-d-[b-c]])$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00056() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[^a-d-b-c])$')) and (every $s in tokenize('a-b,c-c,ab,cc', ',') satisfies not(matches($s, '^(?:[^a-d-b-c])$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00057() { final XQuery query = new XQuery( "(every $s in tokenize('abcxyz}', ',') satisfies matches($s, '^(?:[a-\\}]+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:[a-\\}]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00058() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[a-b-[0-9]]+)$')) and (every $s in tokenize('a1', ',') satisfies not(matches($s, '^(?:[a-b-[0-9]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00059() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[a-c-[^a-c]])$')) and (every $s in tokenize('d', ',') satisfies not(matches($s, '^(?:[a-c-[^a-c]])$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00060() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[a-z-[^a]])$')) and (every $s in tokenize('b', ',') satisfies not(matches($s, '^(?:[a-z-[^a]])$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00061() { final XQuery query = new XQuery( "(every $s in tokenize('Ä€', ',') satisfies matches($s, '^(?:[^\\p{IsBasicLatin}]+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:[^\\p{IsBasicLatin}]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00062() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[^\\p{IsBasicLatin}]*)$')) and (every $s in tokenize('a', ',') satisfies not(matches($s, '^(?:[^\\p{IsBasicLatin}]*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00063() { final XQuery query = new XQuery( "(every $s in tokenize('a', ',') satisfies matches($s, '^(?:[^\\P{IsBasicLatin}])$')) and (every $s in tokenize('Ä€', ',') satisfies not(matches($s, '^(?:[^\\P{IsBasicLatin}])$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00064() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[^\\?])$')) and (every $s in tokenize('?', ',') satisfies not(matches($s, '^(?:[^\\?])$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00065() { final XQuery query = new XQuery( "(every $s in tokenize('a+*abc', ',') satisfies matches($s, '^(?:([^\\?])*)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:([^\\?])*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00066() { final XQuery query = new XQuery( "(every $s in tokenize('a*a', ',') satisfies matches($s, '^(?:\\c[^\\d]\\c)$')) and (every $s in tokenize('aa', ',') satisfies not(matches($s, '^(?:\\c[^\\d]\\c)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00067() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\c[^\\s]\\c)$')) and (every $s in tokenize('a c,a\rz,a\n" + "c,a\tr', ',') satisfies not(matches($s, '^(?:\\c[^\\s]\\c)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00068() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[^\\^a])$')) and (every $s in tokenize('^,a', ',') satisfies not(matches($s, '^(?:[^\\^a])$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00069() { final XQuery query = new XQuery( "(every $s in tokenize('abc', ',') satisfies matches($s, '^(?:[a-abc]{3})$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:[a-abc]{3})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00070() { final XQuery query = new XQuery( "(every $s in tokenize('}-', ',') satisfies matches($s, '^(?:[a-\\}-]+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:[a-\\}-]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00071() { final XQuery query = new XQuery( "matches('qwerty','[a--b]')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00072() { final XQuery query = new XQuery( "matches('qwerty','[^[a-b]]')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00073() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[a])$')) and (every $s in tokenize('b,', ',') satisfies not(matches($s, '^(?:[a])$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00074() { final XQuery query = new XQuery( "(every $s in tokenize('123', ',') satisfies matches($s, '^(?:[1-3]{1,4})$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:[1-3]{1,4})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00075() { final XQuery query = new XQuery( "(every $s in tokenize('a', ',') satisfies matches($s, '^(?:[a-a])$')) and (every $s in tokenize('b', ',') satisfies not(matches($s, '^(?:[a-a])$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00076() { final XQuery query = new XQuery( "(every $s in tokenize('1234567890:;<=>?@Azaz', ',') satisfies matches($s, '^(?:[0-z]*)$')) and (every $s in tokenize('{,/', ',') satisfies not(matches($s, '^(?:[0-z]*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00077() { final XQuery query = new XQuery( "(every $s in tokenize('\n" + "', ',') satisfies matches($s, '^(?:[\\n])$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:[\\n])$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00078() { final XQuery query = new XQuery( "(every $s in tokenize('\t', ',') satisfies matches($s, '^(?:[\\t])$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:[\\t])$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00079() { final XQuery query = new XQuery( "(every $s in tokenize('\\|.?*+(){}-[]^', ',') satisfies matches($s, '^(?:[\\\\\\|\\.\\?\\*\\+\\(\\)\\{\\}\\-\\[\\]\\^]*)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:[\\\\\\|\\.\\?\\*\\+\\(\\)\\{\\}\\-\\[\\]\\^]*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00080() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[^a-z^])$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:[^a-z^])$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00081() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\\\-\\{^])$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:[\\\\-\\{^])$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00082() { final XQuery query = new XQuery( "(every $s in tokenize('?a?,?b?,?c?', ',') satisfies matches($s, '^(?:[\\C\\?a-c\\?]+)$')) and (every $s in tokenize('?d?', ',') satisfies not(matches($s, '^(?:[\\C\\?a-c\\?]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00083() { final XQuery query = new XQuery( "(every $s in tokenize('?', ',') satisfies matches($s, '^(?:[\\c\\?a-c\\?]+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:[\\c\\?a-c\\?]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00084() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\D\\?a-c\\?]+)$')) and (every $s in tokenize('?1?', ',') satisfies not(matches($s, '^(?:[\\D\\?a-c\\?]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00085() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\S\\?a-c\\?]+)$')) and (every $s in tokenize('? ?,?\t?', ',') satisfies not(matches($s, '^(?:[\\S\\?a-c\\?]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00086() { final XQuery query = new XQuery( "(every $s in tokenize(',a-1x-7,c-4z-9,a-1z-8a-1z-9,a1z-9,a-1z8,a-1,z-9', ',') satisfies matches($s, '^(?:[a-c-1-4x-z-7-9]*)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:[a-c-1-4x-z-7-9]*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00087() { final XQuery query = new XQuery( "matches('qwerty','[a-\\\\]')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00088() { final XQuery query = new XQuery( "matches('qwerty','[a-\\[]')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00089() { final XQuery query = new XQuery( "(every $s in tokenize('a*a****aaaaa*', ',') satisfies matches($s, '^(?:[\\*a]*)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:[\\*a]*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00090() { final XQuery query = new XQuery( "matches('qwerty','[a-;]')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00091() { final XQuery query = new XQuery( "(every $s in tokenize('1]', ',') satisfies matches($s, '^(?:[1-\\]]+)$')) and (every $s in tokenize('0,^', ',') satisfies not(matches($s, '^(?:[1-\\]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00092() { final XQuery query = new XQuery( "(every $s in tokenize('=,>', ',') satisfies matches($s, '^(?:[=->])$')) and (every $s in tokenize('\\?', ',') satisfies not(matches($s, '^(?:[=->])$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00093() { final XQuery query = new XQuery( "matches('qwerty','[>-=]')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00094() { final XQuery query = new XQuery( "(every $s in tokenize('@', ',') satisfies matches($s, '^(?:[@])$')) and (every $s in tokenize('a', ',') satisfies not(matches($s, '^(?:[@])$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00095() { final XQuery query = new XQuery( "(every $s in tokenize('\u0fff', ',') satisfies matches($s, '^(?:[\u0fff])$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:[\u0fff])$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00096() { final XQuery query = new XQuery( "(every $s in tokenize('ð€€', ',') satisfies matches($s, '^(?:[ð€€])$')) and (every $s in tokenize('ð€', ',') satisfies not(matches($s, '^(?:[ð€€])$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00097() { final XQuery query = new XQuery( "matches('qwerty','[\\]')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00098() { final XQuery query = new XQuery( "(every $s in tokenize('\\,[,],\\[,\\[],[],[\\\\,\\]\\,[][', ',') satisfies matches($s, '^(?:[\\\\\\[\\]]{0,3})$')) and (every $s in tokenize('\\[][,\\]\\],[][]', ',') satisfies not(matches($s, '^(?:[\\\\\\[\\]]{0,3})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00099() { final XQuery query = new XQuery( "(every $s in tokenize('-', ',') satisfies matches($s, '^(?:[-])$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:[-])$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00100() { final XQuery query = new XQuery( "(every $s in tokenize('a--aa---', ',') satisfies matches($s, '^(?:[-a]+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:[-a]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00101() { final XQuery query = new XQuery( "(every $s in tokenize('a--aa---', ',') satisfies matches($s, '^(?:[a-]*)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:[a-]*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FORX0002") ) ); } /** * Test regex syntax. */ @org.junit.Test public void re00102() { final XQuery query = new XQuery( "(every $s in tokenize('a-x', ',') satisfies matches($s, '^(?:[a-a-x-x]+)$')) and (every $s in tokenize('j,a-b', ',') satisfies not(matches($s, '^(?:[a-a-x-x]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00103() { final XQuery query = new XQuery( "(every $s in tokenize('\\|.-^?*+[]{}()*[[]{}}))\n" + "\r\t\t\n" + "\n" + "\r*()', ',') satisfies matches($s, '^(?:[\\n\\r\\t\\\\\\|\\.\\-\\^\\?\\*\\+\\{\\}\\[\\]\\(\\)]*)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:[\\n\\r\\t\\\\\\|\\.\\-\\^\\?\\*\\+\\{\\}\\[\\]\\(\\)]*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00104() { final XQuery query = new XQuery( "(every $s in tokenize('a**,aa*,a', ',') satisfies matches($s, '^(?:[a\\*]*)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:[a\\*]*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00105() { final XQuery query = new XQuery( "(every $s in tokenize('a?,a?a?a?,a,a??,aa?', ',') satisfies matches($s, '^(?:[(a\\?)?]+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:[(a\\?)?]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00106() { final XQuery query = new XQuery( "(every $s in tokenize('\\t', ',') satisfies matches($s, '^(?:\\\\t)$')) and (every $s in tokenize('t,\\\\t,\t', ',') satisfies not(matches($s, '^(?:\\\\t)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00107() { final XQuery query = new XQuery( "(every $s in tokenize('\\n', ',') satisfies matches($s, '^(?:\\\\n)$')) and (every $s in tokenize('n,\\\\n,\n" + "', ',') satisfies not(matches($s, '^(?:\\\\n)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00108() { final XQuery query = new XQuery( "(every $s in tokenize('\\r', ',') satisfies matches($s, '^(?:\\\\r)$')) and (every $s in tokenize('r,\\\\r,\r', ',') satisfies not(matches($s, '^(?:\\\\r)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00109() { final XQuery query = new XQuery( "(every $s in tokenize('\n" + "', ',') satisfies matches($s, '^(?:\\n)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\n)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00110() { final XQuery query = new XQuery( "(every $s in tokenize('\t', ',') satisfies matches($s, '^(?:\\t)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\t)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00111() { final XQuery query = new XQuery( "(every $s in tokenize('\\', ',') satisfies matches($s, '^(?:\\\\)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\\\)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00112() { final XQuery query = new XQuery( "(every $s in tokenize('|', ',') satisfies matches($s, '^(?:\\|)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\|)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00113() { final XQuery query = new XQuery( "(every $s in tokenize('.', ',') satisfies matches($s, '^(?:\\.)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\.)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00114() { final XQuery query = new XQuery( "(every $s in tokenize('-', ',') satisfies matches($s, '^(?:\\-)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\-)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00115() { final XQuery query = new XQuery( "(every $s in tokenize('^', ',') satisfies matches($s, '^(?:\\^)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\^)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00116() { final XQuery query = new XQuery( "(every $s in tokenize('?', ',') satisfies matches($s, '^(?:\\?)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00117() { final XQuery query = new XQuery( "(every $s in tokenize('*', ',') satisfies matches($s, '^(?:\\*)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00118() { final XQuery query = new XQuery( "(every $s in tokenize('+', ',') satisfies matches($s, '^(?:\\+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00119() { final XQuery query = new XQuery( "(every $s in tokenize('{', ',') satisfies matches($s, '^(?:\\{)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\{)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00120() { final XQuery query = new XQuery( "(every $s in tokenize('}', ',') satisfies matches($s, '^(?:\\})$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00121() { final XQuery query = new XQuery( "(every $s in tokenize('(', ',') satisfies matches($s, '^(?:\\()$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\()$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00122() { final XQuery query = new XQuery( "(every $s in tokenize(')', ',') satisfies matches($s, '^(?:\\))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00123() { final XQuery query = new XQuery( "(every $s in tokenize('[', ',') satisfies matches($s, '^(?:\\[)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\[)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00124() { final XQuery query = new XQuery( "(every $s in tokenize(']', ',') satisfies matches($s, '^(?:\\])$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\])$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00125() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\n\\\\\\r\\|\\t\\.\\-\\^\\?\\*\\+\\{\\}\\(\\)\\[\\])$')) and (every $s in tokenize('\n" + "\\\r|\t.-^?*+{}()[,\\\r|\t.-^?*+{}()[],\n" + "\\\r|\t-^?*+{}()[]', ',') satisfies not(matches($s, '^(?:\\n\\\\\\r\\|\\t\\.\\-\\^\\?\\*\\+\\{\\}\\(\\)\\[\\])$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00126() { final XQuery query = new XQuery( "not(matches('', '^(?:\\n\\na\\n\\nb\\n\\n)$')) and\n" + " (every $s in tokenize('\n" + "\n" + "a\n" + "\n" + "b;\n" + ",\n" + "a\n" + "\n" + "b;\n" + "\n" + ",\n" + "\n" + "a\n" + "\n" + "b;\n" + "\r', ',') \n" + " satisfies not(matches($s, '^(?:\\n\\na\\n\\nb\\n\\n)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00127a() { final XQuery query = new XQuery( "\n" + " matches(' a b ', '^\\r\\ra\\r\\rb\\r\\r$'),\n" + " matches(' a b ', '^\\r\\ra\\r\\rb\\r\\r$'),\n" + " matches(' a b ', '^(?:\\r\\ra\\r\\rb\\r\\r)$'),\n" + " matches(' a b ', '^(?:\\r\\ra\\r\\rb\\r\\r)$'),\n" + " matches(' a ', '^(?:\\r\\ra\\r\\rb\\r\\r)$'),\n" + " matches(' a b ', '^(?:\\r\\ra\\r\\rb\\r\\r)$')\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("true(), true(), false(), false(), false(), false()") ); } /** * Test regex syntax. */ @org.junit.Test public void re00128() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\t\\ta\\t\\tb\\t\\t)$')) and (every $s in tokenize('\t\ta\t\tb\t,\ta\t\tb\t\t,\t\ta\t\t\t\t,\t\ta\t\t\tb\t\t', ',') satisfies not(matches($s, '^(?:\\t\\ta\\t\\tb\\t\\t)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00129a() { final XQuery query = new XQuery( "matches('a b', '^(?:a\\r\\nb)$'), matches('ab', '^(?:a\\r\\nb)$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("true(), false()") ); } /** * Test regex syntax. */ @org.junit.Test public void re00130a() { final XQuery query = new XQuery( "(every $s in tokenize(' a b', ',') satisfies (matches($s, '^(?:\\n\\ra\\n\\rb)$'))) and\n" + " (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\n\\ra\\n\\rb)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00131() { final XQuery query = new XQuery( "(every $s in tokenize('\ta\tb\tc\t', ',') satisfies matches($s, '^(?:\\ta\\tb\\tc\\t)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\ta\\tb\\tc\\t)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00132() { final XQuery query = new XQuery( "(every $s in tokenize('\n" + "a\n" + "b\n" + "c\n" + "', ',') satisfies matches($s, '^(?:\\na\\nb\\nc\\n)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\na\\nb\\nc\\n)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00133() { final XQuery query = new XQuery( "(every $s in tokenize('\ta \n" + "\r\n" + " \r\tb, a b, a b ,\ta \n" + "\r\n" + " \rb', ',') satisfies matches($s, '^(?:(\\t|\\s)a(\\r\\n|\\r|\\n|\\s)+(\\s|\\t)b(\\s|\\r\\n|\\r|\\n)*)$')) and (every $s in tokenize(' a b, a b ', ',') satisfies not(matches($s, '^(?:(\\t|\\s)a(\\r\\n|\\r|\\n|\\s)+(\\s|\\t)b(\\s|\\r\\n|\\r|\\n)*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00134() { final XQuery query = new XQuery( "(every $s in tokenize('\\c', ',') satisfies matches($s, '^(?:\\\\c)$')) and (every $s in tokenize('\\p{_xmlC},\\\\c,\\\\', ',') satisfies not(matches($s, '^(?:\\\\c)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00135() { final XQuery query = new XQuery( "(every $s in tokenize('\\.,\\s,\\S,\\i,\\I,\\c,\\C,\\d,\\D,\\w,\\W', ';') satisfies matches($s, '^(?:\\\\.,\\\\s,\\\\S,\\\\i,\\\\I,\\\\c,\\\\C,\\\\d,\\\\D,\\\\w,\\\\W)$')) and (every $s in tokenize('', ';') satisfies not(matches($s, '^(?:\\\\.,\\\\s,\\\\S,\\\\i,\\\\I,\\\\c,\\\\C,\\\\d,\\\\D,\\\\w,\\\\W)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00136() { final XQuery query = new XQuery( "(every $s in tokenize('\\.abcd,\\sssss,\\SSSSSS,\\iiiiiii,\\,\\c,\\CCCCCC,\\ddd,\\D,\\wwwwwww,\\WWW', ';') satisfies matches($s, '^(?:\\\\.*,\\\\s*,\\\\S*,\\\\i*,\\\\I?,\\\\c+,\\\\C+,\\\\d{0,3},\\\\D{1,1000},\\\\w*,\\\\W+)$')) and (every $s in tokenize('', ';') satisfies not(matches($s, '^(?:\\\\.*,\\\\s*,\\\\S*,\\\\i*,\\\\I?,\\\\c+,\\\\C+,\\\\d{0,3},\\\\D{1,1000},\\\\w*,\\\\W+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00137() { final XQuery query = new XQuery( "(every $s in tokenize('aX', ',') satisfies matches($s, '^(?:[\\p{L}*]{0,2})$')) and (every $s in tokenize('aBC', ',') satisfies not(matches($s, '^(?:[\\p{L}*]{0,2})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00138() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(\\p{Ll}\\p{Cc}\\p{Nd})*)$')) and (every $s in tokenize('\u1680', ',') satisfies not(matches($s, '^(?:(\\p{Ll}\\p{Cc}\\p{Nd})*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00139() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{L}*)$')) and (every $s in tokenize('âƒ', ',') satisfies not(matches($s, '^(?:\\p{L}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00140() { final XQuery query = new XQuery( "(every $s in tokenize('Aðž¨', ',') satisfies matches($s, '^(?:\\p{Lu}*)$')) and (every $s in tokenize('a', ',') satisfies not(matches($s, '^(?:\\p{Lu}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00141() { final XQuery query = new XQuery( "(every $s in tokenize('aðŸ‰', ',') satisfies matches($s, '^(?:\\p{Ll}*)$')) and (every $s in tokenize('Ç…', ',') satisfies not(matches($s, '^(?:\\p{Ll}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00142() { final XQuery query = new XQuery( "(every $s in tokenize('Džῼ', ',') satisfies matches($s, '^(?:\\p{Lt}*)$')) and (every $s in tokenize('ʰ', ',') satisfies not(matches($s, '^(?:\\p{Lt}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00143() { final XQuery query = new XQuery( "(every $s in tokenize('ʰ゚', ',') satisfies matches($s, '^(?:\\p{Lm}*)$')) and (every $s in tokenize('×', ',') satisfies not(matches($s, '^(?:\\p{Lm}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00144() { final XQuery query = new XQuery( "(every $s in tokenize('×ð¯¨', ',') satisfies matches($s, '^(?:\\p{Lo}*)$')) and (every $s in tokenize('Ù‹', ',') satisfies not(matches($s, '^(?:\\p{Lo}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00145() { final XQuery query = new XQuery( "(every $s in tokenize('Ù‹ð†­à¤ƒð…²à¤ƒð…²âƒâƒâƒ ', ',') satisfies matches($s, '^(?:\\p{M}*)$')) and (every $s in tokenize('Ç…', ',') satisfies not(matches($s, '^(?:\\p{M}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00146() { final XQuery query = new XQuery( "(every $s in tokenize('Ù‹ð†­', ',') satisfies matches($s, '^(?:\\p{Mn}*)$')) and (every $s in tokenize('ः', ',') satisfies not(matches($s, '^(?:\\p{Mn}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00147() { final XQuery query = new XQuery( "(every $s in tokenize('ःð…²', ',') satisfies matches($s, '^(?:\\p{Mc}*)$')) and (every $s in tokenize('âƒ', ',') satisfies not(matches($s, '^(?:\\p{Mc}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00148() { final XQuery query = new XQuery( "(every $s in tokenize('âƒâƒ ', ',') satisfies matches($s, '^(?:\\p{Me}*)$')) and (every $s in tokenize('ï¼', ',') satisfies not(matches($s, '^(?:\\p{Me}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00149() { final XQuery query = new XQuery( "(every $s in tokenize('ï¼ðŸ¿ðŠðŠã€¥Â²Â²ðŒ£', ',') satisfies matches($s, '^(?:\\p{N}*)$')) and (every $s in tokenize('ः', ',') satisfies not(matches($s, '^(?:\\p{N}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00150() { final XQuery query = new XQuery( "(every $s in tokenize('ï¼ðŸ¿', ',') satisfies matches($s, '^(?:\\p{Nd}*)$')) and (every $s in tokenize('ðŠ', ',') satisfies not(matches($s, '^(?:\\p{Nd}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00151() { final XQuery query = new XQuery( "(every $s in tokenize('ðŠã€¥', ',') satisfies matches($s, '^(?:\\p{Nl}*)$')) and (every $s in tokenize('²', ',') satisfies not(matches($s, '^(?:\\p{Nl}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00152() { final XQuery query = new XQuery( "(every $s in tokenize('²ðŒ£', ',') satisfies matches($s, '^(?:\\p{No}*)$')) and (every $s in tokenize('\u203f', ',') satisfies not(matches($s, '^(?:\\p{No}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00153() { final XQuery query = new XQuery( "(every $s in tokenize('\u203f\uff65\u301c\u301c\uff0d\u301d\u301d\uff62\u301e\u301e\uff63««\u2039»»\u203a¿¿\uff64', ',') satisfies matches($s, '^(?:\\p{P}*)$')) and (every $s in tokenize('²', ',') satisfies not(matches($s, '^(?:\\p{P}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00154() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{Pc}*)$')) and (every $s in tokenize('\u301c', ',') satisfies not(matches($s, '^(?:\\p{Pc}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00155() { final XQuery query = new XQuery( "(every $s in tokenize('\u301c\uff0d', ',') satisfies matches($s, '^(?:\\p{Pd}*)$')) and (every $s in tokenize('\u301d', ',') satisfies not(matches($s, '^(?:\\p{Pd}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00156() { final XQuery query = new XQuery( "(every $s in tokenize('\u301d\uff62', ',') satisfies matches($s, '^(?:\\p{Ps}*)$')) and (every $s in tokenize('\u301e', ',') satisfies not(matches($s, '^(?:\\p{Ps}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00157() { final XQuery query = new XQuery( "(every $s in tokenize('\u301e\uff63', ',') satisfies matches($s, '^(?:\\p{Pe}*)$')) and (every $s in tokenize('«', ',') satisfies not(matches($s, '^(?:\\p{Pe}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00158() { final XQuery query = new XQuery( "(every $s in tokenize('«\u2039', ',') satisfies matches($s, '^(?:\\p{Pi}*)$')) and (every $s in tokenize('»', ',') satisfies not(matches($s, '^(?:\\p{Pi}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00159() { final XQuery query = new XQuery( "(every $s in tokenize('»\u203a', ',') satisfies matches($s, '^(?:\\p{Pf}*)$')) and (every $s in tokenize('¿', ',') satisfies not(matches($s, '^(?:\\p{Pf}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00160() { final XQuery query = new XQuery( "(every $s in tokenize('¿\uff64', ',') satisfies matches($s, '^(?:\\p{Po}*)$')) and (every $s in tokenize('\u1680', ',') satisfies not(matches($s, '^(?:\\p{Po}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00161() { final XQuery query = new XQuery( "(every $s in tokenize('\u1680\u3000\u2028\u2028\u2029\u2029', ',') satisfies matches($s, '^(?:\\p{Z}*)$')) and (every $s in tokenize('¿', ',') satisfies not(matches($s, '^(?:\\p{Z}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00162() { final XQuery query = new XQuery( "(every $s in tokenize('\u1680\u3000', ',') satisfies matches($s, '^(?:\\p{Zs}*)$')) and (every $s in tokenize('\u2028', ',') satisfies not(matches($s, '^(?:\\p{Zs}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00163() { final XQuery query = new XQuery( "(every $s in tokenize('\u2028', ',') satisfies matches($s, '^(?:\\p{Zl}*)$')) and (every $s in tokenize('\u2029', ',') satisfies not(matches($s, '^(?:\\p{Zl}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00164() { final XQuery query = new XQuery( "(every $s in tokenize('\u2029', ',') satisfies matches($s, '^(?:\\p{Zp}*)$')) and (every $s in tokenize('â„', ',') satisfies not(matches($s, '^(?:\\p{Zp}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00165() { final XQuery query = new XQuery( "(every $s in tokenize('ℬ₠₠₩゛゛ ̄ã†ã†ð‡', ',') satisfies matches($s, '^(?:\\p{S}*)$')) and (every $s in tokenize('\u1680', ',') satisfies not(matches($s, '^(?:\\p{S}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00166() { final XQuery query = new XQuery( "(every $s in tokenize('â„ï¿¢', ',') satisfies matches($s, '^(?:\\p{Sm}*)$')) and (every $s in tokenize('â‚ ', ',') satisfies not(matches($s, '^(?:\\p{Sm}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00167() { final XQuery query = new XQuery( "(every $s in tokenize('₠₩', ',') satisfies matches($s, '^(?:\\p{Sc}*)$')) and (every $s in tokenize('ã‚›', ',') satisfies not(matches($s, '^(?:\\p{Sc}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00168() { final XQuery query = new XQuery( "(every $s in tokenize('゛ ̄', ',') satisfies matches($s, '^(?:\\p{Sk}*)$')) and (every $s in tokenize('ã†', ',') satisfies not(matches($s, '^(?:\\p{Sk}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00169() { final XQuery query = new XQuery( "(every $s in tokenize('ã†ð‡', ',') satisfies matches($s, '^(?:\\p{So}*)$')) and (every $s in tokenize('\t', ',') satisfies not(matches($s, '^(?:\\p{So}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00170() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{C}*)$')) and (every $s in tokenize('â‚ ', ',') satisfies not(matches($s, '^(?:\\p{C}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00171() { final XQuery query = new XQuery( "(every $s in tokenize('\t', ',') satisfies matches($s, '^(?:\\p{Cc}*)$')) and (every $s in tokenize('\u070f', ',') satisfies not(matches($s, '^(?:\\p{Cc}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00172() { final XQuery query = new XQuery( "(every $s in tokenize('\u070f\udb40\udc78', ',') satisfies matches($s, '^(?:\\p{Cf}*)$')) and (every $s in tokenize('\ue000', ',') satisfies not(matches($s, '^(?:\\p{Cf}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00173() { final XQuery query = new XQuery( "(every $s in tokenize('\ue000\udbc0\udc00\udb80\udc00\udbbf\udffd\udbff\udffd', ',') satisfies matches($s, '^(?:(\\p{Co})*)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(\\p{Co})*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00174() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{Co}*)$')) and (every $s in tokenize('â„', ',') satisfies not(matches($s, '^(?:\\p{Co}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00175() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{Cn}*)$')) and (every $s in tokenize('\t', ',') satisfies not(matches($s, '^(?:\\p{Cn}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00176() { final XQuery query = new XQuery( "(every $s in tokenize('_,âƒ', ',') satisfies matches($s, '^(?:\\P{L}*)$')) and (every $s in tokenize('aAbB,Aðž¨aaðŸ‰Ç…Džῼʰʰ゚××ð¯¨', ',') satisfies not(matches($s, '^(?:\\P{L}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00177() { final XQuery query = new XQuery( "(every $s in tokenize(',#$', ',') satisfies matches($s, '^(?:[\\P{L}*]{0,2})$')) and (every $s in tokenize('!$#,A', ',') satisfies not(matches($s, '^(?:[\\P{L}*]{0,2})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00178() { final XQuery query = new XQuery( "(every $s in tokenize('a', ',') satisfies matches($s, '^(?:\\P{Lu}*)$')) and (every $s in tokenize('Aðž¨', ',') satisfies not(matches($s, '^(?:\\P{Lu}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00179() { final XQuery query = new XQuery( "(every $s in tokenize('Ç…', ',') satisfies matches($s, '^(?:\\P{Ll}*)$')) and (every $s in tokenize('aðŸ‰', ',') satisfies not(matches($s, '^(?:\\P{Ll}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00180() { final XQuery query = new XQuery( "(every $s in tokenize('ʰ', ',') satisfies matches($s, '^(?:\\P{Lt}*)$')) and (every $s in tokenize('Džῼ', ',') satisfies not(matches($s, '^(?:\\P{Lt}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00181() { final XQuery query = new XQuery( "(every $s in tokenize('×', ',') satisfies matches($s, '^(?:\\P{Lm}*)$')) and (every $s in tokenize('ʰ゚', ',') satisfies not(matches($s, '^(?:\\P{Lm}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00182() { final XQuery query = new XQuery( "(every $s in tokenize('Ù‹', ',') satisfies matches($s, '^(?:\\P{Lo}*)$')) and (every $s in tokenize('×ð¯¨', ',') satisfies not(matches($s, '^(?:\\P{Lo}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00183() { final XQuery query = new XQuery( "(every $s in tokenize('Ç…', ',') satisfies matches($s, '^(?:\\P{M}*)$')) and (every $s in tokenize('Ù‹ð†­à¤ƒð…²à¤ƒð…²âƒâƒâƒ ', ',') satisfies not(matches($s, '^(?:\\P{M}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00184() { final XQuery query = new XQuery( "(every $s in tokenize('ःð…²', ',') satisfies matches($s, '^(?:\\P{Mn}*)$')) and (every $s in tokenize('Ù‹ð†­', ',') satisfies not(matches($s, '^(?:\\P{Mn}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00185() { final XQuery query = new XQuery( "(every $s in tokenize('âƒ', ',') satisfies matches($s, '^(?:\\P{Mc}*)$')) and (every $s in tokenize('ःð…²', ',') satisfies not(matches($s, '^(?:\\P{Mc}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00186() { final XQuery query = new XQuery( "(every $s in tokenize('ï¼', ',') satisfies matches($s, '^(?:\\P{Me}*)$')) and (every $s in tokenize('âƒâƒ ', ',') satisfies not(matches($s, '^(?:\\P{Me}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00187() { final XQuery query = new XQuery( "(every $s in tokenize('ः', ',') satisfies matches($s, '^(?:\\P{N}*)$')) and (every $s in tokenize('ï¼ðŸ¿ðŠðŠã€¥Â²Â²ðŒ£', ',') satisfies not(matches($s, '^(?:\\P{N}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00188() { final XQuery query = new XQuery( "(every $s in tokenize('ðŠ', ',') satisfies matches($s, '^(?:\\P{Nd}*)$')) and (every $s in tokenize('ï¼ðŸ¿', ',') satisfies not(matches($s, '^(?:\\P{Nd}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00189() { final XQuery query = new XQuery( "(every $s in tokenize('²', ',') satisfies matches($s, '^(?:\\P{Nl}*)$')) and (every $s in tokenize('ðŠã€¥', ',') satisfies not(matches($s, '^(?:\\P{Nl}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00190() { final XQuery query = new XQuery( "(every $s in tokenize('\u203f', ',') satisfies matches($s, '^(?:\\P{No}*)$')) and (every $s in tokenize('²ðŒ£', ',') satisfies not(matches($s, '^(?:\\P{No}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00191() { final XQuery query = new XQuery( "(every $s in tokenize('²', ',') satisfies matches($s, '^(?:\\P{P}*)$')) and (every $s in tokenize('\u203f\uff65\u301c\u301c\uff0d\u301d\u301d\uff62\u301e\u301e\uff63««\u2039»»\u203a¿¿\uff64', ',') satisfies not(matches($s, '^(?:\\P{P}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00192() { final XQuery query = new XQuery( "(every $s in tokenize('\u301c', ',') satisfies matches($s, '^(?:\\P{Pc}*)$')) and (every $s in tokenize('\u203f\uff65', ',') satisfies not(matches($s, '^(?:\\P{Pc}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00193() { final XQuery query = new XQuery( "(every $s in tokenize('\u301d', ',') satisfies matches($s, '^(?:\\P{Pd}*)$')) and (every $s in tokenize('\u301c\uff0d', ',') satisfies not(matches($s, '^(?:\\P{Pd}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00194() { final XQuery query = new XQuery( "(every $s in tokenize('\u301e', ',') satisfies matches($s, '^(?:\\P{Ps}*)$')) and (every $s in tokenize('\u301d\uff62', ',') satisfies not(matches($s, '^(?:\\P{Ps}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00195() { final XQuery query = new XQuery( "(every $s in tokenize('«', ',') satisfies matches($s, '^(?:\\P{Pe}*)$')) and (every $s in tokenize('\u301e\uff63', ',') satisfies not(matches($s, '^(?:\\P{Pe}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00196() { final XQuery query = new XQuery( "(every $s in tokenize('»', ',') satisfies matches($s, '^(?:\\P{Pi}*)$')) and (every $s in tokenize('«\u2039', ',') satisfies not(matches($s, '^(?:\\P{Pi}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00197() { final XQuery query = new XQuery( "(every $s in tokenize('¿', ',') satisfies matches($s, '^(?:\\P{Pf}*)$')) and (every $s in tokenize('»\u203a', ',') satisfies not(matches($s, '^(?:\\P{Pf}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00198() { final XQuery query = new XQuery( "(every $s in tokenize('\u1680', ',') satisfies matches($s, '^(?:\\P{Po}*)$')) and (every $s in tokenize('¿\uff64', ',') satisfies not(matches($s, '^(?:\\P{Po}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00199() { final XQuery query = new XQuery( "(every $s in tokenize('¿', ',') satisfies matches($s, '^(?:\\P{Z}*)$')) and (every $s in tokenize('\u1680\u3000\u2028\u2028\u2029\u2029', ',') satisfies not(matches($s, '^(?:\\P{Z}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00200() { final XQuery query = new XQuery( "(every $s in tokenize('\u2028', ',') satisfies matches($s, '^(?:\\P{Zs}*)$')) and (every $s in tokenize('\u1680\u3000', ',') satisfies not(matches($s, '^(?:\\P{Zs}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00201() { final XQuery query = new XQuery( "(every $s in tokenize('\u2029', ',') satisfies matches($s, '^(?:\\P{Zl}*)$')) and (every $s in tokenize('\u2028', ',') satisfies not(matches($s, '^(?:\\P{Zl}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00202() { final XQuery query = new XQuery( "(every $s in tokenize('â„', ',') satisfies matches($s, '^(?:\\P{Zp}*)$')) and (every $s in tokenize('\u2029', ',') satisfies not(matches($s, '^(?:\\P{Zp}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00203() { final XQuery query = new XQuery( "(every $s in tokenize('\u1680', ',') satisfies matches($s, '^(?:\\P{S}*)$')) and (every $s in tokenize('ℬ₠₠₩゛゛ ̄ã†ã†ð‡', ',') satisfies not(matches($s, '^(?:\\P{S}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00204() { final XQuery query = new XQuery( "(every $s in tokenize('â‚ ', ',') satisfies matches($s, '^(?:\\P{Sm}*)$')) and (every $s in tokenize('â„ï¿¢', ',') satisfies not(matches($s, '^(?:\\P{Sm}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00205() { final XQuery query = new XQuery( "(every $s in tokenize('ã‚›', ',') satisfies matches($s, '^(?:\\P{Sc}*)$')) and (every $s in tokenize('₠₩', ',') satisfies not(matches($s, '^(?:\\P{Sc}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00206() { final XQuery query = new XQuery( "(every $s in tokenize('ã†', ',') satisfies matches($s, '^(?:\\P{Sk}*)$')) and (every $s in tokenize('゛ ̄', ',') satisfies not(matches($s, '^(?:\\P{Sk}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00207() { final XQuery query = new XQuery( "(every $s in tokenize('\t', ',') satisfies matches($s, '^(?:\\P{So}*)$')) and (every $s in tokenize('ã†ð‡', ',') satisfies not(matches($s, '^(?:\\P{So}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00208() { final XQuery query = new XQuery( "(every $s in tokenize('â‚ ', ',') satisfies matches($s, '^(?:\\P{C}*)$')) and (every $s in tokenize('\t\u070f\u070f\udb40\udc78\ue000\ue000\udbc0\udc00\udb80\udc00\udbbf\udffd\udbff\udffd', ',') satisfies not(matches($s, '^(?:\\P{C}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00209() { final XQuery query = new XQuery( "(every $s in tokenize('\u070f', ',') satisfies matches($s, '^(?:\\P{Cc}*)$')) and (every $s in tokenize('\t', ',') satisfies not(matches($s, '^(?:\\P{Cc}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00210() { final XQuery query = new XQuery( "(every $s in tokenize('\ue000', ',') satisfies matches($s, '^(?:\\P{Cf}*)$')) and (every $s in tokenize('\u070f\udb40\udc78', ',') satisfies not(matches($s, '^(?:\\P{Cf}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00211() { final XQuery query = new XQuery( "(every $s in tokenize('â„', ',') satisfies matches($s, '^(?:\\P{Co}*)$')) and (every $s in tokenize('\ue000\udbc0\udc00\udb80\udc00\udbbf\udffd\udbff\udffd', ',') satisfies not(matches($s, '^(?:\\P{Co}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00212() { final XQuery query = new XQuery( "matches('qwerty','\\p{\\\\L}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00213() { final XQuery query = new XQuery( "(every $s in tokenize('\\a', ',') satisfies matches($s, '^(?:\\\\\\p{L}*)$')) and (every $s in tokenize('a', ',') satisfies not(matches($s, '^(?:\\\\\\p{L}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00214() { final XQuery query = new XQuery( "matches('qwerty','\\p{Is}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00215() { final XQuery query = new XQuery( "matches('qwerty','\\P{Is}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00216() { final XQuery query = new XQuery( "matches('qwerty','\\p{IsaA0-a9}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FORX0002") || assertBoolean(true) ) ); } /** * Test regex syntax. */ @org.junit.Test public void re00217() { final XQuery query = new XQuery( "(every $s in tokenize('\t\n" + "\r \u007f\ue001\t\n" + "\r !\"#$%''''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u007f', '\ue001') satisfies matches($s, '^(?:\\p{IsBasicLatin}+)$')) and (every $s in tokenize('', '\ue001') satisfies not(matches($s, '^(?:\\p{IsBasicLatin}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00218() { final XQuery query = new XQuery( "(every $s in tokenize('\u0080ÿ,\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008a\u008b\u008c\u008d\u008e\u008f\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009a\u009b\u009c\u009d\u009e\u009f ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÃÂÃÄÅÆÇÈÉÊËÌÃÃŽÃÃÑÒÓÔÕÖרÙÚÛÜÃÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ', ',') satisfies matches($s, '^(?:\\p{IsLatin-1Supplement}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsLatin-1Supplement}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00219() { final XQuery query = new XQuery( "(every $s in tokenize('Āſ,Ä€ÄĂ㥹ĆćĈĉĊċČÄÄŽÄÄđĒēĔĕĖėĘęĚěĜÄĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀÅłŃńŅņŇňʼnŊŋŌÅÅŽÅÅőŒœŔŕŖŗŘřŚśŜÅŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſ', ',') satisfies matches($s, '^(?:\\p{IsLatinExtended-A}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsLatinExtended-A}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00220() { final XQuery query = new XQuery( "(every $s in tokenize('Æ€É,Æ€ÆÆ‚ÆƒÆ„Æ…Æ†Æ‡ÆˆÆ‰ÆŠÆ‹ÆŒÆÆŽÆÆÆ‘Æ’Æ“Æ”Æ•Æ–Æ—Æ˜Æ™ÆšÆ›ÆœÆÆžÆŸÆ Æ¡Æ¢Æ£Æ¤Æ¥Æ¦Æ§Æ¨Æ©ÆªÆ«Æ¬Æ­Æ®Æ¯Æ°Æ±Æ²Æ³Æ´ÆµÆ¶Æ·Æ¸Æ¹ÆºÆ»Æ¼Æ½Æ¾Æ¿Ç€ÇǂǃDŽDždžLJLjljNJNjnjÇÇŽÇÇǑǒǓǔǕǖǗǘǙǚǛǜÇǞǟǠǡǢǣǤǥǦǧǨǩǪǫǬǭǮǯǰDZDzdzǴǵǶǷǸǹǺǻǼǽǾǿȀÈȂȃȄȅȆȇȈȉȊȋȌÈÈŽÈÈȑȒȓȔȕȖȗȘșȚțȜÈȞȟȠȡȢȣȤȥȦȧȨȩȪȫȬȭȮȯȰȱȲȳȴȵȶȷȸȹȺȻȼȽȾȿɀÉɂɃɄɅɆɇɈɉɊɋɌÉÉŽÉ', ',') satisfies matches($s, '^(?:\\p{IsLatinExtended-B}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsLatinExtended-B}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00221() { final XQuery query = new XQuery( "(every $s in tokenize('Éʯ,ÉɑɒɓɔɕɖɗɘəɚɛɜÉɞɟɠɡɢɣɤɥɦɧɨɩɪɫɬɭɮɯɰɱɲɳɴɵɶɷɸɹɺɻɼɽɾɿʀÊʂʃʄʅʆʇʈʉʊʋʌÊÊŽÊÊʑʒʓʔʕʖʗʘʙʚʛʜÊʞʟʠʡʢʣʤʥʦʧʨʩʪʫʬʭʮʯ', ',') satisfies matches($s, '^(?:\\p{IsIPAExtensions}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsIPAExtensions}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00222() { final XQuery query = new XQuery( "(every $s in tokenize('ʰ˿,ʰʱʲʳʴʵʶʷʸʹʺʻʼʽʾʿˀË˂˃˄˅ˆˇˈˉˊˋˌËËŽËËˑ˒˓˔˕˖˗˘˙˚˛˜Ë˞˟ˠˡˢˣˤ˥˦˧˨˩˪˫ˬ˭ˮ˯˰˱˲˳˴˵˶˷˸˹˺˻˼˽˾˿', ',') satisfies matches($s, '^(?:\\p{IsSpacingModifierLetters}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsSpacingModifierLetters}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00223() { final XQuery query = new XQuery( "(every $s in tokenize('\u0530\u058f,\u0530Ô±Ô²Ô³Ô´ÔµÔ¶Ô·Ô¸Ô¹ÔºÔ»Ô¼Ô½Ô¾Ô¿Õ€ÕÕ‚ÕƒÕ„Õ…Õ†Õ‡ÕˆÕ‰ÕŠÕ‹ÕŒÕÕŽÕÕÕ‘Õ’Õ“Õ”Õ•Õ–\u0557\u0558Õ™\u055a\u055b\u055c\u055d\u055e\u055f\u0560Õ¡Õ¢Õ£Õ¤Õ¥Õ¦Õ§Õ¨Õ©ÕªÕ«Õ¬Õ­Õ®Õ¯Õ°Õ±Õ²Õ³Õ´ÕµÕ¶Õ·Õ¸Õ¹ÕºÕ»Õ¼Õ½Õ¾Õ¿Ö€ÖÖ‚ÖƒÖ„Ö…Ö†Ö‡\u0588\u0589\u058a\u058b\u058c\u058d\u058e\u058f', ',') satisfies matches($s, '^(?:\\p{IsArmenian}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsArmenian}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00224() { final XQuery query = new XQuery( "(every $s in tokenize('\u0590\u05ff,\u0590Ö‘Ö’Ö“Ö”Ö•Ö–Ö—Ö˜Ö™ÖšÖ›ÖœÖÖžÖŸÖ Ö¡Ö¢Ö£Ö¤Ö¥Ö¦Ö§Ö¨Ö©ÖªÖ«Ö¬Ö­Ö®Ö¯Ö°Ö±Ö²Ö³Ö´ÖµÖ¶Ö·Ö¸Ö¹ÖºÖ»Ö¼Ö½\u05beÖ¿\u05c0×ׂ\u05c3ׅׄ\u05c6ׇ\u05c8\u05c9\u05ca\u05cb\u05cc\u05cd\u05ce\u05cf×בגדהוזחטיךכל×מןנסעףפץצקרשת\u05eb\u05ec\u05ed\u05ee\u05efװױײ\u05f3\u05f4\u05f5\u05f6\u05f7\u05f8\u05f9\u05fa\u05fb\u05fc\u05fd\u05fe\u05ff', ',') satisfies matches($s, '^(?:\\p{IsHebrew}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsHebrew}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00225() { final XQuery query = new XQuery( "(every $s in tokenize('\u0600Û¿,\u0600\u0601\u0602\u0603\u0604\u0605؆؇؈\u0609\u060aØ‹\u060c\u060dØŽØØØ‘Ø’Ø“Ø”Ø•Ø–Ø—Ø˜Ø™Øš\u061b\u061c\u061d\u061e\u061fؠءآأؤإئابةتثجحخدذرزسشصضطظعغػؼؽؾؿـÙقكلمنهوىيًٌÙÙŽÙÙّْٕٖٜٓٔٗ٘ٙٚٛÙٟٞ٠١٢٣٤٥٦٧٨٩\u066a\u066b\u066c\u066dٮٯٰٱٲٳٴٵٶٷٸٹٺٻټٽپٿڀÚÚ‚ÚƒÚ„Ú…Ú†Ú‡ÚˆÚ‰ÚŠÚ‹ÚŒÚÚŽÚÚÚ‘Ú’Ú“Ú”Ú•Ú–Ú—Ú˜Ú™ÚšÚ›ÚœÚÚžÚŸÚ Ú¡Ú¢Ú£Ú¤Ú¥Ú¦Ú§Ú¨Ú©ÚªÚ«Ú¬Ú­Ú®Ú¯Ú°Ú±Ú²Ú³Ú´ÚµÚ¶Ú·Ú¸Ú¹ÚºÚ»Ú¼Ú½Ú¾Ú¿Û€ÛÛ‚ÛƒÛ„Û…Û†Û‡ÛˆÛ‰ÛŠÛ‹ÛŒÛÛŽÛÛÛ‘Û’Û“\u06d4Û•Û–Û—Û˜Û™ÛšÛ›Ûœ\u06ddÛžÛŸÛ Û¡Û¢Û£Û¤Û¥Û¦Û§Û¨Û©ÛªÛ«Û¬Û­Û®Û¯Û°Û±Û²Û³Û´ÛµÛ¶Û·Û¸Û¹ÛºÛ»Û¼Û½Û¾Û¿', ',') satisfies matches($s, '^(?:\\p{IsArabic}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsArabic}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00226() { final XQuery query = new XQuery( "(every $s in tokenize('\u0700Ý,\u0700\u0701\u0702\u0703\u0704\u0705\u0706\u0707\u0708\u0709\u070a\u070b\u070c\u070d\u070e\u070fÜܑܒܓܔܕܖܗܘܙܚܛܜÜܞܟܠܡܢܣܤܥܦܧܨܩܪܫܬܭܮܯܱܴܷܸܹܻܼܾܰܲܳܵܶܺܽܿ݀Ý݂݄݆݈݃݅݇݉݊\u074b\u074cÝÝŽÝ', ',') satisfies matches($s, '^(?:\\p{IsSyriac}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsSyriac}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00227() { final XQuery query = new XQuery( "(every $s in tokenize('Þ€\u07bf,Þ€ÞÞ‚ÞƒÞ„Þ…Þ†Þ‡ÞˆÞ‰ÞŠÞ‹ÞŒÞÞŽÞÞÞ‘Þ’Þ“Þ”Þ•Þ–Þ—Þ˜Þ™ÞšÞ›ÞœÞÞžÞŸÞ Þ¡Þ¢Þ£Þ¤Þ¥Þ¦Þ§Þ¨Þ©ÞªÞ«Þ¬Þ­Þ®Þ¯Þ°Þ±\u07b2\u07b3\u07b4\u07b5\u07b6\u07b7\u07b8\u07b9\u07ba\u07bb\u07bc\u07bd\u07be\u07bf', ',') satisfies matches($s, '^(?:\\p{IsThaana}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsThaana}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00228() { final XQuery query = new XQuery( "(every $s in tokenize('ऀॿ,ऀà¤à¤‚ःऄअआइईउऊऋऌà¤à¤Žà¤à¤à¤‘ऒओऔकखगघङचछजà¤à¤žà¤Ÿà¤ à¤¡à¤¢à¤£à¤¤à¤¥à¤¦à¤§à¤¨à¤©à¤ªà¤«à¤¬à¤­à¤®à¤¯à¤°à¤±à¤²à¤³à¤´à¤µà¤¶à¤·à¤¸à¤¹à¤ºà¤»à¤¼à¤½à¤¾à¤¿à¥€à¥à¥‚ृॄॅॆेैॉॊोौà¥à¥Žà¥à¥à¥‘॒॓॔ॕॖॗक़ख़ग़ज़ड़à¥à¥žà¥Ÿà¥ à¥¡à¥¢à¥£\u0964\u0965०१२३४५६७८९\u0970ॱॲॳॴॵॶॷ\u0978ॹॺॻॼॽॾॿ', ',') satisfies matches($s, '^(?:\\p{IsDevanagari}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsDevanagari}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00229() { final XQuery query = new XQuery( "(every $s in tokenize('\u0980\u09ff,\u0980à¦à¦‚ঃ\u0984অআইঈউঊঋঌ\u098d\u098eà¦à¦\u0991\u0992ওঔকখগঘঙচছজà¦à¦žà¦Ÿà¦ à¦¡à¦¢à¦£à¦¤à¦¥à¦¦à¦§à¦¨\u09a9পফবভমযর\u09b1ল\u09b3\u09b4\u09b5শষসহ\u09ba\u09bb়ঽািীà§à§‚ৃৄ\u09c5\u09c6েৈ\u09c9\u09caà§‹à§Œà§à§Ž\u09cf\u09d0\u09d1\u09d2\u09d3\u09d4\u09d5\u09d6à§—\u09d8\u09d9\u09da\u09dbà§œà§\u09deয়ৠৡৢৣ\u09e4\u09e5০১২৩৪৫৬৭৮৯ৰৱ৲৳৴৵৶৷৸৹৺৻\u09fc\u09fd\u09fe\u09ff', ',') satisfies matches($s, '^(?:\\p{IsBengali}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsBengali}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00230() { final XQuery query = new XQuery( "(every $s in tokenize('\u0a00\u0a7f,\u0a00à¨à¨‚ਃ\u0a04ਅਆਇਈਉਊ\u0a0b\u0a0c\u0a0d\u0a0eà¨à¨\u0a11\u0a12ਓਔਕਖਗਘਙਚਛਜà¨à¨žà¨Ÿà¨ à¨¡à¨¢à¨£à¨¤à¨¥à¨¦à¨§à¨¨\u0a29ਪਫਬਭਮਯਰ\u0a31ਲਲ਼\u0a34ਵਸ਼\u0a37ਸਹ\u0a3a\u0a3b਼\u0a3dਾਿੀà©à©‚\u0a43\u0a44\u0a45\u0a46ੇੈ\u0a49\u0a4aੋੌà©\u0a4e\u0a4f\u0a50à©‘\u0a52\u0a53\u0a54\u0a55\u0a56\u0a57\u0a58ਖ਼ਗ਼ਜ਼ੜ\u0a5dਫ਼\u0a5f\u0a60\u0a61\u0a62\u0a63\u0a64\u0a65੦੧੨੩੪੫੬੭੮੯ੰੱੲੳੴੵ\u0a76\u0a77\u0a78\u0a79\u0a7a\u0a7b\u0a7c\u0a7d\u0a7e\u0a7f', ',') satisfies matches($s, '^(?:\\p{IsGurmukhi}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsGurmukhi}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00231() { final XQuery query = new XQuery( "(every $s in tokenize('\u0a80\u0aff,\u0a80àªàª‚ઃ\u0a84અઆઇઈઉઊઋઌàª\u0a8eàªàªàª‘\u0a92ઓઔકખગઘઙચછજàªàªžàªŸàª àª¡àª¢àª£àª¤àª¥àª¦àª§àª¨\u0aa9પફબભમયર\u0ab1લળ\u0ab4વશષસહ\u0aba\u0abb઼ઽાિીà«à«‚ૃૄૅ\u0ac6ેૈૉ\u0acaોૌà«\u0ace\u0acfà«\u0ad1\u0ad2\u0ad3\u0ad4\u0ad5\u0ad6\u0ad7\u0ad8\u0ad9\u0ada\u0adb\u0adc\u0add\u0ade\u0adfૠૡૢૣ\u0ae4\u0ae5૦૧૨૩૪૫૬૭૮૯\u0af0૱\u0af2\u0af3\u0af4\u0af5\u0af6\u0af7\u0af8\u0af9\u0afa\u0afb\u0afc\u0afd\u0afe\u0aff', ',') satisfies matches($s, '^(?:\\p{IsGujarati}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsGujarati}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00232() { final XQuery query = new XQuery( "(every $s in tokenize('\u0b00\u0b7f,\u0b00à¬à¬‚ଃ\u0b04ଅଆଇଈଉଊଋଌ\u0b0d\u0b0eà¬à¬\u0b11\u0b12ଓଔକଖଗଘଙଚଛଜà¬à¬žà¬Ÿà¬ à¬¡à¬¢à¬£à¬¤à¬¥à¬¦à¬§à¬¨\u0b29ପଫବଭମଯର\u0b31ଲଳ\u0b34ଵଶଷସହ\u0b3a\u0b3b଼ଽାିୀà­à­‚ୃୄ\u0b45\u0b46େୈ\u0b49\u0b4aà­‹à­Œà­\u0b4e\u0b4f\u0b50\u0b51\u0b52\u0b53\u0b54\u0b55à­–à­—\u0b58\u0b59\u0b5a\u0b5bà­œà­\u0b5eୟୠୡୢୣ\u0b64\u0b65୦୧୨୩୪୫୬୭୮୯୰ୱ୲୳୴୵୶୷\u0b78\u0b79\u0b7a\u0b7b\u0b7c\u0b7d\u0b7e\u0b7f', ',') satisfies matches($s, '^(?:\\p{IsOriya}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsOriya}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00233() { final XQuery query = new XQuery( "(every $s in tokenize('\u0b80\u0bff,\u0b80\u0b81ஂஃ\u0b84அஆஇஈஉஊ\u0b8b\u0b8c\u0b8dஎà®à®\u0b91ஒஓஔக\u0b96\u0b97\u0b98ஙச\u0b9bஜ\u0b9dஞட\u0ba0\u0ba1\u0ba2ணத\u0ba5\u0ba6\u0ba7நனப\u0bab\u0bac\u0badமயரறலளழவஶஷஸஹ\u0bba\u0bbb\u0bbc\u0bbdாிீà¯à¯‚\u0bc3\u0bc4\u0bc5ெேை\u0bc9ொோௌà¯\u0bce\u0bcfà¯\u0bd1\u0bd2\u0bd3\u0bd4\u0bd5\u0bd6ௗ\u0bd8\u0bd9\u0bda\u0bdb\u0bdc\u0bdd\u0bde\u0bdf\u0be0\u0be1\u0be2\u0be3\u0be4\u0be5௦௧௨௩௪௫௬௭௮௯௰௱௲௳௴௵௶௷௸௹௺\u0bfb\u0bfc\u0bfd\u0bfe\u0bff', ',') satisfies matches($s, '^(?:\\p{IsTamil}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsTamil}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00234() { final XQuery query = new XQuery( "(every $s in tokenize('\u0c00౿,\u0c00à°à°‚à°ƒ\u0c04అఆఇఈఉఊఋఌ\u0c0dà°Žà°à°\u0c11ఒఓఔకఖగఘఙచఛజà°à°žà°Ÿà° à°¡à°¢à°£à°¤à°¥à°¦à°§à°¨\u0c29పఫబభమయరఱలళ\u0c34వశషసహ\u0c3a\u0c3b\u0c3cఽాిీà±à±‚ృౄ\u0c45ెేై\u0c49ొోౌà±\u0c4e\u0c4f\u0c50\u0c51\u0c52\u0c53\u0c54ౕౖ\u0c57ౘౙ\u0c5a\u0c5b\u0c5c\u0c5d\u0c5e\u0c5fౠౡౢౣ\u0c64\u0c65౦౧౨౩౪౫౬౭౮౯\u0c70\u0c71\u0c72\u0c73\u0c74\u0c75\u0c76\u0c77౸౹౺౻౼౽౾౿', ',') satisfies matches($s, '^(?:\\p{IsTelugu}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsTelugu}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00235() { final XQuery query = new XQuery( "(every $s in tokenize('\u0c80\u0cff,\u0c80\u0c81ಂಃ\u0c84ಅಆಇಈಉಊಋಌ\u0c8dಎà²à²\u0c91ಒಓಔಕಖಗಘಙಚಛಜà²à²žà²Ÿà² à²¡à²¢à²£à²¤à²¥à²¦à²§à²¨\u0ca9ಪಫಬಭಮಯರಱಲಳ\u0cb4ವಶಷಸಹ\u0cba\u0cbb಼ಽಾಿೀà³à³‚ೃೄ\u0cc5ೆೇೈ\u0cc9ೊೋೌà³\u0cce\u0ccf\u0cd0\u0cd1\u0cd2\u0cd3\u0cd4ೕೖ\u0cd7\u0cd8\u0cd9\u0cda\u0cdb\u0cdc\u0cddೞ\u0cdfೠೡೢೣ\u0ce4\u0ce5೦೧೨೩೪೫೬೭೮೯\u0cf0ೱೲ\u0cf3\u0cf4\u0cf5\u0cf6\u0cf7\u0cf8\u0cf9\u0cfa\u0cfb\u0cfc\u0cfd\u0cfe\u0cff', ',') satisfies matches($s, '^(?:\\p{IsKannada}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsKannada}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00236() { final XQuery query = new XQuery( "(every $s in tokenize('\u0d00ൿ,\u0d00\u0d01à´‚à´ƒ\u0d04അആഇഈഉഊഋഌ\u0d0dà´Žà´à´\u0d11ഒഓഔകഖഗഘങചഛജà´à´žà´Ÿà´ à´¡à´¢à´£à´¤à´¥à´¦à´§à´¨à´©à´ªà´«à´¬à´­à´®à´¯à´°à´±à´²à´³à´´à´µà´¶à´·à´¸à´¹à´º\u0d3b\u0d3cഽാിീàµàµ‚ൃൄ\u0d45െേൈ\u0d49ൊോൌàµàµŽ\u0d4f\u0d50\u0d51\u0d52\u0d53\u0d54\u0d55\u0d56ൗ\u0d58\u0d59\u0d5a\u0d5b\u0d5c\u0d5d\u0d5e\u0d5fൠൡൢൣ\u0d64\u0d65൦൧൨൩൪൫൬൭൮൯൰൱൲൳൴൵\u0d76\u0d77\u0d78൹ൺൻർൽൾൿ', ',') satisfies matches($s, '^(?:\\p{IsMalayalam}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsMalayalam}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00237() { final XQuery query = new XQuery( "(every $s in tokenize('\u0d80\u0dff,\u0d80\u0d81ංඃ\u0d84අආඇඈඉඊඋඌà¶à¶Žà¶à¶à¶‘ඒඓඔඕඖ\u0d97\u0d98\u0d99කඛගà¶à¶žà¶Ÿà¶ à¶¡à¶¢à¶£à¶¤à¶¥à¶¦à¶§à¶¨à¶©à¶ªà¶«à¶¬à¶­à¶®à¶¯à¶°à¶±\u0db2ඳපඵබභමඹයර\u0dbcà¶½\u0dbe\u0dbfà·€à·à·‚සහළෆ\u0dc7\u0dc8\u0dc9à·Š\u0dcb\u0dcc\u0dcd\u0dceà·à·à·‘à·’à·“à·”\u0dd5à·–\u0dd7ෘෙේෛොà·à·žà·Ÿ\u0de0\u0de1\u0de2\u0de3\u0de4\u0de5\u0de6\u0de7\u0de8\u0de9\u0dea\u0deb\u0dec\u0ded\u0dee\u0def\u0df0\u0df1ෲෳ\u0df4\u0df5\u0df6\u0df7\u0df8\u0df9\u0dfa\u0dfb\u0dfc\u0dfd\u0dfe\u0dff', ',') satisfies matches($s, '^(?:\\p{IsSinhala}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsSinhala}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00238() { final XQuery query = new XQuery( "(every $s in tokenize('\u0e00\u0e7f,\u0e00à¸à¸‚ฃคฅฆงจฉชซฌà¸à¸Žà¸à¸à¸‘ฒณดตถทธนบปผà¸à¸žà¸Ÿà¸ à¸¡à¸¢à¸£à¸¤à¸¥à¸¦à¸§à¸¨à¸©à¸ªà¸«à¸¬à¸­à¸®à¸¯à¸°à¸±à¸²à¸³à¸´à¸µà¸¶à¸·à¸¸à¸¹à¸º\u0e3b\u0e3c\u0e3d\u0e3e฿เà¹à¹‚ใไๅๆ็่้๊๋์à¹à¹Ž\u0e4fà¹à¹‘๒๓๔๕๖๗๘๙\u0e5a\u0e5b\u0e5c\u0e5d\u0e5e\u0e5f\u0e60\u0e61\u0e62\u0e63\u0e64\u0e65\u0e66\u0e67\u0e68\u0e69\u0e6a\u0e6b\u0e6c\u0e6d\u0e6e\u0e6f\u0e70\u0e71\u0e72\u0e73\u0e74\u0e75\u0e76\u0e77\u0e78\u0e79\u0e7a\u0e7b\u0e7c\u0e7d\u0e7e\u0e7f', ',') satisfies matches($s, '^(?:\\p{IsThai}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsThai}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00239() { final XQuery query = new XQuery( "(every $s in tokenize('\u0e80\u0eff,\u0e80àºàº‚\u0e83ຄ\u0e85\u0e86ງຈ\u0e89ຊ\u0e8b\u0e8càº\u0e8e\u0e8f\u0e90\u0e91\u0e92\u0e93ດຕຖທ\u0e98ນບປຜàºàºžàºŸ\u0ea0ມຢຣ\u0ea4ລ\u0ea6ວ\u0ea8\u0ea9ສຫ\u0eacອຮຯະັາຳິີຶືຸູ\u0ebaົຼຽ\u0ebe\u0ebfເà»à»‚ໃໄ\u0ec5ໆ\u0ec7່້໊໋໌à»\u0ece\u0ecfà»à»‘໒໓໔໕໖໗໘໙\u0eda\u0edbໜà»\u0ede\u0edf\u0ee0\u0ee1\u0ee2\u0ee3\u0ee4\u0ee5\u0ee6\u0ee7\u0ee8\u0ee9\u0eea\u0eeb\u0eec\u0eed\u0eee\u0eef\u0ef0\u0ef1\u0ef2\u0ef3\u0ef4\u0ef5\u0ef6\u0ef7\u0ef8\u0ef9\u0efa\u0efb\u0efc\u0efd\u0efe\u0eff', ',') satisfies matches($s, '^(?:\\p{IsLao}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsLao}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00240() { final XQuery query = new XQuery( "(every $s in tokenize('ༀ\u0fff,ༀà¼à¼‚༃\u0f04\u0f05\u0f06\u0f07\u0f08\u0f09\u0f0a\u0f0b\u0f0c\u0f0d\u0f0e\u0f0f\u0f10\u0f11\u0f12༓༔༕༖༗༘༙༚༛༜à¼à¼žà¼Ÿà¼ à¼¡à¼¢à¼£à¼¤à¼¥à¼¦à¼§à¼¨à¼©à¼ªà¼«à¼¬à¼­à¼®à¼¯à¼°à¼±à¼²à¼³à¼´à¼µà¼¶à¼·à¼¸à¼¹\u0f3a\u0f3b\u0f3c\u0f3d༾༿ཀà½à½‚གྷངཅཆཇ\u0f48ཉཊཋཌà½à½Žà½à½à½‘དྷནཔཕབབྷམཙཚཛཛྷà½à½žà½Ÿà½ à½¡à½¢à½£à½¤à½¥à½¦à½§à½¨à½©à½ªà½«à½¬\u0f6d\u0f6e\u0f6f\u0f70ཱཱཱིིུུྲྀཷླྀཹེཻོཽཾཿྀà¾à¾‚྄ྃ\u0f85྆྇ྈྉྊྋྌà¾à¾Žà¾à¾à¾‘ྒྒྷྔྕྖྗ\u0f98ྙྚྛྜà¾à¾žà¾Ÿà¾ à¾¡à¾¢à¾£à¾¤à¾¥à¾¦à¾§à¾¨à¾©à¾ªà¾«à¾¬à¾­à¾®à¾¯à¾°à¾±à¾²à¾³à¾´à¾µà¾¶à¾·à¾¸à¾¹à¾ºà¾»à¾¼\u0fbd྾྿࿀à¿à¿‚࿃࿄࿅࿆࿇࿈࿉࿊࿋࿌\u0fcd࿎à¿\u0fd0\u0fd1\u0fd2\u0fd3\u0fd4࿕࿖࿗࿘\u0fd9\u0fda\u0fdb\u0fdc\u0fdd\u0fde\u0fdf\u0fe0\u0fe1\u0fe2\u0fe3\u0fe4\u0fe5\u0fe6\u0fe7\u0fe8\u0fe9\u0fea\u0feb\u0fec\u0fed\u0fee\u0fef\u0ff0\u0ff1\u0ff2\u0ff3\u0ff4\u0ff5\u0ff6\u0ff7\u0ff8\u0ff9\u0ffa\u0ffb\u0ffc\u0ffd\u0ffe\u0fff', ',') satisfies matches($s, '^(?:\\p{IsTibetan}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsTibetan}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00241() { final XQuery query = new XQuery( "(every $s in tokenize('က႟,ကá€á€‚ဃငစဆဇဈဉညဋဌá€á€Žá€á€á€‘ဒဓနပဖဗဘမယရလá€á€žá€Ÿá€ á€¡á€¢á€£á€¤á€¥á€¦á€§á€¨á€©á€ªá€«á€¬á€­á€®á€¯á€°á€±á€²á€³á€´á€µá€¶á€·á€¸á€¹á€ºá€»á€¼á€½á€¾á€¿á€áá‚áƒá„á…á†á‡áˆá‰\u104a\u104b\u104c\u104d\u104e\u104fáá‘á’á“á”á•á–á—á˜á™ášá›áœáážáŸá á¡á¢á£á¤á¥á¦á§á¨á©áªá«á¬á­á®á¯á°á±á²á³á´áµá¶á·á¸á¹áºá»á¼á½á¾á¿á‚€á‚ႂႃႄႅႆႇႈႉႊႋႌá‚ႎá‚á‚႑႒႓႔႕႖႗႘႙ႚႛႜá‚႞႟', ',') satisfies matches($s, '^(?:\\p{IsMyanmar}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsMyanmar}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00242() { final XQuery query = new XQuery( "(every $s in tokenize('á‚ \u10ff,ႠႡႢႣႤႥႦႧႨႩႪႫႬႭႮႯႰႱႲႳႴႵႶႷႸႹႺႻႼႽႾႿჀáƒáƒ‚ჃჄჅ\u10c6\u10c7\u10c8\u10c9\u10ca\u10cb\u10cc\u10cd\u10ce\u10cfáƒáƒ‘გდევზთიკლმნáƒáƒžáƒŸáƒ áƒ¡áƒ¢áƒ£áƒ¤áƒ¥áƒ¦áƒ§áƒ¨áƒ©áƒªáƒ«áƒ¬áƒ­áƒ®áƒ¯áƒ°áƒ±áƒ²áƒ³áƒ´áƒµáƒ¶áƒ·áƒ¸áƒ¹áƒº\u10fbჼ\u10fd\u10fe\u10ff', ',') satisfies matches($s, '^(?:\\p{IsGeorgian}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsGeorgian}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00243() { final XQuery query = new XQuery( "(every $s in tokenize('ᄀᇿ,á„€á„ᄂᄃᄄᄅᄆᄇᄈᄉᄊᄋᄌá„ᄎá„á„ᄑᄒᄓᄔᄕᄖᄗᄘᄙᄚᄛᄜá„ᄞᄟᄠᄡᄢᄣᄤᄥᄦᄧᄨᄩᄪᄫᄬᄭᄮᄯᄰᄱᄲᄳᄴᄵᄶᄷᄸᄹᄺᄻᄼᄽᄾᄿᅀá…ᅂᅃᅄᅅᅆᅇᅈᅉᅊᅋᅌá…á…Žá…á…ᅑᅒᅓᅔᅕᅖᅗᅘᅙᅚᅛᅜá…ᅞᅟᅠᅡᅢᅣᅤᅥᅦᅧᅨᅩᅪᅫᅬᅭᅮᅯᅰᅱᅲᅳᅴᅵᅶᅷᅸᅹᅺᅻᅼᅽᅾᅿᆀá†á†‚ᆃᆄᆅᆆᆇᆈᆉᆊᆋᆌá†á†Žá†á†á†‘ᆒᆓᆔᆕᆖᆗᆘᆙᆚᆛᆜá†á†žá†Ÿá† á†¡á†¢á†£á†¤á†¥á†¦á†§á†¨á†©á†ªá†«á†¬á†­á†®á†¯á†°á†±á†²á†³á†´á†µá†¶á†·á†¸á†¹á†ºá†»á†¼á†½á†¾á†¿á‡€á‡á‡‚ᇃᇄᇅᇆᇇᇈᇉᇊᇋᇌá‡á‡Žá‡á‡á‡‘ᇒᇓᇔᇕᇖᇗᇘᇙᇚᇛᇜá‡á‡žá‡Ÿá‡ á‡¡á‡¢á‡£á‡¤á‡¥á‡¦á‡§á‡¨á‡©á‡ªá‡«á‡¬á‡­á‡®á‡¯á‡°á‡±á‡²á‡³á‡´á‡µá‡¶á‡·á‡¸á‡¹á‡ºá‡»á‡¼á‡½á‡¾á‡¿', ',') satisfies matches($s, '^(?:\\p{IsHangulJamo}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsHangulJamo}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00244() { final XQuery query = new XQuery( "(every $s in tokenize('ሀ\u137f,ሀáˆáˆ‚ሃሄህሆሇለሉሊላሌáˆáˆŽáˆáˆáˆ‘ሒሓሔሕሖሗመሙሚማሜáˆáˆžáˆŸáˆ áˆ¡áˆ¢áˆ£áˆ¤áˆ¥áˆ¦áˆ§áˆ¨áˆ©áˆªáˆ«áˆ¬áˆ­áˆ®áˆ¯áˆ°áˆ±áˆ²áˆ³áˆ´áˆµáˆ¶áˆ·áˆ¸áˆ¹áˆºáˆ»áˆ¼áˆ½áˆ¾áˆ¿á‰€á‰á‰‚ቃቄቅቆቇቈ\u1249ቊቋቌá‰\u124e\u124fá‰á‰‘ቒቓቔቕቖ\u1257ቘ\u1259ቚቛቜá‰\u125e\u125fበቡቢባቤብቦቧቨቩቪቫቬቭቮቯተቱቲታቴትቶቷቸቹቺቻቼችቾቿኀáŠáŠ‚áŠƒáŠ„áŠ…áŠ†áŠ‡áŠˆ\u1289ኊኋኌáŠ\u128e\u128fáŠáŠ‘áŠ’áŠ“áŠ”áŠ•áŠ–áŠ—áŠ˜áŠ™áŠšáŠ›áŠœáŠáŠžáŠŸáŠ áŠ¡áŠ¢áŠ£áŠ¤áŠ¥áŠ¦áŠ§áŠ¨áŠ©áŠªáŠ«áŠ¬áŠ­áŠ®áŠ¯áŠ°\u12b1ኲኳኴኵ\u12b6\u12b7ኸኹኺኻኼኽኾ\u12bfá‹€\u12c1ዂዃዄዅ\u12c6\u12c7ወዉዊዋዌá‹á‹Žá‹á‹á‹‘ዒዓዔዕዖ\u12d7ዘዙዚዛዜá‹á‹žá‹Ÿá‹ á‹¡á‹¢á‹£á‹¤á‹¥á‹¦á‹§á‹¨á‹©á‹ªá‹«á‹¬á‹­á‹®á‹¯á‹°á‹±á‹²á‹³á‹´á‹µá‹¶á‹·á‹¸á‹¹á‹ºá‹»á‹¼á‹½á‹¾á‹¿áŒ€áŒáŒ‚ጃጄጅጆጇገጉጊጋጌáŒáŒŽáŒáŒ\u1311ጒጓጔጕ\u1316\u1317ጘጙጚጛጜáŒáŒžáŒŸáŒ áŒ¡áŒ¢áŒ£áŒ¤áŒ¥áŒ¦áŒ§áŒ¨áŒ©áŒªáŒ«áŒ¬áŒ­áŒ®áŒ¯áŒ°áŒ±áŒ²áŒ³áŒ´áŒµáŒ¶áŒ·áŒ¸áŒ¹áŒºáŒ»áŒ¼áŒ½áŒ¾áŒ¿á€áá‚áƒá„á…á†á‡áˆá‰áŠá‹áŒááŽááá‘á’á“á”á•á–á—á˜á™áš\u135b\u135cáážáŸá \u1361\u1362\u1363\u1364\u1365\u1366\u1367\u1368á©áªá«á¬á­á®á¯á°á±á²á³á´áµá¶á·á¸á¹áºá»á¼\u137d\u137e\u137f', ',') satisfies matches($s, '^(?:\\p{IsEthiopic}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsEthiopic}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00245() { final XQuery query = new XQuery( "(every $s in tokenize('Ꭰ\u13ff,ᎠᎡᎢᎣᎤᎥᎦᎧᎨᎩᎪᎫᎬᎭᎮᎯᎰᎱᎲᎳᎴᎵᎶᎷᎸᎹᎺᎻᎼᎽᎾᎿá€áá‚áƒá„á…á†á‡áˆá‰áŠá‹áŒááŽááá‘á’á“á”á•á–á—á˜á™ášá›áœáážáŸá á¡á¢á£á¤á¥á¦á§á¨á©áªá«á¬á­á®á¯á°á±á²á³á´\u13f5\u13f6\u13f7\u13f8\u13f9\u13fa\u13fb\u13fc\u13fd\u13fe\u13ff', ',') satisfies matches($s, '^(?:\\p{IsCherokee}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsCherokee}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00246() { final XQuery query = new XQuery( "(every $s in tokenize('\u1400ᙿ,\u1400áá‚áƒá„á…á†á‡áˆá‰áŠá‹áŒááŽááá‘á’á“á”á•á–á—á˜á™ášá›áœáážáŸá á¡á¢á£á¤á¥á¦á§á¨á©áªá«á¬á­á®á¯á°á±á²á³á´áµá¶á·á¸á¹áºá»á¼á½á¾á¿á‘€á‘ᑂᑃᑄᑅᑆᑇᑈᑉᑊᑋᑌá‘ᑎá‘á‘ᑑᑒᑓᑔᑕᑖᑗᑘᑙᑚᑛᑜá‘ᑞᑟᑠᑡᑢᑣᑤᑥᑦᑧᑨᑩᑪᑫᑬᑭᑮᑯᑰᑱᑲᑳᑴᑵᑶᑷᑸᑹᑺᑻᑼᑽᑾᑿᒀá’ᒂᒃᒄᒅᒆᒇᒈᒉᒊᒋᒌá’á’Žá’á’ᒑᒒᒓᒔᒕᒖᒗᒘᒙᒚᒛᒜá’ᒞᒟᒠᒡᒢᒣᒤᒥᒦᒧᒨᒩᒪᒫᒬᒭᒮᒯᒰᒱᒲᒳᒴᒵᒶᒷᒸᒹᒺᒻᒼᒽᒾᒿᓀá“ᓂᓃᓄᓅᓆᓇᓈᓉᓊᓋᓌá“ᓎá“á“ᓑᓒᓓᓔᓕᓖᓗᓘᓙᓚᓛᓜá“ᓞᓟᓠᓡᓢᓣᓤᓥᓦᓧᓨᓩᓪᓫᓬᓭᓮᓯᓰᓱᓲᓳᓴᓵᓶᓷᓸᓹᓺᓻᓼᓽᓾᓿᔀá”ᔂᔃᔄᔅᔆᔇᔈᔉᔊᔋᔌá”ᔎá”á”ᔑᔒᔓᔔᔕᔖᔗᔘᔙᔚᔛᔜá”ᔞᔟᔠᔡᔢᔣᔤᔥᔦᔧᔨᔩᔪᔫᔬᔭᔮᔯᔰᔱᔲᔳᔴᔵᔶᔷᔸᔹᔺᔻᔼᔽᔾᔿᕀá•ᕂᕃᕄᕅᕆᕇᕈᕉᕊᕋᕌá•ᕎá•á•ᕑᕒᕓᕔᕕᕖᕗᕘᕙᕚᕛᕜá•ᕞᕟᕠᕡᕢᕣᕤᕥᕦᕧᕨᕩᕪᕫᕬᕭᕮᕯᕰᕱᕲᕳᕴᕵᕶᕷᕸᕹᕺᕻᕼᕽᕾᕿᖀá–ᖂᖃᖄᖅᖆᖇᖈᖉᖊᖋᖌá–á–Žá–á–ᖑᖒᖓᖔᖕᖖᖗᖘᖙᖚᖛᖜá–ᖞᖟᖠᖡᖢᖣᖤᖥᖦᖧᖨᖩᖪᖫᖬᖭᖮᖯᖰᖱᖲᖳᖴᖵᖶᖷᖸᖹᖺᖻᖼᖽᖾᖿᗀá—ᗂᗃᗄᗅᗆᗇᗈᗉᗊᗋᗌá—á—Žá—á—ᗑᗒᗓᗔᗕᗖᗗᗘᗙᗚᗛᗜá—ᗞᗟᗠᗡᗢᗣᗤᗥᗦᗧᗨᗩᗪᗫᗬᗭᗮᗯᗰᗱᗲᗳᗴᗵᗶᗷᗸᗹᗺᗻᗼᗽᗾᗿᘀá˜á˜‚ᘃᘄᘅᘆᘇᘈᘉᘊᘋᘌá˜á˜Žá˜á˜á˜‘ᘒᘓᘔᘕᘖᘗᘘᘙᘚᘛᘜá˜á˜žá˜Ÿá˜ á˜¡á˜¢á˜£á˜¤á˜¥á˜¦á˜§á˜¨á˜©á˜ªá˜«á˜¬á˜­á˜®á˜¯á˜°á˜±á˜²á˜³á˜´á˜µá˜¶á˜·á˜¸á˜¹á˜ºá˜»á˜¼á˜½á˜¾á˜¿á™€á™á™‚ᙃᙄᙅᙆᙇᙈᙉᙊᙋᙌá™á™Žá™á™á™‘ᙒᙓᙔᙕᙖᙗᙘᙙᙚᙛᙜá™á™žá™Ÿá™ á™¡á™¢á™£á™¤á™¥á™¦á™§á™¨á™©á™ªá™«á™¬\u166d\u166eᙯᙰᙱᙲᙳᙴᙵᙶᙷᙸᙹᙺᙻᙼᙽᙾᙿ', ',') satisfies matches($s, '^(?:\\p{IsUnifiedCanadianAboriginalSyllabics}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsUnifiedCanadianAboriginalSyllabics}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00247() { final XQuery query = new XQuery( "(every $s in tokenize('\u1680\u169f,\u1680ášáš‚ᚃᚄᚅᚆᚇᚈᚉᚊᚋᚌášášŽášášáš‘ᚒᚓᚔᚕᚖᚗᚘᚙᚚ\u169b\u169c\u169d\u169e\u169f', ',') satisfies matches($s, '^(?:\\p{IsOgham}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsOgham}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00248() { final XQuery query = new XQuery( "(every $s in tokenize('áš \u16ff,ᚠᚡᚢᚣᚤᚥᚦᚧᚨᚩᚪᚫᚬᚭᚮᚯᚰᚱᚲᚳᚴᚵᚶᚷᚸᚹᚺᚻᚼᚽᚾᚿᛀá›á›‚ᛃᛄᛅᛆᛇᛈᛉᛊᛋᛌá›á›Žá›á›á›‘ᛒᛓᛔᛕᛖᛗᛘᛙᛚᛛᛜá›á›žá›Ÿá› á›¡á›¢á›£á›¤á›¥á›¦á›§á›¨á›©á›ª\u16eb\u16ec\u16edᛮᛯᛰ\u16f1\u16f2\u16f3\u16f4\u16f5\u16f6\u16f7\u16f8\u16f9\u16fa\u16fb\u16fc\u16fd\u16fe\u16ff', ',') satisfies matches($s, '^(?:\\p{IsRunic}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsRunic}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00249() { final XQuery query = new XQuery( "(every $s in tokenize('ក\u17ff,កážáž‚ឃងចឆជឈញដឋឌážážŽážážáž‘ធនបផពភមយរលវážážžážŸáž áž¡áž¢áž£áž¤áž¥áž¦áž§áž¨áž©ážªáž«áž¬áž­áž®áž¯áž°áž±áž²áž³\u17b4\u17b5ាិីឹឺុូួើឿៀáŸáŸ‚ៃោៅំះៈ៉៊់៌áŸáŸŽáŸáŸáŸ‘្៓\u17d4\u17d5\u17d6ៗ\u17d8\u17d9\u17da៛ៜáŸ\u17de\u17df០១២៣៤៥៦៧៨៩\u17ea\u17eb\u17ec\u17ed\u17ee\u17ef៰៱៲៳៴៵៶៷៸៹\u17fa\u17fb\u17fc\u17fd\u17fe\u17ff', ',') satisfies matches($s, '^(?:\\p{IsKhmer}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsKhmer}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00250() { final XQuery query = new XQuery( "(every $s in tokenize('\u1800\u18af,\u1800\u1801\u1802\u1803\u1804\u1805\u1806\u1807\u1808\u1809\u180aá ‹á Œá \u180e\u180fá á ‘᠒᠓᠔᠕᠖᠗᠘᠙\u181a\u181b\u181c\u181d\u181e\u181fᠠᠡᠢᠣᠤᠥᠦᠧᠨᠩᠪᠫᠬᠭᠮᠯᠰᠱᠲᠳᠴᠵᠶᠷᠸᠹᠺᠻᠼᠽᠾᠿᡀá¡á¡‚ᡃᡄᡅᡆᡇᡈᡉᡊᡋᡌá¡á¡Žá¡á¡á¡‘ᡒᡓᡔᡕᡖᡗᡘᡙᡚᡛᡜá¡á¡žá¡Ÿá¡ á¡¡á¡¢á¡£á¡¤á¡¥á¡¦á¡§á¡¨á¡©á¡ªá¡«á¡¬á¡­á¡®á¡¯á¡°á¡±á¡²á¡³á¡´á¡µá¡¶á¡·\u1878\u1879\u187a\u187b\u187c\u187d\u187e\u187fᢀá¢á¢‚ᢃᢄᢅᢆᢇᢈᢉᢊᢋᢌá¢á¢Žá¢á¢á¢‘ᢒᢓᢔᢕᢖᢗᢘᢙᢚᢛᢜá¢á¢žá¢Ÿá¢ á¢¡á¢¢á¢£á¢¤á¢¥á¢¦á¢§á¢¨á¢©á¢ª\u18ab\u18ac\u18ad\u18ae\u18af', ',') satisfies matches($s, '^(?:\\p{IsMongolian}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsMongolian}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00251() { final XQuery query = new XQuery( "(every $s in tokenize('Ḁỿ,Ḁá¸á¸‚ḃḄḅḆḇḈḉḊḋḌá¸á¸Žá¸á¸á¸‘ḒḓḔḕḖḗḘḙḚḛḜá¸á¸žá¸Ÿá¸ á¸¡á¸¢á¸£á¸¤á¸¥á¸¦á¸§á¸¨á¸©á¸ªá¸«á¸¬á¸­á¸®á¸¯á¸°á¸±á¸²á¸³á¸´á¸µá¸¶á¸·á¸¸á¸¹á¸ºá¸»á¸¼á¸½á¸¾á¸¿á¹€á¹á¹‚ṃṄṅṆṇṈṉṊṋṌá¹á¹Žá¹á¹á¹‘ṒṓṔṕṖṗṘṙṚṛṜá¹á¹žá¹Ÿá¹ á¹¡á¹¢á¹£á¹¤á¹¥á¹¦á¹§á¹¨á¹©á¹ªá¹«á¹¬á¹­á¹®á¹¯á¹°á¹±á¹²á¹³á¹´á¹µá¹¶á¹·á¹¸á¹¹á¹ºá¹»á¹¼á¹½á¹¾á¹¿áº€áºáº‚ẃẄẅẆẇẈẉẊẋẌáºáºŽáºáºáº‘ẒẓẔẕẖẗẘẙẚẛẜáºáºžáºŸáº áº¡áº¢áº£áº¤áº¥áº¦áº§áº¨áº©áºªáº«áº¬áº­áº®áº¯áº°áº±áº²áº³áº´áºµáº¶áº·áº¸áº¹áººáº»áº¼áº½áº¾áº¿á»€á»á»‚ểỄễỆệỈỉỊịỌá»á»Žá»á»á»‘ỒồỔổỖỗỘộỚớỜá»á»žá»Ÿá» á»¡á»¢á»£á»¤á»¥á»¦á»§á»¨á»©á»ªá»«á»¬á»­á»®á»¯á»°á»±á»²á»³á»´á»µá»¶á»·á»¸á»¹á»ºá»»á»¼á»½á»¾á»¿', ',') satisfies matches($s, '^(?:\\p{IsLatinExtendedAdditional}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsLatinExtendedAdditional}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00252() { final XQuery query = new XQuery( "(every $s in tokenize('á¼€\u1fff,á¼€á¼á¼‚ἃἄἅἆἇἈἉἊἋἌá¼á¼Žá¼á¼á¼‘ἒἓἔἕ\u1f16\u1f17ἘἙἚἛἜá¼\u1f1e\u1f1fἠἡἢἣἤἥἦἧἨἩἪἫἬἭἮἯἰἱἲἳἴἵἶἷἸἹἺἻἼἽἾἿὀá½á½‚ὃὄὅ\u1f46\u1f47ὈὉὊὋὌá½\u1f4e\u1f4fá½á½‘ὒὓὔὕὖὗ\u1f58á½™\u1f5aá½›\u1f5cá½\u1f5eὟὠὡὢὣὤὥὦὧὨὩὪὫὬὭὮὯὰάὲέὴήὶίὸόὺύὼώ\u1f7e\u1f7fá¾€á¾á¾‚ᾃᾄᾅᾆᾇᾈᾉᾊᾋᾌá¾á¾Žá¾á¾á¾‘ᾒᾓᾔᾕᾖᾗᾘᾙᾚᾛᾜá¾á¾žá¾Ÿá¾ á¾¡á¾¢á¾£á¾¤á¾¥á¾¦á¾§á¾¨á¾©á¾ªá¾«á¾¬á¾­á¾®á¾¯á¾°á¾±á¾²á¾³á¾´\u1fb5ᾶᾷᾸᾹᾺΆᾼ᾽ι᾿῀á¿á¿‚ῃῄ\u1fc5ῆῇῈΈῊΉῌá¿á¿Žá¿á¿á¿‘á¿’á¿“\u1fd4\u1fd5ῖῗῘῙῚΊ\u1fdcá¿á¿žá¿Ÿá¿ á¿¡á¿¢á¿£á¿¤á¿¥á¿¦á¿§á¿¨á¿©á¿ªá¿«á¿¬á¿­á¿®á¿¯\u1ff0\u1ff1ῲῳῴ\u1ff5ῶῷῸΌῺΏῼ´῾\u1fff', ',') satisfies matches($s, '^(?:\\p{IsGreekExtended}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsGreekExtended}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00253() { final XQuery query = new XQuery( "(every $s in tokenize('\u2000\u206f,\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u200c\u200d\u200e\u200f\u2010\u2011\u2012\u2013\u2014\u2015\u2016\u2017\u2018\u2019\u201a\u201b\u201c\u201d\u201e\u201f\u2020\u2021\u2022\u2023\u2024\u2025\u2026\u2027\u2028\u2029\u202a\u202b\u202c\u202d\u202e\u202f\u2030\u2031\u2032\u2033\u2034\u2035\u2036\u2037\u2038\u2039\u203a\u203b\u203c\u203d\u203e\u203f\u2040\u2041\u2042\u2043â„\u2045\u2046\u2047\u2048\u2049\u204a\u204b\u204c\u204d\u204e\u204f\u2050\u2051â’\u2053\u2054\u2055\u2056\u2057\u2058\u2059\u205a\u205b\u205c\u205d\u205e\u205f\u2060\u2061\u2062\u2063\u2064\u2065\u2066\u2067\u2068\u2069\u206a\u206b\u206c\u206d\u206e\u206f', ',') satisfies matches($s, '^(?:\\p{IsGeneralPunctuation}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsGeneralPunctuation}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00254() { final XQuery query = new XQuery( "(every $s in tokenize('â°\u209f,â°â±\u2072\u2073â´âµâ¶â·â¸â¹âºâ»â¼\u207d\u207eâ¿â‚€â‚₂₃₄₅₆₇₈₉₊₋₌\u208d\u208e\u208fâ‚ₑₒₓₔₕₖₗₘₙₚₛₜ\u209d\u209e\u209f', ',') satisfies matches($s, '^(?:\\p{IsSuperscriptsandSubscripts}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsSuperscriptsandSubscripts}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00255() { final XQuery query = new XQuery( "(every $s in tokenize('â‚ \u20cf,₠₡₢₣₤₥₦₧₨₩₪₫€₭₮₯₰₱₲₳₴₵₶₷₸₹\u20ba\u20bb\u20bc\u20bd\u20be\u20bf\u20c0\u20c1\u20c2\u20c3\u20c4\u20c5\u20c6\u20c7\u20c8\u20c9\u20ca\u20cb\u20cc\u20cd\u20ce\u20cf', ',') satisfies matches($s, '^(?:\\p{IsCurrencySymbols}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsCurrencySymbols}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00256() { final XQuery query = new XQuery( "(every $s in tokenize('âƒ\u20ff', ',') satisfies matches($s, '^(?:\\p{IsCombiningMarksforSymbols}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsCombiningMarksforSymbols}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00257() { final XQuery query = new XQuery( "(every $s in tokenize('â„€â…,â„€â„ℂ℃℄℅℆ℇ℈℉ℊℋℌâ„ℎâ„â„ℑℒℓ℔ℕ№℗℘ℙℚℛℜâ„℞℟℠℡™℣ℤ℥Ω℧ℨ℩KÅℬℭ℮ℯℰℱℲℳℴℵℶℷℸℹ℺℻ℼℽℾℿ⅀â…⅂⅃⅄ⅅⅆⅇⅈⅉ⅊⅋⅌â…â…Žâ…', ',') satisfies matches($s, '^(?:\\p{IsLetterlikeSymbols}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsLetterlikeSymbols}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00258() { final XQuery query = new XQuery( "(every $s in tokenize('â…\u218f,â…⅑⅒⅓⅔⅕⅖⅗⅘⅙⅚⅛⅜â…⅞⅟ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫⅬⅭⅮⅯⅰⅱⅲⅳⅴⅵⅶⅷⅸⅹⅺⅻⅼⅽⅾⅿↀâ†â†‚Ↄↄↅↆↇↈ↉\u218a\u218b\u218c\u218d\u218e\u218f', ',') satisfies matches($s, '^(?:\\p{IsNumberForms}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsNumberForms}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00259() { final XQuery query = new XQuery( "(every $s in tokenize('â†â‡¿,â†â†‘→↓↔↕↖↗↘↙↚↛↜â†â†žâ†Ÿâ† â†¡â†¢â†£â†¤â†¥â†¦â†§â†¨â†©â†ªâ†«â†¬â†­â†®â†¯â†°â†±â†²â†³â†´â†µâ†¶â†·â†¸â†¹â†ºâ†»â†¼â†½â†¾â†¿â‡€â‡â‡‚⇃⇄⇅⇆⇇⇈⇉⇊⇋⇌â‡â‡Žâ‡â‡â‡‘⇒⇓⇔⇕⇖⇗⇘⇙⇚⇛⇜â‡â‡žâ‡Ÿâ‡ â‡¡â‡¢â‡£â‡¤â‡¥â‡¦â‡§â‡¨â‡©â‡ªâ‡«â‡¬â‡­â‡®â‡¯â‡°â‡±â‡²â‡³â‡´â‡µâ‡¶â‡·â‡¸â‡¹â‡ºâ‡»â‡¼â‡½â‡¾â‡¿', ',') satisfies matches($s, '^(?:\\p{IsArrows}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsArrows}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00260() { final XQuery query = new XQuery( "(every $s in tokenize('∀⋿,∀âˆâˆ‚∃∄∅∆∇∈∉∊∋∌âˆâˆŽâˆâˆâˆ‘−∓∔∕∖∗∘∙√∛∜âˆâˆžâˆŸâˆ âˆ¡âˆ¢âˆ£âˆ¤âˆ¥âˆ¦âˆ§âˆ¨âˆ©âˆªâˆ«âˆ¬âˆ­âˆ®âˆ¯âˆ°âˆ±âˆ²âˆ³âˆ´âˆµâˆ¶âˆ·âˆ¸âˆ¹âˆºâˆ»âˆ¼âˆ½âˆ¾âˆ¿â‰€â‰â‰‚≃≄≅≆≇≈≉≊≋≌â‰â‰Žâ‰â‰â‰‘≒≓≔≕≖≗≘≙≚≛≜â‰â‰žâ‰Ÿâ‰ â‰¡â‰¢â‰£â‰¤â‰¥â‰¦â‰§â‰¨â‰©â‰ªâ‰«â‰¬â‰­â‰®â‰¯â‰°â‰±â‰²â‰³â‰´â‰µâ‰¶â‰·â‰¸â‰¹â‰ºâ‰»â‰¼â‰½â‰¾â‰¿âŠ€âŠâŠ‚âŠƒâŠ„âŠ…âŠ†âŠ‡âŠˆâŠ‰âŠŠâŠ‹âŠŒâŠâŠŽâŠâŠâŠ‘âŠ’âŠ“âŠ”âŠ•âŠ–âŠ—âŠ˜âŠ™âŠšâŠ›âŠœâŠâŠžâŠŸâŠ âŠ¡âŠ¢âŠ£âŠ¤âŠ¥âŠ¦âŠ§âŠ¨âŠ©âŠªâŠ«âŠ¬âŠ­âŠ®âŠ¯âŠ°âŠ±âŠ²âŠ³âŠ´âŠµâŠ¶âŠ·âŠ¸âŠ¹âŠºâŠ»âŠ¼âŠ½âŠ¾âŠ¿â‹€â‹â‹‚⋃⋄⋅⋆⋇⋈⋉⋊⋋⋌â‹â‹Žâ‹â‹â‹‘⋒⋓⋔⋕⋖⋗⋘⋙⋚⋛⋜â‹â‹žâ‹Ÿâ‹ â‹¡â‹¢â‹£â‹¤â‹¥â‹¦â‹§â‹¨â‹©â‹ªâ‹«â‹¬â‹­â‹®â‹¯â‹°â‹±â‹²â‹³â‹´â‹µâ‹¶â‹·â‹¸â‹¹â‹ºâ‹»â‹¼â‹½â‹¾â‹¿', ',') satisfies matches($s, '^(?:\\p{IsMathematicalOperators}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsMathematicalOperators}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00261() { final XQuery query = new XQuery( "(every $s in tokenize('⌀\u23ff,⌀âŒâŒ‚⌃⌄⌅⌆⌇⌈⌉⌊⌋⌌âŒâŒŽâŒâŒâŒ‘⌒⌓⌔⌕⌖⌗⌘⌙⌚⌛⌜âŒâŒžâŒŸâŒ âŒ¡âŒ¢âŒ£âŒ¤âŒ¥âŒ¦âŒ§âŒ¨\u2329\u232a⌫⌬⌭⌮⌯⌰⌱⌲⌳⌴⌵⌶⌷⌸⌹⌺⌻⌼⌽⌾⌿â€ââ‚âƒâ„â…â†â‡âˆâ‰âŠâ‹âŒââŽâââ‘â’â“â”â•â–â—â˜â™âšâ›âœââžâŸâ â¡â¢â£â¤â¥â¦â§â¨â©âªâ«â¬â­â®â¯â°â±â²â³â´âµâ¶â·â¸â¹âºâ»â¼â½â¾â¿âŽ€âŽâŽ‚âŽƒâŽ„âŽ…âŽ†âŽ‡âŽˆâŽ‰âŽŠâŽ‹âŽŒâŽâŽŽâŽâŽâŽ‘âŽ’âŽ“âŽ”âŽ•âŽ–âŽ—âŽ˜âŽ™âŽšâŽ›âŽœâŽâŽžâŽŸâŽ âŽ¡âŽ¢âŽ£âŽ¤âŽ¥âŽ¦âŽ§âŽ¨âŽ©âŽªâŽ«âŽ¬âŽ­âŽ®âŽ¯âŽ°âŽ±âŽ²âŽ³âŽ´âŽµâŽ¶âŽ·âŽ¸âŽ¹âŽºâŽ»âŽ¼âŽ½âŽ¾âŽ¿â€ââ‚âƒâ„â…â†â‡âˆâ‰âŠâ‹âŒââŽâââ‘â’â“â”â•â–â—â˜â™âšâ›âœââžâŸâ â¡â¢â£â¤â¥â¦â§â¨â©âªâ«â¬â­â®â¯â°â±â²â³\u23f4\u23f5\u23f6\u23f7\u23f8\u23f9\u23fa\u23fb\u23fc\u23fd\u23fe\u23ff', ',') satisfies matches($s, '^(?:\\p{IsMiscellaneousTechnical}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsMiscellaneousTechnical}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00262() { final XQuery query = new XQuery( "(every $s in tokenize('â€\u243f,â€ââ‚âƒâ„â…â†â‡âˆâ‰âŠâ‹âŒââŽâââ‘â’â“â”â•â–â—â˜â™âšâ›âœââžâŸâ â¡â¢â£â¤â¥â¦\u2427\u2428\u2429\u242a\u242b\u242c\u242d\u242e\u242f\u2430\u2431\u2432\u2433\u2434\u2435\u2436\u2437\u2438\u2439\u243a\u243b\u243c\u243d\u243e\u243f', ',') satisfies matches($s, '^(?:\\p{IsControlPictures}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsControlPictures}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00263() { final XQuery query = new XQuery( "(every $s in tokenize('â‘€\u245f,â‘€â‘⑂⑃⑄⑅⑆⑇⑈⑉⑊\u244b\u244c\u244d\u244e\u244f\u2450\u2451\u2452\u2453\u2454\u2455\u2456\u2457\u2458\u2459\u245a\u245b\u245c\u245d\u245e\u245f', ',') satisfies matches($s, '^(?:\\p{IsOpticalCharacterRecognition}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsOpticalCharacterRecognition}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00264() { final XQuery query = new XQuery( "(every $s in tokenize('â‘ â“¿,①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳⑴⑵⑶⑷⑸⑹⑺⑻⑼⑽⑾⑿⒀â’⒂⒃⒄⒅⒆⒇⒈⒉⒊⒋⒌â’â’Žâ’â’⒑⒒⒓⒔⒕⒖⒗⒘⒙⒚⒛⒜â’⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵ⒶⒷⒸⒹⒺⒻⒼⒽⒾⒿⓀâ“ⓂⓃⓄⓅⓆⓇⓈⓉⓊⓋⓌâ“Ⓨâ“â“ⓑⓒⓓⓔⓕⓖⓗⓘⓙⓚⓛⓜâ“ⓞⓟⓠⓡⓢⓣⓤⓥⓦⓧⓨⓩ⓪⓫⓬⓭⓮⓯⓰⓱⓲⓳⓴⓵⓶⓷⓸⓹⓺⓻⓼⓽⓾⓿', ',') satisfies matches($s, '^(?:\\p{IsEnclosedAlphanumerics}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsEnclosedAlphanumerics}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00265() { final XQuery query = new XQuery( "(every $s in tokenize('─╿,─â”│┃┄┅┆┇┈┉┊┋┌â”┎â”â”┑┒┓└┕┖┗┘┙┚┛├â”┞┟┠┡┢┣┤┥┦┧┨┩┪┫┬┭┮┯┰┱┲┳┴┵┶┷┸┹┺┻┼┽┾┿╀â•╂╃╄╅╆╇╈╉╊╋╌â•╎â•â•║╒╓╔╕╖╗╘╙╚╛╜â•╞╟╠╡╢╣╤╥╦╧╨╩╪╫╬╭╮╯╰╱╲╳╴╵╶╷╸╹╺╻╼╽╾╿', ',') satisfies matches($s, '^(?:\\p{IsBoxDrawing}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsBoxDrawing}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00266() { final XQuery query = new XQuery( "(every $s in tokenize('▀▟,â–€â–▂▃▄▅▆▇█▉▊▋▌â–â–Žâ–â–░▒▓▔▕▖▗▘▙▚▛▜â–â–žâ–Ÿ', ',') satisfies matches($s, '^(?:\\p{IsBlockElements}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsBlockElements}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00267() { final XQuery query = new XQuery( "(every $s in tokenize('â– â—¿,■□▢▣▤▥▦▧▨▩▪▫▬▭▮▯▰▱▲△▴▵▶▷▸▹►▻▼▽▾▿◀â—◂◃◄◅◆◇◈◉◊○◌â—â—Žâ—â—◑◒◓◔◕◖◗◘◙◚◛◜â—◞◟◠◡◢◣◤◥◦◧◨◩◪◫◬◭◮◯◰◱◲◳◴◵◶◷◸◹◺◻◼◽◾◿', ',') satisfies matches($s, '^(?:\\p{IsGeometricShapes}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsGeometricShapes}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00268() { final XQuery query = new XQuery( "(every $s in tokenize('☀⛿,☀â˜â˜‚☃☄★☆☇☈☉☊☋☌â˜â˜Žâ˜â˜â˜‘☒☓☔☕☖☗☘☙☚☛☜â˜â˜žâ˜Ÿâ˜ â˜¡â˜¢â˜£â˜¤â˜¥â˜¦â˜§â˜¨â˜©â˜ªâ˜«â˜¬â˜­â˜®â˜¯â˜°â˜±â˜²â˜³â˜´â˜µâ˜¶â˜·â˜¸â˜¹â˜ºâ˜»â˜¼â˜½â˜¾â˜¿â™€â™â™‚♃♄♅♆♇♈♉♊♋♌â™â™Žâ™â™â™‘♒♓♔♕♖♗♘♙♚♛♜â™â™žâ™Ÿâ™ â™¡â™¢â™£â™¤â™¥â™¦â™§â™¨â™©â™ªâ™«â™¬â™­â™®â™¯â™°â™±â™²â™³â™´â™µâ™¶â™·â™¸â™¹â™ºâ™»â™¼â™½â™¾â™¿âš€âšâš‚⚃⚄⚅⚆⚇⚈⚉⚊⚋⚌âšâšŽâšâšâš‘⚒⚓⚔⚕⚖⚗⚘⚙⚚⚛⚜âšâšžâšŸâš âš¡âš¢âš£âš¤âš¥âš¦âš§âš¨âš©âšªâš«âš¬âš­âš®âš¯âš°âš±âš²âš³âš´âšµâš¶âš·âš¸âš¹âšºâš»âš¼âš½âš¾âš¿â›€â›â›‚⛃⛄⛅⛆⛇⛈⛉⛊⛋⛌â›â›Žâ›â›â›‘⛒⛓⛔⛕⛖⛗⛘⛙⛚⛛⛜â›â›žâ›Ÿâ› â›¡â›¢â›£â›¤â›¥â›¦â›§â›¨â›©â›ªâ›«â›¬â›­â›®â›¯â›°â›±â›²â›³â›´â›µâ›¶â›·â›¸â›¹â›ºâ›»â›¼â›½â›¾â›¿', ',') satisfies matches($s, '^(?:\\p{IsMiscellaneousSymbols}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsMiscellaneousSymbols}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00269() { final XQuery query = new XQuery( "(every $s in tokenize('\u2700âž¿,\u2700âœâœ‚✃✄✅✆✇✈✉✊✋✌âœâœŽâœâœâœ‘✒✓✔✕✖✗✘✙✚✛✜âœâœžâœŸâœ âœ¡âœ¢âœ£âœ¤âœ¥âœ¦âœ§âœ¨âœ©âœªâœ«âœ¬âœ­âœ®âœ¯âœ°âœ±âœ²âœ³âœ´âœµâœ¶âœ·âœ¸âœ¹âœºâœ»âœ¼âœ½âœ¾âœ¿â€ââ‚âƒâ„â…â†â‡âˆâ‰âŠâ‹âŒââŽâââ‘â’â“â”â•â–â—â˜â™âšâ›âœââžâŸâ â¡â¢â£â¤â¥â¦â§\u2768\u2769\u276a\u276b\u276c\u276d\u276e\u276f\u2770\u2771\u2772\u2773\u2774\u2775â¶â·â¸â¹âºâ»â¼â½â¾â¿âž€âžâž‚➃➄➅➆➇➈➉➊➋➌âžâžŽâžâžâž‘➒➓➔➕➖➗➘➙➚➛➜âžâžžâžŸâž âž¡âž¢âž£âž¤âž¥âž¦âž§âž¨âž©âžªâž«âž¬âž­âž®âž¯âž°âž±âž²âž³âž´âžµâž¶âž·âž¸âž¹âžºâž»âž¼âž½âž¾âž¿', ',') satisfies matches($s, '^(?:\\p{IsDingbats}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsDingbats}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00270() { final XQuery query = new XQuery( "(every $s in tokenize('⠀⣿,â €â â ‚⠃⠄⠅⠆⠇⠈⠉⠊⠋⠌â â Žâ â â ‘⠒⠓⠔⠕⠖⠗⠘⠙⠚⠛⠜â â žâ Ÿâ  â ¡â ¢â £â ¤â ¥â ¦â §â ¨â ©â ªâ «â ¬â ­â ®â ¯â °â ±â ²â ³â ´â µâ ¶â ·â ¸â ¹â ºâ »â ¼â ½â ¾â ¿â¡€â¡â¡‚⡃⡄⡅⡆⡇⡈⡉⡊⡋⡌â¡â¡Žâ¡â¡â¡‘⡒⡓⡔⡕⡖⡗⡘⡙⡚⡛⡜â¡â¡žâ¡Ÿâ¡ â¡¡â¡¢â¡£â¡¤â¡¥â¡¦â¡§â¡¨â¡©â¡ªâ¡«â¡¬â¡­â¡®â¡¯â¡°â¡±â¡²â¡³â¡´â¡µâ¡¶â¡·â¡¸â¡¹â¡ºâ¡»â¡¼â¡½â¡¾â¡¿â¢€â¢â¢‚⢃⢄⢅⢆⢇⢈⢉⢊⢋⢌â¢â¢Žâ¢â¢â¢‘⢒⢓⢔⢕⢖⢗⢘⢙⢚⢛⢜â¢â¢žâ¢Ÿâ¢ â¢¡â¢¢â¢£â¢¤â¢¥â¢¦â¢§â¢¨â¢©â¢ªâ¢«â¢¬â¢­â¢®â¢¯â¢°â¢±â¢²â¢³â¢´â¢µâ¢¶â¢·â¢¸â¢¹â¢ºâ¢»â¢¼â¢½â¢¾â¢¿â£€â£â£‚⣃⣄⣅⣆⣇⣈⣉⣊⣋⣌â£â£Žâ£â£â£‘⣒⣓⣔⣕⣖⣗⣘⣙⣚⣛⣜â£â£žâ£Ÿâ£ â£¡â£¢â££â£¤â£¥â£¦â£§â£¨â£©â£ªâ£«â£¬â£­â£®â£¯â£°â£±â£²â£³â£´â£µâ£¶â£·â£¸â£¹â£ºâ£»â£¼â£½â£¾â£¿', ',') satisfies matches($s, '^(?:\\p{IsBraillePatterns}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsBraillePatterns}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00271() { final XQuery query = new XQuery( "(every $s in tokenize('⺀\u2eff,⺀âºâº‚⺃⺄⺅⺆⺇⺈⺉⺊⺋⺌âºâºŽâºâºâº‘⺒⺓⺔⺕⺖⺗⺘⺙\u2e9a⺛⺜âºâºžâºŸâº âº¡âº¢âº£âº¤âº¥âº¦âº§âº¨âº©âºªâº«âº¬âº­âº®âº¯âº°âº±âº²âº³âº´âºµâº¶âº·âº¸âº¹âººâº»âº¼âº½âº¾âº¿â»€â»â»‚⻃⻄⻅⻆⻇⻈⻉⻊⻋⻌â»â»Žâ»â»â»‘⻒⻓⻔⻕⻖⻗⻘⻙⻚⻛⻜â»â»žâ»Ÿâ» â»¡â»¢â»£â»¤â»¥â»¦â»§â»¨â»©â»ªâ»«â»¬â»­â»®â»¯â»°â»±â»²â»³\u2ef4\u2ef5\u2ef6\u2ef7\u2ef8\u2ef9\u2efa\u2efb\u2efc\u2efd\u2efe\u2eff', ',') satisfies matches($s, '^(?:\\p{IsCJKRadicalsSupplement}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsCJKRadicalsSupplement}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00272() { final XQuery query = new XQuery( "(every $s in tokenize('â¼€\u2fdf,â¼€â¼â¼‚⼃⼄⼅⼆⼇⼈⼉⼊⼋⼌â¼â¼Žâ¼â¼â¼‘⼒⼓⼔⼕⼖⼗⼘⼙⼚⼛⼜â¼â¼žâ¼Ÿâ¼ â¼¡â¼¢â¼£â¼¤â¼¥â¼¦â¼§â¼¨â¼©â¼ªâ¼«â¼¬â¼­â¼®â¼¯â¼°â¼±â¼²â¼³â¼´â¼µâ¼¶â¼·â¼¸â¼¹â¼ºâ¼»â¼¼â¼½â¼¾â¼¿â½€â½â½‚⽃⽄⽅⽆⽇⽈⽉⽊⽋⽌â½â½Žâ½â½â½‘⽒⽓⽔⽕⽖⽗⽘⽙⽚⽛⽜â½â½žâ½Ÿâ½ â½¡â½¢â½£â½¤â½¥â½¦â½§â½¨â½©â½ªâ½«â½¬â½­â½®â½¯â½°â½±â½²â½³â½´â½µâ½¶â½·â½¸â½¹â½ºâ½»â½¼â½½â½¾â½¿â¾€â¾â¾‚⾃⾄⾅⾆⾇⾈⾉⾊⾋⾌â¾â¾Žâ¾â¾â¾‘⾒⾓⾔⾕⾖⾗⾘⾙⾚⾛⾜â¾â¾žâ¾Ÿâ¾ â¾¡â¾¢â¾£â¾¤â¾¥â¾¦â¾§â¾¨â¾©â¾ªâ¾«â¾¬â¾­â¾®â¾¯â¾°â¾±â¾²â¾³â¾´â¾µâ¾¶â¾·â¾¸â¾¹â¾ºâ¾»â¾¼â¾½â¾¾â¾¿â¿€â¿â¿‚⿃⿄⿅⿆⿇⿈⿉⿊⿋⿌â¿â¿Žâ¿â¿â¿‘⿒⿓⿔⿕\u2fd6\u2fd7\u2fd8\u2fd9\u2fda\u2fdb\u2fdc\u2fdd\u2fde\u2fdf', ',') satisfies matches($s, '^(?:\\p{IsKangxiRadicals}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsKangxiRadicals}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00273() { final XQuery query = new XQuery( "(every $s in tokenize('â¿°\u2fff,⿰⿱⿲⿳⿴⿵⿶⿷⿸⿹⿺⿻\u2ffc\u2ffd\u2ffe\u2fff', ',') satisfies matches($s, '^(?:\\p{IsIdeographicDescriptionCharacters}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsIdeographicDescriptionCharacters}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00274() { final XQuery query = new XQuery( "(every $s in tokenize('\u3000〿,\u3000\u3001\u3002\u3003〄々〆〇\u3008\u3009\u300a\u300b\u300c\u300d\u300e\u300f\u3010\u3011〒〓\u3014\u3015\u3016\u3017\u3018\u3019\u301a\u301b\u301c\u301d\u301e\u301f〠〡〢〣〤〥〦〧〨〩〪〭〮〯〫〬\u3030〱〲〳〴〵〶〷〸〹〺〻〼\u303d〾〿', ',') satisfies matches($s, '^(?:\\p{IsCJKSymbolsandPunctuation}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsCJKSymbolsandPunctuation}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00275() { final XQuery query = new XQuery( "(every $s in tokenize('\u3040ゟ,\u3040ãã‚ãƒã„ã…ã†ã‡ãˆã‰ãŠã‹ãŒããŽããã‘ã’ã“ã”ã•ã–ã—ã˜ã™ãšã›ãœããžãŸã ã¡ã¢ã£ã¤ã¥ã¦ã§ã¨ã©ãªã«ã¬ã­ã®ã¯ã°ã±ã²ã³ã´ãµã¶ã·ã¸ã¹ãºã»ã¼ã½ã¾ã¿ã‚€ã‚もゃやゅゆょよらりるれã‚ゎã‚ã‚ゑをんゔゕゖ\u3097\u3098゙゚゛゜ã‚ゞゟ', ',') satisfies matches($s, '^(?:\\p{IsHiragana}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsHiragana}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00276() { final XQuery query = new XQuery( "(every $s in tokenize('\u30a0ヿ,\u30a0ァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダãƒãƒ‚ッツヅテデトドナニヌãƒãƒŽãƒãƒãƒ‘ヒビピフブプヘベペホボãƒãƒžãƒŸãƒ ãƒ¡ãƒ¢ãƒ£ãƒ¤ãƒ¥ãƒ¦ãƒ§ãƒ¨ãƒ©ãƒªãƒ«ãƒ¬ãƒ­ãƒ®ãƒ¯ãƒ°ãƒ±ãƒ²ãƒ³ãƒ´ãƒµãƒ¶ãƒ·ãƒ¸ãƒ¹ãƒº\u30fbーヽヾヿ', ',') satisfies matches($s, '^(?:\\p{IsKatakana}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsKatakana}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00277() { final XQuery query = new XQuery( "(every $s in tokenize('\u3100\u312f,\u3100\u3101\u3102\u3103\u3104ㄅㄆㄇㄈㄉㄊㄋㄌã„ㄎã„ã„ㄑㄒㄓㄔㄕㄖㄗㄘㄙㄚㄛㄜã„ㄞㄟㄠㄡㄢㄣㄤㄥㄦㄧㄨㄩㄪㄫㄬㄭ\u312e\u312f', ',') satisfies matches($s, '^(?:\\p{IsBopomofo}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsBopomofo}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00278() { final XQuery query = new XQuery( "(every $s in tokenize('\u3130\u318f,\u3130ㄱㄲㄳㄴㄵㄶㄷㄸㄹㄺㄻㄼㄽㄾㄿㅀã…ㅂㅃㅄㅅㅆㅇㅈㅉㅊㅋㅌã…ã…Žã…ã…ㅑㅒㅓㅔㅕㅖㅗㅘㅙㅚㅛㅜã…ㅞㅟㅠㅡㅢㅣㅤㅥㅦㅧㅨㅩㅪㅫㅬㅭㅮㅯㅰㅱㅲㅳㅴㅵㅶㅷㅸㅹㅺㅻㅼㅽㅾㅿㆀã†ã†‚ㆃㆄㆅㆆㆇㆈㆉㆊㆋㆌã†ã†Ž\u318f', ',') satisfies matches($s, '^(?:\\p{IsHangulCompatibilityJamo}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsHangulCompatibilityJamo}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00279() { final XQuery query = new XQuery( "(every $s in tokenize('ã†ã†Ÿ,ã†ã†‘㆒㆓㆔㆕㆖㆗㆘㆙㆚㆛㆜ã†ã†žã†Ÿ', ',') satisfies matches($s, '^(?:\\p{IsKanbun}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsKanbun}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00280() { final XQuery query = new XQuery( "(every $s in tokenize('ㆠ\u31bf,ㆠㆡㆢㆣㆤㆥㆦㆧㆨㆩㆪㆫㆬㆭㆮㆯㆰㆱㆲㆳㆴㆵㆶㆷㆸㆹㆺ\u31bb\u31bc\u31bd\u31be\u31bf', ',') satisfies matches($s, '^(?:\\p{IsBopomofoExtended}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsBopomofoExtended}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00281() { final XQuery query = new XQuery( "(every $s in tokenize('㈀\u32ff,㈀ãˆãˆ‚㈃㈄㈅㈆㈇㈈㈉㈊㈋㈌ãˆãˆŽãˆãˆãˆ‘㈒㈓㈔㈕㈖㈗㈘㈙㈚㈛㈜ãˆãˆž\u321f㈠㈡㈢㈣㈤㈥㈦㈧㈨㈩㈪㈫㈬㈭㈮㈯㈰㈱㈲㈳㈴㈵㈶㈷㈸㈹㈺㈻㈼㈽㈾㈿㉀ã‰ã‰‚㉃㉄㉅㉆㉇㉈㉉㉊㉋㉌ã‰ã‰Žã‰ã‰ã‰‘㉒㉓㉔㉕㉖㉗㉘㉙㉚㉛㉜ã‰ã‰žã‰Ÿã‰ ã‰¡ã‰¢ã‰£ã‰¤ã‰¥ã‰¦ã‰§ã‰¨ã‰©ã‰ªã‰«ã‰¬ã‰­ã‰®ã‰¯ã‰°ã‰±ã‰²ã‰³ã‰´ã‰µã‰¶ã‰·ã‰¸ã‰¹ã‰ºã‰»ã‰¼ã‰½ã‰¾ã‰¿ãŠ€ãŠãŠ‚ãŠƒãŠ„ãŠ…ãŠ†ãŠ‡ãŠˆãŠ‰ãŠŠãŠ‹ãŠŒãŠãŠŽãŠãŠãŠ‘ãŠ’ãŠ“ãŠ”ãŠ•ãŠ–ãŠ—ãŠ˜ãŠ™ãŠšãŠ›ãŠœãŠãŠžãŠŸãŠ ãŠ¡ãŠ¢ãŠ£ãŠ¤ãŠ¥ãŠ¦ãŠ§ãŠ¨ãŠ©ãŠªãŠ«ãŠ¬ãŠ­ãŠ®ãŠ¯ãŠ°ãŠ±ãŠ²ãŠ³ãŠ´ãŠµãŠ¶ãŠ·ãŠ¸ãŠ¹ãŠºãŠ»ãŠ¼ãŠ½ãŠ¾ãŠ¿ã‹€ã‹ã‹‚㋃㋄㋅㋆㋇㋈㋉㋊㋋㋌ã‹ã‹Žã‹ã‹ã‹‘㋒㋓㋔㋕㋖㋗㋘㋙㋚㋛㋜ã‹ã‹žã‹Ÿã‹ ã‹¡ã‹¢ã‹£ã‹¤ã‹¥ã‹¦ã‹§ã‹¨ã‹©ã‹ªã‹«ã‹¬ã‹­ã‹®ã‹¯ã‹°ã‹±ã‹²ã‹³ã‹´ã‹µã‹¶ã‹·ã‹¸ã‹¹ã‹ºã‹»ã‹¼ã‹½ã‹¾\u32ff', ',') satisfies matches($s, '^(?:\\p{IsEnclosedCJKLettersandMonths}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsEnclosedCJKLettersandMonths}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00282() { final XQuery query = new XQuery( "(every $s in tokenize('㌀ã¿,㌀ãŒãŒ‚㌃㌄㌅㌆㌇㌈㌉㌊㌋㌌ãŒãŒŽãŒãŒãŒ‘㌒㌓㌔㌕㌖㌗㌘㌙㌚㌛㌜ãŒãŒžãŒŸãŒ ãŒ¡ãŒ¢ãŒ£ãŒ¤ãŒ¥ãŒ¦ãŒ§ãŒ¨ãŒ©ãŒªãŒ«ãŒ¬ãŒ­ãŒ®ãŒ¯ãŒ°ãŒ±ãŒ²ãŒ³ãŒ´ãŒµãŒ¶ãŒ·ãŒ¸ãŒ¹ãŒºãŒ»ãŒ¼ãŒ½ãŒ¾ãŒ¿ã€ãã‚ãƒã„ã…ã†ã‡ãˆã‰ãŠã‹ãŒããŽããã‘ã’ã“ã”ã•ã–ã—ã˜ã™ãšã›ãœããžãŸã ã¡ã¢ã£ã¤ã¥ã¦ã§ã¨ã©ãªã«ã¬ã­ã®ã¯ã°ã±ã²ã³ã´ãµã¶ã·ã¸ã¹ãºã»ã¼ã½ã¾ã¿ãŽ€ãŽãŽ‚ãŽƒãŽ„ãŽ…ãŽ†ãŽ‡ãŽˆãŽ‰ãŽŠãŽ‹ãŽŒãŽãŽŽãŽãŽãŽ‘ãŽ’ãŽ“ãŽ”ãŽ•ãŽ–ãŽ—ãŽ˜ãŽ™ãŽšãŽ›ãŽœãŽãŽžãŽŸãŽ ãŽ¡ãŽ¢ãŽ£ãŽ¤ãŽ¥ãŽ¦ãŽ§ãŽ¨ãŽ©ãŽªãŽ«ãŽ¬ãŽ­ãŽ®ãŽ¯ãŽ°ãŽ±ãŽ²ãŽ³ãŽ´ãŽµãŽ¶ãŽ·ãŽ¸ãŽ¹ãŽºãŽ»ãŽ¼ãŽ½ãŽ¾ãŽ¿ã€ãã‚ãƒã„ã…ã†ã‡ãˆã‰ãŠã‹ãŒããŽããã‘ã’ã“ã”ã•ã–ã—ã˜ã™ãšã›ãœããžãŸã ã¡ã¢ã£ã¤ã¥ã¦ã§ã¨ã©ãªã«ã¬ã­ã®ã¯ã°ã±ã²ã³ã´ãµã¶ã·ã¸ã¹ãºã»ã¼ã½ã¾ã¿', ',') satisfies matches($s, '^(?:\\p{IsCJKCompatibility}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsCJKCompatibility}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00283() { final XQuery query = new XQuery( "(every $s in tokenize('ã€ä¶µ', ',') satisfies matches($s, '^(?:\\p{IsCJKUnifiedIdeographsExtensionA}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsCJKUnifiedIdeographsExtensionA}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00284() { final XQuery query = new XQuery( "(every $s in tokenize('一\u9fff,一ä¸ä¸‚七丄丅丆万丈三上下丌ä¸ä¸Žä¸ä¸ä¸‘丒专且丕世丗丘丙业丛东ä¸ä¸žä¸Ÿä¸ ä¸¡ä¸¢ä¸£ä¸¤ä¸¥ä¸¦ä¸§ä¸¨ä¸©ä¸ªä¸«ä¸¬ä¸­ä¸®ä¸¯ä¸°ä¸±ä¸²ä¸³ä¸´ä¸µä¸¶ä¸·ä¸¸ä¸¹ä¸ºä¸»ä¸¼ä¸½ä¸¾ä¸¿ä¹€ä¹ä¹‚乃乄久乆乇么义乊之乌ä¹ä¹Žä¹ä¹ä¹‘乒乓乔乕乖乗乘乙乚乛乜ä¹ä¹žä¹Ÿä¹ ä¹¡ä¹¢ä¹£ä¹¤ä¹¥ä¹¦ä¹§ä¹¨ä¹©ä¹ªä¹«ä¹¬ä¹­ä¹®ä¹¯ä¹°ä¹±ä¹²ä¹³ä¹´ä¹µä¹¶ä¹·ä¹¸ä¹¹ä¹ºä¹»ä¹¼ä¹½ä¹¾ä¹¿äº€äºäº‚亃亄亅了亇予争亊事二äºäºŽäºäºäº‘互亓五井亖亗亘亙亚些亜äºäºžäºŸäº äº¡äº¢äº£äº¤äº¥äº¦äº§äº¨äº©äºªäº«äº¬äº­äº®äº¯äº°äº±äº²äº³äº´äºµäº¶äº·äº¸äº¹äººäº»äº¼äº½äº¾äº¿ä»€ä»ä»‚仃仄仅仆仇仈仉今介仌ä»ä»Žä»ä»ä»‘仒仓仔仕他仗付仙仚仛仜ä»ä»žä»Ÿä» ä»¡ä»¢ä»£ä»¤ä»¥ä»¦ä»§ä»¨ä»©ä»ªä»«ä»¬ä»­ä»®ä»¯ä»°ä»±ä»²ä»³ä»´ä»µä»¶ä»·ä»¸ä»¹ä»ºä»»ä»¼ä»½ä»¾ä»¿ä¼€ä¼ä¼‚伃伄伅伆伇伈伉伊伋伌ä¼ä¼Žä¼ä¼ä¼‘伒伓伔伕伖众优伙会伛伜ä¼ä¼žä¼Ÿä¼ ä¼¡ä¼¢ä¼£ä¼¤ä¼¥ä¼¦ä¼§ä¼¨ä¼©ä¼ªä¼«ä¼¬ä¼­ä¼®ä¼¯ä¼°ä¼±ä¼²ä¼³ä¼´ä¼µä¼¶ä¼·ä¼¸ä¼¹ä¼ºä¼»ä¼¼ä¼½ä¼¾ä¼¿ä½€ä½ä½‚佃佄佅但佇佈佉佊佋佌ä½ä½Žä½ä½ä½‘佒体佔何佖佗佘余佚佛作ä½ä½žä½Ÿä½ ä½¡ä½¢ä½£ä½¤ä½¥ä½¦ä½§ä½¨ä½©ä½ªä½«ä½¬ä½­ä½®ä½¯ä½°ä½±ä½²ä½³ä½´ä½µä½¶ä½·ä½¸ä½¹ä½ºä½»ä½¼ä½½ä½¾ä½¿ä¾€ä¾ä¾‚侃侄侅來侇侈侉侊例侌ä¾ä¾Žä¾ä¾ä¾‘侒侓侔侕侖侗侘侙侚供侜ä¾ä¾žä¾Ÿä¾ ä¾¡ä¾¢ä¾£ä¾¤ä¾¥ä¾¦ä¾§ä¾¨ä¾©ä¾ªä¾«ä¾¬ä¾­ä¾®ä¾¯ä¾°ä¾±ä¾²ä¾³ä¾´ä¾µä¾¶ä¾·ä¾¸ä¾¹ä¾ºä¾»ä¾¼ä¾½ä¾¾ä¾¿ä¿€ä¿ä¿‚促俄俅俆俇俈俉俊俋俌ä¿ä¿Žä¿ä¿ä¿‘俒俓俔俕俖俗俘俙俚俛俜ä¿ä¿žä¿Ÿä¿ ä¿¡ä¿¢ä¿£ä¿¤ä¿¥ä¿¦ä¿§ä¿¨ä¿©ä¿ªä¿«ä¿¬ä¿­ä¿®ä¿¯ä¿°ä¿±ä¿²ä¿³ä¿´ä¿µä¿¶ä¿·ä¿¸ä¿¹ä¿ºä¿»ä¿¼ä¿½ä¿¾ä¿¿å€€å€å€‚倃倄倅倆倇倈倉倊個倌å€å€Žå€å€å€‘倒倓倔倕倖倗倘候倚倛倜å€å€žå€Ÿå€ å€¡å€¢å€£å€¤å€¥å€¦å€§å€¨å€©å€ªå€«å€¬å€­å€®å€¯å€°å€±å€²å€³å€´å€µå€¶å€·å€¸å€¹å€ºå€»å€¼å€½å€¾å€¿å€åå‚åƒå„å…å†å‡åˆå‰åŠå‹åŒååŽååå‘å’å“å”å•å–å—å˜å™åšå›åœååžåŸå å¡å¢å£å¤å¥å¦å§å¨å©åªå«å¬å­å®å¯å°å±å²å³å´åµå¶å·å¸å¹åºå»å¼å½å¾å¿å‚€å‚傂傃傄傅傆傇傈傉傊傋傌å‚傎å‚å‚傑傒傓傔傕傖傗傘備傚傛傜å‚傞傟傠傡傢傣傤傥傦傧储傩傪傫催傭傮傯傰傱傲傳傴債傶傷傸傹傺傻傼傽傾傿僀åƒåƒ‚僃僄僅僆僇僈僉僊僋僌åƒåƒŽåƒåƒåƒ‘僒僓僔僕僖僗僘僙僚僛僜åƒåƒžåƒŸåƒ åƒ¡åƒ¢åƒ£åƒ¤åƒ¥åƒ¦åƒ§åƒ¨åƒ©åƒªåƒ«åƒ¬åƒ­åƒ®åƒ¯åƒ°åƒ±åƒ²åƒ³åƒ´åƒµåƒ¶åƒ·åƒ¸åƒ¹åƒºåƒ»åƒ¼åƒ½åƒ¾åƒ¿å„€å„儂儃億儅儆儇儈儉儊儋儌å„儎å„å„儑儒儓儔儕儖儗儘儙儚儛儜å„儞償儠儡儢儣儤儥儦儧儨儩優儫儬儭儮儯儰儱儲儳儴儵儶儷儸儹儺儻儼儽儾儿兀å…兂元兄充兆兇先光兊克兌å…å…Žå…å…兑兒兓兔兕兖兗兘兙党兛兜å…兞兟兠兡兢兣兤入兦內全兩兪八公六兮兯兰共兲关兴兵其具典兹兺养兼兽兾兿冀å†å†‚冃冄内円冇冈冉冊冋册å†å†Žå†å†å†‘冒冓冔冕冖冗冘写冚军农å†å†žå†Ÿå† å†¡å†¢å†£å†¤å†¥å†¦å†§å†¨å†©å†ªå†«å†¬å†­å†®å†¯å†°å†±å†²å†³å†´å†µå†¶å†·å†¸å†¹å†ºå†»å†¼å†½å†¾å†¿å‡€å‡å‡‚凃凄凅准凇凈凉凊凋凌å‡å‡Žå‡å‡å‡‘凒凓凔凕凖凗凘凙凚凛凜å‡å‡žå‡Ÿå‡ å‡¡å‡¢å‡£å‡¤å‡¥å‡¦å‡§å‡¨å‡©å‡ªå‡«å‡¬å‡­å‡®å‡¯å‡°å‡±å‡²å‡³å‡´å‡µå‡¶å‡·å‡¸å‡¹å‡ºå‡»å‡¼å‡½å‡¾å‡¿åˆ€åˆåˆ‚刃刄刅分切刈刉刊刋刌åˆåˆŽåˆåˆåˆ‘划刓刔刕刖列刘则刚创刜åˆåˆžåˆŸåˆ åˆ¡åˆ¢åˆ£åˆ¤åˆ¥åˆ¦åˆ§åˆ¨åˆ©åˆªåˆ«åˆ¬åˆ­åˆ®åˆ¯åˆ°åˆ±åˆ²åˆ³åˆ´åˆµåˆ¶åˆ·åˆ¸åˆ¹åˆºåˆ»åˆ¼åˆ½åˆ¾åˆ¿å‰€å‰å‰‚剃剄剅剆則剈剉削剋剌å‰å‰Žå‰å‰å‰‘剒剓剔剕剖剗剘剙剚剛剜å‰å‰žå‰Ÿå‰ å‰¡å‰¢å‰£å‰¤å‰¥å‰¦å‰§å‰¨å‰©å‰ªå‰«å‰¬å‰­å‰®å‰¯å‰°å‰±å‰²å‰³å‰´å‰µå‰¶å‰·å‰¸å‰¹å‰ºå‰»å‰¼å‰½å‰¾å‰¿åŠ€åŠåŠ‚åŠƒåŠ„åŠ…åŠ†åŠ‡åŠˆåŠ‰åŠŠåŠ‹åŠŒåŠåŠŽåŠåŠåŠ‘åŠ’åŠ“åŠ”åŠ•åŠ–åŠ—åŠ˜åŠ™åŠšåŠ›åŠœåŠåŠžåŠŸåŠ åŠ¡åŠ¢åŠ£åŠ¤åŠ¥åŠ¦åŠ§åŠ¨åŠ©åŠªåŠ«åŠ¬åŠ­åŠ®åŠ¯åŠ°åŠ±åŠ²åŠ³åŠ´åŠµåŠ¶åŠ·åŠ¸åŠ¹åŠºåŠ»åŠ¼åŠ½åŠ¾åŠ¿å‹€å‹å‹‚勃勄勅勆勇勈勉勊勋勌å‹å‹Žå‹å‹å‹‘勒勓勔動勖勗勘務勚勛勜å‹å‹žå‹Ÿå‹ å‹¡å‹¢å‹£å‹¤å‹¥å‹¦å‹§å‹¨å‹©å‹ªå‹«å‹¬å‹­å‹®å‹¯å‹°å‹±å‹²å‹³å‹´å‹µå‹¶å‹·å‹¸å‹¹å‹ºå‹»å‹¼å‹½å‹¾å‹¿åŒ€åŒåŒ‚匃匄包匆匇匈匉匊匋匌åŒåŒŽåŒåŒåŒ‘匒匓匔匕化北匘匙匚匛匜åŒåŒžåŒŸåŒ åŒ¡åŒ¢åŒ£åŒ¤åŒ¥åŒ¦åŒ§åŒ¨åŒ©åŒªåŒ«åŒ¬åŒ­åŒ®åŒ¯åŒ°åŒ±åŒ²åŒ³åŒ´åŒµåŒ¶åŒ·åŒ¸åŒ¹åŒºåŒ»åŒ¼åŒ½åŒ¾åŒ¿å€åå‚åƒå„å…å†å‡åˆå‰åŠå‹åŒååŽååå‘å’å“å”å•å–å—å˜å™åšå›åœååžåŸå å¡å¢å£å¤å¥å¦å§å¨å©åªå«å¬å­å®å¯å°å±å²å³å´åµå¶å·å¸å¹åºå»å¼å½å¾å¿åŽ€åŽåŽ‚åŽƒåŽ„åŽ…åŽ†åŽ‡åŽˆåŽ‰åŽŠåŽ‹åŽŒåŽåŽŽåŽåŽåŽ‘åŽ’åŽ“åŽ”åŽ•åŽ–åŽ—åŽ˜åŽ™åŽšåŽ›åŽœåŽåŽžåŽŸåŽ åŽ¡åŽ¢åŽ£åŽ¤åŽ¥åŽ¦åŽ§åŽ¨åŽ©åŽªåŽ«åŽ¬åŽ­åŽ®åŽ¯åŽ°åŽ±åŽ²åŽ³åŽ´åŽµåŽ¶åŽ·åŽ¸åŽ¹åŽºåŽ»åŽ¼åŽ½åŽ¾åŽ¿å€åå‚åƒå„å…å†å‡åˆå‰åŠå‹åŒååŽååå‘å’å“å”å•å–å—å˜å™åšå›åœååžåŸå å¡å¢å£å¤å¥å¦å§å¨å©åªå«å¬å­å®å¯å°å±å²å³å´åµå¶å·å¸å¹åºå»å¼å½å¾å¿å€åå‚åƒå„å…å†å‡åˆå‰åŠå‹åŒååŽååå‘å’å“å”å•å–å—å˜å™åšå›åœååžåŸå å¡å¢å£å¤å¥å¦å§å¨å©åªå«å¬å­å®å¯å°å±å²å³å´åµå¶å·å¸å¹åºå»å¼å½å¾å¿å‘€å‘呂呃呄呅呆呇呈呉告呋呌å‘呎å‘å‘呑呒呓呔呕呖呗员呙呚呛呜å‘呞呟呠呡呢呣呤呥呦呧周呩呪呫呬呭呮呯呰呱呲味呴呵呶呷呸呹呺呻呼命呾呿咀å’咂咃咄咅咆咇咈咉咊咋和å’å’Žå’å’咑咒咓咔咕咖咗咘咙咚咛咜å’咞咟咠咡咢咣咤咥咦咧咨咩咪咫咬咭咮咯咰咱咲咳咴咵咶咷咸咹咺咻咼咽咾咿哀å“哂哃哄哅哆哇哈哉哊哋哌å“哎å“å“哑哒哓哔哕哖哗哘哙哚哛哜å“哞哟哠員哢哣哤哥哦哧哨哩哪哫哬哭哮哯哰哱哲哳哴哵哶哷哸哹哺哻哼哽哾哿唀å”唂唃唄唅唆唇唈唉唊唋唌å”唎å”å”唑唒唓唔唕唖唗唘唙唚唛唜å”唞唟唠唡唢唣唤唥唦唧唨唩唪唫唬唭售唯唰唱唲唳唴唵唶唷唸唹唺唻唼唽唾唿啀å•啂啃啄啅商啇啈啉啊啋啌å•啎å•å•啑啒啓啔啕啖啗啘啙啚啛啜å•啞啟啠啡啢啣啤啥啦啧啨啩啪啫啬啭啮啯啰啱啲啳啴啵啶啷啸啹啺啻啼啽啾啿喀å–喂喃善喅喆喇喈喉喊喋喌å–å–Žå–å–喑喒喓喔喕喖喗喘喙喚喛喜å–喞喟喠喡喢喣喤喥喦喧喨喩喪喫喬喭單喯喰喱喲喳喴喵営喷喸喹喺喻喼喽喾喿嗀å—嗂嗃嗄嗅嗆嗇嗈嗉嗊嗋嗌å—å—Žå—å—嗑嗒嗓嗔嗕嗖嗗嗘嗙嗚嗛嗜å—嗞嗟嗠嗡嗢嗣嗤嗥嗦嗧嗨嗩嗪嗫嗬嗭嗮嗯嗰嗱嗲嗳嗴嗵嗶嗷嗸嗹嗺嗻嗼嗽嗾嗿嘀å˜å˜‚嘃嘄嘅嘆嘇嘈嘉嘊嘋嘌å˜å˜Žå˜å˜å˜‘嘒嘓嘔嘕嘖嘗嘘嘙嘚嘛嘜å˜å˜žå˜Ÿå˜ å˜¡å˜¢å˜£å˜¤å˜¥å˜¦å˜§å˜¨å˜©å˜ªå˜«å˜¬å˜­å˜®å˜¯å˜°å˜±å˜²å˜³å˜´å˜µå˜¶å˜·å˜¸å˜¹å˜ºå˜»å˜¼å˜½å˜¾å˜¿å™€å™å™‚噃噄噅噆噇噈噉噊噋噌å™å™Žå™å™å™‘噒噓噔噕噖噗噘噙噚噛噜å™å™žå™Ÿå™ å™¡å™¢å™£å™¤å™¥å™¦å™§å™¨å™©å™ªå™«å™¬å™­å™®å™¯å™°å™±å™²å™³å™´å™µå™¶å™·å™¸å™¹å™ºå™»å™¼å™½å™¾å™¿åš€åšåš‚嚃嚄嚅嚆嚇嚈嚉嚊嚋嚌åšåšŽåšåšåš‘嚒嚓嚔嚕嚖嚗嚘嚙嚚嚛嚜åšåšžåšŸåš åš¡åš¢åš£åš¤åš¥åš¦åš§åš¨åš©åšªåš«åš¬åš­åš®åš¯åš°åš±åš²åš³åš´åšµåš¶åš·åš¸åš¹åšºåš»åš¼åš½åš¾åš¿å›€å›å›‚囃囄囅囆囇囈囉囊囋囌å›å›Žå›å›å›‘囒囓囔囕囖囗囘囙囚四囜å›å›žå›Ÿå› å›¡å›¢å›£å›¤å›¥å›¦å›§å›¨å›©å›ªå›«å›¬å›­å›®å›¯å›°å›±å›²å›³å›´å›µå›¶å›·å›¸å›¹å›ºå›»å›¼å›½å›¾å›¿åœ€åœåœ‚圃圄圅圆圇圈圉圊國圌åœåœŽåœåœåœ‘園圓圔圕圖圗團圙圚圛圜åœåœžåœŸåœ åœ¡åœ¢åœ£åœ¤åœ¥åœ¦åœ§åœ¨åœ©åœªåœ«åœ¬åœ­åœ®åœ¯åœ°åœ±åœ²åœ³åœ´åœµåœ¶åœ·åœ¸åœ¹åœºåœ»åœ¼åœ½åœ¾åœ¿å€åå‚åƒå„å…å†å‡åˆå‰åŠå‹åŒååŽååå‘å’å“å”å•å–å—å˜å™åšå›åœååžåŸå å¡å¢å£å¤å¥å¦å§å¨å©åªå«å¬å­å®å¯å°å±å²å³å´åµå¶å·å¸å¹åºå»å¼å½å¾å¿åž€åžåž‚垃垄垅垆垇垈垉垊型垌åžåžŽåžåžåž‘垒垓垔垕垖垗垘垙垚垛垜åžåžžåžŸåž åž¡åž¢åž£åž¤åž¥åž¦åž§åž¨åž©åžªåž«åž¬åž­åž®åž¯åž°åž±åž²åž³åž´åžµåž¶åž·åž¸åž¹åžºåž»åž¼åž½åž¾åž¿åŸ€åŸåŸ‚埃埄埅埆埇埈埉埊埋埌åŸåŸŽåŸåŸåŸ‘埒埓埔埕埖埗埘埙埚埛埜åŸåŸžåŸŸåŸ åŸ¡åŸ¢åŸ£åŸ¤åŸ¥åŸ¦åŸ§åŸ¨åŸ©åŸªåŸ«åŸ¬åŸ­åŸ®åŸ¯åŸ°åŸ±åŸ²åŸ³åŸ´åŸµåŸ¶åŸ·åŸ¸åŸ¹åŸºåŸ»åŸ¼åŸ½åŸ¾åŸ¿å €å å ‚堃堄堅堆堇堈堉堊堋堌å å Žå å å ‘堒堓堔堕堖堗堘堙堚堛堜å å žå Ÿå  å ¡å ¢å £å ¤å ¥å ¦å §å ¨å ©å ªå «å ¬å ­å ®å ¯å °å ±å ²å ³å ´å µå ¶å ·å ¸å ¹å ºå »å ¼å ½å ¾å ¿å¡€å¡å¡‚塃塄塅塆塇塈塉塊塋塌å¡å¡Žå¡å¡å¡‘塒塓塔塕塖塗塘塙塚塛塜å¡å¡žå¡Ÿå¡ å¡¡å¡¢å¡£å¡¤å¡¥å¡¦å¡§å¡¨å¡©å¡ªå¡«å¡¬å¡­å¡®å¡¯å¡°å¡±å¡²å¡³å¡´å¡µå¡¶å¡·å¡¸å¡¹å¡ºå¡»å¡¼å¡½å¡¾å¡¿å¢€å¢å¢‚境墄墅墆墇墈墉墊墋墌å¢å¢Žå¢å¢å¢‘墒墓墔墕墖増墘墙墚墛墜å¢å¢žå¢Ÿå¢ å¢¡å¢¢å¢£å¢¤å¢¥å¢¦å¢§å¢¨å¢©å¢ªå¢«å¢¬å¢­å¢®å¢¯å¢°å¢±å¢²å¢³å¢´å¢µå¢¶å¢·å¢¸å¢¹å¢ºå¢»å¢¼å¢½å¢¾å¢¿å£€å£å£‚壃壄壅壆壇壈壉壊壋壌å£å£Žå£å£å£‘壒壓壔壕壖壗壘壙壚壛壜å£å£žå£Ÿå£ å£¡å£¢å££å£¤å£¥å£¦å£§å£¨å£©å£ªå£«å£¬å£­å£®å£¯å£°å£±å£²å£³å£´å£µå£¶å£·å£¸å£¹å£ºå£»å£¼å£½å£¾å£¿å¤€å¤å¤‚夃处夅夆备夈変夊夋夌å¤å¤Žå¤å¤å¤‘夒夓夔夕外夗夘夙多夛夜å¤å¤žå¤Ÿå¤ å¤¡å¤¢å¤£å¤¤å¤¥å¤¦å¤§å¤¨å¤©å¤ªå¤«å¤¬å¤­å¤®å¤¯å¤°å¤±å¤²å¤³å¤´å¤µå¤¶å¤·å¤¸å¤¹å¤ºå¤»å¤¼å¤½å¤¾å¤¿å¥€å¥å¥‚奃奄奅奆奇奈奉奊奋奌å¥å¥Žå¥å¥å¥‘奒奓奔奕奖套奘奙奚奛奜å¥å¥žå¥Ÿå¥ å¥¡å¥¢å¥£å¥¤å¥¥å¥¦å¥§å¥¨å¥©å¥ªå¥«å¥¬å¥­å¥®å¥¯å¥°å¥±å¥²å¥³å¥´å¥µå¥¶å¥·å¥¸å¥¹å¥ºå¥»å¥¼å¥½å¥¾å¥¿å¦€å¦å¦‚妃妄妅妆妇妈妉妊妋妌å¦å¦Žå¦å¦å¦‘妒妓妔妕妖妗妘妙妚妛妜å¦å¦žå¦Ÿå¦ å¦¡å¦¢å¦£å¦¤å¦¥å¦¦å¦§å¦¨å¦©å¦ªå¦«å¦¬å¦­å¦®å¦¯å¦°å¦±å¦²å¦³å¦´å¦µå¦¶å¦·å¦¸å¦¹å¦ºå¦»å¦¼å¦½å¦¾å¦¿å§€å§å§‚姃姄姅姆姇姈姉姊始姌å§å§Žå§å§å§‘姒姓委姕姖姗姘姙姚姛姜å§å§žå§Ÿå§ å§¡å§¢å§£å§¤å§¥å§¦å§§å§¨å§©å§ªå§«å§¬å§­å§®å§¯å§°å§±å§²å§³å§´å§µå§¶å§·å§¸å§¹å§ºå§»å§¼å§½å§¾å§¿å¨€å¨å¨‚娃娄娅娆娇娈娉娊娋娌å¨å¨Žå¨å¨å¨‘娒娓娔娕娖娗娘娙娚娛娜å¨å¨žå¨Ÿå¨ å¨¡å¨¢å¨£å¨¤å¨¥å¨¦å¨§å¨¨å¨©å¨ªå¨«å¨¬å¨­å¨®å¨¯å¨°å¨±å¨²å¨³å¨´å¨µå¨¶å¨·å¨¸å¨¹å¨ºå¨»å¨¼å¨½å¨¾å¨¿å©€å©å©‚婃婄婅婆婇婈婉婊婋婌å©å©Žå©å©å©‘婒婓婔婕婖婗婘婙婚婛婜å©å©žå©Ÿå© å©¡å©¢å©£å©¤å©¥å©¦å©§å©¨å©©å©ªå©«å©¬å©­å©®å©¯å©°å©±å©²å©³å©´å©µå©¶å©·å©¸å©¹å©ºå©»å©¼å©½å©¾å©¿åª€åªåª‚媃媄媅媆媇媈媉媊媋媌åªåªŽåªåªåª‘媒媓媔媕媖媗媘媙媚媛媜åªåªžåªŸåª åª¡åª¢åª£åª¤åª¥åª¦åª§åª¨åª©åªªåª«åª¬åª­åª®åª¯åª°åª±åª²åª³åª´åªµåª¶åª·åª¸åª¹åªºåª»åª¼åª½åª¾åª¿å«€å«å«‚嫃嫄嫅嫆嫇嫈嫉嫊嫋嫌å«å«Žå«å«å«‘嫒嫓嫔嫕嫖嫗嫘嫙嫚嫛嫜å«å«žå«Ÿå« å«¡å«¢å«£å«¤å«¥å«¦å«§å«¨å«©å«ªå««å«¬å«­å«®å«¯å«°å«±å«²å«³å«´å«µå«¶å«·å«¸å«¹å«ºå«»å«¼å«½å«¾å«¿å¬€å¬å¬‚嬃嬄嬅嬆嬇嬈嬉嬊嬋嬌å¬å¬Žå¬å¬å¬‘嬒嬓嬔嬕嬖嬗嬘嬙嬚嬛嬜å¬å¬žå¬Ÿå¬ å¬¡å¬¢å¬£å¬¤å¬¥å¬¦å¬§å¬¨å¬©å¬ªå¬«å¬¬å¬­å¬®å¬¯å¬°å¬±å¬²å¬³å¬´å¬µå¬¶å¬·å¬¸å¬¹å¬ºå¬»å¬¼å¬½å¬¾å¬¿å­€å­å­‚孃孄孅孆孇孈孉孊孋孌å­å­Žå­å­å­‘孒孓孔孕孖字存孙孚孛孜å­å­žå­Ÿå­ å­¡å­¢å­£å­¤å­¥å­¦å­§å­¨å­©å­ªå­«å­¬å­­å­®å­¯å­°å­±å­²å­³å­´å­µå­¶å­·å­¸å­¹å­ºå­»å­¼å­½å­¾å­¿å®€å®å®‚它宄宅宆宇守安宊宋完å®å®Žå®å®å®‘宒宓宔宕宖宗官宙定宛宜å®å®žå®Ÿå® å®¡å®¢å®£å®¤å®¥å®¦å®§å®¨å®©å®ªå®«å®¬å®­å®®å®¯å®°å®±å®²å®³å®´å®µå®¶å®·å®¸å®¹å®ºå®»å®¼å®½å®¾å®¿å¯€å¯å¯‚寃寄寅密寇寈寉寊寋富å¯å¯Žå¯å¯å¯‘寒寓寔寕寖寗寘寙寚寛寜å¯å¯žå¯Ÿå¯ å¯¡å¯¢å¯£å¯¤å¯¥å¯¦å¯§å¯¨å¯©å¯ªå¯«å¯¬å¯­å¯®å¯¯å¯°å¯±å¯²å¯³å¯´å¯µå¯¶å¯·å¯¸å¯¹å¯ºå¯»å¯¼å¯½å¯¾å¯¿å°€å°å°‚尃射尅将將專尉尊尋尌å°å°Žå°å°å°‘尒尓尔尕尖尗尘尙尚尛尜å°å°žå°Ÿå° å°¡å°¢å°£å°¤å°¥å°¦å°§å°¨å°©å°ªå°«å°¬å°­å°®å°¯å°°å°±å°²å°³å°´å°µå°¶å°·å°¸å°¹å°ºå°»å°¼å°½å°¾å°¿å±€å±å±‚屃屄居屆屇屈屉届屋屌å±å±Žå±å±å±‘屒屓屔展屖屗屘屙屚屛屜å±å±žå±Ÿå± å±¡å±¢å±£å±¤å±¥å±¦å±§å±¨å±©å±ªå±«å±¬å±­å±®å±¯å±°å±±å±²å±³å±´å±µå±¶å±·å±¸å±¹å±ºå±»å±¼å±½å±¾å±¿å²€å²å²‚岃岄岅岆岇岈岉岊岋岌å²å²Žå²å²å²‘岒岓岔岕岖岗岘岙岚岛岜å²å²žå²Ÿå² å²¡å²¢å²£å²¤å²¥å²¦å²§å²¨å²©å²ªå²«å²¬å²­å²®å²¯å²°å²±å²²å²³å²´å²µå²¶å²·å²¸å²¹å²ºå²»å²¼å²½å²¾å²¿å³€å³å³‚峃峄峅峆峇峈峉峊峋峌å³å³Žå³å³å³‘峒峓峔峕峖峗峘峙峚峛峜å³å³žå³Ÿå³ å³¡å³¢å³£å³¤å³¥å³¦å³§å³¨å³©å³ªå³«å³¬å³­å³®å³¯å³°å³±å³²å³³å³´å³µå³¶å³·å³¸å³¹å³ºå³»å³¼å³½å³¾å³¿å´€å´å´‚崃崄崅崆崇崈崉崊崋崌å´å´Žå´å´å´‘崒崓崔崕崖崗崘崙崚崛崜å´å´žå´Ÿå´ å´¡å´¢å´£å´¤å´¥å´¦å´§å´¨å´©å´ªå´«å´¬å´­å´®å´¯å´°å´±å´²å´³å´´å´µå´¶å´·å´¸å´¹å´ºå´»å´¼å´½å´¾å´¿åµ€åµåµ‚嵃嵄嵅嵆嵇嵈嵉嵊嵋嵌åµåµŽåµåµåµ‘嵒嵓嵔嵕嵖嵗嵘嵙嵚嵛嵜åµåµžåµŸåµ åµ¡åµ¢åµ£åµ¤åµ¥åµ¦åµ§åµ¨åµ©åµªåµ«åµ¬åµ­åµ®åµ¯åµ°åµ±åµ²åµ³åµ´åµµåµ¶åµ·åµ¸åµ¹åµºåµ»åµ¼åµ½åµ¾åµ¿å¶€å¶å¶‚嶃嶄嶅嶆嶇嶈嶉嶊嶋嶌å¶å¶Žå¶å¶å¶‘嶒嶓嶔嶕嶖嶗嶘嶙嶚嶛嶜å¶å¶žå¶Ÿå¶ å¶¡å¶¢å¶£å¶¤å¶¥å¶¦å¶§å¶¨å¶©å¶ªå¶«å¶¬å¶­å¶®å¶¯å¶°å¶±å¶²å¶³å¶´å¶µå¶¶å¶·å¶¸å¶¹å¶ºå¶»å¶¼å¶½å¶¾å¶¿å·€å·å·‚巃巄巅巆巇巈巉巊巋巌å·å·Žå·å·å·‘巒巓巔巕巖巗巘巙巚巛巜å·å·žå·Ÿå· å·¡å·¢å·£å·¤å·¥å·¦å·§å·¨å·©å·ªå·«å·¬å·­å·®å·¯å·°å·±å·²å·³å·´å·µå·¶å··å·¸å·¹å·ºå·»å·¼å·½å·¾å·¿å¸€å¸å¸‚布帄帅帆帇师帉帊帋希å¸å¸Žå¸å¸å¸‘帒帓帔帕帖帗帘帙帚帛帜å¸å¸žå¸Ÿå¸ å¸¡å¸¢å¸£å¸¤å¸¥å¸¦å¸§å¸¨å¸©å¸ªå¸«å¸¬å¸­å¸®å¸¯å¸°å¸±å¸²å¸³å¸´å¸µå¸¶å¸·å¸¸å¸¹å¸ºå¸»å¸¼å¸½å¸¾å¸¿å¹€å¹å¹‚幃幄幅幆幇幈幉幊幋幌å¹å¹Žå¹å¹å¹‘幒幓幔幕幖幗幘幙幚幛幜å¹å¹žå¹Ÿå¹ å¹¡å¹¢å¹£å¹¤å¹¥å¹¦å¹§å¹¨å¹©å¹ªå¹«å¹¬å¹­å¹®å¹¯å¹°å¹±å¹²å¹³å¹´å¹µå¹¶å¹·å¹¸å¹¹å¹ºå¹»å¹¼å¹½å¹¾å¹¿åº€åºåº‚広庄庅庆庇庈庉床庋庌åºåºŽåºåºåº‘庒库应底庖店庘庙庚庛府åºåºžåºŸåº åº¡åº¢åº£åº¤åº¥åº¦åº§åº¨åº©åºªåº«åº¬åº­åº®åº¯åº°åº±åº²åº³åº´åºµåº¶åº·åº¸åº¹åººåº»åº¼åº½åº¾åº¿å»€å»å»‚廃廄廅廆廇廈廉廊廋廌å»å»Žå»å»å»‘廒廓廔廕廖廗廘廙廚廛廜å»å»žå»Ÿå» å»¡å»¢å»£å»¤å»¥å»¦å»§å»¨å»©å»ªå»«å»¬å»­å»®å»¯å»°å»±å»²å»³å»´å»µå»¶å»·å»¸å»¹å»ºå»»å»¼å»½å»¾å»¿å¼€å¼å¼‚弃弄弅弆弇弈弉弊弋弌å¼å¼Žå¼å¼å¼‘弒弓弔引弖弗弘弙弚弛弜å¼å¼žå¼Ÿå¼ å¼¡å¼¢å¼£å¼¤å¼¥å¼¦å¼§å¼¨å¼©å¼ªå¼«å¼¬å¼­å¼®å¼¯å¼°å¼±å¼²å¼³å¼´å¼µå¼¶å¼·å¼¸å¼¹å¼ºå¼»å¼¼å¼½å¼¾å¼¿å½€å½å½‚彃彄彅彆彇彈彉彊彋彌å½å½Žå½å½å½‘归当彔录彖彗彘彙彚彛彜å½å½žå½Ÿå½ å½¡å½¢å½£å½¤å½¥å½¦å½§å½¨å½©å½ªå½«å½¬å½­å½®å½¯å½°å½±å½²å½³å½´å½µå½¶å½·å½¸å½¹å½ºå½»å½¼å½½å½¾å½¿å¾€å¾å¾‚徃径待徆徇很徉徊律後å¾å¾Žå¾å¾å¾‘徒従徔徕徖得徘徙徚徛徜å¾å¾žå¾Ÿå¾ å¾¡å¾¢å¾£å¾¤å¾¥å¾¦å¾§å¾¨å¾©å¾ªå¾«å¾¬å¾­å¾®å¾¯å¾°å¾±å¾²å¾³å¾´å¾µå¾¶å¾·å¾¸å¾¹å¾ºå¾»å¾¼å¾½å¾¾å¾¿å¿€å¿å¿‚心忄必忆忇忈忉忊忋忌å¿å¿Žå¿å¿å¿‘忒忓忔忕忖志忘忙忚忛応å¿å¿žå¿Ÿå¿ å¿¡å¿¢å¿£å¿¤å¿¥å¿¦å¿§å¿¨å¿©å¿ªå¿«å¿¬å¿­å¿®å¿¯å¿°å¿±å¿²å¿³å¿´å¿µå¿¶å¿·å¿¸å¿¹å¿ºå¿»å¿¼å¿½å¿¾å¿¿æ€€æ€æ€‚æ€ƒæ€„æ€…æ€†æ€‡æ€ˆæ€‰æ€Šæ€‹æ€Œæ€æ€Žæ€æ€æ€‘æ€’æ€“æ€”æ€•æ€–æ€—æ€˜æ€™æ€šæ€›æ€œæ€æ€žæ€Ÿæ€ æ€¡æ€¢æ€£æ€¤æ€¥æ€¦æ€§æ€¨æ€©æ€ªæ€«æ€¬æ€­æ€®æ€¯æ€°æ€±æ€²æ€³æ€´æ€µæ€¶æ€·æ€¸æ€¹æ€ºæ€»æ€¼æ€½æ€¾æ€¿æ€ææ‚æƒæ„æ…æ†æ‡æˆæ‰æŠæ‹æŒææŽæææ‘æ’æ“æ”æ•æ–æ—æ˜æ™æšæ›æœææžæŸæ æ¡æ¢æ£æ¤æ¥æ¦æ§æ¨æ©æªæ«æ¬æ­æ®æ¯æ°æ±æ²æ³æ´æµæ¶æ·æ¸æ¹æºæ»æ¼æ½æ¾æ¿æ‚€æ‚æ‚‚æ‚ƒæ‚„æ‚…æ‚†æ‚‡æ‚ˆæ‚‰æ‚Šæ‚‹æ‚Œæ‚æ‚Žæ‚æ‚æ‚‘æ‚’æ‚“æ‚”æ‚•æ‚–æ‚—æ‚˜æ‚™æ‚šæ‚›æ‚œæ‚æ‚žæ‚Ÿæ‚ æ‚¡æ‚¢æ‚£æ‚¤æ‚¥æ‚¦æ‚§æ‚¨æ‚©æ‚ªæ‚«æ‚¬æ‚­æ‚®æ‚¯æ‚°æ‚±æ‚²æ‚³æ‚´æ‚µæ‚¶æ‚·æ‚¸æ‚¹æ‚ºæ‚»æ‚¼æ‚½æ‚¾æ‚¿æƒ€æƒæƒ‚æƒƒæƒ„æƒ…æƒ†æƒ‡æƒˆæƒ‰æƒŠæƒ‹æƒŒæƒæƒŽæƒæƒæƒ‘æƒ’æƒ“æƒ”æƒ•æƒ–æƒ—æƒ˜æƒ™æƒšæƒ›æƒœæƒæƒžæƒŸæƒ æƒ¡æƒ¢æƒ£æƒ¤æƒ¥æƒ¦æƒ§æƒ¨æƒ©æƒªæƒ«æƒ¬æƒ­æƒ®æƒ¯æƒ°æƒ±æƒ²æƒ³æƒ´æƒµæƒ¶æƒ·æƒ¸æƒ¹æƒºæƒ»æƒ¼æƒ½æƒ¾æƒ¿æ„€æ„æ„‚æ„ƒæ„„æ„…æ„†æ„‡æ„ˆæ„‰æ„Šæ„‹æ„Œæ„æ„Žæ„æ„æ„‘æ„’æ„“æ„”æ„•æ„–æ„—æ„˜æ„™æ„šæ„›æ„œæ„æ„žæ„Ÿæ„ æ„¡æ„¢æ„£æ„¤æ„¥æ„¦æ„§æ„¨æ„©æ„ªæ„«æ„¬æ„­æ„®æ„¯æ„°æ„±æ„²æ„³æ„´æ„µæ„¶æ„·æ„¸æ„¹æ„ºæ„»æ„¼æ„½æ„¾æ„¿æ…€æ…æ…‚æ…ƒæ…„æ……æ…†æ…‡æ…ˆæ…‰æ…Šæ…‹æ…Œæ…æ…Žæ…æ…æ…‘æ…’æ…“æ…”æ…•æ…–æ…—æ…˜æ…™æ…šæ…›æ…œæ…æ…žæ…Ÿæ… æ…¡æ…¢æ…£æ…¤æ…¥æ…¦æ…§æ…¨æ…©æ…ªæ…«æ…¬æ…­æ…®æ…¯æ…°æ…±æ…²æ…³æ…´æ…µæ…¶æ…·æ…¸æ…¹æ…ºæ…»æ…¼æ…½æ…¾æ…¿æ†€æ†æ†‚æ†ƒæ†„æ†…æ††æ†‡æ†ˆæ†‰æ†Šæ†‹æ†Œæ†æ†Žæ†æ†æ†‘æ†’æ†“æ†”æ†•æ†–æ†—æ†˜æ†™æ†šæ†›æ†œæ†æ†žæ†Ÿæ† æ†¡æ†¢æ†£æ†¤æ†¥æ†¦æ†§æ†¨æ†©æ†ªæ†«æ†¬æ†­æ†®æ†¯æ†°æ†±æ†²æ†³æ†´æ†µæ†¶æ†·æ†¸æ†¹æ†ºæ†»æ†¼æ†½æ†¾æ†¿æ‡€æ‡æ‡‚æ‡ƒæ‡„æ‡…æ‡†æ‡‡æ‡ˆæ‡‰æ‡Šæ‡‹æ‡Œæ‡æ‡Žæ‡æ‡æ‡‘æ‡’æ‡“æ‡”æ‡•æ‡–æ‡—æ‡˜æ‡™æ‡šæ‡›æ‡œæ‡æ‡žæ‡Ÿæ‡ æ‡¡æ‡¢æ‡£æ‡¤æ‡¥æ‡¦æ‡§æ‡¨æ‡©æ‡ªæ‡«æ‡¬æ‡­æ‡®æ‡¯æ‡°æ‡±æ‡²æ‡³æ‡´æ‡µæ‡¶æ‡·æ‡¸æ‡¹æ‡ºæ‡»æ‡¼æ‡½æ‡¾æ‡¿æˆ€æˆæˆ‚æˆƒæˆ„æˆ…æˆ†æˆ‡æˆˆæˆ‰æˆŠæˆ‹æˆŒæˆæˆŽæˆæˆæˆ‘æˆ’æˆ“æˆ”æˆ•æˆ–æˆ—æˆ˜æˆ™æˆšæˆ›æˆœæˆæˆžæˆŸæˆ æˆ¡æˆ¢æˆ£æˆ¤æˆ¥æˆ¦æˆ§æˆ¨æˆ©æˆªæˆ«æˆ¬æˆ­æˆ®æˆ¯æˆ°æˆ±æˆ²æˆ³æˆ´æˆµæˆ¶æˆ·æˆ¸æˆ¹æˆºæˆ»æˆ¼æˆ½æˆ¾æˆ¿æ‰€æ‰æ‰‚æ‰ƒæ‰„æ‰…æ‰†æ‰‡æ‰ˆæ‰‰æ‰Šæ‰‹æ‰Œæ‰æ‰Žæ‰æ‰æ‰‘æ‰’æ‰“æ‰”æ‰•æ‰–æ‰—æ‰˜æ‰™æ‰šæ‰›æ‰œæ‰æ‰žæ‰Ÿæ‰ æ‰¡æ‰¢æ‰£æ‰¤æ‰¥æ‰¦æ‰§æ‰¨æ‰©æ‰ªæ‰«æ‰¬æ‰­æ‰®æ‰¯æ‰°æ‰±æ‰²æ‰³æ‰´æ‰µæ‰¶æ‰·æ‰¸æ‰¹æ‰ºæ‰»æ‰¼æ‰½æ‰¾æ‰¿æŠ€æŠæŠ‚æŠƒæŠ„æŠ…æŠ†æŠ‡æŠˆæŠ‰æŠŠæŠ‹æŠŒæŠæŠŽæŠæŠæŠ‘æŠ’æŠ“æŠ”æŠ•æŠ–æŠ—æŠ˜æŠ™æŠšæŠ›æŠœæŠæŠžæŠŸæŠ æŠ¡æŠ¢æŠ£æŠ¤æŠ¥æŠ¦æŠ§æŠ¨æŠ©æŠªæŠ«æŠ¬æŠ­æŠ®æŠ¯æŠ°æŠ±æŠ²æŠ³æŠ´æŠµæŠ¶æŠ·æŠ¸æŠ¹æŠºæŠ»æŠ¼æŠ½æŠ¾æŠ¿æ‹€æ‹æ‹‚æ‹ƒæ‹„æ‹…æ‹†æ‹‡æ‹ˆæ‹‰æ‹Šæ‹‹æ‹Œæ‹æ‹Žæ‹æ‹æ‹‘æ‹’æ‹“æ‹”æ‹•æ‹–æ‹—æ‹˜æ‹™æ‹šæ‹›æ‹œæ‹æ‹žæ‹Ÿæ‹ æ‹¡æ‹¢æ‹£æ‹¤æ‹¥æ‹¦æ‹§æ‹¨æ‹©æ‹ªæ‹«æ‹¬æ‹­æ‹®æ‹¯æ‹°æ‹±æ‹²æ‹³æ‹´æ‹µæ‹¶æ‹·æ‹¸æ‹¹æ‹ºæ‹»æ‹¼æ‹½æ‹¾æ‹¿æŒ€æŒæŒ‚æŒƒæŒ„æŒ…æŒ†æŒ‡æŒˆæŒ‰æŒŠæŒ‹æŒŒæŒæŒŽæŒæŒæŒ‘æŒ’æŒ“æŒ”æŒ•æŒ–æŒ—æŒ˜æŒ™æŒšæŒ›æŒœæŒæŒžæŒŸæŒ æŒ¡æŒ¢æŒ£æŒ¤æŒ¥æŒ¦æŒ§æŒ¨æŒ©æŒªæŒ«æŒ¬æŒ­æŒ®æŒ¯æŒ°æŒ±æŒ²æŒ³æŒ´æŒµæŒ¶æŒ·æŒ¸æŒ¹æŒºæŒ»æŒ¼æŒ½æŒ¾æŒ¿æ€ææ‚æƒæ„æ…æ†æ‡æˆæ‰æŠæ‹æŒææŽæææ‘æ’æ“æ”æ•æ–æ—æ˜æ™æšæ›æœææžæŸæ æ¡æ¢æ£æ¤æ¥æ¦æ§æ¨æ©æªæ«æ¬æ­æ®æ¯æ°æ±æ²æ³æ´æµæ¶æ·æ¸æ¹æºæ»æ¼æ½æ¾æ¿æŽ€æŽæŽ‚æŽƒæŽ„æŽ…æŽ†æŽ‡æŽˆæŽ‰æŽŠæŽ‹æŽŒæŽæŽŽæŽæŽæŽ‘æŽ’æŽ“æŽ”æŽ•æŽ–æŽ—æŽ˜æŽ™æŽšæŽ›æŽœæŽæŽžæŽŸæŽ æŽ¡æŽ¢æŽ£æŽ¤æŽ¥æŽ¦æŽ§æŽ¨æŽ©æŽªæŽ«æŽ¬æŽ­æŽ®æŽ¯æŽ°æŽ±æŽ²æŽ³æŽ´æŽµæŽ¶æŽ·æŽ¸æŽ¹æŽºæŽ»æŽ¼æŽ½æŽ¾æŽ¿æ€ææ‚æƒæ„æ…æ†æ‡æˆæ‰æŠæ‹æŒææŽæææ‘æ’æ“æ”æ•æ–æ—æ˜æ™æšæ›æœææžæŸæ æ¡æ¢æ£æ¤æ¥æ¦æ§æ¨æ©æªæ«æ¬æ­æ®æ¯æ°æ±æ²æ³æ´æµæ¶æ·æ¸æ¹æºæ»æ¼æ½æ¾æ¿æ€ææ‚æƒæ„æ…æ†æ‡æˆæ‰æŠæ‹æŒææŽæææ‘æ’æ“æ”æ•æ–æ—æ˜æ™æšæ›æœææžæŸæ æ¡æ¢æ£æ¤æ¥æ¦æ§æ¨æ©æªæ«æ¬æ­æ®æ¯æ°æ±æ²æ³æ´æµæ¶æ·æ¸æ¹æºæ»æ¼æ½æ¾æ¿æ‘€æ‘æ‘‚æ‘ƒæ‘„æ‘…æ‘†æ‘‡æ‘ˆæ‘‰æ‘Šæ‘‹æ‘Œæ‘æ‘Žæ‘æ‘æ‘‘æ‘’æ‘“æ‘”æ‘•æ‘–æ‘—æ‘˜æ‘™æ‘šæ‘›æ‘œæ‘æ‘žæ‘Ÿæ‘ æ‘¡æ‘¢æ‘£æ‘¤æ‘¥æ‘¦æ‘§æ‘¨æ‘©æ‘ªæ‘«æ‘¬æ‘­æ‘®æ‘¯æ‘°æ‘±æ‘²æ‘³æ‘´æ‘µæ‘¶æ‘·æ‘¸æ‘¹æ‘ºæ‘»æ‘¼æ‘½æ‘¾æ‘¿æ’€æ’æ’‚æ’ƒæ’„æ’…æ’†æ’‡æ’ˆæ’‰æ’Šæ’‹æ’Œæ’æ’Žæ’æ’æ’‘æ’’æ’“æ’”æ’•æ’–æ’—æ’˜æ’™æ’šæ’›æ’œæ’æ’žæ’Ÿæ’ æ’¡æ’¢æ’£æ’¤æ’¥æ’¦æ’§æ’¨æ’©æ’ªæ’«æ’¬æ’­æ’®æ’¯æ’°æ’±æ’²æ’³æ’´æ’µæ’¶æ’·æ’¸æ’¹æ’ºæ’»æ’¼æ’½æ’¾æ’¿æ“€æ“æ“‚æ“ƒæ“„æ“…æ“†æ“‡æ“ˆæ“‰æ“Šæ“‹æ“Œæ“æ“Žæ“æ“æ“‘æ“’æ““æ“”æ“•æ“–æ“—æ“˜æ“™æ“šæ“›æ“œæ“æ“žæ“Ÿæ“ æ“¡æ“¢æ“£æ“¤æ“¥æ“¦æ“§æ“¨æ“©æ“ªæ“«æ“¬æ“­æ“®æ“¯æ“°æ“±æ“²æ“³æ“´æ“µæ“¶æ“·æ“¸æ“¹æ“ºæ“»æ“¼æ“½æ“¾æ“¿æ”€æ”æ”‚æ”ƒæ”„æ”…æ”†æ”‡æ”ˆæ”‰æ”Šæ”‹æ”Œæ”æ”Žæ”æ”æ”‘æ”’æ”“æ””æ”•æ”–æ”—æ”˜æ”™æ”šæ”›æ”œæ”æ”žæ”Ÿæ” æ”¡æ”¢æ”£æ”¤æ”¥æ”¦æ”§æ”¨æ”©æ”ªæ”«æ”¬æ”­æ”®æ”¯æ”°æ”±æ”²æ”³æ”´æ”µæ”¶æ”·æ”¸æ”¹æ”ºæ”»æ”¼æ”½æ”¾æ”¿æ•€æ•æ•‚æ•ƒæ•„æ•…æ•†æ•‡æ•ˆæ•‰æ•Šæ•‹æ•Œæ•æ•Žæ•æ•æ•‘æ•’æ•“æ•”æ••æ•–æ•—æ•˜æ•™æ•šæ•›æ•œæ•æ•žæ•Ÿæ• æ•¡æ•¢æ•£æ•¤æ•¥æ•¦æ•§æ•¨æ•©æ•ªæ•«æ•¬æ•­æ•®æ•¯æ•°æ•±æ•²æ•³æ•´æ•µæ•¶æ•·æ•¸æ•¹æ•ºæ•»æ•¼æ•½æ•¾æ•¿æ–€æ–æ–‚æ–ƒæ–„æ–…æ–†æ–‡æ–ˆæ–‰æ–Šæ–‹æ–Œæ–æ–Žæ–æ–æ–‘æ–’æ–“æ–”æ–•æ––æ–—æ–˜æ–™æ–šæ–›æ–œæ–æ–žæ–Ÿæ– æ–¡æ–¢æ–£æ–¤æ–¥æ–¦æ–§æ–¨æ–©æ–ªæ–«æ–¬æ–­æ–®æ–¯æ–°æ–±æ–²æ–³æ–´æ–µæ–¶æ–·æ–¸æ–¹æ–ºæ–»æ–¼æ–½æ–¾æ–¿æ—€æ—æ—‚æ—ƒæ—„æ—…æ—†æ—‡æ—ˆæ—‰æ—Šæ—‹æ—Œæ—æ—Žæ—æ—æ—‘æ—’æ—“æ—”æ—•æ—–æ——æ—˜æ—™æ—šæ—›æ—œæ—æ—žæ—Ÿæ— æ—¡æ—¢æ—£æ—¤æ—¥æ—¦æ—§æ—¨æ—©æ—ªæ—«æ—¬æ—­æ—®æ—¯æ—°æ—±æ—²æ—³æ—´æ—µæ—¶æ—·æ—¸æ—¹æ—ºæ—»æ—¼æ—½æ—¾æ—¿æ˜€æ˜æ˜‚æ˜ƒæ˜„æ˜…æ˜†æ˜‡æ˜ˆæ˜‰æ˜Šæ˜‹æ˜Œæ˜æ˜Žæ˜æ˜æ˜‘æ˜’æ˜“æ˜”æ˜•æ˜–æ˜—æ˜˜æ˜™æ˜šæ˜›æ˜œæ˜æ˜žæ˜Ÿæ˜ æ˜¡æ˜¢æ˜£æ˜¤æ˜¥æ˜¦æ˜§æ˜¨æ˜©æ˜ªæ˜«æ˜¬æ˜­æ˜®æ˜¯æ˜°æ˜±æ˜²æ˜³æ˜´æ˜µæ˜¶æ˜·æ˜¸æ˜¹æ˜ºæ˜»æ˜¼æ˜½æ˜¾æ˜¿æ™€æ™æ™‚æ™ƒæ™„æ™…æ™†æ™‡æ™ˆæ™‰æ™Šæ™‹æ™Œæ™æ™Žæ™æ™æ™‘æ™’æ™“æ™”æ™•æ™–æ™—æ™˜æ™™æ™šæ™›æ™œæ™æ™žæ™Ÿæ™ æ™¡æ™¢æ™£æ™¤æ™¥æ™¦æ™§æ™¨æ™©æ™ªæ™«æ™¬æ™­æ™®æ™¯æ™°æ™±æ™²æ™³æ™´æ™µæ™¶æ™·æ™¸æ™¹æ™ºæ™»æ™¼æ™½æ™¾æ™¿æš€æšæš‚æšƒæš„æš…æš†æš‡æšˆæš‰æšŠæš‹æšŒæšæšŽæšæšæš‘æš’æš“æš”æš•æš–æš—æš˜æš™æššæš›æšœæšæšžæšŸæš æš¡æš¢æš£æš¤æš¥æš¦æš§æš¨æš©æšªæš«æš¬æš­æš®æš¯æš°æš±æš²æš³æš´æšµæš¶æš·æš¸æš¹æšºæš»æš¼æš½æš¾æš¿æ›€æ›æ›‚æ›ƒæ›„æ›…æ›†æ›‡æ›ˆæ›‰æ›Šæ›‹æ›Œæ›æ›Žæ›æ›æ›‘æ›’æ›“æ›”æ›•æ›–æ›—æ›˜æ›™æ›šæ››æ›œæ›æ›žæ›Ÿæ› æ›¡æ›¢æ›£æ›¤æ›¥æ›¦æ›§æ›¨æ›©æ›ªæ›«æ›¬æ›­æ›®æ›¯æ›°æ›±æ›²æ›³æ›´æ›µæ›¶æ›·æ›¸æ›¹æ›ºæ›»æ›¼æ›½æ›¾æ›¿æœ€æœæœ‚æœƒæœ„æœ…æœ†æœ‡æœˆæœ‰æœŠæœ‹æœŒæœæœŽæœæœæœ‘æœ’æœ“æœ”æœ•æœ–æœ—æœ˜æœ™æœšæœ›æœœæœæœžæœŸæœ æœ¡æœ¢æœ£æœ¤æœ¥æœ¦æœ§æœ¨æœ©æœªæœ«æœ¬æœ­æœ®æœ¯æœ°æœ±æœ²æœ³æœ´æœµæœ¶æœ·æœ¸æœ¹æœºæœ»æœ¼æœ½æœ¾æœ¿æ€ææ‚æƒæ„æ…æ†æ‡æˆæ‰æŠæ‹æŒææŽæææ‘æ’æ“æ”æ•æ–æ—æ˜æ™æšæ›æœææžæŸæ æ¡æ¢æ£æ¤æ¥æ¦æ§æ¨æ©æªæ«æ¬æ­æ®æ¯æ°æ±æ²æ³æ´æµæ¶æ·æ¸æ¹æºæ»æ¼æ½æ¾æ¿æž€æžæž‚æžƒæž„æž…æž†æž‡æžˆæž‰æžŠæž‹æžŒæžæžŽæžæžæž‘æž’æž“æž”æž•æž–æž—æž˜æž™æžšæž›æžœæžæžžæžŸæž æž¡æž¢æž£æž¤æž¥æž¦æž§æž¨æž©æžªæž«æž¬æž­æž®æž¯æž°æž±æž²æž³æž´æžµæž¶æž·æž¸æž¹æžºæž»æž¼æž½æž¾æž¿æŸ€æŸæŸ‚æŸƒæŸ„æŸ…æŸ†æŸ‡æŸˆæŸ‰æŸŠæŸ‹æŸŒæŸæŸŽæŸæŸæŸ‘æŸ’æŸ“æŸ”æŸ•æŸ–æŸ—æŸ˜æŸ™æŸšæŸ›æŸœæŸæŸžæŸŸæŸ æŸ¡æŸ¢æŸ£æŸ¤æŸ¥æŸ¦æŸ§æŸ¨æŸ©æŸªæŸ«æŸ¬æŸ­æŸ®æŸ¯æŸ°æŸ±æŸ²æŸ³æŸ´æŸµæŸ¶æŸ·æŸ¸æŸ¹æŸºæŸ»æŸ¼æŸ½æŸ¾æŸ¿æ €æ æ ‚æ ƒæ „æ …æ †æ ‡æ ˆæ ‰æ Šæ ‹æ Œæ æ Žæ æ æ ‘æ ’æ “æ ”æ •æ –æ —æ ˜æ ™æ šæ ›æ œæ æ žæ Ÿæ  æ ¡æ ¢æ £æ ¤æ ¥æ ¦æ §æ ¨æ ©æ ªæ «æ ¬æ ­æ ®æ ¯æ °æ ±æ ²æ ³æ ´æ µæ ¶æ ·æ ¸æ ¹æ ºæ »æ ¼æ ½æ ¾æ ¿æ¡€æ¡æ¡‚æ¡ƒæ¡„æ¡…æ¡†æ¡‡æ¡ˆæ¡‰æ¡Šæ¡‹æ¡Œæ¡æ¡Žæ¡æ¡æ¡‘æ¡’æ¡“æ¡”æ¡•æ¡–æ¡—æ¡˜æ¡™æ¡šæ¡›æ¡œæ¡æ¡žæ¡Ÿæ¡ æ¡¡æ¡¢æ¡£æ¡¤æ¡¥æ¡¦æ¡§æ¡¨æ¡©æ¡ªæ¡«æ¡¬æ¡­æ¡®æ¡¯æ¡°æ¡±æ¡²æ¡³æ¡´æ¡µæ¡¶æ¡·æ¡¸æ¡¹æ¡ºæ¡»æ¡¼æ¡½æ¡¾æ¡¿æ¢€æ¢æ¢‚æ¢ƒæ¢„æ¢…æ¢†æ¢‡æ¢ˆæ¢‰æ¢Šæ¢‹æ¢Œæ¢æ¢Žæ¢æ¢æ¢‘æ¢’æ¢“æ¢”æ¢•æ¢–æ¢—æ¢˜æ¢™æ¢šæ¢›æ¢œæ¢æ¢žæ¢Ÿæ¢ æ¢¡æ¢¢æ¢£æ¢¤æ¢¥æ¢¦æ¢§æ¢¨æ¢©æ¢ªæ¢«æ¢¬æ¢­æ¢®æ¢¯æ¢°æ¢±æ¢²æ¢³æ¢´æ¢µæ¢¶æ¢·æ¢¸æ¢¹æ¢ºæ¢»æ¢¼æ¢½æ¢¾æ¢¿æ£€æ£æ£‚æ£ƒæ£„æ£…æ£†æ£‡æ£ˆæ£‰æ£Šæ£‹æ£Œæ£æ£Žæ£æ£æ£‘æ£’æ£“æ£”æ£•æ£–æ£—æ£˜æ£™æ£šæ£›æ£œæ£æ£žæ£Ÿæ£ æ£¡æ£¢æ££æ£¤æ£¥æ£¦æ£§æ£¨æ£©æ£ªæ£«æ£¬æ£­æ£®æ£¯æ£°æ£±æ£²æ£³æ£´æ£µæ£¶æ£·æ£¸æ£¹æ£ºæ£»æ£¼æ£½æ£¾æ£¿æ¤€æ¤æ¤‚æ¤ƒæ¤„æ¤…æ¤†æ¤‡æ¤ˆæ¤‰æ¤Šæ¤‹æ¤Œæ¤æ¤Žæ¤æ¤æ¤‘æ¤’æ¤“æ¤”æ¤•æ¤–æ¤—æ¤˜æ¤™æ¤šæ¤›æ¤œæ¤æ¤žæ¤Ÿæ¤ æ¤¡æ¤¢æ¤£æ¤¤æ¤¥æ¤¦æ¤§æ¤¨æ¤©æ¤ªæ¤«æ¤¬æ¤­æ¤®æ¤¯æ¤°æ¤±æ¤²æ¤³æ¤´æ¤µæ¤¶æ¤·æ¤¸æ¤¹æ¤ºæ¤»æ¤¼æ¤½æ¤¾æ¤¿æ¥€æ¥æ¥‚æ¥ƒæ¥„æ¥…æ¥†æ¥‡æ¥ˆæ¥‰æ¥Šæ¥‹æ¥Œæ¥æ¥Žæ¥æ¥æ¥‘æ¥’æ¥“æ¥”æ¥•æ¥–æ¥—æ¥˜æ¥™æ¥šæ¥›æ¥œæ¥æ¥žæ¥Ÿæ¥ æ¥¡æ¥¢æ¥£æ¥¤æ¥¥æ¥¦æ¥§æ¥¨æ¥©æ¥ªæ¥«æ¥¬æ¥­æ¥®æ¥¯æ¥°æ¥±æ¥²æ¥³æ¥´æ¥µæ¥¶æ¥·æ¥¸æ¥¹æ¥ºæ¥»æ¥¼æ¥½æ¥¾æ¥¿æ¦€æ¦æ¦‚æ¦ƒæ¦„æ¦…æ¦†æ¦‡æ¦ˆæ¦‰æ¦Šæ¦‹æ¦Œæ¦æ¦Žæ¦æ¦æ¦‘æ¦’æ¦“æ¦”æ¦•æ¦–æ¦—æ¦˜æ¦™æ¦šæ¦›æ¦œæ¦æ¦žæ¦Ÿæ¦ æ¦¡æ¦¢æ¦£æ¦¤æ¦¥æ¦¦æ¦§æ¦¨æ¦©æ¦ªæ¦«æ¦¬æ¦­æ¦®æ¦¯æ¦°æ¦±æ¦²æ¦³æ¦´æ¦µæ¦¶æ¦·æ¦¸æ¦¹æ¦ºæ¦»æ¦¼æ¦½æ¦¾æ¦¿æ§€æ§æ§‚æ§ƒæ§„æ§…æ§†æ§‡æ§ˆæ§‰æ§Šæ§‹æ§Œæ§æ§Žæ§æ§æ§‘æ§’æ§“æ§”æ§•æ§–æ§—æ§˜æ§™æ§šæ§›æ§œæ§æ§žæ§Ÿæ§ æ§¡æ§¢æ§£æ§¤æ§¥æ§¦æ§§æ§¨æ§©æ§ªæ§«æ§¬æ§­æ§®æ§¯æ§°æ§±æ§²æ§³æ§´æ§µæ§¶æ§·æ§¸æ§¹æ§ºæ§»æ§¼æ§½æ§¾æ§¿æ¨€æ¨æ¨‚æ¨ƒæ¨„æ¨…æ¨†æ¨‡æ¨ˆæ¨‰æ¨Šæ¨‹æ¨Œæ¨æ¨Žæ¨æ¨æ¨‘æ¨’æ¨“æ¨”æ¨•æ¨–æ¨—æ¨˜æ¨™æ¨šæ¨›æ¨œæ¨æ¨žæ¨Ÿæ¨ æ¨¡æ¨¢æ¨£æ¨¤æ¨¥æ¨¦æ¨§æ¨¨æ¨©æ¨ªæ¨«æ¨¬æ¨­æ¨®æ¨¯æ¨°æ¨±æ¨²æ¨³æ¨´æ¨µæ¨¶æ¨·æ¨¸æ¨¹æ¨ºæ¨»æ¨¼æ¨½æ¨¾æ¨¿æ©€æ©æ©‚æ©ƒæ©„æ©…æ©†æ©‡æ©ˆæ©‰æ©Šæ©‹æ©Œæ©æ©Žæ©æ©æ©‘æ©’æ©“æ©”æ©•æ©–æ©—æ©˜æ©™æ©šæ©›æ©œæ©æ©žæ©Ÿæ© æ©¡æ©¢æ©£æ©¤æ©¥æ©¦æ©§æ©¨æ©©æ©ªæ©«æ©¬æ©­æ©®æ©¯æ©°æ©±æ©²æ©³æ©´æ©µæ©¶æ©·æ©¸æ©¹æ©ºæ©»æ©¼æ©½æ©¾æ©¿æª€æªæª‚æªƒæª„æª…æª†æª‡æªˆæª‰æªŠæª‹æªŒæªæªŽæªæªæª‘æª’æª“æª”æª•æª–æª—æª˜æª™æªšæª›æªœæªæªžæªŸæª æª¡æª¢æª£æª¤æª¥æª¦æª§æª¨æª©æªªæª«æª¬æª­æª®æª¯æª°æª±æª²æª³æª´æªµæª¶æª·æª¸æª¹æªºæª»æª¼æª½æª¾æª¿æ«€æ«æ«‚æ«ƒæ«„æ«…æ«†æ«‡æ«ˆæ«‰æ«Šæ«‹æ«Œæ«æ«Žæ«æ«æ«‘æ«’æ«“æ«”æ«•æ«–æ«—æ«˜æ«™æ«šæ«›æ«œæ«æ«žæ«Ÿæ« æ«¡æ«¢æ«£æ«¤æ«¥æ«¦æ«§æ«¨æ«©æ«ªæ««æ«¬æ«­æ«®æ«¯æ«°æ«±æ«²æ«³æ«´æ«µæ«¶æ«·æ«¸æ«¹æ«ºæ«»æ«¼æ«½æ«¾æ«¿æ¬€æ¬æ¬‚æ¬ƒæ¬„æ¬…æ¬†æ¬‡æ¬ˆæ¬‰æ¬Šæ¬‹æ¬Œæ¬æ¬Žæ¬æ¬æ¬‘æ¬’æ¬“æ¬”æ¬•æ¬–æ¬—æ¬˜æ¬™æ¬šæ¬›æ¬œæ¬æ¬žæ¬Ÿæ¬ æ¬¡æ¬¢æ¬£æ¬¤æ¬¥æ¬¦æ¬§æ¬¨æ¬©æ¬ªæ¬«æ¬¬æ¬­æ¬®æ¬¯æ¬°æ¬±æ¬²æ¬³æ¬´æ¬µæ¬¶æ¬·æ¬¸æ¬¹æ¬ºæ¬»æ¬¼æ¬½æ¬¾æ¬¿æ­€æ­æ­‚æ­ƒæ­„æ­…æ­†æ­‡æ­ˆæ­‰æ­Šæ­‹æ­Œæ­æ­Žæ­æ­æ­‘æ­’æ­“æ­”æ­•æ­–æ­—æ­˜æ­™æ­šæ­›æ­œæ­æ­žæ­Ÿæ­ æ­¡æ­¢æ­£æ­¤æ­¥æ­¦æ­§æ­¨æ­©æ­ªæ­«æ­¬æ­­æ­®æ­¯æ­°æ­±æ­²æ­³æ­´æ­µæ­¶æ­·æ­¸æ­¹æ­ºæ­»æ­¼æ­½æ­¾æ­¿æ®€æ®æ®‚æ®ƒæ®„æ®…æ®†æ®‡æ®ˆæ®‰æ®Šæ®‹æ®Œæ®æ®Žæ®æ®æ®‘æ®’æ®“æ®”æ®•æ®–æ®—æ®˜æ®™æ®šæ®›æ®œæ®æ®žæ®Ÿæ® æ®¡æ®¢æ®£æ®¤æ®¥æ®¦æ®§æ®¨æ®©æ®ªæ®«æ®¬æ®­æ®®æ®¯æ®°æ®±æ®²æ®³æ®´æ®µæ®¶æ®·æ®¸æ®¹æ®ºæ®»æ®¼æ®½æ®¾æ®¿æ¯€æ¯æ¯‚æ¯ƒæ¯„æ¯…æ¯†æ¯‡æ¯ˆæ¯‰æ¯Šæ¯‹æ¯Œæ¯æ¯Žæ¯æ¯æ¯‘æ¯’æ¯“æ¯”æ¯•æ¯–æ¯—æ¯˜æ¯™æ¯šæ¯›æ¯œæ¯æ¯žæ¯Ÿæ¯ æ¯¡æ¯¢æ¯£æ¯¤æ¯¥æ¯¦æ¯§æ¯¨æ¯©æ¯ªæ¯«æ¯¬æ¯­æ¯®æ¯¯æ¯°æ¯±æ¯²æ¯³æ¯´æ¯µæ¯¶æ¯·æ¯¸æ¯¹æ¯ºæ¯»æ¯¼æ¯½æ¯¾æ¯¿æ°€æ°æ°‚æ°ƒæ°„æ°…æ°†æ°‡æ°ˆæ°‰æ°Šæ°‹æ°Œæ°æ°Žæ°æ°æ°‘æ°’æ°“æ°”æ°•æ°–æ°—æ°˜æ°™æ°šæ°›æ°œæ°æ°žæ°Ÿæ° æ°¡æ°¢æ°£æ°¤æ°¥æ°¦æ°§æ°¨æ°©æ°ªæ°«æ°¬æ°­æ°®æ°¯æ°°æ°±æ°²æ°³æ°´æ°µæ°¶æ°·æ°¸æ°¹æ°ºæ°»æ°¼æ°½æ°¾æ°¿æ±€æ±æ±‚æ±ƒæ±„æ±…æ±†æ±‡æ±ˆæ±‰æ±Šæ±‹æ±Œæ±æ±Žæ±æ±æ±‘æ±’æ±“æ±”æ±•æ±–æ±—æ±˜æ±™æ±šæ±›æ±œæ±æ±žæ±Ÿæ± æ±¡æ±¢æ±£æ±¤æ±¥æ±¦æ±§æ±¨æ±©æ±ªæ±«æ±¬æ±­æ±®æ±¯æ±°æ±±æ±²æ±³æ±´æ±µæ±¶æ±·æ±¸æ±¹æ±ºæ±»æ±¼æ±½æ±¾æ±¿æ²€æ²æ²‚æ²ƒæ²„æ²…æ²†æ²‡æ²ˆæ²‰æ²Šæ²‹æ²Œæ²æ²Žæ²æ²æ²‘æ²’æ²“æ²”æ²•æ²–æ²—æ²˜æ²™æ²šæ²›æ²œæ²æ²žæ²Ÿæ² æ²¡æ²¢æ²£æ²¤æ²¥æ²¦æ²§æ²¨æ²©æ²ªæ²«æ²¬æ²­æ²®æ²¯æ²°æ²±æ²²æ²³æ²´æ²µæ²¶æ²·æ²¸æ²¹æ²ºæ²»æ²¼æ²½æ²¾æ²¿æ³€æ³æ³‚æ³ƒæ³„æ³…æ³†æ³‡æ³ˆæ³‰æ³Šæ³‹æ³Œæ³æ³Žæ³æ³æ³‘æ³’æ³“æ³”æ³•æ³–æ³—æ³˜æ³™æ³šæ³›æ³œæ³æ³žæ³Ÿæ³ æ³¡æ³¢æ³£æ³¤æ³¥æ³¦æ³§æ³¨æ³©æ³ªæ³«æ³¬æ³­æ³®æ³¯æ³°æ³±æ³²æ³³æ³´æ³µæ³¶æ³·æ³¸æ³¹æ³ºæ³»æ³¼æ³½æ³¾æ³¿æ´€æ´æ´‚æ´ƒæ´„æ´…æ´†æ´‡æ´ˆæ´‰æ´Šæ´‹æ´Œæ´æ´Žæ´æ´æ´‘æ´’æ´“æ´”æ´•æ´–æ´—æ´˜æ´™æ´šæ´›æ´œæ´æ´žæ´Ÿæ´ æ´¡æ´¢æ´£æ´¤æ´¥æ´¦æ´§æ´¨æ´©æ´ªæ´«æ´¬æ´­æ´®æ´¯æ´°æ´±æ´²æ´³æ´´æ´µæ´¶æ´·æ´¸æ´¹æ´ºæ´»æ´¼æ´½æ´¾æ´¿æµ€æµæµ‚æµƒæµ„æµ…æµ†æµ‡æµˆæµ‰æµŠæµ‹æµŒæµæµŽæµæµæµ‘æµ’æµ“æµ”æµ•æµ–æµ—æµ˜æµ™æµšæµ›æµœæµæµžæµŸæµ æµ¡æµ¢æµ£æµ¤æµ¥æµ¦æµ§æµ¨æµ©æµªæµ«æµ¬æµ­æµ®æµ¯æµ°æµ±æµ²æµ³æµ´æµµæµ¶æµ·æµ¸æµ¹æµºæµ»æµ¼æµ½æµ¾æµ¿æ¶€æ¶æ¶‚æ¶ƒæ¶„æ¶…æ¶†æ¶‡æ¶ˆæ¶‰æ¶Šæ¶‹æ¶Œæ¶æ¶Žæ¶æ¶æ¶‘æ¶’æ¶“æ¶”æ¶•æ¶–æ¶—æ¶˜æ¶™æ¶šæ¶›æ¶œæ¶æ¶žæ¶Ÿæ¶ æ¶¡æ¶¢æ¶£æ¶¤æ¶¥æ¶¦æ¶§æ¶¨æ¶©æ¶ªæ¶«æ¶¬æ¶­æ¶®æ¶¯æ¶°æ¶±æ¶²æ¶³æ¶´æ¶µæ¶¶æ¶·æ¶¸æ¶¹æ¶ºæ¶»æ¶¼æ¶½æ¶¾æ¶¿æ·€æ·æ·‚æ·ƒæ·„æ·…æ·†æ·‡æ·ˆæ·‰æ·Šæ·‹æ·Œæ·æ·Žæ·æ·æ·‘æ·’æ·“æ·”æ·•æ·–æ·—æ·˜æ·™æ·šæ·›æ·œæ·æ·žæ·Ÿæ· æ·¡æ·¢æ·£æ·¤æ·¥æ·¦æ·§æ·¨æ·©æ·ªæ·«æ·¬æ·­æ·®æ·¯æ·°æ·±æ·²æ·³æ·´æ·µæ·¶æ··æ·¸æ·¹æ·ºæ·»æ·¼æ·½æ·¾æ·¿æ¸€æ¸æ¸‚æ¸ƒæ¸„æ¸…æ¸†æ¸‡æ¸ˆæ¸‰æ¸Šæ¸‹æ¸Œæ¸æ¸Žæ¸æ¸æ¸‘æ¸’æ¸“æ¸”æ¸•æ¸–æ¸—æ¸˜æ¸™æ¸šæ¸›æ¸œæ¸æ¸žæ¸Ÿæ¸ æ¸¡æ¸¢æ¸£æ¸¤æ¸¥æ¸¦æ¸§æ¸¨æ¸©æ¸ªæ¸«æ¸¬æ¸­æ¸®æ¸¯æ¸°æ¸±æ¸²æ¸³æ¸´æ¸µæ¸¶æ¸·æ¸¸æ¸¹æ¸ºæ¸»æ¸¼æ¸½æ¸¾æ¸¿æ¹€æ¹æ¹‚æ¹ƒæ¹„æ¹…æ¹†æ¹‡æ¹ˆæ¹‰æ¹Šæ¹‹æ¹Œæ¹æ¹Žæ¹æ¹æ¹‘æ¹’æ¹“æ¹”æ¹•æ¹–æ¹—æ¹˜æ¹™æ¹šæ¹›æ¹œæ¹æ¹žæ¹Ÿæ¹ æ¹¡æ¹¢æ¹£æ¹¤æ¹¥æ¹¦æ¹§æ¹¨æ¹©æ¹ªæ¹«æ¹¬æ¹­æ¹®æ¹¯æ¹°æ¹±æ¹²æ¹³æ¹´æ¹µæ¹¶æ¹·æ¹¸æ¹¹æ¹ºæ¹»æ¹¼æ¹½æ¹¾æ¹¿æº€æºæº‚æºƒæº„æº…æº†æº‡æºˆæº‰æºŠæº‹æºŒæºæºŽæºæºæº‘æº’æº“æº”æº•æº–æº—æº˜æº™æºšæº›æºœæºæºžæºŸæº æº¡æº¢æº£æº¤æº¥æº¦æº§æº¨æº©æºªæº«æº¬æº­æº®æº¯æº°æº±æº²æº³æº´æºµæº¶æº·æº¸æº¹æººæº»æº¼æº½æº¾æº¿æ»€æ»æ»‚æ»ƒæ»„æ»…æ»†æ»‡æ»ˆæ»‰æ»Šæ»‹æ»Œæ»æ»Žæ»æ»æ»‘æ»’æ»“æ»”æ»•æ»–æ»—æ»˜æ»™æ»šæ»›æ»œæ»æ»žæ»Ÿæ» æ»¡æ»¢æ»£æ»¤æ»¥æ»¦æ»§æ»¨æ»©æ»ªæ»«æ»¬æ»­æ»®æ»¯æ»°æ»±æ»²æ»³æ»´æ»µæ»¶æ»·æ»¸æ»¹æ»ºæ»»æ»¼æ»½æ»¾æ»¿æ¼€æ¼æ¼‚æ¼ƒæ¼„æ¼…æ¼†æ¼‡æ¼ˆæ¼‰æ¼Šæ¼‹æ¼Œæ¼æ¼Žæ¼æ¼æ¼‘æ¼’æ¼“æ¼”æ¼•æ¼–æ¼—æ¼˜æ¼™æ¼šæ¼›æ¼œæ¼æ¼žæ¼Ÿæ¼ æ¼¡æ¼¢æ¼£æ¼¤æ¼¥æ¼¦æ¼§æ¼¨æ¼©æ¼ªæ¼«æ¼¬æ¼­æ¼®æ¼¯æ¼°æ¼±æ¼²æ¼³æ¼´æ¼µæ¼¶æ¼·æ¼¸æ¼¹æ¼ºæ¼»æ¼¼æ¼½æ¼¾æ¼¿æ½€æ½æ½‚æ½ƒæ½„æ½…æ½†æ½‡æ½ˆæ½‰æ½Šæ½‹æ½Œæ½æ½Žæ½æ½æ½‘æ½’æ½“æ½”æ½•æ½–æ½—æ½˜æ½™æ½šæ½›æ½œæ½æ½žæ½Ÿæ½ æ½¡æ½¢æ½£æ½¤æ½¥æ½¦æ½§æ½¨æ½©æ½ªæ½«æ½¬æ½­æ½®æ½¯æ½°æ½±æ½²æ½³æ½´æ½µæ½¶æ½·æ½¸æ½¹æ½ºæ½»æ½¼æ½½æ½¾æ½¿æ¾€æ¾æ¾‚æ¾ƒæ¾„æ¾…æ¾†æ¾‡æ¾ˆæ¾‰æ¾Šæ¾‹æ¾Œæ¾æ¾Žæ¾æ¾æ¾‘æ¾’æ¾“æ¾”æ¾•æ¾–æ¾—æ¾˜æ¾™æ¾šæ¾›æ¾œæ¾æ¾žæ¾Ÿæ¾ æ¾¡æ¾¢æ¾£æ¾¤æ¾¥æ¾¦æ¾§æ¾¨æ¾©æ¾ªæ¾«æ¾¬æ¾­æ¾®æ¾¯æ¾°æ¾±æ¾²æ¾³æ¾´æ¾µæ¾¶æ¾·æ¾¸æ¾¹æ¾ºæ¾»æ¾¼æ¾½æ¾¾æ¾¿æ¿€æ¿æ¿‚æ¿ƒæ¿„æ¿…æ¿†æ¿‡æ¿ˆæ¿‰æ¿Šæ¿‹æ¿Œæ¿æ¿Žæ¿æ¿æ¿‘æ¿’æ¿“æ¿”æ¿•æ¿–æ¿—æ¿˜æ¿™æ¿šæ¿›æ¿œæ¿æ¿žæ¿Ÿæ¿ æ¿¡æ¿¢æ¿£æ¿¤æ¿¥æ¿¦æ¿§æ¿¨æ¿©æ¿ªæ¿«æ¿¬æ¿­æ¿®æ¿¯æ¿°æ¿±æ¿²æ¿³æ¿´æ¿µæ¿¶æ¿·æ¿¸æ¿¹æ¿ºæ¿»æ¿¼æ¿½æ¿¾æ¿¿ç€€ç€ç€‚瀃瀄瀅瀆瀇瀈瀉瀊瀋瀌ç€ç€Žç€ç€ç€‘瀒瀓瀔瀕瀖瀗瀘瀙瀚瀛瀜ç€ç€žç€Ÿç€ ç€¡ç€¢ç€£ç€¤ç€¥ç€¦ç€§ç€¨ç€©ç€ªç€«ç€¬ç€­ç€®ç€¯ç€°ç€±ç€²ç€³ç€´ç€µç€¶ç€·ç€¸ç€¹ç€ºç€»ç€¼ç€½ç€¾ç€¿ç€çç‚çƒç„ç…ç†ç‡çˆç‰çŠç‹çŒççŽççç‘ç’ç“ç”ç•ç–ç—ç˜ç™çšç›çœççžçŸç ç¡ç¢ç£ç¤ç¥ç¦ç§ç¨ç©çªç«ç¬ç­ç®ç¯ç°ç±ç²ç³ç´çµç¶ç·ç¸ç¹çºç»ç¼ç½ç¾ç¿ç‚€ç‚炂炃炄炅炆炇炈炉炊炋炌ç‚炎ç‚ç‚炑炒炓炔炕炖炗炘炙炚炛炜ç‚炞炟炠炡炢炣炤炥炦炧炨炩炪炫炬炭炮炯炰炱炲炳炴炵炶炷炸点為炻炼炽炾炿烀çƒçƒ‚烃烄烅烆烇烈烉烊烋烌çƒçƒŽçƒçƒçƒ‘烒烓烔烕烖烗烘烙烚烛烜çƒçƒžçƒŸçƒ çƒ¡çƒ¢çƒ£çƒ¤çƒ¥çƒ¦çƒ§çƒ¨çƒ©çƒªçƒ«çƒ¬çƒ­çƒ®çƒ¯çƒ°çƒ±çƒ²çƒ³çƒ´çƒµçƒ¶çƒ·çƒ¸çƒ¹çƒºçƒ»çƒ¼çƒ½çƒ¾çƒ¿ç„€ç„焂焃焄焅焆焇焈焉焊焋焌ç„焎ç„ç„焑焒焓焔焕焖焗焘焙焚焛焜ç„焞焟焠無焢焣焤焥焦焧焨焩焪焫焬焭焮焯焰焱焲焳焴焵然焷焸焹焺焻焼焽焾焿煀ç…煂煃煄煅煆煇煈煉煊煋煌ç…ç…Žç…ç…煑煒煓煔煕煖煗煘煙煚煛煜ç…煞煟煠煡煢煣煤煥煦照煨煩煪煫煬煭煮煯煰煱煲煳煴煵煶煷煸煹煺煻煼煽煾煿熀ç†ç†‚熃熄熅熆熇熈熉熊熋熌ç†ç†Žç†ç†ç†‘熒熓熔熕熖熗熘熙熚熛熜ç†ç†žç†Ÿç† ç†¡ç†¢ç†£ç†¤ç†¥ç†¦ç†§ç†¨ç†©ç†ªç†«ç†¬ç†­ç†®ç†¯ç†°ç†±ç†²ç†³ç†´ç†µç†¶ç†·ç†¸ç†¹ç†ºç†»ç†¼ç†½ç†¾ç†¿ç‡€ç‡ç‡‚燃燄燅燆燇燈燉燊燋燌ç‡ç‡Žç‡ç‡ç‡‘燒燓燔燕燖燗燘燙燚燛燜ç‡ç‡žç‡Ÿç‡ ç‡¡ç‡¢ç‡£ç‡¤ç‡¥ç‡¦ç‡§ç‡¨ç‡©ç‡ªç‡«ç‡¬ç‡­ç‡®ç‡¯ç‡°ç‡±ç‡²ç‡³ç‡´ç‡µç‡¶ç‡·ç‡¸ç‡¹ç‡ºç‡»ç‡¼ç‡½ç‡¾ç‡¿çˆ€çˆçˆ‚爃爄爅爆爇爈爉爊爋爌çˆçˆŽçˆçˆçˆ‘爒爓爔爕爖爗爘爙爚爛爜çˆçˆžçˆŸçˆ çˆ¡çˆ¢çˆ£çˆ¤çˆ¥çˆ¦çˆ§çˆ¨çˆ©çˆªçˆ«çˆ¬çˆ­çˆ®çˆ¯çˆ°çˆ±çˆ²çˆ³çˆ´çˆµçˆ¶çˆ·çˆ¸çˆ¹çˆºçˆ»çˆ¼çˆ½çˆ¾çˆ¿ç‰€ç‰ç‰‚牃牄牅牆片版牉牊牋牌ç‰ç‰Žç‰ç‰ç‰‘牒牓牔牕牖牗牘牙牚牛牜ç‰ç‰žç‰Ÿç‰ ç‰¡ç‰¢ç‰£ç‰¤ç‰¥ç‰¦ç‰§ç‰¨ç‰©ç‰ªç‰«ç‰¬ç‰­ç‰®ç‰¯ç‰°ç‰±ç‰²ç‰³ç‰´ç‰µç‰¶ç‰·ç‰¸ç‰¹ç‰ºç‰»ç‰¼ç‰½ç‰¾ç‰¿çŠ€çŠçŠ‚çŠƒçŠ„çŠ…çŠ†çŠ‡çŠˆçŠ‰çŠŠçŠ‹çŠŒçŠçŠŽçŠçŠçŠ‘çŠ’çŠ“çŠ”çŠ•çŠ–çŠ—çŠ˜çŠ™çŠšçŠ›çŠœçŠçŠžçŠŸçŠ çŠ¡çŠ¢çŠ£çŠ¤çŠ¥çŠ¦çŠ§çŠ¨çŠ©çŠªçŠ«çŠ¬çŠ­çŠ®çŠ¯çŠ°çŠ±çŠ²çŠ³çŠ´çŠµçŠ¶çŠ·çŠ¸çŠ¹çŠºçŠ»çŠ¼çŠ½çŠ¾çŠ¿ç‹€ç‹ç‹‚狃狄狅狆狇狈狉狊狋狌ç‹ç‹Žç‹ç‹ç‹‘狒狓狔狕狖狗狘狙狚狛狜ç‹ç‹žç‹Ÿç‹ ç‹¡ç‹¢ç‹£ç‹¤ç‹¥ç‹¦ç‹§ç‹¨ç‹©ç‹ªç‹«ç‹¬ç‹­ç‹®ç‹¯ç‹°ç‹±ç‹²ç‹³ç‹´ç‹µç‹¶ç‹·ç‹¸ç‹¹ç‹ºç‹»ç‹¼ç‹½ç‹¾ç‹¿çŒ€çŒçŒ‚猃猄猅猆猇猈猉猊猋猌çŒçŒŽçŒçŒçŒ‘猒猓猔猕猖猗猘猙猚猛猜çŒçŒžçŒŸçŒ çŒ¡çŒ¢çŒ£çŒ¤çŒ¥çŒ¦çŒ§çŒ¨çŒ©çŒªçŒ«çŒ¬çŒ­çŒ®çŒ¯çŒ°çŒ±çŒ²çŒ³çŒ´çŒµçŒ¶çŒ·çŒ¸çŒ¹çŒºçŒ»çŒ¼çŒ½çŒ¾çŒ¿ç€çç‚çƒç„ç…ç†ç‡çˆç‰çŠç‹çŒççŽççç‘ç’ç“ç”ç•ç–ç—ç˜ç™çšç›çœççžçŸç ç¡ç¢ç£ç¤ç¥ç¦ç§ç¨ç©çªç«ç¬ç­ç®ç¯ç°ç±ç²ç³ç´çµç¶ç·ç¸ç¹çºç»ç¼ç½ç¾ç¿çŽ€çŽçŽ‚çŽƒçŽ„çŽ…çŽ†çŽ‡çŽˆçŽ‰çŽŠçŽ‹çŽŒçŽçŽŽçŽçŽçŽ‘çŽ’çŽ“çŽ”çŽ•çŽ–çŽ—çŽ˜çŽ™çŽšçŽ›çŽœçŽçŽžçŽŸçŽ çŽ¡çŽ¢çŽ£çŽ¤çŽ¥çŽ¦çŽ§çŽ¨çŽ©çŽªçŽ«çŽ¬çŽ­çŽ®çŽ¯çŽ°çŽ±çŽ²çŽ³çŽ´çŽµçŽ¶çŽ·çŽ¸çŽ¹çŽºçŽ»çŽ¼çŽ½çŽ¾çŽ¿ç€çç‚çƒç„ç…ç†ç‡çˆç‰çŠç‹çŒççŽççç‘ç’ç“ç”ç•ç–ç—ç˜ç™çšç›çœççžçŸç ç¡ç¢ç£ç¤ç¥ç¦ç§ç¨ç©çªç«ç¬ç­ç®ç¯ç°ç±ç²ç³ç´çµç¶ç·ç¸ç¹çºç»ç¼ç½ç¾ç¿ç€çç‚çƒç„ç…ç†ç‡çˆç‰çŠç‹çŒççŽççç‘ç’ç“ç”ç•ç–ç—ç˜ç™çšç›çœççžçŸç ç¡ç¢ç£ç¤ç¥ç¦ç§ç¨ç©çªç«ç¬ç­ç®ç¯ç°ç±ç²ç³ç´çµç¶ç·ç¸ç¹çºç»ç¼ç½ç¾ç¿ç‘€ç‘瑂瑃瑄瑅瑆瑇瑈瑉瑊瑋瑌ç‘瑎ç‘ç‘瑑瑒瑓瑔瑕瑖瑗瑘瑙瑚瑛瑜ç‘瑞瑟瑠瑡瑢瑣瑤瑥瑦瑧瑨瑩瑪瑫瑬瑭瑮瑯瑰瑱瑲瑳瑴瑵瑶瑷瑸瑹瑺瑻瑼瑽瑾瑿璀ç’璂璃璄璅璆璇璈璉璊璋璌ç’ç’Žç’ç’璑璒璓璔璕璖璗璘璙璚璛璜ç’璞璟璠璡璢璣璤璥璦璧璨璩璪璫璬璭璮璯環璱璲璳璴璵璶璷璸璹璺璻璼璽璾璿瓀ç“瓂瓃瓄瓅瓆瓇瓈瓉瓊瓋瓌ç“瓎ç“ç“瓑瓒瓓瓔瓕瓖瓗瓘瓙瓚瓛瓜ç“瓞瓟瓠瓡瓢瓣瓤瓥瓦瓧瓨瓩瓪瓫瓬瓭瓮瓯瓰瓱瓲瓳瓴瓵瓶瓷瓸瓹瓺瓻瓼瓽瓾瓿甀ç”甂甃甄甅甆甇甈甉甊甋甌ç”甎ç”ç”甑甒甓甔甕甖甗甘甙甚甛甜ç”甞生甠甡產産甤甥甦甧用甩甪甫甬甭甮甯田由甲申甴电甶男甸甹町画甼甽甾甿畀ç•畂畃畄畅畆畇畈畉畊畋界ç•畎ç•ç•畑畒畓畔畕畖畗畘留畚畛畜ç•畞畟畠畡畢畣畤略畦畧畨畩番畫畬畭畮畯異畱畲畳畴畵當畷畸畹畺畻畼畽畾畿疀ç–疂疃疄疅疆疇疈疉疊疋疌ç–ç–Žç–ç–疑疒疓疔疕疖疗疘疙疚疛疜ç–疞疟疠疡疢疣疤疥疦疧疨疩疪疫疬疭疮疯疰疱疲疳疴疵疶疷疸疹疺疻疼疽疾疿痀ç—痂痃痄病痆症痈痉痊痋痌ç—ç—Žç—ç—痑痒痓痔痕痖痗痘痙痚痛痜ç—痞痟痠痡痢痣痤痥痦痧痨痩痪痫痬痭痮痯痰痱痲痳痴痵痶痷痸痹痺痻痼痽痾痿瘀ç˜ç˜‚瘃瘄瘅瘆瘇瘈瘉瘊瘋瘌ç˜ç˜Žç˜ç˜ç˜‘瘒瘓瘔瘕瘖瘗瘘瘙瘚瘛瘜ç˜ç˜žç˜Ÿç˜ ç˜¡ç˜¢ç˜£ç˜¤ç˜¥ç˜¦ç˜§ç˜¨ç˜©ç˜ªç˜«ç˜¬ç˜­ç˜®ç˜¯ç˜°ç˜±ç˜²ç˜³ç˜´ç˜µç˜¶ç˜·ç˜¸ç˜¹ç˜ºç˜»ç˜¼ç˜½ç˜¾ç˜¿ç™€ç™ç™‚癃癄癅癆癇癈癉癊癋癌ç™ç™Žç™ç™ç™‘癒癓癔癕癖癗癘癙癚癛癜ç™ç™žç™Ÿç™ ç™¡ç™¢ç™£ç™¤ç™¥ç™¦ç™§ç™¨ç™©ç™ªç™«ç™¬ç™­ç™®ç™¯ç™°ç™±ç™²ç™³ç™´ç™µç™¶ç™·ç™¸ç™¹ç™ºç™»ç™¼ç™½ç™¾ç™¿çš€çšçš‚皃的皅皆皇皈皉皊皋皌çšçšŽçšçšçš‘皒皓皔皕皖皗皘皙皚皛皜çšçšžçšŸçš çš¡çš¢çš£çš¤çš¥çš¦çš§çš¨çš©çšªçš«çš¬çš­çš®çš¯çš°çš±çš²çš³çš´çšµçš¶çš·çš¸çš¹çšºçš»çš¼çš½çš¾çš¿ç›€ç›ç›‚盃盄盅盆盇盈盉益盋盌ç›ç›Žç›ç›ç›‘盒盓盔盕盖盗盘盙盚盛盜ç›ç›žç›Ÿç› ç›¡ç›¢ç›£ç›¤ç›¥ç›¦ç›§ç›¨ç›©ç›ªç›«ç›¬ç›­ç›®ç›¯ç›°ç›±ç›²ç›³ç›´ç›µç›¶ç›·ç›¸ç›¹ç›ºç›»ç›¼ç›½ç›¾ç›¿çœ€çœçœ‚眃眄眅眆眇眈眉眊看県çœçœŽçœçœçœ‘眒眓眔眕眖眗眘眙眚眛眜çœçœžçœŸçœ çœ¡çœ¢çœ£çœ¤çœ¥çœ¦çœ§çœ¨çœ©çœªçœ«çœ¬çœ­çœ®çœ¯çœ°çœ±çœ²çœ³çœ´çœµçœ¶çœ·çœ¸çœ¹çœºçœ»çœ¼çœ½çœ¾çœ¿ç€çç‚çƒç„ç…ç†ç‡çˆç‰çŠç‹çŒççŽççç‘ç’ç“ç”ç•ç–ç—ç˜ç™çšç›çœççžçŸç ç¡ç¢ç£ç¤ç¥ç¦ç§ç¨ç©çªç«ç¬ç­ç®ç¯ç°ç±ç²ç³ç´çµç¶ç·ç¸ç¹çºç»ç¼ç½ç¾ç¿çž€çžçž‚瞃瞄瞅瞆瞇瞈瞉瞊瞋瞌çžçžŽçžçžçž‘瞒瞓瞔瞕瞖瞗瞘瞙瞚瞛瞜çžçžžçžŸçž çž¡çž¢çž£çž¤çž¥çž¦çž§çž¨çž©çžªçž«çž¬çž­çž®çž¯çž°çž±çž²çž³çž´çžµçž¶çž·çž¸çž¹çžºçž»çž¼çž½çž¾çž¿çŸ€çŸçŸ‚矃矄矅矆矇矈矉矊矋矌çŸçŸŽçŸçŸçŸ‘矒矓矔矕矖矗矘矙矚矛矜çŸçŸžçŸŸçŸ çŸ¡çŸ¢çŸ£çŸ¤çŸ¥çŸ¦çŸ§çŸ¨çŸ©çŸªçŸ«çŸ¬çŸ­çŸ®çŸ¯çŸ°çŸ±çŸ²çŸ³çŸ´çŸµçŸ¶çŸ·çŸ¸çŸ¹çŸºçŸ»çŸ¼çŸ½çŸ¾çŸ¿ç €ç ç ‚砃砄砅砆砇砈砉砊砋砌ç ç Žç ç ç ‘砒砓研砕砖砗砘砙砚砛砜ç ç žç Ÿç  ç ¡ç ¢ç £ç ¤ç ¥ç ¦ç §ç ¨ç ©ç ªç «ç ¬ç ­ç ®ç ¯ç °ç ±ç ²ç ³ç ´ç µç ¶ç ·ç ¸ç ¹ç ºç »ç ¼ç ½ç ¾ç ¿ç¡€ç¡ç¡‚硃硄硅硆硇硈硉硊硋硌ç¡ç¡Žç¡ç¡ç¡‘硒硓硔硕硖硗硘硙硚硛硜ç¡ç¡žç¡Ÿç¡ ç¡¡ç¡¢ç¡£ç¡¤ç¡¥ç¡¦ç¡§ç¡¨ç¡©ç¡ªç¡«ç¡¬ç¡­ç¡®ç¡¯ç¡°ç¡±ç¡²ç¡³ç¡´ç¡µç¡¶ç¡·ç¡¸ç¡¹ç¡ºç¡»ç¡¼ç¡½ç¡¾ç¡¿ç¢€ç¢ç¢‚碃碄碅碆碇碈碉碊碋碌ç¢ç¢Žç¢ç¢ç¢‘碒碓碔碕碖碗碘碙碚碛碜ç¢ç¢žç¢Ÿç¢ ç¢¡ç¢¢ç¢£ç¢¤ç¢¥ç¢¦ç¢§ç¢¨ç¢©ç¢ªç¢«ç¢¬ç¢­ç¢®ç¢¯ç¢°ç¢±ç¢²ç¢³ç¢´ç¢µç¢¶ç¢·ç¢¸ç¢¹ç¢ºç¢»ç¢¼ç¢½ç¢¾ç¢¿ç£€ç£ç£‚磃磄磅磆磇磈磉磊磋磌ç£ç£Žç£ç£ç£‘磒磓磔磕磖磗磘磙磚磛磜ç£ç£žç£Ÿç£ ç£¡ç£¢ç££ç£¤ç£¥ç£¦ç£§ç£¨ç£©ç£ªç£«ç£¬ç£­ç£®ç£¯ç£°ç£±ç£²ç£³ç£´ç£µç£¶ç£·ç£¸ç£¹ç£ºç£»ç£¼ç£½ç£¾ç£¿ç¤€ç¤ç¤‚礃礄礅礆礇礈礉礊礋礌ç¤ç¤Žç¤ç¤ç¤‘礒礓礔礕礖礗礘礙礚礛礜ç¤ç¤žç¤Ÿç¤ ç¤¡ç¤¢ç¤£ç¤¤ç¤¥ç¤¦ç¤§ç¤¨ç¤©ç¤ªç¤«ç¤¬ç¤­ç¤®ç¤¯ç¤°ç¤±ç¤²ç¤³ç¤´ç¤µç¤¶ç¤·ç¤¸ç¤¹ç¤ºç¤»ç¤¼ç¤½ç¤¾ç¤¿ç¥€ç¥ç¥‚祃祄祅祆祇祈祉祊祋祌ç¥ç¥Žç¥ç¥ç¥‘祒祓祔祕祖祗祘祙祚祛祜ç¥ç¥žç¥Ÿç¥ ç¥¡ç¥¢ç¥£ç¥¤ç¥¥ç¥¦ç¥§ç¥¨ç¥©ç¥ªç¥«ç¥¬ç¥­ç¥®ç¥¯ç¥°ç¥±ç¥²ç¥³ç¥´ç¥µç¥¶ç¥·ç¥¸ç¥¹ç¥ºç¥»ç¥¼ç¥½ç¥¾ç¥¿ç¦€ç¦ç¦‚禃禄禅禆禇禈禉禊禋禌ç¦ç¦Žç¦ç¦ç¦‘禒禓禔禕禖禗禘禙禚禛禜ç¦ç¦žç¦Ÿç¦ ç¦¡ç¦¢ç¦£ç¦¤ç¦¥ç¦¦ç¦§ç¦¨ç¦©ç¦ªç¦«ç¦¬ç¦­ç¦®ç¦¯ç¦°ç¦±ç¦²ç¦³ç¦´ç¦µç¦¶ç¦·ç¦¸ç¦¹ç¦ºç¦»ç¦¼ç¦½ç¦¾ç¦¿ç§€ç§ç§‚秃秄秅秆秇秈秉秊秋秌ç§ç§Žç§ç§ç§‘秒秓秔秕秖秗秘秙秚秛秜ç§ç§žç§Ÿç§ ç§¡ç§¢ç§£ç§¤ç§¥ç§¦ç§§ç§¨ç§©ç§ªç§«ç§¬ç§­ç§®ç§¯ç§°ç§±ç§²ç§³ç§´ç§µç§¶ç§·ç§¸ç§¹ç§ºç§»ç§¼ç§½ç§¾ç§¿ç¨€ç¨ç¨‚稃稄稅稆稇稈稉稊程稌ç¨ç¨Žç¨ç¨ç¨‘稒稓稔稕稖稗稘稙稚稛稜ç¨ç¨žç¨Ÿç¨ ç¨¡ç¨¢ç¨£ç¨¤ç¨¥ç¨¦ç¨§ç¨¨ç¨©ç¨ªç¨«ç¨¬ç¨­ç¨®ç¨¯ç¨°ç¨±ç¨²ç¨³ç¨´ç¨µç¨¶ç¨·ç¨¸ç¨¹ç¨ºç¨»ç¨¼ç¨½ç¨¾ç¨¿ç©€ç©ç©‚穃穄穅穆穇穈穉穊穋穌ç©ç©Žç©ç©ç©‘穒穓穔穕穖穗穘穙穚穛穜ç©ç©žç©Ÿç© ç©¡ç©¢ç©£ç©¤ç©¥ç©¦ç©§ç©¨ç©©ç©ªç©«ç©¬ç©­ç©®ç©¯ç©°ç©±ç©²ç©³ç©´ç©µç©¶ç©·ç©¸ç©¹ç©ºç©»ç©¼ç©½ç©¾ç©¿çª€çªçª‚窃窄窅窆窇窈窉窊窋窌çªçªŽçªçªçª‘窒窓窔窕窖窗窘窙窚窛窜çªçªžçªŸçª çª¡çª¢çª£çª¤çª¥çª¦çª§çª¨çª©çªªçª«çª¬çª­çª®çª¯çª°çª±çª²çª³çª´çªµçª¶çª·çª¸çª¹çªºçª»çª¼çª½çª¾çª¿ç«€ç«ç«‚竃竄竅竆竇竈竉竊立竌ç«ç«Žç«ç«ç«‘竒竓竔竕竖竗竘站竚竛竜ç«ç«žç«Ÿç« ç«¡ç«¢ç«£ç«¤ç«¥ç«¦ç«§ç«¨ç«©ç«ªç««ç«¬ç«­ç«®ç«¯ç«°ç«±ç«²ç«³ç«´ç«µç«¶ç«·ç«¸ç«¹ç«ºç«»ç«¼ç«½ç«¾ç«¿ç¬€ç¬ç¬‚笃笄笅笆笇笈笉笊笋笌ç¬ç¬Žç¬ç¬ç¬‘笒笓笔笕笖笗笘笙笚笛笜ç¬ç¬žç¬Ÿç¬ ç¬¡ç¬¢ç¬£ç¬¤ç¬¥ç¬¦ç¬§ç¬¨ç¬©ç¬ªç¬«ç¬¬ç¬­ç¬®ç¬¯ç¬°ç¬±ç¬²ç¬³ç¬´ç¬µç¬¶ç¬·ç¬¸ç¬¹ç¬ºç¬»ç¬¼ç¬½ç¬¾ç¬¿ç­€ç­ç­‚筃筄筅筆筇筈等筊筋筌ç­ç­Žç­ç­ç­‘筒筓答筕策筗筘筙筚筛筜ç­ç­žç­Ÿç­ ç­¡ç­¢ç­£ç­¤ç­¥ç­¦ç­§ç­¨ç­©ç­ªç­«ç­¬ç­­ç­®ç­¯ç­°ç­±ç­²ç­³ç­´ç­µç­¶ç­·ç­¸ç­¹ç­ºç­»ç­¼ç­½ç­¾ç­¿ç®€ç®ç®‚箃箄箅箆箇箈箉箊箋箌ç®ç®Žç®ç®ç®‘箒箓箔箕箖算箘箙箚箛箜ç®ç®žç®Ÿç® ç®¡ç®¢ç®£ç®¤ç®¥ç®¦ç®§ç®¨ç®©ç®ªç®«ç®¬ç®­ç®®ç®¯ç®°ç®±ç®²ç®³ç®´ç®µç®¶ç®·ç®¸ç®¹ç®ºç®»ç®¼ç®½ç®¾ç®¿ç¯€ç¯ç¯‚篃範篅篆篇篈築篊篋篌ç¯ç¯Žç¯ç¯ç¯‘篒篓篔篕篖篗篘篙篚篛篜ç¯ç¯žç¯Ÿç¯ ç¯¡ç¯¢ç¯£ç¯¤ç¯¥ç¯¦ç¯§ç¯¨ç¯©ç¯ªç¯«ç¯¬ç¯­ç¯®ç¯¯ç¯°ç¯±ç¯²ç¯³ç¯´ç¯µç¯¶ç¯·ç¯¸ç¯¹ç¯ºç¯»ç¯¼ç¯½ç¯¾ç¯¿ç°€ç°ç°‚簃簄簅簆簇簈簉簊簋簌ç°ç°Žç°ç°ç°‘簒簓簔簕簖簗簘簙簚簛簜ç°ç°žç°Ÿç° ç°¡ç°¢ç°£ç°¤ç°¥ç°¦ç°§ç°¨ç°©ç°ªç°«ç°¬ç°­ç°®ç°¯ç°°ç°±ç°²ç°³ç°´ç°µç°¶ç°·ç°¸ç°¹ç°ºç°»ç°¼ç°½ç°¾ç°¿ç±€ç±ç±‚籃籄籅籆籇籈籉籊籋籌ç±ç±Žç±ç±ç±‘籒籓籔籕籖籗籘籙籚籛籜ç±ç±žç±Ÿç± ç±¡ç±¢ç±£ç±¤ç±¥ç±¦ç±§ç±¨ç±©ç±ªç±«ç±¬ç±­ç±®ç±¯ç±°ç±±ç±²ç±³ç±´ç±µç±¶ç±·ç±¸ç±¹ç±ºç±»ç±¼ç±½ç±¾ç±¿ç²€ç²ç²‚粃粄粅粆粇粈粉粊粋粌ç²ç²Žç²ç²ç²‘粒粓粔粕粖粗粘粙粚粛粜ç²ç²žç²Ÿç² ç²¡ç²¢ç²£ç²¤ç²¥ç²¦ç²§ç²¨ç²©ç²ªç²«ç²¬ç²­ç²®ç²¯ç²°ç²±ç²²ç²³ç²´ç²µç²¶ç²·ç²¸ç²¹ç²ºç²»ç²¼ç²½ç²¾ç²¿ç³€ç³ç³‚糃糄糅糆糇糈糉糊糋糌ç³ç³Žç³ç³ç³‘糒糓糔糕糖糗糘糙糚糛糜ç³ç³žç³Ÿç³ ç³¡ç³¢ç³£ç³¤ç³¥ç³¦ç³§ç³¨ç³©ç³ªç³«ç³¬ç³­ç³®ç³¯ç³°ç³±ç³²ç³³ç³´ç³µç³¶ç³·ç³¸ç³¹ç³ºç³»ç³¼ç³½ç³¾ç³¿ç´€ç´ç´‚紃約紅紆紇紈紉紊紋紌ç´ç´Žç´ç´ç´‘紒紓純紕紖紗紘紙級紛紜ç´ç´žç´Ÿç´ ç´¡ç´¢ç´£ç´¤ç´¥ç´¦ç´§ç´¨ç´©ç´ªç´«ç´¬ç´­ç´®ç´¯ç´°ç´±ç´²ç´³ç´´ç´µç´¶ç´·ç´¸ç´¹ç´ºç´»ç´¼ç´½ç´¾ç´¿çµ€çµçµ‚絃組絅絆絇絈絉絊絋経çµçµŽçµçµçµ‘絒絓絔絕絖絗絘絙絚絛絜çµçµžçµŸçµ çµ¡çµ¢çµ£çµ¤çµ¥çµ¦çµ§çµ¨çµ©çµªçµ«çµ¬çµ­çµ®çµ¯çµ°çµ±çµ²çµ³çµ´çµµçµ¶çµ·çµ¸çµ¹çµºçµ»çµ¼çµ½çµ¾çµ¿ç¶€ç¶ç¶‚綃綄綅綆綇綈綉綊綋綌ç¶ç¶Žç¶ç¶ç¶‘綒經綔綕綖綗綘継続綛綜ç¶ç¶žç¶Ÿç¶ ç¶¡ç¶¢ç¶£ç¶¤ç¶¥ç¶¦ç¶§ç¶¨ç¶©ç¶ªç¶«ç¶¬ç¶­ç¶®ç¶¯ç¶°ç¶±ç¶²ç¶³ç¶´ç¶µç¶¶ç¶·ç¶¸ç¶¹ç¶ºç¶»ç¶¼ç¶½ç¶¾ç¶¿ç·€ç·ç·‚緃緄緅緆緇緈緉緊緋緌ç·ç·Žç·ç·ç·‘緒緓緔緕緖緗緘緙線緛緜ç·ç·žç·Ÿç· ç·¡ç·¢ç·£ç·¤ç·¥ç·¦ç·§ç·¨ç·©ç·ªç·«ç·¬ç·­ç·®ç·¯ç·°ç·±ç·²ç·³ç·´ç·µç·¶ç··ç·¸ç·¹ç·ºç·»ç·¼ç·½ç·¾ç·¿ç¸€ç¸ç¸‚縃縄縅縆縇縈縉縊縋縌ç¸ç¸Žç¸ç¸ç¸‘縒縓縔縕縖縗縘縙縚縛縜ç¸ç¸žç¸Ÿç¸ ç¸¡ç¸¢ç¸£ç¸¤ç¸¥ç¸¦ç¸§ç¸¨ç¸©ç¸ªç¸«ç¸¬ç¸­ç¸®ç¸¯ç¸°ç¸±ç¸²ç¸³ç¸´ç¸µç¸¶ç¸·ç¸¸ç¸¹ç¸ºç¸»ç¸¼ç¸½ç¸¾ç¸¿ç¹€ç¹ç¹‚繃繄繅繆繇繈繉繊繋繌ç¹ç¹Žç¹ç¹ç¹‘繒繓織繕繖繗繘繙繚繛繜ç¹ç¹žç¹Ÿç¹ ç¹¡ç¹¢ç¹£ç¹¤ç¹¥ç¹¦ç¹§ç¹¨ç¹©ç¹ªç¹«ç¹¬ç¹­ç¹®ç¹¯ç¹°ç¹±ç¹²ç¹³ç¹´ç¹µç¹¶ç¹·ç¹¸ç¹¹ç¹ºç¹»ç¹¼ç¹½ç¹¾ç¹¿çº€çºçº‚纃纄纅纆纇纈纉纊纋續çºçºŽçºçºçº‘纒纓纔纕纖纗纘纙纚纛纜çºçºžçºŸçº çº¡çº¢çº£çº¤çº¥çº¦çº§çº¨çº©çºªçº«çº¬çº­çº®çº¯çº°çº±çº²çº³çº´çºµçº¶çº·çº¸çº¹çººçº»çº¼çº½çº¾çº¿ç»€ç»ç»‚练组绅细织终绉绊绋绌ç»ç»Žç»ç»ç»‘绒结绔绕绖绗绘给绚绛络ç»ç»žç»Ÿç» ç»¡ç»¢ç»£ç»¤ç»¥ç»¦ç»§ç»¨ç»©ç»ªç»«ç»¬ç»­ç»®ç»¯ç»°ç»±ç»²ç»³ç»´ç»µç»¶ç»·ç»¸ç»¹ç»ºç»»ç»¼ç»½ç»¾ç»¿ç¼€ç¼ç¼‚缃缄缅缆缇缈缉缊缋缌ç¼ç¼Žç¼ç¼ç¼‘缒缓缔缕编缗缘缙缚缛缜ç¼ç¼žç¼Ÿç¼ ç¼¡ç¼¢ç¼£ç¼¤ç¼¥ç¼¦ç¼§ç¼¨ç¼©ç¼ªç¼«ç¼¬ç¼­ç¼®ç¼¯ç¼°ç¼±ç¼²ç¼³ç¼´ç¼µç¼¶ç¼·ç¼¸ç¼¹ç¼ºç¼»ç¼¼ç¼½ç¼¾ç¼¿ç½€ç½ç½‚罃罄罅罆罇罈罉罊罋罌ç½ç½Žç½ç½ç½‘罒罓罔罕罖罗罘罙罚罛罜ç½ç½žç½Ÿç½ ç½¡ç½¢ç½£ç½¤ç½¥ç½¦ç½§ç½¨ç½©ç½ªç½«ç½¬ç½­ç½®ç½¯ç½°ç½±ç½²ç½³ç½´ç½µç½¶ç½·ç½¸ç½¹ç½ºç½»ç½¼ç½½ç½¾ç½¿ç¾€ç¾ç¾‚羃羄羅羆羇羈羉羊羋羌ç¾ç¾Žç¾ç¾ç¾‘羒羓羔羕羖羗羘羙羚羛羜ç¾ç¾žç¾Ÿç¾ ç¾¡ç¾¢ç¾£ç¾¤ç¾¥ç¾¦ç¾§ç¾¨ç¾©ç¾ªç¾«ç¾¬ç¾­ç¾®ç¾¯ç¾°ç¾±ç¾²ç¾³ç¾´ç¾µç¾¶ç¾·ç¾¸ç¾¹ç¾ºç¾»ç¾¼ç¾½ç¾¾ç¾¿ç¿€ç¿ç¿‚翃翄翅翆翇翈翉翊翋翌ç¿ç¿Žç¿ç¿ç¿‘習翓翔翕翖翗翘翙翚翛翜ç¿ç¿žç¿Ÿç¿ ç¿¡ç¿¢ç¿£ç¿¤ç¿¥ç¿¦ç¿§ç¿¨ç¿©ç¿ªç¿«ç¿¬ç¿­ç¿®ç¿¯ç¿°ç¿±ç¿²ç¿³ç¿´ç¿µç¿¶ç¿·ç¿¸ç¿¹ç¿ºç¿»ç¿¼ç¿½ç¿¾ç¿¿è€€è€è€‚考耄者耆耇耈耉耊耋而è€è€Žè€è€è€‘耒耓耔耕耖耗耘耙耚耛耜è€è€žè€Ÿè€ è€¡è€¢è€£è€¤è€¥è€¦è€§è€¨è€©è€ªè€«è€¬è€­è€®è€¯è€°è€±è€²è€³è€´è€µè€¶è€·è€¸è€¹è€ºè€»è€¼è€½è€¾è€¿è€èè‚èƒè„è…è†è‡èˆè‰èŠè‹èŒèèŽèèè‘è’è“è”è•è–è—è˜è™èšè›èœèèžèŸè è¡è¢è£è¤è¥è¦è§è¨è©èªè«è¬è­è®è¯è°è±è²è³è´èµè¶è·è¸è¹èºè»è¼è½è¾è¿è‚€è‚肂肃肄肅肆肇肈肉肊肋肌è‚肎è‚è‚肑肒肓肔肕肖肗肘肙肚肛肜è‚肞肟肠股肢肣肤肥肦肧肨肩肪肫肬肭肮肯肰肱育肳肴肵肶肷肸肹肺肻肼肽肾肿胀èƒèƒ‚胃胄胅胆胇胈胉胊胋背èƒèƒŽèƒèƒèƒ‘胒胓胔胕胖胗胘胙胚胛胜èƒèƒžèƒŸèƒ èƒ¡èƒ¢èƒ£èƒ¤èƒ¥èƒ¦èƒ§èƒ¨èƒ©èƒªèƒ«èƒ¬èƒ­èƒ®èƒ¯èƒ°èƒ±èƒ²èƒ³èƒ´èƒµèƒ¶èƒ·èƒ¸èƒ¹èƒºèƒ»èƒ¼èƒ½èƒ¾èƒ¿è„€è„脂脃脄脅脆脇脈脉脊脋脌è„脎è„è„脑脒脓脔脕脖脗脘脙脚脛脜è„脞脟脠脡脢脣脤脥脦脧脨脩脪脫脬脭脮脯脰脱脲脳脴脵脶脷脸脹脺脻脼脽脾脿腀è…腂腃腄腅腆腇腈腉腊腋腌è…è…Žè…è…腑腒腓腔腕腖腗腘腙腚腛腜è…腞腟腠腡腢腣腤腥腦腧腨腩腪腫腬腭腮腯腰腱腲腳腴腵腶腷腸腹腺腻腼腽腾腿膀è†è†‚膃膄膅膆膇膈膉膊膋膌è†è†Žè†è†è†‘膒膓膔膕膖膗膘膙膚膛膜è†è†žè†Ÿè† è†¡è†¢è†£è†¤è†¥è†¦è†§è†¨è†©è†ªè†«è†¬è†­è†®è†¯è†°è†±è†²è†³è†´è†µè†¶è†·è†¸è†¹è†ºè†»è†¼è†½è†¾è†¿è‡€è‡è‡‚臃臄臅臆臇臈臉臊臋臌è‡è‡Žè‡è‡è‡‘臒臓臔臕臖臗臘臙臚臛臜è‡è‡žè‡Ÿè‡ è‡¡è‡¢è‡£è‡¤è‡¥è‡¦è‡§è‡¨è‡©è‡ªè‡«è‡¬è‡­è‡®è‡¯è‡°è‡±è‡²è‡³è‡´è‡µè‡¶è‡·è‡¸è‡¹è‡ºè‡»è‡¼è‡½è‡¾è‡¿èˆ€èˆèˆ‚舃舄舅舆與興舉舊舋舌èˆèˆŽèˆèˆèˆ‘舒舓舔舕舖舗舘舙舚舛舜èˆèˆžèˆŸèˆ èˆ¡èˆ¢èˆ£èˆ¤èˆ¥èˆ¦èˆ§èˆ¨èˆ©èˆªèˆ«èˆ¬èˆ­èˆ®èˆ¯èˆ°èˆ±èˆ²èˆ³èˆ´èˆµèˆ¶èˆ·èˆ¸èˆ¹èˆºèˆ»èˆ¼èˆ½èˆ¾èˆ¿è‰€è‰è‰‚艃艄艅艆艇艈艉艊艋艌è‰è‰Žè‰è‰è‰‘艒艓艔艕艖艗艘艙艚艛艜è‰è‰žè‰Ÿè‰ è‰¡è‰¢è‰£è‰¤è‰¥è‰¦è‰§è‰¨è‰©è‰ªè‰«è‰¬è‰­è‰®è‰¯è‰°è‰±è‰²è‰³è‰´è‰µè‰¶è‰·è‰¸è‰¹è‰ºè‰»è‰¼è‰½è‰¾è‰¿èŠ€èŠèŠ‚èŠƒèŠ„èŠ…èŠ†èŠ‡èŠˆèŠ‰èŠŠèŠ‹èŠŒèŠèŠŽèŠèŠèŠ‘èŠ’èŠ“èŠ”èŠ•èŠ–èŠ—èŠ˜èŠ™èŠšèŠ›èŠœèŠèŠžèŠŸèŠ èŠ¡èŠ¢èŠ£èŠ¤èŠ¥èŠ¦èŠ§èŠ¨èŠ©èŠªèŠ«èŠ¬èŠ­èŠ®èŠ¯èŠ°èŠ±èŠ²èŠ³èŠ´èŠµèŠ¶èŠ·èŠ¸èŠ¹èŠºèŠ»èŠ¼èŠ½èŠ¾èŠ¿è‹€è‹è‹‚苃苄苅苆苇苈苉苊苋苌è‹è‹Žè‹è‹è‹‘苒苓苔苕苖苗苘苙苚苛苜è‹è‹žè‹Ÿè‹ è‹¡è‹¢è‹£è‹¤è‹¥è‹¦è‹§è‹¨è‹©è‹ªè‹«è‹¬è‹­è‹®è‹¯è‹°è‹±è‹²è‹³è‹´è‹µè‹¶è‹·è‹¸è‹¹è‹ºè‹»è‹¼è‹½è‹¾è‹¿èŒ€èŒèŒ‚范茄茅茆茇茈茉茊茋茌èŒèŒŽèŒèŒèŒ‘茒茓茔茕茖茗茘茙茚茛茜èŒèŒžèŒŸèŒ èŒ¡èŒ¢èŒ£èŒ¤èŒ¥èŒ¦èŒ§èŒ¨èŒ©èŒªèŒ«èŒ¬èŒ­èŒ®èŒ¯èŒ°èŒ±èŒ²èŒ³èŒ´èŒµèŒ¶èŒ·èŒ¸èŒ¹èŒºèŒ»èŒ¼èŒ½èŒ¾èŒ¿è€èè‚èƒè„è…è†è‡èˆè‰èŠè‹èŒèèŽèèè‘è’è“è”è•è–è—è˜è™èšè›èœèèžèŸè è¡è¢è£è¤è¥è¦è§è¨è©èªè«è¬è­è®è¯è°è±è²è³è´èµè¶è·è¸è¹èºè»è¼è½è¾è¿èŽ€èŽèŽ‚èŽƒèŽ„èŽ…èŽ†èŽ‡èŽˆèŽ‰èŽŠèŽ‹èŽŒèŽèŽŽèŽèŽèŽ‘èŽ’èŽ“èŽ”èŽ•èŽ–èŽ—èŽ˜èŽ™èŽšèŽ›èŽœèŽèŽžèŽŸèŽ èŽ¡èŽ¢èŽ£èŽ¤èŽ¥èŽ¦èŽ§èŽ¨èŽ©èŽªèŽ«èŽ¬èŽ­èŽ®èŽ¯èŽ°èŽ±èŽ²èŽ³èŽ´èŽµèŽ¶èŽ·èŽ¸èŽ¹èŽºèŽ»èŽ¼èŽ½èŽ¾èŽ¿è€èè‚èƒè„è…è†è‡èˆè‰èŠè‹èŒèèŽèèè‘è’è“è”è•è–è—è˜è™èšè›èœèèžèŸè è¡è¢è£è¤è¥è¦è§è¨è©èªè«è¬è­è®è¯è°è±è²è³è´èµè¶è·è¸è¹èºè»è¼è½è¾è¿è€èè‚èƒè„è…è†è‡èˆè‰èŠè‹èŒèèŽèèè‘è’è“è”è•è–è—è˜è™èšè›èœèèžèŸè è¡è¢è£è¤è¥è¦è§è¨è©èªè«è¬è­è®è¯è°è±è²è³è´èµè¶è·è¸è¹èºè»è¼è½è¾è¿è‘€è‘葂葃葄葅葆葇葈葉葊葋葌è‘葎è‘è‘葑葒葓葔葕葖著葘葙葚葛葜è‘葞葟葠葡葢董葤葥葦葧葨葩葪葫葬葭葮葯葰葱葲葳葴葵葶葷葸葹葺葻葼葽葾葿蒀è’蒂蒃蒄蒅蒆蒇蒈蒉蒊蒋蒌è’è’Žè’è’蒑蒒蒓蒔蒕蒖蒗蒘蒙蒚蒛蒜è’蒞蒟蒠蒡蒢蒣蒤蒥蒦蒧蒨蒩蒪蒫蒬蒭蒮蒯蒰蒱蒲蒳蒴蒵蒶蒷蒸蒹蒺蒻蒼蒽蒾蒿蓀è“蓂蓃蓄蓅蓆蓇蓈蓉蓊蓋蓌è“蓎è“è“蓑蓒蓓蓔蓕蓖蓗蓘蓙蓚蓛蓜è“蓞蓟蓠蓡蓢蓣蓤蓥蓦蓧蓨蓩蓪蓫蓬蓭蓮蓯蓰蓱蓲蓳蓴蓵蓶蓷蓸蓹蓺蓻蓼蓽蓾蓿蔀è”蔂蔃蔄蔅蔆蔇蔈蔉蔊蔋蔌è”蔎è”è”蔑蔒蔓蔔蔕蔖蔗蔘蔙蔚蔛蔜è”蔞蔟蔠蔡蔢蔣蔤蔥蔦蔧蔨蔩蔪蔫蔬蔭蔮蔯蔰蔱蔲蔳蔴蔵蔶蔷蔸蔹蔺蔻蔼蔽蔾蔿蕀è•蕂蕃蕄蕅蕆蕇蕈蕉蕊蕋蕌è•蕎è•è•蕑蕒蕓蕔蕕蕖蕗蕘蕙蕚蕛蕜è•蕞蕟蕠蕡蕢蕣蕤蕥蕦蕧蕨蕩蕪蕫蕬蕭蕮蕯蕰蕱蕲蕳蕴蕵蕶蕷蕸蕹蕺蕻蕼蕽蕾蕿薀è–薂薃薄薅薆薇薈薉薊薋薌è–è–Žè–è–薑薒薓薔薕薖薗薘薙薚薛薜è–薞薟薠薡薢薣薤薥薦薧薨薩薪薫薬薭薮薯薰薱薲薳薴薵薶薷薸薹薺薻薼薽薾薿藀è—藂藃藄藅藆藇藈藉藊藋藌è—è—Žè—è—藑藒藓藔藕藖藗藘藙藚藛藜è—藞藟藠藡藢藣藤藥藦藧藨藩藪藫藬藭藮藯藰藱藲藳藴藵藶藷藸藹藺藻藼藽藾藿蘀è˜è˜‚蘃蘄蘅蘆蘇蘈蘉蘊蘋蘌è˜è˜Žè˜è˜è˜‘蘒蘓蘔蘕蘖蘗蘘蘙蘚蘛蘜è˜è˜žè˜Ÿè˜ è˜¡è˜¢è˜£è˜¤è˜¥è˜¦è˜§è˜¨è˜©è˜ªè˜«è˜¬è˜­è˜®è˜¯è˜°è˜±è˜²è˜³è˜´è˜µè˜¶è˜·è˜¸è˜¹è˜ºè˜»è˜¼è˜½è˜¾è˜¿è™€è™è™‚虃虄虅虆虇虈虉虊虋虌è™è™Žè™è™è™‘虒虓虔處虖虗虘虙虚虛虜è™è™žè™Ÿè™ è™¡è™¢è™£è™¤è™¥è™¦è™§è™¨è™©è™ªè™«è™¬è™­è™®è™¯è™°è™±è™²è™³è™´è™µè™¶è™·è™¸è™¹è™ºè™»è™¼è™½è™¾è™¿èš€èšèš‚蚃蚄蚅蚆蚇蚈蚉蚊蚋蚌èšèšŽèšèšèš‘蚒蚓蚔蚕蚖蚗蚘蚙蚚蚛蚜èšèšžèšŸèš èš¡èš¢èš£èš¤èš¥èš¦èš§èš¨èš©èšªèš«èš¬èš­èš®èš¯èš°èš±èš²èš³èš´èšµèš¶èš·èš¸èš¹èšºèš»èš¼èš½èš¾èš¿è›€è›è›‚蛃蛄蛅蛆蛇蛈蛉蛊蛋蛌è›è›Žè›è›è›‘蛒蛓蛔蛕蛖蛗蛘蛙蛚蛛蛜è›è›žè›Ÿè› è›¡è›¢è›£è›¤è›¥è›¦è›§è›¨è›©è›ªè›«è›¬è›­è›®è›¯è›°è›±è›²è›³è›´è›µè›¶è›·è›¸è›¹è›ºè›»è›¼è›½è›¾è›¿èœ€èœèœ‚蜃蜄蜅蜆蜇蜈蜉蜊蜋蜌èœèœŽèœèœèœ‘蜒蜓蜔蜕蜖蜗蜘蜙蜚蜛蜜èœèœžèœŸèœ èœ¡èœ¢èœ£èœ¤èœ¥èœ¦èœ§èœ¨èœ©èœªèœ«èœ¬èœ­èœ®èœ¯èœ°èœ±èœ²èœ³èœ´èœµèœ¶èœ·èœ¸èœ¹èœºèœ»èœ¼èœ½èœ¾èœ¿è€èè‚èƒè„è…è†è‡èˆè‰èŠè‹èŒèèŽèèè‘è’è“è”è•è–è—è˜è™èšè›èœèèžèŸè è¡è¢è£è¤è¥è¦è§è¨è©èªè«è¬è­è®è¯è°è±è²è³è´èµè¶è·è¸è¹èºè»è¼è½è¾è¿èž€èžèž‚螃螄螅螆螇螈螉螊螋螌èžèžŽèžèžèž‘螒螓螔螕螖螗螘螙螚螛螜èžèžžèžŸèž èž¡èž¢èž£èž¤èž¥èž¦èž§èž¨èž©èžªèž«èž¬èž­èž®èž¯èž°èž±èž²èž³èž´èžµèž¶èž·èž¸èž¹èžºèž»èž¼èž½èž¾èž¿èŸ€èŸèŸ‚蟃蟄蟅蟆蟇蟈蟉蟊蟋蟌èŸèŸŽèŸèŸèŸ‘蟒蟓蟔蟕蟖蟗蟘蟙蟚蟛蟜èŸèŸžèŸŸèŸ èŸ¡èŸ¢èŸ£èŸ¤èŸ¥èŸ¦èŸ§èŸ¨èŸ©èŸªèŸ«èŸ¬èŸ­èŸ®èŸ¯èŸ°èŸ±èŸ²èŸ³èŸ´èŸµèŸ¶èŸ·èŸ¸èŸ¹èŸºèŸ»èŸ¼èŸ½èŸ¾èŸ¿è €è è ‚蠃蠄蠅蠆蠇蠈蠉蠊蠋蠌è è Žè è è ‘蠒蠓蠔蠕蠖蠗蠘蠙蠚蠛蠜è è žè Ÿè  è ¡è ¢è £è ¤è ¥è ¦è §è ¨è ©è ªè «è ¬è ­è ®è ¯è °è ±è ²è ³è ´è µè ¶è ·è ¸è ¹è ºè »è ¼è ½è ¾è ¿è¡€è¡è¡‚衃衄衅衆衇衈衉衊衋行è¡è¡Žè¡è¡è¡‘衒術衔衕衖街衘衙衚衛衜è¡è¡žè¡Ÿè¡ è¡¡è¡¢è¡£è¡¤è¡¥è¡¦è¡§è¡¨è¡©è¡ªè¡«è¡¬è¡­è¡®è¡¯è¡°è¡±è¡²è¡³è¡´è¡µè¡¶è¡·è¡¸è¡¹è¡ºè¡»è¡¼è¡½è¡¾è¡¿è¢€è¢è¢‚袃袄袅袆袇袈袉袊袋袌è¢è¢Žè¢è¢è¢‘袒袓袔袕袖袗袘袙袚袛袜è¢è¢žè¢Ÿè¢ è¢¡è¢¢è¢£è¢¤è¢¥è¢¦è¢§è¢¨è¢©è¢ªè¢«è¢¬è¢­è¢®è¢¯è¢°è¢±è¢²è¢³è¢´è¢µè¢¶è¢·è¢¸è¢¹è¢ºè¢»è¢¼è¢½è¢¾è¢¿è£€è£è£‚裃裄装裆裇裈裉裊裋裌è£è£Žè£è£è£‘裒裓裔裕裖裗裘裙裚裛補è£è£žè£Ÿè£ è£¡è£¢è££è£¤è£¥è£¦è£§è£¨è£©è£ªè£«è£¬è£­è£®è£¯è£°è£±è£²è£³è£´è£µè£¶è£·è£¸è£¹è£ºè£»è£¼è£½è£¾è£¿è¤€è¤è¤‚褃褄褅褆複褈褉褊褋褌è¤è¤Žè¤è¤è¤‘褒褓褔褕褖褗褘褙褚褛褜è¤è¤žè¤Ÿè¤ è¤¡è¤¢è¤£è¤¤è¤¥è¤¦è¤§è¤¨è¤©è¤ªè¤«è¤¬è¤­è¤®è¤¯è¤°è¤±è¤²è¤³è¤´è¤µè¤¶è¤·è¤¸è¤¹è¤ºè¤»è¤¼è¤½è¤¾è¤¿è¥€è¥è¥‚襃襄襅襆襇襈襉襊襋襌è¥è¥Žè¥è¥è¥‘襒襓襔襕襖襗襘襙襚襛襜è¥è¥žè¥Ÿè¥ è¥¡è¥¢è¥£è¥¤è¥¥è¥¦è¥§è¥¨è¥©è¥ªè¥«è¥¬è¥­è¥®è¥¯è¥°è¥±è¥²è¥³è¥´è¥µè¥¶è¥·è¥¸è¥¹è¥ºè¥»è¥¼è¥½è¥¾è¥¿è¦€è¦è¦‚覃覄覅覆覇覈覉覊見覌è¦è¦Žè¦è¦è¦‘覒覓覔覕視覗覘覙覚覛覜è¦è¦žè¦Ÿè¦ è¦¡è¦¢è¦£è¦¤è¦¥è¦¦è¦§è¦¨è¦©è¦ªè¦«è¦¬è¦­è¦®è¦¯è¦°è¦±è¦²è¦³è¦´è¦µè¦¶è¦·è¦¸è¦¹è¦ºè¦»è¦¼è¦½è¦¾è¦¿è§€è§è§‚觃规觅视觇览觉觊觋觌è§è§Žè§è§è§‘角觓觔觕觖觗觘觙觚觛觜è§è§žè§Ÿè§ è§¡è§¢è§£è§¤è§¥è§¦è§§è§¨è§©è§ªè§«è§¬è§­è§®è§¯è§°è§±è§²è§³è§´è§µè§¶è§·è§¸è§¹è§ºè§»è§¼è§½è§¾è§¿è¨€è¨è¨‚訃訄訅訆訇計訉訊訋訌è¨è¨Žè¨è¨è¨‘訒訓訔訕訖託記訙訚訛訜è¨è¨žè¨Ÿè¨ è¨¡è¨¢è¨£è¨¤è¨¥è¨¦è¨§è¨¨è¨©è¨ªè¨«è¨¬è¨­è¨®è¨¯è¨°è¨±è¨²è¨³è¨´è¨µè¨¶è¨·è¨¸è¨¹è¨ºè¨»è¨¼è¨½è¨¾è¨¿è©€è©è©‚詃詄詅詆詇詈詉詊詋詌è©è©Žè©è©è©‘詒詓詔評詖詗詘詙詚詛詜è©è©žè©Ÿè© è©¡è©¢è©£è©¤è©¥è©¦è©§è©¨è©©è©ªè©«è©¬è©­è©®è©¯è©°è©±è©²è©³è©´è©µè©¶è©·è©¸è©¹è©ºè©»è©¼è©½è©¾è©¿èª€èªèª‚誃誄誅誆誇誈誉誊誋誌èªèªŽèªèªèª‘誒誓誔誕誖誗誘誙誚誛誜èªèªžèªŸèª èª¡èª¢èª£èª¤èª¥èª¦èª§èª¨èª©èªªèª«èª¬èª­èª®èª¯èª°èª±èª²èª³èª´èªµèª¶èª·èª¸èª¹èªºèª»èª¼èª½èª¾èª¿è«€è«è«‚諃諄諅諆談諈諉諊請諌è«è«Žè«è«è«‘諒諓諔諕論諗諘諙諚諛諜è«è«žè«Ÿè« è«¡è«¢è«£è«¤è«¥è«¦è«§è«¨è«©è«ªè««è«¬è«­è«®è«¯è«°è«±è«²è«³è«´è«µè«¶è«·è«¸è«¹è«ºè«»è«¼è«½è«¾è«¿è¬€è¬è¬‚謃謄謅謆謇謈謉謊謋謌è¬è¬Žè¬è¬è¬‘謒謓謔謕謖謗謘謙謚講謜è¬è¬žè¬Ÿè¬ è¬¡è¬¢è¬£è¬¤è¬¥è¬¦è¬§è¬¨è¬©è¬ªè¬«è¬¬è¬­è¬®è¬¯è¬°è¬±è¬²è¬³è¬´è¬µè¬¶è¬·è¬¸è¬¹è¬ºè¬»è¬¼è¬½è¬¾è¬¿è­€è­è­‚譃譄譅譆譇譈證譊譋譌è­è­Žè­è­è­‘譒譓譔譕譖譗識譙譚譛譜è­è­žè­Ÿè­ è­¡è­¢è­£è­¤è­¥è­¦è­§è­¨è­©è­ªè­«è­¬è­­è­®è­¯è­°è­±è­²è­³è­´è­µè­¶è­·è­¸è­¹è­ºè­»è­¼è­½è­¾è­¿è®€è®è®‚讃讄讅讆讇讈讉變讋讌è®è®Žè®è®è®‘讒讓讔讕讖讗讘讙讚讛讜è®è®žè®Ÿè® è®¡è®¢è®£è®¤è®¥è®¦è®§è®¨è®©è®ªè®«è®¬è®­è®®è®¯è®°è®±è®²è®³è®´è®µè®¶è®·è®¸è®¹è®ºè®»è®¼è®½è®¾è®¿è¯€è¯è¯‚诃评诅识诇诈诉诊诋诌è¯è¯Žè¯è¯è¯‘诒诓诔试诖诗诘诙诚诛诜è¯è¯žè¯Ÿè¯ è¯¡è¯¢è¯£è¯¤è¯¥è¯¦è¯§è¯¨è¯©è¯ªè¯«è¯¬è¯­è¯®è¯¯è¯°è¯±è¯²è¯³è¯´è¯µè¯¶è¯·è¯¸è¯¹è¯ºè¯»è¯¼è¯½è¯¾è¯¿è°€è°è°‚调谄谅谆谇谈谉谊谋谌è°è°Žè°è°è°‘谒谓谔谕谖谗谘谙谚谛谜è°è°žè°Ÿè° è°¡è°¢è°£è°¤è°¥è°¦è°§è°¨è°©è°ªè°«è°¬è°­è°®è°¯è°°è°±è°²è°³è°´è°µè°¶è°·è°¸è°¹è°ºè°»è°¼è°½è°¾è°¿è±€è±è±‚豃豄豅豆豇豈豉豊豋豌è±è±Žè±è±è±‘豒豓豔豕豖豗豘豙豚豛豜è±è±žè±Ÿè± è±¡è±¢è±£è±¤è±¥è±¦è±§è±¨è±©è±ªè±«è±¬è±­è±®è±¯è±°è±±è±²è±³è±´è±µè±¶è±·è±¸è±¹è±ºè±»è±¼è±½è±¾è±¿è²€è²è²‚貃貄貅貆貇貈貉貊貋貌è²è²Žè²è²è²‘貒貓貔貕貖貗貘貙貚貛貜è²è²žè²Ÿè² è²¡è²¢è²£è²¤è²¥è²¦è²§è²¨è²©è²ªè²«è²¬è²­è²®è²¯è²°è²±è²²è²³è²´è²µè²¶è²·è²¸è²¹è²ºè²»è²¼è²½è²¾è²¿è³€è³è³‚賃賄賅賆資賈賉賊賋賌è³è³Žè³è³è³‘賒賓賔賕賖賗賘賙賚賛賜è³è³žè³Ÿè³ è³¡è³¢è³£è³¤è³¥è³¦è³§è³¨è³©è³ªè³«è³¬è³­è³®è³¯è³°è³±è³²è³³è³´è³µè³¶è³·è³¸è³¹è³ºè³»è³¼è³½è³¾è³¿è´€è´è´‚贃贄贅贆贇贈贉贊贋贌è´è´Žè´è´è´‘贒贓贔贕贖贗贘贙贚贛贜è´è´žè´Ÿè´ è´¡è´¢è´£è´¤è´¥è´¦è´§è´¨è´©è´ªè´«è´¬è´­è´®è´¯è´°è´±è´²è´³è´´è´µè´¶è´·è´¸è´¹è´ºè´»è´¼è´½è´¾è´¿èµ€èµèµ‚赃资赅赆赇赈赉赊赋赌èµèµŽèµèµèµ‘赒赓赔赕赖赗赘赙赚赛赜èµèµžèµŸèµ èµ¡èµ¢èµ£èµ¤èµ¥èµ¦èµ§èµ¨èµ©èµªèµ«èµ¬èµ­èµ®èµ¯èµ°èµ±èµ²èµ³èµ´èµµèµ¶èµ·èµ¸èµ¹èµºèµ»èµ¼èµ½èµ¾èµ¿è¶€è¶è¶‚趃趄超趆趇趈趉越趋趌è¶è¶Žè¶è¶è¶‘趒趓趔趕趖趗趘趙趚趛趜è¶è¶žè¶Ÿè¶ è¶¡è¶¢è¶£è¶¤è¶¥è¶¦è¶§è¶¨è¶©è¶ªè¶«è¶¬è¶­è¶®è¶¯è¶°è¶±è¶²è¶³è¶´è¶µè¶¶è¶·è¶¸è¶¹è¶ºè¶»è¶¼è¶½è¶¾è¶¿è·€è·è·‚跃跄跅跆跇跈跉跊跋跌è·è·Žè·è·è·‘跒跓跔跕跖跗跘跙跚跛跜è·è·žè·Ÿè· è·¡è·¢è·£è·¤è·¥è·¦è·§è·¨è·©è·ªè·«è·¬è·­è·®è·¯è·°è·±è·²è·³è·´è·µè·¶è··è·¸è·¹è·ºè·»è·¼è·½è·¾è·¿è¸€è¸è¸‚踃踄踅踆踇踈踉踊踋踌è¸è¸Žè¸è¸è¸‘踒踓踔踕踖踗踘踙踚踛踜è¸è¸žè¸Ÿè¸ è¸¡è¸¢è¸£è¸¤è¸¥è¸¦è¸§è¸¨è¸©è¸ªè¸«è¸¬è¸­è¸®è¸¯è¸°è¸±è¸²è¸³è¸´è¸µè¸¶è¸·è¸¸è¸¹è¸ºè¸»è¸¼è¸½è¸¾è¸¿è¹€è¹è¹‚蹃蹄蹅蹆蹇蹈蹉蹊蹋蹌è¹è¹Žè¹è¹è¹‘蹒蹓蹔蹕蹖蹗蹘蹙蹚蹛蹜è¹è¹žè¹Ÿè¹ è¹¡è¹¢è¹£è¹¤è¹¥è¹¦è¹§è¹¨è¹©è¹ªè¹«è¹¬è¹­è¹®è¹¯è¹°è¹±è¹²è¹³è¹´è¹µè¹¶è¹·è¹¸è¹¹è¹ºè¹»è¹¼è¹½è¹¾è¹¿èº€èºèº‚躃躄躅躆躇躈躉躊躋躌èºèºŽèºèºèº‘躒躓躔躕躖躗躘躙躚躛躜èºèºžèºŸèº èº¡èº¢èº£èº¤èº¥èº¦èº§èº¨èº©èºªèº«èº¬èº­èº®èº¯èº°èº±èº²èº³èº´èºµèº¶èº·èº¸èº¹èººèº»èº¼èº½èº¾èº¿è»€è»è»‚軃軄軅軆軇軈軉車軋軌è»è»Žè»è»è»‘軒軓軔軕軖軗軘軙軚軛軜è»è»žè»Ÿè» è»¡è»¢è»£è»¤è»¥è»¦è»§è»¨è»©è»ªè»«è»¬è»­è»®è»¯è»°è»±è»²è»³è»´è»µè»¶è»·è»¸è»¹è»ºè»»è»¼è»½è»¾è»¿è¼€è¼è¼‚較輄輅輆輇輈載輊輋輌è¼è¼Žè¼è¼è¼‘輒輓輔輕輖輗輘輙輚輛輜è¼è¼žè¼Ÿè¼ è¼¡è¼¢è¼£è¼¤è¼¥è¼¦è¼§è¼¨è¼©è¼ªè¼«è¼¬è¼­è¼®è¼¯è¼°è¼±è¼²è¼³è¼´è¼µè¼¶è¼·è¼¸è¼¹è¼ºè¼»è¼¼è¼½è¼¾è¼¿è½€è½è½‚轃轄轅轆轇轈轉轊轋轌è½è½Žè½è½è½‘轒轓轔轕轖轗轘轙轚轛轜è½è½žè½Ÿè½ è½¡è½¢è½£è½¤è½¥è½¦è½§è½¨è½©è½ªè½«è½¬è½­è½®è½¯è½°è½±è½²è½³è½´è½µè½¶è½·è½¸è½¹è½ºè½»è½¼è½½è½¾è½¿è¾€è¾è¾‚较辄辅辆辇辈辉辊辋辌è¾è¾Žè¾è¾è¾‘辒输辔辕辖辗辘辙辚辛辜è¾è¾žè¾Ÿè¾ è¾¡è¾¢è¾£è¾¤è¾¥è¾¦è¾§è¾¨è¾©è¾ªè¾«è¾¬è¾­è¾®è¾¯è¾°è¾±è¾²è¾³è¾´è¾µè¾¶è¾·è¾¸è¾¹è¾ºè¾»è¾¼è¾½è¾¾è¾¿è¿€è¿è¿‚迃迄迅迆过迈迉迊迋迌è¿è¿Žè¿è¿è¿‘迒迓返迕迖迗还这迚进远è¿è¿žè¿Ÿè¿ è¿¡è¿¢è¿£è¿¤è¿¥è¿¦è¿§è¿¨è¿©è¿ªè¿«è¿¬è¿­è¿®è¿¯è¿°è¿±è¿²è¿³è¿´è¿µè¿¶è¿·è¿¸è¿¹è¿ºè¿»è¿¼è¿½è¿¾è¿¿é€€é€é€‚逃逄逅逆逇逈选逊逋逌é€é€Žé€é€é€‘递逓途逕逖逗逘這通逛逜é€é€žé€Ÿé€ é€¡é€¢é€£é€¤é€¥é€¦é€§é€¨é€©é€ªé€«é€¬é€­é€®é€¯é€°é€±é€²é€³é€´é€µé€¶é€·é€¸é€¹é€ºé€»é€¼é€½é€¾é€¿é€éé‚éƒé„é…é†é‡éˆé‰éŠé‹éŒééŽééé‘é’é“é”é•é–é—é˜é™éšé›éœééžéŸé é¡é¢é£é¤é¥é¦é§é¨é©éªé«é¬é­é®é¯é°é±é²é³é´éµé¶é·é¸é¹éºé»é¼é½é¾é¿é‚€é‚邂邃還邅邆邇邈邉邊邋邌é‚邎é‚é‚邑邒邓邔邕邖邗邘邙邚邛邜é‚邞邟邠邡邢那邤邥邦邧邨邩邪邫邬邭邮邯邰邱邲邳邴邵邶邷邸邹邺邻邼邽邾邿郀éƒéƒ‚郃郄郅郆郇郈郉郊郋郌éƒéƒŽéƒéƒéƒ‘郒郓郔郕郖郗郘郙郚郛郜éƒéƒžéƒŸéƒ éƒ¡éƒ¢éƒ£éƒ¤éƒ¥éƒ¦éƒ§éƒ¨éƒ©éƒªéƒ«éƒ¬éƒ­éƒ®éƒ¯éƒ°éƒ±éƒ²éƒ³éƒ´éƒµéƒ¶éƒ·éƒ¸éƒ¹éƒºéƒ»éƒ¼éƒ½éƒ¾éƒ¿é„€é„鄂鄃鄄鄅鄆鄇鄈鄉鄊鄋鄌é„鄎é„é„鄑鄒鄓鄔鄕鄖鄗鄘鄙鄚鄛鄜é„鄞鄟鄠鄡鄢鄣鄤鄥鄦鄧鄨鄩鄪鄫鄬鄭鄮鄯鄰鄱鄲鄳鄴鄵鄶鄷鄸鄹鄺鄻鄼鄽鄾鄿酀é…酂酃酄酅酆酇酈酉酊酋酌é…é…Žé…é…酑酒酓酔酕酖酗酘酙酚酛酜é…酞酟酠酡酢酣酤酥酦酧酨酩酪酫酬酭酮酯酰酱酲酳酴酵酶酷酸酹酺酻酼酽酾酿醀é†é†‚醃醄醅醆醇醈醉醊醋醌é†é†Žé†é†é†‘醒醓醔醕醖醗醘醙醚醛醜é†é†žé†Ÿé† é†¡é†¢é†£é†¤é†¥é†¦é†§é†¨é†©é†ªé†«é†¬é†­é†®é†¯é†°é†±é†²é†³é†´é†µé†¶é†·é†¸é†¹é†ºé†»é†¼é†½é†¾é†¿é‡€é‡é‡‚釃釄釅釆采釈釉释釋里é‡é‡Žé‡é‡é‡‘釒釓釔釕釖釗釘釙釚釛釜é‡é‡žé‡Ÿé‡ é‡¡é‡¢é‡£é‡¤é‡¥é‡¦é‡§é‡¨é‡©é‡ªé‡«é‡¬é‡­é‡®é‡¯é‡°é‡±é‡²é‡³é‡´é‡µé‡¶é‡·é‡¸é‡¹é‡ºé‡»é‡¼é‡½é‡¾é‡¿éˆ€éˆéˆ‚鈃鈄鈅鈆鈇鈈鈉鈊鈋鈌éˆéˆŽéˆéˆéˆ‘鈒鈓鈔鈕鈖鈗鈘鈙鈚鈛鈜éˆéˆžéˆŸéˆ éˆ¡éˆ¢éˆ£éˆ¤éˆ¥éˆ¦éˆ§éˆ¨éˆ©éˆªéˆ«éˆ¬éˆ­éˆ®éˆ¯éˆ°éˆ±éˆ²éˆ³éˆ´éˆµéˆ¶éˆ·éˆ¸éˆ¹éˆºéˆ»éˆ¼éˆ½éˆ¾éˆ¿é‰€é‰é‰‚鉃鉄鉅鉆鉇鉈鉉鉊鉋鉌é‰é‰Žé‰é‰é‰‘鉒鉓鉔鉕鉖鉗鉘鉙鉚鉛鉜é‰é‰žé‰Ÿé‰ é‰¡é‰¢é‰£é‰¤é‰¥é‰¦é‰§é‰¨é‰©é‰ªé‰«é‰¬é‰­é‰®é‰¯é‰°é‰±é‰²é‰³é‰´é‰µé‰¶é‰·é‰¸é‰¹é‰ºé‰»é‰¼é‰½é‰¾é‰¿éŠ€éŠéŠ‚éŠƒéŠ„éŠ…éŠ†éŠ‡éŠˆéŠ‰éŠŠéŠ‹éŠŒéŠéŠŽéŠéŠéŠ‘éŠ’éŠ“éŠ”éŠ•éŠ–éŠ—éŠ˜éŠ™éŠšéŠ›éŠœéŠéŠžéŠŸéŠ éŠ¡éŠ¢éŠ£éŠ¤éŠ¥éŠ¦éŠ§éŠ¨éŠ©éŠªéŠ«éŠ¬éŠ­éŠ®éŠ¯éŠ°éŠ±éŠ²éŠ³éŠ´éŠµéŠ¶éŠ·éŠ¸éŠ¹éŠºéŠ»éŠ¼éŠ½éŠ¾éŠ¿é‹€é‹é‹‚鋃鋄鋅鋆鋇鋈鋉鋊鋋鋌é‹é‹Žé‹é‹é‹‘鋒鋓鋔鋕鋖鋗鋘鋙鋚鋛鋜é‹é‹žé‹Ÿé‹ é‹¡é‹¢é‹£é‹¤é‹¥é‹¦é‹§é‹¨é‹©é‹ªé‹«é‹¬é‹­é‹®é‹¯é‹°é‹±é‹²é‹³é‹´é‹µé‹¶é‹·é‹¸é‹¹é‹ºé‹»é‹¼é‹½é‹¾é‹¿éŒ€éŒéŒ‚錃錄錅錆錇錈錉錊錋錌éŒéŒŽéŒéŒéŒ‘錒錓錔錕錖錗錘錙錚錛錜éŒéŒžéŒŸéŒ éŒ¡éŒ¢éŒ£éŒ¤éŒ¥éŒ¦éŒ§éŒ¨éŒ©éŒªéŒ«éŒ¬éŒ­éŒ®éŒ¯éŒ°éŒ±éŒ²éŒ³éŒ´éŒµéŒ¶éŒ·éŒ¸éŒ¹éŒºéŒ»éŒ¼éŒ½éŒ¾éŒ¿é€éé‚éƒé„é…é†é‡éˆé‰éŠé‹éŒééŽééé‘é’é“é”é•é–é—é˜é™éšé›éœééžéŸé é¡é¢é£é¤é¥é¦é§é¨é©éªé«é¬é­é®é¯é°é±é²é³é´éµé¶é·é¸é¹éºé»é¼é½é¾é¿éŽ€éŽéŽ‚éŽƒéŽ„éŽ…éŽ†éŽ‡éŽˆéŽ‰éŽŠéŽ‹éŽŒéŽéŽŽéŽéŽéŽ‘éŽ’éŽ“éŽ”éŽ•éŽ–éŽ—éŽ˜éŽ™éŽšéŽ›éŽœéŽéŽžéŽŸéŽ éŽ¡éŽ¢éŽ£éŽ¤éŽ¥éŽ¦éŽ§éŽ¨éŽ©éŽªéŽ«éŽ¬éŽ­éŽ®éŽ¯éŽ°éŽ±éŽ²éŽ³éŽ´éŽµéŽ¶éŽ·éŽ¸éŽ¹éŽºéŽ»éŽ¼éŽ½éŽ¾éŽ¿é€éé‚éƒé„é…é†é‡éˆé‰éŠé‹éŒééŽééé‘é’é“é”é•é–é—é˜é™éšé›éœééžéŸé é¡é¢é£é¤é¥é¦é§é¨é©éªé«é¬é­é®é¯é°é±é²é³é´éµé¶é·é¸é¹éºé»é¼é½é¾é¿é€éé‚éƒé„é…é†é‡éˆé‰éŠé‹éŒééŽééé‘é’é“é”é•é–é—é˜é™éšé›éœééžéŸé é¡é¢é£é¤é¥é¦é§é¨é©éªé«é¬é­é®é¯é°é±é²é³é´éµé¶é·é¸é¹éºé»é¼é½é¾é¿é‘€é‘鑂鑃鑄鑅鑆鑇鑈鑉鑊鑋鑌é‘鑎é‘é‘鑑鑒鑓鑔鑕鑖鑗鑘鑙鑚鑛鑜é‘鑞鑟鑠鑡鑢鑣鑤鑥鑦鑧鑨鑩鑪鑫鑬鑭鑮鑯鑰鑱鑲鑳鑴鑵鑶鑷鑸鑹鑺鑻鑼鑽鑾鑿钀é’钂钃钄钅钆钇针钉钊钋钌é’é’Žé’é’钑钒钓钔钕钖钗钘钙钚钛钜é’钞钟钠钡钢钣钤钥钦钧钨钩钪钫钬钭钮钯钰钱钲钳钴钵钶钷钸钹钺钻钼钽钾钿铀é“铂铃铄铅铆铇铈铉铊铋铌é“铎é“é“铑铒铓铔铕铖铗铘铙铚铛铜é“铞铟铠铡铢铣铤铥铦铧铨铩铪铫铬铭铮铯铰铱铲铳铴铵银铷铸铹铺铻铼铽链铿销é”锂锃锄锅锆锇锈锉锊锋锌é”锎é”é”锑锒锓锔锕锖锗锘错锚锛锜é”锞锟锠锡锢锣锤锥锦锧锨锩锪锫锬锭键锯锰锱锲锳锴锵锶锷锸锹锺锻锼锽锾锿镀é•镂镃镄镅镆镇镈镉镊镋镌é•镎é•é•镑镒镓镔镕镖镗镘镙镚镛镜é•镞镟镠镡镢镣镤镥镦镧镨镩镪镫镬镭镮镯镰镱镲镳镴镵镶長镸镹镺镻镼镽镾长門é–閂閃閄閅閆閇閈閉閊開閌é–é–Žé–é–閑閒間閔閕閖閗閘閙閚閛閜é–閞閟閠閡関閣閤閥閦閧閨閩閪閫閬閭閮閯閰閱閲閳閴閵閶閷閸閹閺閻閼閽閾閿闀é—闂闃闄闅闆闇闈闉闊闋闌é—é—Žé—é—闑闒闓闔闕闖闗闘闙闚闛關é—闞闟闠闡闢闣闤闥闦闧门闩闪闫闬闭问闯闰闱闲闳间闵闶闷闸闹闺闻闼闽闾闿阀é˜é˜‚阃阄阅阆阇阈阉阊阋阌é˜é˜Žé˜é˜é˜‘阒阓阔阕阖阗阘阙阚阛阜é˜é˜žé˜Ÿé˜ é˜¡é˜¢é˜£é˜¤é˜¥é˜¦é˜§é˜¨é˜©é˜ªé˜«é˜¬é˜­é˜®é˜¯é˜°é˜±é˜²é˜³é˜´é˜µé˜¶é˜·é˜¸é˜¹é˜ºé˜»é˜¼é˜½é˜¾é˜¿é™€é™é™‚陃附际陆陇陈陉陊陋陌é™é™Žé™é™é™‘陒陓陔陕陖陗陘陙陚陛陜é™é™žé™Ÿé™ é™¡é™¢é™£é™¤é™¥é™¦é™§é™¨é™©é™ªé™«é™¬é™­é™®é™¯é™°é™±é™²é™³é™´é™µé™¶é™·é™¸é™¹é™ºé™»é™¼é™½é™¾é™¿éš€éšéš‚隃隄隅隆隇隈隉隊隋隌éšéšŽéšéšéš‘隒隓隔隕隖隗隘隙隚際障éšéšžéšŸéš éš¡éš¢éš£éš¤éš¥éš¦éš§éš¨éš©éšªéš«éš¬éš­éš®éš¯éš°éš±éš²éš³éš´éšµéš¶éš·éš¸éš¹éšºéš»éš¼éš½éš¾éš¿é›€é›é›‚雃雄雅集雇雈雉雊雋雌é›é›Žé›é›é›‘雒雓雔雕雖雗雘雙雚雛雜é›é›žé›Ÿé› é›¡é›¢é›£é›¤é›¥é›¦é›§é›¨é›©é›ªé›«é›¬é›­é›®é›¯é›°é›±é›²é›³é›´é›µé›¶é›·é›¸é›¹é›ºé›»é›¼é›½é›¾é›¿éœ€éœéœ‚霃霄霅霆震霈霉霊霋霌éœéœŽéœéœéœ‘霒霓霔霕霖霗霘霙霚霛霜éœéœžéœŸéœ éœ¡éœ¢éœ£éœ¤éœ¥éœ¦éœ§éœ¨éœ©éœªéœ«éœ¬éœ­éœ®éœ¯éœ°éœ±éœ²éœ³éœ´éœµéœ¶éœ·éœ¸éœ¹éœºéœ»éœ¼éœ½éœ¾éœ¿é€éé‚éƒé„é…é†é‡éˆé‰éŠé‹éŒééŽééé‘é’é“é”é•é–é—é˜é™éšé›éœééžéŸé é¡é¢é£é¤é¥é¦é§é¨é©éªé«é¬é­é®é¯é°é±é²é³é´éµé¶é·é¸é¹éºé»é¼é½é¾é¿éž€éžéž‚鞃鞄鞅鞆鞇鞈鞉鞊鞋鞌éžéžŽéžéžéž‘鞒鞓鞔鞕鞖鞗鞘鞙鞚鞛鞜éžéžžéžŸéž éž¡éž¢éž£éž¤éž¥éž¦éž§éž¨éž©éžªéž«éž¬éž­éž®éž¯éž°éž±éž²éž³éž´éžµéž¶éž·éž¸éž¹éžºéž»éž¼éž½éž¾éž¿éŸ€éŸéŸ‚韃韄韅韆韇韈韉韊韋韌éŸéŸŽéŸéŸéŸ‘韒韓韔韕韖韗韘韙韚韛韜éŸéŸžéŸŸéŸ éŸ¡éŸ¢éŸ£éŸ¤éŸ¥éŸ¦éŸ§éŸ¨éŸ©éŸªéŸ«éŸ¬éŸ­éŸ®éŸ¯éŸ°éŸ±éŸ²éŸ³éŸ´éŸµéŸ¶éŸ·éŸ¸éŸ¹éŸºéŸ»éŸ¼éŸ½éŸ¾éŸ¿é €é é ‚頃頄項順頇須頉頊頋頌é é Žé é é ‘頒頓頔頕頖頗領頙頚頛頜é é žé Ÿé  é ¡é ¢é £é ¤é ¥é ¦é §é ¨é ©é ªé «é ¬é ­é ®é ¯é °é ±é ²é ³é ´é µé ¶é ·é ¸é ¹é ºé »é ¼é ½é ¾é ¿é¡€é¡é¡‚顃顄顅顆顇顈顉顊顋題é¡é¡Žé¡é¡é¡‘顒顓顔顕顖顗願顙顚顛顜é¡é¡žé¡Ÿé¡ é¡¡é¡¢é¡£é¡¤é¡¥é¡¦é¡§é¡¨é¡©é¡ªé¡«é¡¬é¡­é¡®é¡¯é¡°é¡±é¡²é¡³é¡´é¡µé¡¶é¡·é¡¸é¡¹é¡ºé¡»é¡¼é¡½é¡¾é¡¿é¢€é¢é¢‚颃预颅领颇颈颉颊颋颌é¢é¢Žé¢é¢é¢‘颒颓颔颕颖颗题颙颚颛颜é¢é¢žé¢Ÿé¢ é¢¡é¢¢é¢£é¢¤é¢¥é¢¦é¢§é¢¨é¢©é¢ªé¢«é¢¬é¢­é¢®é¢¯é¢°é¢±é¢²é¢³é¢´é¢µé¢¶é¢·é¢¸é¢¹é¢ºé¢»é¢¼é¢½é¢¾é¢¿é£€é£é£‚飃飄飅飆飇飈飉飊飋飌é£é£Žé£é£é£‘飒飓飔飕飖飗飘飙飚飛飜é£é£žé£Ÿé£ é£¡é£¢é££é£¤é£¥é£¦é£§é£¨é£©é£ªé£«é£¬é£­é£®é£¯é£°é£±é£²é£³é£´é£µé£¶é£·é£¸é£¹é£ºé£»é£¼é£½é£¾é£¿é¤€é¤é¤‚餃餄餅餆餇餈餉養餋餌é¤é¤Žé¤é¤é¤‘餒餓餔餕餖餗餘餙餚餛餜é¤é¤žé¤Ÿé¤ é¤¡é¤¢é¤£é¤¤é¤¥é¤¦é¤§é¤¨é¤©é¤ªé¤«é¤¬é¤­é¤®é¤¯é¤°é¤±é¤²é¤³é¤´é¤µé¤¶é¤·é¤¸é¤¹é¤ºé¤»é¤¼é¤½é¤¾é¤¿é¥€é¥é¥‚饃饄饅饆饇饈饉饊饋饌é¥é¥Žé¥é¥é¥‘饒饓饔饕饖饗饘饙饚饛饜é¥é¥žé¥Ÿé¥ é¥¡é¥¢é¥£é¥¤é¥¥é¥¦é¥§é¥¨é¥©é¥ªé¥«é¥¬é¥­é¥®é¥¯é¥°é¥±é¥²é¥³é¥´é¥µé¥¶é¥·é¥¸é¥¹é¥ºé¥»é¥¼é¥½é¥¾é¥¿é¦€é¦é¦‚馃馄馅馆馇馈馉馊馋馌é¦é¦Žé¦é¦é¦‘馒馓馔馕首馗馘香馚馛馜é¦é¦žé¦Ÿé¦ é¦¡é¦¢é¦£é¦¤é¦¥é¦¦é¦§é¦¨é¦©é¦ªé¦«é¦¬é¦­é¦®é¦¯é¦°é¦±é¦²é¦³é¦´é¦µé¦¶é¦·é¦¸é¦¹é¦ºé¦»é¦¼é¦½é¦¾é¦¿é§€é§é§‚駃駄駅駆駇駈駉駊駋駌é§é§Žé§é§é§‘駒駓駔駕駖駗駘駙駚駛駜é§é§žé§Ÿé§ é§¡é§¢é§£é§¤é§¥é§¦é§§é§¨é§©é§ªé§«é§¬é§­é§®é§¯é§°é§±é§²é§³é§´é§µé§¶é§·é§¸é§¹é§ºé§»é§¼é§½é§¾é§¿é¨€é¨é¨‚騃騄騅騆騇騈騉騊騋騌é¨é¨Žé¨é¨é¨‘騒験騔騕騖騗騘騙騚騛騜é¨é¨žé¨Ÿé¨ é¨¡é¨¢é¨£é¨¤é¨¥é¨¦é¨§é¨¨é¨©é¨ªé¨«é¨¬é¨­é¨®é¨¯é¨°é¨±é¨²é¨³é¨´é¨µé¨¶é¨·é¨¸é¨¹é¨ºé¨»é¨¼é¨½é¨¾é¨¿é©€é©é©‚驃驄驅驆驇驈驉驊驋驌é©é©Žé©é©é©‘驒驓驔驕驖驗驘驙驚驛驜é©é©žé©Ÿé© é©¡é©¢é©£é©¤é©¥é©¦é©§é©¨é©©é©ªé©«é©¬é©­é©®é©¯é©°é©±é©²é©³é©´é©µé©¶é©·é©¸é©¹é©ºé©»é©¼é©½é©¾é©¿éª€éªéª‚骃骄骅骆骇骈骉骊骋验éªéªŽéªéªéª‘骒骓骔骕骖骗骘骙骚骛骜éªéªžéªŸéª éª¡éª¢éª£éª¤éª¥éª¦éª§éª¨éª©éªªéª«éª¬éª­éª®éª¯éª°éª±éª²éª³éª´éªµéª¶éª·éª¸éª¹éªºéª»éª¼éª½éª¾éª¿é«€é«é«‚髃髄髅髆髇髈髉髊髋髌é«é«Žé«é«é«‘髒髓體髕髖髗高髙髚髛髜é«é«žé«Ÿé« é«¡é«¢é«£é«¤é«¥é«¦é«§é«¨é«©é«ªé««é«¬é«­é«®é«¯é«°é«±é«²é«³é«´é«µé«¶é«·é«¸é«¹é«ºé«»é«¼é«½é«¾é«¿é¬€é¬é¬‚鬃鬄鬅鬆鬇鬈鬉鬊鬋鬌é¬é¬Žé¬é¬é¬‘鬒鬓鬔鬕鬖鬗鬘鬙鬚鬛鬜é¬é¬žé¬Ÿé¬ é¬¡é¬¢é¬£é¬¤é¬¥é¬¦é¬§é¬¨é¬©é¬ªé¬«é¬¬é¬­é¬®é¬¯é¬°é¬±é¬²é¬³é¬´é¬µé¬¶é¬·é¬¸é¬¹é¬ºé¬»é¬¼é¬½é¬¾é¬¿é­€é­é­‚魃魄魅魆魇魈魉魊魋魌é­é­Žé­é­é­‘魒魓魔魕魖魗魘魙魚魛魜é­é­žé­Ÿé­ é­¡é­¢é­£é­¤é­¥é­¦é­§é­¨é­©é­ªé­«é­¬é­­é­®é­¯é­°é­±é­²é­³é­´é­µé­¶é­·é­¸é­¹é­ºé­»é­¼é­½é­¾é­¿é®€é®é®‚鮃鮄鮅鮆鮇鮈鮉鮊鮋鮌é®é®Žé®é®é®‘鮒鮓鮔鮕鮖鮗鮘鮙鮚鮛鮜é®é®žé®Ÿé® é®¡é®¢é®£é®¤é®¥é®¦é®§é®¨é®©é®ªé®«é®¬é®­é®®é®¯é®°é®±é®²é®³é®´é®µé®¶é®·é®¸é®¹é®ºé®»é®¼é®½é®¾é®¿é¯€é¯é¯‚鯃鯄鯅鯆鯇鯈鯉鯊鯋鯌é¯é¯Žé¯é¯é¯‘鯒鯓鯔鯕鯖鯗鯘鯙鯚鯛鯜é¯é¯žé¯Ÿé¯ é¯¡é¯¢é¯£é¯¤é¯¥é¯¦é¯§é¯¨é¯©é¯ªé¯«é¯¬é¯­é¯®é¯¯é¯°é¯±é¯²é¯³é¯´é¯µé¯¶é¯·é¯¸é¯¹é¯ºé¯»é¯¼é¯½é¯¾é¯¿é°€é°é°‚鰃鰄鰅鰆鰇鰈鰉鰊鰋鰌é°é°Žé°é°é°‘鰒鰓鰔鰕鰖鰗鰘鰙鰚鰛鰜é°é°žé°Ÿé° é°¡é°¢é°£é°¤é°¥é°¦é°§é°¨é°©é°ªé°«é°¬é°­é°®é°¯é°°é°±é°²é°³é°´é°µé°¶é°·é°¸é°¹é°ºé°»é°¼é°½é°¾é°¿é±€é±é±‚鱃鱄鱅鱆鱇鱈鱉鱊鱋鱌é±é±Žé±é±é±‘鱒鱓鱔鱕鱖鱗鱘鱙鱚鱛鱜é±é±žé±Ÿé± é±¡é±¢é±£é±¤é±¥é±¦é±§é±¨é±©é±ªé±«é±¬é±­é±®é±¯é±°é±±é±²é±³é±´é±µé±¶é±·é±¸é±¹é±ºé±»é±¼é±½é±¾é±¿é²€é²é²‚鲃鲄鲅鲆鲇鲈鲉鲊鲋鲌é²é²Žé²é²é²‘鲒鲓鲔鲕鲖鲗鲘鲙鲚鲛鲜é²é²žé²Ÿé² é²¡é²¢é²£é²¤é²¥é²¦é²§é²¨é²©é²ªé²«é²¬é²­é²®é²¯é²°é²±é²²é²³é²´é²µé²¶é²·é²¸é²¹é²ºé²»é²¼é²½é²¾é²¿é³€é³é³‚鳃鳄鳅鳆鳇鳈鳉鳊鳋鳌é³é³Žé³é³é³‘鳒鳓鳔鳕鳖鳗鳘鳙鳚鳛鳜é³é³žé³Ÿé³ é³¡é³¢é³£é³¤é³¥é³¦é³§é³¨é³©é³ªé³«é³¬é³­é³®é³¯é³°é³±é³²é³³é³´é³µé³¶é³·é³¸é³¹é³ºé³»é³¼é³½é³¾é³¿é´€é´é´‚鴃鴄鴅鴆鴇鴈鴉鴊鴋鴌é´é´Žé´é´é´‘鴒鴓鴔鴕鴖鴗鴘鴙鴚鴛鴜é´é´žé´Ÿé´ é´¡é´¢é´£é´¤é´¥é´¦é´§é´¨é´©é´ªé´«é´¬é´­é´®é´¯é´°é´±é´²é´³é´´é´µé´¶é´·é´¸é´¹é´ºé´»é´¼é´½é´¾é´¿éµ€éµéµ‚鵃鵄鵅鵆鵇鵈鵉鵊鵋鵌éµéµŽéµéµéµ‘鵒鵓鵔鵕鵖鵗鵘鵙鵚鵛鵜éµéµžéµŸéµ éµ¡éµ¢éµ£éµ¤éµ¥éµ¦éµ§éµ¨éµ©éµªéµ«éµ¬éµ­éµ®éµ¯éµ°éµ±éµ²éµ³éµ´éµµéµ¶éµ·éµ¸éµ¹éµºéµ»éµ¼éµ½éµ¾éµ¿é¶€é¶é¶‚鶃鶄鶅鶆鶇鶈鶉鶊鶋鶌é¶é¶Žé¶é¶é¶‘鶒鶓鶔鶕鶖鶗鶘鶙鶚鶛鶜é¶é¶žé¶Ÿé¶ é¶¡é¶¢é¶£é¶¤é¶¥é¶¦é¶§é¶¨é¶©é¶ªé¶«é¶¬é¶­é¶®é¶¯é¶°é¶±é¶²é¶³é¶´é¶µé¶¶é¶·é¶¸é¶¹é¶ºé¶»é¶¼é¶½é¶¾é¶¿é·€é·é·‚鷃鷄鷅鷆鷇鷈鷉鷊鷋鷌é·é·Žé·é·é·‘鷒鷓鷔鷕鷖鷗鷘鷙鷚鷛鷜é·é·žé·Ÿé· é·¡é·¢é·£é·¤é·¥é·¦é·§é·¨é·©é·ªé·«é·¬é·­é·®é·¯é·°é·±é·²é·³é·´é·µé·¶é··é·¸é·¹é·ºé·»é·¼é·½é·¾é·¿é¸€é¸é¸‚鸃鸄鸅鸆鸇鸈鸉鸊鸋鸌é¸é¸Žé¸é¸é¸‘鸒鸓鸔鸕鸖鸗鸘鸙鸚鸛鸜é¸é¸žé¸Ÿé¸ é¸¡é¸¢é¸£é¸¤é¸¥é¸¦é¸§é¸¨é¸©é¸ªé¸«é¸¬é¸­é¸®é¸¯é¸°é¸±é¸²é¸³é¸´é¸µé¸¶é¸·é¸¸é¸¹é¸ºé¸»é¸¼é¸½é¸¾é¸¿é¹€é¹é¹‚鹃鹄鹅鹆鹇鹈鹉鹊鹋鹌é¹é¹Žé¹é¹é¹‘鹒鹓鹔鹕鹖鹗鹘鹙鹚鹛鹜é¹é¹žé¹Ÿé¹ é¹¡é¹¢é¹£é¹¤é¹¥é¹¦é¹§é¹¨é¹©é¹ªé¹«é¹¬é¹­é¹®é¹¯é¹°é¹±é¹²é¹³é¹´é¹µé¹¶é¹·é¹¸é¹¹é¹ºé¹»é¹¼é¹½é¹¾é¹¿éº€éºéº‚麃麄麅麆麇麈麉麊麋麌éºéºŽéºéºéº‘麒麓麔麕麖麗麘麙麚麛麜éºéºžéºŸéº éº¡éº¢éº£éº¤éº¥éº¦éº§éº¨éº©éºªéº«éº¬éº­éº®éº¯éº°éº±éº²éº³éº´éºµéº¶éº·éº¸éº¹éººéº»éº¼éº½éº¾éº¿é»€é»é»‚黃黄黅黆黇黈黉黊黋黌é»é»Žé»é»é»‘黒黓黔黕黖黗默黙黚黛黜é»é»žé»Ÿé» é»¡é»¢é»£é»¤é»¥é»¦é»§é»¨é»©é»ªé»«é»¬é»­é»®é»¯é»°é»±é»²é»³é»´é»µé»¶é»·é»¸é»¹é»ºé»»é»¼é»½é»¾é»¿é¼€é¼é¼‚鼃鼄鼅鼆鼇鼈鼉鼊鼋鼌é¼é¼Žé¼é¼é¼‘鼒鼓鼔鼕鼖鼗鼘鼙鼚鼛鼜é¼é¼žé¼Ÿé¼ é¼¡é¼¢é¼£é¼¤é¼¥é¼¦é¼§é¼¨é¼©é¼ªé¼«é¼¬é¼­é¼®é¼¯é¼°é¼±é¼²é¼³é¼´é¼µé¼¶é¼·é¼¸é¼¹é¼ºé¼»é¼¼é¼½é¼¾é¼¿é½€é½é½‚齃齄齅齆齇齈齉齊齋齌é½é½Žé½é½é½‘齒齓齔齕齖齗齘齙齚齛齜é½é½žé½Ÿé½ é½¡é½¢é½£é½¤é½¥é½¦é½§é½¨é½©é½ªé½«é½¬é½­é½®é½¯é½°é½±é½²é½³é½´é½µé½¶é½·é½¸é½¹é½ºé½»é½¼é½½é½¾é½¿é¾€é¾é¾‚龃龄龅龆龇龈龉龊龋龌é¾é¾Žé¾é¾é¾‘龒龓龔龕龖龗龘龙龚龛龜é¾é¾žé¾Ÿé¾ é¾¡é¾¢é¾£é¾¤é¾¥é¾¦é¾§é¾¨é¾©é¾ªé¾«é¾¬é¾­é¾®é¾¯é¾°é¾±é¾²é¾³é¾´é¾µé¾¶é¾·é¾¸é¾¹é¾ºé¾»é¾¼é¾½é¾¾é¾¿é¿€é¿é¿‚鿃鿄鿅鿆鿇鿈鿉鿊鿋\u9fcc\u9fcd\u9fce\u9fcf\u9fd0\u9fd1\u9fd2\u9fd3\u9fd4\u9fd5\u9fd6\u9fd7\u9fd8\u9fd9\u9fda\u9fdb\u9fdc\u9fdd\u9fde\u9fdf\u9fe0\u9fe1\u9fe2\u9fe3\u9fe4\u9fe5\u9fe6\u9fe7\u9fe8\u9fe9\u9fea\u9feb\u9fec\u9fed\u9fee\u9fef\u9ff0\u9ff1\u9ff2\u9ff3\u9ff4\u9ff5\u9ff6\u9ff7\u9ff8\u9ff9\u9ffa\u9ffb\u9ffc\u9ffd\u9ffe\u9fff', ',') satisfies matches($s, '^(?:\\p{IsCJKUnifiedIdeographs}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsCJKUnifiedIdeographs}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00285() { final XQuery query = new XQuery( "(every $s in tokenize('ꀀ\ua48f,ꀀê€ê€‚ꀃꀄꀅꀆꀇꀈꀉꀊꀋꀌê€ê€Žê€ê€ê€‘ꀒꀓꀔꀕꀖꀗꀘꀙꀚꀛꀜê€ê€žê€Ÿê€ ê€¡ê€¢ê€£ê€¤ê€¥ê€¦ê€§ê€¨ê€©ê€ªê€«ê€¬ê€­ê€®ê€¯ê€°ê€±ê€²ê€³ê€´ê€µê€¶ê€·ê€¸ê€¹ê€ºê€»ê€¼ê€½ê€¾ê€¿ê€êê‚êƒê„ê…ê†ê‡êˆê‰êŠê‹êŒêêŽêêê‘ê’ê“ê”ê•ê–ê—ê˜ê™êšê›êœêêžêŸê ê¡ê¢ê£ê¤ê¥ê¦ê§ê¨ê©êªê«ê¬ê­ê®ê¯ê°ê±ê²ê³ê´êµê¶ê·ê¸ê¹êºê»ê¼ê½ê¾ê¿ê‚€ê‚ꂂꂃꂄꂅꂆꂇꂈꂉꂊꂋꂌê‚ꂎê‚ê‚ꂑꂒꂓꂔꂕꂖꂗꂘꂙꂚꂛꂜê‚ꂞꂟꂠꂡꂢꂣꂤꂥꂦꂧꂨꂩꂪꂫꂬꂭꂮꂯꂰꂱꂲꂳꂴꂵꂶꂷꂸꂹꂺꂻꂼꂽꂾꂿꃀêƒêƒ‚ꃃꃄꃅꃆꃇꃈꃉꃊꃋꃌêƒêƒŽêƒêƒêƒ‘ꃒꃓꃔꃕꃖꃗꃘꃙꃚꃛꃜêƒêƒžêƒŸêƒ êƒ¡êƒ¢êƒ£êƒ¤êƒ¥êƒ¦êƒ§êƒ¨êƒ©êƒªêƒ«êƒ¬êƒ­êƒ®êƒ¯êƒ°êƒ±êƒ²êƒ³êƒ´êƒµêƒ¶êƒ·êƒ¸êƒ¹êƒºêƒ»êƒ¼êƒ½êƒ¾êƒ¿ê„€ê„ꄂꄃꄄꄅꄆꄇꄈꄉꄊꄋꄌê„ꄎê„ê„ꄑꄒꄓꄔꄕꄖꄗꄘꄙꄚꄛꄜê„ꄞꄟꄠꄡꄢꄣꄤꄥꄦꄧꄨꄩꄪꄫꄬꄭꄮꄯꄰꄱꄲꄳꄴꄵꄶꄷꄸꄹꄺꄻꄼꄽꄾꄿꅀê…ꅂꅃꅄꅅꅆꅇꅈꅉꅊꅋꅌê…ê…Žê…ê…ꅑꅒꅓꅔꅕꅖꅗꅘꅙꅚꅛꅜê…ꅞꅟꅠꅡꅢꅣꅤꅥꅦꅧꅨꅩꅪꅫꅬꅭꅮꅯꅰꅱꅲꅳꅴꅵꅶꅷꅸꅹꅺꅻꅼꅽꅾꅿꆀê†ê†‚ꆃꆄꆅꆆꆇꆈꆉꆊꆋꆌê†ê†Žê†ê†ê†‘ꆒꆓꆔꆕꆖꆗꆘꆙꆚꆛꆜê†ê†žê†Ÿê† ê†¡ê†¢ê†£ê†¤ê†¥ê†¦ê†§ê†¨ê†©ê†ªê†«ê†¬ê†­ê†®ê†¯ê†°ê†±ê†²ê†³ê†´ê†µê†¶ê†·ê†¸ê†¹ê†ºê†»ê†¼ê†½ê†¾ê†¿ê‡€ê‡ê‡‚ꇃꇄꇅꇆꇇꇈꇉꇊꇋꇌê‡ê‡Žê‡ê‡ê‡‘ꇒꇓꇔꇕꇖꇗꇘꇙꇚꇛꇜê‡ê‡žê‡Ÿê‡ ê‡¡ê‡¢ê‡£ê‡¤ê‡¥ê‡¦ê‡§ê‡¨ê‡©ê‡ªê‡«ê‡¬ê‡­ê‡®ê‡¯ê‡°ê‡±ê‡²ê‡³ê‡´ê‡µê‡¶ê‡·ê‡¸ê‡¹ê‡ºê‡»ê‡¼ê‡½ê‡¾ê‡¿êˆ€êˆêˆ‚ꈃꈄꈅꈆꈇꈈꈉꈊꈋꈌêˆêˆŽêˆêˆêˆ‘ꈒꈓꈔꈕꈖꈗꈘꈙꈚꈛꈜêˆêˆžêˆŸêˆ êˆ¡êˆ¢êˆ£êˆ¤êˆ¥êˆ¦êˆ§êˆ¨êˆ©êˆªêˆ«êˆ¬êˆ­êˆ®êˆ¯êˆ°êˆ±êˆ²êˆ³êˆ´êˆµêˆ¶êˆ·êˆ¸êˆ¹êˆºêˆ»êˆ¼êˆ½êˆ¾êˆ¿ê‰€ê‰ê‰‚ꉃꉄꉅꉆꉇꉈꉉꉊꉋꉌê‰ê‰Žê‰ê‰ê‰‘ꉒꉓꉔꉕꉖꉗꉘꉙꉚꉛꉜê‰ê‰žê‰Ÿê‰ ê‰¡ê‰¢ê‰£ê‰¤ê‰¥ê‰¦ê‰§ê‰¨ê‰©ê‰ªê‰«ê‰¬ê‰­ê‰®ê‰¯ê‰°ê‰±ê‰²ê‰³ê‰´ê‰µê‰¶ê‰·ê‰¸ê‰¹ê‰ºê‰»ê‰¼ê‰½ê‰¾ê‰¿êŠ€êŠêŠ‚êŠƒêŠ„êŠ…êŠ†êŠ‡êŠˆêŠ‰êŠŠêŠ‹êŠŒêŠêŠŽêŠêŠêŠ‘êŠ’êŠ“êŠ”êŠ•êŠ–êŠ—êŠ˜êŠ™êŠšêŠ›êŠœêŠêŠžêŠŸêŠ êŠ¡êŠ¢êŠ£êŠ¤êŠ¥êŠ¦êŠ§êŠ¨êŠ©êŠªêŠ«êŠ¬êŠ­êŠ®êŠ¯êŠ°êŠ±êŠ²êŠ³êŠ´êŠµêŠ¶êŠ·êŠ¸êŠ¹êŠºêŠ»êŠ¼êŠ½êŠ¾êŠ¿ê‹€ê‹ê‹‚ꋃꋄꋅꋆꋇꋈꋉꋊꋋꋌê‹ê‹Žê‹ê‹ê‹‘ꋒꋓꋔꋕꋖꋗꋘꋙꋚꋛꋜê‹ê‹žê‹Ÿê‹ ê‹¡ê‹¢ê‹£ê‹¤ê‹¥ê‹¦ê‹§ê‹¨ê‹©ê‹ªê‹«ê‹¬ê‹­ê‹®ê‹¯ê‹°ê‹±ê‹²ê‹³ê‹´ê‹µê‹¶ê‹·ê‹¸ê‹¹ê‹ºê‹»ê‹¼ê‹½ê‹¾ê‹¿êŒ€êŒêŒ‚ꌃꌄꌅꌆꌇꌈꌉꌊꌋꌌêŒêŒŽêŒêŒêŒ‘ꌒꌓꌔꌕꌖꌗꌘꌙꌚꌛꌜêŒêŒžêŒŸêŒ êŒ¡êŒ¢êŒ£êŒ¤êŒ¥êŒ¦êŒ§êŒ¨êŒ©êŒªêŒ«êŒ¬êŒ­êŒ®êŒ¯êŒ°êŒ±êŒ²êŒ³êŒ´êŒµêŒ¶êŒ·êŒ¸êŒ¹êŒºêŒ»êŒ¼êŒ½êŒ¾êŒ¿ê€êê‚êƒê„ê…ê†ê‡êˆê‰êŠê‹êŒêêŽêêê‘ê’ê“ê”ê•ê–ê—ê˜ê™êšê›êœêêžêŸê ê¡ê¢ê£ê¤ê¥ê¦ê§ê¨ê©êªê«ê¬ê­ê®ê¯ê°ê±ê²ê³ê´êµê¶ê·ê¸ê¹êºê»ê¼ê½ê¾ê¿êŽ€êŽêŽ‚êŽƒêŽ„êŽ…êŽ†êŽ‡êŽˆêŽ‰êŽŠêŽ‹êŽŒêŽêŽŽêŽêŽêŽ‘êŽ’êŽ“êŽ”êŽ•êŽ–êŽ—êŽ˜êŽ™êŽšêŽ›êŽœêŽêŽžêŽŸêŽ êŽ¡êŽ¢êŽ£êŽ¤êŽ¥êŽ¦êŽ§êŽ¨êŽ©êŽªêŽ«êŽ¬êŽ­êŽ®êŽ¯êŽ°êŽ±êŽ²êŽ³êŽ´êŽµêŽ¶êŽ·êŽ¸êŽ¹êŽºêŽ»êŽ¼êŽ½êŽ¾êŽ¿ê€êê‚êƒê„ê…ê†ê‡êˆê‰êŠê‹êŒêêŽêêê‘ê’ê“ê”ê•ê–ê—ê˜ê™êšê›êœêêžêŸê ê¡ê¢ê£ê¤ê¥ê¦ê§ê¨ê©êªê«ê¬ê­ê®ê¯ê°ê±ê²ê³ê´êµê¶ê·ê¸ê¹êºê»ê¼ê½ê¾ê¿ê€êê‚êƒê„ê…ê†ê‡êˆê‰êŠê‹êŒêêŽêêê‘ê’ê“ê”ê•ê–ê—ê˜ê™êšê›êœêêžêŸê ê¡ê¢ê£ê¤ê¥ê¦ê§ê¨ê©êªê«ê¬ê­ê®ê¯ê°ê±ê²ê³ê´êµê¶ê·ê¸ê¹êºê»ê¼ê½ê¾ê¿ê‘€ê‘ꑂꑃꑄꑅꑆꑇꑈꑉꑊꑋꑌê‘ꑎê‘ê‘ꑑꑒꑓꑔꑕꑖꑗꑘꑙꑚꑛꑜê‘ꑞꑟꑠꑡꑢꑣꑤꑥꑦꑧꑨꑩꑪꑫꑬꑭꑮꑯꑰꑱꑲꑳꑴꑵꑶꑷꑸꑹꑺꑻꑼꑽꑾꑿꒀê’ꒂꒃꒄꒅꒆꒇꒈꒉꒊꒋꒌ\ua48d\ua48e\ua48f', ',') satisfies matches($s, '^(?:\\p{IsYiSyllables}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsYiSyllables}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00286() { final XQuery query = new XQuery( "(every $s in tokenize('ê’\ua4cf,ê’꒑꒒꒓꒔꒕꒖꒗꒘꒙꒚꒛꒜ê’꒞꒟꒠꒡꒢꒣꒤꒥꒦꒧꒨꒩꒪꒫꒬꒭꒮꒯꒰꒱꒲꒳꒴꒵꒶꒷꒸꒹꒺꒻꒼꒽꒾꒿꓀ê“꓂꓃꓄꓅꓆\ua4c7\ua4c8\ua4c9\ua4ca\ua4cb\ua4cc\ua4cd\ua4ce\ua4cf', ',') satisfies matches($s, '^(?:\\p{IsYiRadicals}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsYiRadicals}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00287() { final XQuery query = new XQuery( "(every $s in tokenize('가힣', ',') satisfies matches($s, '^(?:\\p{IsHangulSyllables}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsHangulSyllables}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00288() { final XQuery query = new XQuery( "(every $s in tokenize('\ue000\uf8ff,\udb80\udc00\udbbf\udffd,\udbc0\udc00\udbff\udffd', ',') satisfies matches($s, '^(?:\\p{IsPrivateUse}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsPrivateUse}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00289() { final XQuery query = new XQuery( "(every $s in tokenize('豈\ufaff,豈ï¤ï¤‚賈滑串句龜龜契金喇奈ï¤ï¤Žï¤ï¤ï¤‘裸邏樂洛烙珞落酪駱亂卵ï¤ï¤žï¤Ÿï¤ ï¤¡ï¤¢ï¤£ï¤¤ï¤¥ï¤¦ï¤§ï¤¨ï¤©ï¤ªï¤«ï¤¬ï¤­ï¤®ï¤¯ï¤°ï¤±ï¤²ï¤³ï¤´ï¤µï¤¶ï¤·ï¤¸ï¤¹ï¤ºï¤»ï¤¼ï¤½ï¤¾ï¤¿ï¥€ï¥ï¥‚弄籠聾牢磊賂雷壘屢樓ï¥ï¥Žï¥ï¥ï¥‘勒肋凜凌稜綾菱陵讀拏樂ï¥ï¥žï¥Ÿï¥ ï¥¡ï¥¢ï¥£ï¥¤ï¥¥ï¥¦ï¥§ï¥¨ï¥©ï¥ªï¥«ï¥¬ï¥­ï¥®ï¥¯ï¥°ï¥±ï¥²ï¥³ï¥´ï¥µï¥¶ï¥·ï¥¸ï¥¹ï¥ºï¥»ï¥¼ï¥½ï¥¾ï¥¿ï¦€ï¦ï¦‚旅濾礪閭驪麗黎力曆歷ï¦ï¦Žï¦ï¦ï¦‘漣煉璉秊練聯輦蓮連鍊列ï¦ï¦žï¦Ÿï¦ ï¦¡ï¦¢ï¦£ï¦¤ï¦¥ï¦¦ï¦§ï¦¨ï¦©ï¦ªï¦«ï¦¬ï¦­ï¦®ï¦¯ï¦°ï¦±ï¦²ï¦³ï¦´ï¦µï¦¶ï¦·ï¦¸ï¦¹ï¦ºï¦»ï¦¼ï¦½ï¦¾ï¦¿ï§€ï§ï§‚遼龍暈阮劉杻柳流溜琉ï§ï§Žï§ï§ï§‘戮陸倫崙淪輪律慄栗率隆ï§ï§žï§Ÿï§ ï§¡ï§¢ï§£ï§¤ï§¥ï§¦ï§§ï§¨ï§©ï§ªï§«ï§¬ï§­ï§®ï§¯ï§°ï§±ï§²ï§³ï§´ï§µï§¶ï§·ï§¸ï§¹ï§ºï§»ï§¼ï§½ï§¾ï§¿ï¨€ï¨ï¨‚糖宅洞暴輻行降見廓兀ï¨ï¨Žï¨ï¨ï¨‘晴﨓﨔凞猪益礼神祥福靖ï¨ï¨žï¨Ÿï¨ ï¨¡ï¨¢ï¨£ï¨¤ï¨¥ï¨¦ï¨§ï¨¨ï¨©ï¨ªï¨«ï¨¬ï¨­\ufa2e\ufa2f侮僧免勉勤卑喝嘆器塀墨層屮悔慨憎懲ï©ï©‚暑梅海渚漢煮爫琢碑社ï©ï©Žï©ï©ï©‘禍禎穀突節練縉繁署者臭ï©ï©žï©Ÿï© ï©¡ï©¢ï©£ï©¤ï©¥ï©¦ï©§ï©¨ï©©ï©ªï©«ï©¬ï©­\ufa6e\ufa6f並况全侀充冀勇勺喝啕喙嗢塚墳奄奔婢ïªïª‚廙彩徭惘慎愈憎慠懲戴ïªïªŽïªïªïª‘朗望杖歹殺流滛滋漢瀞煮ïªïªžïªŸïª ïª¡ïª¢ïª£ïª¤ïª¥ïª¦ïª§ïª¨ïª©ïªªïª«ïª¬ïª­ïª®ïª¯ïª°ïª±ïª²ïª³ïª´ïªµïª¶ïª·ïª¸ïª¹ïªºïª»ïª¼ïª½ïª¾ïª¿ï«€ï«ï«‚遲醙鉶陼難靖韛響頋頻ï«ï«Žï«ï«ï«‘㮝䀘䀹𥉉𥳐𧻓齃龎\ufada\ufadb\ufadc\ufadd\ufade\ufadf\ufae0\ufae1\ufae2\ufae3\ufae4\ufae5\ufae6\ufae7\ufae8\ufae9\ufaea\ufaeb\ufaec\ufaed\ufaee\ufaef\ufaf0\ufaf1\ufaf2\ufaf3\ufaf4\ufaf5\ufaf6\ufaf7\ufaf8\ufaf9\ufafa\ufafb\ufafc\ufafd\ufafe\ufaff', ',') satisfies matches($s, '^(?:\\p{IsCJKCompatibilityIdeographs}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsCJKCompatibilityIdeographs}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00290() { final XQuery query = new XQuery( "(every $s in tokenize('ffï­,ffï¬ï¬‚ffifflſtst\ufb07\ufb08\ufb09\ufb0a\ufb0b\ufb0c\ufb0d\ufb0e\ufb0f\ufb10\ufb11\ufb12ﬓﬔﬕﬖﬗ\ufb18\ufb19\ufb1a\ufb1b\ufb1cï¬ï¬žï¬Ÿï¬ ï¬¡ï¬¢ï¬£ï¬¤ï¬¥ï¬¦ï¬§ï¬¨ï¬©ï¬ªï¬«ï¬¬ï¬­ï¬®ï¬¯ï¬°ï¬±ï¬²ï¬³ï¬´ï¬µï¬¶\ufb37טּיּךּכּלּ\ufb3dמּ\ufb3fï­€ï­\ufb42ףּפּ\ufb45צּקּרּשּתּוֹבֿï­ï­Žï­', ',') satisfies matches($s, '^(?:\\p{IsAlphabeticPresentationForms}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsAlphabeticPresentationForms}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00291() { final XQuery query = new XQuery( "(every $s in tokenize('ï­\ufdff,ï­ï­‘ﭒﭓﭔﭕﭖﭗﭘﭙﭚﭛﭜï­ï­žï­Ÿï­ ï­¡ï­¢ï­£ï­¤ï­¥ï­¦ï­§ï­¨ï­©ï­ªï­«ï­¬ï­­ï­®ï­¯ï­°ï­±ï­²ï­³ï­´ï­µï­¶ï­·ï­¸ï­¹ï­ºï­»ï­¼ï­½ï­¾ï­¿ï®€ï®ï®‚ﮃﮄﮅﮆﮇﮈﮉﮊﮋﮌï®ï®Žï®ï®ï®‘ﮒﮓﮔﮕﮖﮗﮘﮙﮚﮛﮜï®ï®žï®Ÿï® ï®¡ï®¢ï®£ï®¤ï®¥ï®¦ï®§ï®¨ï®©ï®ªï®«ï®¬ï®­ï®®ï®¯ï®°ï®±ï®²ï®³ï®´ï®µï®¶ï®·ï®¸ï®¹ï®ºï®»ï®¼ï®½ï®¾ï®¿ï¯€ï¯\ufbc2\ufbc3\ufbc4\ufbc5\ufbc6\ufbc7\ufbc8\ufbc9\ufbca\ufbcb\ufbcc\ufbcd\ufbce\ufbcf\ufbd0\ufbd1\ufbd2ﯓﯔﯕﯖﯗﯘﯙﯚﯛﯜï¯ï¯žï¯Ÿï¯ ï¯¡ï¯¢ï¯£ï¯¤ï¯¥ï¯¦ï¯§ï¯¨ï¯©ï¯ªï¯«ï¯¬ï¯­ï¯®ï¯¯ï¯°ï¯±ï¯²ï¯³ï¯´ï¯µï¯¶ï¯·ï¯¸ï¯¹ï¯ºï¯»ï¯¼ï¯½ï¯¾ï¯¿ï°€ï°ï°‚ﰃﰄﰅﰆﰇﰈﰉﰊﰋﰌï°ï°Žï°ï°ï°‘ﰒﰓﰔﰕﰖﰗﰘﰙﰚﰛﰜï°ï°žï°Ÿï° ï°¡ï°¢ï°£ï°¤ï°¥ï°¦ï°§ï°¨ï°©ï°ªï°«ï°¬ï°­ï°®ï°¯ï°°ï°±ï°²ï°³ï°´ï°µï°¶ï°·ï°¸ï°¹ï°ºï°»ï°¼ï°½ï°¾ï°¿ï±€ï±ï±‚ﱃﱄﱅﱆﱇﱈﱉﱊﱋﱌï±ï±Žï±ï±ï±‘ﱒﱓﱔﱕﱖﱗﱘﱙﱚﱛﱜï±ï±žï±Ÿï± ï±¡ï±¢ï±£ï±¤ï±¥ï±¦ï±§ï±¨ï±©ï±ªï±«ï±¬ï±­ï±®ï±¯ï±°ï±±ï±²ï±³ï±´ï±µï±¶ï±·ï±¸ï±¹ï±ºï±»ï±¼ï±½ï±¾ï±¿ï²€ï²ï²‚ﲃﲄﲅﲆﲇﲈﲉﲊﲋﲌï²ï²Žï²ï²ï²‘ﲒﲓﲔﲕﲖﲗﲘﲙﲚﲛﲜï²ï²žï²Ÿï² ï²¡ï²¢ï²£ï²¤ï²¥ï²¦ï²§ï²¨ï²©ï²ªï²«ï²¬ï²­ï²®ï²¯ï²°ï²±ï²²ï²³ï²´ï²µï²¶ï²·ï²¸ï²¹ï²ºï²»ï²¼ï²½ï²¾ï²¿ï³€ï³ï³‚ﳃﳄﳅﳆﳇﳈﳉﳊﳋﳌï³ï³Žï³ï³ï³‘ﳒﳓﳔﳕﳖﳗﳘﳙﳚﳛﳜï³ï³žï³Ÿï³ ï³¡ï³¢ï³£ï³¤ï³¥ï³¦ï³§ï³¨ï³©ï³ªï³«ï³¬ï³­ï³®ï³¯ï³°ï³±ï³²ï³³ï³´ï³µï³¶ï³·ï³¸ï³¹ï³ºï³»ï³¼ï³½ï³¾ï³¿ï´€ï´ï´‚ﴃﴄﴅﴆﴇﴈﴉﴊﴋﴌï´ï´Žï´ï´ï´‘ﴒﴓﴔﴕﴖﴗﴘﴙﴚﴛﴜï´ï´žï´Ÿï´ ï´¡ï´¢ï´£ï´¤ï´¥ï´¦ï´§ï´¨ï´©ï´ªï´«ï´¬ï´­ï´®ï´¯ï´°ï´±ï´²ï´³ï´´ï´µï´¶ï´·ï´¸ï´¹ï´ºï´»ï´¼ï´½\ufd3e\ufd3f\ufd40\ufd41\ufd42\ufd43\ufd44\ufd45\ufd46\ufd47\ufd48\ufd49\ufd4a\ufd4b\ufd4c\ufd4d\ufd4e\ufd4fïµïµ‘ﵒﵓﵔﵕﵖﵗﵘﵙﵚﵛﵜïµïµžïµŸïµ ïµ¡ïµ¢ïµ£ïµ¤ïµ¥ïµ¦ïµ§ïµ¨ïµ©ïµªïµ«ïµ¬ïµ­ïµ®ïµ¯ïµ°ïµ±ïµ²ïµ³ïµ´ïµµïµ¶ïµ·ïµ¸ïµ¹ïµºïµ»ïµ¼ïµ½ïµ¾ïµ¿ï¶€ï¶ï¶‚ﶃﶄﶅﶆﶇﶈﶉﶊﶋﶌï¶ï¶Žï¶\ufd90\ufd91ﶒﶓﶔﶕﶖﶗﶘﶙﶚﶛﶜï¶ï¶žï¶Ÿï¶ ï¶¡ï¶¢ï¶£ï¶¤ï¶¥ï¶¦ï¶§ï¶¨ï¶©ï¶ªï¶«ï¶¬ï¶­ï¶®ï¶¯ï¶°ï¶±ï¶²ï¶³ï¶´ï¶µï¶¶ï¶·ï¶¸ï¶¹ï¶ºï¶»ï¶¼ï¶½ï¶¾ï¶¿ï·€ï·ï·‚ﷃﷄﷅﷆﷇ\ufdc8\ufdc9\ufdca\ufdcb\ufdcc\ufdcd\ufdce\ufdcfï·ï·‘﷒﷓﷔﷕﷖﷗﷘﷙﷚﷛﷜ï·ï·žï·Ÿï· ï·¡ï·¢ï·£ï·¤ï·¥ï·¦ï·§ï·¨ï·©ï·ªï·«ï·¬ï·­ï·®ï·¯ï·°ï·±ï·²ï·³ï·´ï·µï·¶ï··ï·¸ï·¹ï·ºï·»ï·¼ï·½\ufdfe\ufdff', ',') satisfies matches($s, '^(?:\\p{IsArabicPresentationForms-A}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsArabicPresentationForms-A}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00292() { final XQuery query = new XQuery( "(every $s in tokenize('︠\ufe2f,︠︡︢︣︤︥︦\ufe27\ufe28\ufe29\ufe2a\ufe2b\ufe2c\ufe2d\ufe2e\ufe2f', ',') satisfies matches($s, '^(?:\\p{IsCombiningHalfMarks}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsCombiningHalfMarks}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00293() { final XQuery query = new XQuery( "(every $s in tokenize('\ufe30\ufe4f,\ufe30\ufe31\ufe32\ufe33\ufe34\ufe35\ufe36\ufe37\ufe38\ufe39\ufe3a\ufe3b\ufe3c\ufe3d\ufe3e\ufe3f\ufe40\ufe41\ufe42\ufe43\ufe44\ufe45\ufe46\ufe47\ufe48\ufe49\ufe4a\ufe4b\ufe4c\ufe4d\ufe4e\ufe4f', ',') satisfies matches($s, '^(?:\\p{IsCJKCompatibilityForms}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsCJKCompatibilityForms}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00294() { final XQuery query = new XQuery( "(every $s in tokenize('\ufe50\ufe6f,\ufe50\ufe51\ufe52\ufe53\ufe54\ufe55\ufe56\ufe57\ufe58\ufe59\ufe5a\ufe5b\ufe5c\ufe5d\ufe5e\ufe5f\ufe60\ufe61ï¹¢\ufe63﹤﹥﹦\ufe67\ufe68﹩\ufe6a\ufe6b\ufe6c\ufe6d\ufe6e\ufe6f', ',') satisfies matches($s, '^(?:\\p{IsSmallFormVariants}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsSmallFormVariants}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00295() { final XQuery query = new XQuery( "(every $s in tokenize('ï¹°\ufefe', ',') satisfies matches($s, '^(?:\\p{IsArabicPresentationForms-B}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsArabicPresentationForms-B}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00296() { final XQuery query = new XQuery( "(every $s in tokenize('\uff00\uffef,\uff00\uff01\uff02\uff03$\uff05\uff06\uff07\uff08\uff09\uff0a+\uff0c\uff0d\uff0e\uff0fï¼ï¼‘23456789\uff1a\uff1b<ï¼ï¼ž\uff1f\uff20ABCDEFGHIJKLMNOPQRSTUVWXYZ\uff3b\uff3c\uff3dï¼¾\uff3fï½€ï½ï½‚cdefghijklï½ï½Žï½ï½ï½‘rstuvwxyz\uff5b|\uff5d~\uff5f\uff60\uff61\uff62\uff63\uff64\uff65ヲァィゥェォャュョッーアイウエオカキクケコサシスセソタï¾ï¾‚テトナニヌネノハヒフï¾ï¾Žï¾ï¾ï¾‘メモヤユヨラリルレロワï¾ï¾žï¾Ÿï¾ ï¾¡ï¾¢ï¾£ï¾¤ï¾¥ï¾¦ï¾§ï¾¨ï¾©ï¾ªï¾«ï¾¬ï¾­ï¾®ï¾¯ï¾°ï¾±ï¾²ï¾³ï¾´ï¾µï¾¶ï¾·ï¾¸ï¾¹ï¾ºï¾»ï¾¼ï¾½ï¾¾\uffbf\uffc0\uffc1ᅡᅢᅣᅤᅥᅦ\uffc8\uffc9ᅧᅨᅩï¿ï¿Žï¿\uffd0\uffd1ᅭᅮᅯᅰᅱᅲ\uffd8\uffd9ᅳᅴᅵ\uffdd\uffde\uffdf¢£¬ ̄¦¥₩\uffe7│←↑→↓■○\uffef', ',') satisfies matches($s, '^(?:\\p{IsHalfwidthandFullwidthForms}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsHalfwidthandFullwidthForms}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00297() { final XQuery query = new XQuery( "(every $s in tokenize('\ufff0�,\ufff0\ufff1\ufff2\ufff3\ufff4\ufff5\ufff6\ufff7\ufff8\ufff9\ufffa\ufffb�', ',') satisfies matches($s, '^(?:\\p{IsSpecials}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsSpecials}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00298() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsBasicLatin}?)$')) and (every $s in tokenize('\u0080', ',') satisfies not(matches($s, '^(?:\\p{IsBasicLatin}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00299() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsLatin-1Supplement}?)$')) and (every $s in tokenize('Ä€', ',') satisfies not(matches($s, '^(?:\\p{IsLatin-1Supplement}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00300() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsLatinExtended-A}?)$')) and (every $s in tokenize('Æ€', ',') satisfies not(matches($s, '^(?:\\p{IsLatinExtended-A}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00301() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsLatinExtended-B}?)$')) and (every $s in tokenize('É', ',') satisfies not(matches($s, '^(?:\\p{IsLatinExtended-B}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00302() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsIPAExtensions}?)$')) and (every $s in tokenize('ʰ', ',') satisfies not(matches($s, '^(?:\\p{IsIPAExtensions}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00303() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsSpacingModifierLetters}?)$')) and (every $s in tokenize('Ì€', ',') satisfies not(matches($s, '^(?:\\p{IsSpacingModifierLetters}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00304() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCyrillic}?)$')) and (every $s in tokenize('\u0530', ',') satisfies not(matches($s, '^(?:\\p{IsCyrillic}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00305() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsArmenian}?)$')) and (every $s in tokenize('\u0590', ',') satisfies not(matches($s, '^(?:\\p{IsArmenian}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00306() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsHebrew}?)$')) and (every $s in tokenize('\u0600', ',') satisfies not(matches($s, '^(?:\\p{IsHebrew}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00307() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsArabic}?)$')) and (every $s in tokenize('\u0700', ',') satisfies not(matches($s, '^(?:\\p{IsArabic}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00308() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsSyriac}?)$')) and (every $s in tokenize('Þ€', ',') satisfies not(matches($s, '^(?:\\p{IsSyriac}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00309() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsThaana}?)$')) and (every $s in tokenize('ऀ', ',') satisfies not(matches($s, '^(?:\\p{IsThaana}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00310() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsDevanagari}?)$')) and (every $s in tokenize('\u0980', ',') satisfies not(matches($s, '^(?:\\p{IsDevanagari}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00311() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsBengali}?)$')) and (every $s in tokenize('\u0a00', ',') satisfies not(matches($s, '^(?:\\p{IsBengali}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00312() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsGurmukhi}?)$')) and (every $s in tokenize('\u0a80', ',') satisfies not(matches($s, '^(?:\\p{IsGurmukhi}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00313() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsGujarati}?)$')) and (every $s in tokenize('\u0b00', ',') satisfies not(matches($s, '^(?:\\p{IsGujarati}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00314() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsOriya}?)$')) and (every $s in tokenize('\u0b80', ',') satisfies not(matches($s, '^(?:\\p{IsOriya}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00315() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsTamil}?)$')) and (every $s in tokenize('\u0c00', ',') satisfies not(matches($s, '^(?:\\p{IsTamil}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00316() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsTelugu}?)$')) and (every $s in tokenize('\u0c80', ',') satisfies not(matches($s, '^(?:\\p{IsTelugu}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00317() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsKannada}?)$')) and (every $s in tokenize('\u0d00', ',') satisfies not(matches($s, '^(?:\\p{IsKannada}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00318() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsMalayalam}?)$')) and (every $s in tokenize('\u0d80', ',') satisfies not(matches($s, '^(?:\\p{IsMalayalam}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00319() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsSinhala}?)$')) and (every $s in tokenize('\u0e00', ',') satisfies not(matches($s, '^(?:\\p{IsSinhala}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00320() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsThai}?)$')) and (every $s in tokenize('\u0e80', ',') satisfies not(matches($s, '^(?:\\p{IsThai}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00321() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsLao}?)$')) and (every $s in tokenize('ༀ', ',') satisfies not(matches($s, '^(?:\\p{IsLao}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00322() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsTibetan}?)$')) and (every $s in tokenize('က', ',') satisfies not(matches($s, '^(?:\\p{IsTibetan}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00323() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsMyanmar}?)$')) and (every $s in tokenize('á‚ ', ',') satisfies not(matches($s, '^(?:\\p{IsMyanmar}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00324() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsGeorgian}?)$')) and (every $s in tokenize('á„€', ',') satisfies not(matches($s, '^(?:\\p{IsGeorgian}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00325() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsHangulJamo}?)$')) and (every $s in tokenize('ሀ', ',') satisfies not(matches($s, '^(?:\\p{IsHangulJamo}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00326() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsEthiopic}?)$')) and (every $s in tokenize('Ꭰ', ',') satisfies not(matches($s, '^(?:\\p{IsEthiopic}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00327() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCherokee}?)$')) and (every $s in tokenize('\u1400', ',') satisfies not(matches($s, '^(?:\\p{IsCherokee}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00328() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsUnifiedCanadianAboriginalSyllabics}?)$')) and (every $s in tokenize('\u1680', ',') satisfies not(matches($s, '^(?:\\p{IsUnifiedCanadianAboriginalSyllabics}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00329() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsOgham}?)$')) and (every $s in tokenize('áš ', ',') satisfies not(matches($s, '^(?:\\p{IsOgham}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00330() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsRunic}?)$')) and (every $s in tokenize('ក', ',') satisfies not(matches($s, '^(?:\\p{IsRunic}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00331() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsKhmer}?)$')) and (every $s in tokenize('\u1800', ',') satisfies not(matches($s, '^(?:\\p{IsKhmer}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00332() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsMongolian}?)$')) and (every $s in tokenize('Ḁ', ',') satisfies not(matches($s, '^(?:\\p{IsMongolian}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00333() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsLatinExtendedAdditional}?)$')) and (every $s in tokenize('á¼€', ',') satisfies not(matches($s, '^(?:\\p{IsLatinExtendedAdditional}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00334() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsGreekExtended}?)$')) and (every $s in tokenize('\u2000', ',') satisfies not(matches($s, '^(?:\\p{IsGreekExtended}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00335() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsGeneralPunctuation}?)$')) and (every $s in tokenize('â°', ',') satisfies not(matches($s, '^(?:\\p{IsGeneralPunctuation}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00336() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsSuperscriptsandSubscripts}?)$')) and (every $s in tokenize('â‚ ', ',') satisfies not(matches($s, '^(?:\\p{IsSuperscriptsandSubscripts}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00337() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCurrencySymbols}?)$')) and (every $s in tokenize('âƒ', ',') satisfies not(matches($s, '^(?:\\p{IsCurrencySymbols}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00338() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCombiningMarksforSymbols}?)$')) and (every $s in tokenize('â„€', ',') satisfies not(matches($s, '^(?:\\p{IsCombiningMarksforSymbols}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00339() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsLetterlikeSymbols}?)$')) and (every $s in tokenize('â…', ',') satisfies not(matches($s, '^(?:\\p{IsLetterlikeSymbols}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00340() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsNumberForms}?)$')) and (every $s in tokenize('â†', ',') satisfies not(matches($s, '^(?:\\p{IsNumberForms}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00341() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsArrows}?)$')) and (every $s in tokenize('∀', ',') satisfies not(matches($s, '^(?:\\p{IsArrows}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00342() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsMathematicalOperators}?)$')) and (every $s in tokenize('⌀', ',') satisfies not(matches($s, '^(?:\\p{IsMathematicalOperators}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00343() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsMiscellaneousTechnical}?)$')) and (every $s in tokenize('â€', ',') satisfies not(matches($s, '^(?:\\p{IsMiscellaneousTechnical}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00344() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsControlPictures}?)$')) and (every $s in tokenize('â‘€', ',') satisfies not(matches($s, '^(?:\\p{IsControlPictures}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00345() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsOpticalCharacterRecognition}?)$')) and (every $s in tokenize('â‘ ', ',') satisfies not(matches($s, '^(?:\\p{IsOpticalCharacterRecognition}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00346() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsEnclosedAlphanumerics}?)$')) and (every $s in tokenize('─', ',') satisfies not(matches($s, '^(?:\\p{IsEnclosedAlphanumerics}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00347() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsBoxDrawing}?)$')) and (every $s in tokenize('â–€', ',') satisfies not(matches($s, '^(?:\\p{IsBoxDrawing}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00348() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsBlockElements}?)$')) and (every $s in tokenize('â– ', ',') satisfies not(matches($s, '^(?:\\p{IsBlockElements}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00349() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsGeometricShapes}?)$')) and (every $s in tokenize('☀', ',') satisfies not(matches($s, '^(?:\\p{IsGeometricShapes}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00350() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsMiscellaneousSymbols}?)$')) and (every $s in tokenize('\u2700', ',') satisfies not(matches($s, '^(?:\\p{IsMiscellaneousSymbols}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00351() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsDingbats}?)$')) and (every $s in tokenize('â €', ',') satisfies not(matches($s, '^(?:\\p{IsDingbats}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00352() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsBraillePatterns}?)$')) and (every $s in tokenize('⺀', ',') satisfies not(matches($s, '^(?:\\p{IsBraillePatterns}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00353() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCJKRadicalsSupplement}?)$')) and (every $s in tokenize('â¼€', ',') satisfies not(matches($s, '^(?:\\p{IsCJKRadicalsSupplement}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00354() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsKangxiRadicals}?)$')) and (every $s in tokenize('â¿°', ',') satisfies not(matches($s, '^(?:\\p{IsKangxiRadicals}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00355() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsIdeographicDescriptionCharacters}?)$')) and (every $s in tokenize('\u3000', ',') satisfies not(matches($s, '^(?:\\p{IsIdeographicDescriptionCharacters}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00356() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCJKSymbolsandPunctuation}?)$')) and (every $s in tokenize('\u3040', ',') satisfies not(matches($s, '^(?:\\p{IsCJKSymbolsandPunctuation}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00357() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsHiragana}?)$')) and (every $s in tokenize('\u30a0', ',') satisfies not(matches($s, '^(?:\\p{IsHiragana}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00358() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsKatakana}?)$')) and (every $s in tokenize('\u3100', ',') satisfies not(matches($s, '^(?:\\p{IsKatakana}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00359() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsBopomofo}?)$')) and (every $s in tokenize('\u3130', ',') satisfies not(matches($s, '^(?:\\p{IsBopomofo}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00360() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsHangulCompatibilityJamo}?)$')) and (every $s in tokenize('ã†', ',') satisfies not(matches($s, '^(?:\\p{IsHangulCompatibilityJamo}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00361() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsKanbun}?)$')) and (every $s in tokenize('ㆠ', ',') satisfies not(matches($s, '^(?:\\p{IsKanbun}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00362() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsBopomofoExtended}?)$')) and (every $s in tokenize('㈀', ',') satisfies not(matches($s, '^(?:\\p{IsBopomofoExtended}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00363() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsEnclosedCJKLettersandMonths}?)$')) and (every $s in tokenize('㌀', ',') satisfies not(matches($s, '^(?:\\p{IsEnclosedCJKLettersandMonths}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00364() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCJKCompatibility}?)$')) and (every $s in tokenize('ã€', ',') satisfies not(matches($s, '^(?:\\p{IsCJKCompatibility}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00365() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCJKUnifiedIdeographsExtensionA}?)$')) and (every $s in tokenize('一', ',') satisfies not(matches($s, '^(?:\\p{IsCJKUnifiedIdeographsExtensionA}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00366() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCJKUnifiedIdeographs}?)$')) and (every $s in tokenize('ꀀ', ',') satisfies not(matches($s, '^(?:\\p{IsCJKUnifiedIdeographs}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00367() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsYiSyllables}?)$')) and (every $s in tokenize('ê’', ',') satisfies not(matches($s, '^(?:\\p{IsYiSyllables}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00368() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsYiRadicals}?)$')) and (every $s in tokenize('ê°€', ',') satisfies not(matches($s, '^(?:\\p{IsYiRadicals}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00369() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsLowSurrogates}?)$')) and (every $s in tokenize('\ue000', ',') satisfies not(matches($s, '^(?:\\p{IsLowSurrogates}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00370() { final XQuery query = new XQuery( "(every $s in tokenize('\udbc0\udc00', ',') satisfies matches($s, '^(?:\\p{IsPrivateUse}?)$')) and (every $s in tokenize('豈,\u007f', ',') satisfies not(matches($s, '^(?:\\p{IsPrivateUse}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00371() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCJKCompatibilityIdeographs}?)$')) and (every $s in tokenize('ff', ',') satisfies not(matches($s, '^(?:\\p{IsCJKCompatibilityIdeographs}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00372() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsAlphabeticPresentationForms}?)$')) and (every $s in tokenize('ï­', ',') satisfies not(matches($s, '^(?:\\p{IsAlphabeticPresentationForms}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00373() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsArabicPresentationForms-A}?)$')) and (every $s in tokenize('︠', ',') satisfies not(matches($s, '^(?:\\p{IsArabicPresentationForms-A}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00374() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCombiningHalfMarks}?)$')) and (every $s in tokenize('\ufe30', ',') satisfies not(matches($s, '^(?:\\p{IsCombiningHalfMarks}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00375() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCJKCompatibilityForms}?)$')) and (every $s in tokenize('\ufe50', ',') satisfies not(matches($s, '^(?:\\p{IsCJKCompatibilityForms}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00376() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsSmallFormVariants}?)$')) and (every $s in tokenize('ï¹°', ',') satisfies not(matches($s, '^(?:\\p{IsSmallFormVariants}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00377() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsSpecials}?)$')) and (every $s in tokenize('\uff00,ðŒ€', ',') satisfies not(matches($s, '^(?:\\p{IsSpecials}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00378() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsHalfwidthandFullwidthForms}?)$')) and (every $s in tokenize('\ufff0', ',') satisfies not(matches($s, '^(?:\\p{IsHalfwidthandFullwidthForms}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00379() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsOldItalic}?)$')) and (every $s in tokenize('ðŒ°', ',') satisfies not(matches($s, '^(?:\\p{IsOldItalic}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00380() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsGothic}?)$')) and (every $s in tokenize('ð€', ',') satisfies not(matches($s, '^(?:\\p{IsGothic}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00381() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsDeseret}?)$')) and (every $s in tokenize('ð€€', ',') satisfies not(matches($s, '^(?:\\p{IsDeseret}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00382() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsByzantineMusicalSymbols}?)$')) and (every $s in tokenize('ð„€', ',') satisfies not(matches($s, '^(?:\\p{IsByzantineMusicalSymbols}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00383() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsMusicalSymbols}?)$')) and (every $s in tokenize('ð€', ',') satisfies not(matches($s, '^(?:\\p{IsMusicalSymbols}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00384() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsMathematicalAlphanumericSymbols}?)$')) and (every $s in tokenize('ð €€', ',') satisfies not(matches($s, '^(?:\\p{IsMathematicalAlphanumericSymbols}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00385() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCJKUnifiedIdeographsExtensionB}?)$')) and (every $s in tokenize('丽', ',') satisfies not(matches($s, '^(?:\\p{IsCJKUnifiedIdeographsExtensionB}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00386() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCJKCompatibilityIdeographsSupplement}?)$')) and (every $s in tokenize('\udb40\udc00', ',') satisfies not(matches($s, '^(?:\\p{IsCJKCompatibilityIdeographsSupplement}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00387() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsTags}?)$')) and (every $s in tokenize('\udb80\udc00', ',') satisfies not(matches($s, '^(?:\\p{IsTags}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00388() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsBasicLatin})$')) and (every $s in tokenize('Û¿', ',') satisfies not(matches($s, '^(?:\\p{IsBasicLatin})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00389() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsLatin-1Supplement})$')) and (every $s in tokenize('\u007f', ',') satisfies not(matches($s, '^(?:\\p{IsLatin-1Supplement})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00390() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsLatinExtended-A})$')) and (every $s in tokenize('ÿ', ',') satisfies not(matches($s, '^(?:\\p{IsLatinExtended-A})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00391() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsLatinExtended-B})$')) and (every $s in tokenize('Å¿', ',') satisfies not(matches($s, '^(?:\\p{IsLatinExtended-B})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00392() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsIPAExtensions})$')) and (every $s in tokenize('É', ',') satisfies not(matches($s, '^(?:\\p{IsIPAExtensions})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00393() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsSpacingModifierLetters})$')) and (every $s in tokenize('ʯ', ',') satisfies not(matches($s, '^(?:\\p{IsSpacingModifierLetters})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00394() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsGreek})$')) and (every $s in tokenize('ͯ', ',') satisfies not(matches($s, '^(?:\\p{IsGreek})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00395() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCyrillic})$')) and (every $s in tokenize('Ï¿', ',') satisfies not(matches($s, '^(?:\\p{IsCyrillic})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00396() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsArmenian})$')) and (every $s in tokenize('Ó¿', ',') satisfies not(matches($s, '^(?:\\p{IsArmenian})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00397() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsHebrew})$')) and (every $s in tokenize('\u058f', ',') satisfies not(matches($s, '^(?:\\p{IsHebrew})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00398() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsArabic})$')) and (every $s in tokenize('\u05ff', ',') satisfies not(matches($s, '^(?:\\p{IsArabic})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00399() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsSyriac})$')) and (every $s in tokenize('Û¿', ',') satisfies not(matches($s, '^(?:\\p{IsSyriac})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00400() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsThaana})$')) and (every $s in tokenize('Ý', ',') satisfies not(matches($s, '^(?:\\p{IsThaana})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00401() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsDevanagari})$')) and (every $s in tokenize('\u07bf', ',') satisfies not(matches($s, '^(?:\\p{IsDevanagari})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00402() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsBengali})$')) and (every $s in tokenize('ॿ', ',') satisfies not(matches($s, '^(?:\\p{IsBengali})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00403() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsGurmukhi})$')) and (every $s in tokenize('\u09ff', ',') satisfies not(matches($s, '^(?:\\p{IsGurmukhi})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00404() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsGujarati})$')) and (every $s in tokenize('\u0a7f', ',') satisfies not(matches($s, '^(?:\\p{IsGujarati})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00405() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsOriya})$')) and (every $s in tokenize('\u0aff', ',') satisfies not(matches($s, '^(?:\\p{IsOriya})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00406() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsTamil})$')) and (every $s in tokenize('\u0b7f', ',') satisfies not(matches($s, '^(?:\\p{IsTamil})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00407() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsTelugu})$')) and (every $s in tokenize('\u0bff', ',') satisfies not(matches($s, '^(?:\\p{IsTelugu})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00408() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsKannada})$')) and (every $s in tokenize('౿', ',') satisfies not(matches($s, '^(?:\\p{IsKannada})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00409() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsMalayalam})$')) and (every $s in tokenize('\u0cff', ',') satisfies not(matches($s, '^(?:\\p{IsMalayalam})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00410() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsSinhala})$')) and (every $s in tokenize('ൿ', ',') satisfies not(matches($s, '^(?:\\p{IsSinhala})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00411() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsThai})$')) and (every $s in tokenize('\u0dff', ',') satisfies not(matches($s, '^(?:\\p{IsThai})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00412() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsLao})$')) and (every $s in tokenize('\u0e7f', ',') satisfies not(matches($s, '^(?:\\p{IsLao})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00413() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsTibetan})$')) and (every $s in tokenize('\u0eff', ',') satisfies not(matches($s, '^(?:\\p{IsTibetan})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00414() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsMyanmar})$')) and (every $s in tokenize('\u0fff', ',') satisfies not(matches($s, '^(?:\\p{IsMyanmar})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00415() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsGeorgian})$')) and (every $s in tokenize('႟', ',') satisfies not(matches($s, '^(?:\\p{IsGeorgian})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00416() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsHangulJamo})$')) and (every $s in tokenize('\u10ff', ',') satisfies not(matches($s, '^(?:\\p{IsHangulJamo})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00417() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsEthiopic})$')) and (every $s in tokenize('ᇿ', ',') satisfies not(matches($s, '^(?:\\p{IsEthiopic})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00418() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCherokee})$')) and (every $s in tokenize('\u137f', ',') satisfies not(matches($s, '^(?:\\p{IsCherokee})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00419() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsUnifiedCanadianAboriginalSyllabics})$')) and (every $s in tokenize('\u13ff', ',') satisfies not(matches($s, '^(?:\\p{IsUnifiedCanadianAboriginalSyllabics})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00420() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsOgham})$')) and (every $s in tokenize('ᙿ', ',') satisfies not(matches($s, '^(?:\\p{IsOgham})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00421() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsRunic})$')) and (every $s in tokenize('\u169f', ',') satisfies not(matches($s, '^(?:\\p{IsRunic})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00422() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsKhmer})$')) and (every $s in tokenize('\u16ff', ',') satisfies not(matches($s, '^(?:\\p{IsKhmer})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00423() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsMongolian})$')) and (every $s in tokenize('\u17ff', ',') satisfies not(matches($s, '^(?:\\p{IsMongolian})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00424() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsLatinExtendedAdditional})$')) and (every $s in tokenize('\u18af', ',') satisfies not(matches($s, '^(?:\\p{IsLatinExtendedAdditional})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00425() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsGreekExtended})$')) and (every $s in tokenize('ỿ', ',') satisfies not(matches($s, '^(?:\\p{IsGreekExtended})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00426() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsGeneralPunctuation})$')) and (every $s in tokenize('\u1fff', ',') satisfies not(matches($s, '^(?:\\p{IsGeneralPunctuation})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00427() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsSuperscriptsandSubscripts})$')) and (every $s in tokenize('\u206f', ',') satisfies not(matches($s, '^(?:\\p{IsSuperscriptsandSubscripts})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00428() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCurrencySymbols})$')) and (every $s in tokenize('\u209f', ',') satisfies not(matches($s, '^(?:\\p{IsCurrencySymbols})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00429() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCombiningMarksforSymbols})$')) and (every $s in tokenize('\u20cf', ',') satisfies not(matches($s, '^(?:\\p{IsCombiningMarksforSymbols})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00430() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsLetterlikeSymbols})$')) and (every $s in tokenize('\u20ff', ',') satisfies not(matches($s, '^(?:\\p{IsLetterlikeSymbols})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00431() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsNumberForms})$')) and (every $s in tokenize('â…', ',') satisfies not(matches($s, '^(?:\\p{IsNumberForms})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00432() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsArrows})$')) and (every $s in tokenize('\u218f', ',') satisfies not(matches($s, '^(?:\\p{IsArrows})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00433() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsMathematicalOperators})$')) and (every $s in tokenize('⇿', ',') satisfies not(matches($s, '^(?:\\p{IsMathematicalOperators})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00434() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsMiscellaneousTechnical})$')) and (every $s in tokenize('â‹¿', ',') satisfies not(matches($s, '^(?:\\p{IsMiscellaneousTechnical})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00435() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsControlPictures})$')) and (every $s in tokenize('\u23ff', ',') satisfies not(matches($s, '^(?:\\p{IsControlPictures})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00436() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsOpticalCharacterRecognition})$')) and (every $s in tokenize('\u243f', ',') satisfies not(matches($s, '^(?:\\p{IsOpticalCharacterRecognition})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00437() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsEnclosedAlphanumerics})$')) and (every $s in tokenize('\u245f', ',') satisfies not(matches($s, '^(?:\\p{IsEnclosedAlphanumerics})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00438() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsBoxDrawing})$')) and (every $s in tokenize('â“¿', ',') satisfies not(matches($s, '^(?:\\p{IsBoxDrawing})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00439() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsBlockElements})$')) and (every $s in tokenize('â•¿', ',') satisfies not(matches($s, '^(?:\\p{IsBlockElements})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00440() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsGeometricShapes})$')) and (every $s in tokenize('â–Ÿ', ',') satisfies not(matches($s, '^(?:\\p{IsGeometricShapes})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00441() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsMiscellaneousSymbols})$')) and (every $s in tokenize('â—¿', ',') satisfies not(matches($s, '^(?:\\p{IsMiscellaneousSymbols})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00442() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsDingbats})$')) and (every $s in tokenize('⛿', ',') satisfies not(matches($s, '^(?:\\p{IsDingbats})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00443() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsBraillePatterns})$')) and (every $s in tokenize('âž¿', ',') satisfies not(matches($s, '^(?:\\p{IsBraillePatterns})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00444() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCJKRadicalsSupplement})$')) and (every $s in tokenize('⣿', ',') satisfies not(matches($s, '^(?:\\p{IsCJKRadicalsSupplement})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00445() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsKangxiRadicals})$')) and (every $s in tokenize('\u2eff', ',') satisfies not(matches($s, '^(?:\\p{IsKangxiRadicals})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00446() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsIdeographicDescriptionCharacters})$')) and (every $s in tokenize('\u2fdf', ',') satisfies not(matches($s, '^(?:\\p{IsIdeographicDescriptionCharacters})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00447() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCJKSymbolsandPunctuation})$')) and (every $s in tokenize('\u2fff', ',') satisfies not(matches($s, '^(?:\\p{IsCJKSymbolsandPunctuation})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00448() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsHiragana})$')) and (every $s in tokenize('〿', ',') satisfies not(matches($s, '^(?:\\p{IsHiragana})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00449() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsKatakana})$')) and (every $s in tokenize('ゟ', ',') satisfies not(matches($s, '^(?:\\p{IsKatakana})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00450() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsBopomofo})$')) and (every $s in tokenize('ヿ', ',') satisfies not(matches($s, '^(?:\\p{IsBopomofo})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00451() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsHangulCompatibilityJamo})$')) and (every $s in tokenize('\u312f', ',') satisfies not(matches($s, '^(?:\\p{IsHangulCompatibilityJamo})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00452() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsKanbun})$')) and (every $s in tokenize('\u318f', ',') satisfies not(matches($s, '^(?:\\p{IsKanbun})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00453() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsBopomofoExtended})$')) and (every $s in tokenize('㆟', ',') satisfies not(matches($s, '^(?:\\p{IsBopomofoExtended})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00454() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsEnclosedCJKLettersandMonths})$')) and (every $s in tokenize('\u31bf', ',') satisfies not(matches($s, '^(?:\\p{IsEnclosedCJKLettersandMonths})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00455() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCJKCompatibility})$')) and (every $s in tokenize('\u32ff', ',') satisfies not(matches($s, '^(?:\\p{IsCJKCompatibility})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00456() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCJKUnifiedIdeographsExtensionA})$')) and (every $s in tokenize('ã¿', ',') satisfies not(matches($s, '^(?:\\p{IsCJKUnifiedIdeographsExtensionA})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00457() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCJKUnifiedIdeographs})$')) and (every $s in tokenize('ä¶µ', ',') satisfies not(matches($s, '^(?:\\p{IsCJKUnifiedIdeographs})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00458() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsYiSyllables})$')) and (every $s in tokenize('\u9fff', ',') satisfies not(matches($s, '^(?:\\p{IsYiSyllables})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00459() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsYiRadicals})$')) and (every $s in tokenize('\ua48f', ',') satisfies not(matches($s, '^(?:\\p{IsYiRadicals})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00460() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsHangulSyllables})$')) and (every $s in tokenize('\ua4cf', ',') satisfies not(matches($s, '^(?:\\p{IsHangulSyllables})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00461() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsHighSurrogates})$')) and (every $s in tokenize('''힣', ',') satisfies not(matches($s, '^(?:\\p{IsHighSurrogates})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00462() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCJKCompatibilityIdeographs})$')) and (every $s in tokenize('\uf8ff', ',') satisfies not(matches($s, '^(?:\\p{IsCJKCompatibilityIdeographs})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00463() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsAlphabeticPresentationForms})$')) and (every $s in tokenize('\ufaff', ',') satisfies not(matches($s, '^(?:\\p{IsAlphabeticPresentationForms})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00464() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsArabicPresentationForms-A})$')) and (every $s in tokenize('ï­', ',') satisfies not(matches($s, '^(?:\\p{IsArabicPresentationForms-A})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00465() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCombiningHalfMarks})$')) and (every $s in tokenize('\ufdff', ',') satisfies not(matches($s, '^(?:\\p{IsCombiningHalfMarks})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00466() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCJKCompatibilityForms})$')) and (every $s in tokenize('\ufe2f', ',') satisfies not(matches($s, '^(?:\\p{IsCJKCompatibilityForms})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00467() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsSmallFormVariants})$')) and (every $s in tokenize('\ufe4f', ',') satisfies not(matches($s, '^(?:\\p{IsSmallFormVariants})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00468() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsArabicPresentationForms-B})$')) and (every $s in tokenize('\ufe6f', ',') satisfies not(matches($s, '^(?:\\p{IsArabicPresentationForms-B})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00469() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsSpecials})$')) and (every $s in tokenize('\ufefe,\uffef', ',') satisfies not(matches($s, '^(?:\\p{IsSpecials})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00470() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsHalfwidthandFullwidthForms})$')) and (every $s in tokenize('\ufeff', ',') satisfies not(matches($s, '^(?:\\p{IsHalfwidthandFullwidthForms})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00471() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsOldItalic})$')) and (every $s in tokenize('�', ',') satisfies not(matches($s, '^(?:\\p{IsOldItalic})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00472() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsGothic})$')) and (every $s in tokenize('\ud800\udf2f', ',') satisfies not(matches($s, '^(?:\\p{IsGothic})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00473() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsDeseret})$')) and (every $s in tokenize('\ud800\udf4f', ',') satisfies not(matches($s, '^(?:\\p{IsDeseret})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00474() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsByzantineMusicalSymbols})$')) and (every $s in tokenize('ð‘', ',') satisfies not(matches($s, '^(?:\\p{IsByzantineMusicalSymbols})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00475() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsMusicalSymbols})$')) and (every $s in tokenize('\ud834\udcff', ',') satisfies not(matches($s, '^(?:\\p{IsMusicalSymbols})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00476() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsMathematicalAlphanumericSymbols})$')) and (every $s in tokenize('\ud834\uddff', ',') satisfies not(matches($s, '^(?:\\p{IsMathematicalAlphanumericSymbols})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00477() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCJKUnifiedIdeographsExtensionB})$')) and (every $s in tokenize('ðŸ¿', ',') satisfies not(matches($s, '^(?:\\p{IsCJKUnifiedIdeographsExtensionB})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00478() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsCJKCompatibilityIdeographsSupplement})$')) and (every $s in tokenize('𪛖', ',') satisfies not(matches($s, '^(?:\\p{IsCJKCompatibilityIdeographsSupplement})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00479() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsTags})$')) and (every $s in tokenize('\ud87e\ude1f', ',') satisfies not(matches($s, '^(?:\\p{IsTags})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00480() { final XQuery query = new XQuery( "(every $s in tokenize('\udbbf\udffd', ',') satisfies matches($s, '^(?:\\p{IsPrivateUse})$')) and (every $s in tokenize('\udb40\udc7f', ',') satisfies not(matches($s, '^(?:\\p{IsPrivateUse})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00481() { final XQuery query = new XQuery( "(every $s in tokenize('a, ', ',') satisfies matches($s, '^(?:.)$')) and (every $s in tokenize('aa,', ',') satisfies not(matches($s, '^(?:.)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00482() { final XQuery query = new XQuery( "(every $s in tokenize(' ,\n" + ",\r,\t', ',') satisfies matches($s, '^(?:\\s)$')) and (every $s in tokenize('a,', ',') satisfies not(matches($s, '^(?:\\s)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00483() { final XQuery query = new XQuery( "(every $s in tokenize(' \t\n" + "\ra c\n" + "\t\r a \n" + "\r\t \r\n" + ",aa a', ',') satisfies matches($s, '^(?:\\s*\\c\\s?\\c\\s+\\c\\s*)$')) and (every $s in tokenize(' a a a,aaa, a aa ', ',') satisfies not(matches($s, '^(?:\\s*\\c\\s?\\c\\s+\\c\\s*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00484() { final XQuery query = new XQuery( "(every $s in tokenize('aa,a a,a a', ',') satisfies matches($s, '^(?:a\\s{0,3}a)$')) and (every $s in tokenize('a a,aa a', ',') satisfies not(matches($s, '^(?:a\\s{0,3}a)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00485() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:a\\sb)$')) and (every $s in tokenize('a \n" + "b', ',') satisfies not(matches($s, '^(?:a\\sb)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00486() { final XQuery query = new XQuery( "(every $s in tokenize('a', ',') satisfies matches($s, '^(?:\\S)$')) and (every $s in tokenize(' ,\n" + ",\r,\t,aa', ',') satisfies not(matches($s, '^(?:\\S)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00487() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\S+)$')) and (every $s in tokenize('a b', ',') satisfies not(matches($s, '^(?:\\S+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00488() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\S*)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\S*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00489() { final XQuery query = new XQuery( "(every $s in tokenize('a b\t, a \r', ',') satisfies matches($s, '^(?:\\S?\\s?\\S?\\s+)$')) and (every $s in tokenize('a b, a b,ab', ',') satisfies not(matches($s, '^(?:\\S?\\s?\\S?\\s+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00490() { final XQuery query = new XQuery( "(every $s in tokenize('_,:,a', ',') satisfies matches($s, '^(?:\\i)$')) and (every $s in tokenize(' ,\n" + ",\r,\t', ',') satisfies not(matches($s, '^(?:\\i)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00491() { final XQuery query = new XQuery( "(every $s in tokenize('_:abcdefghijklmnopqrstuvwxyzAZ:_', ',') satisfies matches($s, '^(?:\\i*)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\i*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00492() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\i+)$')) and (every $s in tokenize('a b', ',') satisfies not(matches($s, '^(?:\\i+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00493() { final XQuery query = new XQuery( "(every $s in tokenize('zabcsdea', ',') satisfies matches($s, '^(?:\\c\\i*a)$')) and (every $s in tokenize('ab', ',') satisfies not(matches($s, '^(?:\\c\\i*a)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00494() { final XQuery query = new XQuery( "(every $s in tokenize('a b c Z :_ d\ry \tb \n" + " ', ',') satisfies matches($s, '^(?:[\\s\\i]*)$')) and (every $s in tokenize('1', ',') satisfies not(matches($s, '^(?:[\\s\\i]*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00495() { final XQuery query = new XQuery( "(every $s in tokenize(' ,\n" + ",\r,\t', ',') satisfies matches($s, '^(?:\\I)$')) and (every $s in tokenize('_,:,a', ',') satisfies not(matches($s, '^(?:\\I)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00496() { final XQuery query = new XQuery( "(every $s in tokenize('1234', ',') satisfies matches($s, '^(?:\\I*)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\I*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00497() { final XQuery query = new XQuery( "(every $s in tokenize('a 123c', ',') satisfies matches($s, '^(?:a\\I+\\c)$')) and (every $s in tokenize('b123c,a123 123cc', ',') satisfies not(matches($s, '^(?:a\\I+\\c)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00498() { final XQuery query = new XQuery( "(every $s in tokenize('_,:,a', ',') satisfies matches($s, '^(?:\\c)$')) and (every $s in tokenize(' ,\n" + ",\r,\t', ',') satisfies not(matches($s, '^(?:\\c)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00499() { final XQuery query = new XQuery( "(every $s in tokenize('c?1 abc,?0\rzzz', ',') satisfies matches($s, '^(?:\\c?\\?\\d\\s\\c+)$')) and (every $s in tokenize('aa?3 c,a?2\n" + "', ',') satisfies not(matches($s, '^(?:\\c?\\?\\d\\s\\c+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00500() { final XQuery query = new XQuery( "(every $s in tokenize('a,aa,aaaaaaaaaaaaaaaaaaaaaaaaaa', ',') satisfies matches($s, '^(?:\\c?\\c+\\c*)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\c?\\c+\\c*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00501() { final XQuery query = new XQuery( "(every $s in tokenize(' ,\n" + ",\r,\t', ',') satisfies matches($s, '^(?:\\C)$')) and (every $s in tokenize('_,:,a', ',') satisfies not(matches($s, '^(?:\\C)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00502() { final XQuery query = new XQuery( "(every $s in tokenize('a*a**a***,aa*a', ',') satisfies matches($s, '^(?:\\c\\C?\\c\\C+\\c\\C*)$')) \n" + " and (every $s in tokenize(',a12b1c1,ab12345,1a2a2,a1b1c1a', ',') satisfies not(matches($s, '^(?:\\c\\C?\\c\\C+\\c\\C*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00503() { final XQuery query = new XQuery( "(every $s in tokenize('0,Û°,০,੦,૦,à­¦,௧,౦,೦,൦,à¹,à»,༠,á€,០,á ,ï¼,ðŸŽ,9,Ù©,Û¹,९,৯,੯,૯,à­¯,௯,౯,೯,൯,๙,à»™,༩,á‰,៩,á ™,ï¼™,ðŸ¿', ',') satisfies matches($s, '^(?:\\d)$')) \n" + " and (every $s in tokenize('),Ù™,Û®,\u0965,\u09e5,\u0a65,\u0ae5,\u0b65,\u0c65,\u0ce5,\u0d65,้,\u0ecf,༙,္,\u1368,\u17df,\u1809,\uff09,\ud835\udfcd,:,\u066a,Ûº,\u0970,à§°,\u0a79,\u0af0,à­°,௰,\u0c70,\u0cf0,൰,\u0e5a,\u0eda,༪,\u104a,á²,\u17ea,\u181a,\uff1a,\ud836\udc00', ',') satisfies not(matches($s, '^(?:\\d)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00504() { final XQuery query = new XQuery( "(every $s in tokenize('),Ù™,Û®,\u0965,\u09e5,\u0a65,\u0ae5,\u0b65,\u0c65,\u0ce5,\u0d65,้,\u0ecf,༙,္,\u1368,\u17df,\u1809,\uff09,\ud835\udfcd,:,\u066a,Ûº,\u0970,à§°,\u0a79,\u0af0,à­°,௰,\u0c70,\u0cf0,൰,\u0e5a,\u0eda,༪,\u104a,á²,\u17ea,\u181a,\uff1a,\ud836\udc00', ',') satisfies matches($s, '^(?:\\D)$')) \n" + " and (every $s in tokenize('0,Ù ,Û°,०,০,૦,௧,౦,೦,൦,à¹,à»,༠,á€,០,á ,ï¼,ðŸŽ,9,Ù©,Û¹,९,৯,੯,૯,à­¯,௯,౯,೯,൯,๙,à»™,༩,á‰,៩,á ™,ï¼™,ðŸ¿', ',') satisfies not(matches($s, '^(?:\\D)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00505() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\w)$')) and (every $s in tokenize('\uf8ff,\u070f,\u007f,\u2010,\ufe37,},\u201c,»,\u0f04, ,\u2028,\u2029', ',') satisfies not(matches($s, '^(?:\\w)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00506() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\W)$')) and (every $s in tokenize('A,ðž¨,a,a,ðŸ‰,Ç…,Ç…,ῼ,ʰ,ʰ,゚,×,×,ð¯¨,Ù‹,ð†­,ः,ð…²,ः,ð…²,âƒ,âƒ,⃢,ï¼,ðŸ¿,ðŠ,ðŠ,〥,²,²,ðŒ£,â„,ï¿¢,â‚ ,â‚ ,₩,ã‚›,ã‚›,ï¿£,ã†,ã†,ð‡', ',') satisfies not(matches($s, '^(?:\\W)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00507() { final XQuery query = new XQuery( "(every $s in tokenize('true', ',') satisfies matches($s, '^(?:true)$')) and (every $s in tokenize('false', ',') satisfies not(matches($s, '^(?:true)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00508() { final XQuery query = new XQuery( "(every $s in tokenize('false', ',') satisfies matches($s, '^(?:false)$')) and (every $s in tokenize('true', ',') satisfies not(matches($s, '^(?:false)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00509() { final XQuery query = new XQuery( "(every $s in tokenize('true,false', ',') satisfies matches($s, '^(?:(true|false))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(true|false))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00510() { final XQuery query = new XQuery( "(every $s in tokenize('1', ',') satisfies matches($s, '^(?:(1|true))$')) and (every $s in tokenize('0', ',') satisfies not(matches($s, '^(?:(1|true))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00511() { final XQuery query = new XQuery( "(every $s in tokenize('0', ',') satisfies matches($s, '^(?:(1|true|false|0|0))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(1|true|false|0|0))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00512() { final XQuery query = new XQuery( "(every $s in tokenize('1111,11001010', ',') satisfies matches($s, '^(?:([0-1]{4}|(0|1){8}))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:([0-1]{4}|(0|1){8}))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00513() { final XQuery query = new XQuery( "(every $s in tokenize('AF01D1', ',') satisfies matches($s, '^(?:AF01D1)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:AF01D1)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00514() { final XQuery query = new XQuery( "(every $s in tokenize('1.001,1.001', ',') satisfies matches($s, '^(?:\\d*\\.\\d+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\d*\\.\\d+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00515() { final XQuery query = new XQuery( "(every $s in tokenize('http://www.foo.com', ',') satisfies matches($s, '^(?:http://\\c*)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:http://\\c*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00516() { final XQuery query = new XQuery( "(every $s in tokenize('a:b', ',') satisfies matches($s, '^(?:[\\i\\c]+:[\\i\\c]+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:[\\i\\c]+:[\\i\\c]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00517() { final XQuery query = new XQuery( "(every $s in tokenize('P1111Y12M', ',') satisfies matches($s, '^(?:P\\p{Nd}{4}Y\\p{Nd}{2}M)$')) and (every $s in tokenize('P111Y12M,P1111Y1M,P11111Y12M,P1111Y,P12M,P11111Y00M,P11111Y13M', ',') satisfies not(matches($s, '^(?:P\\p{Nd}{4}Y\\p{Nd}{2}M)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00518() { final XQuery query = new XQuery( "(every $s in tokenize('2001-06-06T12:12:00', ',') satisfies matches($s, '^(?:\\p{Nd}{4}-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{Nd}{4}-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00519() { final XQuery query = new XQuery( "(every $s in tokenize('11:00:00,13:20:00-05:00', ',') satisfies matches($s, '^(?:\\p{Nd}{2}:\\d\\d:\\d\\d(\\-\\d\\d:\\d\\d)?)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{Nd}{2}:\\d\\d:\\d\\d(\\-\\d\\d:\\d\\d)?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00520() { final XQuery query = new XQuery( "(every $s in tokenize('1999-12-12', ',') satisfies matches($s, '^(?:\\p{Nd}{4}-\\p{Nd}{2}-\\p{Nd}{2})$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{Nd}{4}-\\p{Nd}{2}-\\p{Nd}{2})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00521() { final XQuery query = new XQuery( "matches('qwerty','\\p{Nd}{4}-\\[{Nd}{2}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00522() { final XQuery query = new XQuery( "(every $s in tokenize('1999', ',') satisfies matches($s, '^(?:\\p{Nd}{4})$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{Nd}{4})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00523() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{Nd}{2})$')) and (every $s in tokenize('1999', ',') satisfies not(matches($s, '^(?:\\p{Nd}{2})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00524() { final XQuery query = new XQuery( "(every $s in tokenize('--03-14', ',') satisfies matches($s, '^(?:--0[123]\\-(12|14))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:--0[123]\\-(12|14))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00525() { final XQuery query = new XQuery( "(every $s in tokenize('---30', ',') satisfies matches($s, '^(?:---([123]0)|([12]?[1-9])|(31))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:---([123]0)|([12]?[1-9])|(31))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00526() { final XQuery query = new XQuery( "(every $s in tokenize('--12--', ',') satisfies matches($s, '^(?:--((0[1-9])|(1(1|2)))--)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:--((0[1-9])|(1(1|2)))--)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00527() { final XQuery query = new XQuery( "(every $s in tokenize('a,abcdef', ',') satisfies matches($s, '^(?:\\c+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\c+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00528() { final XQuery query = new XQuery( "(every $s in tokenize('ch-a', ',') satisfies matches($s, '^(?:\\c{2,4})$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\c{2,4})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00529() { final XQuery query = new XQuery( "(every $s in tokenize('ab', ',') satisfies matches($s, '^(?:[\\i\\c]*)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:[\\i\\c]*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00530() { final XQuery query = new XQuery( "(every $s in tokenize('a1b,ab,ab,name1', ',') satisfies matches($s, '^(?:\\c[\\c\\d]*)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\c[\\c\\d]*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00531() { final XQuery query = new XQuery( "(every $s in tokenize('10000101,10000201', ',') satisfies matches($s, '^(?:\\p{Nd}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{Nd}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00532() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\-\\d\\d)$')) and (every $s in tokenize('11', ',') satisfies not(matches($s, '^(?:\\-\\d\\d)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00533() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\-?\\d)$')) and (every $s in tokenize('+1', ',') satisfies not(matches($s, '^(?:\\-?\\d)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00534() { final XQuery query = new XQuery( "(every $s in tokenize('123,12', ',') satisfies matches($s, '^(?:\\d+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\d+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00535() { final XQuery query = new XQuery( "(every $s in tokenize('-300', ',') satisfies matches($s, '^(?:\\-?[0-3]{3})$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\-?[0-3]{3})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00536() { final XQuery query = new XQuery( "(every $s in tokenize('-128', ',') satisfies matches($s, '^(?:((\\-|\\+)?[1-127])|(\\-?128))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:((\\-|\\+)?[1-127])|(\\-?128))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00537() { final XQuery query = new XQuery( "(every $s in tokenize('1111', ',') satisfies matches($s, '^(?:\\p{Nd}\\d+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{Nd}\\d+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00538() { final XQuery query = new XQuery( "(every $s in tokenize('123', ',') satisfies matches($s, '^(?:\\d+\\d+\\d+)$')) and (every $s in tokenize('12', ',') satisfies not(matches($s, '^(?:\\d+\\d+\\d+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00539() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\d+\\d+\\p{Nd}\\d+)$')) and (every $s in tokenize('123', ',') satisfies not(matches($s, '^(?:\\d+\\d+\\p{Nd}\\d+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00540() { final XQuery query = new XQuery( "(every $s in tokenize('+1,1,+9', ',') satisfies matches($s, '^(?:\\+?\\d)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\+?\\d)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00541() { final XQuery query = new XQuery( "matches('qwerty','++')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00542() { final XQuery query = new XQuery( "(every $s in tokenize('9,0', ',') satisfies matches($s, '^(?:[0-9]*)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:[0-9]*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00543() { final XQuery query = new XQuery( "(every $s in tokenize('-11111,-9', ',') satisfies matches($s, '^(?:\\-[0-9]*)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\-[0-9]*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00544() { final XQuery query = new XQuery( "(every $s in tokenize('1,3', ',') satisfies matches($s, '^(?:[13])$')) and (every $s in tokenize('2', ',') satisfies not(matches($s, '^(?:[13])$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00545() { final XQuery query = new XQuery( "(every $s in tokenize('112233123,abcaabbccabc', ',') satisfies matches($s, '^(?:[123]+|[abc]+)$')) and (every $s in tokenize('1a,a1', ',') satisfies not(matches($s, '^(?:[123]+|[abc]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00546() { final XQuery query = new XQuery( "(every $s in tokenize('112233123,abcaabbccabc,abab', ',') satisfies matches($s, '^(?:([abc]+)|([123]+))$')) and (every $s in tokenize('1a,1a,x', ',') satisfies not(matches($s, '^(?:([abc]+)|([123]+))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00547() { final XQuery query = new XQuery( "(every $s in tokenize('abab', ',') satisfies matches($s, '^(?:[abxyz]+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:[abxyz]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00548() { final XQuery query = new XQuery( "(every $s in tokenize('Hello World', ',') satisfies matches($s, '^(?:(\\p{Lu}\\w*)\\s(\\p{Lu}\\w*))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(\\p{Lu}\\w*)\\s(\\p{Lu}\\w*))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00549() { final XQuery query = new XQuery( "(every $s in tokenize('Hello World', ',') satisfies matches($s, '^(?:(\\p{Lu}\\p{Ll}*)\\s(\\p{Lu}\\p{Ll}*))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(\\p{Lu}\\p{Ll}*)\\s(\\p{Lu}\\p{Ll}*))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00550() { final XQuery query = new XQuery( "(every $s in tokenize('Hello World', ',') satisfies matches($s, '^(?:(\\P{Ll}\\p{Ll}*)\\s(\\P{Ll}\\p{Ll}*))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(\\P{Ll}\\p{Ll}*)\\s(\\P{Ll}\\p{Ll}*))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00551() { final XQuery query = new XQuery( "(every $s in tokenize('hellO worlD', ',') satisfies matches($s, '^(?:(\\P{Lu}+\\p{Lu})\\s(\\P{Lu}+\\p{Lu}))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(\\P{Lu}+\\p{Lu})\\s(\\P{Lu}+\\p{Lu}))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00552() { final XQuery query = new XQuery( "(every $s in tokenize('Ç…ello Ç…orld', ',') satisfies matches($s, '^(?:(\\p{Lt}\\w*)\\s(\\p{Lt}*\\w*))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(\\p{Lt}\\w*)\\s(\\p{Lt}*\\w*))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00553() { final XQuery query = new XQuery( "(every $s in tokenize('Hello World', ',') satisfies matches($s, '^(?:(\\P{Lt}\\w*)\\s(\\P{Lt}*\\w*))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(\\P{Lt}\\w*)\\s(\\P{Lt}*\\w*))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00554() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[@-D]+)$')) and (every $s in tokenize('eE?@ABCDabcdeE', ',') satisfies not(matches($s, '^(?:[@-D]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00555() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[>-D]+)$')) and (every $s in tokenize('eE=>?@ABCDabcdeE', ',') satisfies not(matches($s, '^(?:[>-D]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00556() { final XQuery query = new XQuery( "matches('qwerty','[\\u0554-\\u0557]+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00557() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[X-\\]]+)$')) and (every $s in tokenize('wWXYZxyz[\\]^', ',') satisfies not(matches($s, '^(?:[X-\\]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00558() { final XQuery query = new XQuery( "matches('qwerty','[X-\\u0533]+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00559() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[X-a]+)$')) and (every $s in tokenize('wWAXYZaxyz', ',') satisfies not(matches($s, '^(?:[X-a]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00560() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[X-c]+)$')) and (every $s in tokenize('wWABCXYZabcxyz', ',') satisfies not(matches($s, '^(?:[X-c]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00561() { final XQuery query = new XQuery( "matches('qwerty','[X-\\u00C0]+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00562() { final XQuery query = new XQuery( "matches('qwerty','[\\u0100\\u0102\\u0104]+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00563() { final XQuery query = new XQuery( "matches('qwerty','[B-D\\u0130]+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00564() { final XQuery query = new XQuery( "matches('qwerty','[\\u013B\\u013D\\u013F]+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00565() { final XQuery query = new XQuery( "(every $s in tokenize('Foo Bar,Foo Bar', ',') satisfies matches($s, '^(?:(Foo) (Bar))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(Foo) (Bar))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00566() { final XQuery query = new XQuery( "matches('qwerty','\\p{klsak')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00567() { final XQuery query = new XQuery( "matches('qwerty','{5')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00568() { final XQuery query = new XQuery( "matches('qwerty','{5,')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00569() { final XQuery query = new XQuery( "matches('qwerty','{5,6')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00570() { final XQuery query = new XQuery( "matches('qwerty','(?r:foo)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00571() { final XQuery query = new XQuery( "matches('qwerty','(?c:foo)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00572() { final XQuery query = new XQuery( "matches('qwerty','(?n:(foo)(\\s+)(bar))')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00573() { final XQuery query = new XQuery( "matches('qwerty','(?e:foo)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00574() { final XQuery query = new XQuery( "matches('qwerty','(?+i:foo)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00575() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:foo([\\d]*)bar)$')) and (every $s in tokenize('hello123foo230927bar1412d,hello123foo230927bar1412d', ',') satisfies not(matches($s, '^(?:foo([\\d]*)bar)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00576() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:([\\D]*)bar)$')) and (every $s in tokenize('65498foobar58719,65498foobar58719', ',') satisfies not(matches($s, '^(?:([\\D]*)bar)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00577() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:foo([\\s]*)bar)$')) and (every $s in tokenize('wiofoo bar3270,wiofoo bar3270', ',') satisfies not(matches($s, '^(?:foo([\\s]*)bar)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00578() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:foo([\\S]*))$')) and (every $s in tokenize('sfdfoobar 3270,sfdfoobar 3270', ',') satisfies not(matches($s, '^(?:foo([\\S]*))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00579() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:foo([\\w]*))$')) and (every $s in tokenize('sfdfoobar 3270,sfdfoobar 3270', ',') satisfies not(matches($s, '^(?:foo([\\w]*))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00580() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:foo([\\W]*)bar)$')) and (every $s in tokenize('wiofoo bar3270,wiofoo bar3270', ',') satisfies not(matches($s, '^(?:foo([\\W]*)bar)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00581() { final XQuery query = new XQuery( "(every $s in tokenize('Hello World,Hello World', ',') satisfies matches($s, '^(?:([\\p{Lu}]\\w*)\\s([\\p{Lu}]\\w*))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:([\\p{Lu}]\\w*)\\s([\\p{Lu}]\\w*))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00582() { final XQuery query = new XQuery( "(every $s in tokenize('Hello World,Hello World', ',') satisfies matches($s, '^(?:([\\P{Ll}][\\p{Ll}]*)\\s([\\P{Ll}][\\p{Ll}]*))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:([\\P{Ll}][\\p{Ll}]*)\\s([\\P{Ll}][\\p{Ll}]*))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00583() { final XQuery query = new XQuery( "matches('qwerty','foo([a-\\d]*)bar')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00584() { final XQuery query = new XQuery( "matches('qwerty','([5-\\D]*)bar')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00585() { final XQuery query = new XQuery( "matches('qwerty','foo([6-\\s]*)bar')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00586() { final XQuery query = new XQuery( "matches('qwerty','foo([c-\\S]*)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00587() { final XQuery query = new XQuery( "matches('qwerty','foo([7-\\w]*)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00588() { final XQuery query = new XQuery( "matches('qwerty','foo([a-\\W]*)bar')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00589() { final XQuery query = new XQuery( "matches('qwerty','([f-\\p{Lu}]\\w*)\\s([\\p{Lu}]\\w*)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00590() { final XQuery query = new XQuery( "matches('qwerty','([1-\\P{Ll}][\\p{Ll}]*)\\s([\\P{Ll}][\\p{Ll}]*)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00591() { final XQuery query = new XQuery( "matches('qwerty','[\\p]')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00592() { final XQuery query = new XQuery( "matches('qwerty','[\\P]')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00593() { final XQuery query = new XQuery( "matches('qwerty','([\\pfoo])')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00594() { final XQuery query = new XQuery( "matches('qwerty','([\\Pfoo])')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00595() { final XQuery query = new XQuery( "matches('qwerty','(\\p{')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00596() { final XQuery query = new XQuery( "matches('qwerty','(\\p{Ll')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00597() { final XQuery query = new XQuery( "matches('qwerty','(foo)([\\x41]*)(bar)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00598() { final XQuery query = new XQuery( "matches('qwerty','(foo)([\\u0041]*)(bar)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00599() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(foo)([\\r]*)(bar))$')) and (every $s in tokenize('foo bar', ',') satisfies not(matches($s, '^(?:(foo)([\\r]*)(bar))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00600() { final XQuery query = new XQuery( "matches('qwerty','(foo)([\\o]*)(bar)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00601() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(foo)\\d*bar)$')) and (every $s in tokenize('hello123foo230927bar1412d', ',') satisfies not(matches($s, '^(?:(foo)\\d*bar)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00602() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\D*(bar))$')) and (every $s in tokenize('65498foobar58719', ',') satisfies not(matches($s, '^(?:\\D*(bar))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00603() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(foo)\\s*(bar))$')) and (every $s in tokenize('wiofoo bar3270', ',') satisfies not(matches($s, '^(?:(foo)\\s*(bar))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00604() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(foo)\\S*)$')) and (every $s in tokenize('sfdfoobar 3270', ',') satisfies not(matches($s, '^(?:(foo)\\S*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00605() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(foo)\\w*)$')) and (every $s in tokenize('sfdfoobar 3270', ',') satisfies not(matches($s, '^(?:(foo)\\w*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00606() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(foo)\\W*(bar))$')) and (every $s in tokenize('wiofoo bar3270', ',') satisfies not(matches($s, '^(?:(foo)\\W*(bar))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00607() { final XQuery query = new XQuery( "(every $s in tokenize('Hello World', ',') satisfies matches($s, '^(?:\\p{Lu}(\\w*)\\s\\p{Lu}(\\w*))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{Lu}(\\w*)\\s\\p{Lu}(\\w*))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00608() { final XQuery query = new XQuery( "(every $s in tokenize('Hello World', ',') satisfies matches($s, '^(?:\\P{Ll}\\p{Ll}*\\s\\P{Ll}\\p{Ll}*)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\P{Ll}\\p{Ll}*\\s\\P{Ll}\\p{Ll}*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00609() { final XQuery query = new XQuery( "matches('qwerty','foo(?(?#COMMENT)foo)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00610() { final XQuery query = new XQuery( "matches('qwerty','foo(?(?afdfoo)bar)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00611() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(foo) #foo \\s+ #followed by 1 or more whitespace (bar) #followed by bar )$')) and (every $s in tokenize('foo bar', ',') satisfies not(matches($s, '^(?:(foo) #foo \\s+ #followed by 1 or more whitespace (bar) #followed by bar )$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00612() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(foo) #foo \\s+ #followed by 1 or more whitespace (bar) #followed by bar)$')) and (every $s in tokenize('foo bar', ',') satisfies not(matches($s, '^(?:(foo) #foo \\s+ #followed by 1 or more whitespace (bar) #followed by bar)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00613() { final XQuery query = new XQuery( "matches('qwerty','(foo) (?#foo) \\s+ (?#followed by 1 or more whitespace) (bar) (?#followed by bar)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00614() { final XQuery query = new XQuery( "matches('qwerty','(foo) (?#foo) \\s+ (?#followed by 1 or more whitespace')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00615() { final XQuery query = new XQuery( "matches('qwerty','(foo)(\\077)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00616() { final XQuery query = new XQuery( "matches('qwerty','(foo)(\\77)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00617() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(foo)(\\176))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(foo)(\\176))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00618() { final XQuery query = new XQuery( "matches('qwerty','(foo)(\\300)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00619() { final XQuery query = new XQuery( "matches('qwerty','(foo)(\\477)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00620() { final XQuery query = new XQuery( "matches('qwerty','(foo)(\\777)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00621() { final XQuery query = new XQuery( "matches('qwerty','(foo)(\\7770)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00622() { final XQuery query = new XQuery( "matches('qwerty','(foo)(\\7)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00623() { final XQuery query = new XQuery( "matches('qwerty','(foo)(\\40)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00624() { final XQuery query = new XQuery( "matches('qwerty','(foo)(\\040)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00625() { final XQuery query = new XQuery( "matches('qwerty','(foo)(\\377)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00626() { final XQuery query = new XQuery( "matches('qwerty','(foo)(\\400)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00627() { final XQuery query = new XQuery( "matches('qwerty','(foo)(\\x2a*)(bar)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00628() { final XQuery query = new XQuery( "matches('qwerty','(foo)(\\x2b*)(bar)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00629() { final XQuery query = new XQuery( "matches('qwerty','(foo)(\\x2c*)(bar)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00630() { final XQuery query = new XQuery( "matches('qwerty','(foo)(\\x2d*)(bar)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00631() { final XQuery query = new XQuery( "matches('qwerty','(foo)(\\x2e*)(bar)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00632() { final XQuery query = new XQuery( "matches('qwerty','(foo)(\\x2f*)(bar)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00633() { final XQuery query = new XQuery( "matches('qwerty','(foo)(\\x2A*)(bar)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00634() { final XQuery query = new XQuery( "matches('qwerty','(foo)(\\x2B*)(bar)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00635() { final XQuery query = new XQuery( "matches('qwerty','(foo)(\\x2C*)(bar)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00636() { final XQuery query = new XQuery( "matches('qwerty','(foo)(\\x2D*)(bar)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00637() { final XQuery query = new XQuery( "matches('qwerty','(foo)(\\x2E*)(bar)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00638() { final XQuery query = new XQuery( "matches('qwerty','(foo)(\\x2F*)(bar)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00639() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(foo)(\\c*)(bar))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(foo)(\\c*)(bar))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00640() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(foo)\\c)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(foo)\\c)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00641() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(foo)(\\c *)(bar))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(foo)(\\c *)(bar))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00642() { final XQuery query = new XQuery( "matches('qwerty','(foo)(\\c?*)(bar)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00643() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(foo)(\\c`*)(bar))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(foo)(\\c`*)(bar))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00644() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(foo)(\\c\\|*)(bar))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(foo)(\\c\\|*)(bar))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00645() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(foo)(\\c\\[*)(bar))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(foo)(\\c\\[*)(bar))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00646() { final XQuery query = new XQuery( "matches('qwerty','\\A(foo)\\s+(bar)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00647() { final XQuery query = new XQuery( "matches('qwerty','(foo)\\s+(bar)\\Z')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00648() { final XQuery query = new XQuery( "matches('qwerty','(foo)\\s+(bar)\\z')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00649() { final XQuery query = new XQuery( "matches('qwerty','\\b@foo')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00650() { final XQuery query = new XQuery( "matches('qwerty','\\b,foo')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00651() { final XQuery query = new XQuery( "matches('qwerty','\\b\\[foo')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00652() { final XQuery query = new XQuery( "matches('qwerty','\\B@foo')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00653() { final XQuery query = new XQuery( "matches('qwerty','\\B,foo')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00654() { final XQuery query = new XQuery( "matches('qwerty','\\B\\[foo')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00655() { final XQuery query = new XQuery( "(every $s in tokenize('fooʰ barʱ', ',') satisfies matches($s, '^(?:(\\w+)\\s+(\\w+))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(\\w+)\\s+(\\w+))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00656() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(foo\\w+)\\s+(bar\\w+))$')) and (every $s in tokenize('STARTfooー bar々END,STARTfoo゙ bar゚END', ',') satisfies not(matches($s, '^(?:(foo\\w+)\\s+(bar\\w+))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00657() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:([^{}]|\\n)+)$')) and (every $s in tokenize('{{{{Hello World }END', ',') satisfies not(matches($s, '^(?:([^{}]|\\n)+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00658() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(([0-9])|([a-z])|([A-Z]))*)$')) and (every $s in tokenize('{hello 1234567890 world},{HELLO 1234567890 world},{1234567890 hello world}', ',') satisfies not(matches($s, '^(?:(([0-9])|([a-z])|([A-Z]))*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00659() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(([0-9])|([a-z])|([A-Z]))+)$')) and (every $s in tokenize('{hello 1234567890 world},{HELLO 1234567890 world},{1234567890 hello world}', ',') satisfies not(matches($s, '^(?:(([0-9])|([a-z])|([A-Z]))+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00660() { final XQuery query = new XQuery( "(every $s in tokenize('aaabbbcccdddeeefff', ',') satisfies matches($s, '^(?:(([a-d]*)|([a-z]*)))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(([a-d]*)|([a-z]*)))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00661() { final XQuery query = new XQuery( "(every $s in tokenize('dddeeeccceee', ',') satisfies matches($s, '^(?:(([d-f]*)|([c-e]*)))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(([d-f]*)|([c-e]*)))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00662() { final XQuery query = new XQuery( "(every $s in tokenize('dddeeeccceee', ',') satisfies matches($s, '^(?:(([c-e]*)|([d-f]*)))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(([c-e]*)|([d-f]*)))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00663() { final XQuery query = new XQuery( "(every $s in tokenize('aaabbbcccdddeeefff', ',') satisfies matches($s, '^(?:(([a-d]*)|(.*)))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(([a-d]*)|(.*)))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00664() { final XQuery query = new XQuery( "(every $s in tokenize('dddeeeccceee', ',') satisfies matches($s, '^(?:(([d-f]*)|(.*)))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(([d-f]*)|(.*)))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00665() { final XQuery query = new XQuery( "(every $s in tokenize('dddeeeccceee', ',') satisfies matches($s, '^(?:(([c-e]*)|(.*)))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(([c-e]*)|(.*)))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00666() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:CH)$')) and (every $s in tokenize('Ch,Ch', ',') satisfies not(matches($s, '^(?:CH)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00667() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:cH)$')) and (every $s in tokenize('Ch,Ch', ',') satisfies not(matches($s, '^(?:cH)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00668() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:AA)$')) and (every $s in tokenize('Aa,Aa', ',') satisfies not(matches($s, '^(?:AA)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00669() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:aA)$')) and (every $s in tokenize('Aa,Aa', ',') satisfies not(matches($s, '^(?:aA)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00670() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:ı)$')) and (every $s in tokenize('I,I,I,i,I,i', ',') satisfies not(matches($s, '^(?:ı)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00671() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:İ)$')) and (every $s in tokenize('i,i,I,i,I,i', ',') satisfies not(matches($s, '^(?:İ)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00672() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:([0-9]+?)([\\w]+?))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:([0-9]+?)([\\w]+?))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00673() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:([0-9]+?)([a-z]+?))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:([0-9]+?)([a-z]+?))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00674() { final XQuery query = new XQuery( "matches('qwerty','^[abcd]{0,16}*$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00675() { final XQuery query = new XQuery( "matches('qwerty','^[abcd]{1,}*$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00676() { final XQuery query = new XQuery( "matches('qwerty','^[abcd]{1}*$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00677() { final XQuery query = new XQuery( "matches('qwerty','^[abcd]{0,16}?*$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00678() { final XQuery query = new XQuery( "matches('qwerty','^[abcd]{1,}?*$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00679() { final XQuery query = new XQuery( "matches('qwerty','^[abcd]{1}?*$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00680() { final XQuery query = new XQuery( "matches('qwerty','^[abcd]*+$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00681() { final XQuery query = new XQuery( "matches('qwerty','^[abcd]+*$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00682() { final XQuery query = new XQuery( "matches('qwerty','^[abcd]?*$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00683() { final XQuery query = new XQuery( "matches('qwerty','^[abcd]*?+$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00684() { final XQuery query = new XQuery( "matches('qwerty','^[abcd]+?*$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00685() { final XQuery query = new XQuery( "matches('qwerty','^[abcd]??*$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00686() { final XQuery query = new XQuery( "matches('qwerty','^[abcd]*{0,5}$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00687() { final XQuery query = new XQuery( "matches('qwerty','^[abcd]+{0,5}$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00688() { final XQuery query = new XQuery( "matches('qwerty','^[abcd]?{0,5}$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00689() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:http://([a-zA-z0-9\\-]*\\.?)*?(:[0-9]*)??/)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:http://([a-zA-z0-9\\-]*\\.?)*?(:[0-9]*)??/)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00690() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:http://([a-zA-Z0-9\\-]*\\.?)*?/)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:http://([a-zA-Z0-9\\-]*\\.?)*?/)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00691() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:([a-z]*?)([\\w]))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:([a-z]*?)([\\w]))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00692() { final XQuery query = new XQuery( "(every $s in tokenize('foo', ',') satisfies matches($s, '^(?:([a-z]*)([\\w]))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:([a-z]*)([\\w]))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00693() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[abcd-[d]]+)$')) and (every $s in tokenize('dddaabbccddd', ',') satisfies not(matches($s, '^(?:[abcd-[d]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00694() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\d-[357]]+)$')) and (every $s in tokenize('33312468955,51246897,3312468977', ',') satisfies not(matches($s, '^(?:[\\d-[357]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00695() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\w-[b-y]]+)$')) and (every $s in tokenize('bbbaaaABCD09zzzyyy,bbbaaaABCD09zzzyyy,bbbaaaABCD09zzzyyy,bbbaaaABCD09zzzyyy', ',') satisfies not(matches($s, '^(?:[\\w-[b-y]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00696() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\w-[\\d]]+)$')) and (every $s in tokenize('0AZaz9', ',') satisfies not(matches($s, '^(?:[\\w-[\\d]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00697() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\w-[\\p{Ll}]]+)$')) and (every $s in tokenize('a09AZz', ',') satisfies not(matches($s, '^(?:[\\w-[\\p{Ll}]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00698() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\d-[13579]]+)$')) and (every $s in tokenize('1024689', ',') satisfies not(matches($s, '^(?:[\\d-[13579]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00699() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\p{Ll}-[ae-z]]+)$')) and (every $s in tokenize('aaabbbcccdddeee', ',') satisfies not(matches($s, '^(?:[\\p{Ll}-[ae-z]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00700() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\p{Nd}-[2468]]+)$')) and (every $s in tokenize('20135798', ',') satisfies not(matches($s, '^(?:[\\p{Nd}-[2468]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00701() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\P{Lu}-[ae-z]]+)$')) and (every $s in tokenize('aaabbbcccdddeee', ',') satisfies not(matches($s, '^(?:[\\P{Lu}-[ae-z]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00702() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[abcd-[def]]+)$')) and (every $s in tokenize('fedddaabbccddd', ',') satisfies not(matches($s, '^(?:[abcd-[def]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00703() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\d-[357a-z]]+)$')) and (every $s in tokenize('az33312468955', ',') satisfies not(matches($s, '^(?:[\\d-[357a-z]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00704() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\d-[de357fgA-Z]]+)$')) and (every $s in tokenize('AZ51246897', ',') satisfies not(matches($s, '^(?:[\\d-[de357fgA-Z]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00705() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\d-[357\\p{Ll}]]+)$')) and (every $s in tokenize('az3312468977', ',') satisfies not(matches($s, '^(?:[\\d-[357\\p{Ll}]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00706() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\w-[b-y\\s]]+)$')) and (every $s in tokenize(' bbbaaaABCD09zzzyyy', ',') satisfies not(matches($s, '^(?:[\\w-[b-y\\s]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00707() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\w-[\\d\\p{Po}]]+)$')) and (every $s in tokenize('!#0AZaz9', ',') satisfies not(matches($s, '^(?:[\\w-[\\d\\p{Po}]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00708() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\w-[\\p{Ll}\\s]]+)$')) and (every $s in tokenize('a09AZz', ',') satisfies not(matches($s, '^(?:[\\w-[\\p{Ll}\\s]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00709() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\d-[13579a-zA-Z]]+)$')) and (every $s in tokenize('AZ1024689', ',') satisfies not(matches($s, '^(?:[\\d-[13579a-zA-Z]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00710() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\d-[13579abcd]]+)$')) and (every $s in tokenize('abcdÙ¡02468Ù ', ',') satisfies not(matches($s, '^(?:[\\d-[13579abcd]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00711() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\d-[13579\\s]]+)$')) and (every $s in tokenize(' Ù¡02468Ù ', ',') satisfies not(matches($s, '^(?:[\\d-[13579\\s]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00712() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\w-[b-y\\p{Po}]]+)$')) and (every $s in tokenize('!#bbbaaaABCD09zzzyyy', ',') satisfies not(matches($s, '^(?:[\\w-[b-y\\p{Po}]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00713() { final XQuery query = new XQuery( "(every $s in tokenize('', ';') satisfies matches($s, '^(?:[\\w-[b-y!.,]]+)$')) and (every $s in tokenize('!.,bbbaaaABCD09zzzyyy', ';') satisfies not(matches($s, '^(?:[\\w-[b-y!.,]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00714() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\p{Ll}-[ae-z0-9]]+)$')) and (every $s in tokenize('09aaabbbcccdddeee', ',') satisfies not(matches($s, '^(?:[\\p{Ll}-[ae-z0-9]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00715() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\p{Nd}-[2468az]]+)$')) and (every $s in tokenize('az20135798', ',') satisfies not(matches($s, '^(?:[\\p{Nd}-[2468az]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00716() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\P{Lu}-[ae-zA-Z]]+)$')) and (every $s in tokenize('AZaaabbbcccdddeee', ',') satisfies not(matches($s, '^(?:[\\P{Lu}-[ae-zA-Z]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00717() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[abc-[defg]]+)$')) and (every $s in tokenize('dddaabbccddd', ',') satisfies not(matches($s, '^(?:[abc-[defg]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00718() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\d-[abc]]+)$')) and (every $s in tokenize('abc09abc', ',') satisfies not(matches($s, '^(?:[\\d-[abc]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00719() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\d-[a-zA-Z]]+)$')) and (every $s in tokenize('az09AZ,azAZÙ¡02468Ù ', ',') satisfies not(matches($s, '^(?:[\\d-[a-zA-Z]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00720() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\d-[\\p{Ll}]]+)$')) and (every $s in tokenize('az09az', ',') satisfies not(matches($s, '^(?:[\\d-[\\p{Ll}]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00721() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\w-[\\p{Po}]]+)$')) and (every $s in tokenize('#a09AZz!', ',') satisfies not(matches($s, '^(?:[\\w-[\\p{Po}]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00722() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\d-[\\D]]+)$')) and (every $s in tokenize('azAZ1024689', ',') satisfies not(matches($s, '^(?:[\\d-[\\D]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00723() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[a-zA-Z0-9-[\\s]]+)$')) and (every $s in tokenize(' azAZ09', ',') satisfies not(matches($s, '^(?:[a-zA-Z0-9-[\\s]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00724() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\p{Ll}-[A-Z]]+)$')) and (every $s in tokenize('AZaz09', ',') satisfies not(matches($s, '^(?:[\\p{Ll}-[A-Z]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00725() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\p{Nd}-[a-z]]+)$')) and (every $s in tokenize('az09', ',') satisfies not(matches($s, '^(?:[\\p{Nd}-[a-z]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00726() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\P{Lu}-[\\p{Lu}]]+)$')) and (every $s in tokenize('AZazAZ', ',') satisfies not(matches($s, '^(?:[\\P{Lu}-[\\p{Lu}]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00727() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\P{Lu}-[A-Z]]+)$')) and (every $s in tokenize('AZazAZ', ',') satisfies not(matches($s, '^(?:[\\P{Lu}-[A-Z]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00728() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\P{Nd}-[\\p{Nd}]]+)$')) and (every $s in tokenize('azAZ09', ',') satisfies not(matches($s, '^(?:[\\P{Nd}-[\\p{Nd}]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00729() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\P{Nd}-[2-8]]+)$')) and (every $s in tokenize('1234567890azAZ1234567890', ',') satisfies not(matches($s, '^(?:[\\P{Nd}-[2-8]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00730() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:([ ]|[\\w-[0-9]])+)$')) and (every $s in tokenize('09az AZ90', ',') satisfies not(matches($s, '^(?:([ ]|[\\w-[0-9]])+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00731() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:([0-9-[02468]]|[0-9-[13579]])+)$')) and (every $s in tokenize('az1234567890za', ',') satisfies not(matches($s, '^(?:([0-9-[02468]]|[0-9-[13579]])+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00732() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:([^0-9-[a-zAE-Z]]|[\\w-[a-zAF-Z]])+)$')) and (every $s in tokenize('azBCDE1234567890BCDEFza', ',') satisfies not(matches($s, '^(?:([^0-9-[a-zAE-Z]]|[\\w-[a-zAF-Z]])+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00733() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:([\\p{Ll}-[aeiou]]|[^\\w-[\\s]])+)$')) and (every $s in tokenize('aeiobcdxyz!@#aeio', ',') satisfies not(matches($s, '^(?:([\\p{Ll}-[aeiou]]|[^\\w-[\\s]])+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00734() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:98[\\d-[9]][\\d-[8]][\\d-[0]])$')) and (every $s in tokenize('98911 98881 98870 98871', ',') satisfies not(matches($s, '^(?:98[\\d-[9]][\\d-[8]][\\d-[0]])$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00735() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:m[\\w-[^aeiou]][\\w-[^aeiou]]t)$')) and (every $s in tokenize('mbbt mect meet', ',') satisfies not(matches($s, '^(?:m[\\w-[^aeiou]][\\w-[^aeiou]]t)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00736() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[abcdef-[^bce]]+)$')) and (every $s in tokenize('adfbcefda', ',') satisfies not(matches($s, '^(?:[abcdef-[^bce]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00737() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[^cde-[ag]]+)$')) and (every $s in tokenize('agbfxyzga', ',') satisfies not(matches($s, '^(?:[^cde-[ag]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00738() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[\\p{IsGreek}-[\\P{Lu}]]+)$')) and (every $s in tokenize('ÎϾΆΈϬϮЀ', ',') satisfies not(matches($s, '^(?:[\\p{IsGreek}-[\\P{Lu}]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00739() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[a-zA-Z-[aeiouAEIOU]]+)$')) and (every $s in tokenize('aeiouAEIOUbcdfghjklmnpqrstvwxyz', ',') satisfies not(matches($s, '^(?:[a-zA-Z-[aeiouAEIOU]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00740() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[abcd\\-d-[bc]]+)$')) and (every $s in tokenize('bbbaaa---dddccc,bbbaaa---dddccc', ',') satisfies not(matches($s, '^(?:[abcd\\-d-[bc]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00741() { final XQuery query = new XQuery( "matches('qwerty','[^a-f-[\\x00-\\x60\\u007B-\\uFFFF]]+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00742() { final XQuery query = new XQuery( "matches('qwerty','[a-f-[]]+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00743() { final XQuery query = new XQuery( "matches('qwerty','[\\[\\]a-f-[[]]+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00744() { final XQuery query = new XQuery( "matches('qwerty','[\\[\\]a-f-[]]]+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00745() { final XQuery query = new XQuery( "matches('qwerty','[ab\\-\\[cd-[-[]]]]')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00746() { final XQuery query = new XQuery( "matches('qwerty','[ab\\-\\[cd-[[]]]]')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00747() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[a-[a-f]])$')) and (every $s in tokenize('abcdefghijklmnopqrstuvwxyz', ',') satisfies not(matches($s, '^(?:[a-[a-f]])$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00748() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[a-[c-e]]+)$')) and (every $s in tokenize('bbbaaaccc,```aaaccc', ',') satisfies not(matches($s, '^(?:[a-[c-e]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00749() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[a-d\\--[bc]]+)$')) and (every $s in tokenize('cccaaa--dddbbb', ',') satisfies not(matches($s, '^(?:[a-d\\--[bc]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00750() { final XQuery query = new XQuery( "matches('qwerty','[[abcd]-[bc]]+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00751() { final XQuery query = new XQuery( "matches('qwerty','[-[e-g]+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00752() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[-e-g]+)$')) and (every $s in tokenize('ddd---eeefffggghhh,ddd---eeefffggghhh', ',') satisfies not(matches($s, '^(?:[-e-g]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00753() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[a-e - m-p]+)$')) and (every $s in tokenize('---a b c d e m n o p---', ',') satisfies not(matches($s, '^(?:[a-e - m-p]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00754() { final XQuery query = new XQuery( "matches('qwerty','[^-[bc]]')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00755() { final XQuery query = new XQuery( "matches('qwerty','[A-[]+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00756() { final XQuery query = new XQuery( "matches('qwerty','[a\\-[bc]+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00757() { final XQuery query = new XQuery( "matches('qwerty','[a\\-[\\-\\-bc]+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00758() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[a\\-\\[\\-\\[\\-bc]+)$')) and (every $s in tokenize('```bbbaaa---[[[cccddd', ',') satisfies not(matches($s, '^(?:[a\\-\\[\\-\\[\\-bc]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00759() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[abc\\--[b]]+)$')) and (every $s in tokenize('[[[```bbbaaa---cccddd', ',') satisfies not(matches($s, '^(?:[abc\\--[b]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00760() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:[abc\\-z-[b]]+)$')) and (every $s in tokenize('```aaaccc---zzzbbb', ',') satisfies not(matches($s, '^(?:[abc\\-z-[b]]+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00761() { final XQuery query = new XQuery( "matches('qwerty','[a-d\\-[b]+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00762() { final XQuery query = new XQuery( "matches('qwerty','[abcd\\-d\\-[bc]+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00763() { final XQuery query = new XQuery( "matches('qwerty','[a - c - [ b ] ]+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00764() { final XQuery query = new XQuery( "matches('qwerty','[a - c - [ b ] +')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00765() { final XQuery query = new XQuery( "matches('qwerty','(?\\\\S+)\\\\s(?\\\\S+)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00766() { final XQuery query = new XQuery( "matches('qwerty','(a+)(?:b*)(ccc)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00767() { final XQuery query = new XQuery( "matches('qwerty','abc(?=XXX)\\w+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00768() { final XQuery query = new XQuery( "matches('qwerty','abc(?!XXX)\\w+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00769() { final XQuery query = new XQuery( "matches('qwerty','[^0-9]+(?>[0-9]+)3')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00770() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:^aa$)$')) and (every $s in tokenize('aA', ',') satisfies not(matches($s, '^(?:^aa$)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00771() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:^Aa$)$')) and (every $s in tokenize('aA', ',') satisfies not(matches($s, '^(?:^Aa$)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00772() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\s+\\d+)$')) and (every $s in tokenize('sdf 12sad', ',') satisfies not(matches($s, '^(?:\\s+\\d+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00773() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:foo\\d+)$')) and (every $s in tokenize('0123456789foo4567890foo ,0123456789foo4567890foo1foo 0987', ',') satisfies not(matches($s, '^(?:foo\\d+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00774() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:foo\\s+)$')) and (every $s in tokenize('0123456789foo4567890foo ', ',') satisfies not(matches($s, '^(?:foo\\s+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00775() { final XQuery query = new XQuery( "(every $s in tokenize('hellofoo barworld', ',') satisfies matches($s, '^(?:(hello)foo\\s+bar(world))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(hello)foo\\s+bar(world))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00776() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(hello)\\s+(world))$')) and (every $s in tokenize('What the hello world goodby,What the hello world goodby,START hello world END,START hello world END', ',') satisfies not(matches($s, '^(?:(hello)\\s+(world))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00777() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(foo)\\s+(bar))$')) and (every $s in tokenize('before textfoo barafter text,before textfoo barafter text,before textfoo barafter text', ',') satisfies not(matches($s, '^(?:(foo)\\s+(bar))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00778() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(d)(o)(g)(\\s)(c)(a)(t)(\\s)(h)(a)(s))$')) and (every $s in tokenize('My dog cat has fleas.,My dog cat has fleas.', ',') satisfies not(matches($s, '^(?:(d)(o)(g)(\\s)(c)(a)(t)(\\s)(h)(a)(s))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00779() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:^([a-z0-9]+)@([a-z]+)\\.([a-z]+)$)$')) and (every $s in tokenize('bar@bar.foo.com', ',') satisfies not(matches($s, '^(?:^([a-z0-9]+)@([a-z]+)\\.([a-z]+)$)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00780() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:^http://www.([a-zA-Z0-9]+)\\.([a-z]+)$)$')) and (every $s in tokenize('http://www.foo.bar.com', ',') satisfies not(matches($s, '^(?:^http://www.([a-zA-Z0-9]+)\\.([a-z]+)$)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00781() { final XQuery query = new XQuery( "(every $s in tokenize('abc\\nsfc', ',') satisfies matches($s, '^(?:(.*))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(.*))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00782() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?: ((.)+) )$')) and (every $s in tokenize('abc', ',') satisfies not(matches($s, '^(?: ((.)+) )$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00783() { final XQuery query = new XQuery( "(every $s in tokenize(' abc ', ',') satisfies matches($s, '^(?: ([^/]+) )$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?: ([^/]+) )$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00784() { final XQuery query = new XQuery( "matches('qwerty','.*\\B(SUCCESS)\\B.*')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00785() { final XQuery query = new XQuery( "matches('qwerty','\\060(\\061)?\\061')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00786() { final XQuery query = new XQuery( "matches('qwerty','(\\x30\\x31\\x32)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00787() { final XQuery query = new XQuery( "matches('qwerty','(\\u0034)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00788() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(a+)(b*)(c?))$')) and (every $s in tokenize('aaabbbccc', ',') satisfies not(matches($s, '^(?:(a+)(b*)(c?))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00789() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(d+?)(e*?)(f??))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(d+?)(e*?)(f??))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00790() { final XQuery query = new XQuery( "(every $s in tokenize('aaa', ',') satisfies matches($s, '^(?:(111|aaa))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(111|aaa))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00791() { final XQuery query = new XQuery( "matches('qwerty','(abbc)(?(1)111|222)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00792() { final XQuery query = new XQuery( "matches('qwerty','.*\\b(\\w+)\\b')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00793() { final XQuery query = new XQuery( "(every $s in tokenize('ab.cc', ',') satisfies matches($s, '^(?:a+\\.?b*\\.+c{2})$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:a+\\.?b*\\.+c{2})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00794() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(abra(cad)?)+)$')) and (every $s in tokenize('abracadabra1abracadabra2abracadabra3', ',') satisfies not(matches($s, '^(?:(abra(cad)?)+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00795() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:^(cat|chat))$')) and (every $s in tokenize('cats are bad', ',') satisfies not(matches($s, '^(?:^(cat|chat))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00796() { final XQuery query = new XQuery( "(every $s in tokenize('209.25.0.111', ',') satisfies matches($s, '^(?:([0-9]+(\\.[0-9]+){3}))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:([0-9]+(\\.[0-9]+){3}))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00797() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:qqq(123)*)$')) and (every $s in tokenize('Startqqq123123End', ',') satisfies not(matches($s, '^(?:qqq(123)*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00798() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(\\s)?(-))$')) and (every $s in tokenize('once -upon-a time', ',') satisfies not(matches($s, '^(?:(\\s)?(-))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00799() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:a(.)c(.)e)$')) and (every $s in tokenize('123abcde456aBCDe789', ',') satisfies not(matches($s, '^(?:a(.)c(.)e)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00800() { final XQuery query = new XQuery( "(every $s in tokenize('Price: 5 dollars', ',') satisfies matches($s, '^(?:(\\S+):\\W(\\d+)\\s(\\D+))$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(\\S+):\\W(\\d+)\\s(\\D+))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00801() { final XQuery query = new XQuery( "matches('qwerty','a[b-a]')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00802() { final XQuery query = new XQuery( "matches('qwerty','a[]b')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00803() { final XQuery query = new XQuery( "matches('qwerty','a[')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00804() { final XQuery query = new XQuery( "matches('qwerty','a]')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00805() { final XQuery query = new XQuery( "matches('qwerty','a[]]b')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00806() { final XQuery query = new XQuery( "matches('qwerty','a[^]b]c')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00807() { final XQuery query = new XQuery( "matches('qwerty','\\ba\\b')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00808() { final XQuery query = new XQuery( "matches('qwerty','\\by\\b')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00809() { final XQuery query = new XQuery( "matches('qwerty','\\Ba\\B')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00810() { final XQuery query = new XQuery( "matches('qwerty','\\By\\b')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00811() { final XQuery query = new XQuery( "matches('qwerty','\\by\\B')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00812() { final XQuery query = new XQuery( "matches('qwerty','\\By\\B')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00813() { final XQuery query = new XQuery( "matches('qwerty','(*)b')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00814() { final XQuery query = new XQuery( "matches('qwerty','a\\')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00815() { final XQuery query = new XQuery( "matches('qwerty','abc)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00816() { final XQuery query = new XQuery( "matches('qwerty','(abc')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00817() { final XQuery query = new XQuery( "matches('qwerty','a**')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00818() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:a.+?c)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:a.+?c)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00819() { final XQuery query = new XQuery( "matches('qwerty','))((')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00820() { final XQuery query = new XQuery( "matches('qwerty','\\10((((((((((a))))))))))')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00821() { final XQuery query = new XQuery( "matches('qwerty','\\1(abc)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00822() { final XQuery query = new XQuery( "matches('qwerty','\\1([a-c]*)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00823() { final XQuery query = new XQuery( "matches('qwerty','\\1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00824() { final XQuery query = new XQuery( "matches('qwerty','\\2')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00825() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(a)|\\1)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(a)|\\1)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00826() { final XQuery query = new XQuery( "matches('qwerty','(a)|\\6')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00827() { final XQuery query = new XQuery( "matches('qwerty','(\\2b*?([a-c]))*')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00828() { final XQuery query = new XQuery( "matches('qwerty','(\\2b*?([a-c])){3}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00829() { final XQuery query = new XQuery( "matches('qwerty','(x(a)\\3(\\2|b))+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00830() { final XQuery query = new XQuery( "matches('qwerty','((a)\\3(\\2|b)){2,}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00831() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:ab*?bc)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:ab*?bc)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00832() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:ab{0,}?bc)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:ab{0,}?bc)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00833() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:ab+?bc)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:ab+?bc)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00834() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:ab{1,}?bc)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:ab{1,}?bc)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00835() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:ab{1,3}?bc)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:ab{1,3}?bc)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00836() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:ab{3,4}?bc)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:ab{3,4}?bc)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00837() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:ab{4,5}?bc)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:ab{4,5}?bc)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00838() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:ab??bc)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:ab??bc)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00839() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:ab{0,1}?bc)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:ab{0,1}?bc)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00840() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:ab??c)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:ab??c)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00841() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:ab{0,1}?c)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:ab{0,1}?c)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00842() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:a.*?c)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:a.*?c)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00843() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:a.{0,5}?c)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:a.{0,5}?c)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00844() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(a+|b){0,1}?)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(a+|b){0,1}?)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00845() { final XQuery query = new XQuery( "matches('qwerty','(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00846() { final XQuery query = new XQuery( "matches('qwerty','(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00847() { final XQuery query = new XQuery( "matches('qwerty','(.)(?:b|c|d)a')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00848() { final XQuery query = new XQuery( "matches('qwerty','(.)(?:b|c|d)*a')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00849() { final XQuery query = new XQuery( "matches('qwerty','(.)(?:b|c|d)+?a')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00850() { final XQuery query = new XQuery( "matches('qwerty','(.)(?:b|c|d)+a')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00851() { final XQuery query = new XQuery( "matches('qwerty','(.)(?:b|c|d){2}a')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00852() { final XQuery query = new XQuery( "matches('qwerty','(.)(?:b|c|d){4,5}a')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00853() { final XQuery query = new XQuery( "matches('qwerty','(.)(?:b|c|d){4,5}?a')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00854() { final XQuery query = new XQuery( "matches('qwerty',':(?:')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00855() { final XQuery query = new XQuery( "matches('qwerty','(.)(?:b|c|d){6,7}a')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00856() { final XQuery query = new XQuery( "matches('qwerty','(.)(?:b|c|d){6,7}?a')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00857() { final XQuery query = new XQuery( "matches('qwerty','(.)(?:b|c|d){5,6}a')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00858() { final XQuery query = new XQuery( "matches('qwerty','(.)(?:b|c|d){5,6}?a')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00859() { final XQuery query = new XQuery( "matches('qwerty','(.)(?:b|c|d){5,7}a')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00860() { final XQuery query = new XQuery( "matches('qwerty','(.)(?:b|c|d){5,7}?a')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00861() { final XQuery query = new XQuery( "matches('qwerty','(.)(?:b|(c|e){1,2}?|d)+?a')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00862() { final XQuery query = new XQuery( "matches('qwerty','^(?:a\\1?){4}$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00863() { final XQuery query = new XQuery( "matches('qwerty','^(?:a(?(1)\\1)){4}$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00864() { final XQuery query = new XQuery( "matches('qwerty','(?:(f)(o)(o)|(b)(a)(r))*')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00865() { final XQuery query = new XQuery( "matches('qwerty','(?:..)*a')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00866() { final XQuery query = new XQuery( "matches('qwerty','(?:..)*?a')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00867() { final XQuery query = new XQuery( "matches('qwerty','(?:(?i)a)b')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00868() { final XQuery query = new XQuery( "matches('qwerty','((?i)a)b')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00869() { final XQuery query = new XQuery( "matches('qwerty','(?i:a)b')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00870() { final XQuery query = new XQuery( "matches('qwerty','((?i:a))b')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00871() { final XQuery query = new XQuery( "matches('qwerty','(?:(?-i)a)b')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00872() { final XQuery query = new XQuery( "matches('qwerty','((?-i)a)b')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00873() { final XQuery query = new XQuery( "matches('qwerty','(?-i:a)b')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00874() { final XQuery query = new XQuery( "matches('qwerty','((?-i:a))b')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00875() { final XQuery query = new XQuery( "matches('qwerty','((?-i:a.))b')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00876() { final XQuery query = new XQuery( "matches('qwerty','((?s-i:a.))b')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00877() { final XQuery query = new XQuery( "matches('qwerty','(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00878() { final XQuery query = new XQuery( "matches('qwerty','(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00879() { final XQuery query = new XQuery( "matches('qwerty','\\1\\d(ab)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00880() { final XQuery query = new XQuery( "matches('qwerty','x(~~)*(?:(?:F)?)?')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00881() { final XQuery query = new XQuery( "matches('qwerty','^a(?#xxx){3}c')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00882() { final XQuery query = new XQuery( "matches('qwerty','^a (?#xxx) (?#yyy) {3}c')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00883() { final XQuery query = new XQuery( "matches('qwerty','^(?:?:a?b?)*$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00884() { final XQuery query = new XQuery( "matches('qwerty','((?s)^a(.))((?m)^b$)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00885() { final XQuery query = new XQuery( "matches('qwerty','((?m)^b$)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00886() { final XQuery query = new XQuery( "matches('qwerty','(?m)^b')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00887() { final XQuery query = new XQuery( "matches('qwerty','(?m)^(b)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00888() { final XQuery query = new XQuery( "matches('qwerty','((?m)^b)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00889() { final XQuery query = new XQuery( "matches('qwerty','\\n((?m)^b)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00890() { final XQuery query = new XQuery( "matches('qwerty','((?s).)c(?!.)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00891() { final XQuery query = new XQuery( "matches('qwerty','((?s)b.)c(?!.)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00892() { final XQuery query = new XQuery( "matches('qwerty','((c*)(?(1)a|b))')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00893() { final XQuery query = new XQuery( "matches('qwerty','((q*)(?(1)b|a))')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00894() { final XQuery query = new XQuery( "matches('qwerty','(?(1)a|b)(x)?')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00895() { final XQuery query = new XQuery( "matches('qwerty','(?(1)b|a)(x)?')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00896() { final XQuery query = new XQuery( "matches('qwerty','(?(1)b|a)()?')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00897() { final XQuery query = new XQuery( "matches('qwerty','(?(1)b|a)()')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00898() { final XQuery query = new XQuery( "matches('qwerty','(?(1)a|b)()?')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00899() { final XQuery query = new XQuery( "matches('qwerty','^(?:?(2)(\\())blah(\\))?$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00900() { final XQuery query = new XQuery( "matches('qwerty','^(?:?(2)(\\())blah(\\)+)?$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00901() { final XQuery query = new XQuery( "matches('qwerty','(?(1?)a|b)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00902() { final XQuery query = new XQuery( "matches('qwerty','(?(1)a|b|c)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00903() { final XQuery query = new XQuery( "matches('qwerty','(ba\\2)(?=(a+?))')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00904() { final XQuery query = new XQuery( "matches('qwerty','ba\\1(?=(a+?))$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00905() { final XQuery query = new XQuery( "matches('qwerty','(?>a+)b')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00906() { final XQuery query = new XQuery( "matches('qwerty','([[:]+)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00907() { final XQuery query = new XQuery( "matches('qwerty','([[=]+)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00908() { final XQuery query = new XQuery( "matches('qwerty','([[.]+)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00909() { final XQuery query = new XQuery( "matches('qwerty','[a[:xyz:')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00910() { final XQuery query = new XQuery( "matches('qwerty','[a[:xyz:]')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00911() { final XQuery query = new XQuery( "matches('qwerty','([a[:xyz:]b]+)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00912() { final XQuery query = new XQuery( "matches('qwerty','((?>a+)b)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00913() { final XQuery query = new XQuery( "matches('qwerty','(?>(a+))b')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00914() { final XQuery query = new XQuery( "matches('qwerty','((?>[^()]+)|\\([^()]*\\))+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00915() { final XQuery query = new XQuery( "matches('qwerty','a{37,17}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00916() { final XQuery query = new XQuery( "matches('qwerty','a\\Z')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00917() { final XQuery query = new XQuery( "matches('qwerty','b\\Z')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00918() { final XQuery query = new XQuery( "matches('qwerty','b\\z')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00919() { final XQuery query = new XQuery( "matches('qwerty','round\\(((?>[^()]+))\\)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00920() { final XQuery query = new XQuery( "matches('qwerty','(a\\1|(?(1)\\1)){2}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00921() { final XQuery query = new XQuery( "matches('qwerty','(a\\1|(?(1)\\1)){1,2}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00922() { final XQuery query = new XQuery( "matches('qwerty','(a\\1|(?(1)\\1)){0,2}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00923() { final XQuery query = new XQuery( "matches('qwerty','(a\\1|(?(1)\\1)){2,}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00924() { final XQuery query = new XQuery( "matches('qwerty','(a\\1|(?(1)\\1)){1,2}?')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00925() { final XQuery query = new XQuery( "matches('qwerty','(a\\1|(?(1)\\1)){0,2}?')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00926() { final XQuery query = new XQuery( "matches('qwerty','(a\\1|(?(1)\\1)){2,}?')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00927() { final XQuery query = new XQuery( "matches('qwerty','\\1a(\\d*){0,2}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00928() { final XQuery query = new XQuery( "matches('qwerty','\\1a(\\d*){2,}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00929() { final XQuery query = new XQuery( "matches('qwerty','\\1a(\\d*){0,2}?')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00930() { final XQuery query = new XQuery( "matches('qwerty','\\1a(\\d*){2,}?')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00931() { final XQuery query = new XQuery( "matches('qwerty','z\\1a(\\d*){2,}?')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00932() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:((((((((((a))))))))))\\10)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:((((((((((a))))))))))\\10)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00933() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(abc)\\1)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(abc)\\1)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00934() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:([a-c]*)\\1)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:([a-c]*)\\1)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00935() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(([a-c])b*?\\2)*)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(([a-c])b*?\\2)*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00936() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:(([a-c])b*?\\2){3})$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:(([a-c])b*?\\2){3})$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00937() { final XQuery query = new XQuery( "matches('qwerty','((\\3|b)\\2(a)x)+')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00938() { final XQuery query = new XQuery( "matches('qwerty','((\\3|b)\\2(a)){2,}')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00939() { final XQuery query = new XQuery( "matches('qwerty','a(?!b).')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00940() { final XQuery query = new XQuery( "matches('qwerty','a(?=d).')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00941() { final XQuery query = new XQuery( "matches('qwerty','a(?=c|d).')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00942() { final XQuery query = new XQuery( "matches('qwerty','a(?:b|c|d)(.)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00943() { final XQuery query = new XQuery( "matches('qwerty','a(?:b|c|d)*(.)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00944() { final XQuery query = new XQuery( "matches('qwerty','a(?:b|c|d)+?(.)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00945() { final XQuery query = new XQuery( "matches('qwerty','a(?:b|c|d)+(.)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00946() { final XQuery query = new XQuery( "matches('qwerty','a(?:b|c|d){2}(.)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00947() { final XQuery query = new XQuery( "matches('qwerty','a(?:b|c|d){4,5}(.)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00948() { final XQuery query = new XQuery( "matches('qwerty','a(?:b|c|d){4,5}?(.)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00949() { final XQuery query = new XQuery( "matches('qwerty','a(?:b|c|d){6,7}(.)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00950() { final XQuery query = new XQuery( "matches('qwerty','a(?:b|c|d){6,7}?(.)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00951() { final XQuery query = new XQuery( "matches('qwerty','a(?:b|c|d){5,6}(.)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00952() { final XQuery query = new XQuery( "matches('qwerty','a(?:b|c|d){5,6}?(.)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00953() { final XQuery query = new XQuery( "matches('qwerty','a(?:b|c|d){5,7}(.)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00954() { final XQuery query = new XQuery( "matches('qwerty','a(?:b|c|d){5,7}?(.)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00955() { final XQuery query = new XQuery( "matches('qwerty','a(?:b|(c|e){1,2}?|d)+?(.)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00956() { final XQuery query = new XQuery( "matches('qwerty','^(?:?:b|a(?=(.)))*\\1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00957() { final XQuery query = new XQuery( "(every $s in tokenize('ab9ab', ',') satisfies matches($s, '^(?:(ab)\\d\\1)$')) and (every $s in tokenize('ab9aa', ',') satisfies not(matches($s, '^(?:(ab)\\d\\1)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00958() { final XQuery query = new XQuery( "matches('qwerty','((q*)(?(1)a|b))')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00959() { final XQuery query = new XQuery( "matches('qwerty','(x)?(?(1)a|b)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00960() { final XQuery query = new XQuery( "matches('qwerty','(x)?(?(1)b|a)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00961() { final XQuery query = new XQuery( "matches('qwerty','()?(?(1)b|a)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00962() { final XQuery query = new XQuery( "matches('qwerty','()(?(1)b|a)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00963() { final XQuery query = new XQuery( "matches('qwerty','()?(?(1)a|b)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00964() { final XQuery query = new XQuery( "matches('qwerty','^(?:\\()?blah(?(1)(\\)))$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00965() { final XQuery query = new XQuery( "matches('qwerty','^(?:\\(+)?blah(?(1)(\\)))$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00966() { final XQuery query = new XQuery( "matches('qwerty','(?(?!a)a|b)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00967() { final XQuery query = new XQuery( "matches('qwerty','(?(?!a)b|a)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00968() { final XQuery query = new XQuery( "matches('qwerty','(?(?=a)b|a)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00969() { final XQuery query = new XQuery( "matches('qwerty','(?(?=a)a|b)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00970() { final XQuery query = new XQuery( "matches('qwerty','(?=(a+?))(\\1ab)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00971() { final XQuery query = new XQuery( "matches('qwerty','^(?:?=(a+?))\\1ab')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00972() { final XQuery query = new XQuery( "matches('33a34', '^(\\d){0,2}a\\1$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00973() { final XQuery query = new XQuery( "matches('333a334', '^(\\d*){2,}a\\1$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00974() { final XQuery query = new XQuery( "\n" + " matches('22a3', '^(\\d*){0,2}?a\\1$')\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00975() { final XQuery query = new XQuery( "\n" + " matches('22a3', '^(\\d*){2,}?a\\1$')\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00976() { final XQuery query = new XQuery( "\n" + " matches('22a22z', '^(\\d*){2,}?a\\1z$')\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("xs:boolean") ); } /** * Test regex syntax. */ @org.junit.Test public void re00976a() { final XQuery query = new XQuery( "\n" + " matches('22a22', '^(\\d*){2,}?a\\1z$')\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test regex syntax. */ @org.junit.Test public void re00976b() { final XQuery query = new XQuery( "\n" + " matches('22a22', '^(\\d{2,})a\\1$')\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00977() { final XQuery query = new XQuery( "matches('qwerty','(?>\\d+)3')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00978() { final XQuery query = new XQuery( "matches('qwerty','(\\w(?=aa)aa)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax. */ @org.junit.Test public void re00979() { final XQuery query = new XQuery( "(every $s in tokenize('Ì€Ì̂̃̄̅̆̇̈̉̊̋̌ÌÌŽÌÌ̛̖̗̘̙̜̑̒̓̔̕̚Ì̴̵̶̷̸̡̢̧̨̞̟̠̣̤̥̦̩̪̫̬̭̮̯̰̱̲̳̹̺̻̼̽̾̿̀Í͇͈͉͂̓̈́͆͊͋͌ͅÍÍŽÍÍ͓͔͕͖͙͚͑͒͗͛͘͜Íͣͤͥͦͧͨͩͪͫͬͭͮͯ͟͢͞͠͡', ',') satisfies matches($s, '^(?:\\p{IsCombiningDiacriticalMarks}+)$')) and (every $s in tokenize('a', ',') satisfies not(matches($s, '^(?:\\p{IsCombiningDiacriticalMarks}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00980() { final XQuery query = new XQuery( "(every $s in tokenize('ЀÐЂЃЄЅІЇЈЉЊЋЌÐÐŽÐÐБВГДЕЖЗИЙКЛМÐОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрÑтуфхцчшщъыьÑÑŽÑÑёђѓєѕіїјљњћќÑўџѠѡѢѣѤѥѦѧѨѩѪѫѬѭѮѯѰѱѲѳѴѵѶѷѸѹѺѻѼѽѾѿҀÒÒ‚ÒƒÒ„Ò…Ò†Ò‡ÒˆÒ‰ÒŠÒ‹ÒŒÒÒŽÒÒÒ‘Ò’Ò“Ò”Ò•Ò–Ò—Ò˜Ò™ÒšÒ›ÒœÒÒžÒŸÒ Ò¡Ò¢Ò£Ò¤Ò¥Ò¦Ò§Ò¨Ò©ÒªÒ«Ò¬Ò­Ò®Ò¯Ò°Ò±Ò²Ò³Ò´ÒµÒ¶Ò·Ò¸Ò¹ÒºÒ»Ò¼Ò½Ò¾Ò¿Ó€ÓÓ‚ÓƒÓ„Ó…Ó†Ó‡ÓˆÓ‰ÓŠÓ‹ÓŒÓÓŽÓÓÓ‘Ó’Ó“Ó”Ó•Ó–Ó—Ó˜Ó™ÓšÓ›ÓœÓÓžÓŸÓ Ó¡Ó¢Ó£Ó¤Ó¥Ó¦Ó§Ó¨Ó©ÓªÓ«Ó¬Ó­Ó®Ó¯Ó°Ó±Ó²Ó³Ó´ÓµÓ¶Ó·Ó¸Ó¹ÓºÓ»Ó¼Ó½Ó¾Ó¿', ',') satisfies matches($s, '^(?:\\p{IsCyrillic}+)$')) and (every $s in tokenize('a', ',') satisfies not(matches($s, '^(?:\\p{IsCyrillic}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00981() { final XQuery query = new XQuery( "(every $s in tokenize('', ',') satisfies matches($s, '^(?:\\p{IsHighSurrogates}+)$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:\\p{IsHighSurrogates}+)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00982() { final XQuery query = new XQuery( "(every $s in tokenize('test@someverylongemailaddress.com', ',') satisfies matches($s, '^(?:^([0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\\w]*[0-9a-zA-Z])*\\.)+[a-zA-Z]{2,9}))$')) and (every $s in tokenize('mhk%mhk.me.uk', ',') satisfies not(matches($s, '^(?:^([0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\\w]*[0-9a-zA-Z])*\\.)+[a-zA-Z]{2,9}))$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00983() { final XQuery query = new XQuery( "(every $s in tokenize('first.last@seznam.cz,first-last@seznam.cz', ',') satisfies matches($s, '^(?:[\\w\\-\\.]+@.*)$')) and (every $s in tokenize('first_last@seznam.cz', ',') satisfies not(matches($s, '^(?:[\\w\\-\\.]+@.*)$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00984() { final XQuery query = new XQuery( "(every $s in tokenize('2,3,4,5,6,7,8,9,A,B,C,D,E,F,G,H,I,P,Q,R,S,T,U,V,W,X,Y,`,a,b,c,d,e,f,g,h,i,p,q,r,s,t,u,v,w,x,y,Ä€,Ä,Ä‚,ă,Ä„,Ä…,Ć,ć,Ĉ,ĉ,Ä,Ä‘,Ä’,Ä“,Ä”,Ä•,Ä–,Ä—,Ę,Ä™,Ä ,Ä¡,Ä¢,Ä£,Ĥ,Ä¥,Ħ,ħ,Ĩ,Ä©,İ,ı,IJ,ij,Ä´,ĵ,Ķ,Ä·,ĸ,Ĺ,Å€,Å,Å‚,Ń,Å„,Å…,ņ,Ň,ň,ʼn,Å,Å‘,Å’,Å“,Å”,Å•,Å–,Å—,Ř,Å™,Å ,Å¡,Å¢,Å£,Ť,Å¥,Ŧ,ŧ,Ũ,Å©,Ű,ű,Ų,ų,Å´,ŵ,Ŷ,Å·,Ÿ,Ź,Æ€,Æ,Æ‚,ƃ,Æ„,Æ…,Ɔ,Ƈ,ƈ,Ɖ,Æ,Æ‘,Æ’,Æ“,Æ”,Æ•,Æ–,Æ—,Ƙ,Æ™,È€,È,È‚,ȃ,È„,È…,Ȇ,ȇ,Ȉ,ȉ,È,È‘,È’,È“,È”,È•,È–,È—,Ș,È™,È ,È¢,È£,Ȥ,È¥,Ȧ,ȧ,Ȩ,È©,Ȱ,ȱ,Ȳ,ȳ,É,É‘,É’,É“,É”,É•,É–,É—,ɘ,É™,É ,É¡,É¢,É£,ɤ,É¥,ɦ,ɧ,ɨ,É©,ɰ,ɱ,ɲ,ɳ,É´,ɵ,ɶ,É·,ɸ,ɹ,Ê€,Ê,Ê‚,ʃ,Ê„,Ê…,ʆ,ʇ,ʈ,ʉ,Ê,Ê‘,Ê’,Ê“,Ê”,Ê•,Ê–,Ê—,ʘ,Ê™,Ì€,Ì,Ì‚,̃,Ì„,Ì…,̆,̇,̈,̉,Ì,Ì‘,Ì’,Ì“,Ì”,Ì•,Ì–,Ì—,̘,Ì™,Ì ,Ì¡,Ì¢,Ì£,̤,Ì¥,̦,̧,̨,Ì©,̰,̱,̲,̳,Ì´,̵,̶,Ì·,̸,̹,Í€,Í,Í‚,̓,Í„,Í…,͆,͇,͈,͉,Í ,Í¡,Í¢,Í£,ͤ,Í¥,ͦ,ͧ,ͨ,Í©,Í´,͵,΄,Î…,Ά,Έ,Ή,Î,Α,Î’,Γ,Δ,Ε,Ζ,Η,Θ,Ι,Ѐ,Ð,Ђ,Ѓ,Є,Ð…,І,Ї,Ј,Љ,Ð,Б,Ð’,Г,Д,Е,Ж,З,И,Й,Р,С,Т,У,Ф,Ð¥,Ц,Ч,Ш,Щ,а,б,в,г,д,е,ж,з,и,й,Ñ€,Ñ,Ñ‚,у,Ñ„,Ñ…,ц,ч,ш,щ,Ñ,Ñ‘,Ñ’,Ñ“,Ñ”,Ñ•,Ñ–,Ñ—,ј,Ñ™,Ñ ,Ñ¡,Ñ¢,Ñ£,Ѥ,Ñ¥,Ѧ,ѧ,Ѩ,Ñ©,Ѱ,ѱ,Ѳ,ѳ,Ñ´,ѵ,Ѷ,Ñ·,Ѹ,ѹ,Ò€,Ò,Ò‚,Òƒ,Ò„,Ò…,Ò†,Òˆ,Ò‰,Ò,Ò‘,Ò’,Ò“,Ò”,Ò•,Ò–,Ò—,Ò˜,Ò™,Ô€,Ô,Ô‚,Ôƒ,Ô„,Ô…,Ô†,Ô‡,Ôˆ,Ô‰,Ô±,Ô²,Ô³,Ô´,Ôµ,Ô¶,Ô·,Ô¸,Ô¹,Õ€,Õ,Õ‚,Õƒ,Õ„,Õ…,Õ†,Õ‡,Õˆ,Õ‰,Õ,Õ‘,Õ’,Õ“,Õ”,Õ•,Õ–,Õ™,Õ¡,Õ¢,Õ£,Õ¤,Õ¥,Õ¦,Õ§,Õ¨,Õ©,Õ°,Õ±,Õ²,Õ³,Õ´,Õµ,Õ¶,Õ·,Õ¸,Õ¹,Ö€,Ö,Ö‚,Öƒ,Ö„,Ö…,Ö†,Ö‡,Ö‘,Ö’,Ö“,Ö”,Ö•,Ö–,Ö—,Ö˜,Ö™,Ø¡,Ø¢,Ø£,ؤ,Ø¥,ئ,ا,ب,Ø©,ذ,ر,ز,س,Ø´,ص,ض,Ø·,ظ,ع,Ù€,Ù,Ù‚,Ùƒ,Ù„,Ù…,Ù†,Ù‡,Ùˆ,Ù‰,Ù,Ù‘,Ù’,Ù“,Ù”,Ù•,Ù ,Ù¡,Ù¢,Ù£,Ù¤,Ù¥,Ù¦,Ù§,Ù¨,Ù©,Ù°,Ù±,Ù²,Ù³,Ù´,Ùµ,Ù¶,Ù·,Ù¸,Ù¹,Ú€,Ú,Ú‚,Úƒ,Ú„,Ú…,Ú†,Ú‡,Úˆ,Ú‰,Ú,Ú‘,Ú’,Ú“,Ú”,Ú•,Ú–,Ú—,Ú˜,Ú™,Ü,Ü‘,Ü’,Ü“,Ü”,Ü•,Ü–,Ü—,ܘ,Ü™,Ü ,Ü¡,Ü¢,Ü£,ܤ,Ü¥,ܦ,ܧ,ܨ,Ü©,ܰ,ܱ,ܲ,ܳ,Ü´,ܵ,ܶ'||\n" + " ',Ü·,ܸ,ܹ,Ý€,Ý,Ý‚,݃,Ý„,Ý…,݆,݇,݈,݉,Þ€,Þ,Þ‚,Þƒ,Þ„,Þ…,Þ†,Þ‡,Þˆ,Þ‰,Þ,Þ‘,Þ’,Þ“,Þ”,Þ•,Þ–,Þ—,Þ˜,Þ™,à¤,ं,ः,अ,आ,इ,ई,उ,à¤,ऑ,ऒ,ओ,औ,क,ख,ग,घ,ङ,ठ,ड,ढ,ण,त,थ,द,ध,न,ऩ,र,ऱ,ल,ळ,ऴ,व,श,ष,स,ह,ी,à¥,ू,ृ,ॄ,ॅ,ॆ,े,ै,ॉ,à¥,॑,॒,॓,॔,क़,ख़,ॠ,ॡ,ॢ,ॣ,०,१,२,३,à¦,ং,ঃ,অ,আ,ই,ঈ,উ,à¦,ও,ঔ,ক,খ,গ,ঘ,ঙ,က,á€,ဂ,ဃ,င,စ,ဆ,ဇ,ဈ,ဉ,á€,ထ,ဒ,ဓ,န,ပ,ဖ,ဗ,ဘ,မ,ဠ,အ,ဣ,ဤ,ဥ,ဦ,ဧ,ဩ,ူ,ေ,ဲ,ံ,့,း,္,á€,á,á‚,áƒ,á„,á…,á†,á‡,áˆ,á‰,á,á‘,á’,á“,á”,á•,á–,á—,á˜,á™,á„€,á„,á„‚,ᄃ,á„„,á„…,ᄆ,ᄇ,ᄈ,ᄉ,á„,á„‘,á„’,á„“,á„”,á„•,á„–,á„—,ᄘ,á„™,á„ ,á„¡,á„¢,á„£,ᄤ,á„¥,ᄦ,á„§,ᄨ,á„©,á„°,ᄱ,ᄲ,ᄳ,á„´,ᄵ,á„¶,á„·,ᄸ,ᄹ,á…€,á…,á…‚,á…ƒ,á…„,á……,á…†,á…‡,á…ˆ,á…‰,á…,á…‘,á…’,á…“,á…”,á…•,á…–,á…—,á…˜,á…™,á… ,á…¡,á…¢,á…£,á…¤,á…¥,á…¦,á…§,á…¨,á…©,á…°,á…±,á…²,á…³,á…´,á…µ,á…¶,á…·,á…¸,á…¹,ᆀ,á†,ᆂ,ᆃ,ᆄ,ᆅ,ᆆ,ᆇ,ᆈ,ᆉ,á†,ᆑ,ᆒ,ᆓ,ᆔ,ᆕ,ᆖ,ᆗ,ᆘ,ᆙ,ሀ,áˆ,ሂ,ሃ,ሄ,ህ,ሆ,ለ,ሉ,áˆ,ሑ,ሒ,ሓ,ሔ,ሕ,ሖ,ሗ,መ,ሙ,ሠ,ሡ,ሢ,ሣ,ሤ,ሥ,ሦ,ሧ,ረ,ሩ,ሰ,ሱ,ሲ,ሳ,ሴ,ስ,ሶ,ሷ,ሸ,ሹ,ቀ,á‰,ቂ,ቃ,ቄ,ቅ,ቆ,ቈ,á‰,ቑ,ቒ,ቓ,ቔ,ቕ,ቖ,ቘ,በ,ቡ,ቢ,ባ,ቤ,ብ,ቦ,ቧ,ቨ,ቩ,ተ,ቱ,ቲ,ታ,ቴ,ት,ቶ,ቷ,ቸ,ቹ,ኀ,áŠ,ኂ,ኃ,ኄ,ኅ,ኆ,ኈ,áŠ,ኑ,ኒ,ና,ኔ,ን,ኖ,ኗ,ኘ,ኙ,ጀ,áŒ,ጂ,ጃ,ጄ,ጅ,ጆ,ጇ,ገ,ጉ,áŒ,ጒ,ጓ,ጔ,ጕ,ጘ,ጙ,ጠ,ጡ,ጢ,ጣ,ጤ,ጥ,ጦ,ጧ,ጨ,ጩ,ጰ,ጱ,ጲ,ጳ,ጴ,ጵ,ጶ,ጷ,ጸ,ጹ,á€,á,á‚,áƒ,á„,á…,á†,áˆ,á‰,á,á‘,á’,á“,á”,á•,á–,á—,á˜,á™,á©,á°,á±,á²,á³,á´,áµ,á¶,á·,á¸,á¹,á,á‚,áƒ,á„,á…,á†,á‡,áˆ,á‰,á,á‘,á’,á“,á”,á•,á–,á—,á˜,á™,á ,á¡,á¢,á£,á¤,á¥,á¦,á§,á¨,á©,á°,á±,á²,á³,á´,áµ,á¶,á·,á¸,á¹,á‘€,á‘,á‘‚,ᑃ,á‘„,á‘…,ᑆ,ᑇ,ᑈ,ᑉ,á‘,á‘‘,á‘’,á‘“,á‘”,á‘•,á‘–,á‘—,ᑘ,á‘™,á‘ ,á‘¡,á‘¢,á‘£,ᑤ,á‘¥,ᑦ,á‘§,ᑨ,á‘©,á‘°,ᑱ,ᑲ,ᑳ,á‘´,ᑵ,á‘¶,á‘·,ᑸ,ᑹ,á’€,á’,á’‚,á’ƒ,á’„,á’…,á’†,á’‡,á’ˆ,á’‰,á’'||\n" + " ',á’‘,á’’,á’“,á’”,á’•,á’–,á’—,á’˜,á’™,ᔀ,á”,ᔂ,ᔃ,ᔄ,á”…,ᔆ,ᔇ,ᔈ,ᔉ,á”,ᔑ,á”’,ᔓ,á””,ᔕ,á”–,á”—,ᔘ,á”™,á” ,ᔡ,ᔢ,ᔣ,ᔤ,ᔥ,ᔦ,á”§,ᔨ,ᔩ,á”°,á”±,ᔲ,ᔳ,á”´,ᔵ,á”¶,á”·,ᔸ,ᔹ,á•€,á•,á•‚,ᕃ,á•„,á•…,ᕆ,ᕇ,ᕈ,ᕉ,á•,á•‘,á•’,á•“,á•”,á••,á•–,á•—,ᕘ,á•™,á• ,á•¡,á•¢,á•£,ᕤ,á•¥,ᕦ,á•§,ᕨ,á•©,á•°,ᕱ,ᕲ,ᕳ,á•´,ᕵ,á•¶,á•·,ᕸ,ᕹ,á–€,á–,á–‚,á–ƒ,á–„,á–…,á–†,á–‡,á–ˆ,á–‰,á–,á–‘,á–’,á–“,á–”,á–•,á––,á–—,á–˜,á–™,ᘀ,á˜,ᘂ,ᘃ,ᘄ,ᘅ,ᘆ,ᘇ,ᘈ,ᘉ,á˜,ᘑ,ᘒ,ᘓ,ᘔ,ᘕ,ᘖ,ᘗ,ᘘ,ᘙ,ᘠ,ᘡ,ᘢ,ᘣ,ᘤ,ᘥ,ᘦ,ᘧ,ᘨ,ᘩ,ᘰ,ᘱ,ᘲ,ᘳ,ᘴ,ᘵ,ᘶ,ᘷ,ᘸ,ᘹ,ᙀ,á™,ᙂ,ᙃ,ᙄ,á™…,ᙆ,ᙇ,ᙈ,ᙉ,á™,ᙑ,á™’,ᙓ,á™”,ᙕ,á™–,á™—,ᙘ,á™™,á™ ,ᙡ,ᙢ,ᙣ,ᙤ,ᙥ,ᙦ,á™§,ᙨ,ᙩ,á™°,á™±,ᙲ,ᙳ,á™´,ᙵ,á™¶,áš,áš‚,ᚃ,áš„,áš…,ᚆ,ᚇ,ᚈ,ᚉ,áš,áš‘,áš’,áš“,áš”,áš•,áš–,áš—,ᚘ,áš™,ᜀ,áœ,ᜂ,ᜃ,ᜄ,ᜅ,ᜆ,ᜇ,ᜈ,ᜉ,áœ,ᜑ,ᜒ,ᜓ,᜔,ᜠ,ᜡ,ᜢ,ᜣ,ᜤ,ᜥ,ᜦ,ᜧ,ᜨ,ᜩ,ᜰ,ᜱ,ᜲ,ᜳ,᜴,á€,á,á‚,áƒ,á„,á…,á†,á‡,áˆ,á‰,á,á‘,á’,á“,á ,á¡,á¢,á£,á¤,á¥,á¦,á§,á¨,á©,á°,á²,á³,ក,áž,áž‚,ឃ,áž„,áž…,ឆ,ជ,ឈ,ញ,áž,áž‘,áž’,áž“,áž”,áž•,áž–,áž—,ម,áž™,á ,á ‘,á ’,á “,á ”,á •,á –,á —,á ˜,á ™,á  ,á ¡,á ¢,á £,á ¤,á ¥,á ¦,á §,á ¨,á ©,á °,á ±,á ²,á ³,á ´,á µ,á ¶,á ·,á ¸,á ¹,á¡€,á¡,á¡‚,ᡃ,á¡„,á¡…,ᡆ,ᡇ,ᡈ,ᡉ,á¡,á¡‘,á¡’,á¡“,á¡”,á¡•,á¡–,á¡—,ᡘ,á¡™,á¡ ,á¡¡,á¡¢,á¡£,ᡤ,á¡¥,ᡦ,á¡§,ᡨ,á¡©,á¡°,ᡱ,ᡲ,ᡳ,á¡´,ᡵ,á¡¶,á¡·,ᢀ,á¢,ᢂ,ᢃ,ᢄ,ᢅ,ᢆ,ᢇ,ᢈ,ᢉ,á¢,ᢑ,ᢒ,ᢓ,ᢔ,ᢕ,ᢖ,ᢗ,ᢘ,ᢙ,â„,â’,â°,â±,â´,âµ,â¶,â·,â¸,â¹,â‚€,â‚,â‚‚,₃,â‚„,â‚…,₆,₇,₈,₉,â„€,â„,â„‚,℃,â„„,â„…,℆,ℇ,℈,℉,â„,â„‘,â„’,â„“,â„”,â„•,â„–,â„—,℘,â„™,â„ ,â„¡,â„¢,â„£,ℤ,â„¥,Ω,â„§,ℨ,â„©,â„°,ℱ,Ⅎ,ℳ,â„´,ℵ,â„¶,â„·,ℸ,ℹ,â…€,â…,â…‚,â…ƒ,â…„,â……,â…†,â…‡,â…ˆ,â…‰,â…“,â…”,â…•,â…–,â…—,â…˜,â…™,â… ,â…¡,â…¢,â…£,â…¤,â…¥,â…¦,â…§,â…¨,â…©,â…°,â…±,â…²,â…³,â…´,â…µ,â…¶,â…·,â…¸,â…¹,ↀ,â†,ↂ,Ↄ,â†,↑,→,↓,↔,↕,↖,↗,↘,↙,∀,âˆ,∂,∃,∄,∅,∆,∇,∈,∉,âˆ,∑,−,∓,∔,∕,∖,∗,∘,∙,∠,∡,∢,∣,∤,∥,∦,∧,∨,∩,∰,∱,∲,∳,∴,∵'||\n" + " ',∶,∷,∸,∹,≀,â‰,≂,≃,≄,≅,≆,≇,≈,≉,â‰,≑,≒,≓,≔,≕,≖,≗,≘,≙,≠,≡,≢,≣,≤,≥,≦,≧,≨,≩,≰,≱,≲,≳,≴,≵,≶,≷,≸,≹,⊀,âŠ,⊂,⊃,⊄,⊅,⊆,⊇,⊈,⊉,âŠ,⊑,⊒,⊓,⊔,⊕,⊖,⊗,⊘,⊙,⌀,âŒ,⌂,⌃,⌄,⌅,⌆,⌇,⌈,⌉,âŒ,⌑,⌒,⌓,⌔,⌕,⌖,⌗,⌘,⌙,⌠,⌡,⌢,⌣,⌤,⌥,⌦,⌧,⌨,⌰,⌱,⌲,⌳,⌴,⌵,⌶,⌷,⌸,⌹,â€,â,â‚,âƒ,â„,â…,â†,â‡,âˆ,â‰,â,â‘,â’,â“,â”,â•,â–,â—,â˜,â™,â ,â¡,â¢,â£,â¤,â¥,â¦,â§,â¨,â©,â°,â±,â²,â³,â´,âµ,â¶,â·,â¸,â¹,⎀,âŽ,⎂,⎃,⎄,⎅,⎆,⎇,⎈,⎉,âŽ,⎑,⎒,⎓,⎔,⎕,⎖,⎗,⎘,⎙,â€,â,â‚,âƒ,â„,â…,â†,â‡,âˆ,â‰,â,â‘,â’,â“,â”,â•,â–,â—,â˜,â™,â ,â¡,â¢,â£,â¤,â¥,â¦,â‘€,â‘,â‘‚,⑃,â‘„,â‘…,⑆,⑇,⑈,⑉,â‘ ,â‘¡,â‘¢,â‘£,⑤,â‘¥,⑦,â‘§,⑨,â‘©,â‘°,⑱,⑲,⑳,â‘´,⑵,â‘¶,â‘·,⑸,⑹,â’€,â’,â’‚,â’ƒ,â’„,â’…,â’†,â’‡,â’ˆ,â’‰,â’,â’‘,â’’,â’“,â’”,â’•,â’–,â’—,â’˜,â’™,─,â”,│,┃,┄,â”…,┆,┇,┈,┉,â”,┑,â”’,┓,â””,┕,â”–,â”—,┘,â”™,â” ,┡,┢,┣,┤,┥,┦,â”§,┨,┩,â”°,â”±,┲,┳,â”´,┵,â”¶,â”·,┸,┹,â•€,â•,â•‚,╃,â•„,â•…,╆,╇,╈,╉,â•,â•‘,â•’,â•“,â•”,â••,â•–,â•—,╘,â•™,â• ,â•¡,â•¢,â•£,╤,â•¥,╦,â•§,╨,â•©,â•°,╱,╲,╳,â•´,╵,â•¶,â•·,╸,╹,â–€,â–,â–‚,â–ƒ,â–„,â–…,â–†,â–‡,â–ˆ,â–‰,â–,â–‘,â–’,â–“,â–”,â–•,â––,â–—,â–˜,â–™,☀,â˜,☂,☃,☄,★,☆,☇,☈,☉,â˜,☑,☒,☓,☖,☗,☙,☠,☡,☢,☣,☤,☥,☦,☧,☨,☩,☰,☱,☲,☳,☴,☵,☶,☷,☸,☹,♀,â™,♂,♃,♄,â™…,♆,♇,♈,♉,â™,♑,â™’,♓,â™”,♕,â™–,â™—,♘,â™™,â™ ,♡,♢,♣,♤,♥,♦,â™§,♨,♩,â™°,â™±,♲,♳,â™´,♵,â™¶,â™·,♸,♹,⚀,âš,âš‚,⚃,âš„,âš…,⚆,⚇,⚈,⚉,âœ,✂,✃,✄,✆,✇,✈,✉,âœ,✑,✒,✓,✔,✕,✖,✗,✘,✙,✠,✡,✢,✣,✤,✥,✦,✧,✩,✰,✱,✲,✳,✴,✵,✶,✷,✸,✹,â€,â,â‚,âƒ,â„,â…,â†,â‡,âˆ,â‰,â,â‘,â’,â–,â˜,â™,â¡,â¢,â£,â¤,â¥,â¦,â§,â¶,â·,â¸,â¹,➀,âž,âž‚,➃,âž„,âž…,➆,➇,➈,➉,âž,âž‘,âž’,âž“,âž”,➘,âž™,â €,â ,â ‚,â ƒ,â „,â …,â †,â ‡,â ˆ,â ‰,â ,â ‘,â ’,â “,â ”,â •,â –,â —,â ˜,â ™,â  ,â ¡,â ¢,â £,â ¤,â ¥,â ¦,â §,â ¨,â ©,â °,â ±,â ²,â ³,â ´,â µ,â ¶,â ·,â ¸,â ¹,â¡€,â¡,â¡‚,⡃,â¡„,â¡…,⡆,⡇,⡈,⡉,â¡,â¡‘,â¡’,â¡“,â¡”,â¡•,â¡–,â¡—,⡘,â¡™,â¡ ,â¡¡,â¡¢,â¡£,⡤,â¡¥,⡦,â¡§,⡨,â¡©,â¡°,⡱,⡲,⡳,â¡´,⡵,â¡¶,â¡·,⡸,⡹,⢀,â¢,⢂,⢃,⢄,⢅,⢆,⢇,⢈,⢉,â¢,⢑,⢒,⢓,⢔,⢕,⢖,⢗,⢘,⢙,⤀,â¤,⤂,⤃,⤄,⤅,⤆,⤇,⤈,⤉,â¤,⤑,⤒,⤓,⤔,⤕,⤖,⤗,⤘,⤙,⤠,⤡,⤢,⤣,⤤,⤥,⤦,⤧,⤨,⤩,⤰,⤱,⤲,⤳,⤴,⤵,⤶,⤷,⤸,⤹,⥀,â¥,⥂,⥃,⥄,⥅,⥆,⥇,⥈,⥉,â¥,⥑,⥒,⥓,⥔,⥕,⥖,⥗,⥘,⥙,⥠,⥡,⥢,⥣,⥤,⥥,⥦,⥧,⥨,⥩,⥰,⥱,⥲,⥳,⥴,⥵,⥶,⥷,⥸,⥹,⦀,â¦,⦂,⦙,〄,々,〆,〇,〒,〓,〠,〡,〢,〣,〤,〥,〦,〧,〨,〩,〱,〲,〳,〴,〵,〶,〷,〸,〹,ã,ã‚,ãƒ,ã„,ã…,ã†,ã‡,ãˆ,ã‰,ã,ã‘,ã’,ã“,ã”,ã•,ã–,ã—,ã˜,ã™,ã ,ã¡,ã¢,ã£,ã¤,ã¥,ã¦,ã§,ã¨,ã©,ã°,ã±,ã²,ã³,ã´,ãµ,ã¶,ã·,ã¸,ã¹,ã‚€,ã‚,ã‚‚,ゃ,ã‚„,ã‚…,ゆ,ょ,よ,ら,ã‚,ã‚‘,ã‚’,ã‚“,ã‚”,ã‚•,ã‚–,ã‚™,ã„…,ㄆ,ㄇ,ㄈ,ㄉ,ã„,ã„‘,ã„’,ã„“,ã„”,ã„•,ã„–,ã„—,ㄘ,ã„™,ã„ ,ã„¡,ã„¢,ã„£,ㄤ,ã„¥,ㄦ,ã„§,ㄨ,ã„©,ㄱ,ㄲ,ㄳ,ã„´,ㄵ,ã„¶,ã„·,ㄸ,ㄹ,ã…€,ã…,ã…‚,ã…ƒ,ã…„,ã……,ã…†,ã…‡,ã…ˆ,ã…‰,ã…,ã…‘,ã…’,ã…“,ã…”,ã…•,ã…–,ã…—,ã…˜,ã…™,ã… ,ã…¡,ã…¢,ã…£,ã…¤,ã…¥,ã…¦,ã…§,ã…¨,ã…©,ã…°,ã…±,ã…²,ã…³,ã…´,ã…µ,ã…¶,ã…·,ã…¸,ã…¹,ㆀ,ã†,ㆂ,ㆃ,ㆄ,ㆅ,ㆆ,ㆇ,ㆈ,ㆉ,ã†,㆑,㆒,㆓,㆔,㆕,㆖,㆗,㆘,㆙,㈀,ãˆ,㈂,㈃,㈄,㈅,㈆,㈇,㈈,㈉,ãˆ,㈑,㈒,㈓,㈔,㈕,㈖,㈗,㈘,㈙,㈠,㈡,㈢,㈣,㈤,㈥,㈦,㈧,㈨,㈩,㈰,㈱,㈲,㈳,㈴,㈵,㈶,㈷,㈸,㈹,㉀,ã‰,㉂,㉃,㉑,㉒,㉓,㉔,㉕,㉖,㉗,㉘,㉙,㉠,㉡,㉢,㉣,㉤,㉥,㉦,㉧,㉨,㉩,㉰,㉱,㉲,㉳,㉴,㉵,㉶,㉷,㉸,㉹,㊀,ãŠ,㊂,㊃,㊄,㊅,㊆,㊇,㊈,㊉,ãŠ,㊑,㊒,㊓,㊔,㊕,㊖,㊗,㊘,㊙,㌀,ãŒ,㌂,㌃,㌄,㌅,㌆,㌇,㌈,㌉,ãŒ,㌑,㌒,㌓,㌔,㌕,㌖,㌗,㌘,㌙,㌠,㌡,㌢,㌣,㌤,㌥,㌦,㌧,㌨,㌩,㌰,㌱,㌲,㌳,㌴,㌵,㌶,㌷,㌸,㌹,ã€,ã,ã‚,ãƒ,ã„,ã…,ã†,ã‡,ãˆ,ã‰,ã,ã‘,ã’,ã“,ã”,ã•,ã–,ã—,ã˜,ã™,ã ,ã¡,ã¢,ã£,ã¤,ã¥,ã¦,ã§,ã¨,ã©,ã°,ã±,ã²,ã³,ã´,ãµ,ã¶,㎀,ãŽ,㎂,㎃,㎄,㎅,㎆,㎇,㎈,㎉,ãŽ,㎑,㎒,㎓,㎔,㎕,㎖,㎗,㎘,㎙,ã€,ã,ã‚,ãƒ,ã„,ã…,ã†,ã‡,ãˆ,ã‰,ã,ã‘,ã’,ã“,ã”,ã•,ã–,ã—,ã˜,ã™,ã ,ã¡,ã¢,ã£,ã¤,ã¥,ã¦,ã§,ã¨,ã©,ã°,ã±,ã²,ã³,ã´,ãµ,ã¶,ã·,ã¸,ã¹,ã‘€,ã‘,ã‘‚,㑃,ã‘„,ã‘…,㑆,㑇,㑈,㑉,ã‘,ã‘‘,ã‘’,ã‘“,ã‘”,ã‘•,ã‘–,ã‘—,㑘,ã‘™,ã‘ ,ã‘¡,ã‘¢,ã‘£,㑤,ã‘¥,㑦,ã‘§,㑨,ã‘©,ã‘°,㑱,㑲,㑳,ã‘´,㑵,ã‘¶,ã‘·,㑸,㑹,ã’€,ã’,ã’‚,ã’ƒ,ã’„,ã’…,ã’†,ã’‡,ã’ˆ,ã’‰,ã’,ã’‘,ã’’,ã’“,ã’”,ã’•,ã’–,ã’—,ã’˜,ã’™,㔀,ã”,㔂,㔃,㔄,ã”…,㔆,㔇,㔈,㔉,ã”,㔑,ã”’,㔓,ã””,㔕,ã”–,ã”—,㔘,ã”™,ã” ,㔡,㔢,㔣,㔤,㔥,㔦,ã”§,㔨,㔩,ã”°,ã”±,㔲,㔳,ã”´,㔵,ã”¶,ã”·,㔸,㔹,ã•€,ã•,ã•‚,㕃,ã•„,ã•…,㕆,㕇,㕈,㕉,ã•,ã•‘,ã•’,ã•“,ã•”,ã••,ã•–,ã•—,㕘,ã•™,ã• ,ã•¡,ã•¢,ã•£,㕤,ã•¥,㕦,ã•§,㕨,ã•©,ã•°,㕱,㕲,㕳,ã•´,㕵,ã•¶,ã•·,㕸,㕹,ã–€,ã–,ã–‚,ã–ƒ,ã–„,ã–…,ã–†,ã–‡,ã–ˆ,ã–‰,ã–,ã–‘,ã–’,ã–“,ã–”,ã–•,ã––,ã–—,ã–˜,ã–™,㘀,ã˜,㘂,㘃,㘄,㘅,㘆,㘇,㘈,㘉,ã˜,㘑,㘒,㘓,㘔,㘕,㘖,㘗,㘘,㘙,㘠,㘡,㘢,㘣,㘤,㘥,㘦,㘧,㘨,㘩,㘰,㘱,㘲,㘳,㘴,㘵,㘶,㘷,㘸,㘹,㙀,ã™,㙂,㙃,㙄,ã™…,㙆,㙇,㙈,㙉,ã™,㙑,ã™’,㙓,ã™”,㙕,ã™–,ã™—,㙘,ã™™,ã™ ,㙡,㙢,㙣,㙤,㙥,㙦,ã™§,㙨,㙩,ã™°,ã™±,㙲,㙳,ã™´,㙵,ã™¶,ã™·,㙸,㙹,㚀,ãš,ãš‚,㚃,ãš„,ãš…,㚆,㚇,㚈,㚉,ãš,ãš‘,ãš’,ãš“,ãš”,ãš•,ãš–,ãš—,㚘,ãš™,㜀,ãœ,㜂,㜃,㜄,㜅,㜆,㜇,㜈,㜉,ãœ,㜑,㜒,㜓,㜔,㜕,㜖,㜗,㜘,㜙,㜠,㜡,㜢,㜣,㜤,㜥,㜦,㜧,㜨,㜩,㜰,㜱,㜲,㜳,㜴,㜵,㜶,㜷,㜸,㜹,ã€,ã,ã‚,ãƒ,ã„,ã…,ã†,ã‡,ãˆ,ã‰,ã,ã‘,ã’,ã“,ã”,ã•,ã–,ã—,ã˜,ã™,ã ,ã¡,ã¢,ã£,ã¤,ã¥,ã¦,ã§,ã¨,ã©,ã°,ã±,ã²,ã³,ã´,ãµ,ã¶,ã·,ã¸,ã¹,㞀,ãž,ãž‚,㞃,ãž„,ãž…,㞆,㞇,㞈,㞉,ãž,ãž‘,ãž’,ãž“,ãž”,ãž•,ãž–,ãž—,㞘,ãž™,ã €,ã ,ã ‚,ã ƒ,ã „,ã …,ã †,ã ‡,ã ˆ,ã ‰,ã ,ã ‘,ã ’,ã “,ã ”,ã •,ã –,ã —,ã ˜,ã ™,ã  ,ã ¡,ã ¢,ã £,ã ¤,ã ¥,ã ¦,ã §,ã ¨,ã ©,ã °,ã ±,ã ²,ã ³,ã ´,ã µ,ã ¶,ã ·,ã ¸,ã ¹,ã¡€,ã¡,ã¡‚,㡃,ã¡„,ã¡…,㡆,㡇,㡈,㡉,ã¡,ã¡‘,ã¡’,ã¡“,ã¡”,ã¡•,ã¡–,ã¡—,㡘,ã¡™,ã¡ ,ã¡¡,ã¡¢,ã¡£,㡤,ã¡¥,㡦,ã¡§,㡨,ã¡©,ã¡°,㡱,㡲,㡳,ã¡´,㡵,ã¡¶,ã¡·,㡸,㡹,㢀,ã¢,㢂,㢃,㢄,㢅,㢆,㢇,㢈,㢉,ã¢,㢑,㢒,㢓,㢔,㢕,㢖,㢗,㢘,㢙,㤀,ã¤,㤂,㤃,㤄,㤅,㤆,㤇,㤈,㤉,ã¤,㤑,㤒,㤓,㤔,㤕,㤖,㤗,㤘,㤙,㤠,㤡,㤢,㤣,㤤,㤥,㤦,㤧,㤨,㤩,㤰,㤱,㤲,㤳,㤴,㤵,㤶,㤷,㤸,㤹,㥀,ã¥,㥂,㥃,㥄,㥅,㥆,㥇,㥈,㥉,ã¥,㥑,㥒,㥓,㥔,㥕,㥖,㥗,㥘,㥙,㥠,㥡,㥢,㥣,㥤,㥥,㥦,㥧,㥨,㥩,㥰,㥱,㥲,㥳,㥴,㥵,㥶,㥷,㥸,㥹,㦀,ã¦,㦂,㦃,㦄,㦅,㦆,㦇,㦈,㦉,ã¦,㦑,㦒,㦓,㦔,㦕,㦖,㦗,㦘,㦙,䀀,ä€,䀂,䀃,䀄,䀅,䀆,䀇,䀈,䀉,ä€,䀑,䀒,䀓,䀔,䀕,䀖,䀗,䀘,䀙,䀠,䀡,䀢,䀣,䀤,䀥,䀦,䀧,䀨,䀩,䀰,䀱,䀲,䀳,䀴,䀵,䀶,䀷,䀸,䀹,ä€,ä,ä‚,äƒ,ä„,ä…,ä†,ä‡,äˆ,ä‰,ä,ä‘,ä’,ä“,ä”,ä•,ä–,ä—,ä˜,ä™,ä ,ä¡,ä¢,ä£,ä¤,ä¥,ä¦,ä§,ä¨,ä©,ä°,ä±,ä²,ä³,ä´,äµ,ä¶,ä·,ä¸,ä¹,ä‚€,ä‚,ä‚‚,䂃,ä‚„,ä‚…,䂆,䂇,䂈,䂉,ä‚,ä‚‘,ä‚’,ä‚“,ä‚”,ä‚•,ä‚–,ä‚—,䂘,ä‚™,ä„€,ä„,ä„‚,䄃,ä„„,ä„…,䄆,䄇,䄈,䄉,ä„,ä„‘,ä„’,ä„“,ä„”,ä„•,ä„–,ä„—,䄘,ä„™,ä„ ,ä„¡,ä„¢,ä„£,䄤,ä„¥,䄦,ä„§,䄨,ä„©,ä„°,䄱,䄲,䄳,ä„´,䄵,ä„¶,ä„·,䄸,䄹,ä…€,ä…,ä…‚,ä…ƒ,ä…„,ä……,ä…†,ä…‡,ä…ˆ,ä…‰,ä…,ä…‘,ä…’,ä…“,ä…”,ä…•,ä…–,ä…—,ä…˜,ä…™,ä… ,ä…¡,ä…¢,ä…£,ä…¤,ä…¥,ä…¦,ä…§,ä…¨,ä…©,ä…°,ä…±,ä…²,ä…³,ä…´,ä…µ,ä…¶,ä…·,ä…¸,ä…¹,䆀,ä†,䆂,䆃,䆄,䆅,䆆,䆇,䆈,䆉,ä†,䆑,䆒,䆓,䆔,䆕,䆖,䆗,䆘,䆙,䈀,äˆ,䈂,䈃,䈄,䈅,䈆,䈇,䈈,䈉,äˆ,䈑,䈒,䈓,䈔,䈕,䈖,䈗,䈘,䈙,䈠,䈡,䈢,䈣,䈤,䈥,䈦,䈧,䈨,䈩,䈰,䈱,䈲,䈳,䈴,䈵,䈶,䈷,䈸,䈹,䉀,ä‰,䉂,䉃,䉄,䉅,䉆,䉇,䉈,䉉,ä‰,䉑,䉒,䉓,䉔,䉕,䉖,䉗,䉘,䉙,䉠,䉡,䉢,䉣,䉤,䉥,䉦,䉧,䉨,䉩,䉰,䉱,䉲,䉳,䉴,䉵,䉶,䉷,䉸,䉹,䊀,äŠ,䊂,䊃,䊄,䊅,䊆,䊇,䊈,䊉,äŠ,䊑,䊒,䊓,䊔,䊕,䊖,䊗,䊘,䊙,䌀,äŒ,䌂,䌃,䌄,䌅,䌆,䌇,䌈,䌉,äŒ,䌑,䌒,䌓,䌔,䌕,䌖,䌗,䌘,䌙,䌠,䌡,䌢,䌣,䌤,䌥,䌦,䌧,䌨,䌩,䌰,䌱,䌲,䌳,䌴,䌵,䌶,䌷,䌸,䌹,ä€,ä,ä‚,äƒ,ä„,ä…,ä†,ä‡,äˆ,ä‰,ä,ä‘,ä’,ä“,ä”,ä•,ä–,ä—,ä˜,ä™,ä ,ä¡,ä¢,ä£,ä¤,ä¥,ä¦,ä§,ä¨,ä©,ä°,ä±,ä²,ä³,ä´,äµ,ä¶,ä·,ä¸,ä¹,䎀,äŽ,䎂,䎃,䎄,䎅,䎆,䎇,䎈,䎉,äŽ,䎑,䎒,䎓,䎔,䎕,䎖,䎗,䎘,䎙,ä€,ä,ä‚,äƒ,ä„,ä…,ä†,ä‡,äˆ,ä‰,ä,ä‘,ä’,ä“,ä”,ä•,ä–,ä—,ä˜,ä™,ä ,ä¡,ä¢,ä£,ä¤,ä¥,ä¦,ä§,ä¨,ä©,ä°,ä±,ä²,ä³,ä´,äµ,ä¶,ä·,ä¸,ä¹,ä‘€,ä‘,ä‘‚,䑃,ä‘„,ä‘…,䑆,䑇,䑈,䑉,ä‘,ä‘‘,ä‘’,ä‘“,ä‘”,ä‘•,ä‘–,ä‘—,䑘,ä‘™,ä‘ ,ä‘¡,ä‘¢,ä‘£,䑤,ä‘¥,䑦,ä‘§,䑨,ä‘©,ä‘°,䑱,䑲,䑳,ä‘´,䑵,ä‘¶,ä‘·,䑸,䑹,ä’€,ä’,ä’‚,ä’ƒ,ä’„,ä’…,ä’†,ä’‡,ä’ˆ,ä’‰,ä’,ä’‘,ä’’,ä’“,ä’”,ä’•,ä’–,ä’—,ä’˜,ä’™,䔀,ä”,䔂,䔃,䔄,ä”…,䔆,䔇,䔈,䔉,ä”,䔑,ä”’,䔓,ä””,䔕,ä”–,ä”—,䔘,ä”™,ä” ,䔡,䔢,䔣,䔤,䔥,䔦,ä”§,䔨,䔩,ä”°,ä”±,䔲,䔳,ä”´,䔵,ä”¶,ä”·,䔸,䔹,ä•€,ä•,ä•‚,䕃,ä•„,ä•…,䕆,䕇,䕈,䕉,ä•,ä•‘,ä•’,ä•“,ä•”,ä••,ä•–,ä•—,䕘,ä•™,ä• ,ä•¡,ä•¢,ä•£,䕤,ä•¥,䕦,ä•§,䕨,ä•©,ä•°,䕱,䕲,䕳,ä•´,䕵,ä•¶,ä•·,䕸,䕹,ä–€,ä–,ä–‚,ä–ƒ,ä–„,ä–…,ä–†,ä–‡,ä–ˆ,ä–‰,ä–,ä–‘,ä–’,ä–“,ä–”,ä–•,ä––,ä–—,ä–˜,ä–™,䘀,ä˜,䘂,䘃,䘄,䘅,䘆,䘇,䘈,䘉,ä˜,䘑,䘒,䘓,䘔,䘕,䘖,䘗,䘘,䘙,䘠,䘡,䘢,䘣,䘤,䘥,䘦,䘧,䘨,䘩,䘰,䘱,䘲,䘳,䘴,䘵,䘶,䘷,䘸,䘹,䙀,ä™,䙂,䙃,䙄,ä™…,䙆,䙇,䙈,䙉,ä™,䙑,ä™’,䙓,ä™”,䙕,ä™–,ä™—,䙘,ä™™,ä™ ,䙡,䙢,䙣,䙤,䙥,䙦,ä™§,䙨,䙩,ä™°,ä™±,䙲,䙳,ä™´,䙵,ä™¶,ä™·,䙸,䙹,䚀,äš,äš‚,䚃,äš„,äš…,䚆,䚇,䚈,䚉,äš,äš‘,äš’,äš“,äš”,äš•,äš–,äš—,䚘,äš™,䜀,äœ,䜂,䜃,䜄,䜅,䜆,䜇,䜈,䜉,äœ,䜑,䜒,䜓,䜔,䜕,䜖,䜗,䜘,䜙,䜠,䜡,䜢,䜣,䜤,䜥,䜦,䜧,䜨,䜩,䜰,䜱,䜲,䜳,䜴,䜵,䜶,䜷,䜸,䜹,ä€,ä,ä‚,äƒ,ä„,ä…,ä†,ä‡,äˆ,ä‰,ä,ä‘,ä’,ä“,ä”,ä•,ä–,ä—,ä˜,ä™,ä ,ä¡,ä¢,ä£,ä¤,ä¥,ä¦,ä§,ä¨,ä©,ä°,ä±,ä²,ä³,ä´,äµ,ä¶,ä·,ä¸,ä¹,䞀,äž,äž‚,䞃,äž„,äž…,䞆,䞇,䞈,䞉,äž,äž‘,äž’,äž“,äž”,äž•,äž–,äž—,䞘,äž™,ä €,ä ,ä ‚,ä ƒ,ä „,ä …,ä †,ä ‡,ä ˆ,ä ‰,ä ,ä ‘,ä ’,ä “,ä ”,ä •,ä –,ä —,ä ˜,ä ™,ä  ,ä ¡,ä ¢,ä £,ä ¤,ä ¥,ä ¦,ä §,ä ¨,ä ©,ä °,ä ±,ä ²,ä ³,ä ´,ä µ,ä ¶,ä ·,ä ¸,ä ¹,ä¡€,ä¡,ä¡‚,䡃,ä¡„,ä¡…,䡆,䡇,䡈,䡉,ä¡,ä¡‘,ä¡’,ä¡“,ä¡”,ä¡•,ä¡–,ä¡—,䡘,ä¡™,ä¡ ,ä¡¡,ä¡¢,ä¡£,䡤,ä¡¥,䡦,ä¡§,䡨,ä¡©,ä¡°,䡱,䡲,䡳,ä¡´,䡵,ä¡¶,ä¡·,䡸,䡹,䢀,ä¢,䢂,䢃,䢄,䢅,䢆,䢇,䢈,䢉,ä¢,䢑,䢒,䢓,䢔,䢕,䢖,䢗,䢘,䢙,䤀,ä¤,䤂,䤃,䤄,䤅,䤆,䤇,䤈,䤉,ä¤,䤑,䤒,䤓,䤔,䤕,䤖,䤗,䤘,䤙,䤠,䤡,䤢,䤣,䤤,䤥,䤦,䤧,䤨,䤩,䤰,䤱,䤲,䤳,䤴,䤵,䤶,䤷,䤸,䤹,䥀,ä¥,䥂,䥃,䥄,䥅,䥆,䥇,䥈,䥉,ä¥,䥑,䥒,䥓,䥔,䥕,䥖,䥗,䥘,䥙,䥠,䥡,䥢,䥣,䥤,䥥,䥦,䥧,䥨,䥩,䥰,䥱,䥲,䥳,䥴,䥵,䥶,䥷,䥸,䥹,䦀,ä¦,䦂,䦃,䦄,䦅,䦆,䦇,䦈,䦉,ä¦,䦑,䦒,䦓,䦔,䦕,䦖,䦗,䦘,䦙,倀,å€,倂,倃,倄,倅,倆,倇,倈,倉,å€,們,倒,倓,倔,倕,倖,倗,倘,候,倠,倡,倢,倣,値,倥,倦,倧,倨,倩,倰,倱,倲,倳,倴,倵,倶,倷,倸,倹,å€,å,å‚,åƒ,å„,å…,å†,å‡,åˆ,å‰,å,å‘,å’,å“,å”,å•,å–,å—,å˜,å™,å ,å¡,å¢,å£,å¤,å¥,å¦,å§,å¨,å©,å°,å±,å²,å³,å´,åµ,å¶,å·,å¸,å¹,å‚€,å‚,å‚‚,傃,å‚„,å‚…,傆,傇,傈,傉,å‚,å‚‘,å‚’,å‚“,å‚”,å‚•,å‚–,å‚—,傘,å‚™,å„€,å„,å„‚,儃,å„„,å„…,儆,儇,儈,儉,å„,å„‘,å„’,å„“,å„”,å„•,å„–,å„—,儘,å„™,å„ ,å„¡,å„¢,å„£,儤,å„¥,儦,å„§,儨,å„©,å„°,儱,儲,儳,å„´,儵,å„¶,å„·,儸,儹,å…€,å…,å…‚,å…ƒ,å…„,å……,å…†,å…‡,å…ˆ,å…‰,å…,å…‘,å…’,å…“,å…”,å…•,å…–,å…—,å…˜,å…™,å… ,å…¡,å…¢,å…£,å…¤,å…¥,å…¦,å…§,å…¨,å…©,å…°,å…±,å…²,å…³,å…´,å…µ,å…¶,å…·,å…¸,å…¹,冀,å†,冂,冃,冄,内,円,冇,冈,冉,å†,冑,冒,冓,冔,冕,冖,冗,冘,写,刀,åˆ,刂,刃,刄,刅,分,切,刈,刉,åˆ,刑,划,刓,刔,刕,刖,列,刘,则,删,刡,刢,刣,判,別,刦,刧,刨,利,到,刱,刲,刳,刴,刵,制,刷,券,刹,剀,å‰,剂,剃,剄,剅,剆,則,剈,剉,å‰,剑,剒,剓,剔,剕,剖,剗,剘,剙,剠,剡,剢,剣,剤,剥,剦,剧,剨,剩,剰,剱,割,剳,剴,創,剶,剷,剸,剹,劀,åŠ,劂,劃,劄,劅,劆,劇,劈,劉,åŠ,劑,劒,劓,劔,劕,劖,劗,劘,劙,匀,åŒ,匂,匃,匄,包,匆,匇,匈,匉,åŒ,匑,匒,匓,匔,匕,化,北,匘,匙,匠,匡,匢,匣,匤,匥,匦,匧,匨,匩,匰,匱,匲,匳,匴,匵,匶,匷,匸,匹,å€,å,å‚,åƒ,å„,å…,å†,å‡,åˆ,å‰,å,å‘,å’,å“,å”,å•,å–,å—,å˜,å™,å ,å¡,å¢,å£,å¤,å¥,å¦,å§,å¨,å©,å°,å±,å²,å³,å´,åµ,å¶,å·,å¸,å¹,厀,åŽ,厂,厃,厄,厅,历,厇,厈,厉,åŽ,厑,厒,厓,厔,厕,厖,厗,厘,厙,å€,å,å‚,åƒ,å„,å…,å†,å‡,åˆ,å‰,å,å‘,å’,å“,å”,å•,å–,å—,å˜,å™,å ,å¡,å¢,å£,å¤,å¥,å¦,å§,å¨,å©,å°,å±,å²,å³,å´,åµ,å¶,å·,å¸,å¹,å‘€,å‘,å‘‚,呃,å‘„,å‘…,呆,呇,呈,呉,å‘,å‘‘,å‘’,å‘“,å‘”,å‘•,å‘–,å‘—,员,å‘™,å‘ ,å‘¡,å‘¢,å‘£,呤,å‘¥,呦,å‘§,周,å‘©,å‘°,呱,呲,味,å‘´,呵,å‘¶,å‘·,呸,呹,å’€,å’,å’‚,å’ƒ,å’„,å’…,å’†,å’‡,å’ˆ,å’‰,å’,å’‘,å’’,å’“,å’”,å’•,å’–,å’—,å’˜,å’™,唀,å”,唂,唃,唄,å”…,唆,唇,唈,唉,å”,唑,å”’,唓,å””,唕,å”–,å”—,唘,å”™,å” ,唡,唢,唣,唤,唥,唦,å”§,唨,唩,å”°,å”±,唲,唳,å”´,唵,å”¶,å”·,唸,唹,å•€,å•,å•‚,啃,å•„,å•…,商,啇,啈,啉,å•,å•‘,å•’,å•“,å•”,å••,å•–,å•—,啘,å•™,å• ,å•¡,å•¢,å•£,啤,å•¥,啦,å•§,啨,å•©,å•°,啱,啲,啳,å•´,啵,å•¶,å•·,啸,啹,å–€,å–,å–‚,å–ƒ,å–„,å–…,å–†,å–‡,å–ˆ,å–‰,å–,å–‘,å–’,å–“,å–”,å–•,å––,å–—,å–˜,å–™,嘀,å˜,嘂,嘃,嘄,嘅,嘆,嘇,嘈,嘉,å˜,嘑,嘒,嘓,嘔,嘕,嘖,嘗,嘘,嘙,嘠,嘡,嘢,嘣,嘤,嘥,嘦,嘧,嘨,嘩,嘰,嘱,嘲,嘳,嘴,嘵,嘶,嘷,嘸,嘹,噀,å™,噂,噃,噄,å™…,噆,噇,噈,噉,å™,噑,å™’,噓,å™”,噕,å™–,å™—,噘,å™™,å™ ,噡,噢,噣,噤,噥,噦,å™§,器,噩,å™°,å™±,噲,噳,å™´,噵,å™¶,å™·,噸,噹,嚀,åš,åš‚,嚃,åš„,åš…,嚆,嚇,嚈,嚉,åš,åš‘,åš’,åš“,åš”,åš•,åš–,åš—,嚘,åš™,圀,åœ,圂,圃,圄,圅,圆,圇,圈,圉,åœ,圑,園,圓,圔,圕,圖,圗,團,圙,圠,圡,圢,圣,圤,圥,圦,圧,在,圩,地,圱,圲,圳,圴,圵,圶,圷,圸,圹,å€,å,å‚,åƒ,å„,å…,å†,å‡,åˆ,å‰,å,å‘,å’,å“,å”,å•,å–,å—,å˜,å™,å ,å¡,å¢,å£,å¤,å¥,å¦,å§,å¨,å©,å°,å±,å²,å³,å´,åµ,å¶,å·,å¸,å¹,垀,åž,åž‚,垃,åž„,åž…,垆,垇,垈,垉,åž,åž‘,åž’,åž“,åž”,åž•,åž–,åž—,垘,åž™,å €,å ,å ‚,å ƒ,å „,å …,å †,å ‡,å ˆ,å ‰,å ,å ‘,å ’,å “,å ”,å •,å –,å —,å ˜,å ™,å  ,å ¡,å ¢,å £,å ¤,å ¥,å ¦,å §,å ¨,å ©,å °,å ±,å ²,å ³,å ´,å µ,å ¶,å ·,å ¸,å ¹,å¡€,å¡,å¡‚,塃,å¡„,å¡…,塆,塇,塈,塉,å¡,å¡‘,å¡’,å¡“,å¡”,å¡•,å¡–,å¡—,塘,å¡™,å¡ ,å¡¡,å¡¢,å¡£,塤,å¡¥,塦,å¡§,塨,å¡©,å¡°,塱,塲,塳,å¡´,塵,å¡¶,å¡·,塸,塹,墀,å¢,墂,境,墄,墅,墆,墇,墈,墉,å¢,墑,墒,墓,墔,墕,墖,増,墘,墙,夀,å¤,夂,夃,处,夅,夆,备,夈,変,å¤,夑,夒,夓,夔,夕,外,夗,夘,夙,夠,夡,夢,夣,夤,夥,夦,大,夨,天,夰,失,夲,夳,头,夵,夶,夷,夸,夹,奀,å¥,奂,奃,奄,奅,奆,奇,奈,奉,å¥,契,奒,奓,奔,奕,奖,套,奘,奙,奠,奡,奢,奣,奤,奥,奦,奧,奨,奩,奰,奱,奲,女,奴,奵,奶,奷,奸,她,妀,å¦,如,妃,妄,妅,妆,妇,妈,妉,å¦,妑,妒,妓,妔,妕,妖,妗,妘,妙,怀,æ€,怂,怃,怄,怅,怆,怇,怈,怉,æ€,怑,怒,怓,怔,怕,怖,怗,怘,怙,怠,怡,怢,怣,怤,急,怦,性,怨,怩,怰,怱,怲,怳,怴,怵,怶,怷,怸,怹,æ€,æ,æ‚,æƒ,æ„,æ…,æ†,æ‡,æˆ,æ‰,æ,æ‘,æ’,æ“,æ”,æ•,æ–,æ—,æ˜,æ™,æ ,æ¡,æ¢,æ£,æ¤,æ¥,æ¦,æ§,æ¨,æ©,æ°,æ±,æ²,æ³,æ´,æµ,æ¶,æ·,æ¸,æ¹,æ‚€,æ‚,æ‚‚,悃,æ‚„,æ‚…,悆,悇,悈,悉,æ‚,æ‚‘,æ‚’,æ‚“,æ‚”,æ‚•,æ‚–,æ‚—,悘,æ‚™,æ„€,æ„,æ„‚,愃,æ„„,æ„…,愆,愇,愈,愉,æ„,æ„‘,æ„’,æ„“,æ„”,æ„•,æ„–,æ„—,愘,æ„™,æ„ ,æ„¡,æ„¢,æ„£,愤,æ„¥,愦,æ„§,愨,æ„©,æ„°,愱,愲,愳,æ„´,愵,æ„¶,æ„·,愸,愹,æ…€,æ…,æ…‚,æ…ƒ,æ…„,æ……,æ…†,æ…‡,æ…ˆ,æ…‰,æ…,æ…‘,æ…’,æ…“,æ…”,æ…•,æ…–,æ…—,æ…˜,æ…™,æ… ,æ…¡,æ…¢,æ…£,æ…¤,æ…¥,æ…¦,æ…§,æ…¨,æ…©,æ…°,æ…±,æ…²,æ…³,æ…´,æ…µ,æ…¶,æ…·,æ…¸,æ…¹,憀,æ†,憂,憃,憄,憅,憆,憇,憈,憉,æ†,憑,憒,憓,憔,憕,憖,憗,憘,憙,戀,æˆ,戂,戃,戄,戅,戆,戇,戈,戉,æˆ,我,戒,戓,戔,戕,或,戗,战,戙,戠,戡,戢,戣,戤,戥,戦,戧,戨,戩,戰,戱,戲,戳,戴,戵,戶,户,戸,戹,所,æ‰,扂,扃,扄,扅,扆,扇,扈,扉,æ‰,扑,扒,打,扔,払,扖,扗,托,扙,扠,扡,扢,扣,扤,扥,扦,执,扨,扩,扰,扱,扲,扳,扴,扵,扶,扷,扸,批,技,æŠ,抂,抃,抄,抅,抆,抇,抈,抉,æŠ,抑,抒,抓,抔,投,抖,抗,折,抙,挀,æŒ,挂,挃,挄,挅,挆,指,挈,按,æŒ,挑,挒,挓,挔,挕,挖,挗,挘,挙,挠,挡,挢,挣,挤,挥,挦,挧,挨,挩,挰,挱,挲,挳,挴,挵,挶,挷,挸,挹,æ€,æ,æ‚,æƒ,æ„,æ…,æ†,æ‡,æˆ,æ‰,æ,æ‘,æ’,æ“,æ”,æ•,æ–,æ—,æ˜,æ™,æ ,æ¡,æ¢,æ£,æ¤,æ¥,æ¦,æ§,æ¨,æ©,æ°,æ±,æ²,æ³,æ´,æµ,æ¶,æ·,æ¸,æ¹,掀,æŽ,掂,掃,掄,掅,掆,掇,授,掉,æŽ,掑,排,掓,掔,掕,掖,掗,掘,掙,æ€,æ,æ‚,æƒ,æ„,æ…,æ†,æ‡,æˆ,æ‰,æ,æ‘,æ’,æ“,æ”,æ•,æ–,æ—,æ˜,æ™,æ ,æ¡,æ¢,æ£,æ¤,æ¥,æ¦,æ§,æ¨,æ©,æ°,æ±,æ²,æ³,æ´,æµ,æ¶,æ·,æ¸,æ¹,æ‘€,æ‘,æ‘‚,摃,æ‘„,æ‘…,摆,摇,摈,摉,æ‘,æ‘‘,æ‘’,æ‘“,æ‘”,æ‘•,æ‘–,æ‘—,摘,æ‘™,æ‘ ,æ‘¡,æ‘¢,æ‘£,摤,æ‘¥,摦,æ‘§,摨,æ‘©,æ‘°,摱,摲,摳,æ‘´,摵,æ‘¶,æ‘·,摸,摹,æ’€,æ’,æ’‚,æ’ƒ,æ’„,æ’…,æ’†,æ’‡,æ’ˆ,æ’‰,æ’,æ’‘,æ’’,æ’“,æ’”,æ’•,æ’–,æ’—,æ’˜,æ’™,攀,æ”,攂,攃,攄,æ”…,攆,攇,攈,攉,æ”,攑,æ”’,攓,æ””,攕,æ”–,æ”—,攘,æ”™,æ” ,攡,攢,攣,攤,攥,攦,æ”§,攨,攩,æ”°,æ”±,攲,攳,æ”´,攵,æ”¶,æ”·,攸,改,æ•€,æ•,æ•‚,敃,æ•„,æ•…,敆,敇,效,敉,æ•,æ•‘,æ•’,æ•“,æ•”,æ••,æ•–,æ•—,敘,æ•™,æ• ,æ•¡,æ•¢,æ•£,敤,æ•¥,敦,æ•§,敨,æ•©,æ•°,敱,敲,敳,æ•´,敵,æ•¶,æ•·,數,敹,æ–€,æ–,æ–‚,æ–ƒ,æ–„,æ–…,æ–†,æ–‡,æ–ˆ,æ–‰,æ–,æ–‘,æ–’,æ–“,æ–”,æ–•,æ––,æ–—,æ–˜,æ–™,昀,æ˜,昂,昃,昄,昅,昆,昇,昈,昉,æ˜,昑,昒,易,昔,昕,昖,昗,昘,昙,映,昡,昢,昣,昤,春,昦,昧,昨,昩,昰,昱,昲,昳,昴,昵,昶,昷,昸,昹,晀,æ™,時,晃,晄,æ™…,晆,晇,晈,晉,æ™,晑,æ™’,晓,æ™”,晕,æ™–,æ™—,晘,æ™™,æ™ ,晡,晢,晣,晤,晥,晦,æ™§,晨,晩,æ™°,æ™±,晲,晳,æ™´,晵,æ™¶,æ™·,晸,晹,暀,æš,æš‚,暃,æš„,æš…,暆,暇,暈,暉,æš,æš‘,æš’,æš“,æš”,æš•,æš–,æš—,暘,æš™,最,æœ,朂,會,朄,朅,朆,朇,月,有,æœ,朑,朒,朓,朔,朕,朖,朗,朘,朙,朠,朡,朢,朣,朤,朥,朦,朧,木,朩,朰,朱,朲,朳,朴,朵,朶,朷,朸,朹,æ€,æ,æ‚,æƒ,æ„,æ…,æ†,æ‡,æˆ,æ‰,æ,æ‘,æ’,æ“,æ”,æ•,æ–,æ—,æ˜,æ™,æ ,æ¡,æ¢,æ£,æ¤,æ¥,æ¦,æ§,æ¨,æ©,æ°,æ±,æ²,æ³,æ´,æµ,æ¶,æ·,æ¸,æ¹,枀,æž,æž‚,枃,æž„,æž…,枆,枇,枈,枉,æž,æž‘,æž’,æž“,æž”,æž•,æž–,æž—,枘,æž™,æ €,æ ,æ ‚,æ ƒ,æ „,æ …,æ †,æ ‡,æ ˆ,æ ‰,æ ,æ ‘,æ ’,æ “,æ ”,æ •,æ –,æ —,æ ˜,æ ™,æ  ,æ ¡,æ ¢,æ £,æ ¤,æ ¥,æ ¦,æ §,æ ¨,æ ©,æ °,æ ±,æ ²,æ ³,æ ´,æ µ,æ ¶,æ ·,æ ¸,æ ¹,æ¡€,æ¡,æ¡‚,桃,æ¡„,æ¡…,框,桇,案,桉,æ¡,æ¡‘,æ¡’,æ¡“,æ¡”,æ¡•,æ¡–,æ¡—,桘,æ¡™,æ¡ ,æ¡¡,æ¡¢,æ¡£,桤,æ¡¥,桦,æ¡§,桨,æ¡©,æ¡°,桱,桲,桳,æ¡´,桵,æ¡¶,æ¡·,桸,桹,梀,æ¢,梂,梃,梄,梅,梆,梇,梈,梉,æ¢,梑,梒,梓,梔,梕,梖,梗,梘,梙,椀,æ¤,椂,椃,椄,椅,椆,椇,椈,椉,æ¤,椑,椒,椓,椔,椕,椖,椗,椘,椙,椠,椡,椢,椣,椤,椥,椦,椧,椨,椩,椰,椱,椲,椳,椴,椵,椶,椷,椸,椹,楀,æ¥,楂,楃,楄,楅,楆,楇,楈,楉,æ¥,楑,楒,楓,楔,楕,楖,楗,楘,楙,楠,楡,楢,楣,楤,楥,楦,楧,楨,楩,楰,楱,楲,楳,楴,極,楶,楷,楸,楹,榀,æ¦,概,榃,榄,榅,榆,榇,榈,榉,æ¦,榑,榒,榓,榔,榕,榖,榗,榘,榙,瀀,ç€,瀂,瀃,瀄,瀅,瀆,瀇,瀈,瀉,ç€,瀑,瀒,瀓,瀔,瀕,瀖,瀗,瀘,瀙,瀠,瀡,瀢,瀣,瀤,瀥,瀦,瀧,瀨,瀩,瀰,瀱,瀲,瀳,瀴,瀵,瀶,瀷,瀸,瀹,ç€,ç,ç‚,çƒ,ç„,ç…,ç†,ç‡,çˆ,ç‰,ç,ç‘,ç’,ç“,ç”,ç•,ç–,ç—,ç˜,ç™,ç ,ç¡,ç¢,ç£,ç¤,ç¥,ç¦,ç§,ç¨,ç©,ç°,ç±,ç²,ç³,ç´,çµ,ç¶,ç·,ç¸,ç¹,ç‚€,ç‚,ç‚‚,炃,ç‚„,ç‚…,炆,炇,炈,炉,ç‚,ç‚‘,ç‚’,ç‚“,ç‚”,ç‚•,ç‚–,ç‚—,炘,ç‚™,ç„€,ç„,ç„‚,焃,ç„„,ç„…,焆,焇,焈,焉,ç„,ç„‘,ç„’,ç„“,ç„”,ç„•,ç„–,ç„—,焘,ç„™,ç„ ,ç„¡,ç„¢,ç„£,焤,ç„¥,焦,ç„§,焨,ç„©,ç„°,焱,焲,焳,ç„´,焵,ç„¶,ç„·,焸,焹,ç…€,ç…,ç…‚,ç…ƒ,ç…„,ç……,ç…†,ç…‡,ç…ˆ,ç…‰,ç…,ç…‘,ç…’,ç…“,ç…”,ç…•,ç…–,ç…—,ç…˜,ç…™,ç… ,ç…¡,ç…¢,ç…£,ç…¤,ç…¥,ç…¦,ç…§,ç…¨,ç…©,ç…°,ç…±,ç…²,ç…³,ç…´,ç…µ,ç…¶,ç…·,ç…¸,ç…¹,熀,ç†,熂,熃,熄,熅,熆,熇,熈,熉,ç†,熑,熒,熓,熔,熕,熖,熗,熘,熙,爀,çˆ,爂,爃,爄,爅,爆,爇,爈,爉,çˆ,爑,爒,爓,爔,爕,爖,爗,爘,爙,爠,爡,爢,爣,爤,爥,爦,爧,爨,爩,爰,爱,爲,爳,爴,爵,父,爷,爸,爹,牀,ç‰,牂,牃,牄,牅,牆,片,版,牉,ç‰,牑,牒,牓,牔,牕,牖,牗,牘,牙,牠,牡,牢,牣,牤,牥,牦,牧,牨,物,牰,牱,牲,牳,牴,牵,牶,牷,牸,特,犀,çŠ,犂,犃,犄,犅,犆,犇,犈,犉,çŠ,犑,犒,犓,犔,犕,犖,犗,犘,犙,猀,çŒ,猂,猃,猄,猅,猆,猇,猈,猉,çŒ,猑,猒,猓,猔,猕,猖,猗,猘,猙,猠,猡,猢,猣,猤,猥,猦,猧,猨,猩,猰,猱,猲,猳,猴,猵,猶,猷,猸,猹,ç€,ç,ç‚,çƒ,ç„,ç…,ç†,ç‡,çˆ,ç‰,ç,ç‘,ç’,ç“,ç”,ç•,ç–,ç—,ç˜,ç™,ç ,ç¡,ç¢,ç£,ç¤,ç¥,ç¦,ç§,ç¨,ç©,ç°,ç±,ç²,ç³,ç´,çµ,ç¶,ç·,ç¸,ç¹,玀,çŽ,玂,玃,玄,玅,玆,率,玈,玉,çŽ,玑,玒,玓,玔,玕,玖,玗,玘,玙,ç€,ç,ç‚,çƒ,ç„,ç…,ç†,ç‡,çˆ,ç‰,ç,ç‘,ç’,ç“,ç”,ç•,ç–,ç—,ç˜,ç™,ç ,ç¡,ç¢,ç£,ç¤,ç¥,ç¦,ç§,ç¨,ç©,ç°,ç±,ç²,ç³,ç´,çµ,ç¶,ç·,ç¸,ç¹,ç‘€,ç‘,ç‘‚,瑃,ç‘„,ç‘…,瑆,瑇,瑈,瑉,ç‘,ç‘‘,ç‘’,ç‘“,ç‘”,ç‘•,ç‘–,ç‘—,瑘,ç‘™,ç‘ ,ç‘¡,ç‘¢,ç‘£,瑤,ç‘¥,瑦,ç‘§,瑨,ç‘©,ç‘°,瑱,瑲,瑳,ç‘´,瑵,ç‘¶,ç‘·,瑸,瑹,ç’€,ç’,ç’‚,ç’ƒ,ç’„,ç’…,ç’†,ç’‡,ç’ˆ,ç’‰,ç’,ç’‘,ç’’,ç’“,ç’”,ç’•,ç’–,ç’—,ç’˜,ç’™,甀,ç”,甂,甃,甄,ç”…,甆,甇,甈,甉,ç”,甑,ç”’,甓,ç””,甕,ç”–,ç”—,甘,ç”™,ç” ,甡,產,産,甤,甥,甦,ç”§,用,甩,ç”°,ç”±,甲,申,ç”´,电,ç”¶,ç”·,甸,甹,ç•€,ç•,ç•‚,畃,ç•„,ç•…,畆,畇,畈,畉,ç•,ç•‘,ç•’,ç•“,ç•”,ç••,ç•–,ç•—,畘,ç•™,ç• ,ç•¡,ç•¢,ç•£,畤,ç•¥,畦,ç•§,畨,ç•©,ç•°,畱,畲,畳,ç•´,畵,ç•¶,ç•·,畸,畹,ç–€,ç–,ç–‚,ç–ƒ,ç–„,ç–…,ç–†,ç–‡,ç–ˆ,ç–‰,ç–,ç–‘,ç–’,ç–“,ç–”,ç–•,ç––,ç–—,ç–˜,ç–™,瘀,ç˜,瘂,瘃,瘄,瘅,瘆,瘇,瘈,瘉,ç˜,瘑,瘒,瘓,瘔,瘕,瘖,瘗,瘘,瘙,瘠,瘡,瘢,瘣,瘤,瘥,瘦,瘧,瘨,瘩,瘰,瘱,瘲,瘳,瘴,瘵,瘶,瘷,瘸,瘹,癀,ç™,療,癃,癄,ç™…,癆,癇,癈,癉,ç™,癑,ç™’,癓,ç™”,癕,ç™–,ç™—,癘,ç™™,ç™ ,癡,癢,癣,癤,癥,癦,ç™§,癨,癩,ç™°,ç™±,癲,癳,ç™´,癵,ç™¶,ç™·,癸,癹,皀,çš,çš‚,皃,çš„,çš…,皆,皇,皈,皉,çš,çš‘,çš’,çš“,çš”,çš•,çš–,çš—,皘,çš™,眀,çœ,眂,眃,眄,眅,眆,眇,眈,眉,çœ,眑,眒,眓,眔,眕,眖,眗,眘,眙,眠,眡,眢,眣,眤,眥,眦,眧,眨,眩,眰,眱,眲,眳,眴,眵,眶,眷,眸,眹,ç€,ç,ç‚,çƒ,ç„,ç…,ç†,ç‡,çˆ,ç‰,ç,ç‘,ç’,ç“,ç”,ç•,ç–,ç—,ç˜,ç™,ç ,ç¡,ç¢,ç£,ç¤,ç¥,ç¦,ç§,ç¨,ç©,ç°,ç±,ç²,ç³,ç´,çµ,ç¶,ç·,ç¸,ç¹,瞀,çž,çž‚,瞃,çž„,çž…,瞆,瞇,瞈,瞉,çž,çž‘,çž’,çž“,çž”,çž•,çž–,çž—,瞘,çž™,ç €,ç ,ç ‚,ç ƒ,ç „,ç …,ç †,ç ‡,ç ˆ,ç ‰,ç ,ç ‘,ç ’,ç “,ç ”,ç •,ç –,ç —,ç ˜,ç ™,ç  ,ç ¡,ç ¢,ç £,ç ¤,ç ¥,ç ¦,ç §,ç ¨,ç ©,ç °,ç ±,ç ²,ç ³,ç ´,ç µ,ç ¶,ç ·,ç ¸,ç ¹,ç¡€,ç¡,ç¡‚,硃,ç¡„,ç¡…,硆,硇,硈,硉,ç¡,ç¡‘,ç¡’,ç¡“,ç¡”,ç¡•,ç¡–,ç¡—,硘,ç¡™,ç¡ ,ç¡¡,ç¡¢,ç¡£,硤,ç¡¥,硦,ç¡§,硨,ç¡©,ç¡°,硱,硲,硳,ç¡´,硵,ç¡¶,ç¡·,硸,硹,碀,ç¢,碂,碃,碄,碅,碆,碇,碈,碉,ç¢,碑,碒,碓,碔,碕,碖,碗,碘,碙,礀,ç¤,礂,礃,礄,礅,礆,礇,礈,礉,ç¤,礑,礒,礓,礔,礕,礖,礗,礘,礙,礠,礡,礢,礣,礤,礥,礦,礧,礨,礩,礰,礱,礲,礳,礴,礵,礶,礷,礸,礹,祀,ç¥,祂,祃,祄,祅,祆,祇,祈,祉,ç¥,祑,祒,祓,祔,祕,祖,祗,祘,祙,祠,祡,祢,祣,祤,祥,祦,祧,票,祩,祰,祱,祲,祳,祴,祵,祶,祷,祸,祹,禀,ç¦,禂,禃,禄,禅,禆,禇,禈,禉,ç¦,禑,禒,禓,禔,禕,禖,禗,禘,禙,耀,è€,耂,考,耄,者,耆,耇,耈,耉,è€,耑,耒,耓,耔,耕,耖,耗,耘,耙,耠,耡,耢,耣,耤,耥,耦,耧,耨,耩,耰,耱,耲,耳,耴,耵,耶,耷,耸,耹,è€,è,è‚,èƒ,è„,è…,è†,è‡,èˆ,è‰,è,è‘,è’,è“,è”,è•,è–,è—,è˜,è™,è ,è¡,è¢,è£,è¤,è¥,è¦,è§,è¨,è©,è°,è±,è²,è³,è´,èµ,è¶,è·,è¸,è¹,è‚€,è‚,è‚‚,肃,è‚„,è‚…,肆,肇,肈,肉,è‚,è‚‘,è‚’,è‚“,è‚”,è‚•,è‚–,è‚—,肘,è‚™,è„€,è„,è„‚,脃,è„„,è„…,脆,脇,脈,脉,è„,è„‘,è„’,è„“,è„”,è„•,è„–,è„—,脘,è„™,è„ ,è„¡,è„¢,è„£,脤,è„¥,脦,è„§,脨,è„©,è„°,脱,脲,脳,è„´,脵,è„¶,è„·,脸,脹,è…€,è…,è…‚,è…ƒ,è…„,è……,è…†,è…‡,è…ˆ,è…‰,è…,è…‘,è…’,è…“,è…”,è…•,è…–,è…—,è…˜,è…™,è… ,è…¡,è…¢,è…£,è…¤,è…¥,è…¦,è…§,è…¨,è…©,è…°,è…±,è…²,è…³,è…´,è…µ,è…¶,è…·,è…¸,è…¹,膀,è†,膂,膃,膄,膅,膆,膇,膈,膉,è†,膑,膒,膓,膔,膕,膖,膗,膘,膙,舀,èˆ,舂,舃,舄,舅,舆,與,興,舉,èˆ,舑,舒,舓,舔,舕,舖,舗,舘,舙,舠,舡,舢,舣,舤,舥,舦,舧,舨,舩,舰,舱,舲,舳,舴,舵,舶,舷,舸,船,艀,è‰,艂,艃,艄,艅,艆,艇,艈,艉,è‰,艑,艒,艓,艔,艕,艖,艗,艘,艙,艠,艡,艢,艣,艤,艥,艦,艧,艨,艩,艰,艱,色,艳,艴,艵,艶,艷,艸,艹,芀,èŠ,节,芃,芄,芅,芆,芇,芈,芉,èŠ,芑,芒,芓,芔,芕,芖,芗,芘,芙,茀,èŒ,茂,范,茄,茅,茆,茇,茈,茉,èŒ,茑,茒,茓,茔,茕,茖,茗,茘,茙,茠,茡,茢,茣,茤,茥,茦,茧,茨,茩,茰,茱,茲,茳,茴,茵,茶,茷,茸,茹,è€,è,è‚,èƒ,è„,è…,è†,è‡,èˆ,è‰,è,è‘,è’,è“,è”,è•,è–,è—,è˜,è™,è ,è¡,è¢,è£,è¤,è¥,è¦,è§,è¨,è©,è°,è±,è²,è³,è´,èµ,è¶,è·,è¸,è¹,莀,èŽ,莂,莃,莄,莅,莆,莇,莈,莉,èŽ,莑,莒,莓,莔,莕,莖,莗,莘,莙,è€,è,è‚,èƒ,è„,è…,è†,è‡,èˆ,è‰,è,è‘,è’,è“,è”,è•,è–,è—,è˜,è™,è ,è¡,è¢,è£,è¤,è¥,è¦,è§,è¨,è©,è°,è±,è²,è³,è´,èµ,è¶,è·,è¸,è¹,è‘€,è‘,è‘‚,葃,è‘„,è‘…,葆,葇,葈,葉,è‘,è‘‘,è‘’,è‘“,è‘”,è‘•,è‘–,è‘—,葘,è‘™,è‘ ,è‘¡,è‘¢,è‘£,葤,è‘¥,葦,è‘§,葨,è‘©,è‘°,葱,葲,葳,è‘´,葵,è‘¶,è‘·,葸,葹,è’€,è’,è’‚,è’ƒ,è’„,è’…,è’†,è’‡,è’ˆ,è’‰,è’,è’‘,è’’,è’“,è’”,è’•,è’–,è’—,è’˜,è’™,蔀,è”,蔂,蔃,蔄,è”…,蔆,蔇,蔈,蔉,è”,蔑,è”’,蔓,è””,蔕,è”–,è”—,蔘,è”™,è” ,蔡,蔢,蔣,蔤,蔥,蔦,è”§,蔨,蔩,è”°,è”±,蔲,蔳,è”´,蔵,è”¶,è”·,蔸,蔹,è•€,è•,è•‚,蕃,è•„,è•…,蕆,蕇,蕈,蕉,è•,è•‘,è•’,è•“,è•”,è••,è•–,è•—,蕘,è•™,è• ,è•¡,è•¢,è•£,蕤,è•¥,蕦,è•§,蕨,è•©,è•°,蕱,蕲,蕳,è•´,蕵,è•¶,è•·,蕸,蕹,è–€,è–,è–‚,è–ƒ,è–„,è–…,è–†,è–‡,è–ˆ,è–‰,è–,è–‘,è–’,è–“,è–”,è–•,è––,è–—,è–˜,è–™,蘀,è˜,蘂,蘃,蘄,蘅,蘆,蘇,蘈,蘉,è˜,蘑,蘒,蘓,蘔,蘕,蘖,蘗,蘘,蘙,蘠,蘡,蘢,蘣,蘤,蘥,蘦,蘧,蘨,蘩,蘰,蘱,蘲,蘳,蘴,蘵,蘶,蘷,蘸,蘹,虀,è™,虂,虃,虄,è™…,虆,虇,虈,虉,è™,虑,è™’,虓,è™”,處,è™–,è™—,虘,è™™,è™ ,虡,虢,虣,虤,虥,虦,è™§,虨,虩,è™°,è™±,虲,虳,è™´,虵,è™¶,è™·,虸,虹,蚀,èš,èš‚,蚃,èš„,èš…,蚆,蚇,蚈,蚉,èš,èš‘,èš’,èš“,èš”,èš•,èš–,èš—,蚘,èš™,蜀,èœ,蜂,蜃,蜄,蜅,蜆,蜇,蜈,蜉,èœ,蜑,蜒,蜓,蜔,蜕,蜖,蜗,蜘,蜙,蜠,蜡,蜢,蜣,蜤,蜥,蜦,蜧,蜨,蜩,蜰,蜱,蜲,蜳,蜴,蜵,蜶,蜷,蜸,蜹,è€,è,è‚,èƒ,è„,è…,è†,è‡,èˆ,è‰,è,è‘,è’,è“,è”,è•,è–,è—,è˜,è™,è ,è¡,è¢,è£,è¤,è¥,è¦,è§,è¨,è©,è°,è±,è²,è³,è´,èµ,è¶,è·,è¸,è¹,螀,èž,èž‚,螃,èž„,èž…,螆,螇,螈,螉,èž,èž‘,èž’,èž“,èž”,èž•,èž–,èž—,螘,èž™,è €,è ,è ‚,è ƒ,è „,è …,è †,è ‡,è ˆ,è ‰,è ,è ‘,è ’,è “,è ”,è •,è –,è —,è ˜,è ™,è  ,è ¡,è ¢,è £,è ¤,è ¥,è ¦,è §,è ¨,è ©,è °,è ±,è ²,è ³,è ´,è µ,è ¶,è ·,è ¸,è ¹,è¡€,è¡,è¡‚,衃,è¡„,è¡…,衆,衇,衈,衉,è¡,è¡‘,è¡’,è¡“,è¡”,è¡•,è¡–,è¡—,衘,è¡™,è¡ ,è¡¡,è¡¢,è¡£,衤,è¡¥,衦,è¡§,表,è¡©,è¡°,衱,衲,衳,è¡´,衵,è¡¶,è¡·,衸,衹,袀,è¢,袂,袃,袄,袅,袆,袇,袈,袉,è¢,袑,袒,袓,袔,袕,袖,袗,袘,袙,褀,è¤,褂,褃,褄,褅,褆,複,褈,褉,è¤,褑,褒,褓,褔,褕,褖,褗,褘,褙,褠,褡,褢,褣,褤,褥,褦,褧,褨,褩,褰,褱,褲,褳,褴,褵,褶,褷,褸,褹,襀,è¥,襂,襃,襄,襅,襆,襇,襈,襉,è¥,襑,襒,襓,襔,襕,襖,襗,襘,襙,襠,襡,襢,襣,襤,襥,襦,襧,襨,襩,襰,襱,襲,襳,襴,襵,襶,襷,襸,襹,覀,è¦,覂,覃,覄,覅,覆,覇,覈,覉,è¦,覑,覒,覓,覔,覕,視,覗,覘,覙,退,é€,适,逃,逄,逅,逆,逇,逈,选,é€,逑,递,逓,途,逕,逖,逗,逘,這,造,逡,逢,連,逤,逥,逦,逧,逨,逩,逰,週,進,逳,逴,逵,逶,逷,逸,逹,é€,é,é‚,éƒ,é„,é…,é†,é‡,éˆ,é‰,é,é‘,é’,é“,é”,é•,é–,é—,é˜,é™,é ,é¡,é¢,é£,é¤,é¥,é¦,é§,é¨,é©,é°,é±,é²,é³,é´,éµ,é¶,é·,é¸,é¹,é‚€,é‚,é‚‚,邃,é‚„,é‚…,邆,邇,邈,邉,é‚,é‚‘,é‚’,é‚“,é‚”,é‚•,é‚–,é‚—,邘,é‚™,é„€,é„,é„‚,鄃,é„„,é„…,鄆,鄇,鄈,鄉,é„,é„‘,é„’,é„“,é„”,é„•,é„–,é„—,鄘,é„™,é„ ,é„¡,é„¢,é„£,鄤,é„¥,鄦,é„§,鄨,é„©,é„°,鄱,鄲,鄳,é„´,鄵,é„¶,é„·,鄸,鄹,é…€,é…,é…‚,é…ƒ,é…„,é……,é…†,é…‡,é…ˆ,é…‰,é…,é…‘,é…’,é…“,é…”,é…•,é…–,é…—,é…˜,é…™,é… ,é…¡,é…¢,é…£,é…¤,é…¥,é…¦,é…§,é…¨,é…©,é…°,é…±,é…²,é…³,é…´,é…µ,é…¶,é…·,é…¸,é…¹,醀,é†,醂,醃,醄,醅,醆,醇,醈,醉,é†,醑,醒,醓,醔,醕,醖,醗,醘,醙,鈀,éˆ,鈂,鈃,鈄,鈅,鈆,鈇,鈈,鈉,éˆ,鈑,鈒,鈓,鈔,鈕,鈖,鈗,鈘,鈙,鈠,鈡,鈢,鈣,鈤,鈥,鈦,鈧,鈨,鈩,鈰,鈱,鈲,鈳,鈴,鈵,鈶,鈷,鈸,鈹,鉀,é‰,鉂,鉃,鉄,鉅,鉆,鉇,鉈,鉉,é‰,鉑,鉒,鉓,鉔,鉕,鉖,鉗,鉘,鉙,鉠,鉡,鉢,鉣,鉤,鉥,鉦,鉧,鉨,鉩,鉰,鉱,鉲,鉳,鉴,鉵,鉶,鉷,鉸,鉹,銀,éŠ,銂,銃,銄,銅,銆,銇,銈,銉,éŠ,銑,銒,銓,銔,銕,銖,銗,銘,銙,錀,éŒ,錂,錃,錄,錅,錆,錇,錈,錉,éŒ,錑,錒,錓,錔,錕,錖,錗,錘,錙,錠,錡,錢,錣,錤,錥,錦,錧,錨,錩,錰,錱,録,錳,錴,錵,錶,錷,錸,錹,é€,é,é‚,éƒ,é„,é…,é†,é‡,éˆ,é‰,é,é‘,é’,é“,é”,é•,é–,é—,é˜,é™,é ,é¡,é¢,é£,é¤,é¥,é¦,é§,é¨,é©,é°,é±,é²,é³,é´,éµ,é¶,é·,é¸,é¹,鎀,éŽ,鎂,鎃,鎄,鎅,鎆,鎇,鎈,鎉,éŽ,鎑,鎒,鎓,鎔,鎕,鎖,鎗,鎘,鎙,é€,é,é‚,éƒ,é„,é…,é†,é‡,éˆ,é‰,é,é‘,é’,é“,é”,é•,é–,é—,é˜,é™,é ,é¡,é¢,é£,é¤,é¥,é¦,é§,é¨,é©,é°,é±,é²,é³,é´,éµ,é¶,é·,é¸,é¹,é‘€,é‘,é‘‚,鑃,é‘„,é‘…,鑆,鑇,鑈,鑉,é‘,é‘‘,é‘’,é‘“,é‘”,é‘•,é‘–,é‘—,鑘,é‘™,é‘ ,é‘¡,é‘¢,é‘£,鑤,é‘¥,鑦,é‘§,鑨,é‘©,é‘°,鑱,鑲,鑳,é‘´,鑵,é‘¶,é‘·,鑸,鑹,é’€,é’,é’‚,é’ƒ,é’„,é’…,é’†,é’‡,é’ˆ,é’‰,é’,é’‘,é’’,é’“,é’”,é’•,é’–,é’—,é’˜,é’™,销,é”,锂,锃,锄,é”…,锆,锇,锈,锉,é”,锑,é”’,锓,é””,锕,é”–,é”—,锘,é”™,é” ,锡,锢,锣,锤,锥,锦,é”§,锨,锩,é”°,é”±,锲,锳,é”´,锵,é”¶,é”·,锸,锹,é•€,é•,é•‚,镃,é•„,é•…,镆,镇,镈,镉,é•,é•‘,é•’,é•“,é•”,é••,é•–,é•—,镘,é•™,é• ,é•¡,é•¢,é•£,镤,é•¥,镦,é•§,镨,é•©,é•°,镱,镲,镳,é•´,镵,é•¶,é•·,镸,镹,é–€,é–,é–‚,é–ƒ,é–„,é–…,é–†,é–‡,é–ˆ,é–‰,é–,é–‘,é–’,é–“,é–”,é–•,é––,é–—,é–˜,é–™,阀,é˜,阂,阃,阄,阅,阆,阇,阈,阉,é˜,阑,阒,阓,阔,阕,阖,阗,阘,阙,阠,阡,阢,阣,阤,阥,阦,阧,阨,阩,阰,阱,防,阳,阴,阵,阶,阷,阸,阹,陀,é™,陂,陃,附,é™…,陆,陇,陈,陉,é™,陑,é™’,陓,é™”,陕,é™–,é™—,陘,é™™,é™ ,陡,院,陣,除,陥,陦,é™§,陨,险,é™°,é™±,陲,陳,é™´,陵,é™¶,é™·,陸,陹,隀,éš,éš‚,隃,éš„,éš…,隆,隇,隈,隉,éš,éš‘,éš’,éš“,éš”,éš•,éš–,éš—,隘,éš™,需,éœ,霂,霃,霄,霅,霆,震,霈,霉,éœ,霑,霒,霓,霔,霕,霖,霗,霘,霙,霠,霡,霢,霣,霤,霥,霦,霧,霨,霩,霰,霱,露,霳,霴,霵,霶,霷,霸,霹,é€,é,é‚,éƒ,é„,é…,é†,é‡,éˆ,é‰,é,é‘,é’,é“,é”,é•,é–,é—,é˜,é™,é ,é¡,é¢,é£,é¤,é¥,é¦,é§,é¨,é©,é°,é±,é²,é³,é´,éµ,é¶,é·,é¸,é¹,鞀,éž,éž‚,鞃,éž„,éž…,鞆,鞇,鞈,鞉,éž,éž‘,éž’,éž“,éž”,éž•,éž–,éž—,鞘,éž™,é €,é ,é ‚,é ƒ,é „,é …,é †,é ‡,é ˆ,é ‰,é ,é ‘,é ’,é “,é ”,é •,é –,é —,é ˜,é ™,é  ,é ¡,é ¢,é £,é ¤,é ¥,é ¦,é §,é ¨,é ©,é °,é ±,é ²,é ³,é ´,é µ,é ¶,é ·,é ¸,é ¹,é¡€,é¡,é¡‚,顃,é¡„,é¡…,顆,顇,顈,顉,é¡,é¡‘,é¡’,é¡“,é¡”,é¡•,é¡–,é¡—,願,é¡™,é¡ ,é¡¡,é¡¢,é¡£,顤,é¡¥,顦,é¡§,顨,é¡©,é¡°,顱,顲,顳,é¡´,页,é¡¶,é¡·,顸,项,颀,é¢,颂,颃,预,颅,领,颇,颈,颉,é¢,频,颒,颓,颔,颕,颖,颗,题,颙,餀,é¤,餂,餃,餄,餅,餆,餇,餈,餉,é¤,餑,餒,餓,餔,餕,餖,餗,餘,餙,餠,餡,餢,餣,餤,餥,餦,餧,館,餩,餰,餱,餲,餳,餴,餵,餶,餷,餸,餹,饀,é¥,饂,饃,饄,饅,饆,饇,饈,饉,é¥,饑,饒,饓,饔,饕,饖,饗,饘,饙,饠,饡,饢,饣,饤,饥,饦,饧,饨,饩,饰,饱,饲,饳,饴,饵,饶,饷,饸,饹,馀,é¦,馂,馃,馄,馅,馆,馇,馈,馉,é¦,馑,馒,馓,馔,馕,首,馗,馘,香', ',') satisfies matches($s, '^(?:[\\w])$')) and (every $s in tokenize('', ',') satisfies not(matches($s, '^(?:[\\w])$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00985() { final XQuery query = new XQuery( "(every $s in tokenize('0,1,2,3,4,5,6,7,8,9,Ù ,Ù¡,Ù¢,Ù£,Ù¤,Ù¥,Ù¦,Ù§,Ù¨,Ù©,Û°,Û±,Û²,Û³,Û´,Ûµ,Û¶,Û·,Û¸,Û¹,०,१,२,३,४,५,६,७,८,९,০,à§§,২,à§©,৪,à§«,৬,à§­,à§®,৯,੦,à©§,੨,à©©,੪,à©«,੬,à©­,à©®,੯,૦,à«§,૨,à«©,૪,à««,૬,à«­,à«®,૯,à­¦,à­§,à­¨,à­©,à­ª,à­«,à­¬,à­­,à­®,à­¯,௧,௨,௩,௪,௫,௬,௭,௮,௯,౦,à±§,౨,౩,౪,౫,౬,à±­,à±®,౯,೦,à³§,೨,೩,೪,೫,೬,à³­,à³®,೯,൦,൧,൨,൩,൪,൫,൬,൭,൮,൯,à¹,๑,๒,๓,๔,๕,๖,๗,๘,๙,à»,໑,à»’,໓,à»”,໕,à»–,à»—,໘,à»™,༠,༡,༢,༣,༤,༥,༦,༧,༨,༩,á€,á,á‚,áƒ,á„,á…,á†,á‡,áˆ,á‰,០,១,២,៣,៤,៥,៦,៧,៨,៩,á ,á ‘,á ’,á “,á ”,á •,á –,á —,á ˜,á ™,ï¼,1,ï¼’,3,ï¼”,5,ï¼–,ï¼—,8,ï¼™', ',') satisfies matches($s, '^(?:[\\d])$')) and (every $s in tokenize('\t,\n" + ",\r, ,!,\",#,$,왣,왤,왥,왦,ì™§,왨,왩,왪,왫,왬,ì™­,ì™®,왯,ì™°,ì™±,왲,왳,ì™´,왵,ì™¶,ì™·,외,왹,왺,ì™»,왼,왽,왾,왿,욀,ìš,ìš‚,욃,ìš„,ìš…,욆,욇,욈,욉,욊,ìš‹,욌,ìš,욎,ìš,ìš,ìš‘,ìš’,ìš“,ìš”,ìš•,ìš–,ìš—,욘,ìš™,ìšš,ìš›,ìšœ,ìš,ìšž,욟,ìš ,ìš¡,욢,욣,욤,욥,욦,ìš§,욨,ìš©,욪,ìš«,욬,ìš­,ìš®,욯,ìš°,ìš±,ìš²,ìš³,ìš´,ìšµ,ìš¶,ìš·,울,ìš¹,욺,ìš»,ìš¼,ìš½,ìš¾,ìš¿,움,ì›,웂,웃,웄,ì›…,웆,웇,웈,웉,웊,웋,워,ì›,웎,ì›,ì›,웑,ì›’,웓,ì›”,웕,ì›–,ì›—,웘,ì›™,웚,ì››,웜,ì›,웞,웟,ì› ,웡,웢,웣,웤,웥,웦,ì›§,웨,웩,웪,웫,웬,ì›­,ì›®,웯,ì›°,ì›±,웲,웳,ì›´,웵,ì›¶,ì›·,웸,웹,웺,ì›»,웼,웽,웾,웿,윀,ìœ,윂,윃,위,윅,윆,윇,윈,윉,윊,윋,윌,ìœ,윎,ìœ,ìœ,윑,윒,윓,윔,윕,윖,윗,윘,윙,윚,윛,윜,ìœ,윞,윟,유,육,윢,윣,윤,윥,윦,윧,율,윩,윪,윫,윬,윭,윮,윯,윰,윱,윲,윳,윴,융,윶,윷,윸,윹,윺,윻,으,윽,윾,윿,ì€,ì,ì‚,ìƒ,ì„,ì…,ì†,ì‡,ìˆ,ì‰,ìŠ,ì‹,ìŒ,ì,ìŽ,ì,ì,ì‘,ì’,ì“,ì”,ì•,ì–,ì—,ì˜,ì™,ìš,ì›,ìœ,ì,ìž,ìŸ,ì ,ì¡,ì¢,ì£,ì¤,ì¥,ì¦,ì§,ì¨,ì©,ìª,ì«,ì¬,ì­,ì®,ì¯,ì°,ì±,ì²,ì³,ì´,ìµ,ì¶,ì·,ì¸,ì¹,ìº,ì»,ì¼,재,ìž­,ìž®,잯,ìž°,ìž±,ìž²,ìž³,ìž´,ìžµ,ìž¶,ìž·,잸,ìž¹,잺,ìž»,ìž¼,ìž½,ìž¾,ìž¿,쟀,ìŸ,쟂,쟃,쟄,쟅,쟆,쟇,쟈,쟉,쟊,쟋,쟌,ìŸ,쟎,ìŸ,ìŸ,쟑,쟒,쟓,쟔,쟕,쟖,쟗,쟘,쟙,쟚,쟛,쟜,ìŸ,쟞,쟟,쟠,쟡,쟢,쟣,쟤,쟥,쟦,쟧,쟨,쟩,쟪,쟫,쟬,쟭,쟮,쟯,쟰,쟱,쟲,쟳,쟴,쟵,쟶,쟷,쟸,쟹,쟺,쟻,쟼,쟽,쟾,쟿,ì €,ì ,ì ‚,ì ƒ,ì „,ì …,ì †,ì ‡,ì ˆ,ì ‰,ì Š,ì ‹,ì Œ,ì ,ì Ž,ì ,ì ,ì ‘,ì ’,ì “,ì ”,ì •,ì –,ì —,ì ˜,ì ™,ì š,ì ›,ì œ,ì ,ì ž,ì Ÿ,ì  ,ì ¡,ì ¢,ì £,ì ¤,ì ¥,ì ¦,ì §,ì ¨,ì ©,ì ª,ì «,ì ¬,ì ­,ì ®,ì ¯,ì °,ì ±,ì ²,ì ³,ì ´,ì µ,ì ¶,ì ·,ì ¸,ì ¹,ì º,ì »,ì ¼,ì ½,ì ¾,ì ¿,ì¡€,ì¡,ì¡‚,졃,ì¡„,ì¡…,졆,졇,졈,졉,졊,ì¡‹'||\n" + "',졌,ì¡,졎,ì¡,ì¡,ì¡‘,ì¡’,ì¡“,ì¡”,ì¡•,ì¡–,ì¡—,졘,ì¡™,졚,ì¡›,졜,ì¡,졞,졟,ì¡ ,ì¡¡,ì¡¢,ì¡£,졤,ì¡¥,졦,ì¡§,졨,ì¡©,졪,ì¡«,졬,ì¡­,ì¡®,졯,ì¡°,족,졲,졳,ì¡´,졵,ì¡¶,ì¡·,졸,졹,졺,ì¡»,졼,졽,졾,ì¡¿,좀,ì¢,좂,좃,좄,종,좆,좇,좈,좉,좊,좋,좌,ì¢,좎,ì¢,ì¢,좑,좒,좓,좔,좕,좖,좗,좘,좙,좚,좛,좜,ì¢,좞,좟,좠,좡,좢,좣,좤,좥,좦,좧,좨,좩,좪,좫,좬,좭,좮,좯,좰,좱,좲,좳,좴,좵,좶,좷,좸,좹,좺,좻,좼,좽,좾,좿,죀,ì£,죂,죃,죄,죅,죆,죇,죈,죉,죊,죋,죌,ì£,죎,ì£,ì£,죑,죒,죓,죔,죕,죖,죗,죘,죙,죚,죛,죜,ì£,죞,죟,죠,죡,죢,죣,죤,죥,죦,죧,죨,죩,죪,죫,죬,죭,죮,죯,죰,죱,죲,죳,죴,죵,죶,죷,죸,죹,죺,죻,주,죽,죾,죿,준,ì¤,줂,줃,줄,줅,줆,줇,줈,줉,줊,줋,줌,ì¤,줎,ì¤,ì¤,중,줒,줓,줔,줕,줖,줗,줘,줙,줚,줛,줜,ì¤,줞,줟,줠,줡,줢,줣,줤,줥,줦,줧,줨,줩,줪,줫,줬,줭,줮,줯,줰,줱,줲,줳,줴,줵,줶,줷,줸,줹,줺,줻,줼,줽,줾,줿,쥀,ì¥,쥂,쥃,쥄,쥅,쥆,쥇,쥈,쥉,쥊,쥋,쥌,ì¥,쥎,ì¥,ì¥,쥑,쥒,쥓,쥔,쥕,쥖,쥗,쥘,쥙,쥚,쥛,쥜,ì¥,쥞,쥟,쥠,쥡,쥢,쥣,쥤,쥥,쥦,쥧,쥨,쥩,쥪,쥫,쥬,쥭,쥮,쥯,쥰,쥱,쥲,\uff02,\uff03,$,\uff05,\uff06,\uff07,\uff08,\uff09,\uff0a,+,\uff0c,\uff0d,\uff0e,\uff0f,\uff1a,\uff1b,<,ï¼,>,\uff1f,\uff20,A,ï¼¢,ï¼£,D,ï¼¥,F,ï¼§,H,I,J,K,L,ï¼­,ï¼®,O,ï¼°,ï¼±,ï¼²,ï¼³,ï¼´,ï¼µ,ï¼¶,ï¼·,X,ï¼¹,Z,\uff3b,\uff3c,\uff3d,ï¼¾,\uff3f,ï½€,ï½,b,c,d,ï½…,f,g,h,i,j,k,l,ï½,n,ï½,ï½,q,ï½’,s,ï½”,u,ï½–,ï½—,x,ï½™,z,\uff5b,|,\uff5d,~,\uff5f,\uff60,\uff61,\uff62,\uff63,\uff64,\uff65,ヲ,ï½§,ィ,ゥ,ェ,ォ,ャ,ï½­,ï½®,ッ,ï½°,ï½±,ï½²,ï½³,ï½´,ï½µ,ï½¶,ï½·,ク,ï½¹,コ,ï½»,ï½¼,ï½½,ï½¾,ソ,ï¾€,ï¾,ツ,テ,ト,ï¾…,ニ,ヌ,ネ,ノ,ハ,ヒ,フ,ï¾,ï¿¢,ï¿£,¦,ï¿¥,₩,\uffe7,│,ï¿©,↑,ï¿«,↓,ï¿­,ï¿®,\uffef,\ufff0,\ufff1,\ufff2,\ufff3,\ufff4,\ufff5,\ufff6,\ufff7,\ufff8,\ufff9,\ufffa,\ufffb,,�', ',') satisfies not(matches($s, '^(?:[\\d])$')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax. */ @org.junit.Test public void re00987() { final XQuery query = new XQuery( "(for $range in\n" + " tokenize('65-90;97-122;192-214;216-246;248-305;308-318;321-328;330-382;384-451;461-496;500-501;506-535;592-680;699-705;902-902;904-906;908-908;910-929;931-974;976-982;986-986;988-988;990-990;992-992;994-1011;1025-1036;1038-1103;1105-1116;1118-1153;1168-1220;1223-1224;1227-1228;1232-1259;1262-1269;1272-1273;1329-1366;1369-1369;1377-1414;1488-1514;1520-1522;1569-1594;1601-1610;1649-1719;1722-1726;1728-1742;1744-1747;1749-1749;1765-1766;2309-2361;2365-2365;2392-2401;2437-2444;2447-2448;2451-2472;2474-2480;2482-2482;2486-2489;2524-2525;2527-2529;2544-2545;2565-2570;'||\n" + " '2575-2576;2579-2600;2602-2608;2610-2611;2613-2614;2616-2617;2649-2652;2654-2654;2674-2676;2693-2699;2701-2701;2703-2705;2707-2728;2730-2736;2738-2739;2741-2745;2749-2749;2784-2784;2821-2828;2831-2832;2835-2856;2858-2864;2866-2867;2870-2873;2877-2877;2908-2909;2911-2913;2949-2954;2958-2960;2962-2965;2969-2970;2972-2972;2974-2975;2979-2980;2984-2986;2990-2997;2999-3001;3077-3084;3086-3088;3090-3112;3114-3123;3125-3129;3168-3169;3205-3212;3214-3216;3218-3240;3242-3251;3253-3257;3294-3294;3296-3297;3333-3340;3342-3344;3346-3368;3370-3385;3424-3425;3585-3630;3632-3632;'||\n" + " '3634-3635;3648-3653;3713-3714;3716-3716;3719-3720;3722-3722;3725-3725;3732-3735;3737-3743;3745-3747;3749-3749;3751-3751;3754-3755;3757-3758;3760-3760;3762-3763;3773-3773;3776-3780;3904-3911;3913-3945;4256-4293;4304-4342;4352-4352;4354-4355;4357-4359;4361-4361;4363-4364;4366-4370;4412-4412;4414-4414;4416-4416;4428-4428;4430-4430;4432-4432;4436-4437;4441-4441;4447-4449;4451-4451;4453-4453;4455-4455;4457-4457;4461-4462;4466-4467;4469-4469;4510-4510;4520-4520;4523-4523;4526-4527;4535-4536;4538-4538;4540-4546;4587-4587;4592-4592;4601-4601;7680-7835;7840-7929;7936-7957;'||\n" + " '7960-7965;7968-8005;8008-8013;8016-8023;8025-8025;8027-8027;8029-8029;8031-8061;8064-8116;8118-8124;8126-8126;8130-8132;8134-8140;8144-8147;8150-8155;8160-8172;8178-8180;8182-8188;8486-8486;8490-8491;8494-8494;8576-8578;12353-12436;12449-12538;12549-12588;44032-55203;19968-40869;12295-12295;12321-12329;48-57;1632-1641;1776-1785;2406-2415;2534-2543;2662-2671;2790-2799;2918-2927;3047-3055;3174-3183;3302-3311;3430-3439;3664-3673;3792-3801;3872-3881;768-837;864-865;1155-1158;1425-1441;1443-1465;1467-1469;1471-1471;1473-1474;1476-1476;1611-1618;1648-1648;1750-1764;1767-1768;'||\n" + " '1770-1773;2305-2307;2364-2364;2366-2381;2385-2388;2402-2403;2433-2435;2492-2492;2494-2500;2503-2504;2507-2509;2519-2519;2530-2531;2562-2562;2620-2620;2622-2626;2631-2632;2635-2637;2672-2673;2689-2691;2748-2748;2750-2757;2759-2761;2763-2765;2817-2819;2876-2876;2878-2883;2887-2888;2891-2893;2902-2903;2946-2947;3006-3010;3014-3016;3018-3021;3031-3031;3073-3075;3134-3140;3142-3144;3146-3149;3157-3158;3202-3203;3262-3268;3270-3272;3274-3277;3285-3286;3330-3331;3390-3395;3398-3400;3402-3405;3415-3415;3633-3633;3636-3642;3655-3662;3761-3761;3764-3769;3771-3772;3784-3789;3864-3865;'||\n" + " '3893-3893;3895-3895;3897-3897;3902-3903;3953-3972;3974-3979;3984-3989;3991-3991;3993-4013;4017-4023;4025-4025;8400-8412;8417-8417;12330-12335;12441-12442;183-183;720-721;903-903;1600-1600;3654-3654;3782-3782;12293-12293;12337-12341;12445-12446;12540-12542;58-58;95-95;45-46;65-90;97-122;192-214;216-246;248-305;308-318;321-328;330-382;384-451;461-496;500-501;506-535;592-680;699-705;902-902;904-906;908-908;910-929;931-974;976-982;986-986;988-988;990-990;992-992;994-1011;1025-1036;1038-1103;1105-1116;1118-1153;1168-1220;1223-1224;1227-1228;1232-1259;1262-1269;1272-1273;1329-1366;'||\n" + " '1369-1369;1377-1414;1488-1514;1520-1522;1569-1594;1601-1610;1649-1719;1722-1726;1728-1742;1744-1747;1749-1749;1765-1766;2309-2361;2365-2365;2392-2401;2437-2444;2447-2448;2451-2472;2474-2480;2482-2482;2486-2489;2524-2525;2527-2529;2544-2545;2565-2570;2575-2576;2579-2600;2602-2608;2610-2611;2613-2614;2616-2617;2649-2652;2654-2654;2674-2676;2693-2699;2701-2701;2703-2705;2707-2728;2730-2736;2738-2739;2741-2745;2749-2749;2784-2784;2821-2828;2831-2832;2835-2856;2858-2864;2866-2867;2870-2873;2877-2877;2908-2909;2911-2913;2949-2954;2958-2960;2962-2965;2969-2970;2972-2972;2974-2975;'||\n" + " '2979-2980;2984-2986;2990-2997;2999-3001;3077-3084;3086-3088;3090-3112;3114-3123;3125-3129;3168-3169;3205-3212;3214-3216;3218-3240;3242-3251;3253-3257;3294-3294;3296-3297;3333-3340;3342-3344;3346-3368;3370-3385;3424-3425;3585-3630;3632-3632;3634-3635;3648-3653;3713-3714;3716-3716;3719-3720;3722-3722;3725-3725;3732-3735;3737-3743;3745-3747;3749-3749;3751-3751;3754-3755;3757-3758;3760-3760;3762-3763;3773-3773;3776-3780;3904-3911;3913-3945;4256-4293;4304-4342;4352-4352;4354-4355;4357-4359;4361-4361;4363-4364;4366-4370;4412-4412;4414-4414;4416-4416;4428-4428;4430-4430;4432-4432;'||\n" + " '4436-4437;4441-4441;4447-4449;4451-4451;4453-4453;4455-4455;4457-4457;4461-4462;4466-4467;4469-4469;4510-4510;4520-4520;4523-4523;4526-4527;4535-4536;4538-4538;4540-4546;4587-4587;4592-4592;4601-4601;7680-7835;7840-7929;7936-7957;7960-7965;7968-8005;8008-8013;8016-8023;8025-8025;8027-8027;8029-8029;8031-8061;8064-8116;8118-8124;8126-8126;8130-8132;8134-8140;8144-8147;8150-8155;8160-8172;8178-8180;8182-8188;8486-8486;8490-8491;8494-8494;8576-8578;12353-12436;12449-12538;12549-12588;44032-55203;19968-40869;12295-12295;12321-12329;48-57;1632-1641;1776-1785;2406-2415;2534-2543;'||\n" + " '2662-2671;2790-2799;2918-2927;3047-3055;3174-3183;3302-3311;3430-3439;3664-3673;3792-3801;3872-3881;768-836;864-865;1155-1158;1425-1441;1443-1465;1467-1469;1471-1471;1473-1474;1476-1476;1611-1618;1648-1648;1750-1764;1767-1768;1770-1773;2305-2307;2364-2364;2366-2381;2385-2388;2402-2403;2433-2435;2492-2492;2494-2500;2503-2504;2507-2509;2519-2519;2530-2531;2562-2562;2620-2620;2622-2626;2631-2632;2635-2637;2672-2673;2689-2691;2748-2748;2750-2757;2759-2761;2763-2765;2817-2819;2876-2876;2878-2883;2887-2888;2891-2893;'||\n" + " '2902-2903;2946-2947;3006-3010;3014-3016;3018-3021;3031-3031;3073-3075;3134-3140;3142-3144;3146-3149;3157-3158;3202-3203;3262-3268;3270-3272;3274-3277;3285-3286;3330-3331;3390-3395;3398-3400;3402-3405;3415-3415;3633-3633;3636-3642;3655-3662;3761-3761;3764-3769;3771-3772;3784-3789;3864-3865;3893-3893;3895-3895;3897-3897;3902-3903;3953-3972;3974-3979;3984-3989;3991-3991;3993-4013;4017-4023;4025-4025;8400-8412;8417-8417;12330-12335;12441-12442;183-183;720-721;903-903;1600-1600;3654-3654;3782-3782;12293-12293;12337-12341;12445-12446;12540-12542;58-58;95-95;45-46', ';')\n" + " let $s := xs:integer(substring-before($range, '-')) \n" + " let $e := xs:integer(substring-after($range, '-')) \n" + " for $c in ($s to $e)!codepoints-to-string(.)\n" + " where not(matches($c, '^([\\c])$')) \n" + " return string-to-codepoints($c)), \n" + " \n" + " (for $range in tokenize('161-161', ';') \n" + " let $s := xs:integer(substring-before($range, '-')) \n" + " let $e := xs:integer(substring-after($range, '-')) \n" + " for $c in ($s to $e)!codepoints-to-string(.)\n" + " where (matches($c, '^([\\c])$')) \n" + " return string-to-codepoints($c)) \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Test regex syntax: invalid subtraction. */ @org.junit.Test public void re00988() { final XQuery query = new XQuery( "matches('qwerty','[-[xyz]]')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax: invalid subtraction. */ @org.junit.Test public void re00989() { final XQuery query = new XQuery( "matches('qwerty','[^-[xyz]]')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test regex syntax: escaped dollar is OK in XPath. */ @org.junit.Test public void re00990() { final XQuery query = new XQuery( "matches('$', '^\\$$') and not(matches('\\$', '^\\$$'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test regex syntax: escaped dollar is OK in XPath. */ @org.junit.Test public void re00991() { final XQuery query = new XQuery( "matches('$', '[\\$]') and not(matches('\\$', '^[\\$]$'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Backreference at end of string. */ @org.junit.Test public void re00992() { final XQuery query = new XQuery( "matches('$$', '(.)\\1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Backreference followed by digit. */ @org.junit.Test public void re00993() { final XQuery query = new XQuery( "matches('$$9', '(.)\\19')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Two-digit Backreference. */ @org.junit.Test public void re00994() { final XQuery query = new XQuery( "matches('$$9', '(((((((((((.)))))))))))\\119')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invalid single-digit Backreference. */ @org.junit.Test public void re00995() { final XQuery query = new XQuery( "matches('$$9', '(.)\\2')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Invalid single-digit Backreference. */ @org.junit.Test public void re00996() { final XQuery query = new XQuery( "matches('$$9', '(.)(\\2)')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Invalid two-digit Backreference. */ @org.junit.Test public void re00997() { final XQuery query = new XQuery( "matches('$$9', '((((((((((.))))))))))(\\11)9')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Quantifier after '^' (useless but allowed). */ @org.junit.Test public void re00998() { final XQuery query = new XQuery( "matches('alpha', 'alp^?ha')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Quantifier after '^' (useless but allowed). */ @org.junit.Test public void re00999() { final XQuery query = new XQuery( "matches('alpha', 'alp^+ha')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Quantifier after '^' (useless but allowed). */ @org.junit.Test public void re01000() { final XQuery query = new XQuery( "matches('alpha', '^{2}alpha') and not(matches('zalpha', '^{2}alpha'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Quantifier after '$' (useless but allowed). */ @org.junit.Test public void re01001() { final XQuery query = new XQuery( "matches('alpha', 'alp$?ha')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Quantifier after '$' (useless but allowed). */ @org.junit.Test public void re01002() { final XQuery query = new XQuery( "matches('alpha', 'alp${2,4}ha')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Quantifier after '$' (useless but allowed). */ @org.junit.Test public void re01003() { final XQuery query = new XQuery( "matches('alpha', 'alpha$+') and not(matches('alphax', 'alpha$+'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnMax.java000066400000000000000000003143031222453003200257640ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the max() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnMax extends QT3TestSet { /** * A test whose essence is: `max()`. . */ @org.junit.Test public void kSeqMAXFunc1() { final XQuery query = new XQuery( "max()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `max(xs:untypedAtomic("3")) eq 3`. . */ @org.junit.Test public void kSeqMAXFunc10() { final XQuery query = new XQuery( "max(xs:untypedAtomic(\"3\")) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((xs:untypedAtomic("3"), 1, 2)) instance of xs:double`. . */ @org.junit.Test public void kSeqMAXFunc11() { final XQuery query = new XQuery( "max((xs:untypedAtomic(\"3\"), 1, 2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((1, xs:float(2), xs:untypedAtomic("3"))) eq 3`. . */ @org.junit.Test public void kSeqMAXFunc12() { final XQuery query = new XQuery( "max((1, xs:float(2), xs:untypedAtomic(\"3\"))) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((1, xs:float(2), xs:untypedAtomic("3"))) instance of xs:double`. . */ @org.junit.Test public void kSeqMAXFunc13() { final XQuery query = new XQuery( "max((1, xs:float(2), xs:untypedAtomic(\"3\"))) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((1, xs:float(2), xs:decimal(3))) instance of xs:float`. . */ @org.junit.Test public void kSeqMAXFunc14() { final XQuery query = new XQuery( "max((1, xs:float(2), xs:decimal(3))) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((1, xs:untypedAtomic("3"), xs:float(2))) instance of xs:double`. . */ @org.junit.Test public void kSeqMAXFunc15() { final XQuery query = new XQuery( "max((1, xs:untypedAtomic(\"3\"), xs:float(2))) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(max((1, xs:untypedAtomic("NaN"), xs:float(2)))) eq "NaN"`. . */ @org.junit.Test public void kSeqMAXFunc16() { final XQuery query = new XQuery( "string(max((1, xs:untypedAtomic(\"NaN\"), xs:float(2)))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(max((xs:float("NaN"), xs:untypedAtomic("3"), xs:float(2)))) eq "NaN"`. . */ @org.junit.Test public void kSeqMAXFunc17() { final XQuery query = new XQuery( "string(max((xs:float(\"NaN\"), xs:untypedAtomic(\"3\"), xs:float(2)))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((xs:float("NaN"), xs:untypedAtomic("3"), xs:float(2))) instance of xs:double`. . */ @org.junit.Test public void kSeqMAXFunc18() { final XQuery query = new XQuery( "max((xs:float(\"NaN\"), xs:untypedAtomic(\"3\"), xs:float(2))) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((xs:float("NaN"), 1, 1, 2, xs:double("NaN"))) instance of xs:double`. . */ @org.junit.Test public void kSeqMAXFunc19() { final XQuery query = new XQuery( "max((xs:float(\"NaN\"), 1, 1, 2, xs:double(\"NaN\"))) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max("a string", "http://www.w3.org/2005/xpath-functions/collation/codepoint", "wrong param")`. . */ @org.junit.Test public void kSeqMAXFunc2() { final XQuery query = new XQuery( "max(\"a string\", \"http://www.w3.org/2005/xpath-functions/collation/codepoint\", \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `max((xs:double("NaN"), 1, 1, 2, xs:float("NaN"))) instance of xs:double`. . */ @org.junit.Test public void kSeqMAXFunc20() { final XQuery query = new XQuery( "max((xs:double(\"NaN\"), 1, 1, 2, xs:float(\"NaN\"))) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An xs:string cannot be compared to a numeric, even if a value is NaN. . */ @org.junit.Test public void kSeqMAXFunc21() { final XQuery query = new XQuery( "max((xs:float(\"NaN\"), 1, \"a string\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * An xs:string cannot be compared to a numeric, even if a value is NaN. . */ @org.junit.Test public void kSeqMAXFunc22() { final XQuery query = new XQuery( "max((\"a string\", 1, xs:float(\"NaN\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A type error must be reported even if one of other values is NaN. . */ @org.junit.Test public void kSeqMAXFunc23() { final XQuery query = new XQuery( "max((xs:float(\"NaN\"), 1, xs:untypedAtomic(\"one\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A type error must be reported even if one of other values is NaN. . */ @org.junit.Test public void kSeqMAXFunc24() { final XQuery query = new XQuery( "max((xs:untypedAtomic(\"one\"), 1, xs:float(\"NaN\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `string(max((xs:double("NaN"), xs:double("NaN")))) eq "NaN"`. . */ @org.junit.Test public void kSeqMAXFunc25() { final XQuery query = new XQuery( "string(max((xs:double(\"NaN\"), xs:double(\"NaN\")))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(max((xs:float("NaN"), xs:float("NaN")))) eq "NaN"`. . */ @org.junit.Test public void kSeqMAXFunc26() { final XQuery query = new XQuery( "string(max((xs:float(\"NaN\"), xs:float(\"NaN\")))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(max((3, xs:double("NaN")))) eq "NaN"`. . */ @org.junit.Test public void kSeqMAXFunc27() { final XQuery query = new XQuery( "string(max((3, xs:double(\"NaN\")))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(max((3, xs:float("NaN")))) eq "NaN"`. . */ @org.junit.Test public void kSeqMAXFunc28() { final XQuery query = new XQuery( "string(max((3, xs:float(\"NaN\")))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((3, xs:double("NaN"))) instance of xs:double`. . */ @org.junit.Test public void kSeqMAXFunc29() { final XQuery query = new XQuery( "max((3, xs:double(\"NaN\"))) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(max(()))`. . */ @org.junit.Test public void kSeqMAXFunc3() { final XQuery query = new XQuery( "empty(max(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((3, xs:float("NaN"))) instance of xs:float`. . */ @org.junit.Test public void kSeqMAXFunc30() { final XQuery query = new XQuery( "max((3, xs:float(\"NaN\"))) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(max((xs:float(-3), xs:untypedAtomic("3"), xs:double("NaN")))) eq "NaN"`. . */ @org.junit.Test public void kSeqMAXFunc31() { final XQuery query = new XQuery( "string(max((xs:float(-3), xs:untypedAtomic(\"3\"), xs:double(\"NaN\")))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((xs:float(-3), xs:untypedAtomic("3"), xs:double("NaN"))) instance of xs:double`. . */ @org.junit.Test public void kSeqMAXFunc32() { final XQuery query = new XQuery( "max((xs:float(-3), xs:untypedAtomic(\"3\"), xs:double(\"NaN\"))) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(max(xs:float("NaN"))) eq "NaN"`. . */ @org.junit.Test public void kSeqMAXFunc33() { final XQuery query = new XQuery( "string(max(xs:float(\"NaN\"))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(max(xs:double("NaN"))) eq "NaN"`. . */ @org.junit.Test public void kSeqMAXFunc34() { final XQuery query = new XQuery( "string(max(xs:double(\"NaN\"))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max(xs:untypedAtomic("three"))`. . */ @org.junit.Test public void kSeqMAXFunc35() { final XQuery query = new XQuery( "max(xs:untypedAtomic(\"three\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `max((xs:untypedAtomic("3"), "a string"))`. . */ @org.junit.Test public void kSeqMAXFunc36() { final XQuery query = new XQuery( "max((xs:untypedAtomic(\"3\"), \"a string\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A test whose essence is: `max(("a string", xs:untypedAtomic("3")))`. . */ @org.junit.Test public void kSeqMAXFunc37() { final XQuery query = new XQuery( "max((\"a string\", xs:untypedAtomic(\"3\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A test whose essence is: `max(QName("example.com/", "ncname"))`. . */ @org.junit.Test public void kSeqMAXFunc38() { final XQuery query = new XQuery( "max(QName(\"example.com/\", \"ncname\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A test whose essence is: `max(xs:anyURI("example.com/")) eq xs:anyURI("example.com/")`. . */ @org.junit.Test public void kSeqMAXFunc39() { final XQuery query = new XQuery( "max(xs:anyURI(\"example.com/\")) eq xs:anyURI(\"example.com/\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((3, 3, 3, 3, 3, 3)) eq 3`. . */ @org.junit.Test public void kSeqMAXFunc4() { final XQuery query = new XQuery( "max((3, 3, 3, 3, 3, 3)) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((xs:anyURI("example.com/"), xs:anyURI("example.com/"))) eq xs:anyURI("example.com/")`. . */ @org.junit.Test public void kSeqMAXFunc40() { final XQuery query = new XQuery( "max((xs:anyURI(\"example.com/\"), xs:anyURI(\"example.com/\"))) eq xs:anyURI(\"example.com/\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max(("a string")) eq "a string"`. . */ @org.junit.Test public void kSeqMAXFunc41() { final XQuery query = new XQuery( "max((\"a string\")) eq \"a string\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max(("a string", QName("example.com/", "ncname")))`. . */ @org.junit.Test public void kSeqMAXFunc42() { final XQuery query = new XQuery( "max((\"a string\", QName(\"example.com/\", \"ncname\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A test whose essence is: `max((5, 5.0e0)) eq 5.0e0`. . */ @org.junit.Test public void kSeqMAXFunc43() { final XQuery query = new XQuery( "max((5, 5.0e0)) eq 5.0e0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((5, 5.0e0)) instance of xs:double`. . */ @org.junit.Test public void kSeqMAXFunc44() { final XQuery query = new XQuery( "max((5, 5.0e0)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((5, 3.0e0)) instance of xs:double`. . */ @org.junit.Test public void kSeqMAXFunc45() { final XQuery query = new XQuery( "max((5, 3.0e0)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((5.0e0, 5)) instance of xs:double`. . */ @org.junit.Test public void kSeqMAXFunc46() { final XQuery query = new XQuery( "max((5.0e0, 5)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((3, 5.0e0)) instance of xs:double`. . */ @org.junit.Test public void kSeqMAXFunc47() { final XQuery query = new XQuery( "max((3, 5.0e0)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((5.0e0, 3)) instance of xs:double`. . */ @org.junit.Test public void kSeqMAXFunc48() { final XQuery query = new XQuery( "max((5.0e0, 3)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((1, 1, 1, 1, 1.0)) instance of xs:decimal`. . */ @org.junit.Test public void kSeqMAXFunc49() { final XQuery query = new XQuery( "max((1, 1, 1, 1, 1.0)) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((3, 1, 1, 1, 1, 1)) eq 3`. . */ @org.junit.Test public void kSeqMAXFunc5() { final XQuery query = new XQuery( "max((3, 1, 1, 1, 1, 1)) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((1.0, 1, 1, 1, 1)) instance of xs:decimal`. . */ @org.junit.Test public void kSeqMAXFunc50() { final XQuery query = new XQuery( "max((1.0, 1, 1, 1, 1)) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((1.0, 1, 1.0, 1, 1)) instance of xs:decimal`. . */ @org.junit.Test public void kSeqMAXFunc51() { final XQuery query = new XQuery( "max((1.0, 1, 1.0, 1, 1)) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((5.0e0, 5)) eq 5.0e0`. . */ @org.junit.Test public void kSeqMAXFunc52() { final XQuery query = new XQuery( "max((5.0e0, 5)) eq 5.0e0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((3, 5.0e0)) eq 5.0e0`. . */ @org.junit.Test public void kSeqMAXFunc53() { final XQuery query = new XQuery( "max((3, 5.0e0)) eq 5.0e0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((5.0e0, 3)) eq 5.0e0`. . */ @org.junit.Test public void kSeqMAXFunc54() { final XQuery query = new XQuery( "max((5.0e0, 3)) eq 5.0e0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Testing max() with current-date(). . */ @org.junit.Test public void kSeqMAXFunc55() { final XQuery query = new XQuery( "max((current-date(), xs:date(\"1999-01-01\"))) eq current-date()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((3,4,5)) eq 5`. . */ @org.junit.Test public void kSeqMAXFunc56() { final XQuery query = new XQuery( "max((3,4,5)) eq 5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((5, 5.0e0)) eq 5.0e0`. . */ @org.junit.Test public void kSeqMAXFunc57() { final XQuery query = new XQuery( "max((5, 5.0e0)) eq 5.0e0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((3,4, "Zero"))`. . */ @org.junit.Test public void kSeqMAXFunc58() { final XQuery query = new XQuery( "max((3,4, \"Zero\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A test whose essence is: `max(("a", "b", "c")) eq "c"`. . */ @org.junit.Test public void kSeqMAXFunc59() { final XQuery query = new XQuery( "max((\"a\", \"b\", \"c\")) eq \"c\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((1, 1, 1, 1, 1, 3)) eq 3`. . */ @org.junit.Test public void kSeqMAXFunc6() { final XQuery query = new XQuery( "max((1, 1, 1, 1, 1, 3)) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((3, 1, 5, 1, 1, 3)) eq 5`. . */ @org.junit.Test public void kSeqMAXFunc7() { final XQuery query = new XQuery( "max((3, 1, 5, 1, 1, 3)) eq 5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max((3, -5.0, 5, 1, -3, 3)) eq 5`. . */ @org.junit.Test public void kSeqMAXFunc8() { final XQuery query = new XQuery( "max((3, -5.0, 5, 1, -3, 3)) eq 5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `max(xs:untypedAtomic("3")) instance of xs:double`. . */ @org.junit.Test public void kSeqMAXFunc9() { final XQuery query = new XQuery( "max(xs:untypedAtomic(\"3\")) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke fn:max() on two identical xs:anyURI values. . */ @org.junit.Test public void k2SeqMAXFunc1() { final XQuery query = new XQuery( "max((xs:anyURI(\"http://example.com/A\"), xs:anyURI(\"http://example.com/A\"))) eq xs:anyURI(\"http://example.com/A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke fn:max() on two different xs:anyURI values. . */ @org.junit.Test public void k2SeqMAXFunc2() { final XQuery query = new XQuery( "max((xs:anyURI(\"http://example.com/B\"), xs:anyURI(\"http://example.com/A\"))) eq xs:anyURI(\"http://example.com/B\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke fn:max() on two different xs:anyURI values(#2). . */ @org.junit.Test public void k2SeqMAXFunc3() { final XQuery query = new XQuery( "max((xs:anyURI(\"http://example.com/8\"), xs:anyURI(\"http://example.com/4\"))) eq xs:anyURI(\"http://example.com/8\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke fn:max() with an unsupported collation. . */ @org.junit.Test public void k2SeqMAXFunc4() { final XQuery query = new XQuery( "max((\"str1\", \"str2\"), \"http://example.com/UNSUPPORTED_COLLATION\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0002") ); } /** * Invoke fn:max() with too many arguments. . */ @org.junit.Test public void k2SeqMAXFunc5() { final XQuery query = new XQuery( "max((\"str1\", \"str2\"), \"http://www.w3.org/2005/xpath-functions/collation/codepoint\", ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Invoke fn:max() with an unsupported collation and one xs:anyURI value. . */ @org.junit.Test public void k2SeqMAXFunc6() { final XQuery query = new XQuery( "max(xs:anyURI(\"str1\"), \"max://example.com/UNSUPPORTED_COLLATION\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("str1") || error("FOCH0002") ) ); } /** * Ensure the return type is properly inferred. . */ @org.junit.Test public void k2SeqMAXFunc7() { final XQuery query = new XQuery( "max(xs:unsignedShort(\"1\")) instance of xs:unsignedShort", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:max on xs:boolean arguments . */ @org.junit.Test public void cbclMax001() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { \n" + " \t\tif ($x = 0) then true() else false() \n" + " \t}; \n" + " \tmax(for $x in (1,2,3) return local:f($x))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:max on xs:boolean arguments . */ @org.junit.Test public void cbclMax002() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { \n" + " \t\tif ($x = 2) then true() else false() \n" + " \t}; \n" + " \tmax(for $x in (1,2,3) return local:f($x))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:max on xs:boolean arguments . */ @org.junit.Test public void cbclMax003() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { \n" + " \t\tif ($x = 3) then $x else false() \n" + " \t}; \n" + " \tmax(for $x in (1,2,3) return local:f($x))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * test fn:max with xs:date argument causing type error . */ @org.junit.Test public void cbclMax004() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) {\n" + " \t\t if ($x < 3) then current-date() else current-time() \n" + " \t}; \n" + " \tmax(for $x in (1,2,3) return local:f($x))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * test fn:max with xs:dateTime arguments . */ @org.junit.Test public void cbclMax005() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { \n" + " \t\tif ($x = 2) then xs:dateTime(\"3000-12-01T12:00:00\") else current-dateTime() \n" + " \t}; \n" + " \tmax(for $x in (1,2,3) return local:f($x))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3000-12-01T12:00:00") ); } /** * test fn:max with xs:dateTime argument causing type error . */ @org.junit.Test public void cbclMax006() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { \n" + " \t\tif ($x < 3) then current-dateTime() else xs:dayTimeDuration(\"PT3S\") \n" + " \t}; \n" + " \tmax(for $x in (1,2,3) return local:f($x))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Test fn:max with xs:dayTimeDuration arguments . */ @org.junit.Test public void cbclMax007() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { \n" + " \t\tif ($x = 2) then xs:dayTimeDuration(\"P1D\") else xs:dayTimeDuration(\"PT3S\") \n" + " \t}; \n" + " \tmax(for $x in (1,2,3) return local:f($x))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1D") ); } /** * Test fn:max with xs:dayTimeDuration argument causing type error . */ @org.junit.Test public void cbclMax008() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) {\n" + " \t\t if ($x = 3) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"PT3S\") \n" + " \t}; \n" + " \tmax(for $x in (1,2,3) return local:f($x))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Test fn:max with numeric arguments . */ @org.junit.Test public void cbclMax009() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) {\n" + " \t\t (xs:decimal(1.1), xs:float(2.2), xs:double(1.4), xs:integer(2))[$x] \n" + " \t}; \n" + " \tmax(for $x in (1,2,3) return local:f($x)) instance of xs:double\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test fn:max with numeric arguments . */ @org.junit.Test public void cbclMax010() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { \n" + " \t\t(xs:decimal(1.3), xs:float(1.2), xs:double(1.4), xs:integer(2))[$x] \n" + " \t}; \n" + " \tmax(for $x in (1,2,3) return local:f($x)) instance of xs:double\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test fn:max with numeric arguments rasing error . */ @org.junit.Test public void cbclMax011() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) {\n" + " \t\t (xs:decimal(1.1), xs:float(1.2), xs:double(0.4), xs:string(\"2\"))[$x] \n" + " \t}; \n" + " \tmax(for $x in (1,4,2,3) return local:f($x))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Test fn:max with numeric arguments . */ @org.junit.Test public void cbclMax012() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { \n" + " \t\t(xs:decimal(1.1), xs:float(1.2), xs:double(0.4), xs:integer(\"-3\"))[$x] \n" + " \t}; \n" + " \tmax(for $x in (4,2,1,3) return local:f($x)) instance of xs:double\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:max with xs:time arguments . */ @org.junit.Test public void cbclMax013() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { \n" + " \t\tif ($x = 2) then xs:time(\"12:00:00-01:00\") else xs:time(\"12:00:00+01:00\") \n" + " \t}; \n" + " \tmax(for $x in (1,2,3) return local:f($x))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12:00:00-01:00") ); } /** * test fn:max with xs:time argument causing type error . */ @org.junit.Test public void cbclMax014() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { \n" + " \t\tif ($x < 3) then current-time() else xs:dayTimeDuration(\"PT3S\") \n" + " \t}; \n" + " \tmax(for $x in (1,2,3) return local:f($x))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Test fn:max with xs:yearMonthDuration arguments . */ @org.junit.Test public void cbclMax015() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { \n" + " \t\tif ($x = 2) then xs:yearMonthDuration(\"P13M\") else xs:yearMonthDuration(\"P1Y\") \n" + " \t};\n" + " \tmax(for $x in (1,2,3) return local:f($x))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1Y1M") ); } /** * Test fn:max with xs:yearMonthDuration argument causing type error . */ @org.junit.Test public void cbclMax016() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { \n" + " \t\tif ($x = 3) then xs:duration(\"P1Y\") else xs:yearMonthDuration(\"P11M\") \n" + " \t}; \n" + " \tmax(for $x in (1,2,3) return local:f($x))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Test fn:max with invalid type for first argument . */ @org.junit.Test public void cbclMax017() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) as xs:duration { \n" + " \t\tif ($x = 1) then xs:duration(\"P1Y\") else xs:yearMonthDuration(\"P11M\") \n" + " \t}; \n" + " \tmax(for $x in (1,2,3) return local:f($x))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Test fn:max on a range expression . */ @org.junit.Test public void cbclMax018() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) as xs:integer { $x }; \n" + " \tmax(local:f(4) to local:f(10))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10") ); } /** * Test evaluating effective boolean value of max . */ @org.junit.Test public void cbclMax019() { final XQuery query = new XQuery( "if (max(for $x in 1 to 10 return $x mod 9 = 0)) then true() else false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the fn:max function with argument to sequence of different types. . */ @org.junit.Test public void fnMax1() { final XQuery query = new XQuery( "fn:max((3,4,\"Zero\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Test fn:max on a sequence of numeric arguments . */ @org.junit.Test public void fnMax10() { final XQuery query = new XQuery( "for $p in 1 to 4 let $x := (xs:integer(1), xs:decimal(2), xs:float(3), xs:double(4))[position() le $p] return typeswitch (max($x)) case xs:integer return \"integer\" case xs:decimal return \"decimal\" case xs:float return \"float\" case xs:double return \"double\" default return error()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "integer decimal float double") ); } /** * Test fn:max on a sequence of strings . */ @org.junit.Test public void fnMax11() { final XQuery query = new XQuery( "max((\"a\", \"b\", \"c\", \"d\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "d") ); } /** * Test fn:max on a sequence of dates . */ @org.junit.Test public void fnMax12() { final XQuery query = new XQuery( "max((xs:date('1066-10-02'), xs:date('1588-08-08'), xs:date('2011-06-29')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2011-06-29") ); } /** * Evaluation of type promotion when using mixed typed with fn:max function . */ @org.junit.Test public void fnMax2() { final XQuery query = new XQuery( "fn:max((xs:integer(5000000000),xs:double(3e0)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5.0E9") ); } /** * Evaluation of type promotion when using mixed typed with fn:max function Uses drived types promoted to least common type. . */ @org.junit.Test public void fnMax3() { final XQuery query = new XQuery( "let $var := fn:max((xs:long(20),xs:short(13))) return $var instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test fn:max on a sequence of xs:dayTimeDuration arguments . */ @org.junit.Test public void fnMax4() { final XQuery query = new XQuery( "max((xs:dayTimeDuration(\"P1D\"), xs:dayTimeDuration(\"PT2H\"))) instance of xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test fn:max on a sequence of xs:dayTimeDuration arguments . */ @org.junit.Test public void fnMax5() { final XQuery query = new XQuery( "max(for $x in 1 to 10 return xs:dayTimeDuration(concat(\"PT\",$x,\"H\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT10H") ); } /** * Test fn:max on a sequence of xs:yearMonthDuration arguments . */ @org.junit.Test public void fnMax6() { final XQuery query = new XQuery( "max((xs:yearMonthDuration(\"P1Y\"), xs:yearMonthDuration(\"P1M\"))) instance of xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test fn:max on a sequence of xs:yearMonthDuration arguments . */ @org.junit.Test public void fnMax7() { final XQuery query = new XQuery( "max(for $x in 1 to 10 return xs:yearMonthDuration(concat(\"P\",$x,\"M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P10M") ); } /** * Test fn:max on a sequence of xs:yearMonthDuration and xs:dayTimeDuration arguments . */ @org.junit.Test public void fnMax8() { final XQuery query = new XQuery( "max((xs:yearMonthDuration(\"P1Y\"), xs:dayTimeDuration(\"P1D\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FORG0006") || error("XPTY0004") ) ); } /** * Test fn:max on a sequence of xs:duration arguments . */ @org.junit.Test public void fnMax9() { final XQuery query = new XQuery( "max(xs:duration(\"P1Y1M1D\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FORG0006") || error("XPTY0004") ) ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:double(lower bound) . */ @org.junit.Test public void fnMaxdbl1args1() { final XQuery query = new XQuery( "fn:max((xs:double(\"-1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.7976931348623157E308") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:double(mid range) . */ @org.junit.Test public void fnMaxdbl1args2() { final XQuery query = new XQuery( "fn:max((xs:double(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:double(upper bound) . */ @org.junit.Test public void fnMaxdbl1args3() { final XQuery query = new XQuery( "fn:max((xs:double(\"1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.7976931348623157E308") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void fnMaxdbl2args1() { final XQuery query = new XQuery( "fn:max((xs:double(\"-1.7976931348623157E308\"),xs:double(\"-1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.7976931348623157E308") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:double(mid range) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void fnMaxdbl2args2() { final XQuery query = new XQuery( "fn:max((xs:double(\"0\"),xs:double(\"-1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:double(upper bound) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void fnMaxdbl2args3() { final XQuery query = new XQuery( "fn:max((xs:double(\"1.7976931348623157E308\"),xs:double(\"-1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.7976931348623157E308") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(mid range) . */ @org.junit.Test public void fnMaxdbl2args4() { final XQuery query = new XQuery( "fn:max((xs:double(\"-1.7976931348623157E308\"),xs:double(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(upper bound) . */ @org.junit.Test public void fnMaxdbl2args5() { final XQuery query = new XQuery( "fn:max((xs:double(\"-1.7976931348623157E308\"),xs:double(\"1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.7976931348623157E308") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:decimal(lower bound) . */ @org.junit.Test public void fnMaxdec1args1() { final XQuery query = new XQuery( "fn:max((xs:decimal(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:decimal(mid range) . */ @org.junit.Test public void fnMaxdec1args2() { final XQuery query = new XQuery( "fn:max((xs:decimal(\"617375191608514839\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("617375191608514839") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:decimal(upper bound) . */ @org.junit.Test public void fnMaxdec1args3() { final XQuery query = new XQuery( "fn:max((xs:decimal(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void fnMaxdec2args1() { final XQuery query = new XQuery( "fn:max((xs:decimal(\"-999999999999999999\"),xs:decimal(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:decimal(mid range) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void fnMaxdec2args2() { final XQuery query = new XQuery( "fn:max((xs:decimal(\"617375191608514839\"),xs:decimal(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("617375191608514839") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:decimal(upper bound) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void fnMaxdec2args3() { final XQuery query = new XQuery( "fn:max((xs:decimal(\"999999999999999999\"),xs:decimal(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(mid range) . */ @org.junit.Test public void fnMaxdec2args4() { final XQuery query = new XQuery( "fn:max((xs:decimal(\"-999999999999999999\"),xs:decimal(\"617375191608514839\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("617375191608514839") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(upper bound) . */ @org.junit.Test public void fnMaxdec2args5() { final XQuery query = new XQuery( "fn:max((xs:decimal(\"-999999999999999999\"),xs:decimal(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:float(lower bound) . */ @org.junit.Test public void fnMaxflt1args1() { final XQuery query = new XQuery( "fn:max((xs:float(\"-3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(\"-3.4028235E38\")") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:float(mid range) . */ @org.junit.Test public void fnMaxflt1args2() { final XQuery query = new XQuery( "fn:max((xs:float(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:float(upper bound) . */ @org.junit.Test public void fnMaxflt1args3() { final XQuery query = new XQuery( "fn:max((xs:float(\"3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(\"3.4028235E38\")") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void fnMaxflt2args1() { final XQuery query = new XQuery( "fn:max((xs:float(\"-3.4028235E38\"),xs:float(\"-3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(-3.4028235E38)") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:float(mid range) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void fnMaxflt2args2() { final XQuery query = new XQuery( "fn:max((xs:float(\"0\"),xs:float(\"-3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:float(upper bound) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void fnMaxflt2args3() { final XQuery query = new XQuery( "fn:max((xs:float(\"3.4028235E38\"),xs:float(\"-3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(3.4028235E38)") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(mid range) . */ @org.junit.Test public void fnMaxflt2args4() { final XQuery query = new XQuery( "fn:max((xs:float(\"-3.4028235E38\"),xs:float(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(upper bound) . */ @org.junit.Test public void fnMaxflt2args5() { final XQuery query = new XQuery( "fn:max((xs:float(\"-3.4028235E38\"),xs:float(\"3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(3.4028235E38)") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:int(lower bound) . */ @org.junit.Test public void fnMaxint1args1() { final XQuery query = new XQuery( "fn:max((xs:int(\"-2147483648\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2147483648") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:int(mid range) . */ @org.junit.Test public void fnMaxint1args2() { final XQuery query = new XQuery( "fn:max((xs:int(\"-1873914410\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1873914410") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:int(upper bound) . */ @org.junit.Test public void fnMaxint1args3() { final XQuery query = new XQuery( "fn:max((xs:int(\"2147483647\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2147483647") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void fnMaxint2args1() { final XQuery query = new XQuery( "fn:max((xs:int(\"-2147483648\"),xs:int(\"-2147483648\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2147483648") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:int(mid range) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void fnMaxint2args2() { final XQuery query = new XQuery( "fn:max((xs:int(\"-1873914410\"),xs:int(\"-2147483648\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1873914410") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:int(upper bound) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void fnMaxint2args3() { final XQuery query = new XQuery( "fn:max((xs:int(\"2147483647\"),xs:int(\"-2147483648\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2147483647") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(mid range) . */ @org.junit.Test public void fnMaxint2args4() { final XQuery query = new XQuery( "fn:max((xs:int(\"-2147483648\"),xs:int(\"-1873914410\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1873914410") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(upper bound) . */ @org.junit.Test public void fnMaxint2args5() { final XQuery query = new XQuery( "fn:max((xs:int(\"-2147483648\"),xs:int(\"2147483647\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2147483647") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:integer(lower bound) . */ @org.junit.Test public void fnMaxintg1args1() { final XQuery query = new XQuery( "fn:max((xs:integer(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:integer(mid range) . */ @org.junit.Test public void fnMaxintg1args2() { final XQuery query = new XQuery( "fn:max((xs:integer(\"830993497117024304\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("830993497117024304") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:integer(upper bound) . */ @org.junit.Test public void fnMaxintg1args3() { final XQuery query = new XQuery( "fn:max((xs:integer(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void fnMaxintg2args1() { final XQuery query = new XQuery( "fn:max((xs:integer(\"-999999999999999999\"),xs:integer(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:integer(mid range) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void fnMaxintg2args2() { final XQuery query = new XQuery( "fn:max((xs:integer(\"830993497117024304\"),xs:integer(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("830993497117024304") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:integer(upper bound) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void fnMaxintg2args3() { final XQuery query = new XQuery( "fn:max((xs:integer(\"999999999999999999\"),xs:integer(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(mid range) . */ @org.junit.Test public void fnMaxintg2args4() { final XQuery query = new XQuery( "fn:max((xs:integer(\"-999999999999999999\"),xs:integer(\"830993497117024304\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("830993497117024304") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(upper bound) . */ @org.junit.Test public void fnMaxintg2args5() { final XQuery query = new XQuery( "fn:max((xs:integer(\"-999999999999999999\"),xs:integer(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:long(lower bound) . */ @org.junit.Test public void fnMaxlng1args1() { final XQuery query = new XQuery( "fn:max((xs:long(\"-92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:long(mid range) . */ @org.junit.Test public void fnMaxlng1args2() { final XQuery query = new XQuery( "fn:max((xs:long(\"-47175562203048468\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-47175562203048468") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:long(upper bound) . */ @org.junit.Test public void fnMaxlng1args3() { final XQuery query = new XQuery( "fn:max((xs:long(\"92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("92233720368547758") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void fnMaxlng2args1() { final XQuery query = new XQuery( "fn:max((xs:long(\"-92233720368547758\"),xs:long(\"-92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:long(mid range) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void fnMaxlng2args2() { final XQuery query = new XQuery( "fn:max((xs:long(\"-47175562203048468\"),xs:long(\"-92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-47175562203048468") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:long(upper bound) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void fnMaxlng2args3() { final XQuery query = new XQuery( "fn:max((xs:long(\"92233720368547758\"),xs:long(\"-92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("92233720368547758") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(mid range) . */ @org.junit.Test public void fnMaxlng2args4() { final XQuery query = new XQuery( "fn:max((xs:long(\"-92233720368547758\"),xs:long(\"-47175562203048468\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-47175562203048468") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(upper bound) . */ @org.junit.Test public void fnMaxlng2args5() { final XQuery query = new XQuery( "fn:max((xs:long(\"-92233720368547758\"),xs:long(\"92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("92233720368547758") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnMaxnint1args1() { final XQuery query = new XQuery( "fn:max((xs:negativeInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnMaxnint1args2() { final XQuery query = new XQuery( "fn:max((xs:negativeInteger(\"-297014075999096793\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-297014075999096793") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnMaxnint1args3() { final XQuery query = new XQuery( "fn:max((xs:negativeInteger(\"-1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnMaxnint2args1() { final XQuery query = new XQuery( "fn:max((xs:negativeInteger(\"-999999999999999999\"),xs:negativeInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:negativeInteger(mid range) $arg2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnMaxnint2args2() { final XQuery query = new XQuery( "fn:max((xs:negativeInteger(\"-297014075999096793\"),xs:negativeInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-297014075999096793") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:negativeInteger(upper bound) $arg2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnMaxnint2args3() { final XQuery query = new XQuery( "fn:max((xs:negativeInteger(\"-1\"),xs:negativeInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnMaxnint2args4() { final XQuery query = new XQuery( "fn:max((xs:negativeInteger(\"-999999999999999999\"),xs:negativeInteger(\"-297014075999096793\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-297014075999096793") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnMaxnint2args5() { final XQuery query = new XQuery( "fn:max((xs:negativeInteger(\"-999999999999999999\"),xs:negativeInteger(\"-1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnMaxnni1args1() { final XQuery query = new XQuery( "fn:max((xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnMaxnni1args2() { final XQuery query = new XQuery( "fn:max((xs:nonNegativeInteger(\"303884545991464527\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("303884545991464527") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnMaxnni1args3() { final XQuery query = new XQuery( "fn:max((xs:nonNegativeInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnMaxnni2args1() { final XQuery query = new XQuery( "fn:max((xs:nonNegativeInteger(\"0\"),xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:nonNegativeInteger(mid range) $arg2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnMaxnni2args2() { final XQuery query = new XQuery( "fn:max((xs:nonNegativeInteger(\"303884545991464527\"),xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("303884545991464527") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:nonNegativeInteger(upper bound) $arg2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnMaxnni2args3() { final XQuery query = new XQuery( "fn:max((xs:nonNegativeInteger(\"999999999999999999\"),xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnMaxnni2args4() { final XQuery query = new XQuery( "fn:max((xs:nonNegativeInteger(\"0\"),xs:nonNegativeInteger(\"303884545991464527\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("303884545991464527") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnMaxnni2args5() { final XQuery query = new XQuery( "fn:max((xs:nonNegativeInteger(\"0\"),xs:nonNegativeInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnMaxnpi1args1() { final XQuery query = new XQuery( "fn:max((xs:nonPositiveInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnMaxnpi1args2() { final XQuery query = new XQuery( "fn:max((xs:nonPositiveInteger(\"-475688437271870490\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-475688437271870490") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnMaxnpi1args3() { final XQuery query = new XQuery( "fn:max((xs:nonPositiveInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnMaxnpi2args1() { final XQuery query = new XQuery( "fn:max((xs:nonPositiveInteger(\"-999999999999999999\"),xs:nonPositiveInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:nonPositiveInteger(mid range) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnMaxnpi2args2() { final XQuery query = new XQuery( "fn:max((xs:nonPositiveInteger(\"-475688437271870490\"),xs:nonPositiveInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-475688437271870490") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:nonPositiveInteger(upper bound) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnMaxnpi2args3() { final XQuery query = new XQuery( "fn:max((xs:nonPositiveInteger(\"0\"),xs:nonPositiveInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnMaxnpi2args4() { final XQuery query = new XQuery( "fn:max((xs:nonPositiveInteger(\"-999999999999999999\"),xs:nonPositiveInteger(\"-475688437271870490\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-475688437271870490") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnMaxnpi2args5() { final XQuery query = new XQuery( "fn:max((xs:nonPositiveInteger(\"-999999999999999999\"),xs:nonPositiveInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnMaxpint1args1() { final XQuery query = new XQuery( "fn:max((xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnMaxpint1args2() { final XQuery query = new XQuery( "fn:max((xs:positiveInteger(\"52704602390610033\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("52704602390610033") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnMaxpint1args3() { final XQuery query = new XQuery( "fn:max((xs:positiveInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnMaxpint2args1() { final XQuery query = new XQuery( "fn:max((xs:positiveInteger(\"1\"),xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:positiveInteger(mid range) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnMaxpint2args2() { final XQuery query = new XQuery( "fn:max((xs:positiveInteger(\"52704602390610033\"),xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("52704602390610033") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:positiveInteger(upper bound) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnMaxpint2args3() { final XQuery query = new XQuery( "fn:max((xs:positiveInteger(\"999999999999999999\"),xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnMaxpint2args4() { final XQuery query = new XQuery( "fn:max((xs:positiveInteger(\"1\"),xs:positiveInteger(\"52704602390610033\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("52704602390610033") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnMaxpint2args5() { final XQuery query = new XQuery( "fn:max((xs:positiveInteger(\"1\"),xs:positiveInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:short(lower bound) . */ @org.junit.Test public void fnMaxsht1args1() { final XQuery query = new XQuery( "fn:max((xs:short(\"-32768\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-32768") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:short(mid range) . */ @org.junit.Test public void fnMaxsht1args2() { final XQuery query = new XQuery( "fn:max((xs:short(\"-5324\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-5324") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:short(upper bound) . */ @org.junit.Test public void fnMaxsht1args3() { final XQuery query = new XQuery( "fn:max((xs:short(\"32767\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("32767") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void fnMaxsht2args1() { final XQuery query = new XQuery( "fn:max((xs:short(\"-32768\"),xs:short(\"-32768\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-32768") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:short(mid range) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void fnMaxsht2args2() { final XQuery query = new XQuery( "fn:max((xs:short(\"-5324\"),xs:short(\"-32768\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-5324") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:short(upper bound) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void fnMaxsht2args3() { final XQuery query = new XQuery( "fn:max((xs:short(\"32767\"),xs:short(\"-32768\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("32767") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(mid range) . */ @org.junit.Test public void fnMaxsht2args4() { final XQuery query = new XQuery( "fn:max((xs:short(\"-32768\"),xs:short(\"-5324\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-5324") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(upper bound) . */ @org.junit.Test public void fnMaxsht2args5() { final XQuery query = new XQuery( "fn:max((xs:short(\"-32768\"),xs:short(\"32767\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("32767") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnMaxulng1args1() { final XQuery query = new XQuery( "fn:max((xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnMaxulng1args2() { final XQuery query = new XQuery( "fn:max((xs:unsignedLong(\"130747108607674654\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("130747108607674654") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnMaxulng1args3() { final XQuery query = new XQuery( "fn:max((xs:unsignedLong(\"184467440737095516\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("184467440737095516") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnMaxulng2args1() { final XQuery query = new XQuery( "fn:max((xs:unsignedLong(\"0\"),xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:unsignedLong(mid range) $arg2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnMaxulng2args2() { final XQuery query = new XQuery( "fn:max((xs:unsignedLong(\"130747108607674654\"),xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("130747108607674654") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:unsignedLong(upper bound) $arg2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnMaxulng2args3() { final XQuery query = new XQuery( "fn:max((xs:unsignedLong(\"184467440737095516\"),xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("184467440737095516") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnMaxulng2args4() { final XQuery query = new XQuery( "fn:max((xs:unsignedLong(\"0\"),xs:unsignedLong(\"130747108607674654\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("130747108607674654") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnMaxulng2args5() { final XQuery query = new XQuery( "fn:max((xs:unsignedLong(\"0\"),xs:unsignedLong(\"184467440737095516\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("184467440737095516") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnMaxusht1args1() { final XQuery query = new XQuery( "fn:max((xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnMaxusht1args2() { final XQuery query = new XQuery( "fn:max((xs:unsignedShort(\"44633\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("44633") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnMaxusht1args3() { final XQuery query = new XQuery( "fn:max((xs:unsignedShort(\"65535\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("65535") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnMaxusht2args1() { final XQuery query = new XQuery( "fn:max((xs:unsignedShort(\"0\"),xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:unsignedShort(mid range) $arg2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnMaxusht2args2() { final XQuery query = new XQuery( "fn:max((xs:unsignedShort(\"44633\"),xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("44633") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:unsignedShort(upper bound) $arg2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnMaxusht2args3() { final XQuery query = new XQuery( "fn:max((xs:unsignedShort(\"65535\"),xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("65535") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnMaxusht2args4() { final XQuery query = new XQuery( "fn:max((xs:unsignedShort(\"0\"),xs:unsignedShort(\"44633\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("44633") ); } /** * Evaluates The "max" function with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnMaxusht2args5() { final XQuery query = new XQuery( "fn:max((xs:unsignedShort(\"0\"),xs:unsignedShort(\"65535\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("65535") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnMin.java000066400000000000000000003114071222453003200257640ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the min() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnMin extends QT3TestSet { /** * A test whose essence is: `min()`. . */ @org.junit.Test public void kSeqMINFunc1() { final XQuery query = new XQuery( "min()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `min(xs:untypedAtomic("3")) eq 3`. . */ @org.junit.Test public void kSeqMINFunc10() { final XQuery query = new XQuery( "min(xs:untypedAtomic(\"3\")) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `min((xs:untypedAtomic("1"), 3, 2)) instance of xs:double`. . */ @org.junit.Test public void kSeqMINFunc11() { final XQuery query = new XQuery( "min((xs:untypedAtomic(\"1\"), 3, 2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `min((3, xs:float(2), xs:untypedAtomic("1"))) eq 1`. . */ @org.junit.Test public void kSeqMINFunc12() { final XQuery query = new XQuery( "min((3, xs:float(2), xs:untypedAtomic(\"1\"))) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `min((3, xs:float(2), xs:untypedAtomic("1"))) instance of xs:double`. . */ @org.junit.Test public void kSeqMINFunc13() { final XQuery query = new XQuery( "min((3, xs:float(2), xs:untypedAtomic(\"1\"))) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `min((1, xs:float(2), xs:decimal(3))) instance of xs:float`. . */ @org.junit.Test public void kSeqMINFunc14() { final XQuery query = new XQuery( "min((1, xs:float(2), xs:decimal(3))) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `min((3, xs:untypedAtomic("1"), xs:float(2))) instance of xs:double`. . */ @org.junit.Test public void kSeqMINFunc15() { final XQuery query = new XQuery( "min((3, xs:untypedAtomic(\"1\"), xs:float(2))) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(min((1, xs:untypedAtomic("NaN"), xs:float(2)))) eq "NaN"`. . */ @org.junit.Test public void kSeqMINFunc16() { final XQuery query = new XQuery( "string(min((1, xs:untypedAtomic(\"NaN\"), xs:float(2)))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(min((xs:float("NaN"), xs:untypedAtomic("3"), xs:float(2)))) eq "NaN"`. . */ @org.junit.Test public void kSeqMINFunc17() { final XQuery query = new XQuery( "string(min((xs:float(\"NaN\"), xs:untypedAtomic(\"3\"), xs:float(2)))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `min((xs:float("NaN"), xs:untypedAtomic("3"), xs:double(2))) instance of xs:double`. . */ @org.junit.Test public void kSeqMINFunc18() { final XQuery query = new XQuery( "min((xs:float(\"NaN\"), xs:untypedAtomic(\"3\"), xs:double(2))) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `min((xs:float("NaN"), 1, 1, 2, xs:double("NaN"))) instance of xs:double`. . */ @org.junit.Test public void kSeqMINFunc19() { final XQuery query = new XQuery( "min((xs:float(\"NaN\"), 1, 1, 2, xs:double(\"NaN\"))) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `min("a string", "http://www.w3.org/2005/xpath-functions/collation/codepoint", "wrong param")`. . */ @org.junit.Test public void kSeqMINFunc2() { final XQuery query = new XQuery( "min(\"a string\", \"http://www.w3.org/2005/xpath-functions/collation/codepoint\", \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `min((xs:double("NaN"), 1, 1, 2, xs:float("NaN"))) instance of xs:double`. . */ @org.junit.Test public void kSeqMINFunc20() { final XQuery query = new XQuery( "min((xs:double(\"NaN\"), 1, 1, 2, xs:float(\"NaN\"))) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An xs:string cannot be compared to a numeric, even if a value is NaN. . */ @org.junit.Test public void kSeqMINFunc21() { final XQuery query = new XQuery( "min((xs:float(\"NaN\"), 1, \"a string\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * An xs:string cannot be compared to a numeric, even if a value is NaN. . */ @org.junit.Test public void kSeqMINFunc22() { final XQuery query = new XQuery( "min((\"a string\", 1, xs:float(\"NaN\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A type error must be reported even if one of other values is NaN. . */ @org.junit.Test public void kSeqMINFunc23() { final XQuery query = new XQuery( "max((xs:float(\"NaN\"), 1, xs:untypedAtomic(\"one\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A type error must be reported even if one of other values is NaN. . */ @org.junit.Test public void kSeqMINFunc24() { final XQuery query = new XQuery( "max((xs:untypedAtomic(\"one\"), 1, xs:float(\"NaN\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `string(min((xs:double("NaN"), xs:double("NaN")))) eq "NaN"`. . */ @org.junit.Test public void kSeqMINFunc25() { final XQuery query = new XQuery( "string(min((xs:double(\"NaN\"), xs:double(\"NaN\")))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(min((xs:float("NaN"), xs:float("NaN")))) eq "NaN"`. . */ @org.junit.Test public void kSeqMINFunc26() { final XQuery query = new XQuery( "string(min((xs:float(\"NaN\"), xs:float(\"NaN\")))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(min((3, xs:double("NaN")))) eq "NaN"`. . */ @org.junit.Test public void kSeqMINFunc27() { final XQuery query = new XQuery( "string(min((3, xs:double(\"NaN\")))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(min((3, xs:float("NaN")))) eq "NaN"`. . */ @org.junit.Test public void kSeqMINFunc28() { final XQuery query = new XQuery( "string(min((3, xs:float(\"NaN\")))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `min((3, xs:double("NaN"))) instance of xs:double`. . */ @org.junit.Test public void kSeqMINFunc29() { final XQuery query = new XQuery( "min((3, xs:double(\"NaN\"))) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(min(()))`. . */ @org.junit.Test public void kSeqMINFunc3() { final XQuery query = new XQuery( "empty(min(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `min((3, xs:float("NaN"))) instance of xs:float`. . */ @org.junit.Test public void kSeqMINFunc30() { final XQuery query = new XQuery( "min((3, xs:float(\"NaN\"))) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(min((xs:float(-3), xs:untypedAtomic("3"), xs:double("NaN")))) eq "NaN"`. . */ @org.junit.Test public void kSeqMINFunc31() { final XQuery query = new XQuery( "string(min((xs:float(-3), xs:untypedAtomic(\"3\"), xs:double(\"NaN\")))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `min((xs:float(-3), xs:untypedAtomic("3"), xs:double("NaN"))) instance of xs:double`. . */ @org.junit.Test public void kSeqMINFunc32() { final XQuery query = new XQuery( "min((xs:float(-3), xs:untypedAtomic(\"3\"), xs:double(\"NaN\"))) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(min(xs:float("NaN"))) eq "NaN"`. . */ @org.junit.Test public void kSeqMINFunc33() { final XQuery query = new XQuery( "string(min(xs:float(\"NaN\"))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(min(xs:double("NaN"))) eq "NaN"`. . */ @org.junit.Test public void kSeqMINFunc34() { final XQuery query = new XQuery( "string(min(xs:double(\"NaN\"))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `min(xs:untypedAtomic("three"))`. . */ @org.junit.Test public void kSeqMINFunc35() { final XQuery query = new XQuery( "min(xs:untypedAtomic(\"three\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `min((xs:untypedAtomic("3"), "a string"))`. . */ @org.junit.Test public void kSeqMINFunc36() { final XQuery query = new XQuery( "min((xs:untypedAtomic(\"3\"), \"a string\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A test whose essence is: `min(("a string", xs:untypedAtomic("3")))`. . */ @org.junit.Test public void kSeqMINFunc37() { final XQuery query = new XQuery( "min((\"a string\", xs:untypedAtomic(\"3\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A test whose essence is: `min(QName("example.com/", "ncname"))`. . */ @org.junit.Test public void kSeqMINFunc38() { final XQuery query = new XQuery( "min(QName(\"example.com/\", \"ncname\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A test whose essence is: `min(xs:anyURI("example.com/")) eq xs:anyURI("example.com/")`. . */ @org.junit.Test public void kSeqMINFunc39() { final XQuery query = new XQuery( "min(xs:anyURI(\"example.com/\")) eq xs:anyURI(\"example.com/\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `min((3, 3, 3, 3, 3, 3)) eq 3`. . */ @org.junit.Test public void kSeqMINFunc4() { final XQuery query = new XQuery( "min((3, 3, 3, 3, 3, 3)) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `min((xs:anyURI("example.com/"), xs:anyURI("example.com/"))) eq xs:anyURI("example.com/")`. . */ @org.junit.Test public void kSeqMINFunc40() { final XQuery query = new XQuery( "min((xs:anyURI(\"example.com/\"), xs:anyURI(\"example.com/\"))) eq xs:anyURI(\"example.com/\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `min(("a string")) eq "a string"`. . */ @org.junit.Test public void kSeqMINFunc41() { final XQuery query = new XQuery( "min((\"a string\")) eq \"a string\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `min(("a string", QName("example.com/", "ncname")))`. . */ @org.junit.Test public void kSeqMINFunc42() { final XQuery query = new XQuery( "min((\"a string\", QName(\"example.com/\", \"ncname\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A test whose essence is: `min((5, 5.0e0)) eq 5.0e0`. . */ @org.junit.Test public void kSeqMINFunc43() { final XQuery query = new XQuery( "min((5, 5.0e0)) eq 5.0e0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `min((5.0e0, 5)) eq 5.0e0`. . */ @org.junit.Test public void kSeqMINFunc44() { final XQuery query = new XQuery( "min((5.0e0, 5)) eq 5.0e0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `min((3, 5.0e0)) eq 3`. . */ @org.junit.Test public void kSeqMINFunc45() { final XQuery query = new XQuery( "min((3, 5.0e0)) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `min((5.0e0, 3)) eq 3`. . */ @org.junit.Test public void kSeqMINFunc46() { final XQuery query = new XQuery( "min((5.0e0, 3)) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test for min() involving xs:date. . */ @org.junit.Test public void kSeqMINFunc47() { final XQuery query = new XQuery( "min((xs:date(\"2005-01-01\"), xs:date(\"2001-01-01\"))) eq xs:date(\"2001-01-01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `min((3,4,5)) eq 3`. . */ @org.junit.Test public void kSeqMINFunc48() { final XQuery query = new XQuery( "min((3,4,5)) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `min((5, 5.0e0)) eq 5.0e0`. . */ @org.junit.Test public void kSeqMINFunc49() { final XQuery query = new XQuery( "min((5, 5.0e0)) eq 5.0e0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `min((3, 1, 1, 1, 1, 1)) eq 1`. . */ @org.junit.Test public void kSeqMINFunc5() { final XQuery query = new XQuery( "min((3, 1, 1, 1, 1, 1)) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `min((3,4, "Zero"))`. . */ @org.junit.Test public void kSeqMINFunc50() { final XQuery query = new XQuery( "min((3,4, \"Zero\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A test whose essence is: `min((xs:float(0.0E0), xs:float(-0.0E0))) eq xs:float("-0")`. . */ @org.junit.Test public void kSeqMINFunc51() { final XQuery query = new XQuery( "min((xs:float(0.0E0), xs:float(-0.0E0))) eq xs:float(\"-0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `min((1, 1, 1, 1, 1, 3)) eq 1`. . */ @org.junit.Test public void kSeqMINFunc6() { final XQuery query = new XQuery( "min((1, 1, 1, 1, 1, 3)) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `min((3, 1, 5, 1, 1, 3)) eq 1`. . */ @org.junit.Test public void kSeqMINFunc7() { final XQuery query = new XQuery( "min((3, 1, 5, 1, 1, 3)) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `min((3, -5.0, 5, 1, -3, 3)) eq -5.0`. . */ @org.junit.Test public void kSeqMINFunc8() { final XQuery query = new XQuery( "min((3, -5.0, 5, 1, -3, 3)) eq -5.0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `min(xs:untypedAtomic("3")) instance of xs:double`. . */ @org.junit.Test public void kSeqMINFunc9() { final XQuery query = new XQuery( "min(xs:untypedAtomic(\"3\")) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke fn:min() on two identical xs:anyURI values. . */ @org.junit.Test public void k2SeqMINFunc1() { final XQuery query = new XQuery( "min((xs:anyURI(\"http://example.com/A\"), xs:anyURI(\"http://example.com/A\"))) eq xs:anyURI(\"http://example.com/A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:min() and xs:double promotion. . */ @org.junit.Test public void k2SeqMINFunc10() { final XQuery query = new XQuery( "min((5.0e0, 3)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:min() and xs:double promotion. . */ @org.junit.Test public void k2SeqMINFunc11() { final XQuery query = new XQuery( "min((1, 1, 1, 1, 1.0)) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:min() and xs:double promotion. . */ @org.junit.Test public void k2SeqMINFunc12() { final XQuery query = new XQuery( "min((1.0, 1, 1, 1, 1)) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:min() and xs:double promotion. . */ @org.junit.Test public void k2SeqMINFunc13() { final XQuery query = new XQuery( "min((1.0, 1, 1.0, 1, 1)) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:min() and xs:double promotion. . */ @org.junit.Test public void k2SeqMINFunc14() { final XQuery query = new XQuery( "min((\"a\", \"b\", \"c\")) eq \"a\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is properly inferred. . */ @org.junit.Test public void k2SeqMINFunc15() { final XQuery query = new XQuery( "min(xs:unsignedShort(\"1\")) instance of xs:unsignedShort", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke fn:min() on two different xs:anyURI values. . */ @org.junit.Test public void k2SeqMINFunc2() { final XQuery query = new XQuery( "min((xs:anyURI(\"http://example.com/B\"), xs:anyURI(\"http://example.com/A\"))) eq xs:anyURI(\"http://example.com/A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke fn:min() on two different xs:anyURI values(#2). . */ @org.junit.Test public void k2SeqMINFunc3() { final XQuery query = new XQuery( "min((xs:anyURI(\"http://example.com/8\"), xs:anyURI(\"http://example.com/4\"))) eq xs:anyURI(\"http://example.com/4\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke fn:min() with an unsupported collation. . */ @org.junit.Test public void k2SeqMINFunc4() { final XQuery query = new XQuery( "min((\"str1\", \"str2\"), \"http://example.com/UNSUPPORTED_COLLATION\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0002") ); } /** * Invoke fn:min() with an unsupported collation and one xs:anyURI value. . */ @org.junit.Test public void k2SeqMINFunc5() { final XQuery query = new XQuery( "min(xs:anyURI(\"str1\"), \"http://example.com/UNSUPPORTED_COLLATION\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("str1") || error("FOCH0002") ) ); } /** * Invoke fn:min() with too many arguments. . */ @org.junit.Test public void k2SeqMINFunc6() { final XQuery query = new XQuery( "min((\"str1\", \"str2\"), \"http://www.w3.org/2005/xpath-functions/collation/codepoint\", ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * fn:min() and xs:double promotion. . */ @org.junit.Test public void k2SeqMINFunc7() { final XQuery query = new XQuery( "min((5, 5.0e0)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:min() and xs:double promotion. . */ @org.junit.Test public void k2SeqMINFunc8() { final XQuery query = new XQuery( "min((5.0e0, 5)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:min() and xs:double promotion. . */ @org.junit.Test public void k2SeqMINFunc9() { final XQuery query = new XQuery( "min((3, 5.0e0)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:min on xs:boolean arguments . */ @org.junit.Test public void cbclMin001() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { if ($x = 0) then false() else true() }; \n" + " \tmin(for $x in (1,2,3) return local:f($x))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:min on xs:boolean arguments . */ @org.junit.Test public void cbclMin002() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { if ($x = 2) then false() else true() }; \n" + " \tmin(for $x in (1,2,3) return local:f($x))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:min on xs:boolean arguments . */ @org.junit.Test public void cbclMin003() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { if ($x = 3) then $x else false() }; \n" + " \tmin(for $x in (1,2,3) return local:f($x))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * test fn:min with xs:date argument causing type error . */ @org.junit.Test public void cbclMin004() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { if ($x < 3) then current-date() else current-time() }; \n" + " \tmin(for $x in (1,2,3) return local:f($x))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * test fn:min with xs:dateTime arguments . */ @org.junit.Test public void cbclMin005() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { if ($x = 2) then xs:dateTime(\"1996-12-01T12:00:00\") else current-dateTime() }; \n" + " \tmin(for $x in (1,2,3) return local:f($x))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1996-12-01T12:00:00") ); } /** * test fn:min with xs:dateTime argument causing type error . */ @org.junit.Test public void cbclMin006() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { if ($x < 3) then current-dateTime() else xs:dayTimeDuration(\"PT3S\") }; \n" + " \tmin(for $x in (1,2,3) return local:f($x))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Test fn:min with xs:dayTimeDuration arguments . */ @org.junit.Test public void cbclMin007() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { if ($x = 2) then xs:dayTimeDuration(\"P1D\") else xs:dayTimeDuration(\"PT3S\") }; \n" + " \tmin(for $x in (1,2,3) return local:f($x))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT3S") ); } /** * Test fn:min with xs:dayTimeDuration argument causing type error . */ @org.junit.Test public void cbclMin008() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { if ($x = 3) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"PT3S\") }; \n" + " \tmin(for $x in (1,2,3) return local:f($x))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Test fn:min with numeric arguments . */ @org.junit.Test public void cbclMin009() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { (xs:decimal(1.1), xs:float(2.2), xs:double(1.4), xs:integer(2))[$x] }; \n" + " \tmin(for $x in (1,2,3) return local:f($x)) instance of xs:double\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test fn:min with numeric arguments . */ @org.junit.Test public void cbclMin010() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { (xs:decimal(1.3), xs:float(1.2), xs:double(1.4), xs:integer(2))[$x] }; \n" + " \tmin(for $x in (1,2,3) return local:f($x)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test fn:min with numeric arguments rasing error . */ @org.junit.Test public void cbclMin011() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { (xs:decimal(1.1), xs:float(1.2), xs:double(0.4), xs:string(\"2\"))[$x] }; \n" + " \tmin(for $x in (1,4,2,3) return local:f($x))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Test fn:min with numeric arguments . */ @org.junit.Test public void cbclMin012() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { (xs:decimal(1.1), xs:float(1.2), xs:double(0.4), xs:integer(\"-3\"))[$x] }; \n" + " \tmin(for $x in (4,2,1,3) return local:f($x)) instance of xs:double\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:min with xs:time arguments . */ @org.junit.Test public void cbclMin013() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { if ($x = 2) then xs:time(\"12:00:00-01:00\") else xs:time(\"12:00:00+01:00\") }; \n" + " \tmin(for $x in (1,2,3) return local:f($x))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12:00:00+01:00") ); } /** * test fn:min with xs:time argument causing type error . */ @org.junit.Test public void cbclMin014() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { if ($x < 3) then current-time() else xs:dayTimeDuration(\"PT3S\") }; \n" + " \tmin(for $x in (1,2,3) return local:f($x))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Test fn:min with xs:yearMonthDuration arguments . */ @org.junit.Test public void cbclMin015() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { if ($x = 2) then xs:yearMonthDuration(\"P11M\") else xs:yearMonthDuration(\"P1Y\") }; \n" + " \tmin(for $x in (1,2,3) return local:f($x))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P11M") ); } /** * Test fn:min with xs:yearMonthDuration argument causing type error . */ @org.junit.Test public void cbclMin016() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) { if ($x = 3) then xs:duration(\"P1Y\") else xs:yearMonthDuration(\"P11M\") }; \n" + " \tmin(for $x in (1,2,3) return local:f($x))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Test fn:min with invalid type for first argument . */ @org.junit.Test public void cbclMin017() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) as xs:duration { if ($x = 1) then xs:duration(\"P1Y\") else xs:yearMonthDuration(\"P11M\") }; \n" + " \tmin(for $x in (1,2,3) return local:f($x))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Test fn:min on a range expression . */ @org.junit.Test public void cbclMin018() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) as xs:integer { $x }; \n" + " \tmin(local:f(4) to local:f(10))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4") ); } /** * Evaluation of the fn:min function with argument to sequence of different types. . */ @org.junit.Test public void fnMin1() { final XQuery query = new XQuery( "fn:min((3,4,\"Zero\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Test fn:min on a sequence of numeric arguments. */ @org.junit.Test public void fnMin10() { final XQuery query = new XQuery( "for $p in 1 to 4 let $x := (xs:integer(4), xs:decimal(3), xs:float(2), xs:double(1))[position() le $p] return typeswitch (min($x)) case xs:integer return \"integer\" case xs:decimal return \"decimal\" case xs:float return \"float\" case xs:double return \"double\" default return error()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "integer decimal float double") ); } /** * Test fn:min on a sequence of strings. */ @org.junit.Test public void fnMin11() { final XQuery query = new XQuery( "min((\"a\", \"b\", \"c\", \"d\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a") ); } /** * Test fn:min on a sequence of dates. */ @org.junit.Test public void fnMin12() { final XQuery query = new XQuery( "min((xs:date('1066-10-02'), xs:date('1588-08-08'), xs:date('2011-06-29')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1066-10-02") ); } /** * Evaluation of type promotion when using mixed typed with fn:min function . */ @org.junit.Test public void fnMin2() { final XQuery query = new XQuery( "fn:min((xs:integer(5000000),xs:double(3e8)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5.0E6") ); } /** * Evaluation of type promotion when using mixed typed with fn:min function (used derived types). */ @org.junit.Test public void fnMin3() { final XQuery query = new XQuery( "let $var := fn:min((xs:long(22),xs:short(10))) return $var instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test fn:min on a sequence of xs:dayTimeDuration arguments. */ @org.junit.Test public void fnMin4() { final XQuery query = new XQuery( "min((xs:dayTimeDuration(\"P1D\"), xs:dayTimeDuration(\"PT2H\"))) instance of xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test fn:min on a sequence of xs:dayTimeDuration arguments. */ @org.junit.Test public void fnMin5() { final XQuery query = new XQuery( "min(for $x in 1 to 10 return xs:dayTimeDuration(concat(\"PT\",$x,\"H\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT1H") ); } /** * Test fn:min on a sequence of xs:yearMonthDuration arguments. */ @org.junit.Test public void fnMin6() { final XQuery query = new XQuery( "min((xs:yearMonthDuration(\"P1Y\"), xs:yearMonthDuration(\"P1M\"))) instance of xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test fn:min on a sequence of xs:yearMonthDuration arguments. */ @org.junit.Test public void fnMin7() { final XQuery query = new XQuery( "min(for $x in 1 to 10 return xs:yearMonthDuration(concat(\"P\",$x,\"M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1M") ); } /** * Test fn:min on a sequence of xs:yearMonthDuration and xs:dayTimeDuration arguments. */ @org.junit.Test public void fnMin8() { final XQuery query = new XQuery( "min((xs:yearMonthDuration(\"P1Y\"), xs:dayTimeDuration(\"P1D\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FORG0006") || error("XPTY0004") ) ); } /** * Test fn:min on a sequence of xs:duration arguments. */ @org.junit.Test public void fnMin9() { final XQuery query = new XQuery( "min(xs:duration(\"P1Y1M1D\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FORG0006") || error("XPTY0004") ) ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:double(lower bound) . */ @org.junit.Test public void fnMindbl1args1() { final XQuery query = new XQuery( "fn:min((xs:double(\"-1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.7976931348623157E308") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:double(mid range) . */ @org.junit.Test public void fnMindbl1args2() { final XQuery query = new XQuery( "fn:min((xs:double(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:double(upper bound) . */ @org.junit.Test public void fnMindbl1args3() { final XQuery query = new XQuery( "fn:min((xs:double(\"1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.7976931348623157E308") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void fnMindbl2args1() { final XQuery query = new XQuery( "fn:min((xs:double(\"-1.7976931348623157E308\"),xs:double(\"-1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.7976931348623157E308") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:double(mid range) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void fnMindbl2args2() { final XQuery query = new XQuery( "fn:min((xs:double(\"0\"),xs:double(\"-1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.7976931348623157E308") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:double(upper bound) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void fnMindbl2args3() { final XQuery query = new XQuery( "fn:min((xs:double(\"1.7976931348623157E308\"),xs:double(\"-1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.7976931348623157E308") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(mid range) . */ @org.junit.Test public void fnMindbl2args4() { final XQuery query = new XQuery( "fn:min((xs:double(\"-1.7976931348623157E308\"),xs:double(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.7976931348623157E308") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(upper bound) . */ @org.junit.Test public void fnMindbl2args5() { final XQuery query = new XQuery( "fn:min((xs:double(\"-1.7976931348623157E308\"),xs:double(\"1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.7976931348623157E308") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:decimal(lower bound) . */ @org.junit.Test public void fnMindec1args1() { final XQuery query = new XQuery( "fn:min((xs:decimal(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:decimal(mid range) . */ @org.junit.Test public void fnMindec1args2() { final XQuery query = new XQuery( "fn:min((xs:decimal(\"617375191608514839\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("617375191608514839") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:decimal(upper bound) . */ @org.junit.Test public void fnMindec1args3() { final XQuery query = new XQuery( "fn:min((xs:decimal(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void fnMindec2args1() { final XQuery query = new XQuery( "fn:min((xs:decimal(\"-999999999999999999\"),xs:decimal(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:decimal(mid range) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void fnMindec2args2() { final XQuery query = new XQuery( "fn:min((xs:decimal(\"617375191608514839\"),xs:decimal(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:decimal(upper bound) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void fnMindec2args3() { final XQuery query = new XQuery( "fn:min((xs:decimal(\"999999999999999999\"),xs:decimal(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(mid range) . */ @org.junit.Test public void fnMindec2args4() { final XQuery query = new XQuery( "fn:min((xs:decimal(\"-999999999999999999\"),xs:decimal(\"617375191608514839\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(upper bound) . */ @org.junit.Test public void fnMindec2args5() { final XQuery query = new XQuery( "fn:min((xs:decimal(\"-999999999999999999\"),xs:decimal(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:float(lower bound) . */ @org.junit.Test public void fnMinflt1args1() { final XQuery query = new XQuery( "fn:min((xs:float(\"-3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(\"-3.4028235E38\")") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:float(mid range) . */ @org.junit.Test public void fnMinflt1args2() { final XQuery query = new XQuery( "fn:min((xs:float(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:float(upper bound) . */ @org.junit.Test public void fnMinflt1args3() { final XQuery query = new XQuery( "fn:min((xs:float(\"3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(\"3.4028235E38\")") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void fnMinflt2args1() { final XQuery query = new XQuery( "fn:min((xs:float(\"-3.4028235E38\"),xs:float(\"-3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(\"-3.4028235E38\")") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:float(mid range) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void fnMinflt2args2() { final XQuery query = new XQuery( "fn:min((xs:float(\"0\"),xs:float(\"-3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(\"-3.4028235E38\")") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:float(upper bound) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void fnMinflt2args3() { final XQuery query = new XQuery( "fn:min((xs:float(\"3.4028235E38\"),xs:float(\"-3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(\"-3.4028235E38\")") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(mid range) . */ @org.junit.Test public void fnMinflt2args4() { final XQuery query = new XQuery( "fn:min((xs:float(\"-3.4028235E38\"),xs:float(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(\"-3.4028235E38\")") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(upper bound) . */ @org.junit.Test public void fnMinflt2args5() { final XQuery query = new XQuery( "fn:min((xs:float(\"-3.4028235E38\"),xs:float(\"3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(\"-3.4028235E38\")") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:int(lower bound) . */ @org.junit.Test public void fnMinint1args1() { final XQuery query = new XQuery( "fn:min((xs:int(\"-2147483648\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2147483648") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:int(mid range) . */ @org.junit.Test public void fnMinint1args2() { final XQuery query = new XQuery( "fn:min((xs:int(\"-1873914410\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1873914410") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:int(upper bound) . */ @org.junit.Test public void fnMinint1args3() { final XQuery query = new XQuery( "fn:min((xs:int(\"2147483647\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2147483647") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void fnMinint2args1() { final XQuery query = new XQuery( "fn:min((xs:int(\"-2147483648\"),xs:int(\"-2147483648\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2147483648") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:int(mid range) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void fnMinint2args2() { final XQuery query = new XQuery( "fn:min((xs:int(\"-1873914410\"),xs:int(\"-2147483648\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2147483648") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:int(upper bound) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void fnMinint2args3() { final XQuery query = new XQuery( "fn:min((xs:int(\"2147483647\"),xs:int(\"-2147483648\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2147483648") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(mid range) . */ @org.junit.Test public void fnMinint2args4() { final XQuery query = new XQuery( "fn:min((xs:int(\"-2147483648\"),xs:int(\"-1873914410\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2147483648") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(upper bound) . */ @org.junit.Test public void fnMinint2args5() { final XQuery query = new XQuery( "fn:min((xs:int(\"-2147483648\"),xs:int(\"2147483647\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2147483648") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:integer(lower bound) . */ @org.junit.Test public void fnMinintg1args1() { final XQuery query = new XQuery( "fn:min((xs:integer(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:integer(mid range) . */ @org.junit.Test public void fnMinintg1args2() { final XQuery query = new XQuery( "fn:min((xs:integer(\"830993497117024304\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("830993497117024304") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:integer(upper bound) . */ @org.junit.Test public void fnMinintg1args3() { final XQuery query = new XQuery( "fn:min((xs:integer(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void fnMinintg2args1() { final XQuery query = new XQuery( "fn:min((xs:integer(\"-999999999999999999\"),xs:integer(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:integer(mid range) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void fnMinintg2args2() { final XQuery query = new XQuery( "fn:min((xs:integer(\"830993497117024304\"),xs:integer(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:integer(upper bound) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void fnMinintg2args3() { final XQuery query = new XQuery( "fn:min((xs:integer(\"999999999999999999\"),xs:integer(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(mid range) . */ @org.junit.Test public void fnMinintg2args4() { final XQuery query = new XQuery( "fn:min((xs:integer(\"-999999999999999999\"),xs:integer(\"830993497117024304\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(upper bound) . */ @org.junit.Test public void fnMinintg2args5() { final XQuery query = new XQuery( "fn:min((xs:integer(\"-999999999999999999\"),xs:integer(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:long(lower bound) . */ @org.junit.Test public void fnMinlng1args1() { final XQuery query = new XQuery( "fn:min((xs:long(\"-92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:long(mid range) . */ @org.junit.Test public void fnMinlng1args2() { final XQuery query = new XQuery( "fn:min((xs:long(\"-47175562203048468\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-47175562203048468") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:long(upper bound) . */ @org.junit.Test public void fnMinlng1args3() { final XQuery query = new XQuery( "fn:min((xs:long(\"92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("92233720368547758") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void fnMinlng2args1() { final XQuery query = new XQuery( "fn:min((xs:long(\"-92233720368547758\"),xs:long(\"-92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:long(mid range) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void fnMinlng2args2() { final XQuery query = new XQuery( "fn:min((xs:long(\"-47175562203048468\"),xs:long(\"-92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:long(upper bound) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void fnMinlng2args3() { final XQuery query = new XQuery( "fn:min((xs:long(\"92233720368547758\"),xs:long(\"-92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(mid range) . */ @org.junit.Test public void fnMinlng2args4() { final XQuery query = new XQuery( "fn:min((xs:long(\"-92233720368547758\"),xs:long(\"-47175562203048468\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(upper bound) . */ @org.junit.Test public void fnMinlng2args5() { final XQuery query = new XQuery( "fn:min((xs:long(\"-92233720368547758\"),xs:long(\"92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnMinnint1args1() { final XQuery query = new XQuery( "fn:min((xs:negativeInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnMinnint1args2() { final XQuery query = new XQuery( "fn:min((xs:negativeInteger(\"-297014075999096793\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-297014075999096793") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnMinnint1args3() { final XQuery query = new XQuery( "fn:min((xs:negativeInteger(\"-1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnMinnint2args1() { final XQuery query = new XQuery( "fn:min((xs:negativeInteger(\"-999999999999999999\"),xs:negativeInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:negativeInteger(mid range) $arg2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnMinnint2args2() { final XQuery query = new XQuery( "fn:min((xs:negativeInteger(\"-297014075999096793\"),xs:negativeInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:negativeInteger(upper bound) $arg2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnMinnint2args3() { final XQuery query = new XQuery( "fn:min((xs:negativeInteger(\"-1\"),xs:negativeInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnMinnint2args4() { final XQuery query = new XQuery( "fn:min((xs:negativeInteger(\"-999999999999999999\"),xs:negativeInteger(\"-297014075999096793\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnMinnint2args5() { final XQuery query = new XQuery( "fn:min((xs:negativeInteger(\"-999999999999999999\"),xs:negativeInteger(\"-1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnMinnni1args1() { final XQuery query = new XQuery( "fn:min((xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnMinnni1args2() { final XQuery query = new XQuery( "fn:min((xs:nonNegativeInteger(\"303884545991464527\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("303884545991464527") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnMinnni1args3() { final XQuery query = new XQuery( "fn:min((xs:nonNegativeInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnMinnni2args1() { final XQuery query = new XQuery( "fn:min((xs:nonNegativeInteger(\"0\"),xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:nonNegativeInteger(mid range) $arg2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnMinnni2args2() { final XQuery query = new XQuery( "fn:min((xs:nonNegativeInteger(\"303884545991464527\"),xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:nonNegativeInteger(upper bound) $arg2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnMinnni2args3() { final XQuery query = new XQuery( "fn:min((xs:nonNegativeInteger(\"999999999999999999\"),xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnMinnni2args4() { final XQuery query = new XQuery( "fn:min((xs:nonNegativeInteger(\"0\"),xs:nonNegativeInteger(\"303884545991464527\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnMinnni2args5() { final XQuery query = new XQuery( "fn:min((xs:nonNegativeInteger(\"0\"),xs:nonNegativeInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnMinnpi1args1() { final XQuery query = new XQuery( "fn:min((xs:nonPositiveInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnMinnpi1args2() { final XQuery query = new XQuery( "fn:min((xs:nonPositiveInteger(\"-475688437271870490\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-475688437271870490") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnMinnpi1args3() { final XQuery query = new XQuery( "fn:min((xs:nonPositiveInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnMinnpi2args1() { final XQuery query = new XQuery( "fn:min((xs:nonPositiveInteger(\"-999999999999999999\"),xs:nonPositiveInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:nonPositiveInteger(mid range) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnMinnpi2args2() { final XQuery query = new XQuery( "fn:min((xs:nonPositiveInteger(\"-475688437271870490\"),xs:nonPositiveInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:nonPositiveInteger(upper bound) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnMinnpi2args3() { final XQuery query = new XQuery( "fn:min((xs:nonPositiveInteger(\"0\"),xs:nonPositiveInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnMinnpi2args4() { final XQuery query = new XQuery( "fn:min((xs:nonPositiveInteger(\"-999999999999999999\"),xs:nonPositiveInteger(\"-475688437271870490\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnMinnpi2args5() { final XQuery query = new XQuery( "fn:min((xs:nonPositiveInteger(\"-999999999999999999\"),xs:nonPositiveInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnMinpint1args1() { final XQuery query = new XQuery( "fn:min((xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnMinpint1args2() { final XQuery query = new XQuery( "fn:min((xs:positiveInteger(\"52704602390610033\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("52704602390610033") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnMinpint1args3() { final XQuery query = new XQuery( "fn:min((xs:positiveInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnMinpint2args1() { final XQuery query = new XQuery( "fn:min((xs:positiveInteger(\"1\"),xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:positiveInteger(mid range) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnMinpint2args2() { final XQuery query = new XQuery( "fn:min((xs:positiveInteger(\"52704602390610033\"),xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:positiveInteger(upper bound) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnMinpint2args3() { final XQuery query = new XQuery( "fn:min((xs:positiveInteger(\"999999999999999999\"),xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnMinpint2args4() { final XQuery query = new XQuery( "fn:min((xs:positiveInteger(\"1\"),xs:positiveInteger(\"52704602390610033\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnMinpint2args5() { final XQuery query = new XQuery( "fn:min((xs:positiveInteger(\"1\"),xs:positiveInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:short(lower bound) . */ @org.junit.Test public void fnMinsht1args1() { final XQuery query = new XQuery( "fn:min((xs:short(\"-32768\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-32768") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:short(mid range) . */ @org.junit.Test public void fnMinsht1args2() { final XQuery query = new XQuery( "fn:min((xs:short(\"-5324\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-5324") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:short(upper bound) . */ @org.junit.Test public void fnMinsht1args3() { final XQuery query = new XQuery( "fn:min((xs:short(\"32767\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("32767") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void fnMinsht2args1() { final XQuery query = new XQuery( "fn:min((xs:short(\"-32768\"),xs:short(\"-32768\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-32768") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:short(mid range) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void fnMinsht2args2() { final XQuery query = new XQuery( "fn:min((xs:short(\"-5324\"),xs:short(\"-32768\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-32768") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:short(upper bound) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void fnMinsht2args3() { final XQuery query = new XQuery( "fn:min((xs:short(\"32767\"),xs:short(\"-32768\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-32768") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(mid range) . */ @org.junit.Test public void fnMinsht2args4() { final XQuery query = new XQuery( "fn:min((xs:short(\"-32768\"),xs:short(\"-5324\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-32768") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(upper bound) . */ @org.junit.Test public void fnMinsht2args5() { final XQuery query = new XQuery( "fn:min((xs:short(\"-32768\"),xs:short(\"32767\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-32768") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnMinulng1args1() { final XQuery query = new XQuery( "fn:min((xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnMinulng1args2() { final XQuery query = new XQuery( "fn:min((xs:unsignedLong(\"130747108607674654\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("130747108607674654") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnMinulng1args3() { final XQuery query = new XQuery( "fn:min((xs:unsignedLong(\"184467440737095516\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("184467440737095516") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnMinulng2args1() { final XQuery query = new XQuery( "fn:min((xs:unsignedLong(\"0\"),xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:unsignedLong(mid range) $arg2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnMinulng2args2() { final XQuery query = new XQuery( "fn:min((xs:unsignedLong(\"130747108607674654\"),xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:unsignedLong(upper bound) $arg2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnMinulng2args3() { final XQuery query = new XQuery( "fn:min((xs:unsignedLong(\"184467440737095516\"),xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnMinulng2args4() { final XQuery query = new XQuery( "fn:min((xs:unsignedLong(\"0\"),xs:unsignedLong(\"130747108607674654\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnMinulng2args5() { final XQuery query = new XQuery( "fn:min((xs:unsignedLong(\"0\"),xs:unsignedLong(\"184467440737095516\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnMinusht1args1() { final XQuery query = new XQuery( "fn:min((xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnMinusht1args2() { final XQuery query = new XQuery( "fn:min((xs:unsignedShort(\"44633\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("44633") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnMinusht1args3() { final XQuery query = new XQuery( "fn:min((xs:unsignedShort(\"65535\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("65535") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnMinusht2args1() { final XQuery query = new XQuery( "fn:min((xs:unsignedShort(\"0\"),xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:unsignedShort(mid range) $arg2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnMinusht2args2() { final XQuery query = new XQuery( "fn:min((xs:unsignedShort(\"44633\"),xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:unsignedShort(upper bound) $arg2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnMinusht2args3() { final XQuery query = new XQuery( "fn:min((xs:unsignedShort(\"65535\"),xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnMinusht2args4() { final XQuery query = new XQuery( "fn:min((xs:unsignedShort(\"0\"),xs:unsignedShort(\"44633\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "min" function with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnMinusht2args5() { final XQuery query = new XQuery( "fn:min((xs:unsignedShort(\"0\"),xs:unsignedShort(\"65535\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnMinutesFromDateTime.java000066400000000000000000000350431222453003200311250ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the minutes-from-dateTime() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnMinutesFromDateTime extends QT3TestSet { /** * A test whose essence is: `minutes-from-dateTime()`. . */ @org.junit.Test public void kMinutesFromDateTimeFunc1() { final XQuery query = new XQuery( "minutes-from-dateTime()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `minutes-from-dateTime((), "Wrong param")`. . */ @org.junit.Test public void kMinutesFromDateTimeFunc2() { final XQuery query = new XQuery( "minutes-from-dateTime((), \"Wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(minutes-from-dateTime(()))`. . */ @org.junit.Test public void kMinutesFromDateTimeFunc3() { final XQuery query = new XQuery( "empty(minutes-from-dateTime(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `minutes-from-dateTime(()) instance of xs:integer?`. . */ @org.junit.Test public void kMinutesFromDateTimeFunc4() { final XQuery query = new XQuery( "minutes-from-dateTime(()) instance of xs:integer?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `minutes-from-dateTime(xs:dateTime("2001-02-03T08:23:12.43")) eq 23`. . */ @org.junit.Test public void kMinutesFromDateTimeFunc5() { final XQuery query = new XQuery( "minutes-from-dateTime(xs:dateTime(\"2001-02-03T08:23:12.43\")) eq 23", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "minutes-from-dateTime" function As per example 1 of the F&O specs . */ @org.junit.Test public void fnMinutesFromDateTime1() { final XQuery query = new XQuery( "fn:minutes-from-dateTime(xs:dateTime(\"1999-05-31T13:20:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "20") ); } /** * Evaluates The "minutes-from-dateTime" function as part of a "*" expression. . */ @org.junit.Test public void fnMinutesFromDateTime10() { final XQuery query = new XQuery( "fn:minutes-from-dateTime(xs:dateTime(\"1970-01-01T02:02:00Z\")) * fn:minutes-from-dateTime(xs:dateTime(\"1970-01-01T10:03:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "6") ); } /** * Evaluates The "minutes-from-dateTime" function as part of a "div" expression. . */ @org.junit.Test public void fnMinutesFromDateTime11() { final XQuery query = new XQuery( "fn:minutes-from-dateTime(xs:dateTime(\"1970-01-01T02:10:00Z\")) div fn:minutes-from-dateTime(xs:dateTime(\"1970-01-01T10:05:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Evaluates The "minutes-from-dateTime" function as part of a "idiv" expression. . */ @org.junit.Test public void fnMinutesFromDateTime12() { final XQuery query = new XQuery( "fn:minutes-from-dateTime(xs:dateTime(\"1970-01-01T10:10:00Z\")) idiv fn:minutes-from-dateTime(xs:dateTime(\"1970-01-01T02:05:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Evaluates The "minutes-from-dateTime" function as part of a "mod" expression. . */ @org.junit.Test public void fnMinutesFromDateTime13() { final XQuery query = new XQuery( "fn:minutes-from-dateTime(xs:dateTime(\"1970-01-01T10:10:00Z\")) mod fn:minutes-from-dateTime(xs:dateTime(\"1970-01-01T03:10:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "minutes-from-dateTime" function as part of a "numeric-unary-plus" expression. . */ @org.junit.Test public void fnMinutesFromDateTime14() { final XQuery query = new XQuery( "+fn:minutes-from-dateTime(xs:dateTime(\"1970-01-01T10:10:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10") ); } /** * Evaluates The "minutes-from-dateTime" function as part of a "numeric-unary-minus" expression. . */ @org.junit.Test public void fnMinutesFromDateTime15() { final XQuery query = new XQuery( "-fn:minutes-from-dateTime(xs:dateTime(\"1970-01-01T10:10:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-10") ); } /** * Evaluates The "minutes-from-dateTime" function as part of a "numeric-equal" expression (eq operator) . */ @org.junit.Test public void fnMinutesFromDateTime16() { final XQuery query = new XQuery( "fn:minutes-from-dateTime(xs:dateTime(\"1970-01-01T10:10:00Z\")) eq fn:minutes-from-dateTime(xs:dateTime(\"1970-01-01T10:10:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "minutes-from-dateTime" function as part of a "numeric-equal" expression (ne operator) . */ @org.junit.Test public void fnMinutesFromDateTime17() { final XQuery query = new XQuery( "fn:minutes-from-dateTime(xs:dateTime(\"1970-01-01T10:10:00Z\")) ne fn:minutes-from-dateTime(xs:dateTime(\"1970-01-01T10:10:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "minutes-from-dateTime" function as part of a "numeric-equal" expression (le operator) . */ @org.junit.Test public void fnMinutesFromDateTime18() { final XQuery query = new XQuery( "fn:minutes-from-dateTime(xs:dateTime(\"1970-01-01T10:10:00Z\")) le fn:minutes-from-dateTime(xs:dateTime(\"1970-01-01T10:10:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "minutes-from-dateTime" function as part of a "numeric-equal" expression (ge operator) . */ @org.junit.Test public void fnMinutesFromDateTime19() { final XQuery query = new XQuery( "fn:minutes-from-dateTime(xs:dateTime(\"1970-01-01T10:10:00Z\")) ge fn:minutes-from-dateTime(xs:dateTime(\"1970-01-01T10:10:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "minutes-from-dateTime" function As per example 2 of the F&O specs . */ @org.junit.Test public void fnMinutesFromDateTime2() { final XQuery query = new XQuery( "fn:minutes-from-dateTime(xs:dateTime(\"1999-05-31T13:30:00+05:30\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "30") ); } /** * Evaluates The "minutes-from-dateTime" function involving a "numeric-less-than" operation (lt operator) . */ @org.junit.Test public void fnMinutesFromDateTime3() { final XQuery query = new XQuery( "fn:minutes-from-dateTime(xs:dateTime(\"1999-12-31T21:20:00-05:00\")) lt fn:minutes-from-dateTime(xs:dateTime(\"1999-12-31T21:20:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "minutes-from-dateTime" function involving a "numeric-less-than" operation (le operator) . */ @org.junit.Test public void fnMinutesFromDateTime4() { final XQuery query = new XQuery( "fn:minutes-from-dateTime(xs:dateTime(\"1999-12-31T21:20:00-05:00\")) le fn:minutes-from-dateTime(xs:dateTime(\"1999-12-31T21:20:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "minutes-from-dateTime" function using the empty sequence as an argument. Use count function to avoid empty file. . */ @org.junit.Test public void fnMinutesFromDateTime5() { final XQuery query = new XQuery( "fn:count(fn:minutes-from-dateTime(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "minutes-from-dateTime" function that returns 0. . */ @org.junit.Test public void fnMinutesFromDateTime6() { final XQuery query = new XQuery( "fn:minutes-from-dateTime(xs:dateTime(\"1999-05-31T20:00:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "minutes-from-dateTime" function that returns 59. . */ @org.junit.Test public void fnMinutesFromDateTime7() { final XQuery query = new XQuery( "fn:minutes-from-dateTime(xs:dateTime(\"1999-05-31T23:59:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "59") ); } /** * Evaluates The "minutes-from-dateTime" function as part of a "+" expression. . */ @org.junit.Test public void fnMinutesFromDateTime8() { final XQuery query = new XQuery( "fn:minutes-from-dateTime(xs:dateTime(\"1970-01-01T00:00:00Z\")) + fn:minutes-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "minutes-from-dateTime" function as part of a "-" expression. . */ @org.junit.Test public void fnMinutesFromDateTime9() { final XQuery query = new XQuery( "fn:minutes-from-dateTime(xs:dateTime(\"1970-01-01T00:00:00Z\")) - fn:minutes-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "minutes-from-dateTime" function with the arguments set as follows: $arg = xs:dateTime(lower bound) . */ @org.junit.Test public void fnMinutesFromDateTime1args1() { final XQuery query = new XQuery( "fn:minutes-from-dateTime(xs:dateTime(\"1970-01-01T00:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "minutes-from-dateTime" function with the arguments set as follows: $arg = xs:dateTime(mid range) . */ @org.junit.Test public void fnMinutesFromDateTime1args2() { final XQuery query = new XQuery( "fn:minutes-from-dateTime(xs:dateTime(\"1996-04-07T01:40:52Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "40") ); } /** * Evaluates The "minutes-from-dateTime" function with the arguments set as follows: $arg = xs:dateTime(upper bound) . */ @org.junit.Test public void fnMinutesFromDateTime1args3() { final XQuery query = new XQuery( "fn:minutes-from-dateTime(xs:dateTime(\"2030-12-31T23:59:59Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "59") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnMinutesFromDuration.java000066400000000000000000000417641222453003200312250ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the minutes-from-duration() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnMinutesFromDuration extends QT3TestSet { /** * A test whose essence is: `minutes-from-duration()`. . */ @org.junit.Test public void kMinutesFromDurationFunc1() { final XQuery query = new XQuery( "minutes-from-duration()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `minutes-from-duration((), "Wrong param")`. . */ @org.junit.Test public void kMinutesFromDurationFunc2() { final XQuery query = new XQuery( "minutes-from-duration((), \"Wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(minutes-from-duration(()))`. . */ @org.junit.Test public void kMinutesFromDurationFunc3() { final XQuery query = new XQuery( "empty(minutes-from-duration(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `minutes-from-duration(()) instance of xs:integer?`. . */ @org.junit.Test public void kMinutesFromDurationFunc4() { final XQuery query = new XQuery( "minutes-from-duration(()) instance of xs:integer?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `minutes-from-duration(xs:dayTimeDuration("P3DT8H2M1.03S")) eq 2`. . */ @org.junit.Test public void kMinutesFromDurationFunc5() { final XQuery query = new XQuery( "minutes-from-duration(xs:dayTimeDuration(\"P3DT8H2M1.03S\")) eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test invoking minutes-from-duration() on a negative duration. . */ @org.junit.Test public void kMinutesFromDurationFunc6() { final XQuery query = new XQuery( "minutes-from-duration(xs:dayTimeDuration(\"-P3DT8H2M1.03S\")) eq -2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test invoking minutes-from-hours() on an negative xs:duration. . */ @org.junit.Test public void kMinutesFromDurationFunc7() { final XQuery query = new XQuery( "minutes-from-duration(xs:duration(\"-P3Y4M8DT1H23M2.34S\")) eq -23", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:minutes-from-duration on xs:dayTimeDuration . */ @org.junit.Test public void cbclMinutesFromDuration001() { final XQuery query = new XQuery( "fn:minutes-from-duration(xs:yearMonthDuration('P1Y'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "minutes-from-duration" function As per example 1 (for this function)of the F&O specs . */ @org.junit.Test public void fnMinutesFromDuration1() { final XQuery query = new XQuery( "fn:minutes-from-duration(xs:dayTimeDuration(\"P3DT10H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "minutes-from-duration" function as part of a "*" expression. . */ @org.junit.Test public void fnMinutesFromDuration10() { final XQuery query = new XQuery( "fn:minutes-from-duration(xs:dayTimeDuration(\"P20DT09H04M\")) * fn:minutes-from-duration(xs:dayTimeDuration(\"P03DT10H10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "40") ); } /** * Evaluates The "minutes-from-duration" function as part of a "div" expression. . */ @org.junit.Test public void fnMinutesFromDuration11() { final XQuery query = new XQuery( "fn:minutes-from-duration(xs:dayTimeDuration(\"P20DT10H10M\")) div fn:minutes-from-duration(xs:dayTimeDuration(\"P05DT05H02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5") ); } /** * Evaluates The "minutes-from-duration" function as part of a "idiv" expression. . */ @org.junit.Test public void fnMinutesFromDuration12() { final XQuery query = new XQuery( "fn:minutes-from-duration(xs:dayTimeDuration(\"P25DT10H20M\")) idiv fn:minutes-from-duration(xs:dayTimeDuration(\"P05DT02H04M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5") ); } /** * Evaluates The "minutes-from-duration" function as part of a "mod" expression. . */ @org.junit.Test public void fnMinutesFromDuration13() { final XQuery query = new XQuery( "fn:minutes-from-duration(xs:dayTimeDuration(\"P10DT10H20M\")) mod fn:minutes-from-duration(xs:dayTimeDuration(\"P03DT03H03M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Evaluates The "minutes-from-duration" function as part of a "numeric-unary-plus" expression. . */ @org.junit.Test public void fnMinutesFromDuration14() { final XQuery query = new XQuery( "+fn:minutes-from-duration(xs:dayTimeDuration(\"P21DT10H10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10") ); } /** * Evaluates The "minutes-from-duration" function as part of a "numeric-unary-minus" expression. . */ @org.junit.Test public void fnMinutesFromDuration15() { final XQuery query = new XQuery( "-fn:minutes-from-duration(xs:dayTimeDuration(\"P20DT03H20M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-20") ); } /** * Evaluates The "minutes-from-duration" function as part of a "numeric-equal" expression (eq operator) . */ @org.junit.Test public void fnMinutesFromDuration16() { final XQuery query = new XQuery( "fn:minutes-from-duration(xs:dayTimeDuration(\"P22DT10H10M\")) eq fn:minutes-from-duration(xs:dayTimeDuration(\"P22DT09H10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "minutes-from-duration" function as part of a "numeric-equal" expression (ne operator) . */ @org.junit.Test public void fnMinutesFromDuration17() { final XQuery query = new XQuery( "fn:minutes-from-duration(xs:dayTimeDuration(\"P23DT08H20M\")) ne fn:minutes-from-duration(xs:dayTimeDuration(\"P12DT05H22M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "minutes-from-duration" function as part of a "numeric-equal" expression (le operator) . */ @org.junit.Test public void fnMinutesFromDuration18() { final XQuery query = new XQuery( "fn:minutes-from-duration(xs:dayTimeDuration(\"P20DT03H09M\")) le fn:minutes-from-duration(xs:dayTimeDuration(\"P21DT15H21M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "minutes-from-duration" function as part of a "numeric-equal" expression (ge operator) . */ @org.junit.Test public void fnMinutesFromDuration19() { final XQuery query = new XQuery( "fn:minutes-from-duration(xs:dayTimeDuration(\"P21DT07H12M\")) ge fn:minutes-from-duration(xs:dayTimeDuration(\"P20DT01H13M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "minutes-from-duration" function As per example 2 (for this function) of the F&O specs . */ @org.junit.Test public void fnMinutesFromDuration2() { final XQuery query = new XQuery( "fn:minutes-from-duration(xs:dayTimeDuration(\"-P5DT12H30M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-30") ); } /** * Evaluates The "minutes-from-duration" function with wrong argument type. . */ @org.junit.Test public void fnMinutesFromDuration20() { final XQuery query = new XQuery( "fn:minutes-from-duration(xs:duration(\"P1Y2M3DT10H30M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "30") ); } /** * Evaluates The "minutes-from-duration" function to evaluate normalization of duration. . */ @org.junit.Test public void fnMinutesFromDuration21() { final XQuery query = new XQuery( "fn:minutes-from-duration(xs:dayTimeDuration(\"P21DT10H65M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5") ); } /** * Evaluates The "minutes-from-duration" function involving a "numeric-less-than" operation (lt operator) . */ @org.junit.Test public void fnMinutesFromDuration3() { final XQuery query = new XQuery( "fn:minutes-from-duration(xs:dayTimeDuration(\"P20DT20H20M\")) lt fn:minutes-from-duration(xs:dayTimeDuration(\"P03DT02H10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "minutes-from-duration" function involving a "numeric-less-than" operation (le operator) . */ @org.junit.Test public void fnMinutesFromDuration4() { final XQuery query = new XQuery( "fn:minutes-from-duration(xs:dayTimeDuration(\"P21DT10H10M\")) le fn:minutes-from-duration(xs:dayTimeDuration(\"P22DT10H09M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "minutes-from-duration" function using the empty sequence as an argument. Use count function to avoid empty file. . */ @org.junit.Test public void fnMinutesFromDuration5() { final XQuery query = new XQuery( "fn:count(fn:minutes-from-duration(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "minutes-from-duration" function that returns 1. . */ @org.junit.Test public void fnMinutesFromDuration6() { final XQuery query = new XQuery( "fn:minutes-from-duration(xs:dayTimeDuration(\"P01DT01H01M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "minutes-from-duration" function used as arguments to an avg function. . */ @org.junit.Test public void fnMinutesFromDuration7() { final XQuery query = new XQuery( "fn:avg((fn:minutes-from-duration(xs:dayTimeDuration(\"P23DT10H20M\")),fn:minutes-from-duration(xs:dayTimeDuration(\"P21DT10H10M\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "15") ); } /** * Evaluates The "minutes-from-duration" function as part of a "+" expression. . */ @org.junit.Test public void fnMinutesFromDuration8() { final XQuery query = new XQuery( "fn:minutes-from-duration(xs:dayTimeDuration(\"P21DT10H10M\")) + fn:minutes-from-duration(xs:dayTimeDuration(\"P22DT11H30M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "40") ); } /** * Evaluates The "minutes-from-duration" function as part of a "-" expression. . */ @org.junit.Test public void fnMinutesFromDuration9() { final XQuery query = new XQuery( "fn:minutes-from-duration(xs:dayTimeDuration(\"P30DT10H20M\")) - fn:minutes-from-duration(xs:dayTimeDuration(\"P10DT09H10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10") ); } /** * Evaluates The "minutes-from-duration" function with the arguments set as follows: $arg = xs:dayTimeDuration(lower bound) . */ @org.junit.Test public void fnMinutesFromDuration1args1() { final XQuery query = new XQuery( "fn:minutes-from-duration(xs:dayTimeDuration(\"P0DT0H0M0S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "minutes-from-duration" function with the arguments set as follows: $arg = xs:dayTimeDuration(mid range) . */ @org.junit.Test public void fnMinutesFromDuration1args2() { final XQuery query = new XQuery( "fn:minutes-from-duration(xs:dayTimeDuration(\"P15DT11H59M59S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "59") ); } /** * Evaluates The "minutes-from-duration" function with the arguments set as follows: $arg = xs:dayTimeDuration(upper bound) . */ @org.junit.Test public void fnMinutesFromDuration1args3() { final XQuery query = new XQuery( "fn:minutes-from-duration(xs:dayTimeDuration(\"P31DT23H59M59S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "59") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnMinutesFromTime.java000066400000000000000000000333221222453003200303250ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the minutes-from-time() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnMinutesFromTime extends QT3TestSet { /** * A test whose essence is: `minutes-from-time()`. . */ @org.junit.Test public void kMinutesFromTimeFunc1() { final XQuery query = new XQuery( "minutes-from-time()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `minutes-from-time((), "Wrong param")`. . */ @org.junit.Test public void kMinutesFromTimeFunc2() { final XQuery query = new XQuery( "minutes-from-time((), \"Wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(minutes-from-time(()))`. . */ @org.junit.Test public void kMinutesFromTimeFunc3() { final XQuery query = new XQuery( "empty(minutes-from-time(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `minutes-from-time(()) instance of xs:integer?`. . */ @org.junit.Test public void kMinutesFromTimeFunc4() { final XQuery query = new XQuery( "minutes-from-time(()) instance of xs:integer?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `minutes-from-time(xs:time("23:11:12.43")) eq 11`. . */ @org.junit.Test public void kMinutesFromTimeFunc5() { final XQuery query = new XQuery( "minutes-from-time(xs:time(\"23:11:12.43\")) eq 11", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "minutes-from-time" function As per example 1 of the F&O specs (for this function) . */ @org.junit.Test public void fnMinutesFromTime1() { final XQuery query = new XQuery( "fn:minutes-from-time(xs:time(\"13:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "minutes-from-time" function as part of a "*" expression. . */ @org.junit.Test public void fnMinutesFromTime10() { final XQuery query = new XQuery( "fn:minutes-from-time(xs:time(\"02:02:00Z\")) * fn:minutes-from-time(xs:time(\"10:08:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "16") ); } /** * Evaluates The "minutes-from-time" function as part of a "div" expression. . */ @org.junit.Test public void fnMinutesFromTime11() { final XQuery query = new XQuery( "fn:minutes-from-time(xs:time(\"22:33:00Z\")) div fn:minutes-from-time(xs:time(\"02:11:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Evaluates The "minutes-from-time" function as part of a "idiv" expression. . */ @org.junit.Test public void fnMinutesFromTime12() { final XQuery query = new XQuery( "fn:minutes-from-time(xs:time(\"10:12:00Z\")) idiv fn:minutes-from-time(xs:time(\"02:02:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "6") ); } /** * Evaluates The "minutes-from-time" function as part of a "mod" expression. . */ @org.junit.Test public void fnMinutesFromTime13() { final XQuery query = new XQuery( "fn:minutes-from-time(xs:time(\"10:10:00Z\")) mod fn:minutes-from-time(xs:time(\"03:03:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "minutes-from-time" function as part of a "numeric-unary-plus" expression. . */ @org.junit.Test public void fnMinutesFromTime14() { final XQuery query = new XQuery( "+fn:minutes-from-time(xs:time(\"10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "minutes-from-time" function as part of a "numeric-unary-minus" expression. . */ @org.junit.Test public void fnMinutesFromTime15() { final XQuery query = new XQuery( "-fn:minutes-from-time(xs:time(\"10:10:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-10") ); } /** * Evaluates The "minutes-from-time" function as part of a "numeric-equal" expression (eq operator) . */ @org.junit.Test public void fnMinutesFromTime16() { final XQuery query = new XQuery( "fn:minutes-from-time(xs:time(\"10:02:00Z\")) eq fn:minutes-from-time(xs:time(\"10:02:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "minutes-from-time" function as part of a "numeric-equal" expression (ne operator) . */ @org.junit.Test public void fnMinutesFromTime17() { final XQuery query = new XQuery( "fn:minutes-from-time(xs:time(\"10:00:00Z\")) ne fn:minutes-from-time(xs:time(\"01:01:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "minutes-from-time" function as part of a "numeric-equal" expression (le operator) . */ @org.junit.Test public void fnMinutesFromTime18() { final XQuery query = new XQuery( "fn:minutes-from-time(xs:time(\"10:00:00Z\")) le fn:minutes-from-time(xs:time(\"10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "minutes-from-time" function as part of a "numeric-equal" expression (ge operator) . */ @org.junit.Test public void fnMinutesFromTime19() { final XQuery query = new XQuery( "fn:minutes-from-time(xs:time(\"10:03:00Z\")) ge fn:minutes-from-time(xs:time(\"10:04:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "minutes-from-time" function used as part of a numeric less than expression (lt operator) . */ @org.junit.Test public void fnMinutesFromTime2() { final XQuery query = new XQuery( "fn:minutes-from-time(xs:time(\"21:23:00Z\")) lt fn:minutes-from-time(xs:time(\"21:24:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "minutes-from-time" function as part of a numeric greater than operation (gt operator) . */ @org.junit.Test public void fnMinutesFromTime3() { final XQuery query = new XQuery( "fn:minutes-from-time(xs:time(\"01:23:00Z\")) gt fn:minutes-from-time(xs:time(\"01:23:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "minutes-from-time" function used as an argument to an avg function. . */ @org.junit.Test public void fnMinutesFromTime4() { final XQuery query = new XQuery( "fn:avg((fn:minutes-from-time(xs:time(\"01:10:00Z\")), fn:minutes-from-time(xs:time(\"01:20:00Z\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "15") ); } /** * Evaluates The "minutes-from-time" function using the empty sequence as an argument. Use count function to avoid empty file. . */ @org.junit.Test public void fnMinutesFromTime5() { final XQuery query = new XQuery( "fn:count(fn:minutes-from-time(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "hours-from-time" function that returns 59. . */ @org.junit.Test public void fnMinutesFromTime6() { final XQuery query = new XQuery( "fn:hours-from-time(xs:time(\"00:59:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "minutes-from-time" function used as part of an abs function. . */ @org.junit.Test public void fnMinutesFromTime7() { final XQuery query = new XQuery( "fn:abs(fn:minutes-from-time(xs:time(\"23:20:00Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "20") ); } /** * Evaluates The "minutes-from-time" function as part of a "+" expression. . */ @org.junit.Test public void fnMinutesFromTime8() { final XQuery query = new XQuery( "fn:minutes-from-time(xs:time(\"02:00:00Z\")) + fn:minutes-from-time(xs:time(\"10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "minutes-from-time" function as part of a "-" expression. . */ @org.junit.Test public void fnMinutesFromTime9() { final XQuery query = new XQuery( "fn:minutes-from-time(xs:time(\"10:10:00Z\")) - fn:minutes-from-time(xs:time(\"09:02:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "8") ); } /** * Evaluates The "minutes-from-time" function with the arguments set as follows: $arg = xs:time(lower bound) . */ @org.junit.Test public void fnMinutesFromTime1args1() { final XQuery query = new XQuery( "fn:minutes-from-time(xs:time(\"00:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "minutes-from-time" function with the arguments set as follows: $arg = xs:time(mid range) . */ @org.junit.Test public void fnMinutesFromTime1args2() { final XQuery query = new XQuery( "fn:minutes-from-time(xs:time(\"08:03:35Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Evaluates The "minutes-from-time" function with the arguments set as follows: $arg = xs:time(upper bound) . */ @org.junit.Test public void fnMinutesFromTime1args3() { final XQuery query = new XQuery( "fn:minutes-from-time(xs:time(\"23:59:59Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "59") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnMonthFromDate.java000066400000000000000000000327541222453003200277550ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the month-from-date() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnMonthFromDate extends QT3TestSet { /** * A test whose essence is: `month-from-date()`. . */ @org.junit.Test public void kMonthFromDateFunc1() { final XQuery query = new XQuery( "month-from-date()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `month-from-date((), "Wrong param")`. . */ @org.junit.Test public void kMonthFromDateFunc2() { final XQuery query = new XQuery( "month-from-date((), \"Wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(month-from-date(()))`. . */ @org.junit.Test public void kMonthFromDateFunc3() { final XQuery query = new XQuery( "empty(month-from-date(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `month-from-date(()) instance of xs:integer?`. . */ @org.junit.Test public void kMonthFromDateFunc4() { final XQuery query = new XQuery( "month-from-date(()) instance of xs:integer?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `month-from-date(xs:date("2000-02-03")) eq 2`. . */ @org.junit.Test public void kMonthFromDateFunc5() { final XQuery query = new XQuery( "month-from-date(xs:date(\"2000-02-03\")) eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "month-from-date" function As per example 1 of the F&O specs . */ @org.junit.Test public void fnMonthFromDate1() { final XQuery query = new XQuery( "fn:month-from-date(xs:date(\"1999-05-31-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5") ); } /** * Evaluates The "month-from-date" function as part of a "*" expression. . */ @org.junit.Test public void fnMonthFromDate10() { final XQuery query = new XQuery( "fn:month-from-date(xs:date(\"1970-01-01Z\")) * fn:month-from-date(xs:date(\"0002-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "month-from-date" function as part of a "div" expression. . */ @org.junit.Test public void fnMonthFromDate11() { final XQuery query = new XQuery( "fn:month-from-date(xs:date(\"1970-01-01Z\")) div fn:month-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "month-from-date" function as part of a "idiv" expression. . */ @org.junit.Test public void fnMonthFromDate12() { final XQuery query = new XQuery( "fn:month-from-date(xs:date(\"1970-01-01Z\")) idiv fn:month-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "month-from-date" function as part of a "mod" expression. . */ @org.junit.Test public void fnMonthFromDate13() { final XQuery query = new XQuery( "fn:month-from-date(xs:date(\"1970-01-01Z\")) mod fn:month-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "month-from-date" function as part of a "numeric-unary-plus" expression. . */ @org.junit.Test public void fnMonthFromDate14() { final XQuery query = new XQuery( "+fn:month-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "month-from-date" function as part of a "numeric-unary-minus" expression. . */ @org.junit.Test public void fnMonthFromDate15() { final XQuery query = new XQuery( "-fn:month-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1") ); } /** * Evaluates The "month-from-date" function as part of a "numeric-equal" expression (eq operator) . */ @org.junit.Test public void fnMonthFromDate16() { final XQuery query = new XQuery( "fn:month-from-date(xs:date(\"1970-01-01Z\")) eq fn:month-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "month-from-date" function as part of a "numeric-equal" expression (ne operator) . */ @org.junit.Test public void fnMonthFromDate17() { final XQuery query = new XQuery( "fn:month-from-date(xs:date(\"1970-01-01Z\")) ne fn:month-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "month-from-date" function as part of a "numeric-equal" expression (le operator) . */ @org.junit.Test public void fnMonthFromDate18() { final XQuery query = new XQuery( "fn:month-from-date(xs:date(\"1970-01-01Z\")) le fn:month-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "month-from-date" function as part of a "numeric-equal" expression (ge operator) . */ @org.junit.Test public void fnMonthFromDate19() { final XQuery query = new XQuery( "fn:month-from-date(xs:date(\"1970-01-01Z\")) ge fn:month-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "month-from-date" function As per example 2 of the F&O specs . */ @org.junit.Test public void fnMonthFromDate2() { final XQuery query = new XQuery( "fn:month-from-date(xs:date(\"2000-01-01+05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "month-from-date" function involving a "numeric-less-than" operation (lt operator) . */ @org.junit.Test public void fnMonthFromDate3() { final XQuery query = new XQuery( "fn:month-from-date(xs:date(\"1999-12-31Z\")) lt fn:month-from-date(xs:date(\"1999-12-31Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "month-from-date" function involving a "numeric-less-than" operation (le operator) . */ @org.junit.Test public void fnMonthFromDate4() { final XQuery query = new XQuery( "fn:month-from-date(xs:date(\"1999-12-31Z\")) le fn:month-from-date(xs:date(\"1999-12-31Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "month-from-date" function using the empty sequence as an argument. Use count function to avoid empty file. . */ @org.junit.Test public void fnMonthFromDate5() { final XQuery query = new XQuery( "fn:count(fn:month-from-date(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "month-from-date" function that returns 1. . */ @org.junit.Test public void fnMonthFromDate6() { final XQuery query = new XQuery( "fn:month-from-date(xs:date(\"1970-01-31Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "month-from-date" function that returns 12. . */ @org.junit.Test public void fnMonthFromDate7() { final XQuery query = new XQuery( "fn:month-from-date(xs:date(\"1999-12-31Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12") ); } /** * Evaluates The "month-from-date" function as part of a "+" expression. . */ @org.junit.Test public void fnMonthFromDate8() { final XQuery query = new XQuery( "fn:month-from-date(xs:date(\"1970-01-01Z\")) + fn:month-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Evaluates The "month-from-date" function as part of a "-" expression. . */ @org.junit.Test public void fnMonthFromDate9() { final XQuery query = new XQuery( "fn:month-from-date(xs:date(\"1970-01-01Z\")) - fn:month-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "month-from-date" function with the arguments set as follows: $arg = xs:date(lower bound) . */ @org.junit.Test public void fnMonthFromDate1args1() { final XQuery query = new XQuery( "fn:month-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "month-from-date" function with the arguments set as follows: $arg = xs:date(mid range) . */ @org.junit.Test public void fnMonthFromDate1args2() { final XQuery query = new XQuery( "fn:month-from-date(xs:date(\"1983-11-17Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "11") ); } /** * Evaluates The "month-from-date" function with the arguments set as follows: $arg = xs:date(upper bound) . */ @org.junit.Test public void fnMonthFromDate1args3() { final XQuery query = new XQuery( "fn:month-from-date(xs:date(\"2030-12-31Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnMonthFromDateTime.java000066400000000000000000000346121222453003200305670ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the month-from-dateTime() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnMonthFromDateTime extends QT3TestSet { /** * A test whose essence is: `month-from-dateTime()`. . */ @org.junit.Test public void kMonthFromDateTimeFunc1() { final XQuery query = new XQuery( "month-from-dateTime()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `month-from-dateTime((), "Wrong param")`. . */ @org.junit.Test public void kMonthFromDateTimeFunc2() { final XQuery query = new XQuery( "month-from-dateTime((), \"Wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(month-from-dateTime(()))`. . */ @org.junit.Test public void kMonthFromDateTimeFunc3() { final XQuery query = new XQuery( "empty(month-from-dateTime(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `month-from-dateTime(()) instance of xs:integer?`. . */ @org.junit.Test public void kMonthFromDateTimeFunc4() { final XQuery query = new XQuery( "month-from-dateTime(()) instance of xs:integer?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `month-from-dateTime(xs:dateTime("2001-02-03T08:23:12.43")) eq 2`. . */ @org.junit.Test public void kMonthFromDateTimeFunc5() { final XQuery query = new XQuery( "month-from-dateTime(xs:dateTime(\"2001-02-03T08:23:12.43\")) eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "month-from-dateTime" function As per example 1 (of this fucntion) of the F&O specs . */ @org.junit.Test public void fnMonthFromDateTime1() { final XQuery query = new XQuery( "fn:month-from-dateTime(xs:dateTime(\"1999-05-31T13:20:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5") ); } /** * Evaluates The "month-from-dateTime" function as part of a "div" expression. . */ @org.junit.Test public void fnMonthFromDateTime11() { final XQuery query = new XQuery( "fn:month-from-dateTime(xs:dateTime(\"1000-10-01T02:00:00Z\")) div fn:month-from-dateTime(xs:dateTime(\"0050-05-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Evaluates The "month-from-dateTime" function as part of a "idiv" expression. . */ @org.junit.Test public void fnMonthFromDateTime12() { final XQuery query = new XQuery( "fn:month-from-dateTime(xs:dateTime(\"1970-01-12T10:00:00Z\")) idiv fn:month-from-dateTime(xs:dateTime(\"1970-02-01T02:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "month-from-dateTime" function as part of a "mod" expression. . */ @org.junit.Test public void fnMonthFromDateTime13() { final XQuery query = new XQuery( "fn:month-from-dateTime(xs:dateTime(\"1970-10-01T10:00:00Z\")) mod fn:month-from-dateTime(xs:dateTime(\"1970-03-01T03:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "month-from-dateTime" function as part of a "numeric-unary-plus" expression. . */ @org.junit.Test public void fnMonthFromDateTime14() { final XQuery query = new XQuery( "+fn:month-from-dateTime(xs:dateTime(\"1971-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "month-from-dateTime" function as part of a "numeric-unary-minus" expression. . */ @org.junit.Test public void fnMonthFromDateTime15() { final XQuery query = new XQuery( "-fn:month-from-dateTime(xs:dateTime(\"1970-02-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-2") ); } /** * Evaluates The "month-from-dateTime" function as part of a "numeric-equal" expression (eq operator) . */ @org.junit.Test public void fnMonthFromDateTime16() { final XQuery query = new XQuery( "fn:month-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\")) eq fn:month-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "month-from-dateTime" function as part of a "numeric-equal" expression (ne operator) . */ @org.junit.Test public void fnMonthFromDateTime17() { final XQuery query = new XQuery( "fn:month-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\")) ne fn:month-from-dateTime(xs:dateTime(\"1970-02-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "month-from-dateTime" function as part of a "numeric-equal" expression (le operator) . */ @org.junit.Test public void fnMonthFromDateTime18() { final XQuery query = new XQuery( "fn:month-from-dateTime(xs:dateTime(\"1970-02-01T10:00:00Z\")) le fn:month-from-dateTime(xs:dateTime(\"1971-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "month-from-dateTime" function as part of a "numeric-equal" expression (ge operator) . */ @org.junit.Test public void fnMonthFromDateTime19() { final XQuery query = new XQuery( "fn:month-from-dateTime(xs:dateTime(\"1971-01-01T10:00:00Z\")) ge fn:month-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "month-from-dateTime" function As per example 2 (for this function)of the F&O specs . */ @org.junit.Test public void fnMonthFromDateTime2() { final XQuery query = new XQuery( "fn:month-from-dateTime(xs:dateTime(\"1999-12-31T19:20:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12") ); } /** * Evaluates The "month-from-dateTime" function As per example 3 (for this function) of the F&O specs . */ @org.junit.Test public void fnMonthFromDateTime3() { final XQuery query = new XQuery( "fn:month-from-dateTime(fn:adjust-dateTime-to-timezone(xs:dateTime(\"1999-12-31T19:20:00-05:00\"), xs:dayTimeDuration(\"PT0H\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "month-from-dateTime" function used as an argument to an "avg" function. . */ @org.junit.Test public void fnMonthFromDateTime4() { final XQuery query = new XQuery( "fn:avg((fn:month-from-dateTime(xs:dateTime(\"1996-12-31T12:00:00Z\")),fn:month-from-dateTime(xs:dateTime(\"2000-10-31T12:00:00Z\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "11") ); } /** * Evaluates The "month-from-dateTime" function using the empty sequence as an argument. Use count function to avoid empty file. . */ @org.junit.Test public void fnMonthFromDateTime5() { final XQuery query = new XQuery( "fn:count(fn:month-from-dateTime(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "month-from-dateTime" function that returns a 1. . */ @org.junit.Test public void fnMonthFromDateTime6() { final XQuery query = new XQuery( "fn:month-from-dateTime(xs:dateTime(\"-1999-01-31T00:20:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "month-from-dateTime" function that returns 12. Uses Zulu. . */ @org.junit.Test public void fnMonthFromDateTime7() { final XQuery query = new XQuery( "fn:month-from-dateTime(xs:dateTime(\"0001-12-31T23:20:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12") ); } /** * Evaluates The "month-from-dateTime" function as part of a "+" expression. . */ @org.junit.Test public void fnMonthFromDateTime8() { final XQuery query = new XQuery( "fn:month-from-dateTime(xs:dateTime(\"1970-01-01T00:00:00Z\")) + fn:month-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Evaluates The "month-from-dateTime" function as part of a "-" expression. . */ @org.junit.Test public void fnMonthFromDateTime9() { final XQuery query = new XQuery( "fn:month-from-dateTime(xs:dateTime(\"1970-02-01T00:00:00Z\")) - fn:month-from-dateTime(xs:dateTime(\"1969-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "month-from-dateTime" function with the arguments set as follows: $arg = xs:dateTime(lower bound) . */ @org.junit.Test public void fnMonthFromDateTime1args1() { final XQuery query = new XQuery( "fn:month-from-dateTime(xs:dateTime(\"1970-01-01T00:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "month-from-dateTime" function with the arguments set as follows: $arg = xs:dateTime(mid range) . */ @org.junit.Test public void fnMonthFromDateTime1args2() { final XQuery query = new XQuery( "fn:month-from-dateTime(xs:dateTime(\"1996-04-07T01:40:52Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4") ); } /** * Evaluates The "month-from-dateTime" function with the arguments set as follows: $arg = xs:dateTime(upper bound) . */ @org.junit.Test public void fnMonthFromDateTime1args3() { final XQuery query = new XQuery( "fn:month-from-dateTime(xs:dateTime(\"2030-12-31T23:59:59Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12") ); } /** * Evaluates The "month-from-dateTime" function as part of a "*" expression. . */ @org.junit.Test public void fnMonthFromDateTimeNew10() { final XQuery query = new XQuery( "fn:month-from-dateTime(xs:dateTime(\"1970-03-01T02:00:00Z\")) * fn:month-from-dateTime(xs:dateTime(\"0002-02-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "6") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnMonthsFromDuration.java000066400000000000000000000400521222453003200310360ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the months-from-duration() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnMonthsFromDuration extends QT3TestSet { /** * A test whose essence is: `months-from-duration()`. . */ @org.junit.Test public void kMonthsFromDurationFunc1() { final XQuery query = new XQuery( "months-from-duration()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `months-from-duration((), "Wrong param")`. . */ @org.junit.Test public void kMonthsFromDurationFunc2() { final XQuery query = new XQuery( "months-from-duration((), \"Wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(months-from-duration(()))`. . */ @org.junit.Test public void kMonthsFromDurationFunc3() { final XQuery query = new XQuery( "empty(months-from-duration(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `months-from-duration(()) instance of xs:integer?`. . */ @org.junit.Test public void kMonthsFromDurationFunc4() { final XQuery query = new XQuery( "months-from-duration(()) instance of xs:integer?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `months-from-duration(xs:yearMonthDuration("P0003Y2M")) eq 2`. . */ @org.junit.Test public void kMonthsFromDurationFunc5() { final XQuery query = new XQuery( "months-from-duration(xs:yearMonthDuration(\"P0003Y2M\")) eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test invoking months-from-duration() on a negative duration. . */ @org.junit.Test public void kMonthsFromDurationFunc6() { final XQuery query = new XQuery( "months-from-duration(xs:yearMonthDuration(\"-P0003Y2M\")) eq -2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test invoking months-from-duration() on an negative xs:duration. . */ @org.junit.Test public void kMonthsFromDurationFunc7() { final XQuery query = new XQuery( "months-from-duration(xs:duration(\"-P3Y4M4DT1H23M2.34S\")) eq -4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:months-from-duration on xs:dayTimeDuration . */ @org.junit.Test public void cbclMonthsFromDuration001() { final XQuery query = new XQuery( "fn:months-from-duration(xs:dayTimeDuration('P1D'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "months-from-duration" function As per example 1 (for this function)of the F&O specs . */ @org.junit.Test public void fnMonthsFromDuration1() { final XQuery query = new XQuery( "fn:months-from-duration(xs:yearMonthDuration(\"P20Y15M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Evaluates The "months-from-duration" function as part of a "*" expression. . */ @org.junit.Test public void fnMonthsFromDuration10() { final XQuery query = new XQuery( "fn:months-from-duration(xs:yearMonthDuration(\"P20Y09M\")) * fn:months-from-duration(xs:yearMonthDuration(\"P02Y10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("90") ); } /** * Evaluates The "months-from-duration" function as part of a "div" expression. . */ @org.junit.Test public void fnMonthsFromDuration11() { final XQuery query = new XQuery( "fn:months-from-duration(xs:yearMonthDuration(\"P20Y10M\")) div fn:months-from-duration(xs:yearMonthDuration(\"P05Y05M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Evaluates The "months-from-duration" function as part of a "idiv" expression. . */ @org.junit.Test public void fnMonthsFromDuration12() { final XQuery query = new XQuery( "fn:months-from-duration(xs:yearMonthDuration(\"P25Y10M\")) idiv fn:months-from-duration(xs:yearMonthDuration(\"P05Y02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** * Evaluates The "months-from-duration" function as part of a "mod" expression. . */ @org.junit.Test public void fnMonthsFromDuration13() { final XQuery query = new XQuery( "fn:months-from-duration(xs:yearMonthDuration(\"P10Y10M\")) mod fn:months-from-duration(xs:yearMonthDuration(\"P03Y03M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "months-from-duration" function as part of a "numeric-unary-plus" expression. . */ @org.junit.Test public void fnMonthsFromDuration14() { final XQuery query = new XQuery( "+fn:months-from-duration(xs:yearMonthDuration(\"P21Y10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Evaluates The "months-from-duration" function as part of a "numeric-unary-minus" expression. . */ @org.junit.Test public void fnMonthsFromDuration15() { final XQuery query = new XQuery( "-fn:months-from-duration(xs:yearMonthDuration(\"P25Y03M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-3") ); } /** * Evaluates The "months-from-duration" function as part of a "numeric-equal" expression (eq operator) . */ @org.junit.Test public void fnMonthsFromDuration16() { final XQuery query = new XQuery( "fn:months-from-duration(xs:yearMonthDuration(\"P22Y10M\")) eq fn:months-from-duration(xs:yearMonthDuration(\"P22Y09M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "months-from-duration" function as part of a "numeric-equal" expression (ne operator) . */ @org.junit.Test public void fnMonthsFromDuration17() { final XQuery query = new XQuery( "fn:months-from-duration(xs:yearMonthDuration(\"P22Y10M\")) ne fn:months-from-duration(xs:yearMonthDuration(\"P23Y10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "months-from-duration" function as part of a "numeric-equal" expression (le operator) . */ @org.junit.Test public void fnMonthsFromDuration18() { final XQuery query = new XQuery( "fn:months-from-duration(xs:yearMonthDuration(\"P21Y01M\")) le fn:months-from-duration(xs:yearMonthDuration(\"P21Y15M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "months-from-duration" function as part of a "numeric-equal" expression (ge operator) . */ @org.junit.Test public void fnMonthsFromDuration19() { final XQuery query = new XQuery( "fn:months-from-duration(xs:yearMonthDuration(\"P20Y09M\")) ge fn:months-from-duration(xs:yearMonthDuration(\"P20Y01M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "months-from-duration" function As per example 2 (for this function) of the F&O specs . */ @org.junit.Test public void fnMonthsFromDuration2() { final XQuery query = new XQuery( "fn:months-from-duration(xs:yearMonthDuration(\"-P20Y18M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-6") ); } /** * Evaluates The "months-from-duration" function with wrong argument type. . */ @org.junit.Test public void fnMonthsFromDuration20() { final XQuery query = new XQuery( "fn:months-from-duration(xs:duration(\"P1Y2M3DT10H30M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Evaluates The "months-from-duration" function involving a "numeric-less-than" operation (lt operator) . */ @org.junit.Test public void fnMonthsFromDuration3() { final XQuery query = new XQuery( "fn:months-from-duration(xs:yearMonthDuration(\"P20Y3M\")) lt fn:months-from-duration(xs:yearMonthDuration(\"P21Y2M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "months-from-duration" function involving a "numeric-less-than" operation (le operator) . */ @org.junit.Test public void fnMonthsFromDuration4() { final XQuery query = new XQuery( "fn:months-from-duration(xs:yearMonthDuration(\"P21Y10M\")) le fn:months-from-duration(xs:yearMonthDuration(\"P22Y10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "months-from-duration" function using the empty sequence as an argument. Use count function to avoid empty file. . */ @org.junit.Test public void fnMonthsFromDuration5() { final XQuery query = new XQuery( "fn:count(fn:months-from-duration(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "months-from-duration" function that returns 1. . */ @org.junit.Test public void fnMonthsFromDuration6() { final XQuery query = new XQuery( "fn:months-from-duration(xs:yearMonthDuration(\"P01Y01M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "months-from-duration" function used as arguments to an avg function. . */ @org.junit.Test public void fnMonthsFromDuration7() { final XQuery query = new XQuery( "fn:avg((fn:months-from-duration(xs:yearMonthDuration(\"P23Y10M\")),fn:months-from-duration(xs:yearMonthDuration(\"P21Y10M\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Evaluates The "months-from-duration" function as part of a "+" expression. . */ @org.junit.Test public void fnMonthsFromDuration8() { final XQuery query = new XQuery( "fn:months-from-duration(xs:yearMonthDuration(\"P21Y10M\")) + fn:months-from-duration(xs:yearMonthDuration(\"P22Y11M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("21") ); } /** * Evaluates The "months-from-duration" function as part of a "-" expression. . */ @org.junit.Test public void fnMonthsFromDuration9() { final XQuery query = new XQuery( "fn:months-from-duration(xs:yearMonthDuration(\"P30Y10M\")) - fn:months-from-duration(xs:yearMonthDuration(\"P10Y09M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "months-from-duration" function with the arguments set as follows: $arg = xs:yearMonthDuration(lower bound) . */ @org.junit.Test public void fnMonthsFromDuration1args1() { final XQuery query = new XQuery( "fn:months-from-duration(xs:yearMonthDuration(\"P0Y0M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "months-from-duration" function with the arguments set as follows: $arg = xs:yearMonthDuration(mid range) . */ @org.junit.Test public void fnMonthsFromDuration1args2() { final XQuery query = new XQuery( "fn:months-from-duration(xs:yearMonthDuration(\"P1000Y6M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("6") ); } /** * Evaluates The "months-from-duration" function with the arguments set as follows: $arg = xs:yearMonthDuration(upper bound) . */ @org.junit.Test public void fnMonthsFromDuration1args3() { final XQuery query = new XQuery( "fn:months-from-duration(xs:yearMonthDuration(\"P2030Y12M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnName.java000066400000000000000000000453431222453003200261240ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** . * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnName extends QT3TestSet { /** * Test: K-NameFunc-1 `name((), "wrong param")`. . */ @org.junit.Test public void kNameFunc1() { final XQuery query = new XQuery( "name((), \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Test: K-NameFunc-2 `if(false()) then name() else true()`. . */ @org.junit.Test public void kNameFunc2() { final XQuery query = new XQuery( "if(false()) then name() else true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPDY0002") ) ); } /** * Test: K-NameFunc-3 `name(()) eq ""`. . */ @org.junit.Test public void kNameFunc3() { final XQuery query = new XQuery( "name(()) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * argument set to the empty sequence. Uses the fn:string-length function to avoid empty file.. */ @org.junit.Test public void fnName1() { final XQuery query = new XQuery( "fn:string-length(fn:name(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * that uses the "parent" axes. */ @org.junit.Test public void fnName10() { final XQuery query = new XQuery( "for $h in (./works/employee[2]) return fn:name($h/parent::node())", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "works") ); } /** * that uses the "descendant" axes. */ @org.junit.Test public void fnName11() { final XQuery query = new XQuery( "for $h in (./works/employee[2]) return fn:name($h/descendant::empnum[position() =\n" + " 1])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "empnum") ); } /** * that uses the "descendant-or-self" axes. */ @org.junit.Test public void fnName12() { final XQuery query = new XQuery( "for $h in (./works/employee[2]) return fn:name($h/descendant-or-self::empnum[position()\n" + " = 1])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "empnum") ); } /** * argument to the fn-subtstring function.. */ @org.junit.Test public void fnName13() { final XQuery query = new XQuery( "for $h in (./works/employee[2]) return fn:substring(fn:name($h),2)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "mployee") ); } /** * argument to the fn:concat function.. */ @org.junit.Test public void fnName14() { final XQuery query = new XQuery( "for $h in (/works/employee[2]) return fn:concat(fn:name($h),\"A String\")", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "employeeA String") ); } /** * that uses the "self" axes. Returns a string. */ @org.junit.Test public void fnName15() { final XQuery query = new XQuery( "for $h in (./works/employee[2]) return fn:name($h/self::employee)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "employee") ); } /** * that uses the "self" axes. Returns a empty sequence Uses fn:count to avoid empty file.. */ @org.junit.Test public void fnName16() { final XQuery query = new XQuery( "for $h in (./works/employee[2]) return fn:count(fn:name($h/self::div))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "1") || error("XPST0005") ) ); } /** * that uses the "parent::node()". The context node is an attribute node.. */ @org.junit.Test public void fnName17() { final XQuery query = new XQuery( " for $h in (/works/employee[2]/@name) return fn:name($h/parent::node())", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "employee") ); } /** * Evaluation of the fn:name function as an argument to the string-length function. The context node is an attribute node.. */ @org.junit.Test public void fnName18() { final XQuery query = new XQuery( "fn:string-length(fn:name(./works[1]/employee[2]/@name))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4") ); } /** * Evaluation of the fn:name function, for which the argument is a direct element constructor. The context node is an attribute node. . */ @org.junit.Test public void fnName19() { final XQuery query = new XQuery( "fn:name(Content)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "anElement") ); } /** * argument set to an element node.. */ @org.junit.Test public void fnName2() { final XQuery query = new XQuery( "(fn:name(./works[1]/employee[1]))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "employee") ); } /** * Evaluation of the fn:name function, for which the argument is a direct element constructor with an attribute.. */ @org.junit.Test public void fnName20() { final XQuery query = new XQuery( "fn:name(Content)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "anElement") ); } /** * Evaluation of the fn:name function used as part of a sequence.. */ @org.junit.Test public void fnName21() { final XQuery query = new XQuery( "(fn:name(./works[1]/employee[1]),fn:name(./works[1]/employee[2]))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "employee employee") ); } /** * fn:count.. */ @org.junit.Test public void fnName22() { final XQuery query = new XQuery( "fn:count(((fn:name(/works[1]/employee[1]),fn:name(/works[1]/employee[2]))))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * undefined context node and argument set to ".".. */ @org.junit.Test public void fnName23() { final XQuery query = new XQuery( "fn:name(.)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** . */ @org.junit.Test public void fnName24() { final XQuery query = new XQuery( "name(/*)", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ma:AuctionWatchList") ); } /** . */ @org.junit.Test public void fnName25() { final XQuery query = new XQuery( "name((//*:Start)[1]/@*)", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ma:currency") ); } /** . */ @org.junit.Test public void fnName26() { final XQuery query = new XQuery( "name((//@xml:*)[1])", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xml:lang") ); } /** * Get the name of a processing-instruction node.. */ @org.junit.Test public void fnName28() { final XQuery query = new XQuery( "name((//processing-instruction())[1])", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xml-stylesheet") ); } /** * Get the name of an element in a default but non-null namespace.. */ @org.junit.Test public void fnName29() { final XQuery query = new XQuery( "name((//*[.='1983'])[1])", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "recorded") ); } /** * argument set to an attribute node. insert-start insert-end. */ @org.junit.Test public void fnName3() { final XQuery query = new XQuery( "(fn:name(./works[1]/employee[1]/@name))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "name") ); } /** * Get the name of a comment node. */ @org.junit.Test public void fnName30() { final XQuery query = new XQuery( "name((//comment())[1]) = ''", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Get the name of a text node. */ @org.junit.Test public void fnName31() { final XQuery query = new XQuery( "name((//text())[1]) = ''", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * argument set to a document node. Use of "fn:string-length" to avoid empty file. insert-start insert-end. */ @org.junit.Test public void fnName4() { final XQuery query = new XQuery( "fn:string-length(fn:name(.))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * argument set to a non existing element. Use of "fn:string-length" to avoid empty file. insert-start insert-end. */ @org.junit.Test public void fnName5() { final XQuery query = new XQuery( "fn:string-length(fn:name(./works[1]/nonexistent[1]))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * argument set to a non existing element. Use of "fn:string-length" to avoid empty file.. */ @org.junit.Test public void fnName6() { final XQuery query = new XQuery( "for $h in ./works[1]/employee[2] return\n" + " fn:string-length(fn:name($h/child::text()[last()]))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * undefined context node.. */ @org.junit.Test public void fnName7() { final XQuery query = new XQuery( "fn:name()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * argument to the fn:upper-case function. */ @org.junit.Test public void fnName8() { final XQuery query = new XQuery( "for $h in (./works/employee[2]) return fn:upper-case(fn:name($h))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "EMPLOYEE") ); } /** * argument to the fn:lower-case function. */ @org.junit.Test public void fnName9() { final XQuery query = new XQuery( "for $h in (./works/employee[2]) return fn:lower-case(fn:name($h))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "employee") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnNamespaceUri.java000066400000000000000000000475101222453003200276160ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the namespace-uri() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnNamespaceUri extends QT3TestSet { /** * A test whose essence is: `namespace-uri((), "wrong param")`. . */ @org.junit.Test public void kNodeNamespaceURIFunc1() { final XQuery query = new XQuery( "namespace-uri((), \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `if(false()) then namespace-uri() else true()`. . */ @org.junit.Test public void kNodeNamespaceURIFunc2() { final XQuery query = new XQuery( "if(false()) then namespace-uri() else true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPDY0002") ) ); } /** * A test whose essence is: `namespace-uri(()) eq xs:anyURI("")`. . */ @org.junit.Test public void kNodeNamespaceURIFunc3() { final XQuery query = new XQuery( "namespace-uri(()) eq xs:anyURI(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Extract the namespace URI from a processing instruction node. . */ @org.junit.Test public void k2NodeNamespaceURIFunc1() { final XQuery query = new XQuery( "namespace-uri() eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Extract the namespace URI from a comment node. . */ @org.junit.Test public void k2NodeNamespaceURIFunc2() { final XQuery query = new XQuery( "namespace-uri() eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Extract the namespace URI from a text node. . */ @org.junit.Test public void k2NodeNamespaceURIFunc3() { final XQuery query = new XQuery( "namespace-uri(text{()}) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:boolean on fn:namespace-uri . */ @org.junit.Test public void cbclNamespaceUri001() { final XQuery query = new XQuery( "fn:boolean(fn:namespace-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the fn:namespace-uri function with an undefined context node and no argument. . */ @org.junit.Test public void fnNamespaceUri1() { final XQuery query = new XQuery( "fn:namespace-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Evaluation of the fn:namespace-uri function argument set to an element node with no namespace. Use the fn:count function to avoid empty file. . */ @org.junit.Test public void fnNamespaceUri10() { final XQuery query = new XQuery( "namespace-uri(/*)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"\"") ); } /** * Evaluation of the fn:namespace-uri function argument set to a computed element node with no namespace. Use the fn:count function to avoid empty file. . */ @org.junit.Test public void fnNamespaceUri11() { final XQuery query = new XQuery( "fn:namespace-uri(element elementNode {\"with no namespace\"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"\"") ); } /** * Evaluation of the fn:namespace-uri function argument set to an attribute node with no namespace. Use the fn:count function to avoid empty file. . */ @org.junit.Test public void fnNamespaceUri12() { final XQuery query = new XQuery( "fn:namespace-uri(/works/employee[1]/@name)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"\"") ); } /** * Evaluation of the fn:namespace-uri function argument set to a computed attribute node with no namespace. . */ @org.junit.Test public void fnNamespaceUri13() { final XQuery query = new XQuery( "fn:namespace-uri(attribute anAttribute {\"Attribute Value No Namespace\"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertType("xs:anyURI") ) ); } /** * Evaluation of the fn:namespace-uri function argument set to an element node with no namespace queried from a file. . */ @org.junit.Test public void fnNamespaceUri14() { final XQuery query = new XQuery( "fn:namespace-uri(/works[1]/employee[1])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"\"") ); } /** * Evaluation of the fn:namespace-uri function argument set to an attribute node with no namespace queried from a file. . */ @org.junit.Test public void fnNamespaceUri15() { final XQuery query = new XQuery( "fn:namespace-uri(/works[1]/employee[1]/@name)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"\"") ); } /** * Evaluation of the fn:namespace-uri function with no argument. Use an element node with no namespace queried from a file. . */ @org.junit.Test public void fnNamespaceUri16() { final XQuery query = new XQuery( "let $var := /works/employee[1] return $var/fn:namespace-uri()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertType("xs:anyURI") ) ); } /** * Evaluation of the fn:namespace-uri function with argument set to a direct element node with a namespace attribute. Use the string function . */ @org.junit.Test public void fnNamespaceUri17() { final XQuery query = new XQuery( "namespace-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"http://www.example.com/examples\"") && assertType("xs:anyURI") ) ); } /** * Evaluation of the fn:namespace-uri function with argument set to a computed element node (with prefix) that uses a declared namespace attribute. Use the string function . */ @org.junit.Test public void fnNamespaceUri18() { final XQuery query = new XQuery( "declare namespace ex = \"http://www.example.com/examples\"; \n" + " fn:string(fn:namespace-uri(element ex:anElement {\"An Element Content\"}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/examples") ); } /** * Evaluation of the fn:namespace-uri function with argument set to a computed element node (with no prefix) * that should not use a declared namespace attribute. Use the count function to avoid empty file. . */ @org.junit.Test public void fnNamespaceUri19() { final XQuery query = new XQuery( "declare namespace ex = \"http://www.example.com/examples\"; \n" + " fn:namespace-uri(element anElement {\"An Element Content\"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * Evaluation of the fn:namespace-uri function with more than one argument. . */ @org.junit.Test public void fnNamespaceUri2() { final XQuery query = new XQuery( "fn:namespace-uri(/*,\"A Second Argument\")", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Evaluation of the fn:namespace-uri function with argument set to a direct element node (with no prefix) * that should not use a declared namespace attribute. Use the count function to avoid empty file. . */ @org.junit.Test public void fnNamespaceUri20() { final XQuery query = new XQuery( "declare namespace ex = \"http://www.example.com/examples\"; \n" + " fn:namespace-uri(An Element Content)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * Evaluation of the fn:namespace-uri function with argument set to a direct element node with prefix that should use a declared namespace attribute. Use the string function. . */ @org.junit.Test public void fnNamespaceUri21() { final XQuery query = new XQuery( "declare namespace ex = \"http://www.example.com/examples\"; \n" + " fn:namespace-uri(An Element Content)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/examples") ); } /** * Evaluation of the fn:namespace-uri function with argument set to a direct element node with no prefix that should use a declared defaultnamespace attribute. Use the string function. . */ @org.junit.Test public void fnNamespaceUri22() { final XQuery query = new XQuery( "declare default element namespace \"http://www.example.com/examples\"; \n" + " fn:string(fn:namespace-uri(An Element Content))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/examples") ); } /** * Evaluation of the fn:namespace-uri function with argument set to a direct element node with prefix that should not used the declared defaultnamespace attribute. Use the string function. . */ @org.junit.Test public void fnNamespaceUri23() { final XQuery query = new XQuery( "declare default element namespace \"http://www.example.com/examples\"; \n" + " declare namespace ex = \"http://www.example.com/exampleswithPrefix\"; \n" + " fn:string(fn:namespace-uri(An Element Content))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/exampleswithPrefix") ); } /** * Evaluation of the fn:namespace-uri function with argument set to a computed element node with prefix that should not used the declared defaultnamespace attribute. Use the string function. . */ @org.junit.Test public void fnNamespaceUri24() { final XQuery query = new XQuery( "declare default element namespace \"http://www.example.com/examples\"; \n" + " declare namespace ex = \"http://www.example.com/exampleswithPrefix\"; \n" + " fn:string(fn:namespace-uri(element ex:anElement {\"An Element Content\"}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/exampleswithPrefix") ); } /** * Evaluation of the fn:namespace-uri function with argument set to a computed element node with prefix no that should used the declared default namespace attribute. Use the string function. . */ @org.junit.Test public void fnNamespaceUri25() { final XQuery query = new XQuery( "declare default element namespace \"http://www.example.com/examples\"; \n" + " declare namespace ex = \"http://www.example.com/exampleswithPrefix\"; \n" + " fn:string(fn:namespace-uri(element anElement {\"An Element Content\"}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/examples") ); } /** * Evaluation of the fn:namespace-uri function with an undefined context node and argument set to ".". . */ @org.junit.Test public void fnNamespaceUri26() { final XQuery query = new XQuery( "fn:namespace-uri(.)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Evaluation of the fn:namespace-uri function with the context item not being a node. . */ @org.junit.Test public void fnNamespaceUri3() { final XQuery query = new XQuery( "(1 to 100)[fn:namespace-uri()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluation of the fn:namespace-uri function argument set to empty sequence. . */ @org.junit.Test public void fnNamespaceUri4() { final XQuery query = new XQuery( "fn:namespace-uri(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"\"") ); } /** * Evaluation of the fn:namespace-uri function argument set to a comment node. Use the fn:count function to avoid empty file. . */ @org.junit.Test public void fnNamespaceUri5() { final XQuery query = new XQuery( "namespace-uri((//comment())[1])", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"\"") ); } /** * Evaluation of the fn:namespace-uri function argument set to a computed comment node. . */ @org.junit.Test public void fnNamespaceUri6() { final XQuery query = new XQuery( "namespace-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"\"") ); } /** * Evaluation of the fn:namespace-uri function argument set to a processing instruction node. . */ @org.junit.Test public void fnNamespaceUri7() { final XQuery query = new XQuery( "namespace-uri((//processing-instruction())[1])", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"\"") ); } /** * Evaluation of the fn:namespace-uri function argument set to a constructed processing instruction node. . */ @org.junit.Test public void fnNamespaceUri8() { final XQuery query = new XQuery( "namespace-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"\"") ); } /** * Evaluation of the fn:namespace-uri function argument set to a text node. Use the fn:count function to avoid empty file. . */ @org.junit.Test public void fnNamespaceUri9() { final XQuery query = new XQuery( "namespace-uri((//text())[1])", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"\"") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnNamespaceUriForPrefix.java000066400000000000000000000506331222453003200314430ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the namespace-uri-for-prefix() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnNamespaceUriForPrefix extends QT3TestSet { /** * A test whose essence is: `namespace-uri-for-prefix()`. . */ @org.junit.Test public void kNamespaceURIForPrefixFunc1() { final XQuery query = new XQuery( "namespace-uri-for-prefix()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `namespace-uri-for-prefix("string", (), "wrong param")`. . */ @org.junit.Test public void kNamespaceURIForPrefixFunc2() { final XQuery query = new XQuery( "namespace-uri-for-prefix(\"string\", (), \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Test that the correct default namespace is picked up. . */ @org.junit.Test public void k2NamespaceURIForPrefixFunc1() { final XQuery query = new XQuery( "declare namespace p = \"http://www.example.com/B\"; namespace-uri-for-prefix(\"\", /p:b)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/B") ); } /** * Test that the correct default namespace is picked up(#2). . */ @org.junit.Test public void k2NamespaceURIForPrefixFunc2() { final XQuery query = new XQuery( "namespace-uri-for-prefix(\"\", exactly-one(\n" + " /b)\n" + " )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * Test that the correct default namespace is picked up(#3). . */ @org.junit.Test public void k2NamespaceURIForPrefixFunc3() { final XQuery query = new XQuery( "declare namespace p = \"http://www.example.com/A\"; namespace-uri-for-prefix(\"\", /p:b)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/A") ); } /** * Test EBV of fn:namespace-uri-for-prefix . */ @org.junit.Test public void cbclNamespaceUriForPrefix001() { final XQuery query = new XQuery( "\n" + " \tfn:boolean(fn:namespace-uri-for-prefix('', ))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of fn:namespace-uri-for-prefix function, for which the element is defined * and namespace uri is set. Use a direct element. . */ @org.junit.Test public void fnNamespaceUriForPrefix1() { final XQuery query = new XQuery( "let $var := some context \n" + " return string(fn:namespace-uri-for-prefix(\"p1\",$var))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/examples") ); } /** * Evaluation of fn:namespace-uri-for-prefix function,with the first argument (prefix) * uses the fn:lower-case function. Element is directly constructed and given as argument. Use fn:string. . */ @org.junit.Test public void fnNamespaceUriForPrefix10() { final XQuery query = new XQuery( "fn:string(fn:namespace-uri-for-prefix(fn:lower-case(\"P1\"),some context))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/examples") ); } /** * Evaluation of fn:namespace-uri-for-prefix function,with the first argument (prefix) * uses the fn:substring function. Element is directly constructed and given as argument. Use fn:string. . */ @org.junit.Test public void fnNamespaceUriForPrefix11() { final XQuery query = new XQuery( "fn:string(fn:namespace-uri-for-prefix(fn:substring(\"abcp1\",4),some context))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/examples") ); } /** * Evaluation of fn:namespace-uri-for-prefix function,with the first argument (prefix) * uses the fn:concat function. Element is directly constructed and given as argument. Use fn:string. . */ @org.junit.Test public void fnNamespaceUriForPrefix12() { final XQuery query = new XQuery( "fn:string(fn:namespace-uri-for-prefix(fn:concat(\"p\",\"1\"),some context))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/examples") ); } /** * Evaluation of fn:namespace-uri-for-prefix function,with the first argument (prefix) uses * the fn:string-join function. Element is directly constructed and given as argument. Use fn:string. . */ @org.junit.Test public void fnNamespaceUriForPrefix13() { final XQuery query = new XQuery( "fn:string(fn:namespace-uri-for-prefix(fn:string-join((\"p\",\"1\"),\"\"),some context))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/examples") ); } /** * Evaluation of fn:namespace-uri-for-prefix function,with the first argument (prefix) * uses the fn:substring-before function. Element is directly constructed and given as argument. Use fn:string. . */ @org.junit.Test public void fnNamespaceUriForPrefix14() { final XQuery query = new XQuery( "fn:string(fn:namespace-uri-for-prefix(fn:substring-before(\"p1abc\",\"abc\"),some context))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/examples") ); } /** * Evaluation of fn:namespace-uri-for-prefix function,with the first argument (prefix) * uses the fn:substring-after function. Element is directly constructed and given as argument. Use fn:string. . */ @org.junit.Test public void fnNamespaceUriForPrefix15() { final XQuery query = new XQuery( "fn:string(fn:namespace-uri-for-prefix(fn:substring-after(\"abcp1\",\"abc\"),some context))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/examples") ); } /** * Evaluation of fn:namespace-uri-for-prefix function for which the element * is directly constructed and given as argument with no namespace. Use fn:count to avoid empty file. . */ @org.junit.Test public void fnNamespaceUriForPrefix16() { final XQuery query = new XQuery( "declare default element namespace \"http://www.example.com/defaultnamespace\"; \n" + " fn:count(fn:namespace-uri-for-prefix(\"p1\",some context))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of fn:namespace-uri-for-prefix function for which the element is computed and given as argument with no namespace. Use fn:count to avoid empty file. . */ @org.junit.Test public void fnNamespaceUriForPrefix17() { final XQuery query = new XQuery( "declare default element namespace \"http://www.example.com/defaultnamespace\"; \n" + " fn:count(fn:namespace-uri-for-prefix(\"p1\",element anElement {\"some content\"}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of fn:namespace-uri-for-prefix function for which the element is computed as variable (via let) with no namespace. Use fn:count to avoid empty file. . */ @org.junit.Test public void fnNamespaceUriForPrefix18() { final XQuery query = new XQuery( "declare default element namespace \"http://www.example.com/defaultnamespace\"; \n" + " let $var := element anElement {\"some content\"} \n" + " return fn:count(fn:namespace-uri-for-prefix(\"p1\",$var))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of fn:namespace-uri-for-prefix function for which the element is computed * as variable (via for) with no namespace. Use fn:count to avoid empty file. . */ @org.junit.Test public void fnNamespaceUriForPrefix19() { final XQuery query = new XQuery( "declare default element namespace \"http://www.example.com/defaultnamespace\"; \n" + " for $var in (element anElement {\"some content\"}) \n" + " return fn:count(fn:namespace-uri-for-prefix(\"p1\",$var))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of fn:namespace-uri-for-prefix function, for which the element is * defined and namespace uri is not set. Use a direct element. Use fn:count to avoid empty sequence. . */ @org.junit.Test public void fnNamespaceUriForPrefix2() { final XQuery query = new XQuery( "\n" + " let $var := some context \n" + " return fn:count(fn:namespace-uri-for-prefix(\"p2\",$var))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of fn:namespace-uri-for-prefix function for which the element is computed * as variable (via declare variable) with no namespace. Use fn:count to avoid empty file. . */ @org.junit.Test public void fnNamespaceUriForPrefix20() { final XQuery query = new XQuery( "declare default element namespace \"http://www.example.com/defaultnamespace\"; \n" + " for $var in element anElement {\"some content\"} \n" + " return fn:count(fn:namespace-uri-for-prefix(\"p1\",$var))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of fn:namespace-uri-for-prefix function for which the element is directly constructed * and have multiple namespaces. Use fn:string. . */ @org.junit.Test public void fnNamespaceUriForPrefix21() { final XQuery query = new XQuery( "\n" + " fn:string(fn:namespace-uri-for-prefix(\"p1\",\n" + " some content\"\n" + " ))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/examples") ); } /** * * Evaluation of fn:namespace-uri-for-prefix function for which the prefix is the empty string and the element has no default namespace. * The expected behavior for this case was clarified in 3.0. See bugs 11590, 12554. * . */ @org.junit.Test public void fnNamespaceUriForPrefix22() { final XQuery query = new XQuery( "fn:namespace-uri-for-prefix(\"\", )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * * Evaluation of fn:namespace-uri-for-prefix function for which the prefix is the empty sequence and the element has no default namespace. * The expected behavior for this case was clarified in 3.0. See bugs 11590, 12554. * . */ @org.junit.Test public void fnNamespaceUriForPrefix23() { final XQuery query = new XQuery( "fn:namespace-uri-for-prefix((), )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of fn:namespace-uri-for-prefix function,with the first argument (prefix) * set to the zero length string and element is directly constructed. Use fn:string. . */ @org.junit.Test public void fnNamespaceUriForPrefix3() { final XQuery query = new XQuery( "declare default element namespace \"http://www.example.com/defaultspace\"; \n" + " let $var := some context \n" + " return fn:string(fn:namespace-uri-for-prefix(\"\",$var))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/defaultspace") ); } /** * Evaluation of fn:namespace-uri-for-prefix function,with the first argument (prefix) * set to the empty sequence and element is directly constructed. Use fn:string. . */ @org.junit.Test public void fnNamespaceUriForPrefix4() { final XQuery query = new XQuery( "\n" + " declare default element namespace \"http://www.example.com/defaultspace\"; \n" + " let $var := some context \n" + " return fn:string(fn:namespace-uri-for-prefix((), $var))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/defaultspace") ); } /** * Evaluation of fn:namespace-uri-for-prefix function,with the first argument (prefix) * set to the prefix of a directly constructed element given as argument. Use fn:string. . */ @org.junit.Test public void fnNamespaceUriForPrefix5() { final XQuery query = new XQuery( "fn:string(fn:namespace-uri-for-prefix(\"p1\",some context))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/examples") ); } /** * Evaluation of fn:namespace-uri-for-prefix function,with the first argument (prefix) * set to a non existent prefix of a directly constructed element given as argument. Use fn:count to avaoid empty file. . */ @org.junit.Test public void fnNamespaceUriForPrefix6() { final XQuery query = new XQuery( "fn:count(fn:namespace-uri-for-prefix(\"p2\",some context))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of fn:namespace-uri-for-prefix function,with the first argument (prefix) * uses the xs:string function. Element is directly constructed and given as argument. Use fn:string. . */ @org.junit.Test public void fnNamespaceUriForPrefix7() { final XQuery query = new XQuery( "fn:string(fn:namespace-uri-for-prefix(xs:string(\"p1\"),some context))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/examples") ); } /** * Evaluation of fn:namespace-uri-for-prefix function,with the first argument (prefix) * uses the fn:string function. Element is directly constructed and given as argument. Use fn:string. . */ @org.junit.Test public void fnNamespaceUriForPrefix8() { final XQuery query = new XQuery( "fn:string(fn:namespace-uri-for-prefix(fn:string(\"p1\"),some context))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/examples") ); } /** * Evaluation of fn:namespace-uri-for-prefix function,with the first argument (prefix) * uses the fn:upper-case function. Element is directly constructed and given as argument. Use fn:string. . */ @org.junit.Test public void fnNamespaceUriForPrefix9() { final XQuery query = new XQuery( "fn:string(fn:namespace-uri-for-prefix(fn:upper-case(\"p1\"),some context))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/examples") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnNamespaceUriFromQName.java000066400000000000000000000225131222453003200313600ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the namespace-uri-from-qname() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnNamespaceUriFromQName extends QT3TestSet { /** * A test whose essence is: `namespace-uri-from-QName()`. . */ @org.junit.Test public void kNamespaceURIFromQNameFunc1() { final XQuery query = new XQuery( "namespace-uri-from-QName()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `namespace-uri-from-QName(1, 2)`. . */ @org.junit.Test public void kNamespaceURIFromQNameFunc2() { final XQuery query = new XQuery( "namespace-uri-from-QName(1, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(namespace-uri-from-QName( () ))`. . */ @org.junit.Test public void kNamespaceURIFromQNameFunc3() { final XQuery query = new XQuery( "empty(namespace-uri-from-QName( () ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `namespace-uri-from-QName( QName("example.com/", "pre:lname")) eq xs:anyURI("example.com/")`. . */ @org.junit.Test public void kNamespaceURIFromQNameFunc4() { final XQuery query = new XQuery( "namespace-uri-from-QName( QName(\"example.com/\", \"pre:lname\")) eq xs:anyURI(\"example.com/\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `namespace-uri-from-QName( QName("example.com/", "pre:lname")) instance of xs:anyURI`. . */ @org.junit.Test public void kNamespaceURIFromQNameFunc5() { final XQuery query = new XQuery( "namespace-uri-from-QName( QName(\"example.com/\", \"pre:lname\")) instance of xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that xmlns declarations in direct element constructors are honored in embedded expressions. . */ @org.junit.Test public void k2NamespaceURIFromQNameFunc1() { final XQuery query = new XQuery( "\n" + " declare namespace ns = \"http://example.com/ANamespace\"; \n" + " string({namespace-uri-from-QName(\"ns:foo\" cast as xs:QName)})\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.com/BNamespace") ); } /** * Check that the default element namespace is picked up with computed element constructors. . */ @org.junit.Test public void k2NamespaceURIFromQNameFunc2() { final XQuery query = new XQuery( "\n" + " {namespace-uri-from-QName(node-name(element anElement{\"text\"}))} /string()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.com/") ); } /** * Check that xmlns declarations overrides. . */ @org.junit.Test public void k2NamespaceURIFromQNameFunc3() { final XQuery query = new XQuery( "\n" + " declare default element namespace \"http://example.com/\"; \n" + " {namespace-uri-from-QName(xs:QName(\"l\"))}/string()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"\"") ); } /** * Check that xmlns declarations overrides(#2). . */ @org.junit.Test public void k2NamespaceURIFromQNameFunc4() { final XQuery query = new XQuery( "\n" + " declare default element namespace \"http://example.com/\"; \n" + " declare namespace p = \"http://example.com/2\"; \n" + " [{namespace-uri-from-QName(xs:QName(\"n1\"))}|{namespace-uri-from-QName(xs:QName(\"p:n2\"))}]/text()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "[|http://example.com/3]") ); } /** * Test function fn:namespace-uri-from-QName. Empty sequence literal as input . */ @org.junit.Test public void namespaceURIFromQNameFunc006() { final XQuery query = new XQuery( "fn:namespace-uri-from-QName(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Test function fn:namespace-uri-from-QName. Empty sequence literal as input . */ @org.junit.Test public void namespaceURIFromQNameFunc007() { final XQuery query = new XQuery( "fn:namespace-uri-from-QName(((),()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Test function fn:namespace-uri-from-QName. Error case - invalid parameter type (string) . */ @org.junit.Test public void namespaceURIFromQNameFunc009() { final XQuery query = new XQuery( "fn:namespace-uri-from-QName(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test function fn:namespace-uri-from-QName. Error case - no input parameter . */ @org.junit.Test public void namespaceURIFromQNameFunc011() { final XQuery query = new XQuery( "fn:namespace-uri-from-QName()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Test function fn:namespace-uri-from-QName. * Error case - invalid parameter type (simple type) . */ @org.junit.Test public void namespaceURIFromQNameFunc015() { xquery10(); final XQuery query = new XQuery( "fn:namespace-uri-from-QName((//Folder)[1])", ctx); try { query.context(node(file("prod/ForClause/fsx.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test function fn:namespace-uri-from-QName. * Error case - invalid parameter type (simple type) . */ @org.junit.Test public void namespaceURIFromQNameFunc015a() { final XQuery query = new XQuery( "fn:namespace-uri-from-QName((//Folder)[1])", ctx); try { query.context(node(file("prod/ForClause/fsx.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0117") ); } /** * Test function fn:namespace-uri-from-QName. Error case - invalid parameter type (integer) . */ @org.junit.Test public void namespaceURIFromQNameFunc016() { final XQuery query = new XQuery( "fn:namespace-uri-from-QName(xs:integer(\"100\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test function fn:namespace-uri-from-QName. Error case - invalid parameter type (time) . */ @org.junit.Test public void namespaceURIFromQNameFunc017() { final XQuery query = new XQuery( "fn:namespace-uri-from-QName(xs:time(\"12:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnNilled.java000066400000000000000000000403121222453003200264420ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the nilled() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnNilled extends QT3TestSet { /** * A test whose essence is: `nilled()`. . */ @org.junit.Test public void kNilledFunc1() { xquery10(); final XQuery query = new XQuery( "nilled()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `nilled((), "wrong param")`. . */ @org.junit.Test public void kNilledFunc2() { final XQuery query = new XQuery( "nilled((), \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(nilled( () ))`. . */ @org.junit.Test public void kNilledFunc3() { final XQuery query = new XQuery( "empty(nilled( () ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `nilled(1)`. . */ @org.junit.Test public void kNilledFunc4() { final XQuery query = new XQuery( "nilled(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test fn:nilled on non-element nodes. . */ @org.junit.Test public void cbclNilled007() { final XQuery query = new XQuery( "\n" + " \tempty(nilled( ))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of nilled function with argument set to empty sequence. Use fn:count to avoid empty file . */ @org.junit.Test public void fnNilled1() { final XQuery query = new XQuery( "fn:count(fn:nilled(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluation of nilled function as argument to fn:not function. returns true. . */ @org.junit.Test public void fnNilled10() { final XQuery query = new XQuery( " fn:not(fn:nilled())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of nilled function as argument to fn:not function. returns false. . */ @org.junit.Test public void fnNilled11() { final XQuery query = new XQuery( " fn:not(fn:nilled())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of nilled function used a part of boolean expression ("and" operator and fn:true() . */ @org.junit.Test public void fnNilled12() { final XQuery query = new XQuery( " fn:nilled() and fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of nilled function used a part of boolean expression ("and" operator and fn:false() . */ @org.junit.Test public void fnNilled13() { final XQuery query = new XQuery( " fn:nilled() and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of nilled function used a part of boolean expression ("or" operator and fn:true() . */ @org.junit.Test public void fnNilled14() { final XQuery query = new XQuery( " fn:nilled() or fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of nilled function used a part of boolean expression ("or" operator and fn:false() . */ @org.junit.Test public void fnNilled15() { final XQuery query = new XQuery( " fn:nilled() or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of nilled function used as argument to fn:string function. . */ @org.junit.Test public void fnNilled16() { final XQuery query = new XQuery( " fn:nilled() ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of nilled function used as argument to xs:boolean function. Returns false . */ @org.junit.Test public void fnNilled17() { final XQuery query = new XQuery( " xs:boolean(fn:nilled())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of nilled function used as argument to xs:boolean function. Returns false . */ @org.junit.Test public void fnNilled18() { final XQuery query = new XQuery( " xs:boolean(fn:nilled())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of nilled function with argument set to a document node . */ @org.junit.Test public void fnNilled19() { final XQuery query = new XQuery( " fn:nilled(document {data})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of nilled function with argument set to comment node. Use fn:count to avoid empty file . */ @org.junit.Test public void fnNilled2() { final XQuery query = new XQuery( " fn:count(fn:nilled(/works[1]/employee[2]/child::text()[last()]))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluation of nilled function with argument set to an attribute node . */ @org.junit.Test public void fnNilled20() { final XQuery query = new XQuery( " fn:nilled(attribute size {1})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of nilled function with argument set to a comment node . */ @org.junit.Test public void fnNilled21() { final XQuery query = new XQuery( " fn:nilled()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of nilled function with argument set to a processing instruction node. */ @org.junit.Test public void fnNilled22() { final XQuery query = new XQuery( " fn:nilled()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * nilled() applied to document node (Allowed in 3.0). . */ @org.junit.Test public void fnNilled23() { final XQuery query = new XQuery( "nilled()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * nilled() applied to element node (Allowed in 3.0). . */ @org.junit.Test public void fnNilled24() { final XQuery query = new XQuery( "/*/nilled()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * nilled() applied to attribute node (Allowed in 3.0). . */ @org.junit.Test public void fnNilled25() { final XQuery query = new XQuery( "/works/employee[1]/@gender/nilled()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * nilled() applied to text node (Allowed in 3.0). . */ @org.junit.Test public void fnNilled26() { final XQuery query = new XQuery( "/works/employee[1]/empnum/text()/nilled()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * nilled() applied to untyped element node with xsi:nil=true (Allowed in 3.0). . */ @org.junit.Test public void fnNilled27() { final XQuery query = new XQuery( " ()/fn:nilled()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * nilled() : context item is atomic . */ @org.junit.Test public void fnNilled28() { final XQuery query = new XQuery( "23[nilled()]", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * nilled() : context item is a function item . */ @org.junit.Test public void fnNilled29() { final XQuery query = new XQuery( "nilled#0[nilled()]", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluation of nilled function with argument set to an element node. . */ @org.junit.Test public void fnNilled3() { final XQuery query = new XQuery( " fn:nilled(/works[1]/employee[2])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * nilled() : context item is absent . */ @org.junit.Test public void fnNilled30() { final XQuery query = new XQuery( "current-date() gt current-date()+xs:dayTimeDuration('P1D') or nilled()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Evaluation of nilled function with argument set to an element node. . */ @org.junit.Test public void fnNilled4() { final XQuery query = new XQuery( " fn:nilled()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of nilled function with argument set to an element node with xsi:nill = true. . */ @org.junit.Test public void fnNilled5() { final XQuery query = new XQuery( " fn:nilled()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of nilled function with argument set to an element node with xsi:nill = false. . */ @org.junit.Test public void fnNilled6() { final XQuery query = new XQuery( " fn:nilled()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of nilled function with argument set to an element node with xsi:nill = fn:true(). . */ @org.junit.Test public void fnNilled7() { final XQuery query = new XQuery( " fn:nilled()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of nilled function with argument set to an element node with xsi:nill = fn:false(). . */ @org.junit.Test public void fnNilled8() { final XQuery query = new XQuery( " fn:nilled()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of nilled function with more than one argument. . */ @org.junit.Test public void fnNilled9() { final XQuery query = new XQuery( " fn:nilled(,\"A Second Argument\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnNodeName.java000066400000000000000000000572551222453003200267370ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the node-name() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnNodeName extends QT3TestSet { /** * node-name() must be passed one argument, it doesn't use the context item by default in XPath 2.0. . */ @org.junit.Test public void kNodeNameFunc1() { xquery10(); final XQuery query = new XQuery( "node-name()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Written by: Frans Englich modified by Michael Kay node-name() does use the context item by default in XPath 3.0. . */ @org.junit.Test public void kNodeNameFunc1a() { final XQuery query = new XQuery( "node-name()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * A test whose essence is: `node-name((), "wrong param")`. . */ @org.junit.Test public void kNodeNameFunc2() { final XQuery query = new XQuery( "node-name((), \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(node-name(()))`. . */ @org.junit.Test public void kNodeNameFunc3() { final XQuery query = new XQuery( "empty(node-name(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke fn:node-name() with too many arguments. . */ @org.junit.Test public void k2NodeNameFunc1() { final XQuery query = new XQuery( "node-name(/*, ())", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Invoke fn:node-name() with an invalid argument. . */ @org.junit.Test public void k2NodeNameFunc2() { final XQuery query = new XQuery( "node-name(\"string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Check the return value of fn:node-name(). . */ @org.junit.Test public void k2NodeNameFunc3() { final XQuery query = new XQuery( "node-name(/*) instance of xs:QName", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check invalid inputs to fn:node-name(). . */ @org.junit.Test public void k3NodeNameFunc1() { final XQuery query = new XQuery( "node-name(3.3)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Check invalid multi-node input sequence to fn:node-name().. */ @org.junit.Test public void k3NodeNameFunc2() { final XQuery query = new XQuery( "node-name( (, ))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Check invalid mix node,item input sequence to fn:node-name().. */ @org.junit.Test public void k3NodeNameFunc3() { final XQuery query = new XQuery( "node-name( (, \"mystring\"))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Check invalid input sequence to fn:node-name() from fn:node-name() call.. */ @org.junit.Test public void k3NodeNameFunc4() { final XQuery query = new XQuery( "node-name( node-name())", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test fn:node-name on a comment(). . */ @org.junit.Test public void cbclNodeName001() { final XQuery query = new XQuery( "empty(node-name( comment { \"comments have no name \" } ) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of node function with argument set empty sequence. Use fn:count to avoid empty file . */ @org.junit.Test public void fnNodeName1() { final XQuery query = new XQuery( "fn:count(fn:node-name(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluation of node-name function with argument set to a computed constructed element node with no namespace declaration and one child. Use fn:local-name-from-qName to retrieve local part. . */ @org.junit.Test public void fnNodeName10() { final XQuery query = new XQuery( "fn:local-name-from-QName(fn:node-name(element elementName { element achild {\"some text\"}}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "elementName") ); } /** * Evaluation of node-name function with argument set to a computed constructed attribute node with value set to empty string. Use fn:local-name-from-qName to retrieve local name. . */ @org.junit.Test public void fnNodeName11() { final XQuery query = new XQuery( "fn:local-name-from-QName(fn:node-name(attribute attributeName {\"\"}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "attributeName") ); } /** * Evaluation of node-name function with argument set to a computed constructed attribute node with value set to a non empty value. Use fn:local-name-from-qName to retrieve local name. . */ @org.junit.Test public void fnNodeName12() { final XQuery query = new XQuery( "fn:local-name-from-QName(fn:node-name(attribute attributeName {\"an attribute value\"}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "attributeName") ); } /** * Evaluation of node-name function with argument set to a computed constructed attribute node with value set to a non empty value. Use fn:namespace-uri-from-qName to retrieve local name and fn:count. to avoid empty file. . */ @org.junit.Test public void fnNodeName13() { final XQuery query = new XQuery( "fn:count(fn:namespace-uri-from-QName(fn:node-name(attribute attributeName {\"an attribute value\"})))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluation of node-name function with argument set to a computed constructed document node with value set to the empty string. Use fn:local-name-from-qName to retrieve local name and fn:count to avoid empty file. . */ @org.junit.Test public void fnNodeName14() { final XQuery query = new XQuery( "fn:count(fn:local-name-from-QName(fn:node-name(document {\"\"})))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluation of node-name function with argument set to a computed constructed document node with value set to the empty string. Use fn:namspace-uri-from-qName to retrieve local name and fn:count to avoid empty file. . */ @org.junit.Test public void fnNodeName15() { final XQuery query = new XQuery( "fn:count(fn:namespace-uri-from-QName(fn:node-name(document {\"\"})))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluation of node-name function with argument set to a computed constructed document node with value set to the a non empty value. Use fn:local-name-from-qName to retrieve local name and fn:count to avoid empty file. . */ @org.junit.Test public void fnNodeName16() { final XQuery query = new XQuery( "fn:count(fn:local-name-from-QName(fn:node-name(document {\" text \"})))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluation of node-name function with argument set to a computed constructed document node with value set to the a non empty value. Use fn:namespace-uri-from-qName to retrieve local name and fn:count to avoid empty file. . */ @org.junit.Test public void fnNodeName17() { final XQuery query = new XQuery( "fn:count(fn:namespace-uri-from-QName(fn:node-name(document {\" text \"})))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluation of node-name function with argument set to a computed constructed text node with value set to the the empty string. Use fn:local-name-from-qName to retrieve local name and fn:count to avoid empty file. . */ @org.junit.Test public void fnNodeName18() { final XQuery query = new XQuery( "fn:count(fn:local-name-from-QName(fn:node-name(text {\"\"})))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluation of node-name function with argument set to a computed constructed text node with value set to the the empty string. Use fn:namespace-uri-from-qName to retrieve namespace and fn:count to avoid empty file. . */ @org.junit.Test public void fnNodeName19() { final XQuery query = new XQuery( "fn:count(fn:namespace-uri-from-QName(fn:node-name(text {\"\"})))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluation of node-name function with argument set to comment node. Use fn:count to avoid empty file . */ @org.junit.Test public void fnNodeName2() { final XQuery query = new XQuery( "fn:count(fn:node-name(/works[1]/employee[2]/child::text()[last()]))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluation of node-name function with argument set to a computed constructed text node with value set to a non empty value. Use fn:local-name-from-QName to retrieve local name and fn:count to avoid empty file. . */ @org.junit.Test public void fnNodeName20() { final XQuery query = new XQuery( "fn:count(fn:local-name-from-QName(fn:node-name(text {\"a text value\"})))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluation of node-name function with argument set to a computed constructed text node with value set to a non empty value. Use fn:namespace-uri-from-QName to retrieve namespace and fn:count to avoid empty file. . */ @org.junit.Test public void fnNodeName21() { final XQuery query = new XQuery( "fn:count(fn:namespace-uri-from-QName(fn:node-name(text {\"a text value\"})))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluation of node-name function with argument set to a computed constructed processing instruction node. Use fn:fn-local-name-from-QName to retrieve local name. . */ @org.junit.Test public void fnNodeName22() { final XQuery query = new XQuery( "fn:local-name-from-QName(fn:node-name(processing-instruction piName {\"Processing Instruction content\"}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "piName") ); } /** * Evaluation of node-name function with argument set to a computed constructed processing instruction node. Use fn:fn-namespace-uri-from-QName to retrieve namespace and fn:count to avoid empty file. . */ @org.junit.Test public void fnNodeName23() { final XQuery query = new XQuery( "fn:count(fn:namespace-uri-from-QName(fn:node-name(processing-instruction piName {\"Processing Instruction content\"})))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluation of node-name function with wrong number of arguments. . */ @org.junit.Test public void fnNodeName24() { final XQuery query = new XQuery( "fn:node-name(processing-instruction piName {\"Processing Instruction content\"},\"A Second Argument\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Evaluation of node-name function with no arguments on element node. . */ @org.junit.Test public void fnNodeName25() { final XQuery query = new XQuery( "/node-name()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("QName(\"http://example.com/ns\", \"node\")") ); } /** * Evaluation of node-name function with no arguments on attribute node. . */ @org.junit.Test public void fnNodeName26() { final XQuery query = new XQuery( "/@xml:space/node-name()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("QName(\"http://www.w3.org/XML/1998/namespace\", \"space\")") ); } /** * Evaluation of node-name function with no arguments on processing instruction node. . */ @org.junit.Test public void fnNodeName27() { final XQuery query = new XQuery( "/node-name()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("QName(\"\", \"test\")") ); } /** * Evaluation of node-name function with no arguments on namespace node. . */ @org.junit.Test public void fnNodeName28() { final XQuery query = new XQuery( "namespace{\"foo\"}{\"http://example.com/foo\"}/node-name()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("QName(\"\", \"foo\")") ); } /** * Evaluation of node-name function with no arguments on text node. . */ @org.junit.Test public void fnNodeName29() { final XQuery query = new XQuery( "abc/text()/node-name()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluation of node-name function with argument set to an element node. Uses local-name-from-QName to get local part . */ @org.junit.Test public void fnNodeName3() { final XQuery query = new XQuery( "fn:local-name-from-QName(fn:node-name(/works[1]/employee[2]))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "employee") ); } /** * Evaluation of node-name function with no arguments on atomic value. . */ @org.junit.Test public void fnNodeName30() { final XQuery query = new XQuery( "79[node-name()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluation of node-name function with no arguments on function item. . */ @org.junit.Test public void fnNodeName31() { final XQuery query = new XQuery( "node-name#0!node-name()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluation of node-name function with no arguments with absent context. . */ @org.junit.Test public void fnNodeName32() { final XQuery query = new XQuery( "node-name()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Evaluation of node-name function with argument set to an element node. use local-name-from-QName to get the local part. . */ @org.junit.Test public void fnNodeName4() { final XQuery query = new XQuery( "fn:local-name-from-QName(fn:node-name())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "shoe") ); } /** * Evaluation of node-name function with argument set to comment node. Use of fn:count to avoid empty file. . */ @org.junit.Test public void fnNodeName5() { final XQuery query = new XQuery( "fn:count(fn:node-name())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluation of node-name function with argument set to a Processing Instruction node. Use local-name-from-QName to get local part . */ @org.junit.Test public void fnNodeName6() { final XQuery query = new XQuery( "fn:local-name-from-QName(fn:node-name())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "format") ); } /** * Evaluation of node-name function with argument set to a directly constructed element node with namespace declaration. Use namespace-uri-from-qName to retrive values from QName. . */ @org.junit.Test public void fnNodeName7() { final XQuery query = new XQuery( "fn:namespace-uri-from-QName(fn:node-name())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.com/examples") ); } /** * Evaluation of node-name function with argument set to a computed constructed element node with no namespace declaration and no children. Use local-name-from-qName to retrieve local part. . */ @org.junit.Test public void fnNodeName8() { final XQuery query = new XQuery( "fn:local-name-from-QName(fn:node-name(element elementName {}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "elementName") ); } /** * Evaluation of node-name function with argument set to a computed constructed element node with no namespace declaration and no children. Use fn:namespace-uri-from-qName to retrieve namespace. Should return empty string. Use fn:count to avoid empty file. . */ @org.junit.Test public void fnNodeName9() { final XQuery query = new XQuery( "fn:count(fn:namespace-uri-from-QName(fn:node-name(element elementName {})))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnNormalizeSpace.java000066400000000000000000000452011222453003200301510ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the fn:normalize-space function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnNormalizeSpace extends QT3TestSet { /** * A test whose essence is: `normalize-space("a string", "wrong param")`. . */ @org.junit.Test public void kNormalizeSpaceFunc1() { final XQuery query = new XQuery( "normalize-space(\"a string\", \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `if(false()) then normalize-space() else true()`. . */ @org.junit.Test public void kNormalizeSpaceFunc2() { final XQuery query = new XQuery( "if(false()) then normalize-space() else true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPDY0002") ) ); } /** * A test whose essence is: `normalize-space("foo") eq "foo"`. . */ @org.junit.Test public void kNormalizeSpaceFunc3() { final XQuery query = new XQuery( "normalize-space(\"foo\") eq \"foo\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `normalize-space(" foo") eq "foo"`. . */ @org.junit.Test public void kNormalizeSpaceFunc4() { final XQuery query = new XQuery( "normalize-space(\" foo\") eq \"foo\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `normalize-space("foo ") eq "foo"`. . */ @org.junit.Test public void kNormalizeSpaceFunc5() { final XQuery query = new XQuery( "normalize-space(\"foo \") eq \"foo\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `normalize-space(()) eq ""`. . */ @org.junit.Test public void kNormalizeSpaceFunc6() { final XQuery query = new XQuery( "normalize-space(()) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `normalize-space("f o o ") eq "f o o"`. . */ @org.junit.Test public void kNormalizeSpaceFunc7() { final XQuery query = new XQuery( "normalize-space(\"f o o \") eq \"f o o\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `normalize-space(" 143 1239 fhjkls ") eq "143 1239 fhjkls"`. . */ @org.junit.Test public void kNormalizeSpaceFunc8() { final XQuery query = new XQuery( "normalize-space(\" 143 1239 fhjkls \") eq \"143 1239 fhjkls\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke normalize-space on itself. Implementations supporting the static typing feature may raise XPTY0004. . */ @org.junit.Test public void kNormalizeSpaceFunc9() { final XQuery query = new XQuery( "normalize-space(normalize-space((\"foo\", current-time())[1])) eq \"foo\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * Evaluation of fn-normalize-space function as per example 1 for this function from the Functions and Operators specs. . */ @org.junit.Test public void fnNormalizeSpace1() { final XQuery query = new XQuery( "fn:normalize-space(\" The wealthy curled darlings of our nation. \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "The wealthy curled darlings of our nation.") ); } /** * Evaluation of fn-normalize-space function with argument string containing only a single space. Use fn:count to avoid empty file . */ @org.junit.Test public void fnNormalizeSpace10() { final XQuery query = new XQuery( "fn:normalize-space(\" \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * Evaluation of fn-normalize-space function with argument string containing the zero length string. Use fn:count to avoid empty file . */ @org.junit.Test public void fnNormalizeSpace11() { final XQuery query = new XQuery( "fn:normalize-space(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * Evaluation of fn-normalize-space function with argument string containing a single tab character. Use fn:count to avoid empty file . */ @org.junit.Test public void fnNormalizeSpace12() { final XQuery query = new XQuery( "fn:normalize-space(\"\t\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * Evaluation of fn-normalize-space function with argument string containing only tab characters. Use fn:count to avoid empty file . */ @org.junit.Test public void fnNormalizeSpace13() { final XQuery query = new XQuery( "fn:normalize-space(\"\t\t\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * Evaluation of fn-normalize-space function with argument string containing only a single newline character. Use fn:count to avoid empty file . */ @org.junit.Test public void fnNormalizeSpace14() { final XQuery query = new XQuery( "fn:normalize-space(\"\n" + "\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * Evaluation of fn-normalize-space function with argument string containing only multiple newline characters. Use fn:count to avoid empty file . */ @org.junit.Test public void fnNormalizeSpace15() { final XQuery query = new XQuery( "fn:normalize-space(\"\r\n" + "\r\n" + "\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * Evaluation of fn-normalize-space function with argument string containing only spaces and tab characters. Use fn:count to avoid empty file . */ @org.junit.Test public void fnNormalizeSpace16() { final XQuery query = new XQuery( "fn:normalize-space(\" \t \t \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * Evaluation of fn-normalize-space function with argument string containing only spaces and newline characters. Use fn:count to avoid empty file . */ @org.junit.Test public void fnNormalizeSpace17() { final XQuery query = new XQuery( "fn:normalize-space(\" \r \n" + " \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * Evaluation of fn-normalize-space function with argument string containing only tab and newline characters. Use fn:count to avoid empty file . */ @org.junit.Test public void fnNormalizeSpace18() { final XQuery query = new XQuery( "fn:normalize-space(\"\t\n" + "\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * Evaluation of fn-normalize-space function with argument string containing tabs and numerical characters. Use fn:count to avoid empty file . */ @org.junit.Test public void fnNormalizeSpace19() { final XQuery query = new XQuery( "fn:normalize-space(\"\t12345\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12345") ); } /** * Evaluation of fn-normalize-space function with no arguments and no context node. . */ @org.junit.Test public void fnNormalizeSpace2() { final XQuery query = new XQuery( "fn:normalize-space()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Evaluation of fn-normalize-space function with argument referencing fn:string function. . */ @org.junit.Test public void fnNormalizeSpace20() { final XQuery query = new XQuery( "fn:normalize-space(fn:string(\" ABC \"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ABC") ); } /** * Evaluation of fn-normalize-space function with argument set to another fn:normalize-space function. . */ @org.junit.Test public void fnNormalizeSpace21() { final XQuery query = new XQuery( "fn:normalize-space(fn:normalize-space(\" ABC\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ABC") ); } /** * Evaluation of fn-normalize-space function with argument containing one tab character. . */ @org.junit.Test public void fnNormalizeSpace3() { final XQuery query = new XQuery( "fn:normalize-space(\"This\ttext should contains no tabs\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "This text should contains no tabs") ); } /** * Evaluation of fn-normalize-space function with argument containing one newline character. . */ @org.junit.Test public void fnNormalizeSpace4() { final XQuery query = new XQuery( "fn:normalize-space(\"This text should contains\n" + "no newline characters.\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "This text should contains no newline characters.") ); } /** * Evaluation of fn-normalize-space function with argument containing multiple tab character. . */ @org.junit.Test public void fnNormalizeSpace5() { final XQuery query = new XQuery( "fn:normalize-space(\"This\ttext\tshould\tcontains\tno\ttab\tcharacters.\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "This text should contains no tab characters.") ); } /** * Evaluation of fn-normalize-space function with argument containing multiple newline characters. . */ @org.junit.Test public void fnNormalizeSpace6() { final XQuery query = new XQuery( "fn:normalize-space(\"This\n" + "text\n" + "should\n" + "contains\n" + "no\n" + "newline\n" + "characters.\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "This text should contains no newline characters.") ); } /** * Evaluation of fn-normalize-space function with argument containing a tab and a newline characters. . */ @org.junit.Test public void fnNormalizeSpace7() { final XQuery query = new XQuery( "fn:normalize-space(\"This text\tshould contains no tabs or\n" + "newline characters.\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "This text should contains no tabs or newline characters.") ); } /** * Evaluation of fn-normalize-space function with argument containing multiple tab and a newline characters. . */ @org.junit.Test public void fnNormalizeSpace8() { final XQuery query = new XQuery( "fn:normalize-space(\"This\t text\t should\t contains\n" + " no tabs or newline characters.\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "This text should contains no tabs or newline characters.") ); } /** * Evaluation of fn-normalize-space function with argument string containing only spaces. Use fn:count to avoid empty file . */ @org.junit.Test public void fnNormalizeSpace9() { final XQuery query = new XQuery( "fn:normalize-space(\" \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * Test normalize-space without argument . */ @org.junit.Test public void fnNormalizeSpace0args1() { final XQuery query = new XQuery( "//doc/normalize-space(zero-or-one(a[normalize-space() = 'Hello, How are you?']))", ctx); try { query.context(node(file("fn/normalize-space/textWithSpaces.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Hello, How are you?") ); } /** * Evaluates The "normalize-space" function with the arguments set as follows: $arg = notNormalizedString(lower bound) . */ @org.junit.Test public void fnNormalizeSpace1args1() { final XQuery query = new XQuery( "fn:normalize-space(\"This is a charac\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "This is a charac") ); } /** * Evaluates The "normalize-space" function with the arguments set as follows: $arg = notNormalizedString(mid range) . */ @org.junit.Test public void fnNormalizeSpace1args2() { final XQuery query = new XQuery( "fn:normalize-space(\"This is a ch\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "This is a ch") ); } /** * Evaluates The "normalize-space" function with the arguments set as follows: $arg = notNormalizedString(upper bound) . */ @org.junit.Test public void fnNormalizeSpace1args3() { final XQuery query = new XQuery( "fn:normalize-space(\"This is a charac\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "This is a charac") ); } /** * Test normalize-space with an empty sequence argument . */ @org.junit.Test public void fnNormalizeSpace1args4() { final XQuery query = new XQuery( "normalize-space(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertType("xs:string") && assertCount(1) ) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnNormalizeUnicode.java000066400000000000000000000506211222453003200305060ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the normalize-unicode() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnNormalizeUnicode extends QT3TestSet { /** * A test whose essence is: `normalize-unicode()`. . */ @org.junit.Test public void kNormalizeUnicodeFunc1() { final XQuery query = new XQuery( "normalize-unicode()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `normalize-unicode("foo", "") eq "foo"`. . */ @org.junit.Test public void kNormalizeUnicodeFunc10() { final XQuery query = new XQuery( "normalize-unicode(\"foo\", \"\") eq \"foo\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `normalize-unicode("f oo") eq "f oo"`. . */ @org.junit.Test public void kNormalizeUnicodeFunc11() { final XQuery query = new XQuery( "normalize-unicode(\"f oo\") eq \"f oo\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `normalize-unicode("f oo", "NFC") eq "f oo"`. . */ @org.junit.Test public void kNormalizeUnicodeFunc12() { final XQuery query = new XQuery( "normalize-unicode(\"f oo\", \"NFC\") eq \"f oo\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Static typing implementations may raise XPTY0004. See http://www.w3.org/Bugs/Public/show_bug.cgi?id=4551 for details. . */ @org.junit.Test public void kNormalizeUnicodeFunc13() { final XQuery query = new XQuery( "normalize-unicode((\"a string\", error()), \"NFC\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FOER0000") || error("XPTY0004") ) ); } /** * A test whose essence is: `normalize-unicode("a string", "NFC", "wrong param")`. . */ @org.junit.Test public void kNormalizeUnicodeFunc2() { final XQuery query = new XQuery( "normalize-unicode(\"a string\", \"NFC\", \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `normalize-unicode("a string", "example.com/notSupported/")`. . */ @org.junit.Test public void kNormalizeUnicodeFunc3() { final XQuery query = new XQuery( "normalize-unicode(\"a string\", \"example.com/notSupported/\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0003") ); } /** * A test whose essence is: `normalize-unicode("foo") eq "foo"`. . */ @org.junit.Test public void kNormalizeUnicodeFunc4() { final XQuery query = new XQuery( "normalize-unicode(\"foo\") eq \"foo\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `normalize-unicode("foo", "NFC") eq "foo"`. . */ @org.junit.Test public void kNormalizeUnicodeFunc5() { final XQuery query = new XQuery( "normalize-unicode(\"foo\", \"NFC\") eq \"foo\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `normalize-unicode("foo", "NFD") eq "foo"`. . */ @org.junit.Test public void kNormalizeUnicodeFunc6() { final XQuery query = new XQuery( "normalize-unicode(\"foo\", \"NFD\") eq \"foo\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `normalize-unicode("foo", "NFKD") eq "foo"`. . */ @org.junit.Test public void kNormalizeUnicodeFunc7() { final XQuery query = new XQuery( "normalize-unicode(\"foo\", \"NFKD\") eq \"foo\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `normalize-unicode("foo", "NFKC") eq "foo"`. . */ @org.junit.Test public void kNormalizeUnicodeFunc8() { final XQuery query = new XQuery( "normalize-unicode(\"foo\", \"NFKC\") eq \"foo\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `normalize-unicode("f oo", "") eq "f oo"`. . */ @org.junit.Test public void kNormalizeUnicodeFunc9() { final XQuery query = new XQuery( "normalize-unicode(\"f oo\", \"\") eq \"f oo\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Tests boolean(normalize-unicode(...)) . */ @org.junit.Test public void cbclFnNormalizeUnicode002() { final XQuery query = new XQuery( "boolean(normalize-unicode(\"blah\",\"NFC\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Tests boolean(normalize-unicode(....)) with an error thrown . */ @org.junit.Test public void cbclFnNormalizeUnicode003() { final XQuery query = new XQuery( "boolean(normalize-unicode(\"blah\",\"ZZZ\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0003") ); } /** * tests normalize-unicode on empty . */ @org.junit.Test public void cbclFnNormalizeUnicode004() { final XQuery query = new XQuery( "normalize-unicode((),\"NFC\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * Tests normalize-unicode on empty . */ @org.junit.Test public void cbclFnNormalizeUnicode005() { final XQuery query = new XQuery( "normalize-unicode(\"\",\"NFC\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * Evaluation of fn:normalize-unicode to ensure that " NFC " is the same as "NFC". . */ @org.junit.Test public void fnNormalizeUnicode1() { final XQuery query = new XQuery( "fn:concat(fn:normalize-unicode(\"Ã…\",\" NFC \"),fn:normalize-unicode(\"Ã…\",\"NFC\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Ã…Ã…") ); } /** * Evaluation of fn:normalize-unicode with noncharacters in argument . */ @org.junit.Test public void fnNormalizeUnicode10() { final XQuery query = new XQuery( "string-to-codepoints(fn:normalize-unicode('eï·Ì‚'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("101, 64976, 770") ); } /** * Bug 7935: normalize-unicode() applied to unassigned codepoints * Result should be empty, indicating that normalization is idempotent on these * characters derived from the Unicode 5.2 database - essentially a list of characters * that are legal in XML but undefined in Unicode 5.2 . */ @org.junit.Test public void fnNormalizeUnicode11() { final XQuery query = new XQuery( queryFile( file( "fn/normalize-unicode/fn-normalize-unicode-11.xq" ) ), ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Evaluation of fn:normalize-unicode with a normalization form that attempts to raise a non-implemented form . */ @org.junit.Test public void fnNormalizeUnicode2() { final XQuery query = new XQuery( "fn:normalize-unicode(\"è\",\"chancesareyoudonotsupportthis123ifyoudowaoo\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0003") ); } /** * Evaluation of fn:normalize-unicode with nothing to normalize and used as argument to fn:upper-case . */ @org.junit.Test public void fnNormalizeUnicode3() { final XQuery query = new XQuery( "fn:upper-case(fn:normalize-unicode(\"normalizedstring\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NORMALIZEDSTRING") ); } /** * Evaluation of fn:normalize-unicode with nothing to normalize and used as argument to fn:lower-case . */ @org.junit.Test public void fnNormalizeUnicode4() { final XQuery query = new XQuery( "fn:lower-case(fn:normalize-unicode(\"NORMALIZEDSTRING\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "normalizedstring") ); } /** * Evaluation of fn:normalize-unicode with nothing to normalize and used as argument to fn:string-length . */ @org.junit.Test public void fnNormalizeUnicode5() { final XQuery query = new XQuery( "fn:string-length(fn:normalize-unicode(\"NORMALIZEDSTRING\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "16") ); } /** * Evaluation of fn:normalize-unicode with nothing to normalize and used as argument to fn:concat . */ @org.junit.Test public void fnNormalizeUnicode6() { final XQuery query = new XQuery( "fn:concat(fn:normalize-unicode(\"NORMALIZEDSTRING\"),\"another string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NORMALIZEDSTRINGanother string") ); } /** * Evaluation of fn:normalize-unicode with nothing to normalize and used as argument to fn:substring . */ @org.junit.Test public void fnNormalizeUnicode7() { final XQuery query = new XQuery( "fn:substring(fn:normalize-unicode(\"NORMALIZEDSTRING\"),5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ALIZEDSTRING") ); } /** * Evaluation of fn:normalize-unicode with noncharacter argument . */ @org.junit.Test public void fnNormalizeUnicode8() { final XQuery query = new XQuery( "string-to-codepoints(normalize-unicode('ï·'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "64976") ); } /** * Evaluation of fn:normalize-unicode with noncharacters in argument . */ @org.junit.Test public void fnNormalizeUnicode9() { final XQuery query = new XQuery( "string-to-codepoints(fn:normalize-unicode('eÌ‚ï·eÌ‚ï·eÌ‚'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("234, 64976, 234, 64976, 234") ); } /** * Test normalize-unicode with simple text input . */ @org.junit.Test public void fnNormalizeUnicode1args1() { final XQuery query = new XQuery( "normalize-unicode('Nothing to normalize.')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Nothing to normalize.") ); } /** * Test normalize-unicode with empty sequence argument . */ @org.junit.Test public void fnNormalizeUnicode1args2() { final XQuery query = new XQuery( "normalize-unicode(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * Test fn:normalize-unicode on combining characters for LATIN CAPITAL LETTER A WITH RING (w/ ACUTE) and ANGSTROM SIGN . */ @org.junit.Test public void fnNormalizeUnicode1args3() { final XQuery query = new XQuery( "matches('Ǻ', normalize-unicode('AÌŠÌ'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test fn:normalize-unicode on combining characters for LATIN CAPITAL LETTER A WITH RING (w/ ACUTE) and ANGSTROM SIGN . */ @org.junit.Test public void fnNormalizeUnicode1args4() { final XQuery query = new XQuery( "matches('Ã…', normalize-unicode('AÌŠ'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test fn:normalize-unicode on combining characters for LATIN CAPITAL LETTER A WITH RING (w/ ACUTE) and ANGSTROM SIGN . */ @org.junit.Test public void fnNormalizeUnicode1args5() { final XQuery query = new XQuery( "matches('AÌŠ', normalize-unicode('AÌŠ'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test fn:normalize-unicode on combining characters for LATIN CAPITAL LETTER A WITH RING (w/ ACUTE) and ANGSTROM SIGN . */ @org.junit.Test public void fnNormalizeUnicode1args6() { final XQuery query = new XQuery( "(normalize-unicode('Ã…') eq normalize-unicode('â„«'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test normalize-unicode with invalid argument types . */ @org.junit.Test public void fnNormalizeUnicode1args7() { final XQuery query = new XQuery( "normalize-unicode(12)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test normalize-unicode with incorrect arity . */ @org.junit.Test public void fnNormalizeUnicode1args8() { final XQuery query = new XQuery( "normalize-unicode('','','')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Test normalize-unicode with simple text input and NFC . */ @org.junit.Test public void fnNormalizeUnicode2args1() { final XQuery query = new XQuery( "normalize-unicode('Nothing to normalize.', 'NFC')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Nothing to normalize.") ); } /** * Test normalize-unicode with simple text input and NFC spelled differently . */ @org.junit.Test public void fnNormalizeUnicode2args2() { final XQuery query = new XQuery( "normalize-unicode('Nothing to normalize.', 'nFc')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Nothing to normalize.") ); } /** * Test normalize-unicode with empty sequence argument and NFC . */ @org.junit.Test public void fnNormalizeUnicode2args3() { final XQuery query = new XQuery( "normalize-unicode((), 'NFC')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * Test fn:normalize-unicode where the second argument is the zero-length string, no normalization is performed . */ @org.junit.Test public void fnNormalizeUnicode2args4() { final XQuery query = new XQuery( "(normalize-unicode('Ã…', '') eq normalize-unicode('â„«', ''))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test normalize-unicode with invalid argument types . */ @org.junit.Test public void fnNormalizeUnicode2args5() { final XQuery query = new XQuery( "normalize-unicode('',())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test normalize-unicode with invalid argument types . */ @org.junit.Test public void fnNormalizeUnicode2args6() { final XQuery query = new XQuery( "normalize-unicode('',12)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnNot.java000066400000000000000000001057221222453003200260020ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** . * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnNot extends QT3TestSet { /** * K-NotFunc-1 A test whose essence is: `not()`. . */ @org.junit.Test public void kNotFunc1() { final XQuery query = new XQuery( "not()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * K-NotFunc-10 fn:not() combined with fn:boolean(). . */ @org.junit.Test public void kNotFunc10() { final XQuery query = new XQuery( "not(fn:boolean((1, 2, 3, current-time())[1] treat as xs:integer)) eq false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * K-NotFunc-2 A test whose essence is: `not(1, 2, 3, 4, 5, 6)`. . */ @org.junit.Test public void kNotFunc2() { final XQuery query = new XQuery( "not(1, 2, 3, 4, 5, 6)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * K-NotFunc-3 A test whose essence is: `not(false() and false())`. . */ @org.junit.Test public void kNotFunc3() { final XQuery query = new XQuery( "not(false() and false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * K-NotFunc-4 A test whose essence is: `not(not(true()))`. . */ @org.junit.Test public void kNotFunc4() { final XQuery query = new XQuery( "not(not(true()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * K-NotFunc-5 A test whose essence is: `not(false())`. . */ @org.junit.Test public void kNotFunc5() { final XQuery query = new XQuery( "not(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * K-NotFunc-6 A test whose essence is: `not(0)`. . */ @org.junit.Test public void kNotFunc6() { final XQuery query = new XQuery( "not(0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * K-NotFunc-7 A test whose essence is: `not(())`. . */ @org.junit.Test public void kNotFunc7() { final XQuery query = new XQuery( "not(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * K-NotFunc-8 A test whose essence is: `not(xs:anyURI(""))`. . */ @org.junit.Test public void kNotFunc8() { final XQuery query = new XQuery( "not(xs:anyURI(\"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * K-NotFunc-9 A test whose essence is: `not(not(xs:anyURI("example.com/")))`. . */ @org.junit.Test public void kNotFunc9() { final XQuery query = new XQuery( "not(not(xs:anyURI(\"example.com/\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:not on a sequence of one or more nodes . */ @org.junit.Test public void cbclNot001() { final XQuery query = new XQuery( "fn:not(for $x in 1 to 10 return {$x})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:not on the empty sequence . */ @org.junit.Test public void cbclNot002() { final XQuery query = new XQuery( "fn:not(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:not on a context-sensitive comparison . */ @org.junit.Test public void cbclNot003() { final XQuery query = new XQuery( "fn:not(current-date() > xs:date(\"1997-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:not on fn:not . */ @org.junit.Test public void cbclNot004() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) as xs:integer { $x }; \n" + " \tnot(not(local:f(1)))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:not on fn:exists . */ @org.junit.Test public void cbclNot005() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) as xs:integer* { 1 to $x }; \n" + " \tnot(exists(local:f(0)))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void fnNot1() { final XQuery query = new XQuery( "fn:not(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * comparison expression involving the "ge" operator.. */ @org.junit.Test public void fnNot10() { final XQuery query = new XQuery( "fn:not(\"true\") ge fn:not(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * comparison expression involving the "=" operator.. */ @org.junit.Test public void fnNot11() { final XQuery query = new XQuery( "fn:not(\"true\") = fn:not(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * comparison expression involving the "!=" operator.. */ @org.junit.Test public void fnNot12() { final XQuery query = new XQuery( "fn:not(\"true\") != fn:not(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * comparison expression involving the "<" operator.. */ @org.junit.Test public void fnNot13() { final XQuery query = new XQuery( "fn:not(\"true\") < fn:not(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * comparison expression involving the "<=" operator.. */ @org.junit.Test public void fnNot14() { final XQuery query = new XQuery( "fn:not(\"true\") <= fn:not(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * comparison expression involving the ">" operator.. */ @org.junit.Test public void fnNot15() { final XQuery query = new XQuery( "fn:not(\"true\") > fn:not(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * comparison expression involving the ">=" operator.. */ @org.junit.Test public void fnNot16() { final XQuery query = new XQuery( "fn:not(\"true\") >= fn:not(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * to an "xs:boolean" function.. */ @org.junit.Test public void fnNot17() { final XQuery query = new XQuery( "xs:boolean(fn:not(\"true\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * to an "fn:string" function.. */ @org.junit.Test public void fnNot18() { final XQuery query = new XQuery( "fn:string(fn:not(\"true\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'false'") ); } /** * an "fn:concat" function.. */ @org.junit.Test public void fnNot19() { final XQuery query = new XQuery( "fn:concat(xs:string(fn:not(\"true\")),xs:string(fn:not(\"true\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'falsefalse'") ); } /** * fn:not function.. */ @org.junit.Test public void fnNot2() { final XQuery query = new XQuery( "fn:not(\"fn:not()\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * an "fn:contains" function.. */ @org.junit.Test public void fnNot20() { final XQuery query = new XQuery( "fn:contains(xs:string(fn:not(\"true\")),xs:string(fn:not(\"true\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * to an "fn:string-length" function.. */ @org.junit.Test public void fnNot21() { final XQuery query = new XQuery( "fn:string-length(xs:string(fn:not(\"true\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** . */ @org.junit.Test public void fnNot24() { final XQuery query = new XQuery( "not(xs:double('NaN'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void fnNot25() { final XQuery query = new XQuery( "not(xs:float('NaN'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void fnNot26() { final XQuery query = new XQuery( "not(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * boolean. */ @org.junit.Test public void fnNot27() { final XQuery query = new XQuery( "not((true(), false()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * expression involving the "and" operator.. */ @org.junit.Test public void fnNot3() { final XQuery query = new XQuery( "fn:not(\"true\") and fn:not(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * expression involving the "or" operator.. */ @org.junit.Test public void fnNot4() { final XQuery query = new XQuery( "fn:not(\"true\") or fn:not(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * expression involving the "eq" operator.. */ @org.junit.Test public void fnNot5() { final XQuery query = new XQuery( "fn:not(\"true\") eq fn:not(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * expression involving the "ne" operator.. */ @org.junit.Test public void fnNot6() { final XQuery query = new XQuery( "fn:not(\"true\") ne fn:not(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * expression involving the "lt" operator.. */ @org.junit.Test public void fnNot7() { final XQuery query = new XQuery( "fn:not(\"true\") lt fn:not(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * expression involving the "le" operator.. */ @org.junit.Test public void fnNot8() { final XQuery query = new XQuery( "fn:not(\"true\") le fn:not(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * expression involving the "gt" operator.. */ @org.junit.Test public void fnNot9() { final XQuery query = new XQuery( "fn:not(\"true\") gt fn:not(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notdbl1args-1 The "not" function with the arguments set as follows: $arg = xs:double(lower bound) . */ @org.junit.Test public void fnNotdbl1args1() { final XQuery query = new XQuery( "fn:not(xs:double(\"-1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notdbl1args-2 The "not" function with the arguments set as follows: $arg = xs:double(mid range) . */ @org.junit.Test public void fnNotdbl1args2() { final XQuery query = new XQuery( "fn:not(xs:double(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * notdbl1args-3 The "not" function with the arguments set as follows: $arg = xs:double(upper bound) . */ @org.junit.Test public void fnNotdbl1args3() { final XQuery query = new XQuery( "fn:not(xs:double(\"1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notdec1args-1 The "not" function with the arguments set as follows: $arg = xs:decimal(lower bound) . */ @org.junit.Test public void fnNotdec1args1() { final XQuery query = new XQuery( "fn:not(xs:decimal(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notdec1args-2 The "not" function with the arguments set as follows: $arg = xs:decimal(mid range) . */ @org.junit.Test public void fnNotdec1args2() { final XQuery query = new XQuery( "fn:not(xs:decimal(\"617375191608514839\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notdec1args-3 The "not" function with the arguments set as follows: $arg = xs:decimal(upper bound) . */ @org.junit.Test public void fnNotdec1args3() { final XQuery query = new XQuery( "fn:not(xs:decimal(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notflt1args-1 The "not" function with the arguments set as follows: $arg = xs:float(lower bound) . */ @org.junit.Test public void fnNotflt1args1() { final XQuery query = new XQuery( "fn:not(xs:float(\"-3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notflt1args-2 The "not" function with the arguments set as follows: $arg = xs:float(mid range) . */ @org.junit.Test public void fnNotflt1args2() { final XQuery query = new XQuery( "fn:not(xs:float(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * notflt1args-3 The "not" function with the arguments set as follows: $arg = xs:float(upper bound) . */ @org.junit.Test public void fnNotflt1args3() { final XQuery query = new XQuery( "fn:not(xs:float(\"3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notint1args-1 The "not" function with the arguments set as follows: $arg = xs:int(lower bound) . */ @org.junit.Test public void fnNotint1args1() { final XQuery query = new XQuery( "fn:not(xs:int(\"-2147483648\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notint1args-2 The "not" function with the arguments set as follows: $arg = xs:int(mid range) . */ @org.junit.Test public void fnNotint1args2() { final XQuery query = new XQuery( "fn:not(xs:int(\"-1873914410\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notint1args-3 The "not" function with the arguments set as follows: $arg = xs:int(upper bound) . */ @org.junit.Test public void fnNotint1args3() { final XQuery query = new XQuery( "fn:not(xs:int(\"2147483647\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notintg1args-1 The "not" function with the arguments set as follows: $arg = xs:integer(lower bound) . */ @org.junit.Test public void fnNotintg1args1() { final XQuery query = new XQuery( "fn:not(xs:integer(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notintg1args-2 The "not" function with the arguments set as follows: $arg = xs:integer(mid range) . */ @org.junit.Test public void fnNotintg1args2() { final XQuery query = new XQuery( "fn:not(xs:integer(\"830993497117024304\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notintg1args-3 The "not" function with the arguments set as follows: $arg = xs:integer(upper bound) . */ @org.junit.Test public void fnNotintg1args3() { final XQuery query = new XQuery( "fn:not(xs:integer(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notlng1args-1 The "not" function with the arguments set as follows: $arg = xs:long(lower bound) . */ @org.junit.Test public void fnNotlng1args1() { final XQuery query = new XQuery( "fn:not(xs:long(\"-92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notlng1args-2 The "not" function with the arguments set as follows: $arg = xs:long(mid range) . */ @org.junit.Test public void fnNotlng1args2() { final XQuery query = new XQuery( "fn:not(xs:long(\"-47175562203048468\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notlng1args-3 The "not" function with the arguments set as follows: $arg = xs:long(upper bound) . */ @org.junit.Test public void fnNotlng1args3() { final XQuery query = new XQuery( "fn:not(xs:long(\"92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notnint1args-1 The "not" function with the arguments set as follows: $arg = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnNotnint1args1() { final XQuery query = new XQuery( "fn:not(xs:negativeInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notnint1args-2 The "not" function with the arguments set as follows: $arg = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnNotnint1args2() { final XQuery query = new XQuery( "fn:not(xs:negativeInteger(\"-297014075999096793\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notnint1args-3 The "not" function with the arguments set as follows: $arg = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnNotnint1args3() { final XQuery query = new XQuery( "fn:not(xs:negativeInteger(\"-1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notnni1args-1 The "not" function with the arguments set as follows: $arg = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnNotnni1args1() { final XQuery query = new XQuery( "fn:not(xs:nonNegativeInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * notnni1args-2 The "not" function with the arguments set as follows: $arg = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnNotnni1args2() { final XQuery query = new XQuery( "fn:not(xs:nonNegativeInteger(\"303884545991464527\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notnni1args-3 The "not" function with the arguments set as follows: $arg = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnNotnni1args3() { final XQuery query = new XQuery( "fn:not(xs:nonNegativeInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notnpi1args-1 The "not" function with the arguments set as follows: $arg = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnNotnpi1args1() { final XQuery query = new XQuery( "fn:not(xs:nonPositiveInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notnpi1args-2 The "not" function with the arguments set as follows: $arg = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnNotnpi1args2() { final XQuery query = new XQuery( "fn:not(xs:nonPositiveInteger(\"-475688437271870490\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notnpi1args-3 The "not" function with the arguments set as follows: $arg = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnNotnpi1args3() { final XQuery query = new XQuery( "fn:not(xs:nonPositiveInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * notpint1args-1 The "not" function with the arguments set as follows: $arg = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnNotpint1args1() { final XQuery query = new XQuery( "fn:not(xs:positiveInteger(\"1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notpint1args-2 The "not" function with the arguments set as follows: $arg = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnNotpint1args2() { final XQuery query = new XQuery( "fn:not(xs:positiveInteger(\"52704602390610033\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notpint1args-3 The "not" function with the arguments set as follows: $arg = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnNotpint1args3() { final XQuery query = new XQuery( "fn:not(xs:positiveInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notsht1args-1 The "not" function with the arguments set as follows: $arg = xs:short(lower bound) . */ @org.junit.Test public void fnNotsht1args1() { final XQuery query = new XQuery( "fn:not(xs:short(\"-32768\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notsht1args-2 The "not" function with the arguments set as follows: $arg = xs:short(mid range) . */ @org.junit.Test public void fnNotsht1args2() { final XQuery query = new XQuery( "fn:not(xs:short(\"-5324\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notsht1args-3 The "not" function with the arguments set as follows: $arg = xs:short(upper bound) . */ @org.junit.Test public void fnNotsht1args3() { final XQuery query = new XQuery( "fn:not(xs:short(\"32767\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notulng1args-1 The "not" function with the arguments set as follows: $arg = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnNotulng1args1() { final XQuery query = new XQuery( "fn:not(xs:unsignedLong(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * notulng1args-2 The "not" function with the arguments set as follows: $arg = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnNotulng1args2() { final XQuery query = new XQuery( "fn:not(xs:unsignedLong(\"130747108607674654\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notulng1args-3 The "not" function with the arguments set as follows: $arg = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnNotulng1args3() { final XQuery query = new XQuery( "fn:not(xs:unsignedLong(\"184467440737095516\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notusht1args-1 The "not" function with the arguments set as follows: $arg = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnNotusht1args1() { final XQuery query = new XQuery( "fn:not(xs:unsignedShort(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * notusht1args-2 The "not" function with the arguments set as follows: $arg = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnNotusht1args2() { final XQuery query = new XQuery( "fn:not(xs:unsignedShort(\"44633\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * notusht1args-3 The "not" function with the arguments set as follows: $arg = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnNotusht1args3() { final XQuery query = new XQuery( "fn:not(xs:unsignedShort(\"65535\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnNumber.java000066400000000000000000001016061222453003200264670ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests the fn:number() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnNumber extends QT3TestSet { /** * A test whose essence is: `number(1, 2)`. . */ @org.junit.Test public void kNodeNumberFunc1() { final XQuery query = new XQuery( "number(1, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `fn:number(()) instance of xs:double`. . */ @org.junit.Test public void kNodeNumberFunc10() { final XQuery query = new XQuery( "fn:number(()) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(fn:number(()))`. . */ @org.junit.Test public void kNodeNumberFunc11() { final XQuery query = new XQuery( "not(fn:number(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:number() applied to a type which a cast regardless of source value never would succeed for. . */ @org.junit.Test public void kNodeNumberFunc12() { final XQuery query = new XQuery( "string(number(xs:anyURI(\"example.com/\"))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(number(xs:anyURI("1"))) eq "NaN"`. . */ @org.junit.Test public void kNodeNumberFunc13() { final XQuery query = new XQuery( "string(number(xs:anyURI(\"1\"))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(number("1")) eq "1"`. . */ @org.junit.Test public void kNodeNumberFunc14() { final XQuery query = new XQuery( "string(number(\"1\")) eq \"1\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(number(xs:gYear("2005"))) eq "NaN"`. . */ @org.junit.Test public void kNodeNumberFunc15() { final XQuery query = new XQuery( "string(number(xs:gYear(\"2005\"))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:number() inside a predicate. . */ @org.junit.Test public void kNodeNumberFunc16() { final XQuery query = new XQuery( "deep-equal((1, 2, 3)[number()], (1, 2, 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:number() inside a predicate(#2). . */ @org.junit.Test public void kNodeNumberFunc17() { final XQuery query = new XQuery( "(1)[number()] eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `fn:number(1) eq 1`. . */ @org.junit.Test public void kNodeNumberFunc2() { final XQuery query = new XQuery( "fn:number(1) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(fn:number("results in NaN"))`. . */ @org.junit.Test public void kNodeNumberFunc3() { final XQuery query = new XQuery( "not(fn:number(\"results in NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `fn:number("results in NaN") instance of xs:double`. . */ @org.junit.Test public void kNodeNumberFunc4() { final XQuery query = new XQuery( "fn:number(\"results in NaN\") instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `fn:number(1) instance of xs:double`. . */ @org.junit.Test public void kNodeNumberFunc5() { final XQuery query = new XQuery( "fn:number(1) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `fn:number(1.1) instance of xs:double`. . */ @org.junit.Test public void kNodeNumberFunc6() { final XQuery query = new XQuery( "fn:number(1.1) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `fn:number(xs:float(3)) instance of xs:double`. . */ @org.junit.Test public void kNodeNumberFunc7() { final XQuery query = new XQuery( "fn:number(xs:float(3)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `fn:number(xs:double(3)) instance of xs:double`. . */ @org.junit.Test public void kNodeNumberFunc8() { final XQuery query = new XQuery( "fn:number(xs:double(3)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `fn:number("NaN") instance of xs:double`. . */ @org.junit.Test public void kNodeNumberFunc9() { final XQuery query = new XQuery( "fn:number(\"NaN\") instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the fn:number function with empty sequence as an argument. . */ @org.junit.Test public void fnNumber1() { final XQuery query = new XQuery( "fn:number(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * number() applied to an untypedAtomic. */ @org.junit.Test public void fnNumber10() { final XQuery query = new XQuery( "number(xs:untypedAtomic(\"1000\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertType("xs:double") && assertEq("1e3") ) ); } /** * Evaluation of the fn:number function with a string set as an argument. . */ @org.junit.Test public void fnNumber2() { final XQuery query = new XQuery( "fn:number(\"A String\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Evaluation of the fn:number function with an undefined context node. . */ @org.junit.Test public void fnNumber3() { final XQuery query = new XQuery( "fn:number()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Evaluation of the fn:number function with an undefined context node and argument set to ".". . */ @org.junit.Test public void fnNumber4() { final XQuery query = new XQuery( "fn:number(.)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * number() applied to a boolean. */ @org.junit.Test public void fnNumber5() { final XQuery query = new XQuery( "number(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertType("xs:double") && assertEq("1.0e0") ) ); } /** * number() applied to a boolean. */ @org.junit.Test public void fnNumber6() { final XQuery query = new XQuery( "number(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertType("xs:double") && assertEq("0.0e0") ) ); } /** * number() applied to a duration. */ @org.junit.Test public void fnNumber7() { final XQuery query = new XQuery( "number(implicit-timezone())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertType("xs:double") && assertStringValue(false, "NaN") ) ); } /** * number() applied to a string with whitespace. */ @org.junit.Test public void fnNumber8() { final XQuery query = new XQuery( "number(\" -22e0 \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertType("xs:double") && assertEq("-22e0") ) ); } /** * number() applied to a string with leading plus sign. */ @org.junit.Test public void fnNumber9() { final XQuery query = new XQuery( "number(\"+22e0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertType("xs:double") && assertEq("2.2e1") ) ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:double(lower bound) . */ @org.junit.Test public void fnNumberdbl1args1() { final XQuery query = new XQuery( "fn:number(xs:double(\"-1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.7976931348623157E308") ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:double(mid range) . */ @org.junit.Test public void fnNumberdbl1args2() { final XQuery query = new XQuery( "fn:number(xs:double(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:double(upper bound) . */ @org.junit.Test public void fnNumberdbl1args3() { final XQuery query = new XQuery( "fn:number(xs:double(\"1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.7976931348623157E308") ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:decimal(lower bound) . */ @org.junit.Test public void fnNumberdec1args1() { final XQuery query = new XQuery( "fn:number(xs:decimal(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.0E18") ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:decimal(mid range) . */ @org.junit.Test public void fnNumberdec1args2() { final XQuery query = new XQuery( "fn:number(xs:decimal(\"617375191608514839\")) eq 617375191608514839", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:decimal(upper bound) . */ @org.junit.Test public void fnNumberdec1args3() { final XQuery query = new XQuery( "fn:number(xs:decimal(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.0E18") ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:float(lower bound) . */ @org.junit.Test public void fnNumberflt1args1() { final XQuery query = new XQuery( "fn:number(xs:float(\"-3.4028235E38\")) eq -3.4028234663852885E38", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:float(mid range) . */ @org.junit.Test public void fnNumberflt1args2() { final XQuery query = new XQuery( "fn:number(xs:float(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:float(upper bound) . */ @org.junit.Test public void fnNumberflt1args3() { final XQuery query = new XQuery( "fn:number(xs:float(\"3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "3.4028234663852885E38") || assertStringValue(false, "3.402823466385289E38") || assertStringValue(false, "3.4028234663852886E38") ) ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:int(lower bound) . */ @org.junit.Test public void fnNumberint1args1() { final XQuery query = new XQuery( "fn:number(xs:int(\"-2147483648\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-2.147483648E9") ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:int(mid range) . */ @org.junit.Test public void fnNumberint1args2() { final XQuery query = new XQuery( "fn:number(xs:int(\"-1873914410\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.87391441E9") ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:int(upper bound) . */ @org.junit.Test public void fnNumberint1args3() { final XQuery query = new XQuery( "fn:number(xs:int(\"2147483647\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2.147483647E9") ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:integer(lower bound) . */ @org.junit.Test public void fnNumberintg1args1() { final XQuery query = new XQuery( "fn:number(xs:integer(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.0E18") ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:integer(mid range) . */ @org.junit.Test public void fnNumberintg1args2() { final XQuery query = new XQuery( "fn:number(xs:integer(\"830993497117024304\")) eq 830993497117024304", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:integer(upper bound) . */ @org.junit.Test public void fnNumberintg1args3() { final XQuery query = new XQuery( "fn:number(xs:integer(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.0E18") ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:long(lower bound) . */ @org.junit.Test public void fnNumberlng1args1() { final XQuery query = new XQuery( "fn:number(xs:long(\"-92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-9.223372036854776E16") ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:long(mid range) . */ @org.junit.Test public void fnNumberlng1args2() { final XQuery query = new XQuery( "fn:number(xs:long(\"-47175562203048468\")) eq -47175562203048468", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:long(upper bound) . */ @org.junit.Test public void fnNumberlng1args3() { final XQuery query = new XQuery( "fn:number(xs:long(\"92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9.223372036854776E16") ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnNumbernint1args1() { final XQuery query = new XQuery( "fn:number(xs:negativeInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.0E18") ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnNumbernint1args2() { final XQuery query = new XQuery( "fn:number(xs:negativeInteger(\"-297014075999096793\")) eq -297014075999096793", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnNumbernint1args3() { final XQuery query = new XQuery( "fn:number(xs:negativeInteger(\"-1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1") ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnNumbernni1args1() { final XQuery query = new XQuery( "fn:number(xs:nonNegativeInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnNumbernni1args2() { final XQuery query = new XQuery( "fn:number(xs:nonNegativeInteger(\"303884545991464527\")) eq 303884545991464527", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnNumbernni1args3() { final XQuery query = new XQuery( "fn:number(xs:nonNegativeInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.0E18") ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnNumbernpi1args1() { final XQuery query = new XQuery( "fn:number(xs:nonPositiveInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.0E18") ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnNumbernpi1args2() { final XQuery query = new XQuery( "fn:number(xs:nonPositiveInteger(\"-475688437271870490\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "-4.7568843727187049E17") || assertStringValue(false, "-4.756884372718705E17") || assertStringValue(false, "-4.7568843727187046E17") ) ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnNumbernpi1args3() { final XQuery query = new XQuery( "fn:number(xs:nonPositiveInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnNumberpint1args1() { final XQuery query = new XQuery( "fn:number(xs:positiveInteger(\"1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnNumberpint1args2() { final XQuery query = new XQuery( "fn:number(xs:positiveInteger(\"52704602390610033\")) eq 52704602390610033", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnNumberpint1args3() { final XQuery query = new XQuery( "fn:number(xs:positiveInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.0E18") ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:short(lower bound) . */ @org.junit.Test public void fnNumbersht1args1() { final XQuery query = new XQuery( "fn:number(xs:short(\"-32768\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-32768") ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:short(mid range) . */ @org.junit.Test public void fnNumbersht1args2() { final XQuery query = new XQuery( "fn:number(xs:short(\"-5324\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-5324") ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:short(upper bound) . */ @org.junit.Test public void fnNumbersht1args3() { final XQuery query = new XQuery( "fn:number(xs:short(\"32767\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "32767") ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnNumberulng1args1() { final XQuery query = new XQuery( "fn:number(xs:unsignedLong(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnNumberulng1args2() { final XQuery query = new XQuery( "fn:number(xs:unsignedLong(\"130747108607674654\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "1.3074710860767466E17") || assertStringValue(false, "1.30747108607674648E17") || assertStringValue(false, "1.30747108607674649E17") || assertStringValue(false, "1.3074710860767465E17") || assertStringValue(false, "1.30747108607674651E17") || assertStringValue(false, "1.30747108607674652E17") || assertStringValue(false, "1.30747108607674653E17") || assertStringValue(false, "1.30747108607674654E17") || assertStringValue(false, "1.30747108607674655E17") || assertStringValue(false, "1.30747108607674656E17") || assertStringValue(false, "1.30747108607674657E17") || assertStringValue(false, "1.30747108607674658E17") || assertStringValue(false, "1.30747108607674659E17") || assertStringValue(false, "1.30747108607674661E17") || assertStringValue(false, "1.30747108607674662E17") || assertStringValue(false, "1.30747108607674663E17") || assertStringValue(false, "1.30747108607674664E17") ) ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnNumberulng1args3() { final XQuery query = new XQuery( "fn:number(xs:unsignedLong(\"184467440737095516\")) eq 1.8446744073709551E17", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnNumberusht1args1() { final XQuery query = new XQuery( "fn:number(xs:unsignedShort(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnNumberusht1args2() { final XQuery query = new XQuery( "fn:number(xs:unsignedShort(\"44633\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "44633") ); } /** * Evaluates The "number" function with the arguments set as follows: $arg = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnNumberusht1args3() { final XQuery query = new XQuery( "fn:number(xs:unsignedShort(\"65535\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "65535") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnOneOrMore.java000066400000000000000000000701251222453003200271050ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the one-or-more() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnOneOrMore extends QT3TestSet { /** * A test whose essence is: `one-or-more(1, 2)`. . */ @org.junit.Test public void kSeqOneOrMoreFunc1() { final XQuery query = new XQuery( "one-or-more(1, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `one-or-more()`. . */ @org.junit.Test public void kSeqOneOrMoreFunc2() { final XQuery query = new XQuery( "one-or-more()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `one-or-more("one")`. . */ @org.junit.Test public void kSeqOneOrMoreFunc3() { final XQuery query = new XQuery( "one-or-more(\"one\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "one") ); } /** * A test whose essence is: `exists(one-or-more(("one", 2)))`. . */ @org.junit.Test public void kSeqOneOrMoreFunc4() { final XQuery query = new XQuery( "exists(one-or-more((\"one\", 2)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(one-or-more( "one" )) eq 1`. . */ @org.junit.Test public void kSeqOneOrMoreFunc5() { final XQuery query = new XQuery( "count(one-or-more( \"one\" )) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(one-or-more( (1, 2, 3, "four") )) eq 4`. . */ @org.junit.Test public void kSeqOneOrMoreFunc6() { final XQuery query = new XQuery( "count(one-or-more( (1, 2, 3, \"four\") )) eq 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `one-or-more(error())`. . */ @org.junit.Test public void kSeqOneOrMoreFunc7() { final XQuery query = new XQuery( "one-or-more(error())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * A test whose essence is: `one-or-more( () )`. . */ @org.junit.Test public void kSeqOneOrMoreFunc8() { final XQuery query = new XQuery( "one-or-more( () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0004") ); } /** * Have fn:one-or-more() as an operand to an expression that requires zero or more, that itself has cardinality zero or more. . */ @org.junit.Test public void k2SeqOneOrMoreFunc1() { final XQuery query = new XQuery( "codepoints-to-string(one-or-more(string-to-codepoints(\"foo\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "foo") ); } /** * test fn:one-or-more-one on a count-preserving function . */ @org.junit.Test public void cbclOneOrMore001() { final XQuery query = new XQuery( "\n" + " declare function local:generate($arg as xs:integer?) { if ($arg = 0) then (1, 2, 3) else $arg };\n" + " fn:one-or-more(fn:reverse( local:generate( 0 ) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3 2 1") ); } /** * test fn:one-or-more on a sequence of zero-or-one items . */ @org.junit.Test public void cbclOneOrMore002() { final XQuery query = new XQuery( "\n" + " declare function local:generate($arg as xs:integer?) { if ($arg = 0) then (1, 2, 3) else $arg };\n" + " fn:one-or-more(fn:zero-or-one( local:generate( () ) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0004") ); } /** * test fn:boolean on fn:one-or-more-one on a sequence of nodes . */ @org.junit.Test public void cbclOneOrMore003() { final XQuery query = new XQuery( "\n" + " boolean(one-or-more(for $x in 1 to month-from-date(current-date()) return ))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:boolean on fn:one-or-more-one on an empty sequence . */ @org.junit.Test public void cbclOneOrMore004() { final XQuery query = new XQuery( "boolean(one-or-more(month-from-date(current-date()) to 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0004") ); } /** * Tests boolean call on one-or-more . */ @org.junit.Test public void cbclOneOrMore005() { final XQuery query = new XQuery( "boolean(one-or-more((1 to 10)[. mod 2 = 0]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Tests one-or-more on zero items . */ @org.junit.Test public void cbclOneOrMore006() { final XQuery query = new XQuery( "one-or-more((1 to 10)[. div 2 = 0])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0004") ); } /** * Tests one or more on a single boolean value . */ @org.junit.Test public void cbclOneOrMore007() { final XQuery query = new XQuery( "\n" + " boolean(one-or-more(for $x in (1 to 10)[. div 2 = 1] return true()))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the fn:one-or-more function with argument set to empty sequence.. */ @org.junit.Test public void fnOneOrMore1() { final XQuery query = new XQuery( "fn:one-or-more(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0004") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:double(lower bound) . */ @org.junit.Test public void fnOneOrMoredbl1args1() { final XQuery query = new XQuery( "fn:one-or-more(xs:double(\"-1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.7976931348623157E308") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:double(mid range) . */ @org.junit.Test public void fnOneOrMoredbl1args2() { final XQuery query = new XQuery( "fn:one-or-more(xs:double(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:double(upper bound) . */ @org.junit.Test public void fnOneOrMoredbl1args3() { final XQuery query = new XQuery( "fn:one-or-more(xs:double(\"1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.7976931348623157E308") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:decimal(lower bound) . */ @org.junit.Test public void fnOneOrMoredec1args1() { final XQuery query = new XQuery( "fn:one-or-more(xs:decimal(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:decimal(mid range) . */ @org.junit.Test public void fnOneOrMoredec1args2() { final XQuery query = new XQuery( "fn:one-or-more(xs:decimal(\"617375191608514839\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "617375191608514839") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:decimal(upper bound) . */ @org.junit.Test public void fnOneOrMoredec1args3() { final XQuery query = new XQuery( "fn:one-or-more(xs:decimal(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "999999999999999999") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:float(lower bound) . */ @org.junit.Test public void fnOneOrMoreflt1args1() { final XQuery query = new XQuery( "fn:one-or-more(xs:float(\"-3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-3.4028235E38") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:float(mid range) . */ @org.junit.Test public void fnOneOrMoreflt1args2() { final XQuery query = new XQuery( "fn:one-or-more(xs:float(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:float(upper bound) . */ @org.junit.Test public void fnOneOrMoreflt1args3() { final XQuery query = new XQuery( "fn:one-or-more(xs:float(\"3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3.4028235E38") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:int(lower bound) . */ @org.junit.Test public void fnOneOrMoreint1args1() { final XQuery query = new XQuery( "fn:one-or-more(xs:int(\"-2147483648\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-2147483648") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:int(mid range) . */ @org.junit.Test public void fnOneOrMoreint1args2() { final XQuery query = new XQuery( "fn:one-or-more(xs:int(\"-1873914410\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1873914410") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:int(upper bound) . */ @org.junit.Test public void fnOneOrMoreint1args3() { final XQuery query = new XQuery( "fn:one-or-more(xs:int(\"2147483647\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2147483647") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:integer(lower bound) . */ @org.junit.Test public void fnOneOrMoreintg1args1() { final XQuery query = new XQuery( "fn:one-or-more(xs:integer(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:integer(mid range) . */ @org.junit.Test public void fnOneOrMoreintg1args2() { final XQuery query = new XQuery( "fn:one-or-more(xs:integer(\"830993497117024304\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "830993497117024304") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:integer(upper bound) . */ @org.junit.Test public void fnOneOrMoreintg1args3() { final XQuery query = new XQuery( "fn:one-or-more(xs:integer(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "999999999999999999") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:long(lower bound) . */ @org.junit.Test public void fnOneOrMorelng1args1() { final XQuery query = new XQuery( "fn:one-or-more(xs:long(\"-92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-92233720368547758") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:long(mid range) . */ @org.junit.Test public void fnOneOrMorelng1args2() { final XQuery query = new XQuery( "fn:one-or-more(xs:long(\"-47175562203048468\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-47175562203048468") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:long(upper bound) . */ @org.junit.Test public void fnOneOrMorelng1args3() { final XQuery query = new XQuery( "fn:one-or-more(xs:long(\"92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "92233720368547758") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnOneOrMorenint1args1() { final XQuery query = new XQuery( "fn:one-or-more(xs:negativeInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnOneOrMorenint1args2() { final XQuery query = new XQuery( "fn:one-or-more(xs:negativeInteger(\"-297014075999096793\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-297014075999096793") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnOneOrMorenint1args3() { final XQuery query = new XQuery( "fn:one-or-more(xs:negativeInteger(\"-1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnOneOrMorenni1args1() { final XQuery query = new XQuery( "fn:one-or-more(xs:nonNegativeInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnOneOrMorenni1args2() { final XQuery query = new XQuery( "fn:one-or-more(xs:nonNegativeInteger(\"303884545991464527\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "303884545991464527") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnOneOrMorenni1args3() { final XQuery query = new XQuery( "fn:one-or-more(xs:nonNegativeInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "999999999999999999") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnOneOrMorenpi1args1() { final XQuery query = new XQuery( "fn:one-or-more(xs:nonPositiveInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnOneOrMorenpi1args2() { final XQuery query = new XQuery( "fn:one-or-more(xs:nonPositiveInteger(\"-475688437271870490\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-475688437271870490") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnOneOrMorenpi1args3() { final XQuery query = new XQuery( "fn:one-or-more(xs:nonPositiveInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnOneOrMorepint1args1() { final XQuery query = new XQuery( "fn:one-or-more(xs:positiveInteger(\"1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnOneOrMorepint1args2() { final XQuery query = new XQuery( "fn:one-or-more(xs:positiveInteger(\"52704602390610033\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "52704602390610033") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnOneOrMorepint1args3() { final XQuery query = new XQuery( "fn:one-or-more(xs:positiveInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "999999999999999999") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:short(lower bound) . */ @org.junit.Test public void fnOneOrMoresht1args1() { final XQuery query = new XQuery( "fn:one-or-more(xs:short(\"-32768\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-32768") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:short(mid range) . */ @org.junit.Test public void fnOneOrMoresht1args2() { final XQuery query = new XQuery( "fn:one-or-more(xs:short(\"-5324\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-5324") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:short(upper bound) . */ @org.junit.Test public void fnOneOrMoresht1args3() { final XQuery query = new XQuery( "fn:one-or-more(xs:short(\"32767\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "32767") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnOneOrMoreulng1args1() { final XQuery query = new XQuery( "fn:one-or-more(xs:unsignedLong(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnOneOrMoreulng1args2() { final XQuery query = new XQuery( "fn:one-or-more(xs:unsignedLong(\"130747108607674654\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "130747108607674654") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnOneOrMoreulng1args3() { final XQuery query = new XQuery( "fn:one-or-more(xs:unsignedLong(\"184467440737095516\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "184467440737095516") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnOneOrMoreusht1args1() { final XQuery query = new XQuery( "fn:one-or-more(xs:unsignedShort(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnOneOrMoreusht1args2() { final XQuery query = new XQuery( "fn:one-or-more(xs:unsignedShort(\"44633\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "44633") ); } /** * Evaluates The "one-or-more" function with the arguments set as follows: $arg = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnOneOrMoreusht1args3() { final XQuery query = new XQuery( "fn:one-or-more(xs:unsignedShort(\"65535\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "65535") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnOutermost.java000066400000000000000000001050421222453003200272360ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the outermost() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnOutermost extends QT3TestSet { /** * Attempts to evaluate the "outermost" function with no arguments.. */ @org.junit.Test public void fnOutermost001() { final XQuery query = new XQuery( "fn:outermost()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "outermost" function with arity zero.. */ @org.junit.Test public void fnOutermost002() { final XQuery query = new XQuery( "fn:outermost#0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to evaluate the "outermost" function with two arguments.. */ @org.junit.Test public void fnOutermost003() { final XQuery query = new XQuery( "fn:outermost( (), 1 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "outermost" function with arity two.. */ @org.junit.Test public void fnOutermost004() { final XQuery query = new XQuery( "fn:outermost#2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "outermost" function with arity one.. */ @org.junit.Test public void fnOutermost005() { final XQuery query = new XQuery( "fn:exists( fn:outermost#1 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "outermost" function with an argument of type xs:anyAtomicType.. */ @org.junit.Test public void fnOutermost006() { final XQuery query = new XQuery( "fn:outermost( 1 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluates the "outermost" function with an argument of type function().. */ @org.junit.Test public void fnOutermost007() { final XQuery query = new XQuery( "fn:outermost( fn:dateTime#2 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the type checking of the argument.. */ @org.junit.Test public void fnOutermost009() { final XQuery query = new XQuery( "( fn:outermost( if (current-date() eq xs:date('1900-01-01'))\n" + " then .\n" + " else 1 ),\n" + " fn:outermost( if (current-date() eq xs:date('1900-01-01'))\n" + " then 1\n" + " else . ) )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the type checking of the argument.. */ @org.junit.Test public void fnOutermost011() { final XQuery query = new XQuery( "( fn:outermost( if (current-date() eq xs:date('1900-01-01'))\n" + " then .\n" + " else fn:dateTime#2 ),\n" + " fn:outermost( if (current-date() eq xs:date('1900-01-01'))\n" + " then fn:dateTime#2\n" + " else . ) )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type document-node() . */ @org.junit.Test public void fnOutermost012() { final XQuery query = new XQuery( "fn:outermost( / )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(1) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type document-node() . */ @org.junit.Test public void fnOutermost013() { final XQuery query = new XQuery( "fn:deep-equal(fn:outermost( / ), / )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type attribute()* . */ @org.junit.Test public void fnOutermost014() { final XQuery query = new XQuery( "fn:outermost( //*/@* )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(7) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type attribute()* . */ @org.junit.Test public void fnOutermost015() { final XQuery query = new XQuery( "fn:outermost( //*/@* ) ! string()", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("('0a','00a','000a','01a','010a','02a','020a')") ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type attribute()* . */ @org.junit.Test public void fnOutermost016() { final XQuery query = new XQuery( "deep-equal(fn:outermost( //*/@* ), //*/@*)", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type processing-instruction()* . */ @org.junit.Test public void fnOutermost023() { final XQuery query = new XQuery( "fn:outermost( //processing-instruction() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(7) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type processing-instruction()* . */ @org.junit.Test public void fnOutermost024() { final XQuery query = new XQuery( "fn:outermost( //processing-instruction() ) ! local-name() ", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("('level-0','level-00','level-000','level-01','level-010','level-02','level-020')") ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type processing-instruction()* . */ @org.junit.Test public void fnOutermost025() { final XQuery query = new XQuery( "fn:deep-equal( fn:outermost( //processing-instruction() ), \n" + " //processing-instruction() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type comment()* . */ @org.junit.Test public void fnOutermost026() { final XQuery query = new XQuery( "fn:outermost( //comment() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(7) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type comment()* . */ @org.junit.Test public void fnOutermost027() { final XQuery query = new XQuery( "fn:outermost( //comment() ) ! string()", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("('0c','00c','000c','01c','010c','02c','020c')") ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type comment()* . */ @org.junit.Test public void fnOutermost028() { final XQuery query = new XQuery( "fn:deep-equal( fn:outermost( //comment() ),\n" + " //comment() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type text()* . */ @org.junit.Test public void fnOutermost029() { final XQuery query = new XQuery( "fn:outermost( //text() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(14) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type text()* . */ @org.junit.Test public void fnOutermost030() { final XQuery query = new XQuery( "fn:outermost( //text() ) ! string() ", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("('0t',' ',\n '00t',' ','000t',' ',\n '01t',' ','010t',' ',\n '02t',' ','020t',' ')") ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type text()* . */ @org.junit.Test public void fnOutermost031() { final XQuery query = new XQuery( "fn:deep-equal( fn:outermost( //text() ),\n" + " //text() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type element()* . */ @org.junit.Test public void fnOutermost032() { final XQuery query = new XQuery( "fn:outermost( //* )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(1) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type element()* . */ @org.junit.Test public void fnOutermost033() { final XQuery query = new XQuery( "fn:outermost( //* ) ! local-name(.)", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("('root')") ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type element()* . */ @org.junit.Test public void fnOutermost034() { final XQuery query = new XQuery( "fn:deep-equal( fn:outermost( //* ), \n" + " let $nodes := //*\n" + " return $nodes except $nodes/descendant::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnOutermost035() { final XQuery query = new XQuery( "fn:outermost( //node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(1) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnOutermost036() { final XQuery query = new XQuery( "fn:deep-equal( fn:outermost( //node() ), \n" + " let $nodes := //node()\n" + " return $nodes except $nodes/descendant::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnOutermost037() { final XQuery query = new XQuery( "fn:outermost( /root/node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(8) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnOutermost038() { final XQuery query = new XQuery( "fn:deep-equal( fn:outermost( /root/node() ), \n" + " let $nodes := /root/node()\n" + " return $nodes except $nodes/descendant::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnOutermost039() { final XQuery query = new XQuery( "fn:outermost( /root/descendant::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(8) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnOutermost040() { final XQuery query = new XQuery( "fn:deep-equal( fn:outermost( /root/descendant::node() ), \n" + " let $nodes := /root/descendant::node()\n" + " return $nodes except $nodes/descendant::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnOutermost041() { final XQuery query = new XQuery( "fn:outermost( /root/level[1]/level[1]/ancestor::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(1) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnOutermost042() { final XQuery query = new XQuery( "fn:deep-equal( fn:outermost( /root/level[1]/level[1]/ancestor::node() ), \n" + " let $nodes := /root/level[1]/level[1]/ancestor::node()\n" + " return $nodes except $nodes/descendant::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnOutermost043() { final XQuery query = new XQuery( "fn:outermost( /root/level[1]/level[last()]/preceding-sibling::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(5) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnOutermost044() { final XQuery query = new XQuery( "fn:deep-equal( fn:outermost( /root/level[1]/level[last()]/preceding-sibling::node() ), \n" + " let $nodes := /root/level[1]/level[last()]/preceding-sibling::node()\n" + " return $nodes except $nodes/descendant::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnOutermost045() { final XQuery query = new XQuery( "fn:outermost( /root/level[1]/level[last()]/preceding::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(10) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnOutermost046() { final XQuery query = new XQuery( "fn:deep-equal( fn:outermost( /root/level[1]/level[last()]/preceding::node() ), \n" + " let $nodes := /root/level[1]/level[last()]/preceding::node()\n" + " return $nodes except $nodes/descendant::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnOutermost047() { final XQuery query = new XQuery( "fn:outermost( /root/level[1]/following-sibling::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(2) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnOutermost048() { final XQuery query = new XQuery( "fn:deep-equal( fn:outermost( /root/level[1]/following-sibling::node() ), \n" + " let $nodes := /root/level[1]/following-sibling::node()\n" + " return $nodes except $nodes/descendant::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnOutermost049() { final XQuery query = new XQuery( "fn:outermost( /root/level[1]/level[1]/following::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(2) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnOutermost050() { final XQuery query = new XQuery( "fn:deep-equal( fn:outermost( /root/level[1]/level[1]/following::node() ), \n" + " let $nodes := /root/level[1]/level[1]/following::node()\n" + " return $nodes except $nodes/descendant::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnOutermost051() { final XQuery query = new XQuery( "fn:outermost( /root/node()/.. )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(1) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type node()* . */ @org.junit.Test public void fnOutermost052() { final XQuery query = new XQuery( "fn:deep-equal( fn:outermost( /root/node()/.. ), \n" + " let $nodes := /root/node()/..\n" + " return $nodes except $nodes/descendant::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type node()* from two documents . */ @org.junit.Test public void fnOutermost053() { final XQuery query = new XQuery( "fn:outermost( ($doc1//node(), $doc2//node()) )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(2) ); } /** * Evaluates the "outermost" function with the argument set as follows: $nodes of type node()* from two documents . */ @org.junit.Test public void fnOutermost054() { final XQuery query = new XQuery( "fn:deep-equal( fn:outermost( ($doc1//node(), $doc2//node()) ),\n" + " let $nodes := ($doc1//node(), $doc2//node())\n" + " return $nodes except $nodes/descendant::node() )", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "outermost" function with the input sequence not in document order . */ @org.junit.Test public void fnOutermost055() { final XQuery query = new XQuery( "let $in := for $x in //* order by local-name($x) return $x\n" + " return deep-equal(fn:outermost($in)/local-name(), fn:outermost(//*)/local-name())", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "outermost" function with the input sequence containing duplicates . */ @org.junit.Test public void fnOutermost056() { final XQuery query = new XQuery( "let $in := for $x in //* order by local-name($x) return $x\n" + " return deep-equal(fn:outermost(($in, $in))/local-name(), fn:outermost(//*)/local-name())", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "outermost" function with the input sequence empty . */ @org.junit.Test public void fnOutermost057() { final XQuery query = new XQuery( "outermost(//rubbish)", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Check that "outermost" doesn't change node identity . */ @org.junit.Test public void fnOutermost058() { final XQuery query = new XQuery( "outermost(//*) except //*", ctx); try { query.context(node(file("fn/innermost/innermost.xml"))); query.bind("$doc1", node(file("fn/innermost/doc1.xml"))); query.bind("$doc2", node(file("fn/innermost/doc2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnParseXml.java000066400000000000000000000154451222453003200267770ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the fn:parse-xml function introduced in XPath 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnParseXml extends QT3TestSet { /** * parse-xml test. */ @org.junit.Test public void parseXml001() { final XQuery query = new XQuery( "parse-xml(unparsed-text(\"../docs/atomic.xml\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("document-node(element(*,xs:untyped))") ); } /** * parse-xml test - with invalid absolute URI. */ @org.junit.Test public void parseXml002() { final XQuery query = new XQuery( "parse-xml(unparsed-text(\"../docs/atomic.xml\"),'###/atomic.xml')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * parse-xml test - with valid absolute URI. */ @org.junit.Test public void parseXml003() { final XQuery query = new XQuery( "parse-xml(unparsed-text(\"../docs/atomic.xml\"),'file:/test/fots/../docs/atomic.xml')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * parse-xml test - invalid XML document. */ @org.junit.Test public void parseXml004() { final XQuery query = new XQuery( "parse-xml(\"Test123\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0006") ); } /** * parse-xml test - with XML declaration. */ @org.junit.Test public void parseXml005() { final XQuery query = new XQuery( "parse-xml(\"foo\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("foo", false) ); } /** * parse-xml test - with local DTD. */ @org.junit.Test public void parseXml006() { final XQuery query = new XQuery( "parse-xml(\"]>foo\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("foo", false) ); } /** * parse-xml test - base URI of result. */ @org.junit.Test public void parseXml007() { final XQuery query = new XQuery( "base-uri(parse-xml(\"foo\")) eq static-base-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * parse-xml test - with external DTD. */ @org.junit.Test public void parseXml008() { final XQuery query = new XQuery( "parse-xml(\"foo\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("foo", false) ); } /** * parse-xml test - with XML declaration and external DTD. */ @org.junit.Test public void parseXml009() { final XQuery query = new XQuery( "parse-xml(\"foo\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("foo", false) ); } /** * parse-xml test - with external entity. */ @org.junit.Test public void parseXml010() { final XQuery query = new XQuery( "parse-xml(\"]>\" ||\n" + " codepoints-to-string(38) || \"foo;\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("baz", false) ); } /** * parse-xml test - document-uri() of result is absent. */ @org.junit.Test public void parseXml011() { final XQuery query = new XQuery( "document-uri(parse-xml(\"foo\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * parse-xml test - determinism of result is implementation-defined. */ @org.junit.Test public void parseXml012() { final XQuery query = new XQuery( "parse-xml(\"foo\") is parse-xml(\"foo\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || assertBoolean(false) ) ); } /** * parse-xml test - with local DTD - invalid against DTD. */ @org.junit.Test public void parseXml013() { final XQuery query = new XQuery( "parse-xml(\"]>\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("", false) || error("FODC0006") ) ); } /** * parse-xml test - result is a document node. */ @org.junit.Test public void parseXml014() { final XQuery query = new XQuery( "parse-xml(\"foo\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("document-node()") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnParseXmlFragment.java000066400000000000000000000257051222453003200304630ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the fn:parse-xml-fragment function introduced in XPath 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnParseXmlFragment extends QT3TestSet { /** * parse-xml-fragment test. */ @org.junit.Test public void parseXmlFragment001() { final XQuery query = new XQuery( "\n" + " \tparse-xml-fragment(unparsed-text(\"../docs/atomic.xml\"))/*\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertType("element(*,xs:untyped)") ); } /** * parse-xml-fragment test - two args not allowed. */ @org.junit.Test public void parseXmlFragment002() { final XQuery query = new XQuery( "parse-xml-fragment(unparsed-text(\"../docs/atomic.xml\"),'###/atomic.xml')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * parse-xml-fragment test - two args not allowed. */ @org.junit.Test public void parseXmlFragment003() { final XQuery query = new XQuery( "parse-xml-fragment(unparsed-text(\"../docs/atomic.xml\"),'file:/test/fots/../docs/atomic.xml')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * parse-xml-fragment test - invalid XML document. */ @org.junit.Test public void parseXmlFragment004() { final XQuery query = new XQuery( "parse-xml-fragment(\"Test123\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0006") ); } /** * parse-xml-fragment test - empty string is OK. */ @org.junit.Test public void parseXmlFragment005() { final XQuery query = new XQuery( "parse-xml-fragment(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * parse-xml-fragment test - text only is OK. */ @org.junit.Test public void parseXmlFragment006() { final XQuery query = new XQuery( "parse-xml-fragment(\"vanessa\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "vanessa") ); } /** * parse-xml-fragment test - multiple elements are OK. */ @org.junit.Test public void parseXmlFragment007() { final XQuery query = new XQuery( "parse-xml-fragment(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * parse-xml-fragment test - whitespace is preserved. */ @org.junit.Test public void parseXmlFragment008() { final XQuery query = new XQuery( "parse-xml-fragment(\" \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, " ") ); } /** * parse-xml-fragment test - whitespace is preserved. */ @org.junit.Test public void parseXmlFragment009() { final XQuery query = new XQuery( "parse-xml-fragment(\" \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" ", false) ); } /** * parse-xml-fragment test - comments and PIs are OK. */ @org.junit.Test public void parseXmlFragment010() { final XQuery query = new XQuery( "parse-xml-fragment(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * parse-xml-fragment test - built-in entity references are OK. */ @org.junit.Test public void parseXmlFragment011() { final XQuery query = new XQuery( "parse-xml-fragment(codepoints-to-string((38, 108, 116, 59)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "<") ); } /** * parse-xml-fragment test - numeric character references are OK. */ @org.junit.Test public void parseXmlFragment012() { final XQuery query = new XQuery( "parse-xml-fragment(codepoints-to-string((38, 35, 51, 56, 59)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "&") ); } /** * parse-xml-fragment test - text declaration is OK. */ @org.junit.Test public void parseXmlFragment013() { final XQuery query = new XQuery( "parse-xml-fragment(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * parse-xml-fragment test - text declaration on its own is OK. */ @org.junit.Test public void parseXmlFragment014() { final XQuery query = new XQuery( "parse-xml-fragment(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * parse-xml-fragment test - text declaration plus text on its own is OK. */ @org.junit.Test public void parseXmlFragment015() { final XQuery query = new XQuery( "parse-xml-fragment(\"abc\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc") ); } /** * parse-xml-fragment test - encoding attribute in a text declaration is mandatory. */ @org.junit.Test public void parseXmlFragment016() { final XQuery query = new XQuery( "parse-xml-fragment(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0006") ); } /** * parse-xml-fragment test - standalone attribute in a text declaration is disallowed. */ @org.junit.Test public void parseXmlFragment017() { final XQuery query = new XQuery( "parse-xml-fragment(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0006") ); } /** * parse-xml-fragment test - tags must be balanced. */ @org.junit.Test public void parseXmlFragment018() { final XQuery query = new XQuery( "parse-xml-fragment(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0006") ); } /** * parse-xml-fragment test - namespaces must be declared. */ @org.junit.Test public void parseXmlFragment019() { final XQuery query = new XQuery( "parse-xml-fragment(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0006") ); } /** * parse-xml-fragment test - DOCTYPE is not allowed. */ @org.junit.Test public void parseXmlFragment020() { final XQuery query = new XQuery( "parse-xml-fragment(\"\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0006") ); } /** * parse-xml-fragment test - line endings are normalized. */ @org.junit.Test public void parseXmlFragment021() { final XQuery query = new XQuery( "string-to-codepoints(parse-xml-fragment(\"a\"||codepoints-to-string((13, 10))||\"b\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "97 10 98") ); } /** * parse-xml-fragment test - result is parentless. */ @org.junit.Test public void parseXmlFragment022() { final XQuery query = new XQuery( "parse-xml-fragment(\"\")/..", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * parse-xml-fragment test - result is a document node. */ @org.junit.Test public void parseXmlFragment023() { final XQuery query = new XQuery( "parse-xml-fragment(\"\") instance of document-node()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnPath.java000066400000000000000000000251431222453003200261340ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * tests for the fn:path() function introduced in XPath 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnPath extends QT3TestSet { /** * path() applied to empty sequence. */ @org.junit.Test public void path001() { final XQuery query = new XQuery( "fn:path(())", ctx); try { query.context(node(file("fn/path/pathdata.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * path() applied to top-level element. */ @org.junit.Test public void path002() { final XQuery query = new XQuery( "fn:path(/*)", ctx); try { query.context(node(file("fn/path/pathdata.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "/Q{http://www.w3.org/2010/09/qt-fots-catalog}test-set[1]") && assertType("xs:string") ) ); } /** * path() applied to nested element. */ @org.junit.Test public void path003() { final XQuery query = new XQuery( "fn:path((//*:all-of)[1])", ctx); try { query.context(node(file("fn/path/pathdata.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "/Q{http://www.w3.org/2010/09/qt-fots-catalog}test-set[1]/Q{http://www.w3.org/2010/09/qt-fots-catalog}test-case[1]/Q{http://www.w3.org/2010/09/qt-fots-catalog}result[1]/Q{http://www.w3.org/2010/09/qt-fots-catalog}all-of[1]") && assertType("xs:string") ) ); } /** * path() applied to non-first sibling element. */ @org.junit.Test public void path004() { final XQuery query = new XQuery( "fn:path(//*[@name=\"fn-absintg1args-1\"])", ctx); try { query.context(node(file("fn/path/pathdata.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "/Q{http://www.w3.org/2010/09/qt-fots-catalog}test-set[1]/Q{http://www.w3.org/2010/09/qt-fots-catalog}test-case[4]") && assertType("xs:string") ) ); } /** * path() applied to no-namespace attribute. */ @org.junit.Test public void path005() { final XQuery query = new XQuery( "fn:path((//@idref)[1])", ctx); try { query.context(node(file("fn/path/pathdata.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "/Q{http://www.w3.org/2010/09/qt-fots-catalog}test-set[1]/Q{http://www.w3.org/2010/09/qt-fots-catalog}link[1]/@idref") && assertType("xs:string") ) ); } /** * path() applied to namespaced attribute. */ @org.junit.Test public void path006() { final XQuery query = new XQuery( "fn:path((//*:source)[3]/@xml:id)", ctx); try { query.context(node(file("fn/path/pathdata.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "/Q{http://www.w3.org/2010/09/qt-fots-catalog}test-set[1]/Q{http://www.w3.org/2010/09/qt-fots-catalog}environment[3]/Q{http://www.w3.org/2010/09/qt-fots-catalog}source[1]/@Q{http://www.w3.org/XML/1998/namespace}id") && assertType("xs:string") ) ); } /** * path() applied to comment. */ @org.junit.Test public void path007() { final XQuery query = new XQuery( "fn:path((//comment())[2])", ctx); try { query.context(node(file("fn/path/pathdata.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "/Q{http://www.w3.org/2010/09/qt-fots-catalog}test-set[1]/Q{http://www.w3.org/2010/09/qt-fots-catalog}test-case[2]/Q{http://www.w3.org/2010/09/qt-fots-catalog}description[1]/comment()[1]") && assertType("xs:string") ) ); } /** * path() applied to text node. */ @org.junit.Test public void path008() { final XQuery query = new XQuery( "fn:path(//text()[.='2147483647'][1])", ctx); try { query.context(node(file("fn/path/pathdata.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "/Q{http://www.w3.org/2010/09/qt-fots-catalog}test-set[1]/Q{http://www.w3.org/2010/09/qt-fots-catalog}test-case[3]/Q{http://www.w3.org/2010/09/qt-fots-catalog}result[1]/Q{http://www.w3.org/2010/09/qt-fots-catalog}all-of[1]/Q{http://www.w3.org/2010/09/qt-fots-catalog}assert-eq[1]/text()[1]") && assertType("xs:string") ) ); } /** * path() applied to PI. */ @org.junit.Test public void path009() { final XQuery query = new XQuery( "fn:path(//processing-instruction()[1])", ctx); try { query.context(node(file("fn/path/pathdata.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "/processing-instruction(xml-stylesheet)[1]") && assertType("xs:string") ) ); } /** * path() applied to no-namespace element. */ @org.junit.Test public void path010() { final XQuery query = new XQuery( "fn:path(//p)", ctx); try { query.context(node(file("fn/path/pathdata.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "/Q{http://www.w3.org/2010/09/qt-fots-catalog}test-set[1]/Q{}p[1]") && assertType("xs:string") ) ); } /** * path() applied to a parentless element. */ @org.junit.Test public void path014() { final XQuery query = new XQuery( "\n" + " import module namespace copy=\"http://www.w3.org/QT3/copy\";\n" + " fn:path(copy:copy((//employee)[1])/pnum)\n" + " ", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.addModule("http://www.w3.org/QT3/copy", file("fn/id/copy.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Q{http://www.w3.org/2005/xpath-functions}root()/Q{}pnum[1]") ); } /** * path() applied to document node. */ @org.junit.Test public void path015() { final XQuery query = new XQuery( "fn:path(/)", ctx); try { query.context(node(file("fn/path/pathdata.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "/") && assertType("xs:string") ) ); } /** * path() applied to a parentless attribute node. */ @org.junit.Test public void path016() { final XQuery query = new XQuery( "fn:path(attribute name {\"fred\"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "Q{http://www.w3.org/2005/xpath-functions}root()") && assertType("xs:string") ) ); } /** * path() applied to a parentless text node. */ @org.junit.Test public void path017() { final XQuery query = new XQuery( "fn:path(text{\"fred\"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "Q{http://www.w3.org/2005/xpath-functions}root()") && assertType("xs:string") ) ); } /** * path() applied to an attribute of an element root. */ @org.junit.Test public void path018() { final XQuery query = new XQuery( "fn:path(/@b)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "Q{http://www.w3.org/2005/xpath-functions}root()/@b") && assertType("xs:string") ) ); } /** * path() applied to an element child of an element root. */ @org.junit.Test public void path019() { final XQuery query = new XQuery( "fn:path(/(b[2]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "Q{http://www.w3.org/2005/xpath-functions}root()/Q{}b[2]") && assertType("xs:string") ) ); } /** * path() with no arguments. */ @org.junit.Test public void path020() { final XQuery query = new XQuery( "(//*:all-of)[1] ! fn:path()", ctx); try { query.context(node(file("fn/path/pathdata.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "/Q{http://www.w3.org/2010/09/qt-fots-catalog}test-set[1]/Q{http://www.w3.org/2010/09/qt-fots-catalog}test-case[1]/Q{http://www.w3.org/2010/09/qt-fots-catalog}result[1]/Q{http://www.w3.org/2010/09/qt-fots-catalog}all-of[1]") && assertType("xs:string") ) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnPosition.java000066400000000000000000001025231222453003200270420ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the position() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnPosition extends QT3TestSet { /** * A test whose essence is: `position(1)`. . */ @org.junit.Test public void kContextPositionFunc1() { final XQuery query = new XQuery( "position(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * fn:position() can never return 0('ne'), #2. . */ @org.junit.Test public void kContextPositionFunc10() { final XQuery query = new XQuery( "deep-equal( (1, 2, 3, remove((current-time(), 4), 1)) [0 ne position()], (1, 2, 3, 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:position() can never return anything less than 1(lt). . */ @org.junit.Test public void kContextPositionFunc11() { final XQuery query = new XQuery( "empty((1, 2, 3, current-time(), current-date(), 6, 7, 8) [position() lt 1])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:position() can never return anything less than 1(<). . */ @org.junit.Test public void kContextPositionFunc12() { final XQuery query = new XQuery( "empty((1, 2, 3, current-time(), current-date(), 6, 7, 8) [position() < 1])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:position() can never return anything less or equal to 0(le). . */ @org.junit.Test public void kContextPositionFunc13() { final XQuery query = new XQuery( "empty((1, 2, 3, current-time(), current-date(), 6, 7, 8) [position() le 0])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:position() can never return anything less or equal to 0(<=). . */ @org.junit.Test public void kContextPositionFunc14() { final XQuery query = new XQuery( "empty((1, 2, 3, current-time(), current-date(), 6, 7, 8) [position() <= 0])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The return value of fn:position() is always greater than 0('ne'). . */ @org.junit.Test public void kContextPositionFunc15() { final XQuery query = new XQuery( "deep-equal( (1, 2, 3, remove((current-time(), 4), 1)) [position() > 0], (1, 2, 3, 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The return value of fn:position() is always greater than 0('>'). . */ @org.junit.Test public void kContextPositionFunc16() { final XQuery query = new XQuery( "deep-equal( (1, 2, 3, remove((current-time(), 4), 1)) [position() > 0], (1, 2, 3, 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The return value of fn:position() is always greater than 0('gt'). . */ @org.junit.Test public void kContextPositionFunc17() { final XQuery query = new XQuery( "deep-equal( (1, 2, 3, remove((current-time(), 4), 1)) [position() gt 0], (1, 2, 3, 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The return value of fn:position() is always greater or equal to 0('>='). . */ @org.junit.Test public void kContextPositionFunc18() { final XQuery query = new XQuery( "deep-equal( (1, 2, 3, remove((current-time(), 4), 1)) [position() >= 1], (1, 2, 3, 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The return value of fn:position() is always greater or equal to 0('ge'). . */ @org.junit.Test public void kContextPositionFunc19() { final XQuery query = new XQuery( "deep-equal( (1, 2, 3, remove((current-time(), 4), 1)) [position() ge 1], (1, 2, 3, 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(1, 2, 3)[if(1) then 1 else position()]`. . */ @org.junit.Test public void kContextPositionFunc2() { final XQuery query = new XQuery( "(1, 2, 3)[if(1) then 1 else position()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * position() combined with a comparison operator inside a predicate. . */ @org.junit.Test public void kContextPositionFunc20() { final XQuery query = new XQuery( "1 eq (0, 1, current-time(), 4)[position() = 2] treat as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * position() combined with a comparison operator inside a predicate. . */ @org.junit.Test public void kContextPositionFunc21() { final XQuery query = new XQuery( "1 eq (0, 1, current-time(), 4)[position() eq 2] treat as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * position() combined with a comparison operator inside a predicate. . */ @org.junit.Test public void kContextPositionFunc22() { final XQuery query = new XQuery( "1 eq (0, 1, current-time(), 4)[2 eq position()] treat as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * position() combined with a comparison operator inside a predicate. . */ @org.junit.Test public void kContextPositionFunc23() { final XQuery query = new XQuery( "1 eq (0, 1, current-time(), 4)[2 = position()] treat as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * position() combined with a comparison operator inside a predicate. . */ @org.junit.Test public void kContextPositionFunc24() { final XQuery query = new XQuery( "deep-equal((1, 2, 4), (1, 2, current-time(), 4)[position() != 3])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * position() combined with a comparison operator inside a predicate. . */ @org.junit.Test public void kContextPositionFunc25() { final XQuery query = new XQuery( "deep-equal((1, 2, 4), (1, 2, current-time(), 4)[position() ne 3])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * position() combined with a comparison operator inside a predicate. . */ @org.junit.Test public void kContextPositionFunc26() { final XQuery query = new XQuery( "deep-equal((1, 2, 4), (1, 2, current-time(), 4)[3 ne position()])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * position() combined with a comparison operator inside a predicate. . */ @org.junit.Test public void kContextPositionFunc27() { final XQuery query = new XQuery( "deep-equal((1, 2, 4), (1, 2, current-time(), 4)[3 != position()])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * position() combined with a comparison operator inside a predicate. . */ @org.junit.Test public void kContextPositionFunc28() { final XQuery query = new XQuery( "deep-equal((1, 2, 3), (1, 2, 3, current-time())[position() lt 4])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * position() combined with a comparison operator inside a predicate. . */ @org.junit.Test public void kContextPositionFunc29() { final XQuery query = new XQuery( "deep-equal((1, 2, 3), (1, 2, 3, current-time())[position() < 4])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:position() can never return 0('='). . */ @org.junit.Test public void kContextPositionFunc3() { final XQuery query = new XQuery( "empty((1, 2, 3, current-time(), current-date(), 6, 7, 8) [position() = 0])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * position() combined with a comparison operator inside a predicate. . */ @org.junit.Test public void kContextPositionFunc30() { final XQuery query = new XQuery( "deep-equal((1, 2, 3), (1, 2, 3, current-time())[4 gt position()])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * position() combined with a comparison operator inside a predicate. . */ @org.junit.Test public void kContextPositionFunc31() { final XQuery query = new XQuery( "deep-equal((1, 2, 3), (1, 2, 3, current-time())[4 > position()])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * position() combined with a comparison operator inside a predicate. . */ @org.junit.Test public void kContextPositionFunc32() { final XQuery query = new XQuery( "deep-equal((1, 2, 3), (1, 2, 3, current-time())[position() le 3])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * position() combined with a comparison operator inside a predicate. . */ @org.junit.Test public void kContextPositionFunc33() { final XQuery query = new XQuery( "deep-equal((1, 2, 3), (1, 2, 3, current-time())[position() <= 3])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * position() combined with a comparison operator inside a predicate. . */ @org.junit.Test public void kContextPositionFunc34() { final XQuery query = new XQuery( "deep-equal((1, 2, 3), (1, 2, 3, current-time())[3 ge position()])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * position() combined with a comparison operator inside a predicate. . */ @org.junit.Test public void kContextPositionFunc35() { final XQuery query = new XQuery( "deep-equal((1, 2, 3), (1, 2, 3, current-time())[3 >= position()])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * position() combined with a comparison operator inside a predicate. . */ @org.junit.Test public void kContextPositionFunc36() { final XQuery query = new XQuery( "deep-equal((4, 5), (1, 2, current-time(), 4, 5)[3 lt position()])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * position() combined with a comparison operator inside a predicate. . */ @org.junit.Test public void kContextPositionFunc37() { final XQuery query = new XQuery( "deep-equal((4, 5), (1, 2, current-time(), 4, 5)[3 < position()])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * position() combined with a comparison operator inside a predicate. . */ @org.junit.Test public void kContextPositionFunc38() { final XQuery query = new XQuery( "deep-equal((4, 5), (1, 2, current-time(), 4, 5)[position() gt 3])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * position() combined with a comparison operator inside a predicate. . */ @org.junit.Test public void kContextPositionFunc39() { final XQuery query = new XQuery( "deep-equal((4, 5), (1, 2, current-time(), 4, 5)[position() > 3])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:position() can never return 0('='), #2. . */ @org.junit.Test public void kContextPositionFunc4() { final XQuery query = new XQuery( "empty((1, 2, 3, current-time(), current-date(), 6, 7, 8) [0 = position()])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * position() combined with a comparison operator inside a predicate. . */ @org.junit.Test public void kContextPositionFunc40() { final XQuery query = new XQuery( "deep-equal((4, 5), (1, 2, current-time(), 4, 5)[4 le position()])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * position() combined with a comparison operator inside a predicate. . */ @org.junit.Test public void kContextPositionFunc41() { final XQuery query = new XQuery( "deep-equal((4, 5), (1, 2, current-time(), 4, 5)[4 <= position()])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * position() combined with a comparison operator inside a predicate. . */ @org.junit.Test public void kContextPositionFunc42() { final XQuery query = new XQuery( "deep-equal((4, 5), (1, 2, current-time(), 4, 5)[position() ge 4])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * position() combined with a comparison operator inside a predicate. . */ @org.junit.Test public void kContextPositionFunc43() { final XQuery query = new XQuery( "deep-equal((4, 5), (1, 2, current-time(), 4, 5)[position() >= 4])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:position() can never return 0('eq'). . */ @org.junit.Test public void kContextPositionFunc5() { final XQuery query = new XQuery( "empty((1, 2, 3, current-time(), current-date(), 6, 7, 8) [position() eq 0])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:position() can never return 0('eq'), #2. . */ @org.junit.Test public void kContextPositionFunc6() { final XQuery query = new XQuery( "empty((1, 2, 3, current-time(), current-date(), 6, 7, 8) [0 eq position()])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:position() can never return 0('!='). . */ @org.junit.Test public void kContextPositionFunc7() { final XQuery query = new XQuery( "deep-equal( (1, 2, 3, remove((current-time(), 4), 1)) [position() != 0], (1, 2, 3, 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:position() can never return 0('ne'). . */ @org.junit.Test public void kContextPositionFunc8() { final XQuery query = new XQuery( "deep-equal( (1, 2, 3, remove((current-time(), 4), 1)) [position() ne 0], (1, 2, 3, 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:position() can never return 0('!='), #2. . */ @org.junit.Test public void kContextPositionFunc9() { final XQuery query = new XQuery( "deep-equal( (1, 2, 3, remove((current-time(), 4), 1)) [0 != position()], (1, 2, 3, 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of "fn"position", where context function is an element node and position is first. . */ @org.junit.Test public void position1() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[position() = 1]/string(@name)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 1") ); } /** * Evaluation of "fn:position" where the position function is used inside the first predicate. . */ @org.junit.Test public void position10() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[position() = 1][@name]/string(@name)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 1") ); } /** * Evaluation of "fn:position" used in conjucntion with the fn:not function . */ @org.junit.Test public void position11() { final XQuery query = new XQuery( "for $h in (/works/employee[12]/overtime) return $h/day[not(position() = 1)]/string()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Tuesday") ); } /** * Evaluation of "fn:position" as a predicate to a wildcard (*). . */ @org.junit.Test public void position12() { final XQuery query = new XQuery( "for $h in (/works/employee[12]/overtime) return $h/*[position() = position()]/string()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"Monday\", \"Tuesday\"") ); } /** * Evaluation of "fn:position" used together with an addition operation. . */ @org.junit.Test public void position13() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[position() = (2 + 2)]/string(@name)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "John Doe 4") ); } /** * Evaluation of "fn:position" used together with a subtraction operation. . */ @org.junit.Test public void position14() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[position() = (5 - 2)]/string(@name)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 3") ); } /** * Evaluation of "fn:position" used together with a multiplication operation. . */ @org.junit.Test public void position15() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[position() = (3 * 2)]/string(@name)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "John Doe 6") ); } /** * Evaluation of "fn:position" used together with a division (div) operation. . */ @org.junit.Test public void position16() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[position() = (6 div 2)]/string(@name)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 3") ); } /** * Evaluation of "fn:position" used together with a division (idiv) operation. . */ @org.junit.Test public void position17() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[position() = (6 idiv 2)]/string(@name)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 3") ); } /** * Evaluation of "fn:position" used together with a logical expression ("and" operator and "true" function). . */ @org.junit.Test public void position18() { final XQuery query = new XQuery( "for $h in (/works/employee[12]) return ($h/overtime[position() and fn:true()]/*/string())", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"Monday\", \"Tuesday\"") ); } /** * Evaluation of "fn:position" used together with a logical expression ("and" operator and "false" function). . */ @org.junit.Test public void position19() { final XQuery query = new XQuery( "for $h in (/works/employee[12]) return ($h/overtime[position() and fn:false()])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEmpty() || error("XPST0005") ) ); } /** * Evaluation of "fn:position", where the context node is not defined. . */ @org.junit.Test public void position2() { final XQuery query = new XQuery( "position()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Evaluation of "fn:position" used together with a logical expression ("or" operator and "true" function). . */ @org.junit.Test public void position20() { final XQuery query = new XQuery( "for $h in (/works/employee[12]) return $h/overtime[position() or fn:true()]/*/string()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"Monday\", \"Tuesday\"") ); } /** * Evaluation of "fn:position" used together with a logical expression ("or" operator and "false" function). . */ @org.junit.Test public void position21() { final XQuery query = new XQuery( "for $h in (/works/employee[12]) return $h/overtime[position() or fn:false()]/*/string()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"Monday\", \"Tuesday\"") ); } /** * Evaluation of "fn:position" used in the middle of a path expression. . */ @org.junit.Test public void position22() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[position() = 12]/overtime/*/string()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"Monday\", \"Tuesday\"") ); } /** * Top-level call on position(). */ @org.junit.Test public void position23() { final XQuery query = new XQuery( "position()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluation of "fn"position", where the last item is selected. . */ @org.junit.Test public void position3() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[position() = 13]/string(@name)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 13") ); } /** * Evaluation of "fn"position" together with "fn:last". . */ @org.junit.Test public void position4() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[position() = last()]/string(@name)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 13") ); } /** * Evaluation of "fn:position" together with "fn:last" (format last() = position()). . */ @org.junit.Test public void position5() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[last() = position()]/string(@name)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 13") ); } /** * Evaluation of "fn"position" together with a variable of type integer . */ @org.junit.Test public void position6() { final XQuery query = new XQuery( "for $var in 1 return for $h in (/works) return $h/employee[position() = $var]/string(@name)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 1") ); } /** * Evaluation of "fn"position" together with a variable of type string casted to integer inside the predicate. . */ @org.junit.Test public void position7() { final XQuery query = new XQuery( "for $var in \"1\" return for $h in (/works) return $h/employee[position() = xs:integer($var)]/string(@name)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 1") ); } /** * Evaluation of "fn"position" where two position functions are used inside the predicate. . */ @org.junit.Test public void position8() { final XQuery query = new XQuery( "for $h in (/works/employee[12]) return $h/overtime[position() = position()]/day/string()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"Monday\", \"Tuesday\"") ); } /** * Evaluation of "fn:position" where the position function is used inside a second predicate. . */ @org.junit.Test public void position9() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[@name][position() = 1]/string(@name)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 1") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnPrefixFromQName.java000066400000000000000000000311021222453003200302330ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the prefix-from-QName() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnPrefixFromQName extends QT3TestSet { /** * A test whose essence is: `prefix-from-QName()`. . */ @org.junit.Test public void kPrefixFromQName1() { final XQuery query = new XQuery( "prefix-from-QName()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `prefix-from-QName(1, 2)`. . */ @org.junit.Test public void kPrefixFromQName2() { final XQuery query = new XQuery( "prefix-from-QName(1, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(prefix-from-QName( () ))`. . */ @org.junit.Test public void kPrefixFromQName3() { final XQuery query = new XQuery( "empty(prefix-from-QName( () ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `prefix-from-QName( QName("example.com/", "pre:lname")) eq "pre"`. . */ @org.junit.Test public void kPrefixFromQName4() { final XQuery query = new XQuery( "prefix-from-QName( QName(\"example.com/\", \"pre:lname\")) eq \"pre\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of fn-prefix-fromQName function with wrong arity. . */ @org.junit.Test public void fnPrefixFromQname1() { final XQuery query = new XQuery( "fn:prefix-from-QName(\"arg1\",\"arg2\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Evaluation of fn-prefix-fromQName function as argument to fn:lower-case. . */ @org.junit.Test public void fnPrefixFromQname10() { final XQuery query = new XQuery( "fn:lower-case(fn:prefix-from-QName(xs:QName(\"FOO:bar\")))", ctx); try { query.namespace("FOO", "http://example.org"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "foo") ); } /** * Evaluation of fn-prefix-fromQName function as argument to fn:lower-case. . */ @org.junit.Test public void fnPrefixFromQname11() { final XQuery query = new XQuery( "fn:concat(fn:prefix-from-QName(xs:QName(\"foo:bar\")),\":bar\")", ctx); try { query.namespace("foo", "http://example.org"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "foo:bar") ); } /** * Evaluation of fn-prefix-fromQName function as argument to fn:substring-before. . */ @org.junit.Test public void fnPrefixFromQname12() { final XQuery query = new XQuery( "fn:substring-before(fn:prefix-from-QName(xs:QName(\"foo:bar\")),\"oo\")", ctx); try { query.namespace("foo", "http://example.org"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "f") ); } /** * Evaluation of fn-prefix-fromQName function as argument to fn:substring-after. . */ @org.junit.Test public void fnPrefixFromQname13() { final XQuery query = new XQuery( "fn:substring-after(fn:prefix-from-QName(xs:QName(\"foo:bar\")),\"f\")", ctx); try { query.namespace("foo", "http://example.org"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "oo") ); } /** * Evaluation of fn-prefix-fromQName function as argument to fn:string-length. . */ @org.junit.Test public void fnPrefixFromQname14() { final XQuery query = new XQuery( "fn:string-length(fn:prefix-from-QName(xs:QName(\"foo:bar\")))", ctx); try { query.namespace("foo", "http://example.org"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Evaluation of fn-prefix-fromQName function as argument to fn:substring. . */ @org.junit.Test public void fnPrefixFromQname15() { final XQuery query = new XQuery( "fn:substring(fn:prefix-from-QName(xs:QName(\"foo:bar\")),2)", ctx); try { query.namespace("foo", "http://example.org"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "oo") ); } /** * Evaluation of fn-prefix-fromQName function as argument to fn:string-join. . */ @org.junit.Test public void fnPrefixFromQname16() { final XQuery query = new XQuery( "fn:string-join((fn:prefix-from-QName(xs:QName(\"foo:bar\")),\":bar\"),\"\")", ctx); try { query.namespace("foo", "http://example.org"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "foo:bar") ); } /** * Evaluation of fn-prefix-fromQName function as argument to fn:starts-with. . */ @org.junit.Test public void fnPrefixFromQname17() { final XQuery query = new XQuery( "fn:starts-with(fn:prefix-from-QName(xs:QName(\"foo:bar\")),\"f\")", ctx); try { query.namespace("foo", "http://example.org"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of fn-prefix-fromQName function as argument to fn:ends-with. . */ @org.junit.Test public void fnPrefixFromQname18() { final XQuery query = new XQuery( "fn:ends-with(fn:prefix-from-QName(xs:QName(\"foo:bar\")),\"f\")", ctx); try { query.namespace("foo", "http://example.org"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of fn-prefix-fromQName function as argument to fn:contains. . */ @org.junit.Test public void fnPrefixFromQname19() { final XQuery query = new XQuery( "fn:contains(fn:prefix-from-QName(xs:QName(\"foo:bar\")),\"f\")", ctx); try { query.namespace("foo", "http://example.org"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of fn-prefix-fromQName function with wrong argument type. . */ @org.junit.Test public void fnPrefixFromQname2() { final XQuery query = new XQuery( "fn:prefix-from-QName(xs:integer(1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluation of fn-prefix-fromQName function with two namespaces declared with same namespace (different case). . */ @org.junit.Test public void fnPrefixFromQname20() { final XQuery query = new XQuery( "fn:prefix-from-QName(xs:QName(\"foo:bar\"))", ctx); try { query.namespace("foo", "http://example.org"); query.namespace("FOO", "http://example.org"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "foo") ); } /** * Evaluation of fn-prefix-fromQName function as argument to fn:string function and no prefix. Uses fn:count to avoid empty file. . */ @org.junit.Test public void fnPrefixFromQname3() { final XQuery query = new XQuery( "fn:count(fn:prefix-from-QName(xs:QName(\"name\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluation of fn-prefix-fromQName function as argument to xs:string function and no prefix Uses fn:count to avoid empty file. . */ @org.junit.Test public void fnPrefixFromQname4() { final XQuery query = new XQuery( "fn:string-length(xs:string(fn:prefix-from-QName(xs:QName(\"name\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluation of fn-prefix-fromQName function as argument to xs:string function and with prefix . */ @org.junit.Test public void fnPrefixFromQname5() { final XQuery query = new XQuery( "xs:string(fn:prefix-from-QName(xs:QName(\"foo:name\")))", ctx); try { query.namespace("foo", "http://example.org"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "foo") ); } /** * Evaluation of fn-prefix-fromQName function as argument to fn:string function and with prefix. . */ @org.junit.Test public void fnPrefixFromQname6() { final XQuery query = new XQuery( "fn:string(fn:prefix-from-QName(xs:QName(\"foo:name\")))", ctx); try { query.namespace("foo", "http://example.org"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "foo") ); } /** * Evaluation of fn-prefix-fromQName function with argument set to empty sequence. Uses fn:count to avoid empty file. . */ @org.junit.Test public void fnPrefixFromQname7() { final XQuery query = new XQuery( "fn:count(fn:prefix-from-QName(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluation of fn-prefix-fromQName function with a prefix that is not defined. . */ @org.junit.Test public void fnPrefixFromQname8() { final XQuery query = new XQuery( "fn:prefix-from-QName(xs:QName(\"foo:bar\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FONS0004") ); } /** * Evaluation of fn-prefix-fromQName function as argument to fn:upper-case. . */ @org.junit.Test public void fnPrefixFromQname9() { final XQuery query = new XQuery( "fn:upper-case(fn:prefix-from-QName(xs:QName(\"foo:bar\")))", ctx); try { query.namespace("foo", "http://example.org"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "FOO") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnQName.java000066400000000000000000000422701222453003200262410ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the QName() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnQName extends QT3TestSet { /** * Test function fn:QName. Simple use case from functions and operators spec . */ @org.junit.Test public void expandedQNameConstructFunc001() { final XQuery query = new XQuery( "element {fn:QName(\"http://www.example.com/example\", \"person\")}{ \"test\" }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("test", false) ); } /** * Test function fn:QName. Simple use case from functions and operators spec . */ @org.junit.Test public void expandedQNameConstructFunc002() { final XQuery query = new XQuery( "element {fn:QName(\"http://www.example.com/example\", \"ht:person\")}{ \"test\" }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("test", false) ); } /** * Test function fn:QName. Simple use case for 'no namespace' QName . */ @org.junit.Test public void expandedQNameConstructFunc003() { final XQuery query = new XQuery( "element {fn:QName(\"\", \"person\")}{ \"test\" }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("test", false) ); } /** * Test function fn:QName. Simple use case for 'no namespace' QName . */ @org.junit.Test public void expandedQNameConstructFunc004() { final XQuery query = new XQuery( "element {fn:QName((), \"person\")}{ \"test\" }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("test", false) ); } /** * Test function fn:QName. Error case - local name contains a prefix, but no namespace URI is specified . */ @org.junit.Test public void expandedQNameConstructFunc005() { final XQuery query = new XQuery( "fn:QName(\"\", \"ht:person\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Test function fn:QName. Error case - local name contains a prefix, but no namespace URI is specified . */ @org.junit.Test public void expandedQNameConstructFunc006() { final XQuery query = new XQuery( "fn:QName((), \"ht:person\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Test function fn:QName. Error case - invalid lexical representation for the local-name part . */ @org.junit.Test public void expandedQNameConstructFunc007() { final XQuery query = new XQuery( "fn:QName(\"http://www.example.com/example\", \"1person\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Test function fn:QName. Error case - invalid lexical representation for the local-name part . */ @org.junit.Test public void expandedQNameConstructFunc008() { final XQuery query = new XQuery( "fn:QName(\"http://www.example.com/example\", \"@person\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Test function fn:QName. Error case - invalid lexical representation for the local-name part . */ @org.junit.Test public void expandedQNameConstructFunc009() { final XQuery query = new XQuery( "fn:QName(\"http://www.example.com/example\", \"-person\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Test function fn:QName. Error case - invalid lexical representation for the local-name part . */ @org.junit.Test public void expandedQNameConstructFunc010() { final XQuery query = new XQuery( "fn:QName(\"http://www.example.com/example\", \"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Test function fn:QName. Error case - invalid lexical representation for the local-name part . */ @org.junit.Test public void expandedQNameConstructFunc011() { final XQuery query = new XQuery( "fn:QName(\"http://www.example.com/example\", \":person\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Test function fn:QName. Error case - invalid lexical representation for the local-name part . */ @org.junit.Test public void expandedQNameConstructFunc012() { final XQuery query = new XQuery( "fn:QName(\"http://www.example.com/example\", \"person:\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Test function fn:QName. Error case - wrong number of input parameters . */ @org.junit.Test public void expandedQNameConstructFunc013() { final XQuery query = new XQuery( "fn:QName(\"person\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Test function fn:QName. Error case - wrong number of input parameters . */ @org.junit.Test public void expandedQNameConstructFunc014() { final XQuery query = new XQuery( "fn:QName(\"http://www.example.com/example\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Test function fn:QName. Error case - invalid input type for parameters (integer) . */ @org.junit.Test public void expandedQNameConstructFunc015() { final XQuery query = new XQuery( "fn:QName(\"http://www.example.com/example\", xs:integer(\"100\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test function fn:QName. Error case - invalid input type for parameters (integer) . */ @org.junit.Test public void expandedQNameConstructFunc016() { final XQuery query = new XQuery( "fn:QName( xs:integer(\"100\"), \"person\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test function fn:QName. Select local-name part from source document . */ @org.junit.Test public void expandedQNameConstructFunc017() { final XQuery query = new XQuery( "element {fn:QName( \"http://www.example.com/example\", string((//FolderName)[2]) )}{ \"test\" }", ctx); try { query.context(node(file("prod/ForClause/fsx.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("test", false) ); } /** * Test function fn:QName. Select namespace-URI part from source document . */ @org.junit.Test public void expandedQNameConstructFunc018() { final XQuery query = new XQuery( "element {fn:QName( concat('http://www.example.com/', string((//FolderName)[2])), \"people\" )}{ \"test\" }", ctx); try { query.context(node(file("prod/ForClause/fsx.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("test", false) ); } /** * Test function fn:QName. Error case - zero length string for local-name . */ @org.junit.Test public void expandedQNameConstructFunc019() { final XQuery query = new XQuery( "element {fn:QName( \"http://www.example.com/example\", \"\" )}{ \"test\" }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Test function fn:QName. Local-name references an already defined namespace prefix which is assigned to a different URI . */ @org.junit.Test public void expandedQNameConstructFunc020() { final XQuery query = new XQuery( "declare namespace ht=\"http://www.example.com/example\"; element {fn:QName( \"http://www.example.com/another-example\", \"ht:person\" )}{ \"test\" }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("test", false) ); } /** * Test function fn:QName. URI exists and is linked to a different namespace prefix . */ @org.junit.Test public void expandedQNameConstructFunc021() { final XQuery query = new XQuery( "declare namespace ht=\"http://www.example.com/example\"; element {fn:QName( \"http://www.example.com/example\", \"ht2:person\" )}{ \"test\" }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("test", false) ); } /** * A test whose essence is: `QName()`. . */ @org.junit.Test public void kExpandedQNameConstructFunc1() { final XQuery query = new XQuery( "QName()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `QName((), "local") eq xs:QName("local")`. . */ @org.junit.Test public void kExpandedQNameConstructFunc10() { final XQuery query = new XQuery( "QName((), \"local\") eq xs:QName(\"local\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `QName("http://www.example.com/")`. . */ @org.junit.Test public void kExpandedQNameConstructFunc2() { final XQuery query = new XQuery( "QName(\"http://www.example.com/\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `QName("http://www.example.com/", "ncname", "error")`. . */ @org.junit.Test public void kExpandedQNameConstructFunc3() { final XQuery query = new XQuery( "QName(\"http://www.example.com/\", \"ncname\", \"error\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `QName("http://www.w3.org/2005/xpath-functions", "prefix:local") eq xs:QName("fn:local")`. . */ @org.junit.Test public void kExpandedQNameConstructFunc4() { final XQuery query = new XQuery( "QName(\"http://www.w3.org/2005/xpath-functions\", \"prefix:local\") eq xs:QName(\"fn:local\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A QName cannot start with a digit. . */ @org.junit.Test public void kExpandedQNameConstructFunc5() { final XQuery query = new XQuery( "QName(\"http://www.example.com/\", \"1asd:error\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * A test whose essence is: `QName("", "error:ncname")`. . */ @org.junit.Test public void kExpandedQNameConstructFunc6() { final XQuery query = new XQuery( "QName(\"\", \"error:ncname\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * A test whose essence is: `QName((), "error:ncname")`. . */ @org.junit.Test public void kExpandedQNameConstructFunc7() { final XQuery query = new XQuery( "QName((), \"error:ncname\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * URI/QName arguments appearing in wrong order, leading to an invalid QName. . */ @org.junit.Test public void kExpandedQNameConstructFunc8() { final XQuery query = new XQuery( "QName(\"my:qName\", \"http://example.com/MyErrorNS\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * A test whose essence is: `QName("", "local") eq xs:QName("local")`. . */ @org.junit.Test public void kExpandedQNameConstructFunc9() { final XQuery query = new XQuery( "QName(\"\", \"local\") eq xs:QName(\"local\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The last argument must be a string. . */ @org.junit.Test public void k2ExpandedQNameConstructFunc1() { final XQuery query = new XQuery( "fn:QName((), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test fn:QName for FOCA0002 on invalid input. . */ @org.junit.Test public void cbclQname001() { final XQuery query = new XQuery( "fn:QName('', ' ')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Evaluation of constructor function xs:QName for which the argument is not a literal. . */ @org.junit.Test public void qName1() { final XQuery query = new XQuery( "xs:QName(20)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnRemove.java000066400000000000000000000537271222453003200265060ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the remove() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnRemove extends QT3TestSet { /** * A test whose essence is: `remove()`. . */ @org.junit.Test public void kSeqRemoveFunc1() { final XQuery query = new XQuery( "remove()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `count(remove((1, "two", 3), 2)) eq 2`. . */ @org.junit.Test public void kSeqRemoveFunc10() { final XQuery query = new XQuery( "count(remove((1, \"two\", 3), 2)) eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(remove((1, 2, "three"), 3)) eq 2`. . */ @org.junit.Test public void kSeqRemoveFunc11() { final XQuery query = new XQuery( "count(remove((1, 2, \"three\"), 3)) eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `remove((3.1, "four"), 1)`. . */ @org.junit.Test public void kSeqRemoveFunc12() { final XQuery query = new XQuery( "remove((3.1, \"four\"), 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"four\"") ); } /** * A test whose essence is: `remove(error(), 1)`. . */ @org.junit.Test public void kSeqRemoveFunc13() { final XQuery query = new XQuery( "remove(error(), 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FOER0000") || error("XPST0005") ) ); } /** * Combine fn:remove() with operator 'eq'. . */ @org.junit.Test public void kSeqRemoveFunc14() { final XQuery query = new XQuery( "remove((5, 1e0), 2) eq 5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * Combine fn:remove() with operator 'eq'. . */ @org.junit.Test public void kSeqRemoveFunc15() { final XQuery query = new XQuery( "5 eq remove((5, 1e0), 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * Combine remove(), with a predicate and the 'eq' operator. . */ @org.junit.Test public void kSeqRemoveFunc16() { final XQuery query = new XQuery( "deep-equal((1, 2), (1, 2)[remove((true(), \"a string\"), 2)]) eq 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Combine fn:remove() with operator 'eq'. . */ @org.junit.Test public void kSeqRemoveFunc17() { final XQuery query = new XQuery( "remove((4, xs:untypedAtomic(\"4\")), 1) eq 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Combine fn:remove() with operator 'eq'. . */ @org.junit.Test public void kSeqRemoveFunc18() { final XQuery query = new XQuery( "4 eq remove((4, xs:untypedAtomic(\"1\")), 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * An expression involving the eq operator that trigger certain optimization paths in some implementations. . */ @org.junit.Test public void kSeqRemoveFunc19() { final XQuery query = new XQuery( "count(remove(current-time(), 1)) eq 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `remove(1, 2, "wrong param")`. . */ @org.junit.Test public void kSeqRemoveFunc2() { final XQuery query = new XQuery( "remove(1, 2, \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * An expression involving the eq operator that trigger certain optimization paths in some implementations. . */ @org.junit.Test public void kSeqRemoveFunc20() { final XQuery query = new XQuery( "empty(remove(current-time(), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Apply a predicate to the result of fn:remove(). . */ @org.junit.Test public void kSeqRemoveFunc21() { final XQuery query = new XQuery( "remove((1, 2, 3, current-time()), 4)[last()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Apply a predicate to the result of fn:remove(). . */ @org.junit.Test public void kSeqRemoveFunc22() { final XQuery query = new XQuery( "remove((1, 2, 3, current-time()), 4)[last() - 1]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Apply a predicate to the result of fn:remove(). . */ @org.junit.Test public void kSeqRemoveFunc23() { final XQuery query = new XQuery( "remove((1, 2, 3, current-time()), 9)[last() - 1]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Apply a predicate to the result of fn:remove(). . */ @org.junit.Test public void kSeqRemoveFunc24() { final XQuery query = new XQuery( "empty(remove((1, 2, 3, current-time()), 9)[last() - 10])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(remove((1, 2, 3), 0)) eq 3`. . */ @org.junit.Test public void kSeqRemoveFunc3() { final XQuery query = new XQuery( "count(remove((1, 2, 3), 0)) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(remove((1, 2, 3), -4)) eq 3`. . */ @org.junit.Test public void kSeqRemoveFunc4() { final XQuery query = new XQuery( "count(remove((1, 2, 3), -4)) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(remove((), 4))`. . */ @org.junit.Test public void kSeqRemoveFunc5() { final XQuery query = new XQuery( "empty(remove((), 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * A test whose essence is: `remove(("one", 2, 3), 1) instance of xs:integer+`. . */ @org.junit.Test public void kSeqRemoveFunc6() { final XQuery query = new XQuery( "remove((\"one\", 2, 3), 1) instance of xs:integer+", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `remove((1, "two", 3), 2) instance of xs:integer+`. . */ @org.junit.Test public void kSeqRemoveFunc7() { final XQuery query = new XQuery( "remove((1, \"two\", 3), 2) instance of xs:integer+", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `remove((1, 2, "three"), 3) instance of xs:integer+`. . */ @org.junit.Test public void kSeqRemoveFunc8() { final XQuery query = new XQuery( "remove((1, 2, \"three\"), 3) instance of xs:integer+", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(remove(("one", 2, 3), 1)) eq 2`. . */ @org.junit.Test public void kSeqRemoveFunc9() { final XQuery query = new XQuery( "count(remove((\"one\", 2, 3), 1)) eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Tests with non-value position . */ @org.junit.Test public void cbclFnRemove001() { final XQuery query = new XQuery( "remove(1 to 10,exactly-one((1 to 10)[. div 2 = 2]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 5 6 7 8 9 10") ); } /** * Tests removal from range value . */ @org.junit.Test public void cbclFnRemove002() { final XQuery query = new XQuery( "remove(1 to 10,4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 5 6 7 8 9 10") ); } /** * Tests removal from non-range value . */ @org.junit.Test public void cbclFnRemove003() { final XQuery query = new XQuery( "remove((1 to 10)[. mod 2 = 0],4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2 4 6 10") ); } /** * Tests removal from a sequence of values . */ @org.junit.Test public void cbclFnRemove004() { final XQuery query = new XQuery( "\n" + " remove(((1 to 10)[. mod 2 = 0],\"blah\",(1 to 10)[. mod 2 = 0]),4)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2 4 6 10 blah 2 4 6 8 10") ); } /** * arg1: sequence of string, arg2: integer . */ @org.junit.Test public void fnRemoveMixArgs001() { final XQuery query = new XQuery( "fn:remove ( (\"a\", \"b\", \"c\"), 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"b\", \"c\"") ); } /** * arg1: sequence of string, arg2: integer . */ @org.junit.Test public void fnRemoveMixArgs002() { final XQuery query = new XQuery( "fn:remove ( (\"a\", \"b\", \"c\"), 0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", \"b\", \"c\"") ); } /** * arg1: sequence of string, arg2: integer . */ @org.junit.Test public void fnRemoveMixArgs003() { final XQuery query = new XQuery( "fn:remove ( (\"a\", \"b\", \"c\", true()), 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", \"b\", true()") ); } /** * arg1: sequence of string, arg2: integer . */ @org.junit.Test public void fnRemoveMixArgs004() { final XQuery query = new XQuery( "fn:remove ( (xs:string(\"xyz\"), (), (), \"a\" , \"b\"), 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"xyz\", \"b\"") ); } /** * arg1: sequence of string,anyURI,arg2: integer . */ @org.junit.Test public void fnRemoveMixArgs005() { final XQuery query = new XQuery( "fn:remove( (xs:anyURI(\"www.example.com\"), \"a\", (\"\"), \"b\"), 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"www.example.com\", \"\", \"b\"") ); } /** * arg1: sequence of string,anyURI,arg2: integer . */ @org.junit.Test public void fnRemoveMixArgs006() { final XQuery query = new XQuery( "fn:remove( (xs:anyURI(\"www.example.com\"), \"a\", (\"\"), \"b\"), 10)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"www.example.com\", \"a\", \"\", \"b\"") ); } /** * arg1: sequence of string,anyURI,arg2: integer . */ @org.junit.Test public void fnRemoveMixArgs007() { final XQuery query = new XQuery( "fn:remove( (xs:anyURI(\"www.example.com\"), \"a\", (\"\"), \"b\"), -20)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"www.example.com\", \"a\", \"\", \"b\"") ); } /** * arg1:sequence of string,integer,arg2: integer . */ @org.junit.Test public void fnRemoveMixArgs008() { final XQuery query = new XQuery( "fn:remove( (xs:integer(\"100\"), xs:string(\"abc\")), 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"abc\"") ); } /** * arg1: sequence of decimal, integer, anyURI arg2: integer . */ @org.junit.Test public void fnRemoveMixArgs009() { final XQuery query = new XQuery( "fn:remove( (xs:decimal(\"1.01\"), xs:integer(\"12\"), xs:anyURI(\"www.example.com\")),3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1.01, 12") ); } /** * arg1: sequence of string,float ,arg2: integer . */ @org.junit.Test public void fnRemoveMixArgs010() { final XQuery query = new XQuery( "fn:remove( (xs:float(\"1.01\"), xs:string(\"a\")), 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.01") ); } /** * arg1: sequence of float,integer,arg2: integer . */ @org.junit.Test public void fnRemoveMixArgs011() { final XQuery query = new XQuery( "fn:remove( (xs:float(\"NaN\"), 100, (), 2), 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("xs:float('NaN'), 2") ); } /** * arg1: sequence of string,float, decimal arg2: integer . */ @org.junit.Test public void fnRemoveMixArgs012() { final XQuery query = new XQuery( "fn:remove( (xs:float(\"-INF\"), xs:decimal(\"2.34\"), \"abc\"), 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("xs:float(\"-INF\"), \"abc\"") ); } /** * arg1: sequence of double,float,boolean ,arg2: integer . */ @org.junit.Test public void fnRemoveMixArgs013() { final XQuery query = new XQuery( "fn:remove( (xs:double(\"1.34\"), xs:float(\"INF\"), true()), 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("xs:float(\"INF\"), true()") ); } /** * arg1: sequence of double, integer ,arg2: integer . */ @org.junit.Test public void fnRemoveMixArgs014() { final XQuery query = new XQuery( "fn:remove( (xs:double(\"INF\"), 2, 3), 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("xs:double(\"INF\"), 3") ); } /** * arg1: sequence of string,double ,arg2: integer . */ @org.junit.Test public void fnRemoveMixArgs015() { final XQuery query = new XQuery( "fn:remove( (xs:double(\"NaN\"), \"a\", \"b\"), 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("xs:double(\"NaN\"), \"a\"") ); } /** * arg1: sequence of string,boolean, double ,arg2: integer . */ @org.junit.Test public void fnRemoveMixArgs016() { final XQuery query = new XQuery( "fn:remove( (xs:boolean(\"1\"), xs:double(\"-INF\"), \"s\"), 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("true(), xs:double(\"-INF\")") ); } /** * arg1: sequence of boolean ,arg2: integer . */ @org.junit.Test public void fnRemoveMixArgs017() { final XQuery query = new XQuery( "fn:remove( (xs:boolean(\"0\")), 2 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * arg1: sequence of string,boolean, date ,arg2: integer . */ @org.junit.Test public void fnRemoveMixArgs018() { final XQuery query = new XQuery( "fn:remove( (xs:boolean(\"true\"), xs:date(\"1993-03-31\"), 4, \"a\"),3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("true(), xs:date('1993-03-31'), \"a\"") ); } /** * arg1: sequence of string,dateTime,boolean ,arg2: integer . */ @org.junit.Test public void fnRemoveMixArgs019() { final XQuery query = new XQuery( "fn:remove( (xs:dateTime(\"1972-12-31T00:00:00\"), xs:boolean(\"false\"), (), (\" \")) ,3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("xs:dateTime(\"1972-12-31T00:00:00\"), false()") ); } /** * arg1: sequence of time,decimal, integer ,arg2: integer . */ @org.junit.Test public void fnRemoveMixArgs020() { final XQuery query = new XQuery( "fn:remove( (xs:time(\"12:30:00\"), xs:decimal(\"2.000003\"), 2), 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("xs:time(\"12:30:00\"), 2") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnReplace.java000066400000000000000000001117271222453003200266170ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the replace() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnReplace extends QT3TestSet { /** * The flags argument cannot contain whitespace. . */ @org.junit.Test public void kReplaceFunc1() { final XQuery query = new XQuery( "replace(\"input\", \"pattern\", \"replacement\", \" \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0001") ); } /** * The pattern can't be the empty sequence. . */ @org.junit.Test public void kReplaceFunc2() { final XQuery query = new XQuery( "replace(\"input\", (), \"replacement\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The replacement can't be the empty sequence. . */ @org.junit.Test public void kReplaceFunc3() { final XQuery query = new XQuery( "replace(\"input\", \"pattern\", ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The flags argument cannot contain 'X'. . */ @org.junit.Test public void kReplaceFunc4() { final XQuery query = new XQuery( "replace(\"input\", \"pattern\", \"replacement\", \"X\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0001") ); } /** * Only four arguments are accepted. . */ @org.junit.Test public void kReplaceFunc5() { final XQuery query = new XQuery( "replace(\"input\", \"pattern\", \"replacement\", \"\", ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A '\' cannot occur at the end of the line. . */ @org.junit.Test public void kReplaceFunc6() { final XQuery query = new XQuery( "replace(\"input\", \"in\", \"thisIsInvalid\\\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0004") ); } /** * A '$' cannot occur at the end of the line. . */ @org.junit.Test public void kReplaceFunc7() { final XQuery query = new XQuery( "replace(\"input\", \"(input)\", \"thisIsInvalid$\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0004") ); } /** * A '\' cannot be used to escape whitespace. . */ @org.junit.Test public void kReplaceFunc8() { final XQuery query = new XQuery( "replace(\"input\", \"in\", \"thisIsInvalid\\ \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0004") ); } /** * A '$' cannot be followed by whitespace. . */ @org.junit.Test public void kReplaceFunc9() { final XQuery query = new XQuery( "replace(\"input\", \"in\", \"thisIsInvalid$ \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0004") ); } /** * Unexpectedly ending escape. . */ @org.junit.Test public void k2ReplaceFunc1() { final XQuery query = new XQuery( "replace(\"a a a \", \"(a )\", \"replacment: \\1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0004") ); } /** * Unexpectedly ending escape. . */ @org.junit.Test public void k2ReplaceFunc2() { final XQuery query = new XQuery( "replace(\"a a a \", \"(a )\", \"replacment: \\1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0004") ); } /** * Use a back reference that isn't preceeded by sufficiently many captures, and therefore match the empty sequence. . */ @org.junit.Test public void k2ReplaceFunc3() { final XQuery query = new XQuery( "replace(\"abcd\", \"(a)\\2(b)\", \"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Use a back reference inside a character class. . */ @org.junit.Test public void k2ReplaceFunc4() { final XQuery query = new XQuery( "replace(\"abcd\", \"(asd)[\\1]\", \"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Use a back reference inside a character class(#2). . */ @org.junit.Test public void k2ReplaceFunc5() { final XQuery query = new XQuery( "replace(\"abcd\", \"(asd)[asd\\1]\", \"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Use a back reference inside a character class(#3). . */ @org.junit.Test public void k2ReplaceFunc6() { final XQuery query = new XQuery( "replace(\"abcd\", \"(asd)[asd\\0]\", \"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Use a back reference inside a character class(#3). . */ @org.junit.Test public void k2ReplaceFunc7() { final XQuery query = new XQuery( "replace(\"abcd\", \"1[asd\\0]\", \"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Use fn:replace inside user function. . */ @org.junit.Test public void k2ReplaceFunc8() { final XQuery query = new XQuery( "declare function local:doReplace($input as xs:string?, $pattern as xs:string, $replacement as xs:string) as xs:string { fn:replace($input, $pattern, $replacement) }; {fn:replace(\"ThiY Ybcd.\", \"Y\", \"Q\")} {local:doReplace(\"ThiY iY a abYY.\", \"Y\", \"Q\")} , fn:replace(\"ThiY abcdY.\", \"Y\", \"Q\"), local:doReplace(\"ThiY iY a abYY.\", \"Y\", \"Q\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("ThiQ Qbcd.ThiQ iQ a abQQ.ThiQ abcdQ. ThiQ iQ a abQQ.", false) ); } /** * Tests a replace with prepared value evaluated to a boolean . */ @org.junit.Test public void cbclFnReplace001() { final XQuery query = new XQuery( "\n" + " boolean(replace(if(exists((1 to 10)[. mod 2 = 0])) then \"blah\" else (),\"a\",\"e\",\"m\"))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Tests a prepared expression which matches the empty sequence . */ @org.junit.Test public void cbclFnReplace002() { final XQuery query = new XQuery( "replace(\"a\",\"\",\"b\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0003") ); } /** * Tests empty regex on prepared fn:replace . */ @org.junit.Test public void cbclFnReplace003() { final XQuery query = new XQuery( "\n" + " replace(string-join(for $x in (1 to 10)[. mod 2 = 0] return string($x),\",\"),\"\",\"c\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0003") ); } /** * Tests empty regex on prepared fn:replace . */ @org.junit.Test public void cbclFnReplace004() { final XQuery query = new XQuery( "\n" + " replace(string-join(for $x in (1 to 10)[. mod 2 = 0] return string($x),\",\"),\"\",\"c\",\"m\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0003") ); } /** * Tests empty regex on prepared fn:replace . */ @org.junit.Test public void cbclFnReplace005() { final XQuery query = new XQuery( "\n" + " replace(string-join(for $x in (1 to 10)[. mod 2 = 0] return string($x),\",\"),\"\",\"c\",\"m\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0003") ); } /** * Evaluation of replace function with replacement = "*" as an example 1 for this function. . */ @org.junit.Test public void fnReplace1() { final XQuery query = new XQuery( "replace(\"abracadabra\", \"bra\", \"*\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a*cada*") ); } /** * Two alternatives within the pattern both match at the same position in the $input. The first one is chosen. . */ @org.junit.Test public void fnReplace10() { final XQuery query = new XQuery( "fn:replace(\"abcd\", \"(ab)|(a)\", \"[1=$1][2=$2]\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "[1=ab][2=]cd") ); } /** * Evaluation of fn:replace function with input set to empty sequence. Uses the fn:count function to avoid empty file. . */ @org.junit.Test public void fnReplace11() { final XQuery query = new XQuery( "fn:count(fn:replace((), \"bra\", \"*\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluate that calling function with flags omitted is same as flags being the zero length string. . */ @org.junit.Test public void fnReplace12() { final XQuery query = new XQuery( "replace(\"abracadabra\", \"bra\", \"*\", \"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a*cada*") ); } /** * Evaluation of replace function with pattern set to "\?" for an input string that contains "?". . */ @org.junit.Test public void fnReplace13() { final XQuery query = new XQuery( "fn:replace(\"abracadabra?abracadabra\", \"\\?\", \"with\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abracadabrawithabracadabra") ); } /** * Evaluation of replace function with pattern set to "\*" for an input string that contains "*". . */ @org.junit.Test public void fnReplace14() { final XQuery query = new XQuery( "fn:replace(\"abracadabra*abracadabra\", \"\\*\", \"with\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abracadabrawithabracadabra") ); } /** * Evaluation of replace function with pattern set to "\+" for an input string that contains "+". . */ @org.junit.Test public void fnReplace15() { final XQuery query = new XQuery( "fn:replace(\"abracadabra+abracadabra\", \"\\+\", \"with\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abracadabrawithabracadabra") ); } /** * Evaluation of replace function with pattern set to "\{" for an input string that contains "}". . */ @org.junit.Test public void fnReplace16() { final XQuery query = new XQuery( "fn:replace(\"abracadabra{abracadabra\", \"\\{\", \"with\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abracadabrawithabracadabra") ); } /** * Evaluation of replace function with pattern set to "\}" for an input string that contains "}". . */ @org.junit.Test public void fnReplace17() { final XQuery query = new XQuery( "fn:replace(\"abracadabra}abracadabra\", \"\\}\", \"with\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abracadabrawithabracadabra") ); } /** * Evaluation of replace function with pattern set to "\(" for an input string that contains "(". . */ @org.junit.Test public void fnReplace18() { final XQuery query = new XQuery( "fn:replace(\"abracadabra(abracadabra\", \"\\(\", \"with\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abracadabrawithabracadabra") ); } /** * Evaluation of replace function with pattern set to "\)" for an input string that contains ")". . */ @org.junit.Test public void fnReplace19() { final XQuery query = new XQuery( "fn:replace(\"abracadabra)abracadabra\", \"\\)\", \"with\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abracadabrawithabracadabra") ); } /** * Evaluation of replace function with pattern = "a.*a" and replacement = "*" as an example 2 for this function. . */ @org.junit.Test public void fnReplace2() { final XQuery query = new XQuery( "replace(\"abracadabra\", \"a.*a\", \"*\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "*") ); } /** * Evaluation of replace function with pattern set to "\[" for an input string that contains "[". . */ @org.junit.Test public void fnReplace20() { final XQuery query = new XQuery( "fn:replace(\"abracadabra[abracadabra\", \"\\[\", \"with\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abracadabrawithabracadabra") ); } /** * Evaluation of replace function with pattern set to "\]" for an input string that contains "]". . */ @org.junit.Test public void fnReplace21() { final XQuery query = new XQuery( "fn:replace(\"abracadabra]abracadabra\", \"\\]\", \"with\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abracadabrawithabracadabra") ); } /** * Evaluation of replace function with pattern set to "\-" for an input string that contains "-". . */ @org.junit.Test public void fnReplace22() { final XQuery query = new XQuery( "fn:replace(\"abracadabra-abracadabra\", \"\\-\",\"with\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abracadabrawithabracadabra") ); } /** * Evaluation of replace function with pattern set to "\." for an input string that contains ".". . */ @org.junit.Test public void fnReplace23() { final XQuery query = new XQuery( "fn:replace(\"abracadabra.abracadabra\", \"\\.\",\"with\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abracadabrawithabracadabra") ); } /** * Evaluation of replace function with pattern set to "\|" for an input string that contains "|". . */ @org.junit.Test public void fnReplace24() { final XQuery query = new XQuery( "fn:replace(\"abracadabra|abracadabra\", \"\\|\",\"with\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abracadabrawithabracadabra") ); } /** * Evaluation of replace function with pattern set to "\\" for an input string that contains "\". . */ @org.junit.Test public void fnReplace25() { final XQuery query = new XQuery( "fn:replace(\"abracadabra\\abracadabra\", \"\\\\\",\"with\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abracadabrawithabracadabra") ); } /** * Evaluation of replace function with pattern set to "\t" for an input string that contains the tab character. . */ @org.junit.Test public void fnReplace26() { final XQuery query = new XQuery( "fn:replace(\"abracadabra\tabracadabra\", \"\\t\",\"with\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abracadabrawithabracadabra") ); } /** * Evaluation of replace function with pattern set to "\n" for an input string that contains the newline character. . */ @org.junit.Test public void fnReplace27() { final XQuery query = new XQuery( "fn:replace(\"abracadabra\n" + "abracadabra\", \"\\n\",\"with\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abracadabrawithabracadabra") ); } /** * Evaluation of replace function with pattern set to "aa{1}" (exact quantity) for an input string that contains the "aa" string. . */ @org.junit.Test public void fnReplace28() { final XQuery query = new XQuery( "fn:replace(\"abracadabraabracadabra\", \"aa{1}\",\"with\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abracadabrwithbracadabra") ); } /** * Evaluation of replace function with pattern set to "aa{1,}" (min quantity) for an input string that contains the "aa" string twice. . */ @org.junit.Test public void fnReplace29() { final XQuery query = new XQuery( "fn:replace(\"abracadabraabracadabraabracadabra\", \"aa{1,}\",\"with\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abracadabrwithbracadabrwithbracadabra") ); } /** * Evaluation of replace function with pattern = "a.*?a" and replacement = "*" as an example 3 for this function. . */ @org.junit.Test public void fnReplace3() { final XQuery query = new XQuery( "replace(\"abracadabra\", \"a.*?a\", \"*\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "*c*bra") ); } /** * Evaluation of replace function with pattern set to "aa{1,2}" (range quantity) for an input string that contains the "aa" string twice. . */ @org.junit.Test public void fnReplace30() { final XQuery query = new XQuery( "fn:replace(\"abracadabraabracadabraabracadabra\", \"aa{1,2}\",\"with\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abracadabrwithbracadabrwithbracadabra") ); } /** * Evaluation of replace function with pattern set to "\^". . */ @org.junit.Test public void fnReplace31() { final XQuery query = new XQuery( "fn:replace(\"abracadabra^abracadabra\", \"\\^\",\"with\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abracadabrawithabracadabra") ); } /** * Evaluation of replace function with pattern set to "^a". . */ @org.junit.Test public void fnReplace32() { final XQuery query = new XQuery( "fn:replace(\"abracadabra\", \"^a\",\"with\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "withbracadabra") ); } /** * Evaluation of replace function with pattern that does not match the input string. . */ @org.junit.Test public void fnReplace33() { final XQuery query = new XQuery( "fn:replace(\"abracadabra\", \"ww\",\"with\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abracadabra") ); } /** * Evaluation of replace function with escaped $ sign in replacement string.. */ @org.junit.Test public void fnReplace37() { final XQuery query = new XQuery( "fn:replace(\"abracadabra\", \"a\", \"\\$\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "$br$c$d$br$") ); } /** * Evaluation of replace function with escaped $ sign in replacement string.. */ @org.junit.Test public void fnReplace38() { final XQuery query = new XQuery( "fn:replace(\"abracadabra\", \"(a)\", \"\\$$1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "$abr$ac$ad$abr$a") ); } /** * Evaluation of replace function with escaped \ sign in replacement string.. */ @org.junit.Test public void fnReplace39() { final XQuery query = new XQuery( "fn:replace(\"abracadabra\", \"a\", \"\\\\\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "\\br\\c\\d\\br\\") ); } /** * Evaluation of replace function with pattern = "a" and replacement = "" as an example 4 for this function. . */ @org.junit.Test public void fnReplace4() { final XQuery query = new XQuery( "replace(\"abracadabra\", \"a\", \"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "brcdbr") ); } /** * Evaluation of replace with double-digit capture. */ @org.junit.Test public void fnReplace40() { final XQuery query = new XQuery( "fn:replace(\"abracadabra\", \"((((( ((((( (((((a))))) ))))) )))))\", \"|$1$15|\", \"x\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "|aa|br|aa|c|aa|d|aa|br|aa|") ); } /** * Evaluation of replace with double-digit capture. */ @org.junit.Test public void fnReplace41() { final XQuery query = new XQuery( "fn:replace(\"abracadabra\", \"((((( ((((( (((((a))))) ))))) )))))\", \"$1520\", \"x\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a20bra20ca20da20bra20") ); } /** * Evaluation of replace with double-digit capture beyond max capture value. */ @org.junit.Test public void fnReplace42() { final XQuery query = new XQuery( "fn:replace(\"abracadabra\", \"((((( ((((( (((((a)(b))))) ))))) )))))\", \"($14.$15.$16.$17)\", \"x\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "(ab.a.b.ab7)racad(ab.a.b.ab7)ra") ); } /** * "." does NOT match CR in default mode. */ @org.junit.Test public void fnReplace43() { final XQuery query = new XQuery( "fn:replace(concat('Mary', codepoints-to-string(13), 'Jones'), 'Mary.Jones', 'Jacob Jones')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("concat('Mary', codepoints-to-string(13), 'Jones')") ); } /** * "." does match CR in dot-all mode. */ @org.junit.Test public void fnReplace44() { final XQuery query = new XQuery( "fn:replace(concat('Mary', codepoints-to-string(13), 'Jones'), 'Mary.Jones', 'Jacob Jones', 's')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("'Jacob Jones'") ); } /** * Evaluation of replace function with pattern = "a(.)" and replacement = "a$1$1" as an example 5 for this function. . */ @org.junit.Test public void fnReplace5() { final XQuery query = new XQuery( "replace(\"abracadabra\", \"a(.)\", \"a$1$1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abbraccaddabbra") ); } /** * Evaluation of replace function with pattern = ".*?" and replacement = "$1" as an example 6 for this function. Should raise an error . */ @org.junit.Test public void fnReplace6() { final XQuery query = new XQuery( "replace(\"abracadabra\", \".*?\", \"$1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0003") ); } /** * Evaluation of replace function with pattern = "A+" and replacement = "b" as an example 7 for this function. . */ @org.junit.Test public void fnReplace7() { final XQuery query = new XQuery( "replace(\"AAAA\", \"A+\", \"b\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "b") ); } /** * Evaluation of replace function with pattern = "A+?" and replacement = "b" as an example 8 for this function. . */ @org.junit.Test public void fnReplace8() { final XQuery query = new XQuery( "replace(\"AAAA\", \"A+?\", \"b\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "bbbb") ); } /** * Evaluation of replace function with pattern = "^(.*?)d(.*)" and replacement = "$1c$2" as an example 9 for this function. . */ @org.junit.Test public void fnReplace9() { final XQuery query = new XQuery( "replace(\"darted\", \"^(.*?)d(.*)$\", \"$1c$2\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "carted") ); } /** * Evaluates The "replace" function with the arguments set as follows: $input = xs:string(lower bound) $pattern = xs:string(lower bound) $replacement = xs:string(lower bound) . */ @org.junit.Test public void fnReplace3args1() { final XQuery query = new XQuery( "fn:replace(\"This is a characte\",\"This is a characte\",\"This is a characte\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "This is a characte") ); } /** * Evaluates The "replace" function with the arguments set as follows: $input = xs:string(mid range) $pattern = xs:string(lower bound) $replacement = xs:string(lower bound) . */ @org.junit.Test public void fnReplace3args2() { final XQuery query = new XQuery( "fn:replace(\"This is a characte\",\"This is a characte\",\"This is a characte\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "This is a characte") ); } /** * Evaluates The "replace" function with the arguments set as follows: $input = xs:string(upper bound) $pattern = xs:string(lower bound) $replacement = xs:string(lower bound) . */ @org.junit.Test public void fnReplace3args3() { final XQuery query = new XQuery( "fn:replace(\"This is a characte\",\"This is a characte\",\"This is a characte\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "This is a characte") ); } /** * Evaluates The "replace" function with the arguments set as follows: $input = xs:string(lower bound) $pattern = xs:string(mid range) $replacement = xs:string(lower bound) . */ @org.junit.Test public void fnReplace3args4() { final XQuery query = new XQuery( "fn:replace(\"This is a characte\",\"This is a characte\",\"This is a characte\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "This is a characte") ); } /** * Evaluates The "replace" function with the arguments set as follows: $input = xs:string(lower bound) $pattern = xs:string(upper bound) $replacement = xs:string(lower bound) . */ @org.junit.Test public void fnReplace3args5() { final XQuery query = new XQuery( "fn:replace(\"This is a characte\",\"This is a characte\",\"This is a characte\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "This is a characte") ); } /** * Evaluates The "replace" function with the arguments set as follows: $input = xs:string(lower bound) $pattern = xs:string(lower bound) $replacement = xs:string(mid range) . */ @org.junit.Test public void fnReplace3args6() { final XQuery query = new XQuery( "fn:replace(\"This is a characte\",\"This is a characte\",\"This is a characte\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "This is a characte") ); } /** * Evaluates The "replace" function with the arguments set as follows: $input = xs:string(lower bound) $pattern = xs:string(lower bound) $replacement = xs:string(upper bound) . */ @org.junit.Test public void fnReplace3args7() { final XQuery query = new XQuery( "fn:replace(xs:string(\"This is a characte\"),xs:string(\"This is a characte\"),xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "This is a characte") ); } /** * Invalid flag for fn:matches fourth argument. . */ @org.junit.Test public void fnReplaceErr1() { final XQuery query = new XQuery( "fn:replace(\"abracadabra\", \"bra\", \"*\", \"p\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0001") ); } /** * the value of $replacement contains a "\" character that is not part of a "\\" pair, unless it is immediately followed by a "$" character. . */ @org.junit.Test public void fnReplaceErr2() { final XQuery query = new XQuery( "fn:replace(\"abracadabra\", \"bra\", \"\\\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0004") ); } /** * The value of $replacement contains a "$" character that is not immediately followed by a digit 0-9 and not immediately preceded by a "\". . */ @org.junit.Test public void fnReplaceErr3() { final XQuery query = new XQuery( "fn:replace(\"abracadabra\", \"bra\", \"$y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0004") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnResolveQName.java000066400000000000000000000460421222453003200276020ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the resolve-QName() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnResolveQName extends QT3TestSet { /** * A test whose essence is: `resolve-QName()`. . */ @org.junit.Test public void kResolveQNameConstructFunc1() { final XQuery query = new XQuery( "resolve-QName()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `resolve-QName("wrongparam")`. . */ @org.junit.Test public void kResolveQNameConstructFunc2() { final XQuery query = new XQuery( "resolve-QName(\"wrongparam\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `resolve-QName("wrongparam", "takes a node", "wrong")`. . */ @org.junit.Test public void kResolveQNameConstructFunc3() { final XQuery query = new XQuery( "resolve-QName(\"wrongparam\", \"takes a node\", \"wrong\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Although the second argument contains a type error(because an element is expected), it is also valid to return the empty sequence because one must not evaluate all arguments. . */ @org.junit.Test public void kResolveQNameConstructFunc4() { final XQuery query = new XQuery( "empty(resolve-QName((), \"a string\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * Tests fn:resolve-QName on an empty prefix an a node without a default namespace . */ @org.junit.Test public void cbclFnResolveQname001() { final XQuery query = new XQuery( "resolve-QName(\"blah\",)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "blah") ); } /** * Evaluation of fn:resolve-qname function for which the give qname is not lexically correct. . */ @org.junit.Test public void fnResolveQname1() { final XQuery query = new XQuery( "fn:resolve-QName(\"aName::\", Some content)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Evaluation of fn:resolve-qname function for which the given qname has no prefix and there is a namespace binding with prefix for the element. uses fn:namespace-uri-from-qname to get namespace uri. Element is given as direct element use fn:count to avoid empty file. . */ @org.junit.Test public void fnResolveQname10() { final XQuery query = new XQuery( "fn:count(fn:namespace-uri-from-QName(fn:resolve-QName(\"anElement\", Some content)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluation of fn:resolve-qname function for which the given qname has a prefix used together with xs:string and there is a namespace binding with prefix for the element. uses fn:local-name-from-qname to get local part. Element is given as direct element . */ @org.junit.Test public void fnResolveQname11() { final XQuery query = new XQuery( "fn:string(fn:local-name-from-QName(fn:resolve-QName(xs:string(\"p1:anElement\"), Some content)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "anElement") ); } /** * Evaluation of fn:resolve-qname function for which the given qname has a prefix used together with xs:string and there is a namespace binding with prefix for the element. uses fn:namespace-uri-from-qname to get namespace-uri part. Element is given as direct element . */ @org.junit.Test public void fnResolveQname12() { final XQuery query = new XQuery( "fn:string(fn:namespace-uri-from-QName(fn:resolve-QName(xs:string(\"p1:anElement\"), Some content)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.com/examples") ); } /** * Evaluation of fn:resolve-qname function for which the given qname has a prefix used together with fn:concat and there is a namespace binding with prefix for the element. uses fn:local-name-from-qname to get local part. Element is given as direct element . */ @org.junit.Test public void fnResolveQname13() { final XQuery query = new XQuery( "fn:string(fn:local-name-from-QName(fn:resolve-QName(fn:concat(\"p1:\",\"anElement\"), Some content)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "anElement") ); } /** * Evaluation of fn:resolve-qname function for which the given qname has a prefix used together with fn:concat and there is a namespace binding with prefix for the element. uses fn:namespace-uri-from-qname to get namespace-uri part. Element is given as direct element . */ @org.junit.Test public void fnResolveQname14() { final XQuery query = new XQuery( "fn:string(fn:namespace-uri-from-QName(fn:resolve-QName(fn:concat(\"p1:\",\"anElement\"), Some content)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.com/examples") ); } /** * Evaluation of fn:resolve-qname function for which the given qname has a prefix used together with fn:string-join and there is a namespace binding with prefix for the element. uses fn:local-name-from-qname to get local part. Element is given as direct element . */ @org.junit.Test public void fnResolveQname15() { final XQuery query = new XQuery( "fn:string(fn:local-name-from-QName(fn:resolve-QName(fn:string-join((\"p1:\",\"anElement\"),\"\"), Some content)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "anElement") ); } /** * Evaluation of fn:resolve-qname function for which the given qname has a prefix used together with fn:string-join and there is a namespace binding with prefix for the element. uses fn:namespace-uri-from-qname to get namespace-uri part. Element is given as direct element . */ @org.junit.Test public void fnResolveQname16() { final XQuery query = new XQuery( "fn:string(fn:namespace-uri-from-QName(fn:resolve-QName(fn:string-join(('p1:','anElement'),''), Some content)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.com/examples") ); } /** * Evaluation of fn:resolve-qname function for which the given qname has a prefix used together with fn:substring-before and there is a namespace binding with prefix for the element. uses fn:local-name-from-qname to get local part. Element is given as direct element . */ @org.junit.Test public void fnResolveQname17() { final XQuery query = new XQuery( "fn:string(fn:local-name-from-QName(fn:resolve-QName(fn:substring-before(\"p1:anElementabc\",\"abc\"), Some content)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "anElement") ); } /** * Evaluation of fn:resolve-qname function for which the given qname has a prefix used together with fn:substring-before and there is a namespace binding with prefix for the element. uses fn:namespace-uri-from-qname to get namespace-uri part. Element is given as direct element . */ @org.junit.Test public void fnResolveQname18() { final XQuery query = new XQuery( "fn:string(fn:namespace-uri-from-QName(fn:resolve-QName(fn:substring-before(\"p1:anElementabc\",\"abc\"), Some content)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.com/examples") ); } /** * Evaluation of fn:resolve-qname function for which the given qname has a prefix used together with fn:substring-after and there is a namespace binding with prefix for the element. uses fn:local-name-from-qname to get local part. Element is given as direct element . */ @org.junit.Test public void fnResolveQname19() { final XQuery query = new XQuery( "fn:string(fn:local-name-from-QName(fn:resolve-QName(fn:substring-after(\"abcp1:anElement\",\"abc\"), Some content)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "anElement") ); } /** * Evaluation of fn:resolve-qname function for which the give qname has a prefix but element does not have binding namespace. Element is give as a directly constructed element . */ @org.junit.Test public void fnResolveQname2() { final XQuery query = new XQuery( "fn:resolve-QName(\"p1:anElement\", Some content)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FONS0004") ); } /** * Evaluation of fn:resolve-qname function for which the given qname has a prefix used together with fn:substring-after and there is a namespace binding with prefix for the element. uses fn:namespace-uri-from-qname to get namespace-uri part. Element is given as direct element . */ @org.junit.Test public void fnResolveQname20() { final XQuery query = new XQuery( "fn:string(fn:namespace-uri-from-QName(fn:resolve-QName(fn:substring-after(\"abcp1:anElement\",\"abc\"), Some content)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.com/examples") ); } /** * Evaluation of fn:resolve-qname function for which the given qname has a prefix used together with fn:substring and there is a namespace binding with prefix for the element. uses fn:local-name-from-qname to get local part. Element is given as direct element . */ @org.junit.Test public void fnResolveQname21() { final XQuery query = new XQuery( "fn:string(fn:local-name-from-QName(fn:resolve-QName(fn:substring(\"abcp1:anElement\",4), Some content)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "anElement") ); } /** * Evaluation of fn:resolve-qname function for which the given qname has a prefix used together with fn:substring and there is a namespace binding with prefix for the element. uses fn:namespace-uri-from-qname to get namespace-uri part. Element is given as direct element . */ @org.junit.Test public void fnResolveQname22() { final XQuery query = new XQuery( "fn:string(fn:namespace-uri-from-QName(fn:resolve-QName(fn:substring(\"abcp1:anElement\",4), Some content)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.com/examples") ); } /** * Evaluation of fn:resolve-qname function for which the give qname is the empty sequence uses fn:count to avoid empty file . */ @org.junit.Test public void fnResolveQname3() { final XQuery query = new XQuery( "fn:count(fn:resolve-QName((), Some content))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluation of fn:resolve-qname function for which the give qname has a prefix and there is a namespace binding for the element. uses fn:local-name-from-QName to get local part. Element is given as direct element . */ @org.junit.Test public void fnResolveQname4() { final XQuery query = new XQuery( "fn:string(fn:local-name-from-QName(fn:resolve-QName(\"p1:name\", Some content)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "name") ); } /** * Evaluation of fn:resolve-qname function for which the give qname has a prefix and there is a namespace binding for the element. uses fn:namespace-uri-from-QName to get namespace part. Element is given as direct element . */ @org.junit.Test public void fnResolveQname5() { final XQuery query = new XQuery( "fn:string(fn:namespace-uri-from-QName(fn:resolve-QName(\"p1:name\", Some content)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.com/examples") ); } /** * Evaluation of fn:resolve-qname function for which the give qname has a prefix and there is a namespace binding for the element. Element has multiple namespapce bindings. Uses fn:local-name-from-QName to get local part. Element is given as direct element . */ @org.junit.Test public void fnResolveQname6() { final XQuery query = new XQuery( "fn:string(fn:local-name-from-QName(fn:resolve-QName(\"p1:name\", Some content)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "name") ); } /** * Evaluation of fn:resolve-qname function for which the give qname has a prefix and there is a namespace binding for the element. uses fn:namespace-uri-from-QName to get local part. Element is given as direct element . */ @org.junit.Test public void fnResolveQname7() { final XQuery query = new XQuery( "fn:string(fn:namespace-uri-from-QName(fn:resolve-QName(\"P1:name\", Some content)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://someothernamespace.com/examples") ); } /** * Evaluation of fn:resolve-qname function for which the given qname has no prefix and there is a namespace binding for the element. uses fn:local-part-from-QName to get local part. Element is given as direct element . */ @org.junit.Test public void fnResolveQname8() { final XQuery query = new XQuery( "fn:string(fn:local-name-from-QName(fn:resolve-QName(\"anElement\", Some content)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "anElement") ); } /** * Evaluation of fn:resolve-qname function for which the given qname has no prefix and there is a namespace binding for the element. uses fn:namespace-uri-from-qname to get namespace uri. Element is given as direct element . */ @org.junit.Test public void fnResolveQname9() { final XQuery query = new XQuery( "fn:string(fn:namespace-uri-from-QName(fn:resolve-QName(\"anElement\", Some content)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.com/examples") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnResolveUri.java000066400000000000000000000566331222453003200273470ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the resolve-uri function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnResolveUri extends QT3TestSet { /** * A test whose essence is: `resolve-uri()`. . */ @org.junit.Test public void kResolveURIFunc1() { final XQuery query = new XQuery( "resolve-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `resolve-uri("http://www.example.com/", "relative/uri.ext", "wrong param")`. . */ @org.junit.Test public void kResolveURIFunc2() { final XQuery query = new XQuery( "resolve-uri(\"http://www.example.com/\", \"relative/uri.ext\", \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `resolve-uri("relative/uri.ext", "http://www.example.com/") eq xs:anyURI("http://www.example.com/relative/uri.ext")`. . */ @org.junit.Test public void kResolveURIFunc3() { final XQuery query = new XQuery( "resolve-uri(\"relative/uri.ext\", \"http://www.example.com/\") eq xs:anyURI(\"http://www.example.com/relative/uri.ext\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `resolve-uri("", "http://www.example.com/") eq xs:anyURI("http://www.example.com/")`. . */ @org.junit.Test public void kResolveURIFunc4() { final XQuery query = new XQuery( "resolve-uri(\"\", \"http://www.example.com/\") eq xs:anyURI(\"http://www.example.com/\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(resolve-uri((), "http://www.example.com/"))`. . */ @org.junit.Test public void kResolveURIFunc5() { final XQuery query = new XQuery( "empty(resolve-uri((), \"http://www.example.com/\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `resolve-uri("http://www.example.com/absolute", "http://www.example.com/") eq xs:anyURI("http://www.example.com/absolute")`. . */ @org.junit.Test public void kResolveURIFunc6() { final XQuery query = new XQuery( "resolve-uri(\"http://www.example.com/absolute\", \"http://www.example.com/\") eq xs:anyURI(\"http://www.example.com/absolute\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Tests effective boolean value of resolve-uri . */ @org.junit.Test public void cbclFnResolveUri001() { final XQuery query = new XQuery( "\n" + " boolean(resolve-uri(string-join(for $x in 1 to 10 return \"blah\",\"z\"),\"http://localhost/\"))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of resolve-uri function with relative argument set to empty sequence Use fn:count to avoid empty file . */ @org.junit.Test public void fnResolveUri1() { final XQuery query = new XQuery( "fn:count(fn:resolve-uri((),\"BaseValue\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of resolve-uri function with relative argument set to an absolute URI and given as a an argument to fn:lower-case function (Two argument version of function). Use the fn-string function. . */ @org.junit.Test public void fnResolveUri10() { final XQuery query = new XQuery( "fn:string(fn:resolve-uri(fn:lower-case(\"EXAMPLES\"),fn:lower-case(\"HTTP://www.examples.com/\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.examples.com/examples") ); } /** * Evaluation of resolve-uri function with relative argument set to an absolute URI and given as a an argument to fn:substring function (Two argument version of function). Use the fn-string function. . */ @org.junit.Test public void fnResolveUri11() { final XQuery query = new XQuery( "fn:string(fn:resolve-uri(\"examples\",fn:substring(\"1234http://www.examples.com/\",5)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.examples.com/examples") ); } /** * Evaluation of resolve-uri function with relative argument set to an absolute URI and given as a an argument to fn:string-join function (Two argument version of function). Use the fn-string function. . */ @org.junit.Test public void fnResolveUri12() { final XQuery query = new XQuery( "fn:string(fn:resolve-uri(\"examples\",fn:string-join(('http://www.example','.com/'),'')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/examples") ); } /** * Evaluation of resolve-uri function with relative argument set to an absolute URI and given as a an argument to fn:concat function (Two argument version of function). Use the fn-string function. . */ @org.junit.Test public void fnResolveUri13() { final XQuery query = new XQuery( "fn:string(fn:resolve-uri(\"examples\",fn:concat(\"http://www.example\",\".com/\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/examples") ); } /** * Evaluation of resolve-uri function with relative argument set to an absolute URI and given as a an argument to fn:substring-before function (Two argument version of function). Use the fn:substring-before function. . */ @org.junit.Test public void fnResolveUri14() { final XQuery query = new XQuery( "fn:string(fn:resolve-uri(\"examples\",fn:substring-before(\"http://www.example.com/123\",\"123\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/examples") ); } /** * Evaluation of resolve-uri function with relative argument set to an absolute URI and given as a an argument to fn:substring-after function (Two argument version of function). Use the fn:substring-after function. . */ @org.junit.Test public void fnResolveUri15() { final XQuery query = new XQuery( "fn:string(fn:resolve-uri(\"examples\",fn:substring-after(\"123http://www.example.com/\",\"123\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/examples") ); } /** * Evaluation of resolve-uri function with relative argument set to an absolute URI and given as an argument to fn:string function (two argument version of function). Use the fn-string function. . */ @org.junit.Test public void fnResolveUri16() { final XQuery query = new XQuery( "fn:string(fn:resolve-uri(fn:string(\"http://www.examples.com/\"),\"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.examples.com/") ); } /** * Evaluation of resolve-uri function with relative argument set to an absolute URI and given as an argument to fn:upper-case function (two argument version of function). Use the fn-string function. . */ @org.junit.Test public void fnResolveUri17() { final XQuery query = new XQuery( "fn:string(fn:resolve-uri(fn:upper-case(\"http://www.examples.com\"),\"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "HTTP://WWW.EXAMPLES.COM") ); } /** * Evaluation of resolve-uri function with relative argument set to an absolute URI and given as an argument to fn:lower-case function (two argument version of function). Use the fn-string function. . */ @org.junit.Test public void fnResolveUri18() { final XQuery query = new XQuery( "fn:string(fn:resolve-uri(fn:lower-case(\"http://www.examples.com\"),\"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.examples.com") ); } /** * Evaluation of resolve-uri function with relative argument set to an absolute URI and given as an argument to fn:substring function (two argument version of function). Use the fn-string function. . */ @org.junit.Test public void fnResolveUri19() { final XQuery query = new XQuery( "fn:string(fn:resolve-uri(fn:substring(\"123http://www.examples.com\",4),\"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.examples.com") ); } /** * Evaluation of resolve-uri function with relative argument set to zero length string. Use the base-uri property that is set. Use the fn-string function . */ @org.junit.Test public void fnResolveUri2() { final XQuery query = new XQuery( "declare base-uri \"http://www.example/\"; fn:string(fn:resolve-uri(\"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example/") ); } /** * Evaluation of resolve-uri function with relative argument set to an absolute URI and given as an argument to fn:string-join function (two argument version of function). Use the fn-string function. . */ @org.junit.Test public void fnResolveUri20() { final XQuery query = new XQuery( "fn:string(fn:resolve-uri(fn:string-join((\"http://www.examples\",\".com\"),''),\"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.examples.com") ); } /** * Evaluation of resolve-uri function with relative argument set to an absolute URI and given as an argument to fn:concat function (two argument version of function). Use the fn-string function. . */ @org.junit.Test public void fnResolveUri21() { final XQuery query = new XQuery( "fn:string(fn:resolve-uri(fn:concat(\"http://www.examples\",\".com\"),\"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.examples.com") ); } /** * Evaluation of resolve-uri function with relative argument set to an absolute URI and given as an argument to fn:substring-before function (two argument version of function). Use the fn-string function. . */ @org.junit.Test public void fnResolveUri22() { final XQuery query = new XQuery( "fn:string(fn:resolve-uri(fn:substring-before(\"http://www.example.com123\",\"123\"),\"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com") ); } /** * Evaluation of resolve-uri function with relative argument set to an absolute URI and given as an argument to fn:substring-after function (two argument version of function). Use the fn-string function. . */ @org.junit.Test public void fnResolveUri23() { final XQuery query = new XQuery( "fn:string(fn:resolve-uri(fn:substring-after(\"123http://www.example.com\",\"123\"),\"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com") ); } /** * Evaluation of resolve-uri function with a relative URI reference for second argument. Expects error FORG0002: see erratum FO.E1 . */ @org.junit.Test public void fnResolveUri24() { final XQuery query = new XQuery( "fn:string(fn:resolve-uri(\"a.html\",\"b.html\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0002") ); } /** * Evaluation of resolve-uri function with an absolute URI for the first argument and a relative URI reference for second argument. Should return first argument unchanged . */ @org.junit.Test public void fnResolveUri25() { final XQuery query = new XQuery( "string(resolve-uri(\"http://www.example.com/a.html\",\"b.html\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/a.html") ); } /** * Evaluation of resolve-uri function with a fragment as part of the base URI . */ @org.junit.Test public void fnResolveUri26() { final XQuery query = new XQuery( "resolve-uri(\"b.html\", \"http://www.example.com/a.html#fragment\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0002") ); } /** * Evaluation of resolve-uri function with a query as part of the base URI . */ @org.junit.Test public void fnResolveUri27() { final XQuery query = new XQuery( "string(resolve-uri(\"b.html\", \"http://www.example.com/a.html?foo=bar\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/b.html") ); } /** * Evaluation of resolve-uri function with a non-hierarchic base URI . */ @org.junit.Test public void fnResolveUri28() { final XQuery query = new XQuery( "resolve-uri(\"b.html\", \"urn:isbn:01234567890X\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0002") ); } /** * Evaluation of resolve-uri function with a non-hierarchic relative URI . */ @org.junit.Test public void fnResolveUri29() { final XQuery query = new XQuery( "string(resolve-uri(\"urn:isbn:01234567890X\", \"http://www.example.com/\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "urn:isbn:01234567890X") ); } /** * Evaluation of resolve-uri function with an invalid URI value for first argument. . */ @org.junit.Test public void fnResolveUri3() { final XQuery query = new XQuery( "fn:resolve-uri(\":\",\"http://www.example.com/\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0002") ); } /** * Both the absolute URI and relative URI reference are valid IRIs but not valid URIs . */ @org.junit.Test public void fnResolveUri30() { final XQuery query = new XQuery( "\n" + " resolve-uri(codepoints-to-string(231)||\".html\", \"http://www.example.com/\"||codepoints-to-string(224)||\".html\")\n" + " = (\"http://www.example.com/\"||codepoints-to-string(231)||\".html\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Both the absolute URI and relative URI reference contain %-encoded characters . */ @org.junit.Test public void fnResolveUri31() { final XQuery query = new XQuery( "\n" + " resolve-uri(\"%C3%A0.html\", \"http://www.example.com/%C3%A7.html\")\n" + " = \"http://www.example.com/%C3%A0.html\"\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Both the absolute URI and relative URI reference contain spaces. This makes them * valid LEIRIs but not valid IRIs. It is therefore implementation-defined whether they * are accepted. The LEIRI spec says that the spaces SHOULD NOT be percent-encoded, * but it doesn't say MUST NOT so we accept that an implementation that does so is conformant. * . */ @org.junit.Test public void fnResolveUri32() { final XQuery query = new XQuery( "resolve-uri(\"this doc.html\", \"http://www.example.com/that doc.html\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "http://www.example.com/this doc.html") || assertStringValue(false, "http://www.example.com/this%20doc.html") || error("FORG0002") ) ); } /** * Evaluation of resolve-uri function with an invalid URI value for second argument. . */ @org.junit.Test public void fnResolveUri4() { final XQuery query = new XQuery( "fn:resolve-uri(\"examples\",\"http:%%\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0002") ); } /** * Evaluation of resolve-uri function with relative argument set to an absolute URI. Use the fn-string function . */ @org.junit.Test public void fnResolveUri5() { final XQuery query = new XQuery( "fn:string(fn:resolve-uri(\"http://www.examples.com\",\"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.examples.com") ); } /** * Evaluation of resolve-uri function with base argument set to an absolute URI (Two argument version of function). Use the fn-string function. . */ @org.junit.Test public void fnResolveUri6() { final XQuery query = new XQuery( "fn:string(fn:resolve-uri(\"examples\",\"http://www.examples.com/\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.examples.com/examples") ); } /** * * Evaluation of resolve-uri function with base argument set to an absolute URI and given as * a an argument to xs:string function (Two argument version of function). Use the fn-string function. * . */ @org.junit.Test public void fnResolveUri7() { final XQuery query = new XQuery( "fn:string(fn:resolve-uri(\"examples\",xs:string(\"http://www.examples.com/\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.examples.com/examples") ); } /** * Evaluation of resolve-uri function with relative argument set to an absolute URI and given as a an argument to fn:string function (Two argument version of function). Use the fn-string function. . */ @org.junit.Test public void fnResolveUri8() { final XQuery query = new XQuery( "fn:string(fn:resolve-uri(fn:string(\"examples\"),fn:string(\"http://www.examples.com/\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.examples.com/examples") ); } /** * Evaluation of resolve-uri function with relative argument set to an absolute URI and given as a an argument to fn:upper-case function (Two argument version of function). Use the fn-string function. . */ @org.junit.Test public void fnResolveUri9() { final XQuery query = new XQuery( "fn:string(fn:resolve-uri(fn:upper-case(\"examples\"),fn:upper-case(\"http://www.examples.com/\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "HTTP://WWW.EXAMPLES.COM/EXAMPLES") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnReverse.java000066400000000000000000001026511222453003200266530ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the reverse() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnReverse extends QT3TestSet { /** * A test whose essence is: `reverse()`. . */ @org.junit.Test public void kSeqReverseFunc1() { final XQuery query = new XQuery( "reverse()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `count(reverse((1, 2, 3)))`. . */ @org.junit.Test public void kSeqReverseFunc10() { final XQuery query = new XQuery( "count(reverse((1, 2, 3)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * A test whose essence is: `count(reverse((1, 2, 3)))`. . */ @org.junit.Test public void kSeqReverseFunc11() { final XQuery query = new XQuery( "count(reverse((1, 2, 3)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * A test whose essence is: `deep-equal((3, 2, 1), reverse(1 to 3))`. . */ @org.junit.Test public void kSeqReverseFunc12() { final XQuery query = new XQuery( "deep-equal((3, 2, 1), reverse(1 to 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal((3, 2, 1), reverse((1, 2, 3)))`. . */ @org.junit.Test public void kSeqReverseFunc13() { final XQuery query = new XQuery( "deep-equal((3, 2, 1), reverse((1, 2, 3)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal((11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1), reverse(((), (), 1, 2, (3, 4), (5), (6, (7, 8), 9), 10, (), 11, ())))`. . */ @org.junit.Test public void kSeqReverseFunc14() { final XQuery query = new XQuery( "deep-equal((11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1), reverse(((), (), 1, 2, (3, 4), (5), (6, (7, 8), 9), 10, (), 11, ())))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `reverse(error())`. . */ @org.junit.Test public void kSeqReverseFunc15() { final XQuery query = new XQuery( "reverse(error())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * Apply a predicate to the result of fn:reverse(). . */ @org.junit.Test public void kSeqReverseFunc16() { final XQuery query = new XQuery( "reverse((1, 2, 3))[last()] eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Apply a predicate to the result of fn:reverse(). . */ @org.junit.Test public void kSeqReverseFunc17() { final XQuery query = new XQuery( "reverse((1, 2, 3))[last() - 2]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Apply a predicate to the result of fn:reverse(). . */ @org.junit.Test public void kSeqReverseFunc18() { final XQuery query = new XQuery( "reverse((1, 2, 3))[last() - 1]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Apply a predicate to the result of fn:reverse(). . */ @org.junit.Test public void kSeqReverseFunc19() { final XQuery query = new XQuery( "deep-equal((3, 2, 1), reverse((1, 2, 3))[true()])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `reverse(1, 2)`. . */ @org.junit.Test public void kSeqReverseFunc2() { final XQuery query = new XQuery( "reverse(1, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Apply a predicate to the result of fn:reverse(). . */ @org.junit.Test public void kSeqReverseFunc20() { final XQuery query = new XQuery( "reverse((1, 2, current-time(), 3))[last() - 1]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Apply a predicate to the result of fn:reverse(). . */ @org.junit.Test public void kSeqReverseFunc21() { final XQuery query = new XQuery( "reverse((1, 2, current-time(), 3))[last() - 0]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * A test whose essence is: `empty(reverse(()))`. . */ @org.junit.Test public void kSeqReverseFunc3() { final XQuery query = new XQuery( "empty(reverse(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * A test whose essence is: `not(empty(reverse((1))))`. . */ @org.junit.Test public void kSeqReverseFunc4() { final XQuery query = new XQuery( "not(empty(reverse((1))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(reverse(()))`. . */ @org.junit.Test public void kSeqReverseFunc5() { final XQuery query = new XQuery( "not(reverse(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * A test whose essence is: `not(exists(reverse(())))`. . */ @org.junit.Test public void kSeqReverseFunc6() { final XQuery query = new XQuery( "not(exists(reverse(())))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * A test whose essence is: `exists(reverse((1)))`. . */ @org.junit.Test public void kSeqReverseFunc7() { final XQuery query = new XQuery( "exists(reverse((1)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `reverse((1, current-time())[1])`. . */ @org.junit.Test public void kSeqReverseFunc8() { final XQuery query = new XQuery( "reverse((1, current-time())[1])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * A test whose essence is: `exists(reverse((1, 2, 3)))`. . */ @org.junit.Test public void kSeqReverseFunc9() { final XQuery query = new XQuery( "exists(reverse((1, 2, 3)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Apply fn:reverse() on a node sequence. . */ @org.junit.Test public void k2SeqReverseFunc1() { final XQuery query = new XQuery( "reverse(( , ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Apply a confusing amount of ordered/unordered{} expressions. . */ @org.junit.Test public void k2SeqReverseFunc2() { final XQuery query = new XQuery( "declare variable $myVar := unordered{ordered{unordered{fn:reverse((, ))}}}; deep-equal($myVar, (, )) or deep-equal($myVar, (, ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Apply fn:unordered() to fn:reverse(). . */ @org.junit.Test public void k2SeqReverseFunc3() { final XQuery query = new XQuery( "declare variable $myVar := unordered(fn:reverse((, ))); deep-equal($myVar, (, )) or deep-equal($myVar, (, ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:reverse() takes only one argument. . */ @org.junit.Test public void k2SeqReverseFunc4() { final XQuery query = new XQuery( "fn:reverse(1, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * fn:reverse() takes one argument. . */ @org.junit.Test public void k2SeqReverseFunc5() { final XQuery query = new XQuery( "fn:reverse()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Combine unordered declaration with fn:reverse(). . */ @org.junit.Test public void k2SeqReverseFunc6() { final XQuery query = new XQuery( "declare ordering unordered; reverse((1, 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("2, 1") ); } /** * Test condition "If $arg is the empty sequence, the empty sequence is returned." . */ @org.junit.Test public void cbclReverse1() { final XQuery query = new XQuery( "empty(reverse( () ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:double(lower bound) . */ @org.junit.Test public void fnReversedbl1args1() { final XQuery query = new XQuery( "fn:reverse((xs:double(\"-1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.7976931348623157E308") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:double(mid range) . */ @org.junit.Test public void fnReversedbl1args2() { final XQuery query = new XQuery( "fn:reverse((xs:double(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:double(upper bound) . */ @org.junit.Test public void fnReversedbl1args3() { final XQuery query = new XQuery( "fn:reverse((xs:double(\"1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.7976931348623157E308") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:decimal(lower bound) . */ @org.junit.Test public void fnReversedec1args1() { final XQuery query = new XQuery( "fn:reverse((xs:decimal(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:decimal(mid range) . */ @org.junit.Test public void fnReversedec1args2() { final XQuery query = new XQuery( "fn:reverse((xs:decimal(\"617375191608514839\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("617375191608514839") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:decimal(upper bound) . */ @org.junit.Test public void fnReversedec1args3() { final XQuery query = new XQuery( "fn:reverse((xs:decimal(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:float(lower bound) . */ @org.junit.Test public void fnReverseflt1args1() { final XQuery query = new XQuery( "fn:reverse((xs:float(\"-3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(\"-3.4028235E38\")") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:float(mid range) . */ @org.junit.Test public void fnReverseflt1args2() { final XQuery query = new XQuery( "fn:reverse((xs:float(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:float(upper bound) . */ @org.junit.Test public void fnReverseflt1args3() { final XQuery query = new XQuery( "fn:reverse((xs:float(\"3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(\"3.4028235E38\")") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:int(lower bound) . */ @org.junit.Test public void fnReverseint1args1() { final XQuery query = new XQuery( "fn:reverse((xs:int(\"-2147483648\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2147483648") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:int(mid range) . */ @org.junit.Test public void fnReverseint1args2() { final XQuery query = new XQuery( "fn:reverse((xs:int(\"-1873914410\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1873914410") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:int(upper bound) . */ @org.junit.Test public void fnReverseint1args3() { final XQuery query = new XQuery( "fn:reverse((xs:int(\"2147483647\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2147483647") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:integer(lower bound) . */ @org.junit.Test public void fnReverseintg1args1() { final XQuery query = new XQuery( "fn:reverse((xs:integer(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:integer(mid range) . */ @org.junit.Test public void fnReverseintg1args2() { final XQuery query = new XQuery( "fn:reverse((xs:integer(\"830993497117024304\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("830993497117024304") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:integer(upper bound) . */ @org.junit.Test public void fnReverseintg1args3() { final XQuery query = new XQuery( "fn:reverse((xs:integer(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:long(lower bound) . */ @org.junit.Test public void fnReverselng1args1() { final XQuery query = new XQuery( "fn:reverse((xs:long(\"-92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:long(mid range) . */ @org.junit.Test public void fnReverselng1args2() { final XQuery query = new XQuery( "fn:reverse((xs:long(\"-47175562203048468\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-47175562203048468") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:long(upper bound) . */ @org.junit.Test public void fnReverselng1args3() { final XQuery query = new XQuery( "fn:reverse((xs:long(\"92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("92233720368547758") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnReversenint1args1() { final XQuery query = new XQuery( "fn:reverse((xs:negativeInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnReversenint1args2() { final XQuery query = new XQuery( "fn:reverse((xs:negativeInteger(\"-297014075999096793\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-297014075999096793") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnReversenint1args3() { final XQuery query = new XQuery( "fn:reverse((xs:negativeInteger(\"-1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnReversenni1args1() { final XQuery query = new XQuery( "fn:reverse((xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnReversenni1args2() { final XQuery query = new XQuery( "fn:reverse((xs:nonNegativeInteger(\"303884545991464527\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("303884545991464527") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnReversenni1args3() { final XQuery query = new XQuery( "fn:reverse((xs:nonNegativeInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnReversenpi1args1() { final XQuery query = new XQuery( "fn:reverse((xs:nonPositiveInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnReversenpi1args2() { final XQuery query = new XQuery( "fn:reverse((xs:nonPositiveInteger(\"-475688437271870490\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-475688437271870490") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnReversenpi1args3() { final XQuery query = new XQuery( "fn:reverse((xs:nonPositiveInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnReversepint1args1() { final XQuery query = new XQuery( "fn:reverse((xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnReversepint1args2() { final XQuery query = new XQuery( "fn:reverse((xs:positiveInteger(\"52704602390610033\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("52704602390610033") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnReversepint1args3() { final XQuery query = new XQuery( "fn:reverse((xs:positiveInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:short(lower bound) . */ @org.junit.Test public void fnReversesht1args1() { final XQuery query = new XQuery( "fn:reverse((xs:short(\"-32768\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-32768") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:short(mid range) . */ @org.junit.Test public void fnReversesht1args2() { final XQuery query = new XQuery( "fn:reverse((xs:short(\"-5324\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-5324") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:short(upper bound) . */ @org.junit.Test public void fnReversesht1args3() { final XQuery query = new XQuery( "fn:reverse((xs:short(\"32767\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("32767") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnReverseulng1args1() { final XQuery query = new XQuery( "fn:reverse((xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnReverseulng1args2() { final XQuery query = new XQuery( "fn:reverse((xs:unsignedLong(\"130747108607674654\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("130747108607674654") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnReverseulng1args3() { final XQuery query = new XQuery( "fn:reverse((xs:unsignedLong(\"184467440737095516\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("184467440737095516") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnReverseusht1args1() { final XQuery query = new XQuery( "fn:reverse((xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnReverseusht1args2() { final XQuery query = new XQuery( "fn:reverse((xs:unsignedShort(\"44633\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("44633") ); } /** * Evaluates The "reverse" function with the arguments set as follows: $arg = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnReverseusht1args3() { final XQuery query = new XQuery( "fn:reverse((xs:unsignedShort(\"65535\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("65535") ); } /** * Reverse a sequence of several items (for a change...). */ @org.junit.Test public void reverse001() { final XQuery query = new XQuery( "fn:reverse(1 to 10)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("10, 9, 8, 7, 6, 5, 4, 3, 2, 1") ); } /** * Reverse an empty sequence. */ @org.junit.Test public void reverse002() { final XQuery query = new XQuery( "fn:reverse(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Reverse sequence of nodes on the ancestor axis. */ @org.junit.Test public void reverse003() { final XQuery query = new XQuery( "string-join(reverse(((//*:Open)[1])/ancestor-or-self::*/local-name()), '~')", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"Open~Schedule~Auction~AuctionWatchList\"") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnRoot.java000066400000000000000000000443461222453003200261710ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the root() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnRoot extends QT3TestSet { /** * A test whose essence is: `Root(2)`. . */ @org.junit.Test public void kNodeRootFunc1() { final XQuery query = new XQuery( "Root(2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `(1, 2, 3)[root()]`. . */ @org.junit.Test public void kNodeRootFunc2() { final XQuery query = new XQuery( "(1, 2, 3)[root()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A test whose essence is: `root(2)`. . */ @org.junit.Test public void kNodeRootFunc3() { final XQuery query = new XQuery( "root(2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A test whose essence is: `empty(root(()))`. . */ @org.junit.Test public void kNodeRootFunc4() { final XQuery query = new XQuery( "empty(root(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Apply fn:root() to a directly constructed element. . */ @org.junit.Test public void k2NodeRootFunc1() { final XQuery query = new XQuery( "fn:root()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Apply fn:root() to an empty sequence coming from a parent axis. . */ @org.junit.Test public void k2NodeRootFunc2() { final XQuery query = new XQuery( "empty(fn:root(/..))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke on a comment node. . */ @org.junit.Test public void k2NodeRootFunc3() { final XQuery query = new XQuery( "fn:root()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Invoke on an attribute node. . */ @org.junit.Test public void k2NodeRootFunc4() { final XQuery query = new XQuery( "{fn:root(attribute name {\"value\"})}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Invoke on a processing instruction node. . */ @org.junit.Test public void k2NodeRootFunc5() { final XQuery query = new XQuery( "fn:root()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Invoke on a processing instruction node. . */ @org.junit.Test public void k2NodeRootFunc6() { final XQuery query = new XQuery( "fn:root(text{\"text node\"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "text node") ); } /** * Invoke on a processing instruction node. . */ @org.junit.Test public void k2NodeRootFunc7() { final XQuery query = new XQuery( "fn:root(text{\"text node\"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "text node") ); } /** * Invoke on a single document node. . */ @org.junit.Test public void k2NodeRootFunc8() { final XQuery query = new XQuery( "root(document {()}) instance of document-node()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the fn:root function with no arguments and no context node set. . */ @org.junit.Test public void fnRoot1() { final XQuery query = new XQuery( "fn:root()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Evaluation of the fn:root function with argument set to an computed element with attribute node by setting via a variable. . */ @org.junit.Test public void fnRoot10() { final XQuery query = new XQuery( "let $var := element anElement {attribute anAttribute {\"Attribute Value\"}} return fn:root($var)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Evaluation of the fn:root function with argument set to an computed element with attribute node by setting directly on argument. . */ @org.junit.Test public void fnRoot11() { final XQuery query = new XQuery( "fn:root(element anElement {attribute anAttribute {\"Attribute Value\"}})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Evaluation of the fn:root function with argument set to a document node by setting via a variable. . */ @org.junit.Test public void fnRoot12() { final XQuery query = new XQuery( "let $var := document {element content} return fn:root($var)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("element content", false) ); } /** * Evaluation of the fn:root function with argument set to an computed document node by setting directly on argument. . */ @org.junit.Test public void fnRoot13() { final XQuery query = new XQuery( "fn:root(document {element content})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("element content", false) ); } /** * Evaluation of the fn:root function with argument set to a element node by quering an xml file. . */ @org.junit.Test public void fnRoot14() { final XQuery query = new XQuery( "fn:root(fn:exactly-one(/langs[1]/para[1]))", ctx); try { query.context(node(file("fn/lang/lang.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n \n
    And now, and forever!
    \n \n \n
    ", false) ); } /** * Evaluation of the fn:root function with argument set to a attribute node by quering an xml file. . */ @org.junit.Test public void fnRoot15() { final XQuery query = new XQuery( "fn:root(/langs[1]/para[1]/@xml:lang)", ctx); try { query.context(node(file("fn/lang/lang.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n \n
    And now, and forever!
    \n \n \n
    ", false) ); } /** * Evaluation of the fn:root function with argument set to computed text node by setting directly on argument. . */ @org.junit.Test public void fnRoot16() { final XQuery query = new XQuery( "fn:root(text {\"A text Node\"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "A text Node") ); } /** * Evaluation of the fn:root function with argument set to computed text node by setting argument vias a variable. . */ @org.junit.Test public void fnRoot17() { final XQuery query = new XQuery( "let $var := text {\"a text Node\"} return fn:root($var)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a text Node") ); } /** * Evaluation of the fn:root function used in conjunction with "is" operator (returns true). . */ @org.junit.Test public void fnRoot18() { final XQuery query = new XQuery( "let $var := element anElement {\"Element Content\"} return fn:root($var) is fn:root($var)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the fn:root function used in conjunction with "is" operator (returns false). . */ @org.junit.Test public void fnRoot19() { final XQuery query = new XQuery( "let $var := element anElement {\"Element Content\"} return fn:root($var) is fn:root($var)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the fn:root function with no arguments that uses context node, which is not a node. . */ @org.junit.Test public void fnRoot2() { final XQuery query = new XQuery( "(1 to 100)[fn:root()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluation of the fn:root function used as argument to namespace-uri function (use an element). * Use fn:count to avoid empty file . */ @org.junit.Test public void fnRoot20() { final XQuery query = new XQuery( "let $var := element anElement {\"Element Content\"} return fn:count(fn:namespace-uri(fn:root($var)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluation of the fn:root function used as argument to namespace-uri function (use a comment). * Use fn:count to avoid empty file . */ @org.junit.Test public void fnRoot21() { final XQuery query = new XQuery( "let $var := return fn:count(fn:namespace-uri(fn:root($var)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluation of the fn:root function used as argument to namespace-uri function (use a Processing Instruction). * Use fn:count to avoid empty file . */ @org.junit.Test public void fnRoot22() { final XQuery query = new XQuery( "let $var := return fn:count(fn:namespace-uri(fn:root($var)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluation of the fn:root function used as argument to namespace-uri function (use a text node). use fn:count to avoid empty file . */ @org.junit.Test public void fnRoot23() { final XQuery query = new XQuery( "let $var := text {\"A text node\"} return fn:count(fn:namespace-uri(fn:root($var)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluation of the fn:root function with argument set to "." and no context node set. . */ @org.junit.Test public void fnRoot24() { final XQuery query = new XQuery( "fn:root(.)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Evaluation of the fn:root function with argument set to the empty sequence. Use count to avoid empty file. . */ @org.junit.Test public void fnRoot3() { final XQuery query = new XQuery( "fn:count(fn:root(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Evaluation of the fn:root function with argument set to a comment node (via a variable). . */ @org.junit.Test public void fnRoot4() { final XQuery query = new XQuery( "let $var := return fn:root($var)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Evaluation of the fn:root function with argument set to a comment node set directly on argument. . */ @org.junit.Test public void fnRoot5() { final XQuery query = new XQuery( "fn:root()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Evaluation of the fn:root function with argument set to an elemnt node set via a variable. . */ @org.junit.Test public void fnRoot6() { final XQuery query = new XQuery( "let $var := An Element Content return fn:root($var)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("An Element Content", false) ); } /** * Evaluation of the fn:root function with argument set to an direct element node by setting directly on argument. . */ @org.junit.Test public void fnRoot7() { final XQuery query = new XQuery( "fn:root(An Element Content)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("An Element Content", false) ); } /** * Evaluation of the fn:root function with argument set to an processing instruction node by setting via a variable. . */ @org.junit.Test public void fnRoot8() { final XQuery query = new XQuery( "let $var := return fn:root($var)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Evaluation of the fn:root function with argument set to an direct element node by setting directly on argument. . */ @org.junit.Test public void fnRoot9() { final XQuery query = new XQuery( "fn:root()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnRound.java000066400000000000000000003312601222453003200263270ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the round() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnRound extends QT3TestSet { /** * A test whose essence is: `round()`. . */ @org.junit.Test public void kRoundFunc1() { final XQuery query = new XQuery( "round()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `round(1, 2)`. . */ @org.junit.Test public void kRoundFunc2() { xquery10(); final XQuery query = new XQuery( "round(1, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `round(1, 2)`. . */ @org.junit.Test public void kRoundFunc2a() { final XQuery query = new XQuery( "round(1, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * A test whose essence is: `empty(round(()))`. . */ @org.junit.Test public void kRoundFunc3() { final XQuery query = new XQuery( "empty(round(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `round(1) eq 1`. . */ @org.junit.Test public void kRoundFunc4() { final XQuery query = new XQuery( "round(1) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `round(1.1) eq 1`. . */ @org.junit.Test public void kRoundFunc5() { final XQuery query = new XQuery( "round(1.1) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `round(xs:double(1)) eq 1`. . */ @org.junit.Test public void kRoundFunc6() { final XQuery query = new XQuery( "round(xs:double(1)) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `round(xs:float(1)) eq 1`. . */ @org.junit.Test public void kRoundFunc7() { final XQuery query = new XQuery( "round(xs:float(1)) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `round(2.4999) eq 2`. . */ @org.junit.Test public void kRoundFunc8() { final XQuery query = new XQuery( "round(2.4999) eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `round(-2.5) eq -2`. . */ @org.junit.Test public void kRoundFunc9() { final XQuery query = new XQuery( "round(-2.5) eq -2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is properly inferred for unsignedShort. . */ @org.junit.Test public void k2RoundFunc1() { final XQuery query = new XQuery( "round(xs:unsignedShort(.)) instance of xs:unsignedShort", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Ensure the return type is properly inferred for int. . */ @org.junit.Test public void k2RoundFunc10() { final XQuery query = new XQuery( "round(xs:int(.)) instance of xs:int", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Invoke on 0.54, type xs:double. . */ @org.junit.Test public void k2RoundFunc100() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.54\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on -0.54, type xs:float. . */ @org.junit.Test public void k2RoundFunc101() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.54\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on -0.54, type xs:double. . */ @org.junit.Test public void k2RoundFunc102() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.54\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on 0.55, type xs:float. . */ @org.junit.Test public void k2RoundFunc103() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.55\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on 0.55, type xs:double. . */ @org.junit.Test public void k2RoundFunc104() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.55\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on -0.55, type xs:float. . */ @org.junit.Test public void k2RoundFunc105() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.55\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on -0.55, type xs:double. . */ @org.junit.Test public void k2RoundFunc106() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.55\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on 0.56, type xs:float. . */ @org.junit.Test public void k2RoundFunc107() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.56\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on 0.56, type xs:double. . */ @org.junit.Test public void k2RoundFunc108() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.56\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on -0.56, type xs:float. . */ @org.junit.Test public void k2RoundFunc109() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.56\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Ensure the return type is properly inferred for short. . */ @org.junit.Test public void k2RoundFunc11() { final XQuery query = new XQuery( "round(xs:short(.)) instance of xs:short", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Invoke on -0.56, type xs:double. . */ @org.junit.Test public void k2RoundFunc110() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.56\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on 0.59, type xs:float. . */ @org.junit.Test public void k2RoundFunc111() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.59\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on 0.59, type xs:double. . */ @org.junit.Test public void k2RoundFunc112() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.59\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on -0.59, type xs:float. . */ @org.junit.Test public void k2RoundFunc113() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.59\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on -0.59, type xs:double. . */ @org.junit.Test public void k2RoundFunc114() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.59\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on 0.50, type xs:float. . */ @org.junit.Test public void k2RoundFunc115() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.50\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on 0.50, type xs:double. . */ @org.junit.Test public void k2RoundFunc116() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.50\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on -0.50, type xs:float. . */ @org.junit.Test public void k2RoundFunc117() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.50\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on -0.50, type xs:double. . */ @org.junit.Test public void k2RoundFunc118() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.50\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on 0.61, type xs:float. . */ @org.junit.Test public void k2RoundFunc119() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.61\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Ensure the return type is properly inferred for byte. . */ @org.junit.Test public void k2RoundFunc12() { final XQuery query = new XQuery( "round(xs:byte(.)) instance of xs:byte", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Invoke on 0.61, type xs:double. . */ @org.junit.Test public void k2RoundFunc120() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.61\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on -0.61, type xs:float. . */ @org.junit.Test public void k2RoundFunc121() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.61\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on -0.61, type xs:double. . */ @org.junit.Test public void k2RoundFunc122() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.61\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on 0.64, type xs:float. . */ @org.junit.Test public void k2RoundFunc123() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.64\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on 0.64, type xs:double. . */ @org.junit.Test public void k2RoundFunc124() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.64\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on -0.64, type xs:float. . */ @org.junit.Test public void k2RoundFunc125() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.64\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on -0.64, type xs:double. . */ @org.junit.Test public void k2RoundFunc126() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.64\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on 0.65, type xs:float. . */ @org.junit.Test public void k2RoundFunc127() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.65\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on 0.65, type xs:double. . */ @org.junit.Test public void k2RoundFunc128() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.65\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on -0.65, type xs:float. . */ @org.junit.Test public void k2RoundFunc129() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.65\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on xs:double INF. . */ @org.junit.Test public void k2RoundFunc13() { final XQuery query = new XQuery( "round(xs:double(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** * Invoke on -0.65, type xs:double. . */ @org.junit.Test public void k2RoundFunc130() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.65\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on 0.66, type xs:float. . */ @org.junit.Test public void k2RoundFunc131() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.66\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on 0.66, type xs:double. . */ @org.junit.Test public void k2RoundFunc132() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.66\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on -0.66, type xs:float. . */ @org.junit.Test public void k2RoundFunc133() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.66\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on -0.66, type xs:double. . */ @org.junit.Test public void k2RoundFunc134() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.66\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on 0.69, type xs:float. . */ @org.junit.Test public void k2RoundFunc135() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.69\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on 0.69, type xs:double. . */ @org.junit.Test public void k2RoundFunc136() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.69\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on -0.69, type xs:float. . */ @org.junit.Test public void k2RoundFunc137() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.69\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on -0.69, type xs:double. . */ @org.junit.Test public void k2RoundFunc138() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.69\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on 0.60, type xs:float. . */ @org.junit.Test public void k2RoundFunc139() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.60\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on xs:double -INF. . */ @org.junit.Test public void k2RoundFunc14() { final XQuery query = new XQuery( "round(xs:double(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-INF") ); } /** * Invoke on 0.60, type xs:double. . */ @org.junit.Test public void k2RoundFunc140() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.60\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on -0.60, type xs:float. . */ @org.junit.Test public void k2RoundFunc141() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.60\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on -0.60, type xs:double. . */ @org.junit.Test public void k2RoundFunc142() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.60\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on 0.91, type xs:float. . */ @org.junit.Test public void k2RoundFunc143() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.91\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on 0.91, type xs:double. . */ @org.junit.Test public void k2RoundFunc144() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.91\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on -0.91, type xs:float. . */ @org.junit.Test public void k2RoundFunc145() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.91\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on -0.91, type xs:double. . */ @org.junit.Test public void k2RoundFunc146() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.91\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on 0.94, type xs:float. . */ @org.junit.Test public void k2RoundFunc147() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.94\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on 0.94, type xs:double. . */ @org.junit.Test public void k2RoundFunc148() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.94\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on -0.94, type xs:float. . */ @org.junit.Test public void k2RoundFunc149() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.94\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on xs:double 0. . */ @org.junit.Test public void k2RoundFunc15() { final XQuery query = new XQuery( "round(xs:double(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on -0.94, type xs:double. . */ @org.junit.Test public void k2RoundFunc150() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.94\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on 0.95, type xs:float. . */ @org.junit.Test public void k2RoundFunc151() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.95\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on 0.95, type xs:double. . */ @org.junit.Test public void k2RoundFunc152() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.95\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on -0.95, type xs:float. . */ @org.junit.Test public void k2RoundFunc153() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.95\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on -0.95, type xs:double. . */ @org.junit.Test public void k2RoundFunc154() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.95\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on 0.96, type xs:float. . */ @org.junit.Test public void k2RoundFunc155() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.96\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on 0.96, type xs:double. . */ @org.junit.Test public void k2RoundFunc156() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.96\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on -0.96, type xs:float. . */ @org.junit.Test public void k2RoundFunc157() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.96\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on -0.96, type xs:double. . */ @org.junit.Test public void k2RoundFunc158() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.96\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on 0.99, type xs:float. . */ @org.junit.Test public void k2RoundFunc159() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.99\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on xs:double -0. . */ @org.junit.Test public void k2RoundFunc16() { final XQuery query = new XQuery( "round(xs:double(\"-0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on 0.99, type xs:double. . */ @org.junit.Test public void k2RoundFunc160() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.99\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on -0.99, type xs:float. . */ @org.junit.Test public void k2RoundFunc161() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.99\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on -0.99, type xs:double. . */ @org.junit.Test public void k2RoundFunc162() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.99\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on 0.90, type xs:float. . */ @org.junit.Test public void k2RoundFunc163() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.90\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on 0.90, type xs:double. . */ @org.junit.Test public void k2RoundFunc164() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.90\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Invoke on -0.90, type xs:float. . */ @org.junit.Test public void k2RoundFunc165() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.90\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on -0.90, type xs:double. . */ @org.junit.Test public void k2RoundFunc166() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.90\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on 0.101, type xs:float. . */ @org.junit.Test public void k2RoundFunc167() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.101\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Invoke on 0.101, type xs:double. . */ @org.junit.Test public void k2RoundFunc168() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.101\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on -0.101, type xs:float. . */ @org.junit.Test public void k2RoundFunc169() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.101\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on xs:float INF. . */ @org.junit.Test public void k2RoundFunc17() { final XQuery query = new XQuery( "round(xs:float(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** * Invoke on -0.101, type xs:double. . */ @org.junit.Test public void k2RoundFunc170() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.101\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on 0.104, type xs:float. . */ @org.junit.Test public void k2RoundFunc171() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.104\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on 0.104, type xs:double. . */ @org.junit.Test public void k2RoundFunc172() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.104\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on -0.104, type xs:float. . */ @org.junit.Test public void k2RoundFunc173() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.104\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on -0.104, type xs:double. . */ @org.junit.Test public void k2RoundFunc174() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.104\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on 0.105, type xs:float. . */ @org.junit.Test public void k2RoundFunc175() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.105\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on 0.105, type xs:double. . */ @org.junit.Test public void k2RoundFunc176() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.105\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on -0.105, type xs:float. . */ @org.junit.Test public void k2RoundFunc177() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.105\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on -0.105, type xs:double. . */ @org.junit.Test public void k2RoundFunc178() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.105\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on 0.106, type xs:float. . */ @org.junit.Test public void k2RoundFunc179() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.106\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on xs:float -INF. . */ @org.junit.Test public void k2RoundFunc18() { final XQuery query = new XQuery( "round(xs:float(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-INF") ); } /** * Invoke on 0.106, type xs:double. . */ @org.junit.Test public void k2RoundFunc180() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.106\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on -0.106, type xs:float. . */ @org.junit.Test public void k2RoundFunc181() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.106\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on -0.106, type xs:double. . */ @org.junit.Test public void k2RoundFunc182() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.106\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on 0.109, type xs:float. . */ @org.junit.Test public void k2RoundFunc183() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.109\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on 0.109, type xs:double. . */ @org.junit.Test public void k2RoundFunc184() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.109\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on -0.109, type xs:float. . */ @org.junit.Test public void k2RoundFunc185() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.109\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on -0.109, type xs:double. . */ @org.junit.Test public void k2RoundFunc186() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.109\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on 0.100, type xs:float. . */ @org.junit.Test public void k2RoundFunc187() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.100\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on 0.100, type xs:double. . */ @org.junit.Test public void k2RoundFunc188() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.100\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on -0.100, type xs:float. . */ @org.junit.Test public void k2RoundFunc189() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.100\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on xs:float 0. . */ @org.junit.Test public void k2RoundFunc19() { final XQuery query = new XQuery( "round(xs:float(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on -0.100, type xs:double. . */ @org.junit.Test public void k2RoundFunc190() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.100\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Ensure the return type is properly inferred for unsignedLong. . */ @org.junit.Test public void k2RoundFunc2() { final XQuery query = new XQuery( "round(xs:unsignedLong(.)) instance of xs:unsignedLong", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Invoke on xs:float -0. . */ @org.junit.Test public void k2RoundFunc20() { final XQuery query = new XQuery( "round(xs:float(\"-0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on xs:float NaN. . */ @org.junit.Test public void k2RoundFunc21() { final XQuery query = new XQuery( "fn:round(xs:float(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Invoke on xs:double NaN. . */ @org.junit.Test public void k2RoundFunc22() { final XQuery query = new XQuery( "fn:round(xs:double(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Invoke on 0.01, type xs:float. . */ @org.junit.Test public void k2RoundFunc23() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.01\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Invoke on 0.01, type xs:double. . */ @org.junit.Test public void k2RoundFunc24() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.01\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Invoke on -0.01, type xs:float. . */ @org.junit.Test public void k2RoundFunc25() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.01\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Invoke on -0.01, type xs:double. . */ @org.junit.Test public void k2RoundFunc26() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.01\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on 0.04, type xs:float. . */ @org.junit.Test public void k2RoundFunc27() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.04\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on 0.04, type xs:double. . */ @org.junit.Test public void k2RoundFunc28() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.04\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on -0.04, type xs:float. . */ @org.junit.Test public void k2RoundFunc29() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.04\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Ensure the return type is properly inferred for unsignedInt. . */ @org.junit.Test public void k2RoundFunc3() { final XQuery query = new XQuery( "round(xs:unsignedInt(.)) instance of xs:unsignedInt", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Invoke on -0.04, type xs:double. . */ @org.junit.Test public void k2RoundFunc30() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.04\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on 0.05, type xs:float. . */ @org.junit.Test public void k2RoundFunc31() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.05\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on 0.05, type xs:double. . */ @org.junit.Test public void k2RoundFunc32() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.05\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on -0.05, type xs:float. . */ @org.junit.Test public void k2RoundFunc33() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.05\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on -0.05, type xs:double. . */ @org.junit.Test public void k2RoundFunc34() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.05\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on 0.06, type xs:float. . */ @org.junit.Test public void k2RoundFunc35() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.06\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on 0.06, type xs:double. . */ @org.junit.Test public void k2RoundFunc36() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.06\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on -0.06, type xs:float. . */ @org.junit.Test public void k2RoundFunc37() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.06\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on -0.06, type xs:double. . */ @org.junit.Test public void k2RoundFunc38() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.06\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on 0.09, type xs:float. . */ @org.junit.Test public void k2RoundFunc39() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.09\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Ensure the return type is properly inferred for unsignedByte. . */ @org.junit.Test public void k2RoundFunc4() { final XQuery query = new XQuery( "round(xs:unsignedByte(.)) instance of xs:unsignedByte", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Invoke on 0.09, type xs:double. . */ @org.junit.Test public void k2RoundFunc40() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.09\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on -0.09, type xs:float. . */ @org.junit.Test public void k2RoundFunc41() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.09\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on -0.09, type xs:double. . */ @org.junit.Test public void k2RoundFunc42() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.09\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on 0.00, type xs:float. . */ @org.junit.Test public void k2RoundFunc43() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on 0.00, type xs:double. . */ @org.junit.Test public void k2RoundFunc44() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on -0.00, type xs:float. . */ @org.junit.Test public void k2RoundFunc45() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on -0.00, type xs:double. . */ @org.junit.Test public void k2RoundFunc46() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on 0.11, type xs:float. . */ @org.junit.Test public void k2RoundFunc47() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.11\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on 0.11, type xs:double. . */ @org.junit.Test public void k2RoundFunc48() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.11\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on -0.11, type xs:float. . */ @org.junit.Test public void k2RoundFunc49() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.11\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Ensure the return type is properly inferred for positiveInteger. . */ @org.junit.Test public void k2RoundFunc5() { final XQuery query = new XQuery( "round(xs:positiveInteger(.)) instance of xs:positiveInteger", ctx); try { query.context(node(file("fn/abs/e1.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Invoke on -0.11, type xs:double. . */ @org.junit.Test public void k2RoundFunc50() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.11\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on 0.14, type xs:float. . */ @org.junit.Test public void k2RoundFunc51() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.14\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on 0.14, type xs:double. . */ @org.junit.Test public void k2RoundFunc52() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.14\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on -0.14, type xs:float. . */ @org.junit.Test public void k2RoundFunc53() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.14\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on -0.14, type xs:double. . */ @org.junit.Test public void k2RoundFunc54() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.14\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertType("xs:double") && assertStringValue(false, "-0") ) ); } /** * Invoke on 0.15, type xs:float. . */ @org.junit.Test public void k2RoundFunc55() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.15\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on 0.15, type xs:double. . */ @org.junit.Test public void k2RoundFunc56() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.15\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on -0.15, type xs:float. . */ @org.junit.Test public void k2RoundFunc57() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.15\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on -0.15, type xs:double. . */ @org.junit.Test public void k2RoundFunc58() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.15\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on 0.16, type xs:float. . */ @org.junit.Test public void k2RoundFunc59() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.16\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Ensure the return type is properly inferred for nonPositiveInteger. . */ @org.junit.Test public void k2RoundFunc6() { final XQuery query = new XQuery( "round(xs:nonPositiveInteger(.)) instance of xs:nonPositiveInteger", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Invoke on 0.16, type xs:double. . */ @org.junit.Test public void k2RoundFunc60() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.16\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on -0.16, type xs:float. . */ @org.junit.Test public void k2RoundFunc61() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.16\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on -0.16, type xs:double. . */ @org.junit.Test public void k2RoundFunc62() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.16\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on 0.19, type xs:float. . */ @org.junit.Test public void k2RoundFunc63() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.19\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on 0.19, type xs:double. . */ @org.junit.Test public void k2RoundFunc64() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.19\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on -0.19, type xs:float. . */ @org.junit.Test public void k2RoundFunc65() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.19\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on -0.19, type xs:double. . */ @org.junit.Test public void k2RoundFunc66() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.19\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on 0.10, type xs:float. . */ @org.junit.Test public void k2RoundFunc67() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.10\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on 0.10, type xs:double. . */ @org.junit.Test public void k2RoundFunc68() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.10\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on -0.10, type xs:float. . */ @org.junit.Test public void k2RoundFunc69() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.10\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Ensure the return type is properly inferred for nonNegativeInteger. . */ @org.junit.Test public void k2RoundFunc7() { final XQuery query = new XQuery( "round(xs:nonNegativeInteger(.)) instance of xs:nonNegativeInteger", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Invoke on -0.10, type xs:double. . */ @org.junit.Test public void k2RoundFunc70() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.10\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on 0.41, type xs:float. . */ @org.junit.Test public void k2RoundFunc71() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.41\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on 0.41, type xs:double. . */ @org.junit.Test public void k2RoundFunc72() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.41\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on -0.41, type xs:float. . */ @org.junit.Test public void k2RoundFunc73() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.41\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on -0.41, type xs:double. . */ @org.junit.Test public void k2RoundFunc74() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.41\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on 0.44, type xs:float. . */ @org.junit.Test public void k2RoundFunc75() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.44\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on 0.44, type xs:double. . */ @org.junit.Test public void k2RoundFunc76() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.44\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on -0.44, type xs:float. . */ @org.junit.Test public void k2RoundFunc77() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.44\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on -0.44, type xs:double. . */ @org.junit.Test public void k2RoundFunc78() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.44\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on 0.45, type xs:float. . */ @org.junit.Test public void k2RoundFunc79() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.45\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Ensure the return type is properly inferred for negativeInteger. . */ @org.junit.Test public void k2RoundFunc8() { final XQuery query = new XQuery( "round(xs:negativeInteger(.)) instance of xs:negativeInteger", ctx); try { query.context(node(file("fn/abs/e-1.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Invoke on 0.45, type xs:double. . */ @org.junit.Test public void k2RoundFunc80() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.45\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on -0.45, type xs:float. . */ @org.junit.Test public void k2RoundFunc81() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.45\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on -0.45, type xs:double. . */ @org.junit.Test public void k2RoundFunc82() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.45\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on 0.46, type xs:float. . */ @org.junit.Test public void k2RoundFunc83() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.46\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on 0.46, type xs:double. . */ @org.junit.Test public void k2RoundFunc84() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.46\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on -0.46, type xs:float. . */ @org.junit.Test public void k2RoundFunc85() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.46\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on -0.46, type xs:double. . */ @org.junit.Test public void k2RoundFunc86() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.46\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on 0.49, type xs:float. . */ @org.junit.Test public void k2RoundFunc87() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.49\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on 0.49, type xs:double. . */ @org.junit.Test public void k2RoundFunc88() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.49\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on -0.49, type xs:float. . */ @org.junit.Test public void k2RoundFunc89() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.49\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Ensure the return type is properly inferred for long. . */ @org.junit.Test public void k2RoundFunc9() { final XQuery query = new XQuery( "round(xs:long(.)) instance of xs:long", ctx); try { query.context(node(file("fn/abs/e0.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Invoke on -0.49, type xs:double. . */ @org.junit.Test public void k2RoundFunc90() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.49\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on 0.40, type xs:float. . */ @org.junit.Test public void k2RoundFunc91() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.40\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on 0.40, type xs:double. . */ @org.junit.Test public void k2RoundFunc92() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.40\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Invoke on -0.40, type xs:float. . */ @org.junit.Test public void k2RoundFunc93() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.40\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on -0.40, type xs:double. . */ @org.junit.Test public void k2RoundFunc94() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.40\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Invoke on 0.51, type xs:float. . */ @org.junit.Test public void k2RoundFunc95() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.51\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Invoke on 0.51, type xs:double. . */ @org.junit.Test public void k2RoundFunc96() { final XQuery query = new XQuery( "fn:round(xs:double(\"0.51\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Invoke on -0.51, type xs:float. . */ @org.junit.Test public void k2RoundFunc97() { final XQuery query = new XQuery( "fn:round(xs:float(\"-0.51\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on -0.51, type xs:double. . */ @org.junit.Test public void k2RoundFunc98() { final XQuery query = new XQuery( "fn:round(xs:double(\"-0.51\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Invoke on 0.54, type xs:float. . */ @org.junit.Test public void k2RoundFunc99() { final XQuery query = new XQuery( "fn:round(xs:float(\"0.54\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * check dynamic type of fn:round on argument of union of numeric types. . */ @org.junit.Test public void fnRound1() { final XQuery query = new XQuery( "for $x in (1, xs:decimal(2), xs:float(3), xs:double(4)) \n" + " return if ((round($x)) instance of xs:integer) then \"integer\" \n" + " else if ((round($x)) instance of xs:decimal) then \"decimal\" \n" + " else if ((round($x)) instance of xs:float) then \"float\"\n" + " else if ((round($x)) instance of xs:double) then \"double\" \n" + " else error()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"integer\", \"decimal\", \"float\", \"double\"") ); } /** * round() applied to xs:decimal . */ @org.junit.Test public void fnRoundDecimal10() { final XQuery query = new XQuery( "fn:round(-12.567, 0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-13") && assertType("xs:decimal") ) ); } /** * round() applied to xs:decimal . */ @org.junit.Test public void fnRoundDecimal11() { final XQuery query = new XQuery( "fn:round(-1234.567, -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-1200") && assertType("xs:decimal") ) ); } /** * round() applied to xs:decimal . */ @org.junit.Test public void fnRoundDecimal12() { final XQuery query = new XQuery( "fn:round(1.567, -3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") && assertType("xs:decimal") ) ); } /** * round() applied to xs:decimal . */ @org.junit.Test public void fnRoundDecimal2() { final XQuery query = new XQuery( "fn:round(xs:decimal(\"12.1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("12") && assertType("xs:decimal") ) ); } /** * round() applied to xs:decimal . */ @org.junit.Test public void fnRoundDecimal3() { final XQuery query = new XQuery( "fn:round(xs:decimal(\"12.7\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("13") && assertType("xs:decimal") ) ); } /** * round() applied to xs:decimal . */ @org.junit.Test public void fnRoundDecimal4() { final XQuery query = new XQuery( "fn:round(xs:decimal(\"12.5\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("13") && assertType("xs:decimal") ) ); } /** * round() applied to xs:decimal . */ @org.junit.Test public void fnRoundDecimal5() { final XQuery query = new XQuery( "fn:round(xs:decimal(\"-12.7\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-13") && assertType("xs:decimal") ) ); } /** * round() applied to xs:decimal . */ @org.junit.Test public void fnRoundDecimal6() { final XQuery query = new XQuery( "fn:round(xs:decimal(\"-12.1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-12") && assertType("xs:decimal") ) ); } /** * round() applied to xs:decimal . */ @org.junit.Test public void fnRoundDecimal7() { final XQuery query = new XQuery( "fn:round(xs:decimal(\"-12.5\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-12") && assertType("xs:decimal") ) ); } /** * round() applied to xs:decimal . */ @org.junit.Test public void fnRoundDecimal8() { final XQuery query = new XQuery( "fn:round(-12.567, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-12.57") && assertType("xs:decimal") ) ); } /** * round() applied to xs:decimal . */ @org.junit.Test public void fnRoundDecimal9() { final XQuery query = new XQuery( "fn:round(-12.567, 4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-12.567") && assertType("xs:decimal") ) ); } /** * Tests the two-argument form of round(). */ @org.junit.Test public void fnRound2args1() { final XQuery query = new XQuery( "fn:round(1.125, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1.13") && assertType("xs:decimal") ) ); } /** * Tests the two-argument form of round(). */ @org.junit.Test public void fnRound2args2() { final XQuery query = new XQuery( "fn:round(8452, -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("8500") ); } /** * Tests the two-argument form of round(). */ @org.junit.Test public void fnRound2args3() { final XQuery query = new XQuery( "fn:round(3.1415e0, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3.14e0") ); } /** * Tests the two-argument form of round(). */ @org.junit.Test public void fnRound2args4() { final XQuery query = new XQuery( "fn:round(35.425, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("35.43") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:double(lower bound) . */ @org.junit.Test public void fnRounddbl1args1() { final XQuery query = new XQuery( "fn:round(xs:double(\"-1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.7976931348623157E308") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:double(mid range) . */ @org.junit.Test public void fnRounddbl1args2() { final XQuery query = new XQuery( "fn:round(xs:double(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") && assertType("xs:double") ) ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:double(upper bound) . */ @org.junit.Test public void fnRounddbl1args3() { final XQuery query = new XQuery( "fn:round(xs:double(\"1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.7976931348623157E308") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:decimal(lower bound) . */ @org.junit.Test public void fnRounddec1args1() { final XQuery query = new XQuery( "fn:round(xs:decimal(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:decimal(mid range) . */ @org.junit.Test public void fnRounddec1args2() { final XQuery query = new XQuery( "fn:round(xs:decimal(\"617375191608514839\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("617375191608514839") && assertType("xs:decimal") ) ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:decimal(upper bound) . */ @org.junit.Test public void fnRounddec1args3() { final XQuery query = new XQuery( "fn:round(xs:decimal(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:float(lower bound) . */ @org.junit.Test public void fnRoundflt1args1() { final XQuery query = new XQuery( "fn:round(xs:float(\"-3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(\"-3.4028235E38\")") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:float(mid range) . */ @org.junit.Test public void fnRoundflt1args2() { final XQuery query = new XQuery( "fn:round(xs:float(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertType("xs:float") && assertEq("0") ) ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:float(upper bound) . */ @org.junit.Test public void fnRoundflt1args3() { final XQuery query = new XQuery( "fn:round(xs:float(\"3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(\"3.4028235E38\")") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:int(lower bound) . */ @org.junit.Test public void fnRoundint1args1() { final XQuery query = new XQuery( "fn:round(xs:int(\"-2147483648\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-2147483648") && assertType("xs:integer") ) ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:int(mid range) . */ @org.junit.Test public void fnRoundint1args2() { final XQuery query = new XQuery( "fn:round(xs:int(\"-1873914410\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1873914410") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:int(upper bound) . */ @org.junit.Test public void fnRoundint1args3() { final XQuery query = new XQuery( "fn:round(xs:int(\"2147483647\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2147483647") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:integer(lower bound) . */ @org.junit.Test public void fnRoundintg1args1() { final XQuery query = new XQuery( "fn:round(xs:integer(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:integer(mid range) . */ @org.junit.Test public void fnRoundintg1args2() { final XQuery query = new XQuery( "fn:round(xs:integer(\"830993497117024304\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("830993497117024304") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:integer(upper bound) . */ @org.junit.Test public void fnRoundintg1args3() { final XQuery query = new XQuery( "fn:round(xs:integer(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:long(lower bound) . */ @org.junit.Test public void fnRoundlng1args1() { final XQuery query = new XQuery( "fn:round(xs:long(\"-92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:long(mid range) . */ @org.junit.Test public void fnRoundlng1args2() { final XQuery query = new XQuery( "fn:round(xs:long(\"-47175562203048468\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-47175562203048468") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:long(upper bound) . */ @org.junit.Test public void fnRoundlng1args3() { final XQuery query = new XQuery( "fn:round(xs:long(\"92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("92233720368547758") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnRoundnint1args1() { final XQuery query = new XQuery( "fn:round(xs:negativeInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnRoundnint1args2() { final XQuery query = new XQuery( "fn:round(xs:negativeInteger(\"-297014075999096793\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-297014075999096793") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnRoundnint1args3() { final XQuery query = new XQuery( "fn:round(xs:negativeInteger(\"-1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnRoundnni1args1() { final XQuery query = new XQuery( "fn:round(xs:nonNegativeInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnRoundnni1args2() { final XQuery query = new XQuery( "fn:round(xs:nonNegativeInteger(\"303884545991464527\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("303884545991464527") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnRoundnni1args3() { final XQuery query = new XQuery( "fn:round(xs:nonNegativeInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnRoundnpi1args1() { final XQuery query = new XQuery( "fn:round(xs:nonPositiveInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnRoundnpi1args2() { final XQuery query = new XQuery( "fn:round(xs:nonPositiveInteger(\"-475688437271870490\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-475688437271870490") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnRoundnpi1args3() { final XQuery query = new XQuery( "fn:round(xs:nonPositiveInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnRoundpint1args1() { final XQuery query = new XQuery( "fn:round(xs:positiveInteger(\"1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnRoundpint1args2() { final XQuery query = new XQuery( "fn:round(xs:positiveInteger(\"52704602390610033\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("52704602390610033") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnRoundpint1args3() { final XQuery query = new XQuery( "fn:round(xs:positiveInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:short(lower bound) . */ @org.junit.Test public void fnRoundsht1args1() { final XQuery query = new XQuery( "fn:round(xs:short(\"-32768\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-32768") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:short(mid range) . */ @org.junit.Test public void fnRoundsht1args2() { final XQuery query = new XQuery( "fn:round(xs:short(\"-5324\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-5324") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:short(upper bound) . */ @org.junit.Test public void fnRoundsht1args3() { final XQuery query = new XQuery( "fn:round(xs:short(\"32767\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("32767") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnRoundulng1args1() { final XQuery query = new XQuery( "fn:round(xs:unsignedLong(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnRoundulng1args2() { final XQuery query = new XQuery( "fn:round(xs:unsignedLong(\"130747108607674654\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("130747108607674654") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnRoundulng1args3() { final XQuery query = new XQuery( "fn:round(xs:unsignedLong(\"184467440737095516\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("184467440737095516") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnRoundusht1args1() { final XQuery query = new XQuery( "fn:round(xs:unsignedShort(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnRoundusht1args2() { final XQuery query = new XQuery( "fn:round(xs:unsignedShort(\"44633\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("44633") ); } /** * Evaluates The "round" function with the arguments set as follows: $arg = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnRoundusht1args3() { final XQuery query = new XQuery( "fn:round(xs:unsignedShort(\"65535\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("65535") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnRoundHalfToEven.java000066400000000000000000001766061222453003200302560ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the round-half-to-even() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnRoundHalfToEven extends QT3TestSet { /** * A test whose essence is: `round-half-to-even()`. . */ @org.junit.Test public void kRoundEvenFunc1() { final XQuery query = new XQuery( "round-half-to-even()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `round-half-to-even(1.1, 3, "wrong param")`. . */ @org.junit.Test public void kRoundEvenFunc2() { final XQuery query = new XQuery( "round-half-to-even(1.1, 3, \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(round-half-to-even(()))`. . */ @org.junit.Test public void kRoundEvenFunc3() { final XQuery query = new XQuery( "empty(round-half-to-even(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(round-half-to-even((), 3))`. . */ @org.junit.Test public void kRoundEvenFunc4() { final XQuery query = new XQuery( "empty(round-half-to-even((), 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `round-half-to-even("a string")`. . */ @org.junit.Test public void kRoundEvenFunc5() { final XQuery query = new XQuery( "round-half-to-even(\"a string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Invoked fn:round-half-to-even() on 1. . */ @org.junit.Test public void k2RoundEvenFunc1() { final XQuery query = new XQuery( "round-half-to-even(1) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked fn:round-half-to-even() on xs:float -0. . */ @org.junit.Test public void k2RoundEvenFunc10() { final XQuery query = new XQuery( "round-half-to-even(xs:float(\"-0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Invoked fn:round-half-to-even() on xs:double NaN. . */ @org.junit.Test public void k2RoundEvenFunc11() { final XQuery query = new XQuery( "round-half-to-even(xs:double(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Invoked fn:round-half-to-even() on xs:float NaN. . */ @org.junit.Test public void k2RoundEvenFunc12() { final XQuery query = new XQuery( "round-half-to-even(xs:float(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Invoked fn:round-half-to-even() on xs:double -INF. . */ @org.junit.Test public void k2RoundEvenFunc13() { final XQuery query = new XQuery( "round-half-to-even(xs:double(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-INF") ); } /** * Invoked fn:round-half-to-even() on xs:float -INF. . */ @org.junit.Test public void k2RoundEvenFunc14() { final XQuery query = new XQuery( "round-half-to-even(xs:float(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-INF") ); } /** * Invoked fn:round-half-to-even() on xs:double INF. . */ @org.junit.Test public void k2RoundEvenFunc15() { final XQuery query = new XQuery( "round-half-to-even(xs:double(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** * Invoked fn:round-half-to-even() on xs:float INF. . */ @org.junit.Test public void k2RoundEvenFunc16() { final XQuery query = new XQuery( "round-half-to-even(xs:float(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** * Ensure the return type is properly inferred for unsignedShort. . */ @org.junit.Test public void k2RoundEvenFunc17() { final XQuery query = new XQuery( "round-half-to-even(xs:unsignedShort(\"0\")) instance of xs:unsignedShort", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Ensure the return type is properly inferred for unsignedLong. . */ @org.junit.Test public void k2RoundEvenFunc18() { final XQuery query = new XQuery( "round-half-to-even(xs:unsignedLong(\"0\")) instance of xs:unsignedLong", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Ensure the return type is properly inferred for unsignedInt. . */ @org.junit.Test public void k2RoundEvenFunc19() { final XQuery query = new XQuery( "round-half-to-even(xs:unsignedInt(\"0\")) instance of xs:unsignedInt", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Invoked fn:round-half-to-even() on 1.0. . */ @org.junit.Test public void k2RoundEvenFunc2() { final XQuery query = new XQuery( "round-half-to-even(1.0) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is properly inferred for unsignedByte. . */ @org.junit.Test public void k2RoundEvenFunc20() { final XQuery query = new XQuery( "round-half-to-even(xs:unsignedByte(\"0\")) instance of xs:unsignedByte", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Ensure the return type is properly inferred for positiveInteger. . */ @org.junit.Test public void k2RoundEvenFunc21() { final XQuery query = new XQuery( "round-half-to-even(xs:positiveInteger(\"1\")) instance of xs:positiveInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Ensure the return type is properly inferred for nonPositiveInteger. . */ @org.junit.Test public void k2RoundEvenFunc22() { final XQuery query = new XQuery( "round-half-to-even(xs:nonPositiveInteger(\"0\")) instance of xs:nonPositiveInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Ensure the return type is properly inferred for nonNegativeInteger. . */ @org.junit.Test public void k2RoundEvenFunc23() { final XQuery query = new XQuery( "round-half-to-even(xs:nonNegativeInteger(\"0\")) instance of xs:nonNegativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Ensure the return type is properly inferred for negativeInteger. . */ @org.junit.Test public void k2RoundEvenFunc24() { final XQuery query = new XQuery( "round-half-to-even(xs:negativeInteger(\"-1\")) instance of xs:negativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Ensure the return type is properly inferred for long. . */ @org.junit.Test public void k2RoundEvenFunc25() { final XQuery query = new XQuery( "round-half-to-even(xs:long(\"0\")) instance of xs:long", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Ensure the return type is properly inferred for int. . */ @org.junit.Test public void k2RoundEvenFunc26() { final XQuery query = new XQuery( "round-half-to-even(xs:int(\"0\")) instance of xs:int", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Ensure the return type is properly inferred for short. . */ @org.junit.Test public void k2RoundEvenFunc27() { final XQuery query = new XQuery( "round-half-to-even(xs:short(\"0\")) instance of xs:short", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Ensure the return type is properly inferred for byte. . */ @org.junit.Test public void k2RoundEvenFunc28() { final XQuery query = new XQuery( "round-half-to-even(xs:byte(\"0\")) instance of xs:byte", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Invoked fn:round-half-to-even() on 0.5. . */ @org.junit.Test public void k2RoundEvenFunc3() { final XQuery query = new XQuery( "round-half-to-even(0.5) eq 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked fn:round-half-to-even() on 1.5. . */ @org.junit.Test public void k2RoundEvenFunc4() { final XQuery query = new XQuery( "round-half-to-even(1.5) eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked fn:round-half-to-even() on 2.5. . */ @org.junit.Test public void k2RoundEvenFunc5() { final XQuery query = new XQuery( "round-half-to-even(2.5) eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked fn:round-half-to-even() on a large double. . */ @org.junit.Test public void k2RoundEvenFunc6() { final XQuery query = new XQuery( "round-half-to-even(3.567812E+3, 2) eq 3567.81E0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked fn:round-half-to-even() on a large double with 2 in precision. . */ @org.junit.Test public void k2RoundEvenFunc7() { final XQuery query = new XQuery( "round-half-to-even(4.7564E-3, 2) eq 0.0E0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked fn:round-half-to-even() on a large double with -2 in precision. . */ @org.junit.Test public void k2RoundEvenFunc8() { final XQuery query = new XQuery( "round-half-to-even(35612.25, -2) eq 35600", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked fn:round-half-to-even() on xs:double -0. . */ @org.junit.Test public void k2RoundEvenFunc9() { final XQuery query = new XQuery( "round-half-to-even(xs:double(\"-0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * test fn:found-half-to-even on xs:double with large $precision argment . */ @org.junit.Test public void cbclRoundHalfToEven001() { final XQuery query = new XQuery( "fn:round-half-to-even(3.567812E+3, 4294967296)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3567.812") ); } /** * test fn:found-half-to-even on integer with positive precision . */ @org.junit.Test public void cbclRoundHalfToEven002() { final XQuery query = new XQuery( "fn:round-half-to-even(12345, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12345") ); } /** * test fn:found-half-to-even on integer with negative precision . */ @org.junit.Test public void cbclRoundHalfToEven003() { final XQuery query = new XQuery( "fn:round-half-to-even(12345, -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12300") ); } /** * test fn:found-half-to-even on short with positive precision . */ @org.junit.Test public void cbclRoundHalfToEven004() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:short(12345), 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12345") ); } /** * test fn:found-half-to-even on short with negative precision . */ @org.junit.Test public void cbclRoundHalfToEven005() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:short(12345), -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12300") ); } /** * test fn:found-half-to-even on decimal with positive precision . */ @org.junit.Test public void cbclRoundHalfToEven006() { final XQuery query = new XQuery( "fn:round-half-to-even(12345.6, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12345.6") ); } /** * test fn:found-half-to-even on decimal with negative precision . */ @org.junit.Test public void cbclRoundHalfToEven007() { final XQuery query = new XQuery( "fn:round-half-to-even(12345.6, -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12300") ); } /** * test fn:found-half-to-even on float with positive precision . */ @org.junit.Test public void cbclRoundHalfToEven008() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:float(12345.6), 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12345.6") ); } /** * test fn:found-half-to-even on float with negative precision . */ @org.junit.Test public void cbclRoundHalfToEven009() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:float(12345.6), -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12300") ); } /** * test fn:found-half-to-even on double with positive precision . */ @org.junit.Test public void cbclRoundHalfToEven010() { final XQuery query = new XQuery( "fn:round-half-to-even(123456e-2, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1234.56") ); } /** * test fn:found-half-to-even on double with negative precision . */ @org.junit.Test public void cbclRoundHalfToEven011() { final XQuery query = new XQuery( "fn:round-half-to-even(123456e-2, -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1200") ); } /** * test fn:found-half-to-even on xs:decimal with large $precision argment . */ @org.junit.Test public void cbclRoundHalfToEven012() { final XQuery query = new XQuery( "fn:round-half-to-even(3.567812, 4294967296)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3.567812") ); } /** * test EBV of fn:found-half-to-even with invalid type for argument 2 . */ @org.junit.Test public void cbclRoundHalfToEven013() { final XQuery query = new XQuery( "fn:boolean(fn:round-half-to-even(5, 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:found-half-to-even with invalid type for argument 2 . */ @org.junit.Test public void cbclRoundHalfToEven014() { final XQuery query = new XQuery( "fn:round-half-to-even(123456e-2, \"two\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * check dynamic type of fn:round-half-to-even on argument of union of numeric types. . */ @org.junit.Test public void fnRoundHalfToEven1() { final XQuery query = new XQuery( "for $x in (1, xs:decimal(2), xs:float(3), xs:double(4)) \n" + " return if ((round-half-to-even($x)) instance of xs:integer) then \"integer\" \n" + " else if ((round-half-to-even($x)) instance of xs:decimal) then \"decimal\" \n" + " else if ((round-half-to-even($x)) instance of xs:float) then \"float\"\n" + " else if ((round-half-to-even($x)) instance of xs:double) then \"double\" \n" + " else error()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"integer\", \"decimal\", \"float\", \"double\"") ); } /** * Zero second argument - decimal. */ @org.junit.Test public void fnRoundHalfToEven10() { final XQuery query = new XQuery( "round-half-to-even(4561.234567, 0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("4561") && assertType("xs:decimal") ) ); } /** * Zero second argument - double. */ @org.junit.Test public void fnRoundHalfToEven11() { final XQuery query = new XQuery( "round-half-to-even(4561.000005e0, 0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("4561") && assertType("xs:double") ) ); } /** * Zero second argument - float. */ @org.junit.Test public void fnRoundHalfToEven12() { final XQuery query = new XQuery( "round-half-to-even(xs:float('4561.000005e0'), 0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("4561") && assertType("xs:float") ) ); } /** * Zero second argument - integer. */ @org.junit.Test public void fnRoundHalfToEven13() { final XQuery query = new XQuery( "round-half-to-even(4561234567, 0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("4561234567") && assertType("xs:integer") ) ); } /** * Positive second argument - halfway case - float. The expected result is surprising; it arises because 0.05 is not exactly representable as an xs:float. */ @org.junit.Test public void fnRoundHalfToEven14() { final XQuery query = new XQuery( "round-half-to-even(xs:float('0.05'), 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0.1") && assertType("xs:float") ) ); } /** * Positive second argument - halfway case - float. The expected result is surprising; it arises because -0.05 is not exactly representable as an xs:float. */ @org.junit.Test public void fnRoundHalfToEven15() { final XQuery query = new XQuery( "round-half-to-even(xs:float('-0.05'), 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-0.1") && assertType("xs:float") ) ); } /** * Positive second argument - halfway case - float. */ @org.junit.Test public void fnRoundHalfToEven16() { final XQuery query = new XQuery( "round-half-to-even(xs:float('3.75'), 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("3.8") && assertType("xs:float") ) ); } /** * Positive second argument - halfway case - decimal. */ @org.junit.Test public void fnRoundHalfToEven17() { final XQuery query = new XQuery( "round-half-to-even(123.355, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("123.36") && assertType("xs:decimal") ) ); } /** * Positive second argument - halfway case - decimal. */ @org.junit.Test public void fnRoundHalfToEven18() { final XQuery query = new XQuery( "round-half-to-even(123.365, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("123.36") && assertType("xs:decimal") ) ); } /** * Positive second argument - halfway case - decimal. */ @org.junit.Test public void fnRoundHalfToEven19() { final XQuery query = new XQuery( "round-half-to-even(123.375, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("123.38") && assertType("xs:decimal") ) ); } /** * check dynamic type of fn:round-half-to-even on argument of union of numeric types. . */ @org.junit.Test public void fnRoundHalfToEven2() { final XQuery query = new XQuery( "for $x in (1, xs:decimal(2), xs:float(3), xs:double(4)) \n" + " return if ((round-half-to-even($x,1)) instance of xs:integer) then \"integer\" \n" + " else if ((round-half-to-even($x,1)) instance of xs:decimal) then \"decimal\" \n" + " else if ((round-half-to-even($x,1)) instance of xs:float) then \"float\"\n" + " else if ((round-half-to-even($x,1)) instance of xs:double) then \"double\" \n" + " else error()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"integer\", \"decimal\", \"float\", \"double\"") ); } /** * Positive second argument - halfway case - decimal. */ @org.junit.Test public void fnRoundHalfToEven20() { final XQuery query = new XQuery( "round-half-to-even(123.385, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("123.38") && assertType("xs:decimal") ) ); } /** * Positive second argument - halfway case - decimal. */ @org.junit.Test public void fnRoundHalfToEven21() { final XQuery query = new XQuery( "round-half-to-even(-123.355, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-123.36") && assertType("xs:decimal") ) ); } /** * Positive second argument - halfway case - decimal. */ @org.junit.Test public void fnRoundHalfToEven22() { final XQuery query = new XQuery( "round-half-to-even(-123.365, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-123.36") && assertType("xs:decimal") ) ); } /** * Positive second argument - halfway case - decimal. */ @org.junit.Test public void fnRoundHalfToEven23() { final XQuery query = new XQuery( "round-half-to-even(-123.375, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-123.38") && assertType("xs:decimal") ) ); } /** * Positive second argument - halfway case - decimal. */ @org.junit.Test public void fnRoundHalfToEven24() { final XQuery query = new XQuery( "round-half-to-even(-123.385, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-123.38") && assertType("xs:decimal") ) ); } /** * Negative second argument - halfway case - decimal. */ @org.junit.Test public void fnRoundHalfToEven24a() { final XQuery query = new XQuery( "round-half-to-even(12350.00, -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("12400") && assertType("xs:decimal") ) ); } /** * Negative second argument - halfway case - decimal. */ @org.junit.Test public void fnRoundHalfToEven25() { final XQuery query = new XQuery( "round-half-to-even(-12350.00, -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-12400") && assertType("xs:decimal") ) ); } /** * Negative second argument - halfway case - decimal. */ @org.junit.Test public void fnRoundHalfToEven26() { final XQuery query = new XQuery( "round-half-to-even(12450.00, -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("12400") && assertType("xs:decimal") ) ); } /** * Negative second argument - halfway case - decimal. */ @org.junit.Test public void fnRoundHalfToEven27() { final XQuery query = new XQuery( "round-half-to-even(-12450.00, -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-12400") && assertType("xs:decimal") ) ); } /** * Negative second argument - halfway case - decimal. */ @org.junit.Test public void fnRoundHalfToEven28() { final XQuery query = new XQuery( "round-half-to-even(12550.00, -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("12600") && assertType("xs:decimal") ) ); } /** * Negative second argument - halfway case - decimal. */ @org.junit.Test public void fnRoundHalfToEven29() { final XQuery query = new XQuery( "round-half-to-even(-12550.00, -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-12600") && assertType("xs:decimal") ) ); } /** * Positive second argument - decimal. */ @org.junit.Test public void fnRoundHalfToEven3() { final XQuery query = new XQuery( "round-half-to-even(1.234567, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1.23") && assertType("xs:decimal") ) ); } /** * Negative second argument - halfway case - integer. */ @org.junit.Test public void fnRoundHalfToEven30() { final XQuery query = new XQuery( "round-half-to-even(12350, -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("12400") && assertType("xs:decimal") ) ); } /** * Negative second argument - halfway case - integer. */ @org.junit.Test public void fnRoundHalfToEven31() { final XQuery query = new XQuery( "round-half-to-even(-12350, -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-12400") && assertType("xs:decimal") ) ); } /** * Negative second argument - halfway case - integer. */ @org.junit.Test public void fnRoundHalfToEven32() { final XQuery query = new XQuery( "round-half-to-even(12450, -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("12400") && assertType("xs:decimal") ) ); } /** * Negative second argument - halfway case - integer. */ @org.junit.Test public void fnRoundHalfToEven33() { final XQuery query = new XQuery( "round-half-to-even(-12450, -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-12400") && assertType("xs:decimal") ) ); } /** * Negative second argument - halfway case - integer. */ @org.junit.Test public void fnRoundHalfToEven34() { final XQuery query = new XQuery( "round-half-to-even(12550, -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("12600") && assertType("xs:decimal") ) ); } /** * Negative second argument - halfway case - integer. */ @org.junit.Test public void fnRoundHalfToEven35() { final XQuery query = new XQuery( "round-half-to-even(-12550, -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-12600") && assertType("xs:decimal") ) ); } /** * Negative second argument - halfway case - double. */ @org.junit.Test public void fnRoundHalfToEven36() { final XQuery query = new XQuery( "round-half-to-even(12350e0, -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("12400") && assertType("xs:double") ) ); } /** * Negative second argument - halfway case - double. */ @org.junit.Test public void fnRoundHalfToEven37() { final XQuery query = new XQuery( "round-half-to-even(-12350e0, -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-12400") && assertType("xs:double") ) ); } /** * Negative second argument - halfway case - double. */ @org.junit.Test public void fnRoundHalfToEven38() { final XQuery query = new XQuery( "round-half-to-even(12450e0, -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("12400") && assertType("xs:double") ) ); } /** * Negative second argument - halfway case - double. */ @org.junit.Test public void fnRoundHalfToEven39() { final XQuery query = new XQuery( "round-half-to-even(-12450e0, -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-12400") && assertType("xs:double") ) ); } /** * Positive second argument - double. */ @org.junit.Test public void fnRoundHalfToEven4() { final XQuery query = new XQuery( "round-half-to-even(1.000005e0, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1") && assertType("xs:double") ) ); } /** * Negative second argument - halfway case - double. */ @org.junit.Test public void fnRoundHalfToEven40() { final XQuery query = new XQuery( "round-half-to-even(12550e0, -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("12600") && assertType("xs:double") ) ); } /** * Negative second argument - halfway case - double. */ @org.junit.Test public void fnRoundHalfToEven41() { final XQuery query = new XQuery( "round-half-to-even(-12550e0, -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-12600") && assertType("xs:double") ) ); } /** * Positive second argument - float. */ @org.junit.Test public void fnRoundHalfToEven5() { final XQuery query = new XQuery( "round-half-to-even(xs:float('1.000005e0'), 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1") && assertType("xs:float") ) ); } /** * Negative second argument - decimal. */ @org.junit.Test public void fnRoundHalfToEven6() { final XQuery query = new XQuery( "round-half-to-even(4561.234567, -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("4600") && assertType("xs:decimal") ) ); } /** * Negative second argument - double. */ @org.junit.Test public void fnRoundHalfToEven7() { final XQuery query = new XQuery( "round-half-to-even(4561.000005e0, -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("4600") && assertType("xs:double") ) ); } /** * Negative second argument - float. */ @org.junit.Test public void fnRoundHalfToEven8() { final XQuery query = new XQuery( "round-half-to-even(xs:float('4561.000005e0'), -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("4600") && assertType("xs:float") ) ); } /** * Negative second argument - integer. */ @org.junit.Test public void fnRoundHalfToEven9() { final XQuery query = new XQuery( "round-half-to-even(4561234567, -2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("4561234600") && assertType("xs:integer") ) ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:double(lower bound) . */ @org.junit.Test public void fnRoundHalfToEvendbl1args1() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:double(\"-1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-1.7976931348623157E308") || error("FOCA0001") ) ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:double(mid range) . */ @org.junit.Test public void fnRoundHalfToEvendbl1args2() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:double(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:double(upper bound) . */ @org.junit.Test public void fnRoundHalfToEvendbl1args3() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:double(\"1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1.7976931348623157E308") || error("FOCA0001") ) ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:decimal(lower bound) . */ @org.junit.Test public void fnRoundHalfToEvendec1args1() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:decimal(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:decimal(mid range) . */ @org.junit.Test public void fnRoundHalfToEvendec1args2() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:decimal(\"617375191608514839\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("617375191608514839") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:decimal(upper bound) . */ @org.junit.Test public void fnRoundHalfToEvendec1args3() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:decimal(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:float(lower bound) . */ @org.junit.Test public void fnRoundHalfToEvenflt1args1() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:float(\"-3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("xs:float(\"-3.4028235E38\")") || error("FOCA0001") ) ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:float(mid range) . */ @org.junit.Test public void fnRoundHalfToEvenflt1args2() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:float(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:float(upper bound) . */ @org.junit.Test public void fnRoundHalfToEvenflt1args3() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:float(\"3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("xs:float(\"3.4028235E38\")") || error("FOCA0001") ) ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:int(lower bound) . */ @org.junit.Test public void fnRoundHalfToEvenint1args1() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:int(\"-2147483648\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2147483648") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:int(mid range) . */ @org.junit.Test public void fnRoundHalfToEvenint1args2() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:int(\"-1873914410\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1873914410") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:int(upper bound) . */ @org.junit.Test public void fnRoundHalfToEvenint1args3() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:int(\"2147483647\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2147483647") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:integer(lower bound) . */ @org.junit.Test public void fnRoundHalfToEvenintg1args1() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:integer(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:integer(mid range) . */ @org.junit.Test public void fnRoundHalfToEvenintg1args2() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:integer(\"830993497117024304\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("830993497117024304") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:integer(upper bound) . */ @org.junit.Test public void fnRoundHalfToEvenintg1args3() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:integer(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:long(lower bound) . */ @org.junit.Test public void fnRoundHalfToEvenlng1args1() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:long(\"-92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:long(mid range) . */ @org.junit.Test public void fnRoundHalfToEvenlng1args2() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:long(\"-47175562203048468\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-47175562203048468") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:long(upper bound) . */ @org.junit.Test public void fnRoundHalfToEvenlng1args3() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:long(\"92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("92233720368547758") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnRoundHalfToEvennint1args1() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:negativeInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnRoundHalfToEvennint1args2() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:negativeInteger(\"-297014075999096793\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-297014075999096793") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnRoundHalfToEvennint1args3() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:negativeInteger(\"-1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnRoundHalfToEvennni1args1() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:nonNegativeInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnRoundHalfToEvennni1args2() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:nonNegativeInteger(\"303884545991464527\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("303884545991464527") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnRoundHalfToEvennni1args3() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:nonNegativeInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnRoundHalfToEvennpi1args1() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:nonPositiveInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnRoundHalfToEvennpi1args2() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:nonPositiveInteger(\"-475688437271870490\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-475688437271870490") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnRoundHalfToEvennpi1args3() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:nonPositiveInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnRoundHalfToEvenpint1args1() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:positiveInteger(\"1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnRoundHalfToEvenpint1args2() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:positiveInteger(\"52704602390610033\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("52704602390610033") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnRoundHalfToEvenpint1args3() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:positiveInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:short(lower bound) . */ @org.junit.Test public void fnRoundHalfToEvensht1args1() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:short(\"-32768\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-32768") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:short(mid range) . */ @org.junit.Test public void fnRoundHalfToEvensht1args2() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:short(\"-5324\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-5324") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:short(upper bound) . */ @org.junit.Test public void fnRoundHalfToEvensht1args3() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:short(\"32767\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("32767") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnRoundHalfToEvenulng1args1() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:unsignedLong(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnRoundHalfToEvenulng1args2() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:unsignedLong(\"130747108607674654\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("130747108607674654") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnRoundHalfToEvenulng1args3() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:unsignedLong(\"184467440737095516\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("184467440737095516") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnRoundHalfToEvenusht1args1() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:unsignedShort(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnRoundHalfToEvenusht1args2() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:unsignedShort(\"44633\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("44633") ); } /** * Evaluates The "round-half-to-even" function with the arguments set as follows: $arg = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnRoundHalfToEvenusht1args3() { final XQuery query = new XQuery( "fn:round-half-to-even(xs:unsignedShort(\"65535\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("65535") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnSecondsFromDateTime.java000066400000000000000000000351671222453003200311060ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the seconds-from-dateTime() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnSecondsFromDateTime extends QT3TestSet { /** * A test whose essence is: `seconds-from-dateTime()`. . */ @org.junit.Test public void kSecondsFromDateTimeFunc1() { final XQuery query = new XQuery( "seconds-from-dateTime()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `seconds-from-dateTime((), "Wrong param")`. . */ @org.junit.Test public void kSecondsFromDateTimeFunc2() { final XQuery query = new XQuery( "seconds-from-dateTime((), \"Wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(seconds-from-dateTime(()))`. . */ @org.junit.Test public void kSecondsFromDateTimeFunc3() { final XQuery query = new XQuery( "empty(seconds-from-dateTime(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `seconds-from-dateTime(()) instance of xs:decimal?`. . */ @org.junit.Test public void kSecondsFromDateTimeFunc4() { final XQuery query = new XQuery( "seconds-from-dateTime(()) instance of xs:decimal?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `seconds-from-dateTime(xs:dateTime("2001-02-03T08:23:12.43")) eq 12.43`. . */ @org.junit.Test public void kSecondsFromDateTimeFunc5() { final XQuery query = new XQuery( "seconds-from-dateTime(xs:dateTime(\"2001-02-03T08:23:12.43\")) eq 12.43", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "seconds-from-dateTime" function As per example 1 of the F&O specs. . */ @org.junit.Test public void fnSecondsFromDateTime1() { final XQuery query = new XQuery( "fn:seconds-from-dateTime(xs:dateTime(\"1999-05-31T13:20:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "secondss-from-dateTime" function as part of a "*" expression. . */ @org.junit.Test public void fnSecondsFromDateTime10() { final XQuery query = new XQuery( "fn:seconds-from-dateTime(xs:dateTime(\"1970-01-01T02:02:02Z\")) * fn:seconds-from-dateTime(xs:dateTime(\"1970-01-01T10:03:03Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "6") ); } /** * Evaluates The "seconds-from-dateTime" function as part of a "div" expression. . */ @org.junit.Test public void fnSecondsFromDateTime11() { final XQuery query = new XQuery( "fn:seconds-from-dateTime(xs:dateTime(\"1970-01-01T02:10:10Z\")) div fn:seconds-from-dateTime(xs:dateTime(\"1970-01-01T10:05:05Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Evaluates The "seconds-from-dateTime" function as part of a "idiv" expression. . */ @org.junit.Test public void fnSecondsFromDateTime12() { final XQuery query = new XQuery( "fn:seconds-from-dateTime(xs:dateTime(\"1970-01-01T10:10:10Z\")) idiv fn:seconds-from-dateTime(xs:dateTime(\"1970-01-01T02:05:05Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Evaluates The "seconds-from-dateTime" function as part of a "mod" expression. . */ @org.junit.Test public void fnSecondsFromDateTime13() { final XQuery query = new XQuery( "fn:seconds-from-dateTime(xs:dateTime(\"1970-01-01T10:10:10Z\")) mod fn:seconds-from-dateTime(xs:dateTime(\"1970-01-01T03:10:10Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "seconds-from-dateTime" function as part of a "numeric-unary-plus" expression. . */ @org.junit.Test public void fnSecondsFromDateTime14() { final XQuery query = new XQuery( "+fn:seconds-from-dateTime(xs:dateTime(\"1970-01-01T10:10:10Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10") ); } /** * Evaluates The "seconds-from-dateTime" function as part of a "numeric-unary-minus" expression. . */ @org.junit.Test public void fnSecondsFromDateTime15() { final XQuery query = new XQuery( "-fn:seconds-from-dateTime(xs:dateTime(\"1970-01-01T10:10:10Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-10") ); } /** * Evaluates The "seconds-from-dateTime" function as part of a "numeric-equal" expression (eq operator) . */ @org.junit.Test public void fnSecondsFromDateTime16() { final XQuery query = new XQuery( "fn:seconds-from-dateTime(xs:dateTime(\"1970-01-01T10:10:10Z\")) eq fn:seconds-from-dateTime(xs:dateTime(\"1970-01-01T10:10:10Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "seconds-from-dateTime" function as part of a "numeric-equal" expression (ne operator) . */ @org.junit.Test public void fnSecondsFromDateTime17() { final XQuery query = new XQuery( "fn:seconds-from-dateTime(xs:dateTime(\"1970-01-01T10:10:10Z\")) ne fn:seconds-from-dateTime(xs:dateTime(\"1970-01-01T10:10:10Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "seconds-from-dateTime" function as part of a "numeric-equal" expression (le operator) . */ @org.junit.Test public void fnSecondsFromDateTime18() { final XQuery query = new XQuery( "fn:seconds-from-dateTime(xs:dateTime(\"1970-01-01T10:10:10Z\")) le fn:seconds-from-dateTime(xs:dateTime(\"1970-01-01T10:10:10Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "seconds-from-dateTime" function as part of a "numeric-equal" expression (ge operator) . */ @org.junit.Test public void fnSecondsFromDateTime19() { final XQuery query = new XQuery( "fn:seconds-from-dateTime(xs:dateTime(\"1970-01-01T10:10:10Z\")) ge fn:seconds-from-dateTime(xs:dateTime(\"1970-01-01T10:10:10Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "seconds-from-dateTime" function as an argument to an "avg" function. . */ @org.junit.Test public void fnSecondsFromDateTime2() { final XQuery query = new XQuery( "fn:avg((fn:seconds-from-dateTime(xs:dateTime(\"1999-05-31T13:30:10Z\")), fn:seconds-from-dateTime(xs:dateTime(\"1999-05-31T13:30:15Z\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12.5") ); } /** * Evaluates The "seconds-from-dateTime" function involving a "numeric-less-than" operation (lt operator) . */ @org.junit.Test public void fnSecondsFromDateTime3() { final XQuery query = new XQuery( "fn:seconds-from-dateTime(xs:dateTime(\"1999-12-31T21:20:20-05:00\")) lt fn:seconds-from-dateTime(xs:dateTime(\"1999-12-31T21:20:20-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "seconds-from-dateTime" function involving a "numeric-less-than" operation (le operator) . */ @org.junit.Test public void fnSecondsFromDateTime4() { final XQuery query = new XQuery( "fn:seconds-from-dateTime(xs:dateTime(\"1999-12-31T21:20:20-05:00\")) le fn:seconds-from-dateTime(xs:dateTime(\"1999-12-31T21:20:20-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "seconds-from-dateTime" function using the empty sequence as an argument. Use count function to avoid empty file. . */ @org.junit.Test public void fnSecondsFromDateTime5() { final XQuery query = new XQuery( "fn:count(fn:seconds-from-dateTime(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "seconds-from-dateTime" function that returns 0. . */ @org.junit.Test public void fnSecondsFromDateTime6() { final XQuery query = new XQuery( "fn:seconds-from-dateTime(xs:dateTime(\"1999-05-31T20:00:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "seconds-from-dateTime" function that returns 59. . */ @org.junit.Test public void fnSecondsFromDateTime7() { final XQuery query = new XQuery( "fn:seconds-from-dateTime(xs:dateTime(\"1999-05-31T23:59:59-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "59") ); } /** * Evaluates The "seconds-from-dateTime" function as part of a "+" expression. . */ @org.junit.Test public void fnSecondsFromDateTime8() { final XQuery query = new XQuery( "fn:seconds-from-dateTime(xs:dateTime(\"1970-01-01T00:00:10Z\")) + fn:seconds-from-dateTime(xs:dateTime(\"1970-01-01T10:00:11Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "21") ); } /** * Evaluates The "seconds-from-dateTime" function as part of a "-" expression. . */ @org.junit.Test public void fnSecondsFromDateTime9() { final XQuery query = new XQuery( "fn:seconds-from-dateTime(xs:dateTime(\"1970-01-01T00:00:10Z\")) - fn:seconds-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10") ); } /** * Evaluates The "seconds-from-dateTime" function with the arguments set as follows: $arg = xs:dateTime(lower bound) . */ @org.junit.Test public void fnSecondsFromDateTime1args1() { final XQuery query = new XQuery( "fn:seconds-from-dateTime(xs:dateTime(\"1970-01-01T00:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "seconds-from-dateTime" function with the arguments set as follows: $arg = xs:dateTime(mid range) . */ @org.junit.Test public void fnSecondsFromDateTime1args2() { final XQuery query = new XQuery( "fn:seconds-from-dateTime(xs:dateTime(\"1996-04-07T01:40:52Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "52") ); } /** * Evaluates The "seconds-from-dateTime" function with the arguments set as follows: $arg = xs:dateTime(upper bound) . */ @org.junit.Test public void fnSecondsFromDateTime1args3() { final XQuery query = new XQuery( "fn:seconds-from-dateTime(xs:dateTime(\"2030-12-31T23:59:59Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "59") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnSecondsFromDuration.java000066400000000000000000000414551222453003200311740ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the seconds-from-duration() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnSecondsFromDuration extends QT3TestSet { /** * A test whose essence is: `seconds-from-duration()`. . */ @org.junit.Test public void kSecondsFromDurationFunc1() { final XQuery query = new XQuery( "seconds-from-duration()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `seconds-from-duration((), "Wrong param")`. . */ @org.junit.Test public void kSecondsFromDurationFunc2() { final XQuery query = new XQuery( "seconds-from-duration((), \"Wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(seconds-from-duration(()))`. . */ @org.junit.Test public void kSecondsFromDurationFunc3() { final XQuery query = new XQuery( "empty(seconds-from-duration(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `seconds-from-duration(()) instance of xs:decimal?`. . */ @org.junit.Test public void kSecondsFromDurationFunc4() { final XQuery query = new XQuery( "seconds-from-duration(()) instance of xs:decimal?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test invoking seconds-from-duration() on a positive duration. . */ @org.junit.Test public void kSecondsFromDurationFunc5() { final XQuery query = new XQuery( "seconds-from-duration(xs:dayTimeDuration(\"P3DT8H2M1.03S\")) eq 1.03", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test invoking seconds-from-duration() on a negative duration. . */ @org.junit.Test public void kSecondsFromDurationFunc6() { final XQuery query = new XQuery( "seconds-from-duration(xs:dayTimeDuration(\"-P3DT8H2M1.03S\")) eq -1.03", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test invoking minutes-from-seconds() on an negative xs:duration. . */ @org.junit.Test public void kSecondsFromDurationFunc7() { final XQuery query = new XQuery( "seconds-from-duration(xs:duration(\"-P3Y4M8DT1H23M2.34S\")) eq -2.34", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:seconds-from-duration on xs:dayTimeDuration . */ @org.junit.Test public void cbclSecondsFromDuration001() { final XQuery query = new XQuery( "fn:seconds-from-duration(xs:yearMonthDuration('P1Y'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "seconds-from-duration" function As per example 1 (for this function)of the F&O specs . */ @org.junit.Test public void fnSecondsFromDuration1() { final XQuery query = new XQuery( "fn:seconds-from-duration(xs:dayTimeDuration(\"P3DT10H12.5S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("12.5") ); } /** * Evaluates The "seconds-from-duration" function as part of a "*" expression. . */ @org.junit.Test public void fnSecondsFromDuration10() { final XQuery query = new XQuery( "fn:seconds-from-duration(xs:dayTimeDuration(\"P20DT09H04M20S\")) * fn:seconds-from-duration(xs:dayTimeDuration(\"P03DT10H10M03S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("60") ); } /** * Evaluates The "seconds-from-duration" function as part of a "div" expression. . */ @org.junit.Test public void fnSecondsFromDuration11() { final XQuery query = new XQuery( "fn:seconds-from-duration(xs:dayTimeDuration(\"P20DT10H10M30S\")) div fn:seconds-from-duration(xs:dayTimeDuration(\"P05DT05H02M02S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("15") ); } /** * Evaluates The "seconds-from-duration" function as part of a "idiv" expression. . */ @org.junit.Test public void fnSecondsFromDuration12() { final XQuery query = new XQuery( "fn:seconds-from-duration(xs:dayTimeDuration(\"P25DT10H20M40S\")) idiv fn:seconds-from-duration(xs:dayTimeDuration(\"P05DT02H04M20S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Evaluates The "seconds-from-duration" function as part of a "mod" expression. . */ @org.junit.Test public void fnSecondsFromDuration13() { final XQuery query = new XQuery( "fn:seconds-from-duration(xs:dayTimeDuration(\"P10DT10H20M10S\")) mod fn:seconds-from-duration(xs:dayTimeDuration(\"P03DT03H03M03S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "seconds-from-duration" function as part of a "numeric-unary-plus" expression. . */ @org.junit.Test public void fnSecondsFromDuration14() { final XQuery query = new XQuery( "+fn:seconds-from-duration(xs:dayTimeDuration(\"P21DT10H10M20S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("20") ); } /** * Evaluates The "seconds-from-duration" function as part of a "numeric-unary-minus" expression. . */ @org.junit.Test public void fnSecondsFromDuration15() { final XQuery query = new XQuery( "-fn:seconds-from-duration(xs:dayTimeDuration(\"P20DT03H20M30S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-30") ); } /** * Evaluates The "seconds-from-duration" function as part of a "numeric-equal" expression (eq operator) . */ @org.junit.Test public void fnSecondsFromDuration16() { final XQuery query = new XQuery( "fn:seconds-from-duration(xs:dayTimeDuration(\"P22DT10H10M01S\")) eq fn:seconds-from-duration(xs:dayTimeDuration(\"P22DT09H10M01S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "seconds-from-duration" function as part of a "numeric-equal" expression (ne operator) . */ @org.junit.Test public void fnSecondsFromDuration17() { final XQuery query = new XQuery( "fn:seconds-from-duration(xs:dayTimeDuration(\"P23DT08H20M02S\")) ne fn:seconds-from-duration(xs:dayTimeDuration(\"P12DT05H22M03S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "seconds-from-duration" function as part of a "numeric-equal" expression (le operator) . */ @org.junit.Test public void fnSecondsFromDuration18() { final XQuery query = new XQuery( "fn:seconds-from-duration(xs:dayTimeDuration(\"P20DT03H09M20S\")) le fn:seconds-from-duration(xs:dayTimeDuration(\"P21DT15H21M31S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "seconds-from-duration" function as part of a "numeric-equal" expression (ge operator) . */ @org.junit.Test public void fnSecondsFromDuration19() { final XQuery query = new XQuery( "fn:seconds-from-duration(xs:dayTimeDuration(\"P21DT07H12M59S\")) ge fn:seconds-from-duration(xs:dayTimeDuration(\"P20DT01H13M01S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "seconds-from-duration" function As per example 2 (for this function) of the F&O specs . */ @org.junit.Test public void fnSecondsFromDuration2() { final XQuery query = new XQuery( "fn:seconds-from-duration(xs:dayTimeDuration(\"-PT256S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-16") ); } /** * Evaluates The "seconds-from-duration" function with wrong argument type. . */ @org.junit.Test public void fnSecondsFromDuration20() { final XQuery query = new XQuery( "fn:seconds-from-duration(xs:duration(\"P1Y2M3DT10H30M911S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("11") ); } /** * Evaluates The "seconds-from-duration" function to evaluate normalization of dayTimeDuration . */ @org.junit.Test public void fnSecondsFromDuration21() { final XQuery query = new XQuery( "fn:seconds-from-duration(xs:dayTimeDuration(\"P21DT10H10M90S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("30") ); } /** * Evaluates The "seconds-from-duration" function involving a "numeric-less-than" operation (lt operator) . */ @org.junit.Test public void fnSecondsFromDuration3() { final XQuery query = new XQuery( "fn:seconds-from-duration(xs:dayTimeDuration(\"P20DT20H20M10S\")) lt fn:seconds-from-duration(xs:dayTimeDuration(\"P03DT02H10M20S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "seconds-from-duration" function involving a "numeric-less-than" operation (le operator) . */ @org.junit.Test public void fnSecondsFromDuration4() { final XQuery query = new XQuery( "fn:seconds-from-duration(xs:dayTimeDuration(\"P21DT10H10M09S\")) le fn:seconds-from-duration(xs:dayTimeDuration(\"P22DT10H09M31S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "seconds-from-duration" function using the empty sequence as an argument. Use count function to avoid empty file. . */ @org.junit.Test public void fnSecondsFromDuration5() { final XQuery query = new XQuery( "fn:count(fn:seconds-from-duration(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "seconds-from-duration" function that returns 1. . */ @org.junit.Test public void fnSecondsFromDuration6() { final XQuery query = new XQuery( "fn:seconds-from-duration(xs:dayTimeDuration(\"P01DT01H01M01S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "seconds-from-duration" function used as arguments to an avg function. . */ @org.junit.Test public void fnSecondsFromDuration7() { final XQuery query = new XQuery( "fn:avg((fn:seconds-from-duration(xs:dayTimeDuration(\"P23DT10H20M30S\")),fn:seconds-from-duration(xs:dayTimeDuration(\"P21DT10H10M32S\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("31") ); } /** * Evaluates The "seconds-from-duration" function as part of a "+" expression. . */ @org.junit.Test public void fnSecondsFromDuration8() { final XQuery query = new XQuery( "fn:seconds-from-duration(xs:dayTimeDuration(\"P21DT10H10M09S\")) + fn:seconds-from-duration(xs:dayTimeDuration(\"P22DT11H30M21S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("30") ); } /** * Evaluates The "seconds-from-duration" function as part of a "-" expression. . */ @org.junit.Test public void fnSecondsFromDuration9() { final XQuery query = new XQuery( "fn:seconds-from-duration(xs:dayTimeDuration(\"P30DT10H20M10S\")) - fn:seconds-from-duration(xs:dayTimeDuration(\"P10DT09H10M02S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("8") ); } /** * Evaluates The "seconds-from-duration" function with the arguments set as follows: $arg = xs:dayTimeDuration(lower bound) . */ @org.junit.Test public void fnSecondsFromDuration1args1() { final XQuery query = new XQuery( "fn:seconds-from-duration(xs:dayTimeDuration(\"P0DT0H0M0S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "seconds-from-duration" function with the arguments set as follows: $arg = xs:dayTimeDuration(mid range) . */ @org.junit.Test public void fnSecondsFromDuration1args2() { final XQuery query = new XQuery( "fn:seconds-from-duration(xs:dayTimeDuration(\"P15DT11H59M59S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("59") ); } /** * Evaluates The "seconds-from-duration" function with the arguments set as follows: $arg = xs:dayTimeDuration(upper bound) . */ @org.junit.Test public void fnSecondsFromDuration1args3() { final XQuery query = new XQuery( "fn:seconds-from-duration(xs:dayTimeDuration(\"P31DT23H59M59S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("59") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnSecondsFromTime.java000066400000000000000000000332661222453003200303060ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the seconds-from-time() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnSecondsFromTime extends QT3TestSet { /** * A test whose essence is: `seconds-from-time()`. . */ @org.junit.Test public void kSecondsFromTimeFunc1() { final XQuery query = new XQuery( "seconds-from-time()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `seconds-from-time((), "Wrong param")`. . */ @org.junit.Test public void kSecondsFromTimeFunc2() { final XQuery query = new XQuery( "seconds-from-time((), \"Wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(seconds-from-time(()))`. . */ @org.junit.Test public void kSecondsFromTimeFunc3() { final XQuery query = new XQuery( "empty(seconds-from-time(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `seconds-from-time(()) instance of xs:decimal?`. . */ @org.junit.Test public void kSecondsFromTimeFunc4() { final XQuery query = new XQuery( "seconds-from-time(()) instance of xs:decimal?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test invoking seconds-from-time(). . */ @org.junit.Test public void kSecondsFromTimeFunc5() { final XQuery query = new XQuery( "seconds-from-time(xs:time(\"23:11:12.43\")) eq 12.43", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "seconds-from-time" function As per example 1 of the F&O specs (for this function) . */ @org.junit.Test public void fnSecondsFromTime1() { final XQuery query = new XQuery( "fn:seconds-from-time(xs:time(\"13:20:10.5\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10.5") ); } /** * Evaluates The "seconds-from-time" function as part of a "*" expression. . */ @org.junit.Test public void fnSecondsFromTime10() { final XQuery query = new XQuery( "fn:seconds-from-time(xs:time(\"02:02:03Z\")) * fn:seconds-from-time(xs:time(\"10:08:09Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "27") ); } /** * Evaluates The "seconds-from-time" function as part of a "div" expression. . */ @org.junit.Test public void fnSecondsFromTime11() { final XQuery query = new XQuery( "fn:seconds-from-time(xs:time(\"22:33:10Z\")) div fn:seconds-from-time(xs:time(\"02:11:02Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5") ); } /** * Evaluates The "seconds-from-time" function as part of a "idiv" expression. . */ @org.junit.Test public void fnSecondsFromTime12() { final XQuery query = new XQuery( "fn:seconds-from-time(xs:time(\"10:12:15Z\")) idiv fn:seconds-from-time(xs:time(\"02:02:03Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5") ); } /** * Evaluates The "seconds-from-time" function as part of a "mod" expression. . */ @org.junit.Test public void fnSecondsFromTime13() { final XQuery query = new XQuery( "fn:seconds-from-time(xs:time(\"10:10:20Z\")) mod fn:seconds-from-time(xs:time(\"03:03:02Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "seconds-from-time" function as part of a "numeric-unary-plus" expression. . */ @org.junit.Test public void fnSecondsFromTime14() { final XQuery query = new XQuery( "+fn:seconds-from-time(xs:time(\"10:00:01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "seconds-from-time" function as part of a "numeric-unary-minus" expression. . */ @org.junit.Test public void fnSecondsFromTime15() { final XQuery query = new XQuery( "-fn:seconds-from-time(xs:time(\"10:10:01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1") ); } /** * Evaluates The "seconds-from-time" function as part of a "numeric-equal" expression (eq operator) . */ @org.junit.Test public void fnSecondsFromTime16() { final XQuery query = new XQuery( "fn:seconds-from-time(xs:time(\"10:02:01Z\")) eq fn:seconds-from-time(xs:time(\"10:02:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "seconds-from-time" function as part of a "numeric-equal" expression (ne operator) . */ @org.junit.Test public void fnSecondsFromTime17() { final XQuery query = new XQuery( "fn:seconds-from-time(xs:time(\"10:00:01Z\")) ne fn:seconds-from-time(xs:time(\"01:01:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "seconds-from-time" function as part of a "numeric-equal" expression (le operator) . */ @org.junit.Test public void fnSecondsFromTime18() { final XQuery query = new XQuery( "fn:seconds-from-time(xs:time(\"10:00:00Z\")) le fn:seconds-from-time(xs:time(\"10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "seconds-from-time" function as part of a "numeric-equal" expression (ge operator) . */ @org.junit.Test public void fnSecondsFromTime19() { final XQuery query = new XQuery( "fn:seconds-from-time(xs:time(\"10:03:01Z\")) ge fn:seconds-from-time(xs:time(\"10:04:02Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "seconds-from-time" function used as part of a numeric less than expression (lt operator) . */ @org.junit.Test public void fnSecondsFromTime2() { final XQuery query = new XQuery( "fn:seconds-from-time(xs:time(\"21:23:04Z\")) lt fn:seconds-from-time(xs:time(\"21:24:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "seconds-from-time" function as part of a numeric greater than operation (gt operator) . */ @org.junit.Test public void fnSecondsFromTime3() { final XQuery query = new XQuery( "fn:seconds-from-time(xs:time(\"01:23:02Z\")) gt fn:seconds-from-time(xs:time(\"01:23:03Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "seconds-from-time" function used as an argument to an avg function. . */ @org.junit.Test public void fnSecondsFromTime4() { final XQuery query = new XQuery( "fn:avg((fn:seconds-from-time(xs:time(\"01:10:20Z\")), fn:seconds-from-time(xs:time(\"01:20:30Z\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "25") ); } /** * Evaluates The "seconds-from-time" function using the empty sequence as an argument. Use count function to avoid empty file. . */ @org.junit.Test public void fnSecondsFromTime5() { final XQuery query = new XQuery( "fn:count(fn:seconds-from-time(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "seconds-from-time" function that returns 0. . */ @org.junit.Test public void fnSecondsFromTime6() { final XQuery query = new XQuery( "fn:hours-from-time(xs:time(\"00:59:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "seconds-from-time" function with the argument set to return 59. . */ @org.junit.Test public void fnSecondsFromTime7() { final XQuery query = new XQuery( "fn:seconds-from-time(xs:time(\"23:20:59Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "59") ); } /** * Evaluates The "seconds-from-time" function as part of a "+" expression. . */ @org.junit.Test public void fnSecondsFromTime8() { final XQuery query = new XQuery( "fn:seconds-from-time(xs:time(\"02:00:00Z\")) + fn:seconds-from-time(xs:time(\"10:00:10Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10") ); } /** * Evaluates The "seconds-from-time" function as part of a "-" expression. . */ @org.junit.Test public void fnSecondsFromTime9() { final XQuery query = new XQuery( "fn:seconds-from-time(xs:time(\"10:10:10Z\")) - fn:seconds-from-time(xs:time(\"09:02:07Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Evaluates The "seconds-from-time" function with the arguments set as follows: $arg = xs:time(lower bound) . */ @org.junit.Test public void fnSecondsFromTime1args1() { final XQuery query = new XQuery( "fn:seconds-from-time(xs:time(\"00:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "seconds-from-time" function with the arguments set as follows: $arg = xs:time(mid range) . */ @org.junit.Test public void fnSecondsFromTime1args2() { final XQuery query = new XQuery( "fn:seconds-from-time(xs:time(\"08:03:35Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "35") ); } /** * Evaluates The "seconds-from-time" function with the arguments set as follows: $arg = xs:time(upper bound) . */ @org.junit.Test public void fnSecondsFromTime1args3() { final XQuery query = new XQuery( "fn:seconds-from-time(xs:time(\"23:59:59Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "59") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnSerialize.java000066400000000000000000000035321222453003200271650ustar00rootroot00000000000000package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the fn:serialize() function introduced in XPath 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnSerialize extends QT3TestSet { /** * serialize test: New suppress-indentation parameter. */ @org.junit.Test public void serializeXml008() { final XQuery query = new XQuery( "\n" + " let $params := \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " return serialize(., $params)\n" + " ", ctx); try { query.context(node(file("fn/serialize/serialize-008-src.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertQuery("matches($result,'\\n\\s+')") && assertQuery("matches($result,'\\n\\s+<p>')") && assertQuery("not(matches($result,'\\n\\s+<code>'))") ) ); } /** * Serialize a function item. */ @org.junit.Test public void serializeXml010() { final XQuery query = new XQuery( "serialize(name#1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("SENR0001") ); } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnStartsWith.java���������������������0000664�0000000�0000000�00000050113�12224530032�0027347�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the starts-with() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnStartsWith extends QT3TestSet { /** * A test whose essence is: `starts-with()`. . */ @org.junit.Test public void kStartsWithFunc1() { final XQuery query = new XQuery( "starts-with()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `starts-with("a string", ())`. . */ @org.junit.Test public void kStartsWithFunc10() { final XQuery query = new XQuery( "starts-with(\"a string\", ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(starts-with("", "a string"))`. . */ @org.junit.Test public void kStartsWithFunc11() { final XQuery query = new XQuery( "not(starts-with(\"\", \"a string\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `starts-with(())`. . */ @org.junit.Test public void kStartsWithFunc2() { final XQuery query = new XQuery( "starts-with(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `starts-with((), (), "http://www.w3.org/2005/xpath-functions/collation/codepoint", "wrong param")`. . */ @org.junit.Test public void kStartsWithFunc3() { final XQuery query = new XQuery( "starts-with((), (), \"http://www.w3.org/2005/xpath-functions/collation/codepoint\", \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `starts-with("a string", "a string", "http://www.example.com/COLLATION/NOT/SUPPORTED")`. . */ @org.junit.Test public void kStartsWithFunc4() { final XQuery query = new XQuery( "starts-with(\"a string\", \"a string\", \"http://www.example.com/COLLATION/NOT/SUPPORTED\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0002") ); } /** * A test whose essence is: `starts-with("foo", "foo", "http://www.w3.org/2005/xpath-functions/collation/codepoint")`. . */ @org.junit.Test public void kStartsWithFunc5() { final XQuery query = new XQuery( "starts-with(\"foo\", \"foo\", \"http://www.w3.org/2005/xpath-functions/collation/codepoint\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `starts-with("foo", "foo")`. . */ @org.junit.Test public void kStartsWithFunc6() { final XQuery query = new XQuery( "starts-with(\"foo\", \"foo\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `starts-with("tattoo", "tat")`. . */ @org.junit.Test public void kStartsWithFunc7() { final XQuery query = new XQuery( "starts-with(\"tattoo\", \"tat\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(starts-with("tattoo", "att"))`. . */ @org.junit.Test public void kStartsWithFunc8() { final XQuery query = new XQuery( "not(starts-with(\"tattoo\", \"att\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `starts-with((), ())`. . */ @org.junit.Test public void kStartsWithFunc9() { final XQuery query = new XQuery( "starts-with((), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Compare two values returned from fn:lower-case(). . */ @org.junit.Test public void k2StartsWithFunc1() { final XQuery query = new XQuery( "let $vA := (\"B STRING\", current-time(), string(\"content\"))[1] treat as xs:string, \n" + " $vB := (\"b string\", current-time(), string(\"content\"))[1] treat as xs:string\n" + " return starts-with(lower-case($vA), lower-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Compare two values returned from fn:upper-case(). . */ @org.junit.Test public void k2StartsWithFunc2() { final XQuery query = new XQuery( "let $vA := (\"B STRING\", current-time(), string(\"content\"))[1] treat as xs:string,\n" + " $vB := (\"b string\", current-time(), string(\"content\"))[1] treat as xs:string\n" + " return starts-with(upper-case($vA), upper-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Compare two non-matching values returned from fn:lower-case(). . */ @org.junit.Test public void k2StartsWithFunc3() { final XQuery query = new XQuery( "let $vA := (\"B STRING\", current-time(), string(\"content\"))[1] treat as xs:string, \n" + " $vB := (\"no match\", current-time(), string(\"content\"))[1] treat as xs:string\n" + " return starts-with(lower-case($vA), lower-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Compare two non-matching values returned from fn:upper-case(). . */ @org.junit.Test public void k2StartsWithFunc4() { final XQuery query = new XQuery( "let $vA := (\"B STRING\", current-time(), string(\"content\"))[1] treat as xs:string,\n" + " $vB := (\"no match\", current-time(), string(\"content\"))[1] treat as xs:string\n" + " return starts-with(upper-case($vA), upper-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Compare two non-matching values returned from fn:lower-case() and fn:upper-case(). . */ @org.junit.Test public void k2StartsWithFunc5() { final XQuery query = new XQuery( "let $vA := (\"B STRING\", current-time(), string(\"content\"))[1] treat as xs:string,\n" + " $vB := (\"b string\", current-time(), string(\"content\"))[1] treat as xs:string\n" + " return starts-with(upper-case($vA), lower-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Compare two non-matching values returned from fn:lower-case() and fn:upper-case(). . */ @org.junit.Test public void k2StartsWithFunc6() { final XQuery query = new XQuery( "let $vA := (\"B STRING\", current-time(), string(\"content\"))[1] treat as xs:string,\n" + " $vB := (\"b string\", current-time(), string(\"content\"))[1] treat as xs:string\n" + " return starts-with(lower-case($vA), upper-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:starts-with with collation and empty string . */ @org.junit.Test public void cbclStartsWith001() { final XQuery query = new XQuery( "\n" + " fn:boolean(fn:starts-with('input', '', 'http://www.w3.org/2005/xpath-functions/collation/codepoint'))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "starts-with" function with the arguments set as follows: $arg1 = "" $arg2 = "" . */ @org.junit.Test public void fnStartsWith1() { final XQuery query = new XQuery( "fn:starts-with(\"\",\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "starts-with" function with the arguments set as follows: $arg1 = " " $arg2 = " AAAAABBBBB" . */ @org.junit.Test public void fnStartsWith10() { final XQuery query = new XQuery( "fn:starts-with(\" \",\"AAAAABBBBB\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "starts-with" function using it as a argument of a fn:not - returns false . */ @org.junit.Test public void fnStartsWith11() { final XQuery query = new XQuery( "fn:not(fn:starts-with(\"A\",\"A\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "starts-with" function using it as a argument of a fn:not - returns true . */ @org.junit.Test public void fnStartsWith12() { final XQuery query = new XQuery( "fn:not(fn:starts-with(\"A\",\"B\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "starts-with" function with the arguments set as follows: $arg1 = xs:string("A") $arg2 = "A" . */ @org.junit.Test public void fnStartsWith13() { final XQuery query = new XQuery( "fn:starts-with(xs:string(\"A\"),\"A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "starts-with" function with the arguments set as follows: $arg1 = "A" $arg2 = xs:string("A") . */ @org.junit.Test public void fnStartsWith14() { final XQuery query = new XQuery( "fn:starts-with(\"A\",xs:string(\"A\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "starts-with" function with the arguments set as follows: $arg1 = "A" $arg2 = "a" . */ @org.junit.Test public void fnStartsWith15() { final XQuery query = new XQuery( "fn:starts-with(\"A\",\"a\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "starts-with" function with the arguments set as follows: $arg1 = "a" $arg2 = "A" . */ @org.junit.Test public void fnStartsWith16() { final XQuery query = new XQuery( "fn:starts-with(\"a\",\"A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "starts-with" function with the arguments set as follows: $arg1 = "" $arg2 = "A Character String" . */ @org.junit.Test public void fnStartsWith2() { final XQuery query = new XQuery( "fn:starts-with(\"\",\"A Character String\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "starts-with" function with the arguments set as follows: $arg1 = "" $arg2 = "A Character String" . */ @org.junit.Test public void fnStartsWith3() { final XQuery query = new XQuery( "fn:starts-with(\"A Character String\",\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "starts-with" function with the arguments set as follows: $arg1 = () $arg2 = "" . */ @org.junit.Test public void fnStartsWith4() { final XQuery query = new XQuery( "fn:starts-with((),\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "starts-with" function with the arguments set as follows: $arg1 = "" $arg2 = () . */ @org.junit.Test public void fnStartsWith5() { final XQuery query = new XQuery( "fn:starts-with(\"\",())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "starts-with" function with the arguments set as follows: $arg1 = "A Character String" $arg2 = () . */ @org.junit.Test public void fnStartsWith6() { final XQuery query = new XQuery( "fn:starts-with(\"A Character String\",())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "starts-with" function with the arguments set as follows: $arg1 = () $arg2 = "A Character String" . */ @org.junit.Test public void fnStartsWith7() { final XQuery query = new XQuery( "fn:starts-with((),\"A Character String\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "starts-with" function with the arguments set as follows: $arg1 = "AAAAABBBBBCCCCC" $arg2 = "BBBBB" . */ @org.junit.Test public void fnStartsWith8() { final XQuery query = new XQuery( "fn:starts-with(\"AAAAABBBBBCCCCC\",\"BBBBB\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "starts-with" function with the arguments set as follows: $arg1 = "AAAAABBBBB" $arg2 = " " . */ @org.junit.Test public void fnStartsWith9() { final XQuery query = new XQuery( "fn:starts-with(\"AAAAABBBBB\",\" \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "starts-with" function with the arguments set as follows: $arg1 = xs:string(lower bound) $arg2 = xs:string(lower bound) . */ @org.junit.Test public void fnStartsWith2args1() { final XQuery query = new XQuery( "fn:starts-with(xs:string(\"This is a characte\"),xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "starts-with" function with the arguments set as follows: $arg1 = xs:string(mid range) $arg2 = xs:string(lower bound) . */ @org.junit.Test public void fnStartsWith2args2() { final XQuery query = new XQuery( "fn:starts-with(xs:string(\"This is a characte\"),xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "starts-with" function with the arguments set as follows: $arg1 = xs:string(upper bound) $arg2 = xs:string(lower bound) . */ @org.junit.Test public void fnStartsWith2args3() { final XQuery query = new XQuery( "fn:starts-with(xs:string(\"This is a characte\"),xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "starts-with" function with the arguments set as follows: $arg1 = xs:string(lower bound) $arg2 = xs:string(mid range) . */ @org.junit.Test public void fnStartsWith2args4() { final XQuery query = new XQuery( "fn:starts-with(xs:string(\"This is a characte\"),xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "starts-with" function with the arguments set as follows: $arg1 = xs:string(lower bound) $arg2 = xs:string(upper bound) . */ @org.junit.Test public void fnStartsWith2args5() { final XQuery query = new XQuery( "fn:starts-with(xs:string(\"This is a characte\"),xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnStaticBaseUri.java������������������0000664�0000000�0000000�00000023400�12224530032�0027734�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the static-base-uri() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnStaticBaseUri extends QT3TestSet { /** * A test whose essence is: `static-base-uri(.)`. . */ @org.junit.Test public void kStaticBaseURIFunc1() { final XQuery query = new XQuery( "static-base-uri(.)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `static-base-uri(1, 2)`. . */ @org.junit.Test public void kStaticBaseURIFunc2() { final XQuery query = new XQuery( "static-base-uri(1, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `if(static-base-uri()) then true() else true()`. . */ @org.junit.Test public void kStaticBaseURIFunc3() { final XQuery query = new XQuery( "if(static-base-uri()) then true() else true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of fn;static-base-uri function with incorrect arity. . */ @org.junit.Test public void fnStaticBase1() { final XQuery query = new XQuery( "fn:static-base-uri(\"A argument\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Evaluation of fn:static-base-uri function using Used as argument to fn:concat function. Uses fn:string . . */ @org.junit.Test public void fnStaticBase10() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com\"; fn:concat(fn:string(fn:static-base-uri()),\"another string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.comanother string") ); } /** * Evaluation of fn:static-base-uri function using Used as argument to fn:string-join function. Uses fn:string . . */ @org.junit.Test public void fnStaticBase11() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com\"; fn:string-join((fn:string(fn:static-base-uri()),\"another string\"),\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.comanother string") ); } /** * Evaluation of fn:static-base-uri function using Used as argument to fn:string-length function. Uses fn:string . . */ @org.junit.Test public void fnStaticBase12() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com\"; fn:string-length(fn:string(fn:static-base-uri()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "22") ); } /** * Evaluation of fn:static-base-uri function using Used as argument to fn:substring-before function. Uses fn:string . . */ @org.junit.Test public void fnStaticBase13() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com\"; fn:substring-before(fn:string(fn:static-base-uri()),\":\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http") ); } /** * Evaluation of fn:static-base-uri function using Used as argument to fn:substring-after function. Uses fn:string . . */ @org.junit.Test public void fnStaticBase14() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com\"; fn:substring-after(fn:string(fn:static-base-uri()),\":\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "//www.example.com") ); } /** * Rely on test case environment for the base URI (this should work under XPath, but depends on the test driver) . */ @org.junit.Test public void fnStaticBase15() { final XQuery query = new XQuery( "static-base-uri()", ctx); try { query.baseURI("http://www.example.com"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com") ); } /** * Evaluation of fn:static-base-uri function using "ftp". Uses fn:string . . */ @org.junit.Test public void fnStaticBase2() { final XQuery query = new XQuery( "declare base-uri \"ftp://ftp.is.co.za/rfc/somefile.txt\"; fn:string(fn:static-base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ftp://ftp.is.co.za/rfc/somefile.txt") ); } /** * Evaluation of fn:static-base-uri function using "mailto". Uses fn:string . . */ @org.junit.Test public void fnStaticBase3() { final XQuery query = new XQuery( "declare base-uri \"mailto:John.Doe@example.com\"; fn:string(fn:static-base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "mailto:John.Doe@example.com") ); } /** * Evaluation of fn:static-base-uri function using "news". Uses fn:string . . */ @org.junit.Test public void fnStaticBase4() { final XQuery query = new XQuery( "declare base-uri \"news:comp.infosystems.www.servers.unix\"; fn:string(fn:static-base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "news:comp.infosystems.www.servers.unix") ); } /** * Evaluation of fn:static-base-uri function using "telnet". Uses fn:string . . */ @org.junit.Test public void fnStaticBase5() { final XQuery query = new XQuery( "declare base-uri \"telnet://192.0.2.16:80/\"; fn:string(fn:static-base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "telnet://192.0.2.16:80/") ); } /** * Evaluation of fn:static-base-uri function using "tel". Uses fn:string . . */ @org.junit.Test public void fnStaticBase6() { final XQuery query = new XQuery( "declare base-uri \"tel:+1-816-555-1212\"; fn:string(fn:static-base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "tel:+1-816-555-1212") ); } /** * Evaluation of fn:static-base-uri function using "ldap" scheme. Uses fn:string . . */ @org.junit.Test public void fnStaticBase7() { final XQuery query = new XQuery( "declare base-uri \"urn:oasis:names:specification:docbook:dtd:xml:4.1.2\"; fn:string(fn:static-base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "urn:oasis:names:specification:docbook:dtd:xml:4.1.2") ); } /** * Evaluation of fn:static-base-uri function using Used as argument to upper-case function. Uses fn:string . . */ @org.junit.Test public void fnStaticBase8() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com\"; fn:upper-case(fn:string(fn:static-base-uri()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "HTTP://WWW.EXAMPLE.COM") ); } /** * Evaluation of fn:static-base-uri function using Used as argument to lower-case function. Uses fn:string . . */ @org.junit.Test public void fnStaticBase9() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com\"; fn:lower-case(fn:string(fn:static-base-uri()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com") ); } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnString.java�������������������������0000664�0000000�0000000�00000100755�12224530032�0026511�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests the fn:string() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnString extends QT3TestSet { /** * K-StringFunc-1 `string(1, 2)`. . */ @org.junit.Test public void kStringFunc1() { final XQuery query = new XQuery( "string(1, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * K-StringFunc-2 ensures that no arguments isn't flagged as invalid. . */ @org.junit.Test public void kStringFunc2() { final XQuery query = new XQuery( "if(true()) then true() else string()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPDY0002") ) ); } /** * K-StringFunc-3 `string(1) eq "1"`. . */ @org.junit.Test public void kStringFunc3() { final XQuery query = new XQuery( "string(1) eq \"1\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * K-StringFunc-4 `string(()) eq ""`. . */ @org.junit.Test public void kStringFunc4() { final XQuery query = new XQuery( "string(()) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * K-StringFunc-5 xs:string. . */ @org.junit.Test public void kStringFunc5() { final XQuery query = new XQuery( "string-length(string(xs:string(current-time()))) gt 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * K-StringFunc-6 `string( (1, 2) )`. . */ @org.junit.Test public void kStringFunc6() { final XQuery query = new XQuery( "string( (1, 2) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * argument and no context item defined.. */ @org.junit.Test public void fnString1() { final XQuery query = new XQuery( "fn:string()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * argument set to the empty sequence. Use fn:count to avoid empty file.. */ @org.junit.Test public void fnString2() { final XQuery query = new XQuery( "fn:string(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * Evaluation of string() applied to a function item. */ @org.junit.Test public void fnString23() { final XQuery query = new XQuery( "string(string#1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOTY0014") ); } /** * Get the string-value of an element in a namespace.. */ @org.junit.Test public void fnString24() { final XQuery query = new XQuery( "string((//*:Open)[1])", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2000-03-21:07:41:34-05:00") ); } /** * Get the string-value of an attribute in a namespace.. */ @org.junit.Test public void fnString25() { final XQuery query = new XQuery( "string((//*:Start)[1]/@*)", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "USD") ); } /** * Get the string-value of the xml:lang attribute.. */ @org.junit.Test public void fnString26() { final XQuery query = new XQuery( "string((//@xml:*)[1])", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "en") ); } /** * Get the string-value of a processing-instruction node.. */ @org.junit.Test public void fnString28() { final XQuery query = new XQuery( "string((//processing-instruction())[1])", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "href=\"none\"") ); } /** * Get the string value of an element with children.. */ @org.junit.Test public void fnString29() { final XQuery query = new XQuery( "normalize-space(string((//*:Price)[1]))", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"3.00 10.00 5\"") ); } /** * argument set to "." and no context node set.. */ @org.junit.Test public void fnString3() { final XQuery query = new XQuery( "fn:string(.)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Get the string value of a comment node. */ @org.junit.Test public void fnString30() { final XQuery query = new XQuery( "string((//comment())[1])", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("contains($result, \"______________________________________________________\")") ); } /** * Get the string value of a text node. */ @org.junit.Test public void fnString31() { final XQuery query = new XQuery( "string((//text())[normalize-space(.)][1])", ctx); try { query.namespace("ma", "http://www.example.com/AuctionWatch"); query.namespace("xlink", "http://www.w3.org/1999/xlink"); query.namespace("anyzone", "http://www.example.com/auctioneers#anyzone"); query.namespace("eachbay", "http://www.example.com/auctioneers#eachbay"); query.namespace("yabadoo", "http://www.example.com/auctioneers#yabadoo"); query.context(node(file("docs/auction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"2000-03-21:07:41:34-05:00\"") ); } /** * string() applied to a date. */ @org.junit.Test public void fnString4() { final XQuery query = new XQuery( "string(current-date())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(1) ); } /** * string() applied to a time. */ @org.junit.Test public void fnString5() { final XQuery query = new XQuery( "string(xs:time(\"24:00:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"00:00:00\"") ); } /** * string() applied to a dateTime. */ @org.junit.Test public void fnString6() { final XQuery query = new XQuery( "string(dateTime(xs:date(\"2011-06-29\"), xs:time(\"24:00:00\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"2011-06-29T00:00:00\"") ); } /** * string() applied to a duration. */ @org.junit.Test public void fnString7() { final XQuery query = new XQuery( "string(xs:duration(\"P24M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"P2Y\"") ); } /** * string() applied to a QName. */ @org.junit.Test public void fnString8() { final XQuery query = new XQuery( "string(QName(\"http://www.w3.org/\", \"test:example\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"test:example\"") ); } /** * string() with no arguments applied to a double. */ @org.junit.Test public void fnString9() { final XQuery query = new XQuery( "xs:double('-INF')[string() = '-INF']", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(1) ); } /** * stringdbl1args-1 The "string" function with the arguments set as follows: $arg = xs:double(lower bound) . */ @org.junit.Test public void fnStringdbl1args1() { final XQuery query = new XQuery( "fn:string(xs:double(\"-1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.7976931348623157E308") ); } /** * stringdbl1args-2 The "string" function with the arguments set as follows: $arg = xs:double(mid range) . */ @org.junit.Test public void fnStringdbl1args2() { final XQuery query = new XQuery( "fn:string(xs:double(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * stringdbl1args-3 The "string" function with the arguments set as follows: $arg = xs:double(upper bound) . */ @org.junit.Test public void fnStringdbl1args3() { final XQuery query = new XQuery( "fn:string(xs:double(\"1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.7976931348623157E308") ); } /** * stringdec1args-1 The "string" function with the arguments set as follows: $arg = xs:decimal(lower bound) . */ @org.junit.Test public void fnStringdec1args1() { final XQuery query = new XQuery( "fn:string(xs:decimal(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999") ); } /** * stringdec1args-2 The "string" function with the arguments set as follows: $arg = xs:decimal(mid range) . */ @org.junit.Test public void fnStringdec1args2() { final XQuery query = new XQuery( "fn:string(xs:decimal(\"617375191608514839\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "617375191608514839") ); } /** * stringdec1args-3 The "string" function with the arguments set as follows: $arg = xs:decimal(upper bound) . */ @org.junit.Test public void fnStringdec1args3() { final XQuery query = new XQuery( "fn:string(xs:decimal(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "999999999999999999") ); } /** * stringflt1args-1 The "string" function with the arguments set as follows: $arg = xs:float(lower bound) . */ @org.junit.Test public void fnStringflt1args1() { final XQuery query = new XQuery( "fn:string(xs:float(\"-3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-3.4028235E38") ); } /** * stringflt1args-2 The "string" function with the arguments set as follows: $arg = xs:float(mid range) . */ @org.junit.Test public void fnStringflt1args2() { final XQuery query = new XQuery( "fn:string(xs:float(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * stringflt1args-3 The "string" function with the arguments set as follows: $arg = xs:float(upper bound) . */ @org.junit.Test public void fnStringflt1args3() { final XQuery query = new XQuery( "fn:string(xs:float(\"3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3.4028235E38") ); } /** * stringint1args-1 The "string" function with the arguments set as follows: $arg = xs:int(lower bound) . */ @org.junit.Test public void fnStringint1args1() { final XQuery query = new XQuery( "fn:string(xs:int(\"-2147483648\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-2147483648") ); } /** * stringint1args-2 The "string" function with the arguments set as follows: $arg = xs:int(mid range) . */ @org.junit.Test public void fnStringint1args2() { final XQuery query = new XQuery( "fn:string(xs:int(\"-1873914410\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1873914410") ); } /** * stringint1args-3 The "string" function with the arguments set as follows: $arg = xs:int(upper bound) . */ @org.junit.Test public void fnStringint1args3() { final XQuery query = new XQuery( "fn:string(xs:int(\"2147483647\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2147483647") ); } /** * stringintg1args-1 The "string" function with the arguments set as follows: $arg = xs:integer(lower bound) . */ @org.junit.Test public void fnStringintg1args1() { final XQuery query = new XQuery( "fn:string(xs:integer(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999") ); } /** * stringintg1args-2 The "string" function with the arguments set as follows: $arg = xs:integer(mid range) . */ @org.junit.Test public void fnStringintg1args2() { final XQuery query = new XQuery( "fn:string(xs:integer(\"830993497117024304\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "830993497117024304") ); } /** * stringintg1args-3 The "string" function with the arguments set as follows: $arg = xs:integer(upper bound) . */ @org.junit.Test public void fnStringintg1args3() { final XQuery query = new XQuery( "fn:string(xs:integer(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "999999999999999999") ); } /** * stringlng1args-1 The "string" function with the arguments set as follows: $arg = xs:long(lower bound) . */ @org.junit.Test public void fnStringlng1args1() { final XQuery query = new XQuery( "fn:string(xs:long(\"-92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-92233720368547758") ); } /** * stringlng1args-2 The "string" function with the arguments set as follows: $arg = xs:long(mid range) . */ @org.junit.Test public void fnStringlng1args2() { final XQuery query = new XQuery( "fn:string(xs:long(\"-47175562203048468\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-47175562203048468") ); } /** * stringlng1args-3 The "string" function with the arguments set as follows: $arg = xs:long(upper bound) . */ @org.junit.Test public void fnStringlng1args3() { final XQuery query = new XQuery( "fn:string(xs:long(\"92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "92233720368547758") ); } /** * stringnint1args-1 The "string" function with the arguments set as follows: $arg = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnStringnint1args1() { final XQuery query = new XQuery( "fn:string(xs:negativeInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999") ); } /** * stringnint1args-2 The "string" function with the arguments set as follows: $arg = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnStringnint1args2() { final XQuery query = new XQuery( "fn:string(xs:negativeInteger(\"-297014075999096793\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-297014075999096793") ); } /** * stringnint1args-3 The "string" function with the arguments set as follows: $arg = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnStringnint1args3() { final XQuery query = new XQuery( "fn:string(xs:negativeInteger(\"-1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1") ); } /** * stringnni1args-1 The "string" function with the arguments set as follows: $arg = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnStringnni1args1() { final XQuery query = new XQuery( "fn:string(xs:nonNegativeInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * stringnni1args-2 The "string" function with the arguments set as follows: $arg = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnStringnni1args2() { final XQuery query = new XQuery( "fn:string(xs:nonNegativeInteger(\"303884545991464527\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "303884545991464527") ); } /** * stringnni1args-3 The "string" function with the arguments set as follows: $arg = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnStringnni1args3() { final XQuery query = new XQuery( "fn:string(xs:nonNegativeInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "999999999999999999") ); } /** * stringnpi1args-1 The "string" function with the arguments set as follows: $arg = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnStringnpi1args1() { final XQuery query = new XQuery( "fn:string(xs:nonPositiveInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999") ); } /** * stringnpi1args-2 The "string" function with the arguments set as follows: $arg = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnStringnpi1args2() { final XQuery query = new XQuery( "fn:string(xs:nonPositiveInteger(\"-475688437271870490\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-475688437271870490") ); } /** * stringnpi1args-3 The "string" function with the arguments set as follows: $arg = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnStringnpi1args3() { final XQuery query = new XQuery( "fn:string(xs:nonPositiveInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * stringpint1args-1 The "string" function with the arguments set as follows: $arg = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnStringpint1args1() { final XQuery query = new XQuery( "fn:string(xs:positiveInteger(\"1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * stringpint1args-2 The "string" function with the arguments set as follows: $arg = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnStringpint1args2() { final XQuery query = new XQuery( "fn:string(xs:positiveInteger(\"52704602390610033\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "52704602390610033") ); } /** * stringpint1args-3 The "string" function with the arguments set as follows: $arg = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnStringpint1args3() { final XQuery query = new XQuery( "fn:string(xs:positiveInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "999999999999999999") ); } /** * stringsht1args-1 The "string" function with the arguments set as follows: $arg = xs:short(lower bound) . */ @org.junit.Test public void fnStringsht1args1() { final XQuery query = new XQuery( "fn:string(xs:short(\"-32768\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-32768") ); } /** * stringsht1args-2 The "string" function with the arguments set as follows: $arg = xs:short(mid range) . */ @org.junit.Test public void fnStringsht1args2() { final XQuery query = new XQuery( "fn:string(xs:short(\"-5324\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-5324") ); } /** * stringsht1args-3 The "string" function with the arguments set as follows: $arg = xs:short(upper bound) . */ @org.junit.Test public void fnStringsht1args3() { final XQuery query = new XQuery( "fn:string(xs:short(\"32767\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "32767") ); } /** * stringulng1args-1 The "string" function with the arguments set as follows: $arg = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnStringulng1args1() { final XQuery query = new XQuery( "fn:string(xs:unsignedLong(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * stringulng1args-2 The "string" function with the arguments set as follows: $arg = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnStringulng1args2() { final XQuery query = new XQuery( "fn:string(xs:unsignedLong(\"130747108607674654\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "130747108607674654") ); } /** * stringulng1args-3 The "string" function with the arguments set as follows: $arg = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnStringulng1args3() { final XQuery query = new XQuery( "fn:string(xs:unsignedLong(\"184467440737095516\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "184467440737095516") ); } /** * stringusht1args-1 The "string" function with the arguments set as follows: $arg = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnStringusht1args1() { final XQuery query = new XQuery( "fn:string(xs:unsignedShort(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * stringusht1args-2 The "string" function with the arguments set as follows: $arg = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnStringusht1args2() { final XQuery query = new XQuery( "fn:string(xs:unsignedShort(\"44633\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "44633") ); } /** * stringusht1args-3 The "string" function with the arguments set as follows: $arg = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnStringusht1args3() { final XQuery query = new XQuery( "fn:string(xs:unsignedShort(\"65535\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "65535") ); } } �������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnStringJoin.java���������������������0000664�0000000�0000000�00000051167�12224530032�0027333�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the string-join() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnStringJoin extends QT3TestSet { /** * A test whose essence is: `string-join("a string")`. . */ @org.junit.Test public void kStringJoinFunc1() { xquery10(); final XQuery query = new XQuery( "string-join(\"a string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `string-join("a string")`. Allowed in 3.0. */ @org.junit.Test public void kStringJoinFunc1a() { final XQuery query = new XQuery( "string-join(\"a string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a string") ); } /** * A test whose essence is: `string-join("a string", "a string", "wrong param")`. . */ @org.junit.Test public void kStringJoinFunc2() { final XQuery query = new XQuery( "string-join(\"a string\", \"a string\", \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `string-join(('Now', 'is', 'the', 'time', '...'), ' ') eq "Now is the time ..."`. . */ @org.junit.Test public void kStringJoinFunc3() { final XQuery query = new XQuery( "string-join(('Now', 'is', 'the', 'time', '...'), ' ') eq \"Now is the time ...\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string-join(("abc", "def"), "") eq "abcdef"`. . */ @org.junit.Test public void kStringJoinFunc4() { final XQuery query = new XQuery( "string-join((\"abc\", \"def\"), \"\") eq \"abcdef\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string-join(('Blow, ', 'blow, ', 'thou ', 'winter ', 'wind!'), '') eq "Blow, blow, thou winter wind!"`. . */ @org.junit.Test public void kStringJoinFunc5() { final XQuery query = new XQuery( "string-join(('Blow, ', 'blow, ', 'thou ', 'winter ', 'wind!'), '') eq \"Blow, blow, thou winter wind!\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string-join((), 'separator') eq ""`. . */ @org.junit.Test public void kStringJoinFunc6() { final XQuery query = new XQuery( "string-join((), 'separator') eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string-join("a string", ())`. . */ @org.junit.Test public void kStringJoinFunc7() { final XQuery query = new XQuery( "string-join(\"a string\", ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test boolean fn:string-join on various cases . */ @org.junit.Test public void cbclFnStringJoin001() { final XQuery query = new XQuery( "\n" + " declare function local:repeat($count as xs:integer, $arg as xs:string) as xs:string* { if ($count le 0) then \"\" else for $x in 1 to $count return $arg };\n" + " string-join( for $x in 0 to 4 return local:repeat($x, 'a') , ' ') and string-join( for $x in 0 to 4 return local:repeat($x, 'a') , '')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "string-join" function as per example 1 for this frunction in F&O sepecs. . */ @org.junit.Test public void fnStringJoin1() { final XQuery query = new XQuery( "fn:string-join(('Now', 'is', 'the', 'time', '...'), ' ')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Now is the time ...") ); } /** * Evaluates The "string-join" function with the arguments set as follows: $arg1 = (" ") $arg2 = " AAAAABBBBB". Use of count to avoid empty file . */ @org.junit.Test public void fnStringJoin10() { final XQuery query = new XQuery( "fn:count(fn:string-join((\" \"),\"AAAAABBBBB\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "string-join" function using it as a argument of a fn:not - returns true . */ @org.junit.Test public void fnStringJoin11() { final XQuery query = new XQuery( "fn:not(fn:string-join((),\"A\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "string-join" function using it as a argument of a fn:not - returns true . */ @org.junit.Test public void fnStringJoin12() { final XQuery query = new XQuery( "fn:not(fn:string-join((\"A\"),\"B\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "string-join" function with the arguments set as follows: $arg1 = xs:string("A") $arg2 = "A" . */ @org.junit.Test public void fnStringJoin13() { final XQuery query = new XQuery( "fn:string-join((xs:string(\"A\")),\"A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "A") ); } /** * Evaluates The "string-join" function with the arguments set as follows: $arg1 = "A" $arg2 = xs:string("A") . */ @org.junit.Test public void fnStringJoin14() { final XQuery query = new XQuery( "fn:string-join((\"A\"),xs:string(\"A\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "A") ); } /** * Evaluates The "string-join" function with the arguments set as follows: $arg1 = "A" $arg2 = "a" . */ @org.junit.Test public void fnStringJoin15() { final XQuery query = new XQuery( "fn:string-join((\"A\"),\"a\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "A") ); } /** * Evaluates The "string-join" function with the arguments set as follows: $arg1 = "a" $arg2 = "A" . */ @org.junit.Test public void fnStringJoin16() { final XQuery query = new XQuery( "fn:string-join((\"a\"),\"A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a") ); } /** * Evaluates The "string-join" function with the arguments set as follows: $arg1 = "string-join" $arg2 = "string-join" . */ @org.junit.Test public void fnStringJoin17() { final XQuery query = new XQuery( "fn:string-join(\"string-join\",\"string-join\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "string-join") ); } /** * Evaluates The "string-join" function with the arguments set as follows: $arg1 = "string-joinstring-join" $arg2 = "string-join" . */ @org.junit.Test public void fnStringJoin18() { final XQuery query = new XQuery( "fn:string-join((\"string-joinstring-join\"),\"string-join\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "string-joinstring-join") ); } /** * Evaluates The "string-join" function with the arguments set as follows: $arg1 = "****" $arg2 = "***" . */ @org.junit.Test public void fnStringJoin19() { final XQuery query = new XQuery( "fn:string-join(\"****\",\"***\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "****") ); } /** * Evaluates The "string-join" function as per example 2 for this function in the F&O specs. . */ @org.junit.Test public void fnStringJoin2() { final XQuery query = new XQuery( "fn:string-join(('Blow, ', 'blow, ', 'thou ', 'winter ', 'wind!'), '')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Blow, blow, thou winter wind!") ); } /** * Evaluates The "string-join" function with the arguments set as follows: $arg1 = "12345" $arg2 = "1234" . */ @org.junit.Test public void fnStringJoin20() { final XQuery query = new XQuery( "fn:string-join(\"12345\",\"1234\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12345") ); } /** * Evaluates The "string-join" function with the arguments set as follows: $arg1 = "string-join $arg2 = "nioj-gnirts ("string-join" backwards) . */ @org.junit.Test public void fnStringJoin21() { final XQuery query = new XQuery( "fn:string-join(\"string-join\",\"nioj-gnirts\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "string-join") ); } /** * Default second argument is zero-length string in 3.0 . */ @org.junit.Test public void fnStringJoin22() { final XQuery query = new XQuery( "fn:string-join((\"1\", \"2\", \"3\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "123") ); } /** * Default second argument is zero-length string in 3.0 . */ @org.junit.Test public void fnStringJoin23() { final XQuery query = new XQuery( "\n" + " let $e := <e><a>1</a><b>2</b><c>3</c></e>\n" + " return fn:string-join($e/*)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "123") ); } /** * Default second argument is zero-length string in 3.0 . */ @org.junit.Test public void fnStringJoin24() { final XQuery query = new XQuery( "\n" + " let $e := <e><a>1</a><b></b><c>3</c></e>\n" + " return fn:string-join($e/*)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "13") ); } /** * Default second argument is zero-length string in 3.0 . */ @org.junit.Test public void fnStringJoin25() { final XQuery query = new XQuery( "\n" + " let $e := <e><a>1</a><b></b><c>3</c></e>\n" + " return fn:string-join($e/d)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * Default second argument is zero-length string in 3.0 . */ @org.junit.Test public void fnStringJoin26() { final XQuery query = new XQuery( "\n" + " fn:string-join((1 to 9)!string())\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "123456789") ); } /** * Evaluates The "string-join" function as per example 3 for this function in the F&O specs. Use of fn:count to avoid empty file. . */ @org.junit.Test public void fnStringJoin3() { final XQuery query = new XQuery( "fn:count(fn:string-join((), 'separator'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "string-join" function with the arguments set as follows: $arg1 = () $arg2 = "" . */ @org.junit.Test public void fnStringJoin4() { final XQuery query = new XQuery( "fn:count(fn:string-join((),\"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "string-join" function with the arguments set as follows: $arg1 = "" $arg2 = "" . */ @org.junit.Test public void fnStringJoin5() { final XQuery query = new XQuery( "fn:count(fn:string-join(\"\",\"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "string-join" function with the arguments set as follows: $arg1 = "" $arg2 = "A Character String". . */ @org.junit.Test public void fnStringJoin6() { final XQuery query = new XQuery( "fn:count(fn:string-join(\"\",\"A Character String\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "string-join" function with the arguments set as follows: $arg1 = () $arg2 = "A Character String" . */ @org.junit.Test public void fnStringJoin7() { final XQuery query = new XQuery( "fn:count(fn:string-join((),\"A Character String\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "string-join" function with the arguments set as follows: $arg1 = "AAAAABBBBBCCCCC" $arg2 = "BBBBB" . */ @org.junit.Test public void fnStringJoin8() { final XQuery query = new XQuery( "fn:string-join((\"AAAAABBBBBCCCCC\"),\"BBBBB\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "AAAAABBBBBCCCCC") ); } /** * Evaluates The "string-join" function with the arguments set as follows: $arg1 = ("AAAAABBBBB") $arg2 = " " . */ @org.junit.Test public void fnStringJoin9() { final XQuery query = new XQuery( "fn:string-join((\"AAAAABBBBB\"),\" \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "AAAAABBBBB") ); } /** * Evaluates The "string-join" function with the arguments set as follows: $arg1 = xs:string(lower bound) $arg2 = xs:string(lower bound) . */ @org.junit.Test public void fnStringJoin2args1() { final XQuery query = new XQuery( "fn:string-join(xs:string(\"This is a characte\"),xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "This is a characte") ); } /** * Evaluates The "string-join" function with the arguments set as follows: $arg1 = xs:string(mid range) $arg2 = xs:string(lower bound) . */ @org.junit.Test public void fnStringJoin2args2() { final XQuery query = new XQuery( "fn:string-join(xs:string(\"This is a characte\"),xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "This is a characte") ); } /** * Evaluates The "string-join" function with the arguments set as follows: $arg1 = xs:string(upper bound) $arg2 = xs:string(lower bound) . */ @org.junit.Test public void fnStringJoin2args3() { final XQuery query = new XQuery( "fn:string-join(xs:string(\"This is a characte\"),xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "This is a characte") ); } /** * Evaluates The "string-join" function with the arguments set as follows: $arg1 = xs:string(lower bound) $arg2 = xs:string(mid range) . */ @org.junit.Test public void fnStringJoin2args4() { final XQuery query = new XQuery( "fn:string-join(xs:string(\"This is a characte\"),xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "This is a characte") ); } /** * Evaluates The "string-join" function with the arguments set as follows: $arg1 = xs:string(lower bound) $arg2 = xs:string(upper bound) . */ @org.junit.Test public void fnStringJoin2args5() { final XQuery query = new XQuery( "fn:string-join(xs:string(\"This is a characte\"),xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "This is a characte") ); } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnStringLength.java�������������������0000664�0000000�0000000�00000035465�12224530032�0027660�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the string-length() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnStringLength extends QT3TestSet { /** * A test whose essence is: `string-length("a string", "wrong param")`.. */ @org.junit.Test public void kStringLengthFunc1() { final XQuery query = new XQuery( "string-length(\"a string\", \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `string-length("ebv") eq 3`.. */ @org.junit.Test public void kStringLengthFunc2() { final XQuery query = new XQuery( "string-length(\"ebv\") eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string-length("ebv") instance of xs:integer`.. */ @org.junit.Test public void kStringLengthFunc3() { final XQuery query = new XQuery( "string-length(\"ebv\") instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string-length(()) eq 0`.. */ @org.junit.Test public void kStringLengthFunc4() { final XQuery query = new XQuery( "string-length(()) eq 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string-length("") eq 0`.. */ @org.junit.Test public void kStringLengthFunc5() { final XQuery query = new XQuery( "string-length(\"\") eq 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string-length(()) instance of xs:integer`.. */ @org.junit.Test public void kStringLengthFunc6() { final XQuery query = new XQuery( "string-length(()) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `if(false()) then string-length() else true()`.. */ @org.junit.Test public void kStringLengthFunc7() { final XQuery query = new XQuery( "if(false()) then string-length() else true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPDY0002") ) ); } /** * A test whose essence is: `string-length("Harp not on that string, madam; that is past.") eq 45`.. */ @org.junit.Test public void kStringLengthFunc8() { final XQuery query = new XQuery( "string-length(\"Harp not on that string, madam; that is past.\") eq 45", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of string-length function as per example 1 (for this function) from the F&O specs. . */ @org.junit.Test public void fnStringLength1() { final XQuery query = new XQuery( "fn:string-length(\"Harp not on that string, madam; that is past.\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("45") ); } /** * Evaluation of string-length function with argument set to "*****" . */ @org.junit.Test public void fnStringLength10() { final XQuery query = new XQuery( "fn:string-length(\"*****\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** * Evaluation of string-length function as part of an addition operation . */ @org.junit.Test public void fnStringLength11() { final XQuery query = new XQuery( "fn:string-length(\"zzzzz\") + fn:string-length(\"zzzzz\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Evaluation of string-length function as an argument to the "fn:boolean" function . */ @org.junit.Test public void fnStringLength12() { final XQuery query = new XQuery( "fn:boolean(fn:string-length(\"abcde\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of string-length function as an argument to the "fn:concat" function . */ @org.junit.Test public void fnStringLength13() { final XQuery query = new XQuery( "fn:concat(fn:string-length(\"abcde\"), fn:string-length(\"fghi\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"54\"") ); } /** * Evaluation of string-length function as an argument to the "fn:not" function . */ @org.junit.Test public void fnStringLength14() { final XQuery query = new XQuery( "fn:not(fn:string-length(\"abcde\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of string-length function with argument set to "%$#@!" . */ @org.junit.Test public void fnStringLength15() { final XQuery query = new XQuery( "fn:string-length(\"%$#@!\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** * Evaluation of string-length function with argument set to "string-length" . */ @org.junit.Test public void fnStringLength16() { final XQuery query = new XQuery( "fn:string-length(\"string-length\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("13") ); } /** * Evaluation of string-length function as part of a boolean expression . */ @org.junit.Test public void fnStringLength17() { final XQuery query = new XQuery( "fn:string-length(\"abc\") and fn:string-length(\"abc\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of string-length function with no argument and no context item defined. . */ @org.junit.Test public void fnStringLength18() { final XQuery query = new XQuery( "fn:string-length()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Evaluation of string-length function with an argument that is a sequence of more than one item . */ @org.junit.Test public void fnStringLength19() { final XQuery query = new XQuery( "fn:string-length(.//employee/@name )", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluation of string-length function using the empty sequence . */ @org.junit.Test public void fnStringLength2() { final XQuery query = new XQuery( "fn:string-length(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of string-length function with non-BMP characters.. */ @org.junit.Test public void fnStringLength20() { final XQuery query = new XQuery( "string-length(\"ð€‚\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluation of string-length applied to a function item.. */ @org.junit.Test public void fnStringLength21() { final XQuery query = new XQuery( "string-length(string-length#1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOTY0013") ); } /** * Evaluation of string-length function that uses only numbers as part of argument . */ @org.junit.Test public void fnStringLength3() { final XQuery query = new XQuery( "fn:string-length(\"12345\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** * Evaluation of string-length function that uses both numbers and letters as part of argument . */ @org.junit.Test public void fnStringLength4() { final XQuery query = new XQuery( "fn:string-length(\"12345abcd\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("9") ); } /** * Evaluation of string-length function that uses only upper case letters as part of argument . */ @org.junit.Test public void fnStringLength5() { final XQuery query = new XQuery( "fn:string-length(\"ABCD\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("4") ); } /** * Evaluation of string-length function that uses only lower case letters as part of argument . */ @org.junit.Test public void fnStringLength6() { final XQuery query = new XQuery( "fn:string-length(\"abcde\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** * Evaluation of string-length function that uses both upper and lower case letters as part of argument . */ @org.junit.Test public void fnStringLength7() { final XQuery query = new XQuery( "fn:string-length(\"ABCDEabcde\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Evaluation of string-length function that uses the empty string as part of argument . */ @org.junit.Test public void fnStringLength8() { final XQuery query = new XQuery( "fn:string-length(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of string-length function that uses the "string" as part of argument . */ @org.junit.Test public void fnStringLength9() { final XQuery query = new XQuery( "fn:string-length(fn:string(\"AbcDH\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** * Evaluates The "string-length" function with the arguments set as follows: $arg = xs:string(lower bound) . */ @org.junit.Test public void fnStringLength1args1() { final XQuery query = new XQuery( "fn:string-length(xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("18") ); } /** * Evaluates The "string-length" function with the arguments set as follows: $arg = xs:string(mid range) . */ @org.junit.Test public void fnStringLength1args2() { final XQuery query = new XQuery( "fn:string-length(xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("18") ); } /** * Evaluates The "string-length" function with the arguments set as follows: $arg = xs:string(upper bound) . */ @org.junit.Test public void fnStringLength1args3() { final XQuery query = new XQuery( "fn:string-length(xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("18") ); } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnStringToCodepoints.java�������������0000664�0000000�0000000�00000054240�12224530032�0031041�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** . * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnStringToCodepoints extends QT3TestSet { /** * * Purpose: A test whose essence is: `string-to-codepoints()`. * . */ @org.junit.Test public void kStringToCodepointFunc1() { final XQuery query = new XQuery( "string-to-codepoints()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * * Purpose: A test whose essence is: `deep-equal(string-to-codepoints("eee"), (101, 101, 101))`. * . */ @org.junit.Test public void kStringToCodepointFunc10() { final XQuery query = new XQuery( "deep-equal(string-to-codepoints(\"eee\"), (101, 101, 101))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Purpose: A test whose essence is: `string-join(for $code in string-to-codepoints("example.com/") return string($code), "") eq "10112097109112108101469911110947"`. * . */ @org.junit.Test public void kStringToCodepointFunc11() { final XQuery query = new XQuery( "string-join(for $code in string-to-codepoints(\"example.com/\") return string($code), \"\") eq \"10112097109112108101469911110947\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Purpose: Combine fn:deep-equal and string-to-codepoints(). * . */ @org.junit.Test public void kStringToCodepointFunc12() { final XQuery query = new XQuery( "deep-equal(string-to-codepoints(\"Thérèse\"), (84, 104, 233, 114, 232, 115, 101))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Purpose: A test whose essence is: `codepoints-to-string((87, 36, 56, 87, 102, 96)) eq "W$8Wf`"`. * . */ @org.junit.Test public void kStringToCodepointFunc13() { final XQuery query = new XQuery( "codepoints-to-string((87, 36, 56, 87, 102, 96)) eq \"W$8Wf`\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Purpose: Combine string-to-codepoints() and a predicate. * . */ @org.junit.Test public void kStringToCodepointFunc14() { final XQuery query = new XQuery( "string-to-codepoints(\"Thérèse\")[last()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("101") ); } /** * * Purpose: Combine string-to-codepoints() and a predicate. * . */ @org.junit.Test public void kStringToCodepointFunc15() { final XQuery query = new XQuery( "string-to-codepoints(\"Thérèse\")[0 + last()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("101") ); } /** * * Purpose: Combine string-to-codepoints() and a predicate. * . */ @org.junit.Test public void kStringToCodepointFunc16() { final XQuery query = new XQuery( "string-to-codepoints(\"Thérèse\")[last() - 1]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("115") ); } /** * * Purpose: Combine string-to-codepoints() and a predicate. * . */ @org.junit.Test public void kStringToCodepointFunc17() { final XQuery query = new XQuery( "string-to-codepoints(\"Thérèse\")[last() - 0]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("101") ); } /** * * Purpose: Combine string-to-codepoints() and a predicate. * . */ @org.junit.Test public void kStringToCodepointFunc18() { final XQuery query = new XQuery( "string-to-codepoints(\"Thérèse\")[0 + last()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("101") ); } /** * * Purpose: Combine string-to-codepoints() and a predicate. * . */ @org.junit.Test public void kStringToCodepointFunc19() { final XQuery query = new XQuery( "string-to-codepoints(\"Thérèse\")[last() - 2]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("232") ); } /** * * Purpose: A test whose essence is: `string-to-codepoints("str", "INVALID")`. * . */ @org.junit.Test public void kStringToCodepointFunc2() { final XQuery query = new XQuery( "string-to-codepoints(\"str\", \"INVALID\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * * Purpose: Combine string-to-codepoints() and a predicate. * . */ @org.junit.Test public void kStringToCodepointFunc20() { final XQuery query = new XQuery( "empty(string-to-codepoints(\"Thérèse\")[last() - 7])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Purpose: Combine string-to-codepoints() and a predicate. * . */ @org.junit.Test public void kStringToCodepointFunc21() { final XQuery query = new XQuery( "string-to-codepoints(\"Thérèse\")[last() - 6]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("84") ); } /** * * Purpose: A test whose essence is: `empty(string-to-codepoints(()))`. * . */ @org.junit.Test public void kStringToCodepointFunc3() { final XQuery query = new XQuery( "empty(string-to-codepoints(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Purpose: A test whose essence is: `empty(string-to-codepoints(""))`. * . */ @org.junit.Test public void kStringToCodepointFunc4() { final XQuery query = new XQuery( "empty(string-to-codepoints(\"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Purpose: A test whose essence is: `count(string-to-codepoints("123")) eq 3`. * . */ @org.junit.Test public void kStringToCodepointFunc5() { final XQuery query = new XQuery( "count(string-to-codepoints(\"123\")) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Purpose: A test whose essence is: `count(string-to-codepoints("")) eq 0`. * . */ @org.junit.Test public void kStringToCodepointFunc6() { final XQuery query = new XQuery( "count(string-to-codepoints(\"\")) eq 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Purpose: A test whose essence is: `empty(string-to-codepoints(""))`. * . */ @org.junit.Test public void kStringToCodepointFunc7() { final XQuery query = new XQuery( "empty(string-to-codepoints(\"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Purpose: A test whose essence is: `string-to-codepoints("e")`. * . */ @org.junit.Test public void kStringToCodepointFunc8() { final XQuery query = new XQuery( "string-to-codepoints(\"e\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("101") ); } /** * * Purpose: A test whose essence is: `deep-equal(string-to-codepoints("ee"), (101, 101))`. * . */ @org.junit.Test public void kStringToCodepointFunc9() { final XQuery query = new XQuery( "deep-equal(string-to-codepoints(\"ee\"), (101, 101))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Description: Evaluation of an "fn:string-to-codepoints" with argument set to a single character ('1'). * . */ @org.junit.Test public void fnStringToCodepoints1() { final XQuery query = new XQuery( "fn:string-to-codepoints('1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("49") ); } /** * * Description: Evaluation of an "fn:string-to-codepoints" that is used as argument to fn:avg function . * . */ @org.junit.Test public void fnStringToCodepoints10() { final XQuery query = new XQuery( "fn:avg(fn:string-to-codepoints(\"A String\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("91") ); } /** * * Description: Evaluation of an "fn:string-to-codepoints" that is used as argument to fn:empty function . * . */ @org.junit.Test public void fnStringToCodepoints11() { final XQuery query = new XQuery( "fn:empty(fn:string-to-codepoints(\"A String\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Description: Evaluation of an "fn:string-to-codepoints" that is used as argument to fn:empty function. * . */ @org.junit.Test public void fnStringToCodepoints12() { final XQuery query = new XQuery( "fn:empty(fn:string-to-codepoints(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Description: Evaluation of an "fn:string-to-codepoints" that is used as argument to fn:exits function . * . */ @org.junit.Test public void fnStringToCodepoints13() { final XQuery query = new XQuery( "fn:exists(fn:string-to-codepoints(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Description: Evaluation of an "fn:string-to-codepoints" that is used as argument to fn:empty function. * . */ @org.junit.Test public void fnStringToCodepoints14() { final XQuery query = new XQuery( "fn:exists(fn:string-to-codepoints(\"A String\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Evaluation of "fn:string-to-codepoints" with non-BMP characters * . */ @org.junit.Test public void fnStringToCodepoints15() { final XQuery query = new XQuery( "fn:deep-equal(fn:string-to-codepoints(\"ð€ð€‚\"), (65537, 65538))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Description: Evaluation of an "fn:string-to-codepoints" with argument set to a single character ('a'). * . */ @org.junit.Test public void fnStringToCodepoints2() { final XQuery query = new XQuery( "fn:string-to-codepoints('a')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("97") ); } /** * * Description: Evaluation of an "fn:string-to-codepoints" with argument set to a combination of number/character ('1a'). * . */ @org.junit.Test public void fnStringToCodepoints3() { final XQuery query = new XQuery( "fn:string-to-codepoints('1a')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("49, 97") ); } /** * * Description: Evaluation of an "fn:string-to-codepoints" with argument set to the characters "#*^$". * . */ @org.junit.Test public void fnStringToCodepoints4() { final XQuery query = new XQuery( "fn:string-to-codepoints('#*^$')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("35, 42, 94, 36") ); } /** * * Description: Evaluation of an "fn:string-to-codepoints" with argument set to "string-to-codepoints". * . */ @org.junit.Test public void fnStringToCodepoints5() { final XQuery query = new XQuery( "fn:string-to-codepoints('string-to-codepoints')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("115, 116, 114, 105, 110, 103, 45, 116, 111, 45, 99, 111, 100, 101, 112, 111, 105, 110, 116, 115") ); } /** * * Description: Evaluation of an "fn:string-to-codepoints" with argument that uses "xs:string()" function . * . */ @org.junit.Test public void fnStringToCodepoints6() { final XQuery query = new XQuery( "fn:string-to-codepoints(xs:string(\"A String\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("65, 32, 83, 116, 114, 105, 110, 103") ); } /** * * Description: Evaluation of an "fn:string-to-codepoints" with argument that uses "fn:upper-case" function . * . */ @org.junit.Test public void fnStringToCodepoints7() { final XQuery query = new XQuery( "fn:string-to-codepoints(fn:upper-case(\"A String\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("(65, 32, 83, 84, 82, 73, 78, 71)") ); } /** * * Description: Evaluation of an "fn:string-to-codepoints" with argument that uses "fn:lower-case" function . * . */ @org.junit.Test public void fnStringToCodepoints8() { final XQuery query = new XQuery( "fn:string-to-codepoints(fn:lower-case(\"A String\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("(97, 32, 115, 116, 114, 105, 110, 103)") ); } /** * * Description: Evaluation of an "fn:string-to-codepoints" that is used as argument to fn:count function . * . */ @org.junit.Test public void fnStringToCodepoints9() { final XQuery query = new XQuery( "fn:count(fn:string-to-codepoints(\"A String\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("8") ); } /** * * Purpose: Evaluates The "string-to-codepoints" function * with the arguments set as follows: * $arg = xs:string(lower bound) * . */ @org.junit.Test public void fnStringToCodepoints1args1() { final XQuery query = new XQuery( "fn:string-to-codepoints(xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("84, 104, 105, 115, 32, 105, 115, 32, 97, 32, 99, 104, 97, 114, 97, 99, 116, 101") ); } /** * * Purpose: Evaluates The "string-to-codepoints" function * with the arguments set as follows: * $arg = xs:string(mid range) * . */ @org.junit.Test public void fnStringToCodepoints1args2() { final XQuery query = new XQuery( "fn:string-to-codepoints(xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("84, 104, 105, 115, 32, 105, 115, 32, 97, 32, 99, 104, 97, 114, 97, 99, 116, 101") ); } /** * * Purpose: Evaluates The "string-to-codepoints" function * with the arguments set as follows: * $arg = xs:string(upper bound) * . */ @org.junit.Test public void fnStringToCodepoints1args3() { final XQuery query = new XQuery( "fn:string-to-codepoints(xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("84, 104, 105, 115, 32, 105, 115, 32, 97, 32, 99, 104, 97, 114, 97, 99, 116, 101") ); } /** * * Purpose:Test string-to-codepoints with variety of characters * . */ @org.junit.Test public void fnStringToCodepoints1args4() { final XQuery query = new XQuery( "string-to-codepoints('bßڒã豈')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("98, 223, 1682, 12365, 63744") ); } /** * * Purpose:Test string-to-codepoints with an empty string argument * . */ @org.junit.Test public void fnStringToCodepoints1args5() { final XQuery query = new XQuery( "fn:string-to-codepoints(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * * Purpose:Test string-to-codepoints with empty sequence argument * . */ @org.junit.Test public void fnStringToCodepoints1args6() { final XQuery query = new XQuery( "string-to-codepoints(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * * Purpose:Test string-to-codepoints with invalid type in argument * . */ @org.junit.Test public void fnStringToCodepoints1args7() { final XQuery query = new XQuery( "string-to-codepoints(12)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * Purpose:Test string-to-codepoints with incorrect function arity * . */ @org.junit.Test public void fnStringToCodepoints1args8() { final XQuery query = new XQuery( "string-to-codepoints('abc','def')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnSubsequence.java��������������������0000664�0000000�0000000�00000143756�12224530032�0027535�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the subsequence() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnSubsequence extends QT3TestSet { /** * A test whose essence is: `subsequence()`. . */ @org.junit.Test public void kSeqSubsequenceFunc1() { final XQuery query = new XQuery( "subsequence()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `subsequence((1, 2, 3.1, "four"), 3, 1) instance of xs:decimal`. . */ @org.junit.Test public void kSeqSubsequenceFunc10() { final XQuery query = new XQuery( "subsequence((1, 2, 3.1, \"four\"), 3, 1) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `subsequence((1, 2, 3.1, "four"), 1, 1)`. . */ @org.junit.Test public void kSeqSubsequenceFunc11() { final XQuery query = new XQuery( "subsequence((1, 2, 3.1, \"four\"), 1, 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * A test whose essence is: `empty(subsequence((1, 2, 3, "four"), 4, -3))`. . */ @org.junit.Test public void kSeqSubsequenceFunc12() { final XQuery query = new XQuery( "empty(subsequence((1, 2, 3, \"four\"), 4, -3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(subsequence((1, 2, 3, "four"), -4, -3))`. . */ @org.junit.Test public void kSeqSubsequenceFunc13() { final XQuery query = new XQuery( "empty(subsequence((1, 2, 3, \"four\"), -4, -3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `subsequence((1, 2, 3), 1, 1) eq 1`. . */ @org.junit.Test public void kSeqSubsequenceFunc14() { final XQuery query = new XQuery( "subsequence((1, 2, 3), 1, 1) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `subsequence((1, 2, 3), 1, 1) eq 1`. . */ @org.junit.Test public void kSeqSubsequenceFunc15() { final XQuery query = new XQuery( "subsequence((1, 2, 3), 1, 1) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `subsequence((1, 2, 3), 3) eq 3`. . */ @org.junit.Test public void kSeqSubsequenceFunc16() { final XQuery query = new XQuery( "subsequence((1, 2, 3), 3) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(subsequence((1, 2, 3), 1, 1)) eq 1`. . */ @org.junit.Test public void kSeqSubsequenceFunc17() { final XQuery query = new XQuery( "count(subsequence((1, 2, 3), 1, 1)) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(subsequence((1, 2, 3), 1, 3)) eq 3`. . */ @org.junit.Test public void kSeqSubsequenceFunc18() { final XQuery query = new XQuery( "count(subsequence((1, 2, 3), 1, 3)) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(subsequence((1, 2, 3, "four"), 4)) eq 1`. . */ @org.junit.Test public void kSeqSubsequenceFunc19() { final XQuery query = new XQuery( "count(subsequence((1, 2, 3, \"four\"), 4)) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `subsequence(1)`. . */ @org.junit.Test public void kSeqSubsequenceFunc2() { final XQuery query = new XQuery( "subsequence(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `count(subsequence(1 to 3, 1, 1)) eq 1`. . */ @org.junit.Test public void kSeqSubsequenceFunc20() { final XQuery query = new XQuery( "count(subsequence(1 to 3, 1, 1)) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(subsequence((1, 2), 4))`. . */ @org.junit.Test public void kSeqSubsequenceFunc21() { final XQuery query = new XQuery( "empty(subsequence((1, 2), 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `subsequence((5, 6, 7, 8), 2, 1) eq 6`. . */ @org.junit.Test public void kSeqSubsequenceFunc22() { final XQuery query = new XQuery( "subsequence((5, 6, 7, 8), 2, 1) eq 6", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(subsequence((1, 2), 2)) eq 1`. . */ @org.junit.Test public void kSeqSubsequenceFunc23() { final XQuery query = new XQuery( "count(subsequence((1, 2), 2)) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(subsequence((1, 2, 3, "four"), 2)) eq 3`. . */ @org.junit.Test public void kSeqSubsequenceFunc24() { final XQuery query = new XQuery( "count(subsequence((1, 2, 3, \"four\"), 2)) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(subsequence((1, 2, 3, "four"), 2, 2)) eq 2`. . */ @org.junit.Test public void kSeqSubsequenceFunc25() { final XQuery query = new XQuery( "count(subsequence((1, 2, 3, \"four\"), 2, 2)) eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `subsequence((1, 2, 3.1, "four"), 1, 1)`. . */ @org.junit.Test public void kSeqSubsequenceFunc26() { final XQuery query = new XQuery( "subsequence((1, 2, 3.1, \"four\"), 1, 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * A test whose essence is: `1 eq "a string"`. . */ @org.junit.Test public void kSeqSubsequenceFunc27() { final XQuery query = new XQuery( "1 eq \"a string\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A test whose essence is: `1 eq subsequence(("1", 2, 3.1, "four"), 1, 1)`. . */ @org.junit.Test public void kSeqSubsequenceFunc28() { final XQuery query = new XQuery( "1 eq subsequence((\"1\", 2, 3.1, \"four\"), 1, 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A test whose essence is: `subsequence(("1", 2, 3.1, "four"), 1, 1) eq 1`. . */ @org.junit.Test public void kSeqSubsequenceFunc29() { final XQuery query = new XQuery( "subsequence((\"1\", 2, 3.1, \"four\"), 1, 1) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A test whose essence is: `subsequence(1, 1, 1, 1)`. . */ @org.junit.Test public void kSeqSubsequenceFunc3() { final XQuery query = new XQuery( "subsequence(1, 1, 1, 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `subsequence(error(), 1, 1)`. . */ @org.junit.Test public void kSeqSubsequenceFunc30() { final XQuery query = new XQuery( "subsequence(error(), 1, 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * A test whose essence is: `count(subsequence((1, 2, 2, current-time()), 2, 2)) eq 2`. . */ @org.junit.Test public void kSeqSubsequenceFunc31() { final XQuery query = new XQuery( "count(subsequence((1, 2, 2, current-time()), 2, 2)) eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(subsequence(remove(current-time(), 1), 1, 1)) eq 0`. . */ @org.junit.Test public void kSeqSubsequenceFunc32() { final XQuery query = new XQuery( "count(subsequence(remove(current-time(), 1), 1, 1)) eq 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal(1, subsequence((1, 2, current-time()), 1, 1))`. . */ @org.junit.Test public void kSeqSubsequenceFunc33() { final XQuery query = new XQuery( "deep-equal(1, subsequence((1, 2, current-time()), 1, 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Using subsequence inside a predicate. . */ @org.junit.Test public void kSeqSubsequenceFunc34() { final XQuery query = new XQuery( "(1)[deep-equal(1, subsequence((1, 2, current-time()), 1, 1))] eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(subsequence((current-time(), 1), 4))`. . */ @org.junit.Test public void kSeqSubsequenceFunc35() { final XQuery query = new XQuery( "empty(subsequence((current-time(), 1), 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(subsequence((current-time(), 1), 4)) eq 0`. . */ @org.junit.Test public void kSeqSubsequenceFunc36() { final XQuery query = new XQuery( "count(subsequence((current-time(), 1), 4)) eq 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(subsequence((current-time(), 2 , 3), 1)) eq 3`. . */ @org.junit.Test public void kSeqSubsequenceFunc37() { final XQuery query = new XQuery( "count(subsequence((current-time(), 2 , 3), 1)) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(subsequence((current-time(), 2 , 3), 3)) eq 1`. . */ @org.junit.Test public void kSeqSubsequenceFunc38() { final XQuery query = new XQuery( "count(subsequence((current-time(), 2 , 3), 3)) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(subsequence((current-time(), 2 , 3, 4), 2, 2)) eq 2`. . */ @org.junit.Test public void kSeqSubsequenceFunc39() { final XQuery query = new XQuery( "count(subsequence((current-time(), 2 , 3, 4), 2, 2)) eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(subsequence((), 2, 3))`. . */ @org.junit.Test public void kSeqSubsequenceFunc4() { final XQuery query = new XQuery( "empty(subsequence((), 2, 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Apply a predicate to the result of fn:subsequence(). . */ @org.junit.Test public void kSeqSubsequenceFunc40() { final XQuery query = new XQuery( "subsequence((1, 2, 3, current-time(), 5, 6, 7), 1, 1)[1]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Apply a predicate to the result of fn:subsequence(). . */ @org.junit.Test public void kSeqSubsequenceFunc41() { final XQuery query = new XQuery( "subsequence((1, 2, 3, current-time(), 5, 6, 9), 7)[last()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("9") ); } /** * Apply a predicate to the result of fn:subsequence(). . */ @org.junit.Test public void kSeqSubsequenceFunc42() { final XQuery query = new XQuery( "subsequence((1, 2, 3, current-time(), 5, 6, 7), 4)[last() - 1]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("6") ); } /** * Apply a predicate to the result of fn:subsequence(). . */ @org.junit.Test public void kSeqSubsequenceFunc43() { final XQuery query = new XQuery( "empty(subsequence((1, 2, 3, current-time(), 5, 6, 7), 4, 1)[last() - 10])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Apply a predicate to the result of fn:subsequence(). . */ @org.junit.Test public void kSeqSubsequenceFunc44() { final XQuery query = new XQuery( "empty(subsequence((1, 2, 3, current-time(), 5, 6, 7), 1, 1)[2])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(subsequence((1, 2, 3), 2, -10))`. . */ @org.junit.Test public void kSeqSubsequenceFunc5() { final XQuery query = new XQuery( "empty(subsequence((1, 2, 3), 2, -10))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(subsequence((1, 2, 3, "four"), 4)) eq 1`. . */ @org.junit.Test public void kSeqSubsequenceFunc6() { final XQuery query = new XQuery( "count(subsequence((1, 2, 3, \"four\"), 4)) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(subsequence((1, 2, 3, "four"), 4, 1)) eq 1`. . */ @org.junit.Test public void kSeqSubsequenceFunc7() { final XQuery query = new XQuery( "count(subsequence((1, 2, 3, \"four\"), 4, 1)) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `subsequence((1, 2, 3.1, "four"), 4)`. . */ @org.junit.Test public void kSeqSubsequenceFunc8() { final XQuery query = new XQuery( "subsequence((1, 2, 3.1, \"four\"), 4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"four\"") ); } /** * A test whose essence is: `subsequence((1, 2, 3.1, "four"), 4, 1)`. . */ @org.junit.Test public void kSeqSubsequenceFunc9() { final XQuery query = new XQuery( "subsequence((1, 2, 3.1, \"four\"), 4, 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"four\"") ); } /** * Use fn:subsequence where the input is via variable references. . */ @org.junit.Test public void k2SeqSubsequenceFunc1() { final XQuery query = new XQuery( "let $start := (current-time(), 2)[2] treat as xs:integer,\n" + " $len := (current-time(), 1)[2] treat as xs:integer\n" + " return subsequence((1, 2, 3), $start, $len)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Have a call to subsequence that triggers a type error in an expression which can be const folded(derived from functionbc20_037). . */ @org.junit.Test public void k2SeqSubsequenceFunc10() { final XQuery query = new XQuery( "subsequence((1, 2, 3), 1, \"string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A zero length. . */ @org.junit.Test public void k2SeqSubsequenceFunc2() { final XQuery query = new XQuery( "subsequence((1, 2, 3), 1, 0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * A negative length. . */ @org.junit.Test public void k2SeqSubsequenceFunc3() { final XQuery query = new XQuery( "subsequence((1, 2, 3, 4, 5), 4, -1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Ensure rounding is done properly, 1.1. . */ @org.junit.Test public void k2SeqSubsequenceFunc4() { final XQuery query = new XQuery( "fn:subsequence((1,2,3), 1.1, 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Ensure rounding is done properly, 1.8. . */ @org.junit.Test public void k2SeqSubsequenceFunc5() { final XQuery query = new XQuery( "fn:subsequence((1,2,3), 1.8, 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Ensure rounding is done properly, 1.4. . */ @org.junit.Test public void k2SeqSubsequenceFunc6() { final XQuery query = new XQuery( "fn:subsequence((1,2,3), 1.4, 1.4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Ensure rounding is done properly, 1.5. . */ @org.junit.Test public void k2SeqSubsequenceFunc7() { final XQuery query = new XQuery( "fn:subsequence((1,2,3), 1.5, 1.5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("2, 3") ); } /** * Have subsequence inside a function body, to trap bugs related to inference, rewrites and function call sites. This expression typically constant propagates to a sequence of integers. . */ @org.junit.Test public void k2SeqSubsequenceFunc8() { final XQuery query = new XQuery( "let $f :=function() { subsequence(subsequence((1, 2, 3, 4), 3, 1), 1, 4) } return $f()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Have subsequence inside a function body, to trap bugs related to inference, rewrites and function call sites(#2). This expression typically constant propagates to a sequence of integers. . */ @org.junit.Test public void k2SeqSubsequenceFunc9() { final XQuery query = new XQuery( "let $f :=function() { subsequence((1, 2, 3), 1) } return $f()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1, 2, 3") ); } /** * Test fn:subsequence on -INF and INF . */ @org.junit.Test public void cbclSubsequence001() { final XQuery query = new XQuery( "\n" + " count(subsequence(1 to 10, xs:double(\"-INF\"), xs:double(\"INF\")))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Test fn:subsequence with length NaN . */ @org.junit.Test public void cbclSubsequence002() { final XQuery query = new XQuery( "count(subsequence(1 to 10, 2, xs:double(\"NaN\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Test fn:subsequence with starting position NaN . */ @org.junit.Test public void cbclSubsequence003() { final XQuery query = new XQuery( "count(subsequence(1 to 10, xs:double(\"NaN\"), 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Test unbounded fn:subsequence with starting position -INF . */ @org.junit.Test public void cbclSubsequence004() { final XQuery query = new XQuery( "count(subsequence(1 to 10, xs:double(\"-INF\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10") ); } /** * Test unbounded fn:subsequence with starting position NaN . */ @org.junit.Test public void cbclSubsequence005() { final XQuery query = new XQuery( "count(subsequence(1 to 10, xs:double(\"NaN\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Test subsequence optimizations. . */ @org.junit.Test public void cbclSubsequence006() { final XQuery query = new XQuery( "\n" + " subsequence((1, 2, for $x in 1 to 10 return 2*$x), 2, year-from-date(current-date()))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2 2 4 6 8 10 12 14 16 18 20") ); } /** * Test subsequence optimizations. . */ @org.junit.Test public void cbclSubsequence007() { final XQuery query = new XQuery( "\n" + " subsequence((1, 2, for $x in 1 to 10 return 2*$x), -1, sum((1 to 10)[. mod 10 = 3]))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Test subsequence on length out of int range. . */ @org.junit.Test public void cbclSubsequence008() { final XQuery query = new XQuery( "subsequence(1 to 100, 99, 2147483648)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "99 100") ); } /** * Test subsequence on starting value out of int range. . */ @org.junit.Test public void cbclSubsequence009() { final XQuery query = new XQuery( "count(subsequence(1 to 100, -2147483648, 20))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Test subsequence on largest supported (non-infinite) range. . */ @org.junit.Test public void cbclSubsequence010() { final XQuery query = new XQuery( "count(subsequence(1 to 3000000000, -2147483648, 2147483647))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("*") || assertEq("0") ) ); } /** * Test unbounded subsequence with starting position out of int range. . */ @org.junit.Test public void cbclSubsequence011() { final XQuery query = new XQuery( "count(subsequence(1 to 3000000000, -2147483649))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("3000000000") || error("*") ) ); } /** * Test unbounded subsequence with starting position out of int range. . */ @org.junit.Test public void cbclSubsequence012() { final XQuery query = new XQuery( "count(subsequence(1 to 3000000000, 2147483648))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("852516353") || error("*") ) ); } /** * Test unbounded subsequence with largest allowed starting position. . */ @org.junit.Test public void cbclSubsequence013() { final XQuery query = new XQuery( "count(subsequence(1 to 3000000000, 2147483647))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("852516354") || error("*") ) ); } /** * Test unbounded subsequence with largest allowed starting position. . */ @org.junit.Test public void cbclSubsequence014() { final XQuery query = new XQuery( "subsequence(1 to 3000000000, 2147483647, 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "2147483647 2147483648 2147483649 2147483650 2147483651") || error("*") ) ); } /** * Test subsequence on map expression. . */ @org.junit.Test public void cbclSubsequence015() { final XQuery query = new XQuery( "subsequence(for $x in (1 to 100) return -$x, 3, 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-3 -4 -5 -6 -7") ); } /** * Test subsequence on something that looks a bit like last but isn't . */ @org.junit.Test public void cbclSubsequence016() { final XQuery query = new XQuery( "\n" + " subsequence( for $x in 1 to 10 return 1 to $x, count(for $x in 0 to 10 return 1 to $x), 1)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10") ); } /** * Test subsequence with infinite length starting at first item . */ @org.junit.Test public void cbclSubsequence017() { final XQuery query = new XQuery( "\n" + " subsequence(for $x in 1 to 10 return 1 to $x, 1.2, xs:double(\"INF\"))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 1 2 3 4 5 6 1 2 3 4 5 6 7 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 10") ); } /** * Test subsequence with infinite length starting after first item . */ @org.junit.Test public void cbclSubsequence018() { final XQuery query = new XQuery( "\n" + " subsequence(for $x in 1 to 10 return 1 to $x, 4.2, xs:double(\"INF\"))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 1 2 3 4 1 2 3 4 5 1 2 3 4 5 6 1 2 3 4 5 6 7 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 10") ); } /** * Test subsequence that gets the last item . */ @org.junit.Test public void cbclSubsequence019() { final XQuery query = new XQuery( "\n" + " let $y := for $x in 1 to 10 return $x * $x return subsequence($y, count($y), 3)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "100") ); } /** * Tests subsequence with static start and length . */ @org.junit.Test public void cbclSubsequence020() { final XQuery query = new XQuery( "subsequence(for $x in 1 to 10 return $x[. mod 2 = 0],2,4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4 6 8 10") ); } /** * Tests an unbounded subsequence with a static start . */ @org.junit.Test public void cbclSubsequence021() { final XQuery query = new XQuery( "subsequence(for $x in 1 to 10 return $x[. mod 2 = 0],2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4 6 8 10") ); } /** * Test skip on initial subsequence enumerator . */ @org.junit.Test public void cbclSubsequence022() { final XQuery query = new XQuery( "subsequence((1 to 20)[. mod 2 = 0][position() < 5],2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4 6 8") ); } /** * Test subsequence(for .....) . */ @org.junit.Test public void cbclSubsequence023() { final XQuery query = new XQuery( "subsequence(for $x in 1 to 10 return $x * $x,2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4 9 16 25 36 49 64 81 100") ); } /** * Test subsequence(...,1,INF) . */ @org.junit.Test public void cbclSubsequence024() { final XQuery query = new XQuery( "\n" + " subsequence((1 to 100)[. mod 2 = 0],1,xs:double(string-join(('I','N','F')[position() mod 2 >= 0],'')))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100") ); } /** * Tries to call GetExpressionProperties on static-subsequence. In fact shows an error in variable binding when expanding path expressions . */ @org.junit.Test public void cbclSubsequence025() { final XQuery query = new XQuery( "count(<a><b/></a>/*/subsequence(.,1,1)/..)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Tests for subsequence on divided sequence . */ @org.junit.Test public void cbclSubsequence026() { final XQuery query = new XQuery( "\n" + " let $x := (1 to 10)[. mod 2 = 0] return subsequence((0,$x),3,count($x) div 2)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4 6 8") ); } /** * Tests for subsequence on a map expression . */ @org.junit.Test public void cbclSubsequence027() { final XQuery query = new XQuery( "\n" + " let $z := (1 to 10)[. mod 2 = 0] return subsequence(for $x in $z return floor($x),2,4)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4 6 8 10") ); } /** * arg1: sequence of string, arg2 & arg3: integer . */ @org.junit.Test public void fnSubsequenceMixArgs001() { final XQuery query = new XQuery( "fn:subsequence( (\"a\", \"b\", \"c\"), 1, 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\"") ); } /** * arg1: sequence of string, arg2 & arg3: integer . */ @org.junit.Test public void fnSubsequenceMixArgs002() { final XQuery query = new XQuery( "fn:subsequence( (\"a\", \"b\", \"c\"), 3, 12)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"c\"") ); } /** * arg1: sequence of string, arg2 & arg3: integer . */ @org.junit.Test public void fnSubsequenceMixArgs003() { final XQuery query = new XQuery( "fn:subsequence( (\"a\", xs:string(\"\"),\"b\", \"c\"), 1, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", \"\", \"b\"") ); } /** * arg1: sequence of string, arg2 & arg3: integer . */ @org.junit.Test public void fnSubsequenceMixArgs004() { final XQuery query = new XQuery( "fn:subsequence( (\"a\", xs:string(\"hello\"),\"b\", \"c\"), 1, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", \"hello\", \"b\"") ); } /** * arg1: sequence of string & anyURI, arg2 & arg3: integer . */ @org.junit.Test public void fnSubsequenceMixArgs005() { final XQuery query = new XQuery( "fn:subsequence( (\"a\", xs:anyURI(\"www.example.com\"),\"b\", \"c\"), 1, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", \"www.example.com\", \"b\"") ); } /** * arg1: sequence of string, arg2 & arg3: integer . */ @org.junit.Test public void fnSubsequenceMixArgs006() { final XQuery query = new XQuery( "fn:subsequence( (\"a\", (), (), \"b\", \"c\"), 1, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", \"b\", \"c\"") ); } /** * arg1: sequence of string & integer, arg2 & arg3: integer . */ @org.junit.Test public void fnSubsequenceMixArgs007() { final XQuery query = new XQuery( "fn:subsequence( (\"a\", xs:integer(\"100\"), xs:integer(\"-100\"), \"b\", \"c\"),2,4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("100, -100, \"b\", \"c\"") ); } /** * arg1: sequence of string,decimal & integer, arg2 & arg3: integer . */ @org.junit.Test public void fnSubsequenceMixArgs008() { final XQuery query = new XQuery( "fn:subsequence( (\"a\", xs:decimal(\"-1.000000000001\"), xs:integer(\"-100\"), \"b\", \"c\"), 2,3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("-1.000000000001, -100, \"b\"") ); } /** * arg1: sequence of string & float , arg2 & arg3: integer . */ @org.junit.Test public void fnSubsequenceMixArgs009() { final XQuery query = new XQuery( "fn:subsequence( (\"a\", xs:float(\"INF\"), \"b\", \"c\"),-2,3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * arg1: sequence of string & float , arg2 & arg3: integer . */ @org.junit.Test public void fnSubsequenceMixArgs010() { final XQuery query = new XQuery( "fn:subsequence ( (\"a\", xs:float(\"-INF\"), \"b\", \"c\"), 1,2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", xs:float(\"-INF\")") ); } /** * arg1: sequence of string & float , arg2 & arg3: integer . */ @org.junit.Test public void fnSubsequenceMixArgs011() { final XQuery query = new XQuery( "fn:subsequence ( (\"a\", xs:float(\"NaN\"), \"b\", \"c\"), 0, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"a\"") ); } /** * arg1: sequence of string & float , arg2 & arg3: integer . */ @org.junit.Test public void fnSubsequenceMixArgs012() { final XQuery query = new XQuery( "fn:subsequence ( (\"a\", xs:float(\"1.01\"), \"b\", \"c\"), 2,4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1.01, \"b\", \"c\"") ); } /** * arg1: sequence of string & double , arg2 & arg3: integer . */ @org.junit.Test public void fnSubsequenceMixArgs013() { final XQuery query = new XQuery( "fn:subsequence ( (\"a\", xs:double(\"NaN\"), \"b\", \"c\"), 2, 20)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("xs:double('NaN'), \"b\", \"c\"") ); } /** * arg1: sequence of string & double , arg2 & arg3: integer . */ @org.junit.Test public void fnSubsequenceMixArgs014() { final XQuery query = new XQuery( "fn:subsequence ( (\"a\", xs:double(\"1.01\"), \"b\", \"c\"), 2,3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1.01, \"b\", \"c\"") ); } /** * arg1: sequence of string & double , arg2 & arg3: integer . */ @org.junit.Test public void fnSubsequenceMixArgs015() { final XQuery query = new XQuery( "fn:subsequence ( (\"a\", xs:double(\"-INF\"), \"b\", \"c\"), 2,2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("xs:double('-INF'), \"b\"") ); } /** * arg1: sequence of string & double , arg2 & arg3: integer . */ @org.junit.Test public void fnSubsequenceMixArgs016() { final XQuery query = new XQuery( "fn:subsequence ( (\"a\", xs:double(\"INF\"), \"b\", \"c\"), 2, 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:double(\"INF\")") ); } /** * arg1: sequence of string & boolean, arg2 & arg3: integer . */ @org.junit.Test public void fnSubsequenceMixArgs017() { final XQuery query = new XQuery( "fn:subsequence ( (\"a\", xs:boolean(\"1\"), \"b\", \"c\"), 1,2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", true()") ); } /** * arg1: sequence of string & boolean, arg2 & arg3: integer . */ @org.junit.Test public void fnSubsequenceMixArgs018() { final XQuery query = new XQuery( "fn:subsequence ( (\"a\", xs:boolean(\"0\"), \"b\", \"c\"), 2,1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * arg1: sequence of string & boolean, arg2 & arg3: integer . */ @org.junit.Test public void fnSubsequenceMixArgs019() { final XQuery query = new XQuery( "fn:subsequence ( (\"a\", xs:boolean(\"true\"), \"b\", \"c\"), 1,2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", true()") ); } /** * arg1: sequence of string & boolean, arg2 & arg3: integer . */ @org.junit.Test public void fnSubsequenceMixArgs020() { final XQuery query = new XQuery( "fn:subsequence ( (\"a\", xs:boolean(\"false\"), \"b\", \"c\"), 1, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", false(), \"b\"") ); } /** * arg1: sequence of string & date , arg2 & arg3: integer . */ @org.junit.Test public void fnSubsequenceMixArgs021() { final XQuery query = new XQuery( "fn:subsequence ( (\"a\", xs:date(\"1993-03-31\"), \"b\", \"c\"), 1,2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", xs:date('1993-03-31')") ); } /** * arg1: sequence of string & dateTime, arg2 & arg3: integer . */ @org.junit.Test public void fnSubsequenceMixArgs022() { final XQuery query = new XQuery( "fn:subsequence ( (\"a\", xs:dateTime(\"1972-12-31T00:00:00\"), \"b\", \"c\"), 0,2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"a\"") ); } /** * arg1: sequence of string & time , arg2 & arg3: integer . */ @org.junit.Test public void fnSubsequenceMixArgs023() { final XQuery query = new XQuery( "fn:subsequence ( (\"a\", xs:time(\"12:30:00\"), \"b\", \"c\"), 1, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", xs:time('12:30:00')") ); } /** * subsequence(X, -INF, +INF Returns () because -INF + INF = NaN, and position() lt NaN is false. See XSLT test case bug 837 (member only bugzilla) . */ @org.junit.Test public void fnSubsequenceMixArgs024() { final XQuery query = new XQuery( "fn:subsequence (1 to 10, xs:double('-INF'), xs:double('INF'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } } ������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnSubstring.java����������������������0000664�0000000�0000000�00000053110�12224530032�0027213�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the fn:substring() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnSubstring extends QT3TestSet { /** * A test whose essence is: `sub-string("a string")`. . */ @org.junit.Test public void kSubstringFunc1() { final XQuery query = new XQuery( "sub-string(\"a string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `substring("12345", 0 div 0E0, 3) eq ""`. . */ @org.junit.Test public void kSubstringFunc10() { final XQuery query = new XQuery( "substring(\"12345\", 0 div 0E0, 3) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `substring("12345", 1, 0 div 0E0) eq ""`. . */ @org.junit.Test public void kSubstringFunc11() { final XQuery query = new XQuery( "substring(\"12345\", 1, 0 div 0E0) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `substring("12345", -3, 5) eq "1"`. . */ @org.junit.Test public void kSubstringFunc12() { final XQuery query = new XQuery( "substring(\"12345\", -3, 5) eq \"1\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `substring("12345", -42, 1 div 0E0) eq "12345"`. . */ @org.junit.Test public void kSubstringFunc13() { final XQuery query = new XQuery( "substring(\"12345\", -42, 1 div 0E0) eq \"12345\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `substring("12345", -1 div 0E0, 1 div 0E0) eq ""`. . */ @org.junit.Test public void kSubstringFunc14() { final XQuery query = new XQuery( "substring(\"12345\", -1 div 0E0, 1 div 0E0) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `substring("12345", 5, -3) eq ""`. . */ @org.junit.Test public void kSubstringFunc15() { final XQuery query = new XQuery( "substring(\"12345\", 5, -3) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `sub-string("a string", 1, 2, "wrong param")`. . */ @org.junit.Test public void kSubstringFunc2() { final XQuery query = new XQuery( "sub-string(\"a string\", 1, 2, \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `substring((), 1, 2) eq ""`. . */ @org.junit.Test public void kSubstringFunc3() { final XQuery query = new XQuery( "substring((), 1, 2) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `substring((), 1) eq ""`. . */ @org.junit.Test public void kSubstringFunc4() { final XQuery query = new XQuery( "substring((), 1) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `substring("12345", 1.5, 2.6) eq "234"`. . */ @org.junit.Test public void kSubstringFunc5() { final XQuery query = new XQuery( "substring(\"12345\", 1.5, 2.6) eq \"234\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `substring((), 1, 3) eq ""`. . */ @org.junit.Test public void kSubstringFunc6() { final XQuery query = new XQuery( "substring((), 1, 3) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `substring("motor car", 6) eq " car"`. . */ @org.junit.Test public void kSubstringFunc7() { final XQuery query = new XQuery( "substring(\"motor car\", 6) eq \" car\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `substring("12345", 0, 3) eq "12"`. . */ @org.junit.Test public void kSubstringFunc8() { final XQuery query = new XQuery( "substring(\"12345\", 0, 3) eq \"12\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `substring("metadata", 4, 3) eq "ada"`. . */ @org.junit.Test public void kSubstringFunc9() { final XQuery query = new XQuery( "substring(\"metadata\", 4, 3) eq \"ada\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:substring empty string . */ @org.junit.Test public void cbclSubstring001() { final XQuery query = new XQuery( "fn:boolean(fn:substring('', 1, 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test fn:substring with index past end of string . */ @org.junit.Test public void cbclSubstring002() { final XQuery query = new XQuery( "fn:boolean(fn:substring('five', 5, 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of substring function as per example 1 (for this function) from the F&O specs. . */ @org.junit.Test public void fnSubstring1() { final XQuery query = new XQuery( "fn:substring(\"motor car\", 6)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, " car") && assertType("xs:string") ) ); } /** * Evaluation of substring function as per example 10 (for this function) from the F&O specs. . */ @org.junit.Test public void fnSubstring10() { final XQuery query = new XQuery( "fn:substring(\"12345\", -42, 1 div 0E0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12345") ); } /** * Evaluation of substring function as per example 11 (for this function) from the F&O specs. Use "fn:count" to avoid empty file. . */ @org.junit.Test public void fnSubstring11() { final XQuery query = new XQuery( "fn:count(fn:substring(\"12345\", -1 div 0E0, 1 div 0E0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluation of substring function, where the source string is the empty string Use "fn:count" to avoid empty file. . */ @org.junit.Test public void fnSubstring12() { final XQuery query = new XQuery( "fn:count(fn:substring(\"\",0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluation of substring function, as an argument to an "fn:boolean" function" . */ @org.junit.Test public void fnSubstring13() { final XQuery query = new XQuery( "fn:boolean(fn:substring(\"ABC\",1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of substring function, as an argument to an "fn:not" function" . */ @org.junit.Test public void fnSubstring14() { final XQuery query = new XQuery( "fn:not(fn:substring(\"ABC\",1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of substring function, as an argument to another "fn:substring" function" . */ @org.junit.Test public void fnSubstring15() { final XQuery query = new XQuery( "fn:substring(fn:substring(\"ABCDE\",1),1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ABCDE") ); } /** * Evaluation of substring function, where the source string is the string "substring". . */ @org.junit.Test public void fnSubstring16() { final XQuery query = new XQuery( "fn:substring(\"substring\",1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "substring") ); } /** * Evaluation of substring function as an argument to a concat function. . */ @org.junit.Test public void fnSubstring17() { final XQuery query = new XQuery( "fn:concat(fn:substring(\"ABC\",1),\"DEF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ABCDEF") ); } /** * Evaluation of substring function as an argument to a contains function. . */ @org.junit.Test public void fnSubstring18() { final XQuery query = new XQuery( "fn:contains(fn:substring(\"ABCDEF\",1),\"DEF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of substring function using the special chracter "!@#$%^&*()". . */ @org.junit.Test public void fnSubstring19() { final XQuery query = new XQuery( "fn:substring(\"!@#$%^*()\",1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "!@#$%^*()") ); } /** * Evaluation of substring function as per example 2 (for this function) from the F&O specs. . */ @org.junit.Test public void fnSubstring2() { final XQuery query = new XQuery( "fn:substring(\"metadata\", 4, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ada") ); } /** * Evaluation of substring function, where the start location uses a "double" constructor. . */ @org.junit.Test public void fnSubstring20() { final XQuery query = new XQuery( "fn:substring(\"ABCD\",xs:double(1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ABCD") ); } /** * Evaluation of substring function, where the starting locatin is an addition expression. . */ @org.junit.Test public void fnSubstring21() { final XQuery query = new XQuery( "fn:substring(\"ABCDE\",1+1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "BCDE") ); } /** * Evaluation of substring function, where start<0 and (start+len)<0 . */ @org.junit.Test public void fnSubstring22() { final XQuery query = new XQuery( "concat('#', fn:substring(./concepts/@id, string-length(./concepts/@id) - 18, 1), '#')", ctx); try { query.context(node(file("fn/substring/concepts.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "##") ); } /** * substring() of a string containing non-BMP characters. */ @org.junit.Test public void fnSubstring23() { final XQuery query = new XQuery( "substring(\"abcdð€efgh\", 6)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"efgh\"") ); } /** * substring() of a string containing non-BMP characters. */ @org.junit.Test public void fnSubstring24() { final XQuery query = new XQuery( "substring(\"abcdð€efgh\", 5, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"ð€e\"") ); } /** * substring() of a string containing non-BMP characters. */ @org.junit.Test public void fnSubstring25() { final XQuery query = new XQuery( "substring(\"ð€\", 1, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"ð€\"") ); } /** * substring() of a string containing non-BMP characters. */ @org.junit.Test public void fnSubstring26() { final XQuery query = new XQuery( "substring(\"ð€\", 2, 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"\"") ); } /** * substring() of a string containing non-BMP characters. */ @org.junit.Test public void fnSubstring27() { final XQuery query = new XQuery( "substring(\"ð€\", 0, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"ð€\"") ); } /** * substring() of a string containing non-BMP characters. */ @org.junit.Test public void fnSubstring28() { final XQuery query = new XQuery( "substring(\"ð€\", 0, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"ð€\"") ); } /** * substring() of a string containing non-BMP characters. */ @org.junit.Test public void fnSubstring29() { final XQuery query = new XQuery( "substring(\"ð€ð€\", 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"\"") ); } /** * Evaluation of substring function as per example 3 (for this function) from the F&O specs. . */ @org.junit.Test public void fnSubstring3() { final XQuery query = new XQuery( "fn:substring(\"12345\", 1.5, 2.6)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "234") ); } /** * substring() of a string containing non-BMP characters. */ @org.junit.Test public void fnSubstring30() { final XQuery query = new XQuery( "substring(\"ð€ð€\", 0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"ð€ð€\"") ); } /** * Evaluation of substring function as per example 4 (for this function) from the F&O specs. . */ @org.junit.Test public void fnSubstring4() { final XQuery query = new XQuery( "fn:substring(\"12345\", 0, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12") ); } /** * Evaluation of substring function as per example 5 (for this function) from the F&O specs. Use "fn:count" to avoid empty file. . */ @org.junit.Test public void fnSubstring5() { final XQuery query = new XQuery( "fn:count(fn:substring(\"12345\", 5, -3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluation of substring function as per example 6 (for this function) from the F&O specs. . */ @org.junit.Test public void fnSubstring6() { final XQuery query = new XQuery( "fn:substring(\"12345\", -3, 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluation of substring function as per example 7 (for this function) from the F&O specs. Use "fn:count" to avoid empty file. . */ @org.junit.Test public void fnSubstring7() { final XQuery query = new XQuery( "fn:count(fn:substring(\"12345\", 0 div 0E0, 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluation of substring function as per example 8 (for this function) from the F&O specs. Use "fn:count" to avoid empty file. . */ @org.junit.Test public void fnSubstring8() { final XQuery query = new XQuery( "fn:count(fn:substring(\"12345\", 1, 0 div 0E0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluation of substring function as per example 9 (for this function) from the F&O specs. Use "fn:count" to avoid empty file. . */ @org.junit.Test public void fnSubstring9() { final XQuery query = new XQuery( "fn:count(fn:substring((), 1, 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnSubstringAfter.java�����������������0000664�0000000�0000000�00000045020�12224530032�0030176�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** . * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnSubstringAfter extends QT3TestSet { /** * A test whose essence is: `substring-after()`. . */ @org.junit.Test public void kSubstringAfterFunc1() { final XQuery query = new XQuery( "substring-after()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `substring-after("a string", ()) eq "a string"`. . */ @org.junit.Test public void kSubstringAfterFunc10() { final XQuery query = new XQuery( "substring-after(\"a string\", ()) eq \"a string\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `substring-after("a string", "not in other") eq ""`. . */ @org.junit.Test public void kSubstringAfterFunc11() { final XQuery query = new XQuery( "substring-after(\"a string\", \"not in other\") eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `substring-after(())`. . */ @org.junit.Test public void kSubstringAfterFunc2() { final XQuery query = new XQuery( "substring-after(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `substring-after((), (), "http://www.w3.org/2005/xpath-functions/collation/codepoint", "wrong param")`. . */ @org.junit.Test public void kSubstringAfterFunc3() { final XQuery query = new XQuery( "substring-after((), (), \"http://www.w3.org/2005/xpath-functions/collation/codepoint\", \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `substring-after("a string", "a string", "http://www.example.com/COLLATION/NOT/SUPPORTED")`. . */ @org.junit.Test public void kSubstringAfterFunc4() { final XQuery query = new XQuery( "substring-after(\"a string\", \"a string\", \"http://www.example.com/COLLATION/NOT/SUPPORTED\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0002") ); } /** * A test whose essence is: `substring-after("foo", "fo", "http://www.w3.org/2005/xpath-functions/collation/codepoint") eq "o"`. . */ @org.junit.Test public void kSubstringAfterFunc5() { final XQuery query = new XQuery( "substring-after(\"foo\", \"fo\", \"http://www.w3.org/2005/xpath-functions/collation/codepoint\") eq \"o\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `substring-after("tattoo", "tat") eq "too"`. . */ @org.junit.Test public void kSubstringAfterFunc6() { final XQuery query = new XQuery( "substring-after(\"tattoo\", \"tat\") eq \"too\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `substring-after("tattoo", "tattoo") eq ""`. . */ @org.junit.Test public void kSubstringAfterFunc7() { final XQuery query = new XQuery( "substring-after(\"tattoo\", \"tattoo\") eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `substring-after("abcdefgedij", "def") eq "gedij"`. . */ @org.junit.Test public void kSubstringAfterFunc8() { final XQuery query = new XQuery( "substring-after(\"abcdefgedij\", \"def\") eq \"gedij\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `substring-after((), ()) eq ""`. . */ @org.junit.Test public void kSubstringAfterFunc9() { final XQuery query = new XQuery( "substring-after((), ()) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:substring-after with collation and empty string . */ @org.junit.Test public void cbclSubstringAfter001() { final XQuery query = new XQuery( "\n" + " fn:boolean(fn:substring-after('input', '', 'http://www.w3.org/2005/xpath-functions/collation/codepoint'))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "substring-after" function with the arguments set as follows: $arg1 = "" $arg2 = "" . */ @org.junit.Test public void fnSubstringAfter1() { final XQuery query = new XQuery( "fn:substring-after(\"\",\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * Evaluates The "substring-after" function with the arguments set as follows: $arg1 = " " $arg2 = " AAAAABBBBB" . */ @org.junit.Test public void fnSubstringAfter10() { final XQuery query = new XQuery( "fn:substring-after(\" \",\"AAAAABBBBB\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * Evaluates The "substring-after" function using it as a argument of a fn:not - returns true . */ @org.junit.Test public void fnSubstringAfter11() { final XQuery query = new XQuery( "fn:not(fn:substring-after(\"A\",\"A\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "substring-after" function using it as a argument of a fn:not - returns true . */ @org.junit.Test public void fnSubstringAfter12() { final XQuery query = new XQuery( "fn:not(fn:substring-after(\"A\",\"B\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "substring-after" function with the arguments set as follows: $arg1 = xs:string("A") $arg2 = "A" . */ @org.junit.Test public void fnSubstringAfter13() { final XQuery query = new XQuery( "fn:substring-after(xs:string(\"A\"),\"A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * Evaluates The "substring-after" function with the arguments set as follows: $arg1 = "A" $arg2 = xs:string("A") . */ @org.junit.Test public void fnSubstringAfter14() { final XQuery query = new XQuery( "fn:substring-after(\"A\",xs:string(\"A\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * Evaluates The "substring-after" function with the arguments set as follows: $arg1 = "A" $arg2 = "a" . */ @org.junit.Test public void fnSubstringAfter15() { final XQuery query = new XQuery( "fn:substring-after(\"A\",\"a\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * Evaluates The "substring-after" function with the arguments set as follows: $arg1 = "a" $arg2 = "A" . */ @org.junit.Test public void fnSubstringAfter16() { final XQuery query = new XQuery( "fn:substring-after(\"a\",\"A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * Evaluates The "substring-after" function with the arguments set as follows: $arg1 = "substring-after" $arg2 = "substring-after" . */ @org.junit.Test public void fnSubstringAfter17() { final XQuery query = new XQuery( "fn:substring-after(\"substring-after\",\"substring-after\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * Evaluates The "substring-after" function with the arguments set as follows: $arg1 = "substring-aftersubstring-after" $arg2 = "substring-after" . */ @org.junit.Test public void fnSubstringAfter18() { final XQuery query = new XQuery( "fn:substring-after(\"substring-aftersubstring-after\",\"substring-after\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "substring-after") ); } /** * Evaluates The "substring-after" function with the arguments set as follows: $arg1 = "****" $arg2 = "***" . */ @org.junit.Test public void fnSubstringAfter19() { final XQuery query = new XQuery( "fn:substring-after(\"****\",\"***\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "*") ); } /** * Evaluates The "substring-after" function with the arguments set as follows: $arg1 = "" $arg2 = "A Character String" . */ @org.junit.Test public void fnSubstringAfter2() { final XQuery query = new XQuery( "fn:substring-after(\"\",\"A Character String\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * Evaluates The "substring-after" function with the arguments set as follows: $arg1 = "12345" $arg2 = "1234" . */ @org.junit.Test public void fnSubstringAfter20() { final XQuery query = new XQuery( "fn:substring-after(\"12345\",\"1234\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5") ); } /** * Evaluates The "substring-after" function with the arguments set as follows: $arg1 = "substring-after $arg2 = "refta-gnirtsbus ("substring-after" backwards) . */ @org.junit.Test public void fnSubstringAfter21() { final XQuery query = new XQuery( "fn:substring-after(\"substring-after\",\"refta-gnirtsbus\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * Use absolute collation URI. */ @org.junit.Test public void fnSubstringAfter22() { final XQuery query = new XQuery( "substring-after(\"banana\", \"a\", \"http://www.w3.org/2005/xpath-functions/collation/codepoint\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"nana\"") ); } /** * Use relative collation URI. */ @org.junit.Test public void fnSubstringAfter23() { final XQuery query = new XQuery( "substring-after(\"banana\", \"a\", \"collation/codepoint\")", ctx); try { query.baseURI("http://www.w3.org/2005/xpath-functions/"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"nana\"") ); } /** * Use non-BMP characters. */ @org.junit.Test public void fnSubstringAfter25() { final XQuery query = new XQuery( "substring-after(\"ð€ð€‚ð€ƒ\", \"ð€‚\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"ð€ƒ\"") ); } /** * Evaluates The "substring-after" function with the arguments set as follows: $arg1 = "" $arg2 = "A Character String" . */ @org.junit.Test public void fnSubstringAfter3() { final XQuery query = new XQuery( "fn:substring-after(\"A Character String\",\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"A Character String\"") && assertCount(1) ) ); } /** * Evaluates The "substring-after" function with the arguments set as follows: $arg1 = () $arg2 = "" . */ @org.junit.Test public void fnSubstringAfter4() { final XQuery query = new XQuery( "fn:substring-after((),\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * Evaluates The "substring-after" function with the arguments set as follows: $arg1 = "" $arg2 = () . */ @org.junit.Test public void fnSubstringAfter5() { final XQuery query = new XQuery( "fn:substring-after(\"\",())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * Evaluates The "substring-after" function with the arguments set as follows: $arg1 = "A Character String" $arg2 = () . */ @org.junit.Test public void fnSubstringAfter6() { final XQuery query = new XQuery( "fn:substring-after(\"A Character String\",())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"A Character String\"") && assertCount(1) ) ); } /** * Evaluates The "substring-after" function with the arguments set as follows: $arg1 = () $arg2 = "A Character String" . */ @org.junit.Test public void fnSubstringAfter7() { final XQuery query = new XQuery( "fn:substring-after((),\"A Character String\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * Evaluates The "substring-after" function with the arguments set as follows: $arg1 = "AAAAABBBBBCCCCC" $arg2 = "BBBBB" . */ @org.junit.Test public void fnSubstringAfter8() { final XQuery query = new XQuery( "fn:substring-after(\"AAAAABBBBBCCCCC\",\"BBBBB\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "CCCCC") ); } /** * Evaluates The "substring-after" function with the arguments set as follows: $arg1 = "AAAAABBBBB" $arg2 = " " . */ @org.junit.Test public void fnSubstringAfter9() { final XQuery query = new XQuery( "fn:substring-after(\"AAAAABBBBB\",\" \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnSubstringBefore.java����������������0000664�0000000�0000000�00000045725�12224530032�0030353�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** . * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnSubstringBefore extends QT3TestSet { /** * K-SubstringBeforeFunc-1 A test whose essence is: `substring-before()`. . */ @org.junit.Test public void kSubstringBeforeFunc1() { final XQuery query = new XQuery( "substring-before()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * K-SubstringBeforeFunc-10 A test whose essence is: `substring-before("a string", "not in other") eq ""`. . */ @org.junit.Test public void kSubstringBeforeFunc10() { final XQuery query = new XQuery( "substring-before(\"a string\", \"not in other\") eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * K-SubstringBeforeFunc-2 A test whose essence is: `substring-before(())`. . */ @org.junit.Test public void kSubstringBeforeFunc2() { final XQuery query = new XQuery( "substring-before(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * K-SubstringBeforeFunc-3 A test whose essence is: `substring-before((), (), "http://www.w3.org/2005/xpath-functions/collation/codepoint", "wrong param")`. . */ @org.junit.Test public void kSubstringBeforeFunc3() { final XQuery query = new XQuery( "substring-before((), (), \"http://www.w3.org/2005/xpath-functions/collation/codepoint\",\n" + " \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * K-SubstringBeforeFunc-4 A test whose essence is: `substring-before("a string", "a string", "http://www.example.com/COLLATION/NOT/SUPPORTED")`. . */ @org.junit.Test public void kSubstringBeforeFunc4() { final XQuery query = new XQuery( "substring-before(\"a string\", \"a string\",\n" + " \"http://www.example.com/COLLATION/NOT/SUPPORTED\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0002") ); } /** * K-SubstringBeforeFunc-5 A test whose essence is: `substring-before("foo", "oo", "http://www.w3.org/2005/xpath-functions/collation/codepoint") eq "f"`. . */ @org.junit.Test public void kSubstringBeforeFunc5() { final XQuery query = new XQuery( "substring-before(\"foo\", \"oo\",\n" + " \"http://www.w3.org/2005/xpath-functions/collation/codepoint\") eq \"f\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * K-SubstringBeforeFunc-6 A test whose essence is: `substring-before("tattoo", "attoo") eq "t"`. . */ @org.junit.Test public void kSubstringBeforeFunc6() { final XQuery query = new XQuery( "substring-before(\"tattoo\", \"attoo\") eq \"t\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * K-SubstringBeforeFunc-7 A test whose essence is: `substring-before("tattoo", "tatto") eq ""`. . */ @org.junit.Test public void kSubstringBeforeFunc7() { final XQuery query = new XQuery( "substring-before(\"tattoo\", \"tatto\") eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * K-SubstringBeforeFunc-8 A test whose essence is: `substring-before((), ()) eq ""`. . */ @org.junit.Test public void kSubstringBeforeFunc8() { final XQuery query = new XQuery( "substring-before((), ()) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * K-SubstringBeforeFunc-9 A test whose essence is: `substring-before("a string", "") eq ""`. . */ @org.junit.Test public void kSubstringBeforeFunc9() { final XQuery query = new XQuery( "substring-before(\"a string\", \"\") eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:substring-before with collation and empty string . */ @org.junit.Test public void cbclSubstringBefore001() { final XQuery query = new XQuery( "\n" + " fn:boolean(fn:substring-before('input', '', 'http://www.w3.org/2005/xpath-functions/collation/codepoint'))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * fn-substring-before-1 Evaluates The "substring-before" function with the arguments set as follows: $arg1 = "" $arg2 = "" . */ @org.junit.Test public void fnSubstringBefore1() { final XQuery query = new XQuery( "fn:substring-before(\"\",\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * fn-substring-before-10 Evaluates The "substring-before" function with the arguments set as follows: $arg1 = " " $arg2 = " AAAAABBBBB" . */ @org.junit.Test public void fnSubstringBefore10() { final XQuery query = new XQuery( "fn:substring-before(\" \",\"AAAAABBBBB\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * fn-substring-before-11 Evaluates The "substring-before" function using it as a argument of a fn:not - returns true . */ @org.junit.Test public void fnSubstringBefore11() { final XQuery query = new XQuery( "fn:not(fn:substring-before(\"A\",\"A\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn-substring-before-12 Evaluates The "substring-before" function using it as a argument of a fn:not - returns true . */ @org.junit.Test public void fnSubstringBefore12() { final XQuery query = new XQuery( "fn:not(fn:substring-before(\"A\",\"B\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn-substring-before-13 Evaluates The "substring-before" function with the arguments set as follows: $arg1 = xs:string("A") $arg2 = "A" . */ @org.junit.Test public void fnSubstringBefore13() { final XQuery query = new XQuery( "fn:substring-before(xs:string(\"A\"),\"A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * fn-substring-before-14 Evaluates The "substring-before" function with the arguments set as follows: $arg1 = "A" $arg2 = xs:string("A") . */ @org.junit.Test public void fnSubstringBefore14() { final XQuery query = new XQuery( "fn:substring-before(\"A\",xs:string(\"A\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * fn-substring-before-15 Evaluates The "substring-before" function with the arguments set as follows: $arg1 = "A" $arg2 = "a" . */ @org.junit.Test public void fnSubstringBefore15() { final XQuery query = new XQuery( "fn:substring-before(\"A\",\"a\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * fn-substring-before-16 Evaluates The "substring-before" function with the arguments set as follows: $arg1 = "a" $arg2 = "A" . */ @org.junit.Test public void fnSubstringBefore16() { final XQuery query = new XQuery( "fn:substring-before(\"a\",\"A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * fn-substring-before-17 Evaluates The "substring-before" function with the arguments set as follows: $arg1 = "substring-before" $arg2 = "substring-before" . */ @org.junit.Test public void fnSubstringBefore17() { final XQuery query = new XQuery( "fn:substring-before(\"substring-before\",\"substring-before\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * fn-substring-before-18 Evaluates The "substring-before" function with the arguments set as follows: $arg1 = "substring-beforesubstring-before" $arg2 = "substring-before" . */ @org.junit.Test public void fnSubstringBefore18() { final XQuery query = new XQuery( "fn:substring-before(\"substring-beforesubstring-before\",\"substring-before\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * fn-substring-before-19 Evaluates The "substring-before" function with the arguments set as follows: $arg1 = "****" $arg2 = "***" . */ @org.junit.Test public void fnSubstringBefore19() { final XQuery query = new XQuery( "fn:substring-before(\"****\",\"***\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * fn-substring-before-2 Evaluates The "substring-before" function with the arguments set as follows: $arg1 = "" $arg2 = "A Character String" . */ @org.junit.Test public void fnSubstringBefore2() { final XQuery query = new XQuery( "fn:substring-before(\"\",\"A Character String\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * fn-substring-before-20 Evaluates The "substring-before" function with the arguments set as follows: $arg1 = "12345" $arg2 = "2345" . */ @org.junit.Test public void fnSubstringBefore20() { final XQuery query = new XQuery( "fn:substring-before(\"12345\",\"2345\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"1\"") && assertCount(1) ) ); } /** * fn-substring-before-21 Evaluates The "substring-before" function with the arguments set as follows: $arg1 = "substring-before $arg2 = "erofeb-gnirtsbus ("substring-before" backwards) . */ @org.junit.Test public void fnSubstringBefore21() { final XQuery query = new XQuery( "fn:substring-before(\"substring-before\",\"erofeb-gnirtsbus\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * Use absolute collation URI. */ @org.junit.Test public void fnSubstringBefore22() { final XQuery query = new XQuery( "substring-before(\"banana\", \"a\",\n" + " \"http://www.w3.org/2005/xpath-functions/collation/codepoint\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"b\"") ); } /** * Use relative collation URI. */ @org.junit.Test public void fnSubstringBefore23() { final XQuery query = new XQuery( "substring-before(\"banana\", \"a\", \"collation/codepoint\")", ctx); try { query.baseURI("http://www.w3.org/2005/xpath-functions/"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"b\"") ); } /** * Use non-BMP characters. */ @org.junit.Test public void fnSubstringBefore25() { final XQuery query = new XQuery( "substring-before(\"ð€ð€‚ð€ƒ\", \"ð€‚\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"ð€\"") ); } /** * fn-substring-before-3 Evaluates The "substring-before" function with the arguments set as follows: $arg1 = "" $arg2 = "A Character String" . */ @org.junit.Test public void fnSubstringBefore3() { final XQuery query = new XQuery( "fn:substring-before(\"A Character String\",\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * fn-substring-before-4 Evaluates The "substring-before" function with the arguments set as follows: $arg1 = () $arg2 = "" . */ @org.junit.Test public void fnSubstringBefore4() { final XQuery query = new XQuery( "fn:substring-before((),\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * fn-substring-before-5 Evaluates The "substring-before" function with the arguments set as follows: $arg1 = "" $arg2 = () . */ @org.junit.Test public void fnSubstringBefore5() { final XQuery query = new XQuery( "fn:substring-before(\"\",())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * fn-substring-before-6 Evaluates The "substring-before" function with the arguments set as follows: $arg1 = "A Character String" $arg2 = () . */ @org.junit.Test public void fnSubstringBefore6() { final XQuery query = new XQuery( "fn:substring-before(\"A Character String\",())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * fn-substring-before-7 Evaluates The "substring-before" function with the arguments set as follows: $arg1 = () $arg2 = "A Character String" . */ @org.junit.Test public void fnSubstringBefore7() { final XQuery query = new XQuery( "fn:substring-before((),\"A Character String\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } /** * fn-substring-before-8 Evaluates The "substring-before" function with the arguments set as follows: $arg1 = "AAAAABBBBBCCCCC" $arg2 = "BBBBB" . */ @org.junit.Test public void fnSubstringBefore8() { final XQuery query = new XQuery( "fn:substring-before(\"AAAAABBBBBCCCCC\",\"BBBBB\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "AAAAA") ); } /** * fn-substring-before-9 Evaluates The "substring-before" function with the arguments set as follows: $arg1 = "AAAAABBBBB" $arg2 = " " . */ @org.junit.Test public void fnSubstringBefore9() { final XQuery query = new XQuery( "fn:substring-before(\"AAAAABBBBB\",\" \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"\"") && assertCount(1) ) ); } } �������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnSum.java����������������������������0000664�0000000�0000000�00000352634�12224530032�0026014�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the sum() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnSum extends QT3TestSet { /** * A test whose essence is: `sum()`. . */ @org.junit.Test public void kSeqSUMFunc1() { final XQuery query = new XQuery( "sum()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `sum((-5, -0, -3, -6)) eq -14`. . */ @org.junit.Test public void kSeqSUMFunc10() { final XQuery query = new XQuery( "sum((-5, -0, -3, -6)) eq -14", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(sum((1, 2, 3, xs:float("NaN")))) eq "NaN"`. . */ @org.junit.Test public void kSeqSUMFunc11() { final XQuery query = new XQuery( "string(sum((1, 2, 3, xs:float(\"NaN\")))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(sum((1, 2, 3, xs:double("NaN")))) eq "NaN"`. . */ @org.junit.Test public void kSeqSUMFunc12() { final XQuery query = new XQuery( "string(sum((1, 2, 3, xs:double(\"NaN\")))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(sum((xs:double("NaN"), 1, 2, 3))) eq "NaN"`. . */ @org.junit.Test public void kSeqSUMFunc13() { final XQuery query = new XQuery( "string(sum((xs:double(\"NaN\"), 1, 2, 3))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(sum((xs:float("NaN"), 1, 2, 3))) eq "NaN"`. . */ @org.junit.Test public void kSeqSUMFunc14() { final XQuery query = new XQuery( "string(sum((xs:float(\"NaN\"), 1, 2, 3))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(sum((1, 2, xs:double("NaN"), 1, 2, 3))) eq "NaN"`. . */ @org.junit.Test public void kSeqSUMFunc15() { final XQuery query = new XQuery( "string(sum((1, 2, xs:double(\"NaN\"), 1, 2, 3))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(sum((1, 2, xs:float("NaN"), 1, 2, 3))) eq "NaN"`. . */ @org.junit.Test public void kSeqSUMFunc16() { final XQuery query = new XQuery( "string(sum((1, 2, xs:float(\"NaN\"), 1, 2, 3))) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `sum(xs:untypedAtomic("3")) instance of xs:double`. . */ @org.junit.Test public void kSeqSUMFunc17() { final XQuery query = new XQuery( "sum(xs:untypedAtomic(\"3\")) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `sum((1, 2, xs:untypedAtomic("3"))) instance of xs:double`. . */ @org.junit.Test public void kSeqSUMFunc18() { final XQuery query = new XQuery( "sum((1, 2, xs:untypedAtomic(\"3\"))) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `sum((1, 2, xs:untypedAtomic("3"))) eq 6`. . */ @org.junit.Test public void kSeqSUMFunc19() { final XQuery query = new XQuery( "sum((1, 2, xs:untypedAtomic(\"3\"))) eq 6", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `sum(1, 1, "wrong param")`. . */ @org.junit.Test public void kSeqSUMFunc2() { final XQuery query = new XQuery( "sum(1, 1, \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `sum((xs:float(1), 2, xs:untypedAtomic("3"))) eq 6`. . */ @org.junit.Test public void kSeqSUMFunc20() { final XQuery query = new XQuery( "sum((xs:float(1), 2, xs:untypedAtomic(\"3\"))) eq 6", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `sum((xs:float(1), 2, xs:untypedAtomic("3"))) instance of xs:double`. . */ @org.junit.Test public void kSeqSUMFunc21() { final XQuery query = new XQuery( "sum((xs:float(1), 2, xs:untypedAtomic(\"3\"))) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:sum() having an input sequence whose static type is xs:anyAtomicType. . */ @org.junit.Test public void kSeqSUMFunc22() { final XQuery query = new XQuery( "sum(remove((1.0, xs:float(1), 2, xs:untypedAtomic(\"3\")), 1)) eq 6", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `sum("a string")`. . */ @org.junit.Test public void kSeqSUMFunc23() { final XQuery query = new XQuery( "sum(\"a string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A test whose essence is: `sum(xs:anyURI("a string"))`. . */ @org.junit.Test public void kSeqSUMFunc24() { final XQuery query = new XQuery( "sum(xs:anyURI(\"a string\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A test whose essence is: `sum((1, 2, 3, xs:anyURI("a string"), xs:double("NaN")))`. . */ @org.junit.Test public void kSeqSUMFunc25() { final XQuery query = new XQuery( "sum((1, 2, 3, xs:anyURI(\"a string\"), xs:double(\"NaN\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A test whose essence is: `sum((1, 2, 3, xs:anyURI("a string"), xs:double("NaN")), 3)`. . */ @org.junit.Test public void kSeqSUMFunc26() { final XQuery query = new XQuery( "sum((1, 2, 3, xs:anyURI(\"a string\"), xs:double(\"NaN\")), 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A test whose essence is: `sum(((),())) eq 0`. . */ @org.junit.Test public void kSeqSUMFunc27() { final XQuery query = new XQuery( "sum(((),())) eq 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `sum(()) eq 0`. . */ @org.junit.Test public void kSeqSUMFunc28() { final XQuery query = new XQuery( "sum(()) eq 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `sum((3, 4, 5)) eq 12`. . */ @org.junit.Test public void kSeqSUMFunc29() { final XQuery query = new XQuery( "sum((3, 4, 5)) eq 12", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `sum((), 3) eq 3`. . */ @org.junit.Test public void kSeqSUMFunc3() { final XQuery query = new XQuery( "sum((), 3) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `sum((xs:yearMonthDuration("P20Y"), xs:yearMonthDuration("P10M"))) eq xs:yearMonthDuration("P250M")`. . */ @org.junit.Test public void kSeqSUMFunc30() { final XQuery query = new XQuery( "sum((xs:yearMonthDuration(\"P20Y\"), xs:yearMonthDuration(\"P10M\"))) eq xs:yearMonthDuration(\"P250M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `sum((xs:yearMonthDuration("P20Y"), xs:yearMonthDuration("P10M")) [. < xs:yearMonthDuration("P3M")], xs:yearMonthDuration("P0M")) eq xs:yearMonthDuration("P0M")`. . */ @org.junit.Test public void kSeqSUMFunc31() { final XQuery query = new XQuery( "sum((xs:yearMonthDuration(\"P20Y\"), xs:yearMonthDuration(\"P10M\")) [. < xs:yearMonthDuration(\"P3M\")], xs:yearMonthDuration(\"P0M\")) eq xs:yearMonthDuration(\"P0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `sum((1 to 100)[. < 0], 0) eq 0`. . */ @org.junit.Test public void kSeqSUMFunc32() { final XQuery query = new XQuery( "sum((1 to 100)[. < 0], 0) eq 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `sum((xs:yearMonthDuration("P20Y"), (3, 4, 5)))`. . */ @org.junit.Test public void kSeqSUMFunc33() { final XQuery query = new XQuery( "sum((xs:yearMonthDuration(\"P20Y\"), (3, 4, 5)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A test whose essence is: `sum((), 3) instance of xs:integer`. . */ @org.junit.Test public void kSeqSUMFunc4() { final XQuery query = new XQuery( "sum((), 3) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(sum((), ()))`. . */ @org.junit.Test public void kSeqSUMFunc5() { final XQuery query = new XQuery( "empty(sum((), ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `sum((), 0.0) instance of xs:decimal`. . */ @org.junit.Test public void kSeqSUMFunc6() { final XQuery query = new XQuery( "sum((), 0.0) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `sum((), 0.0) eq 0.0`. . */ @org.junit.Test public void kSeqSUMFunc7() { final XQuery query = new XQuery( "sum((), 0.0) eq 0.0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `sum(()) eq 0`. . */ @org.junit.Test public void kSeqSUMFunc8() { final XQuery query = new XQuery( "sum(()) eq 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `sum(()) instance of xs:integer`. . */ @org.junit.Test public void kSeqSUMFunc9() { final XQuery query = new XQuery( "sum(()) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Pass in an empty sequence as zero. . */ @org.junit.Test public void k2SeqSUMFunc1() { final XQuery query = new XQuery( "sum((), ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Ensure the return type is correct when type promotion is required. . */ @org.junit.Test public void k2SeqSUMFunc2() { final XQuery query = new XQuery( "sum((xs:float('NaN'), 2, 3, 4, xs:double('NaN'))) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is correct when type promotion is required(#2). . */ @org.junit.Test public void k2SeqSUMFunc3() { final XQuery query = new XQuery( "sum((xs:float('NaN'), 2, 3.3, 4, xs:double('NaN'))) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the return type is properly inferred. . */ @org.junit.Test public void k2SeqSUMFunc4() { final XQuery query = new XQuery( "sum(xs:unsignedShort(\"1\")) instance of xs:unsignedShort", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test sum(1 to 10) . */ @org.junit.Test public void cbclSumFunc001() { final XQuery query = new XQuery( "sum(1 to 10)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "55") ); } /** * Test sum(foreach) . */ @org.junit.Test public void cbclSumFunc002() { final XQuery query = new XQuery( "sum(for $x in 1 to 10 return 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "50") ); } /** * Test sum($x to $y) . */ @org.junit.Test public void cbclSumFunc003() { final XQuery query = new XQuery( "\n" + " for $x in 1 to 10, $y in 1 to 10 return concat('sum(',$x,' to ',$y,') = ',sum($x to $y))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "sum(1 to 1) = 1 sum(1 to 2) = 3 sum(1 to 3) = 6 sum(1 to 4) = 10 sum(1 to 5) = 15 sum(1 to 6) = 21 sum(1 to 7) = 28 sum(1 to 8) = 36 sum(1 to 9) = 45 sum(1 to 10) = 55 sum(2 to 1) = 0 sum(2 to 2) = 2 sum(2 to 3) = 5 sum(2 to 4) = 9 sum(2 to 5) = 14 sum(2 to 6) = 20 sum(2 to 7) = 27 sum(2 to 8) = 35 sum(2 to 9) = 44 sum(2 to 10) = 54 sum(3 to 1) = 0 sum(3 to 2) = 0 sum(3 to 3) = 3 sum(3 to 4) = 7 sum(3 to 5) = 12 sum(3 to 6) = 18 sum(3 to 7) = 25 sum(3 to 8) = 33 sum(3 to 9) = 42 sum(3 to 10) = 52 sum(4 to 1) = 0 sum(4 to 2) = 0 sum(4 to 3) = 0 sum(4 to 4) = 4 sum(4 to 5) = 9 sum(4 to 6) = 15 sum(4 to 7) = 22 sum(4 to 8) = 30 sum(4 to 9) = 39 sum(4 to 10) = 49 sum(5 to 1) = 0 sum(5 to 2) = 0 sum(5 to 3) = 0 sum(5 to 4) = 0 sum(5 to 5) = 5 sum(5 to 6) = 11 sum(5 to 7) = 18 sum(5 to 8) = 26 sum(5 to 9) = 35 sum(5 to 10) = 45 sum(6 to 1) = 0 sum(6 to 2) = 0 sum(6 to 3) = 0 sum(6 to 4) = 0 sum(6 to 5) = 0 sum(6 to 6) = 6 sum(6 to 7) = 13 sum(6 to 8) = 21 sum(6 to 9) = 30 sum(6 to 10) = 40 sum(7 to 1) = 0 sum(7 to 2) = 0 sum(7 to 3) = 0 sum(7 to 4) = 0 sum(7 to 5) = 0 sum(7 to 6) = 0 sum(7 to 7) = 7 sum(7 to 8) = 15 sum(7 to 9) = 24 sum(7 to 10) = 34 sum(8 to 1) = 0 sum(8 to 2) = 0 sum(8 to 3) = 0 sum(8 to 4) = 0 sum(8 to 5) = 0 sum(8 to 6) = 0 sum(8 to 7) = 0 sum(8 to 8) = 8 sum(8 to 9) = 17 sum(8 to 10) = 27 sum(9 to 1) = 0 sum(9 to 2) = 0 sum(9 to 3) = 0 sum(9 to 4) = 0 sum(9 to 5) = 0 sum(9 to 6) = 0 sum(9 to 7) = 0 sum(9 to 8) = 0 sum(9 to 9) = 9 sum(9 to 10) = 19 sum(10 to 1) = 0 sum(10 to 2) = 0 sum(10 to 3) = 0 sum(10 to 4) = 0 sum(10 to 5) = 0 sum(10 to 6) = 0 sum(10 to 7) = 0 sum(10 to 8) = 0 sum(10 to 9) = 0 sum(10 to 10) = 10") ); } /** * Tests boolean call to sum . */ @org.junit.Test public void cbclSumFunc004() { final XQuery query = new XQuery( "boolean(sum((1 to 10)[. mod 2 = 0]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Tests sum of a sum . */ @org.junit.Test public void cbclSumFunc005() { final XQuery query = new XQuery( "sum(sum((1 to 10)[. mod 2 = 0],()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "30") ); } /** * Tests sum of two integer converts to plus . */ @org.junit.Test public void cbclSumFunc006() { final XQuery query = new XQuery( "sum((1,exactly-one((1 to 10)[. div 2 = 2])))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5") ); } /** * Test fn:sum on a sequence of xs:dayTimeDuration arguments . */ @org.junit.Test public void fnSum1() { final XQuery query = new XQuery( "sum((xs:dayTimeDuration(\"P1D\"), xs:dayTimeDuration(\"PT1H\"))) instance of xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test fn:sum on a sequence of xs:duration arguments . */ @org.junit.Test public void fnSum10() { final XQuery query = new XQuery( "sum(xs:duration(\"P1Y1M1D\"), xs:duration(\"PT0S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FORG0006") || error("XPTY0004") ) ); } /** * Test fn:sum on a sequence of xs:dayTimeDuration arguments . */ @org.junit.Test public void fnSum2() { final XQuery query = new XQuery( "sum((), xs:dayTimeDuration(\"PT0S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Test fn:sum on a sequence of xs:dayTimeDuration arguments . */ @org.junit.Test public void fnSum3() { final XQuery query = new XQuery( "sum(for $x in 1 to 10 return xs:dayTimeDuration(concat(\"PT\",$x,\"H\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P2DT7H") ); } /** * Test fn:sum on a sequence of xs:yearMonthDuration arguments . */ @org.junit.Test public void fnSum4() { final XQuery query = new XQuery( "sum((xs:yearMonthDuration(\"P1Y\"), xs:yearMonthDuration(\"P1M\"))) instance of xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test fn:sum on a sequence of xs:yearMonthDuration arguments . */ @org.junit.Test public void fnSum5() { final XQuery query = new XQuery( "sum((), xs:yearMonthDuration(\"P0M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P0M") ); } /** * Test fn:sum on a sequence of xs:yearMonthDuration arguments . */ @org.junit.Test public void fnSum6() { final XQuery query = new XQuery( "sum(for $x in 1 to 10 return xs:yearMonthDuration(concat(\"P\",$x,\"M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P4Y7M") ); } /** * Test fn:sum on a sequence of xs:yearMonthDuration and xs:dayTimeDuration arguments . */ @org.junit.Test public void fnSum7() { final XQuery query = new XQuery( "sum((xs:yearMonthDuration(\"P1Y\"), xs:dayTimeDuration(\"P1D\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FORG0006") || error("XPTY0004") ) ); } /** * Test fn:sum with $zero as xs:duration . */ @org.junit.Test public void fnSum8() { final XQuery query = new XQuery( "sum((), xs:duration(\"P0M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Test fn:sum on a sequence of xs:duration arguments . */ @org.junit.Test public void fnSum9() { final XQuery query = new XQuery( "sum(xs:duration(\"P1Y1M1D\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FORG0006") || error("XPTY0004") ) ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:double(lower bound) . */ @org.junit.Test public void fnSumdbl1args1() { final XQuery query = new XQuery( "fn:sum((xs:double(\"-1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.7976931348623157E308") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:double(mid range) . */ @org.junit.Test public void fnSumdbl1args2() { final XQuery query = new XQuery( "fn:sum((xs:double(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:double(upper bound) . */ @org.junit.Test public void fnSumdbl1args3() { final XQuery query = new XQuery( "fn:sum((xs:double(\"1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.7976931348623157E308") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:double(mid range) $zero = xs:double(lower bound) . */ @org.junit.Test public void fnSumdbl2args1() { final XQuery query = new XQuery( "fn:sum((xs:double(\"0\"),xs:double(\"-1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.7976931348623157E308") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:double(upper bound) $zero = xs:double(lower bound) . */ @org.junit.Test public void fnSumdbl2args2() { final XQuery query = new XQuery( "fn:sum((xs:double(\"1.7976931348623157E308\"),xs:double(\"-1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:double(lower bound) $zero = xs:double(mid range) . */ @org.junit.Test public void fnSumdbl2args3() { final XQuery query = new XQuery( "fn:sum((xs:double(\"-1.7976931348623157E308\"),xs:double(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.7976931348623157E308") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:double(lower bound) $zero = xs:double(upper bound) . */ @org.junit.Test public void fnSumdbl2args4() { final XQuery query = new XQuery( "fn:sum((xs:double(\"-1.7976931348623157E308\"),xs:double(\"1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:double(mid range) $arg2 = xs:double(lower bound) $zero = xs:double(lower bound) . */ @org.junit.Test public void fnSumdbl3args1() { final XQuery query = new XQuery( "fn:sum((xs:double(\"0\"),xs:double(\"-1.7976931348623157E308\"),xs:double(\"-1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "-INF") || error("FOAR0002") ) ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:double(upper bound) $arg2 = xs:double(lower bound) $zero = xs:double(lower bound) . */ @org.junit.Test public void fnSumdbl3args2() { final XQuery query = new XQuery( "fn:sum((xs:double(\"1.7976931348623157E308\"),xs:double(\"-1.7976931348623157E308\"),xs:double(\"-1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.7976931348623157E308") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(mid range) $zero = xs:double(lower bound) . */ @org.junit.Test public void fnSumdbl3args3() { final XQuery query = new XQuery( "fn:sum((xs:double(\"-1.7976931348623157E308\"),xs:double(\"0\"),xs:double(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.7976931348623157E308") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(upper bound) $zero = xs:double(lower bound) . */ @org.junit.Test public void fnSumdbl3args4() { final XQuery query = new XQuery( "fn:sum((xs:double(\"-1.7976931348623157E308\"),xs:double(\"1.7976931348623157E308\"),xs:double(\"-1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.7976931348623157E308") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(lower bound) $zero = xs:double(mid range) . */ @org.junit.Test public void fnSumdbl3args5() { final XQuery query = new XQuery( "fn:sum((xs:double(\"0\"),xs:double(\"0\"),xs:double(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(lower bound) $zero = xs:double(upper bound) . */ @org.junit.Test public void fnSumdbl3args6() { final XQuery query = new XQuery( "fn:sum((xs:double(\"-1.7976931348623157E308\"),xs:double(\"-1.7976931348623157E308\"),xs:double(\"1.7976931348623157E308\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "-INF") || assertEq("-1.7976931348623157E308") || error("FOAR0002") ) ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:decimal(lower bound) . */ @org.junit.Test public void fnSumdec1args1() { final XQuery query = new XQuery( "fn:sum((xs:decimal(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:decimal(mid range) . */ @org.junit.Test public void fnSumdec1args2() { final XQuery query = new XQuery( "fn:sum((xs:decimal(\"617375191608514839\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("617375191608514839") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:decimal(upper bound) . */ @org.junit.Test public void fnSumdec1args3() { final XQuery query = new XQuery( "fn:sum((xs:decimal(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:decimal(mid range) $zero = xs:decimal(lower bound) . */ @org.junit.Test public void fnSumdec2args1() { final XQuery query = new XQuery( "fn:sum((xs:decimal(\"617375191608514839\"),xs:decimal(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-382624808391485160") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:decimal(upper bound) $zero = xs:decimal(lower bound) . */ @org.junit.Test public void fnSumdec2args2() { final XQuery query = new XQuery( "fn:sum((xs:decimal(\"999999999999999999\"),xs:decimal(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:decimal(lower bound) $zero = xs:decimal(mid range) . */ @org.junit.Test public void fnSumdec2args3() { final XQuery query = new XQuery( "fn:sum((xs:decimal(\"-999999999999999999\"),xs:decimal(\"617375191608514839\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-382624808391485160") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:decimal(lower bound) $zero = xs:decimal(upper bound) . */ @org.junit.Test public void fnSumdec2args4() { final XQuery query = new XQuery( "fn:sum((xs:decimal(\"-999999999999999999\"),xs:decimal(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:decimal(upper bound) $arg2 = xs:decimal(lower bound) $zero = xs:decimal(lower bound) . */ @org.junit.Test public void fnSumdec3args1() { final XQuery query = new XQuery( "fn:sum((xs:decimal(\"999999999999999999\"),xs:decimal(\"-999999999999999999\"),xs:decimal(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(upper bound) $zero = xs:decimal(lower bound) . */ @org.junit.Test public void fnSumdec3args2() { final XQuery query = new XQuery( "fn:sum((xs:decimal(\"-999999999999999999\"),xs:decimal(\"999999999999999999\"),xs:decimal(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(lower bound) $zero = xs:decimal(mid range) . */ @org.junit.Test public void fnSumdec3args3() { final XQuery query = new XQuery( "fn:sum((xs:decimal(\"0\"),xs:decimal(\"0\"),xs:decimal(\"617375191608514839\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("617375191608514839") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(lower bound) $zero = xs:decimal(upper bound) . */ @org.junit.Test public void fnSumdec3args4() { final XQuery query = new XQuery( "fn:sum((xs:decimal(\"-999999999999999999\"),xs:decimal(\"-999999999999999999\"),xs:decimal(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:float(lower bound) . */ @org.junit.Test public void fnSumflt1args1() { final XQuery query = new XQuery( "fn:sum((xs:float(\"-3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(\"-3.4028235E38\")") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:float(mid range) . */ @org.junit.Test public void fnSumflt1args2() { final XQuery query = new XQuery( "fn:sum((xs:float(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:float(upper bound) . */ @org.junit.Test public void fnSumflt1args3() { final XQuery query = new XQuery( "fn:sum((xs:float(\"3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(\"3.4028235E38\")") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:float(mid range) $zero = xs:float(lower bound) . */ @org.junit.Test public void fnSumflt2args1() { final XQuery query = new XQuery( "fn:sum((xs:float(\"0\"),xs:float(\"-3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(\"-3.4028235E38\")") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:float(upper bound) $zero = xs:float(lower bound) . */ @org.junit.Test public void fnSumflt2args2() { final XQuery query = new XQuery( "fn:sum((xs:float(\"3.4028235E38\"),xs:float(\"-3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:float(lower bound) $zero = xs:float(mid range) . */ @org.junit.Test public void fnSumflt2args3() { final XQuery query = new XQuery( "fn:sum((xs:float(\"-3.4028235E38\"),xs:float(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(\"-3.4028235E38\")") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:float(lower bound) $zero = xs:float(upper bound) . */ @org.junit.Test public void fnSumflt2args4() { final XQuery query = new XQuery( "fn:sum((xs:float(\"-3.4028235E38\"),xs:float(\"3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:float(mid range) $arg2 = xs:float(lower bound) $zero = xs:float(lower bound) . */ @org.junit.Test public void fnSumflt3args1() { final XQuery query = new XQuery( "fn:sum((xs:float(\"0\"),xs:float(\"-3.4028235E38\"),xs:float(\"-3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "-INF") || error("FOAR0002") ) ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:float(upper bound) $arg2 = xs:float(lower bound) $zero = xs:float(lower bound) . */ @org.junit.Test public void fnSumflt3args2() { final XQuery query = new XQuery( "fn:sum((xs:float(\"3.4028235E38\"),xs:float(\"-3.4028235E38\"),xs:float(\"-3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(\"-3.4028235E38\")") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(mid range) $zero = xs:float(lower bound) . */ @org.junit.Test public void fnSumflt3args3() { final XQuery query = new XQuery( "fn:sum((xs:float(\"-3.4028235E38\"),xs:float(\"0\"),xs:float(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(\"-3.4028235E38\")") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(upper bound) $zero = xs:float(lower bound) . */ @org.junit.Test public void fnSumflt3args4() { final XQuery query = new XQuery( "fn:sum((xs:float(\"-3.4028235E38\"),xs:float(\"3.4028235E38\"),xs:float(\"-3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(\"-3.4028235E38\")") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(lower bound) $zero = xs:float(mid range) . */ @org.junit.Test public void fnSumflt3args5() { final XQuery query = new XQuery( "fn:sum((xs:float(\"0\"),xs:float(\"0\"),xs:float(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(lower bound) $zero = xs:float(upper bound) . */ @org.junit.Test public void fnSumflt3args6() { final XQuery query = new XQuery( "fn:sum((xs:float(\"-3.4028235E38\"),xs:float(\"-3.4028235E38\"),xs:float(\"3.4028235E38\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "-INF") || assertEq("xs:float(\"-3.4028235E38\")") || error("FOAR0002") ) ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:int(lower bound) . */ @org.junit.Test public void fnSumint1args1() { final XQuery query = new XQuery( "fn:sum((xs:int(\"-2147483648\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2147483648") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:int(mid range) . */ @org.junit.Test public void fnSumint1args2() { final XQuery query = new XQuery( "fn:sum((xs:int(\"-1873914410\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1873914410") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:int(upper bound) . */ @org.junit.Test public void fnSumint1args3() { final XQuery query = new XQuery( "fn:sum((xs:int(\"2147483647\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2147483647") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:int(mid range) $zero = xs:int(lower bound) . */ @org.junit.Test public void fnSumint2args1() { final XQuery query = new XQuery( "fn:sum((xs:int(\"-1873914410\"),xs:int(\"-273569238\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2147483648") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:int(upper bound) $zero = xs:int(lower bound) . */ @org.junit.Test public void fnSumint2args2() { final XQuery query = new XQuery( "fn:sum((xs:int(\"2147483647\"),xs:int(\"-2147483648\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:int(lower bound) $zero = xs:int(mid range) . */ @org.junit.Test public void fnSumint2args3() { final XQuery query = new XQuery( "fn:sum((xs:int(\"-273569238\"),xs:int(\"-1873914410\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2147483648") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:int(lower bound) $zero = xs:int(upper bound) . */ @org.junit.Test public void fnSumint2args4() { final XQuery query = new XQuery( "fn:sum((xs:int(\"-2147483648\"),xs:int(\"2147483647\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:int(mid range) $arg2 = xs:int(lower bound) $zero = xs:int(lower bound) . */ @org.junit.Test public void fnSumint3args1() { final XQuery query = new XQuery( "fn:sum((xs:int(\"-1873914410\"),xs:int(\"-273569238\"),xs:int(\"-273569238\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2421052886") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(mid range) $zero = xs:int(lower bound) . */ @org.junit.Test public void fnSumint3args2() { final XQuery query = new XQuery( "fn:sum((xs:int(\"-273569238\"),xs:int(\"-1873914410\"),xs:int(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2147483648") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(lower bound) $zero = xs:int(mid range) . */ @org.junit.Test public void fnSumint3args3() { final XQuery query = new XQuery( "fn:sum((xs:int(\"0\"),xs:int(\"0\"),xs:int(\"-1873914410\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1873914410") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(lower bound) $zero = xs:int(upper bound) . */ @org.junit.Test public void fnSumint3args4() { final XQuery query = new XQuery( "fn:sum((xs:int(\"0\"),xs:int(\"0\"),xs:int(\"2147483647\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2147483647") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:integer(lower bound) . */ @org.junit.Test public void fnSumintg1args1() { final XQuery query = new XQuery( "fn:sum((xs:integer(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:integer(mid range) . */ @org.junit.Test public void fnSumintg1args2() { final XQuery query = new XQuery( "fn:sum((xs:integer(\"830993497117024304\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("830993497117024304") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:integer(upper bound) . */ @org.junit.Test public void fnSumintg1args3() { final XQuery query = new XQuery( "fn:sum((xs:integer(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:integer(mid range) $zero = xs:integer(lower bound) . */ @org.junit.Test public void fnSumintg2args1() { final XQuery query = new XQuery( "fn:sum((xs:integer(\"830993497117024304\"),xs:integer(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-169006502882975695") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:integer(upper bound) $zero = xs:integer(lower bound) . */ @org.junit.Test public void fnSumintg2args2() { final XQuery query = new XQuery( "fn:sum((xs:integer(\"999999999999999999\"),xs:integer(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:integer(lower bound) $zero = xs:integer(mid range) . */ @org.junit.Test public void fnSumintg2args3() { final XQuery query = new XQuery( "fn:sum((xs:integer(\"-999999999999999999\"),xs:integer(\"830993497117024304\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-169006502882975695") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:integer(lower bound) $zero = xs:integer(upper bound) . */ @org.junit.Test public void fnSumintg2args4() { final XQuery query = new XQuery( "fn:sum((xs:integer(\"-999999999999999999\"),xs:integer(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:integer(upper bound) $arg2 = xs:integer(lower bound) $zero = xs:integer(lower bound) . */ @org.junit.Test public void fnSumintg3args1() { final XQuery query = new XQuery( "fn:sum((xs:integer(\"999999999999999999\"),xs:integer(\"-999999999999999999\"),xs:integer(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(upper bound) $zero = xs:integer(lower bound) . */ @org.junit.Test public void fnSumintg3args2() { final XQuery query = new XQuery( "fn:sum((xs:integer(\"-999999999999999999\"),xs:integer(\"999999999999999999\"),xs:integer(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(lower bound) $zero = xs:integer(mid range) . */ @org.junit.Test public void fnSumintg3args3() { final XQuery query = new XQuery( "fn:sum((xs:integer(\"0\"),xs:integer(\"0\"),xs:integer(\"830993497117024304\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("830993497117024304") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(lower bound) $zero = xs:integer(upper bound) . */ @org.junit.Test public void fnSumintg3args4() { final XQuery query = new XQuery( "fn:sum((xs:integer(\"-999999999999999999\"),xs:integer(\"-999999999999999999\"),xs:integer(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:long(lower bound) . */ @org.junit.Test public void fnSumlng1args1() { final XQuery query = new XQuery( "fn:sum((xs:long(\"-92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:long(mid range) . */ @org.junit.Test public void fnSumlng1args2() { final XQuery query = new XQuery( "fn:sum((xs:long(\"-47175562203048468\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-47175562203048468") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:long(upper bound) . */ @org.junit.Test public void fnSumlng1args3() { final XQuery query = new XQuery( "fn:sum((xs:long(\"92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("92233720368547758") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:long(mid range) $zero = xs:long(lower bound) . */ @org.junit.Test public void fnSumlng2args1() { final XQuery query = new XQuery( "fn:sum((xs:long(\"-47175562203048468\"),xs:long(\"-45058158165499290\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:long(upper bound) $zero = xs:long(lower bound) . */ @org.junit.Test public void fnSumlng2args2() { final XQuery query = new XQuery( "fn:sum((xs:long(\"92233720368547758\"),xs:long(\"-92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:long(lower bound) $zero = xs:long(mid range) . */ @org.junit.Test public void fnSumlng2args3() { final XQuery query = new XQuery( "fn:sum((xs:long(\"-45058158165499290\"),xs:long(\"-47175562203048468\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:long(lower bound) $zero = xs:long(upper bound) . */ @org.junit.Test public void fnSumlng2args4() { final XQuery query = new XQuery( "fn:sum((xs:long(\"-92233720368547758\"),xs:long(\"92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:long(mid range) $arg2 = xs:long(lower bound) $zero = xs:long(lower bound) . */ @org.junit.Test public void fnSumlng3args1() { final XQuery query = new XQuery( "fn:sum((xs:long(\"-47175562203048468\"),xs:long(\"-45058158165499290\"),xs:long(\"-45058158165499290\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-137291878534047048") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:long(upper bound) $arg2 = xs:long(lower bound) $zero = xs:long(lower bound) . */ @org.junit.Test public void fnSumlng3args2() { final XQuery query = new XQuery( "fn:sum((xs:long(\"92233720368547758\"),xs:long(\"-92233720368547758\"),xs:long(\"-92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(mid range) $zero = xs:long(lower bound) . */ @org.junit.Test public void fnSumlng3args3() { final XQuery query = new XQuery( "fn:sum((xs:long(\"-45058158165499290\"),xs:long(\"-47175562203048468\"),xs:long(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(upper bound) $zero = xs:long(lower bound) . */ @org.junit.Test public void fnSumlng3args4() { final XQuery query = new XQuery( "fn:sum((xs:long(\"-92233720368547758\"),xs:long(\"92233720368547758\"),xs:long(\"-92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(lower bound) $zero = xs:long(mid range) . */ @org.junit.Test public void fnSumlng3args5() { final XQuery query = new XQuery( "fn:sum((xs:long(\"0\"),xs:long(\"0\"),xs:long(\"-47175562203048468\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-47175562203048468") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(lower bound) $zero = xs:long(upper bound) . */ @org.junit.Test public void fnSumlng3args6() { final XQuery query = new XQuery( "fn:sum((xs:long(\"-92233720368547758\"),xs:long(\"-92233720368547758\"),xs:long(\"92233720368547758\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnSumnint1args1() { final XQuery query = new XQuery( "fn:sum((xs:negativeInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnSumnint1args2() { final XQuery query = new XQuery( "fn:sum((xs:negativeInteger(\"-297014075999096793\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-297014075999096793") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnSumnint1args3() { final XQuery query = new XQuery( "fn:sum((xs:negativeInteger(\"-1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:negativeInteger(mid range) $zero = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnSumnint2args1() { final XQuery query = new XQuery( "fn:sum((xs:negativeInteger(\"-297014075999096793\"),xs:negativeInteger(\"-702985924000903206\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:negativeInteger(upper bound) $zero = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnSumnint2args2() { final XQuery query = new XQuery( "fn:sum((xs:negativeInteger(\"-1\"),xs:negativeInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1000000000000000000") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:negativeInteger(lower bound) $zero = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnSumnint2args3() { final XQuery query = new XQuery( "fn:sum((xs:negativeInteger(\"-702985924000903206\"),xs:negativeInteger(\"-297014075999096793\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:negativeInteger(lower bound) $zero = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnSumnint2args4() { final XQuery query = new XQuery( "fn:sum((xs:negativeInteger(\"-999999999999999999\"),xs:negativeInteger(\"-1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1000000000000000000") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:negativeInteger(mid range) $arg2 = xs:negativeInteger(lower bound) $zero = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnSumnint3args1() { final XQuery query = new XQuery( "fn:sum((xs:negativeInteger(\"-297014075999096793\"),xs:negativeInteger(\"-702985924000903206\"),xs:negativeInteger(\"-702985924000903206\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1702985924000903205") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:negativeInteger(upper bound) $arg2 = xs:negativeInteger(lower bound) $zero = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnSumnint3args2() { final XQuery query = new XQuery( "fn:sum((xs:negativeInteger(\"-1\"),xs:negativeInteger(\"-999999999999999999\"),xs:negativeInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnSumnni1args1() { final XQuery query = new XQuery( "fn:sum((xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnSumnni1args2() { final XQuery query = new XQuery( "fn:sum((xs:nonNegativeInteger(\"303884545991464527\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("303884545991464527") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnSumnni1args3() { final XQuery query = new XQuery( "fn:sum((xs:nonNegativeInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:nonNegativeInteger(lower bound) $zero = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnSumnni2args1() { final XQuery query = new XQuery( "fn:sum((xs:nonNegativeInteger(\"0\"),xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:nonNegativeInteger(mid range) $zero = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnSumnni2args2() { final XQuery query = new XQuery( "fn:sum((xs:nonNegativeInteger(\"303884545991464527\"),xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("303884545991464527") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:nonNegativeInteger(upper bound) $zero = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnSumnni2args3() { final XQuery query = new XQuery( "fn:sum((xs:nonNegativeInteger(\"999999999999999999\"),xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:nonNegativeInteger(lower bound) $zero = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnSumnni2args4() { final XQuery query = new XQuery( "fn:sum((xs:nonNegativeInteger(\"0\"),xs:nonNegativeInteger(\"303884545991464527\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("303884545991464527") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:nonNegativeInteger(lower bound) $zero = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnSumnni2args5() { final XQuery query = new XQuery( "fn:sum((xs:nonNegativeInteger(\"0\"),xs:nonNegativeInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(lower bound) $zero = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnSumnni3args1() { final XQuery query = new XQuery( "fn:sum((xs:nonNegativeInteger(\"0\"),xs:nonNegativeInteger(\"0\"),xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:nonNegativeInteger(mid range) $arg2 = xs:nonNegativeInteger(lower bound) $zero = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnSumnni3args2() { final XQuery query = new XQuery( "fn:sum((xs:nonNegativeInteger(\"303884545991464527\"),xs:nonNegativeInteger(\"0\"),xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("303884545991464527") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:nonNegativeInteger(upper bound) $arg2 = xs:nonNegativeInteger(lower bound) $zero = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnSumnni3args3() { final XQuery query = new XQuery( "fn:sum((xs:nonNegativeInteger(\"999999999999999999\"),xs:nonNegativeInteger(\"0\"),xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(mid range) $zero = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnSumnni3args4() { final XQuery query = new XQuery( "fn:sum((xs:nonNegativeInteger(\"0\"),xs:nonNegativeInteger(\"303884545991464527\"),xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("303884545991464527") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(upper bound) $zero = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnSumnni3args5() { final XQuery query = new XQuery( "fn:sum((xs:nonNegativeInteger(\"0\"),xs:nonNegativeInteger(\"999999999999999999\"),xs:nonNegativeInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(lower bound) $zero = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnSumnni3args6() { final XQuery query = new XQuery( "fn:sum((xs:nonNegativeInteger(\"0\"),xs:nonNegativeInteger(\"0\"),xs:nonNegativeInteger(\"303884545991464527\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("303884545991464527") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(lower bound) $zero = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnSumnni3args7() { final XQuery query = new XQuery( "fn:sum((xs:nonNegativeInteger(\"0\"),xs:nonNegativeInteger(\"0\"),xs:nonNegativeInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnSumnpi1args1() { final XQuery query = new XQuery( "fn:sum((xs:nonPositiveInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnSumnpi1args2() { final XQuery query = new XQuery( "fn:sum((xs:nonPositiveInteger(\"-475688437271870490\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-475688437271870490") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnSumnpi1args3() { final XQuery query = new XQuery( "fn:sum((xs:nonPositiveInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:nonPositiveInteger(mid range) $zero = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnSumnpi2args1() { final XQuery query = new XQuery( "fn:sum((xs:nonPositiveInteger(\"-475688437271870490\"),xs:nonPositiveInteger(\"-524311562728129509\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:nonPositiveInteger(upper bound) $zero = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnSumnpi2args2() { final XQuery query = new XQuery( "fn:sum((xs:nonPositiveInteger(\"0\"),xs:nonPositiveInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:nonPositiveInteger(lower bound) $zero = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnSumnpi2args3() { final XQuery query = new XQuery( "fn:sum((xs:nonPositiveInteger(\"-524311562728129509\"),xs:nonPositiveInteger(\"-475688437271870490\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:nonPositiveInteger(lower bound) $zero = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnSumnpi2args4() { final XQuery query = new XQuery( "fn:sum((xs:nonPositiveInteger(\"-999999999999999999\"),xs:nonPositiveInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:nonPositiveInteger(mid range) $arg2 = xs:nonPositiveInteger(lower bound) $zero = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnSumnpi3args1() { final XQuery query = new XQuery( "fn:sum((xs:nonPositiveInteger(\"-475688437271870490\"),xs:nonPositiveInteger(\"-524311562728129509\"),xs:nonPositiveInteger(\"-524311562728129509\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1524311562728129508") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:nonPositiveInteger(upper bound) $arg2 = xs:nonPositiveInteger(lower bound) $zero = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnSumnpi3args2() { final XQuery query = new XQuery( "fn:sum((xs:nonPositiveInteger(\"0\"),xs:nonPositiveInteger(\"-999999999999999999\"),xs:nonPositiveInteger(\"-999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1999999999999999998") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(mid range) $zero = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnSumnpi3args3() { final XQuery query = new XQuery( "fn:sum((xs:nonPositiveInteger(\"-524311562728129509\"),xs:nonPositiveInteger(\"-475688437271870490\"),xs:nonPositiveInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(upper bound) $zero = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnSumnpi3args4() { final XQuery query = new XQuery( "fn:sum((xs:nonPositiveInteger(\"-999999999999999999\"),xs:nonPositiveInteger(\"0\"),xs:nonPositiveInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(lower bound) $zero = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnSumnpi3args5() { final XQuery query = new XQuery( "fn:sum((xs:nonPositiveInteger(\"0\"),xs:nonPositiveInteger(\"0\"),xs:nonPositiveInteger(\"-475688437271870490\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-475688437271870490") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(lower bound) $zero = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnSumnpi3args6() { final XQuery query = new XQuery( "fn:sum((xs:nonPositiveInteger(\"0\"),xs:nonPositiveInteger(\"0\"),xs:nonPositiveInteger(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnSumpint1args1() { final XQuery query = new XQuery( "fn:sum((xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnSumpint1args2() { final XQuery query = new XQuery( "fn:sum((xs:positiveInteger(\"52704602390610033\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("52704602390610033") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnSumpint1args3() { final XQuery query = new XQuery( "fn:sum((xs:positiveInteger(\"999999999999999999\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:positiveInteger(lower bound) $zero = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnSumpint2args1() { final XQuery query = new XQuery( "fn:sum((xs:positiveInteger(\"1\"),xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:positiveInteger(mid range) $zero = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnSumpint2args2() { final XQuery query = new XQuery( "fn:sum((xs:positiveInteger(\"52704602390610033\"),xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("52704602390610034") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:positiveInteger(upper bound) $zero = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnSumpint2args3() { final XQuery query = new XQuery( "fn:sum((xs:positiveInteger(\"999999999999999998\"),xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:positiveInteger(lower bound) $zero = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnSumpint2args4() { final XQuery query = new XQuery( "fn:sum((xs:positiveInteger(\"1\"),xs:positiveInteger(\"52704602390610033\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("52704602390610034") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:positiveInteger(lower bound) $zero = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnSumpint2args5() { final XQuery query = new XQuery( "fn:sum((xs:positiveInteger(\"1\"),xs:positiveInteger(\"999999999999999998\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(lower bound) $zero = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnSumpint3args1() { final XQuery query = new XQuery( "fn:sum((xs:positiveInteger(\"1\"),xs:positiveInteger(\"1\"),xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:positiveInteger(mid range) $arg2 = xs:positiveInteger(lower bound) $zero = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnSumpint3args2() { final XQuery query = new XQuery( "fn:sum((xs:positiveInteger(\"52704602390610033\"),xs:positiveInteger(\"1\"),xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("52704602390610035") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:positiveInteger(upper bound) $arg2 = xs:positiveInteger(lower bound) $zero = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnSumpint3args3() { final XQuery query = new XQuery( "fn:sum((xs:positiveInteger(\"999999999999999998\"),xs:positiveInteger(\"1\"),xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1000000000000000000") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(mid range) $zero = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnSumpint3args4() { final XQuery query = new XQuery( "fn:sum((xs:positiveInteger(\"1\"),xs:positiveInteger(\"52704602390610033\"),xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("52704602390610035") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(upper bound) $zero = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnSumpint3args5() { final XQuery query = new XQuery( "fn:sum((xs:positiveInteger(\"1\"),xs:positiveInteger(\"999999999999999998\"),xs:positiveInteger(\"1\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1000000000000000000") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(lower bound) $zero = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnSumpint3args6() { final XQuery query = new XQuery( "fn:sum((xs:positiveInteger(\"1\"),xs:positiveInteger(\"1\"),xs:positiveInteger(\"52704602390610033\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("52704602390610035") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(lower bound) $zero = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnSumpint3args7() { final XQuery query = new XQuery( "fn:sum((xs:positiveInteger(\"1\"),xs:positiveInteger(\"1\"),xs:positiveInteger(\"999999999999999998\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1000000000000000000") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:short(lower bound) . */ @org.junit.Test public void fnSumsht1args1() { final XQuery query = new XQuery( "fn:sum((xs:short(\"-32768\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-32768") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:short(mid range) . */ @org.junit.Test public void fnSumsht1args2() { final XQuery query = new XQuery( "fn:sum((xs:short(\"-5324\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-5324") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:short(upper bound) . */ @org.junit.Test public void fnSumsht1args3() { final XQuery query = new XQuery( "fn:sum((xs:short(\"32767\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("32767") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:short(mid range) $zero = xs:short(lower bound) . */ @org.junit.Test public void fnSumsht2args1() { final XQuery query = new XQuery( "fn:sum((xs:short(\"-5324\"),xs:short(\"-27444\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-32768") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:short(upper bound) $zero = xs:short(lower bound) . */ @org.junit.Test public void fnSumsht2args2() { final XQuery query = new XQuery( "fn:sum((xs:short(\"32767\"),xs:short(\"-32768\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:short(lower bound) $zero = xs:short(mid range) . */ @org.junit.Test public void fnSumsht2args3() { final XQuery query = new XQuery( "fn:sum((xs:short(\"-27444\"),xs:short(\"-5324\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-32768") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:short(lower bound) $zero = xs:short(upper bound) . */ @org.junit.Test public void fnSumsht2args4() { final XQuery query = new XQuery( "fn:sum((xs:short(\"-32768\"),xs:short(\"32767\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:short(mid range) $arg2 = xs:short(lower bound) $zero = xs:short(lower bound) . */ @org.junit.Test public void fnSumsht3args1() { final XQuery query = new XQuery( "fn:sum((xs:short(\"-5324\"),xs:short(\"-27444\"),xs:short(\"-27444\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-60212") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(mid range) $zero = xs:short(lower bound) . */ @org.junit.Test public void fnSumsht3args2() { final XQuery query = new XQuery( "fn:sum((xs:short(\"-27444\"),xs:short(\"-5324\"),xs:short(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-32768") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(lower bound) $zero = xs:short(mid range) . */ @org.junit.Test public void fnSumsht3args3() { final XQuery query = new XQuery( "fn:sum((xs:short(\"0\"),xs:short(\"0\"),xs:short(\"-5324\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-5324") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(lower bound) $zero = xs:short(upper bound) . */ @org.junit.Test public void fnSumsht3args4() { final XQuery query = new XQuery( "fn:sum((xs:short(\"0\"),xs:short(\"0\"),xs:short(\"32767\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("32767") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnSumulng1args1() { final XQuery query = new XQuery( "fn:sum((xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnSumulng1args2() { final XQuery query = new XQuery( "fn:sum((xs:unsignedLong(\"130747108607674654\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("130747108607674654") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnSumulng1args3() { final XQuery query = new XQuery( "fn:sum((xs:unsignedLong(\"184467440737095516\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("184467440737095516") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:unsignedLong(lower bound) $zero = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnSumulng2args1() { final XQuery query = new XQuery( "fn:sum((xs:unsignedLong(\"0\"),xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:unsignedLong(mid range) $zero = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnSumulng2args2() { final XQuery query = new XQuery( "fn:sum((xs:unsignedLong(\"130747108607674654\"),xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("130747108607674654") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:unsignedLong(upper bound) $zero = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnSumulng2args3() { final XQuery query = new XQuery( "fn:sum((xs:unsignedLong(\"184467440737095516\"),xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("184467440737095516") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:unsignedLong(lower bound) $zero = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnSumulng2args4() { final XQuery query = new XQuery( "fn:sum((xs:unsignedLong(\"0\"),xs:unsignedLong(\"130747108607674654\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("130747108607674654") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:unsignedLong(lower bound) $zero = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnSumulng2args5() { final XQuery query = new XQuery( "fn:sum((xs:unsignedLong(\"0\"),xs:unsignedLong(\"184467440737095516\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("184467440737095516") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(lower bound) $zero = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnSumulng3args1() { final XQuery query = new XQuery( "fn:sum((xs:unsignedLong(\"0\"),xs:unsignedLong(\"0\"),xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:unsignedLong(mid range) $arg2 = xs:unsignedLong(lower bound) $zero = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnSumulng3args2() { final XQuery query = new XQuery( "fn:sum((xs:unsignedLong(\"130747108607674654\"),xs:unsignedLong(\"0\"),xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("130747108607674654") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:unsignedLong(upper bound) $arg2 = xs:unsignedLong(lower bound) $zero = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnSumulng3args3() { final XQuery query = new XQuery( "fn:sum((xs:unsignedLong(\"184467440737095516\"),xs:unsignedLong(\"0\"),xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("184467440737095516") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(mid range) $zero = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnSumulng3args4() { final XQuery query = new XQuery( "fn:sum((xs:unsignedLong(\"0\"),xs:unsignedLong(\"130747108607674654\"),xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("130747108607674654") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(upper bound) $zero = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnSumulng3args5() { final XQuery query = new XQuery( "fn:sum((xs:unsignedLong(\"0\"),xs:unsignedLong(\"184467440737095516\"),xs:unsignedLong(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("184467440737095516") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(lower bound) $zero = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnSumulng3args6() { final XQuery query = new XQuery( "fn:sum((xs:unsignedLong(\"0\"),xs:unsignedLong(\"0\"),xs:unsignedLong(\"130747108607674654\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("130747108607674654") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(lower bound) $zero = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnSumulng3args7() { final XQuery query = new XQuery( "fn:sum((xs:unsignedLong(\"0\"),xs:unsignedLong(\"0\"),xs:unsignedLong(\"184467440737095516\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("184467440737095516") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnSumusht1args1() { final XQuery query = new XQuery( "fn:sum((xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnSumusht1args2() { final XQuery query = new XQuery( "fn:sum((xs:unsignedShort(\"44633\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("44633") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnSumusht1args3() { final XQuery query = new XQuery( "fn:sum((xs:unsignedShort(\"65535\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("65535") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:unsignedShort(lower bound) $zero = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnSumusht2args1() { final XQuery query = new XQuery( "fn:sum((xs:unsignedShort(\"0\"),xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:unsignedShort(mid range) $zero = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnSumusht2args2() { final XQuery query = new XQuery( "fn:sum((xs:unsignedShort(\"44633\"),xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("44633") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:unsignedShort(upper bound) $zero = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnSumusht2args3() { final XQuery query = new XQuery( "fn:sum((xs:unsignedShort(\"65535\"),xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("65535") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:unsignedShort(lower bound) $zero = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnSumusht2args4() { final XQuery query = new XQuery( "fn:sum((xs:unsignedShort(\"0\"),xs:unsignedShort(\"44633\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("44633") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg = xs:unsignedShort(lower bound) $zero = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnSumusht2args5() { final XQuery query = new XQuery( "fn:sum((xs:unsignedShort(\"0\"),xs:unsignedShort(\"65535\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("65535") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(lower bound) $zero = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnSumusht3args1() { final XQuery query = new XQuery( "fn:sum((xs:unsignedShort(\"0\"),xs:unsignedShort(\"0\"),xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:unsignedShort(mid range) $arg2 = xs:unsignedShort(lower bound) $zero = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnSumusht3args2() { final XQuery query = new XQuery( "fn:sum((xs:unsignedShort(\"44633\"),xs:unsignedShort(\"0\"),xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("44633") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:unsignedShort(upper bound) $arg2 = xs:unsignedShort(lower bound) $zero = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnSumusht3args3() { final XQuery query = new XQuery( "fn:sum((xs:unsignedShort(\"65535\"),xs:unsignedShort(\"0\"),xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("65535") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(mid range) $zero = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnSumusht3args4() { final XQuery query = new XQuery( "fn:sum((xs:unsignedShort(\"0\"),xs:unsignedShort(\"44633\"),xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("44633") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(upper bound) $zero = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnSumusht3args5() { final XQuery query = new XQuery( "fn:sum((xs:unsignedShort(\"0\"),xs:unsignedShort(\"65535\"),xs:unsignedShort(\"0\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("65535") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(lower bound) $zero = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnSumusht3args6() { final XQuery query = new XQuery( "fn:sum((xs:unsignedShort(\"0\"),xs:unsignedShort(\"0\"),xs:unsignedShort(\"44633\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("44633") ); } /** * Evaluates The "sum" function with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(lower bound) $zero = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnSumusht3args7() { final XQuery query = new XQuery( "fn:sum((xs:unsignedShort(\"0\"),xs:unsignedShort(\"0\"),xs:unsignedShort(\"65535\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("65535") ); } } ����������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnTail.java���������������������������0000664�0000000�0000000�00000005775�12224530032�0026142�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the tail() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnTail extends QT3TestSet { /** * tail() of a simple sequence . */ @org.junit.Test public void tail001() { final XQuery query = new XQuery( "tail(12 to 15)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("13, 14, 15") ); } /** * tail() of a simple sequence . */ @org.junit.Test public void tail002() { final XQuery query = new XQuery( "tail((\"a\", \"b\", \"c\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"b\", \"c\"") ); } /** * tail() of a singleton sequence . */ @org.junit.Test public void tail003() { final XQuery query = new XQuery( "count(tail(\"a\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * tail() of an empty sequence . */ @org.junit.Test public void tail004() { final XQuery query = new XQuery( "let $a := /works/employee return count(tail($a/z))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * tail() of a node sequence . */ @org.junit.Test public void tail005() { final XQuery query = new XQuery( "let $a := /works/employee[@gender='female']/@name return tail($a)/string()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"Jane Doe 3\", \"Jane Doe 5\", \"Jane Doe 7\", \"Jane Doe 9\", \"Jane Doe 11\", \"Jane Doe 13\"") ); } /** * head/tail recursion . */ @org.junit.Test public void tail006() { final XQuery query = new XQuery( "declare function local:sum($n) { if (empty($n)) then 0 else head($n) + local:sum(tail($n)) }; \n" + " local:sum(1 to 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("15") && assertType("xs:integer") ) ); } } ���basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnTimezoneFromDate.java���������������0000664�0000000�0000000�00000045672�12224530032�0030465�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the timezone-from-date() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnTimezoneFromDate extends QT3TestSet { /** * A test whose essence is: `timezone-from-date()`. . */ @org.junit.Test public void kTimezoneFromDateFunc1() { final XQuery query = new XQuery( "timezone-from-date()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `timezone-from-date((), "Wrong param")`. . */ @org.junit.Test public void kTimezoneFromDateFunc2() { final XQuery query = new XQuery( "timezone-from-date((), \"Wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(timezone-from-date(()))`. . */ @org.junit.Test public void kTimezoneFromDateFunc3() { final XQuery query = new XQuery( "empty(timezone-from-date(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `timezone-from-date(()) instance of xs:dayTimeDuration?`. . */ @org.junit.Test public void kTimezoneFromDateFunc4() { final XQuery query = new XQuery( "timezone-from-date(()) instance of xs:dayTimeDuration?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `timezone-from-date(xs:date("2004-10-12Z")) eq xs:dayTimeDuration("PT0S")`. . */ @org.junit.Test public void kTimezoneFromDateFunc5() { final XQuery query = new XQuery( "timezone-from-date(xs:date(\"2004-10-12Z\")) eq xs:dayTimeDuration(\"PT0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `timezone-from-date(xs:date("2004-10-12-08:23")) eq xs:dayTimeDuration("-PT8H23M")`. . */ @org.junit.Test public void kTimezoneFromDateFunc6() { final XQuery query = new XQuery( "timezone-from-date(xs:date(\"2004-10-12-08:23\")) eq xs:dayTimeDuration(\"-PT8H23M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(timezone-from-date(xs:date("2004-10-12")))`. . */ @org.junit.Test public void kTimezoneFromDateFunc7() { final XQuery query = new XQuery( "empty(timezone-from-date(xs:date(\"2004-10-12\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:timezone-from-date on fn:adjust-date-to-timezone . */ @org.junit.Test public void cbclTimezoneFromDate001() { final XQuery query = new XQuery( "\n" + " timezone-from-date(adjust-date-to-timezone(xs:date(\"1997-01-01\"))) = implicit-timezone()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:timezone-from-date . */ @org.junit.Test public void cbclTimezoneFromDate002() { final XQuery query = new XQuery( "\n" + " declare function local:timezone($arg as xs:integer) { if ($arg gt 0) then xs:dayTimeDuration(concat('PT', $arg, 'H')) else if ($arg lt 0) then xs:dayTimeDuration(concat('-PT', -$arg, 'H')) else xs:dayTimeDuration('PT0H') };\n" + " timezone-from-date( adjust-date-to-timezone( fn:current-date(), local:timezone(15)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0003") ); } /** * test fn:timezone-from-date . */ @org.junit.Test public void cbclTimezoneFromDate003() { final XQuery query = new XQuery( "\n" + " declare function local:timezone($arg as xs:integer) { if ($arg gt 0) then xs:dayTimeDuration(concat('PT', $arg, 'H')) else if ($arg lt 0) then xs:dayTimeDuration(concat('-PT', -$arg, 'H')) else xs:dayTimeDuration('PT0H') };\n" + " timezone-from-date( adjust-date-to-timezone( fn:current-date(), local:timezone(14)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT14H") ); } /** * test fn:timezone-from-date . */ @org.junit.Test public void cbclTimezoneFromDate004() { final XQuery query = new XQuery( "\n" + " declare function local:timezone($arg as xs:integer) { if ($arg gt 0) then xs:dayTimeDuration(concat('PT', $arg, 'H')) else if ($arg lt 0) then xs:dayTimeDuration(concat('-PT', -$arg, 'H')) else xs:dayTimeDuration('PT0H') };\n" + " timezone-from-date( adjust-date-to-timezone( fn:current-date(), timezone-from-date( adjust-date-to-timezone( xs:date('1970-01-01'), local:timezone(-12)))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-PT12H") ); } /** * test fn:timezone-from-date . */ @org.junit.Test public void cbclTimezoneFromDate005() { final XQuery query = new XQuery( "\n" + " declare function local:date($arg as xs:boolean) { if ($arg) then xs:date('1970-01-01Z') else fn:current-date() };\n" + " timezone-from-date( adjust-date-to-timezone( xs:date('2008-08-01'), timezone-from-date(local:date(true()))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * test fn:timezone-from-date . */ @org.junit.Test public void cbclTimezoneFromDate006() { final XQuery query = new XQuery( "\n" + " declare function local:dateTime($arg as xs:boolean) { if ($arg) then xs:dateTime('1970-01-01T00:00:00Z') else fn:current-dateTime() };\n" + " timezone-from-date( adjust-date-to-timezone( xs:date('2008-08-01'), timezone-from-dateTime(local:dateTime(true()))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * test fn:timezone-from-date . */ @org.junit.Test public void cbclTimezoneFromDate007() { final XQuery query = new XQuery( "\n" + " declare function local:time($arg as xs:boolean) { if ($arg) then xs:time('12:00:00Z') else fn:current-time() };\n" + " timezone-from-date( adjust-date-to-timezone( xs:date('2008-08-01'), timezone-from-time(local:time(true()))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Evaluates The "timezone-from-date" function As per example 1 of the F&O specs . */ @org.junit.Test public void fnTimezoneFromDate1() { final XQuery query = new XQuery( "fn:timezone-from-date(xs:date(\"1999-05-31-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-PT5H") ); } /** * Evaluates The "timezone-from-date" function as as an argument to the "not" function. Uses the "fn:string" function to account for new EBV rules. . */ @org.junit.Test public void fnTimezoneFromDate10() { final XQuery query = new XQuery( "fn:not(fn:string(fn:timezone-from-date(xs:date(\"1970-01-03+02:00\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "timezone-from-date" function as part of a "div" expression. . */ @org.junit.Test public void fnTimezoneFromDate11() { final XQuery query = new XQuery( "fn:timezone-from-date(xs:date(\"1970-01-02+10:00\")) div fn:timezone-from-date(xs:date(\"1970-01-01+05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Evaluates The "timezone-from-date" function as an argument to the fn:number function. returns "NaN". . */ @org.junit.Test public void fnTimezoneFromDate12() { final XQuery query = new XQuery( "fn:number(fn:timezone-from-date(xs:date(\"1970-01-02+10:00\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Evaluates The "timezone-from-date" function as an argument to the "fn:boolean" function. Uses the "fn:string" function to account for new EBV rules. . */ @org.junit.Test public void fnTimezoneFromDate13() { final XQuery query = new XQuery( "fn:boolean(fn:string(fn:timezone-from-date(xs:date(\"1970-01-02+10:00\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "timezone-from-date" function as argument to the "fn:string" function. . */ @org.junit.Test public void fnTimezoneFromDate14() { final XQuery query = new XQuery( "fn:string(fn:timezone-from-date(xs:date(\"1970-01-01Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Evaluates The "timezone-from-date" function as part of an "and" expression. Uses the "fn:string" function to account for new EBV rules. . */ @org.junit.Test public void fnTimezoneFromDate15() { final XQuery query = new XQuery( "fn:string(fn:timezone-from-date(xs:date(\"1970-01-01Z\"))) and fn:string(fn:timezone-from-date(xs:date(\"1970-01-01Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "timezone-from-date" function as part of a "numeric-equal" expression (eq operator) . */ @org.junit.Test public void fnTimezoneFromDate16() { final XQuery query = new XQuery( "fn:timezone-from-date(xs:date(\"1970-01-02+10:00\")) eq fn:timezone-from-date(xs:date(\"1970-01-01+10:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "month-from-date" function as part of a "numeric-equal" expression (ne operator) . */ @org.junit.Test public void fnTimezoneFromDate17() { final XQuery query = new XQuery( "fn:month-from-date(xs:date(\"1970-01-01+05:00\")) ne fn:month-from-date(xs:date(\"1970-01-03+03:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "timezone-from-date" function as part of a "numeric-equal" expression (le operator) . */ @org.junit.Test public void fnTimezoneFromDate18() { final XQuery query = new XQuery( "fn:timezone-from-date(xs:date(\"1970-01-01+04:00\")) le fn:timezone-from-date(xs:date(\"1970-01-02+02:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "timezone-from-date" function as part of a "numeric-equal" expression (ge operator) . */ @org.junit.Test public void fnTimezoneFromDate19() { final XQuery query = new XQuery( "fn:timezone-from-date(xs:date(\"1970-01-03+02:00\")) ge fn:timezone-from-date(xs:date(\"1970-01-01+01:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "timezone-from-date" function As per example 2 of the F&O specs. . */ @org.junit.Test public void fnTimezoneFromDate2() { final XQuery query = new XQuery( "fn:timezone-from-date(xs:date(\"2000-06-12Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Evaluates The "timezone-from-date" function as part of an "or" expression. Uses the "fn:string" function to account for new EBV rules. . */ @org.junit.Test public void fnTimezoneFromDate20() { final XQuery query = new XQuery( "fn:string(fn:timezone-from-date(xs:date(\"1970-01-01Z\"))) or fn:string(fn:timezone-from-date(xs:date(\"1970-01-01Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "timezone-from-date" function involving a "numeric-less-than" operation (lt operator) . */ @org.junit.Test public void fnTimezoneFromDate3() { final XQuery query = new XQuery( "fn:timezone-from-date(xs:date(\"1999-12-31+05:00\")) lt fn:timezone-from-date(xs:date(\"1999-12-31+06:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "timezone-from-date" function involving a "numeric-less-than" operation (le operator) . */ @org.junit.Test public void fnTimezoneFromDate4() { final XQuery query = new XQuery( "fn:timezone-from-date(xs:date(\"1999-12-31+01:00\")) le fn:timezone-from-date(xs:date(\"1999-12-31+01:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "timezone-from-date" function using the empty sequence as an argument. Use count function to avoid empty file. . */ @org.junit.Test public void fnTimezoneFromDate5() { final XQuery query = new XQuery( "fn:count(fn:timezone-from-date(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "timezone-from-date" function that returns a dayTimeDuration of 0. . */ @org.junit.Test public void fnTimezoneFromDate6() { final XQuery query = new XQuery( "fn:timezone-from-date(xs:date(\"1999-05-31+00:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Evaluates The "timezone-from-date" function that uses a timezone of -0. . */ @org.junit.Test public void fnTimezoneFromDate7() { final XQuery query = new XQuery( "fn:timezone-from-date(xs:date(\"1999-12-31-00:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Evaluates The "timezone-from-date" function as part of a "+" expression. . */ @org.junit.Test public void fnTimezoneFromDate8() { final XQuery query = new XQuery( "fn:timezone-from-date(xs:date(\"1970-01-01+08:00\")) + fn:timezone-from-date(xs:date(\"1970-01-01+03:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT11H") ); } /** * Evaluates The "timezone-from-date" function as part of a "-" expression. . */ @org.junit.Test public void fnTimezoneFromDate9() { final XQuery query = new XQuery( "fn:timezone-from-date(xs:date(\"1970-01-01+09:00\")) - fn:timezone-from-date(xs:date(\"1970-01-01+10:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-PT1H") ); } } ����������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnTimezoneFromDateTime.java�����������0000664�0000000�0000000�00000035737�12224530032�0031305�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the timezone-from-dateTime() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnTimezoneFromDateTime extends QT3TestSet { /** * A test whose essence is: `timezone-from-dateTime()`. . */ @org.junit.Test public void kTimezoneFromDateTimeFunc1() { final XQuery query = new XQuery( "timezone-from-dateTime()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `timezone-from-dateTime((), "Wrong param")`. . */ @org.junit.Test public void kTimezoneFromDateTimeFunc2() { final XQuery query = new XQuery( "timezone-from-dateTime((), \"Wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(timezone-from-dateTime(()))`. . */ @org.junit.Test public void kTimezoneFromDateTimeFunc3() { final XQuery query = new XQuery( "empty(timezone-from-dateTime(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `timezone-from-dateTime(()) instance of xs:dayTimeDuration?`. . */ @org.junit.Test public void kTimezoneFromDateTimeFunc4() { final XQuery query = new XQuery( "timezone-from-dateTime(()) instance of xs:dayTimeDuration?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `timezone-from-dateTime(xs:dateTime("2004-10-12T23:43:12Z")) eq xs:dayTimeDuration("PT0S")`. . */ @org.junit.Test public void kTimezoneFromDateTimeFunc5() { final XQuery query = new XQuery( "timezone-from-dateTime(xs:dateTime(\"2004-10-12T23:43:12Z\")) eq xs:dayTimeDuration(\"PT0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `timezone-from-dateTime(xs:dateTime("2004-10-12T23:43:12-08:23")) eq xs:dayTimeDuration("-PT8H23M")`. . */ @org.junit.Test public void kTimezoneFromDateTimeFunc6() { final XQuery query = new XQuery( "timezone-from-dateTime(xs:dateTime(\"2004-10-12T23:43:12-08:23\")) eq xs:dayTimeDuration(\"-PT8H23M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(timezone-from-dateTime(xs:dateTime("2004-12-10T23:43:41.965")))`. . */ @org.junit.Test public void kTimezoneFromDateTimeFunc7() { final XQuery query = new XQuery( "empty(timezone-from-dateTime(xs:dateTime(\"2004-12-10T23:43:41.965\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "timezone-from-dateTime" function As per example 1 (for this function) of the F&O specs . */ @org.junit.Test public void fnTimezoneFromDateTimealt1() { final XQuery query = new XQuery( "fn:timezone-from-dateTime(xs:dateTime(\"1999-05-31T13:20:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-PT5H") ); } /** * Evaluates The "timezone-from-dateTime" function as an argument to the "min" function. . */ @org.junit.Test public void fnTimezoneFromDateTimealt10() { final XQuery query = new XQuery( "fn:min(fn:timezone-from-dateTime(xs:dateTime(\"1970-01-01T02:00:00Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Evaluates The "timezone-from-dateTime" function as part of a "div" expression. . */ @org.junit.Test public void fnTimezoneFromDateTimealt11() { final XQuery query = new XQuery( "fn:timezone-from-dateTime(xs:dateTime(\"1970-01-01T02:00:00+10:00\")) div fn:timezone-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00+05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Evaluates The "timezone-from-dateTime" function as an argument to the "fn:number" function. Return NaN. . */ @org.junit.Test public void fnTimezoneFromDateTimealt12() { final XQuery query = new XQuery( "fn:number(fn:timezone-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Evaluates The "timezone-from-dateTime" function as as an argument to an "fn:max" function. . */ @org.junit.Test public void fnTimezoneFromDateTimealt13() { final XQuery query = new XQuery( "fn:max(fn:timezone-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Evaluates The "timezone-from-dateTime" function as an argument to the "fn:string" function . */ @org.junit.Test public void fnTimezoneFromDateTimealt14() { final XQuery query = new XQuery( "fn:string(fn:timezone-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Evaluates The "timezone-from-dateTime" function as part of an "and" expression. Uses the "fn:string" function to account for new EBV rules. . */ @org.junit.Test public void fnTimezoneFromDateTimealt15() { final XQuery query = new XQuery( "fn:string(fn:timezone-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))) and fn:string(fn:timezone-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "timezone-from-dateTime" function as part of a "numeric-equal" expression (eq operator) . */ @org.junit.Test public void fnTimezoneFromDateTimealt16() { final XQuery query = new XQuery( "fn:timezone-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\")) eq fn:timezone-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "timezone-from-dateTime" function as part of a "numeric-equal" expression (ne operator) . */ @org.junit.Test public void fnTimezoneFromDateTimealt17() { final XQuery query = new XQuery( "fn:timezone-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\")) ne fn:timezone-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "timezone-from-dateTime" function as part of a "numeric-equal" expression (le operator) . */ @org.junit.Test public void fnTimezoneFromDateTimealt18() { final XQuery query = new XQuery( "fn:timezone-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\")) le fn:timezone-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "timezone-from-dateTime" function as part of a "numeric-equal" expression (ge operator) . */ @org.junit.Test public void fnTimezoneFromDateTimealt19() { final XQuery query = new XQuery( "fn:timezone-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\")) ge fn:timezone-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "timezone-from-dateTime" function As per example 2 (for this function) of the F&O specs. . */ @org.junit.Test public void fnTimezoneFromDateTimealt2() { final XQuery query = new XQuery( "fn:timezone-from-dateTime(xs:dateTime(\"2000-06-12T13:20:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Evaluates The "timezone-from-dateTime" function as part of an "or" expression. Uses the "fn:string" function to account for new EBV rules. . */ @org.junit.Test public void fnTimezoneFromDateTimealt20() { final XQuery query = new XQuery( "fn:string(fn:timezone-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))) or fn:string(fn:timezone-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "timezone-from-dateTime" function As per example 3 (for this function) of the F&O specs. Use the fn:count function to avoid empty file. . */ @org.junit.Test public void fnTimezoneFromDateTimealt3() { final XQuery query = new XQuery( "fn:count(fn:timezone-from-dateTime(xs:dateTime(\"2004-08-27T00:00:00\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "timezone-from-dateTime" function uses as part of a numeric-less-than expression (le operator). . */ @org.junit.Test public void fnTimezoneFromDateTimealt4() { final XQuery query = new XQuery( "fn:timezone-from-dateTime(xs:dateTime(\"1999-12-31T12:00:00+02:00\")) le fn:timezone-from-dateTime(xs:dateTime(\"1999-12-30T12:00:00+03:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "timezone-from-dateTime" function using the empty sequence as an argument. Use count function to avoid empty file. . */ @org.junit.Test public void fnTimezoneFromDateTimealt5() { final XQuery query = new XQuery( "fn:count(fn:timezone-from-dateTime(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "timezone-from-dateTime" function that returns dayTimeDuration of 0. . */ @org.junit.Test public void fnTimezoneFromDateTimealt6() { final XQuery query = new XQuery( "fn:timezone-from-dateTime(xs:dateTime(\"1999-05-31T00:20:00+00:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Evaluates The "timezone-from-dateTime" function that evaluates a timezone of "-00:00". . */ @org.junit.Test public void fnTimezoneFromDateTimealt7() { final XQuery query = new XQuery( "fn:timezone-from-dateTime(xs:dateTime(\"1999-05-31T23:20:00-00:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Evaluates The "timezone-from-dateTime" function as part of a "+" expression. . */ @org.junit.Test public void fnTimezoneFromDateTimealt8() { final XQuery query = new XQuery( "fn:timezone-from-dateTime(xs:dateTime(\"1970-01-01T00:02:00Z\")) + fn:timezone-from-dateTime(xs:dateTime(\"1970-01-01T10:03:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Evaluates The "timezone-from-dateTime" function as part of a "-" expression. . */ @org.junit.Test public void fnTimezoneFromDateTimealt9() { final XQuery query = new XQuery( "fn:timezone-from-dateTime(xs:dateTime(\"1970-01-01T00:00:00+04:00\")) - fn:timezone-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00+02:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT2H") ); } } ���������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnTimezoneFromTime.java���������������0000664�0000000�0000000�00000034266�12224530032�0030503�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the timezone-from-time() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnTimezoneFromTime extends QT3TestSet { /** * A test whose essence is: `timezone-from-time()`. . */ @org.junit.Test public void kTimezoneFromTimeFunc1() { final XQuery query = new XQuery( "timezone-from-time()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `timezone-from-time((), "Wrong param")`. . */ @org.junit.Test public void kTimezoneFromTimeFunc2() { final XQuery query = new XQuery( "timezone-from-time((), \"Wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(timezone-from-time(()))`. . */ @org.junit.Test public void kTimezoneFromTimeFunc3() { final XQuery query = new XQuery( "empty(timezone-from-time(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `timezone-from-time(()) instance of xs:dayTimeDuration?`. . */ @org.junit.Test public void kTimezoneFromTimeFunc4() { final XQuery query = new XQuery( "timezone-from-time(()) instance of xs:dayTimeDuration?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `timezone-from-time(xs:time("23:43:12.765Z")) eq xs:dayTimeDuration("PT0S")`. . */ @org.junit.Test public void kTimezoneFromTimeFunc5() { final XQuery query = new XQuery( "timezone-from-time(xs:time(\"23:43:12.765Z\")) eq xs:dayTimeDuration(\"PT0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `timezone-from-time(xs:time("23:43:12.765-08:23")) eq xs:dayTimeDuration("-PT8H23M")`. . */ @org.junit.Test public void kTimezoneFromTimeFunc6() { final XQuery query = new XQuery( "timezone-from-time(xs:time(\"23:43:12.765-08:23\")) eq xs:dayTimeDuration(\"-PT8H23M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(timezone-from-time(xs:time("23:43:12.765")))`. . */ @org.junit.Test public void kTimezoneFromTimeFunc7() { final XQuery query = new XQuery( "empty(timezone-from-time(xs:time(\"23:43:12.765\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "timezone-from-time" function As per example 1 of the F&O specs (for this function) . */ @org.junit.Test public void fnTimezoneFromTime1() { final XQuery query = new XQuery( "fn:timezone-from-time(xs:time(\"13:20:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-PT5H") ); } /** * Evaluates The "timezone-from-time" function as an argument to the "fn:not" function. Uses the "fn:string" function to account for new EBV rules. . */ @org.junit.Test public void fnTimezoneFromTime10() { final XQuery query = new XQuery( "fn:not(fn:string(fn:timezone-from-time(xs:time(\"02:02:03Z\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "timezone-from-time" function as part of a "div" expression. . */ @org.junit.Test public void fnTimezoneFromTime11() { final XQuery query = new XQuery( "fn:timezone-from-time(xs:time(\"22:33:10+10:00\")) div fn:timezone-from-time(xs:time(\"02:11:02+05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Evaluates The "timezone-from-time" function as an argument to the "fn:number" function. Return NaN. . */ @org.junit.Test public void fnTimezoneFromTime12() { final XQuery query = new XQuery( "fn:number(fn:timezone-from-time(xs:time(\"10:12:15Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Evaluates The "timezone-from-time" function as an argument to the "fn:boolean" function. Uses the "fn:string" function to account for new EBV rules. . */ @org.junit.Test public void fnTimezoneFromTime13() { final XQuery query = new XQuery( "fn:boolean(fn:string(fn:timezone-from-time(xs:time(\"10:10:20Z\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "timezone-from-time" function as an argument to the "fn:string" function. . */ @org.junit.Test public void fnTimezoneFromTime14() { final XQuery query = new XQuery( "fn:string(fn:timezone-from-time(xs:time(\"10:00:01Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Evaluates The "timezone-from-time" function as part of an "and" expression. Uses the "fn:string" function to account for new EBV rules. . */ @org.junit.Test public void fnTimezoneFromTime15() { final XQuery query = new XQuery( "fn:string(fn:timezone-from-time(xs:time(\"10:10:01Z\"))) and fn:string(fn:timezone-from-time(xs:time(\"10:10:01Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "timezone-from-time" function as part of a "numeric-equal" expression (eq operator) . */ @org.junit.Test public void fnTimezoneFromTime16() { final XQuery query = new XQuery( "fn:timezone-from-time(xs:time(\"10:02:01Z\")) eq fn:timezone-from-time(xs:time(\"10:02:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "timezone-from-time" function as part of a "numeric-equal" expression (ne operator) . */ @org.junit.Test public void fnTimezoneFromTime17() { final XQuery query = new XQuery( "fn:timezone-from-time(xs:time(\"10:00:01Z\")) ne fn:timezone-from-time(xs:time(\"01:01:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "timezone-from-time" function as part of a "numeric-equal" expression (le operator) . */ @org.junit.Test public void fnTimezoneFromTime18() { final XQuery query = new XQuery( "fn:timezone-from-time(xs:time(\"10:00:00Z\")) le fn:timezone-from-time(xs:time(\"10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "timezone-from-time" function as part of a "numeric-equal" expression (ge operator) . */ @org.junit.Test public void fnTimezoneFromTime19() { final XQuery query = new XQuery( "fn:timezone-from-time(xs:time(\"10:03:01Z\")) ge fn:timezone-from-time(xs:time(\"10:04:02Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "timezone-from-time" function as per example 2 (for this function) from the F&O. specs. Use fn:count to aoid empty file. . */ @org.junit.Test public void fnTimezoneFromTime2() { final XQuery query = new XQuery( "fn:count(fn:timezone-from-time(xs:time(\"13:20:00\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "timezone-from-time" function as part of an "or" expression. Uses the "fn:string" function to account for new EBV rules. . */ @org.junit.Test public void fnTimezoneFromTime20() { final XQuery query = new XQuery( "fn:string(fn:timezone-from-time(xs:time(\"10:03:01Z\"))) or fn:string(fn:timezone-from-time(xs:time(\"10:04:02Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "timezone-from-time" function as part of a numeric greater than operation (gt operator) . */ @org.junit.Test public void fnTimezoneFromTime3() { final XQuery query = new XQuery( "fn:timezone-from-time(xs:time(\"01:23:02Z\")) gt fn:timezone-from-time(xs:time(\"01:23:03Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "timezone-from-time" function as part of a numeric-less-than expression (le operator) . */ @org.junit.Test public void fnTimezoneFromTime4() { final XQuery query = new XQuery( "fn:timezone-from-time(xs:time(\"01:10:20Z\")) le fn:timezone-from-time(xs:time(\"01:20:30Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "timezone-from-time" function using the empty sequence as an argument. Use count function to avoid empty file. . */ @org.junit.Test public void fnTimezoneFromTime5() { final XQuery query = new XQuery( "fn:count(fn:timezone-from-time(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "timezone-from-time" function that returns a dayTimeDuration of 0. . */ @org.junit.Test public void fnTimezoneFromTime6() { final XQuery query = new XQuery( "fn:timezone-from-time(xs:time(\"00:59:00+00:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Evaluates The "timezone-from-time" function with a timezone component of "-00:00". . */ @org.junit.Test public void fnTimezoneFromTime7() { final XQuery query = new XQuery( "fn:timezone-from-time(xs:time(\"23:20:59-00:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Evaluates The "timezone-from-time" function as part of a "+" expression. . */ @org.junit.Test public void fnTimezoneFromTime8() { final XQuery query = new XQuery( "fn:timezone-from-time(xs:time(\"02:00:00Z\")) + fn:timezone-from-time(xs:time(\"10:00:10Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Evaluates The "timezone-from-time" function as part of a "-" expression. . */ @org.junit.Test public void fnTimezoneFromTime9() { final XQuery query = new XQuery( "fn:timezone-from-time(xs:time(\"10:10:10Z\")) - fn:timezone-from-time(xs:time(\"09:02:07Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnTokenize.java�����������������������0000664�0000000�0000000�00000062024�12224530032�0027027�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests the fn:tokenize() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnTokenize extends QT3TestSet { /** * fn:tokenize takes at least two arguments. . */ @org.junit.Test public void kTokenizeFunc1() { final XQuery query = new XQuery( "tokenize(\"input\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * The pattern can't be the empty sequence. . */ @org.junit.Test public void kTokenizeFunc2() { final XQuery query = new XQuery( "tokenize(\"input\", ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The flags argument cannot contain whitespace. . */ @org.junit.Test public void kTokenizeFunc3() { final XQuery query = new XQuery( "tokenize(\"input\", \"pattern\", \" \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0001") ); } /** * The flags argument cannot contain 'X'. . */ @org.junit.Test public void kTokenizeFunc4() { final XQuery query = new XQuery( "tokenize(\"input\", \"pattern\", \"X\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0001") ); } /** * Only three arguments are accepted. . */ @org.junit.Test public void kTokenizeFunc5() { final XQuery query = new XQuery( "tokenize(\"input\", \"pattern\", \"\", ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * fn:tokenize with a positional predicate. . */ @org.junit.Test public void k2TokenizeFunc1() { final XQuery query = new XQuery( "fn:tokenize((\"abracadabra\", current-time())[1] treat as xs:string, \"(ab)|(a)\")[last()] eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:tokenize with a positional predicate. . */ @org.junit.Test public void k2TokenizeFunc2() { final XQuery query = new XQuery( "empty(fn:tokenize((\"abracadabra\", current-time())[1] treat as xs:string, \"(ab)|(a)\")[last() + 1])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:tokenize with a positional predicate(#2). . */ @org.junit.Test public void k2TokenizeFunc3() { final XQuery query = new XQuery( "fn:tokenize((\"abracadabra\", current-time())[1] treat as xs:string, \"(ab)|(a)\")[last() - 1]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "r") ); } /** * fn:tokenize with a positional predicate(#3). . */ @org.junit.Test public void k2TokenizeFunc4() { final XQuery query = new XQuery( "fn:tokenize((\"abracadabra\", current-time())[1] treat as xs:string, \"(ab)|(a)\")[last() - 3]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "c") ); } /** * Tokenize a sequence of words. . */ @org.junit.Test public void k2TokenizeFunc5() { final XQuery query = new XQuery( "deep-equal(fn:tokenize(\"The cat sat on the mat\", \"\\s+\"), (\"The\", \"cat\", \"sat\", \"on\", \"the\", \"mat\")), count(fn:tokenize(\"The cat sat on the mat\", \"\\s+\")), count(fn:tokenize(\" The cat sat on the mat \", \"\\s+\")), fn:tokenize(\"The cat sat on the mat\", \"\\s+\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true 6 8 The cat sat on the mat") ); } /** * A regexp that some Java versions have trouble with. . */ @org.junit.Test public void k2TokenizeFunc6() { final XQuery query = new XQuery( "replace('APXterms6', '\\w{3}\\d*([^TKR0-9]+).*$', '$1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "terms") ); } /** * Tokenize on a single whitespace. . */ @org.junit.Test public void k2TokenizeFunc7() { final XQuery query = new XQuery( "count(tokenize(\"a b\", \" \")), count(tokenize(\"a b\", \"\\s\")), string-join(tokenize(\"a b\", \" \"), '|'), string-join(tokenize(\"a b\", \"\\s\"), '|'), tokenize(\"a b\", \" \"), tokenize(\"a b\", \"\\s\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2 2 a|b a|b a b a b") ); } /** * Test boolean on tokenize . */ @org.junit.Test public void cbclFnTokenize001() { final XQuery query = new XQuery( "\n" + " for $x in xs:string(zero-or-one((1 to 10)[. mod 2 = -1])) return tokenize($x,',')\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * Test invalid regex expression . */ @org.junit.Test public void cbclFnTokenize002() { final XQuery query = new XQuery( "\n" + " tokenize(string-join(for $x in (1 to 10)[. mod 2 = 0] return string($x),','),'[')\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0002") ); } /** * Test tokenize on empty string . */ @org.junit.Test public void cbclFnTokenize003() { final XQuery query = new XQuery( "\n" + " tokenize(string-join(for $x in (1 to 10)[. mod 2 < 0] return string($x),','),',')\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * Evaluation of tokenize function where pattern matches the zero length string. Given on example 3 for this function in the Func and Ops specs. . */ @org.junit.Test public void fnTokenize1() { final XQuery query = new XQuery( "fn:tokenize(\"abba\", \".?\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0003") ); } /** * Evaluation of tokenize function with pattern that does not match the input string. . */ @org.junit.Test public void fnTokenize10() { final XQuery query = new XQuery( "fn:tokenize(\"abracadabra\", \"ww\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abracadabra") ); } /** * Evaluation of tokenize function with pattern set to "^a". . */ @org.junit.Test public void fnTokenize11() { final XQuery query = new XQuery( "fn:tokenize(\"abracadabra\", \"^a\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"\", \"bracadabra\"") ); } /** * Evaluation of tokenize function with pattern set to "\^". . */ @org.junit.Test public void fnTokenize12() { final XQuery query = new XQuery( "fn:tokenize(\"abracadabra^abracadabra\", \"\\^\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"abracadabra\", \"abracadabra\"") ); } /** * Evaluation of tokenize function with pattern set to "\?" for an input string that contains "?". . */ @org.junit.Test public void fnTokenize13() { final XQuery query = new XQuery( "fn:tokenize(\"abracadabra?abracadabra\", \"\\?\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"abracadabra\", \"abracadabra\"") ); } /** * Evaluation of tokenize function with pattern set to "\*" for an input string that contains "*". . */ @org.junit.Test public void fnTokenize14() { final XQuery query = new XQuery( "fn:tokenize(\"abracadabra*abracadabra\", \"\\*\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"abracadabra\", \"abracadabra\"") ); } /** * Evaluation of tokenize function with pattern set to "\+" for an input string that contains "+". . */ @org.junit.Test public void fnTokenize15() { final XQuery query = new XQuery( "fn:tokenize(\"abracadabra+abracadabra\", \"\\+\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"abracadabra\", \"abracadabra\"") ); } /** * Evaluation of tokenize function with pattern set to "\{" for an input string that contains "}". . */ @org.junit.Test public void fnTokenize16() { final XQuery query = new XQuery( "fn:tokenize(\"abracadabra{abracadabra\", \"\\{\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"abracadabra\", \"abracadabra\"") ); } /** * Evaluation of tokenize function with pattern set to "\}" for an input string that contains "}". . */ @org.junit.Test public void fnTokenize17() { final XQuery query = new XQuery( "fn:tokenize(\"abracadabra}abracadabra\", \"\\}\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"abracadabra\", \"abracadabra\"") ); } /** * Evaluation of tokenize function with pattern set to "\(" for an input string that contains "(". . */ @org.junit.Test public void fnTokenize18() { final XQuery query = new XQuery( "fn:tokenize(\"abracadabra(abracadabra\", \"\\(\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"abracadabra\", \"abracadabra\"") ); } /** * Evaluation of tokenize function with pattern set to "\)" for an input string that contains ")". . */ @org.junit.Test public void fnTokenize19() { final XQuery query = new XQuery( "fn:tokenize(\"abracadabra)abracadabra\", \"\\)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"abracadabra\", \"abracadabra\"") ); } /** * Evaluation of tokenize function whith an invalid value for the flags . */ @org.junit.Test public void fnTokenize2() { final XQuery query = new XQuery( "fn:tokenize(\"The cat sat on the mat\", \"\\s+\", \"t\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORX0001") ); } /** * Evaluation of tokenize function with pattern set to "\[" for an input string that contains "[". . */ @org.junit.Test public void fnTokenize20() { final XQuery query = new XQuery( "fn:tokenize(\"abracadabra[abracadabra\", \"\\[\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"abracadabra\", \"abracadabra\"") ); } /** * Evaluation of tokenize function with pattern set to "\]" for an input string that contains "]". . */ @org.junit.Test public void fnTokenize21() { final XQuery query = new XQuery( "fn:tokenize(\"abracadabra]abracadabra\", \"\\]\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"abracadabra\", \"abracadabra\"") ); } /** * Evaluation of tokenize function with pattern set to "\-" for an input string that contains "-". . */ @org.junit.Test public void fnTokenize22() { final XQuery query = new XQuery( "fn:tokenize(\"abracadabra-abracadabra\", \"\\-\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"abracadabra\", \"abracadabra\"") ); } /** * Evaluation of tokenize function with pattern set to "\." for an input string that contains ".". . */ @org.junit.Test public void fnTokenize23() { final XQuery query = new XQuery( "fn:tokenize(\"abracadabra.abracadabra\", \"\\.\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"abracadabra\", \"abracadabra\"") ); } /** * Evaluation of tokenize function with pattern set to "\|" for an input string that contains "|". . */ @org.junit.Test public void fnTokenize24() { final XQuery query = new XQuery( "fn:tokenize(\"abracadabra|abracadabra\", \"\\|\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"abracadabra\", \"abracadabra\"") ); } /** * Evaluation of tokenize function with pattern set to "\\" for an input string that contains "\". . */ @org.junit.Test public void fnTokenize25() { final XQuery query = new XQuery( "fn:tokenize(\"abracadabra\\abracadabra\", \"\\\\\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"abracadabra\", \"abracadabra\"") ); } /** * Evaluation of tokenize function with pattern set to "\t" for an input string that contains the tab character. . */ @org.junit.Test public void fnTokenize26() { final XQuery query = new XQuery( "fn:tokenize(\"abracadabra\tabracadabra\", \"\\t\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"abracadabra\", \"abracadabra\"") ); } /** * Evaluation of tokenize function with pattern set to "\n" for an input string that contains the newline character. . */ @org.junit.Test public void fnTokenize27() { final XQuery query = new XQuery( "fn:tokenize(\"abracadabra\n" + "abracadabra\", \"\\n\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"abracadabra\", \"abracadabra\"") ); } /** * Evaluation of tokenize function with pattern set to "aa{1}" (exact quantity) for an input string that contains the "aa" string. . */ @org.junit.Test public void fnTokenize28() { final XQuery query = new XQuery( "fn:tokenize(\"abracadabraabracadabra\", \"aa{1}\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"abracadabr\", \"bracadabra\"") ); } /** * Evaluation of tokenize function with pattern set to "aa{1,}" (min quantity) for an input string that contains the "aa" string twice. . */ @org.junit.Test public void fnTokenize29() { final XQuery query = new XQuery( "fn:tokenize(\"abracadabraabracadabraabracadabra\", \"aa{1,}\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"abracadabr\", \"bracadabr\", \"bracadabra\"") ); } /** * Evaluation of tokenize function with pattern set to "\s+" as per example 1 for this functions from the Func and Ops specs. . */ @org.junit.Test public void fnTokenize3() { final XQuery query = new XQuery( "fn:tokenize(\"The cat sat on the mat\", \"\\s+\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "The cat sat on the mat") ); } /** * Evaluation of tokenize function with pattern set to "aa{1,2}" (range quantity) for an input string that contains the "aa" string twice. . */ @org.junit.Test public void fnTokenize30() { final XQuery query = new XQuery( "fn:tokenize(\"abracadabraabracadabraabracadabra\", \"aa{1,2}\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"abracadabr\", \"bracadabr\", \"bracadabra\"") ); } /** * Evaluation of tokenize function with regex 'q' flag. . */ @org.junit.Test public void fnTokenize31() { final XQuery query = new XQuery( "fn:tokenize(\"abc.def.gh.ijk\", \".\", \"q\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"abc\", \"def\", \"gh\", \"ijk\"") ); } /** * Evaluation of tokenize function with regex 'q' and "i" flags. . */ @org.junit.Test public void fnTokenize32() { final XQuery query = new XQuery( "fn:tokenize(\"A.BRA.CADA.BRA\", \"a.\", \"qi\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"\", \"BR\", \"CAD\", \"BRA\"") ); } /** * Evaluation of tokenize function with non-capturing group in the regex. . */ @org.junit.Test public void fnTokenize33() { final XQuery query = new XQuery( "fn:tokenize(\"ABRACADABRA\", \"A(?:B)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"\", \"RACAD\", \"RA\"") ); } /** * "." does NOT match CR in default mode. */ @org.junit.Test public void fnTokenize34() { final XQuery query = new XQuery( "fn:tokenize(concat('Mary', codepoints-to-string(13), 'Jones'), 'y.J')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("concat('Mary', codepoints-to-string(13), 'Jones')") ); } /** * "." does match CR in dot-all mode. */ @org.junit.Test public void fnTokenize35() { final XQuery query = new XQuery( "fn:tokenize(concat('Mary', codepoints-to-string(13), 'Jones'), 'y.J', 's')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"Mar\", \"ones\"") ); } /** * Evaluation of tokenize function with pattern set to "\s*" as per example 2 for this functions from the Func and Ops specs. . */ @org.junit.Test public void fnTokenize4() { final XQuery query = new XQuery( "fn:tokenize(\"1, 15, 24, 50\", \",\\s*\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 15 24 50") ); } /** * Evaluation of tokenize function with pattern set to "\s*<br>\s*" and flag set to "i" as per example 4 for this functions from the Func and Ops specs. . */ @org.junit.Test public void fnTokenize5() { final XQuery query = new XQuery( "fn:tokenize(\"Some unparsed <br> HTML <BR> text\", \"\\s*<br>\\s*\", \"i\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"Some unparsed\", \"HTML\", \"text\"") ); } /** * Evaluation of tokenize function with pattern with flags arguments set to empty string. . */ @org.junit.Test public void fnTokenize6() { final XQuery query = new XQuery( "fn:tokenize(\"Some unparsed <br> HTML <BR> text\", \"\\s*<br>\\s*\", \"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"Some unparsed\", \"HTML <BR> text\"") ); } /** * Evaluation of tokenize function with $input set to empty sequence Uses fn:count to avoid empty file. . */ @org.junit.Test public void fnTokenize7() { final XQuery query = new XQuery( "fn:count(fn:tokenize((), \"\\s+\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of tokenize function with $input set to zero length string. Uses fn:count to avoid empty file. . */ @org.junit.Test public void fnTokenize8() { final XQuery query = new XQuery( "fn:count(fn:tokenize(\"\", \"\\s+\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of tokenize function with two patterms matching the input string. . */ @org.junit.Test public void fnTokenize9() { final XQuery query = new XQuery( "string-join(fn:tokenize(\"abracadabra\", \"(ab)|(a)\"), '#')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "#r#c#d#r#") ); } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnTrace.java��������������������������0000664�0000000�0000000�00000034625�12224530032�0026303�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the trace() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnTrace extends QT3TestSet { /** * A test whose essence is: `trace()`. . */ @org.junit.Test public void kTraceFunc1() { final XQuery query = new XQuery( "trace()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `trace(.)`. . */ @org.junit.Test public void kTraceFunc2() { final XQuery query = new XQuery( "trace(.)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `trace(., "message", "wrong parameter")`. . */ @org.junit.Test public void kTraceFunc3() { final XQuery query = new XQuery( "trace(., \"message\", \"wrong parameter\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `trace("a string", "trace message")`. . */ @org.junit.Test public void kTraceFunc4() { final XQuery query = new XQuery( "trace(\"a string\", \"trace message\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a string") ); } /** * A test whose essence is: `empty(trace((), "trace message"))`. . */ @org.junit.Test public void kTraceFunc5() { final XQuery query = new XQuery( "empty(trace((), \"trace message\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * A test whose essence is: `empty(trace(error(), "trace message"))`. . */ @org.junit.Test public void kTraceFunc6() { final XQuery query = new XQuery( "empty(trace(error(), \"trace message\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * Evaluation of "fn:trace" function with wrong arity. . */ @org.junit.Test public void fnTrace1() { final XQuery query = new XQuery( "fn:trace()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Simple call of "fn:trace" function used with string manipulation (fn:concat). . */ @org.junit.Test public void fnTrace10() { final XQuery query = new XQuery( "for $var in (\"aa\",\"bb\",\"cc\",\"dd\",\"ee\") return fn:trace(fn:concat($var,$var) ,\"The Value of concat($var,$var) is: \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "aaaa bbbb cccc dddd eeee") ); } /** * Simple call of "fn:trace" function used numbers manipulation queried from an xml file. . */ @org.junit.Test public void fnTrace11() { final XQuery query = new XQuery( "for $var in (/works//hours) return fn:trace(($var div 2) ,\"The Value of hours div/2 is: \")", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "20 35 10 40 10 20 10 15 6 20 40 10 10 10 20 40") ); } /** * Simple call of "fn:trace" function used numbers manipulation queried from an xml file and the entire query is given as argument to the function. . */ @org.junit.Test public void fnTrace12() { final XQuery query = new XQuery( "fn:trace((for $var in (/works//hours) return $var + $var) ,\"The Value of the given expression is: \")", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "80 140 40 160 40 80 40 60 24 80 160 40 40 40 80 160") ); } /** * Simple call of "fn:trace" function used in a math expression involving the "avg" function. . */ @org.junit.Test public void fnTrace13() { final XQuery query = new XQuery( "fn:trace((fn:avg((1,3,3,4,5)) * 2) ,\"The Value of 'fn:avg((1,3,3,4,5)) * 2' is: \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "6.4") ); } /** * Simple call of "fn:trace" function used in expression involving casting (floats to integer). . */ @org.junit.Test public void fnTrace14() { final XQuery query = new XQuery( "fn:trace((for $var in (1.1,2.2,3.3,4.4,5.5) return xs:integer($var)) ,\"The Value of 'for $var in (1.1,2.2,3.3,4.4,5.5) return xs:float($var)' is: \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 4 5") ); } /** * Simple call of "fn:trace" function that uses another fn-trace as argument. . */ @org.junit.Test public void fnTrace15() { final XQuery query = new XQuery( "fn:trace((fn:trace((2+2),\"The value of '2 + 2' is:\" )) ,\"The Value of 'fn:trace(2+2)' is: \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4") ); } /** * Simple call of "fn:trace" function used in a math expression involving the "abs" function. . */ @org.junit.Test public void fnTrace16() { final XQuery query = new XQuery( "fn:trace((fn:count((1,2,-3,-4,5)) * 2) ,\"The Value of 'fn:count(1,2,-3,-4,5)) * 2' is: \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10") ); } /** * Simple call of "fn:trace" function used in a math expression involving boolean operations ("and" and fn:true()). . */ @org.junit.Test public void fnTrace17() { final XQuery query = new XQuery( "fn:trace((for $var in (fn:true(),fn:false(),fn:true()) return $var and fn:true()) ,\"The value of 'for $var in (fn:true(),fn:false(),fn:true() return $var and fn:true()' is:\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true false true") ); } /** * Simple call of "fn:trace" function used in a math expression involving boolean operations ("or" and fn:true()). . */ @org.junit.Test public void fnTrace18() { final XQuery query = new XQuery( "fn:trace((for $var in (fn:true(),fn:false(),fn:true()) return $var or fn:true()) ,\"The value of 'for $var in (fn:true(),fn:false(),fn:true() return $var or fn:true()' is:\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true true") ); } /** * Simple call of "fn:trace" function where the first argument is the empty sequence. Uses fn:count to maybe avoid empty file. . */ @org.junit.Test public void fnTrace19() { final XQuery query = new XQuery( "fn:count(fn:trace(() ,\"The value of the empty sequence is:\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "0") || error("XPST0005") ) ); } /** * Simple call of "fn:trace" function with integer value. . */ @org.junit.Test public void fnTrace2() { final XQuery query = new XQuery( "\n" + " let $var := xs:integer(\"123\") \n" + " return fn:trace($var,\"The Value of $var is: \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "123") ); } /** * Simple call of "fn:trace" function where the first argument is the zero length string. Uses fn:count to maybe avoid empty file. . */ @org.junit.Test public void fnTrace20() { final XQuery query = new XQuery( "fn:count(fn:trace(\"\" ,\"The value of the zero length string is:\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Simple call of "fn:trace" function involving string manipulations with upper/lower case functions. . */ @org.junit.Test public void fnTrace21() { final XQuery query = new XQuery( "fn:trace((for $var in (fn:upper-case(\"a\"),fn:lower-case(\"B\")) return (fn:lower-case($var),fn:upper-case($var))) ,\"The value of the complex expression on the other argument is:\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a A b B") ); } /** * Simple call of "fn:trace" function used with an addition operation. . */ @org.junit.Test public void fnTrace3() { final XQuery query = new XQuery( "for $var in (1,2,3,4,5) return fn:trace($var + 1,\"The Value of $var + 1 is: \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2 3 4 5 6") ); } /** * Simple call of "fn:trace" function used with a subtraction operation. . */ @org.junit.Test public void fnTrace4() { final XQuery query = new XQuery( "for $var in (2,3,4,5) return fn:trace($var - 1,\"The Value of $var - 1 is: \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 4") ); } /** * Simple call of "fn:trace" function used with a multiplication operation. . */ @org.junit.Test public void fnTrace5() { final XQuery query = new XQuery( "for $var in (2,3,4,5) return fn:trace($var * 2 ,\"The Value of $var * 2 is: \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4 6 8 10") ); } /** * Simple call of "fn:trace" function used with a division (div operator) operation. . */ @org.junit.Test public void fnTrace6() { final XQuery query = new XQuery( "for $var in (2,4,6,8) return fn:trace($var div 2 ,\"The Value of $var div 2 is: \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 4") ); } /** * Simple call of "fn:trace" function used with a division (idiv operator) operation. . */ @org.junit.Test public void fnTrace7() { final XQuery query = new XQuery( "for $var in (2,4,6,8) return fn:trace($var idiv 2 ,\"The Value of $var idiv 2 is: \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 4") ); } /** * Simple call of "fn:trace" function used with a modulus operation. . */ @org.junit.Test public void fnTrace8() { final XQuery query = new XQuery( "for $var in (2,4,6,8) return fn:trace($var mod 2 ,\"The Value of $var mod 2 is: \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0 0 0 0") ); } /** * Simple call of "fn:trace" function used with two variables, where the second one uses the first one in a more complex math expression. . */ @org.junit.Test public void fnTrace9() { final XQuery query = new XQuery( "for $var1 in (2,4,6,8), $var2 in (3 + $var1) - (4 * $var1) \n" + " return fn:trace($var1 + $var2 ,\"The Value of $var 1 + $var2 is: \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1 -5 -9 -13") ); } } �����������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnTranslate.java����������������������0000664�0000000�0000000�00000047237�12224530032�0027205�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** . * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnTranslate extends QT3TestSet { /** * A test whose essence is: `translate()`. . */ @org.junit.Test public void kTranslateFunc1() { final XQuery query = new XQuery( "translate()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `translate("--aaa--","abc-","ABC") eq "AAA"`. . */ @org.junit.Test public void kTranslateFunc10() { final XQuery query = new XQuery( "translate(\"--aaa--\",\"abc-\",\"ABC\") eq \"AAA\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `translate("string", "map string")`. . */ @org.junit.Test public void kTranslateFunc2() { final XQuery query = new XQuery( "translate(\"string\", \"map string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `translate("arg", "map string", "transString", "wrong param")`. . */ @org.junit.Test public void kTranslateFunc3() { final XQuery query = new XQuery( "translate(\"arg\", \"map string\", \"transString\", \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `translate("--aaa--","-","") eq "aaa"`. . */ @org.junit.Test public void kTranslateFunc4() { final XQuery query = new XQuery( "translate(\"--aaa--\",\"-\",\"\") eq \"aaa\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `translate("--aaa--","bbb++","") eq "--aaa--"`. . */ @org.junit.Test public void kTranslateFunc5() { final XQuery query = new XQuery( "translate(\"--aaa--\",\"bbb++\",\"\") eq \"--aaa--\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `translate("argstr", "", "matrs") eq "argstr"`. . */ @org.junit.Test public void kTranslateFunc6() { final XQuery query = new XQuery( "translate(\"argstr\", \"\", \"matrs\") eq \"argstr\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `translate((), "map", "trans") eq ""`. . */ @org.junit.Test public void kTranslateFunc7() { final XQuery query = new XQuery( "translate((), \"map\", \"trans\") eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `translate("abcdabc", "abc", "AB") eq "ABdAB"`. . */ @org.junit.Test public void kTranslateFunc8() { final XQuery query = new XQuery( "translate(\"abcdabc\", \"abc\", \"AB\") eq \"ABdAB\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `translate("bar","abc","ABC") eq "BAr"`. . */ @org.junit.Test public void kTranslateFunc9() { final XQuery query = new XQuery( "translate(\"bar\",\"abc\",\"ABC\") eq \"BAr\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The second argument to fn:translate() cannot be the empty sequence. . */ @org.junit.Test public void k2TranslateFunc1() { final XQuery query = new XQuery( "fn:translate(\"arg\", (), \"transString\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The third argument to fn:translate() cannot be the empty sequence. . */ @org.junit.Test public void k2TranslateFunc2() { final XQuery query = new XQuery( "fn:translate(\"arg\", \"mapString\", ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests EffectiveBooleanValue on fn:translate . */ @org.junit.Test public void cbclFnTranslate001() { final XQuery query = new XQuery( "\n" + " boolean(translate(string-join(for $x in 1 to 10 return \"blah\",\"-\"),exactly-one((\"--\",\"==\")[position() mod 2 = 0]),\"__\"))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Tests with surrogates . */ @org.junit.Test public void cbclFnTranslate002() { final XQuery query = new XQuery( "\n" + " translate(codepoints-to-string(65536 to 65537),codepoints-to-string(65536 to 65537),\"l\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "l") ); } /** * Simple test of translate function as per example one for this function from the F andO specs. . */ @org.junit.Test public void fnTranslate1() { final XQuery query = new XQuery( "fn:translate(\"bar\",\"abc\",\"ABC\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "BAr") ); } /** * Evaluation of translate function, where all three arguments are an invocation to "fn:string". . */ @org.junit.Test public void fnTranslate10() { final XQuery query = new XQuery( "fn:translate(fn:string(\"ABC\"), fn:string(\"ABC\"), fn:string(\"ABC\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ABC") ); } /** * Evaluation of translate function as an argument to the "fn:string" function. . */ @org.junit.Test public void fnTranslate11() { final XQuery query = new XQuery( "fn:string(fn:translate(\"ABC\", \"ABC\", \"ABC\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ABC") ); } /** * Evaluation of translate function as an argument to the "fn:string-length" function. . */ @org.junit.Test public void fnTranslate12() { final XQuery query = new XQuery( "fn:string-length(fn:translate(\"ABC\",\"ABC\",\"ABC\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Evaluation of translate function as an argument to the "xs:decimal" constructor function. . */ @org.junit.Test public void fnTranslate13() { final XQuery query = new XQuery( "xs:decimal(fn:translate(\"123\",\"123\",\"123\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "123") ); } /** * Evaluation of translate function as an argument to the "xs:integer" constructor function. . */ @org.junit.Test public void fnTranslate14() { final XQuery query = new XQuery( "xs:integer(fn:translate(\"123\",\"123\",\"123\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "123") ); } /** * Evaluation of translate function as an argument to the "xs:float" constructor function. . */ @org.junit.Test public void fnTranslate15() { final XQuery query = new XQuery( "xs:float(fn:translate(\"123\",\"123\",\"123\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "123") ); } /** * Evaluation of translate function as an argument to the "xs:double" constructor function. . */ @org.junit.Test public void fnTranslate16() { final XQuery query = new XQuery( "xs:double(fn:translate(\"123\",\"123\",\"123\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "123") ); } /** * Evaluation of translate function using non-BMP characters.. */ @org.junit.Test public void fnTranslate17() { final XQuery query = new XQuery( "translate(\"abcd\", \"ð€a\", \"xy\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"ybcd\"") ); } /** * Evaluation of translate function using non-BMP characters.. */ @org.junit.Test public void fnTranslate18() { final XQuery query = new XQuery( "translate(\"abcd\", \"xa\", \"ð€y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"ybcd\"") ); } /** * Evaluation of translate function using non-BMP characters.. */ @org.junit.Test public void fnTranslate19() { final XQuery query = new XQuery( "translate(\"abcdð€„e\", \"að€„e\", \"XYZ\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"XbcdYZ\"") ); } /** * Simple test of translate function as per example two for this function from the F andO specs. . */ @org.junit.Test public void fnTranslate2() { final XQuery query = new XQuery( "fn:translate(\"--aaa--\",\"abc-\",\"ABC\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "AAA") ); } /** * Evaluation of translate function using non-BMP characters.. */ @org.junit.Test public void fnTranslate20() { final XQuery query = new XQuery( "translate(\"abcdð€„e\", \"að€„e\", \"ð€†YZ\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"ð€†bcdYZ\"") ); } /** * Simple test of translate function as per example three for this function from the F andO specs. . */ @org.junit.Test public void fnTranslate3() { final XQuery query = new XQuery( "fn:translate(\"abcdabc\", \"abc\", \"AB\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ABdAB") ); } /** * Evaluation of translate function. Translate lower case letters to upper case letters. . */ @org.junit.Test public void fnTranslate4() { final XQuery query = new XQuery( "fn:translate(\"acdefghijklmnopqrstuvwxyz\", \"abcdefghijklmnopqrstuvwxyz\", \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ACDEFGHIJKLMNOPQRSTUVWXYZ") ); } /** * Evaluation of translate function. Translate upper case letters to lower case letters. . */ @org.junit.Test public void fnTranslate5() { final XQuery query = new XQuery( "fn:translate(\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\",\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\",\"abcdefghijklmnopqrstuvwxyz\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcdefghijklmnopqrstuvwxyz") ); } /** * Evaluation of translate function, where all three arguments are the zero length string. Use fn;count to avoid empty file. . */ @org.junit.Test public void fnTranslate6() { final XQuery query = new XQuery( "fn:count(fn:translate(\"\",\"\",\"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluation of translate function, where the first and third arguments are the same (letters). . */ @org.junit.Test public void fnTranslate7() { final XQuery query = new XQuery( "fn:translate(\"ABC\", \"ABC\", \"ABC\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ABC") ); } /** * Evaluation of translate function, where all arguments are the same (numbers). . */ @org.junit.Test public void fnTranslate8() { final XQuery query = new XQuery( "fn:translate(\"123\", \"123\", \"123\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "123") ); } /** * Evaluation of translate function, there is a mixture of numbers and letters. . */ @org.junit.Test public void fnTranslate9() { final XQuery query = new XQuery( "fn:translate(\"123ABC\", \"123ABC\", \"123ABC\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "123ABC") ); } /** * Test simple translate expression . */ @org.junit.Test public void fnTranslate3args1() { final XQuery query = new XQuery( "translate('---abcABCxyz---','-abcABCxyz','1ABCabcXYZ')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "111ABCabcXYZ111") ); } /** * Test translate on space, tab, and newline . */ @org.junit.Test public void fnTranslate3args2() { final XQuery query = new XQuery( "translate('newline\n" + "tab\tspace ','\n" + "\t ','123')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "newline1tab2space3") ); } /** * Test translate with zero-length string argument . */ @org.junit.Test public void fnTranslate3args3() { final XQuery query = new XQuery( "translate('','-','x')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * Test translate with an empty sequence argument . */ @org.junit.Test public void fnTranslate3args4() { final XQuery query = new XQuery( "translate((),'-','x')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * Test translate with invalid type in 1st argument . */ @org.junit.Test public void fnTranslate3args5() { final XQuery query = new XQuery( "translate(1,'-','x')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test translate with invalid type in 2nd argument . */ @org.junit.Test public void fnTranslate3args6() { final XQuery query = new XQuery( "translate('abc',1,'x')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test translate with invalid type in 3rd argument . */ @org.junit.Test public void fnTranslate3args7() { final XQuery query = new XQuery( "translate('abc','x',1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test translate with incorrect arity . */ @org.junit.Test public void fnTranslate3args8() { final XQuery query = new XQuery( "translate('abc')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnTrue.java���������������������������0000664�0000000�0000000�00000026216�12224530032�0026161�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the function true(). * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnTrue extends QT3TestSet { /** * A test whose essence is: `true(1)`. . */ @org.junit.Test public void kTrueFunc1() { final XQuery query = new XQuery( "true(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `true() eq true()`. . */ @org.junit.Test public void kTrueFunc2() { final XQuery query = new XQuery( "true() eq true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `true()`. . */ @org.junit.Test public void kTrueFunc3() { final XQuery query = new XQuery( "true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple call to an "fn:true" function. . */ @org.junit.Test public void fnTrue1() { final XQuery query = new XQuery( "fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) && assertType("xs:boolean") ) ); } /** * Evaluation of an "fn:true" function with a comparison expression involving the "ge" operator. . */ @org.junit.Test public void fnTrue10() { final XQuery query = new XQuery( "fn:true() ge fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an "fn:true" function with a comparison expression involving the "=" operator. . */ @org.junit.Test public void fnTrue11() { final XQuery query = new XQuery( "fn:true() = fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an "fn:true" function with a comparison expression involving the "!=" operator. . */ @org.junit.Test public void fnTrue12() { final XQuery query = new XQuery( "fn:true() != fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of an "fn:true" function with a comparison expression involving the "<" operator. . */ @org.junit.Test public void fnTrue13() { final XQuery query = new XQuery( "fn:true() < fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of an "fn:true" function with a comparison expression involving the "<=" operator. . */ @org.junit.Test public void fnTrue14() { final XQuery query = new XQuery( "fn:true() <= fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an "fn:true" function with a comparison expression involving the ">" operator. . */ @org.junit.Test public void fnTrue15() { final XQuery query = new XQuery( "fn:true() > fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of an "fn:true" function with a comparison expression involving the ">=" operator. . */ @org.junit.Test public void fnTrue16() { final XQuery query = new XQuery( "fn:true() >= fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an "fn:true" function as an argument to an "xs:boolean" function. . */ @org.junit.Test public void fnTrue17() { final XQuery query = new XQuery( "xs:boolean(fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an "fn:true" function as an argument to an "fn:string" function. . */ @org.junit.Test public void fnTrue18() { final XQuery query = new XQuery( "fn:string(fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"true\"") ); } /** * Evaluation of an "fn:true" function as arguments to an "fn:concat" function. . */ @org.junit.Test public void fnTrue19() { final XQuery query = new XQuery( "fn:concat(xs:string(fn:true()),xs:string(fn:true()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "truetrue") ); } /** * Evaluation of "fn:true" function as an argument to "fn:not" function. . */ @org.junit.Test public void fnTrue2() { final XQuery query = new XQuery( "fn:not(fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of an "fn:true" function as arguments to an "fn:contains" function. . */ @org.junit.Test public void fnTrue20() { final XQuery query = new XQuery( "fn:contains(xs:string(fn:true()),xs:string(fn:true()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an "fn:true" function as an argument to an "fn:string-length" function. . */ @org.junit.Test public void fnTrue21() { final XQuery query = new XQuery( "fn:string-length(xs:string(fn:true()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4") ); } /** * true() as a function item. */ @org.junit.Test public void fnTrue22() { final XQuery query = new XQuery( "let $t := true#0 return 3[$t()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Evaluation of a "true" function with a logical expression involving the "and" operator. . */ @org.junit.Test public void fnTrue3() { final XQuery query = new XQuery( "fn:true() and fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of a "fn:true" function with a logical expression involving the "or" operator. . */ @org.junit.Test public void fnTrue4() { final XQuery query = new XQuery( "fn:true() or fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an "fn:true" function with a comparison expression involving the "eq" operator. . */ @org.junit.Test public void fnTrue5() { final XQuery query = new XQuery( "fn:true() eq fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an "fn:true" function with a comparison expression involving the "ne" operator. . */ @org.junit.Test public void fnTrue6() { final XQuery query = new XQuery( "fn:true() ne fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of an "fn:true" function with a comparison expression involving the "lt" operator. . */ @org.junit.Test public void fnTrue7() { final XQuery query = new XQuery( "fn:true() lt fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of an "fn:true" function with a comparison expression involving the "le" operator. . */ @org.junit.Test public void fnTrue8() { final XQuery query = new XQuery( "fn:true() le fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of an "fn:true" function with a comparison expression involving the "gt" operator. . */ @org.junit.Test public void fnTrue9() { final XQuery query = new XQuery( "fn:true() gt fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnUnordered.java����������������������0000664�0000000�0000000�00000037612�12224530032�0027173�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the unordered() function. (Note: many of these tests will only work if unordered() is implemented as a no-op. The tests are therefore incorrect. I'm leaving them as such until someone cares to challenge the results - Michael Kay 2011-06-30 . * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnUnordered extends QT3TestSet { /** * A test whose essence is: `unordered()`. . */ @org.junit.Test public void kSeqUnorderedFunc1() { final XQuery query = new XQuery( "unordered()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `unordered(1, 2)`. . */ @org.junit.Test public void kSeqUnorderedFunc2() { final XQuery query = new XQuery( "unordered(1, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `unordered(1) eq 1`. . */ @org.junit.Test public void kSeqUnorderedFunc3() { final XQuery query = new XQuery( "unordered(1) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(unordered((1, 2, 3))) eq 3`. . */ @org.junit.Test public void kSeqUnorderedFunc4() { final XQuery query = new XQuery( "count(unordered((1, 2, 3))) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(unordered((1, 2, current-time()))) eq 3`. . */ @org.junit.Test public void kSeqUnorderedFunc5() { final XQuery query = new XQuery( "count(unordered((1, 2, current-time()))) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(unordered(()))`. . */ @org.junit.Test public void kSeqUnorderedFunc6() { final XQuery query = new XQuery( "empty(unordered(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * A test whose essence is: `deep-equal((1, 2, 3), unordered((1, 2, 3)))`. . */ @org.junit.Test public void kSeqUnorderedFunc7() { final XQuery query = new XQuery( "deep-equal((1, 2, 3), unordered((1, 2, 3)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `unordered(error())`. . */ @org.junit.Test public void kSeqUnorderedFunc8() { final XQuery query = new XQuery( "unordered(error())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * Tests optimizations for unordered . */ @org.junit.Test public void cbclFnUnordered001() { final XQuery query = new XQuery( "boolean(unordered(reverse((1 to 10)[. div 2 = 2])))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Tries EvaluateOptionalItem on fn:unordered . */ @org.junit.Test public void cbclFnUnordered002() { final XQuery query = new XQuery( "local-name(unordered(<a><b/><c/></a>/*[1]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "b") ); } /** * Tests corner evaluation case . */ @org.junit.Test public void cbclFnUnordered003() { final XQuery query = new XQuery( "floor(unordered((1 to 10)[. div 2 = 0]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * arg: sequence of string . */ @org.junit.Test public void fnUnorderedMixArgs001() { final XQuery query = new XQuery( "fn:unordered( (\"c\",1, \"xzy\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"c\", 1, \"xzy\"") ); } /** * arg: sequence of string . */ @org.junit.Test public void fnUnorderedMixArgs002() { final XQuery query = new XQuery( "fn:unordered( (\"c\", \"b\", \"a\") )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"c\", \"b\", \"a\"") ); } /** * arg: sequence of string . */ @org.junit.Test public void fnUnorderedMixArgs003() { final XQuery query = new XQuery( "fn:unordered ( (\"a\", \"b\", \"c\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"a\", \"b\", \"c\"") ); } /** * arg: sequence of string . */ @org.junit.Test public void fnUnorderedMixArgs004() { final XQuery query = new XQuery( "fn:unordered ( (\"a\", xs:string(\"\"), \"b\", \"c\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"a\", \"\", \"b\", \"c\"") ); } /** * arg: sequence of string & anyURI . */ @org.junit.Test public void fnUnorderedMixArgs005() { final XQuery query = new XQuery( "fn:unordered ( (\"a\", xs:anyURI(\"www.example.com\"), \"b\", \"c\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"a\", \"www.example.com\", \"b\", \"c\"") ); } /** * arg: sequence of string . */ @org.junit.Test public void fnUnorderedMixArgs006() { final XQuery query = new XQuery( "fn:unordered ( (\"a\", (), (), \"b\", \"c\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"a\", \"b\", \"c\"") ); } /** * arg: sequence of string & integer . */ @org.junit.Test public void fnUnorderedMixArgs007() { final XQuery query = new XQuery( "fn:unordered ( (\"a\", xs:integer(\"100\"), xs:integer(\"-100\"), \"b\", \"c\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"a\", 100, -100, \"b\", \"c\"") ); } /** * arg: sequence of string , decimal & integer . */ @org.junit.Test public void fnUnorderedMixArgs008() { final XQuery query = new XQuery( "fn:unordered ( (\"a\", xs:decimal(\"-1.000000000001\"), xs:integer(\"-100\"), \"b\", \"c\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"a\", -1.000000000001, -100, \"b\", \"c\"") ); } /** * arg: sequence of string & float . */ @org.junit.Test public void fnUnorderedMixArgs009() { final XQuery query = new XQuery( "fn:unordered ( (\"a\", xs:float(\"INF\"), \"b\", \"c\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"a\", xs:float(\"INF\"), \"b\", \"c\"") ); } /** * arg: sequence of string & float . */ @org.junit.Test public void fnUnorderedMixArgs010() { final XQuery query = new XQuery( "fn:unordered ( (\"a\", xs:float(\"-INF\"), \"b\", \"c\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"a\", xs:float('-INF'), \"b\", \"c\"") ); } /** * arg: sequence of string & float . */ @org.junit.Test public void fnUnorderedMixArgs011() { final XQuery query = new XQuery( "fn:unordered ( (\"a\", xs:float(\"NaN\"), \"b\", \"c\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"a\", xs:float('NaN'), \"b\", \"c\"") ); } /** * arg: sequence of string & float . */ @org.junit.Test public void fnUnorderedMixArgs012() { final XQuery query = new XQuery( "fn:unordered ( (\"a\", xs:float(\"1.01\"), \"b\", \"c\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"a\", 1.01, \"b\", \"c\"") ); } /** * arg: sequence of string & double . */ @org.junit.Test public void fnUnorderedMixArgs013() { final XQuery query = new XQuery( "fn:unordered ( (\"a\", xs:double(\"NaN\"), \"b\", \"c\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"a\", xs:double('NaN'), \"b\", \"c\"") ); } /** * arg: sequence of string & double . */ @org.junit.Test public void fnUnorderedMixArgs014() { final XQuery query = new XQuery( "fn:unordered ( (\"a\", xs:double(\"1.01\"), \"b\", \"c\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"a\", 1.01, \"b\", \"c\"") ); } /** * arg: sequence of string & double . */ @org.junit.Test public void fnUnorderedMixArgs015() { final XQuery query = new XQuery( "fn:unordered ( (\"a\", xs:double(\"-INF\"), \"b\", \"c\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"a\", xs:double('-INF'), \"b\", \"c\"") ); } /** * arg: sequence of string & double . */ @org.junit.Test public void fnUnorderedMixArgs016() { final XQuery query = new XQuery( "fn:unordered ( (\"a\", xs:double(\"INF\"), \"b\", \"c\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"a\", xs:double(\"INF\"), \"b\", \"c\"") ); } /** * arg: sequence of string & boolean . */ @org.junit.Test public void fnUnorderedMixArgs017() { final XQuery query = new XQuery( "fn:unordered ( (\"a\", xs:boolean(\"1\"), \"b\", \"c\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"a\", true(), \"b\", \"c\"") ); } /** * arg: sequence of string & boolean . */ @org.junit.Test public void fnUnorderedMixArgs018() { final XQuery query = new XQuery( "fn:unordered ( (\"a\", xs:boolean(\"0\"), \"b\", \"c\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"a\", false(), \"b\", \"c\"") ); } /** * arg: sequence of string & boolean . */ @org.junit.Test public void fnUnorderedMixArgs019() { final XQuery query = new XQuery( "fn:unordered ( (\"a\", xs:boolean(\"true\"), \"b\", \"c\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"a\", true(), \"b\", \"c\"") ); } /** * arg: sequence of string & boolean . */ @org.junit.Test public void fnUnorderedMixArgs020() { final XQuery query = new XQuery( "fn:unordered ( (\"a\", xs:boolean(\"false\"), \"b\", \"c\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"a\", false(), \"b\", \"c\"") ); } /** * arg: sequence of string & date . */ @org.junit.Test public void fnUnorderedMixArgs021() { final XQuery query = new XQuery( "fn:unordered ( (\"a\", xs:date(\"1993-03-31\"), \"b\", \"c\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"a\", xs:date('1993-03-31'), \"b\", \"c\"") ); } /** * arg: sequence of string & dateTime . */ @org.junit.Test public void fnUnorderedMixArgs022() { final XQuery query = new XQuery( "fn:unordered ( (\"a\", xs:dateTime(\"1972-12-31T00:00:00\"), \"b\", \"c\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"a\", xs:dateTime(\"1972-12-31T00:00:00\"), \"b\", \"c\"") ); } /** * arg: sequence of string & time . */ @org.junit.Test public void fnUnorderedMixArgs023() { final XQuery query = new XQuery( "fn:unordered ( (\"a\", xs:time(\"12:30:00\"), \"b\", \"c\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"a\", xs:time('12:30:00'), \"b\", \"c\"") ); } } ����������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnUnparsedText.java�������������������0000664�0000000�0000000�00000146567�12224530032�0027704�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the unparsed-text() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnUnparsedText extends QT3TestSet { /** * Attempts to evaluate the "unparsed-text" function with no arguments.. */ @org.junit.Test public void fnUnparsedText001() { final XQuery query = new XQuery( "fn:unparsed-text()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "unparsed-text" function with arity zero.. */ @org.junit.Test public void fnUnparsedText002() { final XQuery query = new XQuery( "fn:unparsed-text#0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "unparsed-text" function with arity one.. */ @org.junit.Test public void fnUnparsedText003() { final XQuery query = new XQuery( "fn:exists( fn:unparsed-text#1 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to reference the "unparsed-text" function with arity two.. */ @org.junit.Test public void fnUnparsedText004() { final XQuery query = new XQuery( "fn:exists( fn:unparsed-text#2 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to evaluate the "unparsed-text" function with three arguments.. */ @org.junit.Test public void fnUnparsedText005() { final XQuery query = new XQuery( "fn:unparsed-text(static-base-uri(), \"utf-8\", \"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "unparsed-text" function with arity three.. */ @org.junit.Test public void fnUnparsedText006() { final XQuery query = new XQuery( "fn:unparsed-text#3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Tests the type checking of the $href argument.. */ @org.junit.Test public void fnUnparsedText008() { final XQuery query = new XQuery( "( fn:unparsed-text( if (current-date() eq xs:date('1900-01-01'))\n" + " then \"http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt\"\n" + " else 1 ),\n" + " fn:unparsed-text( if (current-date() eq xs:date('1900-01-01'))\n" + " then 1\n" + " else \"http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt\") )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the type checking of the $encoding argument.. */ @org.junit.Test public void fnUnparsedText010() { final XQuery query = new XQuery( "( fn:unparsed-text( \"http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt\",\n" + " if (current-date() eq xs:date('1900-01-01'))\n" + " then \"utf-8\"\n" + " else 1 ),\n" + " fn:unparsed-text( \"http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt\",\n" + " if (current-date() eq xs:date('1900-01-01'))\n" + " then 1\n" + " else \"utf-8\") )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the type checking of the $encoding argument.. */ @org.junit.Test public void fnUnparsedText012() { final XQuery query = new XQuery( "( fn:unparsed-text( \"http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt\",\n" + " if (current-date() eq xs:date('1900-01-01'))\n" + " then \"utf-8\"\n" + " else () ),\n" + " fn:unparsed-text( \"http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt\",\n" + " if (current-date() eq xs:date('1900-01-01'))\n" + " then ()\n" + " else \"utf-8\") )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href contains a fragment identifier.. */ @org.junit.Test public void fnUnparsedText013() { final XQuery query = new XQuery( "fn:unparsed-text(\"http://www.example.org/#fragment\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href contains a fragment identifier.. */ @org.junit.Test public void fnUnparsedText014() { final XQuery query = new XQuery( "fn:unparsed-text(\"http://www.example.org/#fragment\", \"utf-8\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href is an invalid xs:anyURI.. */ @org.junit.Test public void fnUnparsedText015() { final XQuery query = new XQuery( "fn:unparsed-text(\"http://www.example.org/%gg\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href is an invalid xs:anyURI.. */ @org.junit.Test public void fnUnparsedText016() { final XQuery query = new XQuery( "fn:unparsed-text(\"http://www.example.org/%gg\", \"utf-8\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href is an invalid xs:anyURI.. */ @org.junit.Test public void fnUnparsedText017() { final XQuery query = new XQuery( "fn:unparsed-text(\":/\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href is an invalid xs:anyURI.. */ @org.junit.Test public void fnUnparsedText018() { final XQuery query = new XQuery( "fn:unparsed-text(\":/\", \"utf-8\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href refers to a non-existent file.. */ @org.junit.Test public void fnUnparsedText019() { final XQuery query = new XQuery( "fn:unparsed-text( \"http://www.w3.org/fots/unparsed-text/does-not-exist.txt\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href refers to a non-existent file.. */ @org.junit.Test public void fnUnparsedText020() { final XQuery query = new XQuery( "fn:unparsed-text( \"http://www.w3.org/fots/unparsed-text/does-not-exist.txt\", \"utf-8\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href uses a (probably) unsupported URI scheme.. */ @org.junit.Test public void fnUnparsedText021() { final XQuery query = new XQuery( "fn:unparsed-text(\"surely-nobody-supports-this:/path.txt\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href uses a (probably) unsupported URI scheme.. */ @org.junit.Test public void fnUnparsedText022() { final XQuery query = new XQuery( "fn:unparsed-text(\"surely-nobody-supports-this:/path.txt\", \"utf-8\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href is a relative URI, static base URI undefined.. */ @org.junit.Test public void fnUnparsedText023() { final XQuery query = new XQuery( "fn:unparsed-text(\"unparsed-text/text-plain-utf-8.txt\")", ctx); try { query.baseURI("#UNDEFINED"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0001") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href is a relative URI, static base URI undefined.. */ @org.junit.Test public void fnUnparsedText024() { final XQuery query = new XQuery( "fn:unparsed-text(\"unparsed-text/text-plain-utf-8.txt\", \"utf-8\")", ctx); try { query.baseURI("#UNDEFINED"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0001") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href is a relative URI, static base is defined.. */ @org.junit.Test public void fnUnparsedText025() { final XQuery query = new XQuery( "fn:unparsed-text(\"does-not-exist.txt\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href is a relative URI, static base is defined.. */ @org.junit.Test public void fnUnparsedText026() { final XQuery query = new XQuery( "fn:unparsed-text(\"does-not-exist.txt\", \"utf-8\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href is a relative URI, static base is defined.. */ @org.junit.Test public void fnUnparsedText027() { final XQuery query = new XQuery( "fn:unparsed-text(\"text-plain-utf-8.txt\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/"); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "hello world") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href is a relative URI, static base is defined.. */ @org.junit.Test public void fnUnparsedText028() { final XQuery query = new XQuery( "fn:unparsed-text(\"text-plain-utf-8.txt\", \"utf-8\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/"); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "hello world") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href is a Windows file path.. */ @org.junit.Test public void fnUnparsedText029() { final XQuery query = new XQuery( "fn:unparsed-text(\"C:\\file-might-exist.txt\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/"); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href is a Windows file path.. */ @org.junit.Test public void fnUnparsedText030() { final XQuery query = new XQuery( "fn:unparsed-text(\"C:\\file-might-exist.txt\", \"utf-8\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/"); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href is an empty string.. */ @org.junit.Test public void fnUnparsedText031() { final XQuery query = new XQuery( "fn:unparsed-text(\"\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt"); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "hello world") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href is an empty string.. */ @org.junit.Test public void fnUnparsedText032() { final XQuery query = new XQuery( "fn:unparsed-text(\"\", \"utf-8\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt"); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "hello world") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href is an empty string.. */ @org.junit.Test public void fnUnparsedText033() { final XQuery query = new XQuery( "fn:unparsed-text(\"\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/does-not-exists.txt"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href is an empty string.. */ @org.junit.Test public void fnUnparsedText034() { final XQuery query = new XQuery( "fn:unparsed-text(\"\", \"utf-8\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/does-not-exists.txt"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Test the effect of a call to fn:unparsed-text which need not be evaluated. Since implementations are allowed to dereference the sources in any case, an error is allowed.. */ @org.junit.Test public void fnUnparsedText035() { final XQuery query = new XQuery( "(1, fn:unparsed-text(\"http://www.w3.org/fots/unparsed-text/does-not-exist.txt\"))[1]", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "1") || error("FOUT1170") ) ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $encoding is invalid.. */ @org.junit.Test public void fnUnparsedText036() { final XQuery query = new XQuery( "fn:unparsed-text(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt\", \"123\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1190") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href refers to a file whose encoding cannot be determined.. */ @org.junit.Test public void fnUnparsedText037() { final XQuery query = new XQuery( "fn:unparsed-text(\"http://www.w3.org/fots/unparsed-text/unknown-encoding.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1200") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href refers to a file whose encoding is invalid for utf-8.. */ @org.junit.Test public void fnUnparsedText038() { final XQuery query = new XQuery( "fn:unparsed-text(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1190") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href refers to a file which contains non-XML characters.. */ @org.junit.Test public void fnUnparsedText039() { final XQuery query = new XQuery( "fn:unparsed-text(\"http://www.w3.org/fots/unparsed-text/non-xml-character.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1190") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href refers to a file which does not contain well-formed XML.. */ @org.junit.Test public void fnUnparsedText040() { final XQuery query = new XQuery( "fn:unparsed-text(\"http://www.w3.org/fots/unparsed-text/invalid-xml.xml\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "<?xml version=\"1.0\" encoding=\"utf-16\"?><text>hello world\r\n") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href refers to a file whose encoding is valid utf-8.. */ @org.junit.Test public void fnUnparsedText041() { final XQuery query = new XQuery( "fn:unparsed-text(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "hello world") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href refers to a file whose encoding is valid utf-8.. */ @org.junit.Test public void fnUnparsedText042() { final XQuery query = new XQuery( "fn:unparsed-text(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "hello world") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href refers to a file whose encoding is valid utf-16.. */ @org.junit.Test public void fnUnparsedText043() { final XQuery query = new XQuery( "fn:unparsed-text(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "hello world") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href refers to a file whose encoding is valid utf-16.. */ @org.junit.Test public void fnUnparsedText044() { final XQuery query = new XQuery( "fn:unparsed-text(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "hello world") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href refers to a file whose encoding is valid iso-8859-1.. */ @org.junit.Test public void fnUnparsedText045() { final XQuery query = new XQuery( "fn:unparsed-text(\"http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "hello world") || error("FOUT1190") ) ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href refers to a file whose encoding is valid utf-8.. */ @org.junit.Test public void fnUnparsedText046() { final XQuery query = new XQuery( "fn:unparsed-text(\"http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "<?xml version=\"1.0\" encoding=\"utf-8\"?><text>hello world</text>") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href refers to a file whose encoding is valid utf-16.. */ @org.junit.Test public void fnUnparsedText047() { final XQuery query = new XQuery( "fn:unparsed-text(\"http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "<?xml version=\"1.0\" encoding=\"utf-16\"?><text>hello world</text>") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href refers to a file whose encoding is valid iso-8859-1.. */ @org.junit.Test public void fnUnparsedText048() { final XQuery query = new XQuery( "fn:unparsed-text(\"http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?><text>hello world</text>") || error("FOUT1190") ) ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href refers to a file containing various line endings of the form 0A, x0D, and x0Dx0A.. */ @org.junit.Test public void fnUnparsedText049() { final XQuery query = new XQuery( "string-length(fn:unparsed-text(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt\"))", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "400") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href refers to a file containing various line endings of the form 0A, x0D, and x0Dx0A.. */ @org.junit.Test public void fnUnparsedText050() { final XQuery query = new XQuery( "string-length(fn:unparsed-text(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt\"))", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "400") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href refers to a file containing various line endings of the form 0A, x0D, and x0Dx0A.. */ @org.junit.Test public void fnUnparsedText051() { final XQuery query = new XQuery( "string-length(fn:unparsed-text(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt\"))", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "400") ); } /** * Evaluates the "unparsed-text" function with the argument set as follows: $href refers to a file containing various line endings of the form 0A, x0D, and x0Dx0A.. */ @org.junit.Test public void fnUnparsedText052() { final XQuery query = new XQuery( "string-length(fn:unparsed-text(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt\"))", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "400") ); } } �����������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnUnparsedTextAvailable.java����������0000664�0000000�0000000�00000144334�12224530032�0031473�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the unparsed-text-available() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnUnparsedTextAvailable extends QT3TestSet { /** * Attempts to evaluate the "unparsed-text-available" function with no arguments.. */ @org.junit.Test public void fnUnparsedTextAvailable001() { final XQuery query = new XQuery( "fn:unparsed-text-available()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "unparsed-text-available" function with arity zero.. */ @org.junit.Test public void fnUnparsedTextAvailable002() { final XQuery query = new XQuery( "fn:unparsed-text-available#0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "unparsed-text-available" function with arity one.. */ @org.junit.Test public void fnUnparsedTextAvailable003() { final XQuery query = new XQuery( "fn:exists( fn:unparsed-text-available#1 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to reference the "unparsed-text-available" function with arity two.. */ @org.junit.Test public void fnUnparsedTextAvailable004() { final XQuery query = new XQuery( "fn:exists( fn:unparsed-text-available#2 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to evaluate the "unparsed-text-available" function with three arguments.. */ @org.junit.Test public void fnUnparsedTextAvailable005() { final XQuery query = new XQuery( "fn:unparsed-text-available(static-base-uri(), \"utf-8\", \"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "unparsed-text-available" function with arity three.. */ @org.junit.Test public void fnUnparsedTextAvailable006() { final XQuery query = new XQuery( "fn:unparsed-text-available#3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Tests the type checking of the $href argument.. */ @org.junit.Test public void fnUnparsedTextAvailable008() { final XQuery query = new XQuery( "( fn:unparsed-text-available(\n" + " if (current-date() eq xs:date('1900-01-01'))\n" + " then \"http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt\"\n" + " else 1 ),\n" + " fn:unparsed-text-available( \n" + " if (current-date() eq xs:date('1900-01-01'))\n" + " then 1\n" + " else \"http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt\") )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the type checking of the $encoding argument.. */ @org.junit.Test public void fnUnparsedTextAvailable010() { final XQuery query = new XQuery( "( fn:unparsed-text-available( \n" + " \"http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt\",\n" + " if (current-date() eq xs:date('1900-01-01'))\n" + " then \"utf-8\"\n" + " else 1 ),\n" + " fn:unparsed-text-available( \n" + " \"http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt\",\n" + " if (current-date() eq xs:date('1900-01-01'))\n" + " then 1\n" + " else \"utf-8\") )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the type checking of the $encoding argument.. */ @org.junit.Test public void fnUnparsedTextAvailable012() { final XQuery query = new XQuery( "( fn:unparsed-text-available( \n" + " \"http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt\",\n" + " if (current-date() eq xs:date('1900-01-01'))\n" + " then \"utf-8\"\n" + " else () ),\n" + " fn:unparsed-text-available( \n" + " \"http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt\",\n" + " if (current-date() eq xs:date('1900-01-01'))\n" + " then ()\n" + " else \"utf-8\") )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href contains a fragment identifier.. */ @org.junit.Test public void fnUnparsedTextAvailable013() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"http://www.example.org/#fragment\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href contains a fragment identifier.. */ @org.junit.Test public void fnUnparsedTextAvailable014() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"http://www.example.org/#fragment\", \"utf-8\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href is an invalid xs:anyURI.. */ @org.junit.Test public void fnUnparsedTextAvailable015() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"http://www.example.org/%gg\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href is an invalid xs:anyURI.. */ @org.junit.Test public void fnUnparsedTextAvailable016() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"http://www.example.org/%gg\", \"utf-8\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href is an invalid xs:anyURI.. */ @org.junit.Test public void fnUnparsedTextAvailable017() { final XQuery query = new XQuery( "fn:unparsed-text-available(\":/\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href is an invalid xs:anyURI.. */ @org.junit.Test public void fnUnparsedTextAvailable018() { final XQuery query = new XQuery( "fn:unparsed-text-available(\":/\", \"utf-8\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href refers to a non-existent file.. */ @org.junit.Test public void fnUnparsedTextAvailable019() { final XQuery query = new XQuery( "fn:unparsed-text-available( \"http://www.w3.org/fots/unparsed-text/does-not-exist.txt\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href refers to a non-existent file.. */ @org.junit.Test public void fnUnparsedTextAvailable020() { final XQuery query = new XQuery( "fn:unparsed-text-available( \"http://www.w3.org/fots/unparsed-text/does-not-exist.txt\", \"utf-8\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href uses a (probably) unsupported URI scheme.. */ @org.junit.Test public void fnUnparsedTextAvailable021() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"surely-nobody-supports-this:/path.txt\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href uses a (probably) unsupported URI scheme.. */ @org.junit.Test public void fnUnparsedTextAvailable022() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"surely-nobody-supports-this:/path.txt\", \"utf-8\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href is a relative URI, static base URI undefined.. */ @org.junit.Test public void fnUnparsedTextAvailable023() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"unparsed-text/text-plain-utf-8.txt\")", ctx); try { query.baseURI("#UNDEFINED"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0001") ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href is a relative URI, static base URI undefined.. */ @org.junit.Test public void fnUnparsedTextAvailable024() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"unparsed-text/text-plain-utf-8.txt\", \"utf-8\")", ctx); try { query.baseURI("#UNDEFINED"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0001") ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href is a relative URI, static base is defined.. */ @org.junit.Test public void fnUnparsedTextAvailable025() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"does-not-exist.txt\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href is a relative URI, static base is defined.. */ @org.junit.Test public void fnUnparsedTextAvailable026() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"does-not-exist.txt\", \"utf-8\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href is a relative URI, static base is defined.. */ @org.junit.Test public void fnUnparsedTextAvailable027() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"text-plain-utf-8.txt\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/"); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href is a relative URI, static base is defined.. */ @org.junit.Test public void fnUnparsedTextAvailable028() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"text-plain-utf-8.txt\", \"utf-8\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/"); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href is a Windows file path.. */ @org.junit.Test public void fnUnparsedTextAvailable029() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"C:\\file-might-exist.txt\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/"); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href is a Windows file path.. */ @org.junit.Test public void fnUnparsedTextAvailable030() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"C:\\file-might-exist.txt\", \"utf-8\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/"); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href is an empty string.. */ @org.junit.Test public void fnUnparsedTextAvailable031() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt"); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href is an empty string.. */ @org.junit.Test public void fnUnparsedTextAvailable032() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"\", \"utf-8\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt"); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href is an empty string.. */ @org.junit.Test public void fnUnparsedTextAvailable033() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/does-not-exists.txt"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href is an empty string.. */ @org.junit.Test public void fnUnparsedTextAvailable034() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"\", \"utf-8\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/does-not-exists.txt"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $encoding is invalid.. */ @org.junit.Test public void fnUnparsedTextAvailable035() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt\", \"123\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href refers to a file whose encoding cannot be determined.. */ @org.junit.Test public void fnUnparsedTextAvailable036() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"http://www.w3.org/fots/unparsed-text/unknown-encoding.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href refers to a file whose encoding is invalid for utf-8.. */ @org.junit.Test public void fnUnparsedTextAvailable037() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href refers to a file which contains non-XML characters.. */ @org.junit.Test public void fnUnparsedTextAvailable038() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"http://www.w3.org/fots/unparsed-text/non-xml-character.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href refers to a file which does not contain well-formed XML.. */ @org.junit.Test public void fnUnparsedTextAvailable039() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"http://www.w3.org/fots/unparsed-text/invalid-xml.xml\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href refers to a file whose encoding is valid utf-8.. */ @org.junit.Test public void fnUnparsedTextAvailable040() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href refers to a file whose encoding is valid utf-8.. */ @org.junit.Test public void fnUnparsedTextAvailable041() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href refers to a file whose encoding is valid utf-16.. */ @org.junit.Test public void fnUnparsedTextAvailable042() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href refers to a file whose encoding is valid utf-16.. */ @org.junit.Test public void fnUnparsedTextAvailable043() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href refers to a file whose encoding is valid iso-8859-1.. */ @org.junit.Test public void fnUnparsedTextAvailable044() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || assertBoolean(false) ) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href refers to a file whose encoding is valid utf-8.. */ @org.junit.Test public void fnUnparsedTextAvailable045() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href refers to a file whose encoding is valid utf-16.. */ @org.junit.Test public void fnUnparsedTextAvailable046() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href refers to a file whose encoding is valid iso-8859-1.. */ @org.junit.Test public void fnUnparsedTextAvailable047() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || assertBoolean(false) ) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href refers to a file containing various line endings of the form 0A, x0D, and x0Dx0A.. */ @org.junit.Test public void fnUnparsedTextAvailable048() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href refers to a file containing various line endings of the form 0A, x0D, and x0Dx0A.. */ @org.junit.Test public void fnUnparsedTextAvailable049() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href refers to a file containing various line endings of the form 0A, x0D, and x0Dx0A.. */ @org.junit.Test public void fnUnparsedTextAvailable050() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates the "unparsed-text-available" function with the argument set as follows: $href refers to a file containing various line endings of the form 0A, x0D, and x0Dx0A.. */ @org.junit.Test public void fnUnparsedTextAvailable051() { final XQuery query = new XQuery( "fn:unparsed-text-available(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnUnparsedTextLines.java��������������0000664�0000000�0000000�00000170106�12224530032�0030661�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the unparsed-text-lines() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnUnparsedTextLines extends QT3TestSet { /** * Attempts to evaluate the "unparsed-text-lines" function with no arguments.. */ @org.junit.Test public void fnUnparsedTextLines001() { final XQuery query = new XQuery( "fn:unparsed-text-lines()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "unparsed-text-lines" function with arity zero.. */ @org.junit.Test public void fnUnparsedTextLines002() { final XQuery query = new XQuery( "fn:unparsed-text-lines#0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "unparsed-text-lines" function with arity one.. */ @org.junit.Test public void fnUnparsedTextLines003() { final XQuery query = new XQuery( "fn:exists(fn:unparsed-text-lines#1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to reference the "unparsed-text-lines" function with arity two.. */ @org.junit.Test public void fnUnparsedTextLines004() { final XQuery query = new XQuery( "fn:exists(fn:unparsed-text-lines#2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Attempts to evaluate the "unparsed-text-lines" function with three arguments.. */ @org.junit.Test public void fnUnparsedTextLines005() { final XQuery query = new XQuery( "fn:unparsed-text-lines(static-base-uri(), \"utf-8\", \"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Attempts to reference the "unparsed-text-lines" function with arity three.. */ @org.junit.Test public void fnUnparsedTextLines006() { final XQuery query = new XQuery( "fn:unparsed-text-lines#3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Tests the type checking of the $href argument.. */ @org.junit.Test public void fnUnparsedTextLines008() { final XQuery query = new XQuery( "( fn:unparsed-text-lines( \n" + " if (current-date() eq xs:date('1900-01-01'))\n" + " then \"http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt\"\n" + " else 1 ),\n" + " fn:unparsed-text-lines( \n" + " if (current-date() eq xs:date('1900-01-01'))\n" + " then 1\n" + " else \"http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt\") )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the type checking of the $encoding argument.. */ @org.junit.Test public void fnUnparsedTextLines010() { final XQuery query = new XQuery( "( fn:unparsed-text-lines( \n" + " \"http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt\",\n" + " if (current-date() eq xs:date('1900-01-01'))\n" + " then \"utf-8\"\n" + " else 1 ),\n" + " fn:unparsed-text-lines( \n" + " \"http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt\",\n" + " if (current-date() eq xs:date('1900-01-01'))\n" + " then 1\n" + " else \"utf-8\") )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Tests the type checking of the $encoding argument.. */ @org.junit.Test public void fnUnparsedTextLines012() { final XQuery query = new XQuery( "( fn:unparsed-text-lines( \n" + " \"http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt\",\n" + " if (current-date() eq xs:date('1900-01-01'))\n" + " then \"utf-8\"\n" + " else () ),\n" + " fn:unparsed-text-lines( \n" + " \"http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt\",\n" + " if (current-date() eq xs:date('1900-01-01'))\n" + " then ()\n" + " else \"utf-8\") )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href contains a fragment identifier.. */ @org.junit.Test public void fnUnparsedTextLines013() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"http://www.example.org/#fragment\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href contains a fragment identifier.. */ @org.junit.Test public void fnUnparsedTextLines014() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"http://www.example.org/#fragment\", \"utf-8\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href is an invalid xs:anyURI.. */ @org.junit.Test public void fnUnparsedTextLines015() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"http://www.example.org/%gg\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href is an invalid xs:anyURI.. */ @org.junit.Test public void fnUnparsedTextLines016() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"http://www.example.org/%gg\", \"utf-8\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href is an invalid xs:anyURI.. */ @org.junit.Test public void fnUnparsedTextLines017() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\":/\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href is an invalid xs:anyURI.. */ @org.junit.Test public void fnUnparsedTextLines018() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\":/\", \"utf-8\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href refers to a non-existent file.. */ @org.junit.Test public void fnUnparsedTextLines019() { final XQuery query = new XQuery( "fn:unparsed-text-lines( \"http://www.w3.org/fots/unparsed-text/does-not-exist.txt\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href refers to a non-existent file.. */ @org.junit.Test public void fnUnparsedTextLines020() { final XQuery query = new XQuery( "fn:unparsed-text-lines( \"http://www.w3.org/fots/unparsed-text/does-not-exist.txt\", \"utf-8\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href uses a (probably) unsupported URI scheme.. */ @org.junit.Test public void fnUnparsedTextLines021() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"surely-nobody-supports-this:/path.txt\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href uses a (probably) unsupported URI scheme.. */ @org.junit.Test public void fnUnparsedTextLines022() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"surely-nobody-supports-this:/path.txt\", \"utf-8\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href is a relative URI, static base URI undefined.. */ @org.junit.Test public void fnUnparsedTextLines023() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"unparsed-text/text-plain-utf-8.txt\")", ctx); try { query.baseURI("#UNDEFINED"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0001") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href is a relative URI, static base URI undefined.. */ @org.junit.Test public void fnUnparsedTextLines024() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"unparsed-text/text-plain-utf-8.txt\", \"utf-8\")", ctx); try { query.baseURI("#UNDEFINED"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0001") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href is a relative URI, static base is defined.. */ @org.junit.Test public void fnUnparsedTextLines025() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"does-not-exist.txt\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href is a relative URI, static base is defined.. */ @org.junit.Test public void fnUnparsedTextLines026() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"does-not-exist.txt\", \"utf-8\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href is a relative URI, static base is defined.. */ @org.junit.Test public void fnUnparsedTextLines027() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"text-plain-utf-8.txt\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/"); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "hello world") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href is a relative URI, static base is defined.. */ @org.junit.Test public void fnUnparsedTextLines028() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"text-plain-utf-8.txt\", \"utf-8\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/"); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "hello world") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href is a Windows file path.. */ @org.junit.Test public void fnUnparsedTextLines029() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"C:\\file-might-exist.txt\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/"); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href is a Windows file path.. */ @org.junit.Test public void fnUnparsedTextLines030() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"C:\\file-might-exist.txt\", \"utf-8\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/"); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href is an empty string.. */ @org.junit.Test public void fnUnparsedTextLines031() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt"); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "hello world") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href is an empty string.. */ @org.junit.Test public void fnUnparsedTextLines032() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"\", \"utf-8\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt"); // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "hello world") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href is an empty string.. */ @org.junit.Test public void fnUnparsedTextLines033() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/does-not-exists.txt"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href is an empty string.. */ @org.junit.Test public void fnUnparsedTextLines034() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"\", \"utf-8\")", ctx); try { query.baseURI("http://www.w3.org/fots/unparsed-text/does-not-exists.txt"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1170") ); } /** * Test the effect of a call to fn:unparsed-text-lines which need not be evaluated. Since implementations are allowed to dereference the sources in any case, an error is allowed.. */ @org.junit.Test public void fnUnparsedTextLines035() { final XQuery query = new XQuery( "(1, fn:unparsed-text-lines(\"http://www.w3.org/fots/unparsed-text/does-not-exist.txt\"))[1]", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-2.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-3.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "1") || error("FOUT1170") ) ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $encoding is invalid.. */ @org.junit.Test public void fnUnparsedTextLines036() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt\", \"123\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-2.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-3.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1190") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href refers to a file whose encoding cannot be determined.. */ @org.junit.Test public void fnUnparsedTextLines037() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"http://www.w3.org/fots/unparsed-text/unknown-encoding.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-2.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-3.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1200") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href refers to a file whose encoding is invalid for utf-8.. */ @org.junit.Test public void fnUnparsedTextLines038() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-2.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-3.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1190") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href refers to a file which contains non-XML characters.. */ @org.junit.Test public void fnUnparsedTextLines039() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"http://www.w3.org/fots/unparsed-text/non-xml-character.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-2.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-3.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOUT1190") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href refers to a file which does not contain well-formed XML. A processor is not required to support utf-16.. */ @org.junit.Test public void fnUnparsedTextLines040() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"http://www.w3.org/fots/unparsed-text/invalid-xml.xml\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-2.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-3.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertDeepEq("'<?xml version=\"1.0\" encoding=\"utf-16\"?><text>hello world'") || error("FOUT1200") ) ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href refers to a file whose encoding is valid utf-8.. */ @org.junit.Test public void fnUnparsedTextLines041() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-2.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-3.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "hello world") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href refers to a file whose encoding is valid utf-8.. */ @org.junit.Test public void fnUnparsedTextLines042() { final XQuery query = new XQuery( "fn:unparsed-text(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-2.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-3.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "hello world") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href refers to a file whose encoding is valid utf-16.. */ @org.junit.Test public void fnUnparsedTextLines043() { final XQuery query = new XQuery( "fn:unparsed-text(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-2.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-3.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "hello world") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href refers to a file whose encoding is valid utf-16.. */ @org.junit.Test public void fnUnparsedTextLines044() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-2.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-3.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "hello world") ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href refers to a file whose encoding is valid iso-8859-1.. */ @org.junit.Test public void fnUnparsedTextLines045() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-2.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-3.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "hello world") || error("FOUT1190") ) ); } /** * Evaluates the "unparsed-text-lines" function with the argument set as follows: $href refers to a file whose encoding is valid utf-8.. */ @org.junit.Test public void fnUnparsedTextLines046() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-2.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-3.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "<?xml version=\"1.0\" encoding=\"utf-8\"?><text>hello world</text>") ); } /** * * Evaluates the "unparsed-text-lines" function with the argument set as follows: * $href refers to a file whose encoding is valid utf-16. A processor is not required to support utf-16.. */ @org.junit.Test public void fnUnparsedTextLines047() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-2.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-3.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "<?xml version=\"1.0\" encoding=\"utf-16\"?><text>hello world</text>") || error("FOUT1200") ) ); } /** * * Evaluates the "unparsed-text-lines" function with the argument set as follows: * $href refers to a file whose encoding is valid iso-8859-1.. */ @org.junit.Test public void fnUnparsedTextLines048() { final XQuery query = new XQuery( "fn:unparsed-text(\"http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml\")", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-2.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-3.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?><text>hello world</text>") || error("FOUT1190") ) ); } /** * * Evaluates the "unparsed-text-lines" function with the argument set as follows: * $href refers to a file containing various line endings of the form 0A, x0D, and x0Dx0A.. */ @org.junit.Test public void fnUnparsedTextLines049() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt\") ! string-length(.)", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-2.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-3.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("(53, 54, 179, 77, 32)") ); } /** * * Evaluates the "unparsed-text-lines" function with the argument set as follows: * $href refers to a file containing various line endings of the form 0A, x0D, and x0Dx0A. * . */ @org.junit.Test public void fnUnparsedTextLines050() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt\") ! string-length(.)", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-2.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-3.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("(53, 54, 179, 77, 32)") ); } /** * * Evaluates the "unparsed-text-lines" function with the argument set as follows: * $href refers to a file containing various line endings of the form 0A, x0D, and x0Dx0A. A processor is not required to support utf-16. * . */ @org.junit.Test public void fnUnparsedTextLines051() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt\") ! string-length(.)", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-2.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-3.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertDeepEq("(53, 54, 179, 77, 32)") || error("FOUT1200") ) ); } /** * * Evaluates the "unparsed-text-lines" function with the argument set as follows: * $href refers to a file containing various line endings of the form 0A, x0D, and x0Dx0A. A processor is not required to support utf-16. * . */ @org.junit.Test public void fnUnparsedTextLines052() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt\") ! string-length(.)", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-2.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-3.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertDeepEq("(53, 54, 179, 77, 32)") || error("FOUT1200") ) ); } /** * * Evaluates the "unparsed-text-lines" function with the argument set as follows: * $href refers to a file containing various line endings of the form 0A, x0D, and x0Dx0A. * . */ @org.junit.Test public void fnUnparsedTextLines053() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-2.txt\") ! string-length(.)", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-2.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-3.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("(50, 0, 0, 50, 0, 0)") ); } /** * * Evaluates the "unparsed-text-lines" function with the argument set as follows: * $href refers to a file containing various line endings of the form 0A, x0D, and x0Dx0A. * . */ @org.junit.Test public void fnUnparsedTextLines054() { final XQuery query = new XQuery( "fn:unparsed-text-lines(\"http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-3.txt\") ! string-length(.)", ctx); try { // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-iso-8859-1.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-invalid.txt // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-8.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-utf-16.xml // resource: http://www.w3.org/fots/unparsed-text/text-xml-iso-8859-1.xml // resource: http://www.w3.org/fots/unparsed-text/non-xml-character.txt // resource: http://www.w3.org/fots/unparsed-text/invalid-xml.xml // resource: http://www.w3.org/fots/unparsed-text/unknown-encoding.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-2.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines-3.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-8-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16le-bom-lines.txt // resource: http://www.w3.org/fots/unparsed-text/text-plain-utf-16be-bom-lines.txt result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("(46, 0, 20)") ); } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnUpperCase.java����������������������0000664�0000000�0000000�00000026555�12224530032�0027137�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the upper-case() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnUpperCase extends QT3TestSet { /** * A test whose essence is: `upper-case()`. . */ @org.junit.Test public void kUpperCaseFunc1() { final XQuery query = new XQuery( "upper-case()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `upper-case("string", "wrong param")`. . */ @org.junit.Test public void kUpperCaseFunc2() { final XQuery query = new XQuery( "upper-case(\"string\", \"wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `upper-case(()) eq ""`. . */ @org.junit.Test public void kUpperCaseFunc3() { final XQuery query = new XQuery( "upper-case(()) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `lower-case("ABc!D") eq "abc!d"`. . */ @org.junit.Test public void kUpperCaseFunc4() { final XQuery query = new XQuery( "lower-case(\"ABc!D\") eq \"abc!d\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of upper-case function as per example 1 (for this function) from the F&O specs. . */ @org.junit.Test public void fnUpperCase1() { final XQuery query = new XQuery( "fn:upper-case(\"ABc!D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ABC!D") ); } /** * Evaluation of upper-case function with argument set to "*****" . */ @org.junit.Test public void fnUpperCase10() { final XQuery query = new XQuery( "fn:upper-case(\"*****\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "*****") ); } /** * Evaluation of upper-case function with argument set to another upper case function . */ @org.junit.Test public void fnUpperCase11() { final XQuery query = new XQuery( "fn:upper-case(upper-case(\"zzzzz\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ZZZZZ") ); } /** * Evaluation of upper-case function as an argument to the "fn:boolean" function . */ @org.junit.Test public void fnUpperCase12() { final XQuery query = new XQuery( "fn:boolean(fn:upper-case(\"abcde\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of upper-case function as an argument to the "fn:concat" function . */ @org.junit.Test public void fnUpperCase13() { final XQuery query = new XQuery( "fn:concat(fn:upper-case(\"abcde\"), fn:upper-case(\"fghi\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ABCDEFGHI") ); } /** * Evaluation of upper-case function as an argument to the "fn:not" function . */ @org.junit.Test public void fnUpperCase14() { final XQuery query = new XQuery( "fn:not(fn:upper-case(\"abcde\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of upper-case function with argument set to "%$#@!" . */ @org.junit.Test public void fnUpperCase15() { final XQuery query = new XQuery( "fn:upper-case(\"%$#@!\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "%$#@!") ); } /** * Evaluation of upper-case function with argument set to "upper-case" . */ @org.junit.Test public void fnUpperCase16() { final XQuery query = new XQuery( "fn:upper-case(\"upper-case\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "UPPER-CASE") ); } /** * Evaluation of upper-case function as part of a boolean expression . */ @org.junit.Test public void fnUpperCase17() { final XQuery query = new XQuery( "fn:upper-case(\"abc\") and fn:upper-case(\"abc\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of upper-case function using the empty sequence Uses the count function to avoid empty file. . */ @org.junit.Test public void fnUpperCase2() { final XQuery query = new XQuery( "fn:count(fn:upper-case(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluation of upper-case function that uses only numbers as part of argument Use of count function to avoid empty file. . */ @org.junit.Test public void fnUpperCase3() { final XQuery query = new XQuery( "fn:upper-case(\"12345\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12345") ); } /** * Evaluation of upper-case function that uses both numbers and letters as part of argument . */ @org.junit.Test public void fnUpperCase4() { final XQuery query = new XQuery( "fn:upper-case(\"12345abcd\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12345ABCD") ); } /** * Evaluation of upper-case function that uses only upper case letters as part of argument . */ @org.junit.Test public void fnUpperCase5() { final XQuery query = new XQuery( "fn:upper-case(\"ABCD\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ABCD") ); } /** * Evaluation of upper-case function that uses only lower case letters as part of argument . */ @org.junit.Test public void fnUpperCase6() { final XQuery query = new XQuery( "fn:upper-case(\"abcde\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ABCDE") ); } /** * Evaluation of upper-case function that uses both upper and lower case letters as part of argument . */ @org.junit.Test public void fnUpperCase7() { final XQuery query = new XQuery( "fn:upper-case(\"ABCDEabcde\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ABCDEABCDE") ); } /** * Evaluation of upper-case function that uses the empty string as part of argument Uses "fn:count" to avoid the empty file . */ @org.junit.Test public void fnUpperCase8() { final XQuery query = new XQuery( "fn:count(fn:upper-case(\"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluation of upper-case function that uses the "lower-case" as part of argument . */ @org.junit.Test public void fnUpperCase9() { final XQuery query = new XQuery( "fn:upper-case(lower-case(\"AbcDH\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ABCDH") ); } /** * Evaluates The "upper-case" function with the arguments set as follows: $arg = xs:string(lower bound) . */ @org.junit.Test public void fnUpperCase1args1() { final XQuery query = new XQuery( "fn:upper-case(xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "THIS IS A CHARACTE") ); } /** * Evaluates The "upper-case" function with the arguments set as follows: $arg = xs:string(mid range) . */ @org.junit.Test public void fnUpperCase1args2() { final XQuery query = new XQuery( "fn:upper-case(xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "THIS IS A CHARACTE") ); } /** * Evaluates The "upper-case" function with the arguments set as follows: $arg = xs:string(upper bound) . */ @org.junit.Test public void fnUpperCase1args3() { final XQuery query = new XQuery( "fn:upper-case(xs:string(\"This is a characte\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "THIS IS A CHARACTE") ); } } ���������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnUriCollection.java������������������0000664�0000000�0000000�00000006712�12224530032�0030014�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the uri-collection function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnUriCollection extends QT3TestSet { /** * Pass an invalid xs:anyURI to fn:uri-collection(). Inspired by K2-SeqCollectionFunc-1.. */ @org.junit.Test public void k2SeqUriCollectionFunc1() { final XQuery query = new XQuery( "uri-collection(\"http:\\\\invalidURI\\someURI%gg\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0004") ); } /** * ':/ is an invalid URI. Inspired by K2-SeqCollectionFunc-2.. */ @org.junit.Test public void k2SeqUriCollectionFunc2() { final XQuery query = new XQuery( "uri-collection(\":/\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0004") ); } /** * Evaluation of an fn:uri-collection function with wrong arity. Inspired by fn-collection-1. . */ @org.junit.Test public void fnUriCollection1() { final XQuery query = new XQuery( "fn:uri-collection(\"argument1\",\"argument2\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Evaluation of ana fn:uri-collection, which tries to retrieve a non-existent resource. Inspired by fn-collection-2. . */ @org.junit.Test public void fnUriCollection2() { final XQuery query = new XQuery( "fn:uri-collection(\"thisfileshouldnotexists\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0002") ); } /** * Evaluation of ana fn:uri-collection with argument set to an invalid URI. Inspired by fn-collection-3.. */ @org.junit.Test public void fnUriCollection3() { final XQuery query = new XQuery( "fn:uri-collection(\"invalidURI%gg\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0004") ); } /** * Unknown default resource collection. Inspired by collection-901.. */ @org.junit.Test public void uriCollection901() { final XQuery query = new XQuery( "uri-collection()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0002") ); } /** * Unknown default resource collection.. */ @org.junit.Test public void uriCollection903() { final XQuery query = new XQuery( "uri-collection(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0002") ); } } ������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnYearFromDate.java�������������������0000664�0000000�0000000�00000032664�12224530032�0027570�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the year-from-date() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnYearFromDate extends QT3TestSet { /** * A test whose essence is: `year-from-date()`. . */ @org.junit.Test public void kYearFromDateFunc1() { final XQuery query = new XQuery( "year-from-date()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `year-from-date((), "Wrong param")`. . */ @org.junit.Test public void kYearFromDateFunc2() { final XQuery query = new XQuery( "year-from-date((), \"Wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(year-from-date(()))`. . */ @org.junit.Test public void kYearFromDateFunc3() { final XQuery query = new XQuery( "empty(year-from-date(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `year-from-date(()) instance of xs:integer?`. . */ @org.junit.Test public void kYearFromDateFunc4() { final XQuery query = new XQuery( "year-from-date(()) instance of xs:integer?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `year-from-date(xs:date("2000-02-03")) eq 2000`. . */ @org.junit.Test public void kYearFromDateFunc5() { final XQuery query = new XQuery( "year-from-date(xs:date(\"2000-02-03\")) eq 2000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "year-from-date" function As per example 1 of the F&O specs . */ @org.junit.Test public void fnYearFromDate1() { final XQuery query = new XQuery( "fn:year-from-date(xs:date(\"1999-05-31Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999") ); } /** * Evaluates The "year-from-date" function as part of a "*" expression. . */ @org.junit.Test public void fnYearFromDate10() { final XQuery query = new XQuery( "fn:year-from-date(xs:date(\"1970-01-01Z\")) * fn:year-from-date(xs:date(\"0002-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3940") ); } /** * Evaluates The "year-from-date" function as part of a "div" expression. . */ @org.junit.Test public void fnYearFromDate11() { final XQuery query = new XQuery( "fn:year-from-date(xs:date(\"1970-01-01Z\")) div fn:year-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "year-from-date" function as part of a "idiv" expression. . */ @org.junit.Test public void fnYearFromDate12() { final XQuery query = new XQuery( "fn:year-from-date(xs:date(\"1970-01-01Z\")) idiv fn:year-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "year-from-date" function as part of a "mod" expression. . */ @org.junit.Test public void fnYearFromDate13() { final XQuery query = new XQuery( "fn:year-from-date(xs:date(\"1970-01-01Z\")) mod fn:year-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "year-from-date" function as part of a "numeric-unary-plus" expression. . */ @org.junit.Test public void fnYearFromDate14() { final XQuery query = new XQuery( "+fn:year-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1970") ); } /** * Evaluates The "year-from-date" function as part of a "numeric-unary-minus" expression. . */ @org.junit.Test public void fnYearFromDate15() { final XQuery query = new XQuery( "-fn:year-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1970") ); } /** * Evaluates The "year-from-date" function as part of a "numeric-equal" expression (eq operator) . */ @org.junit.Test public void fnYearFromDate16() { final XQuery query = new XQuery( "fn:year-from-date(xs:date(\"1970-01-01Z\")) eq fn:year-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "year-from-date" function as part of a "numeric-equal" expression (ne operator) . */ @org.junit.Test public void fnYearFromDate17() { final XQuery query = new XQuery( "fn:year-from-date(xs:date(\"1970-01-01Z\")) ne fn:year-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "year-from-date" function as part of a "numeric-equal" expression (le operator) . */ @org.junit.Test public void fnYearFromDate18() { final XQuery query = new XQuery( "fn:year-from-date(xs:date(\"1970-01-01Z\")) le fn:year-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "year-from-date" function as part of a "numeric-equal" expression (ge operator) . */ @org.junit.Test public void fnYearFromDate19() { final XQuery query = new XQuery( "fn:year-from-date(xs:date(\"1970-01-01Z\")) ge fn:year-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "year-from-date" function As per example 2 of the F&O specs . */ @org.junit.Test public void fnYearFromDate2() { final XQuery query = new XQuery( "fn:year-from-date(xs:date(\"2000-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2000") ); } /** * Evaluates The "year-from-date" function involving a "numeric-less-than" operation (lt operator) . */ @org.junit.Test public void fnYearFromDate3() { final XQuery query = new XQuery( "fn:year-from-date(xs:date(\"1999-12-31Z\")) lt fn:year-from-date(xs:date(\"1999-12-31Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "year-from-date" function involving a "numeric-less-than" operation (le operator) . */ @org.junit.Test public void fnYearFromDate4() { final XQuery query = new XQuery( "fn:year-from-date(xs:date(\"1999-12-31Z\")) le fn:year-from-date(xs:date(\"1999-12-31Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "year-from-date" function using the empty sequence as an argument. Use count function to avoid empty file. . */ @org.junit.Test public void fnYearFromDate5() { final XQuery query = new XQuery( "fn:count(fn:year-from-date(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "year-from-date" function that returns 1. . */ @org.junit.Test public void fnYearFromDate6() { final XQuery query = new XQuery( "fn:year-from-date(xs:date(\"0001-05-31Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "year-from-date" function that returns a negative number . */ @org.junit.Test public void fnYearFromDate7() { final XQuery query = new XQuery( "fn:year-from-date(xs:date(\"-1999-05-31Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1999") ); } /** * Evaluates The "year-from-date" function as part of a "+" expression. . */ @org.junit.Test public void fnYearFromDate8() { final XQuery query = new XQuery( "fn:year-from-date(xs:date(\"1970-01-01Z\")) + fn:year-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3940") ); } /** * Evaluates The "year-from-date" function as part of a "-" expression. . */ @org.junit.Test public void fnYearFromDate9() { final XQuery query = new XQuery( "fn:year-from-date(xs:date(\"1970-01-01Z\")) - fn:year-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "year-from-date" function with the arguments set as follows: $arg = xs:date(lower bound) . */ @org.junit.Test public void fnYearFromDate1args1() { final XQuery query = new XQuery( "fn:year-from-date(xs:date(\"1970-01-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1970") ); } /** * Evaluates The "year-from-date" function with the arguments set as follows: $arg = xs:date(mid range) . */ @org.junit.Test public void fnYearFromDate1args2() { final XQuery query = new XQuery( "fn:year-from-date(xs:date(\"1983-11-17Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1983") ); } /** * Evaluates The "year-from-date" function with the arguments set as follows: $arg = xs:date(upper bound) . */ @org.junit.Test public void fnYearFromDate1args3() { final XQuery query = new XQuery( "fn:year-from-date(xs:date(\"2030-12-31Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2030") ); } } ����������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnYearFromDateTime.java���������������0000664�0000000�0000000�00000034435�12224530032�0030405�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the year-from-dateTime() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnYearFromDateTime extends QT3TestSet { /** * A test whose essence is: `year-from-dateTime()`. . */ @org.junit.Test public void kYearFromDateTimeFunc1() { final XQuery query = new XQuery( "year-from-dateTime()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `year-from-dateTime((), "Wrong param")`. . */ @org.junit.Test public void kYearFromDateTimeFunc2() { final XQuery query = new XQuery( "year-from-dateTime((), \"Wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(year-from-dateTime(()))`. . */ @org.junit.Test public void kYearFromDateTimeFunc3() { final XQuery query = new XQuery( "empty(year-from-dateTime(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `year-from-dateTime(()) instance of xs:integer?`. . */ @org.junit.Test public void kYearFromDateTimeFunc4() { final XQuery query = new XQuery( "year-from-dateTime(()) instance of xs:integer?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `year-from-dateTime(xs:dateTime("2001-02-03T08:23:12.43")) eq 2001`. . */ @org.junit.Test public void kYearFromDateTimeFunc5() { final XQuery query = new XQuery( "year-from-dateTime(xs:dateTime(\"2001-02-03T08:23:12.43\")) eq 2001", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "year-from-dateTime" function As per example 1 (of this fucntion) of the F&O specs . */ @org.junit.Test public void fnYearFromDateTime1() { final XQuery query = new XQuery( "fn:year-from-dateTime(xs:dateTime(\"1999-05-31T13:20:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999") ); } /** * Evaluates The "year-from-dateTime" function as part of a "*" expression. . */ @org.junit.Test public void fnYearFromDateTime10() { final XQuery query = new XQuery( "fn:year-from-dateTime(xs:dateTime(\"1970-01-01T02:00:00Z\")) * fn:year-from-dateTime(xs:dateTime(\"0002-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3940") ); } /** * Evaluates The "year-from-dateTime" function as part of a "div" expression. . */ @org.junit.Test public void fnYearFromDateTime11() { final XQuery query = new XQuery( "fn:year-from-dateTime(xs:dateTime(\"1000-01-01T02:00:00Z\")) div fn:year-from-dateTime(xs:dateTime(\"0050-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "20") ); } /** * Evaluates The "year-from-dateTime" function as part of a "idiv" expression. . */ @org.junit.Test public void fnYearFromDateTime12() { final XQuery query = new XQuery( "fn:year-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\")) idiv fn:year-from-dateTime(xs:dateTime(\"1970-01-01T02:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "year-from-dateTime" function as part of a "mod" expression. . */ @org.junit.Test public void fnYearFromDateTime13() { final XQuery query = new XQuery( "fn:year-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\")) mod fn:year-from-dateTime(xs:dateTime(\"1970-01-01T03:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "year-from-dateTime" function as part of a "numeric-equal" expression (eq operator) . */ @org.junit.Test public void fnYearFromDateTime16() { final XQuery query = new XQuery( "fn:year-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\")) eq fn:year-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "year-from-dateTime" function as part of a "numeric-equal" expression (ne operator) . */ @org.junit.Test public void fnYearFromDateTime17() { final XQuery query = new XQuery( "fn:year-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\")) ne fn:year-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "year-from-dateTime" function as part of a "numeric-equal" expression (le operator) . */ @org.junit.Test public void fnYearFromDateTime18() { final XQuery query = new XQuery( "fn:year-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\")) le fn:year-from-dateTime(xs:dateTime(\"1971-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "year-from-dateTime" function as part of a "numeric-equal" expression (ge operator) . */ @org.junit.Test public void fnYearFromDateTime19() { final XQuery query = new XQuery( "fn:year-from-dateTime(xs:dateTime(\"1971-01-01T10:00:00Z\")) ge fn:year-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "year-from-dateTime" function As per example 2 (for this function)of the F&O specs . */ @org.junit.Test public void fnYearFromDateTime2() { final XQuery query = new XQuery( "fn:year-from-dateTime(xs:dateTime(\"1999-05-31T21:30:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999") ); } /** * Evaluates The "year-from-dateTime" function As per example 3 (for this function) of the F&O specs . */ @org.junit.Test public void fnYearFromDateTime3() { final XQuery query = new XQuery( "fn:year-from-dateTime(xs:dateTime(\"1999-12-31T19:20:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999") ); } /** * Evaluates The "year-from-dateTime" function used as an argument to an "avg" function. . */ @org.junit.Test public void fnYearFromDateTime4() { final XQuery query = new XQuery( "fn:avg((fn:year-from-dateTime(xs:dateTime(\"1996-12-31T12:00:00Z\")),fn:year-from-dateTime(xs:dateTime(\"2000-12-31T12:00:00Z\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1998") ); } /** * Evaluates The "year-from-dateTime" function using the empty sequence as an argument. Use count function to avoid empty file. . */ @org.junit.Test public void fnYearFromDateTime5() { final XQuery query = new XQuery( "fn:count(fn:year-from-dateTime(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "year-from-dateTime" function that returns a negative number. . */ @org.junit.Test public void fnYearFromDateTime6() { final XQuery query = new XQuery( "fn:year-from-dateTime(xs:dateTime(\"-1999-05-31T00:20:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1999") ); } /** * Evaluates The "year-from-dateTime" function that returns 0001. . */ @org.junit.Test public void fnYearFromDateTime7() { final XQuery query = new XQuery( "fn:year-from-dateTime(xs:dateTime(\"0001-05-31T23:20:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "year-from-dateTime" function as part of a "+" expression. . */ @org.junit.Test public void fnYearFromDateTime8() { final XQuery query = new XQuery( "fn:year-from-dateTime(xs:dateTime(\"1970-01-01T00:00:00Z\")) + fn:year-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3940") ); } /** * Evaluates The "year-from-dateTime" function as part of a "-" expression. . */ @org.junit.Test public void fnYearFromDateTime9() { final XQuery query = new XQuery( "fn:year-from-dateTime(xs:dateTime(\"1970-01-01T00:00:00Z\")) - fn:year-from-dateTime(xs:dateTime(\"1969-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "year-from-dateTime" function with the arguments set as follows: $arg = xs:dateTime(lower bound) . */ @org.junit.Test public void fnYearFromDateTime1args1() { final XQuery query = new XQuery( "fn:year-from-dateTime(xs:dateTime(\"1970-01-01T00:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1970") ); } /** * Evaluates The "year-from-dateTime" function with the arguments set as follows: $arg = xs:dateTime(mid range) . */ @org.junit.Test public void fnYearFromDateTime1args2() { final XQuery query = new XQuery( "fn:year-from-dateTime(xs:dateTime(\"1996-04-07T01:40:52Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1996") ); } /** * Evaluates The "year-from-dateTime" function with the arguments set as follows: $arg = xs:dateTime(upper bound) . */ @org.junit.Test public void fnYearFromDateTime1args3() { final XQuery query = new XQuery( "fn:year-from-dateTime(xs:dateTime(\"2030-12-31T23:59:59Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2030") ); } /** * Evaluates The "year-from-dateTime" function as part of a "numeric-unary-plus" expression. . */ @org.junit.Test public void fnYearFromDateTimeNew14() { final XQuery query = new XQuery( "+fn:year-from-dateTime(xs:dateTime(\"1971-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1971") ); } /** * Evaluates The "year-from-dateTime" function as part of a "numeric-unary-minus" expression. . */ @org.junit.Test public void fnYearFromDateTimeNew15() { final XQuery query = new XQuery( "-fn:year-from-dateTime(xs:dateTime(\"1970-01-01T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1970") ); } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnYearsFromDuration.java��������������0000664�0000000�0000000�00000037701�12224530032�0030660�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the years-from-duration() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnYearsFromDuration extends QT3TestSet { /** * A test whose essence is: `years-from-duration()`. . */ @org.junit.Test public void kYearsFromDurationFunc1() { final XQuery query = new XQuery( "years-from-duration()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `years-from-duration((), "Wrong param")`. . */ @org.junit.Test public void kYearsFromDurationFunc2() { final XQuery query = new XQuery( "years-from-duration((), \"Wrong param\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `empty(years-from-duration(()))`. . */ @org.junit.Test public void kYearsFromDurationFunc3() { final XQuery query = new XQuery( "empty(years-from-duration(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `years-from-duration(()) instance of xs:integer?`. . */ @org.junit.Test public void kYearsFromDurationFunc4() { final XQuery query = new XQuery( "years-from-duration(()) instance of xs:integer?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `years-from-duration(xs:yearMonthDuration("P0003Y2M")) eq 3`. . */ @org.junit.Test public void kYearsFromDurationFunc5() { final XQuery query = new XQuery( "years-from-duration(xs:yearMonthDuration(\"P0003Y2M\")) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test invoking years-from-duration() on a negative duration. . */ @org.junit.Test public void kYearsFromDurationFunc6() { final XQuery query = new XQuery( "years-from-duration(xs:yearMonthDuration(\"-P0003Y2M\")) eq -3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test invoking years-from-duration() on an negative xs:duration. . */ @org.junit.Test public void kYearsFromDurationFunc7() { final XQuery query = new XQuery( "years-from-duration(xs:duration(\"-P3Y4M4DT1H23M2.34S\")) eq -3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:years-from-duration on xs:dayTimeDuration . */ @org.junit.Test public void cbclYearsFromDuration001() { final XQuery query = new XQuery( "fn:years-from-duration(xs:dayTimeDuration('P1D'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "years-from-duration" function As per example 1 (for this function)of the F&O specs . */ @org.junit.Test public void fnYearsFromDuration1() { final XQuery query = new XQuery( "fn:years-from-duration(xs:yearMonthDuration(\"P20Y15M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("21") ); } /** * Evaluates The "years-from-duration" function as part of a "*" expression. . */ @org.junit.Test public void fnYearsFromDuration10() { final XQuery query = new XQuery( "fn:years-from-duration(xs:yearMonthDuration(\"P20Y10M\")) * fn:years-from-duration(xs:yearMonthDuration(\"P02Y10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("40") ); } /** * Evaluates The "years-from-duration" function as part of a "div" expression. . */ @org.junit.Test public void fnYearsFromDuration11() { final XQuery query = new XQuery( "fn:years-from-duration(xs:yearMonthDuration(\"P20Y10M\")) div fn:years-from-duration(xs:yearMonthDuration(\"P05Y10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("4") ); } /** * Evaluates The "years-from-duration" function as part of a "idiv" expression. . */ @org.junit.Test public void fnYearsFromDuration12() { final XQuery query = new XQuery( "fn:years-from-duration(xs:yearMonthDuration(\"P25Y10M\")) idiv fn:years-from-duration(xs:yearMonthDuration(\"P05Y10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** * Evaluates The "years-from-duration" function as part of a "mod" expression. . */ @org.junit.Test public void fnYearsFromDuration13() { final XQuery query = new XQuery( "fn:years-from-duration(xs:yearMonthDuration(\"P10Y10M\")) mod fn:years-from-duration(xs:yearMonthDuration(\"P03Y10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "years-from-duration" function as part of a "numeric-unary-plus" expression. . */ @org.junit.Test public void fnYearsFromDuration14() { final XQuery query = new XQuery( "+fn:years-from-duration(xs:yearMonthDuration(\"P21Y10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("21") ); } /** * Evaluates The "years-from-duration" function as part of a "numeric-unary-minus" expression. . */ @org.junit.Test public void fnYearsFromDuration15() { final XQuery query = new XQuery( "-fn:years-from-duration(xs:yearMonthDuration(\"P25Y10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-25") ); } /** * Evaluates The "years-from-duration" function as part of a "numeric-equal" expression (eq operator) . */ @org.junit.Test public void fnYearsFromDuration16() { final XQuery query = new XQuery( "fn:years-from-duration(xs:yearMonthDuration(\"P22Y10M\")) eq fn:years-from-duration(xs:yearMonthDuration(\"P22Y10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "years-from-duration" function as part of a "numeric-equal" expression (ne operator) . */ @org.junit.Test public void fnYearsFromDuration17() { final XQuery query = new XQuery( "fn:years-from-duration(xs:yearMonthDuration(\"P22Y10M\")) ne fn:years-from-duration(xs:yearMonthDuration(\"P23Y10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "years-from-duration" function as part of a "numeric-equal" expression (le operator) . */ @org.junit.Test public void fnYearsFromDuration18() { final XQuery query = new XQuery( "fn:years-from-duration(xs:yearMonthDuration(\"P21Y01M\")) le fn:years-from-duration(xs:yearMonthDuration(\"P21Y15M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "years-from-duration" function as part of a "numeric-equal" expression (ge operator) . */ @org.junit.Test public void fnYearsFromDuration19() { final XQuery query = new XQuery( "fn:years-from-duration(xs:yearMonthDuration(\"P20Y10M\")) ge fn:years-from-duration(xs:yearMonthDuration(\"P20Y10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "years-from-duration" function As per example 2 (for this function) of the F&O specs . */ @org.junit.Test public void fnYearsFromDuration2() { final XQuery query = new XQuery( "fn:years-from-duration(xs:yearMonthDuration(\"-P15M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "years-from-duration" function with wrong argument type. . */ @org.junit.Test public void fnYearsFromDuration20() { final XQuery query = new XQuery( "fn:years-from-duration(xs:duration(\"P1Y2M3DT10H30M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "years-from-duration" function involving a "numeric-less-than" operation (lt operator) . */ @org.junit.Test public void fnYearsFromDuration3() { final XQuery query = new XQuery( "fn:years-from-duration(xs:yearMonthDuration(\"P20Y3M\")) lt fn:years-from-duration(xs:yearMonthDuration(\"P21Y2M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "years-from-duration" function involving a "numeric-less-than" operation (le operator) . */ @org.junit.Test public void fnYearsFromDuration4() { final XQuery query = new XQuery( "fn:years-from-duration(xs:yearMonthDuration(\"P21Y10M\")) le fn:years-from-duration(xs:yearMonthDuration(\"P22Y10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "years-from-duration" function using the empty sequence as an argument. Use count function to avoid empty file. . */ @org.junit.Test public void fnYearsFromDuration5() { final XQuery query = new XQuery( "fn:count(fn:years-from-duration(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "years-from-duration" function that returns 1. . */ @org.junit.Test public void fnYearsFromDuration6() { final XQuery query = new XQuery( "fn:years-from-duration(xs:yearMonthDuration(\"P01Y10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "years-from-duration" function used as arguments to an avg function. . */ @org.junit.Test public void fnYearsFromDuration7() { final XQuery query = new XQuery( "fn:avg((fn:years-from-duration(xs:yearMonthDuration(\"P23Y10M\")),fn:years-from-duration(xs:yearMonthDuration(\"P21Y10M\"))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("22") ); } /** * Evaluates The "years-from-duration" function as part of a "+" expression. . */ @org.junit.Test public void fnYearsFromDuration8() { final XQuery query = new XQuery( "fn:years-from-duration(xs:yearMonthDuration(\"P21Y10M\")) + fn:years-from-duration(xs:yearMonthDuration(\"P22Y10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("43") ); } /** * Evaluates The "years-from-duration" function as part of a "-" expression. . */ @org.junit.Test public void fnYearsFromDuration9() { final XQuery query = new XQuery( "fn:years-from-duration(xs:yearMonthDuration(\"P30Y10M\")) - fn:years-from-duration(xs:yearMonthDuration(\"P10Y10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("20") ); } /** * Evaluates The "years-from-duration" function with the arguments set as follows: $arg = xs:yearMonthDuration(lower bound) . */ @org.junit.Test public void fnYearsFromDuration1args1() { final XQuery query = new XQuery( "fn:years-from-duration(xs:yearMonthDuration(\"P0Y0M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "years-from-duration" function with the arguments set as follows: $arg = xs:yearMonthDuration(mid range) . */ @org.junit.Test public void fnYearsFromDuration1args2() { final XQuery query = new XQuery( "fn:years-from-duration(xs:yearMonthDuration(\"P1000Y6M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1000") ); } /** * Evaluates The "years-from-duration" function with the arguments set as follows: $arg = xs:yearMonthDuration(upper bound) . */ @org.junit.Test public void fnYearsFromDuration1args3() { final XQuery query = new XQuery( "fn:years-from-duration(xs:yearMonthDuration(\"P2030Y12M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2031") ); } } ���������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/fn/FnZeroOrOne.java����������������������0000664�0000000�0000000�00000063401�12224530032�0027121�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.fn; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the zero-or-one() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class FnZeroOrOne extends QT3TestSet { /** * A test whose essence is: `zero-or-one(1, 2)`. . */ @org.junit.Test public void kSeqZeroOrOneFunc1() { final XQuery query = new XQuery( "zero-or-one(1, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `zero-or-one()`. . */ @org.junit.Test public void kSeqZeroOrOneFunc2() { final XQuery query = new XQuery( "zero-or-one()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `zero-or-one(true())`. . */ @org.junit.Test public void kSeqZeroOrOneFunc3() { final XQuery query = new XQuery( "zero-or-one(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(zero-or-one(()))`. . */ @org.junit.Test public void kSeqZeroOrOneFunc4() { final XQuery query = new XQuery( "empty(zero-or-one(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(zero-or-one( "one" )) eq 1`. . */ @org.junit.Test public void kSeqZeroOrOneFunc5() { final XQuery query = new XQuery( "count(zero-or-one( \"one\" )) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(zero-or-one( () )) eq 0`. . */ @org.junit.Test public void kSeqZeroOrOneFunc6() { final XQuery query = new XQuery( "count(zero-or-one( () )) eq 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `zero-or-one(error())`. . */ @org.junit.Test public void kSeqZeroOrOneFunc7() { final XQuery query = new XQuery( "zero-or-one(error())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * A test whose essence is: `zero-or-one( (1, 2, 3) )`. . */ @org.junit.Test public void kSeqZeroOrOneFunc8() { final XQuery query = new XQuery( "zero-or-one( (1, 2, 3) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0003") ); } /** * Test an optimization in if-not-empoty for empty return . */ @org.junit.Test public void cbclIfNotEmpty001() { final XQuery query = new XQuery( "for $x in zero-or-one((1 to 10)[. div 2 = 0]) return ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * test fn:zero-or-one on a count-preserving function . */ @org.junit.Test public void cbclZeroOrOne001() { final XQuery query = new XQuery( "\n" + " declare function local:generate($arg as xs:integer?) { if ($arg = 0) then (1, 2, 3) else $arg };\n" + " fn:empty( fn:zero-or-one(fn:unordered( local:generate( () ) )) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test fn:zero-or-one on a sequence of one-or-more items . */ @org.junit.Test public void cbclZeroOrOne002() { final XQuery query = new XQuery( "\n" + " declare function local:generate($arg as xs:integer?) { if ($arg = 0) then () else if ($arg = 1) then $arg else ($arg, $arg) };\n" + " 1 + fn:zero-or-one(fn:one-or-more( local:generate( 1 ) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Evaluation of the fn:zero-or-one function with argument sequence containing more than one item . */ @org.junit.Test public void fnZeroOrOne1() { final XQuery query = new XQuery( "fn:zero-or-one((1,2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0003") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:double(lower bound) . */ @org.junit.Test public void fnZeroOrOnedbl1args1() { final XQuery query = new XQuery( "fn:zero-or-one(xs:double(\"-1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.7976931348623157E308") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:double(mid range) . */ @org.junit.Test public void fnZeroOrOnedbl1args2() { final XQuery query = new XQuery( "fn:zero-or-one(xs:double(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:double(upper bound) . */ @org.junit.Test public void fnZeroOrOnedbl1args3() { final XQuery query = new XQuery( "fn:zero-or-one(xs:double(\"1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.7976931348623157E308") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:decimal(lower bound) . */ @org.junit.Test public void fnZeroOrOnedec1args1() { final XQuery query = new XQuery( "fn:zero-or-one(xs:decimal(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:decimal(mid range) . */ @org.junit.Test public void fnZeroOrOnedec1args2() { final XQuery query = new XQuery( "fn:zero-or-one(xs:decimal(\"617375191608514839\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "617375191608514839") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:decimal(upper bound) . */ @org.junit.Test public void fnZeroOrOnedec1args3() { final XQuery query = new XQuery( "fn:zero-or-one(xs:decimal(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "999999999999999999") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:float(lower bound) . */ @org.junit.Test public void fnZeroOrOneflt1args1() { final XQuery query = new XQuery( "fn:zero-or-one(xs:float(\"-3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-3.4028235E38") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:float(mid range) . */ @org.junit.Test public void fnZeroOrOneflt1args2() { final XQuery query = new XQuery( "fn:zero-or-one(xs:float(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:float(upper bound) . */ @org.junit.Test public void fnZeroOrOneflt1args3() { final XQuery query = new XQuery( "fn:zero-or-one(xs:float(\"3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3.4028235E38") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:int(lower bound) . */ @org.junit.Test public void fnZeroOrOneint1args1() { final XQuery query = new XQuery( "fn:zero-or-one(xs:int(\"-2147483648\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-2147483648") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:int(mid range) . */ @org.junit.Test public void fnZeroOrOneint1args2() { final XQuery query = new XQuery( "fn:zero-or-one(xs:int(\"-1873914410\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1873914410") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:int(upper bound) . */ @org.junit.Test public void fnZeroOrOneint1args3() { final XQuery query = new XQuery( "fn:zero-or-one(xs:int(\"2147483647\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2147483647") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:integer(lower bound) . */ @org.junit.Test public void fnZeroOrOneintg1args1() { final XQuery query = new XQuery( "fn:zero-or-one(xs:integer(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:integer(mid range) . */ @org.junit.Test public void fnZeroOrOneintg1args2() { final XQuery query = new XQuery( "fn:zero-or-one(xs:integer(\"830993497117024304\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "830993497117024304") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:integer(upper bound) . */ @org.junit.Test public void fnZeroOrOneintg1args3() { final XQuery query = new XQuery( "fn:zero-or-one(xs:integer(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "999999999999999999") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:long(lower bound) . */ @org.junit.Test public void fnZeroOrOnelng1args1() { final XQuery query = new XQuery( "fn:zero-or-one(xs:long(\"-92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-92233720368547758") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:long(mid range) . */ @org.junit.Test public void fnZeroOrOnelng1args2() { final XQuery query = new XQuery( "fn:zero-or-one(xs:long(\"-47175562203048468\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-47175562203048468") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:long(upper bound) . */ @org.junit.Test public void fnZeroOrOnelng1args3() { final XQuery query = new XQuery( "fn:zero-or-one(xs:long(\"92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "92233720368547758") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:negativeInteger(lower bound) . */ @org.junit.Test public void fnZeroOrOnenint1args1() { final XQuery query = new XQuery( "fn:zero-or-one(xs:negativeInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:negativeInteger(mid range) . */ @org.junit.Test public void fnZeroOrOnenint1args2() { final XQuery query = new XQuery( "fn:zero-or-one(xs:negativeInteger(\"-297014075999096793\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-297014075999096793") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:negativeInteger(upper bound) . */ @org.junit.Test public void fnZeroOrOnenint1args3() { final XQuery query = new XQuery( "fn:zero-or-one(xs:negativeInteger(\"-1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void fnZeroOrOnenni1args1() { final XQuery query = new XQuery( "fn:zero-or-one(xs:nonNegativeInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void fnZeroOrOnenni1args2() { final XQuery query = new XQuery( "fn:zero-or-one(xs:nonNegativeInteger(\"303884545991464527\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "303884545991464527") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void fnZeroOrOnenni1args3() { final XQuery query = new XQuery( "fn:zero-or-one(xs:nonNegativeInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "999999999999999999") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void fnZeroOrOnenpi1args1() { final XQuery query = new XQuery( "fn:zero-or-one(xs:nonPositiveInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void fnZeroOrOnenpi1args2() { final XQuery query = new XQuery( "fn:zero-or-one(xs:nonPositiveInteger(\"-475688437271870490\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-475688437271870490") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void fnZeroOrOnenpi1args3() { final XQuery query = new XQuery( "fn:zero-or-one(xs:nonPositiveInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:positiveInteger(lower bound) . */ @org.junit.Test public void fnZeroOrOnepint1args1() { final XQuery query = new XQuery( "fn:zero-or-one(xs:positiveInteger(\"1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:positiveInteger(mid range) . */ @org.junit.Test public void fnZeroOrOnepint1args2() { final XQuery query = new XQuery( "fn:zero-or-one(xs:positiveInteger(\"52704602390610033\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "52704602390610033") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:positiveInteger(upper bound) . */ @org.junit.Test public void fnZeroOrOnepint1args3() { final XQuery query = new XQuery( "fn:zero-or-one(xs:positiveInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "999999999999999999") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:short(lower bound) . */ @org.junit.Test public void fnZeroOrOnesht1args1() { final XQuery query = new XQuery( "fn:zero-or-one(xs:short(\"-32768\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-32768") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:short(mid range) . */ @org.junit.Test public void fnZeroOrOnesht1args2() { final XQuery query = new XQuery( "fn:zero-or-one(xs:short(\"-5324\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-5324") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:short(upper bound) . */ @org.junit.Test public void fnZeroOrOnesht1args3() { final XQuery query = new XQuery( "fn:zero-or-one(xs:short(\"32767\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "32767") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:unsignedLong(lower bound) . */ @org.junit.Test public void fnZeroOrOneulng1args1() { final XQuery query = new XQuery( "fn:zero-or-one(xs:unsignedLong(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:unsignedLong(mid range) . */ @org.junit.Test public void fnZeroOrOneulng1args2() { final XQuery query = new XQuery( "fn:zero-or-one(xs:unsignedLong(\"130747108607674654\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "130747108607674654") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:unsignedLong(upper bound) . */ @org.junit.Test public void fnZeroOrOneulng1args3() { final XQuery query = new XQuery( "fn:zero-or-one(xs:unsignedLong(\"184467440737095516\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "184467440737095516") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:unsignedShort(lower bound) . */ @org.junit.Test public void fnZeroOrOneusht1args1() { final XQuery query = new XQuery( "fn:zero-or-one(xs:unsignedShort(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:unsignedShort(mid range) . */ @org.junit.Test public void fnZeroOrOneusht1args2() { final XQuery query = new XQuery( "fn:zero-or-one(xs:unsignedShort(\"44633\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "44633") ); } /** * Evaluates The "zero-or-one" function with the arguments set as follows: $arg = xs:unsignedShort(upper bound) . */ @org.junit.Test public void fnZeroOrOneusht1args3() { final XQuery query = new XQuery( "fn:zero-or-one(xs:unsignedShort(\"65535\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "65535") ); } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/math/������������������������������������0000775�0000000�0000000�00000000000�12224530032�0024432�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/math/MathAcos.java�����������������������0000664�0000000�0000000�00000011527�12224530032�0027002�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.math; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the math:acos function introduced in XPath 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class MathAcos extends QT3TestSet { /** * Evaluate the function math:acos() with the argument (). */ @org.junit.Test public void mathAcos001() { final XQuery query = new XQuery( "math:acos(())", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluate the function math:acos() with the argument 0. */ @org.junit.Test public void mathAcos002() { final XQuery query = new XQuery( "math:acos(0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("abs($result - 1.5707963267948966e0) lt 1e-14") ); } /** * Evaluate the function math:acos() with the argument -0.0e0. */ @org.junit.Test public void mathAcos003() { final XQuery query = new XQuery( "math:acos(-0.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("abs($result - 1.5707963267948966e0) lt 1e-14") ); } /** * Evaluate the function math:acos() with the argument 1.0e0. */ @org.junit.Test public void mathAcos004() { final XQuery query = new XQuery( "math:acos(1.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0.0e0") ); } /** * Evaluate the function math:acos() with the argument -1.0e0. */ @org.junit.Test public void mathAcos005() { final XQuery query = new XQuery( "math:acos(-1.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3.141592653589793e0") ); } /** * Evaluate the function math:acos() with the argument 2.0e0. */ @org.junit.Test public void mathAcos006() { final XQuery query = new XQuery( "math:acos(2.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Evaluate the function math:acos() with the argument xs:double('NaN'). */ @org.junit.Test public void mathAcos007() { final XQuery query = new XQuery( "math:acos(xs:double('NaN'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Evaluate the function math:acos() with the argument xs:double('INF'). */ @org.junit.Test public void mathAcos008() { final XQuery query = new XQuery( "math:acos(xs:double('INF'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Evaluate the function math:acos() with the argument xs:double('-INF'). */ @org.junit.Test public void mathAcos009() { final XQuery query = new XQuery( "math:acos(xs:double('-INF'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/math/MathAsin.java�����������������������0000664�0000000�0000000�00000011461�12224530032�0027004�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.math; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the math:asin function introduced in XPath 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class MathAsin extends QT3TestSet { /** * Evaluate the function math:asin() with the argument (). */ @org.junit.Test public void mathAsin001() { final XQuery query = new XQuery( "math:asin(())", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluate the function math:asin() with the argument 0. */ @org.junit.Test public void mathAsin002() { final XQuery query = new XQuery( "math:asin(0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0.0e0") ); } /** * Evaluate the function math:asin() with the argument -0.0e0. */ @org.junit.Test public void mathAsin003() { final XQuery query = new XQuery( "math:asin(-0.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0.0e0") ); } /** * Evaluate the function math:asin() with the argument math:pi() div 4. */ @org.junit.Test public void mathAsin004() { final XQuery query = new XQuery( "math:asin(1.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.5707963267948966e0") ); } /** * Evaluate the function math:asin() with the argument -math:pi() div 4. */ @org.junit.Test public void mathAsin005() { final XQuery query = new XQuery( "math:asin(-1.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.5707963267948966e0") ); } /** * Evaluate the function math:asin() with the argument math:pi() div 2. */ @org.junit.Test public void mathAsin006() { final XQuery query = new XQuery( "math:asin(2.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Evaluate the function math:asin() with the argument xs:double('NaN'). */ @org.junit.Test public void mathAsin007() { final XQuery query = new XQuery( "math:asin(xs:double('NaN'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Evaluate the function math:asin() with the argument xs:double('INF'). */ @org.junit.Test public void mathAsin08() { final XQuery query = new XQuery( "math:asin(xs:double('INF'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Evaluate the function math:asin() with the argument xs:double('-INF'). */ @org.junit.Test public void mathAsin09() { final XQuery query = new XQuery( "math:asin(xs:double('-INF'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/math/MathAtan.java�����������������������0000664�0000000�0000000�00000011433�12224530032�0026774�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.math; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the math:atan function introduced in XPath 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class MathAtan extends QT3TestSet { /** * Evaluate the function math:atan() with the argument (). */ @org.junit.Test public void mathAtan001() { final XQuery query = new XQuery( "math:atan(())", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluate the function math:atan() with the argument 0. */ @org.junit.Test public void mathAtan002() { final XQuery query = new XQuery( "math:atan(0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0.0e0") ); } /** * Evaluate the function math:atan() with the argument -0.0e0. */ @org.junit.Test public void mathAtan003() { final XQuery query = new XQuery( "math:atan(-0.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0.0e0") ); } /** * Evaluate the function math:atan() with the argument 1.0e0. */ @org.junit.Test public void mathAtan004() { final XQuery query = new XQuery( "math:atan(1.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0.7853981633974483e0") ); } /** * Evaluate the function math:atan() with the argument -1.0e0. */ @org.junit.Test public void mathAtan005() { final XQuery query = new XQuery( "math:atan(-1.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0.7853981633974483e0") ); } /** * Evaluate the function math:atan() with the argument 2.0e0. */ @org.junit.Test public void mathAtan006() { final XQuery query = new XQuery( "math:atan(-1.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0.7853981633974483e0") ); } /** * Evaluate the function math:atan() with the argument xs:double('NaN'). */ @org.junit.Test public void mathAtan007() { final XQuery query = new XQuery( "math:atan(xs:double('NaN'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Evaluate the function math:atan() with the argument xs:double('INF'). */ @org.junit.Test public void mathAtan008() { final XQuery query = new XQuery( "math:atan(xs:double('INF'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.5707963267948966e0") ); } /** * Evaluate the function math:atan() with the argument xs:double('-INF'). */ @org.junit.Test public void mathAtan009() { final XQuery query = new XQuery( "math:atan(xs:double('-INF'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.5707963267948966e0") ); } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/math/MathAtan2.java����������������������0000664�0000000�0000000�00000013065�12224530032�0027061�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.math; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the math:atan2 function introduced in XPath 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class MathAtan2 extends QT3TestSet { /** * Evaluate the function math:atan2() with the arguments +0.0e0 and -0.0e0. */ @org.junit.Test public void mathAtan2001() { final XQuery query = new XQuery( "math:atan2(+0.0e0, 0.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0.0e0") ); } /** * Evaluate the function math:atan2() with the arguments -0.0e0 and -0.0e0. */ @org.junit.Test public void mathAtan2002() { final XQuery query = new XQuery( "math:atan2(-0.0e0, 0.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0.0e0") ); } /** * Evaluate the function math:atan2() with the arguments +0.0e0 and -0.0e0. */ @org.junit.Test public void mathAtan2003() { final XQuery query = new XQuery( "math:atan2(+0.0e0, -0.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("abs($result - 3.141592653589793e0) lt 1e-14") ); } /** * Evaluate the function math:atan2() with the arguments -0.0e0 and -0.0e0. */ @org.junit.Test public void mathAtan2004() { final XQuery query = new XQuery( "math:atan2(-0.0e0, -0.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("abs($result + 3.141592653589793e0) lt 1e-14") ); } /** * Evaluate the function math:atan2() with the arguments -1 and -0.0e0. */ @org.junit.Test public void mathAtan2005() { final XQuery query = new XQuery( "math:atan2(-1, -0.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("abs($result + 1.5707963267948966e0) lt 1e-14") ); } /** * Evaluate the function math:atan2() with the arguments +1 and 0.0e0. */ @org.junit.Test public void mathAtan2006() { final XQuery query = new XQuery( "math:atan2(+1, 0.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("abs($result - 1.5707963267948966e0) lt 1e-14") ); } /** * Evaluate the function math:atan2() with the arguments -0.0e0 and -1. */ @org.junit.Test public void mathAtan2007() { final XQuery query = new XQuery( "math:atan2(-0.0e0, -1)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("abs($result + 3.141592653589793e0) lt 1e-14") ); } /** * Evaluate the function math:atan2() with the arguments +0.0e0 and -1. */ @org.junit.Test public void mathAtan2008() { final XQuery query = new XQuery( "math:atan2(+0.0e0, -1)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("abs($result - 3.141592653589793e0) lt 1e-14") ); } /** * Evaluate the function math:atan2() with the arguments -0.0e0 and +1. */ @org.junit.Test public void mathAtan2009() { final XQuery query = new XQuery( "math:atan2(-0.0e0, +1)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0.0e0") ); } /** * Evaluate the function math:atan2() with the arguments +0.0e0 and +1. */ @org.junit.Test public void mathAtan2010() { final XQuery query = new XQuery( "math:atan2(+0.0e0, +1)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("+0.0e0") ); } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/math/MathCos.java������������������������0000664�0000000�0000000�00000011441�12224530032�0026634�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.math; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the math:cos function introduced in XPath 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class MathCos extends QT3TestSet { /** * Evaluate the function math:cos() with the argument (). */ @org.junit.Test public void mathCos001() { final XQuery query = new XQuery( "math:cos(())", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluate the function math:cos() with the argument 0. */ @org.junit.Test public void mathCos002() { final XQuery query = new XQuery( "math:cos(0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.0e0") ); } /** * Evaluate the function math:cos() with the argument -0.0e0. */ @org.junit.Test public void mathCos003() { final XQuery query = new XQuery( "math:cos(-0.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.0e0") ); } /** * Evaluate the function math:cos() with the argument math:pi() div 2. */ @org.junit.Test public void mathCos004() { final XQuery query = new XQuery( "math:cos(math:pi() div 2)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("abs($result) lt 1e-15") ); } /** * Evaluate the function math:cos() with the argument -math:pi() div 2. */ @org.junit.Test public void mathCos005() { final XQuery query = new XQuery( "math:cos(-math:pi() div 2)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("abs($result) lt 1e-15") ); } /** * Evaluate the function math:cos() with the argument math:pi(). */ @org.junit.Test public void mathCos006() { final XQuery query = new XQuery( "math:cos(math:pi())", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.0e0") ); } /** * Evaluate the function math:cos() with the argument xs:double('NaN'). */ @org.junit.Test public void mathCos007() { final XQuery query = new XQuery( "math:cos(xs:double('NaN'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Evaluate the function math:cos() with the argument xs:double('INF'). */ @org.junit.Test public void mathCos008() { final XQuery query = new XQuery( "math:cos(xs:double('INF'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Evaluate the function math:cos() with the argument xs:double('-INF'). */ @org.junit.Test public void mathCos009() { final XQuery query = new XQuery( "math:cos(xs:double('-INF'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/math/MathExp.java������������������������0000664�0000000�0000000�00000011435�12224530032�0026647�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.math; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the math:exp function introduced in XPath 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class MathExp extends QT3TestSet { /** * Evaluate the function exp() with the argument set to empty sequence. */ @org.junit.Test public void mathExp001() { final XQuery query = new XQuery( "math:exp(())", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluate the function exp() with the argument set to zero. */ @org.junit.Test public void mathExp002() { final XQuery query = new XQuery( "math:exp(0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.0e0") ); } /** * Evaluate the function exp() with the argument set to 1. */ @org.junit.Test public void mathExp003() { final XQuery query = new XQuery( "math:exp(1)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("abs($result - 2.7182818284590456e0) lt 1e-15") ); } /** * Evaluate the function exp() with the argument set to 2. */ @org.junit.Test public void mathExp004() { final XQuery query = new XQuery( "math:exp(2)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("7.38905609893065e0") ); } /** * Evaluate the function exp() with the argument set to -1. */ @org.junit.Test public void mathExp005() { final XQuery query = new XQuery( "math:exp(-1)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0.36787944117144233e0") ); } /** * Evaluate the function exp() with the argument set to math:pi(). */ @org.junit.Test public void mathExp006() { final XQuery query = new XQuery( "math:exp(math:pi())", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("23.140692632779267e0") ); } /** * Evaluate the function exp() with the argument set to xs:double('NaN'). */ @org.junit.Test public void mathExp007() { final XQuery query = new XQuery( "math:exp(xs:double('NaN'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Evaluate the function exp() with the argument set to xs:double('INF'). */ @org.junit.Test public void mathExp008() { final XQuery query = new XQuery( "math:exp(xs:double('INF'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:double('INF')") ); } /** * Evaluate the function exp() with the argument set to xs:double('NaN'). */ @org.junit.Test public void mathExp009() { final XQuery query = new XQuery( "math:exp(xs:double('-INF'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0.0e0") ); } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/math/MathExp10.java����������������������0000664�0000000�0000000�00000010513�12224530032�0027004�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.math; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the math:exp10 function introduced in XPath 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class MathExp10 extends QT3TestSet { /** * Evaluate the function exp10() with the argument set to empty sequence. */ @org.junit.Test public void mathExp10001() { final XQuery query = new XQuery( "math:exp10(())", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluate the function exp10() with the argument set to 0. */ @org.junit.Test public void mathExp10002() { final XQuery query = new XQuery( "math:exp10(0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.0e0") ); } /** * Evaluate the function exp10() with the argument set to 1. */ @org.junit.Test public void mathExp10003() { final XQuery query = new XQuery( "math:exp10(1)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.0e1") ); } /** * Evaluate the function exp10() with the argument set to 0.5. */ @org.junit.Test public void mathExp10004() { final XQuery query = new XQuery( "math:exp10(0.5)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("3.1622776601683795") || assertEq("3.162277660168379") ) ); } /** * Evaluate the function exp10() with the argument set to -1. */ @org.junit.Test public void mathExp10005() { final XQuery query = new XQuery( "math:exp10(-1)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.0e-1") ); } /** * Evaluate the function exp10() with the argument set to xs:double('NaN'). */ @org.junit.Test public void mathExp10006() { final XQuery query = new XQuery( "math:exp10(xs:double('NaN'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Evaluate the function exp10() with the argument xs:double('INF'). */ @org.junit.Test public void mathExp10007() { final XQuery query = new XQuery( "math:exp10(xs:double('INF'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:double('INF')") ); } /** * Evaluate the function exp10() with the argument xs:double('NaN'). */ @org.junit.Test public void mathExp10008() { final XQuery query = new XQuery( "math:exp10(xs:double('-INF'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0.0e0") ); } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/math/MathLog.java������������������������0000664�0000000�0000000�00000011446�12224530032�0026636�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.math; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the math:log function introduced in XPath 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class MathLog extends QT3TestSet { /** * Evaluate the function log() with the argument set to empty sequence. */ @org.junit.Test public void mathLog001() { final XQuery query = new XQuery( "math:log(())", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluate the function log() with the argument set to 0. */ @org.junit.Test public void mathLog002() { final XQuery query = new XQuery( "math:log(0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:double('-INF')") ); } /** * Evaluate the function log() with the argument set to math:exp(1). */ @org.junit.Test public void mathLog003() { final XQuery query = new XQuery( "math:log(math:exp(1))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.0e0") ); } /** * Evaluate the function log() with the argument set to 1.0e-3. */ @org.junit.Test public void mathLog004() { final XQuery query = new XQuery( "math:log(1.0e-3)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-6.907755278982137e0") ); } /** * Evaluate the function log() with the argument set to 2. */ @org.junit.Test public void mathLog005() { final XQuery query = new XQuery( "math:log(2)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0.6931471805599453e0") ); } /** * Evaluate the function log() with the argument set to xs:double('-1'). */ @org.junit.Test public void mathLog006() { final XQuery query = new XQuery( "math:log(-1)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Evaluate the function log() with the argument set to xs:double('NaN'). */ @org.junit.Test public void mathLog007() { final XQuery query = new XQuery( "math:log(xs:double('NaN'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Evaluate the function log() with the argument set to xs:double('INF'). */ @org.junit.Test public void mathLog008() { final XQuery query = new XQuery( "math:log(xs:double('INF'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:double('INF')") ); } /** * Evaluate the function log() with the argument set to xs:double('-INF'). */ @org.junit.Test public void mathLog009() { final XQuery query = new XQuery( "math:log(xs:double('-INF'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/math/MathLog10.java����������������������0000664�0000000�0000000�00000011471�12224530032�0026775�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.math; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the math:log10 function introduced in XPath 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class MathLog10 extends QT3TestSet { /** * Evaluate the function log10() with the argument set to empty sequence. */ @org.junit.Test public void mathLog10001() { final XQuery query = new XQuery( "math:log10(())", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluate the function log10() with the argument set to 0. */ @org.junit.Test public void mathLog10002() { final XQuery query = new XQuery( "math:log10(0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:double('-INF')") ); } /** * Evaluate the function log10() with the argument set to 1.0e3. */ @org.junit.Test public void mathLog10003() { final XQuery query = new XQuery( "math:log10(1.0e3)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3.0e0") ); } /** * Evaluate the function log10() with the argument set to 1.0e-3. */ @org.junit.Test public void mathLog10004() { final XQuery query = new XQuery( "math:log10(1.0e-3)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-3.0e0") ); } /** * Evaluate the function log10() with the argument set to 2. */ @org.junit.Test public void mathLog10005() { final XQuery query = new XQuery( "math:log10(2)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0.3010299956639812e0") ); } /** * Evaluate the function log10() with the argument set to -1. */ @org.junit.Test public void mathLog10006() { final XQuery query = new XQuery( "math:log10(-1)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Evaluate the function log10() with the argument set to xs:double('NaN'). */ @org.junit.Test public void mathLog10007() { final XQuery query = new XQuery( "math:log10(xs:double('NaN'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Evaluate the function log10() with the argument set to xs:double('INF'). */ @org.junit.Test public void mathLog10008() { final XQuery query = new XQuery( "math:log10(xs:double('INF'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:double('INF')") ); } /** * Evaluate the function log10() with the argument set to xs:double('-INF'). */ @org.junit.Test public void mathLog10009() { final XQuery query = new XQuery( "math:log10(xs:double('-INF'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/math/MathPi.java�������������������������0000664�0000000�0000000�00000005313�12224530032�0026461�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.math; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the math:pi function introduced in XPath 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class MathPi extends QT3TestSet { /** * function pi() multipled by 2. */ @org.junit.Test public void mathPi001() { final XQuery query = new XQuery( "2*math:pi()", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("6.283185307179586e0") ); } /** * function pi() converts an angle of 60 degrees to radians. */ @org.junit.Test public void mathPi002() { final XQuery query = new XQuery( "60 * (math:pi() div 180)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("abs($result - 1.0471975511965976e0) lt 1e-14") ); } /** * function pi() itself. */ @org.junit.Test public void mathPi003() { final XQuery query = new XQuery( "math:pi()", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3.141592653589793e0") ); } /** * function pi() as a function item. */ @org.junit.Test public void mathPi004() { final XQuery query = new XQuery( "math:pi#0()", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3.141592653589793e0") ); } /** * function pi() via function lookup. */ @org.junit.Test public void mathPi005() { final XQuery query = new XQuery( "function-lookup(xs:QName('math:pi'), 0)()", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3.141592653589793e0") ); } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/math/MathPow.java������������������������0000664�0000000�0000000�00000042246�12224530032�0026664�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.math; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the math:pow function introduced in XPath 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class MathPow extends QT3TestSet { /** * Evaluate the function math:pow() with the arguments () and 93.7. */ @org.junit.Test public void mathPow001() { final XQuery query = new XQuery( "math:pow((), 93.7)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluate the function math:pow() with the arguments 2 and 3. */ @org.junit.Test public void mathPow002() { final XQuery query = new XQuery( "math:pow(2, 3)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("8.0e0") ); } /** * Evaluate the function math:pow() with the arguments -2 and 3. */ @org.junit.Test public void mathPow003() { final XQuery query = new XQuery( "math:pow(-2, 3)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-8.0e0") ); } /** * Evaluate the function math:pow() with the arguments -2 and -3. */ @org.junit.Test public void mathPow004() { final XQuery query = new XQuery( "math:pow(-2, -3)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0.125e0") ); } /** * Evaluate the function math:pow() with the arguments 2 and 0. */ @org.junit.Test public void mathPow005() { final XQuery query = new XQuery( "math:pow(2, 0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.0e0") ); } /** * Evaluate the function math:pow() with the arguments 0 and 0. */ @org.junit.Test public void mathPow006() { final XQuery query = new XQuery( "math:pow(0, 0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.0e0") ); } /** * Evaluate the function math:pow() with the arguments xs:double('INF') and 0. */ @org.junit.Test public void mathPow007() { final XQuery query = new XQuery( "math:pow(xs:double('INF'), 0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.0e0") ); } /** * Evaluate the function math:pow() with the arguments xs:double('NaN') and 0. */ @org.junit.Test public void mathPow008() { final XQuery query = new XQuery( "math:pow(xs:double('NaN'), 0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.0e0") ); } /** * Evaluate the function math:pow() with the arguments -math:pi() and 0. */ @org.junit.Test public void mathPow009() { final XQuery query = new XQuery( "math:pow(-math:pi(), 0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.0e0") ); } /** * Evaluate the function math:pow() with the arguments 0e0 and 3. */ @org.junit.Test public void mathPow010() { final XQuery query = new XQuery( "math:pow(0e0, 3)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0.0e0") ); } /** * Evaluate the function math:pow() with the arguments 0e0 and 4. */ @org.junit.Test public void mathPow011() { final XQuery query = new XQuery( "math:pow(0e0, 4)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0.0e0") ); } /** * Evaluate the function math:pow() with the arguments -0e0 and 3. */ @org.junit.Test public void mathPow012() { final XQuery query = new XQuery( "math:pow(-0e0, 3)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0.0e0") ); } /** * Evaluate the function math:pow() with the arguments 0 and 4. */ @org.junit.Test public void mathPow013() { final XQuery query = new XQuery( "math:pow(0, 4)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0.0e0") ); } /** * Evaluate the function math:pow() with the arguments 0e0 and -3. */ @org.junit.Test public void mathPow014() { final XQuery query = new XQuery( "math:pow(0e0, -3)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:double('INF')") ); } /** * Evaluate the function math:pow() with the arguments 0e0 and -4. */ @org.junit.Test public void mathPow015() { final XQuery query = new XQuery( "math:pow(0e0, -4)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:double('INF')") ); } /** * Evaluate the function math:pow() with the arguments -0e0 and -3. */ @org.junit.Test public void mathPow016() { final XQuery query = new XQuery( "math:pow(-0e0, -3)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:double('-INF')") ); } /** * Evaluate the function math:pow() with the arguments 0 and -4. */ @org.junit.Test public void mathPow017() { final XQuery query = new XQuery( "math:pow(0, -4)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:double('INF')") ); } /** * Evaluate the function math:pow() with the arguments 16 and 0.5e0. */ @org.junit.Test public void mathPow018() { final XQuery query = new XQuery( "math:pow(16, 0.5e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("4.0e0") ); } /** * Evaluate the function math:pow() with the arguments 16 and 0.25e0. */ @org.junit.Test public void mathPow019() { final XQuery query = new XQuery( "math:pow(16, 0.25e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2.0e0") ); } /** * Evaluate the function math:pow() with the arguments 0e0 and -3.0e0. */ @org.junit.Test public void mathPow020() { final XQuery query = new XQuery( "math:pow(0e0, -3.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:double('INF')") ); } /** * Evaluate the function math:pow() with the arguments -0e0 and -3.0e0. */ @org.junit.Test public void mathPow021() { final XQuery query = new XQuery( "math:pow(-0e0, -3.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:double('-INF')") ); } /** * Evaluate the function math:pow() with the arguments 0e0 and -3.1e0. */ @org.junit.Test public void mathPow022() { final XQuery query = new XQuery( "math:pow(0e0, -3.1e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:double('INF')") ); } /** * Evaluate the function math:pow() with the arguments -0e0 and -3.1e0. */ @org.junit.Test public void mathPow023() { final XQuery query = new XQuery( "math:pow(-0e0, -3.1e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:double('INF')") ); } /** * Evaluate the function math:pow() with the arguments 0e0 3.0e0. */ @org.junit.Test public void mathPow024() { final XQuery query = new XQuery( "math:pow(0e0, 3.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0.0e0") ); } /** * Evaluate the function math:pow() with the arguments -0e0 and 3.0e0. */ @org.junit.Test public void mathPow025() { final XQuery query = new XQuery( "math:pow(-0e0, 3.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0.0e0") ); } /** * Evaluate the function math:pow() with the arguments 0e0 3.1e0. */ @org.junit.Test public void mathPow026() { final XQuery query = new XQuery( "math:pow(0e0, 3.1e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0.0e0") ); } /** * Evaluate the function math:pow() with the arguments -0e0 and 3.1e0. */ @org.junit.Test public void mathPow027() { final XQuery query = new XQuery( "math:pow(-0e0, 3.1e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0.0e0") ); } /** * Evaluate the function math:pow() with the arguments -1 and xs:double('INF'). */ @org.junit.Test public void mathPow028() { final XQuery query = new XQuery( "math:pow(-1, xs:double('INF'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.0e0") ); } /** * Evaluate the function math:pow() with the arguments -1 and xs:double('-INF'). */ @org.junit.Test public void mathPow029() { final XQuery query = new XQuery( "math:pow(-1, xs:double('-INF'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.0e0") ); } /** * Evaluate the function math:pow() with the arguments 1 and xs:double('INF'). */ @org.junit.Test public void mathPow030() { final XQuery query = new XQuery( "math:pow(1, xs:double('INF'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.0e0") ); } /** * Evaluate the function math:pow() with the arguments 1 and xs:double('-INF'). */ @org.junit.Test public void mathPow031() { final XQuery query = new XQuery( "math:pow(1, xs:double('-INF'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.0e0") ); } /** * Evaluate the function math:pow() with the arguments 1 and xs:double('NaN'). */ @org.junit.Test public void mathPow032() { final XQuery query = new XQuery( "math:pow(1, xs:double('NaN'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.0e0") ); } /** * Evaluate the function math:pow() with the arguments -2.5 and 2.0e0. */ @org.junit.Test public void mathPow033() { final XQuery query = new XQuery( "math:pow(-2.5e0, 2.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("6.25e0") ); } /** * Evaluate the function math:pow() with the arguments -2.5 and 2.0000001. */ @org.junit.Test public void mathPow034() { final XQuery query = new XQuery( "math:pow(-2.5e0, 2.00000001e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/math/MathSin.java������������������������0000664�0000000�0000000�00000011407�12224530032�0026643�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.math; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the math:sin function introduced in XPath 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class MathSin extends QT3TestSet { /** * Evaluate the function math:sin() with the argument (). */ @org.junit.Test public void mathSin001() { final XQuery query = new XQuery( "math:sin(())", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluate the function math:sin() with the argument 0. */ @org.junit.Test public void mathSin002() { final XQuery query = new XQuery( "math:sin(0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0.0e0") ); } /** * Evaluate the function math:sin() with the argument -0.0e0. */ @org.junit.Test public void mathSin003() { final XQuery query = new XQuery( "math:sin(-0.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0.0e0") ); } /** * Evaluate the function math:sin() with the argument math:pi() div 2. */ @org.junit.Test public void mathSin004() { final XQuery query = new XQuery( "math:sin(math:pi() div 2)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.0e0") ); } /** * Evaluate the function math:sin() with the argument -math:pi() div 2. */ @org.junit.Test public void mathSin005() { final XQuery query = new XQuery( "math:sin(-math:pi() div 2)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.0e0") ); } /** * Evaluate the function math:sin() with the argument math:pi(). */ @org.junit.Test public void mathSin006() { final XQuery query = new XQuery( "math:sin(math:pi()) lt 1e-15", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluate the function math:sin() with the argument xs:double('NaN'). */ @org.junit.Test public void mathSin007() { final XQuery query = new XQuery( "math:sin(xs:double('NaN'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Evaluate the function math:sin() with the argument xs:double('INF'). */ @org.junit.Test public void mathSin008() { final XQuery query = new XQuery( "math:sin(xs:double('INF'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Evaluate the function math:sin() with the argument xs:double('-INF'). */ @org.junit.Test public void mathSin009() { final XQuery query = new XQuery( "math:sin(xs:double('-INF'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/math/MathSqrt.java�����������������������0000664�0000000�0000000�00000011342�12224530032�0027041�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.math; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the math:sqrt function introduced in XPath 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class MathSqrt extends QT3TestSet { /** * Evaluate the function math:sqrt() with the argument (). */ @org.junit.Test public void mathSqrt001() { final XQuery query = new XQuery( "math:sqrt(())", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluate the function math:sqrt() with the argument 0.0e0. */ @org.junit.Test public void mathSqrt002() { final XQuery query = new XQuery( "math:sqrt(0.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0.0e0") ); } /** * Evaluate the function math:sqrt() with the argument -0.0e0. */ @org.junit.Test public void mathSqrt003() { final XQuery query = new XQuery( "math:sqrt(-0.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0.0e0") ); } /** * Evaluate the function math:sqrt() with the argument -0.0e0. */ @org.junit.Test public void mathSqrt004() { final XQuery query = new XQuery( "math:sqrt(-0.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0.0e0") ); } /** * Evaluate the function math:sqrt() with the argument 1.0e6. */ @org.junit.Test public void mathSqrt005() { final XQuery query = new XQuery( "math:sqrt(1.0e6)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.0e3") ); } /** * Evaluate the function math:sqrt() with the argument 2.0e0. */ @org.junit.Test public void mathSqrt006() { final XQuery query = new XQuery( "math:sqrt(2.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.4142135623730951e0") ); } /** * Evaluate the function math:sqrt() with the argument xs:double('NaN'). */ @org.junit.Test public void mathSqrt007() { final XQuery query = new XQuery( "math:sqrt(xs:double('NaN'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Evaluate the function math:sqrt() with the argument INF. */ @org.junit.Test public void mathSqrt008() { final XQuery query = new XQuery( "math:sqrt(xs:double('INF'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:double('INF')") ); } /** * Evaluate the function math:sqrt() with the argument -INF. */ @org.junit.Test public void mathSqrt010() { final XQuery query = new XQuery( "math:sqrt(xs:double('-INF'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/math/MathTan.java������������������������0000664�0000000�0000000�00000013537�12224530032�0026642�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.math; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the math:tan function introduced in XPath 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class MathTan extends QT3TestSet { /** * Evaluate the function math:tan() with the argument (). */ @org.junit.Test public void mathTan001() { final XQuery query = new XQuery( "math:tan(())", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Evaluate the function math:tan() with the argument 0. */ @org.junit.Test public void mathTan002() { final XQuery query = new XQuery( "math:tan(0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0.0e0") ); } /** * Evaluate the function math:tan() with the argument -0.0e0. */ @org.junit.Test public void mathTan003() { final XQuery query = new XQuery( "math:tan(-0.0e0)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0.0e0") ); } /** * Evaluate the function math:tan() with the argument math:pi() div 4. */ @org.junit.Test public void mathTan004() { final XQuery query = new XQuery( "math:tan(math:pi() div 4)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("abs($result - 1.0e0) lt 0.0000001") ); } /** * Evaluate the function math:tan() with the argument -math:pi() div 4. */ @org.junit.Test public void mathTan005() { final XQuery query = new XQuery( "math:tan(-math:pi() div 4)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("abs($result - -1.0e0) lt 0.0000001") ); } /** * Evaluate the function math:tan() with the argument math:pi() div 4. */ @org.junit.Test public void mathTan006() { final XQuery query = new XQuery( "math:tan(math:pi() div 4)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0.9999999999999999") ); } /** * Evaluate the function math:tan() with the argument math:pi() div 4. */ @org.junit.Test public void mathTan007() { final XQuery query = new XQuery( "math:tan(-math:pi() div 4)", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0.9999999999999999") ); } /** * Evaluate the function math:tan() with the argument math:pi(). */ @org.junit.Test public void mathTan008() { final XQuery query = new XQuery( "math:tan(math:pi())", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("abs($result) < 1e12") ); } /** * Evaluate the function math:tan() with the argument xs:double('NaN'). */ @org.junit.Test public void mathTan009() { final XQuery query = new XQuery( "math:tan(xs:double('NaN'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Evaluate the function math:tan() with the argument xs:double('INF'). */ @org.junit.Test public void mathTan010() { final XQuery query = new XQuery( "math:tan(xs:double('INF'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Evaluate the function math:tan() with the argument xs:double('-INF'). */ @org.junit.Test public void mathTan011() { final XQuery query = new XQuery( "math:tan(xs:double('-INF'))", ctx); try { query.namespace("math", "http://www.w3.org/2005/xpath-functions/math"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/misc/������������������������������������0000775�0000000�0000000�00000000000�12224530032�0024434�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/misc/MiscAnnexE.java���������������������0000664�0000000�0000000�00000014211�12224530032�0027270�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.misc; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the AnnexE operator. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class MiscAnnexE extends QT3TestSet { /** * User defined function # 1 from annex E of F& O Specs. . */ @org.junit.Test public void annex1() { final XQuery query = new XQuery( "declare namespace eg = \"http://example.org\"; declare function eg:if-empty ( $node as node()?, $value as xs:anyAtomicType) as xs:anyAtomicType* { if ($node and $node/child::node()) then fn:data($node) else $value }; let $arg1 := <element1>some data</element1> let $arg2 as xs:anyAtomicType := 1 return eg:if-empty($arg1,$arg2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "some data") ); } /** * User defined function # 2 from annex E of F& O Specs. . */ @org.junit.Test public void annex2() { final XQuery query = new XQuery( "declare namespace eg = \"http://example.org\"; declare function eg:if-absent ( $node as node()?, $value as xs:anyAtomicType) as xs:anyAtomicType* { if ($node) then fn:data($node) else $value }; let $arg1 := <element1>some data</element1> let $arg2 as xs:anyAtomicType := 1 return eg:if-absent($arg1,$arg2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "some data") ); } /** * User defined function # 3 from annex E of F& O Specs. . */ @org.junit.Test public void annex3() { final XQuery query = new XQuery( "declare namespace eg = \"http://example.org\"; declare function eg:value-union ( $arg1 as xs:anyAtomicType*, $arg2 as xs:anyAtomicType*) as xs:anyAtomicType* { fn:distinct-values(($arg1, $arg2)) }; let $arg1 as xs:anyAtomicType := 1 let $arg2 as xs:anyAtomicType := 2 return eg:value-union($arg1,$arg2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2") ); } /** * User defined function # 4 from annex E of F& O Specs. . */ @org.junit.Test public void annex4() { final XQuery query = new XQuery( "declare namespace eg = \"http://example.org\"; declare function eg:value-intersect ( $arg1 as xs:anyAtomicType*, $arg2 as xs:anyAtomicType* ) as xs:anyAtomicType* { fn:distinct-values($arg1[.=$arg2]) }; let $arg1 as xs:anyAtomicType := 1 let $arg2 as xs:anyAtomicType := 1 return eg:value-intersect($arg1,$arg2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1") || error("XPTY0004") ) ); } /** * User defined function # 5 from annex E of F& O Specs. . */ @org.junit.Test public void annex5() { final XQuery query = new XQuery( "declare namespace eg = \"http://example.org\"; declare function eg:value-except ( $arg1 as xs:anyAtomicType*, $arg2 as xs:anyAtomicType*) as xs:anyAtomicType* { fn:distinct-values($arg1[not(.=$arg2)]) }; let $arg1 as xs:anyAtomicType := 1 let $arg2 as xs:anyAtomicType := 2 return eg:value-except($arg1,$arg2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1") || error("XPTY0004") ) ); } /** * User defined function # 6 from annex E of F& O Specs. . */ @org.junit.Test public void annex6() { final XQuery query = new XQuery( "declare namespace eg = \"http://example.org\"; declare function eg:index-of-node($sequence as node()*, $srch as node()) as xs:integer* { for $n at $i in $sequence where ($n is $srch) return $i }; let $arg1 := (<element1>some data 1</element1>,<element2>some data 2</element2>) let $arg2 := $arg1[2] return eg:index-of-node($arg1, exactly-one($arg2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * User defined function # 7 from annex E of F& O Specs. . */ @org.junit.Test public void annex7() { final XQuery query = new XQuery( "declare namespace eg = \"http://example.org\"; declare function eg:string-pad ( $padString as xs:string?, $padCount as xs:integer) as xs:string { fn:string-join((for $i in 1 to $padCount return $padString), \"\") }; let $arg1 as xs:string := \"A String\" let $arg2 as xs:integer := 3 return eg:string-pad($arg1,$arg2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "A StringA StringA String") ); } /** * User defined function # 8 from annex E of F& O Specs. . */ @org.junit.Test public void annex8() { final XQuery query = new XQuery( "declare namespace eg = \"http://example.org\"; declare function eg:distinct-nodes-stable ($arg as node()*) as node()* { for $a at $apos in $arg let $before_a := fn:subsequence($arg, 1, $apos - 1) where every $ba in $before_a satisfies not($ba is $a) return $a }; let $arg1 := (<element1>some data 1</element1>,<element2>some data 2</element2>) return eg:distinct-nodes-stable($arg1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("<element1>some data 1</element1><element2>some data 2</element2>", false) ); } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/misc/MiscAppendixA4.java�����������������0000664�0000000�0000000�00000007274�12224530032�0030062�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.misc; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the AppendixA4 operator. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class MiscAppendixA4 extends QT3TestSet { /** * Precedence order for "+" and "*". . */ @org.junit.Test public void appendixA41() { final XQuery query = new XQuery( "-3 + 5 * 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("12") ); } /** * Precedence order for "-" and "*". . */ @org.junit.Test public void appendixA42() { final XQuery query = new XQuery( "3 - 5 * 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-12") ); } /** * Precedence order for "+" and "div". . */ @org.junit.Test public void appendixA43() { final XQuery query = new XQuery( "3 + 10 div 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("8") ); } /** * Precedence order for "-" and "div". . */ @org.junit.Test public void appendixA44() { final XQuery query = new XQuery( "5 - 10 div 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Precedence order for "+" and "idiv". . */ @org.junit.Test public void appendixA45() { final XQuery query = new XQuery( "5 + 10 idiv 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("7") ); } /** * Precedence order for "-" and "idiv". . */ @org.junit.Test public void appendixA46() { final XQuery query = new XQuery( "5 - 10 idiv 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Precedence order for "+" and "mod". . */ @org.junit.Test public void appendixA47() { final XQuery query = new XQuery( "5 + 10 mod 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("7") ); } /** * Precedence order for "-" and "mod". . */ @org.junit.Test public void appendixA48() { final XQuery query = new XQuery( "5 - 10 mod 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Precedence order for unary "-" and unary "+". . */ @org.junit.Test public void appendixA49() { final XQuery query = new XQuery( "-+7", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-7") ); } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/misc/MiscCombinedErrorCodes.java���������0000664�0000000�0000000�00000334765�12224530032�0031645�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.misc; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the CombinedErrorCodes operator. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class MiscCombinedErrorCodes extends QT3TestSet { /** * check that decimal division by zero throws FOAR0001 . */ @org.junit.Test public void fOAR00011() { final XQuery query = new XQuery( "1.0 div 0.0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * check that integer division by zero throws FOAR0001 . */ @org.junit.Test public void fOAR00012() { final XQuery query = new XQuery( "1 div 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * check that double integer division by zero throws FOAR0001 . */ @org.junit.Test public void fOAR00013() { final XQuery query = new XQuery( "1.0e0 idiv 0.0e0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * check that float integer division by zero throws FOAR0001 . */ @org.junit.Test public void fOAR00014() { final XQuery query = new XQuery( "xs:float(1.0e0) idiv xs:float(0.0e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * check that decimal integer division by zero throws FOAR0001 . */ @org.junit.Test public void fOAR00015() { final XQuery query = new XQuery( "1.0 idiv 0.0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * check that integer integer division by zero throws FOAR0001 . */ @org.junit.Test public void fOAR00016() { final XQuery query = new XQuery( "1 div 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * check that integer mod ivision by zero throws FOAR0001 . */ @org.junit.Test public void fOAR00017() { final XQuery query = new XQuery( "1 mod 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * check that decimal mod by zero throws FOAR0001 . */ @org.junit.Test public void fOAR00018() { final XQuery query = new XQuery( "1.0 mod 0.0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * check that yearMonthDuration div by zero throws FOAR0001 . */ @org.junit.Test public void fOAR00019() { final XQuery query = new XQuery( "xs:yearMonthDuration('P1Y2M') div xs:yearMonthDuration('P0Y0M')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * check that duration functions throw FOAR0002 . */ @org.junit.Test public void fOAR00025() { final XQuery query = new XQuery( "xs:dayTimeDuration('P5999999999999999999DT00H00M01S') div xs:dayTimeDuration('P0DT00H00M0.000001S')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0002") ); } /** * check that underflow/overflow throws FOAR0002 . */ @org.junit.Test public void fOAR00021() { final XQuery query = new XQuery( "2e308", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FOAR0002") || assertStringValue(false, "INF") ) ); } /** * Evaluates The "op:numeric-integer-divide" operator for error condition. . */ @org.junit.Test public void fOAR00023() { final XQuery query = new XQuery( "(0 div 0E0) idiv xs:integer(2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0002") ); } /** * Evaluates The "op:numeric-integer-divide" operator for error condition. . */ @org.junit.Test public void fOAR00024() { final XQuery query = new XQuery( "xs:double('INF') idiv xs:integer(2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0002") ); } /** * check that values too large for decimal throws FOCA0001 . */ @org.junit.Test public void fOCA00011() { final XQuery query = new XQuery( "xs:decimal(1e308)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FOCA0001") || ( assertType("xs:decimal") && assertQuery("string-length(string($result)) = (308, 309)") && assertQuery("starts-with(string($result), '1000000000') or starts-with(string($result), '999999999')") ) ) ); } /** * check that invalid lexical values throw FOCA0001 . */ @org.junit.Test public void fOCA00021() { final XQuery query = new XQuery( "xs:float('INF') cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * check that invalid lexical values throw FOCA0002 . */ @org.junit.Test public void fOCA00022() { final XQuery query = new XQuery( "QName(\"http://www.w3.org/\", \"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * check that invalid lexical values throw FOCA0002 . */ @org.junit.Test public void fOCA00023() { final XQuery query = new XQuery( "QName(\"\", \"prefix:localName\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * check that invalid lexical values throw FOCA0002 . */ @org.junit.Test public void fOCA00024() { final XQuery query = new XQuery( "QName(\"http://www.w3.org/\", \"1prefix:localName\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * check that invalid lexical values throw FOCA0002 . */ @org.junit.Test public void fOCA00025() { final XQuery query = new XQuery( "QName(\"http://www.w3.org/\", \"prefix:2localName\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * check that invalid lexical values throw FOCA0002 . */ @org.junit.Test public void fOCA00026() { final XQuery query = new XQuery( "QName(\"\", \"2localName\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * check that invalid lexical values throw FOCA0002 . */ @org.junit.Test public void fOCA00027() { final XQuery query = new XQuery( "resolve-QName(\"2localName\", <localName />)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * check that invalid lexical values throw FOCA0002 . */ @org.junit.Test public void fOCA00028() { final XQuery query = new XQuery( "resolve-QName(\"1prefix:localName\", <localName />)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * check that invalid lexical values throw FOCA0002 . */ @org.junit.Test public void fOCA00029() { final XQuery query = new XQuery( "resolve-QName(\"2localName\", <localName />)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * check that large integers throw FOCA0003 . */ @org.junit.Test public void fOCA00031() { final XQuery query = new XQuery( "xs:integer(xs:double(1e308))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FOCA0003") || ( assertType("xs:integer") && assertQuery("string-length(string($result)) = (308, 309)") && assertQuery("starts-with(string($result), '1000000000') or starts-with(string($result), '999999999')") ) ) ); } /** * check that using NaN throws FOCA0005 . */ @org.junit.Test public void fOCA00051() { final XQuery query = new XQuery( "xs:dayTimeDuration('P3DT10H30M') div xs:double('NaN')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0005") ); } /** * check that using NaN throws FOCA0005 . */ @org.junit.Test public void fOCA00052() { final XQuery query = new XQuery( "xs:dayTimeDuration('P3DT10H30M') * xs:double('NaN')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0005") ); } /** * check that using NaN throws FOCA0005 . */ @org.junit.Test public void fOCA00053() { final XQuery query = new XQuery( "xs:dayTimeDuration('P3DT10H30M') div xs:double('NaN')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0005") ); } /** * check that using NaN throws FOCA0005 . */ @org.junit.Test public void fOCA00054() { final XQuery query = new XQuery( "xs:dayTimeDuration('P3DT10H30M') * xs:double('NaN')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0005") ); } /** * check that invalid codepoints throw FOCH0001 . */ @org.junit.Test public void fOCH0001() { final XQuery query = new XQuery( "codepoints-to-string(0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * check that invalid collations throw FOCH0002 . */ @org.junit.Test public void fOCH00021() { final XQuery query = new XQuery( "compare('a', 'b', 'http://www.cbcl.co.u,/collation')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0002") ); } /** * check that invalid collations throw FOCH0002 . */ @org.junit.Test public void fOCH000210() { final XQuery query = new XQuery( "substring-before('a', 'b', 'http://www.cbcl.co.u,/collation')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0002") ); } /** * check that invalid collations throw FOCH0002 . */ @org.junit.Test public void fOCH00022() { final XQuery query = new XQuery( "deep-equal('a', 'b', 'http://www.cbcl.co.u,/collation')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0002") ); } /** * check that invalid collations throw FOCH0002 . */ @org.junit.Test public void fOCH00023() { final XQuery query = new XQuery( "distinct-values(('a', 'b'), 'http://www.cbcl.co.u,/collation')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0002") ); } /** * check that invalid collations throw FOCH0002 . */ @org.junit.Test public void fOCH00024() { final XQuery query = new XQuery( "ends-with('a', 'b', 'http://www.cbcl.co.u,/collation')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0002") ); } /** * check that invalid collations throw FOCH0002 . */ @org.junit.Test public void fOCH00025() { final XQuery query = new XQuery( "index-of('a', 'b', 'http://www.cbcl.co.u,/collation')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0002") ); } /** * check that invalid collations throw FOCH0002 . */ @org.junit.Test public void fOCH00026() { final XQuery query = new XQuery( "max(('a', 'b'), 'http://www.cbcl.co.u,/collation')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0002") ); } /** * check that invalid collations throw FOCH0002 . */ @org.junit.Test public void fOCH00027() { final XQuery query = new XQuery( "min(('a', 'b'), 'http://www.cbcl.co.u,/collation')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0002") ); } /** * check that invalid collations throw FOCH0002 . */ @org.junit.Test public void fOCH00028() { final XQuery query = new XQuery( "starts-with('a', 'b', 'http://www.cbcl.co.u,/collation')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0002") ); } /** * check that invalid collations throw FOCH0002 . */ @org.junit.Test public void fOCH00029() { final XQuery query = new XQuery( "substring-after('a', 'b', 'http://www.cbcl.co.u,/collation')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0002") ); } /** * check that fn:id throws FOAR0001 . */ @org.junit.Test public void fODC00011() { final XQuery query = new XQuery( "fn:id('id', <a />)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0001") ); } /** * check that fn:idref throws FOAR0001 . */ @org.junit.Test public void fODC00012() { final XQuery query = new XQuery( "<a />/fn:idref('id')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0001") ); } /** * check that fn:doc throws FOAR0002 . */ @org.junit.Test public void fODC00021() { final XQuery query = new XQuery( "doc('http://www.example.org/notFound.xml')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0002") ); } /** * check that fn:doc throws FOAR0002 . */ @org.junit.Test public void fODC00022() { final XQuery query = new XQuery( "doc('http://www.example.org/notFound.xml')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0002") ); } /** * check that fn:doc throws FOAR0002 . */ @org.junit.Test public void fODC00023() { final XQuery query = new XQuery( "doc('http://www.example.org/notFound.xml')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0002") ); } /** * check that fn:collection() throws FODC0002 . */ @org.junit.Test public void fODC00024() { final XQuery query = new XQuery( "collection()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0002") ); } /** * check that fn:collection throws FODC0004 . */ @org.junit.Test public void fODC0004() { final XQuery query = new XQuery( "collection('%gg')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0004") ); } /** * check that fn:doc throws FODC0005 . */ @org.junit.Test public void fODC00051() { final XQuery query = new XQuery( "doc('%gg')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODC0005") ); } /** * check that fn:doc-available throws FODC0005 . */ @org.junit.Test public void fODC00052() { final XQuery query = new XQuery( "doc-available('%gg')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FODC0005") || assertBoolean(false) ) ); } /** * check that date/time functions throw FODT0001 . */ @org.junit.Test public void fODT00011() { final XQuery query = new XQuery( "adjust-dateTime-to-timezone( xs:dateTime(\"25252734927766555-07-28T23:59:59-14:00\"), xs:dayTimeDuration(\"PT14H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * check that date/time operators throw FODT0001 . */ @org.junit.Test public void fODT000110() { final XQuery query = new XQuery( "xs:date(\"25252734927766555-07-28-14:00\") - xs:yearMonthDuration(\"-P1Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * check that date/time operators throw FODT0001 . */ @org.junit.Test public void fODT000111() { final XQuery query = new XQuery( "xs:date(\"25252734927766555-07-28-14:00\") - xs:date(\"-25252734927766555-07-28-14:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * check that date/time operators throw FODT0001 . */ @org.junit.Test public void fODT000112() { final XQuery query = new XQuery( "xs:dateTime(\"25252734927766555-07-28T23:59:59-14:00\") - xs:dateTime(\"-25252734927766555-07-28T23:59:59-14:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * check that date/time functions throw FODT0001 . */ @org.junit.Test public void fODT00012() { final XQuery query = new XQuery( "adjust-date-to-timezone( xs:date(\"25252734927766555-07-28-14:00\"), xs:dayTimeDuration(\"PT14H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * check that date/time operators throw FODT0001 . */ @org.junit.Test public void fODT00013() { final XQuery query = new XQuery( "xs:dateTime(\"25252734927766555-07-28T23:59:59-14:00\") + xs:dayTimeDuration(\"PT14H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * check that date/time operators throw FODT0001 . */ @org.junit.Test public void fODT00014() { final XQuery query = new XQuery( "xs:date(\"25252734927766555-07-28-14:00\") + xs:dayTimeDuration(\"PT24H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * check that date/time operators throw FODT0001 . */ @org.junit.Test public void fODT00015() { final XQuery query = new XQuery( "xs:dateTime(\"25252734927766555-07-28T23:59:59-14:00\") - xs:dayTimeDuration(\"-PT14H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * check that date/time operators throw FODT0001 . */ @org.junit.Test public void fODT00016() { final XQuery query = new XQuery( "xs:date(\"25252734927766555-07-28-14:00\") - xs:dayTimeDuration(\"-PT24H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * check that date/time operators throw FODT0001 . */ @org.junit.Test public void fODT00017() { final XQuery query = new XQuery( "xs:dateTime(\"25252734927766555-07-28T23:59:59-14:00\") + xs:yearMonthDuration(\"P1Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * check that date/time operators throw FODT0001 . */ @org.junit.Test public void fODT00018() { final XQuery query = new XQuery( "xs:date(\"25252734927766555-07-28-14:00\") + xs:yearMonthDuration(\"P1Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * check that date/time operators throw FODT0001 . */ @org.junit.Test public void fODT00019() { final XQuery query = new XQuery( "xs:dateTime(\"25252734927766555-07-28T23:59:59-14:00\") - xs:yearMonthDuration(\"-P1Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * check that duration functions throw FODT0002 . */ @org.junit.Test public void fODT00021() { final XQuery query = new XQuery( "xs:dayTimeDuration('P5999999999999999999DT00H00M01S') + xs:dayTimeDuration('P4999999999999999999DT00H00M01S')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * check that duration functions throw FODT0002 . */ @org.junit.Test public void fODT00022() { final XQuery query = new XQuery( "xs:dayTimeDuration('P5999999999999999999DT00H00M01S') * 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * check that duration functions throw FODT0002 . */ @org.junit.Test public void fODT00023() { final XQuery query = new XQuery( "xs:dayTimeDuration('P5999999999999999999DT00H00M01S') div 0.5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * check that duration functions throw FODT0002 . */ @org.junit.Test public void fODT00024() { final XQuery query = new XQuery( "xs:dayTimeDuration('P5999999999999999999DT00H00M01S') - xs:dayTimeDuration('-P5999999999999999999DT00H00M01S')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * check that duration functions throw FODT0002 . */ @org.junit.Test public void fODT00026() { final XQuery query = new XQuery( "xs:yearMonthDuration('P768614336404564650Y0M') + xs:yearMonthDuration('P768614336404564650Y1M')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * check that duration functions throw FODT0002 . */ @org.junit.Test public void fODT00027() { final XQuery query = new XQuery( "xs:yearMonthDuration('P768614336404564650Y0M') * 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * check that duration functions throw FODT0002 . */ @org.junit.Test public void fODT00028() { final XQuery query = new XQuery( "xs:yearMonthDuration('P768614336404564650Y0M') div 0.5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * check that duration functions throw FODT0002 . */ @org.junit.Test public void fODT00029() { final XQuery query = new XQuery( "xs:yearMonthDuration('P768614336404564650Y0M') - xs:yearMonthDuration('-P768614336404564650Y0M')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * check that bad timezones throw FODT0003 . */ @org.junit.Test public void fODT00031() { final XQuery query = new XQuery( "adjust-date-to-timezone( xs:date(\"2001-07-28-14:00\"), xs:dayTimeDuration(\"PT15H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0003") ); } /** * check that bad timezones throw FODT0003 . */ @org.junit.Test public void fODT00032() { final XQuery query = new XQuery( "adjust-date-to-timezone( xs:date(\"2001-07-28-14:00\"), xs:dayTimeDuration(\"-PT15H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0003") ); } /** * check that fn:error() throws FOER0000 . */ @org.junit.Test public void fOER0000() { final XQuery query = new XQuery( "error()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * check that missing prefix throws FONS0004 . */ @org.junit.Test public void fONS00041() { final XQuery query = new XQuery( "resolve-QName('prefix:localName', <element />)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FONS0004") ); } /** * check that missing prefix throws FONS0004 . */ @org.junit.Test public void fONS00042() { final XQuery query = new XQuery( "xs:QName('prefix:localName')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FONS0004") ); } /** * check that invalid construction throws FORG0001 . */ @org.junit.Test public void fORG0001() { final XQuery query = new XQuery( "xs:integer('INF')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * check that resolve-uri throws FORG0002 . */ @org.junit.Test public void fORG0002() { final XQuery query = new XQuery( "declare base-uri \"http://www.w3.org/\"; resolve-uri(\"%gg\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0002") ); } /** * check that zero-or-one throws FORG0003 . */ @org.junit.Test public void fORG0003() { final XQuery query = new XQuery( "zero-or-one( (1, 2, 3) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0003") ); } /** * check that one-or-more throws FORG0004 . */ @org.junit.Test public void fORG0004() { final XQuery query = new XQuery( "one-or-more( () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0004") ); } /** * check that exactly-one throws FORG0005 . */ @org.junit.Test public void fORG0005() { final XQuery query = new XQuery( "exactly-one( () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0005") ); } /** * check that exactly-one throws FORG0005 . */ @org.junit.Test public void fORG000601() { final XQuery query = new XQuery( "fn:boolean( xs:date('2007-01-01') )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FORG0006") || error("XPTY0004") ) ); } /** * check that fn:avg throws FORG0006-2 . */ @org.junit.Test public void fORG000602() { final XQuery query = new XQuery( "fn:avg( (xs:yearMonthDuration('P1Y0M'), 1) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * check that fn:min throws FORG0006-3 . */ @org.junit.Test public void fORG000603() { final XQuery query = new XQuery( "fn:min( (xs:yearMonthDuration('P1Y0M'), 1) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * check that fn:max throws FORG0006-3 . */ @org.junit.Test public void fORG000604() { final XQuery query = new XQuery( "fn:max( (xs:yearMonthDuration('P1Y0M'), 1) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * check that fn:sum throws FORG0006 . */ @org.junit.Test public void fORG000605() { final XQuery query = new XQuery( "fn:sum( (xs:yearMonthDuration('P1Y0M'), 1) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * check that fn:dateTime can throw FORG0008 . */ @org.junit.Test public void fORG0008() { final XQuery query = new XQuery( "dateTime(xs:date('2001-01-01-14:00'), xs:time('01:01:01+14:00'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0008") ); } /** * check resolution against a relative URI . */ @org.junit.Test public void fORG0009() { final XQuery query = new XQuery( "resolve-uri('../../', '../../')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0002") ); } /** * Schema import binding to no namespace, and no location hint. . */ @org.junit.Test public void kCombinedErrorCodes1() { final XQuery query = new XQuery( "import schema \"http://example.com/NSNOTRECOGNIZED\"; 1 eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQST0009") || error("XQST0059") ) ); } /** * A 'validate' expression with an invalid operand. . */ @org.junit.Test public void kCombinedErrorCodes10() { final XQuery query = new XQuery( "validate { () }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQTY0030") || error("XQST0075") ) ); } /** * A 'validate' expression with an invalid operand. . */ @org.junit.Test public void kCombinedErrorCodes11() { final XQuery query = new XQuery( "validate lax { 1 }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQTY0030") || error("XQST0075") ) ); } /** * A 'validate' expression with an invalid operand. . */ @org.junit.Test public void kCombinedErrorCodes12() { final XQuery query = new XQuery( "validate strict { 1 }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQTY0030") || error("XQST0075") ) ); } /** * A 'validate' expression with an invalid operand. . */ @org.junit.Test public void kCombinedErrorCodes13() { final XQuery query = new XQuery( "validate lax { }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XQST0075") ) ); } /** * A 'validate' expression with an invalid operand. . */ @org.junit.Test public void kCombinedErrorCodes14() { final XQuery query = new XQuery( "validate strict { }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XQST0075") ) ); } /** * A 'validate' expression with an invalid operand. . */ @org.junit.Test public void kCombinedErrorCodes15() { final XQuery query = new XQuery( "validate { }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XQST0075") ) ); } /** * Schema import binding to no namespace, but has a location hint. . */ @org.junit.Test public void kCombinedErrorCodes2() { final XQuery query = new XQuery( "import schema \"http://example.com/NSNOTRECOGNIZED\" at \"http://example.com/DOESNOTEXIST\"; 1 eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQST0009") || error("XQST0059") ) ); } /** * Schema import binding to no namespace, but has three location hints. . */ @org.junit.Test public void kCombinedErrorCodes3() { final XQuery query = new XQuery( "import schema \"http://example.com/NSNOTRECOGNIZED\" at \"http://example.com/DOESNOTEXIST\", \"http://example.com/2\", \"http://example.com/3\"; 1 eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQST0009") || error("XQST0059") ) ); } /** * Schema import binding to no namespace, but has three location hints. . */ @org.junit.Test public void kCombinedErrorCodes4() { final XQuery query = new XQuery( "import schema \"http://example.com/NSNOTRECOGNIZED\" at \"http://example.com/DOESNOTEXIST\", \"http://example.com/2\", \"http://example.com/3\"; 1 eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQST0009") || error("XQST0059") ) ); } /** * Schema import binding to a namespace, and has three location hints. . */ @org.junit.Test public void kCombinedErrorCodes5() { final XQuery query = new XQuery( "import schema namespace prefix = \"http://example.com/NSNOTRECOGNIZED\" at \"http://example.com/DOESNOTEXIST\", \"http://example.com/2DOESNOTEXIST\", \"http://example.com/3DOESNOTEXIST\"; 1 eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQST0009") || error("XQST0059") ) ); } /** * Schema import binding to the default element namespace, and has three location hints. . */ @org.junit.Test public void kCombinedErrorCodes6() { final XQuery query = new XQuery( "import schema default element namespace \"http://example.com/NSNOTRECOGNIZED\" at \"http://example.com/DOESNOTEXIST\", \"http://example.com/2DOESNOTEXIST\", \"http://example.com/3DOESNOTEXIST\"; 1 eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQST0009") || error("XQST0059") ) ); } /** * ':=' cannot be used to assing namespaces in 'import schema'. . */ @org.junit.Test public void kCombinedErrorCodes7() { final XQuery query = new XQuery( "import schema namespace NCName := \"http://example.com/Dummy\"; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A 'validate' expression with an invalid operand. . */ @org.junit.Test public void kCombinedErrorCodes9() { final XQuery query = new XQuery( "validate { 1 }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQTY0030") || error("XQST0075") ) ); } /** * check that unassigned context item is reported correctly . */ @org.junit.Test public void xPDY000201() { final XQuery query = new XQuery( ".", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * check that unassigned context item is reported correctly . */ @org.junit.Test public void xPDY000202() { final XQuery query = new XQuery( "declare variable $variable external; $variable", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * check that treat as errors are reported correctly . */ @org.junit.Test public void xPDY0050() { final XQuery query = new XQuery( "1 treat as node()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0050") ); } /** * test type checking of attribute names . */ @org.junit.Test public void xPTY000401() { final XQuery query = new XQuery( "attribute { 1 } { 1 }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test type checking of element names . */ @org.junit.Test public void xPTY000402() { final XQuery query = new XQuery( "element { 1 } { }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test bad casts . */ @org.junit.Test public void xPTY000403() { final XQuery query = new XQuery( "() cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test bad casts . */ @org.junit.Test public void xPTY000404() { final XQuery query = new XQuery( "(1, 2) cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test bad 'as' clauses . */ @org.junit.Test public void xPTY000405() { final XQuery query = new XQuery( "let $x as node() := 1 return $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test bad 'as' clauses . */ @org.junit.Test public void xPTY000406() { final XQuery query = new XQuery( "for $x as node() in (1, 2, 3) return $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test bad document constructions . */ @org.junit.Test public void xPTY000407() { final XQuery query = new XQuery( "document { attribute {'foo'} {} }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test bad document constructions . */ @org.junit.Test public void xPTY000408() { final XQuery query = new XQuery( "declare namespace foo = \"http://www.example.org\"; declare function foo:content($type as xs:integer) { if ($type eq 1) then attribute {'foo'} {} else <foo /> }; document { foo:content(1) }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test bad order-by comparisons . */ @org.junit.Test public void xPTY000409() { final XQuery query = new XQuery( "for $x in (1, 'hello', xs:date('2007-11-28')) order by $x return $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test type checking of function calls . */ @org.junit.Test public void xPTY000410() { final XQuery query = new XQuery( "fn:upper-case(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test type checking of function calls . */ @org.junit.Test public void xPTY000411() { final XQuery query = new XQuery( "fn:tokenize('foo', () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test type checking of function calls . */ @org.junit.Test public void xPTY000412() { final XQuery query = new XQuery( "fn:error( () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test type checking of binary operators . */ @org.junit.Test public void xPTY000413() { final XQuery query = new XQuery( "\"string\" eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test type checking of binary operators . */ @org.junit.Test public void xPTY000414() { final XQuery query = new XQuery( "\"string\" ne 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test type checking of binary operators . */ @org.junit.Test public void xPTY000415() { final XQuery query = new XQuery( "\"string\" le 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test type checking of binary operators . */ @org.junit.Test public void xPTY000416() { final XQuery query = new XQuery( "\"string\" gt 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test type checking of binary operators . */ @org.junit.Test public void xPTY000417() { final XQuery query = new XQuery( "\"string\" ge 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test type checking of binary operators . */ @org.junit.Test public void xPTY000418() { final XQuery query = new XQuery( "\"string\" ne 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test type checking of binary operators . */ @org.junit.Test public void xPTY000419() { final XQuery query = new XQuery( "\"string\" << 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test type checking of binary operators . */ @org.junit.Test public void xPTY000420() { final XQuery query = new XQuery( "\"string\" >> 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test type checking of binary operators . */ @org.junit.Test public void xPTY000421() { final XQuery query = new XQuery( "\"string\" is 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test type checking of binary operators . */ @org.junit.Test public void xPTY000422() { final XQuery query = new XQuery( "\"string\" div 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test type checking of binary operators . */ @org.junit.Test public void xPTY000423() { final XQuery query = new XQuery( "\"string\" idiv 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test type checking of binary operators . */ @org.junit.Test public void xPTY000424() { final XQuery query = new XQuery( "\"string\" * 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test type checking of binary operators . */ @org.junit.Test public void xPTY000425() { final XQuery query = new XQuery( "\"string\" mod 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test type checking of binary operators . */ @org.junit.Test public void xPTY000426() { final XQuery query = new XQuery( "\"string\" - 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test type checking of binary operators . */ @org.junit.Test public void xPTY000427() { final XQuery query = new XQuery( "\"string\" + 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test bad run-time conversions . */ @org.junit.Test public void xPTY000428() { final XQuery query = new XQuery( "declare namespace foo = \"http://www.example.org\"; declare function foo:something($type as xs:integer) { if ($type eq 1) then xs:date('2007-11-28') else 1.0 }; abs(foo:something(1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test bad run-time conversions . */ @org.junit.Test public void xPTY000429() { final XQuery query = new XQuery( "declare namespace foo = \"http://www.example.org\"; declare function foo:something($type as xs:integer) { if ($type eq 1) then xs:date('2007-11-28') else 'foo' }; element { foo:something(1) } { }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test bad run-time conversions . */ @org.junit.Test public void xPTY000430() { final XQuery query = new XQuery( "declare namespace foo = \"http://www.example.org\"; declare function foo:something($type as xs:integer) { if ($type eq 1) then xs:date('2007-11-28') else 'foo' }; processing-instruction { foo:something(1) } { }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test bad run-time conversions . */ @org.junit.Test public void xPTY000431() { final XQuery query = new XQuery( "declare namespace foo = \"http://www.example.org\"; declare function foo:something($type as xs:integer) { if ($type eq 1) then xs:date('2007-11-28') else 'foo' }; <e> { attribute { foo:something(1) } { } } </e>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test bad run-time conversions . */ @org.junit.Test public void xPTY000432() { final XQuery query = new XQuery( "declare namespace foo = \"http://www.example.org\"; declare function foo:something($type as xs:integer) { if ($type eq 1) then ('foo', xs:date('2007-11-28'), 'foo') else 'foo' }; let $x as xs:string* := foo:something(1) return $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test bad run-time conversions . */ @org.junit.Test public void xPTY000433() { final XQuery query = new XQuery( "declare namespace foo = \"http://www.example.org\"; declare function foo:something($type as xs:integer) { if ($type eq 1) then xs:date('2007-11-28') else 'foo' }; for $x as xs:string in foo:something(1) return $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test bad run-time conversions . */ @org.junit.Test public void xPTY000434() { final XQuery query = new XQuery( "declare namespace foo = \"http://www.example.org\"; declare function foo:something($type) as xs:integer { $type }; foo:something('foo')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test bad run-time conversions . */ @org.junit.Test public void xPTY000435() { final XQuery query = new XQuery( "declare namespace foo = \"http://www.example.org\"; declare function foo:something($type as xs:integer) as xs:integer { if ($type eq 1) then xs:date('2007-11-28') else $type }; foo:something(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test bad unary functions . */ @org.junit.Test public void xPTY000437() { final XQuery query = new XQuery( "-xs:date('2007-11-29')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test bad unary functions . */ @org.junit.Test public void xPTY000438() { final XQuery query = new XQuery( "declare namespace foo = \"http://www.example.org\"; declare function foo:something($pos as xs:integer) { if ($pos eq 1) then 1 else xs:date('2007-11-29') }; -foo:something(2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test bad unary functions . */ @org.junit.Test public void xPTY000439() { final XQuery query = new XQuery( "declare namespace foo = \"http://www.example.org\"; declare function foo:something($pos as xs:integer) { if ($pos eq 1) then 1 else xs:date('2007-11-29') }; +foo:something(2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test bad unary functions . */ @org.junit.Test public void xPTY000440() { final XQuery query = new XQuery( "+xs:date('2007-11-29')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test bad input to fn:boolean. Error differs depending on type checking mode . */ @org.junit.Test public void xPTY000441() { final XQuery query = new XQuery( "fn:boolean( (1, 2) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || error("FORG0006") ) ); } /** * test bad input to fn:string-length . */ @org.junit.Test public void xPTY000442() { final XQuery query = new XQuery( "fn:string-length(xs:date('2007-11-29'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test bad input to fn:string-length . */ @org.junit.Test public void xPTY000443() { final XQuery query = new XQuery( "xs:date(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test bad input to fn:string-length . */ @org.junit.Test public void xPTY000444() { final XQuery query = new XQuery( "1 cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test bad casts . */ @org.junit.Test public void xPTY000445() { xquery10(); final XQuery query = new XQuery( "concat('prefix:', 'localname') cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test runtime cardinality checks . */ @org.junit.Test public void xPTY000446() { final XQuery query = new XQuery( "(1, 2) + 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test runtime cardinality checks . */ @org.junit.Test public void xPTY000447() { final XQuery query = new XQuery( "declare variable $a := <e><a/><b/><a/></e>; <a>{$a/a eq 1}</a>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test runtime cardinality checks . */ @org.junit.Test public void xPTY000448() { final XQuery query = new XQuery( "let $i := (1, 3, 2) order by $i return $i", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "1 3 2") || error("XPTY0004") ) ); } /** * check that last step of path expressions are reported correctly . */ @org.junit.Test public void xPTY0018() { final XQuery query = new XQuery( "(<a/>, <b/>)/(if (position() mod 2 = 1) then position() else .)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0018") ); } /** * check that bad steps are reported correctly . */ @org.junit.Test public void xPTY00191() { final XQuery query = new XQuery( "<a/>/1/node()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0019") ); } /** * test bad run-time conversions . */ @org.junit.Test public void xPTY00192() { final XQuery query = new XQuery( "declare namespace foo = \"http://www.example.org\"; declare function foo:something() { (<a />, 1, <b/>, 2) }; foo:something()/a", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0019") ); } /** * test bad run-time conversions . */ @org.junit.Test public void xPTY00193() { final XQuery query = new XQuery( "declare namespace foo = \"http://www.example.org\"; declare function foo:something($pos as xs:integer) { if ($pos eq 1) then 1 else <a /> }; let $x := <a><b><c/></b><b><c/></b></a> return $x/b/(foo:something(position()))/a", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0019") ); } /** * check that bad context item types are reported correctly . */ @org.junit.Test public void xPTY0020() { final XQuery query = new XQuery( "<a/>/20[text()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0020") ); } /** * check that attributes clashes are reported correctly . */ @org.junit.Test public void xQDY00251() { final XQuery query = new XQuery( "let $attr1 := attribute attr { 'foo' } return let $attr2 := attribute attr { 'bar' } return <a>{$attr1, $attr2 }</a>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0025") ); } /** * check that attributes clashes are reported correctly . */ @org.junit.Test public void xQDY00252() { final XQuery query = new XQuery( "declare namespace prefix = \"http://www/w3.org/\"; let $attr1 := attribute prefix:attr { 'foo' } return let $attr2 := attribute prefix:attr { 'bar' } return <a>{$attr1, $attr2 }</a>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0025") ); } /** * check that attributes clashes are reported correctly . */ @org.junit.Test public void xQDY00253() { final XQuery query = new XQuery( "declare namespace prefix = \"http://www/w3.org/\"; let $attr1 := attribute attr { 'foo' } return let $attr2 := attribute attr { 'bar' } return <prefix:a>{$attr1, $attr2 }</prefix:a>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0025") ); } /** * check that attributes clashes are reported correctly . */ @org.junit.Test public void xQDY00254() { final XQuery query = new XQuery( "declare namespace prefix = \"http://www/w3.org/\"; let $attr1 := attribute prefix:attr { 'foo' } return let $attr2 := attribute prefix:attr { 'bar' } return <prefix:a>{$attr1, $attr2 }</prefix:a>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0025") ); } /** * check that bad processing instruction content is reported correctly . */ @org.junit.Test public void xQDY0026() { final XQuery query = new XQuery( "processing-instruction target { '?>' }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0026") ); } /** * check that bad processing instruction targets reported correctly . */ @org.junit.Test public void xQDY0041() { final XQuery query = new XQuery( "<a> { processing-instruction { '1BadName' } { 'content' } } </a>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0041") ); } /** * check that bad attribute names are reported correctly . */ @org.junit.Test public void xQDY00441() { final XQuery query = new XQuery( "<a> { attribute { 'xmlns' } { 'http://www.w3.org/' } } </a>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0044") ); } /** * check that bad processing instructions are reported correctly . */ @org.junit.Test public void xQDY0064() { final XQuery query = new XQuery( "<a> { processing-instruction { 'xml' } { 'content' } } </a>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0064") ); } /** * check that bad comments are reported correctly . */ @org.junit.Test public void xQDY0072() { final XQuery query = new XQuery( "<a> { comment { ' -- ' } } </a>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0072") ); } /** * check that bad qualified names are reported correctly . */ @org.junit.Test public void xQDY00741() { final XQuery query = new XQuery( "<a> { element { 'prefix:localName' } { } } </a>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0074") ); } /** * check that bad qualified names are reported correctly . */ @org.junit.Test public void xQDY00742() { final XQuery query = new XQuery( "<a> { attribute { 'prefix:localName' } { } } </a>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0074") ); } /** * check that bad qualified names are reported correctly . */ @org.junit.Test public void xQDY00743() { final XQuery query = new XQuery( "<a> { element { '1localName' } { } } </a>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0074") ); } /** * check that bad qualified names are reported correctly . */ @org.junit.Test public void xQDY00744() { final XQuery query = new XQuery( "<a> { attribute { '1localName' } { } } </a>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0074") ); } /** * check that bad xml:id attributes are reported correctly . */ @org.junit.Test public void xQDY0091() { final XQuery query = new XQuery( "<e xml:id=\" ab c d \"/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQDY0091") || assertSerialization("<e xml:id=\"ab c d\"/>", false) ) ); } /** * check construction of xml:space attribute with a value other than preserve or default. . */ @org.junit.Test public void xQDY0092() { final XQuery query = new XQuery( "<a xml:space=\"space\"/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQDY0092") || assertSerialization("<a xml:space=\"space\"/>", false) ) ); } /** * check that bad context item types are reported correctly . */ @org.junit.Test public void xQST00221() { final XQuery query = new XQuery( "<a xmlns=\"{1}\" />", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0022") ); } /** * check that bad context item types are reported correctly . */ @org.junit.Test public void xQST00222() { final XQuery query = new XQuery( "<a xmlns:prefix=\"{1}\" />", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0022") ); } /** * check that invalid encodings are reported correctly . */ @org.junit.Test public void xQST0031() { final XQuery query = new XQuery( "xquery version '2.0'; 1+2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0031") ); } /** * check that invalid prolog declarations are reported correctly . */ @org.junit.Test public void xQST0032() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.org/A\"; declare base-uri \"http://www.example.org/B\"; 1 + 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0032") ); } /** * check that invalid namespace declarations are reported correctly . */ @org.junit.Test public void xQST0033() { final XQuery query = new XQuery( "declare namespace cheddar = 'http://www.example.org/cheddar'; declare namespace cheddar = 'http://www.example.org/cheddar'; 1 + 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0033") ); } /** * check that function name clashes are reported correctly . */ @org.junit.Test public void xQST0034() { final XQuery query = new XQuery( "declare namespace prefix = \"http://www.example.org/\"; declare function prefix:foo() { 1 }; declare function prefix:foo() { 1 }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0034") ); } /** * check that invalid prolog declarations are reported correctly . */ @org.junit.Test public void xQST00381() { final XQuery query = new XQuery( "declare default collation \"http://www.w3.org/2005/xpath-functions/collation/codepoint\"; declare default collation \"http://www.w3.org/2005/xpath-functions/collation/codepoint\"; 1 + 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0038") ); } /** * check that invalid prolog declarations are reported correctly . */ @org.junit.Test public void xQST00383() { final XQuery query = new XQuery( "declare default collation \"http://www.example.org/\"; 1 + 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0038") ); } /** * check that bad function parameter declarations are reported correctly . */ @org.junit.Test public void xQST0039() { final XQuery query = new XQuery( "declare namespace prefix = \"http://www.w3.org/\"; declare function prefix:foo($arg, $arg) { 1 }; 1 + 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0039") ); } /** * check that duplicate attributes are reported correctly . */ @org.junit.Test public void xQST0040() { final XQuery query = new XQuery( "<a attr=\"a\" attr=\"a\" />", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0040") ); } /** * check that bad function declarations are reported correctly . */ @org.junit.Test public void xQST00451() { final XQuery query = new XQuery( "declare function foo() { 1 }; foo()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * check that bad function declarations are reported correctly . */ @org.junit.Test public void xQST00452() { final XQuery query = new XQuery( "declare function xml:foo() { 1 }; xml:foo()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * check that bad function declarations are reported correctly . */ @org.junit.Test public void xQST00453() { final XQuery query = new XQuery( "declare function xs:foo() { 1 }; xs:foo()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * check that bad function declarations are reported correctly . */ @org.junit.Test public void xQST00454() { final XQuery query = new XQuery( "declare function xsi:foo() { 1 }; xsi:foo()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * check that bad namespace declarations are reported correctly . */ @org.junit.Test public void xQST004601() { final XQuery query = new XQuery( "base-uri(<a xml:base=\"%gg\" />)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQST0046") || error("FORG0001") || assertStringValue(false, "%gg") ) ); } /** * check that bad namespace declarations are reported correctly . */ @org.junit.Test public void xQST004602() { final XQuery query = new XQuery( "import module \"http://www.example.org/test\"; true()", ctx); try { query.addModule("http://www.example.org/test", file("misc/CombinedErrorCodes/XQST0046_lib.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQST0046") || error("XQST0059") ) ); } /** * check that bad namespace declarations are reported correctly . */ @org.junit.Test public void xQST004603() { final XQuery query = new XQuery( "declare namespace foo = \"%gg\"; true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQST0046") || assertBoolean(true) ) ); } /** * check that bad namespace declarations are reported correctly . */ @org.junit.Test public void xQST004604() { final XQuery query = new XQuery( "declare default element namespace \"%gg\"; true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQST0046") || assertBoolean(true) ) ); } /** * check that bad namespace declarations are reported correctly . */ @org.junit.Test public void xQST004605() { final XQuery query = new XQuery( "declare default function namespace \"%gg\"; fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQST0046") || assertBoolean(true) ) ); } /** * check that bad namespace declarations are reported correctly . */ @org.junit.Test public void xQST004606() { final XQuery query = new XQuery( "declare default collation \"%gg\"; fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQST0046") || error("XQST0038") || assertBoolean(true) ) ); } /** * check that bad namespace declarations are reported correctly . */ @org.junit.Test public void xQST004607() { final XQuery query = new XQuery( "declare base-uri \"%gg\"; true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQST0046") || assertBoolean(true) ) ); } /** * check that bad namespace declarations are reported correctly . */ @org.junit.Test public void xQST004608() { final XQuery query = new XQuery( "import schema \"%gg\" at \"http://www.w3.org/\"; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0046") ); } /** * check that bad namespace declarations are reported correctly . */ @org.junit.Test public void xQST004609() { final XQuery query = new XQuery( "import schema \"http://www.w3.org/\" at \"%gg\"; 1", ctx); try { query.addModule("http://www.example.org/test", file("misc/CombinedErrorCodes/XQST0046_lib.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQST0046") || error("XQST0059") ) ); } /** * check that bad namespace declarations are reported correctly . */ @org.junit.Test public void xQST004610() { final XQuery query = new XQuery( "import module \"%gg\"; true()", ctx); try { query.addModule("http://www.example.org/test", file("misc/CombinedErrorCodes/XQST0046_lib.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQST0046") || assertBoolean(true) ) ); } /** * check that bad namespace declarations are reported correctly . */ @org.junit.Test public void xQST004611() { final XQuery query = new XQuery( "import module \"http://www.w3.org/\" at \"%gg\"; 1", ctx); try { query.addModule("http://www.example.org/test", file("misc/CombinedErrorCodes/XQST0046_lib.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQST0046") || error("XQST0059") ) ); } /** * check that invalid collation URIs are reported correctly . */ @org.junit.Test public void xQST004612() { final XQuery query = new XQuery( "for $x in (\"a\", \"a\", \"a\") order by $x collation \"%gg\" return $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQST0046") || error("XQST0038") || assertStringValue(false, "aaa") ) ); } /** * check that bad namespace declarations are reported correctly . */ @org.junit.Test public void xQST004613() { final XQuery query = new XQuery( "<a xmlns=\"%gg\" />", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0046") ); } /** * check that bad namespace declarations are reported correctly . */ @org.junit.Test public void xQST004614() { final XQuery query = new XQuery( "<a xmlns:foo=\"%gg\" />", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0046") ); } /** * check that bad module imports are reported correctly . */ @org.junit.Test public void xQST0047() { final XQuery query = new XQuery( "import module \"http://www.example.org/foo\"; import module \"http://www.example.org/foo\"; 1", ctx); try { query.addModule("http://www.example.org/foo", file("misc/CombinedErrorCodes/XQST0047_lib.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0047") ); } /** * check that bad declarations are reported correctly . */ @org.junit.Test public void xQST0048() { final XQuery query = new XQuery( "import module namespace foo = \"http://www.example.org/foo\"; 1", ctx); try { query.addModule("http://www.example.org/foo", file("misc/CombinedErrorCodes/XQST0048_lib.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0048") ); } /** * check that bad variable declarations are reported correctly . */ @org.junit.Test public void xQST0049() { final XQuery query = new XQuery( "declare variable $foo external; declare variable $foo external; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0049") ); } /** * check that cyclic variable definitions are reported correctly . */ @org.junit.Test public void xQST0054() { xquery10(); final XQuery query = new XQuery( "declare namespace foo = \"http://www.example.org/\"; declare variable $a := foo:bar(); declare function foo:bar() { $a + 1 }; $a", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0054") ); } /** * check that cyclic variable definitions are reported correctly . */ @org.junit.Test public void xQST0055() { final XQuery query = new XQuery( "declare copy-namespaces preserve,inherit; declare copy-namespaces preserve,no-inherit; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0055") ); } /** * check that bad schema imports are reported correctly . */ @org.junit.Test public void xQST0057() { final XQuery query = new XQuery( "import schema namespace foo = \"\" at \"http://www.w3.org/\"; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0057") ); } /** * check that bad schema imports are reported correctly . */ @org.junit.Test public void xQST0058() { final XQuery query = new XQuery( "import schema namespace foo = \"http://www.w3.org/XQueryTest/testcases\"; import schema namespace bar = \"http://www.w3.org/XQueryTest/testcases\"; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0058") ); } /** * check that missing schema imports are reported correctly . */ @org.junit.Test public void xQST00591() { final XQuery query = new XQuery( "import schema namespace foo = \"http://www.w3.org/\" at \"DoesNotExist.xsd\"; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0059") ); } /** * check that missing module imports are reported correctly . */ @org.junit.Test public void xQST00592() { final XQuery query = new XQuery( "import module namespace foo = \"http://www.w3.org/\" at \"DoesNotExist.xq\"; 1", ctx); try { query.addModule("http://www.example.org", file("misc/CombinedErrorCodes/XQST0059_lib.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0059") ); } /** * check that missing schema imports are reported correctly . */ @org.junit.Test public void xQST00593() { final XQuery query = new XQuery( "import schema namespace foo = \"http://www.w3.org/\"; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0059") ); } /** * check that missing module imports are reported correctly . */ @org.junit.Test public void xQST00594() { final XQuery query = new XQuery( "import module namespace foo = \"http://www.w3.org/\"; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0059") ); } /** * Test generating XQST0059 . */ @org.junit.Test public void xQST00595() { final XQuery query = new XQuery( "import module namespace foo = \"http://www.example.org/\"; foo:bar()", ctx); try { query.addModule("http://www.example.org", file("misc/CombinedErrorCodes/XQST0059_lib.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0059") ); } /** * Test generating XQST0059 . */ @org.junit.Test public void xQST00596() { final XQuery query = new XQuery( "import schema namespace foo = \"http://www.example.org/\" at \"XQST0059.xsd\"; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0059") ); } /** * check that bad context item types are reported correctly . */ @org.junit.Test public void xQST0060() { final XQuery query = new XQuery( "declare default function namespace \"\"; declare function foo() { 1 }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0060") ); } /** * check that bad context item types are reported correctly . */ @org.junit.Test public void xQST0065() { final XQuery query = new XQuery( "declare ordering unordered; declare ordering ordered; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0065") ); } /** * check that repeated element namespace declarations are reported correctly . */ @org.junit.Test public void xQST00661() { final XQuery query = new XQuery( "declare default element namespace \"http://www.w3.org/a\"; declare default element namespace \"http://www.w3.org/b\"; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0066") ); } /** * check that invalid prolog declarations are reported correctly . */ @org.junit.Test public void xQST00663() { final XQuery query = new XQuery( "declare default function namespace \"http://www.example.org/\"; declare default function namespace \"http://www.w3.org/2005/xpath-functions/collation/codepoint\"; 1 + 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0066") ); } /** * check that duplicate declarations are reported correctly . */ @org.junit.Test public void xQST0067() { final XQuery query = new XQuery( "declare construction strip; declare construction preserve; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0067") ); } /** * check that duplicate declarations are reported correctly . */ @org.junit.Test public void xQST0068() { final XQuery query = new XQuery( "declare boundary-space strip; declare boundary-space preserve; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0068") ); } /** * check that duplicate declarations are reported correctly . */ @org.junit.Test public void xQST0069() { final XQuery query = new XQuery( "declare default order empty least; declare default order empty greatest; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0069") ); } /** * check that invalid prolog declarations are reported correctly . */ @org.junit.Test public void xQST00701() { final XQuery query = new XQuery( "import schema namespace xml = \"http://www.example.org/\"; 1 + 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0070") ); } /** * check that invalid prolog declarations are reported correctly . */ @org.junit.Test public void xQST00702() { final XQuery query = new XQuery( "import module namespace xml = \"http://www.example.org/\"; 1 + 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0070") ); } /** * check that invalid module declarations are reported correctly . */ @org.junit.Test public void xQST00703() { final XQuery query = new XQuery( "import module namespace xml = 'http://www.example.org/'; 1 + 2", ctx); try { query.addModule("http://www.example.org/foo", file("misc/CombinedErrorCodes/XQST0070_lib.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0070") ); } /** * check that invalid prolog declarations are reported correctly . */ @org.junit.Test public void xQST00704() { final XQuery query = new XQuery( "declare namespace xml = \"http://www.example.org/\"; 1 + 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0070") ); } /** * check that duplicate namespaces are reported correctly . */ @org.junit.Test public void xQST00711() { final XQuery query = new XQuery( "<a xmlns:prefix=\"http://www.w3.org/\" xmlns:prefix=\"http://www.w3.org/\" />", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0071") ); } /** * check that duplicate namespaces are reported correctly . */ @org.junit.Test public void xQST00712() { final XQuery query = new XQuery( "<a xmlns=\"http://www.w3.org/\" xmlns=\"http://www.w3.org/\" />", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0071") ); } /** * check that invalid collations are reported correctly . */ @org.junit.Test public void xQST0076() { final XQuery query = new XQuery( "for $x in ('a', 'b', 'c') order by $x collation 'http://www.w3.org/' return $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0076") ); } /** * check that unrecognised pragma is reported correctly . */ @org.junit.Test public void xQST0079() { final XQuery query = new XQuery( "declare namespace prefix = \"http://www.w3.org/\"; (# prefix:pragma #) { }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0079") ); } /** * check that XML 1.1 namespace undeclarations are reported correctly . */ @org.junit.Test public void xQST0085() { final XQuery query = new XQuery( "<element xmlns:foo=\"http://www.w3.org/\"> <element xmlns:foo=\"\" /> </element>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0085") ); } /** * check that invalid encodings are reported correctly . */ @org.junit.Test public void xQST0087() { final XQuery query = new XQuery( "xquery version '1.0' encoding '_utf'; 1+2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0087") ); } /** * check that invalid module imports are reported correctly . */ @org.junit.Test public void xQST00881() { final XQuery query = new XQuery( "import module namespace cheese = ''; 1 + 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0088") ); } /** * check that invalid module declarations are reported correctly . */ @org.junit.Test public void xQST00882() { final XQuery query = new XQuery( "import module \"http://www.example.org/test\"; 1", ctx); try { query.addModule("http://www.example.org/test", file("misc/CombinedErrorCodes/XQST0088_lib.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0088") ); } /** * check that bad for/at expressions are reported correctly . */ @org.junit.Test public void xQST0089() { final XQuery query = new XQuery( "for $x at $x in (1, 2, 3) return $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0089") ); } /** * check that bad character references are reported correctly . */ @org.junit.Test public void xQST0090() { final XQuery query = new XQuery( "<bad-character-reference>�</bad-character-reference>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0090") ); } /** * Test generating XQST0093 . */ @org.junit.Test public void xQST0093() { xquery10(); final XQuery query = new XQuery( "import module namespace foo=\"http://www.example.org/foo\"; $foo:variable2", ctx); try { query.addModule("http://www.example.org/foo", file("misc/CombinedErrorCodes/XQST0093_lib2.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0093") ); } /** * Test generating XQST0093 (no longer an error in XQuery 3.0). */ @org.junit.Test public void xQST0093a() { final XQuery query = new XQuery( "\n" + " \timport module namespace foo=\"http://www.example.org/foo\"; \n" + " \t$foo:variable2\n" + " ", ctx); try { query.addModule("http://www.example.org/foo", file("misc/CombinedErrorCodes/XQST0093_lib2.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * It is a static error if an inline function expression is annotated as %public.. */ @org.junit.Test public void xQST01251() { final XQuery query = new XQuery( "\n" + " let $f := %public function($arg as xs:integer) as xs:integer \n" + " { $arg + 1 }\n" + " return $f(1)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0125") ); } /** * It is a static error if an inline function expression is annotated as %private.. */ @org.junit.Test public void xQST01252() { final XQuery query = new XQuery( "\n" + " let $f := %private function($arg as xs:integer) as xs:integer \n" + " { $arg + 1 }\n" + " return $f(1)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0125") ); } /** * check that bad element content is reported correctly . */ @org.junit.Test public void xQTY00241() { final XQuery query = new XQuery( "declare namespace prefix = \"http://www.w3.org/\"; <prefix:a> { <b />, attribute prefix:foo { 'bar' } } </prefix:a>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * check that bad element content is reported correctly . */ @org.junit.Test public void xQTY00242() { final XQuery query = new XQuery( "declare namespace prefix = \"http://www.w3.org/\"; <prefix:a> { <b />, attribute foo { 'bar' } } </prefix:a>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * check that bad element content is reported correctly . */ @org.junit.Test public void xQTY00243() { final XQuery query = new XQuery( "declare namespace prefix = \"http://www.w3.org/\"; <a> { <b />, attribute prefix:foo { 'bar' } } </a>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * check that bad element content is reported correctly . */ @org.junit.Test public void xQTY00244() { final XQuery query = new XQuery( "<a> { <b />, attribute foo { 'bar' } } </a>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * Evaluates simple module import to generate error code if feature not supported. . */ @org.junit.Test public void combinedErrors1() { final XQuery query = new XQuery( "import module namespace defs=\"http://www.w3.org/TestModules/defs\"; \"ABC\"", ctx); try { query.addModule("http://www.w3.org/TestModules/test1", file("misc/CombinedErrorCodes/test1-lib.xq")); query.addModule("http://www.w3.org/TestModules/defs", file("misc/CombinedErrorCodes/moduleDefs-lib.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "ABC") || error("XQST0016") ) ); } /** * Evaluates simple full axis feature (preceding axis) to generate error code if feature not supported. . */ @org.junit.Test public void combinedErrors4() { final XQuery query = new XQuery( "/works[1]/employee[2]/preceding::employee", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("<employee name=\"Jane Doe 1\" gender=\"female\">\n <empnum>E1</empnum>\n <pnum>P1</pnum>\n <hours>40</hours>\n </employee>", false) || error("XPST0010") ) ); } } �����������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/misc/MiscErrorsAndOptimization.java������0000664�0000000�0000000�00000010152�12224530032�0032420�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.misc; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the ErrorsAndOptimization. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class MiscErrorsAndOptimization extends QT3TestSet { /** * Conditional and typeswitch expressions must not raise a dynamic error in respect of subexpressions occurring in a branch that is not selected . */ @org.junit.Test public void errorsAndOptimization1() { final XQuery query = new XQuery( "if (true()) then 1 else error(QName('http://www.example.com/errors', 'err:oops'), \"Oops, this error should not be raised!\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Conditional expressions must not return the value delivered by a branch unless that branch is selected. . */ @org.junit.Test public void errorsAndOptimization2() { final XQuery query = new XQuery( "if (true()) then 1 div 0 else 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * To avoid unexpected errors caused by expression rewrite, tests that are designed to prevent dynamic errors should be expressed using conditional or typeswitch expressions. . */ @org.junit.Test public void errorsAndOptimization3() { final XQuery query = new XQuery( "count( let $N := <n x=\"this ain't no date\"/> return $N[if (@x castable as xs:date) then xs:date(@x) gt xs:date(\"2000-01-01\") else false()] )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * If a processor evaluates an operand E (wholly or in part), then it is required to establish that the actual value of the operand E does not violate any constraints on its cardinality. . */ @org.junit.Test public void errorsAndOptimization4() { final XQuery query = new XQuery( "string-length((\"one\", \"two\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * If a processor evaluates an operand E (wholly or in part), then it is required to establish that the actual value of the operand E does not violate any constraints on its cardinality. . */ @org.junit.Test public void errorsAndOptimization5() { final XQuery query = new XQuery( "let $e := (1,2) return $e eq 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Expressions must not be rewritten in such a way as to create or remove static errors. . */ @org.junit.Test public void errorsAndOptimization6() { final XQuery query = new XQuery( "for $s in \"var:QName\" return QName($s)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Expressions must not be rewritten in such a way as to create or remove static errors. . */ @org.junit.Test public void errorsAndOptimization7() { final XQuery query = new XQuery( "if (true()) then 1 else let $unbound:var := 2 return $unbound:var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0081") ); } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/misc/MiscHigherOrderFunctions.java�������0000664�0000000�0000000�00000240524�12224530032�0032215�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.misc; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for features associated with higher order functions. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class MiscHigherOrderFunctions extends QT3TestSet { /** * A function item is a value that represents a function.. */ @org.junit.Test public void functionItem1() { final XQuery query = new XQuery( "concat#64 instance of function(*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A function item consists of the following information: The signature of the function item.. */ @org.junit.Test public void functionItem10() { final XQuery query = new XQuery( "(let $a := 92, $b := true() return function($c) { $a, $b, $c }) instance of function(item()*) as item()*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A function item consists of the following information: The function implementation.. */ @org.junit.Test public void functionItem11() { final XQuery query = new XQuery( "(let $a := 92, $b := true() return function($c) { $a, $b, $c })((xs:QName(\"foo\"), 5.0e3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("92, true(), fn:QName(\"\",\"foo\"), 5000") ); } /** * function(item()) as item() is a subtype of function(*). */ @org.junit.Test public void functionItem12() { final XQuery query = new XQuery( "function($a as item()) as item() { $a } instance of function(*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * function(item()) as xs:integer is a subtype of function(item()) as item(). */ @org.junit.Test public void functionItem13() { final XQuery query = new XQuery( "function($a as item()) as xs:integer { $a } instance of function(item()) as item()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * function(xs:string) as item() is a subtype of function(item()) as item(). */ @org.junit.Test public void functionItem14() { final XQuery query = new XQuery( "function($a as item()) as item() { $a } instance of function(xs:string) as item()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * function(item()) as item() is not a subtype of function() as item(). */ @org.junit.Test public void functionItem15() { final XQuery query = new XQuery( "function($a as item()) as item() { $a } instance of function() as item()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * function(item()) as xs:integer is no a subtype of function(item(), item()) as item(). */ @org.junit.Test public void functionItem16() { final XQuery query = new XQuery( "function($a as item()) as xs:integer { $a } instance of function(item(), item()) as item()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * function(item()) as item() is not a subtype of function(xs:string) as item(). */ @org.junit.Test public void functionItem17() { final XQuery query = new XQuery( "function($a as xs:string) as item() { $a } instance of function(item()) as item()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Function items can be invoked, which is the act of calling the function that the function item represents.. */ @org.junit.Test public void functionItem2() { final XQuery query = new XQuery( "string-join#1((\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcdefghij") ); } /** * Function items have no identity, cannot be compared, and have no serialization.. */ @org.junit.Test public void functionItem3() { final XQuery query = new XQuery( "string-join#1 is string-join#1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Function items have no identity, cannot be compared, and have no serialization.. */ @org.junit.Test public void functionItem4() { final XQuery query = new XQuery( "string-join#1 eq string-join#1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOTY0013") ); } /** * Function items have no identity, cannot be compared, and have no serialization.. */ @org.junit.Test public void functionItem5() { final XQuery query = new XQuery( "element a { avg#1 }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0105") ); } /** * Function items have no identity, cannot be compared, and have no serialization.. */ @org.junit.Test public void functionItem6() { final XQuery query = new XQuery( "attribute a { avg#1 }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOTY0013") ); } /** * A function item consists of the following information: The set of variable values for the variables referenced by the function.. */ @org.junit.Test public void functionItem7() { final XQuery query = new XQuery( "(let $a := 92, $b := true() return function($c) { $a, $b, $c })(\"lala\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("92, true(), \"lala\"") ); } /** * A function item consists of the following information: The name of the function as a xs:QName.. */ @org.junit.Test public void functionItem8() { final XQuery query = new XQuery( "function-name(function-name#1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:QName(\"fn:function-name\")") ); } /** * A function item consists of the following information: The name of the function as a xs:QName. This is potentially absent.. */ @org.junit.Test public void functionItem9() { final XQuery query = new XQuery( "function-name(let $a := 92, $b := true() return function($c) { $a, $b, $c })", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(0) ); } /** * named function reference, user-defined function . */ @org.junit.Test public void hof001() { final XQuery query = new XQuery( "\n" + " declare function local:f($x as xs:integer) as xs:integer { $x + 1 }; \n" + " let $f := local:f#1 return $f(2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * named function reference, user-defined function . */ @org.junit.Test public void hof002() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f() as xs:integer { 42 }; \n" + " \tdeclare function local:f($x as xs:integer) as xs:integer { $x + 1 }; \n" + " \tlet $f := local:f#0 return $f()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("42") ); } /** * named function reference, imported user-defined function . */ @org.junit.Test public void hof003() { final XQuery query = new XQuery( "\n" + " import module namespace m=\"http://example.com/hof-003\"; \n" + " let $f := m:f#1 return $f(17)", ctx); try { query.addModule("http://example.com/hof-003", file("misc/HigherOrderFunctions/module-hof-003.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("18") ); } /** * named function reference, system function . */ @org.junit.Test public void hof004() { final XQuery query = new XQuery( "let $f := fn:round#1 return $f(1.2345)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * named function reference, system function . */ @org.junit.Test public void hof005() { final XQuery query = new XQuery( "let $f := concat#8 return $f('a','b','c','d','e','f','g','h')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcdefgh") ); } /** * named function reference, user-defined function, default function namespace . */ @org.junit.Test public void hof006() { final XQuery query = new XQuery( "\n" + " declare default function namespace \"http://example.com/hof-006\"; \n" + " declare function g($x as xs:integer) as xs:integer { $x + 1 }; \n" + " let $f := g#1 return $f(21)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("22") ); } /** * named function reference, constructor function, default namespace . */ @org.junit.Test public void hof007() { final XQuery query = new XQuery( "\n" + " declare default function namespace \"http://www.w3.org/2001/XMLSchema\"; \n" + " let $f := date#1 return $f('2008-01-31')\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2008-01-31") ); } /** * named function reference, constructor function, non default namespace . */ @org.junit.Test public void hof008() { final XQuery query = new XQuery( "let $f := xs:date#1 return $f('2008-01-31')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2008-01-31") ); } /** * SequenceType function() . */ @org.junit.Test public void hof010() { final XQuery query = new XQuery( "\n" + " declare function local:f($x as xs:integer) as xs:integer { $x + 1 }; \n" + " let $f as function(*) := local:f#1 return $f(2)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * SequenceType function(x) as z . */ @org.junit.Test public void hof011() { final XQuery query = new XQuery( "\n" + " declare function local:f($x as xs:integer) as xs:integer { $x + 3 }; \n" + " let $f as function(xs:integer) as xs:integer := local:f#1 \n" + " return $f(2)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** * SequenceType function(x,y) as z . */ @org.junit.Test public void hof012() { final XQuery query = new XQuery( "\n" + " declare function local:f($x as xs:integer, $y as xs:long) as xs:integer { $x + $y }; \n" + " let $f as function(xs:integer, xs:long) as xs:integer := local:f#2 \n" + " return $f(2, xs:long(5))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("7") ); } /** * Selecting from a sequence of functions . */ @org.junit.Test public void hof013() { final XQuery query = new XQuery( "\n" + " declare function local:f($x as xs:integer) as xs:integer { $x + 3 }; \n" + " declare function local:g($x as xs:integer) as xs:integer { $x + 4 }; \n" + " declare function local:h($x as xs:integer) as xs:integer { $x + 5 }; \n" + " let $f as (function(xs:integer) as xs:integer)* := (local:f#1, local:g#1, local:h#1) return $f[3](2)[1]\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("7") ); } /** * Function returning a function . */ @org.junit.Test public void hof014() { final XQuery query = new XQuery( "\n" + " declare function local:case($x as xs:boolean) as function(*) \n" + " \t{ if ($x) then fn:upper-case#1 else fn:lower-case#1 }; \n" + " local:case(true())(\"Mike\"), local:case(false())(\"Mike\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "MIKE mike") ); } /** * Function returning a function . */ @org.junit.Test public void hof015() { final XQuery query = new XQuery( "\n" + " declare function local:case($x as xs:boolean) as function(xs:string?) as xs:string \n" + " \t{ if ($x) then fn:upper-case#1 else fn:lower-case#1 }; \n" + " local:case(true())(\"Mike\"), local:case(false())(\"Mike\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "MIKE mike") ); } /** * Function expecting a function . */ @org.junit.Test public void hof016() { final XQuery query = new XQuery( "\n" + " declare function local:case($x as function(*), $y as xs:string) as xs:string { $x($y) }; \n" + " local:case(upper-case#1, \"Mike\"), local:case(lower-case#1, \"Mike\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "MIKE mike") ); } /** * Function expecting a function, full signature . */ @org.junit.Test public void hof017() { final XQuery query = new XQuery( "\n" + " declare function local:case($x as function(xs:string?) as xs:string, $y as xs:string) as xs:string { $x($y) }; \n" + " local:case(upper-case#1, \"Mike\"), local:case(lower-case#1, \"Mike\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "MIKE mike") ); } /** * Function expecting a function, caller supplies local function . */ @org.junit.Test public void hof018() { final XQuery query = new XQuery( "\n" + " declare function local:scramble($x as function(xs:string) as xs:string, $y as xs:string) as xs:string \n" + " \t{ $x($y) }; \n" + " declare function local:rot13($x as xs:string) as xs:string \n" + " \t{ translate($x, \"abcdefghijklmnopqrstuvwxyz\", \"nopqrstuvwxyzabcdefghijklm\") }; \n" + " local:scramble(local:rot13#1, \"mike\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "zvxr") ); } /** * Function expecting a function, caller supplies local function . */ @org.junit.Test public void hof019() { final XQuery query = new XQuery( "\n" + " declare function local:scramble($x as function(*), $y as xs:string) as xs:string { $x($y) }; \n" + " declare function local:rot13($x as xs:string) as xs:string { translate($x, \"abcdefghijklmnopqrstuvwxyz\", \"nopqrstuvwxyzabcdefghijklm\") }; \n" + " local:scramble(local:rot13#1, \"mike\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "zvxr") ); } /** * Function expecting a function, caller supplies inline function . */ @org.junit.Test public void hof020() { final XQuery query = new XQuery( "\n" + " declare function local:scramble($x as function(*), $y as xs:string) as xs:string { $x($y) }; \n" + " local:scramble(function($x){translate($x, \"abcdefghijklmnopqrstuvwxyz\", \"nopqrstuvwxyzabcdefghijklm\")}, \"john\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "wbua") ); } /** * Function expecting a function, caller supplies inline function. Needs function coercion . */ @org.junit.Test public void hof021() { final XQuery query = new XQuery( "\n" + " declare function local:scramble($x as function(xs:string) as xs:string, $y as xs:string) as xs:string { $x($y) }; \n" + " local:scramble(function($x){translate($x, \"abcdefghijklmnopqrstuvwxyz\", \"nopqrstuvwxyzabcdefghijklm\")}, \"john\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "wbua") ); } /** * Name and arity of a user-defined function . */ @org.junit.Test public void hof022() { final XQuery query = new XQuery( "\n" + " declare function local:scramble($x as function(xs:string) as xs:string, $y as xs:string) as xs:string { $x($y) }; \n" + " let $n := function-name(local:scramble#2) \n" + " return (local-name-from-QName($n), namespace-uri-from-QName($n), function-arity(local:scramble#2))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "scramble http://www.w3.org/2005/xquery-local-functions 2") ); } /** * Name and arity of a system function . */ @org.junit.Test public void hof023() { final XQuery query = new XQuery( "\n" + " let $f := fn:function-name#1, $n := function-name($f) \n" + " return (local-name-from-QName($n), namespace-uri-from-QName($n), function-arity($f))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "function-name http://www.w3.org/2005/xpath-functions 1") ); } /** * Name and arity of a constructor function . */ @org.junit.Test public void hof024() { final XQuery query = new XQuery( "\n" + " let $f := xs:dateTime#1, $n := function-name($f) \n" + " return (local-name-from-QName($n), namespace-uri-from-QName($n), function-arity($f))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "dateTime http://www.w3.org/2001/XMLSchema 1") ); } /** * Name and arity of a concat function . */ @org.junit.Test public void hof025() { final XQuery query = new XQuery( "let $f := concat#123456, $n := function-name($f) \n" + " return (local-name-from-QName($n), namespace-uri-from-QName($n), function-arity($f))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "concat http://www.w3.org/2005/xpath-functions 123456") ); } /** * Name and arity of an inline function . */ @org.junit.Test public void hof026() { final XQuery query = new XQuery( "\n" + " let $f := function($x as xs:string) as xs:string { upper-case($x) } \n" + " let $n := function-name($f) \n" + " return <a loc=\"{local-name-from-QName($n)}\" uri=\"{namespace-uri-from-QName($n)}\"\n" + " \t\t\tarity=\"{function-arity($f)}\" eloc=\"{empty(local-name-from-QName($n))}\" euri=\"{empty(namespace-uri-from-QName($n))}\"/>\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("<a uri=\"\" loc=\"\" euri=\"true\" eloc=\"true\" arity=\"1\"/>", false) ); } /** * Curry a system function . */ @org.junit.Test public void hof027() { final XQuery query = new XQuery( "\n" + " let $f := fn:contains(?, \"e\") \n" + " return for $s in (\"Mike\", \"John\", \"Dave\", \"Mary\", \"Jane\") return $f($s)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true false true false true") ); } /** * Return an inline function from a user-defined function. Needs function coercion . */ @org.junit.Test public void hof028() { final XQuery query = new XQuery( "\n" + " declare function local:splitter() as (function(xs:string) as xs:string*) { function($x as xs:string) { tokenize($x, '\\s') } }; \n" + " string-join(local:splitter()(\"A nice cup of tea\"), '|')\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "A|nice|cup|of|tea") ); } /** * Return an inline function that uses internal variables. Needs function coercion . */ @org.junit.Test public void hof029() { final XQuery query = new XQuery( "\n" + " declare function local:splitter() as (function(xs:string) as xs:string+)? \n" + " { function($x as xs:string) { for $i in tokenize($x, '\\s') return upper-case($i)} }; \n" + " string-join(local:splitter()(\"A nice cup of tea\"), '|')\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "A|NICE|CUP|OF|TEA") ); } /** * Return an inline function that uses global variables . */ @org.junit.Test public void hof030() { final XQuery query = new XQuery( "\n" + " declare variable $sep as xs:string := \"\\s\"; \n" + " declare function local:splitter() as (function(xs:string) as xs:string*)? \n" + " \t{ function($x as xs:string) { for $i in tokenize($x, $sep) return upper-case($i)} }; \n" + " string-join(local:splitter()(\"A nice cup of tea\"), '|')\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "A|NICE|CUP|OF|TEA") ); } /** * Return an inline function that uses local parameters . */ @org.junit.Test public void hof031() { final XQuery query = new XQuery( "\n" + " declare function local:splitter($sep as xs:string) as (function(xs:string) as xs:string*) \n" + " \t{ function($x as xs:string) { for $i in tokenize($x, $sep) return upper-case($i)} }; \n" + " string-join(local:splitter(\"\\s\")(\"A nice cup of tea\"), '|')\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "A|NICE|CUP|OF|TEA") ); } /** * Parenthesized expression in a function call . */ @org.junit.Test public void hof032() { final XQuery query = new XQuery( "(if (current-date() gt xs:date('2000-12-31')) then upper-case#1 else lower-case#1)(\"Mike\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "MIKE") ); } /** * Context item is a function item . */ @org.junit.Test public void hof033() { final XQuery query = new XQuery( "local-name-from-QName(function-name((upper-case#1, lower-case#1)[.(\"Mike\") = \"MIKE\"]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "upper-case") ); } /** * ordered{} applied to a function item . */ @org.junit.Test public void hof034() { final XQuery query = new XQuery( "local-name-from-QName(function-name((upper-case#1, lower-case#1)[ordered{.}(\"Mike\") = \"MIKE\"]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "upper-case") ); } /** * unordered{} applied to a function item . */ @org.junit.Test public void hof035() { final XQuery query = new XQuery( "local-name-from-QName(function-name((upper-case#1, lower-case#1)[ordered{.}(\"Mike\") = \"MIKE\"]))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "upper-case") ); } /** * Heterogeneous sequence of atomics and functions on rhs of "/" . */ @org.junit.Test public void hof036() { final XQuery query = new XQuery( "(<a b=\"3\"/>/(string(@b), upper-case#1, 17))[. instance of xs:anyAtomicType]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3 17") ); } /** * instance-of tests on user-defined function, varying the argument types - all true . */ @org.junit.Test public void hof037() { final XQuery query = new XQuery( "\n" + " declare function local:f($x as xs:long, $y as xs:NCName) as element(e) { \n" + " <e x=\"{$x}\" y=\"{$y}\"/> \n" + " }; \n" + " local:f#2 instance of function(*), \n" + " local:f#2 instance of function(xs:long, xs:NCName) as element(e), \n" + " local:f#2 instance of function(xs:anyAtomicType?, xs:anyAtomicType?) as element(e), \n" + " local:f#2 instance of function(item()*, item()*) as element(e)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true false false") ); } /** * instance-of tests on user-defined function, varying the argument types - all false . */ @org.junit.Test public void hof038() { final XQuery query = new XQuery( "\n" + " declare function local:f($x as xs:long?, $y as xs:NCName?) as element(e) { \n" + " <e x=\"{$x}\" y=\"{$y}\"/> \n" + " }; \n" + " local:f#2 instance of function(xs:int?, xs:NCName?) as element(e), \n" + " local:f#2 instance of function(xs:long?) as element(e), \n" + " local:f#2 instance of function(xs:long?, xs:NCName?, item()*) as element(e), \n" + " local:f#2 instance of function(xs:long, xs:anyAtomicType?) as element(e), \n" + " local:f#2 instance of function(item()+, item()+) as element(e)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true false false false false") ); } /** * instance-of tests on user-defined function, varying the result types . */ @org.junit.Test public void hof039() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:long, $y as xs:NCName) as element(e)? { <e x=\"{$x}\" y=\"{$y}\"/> }; \n" + " \tlocal:f#2 instance of function(xs:long, xs:NCName) as element()?, \n" + " \tlocal:f#2 instance of function(xs:long, xs:NCName) as element()*, \n" + " \tlocal:f#2 instance of function(xs:long, xs:NCName) as element(e)*, \n" + " \tlocal:f#2 instance of function(xs:long, xs:NCName) as element(e, xs:anyType?)*, \n" + " \tlocal:f#2 instance of function(xs:long, xs:NCName) as element(*, xs:anyType?)?, \n" + " \tlocal:f#2 instance of function(xs:long, xs:NCName) as element(*, xs:untyped)?\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true true true true false") ); } /** * Pass a sequence of functions that require coercion in different ways . */ @org.junit.Test public void hof040() { final XQuery query = new XQuery( "\n" + " declare function local:apply($fns as (function(xs:string) as xs:string)*, $s as xs:string) as xs:string* { for $f in $fns return $f($s) }; \n" + " let $ops := (upper-case#1, lower-case#1, function($x){translate($x, 'e', 'i')}, substring-before(?, ' ')) \n" + " return string-join(local:apply($ops, 'Michael Kay'), '~')\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "MICHAEL KAY~michael kay~Michail Kay~Michael") ); } /** * Return a sequence of functions that require coercion in different ways . */ @org.junit.Test public void hof041() { final XQuery query = new XQuery( "\n" + " declare function local:ops() as (function(xs:string) as xs:string)*\n" + " \t{ (upper-case#1, lower-case#1, function($x){translate($x, 'e', 'i')}, substring-before(?, ' ')) }; \n" + " string-join(for $f in local:ops() return $f('Michael Kay'), '~')\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "MICHAEL KAY~michael kay~Michail Kay~Michael") ); } /** * Implicit atomization works for various kinds of functions . */ @org.junit.Test public void hof042() { final XQuery query = new XQuery( "\n" + " declare function local:lower-case($x as xs:string) as xs:string { concat(\"'\", fn:lower-case($x), \"'\") }; \n" + " declare function local:ops() as (function(xs:string) as xs:string)* \n" + " \t{ (upper-case#1, local:lower-case#1, function($x){translate($x, 'e', 'i')}, substring-before(?, ' ')) }; \n" + " string-join(for $f in local:ops() return $f(<a name=\"Michael Kay\"/>/@name), '~')\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "MICHAEL KAY~'michael kay'~Michail Kay~Michael") ); } /** * untypedAtomic conversion works for various kinds of functions . */ @org.junit.Test public void hof043() { final XQuery query = new XQuery( "\n" + " declare function local:round($x as xs:double) as xs:double \n" + " \t{ fn:floor($x) }; \n" + " declare function local:ops() as (function(xs:double) as xs:double)* \n" + " \t{ (abs#1, local:round#1, function($x){$x+1}, round-half-to-even(?, 2)) }; \n" + " string-join(for $f in local:ops() return string($f(xs:untypedAtomic('123.456'))), '~')\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "123.456~123~124.456~123.46") ); } /** * numeric promotion works for various kinds of functions . */ @org.junit.Test public void hof044() { final XQuery query = new XQuery( "\n" + " declare function local:round($x as xs:double) as xs:double { fn:floor($x) }; \n" + " declare function local:ops() as (function(xs:double) as xs:double)* \n" + " \t{ (abs#1, local:round#1, function($x as xs:double){$x+1}, round-half-to-even(?, 2)) }; \n" + " string-join(for $f in local:ops() return string(round-half-to-even($f(xs:decimal('123.456')), 4)), '~')\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "123.456~123~124.456~123.46") ); } /** * partial-apply supplying a function parameter . */ @org.junit.Test public void hof045() { final XQuery query = new XQuery( "\n" + " declare function local:round($x as xs:double, $algorithm as (function(xs:double) as xs:double)) as xs:double { $algorithm($x) }; \n" + " declare variable $roundToCeiling := local:round(?, ceiling#1); $roundToCeiling(12.4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("13") ); } /** * Return an inline function that uses inner and outer local variables. */ @org.junit.Test public void hof046() { final XQuery query = new XQuery( "\n" + " declare function local:splitter($x as xs:string) as (function() as xs:string*)* { \n" + " for $sep in ('\\s', ',', '!') \n" + " return function() { for $i in tokenize($x, $sep) return upper-case($i) } \n" + " }; \n" + " <out>{ \n" + " for $f as function(*) in local:splitter(\"How nice! Thank you, I enjoyed that.\") \n" + " return <tokens>{ for $t in $f() \n" + " return <t>{$t}</t> \n" + " }</tokens> \n" + " }</out>\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("<out><tokens><t>HOW</t><t>NICE!</t><t>THANK</t><t>YOU,</t><t>I</t><t>ENJOYED</t><t>THAT.</t></tokens><tokens><t>HOW NICE! THANK YOU</t><t> I ENJOYED THAT.</t></tokens><tokens><t>HOW NICE</t><t> THANK YOU, I ENJOYED THAT.</t></tokens></out>", false) ); } /** * Nested inline functions referencing grandfather local variables . */ @org.junit.Test public void hof047() { final XQuery query = new XQuery( "\n" + " declare function local:splitter($x as xs:string) as (function() as xs:string*)* { \n" + " for $sep in ('\\s', ',', '!') return function() { \n" + " for $i in tokenize($x, $sep) return \n" + " let $f := function(){ concat($sep, ':', upper-case($i)) } \n" + " return $f() } \n" + " }; \n" + " <out>{ \n" + " for $f as function(*) in local:splitter(\"How nice! Thank you, I enjoyed that.\") \n" + " return <tokens>{ for $t in $f() \n" + " return <t>{$t}</t> }</tokens> \n" + " }</out>\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("<out><tokens><t>\\s:HOW</t><t>\\s:NICE!</t><t>\\s:THANK</t><t>\\s:YOU,</t><t>\\s:I</t><t>\\s:ENJOYED</t><t>\\s:THAT.</t></tokens><tokens><t>,:HOW NICE! THANK YOU</t><t>,: I ENJOYED THAT.</t></tokens><tokens><t>!:HOW NICE</t><t>!: THANK YOU, I ENJOYED THAT.</t></tokens></out>", false) ); } /** * Forwards reference to a literal function item . */ @org.junit.Test public void hof048() { final XQuery query = new XQuery( "\n" + " declare function local:do() as xs:integer { (local:f#1)(5) }; \n" + " declare function local:f($x as xs:integer) as xs:integer { $x + 1 }; \n" + " local:do()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("6") ); } /** * true#0 and false# as literal function items . */ @org.junit.Test public void hof049() { final XQuery query = new XQuery( "\n" + " declare function local:tf($i as xs:integer) as function () as xs:boolean { \n" + " if ($i) then true#0 else false#0 \n" + " }; \n" + " <out>{(local:tf(0)(), local:tf(1)())}</out>\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("<out>false true</out>", false) ); } /** * Partial application of a literal function item . */ @org.junit.Test public void hof050() { final XQuery query = new XQuery( "let $f := fn:substring-before#2(?, '-') return <out>{$f('the-end-of-the-world')}</out>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("<out>the</out>", false) ); } /** * Partial application of an inline function item . */ @org.junit.Test public void hof051() { final XQuery query = new XQuery( "\n" + " let $f := function($a as xs:string, $b as xs:string) { \n" + " starts-with($a, $b) and ends-with($a, $b)}(?, 'a') \n" + " return <out>{$f('abracadabra')}</out>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("<out>true</out>", false) ); } /** * Repeated partial application of a function . */ @org.junit.Test public void hof052() { final XQuery query = new XQuery( "let $f := fn:concat#3(?, '*', ?) let $g := $f('[', ?) return <out>{$g(']')}</out>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("<out>[*]</out>", false) ); } /** * instance-of tests on user-defined function, varying the result types . */ @org.junit.Test public void hof053() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:long, $y as xs:NCName) as element(e, xs:anyAtomicType) { <e x=\"{$x}\" y=\"{$y}\"/> }; \n" + " \tlocal:f#2 instance of function(xs:long, xs:NCName) as element(), \n" + " \tlocal:f#2 instance of function(xs:long, xs:NCName) as element()+, \n" + " \tlocal:f#2 instance of function(xs:long, xs:NCName) as element()?, \n" + " \tlocal:f#2 instance of function(xs:long, xs:NCName) as element()*, \n" + " \tlocal:f#2 instance of function(xs:long, xs:NCName) as element(e)*, \n" + " \tlocal:f#2 instance of function(xs:long, xs:NCName) as element(e, xs:anyType?)*, \n" + " \tlocal:f#2 instance of function(xs:long, xs:NCName) as element(*, xs:anyType?)?, \n" + " \tlocal:f#2 instance of function(xs:long, xs:NCName) as element(e, xs:anyType)*, \n" + " \tlocal:f#2 instance of function(xs:long, xs:NCName) as element(*, xs:anyType)?, \n" + " \tlocal:f#2 instance of function(xs:long, xs:NCName) as element(*, xs:untyped)?\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true true true true true true true true false") ); } /** * inline function literal, unknown user-defined function . */ @org.junit.Test public void hof901() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) as xs:integer { $x + 1 }; \n" + " \tlet $f := local:g#1 return $f(2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * inline function literal, unknown user-defined function . */ @org.junit.Test public void hof902() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) as xs:integer { $x + 1 }; \n" + " \tlet $f := local:f#3 return $f(2)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * inline function literal, unknown function . */ @org.junit.Test public void hof903() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) as xs:integer { $x + 1 }; \n" + " \tlet $f := xs:date#2 return $f('2008-03-01')\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * inline function literal, unknown function . */ @org.junit.Test public void hof904() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) as xs:integer { $x + 1 }; \n" + " \tlet $f := concat#1 return $f('2008-03-01')\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * apply string() to a function item . */ @org.junit.Test public void hof905() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) as xs:integer { $x + 1 }; \n" + " \tstring(local:f#1)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOTY0014") ); } /** * apply data() to a function item . */ @org.junit.Test public void hof906() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) as xs:integer { $x + 1 }; \n" + " \texists(data(local:f#1))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOTY0013") ); } /** * apply deep-equal() to a function item . */ @org.junit.Test public void hof907() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) as xs:integer { $x + 1 }; \n" + " \tdeep-equal((1,2,3,4,local:f#1), (1,2,3,4,local:f#1))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOTY0015") ); } /** * atomize a function item implicitly . */ @org.junit.Test public void hof908() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) as xs:integer { $x + 1 }; \n" + " \tlocal:f#1 eq 3\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOTY0013") ); } /** * atomize a function item implicitly . */ @org.junit.Test public void hof909() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f($x as xs:integer) as xs:integer { $x + 1 }; \n" + " \tnumber(local:f#1)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOTY0013") ); } /** * In SequenceType syntax, Result type required if argument type given . */ @org.junit.Test public void hof910() { final XQuery query = new XQuery( "\n" + " declare function local:f($x as xs:integer) as xs:integer {\n" + " $x + 1\n" + " };\n" + " let $f as function(xs:integer) := local:f#1\n" + " return $f(3)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Heterogeneous sequence on rhs of "/" . */ @org.junit.Test public void hof911() { final XQuery query = new XQuery( "<a b=\"3\"/>/(@b, upper-case#1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0018") ); } /** * Pass a sequence of functions that cannot be coerced to the required type . */ @org.junit.Test public void hof912() { final XQuery query = new XQuery( "\n" + " declare function local:apply($fns as (function(xs:string) as xs:string)*, $s as xs:string) as xs:string* \n" + " { for $f in $fns return $f($s) };\n" + " let $ops := (upper-case#1, lower-case#1, function($x){translate($x, 'e', 'i')}, \n" + " substring-before(?, ' ', ?)) \n" + " return string-join(local:apply($ops, 'Michael Kay'), '~')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Pass a sequence of functions that cannot be coerced to the required type . */ @org.junit.Test public void hof913() { final XQuery query = new XQuery( "\n" + " declare function local:apply($fns as (function(xs:string) as xs:string)*, $s as xs:string) as xs:string* \n" + " { for $f in $fns return $f($s) }; \n" + " let $ops := (upper-case#1, lower-case#1, function($x){translate($x, 'e', 'i')}, \n" + " string-length#1) \n" + " return string-join(local:apply($ops, 'Michael Kay'), '~')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Pass a sequence of functions that cannot be coerced to the required type . */ @org.junit.Test public void hof914() { final XQuery query = new XQuery( "\n" + " declare function local:apply($fns as (function(xs:string) as xs:string)*, $s as xs:string) as xs:string* \n" + " { for $f in $fns return $f($s) }; \n" + " let $ops := (upper-case#1, lower-case#1, function($x as xs:double){string($x)}) \n" + " return string-join(local:apply($ops, 'Michael Kay'), '~')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * partial-apply, argument number out of range . */ @org.junit.Test public void hof915() { final XQuery query = new XQuery( "let $ops := substring-before('abc', ' ', (), ?) return $ops('Michael Kay')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * partial-apply, argument number out of range . */ @org.junit.Test public void hof916() { final XQuery query = new XQuery( "let $ops := substring-before(?, ?) return $ops('Michael Kay')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * partial-apply, argument value invalid for target function . */ @org.junit.Test public void hof917() { final XQuery query = new XQuery( "let $ops := substring-before(?, 2) return $ops('Michael Kay')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * partial-apply supplying an incorrect function parameter . */ @org.junit.Test public void hof918() { final XQuery query = new XQuery( "\n" + " declare function local:round($x as xs:double, $algorithm as (function(xs:double) as xs:double)) as xs:double \n" + " { $algorithm($x) }; \n" + " declare variable $roundToCeiling := local:round(?, upper-case#1); \n" + " $roundToCeiling(12.4)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Was hof-044: test that numeric promotion works for various kinds of functions. But there's * an error - the function item function($x as xs:float){$x+1} doesn't satisfy the required type * (function(xs:double) as xs:double) because it doesn't accept a double as an argument. * . */ @org.junit.Test public void hof919() { final XQuery query = new XQuery( "\n" + " declare function local:round($x as xs:double) as xs:double { fn:floor($x) }; \n" + " declare function local:ops() as (function(xs:double) as xs:double)* \n" + " \t{ (abs#1, local:round#1, function($x as xs:float){$x+1}, round-half-to-even(?, 2)) }; \n" + " string-join(for $f in local:ops() return string(round-half-to-even($f(xs:decimal('123.456')), 4)), '~')\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * An inline function expression creates a function. */ @org.junit.Test public void inlineFunction1() { final XQuery query = new XQuery( "function() { 5 } instance of function(*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The parameters of a function declaration are considered to be variables whose scope is the function body.. */ @org.junit.Test public void inlineFunction10() { final XQuery query = new XQuery( "function($a) { \"lala\", $a }, $a", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * The parameters of a function declaration are considered to be variables whose scope is the function body.. */ @org.junit.Test public void inlineFunction11() { final XQuery query = new XQuery( "let $a := \"monkey\" return function($a) { \"lala\", $a }(\"gibbon\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"lala\", \"gibbon\"") ); } /** * The parameters of a function declaration are considered to be variables whose scope is the function body.. */ @org.junit.Test public void inlineFunction11a() { final XQuery query = new XQuery( "function($a) { let $a := \"monkey\" return (\"lala\", $a) }(\"gibbon\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"lala\", \"monkey\"") ); } /** * The parameters of a function declaration are considered to be variables whose scope is the function body.. */ @org.junit.Test public void inlineFunction12() { final XQuery query = new XQuery( "$a, function($a) { \"lala\", $a }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * It is a static error [err:XQST0039] for a function declaration to have more than one parameter with the same name.. */ @org.junit.Test public void inlineFunction12a() { final XQuery query = new XQuery( "function($a, $a) { \"lala\", $a }(\"gibbon\", \"monkey\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0039") ); } /** * It is a static error [err:XQST0039] for a function declaration to have more than one parameter with the same name.. */ @org.junit.Test public void inlineFunction13() { final XQuery query = new XQuery( "function($local:foo, $local:bar, $local:foo) { \"lala\", $local:foo, $local:bar }(\"gibbon\", \"monkey\", \"ape\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0039") ); } /** * It is a static error [err:XQST0039] for a function declaration to have more than one parameter with the same name.. */ @org.junit.Test public void inlineFunction14() { final XQuery query = new XQuery( "function($local:foo, $local:bar, $fn:foo) { \"lala\", $local:foo, $local:bar }(\"gibbon\", \"monkey\", \"ape\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"lala\", \"gibbon\", \"monkey\"") ); } /** * It is a static error [err:XQST0039] for a function declaration to have more than one parameter with the same name.. */ @org.junit.Test public void inlineFunction15() { final XQuery query = new XQuery( "function($Q{http://local/}foo, $Q{http://local/}bar, $Q{http://local/}foo) { \n" + " \"lala\", $Q{http://local/}foo, $Q{http://local/}bar }(\"gibbon\", \"monkey\", \"ape\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0039") ); } /** * It is a static error [err:XQST0039] for a function declaration to have more than one parameter with the same name.. */ @org.junit.Test public void inlineFunction16() { final XQuery query = new XQuery( "function($Q{http://local/}foo, $Q{http://local/}bar, $fn:foo) { \n" + " \"lala\", $Q{http://local/}foo, $Q{http://local/}bar }(\"gibbon\", \"monkey\", \"ape\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"lala\", \"gibbon\", \"monkey\"") ); } /** * that represents an anonymous function. */ @org.junit.Test public void inlineFunction2() { final XQuery query = new XQuery( "function-name(function() { 5 })", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertCount(0) ); } /** * An inline function specifies the names and SequenceTypes of the parameters to the function, the SequenceType of the result, and the body of the function.. */ @org.junit.Test public void inlineFunction3() { final XQuery query = new XQuery( "function() as xs:integer { 5 }()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** * An inline function specifies the names and SequenceTypes of the parameters to the function, the SequenceType of the result, and the body of the function.. */ @org.junit.Test public void inlineFunction4() { final XQuery query = new XQuery( "function($a as xs:integer) as xs:integer { $a + 5 }(3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("8") ); } /** * An inline function specifies the names and SequenceTypes of the parameters to the function, the SequenceType of the result, and the body of the function.. */ @org.junit.Test public void inlineFunction5() { final XQuery query = new XQuery( "function($a as xs:integer, $b as xs:double) as xs:double { $a * $b + 5 }(3, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("11") ); } /** * If a function parameter is declared using a name but no type, its default type is item()*.. */ @org.junit.Test public void inlineFunction6() { final XQuery query = new XQuery( "function($a, $b as xs:double) as xs:double { $a * $b + 5 } instance of function(item()*, xs:double) as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * If a function parameter is declared using a name but no type, its default type is item()*.. */ @org.junit.Test public void inlineFunction7() { final XQuery query = new XQuery( "function($a as node()+, $b) as xs:double { $a * $b + 5 } instance of function(node(), item()*) as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * If the result type is omitted from a function declaration, its default result type is item()*.. */ @org.junit.Test public void inlineFunction8() { final XQuery query = new XQuery( "function($a as node()+) { $a + 5 } instance of function(node()) as item()*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * If the result type is omitted from a function declaration, its default result type is item()*.. */ @org.junit.Test public void inlineFunction9() { final XQuery query = new XQuery( "function() { true() } instance of function() as item()*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void xqhof1() { final XQuery query = new XQuery( "\n" + "declare namespace map = \"http://snelson.org.uk/functions/map\";\n" + "\n" + "declare function map:key($pair as function() as item()+) as item()\n" + "{\n" + " $pair()[1]\n" + "};\n" + "\n" + "declare function map:value($pair as function() as item()+) as item()*\n" + "{\n" + " subsequence($pair(), 2)\n" + "};\n" + "\n" + "declare function map:contains($map as (function() as item()+)*, $key as item())\n" + " as xs:boolean\n" + "{\n" + " map:process($map, $key, function($a) { true() }, false(),\n" + " function($a) { () })\n" + "};\n" + "\n" + "declare function map:get($map as (function() as item()+)*, $key as item())\n" + " as item()*\n" + "{\n" + " map:process($map, $key, map:value#1, (), function($a) { () })\n" + "};\n" + "\n" + "declare function map:process(\n" + " $map as (function() as item()+)*,\n" + " $key as item(),\n" + " $found as function(function() as item()+) as item()*,\n" + " $notfound as item()*,\n" + " $unused as function((function() as item()+)*) as item()*\n" + ") as item()*\n" + "{\n" + " if(empty($map)) then $notfound\n" + " else\n" + "\n" + " let $length := count($map)\n" + " let $middle := $length idiv 2 + 1\n" + " let $pair := $map[$middle]\n" + " let $pair_key := $pair()[1]\n" + " return\n" + " if($pair_key eq $key) then (\n" + " $unused(subsequence($map, 1, $middle - 1)),\n" + " $found($pair),\n" + " $unused(subsequence($map, $middle + 1))\n" + " )\n" + " else if($pair_key gt $key) then (\n" + " map:process(subsequence($map, 1, $middle - 1), $key,\n" + " $found, $notfound, $unused),\n" + " $unused(subsequence($map, $middle))\n" + " )\n" + " else (\n" + " $unused(subsequence($map, 1, $middle)),\n" + " map:process(subsequence($map, $middle + 1), $key,\n" + " $found, $notfound, $unused)\n" + " )\n" + "};\n" + "\n" + "declare function map:pair($key as item(), $value as item()*)\n" + " as function() as item()+\n" + "{\n" + " function() { $key, $value }\n" + "};\n" + "\n" + "declare function map:put(\n" + " $map as (function() as item()+)*,\n" + " $key as item(),\n" + " $value as item()*\n" + ") as (function() as item()+)+\n" + "{\n" + " let $pair := map:pair($key, $value)\n" + " return\n" + " map:process($map, $key, function($a) { $pair }, $pair,\n" + " function($a) { $a })\n" + "};\n" + "\n" + "string-join(let $map := map:put(map:put(map:put(map:put(map:put(map:put((),\n" + " \"a\", \"aardvark\"),\n" + " \"z\", \"zebra\"),\n" + " \"e\", (\"elephant\", \"eagle\")),\n" + " \"o\", \"osterich\"),\n" + " \"t\", \"terrapin\"),\n" + " \"a\", \"antelope\")\n" + "return (\n" + " map:get($map, \"o\"),\n" + "\n" + " for $m in $map\n" + " return concat(\"key: \", map:key($m), \", value: (\",\n" + " string-join(map:value($m), \", \"), \")\"))\n" + ", \"\n" + "\")\n" + "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"osterich\nkey: a, value: (antelope)\nkey: e, value: (elephant, eagle)\nkey: o, value: (osterich)\nkey: t, value: (terrapin)\nkey: z, value: (zebra)\"") ); } /** . */ @org.junit.Test public void xqhof10() { final XQuery query = new XQuery( "\n" + " for $f in (concat(\"one \", ?, \" three\"), substring-before(\"one two three\", ?), matches(?, \"t.*o\"), xs:NCName(?))\n" + " return $f(\"two\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"one two three\", \"one \", true(), xs:NCName(\"two\")") ); } /** . */ @org.junit.Test public void xqhof11() { final XQuery query = new XQuery( "()(\"two\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** . */ @org.junit.Test public void xqhof12() { final XQuery query = new XQuery( "(concat(\"one \", ?, \" three\"), substring-before(\"one two three\", ?), matches(?, \"t.*o\"), xs:NCName(?))(\"two\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** . */ @org.junit.Test public void xqhof13() { final XQuery query = new XQuery( "\n" + " let $f := function($a) { node-name(.), $a }\n" + " return <a/>/$f(5)\n" + " \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** . */ @org.junit.Test public void xqhof14() { final XQuery query = new XQuery( "\n" + " let $f := name#0\n" + " return <a/>/$f()\n" + " \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Test closure over context. */ @org.junit.Test public void xqhof15() { final XQuery query = new XQuery( "\n" + " let $f := <b/>/name#0\n" + " return <a/>/$f()\n" + " \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"b\"") ); } /** * Test closure over context. */ @org.junit.Test public void xqhof16() { final XQuery query = new XQuery( "\n" + " declare base-uri \"main\";\n" + " import module namespace lib = \"lib\";\n" + " \n" + " lib:getfun()(),\n" + " fn:static-base-uri#0(),\n" + " fn:static-base-uri()\n" + " ", ctx); try { query.addModule("lib", file("misc/HigherOrderFunctions/module-xqhof16.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertQuery("fn:ends-with($result[1], \"lib\")") && assertQuery("fn:ends-with($result[2], \"main\")") && assertQuery("fn:ends-with($result[3], \"main\")") ) ); } /** * Test closure over context. */ @org.junit.Test public void xqhof17() { final XQuery query = new XQuery( "\n" + " import module namespace lib = \"lib\";\n" + " \n" + " <main/>/lib:getfun2()(),\n" + " <main/>/name#0(),\n" + " <main/>/name()\n" + " ", ctx); try { query.addModule("lib", file("misc/HigherOrderFunctions/module-xqhof16.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"lib\", \"main\", \"main\"") ); } /** * Test closure over context. */ @org.junit.Test public void xqhof18() { final XQuery query = new XQuery( "\n" + " declare base-uri \"main\";\n" + " import module namespace lib = \"lib\";\n" + " \n" + " lib:getfun3()(xs:QName(\"fn:static-base-uri\"),0)(),\n" + " function-lookup#2(xs:QName(\"fn:static-base-uri\"),0)(),\n" + " function-lookup(xs:QName(\"fn:static-base-uri\"),0)()\n" + " ", ctx); try { query.addModule("lib", file("misc/HigherOrderFunctions/module-xqhof16.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertQuery("fn:ends-with($result[1], \"lib\")") && assertQuery("fn:ends-with($result[2], \"main\")") && assertQuery("fn:ends-with($result[3], \"main\")") ) ); } /** * Test closure over context. */ @org.junit.Test public void xqhof19() { final XQuery query = new XQuery( "\n" + " import module namespace lib = \"lib\";\n" + " \n" + " <main/>/lib:getfun3()(xs:QName(\"fn:name\"),0)(),\n" + " <main/>/function-lookup#2(xs:QName(\"fn:name\"),0)(),\n" + " <main/>/function-lookup(xs:QName(\"fn:name\"),0)()\n" + " ", ctx); try { query.addModule("lib", file("misc/HigherOrderFunctions/module-xqhof16.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"lib\", \"main\", \"main\"") ); } /** . */ @org.junit.Test public void xqhof2() { final XQuery query = new XQuery( "\n" + " import module namespace func = \"http://snelson.org.uk/functions/functional\";\n" + " \n" + " let $f := func:curry(concat#5)\n" + " return $f(\"foo\")(\" bar\")(\" baz\")(\" what's\")(\" next?\")\n" + " ", ctx); try { query.addModule("http://snelson.org.uk/functions/functional", file("misc/HigherOrderFunctions/functional.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"foo bar baz what's next?\"") ); } /** . */ @org.junit.Test public void xqhof3() { final XQuery query = new XQuery( "\n" + "import module namespace func = \"http://snelson.org.uk/functions/functional\";\n" + "\n" + "declare function local:fib2_aux($result as xs:integer, $next as xs:integer, $n) as xs:integer*\n" + "{\n" + " if($n eq 0) then () else (\n" + " $result, local:fib2_aux($next, $next + $result, $n - 1))\n" + "};\n" + "\n" + "declare function local:fib2($n) as xs:integer*\n" + "{\n" + " local:fib2_aux(0, 1, $n)\n" + "};\n" + "\n" + "string-join(\n" + "for $a in subsequence(\n" + "\n" + "let $interleave := func:curry(map-pairs#3)(function($a, $b) { $a, $b })\n" + "let $enumerate := $interleave(0 to 49)\n" + "return\n" + "$enumerate(local:fib2(50))\n" + "\n" + ", 1, 100)\n" + "return string($a)\n" + ", \"\n" + "\")\n" + " ", ctx); try { query.addModule("http://snelson.org.uk/functions/functional", file("misc/HigherOrderFunctions/functional.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"0\n0\n1\n1\n2\n1\n3\n2\n4\n3\n5\n5\n6\n8\n7\n13\n8\n21\n9\n34\n10\n55\n11\n89\n12\n144\n13\n233\n14\n377\n15\n610\n16\n987\n17\n1597\n18\n2584\n19\n4181\n20\n6765\n21\n10946\n22\n17711\n23\n28657\n24\n46368\n25\n75025\n26\n121393\n27\n196418\n28\n317811\n29\n514229\n30\n832040\n31\n1346269\n32\n2178309\n33\n3524578\n34\n5702887\n35\n9227465\n36\n14930352\n37\n24157817\n38\n39088169\n39\n63245986\n40\n102334155\n41\n165580141\n42\n267914296\n43\n433494437\n44\n701408733\n45\n1134903170\n46\n1836311903\n47\n2971215073\n48\n4807526976\n49\n7778742049\"") ); } /** . */ @org.junit.Test public void xqhof4() { final XQuery query = new XQuery( "\n" + " declare function local:hof($s, $f as function(*)) {\n" + " $f($s[1], $s[2])\n" + " };\n" + " \n" + " local:hof(('1', '2'), concat#2)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"12\"") ); } /** . */ @org.junit.Test public void xqhof5() { final XQuery query = new XQuery( "\n" + " let $a := string-join(?, \"\")\n" + " return $a((\"foo\", \"bar\", \"baz\"))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"foobarbaz\"") ); } /** . */ @org.junit.Test public void xqhof6() { final XQuery query = new XQuery( "\n" + " declare function local:curry($f as function(item()*, item()*) as item()*) as function(item()*) as function(item()*) as item()*\n" + " {\n" + " function($a) { $f($a, ?) }\n" + " };\n" + " \n" + " local:curry(substring-after#2)(\"foobar\")(\"foo\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"bar\"") ); } /** . */ @org.junit.Test public void xqhof7() { final XQuery query = new XQuery( "concat#3(\"one\", \"two\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** . */ @org.junit.Test public void xqhof8() { final XQuery query = new XQuery( "concat#4(\"one\", ?, \"three\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** . */ @org.junit.Test public void xqhof9() { final XQuery query = new XQuery( "concat#2(\"one\", ?, \"three\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/misc/MiscSerialization.java��������������0000664�0000000�0000000�00000017006�12224530032�0030734�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.misc; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the Serialization. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class MiscSerialization extends QT3TestSet { /** * A standalone attribute node cannot be serialized. . */ @org.junit.Test public void k2Serialization1() { final XQuery query = new XQuery( "attribute name {<anElement/>}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialError("SENR0001") ); } /** * Use characters in the range of #x7F through #x9F in a text node and ensure they are escaped properly. #x7F - #x9F . */ @org.junit.Test public void k2Serialization10() { final XQuery query = new XQuery( "<a>{codepoints-to-string(127 to 159)}</a>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( serializationMatches("€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ", "i") || serializationMatches("€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ", "") ) ); } /** * Ensure a new-line character is properly escaped. . */ @org.junit.Test public void k2Serialization11() { final XQuery query = new XQuery( "\"a aa a \"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( ( serializationMatches("a aa ", "i") || serializationMatches("a aa ", "") ) && serializationMatches("\\r?\\n.*\\r?\\n", "") ) ); } /** * Write out elements and attributes that have the same names except for their prefixes. * (Note by MHK: this is not really a serialization test.) * . */ @org.junit.Test public void k2Serialization12() { final XQuery query = new XQuery( "<e> <a:a xmlns:a=\"http://www.example.com/A\" a:a=\"value\"/> <b:a xmlns:b=\"http://www.example.com/A\" b:a=\"value\"/> </e>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("<e><a:a xmlns:a=\"http://www.example.com/A\" a:a=\"value\"/><b:a xmlns:b=\"http://www.example.com/A\" b:a=\"value\"/></e>", false) ); } /** * An attribute node appearing after an element cannot be serialized. . */ @org.junit.Test public void k2Serialization2() { final XQuery query = new XQuery( "<e/>, attribute name {<anElement/>}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialError("SENR0001") ); } /** * An attribute node appearing before an element cannot be serialized. . */ @org.junit.Test public void k2Serialization3() { final XQuery query = new XQuery( "attribute name {<anElement/>}, <e/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialError("SENR0001") ); } /** * An attribute node appearing between two element nodes cannot be serialized. . */ @org.junit.Test public void k2Serialization4() { final XQuery query = new XQuery( "<e/>, attribute name {<anElement/>}, <e/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialError("SENR0001") ); } /** * Ensure that CR, NEL and LINE SEPARATOR in text nodes are escaped when serialized. . */ @org.junit.Test public void k2Serialization5() { final XQuery query = new XQuery( "<a> …
</a>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( serializationMatches(" …
", "i") || serializationMatches(" …
", "") ) ); } /** * Ensure that CR, NL, TAB, NEL and LINE SEPARATOR in attributes are escaped when serialized. . */ @org.junit.Test public void k2Serialization6() { final XQuery query = new XQuery( "<a attr=\" …
\"/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( serializationMatches(" …
", "i") || serializationMatches(" …
", "") ) ); } /** * Use characters in a text node that in XML 1.0 are invalid, and in XML 1.1 must be escaped. #x1 - #x1F . */ @org.junit.Test public void k2Serialization7a() { final XQuery query = new XQuery( "<a>{codepoints-to-string(1 to 31)}</a>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FOCH0001") ) ); } /** * Use characters in an attribute node that in XML 1.0 are invalid, and in XML 1.1 must be escaped. #x1 - #x1F . */ @org.junit.Test public void k2Serialization8a() { final XQuery query = new XQuery( "<a attr=\"{codepoints-to-string(1 to 31)}\"></a>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCH0001") ); } /** * Use characters in the range of #x7F through #x9F in an attribute node and ensure they are escaped properly. #x7F - #x9F . */ @org.junit.Test public void k2Serialization9() { final XQuery query = new XQuery( "<a attr=\"{codepoints-to-string(127 to 159)}\"/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( serializationMatches("€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ", "i") || serializationMatches("€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ", "") ) ); } } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/misc/MiscStaticContext.java��������������0000664�0000000�0000000�00000001437�12224530032�0030714�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.misc; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the StaticContext. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class MiscStaticContext extends QT3TestSet { /** * Evaluate error condition XPST0001 . */ @org.junit.Test public void staticContext1() { final XQuery query = new XQuery( "declare namespace test = 'http://www.example.com'; \n" + " <a/> instance of element(*, test:unknownType)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/misc/MiscSurrogates.java�����������������0000664�0000000�0000000�00000017657�12224530032�0030271�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.misc; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the surrogates operator. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class MiscSurrogates extends QT3TestSet { /** * string-length() when non-BMP characters are present . */ @org.junit.Test public void surrogates01() { final XQuery query = new XQuery( "string-length(\"abc𝅖def\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("7") ); } /** * substring() when non-BMP characters are present . */ @org.junit.Test public void surrogates02() { final XQuery query = new XQuery( "substring(\"abc𝅖def\", 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "def") ); } /** * substring() when non-BMP characters are present . */ @org.junit.Test public void surrogates03() { final XQuery query = new XQuery( "substring(\"abc𝅖def\", 4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ð…–def") ); } /** * translate() when non-BMP characters are present . */ @org.junit.Test public void surrogates04() { final XQuery query = new XQuery( "translate(\"abc𝅖def\", \"𝅖\", \"#\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc#def") ); } /** * translate() when non-BMP characters are present . */ @org.junit.Test public void surrogates05() { final XQuery query = new XQuery( "translate(\"abc𝅖def\", \"𝅖de\", \"#DE\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc#DEf") ); } /** * translate() when non-BMP characters are present . */ @org.junit.Test public void surrogates06() { final XQuery query = new XQuery( "translate(\"abc𝅖def\", \"def\", \"𝅖EF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcð…–ð…–EF") ); } /** * string-to-codepoints() when non-BMP characters are present . */ @org.junit.Test public void surrogates07() { final XQuery query = new XQuery( "string-to-codepoints(\"abc𝅖def\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "97 98 99 119126 100 101 102") ); } /** * codepoints-to-string() when non-BMP characters are present . */ @org.junit.Test public void surrogates08() { final XQuery query = new XQuery( "codepoints-to-string((97, 98, 99, 119126, 100, 101, 102))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcð…–def") ); } /** * codepoints-to-string() when non-BMP characters are present . */ @org.junit.Test public void surrogates08a() { final XQuery query = new XQuery( "codepoints-to-string((97, 98, 99, 119126, 100, 101, 102))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcð…–def") ); } /** * substring-before() when non-BMP characters are present . */ @org.junit.Test public void surrogates09() { final XQuery query = new XQuery( "substring-before(\"abc𝅖def\", \"𝅖\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc") ); } /** * substring-before() when non-BMP characters are present . */ @org.junit.Test public void surrogates10() { final XQuery query = new XQuery( "substring-before(\"abc𝅖def\", \"f\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcð…–de") ); } /** * substring-after() when non-BMP characters are present . */ @org.junit.Test public void surrogates11() { final XQuery query = new XQuery( "substring-after(\"abc𝅖def\", \"𝅖\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "def") ); } /** * matches() when non-BMP characters are present . */ @org.junit.Test public void surrogates12() { final XQuery query = new XQuery( "matches(\"abc𝅗def\", \"abc[𝅖-𝅘]def\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * matches() when non-BMP characters are present . */ @org.junit.Test public void surrogates13() { final XQuery query = new XQuery( "matches(\"abc𝅗def\", \"abc.def\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * replace() when non-BMP characters are present . */ @org.junit.Test public void surrogates14() { final XQuery query = new XQuery( "replace(\"abc𝅚def\", \"[𝅐-𝅘𝅥]\", \"𝅘𝅥\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcð…Ÿdef") ); } /** * replace() when non-BMP characters are present . */ @org.junit.Test public void surrogates15() { final XQuery query = new XQuery( "replace(\"abc𝅗def\", \"[^a-f]\", \"###\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc###def") ); } /** * Leading surrogate = edge value of 56319. Test case from Gunther Rademacher. */ @org.junit.Test public void surrogates16() { final XQuery query = new XQuery( "string-to-codepoints(substring(\"􏰀A\", 2, 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("65") ); } } ���������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/misc/MiscXMLEdition.java�����������������0000664�0000000�0000000�00000015510�12224530032�0030071�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.misc; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the XMLEdition. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class MiscXMLEdition extends QT3TestSet { /** * CDATA sections, comments and PIs may occur in ANY content. in XML 1.0 3th edition and older . */ @org.junit.Test public void xML103edMixedContent() { final XQuery query = new XQuery( "<foo> a <![CDATA[cdata section]]> in mixed content. a <!-- comment --> in mixed content. a <?processing instruction?> in mixed content. </foo>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("<foo> a cdata section in mixed content. a <!-- comment --> in mixed content. a <?processing instruction?> in mixed content. </foo>", false) ); } /** * The character #x037F is excluded from the start of a Name in XML 1.0 4th edition and older . */ @org.junit.Test public void xML104edExcludedChar1() { final XQuery query = new XQuery( "xquery version \"1.0\" encoding \"utf-8\"; <\u037fnode/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * The character #x037F is allowed at the start of a Name in XML 1.0 5th edition and later . */ @org.junit.Test public void xML104edExcludedChar1New() { final XQuery query = new XQuery( "xquery version \"1.0\" encoding \"utf-8\"; <\u037fnode/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("<\u037fnode/>", false) || serializationMatches("<\u037fnode/>", "") ) ); } /** * The character #x0100 is excluded from the start of a Name in XML 1.0 4th edition and older. * Note: the query is in a separate file because it cannot be represented in an XML document.. */ @org.junit.Test public void xML104edExcludedChar2() { final XQuery query = new XQuery( queryFile( file( "misc/XMLEdition/XML10-4ed-Excluded-char-2.xq" ) ), ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Written by: Tim Kraska Contains a DEL, legal in XML 1.0, illegal in XML 1.1 . */ @org.junit.Test public void xML105edIncludedChar1() { final XQuery query = new XQuery( "<foo>\u007f</foo>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("<foo></foo>", false) ); } /** * Written by: Tim Kraska Has a "long s" in a name, legal in XML 1.1, illegal in XML 1.0 ed 4 and earlier. */ @org.junit.Test public void xML111edIncludedChar1() { final XQuery query = new XQuery( "<eggÅ¿/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Written by: Tim Kraska Has a "long s" in a name, legal in XML 1.1, illegal in XML 1.0 ed 4 and earlier. */ @org.junit.Test public void xML111edIncludedChar1New() { final XQuery query = new XQuery( "<eggÅ¿/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("<eggÅ¿/>", false) || serializationMatches("<eggÅ¿/>", "") ) ); } /** * Normalization of line endings in XQuery. */ @org.junit.Test public void lineEndingQ001() { final XQuery query = new XQuery( "deep-equal(string-to-codepoints('\n" + "'), (10))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Normalization of line endings in XQuery. */ @org.junit.Test public void lineEndingQ002() { final XQuery query = new XQuery( "deep-equal(string-to-codepoints('\r\n" + "'), (10))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Normalization of line endings in XQuery. */ @org.junit.Test public void lineEndingQ003() { final XQuery query = new XQuery( "deep-equal(string-to-codepoints('\r \r\n" + " \n" + "\r'), (10, 32, 10, 32, 10, 10))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Normalization of line endings in XQuery with XML 1.0. */ @org.junit.Test public void lineEndingQ007() { final XQuery query = new XQuery( "deep-equal(string-to-codepoints('\r\u0085'), (10, 133))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Normalization of line endings in XQuery with XML 1.1. */ @org.junit.Test public void lineEndingQ008() { final XQuery query = new XQuery( "deep-equal(string-to-codepoints(' \u0085 '), (32, 133, 32))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Normalization of line endings in XQuery with XML 1.1. */ @org.junit.Test public void lineEndingQ009() { final XQuery query = new XQuery( "deep-equal(string-to-codepoints(' \u2028 '), (32, 8232, 32))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/��������������������������������������0000775�0000000�0000000�00000000000�12224530032�0024117�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpAddDayTimeDurationToDate.java�������0000664�0000000�0000000�00000056427�12224530032�0032053�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the add-dayTimeDuration-to-date() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpAddDayTimeDurationToDate extends QT3TestSet { /** * * ******************************************************* * Test: K-DateAddDTD-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple testing involving operator '+' between xs:date and xs:dayTimeDuration. * ******************************************************* * . */ @org.junit.Test public void kDateAddDTD1() { final XQuery query = new XQuery( "xs:date(\"1999-08-12\") + xs:dayTimeDuration(\"P23DT09H32M59S\") eq xs:date(\"1999-09-04\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateAddDTD-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple testing involving operator '+' between xs:dayTimeDuration and xs:date. * ******************************************************* * . */ @org.junit.Test public void kDateAddDTD2() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P23DT09H32M59S\") + xs:date(\"1999-08-12\") eq xs:date(\"1999-09-04\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test addition of zero duration to date . */ @org.junit.Test public void cbclAddDayTimeDurationToDate001() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:two-digit($number as xs:integer) { \n" + " \t\tlet $string := string($number) \n" + " \t\treturn if (string-length($string) lt 2) then concat('0', $string) else $string \n" + " \t}; \n" + " \tdeclare function local:date($year as xs:integer, $month as xs:integer, $day as xs:integer) { \n" + " \t\tlet $m := local:two-digit($month), $d := local:two-digit($day) \n" + " \t\treturn xs:date(concat($year, '-', $m, '-', $d)) \n" + " \t}; \n" + " \tlocal:date(2008, 05, 12) + xs:dayTimeDuration(\"P0D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2008-05-12") ); } /** * test addition of zero duration to date . */ @org.junit.Test public void cbclAddDayTimeDurationToDate002() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:two-digit($number as xs:integer) { \n" + " \t\tlet $string := string($number) \n" + " \t\treturn if (string-length($string) lt 2) then concat('0', $string) else $string \n" + " \t}; \n" + " \tdeclare function local:date($year as xs:integer, $month as xs:integer, $day as xs:integer) { \n" + " \t\tlet $m := local:two-digit($month), $d := local:two-digit($day) \n" + " \t\treturn xs:date(concat($year, '-', $m, '-', $d)) \n" + " \t}; \n" + " \txs:dayTimeDuration(\"P0D\") + local:date(2008, 05, 12)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2008-05-12") ); } /** * test addition of large duration to date . */ @org.junit.Test public void cbclAddDayTimeDurationToDate003() { final XQuery query = new XQuery( "\n" + " declare function local:two-digit($number as xs:integer) { \n" + " \tlet $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string \n" + " }; \n" + " declare function local:date($year as xs:integer, $month as xs:integer, $day as xs:integer) { \n" + " \tlet $m := local:two-digit($month), $d := local:two-digit($day) return xs:date(concat($year, '-', $m, '-', $d)) \n" + " }; \n" + " local:date(25252734927766555, 05, 12) + xs:dayTimeDuration(\"P4267296D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-date-1 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-date" operator * As per example 1 (for this function)of the F&O specs. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDate1() { final XQuery query = new XQuery( "xs:date(\"2004-10-30Z\") + xs:dayTimeDuration(\"P2DT2H30M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-11-01Z") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-date-10 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value "add-dayTimeDuration-to-date" operator used * together with an "or" expression. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDate10() { final XQuery query = new XQuery( "fn:string((xs:date(\"1985-07-05Z\") + xs:dayTimeDuration(\"P03DT01H04M\"))) or fn:string((xs:date(\"1985-07-05Z\") + xs:dayTimeDuration(\"P01DT01H03M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-date-12 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of "add-dayTimeDuration-to-date" operator used * with a boolean expression and the "fn:true" function. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDate12() { final XQuery query = new XQuery( "fn:string((xs:date(\"1980-03-02Z\") + xs:dayTimeDuration(\"P05DT08H11M\"))) and (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-date-13 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-date" operator used * together with the numeric-equal-operator "eq". * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDate13() { final XQuery query = new XQuery( "(xs:date(\"1980-05-05Z\") + xs:dayTimeDuration(\"P23DT11H11M\")) eq xs:date(\"1980-05-05Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-date-14 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-date" operator used * together with the numeric-equal operator "ne". * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDate14() { final XQuery query = new XQuery( "(xs:date(\"1979-12-12Z\") + xs:dayTimeDuration(\"P08DT08H05M\")) ne xs:date(\"1979-12-12Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-date-15 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-date" operator used * together with the numeric-equal operator "le". * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDate15() { final XQuery query = new XQuery( "(xs:date(\"1978-12-12Z\") + xs:dayTimeDuration(\"P17DT10H02M\")) le xs:date(\"1978-12-12Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-date-16 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-date" operator used * together with the numeric-equal operator "ge". * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDate16() { final XQuery query = new XQuery( "(xs:date(\"1977-12-12Z\") + xs:dayTimeDuration(\"P18DT02H02M\")) ge xs:date(\"1977-12-12Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-date-3 * Date: July 1, 2005 * Purpose: Evaluates The string value "add-dayTimeDuration-to-date" operator as * part of a boolean expression (or operator) and the "fn:boolean" function. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDate3() { final XQuery query = new XQuery( "fn:string((xs:date(\"1999-10-23Z\") + xs:dayTimeDuration(\"P19DT13H10M\"))) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-date-4 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value"add-dayTimeDuration-to-date" operator that * return true and used together with fn:not. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDate4() { final XQuery query = new XQuery( "fn:not(fn:string(xs:date(\"1998-09-12Z\") + xs:dayTimeDuration(\"P02DT07H01M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-date-5 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value "add-dayTimeDuration-to-date" operator that * is used as an argument to the fn:boolean function. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDate5() { final XQuery query = new XQuery( "fn:boolean(fn:string(xs:date(\"1962-03-12Z\") + xs:dayTimeDuration(\"P03DT08H06M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-date-6 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-date" operator that * is used as an argument to the fn:number function. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDate6() { final XQuery query = new XQuery( "fn:number(xs:date(\"1988-01-28Z\") + xs:dayTimeDuration(\"P10DT08H01M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-date-7 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-date" operator used * as an argument to the "fn:string" function). * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDate7() { final XQuery query = new XQuery( "fn:string(xs:date(\"1989-07-05Z\") + xs:dayTimeDuration(\"P01DT09H02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1989-07-06Z") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-date-8 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-date" operator that * returns a negative value. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDate8() { final XQuery query = new XQuery( "(xs:date(\"0001-01-01Z\") + xs:dayTimeDuration(\"-P11DT02H02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "-0001-12-20Z") || assertStringValue(false, "0000-12-20Z") ) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-date-9 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value "add-dayTimeDuration-to-date" operator used * together with an "and" expression. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDate9() { final XQuery query = new XQuery( "fn:string((xs:date(\"1993-12-09Z\") + xs:dayTimeDuration(\"P03DT01H04M\"))) and fn:string((xs:date(\"1993-12-09Z\") + xs:dayTimeDuration(\"P01DT01H03M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-date2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-dayTimeDuration-to-date" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDate2args1() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") + xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1970-01-01Z") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-date2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-dayTimeDuration-to-date" operator * with the arguments set as follows: * $arg1 = xs:date(mid range) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDate2args2() { final XQuery query = new XQuery( "xs:date(\"1983-11-17Z\") + xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1983-11-17Z") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-date2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-dayTimeDuration-to-date" operator * with the arguments set as follows: * $arg1 = xs:date(upper bound) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDate2args3() { final XQuery query = new XQuery( "xs:date(\"2030-12-31Z\") + xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2030-12-31Z") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-date2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-dayTimeDuration-to-date" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:dayTimeDuration(mid range) * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDate2args4() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") + xs:dayTimeDuration(\"P15DT11H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1970-01-16Z") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-date2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-dayTimeDuration-to-date" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:dayTimeDuration(upper bound) * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDate2args5() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") + xs:dayTimeDuration(\"P31DT23H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1970-02-01Z") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-date-2 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value "add-dayTimeDuration-to-date" operator * used as part of a boolean expression (and operator) and the "fn:false" function. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDatealt2() { final XQuery query = new XQuery( "fn:string((xs:date(\"2000-12-12Z\") + xs:dayTimeDuration(\"P19DT13H10M\"))) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpAddDayTimeDurationToDateTime.java���0000664�0000000�0000000�00000062426�12224530032�0032666�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the add-dayTimeDuration-to-dateTime() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpAddDayTimeDurationToDateTime extends QT3TestSet { /** * * ******************************************************* * Test: K-DateTimeAddDTD-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The '+' operator is not available between xs:date and xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void kDateTimeAddDTD1() { final XQuery query = new XQuery( "xs:date(\"1999-10-12\") + xs:dateTime(\"1999-10-12T08:12:12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DateTimeAddDTD-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The '+' operator is not available between xs:dateTime and xs:date. * ******************************************************* * . */ @org.junit.Test public void kDateTimeAddDTD2() { final XQuery query = new XQuery( "xs:dateTime(\"1999-10-12T08:12:12\") + xs:date(\"1999-10-12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DateTimeAddDTD-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The '+' operator is not available between xs:time and xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void kDateTimeAddDTD3() { final XQuery query = new XQuery( "xs:time(\"08:12:12\") + xs:dateTime(\"1999-10-12T08:12:12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DateTimeAddDTD-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The '+' operator is not available between xs:dateTime and xs:time. * ******************************************************* * . */ @org.junit.Test public void kDateTimeAddDTD4() { final XQuery query = new XQuery( "xs:dateTime(\"1999-10-12T08:12:12\") + xs:time(\"08:12:12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test addition of zero duration to dateTime . */ @org.junit.Test public void cbclAddDayTimeDurationToDateTime001() { final XQuery query = new XQuery( "declare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string }; declare function local:dateTime($year as xs:integer, $month as xs:integer, $day as xs:integer, $hour as xs:integer, $mins as xs:integer) { let $m := local:two-digit($month), $d := local:two-digit($day), $h := local:two-digit($hour), $n := local:two-digit($mins) return xs:dateTime(concat($year, '-', $m, '-', $d, 'T', $h, ':', $n, ':00')) }; xs:dayTimeDuration(\"P0D\") + local:dateTime(2008, 05, 12, 12, 59)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2008-05-12T12:59:00") ); } /** * test addition of zero duration to dateTime . */ @org.junit.Test public void cbclAddDayTimeDurationToDateTime002() { final XQuery query = new XQuery( "declare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string }; declare function local:dateTime($year as xs:integer, $month as xs:integer, $day as xs:integer, $hour as xs:integer, $mins as xs:integer) { let $m := local:two-digit($month), $d := local:two-digit($day), $h := local:two-digit($hour), $n := local:two-digit($mins) return xs:dateTime(concat($year, '-', $m, '-', $d, 'T', $h, ':', $n, ':00')) }; local:dateTime(2008, 05, 12, 12, 59) + xs:dayTimeDuration(\"P0D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2008-05-12T12:59:00") ); } /** * test addition of large duration to date . */ @org.junit.Test public void cbclAddDayTimeDurationToDateTime003() { final XQuery query = new XQuery( "declare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string }; declare function local:dateTime($year as xs:integer, $month as xs:integer, $day as xs:integer, $hour as xs:integer, $mins as xs:integer) { let $m := local:two-digit($month), $d := local:two-digit($day), $h := local:two-digit($hour), $n := local:two-digit($mins) return xs:dateTime(concat($year, '-', $m, '-', $d, 'T', $h, ':', $n, ':00')) }; local:dateTime(25252734927766555, 05, 12, 12, 59) + xs:dayTimeDuration(\"P40267296D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-dateTime-1 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-dateTime" operator * As per example 1 (for this function)of the F&O specs. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDateTime1() { final XQuery query = new XQuery( "xs:dateTime(\"2000-10-30T11:12:00\") + xs:dayTimeDuration(\"P3DT1H15M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2000-11-02T12:27:00") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-dateTime-10 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of the "add-dayTimeDuration-to-dateTime" * operator used together with an "or" expression. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDateTime10() { final XQuery query = new XQuery( "fn:string((xs:dateTime(\"1985-07-05T14:14:14Z\") + xs:dayTimeDuration(\"P03DT01H04M\"))) or fn:string((xs:dateTime(\"1985-07-05T15:15:15Z\") + xs:dayTimeDuration(\"P01DT01H03M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-dateTime-12 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of the "add-dayTimeDuration-to-dateTime" * operator used with a boolean expression and the "fn:true" function. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDateTime12() { final XQuery query = new XQuery( "fn:string((xs:dateTime(\"1980-03-02T16:12:10Z\") + xs:dayTimeDuration(\"P05DT08H11M\"))) and (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-dateTime-13 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-dateTime" operator used * together with the numeric-equal-operator "eq". * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDateTime13() { final XQuery query = new XQuery( "(xs:dateTime(\"1980-05-05T17:17:17Z\") + xs:dayTimeDuration(\"P23DT11H11M\")) eq xs:dateTime(\"1980-05-05T17:17:17Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-dateTime-14 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-dateTime" operator used * together with the numeric-equal operator "ne". * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDateTime14() { final XQuery query = new XQuery( "(xs:dateTime(\"1979-12-12T18:18:18Z\") + xs:dayTimeDuration(\"P08DT08H05M\")) ne xs:dateTime(\"1979-12-12T16:15:14Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-dateTime-15 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-dateTime" operator used * together with the numeric-equal operator "le". * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDateTime15() { final XQuery query = new XQuery( "(xs:dateTime(\"1978-12-12T12:45:12Z\") + xs:dayTimeDuration(\"P17DT10H02M\")) le xs:dateTime(\"1978-12-12T16:34:23Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-dateTime-16 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-dateTime" operator used * together with the numeric-equal operator "ge". * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDateTime16() { final XQuery query = new XQuery( "(xs:dateTime(\"1977-12-12T13:12:15Z\") + xs:dayTimeDuration(\"P18DT02H02M\")) ge xs:dateTime(\"1977-12-12T15:56:10Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-dateTime-2 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of "add-dayTimeDuration-to-dateTime" operator * used as part of a boolean expression (and operator) and the "fn:false" function. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDateTime2() { final XQuery query = new XQuery( "fn:string((xs:dateTime(\"2000-12-12T11:10:03Z\") + xs:dayTimeDuration(\"P12DT10H07M\"))) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-dateTime-3 * Date: July 1, 2005 * Purpose: Evaluates The string value of the "add-dayTimeDuration-to-dateTime" * operator as part of a boolean expression (or operator) and the "fn:boolean" * function. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDateTime3() { final XQuery query = new XQuery( "fn:string((xs:dateTime(\"1999-10-23T03:12:23Z\") + xs:dayTimeDuration(\"P19DT13H10M\"))) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-dateTime-4 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of the "add-dayTimeDuration-to-dateTime" * operator that return true and used together with fn:not. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDateTime4() { final XQuery query = new XQuery( "fn:not(fn:string(xs:dateTime(\"1998-09-12T13:23:23Z\") + xs:dayTimeDuration(\"P02DT07H01M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-dateTime-5 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of the "add-dayTimeDuration-to-dateTime" * operator that is used as an argument to the fn:boolean function. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDateTime5() { final XQuery query = new XQuery( "fn:boolean(fn:string(xs:dateTime(\"1962-03-12T12:34:09Z\") + xs:dayTimeDuration(\"P03DT08H06M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-dateTime-6 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-dateTime" operator that * is used as an argument to the fn:number function. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDateTime6() { final XQuery query = new XQuery( "fn:number(xs:dateTime(\"1988-01-28T12:34:12Z\") + xs:dayTimeDuration(\"P10DT08H01M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-dateTime-7 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-dateTime" operator used * as an argument to the "fn:string" function). * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDateTime7() { final XQuery query = new XQuery( "fn:string(xs:dateTime(\"1989-07-05T10:10:10Z\") + xs:dayTimeDuration(\"P01DT09H02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1989-07-06T19:12:10Z") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-dateTime-8 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-dateTime" operator that * returns a negative value. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDateTime8() { final XQuery query = new XQuery( "(xs:dateTime(\"0001-01-01T11:11:11Z\") + xs:dayTimeDuration(\"-P11DT02H02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "-0001-12-21T09:09:11Z") || assertStringValue(false, "0000-12-21T09:09:11Z") ) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-dateTime-9 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of the "add-dayTimeDuration-to-dateTime" * operator used together with an "and" expression. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDateTime9() { final XQuery query = new XQuery( "fn:string((xs:dateTime(\"1993-12-09T13:13:13Z\") + xs:dayTimeDuration(\"P03DT01H04M\"))) and fn:string((xs:dateTime(\"1993-12-09T13:13:13Z\") + xs:dayTimeDuration(\"P01DT01H03M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-dateTime2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-dayTimeDuration-to-dateTime" operator * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDateTime2args1() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") + xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1970-01-01T00:00:00Z") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-dateTime2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-dayTimeDuration-to-dateTime" operator * with the arguments set as follows: * $arg1 = xs:dateTime(mid range) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDateTime2args2() { final XQuery query = new XQuery( "xs:dateTime(\"1996-04-07T01:40:52Z\") + xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1996-04-07T01:40:52Z") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-dateTime2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-dayTimeDuration-to-dateTime" operator * with the arguments set as follows: * $arg1 = xs:dateTime(upper bound) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDateTime2args3() { final XQuery query = new XQuery( "xs:dateTime(\"2030-12-31T23:59:59Z\") + xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2030-12-31T23:59:59Z") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-dateTime2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-dayTimeDuration-to-dateTime" operator * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dayTimeDuration(mid range) * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDateTime2args4() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") + xs:dayTimeDuration(\"P15DT11H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1970-01-16T11:59:59Z") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-dateTime2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-dayTimeDuration-to-dateTime" operator * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dayTimeDuration(upper bound) * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToDateTime2args5() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") + xs:dayTimeDuration(\"P31DT23H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1970-02-01T23:59:59Z") ); } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpAddDayTimeDurationToTime.java�������0000664�0000000�0000000�00000057535�12224530032�0032075�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the add-dayTimeDuration-to-time() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpAddDayTimeDurationToTime extends QT3TestSet { /** * * ******************************************************* * Test: K-TimeAddDTD-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple testing involving operator '+' between xs:time and xs:dayTimeDuration. * ******************************************************* * . */ @org.junit.Test public void kTimeAddDTD1() { final XQuery query = new XQuery( "xs:time(\"08:12:32\") + xs:dayTimeDuration(\"P23DT09H32M59S\") eq xs:time(\"17:45:31\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-TimeAddDTD-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple testing involving operator '+' between xs:dayTimeDuration and xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeAddDTD2() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P23DT09H32M59S\") + xs:time(\"08:12:32\") eq xs:time(\"17:45:31\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K2-TimeAddDTD-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: No '+' operator is available between xs:time and xs:time. * ******************************************************* * . */ @org.junit.Test public void k2TimeAddDTD1() { final XQuery query = new XQuery( "xs:time(\"10:10:10\") + xs:time(\"23:10:10\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test addition of zero duration to time . */ @org.junit.Test public void cbclAddDayTimeDurationToTime001() { final XQuery query = new XQuery( "\n" + " declare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string };\n" + " declare function local:time($hour as xs:integer, $mins as xs:integer) { let $h := local:two-digit($hour), $m := local:two-digit($mins) return xs:time(concat( $h, ':', $m, ':00')) };\n" + " local:time(12, 59) + xs:dayTimeDuration(\"P0D\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12:59:00") ); } /** * test addition of zero duration to time . */ @org.junit.Test public void cbclAddDayTimeDurationToTime002() { final XQuery query = new XQuery( "\n" + " declare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string };\n" + " declare function local:time($hour as xs:integer, $mins as xs:integer) { let $h := local:two-digit($hour), $m := local:two-digit($mins) return xs:time(concat( $h, ':', $m, ':00')) };\n" + " xs:dayTimeDuration(\"P0D\") + local:time(12, 59)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12:59:00") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-time-1 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-time" function * As per example 1 (for this function)of the F&O specs. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToTime1() { final XQuery query = new XQuery( "xs:time(\"11:12:00\") + xs:dayTimeDuration(\"P3DT1H15M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12:27:00") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-time-10 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-time" function used * together with an "or" expression. * Uses the "fn:string" function to account for new EBV rules. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToTime10() { final XQuery query = new XQuery( "fn:string((xs:time(\"02:03:01Z\") + xs:dayTimeDuration(\"P03DT01H04M\"))) or fn:string((xs:time(\"02:03:01Z\") + xs:dayTimeDuration(\"P01DT01H03M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-time-13 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-time" function used * together with the numeric-equal-operator "eq". * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToTime13() { final XQuery query = new XQuery( "(xs:time(\"01:03:03Z\") + xs:dayTimeDuration(\"P23DT11H11M\")) eq xs:time(\"04:03:05Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-time-14 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-time" function used * together with the numeric-equal operator "ne". * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToTime14() { final XQuery query = new XQuery( "(xs:time(\"04:04:05Z\") + xs:dayTimeDuration(\"P08DT08H05M\")) ne xs:time(\"05:08:02Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-time-15 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-time" function used * together with the numeric-equal operator "le". * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToTime15() { final XQuery query = new XQuery( "(xs:time(\"08:09:09Z\") + xs:dayTimeDuration(\"P17DT10H02M\")) le xs:time(\"09:08:10Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-time-16 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-time" function used * together with the numeric-equal operator "ge". * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToTime16() { final XQuery query = new XQuery( "(xs:time(\"09:06:07Z\") + xs:dayTimeDuration(\"P18DT02H02M\")) ge xs:time(\"01:01:01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-time-17 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-time" function * used as part of a boolean expression (and operator) and the "fn:false" function. * Uses the "fn:string" function to account for new EBV rules. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToTime17() { final XQuery query = new XQuery( "fn:string(xs:time(\"12:07:08Z\") + xs:dayTimeDuration(\"P12DT10H07M\")) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-time-2 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-time" function * as per example 2 (for this function) from the F&O specs. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToTime2() { final XQuery query = new XQuery( "xs:time(\"23:12:00+03:00\") + xs:dayTimeDuration(\"P1DT3H15M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "02:27:00+03:00") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-time-3 * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-time" function as * part of a boolean expression (or operator) and the "fn:boolean" function. * Uses the "fn:string" function to account for new EBV rules. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToTime3() { final XQuery query = new XQuery( "fn:string((xs:time(\"12:12:01Z\") + xs:dayTimeDuration(\"P19DT13H10M\"))) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-time-4 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-time" function that * return true and used together with fn:not. * Uses the "fn:string" function to account for new EBV rules. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToTime4() { final XQuery query = new XQuery( "fn:not(fn:string(xs:time(\"13:12:00Z\") + xs:dayTimeDuration(\"P02DT07H01M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-time-5 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-time" function that * is used as an argument to the fn:boolean function. * Uses the "fn:string" function to account for new EBV rules. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToTime5() { final XQuery query = new XQuery( "fn:boolean(fn:string(xs:time(\"02:02:02Z\") + xs:dayTimeDuration(\"P03DT08H06M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-time-6 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-time" operator that * is used as an argument to the fn:number function. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToTime6() { final XQuery query = new XQuery( "fn:number(xs:time(\"01:01:01Z\") + xs:dayTimeDuration(\"P10DT08H01M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-time-7 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-time" function used * as an argument to the "fn:string" function). * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToTime7() { final XQuery query = new XQuery( "fn:string(xs:time(\"10:02:03Z\") + xs:dayTimeDuration(\"P01DT09H02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "19:04:03Z") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-time-8 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-time" function that * returns a negative value. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToTime8() { final XQuery query = new XQuery( "(xs:time(\"08:02:06\") + xs:dayTimeDuration(\"-P11DT02H02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "06:00:06") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-time-9 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-time" function used * together with and "and" expression. * Uses the "fn:string" function to account for new EBV rules. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToTime9() { final XQuery query = new XQuery( "fn:string((xs:time(\"10:10:10Z\") + xs:dayTimeDuration(\"P02DT09H02M\"))) and fn:string((xs:time(\"09:02:02Z\") + xs:dayTimeDuration(\"P04DT04H04M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-time2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-dayTimeDuration-to-time" operator * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToTime2args1() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") + xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "00:00:00Z") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-time2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-dayTimeDuration-to-time" operator * with the arguments set as follows: * $arg1 = xs:time(mid range) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToTime2args2() { final XQuery query = new XQuery( "xs:time(\"08:03:35Z\") + xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "08:03:35Z") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-time2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-dayTimeDuration-to-time" operator * with the arguments set as follows: * $arg1 = xs:time(upper bound) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToTime2args3() { final XQuery query = new XQuery( "xs:time(\"23:59:59Z\") + xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "23:59:59Z") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-time2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-dayTimeDuration-to-time" operator * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:dayTimeDuration(mid range) * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToTime2args4() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") + xs:dayTimeDuration(\"P15DT11H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "11:59:59Z") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-time2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-dayTimeDuration-to-time" operator * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:dayTimeDuration(upper bound) * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToTime2args5() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") + xs:dayTimeDuration(\"P31DT23H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "23:59:59Z") ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-time-12 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-dayTimeDuration-to-time" operators used * with a boolean expression and the "fn:true" function. * Uses the "fn:string" function to account for new EBV rules. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurationToTimealt12() { final XQuery query = new XQuery( "fn:string((xs:time(\"02:02:02Z\") + xs:dayTimeDuration(\"P05DT08H11M\"))) and (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpAddDayTimeDurations.java������������0000664�0000000�0000000�00000132523�12224530032�0031125�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the add-dayTimeDurations() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpAddDayTimeDurations extends QT3TestSet { /** * * ******************************************************* * Test: K-DayTimeDurationAdd-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of adding an xs:dayTimeDuration with PT0S. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationAdd1() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT4H3M3.100S\") + xs:dayTimeDuration(\"PT0S\") eq xs:dayTimeDuration(\"P3DT4H3M3.100S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DayTimeDurationAdd-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of substraction PT0S with an xs:dayTimeDuration. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationAdd2() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"PT0S\") + xs:dayTimeDuration(\"P3DT4H3M3.100S\") eq xs:dayTimeDuration(\"P3DT4H3M3.100S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DayTimeDurationAdd-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of adding two arbitrary xs:yearMonthDurations. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationAdd3() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT4H3M3.100S\") + xs:dayTimeDuration(\"P3DT12H31M56.303S\") eq xs:dayTimeDuration(\"P6DT16H34M59.403S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test addition of zero duration to dayTimeDuration . */ @org.junit.Test public void cbclAddDayTimeDurations001() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($days as xs:integer, $hours as xs:integer ) { xs:dayTimeDuration(concat('P', $days, 'DT', $hours, 'H')) }; local:dayTimeDuration(1, 1) + xs:dayTimeDuration(\"P0D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1DT1H") ); } /** * test addition of zero duration to dayTimeDuration . */ @org.junit.Test public void cbclAddDayTimeDurations002() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($days as xs:integer, $hours as xs:integer ) { xs:dayTimeDuration(concat('P', $days, 'DT', $hours, 'H')) }; xs:dayTimeDuration(\"P0D\") + local:dayTimeDuration(1, 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1DT1H") ); } /** * test addition of dayTimeDurations . */ @org.junit.Test public void cbclAddDayTimeDurations003() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($days as xs:integer, $hours as xs:integer ) { xs:dayTimeDuration(concat('P', $days, 'DT', $hours, 'H')) }; local:dayTimeDuration(1, 1) + local:dayTimeDuration(1, 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P2DT2H") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus001() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") };\n" + " xs:date(\"1997-01-01\") + local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1997-01-02") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus002() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") };\n" + " xs:date(\"1997-01-01\") + local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus003() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:yearMonthDuration(\"P1M\") };\n" + " xs:date(\"1997-01-01\") + local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1997-02-01") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus004() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:yearMonthDuration(\"P1M\") };\n" + " xs:date(\"1997-01-01\") + local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus005() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") };\n" + " xs:dateTime(\"1997-01-01T12:00:00\") + local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1997-01-02T12:00:00") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus006() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") };\n" + " xs:dateTime(\"1997-01-01T12:00:00\") + local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus007() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:yearMonthDuration(\"P1M\") };\n" + " xs:dateTime(\"1997-01-01T12:00:00\") + local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1997-02-01T12:00:00") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus008() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:yearMonthDuration(\"P1M\") };\n" + " xs:dateTime(\"1997-01-01T12:00:00\") + local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus009() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"PT1H\") };\n" + " xs:time(\"12:00:00\") + local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "13:00:00") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus010() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1H\") };\n" + " xs:time(\"12:00:00\") + local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus011() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") };\n" + " xs:dayTimeDuration(\"PT1H\") + local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1DT1H") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus012() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") };\n" + " xs:dayTimeDuration(\"PT1H\") + local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus013() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " xs:yearMonthDuration(\"P1Y\") + local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1Y1M") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus014() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " xs:yearMonthDuration(\"P1Y\") + local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus015() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") };\n" + " local:f(false()) + xs:date(\"1997-01-01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1997-01-02") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus016() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") };\n" + " local:f(true()) + xs:date(\"1997-01-01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus017() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:yearMonthDuration(\"P1M\") };\n" + " local:f(false()) + xs:date(\"1997-01-01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1997-02-01") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus018() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:yearMonthDuration(\"P1M\") };\n" + " local:f(true()) + xs:date(\"1997-01-01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus019() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") };\n" + " local:f(false()) + xs:dateTime(\"1997-01-01T12:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1997-01-02T12:00:00") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus020() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") };\n" + " local:f(true()) + xs:dateTime(\"1997-01-01T12:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus021() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:yearMonthDuration(\"P1M\") };\n" + " local:f(false()) + xs:dateTime(\"1997-01-01T12:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1997-02-01T12:00:00") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus022() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:yearMonthDuration(\"P1M\") };\n" + " local:f(true()) + xs:dateTime(\"1997-01-01T12:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus023() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"PT1H\") };\n" + " local:f(false()) + xs:time(\"12:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "13:00:00") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus024() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"PT1H\") };\n" + " local:f(true()) + xs:time(\"12:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus025() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") };\n" + " local:f(false()) + xs:dayTimeDuration(\"PT1H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1DT1H") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus026() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") };\n" + " local:f(true()) + xs:dayTimeDuration(\"PT1H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus027() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " local:f(false()) + xs:yearMonthDuration(\"P1Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1Y1M") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus028() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " local:f(true()) + xs:yearMonthDuration(\"P1Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus029() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " local:f(false()) + local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P2M") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus030() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " local:f(true()) + local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus031() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") };\n" + " local:f(false()) + local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P2D") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus032() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") };\n" + " local:f(true()) + local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus033() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") };\n" + " declare function local:g($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " local:f(false()) + local:g(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of plus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclPlus034() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") };\n" + " declare function local:g($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " local:f(true()) + local:g(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: op-add-dayTimeDurations-1 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-dayTimeDurations" function * As per example 1 (for this function)of the F&O specs. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurations1() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P2DT12H5M\") + xs:dayTimeDuration(\"P5DT12H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P8DT5M") ); } /** * * ******************************************************* * Test: op-add-dayTimeDurations-10 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-dayTimeDurations" function used * together with an "or" expression. * Uses the "fn:string" function to account for new EBV rules. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurations10() { final XQuery query = new XQuery( "fn:string((xs:dayTimeDuration(\"P05DT09H02M\") + xs:dayTimeDuration(\"P03DT01H04M\"))) or fn:string((xs:dayTimeDuration(\"P05DT05H03M\") + xs:dayTimeDuration(\"P01DT01H03M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDurations-11 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-dayTimeDurations" function used * together with a "div" expression. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurations11() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P42DT10H10M\") + xs:dayTimeDuration(\"P10DT10H10M\")) div (xs:dayTimeDuration(\"P42DT10H10M\") + xs:dayTimeDuration(\"P10DT10H10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * * ******************************************************* * Test: op-add-dayTimeDurations-12 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-dayTimeDurations" operators used * with a boolean expression and the "fn:true" function. * Uses the "fn:string" function to account for new EBV rules. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurations12() { final XQuery query = new XQuery( "fn:string((xs:dayTimeDuration(\"P10DT08H11M\") + xs:dayTimeDuration(\"P05DT08H11M\"))) and (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDurations-13 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-dayTimeDurations" function used * together with the numeric-equal-operator "eq". * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurations13() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P23DT11H11M\") + xs:dayTimeDuration(\"P23DT11H11M\")) eq xs:dayTimeDuration(\"P23DT11H11M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-add-dayTimeDurations-14 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-dayTimeDurations" function used * together with the numeric-equal operator "ne". * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurations14() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P21DT08H12M\") + xs:dayTimeDuration(\"P08DT08H05M\")) ne xs:dayTimeDuration(\"P08DT08H05M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDurations-15 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-dayTimeDurations" function used * together with the numeric-equal operator "le". * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurations15() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P10DT10H01M\") + xs:dayTimeDuration(\"P17DT10H02M\")) le xs:dayTimeDuration(\"P17DT10H02M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-add-dayTimeDurations-16 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-dayTimeDurations" function used * together with the numeric-equal operator "ge". * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurations16() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P13DT09H09M\") + xs:dayTimeDuration(\"P18DT02H02M\")) ge xs:dayTimeDuration(\"P18DT02H02M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDurations-2 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-dayTimeDurations" function * used as part of a boolean expression (and operator) and the "fn:false" function. * Uses "fn:string" to account for new EBV rules. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurations2() { final XQuery query = new XQuery( "fn:string(xs:dayTimeDuration(\"P10DT10H11M\") + xs:dayTimeDuration(\"P12DT10H07M\")) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-add-dayTimeDurations-3 * Date: June 29, 2005 * Purpose: Evaluates The "add-dayTimeDurations" function as * part of a boolean expression (or operator) and the "fn:boolean" function. * Uses the "fn:string" function to account for new EBV rules. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurations3() { final XQuery query = new XQuery( "fn:string(xs:dayTimeDuration(\"P20DT20H10M\") + xs:dayTimeDuration(\"P19DT13H10M\")) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDurations-4 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-dayTimeDurations" function that * return true and used together with fn:not. * Uses the "fn:string" function to account for new EBV rules. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurations4() { final XQuery query = new XQuery( "fn:not(fn:string(xs:dayTimeDuration(\"P11DT12H04M\") + xs:dayTimeDuration(\"P02DT07H01M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-add-dayTimeDurations-5 * Written By: Carmelo Montanez * Date: June 29 2005 * Purpose: Evaluates The "add-dayTimeDurations" function that * is used as an argument to the fn:boolean function. * Uses the "fn:string" function to account for new EBV rules. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurations5() { final XQuery query = new XQuery( "fn:boolean(fn:string(xs:dayTimeDuration(\"P05DT09H08M\") + xs:dayTimeDuration(\"P03DT08H06M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDurations-6 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-dayTimeDurations" operator that * is used as an argument to the fn:number function. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurations6() { final XQuery query = new XQuery( "fn:number(xs:dayTimeDuration(\"P02DT06H09M\") + xs:dayTimeDuration(\"P10DT08H01M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * * ******************************************************* * Test: op-add-dayTimeDurations-7 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-dayTimeDurations" function used * as an argument to the "fn:string" function). * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurations7() { final XQuery query = new XQuery( "fn:string(xs:dayTimeDuration(\"P03DT04H08M\") + xs:dayTimeDuration(\"P01DT09H02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P4DT13H10M") ); } /** * * ******************************************************* * Test: op-add-dayTimeDurations-8 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-dayTimeDurations" function that * returns a negative value. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurations8() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P10DT01H01M\") + xs:dayTimeDuration(\"-P11DT02H02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P1DT1H1M") ); } /** * * ******************************************************* * Test: op-add-dayTimeDurations-9 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-dayTimeDurations" function used * together with and "and" expression. * Uses the "fn:string" function to account for new EBV rules. * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurations9() { final XQuery query = new XQuery( "fn:string((xs:dayTimeDuration(\"P01DT02H01M\") + xs:dayTimeDuration(\"P02DT09H02M\"))) and fn:string((xs:dayTimeDuration(\"P02DT03H03M\") + xs:dayTimeDuration(\"P04DT04H04M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDurations2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-dayTimeDurations" operator * with the arguments set as follows: * Sarg1 = xs:dayTimeDuration(lower bound) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurations2args1() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") + xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * * ******************************************************* * Test: op-add-dayTimeDurations2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-dayTimeDurations" operator * with the arguments set as follows: * Sarg1 = xs:dayTimeDuration(mid range) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurations2args2() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P15DT11H59M59S\") + xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P15DT11H59M59S") ); } /** * * ******************************************************* * Test: op-add-dayTimeDurations2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-dayTimeDurations" operator * with the arguments set as follows: * Sarg1 = xs:dayTimeDuration(upper bound) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurations2args3() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P31DT23H59M59S\") + xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P31DT23H59M59S") ); } /** * * ******************************************************* * Test: op-add-dayTimeDurations2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-dayTimeDurations" operator * with the arguments set as follows: * Sarg1 = xs:dayTimeDuration(lower bound) * $arg2 = xs:dayTimeDuration(mid range) * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurations2args4() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") + xs:dayTimeDuration(\"P15DT11H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P15DT11H59M59S") ); } /** * * ******************************************************* * Test: op-add-dayTimeDurations2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-dayTimeDurations" operator * with the arguments set as follows: * Sarg1 = xs:dayTimeDuration(lower bound) * $arg2 = xs:dayTimeDuration(upper bound) * ******************************************************* * . */ @org.junit.Test public void opAddDayTimeDurations2args5() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") + xs:dayTimeDuration(\"P31DT23H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P31DT23H59M59S") ); } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpAddYearMonthDurationToDate.java�����0000664�0000000�0000000�00000061164�12224530032�0032417�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the add-yearMonthDuration-to-date() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpAddYearMonthDurationToDate extends QT3TestSet { /** * * ******************************************************* * Test: K-DateAddYMD-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple testing involving operator '+' between xs:date and xs:yearMonthDuration. * ******************************************************* * . */ @org.junit.Test public void kDateAddYMD1() { final XQuery query = new XQuery( "xs:date(\"1999-08-12\") + xs:yearMonthDuration(\"P3Y7M\") eq xs:date(\"2003-03-12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateAddYMD-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple testing involving operator '+' between xs:yearMonthDuration and xs:date. * ******************************************************* * . */ @org.junit.Test public void kDateAddYMD2() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P3Y7M\") + xs:date(\"1999-08-12\") eq xs:date(\"2003-03-12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateAddYMD-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The '-' operator is not available between xs:yearMonthDuration and xs:date. * ******************************************************* * . */ @org.junit.Test public void kDateAddYMD3() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y\") - xs:date(\"1999-08-12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DateAddYMD-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The '-' operator is not available between xs:yearMonthDuration and xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void kDateAddYMD4() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y\") - xs:dateTime(\"1999-08-12T08:01:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test addition of zero duration to date . */ @org.junit.Test public void cbclAddYearMonthDurationToDate001() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string }; \n" + " \tdeclare function local:date($year as xs:integer, $month as xs:integer, $day as xs:integer) { let $m := local:two-digit($month), $d := local:two-digit($day) return xs:date(concat($year, '-', $m, '-', $d)) }; \n" + " \tlocal:date(2008, 05, 12) + xs:dayTimeDuration(\"P0D\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2008-05-12") ); } /** * test addition of zero duration to date . */ @org.junit.Test public void cbclAddYearMonthDurationToDate002() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string }; \n" + " \tdeclare function local:date($year as xs:integer, $month as xs:integer, $day as xs:integer) { let $m := local:two-digit($month), $d := local:two-digit($day) return xs:date(concat($year, '-', $m, '-', $d)) }; \n" + " \txs:dayTimeDuration(\"P0D\") + local:date(2008, 05, 12)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2008-05-12") ); } /** * test addition of large duration to date . */ @org.junit.Test public void cbclAddYearMonthDurationToDate003() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string }; \n" + " \tdeclare function local:date($year as xs:integer, $month as xs:integer, $day as xs:integer) { let $m := local:two-digit($month), $d := local:two-digit($day) return xs:date(concat($year, '-', $m, '-', $d)) }; \n" + " \tlocal:date(25252734927766555, 05, 12) + xs:yearMonthDuration(\"P4267296Y\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * * ******************************************************* * Test: op-add-yearMonthDuration-to-date-1 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-yearMonthDuration-to-date" operator * As per example 1 (for this function)of the F&O specs. * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurationToDate1() { final XQuery query = new XQuery( "xs:date(\"2000-10-30\") + xs:yearMonthDuration(\"P1Y2M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2001-12-30") ); } /** * * ******************************************************* * Test: op-add-yearMonthDuration-to-date-10 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of "add-yearMonthDuration-to-date" operator used * together with an "or" expression. * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurationToDate10() { final XQuery query = new XQuery( "fn:string((xs:date(\"1985-07-05Z\") + xs:yearMonthDuration(\"P02Y02M\"))) or fn:string((xs:date(\"1985-07-05Z\") + xs:yearMonthDuration(\"P02Y02M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-yearMonthDuration-to-date-12 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value "add-yearMonthDuration-to-date" operator used * with a boolean expression and the "fn:true" function. * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurationToDate12() { final XQuery query = new XQuery( "fn:string((xs:date(\"1980-03-02Z\") + xs:yearMonthDuration(\"P05Y05M\"))) and (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-yearMonthDuration-to-date-13 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-yearMonthDuration-to-date" operator used * together with the numeric-equal-operator "eq". * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurationToDate13() { final XQuery query = new XQuery( "(xs:date(\"1980-05-05Z\") + xs:yearMonthDuration(\"P23Y11M\")) eq xs:date(\"1980-05-05Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-add-yearMonthDuration-to-date-14 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-yearMonthDuration-to-date" operator used * together with the numeric-equal operator "ne". * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurationToDate14() { final XQuery query = new XQuery( "(xs:date(\"1979-12-12Z\") + xs:yearMonthDuration(\"P08Y08M\")) ne xs:date(\"1979-12-12Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-yearMonthDuration-to-date-15 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-yearMonthDuration-to-date" operator used * together with the numeric-equal operator "le". * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurationToDate15() { final XQuery query = new XQuery( "(xs:date(\"1978-12-12Z\") + xs:yearMonthDuration(\"P17Y12M\")) le xs:date(\"1978-12-12Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-add-yearMonthDuration-to-date-16 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-yearMonthDuration-to-date" operator used * together with the numeric-equal operator "ge". * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurationToDate16() { final XQuery query = new XQuery( "(xs:date(\"1977-12-12Z\") + xs:yearMonthDuration(\"P18Y02M\")) ge xs:date(\"1977-12-12Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-dayTimeDuration-to-date-2 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of the "add-dayTimeDuration-to-date" operator * used as part of a boolean expression (and operator) and the "fn:false" function. * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurationToDate2() { final XQuery query = new XQuery( "fn:string(xs:date(\"2000-12-12Z\") + xs:dayTimeDuration(\"P12DT10H07M\")) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-add-yearMonthDuration-to-date-3 * Date: July 1, 2005 * Purpose: Evaluates The string value of "add-yearMonthDuration-to-date" operator as * part of a boolean expression (or operator) and the "fn:boolean" function. * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurationToDate3() { final XQuery query = new XQuery( "fn:string((xs:date(\"1999-10-23Z\") + xs:yearMonthDuration(\"P19Y12M\"))) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-yearMonthDuration-to-date-4 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of "add-yearMonthDuration-to-date" operator that * return true and used together with fn:not. * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurationToDate4() { final XQuery query = new XQuery( "fn:not(fn:string(xs:date(\"1998-09-12Z\") + xs:yearMonthDuration(\"P20Y03M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-add-yearMonthDuration-to-date-5 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of "add-yearMonthDuration-to-date" operator that * is used as an argument to the fn:boolean function. * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurationToDate5() { final XQuery query = new XQuery( "fn:boolean(fn:string(xs:date(\"1962-03-12Z\") + xs:yearMonthDuration(\"P10Y01M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-yearMonthDuration-to-date-6 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-yearMonthDuration-to-date" operator that * is used as an argument to the fn:number function. * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurationToDate6() { final XQuery query = new XQuery( "fn:number(xs:date(\"1988-01-28Z\") + xs:yearMonthDuration(\"P09Y02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * * ******************************************************* * Test: op-add-yearMonthDuration-to-date-7 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-yearMonthDuration-to-date" operator used * as an argument to the "fn:string" function). * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurationToDate7() { final XQuery query = new XQuery( "fn:string(xs:date(\"1989-07-05Z\") + xs:yearMonthDuration(\"P08Y04M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1997-11-05Z") ); } /** * * ******************************************************* * Test: op-add-yearMonthDuration-to-date-8 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "add-yearMonthDuration-to-date" operator that * returns a negative value. * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurationToDate8() { final XQuery query = new XQuery( "(xs:date(\"0001-01-01Z\") + xs:yearMonthDuration(\"-P20Y07M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "-0021-06-01Z") || assertStringValue(false, "-0020-06-01Z") ) ); } /** * * ******************************************************* * Test: op-add-yearMonthDuration-to-date-9 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of "add-yearMonthDuration-to-date" operator used * together with an "and" expression. * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurationToDate9() { final XQuery query = new XQuery( "fn:string((xs:date(\"1993-12-09Z\") + xs:yearMonthDuration(\"P03Y03M\"))) and fn:string((xs:date(\"1993-12-09Z\") + xs:yearMonthDuration(\"P03Y03M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-yearMonthDuration-to-date2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-yearMonthDuration-to-date" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurationToDate2args1() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") + xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1970-01-01Z") ); } /** * * ******************************************************* * Test: op-add-yearMonthDuration-to-date2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-yearMonthDuration-to-date" operator * with the arguments set as follows: * $arg1 = xs:date(mid range) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurationToDate2args2() { final XQuery query = new XQuery( "xs:date(\"1983-11-17Z\") + xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1983-11-17Z") ); } /** * * ******************************************************* * Test: op-add-yearMonthDuration-to-date2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-yearMonthDuration-to-date" operator * with the arguments set as follows: * $arg1 = xs:date(upper bound) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurationToDate2args3() { final XQuery query = new XQuery( "xs:date(\"2030-12-31Z\") + xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2030-12-31Z") ); } /** * * ******************************************************* * Test: op-add-yearMonthDuration-to-date2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-yearMonthDuration-to-date" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:yearMonthDuration(mid range) * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurationToDate2args4() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") + xs:yearMonthDuration(\"P1000Y6M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2970-07-01Z") ); } /** * * ******************************************************* * Test: op-add-yearMonthDuration-to-date2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-yearMonthDuration-to-date" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:yearMonthDuration(upper bound) * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurationToDate2args5() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") + xs:yearMonthDuration(\"P2030Y12M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4001-01-01Z") ); } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpAddYearMonthDurationToDateTime.java�0000664�0000000�0000000�00000046265�12224530032�0033243�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the add-yearMonthDuration-to-dateTime operator. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpAddYearMonthDurationToDateTime extends QT3TestSet { /** * Simple testing involving operator '+' between xs:dateTime and xs:yearMonthDuration. . */ @org.junit.Test public void kYearMonthDurationAddDT1() { final XQuery query = new XQuery( "xs:dateTime(\"1999-07-19T08:23:01.765\") + xs:yearMonthDuration(\"P3Y35M\") eq xs:dateTime(\"2005-06-19T08:23:01.765\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple testing involving operator '+' between xs:yearMonthDuration and xs:dateTime. . */ @org.junit.Test public void kYearMonthDurationAddDT2() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P3Y35M\") + xs:dateTime(\"1999-07-19T08:23:01.765\") eq xs:dateTime(\"2005-06-19T08:23:01.765\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The '+' operator is not available between xs:date and xs:time. . */ @org.junit.Test public void kYearMonthDurationAddDT3() { final XQuery query = new XQuery( "xs:date(\"1999-10-12\") + xs:time(\"08:12:12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The '+' operator is not available between xs:time and xs:date. . */ @org.junit.Test public void kYearMonthDurationAddDT4() { final XQuery query = new XQuery( "xs:time(\"08:12:12\") + xs:date(\"1999-10-12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The '+' operator is not available between xs:date and xs:time. . */ @org.junit.Test public void kYearMonthDurationAddDT5() { final XQuery query = new XQuery( "xs:date(\"1999-10-12\") + xs:time(\"08:12:12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The '+' operator is not available between xs:time and xs:date. . */ @org.junit.Test public void kYearMonthDurationAddDT6() { final XQuery query = new XQuery( "xs:time(\"08:12:12\") + xs:date(\"1999-10-12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test addition of zero duration to dateTime . */ @org.junit.Test public void cbclAddYearMonthDurationToDateTime001() { final XQuery query = new XQuery( "\n" + " declare function local:two-digit($number as xs:integer) { \n" + " let $string := string($number) \n" + " return if (string-length($string) lt 2) then concat('0', $string) else $string \n" + " }; \n" + " declare function local:dateTime($year as xs:integer, $month as xs:integer, $day as xs:integer, $hour as xs:integer, $mins as xs:integer) { \n" + " let $m := local:two-digit($month), $d := local:two-digit($day), $h := local:two-digit($hour), $n := local:two-digit($mins) \n" + " return xs:dateTime(concat($year, '-', $m, '-', $d, 'T', $h, ':', $n, ':00')) \n" + " }; \n" + " xs:yearMonthDuration(\"P0Y\") + local:dateTime(2008, 05, 12, 12, 59)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2008-05-12T12:59:00") ); } /** * test addition of zero duration to dateTime . */ @org.junit.Test public void cbclAddYearMonthDurationToDateTime002() { final XQuery query = new XQuery( "\n" + " declare function local:two-digit($number as xs:integer) { \n" + " let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string \n" + " }; \n" + " declare function local:dateTime($year as xs:integer, $month as xs:integer, $day as xs:integer, $hour as xs:integer, $mins as xs:integer) { \n" + " let $m := local:two-digit($month), $d := local:two-digit($day), $h := local:two-digit($hour), $n := local:two-digit($mins) \n" + " return xs:dateTime(concat($year, '-', $m, '-', $d, 'T', $h, ':', $n, ':00')) \n" + " }; \n" + " local:dateTime(2008, 05, 12, 12, 59) + xs:yearMonthDuration(\"P0Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2008-05-12T12:59:00") ); } /** * test addition of large duration to dateTime . */ @org.junit.Test public void cbclAddYearMonthDurationToDateTime003() { final XQuery query = new XQuery( "\n" + " declare function local:two-digit($number as xs:integer) { \n" + " let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string \n" + " }; \n" + " declare function local:dateTime($year as xs:integer, $month as xs:integer, $day as xs:integer, $hour as xs:integer, $mins as xs:integer) { \n" + " let $m := local:two-digit($month), $d := local:two-digit($day), $h := local:two-digit($hour), $n := local:two-digit($mins) \n" + " return xs:dateTime(concat($year, '-', $m, '-', $d, 'T', $h, ':', $n, ':00')) \n" + " }; \n" + " local:dateTime(2008, 05, 12, 12, 59) + xs:yearMonthDuration(\"P4026720960Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "4026722968-05-12T12:59:00") || error("FODT0002") ) ); } /** * date: July 5, 2005 Evaluates The "add-yearMonthDuration-to-dateTime" operator As per example 1 (for this function)of the F&O specs. . */ @org.junit.Test public void opAddYearMonthDurationToDateTime1() { final XQuery query = new XQuery( "xs:dateTime(\"2000-10-30T11:12:00\") + xs:yearMonthDuration(\"P1Y2M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2001-12-30T11:12:00") ); } /** * date: July 5, 2005 Evaluates The string value of the "add-yearMonthDuration-to-dateTime" operator used together with an "or" expression. . */ @org.junit.Test public void opAddYearMonthDurationToDateTime10() { final XQuery query = new XQuery( "fn:string((xs:dateTime(\"1985-07-05T09:09:09Z\") + xs:yearMonthDuration(\"P02Y02M\"))) or fn:string((xs:dateTime(\"1985-07-05T09:09:09Z\") + xs:yearMonthDuration(\"P02Y02M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * date: July 5, 2005 Evaluates The string value of the "add-yearMonthDuration-to-dateTime" operator used with a boolean expression and the "fn:true" function. . */ @org.junit.Test public void opAddYearMonthDurationToDateTime12() { final XQuery query = new XQuery( "fn:string((xs:dateTime(\"1980-03-02T02:02:02Z\") + xs:yearMonthDuration(\"P05Y05M\"))) and (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * date: July 5, 2005 Evaluates The "add-yearMonthDuration-to-dateTime" operator used together with the numeric-equal-operator "eq". . */ @org.junit.Test public void opAddYearMonthDurationToDateTime13() { final XQuery query = new XQuery( "(xs:dateTime(\"1980-05-05T05:05:05Z\") + xs:yearMonthDuration(\"P23Y11M\")) eq xs:dateTime(\"1980-05-05T05:05:05Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * date: July 5, 2005 Evaluates The "add-yearMonthDuration-to-dateTime" operator used together with the numeric-equal operator "ne". . */ @org.junit.Test public void opAddYearMonthDurationToDateTime14() { final XQuery query = new XQuery( "(xs:dateTime(\"1979-12-12T09:09:09Z\") + xs:yearMonthDuration(\"P08Y08M\")) ne xs:dateTime(\"1979-12-12T09:09:09Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * date: July 5, 2005 Evaluates The "add-yearMonthDuration-to-dateTime" operator used together with the numeric-equal operator "le". . */ @org.junit.Test public void opAddYearMonthDurationToDateTime15() { final XQuery query = new XQuery( "(xs:dateTime(\"1978-12-12T07:07:07Z\") + xs:yearMonthDuration(\"P17Y12M\")) le xs:dateTime(\"1978-12-12T07:07:07Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * date: July 5, 2005 Evaluates The "add-yearMonthDuration-to-dateTime" operator used together with the numeric-equal operator "ge". . */ @org.junit.Test public void opAddYearMonthDurationToDateTime16() { final XQuery query = new XQuery( "(xs:dateTime(\"1977-12-12T03:03:03Z\") + xs:yearMonthDuration(\"P18Y02M\")) ge xs:dateTime(\"1977-12-12T03:03:03Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * date: July 5, 2005 Evaluates The string value of "add-dayTimeDuration-to-dateTime" operator used as part of a boolean expression (and operator) and the "fn:false" function. . */ @org.junit.Test public void opAddYearMonthDurationToDateTime2() { final XQuery query = new XQuery( "fn:string(xs:dateTime(\"2000-12-12T12:12:12Z\") + xs:dayTimeDuration(\"P12DT10H07M\")) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * date: July 5, 2005 Evaluates The string value of "add-yearMonthDuration-to-dateTime" operator as part of a boolean expression (or operator) and the "fn:boolean" function. . */ @org.junit.Test public void opAddYearMonthDurationToDateTime3() { final XQuery query = new XQuery( "fn:string((xs:dateTime(\"1999-10-23T13:45:45Z\") + xs:yearMonthDuration(\"P19Y12M\"))) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * date: July 5, 2005 Evaluates The string value of the "add-yearMonthDuration-to-dateTime" operator that return true and used together with fn:not. . */ @org.junit.Test public void opAddYearMonthDurationToDateTime4() { final XQuery query = new XQuery( "fn:not(fn:string(xs:dateTime(\"1998-09-12T13:56:12Z\") + xs:yearMonthDuration(\"P20Y03M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * date: July 5, 2005 Evaluates The "add-yearMonthDuration-to-dateTime" operator that is used as an argument to the fn:number function. . */ @org.junit.Test public void opAddYearMonthDurationToDateTime6() { final XQuery query = new XQuery( "fn:number(xs:dateTime(\"1988-01-28T13:45:23Z\") + xs:yearMonthDuration(\"P09Y02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * date: July 5, 2005 Evaluates The "add-yearMonthDuration-to-dateTime" operator used as an argument to the "fn:string" function). . */ @org.junit.Test public void opAddYearMonthDurationToDateTime7() { final XQuery query = new XQuery( "fn:string(xs:dateTime(\"1989-07-05T14:34:36Z\") + xs:yearMonthDuration(\"P08Y04M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1997-11-05T14:34:36Z") ); } /** * date: July 8, 2005 Evaluates The "add-yearMonthDuration-to-dateTime" operator that returns a negative value. . */ @org.junit.Test public void opAddYearMonthDurationToDateTime8() { final XQuery query = new XQuery( "(xs:dateTime(\"0001-01-01T01:01:01Z\") + xs:yearMonthDuration(\"-P20Y07M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "-0021-06-01T01:01:01Z") || assertStringValue(false, "-0020-06-01T01:01:01Z") ) ); } /** * date: July 5, 2005 Evaluates The string value of the "add-yearMonthDuration-to-dateTime" operator used together with an "and" expression. . */ @org.junit.Test public void opAddYearMonthDurationToDateTime9() { final XQuery query = new XQuery( "fn:string((xs:dateTime(\"1993-12-09T10:10:10Z\") + xs:yearMonthDuration(\"P03Y03M\"))) and fn:string((xs:dateTime(\"1993-12-09T10:10:10Z\") + xs:yearMonthDuration(\"P03Y03M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:add-yearMonthDuration-to-dateTime" operator with the arguments set as follows: $arg1 = xs:dateTime(lower bound) $arg2 = xs:yearMonthDuration(lower bound) . */ @org.junit.Test public void opAddYearMonthDurationToDateTime2args1() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") + xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1970-01-01T00:00:00Z") ); } /** * Evaluates The "op:add-yearMonthDuration-to-dateTime" operator with the arguments set as follows: $arg1 = xs:dateTime(mid range) $arg2 = xs:yearMonthDuration(lower bound) . */ @org.junit.Test public void opAddYearMonthDurationToDateTime2args2() { final XQuery query = new XQuery( "xs:dateTime(\"1996-04-07T01:40:52Z\") + xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1996-04-07T01:40:52Z") ); } /** * Evaluates The "op:add-yearMonthDuration-to-dateTime" operator with the arguments set as follows: $arg1 = xs:dateTime(upper bound) $arg2 = xs:yearMonthDuration(lower bound) . */ @org.junit.Test public void opAddYearMonthDurationToDateTime2args3() { final XQuery query = new XQuery( "xs:dateTime(\"2030-12-31T23:59:59Z\") + xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2030-12-31T23:59:59Z") ); } /** * Evaluates The "op:add-yearMonthDuration-to-dateTime" operator with the arguments set as follows: $arg1 = xs:dateTime(lower bound) $arg2 = xs:yearMonthDuration(mid range) . */ @org.junit.Test public void opAddYearMonthDurationToDateTime2args4() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") + xs:yearMonthDuration(\"P1000Y6M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2970-07-01T00:00:00Z") ); } /** * Evaluates The "op:add-yearMonthDuration-to-dateTime" operator with the arguments set as follows: $arg1 = xs:dateTime(lower bound) $arg2 = xs:yearMonthDuration(upper bound) . */ @org.junit.Test public void opAddYearMonthDurationToDateTime2args5() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") + xs:yearMonthDuration(\"P2030Y12M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4001-01-01T00:00:00Z") ); } /** * date: July 5, 2005 Evaluates The string value of the "add-yearMonthDuration-to-dateTime" operator that is used as an argument to the fn:boolean function. . */ @org.junit.Test public void opAddYearMonthDurationToDateTimealt5() { final XQuery query = new XQuery( "fn:boolean(fn:string(xs:dateTime(\"1962-03-12T10:12:34Z\") + xs:yearMonthDuration(\"P10Y01M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpAddYearMonthDurations.java����������0000664�0000000�0000000�00000060427�12224530032�0031502�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the add-yearMonthDurations() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpAddYearMonthDurations extends QT3TestSet { /** * * ******************************************************* * Test: K-YearMonthDurationAdd-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of adding an xs:yearMonthDuration with P0M. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationAdd1() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P3Y3M\") + xs:yearMonthDuration(\"P0M\") eq xs:yearMonthDuration(\"P3Y3M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-YearMonthDurationAdd-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of adding P0M with an xs:yearMonthDuration. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationAdd2() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0M\") + xs:yearMonthDuration(\"P3Y3M\") eq xs:yearMonthDuration(\"P3Y3M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-YearMonthDurationAdd-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of adding two arbitrary xs:yearMonthDurations. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationAdd3() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P32Y43M\") + xs:yearMonthDuration(\"P12Y13M\") eq xs:yearMonthDuration(\"P48Y8M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test addition of zero duration to yearMonthDuration . */ @org.junit.Test public void cbclAddYearMonthDurations001() { final XQuery query = new XQuery( "\n" + " declare function local:yearMonthDuration($years as xs:integer, $months as xs:integer ) { xs:yearMonthDuration(concat('P', $years, 'Y', $months, 'M')) };\n" + " local:yearMonthDuration(1, 1) + xs:yearMonthDuration(\"P0Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1Y1M") ); } /** * test addition of zero duration to yearMonthDuration . */ @org.junit.Test public void cbclAddYearMonthDurations002() { final XQuery query = new XQuery( "\n" + " declare function local:yearMonthDuration($years as xs:integer, $months as xs:integer ) { xs:yearMonthDuration(concat('P', $years, 'Y', $months, 'M')) };\n" + " xs:yearMonthDuration(\"P0Y\") + local:yearMonthDuration(1, 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1Y1M") ); } /** * test addition of zero duration to yearMonthDuration . */ @org.junit.Test public void cbclAddYearMonthDurations003() { final XQuery query = new XQuery( "\n" + " declare function local:yearMonthDuration($years as xs:integer, $months as xs:integer ) { xs:yearMonthDuration(concat('P', $years, 'Y', $months, 'M')) };\n" + " local:yearMonthDuration(1, 1) + local:yearMonthDuration(1, 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P2Y2M") ); } /** * * ******************************************************* * Test: op-add-yearMonthDurations-1 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-yearMonthDurations" function * As per example 1 (for this function)of the F&O specs. * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurations1() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P2Y11M\") + xs:yearMonthDuration(\"P3Y3M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P6Y2M") ); } /** * * ******************************************************* * Test: op-add-yearMonthDurations-10 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-yearMonthDurations" function used * together with an "or" expression. * Apply "fn:string" function to account for new EBV. * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurations10() { final XQuery query = new XQuery( "fn:string((xs:yearMonthDuration(\"P05Y02M\") + xs:yearMonthDuration(\"P03Y04M\"))) or fn:string((xs:yearMonthDuration(\"P05Y03M\") + xs:yearMonthDuration(\"P01Y03M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-yearMonthDurations-11 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-yearMonthDurations" function used * together with a "div" expression. * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurations11() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P42Y10M\") + xs:yearMonthDuration(\"P28Y10M\")) div (xs:yearMonthDuration(\"P10Y10M\") + xs:yearMonthDuration(\"P60Y10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * * ******************************************************* * Test: op-add-yearMonthDurations-12 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-yearMonthDurations" operators used * with a boolean expression and the "fn:true" function. * Apply "fn:string" function to account for new EBV. * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurations12() { final XQuery query = new XQuery( "fn:string((xs:yearMonthDuration(\"P10Y11M\") + xs:yearMonthDuration(\"P05Y07M\"))) and (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-yearMonthDurations-13 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-yearMonthDurations" function used * together with the numeric-equal- operator "eq". * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurations13() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P23Y11M\") + xs:yearMonthDuration(\"P23Y11M\")) eq xs:yearMonthDuration(\"P23Y11M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-add-yearMonthDurations-14 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-yearMonthDurations" function used * together with the numeric-equal operator "ne". * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurations14() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P21Y12M\") + xs:yearMonthDuration(\"P08Y05M\")) ne xs:yearMonthDuration(\"P08Y05M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-yearMonthDurations-15 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-yearMonthDurations" function used * together with the numeric-equal operator "le". * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurations15() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P10Y01M\") + xs:yearMonthDuration(\"P17Y02M\")) le xs:yearMonthDuration(\"P17Y02M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-add-yearMonthDurations-16 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-yearMonthDurations" function used * together with the numeric-equal operator "ge". * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurations16() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P13Y09M\") + xs:yearMonthDuration(\"P18Y02M\")) ge xs:yearMonthDuration(\"P18Y02M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-yearMonthDurations-2 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-yearMonthDurations" function * used as part of a boolean expression (and operator) and the "fn:false" function. * Apply "fn:string" function to account for new EBV. * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurations2() { final XQuery query = new XQuery( "fn:string(xs:yearMonthDuration(\"P10Y11M\") + xs:yearMonthDuration(\"P12Y07M\")) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-add-yearMonthDurations-3 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-yearMonthDurations" function as * part of a boolean expression (or operator) and the "fn:boolean" function. * Apply "fn:string" function to account for new EBV. * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurations3() { final XQuery query = new XQuery( "fn:string(xs:yearMonthDuration(\"P20Y10M\") + xs:yearMonthDuration(\"P19Y10M\")) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-yearMonthDurations-4 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-yearMonthDurations" function that * return true and used together with fn:not. * Apply "fn:string" function to account for new EBV. * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurations4() { final XQuery query = new XQuery( "fn:not(fn:string(xs:yearMonthDuration(\"P11Y04M\") + xs:yearMonthDuration(\"P02Y11M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-add-yearMonthDurations-5 * Written By: Carmelo Montanez * Date: June 29 2005 * Purpose: Evaluates The "add-yearMonthDurations" function that * is used as an argument to the fn:boolean function. * Apply "fn:string" function to account for new EBV. * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurations5() { final XQuery query = new XQuery( "fn:boolean(fn:string(xs:yearMonthDuration(\"P05Y08M\") + xs:yearMonthDuration(\"P03Y06M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-yearMonthDurations-6 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-yearMonthDurations" operator that * is used as an argument to the fn:number function. * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurations6() { final XQuery query = new XQuery( "fn:number(xs:yearMonthDuration(\"P02Y09M\") + xs:yearMonthDuration(\"P10Y01M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * * ******************************************************* * Test: op-add-yearMonthDurations-7 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-yearMonthDurations" function used * as an argument to the "fn:string" function). * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurations7() { final XQuery query = new XQuery( "fn:string(xs:yearMonthDuration(\"P03Y08M\") + xs:yearMonthDuration(\"P01Y02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P4Y10M") ); } /** * * ******************************************************* * Test: op-add-yearMonthDurations-8 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-yearMonthDurations" function that * returns a negative value. * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurations8() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P10Y01M\") + xs:yearMonthDuration(\"-P11Y02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P1Y1M") ); } /** * * ******************************************************* * Test: op-add-yearMonthDurations-9 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "add-yearMonthDurations" function used * together with and "and" expression. * Apply "fn:string" function to account for new EBV. * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurations9() { final XQuery query = new XQuery( "fn:string((xs:yearMonthDuration(\"P01Y01M\") + xs:yearMonthDuration(\"P02Y02M\"))) and fn:string((xs:yearMonthDuration(\"P02Y03M\") + xs:yearMonthDuration(\"P04Y04M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-add-yearMonthDurations2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-yearMonthDurations" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(lower bound) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurations2args1() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") + xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P0M") ); } /** * * ******************************************************* * Test: op-add-yearMonthDurations2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-yearMonthDurations" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(mid range) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurations2args2() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1000Y6M\") + xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1000Y6M") ); } /** * * ******************************************************* * Test: op-add-yearMonthDurations2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-yearMonthDurations" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(upper bound) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurations2args3() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P2030Y12M\") + xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P2031Y") ); } /** * * ******************************************************* * Test: op-add-yearMonthDurations2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-yearMonthDurations" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(lower bound) * $arg2 = xs:yearMonthDuration(mid range) * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurations2args4() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") + xs:yearMonthDuration(\"P1000Y6M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1000Y6M") ); } /** * * ******************************************************* * Test: op-add-yearMonthDurations2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:add-yearMonthDurations" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(lower bound) * $arg2 = xs:yearMonthDuration(upper bound) * ******************************************************* * . */ @org.junit.Test public void opAddYearMonthDurations2args5() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") + xs:yearMonthDuration(\"P2030Y12M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P2031Y") ); } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpAnyURIEqual.java��������������������0000664�0000000�0000000�00000025012�12224530032�0027360�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the anyURI-equal operator (not actually defined as such in F+O). * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpAnyURIEqual extends QT3TestSet { /** * A test whose essence is: `xs:anyURI("example.com/") eq xs:anyURI("example.com/")`. . */ @org.junit.Test public void kAnyURIEqual1() { final XQuery query = new XQuery( "xs:anyURI(\"example.com/\") eq xs:anyURI(\"example.com/\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:untypedAtomic("example.com/") ne xs:anyURI("example.com/No")`. . */ @org.junit.Test public void kAnyURIEqual10() { final XQuery query = new XQuery( "xs:untypedAtomic(\"example.com/\") ne xs:anyURI(\"example.com/No\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:anyURI("example.com/") ne xs:anyURI("example.com/No")`. . */ @org.junit.Test public void kAnyURIEqual2() { final XQuery query = new XQuery( "xs:anyURI(\"example.com/\") ne xs:anyURI(\"example.com/No\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:anyURI("example.com/") eq xs:string("example.com/")`. . */ @org.junit.Test public void kAnyURIEqual3() { final XQuery query = new XQuery( "xs:anyURI(\"example.com/\") eq xs:string(\"example.com/\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string("example.com/") eq xs:anyURI("example.com/")`. . */ @org.junit.Test public void kAnyURIEqual4() { final XQuery query = new XQuery( "xs:string(\"example.com/\") eq xs:anyURI(\"example.com/\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:anyURI("example.com/") ne xs:string("example.com/No")`. . */ @org.junit.Test public void kAnyURIEqual5() { final XQuery query = new XQuery( "xs:anyURI(\"example.com/\") ne xs:string(\"example.com/No\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string("example.com/") ne xs:anyURI("example.com/No")`. . */ @org.junit.Test public void kAnyURIEqual6() { final XQuery query = new XQuery( "xs:string(\"example.com/\") ne xs:anyURI(\"example.com/No\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:anyURI("example.com/") eq xs:untypedAtomic("example.com/")`. . */ @org.junit.Test public void kAnyURIEqual7() { final XQuery query = new XQuery( "xs:anyURI(\"example.com/\") eq xs:untypedAtomic(\"example.com/\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:untypedAtomic("example.com/") eq xs:anyURI("example.com/")`. . */ @org.junit.Test public void kAnyURIEqual8() { final XQuery query = new XQuery( "xs:untypedAtomic(\"example.com/\") eq xs:anyURI(\"example.com/\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:anyURI("example.com/") ne xs:untypedAtomic("example.com/No")`. . */ @org.junit.Test public void kAnyURIEqual9() { final XQuery query = new XQuery( "xs:anyURI(\"example.com/\") ne xs:untypedAtomic(\"example.com/No\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'eq' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURIEqual1() { final XQuery query = new XQuery( "xs:string(\"http://example.com/A\") eq xs:anyURI(\"http://example.com/A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'ne' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURIEqual10() { final XQuery query = new XQuery( "xs:anyURI(\"http://example.com/A\") ne xs:string(\"http://example.com/B\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'ne' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURIEqual11() { final XQuery query = new XQuery( "xs:string(\"http://example.com/A\") ne xs:anyURI(\"http://example.com/B\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'ne' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURIEqual12() { final XQuery query = new XQuery( "xs:anyURI(\"http://example.com/A\") ne xs:anyURI(\"http://example.com/B\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'eq' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURIEqual2() { final XQuery query = new XQuery( "xs:anyURI(\"http://example.com/A\") eq xs:string(\"http://example.com/A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'eq' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURIEqual3() { final XQuery query = new XQuery( "xs:anyURI(\"http://example.com/A\") eq xs:anyURI(\"http://example.com/A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'eq' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURIEqual4() { final XQuery query = new XQuery( "not(xs:string(\"http://example.com/A\") eq xs:anyURI(\"http://example.com/B\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'eq' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURIEqual5() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://example.com/A\") eq xs:string(\"http://example.com/B\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'eq' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURIEqual6() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://example.com/A\") eq xs:anyURI(\"http://example.com/B\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'ne' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURIEqual7() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://example.com/A\") ne xs:string(\"http://example.com/A\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'ne' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURIEqual8() { final XQuery query = new XQuery( "not(xs:string(\"http://example.com/A\") ne xs:anyURI(\"http://example.com/A\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'ne' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURIEqual9() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://example.com/A\") ne xs:anyURI(\"http://example.com/A\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpAnyURIGreaterThan.java��������������0000664�0000000�0000000�00000011447�12224530032�0030524�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the anyURI-greater-than operator (not actually defined as such in F+O). * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpAnyURIGreaterThan extends QT3TestSet { /** * Invoked 'le' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURILeGe1() { final XQuery query = new XQuery( "xs:anyURI(\"http://example.com/A\") le xs:anyURI(\"http://example.com/B\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'gt' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURILeGe10() { final XQuery query = new XQuery( "xs:anyURI(\"http://example.com/B\") gt xs:string(\"http://example.com/A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'le' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURILeGe2() { final XQuery query = new XQuery( "xs:anyURI(\"http://example.com/A\") le xs:anyURI(\"http://example.com/A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'le' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURILeGe3() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://example.com/B\") le xs:anyURI(\"http://example.com/A\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'gt' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURILeGe4() { final XQuery query = new XQuery( "xs:anyURI(\"http://example.com/B\") ge xs:anyURI(\"http://example.com/A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'gt' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURILeGe5() { final XQuery query = new XQuery( "xs:anyURI(\"http://example.com/B\") gt xs:anyURI(\"http://example.com/A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'gt' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURILeGe6() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://example.com/A\") gt xs:anyURI(\"http://example.com/B\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'le' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURILeGe7() { final XQuery query = new XQuery( "xs:string(\"http://example.com/A\") le xs:anyURI(\"http://example.com/A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'le' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURILeGe8() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://example.com/B\") le xs:string(\"http://example.com/A\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'gt' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURILeGe9() { final XQuery query = new XQuery( "xs:string(\"http://example.com/B\") gt xs:anyURI(\"http://example.com/A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpAnyURILessThan.java�����������������0000664�0000000�0000000�00000007633�12224530032�0030043�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the anyURI-less-than operator (not actually defined as such in F+O). * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpAnyURILessThan extends QT3TestSet { /** * Invoked 'lt' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURILtGt1() { final XQuery query = new XQuery( "xs:anyURI(\"http://example.com/A\") lt xs:anyURI(\"http://example.com/B\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'lt' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURILtGt2() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://example.com/B\") lt xs:anyURI(\"http://example.com/A\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'lt' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURILtGt3() { final XQuery query = new XQuery( "xs:string(\"http://example.com/A\") lt xs:anyURI(\"http://example.com/B\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'lt' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURILtGt4() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://example.com/B\") lt xs:string(\"http://example.com/A\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'gt' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURILtGt5() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://example.com/A\") gt xs:anyURI(\"http://example.com/B\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'gt' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURILtGt6() { final XQuery query = new XQuery( "not(xs:string(\"http://example.com/A\") gt xs:anyURI(\"http://example.com/B\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'gt' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURILtGt7() { final XQuery query = new XQuery( "xs:anyURI(\"http://example.com/B\") gt xs:anyURI(\"http://example.com/A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoked 'gt' on xs:anyURI values. . */ @org.junit.Test public void k2AnyURILtGt8() { final XQuery query = new XQuery( "xs:anyURI(\"http://example.com/B\") gt xs:string(\"http://example.com/A\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } �����������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpBang.java���������������������������0000664�0000000�0000000�00000015161�12224530032�0026134�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the "!" simple mapping operator (new in XPath 3.0).. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpBang extends QT3TestSet { /** * Simple mapping of atomic sequence. */ @org.junit.Test public void bang1() { final XQuery query = new XQuery( "(1 to 10)!(.*.)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1, 4, 9, 16, 25, 36, 49, 64, 81, 100") ); } /** * rhs of "!" operator returning a sequence. */ @org.junit.Test public void bang10() { final XQuery query = new XQuery( "(1 to 5) ! (1 to .)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1, 1,2, 1,2,3, 1,2,3,4, 1,2,3,4,5") ); } /** * "!" is not associative when position() is used. */ @org.junit.Test public void bang11() { final XQuery query = new XQuery( "(1 to 5) ! ((1 to .) ! position())", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1, 1,2, 1,2,3, 1,2,3,4, 1,2,3,4,5") ); } /** * "!" is not associative when position() is used. */ @org.junit.Test public void bang12() { final XQuery query = new XQuery( "(1 to 5) ! (1 to .) ! position()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1 to 15") ); } /** * backwards-axes semantics of [position()] work with "!" operator. */ @org.junit.Test public void bang13() { final XQuery query = new XQuery( "/ works ! employee[4] ! preceding-sibling::*[1] ! string(@name) ", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"Jane Doe 3\"") ); } /** * Interaction of "!" with "/". */ @org.junit.Test public void bang14() { final XQuery query = new XQuery( "count(/ ! works)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Simple mapping of atomic sequence. */ @org.junit.Test public void bang2() { final XQuery query = new XQuery( "(\"red\", \"blue\", \"green\")!string-length()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("3, 4, 5") ); } /** * Simple mapping with position() function. */ @org.junit.Test public void bang3() { final XQuery query = new XQuery( "(\"red\", \"blue\", \"green\")!position()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1, 2, 3") ); } /** * Simple mapping with last() function. */ @org.junit.Test public void bang4() { final XQuery query = new XQuery( "(\"red\", \"blue\", \"green\")!(position() = last())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("false(), false(), true()") ); } /** * Simple mapping path. */ @org.junit.Test public void bang5() { final XQuery query = new XQuery( "(\"red\", \"blue\", \"green\") ! string-length() ! (.+1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("4, 5, 6") ); } /** * Simple mapping with nodes: no sorting into document order or deduplication. */ @org.junit.Test public void bang6() { final XQuery query = new XQuery( "(/works/employee[2], /works/employee[1], /works/employee[2]) ! @name ! string()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"John Doe 2\", \"Jane Doe 1\", \"John Doe 2\"") ); } /** * Precedence of "!" is less than "[]". */ @org.junit.Test public void bang7() { final XQuery query = new XQuery( "/ works ! employee[2] ! hours[2] ! number()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("20") ); } /** * Precedence of "!" is greater than "+". */ @org.junit.Test public void bang8() { final XQuery query = new XQuery( "2 + (/ works ! employee[2] ! hours[2]) ! number() ! (-.)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-18") ); } /** * Precedence of "!" is greater than unary "-". */ @org.junit.Test public void bang9() { final XQuery query = new XQuery( "-2!(.+1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-3") ); } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpBase64BinaryEqual.java��������������0000664�0000000�0000000�00000071243�12224530032�0030451�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the base64Binary-equal() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpBase64BinaryEqual extends QT3TestSet { /** * * ******************************************************* * Test: K-Base64BinaryEQ-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `xs:base64Binary(xs:hexBinary("03")) eq xs:base64Binary(xs:hexBinary("03"))`. * ******************************************************* * . */ @org.junit.Test public void kBase64BinaryEQ1() { final XQuery query = new XQuery( "xs:base64Binary(xs:hexBinary(\"03\")) eq xs:base64Binary(xs:hexBinary(\"03\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-Base64BinaryEQ-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `xs:base64Binary(xs:hexBinary("03")) ne xs:base64Binary(xs:hexBinary("13"))`. * ******************************************************* * . */ @org.junit.Test public void kBase64BinaryEQ2() { final XQuery query = new XQuery( "xs:base64Binary(xs:hexBinary(\"03\")) ne xs:base64Binary(xs:hexBinary(\"13\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-Base64BinaryEQ-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `xs:hexBinary(xs:base64Binary("/w==")) eq xs:hexBinary("FF")`. * ******************************************************* * . */ @org.junit.Test public void kBase64BinaryEQ3() { final XQuery query = new XQuery( "xs:hexBinary(xs:base64Binary(\"/w==\")) eq xs:hexBinary(\"FF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Test: base64BinaryEqual-1 * Description: Simple base 64 binary operation as part of a * logical expression. Use "and" and "eq" operators. * . */ @org.junit.Test public void base64BinaryEqual1() { final XQuery query = new XQuery( "(xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\") eq xs:base64Binary(\"d2J1bnB0Y3lucWtvYXdpb2xoZWNwZXlkdG90eHB3ZXJqcnliZXFubmJjZXBmbGx3aGN3cmNndG9xb2hvdHdlY2pzZ3h5bnlp\")) and (xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\") eq xs:base64Binary(\"d2J1bnB0Y3lucWtvYXdpb2xoZWNwZXlkdG90eHB3ZXJqcnliZXFubmJjZXBmbGx3aGN3cmNndG9xb2hvdHdlY2pzZ3h5bnlp\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Test: base64BinaryEqual-10 * Description: Simple opeartion involving xs:base64Binary values as part of argument to "fn:not" function. * . */ @org.junit.Test public void base64BinaryEqual10() { final XQuery query = new XQuery( "fn:not(xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\") ne xs:base64Binary(\"d2J1bnB0Y3lucWtvYXdpb2xoZWNwZXlkdG90eHB3ZXJqcnliZXFubmJjZXBmbGx3aGN3cmNndG9xb2hvdHdlY2pzZ3h5bnlp\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Test: base64BinaryEqual-11 * Description: Simple operation involving xs:base64Binary values as part of a * logical expression. Use "and" and "ne" operators with "fn:true" function. * . */ @org.junit.Test public void base64BinaryEqual11() { final XQuery query = new XQuery( "(xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\") ne xs:base64Binary(\"d2J1bnB0Y3lucWtvYXdpb2xoZWNwZXlkdG90eHB3ZXJqcnliZXFubmJjZXBmbGx3aGN3cmNndG9xb2hvdHdlY2pzZ3h5bnlp\")) and fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Test: base64BinaryEqual-12 * Description: Simple operation involving base64Binary values as part of a * logical expression. Use "and" and "ne" operators with "fn:false" function. * . */ @org.junit.Test public void base64BinaryEqual12() { final XQuery query = new XQuery( "(xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\") ne xs:base64Binary(\"d2J1bnB0Y3lucWtvYXdpb2xoZWNwZXlkdG90eHB3ZXJqcnliZXFubmJjZXBmbGx3aGN3cmNndG9xb2hvdHdlY2pzZ3h5bnlp\")) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Test: base64BinaryEqual-13 * Description: Simple operation involving xs:base64Binary values used as part of a * logical expression. Use "or" and "ne" operators and "fn:true" function. * . */ @org.junit.Test public void base64BinaryEqual13() { final XQuery query = new XQuery( "(xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\") ne xs:base64Binary(\"d2J1bnB0Y3lucWtvYXdpb2xoZWNwZXlkdG90eHB3ZXJqcnliZXFubmJjZXBmbGx3aGN3cmNndG9xb2hvdHdlY2pzZ3h5bnlp\")) or fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Test: base64BinaryEqual-14 * Description: Simple operation involving xs:base64Binary values used as part of a * logical expression. Use "or" and "ne" operators and "fn:false" function. * . */ @org.junit.Test public void base64BinaryEqual14() { final XQuery query = new XQuery( "(xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\") ne xs:base64Binary(\"d2J1bnB0Y3lucWtvYXdpb2xoZWNwZXlkdG90eHB3ZXJqcnliZXFubmJjZXBmbGx3aGN3cmNndG9xb2hvdHdlY2pzZ3h5bnlp\")) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Test: base64BinaryEqual-2 * Description: Simple base 64 Binary operation as part of a * logical expression. Use "or" and "eq" operators. * . */ @org.junit.Test public void base64BinaryEqual2() { final XQuery query = new XQuery( "xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\") eq xs:base64Binary(\"d2J1bnB0Y3lucWtvYXdpb2xoZWNwZXlkdG90eHB3ZXJqcnliZXFubmJjZXBmbGx3aGN3cmNndG9xb2hvdHdlY2pzZ3h5bnlp\") or xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\") eq xs:base64Binary(\"d2J1bnB0Y3lucWtvYXdpb2xoZWNwZXlkdG90eHB3ZXJqcnliZXFubmJjZXBmbGx3aGN3cmNndG9xb2hvdHdlY2pzZ3h5bnlp\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Test: base54BinaryEqual-3 * Description: Simple base 64 binary operation as part of argument to fn:not function. * . */ @org.junit.Test public void base64BinaryEqual3() { final XQuery query = new XQuery( "fn:not(xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\") eq xs:base64Binary(\"d2J1bnB0Y3lucWtvYXdpb2xoZWNwZXlkdG90eHB3ZXJqcnliZXFubmJjZXBmbGx3aGN3cmNndG9xb2hvdHdlY2pzZ3h5bnlp\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Test: base64BinaryEqual-4 * Description: Simple operation with xs:base64binary values as part of a * logical expression. Use "and" and "eq" operators with "fn:true" function. * . */ @org.junit.Test public void base64BinaryEqual4() { final XQuery query = new XQuery( "(xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\") eq xs:base64Binary(\"d2J1bnB0Y3lucWtvYXdpb2xoZWNwZXlkdG90eHB3ZXJqcnliZXFubmJjZXBmbGx3aGN3cmNndG9xb2hvdHdlY2pzZ3h5bnlp\")) and fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Test: base64BinaryEqual-6 * Description: Simple operation using xs:base64Binary values as part of a * logical expression. Use "or" and "eq" operators and "fn:true" function. * . */ @org.junit.Test public void base64BinaryEqual6() { final XQuery query = new XQuery( "(xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\") eq xs:base64Binary(\"d2J1bnB0Y3lucWtvYXdpb2xoZWNwZXlkdG90eHB3ZXJqcnliZXFubmJjZXBmbGx3aGN3cmNndG9xb2hvdHdlY2pzZ3h5bnlp\")) or fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Test: base64BinaryEqual-7 * Description: Simple operation using xs:base64Binary values as part of a * logical expression. Use "or" and "eq" operators and "fn:false" function. * . */ @org.junit.Test public void base64BinaryEqual7() { final XQuery query = new XQuery( "(xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\") eq xs:base64Binary(\"d2J1bnB0Y3lucWtvYXdpb2xoZWNwZXlkdG90eHB3ZXJqcnliZXFubmJjZXBmbGx3aGN3cmNndG9xb2hvdHdlY2pzZ3h5bnlp\")) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Test: base64BinaryEqual-8 * Description: Simple operation involving xs:base64Binary values as part of a * logical expression. Use "and" and "ne" operators. * . */ @org.junit.Test public void base64BinaryEqual8() { final XQuery query = new XQuery( "(xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\") eq xs:base64Binary(\"d2J1bnB0Y3lucWtvYXdpb2xoZWNwZXlkdG90eHB3ZXJqcnliZXFubmJjZXBmbGx3aGN3cmNndG9xb2hvdHdlY2pzZ3h5bnlp\")) and (xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\") eq xs:base64Binary(\"d2J1bnB0Y3lucWtvYXdpb2xoZWNwZXlkdG90eHB3ZXJqcnliZXFubmJjZXBmbGx3aGN3cmNndG9xb2hvdHdlY2pzZ3h5bnlp\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Test: base64BinaryEqual-9 * Description: Simple operation involving xs:base64Binary values as part of a * logical expression. Use "and" and "ne" operators. * . */ @org.junit.Test public void base64BinaryEqual9() { final XQuery query = new XQuery( "(xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\") ne xs:base64Binary(\"d2J1bnB0Y3lucWtvYXdpb2xoZWNwZXlkdG90eHB3ZXJqcnliZXFubmJjZXBmbGx3aGN3cmNndG9xb2hvdHdlY2pzZ3h5bnlp\")) or (xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\") ne xs:base64Binary(\"d2J1bnB0Y3lucWtvYXdpb2xoZWNwZXlkdG90eHB3ZXJqcnliZXFubmJjZXBmbGx3aGN3cmNndG9xb2hvdHdlY2pzZ3h5bnlp\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Test: base64BinaryEqual-5 * Description: Simple operation involving xs:base64Binary values as part of a * logical expression. Use "and" and "eq" operators with "fn:false" function. * . */ @org.junit.Test public void base64binaryequal5() { final XQuery query = new XQuery( "(xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\") eq xs:base64Binary(\"d2J1bnB0Y3lucWtvYXdpb2xoZWNwZXlkdG90eHB3ZXJqcnliZXFubmJjZXBmbGx3aGN3cmNndG9xb2hvdHdlY2pzZ3h5bnlp\")) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Name: cbcl-base64Binary-equal-001 * Description: test equality of xs:base64Binary * Author: Tim Mills * Date: 2008-05-14 * . */ @org.junit.Test public void cbclBase64BinaryEqual001() { final XQuery query = new XQuery( "\n" + " declare function local:base64Binary-value($arg as xs:boolean) as xs:base64Binary { \n" + " \tif ($arg) then xs:base64Binary('aGVsbG8=') else xs:base64Binary('Z29vZGJ5ZQ==') \n" + " }; \n" + " local:base64Binary-value(true()) eq local:base64Binary-value(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Name: cbcl-base64Binary-equal-002 * Description: test equality of xs:base64Binary * Author: Tim Mills * Date: 2008-05-14 * . */ @org.junit.Test public void cbclBase64BinaryEqual002() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:base64Binary-value($arg as xs:boolean) as xs:base64Binary { \n" + " \t\tif ($arg) then xs:base64Binary('aGVsbG8=') else xs:base64Binary('Z29vZGJ5ZQ==') \n" + " \t}; \n" + " \tnot(local:base64Binary-value(true()) eq local:base64Binary-value(false()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Name: cbcl-base64Binary-equal-003 * Description: test equality of xs:base64Binary * Author: Tim Mills * Date: 2008-05-14 * . */ @org.junit.Test public void cbclBase64BinaryEqual003() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:base64Binary-value($arg as xs:boolean) as xs:base64Binary { \n" + " \t\tif ($arg) then xs:base64Binary('aGVsbG8=') else xs:base64Binary('Z29vZGJ5ZQ==') \n" + " \t}; \n" + " \tnot(local:base64Binary-value(true()) ne local:base64Binary-value(false()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-base64Binary-equal2args-1 * Written By: Carmelo Montanez * Date: Tue Mar 22 11:23:46 GMT-05:00 2005 * Purpose: Evaluates The "op:base64Binary-equal" operator * with the arguments set as follows: * $value1 = xs:base64Binary(lower bound) * $value2 = xs:base64Binary(lower bound) * ******************************************************* * . */ @org.junit.Test public void opBase64BinaryEqual2args1() { final XQuery query = new XQuery( "xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\") eq xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-base64Binary-equal2args-10 * Written By: Carmelo Montanez * Date: Tue Mar 22 11:23:46 GMT-05:00 2005 * Purpose: Evaluates The "op:base64Binary-equal" operator * with the arguments set as follows: * $value1 = xs:base64Binary(lower bound) * $value2 = xs:base64Binary(upper bound) * ******************************************************* * . */ @org.junit.Test public void opBase64BinaryEqual2args10() { final XQuery query = new XQuery( "xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\") ne xs:base64Binary(\"cW9kanZzY3ZlaWthYXVreGxibm11dW91ZmllZGplbXZza2FqcGlwdWlxcG5xbHR4dmFjcWFjbGN1Z3BqYmVuZWhsdHhzeHZs\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-base64Binary-equal2args-2 * Written By: Carmelo Montanez * Date: Tue Mar 22 11:23:46 GMT-05:00 2005 * Purpose: Evaluates The "op:base64Binary-equal" operator * with the arguments set as follows: * $value1 = xs:base64Binary(mid range) * $value2 = xs:base64Binary(lower bound) * ******************************************************* * . */ @org.junit.Test public void opBase64BinaryEqual2args2() { final XQuery query = new XQuery( "xs:base64Binary(\"d2J1bnB0Y3lucWtvYXdpb2xoZWNwZXlkdG90eHB3ZXJqcnliZXFubmJjZXBmbGx3aGN3cmNndG9xb2hvdHdlY2pzZ3h5bnlp\") eq xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-base64Binary-equal2args-3 * Written By: Carmelo Montanez * Date: Tue Mar 22 11:23:46 GMT-05:00 2005 * Purpose: Evaluates The "op:base64Binary-equal" operator * with the arguments set as follows: * $value1 = xs:base64Binary(upper bound) * $value2 = xs:base64Binary(lower bound) * ******************************************************* * . */ @org.junit.Test public void opBase64BinaryEqual2args3() { final XQuery query = new XQuery( "xs:base64Binary(\"cW9kanZzY3ZlaWthYXVreGxibm11dW91ZmllZGplbXZza2FqcGlwdWlxcG5xbHR4dmFjcWFjbGN1Z3BqYmVuZWhsdHhzeHZs\") eq xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-base64Binary-equal2args-4 * Written By: Carmelo Montanez * Date: Tue Mar 22 11:23:46 GMT-05:00 2005 * Purpose: Evaluates The "op:base64Binary-equal" operator * with the arguments set as follows: * $value1 = xs:base64Binary(lower bound) * $value2 = xs:base64Binary(mid range) * ******************************************************* * . */ @org.junit.Test public void opBase64BinaryEqual2args4() { final XQuery query = new XQuery( "xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\") eq xs:base64Binary(\"d2J1bnB0Y3lucWtvYXdpb2xoZWNwZXlkdG90eHB3ZXJqcnliZXFubmJjZXBmbGx3aGN3cmNndG9xb2hvdHdlY2pzZ3h5bnlp\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-base64Binary-equal2args-5 * Written By: Carmelo Montanez * Date: Tue Mar 22 11:23:46 GMT-05:00 2005 * Purpose: Evaluates The "op:base64Binary-equal" operator * with the arguments set as follows: * $value1 = xs:base64Binary(lower bound) * $value2 = xs:base64Binary(upper bound) * ******************************************************* * . */ @org.junit.Test public void opBase64BinaryEqual2args5() { final XQuery query = new XQuery( "xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\") eq xs:base64Binary(\"cW9kanZzY3ZlaWthYXVreGxibm11dW91ZmllZGplbXZza2FqcGlwdWlxcG5xbHR4dmFjcWFjbGN1Z3BqYmVuZWhsdHhzeHZs\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-base64Binary-equal2args-6 * Written By: Carmelo Montanez * Date: Tue Mar 22 11:23:46 GMT-05:00 2005 * Purpose: Evaluates The "op:base64Binary-equal" operator * with the arguments set as follows: * $value1 = xs:base64Binary(lower bound) * $value2 = xs:base64Binary(lower bound) * ******************************************************* * . */ @org.junit.Test public void opBase64BinaryEqual2args6() { final XQuery query = new XQuery( "xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\") ne xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-base64Binary-equal2args-7 * Written By: Carmelo Montanez * Date: Tue Mar 22 11:23:46 GMT-05:00 2005 * Purpose: Evaluates The "op:base64Binary-equal" operator * with the arguments set as follows: * $value1 = xs:base64Binary(mid range) * $value2 = xs:base64Binary(lower bound) * ******************************************************* * . */ @org.junit.Test public void opBase64BinaryEqual2args7() { final XQuery query = new XQuery( "xs:base64Binary(\"d2J1bnB0Y3lucWtvYXdpb2xoZWNwZXlkdG90eHB3ZXJqcnliZXFubmJjZXBmbGx3aGN3cmNndG9xb2hvdHdlY2pzZ3h5bnlp\") ne xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-base64Binary-equal2args-8 * Written By: Carmelo Montanez * Date: Tue Mar 22 11:23:46 GMT-05:00 2005 * Purpose: Evaluates The "op:base64Binary-equal" operator * with the arguments set as follows: * $value1 = xs:base64Binary(upper bound) * $value2 = xs:base64Binary(lower bound) * ******************************************************* * . */ @org.junit.Test public void opBase64BinaryEqual2args8() { final XQuery query = new XQuery( "xs:base64Binary(\"cW9kanZzY3ZlaWthYXVreGxibm11dW91ZmllZGplbXZza2FqcGlwdWlxcG5xbHR4dmFjcWFjbGN1Z3BqYmVuZWhsdHhzeHZs\") ne xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-base64Binary-equal2args-9 * Written By: Carmelo Montanez * Date: Tue Mar 22 11:23:46 GMT-05:00 2005 * Purpose: Evaluates The "op:base64Binary-equal" operator * with the arguments set as follows: * $value1 = xs:base64Binary(lower bound) * $value2 = xs:base64Binary(mid range) * ******************************************************* * . */ @org.junit.Test public void opBase64BinaryEqual2args9() { final XQuery query = new XQuery( "xs:base64Binary(\"cmxjZ3R4c3JidnllcmVuZG91aWpsbXV5Z2NhamxpcmJkaWFhbmFob2VsYXVwZmJ1Z2dmanl2eHlzYmhheXFtZXR0anV2dG1q\") ne xs:base64Binary(\"d2J1bnB0Y3lucWtvYXdpb2xoZWNwZXlkdG90eHB3ZXJqcnliZXFubmJjZXBmbGx3aGN3cmNndG9xb2hvdHdlY2pzZ3h5bnlp\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpBooleanEqual.java�������������������0000664�0000000�0000000�00000126547�12224530032�0027647�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the boolean-equal() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpBooleanEqual extends QT3TestSet { /** * * ******************************************************* * Test: K-BooleanEqual-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Compare two xs:boolean values. * ******************************************************* * . */ @org.junit.Test public void kBooleanEqual1() { final XQuery query = new XQuery( "false() eq false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-BooleanEqual-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Compare two xs:boolean values. * ******************************************************* * . */ @org.junit.Test public void kBooleanEqual2() { final XQuery query = new XQuery( "true() eq true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-BooleanEqual-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Compare two xs:boolean values. * ******************************************************* * . */ @org.junit.Test public void kBooleanEqual3() { final XQuery query = new XQuery( "false() ne true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-BooleanEqual-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Compare two xs:boolean values. * ******************************************************* * . */ @org.junit.Test public void kBooleanEqual4() { final XQuery query = new XQuery( "true() ne false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-BooleanEqual-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A complex value-comparison involving xs:boolean. * ******************************************************* * . */ @org.junit.Test public void kBooleanEqual5() { final XQuery query = new XQuery( "((((((((((((false() eq false()) eq false()) eq false()) eq false()) eq false()) eq false()) eq false()) eq false()) eq false()) eq false()) eq false()) eq false()) eq false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K2-BooleanEqual-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Cannot compare xs:boolean and xs:untypedAtomic. * ******************************************************* * . */ @org.junit.Test public void k2BooleanEqual1() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") eq true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K2-BooleanEqual-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Cannot compare xs:boolean and xs:untypedAtomic. * ******************************************************* * . */ @org.junit.Test public void k2BooleanEqual2() { final XQuery query = new XQuery( "<name>true</name> eq true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K2-BooleanEqual-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Cannot compare xs:boolean and xs:untypedAtomic(#2). * ******************************************************* * . */ @org.junit.Test public void k2BooleanEqual3() { final XQuery query = new XQuery( "true() eq <name>true</name>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * Name: cbcl-boolean-equal-001 * Description: test equality of xs:boolean * Author: Tim Mills * Date: 2008-05-14 * . */ @org.junit.Test public void cbclBooleanEqual001() { final XQuery query = new XQuery( "\n" + " declare function local:is-even($arg as xs:integer) as xs:boolean { (($arg mod 2) eq 0) }; \n" + " fn:false() eq local:is-even(17)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Name: cbcl-boolean-equal-002 * Description: test equality of xs:boolean * Author: Tim Mills * Date: 2008-05-14 * . */ @org.junit.Test public void cbclBooleanEqual002() { final XQuery query = new XQuery( "\n" + " declare function local:is-even($arg as xs:integer) as xs:boolean { (($arg mod 2) eq 0) }; \n" + " not(local:is-even(13) eq local:is-even(17))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Name: cbcl-boolean-equal-003 * Description: test equality of xs:boolean * Author: Tim Mills * Date: 2008-05-14 * . */ @org.junit.Test public void cbclBooleanEqual003() { final XQuery query = new XQuery( "\n" + " declare function local:is-even($arg as xs:integer) as xs:boolean { (($arg mod 2) eq 0) }; \n" + " fn:true() ne local:is-even(17)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Name: cbcl-boolean-equal-004 * Description: test equality of xs:boolean * Author: Tim Mills * Date: 2008-05-14 * . */ @org.junit.Test public void cbclBooleanEqual004() { final XQuery query = new XQuery( "\n" + " declare function local:is-even($arg as xs:integer) as xs:boolean { (($arg mod 2) eq 0) }; \n" + " local:is-even(17) ne fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test equality of xs:boolean. */ @org.junit.Test public void cbclBooleanEqual005() { final XQuery query = new XQuery( "\n" + " declare function local:is-even($arg as xs:integer) as xs:boolean { (($arg mod 2) eq 0) }; \n" + " local:is-even(17) ne fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test equal to of xs:boolean. */ @org.junit.Test public void cbclBooleanEqual006() { final XQuery query = new XQuery( "\n" + " declare function local:is-even($arg as xs:integer) as xs:boolean { (($arg mod 2) eq 0) }; \n" + " not(not(local:is-even(17) eq local:is-even(16)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-equal-1 * Written By: Carmelo Montanez * Date: June 24, 2005 * Purpose: Evaluates The "boolean-equal" function * with operands set to "not(true)", "true" respectively. * Use of eq operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanEqual1() { final XQuery query = new XQuery( "fn:not(xs:boolean(\"true\")) eq xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-equal-10 * Written By: Carmelo Montanez * Date: June 24, 2005 * Purpose: Evaluates The "boolean-equal" function * with operands set to "(7 eq 7)" and "false" respectively. * Use of ge operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanEqual10() { final XQuery query = new XQuery( "(7 eq 7) eq xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-equal-11 * Written By: Carmelo Montanez * Date: June 24, 2005 * Purpose: Evaluates The "boolean-equal" function * with operands set to "not(7 lt 7)", "true" respectively. * Use of lt operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanEqual11() { final XQuery query = new XQuery( "fn:not(7 lt 7) eq xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-equal-12 * Written By: Carmelo Montanez * Date: June 24, 2005 * Purpose: Evaluates The "boolean-equal" function * with operands set to "not(7 lt 7)" and "false" respectively. * ******************************************************* * . */ @org.junit.Test public void opBooleanEqual12() { final XQuery query = new XQuery( "fn:not(7 lt 7) and xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-equal-13 * Written By: Carmelo Montanez * Date: June 24, 2005 * Purpose: Evaluates The "boolean-equal" function * with both operands set to expressions unsing multiple * "eq" operators connected by an "and" expression. * ******************************************************* * . */ @org.junit.Test public void opBooleanEqual13() { final XQuery query = new XQuery( "((7 eq 7) eq xs:boolean(\"true\")) and (xs:boolean(\"false\") eq xs:boolean(\"true\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-equal-14 * Written By: Carmelo Montanez * Date: June 24, 2005 * Purpose: Evaluates The "boolean-equal" function * with both operands set to expressions unsing multiple * "eq" operators connected by an "or" expression. * ******************************************************* * . */ @org.junit.Test public void opBooleanEqual14() { final XQuery query = new XQuery( "((7 eq 7) eq xs:boolean(\"true\")) or (xs:boolean(\"false\") eq xs:boolean(\"true\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-equal-15 * Written By: Carmelo Montanez * Date: June 24, 2005 * Purpose: Evaluates The "boolean-equal" function * using the "starts-with" function. * ******************************************************* * . */ @org.junit.Test public void opBooleanEqual15() { final XQuery query = new XQuery( "fn:starts-with(\"Query\",\"Que\") eq xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-equal-16 * Written By: Carmelo Montanez * Date: June 24, 2005 * Purpose: Evaluates The "boolean-equal" function * using the "ends-with" function. * ******************************************************* * . */ @org.junit.Test public void opBooleanEqual16() { final XQuery query = new XQuery( "fn:ends-with(\"Query\",\"ry\") eq xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-equal-17 * Written By: Carmelo Montanez * Date: March 26, 2006 * Purpose: Evaluates cardinality violation on a sequence * of two or more items. * ******************************************************* * . */ @org.junit.Test public void opBooleanEqual17() { final XQuery query = new XQuery( "let $e := (0,1) return $e eq 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: op-boolean-equal-2 * Written By: Carmelo Montanez * Date: June 24, 2005 * Purpose: Evaluates The "boolean-equal" function * with operands set to "not(true)", "false" respectively. * Use of eq operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanEqual2() { final XQuery query = new XQuery( "fn:not(xs:boolean(\"true\")) eq xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-equal-3 * Written By: Carmelo Montanez * Date: June 24, 2005 * Purpose: Evaluates The "boolean-equal" function * with operands set to "not(false)" ad "false" respectively. * Use of eq operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanEqual3() { final XQuery query = new XQuery( "fn:not(xs:boolean(\"false\")) eq xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-equal-4 * Written By: Carmelo Montanez * Date: June 24, 2005 * Purpose: Evaluates The "boolean-equal" function * with both operands set to "and" expressions respectively. * Use of eq operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanEqual4() { final XQuery query = new XQuery( "(xs:boolean(\"true\") and xs:boolean(\"true\")) eq (xs:boolean(\"false\") and xs:boolean(\"false\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-equal-5 * Written By: Carmelo Montanez * Date: June 24, 2005 * Purpose: Evaluates The "boolean-equal" function * with left operand set to and "and" expressions with the * "not" function and right operand set to "true". * ******************************************************* * . */ @org.junit.Test public void opBooleanEqual5() { final XQuery query = new XQuery( "fn:not(xs:boolean(\"true\") and xs:boolean(\"true\")) eq xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-equal-6 * Written By: Carmelo Montanez * Date: June 24, 2005 * Purpose: Evaluates The "boolean-equal" function * with left operand set to and "and" expressions with the * "not" function and right operand set to "false". * ******************************************************* * . */ @org.junit.Test public void opBooleanEqual6() { final XQuery query = new XQuery( "fn:not(xs:boolean(\"false\") and xs:boolean(\"false\")) eq xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-equal-7 * Written By: Carmelo Montanez * Date: June 24, 2005 * Purpose: Evaluates The "boolean-equal" function * with operands set to "fn:not(false)" and "fn:not(false)" * respectively. * ******************************************************* * . */ @org.junit.Test public void opBooleanEqual7() { final XQuery query = new XQuery( "fn:not(xs:boolean(\"false\")) eq fn:not(xs:boolean(\"false\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-equal-8 * Written By: Carmelo Montanez * Date: June 24, 2005 * Purpose: Evaluates The "boolean-equal" function with * with operands set to "not(false and true)" and * "not(false and true)" respectively. * ******************************************************* * . */ @org.junit.Test public void opBooleanEqual8() { final XQuery query = new XQuery( "fn:not(xs:boolean(\"false\") and xs:boolean(\"true\")) eq fn:not(xs:boolean(\"false\") and xs:boolean(\"true\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-equal-9 * Written By: Carmelo Montanez * Date: June 24, 2005 * Purpose: Evaluates The "boolean-equal" function * with operands set to "(7 lt 7)" and "true" respectively. * ******************************************************* * . */ @org.junit.Test public void opBooleanEqual9() { final XQuery query = new XQuery( "(7 lt 7) eq xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-equal-more-args-001.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:10:02 2005 * Purpose: To check if args of Boolean type are equal * ******************************************************* * . */ @org.junit.Test public void opBooleanEqualMoreArgs001() { final XQuery query = new XQuery( "xs:boolean(\"false\") eq xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-equal-more-args-002.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:10:02 2005 * Purpose: To check if args of Boolean type are equal * ******************************************************* * . */ @org.junit.Test public void opBooleanEqualMoreArgs002() { final XQuery query = new XQuery( "xs:boolean('false') eq xs:boolean('1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-equal-more-args-003.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:10:02 2005 * Purpose: To check if args of Boolean type are equal * ******************************************************* * . */ @org.junit.Test public void opBooleanEqualMoreArgs003() { final XQuery query = new XQuery( "xs:boolean('false') eq xs:boolean('0')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-equal-more-args-004.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:10:02 2005 * Purpose: To check if args of Boolean type are equal * ******************************************************* * . */ @org.junit.Test public void opBooleanEqualMoreArgs004() { final XQuery query = new XQuery( "xs:boolean(\"false\") eq xs:boolean('0')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-equal-more-args-005.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:10:02 2005 * Purpose: To check if args of Boolean type are equal * ******************************************************* * . */ @org.junit.Test public void opBooleanEqualMoreArgs005() { final XQuery query = new XQuery( "xs:boolean(\"false\") eq xs:boolean(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-equal-more-args-006.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:10:02 2005 * Purpose: To check if args of Boolean type are equal * ******************************************************* * . */ @org.junit.Test public void opBooleanEqualMoreArgs006() { final XQuery query = new XQuery( "xs:boolean(\"false\") eq true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-equal-more-args-007.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:10:02 2005 * Purpose: To check if args of Boolean type are equal * ******************************************************* * . */ @org.junit.Test public void opBooleanEqualMoreArgs007() { final XQuery query = new XQuery( "xs:boolean(\"false\") eq false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-equal-more-args-008.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:10:02 2005 * Purpose: To check if args of Boolean type are equal * ******************************************************* * . */ @org.junit.Test public void opBooleanEqualMoreArgs008() { final XQuery query = new XQuery( "xs:boolean(\"true\") eq xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-equal-more-args-009.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:10:02 2005 * Purpose: To check if args of Boolean type are equal * ******************************************************* * . */ @org.junit.Test public void opBooleanEqualMoreArgs009() { final XQuery query = new XQuery( "xs:boolean(\"true\") eq xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-equal-more-args-010.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:10:02 2005 * Purpose: To check if args of Boolean type are equal * ******************************************************* * . */ @org.junit.Test public void opBooleanEqualMoreArgs010() { final XQuery query = new XQuery( "xs:boolean(\"true\") eq xs:boolean(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-equal-more-args-011.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:10:02 2005 * Purpose: To check if args of Boolean type are equal * ******************************************************* * . */ @org.junit.Test public void opBooleanEqualMoreArgs011() { final XQuery query = new XQuery( "xs:boolean(\"true\") eq xs:boolean(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-equal-more-args-012.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:10:02 2005 * Purpose: To check if args of Boolean type are equal * ******************************************************* * . */ @org.junit.Test public void opBooleanEqualMoreArgs012() { final XQuery query = new XQuery( "xs:boolean(\"1\") eq xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-equal-more-args-013.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:10:02 2005 * Purpose: To check if args of Boolean type are equal * ******************************************************* * . */ @org.junit.Test public void opBooleanEqualMoreArgs013() { final XQuery query = new XQuery( "xs:boolean(\"0\") eq xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-equal-more-args-014.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:10:02 2005 * Purpose: To check if args of Boolean type are equal * ******************************************************* * . */ @org.junit.Test public void opBooleanEqualMoreArgs014() { final XQuery query = new XQuery( "xs:boolean('true') eq xs:boolean('1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-equal-more-args-015.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:10:02 2005 * Purpose: To check if args of Boolean type are equal * ******************************************************* * . */ @org.junit.Test public void opBooleanEqualMoreArgs015() { final XQuery query = new XQuery( "xs:boolean('true') eq xs:boolean('0')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-equal-more-args-016.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:10:02 2005 * Purpose: To check if args of Boolean type are equal * ******************************************************* * . */ @org.junit.Test public void opBooleanEqualMoreArgs016() { final XQuery query = new XQuery( "xs:boolean(\"true\") eq xs:boolean('1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-equal-more-args-017.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:10:02 2005 * Purpose: To check if args of Boolean type are equal * ******************************************************* * . */ @org.junit.Test public void opBooleanEqualMoreArgs017() { final XQuery query = new XQuery( "xs:boolean(\"true\") eq xs:boolean(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-equal-more-args-018.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:10:02 2005 * Purpose: To check if args of Boolean type are equal * ******************************************************* * . */ @org.junit.Test public void opBooleanEqualMoreArgs018() { final XQuery query = new XQuery( "xs:boolean(\"true\") eq true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-equal-more-args-019.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:10:02 2005 * Purpose: To check if args of Boolean type are equal * ******************************************************* * . */ @org.junit.Test public void opBooleanEqualMoreArgs019() { final XQuery query = new XQuery( "xs:boolean(\"true\") eq false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-equal2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:17 GMT-05:00 2004 * Purpose: Evaluates The "op:boolean-equal" operator * with the arguments set as follows: * $value1 = xs:boolean(lower bound) * $value2 = xs:boolean(lower bound) * ******************************************************* * . */ @org.junit.Test public void opBooleanEqual2args1() { final XQuery query = new XQuery( "xs:boolean(\"false\") eq xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-equal2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:17 GMT-05:00 2004 * Purpose: Evaluates The "op:boolean-equal" operator * with the arguments set as follows: * $value1 = xs:boolean(mid range) * $value2 = xs:boolean(lower bound) * ******************************************************* * . */ @org.junit.Test public void opBooleanEqual2args2() { final XQuery query = new XQuery( "xs:boolean(\"1\") eq xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-equal2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:17 GMT-05:00 2004 * Purpose: Evaluates The "op:boolean-equal" operator * with the arguments set as follows: * $value1 = xs:boolean(upper bound) * $value2 = xs:boolean(lower bound) * ******************************************************* * . */ @org.junit.Test public void opBooleanEqual2args3() { final XQuery query = new XQuery( "xs:boolean(\"0\") eq xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-equal2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:17 GMT-05:00 2004 * Purpose: Evaluates The "op:boolean-equal" operator * with the arguments set as follows: * $value1 = xs:boolean(lower bound) * $value2 = xs:boolean(mid range) * ******************************************************* * . */ @org.junit.Test public void opBooleanEqual2args4() { final XQuery query = new XQuery( "xs:boolean(\"false\") eq xs:boolean(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-equal2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:17 GMT-05:00 2004 * Purpose: Evaluates The "op:boolean-equal" operator * with the arguments set as follows: * $value1 = xs:boolean(lower bound) * $value2 = xs:boolean(upper bound) * ******************************************************* * . */ @org.junit.Test public void opBooleanEqual2args5() { final XQuery query = new XQuery( "xs:boolean(\"false\") eq xs:boolean(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } ���������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpBooleanGreaterThan.java�������������0000664�0000000�0000000�00000114425�12224530032�0030774�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the boolean-greater-than() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpBooleanGreaterThan extends QT3TestSet { /** * * ******************************************************* * Test: K-BooleanGT-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Compare two xs:boolean values. * ******************************************************* * . */ @org.junit.Test public void kBooleanGT1() { final XQuery query = new XQuery( "true() gt false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-BooleanGT-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Compare two xs:boolean values. * ******************************************************* * . */ @org.junit.Test public void kBooleanGT2() { final XQuery query = new XQuery( "true() ge false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-BooleanGT-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Compare two xs:boolean values. * ******************************************************* * . */ @org.junit.Test public void kBooleanGT3() { final XQuery query = new XQuery( "true() ge true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void cbclBooleanGreaterThan001() { final XQuery query = new XQuery( "\n" + " declare function local:is-even($arg as xs:integer) as xs:boolean { (($arg mod 2) eq 0) }; \n" + " not(local:is-even(15) ge local:is-even(17))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void cbclBooleanGreaterThan002() { final XQuery query = new XQuery( "\n" + " declare function local:is-even($arg as xs:integer) as xs:boolean { (($arg mod 2) eq 0) }; \n" + " fn:true() ge local:is-even(17)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void cbclBooleanGreaterThan003() { final XQuery query = new XQuery( "\n" + " declare function local:is-even($arg as xs:integer) as xs:boolean { (($arg mod 2) eq 0) }; \n" + " fn:false() ge local:is-even(17)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void cbclBooleanGreaterThan004() { final XQuery query = new XQuery( "\n" + " declare function local:is-even($arg as xs:integer) as xs:boolean { (($arg mod 2) eq 0) }; \n" + " not(local:is-even(15) gt local:is-even(17))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void cbclBooleanGreaterThan005() { final XQuery query = new XQuery( "\n" + " declare function local:is-even($arg as xs:integer) as xs:boolean { (($arg mod 2) eq 0) }; \n" + " fn:true() gt local:is-even(17)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void cbclBooleanGreaterThan006() { final XQuery query = new XQuery( "\n" + " declare function local:is-even($arg as xs:integer) as xs:boolean { (($arg mod 2) eq 0) }; \n" + " fn:false() gt local:is-even(17)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void cbclBooleanGreaterThan007() { final XQuery query = new XQuery( "\n" + " declare function local:is-even($arg as xs:integer) as xs:boolean { (($arg mod 2) eq 0) }; \n" + " local:is-even(17) ge fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void cbclBooleanGreaterThan008() { final XQuery query = new XQuery( "\n" + " declare function local:is-even($arg as xs:integer) as xs:boolean { (($arg mod 2) eq 0) }; \n" + " local:is-even(17) ge fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void cbclBooleanGreaterThan009() { final XQuery query = new XQuery( "declare function local:is-even($arg as xs:integer) as xs:boolean { (($arg mod 2) eq 0) }; \n" + " local:is-even(17) gt fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void cbclBooleanGreaterThan010() { final XQuery query = new XQuery( "\n" + " declare function local:is-even($arg as xs:integer) as xs:boolean { (($arg mod 2) eq 0) }; \n" + " local:is-even(17) gt fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-greater-than-1 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "boolean-greater-than" function * with operands set to "not(true)", "true" respectively. * Use of gt operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanGreaterThan1() { final XQuery query = new XQuery( "fn:not(xs:boolean(\"true\")) gt xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-greater-than-10 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "boolean-greater-than" function * with operands set to "(7 eq 7)", "true" respectively. * Use of le operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanGreaterThan10() { final XQuery query = new XQuery( "(7 eq 7) le xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-greater-than-11 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "boolean-greater-than" function * with operands set to "(7 eq 7)", "false" respectively. * Use of gt operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanGreaterThan11() { final XQuery query = new XQuery( "(7 eq 7) gt xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-greater-than-12 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "boolean-greater-than" function * with operands set to "(7 eq 7)", "false" respectively. * Use of le operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanGreaterThan12() { final XQuery query = new XQuery( "(7 eq 7) le xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-greater-than-2 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "boolean-greater-than" function * with operands set to "not(true)", "true" respectively. * Use of le operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanGreaterThan2() { final XQuery query = new XQuery( "fn:not(xs:boolean(\"true\")) le xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-greater-than-3 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "boolean-greater-than" function * with operands set to "not(true)", "false" respectively. * Use of gt operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanGreaterThan3() { final XQuery query = new XQuery( "fn:not(xs:boolean(\"true\")) gt xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-greater-than-4 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "boolean-greater-than" function * with operands set to "not(true)", "false" respectively. * Use of le operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanGreaterThan4() { final XQuery query = new XQuery( "fn:not(xs:boolean(\"true\")) le xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-greater-than-5 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "boolean-greater-than" function * with operands set to "not(false)", "true" respectively. * Use of gt operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanGreaterThan5() { final XQuery query = new XQuery( "fn:not(xs:boolean(\"false\")) gt xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-greater-than-6 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "boolean-greater-than" function * with operands set to "not(false)", "true" respectively. * Use of le operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanGreaterThan6() { final XQuery query = new XQuery( "fn:not(xs:boolean(\"false\")) le xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-greater-than-7 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "boolean-greater-than" function * with operands set to "not(false)", "false" respectively. * Use of gt operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanGreaterThan7() { final XQuery query = new XQuery( "fn:not(xs:boolean(\"false\")) gt xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-greater-than-8 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "boolean-greater-than" function * with operands set to "not(false)", "false" respectively. * Use of le operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanGreaterThan8() { final XQuery query = new XQuery( "fn:not(xs:boolean(\"false\")) le xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-greater-than-9 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "boolean-greater-than" function * with operands set to "(7 eq 7)", "true" respectively. * Use of gt operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanGreaterThan9() { final XQuery query = new XQuery( "(7 eq 7) gt xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-greater-than-more-args-001.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:16:48 2005 * Purpose: To check if arg1: Boolean is greater than arg2:Boolean * ***************************************************************** * . */ @org.junit.Test public void opBooleanGreaterThanMoreArgs001() { final XQuery query = new XQuery( "xs:boolean(\"true\") gt xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-greater-than-more-args-002.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:16:48 2005 * Purpose: To check if arg1: Boolean is greater than arg2:Boolean * ***************************************************************** * . */ @org.junit.Test public void opBooleanGreaterThanMoreArgs002() { final XQuery query = new XQuery( "xs:boolean(\"1\") gt xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-greater-than-more-args-003.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:16:48 2005 * Purpose: To check if arg1: Boolean is greater than arg2:Boolean * ***************************************************************** * . */ @org.junit.Test public void opBooleanGreaterThanMoreArgs003() { final XQuery query = new XQuery( "xs:boolean(\"0\") gt xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-greater-than-more-args-004.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:16:48 2005 * Purpose: To check if arg1: Boolean is greater than arg2:Boolean * ***************************************************************** * . */ @org.junit.Test public void opBooleanGreaterThanMoreArgs004() { final XQuery query = new XQuery( "xs:boolean(\"true\") gt xs:boolean(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-greater-than-more-args-005.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:16:48 2005 * Purpose: To check if arg1: Boolean is greater than arg2:Boolean * ***************************************************************** * . */ @org.junit.Test public void opBooleanGreaterThanMoreArgs005() { final XQuery query = new XQuery( "xs:boolean(\"true\") gt xs:boolean(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-greater-than-more-args-006.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:16:48 2005 * Purpose: To check if arg1: Boolean is greater than arg2:Boolean * ***************************************************************** * . */ @org.junit.Test public void opBooleanGreaterThanMoreArgs006() { final XQuery query = new XQuery( "xs:boolean(\"true\") gt xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-greater-than-more-args-007.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:16:48 2005 * Purpose: To check if arg1: Boolean is greater than arg2:Boolean * ***************************************************************** * . */ @org.junit.Test public void opBooleanGreaterThanMoreArgs007() { final XQuery query = new XQuery( "xs:boolean(\"false\") gt xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-greater-than-more-args-008.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:16:48 2005 * Purpose: To check if arg1: Boolean is less or equal to arg2:Boolean * ********************************************************************* * . */ @org.junit.Test public void opBooleanGreaterThanMoreArgs008() { final XQuery query = new XQuery( "xs:boolean(\"true\") le xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-greater-than-more-args-009.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:16:48 2005 * Purpose: To check if arg1: Boolean is less or equal to arg2:Boolean * ********************************************************************* * . */ @org.junit.Test public void opBooleanGreaterThanMoreArgs009() { final XQuery query = new XQuery( "xs:boolean(\"1\") le xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-greater-than-more-args-010.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:16:48 2005 * Purpose: To check if arg1: Boolean is less or equal to arg2:Boolean * ********************************************************************* * . */ @org.junit.Test public void opBooleanGreaterThanMoreArgs010() { final XQuery query = new XQuery( "xs:boolean(\"0\") le xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-greater-than-more-args-011.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:16:48 2005 * Purpose: To check if arg1: Boolean is less or equal to arg2:Boolean * ********************************************************************* * . */ @org.junit.Test public void opBooleanGreaterThanMoreArgs011() { final XQuery query = new XQuery( "xs:boolean(\"true\") le xs:boolean(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-greater-than-more-args-012.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:16:48 2005 * Purpose: To check if arg1: Boolean is less or equal to arg2:Boolean * ********************************************************************* * . */ @org.junit.Test public void opBooleanGreaterThanMoreArgs012() { final XQuery query = new XQuery( "xs:boolean(\"true\") le xs:boolean(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-greater-than-more-args-013.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:16:48 2005 * Purpose: To check if arg1: Boolean is less or equal to arg2:Boolean * ********************************************************************* * . */ @org.junit.Test public void opBooleanGreaterThanMoreArgs013() { final XQuery query = new XQuery( "xs:boolean(\"true\") le xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-greater-than-more-args-014.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:16:48 2005 * Purpose: To check if arg1: Boolean is less or equal to arg2:Boolean * ********************************************************************* * . */ @org.junit.Test public void opBooleanGreaterThanMoreArgs014() { final XQuery query = new XQuery( "xs:boolean(\"false\") le xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-greater-than2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:17 GMT-05:00 2004 * Purpose: Evaluates The "op:boolean-greater-than" operator * with the arguments set as follows: * $arg1 = xs:boolean(lower bound) * $arg2 = xs:boolean(lower bound) * ******************************************************* * . */ @org.junit.Test public void opBooleanGreaterThan2args1() { final XQuery query = new XQuery( "xs:boolean(\"false\") gt xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-greater-than2args-10 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:17 GMT-05:00 2004 * Purpose: Evaluates The "op:boolean-greater-than" operator * with the arguments set as follows: * $arg1 = xs:boolean(lower bound) * $arg2 = xs:boolean(upper bound) * ******************************************************* * . */ @org.junit.Test public void opBooleanGreaterThan2args10() { final XQuery query = new XQuery( "xs:boolean(\"false\") le xs:boolean(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-greater-than2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:17 GMT-05:00 2004 * Purpose: Evaluates The "op:boolean-greater-than" operator * with the arguments set as follows: * $arg1 = xs:boolean(mid range) * $arg2 = xs:boolean(lower bound) * ******************************************************* * . */ @org.junit.Test public void opBooleanGreaterThan2args2() { final XQuery query = new XQuery( "xs:boolean(\"1\") gt xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-greater-than2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:17 GMT-05:00 2004 * Purpose: Evaluates The "op:boolean-greater-than" operator * with the arguments set as follows: * $arg1 = xs:boolean(upper bound) * $arg2 = xs:boolean(lower bound) * ******************************************************* * . */ @org.junit.Test public void opBooleanGreaterThan2args3() { final XQuery query = new XQuery( "xs:boolean(\"0\") gt xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-greater-than2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:17 GMT-05:00 2004 * Purpose: Evaluates The "op:boolean-greater-than" operator * with the arguments set as follows: * $arg1 = xs:boolean(lower bound) * $arg2 = xs:boolean(mid range) * ******************************************************* * . */ @org.junit.Test public void opBooleanGreaterThan2args4() { final XQuery query = new XQuery( "xs:boolean(\"false\") gt xs:boolean(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-greater-than2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:17 GMT-05:00 2004 * Purpose: Evaluates The "op:boolean-greater-than" operator * with the arguments set as follows: * $arg1 = xs:boolean(lower bound) * $arg2 = xs:boolean(upper bound) * ******************************************************* * . */ @org.junit.Test public void opBooleanGreaterThan2args5() { final XQuery query = new XQuery( "xs:boolean(\"false\") gt xs:boolean(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-greater-than2args-6 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:17 GMT-05:00 2004 * Purpose: Evaluates The "op:boolean-greater-than" operator * with the arguments set as follows: * $arg1 = xs:boolean(lower bound) * $arg2 = xs:boolean(lower bound) * ******************************************************* * . */ @org.junit.Test public void opBooleanGreaterThan2args6() { final XQuery query = new XQuery( "xs:boolean(\"false\") le xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-greater-than2args-7 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:17 GMT-05:00 2004 * Purpose: Evaluates The "op:boolean-greater-than" operator * with the arguments set as follows: * $arg1 = xs:boolean(mid range) * $arg2 = xs:boolean(lower bound) * ******************************************************* * . */ @org.junit.Test public void opBooleanGreaterThan2args7() { final XQuery query = new XQuery( "xs:boolean(\"1\") le xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-greater-than2args-8 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:17 GMT-05:00 2004 * Purpose: Evaluates The "op:boolean-greater-than" operator * with the arguments set as follows: * $arg1 = xs:boolean(upper bound) * $arg2 = xs:boolean(lower bound) * ******************************************************* * . */ @org.junit.Test public void opBooleanGreaterThan2args8() { final XQuery query = new XQuery( "xs:boolean(\"0\") le xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-greater-than2args-9 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:17 GMT-05:00 2004 * Purpose: Evaluates The "op:boolean-greater-than" operator * with the arguments set as follows: * $arg1 = xs:boolean(lower bound) * $arg2 = xs:boolean(mid range) * ******************************************************* * . */ @org.junit.Test public void opBooleanGreaterThan2args9() { final XQuery query = new XQuery( "xs:boolean(\"false\") le xs:boolean(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpBooleanLessThan.java����������������0000664�0000000�0000000�00000113423�12224530032�0030306�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the boolean-less-than() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpBooleanLessThan extends QT3TestSet { /** * * ******************************************************* * Test: K-BooleanLT-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Compare two xs:boolean values. * ******************************************************* * . */ @org.junit.Test public void kBooleanLT1() { final XQuery query = new XQuery( "false() lt true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-BooleanLT-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Compare two xs:boolean values. * ******************************************************* * . */ @org.junit.Test public void kBooleanLT2() { final XQuery query = new XQuery( "false() le true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-BooleanLT-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Compare two xs:boolean values. * ******************************************************* * . */ @org.junit.Test public void kBooleanLT3() { final XQuery query = new XQuery( "true() le true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void cbclBooleanLessThan001() { final XQuery query = new XQuery( "declare function local:is-even($arg as xs:integer) as xs:boolean { (($arg mod 2) eq 0) }; \n" + " not(local:is-even(15) le local:is-even(17))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void cbclBooleanLessThan002() { final XQuery query = new XQuery( "declare function local:is-even($arg as xs:integer) as xs:boolean { (($arg mod 2) eq 0) }; \n" + " fn:true() le local:is-even(17)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void cbclBooleanLessThan003() { final XQuery query = new XQuery( "declare function local:is-even($arg as xs:integer) as xs:boolean { (($arg mod 2) eq 0) }; \n" + " fn:false() le local:is-even(17)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void cbclBooleanLessThan004() { final XQuery query = new XQuery( "declare function local:is-even($arg as xs:integer) as xs:boolean { (($arg mod 2) eq 0) }; \n" + " not(local:is-even(15) lt local:is-even(17))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void cbclBooleanLessThan005() { final XQuery query = new XQuery( "declare function local:is-even($arg as xs:integer) as xs:boolean { (($arg mod 2) eq 0) }; \n" + " fn:true() lt local:is-even(17)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void cbclBooleanLessThan006() { final XQuery query = new XQuery( "declare function local:is-even($arg as xs:integer) as xs:boolean { (($arg mod 2) eq 0) }; \n" + " fn:false() lt local:is-even(17)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** . */ @org.junit.Test public void cbclBooleanLessThan007() { final XQuery query = new XQuery( "declare function local:is-even($arg as xs:integer) as xs:boolean { (($arg mod 2) eq 0) }; \n" + " local:is-even(17) le fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void cbclBooleanLessThan008() { final XQuery query = new XQuery( "declare function local:is-even($arg as xs:integer) as xs:boolean { (($arg mod 2) eq 0) }; \n" + " local:is-even(17) le fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void cbclBooleanLessThan009() { final XQuery query = new XQuery( "declare function local:is-even($arg as xs:integer) as xs:boolean { (($arg mod 2) eq 0) }; \n" + " local:is-even(17) lt fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** . */ @org.junit.Test public void cbclBooleanLessThan010() { final XQuery query = new XQuery( "declare function local:is-even($arg as xs:integer) as xs:boolean { (($arg mod 2) eq 0) }; \n" + " local:is-even(17) lt fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-less-than-1 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "boolean-less-than" function * with operands set to "not(true)", "true" respectively. * Use of lt operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanLessThan1() { final XQuery query = new XQuery( "fn:not(xs:boolean(\"true\")) lt xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-less-than-10 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "boolean-less-than" function * with operands set to "(7 eq 7)", "true" respectively. * Use of ge operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanLessThan10() { final XQuery query = new XQuery( "(7 eq 7) ge xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-less-than-11 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "boolean-less-than" function * with operands set to "(7 eq 7)", "false" respectively. * Use of lt operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanLessThan11() { final XQuery query = new XQuery( "(7 eq 7) lt xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-less-than-12 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "boolean-less-than" function * with operands set to "(7 eq 7)", "false" respectively. * Use of ge operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanLessThan12() { final XQuery query = new XQuery( "(7 eq 7) ge xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-less-than-2 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "boolean-less-than" function * with operands set to "not(true)", "true" respectively. * Use of ge operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanLessThan2() { final XQuery query = new XQuery( "fn:not(xs:boolean(\"true\")) ge xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-less-than-3 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "boolean-less-than" function * with operands set to "not(true)", "false" respectively. * Use of lt operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanLessThan3() { final XQuery query = new XQuery( "fn:not(xs:boolean(\"true\")) lt xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-less-than-4 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "boolean-less-than" function * with operands set to "not(true)", "false" respectively. * Use of ge operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanLessThan4() { final XQuery query = new XQuery( "fn:not(xs:boolean(\"true\")) ge xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-less-than-5 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "boolean-less-than" function * with operands set to "not(false)", "true" respectively. * Use of lt operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanLessThan5() { final XQuery query = new XQuery( "fn:not(xs:boolean(\"false\")) lt xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-less-than-6 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "boolean-less-than" function * with operands set to "not(false)", "true" respectively. * Use of ge operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanLessThan6() { final XQuery query = new XQuery( "fn:not(xs:boolean(\"false\")) ge xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-less-than-7 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "boolean-less-than" function * with operands set to "not(false)", "false" respectively. * Use of lt operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanLessThan7() { final XQuery query = new XQuery( "fn:not(xs:boolean(\"false\")) lt xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-less-than-8 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "boolean-less-than" function * with operands set to "not(false)", "false" respectively. * Use of ge operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanLessThan8() { final XQuery query = new XQuery( "fn:not(xs:boolean(\"false\")) ge xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-less-than-9 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "boolean-less-than" function * with operands set to "(7 eq 7)", "true" respectively. * Use of lt operator. * ******************************************************* * . */ @org.junit.Test public void opBooleanLessThan9() { final XQuery query = new XQuery( "(7 eq 7) lt xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-less-than-more-args-001.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:19:25 2005 * Purpose: To check if arg1: Boolean is less than arg2:Boolean * ************************************************************** * . */ @org.junit.Test public void opBooleanLessThanMoreArgs001() { final XQuery query = new XQuery( "xs:boolean(\"true\") lt xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-less-than-more-args-002.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:19:25 2005 * Purpose: To check if arg1: Boolean is less than arg2:Boolean * ************************************************************** * . */ @org.junit.Test public void opBooleanLessThanMoreArgs002() { final XQuery query = new XQuery( "xs:boolean(\"1\") lt xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-less-than-more-args-003.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:19:25 2005 * Purpose: To check if arg1: Boolean is less than arg2:Boolean * ************************************************************** * . */ @org.junit.Test public void opBooleanLessThanMoreArgs003() { final XQuery query = new XQuery( "xs:boolean(\"0\") lt xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-less-than-more-args-004.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:19:25 2005 * Purpose: To check if arg1: Boolean is less than arg2:Boolean * ************************************************************** * . */ @org.junit.Test public void opBooleanLessThanMoreArgs004() { final XQuery query = new XQuery( "xs:boolean(\"true\") lt xs:boolean(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-less-than-more-args-005.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:19:25 2005 * Purpose: To check if arg1: Boolean is less than arg2:Boolean * ************************************************************** * . */ @org.junit.Test public void opBooleanLessThanMoreArgs005() { final XQuery query = new XQuery( "xs:boolean(\"true\") lt xs:boolean(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-less-than-more-args-006.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:19:25 2005 * Purpose: To check if arg1: Boolean is less than arg2:Boolean * ************************************************************** * . */ @org.junit.Test public void opBooleanLessThanMoreArgs006() { final XQuery query = new XQuery( "xs:boolean(\"true\") lt xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-less-than-more-args-007.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:19:25 2005 * Purpose: To check if arg1: Boolean is less than arg2:Boolean * ************************************************************** * . */ @org.junit.Test public void opBooleanLessThanMoreArgs007() { final XQuery query = new XQuery( "xs:boolean(\"false\") lt xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-less-than-more-args-008.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:19:25 2005 * Purpose: To check if arg1: Boolean is less than arg2:Boolean * ************************************************************** * . */ @org.junit.Test public void opBooleanLessThanMoreArgs008() { final XQuery query = new XQuery( "xs:boolean(\"true\") ge xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-less-than-more-args-009.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:19:25 2005 * Purpose: To check if arg1: Boolean is less than arg2:Boolean * ************************************************************** * . */ @org.junit.Test public void opBooleanLessThanMoreArgs009() { final XQuery query = new XQuery( "xs:boolean(\"1\") ge xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-less-than-more-args-010.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:19:25 2005 * Purpose: To check if arg1: Boolean is less than arg2:Boolean * ************************************************************** * . */ @org.junit.Test public void opBooleanLessThanMoreArgs010() { final XQuery query = new XQuery( "xs:boolean(\"0\") ge xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-less-than-more-args-011.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:19:25 2005 * Purpose: To check if arg1: Boolean is less than arg2:Boolean * ************************************************************** * . */ @org.junit.Test public void opBooleanLessThanMoreArgs011() { final XQuery query = new XQuery( "xs:boolean(\"true\") ge xs:boolean(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-less-than-more-args-012.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:19:25 2005 * Purpose: To check if arg1: Boolean is less than arg2:Boolean * ************************************************************** * . */ @org.junit.Test public void opBooleanLessThanMoreArgs012() { final XQuery query = new XQuery( "xs:boolean(\"true\") ge xs:boolean(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-less-than-more-args-013.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:19:25 2005 * Purpose: To check if arg1: Boolean is less than arg2:Boolean * ************************************************************** * . */ @org.junit.Test public void opBooleanLessThanMoreArgs013() { final XQuery query = new XQuery( "xs:boolean(\"true\") ge xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-less-than-more-args-014.xq * Written By: Pulkita Tyagi * Date: Thu Jun 2 00:19:25 2005 * Purpose: To check if arg1: Boolean is less than arg2:Boolean * ************************************************************** * . */ @org.junit.Test public void opBooleanLessThanMoreArgs014() { final XQuery query = new XQuery( "xs:boolean(\"false\") ge xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-less-than2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:17 GMT-05:00 2004 * Purpose: Evaluates The "op:boolean-less-than" operator * with the arguments set as follows: * $arg1 = xs:boolean(lower bound) * $arg2 = xs:boolean(lower bound) * ******************************************************* * . */ @org.junit.Test public void opBooleanLessThan2args1() { final XQuery query = new XQuery( "xs:boolean(\"false\") lt xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-less-than2args-10 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:17 GMT-05:00 2004 * Purpose: Evaluates The "op:boolean-less-than" operator * with the arguments set as follows: * $arg1 = xs:boolean(lower bound) * $arg2 = xs:boolean(upper bound) * ******************************************************* * . */ @org.junit.Test public void opBooleanLessThan2args10() { final XQuery query = new XQuery( "xs:boolean(\"false\") ge xs:boolean(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-less-than2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:17 GMT-05:00 2004 * Purpose: Evaluates The "op:boolean-less-than" operator * with the arguments set as follows: * $arg1 = xs:boolean(mid range) * $arg2 = xs:boolean(lower bound) * ******************************************************* * . */ @org.junit.Test public void opBooleanLessThan2args2() { final XQuery query = new XQuery( "xs:boolean(\"1\") lt xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-less-than2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:17 GMT-05:00 2004 * Purpose: Evaluates The "op:boolean-less-than" operator * with the arguments set as follows: * $arg1 = xs:boolean(upper bound) * $arg2 = xs:boolean(lower bound) * ******************************************************* * . */ @org.junit.Test public void opBooleanLessThan2args3() { final XQuery query = new XQuery( "xs:boolean(\"0\") lt xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-less-than2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:17 GMT-05:00 2004 * Purpose: Evaluates The "op:boolean-less-than" operator * with the arguments set as follows: * $arg1 = xs:boolean(lower bound) * $arg2 = xs:boolean(mid range) * ******************************************************* * . */ @org.junit.Test public void opBooleanLessThan2args4() { final XQuery query = new XQuery( "xs:boolean(\"false\") lt xs:boolean(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-less-than2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:17 GMT-05:00 2004 * Purpose: Evaluates The "op:boolean-less-than" operator * with the arguments set as follows: * $arg1 = xs:boolean(lower bound) * $arg2 = xs:boolean(upper bound) * ******************************************************* * . */ @org.junit.Test public void opBooleanLessThan2args5() { final XQuery query = new XQuery( "xs:boolean(\"false\") lt xs:boolean(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-boolean-less-than2args-6 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:17 GMT-05:00 2004 * Purpose: Evaluates The "op:boolean-less-than" operator * with the arguments set as follows: * $arg1 = xs:boolean(lower bound) * $arg2 = xs:boolean(lower bound) * ******************************************************* * . */ @org.junit.Test public void opBooleanLessThan2args6() { final XQuery query = new XQuery( "xs:boolean(\"false\") ge xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-less-than2args-7 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:17 GMT-05:00 2004 * Purpose: Evaluates The "op:boolean-less-than" operator * with the arguments set as follows: * $arg1 = xs:boolean(mid range) * $arg2 = xs:boolean(lower bound) * ******************************************************* * . */ @org.junit.Test public void opBooleanLessThan2args7() { final XQuery query = new XQuery( "xs:boolean(\"1\") ge xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-less-than2args-8 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:17 GMT-05:00 2004 * Purpose: Evaluates The "op:boolean-less-than" operator * with the arguments set as follows: * $arg1 = xs:boolean(upper bound) * $arg2 = xs:boolean(lower bound) * ******************************************************* * . */ @org.junit.Test public void opBooleanLessThan2args8() { final XQuery query = new XQuery( "xs:boolean(\"0\") ge xs:boolean(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-boolean-less-than2args-9 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:17 GMT-05:00 2004 * Purpose: Evaluates The "op:boolean-less-than" operator * with the arguments set as follows: * $arg1 = xs:boolean(lower bound) * $arg2 = xs:boolean(mid range) * ******************************************************* * . */ @org.junit.Test public void opBooleanLessThan2args9() { final XQuery query = new XQuery( "xs:boolean(\"false\") ge xs:boolean(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpConcat.java�������������������������0000664�0000000�0000000�00000231433�12224530032�0026476�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the "||" concatenation operator (new in XPath 3.0). * Tests adapted from the fn:concat() tests by Michael Kay. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpConcat extends QT3TestSet { /** * * Purpose: A test whose essence is: `("ab" || "c") eq "abc"`. * . */ @org.junit.Test public void kConcatOp3() { final XQuery query = new XQuery( "(\"ab\" || \"c\") eq \"abc\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Purpose: A test whose essence is: `concat("ab" || "c") instance of xs:string`. * . */ @org.junit.Test public void kConcatOp4() { final XQuery query = new XQuery( "(\"ab\" || \"c\") instance of xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Purpose: A test whose essence is: `concat(() || ()) instance of xs:string`. * . */ @org.junit.Test public void kConcatOp5() { final XQuery query = new XQuery( "(() || ()) instance of xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Purpose: A test whose essence is: `concat(() || ()) eq ""`. * . */ @org.junit.Test public void kConcatOp6() { final XQuery query = new XQuery( "(() || ()) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Purpose: A test whose essence is: `('a' || 'b' || 'c' || () || 'd' || 'e' || 'f' || 'g' || 'h' || ' ' || 'i' || 'j' || 'k l') eq "abcdefgh ijk l"`. * . */ @org.junit.Test public void kConcatOp7() { final XQuery query = new XQuery( "('a' || 'b' || 'c' || () || 'd' || 'e' || 'f' || 'g' || 'h' || ' ' || 'i' || 'j' || 'k l') eq \"abcdefgh ijk l\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Purpose: A test whose essence is: `(1 || 2 || 3) eq "123"`. * . */ @org.junit.Test public void kConcatOp8() { final XQuery query = new XQuery( "(1 || 2 || 3) eq \"123\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Purpose: A test whose essence is: `(1 || "2" || 3) eq "123"`. * . */ @org.junit.Test public void kConcatOp9() { final XQuery query = new XQuery( "(1 || \"2\" || 3) eq \"123\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of concat function as per example 1 (for this function) * from the F&O specs. * . */ @org.junit.Test public void opConcat1() { final XQuery query = new XQuery( "('un' || 'grateful')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ungrateful") ); } /** * Evaluation of concat function with argument set to "*****" * . */ @org.junit.Test public void opConcat10() { final XQuery query = new XQuery( "(\"**\" || \"***\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "*****") ); } /** * Evaluation of concat function with argument that uses another concat function * . */ @org.junit.Test public void opConcat11() { final XQuery query = new XQuery( "((\"zzz\" || \"zz\") || \"123\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "zzzzz123") ); } /** * Evaluation of concat function as an argument to the "fn:boolean" function * . */ @org.junit.Test public void opConcat12() { final XQuery query = new XQuery( "fn:boolean((\"ab\" || \"cde\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of concat function as an argument to the "fn:string" function * . */ @org.junit.Test public void opConcat13() { final XQuery query = new XQuery( "fn:string((\"abc\" || \"de\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcde") ); } /** * Evaluation of concat function as an argument to the "fn:not" function * . */ @org.junit.Test public void opConcat14() { final XQuery query = new XQuery( "fn:not((\"ab\" || \"cde\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of concat function with argument set to "%$" || #@!" * . */ @org.junit.Test public void opConcat15() { final XQuery query = new XQuery( "(\"%$\" || \"#@!\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "%$#@!") ); } /** * Evaluation of concat function with argument set to "concat" || "concat" * . */ @org.junit.Test public void opConcat16() { final XQuery query = new XQuery( "(\"concat\" || \"concat\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "concatconcat") ); } /** * Evaluation of concat function as part of a boolean expression. */ @org.junit.Test public void opConcat17() { final XQuery query = new XQuery( "(\"abc\" || \"abc\") and (\"abc\" || \"abc\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Can't have a function item as an argument to concat. */ @org.junit.Test public void opConcat18() { final XQuery query = new XQuery( "(\"abc\" || \"abc\" || fn:concat#3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOTY0013") ); } /** * Concat operator has lower precedence than plus/minus. */ @org.junit.Test public void opConcat19() { final XQuery query = new XQuery( "12 || 34 - 50", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("\"12-16\"") && assertType("xs:string") ) ); } /** * Evaluation of concat function as per example 2 (for this function) * from the F&O specs. * . */ @org.junit.Test public void opConcat2() { final XQuery query = new XQuery( "('Thy ' || () || 'old ' || \"groans\" || \"\" || ' ring' || ' yet' || ' in' || ' my' || ' ancient' || ' ears.')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Thy old groans ring yet in my ancient ears.") ); } /** * Concat operator has higher precedence than eq. */ @org.junit.Test public void opConcat20() { final XQuery query = new XQuery( "\"1234\" eq 12 || 34", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of concat function as per example 3 (for this function) * from the F&O specs. * . */ @org.junit.Test public void opConcat3() { final XQuery query = new XQuery( "('Ciao!' || ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Ciao!") ); } /** * Evaluation of concat function as per example 4 (for this function) * from the F&O specs. * . */ @org.junit.Test public void opConcat4() { final XQuery query = new XQuery( "('Ingratitude, ' || 'thou ' || 'marble-hearted' || ' fiend!')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Ingratitude, thou marble-hearted fiend!") ); } /** * Evaluation of concat function that uses only upper case letters as part of argument * . */ @org.junit.Test public void opConcat5() { final XQuery query = new XQuery( "(\"AB\" || \"CD\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ABCD") ); } /** * Evaluation of concat function that uses only lower case letters as part of argument * . */ @org.junit.Test public void opConcat6() { final XQuery query = new XQuery( "(\"abc\" || \"de\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcde") ); } /** * Evaluation of concat function that uses both upper and lower case letters as part of argument * . */ @org.junit.Test public void opConcat7() { final XQuery query = new XQuery( "(\"ABCDE\" || \"abcde\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ABCDEabcde") ); } /** * Evaluation of concat function that uses the empty string as part of argument * Uses "fn:count" to avoid the empty file * . */ @org.junit.Test public void opConcat8() { final XQuery query = new XQuery( "fn:count((\"\" || \"\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluation of concat function that uses the "upper-case" function as part of argument * . */ @org.junit.Test public void opConcat9() { final XQuery query = new XQuery( "(fn:upper-case(\"Abc\") || fn:upper-case(\"DH\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ABCDH") ); } /** * * ******************************************************* * Test: concatdbl2args-1 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:double(lower bound) * $arg2 = xs:double(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatdbl2args1() { final XQuery query = new XQuery( "(xs:double(\"-1.7976931348623157E308\")||xs:double(\"-1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.7976931348623157E308-1.7976931348623157E308") ); } /** * * ******************************************************* * Test: concatdbl2args-2 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:double(mid range) * $arg2 = xs:double(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatdbl2args2() { final XQuery query = new XQuery( "(xs:double(\"0\")||xs:double(\"-1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0-1.7976931348623157E308") ); } /** * * ******************************************************* * Test: concatdbl2args-3 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:double(upper bound) * $arg2 = xs:double(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatdbl2args3() { final XQuery query = new XQuery( "(xs:double(\"1.7976931348623157E308\")||xs:double(\"-1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.7976931348623157E308-1.7976931348623157E308") ); } /** * * ******************************************************* * Test: concatdbl2args-4 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:double(lower bound) * $arg2 = xs:double(mid range) * ******************************************************* * . */ @org.junit.Test public void opConcatdbl2args4() { final XQuery query = new XQuery( "(xs:double(\"-1.7976931348623157E308\") || xs:double(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.7976931348623157E3080") ); } /** * * ******************************************************* * Test: concatdbl2args-5 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:double(lower bound) * $arg2 = xs:double(upper bound) * ******************************************************* * . */ @org.junit.Test public void opConcatdbl2args5() { final XQuery query = new XQuery( "(xs:double(\"-1.7976931348623157E308\") || xs:double(\"1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.7976931348623157E3081.7976931348623157E308") ); } /** * * ******************************************************* * Test: concatdec2args-1 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:decimal(lower bound) * $arg2 = xs:decimal(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatdec2args1() { final XQuery query = new XQuery( "(xs:decimal(\"-999999999999999999\")||xs:decimal(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999-999999999999999999") ); } /** * * ******************************************************* * Test: concatdec2args-2 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:decimal(mid range) * $arg2 = xs:decimal(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatdec2args2() { final XQuery query = new XQuery( "(xs:decimal(\"617375191608514839\")||xs:decimal(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "617375191608514839-999999999999999999") ); } /** * * ******************************************************* * Test: concatdec2args-3 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:decimal(upper bound) * $arg2 = xs:decimal(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatdec2args3() { final XQuery query = new XQuery( "(xs:decimal(\"999999999999999999\")||xs:decimal(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "999999999999999999-999999999999999999") ); } /** * * ******************************************************* * Test: concatdec2args-4 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:decimal(lower bound) * $arg2 = xs:decimal(mid range) * ******************************************************* * . */ @org.junit.Test public void opConcatdec2args4() { final XQuery query = new XQuery( "(xs:decimal(\"-999999999999999999\")||xs:decimal(\"617375191608514839\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999617375191608514839") ); } /** * * ******************************************************* * Test: concatdec2args-5 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:decimal(lower bound) * $arg2 = xs:decimal(upper bound) * ******************************************************* * . */ @org.junit.Test public void opConcatdec2args5() { final XQuery query = new XQuery( "(xs:decimal(\"-999999999999999999\")||xs:decimal(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999999999999999999999") ); } /** * * ******************************************************* * Test: concatflt2args-1 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:float(lower bound) * $arg2 = xs:float(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatflt2args1() { final XQuery query = new XQuery( "(xs:float(\"-3.4028235E38\") || xs:float(\"-3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-3.4028235E38-3.4028235E38") ); } /** * * ******************************************************* * Test: concatflt2args-2 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:float(mid range) * $arg2 = xs:float(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatflt2args2() { final XQuery query = new XQuery( "(xs:float(\"0\") || xs:float(\"-3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0-3.4028235E38") ); } /** * * ******************************************************* * Test: concatflt2args-3 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:float(upper bound) * $arg2 = xs:float(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatflt2args3() { final XQuery query = new XQuery( "(xs:float(\"3.4028235E38\") || xs:float(\"-3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3.4028235E38-3.4028235E38") ); } /** * * ******************************************************* * Test: concatflt2args-4 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:float(lower bound) * $arg2 = xs:float(mid range) * ******************************************************* * . */ @org.junit.Test public void opConcatflt2args4() { final XQuery query = new XQuery( "(xs:float(\"-3.4028235E38\") || xs:float(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-3.4028235E380") ); } /** * * ******************************************************* * Test: concatflt2args-5 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:float(lower bound) * $arg2 = xs:float(upper bound) * ******************************************************* * . */ @org.junit.Test public void opConcatflt2args5() { final XQuery query = new XQuery( "(xs:float(\"-3.4028235E38\") || xs:float(\"3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-3.4028235E383.4028235E38") ); } /** * * ******************************************************* * Test: concatint2args-1 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:int(lower bound) * $arg2 = xs:int(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatint2args1() { final XQuery query = new XQuery( "xs:int(\"-2147483648\")||xs:int(\"-2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-2147483648-2147483648") ); } /** * * ******************************************************* * Test: concatint2args-2 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:int(mid range) * $arg2 = xs:int(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatint2args2() { final XQuery query = new XQuery( "xs:int(\"-1873914410\")||xs:int(\"-2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1873914410-2147483648") ); } /** * * ******************************************************* * Test: concatint2args-3 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:int(upper bound) * $arg2 = xs:int(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatint2args3() { final XQuery query = new XQuery( "xs:int(\"2147483647\")||xs:int(\"-2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2147483647-2147483648") ); } /** * * ******************************************************* * Test: concatint2args-4 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:int(lower bound) * $arg2 = xs:int(mid range) * ******************************************************* * . */ @org.junit.Test public void opConcatint2args4() { final XQuery query = new XQuery( "(xs:int(\"-2147483648\")||xs:int(\"-1873914410\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-2147483648-1873914410") ); } /** * * ******************************************************* * Test: concatint2args-5 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:int(lower bound) * $arg2 = xs:int(upper bound) * ******************************************************* * . */ @org.junit.Test public void opConcatint2args5() { final XQuery query = new XQuery( "(xs:int(\"-2147483648\")||xs:int(\"2147483647\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-21474836482147483647") ); } /** * * ******************************************************* * Test: concatintg2args-1 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:integer(lower bound) * $arg2 = xs:integer(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatintg2args1() { final XQuery query = new XQuery( "(xs:integer(\"-999999999999999999\")||xs:integer(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999-999999999999999999") ); } /** * * ******************************************************* * Test: concatintg2args-2 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:integer(mid range) * $arg2 = xs:integer(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatintg2args2() { final XQuery query = new XQuery( "(xs:integer(\"830993497117024304\")||xs:integer(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "830993497117024304-999999999999999999") ); } /** * * ******************************************************* * Test: concatintg2args-3 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:integer(upper bound) * $arg2 = xs:integer(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatintg2args3() { final XQuery query = new XQuery( "(xs:integer(\"999999999999999999\")||xs:integer(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "999999999999999999-999999999999999999") ); } /** * * ******************************************************* * Test: concatintg2args-4 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:integer(lower bound) * $arg2 = xs:integer(mid range) * ******************************************************* * . */ @org.junit.Test public void opConcatintg2args4() { final XQuery query = new XQuery( "(xs:integer(\"-999999999999999999\")||xs:integer(\"830993497117024304\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999830993497117024304") ); } /** * * ******************************************************* * Test: concatintg2args-5 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:integer(lower bound) * $arg2 = xs:integer(upper bound) * ******************************************************* * . */ @org.junit.Test public void opConcatintg2args5() { final XQuery query = new XQuery( "(xs:integer(\"-999999999999999999\")||xs:integer(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999999999999999999999") ); } /** * * ******************************************************* * Test: concatlng2args-1 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:long(lower bound) * $arg2 = xs:long(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatlng2args1() { final XQuery query = new XQuery( "(xs:long(\"-92233720368547758\") || xs:long(\"-92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-92233720368547758-92233720368547758") ); } /** * * ******************************************************* * Test: concatlng2args-2 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:long(mid range) * $arg2 = xs:long(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatlng2args2() { final XQuery query = new XQuery( "(xs:long(\"-47175562203048468\") || xs:long(\"-92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-47175562203048468-92233720368547758") ); } /** * * ******************************************************* * Test: concatlng2args-3 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:long(upper bound) * $arg2 = xs:long(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatlng2args3() { final XQuery query = new XQuery( "(xs:long(\"92233720368547758\") || xs:long(\"-92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "92233720368547758-92233720368547758") ); } /** * * ******************************************************* * Test: concatlng2args-4 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:long(lower bound) * $arg2 = xs:long(mid range) * ******************************************************* * . */ @org.junit.Test public void opConcatlng2args4() { final XQuery query = new XQuery( "(xs:long(\"-92233720368547758\") || xs:long(\"-47175562203048468\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-92233720368547758-47175562203048468") ); } /** * * ******************************************************* * Test: concatlng2args-5 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:long(lower bound) * $arg2 = xs:long(upper bound) * ******************************************************* * . */ @org.junit.Test public void opConcatlng2args5() { final XQuery query = new XQuery( "(xs:long(\"-92233720368547758\") || xs:long(\"92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-9223372036854775892233720368547758") ); } /** * * ******************************************************* * Test: concatnint2args-1 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:negativeInteger(lower bound) * $arg2 = xs:negativeInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatnint2args1() { final XQuery query = new XQuery( "(xs:negativeInteger(\"-999999999999999999\") || xs:negativeInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999-999999999999999999") ); } /** * * ******************************************************* * Test: concatnint2args-2 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:negativeInteger(mid range) * $arg2 = xs:negativeInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatnint2args2() { final XQuery query = new XQuery( "(xs:negativeInteger(\"-297014075999096793\") || xs:negativeInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-297014075999096793-999999999999999999") ); } /** * * ******************************************************* * Test: concatnint2args-3 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:negativeInteger(upper bound) * $arg2 = xs:negativeInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatnint2args3() { final XQuery query = new XQuery( "(xs:negativeInteger(\"-1\") || xs:negativeInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1-999999999999999999") ); } /** * * ******************************************************* * Test: concatnint2args-4 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:negativeInteger(lower bound) * $arg2 = xs:negativeInteger(mid range) * ******************************************************* * . */ @org.junit.Test public void opConcatnint2args4() { final XQuery query = new XQuery( "(xs:negativeInteger(\"-999999999999999999\") || xs:negativeInteger(\"-297014075999096793\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999-297014075999096793") ); } /** * * ******************************************************* * Test: concatnint2args-5 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:negativeInteger(lower bound) * $arg2 = xs:negativeInteger(upper bound) * ******************************************************* * . */ @org.junit.Test public void opConcatnint2args5() { final XQuery query = new XQuery( "(xs:negativeInteger(\"-999999999999999999\") || xs:negativeInteger(\"-1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999-1") ); } /** * * ******************************************************* * Test: concatnni2args-1 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:nonNegativeInteger(lower bound) * $arg2 = xs:nonNegativeInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatnni2args1() { final XQuery query = new XQuery( "(xs:nonNegativeInteger(\"0\") || xs:nonNegativeInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "00") ); } /** * * ******************************************************* * Test: concatnni2args-2 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:nonNegativeInteger(mid range) * $arg2 = xs:nonNegativeInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatnni2args2() { final XQuery query = new XQuery( "(xs:nonNegativeInteger(\"303884545991464527\") || xs:nonNegativeInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3038845459914645270") ); } /** * * ******************************************************* * Test: concatnni2args-3 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:nonNegativeInteger(upper bound) * $arg2 = xs:nonNegativeInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatnni2args3() { final XQuery query = new XQuery( "(xs:nonNegativeInteger(\"999999999999999999\") || xs:nonNegativeInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9999999999999999990") ); } /** * * ******************************************************* * Test: concatnni2args-4 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:nonNegativeInteger(lower bound) * $arg2 = xs:nonNegativeInteger(mid range) * ******************************************************* * . */ @org.junit.Test public void opConcatnni2args4() { final XQuery query = new XQuery( "(xs:nonNegativeInteger(\"0\") || xs:nonNegativeInteger(\"303884545991464527\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0303884545991464527") ); } /** * * ******************************************************* * Test: concatnni2args-5 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:nonNegativeInteger(lower bound) * $arg2 = xs:nonNegativeInteger(upper bound) * ******************************************************* * . */ @org.junit.Test public void opConcatnni2args5() { final XQuery query = new XQuery( "(xs:nonNegativeInteger(\"0\") || xs:nonNegativeInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0999999999999999999") ); } /** * * ******************************************************* * Test: concatnpi2args-1 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:nonPositiveInteger(lower bound) * $arg2 = xs:nonPositiveInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatnpi2args1() { final XQuery query = new XQuery( "(xs:nonPositiveInteger(\"-999999999999999999\") || xs:nonPositiveInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999-999999999999999999") ); } /** * * ******************************************************* * Test: concatnpi2args-2 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:nonPositiveInteger(mid range) * $arg2 = xs:nonPositiveInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatnpi2args2() { final XQuery query = new XQuery( "(xs:nonPositiveInteger(\"-475688437271870490\") || xs:nonPositiveInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-475688437271870490-999999999999999999") ); } /** * * ******************************************************* * Test: concatnpi2args-3 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:nonPositiveInteger(upper bound) * $arg2 = xs:nonPositiveInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatnpi2args3() { final XQuery query = new XQuery( "(xs:nonPositiveInteger(\"0\") || xs:nonPositiveInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0-999999999999999999") ); } /** * * ******************************************************* * Test: concatnpi2args-4 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:nonPositiveInteger(lower bound) * $arg2 = xs:nonPositiveInteger(mid range) * ******************************************************* * . */ @org.junit.Test public void opConcatnpi2args4() { final XQuery query = new XQuery( "(xs:nonPositiveInteger(\"-999999999999999999\") || xs:nonPositiveInteger(\"-475688437271870490\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-999999999999999999-475688437271870490") ); } /** * * ******************************************************* * Test: concatnpi2args-5 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:nonPositiveInteger(lower bound) * $arg2 = xs:nonPositiveInteger(upper bound) * ******************************************************* * . */ @org.junit.Test public void opConcatnpi2args5() { final XQuery query = new XQuery( "(xs:nonPositiveInteger(\"-999999999999999999\") || xs:nonPositiveInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-9999999999999999990") ); } /** * * ******************************************************* * Test: concatpint2args-1 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:positiveInteger(lower bound) * $arg2 = xs:positiveInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatpint2args1() { final XQuery query = new XQuery( "(xs:positiveInteger(\"1\") || xs:positiveInteger(\"1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "11") ); } /** * * ******************************************************* * Test: concatpint2args-2 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:positiveInteger(mid range) * $arg2 = xs:positiveInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatpint2args2() { final XQuery query = new XQuery( "(xs:positiveInteger(\"52704602390610033\") || xs:positiveInteger(\"1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "527046023906100331") ); } /** * * ******************************************************* * Test: concatpint2args-3 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:positiveInteger(upper bound) * $arg2 = xs:positiveInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatpint2args3() { final XQuery query = new XQuery( "(xs:positiveInteger(\"999999999999999999\") || xs:positiveInteger(\"1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9999999999999999991") ); } /** * * ******************************************************* * Test: concatpint2args-4 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:positiveInteger(lower bound) * $arg2 = xs:positiveInteger(mid range) * ******************************************************* * . */ @org.junit.Test public void opConcatpint2args4() { final XQuery query = new XQuery( "(xs:positiveInteger(\"1\") || xs:positiveInteger(\"52704602390610033\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "152704602390610033") ); } /** * * ******************************************************* * Test: concatpint2args-5 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:positiveInteger(lower bound) * $arg2 = xs:positiveInteger(upper bound) * ******************************************************* * . */ @org.junit.Test public void opConcatpint2args5() { final XQuery query = new XQuery( "(xs:positiveInteger(\"1\") || xs:positiveInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999999999999999999") ); } /** * * ******************************************************* * Test: concatsht2args-1 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:short(lower bound) * $arg2 = xs:short(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatsht2args1() { final XQuery query = new XQuery( "(xs:short(\"-32768\") || xs:short(\"-32768\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-32768-32768") ); } /** * * ******************************************************* * Test: concatsht2args-2 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:short(mid range) * $arg2 = xs:short(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatsht2args2() { final XQuery query = new XQuery( "(xs:short(\"-5324\") || xs:short(\"-32768\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-5324-32768") ); } /** * * ******************************************************* * Test: concatsht2args-3 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:short(upper bound) * $arg2 = xs:short(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatsht2args3() { final XQuery query = new XQuery( "(xs:short(\"32767\") || xs:short(\"-32768\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "32767-32768") ); } /** * * ******************************************************* * Test: concatsht2args-4 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:short(lower bound) * $arg2 = xs:short(mid range) * ******************************************************* * . */ @org.junit.Test public void opConcatsht2args4() { final XQuery query = new XQuery( "(xs:short(\"-32768\") || xs:short(\"-5324\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-32768-5324") ); } /** * * ******************************************************* * Test: concatsht2args-5 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:short(lower bound) * $arg2 = xs:short(upper bound) * ******************************************************* * . */ @org.junit.Test public void opConcatsht2args5() { final XQuery query = new XQuery( "(xs:short(\"-32768\") || xs:short(\"32767\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-3276832767") ); } /** * * ******************************************************* * Test: concatulng2args-1 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:unsignedLong(lower bound) * $arg2 = xs:unsignedLong(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatulng2args1() { final XQuery query = new XQuery( "(xs:unsignedLong(\"0\") || xs:unsignedLong(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "00") ); } /** * * ******************************************************* * Test: concatulng2args-2 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:unsignedLong(mid range) * $arg2 = xs:unsignedLong(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatulng2args2() { final XQuery query = new XQuery( "(xs:unsignedLong(\"130747108607674654\") || xs:unsignedLong(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1307471086076746540") ); } /** * * ******************************************************* * Test: concatulng2args-3 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:unsignedLong(upper bound) * $arg2 = xs:unsignedLong(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatulng2args3() { final XQuery query = new XQuery( "(xs:unsignedLong(\"184467440737095516\") || xs:unsignedLong(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1844674407370955160") ); } /** * * ******************************************************* * Test: concatulng2args-4 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:unsignedLong(lower bound) * $arg2 = xs:unsignedLong(mid range) * ******************************************************* * . */ @org.junit.Test public void opConcatulng2args4() { final XQuery query = new XQuery( "(xs:unsignedLong(\"0\") || xs:unsignedLong(\"130747108607674654\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0130747108607674654") ); } /** * * ******************************************************* * Test: concatulng2args-5 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:unsignedLong(lower bound) * $arg2 = xs:unsignedLong(upper bound) * ******************************************************* * . */ @org.junit.Test public void opConcatulng2args5() { final XQuery query = new XQuery( "(xs:unsignedLong(\"0\") || xs:unsignedLong(\"184467440737095516\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0184467440737095516") ); } /** * * ******************************************************* * Test: concatusht2args-1 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:unsignedShort(lower bound) * $arg2 = xs:unsignedShort(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatusht2args1() { final XQuery query = new XQuery( "(xs:unsignedShort(\"0\") || xs:unsignedShort(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "00") ); } /** * * ******************************************************* * Test: concatusht2args-2 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:unsignedShort(mid range) * $arg2 = xs:unsignedShort(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatusht2args2() { final XQuery query = new XQuery( "(xs:unsignedShort(\"44633\") || xs:unsignedShort(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "446330") ); } /** * * ******************************************************* * Test: concatusht2args-3 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:unsignedShort(upper bound) * $arg2 = xs:unsignedShort(lower bound) * ******************************************************* * . */ @org.junit.Test public void opConcatusht2args3() { final XQuery query = new XQuery( "(xs:unsignedShort(\"65535\") || xs:unsignedShort(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "655350") ); } /** * * ******************************************************* * Test: concatusht2args-4 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:unsignedShort(lower bound) * $arg2 = xs:unsignedShort(mid range) * ******************************************************* * . */ @org.junit.Test public void opConcatusht2args4() { final XQuery query = new XQuery( "(xs:unsignedShort(\"0\") || xs:unsignedShort(\"44633\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "044633") ); } /** * * ******************************************************* * Test: concatusht2args-5 * Written By: Carmelo Montanez * Date: Wed Dec 15 15:41:48 GMT-05:00 2004 * Purpose: Evaluates The "concat" function * with the arguments set as follows: * $arg1 = xs:unsignedShort(lower bound) * $arg2 = xs:unsignedShort(upper bound) * ******************************************************* * . */ @org.junit.Test public void opConcatusht2args5() { final XQuery query = new XQuery( "(xs:unsignedShort(\"0\") || xs:unsignedShort(\"65535\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "065535") ); } } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpConcatenate.java��������������������0000664�0000000�0000000�00000065435�12224530032�0027522�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the concatenate() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpConcatenate extends QT3TestSet { /** * A heavily nested sequence of expressions with the comma operator. On some implementations this triggers certain optimization paths. . */ @org.junit.Test public void kCommaOp1() { final XQuery query = new XQuery( "deep-equal(((1, (2, (3, 4, (5, 6)), 7), 8, (9, 10), 11)), (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An expression sequence containing only empty sequences. On some implementations this triggers certain optimization paths. . */ @org.junit.Test public void kCommaOp2() { final XQuery query = new XQuery( "empty(((), (), ((), (), ((), (), (())), ()), (), (())))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An expression sequence containing many empty sequences and one xs:string. On some implementations this triggers certain optimization paths. . */ @org.junit.Test public void kCommaOp3() { final XQuery query = new XQuery( "((), (), ((), (), ((), (), (\"str\")), ()), (), (())) eq \"str\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Constructing sequences. Constructing a sequence, where one of the members is an addition operation . */ @org.junit.Test public void constSeq1() { final XQuery query = new XQuery( "(1, 1 + 1, 3, 4, 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1, 2, 3, 4, 5") ); } /** * Constructing sequences. Constructing a sequence, where both members contains invocation to "fn:not()" function. . */ @org.junit.Test public void constSeq10() { final XQuery query = new XQuery( " (fn:not(\"true\"),fn:not(\"false\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("false(), false()") ); } /** * Constructing sequences. Constructing a sequence, where one of its members contains a boolean (and) operation. . */ @org.junit.Test public void constSeq11() { final XQuery query = new XQuery( " (fn:true() and fn:true(), fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("true(), true()") ); } /** * Constructing sequences. Constructing a sequence, where one of its members contains a boolean (or) operation. . */ @org.junit.Test public void constSeq12() { final XQuery query = new XQuery( " (fn:true() or fn:true(), fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("true(), true()") ); } /** * Constructing sequences. Constructing a sequence, where one of its members contains invocation to "xs:string()". . */ @org.junit.Test public void constSeq13() { final XQuery query = new XQuery( " (xs:string(\"ABC\"), \"D\", \"E\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"ABC\", \"D\", \"E\"") ); } /** * Constructing sequences. Constructing a sequence, where one of its members contains invocation to "xs:integer". . */ @org.junit.Test public void constSeq14() { final XQuery query = new XQuery( " (xs:integer(1), 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1, 2, 3") ); } /** * Constructing sequences. Constructing a sequence, where one of its members contains invocation to "xs:decimal()". . */ @org.junit.Test public void constSeq15() { final XQuery query = new XQuery( " (xs:decimal(1), 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1, 2, 3") ); } /** * Constructing sequences. Constructing a sequence, where both of its members contains invocation to "xs:anyURI". . */ @org.junit.Test public void constSeq16() { final XQuery query = new XQuery( " (xs:anyURI(\"http://www.example.com\"),xs:anyURI(\"http://www.example1.com\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"http://www.example.com\", \"http://www.example1.com\"") ); } /** * Constructing sequences. Constructing a sequence, where one of its members contains invocation to "xs:float". . */ @org.junit.Test public void constSeq17() { final XQuery query = new XQuery( " (xs:float(1.1), 2.2, 3.3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("xs:float('1.1e0'), 2.2, 3.3") ); } /** * Constructing sequences. Constructing a sequence, where one of its members contains invocation to "xs:double()". . */ @org.junit.Test public void constSeq18() { final XQuery query = new XQuery( " (xs:double(1.2E2), 2.2E2, 3.3E2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("120, 220, 330") ); } /** * Constructing sequences. Constructing a sequence, where one of its members contains invocation to "xs:boolean()". . */ @org.junit.Test public void constSeq19() { final XQuery query = new XQuery( " (xs:boolean(fn:true()), fn:false(), fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("true(), false(), true()") ); } /** * Constructing sequences. Constructing a sequence, where one of the members is subtraction operation. . */ @org.junit.Test public void constSeq2() { final XQuery query = new XQuery( "(1, 3 - 1, 3, 4, 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1, 2 ,3, 4, 5") ); } /** * Constructing sequences. Constructing a sequence, where both of its members contains invocation to "xs:date()". . */ @org.junit.Test public void constSeq20() { final XQuery query = new XQuery( " (xs:date(\"2004-12-25Z\"),xs:date(\"2004-12-26Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2004-12-25Z 2004-12-26Z") ); } /** * Constructing sequences. Constructing a sequence, where both of its members contains invocation to "xs:dateTime()". . */ @org.junit.Test public void constSeq21() { final XQuery query = new XQuery( " (xs:dateTime(\"1999-11-28T09:00:00Z\"),xs:dateTime(\"1998-11-28T09:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-11-28T09:00:00Z 1998-11-28T09:00:00Z") ); } /** * Constructing sequences. Constructing a sequence, where both of its members contains invocation to "xs:time()". . */ @org.junit.Test public void constSeq22() { final XQuery query = new XQuery( " (xs:time(\"08:00:00+09:00\"),xs:time(\"08:00:00+10:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "08:00:00+09:00 08:00:00+10:00") ); } /** * Constructing sequences. Constructing a sequence, where one of the members is a multiplication operation. . */ @org.junit.Test public void constSeq3() { final XQuery query = new XQuery( " (1, 2 * 1, 3, 4, 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1, 2, 3, 4, 5") ); } /** * Constructing sequences. Constructing a sequence, where one of the members is a division (div) operation. . */ @org.junit.Test public void constSeq4() { final XQuery query = new XQuery( " (1, 4 div 2, 3, 4, 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1, 2, 3, 4, 5") ); } /** * Constructing sequences. Constructing a sequence, where one of the members is a division (idiv) operation. . */ @org.junit.Test public void constSeq5() { final XQuery query = new XQuery( " (1, 4 idiv 2, 3, 4, 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1, 2, 3, 4, 5") ); } /** * Constructing sequences. Constructing a sequence, where one of the members contains invocation to "fn:count" function. . */ @org.junit.Test public void constSeq6() { final XQuery query = new XQuery( " (1, fn:count((1, 2)), 3, 4, 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1, 2, 3, 4, 5") ); } /** * Constructing sequences. Constructing a sequence, where one of the members contains invocation to "fn:string-length" function. . */ @org.junit.Test public void constSeq7() { final XQuery query = new XQuery( " (1, fn:string-length(\"AB\"), 3, 4, 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1, 2, 3, 4, 5") ); } /** * Constructing sequences. Constructing a sequence, where both members contains invocation to "fn:true" function. . */ @org.junit.Test public void constSeq8() { final XQuery query = new XQuery( " (fn:true(),fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("true(), true()") ); } /** * Constructing sequences. Constructing a sequence, where both members contains invocation to "fn:false" function. . */ @org.junit.Test public void constSeq9() { final XQuery query = new XQuery( " (fn:false(),fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("false(), false()") ); } /** * arg1 & arg2 : sequence of number . */ @org.junit.Test public void opConcatenateMixArgs001() { final XQuery query = new XQuery( "(1) , (2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1, 2") ); } /** * arg1 & arg2 : string . */ @org.junit.Test public void opConcatenateMixArgs002() { final XQuery query = new XQuery( "xs:string(\"a\") , xs:string(\"b\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", \"b\"") ); } /** * args : string . */ @org.junit.Test public void opConcatenateMixArgs003() { final XQuery query = new XQuery( "xs:string(\"a\") , (), \"xyz\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", \"xyz\"") ); } /** * args : string . */ @org.junit.Test public void opConcatenateMixArgs004() { final XQuery query = new XQuery( "\"xyz\" , xs:string(\" \"), \"b\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"xyz\", \" \", \"b\"") ); } /** * arg1 : string, arg2:anyURI . */ @org.junit.Test public void opConcatenateMixArgs005() { final XQuery query = new XQuery( "xs:string(\"a\") , xs:anyURI(\"www.example.com\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"a\", \"www.example.com\"") ); } /** * arg1 : string, arg2:integer, arg3:anyURI . */ @org.junit.Test public void opConcatenateMixArgs006() { final XQuery query = new XQuery( "xs:string(\"hello\") , xs:integer(\"100\"), xs:anyURI(\"www.example.com\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"hello\", 100, \"www.example.com\"") ); } /** * arg1 : anyURI, arg2: decimal . */ @org.junit.Test public void opConcatenateMixArgs007() { final XQuery query = new XQuery( "xs:anyURI(\"www.example.com\") , xs:decimal(\"1.01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("\"www.example.com\", 1.01") ); } /** * arg1 & arg2 : float . */ @org.junit.Test public void opConcatenateMixArgs008() { final XQuery query = new XQuery( "xs:float(\"1.01\"), xs:float(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.01 NaN") ); } /** * arg1:float, arg2: double . */ @org.junit.Test public void opConcatenateMixArgs009() { final XQuery query = new XQuery( "xs:float(\"INF\") , xs:double(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF NaN") ); } /** * arg1: double, arg2: double, arg3:float . */ @org.junit.Test public void opConcatenateMixArgs010() { final XQuery query = new XQuery( "xs:double(\"INF\"), xs:double(\"-INF\"), xs:float(\"-INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF -INF -INF") ); } /** * arg1:boolean, arg2: boolean, arg3: integer . */ @org.junit.Test public void opConcatenateMixArgs011() { final XQuery query = new XQuery( "xs:boolean(\"true\") , xs:boolean(\"0\"), xs:integer(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("true(), false(), 0") ); } /** * arg1:boolean, arg2: boolean . */ @org.junit.Test public void opConcatenateMixArgs012() { final XQuery query = new XQuery( "xs:boolean(\"false\"), xs:boolean(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("false(), true()") ); } /** * arg1:date, arg2: boolean, arg3: string . */ @org.junit.Test public void opConcatenateMixArgs013() { final XQuery query = new XQuery( "xs:date(\"1993-03-31\") , xs:boolean(\"true\"), xs:string(\"abc\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1993-03-31 true abc") ); } /** * arg1:dateTime, arg2: empty sequence . */ @org.junit.Test public void opConcatenateMixArgs014() { final XQuery query = new XQuery( "xs:dateTime(\"1972-12-31T00:00:00Z\") , (())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1972-12-31T00:00:00Z") ); } /** * arg1:time, arg2: string , arg3: decimal . */ @org.junit.Test public void opConcatenateMixArgs015() { final XQuery query = new XQuery( "xs:time(\"12:30:00Z\") , xs:string(\" \") , xs:decimal(\"2.000000000000002\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12:30:00Z 2.000000000000002") ); } /** * arg1:empty seq, arg2: string , arg3: decimal . */ @org.junit.Test public void opConcatenateMixArgs016() { final XQuery query = new XQuery( "() , xs:string(\" \") , xs:decimal(\"2.000000000000002\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, " 2.000000000000002") ); } /** * Use simple arithmetic expression with concat . */ @org.junit.Test public void opConcatenateMixArgs017() { final XQuery query = new XQuery( "(1+1), (2-2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("2, 0") ); } /** * Concat more than two sequences . */ @org.junit.Test public void opConcatenateMixArgs018() { final XQuery query = new XQuery( "(1,2,2),(1,2,3),(123,\"\"),(),(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1, 2, 2, 1, 2, 3, 123, \"\", \"\"") ); } /** * Written By: Ravindranath Chennnoju Use an external variable with op:concatenate . */ @org.junit.Test public void opConcatenateMixArgs019() { final XQuery query = new XQuery( "//book/price, (), (1)", ctx); try { query.context(node(file("docs/bib.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("<price>65.95</price><price>65.95</price><price>39.95</price><price>129.95</price>1", false) ); } /** * Use two external variables with op:contenate . */ @org.junit.Test public void opConcatenateMixArgs020() { final XQuery query = new XQuery( "//book/price, //book/title", ctx); try { query.context(node(file("docs/bib.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("<price>65.95</price><price>65.95</price><price>39.95</price><price>129.95</price><title>TCP/IP IllustratedAdvanced Programming in the Unix environmentData on the WebThe Economics of Technology and Content for Digital TV", false) ); } /** * Constructing Sequences. Simple sequence involving integers. . */ @org.junit.Test public void sequenceexpressionhc1() { final XQuery query = new XQuery( "(1,2,3,4,5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1, 2, 3, 4, 5") ); } /** * Constructing Sequences. Simple sequence involving nested sequences. . */ @org.junit.Test public void sequenceexpressionhc2() { final XQuery query = new XQuery( "(1,(2,3),4,5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1, 2, 3, 4, 5") ); } /** * Constructing Sequences. Simple sequence involving the empty sequence. . */ @org.junit.Test public void sequenceexpressionhc3() { final XQuery query = new XQuery( "(1, 2, (), 3, 4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1, 2, 3, 4") ); } /** * Constructing Sequences. Simple sequence involving the "to" operand. . */ @org.junit.Test public void sequenceexpressionhc4() { final XQuery query = new XQuery( "(1, 2 to 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1, 2, 3, 4, 5") ); } /** * Constructing Sequences. Simple sequence involving repetition . */ @org.junit.Test public void sequenceexpressionhc5() { final XQuery query = new XQuery( "(1, 2, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1, 2, 2") ); } /** * Constructing Sequences. Simple sequence expression resulting in an empty sequence. Uses count to avoid empty file. . */ @org.junit.Test public void sequenceexpressionhc6() { final XQuery query = new XQuery( "count((15 to 10))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Constructing Sequences. Simple sequence expression that results on a sequence in reverse order . */ @org.junit.Test public void sequenceexpressionhc7() { final XQuery query = new XQuery( "fn:reverse(10 to 15)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("15, 14, 13, 12, 11, 10") ); } /** * Constructing Sequences. Sequence expression resulting by quering xml file string data . */ @org.junit.Test public void sequenceexpressionhc8() { final XQuery query = new XQuery( "//empnum", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("E1E1E1E1E1E1E2E2E3E3E4E4E4", false) ); } /** * Constructing Sequences. Sequence expression resulting by quering xml file string data (multiple xml sources) . */ @org.junit.Test public void sequenceexpressionhc9() { final XQuery query = new XQuery( " ($works//empnum,$staff//empname)", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("E1E1E1E1E1E1E2E2E3E3E4E4E4AliceBettyCarmenDonEd", false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpDateEqual.java000066400000000000000000001061311222453003200271300ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the date-equal() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpDateEqual extends QT3TestSet { /** * * ******************************************************* * Test: K-DateEQ-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'eq' for xs:date, returning positive. * ******************************************************* * . */ @org.junit.Test public void kDateEQ1() { final XQuery query = new XQuery( "xs:date(\"2004-08-12\") eq xs:date(\"2004-08-12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateEQ-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'eq' for xs:date. * ******************************************************* * . */ @org.junit.Test public void kDateEQ2() { final XQuery query = new XQuery( "not(xs:date(\"2004-08-12\") eq xs:date(\"2003-08-12\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateEQ-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ne' for xs:date. * ******************************************************* * . */ @org.junit.Test public void kDateEQ3() { final XQuery query = new XQuery( "xs:date(\"2004-08-12\") ne xs:date(\"2004-07-12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateEQ-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ne' for xs:date. * ******************************************************* * . */ @org.junit.Test public void kDateEQ4() { final XQuery query = new XQuery( "not(xs:date(\"2004-07-12\") ne xs:date(\"2004-07-12\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateEQ-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset -00:00 is equal to Z, in xs:date. * ******************************************************* * . */ @org.junit.Test public void kDateEQ5() { final XQuery query = new XQuery( "xs:date(\"1999-12-04-00:00\") eq xs:date(\"1999-12-04Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateEQ-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset +00:00 is equal to Z, in xs:date. * ******************************************************* * . */ @org.junit.Test public void kDateEQ6() { final XQuery query = new XQuery( "xs:date(\"1999-12-04+00:00\") eq xs:date(\"1999-12-04Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateEQ-7 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset Z is equal to Z, in xs:date. * ******************************************************* * . */ @org.junit.Test public void kDateEQ7() { final XQuery query = new XQuery( "xs:date(\"1999-12-04Z\") eq xs:date(\"1999-12-04Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateEQ-8 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset -00:00 is equal to +00:00, in xs:date. * ******************************************************* * . */ @org.junit.Test public void kDateEQ8() { final XQuery query = new XQuery( "xs:date(\"1999-12-04-00:00\") eq xs:date(\"1999-12-04+00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K2-DateEQ-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Basic negative equalness test for xs:date. * ******************************************************* * . */ @org.junit.Test public void k2DateEQ1() { final XQuery query = new XQuery( "xs:time(\"01:01:01-03:00\") ne xs:time(\"01:01:01+03:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that comparing large dates does not overflow. . */ @org.junit.Test public void cbclDateEq001() { final XQuery query = new XQuery( "xs:date(\"-25252734927766555-06-07+02:00\") = xs:date(\"25252734927766555-07-28\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FODT0001") || assertBoolean(false) ) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateEqual001() { final XQuery query = new XQuery( "declare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string }; declare function local:date($year as xs:integer, $month as xs:integer, $day as xs:integer) { let $m := local:two-digit($month), $d := local:two-digit($day) return xs:date(concat($year, '-', $m, '-', $d)) }; not(local:date(2008, 05, 12) eq xs:date(\"1972-12-15\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateEqual002() { final XQuery query = new XQuery( "xs:date(\"2008-01-30\") eq xs:date(\"2008-01-31+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateEqual003() { final XQuery query = new XQuery( "xs:date(\"2008-01-31+09:00\") eq xs:date(\"2008-01-30\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateEqual004() { final XQuery query = new XQuery( "xs:date(\"2008-01-31\") eq xs:date(\"2008-01-31+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateEqual005() { final XQuery query = new XQuery( "xs:date(\"2008-01-31+09:00\") eq xs:date(\"2008-01-31\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateEqual006() { final XQuery query = new XQuery( "declare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string }; declare function local:date($year as xs:integer, $month as xs:integer, $day as xs:integer) { let $m := local:two-digit($month), $d := local:two-digit($day) return xs:date(concat($year, '-', $m, '-', $d)) }; not(local:date(2008, 05, 12) ne xs:date(\"1972-12-15\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateEqual007() { final XQuery query = new XQuery( "xs:date(\"2008-01-30\") ne xs:date(\"2008-01-31+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateEqual008() { final XQuery query = new XQuery( "xs:date(\"2008-01-31+09:00\") ne xs:date(\"2008-01-30\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateEqual009() { final XQuery query = new XQuery( "xs:date(\"2008-01-31\") ne xs:date(\"2008-01-31+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateEqual010() { final XQuery query = new XQuery( "xs:date(\"2008-01-31+09:00\") ne xs:date(\"2008-01-31\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateEqual011() { final XQuery query = new XQuery( "declare function local:date($date as xs:date, $null as xs:boolean) { if ($null) then () else $date }; exists(local:date(xs:date(\"1972-12-15\"), fn:true()) eq xs:date(\"1972-12-15\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateEqual012() { final XQuery query = new XQuery( "declare function local:date($date as xs:date, $null as xs:boolean) { if ($null) then () else $date }; local:date(xs:date(\"1972-12-15\"), fn:false()) eq xs:date(\"1972-12-15\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateEqual013() { final XQuery query = new XQuery( "declare function local:date($date as xs:date, $null as xs:boolean) { if ($null) then () else $date }; exists(local:date(xs:date(\"1972-12-15\"), fn:true()) ne xs:date(\"1972-12-15\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateEqual014() { final XQuery query = new XQuery( "declare function local:date($date as xs:date, $null as xs:boolean) { if ($null) then () else $date }; local:date(xs:date(\"1972-12-15\"), fn:false()) ne xs:date(\"1972-12-15\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateEqual015() { final XQuery query = new XQuery( "declare function local:date($date as xs:string, $timezone as xs:string) { xs:date( concat($date, $timezone) ) }; adjust-date-to-timezone(local:date(\"1972-12-14\", \"-12:00\")) eq adjust-date-to-timezone(xs:date(\"1972-12-15+12:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateEqual016() { final XQuery query = new XQuery( "declare function local:date($date as xs:string, $timezone as xs:string) { xs:date( concat($date, $timezone) ) }; adjust-date-to-timezone(local:date(\"1972-12-14\", \"-12:00\")) ne adjust-date-to-timezone(xs:date(\"1972-12-15+12:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test that comparing large dates does not overflow. . */ @org.junit.Test public void cbclDateNe001() { final XQuery query = new XQuery( "xs:date(\"25252734927766555-07-28\") != xs:date(\"-25252734927766555-06-07+02:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FODT0001") || assertBoolean(true) ) ); } /** * * ******************************************************* * Test: op-date-equal2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-equal" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:date(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateEqual2args1() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") eq xs:date(\"1970-01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-equal2args-10 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-equal" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:date(upper bound) * ******************************************************* * . */ @org.junit.Test public void opDateEqual2args10() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") ne xs:date(\"2030-12-31Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-equal2args-11 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:date-equal" operator (le) * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:date(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateEqual2args11() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") le xs:date(\"1970-01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-equal2args-12 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:date-equal" operator (le) * with the arguments set as follows: * $arg1 = xs:date(mid range) * $arg2 = xs:date(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateEqual2args12() { final XQuery query = new XQuery( "xs:date(\"1983-11-17Z\") le xs:date(\"1970-01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-equal2args-13 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:date-equal" operator (le) * with the arguments set as follows: * $arg1 = xs:date(upper bound) * $arg2 = xs:date(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateEqual2args13() { final XQuery query = new XQuery( "xs:date(\"2030-12-31Z\") le xs:date(\"1970-01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-equal2args-14 * Written By: Carmelo Montanez * Date: June 14, 2005 * Purpose: Evaluates The "op:date-equal" operator (le) * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:date(mid range) * ******************************************************* * . */ @org.junit.Test public void opDateEqual2args14() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") le xs:date(\"1983-11-17Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-equal2args-15 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:date-equal" operator (le) * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:date(upper bound) * ******************************************************* * . */ @org.junit.Test public void opDateEqual2args15() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") le xs:date(\"2030-12-31Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-equal2args-16 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:date-equal" operator (ge) * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:date(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateEqual2args16() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") ge xs:date(\"1970-01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-equal2args-17 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:date-equal" operator (ge) * with the arguments set as follows: * $arg1 = xs:date(mid range) * $arg2 = xs:date(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateEqual2args17() { final XQuery query = new XQuery( "xs:date(\"1983-11-17Z\") ge xs:date(\"1970-01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-equal2args-18 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:date-equal" operator (ge) * with the arguments set as follows: * $arg1 = xs:date(upper bound) * $arg2 = xs:date(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateEqual2args18() { final XQuery query = new XQuery( "xs:date(\"2030-12-31Z\") ge xs:date(\"1970-01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-equal2args-19 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:date-equal" operator (ge) * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:date(mid range) * ******************************************************* * . */ @org.junit.Test public void opDateEqual2args19() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") ge xs:date(\"1983-11-17Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-equal2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-equal" operator * with the arguments set as follows: * $arg1 = xs:date(mid range) * $arg2 = xs:date(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateEqual2args2() { final XQuery query = new XQuery( "xs:date(\"1983-11-17Z\") eq xs:date(\"1970-01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-equal2args-20 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:date-equal" operator (ge) * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:date(upper bound) * ******************************************************* * . */ @org.junit.Test public void opDateEqual2args20() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") ge xs:date(\"2030-12-31Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-equal2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-equal" operator * with the arguments set as follows: * $arg1 = xs:date(upper bound) * $arg2 = xs:date(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateEqual2args3() { final XQuery query = new XQuery( "xs:date(\"2030-12-31Z\") eq xs:date(\"1970-01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-equal2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-equal" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:date(mid range) * ******************************************************* * . */ @org.junit.Test public void opDateEqual2args4() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") eq xs:date(\"1983-11-17Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-equal2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-equal" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:date(upper bound) * ******************************************************* * . */ @org.junit.Test public void opDateEqual2args5() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") eq xs:date(\"2030-12-31Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-equal2args-6 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-equal" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:date(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateEqual2args6() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") ne xs:date(\"1970-01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-equal2args-7 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-equal" operator * with the arguments set as follows: * $arg1 = xs:date(mid range) * $arg2 = xs:date(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateEqual2args7() { final XQuery query = new XQuery( "xs:date(\"1983-11-17Z\") ne xs:date(\"1970-01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-equal2args-8 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-equal" operator * with the arguments set as follows: * $arg1 = xs:date(upper bound) * $arg2 = xs:date(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateEqual2args8() { final XQuery query = new XQuery( "xs:date(\"2030-12-31Z\") ne xs:date(\"1970-01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-equal2args-9 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-equal" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:date(mid range) * ******************************************************* * . */ @org.junit.Test public void opDateEqual2args9() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") ne xs:date(\"1983-11-17Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpDateGreaterThan.java000066400000000000000000001076211222453003200302720ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the date-greater-than() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpDateGreaterThan extends QT3TestSet { /** * * ******************************************************* * Test: K-DateGT-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'gt' for xs:date. * ******************************************************* * . */ @org.junit.Test public void kDateGT1() { final XQuery query = new XQuery( "xs:date(\"2004-07-13\") gt xs:date(\"2004-07-12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateGT-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'gt' for xs:date. * ******************************************************* * . */ @org.junit.Test public void kDateGT2() { final XQuery query = new XQuery( "not(xs:date(\"2004-07-12\") gt xs:date(\"2004-07-12\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateGT-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'gt' for xs:date. * ******************************************************* * . */ @org.junit.Test public void kDateGT3() { final XQuery query = new XQuery( "not(xs:date(\"2004-07-12\") gt xs:date(\"2004-07-13\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateGT-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ge' for xs:date. * ******************************************************* * . */ @org.junit.Test public void kDateGT4() { final XQuery query = new XQuery( "xs:date(\"2004-07-12\") ge xs:date(\"2004-07-12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateGT-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ge' for xs:date. * ******************************************************* * . */ @org.junit.Test public void kDateGT5() { final XQuery query = new XQuery( "xs:date(\"2004-07-13\") ge xs:date(\"2004-07-12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateGT-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ge' for xs:date. * ******************************************************* * . */ @org.junit.Test public void kDateGT6() { final XQuery query = new XQuery( "not(xs:date(\"2004-07-11\") ge xs:date(\"2004-07-12\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateGreaterEqual001() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string }; declare function local:date($year as xs:integer, $month as xs:integer, $day as xs:integer) { let $m := local:two-digit($month), $d := local:two-digit($day) return xs:date(concat($year, '-', $m, '-', $d)) }; \n" + " \tnot(local:date(2008, 05, 12) lt xs:date(\"1972-12-15\"))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateGreaterEqual002() { final XQuery query = new XQuery( "xs:date(\"2008-01-30\") lt xs:date(\"2008-01-31+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateGreaterEqual003() { final XQuery query = new XQuery( "xs:date(\"2008-01-31+09:00\") lt xs:date(\"2008-01-30\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateGreaterEqual004() { final XQuery query = new XQuery( "xs:date(\"2008-01-31\") lt xs:date(\"2008-01-31+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateGreaterEqual005() { final XQuery query = new XQuery( "xs:date(\"2008-01-31+09:00\") lt xs:date(\"2008-01-31\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateGreaterEqual006() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string }; \n" + " \tdeclare function local:date($year as xs:integer, $month as xs:integer, $day as xs:integer) { let $m := local:two-digit($month), $d := local:two-digit($day) return xs:date(concat($year, '-', $m, '-', $d)) }; \n" + " \tnot(local:date(2008, 05, 12) ge xs:date(\"1972-12-15\"))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateGreaterEqual007() { final XQuery query = new XQuery( "xs:date(\"2008-01-30\") ge xs:date(\"2008-01-31+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateGreaterEqual008() { final XQuery query = new XQuery( "xs:date(\"2008-01-31+09:00\") ge xs:date(\"2008-01-30\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateGreaterEqual009() { final XQuery query = new XQuery( "xs:date(\"2008-01-31\") ge xs:date(\"2008-01-31+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateGreaterEqual010() { final XQuery query = new XQuery( "xs:date(\"2008-01-31+09:00\") ge xs:date(\"2008-01-31\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateGreaterThan011() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:date($date as xs:date, $null as xs:boolean) { if ($null) then () else $date }; \n" + " \texists(local:date(xs:date(\"1972-12-15\"), fn:true()) gt xs:date(\"1972-12-15\"))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateGreaterThan012() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:date($date as xs:date, $null as xs:boolean) { if ($null) then () else $date }; \n" + " \tlocal:date(xs:date(\"1972-12-15\"), fn:false()) gt xs:date(\"1972-12-15\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateGreaterThan013() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:date($date as xs:date, $null as xs:boolean) { if ($null) then () else $date }; \n" + " \texists(local:date(xs:date(\"1972-12-15\"), fn:true()) le xs:date(\"1972-12-15\"))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateGreaterThan014() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:date($date as xs:date, $null as xs:boolean) { if ($null) then () else $date }; \n" + " \tlocal:date(xs:date(\"1972-12-15\"), fn:false()) le xs:date(\"1972-12-15\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateGreaterThan015() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:date($date as xs:string, $timezone as xs:string) { xs:date( concat($date, $timezone) ) }; \n" + " \tadjust-date-to-timezone(local:date(\"1972-12-14\", \"-12:00\")) gt adjust-date-to-timezone(xs:date(\"1972-12-15+12:00\"))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateGreaterThan016() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:date($date as xs:string, $timezone as xs:string) { xs:date( concat($date, $timezone) ) }; \n" + " \tadjust-date-to-timezone(local:date(\"1972-12-14\", \"-12:00\")) ge adjust-date-to-timezone(xs:date(\"1972-12-15+12:00\"))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that comparing large dates does not overflow. . */ @org.junit.Test public void cbclDateGt001() { final XQuery query = new XQuery( "xs:date(\"25252734927766555-07-28\") > xs:date(\"-25252734927766555-06-07+02:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FODT0001") || assertBoolean(true) ) ); } /** * Test that comparing large dates does not overflow. . */ @org.junit.Test public void cbclDateLe001() { final XQuery query = new XQuery( "xs:date(\"-25252734927766555-06-07+02:00\") <= xs:date(\"25252734927766555-07-28\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FODT0001") || assertBoolean(true) ) ); } /** * * ******************************************************* * Test: op-date-greater-than-1 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-greater-than" function * As per example 1 (for this function)of the F&O specs * ******************************************************* * . */ @org.junit.Test public void opDateGreaterThan1() { final XQuery query = new XQuery( "(xs:date(\"2004-12-25Z\") gt xs:date(\"2004-12-25+07:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-greater-than-10 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-greater-than" function used * together with "or" expression (ge operator). * ******************************************************* * . */ @org.junit.Test public void opDateGreaterThan10() { final XQuery query = new XQuery( "(xs:date(\"1976-10-25Z\") ge xs:date(\"1976-10-28Z\")) or (xs:date(\"1980-08-11Z\") ge xs:date(\"1980-08-10Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-greater-than-11 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-greater-than" function used * together with "fn:true"/or expression (gt operator). * ******************************************************* * . */ @org.junit.Test public void opDateGreaterThan11() { final XQuery query = new XQuery( "(xs:date(\"1980-05-18Z\") gt xs:date(\"1980-05-17Z\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-greater-than-12 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-greater-than" function used * together with "fn:true"/or expression (ge operator). * ******************************************************* * . */ @org.junit.Test public void opDateGreaterThan12() { final XQuery query = new XQuery( "(xs:date(\"2000-10-25Z\") ge xs:date(\"2000-10-26Z\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-greater-than-13 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-greater-than" function used * together with "fn:false"/or expression (gt operator). * ******************************************************* * . */ @org.junit.Test public void opDateGreaterThan13() { final XQuery query = new XQuery( "(xs:date(\"1980-01-01Z\") gt xs:date(\"1980-10-01Z\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-greater-than-14 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-greater-than" function used * together with "fn:false"/or expression (ge operator). * ******************************************************* * . */ @org.junit.Test public void opDateGreaterThan14() { final XQuery query = new XQuery( "(xs:date(\"1980-10-25Z\") ge xs:date(\"1980-10-26Z\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-greater-than-2 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-greater-than" function * As per example 2 (for this function) of the F&O specs * ******************************************************* * . */ @org.junit.Test public void opDateGreaterThan2() { final XQuery query = new XQuery( "(xs:date(\"2004-12-25-12:00\") gt xs:date(\"2004-12-26+12:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-greater-than-3 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-greater-than" function that * return true and used together with fn:not (gt operator) * ******************************************************* * . */ @org.junit.Test public void opDateGreaterThan3() { final XQuery query = new XQuery( "fn:not((xs:date(\"2005-12-26Z\") gt xs:date(\"2005-12-25Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-less-than-4 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-less-than" function that * return true and used together with fn:not (ge operator) * ******************************************************* * . */ @org.junit.Test public void opDateGreaterThan4() { final XQuery query = new XQuery( "fn:not(xs:date(\"2005-04-02Z\") ge xs:date(\"2005-04-02Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-greater-than-5 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-greater-than" function that * return false and used together with fn:not (gt operator) * ******************************************************* * . */ @org.junit.Test public void opDateGreaterThan5() { final XQuery query = new XQuery( "fn:not(xs:date(\"2000-11-09Z\") gt xs:date(\"2000-11-10Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-greater-than-6 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-greater-than" function that * return false and used together with fn:not(ge operator) * ******************************************************* * . */ @org.junit.Test public void opDateGreaterThan6() { final XQuery query = new XQuery( "fn:not(xs:date(\"2005-10-23Z\") ge xs:date(\"2005-10-25Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-greater-than-7 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-greater-than" function used * together with "and" expression (gt operator). * ******************************************************* * . */ @org.junit.Test public void opDateGreaterThan7() { final XQuery query = new XQuery( "(xs:date(\"2000-01-01Z\") gt xs:date(\"2000-01-01Z\")) and (xs:date(\"2001-02-02Z\") gt xs:date(\"2001-03-02Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-greater-than-8 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-greater-than" function used * together with "and" expression (ge operator). * ******************************************************* * . */ @org.junit.Test public void opDateGreaterThan8() { final XQuery query = new XQuery( "(xs:date(\"2000-01-25Z\") ge xs:date(\"2000-10-26Z\")) and (xs:date(\"1975-10-26Z\") ge xs:date(\"1975-10-28Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-greater-than-9 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-greater-than" function used * together with "or" expression (gt operator). * ******************************************************* * . */ @org.junit.Test public void opDateGreaterThan9() { final XQuery query = new XQuery( "(xs:date(\"2000-10-26Z\") gt xs:date(\"2000-10-28Z\")) or (xs:date(\"1976-10-28Z\") gt xs:date(\"1976-10-28Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-greater-than2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-greater-than" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:date(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateGreaterThan2args1() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") gt xs:date(\"1970-01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-greater-than2args-10 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-greater-than" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:date(upper bound) * ******************************************************* * . */ @org.junit.Test public void opDateGreaterThan2args10() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") le xs:date(\"2030-12-31Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-greater-than2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-greater-than" operator * with the arguments set as follows: * $arg1 = xs:date(mid range) * $arg2 = xs:date(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateGreaterThan2args2() { final XQuery query = new XQuery( "xs:date(\"1983-11-17Z\") gt xs:date(\"1970-01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-greater-than2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-greater-than" operator * with the arguments set as follows: * $arg1 = xs:date(upper bound) * $arg2 = xs:date(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateGreaterThan2args3() { final XQuery query = new XQuery( "xs:date(\"2030-12-31Z\") gt xs:date(\"1970-01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-greater-than2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-greater-than" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:date(mid range) * ******************************************************* * . */ @org.junit.Test public void opDateGreaterThan2args4() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") gt xs:date(\"1983-11-17Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-greater-than2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-greater-than" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:date(upper bound) * ******************************************************* * . */ @org.junit.Test public void opDateGreaterThan2args5() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") gt xs:date(\"2030-12-31Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-greater-than2args-6 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-greater-than" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:date(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateGreaterThan2args6() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") le xs:date(\"1970-01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-greater-than2args-7 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-greater-than" operator * with the arguments set as follows: * $arg1 = xs:date(mid range) * $arg2 = xs:date(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateGreaterThan2args7() { final XQuery query = new XQuery( "xs:date(\"1983-11-17Z\") le xs:date(\"1970-01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-greater-than2args-8 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-greater-than" operator * with the arguments set as follows: * $arg1 = xs:date(upper bound) * $arg2 = xs:date(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateGreaterThan2args8() { final XQuery query = new XQuery( "xs:date(\"2030-12-31Z\") le xs:date(\"1970-01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-greater-than2args-9 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-greater-than" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:date(mid range) * ******************************************************* * . */ @org.junit.Test public void opDateGreaterThan2args9() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") le xs:date(\"1983-11-17Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpDateLessThan.java000066400000000000000000001075431222453003200276120ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the date-less-than() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpDateLessThan extends QT3TestSet { /** * * ******************************************************* * Test: K-DateLT-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'lt' for xs:date. * ******************************************************* * . */ @org.junit.Test public void kDateLT1() { final XQuery query = new XQuery( "xs:date(\"2004-07-12\") lt xs:date(\"2004-07-13\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateLT-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'lt' for xs:date. * ******************************************************* * . */ @org.junit.Test public void kDateLT2() { final XQuery query = new XQuery( "not(xs:date(\"2004-07-13\") lt xs:date(\"2004-07-12\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateLT-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'lt' for xs:date. * ******************************************************* * . */ @org.junit.Test public void kDateLT3() { final XQuery query = new XQuery( "not(xs:date(\"2004-07-13\") lt xs:date(\"2004-07-13\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateLT-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'le' for xs:date. * ******************************************************* * . */ @org.junit.Test public void kDateLT4() { final XQuery query = new XQuery( "xs:date(\"2004-07-12\") le xs:date(\"2004-07-12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateLT-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'le' for xs:date. * ******************************************************* * . */ @org.junit.Test public void kDateLT5() { final XQuery query = new XQuery( "xs:date(\"2004-07-12\") le xs:date(\"2004-07-12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateLT-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'le' for xs:date. * ******************************************************* * . */ @org.junit.Test public void kDateLT6() { final XQuery query = new XQuery( "not(xs:date(\"2004-07-13\") le xs:date(\"2004-07-12\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that comparing large dates does not overflow. . */ @org.junit.Test public void cbclDateGe001() { final XQuery query = new XQuery( "xs:date(\"25252734927766555-07-28\") >= xs:date(\"-25252734927766555-06-07+02:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FODT0001") || assertBoolean(true) ) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateLessThan001() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:two-digit($number as xs:integer) { \n" + " \t\tlet $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string \n" + " \t}; \n" + " \tdeclare function local:date($year as xs:integer, $month as xs:integer, $day as xs:integer) { \n" + " \t\tlet $m := local:two-digit($month), $d := local:two-digit($day) return xs:date(concat($year, '-', $m, '-', $d)) \n" + " \t}; \n" + " \tnot(local:date(2008, 05, 12) lt xs:date(\"1972-12-15\"))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateLessThan002() { final XQuery query = new XQuery( "xs:date(\"2008-01-30\") lt xs:date(\"2008-01-31+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateLessThan003() { final XQuery query = new XQuery( "xs:date(\"2008-01-31+09:00\") lt xs:date(\"2008-01-30\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateLessThan004() { final XQuery query = new XQuery( "xs:date(\"2008-01-31\") lt xs:date(\"2008-01-31+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateLessThan005() { final XQuery query = new XQuery( "xs:date(\"2008-01-31+09:00\") lt xs:date(\"2008-01-31\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateLessThan006() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string }; \n" + " \tdeclare function local:date($year as xs:integer, $month as xs:integer, $day as xs:integer) { let $m := local:two-digit($month), $d := local:two-digit($day) return xs:date(concat($year, '-', $m, '-', $d)) }; \n" + " \tnot(local:date(2008, 05, 12) le xs:date(\"1972-12-15\"))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateLessThan007() { final XQuery query = new XQuery( "xs:date(\"2008-01-30\") le xs:date(\"2008-01-31+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateLessThan008() { final XQuery query = new XQuery( "xs:date(\"2008-01-31+09:00\") le xs:date(\"2008-01-30\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateLessThan009() { final XQuery query = new XQuery( "xs:date(\"2008-01-31\") le xs:date(\"2008-01-31+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateLessThan010() { final XQuery query = new XQuery( "xs:date(\"2008-01-31+09:00\") le xs:date(\"2008-01-31\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateLessThan011() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:date($date as xs:date, $null as xs:boolean) { if ($null) then () else $date }; \n" + " \texists(local:date(xs:date(\"1972-12-15\"), fn:true()) lt xs:date(\"1972-12-15\"))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateLessThan012() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:date($date as xs:date, $null as xs:boolean) { if ($null) then () else $date }; \n" + " \tlocal:date(xs:date(\"1972-12-15\"), fn:false()) lt xs:date(\"1972-12-15\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateLessThan013() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:date($date as xs:date, $null as xs:boolean) { if ($null) then () else $date }; \n" + " \texists(local:date(xs:date(\"1972-12-15\"), fn:true()) ge xs:date(\"1972-12-15\"))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateLessThan014() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:date($date as xs:date, $null as xs:boolean) { if ($null) then () else $date }; \n" + " \tlocal:date(xs:date(\"1972-12-15\"), fn:false()) ge xs:date(\"1972-12-15\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateLessThan015() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:date($date as xs:string, $timezone as xs:string) { xs:date( concat($date, $timezone) ) }; \n" + " \tadjust-date-to-timezone(local:date(\"1972-12-14\", \"-12:00\")) lt adjust-date-to-timezone(xs:date(\"1972-12-15+12:00\"))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of date . */ @org.junit.Test public void cbclDateLessThan016() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:date($date as xs:string, $timezone as xs:string) { xs:date( concat($date, $timezone) ) }; \n" + " \tadjust-date-to-timezone(local:date(\"1972-12-14\", \"-12:00\")) le adjust-date-to-timezone(xs:date(\"1972-12-15+12:00\"))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that comparing large dates does not overflow. . */ @org.junit.Test public void cbclDateLt001() { final XQuery query = new XQuery( "xs:date(\"-25252734927766555-06-07+02:00\") < xs:date(\"25252734927766555-07-28\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FODT0001") || assertBoolean(true) ) ); } /** * * ******************************************************* * Test: op-date-less-than-1 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-less-than" function * As per example 1 (for this function)of the F&O specs * ******************************************************* * . */ @org.junit.Test public void opDateLessThan1() { final XQuery query = new XQuery( "(xs:date(\"2004-12-25Z\") lt xs:date(\"2004-12-25-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-less-than-10 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-less-than" function used * together with "or" expression (le operator). * ******************************************************* * . */ @org.junit.Test public void opDateLessThan10() { final XQuery query = new XQuery( "(xs:date(\"1976-10-25Z\") le xs:date(\"1976-10-28Z\")) or (xs:date(\"1980-08-11Z\") le xs:date(\"1980-08-10Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-less-than-11 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-less-than" function used * together with "fn:true"/or expression (lt operator). * ******************************************************* * . */ @org.junit.Test public void opDateLessThan11() { final XQuery query = new XQuery( "(xs:date(\"1980-05-18Z\") lt xs:date(\"1980-05-17Z\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-less-than-12 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-less-than" function used * together with "fn:true"/or expression (le operator). * ******************************************************* * . */ @org.junit.Test public void opDateLessThan12() { final XQuery query = new XQuery( "(xs:date(\"2000-10-25Z\") le xs:date(\"2000-10-26Z\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-less-than-13 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-less-than" function used * together with "fn:false"/or expression (lt operator). * ******************************************************* * . */ @org.junit.Test public void opDateLessThan13() { final XQuery query = new XQuery( "(xs:date(\"1980-01-01Z\") lt xs:date(\"1980-10-01Z\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-less-than-14 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-less-than" function used * together with "fn:false"/or expression (le operator). * ******************************************************* * . */ @org.junit.Test public void opDateLessThan14() { final XQuery query = new XQuery( "(xs:date(\"1980-10-25Z\") le xs:date(\"1980-10-26Z\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-less-than-2 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-less-than" function * As per example 2 (for this function) of the F&O specs * ******************************************************* * . */ @org.junit.Test public void opDateLessThan2() { final XQuery query = new XQuery( "(xs:date(\"2004-12-25-12:00\") le xs:date(\"2004-12-26+12:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-less-than-3 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-less-than" function that * return true and used together with fn:not (lt operator) * ******************************************************* * . */ @org.junit.Test public void opDateLessThan3() { final XQuery query = new XQuery( "fn:not((xs:date(\"2005-12-25Z\") lt xs:date(\"2005-12-26Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-less-than-4 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-less-than" function that * return true and used together with fn:not (le operator) * ******************************************************* * . */ @org.junit.Test public void opDateLessThan4() { final XQuery query = new XQuery( "fn:not(xs:date(\"2005-04-02Z\") le xs:date(\"2005-04-02Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-less-than-5 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-less-than" function that * return false and used together with fn:not (lt operator) * ******************************************************* * . */ @org.junit.Test public void opDateLessThan5() { final XQuery query = new XQuery( "fn:not(xs:date(\"2000-12-25Z\") lt xs:date(\"2000-11-25Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-less-than-6 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-less-than" function that * return false and used together with fn:not(le operator) * ******************************************************* * . */ @org.junit.Test public void opDateLessThan6() { final XQuery query = new XQuery( "fn:not(xs:date(\"2005-10-25Z\") le xs:date(\"2005-10-23Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-less-than-7 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-less-than" function used * together with "and" expression (lt operator). * ******************************************************* * . */ @org.junit.Test public void opDateLessThan7() { final XQuery query = new XQuery( "(xs:date(\"2000-01-01Z\") lt xs:date(\"2000-01-01Z\")) and (xs:date(\"2001-02-02Z\") lt xs:date(\"2001-03-02Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-less-than-8 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-less-than" function used * together with "and" expression (le operator). * ******************************************************* * . */ @org.junit.Test public void opDateLessThan8() { final XQuery query = new XQuery( "(xs:date(\"2000-01-25Z\") le xs:date(\"2000-10-26Z\")) and (xs:date(\"1975-10-26Z\") le xs:date(\"1975-10-28Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-less-than-9 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "date-less-than" function used * together with "or" expression (lt operator). * ******************************************************* * . */ @org.junit.Test public void opDateLessThan9() { final XQuery query = new XQuery( "(xs:date(\"2000-10-26Z\") lt xs:date(\"2000-10-28Z\")) or (xs:date(\"1976-10-28Z\") lt xs:date(\"1976-10-28Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-less-than2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-less-than" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:date(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateLessThan2args1() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") lt xs:date(\"1970-01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-less-than2args-10 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-less-than" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:date(upper bound) * ******************************************************* * . */ @org.junit.Test public void opDateLessThan2args10() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") ge xs:date(\"2030-12-31Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-less-than2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-less-than" operator * with the arguments set as follows: * $arg1 = xs:date(mid range) * $arg2 = xs:date(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateLessThan2args2() { final XQuery query = new XQuery( "xs:date(\"1983-11-17Z\") lt xs:date(\"1970-01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-less-than2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-less-than" operator * with the arguments set as follows: * $arg1 = xs:date(upper bound) * $arg2 = xs:date(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateLessThan2args3() { final XQuery query = new XQuery( "xs:date(\"2030-12-31Z\") lt xs:date(\"1970-01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-date-less-than2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-less-than" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:date(mid range) * ******************************************************* * . */ @org.junit.Test public void opDateLessThan2args4() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") lt xs:date(\"1983-11-17Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-less-than2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-less-than" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:date(upper bound) * ******************************************************* * . */ @org.junit.Test public void opDateLessThan2args5() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") lt xs:date(\"2030-12-31Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-less-than2args-6 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-less-than" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:date(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateLessThan2args6() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") ge xs:date(\"1970-01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-less-than2args-7 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-less-than" operator * with the arguments set as follows: * $arg1 = xs:date(mid range) * $arg2 = xs:date(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateLessThan2args7() { final XQuery query = new XQuery( "xs:date(\"1983-11-17Z\") ge xs:date(\"1970-01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-less-than2args-8 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-less-than" operator * with the arguments set as follows: * $arg1 = xs:date(upper bound) * $arg2 = xs:date(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateLessThan2args8() { final XQuery query = new XQuery( "xs:date(\"2030-12-31Z\") ge xs:date(\"1970-01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-date-less-than2args-9 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:date-less-than" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:date(mid range) * ******************************************************* * . */ @org.junit.Test public void opDateLessThan2args9() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") ge xs:date(\"1983-11-17Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpDateTimeEqual.java000066400000000000000000001565261222453003200277640ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the dateTime-equal() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpDateTimeEqual extends QT3TestSet { /** * * ******************************************************* * Test: K-DateTimeEQ-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'eq' for xs:dateTime, returning positive. * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ1() { final XQuery query = new XQuery( "xs:dateTime(\"2004-08-12T23:01:04.12\") eq xs:dateTime(\"2004-08-12T23:01:04.12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateTimeEQ-10 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'ne' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ10() { final XQuery query = new XQuery( "xs:dateTime(\"1999-12-04T12:12:23\") ne xs:date(\"1999-12-04\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DateTimeEQ-11 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'le' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ11() { final XQuery query = new XQuery( "xs:dateTime(\"1999-12-04T12:12:23\") le xs:date(\"1999-12-04\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DateTimeEQ-12 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'lt' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ12() { final XQuery query = new XQuery( "xs:dateTime(\"1999-12-04T12:12:23\") lt xs:date(\"1999-12-04\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DateTimeEQ-13 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'ge' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ13() { final XQuery query = new XQuery( "xs:dateTime(\"1999-12-04T12:12:23\") ge xs:date(\"1999-12-04\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DateTimeEQ-14 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'gt' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ14() { final XQuery query = new XQuery( "xs:dateTime(\"1999-12-04T12:12:23\") gt xs:date(\"1999-12-04\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DateTimeEQ-15 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'eq' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ15() { final XQuery query = new XQuery( "xs:date(\"1999-12-04\") eq xs:dateTime(\"1999-12-04T12:12:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DateTimeEQ-16 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'ne' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ16() { final XQuery query = new XQuery( "xs:date(\"1999-12-04\") ne xs:dateTime(\"1999-12-04T12:12:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DateTimeEQ-17 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'le' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ17() { final XQuery query = new XQuery( "xs:date(\"1999-12-04\") le xs:dateTime(\"1999-12-04T12:12:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DateTimeEQ-18 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'lt' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ18() { final XQuery query = new XQuery( "xs:date(\"1999-12-04\") lt xs:dateTime(\"1999-12-04T12:12:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DateTimeEQ-19 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'ge' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ19() { final XQuery query = new XQuery( "xs:date(\"1999-12-04\") ge xs:dateTime(\"1999-12-04T12:12:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DateTimeEQ-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'eq' for xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ2() { final XQuery query = new XQuery( "not(xs:dateTime(\"2004-08-12T23:01:04.12\") eq xs:dateTime(\"2004-08-12T23:01:04.13\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateTimeEQ-20 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'gt' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ20() { final XQuery query = new XQuery( "xs:date(\"1999-12-04\") gt xs:dateTime(\"1999-12-04T12:12:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DateTimeEQ-21 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'eq' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ21() { final XQuery query = new XQuery( "xs:dateTime(\"1999-12-04T12:12:23\") eq xs:time(\"22:12:04\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DateTimeEQ-22 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'ne' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ22() { final XQuery query = new XQuery( "xs:dateTime(\"1999-12-04T12:12:23\") ne xs:time(\"22:12:04\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DateTimeEQ-23 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'le' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ23() { final XQuery query = new XQuery( "xs:dateTime(\"1999-12-04T12:12:23\") le xs:time(\"22:12:04\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DateTimeEQ-24 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'lt' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ24() { final XQuery query = new XQuery( "xs:dateTime(\"1999-12-04T12:12:23\") lt xs:time(\"22:12:04\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DateTimeEQ-25 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'ge' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ25() { final XQuery query = new XQuery( "xs:dateTime(\"1999-12-04T12:12:23\") ge xs:time(\"22:12:04\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DateTimeEQ-26 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'gt' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ26() { final XQuery query = new XQuery( "xs:dateTime(\"1999-12-04T12:12:23\") gt xs:time(\"22:12:04\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DateTimeEQ-27 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'eq' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ27() { final XQuery query = new XQuery( "xs:time(\"22:12:04\") eq xs:dateTime(\"1999-12-04T12:12:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DateTimeEQ-28 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'ne' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ28() { final XQuery query = new XQuery( "xs:time(\"22:12:04\") ne xs:dateTime(\"1999-12-04T12:12:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DateTimeEQ-29 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'le' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ29() { final XQuery query = new XQuery( "xs:time(\"22:12:04\") le xs:dateTime(\"1999-12-04T12:12:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DateTimeEQ-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ne' for xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ3() { final XQuery query = new XQuery( "xs:dateTime(\"2004-08-12T23:01:05.12\") ne xs:dateTime(\"2004-08-12T23:01:04.12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateTimeEQ-30 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'lt' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ30() { final XQuery query = new XQuery( "xs:time(\"22:12:04\") lt xs:dateTime(\"1999-12-04T12:12:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DateTimeEQ-31 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'ge' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ31() { final XQuery query = new XQuery( "xs:time(\"22:12:04\") ge xs:dateTime(\"1999-12-04T12:12:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DateTimeEQ-32 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'gt' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ32() { final XQuery query = new XQuery( "xs:time(\"22:12:04\") gt xs:dateTime(\"1999-12-04T12:12:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DateTimeEQ-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ne' for xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ4() { final XQuery query = new XQuery( "not(xs:dateTime(\"2004-07-12T23:01:04.12\") ne xs:dateTime(\"2004-07-12T23:01:04.12\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateTimeEQ-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset -00:00 is equal to Z, in xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ5() { final XQuery query = new XQuery( "xs:dateTime(\"1999-12-04T16:00:12.345-00:00\") eq xs:dateTime(\"1999-12-04T16:00:12.345Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateTimeEQ-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset +00:00 is equal to Z, in xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ6() { final XQuery query = new XQuery( "xs:dateTime(\"1999-12-04T16:00:12.345+00:00\") eq xs:dateTime(\"1999-12-04T16:00:12.345Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateTimeEQ-7 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset Z is equal to Z, in xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ7() { final XQuery query = new XQuery( "xs:dateTime(\"1999-12-04T16:00:12.345Z\") eq xs:dateTime(\"1999-12-04T16:00:12.345Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateTimeEQ-8 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset -00:00 is equal to +00:00, in xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ8() { final XQuery query = new XQuery( "xs:dateTime(\"1999-12-04T16:00:12.345-00:00\") eq xs:dateTime(\"1999-12-04T16:00:12.345+00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateTimeEQ-9 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'eq' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kDateTimeEQ9() { final XQuery query = new XQuery( "xs:dateTime(\"1999-12-04T12:12:23\") eq xs:date(\"1999-12-04\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K2-DateTimeEQ-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Basic negative equalness test for xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void k2DateTimeEQ1() { final XQuery query = new XQuery( "xs:dateTime(\"2002-03-06T00:00:00Z\") ne xs:dateTime(\"2002-03-05T00:00:00+03:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeEqual001() { final XQuery query = new XQuery( "declare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string }; declare function local:dateTime($year as xs:integer, $month as xs:integer, $day as xs:integer) { let $m := local:two-digit($month), $d := local:two-digit($day) return xs:dateTime(concat($year, '-', $m, '-', $d, \"T12:00:00\")) }; not(local:dateTime(2008, 05, 12) eq xs:dateTime(\"1972-12-15T12:00:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeEqual002() { final XQuery query = new XQuery( "xs:dateTime(\"2008-01-30T00:01:00\") eq xs:dateTime(\"2008-01-31T01:00:00+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeEqual003() { final XQuery query = new XQuery( "xs:dateTime(\"2008-01-31T00:01:00+09:00\") eq xs:dateTime(\"2008-01-30T00:01:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeEqual004() { final XQuery query = new XQuery( "xs:dateTime(\"2008-01-31T00:01:00\") eq xs:dateTime(\"2008-01-31T00:01:00+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeEqual005() { final XQuery query = new XQuery( "xs:dateTime(\"2008-01-31T00:01:00+09:00\") eq xs:dateTime(\"2008-01-31T00:01:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeEqual006() { final XQuery query = new XQuery( "declare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string }; declare function local:dateTime($year as xs:integer, $month as xs:integer, $day as xs:integer) { let $m := local:two-digit($month), $d := local:two-digit($day) return xs:dateTime(concat($year, '-', $m, '-', $d, \"T12:00:00\")) }; not(local:dateTime(2008, 05, 12) ne xs:dateTime(\"1972-12-15T12:00:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeEqual007() { final XQuery query = new XQuery( "xs:dateTime(\"2008-01-30T00:01:00\") ne xs:dateTime(\"2008-01-31T00:01:00+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeEqual008() { final XQuery query = new XQuery( "xs:dateTime(\"2008-01-31T00:01:00+09:00\") ne xs:dateTime(\"2008-01-30T00:01:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeEqual009() { final XQuery query = new XQuery( "xs:dateTime(\"2008-01-31T00:01:00\") ne xs:dateTime(\"2008-01-31T00:01:00+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeEqual010() { final XQuery query = new XQuery( "xs:dateTime(\"2008-01-31T00:01:00+09:00\") ne xs:dateTime(\"2008-01-31T00:01:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeEqual011() { final XQuery query = new XQuery( "declare function local:dateTime($dateTime as xs:dateTime, $null as xs:boolean) { if ($null) then () else $dateTime }; exists(local:dateTime(xs:dateTime(\"1972-12-15T12:00:00\"), fn:true()) eq xs:dateTime(\"1972-12-15T12:00:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeEqual012() { final XQuery query = new XQuery( "declare function local:dateTime($dateTime as xs:dateTime, $null as xs:boolean) { if ($null) then () else $dateTime }; local:dateTime(xs:dateTime(\"1972-12-15T12:00:00\"), fn:false()) eq xs:dateTime(\"1972-12-15T12:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeEqual013() { final XQuery query = new XQuery( "declare function local:dateTime($dateTime as xs:dateTime, $null as xs:boolean) { if ($null) then () else $dateTime }; exists(local:dateTime(xs:dateTime(\"1972-12-15T12:00:00\"), fn:true()) ne xs:dateTime(\"1972-12-15T12:00:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeEqual014() { final XQuery query = new XQuery( "declare function local:dateTime($dateTime as xs:dateTime, $null as xs:boolean) { if ($null) then () else $dateTime }; local:dateTime(xs:dateTime(\"1972-12-15T12:00:00\"), fn:false()) ne xs:dateTime(\"1972-12-15T12:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeEqual015() { final XQuery query = new XQuery( "declare function local:dateTime($dateTime as xs:string, $timezone as xs:string) { xs:dateTime( concat($dateTime, $timezone) ) }; adjust-dateTime-to-timezone(local:dateTime(\"1972-12-14T00:00:00\", \"-12:00\")) eq adjust-dateTime-to-timezone(xs:dateTime(\"1972-12-15T00:00:00+12:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeEqual016() { final XQuery query = new XQuery( "declare function local:dateTime($dateTime as xs:string, $timezone as xs:string) { xs:dateTime( concat($dateTime, $timezone) ) }; adjust-dateTime-to-timezone(local:dateTime(\"1972-12-14T00:00:00\", \"-12:00\")) ne adjust-dateTime-to-timezone(xs:dateTime(\"1972-12-15T00:00:00+12:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeEqual017() { final XQuery query = new XQuery( "xs:dateTime(\"1972-12-15T00:00:00+12:00\") eq xs:dateTime(\"1972-12-15T00:00:01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeEqual018() { final XQuery query = new XQuery( "xs:dateTime(\"1972-12-15T00:00:00+12:00\") ne xs:dateTime(\"1972-12-15T00:00:01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-equal2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-equal" operator * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dateTime(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeEqual2args1() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") eq xs:dateTime(\"1970-01-01T00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-equal2args-10 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-equal" operator * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dateTime(upper bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeEqual2args10() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") ne xs:dateTime(\"2030-12-31T23:59:59Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-equal2args-11 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:dateTime-equal" operator (le) * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dateTime(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeEqual2args11() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") le xs:dateTime(\"1970-01-01T00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-equal2args-12 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:dateTime-equal" operator (le) * with the arguments set as follows: * $arg1 = xs:dateTime(mid range) * $arg2 = xs:dateTime(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeEqual2args12() { final XQuery query = new XQuery( "xs:dateTime(\"1996-04-07T01:40:52Z\") le xs:dateTime(\"1970-01-01T00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-equal2args-13 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:dateTime-equal" operator (le) * with the arguments set as follows: * $arg1 = xs:dateTime(upper bound) * $arg2 = xs:dateTime(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeEqual2args13() { final XQuery query = new XQuery( "xs:dateTime(\"2030-12-31T23:59:59Z\") le xs:dateTime(\"1970-01-01T00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-equal2args-14 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:dateTime-equal" operator (le) * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dateTime(mid range) * ******************************************************* * . */ @org.junit.Test public void opDateTimeEqual2args14() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") le xs:dateTime(\"1996-04-07T01:40:52Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-equal2args-15 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:dateTime-equal" operator (le) * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dateTime(upper bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeEqual2args15() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") le xs:dateTime(\"2030-12-31T23:59:59Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-equal2args-16 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:dateTime-equal" operator (ge) * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dateTime(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeEqual2args16() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") ge xs:dateTime(\"1970-01-01T00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-equal2args-17 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:dateTime-equal" operator (ge) * with the arguments set as follows: * $arg1 = xs:dateTime(mid range) * $arg2 = xs:dateTime(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeEqual2args17() { final XQuery query = new XQuery( "xs:dateTime(\"1996-04-07T01:40:52Z\") ge xs:dateTime(\"1970-01-01T00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-equal2args-18 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:dateTime-equal" operator (ge) * with the arguments set as follows: * $arg1 = xs:dateTime(upper bound) * $arg2 = xs:dateTime(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeEqual2args18() { final XQuery query = new XQuery( "xs:dateTime(\"2030-12-31T23:59:59Z\") ge xs:dateTime(\"1970-01-01T00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-equal2args-19 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:dateTime-equal" operator (ge) * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dateTime(mid range) * ******************************************************* * . */ @org.junit.Test public void opDateTimeEqual2args19() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") ge xs:dateTime(\"1996-04-07T01:40:52Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-equal2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-equal" operator * with the arguments set as follows: * $arg1 = xs:dateTime(mid range) * $arg2 = xs:dateTime(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeEqual2args2() { final XQuery query = new XQuery( "xs:dateTime(\"1996-04-07T01:40:52Z\") eq xs:dateTime(\"1970-01-01T00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-equal2args-20 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:dateTime-equal" operator (ge) * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dateTime(upper bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeEqual2args20() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") ge xs:dateTime(\"2030-12-31T23:59:59Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-equal2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-equal" operator * with the arguments set as follows: * $arg1 = xs:dateTime(upper bound) * $arg2 = xs:dateTime(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeEqual2args3() { final XQuery query = new XQuery( "xs:dateTime(\"2030-12-31T23:59:59Z\") eq xs:dateTime(\"1970-01-01T00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-equal2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-equal" operator * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dateTime(mid range) * ******************************************************* * . */ @org.junit.Test public void opDateTimeEqual2args4() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") eq xs:dateTime(\"1996-04-07T01:40:52Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-equal2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-equal" operator * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dateTime(upper bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeEqual2args5() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") eq xs:dateTime(\"2030-12-31T23:59:59Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-equal2args-6 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-equal" operator * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dateTime(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeEqual2args6() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") ne xs:dateTime(\"1970-01-01T00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-equal2args-7 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-equal" operator * with the arguments set as follows: * $arg1 = xs:dateTime(mid range) * $arg2 = xs:dateTime(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeEqual2args7() { final XQuery query = new XQuery( "xs:dateTime(\"1996-04-07T01:40:52Z\") ne xs:dateTime(\"1970-01-01T00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-equal2args-8 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-equal" operator * with the arguments set as follows: * $arg1 = xs:dateTime(upper bound) * $arg2 = xs:dateTime(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeEqual2args8() { final XQuery query = new XQuery( "xs:dateTime(\"2030-12-31T23:59:59Z\") ne xs:dateTime(\"1970-01-01T00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-equal2args-9 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-equal" operator * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dateTime(mid range) * ******************************************************* * . */ @org.junit.Test public void opDateTimeEqual2args9() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") ne xs:dateTime(\"1996-04-07T01:40:52Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpDateTimeGreaterThan.java000066400000000000000000001047061222453003200311120ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the dateTime-greater-than() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpDateTimeGreaterThan extends QT3TestSet { /** * * ******************************************************* * Test: K-DateTimeGT-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'gt' for xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void kDateTimeGT1() { final XQuery query = new XQuery( "xs:dateTime(\"2004-07-13T23:01:04.12\") gt xs:dateTime(\"2004-07-12T23:01:04.12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateTimeGT-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'gt' for xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void kDateTimeGT2() { final XQuery query = new XQuery( "not(xs:dateTime(\"2004-07-12T23:01:04.12\") gt xs:dateTime(\"2004-07-12T23:01:04.12\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateTimeGT-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'gt' for xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void kDateTimeGT3() { final XQuery query = new XQuery( "not(xs:dateTime(\"2004-07-12T23:01:04.12\") gt xs:dateTime(\"2004-07-13T23:01:04.12\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateTimeGT-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ge' for xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void kDateTimeGT4() { final XQuery query = new XQuery( "xs:dateTime(\"2004-07-12T23:01:04.12\") ge xs:dateTime(\"2004-07-12T23:01:04.12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateTimeGT-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ge' for xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void kDateTimeGT5() { final XQuery query = new XQuery( "xs:dateTime(\"2004-07-13T23:01:04.12\") ge xs:dateTime(\"2004-07-12T23:01:04.12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateTimeGT-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ge' for xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void kDateTimeGT6() { final XQuery query = new XQuery( "not(xs:dateTime(\"2004-07-11T23:01:04.12\") ge xs:dateTime(\"2004-07-12T23:01:04.12\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeGreaterThan001() { final XQuery query = new XQuery( "declare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string }; declare function local:dateTime($year as xs:integer, $month as xs:integer, $day as xs:integer) { let $m := local:two-digit($month), $d := local:two-digit($day) return xs:dateTime(concat($year, '-', $m, '-', $d, \"T12:00:00\")) }; not(local:dateTime(2008, 05, 12) gt xs:dateTime(\"1972-12-15T12:00:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeGreaterThan002() { final XQuery query = new XQuery( "xs:dateTime(\"2008-01-30T00:01:00\") gt xs:dateTime(\"2008-01-31T01:00:00+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeGreaterThan003() { final XQuery query = new XQuery( "xs:dateTime(\"2008-01-31T00:01:00+09:00\") gt xs:dateTime(\"2008-01-30T00:01:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeGreaterThan004() { final XQuery query = new XQuery( "xs:dateTime(\"2008-01-31T00:01:00\") gt xs:dateTime(\"2008-01-31T00:01:00+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeGreaterThan005() { final XQuery query = new XQuery( "xs:dateTime(\"2008-01-31T00:01:00+09:00\") gt xs:dateTime(\"2008-01-31T00:01:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeGreaterThan006() { final XQuery query = new XQuery( "declare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string }; declare function local:dateTime($year as xs:integer, $month as xs:integer, $day as xs:integer) { let $m := local:two-digit($month), $d := local:two-digit($day) return xs:dateTime(concat($year, '-', $m, '-', $d, \"T12:00:00\")) }; not(local:dateTime(2008, 05, 12) ge xs:dateTime(\"1972-12-15T12:00:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeGreaterThan007() { final XQuery query = new XQuery( "xs:dateTime(\"2008-01-30T00:01:00\") ge xs:dateTime(\"2008-01-31T00:01:00+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeGreaterThan008() { final XQuery query = new XQuery( "xs:dateTime(\"2008-01-31T00:01:00+09:00\") ge xs:dateTime(\"2008-01-30T00:01:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeGreaterThan009() { final XQuery query = new XQuery( "xs:dateTime(\"2008-01-31T00:01:00\") ge xs:dateTime(\"2008-01-31T00:01:00+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeGreaterThan010() { final XQuery query = new XQuery( "xs:dateTime(\"2008-01-31T00:01:00+09:00\") ge xs:dateTime(\"2008-01-31T00:01:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeGreaterThan011() { final XQuery query = new XQuery( "declare function local:dateTime($dateTime as xs:dateTime, $null as xs:boolean) { if ($null) then () else $dateTime }; exists(local:dateTime(xs:dateTime(\"1972-12-15T12:00:00\"), fn:true()) gt xs:dateTime(\"1972-12-15T12:00:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeGreaterThan012() { final XQuery query = new XQuery( "declare function local:dateTime($dateTime as xs:dateTime, $null as xs:boolean) { if ($null) then () else $dateTime }; local:dateTime(xs:dateTime(\"1972-12-15T12:00:00\"), fn:false()) gt xs:dateTime(\"1972-12-15T12:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeGreaterThan013() { final XQuery query = new XQuery( "declare function local:dateTime($dateTime as xs:dateTime, $null as xs:boolean) { if ($null) then () else $dateTime }; exists(local:dateTime(xs:dateTime(\"1972-12-15T12:00:00\"), fn:true()) le xs:dateTime(\"1972-12-15T12:00:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeGreaterThan014() { final XQuery query = new XQuery( "declare function local:dateTime($dateTime as xs:dateTime, $null as xs:boolean) { if ($null) then () else $dateTime }; local:dateTime(xs:dateTime(\"1972-12-15T12:00:00\"), fn:false()) le xs:dateTime(\"1972-12-15T12:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeGreaterThan015() { final XQuery query = new XQuery( "declare function local:dateTime($dateTime as xs:string, $timezone as xs:string) { xs:dateTime( concat($dateTime, $timezone) ) }; adjust-dateTime-to-timezone(local:dateTime(\"1972-12-14T00:00:00\", \"-12:00\")) gt adjust-dateTime-to-timezone(xs:dateTime(\"1972-12-15T00:00:00+12:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeGreaterThan016() { final XQuery query = new XQuery( "declare function local:dateTime($dateTime as xs:string, $timezone as xs:string) { xs:dateTime( concat($dateTime, $timezone) ) }; adjust-dateTime-to-timezone(local:dateTime(\"1972-12-14T00:00:00\", \"-12:00\")) ge adjust-dateTime-to-timezone(xs:dateTime(\"1972-12-15T00:00:00+12:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-greater-than-10 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dateTime-greater-than" function used * together with "or" expression (ge operator). * ******************************************************* * . */ @org.junit.Test public void opDateTimeGreaterThan10() { final XQuery query = new XQuery( "(xs:dateTime(\"2002-04-03T12:00:10Z\") ge xs:dateTime(\"1990-04-02T12:10:00Z\")) or (xs:dateTime(\"1975-04-03T12:10:00Z\") ge xs:dateTime(\"2000-02-02T12:00:09Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-greater-than-11 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dateTime-greater-than" function used * together with "fn:true"/or expression (gt operator). * ******************************************************* * . */ @org.junit.Test public void opDateTimeGreaterThan11() { final XQuery query = new XQuery( "(xs:dateTime(\"1990-04-02T12:00:10Z\") gt xs:dateTime(\"2006-06-02T12:10:00Z\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-greater-than-12 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dateTime-greater-than" function used * together with "fn:true"/or expression (ge operator). * ******************************************************* * . */ @org.junit.Test public void opDateTimeGreaterThan12() { final XQuery query = new XQuery( "(xs:dateTime(\"1970-04-02T12:00:20Z\") ge xs:dateTime(\"1980-04-02T12:00:20Z\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-greater-than-13 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dateTime-greater-than" function used * together with "fn:false"/or expression (gt operator). * ******************************************************* * . */ @org.junit.Test public void opDateTimeGreaterThan13() { final XQuery query = new XQuery( "(xs:dateTime(\"1981-04-02T12:00:00Z\") gt xs:dateTime(\"2003-04-02T12:10:00Z\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-greater-than-14 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dateTime-greater-than" function used * together with "fn:false"/or expression (ge operator). * ******************************************************* * . */ @org.junit.Test public void opDateTimeGreaterThan14() { final XQuery query = new XQuery( "(xs:dateTime(\"1976-04-03T12:00:00Z\") ge xs:dateTime(\"2002-07-02T12:00:30Z\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-greater-than-3 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dateTime-greater-than" function that * return true and used together with fn:not (gt operator) * ******************************************************* * . */ @org.junit.Test public void opDateTimeGreaterThan3() { final XQuery query = new XQuery( "fn:not((xs:dateTime(\"2004-04-02T12:00:00Z\") gt xs:dateTime(\"2003-04-02T12:00:00Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-greater-than-4 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dateTime-greater-than" function that * return true and used together with fn:not (ge operator) * ******************************************************* * . */ @org.junit.Test public void opDateTimeGreaterThan4() { final XQuery query = new XQuery( "fn:not(xs:dateTime(\"2002-04-02T12:00:00Z\") ge xs:dateTime(\"2002-04-02T12:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-greater-than-5 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dateTime-greater-than" function that * return false and used together with fn:not (gt operator) * ******************************************************* * . */ @org.junit.Test public void opDateTimeGreaterThan5() { final XQuery query = new XQuery( "fn:not(xs:dateTime(\"2002-04-02T12:00:00Z\") gt xs:dateTime(\"2002-05-02T12:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-greater-than-6 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dateTime-greater-than" function that * return false and used together with fn:not(ge operator) * ******************************************************* * . */ @org.junit.Test public void opDateTimeGreaterThan6() { final XQuery query = new XQuery( "fn:not(xs:dateTime(\"2002-04-02T12:00:00Z\") ge xs:dateTime(\"2008-04-02T12:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-greater-than-7 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dateTime-greater-than" function used * together with "and" expression (gt operator). * ******************************************************* * . */ @org.junit.Test public void opDateTimeGreaterThan7() { final XQuery query = new XQuery( "(xs:dateTime(\"2002-04-02T12:00:00Z\") gt xs:dateTime(\"2002-04-02T12:01:00Z\")) and (xs:dateTime(\"2003-04-02T12:00:00Z\") gt xs:dateTime(\"2002-04-02T12:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-greater-than-8 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dateTime-greater-than" function used * together with "and" expression (ge operator). * ******************************************************* * . */ @org.junit.Test public void opDateTimeGreaterThan8() { final XQuery query = new XQuery( "(xs:dateTime(\"2002-04-02T12:00:00Z\") ge xs:dateTime(\"2005-04-02T12:00:20Z\")) and (xs:dateTime(\"2002-04-02T12:10:00Z\") ge xs:dateTime(\"2002-04-03T12:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-greater-than-9 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dateTime-greater-than" function used * together with "or" expression (gt operator). * ******************************************************* * . */ @org.junit.Test public void opDateTimeGreaterThan9() { final XQuery query = new XQuery( "(xs:dateTime(\"2002-06-02T12:00:10Z\") gt xs:dateTime(\"2000-04-04T12:00:00Z\")) or (xs:dateTime(\"2002-04-02T13:00:10Z\") gt xs:dateTime(\"2001-04-02T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-greater-than2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-greater-than" operator * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dateTime(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeGreaterThan2args1() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") gt xs:dateTime(\"1970-01-01T00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-greater-than2args-10 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-greater-than" operator * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dateTime(upper bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeGreaterThan2args10() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") le xs:dateTime(\"2030-12-31T23:59:59Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-greater-than2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-greater-than" operator * with the arguments set as follows: * $arg1 = xs:dateTime(mid range) * $arg2 = xs:dateTime(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeGreaterThan2args2() { final XQuery query = new XQuery( "xs:dateTime(\"1996-04-07T01:40:52Z\") gt xs:dateTime(\"1970-01-01T00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-greater-than2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-greater-than" operator * with the arguments set as follows: * $arg1 = xs:dateTime(upper bound) * $arg2 = xs:dateTime(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeGreaterThan2args3() { final XQuery query = new XQuery( "xs:dateTime(\"2030-12-31T23:59:59Z\") gt xs:dateTime(\"1970-01-01T00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-greater-than2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-greater-than" operator * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dateTime(mid range) * ******************************************************* * . */ @org.junit.Test public void opDateTimeGreaterThan2args4() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") gt xs:dateTime(\"1996-04-07T01:40:52Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-greater-than2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-greater-than" operator * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dateTime(upper bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeGreaterThan2args5() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") gt xs:dateTime(\"2030-12-31T23:59:59Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-greater-than2args-6 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-greater-than" operator * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dateTime(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeGreaterThan2args6() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") le xs:dateTime(\"1970-01-01T00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-greater-than2args-7 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-greater-than" operator * with the arguments set as follows: * $arg1 = xs:dateTime(mid range) * $arg2 = xs:dateTime(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeGreaterThan2args7() { final XQuery query = new XQuery( "xs:dateTime(\"1996-04-07T01:40:52Z\") le xs:dateTime(\"1970-01-01T00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-greater-than2args-8 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-greater-than" operator * with the arguments set as follows: * $arg1 = xs:dateTime(upper bound) * $arg2 = xs:dateTime(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeGreaterThan2args8() { final XQuery query = new XQuery( "xs:dateTime(\"2030-12-31T23:59:59Z\") le xs:dateTime(\"1970-01-01T00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-greater-than2args-9 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-greater-than" operator * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dateTime(mid range) * ******************************************************* * . */ @org.junit.Test public void opDateTimeGreaterThan2args9() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") le xs:dateTime(\"1996-04-07T01:40:52Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpDateTimeLessThan.java000066400000000000000000001044101222453003200304170ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the dateTime-less-than() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpDateTimeLessThan extends QT3TestSet { /** * * ******************************************************* * Test: K-DateTimeLT-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'lt' for xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void kDateTimeLT1() { final XQuery query = new XQuery( "xs:dateTime(\"2004-07-12T23:01:04.12\") lt xs:dateTime(\"2004-07-13T23:01:04.12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateTimeLT-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'lt' for xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void kDateTimeLT2() { final XQuery query = new XQuery( "not(xs:dateTime(\"2004-07-13T23:01:04.12\") lt xs:dateTime(\"2004-07-12T23:01:04.12\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateTimeLT-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'lt' for xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void kDateTimeLT3() { final XQuery query = new XQuery( "not(xs:dateTime(\"2004-07-13T23:01:04.12\") lt xs:dateTime(\"2004-07-13T23:01:04.12\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateTimeLT-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'le' for xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void kDateTimeLT4() { final XQuery query = new XQuery( "xs:dateTime(\"2004-07-12T23:01:04.12\") le xs:dateTime(\"2004-07-12T23:01:04.12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateTimeLT-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'le' for xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void kDateTimeLT5() { final XQuery query = new XQuery( "xs:dateTime(\"2004-07-12T23:01:04.12\") le xs:dateTime(\"2004-07-12T23:01:04.12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DateTimeLT-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'le' for xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void kDateTimeLT6() { final XQuery query = new XQuery( "not(xs:dateTime(\"2004-07-13T23:01:04.12\") le xs:dateTime(\"2004-07-12T23:01:04.12\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeLessThan001() { final XQuery query = new XQuery( "declare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string }; declare function local:dateTime($year as xs:integer, $month as xs:integer, $day as xs:integer) { let $m := local:two-digit($month), $d := local:two-digit($day) return xs:dateTime(concat($year, '-', $m, '-', $d, \"T12:00:00\")) }; not(local:dateTime(2008, 05, 12) lt xs:dateTime(\"1972-12-15T12:00:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeLessThan002() { final XQuery query = new XQuery( "xs:dateTime(\"2008-01-30T00:01:00\") lt xs:dateTime(\"2008-01-31T01:00:00+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeLessThan003() { final XQuery query = new XQuery( "xs:dateTime(\"2008-01-31T00:01:00+09:00\") lt xs:dateTime(\"2008-01-30T00:01:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeLessThan004() { final XQuery query = new XQuery( "xs:dateTime(\"2008-01-31T00:01:00\") lt xs:dateTime(\"2008-01-31T00:01:00+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeLessThan005() { final XQuery query = new XQuery( "xs:dateTime(\"2008-01-31T00:01:00+09:00\") lt xs:dateTime(\"2008-01-31T00:01:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeLessThan006() { final XQuery query = new XQuery( "declare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string }; declare function local:dateTime($year as xs:integer, $month as xs:integer, $day as xs:integer) { let $m := local:two-digit($month), $d := local:two-digit($day) return xs:dateTime(concat($year, '-', $m, '-', $d, \"T12:00:00\")) }; not(local:dateTime(2008, 05, 12) le xs:dateTime(\"1972-12-15T12:00:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeLessThan007() { final XQuery query = new XQuery( "xs:dateTime(\"2008-01-30T00:01:00\") le xs:dateTime(\"2008-01-31T00:01:00+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeLessThan008() { final XQuery query = new XQuery( "xs:dateTime(\"2008-01-31T00:01:00+09:00\") le xs:dateTime(\"2008-01-30T00:01:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeLessThan009() { final XQuery query = new XQuery( "xs:dateTime(\"2008-01-31T00:01:00\") le xs:dateTime(\"2008-01-31T00:01:00+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeLessThan010() { final XQuery query = new XQuery( "xs:dateTime(\"2008-01-31T00:01:00+09:00\") le xs:dateTime(\"2008-01-31T00:01:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeLessThan011() { final XQuery query = new XQuery( "declare function local:dateTime($dateTime as xs:dateTime, $null as xs:boolean) { if ($null) then () else $dateTime }; exists(local:dateTime(xs:dateTime(\"1972-12-15T12:00:00\"), fn:true()) lt xs:dateTime(\"1972-12-15T12:00:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeLessThan012() { final XQuery query = new XQuery( "declare function local:dateTime($dateTime as xs:dateTime, $null as xs:boolean) { if ($null) then () else $dateTime }; local:dateTime(xs:dateTime(\"1972-12-15T12:00:00\"), fn:false()) lt xs:dateTime(\"1972-12-15T12:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeLessThan013() { final XQuery query = new XQuery( "declare function local:dateTime($dateTime as xs:dateTime, $null as xs:boolean) { if ($null) then () else $dateTime }; exists(local:dateTime(xs:dateTime(\"1972-12-15T12:00:00\"), fn:true()) ge xs:dateTime(\"1972-12-15T12:00:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeLessThan014() { final XQuery query = new XQuery( "declare function local:dateTime($dateTime as xs:dateTime, $null as xs:boolean) { if ($null) then () else $dateTime }; local:dateTime(xs:dateTime(\"1972-12-15T12:00:00\"), fn:false()) ge xs:dateTime(\"1972-12-15T12:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeLessThan015() { final XQuery query = new XQuery( "declare function local:dateTime($dateTime as xs:string, $timezone as xs:string) { xs:dateTime( concat($dateTime, $timezone) ) }; adjust-dateTime-to-timezone(local:dateTime(\"1972-12-14T00:00:00\", \"-12:00\")) lt adjust-dateTime-to-timezone(xs:dateTime(\"1972-12-15T00:00:00+12:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dateTime . */ @org.junit.Test public void cbclDateTimeLessThan016() { final XQuery query = new XQuery( "declare function local:dateTime($dateTime as xs:string, $timezone as xs:string) { xs:dateTime( concat($dateTime, $timezone) ) }; adjust-dateTime-to-timezone(local:dateTime(\"1972-12-14T00:00:00\", \"-12:00\")) le adjust-dateTime-to-timezone(xs:dateTime(\"1972-12-15T00:00:00+12:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-less-than-10 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dateTime-less-than" function used * together with "or" expression (le operator). * ******************************************************* * . */ @org.junit.Test public void opDateTimeLessThan10() { final XQuery query = new XQuery( "(xs:dateTime(\"2002-04-03T12:00:10Z\") le xs:dateTime(\"1990-04-02T12:10:00Z\")) or (xs:dateTime(\"1975-04-03T12:10:00Z\") le xs:dateTime(\"2000-02-02T12:00:09Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-less-than-11 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dateTime-less-than" function used * together with "fn:true"/or expression (lt operator). * ******************************************************* * . */ @org.junit.Test public void opDateTimeLessThan11() { final XQuery query = new XQuery( "(xs:dateTime(\"1990-04-02T12:00:10Z\") lt xs:dateTime(\"2006-06-02T12:10:00Z\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-less-than-12 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dateTime-less-than" function used * together with "fn:true"/or expression (le operator). * ******************************************************* * . */ @org.junit.Test public void opDateTimeLessThan12() { final XQuery query = new XQuery( "(xs:dateTime(\"1970-04-02T12:00:20Z\") le xs:dateTime(\"1980-04-02T12:00:20Z\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-less-than-13 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dateTime-less-than" function used * together with "fn:false"/or expression (lt operator). * ******************************************************* * . */ @org.junit.Test public void opDateTimeLessThan13() { final XQuery query = new XQuery( "(xs:dateTime(\"1981-04-02T12:00:00Z\") lt xs:dateTime(\"2003-04-02T12:10:00Z\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-less-than-14 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dateTime-less-than" function used * together with "fn:false"/or expression (le operator). * ******************************************************* * . */ @org.junit.Test public void opDateTimeLessThan14() { final XQuery query = new XQuery( "(xs:dateTime(\"1976-04-03T12:00:00Z\") le xs:dateTime(\"2002-07-02T12:00:30Z\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-less-than-3 * Written By: Carmelo Montanez * Date: June 17, 2005 * Purpose: Evaluates The "dateTime-less-than" function that * return true and used together with fn:not (lt operator) * ******************************************************* * . */ @org.junit.Test public void opDateTimeLessThan3() { final XQuery query = new XQuery( "fn:not((xs:dateTime(\"2002-04-02T12:00:00Z\") lt xs:dateTime(\"2003-04-02T12:00:00Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-less-than-4 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dateTime-less-than" function that * return true and used together with fn:not (le operator) * ******************************************************* * . */ @org.junit.Test public void opDateTimeLessThan4() { final XQuery query = new XQuery( "fn:not(xs:dateTime(\"2002-04-02T12:00:00Z\") le xs:dateTime(\"2002-04-02T12:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-less-than-5 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dateTime-less-than" function that * return false and used together with fn:not (lt operator) * ******************************************************* * . */ @org.junit.Test public void opDateTimeLessThan5() { final XQuery query = new XQuery( "fn:not(xs:dateTime(\"2002-05-02T12:00:00Z\") lt xs:dateTime(\"2002-04-02T12:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-less-than-6 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dateTime-less-than" function that * return false and used together with fn:not(le operator) * ******************************************************* * . */ @org.junit.Test public void opDateTimeLessThan6() { final XQuery query = new XQuery( "fn:not(xs:dateTime(\"2004-04-02T12:00:00Z\") le xs:dateTime(\"2002-04-02T12:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-less-than-7 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dateTime-less-than" function used * together with "and" expression (lt operator). * ******************************************************* * . */ @org.junit.Test public void opDateTimeLessThan7() { final XQuery query = new XQuery( "(xs:dateTime(\"2002-04-02T12:00:00Z\") lt xs:dateTime(\"2002-04-02T12:01:00Z\")) and (xs:dateTime(\"2003-04-02T12:00:00Z\") lt xs:dateTime(\"2002-04-02T12:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-less-than-8 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dateTime-less-than" function used * together with "and" expression (le operator). * ******************************************************* * . */ @org.junit.Test public void opDateTimeLessThan8() { final XQuery query = new XQuery( "(xs:dateTime(\"2002-04-02T12:00:00Z\") le xs:dateTime(\"2005-04-02T12:00:20Z\")) and (xs:dateTime(\"2002-04-02T12:10:00Z\") le xs:dateTime(\"2002-04-03T12:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-less-than-9 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dateTime-less-than" function used * together with "or" expression (lt operator). * ******************************************************* * . */ @org.junit.Test public void opDateTimeLessThan9() { final XQuery query = new XQuery( "(xs:dateTime(\"2002-06-02T12:00:10Z\") lt xs:dateTime(\"2000-04-04T12:00:00Z\")) or (xs:dateTime(\"2002-04-02T13:00:10Z\") lt xs:dateTime(\"2001-04-02T10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-less-than2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-less-than" operator * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dateTime(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeLessThan2args1() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") lt xs:dateTime(\"1970-01-01T00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-less-than2args-10 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-less-than" operator * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dateTime(upper bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeLessThan2args10() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") ge xs:dateTime(\"2030-12-31T23:59:59Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-less-than2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-less-than" operator * with the arguments set as follows: * $arg1 = xs:dateTime(mid range) * $arg2 = xs:dateTime(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeLessThan2args2() { final XQuery query = new XQuery( "xs:dateTime(\"1996-04-07T01:40:52Z\") lt xs:dateTime(\"1970-01-01T00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-less-than2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-less-than" operator * with the arguments set as follows: * $arg1 = xs:dateTime(upper bound) * $arg2 = xs:dateTime(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeLessThan2args3() { final XQuery query = new XQuery( "xs:dateTime(\"2030-12-31T23:59:59Z\") lt xs:dateTime(\"1970-01-01T00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dateTime-less-than2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-less-than" operator * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dateTime(mid range) * ******************************************************* * . */ @org.junit.Test public void opDateTimeLessThan2args4() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") lt xs:dateTime(\"1996-04-07T01:40:52Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-less-than2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-less-than" operator * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dateTime(upper bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeLessThan2args5() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") lt xs:dateTime(\"2030-12-31T23:59:59Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-less-than2args-6 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-less-than" operator * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dateTime(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeLessThan2args6() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") ge xs:dateTime(\"1970-01-01T00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-less-than2args-7 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-less-than" operator * with the arguments set as follows: * $arg1 = xs:dateTime(mid range) * $arg2 = xs:dateTime(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeLessThan2args7() { final XQuery query = new XQuery( "xs:dateTime(\"1996-04-07T01:40:52Z\") ge xs:dateTime(\"1970-01-01T00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-less-than2args-8 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-less-than" operator * with the arguments set as follows: * $arg1 = xs:dateTime(upper bound) * $arg2 = xs:dateTime(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDateTimeLessThan2args8() { final XQuery query = new XQuery( "xs:dateTime(\"2030-12-31T23:59:59Z\") ge xs:dateTime(\"1970-01-01T00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dateTime-less-than2args-9 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dateTime-less-than" operator * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dateTime(mid range) * ******************************************************* * . */ @org.junit.Test public void opDateTimeLessThan2args9() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") ge xs:dateTime(\"1996-04-07T01:40:52Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpDayTimeDurationGreaterThan.java000066400000000000000000001333341222453003200324570ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the dayTimeDuration-greater-than() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpDayTimeDurationGreaterThan extends QT3TestSet { /** * * ******************************************************* * Test: K-DayTimeDurationGT-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'gt' for xs:dayTimeDuration. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationGT1() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT08H34M12.144S\") gt xs:dayTimeDuration(\"P3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DayTimeDurationGT-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'gt' for xs:dayTimeDuration, evaluating to false. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationGT2() { final XQuery query = new XQuery( "not(xs:dayTimeDuration(\"P3DT08H34M12.144S\") gt xs:dayTimeDuration(\"P3DT08H34M12.144S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DayTimeDurationGT-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'gt' for xs:dayTimeDuration, evaluating to false. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationGT3() { final XQuery query = new XQuery( "not(xs:dayTimeDuration(\"P3DT08H34M12.144S\") gt xs:dayTimeDuration(\"P3DT08H34M12.145S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DayTimeDurationGT-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ge' for xs:dayTimeDuration. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationGT4() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT08H34M12.143S\") ge xs:dayTimeDuration(\"P3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DayTimeDurationGT-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ge' for xs:dayTimeDuration. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationGT5() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT08H34M12.144S\") ge xs:dayTimeDuration(\"P3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DayTimeDurationGT-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ge' for xs:dayTimeDuration, evaluating to false. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationGT6() { final XQuery query = new XQuery( "not(xs:dayTimeDuration(\"P3DT08H34M12.143S\") ge xs:dayTimeDuration(\"P3DT08H34M12.144S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dayTimeDurations . */ @org.junit.Test public void cbclDayTimeDurationGreaterThan001() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($days as xs:integer, $hours as xs:integer ) { xs:dayTimeDuration(concat('P', $days, 'DT', $hours, 'H')) }; \n" + " not(local:dayTimeDuration(1, 1) gt xs:dayTimeDuration(\"P0D\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dayTimeDurations . */ @org.junit.Test public void cbclDayTimeDurationGreaterThan002() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($days as xs:integer, $hours as xs:integer ) { xs:dayTimeDuration(concat('P', $days, 'DT', $hours, 'H')) }; \n" + " not(local:dayTimeDuration(1, 1) ge xs:dayTimeDuration(\"P0D\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:dayTimeDuration . */ @org.junit.Test public void cbclDayTimeDurationGreaterThan003() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($dayTimeDuration as xs:dayTimeDuration, $null as xs:boolean) { if ($null) then () else $dayTimeDuration }; \n" + " exists(local:dayTimeDuration(xs:dayTimeDuration(\"P0D\"), fn:true()) gt xs:dayTimeDuration(\"P0D\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:dayTimeDuration . */ @org.junit.Test public void cbclDayTimeDurationGreaterThan004() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($dayTimeDuration as xs:dayTimeDuration, $null as xs:boolean) { if ($null) then () else $dayTimeDuration }; \n" + " local:dayTimeDuration(xs:dayTimeDuration(\"P0D\"), fn:false()) gt xs:dayTimeDuration(\"P0D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:dayTimeDuration . */ @org.junit.Test public void cbclDayTimeDurationGreaterThan005() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($dayTimeDuration as xs:dayTimeDuration, $null as xs:boolean) { if ($null) then () else $dayTimeDuration }; \n" + " exists(local:dayTimeDuration(xs:dayTimeDuration(\"P0D\"), fn:true()) le xs:dayTimeDuration(\"P0D\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:dayTimeDuration . */ @org.junit.Test public void cbclDayTimeDurationGreaterThan006() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($dayTimeDuration as xs:dayTimeDuration, $null as xs:boolean) { if ($null) then () else $dayTimeDuration }; \n" + " local:dayTimeDuration(xs:dayTimeDuration(\"P0D\"), fn:false()) le xs:dayTimeDuration(\"P0D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test behaviour of the overloaded greater equal value comparison operator when presented with an expression * with static type xs:duration. . */ @org.junit.Test public void cbclValueGreaterEqual001() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " local:f(false()) ge xs:yearMonthDuration(\"P1Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test behaviour of the overloaded greater equal value comparison operator when presented with an expression * with static type xs:duration. . */ @org.junit.Test public void cbclValueGreaterEqual002() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " local:f(true()) ge xs:yearMonthDuration(\"P1Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of the overloaded greater equal value comparison operator when presented with an expression * with static type xs:duration. . */ @org.junit.Test public void cbclValueGreaterEqual003() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:dayTimeDuration(\"PT1H\") };\n" + " local:f(false()) ge xs:dayTimeDuration(\"P1D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test behaviour of the overloaded greater equal value comparison operator when presented with an expression * with static type xs:duration. . */ @org.junit.Test public void cbclValueGreaterEqual004() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:dayTimeDuration(\"PT1H\") };\n" + " local:f(true()) ge xs:dayTimeDuration(\"P1D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of the overloaded greater equal value comparison operator when presented with an expression * with static type xs:duration. . */ @org.junit.Test public void cbclValueGreaterEqual005() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " xs:yearMonthDuration(\"P1Y\") ge local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test behaviour of the overloaded greater equal value comparison operator when presented with an expression * with static type xs:duration. . */ @org.junit.Test public void cbclValueGreaterEqual006() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " xs:yearMonthDuration(\"P1Y\") ge local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of the overloaded greater equal value comparison operator when presented with an expression * with static type xs:duration. . */ @org.junit.Test public void cbclValueGreaterEqual007() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:dayTimeDuration(\"PT1H\") };\n" + " xs:dayTimeDuration(\"P1D\") ge local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test behaviour of the overloaded greater equal value comparison operator when presented with an expression * with static type xs:duration. . */ @org.junit.Test public void cbclValueGreaterEqual008() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:dayTimeDuration(\"PT1H\") };\n" + " xs:dayTimeDuration(\"P1D\") ge local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of the overloaded greater equal value comparison operator when presented with an expression * with static type xs:duration. . */ @org.junit.Test public void cbclValueGreaterEqual009() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " local:f(false()) ge local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test behaviour of the overloaded greater equal value comparison operator when presented with an expression * with static type xs:duration. . */ @org.junit.Test public void cbclValueGreaterEqual010() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " local:f(true()) ge local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of the overloaded greater equal value comparison operator when presented with an expression * with static type xs:duration. . */ @org.junit.Test public void cbclValueGreaterEqual011() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:dayTimeDuration(\"PT1H\") };\n" + " local:f(false()) ge local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test behaviour of the overloaded greater equal value comparison operator when presented with an expression * with static type xs:duration. . */ @org.junit.Test public void cbclValueGreaterEqual012() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:dayTimeDuration(\"PT1H\") };\n" + " local:f(false()) ge local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of the overloaded greater than value comparison operator when presented with an expression * with static type xs:duration. . */ @org.junit.Test public void cbclValueGreaterThan001() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " local:f(false()) gt xs:yearMonthDuration(\"P1Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test behaviour of the overloaded greater than value comparison operator when presented with an expression * with static type xs:duration. . */ @org.junit.Test public void cbclValueGreaterThan002() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " local:f(true()) gt xs:yearMonthDuration(\"P1Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of the overloaded greater than value comparison operator when presented with an expression * with static type xs:duration. . */ @org.junit.Test public void cbclValueGreaterThan003() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:dayTimeDuration(\"PT1H\") };\n" + " local:f(false()) gt xs:dayTimeDuration(\"P1D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test behaviour of the overloaded greater than value comparison operator when presented with an expression * with static type xs:duration. . */ @org.junit.Test public void cbclValueGreaterThan004() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:dayTimeDuration(\"PT1H\") };\n" + " local:f(true()) gt xs:dayTimeDuration(\"P1D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of the overloaded greater than value comparison operator when presented with an expression * with static type xs:duration. . */ @org.junit.Test public void cbclValueGreaterThan005() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " xs:yearMonthDuration(\"P1Y\") gt local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test behaviour of the overloaded greater than value comparison operator when presented with an expression * with static type xs:duration. . */ @org.junit.Test public void cbclValueGreaterThan006() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " xs:yearMonthDuration(\"P1Y\") gt local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of the overloaded greater than value comparison operator when presented with an expression * with static type xs:duration. . */ @org.junit.Test public void cbclValueGreaterThan007() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:dayTimeDuration(\"PT1H\") };\n" + " xs:dayTimeDuration(\"P1D\") gt local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test behaviour of the overloaded greater than value comparison operator when presented with an expression * with static type xs:duration. . */ @org.junit.Test public void cbclValueGreaterThan008() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:dayTimeDuration(\"PT1H\") };\n" + " xs:dayTimeDuration(\"P1D\") gt local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of the overloaded greater than value comparison operator when presented with an expression * with static type xs:duration. . */ @org.junit.Test public void cbclValueGreaterThan009() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " local:f(false()) gt local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test behaviour of the overloaded greater than value comparison operator when presented with an expression * with static type xs:duration. . */ @org.junit.Test public void cbclValueGreaterThan010() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " local:f(true()) gt local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of the overloaded greater than value comparison operator when presented with an expression * with static type xs:duration. . */ @org.junit.Test public void cbclValueGreaterThan011() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:dayTimeDuration(\"PT1H\") };\n" + " local:f(false()) gt local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test behaviour of the overloaded greater than value comparison operator when presented with an expression * with static type xs:duration. . */ @org.junit.Test public void cbclValueGreaterThan012() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:dayTimeDuration(\"PT1H\") };\n" + " local:f(false()) gt local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: op-dayTimeDuration-greater-than-10 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dayTimeDuration-greater-than" function used * together with "or" expression (ge operator). * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationGreaterThan10() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P10DT01H\") ge xs:dayTimeDuration(\"P09DT06H\")) or (xs:dayTimeDuration(\"P15DT01H\") ge xs:dayTimeDuration(\"P02DT04H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-greater-than-11 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dayTimeDuration-greater-than" function used * together with "fn:true"/or expression (gt operator). * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationGreaterThan11() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P10DT02H\") gt xs:dayTimeDuration(\"P01DT10H\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-greater-than-12 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dayTimeDuration-greater-than" function used * together with "fn:true"/or expression (ge operator). * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationGreaterThan12() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P10DT01H\") ge xs:dayTimeDuration(\"P09DT05H\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-greater-than-13 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dayTimeDuration-greater-than" function used * together with "fn:false"/or expression (gt operator). * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationGreaterThan13() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P30DT10H\") gt xs:dayTimeDuration(\"P01DT02H\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-greater-than-14 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dayTimeDuration-greater-than" function used * together with "fn:false"/or expression (ge operator). * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationGreaterThan14() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P10DT05H\") ge xs:dayTimeDuration(\"P20DT10H\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-greater-than-3 * Written By: Carmelo Montanez * Date: June 17, 2005 * Purpose: Evaluates The "dayTimeDuration-greater-than" function that * return true and used together with fn:not (gt operator) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationGreaterThan3() { final XQuery query = new XQuery( "fn:not((xs:dayTimeDuration(\"P15DT12H\") gt xs:dayTimeDuration(\"P14DT11H\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-greater-than-4 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dayTimeDuration-greater-than" function that * return true and used together with fn:not (ge operator) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationGreaterThan4() { final XQuery query = new XQuery( "fn:not(xs:dayTimeDuration(\"P10DT11H\") ge xs:dayTimeDuration(\"P10DT10H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-greater-than-5 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dayTimeDuration-greater-than" function that * return false and used together with fn:not (gt operator) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationGreaterThan5() { final XQuery query = new XQuery( "fn:not(xs:dayTimeDuration(\"P08DT10H\") gt xs:dayTimeDuration(\"P9DT09H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-greater-than-6 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dayTimeDuration-greater-than" function that * return false and used together with fn:not(ge operator) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationGreaterThan6() { final XQuery query = new XQuery( "fn:not(xs:dayTimeDuration(\"P07DT09H\") ge xs:dayTimeDuration(\"P09DT09H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-greater-than-7 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dayTimeDuration-greater-than" function used * together with "and" expression (gt operator). * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationGreaterThan7() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P10DT09H\") gt xs:dayTimeDuration(\"P09DT10H\")) and (xs:dayTimeDuration(\"P10DT01H\") gt xs:dayTimeDuration(\"P08DT06H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-greater-than-8 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dayTimeDuration-greater-than" function used * together with "and" expression (ge operator). * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationGreaterThan8() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P10DT09H\") ge xs:dayTimeDuration(\"P10DT01H\")) and (xs:dayTimeDuration(\"P02DT04H\") ge xs:dayTimeDuration(\"P09DT07H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-greater-than-9 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dayTimeDuration-greater-than" function used * together with "or" expression (gt operator). * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationGreaterThan9() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P10DT08H\") gt xs:dayTimeDuration(\"P10DT07H\")) or (xs:dayTimeDuration(\"P10DT09H\") gt xs:dayTimeDuration(\"P10DT09H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-greater-than2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dayTimeDuration-greater-than" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(lower bound) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationGreaterThan2args1() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") gt xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-greater-than2args-10 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dayTimeDuration-greater-than" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(lower bound) * $arg2 = xs:dayTimeDuration(upper bound) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationGreaterThan2args10() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") le xs:dayTimeDuration(\"P31DT23H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-greater-than2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dayTimeDuration-greater-than" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(mid range) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationGreaterThan2args2() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P15DT11H59M59S\") gt xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-greater-than2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dayTimeDuration-greater-than" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(upper bound) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationGreaterThan2args3() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P31DT23H59M59S\") gt xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-greater-than2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dayTimeDuration-greater-than" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(lower bound) * $arg2 = xs:dayTimeDuration(mid range) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationGreaterThan2args4() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") gt xs:dayTimeDuration(\"P15DT11H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-greater-than2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dayTimeDuration-greater-than" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(lower bound) * $arg2 = xs:dayTimeDuration(upper bound) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationGreaterThan2args5() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") gt xs:dayTimeDuration(\"P31DT23H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-greater-than2args-6 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dayTimeDuration-greater-than" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(lower bound) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationGreaterThan2args6() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") le xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-greater-than2args-7 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dayTimeDuration-greater-than" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(mid range) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationGreaterThan2args7() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P15DT11H59M59S\") le xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-greater-than2args-8 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dayTimeDuration-greater-than" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(upper bound) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationGreaterThan2args8() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P31DT23H59M59S\") le xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-greater-than2args-9 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dayTimeDuration-greater-than" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(lower bound) * $arg2 = xs:dayTimeDuration(mid range) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationGreaterThan2args9() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") le xs:dayTimeDuration(\"P15DT11H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpDayTimeDurationLessThan.java000066400000000000000000001121311222453003200317640ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the dayTimeDuration-less-than() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpDayTimeDurationLessThan extends QT3TestSet { /** * * ******************************************************* * Test: K-DayTimeDurationLT-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'lt' for xs:dayTimeDuration. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationLT1() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT08H34M12.142S\") lt xs:dayTimeDuration(\"P3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DayTimeDurationLT-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'lt' for xs:dayTimeDuration, evaluating to false. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationLT2() { final XQuery query = new XQuery( "not(xs:dayTimeDuration(\"P3DT08H34M12.143S\") lt xs:dayTimeDuration(\"P3DT08H34M12.143S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DayTimeDurationLT-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'lt' for xs:dayTimeDuration, evaluating to false. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationLT3() { final XQuery query = new XQuery( "not(xs:dayTimeDuration(\"P3DT08H34M12.144S\") lt xs:dayTimeDuration(\"P3DT08H34M12.143S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DayTimeDurationLT-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'le' for xs:dayTimeDuration. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationLT4() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT08H34M12.143S\") le xs:dayTimeDuration(\"P3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DayTimeDurationLT-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'le' for xs:dayTimeDuration. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationLT5() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT08H34M12.143S\") le xs:dayTimeDuration(\"P3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DayTimeDurationLT-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'le' for xs:dayTimeDuration, evaluating to false. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationLT6() { final XQuery query = new XQuery( "not(xs:dayTimeDuration(\"P3DT08H34M12.143S\") le xs:dayTimeDuration(\"P3DT08H34M12.142S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dayTimeDurations . */ @org.junit.Test public void cbclDayTimeDurationLessThan001() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($days as xs:integer, $hours as xs:integer ) { xs:dayTimeDuration(concat('P', $days, 'DT', $hours, 'H')) }; not(local:dayTimeDuration(1, 1) lt xs:dayTimeDuration(\"P0D\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dayTimeDurations . */ @org.junit.Test public void cbclDayTimeDurationLessThan002() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($days as xs:integer, $hours as xs:integer ) { xs:dayTimeDuration(concat('P', $days, 'DT', $hours, 'H')) }; not(local:dayTimeDuration(1, 1) le xs:dayTimeDuration(\"P0D\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of xs:dayTimeDuration . */ @org.junit.Test public void cbclDayTimeDurationLessThan003() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($dayTimeDuration as xs:dayTimeDuration, $null as xs:boolean) { if ($null) then () else $dayTimeDuration }; exists(local:dayTimeDuration(xs:dayTimeDuration(\"P0D\"), fn:true()) lt xs:dayTimeDuration(\"P0D\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:dayTimeDuration . */ @org.junit.Test public void cbclDayTimeDurationLessThan004() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($dayTimeDuration as xs:dayTimeDuration, $null as xs:boolean) { if ($null) then () else $dayTimeDuration }; local:dayTimeDuration(xs:dayTimeDuration(\"P0D\"), fn:false()) lt xs:dayTimeDuration(\"P0D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:dayTimeDuration . */ @org.junit.Test public void cbclDayTimeDurationLessThan005() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($dayTimeDuration as xs:dayTimeDuration, $null as xs:boolean) { if ($null) then () else $dayTimeDuration }; exists(local:dayTimeDuration(xs:dayTimeDuration(\"P0D\"), fn:true()) le xs:dayTimeDuration(\"P0D\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:dayTimeDuration . */ @org.junit.Test public void cbclDayTimeDurationLessThan006() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($dayTimeDuration as xs:dayTimeDuration, $null as xs:boolean) { if ($null) then () else $dayTimeDuration }; local:dayTimeDuration(xs:dayTimeDuration(\"P0D\"), fn:false()) le xs:dayTimeDuration(\"P0D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test behaviour of the overloaded less equal value comparison operator when presented with an expression with static type xs:duration. . */ @org.junit.Test public void cbclValueLessEqual001() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " local:f(false()) le xs:yearMonthDuration(\"P1Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test behaviour of the overloaded less equal value comparison operator when presented with an expression with static type xs:duration. . */ @org.junit.Test public void cbclValueLessEqual002() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " local:f(true()) le xs:yearMonthDuration(\"P1Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of the overloaded less equal value comparison operator when presented with an expression with static type xs:duration. . */ @org.junit.Test public void cbclValueLessEqual003() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:dayTimeDuration(\"PT1H\") };\n" + " local:f(false()) le xs:dayTimeDuration(\"P1D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test behaviour of the overloaded less equal value comparison operator when presented with an expression with static type xs:duration. . */ @org.junit.Test public void cbclValueLessEqual004() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:dayTimeDuration(\"PT1H\") };\n" + " local:f(true()) le xs:dayTimeDuration(\"P1D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of the overloaded less equal value comparison operator when presented with an expression with static type xs:duration. . */ @org.junit.Test public void cbclValueLessEqual005() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " xs:yearMonthDuration(\"P1Y\") le local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test behaviour of the overloaded less equal value comparison operator when presented with an expression with static type xs:duration. . */ @org.junit.Test public void cbclValueLessEqual006() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " xs:yearMonthDuration(\"P1Y\") le local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of the overloaded less equal value comparison operator when presented with an expression with static type xs:duration. . */ @org.junit.Test public void cbclValueLessEqual007() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:dayTimeDuration(\"PT1H\") };\n" + " xs:dayTimeDuration(\"P1D\") le local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test behaviour of the overloaded less equal value comparison operator when presented with an expression with static type xs:duration. . */ @org.junit.Test public void cbclValueLessEqual008() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:dayTimeDuration(\"PT1H\") };\n" + " xs:dayTimeDuration(\"P1D\") le local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of the overloaded less equal value comparison operator when presented with an expression with static type xs:duration. . */ @org.junit.Test public void cbclValueLessEqual009() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " local:f(false()) le local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test behaviour of the overloaded less equal value comparison operator when presented with an expression with static type xs:duration. . */ @org.junit.Test public void cbclValueLessEqual010() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " local:f(true()) le local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of the overloaded less equal value comparison operator when presented with an expression with static type xs:duration. . */ @org.junit.Test public void cbclValueLessEqual011() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:dayTimeDuration(\"PT1H\") };\n" + " local:f(false()) le local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test behaviour of the overloaded less equal value comparison operator when presented with an expression with static type xs:duration. . */ @org.junit.Test public void cbclValueLessEqual012() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:dayTimeDuration(\"PT1H\") };\n" + " local:f(false()) le local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: op-dayTimeDuration-less-than-10 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dayTimeDuration-less-than" function used * together with "or" expression (le operator). * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationLessThan10() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P10DT01H\") le xs:dayTimeDuration(\"P09DT06H\")) or (xs:dayTimeDuration(\"P15DT01H\") le xs:dayTimeDuration(\"P02DT04H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-less-than-11 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dayTimeDuration-less-than" function used * together with "fn:true"/or expression (lt operator). * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationLessThan11() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P10DT02H\") lt xs:dayTimeDuration(\"P01DT10H\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-less-than-12 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dayTimeDuration-less-than" function used * together with "fn:true"/or expression (le operator). * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationLessThan12() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P10DT01H\") le xs:dayTimeDuration(\"P09DT05H\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-less-than-13 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dayTimeDuration-less-than" function used * together with "fn:false"/or expression (lt operator). * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationLessThan13() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P30DT10H\") lt xs:dayTimeDuration(\"P01DT02H\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-less-than-14 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dayTimeDuration-less-than" function used * together with "fn:false"/or expression (le operator). * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationLessThan14() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P10DT05H\") le xs:dayTimeDuration(\"P20DT10H\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-less-than-3 * Written By: Carmelo Montanez * Date: June 17, 2005 * Purpose: Evaluates The "dayTimeDuration-less-than" function that * return true and used together with fn:not (lt operator) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationLessThan3() { final XQuery query = new XQuery( "fn:not((xs:dayTimeDuration(\"P13DT12H\") lt xs:dayTimeDuration(\"P14DT11H\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-less-than-4 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dayTimeDuration-less-than" function that * return true and used together with fn:not (le operator) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationLessThan4() { final XQuery query = new XQuery( "fn:not(xs:dayTimeDuration(\"P10DT110H\") le xs:dayTimeDuration(\"P10DT11H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-less-than-5 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dayTimeDuration-less-than" function that * return false and used together with fn:not (lt operator) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationLessThan5() { final XQuery query = new XQuery( "fn:not(xs:dayTimeDuration(\"P10DT10H\") lt xs:dayTimeDuration(\"P9DT09H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-less-than-6 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dayTimeDuration-less-than" function that * return false and used together with fn:not(le operator) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationLessThan6() { final XQuery query = new XQuery( "fn:not(xs:dayTimeDuration(\"P10DT09H\") le xs:dayTimeDuration(\"P09DT09H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-less-than-7 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dayTimeDuration-less-than" function used * together with "and" expression (lt operator). * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationLessThan7() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P10DT09H\") lt xs:dayTimeDuration(\"P09DT10H\")) and (xs:dayTimeDuration(\"P10DT01H\") lt xs:dayTimeDuration(\"P08DT06H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-less-than-8 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dayTimeDuration-less-than" function used * together with "and" expression (le operator). * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationLessThan8() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P10DT09H\") le xs:dayTimeDuration(\"P10DT01H\")) and (xs:dayTimeDuration(\"P02DT04H\") le xs:dayTimeDuration(\"P09DT07H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-less-than-9 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "dayTimeDuration-less-than" function used * together with "or" expression (lt operator). * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationLessThan9() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P10DT08H\") lt xs:dayTimeDuration(\"P10DT07H\")) or (xs:dayTimeDuration(\"P10DT09H\") lt xs:dayTimeDuration(\"P10DT09H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-less-than2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dayTimeDuration-less-than" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(lower bound) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationLessThan2args1() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") lt xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-less-than2args-10 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dayTimeDuration-less-than" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(lower bound) * $arg2 = xs:dayTimeDuration(upper bound) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationLessThan2args10() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") ge xs:dayTimeDuration(\"P31DT23H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-less-than2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dayTimeDuration-less-than" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(mid range) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationLessThan2args2() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P15DT11H59M59S\") lt xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-less-than2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dayTimeDuration-less-than" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(upper bound) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationLessThan2args3() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P31DT23H59M59S\") lt xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-less-than2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dayTimeDuration-less-than" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(lower bound) * $arg2 = xs:dayTimeDuration(mid range) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationLessThan2args4() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") lt xs:dayTimeDuration(\"P15DT11H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-less-than2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dayTimeDuration-less-than" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(lower bound) * $arg2 = xs:dayTimeDuration(upper bound) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationLessThan2args5() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") lt xs:dayTimeDuration(\"P31DT23H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-less-than2args-6 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dayTimeDuration-less-than" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(lower bound) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationLessThan2args6() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") ge xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-less-than2args-7 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dayTimeDuration-less-than" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(mid range) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationLessThan2args7() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P15DT11H59M59S\") ge xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-less-than2args-8 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dayTimeDuration-less-than" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(upper bound) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationLessThan2args8() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P31DT23H59M59S\") ge xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-dayTimeDuration-less-than2args-9 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:dayTimeDuration-less-than" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(lower bound) * $arg2 = xs:dayTimeDuration(mid range) * ******************************************************* * . */ @org.junit.Test public void opDayTimeDurationLessThan2args9() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") ge xs:dayTimeDuration(\"P15DT11H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpDivideDayTimeDuration.java000066400000000000000000001225671222453003200314650ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the divide-dayTimeDuration() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpDivideDayTimeDuration extends QT3TestSet { /** * * ******************************************************* * Test: K-DayTimeDurationDivide-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of dividing a xs:dayTimeDuration with 4. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationDivide1() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P8DT4H4M4.400S\") div 4 eq xs:dayTimeDuration(\"P2DT1H1M1.1S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DayTimeDurationDivide-10 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The division operator is not available between xs:integer and xs:dayTimeDuration. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationDivide10() { final XQuery query = new XQuery( "3 div xs:dayTimeDuration(\"P3D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DayTimeDurationDivide-11 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The division operator is not available between xs:dayTimeDuration and xs:yearMonthDuration. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationDivide11() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3D\") div xs:yearMonthDuration(\"P3Y3M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DayTimeDurationDivide-12 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The division operator is not available between xs:yearMonthDuration and xs:dayTimeDuration. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationDivide12() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P3Y3M\") div xs:dayTimeDuration(\"P3D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DayTimeDurationDivide-13 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The division operator is not available between xs:duration and xs:yearMonthDuration. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationDivide13() { final XQuery query = new XQuery( "xs:duration(\"P3D\") div xs:yearMonthDuration(\"P3Y3M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DayTimeDurationDivide-14 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The division operator is not available between xs:yearMonthDuration and xs:duration. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationDivide14() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P3Y3M\") div xs:duration(\"P3D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DayTimeDurationDivide-15 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The division operator is not available between xs:dayTimeDuration and xs:duration. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationDivide15() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3D\") div xs:duration(\"P3Y3M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DayTimeDurationDivide-16 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The division operator is not available between xs:duration and xs:dayTimeDuration. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationDivide16() { final XQuery query = new XQuery( "xs:duration(\"P3Y3M\") div xs:dayTimeDuration(\"P3D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DayTimeDurationDivide-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of dividing a xs:dayTimeDuration with xs:double('-INF'). * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationDivide2() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3D\") div xs:double(\"-INF\") eq xs:dayTimeDuration(\"PT0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DayTimeDurationDivide-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of dividing a xs:dayTimeDuration with xs:double('INF'). * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationDivide3() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3D\") div xs:double(\"INF\") eq xs:dayTimeDuration(\"PT0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DayTimeDurationDivide-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of dividing a xs:dayTimeDuration with 0. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationDivide4() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT4H3M3.100S\") div 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * * ******************************************************* * Test: K-DayTimeDurationDivide-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of dividing a xs:dayTimeDuration with NaN. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationDivide5() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT4H3M3.100S\") div xs:double(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0005") ); } /** * * ******************************************************* * Test: K-DayTimeDurationDivide-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of dividing a xs:dayTimeDuration with xs:double('-0'). * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationDivide6() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3D\") div xs:double(\"-0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * * ******************************************************* * Test: K-DayTimeDurationDivide-7 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The division operator is not available between xs:duration and xs:integer. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationDivide7() { final XQuery query = new XQuery( "xs:duration(\"P1Y3M\") div 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DayTimeDurationDivide-8 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The division operator is not available between xs:integer and xs:duration. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationDivide8() { final XQuery query = new XQuery( "3 div xs:duration(\"P1Y3M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DayTimeDurationDivide-9 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The division operator is not available between xs:integer and xs:yearMonthDuration. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationDivide9() { final XQuery query = new XQuery( "3 div xs:yearMonthDuration(\"P1Y3M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of division operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclDiv001() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1Y\") else xs:yearMonthDuration(\"P1Y\") }; local:f(false()) div xs:yearMonthDuration(\"P1M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12") ); } /** * Test behaviour of division operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclDiv002() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1Y\") else xs:yearMonthDuration(\"P1Y\") }; local:f(true()) div xs:yearMonthDuration(\"P1M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of division operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclDiv003() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") }; local:f(false()) div xs:dayTimeDuration(\"PT1H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "24") ); } /** * Test behaviour of division operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclDiv004() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") }; local:f(true()) div xs:dayTimeDuration(\"PT1H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of division operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclDiv005() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") }; xs:yearMonthDuration(\"P1Y\") div local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12") ); } /** * Test behaviour of division operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclDiv006() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") }; xs:yearMonthDuration(\"P1Y\") div local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of division operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclDiv007() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:dayTimeDuration(\"PT1H\") }; xs:dayTimeDuration(\"P1D\") div local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "24") ); } /** * Test behaviour of division operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclDiv008() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:dayTimeDuration(\"PT1H\") }; xs:dayTimeDuration(\"P1D\") div local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of division operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclDiv009() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") }; local:f(false()) div local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Test behaviour of division operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclDiv010() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") }; local:f(true()) div local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of division operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclDiv011() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:dayTimeDuration(\"PT1H\") }; local:f(false()) div local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Test behaviour of division operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclDiv012() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:dayTimeDuration(\"PT1H\") }; local:f(false()) div local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of division operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclDiv013() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P2M\") else xs:yearMonthDuration(\"P2M\") }; local:f(false()) div 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1M") ); } /** * Test behaviour of division operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclDiv014() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P2M\") else xs:yearMonthDuration(\"P2M\") }; local:f(true()) div 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of division operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclDiv015() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") }; local:f(false()) div 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT12H") ); } /** * Test behaviour of division operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclDiv016() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:dayTimeDuration(\"P1D\") }; local:f(true()) div 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test division of xs:dayTimeDuration by 0 . */ @org.junit.Test public void cbclDivideDayTimeDuration001() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($days as xs:integer) as xs:dayTimeDuration { xs:dayTimeDuration(concat(\"P\", $days, \"D\")) }; local:dayTimeDuration(2) div 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * test division of xs:dayTimeDuration by 1 . */ @org.junit.Test public void cbclDivideDayTimeDuration002() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($days as xs:integer) as xs:dayTimeDuration { xs:dayTimeDuration(concat(\"P\", $days, \"D\")) }; local:dayTimeDuration(2) div 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P2D") ); } /** * test possible overflow in divison of xs:dayTimeDuration by . */ @org.junit.Test public void cbclDivideDayTimeDuration003() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P9223372036854775807D\") div 0.5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-10 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "divide-dayTimeDuration" function used * together with an "or" expression. * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDuration10() { final XQuery query = new XQuery( "fn:string((xs:dayTimeDuration(\"P05DT09H02M\") div 2.0)) or fn:string((xs:dayTimeDuration(\"P05DT05H03M\") div 2.0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-11 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "divide-dayTimeDuration" function used * together with multiple "div" expressions. * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDuration11() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P42DT10H10M\") div 2.0) div (xs:dayTimeDuration(\"P42DT10H10M\") div 2.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-12 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "divide-dayTimeDuration" operators used * with a boolean expression and the "fn:true" function. * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDuration12() { final XQuery query = new XQuery( "fn:string((xs:dayTimeDuration(\"P10DT08H11M\") div 2.0)) and (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-13 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "divide-dayTimeDuration" function used * together with the numeric-equal-operator "eq". * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDuration13() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P23DT11H11M\") div 2.0) eq xs:dayTimeDuration(\"P23DT11H11M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-14 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "divide-dayTimeDuration" function used * together with the numeric-equal operator "ne". * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDuration14() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P21DT08H12M\") div 2.0) ne xs:dayTimeDuration(\"P08DT08H05M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-15 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "divide-dayTimeDuration" function used * together with the numeric-equal operator "le". * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDuration15() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P10DT10H01M\") div 2.0) le xs:dayTimeDuration(\"P17DT10H02M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-16 * Date: June 29, 2005 * Purpose: Evaluates The "divide-dayTimeDuration" function used * together with the numeric-equal operator "ge". * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDuration16() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P13DT09H09M\") div 2.0) ge xs:dayTimeDuration(\"P18DT02H02M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-2 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "divide-dayTimeDuration" function * used as part of a boolean expression (and operator) and the "fn:false" function. * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDuration2() { final XQuery query = new XQuery( "fn:string((xs:dayTimeDuration(\"P10DT10H11M\")) div 2.0) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-3 * Date: June 29, 2005 * Purpose: Evaluates The "divide-dayTimeDuration" function as * part of a boolean expression (or operator) and the "fn:boolean" function. * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDuration3() { final XQuery query = new XQuery( "fn:string((xs:dayTimeDuration(\"P20DT20H10M\") div 2.0)) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-4 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "divide-dayTimeDuration" function that * return true and used together with fn:not. * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDuration4() { final XQuery query = new XQuery( "fn:not(fn:string(xs:dayTimeDuration(\"P11DT12H04M\") div 2.0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-5 * Written By: Carmelo Montanez * Date: June 29 2005 * Purpose: Evaluates The "divide-dayTimeDuration" function that * is used as an argument to the fn:boolean function. * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDuration5() { final XQuery query = new XQuery( "fn:boolean(fn:string(xs:dayTimeDuration(\"P05DT09H08M\") div 2.0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-6 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "divide-dayTimeDuration" operator that * is used as an argument to the fn:number function. * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDuration6() { final XQuery query = new XQuery( "fn:number(xs:dayTimeDuration(\"P02DT06H09M\") div 2.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-7 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "divide-dayTimeDuration" function used * as an argument to the "fn:string" function). * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDuration7() { final XQuery query = new XQuery( "fn:string(xs:dayTimeDuration(\"P03DT04H08M\") div 2.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1DT14H4M") ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-8 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "divide-dayTimeDuration" function that * returns a negative value. * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDuration8() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P10DT01H01M\") div -2.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P5DT30M30S") ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-9 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "divide-dayTimeDuration" function used * together with and "and" expression. * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDuration9() { final XQuery query = new XQuery( "fn:string((xs:dayTimeDuration(\"P01DT02H01M\") div 2.0)) and fn:string((xs:dayTimeDuration(\"P02DT03H03M\") div 2.0 ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:divide-dayTimeDuration" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(lower bound) * $arg2 = xs:double(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDuration2args1() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") div xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:divide-dayTimeDuration" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(mid range) * $arg2 = xs:double(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDuration2args2() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P15DT11H59M59S\") div xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:divide-dayTimeDuration" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(upper bound) * $arg2 = xs:double(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDuration2args3() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P31DT23H59M59S\") div xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:divide-dayTimeDuration" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(lower bound) * $arg2 = xs:double(mid range) * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDuration2args4() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") div xs:double(\"0.1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:divide-dayTimeDuration" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(lower bound) * $arg2 = xs:double(upper bound) * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDuration2args5() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") div xs:double(\"1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } } OpDivideDayTimeDurationByDayTimeDuration.java000066400000000000000000000543371222453003200346630ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/oppackage org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the divide-dayTimeDuration-by-dayTimeDuration() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpDivideDayTimeDurationByDayTimeDuration extends QT3TestSet { /** * * ******************************************************* * Test: K-DayTimeDurationDivideDTD-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of dividing a xs:dayTimeDuration with xs:dayTimeDuration. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationDivideDTD1() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"PT8M\") div xs:dayTimeDuration(\"PT2M\")) eq 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test division of xs:dayTimeDuration by zero . */ @org.junit.Test public void cbclDivideDayTimeDurationByDayTimeDuration001() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P9223372036854775807D\") div xs:dayTimeDuration(\"P0D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FOAR0001") || error("FODT0002") ) ); } /** * test division of xs:dayTimeDuration by a small duration . */ @org.junit.Test public void cbclDivideDayTimeDurationByDayTimeDuration002() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P9223372036854775807D\") div xs:dayTimeDuration(\"P0DT0H0M0.000000001S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FOAR0002") || error("FODT0002") ) ); } /** * test division of xs:dayTimeDuration by a small duration . */ @org.junit.Test public void cbclDivideDayTimeDurationByDayTimeDuration003() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P9223372036854775806D\") div xs:dayTimeDuration(\"P4611686018427387903D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("2") || error("FODT0002") ) ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-by-dTD-1 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-dayTimeDuration-by-DTD" operator * As per example 1 (for this function)of the F&O specs. * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDurationByDTD1() { final XQuery query = new XQuery( "fn:round-half-to-even((xs:dayTimeDuration(\"P2DT53M11S\") div xs:dayTimeDuration(\"P1DT10H\")),15)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1.437834967320261") || assertEq("1.4378349673") ) ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-by-dTD-10 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-dayTimeDuration-by-dTD" operator used * together with an "or" expression. * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDurationByDTD10() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P05DT09H02M\") div xs:dayTimeDuration(\"P03DT01H04M\")) or (xs:dayTimeDuration(\"P05DT05H03M\") div xs:dayTimeDuration(\"P01DT01H03M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-by-dTD-11 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-dayTimeDuration-by-dTD" operator used * together with multiple "div" expressions. * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDurationByDTD11() { final XQuery query = new XQuery( "fn:round-half-to-even( (xs:dayTimeDuration(\"P42DT10H10M\") div xs:dayTimeDuration(\"P10DT10H10M\")) div (xs:dayTimeDuration(\"P20DT10H10M\") div xs:dayTimeDuration(\"P18DT10H10M\")) ,15)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3.671399617754547") ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-by-dTD-12 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-dayTimeDuration-by-dTD" operators used * with a boolean expression and the "fn:true" function. * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDurationByDTD12() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P10DT08H11M\") div xs:dayTimeDuration(\"P05DT08H11M\")) and (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-by-dTD-13 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-dayTimeDuration-by-dTD" operator used * together with the numeric-equal-operator "eq". * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDurationByDTD13() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P23DT11H11M\") div xs:dayTimeDuration(\"P23DT11H11M\")) eq xs:decimal(2.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-by-dTD-14 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-dayTimeDuration-by-dTD" operator used * together with the numeric-equal operator "ne". * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDurationByDTD14() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P21DT08H12M\") div xs:dayTimeDuration(\"P08DT08H05M\")) ne xs:decimal(2.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-by-dTD-15 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-dayTimeDuration-by-DTD" function used * together with the numeric-equal operator "le". * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDurationByDTD15() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P10DT10H01M\") div xs:dayTimeDuration(\"P17DT10H02M\")) le xs:decimal(2.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-by-dTD-16 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-dayTimeDuration-by-dTD" operator used * together with the numeric-equal operator "ge". * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDurationByDTD16() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P13DT09H09M\") div xs:dayTimeDuration(\"P18DT02H02M\")) ge xs:decimal(2.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-by-dTD-2 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-dayTimeDuration-by-dTD" operator * used as part of a boolean expression (and operator) and the "fn:false" function. * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDurationByDTD2() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P10DT10H11M\") div xs:dayTimeDuration(\"P12DT10H07M\") and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-by-dTD-3 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-dayTimeDuration-by-dTD" operator as * part of a boolean expression (or operator) and the "fn:boolean" function. * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDurationByDTD3() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P20DT20H10M\") div xs:dayTimeDuration(\"P19DT13H10M\") or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-by-dTD-4 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-dayTimeDuration-by-dTD" operator that * return true and used together with fn:not. * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDurationByDTD4() { final XQuery query = new XQuery( "fn:not(xs:dayTimeDuration(\"P11DT12H04M\") div xs:dayTimeDuration(\"P02DT07H01M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-by-dTD-5 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-dayTimeDuration-by-dTD" operator that * is used as an argument to the fn:boolean function. * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDurationByDTD5() { final XQuery query = new XQuery( "fn:boolean(xs:dayTimeDuration(\"P05DT09H08M\") div xs:dayTimeDuration(\"P03DT08H06M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-by-dTD-6 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-dayTimeDuration-by-dTD" operator that * is used as an argument to the fn:number function. * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDurationByDTD6() { final XQuery query = new XQuery( "fn:number(xs:dayTimeDuration(\"P02DT06H09M\") div xs:dayTimeDuration(\"P02DT06H09M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-by-dTD-7 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-dayTimeDuration-by-dTD" operator used * as an argument to the "fn:string" function. * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDurationByDTD7() { final XQuery query = new XQuery( "fn:string(xs:dayTimeDuration(\"P08DT06H08M\") div xs:dayTimeDuration(\"P08DT06H08M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"1\"") ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-by-dTD-8 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-dayTimeDuration-by-dTD" operator that * returns a negative value. * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDurationByDTD8() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P10DT01H01M\") div xs:dayTimeDuration(\"-P10DT01H01M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-by-dTD-9 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-dayTimeDuration-by-dTD" duration used * together with and "and" expression. * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDurationByDTD9() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P01DT02H01M\") div xs:dayTimeDuration(\"P02DT09H02M\")) and (xs:dayTimeDuration(\"P01DT02H01M\") div xs:dayTimeDuration(\"P02DT09H02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-by-dayTimeDuration2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:divide-dayTimeDuration-by-dayTimeDuration" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(lower bound) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDurationByDayTimeDuration2args1() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") div xs:dayTimeDuration(\"P0DT0H0M01S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-by-dayTimeDuration2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:divide-dayTimeDuration-by-dayTimeDuration" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(mid range) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDurationByDayTimeDuration2args2() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P15DT11H59M59S\") div xs:dayTimeDuration(\"P0DT0H0M01S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1339199") ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-by-dayTimeDuration2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:divide-dayTimeDuration-by-dayTimeDuration" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(upper bound) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDurationByDayTimeDuration2args3() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P31DT23H59M59S\") div xs:dayTimeDuration(\"P0DT0H0M01S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2764799") ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-by-dayTimeDuration2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:divide-dayTimeDuration-by-dayTimeDuration" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(lower bound) * $arg2 = xs:dayTimeDuration(mid range) * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDurationByDayTimeDuration2args4() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") div xs:dayTimeDuration(\"P15DT11H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * * ******************************************************* * Test: op-divide-dayTimeDuration-by-dayTimeDuration2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:divide-dayTimeDuration-by-dayTimeDuration" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(lower bound) * $arg2 = xs:dayTimeDuration(upper bound) * ******************************************************* * . */ @org.junit.Test public void opDivideDayTimeDurationByDayTimeDuration2args5() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") div xs:dayTimeDuration(\"P31DT23H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpDivideYearMonthDuration.java000066400000000000000000000653131222453003200320320ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the divide-yearMonthDuration() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpDivideYearMonthDuration extends QT3TestSet { /** * * ******************************************************* * Test: K-YearMonthDurationDivide-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of dividing a xs:yearMonthDuration with 3. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationDivide1() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P3Y36M\") div 3 eq xs:yearMonthDuration(\"P2Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-YearMonthDurationDivide-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of dividing a xs:yearMonthDuration with xs:double('-INF'). * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationDivide2() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P3Y36M\") div xs:double(\"-INF\") eq xs:yearMonthDuration(\"P0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-YearMonthDurationDivide-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of dividing a xs:yearMonthDuration with xs:double('INF'). * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationDivide3() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P3Y36M\") div xs:double(\"INF\") eq xs:yearMonthDuration(\"P0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-YearMonthDurationDivide-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of dividing a xs:yearMonthDuration with 0. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationDivide4() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P3Y36M\") div 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * * ******************************************************* * Test: K-YearMonthDurationDivide-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of dividing a xs:yearMonthDuration with NaN. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationDivide5() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P3Y36M\") div xs:double(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0005") ); } /** * * ******************************************************* * Test: K-YearMonthDurationDivide-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of dividing a xs:yearMonthDuration with xs:double('-0'). * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationDivide6() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P3Y36M\") div xs:double(\"-0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * test division of xs:yearMonthDuration by 0 . */ @org.junit.Test public void cbclDivideYearMonthDuration001() { final XQuery query = new XQuery( "\n" + " declare function local:yearMonthDuration($years as xs:integer) as xs:yearMonthDuration { xs:yearMonthDuration(concat(\"P\", $years, \"Y\")) };\n" + " local:yearMonthDuration(2) div 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * test division of xs:yearMonthDuration by 1 . */ @org.junit.Test public void cbclDivideYearMonthDuration002() { final XQuery query = new XQuery( "\n" + " declare function local:yearMonthDuration($years as xs:integer) as xs:yearMonthDuration { xs:yearMonthDuration(concat(\"P\", $years, \"Y\")) };\n" + " local:yearMonthDuration(2) div 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P2Y") ); } /** * test possible overflow in division of xs:yearMonthDuration . */ @org.junit.Test public void cbclDivideYearMonthDuration003() { final XQuery query = new XQuery( "\n" + " declare function local:yearMonthDuration($years as xs:integer) as xs:yearMonthDuration { xs:yearMonthDuration(concat(\"P\", $years, \"Y\")) };\n" + " local:yearMonthDuration(768614336404564650) div 0.5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-1 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration" operator * As per example 1 (for this function)of the F&O specs. * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDuration1() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P2Y11M\") div 1.5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1Y11M") ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-10 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration" opeartor used * together with an "or" expression. * Apply "fn:string" function to account for new EBV. * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDuration10() { final XQuery query = new XQuery( "fn:string((xs:yearMonthDuration(\"P05Y02M\") div 2.0)) or fn:string((xs:yearMonthDuration(\"P05Y03M\") div 2.0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-11 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration" operator used * together with a multiple "div" expressions. * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDuration11() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P20Y11M\") div 2.0) div (xs:yearMonthDuration(\"P20Y11M\") div 2.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-12 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration" operators used * with a boolean expression and the "fn:true" function. * Apply "fn:string" function to account for new EBV. * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDuration12() { final XQuery query = new XQuery( "fn:string((xs:yearMonthDuration(\"P10Y11M\") div 2.0)) and (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-13 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "divide-yearMonthDuration" operator used * together with the numeric-equal- operator "eq". * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDuration13() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P23Y11M\") div 2.0) eq xs:yearMonthDuration(\"P23Y11M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-14 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration" operator used * together with the numeric-equal operator "ne". * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDuration14() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P21Y12M\") div 2.0) ne xs:yearMonthDuration(\"P08Y05M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-15 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration" operator used * together with the numeric-equal operator "le". * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDuration15() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P10Y01M\") div 2.0) le xs:yearMonthDuration(\"P17Y02M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-16 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration" operator used * together with the numeric-equal operator "ge". * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDuration16() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P13Y09M\") div 2.0) ge xs:yearMonthDuration(\"P18Y02M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-17 * Written By: Michael Kay * Date: 5 March 2009 * Purpose: Tests rounding performed by the "divide-yearMonthDuration" operator * See Erratum FO.E12 . * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDuration17() { final XQuery query = new XQuery( "for $i in (-2, -4, -10, -50, +50, +10, +4, +2) return (xs:yearMonthDuration(\"P5M\") div $i)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P2M -P1M P0M P0M P0M P1M P1M P3M") ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-2 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration" operator * used as part of a boolean expression (and operator) and the "fn:false" function. * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDuration2() { final XQuery query = new XQuery( "fn:string((xs:yearMonthDuration(\"P10Y11M\") div 2.0)) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-3 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration" operator as * part of a boolean expression (or operator) and the "fn:boolean" function. * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDuration3() { final XQuery query = new XQuery( "fn:string((xs:yearMonthDuration(\"P20Y10M\") div 2.0)) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-4 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration" operator that * return true and used together with fn:not. * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDuration4() { final XQuery query = new XQuery( "fn:not(fn:string(xs:yearMonthDuration(\"P11Y04M\") div 2.0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-5 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration" operator that * is used as an argument to the fn:boolean function. * Apply "fn:string" function to account for new EBV. * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDuration5() { final XQuery query = new XQuery( "fn:boolean(fn:string(xs:yearMonthDuration(\"P05Y08M\") div 2.0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-6 * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration" operator that * is used as an argument to the fn:number function. * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDuration6() { final XQuery query = new XQuery( "fn:number(xs:yearMonthDuration(\"P02Y09M\") div 2.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-7 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration" operator used * as an argument to the "fn:string" function). * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDuration7() { final XQuery query = new XQuery( "fn:string(xs:yearMonthDuration(\"P03Y08M\") div 2.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1Y10M") ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-8 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration" operator that * returns a negative value. * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDuration8() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P10Y01M\") div -2.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P5Y") ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-9 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration" operator used * together with and "and" expression. * Apply "fn:string" function to account for new EBV. * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDuration9() { final XQuery query = new XQuery( "fn:string((xs:yearMonthDuration(\"P01Y01M\") div 2.0)) and fn:string((xs:yearMonthDuration(\"P02Y03M\") div 2.0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:divide-yearMonthDuration" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(lower bound) * $arg2 = xs:double(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDuration2args1() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") div xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P0M") ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:divide-yearMonthDuration" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(mid range) * $arg2 = xs:double(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDuration2args2() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1000Y6M\") div xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P0M") ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:divide-yearMonthDuration" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(upper bound) * $arg2 = xs:double(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDuration2args3() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P2030Y12M\") div xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P0M") ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:divide-yearMonthDuration" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(lower bound) * $arg2 = xs:double(mid range) * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDuration2args4() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") div xs:double(\"0.1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P0M") ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:divide-yearMonthDuration" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(lower bound) * $arg2 = xs:double(upper bound) * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDuration2args5() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") div xs:double(\"1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P0M") ); } } OpDivideYearMonthDurationByYearMonthDuration.java000066400000000000000000000517251222453003200356050ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/oppackage org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the divide-yearMonthDuration-by-yearMonthDuration() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpDivideYearMonthDurationByYearMonthDuration extends QT3TestSet { /** * * ******************************************************* * Test: K-YearMonthDurationDivideYMD-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of dividing a xs:yearMonthDuration with xs:yearMonthDuration. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationDivideYMD1() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P3Y36M\") div xs:yearMonthDuration(\"P60Y\") eq 0.1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test division of xs:yearMonthDuration by 0 . */ @org.junit.Test public void cbclDivideYearMonthDurationByYearMonthDuration001() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P2Y\") div xs:yearMonthDuration(\"P0Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-by-YMD-1 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration-by-YMD" operator * As per example 1 (for this function)of the F&O specs. * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDurationByYMD1() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P3Y4M\") div xs:yearMonthDuration(\"-P1Y4M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2.5") ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-by-YMD-10 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration-by-YMD" operator used * together with an "or" expression. * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDurationByYMD10() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P05Y02M\") div xs:yearMonthDuration(\"P03Y04M\")) or (xs:yearMonthDuration(\"P05Y03M\") div xs:yearMonthDuration(\"P01Y03M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-by-YMD-11 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration-by-YMD" operator used * together with multiple "div" expressions. * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDurationByYMD11() { final XQuery query = new XQuery( "round-half-to-even( (xs:yearMonthDuration(\"P42Y10M\") div xs:yearMonthDuration(\"P20Y10M\")) div (xs:yearMonthDuration(\"P20Y11M\") div xs:yearMonthDuration(\"P18Y11M\")), 15)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.859410358565737") ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-by-YMD-12 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration-by-YMD" operator used * with a boolean expression and the "fn:true" function. * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDurationByYMD12() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P10Y11M\") div xs:yearMonthDuration(\"P05Y07M\")) and (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-by-YMD-13 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration-by-YMD" operator used * together with the numeric-equal- operator "eq". * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDurationByYMD13() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P23Y11M\") div xs:yearMonthDuration(\"P23Y11M\")) eq xs:decimal(2.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-by-YMD-14 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration-by-YMD" operator used * together with the numeric-equal operator "ne". * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDurationByYMD14() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P21Y12M\") div xs:yearMonthDuration(\"P08Y05M\")) ne xs:decimal(2.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-by-YMD-15 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration-by-YMD" operator used * together with the numeric-equal operator "le". * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDurationByYMD15() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P10Y01M\") div xs:yearMonthDuration(\"P17Y02M\")) le xs:decimal(2.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-by-YMD-16 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration-by-YMD" operator used * together with the numeric-equal operator "ge". * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDurationByYMD16() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P13Y09M\") div xs:yearMonthDuration(\"P18Y02M\")) ge xs:decimal(2.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-by-YMD-2 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration-by-YMD" operator * used as part of a boolean expression (and operator) and the "fn:false" function. * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDurationByYMD2() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P10Y11M\") div xs:yearMonthDuration(\"P12Y07M\") and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-by-YMD-3 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration-by-YMD" operator as * part of a boolean expression (or operator) and the "fn:boolean" function. * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDurationByYMD3() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P20Y10M\") div xs:yearMonthDuration(\"P19Y10M\") or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-by-YMD-4 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration-by-YMD" operator that * return true and used together with fn:not. * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDurationByYMD4() { final XQuery query = new XQuery( "fn:not(xs:yearMonthDuration(\"P11Y04M\") div xs:yearMonthDuration(\"P02Y11M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-by-YMD-5 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration-by-YMD" operator that * is used as an argument to the fn:boolean function. * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDurationByYMD5() { final XQuery query = new XQuery( "fn:boolean(xs:yearMonthDuration(\"P05Y08M\") div xs:yearMonthDuration(\"P03Y06M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-by-YMD-6 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration-by-YMD" operator that * is used as an argument to the fn:number function. * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDurationByYMD6() { final XQuery query = new XQuery( "fn:number(xs:yearMonthDuration(\"P02Y09M\") div xs:yearMonthDuration(\"P02Y09M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-by-YMD-7 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration-by-YMD" operator used * as an argument to the "fn:string" function). * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDurationByYMD7() { final XQuery query = new XQuery( "fn:string(xs:yearMonthDuration(\"P03Y08M\") div xs:yearMonthDuration(\"P03Y08M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"1\"") ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-by-YMD-8 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration-by-YMD" operator that * returns a negative value. * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDurationByYMD8() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P10Y01M\") div xs:yearMonthDuration(\"-P10Y01M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-by-YMD-9 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "divide-yearMonthDuration-by-YMD" operator used * together with and "and" expression. * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDurationByYMD9() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P01Y01M\") div xs:yearMonthDuration(\"P02Y02M\")) and (xs:yearMonthDuration(\"P02Y03M\") div xs:yearMonthDuration(\"P04Y04M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-by-yearMonthDuration2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:divide-yearMonthDuration-by-yearMonthDuration" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(lower bound) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDurationByYearMonthDuration2args1() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") div xs:yearMonthDuration(\"P0Y1M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-by-yearMonthDuration2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:divide-yearMonthDuration-by-yearMonthDuration" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(mid range) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDurationByYearMonthDuration2args2() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1000Y6M\") div xs:yearMonthDuration(\"P0Y1M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("12006") ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-by-yearMonthDuration2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:divide-yearMonthDuration-by-yearMonthDuration" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(upper bound) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDurationByYearMonthDuration2args3() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P2030Y12M\") div xs:yearMonthDuration(\"P0Y1M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("24372") ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-by-yearMonthDuration2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:divide-yearMonthDuration-by-yearMonthDuration" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(lower bound) * $arg2 = xs:yearMonthDuration(mid range) * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDurationByYearMonthDuration2args4() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") div xs:yearMonthDuration(\"P1000Y6M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * * ******************************************************* * Test: op-divide-yearMonthDuration-by-yearMonthDuration2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:divide-yearMonthDuration-by-yearMonthDuration" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(lower bound) * $arg2 = xs:yearMonthDuration(upper bound) * ******************************************************* * . */ @org.junit.Test public void opDivideYearMonthDurationByYearMonthDuration2args5() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") div xs:yearMonthDuration(\"P2030Y12M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpDurationEqual.java000066400000000000000000002471321222453003200300470ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the duration-equal operator. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpDurationEqual extends QT3TestSet { /** * Simple test of 'eq' for xs:dayTimeDuration, returning positive. . */ @org.junit.Test public void kDayTimeDurationEQ1() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT08H34M12.143S\") eq xs:dayTimeDuration(\"P3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Testing 'eq' involving xs:dayTimeDuration with two zeroed values. . */ @org.junit.Test public void kDayTimeDurationEQ2() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"PT0S\") eq xs:dayTimeDuration(\"PT0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of 'eq' for xs:dayTimeDuration. . */ @org.junit.Test public void kDayTimeDurationEQ3() { final XQuery query = new XQuery( "not(xs:dayTimeDuration(\"P3DT08H34M12.043S\") eq xs:dayTimeDuration(\"P3DT08H34M12.143S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of 'ne' for xs:dayTimeDuration. . */ @org.junit.Test public void kDayTimeDurationEQ4() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"PT08H34M12.143S\") ne xs:dayTimeDuration(\"P3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of 'ne' for xs:dayTimeDuration. . */ @org.junit.Test public void kDayTimeDurationEQ5() { final XQuery query = new XQuery( "not(xs:dayTimeDuration(\"P3DT08H34M12.143S\") ne xs:dayTimeDuration(\"P3DT08H34M12.143S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The xs:dayTimeDuration values -PT0S and PT0S are equal. . */ @org.junit.Test public void kDayTimeDurationEQ6() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"-PT0S\") eq xs:dayTimeDuration(\"PT0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The xs:dayTimeDuration values -P2DT5H and P2DT5H are not equal. . */ @org.junit.Test public void kDayTimeDurationEQ7() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"-P2DT5H\") ne xs:dayTimeDuration(\"P2DT5H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test eq operator for xs:dayTimeDuration values with large milli second component. . */ @org.junit.Test public void kDayTimeDurationEQ8() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P6DT16H34M59.613999S\") eq xs:dayTimeDuration(\"P6DT16H34M59.613999S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of 'eq' for xs:duration, returning positive. . */ @org.junit.Test public void kDurationEQ1() { final XQuery query = new XQuery( "xs:duration(\"P1999Y10M3DT08H34M12.143S\") eq xs:duration(\"P1999Y10M3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The xs:duration values -P1Y3M4DT08H4M33S and P1Y3M4DT08H4M33S are not equal. . */ @org.junit.Test public void kDurationEQ10() { final XQuery query = new XQuery( "xs:duration(\"-P1Y3M4DT08H4M33S\") ne xs:duration(\"P1Y3M4DT08H4M33S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The 'lt' operator is not available between xs:duration and xs:duration. . */ @org.junit.Test public void kDurationEQ11() { final XQuery query = new XQuery( "xs:duration(\"P1999Y10M3DT08H34M12.142S\") lt xs:duration(\"P1999Y10M3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The 'le' operator is not available between xs:duration and xs:duration. . */ @org.junit.Test public void kDurationEQ12() { final XQuery query = new XQuery( "xs:duration(\"P1999Y10M3DT08H34M12.143S\") le xs:duration(\"P1999Y10M3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The 'gt' operator is not available between xs:duration and xs:duration. . */ @org.junit.Test public void kDurationEQ13() { final XQuery query = new XQuery( "xs:duration(\"P1999Y10M3DT08H34M12.144S\") gt xs:duration(\"P1999Y10M3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The 'ge' operator is not available between xs:duration and xs:duration. . */ @org.junit.Test public void kDurationEQ14() { final XQuery query = new XQuery( "xs:duration(\"P1999Y10M3DT08H34M12.143S\") ge xs:duration(\"P1999Y10M3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Simple test of 'eq' for xs:dayTimeDuration with xs:duration on the left hand. Both values are zero. . */ @org.junit.Test public void kDurationEQ15() { final XQuery query = new XQuery( "xs:duration(\"PT0S\") eq xs:dayTimeDuration(\"PT0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of 'eq' for xs:dayTimeDuration with xs:duration on the right hand. Both values are zero. . */ @org.junit.Test public void kDurationEQ16() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"PT0S\") eq xs:duration(\"PT0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of 'eq' for xs:yearMonthDuration with xs:duration on the right hand. Both values are zero. . */ @org.junit.Test public void kDurationEQ17() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0M\") eq xs:duration(\"PT0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of 'eq' for xs:dayTimeDuration with xs:duration on the left hand. Both values are zero. . */ @org.junit.Test public void kDurationEQ18() { final XQuery query = new XQuery( "xs:duration(\"PT0S\") eq xs:yearMonthDuration(\"P0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of 'eq' for xs:yearMonthDuration with xs:dayTimeDuration on the right hand. Both values are zero. . */ @org.junit.Test public void kDurationEQ19() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0M\") eq xs:dayTimeDuration(\"PT0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Testing 'eq' involving xs:duration with two zeroed values. . */ @org.junit.Test public void kDurationEQ2() { final XQuery query = new XQuery( "xs:duration(\"PT0S\") eq xs:duration(\"PT0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of 'eq' for xs:dayTimeDuration with xs:dayTimeDuration on the left hand. Both values are zero. . */ @org.junit.Test public void kDurationEQ20() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"PT0S\") eq xs:yearMonthDuration(\"P0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of 'eq' for xs:dayTimeDuration with xs:duration on the left hand. . */ @org.junit.Test public void kDurationEQ21() { final XQuery query = new XQuery( "xs:duration(\"P1DT2H\") eq xs:dayTimeDuration(\"P1DT2H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of 'eq' for xs:dayTimeDuration with xs:duration on the right hand. . */ @org.junit.Test public void kDurationEQ22() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P1DT2H\") eq xs:duration(\"P1DT2H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of 'ne' for xs:dayTimeDuration with xs:duration on the left hand. . */ @org.junit.Test public void kDurationEQ23() { final XQuery query = new XQuery( "xs:duration(\"P1M1DT2H\") ne xs:dayTimeDuration(\"P1DT2H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of 'ne' for xs:dayTimeDuration with xs:duration on the left hand. . */ @org.junit.Test public void kDurationEQ24() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P1DT2H\") ne xs:duration(\"P1M1DT2H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of 'eq' for xs:yearMonthDuration with xs:dayTimeDuration on the left hand. . */ @org.junit.Test public void kDurationEQ25() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0M\") eq xs:dayTimeDuration(\"PT0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of 'eq' for xs:dayTimeDuration with xs:yearMonthDuration on the right hand. . */ @org.junit.Test public void kDurationEQ26() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"PT0S\") eq xs:yearMonthDuration(\"P0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of 'eq' for xs:yearMonthDuration with xs:duration on the right hand. . */ @org.junit.Test public void kDurationEQ27() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") eq xs:duration(\"P1Y12M0D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of 'eq' for xs:dayTimeDuration with xs:duration on the left hand. . */ @org.junit.Test public void kDurationEQ28() { final XQuery query = new XQuery( "xs:duration(\"P1Y12M0D\") eq xs:yearMonthDuration(\"P1Y12M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test comparing xs:duration and xs:yearMonthDuration stressing value representations are normalized properly. . */ @org.junit.Test public void kDurationEQ29() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1M\") ne xs:duration(\"P31D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of 'eq' for xs:duration. . */ @org.junit.Test public void kDurationEQ3() { final XQuery query = new XQuery( "not(xs:duration(\"P1999Y10M3DT08H34M12.043S\") eq xs:duration(\"P1999Y10M3DT08H34M12.143S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test comparing xs:duration and xs:yearMonthDuration stressing value representations are normalized properly(with operand order switched). . */ @org.junit.Test public void kDurationEQ30() { final XQuery query = new XQuery( "xs:duration(\"P31D\") ne xs:yearMonthDuration(\"P1M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test comparing xs:dayTimeDuration and xs:yearMonthDuration stressing value representations are normalized properly. . */ @org.junit.Test public void kDurationEQ31() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1M\") ne xs:dayTimeDuration(\"P31D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test comparing xs:dayTimeDuration and xs:yearMonthDuration stressing value representations are normalized properly(with operand order switched). . */ @org.junit.Test public void kDurationEQ32() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P31D\") ne xs:yearMonthDuration(\"P1M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The 'ge' operator is not available between xs:duration and xs:dayTimeDuration. . */ @org.junit.Test public void kDurationEQ33() { final XQuery query = new XQuery( "xs:duration(\"P1999Y10M3DT08H34M12.143S\") ge xs:dayTimeDuration(\"P3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The 'gt' operator is not available between xs:duration and xs:dayTimeDuration. . */ @org.junit.Test public void kDurationEQ34() { final XQuery query = new XQuery( "xs:duration(\"P1999Y10M3DT08H34M12.143S\") gt xs:dayTimeDuration(\"P3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The 'lt' operator is not available between xs:duration and xs:dayTimeDuration. . */ @org.junit.Test public void kDurationEQ35() { final XQuery query = new XQuery( "xs:duration(\"P1999Y10M3DT08H34M12.143S\") lt xs:dayTimeDuration(\"P3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The 'le' operator is not available between xs:duration and xs:dayTimeDuration. . */ @org.junit.Test public void kDurationEQ36() { final XQuery query = new XQuery( "xs:duration(\"P1999Y10M3DT08H34M12.143S\") le xs:dayTimeDuration(\"P3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The 'ge' operator is not available between xs:duration and xs:dayTimeDuration(reversed operand order). . */ @org.junit.Test public void kDurationEQ37() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT08H34M12.143S\") ge xs:duration(\"P1999Y10M3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The 'gt' operator is not available between xs:duration and xs:dayTimeDuration(reversed operand order). . */ @org.junit.Test public void kDurationEQ38() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT08H34M12.143S\") gt xs:duration(\"P1999Y10M3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The 'lt' operator is not available between xs:duration and xs:dayTimeDuration(reversed operand order). . */ @org.junit.Test public void kDurationEQ39() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT08H34M12.143S\") lt xs:duration(\"P1999Y10M3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Simple test of 'ne' for xs:duration. . */ @org.junit.Test public void kDurationEQ4() { final XQuery query = new XQuery( "xs:duration(\"P1999Y01M3DT08H34M12.143S\") ne xs:duration(\"P1999Y10M3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The 'le' operator is not available between xs:duration and xs:dayTimeDuration(reversed operand order). . */ @org.junit.Test public void kDurationEQ40() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT08H34M12.143S\") le xs:duration(\"P1999Y10M3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The 'ge' operator is not available between xs:yearMonthDuration and xs:dayTimeDuration. . */ @org.junit.Test public void kDurationEQ41() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1999Y10M\") ge xs:dayTimeDuration(\"P3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The 'gt' operator is not available between xs:yearMonthDuration and xs:dayTimeDuration. . */ @org.junit.Test public void kDurationEQ42() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1999Y10M\") gt xs:dayTimeDuration(\"P3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The 'lt' operator is not available between xs:yearMonthDuration and xs:dayTimeDuration. . */ @org.junit.Test public void kDurationEQ43() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1999Y10M\") lt xs:dayTimeDuration(\"P3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The 'le' operator is not available between xs:yearMonthDuration and xs:dayTimeDuration. . */ @org.junit.Test public void kDurationEQ44() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1999Y10M\") le xs:dayTimeDuration(\"P3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The 'ge' operator is not available between xs:yearMonthDuration and xs:dayTimeDuration(reversed operand order). . */ @org.junit.Test public void kDurationEQ45() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT08H34M12.143S\") ge xs:yearMonthDuration(\"P1999Y10M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The 'gt' operator is not available between xs:yearMonthDuration and xs:dayTimeDuration(reversed operand order). . */ @org.junit.Test public void kDurationEQ46() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT08H34M12.143S\") gt xs:yearMonthDuration(\"P1999Y10M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The 'lt' operator is not available between xs:yearMonthDuration and xs:dayTimeDuration(reversed operand order). . */ @org.junit.Test public void kDurationEQ47() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT08H34M12.143S\") lt xs:yearMonthDuration(\"P1999Y10M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The 'le' operator is not available between xs:yearMonthDuration and xs:dayTimeDuration(reversed operand order). . */ @org.junit.Test public void kDurationEQ48() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT08H34M12.143S\") le xs:yearMonthDuration(\"P1999Y10M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The 'ge' operator is not available between xs:yearMonthDuration and xs:duration. . */ @org.junit.Test public void kDurationEQ49() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1999Y10M\") ge xs:duration(\"P3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Simple test of 'ne' for xs:duration. . */ @org.junit.Test public void kDurationEQ5() { final XQuery query = new XQuery( "not(xs:duration(\"P1999Y10M3DT08H34M12.143S\") ne xs:duration(\"P1999Y10M3DT08H34M12.143S\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The 'gt' operator is not available between xs:yearMonthDuration and xs:duration. . */ @org.junit.Test public void kDurationEQ50() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1999Y10M\") gt xs:duration(\"P3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The 'lt' operator is not available between xs:yearMonthDuration and xs:duration. . */ @org.junit.Test public void kDurationEQ51() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1999Y10M\") lt xs:duration(\"P3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The 'le' operator is not available between xs:yearMonthDuration and xs:duration. . */ @org.junit.Test public void kDurationEQ52() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1999Y10M\") le xs:duration(\"P3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The 'ge' operator is not available between xs:yearMonthDuration and xs:duration(reversed operand order). . */ @org.junit.Test public void kDurationEQ53() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1999Y10M\") ge xs:duration(\"P3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The 'gt' operator is not available between xs:yearMonthDuration and xs:duration(reversed operand order). . */ @org.junit.Test public void kDurationEQ54() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1999Y10M\") gt xs:duration(\"P3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The 'lt' operator is not available between xs:yearMonthDuration and xs:duration(reversed operand order). . */ @org.junit.Test public void kDurationEQ55() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1999Y10M\") lt xs:duration(\"P3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The 'le' operator is not available between xs:yearMonthDuration and xs:duration(reversed operand order). . */ @org.junit.Test public void kDurationEQ56() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1999Y10M\") le xs:duration(\"P3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The 'ge' operator is not available between xs:yearMonthDuration and xs:duration(reversed operand order)(reversed operand order). . */ @org.junit.Test public void kDurationEQ57() { final XQuery query = new XQuery( "xs:duration(\"P3DT08H34M12.143S\") ge xs:yearMonthDuration(\"P1999Y10M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The 'gt' operator is not available between xs:yearMonthDuration and xs:duration(reversed operand order)(reversed operand order). . */ @org.junit.Test public void kDurationEQ58() { final XQuery query = new XQuery( "xs:duration(\"P3DT08H34M12.143S\") gt xs:yearMonthDuration(\"P1999Y10M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The 'lt' operator is not available between xs:yearMonthDuration and xs:duration(reversed operand order)(reversed operand order). . */ @org.junit.Test public void kDurationEQ59() { final XQuery query = new XQuery( "xs:duration(\"P3DT08H34M12.143S\") lt xs:yearMonthDuration(\"P1999Y10M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The xs:duration values P365D and P1Y are not equal. . */ @org.junit.Test public void kDurationEQ6() { final XQuery query = new XQuery( "xs:duration(\"P1Y\") ne xs:duration(\"P365D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The 'le' operator is not available between xs:yearMonthDuration and xs:duration(reversed operand order)(reversed operand order). . */ @org.junit.Test public void kDurationEQ60() { final XQuery query = new XQuery( "xs:duration(\"P3DT08H34M12.143S\") le xs:yearMonthDuration(\"P1999Y10M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The xs:duration values P12M and P1Y are equal. . */ @org.junit.Test public void kDurationEQ7() { final XQuery query = new XQuery( "xs:duration(\"P1Y\") eq xs:duration(\"P12M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The xs:duration values P1M and P31D are not equal. . */ @org.junit.Test public void kDurationEQ8() { final XQuery query = new XQuery( "xs:duration(\"P1M\") ne xs:duration(\"P31D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The xs:duration values -PT0S and PT0S are equal. . */ @org.junit.Test public void kDurationEQ9() { final XQuery query = new XQuery( "xs:duration(\"-PT0S\") eq xs:duration(\"PT0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of 'eq' for xs:yearMonthDuration, returning positive. . */ @org.junit.Test public void kYearMonthDurationEQ1() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1999Y10M\") eq xs:yearMonthDuration(\"P1999Y10M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Testing 'eq' involving xs:yearMonthDuration with two zeroed values. . */ @org.junit.Test public void kYearMonthDurationEQ2() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0M\") eq xs:yearMonthDuration(\"P0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of 'eq' for xs:yearMonthDuration. . */ @org.junit.Test public void kYearMonthDurationEQ3() { final XQuery query = new XQuery( "not(xs:yearMonthDuration(\"P1999Y\") eq xs:yearMonthDuration(\"P1999Y10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of 'ne' for xs:yearMonthDuration.. */ @org.junit.Test public void kYearMonthDurationEQ4() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1999Y01M\") ne xs:yearMonthDuration(\"P1999Y10M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of 'ne' for xs:yearMonthDuration. . */ @org.junit.Test public void kYearMonthDurationEQ5() { final XQuery query = new XQuery( "not(xs:yearMonthDuration(\"P1999Y10M\") ne xs:yearMonthDuration(\"P1999Y10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The xs:yearMonthDuration values -P0M and P0M are equal. . */ @org.junit.Test public void kYearMonthDurationEQ6() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"-P3Y8M\") ne xs:yearMonthDuration(\"P3Y8M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The xs:yearMonthDuration values -P3Y8M and +P3Y8M are not equal. . */ @org.junit.Test public void kYearMonthDurationEQ7() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"-P3Y8M\") ne xs:yearMonthDuration(\"P3Y8M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dayTimeDurations . */ @org.junit.Test public void cbclDayTimeDurationEqual001() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($days as xs:integer, $hours as xs:integer ) { xs:dayTimeDuration(concat('P', $days, 'DT', $hours, 'H')) }; not(local:dayTimeDuration(1, 1) eq xs:dayTimeDuration(\"P0D\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dayTimeDurations . */ @org.junit.Test public void cbclDayTimeDurationEqual002() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($days as xs:integer, $hours as xs:integer ) { xs:dayTimeDuration(concat('P', $days, 'DT', $hours, 'H')) }; not(local:dayTimeDuration(1, 1) ne xs:dayTimeDuration(\"P0D\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:dayTimeDuration . */ @org.junit.Test public void cbclDayTimeDurationEqual003() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($dayTimeDuration as xs:dayTimeDuration, $null as xs:boolean) { if ($null) then () else $dayTimeDuration }; exists(local:dayTimeDuration(xs:dayTimeDuration(\"P0D\"), fn:true()) eq xs:dayTimeDuration(\"P0D\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:dayTimeDuration . */ @org.junit.Test public void cbclDayTimeDurationEqual004() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($dayTimeDuration as xs:dayTimeDuration, $null as xs:boolean) { if ($null) then () else $dayTimeDuration }; local:dayTimeDuration(xs:dayTimeDuration(\"P0D\"), fn:false()) eq xs:dayTimeDuration(\"P0D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of xs:dayTimeDuration . */ @org.junit.Test public void cbclDayTimeDurationEqual005() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($dayTimeDuration as xs:dayTimeDuration, $null as xs:boolean) { if ($null) then () else $dayTimeDuration }; exists(local:dayTimeDuration(xs:dayTimeDuration(\"P0D\"), fn:true()) ne xs:dayTimeDuration(\"P0D\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:dayTimeDuration . */ @org.junit.Test public void cbclDayTimeDurationEqual006() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($dayTimeDuration as xs:dayTimeDuration, $null as xs:boolean) { if ($null) then () else $dayTimeDuration }; local:dayTimeDuration(xs:dayTimeDuration(\"P0D\"), fn:false()) ne xs:dayTimeDuration(\"P0D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of dayTimeDurations . */ @org.junit.Test public void cbclDurationEqual001() { final XQuery query = new XQuery( "declare function local:duration($days as xs:integer, $hours as xs:integer) { xs:duration(concat('P', $days, 'DT', $hours, 'H')) }; not(local:duration(1, 1) eq xs:dayTimeDuration(\"P0D\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of dayTimeDurations . */ @org.junit.Test public void cbclDurationEqual002() { final XQuery query = new XQuery( "declare function local:duration($days as xs:integer, $hours as xs:integer) { xs:duration(concat('P', $days, 'DT', $hours, 'H')) }; not(local:duration(1, 1) ne xs:dayTimeDuration(\"P0D\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:duration . */ @org.junit.Test public void cbclDurationEqual003() { final XQuery query = new XQuery( "declare function local:duration($duration as xs:duration, $null as xs:boolean) { if ($null) then () else $duration }; exists(local:duration(xs:duration(\"P1DT1H\"), fn:true()) eq xs:duration(\"P1DT1H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:duration . */ @org.junit.Test public void cbclDurationEqual004() { final XQuery query = new XQuery( "declare function local:duration($duration as xs:duration, $null as xs:boolean) { if ($null) then () else $duration }; local:duration(xs:duration(\"P1DT1H\"), fn:false()) eq xs:duration(\"P1DT1H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of xs:duration . */ @org.junit.Test public void cbclDurationEqual005() { final XQuery query = new XQuery( "declare function local:duration($duration as xs:duration, $null as xs:boolean) { if ($null) then () else $duration }; exists(local:duration(xs:duration(\"P1DT1H\"), fn:true()) ne xs:duration(\"P1DT1H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:duration . */ @org.junit.Test public void cbclDurationEqual006() { final XQuery query = new XQuery( "declare function local:duration($duration as xs:duration, $null as xs:boolean) { if ($null) then () else $duration }; local:duration(xs:duration(\"P1DT1H\"), fn:false()) ne xs:duration(\"P1DT1H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test equality of xs:yearMonthDuration . */ @org.junit.Test public void cbclYearMonthDurationEqual001() { final XQuery query = new XQuery( "\n" + " declare function local:yearMonthDuration($years as xs:integer, $months as xs:integer ) { xs:yearMonthDuration(concat('P', $years, 'Y', $months, 'M')) };\n" + " not(local:yearMonthDuration(1, 1) eq xs:yearMonthDuration(\"P0Y\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test equality of xs:yearMonthDuration . */ @org.junit.Test public void cbclYearMonthDurationEqual002() { final XQuery query = new XQuery( "\n" + " declare function local:yearMonthDuration($years as xs:integer, $months as xs:integer ) { xs:yearMonthDuration(concat('P', $years, 'Y', $months, 'M')) };\n" + " not(local:yearMonthDuration(1, 1) ne xs:yearMonthDuration(\"P0Y\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "yearMonthDuration" and "dayTimeDuration" data types with fn:distinct function given on example. . */ @org.junit.Test public void distinctDurationEqual1() { final XQuery query = new XQuery( "fn:distinct-values((xs:yearMonthDuration('P0Y'), xs:dayTimeDuration('P0D')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "P0M") || assertStringValue(false, "PT0S") ) ); } /** * Evaluates The "yearMonthDuration" and "dayTimeDuration" data types with fn:distinct function given on example. . */ @org.junit.Test public void distinctDurationEqual2() { final XQuery query = new XQuery( "fn:distinct-values((xs:yearMonthDuration('P1Y'), xs:dayTimeDuration('P365D')))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "P1Y P365D") || assertStringValue(false, "P365D P1Y") ) ); } /** * Evaluates The "op:dayTimeDuration-equal" operator with the arguments set as follows: $arg1 = xs:dayTimeDuration(lower bound) $arg2 = xs:dayTimeDuration(lower bound) . */ @org.junit.Test public void opDayTimeDurationEqual2args1() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") eq xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:dayTimeDuration-equal" operator with the arguments set as follows: $arg1 = xs:dayTimeDuration(lower bound) $arg2 = xs:dayTimeDuration(upper bound) . */ @org.junit.Test public void opDayTimeDurationEqual2args10() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") ne xs:dayTimeDuration(\"P31DT23H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:dayTimeDuration-equal" operator (le) with the arguments set as follows: $arg1 = xs:dayTimeDuration(lower bound) $arg2 = xs:dayTimeDuration(lower bound) . */ @org.junit.Test public void opDayTimeDurationEqual2args11() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") le xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:dayTimeDuration-equal" operator (le) with the arguments set as follows: $arg1 = xs:dayTimeDuration(mid range) $arg2 = xs:dayTimeDuration(lower bound) . */ @org.junit.Test public void opDayTimeDurationEqual2args12() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P15DT11H59M59S\") le xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:dayTimeDuration-equal" operator (le) with the arguments set as follows: $arg1 = xs:dayTimeDuration(upper bound) $arg2 = xs:dayTimeDuration(lower bound) . */ @org.junit.Test public void opDayTimeDurationEqual2args13() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P31DT23H59M59S\") le xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:dayTimeDuration-equal" operator (le) with the arguments set as follows: $arg1 = xs:dayTimeDuration(lower bound) $arg2 = xs:dayTimeDuration(mid range) . */ @org.junit.Test public void opDayTimeDurationEqual2args14() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") le xs:dayTimeDuration(\"P15DT11H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:dayTimeDuration-equal" operator (le) with the arguments set as follows: $arg1 = xs:dayTimeDuration(lower bound) $arg2 = xs:dayTimeDuration(upper bound) . */ @org.junit.Test public void opDayTimeDurationEqual2args15() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") le xs:dayTimeDuration(\"P31DT23H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:dayTimeDuration-equal" operator (ge) with the arguments set as follows: $arg1 = xs:dayTimeDuration(lower bound) $arg2 = xs:dayTimeDuration(lower bound) . */ @org.junit.Test public void opDayTimeDurationEqual2args16() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") ge xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:dayTimeDuration-equal" operator (ge) with the arguments set as follows: $arg1 = xs:dayTimeDuration(mid range) $arg2 = xs:dayTimeDuration(lower bound) . */ @org.junit.Test public void opDayTimeDurationEqual2args17() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P15DT11H59M59S\") ge xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:dayTimeDuration-equal" operator (ge) with the arguments set as follows: $arg1 = xs:dayTimeDuration(upper bound) $arg2 = xs:dayTimeDuration(lower bound) . */ @org.junit.Test public void opDayTimeDurationEqual2args18() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P31DT23H59M59S\") ge xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:dayTimeDuration-equal" operator (ge) with the arguments set as follows: $arg1 = xs:dayTimeDuration(lower bound) $arg2 = xs:dayTimeDuration(mid range) . */ @org.junit.Test public void opDayTimeDurationEqual2args19() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") ge xs:dayTimeDuration(\"P15DT11H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:dayTimeDuration-equal" operator with the arguments set as follows: $arg1 = xs:dayTimeDuration(mid range) $arg2 = xs:dayTimeDuration(lower bound) . */ @org.junit.Test public void opDayTimeDurationEqual2args2() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P15DT11H59M59S\") eq xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:dayTimeDuration-equal" operator (ge) with the arguments set as follows: $arg1 = xs:dayTimeDuration(lower bound) $arg2 = xs:dayTimeDuration(upper bound) . */ @org.junit.Test public void opDayTimeDurationEqual2args20() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") ge xs:dayTimeDuration(\"P31DT23H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:dayTimeDuration-equal" operator with the arguments set as follows: $arg1 = xs:dayTimeDuration(upper bound) $arg2 = xs:dayTimeDuration(lower bound) . */ @org.junit.Test public void opDayTimeDurationEqual2args3() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P31DT23H59M59S\") eq xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:dayTimeDuration-equal" operator with the arguments set as follows: $arg1 = xs:dayTimeDuration(lower bound) $arg2 = xs:dayTimeDuration(mid range) . */ @org.junit.Test public void opDayTimeDurationEqual2args4() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") eq xs:dayTimeDuration(\"P15DT11H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:dayTimeDuration-equal" operator with the arguments set as follows: $arg1 = xs:dayTimeDuration(lower bound) $arg2 = xs:dayTimeDuration(upper bound) . */ @org.junit.Test public void opDayTimeDurationEqual2args5() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") eq xs:dayTimeDuration(\"P31DT23H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:dayTimeDuration-equal" operator with the arguments set as follows: $arg1 = xs:dayTimeDuration(lower bound) $arg2 = xs:dayTimeDuration(lower bound) . */ @org.junit.Test public void opDayTimeDurationEqual2args6() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") ne xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:dayTimeDuration-equal" operator with the arguments set as follows: $arg1 = xs:dayTimeDuration(mid range) $arg2 = xs:dayTimeDuration(lower bound) . */ @org.junit.Test public void opDayTimeDurationEqual2args7() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P15DT11H59M59S\") ne xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:dayTimeDuration-equal" operator with the arguments set as follows: $arg1 = xs:dayTimeDuration(upper bound) $arg2 = xs:dayTimeDuration(lower bound) . */ @org.junit.Test public void opDayTimeDurationEqual2args8() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P31DT23H59M59S\") ne xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:dayTimeDuration-equal" operator with the arguments set as follows: $arg1 = xs:dayTimeDuration(lower bound) $arg2 = xs:dayTimeDuration(mid range) . */ @org.junit.Test public void opDayTimeDurationEqual2args9() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") ne xs:dayTimeDuration(\"P15DT11H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of duration-equal operator as per example 1 for this operator from Functions and Operators specs. . */ @org.junit.Test public void opDurationEqual1() { final XQuery query = new XQuery( "xs:duration(\"P1Y\") eq xs:duration(\"P12M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of duration-equal operator with both operands set to "P365D" (uses eq operator) . */ @org.junit.Test public void opDurationEqual10() { final XQuery query = new XQuery( "xs:duration(\"P365D\") eq xs:duration(\"P365D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of duration-equal operator with both operands set to "P365D" (uses ne operator) . */ @org.junit.Test public void opDurationEqual11() { final XQuery query = new XQuery( "xs:duration(\"P365D\") ne xs:duration(\"P365D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of duration-equal operator with both operands set to "P36D" and "P39D" (uses eq operator) . */ @org.junit.Test public void opDurationEqual12() { final XQuery query = new XQuery( "xs:duration(\"P36D\") eq xs:duration(\"P39D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of duration-equal operator with both operands set to "P36D" and "P39D" (uses ne operator) . */ @org.junit.Test public void opDurationEqual13() { final XQuery query = new XQuery( "xs:duration(\"P36D\") ne xs:duration(\"P39D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of duration-equal operator with both operands set to "P36D" and used as argument to fn:not (uses eq operator) . */ @org.junit.Test public void opDurationEqual14() { final XQuery query = new XQuery( "fn:not(xs:duration(\"P36D\") eq xs:duration(\"P36D\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of duration-equal operator with both operands set to "P36D" and used as argument to fn:not (uses ne operator) . */ @org.junit.Test public void opDurationEqual15() { final XQuery query = new XQuery( "fn:not(xs:duration(\"P36D\") ne xs:duration(\"P36D\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of duration-equal operator with both operands set to "P36D" and used as argument to xs:boolean (uses eq operator) . */ @org.junit.Test public void opDurationEqual16() { final XQuery query = new XQuery( "xs:boolean(xs:duration(\"P36D\") eq xs:duration(\"P36D\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of duration-equal operator with both operands set to "P36D" and used as argument to xs:boolean (uses ne operator) . */ @org.junit.Test public void opDurationEqual17() { final XQuery query = new XQuery( "xs:boolean(xs:duration(\"P36D\") ne xs:duration(\"P36D\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of duration-equal operator as part of boolean expression "and" operator and "fn:true" function (uses eq operator) . */ @org.junit.Test public void opDurationEqual18() { final XQuery query = new XQuery( "(xs:duration(\"P36D\") eq xs:duration(\"P36D\")) and fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of duration-equal operator as part of boolean expression "and" operator and "fn:true" function (uses ne operator) . */ @org.junit.Test public void opDurationEqual19() { final XQuery query = new XQuery( "(xs:duration(\"P36D\") ne xs:duration(\"P36D\")) and fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of duration-equal operator as per example 2 for this operator from Functions and Operators specs. . */ @org.junit.Test public void opDurationEqual2() { final XQuery query = new XQuery( "xs:duration(\"PT24H\") eq xs:duration(\"P1D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of duration-equal operator as part of boolean expression "or" operator and "fn:true" function (uses eq operator) . */ @org.junit.Test public void opDurationEqual20() { final XQuery query = new XQuery( "(xs:duration(\"P36D\") eq xs:duration(\"P36D\")) or fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of duration-equal operator as part of boolean expression "or" operator and "fn:true" function (uses ne operator) . */ @org.junit.Test public void opDurationEqual21() { final XQuery query = new XQuery( "(xs:duration(\"P36D\") ne xs:duration(\"P36D\")) or fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of duration-equal operator as part of boolean expression "and" operator and "fn:false" function (uses eq operator) . */ @org.junit.Test public void opDurationEqual22() { final XQuery query = new XQuery( "(xs:duration(\"P36D\") eq xs:duration(\"P36D\")) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of duration-equal operator as part of boolean expression "and" operator and "fn:false" function (uses ne operator) . */ @org.junit.Test public void opDurationEqual23() { final XQuery query = new XQuery( "(xs:duration(\"P36D\") ne xs:duration(\"P36D\")) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of duration-equal operator as part of boolean expression "or" operator and "fn:false" function (uses eq operator) . */ @org.junit.Test public void opDurationEqual24() { final XQuery query = new XQuery( "(xs:duration(\"P36D\") eq xs:duration(\"P36D\")) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of duration-equal operator as part of boolean expression "or" operator and "fn:false" function (uses ne operator) . */ @org.junit.Test public void opDurationEqual25() { final XQuery query = new XQuery( "(xs:duration(\"P36D\") ne xs:duration(\"P36D\")) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of duration-equal operator as per example 4 for this operator from the F and O specs. . */ @org.junit.Test public void opDurationEqual26() { final XQuery query = new XQuery( "xs:yearMonthDuration('P0Y') eq xs:dayTimeDuration('P0D')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of duration-equal operator as per example 5 for this operator from the F and O specs. . */ @org.junit.Test public void opDurationEqual27() { final XQuery query = new XQuery( "xs:yearMonthDuration('P1Y') eq xs:dayTimeDuration('P365D')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of duration-equal operator as per example 3 for this operator from Functions and Operators specs. . */ @org.junit.Test public void opDurationEqual3() { final XQuery query = new XQuery( "xs:duration(\"P1Y\") eq xs:duration(\"P365D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of duration-equal operator with both operands set to "P1Y" (uses eq operator) . */ @org.junit.Test public void opDurationEqual4() { final XQuery query = new XQuery( "xs:duration(\"P1Y\") eq xs:duration(\"P1Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of duration-equal operator with both operands set to "P1Y" (uses ne operator) . */ @org.junit.Test public void opDurationEqual5() { final XQuery query = new XQuery( "xs:duration(\"P1Y\") ne xs:duration(\"P1Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of duration-equal operator with both operands set to "PT24H" (uses eq operator) . */ @org.junit.Test public void opDurationEqual6() { final XQuery query = new XQuery( "xs:duration(\"PT24H\") eq xs:duration(\"PT24H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of duration-equal operator with both operands set to "PT24H" (uses ne operator) . */ @org.junit.Test public void opDurationEqual7() { final XQuery query = new XQuery( "xs:duration(\"PT24H\") ne xs:duration(\"PT24H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of duration-equal operator with both operands set to "P12M" (uses eq operator) . */ @org.junit.Test public void opDurationEqual8() { final XQuery query = new XQuery( "xs:duration(\"P12M\") eq xs:duration(\"P12M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of duration-equal operator with both operands set to "P12M" (uses ne operator) . */ @org.junit.Test public void opDurationEqual9() { final XQuery query = new XQuery( "xs:duration(\"P12M\") ne xs:duration(\"P12M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:yearMonthDuration-equal" operator with the arguments set as follows: $arg1 = xs:yearMonthDuration(lower bound) $arg2 = xs:yearMonthDuration(lower bound) . */ @org.junit.Test public void opYearMonthDurationEqual2args1() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") eq xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:yearMonthDuration-equal" operator with the arguments set as follows: $arg1 = xs:yearMonthDuration(lower bound) $arg2 = xs:yearMonthDuration(upper bound) . */ @org.junit.Test public void opYearMonthDurationEqual2args10() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") ne xs:yearMonthDuration(\"P2030Y12M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:yearMonthDuration-equal" operator (le) with the arguments set as follows: $arg1 = xs:yearMonthDuration(lower bound) $arg2 = xs:yearMonthDuration(lower bound) . */ @org.junit.Test public void opYearMonthDurationEqual2args11() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") le xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:yearMonthDuration-equal" operator (le) with the arguments set as follows: $arg1 = xs:yearMonthDuration(mid range) $arg2 = xs:yearMonthDuration(lower bound) . */ @org.junit.Test public void opYearMonthDurationEqual2args12() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1000Y6M\") le xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:yearMonthDuration-equal" operator (le) with the arguments set as follows: $arg1 = xs:yearMonthDuration(upper bound) $arg2 = xs:yearMonthDuration(lower bound) . */ @org.junit.Test public void opYearMonthDurationEqual2args13() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P2030Y12M\") le xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:yearMonthDuration-equal" operator (le) with the arguments set as follows: $arg1 = xs:yearMonthDuration(lower bound) $arg2 = xs:yearMonthDuration(mid range) . */ @org.junit.Test public void opYearMonthDurationEqual2args14() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") le xs:yearMonthDuration(\"P1000Y6M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:yearMonthDuration-equal" operator (le) with the arguments set as follows: $arg1 = xs:yearMonthDuration(lower bound) $arg2 = xs:yearMonthDuration(upper bound) . */ @org.junit.Test public void opYearMonthDurationEqual2args15() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") le xs:yearMonthDuration(\"P2030Y12M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:yearMonthDuration-equal" operator (ge) with the arguments set as follows: $arg1 = xs:yearMonthDuration(lower bound) $arg2 = xs:yearMonthDuration(lower bound) . */ @org.junit.Test public void opYearMonthDurationEqual2args16() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") ge xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:yearMonthDuration-equal" operator (ge) with the arguments set as follows: $arg1 = xs:yearMonthDuration(mid range) $arg2 = xs:yearMonthDuration(lower bound) . */ @org.junit.Test public void opYearMonthDurationEqual2args17() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1000Y6M\") ge xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:yearMonthDuration-equal" operator (ge) with the arguments set as follows: $arg1 = xs:yearMonthDuration(upper bound) $arg2 = xs:yearMonthDuration(lower bound) . */ @org.junit.Test public void opYearMonthDurationEqual2args18() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P2030Y12M\") ge xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:yearMonthDuration-equal" operator (ge) with the arguments set as follows: $arg1 = xs:yearMonthDuration(lower bound) $arg2 = xs:yearMonthDuration(mid range) . */ @org.junit.Test public void opYearMonthDurationEqual2args19() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") ge xs:yearMonthDuration(\"P1000Y6M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:yearMonthDuration-equal" operator with the arguments set as follows: $arg1 = xs:yearMonthDuration(mid range) $arg2 = xs:yearMonthDuration(lower bound) . */ @org.junit.Test public void opYearMonthDurationEqual2args2() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1000Y6M\") eq xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:yearMonthDuration-equal" operator (ge) with the arguments set as follows: $arg1 = xs:yearMonthDuration(lower bound) $arg2 = xs:yearMonthDuration(upper bound) . */ @org.junit.Test public void opYearMonthDurationEqual2args20() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") ge xs:yearMonthDuration(\"P2030Y12M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:yearMonthDuration-equal" operator with the arguments set as follows: $arg1 = xs:yearMonthDuration(upper bound) $arg2 = xs:yearMonthDuration(lower bound) . */ @org.junit.Test public void opYearMonthDurationEqual2args3() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P2030Y12M\") eq xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:yearMonthDuration-equal" operator with the arguments set as follows: $arg1 = xs:yearMonthDuration(lower bound) $arg2 = xs:yearMonthDuration(mid range) . */ @org.junit.Test public void opYearMonthDurationEqual2args4() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") eq xs:yearMonthDuration(\"P1000Y6M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:yearMonthDuration-equal" operator with the arguments set as follows: $arg1 = xs:yearMonthDuration(lower bound) $arg2 = xs:yearMonthDuration(upper bound) . */ @org.junit.Test public void opYearMonthDurationEqual2args5() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") eq xs:yearMonthDuration(\"P2030Y12M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:yearMonthDuration-equal" operator with the arguments set as follows: $arg1 = xs:yearMonthDuration(lower bound) $arg2 = xs:yearMonthDuration(lower bound) . */ @org.junit.Test public void opYearMonthDurationEqual2args6() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") ne xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:yearMonthDuration-equal" operator with the arguments set as follows: $arg1 = xs:yearMonthDuration(mid range) $arg2 = xs:yearMonthDuration(lower bound) . */ @org.junit.Test public void opYearMonthDurationEqual2args7() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1000Y6M\") ne xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:yearMonthDuration-equal" operator with the arguments set as follows: $arg1 = xs:yearMonthDuration(upper bound) $arg2 = xs:yearMonthDuration(lower bound) . */ @org.junit.Test public void opYearMonthDurationEqual2args8() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P2030Y12M\") ne xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:yearMonthDuration-equal" operator with the arguments set as follows: $arg1 = xs:yearMonthDuration(lower bound) $arg2 = xs:yearMonthDuration(mid range) . */ @org.junit.Test public void opYearMonthDurationEqual2args9() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") ne xs:yearMonthDuration(\"P1000Y6M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpExcept.java000066400000000000000000000765201222453003200265230ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the except() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpExcept extends QT3TestSet { /** * Only nodes are allowed. . */ @org.junit.Test public void k2SeqExcept1() { final XQuery query = new XQuery( "(1, 2, 3) except (1, 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Use a node kind keyword, document, to test query parsing. . */ @org.junit.Test public void k2SeqExcept10() { final XQuery query = new XQuery( "empty(/(author except document))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, if, to test query parsing. . */ @org.junit.Test public void k2SeqExcept11() { final XQuery query = new XQuery( "empty(/(author except if))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, then, to test query parsing. . */ @org.junit.Test public void k2SeqExcept12() { final XQuery query = new XQuery( "empty(/(author except then))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, mod, to test query parsing. . */ @org.junit.Test public void k2SeqExcept13() { final XQuery query = new XQuery( "empty(/(author except mod))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, div, to test query parsing. . */ @org.junit.Test public void k2SeqExcept14() { final XQuery query = new XQuery( "empty(/(author except div))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, empty-sequence, to test query parsing. . */ @org.junit.Test public void k2SeqExcept15() { final XQuery query = new XQuery( "empty(/(author except empty-sequence))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, schema-attribute, to test query parsing. . */ @org.junit.Test public void k2SeqExcept16() { final XQuery query = new XQuery( "empty(/(author except schema-attribute))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, schema-element, to test query parsing. . */ @org.junit.Test public void k2SeqExcept17() { final XQuery query = new XQuery( "empty(/(author except schema-element))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a computed attribute constructor as right operand. . */ @org.junit.Test public void k2SeqExcept18() { final XQuery query = new XQuery( "count(/(a except attribute {\"name\"} {()}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Use a computed attribute constructor as right operand(#2). . */ @org.junit.Test public void k2SeqExcept19() { final XQuery query = new XQuery( "count(/(a except attribute name {()}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Use a node kind keyword, text, to test query parsing. . */ @org.junit.Test public void k2SeqExcept2() { final XQuery query = new XQuery( "empty(/(author except text))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a computed attribute constructor as right operand. . */ @org.junit.Test public void k2SeqExcept20() { final XQuery query = new XQuery( "count(/(a except element {\"name\"} {()}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "0") || error("XPST0005") ) ); } /** * Use a computed attribute constructor as right operand(#2). . */ @org.junit.Test public void k2SeqExcept21() { final XQuery query = new XQuery( "count(/(a except element name {()}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "0") || error("XPST0005") ) ); } /** * Use a computed attribute constructor as right operand. . */ @org.junit.Test public void k2SeqExcept22() { final XQuery query = new XQuery( "count(/(a except processing-instruction {\"name\"} {()}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Use a computed attribute constructor as right operand. . */ @org.junit.Test public void k2SeqExcept23() { final XQuery query = new XQuery( "count(/(a except processing-instruction name {}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Use a computed attribute constructor as right operand. . */ @org.junit.Test public void k2SeqExcept24() { final XQuery query = new XQuery( "count(/(a except comment {()}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Use a computed attribute constructor as right operand. . */ @org.junit.Test public void k2SeqExcept25() { final XQuery query = new XQuery( "count(/(a except text {()}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Use a name test that is the descendant axis as right operand. . */ @org.junit.Test public void k2SeqExcept26() { final XQuery query = new XQuery( "empty(/(a except descendant))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that is the attribute axis as right operand. . */ @org.junit.Test public void k2SeqExcept27() { final XQuery query = new XQuery( "empty(/(a except attribute))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that is the self axis as right operand. . */ @org.junit.Test public void k2SeqExcept28() { final XQuery query = new XQuery( "empty(/(a except self))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that is the descendant-or-self axis as right operand. . */ @org.junit.Test public void k2SeqExcept29() { final XQuery query = new XQuery( "empty(/(a except descendant-or-self))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, node, to test query parsing. . */ @org.junit.Test public void k2SeqExcept3() { final XQuery query = new XQuery( "empty(/(author except node))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that is the following-sibling axis as right operand. . */ @org.junit.Test public void k2SeqExcept30() { final XQuery query = new XQuery( "empty(/(a except following-sibling))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that is the following axis as right operand. . */ @org.junit.Test public void k2SeqExcept31() { final XQuery query = new XQuery( "empty(/(a except following))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that is the preceding-sibling axis as right operand. . */ @org.junit.Test public void k2SeqExcept32() { final XQuery query = new XQuery( "empty(/(a except preceding-sibling))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that is the preceding axis as right operand. . */ @org.junit.Test public void k2SeqExcept33() { final XQuery query = new XQuery( "empty(/(a except preceding))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that is the parent axis as right operand. . */ @org.junit.Test public void k2SeqExcept34() { final XQuery query = new XQuery( "empty(/(a except parent))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that is the ancestor axis as right operand. . */ @org.junit.Test public void k2SeqExcept35() { final XQuery query = new XQuery( "empty(/(a except ancestor))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that is the ancestor axis as right operand. . */ @org.junit.Test public void k2SeqExcept36() { final XQuery query = new XQuery( "empty(/(a except ancestor))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that is the ancestor-or-self axis as right operand. . */ @org.junit.Test public void k2SeqExcept37() { final XQuery query = new XQuery( "empty(/(a except ancestor-or-self))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use 'declare as right operand. . */ @org.junit.Test public void k2SeqExcept38() { final XQuery query = new XQuery( "empty(/(a except declare))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Extract the boolean value from an except expression. . */ @org.junit.Test public void k2SeqExcept39() { final XQuery query = new XQuery( "boolean(//employee[location = \"Denver\"] except //employee[last()])", ctx); try { query.context(node(file("op/union/acme_corp.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, element, to test query parsing. . */ @org.junit.Test public void k2SeqExcept4() { final XQuery query = new XQuery( "empty(/(author except element))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Explicitly sort the result of an except expression. . */ @org.junit.Test public void k2SeqExcept40() { final XQuery query = new XQuery( " { //(employee[location = \"Denver\"] except //employee[last()])/./location } ", ctx); try { query.context(node(file("op/union/acme_corp.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("DenverDenverDenver", false) ); } /** * Compare two nodes from different trees. . */ @org.junit.Test public void k2SeqExcept41() { final XQuery query = new XQuery( "
    except ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Ensure node deduplication is done. . */ @org.junit.Test public void k2SeqExcept42() { final XQuery query = new XQuery( " { let $i := /a , $t := $i/following-sibling::b return (($i except ($i, $i)), (($t, $t) except $t)) } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Use a node kind keyword, attribute, to test query parsing. . */ @org.junit.Test public void k2SeqExcept5() { final XQuery query = new XQuery( "empty(/(author except attribute))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, document-node, to test query parsing. . */ @org.junit.Test public void k2SeqExcept6() { final XQuery query = new XQuery( "empty(/(author except document-node))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, comment, to test query parsing. . */ @org.junit.Test public void k2SeqExcept7() { final XQuery query = new XQuery( "empty(/(author except comment))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, processing-instruction, to test query parsing. . */ @org.junit.Test public void k2SeqExcept8() { final XQuery query = new XQuery( "empty(/(author except processing-instruction))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, item, to test query parsing. . */ @org.junit.Test public void k2SeqExcept9() { final XQuery query = new XQuery( "empty(/(author except item))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple combination of node sequences involving node types with integer data. Use "except" operator. . */ @org.junit.Test public void combiningnodeseqexcepthc1() { final XQuery query = new XQuery( "(0,1) except (3,4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("01", false) || assertSerialization("10", false) ) ); } /** * Simple combination of node sequences involving repetition of the same element data. Use "except" operator. . */ @org.junit.Test public void combiningnodeseqexcepthc2() { final XQuery query = new XQuery( "(0,1) except (3,4,0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("01", false) || assertSerialization("10", false) ) ); } /** * Simple combination of node sequences involving the empty sequence. Use "except" operator. . */ @org.junit.Test public void combiningnodeseqexcepthc3() { final XQuery query = new XQuery( "count(() except (3,4,0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Simple combination of node sequences that evaluates to the empty sequence. Use "except" operator. Use count to avoid empty file. . */ @org.junit.Test public void combiningnodeseqexcepthc4() { final XQuery query = new XQuery( "for $h in ( count((//hours) except (//hours))) order by number($h) return $h", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Simple combination of node sequences involving multiple xml data sources and repetition of a sequence. Use "except" operator. Use count to avoid empty file results . */ @org.junit.Test public void combiningnodeseqexcepthc5() { final XQuery query = new XQuery( "for $h in ( count(($works//hours) except ($staff//grade,$works//hours))) order by number($h) return $h", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Simple combination of node sequences involving multiple xml data sources. Use "except" operator. . */ @org.junit.Test public void combiningnodeseqexcepthc6() { final XQuery query = new XQuery( "for $h in ( ($works//hours) except ($staff//grade)) order by number($h) return $h", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("12202020202020404040808080", false) ); } /** * arg: node . */ @org.junit.Test public void fnExceptNodeArgs001() { final XQuery query = new XQuery( "/bib/book[1]/title except /bib/book[1]/title", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * arg: incorrect nodes . */ @org.junit.Test public void fnExceptNodeArgs002() { final XQuery query = new XQuery( "/bib/book/title except /bib/book[1]/title", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Advanced Programming in the Unix environmentData on the WebThe Economics of Technology and Content for Digital TV", false) ); } /** * arg: node . */ @org.junit.Test public void fnExceptNodeArgs003() { final XQuery query = new XQuery( "(/bib/book[3] except root(exactly-one(/bib/book[3]/title)))/string(@year)", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2000") ); } /** * arg: text node & node . */ @org.junit.Test public void fnExceptNodeArgs004() { final XQuery query = new XQuery( "/bib/book[3]/title/text() except /bib/book/title/text()", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * arg: processing-instruction node & node . */ @org.junit.Test public void fnExceptNodeArgs005() { final XQuery query = new XQuery( "/processing-instruction() except /processing-instruction()", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * arg: processing-instruction node & node . */ @org.junit.Test public void fnExceptNodeArgs006() { final XQuery query = new XQuery( "(/processing-instruction() except /processing-instruction(PI1))/name()", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PI2") ); } /** * arg: comment node & node . */ @org.junit.Test public void fnExceptNodeArgs007() { final XQuery query = new XQuery( "/comment() except /comment()", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * arg: text node & node . */ @org.junit.Test public void fnExceptNodeArgs008() { final XQuery query = new XQuery( "string-join((for $node in /bib/book/title/text() except /bib/book[3]/title/text() return $node/string()), \"|\")", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "TCP/IP Illustrated|Advanced Programming in the Unix environment|The Economics of Technology and Content for Digital TV") ); } /** * arg: processing-instruction node & node . */ @org.junit.Test public void fnExceptNodeArgs009() { final XQuery query = new XQuery( "(/processing-instruction() except /bib/book[2]/title)/name()", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PI1 PI2") ); } /** * arg: processing-instruction node & node . */ @org.junit.Test public void fnExceptNodeArgs010() { final XQuery query = new XQuery( "(/processing-instruction(PI1) except /bib/book)/name()", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PI1") ); } /** * arg: comment node & node . */ @org.junit.Test public void fnExceptNodeArgs011() { final XQuery query = new XQuery( "/bib/book except /bib/book", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEmpty() || error("XPST0005") ) ); } /** * arg: node & non existing node . */ @org.junit.Test public void fnExceptNodeArgs012() { final XQuery query = new XQuery( "//author except //nonexisting", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("StevensW.StevensW.AbiteboulSergeBunemanPeterSuciuDan", false) ); } /** * arg: node & empty sequence . */ @org.junit.Test public void fnExceptNodeArgs013() { final XQuery query = new XQuery( "//author except ()", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("StevensW.StevensW.AbiteboulSergeBunemanPeterSuciuDan", false) ); } /** * arg: empty sequence & empty sequence . */ @org.junit.Test public void fnExceptNodeArgs014() { final XQuery query = new XQuery( "() except ()", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEmpty() || error("XPST0005") ) ); } /** * arg: node & node . */ @org.junit.Test public void fnExceptNodeArgs022() { final XQuery query = new XQuery( "string-join((for $node in ((//price/text()) , (//price/text())) except (//price) return $node)/string(), \"|\")", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, " 65.95|65.95| 39.95|129.95") ); } /** * arg: node & node . */ @org.junit.Test public void fnExceptNodeArgs023() { final XQuery query = new XQuery( "((//price/text()) , (//price/text())) except (//price/text())", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpGDayEqual.java000066400000000000000000001113561222453003200271040ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the gDay-equal() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpGDayEqual extends QT3TestSet { /** * * ******************************************************* * Test: K-gDayEQ-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'eq' for xs:gDay, returning positive. * ******************************************************* * . */ @org.junit.Test public void kGDayEQ1() { final XQuery query = new XQuery( "xs:gDay(\" ---31 \") eq xs:gDay(\"---31\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gDayEQ-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'eq' for xs:gDay. * ******************************************************* * . */ @org.junit.Test public void kGDayEQ2() { final XQuery query = new XQuery( "not(xs:gDay(\"---31\") eq xs:gDay(\"---01\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gDayEQ-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ne' for xs:gDay. * ******************************************************* * . */ @org.junit.Test public void kGDayEQ3() { final XQuery query = new XQuery( "xs:gDay(\"---01\") ne xs:gDay(\"---10\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gDayEQ-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ne' for xs:gDay. * ******************************************************* * . */ @org.junit.Test public void kGDayEQ4() { final XQuery query = new XQuery( "not(xs:gDay(\"---01\") ne xs:gDay(\"---01\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gDayEQ-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset -00:00 is equal to Z, in xs:gDay. * ******************************************************* * . */ @org.junit.Test public void kGDayEQ5() { final XQuery query = new XQuery( "xs:gDay(\"---01-00:00\") eq xs:gDay(\"---01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gDayEQ-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset +00:00 is equal to Z, in xs:gDay. * ******************************************************* * . */ @org.junit.Test public void kGDayEQ6() { final XQuery query = new XQuery( "xs:gDay(\"---01+00:00\") eq xs:gDay(\"---01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gDayEQ-7 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset Z is equal to Z, in xs:gDay. * ******************************************************* * . */ @org.junit.Test public void kGDayEQ7() { final XQuery query = new XQuery( "xs:gDay(\"---01Z\") eq xs:gDay(\"---01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gDayEQ-8 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset -00:00 is equal to +00:00, in xs:gDay. * ******************************************************* * . */ @org.junit.Test public void kGDayEQ8() { final XQuery query = new XQuery( "xs:gDay(\"---01-00:00\") eq xs:gDay(\"---01+00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gDay . */ @org.junit.Test public void cbclGDayEqual001() { final XQuery query = new XQuery( "declare function local:gDay($day as xs:integer) { if ($day lt 10) then xs:gDay(concat(\"---0\", $day)) else xs:gDay(concat(\"---\", $day)) }; not(local:gDay(1) eq xs:gDay(\"---31\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gDay . */ @org.junit.Test public void cbclGDayEqual002() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('PT9M'))\n" + " then xs:gDay(\"---30\") eq xs:gDay(\"---31+09:01\")\n" + " else xs:gDay(\"---30\") eq xs:gDay(\"---31+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gDay . */ @org.junit.Test public void cbclGDayEqual003() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('PT9M'))\n" + " then xs:gDay(\"---31+09:01\") eq xs:gDay(\"---30\")\n" + " else xs:gDay(\"---31+09:00\") eq xs:gDay(\"---30\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gDay . */ @org.junit.Test public void cbclGDayEqual004() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('-PT9M'))\n" + " then xs:gDay(\"---30\") eq xs:gDay(\"---31-09:01\")\n" + " else xs:gDay(\"---30\") eq xs:gDay(\"---31-09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gDay . */ @org.junit.Test public void cbclGDayEqual005() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('-PT9M'))\n" + " then xs:gDay(\"---31-09:01\") eq xs:gDay(\"---30\")\n" + " else xs:gDay(\"---31-09:00\") eq xs:gDay(\"---30\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gDay . */ @org.junit.Test public void cbclGDayEqual006() { final XQuery query = new XQuery( "declare function local:gDay($day as xs:integer) { if ($day lt 10) then xs:gDay(concat(\"---0\", $day)) else xs:gDay(concat(\"---\", $day)) }; not(local:gDay(1) ne xs:gDay(\"---31\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gDay . */ @org.junit.Test public void cbclGDayEqual007() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('PT9M'))\n" + " then xs:gDay(\"---30\") ne xs:gDay(\"---31+09:01\")\n" + " else xs:gDay(\"---30\") ne xs:gDay(\"---31+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gDay . */ @org.junit.Test public void cbclGDayEqual008() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('PT9M'))\n" + " then xs:gDay(\"---31+09:01\") ne xs:gDay(\"---30\")\n" + " else xs:gDay(\"---31+09:00\") ne xs:gDay(\"---30\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gDay . */ @org.junit.Test public void cbclGDayEqual009() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('-PT9M'))\n" + " then xs:gDay(\"---30\") ne xs:gDay(\"---31-09:01\")\n" + " else xs:gDay(\"---30\") ne xs:gDay(\"---31-09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gDay . */ @org.junit.Test public void cbclGDayEqual010() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('-PT9M'))\n" + " then xs:gDay(\"---31-09:01\") ne xs:gDay(\"---30\")\n" + " else xs:gDay(\"---31-09:00\") ne xs:gDay(\"---30\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gDay . */ @org.junit.Test public void cbclGDayEqual011() { final XQuery query = new XQuery( "declare function local:gDay($gDay as xs:gDay, $null as xs:boolean) { if ($null) then () else $gDay }; exists(local:gDay(xs:gDay(\"---31\"), fn:true()) eq xs:gDay(\"---31\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gDay . */ @org.junit.Test public void cbclGDayEqual012() { final XQuery query = new XQuery( "declare function local:gDay($gDay as xs:gDay, $null as xs:boolean) { if ($null) then () else $gDay }; local:gDay(xs:gDay(\"---31\"), fn:false()) eq xs:gDay(\"---31\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gDay . */ @org.junit.Test public void cbclGDayEqual013() { final XQuery query = new XQuery( "declare function local:gDay($gDay as xs:gDay, $null as xs:boolean) { if ($null) then () else $gDay }; exists(local:gDay(xs:gDay(\"---31\"), fn:true()) ne xs:gDay(\"---31\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gDay . */ @org.junit.Test public void cbclGDayEqual014() { final XQuery query = new XQuery( "declare function local:gDay($gDay as xs:gDay, $null as xs:boolean) { if ($null) then () else $gDay }; local:gDay(xs:gDay(\"---31\"), fn:false()) ne xs:gDay(\"---31\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gDay . */ @org.junit.Test public void cbclGDayEqual015() { final XQuery query = new XQuery( "xs:gDay(\"---30-12:00\") eq xs:gDay(\"---31+12:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gDay . */ @org.junit.Test public void cbclGDayEqual016() { final XQuery query = new XQuery( "xs:gDay(\"---31+12:00\") eq xs:gDay(\"---30-12:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gDay . */ @org.junit.Test public void cbclGDayEqual017() { final XQuery query = new XQuery( "xs:gDay(\"---30-12:00\") ne xs:gDay(\"---31+12:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gDay . */ @org.junit.Test public void cbclGDayEqual018() { final XQuery query = new XQuery( "xs:gDay(\"---31+12:00\") ne xs:gDay(\"---30-12:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gDay . */ @org.junit.Test public void cbclGDayEqual019() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('PT1H'))\n" + " then xs:gDay(\"---31+01:01\") eq xs:gDay(\"---31\")\n" + " else xs:gDay(\"---31+01:00\") eq xs:gDay(\"---31\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gDay . */ @org.junit.Test public void cbclGDayEqual020() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('PT1H'))\n" + " then xs:gDay(\"---31\") eq xs:gDay(\"---31+01:01\")\n" + " else xs:gDay(\"---31\") eq xs:gDay(\"---31+01:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gDay-equal-10 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "gDay-equal" function used * together with "or" expression (ne operator). * ******************************************************* * . */ @org.junit.Test public void opGDayEqual10() { final XQuery query = new XQuery( "(xs:gDay(\"---06Z\") ne xs:gDay(\"---06Z\")) or (xs:gDay(\"---08Z\") ne xs:gDay(\"---09Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gDay-equal-11 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "gDay-equal" function used * together with "fn:true"/or expression (eq operator). * ******************************************************* * . */ @org.junit.Test public void opGDayEqual11() { final XQuery query = new XQuery( "(xs:gDay(\"---03Z\") eq xs:gDay(\"---01Z\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gDay-equal-12 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "gDay-equal" function used * together with "fn:true"/or expression (ne operator). * ******************************************************* * . */ @org.junit.Test public void opGDayEqual12() { final XQuery query = new XQuery( "(xs:gDay(\"---08Z\") ne xs:gDay(\"---07Z\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gDay-equal-13 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "gDay-equal" function used * together with "fn:false"/or expression (eq operator). * ******************************************************* * . */ @org.junit.Test public void opGDayEqual13() { final XQuery query = new XQuery( "(xs:gDay(\"---05Z\") eq xs:gDay(\"---05Z\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gDay-equal-14 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "gDay-equal" function used * together with "fn:false"/or expression (ne operator). * ******************************************************* * . */ @org.junit.Test public void opGDayEqual14() { final XQuery query = new XQuery( "(xs:gDay(\"---09Z\") ne xs:gDay(\"---09Z\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gDay-equal-2 * Written By: Carmelo Montanez * Date: June 16, 2005 * Purpose: Evaluates The "gDay-equal" function * As per example 2 (for this function) of the F&O specs * ******************************************************* * . */ @org.junit.Test public void opGDayEqual2() { final XQuery query = new XQuery( "(xs:gDay(\"---12-05:00\") eq xs:gDay(\"---12Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gDay-equal-3 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "gDay-equal" function that * return true and used together with fn:not (eq operator) * ******************************************************* * . */ @org.junit.Test public void opGDayEqual3() { final XQuery query = new XQuery( "fn:not((xs:gDay(\"---12Z\") eq xs:gDay(\"---12Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gDay-equal-4 * Written By: Carmelo Montanez * Date: June 16, 2005 * Purpose: Evaluates The "gDay-equal" function that * return true and used together with fn:not (ne operator) * ******************************************************* * . */ @org.junit.Test public void opGDayEqual4() { final XQuery query = new XQuery( "fn:not(xs:gDay(\"---05Z\") ne xs:gDay(\"---06Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gDay-equal-5 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "gDay-equal" function that * return false and used together with fn:not (eq operator) * ******************************************************* * . */ @org.junit.Test public void opGDayEqual5() { final XQuery query = new XQuery( "fn:not(xs:gDay(\"---11Z\") eq xs:gDay(\"---10Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gDay-equal-6 * Written By: Carmelo Montanez * Date: June 16, 2005 * Purpose: Evaluates The "gDay-equal" function that * return false and used together with fn:not(ne operator) * ******************************************************* * . */ @org.junit.Test public void opGDayEqual6() { final XQuery query = new XQuery( "fn:not(xs:gDay(\"---05Z\") ne xs:gDay(\"---05Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gDay-equal-7 * Written By: Carmelo Montanez * Date: June 16, 2005 * Purpose: Evaluates The "gDay-equal" function used * together with "and" expression (eq operator). * ******************************************************* * . */ @org.junit.Test public void opGDayEqual7() { final XQuery query = new XQuery( "(xs:gDay(\"---04Z\") eq xs:gDay(\"---02Z\")) and (xs:gDay(\"---01Z\") eq xs:gDay(\"---12Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gDay-equal-8 * Written By: Carmelo Montanez * Date: June 16, 2005 * Purpose: Evaluates The "gDay-equal" function used * together with "and" expression (ne operator). * ******************************************************* * . */ @org.junit.Test public void opGDayEqual8() { final XQuery query = new XQuery( "(xs:gDay(\"---12Z\") ne xs:gDay(\"---03Z\")) and (xs:gDay(\"---05Z\") ne xs:gDay(\"---08Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gDay-equal-9 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "gDay-equal" function used * together with "or" expression (eq operator). * ******************************************************* * . */ @org.junit.Test public void opGDayEqual9() { final XQuery query = new XQuery( "(xs:gDay(\"---02Z\") eq xs:gDay(\"---02Z\")) or (xs:gDay(\"---06Z\") eq xs:gDay(\"---06Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gDay-equal2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:gDay-equal" operator * with the arguments set as follows: * $arg1 = xs:gDay(lower bound) * $arg2 = xs:gDay(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGDayEqual2args1() { final XQuery query = new XQuery( "xs:gDay(\"---01Z\") eq xs:gDay(\"---01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gDay-equal2args-10 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:gDay-equal" operator * with the arguments set as follows: * $arg1 = xs:gDay(lower bound) * $arg2 = xs:gDay(upper bound) * ******************************************************* * . */ @org.junit.Test public void opGDayEqual2args10() { final XQuery query = new XQuery( "xs:gDay(\"---01Z\") ne xs:gDay(\"---31Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gDay-equal2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:gDay-equal" operator * with the arguments set as follows: * $arg1 = xs:gDay(mid range) * $arg2 = xs:gDay(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGDayEqual2args2() { final XQuery query = new XQuery( "xs:gDay(\"---14Z\") eq xs:gDay(\"---01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gDay-equal2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:gDay-equal" operator * with the arguments set as follows: * $arg1 = xs:gDay(upper bound) * $arg2 = xs:gDay(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGDayEqual2args3() { final XQuery query = new XQuery( "xs:gDay(\"---31Z\") eq xs:gDay(\"---01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gDay-equal2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:gDay-equal" operator * with the arguments set as follows: * $arg1 = xs:gDay(lower bound) * $arg2 = xs:gDay(mid range) * ******************************************************* * . */ @org.junit.Test public void opGDayEqual2args4() { final XQuery query = new XQuery( "xs:gDay(\"---01Z\") eq xs:gDay(\"---14Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gDay-equal2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:gDay-equal" operator * with the arguments set as follows: * $arg1 = xs:gDay(lower bound) * $arg2 = xs:gDay(upper bound) * ******************************************************* * . */ @org.junit.Test public void opGDayEqual2args5() { final XQuery query = new XQuery( "xs:gDay(\"---01Z\") eq xs:gDay(\"---31Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gDay-equal2args-6 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:gDay-equal" operator * with the arguments set as follows: * $arg1 = xs:gDay(lower bound) * $arg2 = xs:gDay(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGDayEqual2args6() { final XQuery query = new XQuery( "xs:gDay(\"---01Z\") ne xs:gDay(\"---01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gDay-equal2args-7 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:gDay-equal" operator * with the arguments set as follows: * $arg1 = xs:gDay(mid range) * $arg2 = xs:gDay(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGDayEqual2args7() { final XQuery query = new XQuery( "xs:gDay(\"---14Z\") ne xs:gDay(\"---01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gDay-equal2args-8 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:gDay-equal" operator * with the arguments set as follows: * $arg1 = xs:gDay(upper bound) * $arg2 = xs:gDay(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGDayEqual2args8() { final XQuery query = new XQuery( "xs:gDay(\"---31Z\") ne xs:gDay(\"---01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gDay-equal2args-9 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:gDay-equal" operator * with the arguments set as follows: * $arg1 = xs:gDay(lower bound) * $arg2 = xs:gDay(mid range) * ******************************************************* * . */ @org.junit.Test public void opGDayEqual2args9() { final XQuery query = new XQuery( "xs:gDay(\"---01Z\") ne xs:gDay(\"---14Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpGMonthDayEqual.java000066400000000000000000001140611222453003200301060ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the gMonthDay-equal() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpGMonthDayEqual extends QT3TestSet { /** * * ******************************************************* * Test: K-gMonthDayEQ-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'eq' for xs:gMonthDay, returning positive. * ******************************************************* * . */ @org.junit.Test public void kGMonthDayEQ1() { final XQuery query = new XQuery( "xs:gMonthDay(\"--04-01 \") eq xs:gMonthDay(\"--04-01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gMonthDayEQ-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'eq' for xs:gMonthDay. * ******************************************************* * . */ @org.junit.Test public void kGMonthDayEQ2() { final XQuery query = new XQuery( "not(xs:gMonthDay(\"--03-03\") eq xs:gMonthDay(\"--04-03\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gMonthDayEQ-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ne' for xs:gMonthDay. * ******************************************************* * . */ @org.junit.Test public void kGMonthDayEQ3() { final XQuery query = new XQuery( "xs:gMonthDay(\"--04-12\") ne xs:gMonthDay(\"--04-11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gMonthDayEQ-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ne' for xs:gMonthDay. * ******************************************************* * . */ @org.junit.Test public void kGMonthDayEQ4() { final XQuery query = new XQuery( "not(xs:gMonthDay(\"--04-11\") ne xs:gMonthDay(\"--04-11\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gMonthDayEQ-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset -00:00 is equal to Z, in xs:gMonthDay. * ******************************************************* * . */ @org.junit.Test public void kGMonthDayEQ5() { final XQuery query = new XQuery( "xs:gMonthDay(\"--03-01-00:00\") eq xs:gMonthDay(\"--03-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gMonthDayEQ-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset +00:00 is equal to Z, in xs:gMonthDay. * ******************************************************* * . */ @org.junit.Test public void kGMonthDayEQ6() { final XQuery query = new XQuery( "xs:gMonthDay(\"--03-01+00:00\") eq xs:gMonthDay(\"--03-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gMonthDayEQ-7 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset Z is equal to Z, in xs:gMonthDay. * ******************************************************* * . */ @org.junit.Test public void kGMonthDayEQ7() { final XQuery query = new XQuery( "xs:gMonthDay(\"--03-01Z\") eq xs:gMonthDay(\"--03-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gMonthDayEQ-8 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset -00:00 is equal to +00:00, in xs:gMonthDay. * ******************************************************* * . */ @org.junit.Test public void kGMonthDayEQ8() { final XQuery query = new XQuery( "xs:gMonthDay(\"--03-01-00:00\") eq xs:gMonthDay(\"--03-01+00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gMonthDay . */ @org.junit.Test public void cbclGMonthDayEqual001() { final XQuery query = new XQuery( "declare function local:gMonthDay($day as xs:integer) { if ($day lt 10) then xs:gMonthDay(concat(\"--12-0\", $day)) else xs:gMonthDay(concat(\"--12-\", $day)) }; not(local:gMonthDay(1) eq xs:gMonthDay(\"--12-31\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gMonthDay . */ @org.junit.Test public void cbclGMonthDayEqual002() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('PT9M'))\n" + " then xs:gMonthDay(\"--12-30\") eq xs:gMonthDay(\"--12-31+09:01\")\n" + " else xs:gMonthDay(\"--12-30\") eq xs:gMonthDay(\"--12-31+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gMonthDay . */ @org.junit.Test public void cbclGMonthDayEqual003() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('PT9M'))\n" + " then xs:gMonthDay(\"--12-31+09:01\") eq xs:gMonthDay(\"--12-30\")\n" + " else xs:gMonthDay(\"--12-31+09:00\") eq xs:gMonthDay(\"--12-30\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gMonthDay . */ @org.junit.Test public void cbclGMonthDayEqual004() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('-PT9M'))\n" + " then xs:gMonthDay(\"--12-30\") eq xs:gMonthDay(\"--12-31-09:01\")\n" + " else xs:gMonthDay(\"--12-30\") eq xs:gMonthDay(\"--12-31-09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gMonthDay . */ @org.junit.Test public void cbclGMonthDayEqual005() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('-PT9M'))\n" + " then xs:gMonthDay(\"--12-31-09:01\") eq xs:gMonthDay(\"--12-30\")\n" + " else xs:gMonthDay(\"--12-31-09:00\") eq xs:gMonthDay(\"--12-30\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gMonthDay . */ @org.junit.Test public void cbclGMonthDayEqual006() { final XQuery query = new XQuery( "declare function local:gMonthDay($day as xs:integer) { if ($day lt 10) then xs:gMonthDay(concat(\"--12-0\", $day)) else xs:gMonthDay(concat(\"--12-\", $day)) }; not(local:gMonthDay(1) ne xs:gMonthDay(\"--12-31\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gMonthDay . */ @org.junit.Test public void cbclGMonthDayEqual007() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('PT9M'))\n" + " then xs:gMonthDay(\"--12-30\") ne xs:gMonthDay(\"--12-31+09:01\")\n" + " else xs:gMonthDay(\"--12-30\") ne xs:gMonthDay(\"--12-31+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gMonthDay . */ @org.junit.Test public void cbclGMonthDayEqual008() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('PT9M'))\n" + " then xs:gMonthDay(\"--12-31+09:01\") ne xs:gMonthDay(\"--12-30\")\n" + " else xs:gMonthDay(\"--12-31+09:00\") ne xs:gMonthDay(\"--12-30\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gMonthDay . */ @org.junit.Test public void cbclGMonthDayEqual009() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('-PT9M'))\n" + " then xs:gMonthDay(\"--12-30\") ne xs:gMonthDay(\"--12-31-09:01\")\n" + " else xs:gMonthDay(\"--12-30\") ne xs:gMonthDay(\"--12-31-09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gMonthDay . */ @org.junit.Test public void cbclGMonthDayEqual010() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('-PT9M'))\n" + " then xs:gMonthDay(\"--12-31-09:01\") ne xs:gMonthDay(\"--12-30\")\n" + " else xs:gMonthDay(\"--12-31-09:00\") ne xs:gMonthDay(\"--12-30\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gMonthDay . */ @org.junit.Test public void cbclGMonthDayEqual011() { final XQuery query = new XQuery( "declare function local:gMonthDay($gMonthDay as xs:gMonthDay, $null as xs:boolean) { if ($null) then () else $gMonthDay }; exists(local:gMonthDay(xs:gMonthDay(\"--12-31\"), fn:true()) eq xs:gMonthDay(\"--12-31\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gMonthDay . */ @org.junit.Test public void cbclGMonthDayEqual012() { final XQuery query = new XQuery( "declare function local:gMonthDay($gMonthDay as xs:gMonthDay, $null as xs:boolean) { if ($null) then () else $gMonthDay }; local:gMonthDay(xs:gMonthDay(\"--12-31\"), fn:false()) eq xs:gMonthDay(\"--12-31\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gMonthDay . */ @org.junit.Test public void cbclGMonthDayEqual013() { final XQuery query = new XQuery( "declare function local:gMonthDay($gMonthDay as xs:gMonthDay, $null as xs:boolean) { if ($null) then () else $gMonthDay }; exists(local:gMonthDay(xs:gMonthDay(\"--12-31\"), fn:true()) ne xs:gMonthDay(\"--12-31\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gMonthDay . */ @org.junit.Test public void cbclGMonthDayEqual014() { final XQuery query = new XQuery( "declare function local:gMonthDay($gMonthDay as xs:gMonthDay, $null as xs:boolean) { if ($null) then () else $gMonthDay }; local:gMonthDay(xs:gMonthDay(\"--12-31\"), fn:false()) ne xs:gMonthDay(\"--12-31\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gDay . */ @org.junit.Test public void cbclGMonthDayEqual015() { final XQuery query = new XQuery( "xs:gMonthDay(\"--01-30-12:00\") eq xs:gMonthDay(\"--01-31+12:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gDay . */ @org.junit.Test public void cbclGMonthDayEqual016() { final XQuery query = new XQuery( "xs:gMonthDay(\"--01-31+12:00\") eq xs:gMonthDay(\"--01-30-12:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gDay . */ @org.junit.Test public void cbclGMonthDayEqual017() { final XQuery query = new XQuery( "xs:gMonthDay(\"--01-30-12:00\") ne xs:gMonthDay(\"--01-31+12:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gDay . */ @org.junit.Test public void cbclGMonthDayEqual018() { final XQuery query = new XQuery( "xs:gMonthDay(\"--01-31+12:00\") ne xs:gMonthDay(\"--01-30-12:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gMonthDay . */ @org.junit.Test public void cbclGMonthDayEqual019() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('PT1M'))\n" + " then xs:gMonthDay(\"--12-30\") eq xs:gMonthDay(\"--12-31+01:01\")\n" + " else xs:gMonthDay(\"--12-30\") eq xs:gMonthDay(\"--12-31+01:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gMonthDay . */ @org.junit.Test public void cbclGMonthDayEqual020() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('PT1M'))\n" + " then xs:gMonthDay(\"--12-31+01:01\") eq xs:gMonthDay(\"--12-30\")\n" + " else xs:gMonthDay(\"--12-31+01:00\") eq xs:gMonthDay(\"--12-30\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gMonthDay-equal-10 * Written By: Carmelo Montanez * Date: June 22, 2005 * Purpose: Evaluates The "gMonthDay-equal" function used * together with "or" expression (ne operator). * ******************************************************* * . */ @org.junit.Test public void opGMonthDayEqual10() { final XQuery query = new XQuery( "(xs:gMonthDay(\"--06-02Z\") ne xs:gMonthDay(\"--06-09Z\")) or (xs:gMonthDay(\"--08-06Z\") ne xs:gMonthDay(\"--09-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gMonthDay-equal-11 * Written By: Carmelo Montanez * Date: June 22, 2005 * Purpose: Evaluates The "gMonthDay-equal" function used * together with "fn:true"/or expression (eq operator). * ******************************************************* * . */ @org.junit.Test public void opGMonthDayEqual11() { final XQuery query = new XQuery( "(xs:gMonthDay(\"--03-04Z\") eq xs:gMonthDay(\"--01-07Z\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gMonthDay-equal-12 * Written By: Carmelo Montanez * Date: June 22, 2005 * Purpose: Evaluates The "gMonthDay-equal" function used * together with "fn:true"/or expression (ne operator). * ******************************************************* * . */ @org.junit.Test public void opGMonthDayEqual12() { final XQuery query = new XQuery( "(xs:gMonthDay(\"--08-04Z\") ne xs:gMonthDay(\"--07-12Z\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gMonthDay-equal-13 * Written By: Carmelo Montanez * Date: June 22, 2005 * Purpose: Evaluates The "gMonthDay-equal" function used * together with "fn:false"/or expression (eq operator). * ******************************************************* * . */ @org.junit.Test public void opGMonthDayEqual13() { final XQuery query = new XQuery( "(xs:gMonthDay(\"--05-05Z\") eq xs:gMonthDay(\"--05-05Z\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gMonthDay-equal-14 * Written By: Carmelo Montanez * Date: June 22, 2005 * Purpose: Evaluates The "gMonthDay-equal" function used * together with "fn:false"/or expression (ne operator). * ******************************************************* * . */ @org.junit.Test public void opGMonthDayEqual14() { final XQuery query = new XQuery( "(xs:gMonthDay(\"--09-09Z\") ne xs:gMonthDay(\"--09-10Z\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gMonthDay-equal-2 * Date: June 22, 2005 * Purpose: Evaluates The "gMonthDay-equal" function * As per example 2 (for this function) of the F&O specs * ******************************************************* * . */ @org.junit.Test public void opGMonthDayEqual2() { final XQuery query = new XQuery( "(xs:gMonthDay(\"--12-25Z\") eq xs:gMonthDay(\"--12-26Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gMonthDay-equal-3 * Written By: Carmelo Montanez * Date: June 22, 2005 * Purpose: Evaluates The "gMonthDay-equal" function that * return true and used together with fn:not (eq operator) * ******************************************************* * . */ @org.junit.Test public void opGMonthDayEqual3() { final XQuery query = new XQuery( "fn:not((xs:gMonthDay(\"--12-10Z\") eq xs:gMonthDay(\"--12-10Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gMonthDay-equal-4 * Written By: Carmelo Montanez * Date: June 22, 2005 * Purpose: Evaluates The "gMonthDay-equal" function that * return true and used together with fn:not (ne operator) * ******************************************************* * . */ @org.junit.Test public void opGMonthDayEqual4() { final XQuery query = new XQuery( "fn:not(xs:gMonthDay(\"--05-01Z\") ne xs:gMonthDay(\"--06-12Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gMonthDay-equal-5 * Written By: Carmelo Montanez * Date: June 22, 2005 * Purpose: Evaluates The "gMonthDay-equal" function that * return false and used together with fn:not (eq operator) * ******************************************************* * . */ @org.junit.Test public void opGMonthDayEqual5() { final XQuery query = new XQuery( "fn:not(xs:gMonthDay(\"--11-10Z\") eq xs:gMonthDay(\"--10-02Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gMonthDay-equal-6 * Written By: Carmelo Montanez * Date: June 22, 2005 * Purpose: Evaluates The "gMonthDay-equal" function that * return false and used together with fn:not(ne operator) * ******************************************************* * . */ @org.junit.Test public void opGMonthDayEqual6() { final XQuery query = new XQuery( "fn:not(xs:gMonthDay(\"--05-10Z\") ne xs:gMonthDay(\"--05-10Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gMonthDay-equal-7 * Written By: Carmelo Montanez * Date: June 22, 2005 * Purpose: Evaluates The "gMonthDay-equal" function used * together with "and" expression (eq operator). * ******************************************************* * . */ @org.junit.Test public void opGMonthDayEqual7() { final XQuery query = new XQuery( "(xs:gMonthDay(\"--04-02Z\") eq xs:gMonthDay(\"--02-03Z\")) and (xs:gMonthDay(\"--01-07Z\") eq xs:gMonthDay(\"--12-10Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gMonthDay-equal-8 * Written By: Carmelo Montanez * Date: June 22, 2005 * Purpose: Evaluates The "gMonthDay-equal" function used * together with "and" expression (ne operator). * ******************************************************* * . */ @org.junit.Test public void opGMonthDayEqual8() { final XQuery query = new XQuery( "(xs:gMonthDay(\"--12-10Z\") ne xs:gMonthDay(\"--03-11Z\")) and (xs:gMonthDay(\"--05-12Z\") ne xs:gMonthDay(\"--08-08Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gMonthDay-equal-9 * Written By: Carmelo Montanez * Date: June 22, 2005 * Purpose: Evaluates The "gMonthDay-equal" function used * together with "or" expression (eq operator). * ******************************************************* * . */ @org.junit.Test public void opGMonthDayEqual9() { final XQuery query = new XQuery( "(xs:gMonthDay(\"--02-01Z\") eq xs:gMonthDay(\"--02-10Z\")) or (xs:gMonthDay(\"--06-02Z\") eq xs:gMonthDay(\"--06-03Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gMonthDay-equal2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gMonthDay-equal" operator * with the arguments set as follows: * $arg1 = xs:gMonthDay(lower bound) * $arg2 = xs:gMonthDay(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGMonthDayEqual2args1() { final XQuery query = new XQuery( "xs:gMonthDay(\"--01-01Z\") eq xs:gMonthDay(\"--01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gMonthDay-equal2args-10 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gMonthDay-equal" operator * with the arguments set as follows: * $arg1 = xs:gMonthDay(lower bound) * $arg2 = xs:gMonthDay(upper bound) * ******************************************************* * . */ @org.junit.Test public void opGMonthDayEqual2args10() { final XQuery query = new XQuery( "xs:gMonthDay(\"--01-01Z\") ne xs:gMonthDay(\"--12-31Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gMonthDay-equal2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gMonthDay-equal" operator * with the arguments set as follows: * $arg1 = xs:gMonthDay(mid range) * $arg2 = xs:gMonthDay(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGMonthDayEqual2args2() { final XQuery query = new XQuery( "xs:gMonthDay(\"--04-10Z\") eq xs:gMonthDay(\"--01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gMonthDay-equal2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gMonthDay-equal" operator * with the arguments set as follows: * $arg1 = xs:gMonthDay(upper bound) * $arg2 = xs:gMonthDay(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGMonthDayEqual2args3() { final XQuery query = new XQuery( "xs:gMonthDay(\"--12-31Z\") eq xs:gMonthDay(\"--01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gMonthDay-equal2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gMonthDay-equal" operator * with the arguments set as follows: * $arg1 = xs:gMonthDay(lower bound) * $arg2 = xs:gMonthDay(mid range) * ******************************************************* * . */ @org.junit.Test public void opGMonthDayEqual2args4() { final XQuery query = new XQuery( "xs:gMonthDay(\"--01-01Z\") eq xs:gMonthDay(\"--04-10Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gMonthDay-equal2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gMonthDay-equal" operator * with the arguments set as follows: * $arg1 = xs:gMonthDay(lower bound) * $arg2 = xs:gMonthDay(upper bound) * ******************************************************* * . */ @org.junit.Test public void opGMonthDayEqual2args5() { final XQuery query = new XQuery( "xs:gMonthDay(\"--01-01Z\") eq xs:gMonthDay(\"--12-31Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gMonthDay-equal2args-6 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gMonthDay-equal" operator * with the arguments set as follows: * $arg1 = xs:gMonthDay(lower bound) * $arg2 = xs:gMonthDay(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGMonthDayEqual2args6() { final XQuery query = new XQuery( "xs:gMonthDay(\"--01-01Z\") ne xs:gMonthDay(\"--01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gMonthDay-equal2args-7 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gMonthDay-equal" operator * with the arguments set as follows: * $arg1 = xs:gMonthDay(mid range) * $arg2 = xs:gMonthDay(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGMonthDayEqual2args7() { final XQuery query = new XQuery( "xs:gMonthDay(\"--04-10Z\") ne xs:gMonthDay(\"--01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gMonthDay-equal2args-8 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gMonthDay-equal" operator * with the arguments set as follows: * $arg1 = xs:gMonthDay(upper bound) * $arg2 = xs:gMonthDay(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGMonthDayEqual2args8() { final XQuery query = new XQuery( "xs:gMonthDay(\"--12-31Z\") ne xs:gMonthDay(\"--01-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gMonthDay-equal2args-9 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gMonthDay-equal" operator * with the arguments set as follows: * $arg1 = xs:gMonthDay(lower bound) * $arg2 = xs:gMonthDay(mid range) * ******************************************************* * . */ @org.junit.Test public void opGMonthDayEqual2args9() { final XQuery query = new XQuery( "xs:gMonthDay(\"--01-01Z\") ne xs:gMonthDay(\"--04-10Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpGMonthEqual.java000066400000000000000000001043001222453003200274430ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the gMonth-equal() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpGMonthEqual extends QT3TestSet { /** * * ******************************************************* * Test: K-gMonthEQ-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'eq' for xs:gMonth, returning positive. * ******************************************************* * . */ @org.junit.Test public void kGMonthEQ1() { final XQuery query = new XQuery( "xs:gMonth(\"--11 \") eq xs:gMonth(\"--11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gMonthEQ-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'eq' for xs:gMonth. * ******************************************************* * . */ @org.junit.Test public void kGMonthEQ2() { final XQuery query = new XQuery( "not(xs:gMonth(\"--11\") eq xs:gMonth(\"--01\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gMonthEQ-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ne' for xs:gMonth. * ******************************************************* * . */ @org.junit.Test public void kGMonthEQ3() { final XQuery query = new XQuery( "xs:gMonth(\"--12\") ne xs:gMonth(\"--10\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gMonthEQ-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ne' for xs:gMonth. * ******************************************************* * . */ @org.junit.Test public void kGMonthEQ4() { final XQuery query = new XQuery( "not(xs:gMonth(\"--03\") ne xs:gMonth(\"--03\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gMonthEQ-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset -00:00 is equal to Z, in xs:gMonth. * ******************************************************* * . */ @org.junit.Test public void kGMonthEQ5() { final XQuery query = new XQuery( "xs:gMonth(\"--01-00:00\") eq xs:gMonth(\"--01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gMonthEQ-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset +00:00 is equal to Z, in xs:gMonth. * ******************************************************* * . */ @org.junit.Test public void kGMonthEQ6() { final XQuery query = new XQuery( "xs:gMonth(\"--01+00:00\") eq xs:gMonth(\"--01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gMonthEQ-7 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset Z is equal to Z, in xs:gMonth. * ******************************************************* * . */ @org.junit.Test public void kGMonthEQ7() { final XQuery query = new XQuery( "xs:gMonth(\"--01Z\") eq xs:gMonth(\"--01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gMonthEQ-8 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset -00:00 is equal to +00:00, in xs:gMonth. * ******************************************************* * . */ @org.junit.Test public void kGMonthEQ8() { final XQuery query = new XQuery( "xs:gMonth(\"--01-00:00\") eq xs:gMonth(\"--01+00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gMonth . */ @org.junit.Test public void cbclGMonthEqual001() { final XQuery query = new XQuery( "declare function local:gMonth($month as xs:integer) { if ($month lt 10) then xs:gMonth(concat(\"--0\", $month)) else xs:gMonth(concat(\"--\", $month)) }; not(local:gMonth(1) eq xs:gMonth(\"--06\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gMonth . */ @org.junit.Test public void cbclGMonthEqual002() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('PT9M'))\n" + " then xs:gMonth(\"--06\") eq xs:gMonth(\"--06+09:01\")\n" + " else xs:gMonth(\"--06\") eq xs:gMonth(\"--06+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gMonth . */ @org.junit.Test public void cbclGMonthEqual003() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('PT9M'))\n" + " then xs:gMonth(\"--06+09:01\") eq xs:gMonth(\"--06\")\n" + " else xs:gMonth(\"--06+09:00\") eq xs:gMonth(\"--06\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gMonth . */ @org.junit.Test public void cbclGMonthEqual004() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('-PT9M'))\n" + " then xs:gMonth(\"--06\") eq xs:gMonth(\"--06-09:01\")\n" + " else xs:gMonth(\"--06\") eq xs:gMonth(\"--06-09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gMonth . */ @org.junit.Test public void cbclGMonthEqual005() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('-PT9M'))\n" + " then xs:gMonth(\"--06-09:01\") eq xs:gMonth(\"--06\")\n" + " else xs:gMonth(\"--06-09:00\") eq xs:gMonth(\"--06\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gMonth . */ @org.junit.Test public void cbclGMonthEqual006() { final XQuery query = new XQuery( "declare function local:gMonth($month as xs:integer) { if ($month lt 10) then xs:gMonth(concat(\"--0\", $month)) else xs:gMonth(concat(\"--\", $month)) }; not(local:gMonth(1) ne xs:gMonth(\"--06\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gMonth . */ @org.junit.Test public void cbclGMonthEqual007() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('PT9M'))\n" + " then xs:gMonth(\"--06\") ne xs:gMonth(\"--06+09:01\")\n" + " else xs:gMonth(\"--06\") ne xs:gMonth(\"--06+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gMonth . */ @org.junit.Test public void cbclGMonthEqual008() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('PT9M'))\n" + " then xs:gMonth(\"--06+09:01\") ne xs:gMonth(\"--06\")\n" + " else xs:gMonth(\"--06+09:00\") ne xs:gMonth(\"--06\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gMonth . */ @org.junit.Test public void cbclGMonthEqual009() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('-PT9M'))\n" + " then xs:gMonth(\"--06\") ne xs:gMonth(\"--06-09:01\")\n" + " else xs:gMonth(\"--06\") ne xs:gMonth(\"--06-09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gMonth . */ @org.junit.Test public void cbclGMonthEqual010() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('-PT9M'))\n" + " then xs:gMonth(\"--06-09:01\") ne xs:gMonth(\"--06\")\n" + " else xs:gMonth(\"--06-09:00\") ne xs:gMonth(\"--06\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gMonth . */ @org.junit.Test public void cbclGMonthEqual011() { final XQuery query = new XQuery( "declare function local:gMonth($gMonth as xs:gMonth, $null as xs:boolean) { if ($null) then () else $gMonth }; exists(local:gMonth(xs:gMonth(\"--12\"), fn:true()) eq xs:gMonth(\"--12\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gMonth . */ @org.junit.Test public void cbclGMonthEqual012() { final XQuery query = new XQuery( "declare function local:gMonth($gMonth as xs:gMonth, $null as xs:boolean) { if ($null) then () else $gMonth }; local:gMonth(xs:gMonth(\"--12\"), fn:false()) eq xs:gMonth(\"--12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gMonth . */ @org.junit.Test public void cbclGMonthEqual013() { final XQuery query = new XQuery( "declare function local:gMonth($gMonth as xs:gMonth, $null as xs:boolean) { if ($null) then () else $gMonth }; exists(local:gMonth(xs:gMonth(\"--12\"), fn:true()) ne xs:gMonth(\"--12\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gMonth . */ @org.junit.Test public void cbclGMonthEqual014() { final XQuery query = new XQuery( "declare function local:gMonth($gMonth as xs:gMonth, $null as xs:boolean) { if ($null) then () else $gMonth }; local:gMonth(xs:gMonth(\"--12\"), fn:false()) ne xs:gMonth(\"--12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gMonth-equal-10 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "gMonth-equal" function used * together with "or" expression (ne operator). * ******************************************************* * . */ @org.junit.Test public void opGMonthEqual10() { final XQuery query = new XQuery( "(xs:gMonth(\"--06Z\") ne xs:gMonth(\"--06Z\")) or (xs:gMonth(\"--08Z\") ne xs:gMonth(\"--09Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gMonth-equal-11 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "gMonth-equal" function used * together with "fn:true"/or expression (eq operator). * ******************************************************* * . */ @org.junit.Test public void opGMonthEqual11() { final XQuery query = new XQuery( "(xs:gMonth(\"--03Z\") eq xs:gMonth(\"--01Z\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gMonth-equal-12 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "gMonth-equal" function used * together with "fn:true"/or expression (ne operator). * ******************************************************* * . */ @org.junit.Test public void opGMonthEqual12() { final XQuery query = new XQuery( "(xs:gMonth(\"--08Z\") ne xs:gMonth(\"--07Z\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gMonth-equal-13 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "gMonth-equal" function used * together with "fn:false"/or expression (eq operator). * ******************************************************* * . */ @org.junit.Test public void opGMonthEqual13() { final XQuery query = new XQuery( "(xs:gMonth(\"--05Z\") eq xs:gMonth(\"--05Z\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gMonth-equal-14 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "gMonth-equal" function used * together with "fn:false"/or expression (ne operator). * ******************************************************* * . */ @org.junit.Test public void opGMonthEqual14() { final XQuery query = new XQuery( "(xs:gMonth(\"--09Z\") ne xs:gMonth(\"--09Z\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gMonth-equal-2 * Date: June 16, 2005 * Purpose: Evaluates The "gMonth-equal" function * As per example 2 (for this function) of the F&O specs * ******************************************************* * . */ @org.junit.Test public void opGMonthEqual2() { final XQuery query = new XQuery( "(xs:gMonth(\"--12-05:00\") eq xs:gMonth(\"--12Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gMonth-equal-3 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "gMonth-equal" function that * return true and used together with fn:not (eq operator) * ******************************************************* * . */ @org.junit.Test public void opGMonthEqual3() { final XQuery query = new XQuery( "fn:not((xs:gMonth(\"--12Z\") eq xs:gMonth(\"--12Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gMonth-equal-4 * Written By: Carmelo Montanez * Date: June 16, 2005 * Purpose: Evaluates The "gMonth-equal" function that * return true and used together with fn:not (ne operator) * ******************************************************* * . */ @org.junit.Test public void opGMonthEqual4() { final XQuery query = new XQuery( "fn:not(xs:gMonth(\"--05Z\") ne xs:gMonth(\"--06Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gMonth-equal-5 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "gMonth-equal" function that * return false and used together with fn:not (eq operator) * ******************************************************* * . */ @org.junit.Test public void opGMonthEqual5() { final XQuery query = new XQuery( "fn:not(xs:gMonth(\"--11Z\") eq xs:gMonth(\"--10Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gMonth-equal-6 * Written By: Carmelo Montanez * Date: June 16, 2005 * Purpose: Evaluates The "gMonth-equal" function that * return false and used together with fn:not(ne operator) * ******************************************************* * . */ @org.junit.Test public void opGMonthEqual6() { final XQuery query = new XQuery( "fn:not(xs:gMonth(\"--05Z\") ne xs:gMonth(\"--05Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gMonth-equal-7 * Written By: Carmelo Montanez * Date: June 16, 2005 * Purpose: Evaluates The "gMonth-equal" function used * together with "and" expression (eq operator). * ******************************************************* * . */ @org.junit.Test public void opGMonthEqual7() { final XQuery query = new XQuery( "(xs:gMonth(\"--04Z\") eq xs:gMonth(\"--02Z\")) and (xs:gMonth(\"--01Z\") eq xs:gMonth(\"--12Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gMonth-equal-8 * Written By: Carmelo Montanez * Date: June 16, 2005 * Purpose: Evaluates The "gMonth-equal" function used * together with "and" expression (ne operator). * ******************************************************* * . */ @org.junit.Test public void opGMonthEqual8() { final XQuery query = new XQuery( "(xs:gMonth(\"--12Z\") ne xs:gMonth(\"--03Z\")) and (xs:gMonth(\"--05Z\") ne xs:gMonth(\"--08Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gMonth-equal-9 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "gMonth-equal" function used * together with "or" expression (eq operator). * ******************************************************* * . */ @org.junit.Test public void opGMonthEqual9() { final XQuery query = new XQuery( "(xs:gMonth(\"--02Z\") eq xs:gMonth(\"--02Z\")) or (xs:gMonth(\"--06Z\") eq xs:gMonth(\"--06Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gMonth-equal2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gMonth-equal" operator * with the arguments set as follows: * $arg1 = xs:gMonth(lower bound) * $arg2 = xs:gMonth(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGMonthEqual2args1() { final XQuery query = new XQuery( "xs:gMonth(\"--01Z\") eq xs:gMonth(\"--01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gMonth-equal2args-10 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gMonth-equal" operator * with the arguments set as follows: * $arg1 = xs:gMonth(lower bound) * $arg2 = xs:gMonth(upper bound) * ******************************************************* * . */ @org.junit.Test public void opGMonthEqual2args10() { final XQuery query = new XQuery( "xs:gMonth(\"--01Z\") ne xs:gMonth(\"--12Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gMonth-equal2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gMonth-equal" operator * with the arguments set as follows: * $arg1 = xs:gMonth(mid range) * $arg2 = xs:gMonth(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGMonthEqual2args2() { final XQuery query = new XQuery( "xs:gMonth(\"--07Z\") eq xs:gMonth(\"--01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gMonth-equal2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gMonth-equal" operator * with the arguments set as follows: * $arg1 = xs:gMonth(upper bound) * $arg2 = xs:gMonth(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGMonthEqual2args3() { final XQuery query = new XQuery( "xs:gMonth(\"--12Z\") eq xs:gMonth(\"--01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gMonth-equal2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gMonth-equal" operator * with the arguments set as follows: * $arg1 = xs:gMonth(lower bound) * $arg2 = xs:gMonth(mid range) * ******************************************************* * . */ @org.junit.Test public void opGMonthEqual2args4() { final XQuery query = new XQuery( "xs:gMonth(\"--01Z\") eq xs:gMonth(\"--07Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gMonth-equal2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gMonth-equal" operator * with the arguments set as follows: * $arg1 = xs:gMonth(lower bound) * $arg2 = xs:gMonth(upper bound) * ******************************************************* * . */ @org.junit.Test public void opGMonthEqual2args5() { final XQuery query = new XQuery( "xs:gMonth(\"--01Z\") eq xs:gMonth(\"--12Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gMonth-equal2args-6 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gMonth-equal" operator * with the arguments set as follows: * $arg1 = xs:gMonth(lower bound) * $arg2 = xs:gMonth(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGMonthEqual2args6() { final XQuery query = new XQuery( "xs:gMonth(\"--01Z\") ne xs:gMonth(\"--01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gMonth-equal2args-7 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gMonth-equal" operator * with the arguments set as follows: * $arg1 = xs:gMonth(mid range) * $arg2 = xs:gMonth(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGMonthEqual2args7() { final XQuery query = new XQuery( "xs:gMonth(\"--07Z\") ne xs:gMonth(\"--01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gMonth-equal2args-8 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gMonth-equal" operator * with the arguments set as follows: * $arg1 = xs:gMonth(upper bound) * $arg2 = xs:gMonth(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGMonthEqual2args8() { final XQuery query = new XQuery( "xs:gMonth(\"--12Z\") ne xs:gMonth(\"--01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gMonth-equal2args-9 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gMonth-equal" operator * with the arguments set as follows: * $arg1 = xs:gMonth(lower bound) * $arg2 = xs:gMonth(mid range) * ******************************************************* * . */ @org.junit.Test public void opGMonthEqual2args9() { final XQuery query = new XQuery( "xs:gMonth(\"--01Z\") ne xs:gMonth(\"--07Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpGYearEqual.java000066400000000000000000001054061222453003200272660ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the gYear-equal() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpGYearEqual extends QT3TestSet { /** * * ******************************************************* * Test: K-gYearEQ-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'eq' for xs:gYear, returning positive. * ******************************************************* * . */ @org.junit.Test public void kGYearEQ1() { final XQuery query = new XQuery( "xs:gYear(\" 1956 \") eq xs:gYear(\"1956\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gYearEQ-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'eq' for xs:gYear. * ******************************************************* * . */ @org.junit.Test public void kGYearEQ2() { final XQuery query = new XQuery( "not(xs:gYear(\"1956\") eq xs:gYear(\"1958\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gYearEQ-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ne' for xs:gYear. * ******************************************************* * . */ @org.junit.Test public void kGYearEQ3() { final XQuery query = new XQuery( "xs:gYear(\"1956\") ne xs:gYear(\"1958\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gYearEQ-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ne' for xs:gYear. * ******************************************************* * . */ @org.junit.Test public void kGYearEQ4() { final XQuery query = new XQuery( "not(xs:gYear(\"1956\") ne xs:gYear(\"1956\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gYearEQ-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset -00:00 is equal to Z, in xs:gYear. * ******************************************************* * . */ @org.junit.Test public void kGYearEQ5() { final XQuery query = new XQuery( "xs:gYear(\"1956-00:00\") eq xs:gYear(\"1956Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gYearEQ-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset +00:00 is equal to Z, in xs:gYear. * ******************************************************* * . */ @org.junit.Test public void kGYearEQ6() { final XQuery query = new XQuery( "xs:gYear(\"1956+00:00\") eq xs:gYear(\"1956Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gYearEQ-7 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset Z is equal to Z, in xs:gYear. * ******************************************************* * . */ @org.junit.Test public void kGYearEQ7() { final XQuery query = new XQuery( "xs:gYear(\"1956Z\") eq xs:gYear(\"1956Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gYearEQ-8 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset -00:00 is equal to +00:00, in xs:gYear. * ******************************************************* * . */ @org.junit.Test public void kGYearEQ8() { final XQuery query = new XQuery( "xs:gYear(\"1956-00:00\") eq xs:gYear(\"1956+00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gYear . */ @org.junit.Test public void cbclGYearEqual001() { final XQuery query = new XQuery( "declare function local:gYear($year as xs:integer) { xs:gYear(string(2000 + $year)) }; not(local:gYear(7) eq xs:gYear(\"2008\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gYear . */ @org.junit.Test public void cbclGYearEqual002() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('PT9M'))\n" + " then xs:gYear(\"2008\") eq xs:gYear(\"2008+09:01\")\n" + " else xs:gYear(\"2008\") eq xs:gYear(\"2008+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gYear . */ @org.junit.Test public void cbclGYearEqual003() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('PT9M'))\n" + " then xs:gYear(\"2008+09:01\") eq xs:gYear(\"2008\")\n" + " else xs:gYear(\"2008+09:00\") eq xs:gYear(\"2008\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gYear . */ @org.junit.Test public void cbclGYearEqual004() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('-PT9M'))\n" + " then xs:gYear(\"2008\") eq xs:gYear(\"2008-09:01\")\n" + " else xs:gYear(\"2008\") eq xs:gYear(\"2008-09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gYear . */ @org.junit.Test public void cbclGYearEqual005() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('-PT9M'))\n" + " then xs:gYear(\"2008-09:01\") eq xs:gYear(\"2008\")\n" + " else xs:gYear(\"2008-09:00\") eq xs:gYear(\"2008\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gYear . */ @org.junit.Test public void cbclGYearEqual006() { final XQuery query = new XQuery( "declare function local:gYear($year as xs:integer) { xs:gYear(string(2000 + $year)) }; not(local:gYear(7) ne xs:gYear(\"2008\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gYear . */ @org.junit.Test public void cbclGYearEqual007() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('PT9M'))\n" + " then xs:gYear(\"2008\") ne xs:gYear(\"2008+09:01\")\n" + " else xs:gYear(\"2008\") ne xs:gYear(\"2008+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gYear . */ @org.junit.Test public void cbclGYearEqual008() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('PT9M'))\n" + " then xs:gYear(\"2008+09:01\") ne xs:gYear(\"2008\")\n" + " else xs:gYear(\"2008+09:00\") ne xs:gYear(\"2008\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gYear . */ @org.junit.Test public void cbclGYearEqual009() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('-PT9M'))\n" + " then xs:gYear(\"2008\") ne xs:gYear(\"2008-09:01\")\n" + " else xs:gYear(\"2008\") ne xs:gYear(\"2008-09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gYear . */ @org.junit.Test public void cbclGYearEqual010() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('-PT9M'))\n" + " then xs:gYear(\"2008-09:01\") ne xs:gYear(\"2008\")\n" + " else xs:gYear(\"2008-09:00\") ne xs:gYear(\"2008\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gYear . */ @org.junit.Test public void cbclGYearEqual011() { final XQuery query = new XQuery( "declare function local:gYear($gYear as xs:gYear, $null as xs:boolean) { if ($null) then () else $gYear }; exists(local:gYear(xs:gYear(\"1972\"), fn:true()) eq xs:gYear(\"1972\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gYear . */ @org.junit.Test public void cbclGYearEqual012() { final XQuery query = new XQuery( "declare function local:gYear($gYear as xs:gYear, $null as xs:boolean) { if ($null) then () else $gYear }; local:gYear(xs:gYear(\"1972\"), fn:false()) ne xs:gYear(\"1972\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gYear . */ @org.junit.Test public void cbclGYearEqual013() { final XQuery query = new XQuery( "declare function local:gYear($gYear as xs:gYear, $null as xs:boolean) { if ($null) then () else $gYear }; exists(local:gYear(xs:gYear(\"1972\"), fn:true()) ne xs:gYear(\"1972\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gYear . */ @org.junit.Test public void cbclGYearEqual014() { final XQuery query = new XQuery( "declare function local:gYear($gYear as xs:gYear, $null as xs:boolean) { if ($null) then () else $gYear }; local:gYear(xs:gYear(\"1972\"), fn:false()) ne xs:gYear(\"1972\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gYear-equal-1 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYear-equal" function * As per example 1 (for this function)of the F&O specs * ******************************************************* * . */ @org.junit.Test public void opGYearEqual1() { final XQuery query = new XQuery( "(xs:gYear(\"2005-12:00\") eq xs:gYear(\"2005+12:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gYear-equal-10 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYear-equal" function used * together with "or" expression (ne operator). * ******************************************************* * . */ @org.junit.Test public void opGYearEqual10() { final XQuery query = new XQuery( "(xs:gYear(\"1976Z\") ne xs:gYear(\"1976Z\")) or (xs:gYear(\"1980Z\") ne xs:gYear(\"1980Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gYear-equal-11 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYear-equal" function used * together with "fn:true"/or expression (eq operator). * ******************************************************* * . */ @org.junit.Test public void opGYearEqual11() { final XQuery query = new XQuery( "(xs:gYear(\"1980Z\") eq xs:gYear(\"1980Z\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gYear-equal-13 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYear-equal" function used * together with "fn:false"/or expression (eq operator). * ******************************************************* * . */ @org.junit.Test public void opGYearEqual13() { final XQuery query = new XQuery( "(xs:gYear(\"1980Z\") eq xs:gYear(\"1980Z\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gYear-equal-14 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYear-equal" function used * together with "fn:false"/or expression (ne operator). * ******************************************************* * . */ @org.junit.Test public void opGYearEqual14() { final XQuery query = new XQuery( "(xs:gYear(\"1980Z\") ne xs:gYear(\"1980Z\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gYear-equal-2 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYear-equal" function * As per example 2 (for this function) of the F&O specs * ******************************************************* * . */ @org.junit.Test public void opGYearEqual2() { final XQuery query = new XQuery( "(xs:gYear(\"1976-05:00\") eq xs:gYear(\"1976-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gYear-equal-5 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYear-equal" function that * return false and used together with fn:not (eq operator) * ******************************************************* * . */ @org.junit.Test public void opGYearEqual5() { final XQuery query = new XQuery( "fn:not(xs:gYear(\"2000Z\") eq xs:gYear(\"2001Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gYear-equal-8 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYear-equal" function used * together with "and" expression (ne operator). * ******************************************************* * . */ @org.junit.Test public void opGYearEqual8() { final XQuery query = new XQuery( "(xs:gYear(\"2000Z\") ne xs:gYear(\"2000Z\")) and (xs:gYear(\"1975Z\") ne xs:gYear(\"1975Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gYear-equal2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gYear-equal" operator * with the arguments set as follows: * $arg1 = xs:gYear(lower bound) * $arg2 = xs:gYear(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGYearEqual2args1() { final XQuery query = new XQuery( "xs:gYear(\"1970Z\") eq xs:gYear(\"1970Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gYear-equal2args-10 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gYear-equal" operator * with the arguments set as follows: * $arg1 = xs:gYear(lower bound) * $arg2 = xs:gYear(upper bound) * ******************************************************* * . */ @org.junit.Test public void opGYearEqual2args10() { final XQuery query = new XQuery( "xs:gYear(\"1970Z\") ne xs:gYear(\"2030Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gYear-equal2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gYear-equal" operator * with the arguments set as follows: * $arg1 = xs:gYear(mid range) * $arg2 = xs:gYear(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGYearEqual2args2() { final XQuery query = new XQuery( "xs:gYear(\"2012Z\") eq xs:gYear(\"1970Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gYear-equal2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gYear-equal" operator * with the arguments set as follows: * $arg1 = xs:gYear(upper bound) * $arg2 = xs:gYear(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGYearEqual2args3() { final XQuery query = new XQuery( "xs:gYear(\"2030Z\") eq xs:gYear(\"1970Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gYear-equal2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gYear-equal" operator * with the arguments set as follows: * $arg1 = xs:gYear(lower bound) * $arg2 = xs:gYear(mid range) * ******************************************************* * . */ @org.junit.Test public void opGYearEqual2args4() { final XQuery query = new XQuery( "xs:gYear(\"1970Z\") eq xs:gYear(\"2012Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gYear-equal2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gYear-equal" operator * with the arguments set as follows: * $arg1 = xs:gYear(lower bound) * $arg2 = xs:gYear(upper bound) * ******************************************************* * . */ @org.junit.Test public void opGYearEqual2args5() { final XQuery query = new XQuery( "xs:gYear(\"1970Z\") eq xs:gYear(\"2030Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gYear-equal2args-6 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gYear-equal" operator * with the arguments set as follows: * $arg1 = xs:gYear(lower bound) * $arg2 = xs:gYear(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGYearEqual2args6() { final XQuery query = new XQuery( "xs:gYear(\"1970Z\") ne xs:gYear(\"1970Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gYear-equal2args-7 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gYear-equal" operator * with the arguments set as follows: * $arg1 = xs:gYear(mid range) * $arg2 = xs:gYear(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGYearEqual2args7() { final XQuery query = new XQuery( "xs:gYear(\"2012Z\") ne xs:gYear(\"1970Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gYear-equal2args-8 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gYear-equal" operator * with the arguments set as follows: * $arg1 = xs:gYear(upper bound) * $arg2 = xs:gYear(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGYearEqual2args8() { final XQuery query = new XQuery( "xs:gYear(\"2030Z\") ne xs:gYear(\"1970Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gYear-equal2args-9 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gYear-equal" operator * with the arguments set as follows: * $arg1 = xs:gYear(lower bound) * $arg2 = xs:gYear(mid range) * ******************************************************* * . */ @org.junit.Test public void opGYearEqual2args9() { final XQuery query = new XQuery( "xs:gYear(\"1970Z\") ne xs:gYear(\"2012Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gYear-equal-12 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYear-equal" function used * together with "fn:true"/or expression (ne operator). * ******************************************************* * . */ @org.junit.Test public void opGYearEqualNew12() { final XQuery query = new XQuery( "(xs:gYear(\"2000Z\") ne xs:gYear(\"2000Z\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gYear-equal-3 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYear-equal" function that * return true and used together with fn:not (eq operator) * ******************************************************* * . */ @org.junit.Test public void opGYearEqualNew3() { final XQuery query = new XQuery( "fn:not((xs:gYear(\"1995Z\") eq xs:gYear(\"1995Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gYear-equal-4 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYear-equal" function that * return true and used together with fn:not (ne operator) * ******************************************************* * . */ @org.junit.Test public void opGYearEqualNew4() { final XQuery query = new XQuery( "fn:not(xs:gYear(\"2005Z\") ne xs:gYear(\"2006Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gYear-equal-6 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYear-equal" function that * return false and used together with fn:not(ne operator) * ******************************************************* * . */ @org.junit.Test public void opGYearEqualNew6() { final XQuery query = new XQuery( "fn:not(xs:gYear(\"2005Z\") ne xs:gYear(\"2005Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gYear-equal-7 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYear-equal" function used * together with "and" expression (eq operator). * ******************************************************* * . */ @org.junit.Test public void opGYearEqualNew7() { final XQuery query = new XQuery( "(xs:gYear(\"2000Z\") eq xs:gYear(\"2000Z\")) and (xs:gYear(\"2001Z\") eq xs:gYear(\"2001Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gYear-equal-9 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYear-equal" function used * together with "or" expression (eq operator). * ******************************************************* * . */ @org.junit.Test public void opGYearEqualNew9() { final XQuery query = new XQuery( "(xs:gYear(\"2000Z\") eq xs:gYear(\"2000Z\")) or (xs:gYear(\"1976Z\") eq xs:gYear(\"1976Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpGYearMonthEqual.java000066400000000000000000001102261222453003200302700ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the gYearMonth-equal() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpGYearMonthEqual extends QT3TestSet { /** * * ******************************************************* * Test: K-gYearMonthEQ-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'eq' for xs:gYearMonth, returning positive. * ******************************************************* * . */ @org.junit.Test public void kGYearMonthEQ1() { final XQuery query = new XQuery( "xs:gYearMonth(\"2001-01 \") eq xs:gYearMonth(\"2001-01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gYearMonthEQ-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'eq' for xs:gYearMonth. * ******************************************************* * . */ @org.junit.Test public void kGYearMonthEQ2() { final XQuery query = new XQuery( "not(xs:gYearMonth(\"2001-03\") eq xs:gYearMonth(\"2000-03\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gYearMonthEQ-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ne' for xs:gYearMonth. * ******************************************************* * . */ @org.junit.Test public void kGYearMonthEQ3() { final XQuery query = new XQuery( "xs:gYearMonth(\"2001-12\") ne xs:gYearMonth(\"2001-11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gYearMonthEQ-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ne' for xs:gYearMonth. * ******************************************************* * . */ @org.junit.Test public void kGYearMonthEQ4() { final XQuery query = new XQuery( "not(xs:gYearMonth(\"1995-11\") ne xs:gYearMonth(\"1995-11\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gYearMonthEQ-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset -00:00 is equal to Z, in xs:gYearMonth. * ******************************************************* * . */ @org.junit.Test public void kGYearMonthEQ5() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-01-00:00\") eq xs:gYearMonth(\"1999-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gYearMonthEQ-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset +00:00 is equal to Z, in xs:gYearMonth. * ******************************************************* * . */ @org.junit.Test public void kGYearMonthEQ6() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-01+00:00\") eq xs:gYearMonth(\"1999-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gYearMonthEQ-7 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset Z is equal to Z, in xs:gYearMonth. * ******************************************************* * . */ @org.junit.Test public void kGYearMonthEQ7() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-01Z\") eq xs:gYearMonth(\"1999-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-gYearMonthEQ-8 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset -00:00 is equal to +00:00, in xs:gYearMonth. * ******************************************************* * . */ @org.junit.Test public void kGYearMonthEQ8() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-01-00:00\") eq xs:gYearMonth(\"1999-01+00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gYearMonth . */ @org.junit.Test public void cbclGYearMonthEqual001() { final XQuery query = new XQuery( "declare function local:gYearMonth($year as xs:integer) { xs:gYearMonth(concat(string(2000 + $year), \"-01\")) }; not(local:gYearMonth(7) eq xs:gYearMonth(\"2008-01\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gYearMonth . */ @org.junit.Test public void cbclGYearMonthEqual002() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('PT9M'))\n" + " then xs:gYearMonth(\"2008-01\") eq xs:gYearMonth(\"2008-01+09:01\")\n" + " else xs:gYearMonth(\"2008-01\") eq xs:gYearMonth(\"2008-01+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gYearMonth . */ @org.junit.Test public void cbclGYearMonthEqual003() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('PT9M'))\n" + " then xs:gYearMonth(\"2008-01+09:01\") eq xs:gYearMonth(\"2008-01\")\n" + " else xs:gYearMonth(\"2008-01+09:00\") eq xs:gYearMonth(\"2008-01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gYearMonth . */ @org.junit.Test public void cbclGYearMonthEqual004() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('-PT9M'))\n" + " then xs:gYearMonth(\"2008-01\") eq xs:gYearMonth(\"2008-01-09:01\")\n" + " else xs:gYearMonth(\"2008-01\") eq xs:gYearMonth(\"2008-01-09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gYearMonth . */ @org.junit.Test public void cbclGYearMonthEqual005() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('-PT9M'))\n" + " then xs:gYearMonth(\"2008-01-09:01\") eq xs:gYearMonth(\"2008-01\")\n" + " else xs:gYearMonth(\"2008-01-09:00\") eq xs:gYearMonth(\"2008-01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gYearMonth . */ @org.junit.Test public void cbclGYearMonthEqual006() { final XQuery query = new XQuery( "declare function local:gYearMonth($year as xs:integer) { xs:gYearMonth(concat(string(2000 + $year), \"-01\")) }; not(local:gYearMonth(7) ne xs:gYearMonth(\"2008-01\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gYearMonth . */ @org.junit.Test public void cbclGYearMonthEqual007() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('PT9M'))\n" + " then xs:gYearMonth(\"2008-01\") ne xs:gYearMonth(\"2008-01+09:01\")\n" + " else xs:gYearMonth(\"2008-01\") ne xs:gYearMonth(\"2008-01+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gYearMonth . */ @org.junit.Test public void cbclGYearMonthEqual008() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('PT9M'))\n" + " then xs:gYearMonth(\"2008-01+09:01\") ne xs:gYearMonth(\"2008-01\")\n" + " else xs:gYearMonth(\"2008-01+09:00\") ne xs:gYearMonth(\"2008-01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gYearMonth . */ @org.junit.Test public void cbclGYearMonthEqual009() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('-PT9M'))\n" + " then xs:gYearMonth(\"2008-01\") ne xs:gYearMonth(\"2008-01-09:01\")\n" + " else xs:gYearMonth(\"2008-01\") ne xs:gYearMonth(\"2008-01-09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gYearMonth . */ @org.junit.Test public void cbclGYearMonthEqual010() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('-PT9M'))\n" + " then xs:gYearMonth(\"2008-01-09:01\") ne xs:gYearMonth(\"2008-01\")\n" + " else xs:gYearMonth(\"2008-01-09:00\") ne xs:gYearMonth(\"2008-01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gYearMonth . */ @org.junit.Test public void cbclGYearMonthEqual011() { final XQuery query = new XQuery( "declare function local:gYearMonth($gYearMonth as xs:gYearMonth, $null as xs:boolean) { if ($null) then () else $gYearMonth }; exists(local:gYearMonth(xs:gYearMonth(\"1972-12\"), fn:true()) eq xs:gYearMonth(\"1972-12\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gYearMonth . */ @org.junit.Test public void cbclGYearMonthEqual012() { final XQuery query = new XQuery( "declare function local:gYearMonth($gYearMonth as xs:gYearMonth, $null as xs:boolean) { if ($null) then () else $gYearMonth }; local:gYearMonth(xs:gYearMonth(\"1972-12\"), fn:false()) eq xs:gYearMonth(\"1972-12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of gYearMonth . */ @org.junit.Test public void cbclGYearMonthEqual013() { final XQuery query = new XQuery( "declare function local:gYearMonth($gYearMonth as xs:gYearMonth, $null as xs:boolean) { if ($null) then () else $gYearMonth }; exists(local:gYearMonth(xs:gYearMonth(\"1972-12\"), fn:true()) ne xs:gYearMonth(\"1972-12\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of gYearMonth . */ @org.junit.Test public void cbclGYearMonthEqual014() { final XQuery query = new XQuery( "declare function local:gYearMonth($gYearMonth as xs:gYearMonth, $null as xs:boolean) { if ($null) then () else $gYearMonth }; local:gYearMonth(xs:gYearMonth(\"1972-12\"), fn:false()) ne xs:gYearMonth(\"1972-12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gYearMonth-equal2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gYearMonth-equal" operator * with the arguments set as follows: * $arg1 = xs:gYearMonth(lower bound) * $arg2 = xs:gYearMonth(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGYearMonthEqual2args1() { final XQuery query = new XQuery( "xs:gYearMonth(\"1970-01Z\") eq xs:gYearMonth(\"1970-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gYearMonth-equal2args-10 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gYearMonth-equal" operator * with the arguments set as follows: * $arg1 = xs:gYearMonth(lower bound) * $arg2 = xs:gYearMonth(upper bound) * ******************************************************* * . */ @org.junit.Test public void opGYearMonthEqual2args10() { final XQuery query = new XQuery( "xs:gYearMonth(\"1970-01Z\") ne xs:gYearMonth(\"2030-12Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gYearMonth-equal2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gYearMonth-equal" operator * with the arguments set as follows: * $arg1 = xs:gYearMonth(mid range) * $arg2 = xs:gYearMonth(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGYearMonthEqual2args2() { final XQuery query = new XQuery( "xs:gYearMonth(\"1984-12Z\") eq xs:gYearMonth(\"1970-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gYearMonth-equal2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gYearMonth-equal" operator * with the arguments set as follows: * $arg1 = xs:gYearMonth(upper bound) * $arg2 = xs:gYearMonth(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGYearMonthEqual2args3() { final XQuery query = new XQuery( "xs:gYearMonth(\"2030-12Z\") eq xs:gYearMonth(\"1970-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gYearMonth-equal2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gYearMonth-equal" operator * with the arguments set as follows: * $arg1 = xs:gYearMonth(lower bound) * $arg2 = xs:gYearMonth(mid range) * ******************************************************* * . */ @org.junit.Test public void opGYearMonthEqual2args4() { final XQuery query = new XQuery( "xs:gYearMonth(\"1970-01Z\") eq xs:gYearMonth(\"1984-12Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gYearMonth-equal2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gYearMonth-equal" operator * with the arguments set as follows: * $arg1 = xs:gYearMonth(lower bound) * $arg2 = xs:gYearMonth(upper bound) * ******************************************************* * . */ @org.junit.Test public void opGYearMonthEqual2args5() { final XQuery query = new XQuery( "xs:gYearMonth(\"1970-01Z\") eq xs:gYearMonth(\"2030-12Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gYearMonth-equal2args-6 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gYearMonth-equal" operator * with the arguments set as follows: * $arg1 = xs:gYearMonth(lower bound) * $arg2 = xs:gYearMonth(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGYearMonthEqual2args6() { final XQuery query = new XQuery( "xs:gYearMonth(\"1970-01Z\") ne xs:gYearMonth(\"1970-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gYearMonth-equal2args-7 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gYearMonth-equal" operator * with the arguments set as follows: * $arg1 = xs:gYearMonth(mid range) * $arg2 = xs:gYearMonth(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGYearMonthEqual2args7() { final XQuery query = new XQuery( "xs:gYearMonth(\"1984-12Z\") ne xs:gYearMonth(\"1970-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gYearMonth-equal2args-8 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gYearMonth-equal" operator * with the arguments set as follows: * $arg1 = xs:gYearMonth(upper bound) * $arg2 = xs:gYearMonth(lower bound) * ******************************************************* * . */ @org.junit.Test public void opGYearMonthEqual2args8() { final XQuery query = new XQuery( "xs:gYearMonth(\"2030-12Z\") ne xs:gYearMonth(\"1970-01Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gYearMonth-equal2args-9 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:gYearMonth-equal" operator * with the arguments set as follows: * $arg1 = xs:gYearMonth(lower bound) * $arg2 = xs:gYearMonth(mid range) * ******************************************************* * . */ @org.junit.Test public void opGYearMonthEqual2args9() { final XQuery query = new XQuery( "xs:gYearMonth(\"1970-01Z\") ne xs:gYearMonth(\"1984-12Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gYearMonth-equal-1 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYearMonth-equal" function * As per example 1 (for this function)of the F&O specs * ******************************************************* * . */ @org.junit.Test public void opGYearMonthEqualNew1() { final XQuery query = new XQuery( "(xs:gYearMonth(\"1976-02-05:00\") eq xs:gYearMonth(\"1976-03Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gYearMonth-equal-10 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYearMonth-equal" function used * together with "or" expression (ne operator). * ******************************************************* * . */ @org.junit.Test public void opGYearMonthEqualNew10() { final XQuery query = new XQuery( "(xs:gYearMonth(\"1976-01Z\") ne xs:gYearMonth(\"1976-02Z\")) or (xs:gYearMonth(\"1980-03Z\") ne xs:gYearMonth(\"1980-04Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gYearMonth-equal-11 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYearMonth-equal" function used * together with "fn:true"/or expression (eq operator). * ******************************************************* * . */ @org.junit.Test public void opGYearMonthEqualNew11() { final XQuery query = new XQuery( "(xs:gYearMonth(\"1980-05Z\") eq xs:gYearMonth(\"1980-05Z\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gYearMonth-equal-12 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYearMonth-equal" function used * together with "fn:true"/or expression (ne operator). * ******************************************************* * . */ @org.junit.Test public void opGYearMonthEqualNew12() { final XQuery query = new XQuery( "(xs:gYearMonth(\"2000-06Z\") ne xs:gYearMonth(\"2000-07Z\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gYearMonth-equal-13 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYearMonth-equal" function used * together with "fn:false"/or expression (eq operator). * ******************************************************* * . */ @org.junit.Test public void opGYearMonthEqualNew13() { final XQuery query = new XQuery( "(xs:gYearMonth(\"1980-09Z\") eq xs:gYearMonth(\"1980-09Z\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gYearMonth-equal-14 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYearMonth-equal" function used * together with "fn:false"/or expression (ne operator). * ******************************************************* * . */ @org.junit.Test public void opGYearMonthEqualNew14() { final XQuery query = new XQuery( "(xs:gYearMonth(\"1980-03Z\") ne xs:gYearMonth(\"1980-03Z\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gYearMonth-equal-2 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYearMonth-equal" function * As per example 2 (for this function) of the F&O specs * ******************************************************* * . */ @org.junit.Test public void opGYearMonthEqualNew2() { final XQuery query = new XQuery( "(xs:gYearMonth(\"1976-03-05:00\") eq xs:gYearMonth(\"1976-03Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gYearMonth-equal-3 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYearMonth-equal" function that * return true and used together with fn:not (eq operator) * ******************************************************* * . */ @org.junit.Test public void opGYearMonthEqualNew3() { final XQuery query = new XQuery( "fn:not((xs:gYearMonth(\"1995-02Z\") eq xs:gYearMonth(\"1995-02Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gYearMonth-equal-4 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYearMonth-equal" function that * return true and used together with fn:not (le operator) * ******************************************************* * . */ @org.junit.Test public void opGYearMonthEqualNew4() { final XQuery query = new XQuery( "fn:not(xs:gYearMonth(\"2005-02Z\") ne xs:gYearMonth(\"2006-03Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gYearMonth-equal-5 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYearMonth-equal" function that * return false and used together with fn:not (eq operator) * ******************************************************* * . */ @org.junit.Test public void opGYearMonthEqualNew5() { final XQuery query = new XQuery( "fn:not(xs:gYearMonth(\"2000-01Z\") eq xs:gYearMonth(\"2001-04Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gYearMonth-equal-6 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYearMonth-equal" function that * return false and used together with fn:not(ne operator) * ******************************************************* * . */ @org.junit.Test public void opGYearMonthEqualNew6() { final XQuery query = new XQuery( "fn:not(xs:gYearMonth(\"2005-01Z\") ne xs:gYearMonth(\"2005-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-gYearMonth-equal-7 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYearMonth-equal" function used * together with "and" expression (eq operator). * ******************************************************* * . */ @org.junit.Test public void opGYearMonthEqualNew7() { final XQuery query = new XQuery( "(xs:gYearMonth(\"2000-02Z\") eq xs:gYearMonth(\"2000-03Z\")) and (xs:gYearMonth(\"2001-01Z\") eq xs:gYearMonth(\"2001-01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gYearMonth-equal-8 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYearMonth-equal" function used * together with "and" expression (ne operator). * ******************************************************* * . */ @org.junit.Test public void opGYearMonthEqualNew8() { final XQuery query = new XQuery( "(xs:gYearMonth(\"2000-01Z\") ne xs:gYearMonth(\"2000-01Z\")) and (xs:gYearMonth(\"1975-01Z\") ne xs:gYearMonth(\"1975-03Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-gYearMonth-equal-9 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "gYearMonth-equal" function used * together with "or" expression (eq operator). * ******************************************************* * . */ @org.junit.Test public void opGYearMonthEqualNew9() { final XQuery query = new XQuery( "(xs:gYearMonth(\"2000-01Z\") eq xs:gYearMonth(\"2000-03Z\")) or (xs:gYearMonth(\"1976-06Z\") eq xs:gYearMonth(\"1976-06Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpHexBinaryEqual.java000066400000000000000000000610041222453003200301430ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the hexBinary-equal() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpHexBinaryEqual extends QT3TestSet { /** * * ******************************************************* * Test: K-HexBinaryEQ-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Compare two hexBinary values. * ******************************************************* * . */ @org.junit.Test public void kHexBinaryEQ1() { final XQuery query = new XQuery( "xs:hexBinary(\"FF\") eq xs:hexBinary(\"ff\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-HexBinaryEQ-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Compare two hexBinary values. * ******************************************************* * . */ @org.junit.Test public void kHexBinaryEQ2() { final XQuery query = new XQuery( "xs:hexBinary(\"FF\") ne xs:hexBinary(\"aa\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-HexBinaryEQ-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Compare two hexBinary values. * ******************************************************* * . */ @org.junit.Test public void kHexBinaryEQ3() { final XQuery query = new XQuery( "not(xs:hexBinary(\"FF\") eq xs:hexBinary(\"aa\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-HexBinaryEQ-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Complex comparison test of wrapped hexBinary/base64Binary constructor functions. * ******************************************************* * . */ @org.junit.Test public void kHexBinaryEQ4() { final XQuery query = new XQuery( "xs:hexBinary(xs:base64Binary(xs:hexBinary(\"03\"))) eq xs:hexBinary(\"03\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-HexBinaryEQ-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Complex comparison test of wrapped hexBinary/base64Binary constructor functions. * ******************************************************* * . */ @org.junit.Test public void kHexBinaryEQ5() { final XQuery query = new XQuery( "xs:hexBinary(xs:base64Binary(xs:hexBinary(\"03\"))) ne xs:hexBinary(\"13\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test equality of xs:hexBinary . */ @org.junit.Test public void cbclHexBinaryEqual001() { final XQuery query = new XQuery( "declare function local:hexBinary-value($arg as xs:boolean) as xs:hexBinary { if ($arg) then xs:hexBinary('68656c6c6f') else xs:hexBinary('676f6f64627965') }; local:hexBinary-value(true()) eq local:hexBinary-value(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test equality of xs:hexBinary . */ @org.junit.Test public void cbclHexBinaryEqual002() { final XQuery query = new XQuery( "declare function local:hexBinary-value($arg as xs:boolean) as xs:hexBinary { if ($arg) then xs:hexBinary('68656c6c6f') else xs:hexBinary('676f6f64627965') }; not(local:hexBinary-value(true()) eq local:hexBinary-value(false()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test equality of xs:hexBinary . */ @org.junit.Test public void cbclHexBinaryEqual003() { final XQuery query = new XQuery( "declare function local:hexBinary-value($arg as xs:boolean) as xs:hexBinary { if ($arg) then xs:hexBinary('68656c6c6f') else xs:hexBinary('676f6f64627965') }; not(local:hexBinary-value(true()) ne local:hexBinary-value(false()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Test: hexBinary-1 * Description: Simple Binary hex operation as part of a * logical expression. Use "and" and "eq" operators. * . */ @org.junit.Test public void hexBinary1() { final XQuery query = new XQuery( "(xs:hexBinary(\"786174616d61616772\") eq xs:hexBinary(\"767479716c6a647663\")) and (xs:hexBinary(\"786174616d61616772\") eq xs:hexBinary(\"767479716c6a647663\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Test: hexBinary-10 * Description: Simple Binary hex opeartion as part of argument to fn:not function. * . */ @org.junit.Test public void hexBinary10() { final XQuery query = new XQuery( "fn:not((xs:hexBinary(\"786174616d61616772\") ne xs:hexBinary(\"786174616d61616772\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Test: hexBinary-11 * Description: Simple Binary hex operation as part of a * logical expression. Use "and" and "ne" operators with "fn:true" function. * . */ @org.junit.Test public void hexBinary11() { final XQuery query = new XQuery( "(xs:hexBinary(\"786174616d61616772\") ne xs:hexBinary(\"767479716c6a647663\")) and fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Test: hexBinary-12 * Description: Simple Binary hex operation as part of a * logical expression. Use "and" and "ne" operators with "fn:false" function. * . */ @org.junit.Test public void hexBinary12() { final XQuery query = new XQuery( "(xs:hexBinary(\"786174616d61616772\") ne xs:hexBinary(\"767479716c6a647663\")) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Test: hexBinary-13 * Description: Simple Binary hex operation as part of a * logical expression. Use "or" and "ne" operators and "fn:true" function. * . */ @org.junit.Test public void hexBinary13() { final XQuery query = new XQuery( "(xs:hexBinary(\"786174616d61616772\") ne xs:hexBinary(\"767479716c6a647663\")) or fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Test: hexBinary-14 * Description: Simple Binary hex operation as part of a * logical expression. Use "or" and "ne" operators and "fn:false" function. * . */ @org.junit.Test public void hexBinary14() { final XQuery query = new XQuery( "(xs:hexBinary(\"786174616d61616772\") ne xs:hexBinary(\"767479716c6a647663\")) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Test: hexBinary-2 * Description: Simple Binary hex operation as part of a * logical expression. Use "and" and "eq" operators. * . */ @org.junit.Test public void hexBinary2() { final XQuery query = new XQuery( "(xs:hexBinary(\"786174616d61616772\") eq xs:hexBinary(\"767479716c6a647663\")) or (xs:hexBinary(\"786174616d61616772\") eq xs:hexBinary(\"767479716c6a647663\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Test: hexBinary-3 * Description: Simple Binary hex opeartion as part of argument to fn:not function. * . */ @org.junit.Test public void hexBinary3() { final XQuery query = new XQuery( "fn:not((xs:hexBinary(\"786174616d61616772\") eq xs:hexBinary(\"786174616d61616772\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Test: hexBinary-4 * Description: Simple Binary hex operation as part of a * logical expression. Use "and" and "eq" operators with "fn:true" function. * . */ @org.junit.Test public void hexBinary4() { final XQuery query = new XQuery( "(xs:hexBinary(\"786174616d61616772\") eq xs:hexBinary(\"767479716c6a647663\")) and fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Test: hexBinary-5 * Description: Simple Binary hex operation as part of a * logical expression. Use "and" and "eq" operators with "fn:false" function. * . */ @org.junit.Test public void hexBinary5() { final XQuery query = new XQuery( "(xs:hexBinary(\"786174616d61616772\") eq xs:hexBinary(\"767479716c6a647663\")) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Test: hexBinary-6 * Description: Simple Binary hex operation as part of a * logical expression. Use "or" and "eq" operators and "fn:true" function. * . */ @org.junit.Test public void hexBinary6() { final XQuery query = new XQuery( "(xs:hexBinary(\"786174616d61616772\") eq xs:hexBinary(\"767479716c6a647663\")) or fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Test: hexBinary-7 * Description: Simple Binary hex operation as part of a * logical expression. Use "or" and "eq" operators and "fn:false" function. * . */ @org.junit.Test public void hexBinary7() { final XQuery query = new XQuery( "(xs:hexBinary(\"786174616d61616772\") eq xs:hexBinary(\"767479716c6a647663\")) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Test: hexBinary-8 * Description: Simple Binary hex operation as part of a * logical expression. Use "and" and "ne" operators. * . */ @org.junit.Test public void hexBinary8() { final XQuery query = new XQuery( "(xs:hexBinary(\"786174616d61616772\") ne xs:hexBinary(\"767479716c6a647663\")) and (xs:hexBinary(\"786174616d61616772\") ne xs:hexBinary(\"767479716c6a647663\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Test: hexBinary-9 * Description: Simple Binary hex operation as part of a * logical expression. Use "and" and "eq" operators. * . */ @org.junit.Test public void hexBinary9() { final XQuery query = new XQuery( "(xs:hexBinary(\"786174616d61616772\") ne xs:hexBinary(\"767479716c6a647663\")) or (xs:hexBinary(\"786174616d61616772\") ne xs:hexBinary(\"767479716c6a647663\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-hexBinary-equal2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:18 GMT-05:00 2004 * Purpose: Evaluates The "op:hexBinary-equal" operator * with the arguments set as follows: * $value1 = xs:hexBinary(lower bound) * $value2 = xs:hexBinary(lower bound) * ******************************************************* * . */ @org.junit.Test public void opHexBinaryEqual2args1() { final XQuery query = new XQuery( "xs:hexBinary(\"767479716c6a647663\") eq xs:hexBinary(\"767479716c6a647663\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-hexBinary-equal2args-10 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:18 GMT-05:00 2004 * Purpose: Evaluates The "op:hexBinary-equal" operator * with the arguments set as follows: * $value1 = xs:hexBinary(lower bound) * $value2 = xs:hexBinary(upper bound) * ******************************************************* * . */ @org.junit.Test public void opHexBinaryEqual2args10() { final XQuery query = new XQuery( "xs:hexBinary(\"767479716c6a647663\") ne xs:hexBinary(\"786174616d61616772\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-hexBinary-equal2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:18 GMT-05:00 2004 * Purpose: Evaluates The "op:hexBinary-equal" operator * with the arguments set as follows: * $value1 = xs:hexBinary(mid range) * $value2 = xs:hexBinary(lower bound) * ******************************************************* * . */ @org.junit.Test public void opHexBinaryEqual2args2() { final XQuery query = new XQuery( "xs:hexBinary(\"6e7875626264756366\") eq xs:hexBinary(\"767479716c6a647663\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-hexBinary-equal2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:18 GMT-05:00 2004 * Purpose: Evaluates The "op:hexBinary-equal" operator * with the arguments set as follows: * $value1 = xs:hexBinary(upper bound) * $value2 = xs:hexBinary(lower bound) * ******************************************************* * . */ @org.junit.Test public void opHexBinaryEqual2args3() { final XQuery query = new XQuery( "xs:hexBinary(\"786174616d61616772\") eq xs:hexBinary(\"767479716c6a647663\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-hexBinary-equal2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:18 GMT-05:00 2004 * Purpose: Evaluates The "op:hexBinary-equal" operator * with the arguments set as follows: * $value1 = xs:hexBinary(lower bound) * $value2 = xs:hexBinary(mid range) * ******************************************************* * . */ @org.junit.Test public void opHexBinaryEqual2args4() { final XQuery query = new XQuery( "xs:hexBinary(\"767479716c6a647663\") eq xs:hexBinary(\"6e7875626264756366\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-hexBinary-equal2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:18 GMT-05:00 2004 * Purpose: Evaluates The "op:hexBinary-equal" operator * with the arguments set as follows: * $value1 = xs:hexBinary(lower bound) * $value2 = xs:hexBinary(upper bound) * ******************************************************* * . */ @org.junit.Test public void opHexBinaryEqual2args5() { final XQuery query = new XQuery( "xs:hexBinary(\"767479716c6a647663\") eq xs:hexBinary(\"786174616d61616772\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-hexBinary-equal2args-6 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:18 GMT-05:00 2004 * Purpose: Evaluates The "op:hexBinary-equal" operator * with the arguments set as follows: * $value1 = xs:hexBinary(lower bound) * $value2 = xs:hexBinary(lower bound) * ******************************************************* * . */ @org.junit.Test public void opHexBinaryEqual2args6() { final XQuery query = new XQuery( "xs:hexBinary(\"767479716c6a647663\") ne xs:hexBinary(\"767479716c6a647663\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-hexBinary-equal2args-7 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:18 GMT-05:00 2004 * Purpose: Evaluates The "op:hexBinary-equal" operator * with the arguments set as follows: * $value1 = xs:hexBinary(mid range) * $value2 = xs:hexBinary(lower bound) * ******************************************************* * . */ @org.junit.Test public void opHexBinaryEqual2args7() { final XQuery query = new XQuery( "xs:hexBinary(\"6e7875626264756366\") ne xs:hexBinary(\"767479716c6a647663\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-hexBinary-equal2args-8 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:18 GMT-05:00 2004 * Purpose: Evaluates The "op:hexBinary-equal" operator * with the arguments set as follows: * $value1 = xs:hexBinary(upper bound) * $value2 = xs:hexBinary(lower bound) * ******************************************************* * . */ @org.junit.Test public void opHexBinaryEqual2args8() { final XQuery query = new XQuery( "xs:hexBinary(\"786174616d61616772\") ne xs:hexBinary(\"767479716c6a647663\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-hexBinary-equal2args-9 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:18 GMT-05:00 2004 * Purpose: Evaluates The "op:hexBinary-equal" operator * with the arguments set as follows: * $value1 = xs:hexBinary(lower bound) * $value2 = xs:hexBinary(mid range) * ******************************************************* * . */ @org.junit.Test public void opHexBinaryEqual2args9() { final XQuery query = new XQuery( "xs:hexBinary(\"767479716c6a647663\") ne xs:hexBinary(\"6e7875626264756366\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpIntersect.java000066400000000000000000000740741222453003200272350ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the intersect() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpIntersect extends QT3TestSet { /** * Only nodes are allowed.. */ @org.junit.Test public void k2SeqIntersect1() { final XQuery query = new XQuery( "(1, 2, 3) intersect (1, 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Use a node kind keyword, document, to test query parsing.. */ @org.junit.Test public void k2SeqIntersect10() { final XQuery query = new XQuery( "empty(/(author intersect document))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, if, to test query parsing.. */ @org.junit.Test public void k2SeqIntersect11() { final XQuery query = new XQuery( "empty(/(author intersect if))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, then, to test query parsing.. */ @org.junit.Test public void k2SeqIntersect12() { final XQuery query = new XQuery( "empty(/(author intersect then))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, mod, to test query parsing.. */ @org.junit.Test public void k2SeqIntersect13() { final XQuery query = new XQuery( "empty(/(author intersect mod))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, div, to test query parsing.. */ @org.junit.Test public void k2SeqIntersect14() { final XQuery query = new XQuery( "empty(/(author intersect div))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, empty-sequence, to test query parsing.. */ @org.junit.Test public void k2SeqIntersect15() { final XQuery query = new XQuery( "empty(/(author intersect empty-sequence))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, schema-attribute, to test query parsing.. */ @org.junit.Test public void k2SeqIntersect16() { final XQuery query = new XQuery( "empty(/(author intersect schema-attribute))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, schema-element, to test query parsing.. */ @org.junit.Test public void k2SeqIntersect17() { final XQuery query = new XQuery( "empty(/(author intersect schema-element))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a computed attribute constructor as right operand.. */ @org.junit.Test public void k2SeqIntersect18() { final XQuery query = new XQuery( "empty(/(a intersect attribute {\"name\"} {()}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a computed attribute constructor as right operand(#2).. */ @org.junit.Test public void k2SeqIntersect19() { final XQuery query = new XQuery( "empty(/(a intersect attribute name {()}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, text, to test query parsing.. */ @org.junit.Test public void k2SeqIntersect2() { final XQuery query = new XQuery( "empty(/(author intersect text))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a computed attribute constructor as right operand.. */ @org.junit.Test public void k2SeqIntersect20() { final XQuery query = new XQuery( "empty(/(a intersect element {\"name\"} {()}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Use a computed attribute constructor as right operand(#2).. */ @org.junit.Test public void k2SeqIntersect21() { final XQuery query = new XQuery( "empty(/(a intersect element name {()}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Use a computed attribute constructor as right operand.. */ @org.junit.Test public void k2SeqIntersect22() { final XQuery query = new XQuery( "empty(/(a intersect processing-instruction {\"name\"} {()}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a computed attribute constructor as right operand.. */ @org.junit.Test public void k2SeqIntersect23() { final XQuery query = new XQuery( "empty(/(a intersect processing-instruction name {}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a computed attribute constructor as right operand.. */ @org.junit.Test public void k2SeqIntersect24() { final XQuery query = new XQuery( "empty(/(a intersect comment {()}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a computed attribute constructor as right operand.. */ @org.junit.Test public void k2SeqIntersect25() { final XQuery query = new XQuery( "empty(/(a intersect text {()}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that is the descendant axis as right operand.. */ @org.junit.Test public void k2SeqIntersect26() { final XQuery query = new XQuery( "empty(/(a intersect descendant))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that is the attribute axis as right operand.. */ @org.junit.Test public void k2SeqIntersect27() { final XQuery query = new XQuery( "empty(/(a intersect attribute))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that is the self axis as right operand.. */ @org.junit.Test public void k2SeqIntersect28() { final XQuery query = new XQuery( "empty(/(a intersect self))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that is the descendant-or-self axis as right operand.. */ @org.junit.Test public void k2SeqIntersect29() { final XQuery query = new XQuery( "empty(/(a intersect descendant-or-self))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, node, to test query parsing.. */ @org.junit.Test public void k2SeqIntersect3() { final XQuery query = new XQuery( "empty(/(author intersect node))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that is the following-sibling axis as right operand.. */ @org.junit.Test public void k2SeqIntersect30() { final XQuery query = new XQuery( "empty(/(a intersect following-sibling))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that is the following axis as right operand.. */ @org.junit.Test public void k2SeqIntersect31() { final XQuery query = new XQuery( "empty(/(a intersect following))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that is the preceding-sibling axis as right operand.. */ @org.junit.Test public void k2SeqIntersect32() { final XQuery query = new XQuery( "empty(/(a intersect preceding-sibling))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that is the preceding axis as right operand.. */ @org.junit.Test public void k2SeqIntersect33() { final XQuery query = new XQuery( "empty(/(a intersect preceding))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that is the parent axis as right operand.. */ @org.junit.Test public void k2SeqIntersect34() { final XQuery query = new XQuery( "empty(/(a intersect parent))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that is the ancestor axis as right operand.. */ @org.junit.Test public void k2SeqIntersect35() { final XQuery query = new XQuery( "empty(/(a intersect ancestor))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that is the ancestor axis as right operand.. */ @org.junit.Test public void k2SeqIntersect36() { final XQuery query = new XQuery( "empty(/(a intersect ancestor))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that is the ancestor-or-self axis as right operand.. */ @org.junit.Test public void k2SeqIntersect37() { final XQuery query = new XQuery( "empty(/(a intersect ancestor-or-self))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use 'declare as right operand.. */ @org.junit.Test public void k2SeqIntersect38() { final XQuery query = new XQuery( "empty(/(a intersect declare))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Extract the boolean value from a intersect expression.. */ @org.junit.Test public void k2SeqIntersect39() { final XQuery query = new XQuery( "boolean(//employee[location = \"Denver\"] intersect //employee[last()])", ctx); try { query.context(node(file("op/union/acme_corp.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Use a node kind keyword, element, to test query parsing.. */ @org.junit.Test public void k2SeqIntersect4() { final XQuery query = new XQuery( "empty(/(author intersect element))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Explicitly sort the result of an intersect expression.. */ @org.junit.Test public void k2SeqIntersect40() { final XQuery query = new XQuery( "//(employee[location = \"Denver\"] intersect //employee[last()])/./location", ctx); try { query.context(node(file("op/union/acme_corp.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Ensure node deduplication is done.. */ @org.junit.Test public void k2SeqIntersect41() { final XQuery query = new XQuery( " { let $i := /a , $t := $i/following-sibling::b return (($i intersect ($i, $i)), (($t, $t) intersect $t)) } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Perform intersection between two singleton document nodes.. */ @org.junit.Test public void k2SeqIntersect42() { final XQuery query = new XQuery( "\n" + " declare function local:function ($c as node()) { $c intersect $c }; \n" + " empty(local:function(document{()}))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Ensure two sequential union operators can be parsed(intersect).. */ @org.junit.Test public void k2SeqIntersect43() { final XQuery query = new XQuery( "1 intersect 2 intersect 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Ensure two sequential union operators can be parsed(except).. */ @org.junit.Test public void k2SeqIntersect44() { final XQuery query = new XQuery( "1 except 2 except 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Use a node kind keyword, attribute, to test query parsing.. */ @org.junit.Test public void k2SeqIntersect5() { final XQuery query = new XQuery( "empty(/(author intersect attribute))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, document-node, to test query parsing.. */ @org.junit.Test public void k2SeqIntersect6() { final XQuery query = new XQuery( "empty(/(author intersect document-node))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, comment, to test query parsing.. */ @org.junit.Test public void k2SeqIntersect7() { final XQuery query = new XQuery( "empty(/(author intersect comment))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, processing-instruction, to test query parsing.. */ @org.junit.Test public void k2SeqIntersect8() { final XQuery query = new XQuery( "empty(/(author intersect processing-instruction))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, item, to test query parsing.. */ @org.junit.Test public void k2SeqIntersect9() { final XQuery query = new XQuery( "empty(/(author intersect item))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple combination of node sequences involving different node sequences that results in empty sequence . Use "intersect" operator. Uses the count function to avoid the empty file for results. . */ @org.junit.Test public void combiningnodeseqintersecthc1() { final XQuery query = new XQuery( "count((0,1) intersect (3,4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Simple combination of node sequences involving two empty sequences. Use "intersect" operator. . */ @org.junit.Test public void combiningnodeseqintersecthc2() { final XQuery query = new XQuery( "count(() intersect ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Simple combination of sequences, where the two sequences are the same. Use "intersect" operator. . */ @org.junit.Test public void combiningnodeseqintersecthc3() { final XQuery query = new XQuery( "for $h in ( (//hours) intersect (//hours[xs:integer(.) gt 12])) order by number($h) return $h", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("202020202020404040808080", false) ); } /** * Simple combination of sequences, where second sequence intersect first sequence (multiple data sources). Use "intersect" operator. . */ @org.junit.Test public void combiningnodeseqintersecthc4() { final XQuery query = new XQuery( "for $h in ( ($works//hours) intersect ($works//hours, $staff//grade)) order by number($h) return $h", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("12202020202020404040808080", false) ); } /** * arg: node. */ @org.junit.Test public void fnIntersectNodeArgs001() { final XQuery query = new XQuery( "(/bib/book[1]/title intersect /bib/book[1]/title)/string()", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "TCP/IP Illustrated") ); } /** * arg: incorrect nodes. */ @org.junit.Test public void fnIntersectNodeArgs002() { final XQuery query = new XQuery( "/bib/book/title intersect /bib/book[1]/title", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "TCP/IP Illustrated") ); } /** * arg: node. */ @org.junit.Test public void fnIntersectNodeArgs003() { final XQuery query = new XQuery( "/bib/book[3]/title intersect root(exactly-one(/bib/book[3]/title))", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * arg: text node & node. */ @org.junit.Test public void fnIntersectNodeArgs004() { final XQuery query = new XQuery( "/bib/book[3]/title/text() intersect /bib/book/title/text()", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Data on the Web") ); } /** * arg: processing-instruction node & node. */ @org.junit.Test public void fnIntersectNodeArgs005() { final XQuery query = new XQuery( "(/processing-instruction() intersect /processing-instruction())/name()", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PI1 PI2") ); } /** * arg: processing-instruction node & node. */ @org.junit.Test public void fnIntersectNodeArgs006() { final XQuery query = new XQuery( "(/processing-instruction(PI1) intersect /processing-instruction())/name()", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PI1") ); } /** * arg: comment node & node. */ @org.junit.Test public void fnIntersectNodeArgs007() { final XQuery query = new XQuery( "string-join((/comment() intersect /comment()), \"|\")", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, " this file is a copy of bib.xml; just adds a few comments and PI nodes for testing | Comment 1 | Comment 2 ") ); } /** * arg: text node & node. */ @org.junit.Test public void fnIntersectNodeArgs008() { final XQuery query = new XQuery( "/bib/book[3]/title/text() intersect /bib/book/title/text()", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Data on the Web") ); } /** * arg: processing-instruction node & node. */ @org.junit.Test public void fnIntersectNodeArgs009() { final XQuery query = new XQuery( "/processing-instruction() intersect /bib/book[2]/title", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * arg: processing-instruction node & node. */ @org.junit.Test public void fnIntersectNodeArgs010() { final XQuery query = new XQuery( "/processing-instruction(PI1) intersect /bib/book", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * arg: comment node & node. */ @org.junit.Test public void fnIntersectNodeArgs011() { final XQuery query = new XQuery( "(/bib/book intersect /bib/book)/string(@year)", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1994 1992 2000 1999") ); } /** * arg: node & non existing node. */ @org.junit.Test public void fnIntersectNodeArgs012() { final XQuery query = new XQuery( "//author intersect //nonexisting", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * arg: node & empty sequence. */ @org.junit.Test public void fnIntersectNodeArgs013() { final XQuery query = new XQuery( "//author intersect ()", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * arg: empty sequence & empty sequence. */ @org.junit.Test public void fnIntersectNodeArgs014() { final XQuery query = new XQuery( "() intersect ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEmpty() || error("XPST0005") ) ); } /** * arg: node & node. */ @org.junit.Test public void fnIntersectNodeArgs023() { final XQuery query = new XQuery( "for $node in ((//price/text()) , (//price/text())) intersect ((//price/text()) , (//price/text())) return {$node} ", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" 65.9565.95 39.95129.95", false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpIsSameNode.java000066400000000000000000000510501222453003200272510ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the is-same-node() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpIsSameNode extends QT3TestSet { /** * A test whose essence is: `empty(1 is ())`. . */ @org.junit.Test public void kNodeSame1() { final XQuery query = new XQuery( "empty(1 is ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") || error("XPST0005") ) ); } /** * A test whose essence is: `empty(() is 1)`. . */ @org.junit.Test public void kNodeSame2() { final XQuery query = new XQuery( "empty(() is 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") || error("XPST0005") ) ); } /** * A test whose essence is: `1 is 1`. . */ @org.junit.Test public void kNodeSame3() { final XQuery query = new XQuery( "1 is 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A test whose essence is: `empty(() is ())`. . */ @org.junit.Test public void kNodeSame4() { final XQuery query = new XQuery( "empty(() is ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * A syntactically invalid expression. . */ @org.junit.Test public void kNodeSame5() { final XQuery query = new XQuery( "() is", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A query reminding of an invokation of 'is' operator. However, this is not a parse error(XPST0003), because it is a valid function call, although to a non-existant function. 'is' is not a reserved function name. . */ @org.junit.Test public void kNodeSame6() { final XQuery query = new XQuery( "is ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Ensure node identity is is correct for variables and element constructors. . */ @org.junit.Test public void k2NodeSame1() { final XQuery query = new XQuery( "declare variable $var := ; {$var}/elem[1] is $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Ensure node identity is is correct between variable references. . */ @org.junit.Test public void k2NodeSame2() { final XQuery query = new XQuery( "declare variable $var := ; $var is $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure node identity is is correct for variables and element constructors(#2). . */ @org.junit.Test public void k2NodeSame3() { final XQuery query = new XQuery( "declare variable $var := ; not($var is )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure node identity of nodes used with node constructors. . */ @org.junit.Test public void k2NodeSame4() { final XQuery query = new XQuery( "declare variable $e := attribute name {()}; $e is $e, is ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true false") ); } /** * exactly-one() to is, that fails. Inferrence may conclude that it will always evaluate to false, so that is valid as well. . */ @org.junit.Test public void k2NodeSame5() { final XQuery query = new XQuery( "empty(exactly-one(/*) is exactly-one(/*))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || error("FORG0005") ) ); } /** * Compare two empty sequences, that are tricky to infer at compile time. . */ @org.junit.Test public void k2NodeSame6() { final XQuery query = new XQuery( "empty(zero-or-one(/*) is zero-or-one(/*))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check node identity for return values of creative user defined functions. . */ @org.junit.Test public void cbclIsSameNode001() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:f() as node() { }; \n" + " \tlocal:f() is local:f()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test is same node operator . */ @org.junit.Test public void cbclNodeSame001() { final XQuery query = new XQuery( "\n" + " \tlet $node := \n" + " \treturn not(exactly-one($node/b[1]) is exactly-one($node/c[1]))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test is same node operator . */ @org.junit.Test public void cbclNodeSame002() { final XQuery query = new XQuery( "\n" + " \tlet $node := \n" + " \treturn not(not(exactly-one($node/b[1]) is exactly-one($node/c[1])))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * A node comparison where one of the operands is not the empty sequence or a single node. . */ @org.junit.Test public void nodecomparisonerr1() { final XQuery query = new XQuery( "fn:count(() is 100)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPTY0004") || error("XPST0005") ) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = empty Sequence operator = is operand2 = empty Sequence . */ @org.junit.Test public void nodeexpression1() { final XQuery query = new XQuery( "count(() is ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = Single Node Element operator = is operand2 = Single Element Constructor . */ @org.junit.Test public void nodeexpression10() { final XQuery query = new XQuery( "/works[1]/employee[1]/empnum[1] is 50000", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = Single Node Element operator = is operand2 = Single Node Element . */ @org.junit.Test public void nodeexpression11() { final XQuery query = new XQuery( "/works[1]/employee[1]/empnum[1] is /works[1]/employee[1]/empnum[1]", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = Single Node Element operator = is operand2 = Sequence of single Element Node . */ @org.junit.Test public void nodeexpression12() { final XQuery query = new XQuery( "\n" + " $works/works[1]/employee[1]/empnum[1] is $staff/staff[1]/employee[1]/empnum[1]", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = Sequence of single Element Node operator = is operand2 = empty Sequence . */ @org.junit.Test public void nodeexpression13() { final XQuery query = new XQuery( "count((/staff[1]/employee[1]/empnum[1]) is ())", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = Sequence of single Element Node operator = is operand2 = Single Element Constructor . */ @org.junit.Test public void nodeexpression14() { final XQuery query = new XQuery( "(/staff[1]/employee[1]/empnum[1]) is 50000", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = Sequence of single Element Node operator = is operand2 = Single Node Element . */ @org.junit.Test public void nodeexpression15() { final XQuery query = new XQuery( "\n" + " ($staff/staff[1]/employee[1]/empnum[1]) is $works/works[1]/employee[1]/empnum[1]", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = Sequence of single Element Node operator = is operand2 = Sequence of single Element Node . */ @org.junit.Test public void nodeexpression16() { final XQuery query = new XQuery( "(/staff[1]/employee[1]/empnum[1]) is (/staff[1]/employee[1]/empnum[1])", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = empty Sequence operator = is operand2 = Single Element Constructor . */ @org.junit.Test public void nodeexpression2() { final XQuery query = new XQuery( "count(() is 50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = empty Sequence operator = is operand2 = Single Node Element . */ @org.junit.Test public void nodeexpression3() { final XQuery query = new XQuery( "count(() is /works[1]/employee[1]/empnum[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = empty Sequence operator = is operand2 = Sequence of single Element Node . */ @org.junit.Test public void nodeexpression4() { final XQuery query = new XQuery( "count(() is (/staff[1]/employee[1]/empnum[1]))", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = Single Element Constructor operator = is operand2 = empty Sequence . */ @org.junit.Test public void nodeexpression5() { final XQuery query = new XQuery( "count(50000 is ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = Single Element Constructor operator = is operand2 = Single Element Constructor . */ @org.junit.Test public void nodeexpression6() { final XQuery query = new XQuery( "50000 is 50000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = Single Element Constructor operator = is operand2 = Single Node Element . */ @org.junit.Test public void nodeexpression7() { final XQuery query = new XQuery( "50000 is /works[1]/employee[1]/empnum[1]", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = Single Element Constructor operator = is operand2 = Sequence of single Element Node . */ @org.junit.Test public void nodeexpression8() { final XQuery query = new XQuery( "50000 is (/staff[1]/employee[1]/empnum[1])", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = Single Node Element operator = is operand2 = empty Sequence . */ @org.junit.Test public void nodeexpression9() { final XQuery query = new XQuery( "count(/works[1]/employee[1]/empnum[1] is ())", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Test of a Node Expression used as an argument to the fn not function . */ @org.junit.Test public void nodeexpressionhc1() { final XQuery query = new XQuery( "fn:not((/staff[1]/employee[1]/empnum[1]) is (/staff[1]/employee[1]/empnum[1]))", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a Node Expression used as part of a boolean-less-than expression (lt operator). . */ @org.junit.Test public void nodeexpressionhc2() { final XQuery query = new XQuery( "((/staff[1]/employee[1]/empnum[1]) is (/staff[1]/employee[1]/empnum[1])) lt ((/staff[1]/employee[1]/empnum[1]) is (/staff[1]/employee[1]/empnum[1]))", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a Node Expression used as part of a boolean less than expression (ge) operator . */ @org.junit.Test public void nodeexpressionhc3() { final XQuery query = new XQuery( "((/staff[1]/employee[1]/empnum[1]) is (/staff[1]/employee[1]/empnum[1])) ge ((/staff[1]/employee[1]/empnum[1]) is (/staff[1]/employee[1]/empnum[1]))", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a Node Expression used as part of a boolean greater than expression (gt) operator. . */ @org.junit.Test public void nodeexpressionhc4() { final XQuery query = new XQuery( "((/staff[1]/employee[1]/empnum[1]) is (/staff[1]/employee[1]/empnum[1])) gt ((/staff[1]/employee[1]/empnum[1]) is (/staff[1]/employee[1]/empnum[1]))", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a Node Expression used as part of a boolean greater than expression (le) operator . */ @org.junit.Test public void nodeexpressionhc5() { final XQuery query = new XQuery( "((/staff[1]/employee[1]/empnum[1]) is (/staff[1]/employee[1]/empnum[1])) le ((/staff[1]/employee[1]/empnum[1]) is (/staff[1]/employee[1]/empnum[1]))", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpMultiplyDayTimeDuration.java000066400000000000000000001075751222453003200321020ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the multiply-dayTimeDuration() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpMultiplyDayTimeDuration extends QT3TestSet { /** * * ******************************************************* * Test: K-DayTimeDurationMultiply-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of multiplying a xs:dayTimeDuration with 3. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationMultiply1() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT4H3M3.100S\") * 3 eq xs:dayTimeDuration(\"P9DT12H9M9.3S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DayTimeDurationMultiply-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of multiplying 3 with xs:dayTimeDuration. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationMultiply2() { final XQuery query = new XQuery( "3 * xs:dayTimeDuration(\"P3DT4H3M3.100S\") eq xs:dayTimeDuration(\"P9DT12H9M9.3S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DayTimeDurationMultiply-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of multiplying a xs:dayTimeDuration with 0. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationMultiply3() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT4H3M3.100S\") * 0 eq xs:dayTimeDuration(\"PT0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DayTimeDurationMultiply-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of multiplying 0 with xs:dayTimeDuration. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationMultiply4() { final XQuery query = new XQuery( "0 * xs:dayTimeDuration(\"P3DT4H3M3.100S\") eq xs:dayTimeDuration(\"PT0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DayTimeDurationMultiply-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of multiplying a xs:dayTimeDuration with -0. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationMultiply5() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT4H3M3.100S\") * xs:double(\"-0\") eq xs:dayTimeDuration(\"PT0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DayTimeDurationMultiply-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of multiplying -0 with xs:dayTimeDuration. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationMultiply6() { final XQuery query = new XQuery( "xs:double(\"-0\") * xs:dayTimeDuration(\"P3DT4H3M3.100S\") eq xs:dayTimeDuration(\"PT0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DayTimeDurationMultiply-7 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of multiplying a xs:dayTimeDuration with INF. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationMultiply7() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT4H3M3.100S\") * xs:double(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * * ******************************************************* * Test: K-DayTimeDurationMultiply-8 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of multiplying a xs:dayTimeDuration with -INF. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationMultiply8() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT4H3M3.100S\") * xs:double(\"-INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * * ******************************************************* * Test: K-DayTimeDurationMultiply-9 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of multiplying a xs:dayTimeDuration with NaN. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationMultiply9() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT4H3M3.100S\") * xs:double(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0005") ); } /** * test multiplication of xs:dayTimeDuration by 0 . */ @org.junit.Test public void cbclMultiplyDayTimeDuration001() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($days as xs:integer) as xs:dayTimeDuration { xs:dayTimeDuration(concat(\"P\", $days, \"D\")) }; local:dayTimeDuration(2) * 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * test multiplication of xs:dayTimeDuration by 1 . */ @org.junit.Test public void cbclMultiplyDayTimeDuration002() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($days as xs:integer) as xs:dayTimeDuration { xs:dayTimeDuration(concat(\"P\", $days, \"D\")) }; local:dayTimeDuration(2) * 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P2D") ); } /** * test multiplication of xs:dayTimeDuration by NaN . */ @org.junit.Test public void cbclMultiplyDayTimeDuration003() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($days as xs:integer) as xs:dayTimeDuration { xs:dayTimeDuration(concat(\"P\", $days, \"D\")) }; local:dayTimeDuration(2) * xs:double(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0005") ); } /** * test multiplication of xs:dayTimeDuration by 0 . */ @org.junit.Test public void cbclMultiplyDayTimeDuration004() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($days as xs:integer) as xs:dayTimeDuration { xs:dayTimeDuration(concat(\"P\", $days, \"D\")) }; 0 * local:dayTimeDuration(2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * test multiplication of xs:dayTimeDuration by 1 . */ @org.junit.Test public void cbclMultiplyDayTimeDuration005() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($days as xs:integer) as xs:dayTimeDuration { xs:dayTimeDuration(concat(\"P\", $days, \"D\")) }; 1 * local:dayTimeDuration(2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P2D") ); } /** * test multiplication of xs:dayTimeDuration by NaN . */ @org.junit.Test public void cbclMultiplyDayTimeDuration006() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($days as xs:integer) as xs:dayTimeDuration { xs:dayTimeDuration(concat(\"P\", $days, \"D\")) }; xs:double(\"NaN\") * local:dayTimeDuration(2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0005") ); } /** * Test behaviour of times operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclTimes001() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " local:f(false()) * 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P2M") ); } /** * Test behaviour of times operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclTimes002() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " local:f(true()) * 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of times operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclTimes003() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:dayTimeDuration(\"P1D\") };\n" + " local:f(false()) * 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P2D") ); } /** * Test behaviour of times operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclTimes004() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:dayTimeDuration(\"P1D\") };\n" + " local:f(true()) * 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of times operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclTimes005() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " 2 * local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P2M") ); } /** * Test behaviour of times operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclTimes006() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") };\n" + " 2 * local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of times operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclTimes007() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:dayTimeDuration(\"P1D\") };\n" + " 2 * local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P2D") ); } /** * Test behaviour of times operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclTimes008() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:dayTimeDuration(\"P1D\") };\n" + " 2 * local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: op-multiply-dayTimeDuration-1 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "multiply-dayTimeDuration" function * As per example 1 (for this function)of the F&O specs. * ******************************************************* * . */ @org.junit.Test public void opMultiplyDayTimeDuration1() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"PT2H10M\") * 2.1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT4H33M") ); } /** * * ******************************************************* * Test: op-multiply-dayTimeDuration-10 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "multiply-dayTimeDuration" function used * together with an "or" expression. * ******************************************************* * . */ @org.junit.Test public void opMultiplyDayTimeDuration10() { final XQuery query = new XQuery( "fn:string((xs:dayTimeDuration(\"P05DT09H02M\") * 2.0)) or fn:string((xs:dayTimeDuration(\"P05DT05H03M\") * 2.0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-multiply-dayTimeDuration-11 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "multiply-dayTimeDuration" function used * together with a "div" expression. * ******************************************************* * . */ @org.junit.Test public void opMultiplyDayTimeDuration11() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P42DT10H10M\") * 2.0) div (xs:dayTimeDuration(\"P42DT10H10M\") * 2.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * * ******************************************************* * Test: op-multiply-dayTimeDuration-12 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "multiply-dayTimeDuration" operators used * with a boolean expression and the "fn:true" function. * ******************************************************* * . */ @org.junit.Test public void opMultiplyDayTimeDuration12() { final XQuery query = new XQuery( "fn:string((xs:dayTimeDuration(\"P10DT08H11M\") * 2.0)) and (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-multiply-dayTimeDuration-13 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "multiply-dayTimeDuration" function used * together with the numeric-equal-operator "eq". * ******************************************************* * . */ @org.junit.Test public void opMultiplyDayTimeDuration13() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P23DT11H11M\") * 2.0) eq xs:dayTimeDuration(\"P23DT11H11M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-multiply-dayTimeDuration-14 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "multiply-dayTimeDuration" function used * together with the numeric-equal operator "ne". * ******************************************************* * . */ @org.junit.Test public void opMultiplyDayTimeDuration14() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P21DT08H12M\") * 2.0) ne xs:dayTimeDuration(\"P08DT08H05M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-multiply-dayTimeDuration-15 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "multiply-dayTimeDuration" function used * together with the numeric-equal operator "le". * ******************************************************* * . */ @org.junit.Test public void opMultiplyDayTimeDuration15() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P10DT10H01M\") * 2.0) le xs:dayTimeDuration(\"P17DT10H02M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-multiply-dayTimeDuration-16 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "multiply-dayTimeDuration" function used * together with the numeric-equal operator "ge". * ******************************************************* * . */ @org.junit.Test public void opMultiplyDayTimeDuration16() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P13DT09H09M\") * 2.0) ge xs:dayTimeDuration(\"P18DT02H02M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-multiply-dayTimeDuration-17 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "multiply-dayTimeDuration" function * multiplied by -0. Use fn:count to avoid empty file. * ******************************************************* * . */ @org.junit.Test public void opMultiplyDayTimeDuration17() { final XQuery query = new XQuery( "fn:count(xs:dayTimeDuration(\"P13DT09H09M\") * -0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * * ******************************************************* * Test: op-multiply-dayTimeDuration-18 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "multiply-dayTimeDuration" function * multiplied by +0. Use fn:count to avoid empty file. * ******************************************************* * . */ @org.junit.Test public void opMultiplyDayTimeDuration18() { final XQuery query = new XQuery( "fn:count(xs:dayTimeDuration(\"P13DT09H09M\") * +0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * * ******************************************************* * Test: op-multiply-dayTimeDuration-2 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "multiply-dayTimeDuration" function * used as part of a boolean expression (and operator) and the "fn:false" function. * ******************************************************* * . */ @org.junit.Test public void opMultiplyDayTimeDuration2() { final XQuery query = new XQuery( "fn:string((xs:dayTimeDuration(\"P10DT10H11M\")) * 2.0) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-multiply-dayTimeDuration-3 * Date: June 29, 2005 * Purpose: Evaluates The "multiply-dayTimeDuration" function as * part of a boolean expression (or operator) and the "fn:boolean" function. * ******************************************************* * . */ @org.junit.Test public void opMultiplyDayTimeDuration3() { final XQuery query = new XQuery( "fn:string((xs:dayTimeDuration(\"P20DT20H10M\") * 2.0)) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-multiply-dayTimeDuration-4 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "multiply-dayTimeDuration" function that * return true and used together with fn:not. * ******************************************************* * . */ @org.junit.Test public void opMultiplyDayTimeDuration4() { final XQuery query = new XQuery( "fn:not(fn:string(xs:dayTimeDuration(\"P11DT12H04M\") * 2.0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-multiply-dayTimeDuration-5 * Written By: Carmelo Montanez * Date: June 29 2005 * Purpose: Evaluates The "multiply-dayTimeDuration" function that * is used as an argument to the fn:boolean function. * ******************************************************* * . */ @org.junit.Test public void opMultiplyDayTimeDuration5() { final XQuery query = new XQuery( "fn:boolean(fn:string(xs:dayTimeDuration(\"P05DT09H08M\") *2.0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-multiply-dayTimeDuration-6 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "multiply-dayTimeDuration" operator that * is used as an argument to the fn:number function. * ******************************************************* * . */ @org.junit.Test public void opMultiplyDayTimeDuration6() { final XQuery query = new XQuery( "fn:number(xs:dayTimeDuration(\"P02DT06H09M\") *2.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * * ******************************************************* * Test: op-multiply-dayTimeDuration-7 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "multiply-dayTimeDuration" function used * as an argument to the "fn:string" function). * ******************************************************* * . */ @org.junit.Test public void opMultiplyDayTimeDuration7() { final XQuery query = new XQuery( "fn:string(xs:dayTimeDuration(\"P03DT04H08M\") * 2.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P6DT8H16M") ); } /** * * ******************************************************* * Test: op-multiply-dayTimeDuration-8 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "multiply-dayTimeDuration" function that * returns a negative value. * ******************************************************* * . */ @org.junit.Test public void opMultiplyDayTimeDuration8() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P10DT01H01M\") * -2.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P20DT2H2M") ); } /** * * ******************************************************* * Test: op-multiply-dayTimeDuration-9 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "multiply-dayTimeDuration" function used * together with and "and" expression. * ******************************************************* * . */ @org.junit.Test public void opMultiplyDayTimeDuration9() { final XQuery query = new XQuery( "fn:string((xs:dayTimeDuration(\"P01DT02H01M\") * 2.0)) and fn:string((xs:dayTimeDuration(\"P02DT03H03M\") * 2.0 ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-multiply-dayTimeDuration2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:multiply-dayTimeDuration" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(lower bound) * $arg2 = xs:double(lower bound) * ******************************************************* * . */ @org.junit.Test public void opMultiplyDayTimeDuration2args1() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") * xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * * ******************************************************* * Test: op-multiply-dayTimeDuration2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:multiply-dayTimeDuration" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(mid range) * $arg2 = xs:double(lower bound) * ******************************************************* * . */ @org.junit.Test public void opMultiplyDayTimeDuration2args2() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P15DT11H59M59S\") * xs:double(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * * ******************************************************* * Test: op-multiply-dayTimeDuration2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:multiply-dayTimeDuration" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(upper bound) * $arg2 = xs:double(lower bound) * ******************************************************* * . */ @org.junit.Test public void opMultiplyDayTimeDuration2args3() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P31DT23H59M59S\") * xs:double(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * * ******************************************************* * Test: op-multiply-dayTimeDuration2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:multiply-dayTimeDuration" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(lower bound) * $arg2 = xs:double(mid range) * ******************************************************* * . */ @org.junit.Test public void opMultiplyDayTimeDuration2args4() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") * xs:double(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * * ******************************************************* * Test: op-multiply-dayTimeDuration2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:multiply-dayTimeDuration" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(lower bound) * $arg2 = xs:double(upper bound) * ******************************************************* * . */ @org.junit.Test public void opMultiplyDayTimeDuration2args5() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") * xs:double(\"1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpMultiplyYearMonthDuration.java000066400000000000000000001110741222453003200324410ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the multiply-yearMonthDuration() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpMultiplyYearMonthDuration extends QT3TestSet { /** * * ******************************************************* * Test: K-YearMonthDurationMultiply-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of multiplying a xs:yearMonthDuration with 3. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationMultiply1() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P3Y36M\") * 3 eq xs:yearMonthDuration(\"P18Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-YearMonthDurationMultiply-10 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The multiplication operator is not available between xs:dayTimeDuration and xs:yearMonthDuration. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationMultiply10() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3D\") * xs:yearMonthDuration(\"P3Y3M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-YearMonthDurationMultiply-11 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The multiplication operator is not available between xs:yearMonthDuration and xs:dayTimeDuration. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationMultiply11() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P3Y3M\") * xs:dayTimeDuration(\"P3D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-YearMonthDurationMultiply-12 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The multiplication operator is not available between xs:yearMonthDuration and xs:yearMonthDuration. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationMultiply12() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P3Y3M\") * xs:yearMonthDuration(\"P3Y3M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-YearMonthDurationMultiply-13 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The multiplication operator is not available between xs:dayTimeDuration and xs:dayTimeDuration. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationMultiply13() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3D\") * xs:dayTimeDuration(\"P3D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-YearMonthDurationMultiply-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of multiplying 3 with xs:yearMonthDuration. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationMultiply2() { final XQuery query = new XQuery( "3 * xs:yearMonthDuration(\"P3Y36M\") eq xs:yearMonthDuration(\"P18Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-YearMonthDurationMultiply-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of multiplying 0 with xs:yearMonthDuration. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationMultiply3() { final XQuery query = new XQuery( "0 * xs:yearMonthDuration(\"P3Y36M\") eq xs:yearMonthDuration(\"P0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-YearMonthDurationMultiply-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of multiplying a xs:yearMonthDuration with 0. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationMultiply4() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P3Y36M\") * 0 eq xs:yearMonthDuration(\"P0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-YearMonthDurationMultiply-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of multiplying a xs:yearMonthDuration with INF. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationMultiply5() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P3Y3M\") * xs:double(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * * ******************************************************* * Test: K-YearMonthDurationMultiply-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of multiplying a xs:yearMonthDuration with -INF. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationMultiply6() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P3Y3M\") * xs:double(\"-INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * * ******************************************************* * Test: K-YearMonthDurationMultiply-7 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of multiplying a xs:yearMonthDuration with NaN. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationMultiply7() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P3Y3M\") * xs:double(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0005") ); } /** * * ******************************************************* * Test: K-YearMonthDurationMultiply-8 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The multiplication operator is not available between xs:duration and xs:integer. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationMultiply8() { final XQuery query = new XQuery( "xs:duration(\"P1Y3M\") * 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-YearMonthDurationMultiply-9 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The multiplication operator is not available between xs:integer and xs:duration. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationMultiply9() { final XQuery query = new XQuery( "3 * xs:duration(\"P1Y3M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test multiplication of xs:yearMonthDuration by 0 . */ @org.junit.Test public void cbclMultiplyYearMonthDuration001() { final XQuery query = new XQuery( "\n" + " declare function local:yearMonthDuration($years as xs:integer) as xs:yearMonthDuration { xs:yearMonthDuration(concat(\"P\", $years, \"Y\")) };\n" + " local:yearMonthDuration(2) * 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P0M") ); } /** * test multiplication of xs:yearMonthDuration by 1 . */ @org.junit.Test public void cbclMultiplyYearMonthDuration002() { final XQuery query = new XQuery( "\n" + " declare function local:yearMonthDuration($years as xs:integer) as xs:yearMonthDuration { xs:yearMonthDuration(concat(\"P\", $years, \"Y\")) };\n" + " local:yearMonthDuration(2) * 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P2Y") ); } /** * test multiplication of xs:yearMonthDuration by NaN . */ @org.junit.Test public void cbclMultiplyYearMonthDuration003() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P2Y\") * xs:double('NaN')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0005") ); } /** * test multiplication of xs:yearMonthDuration by 0 . */ @org.junit.Test public void cbclMultiplyYearMonthDuration004() { final XQuery query = new XQuery( "\n" + " declare function local:yearMonthDuration($years as xs:integer) as xs:yearMonthDuration { xs:yearMonthDuration(concat(\"P\", $years, \"Y\")) };\n" + " 0 * local:yearMonthDuration(2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P0M") ); } /** * test multiplication of xs:yearMonthDuration by 1 . */ @org.junit.Test public void cbclMultiplyYearMonthDuration005() { final XQuery query = new XQuery( "\n" + " declare function local:yearMonthDuration($years as xs:integer) as xs:yearMonthDuration { xs:yearMonthDuration(concat(\"P\", $years, \"Y\")) };\n" + " 1 * local:yearMonthDuration(2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P2Y") ); } /** * test multiplication of xs:yearMonthDuration by NaN . */ @org.junit.Test public void cbclMultiplyYearMonthDuration006() { final XQuery query = new XQuery( "xs:double('NaN') * xs:yearMonthDuration(\"P2Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0005") ); } /** * * ******************************************************* * Test: op-multiply-yearMonthDuration-1 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "multiply-yearMonthDuration" function * As per example 1 (for this function)of the F&O specs. * ******************************************************* * . */ @org.junit.Test public void opMultiplyYearMonthDuration1() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P2Y11M\") * 2.3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P6Y9M") ); } /** * * ******************************************************* * Test: op-multiply-yearMonthDuration-10 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "multiply-yearMonthDuration" function used * together with an "or" expression. * Apply "fn:string" function to account for new EBV. * ******************************************************* * . */ @org.junit.Test public void opMultiplyYearMonthDuration10() { final XQuery query = new XQuery( "fn:string((xs:yearMonthDuration(\"P05Y02M\") * 2.0)) or fn:string((xs:yearMonthDuration(\"P05Y03M\") * 2.0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-multiply-yearMonthDuration-11 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "multiply-yearMonthDuration" function used * together with a "div" expression. * ******************************************************* * . */ @org.junit.Test public void opMultiplyYearMonthDuration11() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P20Y11M\") * 2.0) div (xs:yearMonthDuration(\"P20Y11M\") * 2.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * * ******************************************************* * Test: op-multiply-yearMonthDuration-12 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "multiply-yearMonthDuration" operators used * with a boolean expression and the "fn:true" function. * Apply "fn:string" function to account for new EBV. * ******************************************************* * . */ @org.junit.Test public void opMultiplyYearMonthDuration12() { final XQuery query = new XQuery( "fn:string((xs:yearMonthDuration(\"P10Y11M\") * 2.0)) and (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-multiply-yearMonthDuration-13 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "multiply-yearMonthDuration" function used * together with the numeric-equal- operator "eq". * ******************************************************* * . */ @org.junit.Test public void opMultiplyYearMonthDuration13() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P23Y11M\") * 2.0) eq xs:yearMonthDuration(\"P23Y11M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-multiply-yearMonthDuration-14 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "multiply-yearMonthDuration" function used * together with the numeric-equal operator "ne". * ******************************************************* * . */ @org.junit.Test public void opMultiplyYearMonthDuration14() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P21Y12M\") * 2.0) ne xs:yearMonthDuration(\"P08Y05M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-multiply-yearMonthDuration-15 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "multiply-yearMonthDuration" function used * together with the numeric-equal operator "le". * ******************************************************* * . */ @org.junit.Test public void opMultiplyYearMonthDuration15() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P10Y01M\") * 2.0) le xs:yearMonthDuration(\"P17Y02M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDurations-16 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "subtract-yearMonthDurations" function used * together with the numeric-equal operator "ge". * ******************************************************* * . */ @org.junit.Test public void opMultiplyYearMonthDuration16() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P13Y09M\") - xs:yearMonthDuration(\"P18Y02M\")) ge xs:yearMonthDuration(\"P18Y02M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-multiply-yearMonthDuration-16 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "multiply-yearMonthDuration" operator * multiplied by +0. Use of fn:count to avoid empty file. * ******************************************************* * . */ @org.junit.Test public void opMultiplyYearMonthDuration17() { final XQuery query = new XQuery( "fn:count((xs:yearMonthDuration(\"P13Y09M\") *+0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * * ******************************************************* * Test: op-multiply-yearMonthDuration-18 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "multiply-yearMonthDuration" operator * multiplied by -0. Use of fn:count to avoid empty file. * ******************************************************* * . */ @org.junit.Test public void opMultiplyYearMonthDuration18() { final XQuery query = new XQuery( "fn:count((xs:yearMonthDuration(\"P13Y09M\") *-0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * * ******************************************************* * Test: op-multiply-yearMonthDuration-19 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "multiply-yearMonthDuration" operator * with arg2 set to NaN. Should raise an error * ******************************************************* * . */ @org.junit.Test public void opMultiplyYearMonthDuration19() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P13Y09M\") * fn:number(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0005") ); } /** * * ******************************************************* * Test: op-multiply-yearMonthDuration-2 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "multiply-yearMonthDuration" function * used as part of a boolean expression (and operator) and the "fn:false" function. * Apply "fn:string" function to account for new EBV. * ******************************************************* * . */ @org.junit.Test public void opMultiplyYearMonthDuration2() { final XQuery query = new XQuery( "fn:string((xs:yearMonthDuration(\"P10Y11M\")) * 2.0) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-multiply-yearMonthDuration-20 * Written By: Michael Kay * Date: 5 Feb 2009 * Purpose: Test rounding behaviour, FO.E12. * ******************************************************* * . */ @org.junit.Test public void opMultiplyYearMonthDuration20() { final XQuery query = new XQuery( "for $i in (-3.9, -3.5, -3.1, -0.9, -0.5, -0.1, +0.1, +0.5, +0.9, +3.1, +3.5, +3.9) return xs:yearMonthDuration(\"P1M\") * $i", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P4M -P3M -P3M -P1M P0M P0M P0M P1M P1M P3M P4M P4M") ); } /** * * ******************************************************* * Test: op-multiply-yearMonthDuration-3 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "multiply-yearMonthDuration" function as * part of a boolean expression (or operator) and the "fn:boolean" function. * Apply "fn:string" function to account for new EBV. * ******************************************************* * . */ @org.junit.Test public void opMultiplyYearMonthDuration3() { final XQuery query = new XQuery( "fn:string((xs:yearMonthDuration(\"P20Y10M\") * 2.0)) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-multiply-yearMonthDuration-4 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "multiply-yearMonthDuration" function that * return true and used together with fn:not. * Apply "fn:string" function to account for new EBV. * ******************************************************* * . */ @org.junit.Test public void opMultiplyYearMonthDuration4() { final XQuery query = new XQuery( "fn:not(fn:string(xs:yearMonthDuration(\"P11Y04M\") * 2.0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-multiply-yearMonthDuration-5 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "multiply-yearMonthDuration" function that * is used as an argument to the fn:boolean function. * Apply "fn:string" function to account for new EBV. * ******************************************************* * . */ @org.junit.Test public void opMultiplyYearMonthDuration5() { final XQuery query = new XQuery( "fn:boolean(fn:string(xs:yearMonthDuration(\"P05Y08M\") * 2.0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-multiply-yearMonthDuration-6 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "multiply-yearMonthDuration" operator that * is used as an argument to the fn:number function. * ******************************************************* * . */ @org.junit.Test public void opMultiplyYearMonthDuration6() { final XQuery query = new XQuery( "fn:number(xs:yearMonthDuration(\"P02Y09M\") * 2.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * * ******************************************************* * Test: op-multiply-yearMonthDuration-7 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "multiply-yearMonthDuration" function used * as an argument to the "fn:string" function). * ******************************************************* * . */ @org.junit.Test public void opMultiplyYearMonthDuration7() { final XQuery query = new XQuery( "fn:string(xs:yearMonthDuration(\"P03Y08M\") * 2.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P7Y4M") ); } /** * * ******************************************************* * Test: op-multiply-yearMonthDuration-8 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "multiply-yearMonthDuration" function that * returns a negative value. * ******************************************************* * . */ @org.junit.Test public void opMultiplyYearMonthDuration8() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P10Y01M\") * -2.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P20Y2M") ); } /** * * ******************************************************* * Test: op-multiply-yearMonthDuration-9 * Written By: Carmelo Montanez * Date: June 30, 2005 * Purpose: Evaluates The "multiply-yearMonthDuration" function used * together with and "and" expression. * Apply "fn:string" function to account for new EBV. * ******************************************************* * . */ @org.junit.Test public void opMultiplyYearMonthDuration9() { final XQuery query = new XQuery( "fn:string((xs:yearMonthDuration(\"P01Y01M\") * 2.0)) and fn:string((xs:yearMonthDuration(\"P02Y03M\") * 2.0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-multiply-yearMonthDuration2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:multiply-yearMonthDuration" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(lower bound) * $arg2 = xs:double(lower bound) * ******************************************************* * . */ @org.junit.Test public void opMultiplyYearMonthDuration2args1() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") * xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P0M") ); } /** * * ******************************************************* * Test: op-multiply-yearMonthDuration2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:multiply-yearMonthDuration" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(mid range) * $arg2 = xs:double(lower bound) * ******************************************************* * . */ @org.junit.Test public void opMultiplyYearMonthDuration2args2() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1000Y6M\") * xs:double(\"-0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P0M") ); } /** * * ******************************************************* * Test: op-multiply-yearMonthDuration2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:multiply-yearMonthDuration" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(upper bound) * $arg2 = xs:double(lower bound) * ******************************************************* * . */ @org.junit.Test public void opMultiplyYearMonthDuration2args3() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P2030Y12M\") * xs:double(\"-0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P0M") ); } /** * * ******************************************************* * Test: op-multiply-yearMonthDuration2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:multiply-yearMonthDuration" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(lower bound) * $arg2 = xs:double(mid range) * ******************************************************* * . */ @org.junit.Test public void opMultiplyYearMonthDuration2args4() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") * xs:double(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P0M") ); } /** * * ******************************************************* * Test: op-multiply-yearMonthDuration2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:multiply-yearMonthDuration" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(lower bound) * $arg2 = xs:double(upper bound) * ******************************************************* * . */ @org.junit.Test public void opMultiplyYearMonthDuration2args5() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") * xs:double(\"1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P0M") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpNodeAfter.java000066400000000000000000000500201222453003200271250ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the node-after() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpNodeAfter extends QT3TestSet { /** * A test whose essence is: `empty(1 >> ())`. . */ @org.junit.Test public void kNodeAfter1() { final XQuery query = new XQuery( "empty(1 >> ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") || error("XPST0005") ) ); } /** * A test whose essence is: `>> 1`. . */ @org.junit.Test public void kNodeAfter10() { final XQuery query = new XQuery( ">> 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A test whose essence is: `>>>`. . */ @org.junit.Test public void kNodeAfter11() { final XQuery query = new XQuery( ">>>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A test whose essence is: `empty(() >> 1)`. . */ @org.junit.Test public void kNodeAfter2() { final XQuery query = new XQuery( "empty(() >> 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") || error("XPST0005") ) ); } /** * A test whose essence is: `1 >> 1`. . */ @org.junit.Test public void kNodeAfter3() { final XQuery query = new XQuery( "1 >> 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A test whose essence is: `empty(() >> ())`. . */ @org.junit.Test public void kNodeAfter4() { final XQuery query = new XQuery( "empty(() >> ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * A test whose essence is: `() >>> ()`. . */ @org.junit.Test public void kNodeAfter5() { final XQuery query = new XQuery( "() >>> ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A test whose essence is: `() >>`. . */ @org.junit.Test public void kNodeAfter6() { final XQuery query = new XQuery( "() >>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A test whose essence is: `>> ()`. . */ @org.junit.Test public void kNodeAfter7() { final XQuery query = new XQuery( ">> ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A test whose essence is: `>>`. . */ @org.junit.Test public void kNodeAfter8() { final XQuery query = new XQuery( ">>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A test whose essence is: `1 >>`. . */ @org.junit.Test public void kNodeAfter9() { final XQuery query = new XQuery( "1 >>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * test node after operator . */ @org.junit.Test public void cbclNodeAfter001() { final XQuery query = new XQuery( "\n" + " \tlet $node := \n" + " \treturn not(exactly-one($node/b[1]) >> exactly-one($node/c[1]))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test node after operator . */ @org.junit.Test public void cbclNodeAfter002() { final XQuery query = new XQuery( "\n" + " \tlet $node := \n" + " \treturn not(not(exactly-one($node/b[1]) >> exactly-one($node/c[1])))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * A node comparison where one of the operands is not the empty sequence or a single node. . */ @org.junit.Test public void nodecomparisonerr3() { final XQuery query = new XQuery( "fn:count(() >> 100)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPTY0004") || error("XPST0005") ) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = empty Sequence operator = >> operand2 = empty Sequence . */ @org.junit.Test public void nodeexpression33() { final XQuery query = new XQuery( "count(() >> ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = empty Sequence operator = >> operand2 = Single Element Constructor . */ @org.junit.Test public void nodeexpression34() { final XQuery query = new XQuery( "count(() >> 50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = empty Sequence operator = >> operand2 = Single Node Element . */ @org.junit.Test public void nodeexpression35() { final XQuery query = new XQuery( "count(() >> /works[1]/employee[1]/empnum[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = empty Sequence operator = >> operand2 = Sequence of single Element Node . */ @org.junit.Test public void nodeexpression36() { final XQuery query = new XQuery( "count(() >> (/staff[1]/employee[1]/empnum[1]))", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = Single Element Constructor operator = >> operand2 = empty Sequence . */ @org.junit.Test public void nodeexpression37() { final XQuery query = new XQuery( "count(50000 >> ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = Single Element Constructor operator = >> operand2 = Single Element Constructor . */ @org.junit.Test public void nodeexpression38() { final XQuery query = new XQuery( "50000 >> 50000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = Single Element Constructor operator = >> operand2 = Single Node Element . */ @org.junit.Test public void nodeexpression39() { final XQuery query = new XQuery( "50000 >> /works[1]/employee[1]/empnum[1]", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = Single Element Constructor operator = >> operand2 = Sequence of single Element Node . */ @org.junit.Test public void nodeexpression40() { final XQuery query = new XQuery( "50000 >> (/staff[1]/employee[1]/empnum[1])", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = Single Node Element operator = >> operand2 = empty Sequence . */ @org.junit.Test public void nodeexpression41() { final XQuery query = new XQuery( "count(/works[1]/employee[1]/empnum[1] >> ())", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = Single Node Element operator = >> operand2 = Single Element Constructor . */ @org.junit.Test public void nodeexpression42() { final XQuery query = new XQuery( "/works[1]/employee[1]/empnum[1] >> 50000", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = Single Node Element operator = >> operand2 = Single Node Element . */ @org.junit.Test public void nodeexpression43() { final XQuery query = new XQuery( "/works[1]/employee[1]/empnum[1] >> /works[1]/employee[1]/empnum[1]", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = Single Node Element operator = >> operand2 = Sequence of single Element Node . */ @org.junit.Test public void nodeexpression44() { final XQuery query = new XQuery( "$works/works[1]/employee[1]/empnum[1] >> ($staff/staff[1]/employee[1]/empnum[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = Sequence of single Element Node operator = >> operand2 = empty Sequence . */ @org.junit.Test public void nodeexpression45() { final XQuery query = new XQuery( "count((/staff[1]/employee[1]/empnum[1]) >> ())", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = Sequence of single Element Node operator = >> operand2 = Single Element Constructor . */ @org.junit.Test public void nodeexpression46() { final XQuery query = new XQuery( "(/staff[1]/employee[1]/empnum[1]) >> 50000", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * Name nodeexpression47 Test of a ComparisonExpression testing the rule that states "If any node in a given tree, T1, occurs before any node in a different tree, T2, then all nodes in T1 are before all nodes in T2." Compare various nodes of the first operand against various nodes of the second operand. . */ @org.junit.Test public void nodeexpression47() { final XQuery query = new XQuery( "(($works/works[1]/employee[1]/empnum[1] >> $staff/staff[1]/employee[1]/empnum[1]) \n" + " and ($works/works[1]/employee[2]/empnum[1] >> $staff/staff[1]/employee[2]/empnum[1]) \n" + " and ($works/works[1]/employee[3]/empnum[1] >> $staff/staff[1]/employee[3]/empnum[1])) \n" + " or (($works/works[1]/employee[1]/empnum[1] << $staff/staff[1]/employee[1]/empnum[1]) \n" + " and ($works/works[1]/employee[2]/empnum[1] << $staff/staff[1]/employee[2]/empnum[1]) \n" + " and ($works/works[1]/employee[3]/empnum[1] << $staff/staff[1]/employee[3]/empnum[1]))", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a ComparisonExpression with the operands set as follows operand1 = Sequence of single Element Node operator = >> operand2 = Sequence of single Element Node . */ @org.junit.Test public void nodeexpression48() { final XQuery query = new XQuery( "(/staff[1]/employee[1]/empnum[1]) >> (/staff[1]/employee[1]/empnum[1])", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test nodeexpressionhc11 Test of a Node after expression used as an argument to an "fn:not" function. . */ @org.junit.Test public void nodeexpressionhc11() { final XQuery query = new XQuery( "fn:not((/staff[1]/employee[1]/empnum[1]) >> (/staff[1]/employee[1]/empnum[1]))", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test nodeexpressionhc12 Test of a node after expression used as part of a boolean-less-than expression (lt operator). . */ @org.junit.Test public void nodeexpressionhc12() { final XQuery query = new XQuery( "((/staff[1]/employee[1]/empnum[1]) >> (/staff[1]/employee[1]/empnum[1])) \n" + " lt ((/staff[1]/employee[1]/empnum[1]) >> (/staff[1]/employee[1]/empnum[1]))", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test nodeexpressionhc13 Test of a node after expression used as part of a boolean-less-than expression (ge operator). . */ @org.junit.Test public void nodeexpressionhc13() { final XQuery query = new XQuery( "((/staff[1]/employee[1]/empnum[1]) >> (/staff[1]/employee[1]/empnum[1])) \n" + " ge ((/staff[1]/employee[1]/empnum[1]) >> (/staff[1]/employee[1]/empnum[1]))", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test nodeexpression14hc Test of a node after expression used as part of a boolean-greater-than expression (gt operator). . */ @org.junit.Test public void nodeexpressionhc14() { final XQuery query = new XQuery( "((/staff[1]/employee[1]/empnum[1]) >> (/staff[1]/employee[1]/empnum[1])) \n" + " gt ((/staff[1]/employee[1]/empnum[1]) >> (/staff[1]/employee[1]/empnum[1]))", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test nodeexpressionhc15 Test of a node after expression used as part of a boolean-greater-than expression (le operator). . */ @org.junit.Test public void nodeexpressionhc15() { final XQuery query = new XQuery( "((/staff[1]/employee[1]/empnum[1]) >> (/staff[1]/employee[1]/empnum[1])) \n" + " le ((/staff[1]/employee[1]/empnum[1]) >> (/staff[1]/employee[1]/empnum[1]))", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpNodeBefore.java000066400000000000000000000503371222453003200273010ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the node-before() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpNodeBefore extends QT3TestSet { /** * A test whose essence is: `empty(1 << ())`. . */ @org.junit.Test public void kNodeBefore1() { final XQuery query = new XQuery( "empty(1 << ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") || error("XPST0005") ) ); } /** * A test whose essence is: `<< 1`. . */ @org.junit.Test public void kNodeBefore10() { final XQuery query = new XQuery( "<< 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A test whose essence is: `<<<`. . */ @org.junit.Test public void kNodeBefore11() { final XQuery query = new XQuery( "<<<", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A test whose essence is: `empty(() << 1)`. . */ @org.junit.Test public void kNodeBefore2() { final XQuery query = new XQuery( "empty(() << 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") || error("XPST0005") ) ); } /** * A test whose essence is: `1 << 1`. . */ @org.junit.Test public void kNodeBefore3() { final XQuery query = new XQuery( "1 << 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A test whose essence is: `empty(() << ())`. . */ @org.junit.Test public void kNodeBefore4() { final XQuery query = new XQuery( "empty(() << ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * A test whose essence is: `() <<< ()`. . */ @org.junit.Test public void kNodeBefore5() { final XQuery query = new XQuery( "() <<< ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A test whose essence is: `() <<`. . */ @org.junit.Test public void kNodeBefore6() { final XQuery query = new XQuery( "() <<", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A test whose essence is: `<< ()`. . */ @org.junit.Test public void kNodeBefore7() { final XQuery query = new XQuery( "<< ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A test whose essence is: `<<`. . */ @org.junit.Test public void kNodeBefore8() { final XQuery query = new XQuery( "<<", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A test whose essence is: `1 <<`. . */ @org.junit.Test public void kNodeBefore9() { final XQuery query = new XQuery( "1 <<", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * test node before operator . */ @org.junit.Test public void cbclNodeBefore001() { final XQuery query = new XQuery( "\n" + " \tlet $node := \n" + " \treturn not(exactly-one($node/b[1]) << exactly-one($node/c[1]))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test node before operator . */ @org.junit.Test public void cbclNodeBefore002() { final XQuery query = new XQuery( "\n" + " \tlet $node := \n" + " \treturn not(not(exactly-one($node/b[1]) << exactly-one($node/c[1])))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A node comparison where one of the operands is not the empty sequence or a single node. . */ @org.junit.Test public void nodecomparisonerr2() { final XQuery query = new XQuery( "fn:count(() << 100)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPTY0004") || error("XPST0005") ) ); } /** * Test of a ComparisonExpression with the operands set as follows * operand1 = empty Sequence operator = << operand2 = empty Sequence . */ @org.junit.Test public void nodeexpression17() { final XQuery query = new XQuery( "count(() << ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Test of a ComparisonExpression with the operands set as follows * operand1 = empty Sequence operator = << operand2 = Single Element Constructor . */ @org.junit.Test public void nodeexpression18() { final XQuery query = new XQuery( "count(() << 50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Test of a ComparisonExpression with the operands set as follows * operand1 = empty Sequence operator = << operand2 = Single Node Element . */ @org.junit.Test public void nodeexpression19() { final XQuery query = new XQuery( "count(() << /works[1]/employee[1]/empnum[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Test of a ComparisonExpression with the operands set as follows * operand1 = empty Sequence operator = << operand2 = Sequence of single Element Node . */ @org.junit.Test public void nodeexpression20() { final XQuery query = new XQuery( "count(() << /staff[1]/employee[1]/empnum[1])", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Test of a ComparisonExpression with the operands set as follows * operand1 = Single Element Constructor operator = << operand2 = empty Sequence . */ @org.junit.Test public void nodeexpression21() { final XQuery query = new XQuery( "count(50000 << ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Test of a ComparisonExpression with the operands set as follows * operand1 = Single Element Constructor operator = << operand2 = Single Element Constructor . */ @org.junit.Test public void nodeexpression22() { final XQuery query = new XQuery( "50000 << 50000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || assertBoolean(false) ) ); } /** * Test of a ComparisonExpression with the operands set as follows * operand1 = Single Element Constructor operator = << operand2 = Single Node Element . */ @org.junit.Test public void nodeexpression23() { final XQuery query = new XQuery( "50000 << /works[1]/employee[1]/empnum[1]", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || assertBoolean(false) ) ); } /** * Test of a ComparisonExpression with the operands set as follows * operand1 = Single Element Constructor operator = << operand2 = Sequence of single Element Node . */ @org.junit.Test public void nodeexpression24() { final XQuery query = new XQuery( "50000 << (/staff[1]/employee[1]/empnum[1])", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || assertBoolean(false) ) ); } /** * Test of a ComparisonExpression with the operands set as follows * operand1 = Single Node Element operator = << operand2 = empty Sequence . */ @org.junit.Test public void nodeexpression25() { final XQuery query = new XQuery( "count(/works[1]/employee[1]/empnum[1] << ())", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Test of a ComparisonExpression with the operands set as follows * operand1 = Single Node Element operator = << operand2 = Single Element Constructor . */ @org.junit.Test public void nodeexpression26() { final XQuery query = new XQuery( "/works[1]/employee[1]/empnum[1] << 50000", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || assertBoolean(false) ) ); } /** * Test of a ComparisonExpression with the operands set as follows * operand1 = Single Node Element operator = << operand2 = Single Node Element . */ @org.junit.Test public void nodeexpression27() { final XQuery query = new XQuery( "/works[1]/employee[1]/empnum[1] << /works[1]/employee[1]/empnum[1]", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a ComparisonExpression with the operands set as follows * operand1 = Single Node Element operator = << operand2 = Sequence of single Element Node . */ @org.junit.Test public void nodeexpression28() { final XQuery query = new XQuery( "$works/works[1]/employee[1]/empnum[1] << $staff/staff[1]/employee[1]/empnum[1]", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || assertBoolean(false) ) ); } /** * Test of a ComparisonExpression with the operands set as follows * operand1 = Sequence of single Element Node operator = << operand2 = empty Sequence . */ @org.junit.Test public void nodeexpression29() { final XQuery query = new XQuery( "count((/staff[1]/employee[1]/empnum[1]) << ())", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Test of a ComparisonExpression with the operands set as follows * operand1 = Sequence of single Element Node operator = << operand2 = Single Element Constructor . */ @org.junit.Test public void nodeexpression30() { final XQuery query = new XQuery( "(/staff[1]/employee[1]/empnum[1]) << 50000", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || assertBoolean(false) ) ); } /** * Name nodeexpression31 Test of a ComparisonExpression testing the * rule that states "If any node in a given tree, T1, occurs before any node in a * different tree, T2, then all nodes in T1 are before all nodes in T2." * Compare the first node of the first operand against various nodes of the second operand. . */ @org.junit.Test public void nodeexpression31() { final XQuery query = new XQuery( "(($works/works[1]/employee[1]/empnum[1] << $staff/staff[1]/employee[1]/empnum[1]) \n" + " and ($works/works[1]/employee[1]/empnum[1] << $staff/staff[1]/employee[2]/empnum[1]) \n" + " and ($works/works[1]/employee[1]/empnum[1] << $staff/staff[1]/employee[3]/empnum[1])) \n" + " or (($works/works[1]/employee[1]/empnum[1] >> $staff/staff[1]/employee[1]/empnum[1]) \n" + " and ($works/works[1]/employee[1]/empnum[1] >> $staff/staff[1]/employee[2]/empnum[1]) \n" + " and ($works/works[1]/employee[1]/empnum[1] >> $staff/staff[1]/employee[3]/empnum[1]))", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a ComparisonExpression with the operands set as follows * operand1 = Sequence of single Element Node operator = << operand2 = Sequence of single Element Node . */ @org.junit.Test public void nodeexpression32() { final XQuery query = new XQuery( "(/staff[1]/employee[1]/empnum[1]) << (/staff[1]/employee[1]/empnum[1])", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a Node before Expression used as part of a boolean-greater-than expression (le operator). . */ @org.junit.Test public void nodeexpressionhc10() { final XQuery query = new XQuery( "((/staff[1]/employee[1]/empnum[1]) << (/staff[1]/employee[1]/empnum[1])) \n" + " le ((/staff[1]/employee[1]/empnum[1]) << (/staff[1]/employee[1]/empnum[1]))", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a Node before Expression used as an argument to a "fn:not" function. . */ @org.junit.Test public void nodeexpressionhc6() { final XQuery query = new XQuery( "fn:not((/staff[1]/employee[1]/empnum[1]) << (/staff[1]/employee[1]/empnum[1]))", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a Node before Expression used as part of a boolean-less-than expression (lt operator). . */ @org.junit.Test public void nodeexpressionhc7() { final XQuery query = new XQuery( "((/staff[1]/employee[1]/empnum[1]) << (/staff[1]/employee[1]/empnum[1])) \n" + " lt \n" + " ((/staff[1]/employee[1]/empnum[1]) << (/staff[1]/employee[1]/empnum[1]))", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a Node before Expression used as part of a boolean-less-than expression (ge operator). . */ @org.junit.Test public void nodeexpressionhc8() { final XQuery query = new XQuery( "((/staff[1]/employee[1]/empnum[1]) << (/staff[1]/employee[1]/empnum[1])) \n" + " ge\n" + " ((/staff[1]/employee[1]/empnum[1]) << (/staff[1]/employee[1]/empnum[1]))", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a Node before Expression used as part of a boolean-greater-than expression (gt operator). . */ @org.junit.Test public void nodeexpressionhc9() { final XQuery query = new XQuery( "((/staff[1]/employee[1]/empnum[1]) << (/staff[1]/employee[1]/empnum[1])) \n" + " gt ((/staff[1]/employee[1]/empnum[1]) << (/staff[1]/employee[1]/empnum[1]))", ctx); try { query.context(node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpNumericAdd.java000066400000000000000000002131721222453003200273020ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the numeric-add() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpNumericAdd extends QT3TestSet { /** * A test whose essence is: `xs:double(6) + xs:double(2) eq 8`. . */ @org.junit.Test public void kNumericAdd1() { final XQuery query = new XQuery( "xs:double(6) + xs:double(2) eq 8", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(xs:double("NaN") + 3) eq "NaN"`. . */ @org.junit.Test public void kNumericAdd10() { final XQuery query = new XQuery( "string(xs:double(\"NaN\") + 3) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(3 + xs:float("NaN")) eq "NaN"`. . */ @org.junit.Test public void kNumericAdd11() { final XQuery query = new XQuery( "string(3 + xs:float(\"NaN\")) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(3 + xs:double("NaN")) eq "NaN"`. . */ @org.junit.Test public void kNumericAdd12() { final XQuery query = new XQuery( "string(3 + xs:double(\"NaN\")) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:decimal(6) + xs:integer(2)) instance of xs:decimal`. . */ @org.junit.Test public void kNumericAdd13() { final XQuery query = new XQuery( "(xs:decimal(6) + xs:integer(2)) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:integer(6) + xs:decimal(2)) instance of xs:decimal`. . */ @org.junit.Test public void kNumericAdd14() { final XQuery query = new XQuery( "(xs:integer(6) + xs:decimal(2)) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:integer(6) + xs:integer(2)) instance of xs:integer`. . */ @org.junit.Test public void kNumericAdd15() { final XQuery query = new XQuery( "(xs:integer(6) + xs:integer(2)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:decimal(6) + xs:decimal(2)) instance of xs:decimal`. . */ @org.junit.Test public void kNumericAdd16() { final XQuery query = new XQuery( "(xs:decimal(6) + xs:decimal(2)) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:decimal(6) + xs:float(2)) instance of xs:float`. . */ @org.junit.Test public void kNumericAdd17() { final XQuery query = new XQuery( "(xs:decimal(6) + xs:float(2)) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:float(6) + xs:decimal(2)) instance of xs:float`. . */ @org.junit.Test public void kNumericAdd18() { final XQuery query = new XQuery( "(xs:float(6) + xs:decimal(2)) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:float(6) + xs:integer(2)) instance of xs:float`. . */ @org.junit.Test public void kNumericAdd19() { final XQuery query = new XQuery( "(xs:float(6) + xs:integer(2)) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:decimal(6) + xs:decimal(2) eq 8`. . */ @org.junit.Test public void kNumericAdd2() { final XQuery query = new XQuery( "xs:decimal(6) + xs:decimal(2) eq 8", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:integer(6) + xs:float(2)) instance of xs:float`. . */ @org.junit.Test public void kNumericAdd20() { final XQuery query = new XQuery( "(xs:integer(6) + xs:float(2)) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:float(6) + xs:float(2)) instance of xs:float`. . */ @org.junit.Test public void kNumericAdd21() { final XQuery query = new XQuery( "(xs:float(6) + xs:float(2)) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:decimal(6) + xs:double(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericAdd22() { final XQuery query = new XQuery( "(xs:decimal(6) + xs:double(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:double(6) + xs:decimal(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericAdd23() { final XQuery query = new XQuery( "(xs:double(6) + xs:decimal(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:double(6) + xs:float(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericAdd24() { final XQuery query = new XQuery( "(xs:double(6) + xs:float(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:float(6) + xs:double(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericAdd25() { final XQuery query = new XQuery( "(xs:float(6) + xs:double(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:double(6) + xs:integer(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericAdd26() { final XQuery query = new XQuery( "(xs:double(6) + xs:integer(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:integer(6) + xs:double(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericAdd27() { final XQuery query = new XQuery( "(xs:integer(6) + xs:double(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:double(6) + xs:double(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericAdd28() { final XQuery query = new XQuery( "(xs:double(6) + xs:double(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test parser handles '+' operator with critical whitespace. . */ @org.junit.Test public void kNumericAdd29() { final XQuery query = new XQuery( "1+1 eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:decimal(6.1) + xs:decimal(2.1) eq 8.2`. . */ @org.junit.Test public void kNumericAdd3() { final XQuery query = new XQuery( "xs:decimal(6.1) + xs:decimal(2.1) eq 8.2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test parser handles '+' operator with critical whitespace(#2). . */ @org.junit.Test public void kNumericAdd30() { final XQuery query = new XQuery( "2 eq 1+1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke operator '+' where one of the operands is of type none. . */ @org.junit.Test public void kNumericAdd31() { final XQuery query = new XQuery( "3 + error()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * Invoke operator '+' where one of the operands is of type none. . */ @org.junit.Test public void kNumericAdd32() { final XQuery query = new XQuery( "error() + 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * Invoke operator '+' where one of the operands is of type none. . */ @org.junit.Test public void kNumericAdd33() { final XQuery query = new XQuery( "3 + (error(), 4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * Invoke operator '+' where one of the operands is of type none. . */ @org.junit.Test public void kNumericAdd34() { final XQuery query = new XQuery( "(4, error()) + 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FOER0000") || error("XPST0005") ) ); } /** * Invoke operator '+' where one of the operands is of type none. . */ @org.junit.Test public void kNumericAdd35() { final XQuery query = new XQuery( "3 + (4, error())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FOER0000") || error("XPST0005") ) ); } /** * Invoke operator '+' where one of the operands is of type none. . */ @org.junit.Test public void kNumericAdd36() { final XQuery query = new XQuery( "(error(), 4) + 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * Arithmethics involving operands of integer type but with wrong cardinality. . */ @org.junit.Test public void kNumericAdd37() { final XQuery query = new XQuery( "(1, 2) + 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Arithmethics involving operands of integer type but with wrong cardinality. . */ @org.junit.Test public void kNumericAdd38() { final XQuery query = new XQuery( "empty((1, 2) + ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * Arithmethics involving operands of integer type but with wrong cardinality. . */ @org.junit.Test public void kNumericAdd39() { final XQuery query = new XQuery( "1 + (1, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || error("XPST0005") ) ); } /** * A test whose essence is: `1.1 + 2.2 eq 3.3`. . */ @org.junit.Test public void kNumericAdd4() { final XQuery query = new XQuery( "1.1 + 2.2 eq 3.3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Arithmethics involving operands of integer type but with wrong cardinality. . */ @org.junit.Test public void kNumericAdd40() { final XQuery query = new XQuery( "empty(() + (1, 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") || error("XPST0005") ) ); } /** * Number addition with error() as the left operand. . */ @org.junit.Test public void kNumericAdd41() { final XQuery query = new XQuery( "error() + 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FOER0000") || error("XPST0005") ) ); } /** * Number addition with error() as the right operand. . */ @org.junit.Test public void kNumericAdd42() { final XQuery query = new XQuery( "3 + error()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * Invoke the '+' operator with invalid operands. . */ @org.junit.Test public void kNumericAdd43() { final XQuery query = new XQuery( "\"3\" + \"3\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Invoke the '+' operator with invalid operands. . */ @org.junit.Test public void kNumericAdd44() { final XQuery query = new XQuery( "\"3\" + xs:untypedAtomic(\"3\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A test whose essence is: `(3 + xs:untypedAtomic("3")) eq 6`. . */ @org.junit.Test public void kNumericAdd45() { final XQuery query = new XQuery( "(3 + xs:untypedAtomic(\"3\")) eq 6", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:untypedAtomic("3") + 3.0) eq 6`. . */ @org.junit.Test public void kNumericAdd46() { final XQuery query = new XQuery( "(xs:untypedAtomic(\"3\") + 3.0) eq 6", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Complex combination of numeric arithmetics in order to stress operator precedence. . */ @org.junit.Test public void kNumericAdd47() { final XQuery query = new XQuery( "(2 + 4) * 5 eq 30", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Complex combination of numeric arithmetics in order to stress operator precedence. . */ @org.junit.Test public void kNumericAdd48() { final XQuery query = new XQuery( "2 + 4 * 5 eq 22", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Complex combination of numeric arithmetics in order to stress operator precedence. . */ @org.junit.Test public void kNumericAdd49() { final XQuery query = new XQuery( "1 + 2 * 4 + (1 + 2 + 3 * 4) eq 24", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:double(1.1) + xs:double(2.2) ne 3.3`. . */ @org.junit.Test public void kNumericAdd5() { final XQuery query = new XQuery( "xs:double(1.1) + xs:double(2.2) ne 3.3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Operand(s) which are the empty sequence. . */ @org.junit.Test public void kNumericAdd50() { final XQuery query = new XQuery( "empty(() + ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Implementations supporting the static typing feature may raise XPTy0004. . */ @org.junit.Test public void kNumericAdd51() { final XQuery query = new XQuery( "(remove((1, \"two\"), 2) + 1) eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * Implementations supporting the static typing feature may raise XPTy0004. . */ @org.junit.Test public void kNumericAdd52() { final XQuery query = new XQuery( "2 eq (1 + remove((1, \"two\"), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * Implementations supporting the static typing feature may raise XPTy0004. . */ @org.junit.Test public void kNumericAdd53() { final XQuery query = new XQuery( "(remove((1, \"two\"), 2) + xs:untypedAtomic(\"1\")) eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * Implementations supporting the static typing feature may raise XPTy0004. . */ @org.junit.Test public void kNumericAdd54() { final XQuery query = new XQuery( "2 eq (xs:untypedAtomic(\"1\") + remove((1, \"two\"), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * Implementations supporting the static typing feature may raise XPTy0004. . */ @org.junit.Test public void kNumericAdd55() { final XQuery query = new XQuery( "(remove((xs:untypedAtomic(\"1\"), \"two\"), 2) + 1) eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * Implementations supporting the static typing feature may raise XPTy0004. . */ @org.junit.Test public void kNumericAdd56() { final XQuery query = new XQuery( "2 eq (1 + remove((xs:untypedAtomic(\"1\"), \"two\"), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * Implementations supporting the static typing feature may raise XPTy0004. . */ @org.junit.Test public void kNumericAdd57() { final XQuery query = new XQuery( "(remove((1, \"two\"), 2) + xs:untypedAtomic(\"1\")) eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * Implementations supporting the static typing feature may raise XPTy0004. . */ @org.junit.Test public void kNumericAdd58() { final XQuery query = new XQuery( "2 eq (xs:untypedAtomic(\"1\") + remove((1, \"two\"), 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * A test whose essence is: `xs:untypedAtomic("3") + 3 eq 6`. . */ @org.junit.Test public void kNumericAdd59() { final XQuery query = new XQuery( "xs:untypedAtomic(\"3\") + 3 eq 6", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:float(1.1) + xs:float(2.2) ne 3.3`. . */ @org.junit.Test public void kNumericAdd6() { final XQuery query = new XQuery( "xs:float(1.1) + xs:float(2.2) ne 3.3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:untypedAtomic("3") + 3) instance of xs:double`. . */ @org.junit.Test public void kNumericAdd60() { final XQuery query = new XQuery( "(xs:untypedAtomic(\"3\") + 3) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(remove((5, 1e0), 2) + 1) eq 6`. . */ @org.junit.Test public void kNumericAdd61() { final XQuery query = new XQuery( "(remove((5, 1e0), 2) + 1) eq 6", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * A test whose essence is: `(1 + remove((5, 1e0), 2)) eq 6`. . */ @org.junit.Test public void kNumericAdd62() { final XQuery query = new XQuery( "(1 + remove((5, 1e0), 2)) eq 6", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * Invoke operator '+' where one of the operands, using subsequence(), evaluates to an invalid cardinality. . */ @org.junit.Test public void kNumericAdd63() { final XQuery query = new XQuery( "1 + subsequence(\"a string\", 1, 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Invoke operator '+' where one of the operands, using subsequence(), evaluates to an invalid cardinality. . */ @org.junit.Test public void kNumericAdd64() { final XQuery query = new XQuery( "subsequence(\"a string\", 1, 1) + 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Invoke operator '+' where one of the operands is a string. . */ @org.junit.Test public void kNumericAdd65() { final XQuery query = new XQuery( "\"foo\" + 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Invoke operator '+' where one of the operands is a string. . */ @org.junit.Test public void kNumericAdd66() { final XQuery query = new XQuery( "1 + \"foo\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A test whose essence is: `xs:integer(6) + xs:integer(2) eq 8`. . */ @org.junit.Test public void kNumericAdd7() { final XQuery query = new XQuery( "xs:integer(6) + xs:integer(2) eq 8", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:float(6) + xs:float(2) eq 8`. . */ @org.junit.Test public void kNumericAdd8() { final XQuery query = new XQuery( "xs:float(6) + xs:float(2) eq 8", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(xs:float("NaN") + 3) eq "NaN"`. . */ @org.junit.Test public void kNumericAdd9() { final XQuery query = new XQuery( "string(xs:float(\"NaN\") + 3) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Arithmethics involving operands of integer type but where both have wrong cardinality. . */ @org.junit.Test public void k2NumericAdd1() { final XQuery query = new XQuery( "(1, 2) + (1, 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Arithmetics where the operands are directly constructed nodes. . */ @org.junit.Test public void k2NumericAdd2() { final XQuery query = new XQuery( "1 + 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Arithmetics where the operands are directly constructed attributes. . */ @org.junit.Test public void k2NumericAdd3() { final XQuery query = new XQuery( "/@foo + /@foo", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Check dynamic type of numeric add on arguments of union of numeric types and untypedAtomic. . */ @org.junit.Test public void opNumericAdd1() { final XQuery query = new XQuery( "for $x in (1, xs:decimal(2), xs:float(3), xs:double(4), xs:untypedAtomic(5)) for $y in (1, xs:decimal(2), xs:float(3), xs:double(4), xs:untypedAtomic(5)) return typeswitch ($x + $y) case xs:integer return \"integer\" case xs:decimal return \"decimal\" case xs:float return \"float\" case xs:double return \"double\" default return error()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "integer decimal float double double decimal decimal float double double float float float double double double double double double double double double double double double") ); } /** * Evaluates The "op:numeric-add" operator with the operators set as follows $arg1 = xs:long $arg2 = xs:unsignedLong . */ @org.junit.Test public void opNumericAddDerived1() { final XQuery query = new XQuery( "xs:long(10) + xs:unsignedLong(35)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("45") ); } /** * Evaluates The "op:numeric-add" operator with the operators set as follows $arg1 = xs:positiveInteger $arg2 = xs:nonPositiveInteger . */ @org.junit.Test public void opNumericAddDerived2() { final XQuery query = new XQuery( "xs:positiveInteger(10) + xs:nonPositiveInteger(-15)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-5") ); } /** * Evaluates The "op:numeric-add" operator with the operators set as follows $arg1 = xs:nonNegativeInteger $arg2 = xs:short . */ @org.junit.Test public void opNumericAddDerived3() { final XQuery query = new XQuery( "xs:nonNegativeInteger(10) + xs:short(15)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("25") ); } /** * Evaluates The "op:numeric-add" operator with the operators set as follows $arg1 = xs:short $arg2 = xs:long . */ @org.junit.Test public void opNumericAddDerived4() { final XQuery query = new XQuery( "xs:short(10) + xs:long(145)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("155") ); } /** * Evaluates The "op:numeric-add" operator with the operators set as follows $arg1 = xs:positiveInteger $arg2 = xs:negativeInteger . */ @org.junit.Test public void opNumericAddDerived5() { final XQuery query = new XQuery( "xs:positiveInteger(10) + xs:negativeInteger(-5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:double(mid range) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void opNumericAdddbl2args1() { final XQuery query = new XQuery( "xs:double(\"0\") + xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.7976931348623157E308") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:double(upper bound) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void opNumericAdddbl2args2() { final XQuery query = new XQuery( "xs:double(\"1.7976931348623157E308\") + xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(mid range) . */ @org.junit.Test public void opNumericAdddbl2args3() { final XQuery query = new XQuery( "xs:double(\"-1.7976931348623157E308\") + xs:double(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.7976931348623157E308") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(upper bound) . */ @org.junit.Test public void opNumericAdddbl2args4() { final XQuery query = new XQuery( "xs:double(\"-1.7976931348623157E308\") + xs:double(\"1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:decimal(mid range) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void opNumericAdddec2args1() { final XQuery query = new XQuery( "xs:decimal(\"617375191608514839\") + xs:decimal(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-382624808391485160") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:decimal(upper bound) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void opNumericAdddec2args2() { final XQuery query = new XQuery( "xs:decimal(\"999999999999999999\") + xs:decimal(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(mid range) . */ @org.junit.Test public void opNumericAdddec2args3() { final XQuery query = new XQuery( "xs:decimal(\"-999999999999999999\") + xs:decimal(\"617375191608514839\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-382624808391485160") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(upper bound) . */ @org.junit.Test public void opNumericAdddec2args4() { final XQuery query = new XQuery( "xs:decimal(\"-999999999999999999\") + xs:decimal(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:float(mid range) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void opNumericAddflt2args1() { final XQuery query = new XQuery( "xs:float(\"0\") + xs:float(\"-3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(-3.4028235E38)") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:float(upper bound) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void opNumericAddflt2args2() { final XQuery query = new XQuery( "xs:float(\"3.4028235E38\") + xs:float(\"-3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(mid range) . */ @org.junit.Test public void opNumericAddflt2args3() { final XQuery query = new XQuery( "xs:float(\"-3.4028235E38\") + xs:float(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(-3.4028235E38)") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(upper bound) . */ @org.junit.Test public void opNumericAddflt2args4() { final XQuery query = new XQuery( "xs:float(\"-3.4028235E38\") + xs:float(\"3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:int(mid range) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void opNumericAddint2args1() { final XQuery query = new XQuery( "xs:int(\"-1873914410\") + xs:int(\"-273569238\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2147483648") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:int(upper bound) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void opNumericAddint2args2() { final XQuery query = new XQuery( "xs:int(\"2147483647\") + xs:int(\"-2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(mid range) . */ @org.junit.Test public void opNumericAddint2args3() { final XQuery query = new XQuery( "xs:int(\"-273569238\") + xs:int(\"-1873914410\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2147483648") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(upper bound) . */ @org.junit.Test public void opNumericAddint2args4() { final XQuery query = new XQuery( "xs:int(\"-2147483648\") + xs:int(\"2147483647\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:integer(mid range) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void opNumericAddintg2args1() { final XQuery query = new XQuery( "xs:integer(\"830993497117024304\") + xs:integer(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-169006502882975695") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:integer(upper bound) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void opNumericAddintg2args2() { final XQuery query = new XQuery( "xs:integer(\"999999999999999999\") + xs:integer(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(mid range) . */ @org.junit.Test public void opNumericAddintg2args3() { final XQuery query = new XQuery( "xs:integer(\"-999999999999999999\") + xs:integer(\"830993497117024304\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-169006502882975695") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(upper bound) . */ @org.junit.Test public void opNumericAddintg2args4() { final XQuery query = new XQuery( "xs:integer(\"-999999999999999999\") + xs:integer(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:long(mid range) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void opNumericAddlng2args1() { final XQuery query = new XQuery( "xs:long(\"-47175562203048468\") + xs:long(\"-45058158165499290\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:long(upper bound) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void opNumericAddlng2args2() { final XQuery query = new XQuery( "xs:long(\"92233720368547758\") + xs:long(\"-92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(mid range) . */ @org.junit.Test public void opNumericAddlng2args3() { final XQuery query = new XQuery( "xs:long(\"-45058158165499290\") + xs:long(\"-47175562203048468\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(upper bound) . */ @org.junit.Test public void opNumericAddlng2args4() { final XQuery query = new XQuery( "xs:long(\"-92233720368547758\") + xs:long(\"92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Simple addition test with () as one operand should return null . */ @org.junit.Test public void opNumericAddmix2args1() { final XQuery query = new XQuery( "1 + ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEmpty() || error("XPST0005") ) ); } /** * Simple addition test pass string for second operator . */ @org.junit.Test public void opNumericAddmix2args2() { final XQuery query = new XQuery( "1 + '1'", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Simple addition test, second operator cast string to integer . */ @org.junit.Test public void opNumericAddmix2args3() { final XQuery query = new XQuery( "1 + xs:integer('1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Simple addition test, second operator is a node, atomization applied . */ @org.junit.Test public void opNumericAddmix2args4() { final XQuery query = new XQuery( "1 + 2 ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Simple addition test, second operator is a node, atomization applied . */ @org.junit.Test public void opNumericAddmix2args5() { final XQuery query = new XQuery( "1+ 2 ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Simple addition test, second operator node which is not atomizable . */ @org.junit.Test public void opNumericAddmix2args6() { final XQuery query = new XQuery( "1 + 2 2 ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Simple addition test, two operands are nodes . */ @org.junit.Test public void opNumericAddmix2args7() { final XQuery query = new XQuery( " 1 + 2 ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Simple addition test, second operator is a node, atomizable but not castable to integer . */ @org.junit.Test public void opNumericAddmix2args8() { final XQuery query = new XQuery( "1 + x ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Simple addition test pass an empty node for second operator . */ @org.junit.Test public void opNumericAddmix2args9() { final XQuery query = new XQuery( "1 + ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:negativeInteger(mid range) $arg2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void opNumericAddnint2args1() { final XQuery query = new XQuery( "xs:negativeInteger(\"-297014075999096793\") + xs:negativeInteger(\"-702985924000903206\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:negativeInteger(upper bound) $arg2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void opNumericAddnint2args2() { final XQuery query = new XQuery( "xs:negativeInteger(\"-1\") + xs:negativeInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1000000000000000000") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(mid range) . */ @org.junit.Test public void opNumericAddnint2args3() { final XQuery query = new XQuery( "xs:negativeInteger(\"-702985924000903206\") + xs:negativeInteger(\"-297014075999096793\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(upper bound) . */ @org.junit.Test public void opNumericAddnint2args4() { final XQuery query = new XQuery( "xs:negativeInteger(\"-999999999999999999\") + xs:negativeInteger(\"-1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1000000000000000000") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void opNumericAddnni2args1() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") + xs:nonNegativeInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(mid range) $arg2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void opNumericAddnni2args2() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"303884545991464527\") + xs:nonNegativeInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("303884545991464527") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(upper bound) $arg2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void opNumericAddnni2args3() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"999999999999999999\") + xs:nonNegativeInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void opNumericAddnni2args4() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") + xs:nonNegativeInteger(\"303884545991464527\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("303884545991464527") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void opNumericAddnni2args5() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") + xs:nonNegativeInteger(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(mid range) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void opNumericAddnpi2args1() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-475688437271870490\") + xs:nonPositiveInteger(\"-524311562728129509\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(upper bound) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void opNumericAddnpi2args2() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"0\") + xs:nonPositiveInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void opNumericAddnpi2args3() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-524311562728129509\") + xs:nonPositiveInteger(\"-475688437271870490\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void opNumericAddnpi2args4() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-999999999999999999\") + xs:nonPositiveInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void opNumericAddpint2args1() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") + xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:positiveInteger(mid range) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void opNumericAddpint2args2() { final XQuery query = new XQuery( "xs:positiveInteger(\"52704602390610033\") + xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("52704602390610034") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:positiveInteger(upper bound) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void opNumericAddpint2args3() { final XQuery query = new XQuery( "xs:positiveInteger(\"999999999999999998\") + xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(mid range) . */ @org.junit.Test public void opNumericAddpint2args4() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") + xs:positiveInteger(\"52704602390610033\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("52704602390610034") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(upper bound) . */ @org.junit.Test public void opNumericAddpint2args5() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") + xs:positiveInteger(\"999999999999999998\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:short(mid range) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void opNumericAddsht2args1() { final XQuery query = new XQuery( "xs:short(\"-5324\") + xs:short(\"-27444\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-32768") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:short(upper bound) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void opNumericAddsht2args2() { final XQuery query = new XQuery( "xs:short(\"32767\") + xs:short(\"-32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(mid range) . */ @org.junit.Test public void opNumericAddsht2args3() { final XQuery query = new XQuery( "xs:short(\"-27444\") + xs:short(\"-5324\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-32768") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(upper bound) . */ @org.junit.Test public void opNumericAddsht2args4() { final XQuery query = new XQuery( "xs:short(\"-32768\") + xs:short(\"32767\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void opNumericAddulng2args1() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") + xs:unsignedLong(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:unsignedLong(mid range) $arg2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void opNumericAddulng2args2() { final XQuery query = new XQuery( "xs:unsignedLong(\"130747108607674654\") + xs:unsignedLong(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("130747108607674654") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:unsignedLong(upper bound) $arg2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void opNumericAddulng2args3() { final XQuery query = new XQuery( "xs:unsignedLong(\"184467440737095516\") + xs:unsignedLong(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("184467440737095516") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(mid range) . */ @org.junit.Test public void opNumericAddulng2args4() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") + xs:unsignedLong(\"130747108607674654\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("130747108607674654") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(upper bound) . */ @org.junit.Test public void opNumericAddulng2args5() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") + xs:unsignedLong(\"184467440737095516\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("184467440737095516") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void opNumericAddusht2args1() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") + xs:unsignedShort(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:unsignedShort(mid range) $arg2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void opNumericAddusht2args2() { final XQuery query = new XQuery( "xs:unsignedShort(\"44633\") + xs:unsignedShort(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("44633") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:unsignedShort(upper bound) $arg2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void opNumericAddusht2args3() { final XQuery query = new XQuery( "xs:unsignedShort(\"65535\") + xs:unsignedShort(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("65535") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(mid range) . */ @org.junit.Test public void opNumericAddusht2args4() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") + xs:unsignedShort(\"44633\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("44633") ); } /** * Evaluates The "op:numeric-add" operator with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(upper bound) . */ @org.junit.Test public void opNumericAddusht2args5() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") + xs:unsignedShort(\"65535\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("65535") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpNumericDivide.java000066400000000000000000002165561222453003200300270ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the numeric-divide() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpNumericDivide extends QT3TestSet { /** * A test whose essence is: `xs:double(6) div xs:double(2) eq 3`. . */ @org.junit.Test public void kNumericDivide1() { final XQuery query = new XQuery( "xs:double(6) div xs:double(2) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:integer(5) div xs:integer(2) ne 2.6`. . */ @org.junit.Test public void kNumericDivide10() { final XQuery query = new XQuery( "xs:integer(5) div xs:integer(2) ne 2.6", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:decimal(5) div xs:decimal(2) eq 2.5`. . */ @org.junit.Test public void kNumericDivide11() { final XQuery query = new XQuery( "xs:decimal(5) div xs:decimal(2) eq 2.5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:decimal(5) div xs:decimal(2) ne 2.6`. . */ @org.junit.Test public void kNumericDivide12() { final XQuery query = new XQuery( "xs:decimal(5) div xs:decimal(2) ne 2.6", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `5 div 2 ne 2.6`. . */ @org.junit.Test public void kNumericDivide13() { final XQuery query = new XQuery( "5 div 2 ne 2.6", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `5.0 div 2.0 eq 2.5`. . */ @org.junit.Test public void kNumericDivide14() { final XQuery query = new XQuery( "5.0 div 2.0 eq 2.5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `5.0 div 2.0 ne 2.6`. . */ @org.junit.Test public void kNumericDivide15() { final XQuery query = new XQuery( "5.0 div 2.0 ne 2.6", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:decimal(6) div xs:integer(2)) instance of xs:decimal`. . */ @org.junit.Test public void kNumericDivide16() { final XQuery query = new XQuery( "(xs:decimal(6) div xs:integer(2)) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:integer(6) div xs:decimal(2)) instance of xs:decimal`. . */ @org.junit.Test public void kNumericDivide17() { final XQuery query = new XQuery( "(xs:integer(6) div xs:decimal(2)) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:integer(6) div xs:integer(2)) instance of xs:decimal`. . */ @org.junit.Test public void kNumericDivide18() { final XQuery query = new XQuery( "(xs:integer(6) div xs:integer(2)) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:decimal(6) div xs:decimal(2)) instance of xs:decimal`. . */ @org.junit.Test public void kNumericDivide19() { final XQuery query = new XQuery( "(xs:decimal(6) div xs:decimal(2)) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:decimal(6) div xs:decimal(2) eq 3`. . */ @org.junit.Test public void kNumericDivide2() { final XQuery query = new XQuery( "xs:decimal(6) div xs:decimal(2) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:float(6) div xs:decimal(2)) instance of xs:float`. . */ @org.junit.Test public void kNumericDivide20() { final XQuery query = new XQuery( "(xs:float(6) div xs:decimal(2)) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:decimal(6) div xs:float(2)) instance of xs:float`. . */ @org.junit.Test public void kNumericDivide21() { final XQuery query = new XQuery( "(xs:decimal(6) div xs:float(2)) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:float(6) div xs:integer(2)) instance of xs:float`. . */ @org.junit.Test public void kNumericDivide22() { final XQuery query = new XQuery( "(xs:float(6) div xs:integer(2)) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:integer(6) div xs:float(2)) instance of xs:float`. . */ @org.junit.Test public void kNumericDivide23() { final XQuery query = new XQuery( "(xs:integer(6) div xs:float(2)) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:float(6) div xs:float(2)) instance of xs:float`. . */ @org.junit.Test public void kNumericDivide24() { final XQuery query = new XQuery( "(xs:float(6) div xs:float(2)) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:decimal(6) div xs:double(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericDivide25() { final XQuery query = new XQuery( "(xs:decimal(6) div xs:double(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:double(6) div xs:decimal(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericDivide26() { final XQuery query = new XQuery( "(xs:double(6) div xs:decimal(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:double(6) div xs:float(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericDivide27() { final XQuery query = new XQuery( "(xs:double(6) div xs:float(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:float(6) div xs:double(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericDivide28() { final XQuery query = new XQuery( "(xs:float(6) div xs:double(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:double(6) div xs:integer(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericDivide29() { final XQuery query = new XQuery( "(xs:double(6) div xs:integer(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:integer(6) div xs:integer(2) eq 3`. . */ @org.junit.Test public void kNumericDivide3() { final XQuery query = new XQuery( "xs:integer(6) div xs:integer(2) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:integer(6) div xs:double(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericDivide30() { final XQuery query = new XQuery( "(xs:integer(6) div xs:double(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:double(6) div xs:double(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericDivide31() { final XQuery query = new XQuery( "(xs:double(6) div xs:double(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke the 'div operator with invalid operands. . */ @org.junit.Test public void kNumericDivide32() { final XQuery query = new XQuery( "\"3\" div \"3\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Invoke the 'div' operator with invalid operands. . */ @org.junit.Test public void kNumericDivide33() { final XQuery query = new XQuery( "xs:double(3) div \"3\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A test whose essence is: `(xs:double(3) div xs:untypedAtomic("3")) eq 1`. . */ @org.junit.Test public void kNumericDivide34() { final XQuery query = new XQuery( "(xs:double(3) div xs:untypedAtomic(\"3\")) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:untypedAtomic("3") div xs:double(3)) eq 1`. . */ @org.junit.Test public void kNumericDivide35() { final XQuery query = new XQuery( "(xs:untypedAtomic(\"3\") div xs:double(3)) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invalid whitespace for the 'div' operator. . */ @org.junit.Test public void kNumericDivide36() { final XQuery query = new XQuery( "10 div3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Invalid whitespace for the 'div' operator. . */ @org.junit.Test public void kNumericDivide37() { final XQuery query = new XQuery( "10div 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Invalid whitespace for the 'div' operator. . */ @org.junit.Test public void kNumericDivide38() { final XQuery query = new XQuery( "10div3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Operand(s) which are the empty sequence. . */ @org.junit.Test public void kNumericDivide39() { final XQuery query = new XQuery( "empty(() div ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * A test whose essence is: `xs:float(6) div xs:float(2) eq 3`. . */ @org.junit.Test public void kNumericDivide4() { final XQuery query = new XQuery( "xs:float(6) div xs:float(2) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Operand(s) which are the empty sequence. . */ @org.junit.Test public void kNumericDivide40() { final XQuery query = new XQuery( "empty(1 div ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Operand(s) which are the empty sequence. . */ @org.junit.Test public void kNumericDivide41() { final XQuery query = new XQuery( "empty(() div 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Operand(s) which are the empty sequence. . */ @org.junit.Test public void kNumericDivide42() { final XQuery query = new XQuery( "empty(xs:double(3) div ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Operand(s) which are the empty sequence. . */ @org.junit.Test public void kNumericDivide43() { final XQuery query = new XQuery( "empty(() div xs:decimal(1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * A test whose essence is: `xs:double(5) div xs:double(2) eq 2.5`. . */ @org.junit.Test public void kNumericDivide5() { final XQuery query = new XQuery( "xs:double(5) div xs:double(2) eq 2.5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:double(5) div xs:double(2) ne 2.6`. . */ @org.junit.Test public void kNumericDivide6() { final XQuery query = new XQuery( "xs:double(5) div xs:double(2) ne 2.6", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:float(5) div xs:float(2) eq 2.5`. . */ @org.junit.Test public void kNumericDivide7() { final XQuery query = new XQuery( "xs:float(5) div xs:float(2) eq 2.5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:float(5) div xs:float(2) ne 2.6`. . */ @org.junit.Test public void kNumericDivide8() { final XQuery query = new XQuery( "xs:float(5) div xs:float(2) ne 2.6", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:integer(5) div xs:integer(2) eq 2.5`. . */ @org.junit.Test public void kNumericDivide9() { final XQuery query = new XQuery( "xs:integer(5) div xs:integer(2) eq 2.5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Divide by 0. . */ @org.junit.Test public void k2NumericDivide1() { final XQuery query = new XQuery( "1 div 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * Divide +0e0 with +0e0. . */ @org.junit.Test public void k2NumericDivide10() { final XQuery query = new XQuery( "+0e0 div +0e0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Divide -0e0 with -0e0. . */ @org.junit.Test public void k2NumericDivide11() { final XQuery query = new XQuery( "-0e0 div -0e0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Divide -0e0 with +0e0. . */ @org.junit.Test public void k2NumericDivide12() { final XQuery query = new XQuery( "-0e0 div +0e0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Divide +3 with +0e0. . */ @org.junit.Test public void k2NumericDivide13() { final XQuery query = new XQuery( "+3 div +0e0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** * Divide -3 with +0e0. . */ @org.junit.Test public void k2NumericDivide14() { final XQuery query = new XQuery( "-3 div +0e0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-INF") ); } /** * Divide +3 with -0e0. . */ @org.junit.Test public void k2NumericDivide15() { final XQuery query = new XQuery( "+3 div -0e0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-INF") ); } /** * Divide -3 with -0e0. . */ @org.junit.Test public void k2NumericDivide16() { final XQuery query = new XQuery( "-3 div -0e0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** * Ensure the 'div' keyword is parsed correctly. . */ @org.junit.Test public void k2NumericDivide17() { final XQuery query = new XQuery( "empty(/(div div div))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Divide by 0.0. . */ @org.junit.Test public void k2NumericDivide2() { final XQuery query = new XQuery( "1 div 0.0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * Divide by +0.0. . */ @org.junit.Test public void k2NumericDivide3() { final XQuery query = new XQuery( "1 div +0.0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * Divide by -0.0. . */ @org.junit.Test public void k2NumericDivide4() { final XQuery query = new XQuery( "1 div -0.0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * Divide by 0e0. . */ @org.junit.Test public void k2NumericDivide5() { final XQuery query = new XQuery( "1 div 0e0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** * Divide -1 by 0e0. . */ @org.junit.Test public void k2NumericDivide6() { final XQuery query = new XQuery( "-1 div 0e0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-INF") ); } /** * Divide by xs:float(0). . */ @org.junit.Test public void k2NumericDivide7() { final XQuery query = new XQuery( "1 div xs:float(0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** * Divide -1 by xs:float(0). . */ @org.junit.Test public void k2NumericDivide8() { final XQuery query = new XQuery( "-1 div xs:float(0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-INF") ); } /** * Divide +0e0 with -0e0. . */ @org.junit.Test public void k2NumericDivide9() { final XQuery query = new XQuery( "+0e0 div -0e0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * test division of xs:double NaN . */ @org.junit.Test public void cbclNumericDivide001() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:double) as xs:double { $arg * $arg }; \n" + " \txs:double('NaN') div local:square(7)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * test division by xs:double NaN . */ @org.junit.Test public void cbclNumericDivide002() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:double) as xs:double { $arg * $arg }; \n" + " \tlocal:square(7) div xs:double('NaN')\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * test division by xs:double 1 . */ @org.junit.Test public void cbclNumericDivide003() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:double) as xs:double { $arg * $arg }; \n" + " \tlocal:square(7) div 1e0\n" + " \t", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "49") ); } /** * test division by xs:double -1 . */ @org.junit.Test public void cbclNumericDivide004() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:double) as xs:double { $arg * $arg }; \n" + " \tlocal:square(7) div -1e0\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-49") ); } /** * test division of xs:float NaN . */ @org.junit.Test public void cbclNumericDivide005() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:float) as xs:float { $arg * $arg }; \n" + " \txs:float('NaN') div local:square(7)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * test division by xs:float NaN . */ @org.junit.Test public void cbclNumericDivide006() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:float) as xs:float { $arg * $arg }; \n" + " \tlocal:square(7) div xs:float('NaN')\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * test division by xs:float 1 . */ @org.junit.Test public void cbclNumericDivide007() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:float) as xs:float { $arg * $arg }; \n" + " \tlocal:square(7) div xs:float(1)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "49") ); } /** * test division by xs:float -1 . */ @org.junit.Test public void cbclNumericDivide008() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:float) as xs:float { $arg * $arg }; \n" + " \tlocal:square(7) div xs:float(-1)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-49") ); } /** * test division by xs:decimal 0 . */ @org.junit.Test public void cbclNumericDivide009() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:decimal) as xs:decimal { $arg * $arg }; \n" + " \tlocal:square(2.0) div 0.0\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * test division by xs:decimal 1 . */ @org.junit.Test public void cbclNumericDivide010() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:decimal) as xs:decimal { $arg * $arg }; \n" + " \tlocal:square(7.0) div 1.0\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "49") ); } /** * test division by xs:decimal -1 . */ @org.junit.Test public void cbclNumericDivide011() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:decimal) as xs:decimal { $arg * $arg }; \n" + " \tlocal:square(7.0) div -1.0\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-49") ); } /** * test division by xs:integer 0 . */ @org.junit.Test public void cbclNumericDivide012() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:integer) as xs:integer { $arg * $arg }; \n" + " \tlocal:square(2) div 0\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * test division by xs:integer 1 . */ @org.junit.Test public void cbclNumericDivide013() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:integer) as xs:integer { $arg * $arg }; \n" + " \tlocal:square(7) div 1\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "49") ); } /** * test division by xs:integer -1 . */ @org.junit.Test public void cbclNumericDivide014() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:integer) as xs:integer { $arg * $arg }; \n" + " \tlocal:square(7) div -1\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-49") ); } /** * check that overflow occurs correctly when adding values of type xs:decimal . */ @org.junit.Test public void cbclNumericDivide015() { final XQuery query = new XQuery( "10000000000000000000000000000.0 div 0.1 gt 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FOAR0002") || assertBoolean(true) ) ); } /** * Check dynamic type of numeric divide on arguments of union of numeric types and untypedAtomic. . */ @org.junit.Test public void opNumericDivide1() { final XQuery query = new XQuery( "for $x in (1, xs:decimal(2), xs:float(3), xs:double(4), xs:untypedAtomic(5)), \n" + " $y in (6, xs:decimal(6), xs:float(6), xs:double(6), xs:untypedAtomic(6)),\n" + " $result in ($x div $y)\n" + " return \n" + " if ($result instance of xs:integer) then \"integer\"\n" + " else if ($result instance of xs:decimal) then \"decimal\" \n" + " else if ($result instance of xs:double) then \"double\"\n" + " else if ($result instance of xs:float) then \"float\"\n" + " else error() \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "decimal decimal float double double decimal decimal float double double float float float double double double double double double double double double double double double") ); } /** * check that overflow occurs correctly when dividing values of type xs:decimal . */ @org.junit.Test public void opNumericDivideBig01() { final XQuery query = new XQuery( "(10000000000000000000000000000.0 div 0.1) cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FOAR0002") || assertStringValue(false, "100000000000000000000000000000") ) ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void opNumericDividedbl2args1() { final XQuery query = new XQuery( "xs:double(\"-1.7976931348623157E308\") div xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:double(mid range) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void opNumericDividedbl2args2() { final XQuery query = new XQuery( "xs:double(\"0\") div xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:double(upper bound) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void opNumericDividedbl2args3() { final XQuery query = new XQuery( "xs:double(\"1.7976931348623157E308\") div xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(upper bound) . */ @org.junit.Test public void opNumericDividedbl2args4() { final XQuery query = new XQuery( "xs:double(\"-1.7976931348623157E308\") div xs:double(\"1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void opNumericDividedec2args1() { final XQuery query = new XQuery( "xs:decimal(\"-999999999999999999\") div xs:decimal(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:decimal(mid range) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void opNumericDividedec2args2() { final XQuery query = new XQuery( "fn:round-half-to-even((xs:decimal(\"617375191608514839\") div xs:decimal(\"-999999999999999999\")),18)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-0.61737519160851484") || assertEq("-0.6173751916085") ) ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:decimal(upper bound) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void opNumericDividedec2args3() { final XQuery query = new XQuery( "xs:decimal(\"999999999999999999\") div xs:decimal(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(mid range) . */ @org.junit.Test public void opNumericDividedec2args4() { final XQuery query = new XQuery( "fn:round-half-to-even((xs:decimal(\"-999999999999999999\") div xs:decimal(\"617375191608514839\")),18)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-1.619760582531006901") || assertEq("-1.619760582531") ) ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(upper bound) . */ @org.junit.Test public void opNumericDividedec2args5() { final XQuery query = new XQuery( "xs:decimal(\"-999999999999999999\") div xs:decimal(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void opNumericDivideflt2args1() { final XQuery query = new XQuery( "xs:float(\"-3.4028235E38\") div xs:float(\"-3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:float(mid range) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void opNumericDivideflt2args2() { final XQuery query = new XQuery( "xs:float(\"0\") div xs:float(\"-3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:float(upper bound) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void opNumericDivideflt2args3() { final XQuery query = new XQuery( "xs:float(\"3.4028235E38\") div xs:float(\"-3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(upper bound) . */ @org.junit.Test public void opNumericDivideflt2args4() { final XQuery query = new XQuery( "xs:float(\"-3.4028235E38\") div xs:float(\"3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void opNumericDivideint2args1() { final XQuery query = new XQuery( "xs:int(\"-2147483648\") div xs:int(\"-2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:int(mid range) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void opNumericDivideint2args2() { final XQuery query = new XQuery( "fn:round-half-to-even((xs:int(\"-1873914410\") div xs:int(\"-2147483648\")),10)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0.8726093965") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:int(upper bound) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void opNumericDivideint2args3() { final XQuery query = new XQuery( "fn:round-half-to-even((xs:int(\"2147483647\") div xs:int(\"-2147483648\")),10)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0.9999999995") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(mid range) . */ @org.junit.Test public void opNumericDivideint2args4() { final XQuery query = new XQuery( "fn:round-half-to-even((xs:int(\"-2147483648\") div xs:int(\"-1873914410\")),10)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.145988118") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(upper bound) . */ @org.junit.Test public void opNumericDivideint2args5() { final XQuery query = new XQuery( "fn:round-half-to-even((xs:int(\"-2147483648\") div xs:int(\"2147483647\")),10)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.0000000005") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void opNumericDivideintg2args1() { final XQuery query = new XQuery( "xs:integer(\"-999999999999999999\") div xs:integer(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:integer(mid range) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void opNumericDivideintg2args2() { final XQuery query = new XQuery( "fn:round-half-to-even((xs:integer(\"830993497117024304\") div xs:integer(\"-999999999999999999\")),18)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-0.830993497117024305") || assertEq("-0.830993497117") ) ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:integer(upper bound) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void opNumericDivideintg2args3() { final XQuery query = new XQuery( "xs:integer(\"999999999999999999\") div xs:integer(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(mid range) . */ @org.junit.Test public void opNumericDivideintg2args4() { final XQuery query = new XQuery( "fn:round-half-to-even((xs:integer(\"-999999999999999999\") div xs:integer(\"830993497117024304\")),18)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-1.203378851301859738") || assertEq("-1.203378851301") ) ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(upper bound) . */ @org.junit.Test public void opNumericDivideintg2args5() { final XQuery query = new XQuery( "xs:integer(\"-999999999999999999\") div xs:integer(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates the type of the result of "op:numeric-integer-divide" operator with both arguments of type xs:integer . */ @org.junit.Test public void opNumericDivideintg2args6() { final XQuery query = new XQuery( "(xs:integer(\"-999999999999999999\") div xs:integer(\"999999999999999999\")) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void opNumericDividelng2args1() { final XQuery query = new XQuery( "xs:long(\"-92233720368547758\") div xs:long(\"-92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:long(mid range) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void opNumericDividelng2args2() { final XQuery query = new XQuery( "fn:round-half-to-even((xs:long(\"-47175562203048468\") div xs:long(\"-92233720368547758\")),17)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0.51147847028770199") || assertEq("0.511478470287") ) ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:long(upper bound) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void opNumericDividelng2args3() { final XQuery query = new XQuery( "xs:long(\"92233720368547758\") div xs:long(\"-92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(mid range) . */ @org.junit.Test public void opNumericDividelng2args4() { final XQuery query = new XQuery( "fn:round-half-to-even((xs:long(\"-92233720368547758\") div xs:long(\"-47175562203048468\")),17)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1.95511650654133906") || assertEq("1.955116506541") ) ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(upper bound) . */ @org.junit.Test public void opNumericDividelng2args5() { final XQuery query = new XQuery( "xs:long(\"-92233720368547758\") div xs:long(\"92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Simple division test with () as one operand should return null . */ @org.junit.Test public void opNumericDividemix2args1() { final XQuery query = new XQuery( "() div 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEmpty() || error("XPST0005") ) ); } /** * Simple division test pass string for second operator . */ @org.junit.Test public void opNumericDividemix2args2() { final XQuery query = new XQuery( "1 div '1'", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Simple division test, second operator cast string to integer . */ @org.junit.Test public void opNumericDividemix2args3() { final XQuery query = new XQuery( "1 div xs:integer('1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Simple division test, second operator is a node, atomization applied . */ @org.junit.Test public void opNumericDividemix2args4() { final XQuery query = new XQuery( "1 div 2 ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0.5") ); } /** * Simple division test, second operator is a node, atomization applied . */ @org.junit.Test public void opNumericDividemix2args5() { final XQuery query = new XQuery( "1 div 2 ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0.5") ); } /** * Simple division test, second operator node which is not atomizable . */ @org.junit.Test public void opNumericDividemix2args6() { final XQuery query = new XQuery( "1 div 2 2 ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Simple division test, two operands are nodes . */ @org.junit.Test public void opNumericDividemix2args7() { final XQuery query = new XQuery( " 1 div 2 ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0.5") ); } /** * Simple division test, second operator is a node, atomizable but not castable to integer . */ @org.junit.Test public void opNumericDividemix2args8() { final XQuery query = new XQuery( "1 div x ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Simple division test pass an empty node for second operator . */ @org.junit.Test public void opNumericDividemix2args9() { final XQuery query = new XQuery( "1 div ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void opNumericDividenint2args1() { final XQuery query = new XQuery( "xs:negativeInteger(\"-999999999999999999\") div xs:negativeInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:negativeInteger(mid range) $arg2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void opNumericDividenint2args2() { final XQuery query = new XQuery( "fn:round-half-to-even((xs:negativeInteger(\"-297014075999096793\") div xs:negativeInteger(\"-999999999999999999\")),18)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0.297014075999096793") || assertEq("0.297014075999") ) ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:negativeInteger(upper bound) $arg2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void opNumericDividenint2args3() { final XQuery query = new XQuery( "xs:negativeInteger(\"-1\") div xs:negativeInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0.000000000000000001") || assertEq("0.000000000000000001000000000000000001") || assertEq("0") ) ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(mid range) . */ @org.junit.Test public void opNumericDividenint2args4() { final XQuery query = new XQuery( "fn:round-half-to-even((xs:negativeInteger(\"-999999999999999999\") div xs:negativeInteger(\"-297014075999096793\")),18)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("3.366843799022646172") || assertEq("3.366843799022") ) ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(upper bound) . */ @org.junit.Test public void opNumericDividenint2args5() { final XQuery query = new XQuery( "xs:negativeInteger(\"-999999999999999999\") div xs:negativeInteger(\"-1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void opNumericDividenni2args1() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") div xs:nonNegativeInteger(\"303884545991464527\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void opNumericDividenni2args2() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") div xs:nonNegativeInteger(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void opNumericDividenpi2args1() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-999999999999999999\") div xs:nonPositiveInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(mid range) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void opNumericDividenpi2args2() { final XQuery query = new XQuery( "fn:round-half-to-even((xs:nonPositiveInteger(\"-475688437271870490\") div xs:nonPositiveInteger(\"-999999999999999999\")),18)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0.47568843727187049") || assertEq("0.475688437271") ) ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(upper bound) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void opNumericDividenpi2args3() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"0\") div xs:nonPositiveInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void opNumericDividenpi2args4() { final XQuery query = new XQuery( "fn:round-half-to-even((xs:nonPositiveInteger(\"-999999999999999999\") div xs:nonPositiveInteger(\"-475688437271870490\")),18)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("2.102216328265447024") || assertEq("2.102216328265") ) ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void opNumericDividepint2args1() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") div xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:positiveInteger(mid range) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void opNumericDividepint2args2() { final XQuery query = new XQuery( "xs:positiveInteger(\"52704602390610033\") div xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("52704602390610033") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:positiveInteger(upper bound) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void opNumericDividepint2args3() { final XQuery query = new XQuery( "xs:positiveInteger(\"999999999999999999\") div xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(mid range) . */ @org.junit.Test public void opNumericDividepint2args4() { final XQuery query = new XQuery( "fn:round-half-to-even((xs:positiveInteger(\"1\") div xs:positiveInteger(\"52704602390610033\")),17)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0.00000000000000002") || assertEq("0") ) ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(upper bound) . */ @org.junit.Test public void opNumericDividepint2args5() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") div xs:positiveInteger(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0.000000000000000001") || assertEq("0.000000000000000001000000000000000001") || assertEq("0") ) ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void opNumericDividesht2args1() { final XQuery query = new XQuery( "xs:short(\"-32768\") div xs:short(\"-32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:short(mid range) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void opNumericDividesht2args2() { final XQuery query = new XQuery( "fn:round-half-to-even((xs:short(\"-5324\") div xs:short(\"-32768\")),5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0.16248") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:short(upper bound) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void opNumericDividesht2args3() { final XQuery query = new XQuery( "xs:short(\"32767\") div xs:short(\"-32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-0.999969482421875") || assertEq("-0.999969482421") ) ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(mid range) . */ @org.junit.Test public void opNumericDividesht2args4() { final XQuery query = new XQuery( "fn:round-half-to-even((xs:short(\"-32768\") div xs:short(\"-5324\")),5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("6.15477") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(upper bound) . */ @org.junit.Test public void opNumericDividesht2args5() { final XQuery query = new XQuery( "xs:short(\"-32768\") div xs:short(\"32767\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("abs($result + 1.000030518509475997) lt 1e-12") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(mid range) . */ @org.junit.Test public void opNumericDivideulng2args1() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") div xs:unsignedLong(\"130747108607674654\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(upper bound) . */ @org.junit.Test public void opNumericDivideulng2args2() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") div xs:unsignedLong(\"184467440737095516\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(mid range) . */ @org.junit.Test public void opNumericDivideusht2args1() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") div xs:unsignedShort(\"44633\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-divide" operator with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(upper bound) . */ @org.junit.Test public void opNumericDivideusht2args2() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") div xs:unsignedShort(\"65535\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpNumericEqual.java000066400000000000000000003234541222453003200276660ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the numeric-equal() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpNumericEqual extends QT3TestSet { /** * A test whose essence is: `xs:integer(1) eq xs:integer(1)`. . */ @org.junit.Test public void kNumericEqual1() { final XQuery query = new XQuery( "xs:integer(1) eq xs:integer(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:decimal(1.1) ne xs:decimal(2.1)`. . */ @org.junit.Test public void kNumericEqual10() { final XQuery query = new XQuery( "xs:decimal(1.1) ne xs:decimal(2.1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:integer(2) ne xs:decimal(2.6)`. . */ @org.junit.Test public void kNumericEqual11() { final XQuery query = new XQuery( "xs:integer(2) ne xs:decimal(2.6)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:double(1.1) eq xs:double(1.1)`. . */ @org.junit.Test public void kNumericEqual12() { final XQuery query = new XQuery( "xs:double(1.1) eq xs:double(1.1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:double(-1.1) eq xs:double(-1.1)`. . */ @org.junit.Test public void kNumericEqual13() { final XQuery query = new XQuery( "xs:double(-1.1) eq xs:double(-1.1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:double(1.1) ne xs:double(2.1)`. . */ @org.junit.Test public void kNumericEqual14() { final XQuery query = new XQuery( "xs:double(1.1) ne xs:double(2.1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:double(-1) ne xs:double(1)`. . */ @org.junit.Test public void kNumericEqual15() { final XQuery query = new XQuery( "xs:double(-1) ne xs:double(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:double("NaN") ne xs:double("NaN")`. . */ @org.junit.Test public void kNumericEqual16() { final XQuery query = new XQuery( "xs:double(\"NaN\") ne xs:double(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:double("NaN") ne xs:double(0)`. . */ @org.junit.Test public void kNumericEqual17() { final XQuery query = new XQuery( "xs:double(\"NaN\") ne xs:double(0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:double(0) ne xs:double("NaN")`. . */ @org.junit.Test public void kNumericEqual18() { final XQuery query = new XQuery( "xs:double(0) ne xs:double(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:double("-INF") eq xs:double("-INF")`. . */ @org.junit.Test public void kNumericEqual19() { final XQuery query = new XQuery( "xs:double(\"-INF\") eq xs:double(\"-INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:integer(1) ne xs:integer(2)`. . */ @org.junit.Test public void kNumericEqual2() { final XQuery query = new XQuery( "xs:integer(1) ne xs:integer(2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:double("INF") eq xs:double("INF")`. . */ @org.junit.Test public void kNumericEqual20() { final XQuery query = new XQuery( "xs:double(\"INF\") eq xs:double(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:double("-INF") ne xs:double("INF")`. . */ @org.junit.Test public void kNumericEqual21() { final XQuery query = new XQuery( "xs:double(\"-INF\") ne xs:double(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:double("INF") ne xs:double("-INF")`. . */ @org.junit.Test public void kNumericEqual22() { final XQuery query = new XQuery( "xs:double(\"INF\") ne xs:double(\"-INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:double("INF") ne xs:double("0")`. . */ @org.junit.Test public void kNumericEqual23() { final XQuery query = new XQuery( "xs:double(\"INF\") ne xs:double(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:double("-INF") ne xs:double("0")`. . */ @org.junit.Test public void kNumericEqual24() { final XQuery query = new XQuery( "xs:double(\"-INF\") ne xs:double(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:double("0") ne xs:double("INF")`. . */ @org.junit.Test public void kNumericEqual25() { final XQuery query = new XQuery( "xs:double(\"0\") ne xs:double(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:double("0") ne xs:double("-INF")`. . */ @org.junit.Test public void kNumericEqual26() { final XQuery query = new XQuery( "xs:double(\"0\") ne xs:double(\"-INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:float(1.1) eq xs:float(1.1)`. . */ @org.junit.Test public void kNumericEqual27() { final XQuery query = new XQuery( "xs:float(1.1) eq xs:float(1.1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:float(-1.1) eq xs:float(-1.1)`. . */ @org.junit.Test public void kNumericEqual28() { final XQuery query = new XQuery( "xs:float(-1.1) eq xs:float(-1.1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:float(1.1) ne xs:float(2.1)`. . */ @org.junit.Test public void kNumericEqual29() { final XQuery query = new XQuery( "xs:float(1.1) ne xs:float(2.1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:integer(1) eq xs:integer(1)`. . */ @org.junit.Test public void kNumericEqual3() { final XQuery query = new XQuery( "xs:integer(1) eq xs:integer(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:float("NaN") ne xs:float("NaN")`. . */ @org.junit.Test public void kNumericEqual30() { final XQuery query = new XQuery( "xs:float(\"NaN\") ne xs:float(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:float("NaN") ne xs:float(0)`. . */ @org.junit.Test public void kNumericEqual31() { final XQuery query = new XQuery( "xs:float(\"NaN\") ne xs:float(0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:float(0) ne xs:float("NaN")`. . */ @org.junit.Test public void kNumericEqual32() { final XQuery query = new XQuery( "xs:float(0) ne xs:float(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:float("-INF") eq xs:float("-INF")`. . */ @org.junit.Test public void kNumericEqual33() { final XQuery query = new XQuery( "xs:float(\"-INF\") eq xs:float(\"-INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:float("INF") eq xs:float("INF")`. . */ @org.junit.Test public void kNumericEqual34() { final XQuery query = new XQuery( "xs:float(\"INF\") eq xs:float(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:float("-INF") ne xs:float("INF")`. . */ @org.junit.Test public void kNumericEqual35() { final XQuery query = new XQuery( "xs:float(\"-INF\") ne xs:float(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:float("INF") ne xs:float("-INF")`. . */ @org.junit.Test public void kNumericEqual36() { final XQuery query = new XQuery( "xs:float(\"INF\") ne xs:float(\"-INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:float("INF") ne xs:float("0")`. . */ @org.junit.Test public void kNumericEqual37() { final XQuery query = new XQuery( "xs:float(\"INF\") ne xs:float(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:float("-INF") ne xs:float("0")`. . */ @org.junit.Test public void kNumericEqual38() { final XQuery query = new XQuery( "xs:float(\"-INF\") ne xs:float(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:float("0") ne xs:float("INF")`. . */ @org.junit.Test public void kNumericEqual39() { final XQuery query = new XQuery( "xs:float(\"0\") ne xs:float(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:integer(-1) eq xs:integer(-1)`. . */ @org.junit.Test public void kNumericEqual4() { final XQuery query = new XQuery( "xs:integer(-1) eq xs:integer(-1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:float("0") ne xs:float("-INF")`. . */ @org.junit.Test public void kNumericEqual40() { final XQuery query = new XQuery( "xs:float(\"0\") ne xs:float(\"-INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An expression involving the 'eq' operator that trigger certain optimization paths in some implementations. . */ @org.junit.Test public void kNumericEqual41() { final XQuery query = new XQuery( "count(remove(remove((current-time(), 1), 1), 1)) eq 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that fn:count combined with expressions that might disable compile time evaluations(optimization) as well as the 'eq' operator, is conformant. . */ @org.junit.Test public void kNumericEqual42() { final XQuery query = new XQuery( "not(0 eq count((1, 2, timezone-from-time(current-time()))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that fn:count combined with expressions that might disable compile time evaluations(optimization) as well as the '=' operator, is conformant. . */ @org.junit.Test public void kNumericEqual43() { final XQuery query = new XQuery( "0 ne count((1, 2, timezone-from-time(current-time())))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test automatic xs:untypedAtomic conversion. . */ @org.junit.Test public void kNumericEqual44() { final XQuery query = new XQuery( "(xs:untypedAtomic(\"3\"), 3) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test automatic xs:untypedAtomic conversion. . */ @org.junit.Test public void kNumericEqual45() { final XQuery query = new XQuery( "count(xs:untypedAtomic(\"1\") to 3) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test automatic xs:untypedAtomic conversion. . */ @org.junit.Test public void kNumericEqual46() { final XQuery query = new XQuery( "xs:untypedAtomic(\"three\") + 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A syntactically invalid test. . */ @org.junit.Test public void kNumericEqual47() { final XQuery query = new XQuery( "1 := 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A test whose essence is: `xs:integer(1) ne xs:integer(2)`. . */ @org.junit.Test public void kNumericEqual5() { final XQuery query = new XQuery( "xs:integer(1) ne xs:integer(2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:decimal(1.1) eq xs:decimal(1.1)`. . */ @org.junit.Test public void kNumericEqual6() { final XQuery query = new XQuery( "xs:decimal(1.1) eq xs:decimal(1.1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:decimal(1.1) ne xs:decimal(2.1)`. . */ @org.junit.Test public void kNumericEqual7() { final XQuery query = new XQuery( "xs:decimal(1.1) ne xs:decimal(2.1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:decimal(1.1) eq xs:decimal(1.1)`. . */ @org.junit.Test public void kNumericEqual8() { final XQuery query = new XQuery( "xs:decimal(1.1) eq xs:decimal(1.1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:decimal(-1.1) eq xs:decimal(-1.1)`. . */ @org.junit.Test public void kNumericEqual9() { final XQuery query = new XQuery( "xs:decimal(-1.1) eq xs:decimal(-1.1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Compare an xs:integer to a processing instuction node. . */ @org.junit.Test public void k2NumericEqual1() { final XQuery query = new XQuery( "1 eq ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Compare an xs:integer to a processing instuction node(#2). . */ @org.junit.Test public void k2NumericEqual2() { final XQuery query = new XQuery( " eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Compare an xs:integer to a comment. . */ @org.junit.Test public void k2NumericEqual3() { final XQuery query = new XQuery( "1 eq ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Compare an xs:integer to a comment(#2). . */ @org.junit.Test public void k2NumericEqual4() { final XQuery query = new XQuery( " eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Compare an xs:integer to a text node. . */ @org.junit.Test public void k2NumericEqual5() { final XQuery query = new XQuery( "1 eq text {\"1\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Compare an xs:integer to a text node(#2). . */ @org.junit.Test public void k2NumericEqual6() { final XQuery query = new XQuery( "text {\"1\"} eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test comparison of xs:double . */ @org.junit.Test public void cbclNumericEqual001() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:double) as xs:double { $arg * $arg }; \n" + " \tnot( local:square(1e0) eq local:square(2e0) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of xs:float . */ @org.junit.Test public void cbclNumericEqual002() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:float) as xs:float { $arg * $arg }; \n" + " \tnot( local:square(xs:float(1e0)) eq local:square(xs:float(2e0)) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of xs:decimal . */ @org.junit.Test public void cbclNumericEqual003() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:decimal) as xs:decimal { $arg * $arg }; \n" + " \tnot( local:square(1.0) eq local:square(2.0) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of xs:integer . */ @org.junit.Test public void cbclNumericEqual004() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:integer) as xs:integer { $arg * $arg }; \n" + " \tnot( local:square(1) eq local:square(2) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of xs:double . */ @org.junit.Test public void cbclNumericEqual005() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:double) as xs:double { $arg * $arg }; \n" + " \tnot( local:square(1e0) ne local:square(2e0) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:float . */ @org.junit.Test public void cbclNumericEqual006() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:float) as xs:float { $arg * $arg }; \n" + " \tnot( local:square(xs:float(1e0)) ne local:square(xs:float(2e0)) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:decimal . */ @org.junit.Test public void cbclNumericEqual007() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:decimal) as xs:decimal { $arg * $arg }; \n" + " \tnot( local:square(1.0) ne local:square(2.0) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:integer . */ @org.junit.Test public void cbclNumericEqual008() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:integer) as xs:integer { $arg * $arg }; \n" + " \tnot( local:square(1) ne local:square(2) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison . */ @org.junit.Test public void cbclNumericEqual009() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:integer) as xs:integer { $arg * $arg }; \n" + " \tlet $x := local:square(4) return 0 eq $x - 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison . */ @org.junit.Test public void cbclNumericEqual010() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:integer) as xs:integer { $arg * $arg }; \n" + " \tlet $x := local:square(4) return 0 eq $x + 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison . */ @org.junit.Test public void cbclNumericEqual011() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:integer) as xs:integer { $arg * $arg }; \n" + " \tlet $x := local:square(4) return 4 eq $x + 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison . */ @org.junit.Test public void cbclNumericEqual012() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:integer) as xs:integer { $arg * $arg }; \n" + " \tlet $x := local:square(4) return 4 eq 1 + $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison . */ @org.junit.Test public void cbclNumericEqual013() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:integer) as xs:integer { $arg * $arg }; \n" + " \tlet $x := local:square(4) return -52676506002282294014967032012 eq $x + 52676506002282294014967032012", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || error("FOAR0002") ) ); } /** * test comparison . */ @org.junit.Test public void cbclNumericEqual014() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:integer) as xs:integer { $arg * $arg }; \n" + " \tlet $x := local:square(4) return -52676506002282294014967032012 eq 52676506002282294014967032012 + $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || error("FOAR0002") ) ); } /** * test comparison . */ @org.junit.Test public void cbclNumericEqual015() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:integer) as xs:integer { $arg * $arg }; \n" + " \tlet $x := local:square(4) return 4 eq 1 - $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || error("FOAR0002") ) ); } /** * test comparison . */ @org.junit.Test public void cbclNumericEqual016() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:integer) as xs:integer { $arg * $arg }; \n" + " \tlet $x := local:square(4) return 4 eq $x - 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison . */ @org.junit.Test public void cbclNumericEqual017() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:integer) as xs:integer { $arg * $arg }; \n" + " \tlet $x := local:square(4) return -52676506002282294014967032012 eq 52676506002282294014967032012 - $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || error("FOAR0002") ) ); } /** * test comparison . */ @org.junit.Test public void cbclNumericEqual018() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:integer) as xs:integer { $arg * $arg }; \n" + " \tlet $x := local:square(4) return 52676506002282294014967032012 eq $x - 52676506002282294014967032012", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || error("FOAR0002") ) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = () $arg2 = () . */ @org.junit.Test public void opNumericEqualEmptyseq() { final XQuery query = new XQuery( "() eq ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEmpty() || error("XPST0005") ) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void opNumericEqualdbl2args1() { final XQuery query = new XQuery( "xs:double(\"-1.7976931348623157E308\") eq xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(upper bound) . */ @org.junit.Test public void opNumericEqualdbl2args10() { final XQuery query = new XQuery( "xs:double(\"-1.7976931348623157E308\") ne xs:double(\"1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:double(mid range) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void opNumericEqualdbl2args2() { final XQuery query = new XQuery( "xs:double(\"0\") eq xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:double(upper bound) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void opNumericEqualdbl2args3() { final XQuery query = new XQuery( "xs:double(\"1.7976931348623157E308\") eq xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(mid range) . */ @org.junit.Test public void opNumericEqualdbl2args4() { final XQuery query = new XQuery( "xs:double(\"-1.7976931348623157E308\") eq xs:double(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(upper bound) . */ @org.junit.Test public void opNumericEqualdbl2args5() { final XQuery query = new XQuery( "xs:double(\"-1.7976931348623157E308\") eq xs:double(\"1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void opNumericEqualdbl2args6() { final XQuery query = new XQuery( "xs:double(\"-1.7976931348623157E308\") ne xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:double(mid range) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void opNumericEqualdbl2args7() { final XQuery query = new XQuery( "xs:double(\"0\") ne xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:double(upper bound) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void opNumericEqualdbl2args8() { final XQuery query = new XQuery( "xs:double(\"1.7976931348623157E308\") ne xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(mid range) . */ @org.junit.Test public void opNumericEqualdbl2args9() { final XQuery query = new XQuery( "xs:double(\"-1.7976931348623157E308\") ne xs:double(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void opNumericEqualdec2args1() { final XQuery query = new XQuery( "xs:decimal(\"-999999999999999999\") eq xs:decimal(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(upper bound) . */ @org.junit.Test public void opNumericEqualdec2args10() { final XQuery query = new XQuery( "xs:decimal(\"-999999999999999999\") ne xs:decimal(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:decimal(mid range) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void opNumericEqualdec2args2() { final XQuery query = new XQuery( "xs:decimal(\"617375191608514839\") eq xs:decimal(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:decimal(upper bound) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void opNumericEqualdec2args3() { final XQuery query = new XQuery( "xs:decimal(\"999999999999999999\") eq xs:decimal(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(mid range) . */ @org.junit.Test public void opNumericEqualdec2args4() { final XQuery query = new XQuery( "xs:decimal(\"-999999999999999999\") eq xs:decimal(\"617375191608514839\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(upper bound) . */ @org.junit.Test public void opNumericEqualdec2args5() { final XQuery query = new XQuery( "xs:decimal(\"-999999999999999999\") eq xs:decimal(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void opNumericEqualdec2args6() { final XQuery query = new XQuery( "xs:decimal(\"-999999999999999999\") ne xs:decimal(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:decimal(mid range) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void opNumericEqualdec2args7() { final XQuery query = new XQuery( "xs:decimal(\"617375191608514839\") ne xs:decimal(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:decimal(upper bound) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void opNumericEqualdec2args8() { final XQuery query = new XQuery( "xs:decimal(\"999999999999999999\") ne xs:decimal(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(mid range) . */ @org.junit.Test public void opNumericEqualdec2args9() { final XQuery query = new XQuery( "xs:decimal(\"-999999999999999999\") ne xs:decimal(\"617375191608514839\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void opNumericEqualflt2args1() { final XQuery query = new XQuery( "xs:float(\"-3.4028235E38\") eq xs:float(\"-3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(upper bound) . */ @org.junit.Test public void opNumericEqualflt2args10() { final XQuery query = new XQuery( "xs:float(\"-3.4028235E38\") ne xs:float(\"3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:float(mid range) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void opNumericEqualflt2args2() { final XQuery query = new XQuery( "xs:float(\"0\") eq xs:float(\"-3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:float(upper bound) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void opNumericEqualflt2args3() { final XQuery query = new XQuery( "xs:float(\"3.4028235E38\") eq xs:float(\"-3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(mid range) . */ @org.junit.Test public void opNumericEqualflt2args4() { final XQuery query = new XQuery( "xs:float(\"-3.4028235E38\") eq xs:float(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(upper bound) . */ @org.junit.Test public void opNumericEqualflt2args5() { final XQuery query = new XQuery( "xs:float(\"-3.4028235E38\") eq xs:float(\"3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void opNumericEqualflt2args6() { final XQuery query = new XQuery( "xs:float(\"-3.4028235E38\") ne xs:float(\"-3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:float(mid range) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void opNumericEqualflt2args7() { final XQuery query = new XQuery( "xs:float(\"0\") ne xs:float(\"-3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:float(upper bound) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void opNumericEqualflt2args8() { final XQuery query = new XQuery( "xs:float(\"3.4028235E38\") ne xs:float(\"-3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(mid range) . */ @org.junit.Test public void opNumericEqualflt2args9() { final XQuery query = new XQuery( "xs:float(\"-3.4028235E38\") ne xs:float(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void opNumericEqualint2args1() { final XQuery query = new XQuery( "xs:int(\"-2147483648\") eq xs:int(\"-2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(upper bound) . */ @org.junit.Test public void opNumericEqualint2args10() { final XQuery query = new XQuery( "xs:int(\"-2147483648\") ne xs:int(\"2147483647\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:int(mid range) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void opNumericEqualint2args2() { final XQuery query = new XQuery( "xs:int(\"-1873914410\") eq xs:int(\"-2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:int(upper bound) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void opNumericEqualint2args3() { final XQuery query = new XQuery( "xs:int(\"2147483647\") eq xs:int(\"-2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(mid range) . */ @org.junit.Test public void opNumericEqualint2args4() { final XQuery query = new XQuery( "xs:int(\"-2147483648\") eq xs:int(\"-1873914410\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(upper bound) . */ @org.junit.Test public void opNumericEqualint2args5() { final XQuery query = new XQuery( "xs:int(\"-2147483648\") eq xs:int(\"2147483647\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void opNumericEqualint2args6() { final XQuery query = new XQuery( "xs:int(\"-2147483648\") ne xs:int(\"-2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:int(mid range) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void opNumericEqualint2args7() { final XQuery query = new XQuery( "xs:int(\"-1873914410\") ne xs:int(\"-2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:int(upper bound) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void opNumericEqualint2args8() { final XQuery query = new XQuery( "xs:int(\"2147483647\") ne xs:int(\"-2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(mid range) . */ @org.junit.Test public void opNumericEqualint2args9() { final XQuery query = new XQuery( "xs:int(\"-2147483648\") ne xs:int(\"-1873914410\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void opNumericEqualintg2args1() { final XQuery query = new XQuery( "xs:integer(\"-999999999999999999\") eq xs:integer(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(upper bound) . */ @org.junit.Test public void opNumericEqualintg2args10() { final XQuery query = new XQuery( "xs:integer(\"-999999999999999999\") ne xs:integer(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:integer(mid range) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void opNumericEqualintg2args2() { final XQuery query = new XQuery( "xs:integer(\"830993497117024304\") eq xs:integer(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:integer(upper bound) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void opNumericEqualintg2args3() { final XQuery query = new XQuery( "xs:integer(\"999999999999999999\") eq xs:integer(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(mid range) . */ @org.junit.Test public void opNumericEqualintg2args4() { final XQuery query = new XQuery( "xs:integer(\"-999999999999999999\") eq xs:integer(\"830993497117024304\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(upper bound) . */ @org.junit.Test public void opNumericEqualintg2args5() { final XQuery query = new XQuery( "xs:integer(\"-999999999999999999\") eq xs:integer(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void opNumericEqualintg2args6() { final XQuery query = new XQuery( "xs:integer(\"-999999999999999999\") ne xs:integer(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:integer(mid range) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void opNumericEqualintg2args7() { final XQuery query = new XQuery( "xs:integer(\"830993497117024304\") ne xs:integer(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:integer(upper bound) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void opNumericEqualintg2args8() { final XQuery query = new XQuery( "xs:integer(\"999999999999999999\") ne xs:integer(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(mid range) . */ @org.junit.Test public void opNumericEqualintg2args9() { final XQuery query = new XQuery( "xs:integer(\"-999999999999999999\") ne xs:integer(\"830993497117024304\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void opNumericEquallng2args1() { final XQuery query = new XQuery( "xs:long(\"-92233720368547758\") eq xs:long(\"-92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(upper bound) . */ @org.junit.Test public void opNumericEquallng2args10() { final XQuery query = new XQuery( "xs:long(\"-92233720368547758\") ne xs:long(\"92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:long(mid range) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void opNumericEquallng2args2() { final XQuery query = new XQuery( "xs:long(\"-47175562203048468\") eq xs:long(\"-92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:long(upper bound) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void opNumericEquallng2args3() { final XQuery query = new XQuery( "xs:long(\"92233720368547758\") eq xs:long(\"-92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(mid range) . */ @org.junit.Test public void opNumericEquallng2args4() { final XQuery query = new XQuery( "xs:long(\"-92233720368547758\") eq xs:long(\"-47175562203048468\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(upper bound) . */ @org.junit.Test public void opNumericEquallng2args5() { final XQuery query = new XQuery( "xs:long(\"-92233720368547758\") eq xs:long(\"92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void opNumericEquallng2args6() { final XQuery query = new XQuery( "xs:long(\"-92233720368547758\") ne xs:long(\"-92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:long(mid range) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void opNumericEquallng2args7() { final XQuery query = new XQuery( "xs:long(\"-47175562203048468\") ne xs:long(\"-92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:long(upper bound) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void opNumericEquallng2args8() { final XQuery query = new XQuery( "xs:long(\"92233720368547758\") ne xs:long(\"-92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(mid range) . */ @org.junit.Test public void opNumericEquallng2args9() { final XQuery query = new XQuery( "xs:long(\"-92233720368547758\") ne xs:long(\"-47175562203048468\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void opNumericEqualnint2args1() { final XQuery query = new XQuery( "xs:negativeInteger(\"-999999999999999999\") eq xs:negativeInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(upper bound) . */ @org.junit.Test public void opNumericEqualnint2args10() { final XQuery query = new XQuery( "xs:negativeInteger(\"-999999999999999999\") ne xs:negativeInteger(\"-1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:negativeInteger(mid range) $arg2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void opNumericEqualnint2args2() { final XQuery query = new XQuery( "xs:negativeInteger(\"-297014075999096793\") eq xs:negativeInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:negativeInteger(upper bound) $arg2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void opNumericEqualnint2args3() { final XQuery query = new XQuery( "xs:negativeInteger(\"-1\") eq xs:negativeInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(mid range) . */ @org.junit.Test public void opNumericEqualnint2args4() { final XQuery query = new XQuery( "xs:negativeInteger(\"-999999999999999999\") eq xs:negativeInteger(\"-297014075999096793\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(upper bound) . */ @org.junit.Test public void opNumericEqualnint2args5() { final XQuery query = new XQuery( "xs:negativeInteger(\"-999999999999999999\") eq xs:negativeInteger(\"-1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void opNumericEqualnint2args6() { final XQuery query = new XQuery( "xs:negativeInteger(\"-999999999999999999\") ne xs:negativeInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:negativeInteger(mid range) $arg2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void opNumericEqualnint2args7() { final XQuery query = new XQuery( "xs:negativeInteger(\"-297014075999096793\") ne xs:negativeInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:negativeInteger(upper bound) $arg2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void opNumericEqualnint2args8() { final XQuery query = new XQuery( "xs:negativeInteger(\"-1\") ne xs:negativeInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(mid range) . */ @org.junit.Test public void opNumericEqualnint2args9() { final XQuery query = new XQuery( "xs:negativeInteger(\"-999999999999999999\") ne xs:negativeInteger(\"-297014075999096793\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void opNumericEqualnni2args1() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") eq xs:nonNegativeInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void opNumericEqualnni2args10() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") ne xs:nonNegativeInteger(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(mid range) $arg2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void opNumericEqualnni2args2() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"303884545991464527\") eq xs:nonNegativeInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(upper bound) $arg2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void opNumericEqualnni2args3() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"999999999999999999\") eq xs:nonNegativeInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void opNumericEqualnni2args4() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") eq xs:nonNegativeInteger(\"303884545991464527\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void opNumericEqualnni2args5() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") eq xs:nonNegativeInteger(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void opNumericEqualnni2args6() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") ne xs:nonNegativeInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(mid range) $arg2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void opNumericEqualnni2args7() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"303884545991464527\") ne xs:nonNegativeInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(upper bound) $arg2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void opNumericEqualnni2args8() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"999999999999999999\") ne xs:nonNegativeInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void opNumericEqualnni2args9() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") ne xs:nonNegativeInteger(\"303884545991464527\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void opNumericEqualnpi2args1() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-999999999999999999\") eq xs:nonPositiveInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void opNumericEqualnpi2args10() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-999999999999999999\") ne xs:nonPositiveInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(mid range) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void opNumericEqualnpi2args2() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-475688437271870490\") eq xs:nonPositiveInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(upper bound) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void opNumericEqualnpi2args3() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"0\") eq xs:nonPositiveInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void opNumericEqualnpi2args4() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-999999999999999999\") eq xs:nonPositiveInteger(\"-475688437271870490\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void opNumericEqualnpi2args5() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-999999999999999999\") eq xs:nonPositiveInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void opNumericEqualnpi2args6() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-999999999999999999\") ne xs:nonPositiveInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(mid range) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void opNumericEqualnpi2args7() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-475688437271870490\") ne xs:nonPositiveInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(upper bound) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void opNumericEqualnpi2args8() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"0\") ne xs:nonPositiveInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void opNumericEqualnpi2args9() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-999999999999999999\") ne xs:nonPositiveInteger(\"-475688437271870490\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void opNumericEqualpint2args1() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") eq xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(upper bound) . */ @org.junit.Test public void opNumericEqualpint2args10() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") ne xs:positiveInteger(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:positiveInteger(mid range) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void opNumericEqualpint2args2() { final XQuery query = new XQuery( "xs:positiveInteger(\"52704602390610033\") eq xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:positiveInteger(upper bound) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void opNumericEqualpint2args3() { final XQuery query = new XQuery( "xs:positiveInteger(\"999999999999999999\") eq xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(mid range) . */ @org.junit.Test public void opNumericEqualpint2args4() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") eq xs:positiveInteger(\"52704602390610033\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(upper bound) . */ @org.junit.Test public void opNumericEqualpint2args5() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") eq xs:positiveInteger(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void opNumericEqualpint2args6() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") ne xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:positiveInteger(mid range) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void opNumericEqualpint2args7() { final XQuery query = new XQuery( "xs:positiveInteger(\"52704602390610033\") ne xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:positiveInteger(upper bound) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void opNumericEqualpint2args8() { final XQuery query = new XQuery( "xs:positiveInteger(\"999999999999999999\") ne xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(mid range) . */ @org.junit.Test public void opNumericEqualpint2args9() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") ne xs:positiveInteger(\"52704602390610033\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void opNumericEqualsht2args1() { final XQuery query = new XQuery( "xs:short(\"-32768\") eq xs:short(\"-32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(upper bound) . */ @org.junit.Test public void opNumericEqualsht2args10() { final XQuery query = new XQuery( "xs:short(\"-32768\") ne xs:short(\"32767\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:short(mid range) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void opNumericEqualsht2args2() { final XQuery query = new XQuery( "xs:short(\"-5324\") eq xs:short(\"-32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:short(upper bound) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void opNumericEqualsht2args3() { final XQuery query = new XQuery( "xs:short(\"32767\") eq xs:short(\"-32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(mid range) . */ @org.junit.Test public void opNumericEqualsht2args4() { final XQuery query = new XQuery( "xs:short(\"-32768\") eq xs:short(\"-5324\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(upper bound) . */ @org.junit.Test public void opNumericEqualsht2args5() { final XQuery query = new XQuery( "xs:short(\"-32768\") eq xs:short(\"32767\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void opNumericEqualsht2args6() { final XQuery query = new XQuery( "xs:short(\"-32768\") ne xs:short(\"-32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:short(mid range) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void opNumericEqualsht2args7() { final XQuery query = new XQuery( "xs:short(\"-5324\") ne xs:short(\"-32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:short(upper bound) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void opNumericEqualsht2args8() { final XQuery query = new XQuery( "xs:short(\"32767\") ne xs:short(\"-32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(mid range) . */ @org.junit.Test public void opNumericEqualsht2args9() { final XQuery query = new XQuery( "xs:short(\"-32768\") ne xs:short(\"-5324\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void opNumericEqualulng2args1() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") eq xs:unsignedLong(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(upper bound) . */ @org.junit.Test public void opNumericEqualulng2args10() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") ne xs:unsignedLong(\"184467440737095516\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:unsignedLong(mid range) $arg2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void opNumericEqualulng2args2() { final XQuery query = new XQuery( "xs:unsignedLong(\"130747108607674654\") eq xs:unsignedLong(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:unsignedLong(upper bound) $arg2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void opNumericEqualulng2args3() { final XQuery query = new XQuery( "xs:unsignedLong(\"184467440737095516\") eq xs:unsignedLong(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(mid range) . */ @org.junit.Test public void opNumericEqualulng2args4() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") eq xs:unsignedLong(\"130747108607674654\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(upper bound) . */ @org.junit.Test public void opNumericEqualulng2args5() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") eq xs:unsignedLong(\"184467440737095516\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void opNumericEqualulng2args6() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") ne xs:unsignedLong(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:unsignedLong(mid range) $arg2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void opNumericEqualulng2args7() { final XQuery query = new XQuery( "xs:unsignedLong(\"130747108607674654\") ne xs:unsignedLong(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:unsignedLong(upper bound) $arg2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void opNumericEqualulng2args8() { final XQuery query = new XQuery( "xs:unsignedLong(\"184467440737095516\") ne xs:unsignedLong(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(mid range) . */ @org.junit.Test public void opNumericEqualulng2args9() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") ne xs:unsignedLong(\"130747108607674654\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void opNumericEqualusht2args1() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") eq xs:unsignedShort(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(upper bound) . */ @org.junit.Test public void opNumericEqualusht2args10() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") ne xs:unsignedShort(\"65535\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:unsignedShort(mid range) $arg2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void opNumericEqualusht2args2() { final XQuery query = new XQuery( "xs:unsignedShort(\"44633\") eq xs:unsignedShort(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:unsignedShort(upper bound) $arg2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void opNumericEqualusht2args3() { final XQuery query = new XQuery( "xs:unsignedShort(\"65535\") eq xs:unsignedShort(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(mid range) . */ @org.junit.Test public void opNumericEqualusht2args4() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") eq xs:unsignedShort(\"44633\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(upper bound) . */ @org.junit.Test public void opNumericEqualusht2args5() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") eq xs:unsignedShort(\"65535\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void opNumericEqualusht2args6() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") ne xs:unsignedShort(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:unsignedShort(mid range) $arg2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void opNumericEqualusht2args7() { final XQuery query = new XQuery( "xs:unsignedShort(\"44633\") ne xs:unsignedShort(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:unsignedShort(upper bound) $arg2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void opNumericEqualusht2args8() { final XQuery query = new XQuery( "xs:unsignedShort(\"65535\") ne xs:unsignedShort(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates The "op:numeric-equal" operator with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(mid range) . */ @org.junit.Test public void opNumericEqualusht2args9() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") ne xs:unsignedShort(\"44633\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpNumericGreaterThan.java000066400000000000000000002757701222453003200310320ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the numeric-greater-than() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpNumericGreaterThan extends QT3TestSet { /** * * ******************************************************* * Test: K-NumericGT-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `xs:integer(1) gt xs:integer(-1)`. * ******************************************************* * . */ @org.junit.Test public void kNumericGT1() { final XQuery query = new XQuery( "xs:integer(1) gt xs:integer(-1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericGT-10 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `xs:float("INF") gt 0`. * ******************************************************* * . */ @org.junit.Test public void kNumericGT10() { final XQuery query = new XQuery( "xs:float(\"INF\") gt 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericGT-11 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `xs:float(1) gt xs:float(-1)`. * ******************************************************* * . */ @org.junit.Test public void kNumericGT11() { final XQuery query = new XQuery( "xs:float(1) gt xs:float(-1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericGT-12 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `xs:float(1) ge xs:float(1)`. * ******************************************************* * . */ @org.junit.Test public void kNumericGT12() { final XQuery query = new XQuery( "xs:float(1) ge xs:float(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericGT-13 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `not(xs:double("NaN") gt 1)`. * ******************************************************* * . */ @org.junit.Test public void kNumericGT13() { final XQuery query = new XQuery( "not(xs:double(\"NaN\") gt 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericGT-14 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `not(xs:float("NaN") gt 1)`. * ******************************************************* * . */ @org.junit.Test public void kNumericGT14() { final XQuery query = new XQuery( "not(xs:float(\"NaN\") gt 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericGT-15 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `not(xs:double("NaN") ge 1)`. * ******************************************************* * . */ @org.junit.Test public void kNumericGT15() { final XQuery query = new XQuery( "not(xs:double(\"NaN\") ge 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericGT-16 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `not(xs:float("NaN") ge 1)`. * ******************************************************* * . */ @org.junit.Test public void kNumericGT16() { final XQuery query = new XQuery( "not(xs:float(\"NaN\") ge 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericGT-17 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `not(1 gt xs:double("NaN"))`. * ******************************************************* * . */ @org.junit.Test public void kNumericGT17() { final XQuery query = new XQuery( "not(1 gt xs:double(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericGT-18 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `not(1 gt xs:float("NaN"))`. * ******************************************************* * . */ @org.junit.Test public void kNumericGT18() { final XQuery query = new XQuery( "not(1 gt xs:float(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericGT-19 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `not(1 ge xs:double("NaN"))`. * ******************************************************* * . */ @org.junit.Test public void kNumericGT19() { final XQuery query = new XQuery( "not(1 ge xs:double(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericGT-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `xs:integer(1) ge xs:integer(1)`. * ******************************************************* * . */ @org.junit.Test public void kNumericGT2() { final XQuery query = new XQuery( "xs:integer(1) ge xs:integer(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericGT-20 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `not(1 ge xs:float("NaN"))`. * ******************************************************* * . */ @org.junit.Test public void kNumericGT20() { final XQuery query = new XQuery( "not(1 ge xs:float(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericGT-21 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: le combined with count(). * ******************************************************* * . */ @org.junit.Test public void kNumericGT21() { final XQuery query = new XQuery( "1 le count((1, 2, 3, timezone-from-time(current-time()), 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericGT-22 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: ge combined with count(). * ******************************************************* * . */ @org.junit.Test public void kNumericGT22() { final XQuery query = new XQuery( "count((1, 2, 3, timezone-from-time(current-time()), 4)) ge 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericGT-23 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: gt combined with count(). * ******************************************************* * . */ @org.junit.Test public void kNumericGT23() { final XQuery query = new XQuery( "count((1, 2, 3, timezone-from-time(current-time()), 4)) gt 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericGT-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `xs:decimal(1) gt xs:decimal(-1)`. * ******************************************************* * . */ @org.junit.Test public void kNumericGT3() { final XQuery query = new XQuery( "xs:decimal(1) gt xs:decimal(-1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericGT-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `xs:decimal(1) ge xs:decimal(1)`. * ******************************************************* * . */ @org.junit.Test public void kNumericGT4() { final XQuery query = new XQuery( "xs:decimal(1) ge xs:decimal(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericGT-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `0 gt xs:double("-INF")`. * ******************************************************* * . */ @org.junit.Test public void kNumericGT5() { final XQuery query = new XQuery( "0 gt xs:double(\"-INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericGT-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `xs:double("INF") gt 0`. * ******************************************************* * . */ @org.junit.Test public void kNumericGT6() { final XQuery query = new XQuery( "xs:double(\"INF\") gt 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericGT-7 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `xs:double(1) gt xs:double(-1)`. * ******************************************************* * . */ @org.junit.Test public void kNumericGT7() { final XQuery query = new XQuery( "xs:double(1) gt xs:double(-1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericGT-8 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `xs:double(1) ge xs:double(1)`. * ******************************************************* * . */ @org.junit.Test public void kNumericGT8() { final XQuery query = new XQuery( "xs:double(1) ge xs:double(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericGT-9 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `0 gt xs:float("-INF")`. * ******************************************************* * . */ @org.junit.Test public void kNumericGT9() { final XQuery query = new XQuery( "0 gt xs:float(\"-INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K2-NumericGT-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Compare two xs:unsignedLong values. * ******************************************************* * . */ @org.junit.Test public void k2NumericGT1() { final XQuery query = new XQuery( "xs:unsignedLong(\"100\") gt xs:unsignedLong(\"18446744073709551615\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: K2-NumericGT-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Compare two xs:unsignedLong values. * ******************************************************* * . */ @org.junit.Test public void k2NumericGT2() { final XQuery query = new XQuery( "xs:unsignedLong(\"18446744073709551615\") gt xs:unsignedLong(\"100\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * compare two doubles, where the second value is NaN. */ @org.junit.Test public void k2NumericGT3() { final XQuery query = new XQuery( "xs:double(\"3\") gt xs:double(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * compare two flots, where the second value is NaN. */ @org.junit.Test public void k2NumericGT4() { final XQuery query = new XQuery( "xs:float(\"3\") lt xs:float(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:double . */ @org.junit.Test public void cbclNumericGreaterThan001() { final XQuery query = new XQuery( "declare function local:square($arg as xs:double) as xs:double { $arg * $arg }; not( local:square(1e0) gt local:square(2e0) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of xs:float . */ @org.junit.Test public void cbclNumericGreaterThan002() { final XQuery query = new XQuery( "declare function local:square($arg as xs:float) as xs:float { $arg * $arg }; not( local:square(xs:float(1e0)) gt local:square(xs:float(2e0)) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of xs:decimal . */ @org.junit.Test public void cbclNumericGreaterThan003() { final XQuery query = new XQuery( "declare function local:square($arg as xs:decimal) as xs:decimal { $arg * $arg }; not( local:square(1.0) gt local:square(2.0) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of xs:integer . */ @org.junit.Test public void cbclNumericGreaterThan004() { final XQuery query = new XQuery( "declare function local:square($arg as xs:integer) as xs:integer { $arg * $arg }; not( local:square(1) gt local:square(2) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of xs:double . */ @org.junit.Test public void cbclNumericGreaterThan005() { final XQuery query = new XQuery( "declare function local:square($arg as xs:double) as xs:double { $arg * $arg }; not( local:square(1e0) le local:square(2e0) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:float . */ @org.junit.Test public void cbclNumericGreaterThan006() { final XQuery query = new XQuery( "declare function local:square($arg as xs:float) as xs:float { $arg * $arg }; not( local:square(xs:float(1e0)) le local:square(xs:float(2e0)) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:decimal . */ @org.junit.Test public void cbclNumericGreaterThan007() { final XQuery query = new XQuery( "declare function local:square($arg as xs:decimal) as xs:decimal { $arg * $arg }; not( local:square(1.0) le local:square(2.0) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:integer . */ @org.junit.Test public void cbclNumericGreaterThan008() { final XQuery query = new XQuery( "declare function local:square($arg as xs:integer) as xs:integer { $arg * $arg }; not( local:square(1) le local:square(2) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:double . */ @org.junit.Test public void cbclNumericGreaterThan009() { final XQuery query = new XQuery( "declare function local:square($arg as xs:double) as xs:double { $arg * $arg }; not(not( local:square(1e0) gt local:square(2e0) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:float . */ @org.junit.Test public void cbclNumericGreaterThan010() { final XQuery query = new XQuery( "declare function local:square($arg as xs:float) as xs:float { $arg * $arg }; not(not( local:square(xs:float(1e0)) gt local:square(xs:float(2e0)) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:double . */ @org.junit.Test public void cbclNumericGreaterThan011() { final XQuery query = new XQuery( "declare function local:square($arg as xs:double) as xs:double { $arg * $arg }; not(not( local:square(1e0) le local:square(2e0) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of xs:float . */ @org.junit.Test public void cbclNumericGreaterThan012() { final XQuery query = new XQuery( "declare function local:square($arg as xs:float) as xs:float { $arg * $arg }; not(not( local:square(xs:float(1e0)) le local:square(xs:float(2e0)) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericGreaterThan013() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return $x + 1 gt 121", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericGreaterThan014() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return $x - 1 gt 121", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericGreaterThan015() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return 121 gt $x + 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericGreaterThan016() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return 121 gt 1 + $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericGreaterThan017() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return $x + 1 le 121", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericGreaterThan018() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return $x - 1 le 121", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericGreaterThan019() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return 121 le $x + 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericGreaterThan020() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return 121 le 1 + $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericGreaterThan021() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return 121 gt $x - 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericGreaterThan022() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return 1 + $x gt 121", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericGreaterThan023() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return 1 + $x le 121", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericGreaterThan024() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return 121 le $x - 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thandbl2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:double(lower bound) * $arg2 = xs:double(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThandbl2args1() { final XQuery query = new XQuery( "xs:double(\"-1.7976931348623157E308\") gt xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thandbl2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:double(mid range) * $arg2 = xs:double(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThandbl2args2() { final XQuery query = new XQuery( "xs:double(\"0\") gt xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-greater-thandbl2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:double(upper bound) * $arg2 = xs:double(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThandbl2args3() { final XQuery query = new XQuery( "xs:double(\"1.7976931348623157E308\") gt xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-greater-thandbl2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:double(lower bound) * $arg2 = xs:double(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThandbl2args4() { final XQuery query = new XQuery( "xs:double(\"-1.7976931348623157E308\") gt xs:double(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thandbl2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:double(lower bound) * $arg2 = xs:double(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThandbl2args5() { final XQuery query = new XQuery( "xs:double(\"-1.7976931348623157E308\") gt xs:double(\"1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thandec2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:decimal(lower bound) * $arg2 = xs:decimal(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThandec2args1() { final XQuery query = new XQuery( "xs:decimal(\"-999999999999999999\") gt xs:decimal(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thandec2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:decimal(mid range) * $arg2 = xs:decimal(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThandec2args2() { final XQuery query = new XQuery( "xs:decimal(\"617375191608514839\") gt xs:decimal(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-greater-thandec2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:decimal(upper bound) * $arg2 = xs:decimal(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThandec2args3() { final XQuery query = new XQuery( "xs:decimal(\"999999999999999999\") gt xs:decimal(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-greater-thandec2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:decimal(lower bound) * $arg2 = xs:decimal(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThandec2args4() { final XQuery query = new XQuery( "xs:decimal(\"-999999999999999999\") gt xs:decimal(\"617375191608514839\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thandec2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:decimal(lower bound) * $arg2 = xs:decimal(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThandec2args5() { final XQuery query = new XQuery( "xs:decimal(\"-999999999999999999\") gt xs:decimal(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanflt2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:float(lower bound) * $arg2 = xs:float(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanflt2args1() { final XQuery query = new XQuery( "xs:float(\"-3.4028235E38\") gt xs:float(\"-3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanflt2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:float(mid range) * $arg2 = xs:float(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanflt2args2() { final XQuery query = new XQuery( "xs:float(\"0\") gt xs:float(\"-3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanflt2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:float(upper bound) * $arg2 = xs:float(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanflt2args3() { final XQuery query = new XQuery( "xs:float(\"3.4028235E38\") gt xs:float(\"-3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanflt2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:float(lower bound) * $arg2 = xs:float(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanflt2args4() { final XQuery query = new XQuery( "xs:float(\"-3.4028235E38\") gt xs:float(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanflt2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:float(lower bound) * $arg2 = xs:float(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanflt2args5() { final XQuery query = new XQuery( "xs:float(\"-3.4028235E38\") gt xs:float(\"3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanint2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:int(lower bound) * $arg2 = xs:int(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanint2args1() { final XQuery query = new XQuery( "xs:int(\"-2147483648\") gt xs:int(\"-2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanint2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:int(mid range) * $arg2 = xs:int(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanint2args2() { final XQuery query = new XQuery( "xs:int(\"-1873914410\") gt xs:int(\"-2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanint2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:int(upper bound) * $arg2 = xs:int(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanint2args3() { final XQuery query = new XQuery( "xs:int(\"2147483647\") gt xs:int(\"-2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanint2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:int(lower bound) * $arg2 = xs:int(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanint2args4() { final XQuery query = new XQuery( "xs:int(\"-2147483648\") gt xs:int(\"-1873914410\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanint2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:int(lower bound) * $arg2 = xs:int(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanint2args5() { final XQuery query = new XQuery( "xs:int(\"-2147483648\") gt xs:int(\"2147483647\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanintg2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:integer(lower bound) * $arg2 = xs:integer(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanintg2args1() { final XQuery query = new XQuery( "xs:integer(\"-999999999999999999\") gt xs:integer(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanintg2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:integer(mid range) * $arg2 = xs:integer(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanintg2args2() { final XQuery query = new XQuery( "xs:integer(\"830993497117024304\") gt xs:integer(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanintg2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:integer(upper bound) * $arg2 = xs:integer(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanintg2args3() { final XQuery query = new XQuery( "xs:integer(\"999999999999999999\") gt xs:integer(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanintg2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:integer(lower bound) * $arg2 = xs:integer(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanintg2args4() { final XQuery query = new XQuery( "xs:integer(\"-999999999999999999\") gt xs:integer(\"830993497117024304\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanintg2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:integer(lower bound) * $arg2 = xs:integer(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanintg2args5() { final XQuery query = new XQuery( "xs:integer(\"-999999999999999999\") gt xs:integer(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanlng2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:long(lower bound) * $arg2 = xs:long(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanlng2args1() { final XQuery query = new XQuery( "xs:long(\"-92233720368547758\") gt xs:long(\"-92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanlng2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:long(mid range) * $arg2 = xs:long(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanlng2args2() { final XQuery query = new XQuery( "xs:long(\"-47175562203048468\") gt xs:long(\"-92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanlng2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:long(upper bound) * $arg2 = xs:long(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanlng2args3() { final XQuery query = new XQuery( "xs:long(\"92233720368547758\") gt xs:long(\"-92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanlng2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:long(lower bound) * $arg2 = xs:long(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanlng2args4() { final XQuery query = new XQuery( "xs:long(\"-92233720368547758\") gt xs:long(\"-47175562203048468\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanlng2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:long(lower bound) * $arg2 = xs:long(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanlng2args5() { final XQuery query = new XQuery( "xs:long(\"-92233720368547758\") gt xs:long(\"92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thannint2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:negativeInteger(lower bound) * $arg2 = xs:negativeInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThannint2args1() { final XQuery query = new XQuery( "xs:negativeInteger(\"-999999999999999999\") gt xs:negativeInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thannint2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:negativeInteger(mid range) * $arg2 = xs:negativeInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThannint2args2() { final XQuery query = new XQuery( "xs:negativeInteger(\"-297014075999096793\") gt xs:negativeInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-greater-thannint2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:negativeInteger(upper bound) * $arg2 = xs:negativeInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThannint2args3() { final XQuery query = new XQuery( "xs:negativeInteger(\"-1\") gt xs:negativeInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-greater-thannint2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:negativeInteger(lower bound) * $arg2 = xs:negativeInteger(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThannint2args4() { final XQuery query = new XQuery( "xs:negativeInteger(\"-999999999999999999\") gt xs:negativeInteger(\"-297014075999096793\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thannint2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:negativeInteger(lower bound) * $arg2 = xs:negativeInteger(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThannint2args5() { final XQuery query = new XQuery( "xs:negativeInteger(\"-999999999999999999\") gt xs:negativeInteger(\"-1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thannni2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:nonNegativeInteger(lower bound) * $arg2 = xs:nonNegativeInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThannni2args1() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") gt xs:nonNegativeInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thannni2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:nonNegativeInteger(mid range) * $arg2 = xs:nonNegativeInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThannni2args2() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"303884545991464527\") gt xs:nonNegativeInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-greater-thannni2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:nonNegativeInteger(upper bound) * $arg2 = xs:nonNegativeInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThannni2args3() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"999999999999999999\") gt xs:nonNegativeInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-greater-thannni2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:nonNegativeInteger(lower bound) * $arg2 = xs:nonNegativeInteger(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThannni2args4() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") gt xs:nonNegativeInteger(\"303884545991464527\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thannni2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:nonNegativeInteger(lower bound) * $arg2 = xs:nonNegativeInteger(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThannni2args5() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") gt xs:nonNegativeInteger(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thannpi2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:nonPositiveInteger(lower bound) * $arg2 = xs:nonPositiveInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThannpi2args1() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-999999999999999999\") gt xs:nonPositiveInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thannpi2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:nonPositiveInteger(mid range) * $arg2 = xs:nonPositiveInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThannpi2args2() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-475688437271870490\") gt xs:nonPositiveInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-greater-thannpi2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:nonPositiveInteger(upper bound) * $arg2 = xs:nonPositiveInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThannpi2args3() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"0\") gt xs:nonPositiveInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-greater-thannpi2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:nonPositiveInteger(lower bound) * $arg2 = xs:nonPositiveInteger(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThannpi2args4() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-999999999999999999\") gt xs:nonPositiveInteger(\"-475688437271870490\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thannpi2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:nonPositiveInteger(lower bound) * $arg2 = xs:nonPositiveInteger(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThannpi2args5() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-999999999999999999\") gt xs:nonPositiveInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanpint2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:positiveInteger(lower bound) * $arg2 = xs:positiveInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanpint2args1() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") gt xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanpint2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:positiveInteger(mid range) * $arg2 = xs:positiveInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanpint2args2() { final XQuery query = new XQuery( "xs:positiveInteger(\"52704602390610033\") gt xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanpint2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:positiveInteger(upper bound) * $arg2 = xs:positiveInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanpint2args3() { final XQuery query = new XQuery( "xs:positiveInteger(\"999999999999999999\") gt xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanpint2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:positiveInteger(lower bound) * $arg2 = xs:positiveInteger(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanpint2args4() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") gt xs:positiveInteger(\"52704602390610033\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanpint2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:positiveInteger(lower bound) * $arg2 = xs:positiveInteger(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanpint2args5() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") gt xs:positiveInteger(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thansht2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:short(lower bound) * $arg2 = xs:short(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThansht2args1() { final XQuery query = new XQuery( "xs:short(\"-32768\") gt xs:short(\"-32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thansht2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:short(mid range) * $arg2 = xs:short(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThansht2args2() { final XQuery query = new XQuery( "xs:short(\"-5324\") gt xs:short(\"-32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-greater-thansht2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:short(upper bound) * $arg2 = xs:short(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThansht2args3() { final XQuery query = new XQuery( "xs:short(\"32767\") gt xs:short(\"-32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-greater-thansht2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:short(lower bound) * $arg2 = xs:short(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThansht2args4() { final XQuery query = new XQuery( "xs:short(\"-32768\") gt xs:short(\"-5324\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thansht2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:short(lower bound) * $arg2 = xs:short(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThansht2args5() { final XQuery query = new XQuery( "xs:short(\"-32768\") gt xs:short(\"32767\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanulng2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedLong(lower bound) * $arg2 = xs:unsignedLong(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanulng2args1() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") gt xs:unsignedLong(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanulng2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedLong(mid range) * $arg2 = xs:unsignedLong(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanulng2args2() { final XQuery query = new XQuery( "xs:unsignedLong(\"130747108607674654\") gt xs:unsignedLong(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanulng2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedLong(upper bound) * $arg2 = xs:unsignedLong(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanulng2args3() { final XQuery query = new XQuery( "xs:unsignedLong(\"184467440737095516\") gt xs:unsignedLong(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanulng2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedLong(lower bound) * $arg2 = xs:unsignedLong(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanulng2args4() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") gt xs:unsignedLong(\"130747108607674654\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanulng2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedLong(lower bound) * $arg2 = xs:unsignedLong(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanulng2args5() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") gt xs:unsignedLong(\"184467440737095516\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanusht2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedShort(lower bound) * $arg2 = xs:unsignedShort(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanusht2args1() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") gt xs:unsignedShort(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanusht2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedShort(mid range) * $arg2 = xs:unsignedShort(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanusht2args2() { final XQuery query = new XQuery( "xs:unsignedShort(\"44633\") gt xs:unsignedShort(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanusht2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedShort(upper bound) * $arg2 = xs:unsignedShort(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanusht2args3() { final XQuery query = new XQuery( "xs:unsignedShort(\"65535\") gt xs:unsignedShort(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanusht2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedShort(lower bound) * $arg2 = xs:unsignedShort(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanusht2args4() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") gt xs:unsignedShort(\"44633\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-greater-thanusht2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-greater-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedShort(lower bound) * $arg2 = xs:unsignedShort(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericGreaterThanusht2args5() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") gt xs:unsignedShort(\"65535\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpNumericIntegerDivide.java000066400000000000000000002056221222453003200313350ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the numeric-integer-divide() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpNumericIntegerDivide extends QT3TestSet { /** * A test whose essence is: `(xs:decimal(6) idiv xs:integer(2)) instance of xs:integer`. . */ @org.junit.Test public void kNumericIntegerDivide1() { final XQuery query = new XQuery( "(xs:decimal(6) idiv xs:integer(2)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:float(6) idiv xs:float(2)) instance of xs:integer`. . */ @org.junit.Test public void kNumericIntegerDivide10() { final XQuery query = new XQuery( "(xs:float(6) idiv xs:float(2)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:decimal(6) idiv xs:double(2)) instance of xs:integer`. . */ @org.junit.Test public void kNumericIntegerDivide11() { final XQuery query = new XQuery( "(xs:decimal(6) idiv xs:double(2)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:double(6) idiv xs:decimal(2)) instance of xs:integer`. . */ @org.junit.Test public void kNumericIntegerDivide12() { final XQuery query = new XQuery( "(xs:double(6) idiv xs:decimal(2)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:double(6) idiv xs:float(2)) instance of xs:integer`. . */ @org.junit.Test public void kNumericIntegerDivide13() { final XQuery query = new XQuery( "(xs:double(6) idiv xs:float(2)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:float(6) idiv xs:double(2)) instance of xs:integer`. . */ @org.junit.Test public void kNumericIntegerDivide14() { final XQuery query = new XQuery( "(xs:float(6) idiv xs:double(2)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:double(6) idiv xs:integer(2)) instance of xs:integer`. . */ @org.junit.Test public void kNumericIntegerDivide15() { final XQuery query = new XQuery( "(xs:double(6) idiv xs:integer(2)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:integer(6) idiv xs:double(2)) instance of xs:integer`. . */ @org.junit.Test public void kNumericIntegerDivide16() { final XQuery query = new XQuery( "(xs:integer(6) idiv xs:double(2)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:double(6) idiv xs:double(2)) instance of xs:integer`. . */ @org.junit.Test public void kNumericIntegerDivide17() { final XQuery query = new XQuery( "(xs:double(6) idiv xs:double(2)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `10 idiv 3 eq 3`. . */ @org.junit.Test public void kNumericIntegerDivide18() { final XQuery query = new XQuery( "10 idiv 3 eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `3 idiv -2 eq -1`. . */ @org.junit.Test public void kNumericIntegerDivide19() { final XQuery query = new XQuery( "3 idiv -2 eq -1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:integer(6) idiv xs:decimal(2)) instance of xs:integer`. . */ @org.junit.Test public void kNumericIntegerDivide2() { final XQuery query = new XQuery( "(xs:integer(6) idiv xs:decimal(2)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `-3 idiv 2 eq -1`. . */ @org.junit.Test public void kNumericIntegerDivide20() { final XQuery query = new XQuery( "-3 idiv 2 eq -1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `-3 idiv -2 eq 1`. . */ @org.junit.Test public void kNumericIntegerDivide21() { final XQuery query = new XQuery( "-3 idiv -2 eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `5.0 idiv 2.0 eq 2`. . */ @org.junit.Test public void kNumericIntegerDivide22() { final XQuery query = new XQuery( "5.0 idiv 2.0 eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `9.0 idiv 3 eq 3`. . */ @org.junit.Test public void kNumericIntegerDivide23() { final XQuery query = new XQuery( "9.0 idiv 3 eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `-3.5 idiv 3 eq -1`. . */ @org.junit.Test public void kNumericIntegerDivide24() { final XQuery query = new XQuery( "-3.5 idiv 3 eq -1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `3.0 idiv 4 eq 0`. . */ @org.junit.Test public void kNumericIntegerDivide25() { final XQuery query = new XQuery( "3.0 idiv 4 eq 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `3.1E1 idiv 6 eq 5`. . */ @org.junit.Test public void kNumericIntegerDivide26() { final XQuery query = new XQuery( "3.1E1 idiv 6 eq 5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `3.1E1 idiv 7 eq 4`. . */ @org.junit.Test public void kNumericIntegerDivide27() { final XQuery query = new XQuery( "3.1E1 idiv 7 eq 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(1.1 idiv 1) instance of xs:integer`. . */ @org.junit.Test public void kNumericIntegerDivide28() { final XQuery query = new XQuery( "(1.1 idiv 1) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:double(1.1) idiv 1.1) instance of xs:integer`. . */ @org.junit.Test public void kNumericIntegerDivide29() { final XQuery query = new XQuery( "(xs:double(1.1) idiv 1.1) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:integer(6) idiv xs:integer(2)) instance of xs:integer`. . */ @org.junit.Test public void kNumericIntegerDivide3() { final XQuery query = new XQuery( "(xs:integer(6) idiv xs:integer(2)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `3 idiv 1.1 eq 2`. . */ @org.junit.Test public void kNumericIntegerDivide30() { final XQuery query = new XQuery( "3 idiv 1.1 eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `1 idiv xs:float("NaN")`. . */ @org.junit.Test public void kNumericIntegerDivide31() { final XQuery query = new XQuery( "1 idiv xs:float(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0002") ); } /** * A test whose essence is: `xs:float("NaN") idiv 1`. . */ @org.junit.Test public void kNumericIntegerDivide32() { final XQuery query = new XQuery( "xs:float(\"NaN\") idiv 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0002") ); } /** * A test whose essence is: `xs:float("INF") idiv xs:float(3)`. . */ @org.junit.Test public void kNumericIntegerDivide33() { final XQuery query = new XQuery( "xs:float(\"INF\") idiv xs:float(3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0002") ); } /** * A test whose essence is: `xs:float("-INF") idiv xs:float(3)`. . */ @org.junit.Test public void kNumericIntegerDivide34() { final XQuery query = new XQuery( "xs:float(\"-INF\") idiv xs:float(3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0002") ); } /** * A test whose essence is: `xs:float("3") idiv xs:float("INF") eq xs:float(0)`. . */ @org.junit.Test public void kNumericIntegerDivide35() { final XQuery query = new XQuery( "xs:float(\"3\") idiv xs:float(\"INF\") eq xs:float(0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:float("3") idiv xs:float("-INF") eq xs:float(0)`. . */ @org.junit.Test public void kNumericIntegerDivide36() { final XQuery query = new XQuery( "xs:float(\"3\") idiv xs:float(\"-INF\") eq xs:float(0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `1 idiv xs:double("NaN")`. . */ @org.junit.Test public void kNumericIntegerDivide37() { final XQuery query = new XQuery( "1 idiv xs:double(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0002") ); } /** * A test whose essence is: `xs:double("NaN") idiv 1`. . */ @org.junit.Test public void kNumericIntegerDivide38() { final XQuery query = new XQuery( "xs:double(\"NaN\") idiv 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0002") ); } /** * A test whose essence is: `xs:double("INF") idiv xs:double(3)`. . */ @org.junit.Test public void kNumericIntegerDivide39() { final XQuery query = new XQuery( "xs:double(\"INF\") idiv xs:double(3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0002") ); } /** * A test whose essence is: `(xs:decimal(6) idiv xs:decimal(2)) instance of xs:integer`. . */ @org.junit.Test public void kNumericIntegerDivide4() { final XQuery query = new XQuery( "(xs:decimal(6) idiv xs:decimal(2)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:double("-INF") idiv xs:double(3)`. . */ @org.junit.Test public void kNumericIntegerDivide40() { final XQuery query = new XQuery( "xs:double(\"-INF\") idiv xs:double(3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0002") ); } /** * A test whose essence is: `xs:double("3") idiv xs:double("INF") eq xs:double(0)`. . */ @org.junit.Test public void kNumericIntegerDivide41() { final XQuery query = new XQuery( "xs:double(\"3\") idiv xs:double(\"INF\") eq xs:double(0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:double("3") idiv xs:double("-INF") eq xs:double(0)`. . */ @org.junit.Test public void kNumericIntegerDivide42() { final XQuery query = new XQuery( "xs:double(\"3\") idiv xs:double(\"-INF\") eq xs:double(0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invalid whitespace for the 'idiv' operator. . */ @org.junit.Test public void kNumericIntegerDivide43() { final XQuery query = new XQuery( "10idiv 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Invalid whitespace for the 'idiv' operator. . */ @org.junit.Test public void kNumericIntegerDivide44() { final XQuery query = new XQuery( "10 idiv3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Invalid whitespace for the 'idiv' operator. . */ @org.junit.Test public void kNumericIntegerDivide45() { final XQuery query = new XQuery( "10idiv3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Invoke the 'idiv operator with invalid operands. . */ @org.junit.Test public void kNumericIntegerDivide46() { final XQuery query = new XQuery( "\"3\" idiv \"3\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Invoke the 'idiv' operator with invalid operands. . */ @org.junit.Test public void kNumericIntegerDivide47() { final XQuery query = new XQuery( "\"3\" idiv xs:float(3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A test whose essence is: `(xs:untypedAtomic("9") idiv xs:float(5)) eq 1`. . */ @org.junit.Test public void kNumericIntegerDivide48() { final XQuery query = new XQuery( "(xs:untypedAtomic(\"9\") idiv xs:float(5)) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:float(9) idiv xs:untypedAtomic("5")) eq 1`. . */ @org.junit.Test public void kNumericIntegerDivide49() { final XQuery query = new XQuery( "(xs:float(9) idiv xs:untypedAtomic(\"5\")) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:decimal(6) idiv xs:decimal(2)) instance of xs:integer`. . */ @org.junit.Test public void kNumericIntegerDivide5() { final XQuery query = new XQuery( "(xs:decimal(6) idiv xs:decimal(2)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke 'idiv' where an untypedAtomic conversion fails. . */ @org.junit.Test public void kNumericIntegerDivide50() { final XQuery query = new XQuery( "(xs:untypedAtomic(\"nine\") idiv xs:float(5)) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Invoke 'idiv' where an untypedAtomic conversion fails. . */ @org.junit.Test public void kNumericIntegerDivide51() { final XQuery query = new XQuery( "(xs:float(9) idiv xs:untypedAtomic(\"five\")) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Operand(s) which are the empty sequence. . */ @org.junit.Test public void kNumericIntegerDivide52() { final XQuery query = new XQuery( "empty(() idiv ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Operand(s) which are the empty sequence. . */ @org.junit.Test public void kNumericIntegerDivide53() { final XQuery query = new XQuery( "empty(() idiv xs:decimal(1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * A test whose essence is: `(xs:float(6) idiv xs:decimal(2)) instance of xs:integer`. . */ @org.junit.Test public void kNumericIntegerDivide6() { final XQuery query = new XQuery( "(xs:float(6) idiv xs:decimal(2)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:decimal(6) idiv xs:float(2)) instance of xs:integer`. . */ @org.junit.Test public void kNumericIntegerDivide7() { final XQuery query = new XQuery( "(xs:decimal(6) idiv xs:float(2)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:float(6) idiv xs:integer(2)) instance of xs:integer`. . */ @org.junit.Test public void kNumericIntegerDivide8() { final XQuery query = new XQuery( "(xs:float(6) idiv xs:integer(2)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:integer(6) idiv xs:float(2)) instance of xs:integer`. . */ @org.junit.Test public void kNumericIntegerDivide9() { final XQuery query = new XQuery( "(xs:integer(6) idiv xs:float(2)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Integer divide by 0. . */ @org.junit.Test public void k2NumericIntegerDivide1() { final XQuery query = new XQuery( "1 idiv 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * Integer divide by 0.0. . */ @org.junit.Test public void k2NumericIntegerDivide2() { final XQuery query = new XQuery( "1 idiv 0.0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * Integer divide by +0.0. . */ @org.junit.Test public void k2NumericIntegerDivide3() { final XQuery query = new XQuery( "1 idiv +0.0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * Integer divide by -0.0. . */ @org.junit.Test public void k2NumericIntegerDivide4() { final XQuery query = new XQuery( "1 idiv -0.0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * Integer divide by 0e0. . */ @org.junit.Test public void k2NumericIntegerDivide5() { final XQuery query = new XQuery( "1 idiv 0e0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * Integer divide -1 by 0e0. . */ @org.junit.Test public void k2NumericIntegerDivide6() { final XQuery query = new XQuery( "-1 idiv 0e0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * Integer divide by xs:float(0). . */ @org.junit.Test public void k2NumericIntegerDivide7() { final XQuery query = new XQuery( "1 idiv xs:float(0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * Integer divide -1 by xs:float(0). . */ @org.junit.Test public void k2NumericIntegerDivide8() { final XQuery query = new XQuery( "-1 idiv xs:float(0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * test possible overflow of xs:decimal . */ @org.junit.Test public void cbclNumericIdivide001() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:decimal) as xs:decimal { $arg * $arg }; \n" + " \tlocal:square(4294967296.0) idiv 0.0000000000005 gt 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOAR0002") ) ); } /** * test possible overflow of xs:double . */ @org.junit.Test public void cbclNumericIdivide002() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:double) as xs:double { $arg * $arg }; \n" + " \tlocal:square(1e100) idiv 5e-100", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FOAR0002") || ( assertType("xs:integer") && assertQuery("string-length(string($result)) gt 299") ) ) ); } /** * test possible overflow of xs:float . */ @org.junit.Test public void cbclNumericIdivide003() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:float) as xs:float { $arg * $arg }; \n" + " \tlocal:square(xs:float(1e30)) idiv xs:float(5e-30)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0002") ); } /** * ensure that idividing xs:integers returns an xs:integer . */ @org.junit.Test public void cbclNumericIdivide004() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:integer($x as xs:decimal) { if ($x mod 1 eq 0) then xs:integer($x) else $x };\n" + " \t (local:integer(2) idiv local:integer(2)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test idiv by one on an xs:integer . */ @org.junit.Test public void cbclNumericIdivide005() { final XQuery query = new XQuery( "xs:integer(2) idiv xs:decimal(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Test idiv by one on an xs:float . */ @org.junit.Test public void cbclNumericIdivide006() { final XQuery query = new XQuery( "xs:float(1.5) idiv xs:decimal(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test idiv by one on an xs:double . */ @org.junit.Test public void cbclNumericIdivide007() { final XQuery query = new XQuery( "xs:double(1.5) idiv xs:decimal(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test idiv by one on an xs:double . */ @org.junit.Test public void cbclNumericIdivide008() { final XQuery query = new XQuery( "xs:float('1e38') idiv xs:float('1e-37')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0002") ); } /** * Test numeric idiv with a potential type check error . */ @org.junit.Test public void cbclNumericIdivide009() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:value($number as xs:boolean) { if ($number) then 1 else xs:string('1') }; \n" + " \tlocal:value(true()) idiv local:value(true())\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1") || error("XPTY0004") ) ); } /** * Evaluates The "op:numeric-integer-divide" operator for error condition. . */ @org.junit.Test public void opNumericIntegerDivide1() { final XQuery query = new XQuery( "(0 div 0E0) idiv xs:integer(2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0002") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void opNumericIntegerDividedec2args1() { final XQuery query = new XQuery( "xs:decimal(\"-999999999999999999\") idiv xs:decimal(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:decimal(mid range) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void opNumericIntegerDividedec2args2() { final XQuery query = new XQuery( "xs:decimal(\"617375191608514839\") idiv xs:decimal(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:decimal(upper bound) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void opNumericIntegerDividedec2args3() { final XQuery query = new XQuery( "xs:decimal(\"999999999999999999\") idiv xs:decimal(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(mid range) . */ @org.junit.Test public void opNumericIntegerDividedec2args4() { final XQuery query = new XQuery( "xs:decimal(\"-999999999999999999\") idiv xs:decimal(\"617375191608514839\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(upper bound) . */ @org.junit.Test public void opNumericIntegerDividedec2args5() { final XQuery query = new XQuery( "xs:decimal(\"-999999999999999999\") idiv xs:decimal(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * "op:numeric-integer-divide" with both arguments of type xs:double. Raise [err:FOAR0002] . */ @org.junit.Test public void opNumericIntegerDividedouble2args1() { final XQuery query = new XQuery( "xs:double(\"-INF\") idiv xs:double(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0002") ); } /** * "op:numeric-integer-divide" with both arguments of type xs:double. Raise [err:FOAR0002] . */ @org.junit.Test public void opNumericIntegerDividedouble2args2() { final XQuery query = new XQuery( "xs:double(\"1\") idiv xs:double(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0002") ); } /** * "op:numeric-integer-divide" with both arguments of type xs:double. Raise [err:FOAR0001] . */ @org.junit.Test public void opNumericIntegerDividedouble2args3() { final XQuery query = new XQuery( "xs:double(\"1\") idiv xs:double(\"0.0E0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * "op:numeric-integer-divide" with both arguments of type xs:double. Raise [err:FOAR0001] . */ @org.junit.Test public void opNumericIntegerDividedouble2args4() { final XQuery query = new XQuery( "xs:double(\"INF\") idiv xs:double(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * "op:numeric-integer-divide" with both arguments of type xs:double. . */ @org.junit.Test public void opNumericIntegerDividedouble2args5() { final XQuery query = new XQuery( "xs:double(\"12.78e-2\") idiv xs:double(\"3\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Integer divide with operands of type xs:float. Raise [err:FOAR0002]. . */ @org.junit.Test public void opNumericIntegerDividefloat2args1() { final XQuery query = new XQuery( "xs:float(\"-INF\") idiv xs:float(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0002") ); } /** * Integer divide with operands of type xs:float. Raise [err:FOAR0002]. . */ @org.junit.Test public void opNumericIntegerDividefloat2args2() { final XQuery query = new XQuery( "xs:float(\"1\") idiv xs:float(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0002") ); } /** * Integer divide with operands of type xs:float. Raise [err:FOAR0001]. . */ @org.junit.Test public void opNumericIntegerDividefloat2args3() { final XQuery query = new XQuery( "xs:float(\"1\") idiv xs:float(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * Integer divide with operands of type xs:float. Raise [err:FOAR0001]. . */ @org.junit.Test public void opNumericIntegerDividefloat2args4() { final XQuery query = new XQuery( "xs:float(\"INF\") idiv xs:float(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * "op:numeric-integer-divide" with both arguments of type xs:float. . */ @org.junit.Test public void opNumericIntegerDividefloat2args5() { final XQuery query = new XQuery( "xs:float(\"-3.5\") idiv xs:float(\"3\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void opNumericIntegerDivideint2args1() { final XQuery query = new XQuery( "xs:int(\"-2147483648\") idiv xs:int(\"-2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:int(mid range) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void opNumericIntegerDivideint2args2() { final XQuery query = new XQuery( "xs:int(\"-1873914410\") idiv xs:int(\"-2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:int(upper bound) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void opNumericIntegerDivideint2args3() { final XQuery query = new XQuery( "xs:int(\"2147483647\") idiv xs:int(\"-2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(mid range) . */ @org.junit.Test public void opNumericIntegerDivideint2args4() { final XQuery query = new XQuery( "xs:int(\"-2147483648\") idiv xs:int(\"-1873914410\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(upper bound) . */ @org.junit.Test public void opNumericIntegerDivideint2args5() { final XQuery query = new XQuery( "xs:int(\"-2147483648\") idiv xs:int(\"2147483647\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void opNumericIntegerDivideintg2args1() { final XQuery query = new XQuery( "xs:integer(\"-999999999999999999\") idiv xs:integer(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:integer(mid range) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void opNumericIntegerDivideintg2args2() { final XQuery query = new XQuery( "xs:integer(\"830993497117024304\") idiv xs:integer(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:integer(upper bound) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void opNumericIntegerDivideintg2args3() { final XQuery query = new XQuery( "xs:integer(\"999999999999999999\") idiv xs:integer(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(mid range) . */ @org.junit.Test public void opNumericIntegerDivideintg2args4() { final XQuery query = new XQuery( "xs:integer(\"-999999999999999999\") idiv xs:integer(\"830993497117024304\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(upper bound) . */ @org.junit.Test public void opNumericIntegerDivideintg2args5() { final XQuery query = new XQuery( "xs:integer(\"-999999999999999999\") idiv xs:integer(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void opNumericIntegerDividelng2args1() { final XQuery query = new XQuery( "xs:long(\"-92233720368547758\") idiv xs:long(\"-92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:long(mid range) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void opNumericIntegerDividelng2args2() { final XQuery query = new XQuery( "xs:long(\"-47175562203048468\") idiv xs:long(\"-92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:long(upper bound) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void opNumericIntegerDividelng2args3() { final XQuery query = new XQuery( "xs:long(\"92233720368547758\") idiv xs:long(\"-92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(mid range) . */ @org.junit.Test public void opNumericIntegerDividelng2args4() { final XQuery query = new XQuery( "xs:long(\"-92233720368547758\") idiv xs:long(\"-47175562203048468\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(upper bound) . */ @org.junit.Test public void opNumericIntegerDividelng2args5() { final XQuery query = new XQuery( "xs:long(\"-92233720368547758\") idiv xs:long(\"92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Simple integer division test with () as one operand should return null . */ @org.junit.Test public void opNumericIntegerDividemix2args1() { final XQuery query = new XQuery( "() idiv 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEmpty() || error("XPST0005") ) ); } /** * If the divisor is zer0, then an error is raised . */ @org.junit.Test public void opNumericIntegerDividemix2args10() { final XQuery query = new XQuery( "1 idiv 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * Simple integer division test pass string for second operator . */ @org.junit.Test public void opNumericIntegerDividemix2args2() { final XQuery query = new XQuery( "1 idiv '1'", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Simple integer division test, second operator cast string to integer . */ @org.junit.Test public void opNumericIntegerDividemix2args3() { final XQuery query = new XQuery( "1 idiv xs:integer('1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Simple integer division test, second operator is a node, atomization applied . */ @org.junit.Test public void opNumericIntegerDividemix2args4() { final XQuery query = new XQuery( "3 idiv 2 ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Simple integer division test, second operator is a node, atomization applied . */ @org.junit.Test public void opNumericIntegerDividemix2args5() { final XQuery query = new XQuery( "1 idiv 2 ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Simple integer division test, second operator node which is not atomizable . */ @org.junit.Test public void opNumericIntegerDividemix2args6() { final XQuery query = new XQuery( "3 idiv 2 2 ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Simple integer division test, two operands are nodes . */ @org.junit.Test public void opNumericIntegerDividemix2args7() { final XQuery query = new XQuery( " 1 idiv 2 ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Simple integer division test, second operator is a node, atomizable but not castable to integer . */ @org.junit.Test public void opNumericIntegerDividemix2args8() { final XQuery query = new XQuery( "1 idiv x ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Simple integer division test pass an empty node for second operator . */ @org.junit.Test public void opNumericIntegerDividemix2args9() { final XQuery query = new XQuery( "1 idiv ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void opNumericIntegerDividenint2args1() { final XQuery query = new XQuery( "xs:negativeInteger(\"-999999999999999999\") idiv xs:negativeInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:negativeInteger(mid range) $arg2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void opNumericIntegerDividenint2args2() { final XQuery query = new XQuery( "xs:negativeInteger(\"-297014075999096793\") idiv xs:negativeInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:negativeInteger(upper bound) $arg2 = xs:negativeInteger(lower bound) . */ @org.junit.Test public void opNumericIntegerDividenint2args3() { final XQuery query = new XQuery( "xs:negativeInteger(\"-1\") idiv xs:negativeInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(mid range) . */ @org.junit.Test public void opNumericIntegerDividenint2args4() { final XQuery query = new XQuery( "xs:negativeInteger(\"-999999999999999999\") idiv xs:negativeInteger(\"-297014075999096793\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(upper bound) . */ @org.junit.Test public void opNumericIntegerDividenint2args5() { final XQuery query = new XQuery( "xs:negativeInteger(\"-999999999999999999\") idiv xs:negativeInteger(\"-1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void opNumericIntegerDividenni2args1() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") idiv xs:nonNegativeInteger(\"303884545991464527\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void opNumericIntegerDividenni2args2() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") idiv xs:nonNegativeInteger(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void opNumericIntegerDividenpi2args1() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-999999999999999999\") idiv xs:nonPositiveInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(mid range) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void opNumericIntegerDividenpi2args2() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-475688437271870490\") idiv xs:nonPositiveInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(upper bound) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void opNumericIntegerDividenpi2args3() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"0\") idiv xs:nonPositiveInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void opNumericIntegerDividenpi2args4() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-999999999999999999\") idiv xs:nonPositiveInteger(\"-475688437271870490\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void opNumericIntegerDividepint2args1() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") idiv xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:positiveInteger(mid range) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void opNumericIntegerDividepint2args2() { final XQuery query = new XQuery( "xs:positiveInteger(\"52704602390610033\") idiv xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("52704602390610033") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:positiveInteger(upper bound) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void opNumericIntegerDividepint2args3() { final XQuery query = new XQuery( "xs:positiveInteger(\"999999999999999999\") idiv xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(mid range) . */ @org.junit.Test public void opNumericIntegerDividepint2args4() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") idiv xs:positiveInteger(\"52704602390610033\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(upper bound) . */ @org.junit.Test public void opNumericIntegerDividepint2args5() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") idiv xs:positiveInteger(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void opNumericIntegerDividesht2args1() { final XQuery query = new XQuery( "xs:short(\"-32768\") idiv xs:short(\"-32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:short(mid range) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void opNumericIntegerDividesht2args2() { final XQuery query = new XQuery( "xs:short(\"-5324\") idiv xs:short(\"-32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:short(upper bound) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void opNumericIntegerDividesht2args3() { final XQuery query = new XQuery( "xs:short(\"32767\") idiv xs:short(\"-32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(mid range) . */ @org.junit.Test public void opNumericIntegerDividesht2args4() { final XQuery query = new XQuery( "xs:short(\"-32768\") idiv xs:short(\"-5324\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("6") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(upper bound) . */ @org.junit.Test public void opNumericIntegerDividesht2args5() { final XQuery query = new XQuery( "xs:short(\"-32768\") idiv xs:short(\"32767\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(mid range) . */ @org.junit.Test public void opNumericIntegerDivideulng2args1() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") idiv xs:unsignedLong(\"130747108607674654\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(upper bound) . */ @org.junit.Test public void opNumericIntegerDivideulng2args2() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") idiv xs:unsignedLong(\"184467440737095516\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(mid range) . */ @org.junit.Test public void opNumericIntegerDivideusht2args1() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") idiv xs:unsignedShort(\"44633\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-integer-divide" operator with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(upper bound) . */ @org.junit.Test public void opNumericIntegerDivideusht2args2() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") idiv xs:unsignedShort(\"65535\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpNumericLessThan.java000066400000000000000000004741241222453003200303410ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the numeric-less-than() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpNumericLessThan extends QT3TestSet { /** * * ******************************************************* * Test: K-NumericLT-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `xs:integer(-1) lt xs:integer(1)`. * ******************************************************* * . */ @org.junit.Test public void kNumericLT1() { final XQuery query = new XQuery( "xs:integer(-1) lt xs:integer(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericLT-10 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `xs:float("-INF") lt 0`. * ******************************************************* * . */ @org.junit.Test public void kNumericLT10() { final XQuery query = new XQuery( "xs:float(\"-INF\") lt 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericLT-11 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `xs:float(-1) lt xs:float(1)`. * ******************************************************* * . */ @org.junit.Test public void kNumericLT11() { final XQuery query = new XQuery( "xs:float(-1) lt xs:float(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericLT-12 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `xs:float(-1) le xs:float(1)`. * ******************************************************* * . */ @org.junit.Test public void kNumericLT12() { final XQuery query = new XQuery( "xs:float(-1) le xs:float(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericLT-13 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `not(xs:double("NaN") lt 1)`. * ******************************************************* * . */ @org.junit.Test public void kNumericLT13() { final XQuery query = new XQuery( "not(xs:double(\"NaN\") lt 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericLT-14 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `not(xs:float("NaN") lt 1)`. * ******************************************************* * . */ @org.junit.Test public void kNumericLT14() { final XQuery query = new XQuery( "not(xs:float(\"NaN\") lt 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericLT-15 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `not(xs:double("NaN") le 1)`. * ******************************************************* * . */ @org.junit.Test public void kNumericLT15() { final XQuery query = new XQuery( "not(xs:double(\"NaN\") le 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericLT-16 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `not(xs:float("NaN") le 1)`. * ******************************************************* * . */ @org.junit.Test public void kNumericLT16() { final XQuery query = new XQuery( "not(xs:float(\"NaN\") le 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericLT-17 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `not(1 lt xs:double("NaN"))`. * ******************************************************* * . */ @org.junit.Test public void kNumericLT17() { final XQuery query = new XQuery( "not(1 lt xs:double(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericLT-18 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `not(1 lt xs:float("NaN"))`. * ******************************************************* * . */ @org.junit.Test public void kNumericLT18() { final XQuery query = new XQuery( "not(1 lt xs:float(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericLT-19 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `not(1 le xs:double("NaN"))`. * ******************************************************* * . */ @org.junit.Test public void kNumericLT19() { final XQuery query = new XQuery( "not(1 le xs:double(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericLT-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `xs:integer(-1) le xs:integer(1)`. * ******************************************************* * . */ @org.junit.Test public void kNumericLT2() { final XQuery query = new XQuery( "xs:integer(-1) le xs:integer(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericLT-20 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `not(1 le xs:float("NaN"))`. * ******************************************************* * . */ @org.junit.Test public void kNumericLT20() { final XQuery query = new XQuery( "not(1 le xs:float(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericLT-21 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: le combined with count(). * ******************************************************* * . */ @org.junit.Test public void kNumericLT21() { final XQuery query = new XQuery( "1 le count((1, 2, 3, timezone-from-time(current-time()), 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericLT-22 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: lt combined with count(). * ******************************************************* * . */ @org.junit.Test public void kNumericLT22() { final XQuery query = new XQuery( "0 lt count((1, 2, 3, timezone-from-time(current-time()), 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericLT-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `xs:decimal(-1) lt xs:decimal(1)`. * ******************************************************* * . */ @org.junit.Test public void kNumericLT3() { final XQuery query = new XQuery( "xs:decimal(-1) lt xs:decimal(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericLT-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `xs:decimal(-1) le xs:decimal(1)`. * ******************************************************* * . */ @org.junit.Test public void kNumericLT4() { final XQuery query = new XQuery( "xs:decimal(-1) le xs:decimal(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericLT-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `0 lt xs:double("INF")`. * ******************************************************* * . */ @org.junit.Test public void kNumericLT5() { final XQuery query = new XQuery( "0 lt xs:double(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericLT-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `xs:double("-INF") lt 0`. * ******************************************************* * . */ @org.junit.Test public void kNumericLT6() { final XQuery query = new XQuery( "xs:double(\"-INF\") lt 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericLT-7 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `xs:double(-1) lt xs:double(1)`. * ******************************************************* * . */ @org.junit.Test public void kNumericLT7() { final XQuery query = new XQuery( "xs:double(-1) lt xs:double(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericLT-8 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `xs:double(-1) le xs:double(1)`. * ******************************************************* * . */ @org.junit.Test public void kNumericLT8() { final XQuery query = new XQuery( "xs:double(-1) le xs:double(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-NumericLT-9 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `0 lt xs:float("INF")`. * ******************************************************* * . */ @org.junit.Test public void kNumericLT9() { final XQuery query = new XQuery( "0 lt xs:float(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K2-NumericLT-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Compare two xs:unsignedLong values. * ******************************************************* * . */ @org.junit.Test public void k2NumericLT1() { final XQuery query = new XQuery( "xs:unsignedLong(\"100\") lt xs:unsignedLong(\"18446744073709551615\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K2-NumericLT-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Compare two xs:unsignedLong values. * ******************************************************* * . */ @org.junit.Test public void k2NumericLT2() { final XQuery query = new XQuery( "xs:unsignedLong(\"18446744073709551615\") lt xs:unsignedLong(\"100\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:double . */ @org.junit.Test public void cbclNumericLessThan001() { final XQuery query = new XQuery( "declare function local:square($arg as xs:double) as xs:double { $arg * $arg }; not( local:square(1e0) lt local:square(2e0) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:float . */ @org.junit.Test public void cbclNumericLessThan002() { final XQuery query = new XQuery( "declare function local:square($arg as xs:float) as xs:float { $arg * $arg }; not( local:square(xs:float(1e0)) lt local:square(xs:float(2e0)) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:decimal . */ @org.junit.Test public void cbclNumericLessThan003() { final XQuery query = new XQuery( "declare function local:square($arg as xs:decimal) as xs:decimal { $arg * $arg }; not( local:square(1.0) lt local:square(2.0) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:integer . */ @org.junit.Test public void cbclNumericLessThan004() { final XQuery query = new XQuery( "declare function local:square($arg as xs:integer) as xs:integer { $arg * $arg }; not( local:square(1) lt local:square(2) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:double . */ @org.junit.Test public void cbclNumericLessThan005() { final XQuery query = new XQuery( "declare function local:square($arg as xs:double) as xs:double { $arg * $arg }; not( local:square(1e0) ge local:square(2e0) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of xs:float . */ @org.junit.Test public void cbclNumericLessThan006() { final XQuery query = new XQuery( "declare function local:square($arg as xs:float) as xs:float { $arg * $arg }; not( local:square(xs:float(1e0)) ge local:square(xs:float(2e0)) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of xs:decimal . */ @org.junit.Test public void cbclNumericLessThan007() { final XQuery query = new XQuery( "declare function local:square($arg as xs:decimal) as xs:decimal { $arg * $arg }; not( local:square(1.0) ge local:square(2.0) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of xs:integer . */ @org.junit.Test public void cbclNumericLessThan008() { final XQuery query = new XQuery( "declare function local:square($arg as xs:integer) as xs:integer { $arg * $arg }; not( local:square(1) ge local:square(2) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of xs:double . */ @org.junit.Test public void cbclNumericLessThan009() { final XQuery query = new XQuery( "declare function local:square($arg as xs:double) as xs:double { $arg * $arg }; not(not( local:square(1e0) lt local:square(2e0) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of xs:float . */ @org.junit.Test public void cbclNumericLessThan010() { final XQuery query = new XQuery( "declare function local:square($arg as xs:float) as xs:float { $arg * $arg }; not(not( local:square(xs:float(1e0)) lt local:square(xs:float(2e0)) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of xs:double . */ @org.junit.Test public void cbclNumericLessThan011() { final XQuery query = new XQuery( "declare function local:square($arg as xs:double) as xs:double { $arg * $arg }; not(not( local:square(1e0) ge local:square(2e0) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:float . */ @org.junit.Test public void cbclNumericLessThan012() { final XQuery query = new XQuery( "declare function local:square($arg as xs:float) as xs:float { $arg * $arg }; not(not( local:square(xs:float(1e0)) ge local:square(xs:float(2e0)) ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericLessThan013() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return $x + 1 lt 121", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericLessThan014() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return $x - 1 lt 121", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericLessThan015() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return 121 lt $x + 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericLessThan016() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return 121 lt 1 + $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericLessThan017() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return $x + 1 ge 121", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericLessThan018() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return $x - 1 ge 121", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericLessThan019() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return 121 ge $x + 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericLessThan020() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return 121 ge 1 + $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericLessThan021() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return $x + 2 lt 121", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericLessThan022() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return $x - 2 lt 12", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericLessThan023() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return 121 lt $x + 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericLessThan024() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return 121 lt 2 + $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericLessThan025() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return $x + 2 ge 121", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericLessThan026() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return $x - 2 ge 12", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericLessThan027() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return 121 ge $x + 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericLessThan028() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return 121 ge $x + 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of integers . */ @org.junit.Test public void cbclNumericLessThan029() { final XQuery query = new XQuery( "declare function local:factorial($arg as xs:integer) as xs:integer { if ($arg lt 1) then 1 else $arg * local:factorial($arg - 1) }; let $x := local:factorial(5) return 121 ge 2 + $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thandbl2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:double(lower bound) * $arg2 = xs:double(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThandbl2args1() { final XQuery query = new XQuery( "xs:double(\"-1.7976931348623157E308\") lt xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thandbl2args-10 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:double(lower bound) * $arg2 = xs:double(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThandbl2args10() { final XQuery query = new XQuery( "xs:double(\"-1.7976931348623157E308\") ge xs:double(\"1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thandbl2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:double(mid range) * $arg2 = xs:double(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThandbl2args2() { final XQuery query = new XQuery( "xs:double(\"0\") lt xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thandbl2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:double(upper bound) * $arg2 = xs:double(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThandbl2args3() { final XQuery query = new XQuery( "xs:double(\"1.7976931348623157E308\") lt xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thandbl2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:double(lower bound) * $arg2 = xs:double(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThandbl2args4() { final XQuery query = new XQuery( "xs:double(\"-1.7976931348623157E308\") lt xs:double(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thandbl2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:double(lower bound) * $arg2 = xs:double(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThandbl2args5() { final XQuery query = new XQuery( "xs:double(\"-1.7976931348623157E308\") lt xs:double(\"1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thandbl2args-6 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:double(lower bound) * $arg2 = xs:double(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThandbl2args6() { final XQuery query = new XQuery( "xs:double(\"-1.7976931348623157E308\") ge xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thandbl2args-7 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:double(mid range) * $arg2 = xs:double(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThandbl2args7() { final XQuery query = new XQuery( "xs:double(\"0\") ge xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thandbl2args-8 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:double(upper bound) * $arg2 = xs:double(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThandbl2args8() { final XQuery query = new XQuery( "xs:double(\"1.7976931348623157E308\") ge xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thandbl2args-9 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:double(lower bound) * $arg2 = xs:double(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThandbl2args9() { final XQuery query = new XQuery( "xs:double(\"-1.7976931348623157E308\") ge xs:double(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thandec2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:decimal(lower bound) * $arg2 = xs:decimal(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThandec2args1() { final XQuery query = new XQuery( "xs:decimal(\"-999999999999999999\") lt xs:decimal(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thandec2args-10 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:decimal(lower bound) * $arg2 = xs:decimal(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThandec2args10() { final XQuery query = new XQuery( "xs:decimal(\"-999999999999999999\") ge xs:decimal(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thandec2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:decimal(mid range) * $arg2 = xs:decimal(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThandec2args2() { final XQuery query = new XQuery( "xs:decimal(\"617375191608514839\") lt xs:decimal(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thandec2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:decimal(upper bound) * $arg2 = xs:decimal(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThandec2args3() { final XQuery query = new XQuery( "xs:decimal(\"999999999999999999\") lt xs:decimal(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thandec2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:decimal(lower bound) * $arg2 = xs:decimal(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThandec2args4() { final XQuery query = new XQuery( "xs:decimal(\"-999999999999999999\") lt xs:decimal(\"617375191608514839\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thandec2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:decimal(lower bound) * $arg2 = xs:decimal(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThandec2args5() { final XQuery query = new XQuery( "xs:decimal(\"-999999999999999999\") lt xs:decimal(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thandec2args-6 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:decimal(lower bound) * $arg2 = xs:decimal(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThandec2args6() { final XQuery query = new XQuery( "xs:decimal(\"-999999999999999999\") ge xs:decimal(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thandec2args-7 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:decimal(mid range) * $arg2 = xs:decimal(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThandec2args7() { final XQuery query = new XQuery( "xs:decimal(\"617375191608514839\") ge xs:decimal(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thandec2args-8 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:decimal(upper bound) * $arg2 = xs:decimal(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThandec2args8() { final XQuery query = new XQuery( "xs:decimal(\"999999999999999999\") ge xs:decimal(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thandec2args-9 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:decimal(lower bound) * $arg2 = xs:decimal(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThandec2args9() { final XQuery query = new XQuery( "xs:decimal(\"-999999999999999999\") ge xs:decimal(\"617375191608514839\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanflt2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:float(lower bound) * $arg2 = xs:float(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanflt2args1() { final XQuery query = new XQuery( "xs:float(\"-3.4028235E38\") lt xs:float(\"-3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanflt2args-10 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:float(lower bound) * $arg2 = xs:float(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanflt2args10() { final XQuery query = new XQuery( "xs:float(\"-3.4028235E38\") ge xs:float(\"3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanflt2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:float(mid range) * $arg2 = xs:float(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanflt2args2() { final XQuery query = new XQuery( "xs:float(\"0\") lt xs:float(\"-3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanflt2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:float(upper bound) * $arg2 = xs:float(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanflt2args3() { final XQuery query = new XQuery( "xs:float(\"3.4028235E38\") lt xs:float(\"-3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanflt2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:float(lower bound) * $arg2 = xs:float(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanflt2args4() { final XQuery query = new XQuery( "xs:float(\"-3.4028235E38\") lt xs:float(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanflt2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:float(lower bound) * $arg2 = xs:float(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanflt2args5() { final XQuery query = new XQuery( "xs:float(\"-3.4028235E38\") lt xs:float(\"3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanflt2args-6 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:float(lower bound) * $arg2 = xs:float(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanflt2args6() { final XQuery query = new XQuery( "xs:float(\"-3.4028235E38\") ge xs:float(\"-3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanflt2args-7 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:float(mid range) * $arg2 = xs:float(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanflt2args7() { final XQuery query = new XQuery( "xs:float(\"0\") ge xs:float(\"-3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanflt2args-8 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:float(upper bound) * $arg2 = xs:float(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanflt2args8() { final XQuery query = new XQuery( "xs:float(\"3.4028235E38\") ge xs:float(\"-3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanflt2args-9 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:float(lower bound) * $arg2 = xs:float(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanflt2args9() { final XQuery query = new XQuery( "xs:float(\"-3.4028235E38\") ge xs:float(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanint2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:int(lower bound) * $arg2 = xs:int(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanint2args1() { final XQuery query = new XQuery( "xs:int(\"-2147483648\") lt xs:int(\"-2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanint2args-10 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:int(lower bound) * $arg2 = xs:int(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanint2args10() { final XQuery query = new XQuery( "xs:int(\"-2147483648\") ge xs:int(\"2147483647\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanint2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:int(mid range) * $arg2 = xs:int(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanint2args2() { final XQuery query = new XQuery( "xs:int(\"-1873914410\") lt xs:int(\"-2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanint2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:int(upper bound) * $arg2 = xs:int(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanint2args3() { final XQuery query = new XQuery( "xs:int(\"2147483647\") lt xs:int(\"-2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanint2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:int(lower bound) * $arg2 = xs:int(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanint2args4() { final XQuery query = new XQuery( "xs:int(\"-2147483648\") lt xs:int(\"-1873914410\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanint2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:int(lower bound) * $arg2 = xs:int(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanint2args5() { final XQuery query = new XQuery( "xs:int(\"-2147483648\") lt xs:int(\"2147483647\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanint2args-6 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:int(lower bound) * $arg2 = xs:int(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanint2args6() { final XQuery query = new XQuery( "xs:int(\"-2147483648\") ge xs:int(\"-2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanint2args-7 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:int(mid range) * $arg2 = xs:int(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanint2args7() { final XQuery query = new XQuery( "xs:int(\"-1873914410\") ge xs:int(\"-2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanint2args-8 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:int(upper bound) * $arg2 = xs:int(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanint2args8() { final XQuery query = new XQuery( "xs:int(\"2147483647\") ge xs:int(\"-2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanint2args-9 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:int(lower bound) * $arg2 = xs:int(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanint2args9() { final XQuery query = new XQuery( "xs:int(\"-2147483648\") ge xs:int(\"-1873914410\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanintg2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:integer(lower bound) * $arg2 = xs:integer(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanintg2args1() { final XQuery query = new XQuery( "xs:integer(\"-999999999999999999\") lt xs:integer(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanintg2args-10 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:integer(lower bound) * $arg2 = xs:integer(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanintg2args10() { final XQuery query = new XQuery( "xs:integer(\"-999999999999999999\") ge xs:integer(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanintg2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:integer(mid range) * $arg2 = xs:integer(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanintg2args2() { final XQuery query = new XQuery( "xs:integer(\"830993497117024304\") lt xs:integer(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanintg2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:integer(upper bound) * $arg2 = xs:integer(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanintg2args3() { final XQuery query = new XQuery( "xs:integer(\"999999999999999999\") lt xs:integer(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanintg2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:integer(lower bound) * $arg2 = xs:integer(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanintg2args4() { final XQuery query = new XQuery( "xs:integer(\"-999999999999999999\") lt xs:integer(\"830993497117024304\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanintg2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:integer(lower bound) * $arg2 = xs:integer(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanintg2args5() { final XQuery query = new XQuery( "xs:integer(\"-999999999999999999\") lt xs:integer(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanintg2args-6 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:integer(lower bound) * $arg2 = xs:integer(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanintg2args6() { final XQuery query = new XQuery( "xs:integer(\"-999999999999999999\") ge xs:integer(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanintg2args-7 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:integer(mid range) * $arg2 = xs:integer(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanintg2args7() { final XQuery query = new XQuery( "xs:integer(\"830993497117024304\") ge xs:integer(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanintg2args-8 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:integer(upper bound) * $arg2 = xs:integer(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanintg2args8() { final XQuery query = new XQuery( "xs:integer(\"999999999999999999\") ge xs:integer(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanintg2args-9 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:integer(lower bound) * $arg2 = xs:integer(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanintg2args9() { final XQuery query = new XQuery( "xs:integer(\"-999999999999999999\") ge xs:integer(\"830993497117024304\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanlng2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:long(lower bound) * $arg2 = xs:long(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanlng2args1() { final XQuery query = new XQuery( "xs:long(\"-92233720368547758\") lt xs:long(\"-92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanlng2args-10 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:long(lower bound) * $arg2 = xs:long(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanlng2args10() { final XQuery query = new XQuery( "xs:long(\"-92233720368547758\") ge xs:long(\"92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanlng2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:long(mid range) * $arg2 = xs:long(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanlng2args2() { final XQuery query = new XQuery( "xs:long(\"-47175562203048468\") lt xs:long(\"-92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanlng2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:long(upper bound) * $arg2 = xs:long(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanlng2args3() { final XQuery query = new XQuery( "xs:long(\"92233720368547758\") lt xs:long(\"-92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanlng2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:long(lower bound) * $arg2 = xs:long(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanlng2args4() { final XQuery query = new XQuery( "xs:long(\"-92233720368547758\") lt xs:long(\"-47175562203048468\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanlng2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:long(lower bound) * $arg2 = xs:long(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanlng2args5() { final XQuery query = new XQuery( "xs:long(\"-92233720368547758\") lt xs:long(\"92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanlng2args-6 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:long(lower bound) * $arg2 = xs:long(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanlng2args6() { final XQuery query = new XQuery( "xs:long(\"-92233720368547758\") ge xs:long(\"-92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanlng2args-7 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:long(mid range) * $arg2 = xs:long(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanlng2args7() { final XQuery query = new XQuery( "xs:long(\"-47175562203048468\") ge xs:long(\"-92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanlng2args-8 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:long(upper bound) * $arg2 = xs:long(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanlng2args8() { final XQuery query = new XQuery( "xs:long(\"92233720368547758\") ge xs:long(\"-92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanlng2args-9 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:long(lower bound) * $arg2 = xs:long(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanlng2args9() { final XQuery query = new XQuery( "xs:long(\"-92233720368547758\") ge xs:long(\"-47175562203048468\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thannint2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:negativeInteger(lower bound) * $arg2 = xs:negativeInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannint2args1() { final XQuery query = new XQuery( "xs:negativeInteger(\"-999999999999999999\") lt xs:negativeInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thannint2args-10 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:negativeInteger(lower bound) * $arg2 = xs:negativeInteger(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannint2args10() { final XQuery query = new XQuery( "xs:negativeInteger(\"-999999999999999999\") ge xs:negativeInteger(\"-1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thannint2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:negativeInteger(mid range) * $arg2 = xs:negativeInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannint2args2() { final XQuery query = new XQuery( "xs:negativeInteger(\"-297014075999096793\") lt xs:negativeInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thannint2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:negativeInteger(upper bound) * $arg2 = xs:negativeInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannint2args3() { final XQuery query = new XQuery( "xs:negativeInteger(\"-1\") lt xs:negativeInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thannint2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:negativeInteger(lower bound) * $arg2 = xs:negativeInteger(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannint2args4() { final XQuery query = new XQuery( "xs:negativeInteger(\"-999999999999999999\") lt xs:negativeInteger(\"-297014075999096793\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thannint2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:negativeInteger(lower bound) * $arg2 = xs:negativeInteger(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannint2args5() { final XQuery query = new XQuery( "xs:negativeInteger(\"-999999999999999999\") lt xs:negativeInteger(\"-1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thannint2args-6 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:negativeInteger(lower bound) * $arg2 = xs:negativeInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannint2args6() { final XQuery query = new XQuery( "xs:negativeInteger(\"-999999999999999999\") ge xs:negativeInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thannint2args-7 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:negativeInteger(mid range) * $arg2 = xs:negativeInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannint2args7() { final XQuery query = new XQuery( "xs:negativeInteger(\"-297014075999096793\") ge xs:negativeInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thannint2args-8 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:negativeInteger(upper bound) * $arg2 = xs:negativeInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannint2args8() { final XQuery query = new XQuery( "xs:negativeInteger(\"-1\") ge xs:negativeInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thannint2args-9 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:negativeInteger(lower bound) * $arg2 = xs:negativeInteger(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannint2args9() { final XQuery query = new XQuery( "xs:negativeInteger(\"-999999999999999999\") ge xs:negativeInteger(\"-297014075999096793\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thannni2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:nonNegativeInteger(lower bound) * $arg2 = xs:nonNegativeInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannni2args1() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") lt xs:nonNegativeInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thannni2args-10 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:nonNegativeInteger(lower bound) * $arg2 = xs:nonNegativeInteger(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannni2args10() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") ge xs:nonNegativeInteger(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thannni2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:nonNegativeInteger(mid range) * $arg2 = xs:nonNegativeInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannni2args2() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"303884545991464527\") lt xs:nonNegativeInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thannni2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:nonNegativeInteger(upper bound) * $arg2 = xs:nonNegativeInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannni2args3() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"999999999999999999\") lt xs:nonNegativeInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thannni2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:nonNegativeInteger(lower bound) * $arg2 = xs:nonNegativeInteger(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannni2args4() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") lt xs:nonNegativeInteger(\"303884545991464527\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thannni2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:nonNegativeInteger(lower bound) * $arg2 = xs:nonNegativeInteger(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannni2args5() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") lt xs:nonNegativeInteger(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thannni2args-6 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:nonNegativeInteger(lower bound) * $arg2 = xs:nonNegativeInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannni2args6() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") ge xs:nonNegativeInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thannni2args-7 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:nonNegativeInteger(mid range) * $arg2 = xs:nonNegativeInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannni2args7() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"303884545991464527\") ge xs:nonNegativeInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thannni2args-8 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:nonNegativeInteger(upper bound) * $arg2 = xs:nonNegativeInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannni2args8() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"999999999999999999\") ge xs:nonNegativeInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thannni2args-9 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:nonNegativeInteger(lower bound) * $arg2 = xs:nonNegativeInteger(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannni2args9() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") ge xs:nonNegativeInteger(\"303884545991464527\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thannpi2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:nonPositiveInteger(lower bound) * $arg2 = xs:nonPositiveInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannpi2args1() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-999999999999999999\") lt xs:nonPositiveInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thannpi2args-10 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:nonPositiveInteger(lower bound) * $arg2 = xs:nonPositiveInteger(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannpi2args10() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-999999999999999999\") ge xs:nonPositiveInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thannpi2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:nonPositiveInteger(mid range) * $arg2 = xs:nonPositiveInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannpi2args2() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-475688437271870490\") lt xs:nonPositiveInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thannpi2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:nonPositiveInteger(upper bound) * $arg2 = xs:nonPositiveInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannpi2args3() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"0\") lt xs:nonPositiveInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thannpi2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:nonPositiveInteger(lower bound) * $arg2 = xs:nonPositiveInteger(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannpi2args4() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-999999999999999999\") lt xs:nonPositiveInteger(\"-475688437271870490\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thannpi2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:nonPositiveInteger(lower bound) * $arg2 = xs:nonPositiveInteger(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannpi2args5() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-999999999999999999\") lt xs:nonPositiveInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thannpi2args-6 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:nonPositiveInteger(lower bound) * $arg2 = xs:nonPositiveInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannpi2args6() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-999999999999999999\") ge xs:nonPositiveInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thannpi2args-7 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:nonPositiveInteger(mid range) * $arg2 = xs:nonPositiveInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannpi2args7() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-475688437271870490\") ge xs:nonPositiveInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thannpi2args-8 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:nonPositiveInteger(upper bound) * $arg2 = xs:nonPositiveInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannpi2args8() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"0\") ge xs:nonPositiveInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thannpi2args-9 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:nonPositiveInteger(lower bound) * $arg2 = xs:nonPositiveInteger(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThannpi2args9() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-999999999999999999\") ge xs:nonPositiveInteger(\"-475688437271870490\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanpint2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:positiveInteger(lower bound) * $arg2 = xs:positiveInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanpint2args1() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") lt xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanpint2args-10 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:positiveInteger(lower bound) * $arg2 = xs:positiveInteger(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanpint2args10() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") ge xs:positiveInteger(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanpint2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:positiveInteger(mid range) * $arg2 = xs:positiveInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanpint2args2() { final XQuery query = new XQuery( "xs:positiveInteger(\"52704602390610033\") lt xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanpint2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:positiveInteger(upper bound) * $arg2 = xs:positiveInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanpint2args3() { final XQuery query = new XQuery( "xs:positiveInteger(\"999999999999999999\") lt xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanpint2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:positiveInteger(lower bound) * $arg2 = xs:positiveInteger(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanpint2args4() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") lt xs:positiveInteger(\"52704602390610033\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanpint2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:positiveInteger(lower bound) * $arg2 = xs:positiveInteger(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanpint2args5() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") lt xs:positiveInteger(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanpint2args-6 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:positiveInteger(lower bound) * $arg2 = xs:positiveInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanpint2args6() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") ge xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanpint2args-7 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:positiveInteger(mid range) * $arg2 = xs:positiveInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanpint2args7() { final XQuery query = new XQuery( "xs:positiveInteger(\"52704602390610033\") ge xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanpint2args-8 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:positiveInteger(upper bound) * $arg2 = xs:positiveInteger(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanpint2args8() { final XQuery query = new XQuery( "xs:positiveInteger(\"999999999999999999\") ge xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanpint2args-9 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:positiveInteger(lower bound) * $arg2 = xs:positiveInteger(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanpint2args9() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") ge xs:positiveInteger(\"52704602390610033\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thansht2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:short(lower bound) * $arg2 = xs:short(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThansht2args1() { final XQuery query = new XQuery( "xs:short(\"-32768\") lt xs:short(\"-32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thansht2args-10 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:short(lower bound) * $arg2 = xs:short(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThansht2args10() { final XQuery query = new XQuery( "xs:short(\"-32768\") ge xs:short(\"32767\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thansht2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:short(mid range) * $arg2 = xs:short(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThansht2args2() { final XQuery query = new XQuery( "xs:short(\"-5324\") lt xs:short(\"-32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thansht2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:short(upper bound) * $arg2 = xs:short(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThansht2args3() { final XQuery query = new XQuery( "xs:short(\"32767\") lt xs:short(\"-32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thansht2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:short(lower bound) * $arg2 = xs:short(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThansht2args4() { final XQuery query = new XQuery( "xs:short(\"-32768\") lt xs:short(\"-5324\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thansht2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:short(lower bound) * $arg2 = xs:short(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThansht2args5() { final XQuery query = new XQuery( "xs:short(\"-32768\") lt xs:short(\"32767\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thansht2args-6 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:short(lower bound) * $arg2 = xs:short(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThansht2args6() { final XQuery query = new XQuery( "xs:short(\"-32768\") ge xs:short(\"-32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thansht2args-7 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:short(mid range) * $arg2 = xs:short(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThansht2args7() { final XQuery query = new XQuery( "xs:short(\"-5324\") ge xs:short(\"-32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thansht2args-8 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:short(upper bound) * $arg2 = xs:short(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThansht2args8() { final XQuery query = new XQuery( "xs:short(\"32767\") ge xs:short(\"-32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thansht2args-9 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:short(lower bound) * $arg2 = xs:short(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThansht2args9() { final XQuery query = new XQuery( "xs:short(\"-32768\") ge xs:short(\"-5324\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanulng2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedLong(lower bound) * $arg2 = xs:unsignedLong(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanulng2args1() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") lt xs:unsignedLong(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanulng2args-10 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedLong(lower bound) * $arg2 = xs:unsignedLong(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanulng2args10() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") ge xs:unsignedLong(\"184467440737095516\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanulng2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedLong(mid range) * $arg2 = xs:unsignedLong(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanulng2args2() { final XQuery query = new XQuery( "xs:unsignedLong(\"130747108607674654\") lt xs:unsignedLong(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanulng2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedLong(upper bound) * $arg2 = xs:unsignedLong(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanulng2args3() { final XQuery query = new XQuery( "xs:unsignedLong(\"184467440737095516\") lt xs:unsignedLong(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanulng2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedLong(lower bound) * $arg2 = xs:unsignedLong(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanulng2args4() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") lt xs:unsignedLong(\"130747108607674654\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanulng2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedLong(lower bound) * $arg2 = xs:unsignedLong(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanulng2args5() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") lt xs:unsignedLong(\"184467440737095516\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanulng2args-6 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedLong(lower bound) * $arg2 = xs:unsignedLong(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanulng2args6() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") ge xs:unsignedLong(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanulng2args-7 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedLong(mid range) * $arg2 = xs:unsignedLong(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanulng2args7() { final XQuery query = new XQuery( "xs:unsignedLong(\"130747108607674654\") ge xs:unsignedLong(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanulng2args-8 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedLong(upper bound) * $arg2 = xs:unsignedLong(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanulng2args8() { final XQuery query = new XQuery( "xs:unsignedLong(\"184467440737095516\") ge xs:unsignedLong(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanulng2args-9 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedLong(lower bound) * $arg2 = xs:unsignedLong(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanulng2args9() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") ge xs:unsignedLong(\"130747108607674654\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanusht2args-1 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedShort(lower bound) * $arg2 = xs:unsignedShort(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanusht2args1() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") lt xs:unsignedShort(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanusht2args-10 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedShort(lower bound) * $arg2 = xs:unsignedShort(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanusht2args10() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") ge xs:unsignedShort(\"65535\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanusht2args-2 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedShort(mid range) * $arg2 = xs:unsignedShort(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanusht2args2() { final XQuery query = new XQuery( "xs:unsignedShort(\"44633\") lt xs:unsignedShort(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanusht2args-3 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedShort(upper bound) * $arg2 = xs:unsignedShort(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanusht2args3() { final XQuery query = new XQuery( "xs:unsignedShort(\"65535\") lt xs:unsignedShort(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-numeric-less-thanusht2args-4 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedShort(lower bound) * $arg2 = xs:unsignedShort(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanusht2args4() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") lt xs:unsignedShort(\"44633\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanusht2args-5 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedShort(lower bound) * $arg2 = xs:unsignedShort(upper bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanusht2args5() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") lt xs:unsignedShort(\"65535\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanusht2args-6 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedShort(lower bound) * $arg2 = xs:unsignedShort(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanusht2args6() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") ge xs:unsignedShort(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanusht2args-7 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedShort(mid range) * $arg2 = xs:unsignedShort(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanusht2args7() { final XQuery query = new XQuery( "xs:unsignedShort(\"44633\") ge xs:unsignedShort(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanusht2args-8 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedShort(upper bound) * $arg2 = xs:unsignedShort(lower bound) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanusht2args8() { final XQuery query = new XQuery( "xs:unsignedShort(\"65535\") ge xs:unsignedShort(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-numeric-less-thanusht2args-9 * Written By: Carmelo Montanez * Date: Thu Dec 16 10:48:16 GMT-05:00 2004 * Purpose: Evaluates The "op:numeric-less-than" operator * with the arguments set as follows: * $arg1 = xs:unsignedShort(lower bound) * $arg2 = xs:unsignedShort(mid range) * ******************************************************* * . */ @org.junit.Test public void opNumericLessThanusht2args9() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") ge xs:unsignedShort(\"44633\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpNumericMod.java000066400000000000000000001573261222453003200273410ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the numeric-mod() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpNumericMod extends QT3TestSet { /** * A test whose essence is: `(xs:decimal(6) mod xs:integer(2)) instance of xs:decimal`. . */ @org.junit.Test public void kNumericMod1() { final XQuery query = new XQuery( "(xs:decimal(6) mod xs:integer(2)) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:decimal(6) mod xs:double(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericMod10() { final XQuery query = new XQuery( "(xs:decimal(6) mod xs:double(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:double(6) mod xs:decimal(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericMod11() { final XQuery query = new XQuery( "(xs:double(6) mod xs:decimal(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:double(6) mod xs:float(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericMod12() { final XQuery query = new XQuery( "(xs:double(6) mod xs:float(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:float(6) mod xs:double(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericMod13() { final XQuery query = new XQuery( "(xs:float(6) mod xs:double(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:double(6) mod xs:integer(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericMod14() { final XQuery query = new XQuery( "(xs:double(6) mod xs:integer(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:integer(6) mod xs:double(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericMod15() { final XQuery query = new XQuery( "(xs:integer(6) mod xs:double(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:double(6) mod xs:double(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericMod16() { final XQuery query = new XQuery( "(xs:double(6) mod xs:double(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `10 mod 3 eq 1`. . */ @org.junit.Test public void kNumericMod17() { final XQuery query = new XQuery( "10 mod 3 eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `6 mod -2 eq 0`. . */ @org.junit.Test public void kNumericMod18() { final XQuery query = new XQuery( "6 mod -2 eq 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `4.5 mod 1.2 eq 0.9`. . */ @org.junit.Test public void kNumericMod19() { final XQuery query = new XQuery( "4.5 mod 1.2 eq 0.9", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:integer(6) mod xs:decimal(2)) instance of xs:decimal`. . */ @org.junit.Test public void kNumericMod2() { final XQuery query = new XQuery( "(xs:integer(6) mod xs:decimal(2)) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `1.23E2 mod 0.6E1 eq 3.0E0`. . */ @org.junit.Test public void kNumericMod20() { final XQuery query = new XQuery( "1.23E2 mod 0.6E1 eq 3.0E0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invalid whitespace for the 'mod' operator. . */ @org.junit.Test public void kNumericMod21() { final XQuery query = new XQuery( "10 mod3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Invalid whitespace for the 'mod' operator. . */ @org.junit.Test public void kNumericMod22() { final XQuery query = new XQuery( "10mod 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Invalid whitespace for the 'mod' operator. . */ @org.junit.Test public void kNumericMod23() { final XQuery query = new XQuery( "10mod3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Invoke the 'mod operator with invalid operands. . */ @org.junit.Test public void kNumericMod24() { final XQuery query = new XQuery( "\"3\" mod \"3\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Invoke the 'mod operator with invalid operands. . */ @org.junit.Test public void kNumericMod25() { final XQuery query = new XQuery( "\"3\" mod 1.1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A test whose essence is: `(xs:untypedAtomic("5") mod xs:double(3)) eq 2`. . */ @org.junit.Test public void kNumericMod26() { final XQuery query = new XQuery( "(xs:untypedAtomic(\"5\") mod xs:double(3)) eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:decimal(5) mod xs:untypedAtomic("3")) eq 2`. . */ @org.junit.Test public void kNumericMod27() { final XQuery query = new XQuery( "(xs:decimal(5) mod xs:untypedAtomic(\"3\")) eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Operand(s) which are the empty sequence. . */ @org.junit.Test public void kNumericMod28() { final XQuery query = new XQuery( "empty(() mod ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Operand(s) which are the empty sequence. . */ @org.junit.Test public void kNumericMod29() { final XQuery query = new XQuery( "empty(xs:float(3) mod ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * A test whose essence is: `(xs:integer(6) mod xs:integer(2)) instance of xs:integer`. . */ @org.junit.Test public void kNumericMod3() { final XQuery query = new XQuery( "(xs:integer(6) mod xs:integer(2)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:decimal(6) mod xs:decimal(2)) instance of xs:decimal`. . */ @org.junit.Test public void kNumericMod4() { final XQuery query = new XQuery( "(xs:decimal(6) mod xs:decimal(2)) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:decimal(6) mod xs:float(2)) instance of xs:float`. . */ @org.junit.Test public void kNumericMod5() { final XQuery query = new XQuery( "(xs:decimal(6) mod xs:float(2)) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:float(6) mod xs:decimal(2)) instance of xs:float`. . */ @org.junit.Test public void kNumericMod6() { final XQuery query = new XQuery( "(xs:float(6) mod xs:decimal(2)) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:float(6) mod xs:integer(2)) instance of xs:float`. . */ @org.junit.Test public void kNumericMod7() { final XQuery query = new XQuery( "(xs:float(6) mod xs:integer(2)) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:integer(6) mod xs:float(2)) instance of xs:float`. . */ @org.junit.Test public void kNumericMod8() { final XQuery query = new XQuery( "(xs:integer(6) mod xs:float(2)) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:float(6) mod xs:float(2)) instance of xs:float`. . */ @org.junit.Test public void kNumericMod9() { final XQuery query = new XQuery( "(xs:float(6) mod xs:float(2)) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Divisor is small negative xs:integer. . */ @org.junit.Test public void k2NumericMod1() { final XQuery query = new XQuery( "-1 mod -1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Right op is xs:float/NaN. . */ @org.junit.Test public void k2NumericMod10() { final XQuery query = new XQuery( "3 mod xs:float(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Both ops are xs:float/NaN. . */ @org.junit.Test public void k2NumericMod11() { final XQuery query = new XQuery( "xs:float(\"NaN\") mod xs:float(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Left op is xs:double/NaN. . */ @org.junit.Test public void k2NumericMod12() { final XQuery query = new XQuery( "xs:double(\"NaN\") mod 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Right op is xs:double/NaN. . */ @org.junit.Test public void k2NumericMod13() { final XQuery query = new XQuery( "3 mod xs:double(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Both ops are xs:double/NaN. . */ @org.junit.Test public void k2NumericMod14() { final XQuery query = new XQuery( "xs:double(\"NaN\") mod xs:double(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Left op is xs:double/positive INF. . */ @org.junit.Test public void k2NumericMod15() { final XQuery query = new XQuery( "xs:double(\"INF\") mod 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Right op is xs:double/positive INF. . */ @org.junit.Test public void k2NumericMod16() { final XQuery query = new XQuery( "3 mod xs:double(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Both ops are xs:double/positive INF. . */ @org.junit.Test public void k2NumericMod17() { final XQuery query = new XQuery( "xs:double(\"INF\") mod xs:double(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Left op is xs:double/-INF. . */ @org.junit.Test public void k2NumericMod18() { final XQuery query = new XQuery( "xs:double(\"-INF\") mod 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Right op is xs:double/-INF. . */ @org.junit.Test public void k2NumericMod19() { final XQuery query = new XQuery( "3 mod xs:double(\"-INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Divisor is small negative xs:decimal. . */ @org.junit.Test public void k2NumericMod2() { final XQuery query = new XQuery( "-1.0 mod -1.0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Both ops are xs:double/-INF. . */ @org.junit.Test public void k2NumericMod20() { final XQuery query = new XQuery( "xs:double(\"-INF\") mod xs:double(\"-INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Left op is xs:double/positive 0. . */ @org.junit.Test public void k2NumericMod21() { final XQuery query = new XQuery( "xs:double(\"0\") mod 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Right op is xs:double/positive 0. . */ @org.junit.Test public void k2NumericMod22() { final XQuery query = new XQuery( "3 mod xs:double(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Both ops are xs:double/positive 0. . */ @org.junit.Test public void k2NumericMod23() { final XQuery query = new XQuery( "xs:double(\"0\") mod xs:double(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Left op is xs:double/-0. . */ @org.junit.Test public void k2NumericMod24() { final XQuery query = new XQuery( "xs:double(\"-0\") mod 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Right op is xs:double/-0. . */ @org.junit.Test public void k2NumericMod25() { final XQuery query = new XQuery( "3 mod xs:double(\"-0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Both ops are xs:double/-0. . */ @org.junit.Test public void k2NumericMod26() { final XQuery query = new XQuery( "xs:double(\"-0\") mod xs:double(\"-0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Left op is xs:float/positive INF. . */ @org.junit.Test public void k2NumericMod27() { final XQuery query = new XQuery( "xs:float(\"INF\") mod 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Right op is xs:float/positive INF. . */ @org.junit.Test public void k2NumericMod28() { final XQuery query = new XQuery( "3 mod xs:float(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Both ops are xs:float/positive INF. . */ @org.junit.Test public void k2NumericMod29() { final XQuery query = new XQuery( "xs:float(\"INF\") mod xs:float(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Divisor is small negative xs:double. . */ @org.junit.Test public void k2NumericMod3() { final XQuery query = new XQuery( "-1.0e0 mod -1.0e0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Left op is xs:float/-INF. . */ @org.junit.Test public void k2NumericMod30() { final XQuery query = new XQuery( "xs:float(\"-INF\") mod 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Right op is xs:float/-INF. . */ @org.junit.Test public void k2NumericMod31() { final XQuery query = new XQuery( "3 mod xs:float(\"-INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Both ops are xs:float/-INF. . */ @org.junit.Test public void k2NumericMod32() { final XQuery query = new XQuery( "xs:float(\"-INF\") mod xs:float(\"-INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Left op is xs:float/positive 0. . */ @org.junit.Test public void k2NumericMod33() { final XQuery query = new XQuery( "xs:float(\"0\") mod 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Right op is xs:float/positive 0. . */ @org.junit.Test public void k2NumericMod34() { final XQuery query = new XQuery( "3 mod xs:float(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Both ops are xs:float/positive 0. . */ @org.junit.Test public void k2NumericMod35() { final XQuery query = new XQuery( "xs:float(\"0\") mod xs:float(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Left op is xs:float/-0. . */ @org.junit.Test public void k2NumericMod36() { final XQuery query = new XQuery( "xs:float(\"-0\") mod 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Right op is xs:float/-0. . */ @org.junit.Test public void k2NumericMod37() { final XQuery query = new XQuery( "3 mod xs:float(\"-0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Both ops are xs:float/-0. . */ @org.junit.Test public void k2NumericMod38() { final XQuery query = new XQuery( "xs:float(\"-0\") mod xs:float(\"-0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Left op is xs:float/-0. . */ @org.junit.Test public void k2NumericMod39() { final XQuery query = new XQuery( "xs:float(\"-0\") mod xs:float(\"4\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Divisor is small negative xs:float. . */ @org.junit.Test public void k2NumericMod4() { final XQuery query = new XQuery( "-1.0e0 mod xs:float(-1.0e0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Left op is xs:float/0. . */ @org.junit.Test public void k2NumericMod40() { final XQuery query = new XQuery( "xs:float(\"0\") mod xs:float(\"4\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Left op is xs:double/-0. . */ @org.junit.Test public void k2NumericMod41() { final XQuery query = new XQuery( "xs:double(\"-0\") mod xs:double(\"4\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Left op is xs:double/0. . */ @org.junit.Test public void k2NumericMod42() { final XQuery query = new XQuery( "xs:double(\"0\") mod xs:double(\"4\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Left op is xs:float/-0 with INF as divisor. . */ @org.junit.Test public void k2NumericMod43() { final XQuery query = new XQuery( "xs:float(\"-0\") mod xs:float(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Left op is xs:float/0 with INF as divisor. . */ @org.junit.Test public void k2NumericMod44() { final XQuery query = new XQuery( "xs:float(\"0\") mod xs:float(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Left op is xs:double/-0 with INF as divisor. . */ @org.junit.Test public void k2NumericMod45() { final XQuery query = new XQuery( "xs:double(\"-0\") mod xs:double(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Left op is xs:double/0 with INF as divisor. . */ @org.junit.Test public void k2NumericMod46() { final XQuery query = new XQuery( "xs:double(\"0\") mod xs:double(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Left op is xs:float/-0 with -INF as divisor. . */ @org.junit.Test public void k2NumericMod47() { final XQuery query = new XQuery( "xs:float(\"-0\") mod xs:float(\"-INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Left op is xs:float/0 with -INF as divisor. . */ @org.junit.Test public void k2NumericMod48() { final XQuery query = new XQuery( "xs:float(\"0\") mod xs:float(\"-INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Left op is xs:double/-0 with -INF as divisor. . */ @org.junit.Test public void k2NumericMod49() { final XQuery query = new XQuery( "xs:double(\"-0\") mod xs:double(\"-INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Divisor is large negative xs:integer. . */ @org.junit.Test public void k2NumericMod5() { final XQuery query = new XQuery( "-1 mod -9223372036854775808", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-1") || error("FOAR0002") ) ); } /** * Left op is xs:double/0 with -INF as divisor. . */ @org.junit.Test public void k2NumericMod50() { final XQuery query = new XQuery( "xs:double(\"0\") mod xs:double(\"-INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Trival mod with xs:double. . */ @org.junit.Test public void k2NumericMod51() { final XQuery query = new XQuery( "xs:double(\"10000000\") mod xs:double(\"10000000\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Trival mod with xs:double(#2). . */ @org.junit.Test public void k2NumericMod52() { final XQuery query = new XQuery( "xs:double(\"-10000000\") mod xs:double(\"-10000000\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Trival mod with xs:double(#3). . */ @org.junit.Test public void k2NumericMod53() { final XQuery query = new XQuery( "xs:double(\"10000000\") mod xs:double(\"-10000000\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Trival mod with xs:double(#4). . */ @org.junit.Test public void k2NumericMod54() { final XQuery query = new XQuery( "xs:double(\"-10000000\") mod xs:double(\"10000000\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Trival mod with xs:float. . */ @org.junit.Test public void k2NumericMod55() { final XQuery query = new XQuery( "xs:float(\"10000000\") mod xs:float(\"10000000\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Trival mod with xs:float(#2). . */ @org.junit.Test public void k2NumericMod56() { final XQuery query = new XQuery( "xs:float(\"-10000000\") mod xs:float(\"-10000000\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Trival mod with xs:float(#3). . */ @org.junit.Test public void k2NumericMod57() { final XQuery query = new XQuery( "xs:float(\"10000000\") mod xs:float(\"-10000000\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Trival mod with xs:float(#4). . */ @org.junit.Test public void k2NumericMod58() { final XQuery query = new XQuery( "xs:float(\"-10000000\") mod xs:float(\"10000000\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Divide xs:integer by 0. . */ @org.junit.Test public void k2NumericMod59() { final XQuery query = new XQuery( "3 mod 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * Divisor is large negative xs:decimal. . */ @org.junit.Test public void k2NumericMod6() { final XQuery query = new XQuery( "-1.0 mod -9223372036854775808.0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Divide an xs:decimal by 0. . */ @org.junit.Test public void k2NumericMod60() { final XQuery query = new XQuery( "3.0 mod 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * Divide xs:integer by 0.0. . */ @org.junit.Test public void k2NumericMod61() { final XQuery query = new XQuery( "3 mod 0.0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * Ensure the 'div' keyword is parsed correctly. . */ @org.junit.Test public void k2NumericMod62() { final XQuery query = new XQuery( "empty(/(mod mod mod))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Divisor is large negative xs:double. . */ @org.junit.Test public void k2NumericMod7() { final XQuery query = new XQuery( "-1.0e0 mod xs:double(-9223372036854775808)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-1") || error("FOAR0002") ) ); } /** * Divisor is large negative xs:float. . */ @org.junit.Test public void k2NumericMod8() { final XQuery query = new XQuery( "xs:float(-1.0e0) mod xs:float(-9223372036854775808)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-1") || error("FOAR0002") ) ); } /** * Left op is xs:float/NaN. . */ @org.junit.Test public void k2NumericMod9() { final XQuery query = new XQuery( "xs:float(\"NaN\") mod 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * ensure that taking the modulo xs:integers returns an xs:integer . */ @org.junit.Test public void cbclNumericMod001() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:integer($x as xs:decimal) { if ($x mod 1 eq 0) then xs:integer($x) else $x }; \n" + " \t(local:integer(3) mod local:integer(2)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ensure that taking the modulo xs:integers returns an xs:integer . */ @org.junit.Test public void cbclNumericMod002() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:integer($x as xs:decimal) { if ($x mod 1 eq 0) then xs:integer($x) else $x }; \n" + " \t(local:integer(3.5) mod local:integer(2)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test numeric mod with a potential type check error . */ @org.junit.Test public void cbclNumericMod003() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:value($number as xs:boolean) { if ($number) then 1 else xs:string('1') }; \n" + " \tlocal:value(true()) mod local:value(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "0") || error("XPTY0004") ) ); } /** * Check dynamic type of numeric mod on arguments of union of numeric types and untypedAtomic. . */ @org.junit.Test public void opNumericMod1() { final XQuery query = new XQuery( "for $x in (1, xs:decimal(2), xs:float(3), xs:double(4), xs:untypedAtomic(5)) for $y in (1, xs:decimal(2), xs:float(3), xs:double(4), xs:untypedAtomic(5)) return typeswitch ($x mod $y) case xs:integer return \"integer\" case xs:decimal return \"decimal\" case xs:float return \"float\" case xs:double return \"double\" default return error()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "integer decimal float double double decimal decimal float double double float float float double double double double double double double double double double double double") ); } /** * Evaluates The "op:numeric-mod" operator with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(upper bound) . */ @org.junit.Test public void opNumericModdbl2args1() { final XQuery query = new XQuery( "xs:double(\"-1.7976931348623157E308\") mod xs:double(\"1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Evaluates The "op:numeric-mod" operator with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(mid range) . */ @org.junit.Test public void opNumericModdec2args1() { final XQuery query = new XQuery( "xs:decimal(\"-999999999999999999\") mod xs:decimal(\"617375191608514839\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-382624808391485160") ); } /** * Evaluates The "op:numeric-mod" operator with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(upper bound) . */ @org.junit.Test public void opNumericModdec2args2() { final XQuery query = new XQuery( "xs:decimal(\"-999999999999999999\") mod xs:decimal(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-mod" operator with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(upper bound) . */ @org.junit.Test public void opNumericModflt2args1() { final XQuery query = new XQuery( "xs:float(\"-3.4028235E38\") mod xs:float(\"3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Evaluates The "op:numeric-mod" operator with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(upper bound) . */ @org.junit.Test public void opNumericModint2args1() { final XQuery query = new XQuery( "xs:int(\"-2147483648\") mod xs:int(\"2147483647\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "op:numeric-mod" operator with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(mid range) . */ @org.junit.Test public void opNumericModintg2args1() { final XQuery query = new XQuery( "xs:integer(\"-999999999999999999\") mod xs:integer(\"830993497117024304\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-169006502882975695") ); } /** * Evaluates The "op:numeric-mod" operator with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(upper bound) . */ @org.junit.Test public void opNumericModintg2args2() { final XQuery query = new XQuery( "xs:integer(\"-999999999999999999\") mod xs:integer(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-mod" operator with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(upper bound) . */ @org.junit.Test public void opNumericModlng2args1() { final XQuery query = new XQuery( "xs:long(\"-92233720368547758\") mod xs:long(\"92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Simple mod test with () as one operand should return null . */ @org.junit.Test public void opNumericModmix2args1() { final XQuery query = new XQuery( "() mod 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEmpty() || error("XPST0005") ) ); } /** * Simple mod test pass string for second operator . */ @org.junit.Test public void opNumericModmix2args2() { final XQuery query = new XQuery( "1 mod '1'", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Simple mod test, second operator cast string to integer . */ @org.junit.Test public void opNumericModmix2args3() { final XQuery query = new XQuery( "1 mod xs:integer('1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Simple mod test, second operator is a node, atomization applied . */ @org.junit.Test public void opNumericModmix2args4() { final XQuery query = new XQuery( "1 mod 2 ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Simple mod test, second operator is a node, atomization applied . */ @org.junit.Test public void opNumericModmix2args5() { final XQuery query = new XQuery( "1 mod 2 ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Simple mod test, second operator node which is not atomizable . */ @org.junit.Test public void opNumericModmix2args6() { final XQuery query = new XQuery( "1 mod 2 2 ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Simple mod test, two operands are nodes . */ @org.junit.Test public void opNumericModmix2args7() { final XQuery query = new XQuery( " 1 mod 2 ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Simple mod test, second operator is a node, atomizable but not castable to integer . */ @org.junit.Test public void opNumericModmix2args8() { final XQuery query = new XQuery( "1 mod x ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Simple mod test pass an empty node for second operator . */ @org.junit.Test public void opNumericModmix2args9() { final XQuery query = new XQuery( "1 mod ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Evaluates The "op:numeric-mod" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void opNumericModnni2args1() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") mod xs:nonNegativeInteger(\"303884545991464527\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-mod" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void opNumericModnni2args2() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") mod xs:nonNegativeInteger(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-mod" operator with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void opNumericModpint2args1() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") mod xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-mod" operator with the arguments set as follows: $arg1 = xs:positiveInteger(mid range) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void opNumericModpint2args2() { final XQuery query = new XQuery( "xs:positiveInteger(\"52704602390610033\") mod xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-mod" operator with the arguments set as follows: $arg1 = xs:positiveInteger(upper bound) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void opNumericModpint2args3() { final XQuery query = new XQuery( "xs:positiveInteger(\"999999999999999999\") mod xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-mod" operator with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(mid range) . */ @org.junit.Test public void opNumericModpint2args4() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") mod xs:positiveInteger(\"52704602390610033\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "op:numeric-mod" operator with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(upper bound) . */ @org.junit.Test public void opNumericModpint2args5() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") mod xs:positiveInteger(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "op:numeric-mod" operator with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(upper bound) . */ @org.junit.Test public void opNumericModsht2args1() { final XQuery query = new XQuery( "xs:short(\"-32768\") mod xs:short(\"32767\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "op:numeric-mod" operator with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(mid range) . */ @org.junit.Test public void opNumericModulng2args1() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") mod xs:unsignedLong(\"130747108607674654\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-mod" operator with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(upper bound) . */ @org.junit.Test public void opNumericModulng2args2() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") mod xs:unsignedLong(\"184467440737095516\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-mod" operator with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(mid range) . */ @org.junit.Test public void opNumericModusht2args1() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") mod xs:unsignedShort(\"44633\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-mod" operator with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(upper bound) . */ @org.junit.Test public void opNumericModusht2args2() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") mod xs:unsignedShort(\"65535\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpNumericMultiply.java000066400000000000000000001564711222453003200304410ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the numeric-multiply() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpNumericMultiply extends QT3TestSet { /** * A test whose essence is: `xs:double(6) * xs:double(2) eq 12`. . */ @org.junit.Test public void kNumericMultiply1() { final XQuery query = new XQuery( "xs:double(6) * xs:double(2) eq 12", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:float(6) * xs:decimal(2)) instance of xs:float`. . */ @org.junit.Test public void kNumericMultiply10() { final XQuery query = new XQuery( "(xs:float(6) * xs:decimal(2)) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:float(6) * xs:integer(2)) instance of xs:float`. . */ @org.junit.Test public void kNumericMultiply11() { final XQuery query = new XQuery( "(xs:float(6) * xs:integer(2)) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:integer(6) * xs:float(2)) instance of xs:float`. . */ @org.junit.Test public void kNumericMultiply12() { final XQuery query = new XQuery( "(xs:integer(6) * xs:float(2)) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:float(6) * xs:float(2)) instance of xs:float`. . */ @org.junit.Test public void kNumericMultiply13() { final XQuery query = new XQuery( "(xs:float(6) * xs:float(2)) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:decimal(6) * xs:double(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericMultiply14() { final XQuery query = new XQuery( "(xs:decimal(6) * xs:double(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:double(6) * xs:decimal(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericMultiply15() { final XQuery query = new XQuery( "(xs:double(6) * xs:decimal(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:double(6) * xs:float(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericMultiply16() { final XQuery query = new XQuery( "(xs:double(6) * xs:float(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:float(6) * xs:double(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericMultiply17() { final XQuery query = new XQuery( "(xs:float(6) * xs:double(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:double(6) * xs:integer(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericMultiply18() { final XQuery query = new XQuery( "(xs:double(6) * xs:integer(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:integer(6) * xs:double(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericMultiply19() { final XQuery query = new XQuery( "(xs:integer(6) * xs:double(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:decimal(6) * xs:decimal(2) eq 12`. . */ @org.junit.Test public void kNumericMultiply2() { final XQuery query = new XQuery( "xs:decimal(6) * xs:decimal(2) eq 12", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:double(6) * xs:double(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericMultiply20() { final XQuery query = new XQuery( "(xs:double(6) * xs:double(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(xs:float("NaN") * 3) eq "NaN"`. . */ @org.junit.Test public void kNumericMultiply21() { final XQuery query = new XQuery( "string(xs:float(\"NaN\") * 3) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(xs:double("NaN") * 3) eq "NaN"`. . */ @org.junit.Test public void kNumericMultiply22() { final XQuery query = new XQuery( "string(xs:double(\"NaN\") * 3) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(3 * xs:float("NaN")) eq "NaN"`. . */ @org.junit.Test public void kNumericMultiply23() { final XQuery query = new XQuery( "string(3 * xs:float(\"NaN\")) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(3 * xs:double("NaN")) eq "NaN"`. . */ @org.junit.Test public void kNumericMultiply24() { final XQuery query = new XQuery( "string(3 * xs:double(\"NaN\")) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invalid whitespace involving multiplication operator and '/'. . */ @org.junit.Test public void kNumericMultiply25() { final XQuery query = new XQuery( "/*5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Invalid whitespace involving multiplication operator and '/'. . */ @org.junit.Test public void kNumericMultiply26() { final XQuery query = new XQuery( "/ * 5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Invalid whitespace involving multiplication operator and '/'. . */ @org.junit.Test public void kNumericMultiply27() { final XQuery query = new XQuery( "4 + / * 5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Invoke the '*' operator with invalid operands. . */ @org.junit.Test public void kNumericMultiply28() { final XQuery query = new XQuery( "\"3\" * \"3\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Invoke the '*' operator with invalid operands. . */ @org.junit.Test public void kNumericMultiply29() { final XQuery query = new XQuery( "1 * \"3\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A test whose essence is: `xs:integer(6) * xs:integer(2) eq 12`. . */ @org.junit.Test public void kNumericMultiply3() { final XQuery query = new XQuery( "xs:integer(6) * xs:integer(2) eq 12", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(3 * xs:untypedAtomic(3)) eq 9`. . */ @org.junit.Test public void kNumericMultiply30() { final XQuery query = new XQuery( "(3 * xs:untypedAtomic(3)) eq 9", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:untypedAtomic(3) * 3) eq 9`. . */ @org.junit.Test public void kNumericMultiply31() { final XQuery query = new XQuery( "(xs:untypedAtomic(3) * 3) eq 9", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Operand(s) which are the empty sequence. . */ @org.junit.Test public void kNumericMultiply32() { final XQuery query = new XQuery( "empty(() * ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Operand(s) which are the empty sequence. . */ @org.junit.Test public void kNumericMultiply33() { final XQuery query = new XQuery( "empty(() * 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * A test whose essence is: `xs:float(6) * xs:float(2) eq 12`. . */ @org.junit.Test public void kNumericMultiply4() { final XQuery query = new XQuery( "xs:float(6) * xs:float(2) eq 12", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:decimal(6) * xs:integer(2)) instance of xs:decimal`. . */ @org.junit.Test public void kNumericMultiply5() { final XQuery query = new XQuery( "(xs:decimal(6) * xs:integer(2)) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:integer(6) * xs:decimal(2)) instance of xs:decimal`. . */ @org.junit.Test public void kNumericMultiply6() { final XQuery query = new XQuery( "(xs:integer(6) * xs:decimal(2)) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:integer(6) * xs:integer(2)) instance of xs:integer`. . */ @org.junit.Test public void kNumericMultiply7() { final XQuery query = new XQuery( "(xs:integer(6) * xs:integer(2)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:decimal(6) * xs:decimal(2)) instance of xs:decimal`. . */ @org.junit.Test public void kNumericMultiply8() { final XQuery query = new XQuery( "(xs:decimal(6) * xs:decimal(2)) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:decimal(6) * xs:float(2)) instance of xs:float`. . */ @org.junit.Test public void kNumericMultiply9() { final XQuery query = new XQuery( "(xs:decimal(6) * xs:float(2)) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test multiplication by xs:double NaN . */ @org.junit.Test public void cbclNumericMultiply001() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:double) as xs:double { $arg * $arg }; \n" + " \txs:double('NaN') * local:square(7)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * test multiplication by xs:double NaN . */ @org.junit.Test public void cbclNumericMultiply002() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:double) as xs:double { $arg * $arg }; \n" + " \tlocal:square(7) * xs:double('NaN')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * test multiplication by xs:double 1 . */ @org.junit.Test public void cbclNumericMultiply003() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:double) as xs:double { $arg * $arg }; \n" + " \tlocal:square(7) * 1e0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "49") ); } /** * test multiplication by xs:double 1 . */ @org.junit.Test public void cbclNumericMultiply004() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:double) as xs:double { $arg * $arg }; \n" + " \t1e0 * local:square(7)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "49") ); } /** * test multiplication by xs:double -1 . */ @org.junit.Test public void cbclNumericMultiply005() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:double) as xs:double { $arg * $arg }; \n" + " \tlocal:square(7) * -1e0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-49") ); } /** * test multiplication by xs:double -1 . */ @org.junit.Test public void cbclNumericMultiply006() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:double) as xs:double { $arg * $arg }; \n" + " \t-1e0 * local:square(7)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-49") ); } /** * test multiplication by xs:float NaN . */ @org.junit.Test public void cbclNumericMultiply007() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:float) as xs:float { $arg * $arg }; \n" + " \txs:float('NaN') * local:square(7)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * test multiplication by xs:float NaN . */ @org.junit.Test public void cbclNumericMultiply008() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:float) as xs:float { $arg * $arg }; \n" + " \tlocal:square(7) * xs:float('NaN')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * test multiplication by xs:float 1 . */ @org.junit.Test public void cbclNumericMultiply009() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:float) as xs:float { $arg * $arg }; \n" + " \tlocal:square(7) * xs:float(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "49") ); } /** * test multiplication by xs:float 1 . */ @org.junit.Test public void cbclNumericMultiply010() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:float) as xs:float { $arg * $arg }; \n" + " \txs:float(1) * local:square(7)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "49") ); } /** * test multiplication by xs:float -1 . */ @org.junit.Test public void cbclNumericMultiply011() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:float) as xs:float { $arg * $arg }; \n" + " \tlocal:square(7) * xs:float(-1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-49") ); } /** * test multiplication by xs:float -1 . */ @org.junit.Test public void cbclNumericMultiply012() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:float) as xs:float { $arg * $arg }; \n" + " \txs:float(-1) * local:square(7)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-49") ); } /** * test multiplication by xs:decimal 0 . */ @org.junit.Test public void cbclNumericMultiply013() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:decimal) as xs:decimal { $arg * $arg }; \n" + " \tlocal:square(2.0) * 0.0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * test multiplication by xs:decimal 0 . */ @org.junit.Test public void cbclNumericMultiply014() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:decimal) as xs:decimal { $arg * $arg }; \n" + " \t0.0 * local:square(7.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * test multiplication by xs:decimal 1 . */ @org.junit.Test public void cbclNumericMultiply015() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:decimal) as xs:decimal { $arg * $arg }; \n" + " \tlocal:square(7.0) * 1.0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "49") ); } /** * test multiplication by xs:decimal 1 . */ @org.junit.Test public void cbclNumericMultiply016() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:decimal) as xs:decimal { $arg * $arg }; \n" + " \t1.0 * local:square(7.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "49") ); } /** * test multiplication by xs:decimal -1 . */ @org.junit.Test public void cbclNumericMultiply017() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:decimal) as xs:decimal { $arg * $arg }; \n" + " \tlocal:square(7.0) * -1.0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-49") ); } /** * test multiplication by xs:decimal -1 . */ @org.junit.Test public void cbclNumericMultiply018() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:decimal) as xs:decimal { $arg * $arg }; \n" + " \t-1.0 * local:square(7.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-49") ); } /** * test multiplication by xs:integer 0 . */ @org.junit.Test public void cbclNumericMultiply019() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:integer) as xs:integer { $arg * $arg }; \n" + " \tlocal:square(2) * 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * test multiplication by xs:integer 0 . */ @org.junit.Test public void cbclNumericMultiply020() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:integer) as xs:integer { $arg * $arg }; \n" + " \t0 * local:square(2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * test multiplication by xs:integer 1 . */ @org.junit.Test public void cbclNumericMultiply021() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:integer) as xs:integer { $arg * $arg }; \n" + " \tlocal:square(7) * 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "49") ); } /** * test multiplication by xs:integer 1 . */ @org.junit.Test public void cbclNumericMultiply022() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:integer) as xs:integer { $arg * $arg }; \n" + " \t1 * local:square(7)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "49") ); } /** * test multiplication by xs:integer -1 . */ @org.junit.Test public void cbclNumericMultiply023() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:integer) as xs:integer { $arg * $arg }; \n" + " \tlocal:square(7) * -1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-49") ); } /** * test multiplication by xs:integer -1 . */ @org.junit.Test public void cbclNumericMultiply024() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:integer) as xs:integer { $arg * $arg }; \n" + " \t-1 * local:square(7)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-49") ); } /** * test multiplication of large xs:decimal . */ @org.junit.Test public void cbclNumericMultiply025() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:decimal) as xs:decimal { $arg * $arg }; \n" + " \tlocal:square(9223372036854775808.1) gt 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOAR0002") ) ); } /** * test multiplication of large xs:integer . */ @org.junit.Test public void cbclNumericMultiply026() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:integer) as xs:integer { $arg * $arg }; \n" + " \tlocal:square(9223372036854775808) gt 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOAR0002") ) ); } /** * ensure that multiplying xs:integers returns an xs:integer . */ @org.junit.Test public void cbclNumericMultiply027() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:integer($x as xs:decimal) { if ($x mod 1 eq 0) then xs:integer($x) else $x }; \n" + " \t(local:integer(2) * local:integer(2)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check dynamic type of numeric multiply on arguments of union of numeric types and untypedAtomic. . */ @org.junit.Test public void opNumericMultiply1() { final XQuery query = new XQuery( "for $x in (1, xs:decimal(2), xs:float(3), xs:double(4), xs:untypedAtomic(5)) for $y in (1, xs:decimal(2), xs:float(3), xs:double(4), xs:untypedAtomic(5)) return typeswitch ($x * $y) case xs:integer return \"integer\" case xs:decimal return \"decimal\" case xs:float return \"float\" case xs:double return \"double\" default return error()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "integer decimal float double double decimal decimal float double double float float float double double double double double double double double double double double double") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void opNumericMultiplydbl2args1() { final XQuery query = new XQuery( "xs:double(\"-1.0000000000\") * xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.7976931348623157E308") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:double(mid range) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void opNumericMultiplydbl2args2() { final XQuery query = new XQuery( "xs:double(\"0\") * xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:double(upper bound) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void opNumericMultiplydbl2args3() { final XQuery query = new XQuery( "xs:double(\"1.7976931348623157E308\") * xs:double(\"-1.0000000000\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.7976931348623157E308") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(mid range) . */ @org.junit.Test public void opNumericMultiplydbl2args4() { final XQuery query = new XQuery( "xs:double(\"-1.7976931348623157E308\") * xs:double(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(upper bound) . */ @org.junit.Test public void opNumericMultiplydbl2args5() { final XQuery query = new XQuery( "xs:double(\"-1.0000000000\") * xs:double(\"1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.7976931348623157E308") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void opNumericMultiplydec2args1() { final XQuery query = new XQuery( "xs:decimal(\"-1.0000000000\") * xs:decimal(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:decimal(mid range) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void opNumericMultiplydec2args2() { final XQuery query = new XQuery( "xs:decimal(\"617375191608514839\") * xs:decimal(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:decimal(upper bound) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void opNumericMultiplydec2args3() { final XQuery query = new XQuery( "xs:decimal(\"999999999999999999\") * xs:decimal(\"-1.0000000000\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(mid range) . */ @org.junit.Test public void opNumericMultiplydec2args4() { final XQuery query = new XQuery( "xs:decimal(\"0\") * xs:decimal(\"617375191608514839\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(upper bound) . */ @org.junit.Test public void opNumericMultiplydec2args5() { final XQuery query = new XQuery( "xs:decimal(\"-1.0000000000\") * xs:decimal(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void opNumericMultiplyflt2args1() { final XQuery query = new XQuery( "xs:float(\"-1.0000000000\") * xs:float(\"-3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(3.4028235E38)") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:float(mid range) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void opNumericMultiplyflt2args2() { final XQuery query = new XQuery( "xs:float(\"0\") * xs:float(\"-3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:float(upper bound) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void opNumericMultiplyflt2args3() { final XQuery query = new XQuery( "xs:float(\"3.4028235E38\") * xs:float(\"-1.0000000000\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(-3.4028235E38)") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(mid range) . */ @org.junit.Test public void opNumericMultiplyflt2args4() { final XQuery query = new XQuery( "xs:float(\"-3.4028235E38\") * xs:float(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(upper bound) . */ @org.junit.Test public void opNumericMultiplyflt2args5() { final XQuery query = new XQuery( "xs:float(\"-1.0000000000\") * xs:float(\"3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(-3.4028235E38)") ); } /** * Simple multiplication test with () as one operand should return null . */ @org.junit.Test public void opNumericMultiplymix2args1() { final XQuery query = new XQuery( "1 * ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEmpty() || error("XPST0005") ) ); } /** * Simple multiplication test pass string for second operator . */ @org.junit.Test public void opNumericMultiplymix2args2() { final XQuery query = new XQuery( "1 * '1'", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Simple multiplication test, second operator cast string to integer . */ @org.junit.Test public void opNumericMultiplymix2args3() { final XQuery query = new XQuery( "1 * xs:integer('1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Simple multiplication test, second operator is a node, atomization applied . */ @org.junit.Test public void opNumericMultiplymix2args4() { final XQuery query = new XQuery( "1 * 2 ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Simple multiplication test, second operator is a node, atomization applied . */ @org.junit.Test public void opNumericMultiplymix2args5() { final XQuery query = new XQuery( "1 * 2 ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Simple multiplication test, second operator node which is not atomizable . */ @org.junit.Test public void opNumericMultiplymix2args6() { final XQuery query = new XQuery( "1 * 2 2 ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Simple multiplication test, two operands are nodes . */ @org.junit.Test public void opNumericMultiplymix2args7() { final XQuery query = new XQuery( " 1 * 2 ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Simple multiplication test, second operator is a node, atomizable but not castable to integer . */ @org.junit.Test public void opNumericMultiplymix2args8() { final XQuery query = new XQuery( "1 * x ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Simple multiplication test, pass an empty node for second operator . */ @org.junit.Test public void opNumericMultiplymix2args9() { final XQuery query = new XQuery( "1 * ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void opNumericMultiplynni2args1() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") * xs:nonNegativeInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(mid range) $arg2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void opNumericMultiplynni2args2() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"303884545991464527\") * xs:nonNegativeInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(upper bound) $arg2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void opNumericMultiplynni2args3() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"999999999999999999\") * xs:nonNegativeInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void opNumericMultiplynni2args4() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") * xs:nonNegativeInteger(\"303884545991464527\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void opNumericMultiplynni2args5() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") * xs:nonNegativeInteger(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(upper bound) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void opNumericMultiplynpi2args1() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"0\") * xs:nonPositiveInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void opNumericMultiplynpi2args2() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-999999999999999999\") * xs:nonPositiveInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void opNumericMultiplypint2args1() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") * xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:positiveInteger(mid range) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void opNumericMultiplypint2args2() { final XQuery query = new XQuery( "xs:positiveInteger(\"52704602390610033\") * xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("52704602390610033") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:positiveInteger(upper bound) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void opNumericMultiplypint2args3() { final XQuery query = new XQuery( "xs:positiveInteger(\"999999999999999999\") * xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(mid range) . */ @org.junit.Test public void opNumericMultiplypint2args4() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") * xs:positiveInteger(\"52704602390610033\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("52704602390610033") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(upper bound) . */ @org.junit.Test public void opNumericMultiplypint2args5() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") * xs:positiveInteger(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void opNumericMultiplyulng2args1() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") * xs:unsignedLong(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:unsignedLong(mid range) $arg2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void opNumericMultiplyulng2args2() { final XQuery query = new XQuery( "xs:unsignedLong(\"130747108607674654\") * xs:unsignedLong(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:unsignedLong(upper bound) $arg2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void opNumericMultiplyulng2args3() { final XQuery query = new XQuery( "xs:unsignedLong(\"184467440737095516\") * xs:unsignedLong(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(mid range) . */ @org.junit.Test public void opNumericMultiplyulng2args4() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") * xs:unsignedLong(\"130747108607674654\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(upper bound) . */ @org.junit.Test public void opNumericMultiplyulng2args5() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") * xs:unsignedLong(\"184467440737095516\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void opNumericMultiplyusht2args1() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") * xs:unsignedShort(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:unsignedShort(mid range) $arg2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void opNumericMultiplyusht2args2() { final XQuery query = new XQuery( "xs:unsignedShort(\"44633\") * xs:unsignedShort(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:unsignedShort(upper bound) $arg2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void opNumericMultiplyusht2args3() { final XQuery query = new XQuery( "xs:unsignedShort(\"65535\") * xs:unsignedShort(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(mid range) . */ @org.junit.Test public void opNumericMultiplyusht2args4() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") * xs:unsignedShort(\"44633\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-multiply" operator with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(upper bound) . */ @org.junit.Test public void opNumericMultiplyusht2args5() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") * xs:unsignedShort(\"65535\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpNumericSubtract.java000066400000000000000000001742051222453003200304040ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the numeric-subtract() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpNumericSubtract extends QT3TestSet { /** * A test whose essence is: `xs:double(6) - xs:double(2) eq 4`. . */ @org.junit.Test public void kNumericSubtract1() { final XQuery query = new XQuery( "xs:double(6) - xs:double(2) eq 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:float(6) - xs:decimal(2)) instance of xs:float`. . */ @org.junit.Test public void kNumericSubtract10() { final XQuery query = new XQuery( "(xs:float(6) - xs:decimal(2)) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:float(6) - xs:integer(2)) instance of xs:float`. . */ @org.junit.Test public void kNumericSubtract11() { final XQuery query = new XQuery( "(xs:float(6) - xs:integer(2)) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:integer(6) - xs:float(2)) instance of xs:float`. . */ @org.junit.Test public void kNumericSubtract12() { final XQuery query = new XQuery( "(xs:integer(6) - xs:float(2)) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:float(6) - xs:float(2)) instance of xs:float`. . */ @org.junit.Test public void kNumericSubtract13() { final XQuery query = new XQuery( "(xs:float(6) - xs:float(2)) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:decimal(6) - xs:double(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericSubtract14() { final XQuery query = new XQuery( "(xs:decimal(6) - xs:double(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:double(6) - xs:decimal(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericSubtract15() { final XQuery query = new XQuery( "(xs:double(6) - xs:decimal(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:double(6) - xs:float(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericSubtract16() { final XQuery query = new XQuery( "(xs:double(6) - xs:float(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:float(6) - xs:double(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericSubtract17() { final XQuery query = new XQuery( "(xs:float(6) - xs:double(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:double(6) - xs:integer(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericSubtract18() { final XQuery query = new XQuery( "(xs:double(6) - xs:integer(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:integer(6) - xs:double(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericSubtract19() { final XQuery query = new XQuery( "(xs:integer(6) - xs:double(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:decimal(6) - xs:decimal(2) eq 4`. . */ @org.junit.Test public void kNumericSubtract2() { final XQuery query = new XQuery( "xs:decimal(6) - xs:decimal(2) eq 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:double(6) - xs:double(2)) instance of xs:double`. . */ @org.junit.Test public void kNumericSubtract20() { final XQuery query = new XQuery( "(xs:double(6) - xs:double(2)) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(xs:float("NaN") - 3) eq "NaN"`. . */ @org.junit.Test public void kNumericSubtract21() { final XQuery query = new XQuery( "string(xs:float(\"NaN\") - 3) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(xs:double("NaN") - 3) eq "NaN"`. . */ @org.junit.Test public void kNumericSubtract22() { final XQuery query = new XQuery( "string(xs:double(\"NaN\") - 3) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(3 - xs:float("NaN")) eq "NaN"`. . */ @org.junit.Test public void kNumericSubtract23() { final XQuery query = new XQuery( "string(3 - xs:float(\"NaN\")) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `string(3 - xs:double("NaN")) eq "NaN"`. . */ @org.junit.Test public void kNumericSubtract24() { final XQuery query = new XQuery( "string(3 - xs:double(\"NaN\")) eq \"NaN\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Invoke the '-' operator with invalid operands. . */ @org.junit.Test public void kNumericSubtract25() { final XQuery query = new XQuery( "\"3\" - \"3\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Invoke the '-' operator with invalid operands. . */ @org.junit.Test public void kNumericSubtract26() { final XQuery query = new XQuery( "xs:untypedAtomic(\"3\") - \"3\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A test whose essence is: `(xs:untypedAtomic("3") - 3) eq 0`. . */ @org.junit.Test public void kNumericSubtract27() { final XQuery query = new XQuery( "(xs:untypedAtomic(\"3\") - 3) eq 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(3 - xs:untypedAtomic("3")) eq 0`. . */ @org.junit.Test public void kNumericSubtract28() { final XQuery query = new XQuery( "(3 - xs:untypedAtomic(\"3\")) eq 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Operand(s) which are the empty sequence. . */ @org.junit.Test public void kNumericSubtract29() { final XQuery query = new XQuery( "empty(() - ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * A test whose essence is: `xs:integer(6) - xs:integer(2) eq 4`. . */ @org.junit.Test public void kNumericSubtract3() { final XQuery query = new XQuery( "xs:integer(6) - xs:integer(2) eq 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Operand(s) which are the empty sequence. . */ @org.junit.Test public void kNumericSubtract30() { final XQuery query = new XQuery( "empty(() - xs:float(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Operand(s) which are the empty sequence. . */ @org.junit.Test public void kNumericSubtract31() { final XQuery query = new XQuery( "empty(() - xs:double(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * A test whose essence is: `(xs:untypedAtomic("3") - xs:untypedAtomic("3")) eq 0`. . */ @org.junit.Test public void kNumericSubtract32() { final XQuery query = new XQuery( "(xs:untypedAtomic(\"3\") - xs:untypedAtomic(\"3\")) eq 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:untypedAtomic("3") - xs:untypedAtomic("3")) instance of xs:double`. . */ @org.junit.Test public void kNumericSubtract33() { final XQuery query = new XQuery( "(xs:untypedAtomic(\"3\") - xs:untypedAtomic(\"3\")) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:untypedAtomic("3") - 1.1) instance of xs:double`. . */ @org.junit.Test public void kNumericSubtract34() { final XQuery query = new XQuery( "(xs:untypedAtomic(\"3\") - 1.1) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(1.1 - xs:untypedAtomic("3")) instance of xs:double`. . */ @org.junit.Test public void kNumericSubtract35() { final XQuery query = new XQuery( "(1.1 - xs:untypedAtomic(\"3\")) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Substracting zero, with complex operands. Implementations supporting the static typing feature may raise XPTY0004. . */ @org.junit.Test public void kNumericSubtract36() { final XQuery query = new XQuery( "1 eq (remove((current-time(), 1), 1) - 0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * Adding zero, with complex operands. Implementations supporting the static typing feature may raise XPTY0004. . */ @org.junit.Test public void kNumericSubtract37() { final XQuery query = new XQuery( "1 eq (remove((current-time(), 1), 1) + 0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * Adding zero, with complex operands. Implementations supporting the static typing feature may raise XPTY0004. . */ @org.junit.Test public void kNumericSubtract38() { final XQuery query = new XQuery( "1 eq (0 + remove((current-time(), 1), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * A test whose essence is: `xs:float(5) - xs:float(1) eq 4`. . */ @org.junit.Test public void kNumericSubtract4() { final XQuery query = new XQuery( "xs:float(5) - xs:float(1) eq 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:decimal(6) - xs:integer(2)) instance of xs:decimal`. . */ @org.junit.Test public void kNumericSubtract5() { final XQuery query = new XQuery( "(xs:decimal(6) - xs:integer(2)) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:integer(6) - xs:decimal(2)) instance of xs:decimal`. . */ @org.junit.Test public void kNumericSubtract6() { final XQuery query = new XQuery( "(xs:integer(6) - xs:decimal(2)) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:integer(6) - xs:integer(2)) instance of xs:integer`. . */ @org.junit.Test public void kNumericSubtract7() { final XQuery query = new XQuery( "(xs:integer(6) - xs:integer(2)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:decimal(6) - xs:decimal(2)) instance of xs:decimal`. . */ @org.junit.Test public void kNumericSubtract8() { final XQuery query = new XQuery( "(xs:decimal(6) - xs:decimal(2)) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:decimal(6) - xs:float(2)) instance of xs:float`. . */ @org.junit.Test public void kNumericSubtract9() { final XQuery query = new XQuery( "(xs:decimal(6) - xs:float(2)) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Substract xs:double(0) from xs:integer(0). . */ @org.junit.Test public void k2NumericSubtract1() { final XQuery query = new XQuery( "0 - xs:double(0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Substract xs:double(0) from xs:integer(0). . */ @org.junit.Test public void k2NumericSubtract2() { final XQuery query = new XQuery( "0 - xs:float(0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * test subtraction of large xs:decimal . */ @org.junit.Test public void cbclNumericSubtract001() { final XQuery query = new XQuery( "-79228162514264337593543950335.0 - 1.0 lt 0.0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOAR0002") ) ); } /** * test subtraction of large xs:integer . */ @org.junit.Test public void cbclNumericSubtract002() { final XQuery query = new XQuery( "-79228162514264337593543950335 - 1 lt 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOAR0002") ) ); } /** * test subtraction of xs:decimal 0 . */ @org.junit.Test public void cbclNumericSubtract003() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:decimal) as xs:decimal { $arg * $arg }; \n" + " \tlocal:square(7.5) - 0.0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "56.25") ); } /** * test subtraction of xs:integer 0 . */ @org.junit.Test public void cbclNumericSubtract004() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:square($arg as xs:integer) as xs:integer { $arg * $arg }; \n" + " \tlocal:square(7) - 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "49") ); } /** * ensure that subtracting xs:integers returns an xs:integer . */ @org.junit.Test public void cbclNumericSubtract005() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:integer($x as xs:decimal) { if ($x mod 1 eq 0) then xs:integer($x) else $x }; \n" + " \t(local:integer(2) - local:integer(2)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test subtraction of negated integers . */ @org.junit.Test public void cbclNumericSubtract006() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:integer($x as xs:decimal) { if ($x mod 1 eq 0) then xs:integer($x) else $x }; \n" + " \t-(local:integer(2)) - -(local:integer(4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * test subtraction of negated integers . */ @org.junit.Test public void cbclNumericSubtract007() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:integer($x as xs:decimal) { if ($x mod 1 eq 0) then xs:integer($x) else $x }; \n" + " \tlocal:integer(2) - -(local:integer(4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "6") ); } /** * test subtraction of negated integers . */ @org.junit.Test public void cbclNumericSubtract008() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:integer($x as xs:decimal) { if ($x mod 1 eq 0) then xs:integer($x) else $x }; \n" + " \t-(local:integer(2)) - local:integer(4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-6") ); } /** * Check dynamic type of numeric subtract on arguments of union of numeric types and untypedAtomic. . */ @org.junit.Test public void opNumericSubtract1() { final XQuery query = new XQuery( "\n" + " for $x in (1, xs:decimal(2), xs:float(3), xs:double(4), xs:untypedAtomic(5)) \n" + " for $y in (1, xs:decimal(2), xs:float(3), xs:double(4), xs:untypedAtomic(5)) \n" + " return typeswitch ($x - $y) \n" + " case xs:integer return \"integer\" \n" + " case xs:decimal return \"decimal\" \n" + " case xs:float return \"float\" \n" + " case xs:double return \"double\" \n" + " default return error()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "integer decimal float double double decimal decimal float double double float float float double double double double double double double double double double double double") ); } /** * test subtraction of large xs:decimal . */ @org.junit.Test public void opNumericSubtractBig01() { final XQuery query = new XQuery( "(-79228162514264337593543950335.0 - 1.0) cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "-79228162514264337593543950336") || error("FOAR0002") ) ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void opNumericSubtractdbl2args1() { final XQuery query = new XQuery( "xs:double(\"-1.7976931348623157E308\") - xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:double(mid range) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void opNumericSubtractdbl2args2() { final XQuery query = new XQuery( "xs:double(\"0\") - xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.7976931348623157E308") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:double(upper bound) $arg2 = xs:double(lower bound) . */ @org.junit.Test public void opNumericSubtractdbl2args3() { final XQuery query = new XQuery( "xs:double(\"0\") - xs:double(\"-1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.7976931348623157E308") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(mid range) . */ @org.junit.Test public void opNumericSubtractdbl2args4() { final XQuery query = new XQuery( "xs:double(\"-1.7976931348623157E308\") - xs:double(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.7976931348623157E308") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:double(lower bound) $arg2 = xs:double(upper bound) . */ @org.junit.Test public void opNumericSubtractdbl2args5() { final XQuery query = new XQuery( "xs:double(\"0\") - xs:double(\"1.7976931348623157E308\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.7976931348623157E308") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void opNumericSubtractdec2args1() { final XQuery query = new XQuery( "xs:decimal(\"-999999999999999999\") - xs:decimal(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:decimal(mid range) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void opNumericSubtractdec2args2() { final XQuery query = new XQuery( "xs:decimal(\"0\") - xs:decimal(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:decimal(upper bound) $arg2 = xs:decimal(lower bound) . */ @org.junit.Test public void opNumericSubtractdec2args3() { final XQuery query = new XQuery( "xs:decimal(\"0\") - xs:decimal(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(mid range) . */ @org.junit.Test public void opNumericSubtractdec2args4() { final XQuery query = new XQuery( "xs:decimal(\"-382624808391485160\") - xs:decimal(\"617375191608514839\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:decimal(lower bound) $arg2 = xs:decimal(upper bound) . */ @org.junit.Test public void opNumericSubtractdec2args5() { final XQuery query = new XQuery( "xs:decimal(\"0\") - xs:decimal(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void opNumericSubtractflt2args1() { final XQuery query = new XQuery( "xs:float(\"-3.4028235E38\") - xs:float(\"-3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:float(mid range) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void opNumericSubtractflt2args2() { final XQuery query = new XQuery( "xs:float(\"0\") - xs:float(\"-3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(3.4028235E38)") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:float(upper bound) $arg2 = xs:float(lower bound) . */ @org.junit.Test public void opNumericSubtractflt2args3() { final XQuery query = new XQuery( "xs:float(\"0\") - xs:float(\"-3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(3.4028235E38)") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(mid range) . */ @org.junit.Test public void opNumericSubtractflt2args4() { final XQuery query = new XQuery( "xs:float(\"-3.4028235E38\") - xs:float(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(-3.4028235E38)") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:float(lower bound) $arg2 = xs:float(upper bound) . */ @org.junit.Test public void opNumericSubtractflt2args5() { final XQuery query = new XQuery( "xs:float(\"0\") - xs:float(\"3.4028235E38\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(-3.4028235E38)") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void opNumericSubtractint2args1() { final XQuery query = new XQuery( "xs:int(\"-2147483648\") - xs:int(\"-2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:int(mid range) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void opNumericSubtractint2args2() { final XQuery query = new XQuery( "xs:int(\"-1873914410\") - xs:int(\"-2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("273569238") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:int(upper bound) $arg2 = xs:int(lower bound) . */ @org.junit.Test public void opNumericSubtractint2args3() { final XQuery query = new XQuery( "xs:int(\"-1\") - xs:int(\"-2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2147483647") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(mid range) . */ @org.junit.Test public void opNumericSubtractint2args4() { final XQuery query = new XQuery( "xs:int(\"-2147483648\") - xs:int(\"-1873914410\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-273569238") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:int(lower bound) $arg2 = xs:int(upper bound) . */ @org.junit.Test public void opNumericSubtractint2args5() { final XQuery query = new XQuery( "xs:int(\"-1\") - xs:int(\"2147483647\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2147483648") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void opNumericSubtractintg2args1() { final XQuery query = new XQuery( "xs:integer(\"-999999999999999999\") - xs:integer(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:integer(mid range) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void opNumericSubtractintg2args2() { final XQuery query = new XQuery( "xs:integer(\"0\") - xs:integer(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:integer(upper bound) $arg2 = xs:integer(lower bound) . */ @org.junit.Test public void opNumericSubtractintg2args3() { final XQuery query = new XQuery( "xs:integer(\"0\") - xs:integer(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(mid range) . */ @org.junit.Test public void opNumericSubtractintg2args4() { final XQuery query = new XQuery( "xs:integer(\"-169006502882975695\") - xs:integer(\"830993497117024304\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:integer(lower bound) $arg2 = xs:integer(upper bound) . */ @org.junit.Test public void opNumericSubtractintg2args5() { final XQuery query = new XQuery( "xs:integer(\"0\") - xs:integer(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void opNumericSubtractlng2args1() { final XQuery query = new XQuery( "xs:long(\"-92233720368547758\") - xs:long(\"-92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:long(mid range) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void opNumericSubtractlng2args2() { final XQuery query = new XQuery( "xs:long(\"-47175562203048468\") - xs:long(\"-92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("45058158165499290") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:long(upper bound) $arg2 = xs:long(lower bound) . */ @org.junit.Test public void opNumericSubtractlng2args3() { final XQuery query = new XQuery( "xs:long(\"0\") - xs:long(\"-92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("92233720368547758") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(mid range) . */ @org.junit.Test public void opNumericSubtractlng2args4() { final XQuery query = new XQuery( "xs:long(\"-92233720368547758\") - xs:long(\"-47175562203048468\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-45058158165499290") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:long(lower bound) $arg2 = xs:long(upper bound) . */ @org.junit.Test public void opNumericSubtractlng2args5() { final XQuery query = new XQuery( "xs:long(\"0\") - xs:long(\"92233720368547758\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Simple subtraction test with () as one operand should return null . */ @org.junit.Test public void opNumericSubtractmix2args1() { final XQuery query = new XQuery( "1 - ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEmpty() || error("XPST0005") ) ); } /** * Simple subtraction test pass string for second operator . */ @org.junit.Test public void opNumericSubtractmix2args2() { final XQuery query = new XQuery( "1 - '1'", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Simple subtraction test, second operator cast string to integer . */ @org.junit.Test public void opNumericSubtractmix2args3() { final XQuery query = new XQuery( "1 - xs:integer('1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Simple subtraction test, second operator is a node, atomization applied . */ @org.junit.Test public void opNumericSubtractmix2args4() { final XQuery query = new XQuery( "3 - 2 ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Simple subtraction test, second operator is a node, atomization applied . */ @org.junit.Test public void opNumericSubtractmix2args5() { final XQuery query = new XQuery( "3 - 2 ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Simple subtraction test, second operator node which is not atomizable . */ @org.junit.Test public void opNumericSubtractmix2args6() { final XQuery query = new XQuery( "3 - 2 2 ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Simple subtraction test, two operands are nodes . */ @org.junit.Test public void opNumericSubtractmix2args7() { final XQuery query = new XQuery( " 2 - 1 ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Simple subtraction test, second operator is a node, atomizable but not castable to integer . */ @org.junit.Test public void opNumericSubtractmix2args8() { final XQuery query = new XQuery( "1 - x ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Simple subtraction test pass an empty node for second operator . */ @org.junit.Test public void opNumericSubtractmix2args9() { final XQuery query = new XQuery( "1 - ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(mid range) . */ @org.junit.Test public void opNumericSubtractnint2args1() { final XQuery query = new XQuery( "xs:negativeInteger(\"-999999999999999999\") - xs:negativeInteger(\"-297014075999096793\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-702985924000903206") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:negativeInteger(lower bound) $arg2 = xs:negativeInteger(upper bound) . */ @org.junit.Test public void opNumericSubtractnint2args2() { final XQuery query = new XQuery( "xs:negativeInteger(\"-999999999999999999\") - xs:negativeInteger(\"-1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999998") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void opNumericSubtractnni2args1() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") - xs:nonNegativeInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(mid range) $arg2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void opNumericSubtractnni2args2() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"303884545991464527\") - xs:nonNegativeInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("303884545991464527") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(upper bound) $arg2 = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void opNumericSubtractnni2args3() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"999999999999999999\") - xs:nonNegativeInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void opNumericSubtractnni2args4() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"303884545991464527\") - xs:nonNegativeInteger(\"303884545991464527\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:nonNegativeInteger(lower bound) $arg2 = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void opNumericSubtractnni2args5() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"999999999999999999\") - xs:nonNegativeInteger(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void opNumericSubtractnpi2args1() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-999999999999999999\") - xs:nonPositiveInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(mid range) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void opNumericSubtractnpi2args2() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-999999999999999999\") - xs:nonPositiveInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(upper bound) $arg2 = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void opNumericSubtractnpi2args3() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-999999999999999999\") - xs:nonPositiveInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void opNumericSubtractnpi2args4() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-999999999999999999\") - xs:nonPositiveInteger(\"-475688437271870490\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-524311562728129509") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:nonPositiveInteger(lower bound) $arg2 = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void opNumericSubtractnpi2args5() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-999999999999999999\") - xs:nonPositiveInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:positiveInteger(mid range) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void opNumericSubtractpint2args1() { final XQuery query = new XQuery( "xs:positiveInteger(\"52704602390610033\") - xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("52704602390610032") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:positiveInteger(upper bound) $arg2 = xs:positiveInteger(lower bound) . */ @org.junit.Test public void opNumericSubtractpint2args2() { final XQuery query = new XQuery( "xs:positiveInteger(\"999999999999999999\") - xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999998") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:positiveInteger(lower bound) $arg2 = xs:positiveInteger(mid range) . */ @org.junit.Test public void opNumericSubtractpint2args3() { final XQuery query = new XQuery( "xs:positiveInteger(\"52704602390610034\") - xs:positiveInteger(\"52704602390610033\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void opNumericSubtractsht2args1() { final XQuery query = new XQuery( "xs:short(\"-32768\") - xs:short(\"-32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:short(mid range) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void opNumericSubtractsht2args2() { final XQuery query = new XQuery( "xs:short(\"-5324\") - xs:short(\"-32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("27444") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:short(upper bound) $arg2 = xs:short(lower bound) . */ @org.junit.Test public void opNumericSubtractsht2args3() { final XQuery query = new XQuery( "xs:short(\"-1\") - xs:short(\"-32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("32767") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(mid range) . */ @org.junit.Test public void opNumericSubtractsht2args4() { final XQuery query = new XQuery( "xs:short(\"-32768\") - xs:short(\"-5324\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-27444") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:short(lower bound) $arg2 = xs:short(upper bound) . */ @org.junit.Test public void opNumericSubtractsht2args5() { final XQuery query = new XQuery( "xs:short(\"-1\") - xs:short(\"32767\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-32768") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void opNumericSubtractulng2args1() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") - xs:unsignedLong(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:unsignedLong(mid range) $arg2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void opNumericSubtractulng2args2() { final XQuery query = new XQuery( "xs:unsignedLong(\"130747108607674654\") - xs:unsignedLong(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("130747108607674654") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:unsignedLong(upper bound) $arg2 = xs:unsignedLong(lower bound) . */ @org.junit.Test public void opNumericSubtractulng2args3() { final XQuery query = new XQuery( "xs:unsignedLong(\"184467440737095516\") - xs:unsignedLong(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("184467440737095516") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(mid range) . */ @org.junit.Test public void opNumericSubtractulng2args4() { final XQuery query = new XQuery( "xs:unsignedLong(\"130747108607674654\") - xs:unsignedLong(\"130747108607674654\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:unsignedLong(lower bound) $arg2 = xs:unsignedLong(upper bound) . */ @org.junit.Test public void opNumericSubtractulng2args5() { final XQuery query = new XQuery( "xs:unsignedLong(\"184467440737095516\") - xs:unsignedLong(\"184467440737095516\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void opNumericSubtractusht2args1() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") - xs:unsignedShort(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:unsignedShort(mid range) $arg2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void opNumericSubtractusht2args2() { final XQuery query = new XQuery( "xs:unsignedShort(\"44633\") - xs:unsignedShort(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("44633") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:unsignedShort(upper bound) $arg2 = xs:unsignedShort(lower bound) . */ @org.junit.Test public void opNumericSubtractusht2args3() { final XQuery query = new XQuery( "xs:unsignedShort(\"65535\") - xs:unsignedShort(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("65535") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(mid range) . */ @org.junit.Test public void opNumericSubtractusht2args4() { final XQuery query = new XQuery( "xs:unsignedShort(\"44633\") - xs:unsignedShort(\"44633\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-subtract" operator with the arguments set as follows: $arg1 = xs:unsignedShort(lower bound) $arg2 = xs:unsignedShort(upper bound) . */ @org.junit.Test public void opNumericSubtractusht2args5() { final XQuery query = new XQuery( "xs:unsignedShort(\"65535\") - xs:unsignedShort(\"65535\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpNumericUnaryMinus.java000066400000000000000000000750351222453003200307300ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the numeric-unary-minus() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpNumericUnaryMinus extends QT3TestSet { /** * No unary operator is available for xs:string. . */ @org.junit.Test public void kNumericUnaryMinus1() { final XQuery query = new XQuery( "-\"a string\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A test whose essence is: `---------3 eq -3`. . */ @org.junit.Test public void kNumericUnaryMinus10() { final XQuery query = new XQuery( "---------3 eq -3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `+-+-+-+-+-+-+-+3 eq -3`. . */ @org.junit.Test public void kNumericUnaryMinus11() { final XQuery query = new XQuery( "+-+-+-+-+-+-+-+3 eq -3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `----+-+-++-+-+-+-+++-+--+--3 eq -3`. . */ @org.junit.Test public void kNumericUnaryMinus12() { final XQuery query = new XQuery( "----+-+-++-+-+-+-+++-+--+--3 eq -3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `---3 eq -3`. . */ @org.junit.Test public void kNumericUnaryMinus13() { final XQuery query = new XQuery( "---3 eq -3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `+(-3) eq -3`. . */ @org.junit.Test public void kNumericUnaryMinus2() { final XQuery query = new XQuery( "+(-3) eq -3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(-3) eq -3`. . */ @org.junit.Test public void kNumericUnaryMinus3() { final XQuery query = new XQuery( "(-3) eq -3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(+3) ne -3`. . */ @org.junit.Test public void kNumericUnaryMinus4() { final XQuery query = new XQuery( "(+3) ne -3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `-3 eq -3`. . */ @org.junit.Test public void kNumericUnaryMinus5() { final XQuery query = new XQuery( "-3 eq -3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `+(-3) eq -3`. . */ @org.junit.Test public void kNumericUnaryMinus6() { final XQuery query = new XQuery( "+(-3) eq -3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `-(+3) eq -3`. . */ @org.junit.Test public void kNumericUnaryMinus7() { final XQuery query = new XQuery( "-(+3) eq -3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `-(3) eq -3`. . */ @org.junit.Test public void kNumericUnaryMinus8() { final XQuery query = new XQuery( "-(3) eq -3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `-(3) eq -3`. . */ @org.junit.Test public void kNumericUnaryMinus9() { final XQuery query = new XQuery( "-(3) eq -3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Operand is constructor function for xs:double. . */ @org.junit.Test public void k2NumericUnaryMinus1() { final XQuery query = new XQuery( "-xs:double(0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * A tricky operand, which requires various forms of argument conversion. . */ @org.junit.Test public void k2NumericUnaryMinus10() { final XQuery query = new XQuery( "-((1 | ())[1])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Operand is constructor function for xs:float. . */ @org.junit.Test public void k2NumericUnaryMinus2() { final XQuery query = new XQuery( "-xs:float(0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Operand is constructor function for xs:decimal. . */ @org.junit.Test public void k2NumericUnaryMinus3() { final XQuery query = new XQuery( "-xs:decimal(0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Operand is constructor function for xs:integer. . */ @org.junit.Test public void k2NumericUnaryMinus4() { final XQuery query = new XQuery( "-xs:integer(0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * -0.0. . */ @org.junit.Test public void k2NumericUnaryMinus5() { final XQuery query = new XQuery( "-0.0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Cast -0.0 to xs:float. . */ @org.junit.Test public void k2NumericUnaryMinus6() { final XQuery query = new XQuery( "xs:float(-0.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Cast -0.0 to xs:double. . */ @org.junit.Test public void k2NumericUnaryMinus7() { final XQuery query = new XQuery( "xs:double(-0.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Unary combined with path expressions. . */ @org.junit.Test public void k2NumericUnaryMinus8() { final XQuery query = new XQuery( "empty(document{()}/(-element()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Unary with an empty sequence. . */ @org.junit.Test public void k2NumericUnaryMinus9() { final XQuery query = new XQuery( "empty(-())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test unary minus with a potential type check error . */ @org.junit.Test public void cbclNumericUnaryMinus001() { final XQuery query = new XQuery( "declare function local:value($number as xs:boolean) { if ($number) then 1 else xs:string('1') }; -(local:value(true()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "-1") || error("XPTY0004") ) ); } /** * Check dynamic type of unary plus on argument of union of numeric types and untypedAtomic. . */ @org.junit.Test public void opNumericUnaryMinus1() { final XQuery query = new XQuery( "\n" + " for $x in (1, xs:decimal(2), xs:float(3), xs:double(4), xs:untypedAtomic(5)) \n" + " return typeswitch (-$x) \n" + " case xs:integer return \"integer\" \n" + " case xs:decimal return \"decimal\" \n" + " case xs:float return \"float\" \n" + " case xs:double return \"double\" \n" + " default return error()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "integer decimal float double double") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:double(lower bound) . */ @org.junit.Test public void opNumericUnaryMinusdbl1args1() { final XQuery query = new XQuery( "-(xs:double(\"-1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.7976931348623157E308") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:double(mid range) . */ @org.junit.Test public void opNumericUnaryMinusdbl1args2() { final XQuery query = new XQuery( "-(xs:double(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:double(upper bound) . */ @org.junit.Test public void opNumericUnaryMinusdbl1args3() { final XQuery query = new XQuery( "-(xs:double(\"1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.7976931348623157E308") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:decimal(lower bound) . */ @org.junit.Test public void opNumericUnaryMinusdec1args1() { final XQuery query = new XQuery( "-(xs:decimal(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:decimal(mid range) . */ @org.junit.Test public void opNumericUnaryMinusdec1args2() { final XQuery query = new XQuery( "-(xs:decimal(\"617375191608514839\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-617375191608514839") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:decimal(upper bound) . */ @org.junit.Test public void opNumericUnaryMinusdec1args3() { final XQuery query = new XQuery( "-(xs:decimal(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:float(lower bound) . */ @org.junit.Test public void opNumericUnaryMinusflt1args1() { final XQuery query = new XQuery( "-(xs:float(\"-3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(3.4028235E38)") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:float(mid range) . */ @org.junit.Test public void opNumericUnaryMinusflt1args2() { final XQuery query = new XQuery( "-(xs:float(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:float(upper bound) . */ @org.junit.Test public void opNumericUnaryMinusflt1args3() { final XQuery query = new XQuery( "-(xs:float(\"3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(-3.4028235E38)") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:int(lower bound) . */ @org.junit.Test public void opNumericUnaryMinusint1args1() { final XQuery query = new XQuery( "-(xs:int(\"-2147483647\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2147483647") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:int(mid range) . */ @org.junit.Test public void opNumericUnaryMinusint1args2() { final XQuery query = new XQuery( "-(xs:int(\"-1873914410\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1873914410") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:int(upper bound) . */ @org.junit.Test public void opNumericUnaryMinusint1args3() { final XQuery query = new XQuery( "-(xs:int(\"2147483647\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2147483647") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:integer(lower bound) . */ @org.junit.Test public void opNumericUnaryMinusintg1args1() { final XQuery query = new XQuery( "-(xs:integer(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:integer(mid range) . */ @org.junit.Test public void opNumericUnaryMinusintg1args2() { final XQuery query = new XQuery( "-(xs:integer(\"830993497117024304\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-830993497117024304") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:integer(upper bound) . */ @org.junit.Test public void opNumericUnaryMinusintg1args3() { final XQuery query = new XQuery( "-(xs:integer(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:long(lower bound) . */ @org.junit.Test public void opNumericUnaryMinuslng1args1() { final XQuery query = new XQuery( "-(xs:long(\"-92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("92233720368547758") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:long(mid range) . */ @org.junit.Test public void opNumericUnaryMinuslng1args2() { final XQuery query = new XQuery( "-(xs:long(\"-47175562203048468\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("47175562203048468") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:long(upper bound) . */ @org.junit.Test public void opNumericUnaryMinuslng1args3() { final XQuery query = new XQuery( "-(xs:long(\"92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:negativeInteger(lower bound) . */ @org.junit.Test public void opNumericUnaryMinusnint1args1() { final XQuery query = new XQuery( "-(xs:negativeInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:negativeInteger(mid range) . */ @org.junit.Test public void opNumericUnaryMinusnint1args2() { final XQuery query = new XQuery( "-(xs:negativeInteger(\"-297014075999096793\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("297014075999096793") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:negativeInteger(upper bound) . */ @org.junit.Test public void opNumericUnaryMinusnint1args3() { final XQuery query = new XQuery( "-(xs:negativeInteger(\"-1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void opNumericUnaryMinusnni1args1() { final XQuery query = new XQuery( "-(xs:nonNegativeInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void opNumericUnaryMinusnni1args2() { final XQuery query = new XQuery( "-(xs:nonNegativeInteger(\"303884545991464527\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-303884545991464527") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void opNumericUnaryMinusnni1args3() { final XQuery query = new XQuery( "-(xs:nonNegativeInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void opNumericUnaryMinusnpi1args1() { final XQuery query = new XQuery( "-(xs:nonPositiveInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void opNumericUnaryMinusnpi1args2() { final XQuery query = new XQuery( "-(xs:nonPositiveInteger(\"-475688437271870490\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("475688437271870490") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void opNumericUnaryMinusnpi1args3() { final XQuery query = new XQuery( "-(xs:nonPositiveInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:positiveInteger(lower bound) . */ @org.junit.Test public void opNumericUnaryMinuspint1args1() { final XQuery query = new XQuery( "-(xs:positiveInteger(\"1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:positiveInteger(mid range) . */ @org.junit.Test public void opNumericUnaryMinuspint1args2() { final XQuery query = new XQuery( "-(xs:positiveInteger(\"52704602390610033\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-52704602390610033") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:positiveInteger(upper bound) . */ @org.junit.Test public void opNumericUnaryMinuspint1args3() { final XQuery query = new XQuery( "-(xs:positiveInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:short(lower bound) . */ @org.junit.Test public void opNumericUnaryMinussht1args1() { final XQuery query = new XQuery( "-(xs:short(\"-32768\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("32768") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:short(mid range) . */ @org.junit.Test public void opNumericUnaryMinussht1args2() { final XQuery query = new XQuery( "-(xs:short(\"-5324\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5324") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:short(upper bound) . */ @org.junit.Test public void opNumericUnaryMinussht1args3() { final XQuery query = new XQuery( "-(xs:short(\"32767\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-32767") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:unsignedLong(lower bound) . */ @org.junit.Test public void opNumericUnaryMinusulng1args1() { final XQuery query = new XQuery( "-(xs:unsignedLong(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:unsignedLong(mid range) . */ @org.junit.Test public void opNumericUnaryMinusulng1args2() { final XQuery query = new XQuery( "-(xs:unsignedLong(\"130747108607674654\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-130747108607674654") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:unsignedLong(upper bound) . */ @org.junit.Test public void opNumericUnaryMinusulng1args3() { final XQuery query = new XQuery( "-(xs:unsignedLong(\"184467440737095516\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-184467440737095516") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:unsignedShort(lower bound) . */ @org.junit.Test public void opNumericUnaryMinususht1args1() { final XQuery query = new XQuery( "-(xs:unsignedShort(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:unsignedShort(mid range) . */ @org.junit.Test public void opNumericUnaryMinususht1args2() { final XQuery query = new XQuery( "-(xs:unsignedShort(\"44633\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-44633") ); } /** * Evaluates The "op:numeric-unary-minus" operator with the arguments set as follows: $arg = xs:unsignedShort(upper bound) . */ @org.junit.Test public void opNumericUnaryMinususht1args3() { final XQuery query = new XQuery( "-(xs:unsignedShort(\"65535\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-65535") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpNumericUnaryPlus.java000066400000000000000000000655161222453003200305630ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the numeric-unary-plus() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpNumericUnaryPlus extends QT3TestSet { /** * No unary operator is available for xs:string. . */ @org.junit.Test public void kNumericUnaryPlus1() { final XQuery query = new XQuery( "+\"a string\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A test whose essence is: `-+-+-+-+-+-+-+-3 eq 3`. . */ @org.junit.Test public void kNumericUnaryPlus10() { final XQuery query = new XQuery( "-+-+-+-+-+-+-+-3 eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `-+-+-+-+-+-++-+-++-+-+-+-+++3 eq 3`. . */ @org.junit.Test public void kNumericUnaryPlus11() { final XQuery query = new XQuery( "-+-+-+-+-+-++-+-++-+-+-+-+++3 eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `+++3 eq ++3`. . */ @org.junit.Test public void kNumericUnaryPlus12() { final XQuery query = new XQuery( "+++3 eq ++3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(+3) eq 3`. . */ @org.junit.Test public void kNumericUnaryPlus2() { final XQuery query = new XQuery( "(+3) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(+3) eq +3`. . */ @org.junit.Test public void kNumericUnaryPlus3() { final XQuery query = new XQuery( "(+3) eq +3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(+3) eq +(3)`. . */ @org.junit.Test public void kNumericUnaryPlus4() { final XQuery query = new XQuery( "(+3) eq +(3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `+(3) eq 3`. . */ @org.junit.Test public void kNumericUnaryPlus5() { final XQuery query = new XQuery( "+(3) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `+(3) eq +3`. . */ @org.junit.Test public void kNumericUnaryPlus6() { final XQuery query = new XQuery( "+(3) eq +3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `-(3) ne 3`. . */ @org.junit.Test public void kNumericUnaryPlus7() { final XQuery query = new XQuery( "-(3) ne 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `----------3 eq 3`. . */ @org.junit.Test public void kNumericUnaryPlus8() { final XQuery query = new XQuery( "----------3 eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `+++++++++++3 eq 3`. . */ @org.junit.Test public void kNumericUnaryPlus9() { final XQuery query = new XQuery( "+++++++++++3 eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Unary combined with path expressions. . */ @org.junit.Test public void k2NumericUnaryPlus1() { final XQuery query = new XQuery( "empty(document{()}/(+element()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Unary with an empty sequence. . */ @org.junit.Test public void k2NumericUnaryPlus2() { final XQuery query = new XQuery( "empty(+())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test unary plus with a potential type check error . */ @org.junit.Test public void cbclNumericUnaryPlus001() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:value($number as xs:boolean) { if ($number) then 1 else xs:string('1') }; \n" + " \t+(local:value(true()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "1") || error("XPTY0004") ) ); } /** * Check dynamic type of unary plus on argument of union of numeric types and untypedAtomic. . */ @org.junit.Test public void opNumericUnaryPlus1() { final XQuery query = new XQuery( "for $x in (1, xs:decimal(2), xs:float(3), xs:double(4), xs:untypedAtomic(5)) return typeswitch (+$x) case xs:integer return \"integer\" case xs:decimal return \"decimal\" case xs:float return \"float\" case xs:double return \"double\" default return error()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "integer decimal float double double") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:double(lower bound) . */ @org.junit.Test public void opNumericUnaryPlusdbl1args1() { final XQuery query = new XQuery( "+(xs:double(\"-1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1.7976931348623157E308") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:double(mid range) . */ @org.junit.Test public void opNumericUnaryPlusdbl1args2() { final XQuery query = new XQuery( "+(xs:double(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:double(upper bound) . */ @org.junit.Test public void opNumericUnaryPlusdbl1args3() { final XQuery query = new XQuery( "+(xs:double(\"1.7976931348623157E308\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1.7976931348623157E308") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:decimal(lower bound) . */ @org.junit.Test public void opNumericUnaryPlusdec1args1() { final XQuery query = new XQuery( "+(xs:decimal(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:decimal(mid range) . */ @org.junit.Test public void opNumericUnaryPlusdec1args2() { final XQuery query = new XQuery( "+(xs:decimal(\"617375191608514839\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("617375191608514839") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:decimal(upper bound) . */ @org.junit.Test public void opNumericUnaryPlusdec1args3() { final XQuery query = new XQuery( "+(xs:decimal(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:float(lower bound) . */ @org.junit.Test public void opNumericUnaryPlusflt1args1() { final XQuery query = new XQuery( "+(xs:float(\"-3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(-3.4028235E38)") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:float(mid range) . */ @org.junit.Test public void opNumericUnaryPlusflt1args2() { final XQuery query = new XQuery( "+(xs:float(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:float(upper bound) . */ @org.junit.Test public void opNumericUnaryPlusflt1args3() { final XQuery query = new XQuery( "+(xs:float(\"3.4028235E38\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("xs:float(3.4028235E38)") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:int(lower bound) . */ @org.junit.Test public void opNumericUnaryPlusint1args1() { final XQuery query = new XQuery( "+(xs:int(\"-2147483648\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2147483648") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:int(mid range) . */ @org.junit.Test public void opNumericUnaryPlusint1args2() { final XQuery query = new XQuery( "+(xs:int(\"-1873914410\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1873914410") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:int(upper bound) . */ @org.junit.Test public void opNumericUnaryPlusint1args3() { final XQuery query = new XQuery( "+(xs:int(\"2147483647\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2147483647") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:integer(lower bound) . */ @org.junit.Test public void opNumericUnaryPlusintg1args1() { final XQuery query = new XQuery( "+(xs:integer(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:integer(mid range) . */ @org.junit.Test public void opNumericUnaryPlusintg1args2() { final XQuery query = new XQuery( "+(xs:integer(\"830993497117024304\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("830993497117024304") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:integer(upper bound) . */ @org.junit.Test public void opNumericUnaryPlusintg1args3() { final XQuery query = new XQuery( "+(xs:integer(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:long(lower bound) . */ @org.junit.Test public void opNumericUnaryPluslng1args1() { final XQuery query = new XQuery( "+(xs:long(\"-92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547758") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:long(mid range) . */ @org.junit.Test public void opNumericUnaryPluslng1args2() { final XQuery query = new XQuery( "+(xs:long(\"-47175562203048468\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-47175562203048468") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:long(upper bound) . */ @org.junit.Test public void opNumericUnaryPluslng1args3() { final XQuery query = new XQuery( "+(xs:long(\"92233720368547758\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("92233720368547758") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:negativeInteger(lower bound) . */ @org.junit.Test public void opNumericUnaryPlusnint1args1() { final XQuery query = new XQuery( "+(xs:negativeInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:negativeInteger(mid range) . */ @org.junit.Test public void opNumericUnaryPlusnint1args2() { final XQuery query = new XQuery( "+(xs:negativeInteger(\"-297014075999096793\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-297014075999096793") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:negativeInteger(upper bound) . */ @org.junit.Test public void opNumericUnaryPlusnint1args3() { final XQuery query = new XQuery( "+(xs:negativeInteger(\"-1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:nonNegativeInteger(lower bound) . */ @org.junit.Test public void opNumericUnaryPlusnni1args1() { final XQuery query = new XQuery( "+(xs:nonNegativeInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:nonNegativeInteger(mid range) . */ @org.junit.Test public void opNumericUnaryPlusnni1args2() { final XQuery query = new XQuery( "+(xs:nonNegativeInteger(\"303884545991464527\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("303884545991464527") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:nonNegativeInteger(upper bound) . */ @org.junit.Test public void opNumericUnaryPlusnni1args3() { final XQuery query = new XQuery( "+(xs:nonNegativeInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:nonPositiveInteger(lower bound) . */ @org.junit.Test public void opNumericUnaryPlusnpi1args1() { final XQuery query = new XQuery( "+(xs:nonPositiveInteger(\"-999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:nonPositiveInteger(mid range) . */ @org.junit.Test public void opNumericUnaryPlusnpi1args2() { final XQuery query = new XQuery( "+(xs:nonPositiveInteger(\"-475688437271870490\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-475688437271870490") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:nonPositiveInteger(upper bound) . */ @org.junit.Test public void opNumericUnaryPlusnpi1args3() { final XQuery query = new XQuery( "+(xs:nonPositiveInteger(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:positiveInteger(lower bound) . */ @org.junit.Test public void opNumericUnaryPluspint1args1() { final XQuery query = new XQuery( "+(xs:positiveInteger(\"1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:positiveInteger(mid range) . */ @org.junit.Test public void opNumericUnaryPluspint1args2() { final XQuery query = new XQuery( "+(xs:positiveInteger(\"52704602390610033\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("52704602390610033") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:positiveInteger(upper bound) . */ @org.junit.Test public void opNumericUnaryPluspint1args3() { final XQuery query = new XQuery( "+(xs:positiveInteger(\"999999999999999999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:short(lower bound) . */ @org.junit.Test public void opNumericUnaryPlussht1args1() { final XQuery query = new XQuery( "+(xs:short(\"-32768\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-32768") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:short(mid range) . */ @org.junit.Test public void opNumericUnaryPlussht1args2() { final XQuery query = new XQuery( "+(xs:short(\"-5324\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-5324") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:short(upper bound) . */ @org.junit.Test public void opNumericUnaryPlussht1args3() { final XQuery query = new XQuery( "+(xs:short(\"32767\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("32767") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:unsignedLong(lower bound) . */ @org.junit.Test public void opNumericUnaryPlusulng1args1() { final XQuery query = new XQuery( "+(xs:unsignedLong(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:unsignedLong(mid range) . */ @org.junit.Test public void opNumericUnaryPlusulng1args2() { final XQuery query = new XQuery( "+(xs:unsignedLong(\"130747108607674654\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("130747108607674654") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:unsignedLong(upper bound) . */ @org.junit.Test public void opNumericUnaryPlusulng1args3() { final XQuery query = new XQuery( "+(xs:unsignedLong(\"184467440737095516\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("184467440737095516") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:unsignedShort(lower bound) . */ @org.junit.Test public void opNumericUnaryPlususht1args1() { final XQuery query = new XQuery( "+(xs:unsignedShort(\"0\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:unsignedShort(mid range) . */ @org.junit.Test public void opNumericUnaryPlususht1args2() { final XQuery query = new XQuery( "+(xs:unsignedShort(\"44633\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("44633") ); } /** * Evaluates The "op:numeric-unary-plus" operator with the arguments set as follows: $arg = xs:unsignedShort(upper bound) . */ @org.junit.Test public void opNumericUnaryPlususht1args3() { final XQuery query = new XQuery( "+(xs:unsignedShort(\"65535\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("65535") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpQNameEqual.java000066400000000000000000000636761222453003200272740ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the QName-equal() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpQNameEqual extends QT3TestSet { /** * * ******************************************************* * Test: K-QNameEQ-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `QName("example.com/", "p:ncname") eq QName("example.com/", "p:ncname")`. * ******************************************************* * . */ @org.junit.Test public void kQNameEQ1() { final XQuery query = new XQuery( "QName(\"example.com/\", \"p:ncname\") eq QName(\"example.com/\", \"p:ncname\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-QNameEQ-10 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Operator 'ge' is not available between values of type xs:QName. * ******************************************************* * . */ @org.junit.Test public void kQNameEQ10() { final XQuery query = new XQuery( "QName(\"example.com/\", \"p:ncname\") ge QName(\"example.com/\", \"p:ncname\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-QNameEQ-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `QName("example.com/", "p:ncname") eq QName("example.com/", "pdifferent:ncname")`. * ******************************************************* * . */ @org.junit.Test public void kQNameEQ2() { final XQuery query = new XQuery( "QName(\"example.com/\", \"p:ncname\") eq QName(\"example.com/\", \"pdifferent:ncname\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-QNameEQ-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `QName("example.com/", "p:ncname") ne QName("example.com/Nope", "p:ncname")`. * ******************************************************* * . */ @org.junit.Test public void kQNameEQ3() { final XQuery query = new XQuery( "QName(\"example.com/\", \"p:ncname\") ne QName(\"example.com/Nope\", \"p:ncname\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-QNameEQ-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: A test whose essence is: `QName("example.com/", "p:ncname") ne QName("example.com/", "p:ncnameNope")`. * ******************************************************* * . */ @org.junit.Test public void kQNameEQ4() { final XQuery query = new XQuery( "QName(\"example.com/\", \"p:ncname\") ne QName(\"example.com/\", \"p:ncnameNope\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-QNameEQ-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Operator 'lt' is not available between xs:QName and xs:integer. * ******************************************************* * . */ @org.junit.Test public void kQNameEQ5() { final XQuery query = new XQuery( "QName(\"example.com/\", \"p:ncname\") lt 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-QNameEQ-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Operator 'eq' is not available between xs:anyURI and xs:QName. * ******************************************************* * . */ @org.junit.Test public void kQNameEQ6() { final XQuery query = new XQuery( "QName(\"example.com/\", \"p:ncname\") eq xs:anyURI(\"org\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-QNameEQ-7 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Operator 'lt' is not available between values of type xs:QName. * ******************************************************* * . */ @org.junit.Test public void kQNameEQ7() { final XQuery query = new XQuery( "QName(\"example.com/\", \"p:ncname\") lt QName(\"example.com/\", \"p:ncname\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-QNameEQ-8 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Operator 'le' is not available between values of type xs:QName. * ******************************************************* * . */ @org.junit.Test public void kQNameEQ8() { final XQuery query = new XQuery( "QName(\"example.com/\", \"p:ncname\") le QName(\"example.com/\", \"p:ncname\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-QNameEQ-9 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Operator 'gt' is not available between values of type xs:QName. * ******************************************************* * . */ @org.junit.Test public void kQNameEQ9() { final XQuery query = new XQuery( "QName(\"example.com/\", \"p:ncname\") gt QName(\"example.com/\", \"p:ncname\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test equality of xs:QName . */ @org.junit.Test public void cbclQNameEqual001() { final XQuery query = new XQuery( "\n" + " declare function local:QName-value($arg as xs:boolean) as xs:QName { if ($arg) then QName(\"example.com/\", \"p:ncname\") else QName(\"example.com/\", \"q:ncname\") };\n" + " not(local:QName-value(true()) eq local:QName-value(false()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test equality of xs:QName . */ @org.junit.Test public void cbclQNameEqual002() { final XQuery query = new XQuery( "\n" + " declare function local:QName-value($arg as xs:boolean) as xs:QName { if ($arg) then QName(\"example.com/\", \"p:ncname\") else QName(\"example.com/\", \"q:ncname\") };\n" + " not(local:QName-value(true()) ne local:QName-value(false()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Name: op-qName-equal-1 * Description: Evaluation of op-QName-equal operator with two identical qName values. Uses the "eq" operator. * . */ @org.junit.Test public void opQnameEqual1() { final XQuery query = new XQuery( "fn:QName(\"http://www.example.com/example\", \"person\") eq fn:QName(\"http://www.example.com/example\", \"person\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Name: op-qName-equal-10 * Description: Evaluation of op-QName-equal operator with two same namespace uri, same local part, different prefix. Uses the "ne" operator. * Should ignore the prefix * . */ @org.junit.Test public void opQnameEqual10() { final XQuery query = new XQuery( "fn:QName(\"http://www.example.com/example\", \"px1:person\") ne fn:QName(\"http://www.example.com/example\",\"px2:person\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Name: op-qName-equal-11 * Description: Evaluation of op-QName-equal operator with two same namespace uri, different local part, different prefix. Uses the "eq" operator. * Should ignore the prefix * . */ @org.junit.Test public void opQnameEqual11() { final XQuery query = new XQuery( "fn:QName(\"http://www.example.com/example\", \"px1:person1\") eq fn:QName(\"http://www.example.com/example\",\"px2:person2\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Name: op-qName-equal-12 * Description: Evaluation of op-QName-equal operator with two same namespace uri, different local part, different prefix. Uses the "ne" operator. * Should ignore the prefix * . */ @org.junit.Test public void opQnameEqual12() { final XQuery query = new XQuery( "fn:QName(\"http://www.example.com/example\", \"px1:person1\") ne fn:QName(\"http://www.example.com/example\",\"px2:person2\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Name: op-qName-equal-13 * Description: Evaluation of op-QName-equal operator with two different namespace uri, different local part, different prefix. Uses the "eq" operator. * Should ignore the prefix * . */ @org.junit.Test public void opQnameEqual13() { final XQuery query = new XQuery( "fn:QName(\"http://www.example.com/example1\", \"px1:person1\") eq fn:QName(\"http://www.example.com/example2\",\"px2:person2\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Name: op-qName-equal-14 * Description: Evaluation of op-QName-equal operator with two different namespace uri, different local part, different prefix. Uses the "ne" operator. * Should ignore the prefix * . */ @org.junit.Test public void opQnameEqual14() { final XQuery query = new XQuery( "fn:QName(\"http://www.example.com/example1\", \"px1:person1\") ne fn:QName(\"http://www.example.com/example2\",\"px2:person2\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Name: op-qName-equal-15 * Description: Evaluation of op-QName-equal operator with first namespace uri set to the empty string, same local part and no prefix. Uses the "eq" operator. * . */ @org.junit.Test public void opQnameEqual15() { final XQuery query = new XQuery( "fn:QName(\"\", \"person\") eq fn:QName(\"http://www.example.com/example\",\"person\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Name: op-qName-equal-16 * Description: Evaluation of op-QName-equal operator with first namespace uri set to the empty string, same local part and no prefix. Uses the "ne" operator. * . */ @org.junit.Test public void opQnameEqual16() { final XQuery query = new XQuery( "fn:QName(\"\", \"person\") ne fn:QName(\"http://www.example.com/example\",\"person\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Name: op-qName-equal-17 * Description: Evaluation of op-QName-equal operator with second namespace uri set to the empty string, same local part and no prefix. Uses the "eq" operator. * . */ @org.junit.Test public void opQnameEqual17() { final XQuery query = new XQuery( "fn:QName(\"http://www.example.com/example\", \"person\") eq fn:QName(\"\",\"person\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Name: op-qName-equal-18 * Description: Evaluation of op-QName-equal operator with second namespace uri set to the empty string, same local part and no prefix. Uses the "ne" operator. * . */ @org.junit.Test public void opQnameEqual18() { final XQuery query = new XQuery( "fn:QName(\"http://www.example.com/example\", \"person\") ne fn:QName(\"\",\"person\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Name: op-qName-equal-19 * Description: Evaluation of op-QName-equal operator with both namespace uri set to the empty string, same local part and no prefix. Uses the "eq" operator. * . */ @org.junit.Test public void opQnameEqual19() { final XQuery query = new XQuery( "fn:QName(\"\", \"person\") eq fn:QName(\"\",\"person\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Name: op-qName-equal-2 * Description: Evaluation of op-QName-equal operator with two identical qName values. Uses the "ne" operator. * . */ @org.junit.Test public void opQnameEqual2() { final XQuery query = new XQuery( "fn:QName(\"http://www.example.com/example\", \"person\") ne fn:QName(\"http://www.example.com/example\", \"person\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Name: op-qName-equal-20 * Description: Evaluation of op-QName-equal operator with both namespace uri set to the empty string, same local part and no prefix. Uses the "ne" operator. * . */ @org.junit.Test public void opQnameEqual20() { final XQuery query = new XQuery( "fn:QName(\"\", \"person\") ne fn:QName(\"\",\"person\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Name: op-qName-equal-21 * Description: Evaluation of op-QName-equal operator as an argument to the fn:not function. Uses "eq" operator * Should ignore the prefix * . */ @org.junit.Test public void opQnameEqual21() { final XQuery query = new XQuery( "fn:not(fn:QName(\"http://www.example.com/example\", \"px1:person1\") eq fn:QName(\"http://www.example.com/example\",\"px2:person2\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Name: op-qName-equal-22 * Description: Evaluation of op-QName-equal operator as an argument to the fn:not function. Uses "ne" operator * Should ignore the prefix * . */ @org.junit.Test public void opQnameEqual22() { final XQuery query = new XQuery( "fn:not(fn:QName(\"http://www.example.com/example\", \"px1:person1\") ne fn:QName(\"http://www.example.com/example\",\"px2:person2\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Name: op-qName-equal-23 * Description: Evaluation of op-QName-equal operator as part of a boolean expression. Uses "eq" and "and" operators * Should ignore the prefix * . */ @org.junit.Test public void opQnameEqual23() { final XQuery query = new XQuery( "(fn:QName(\"http://www.example.com/example\", \"px:person\") eq fn:QName(\"http://www.example.com/example\",\"px:person\")) and fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Name: op-qName-equal-24 * Description: Evaluation of op-QName-equal operator as part of a boolean expression. Uses "ne" and "and" operators * Should ignore the prefix * . */ @org.junit.Test public void opQnameEqual24() { final XQuery query = new XQuery( "(fn:QName(\"http://www.example.com/example\", \"px:person\") ne fn:QName(\"http://www.example.com/example\",\"px:person\")) and fn:true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Name: op-qName-equal-3 * Description: Evaluation of op-QName-equal operator with two two different qName values (different namespace uri values, same local part). Uses the "eq" operator. * . */ @org.junit.Test public void opQnameEqual3() { final XQuery query = new XQuery( "fn:QName(\"http://www.example.com/example1\", \"person\") eq fn:QName(\"http://www.example.com/example2\", \"person\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Name: op-qName-equal-4 * Description: Evaluation of op-QName-equal operator with two two different qName values. Uses the "ne" operator. * . */ @org.junit.Test public void opQnameEqual4() { final XQuery query = new XQuery( "fn:QName(\"http://www.example.com/example1\", \"person\") ne fn:QName(\"http://www.example.com/example2\", \"person\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Name: op-qName-equal-5 * Description: Evaluation of op-QName-equal operator with two two different qName values (same namespace uri values, different local part). Uses the "eq" operator. * . */ @org.junit.Test public void opQnameEqual5() { final XQuery query = new XQuery( "fn:QName(\"http://www.example.com/example\", \"person1\") eq fn:QName(\"http://www.example.com/example\",\"person2\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Name: op-qName-equal-6 * Description: Evaluation of op-QName-equal operator with two two different qName values (same namespace uri, different local part). Uses the "ne" operator. * . */ @org.junit.Test public void opQnameEqual6() { final XQuery query = new XQuery( "fn:QName(\"http://www.example.com/example\", \"person1\") ne fn:QName(\"http://www.example.com/example\",\"person2\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Name: op-qName-equal-7 * Description: Evaluation of op-QName-equal operator with two same namespace uri, same local part, same prefix. Uses the "eq" operator. * . */ @org.junit.Test public void opQnameEqual7() { final XQuery query = new XQuery( "fn:QName(\"http://www.example.com/example\", \"px1:person\") eq fn:QName(\"http://www.example.com/example\",\"px1:person\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Name: op-qName-equal-8 * Description: Evaluation of op-QName-equal operator with two same namespace uri, same local part, same prefix. Uses the "ne" operator. * . */ @org.junit.Test public void opQnameEqual8() { final XQuery query = new XQuery( "fn:QName(\"http://www.example.com/example\", \"px1:person\") ne fn:QName(\"http://www.example.com/example\",\"px1:person\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Name: op-qName-equal-9 * Description: Evaluation of op-QName-equal operator with two same namespace uri, same local part, different prefix. Uses the "eq" operator. * Should ignore the prefix * . */ @org.junit.Test public void opQnameEqual9() { final XQuery query = new XQuery( "fn:QName(\"http://www.example.com/example\", \"px1:person\") eq fn:QName(\"http://www.example.com/example\",\"px2:person\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * name : value-comparison-1 * description : Evaluation of xs:string compare to xs:anyURI. * Uses "eq" operator. * . */ @org.junit.Test public void valueComparison1() { final XQuery query = new XQuery( "xs:string(\"example.org/\") eq xs:anyURI(\"example.org/\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * name : value-comparison-2 * description : Evaluation of xs:string compare to xs:anyURI. * Uses "ne" operator. * . */ @org.junit.Test public void valueComparison2() { final XQuery query = new XQuery( "xs:string(\"example.org/\") ne xs:anyURI(\"example.org/\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpStringEqual.java000066400000000000000000000202151222453003200275170ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the string-equal operation (not actually defined as such in F+O). * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpStringEqual extends QT3TestSet { /** * A test whose essence is: `'equals' eq 'equals'`. . */ @org.junit.Test public void kStringEqual1() { final XQuery query = new XQuery( "'equals' eq 'equals'", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `'' eq ''`. . */ @org.junit.Test public void kStringEqual2() { final XQuery query = new XQuery( "'' eq ''", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not('nada' eq 'equalness')`. . */ @org.junit.Test public void kStringEqual3() { final XQuery query = new XQuery( "not('nada' eq 'equalness')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `'not' ne 'equal'`. . */ @org.junit.Test public void kStringEqual4() { final XQuery query = new XQuery( "'not' ne 'equal'", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not('equal' ne 'equal')`. . */ @org.junit.Test public void kStringEqual5() { final XQuery query = new XQuery( "not('equal' ne 'equal')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Compare two values returned from fn:lower-case(). . */ @org.junit.Test public void k2StringEqual1() { final XQuery query = new XQuery( "declare variable $vA as xs:string := (\"B STRING\", current-time(), string(content))[1] treat as xs:string; declare variable $vB as xs:string := (\"b string\", current-time(), string(content))[1] treat as xs:string; (lower-case($vA) eq lower-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Compare two values returned from fn:upper-case(). . */ @org.junit.Test public void k2StringEqual2() { final XQuery query = new XQuery( "declare variable $vA as xs:string := (\"B STRING\", current-time(), string(content))[1] treat as xs:string; declare variable $vB as xs:string := (\"b string\", current-time(), string(content))[1] treat as xs:string; (upper-case($vA) eq upper-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Compare two non-matching values returned from fn:lower-case(). . */ @org.junit.Test public void k2StringEqual3() { final XQuery query = new XQuery( "declare variable $vA as xs:string := (\"B STRING\", current-time(), string(content))[1] treat as xs:string; declare variable $vB as xs:string := (\"no match\", current-time(), string(content))[1] treat as xs:string; (lower-case($vA) eq lower-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Compare two non-matching values returned from fn:upper-case(). . */ @org.junit.Test public void k2StringEqual4() { final XQuery query = new XQuery( "declare variable $vA as xs:string := (\"B STRING\", current-time(), string(content))[1] treat as xs:string; declare variable $vB as xs:string := (\"no match\", current-time(), string(content))[1] treat as xs:string; (upper-case($vA) eq upper-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Compare two non-matching values returned from fn:lower-case() and fn:upper-case(). . */ @org.junit.Test public void k2StringEqual5() { final XQuery query = new XQuery( "declare variable $vA as xs:string := (\"B STRING\", current-time(), string(content))[1] treat as xs:string; declare variable $vB as xs:string := (\"b string\", current-time(), string(content))[1] treat as xs:string; (upper-case($vA) eq lower-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Compare two non-matching values returned from fn:lower-case() and fn:upper-case(). . */ @org.junit.Test public void k2StringEqual6() { final XQuery query = new XQuery( "\n" + " declare variable $vA as xs:string := (\"B STRING\", current-time(), string(content))[1] treat as xs:string; \n" + " declare variable $vB as xs:string := (\"b string\", current-time(), string(content))[1] treat as xs:string; \n" + " (lower-case($vA) eq upper-case($vB))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test string comparison . */ @org.junit.Test public void cbclStringEqual001() { final XQuery query = new XQuery( "not(string(current-time()) eq \"now\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test string comparison . */ @org.junit.Test public void cbclStringEqual002() { final XQuery query = new XQuery( "not(string(current-time()) ne \"now\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test string comparison . */ @org.junit.Test public void cbclStringEqual003() { final XQuery query = new XQuery( "\n" + " not(xs:untypedAtomic(current-time()) eq xs:untypedAtomic(\"now\"))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test string comparison . */ @org.junit.Test public void cbclStringEqual004() { final XQuery query = new XQuery( "\n" + " not(xs:untypedAtomic(current-time()) ne xs:untypedAtomic(\"now\"))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpStringGreaterThan.java000066400000000000000000000101061222453003200306520ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the string-greater-than operator (not actually defined as such in F+O). * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpStringGreaterThan extends QT3TestSet { /** * A test whose essence is: `'abc' gt 'a'`. . */ @org.junit.Test public void kStringGT1() { final XQuery query = new XQuery( "'abc' gt 'a'", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not('abc' gt 'abc')`. . */ @org.junit.Test public void kStringGT2() { final XQuery query = new XQuery( "not('abc' gt 'abc')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `'abc' ge 'a'`. . */ @org.junit.Test public void kStringGT3() { final XQuery query = new XQuery( "'abc' ge 'a'", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not('a' ge 'abc')`. . */ @org.junit.Test public void kStringGT4() { final XQuery query = new XQuery( "not('a' ge 'abc')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `'abc' ge 'abc'`. . */ @org.junit.Test public void kStringGT5() { final XQuery query = new XQuery( "'abc' ge 'abc'", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test string comparison . */ @org.junit.Test public void cbclStringGreaterThan001() { final XQuery query = new XQuery( "not(string(current-time()) gt \"now\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test string comparison . */ @org.junit.Test public void cbclStringGreaterThan002() { final XQuery query = new XQuery( "not(string(current-time()) le \"now\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test string comparison . */ @org.junit.Test public void cbclStringGreaterThan003() { final XQuery query = new XQuery( "\n" + " not(xs:untypedAtomic(current-time()) gt xs:untypedAtomic(\"now\"))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test string comparison . */ @org.junit.Test public void cbclStringGreaterThan004() { final XQuery query = new XQuery( "\n" + " not(xs:untypedAtomic(current-time()) le xs:untypedAtomic(\"now\"))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpStringLessThan.java000066400000000000000000000107031222453003200301720ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the string-less-than operator (not actually defined as such in F+O). * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpStringLessThan extends QT3TestSet { /** * A test whose essence is: `'a' lt 'abc'`. . */ @org.junit.Test public void kStringLT1() { final XQuery query = new XQuery( "'a' lt 'abc'", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not('abc' lt 'a')`. . */ @org.junit.Test public void kStringLT2() { final XQuery query = new XQuery( "not('abc' lt 'a')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `'a' le 'abc'`. . */ @org.junit.Test public void kStringLT3() { final XQuery query = new XQuery( "'a' le 'abc'", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not('abc' le 'a')`. . */ @org.junit.Test public void kStringLT4() { final XQuery query = new XQuery( "not('abc' le 'a')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `'abc' le 'abc'`. . */ @org.junit.Test public void kStringLT5() { final XQuery query = new XQuery( "'abc' le 'abc'", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Compare two large codepoints. . */ @org.junit.Test public void k2StringLT1() { final XQuery query = new XQuery( "\"\uea60\" lt \"\ud804\udd70\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test string comparison . */ @org.junit.Test public void cbclStringLessThan001() { final XQuery query = new XQuery( "not(string(current-time()) lt \"now\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test string comparison . */ @org.junit.Test public void cbclStringLessThan002() { final XQuery query = new XQuery( "not(string(current-time()) ge \"now\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test string comparison . */ @org.junit.Test public void cbclStringLessThan003() { final XQuery query = new XQuery( "\n" + " not(xs:untypedAtomic(current-time()) lt xs:untypedAtomic(\"now\"))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test string comparison . */ @org.junit.Test public void cbclStringLessThan004() { final XQuery query = new XQuery( "\n" + " not(xs:untypedAtomic(current-time()) ge xs:untypedAtomic(\"now\"))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpSubtractDateTimes.java000066400000000000000000000623171222453003200306610ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the subtract-dateTimes() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpSubtractDateTimes extends QT3TestSet { /** * * ******************************************************* * Test: K-dateTimesSubtract-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple testing involving operator '-' between xs:date and xs:date that evaluates to zero. * ******************************************************* * . */ @org.junit.Test public void kDateTimesSubtract1() { final XQuery query = new XQuery( "xs:dateTime(\"1999-07-19T08:23:12.765\") - xs:dateTime(\"1999-07-19T08:23:12.765\") eq xs:dayTimeDuration(\"PT0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-dateTimesSubtract-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The '+' operator is not available between xs:dateTime and xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void kDateTimesSubtract2() { final XQuery query = new XQuery( "xs:dateTime(\"1999-10-12T08:01:23\") + xs:dateTime(\"1999-10-12T08:01:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-dateTimesSubtract-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The 'div' operator is not available between xs:dateTime and xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void kDateTimesSubtract3() { final XQuery query = new XQuery( "xs:dateTime(\"1999-10-12T08:01:23\") div xs:dateTime(\"1999-10-12T08:01:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-dateTimesSubtract-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The '*' operator is not available between xs:dateTime and xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void kDateTimesSubtract4() { final XQuery query = new XQuery( "xs:dateTime(\"1999-10-12T08:01:23\") * xs:dateTime(\"1999-10-12T08:01:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-dateTimesSubtract-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The 'mod' operator is not available between xs:dateTime and xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void kDateTimesSubtract5() { final XQuery query = new XQuery( "xs:dateTime(\"1999-10-12T08:01:23\") mod xs:dateTime(\"1999-10-12T08:01:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-dateTimesSubtract-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The '-' operator is not available between xs:dayTimeDuration and xs:dateTime. * ******************************************************* * . */ @org.junit.Test public void kDateTimesSubtract6() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3D\") - xs:dateTime(\"1999-08-12T08:01:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test subtraction of large to dateTime . */ @org.junit.Test public void cbclSubtractDateTimes001() { final XQuery query = new XQuery( "xs:dateTime(\"-25252734927766554-12-31T12:00:00\") - xs:dateTime(\"25252734927766554-12-31T12:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * test subtraction of large dateTimes . */ @org.junit.Test public void cbclSubtractDateTimes002() { final XQuery query = new XQuery( "xs:dateTime(\"-25252734927766554-12-31T12:00:00\") - xs:dateTime(\"25252734927766554-12-31T12:00:00+01:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * test subtraction of large dateTimes . */ @org.junit.Test public void cbclSubtractDateTimes003() { final XQuery query = new XQuery( "xs:dateTime(\"2008-12-31T12:00:00\") - xs:dateTime(\"2002-12-31T12:00:00+01:00\") + implicit-timezone()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P2192DT1H") ); } /** * test subtraction of large to dateTimes . */ @org.junit.Test public void cbclSubtractDateTimes004() { final XQuery query = new XQuery( "xs:dateTime(\"2002-12-31T12:00:00+01:00\") - xs:dateTime(\"2008-12-31T12:00:00\") - implicit-timezone()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P2192DT1H") ); } /** * * ******************************************************* * Test: op-subtract-dateTimes-yielding-DTD-1 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dateTimes-yielding-DTD" operator * As per example 1 (for this function)of the F&O specs. * ******************************************************* * . */ @org.junit.Test public void opSubtractDateTimesYieldingDTD1() { final XQuery query = new XQuery( "xs:dateTime(\"2000-10-30T06:12:00-05:00\") - xs:dateTime(\"1999-11-28T09:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P337DT2H12M") ); } /** * * ******************************************************* * Test: op-subtract-dateTimes-yielding-DTD-10 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dateTimes-yielding-DTD" operator used * together with an "or" expression. * ******************************************************* * . */ @org.junit.Test public void opSubtractDateTimesYieldingDTD10() { final XQuery query = new XQuery( "fn:string((xs:dateTime(\"1985-07-05T07:07:07Z\") - xs:dateTime(\"1984-07-05T08:08:08Z\"))) or fn:string((xs:dateTime(\"1985-07-05T09:09:09Z\") - xs:dateTime(\"1984-07-05T10:10:10Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dateTimes-yielding-DTD-11 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dateTimes-yielding-DTD" operator used * as part of a "div" expression. * ******************************************************* * . */ @org.junit.Test public void opSubtractDateTimesYieldingDTD11() { final XQuery query = new XQuery( "(xs:dateTime(\"1985-07-05T07:07:07Z\") - xs:dateTime(\"1985-07-05T07:07:07Z\")) div xs:dayTimeDuration(\"P05DT08H11M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * * ******************************************************* * Test: op-subtract-dateTimes-yielding-DTD-12 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dateTimes-yielding-DTD" operator used * with a boolean expression and the "fn:true" function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDateTimesYieldingDTD12() { final XQuery query = new XQuery( "fn:string((xs:dateTime(\"1980-03-02T11:11:11Z\") - xs:dateTime(\"1981-12-12T12:12:12Z\"))) and (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dateTimes-yielding-DTD-13 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dateTimes-yielding-DTD" operator used * together with the numeric-equal-operator "eq". * ******************************************************* * . */ @org.junit.Test public void opSubtractDateTimesYieldingDTD13() { final XQuery query = new XQuery( "fn:string((xs:dateTime(\"1980-05-05T13:13:13Z\") - xs:dateTime(\"1979-10-05T14:14:14Z\"))) eq xs:string(xs:dayTimeDuration(\"P17DT10H02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-dateTimes-yielding-DTD-14 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dateTimes-yielding-DTD" operator used * together with the numeric-equal operator "ne". * ******************************************************* * . */ @org.junit.Test public void opSubtractDateTimesYieldingDTD14() { final XQuery query = new XQuery( "fn:string((xs:dateTime(\"1979-12-12T16:16:16Z\") - xs:dateTime(\"1978-12-12T17:17:17Z\"))) ne xs:string(xs:dayTimeDuration(\"P17DT10H02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dateTimes-yielding-DTD-15 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dateTimes-yielding-DTD" operator used * together with the numeric-equal operator "le". * ******************************************************* * . */ @org.junit.Test public void opSubtractDateTimesYieldingDTD15() { final XQuery query = new XQuery( "fn:string((xs:dateTime(\"1978-12-12T10:09:08Z\") - xs:dateTime(\"1977-12-12T09:08:07Z\"))) le xs:string(xs:dayTimeDuration(\"P17DT10H02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-dateTimes-yielding-DTD-16 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dateTimes-yielding-DTD" operator used * together with the numeric-equal operator "ge". * ******************************************************* * . */ @org.junit.Test public void opSubtractDateTimesYieldingDTD16() { final XQuery query = new XQuery( "fn:string((xs:dateTime(\"1977-12-12T01:02:02Z\") - xs:dateTime(\"1976-12-12T02:03:04Z\"))) ge xs:string(xs:dayTimeDuration(\"P18DT02H02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dateTimes-yielding-DTD-17 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dateTimes-yielding-DTD" function * used as part of a boolean expression (and operator) and the "fn:false" function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDateTimesYieldingDTD17() { final XQuery query = new XQuery( "fn:string(xs:dateTime(\"2000-12-12T12:07:08Z\") - xs:dateTime(\"1999-12-12T13:08:09Z\")) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-dateTimes-yielding-DTD-18 * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dateTimes-yielding-DTD" operator as * part of a boolean expression (or operator) and the "fn:false" function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDateTimesYieldingDTD18() { final XQuery query = new XQuery( "fn:string((xs:dateTime(\"1999-10-23T03:02:01Z\") - xs:dateTime(\"1998-09-09T04:04:05Z\"))) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dateTimes-yielding-DTD-19 * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dates-yielding-DTD" operator as * part of a multiplication expression * ******************************************************* * . */ @org.junit.Test public void opSubtractDateTimesYieldingDTD19() { final XQuery query = new XQuery( "(xs:dateTime(\"1999-10-23T01:01:01Z\") - xs:dateTime(\"1998-09-09T02:02:02Z\")) * xs:decimal(2.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P817DT21H57M58S") ); } /** * * ******************************************************* * Test: op-subtract-dateTimes-yielding-DTD-2 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dateTimes-yielding-DTD" operator * for which the value uses a timezone of "+5:00" * ******************************************************* * . */ @org.junit.Test public void opSubtractDateTimesYieldingDTD2() { final XQuery query = new XQuery( "xs:dateTime(\"2000-12-12T09:08:07+05:00\") - xs:dateTime(\"1999-12-12T09:08:07+05:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P366D") ); } /** * * ******************************************************* * Test: op-subtract-dateTimes-yielding-DTD-20 * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dateTimes-yielding-DTD" operator as * part of a addition expression. * ******************************************************* * . */ @org.junit.Test public void opSubtractDateTimesYieldingDTD20() { final XQuery query = new XQuery( "(xs:dateTime(\"1999-10-23T09:08:07Z\") - xs:dateTime(\"1998-09-09T04:03:02Z\")) + xs:dayTimeDuration(\"P17DT10H02M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P426DT15H7M5S") ); } /** * * ******************************************************* * Test: op-subtract-dateTimes-yielding-DTD-3 * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dateTimes-yielding-DTD" operator, whose * value includes a timezone of "-6.00". * ******************************************************* * . */ @org.junit.Test public void opSubtractDateTimesYieldingDTD3() { final XQuery query = new XQuery( "xs:dateTime(\"2000-02-03T02:09:07-06:00\") - xs:dateTime(\"1998-02-03T02:09:07-06:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P730D") ); } /** * * ******************************************************* * Test: op-subtract-dateTimes-yielding-DTD-4 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dateTimes-yielding-DTD" operator that * return true and used together with fn:not. * ******************************************************* * . */ @org.junit.Test public void opSubtractDateTimesYieldingDTD4() { final XQuery query = new XQuery( "fn:not(fn:string(xs:dateTime(\"1998-09-12T11:12:12Z\") - xs:dateTime(\"1996-02-02T01:01:01Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-dateTimes-yielding-DTD-5 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dateTimes-yielding-DTD" operator that * is used as an argument to the fn:boolean function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDateTimesYieldingDTD5() { final XQuery query = new XQuery( "fn:boolean(fn:string(xs:dateTime(\"1962-03-12T10:09:09Z\") - xs:dateTime(\"1961-02-01T20:10:10Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dateTimes-yielding-DTD-6 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dateTimes-yielding-DTD" operator that * is used as an argument to the fn:number function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDateTimesYieldingDTD6() { final XQuery query = new XQuery( "fn:number(xs:dateTime(\"1988-01-28T10:09:08Z\") - xs:dateTime(\"1987-01-01T01:01:02Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * * ******************************************************* * Test: op-subtract-dateTimes-yielding-DTD-7 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dateTimes-yielding-DTD" operator used * as an argument to the "fn:string" function). * ******************************************************* * . */ @org.junit.Test public void opSubtractDateTimesYieldingDTD7() { final XQuery query = new XQuery( "fn:string(xs:dateTime(\"1989-07-05T02:02:02Z\") - xs:dateTime(\"1988-01-28T03:03:03Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P523DT22H58M59S") ); } /** * * ******************************************************* * Test: op-subtract-dateTimes-yielding-DTD-8 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dateTimes-yielding-DTD" operator that * returns a negative value. * ******************************************************* * . */ @org.junit.Test public void opSubtractDateTimesYieldingDTD8() { final XQuery query = new XQuery( "xs:dateTime(\"0001-01-01T01:01:01Z\") - xs:dateTime(\"2005-07-06T12:12:12Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P732132DT11H11M11S") ); } /** * * ******************************************************* * Test: op-subtract-dateTimes-yielding-DTD-9 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dateTimes-yielding-DTD" operator used * together with an "and" expression. * ******************************************************* * . */ @org.junit.Test public void opSubtractDateTimesYieldingDTD9() { final XQuery query = new XQuery( "fn:string((xs:dateTime(\"1993-12-09T04:04:04Z\") - xs:dateTime(\"1992-12-09T05:05:05Z\"))) and fn:string((xs:dateTime(\"1993-12-09T01:01:01Z\") - xs:dateTime(\"1992-12-09T06:06:06Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpSubtractDates.java000066400000000000000000000602051222453003200300340ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the subtract-dates() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpSubtractDates extends QT3TestSet { /** * * ******************************************************* * Test: K-DatesSubtract-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple testing involving operator '-' between xs:date and xs:date. * ******************************************************* * . */ @org.junit.Test public void kDatesSubtract1() { final XQuery query = new XQuery( "xs:date(\"1999-07-19\") - xs:date(\"1969-11-30\") eq xs:dayTimeDuration(\"P10823D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DatesSubtract-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple testing involving operator '-' between xs:date and xs:date that evaluates to zero. * ******************************************************* * . */ @org.junit.Test public void kDatesSubtract2() { final XQuery query = new XQuery( "xs:date(\"1999-07-19\") - xs:date(\"1999-07-19\") eq xs:dayTimeDuration(\"PT0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DatesSubtract-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The '+' operator is not available between xs:date and xs:date. * ******************************************************* * . */ @org.junit.Test public void kDatesSubtract3() { final XQuery query = new XQuery( "xs:date(\"1999-10-12\") + xs:date(\"1999-10-12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DatesSubtract-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The 'div' operator is not available between xs:date and xs:date. * ******************************************************* * . */ @org.junit.Test public void kDatesSubtract4() { final XQuery query = new XQuery( "xs:date(\"1999-10-12\") div xs:date(\"1999-10-12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DatesSubtract-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The '*' operator is not available between xs:date and xs:date. * ******************************************************* * . */ @org.junit.Test public void kDatesSubtract5() { final XQuery query = new XQuery( "xs:date(\"1999-10-12\") * xs:date(\"1999-10-12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DatesSubtract-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The 'mod' operator is not available between xs:date and xs:date. * ******************************************************* * . */ @org.junit.Test public void kDatesSubtract6() { final XQuery query = new XQuery( "xs:date(\"1999-10-12\") mod xs:date(\"1999-10-12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test subtraction of large dates . */ @org.junit.Test public void cbclSubtractDates001() { final XQuery query = new XQuery( "xs:date(\"-25252734927766554-12-31\") - xs:date(\"25252734927766554-12-31\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * test subtraction of large dates . */ @org.junit.Test public void cbclSubtractDates002() { final XQuery query = new XQuery( "xs:date(\"-25252734927766554-12-31\") - xs:date(\"25252734927766554-12-31+01:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * test subtraction of large dates . */ @org.junit.Test public void cbclSubtractDates003() { final XQuery query = new XQuery( "xs:date(\"2008-12-31\") - xs:date(\"2002-12-31+01:00\") + implicit-timezone()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P2192DT1H") ); } /** * test subtraction of large dates . */ @org.junit.Test public void cbclSubtractDates004() { final XQuery query = new XQuery( "xs:date(\"2002-12-31+01:00\") - xs:date(\"2008-12-31\") - implicit-timezone()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P2192DT1H") ); } /** * * ******************************************************* * Test: op-subtract-dates-yielding-DTD-1 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dates-yielding-DTD" operator * As per example 1 (for this function)of the F&O specs. * ******************************************************* * . */ @org.junit.Test public void opSubtractDatesYieldingDTD1() { final XQuery query = new XQuery( "xs:date(\"2000-10-30\") - xs:date(\"1999-11-28\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P337D") ); } /** * * ******************************************************* * Test: op-subtract-dates-yielding-DTD-10 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dates-yielding-DTD" operator used * together with an "or" expression. * ******************************************************* * . */ @org.junit.Test public void opSubtractDatesYieldingDTD10() { final XQuery query = new XQuery( "fn:string((xs:date(\"1985-07-05Z\") - xs:date(\"1977-12-02Z\"))) or fn:string((xs:date(\"1985-07-05Z\") - xs:date(\"1960-11-07Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dates-yielding-DTD-11 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dates-yielding-DTD" operator used * as part of a "div" expression. * ******************************************************* * . */ @org.junit.Test public void opSubtractDatesYieldingDTD11() { final XQuery query = new XQuery( "(xs:date(\"1978-12-12Z\") - xs:date(\"1978-12-12Z\")) div xs:dayTimeDuration(\"P17DT10H02M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * * ******************************************************* * Test: op-subtract-dates-yielding-DTD-12 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dates-yielding-DTD" operator used * with a boolean expression and the "fn:true" function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDatesYieldingDTD12() { final XQuery query = new XQuery( "fn:string((xs:date(\"1980-03-02Z\") - xs:date(\"2001-09-11Z\"))) and (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dates-yielding-DTD-13 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dates-yielding-DTD" operator used * together with the numeric-equal-operator "eq". * ******************************************************* * . */ @org.junit.Test public void opSubtractDatesYieldingDTD13() { final XQuery query = new XQuery( "fn:string((xs:date(\"1980-05-05Z\") - xs:date(\"1981-12-03Z\"))) eq xs:string(xs:dayTimeDuration(\"P17DT10H02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-dates-yielding-DTD-14 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dates-yielding-DTD" operator used * together with the numeric-equal operator "ne". * ******************************************************* * . */ @org.junit.Test public void opSubtractDatesYieldingDTD14() { final XQuery query = new XQuery( "fn:string((xs:date(\"1979-12-12Z\") - xs:date(\"1979-11-11Z\"))) ne xs:string(xs:dayTimeDuration(\"P17DT10H02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dates-yielding-DTD-15 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dates-yielding-DTD" operator used * together with the numeric-equal operator "le". * ******************************************************* * . */ @org.junit.Test public void opSubtractDatesYieldingDTD15() { final XQuery query = new XQuery( "fn:string((xs:date(\"1978-12-12Z\") - xs:date(\"1977-03-12Z\"))) le xs:string(xs:dayTimeDuration(\"P17DT10H02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-dates-yielding-DTD-16 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dates-yielding-DTD" operator used * together with the numeric-equal operator "ge". * ******************************************************* * . */ @org.junit.Test public void opSubtractDatesYieldingDTD16() { final XQuery query = new XQuery( "fn:string((xs:date(\"1977-12-12Z\") - xs:date(\"1976-12-12Z\"))) ge xs:string(xs:dayTimeDuration(\"P17DT10H02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dates-yielding-DTD-17 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dates-yielding-DTD" operator * used as part of a boolean expression (and operator) and the "fn:false" function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDatesYieldingDTD17() { final XQuery query = new XQuery( "fn:string(xs:date(\"2000-12-12Z\") - xs:date(\"2000-11-11Z\")) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-dates-yielding-DTD-18 * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dates-yielding-DTD" operator as * part of a boolean expression (or operator) and the "fn:false" function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDatesYieldingDTD18() { final XQuery query = new XQuery( "fn:string((xs:date(\"1999-10-23Z\") - xs:date(\"1998-09-09Z\"))) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dates-yielding-DTD-19 * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dates-yielding-DTD" operator as * part of a multiplication expression * ******************************************************* * . */ @org.junit.Test public void opSubtractDatesYieldingDTD19() { final XQuery query = new XQuery( "(xs:date(\"1999-10-23Z\") - xs:date(\"1998-09-09Z\")) * xs:decimal(2.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P818D") ); } /** * * ******************************************************* * Test: op-subtract-dates-yielding-DTD-2 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dates-yielding-DTD" operator * as per example 2 (for this operator) from the F&O specs. * ******************************************************* * . */ @org.junit.Test public void opSubtractDatesYieldingDTD2() { final XQuery query = new XQuery( "xs:date(\"2000-10-30+05:00\") - xs:date(\"1999-11-28Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P336DT19H") ); } /** * * ******************************************************* * Test: op-subtract-dates-yielding-DTD-20 * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dates-yielding-DTD" operator as * part of a addition expression * ******************************************************* * . */ @org.junit.Test public void opSubtractDatesYieldingDTD20() { final XQuery query = new XQuery( "(xs:date(\"1999-10-23Z\") - xs:date(\"1998-09-09Z\")) + xs:dayTimeDuration(\"P17DT10H02M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P426DT10H2M") ); } /** * * ******************************************************* * Test: op-subtract-dates-yielding-DTD-3 * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dates-yielding-DTD" operator as * per example 3 (for this operator) from the F&O specs. * ******************************************************* * . */ @org.junit.Test public void opSubtractDatesYieldingDTD3() { final XQuery query = new XQuery( "xs:date(\"2000-10-15-05:00\") - xs:date(\"2000-10-10+02:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P5DT7H") ); } /** * * ******************************************************* * Test: op-subtract-dates-yielding-DTD-4 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The string value of "subtract-dates-yielding-DTD" * operator that return true and used together with fn:not. * ******************************************************* * . */ @org.junit.Test public void opSubtractDatesYieldingDTD4() { final XQuery query = new XQuery( "fn:not(fn:string(xs:date(\"1998-09-12Z\") - xs:date(\"1998-09-21Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-dates-yielding-DTD-5 * Written By: Carmelo Montanez * Date: July 3, 2005 * Purpose: Evaluates The "subtract-dates-yielding-DTD" operator that * is used as an argument to the fn:boolean function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDatesYieldingDTD5() { final XQuery query = new XQuery( "fn:boolean(fn:string(xs:date(\"1962-03-12Z\") - xs:date(\"1962-03-12Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dates-yielding-DTD-6 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dates-yielding-DTD" operator that * is used as an argument to the fn:number function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDatesYieldingDTD6() { final XQuery query = new XQuery( "fn:number(xs:date(\"1988-01-28Z\") - xs:date(\"2001-03-02\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * * ******************************************************* * Test: op-subtract-dates-yielding-DTD-7 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dates-yielding-DTD" operator used * as an argument to the "fn:string" function). * ******************************************************* * . */ @org.junit.Test public void opSubtractDatesYieldingDTD7() { final XQuery query = new XQuery( "fn:string(xs:date(\"1989-07-05Z\") - xs:date(\"1962-09-04Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P9801D") ); } /** * * ******************************************************* * Test: op-subtract-dates-yielding-DTD-8 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dayTimeDuration-from-date" operator that * returns a negative value. * ******************************************************* * . */ @org.junit.Test public void opSubtractDatesYieldingDTD8() { final XQuery query = new XQuery( "xs:date(\"0001-01-01Z\") - xs:date(\"2005-07-06Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P732132D") ); } /** * * ******************************************************* * Test: op-subtract-dates-yielding-DTD-9 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-dates-yielding-DTD" operator used * together with an "and" expression. * ******************************************************* * . */ @org.junit.Test public void opSubtractDatesYieldingDTD9() { final XQuery query = new XQuery( "fn:string((xs:date(\"1993-12-09Z\") - xs:date(\"1992-10-02Z\"))) and fn:string((xs:date(\"1993-12-09Z\") - xs:date(\"1980-10-20Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpSubtractDayTimeDurationFromDate.java000066400000000000000000000526641222453003200334720ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the subtract-dayTimeDuration-from-date() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpSubtractDayTimeDurationFromDate extends QT3TestSet { /** * * ******************************************************* * Test: K-DateSubtractDTD-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple testing involving operator '-' between xs:date and xs:dayTimeDuration. * ******************************************************* * . */ @org.junit.Test public void kDateSubtractDTD1() { final XQuery query = new XQuery( "xs:date(\"1999-08-12\") - xs:dayTimeDuration(\"P23DT09H32M59S\") eq xs:date(\"1999-07-19\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test subtraction of zero duration from date . */ @org.junit.Test public void cbclSubtractDayTimeDurationFromDate001() { final XQuery query = new XQuery( "declare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string }; declare function local:date($year as xs:integer, $month as xs:integer, $day as xs:integer) { let $m := local:two-digit($month), $d := local:two-digit($day) return xs:date(concat($year, '-', $m, '-', $d)) }; local:date(2008, 05, 12) - xs:dayTimeDuration(\"P0D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2008-05-12") ); } /** * test subtraction of large duration from date . */ @org.junit.Test public void cbclSubtractDayTimeDurationFromDate002() { final XQuery query = new XQuery( "declare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string }; declare function local:date($year as xs:integer, $month as xs:integer, $day as xs:integer) { let $m := local:two-digit($month), $d := local:two-digit($day) return xs:date(concat($year, '-', $m, '-', $d)) }; local:date(-25252734927766555, 05, 12) - xs:dayTimeDuration(\"P4267296D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-date-1 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "subtract-dayTimeDuration-from-date" operator * As per example 1 (for this function)of the F&O specs. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDate1() { final XQuery query = new XQuery( "xs:date(\"2000-10-30\") - xs:dayTimeDuration(\"P3DT1H15M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2000-10-26") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-date-10 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of "subtract-dayTimeDuration-from-date" operator used * together with an "or" expression. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDate10() { final XQuery query = new XQuery( "fn:string((xs:date(\"1985-07-05Z\") - xs:dayTimeDuration(\"P03DT01H04M\"))) or fn:string((xs:date(\"1985-07-05Z\") - xs:dayTimeDuration(\"P01DT01H03M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-date-12 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of "subtract-dayTimeDuration-from-date" operator used * with a boolean expression and the "fn:true" function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDate12() { final XQuery query = new XQuery( "fn:string((xs:date(\"1980-03-02Z\") - xs:dayTimeDuration(\"P05DT08H11M\"))) and (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-date-13 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "subtract-dayTimeDuration-from-date" operator used * together with the numeric-equal-operator "eq". * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDate13() { final XQuery query = new XQuery( "(xs:date(\"1980-05-05Z\") - xs:dayTimeDuration(\"P23DT11H11M\")) eq xs:date(\"1980-05-05Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-date-14 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "subtract-dayTimeDuration-from-date" operator used * together with the numeric-equal operator "ne". * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDate14() { final XQuery query = new XQuery( "(xs:date(\"1979-12-12Z\") - xs:dayTimeDuration(\"P08DT08H05M\")) ne xs:date(\"1979-12-12Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-date-15 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "subtract-dayTimeDuration-from-date" operator used * together with the numeric-equal operator "le". * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDate15() { final XQuery query = new XQuery( "(xs:date(\"1978-12-12Z\") - xs:dayTimeDuration(\"P17DT10H02M\")) le xs:date(\"1978-12-12Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-date-16 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "subtract-dayTimeDuration-from-date" operator used * together with the numeric-equal operator "ge". * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDate16() { final XQuery query = new XQuery( "(xs:date(\"1977-12-12Z\") - xs:dayTimeDuration(\"P18DT02H02M\")) ge xs:date(\"1977-12-12Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-date-2 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of "subtract-dayTimeDuration-from-date" operator * used as part of a boolean expression (and operator) and the "fn:false" function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDate2() { final XQuery query = new XQuery( "fn:string(xs:date(\"2000-12-12Z\") - xs:dayTimeDuration(\"P12DT10H07M\")) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-date-3 * Date: July 1, 2005 * Purpose: Evaluates The string value of "subtract-dayTimeDuration-from-date" operator as * part of a boolean expression (or operator) and the "fn:boolean" function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDate3() { final XQuery query = new XQuery( "fn:string((xs:date(\"1999-10-23Z\") - xs:dayTimeDuration(\"P19DT13H10M\"))) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-date-4 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of "subtract-dayTimeDuration-from-date" operator that * return true and used together with fn:not. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDate4() { final XQuery query = new XQuery( "fn:not(fn:string(xs:date(\"1998-09-12Z\") - xs:dayTimeDuration(\"P02DT07H01M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-date-5 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of "subtract-dayTimeDuration-from-date" operator that * is used as an argument to the fn:boolean function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDate5() { final XQuery query = new XQuery( "fn:boolean(fn:string(xs:date(\"1962-03-12Z\") - xs:dayTimeDuration(\"P03DT08H06M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-date-6 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "subtract-dayTimeDuration-from-date" operator that * is used as an argument to the fn:number function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDate6() { final XQuery query = new XQuery( "fn:number(xs:date(\"1988-01-28Z\") - xs:dayTimeDuration(\"P10DT08H01M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-date-7 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "subtract-dayTimeDuration-from-date" operator used * as an argument to the "fn:string" function). * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDate7() { final XQuery query = new XQuery( "fn:string(xs:date(\"1989-07-05Z\") - xs:dayTimeDuration(\"P01DT09H02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1989-07-03Z") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-date-8 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "subtract-dayTimeDuration-from-date" operator that * returns a negative value. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDate8() { final XQuery query = new XQuery( "(xs:date(\"0001-01-01Z\") - xs:dayTimeDuration(\"P11DT02H02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "-0001-12-20Z") || assertStringValue(false, "0000-12-20Z") ) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-date-9 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of "subtract-dayTimeDuration-from-date" operator used * together with an "and" expression. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDate9() { final XQuery query = new XQuery( "fn:string((xs:date(\"1993-12-09Z\") - xs:dayTimeDuration(\"P03DT01H04M\"))) and fn:string((xs:date(\"1993-12-09Z\") - xs:dayTimeDuration(\"P01DT01H03M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-date2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-dayTimeDuration-from-date" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDate2args1() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") - xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1970-01-01Z") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-date2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-dayTimeDuration-from-date" operator * with the arguments set as follows: * $arg1 = xs:date(mid range) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDate2args2() { final XQuery query = new XQuery( "xs:date(\"1983-11-17Z\") - xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1983-11-17Z") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-date2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-dayTimeDuration-from-date" operator * with the arguments set as follows: * $arg1 = xs:date(upper bound) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDate2args3() { final XQuery query = new XQuery( "xs:date(\"2030-12-31Z\") - xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2030-12-31Z") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-date2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-dayTimeDuration-from-date" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:dayTimeDuration(mid range) * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDate2args4() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") - xs:dayTimeDuration(\"P15DT11H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1969-12-16Z") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-date2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-dayTimeDuration-from-date" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:dayTimeDuration(upper bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDate2args5() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") - xs:dayTimeDuration(\"P31DT23H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1969-11-30Z") ); } } OpSubtractDayTimeDurationFromDateTime.java000066400000000000000000000534211222453003200342220ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/oppackage org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the subtract-dayTimeDuration-from-dateTime() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpSubtractDayTimeDurationFromDateTime extends QT3TestSet { /** * test subtraction of zero duration from dateTime . */ @org.junit.Test public void cbclSubtractDayTimeDurationFromDateTime001() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:two-digit($number as xs:integer) { \n" + " \t\tlet $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string \n" + " \t}; \n" + " \tdeclare function local:dateTime($year as xs:integer, $month as xs:integer, $day as xs:integer, $hour as xs:integer, $mins as xs:integer) { \n" + " \t\tlet $m := local:two-digit($month), $d := local:two-digit($day), $h := local:two-digit($hour), $n := local:two-digit($mins) return xs:dateTime(concat($year, '-', $m, '-', $d, 'T', $h, ':', $n, ':00')) \n" + " \t}; \n" + " \tlocal:dateTime(2008, 05, 12, 12, 59) - xs:dayTimeDuration(\"P0D\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2008-05-12T12:59:00") ); } /** * test subtraction of large duration from date . */ @org.junit.Test public void cbclSubtractDayTimeDurationFromDateTime002() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:two-digit($number as xs:integer) { \n" + " \t\tlet $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string \n" + " \t}; \n" + " \tdeclare function local:dateTime($year as xs:integer, $month as xs:integer, $day as xs:integer, $hour as xs:integer, $mins as xs:integer) { \n" + " \t\tlet $m := local:two-digit($month), $d := local:two-digit($day), $h := local:two-digit($hour), $n := local:two-digit($mins) return xs:dateTime(concat($year, '-', $m, '-', $d, 'T', $h, ':', $n, ':00')) \n" + " \t}; \n" + " \tlocal:dateTime(-25252734927766554, 05, 12, 12, 59) - xs:dayTimeDuration(\"P0D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FODT0001") || assertStringValue(false, "-25252734927766554-05-12T12:59:00") ) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-dateTime-1 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "subtract-dayTimeDuration-from-dateTime" operator * As per example 1 (for this function)of the F&O specs. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDateTime1() { final XQuery query = new XQuery( "xs:dateTime(\"2000-10-30T11:12:00\") - xs:dayTimeDuration(\"P3DT1H15M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2000-10-27T09:57:00") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-dateTime-10 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of "subtract-dayTimeDuration-from-dateTime" * operator used together with an "or" expression. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDateTime10() { final XQuery query = new XQuery( "fn:string((xs:dateTime(\"1985-07-05T14:14:14Z\") - xs:dayTimeDuration(\"P03DT01H04M\"))) or fn:string((xs:dateTime(\"1985-07-05T15:15:15Z\") - xs:dayTimeDuration(\"P01DT01H03M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-dateTime-12 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of the "subtract-dayTimeDuration-from-dateTime" * operator used with a boolean expression and the "fn:true" function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDateTime12() { final XQuery query = new XQuery( "fn:string((xs:dateTime(\"1980-03-02T16:12:10Z\") - xs:dayTimeDuration(\"P05DT08H11M\"))) and (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-dateTime-13 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "subtract-dayTimeDuration-from-dateTime" operator used * together with the numeric-equal-operator "eq". * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDateTime13() { final XQuery query = new XQuery( "(xs:dateTime(\"1980-05-05T17:17:17Z\") - xs:dayTimeDuration(\"P23DT11H11M\")) eq xs:dateTime(\"1980-05-05T17:17:17Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-dateTime-14 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "subtract-dayTimeDuration-from-dateTime" operator used * together with the numeric-equal operator "ne". * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDateTime14() { final XQuery query = new XQuery( "(xs:dateTime(\"1979-12-12T18:18:18Z\") - xs:dayTimeDuration(\"P08DT08H05M\")) ne xs:dateTime(\"1979-12-12T16:15:14Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-dateTime-15 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "subtract-dayTimeDuration-from-dateTime" operator used * together with the numeric-equal operator "le". * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDateTime15() { final XQuery query = new XQuery( "(xs:dateTime(\"1978-12-12T12:45:12Z\") - xs:dayTimeDuration(\"P17DT10H02M\")) le xs:dateTime(\"1978-12-12T16:34:23Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-dateTime-16 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "subtract-dayTimeDuration-from-dateTime" operator used * together with the numeric-equal operator "ge". * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDateTime16() { final XQuery query = new XQuery( "(xs:dateTime(\"1977-12-12T13:12:15Z\") - xs:dayTimeDuration(\"P18DT02H02M\")) ge xs:dateTime(\"1977-12-12T15:56:10Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-dateTime-2 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of the "subtract-dayTimeDuration-from-dateTime" * operator used as part of a boolean expression (and operator) and the "fn:false" * function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDateTime2() { final XQuery query = new XQuery( "fn:string(xs:dateTime(\"2000-12-12T11:10:03Z\") - xs:dayTimeDuration(\"P12DT10H07M\")) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-dateTime-3 * Date: July 1, 2005 * Purpose: Evaluates The string value of "subtract-dayTimeDuration-from-dateTime" * operator part of a boolean expression (or operator) and the "fn:boolean" function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDateTime3() { final XQuery query = new XQuery( "fn:string((xs:dateTime(\"1999-10-23T03:12:23Z\") - xs:dayTimeDuration(\"P19DT13H10M\"))) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-dateTime-4 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of "subtract-dayTimeDuration-from-dateTime" * operator that return true and used together with fn:not. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDateTime4() { final XQuery query = new XQuery( "fn:not(fn:string(xs:dateTime(\"1998-09-12T13:23:23Z\") - xs:dayTimeDuration(\"P02DT07H01M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-dateTime-5 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of "subtract-dayTimeDuration-from-dateTime" * operator that is used as an argument to the fn:boolean function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDateTime5() { final XQuery query = new XQuery( "fn:boolean(fn:string(xs:dateTime(\"1962-03-12T12:34:09Z\") - xs:dayTimeDuration(\"P03DT08H06M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-dateTime-6 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "subtract-dayTimeDuration-from-dateTime" operator that * is used as an argument to the fn:number function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDateTime6() { final XQuery query = new XQuery( "fn:number(xs:dateTime(\"1988-01-28T12:34:12Z\") - xs:dayTimeDuration(\"P10DT08H01M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-dateTime-7 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "subtract-dayTimeDuration-from-dateTime" operator used * as an argument to the "fn:string" function). * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDateTime7() { final XQuery query = new XQuery( "fn:string(xs:dateTime(\"1989-07-05T10:10:10Z\") - xs:dayTimeDuration(\"P01DT09H02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1989-07-04T01:08:10Z") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-dateTime-8 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "subtract-dayTimeDuration-from-dateTime" operator that * returns a negative value. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDateTime8() { final XQuery query = new XQuery( "(xs:dateTime(\"0001-01-01T11:11:11Z\") - xs:dayTimeDuration(\"-P11DT02H02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0001-01-12T13:13:11Z") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-dateTime-9 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of the "subtract-dayTimeDuration-from-dateTime" * operator used together with an "and" expression. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDateTime9() { final XQuery query = new XQuery( "fn:string((xs:dateTime(\"1993-12-09T13:13:13Z\") - xs:dayTimeDuration(\"P03DT01H04M\"))) and fn:string((xs:dateTime(\"1993-12-09T13:13:13Z\") - xs:dayTimeDuration(\"P01DT01H03M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-dateTime2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-dayTimeDuration-from-dateTime" operator * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDateTime2args1() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") - xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1970-01-01T00:00:00Z") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-dateTime2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-dayTimeDuration-from-dateTime" operator * with the arguments set as follows: * $arg1 = xs:dateTime(mid range) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDateTime2args2() { final XQuery query = new XQuery( "xs:dateTime(\"1996-04-07T01:40:52Z\") - xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1996-04-07T01:40:52Z") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-dateTime2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-dayTimeDuration-from-dateTime" operator * with the arguments set as follows: * $arg1 = xs:dateTime(upper bound) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDateTime2args3() { final XQuery query = new XQuery( "xs:dateTime(\"2030-12-31T23:59:59Z\") - xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2030-12-31T23:59:59Z") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-dateTime2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-dayTimeDuration-from-dateTime" operator * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dayTimeDuration(mid range) * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDateTime2args4() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") - xs:dayTimeDuration(\"P15DT11H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1969-12-16T12:00:01Z") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-dateTime2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-dayTimeDuration-from-dateTime" operator * with the arguments set as follows: * $arg1 = xs:dateTime(lower bound) * $arg2 = xs:dayTimeDuration(upper bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromDateTime2args5() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") - xs:dayTimeDuration(\"P31DT23H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1969-11-30T00:00:01Z") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpSubtractDayTimeDurationFromTime.java000066400000000000000000000611341222453003200335030ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the subtract-dayTimeDuration-from-time() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpSubtractDayTimeDurationFromTime extends QT3TestSet { /** * * ******************************************************* * Test: K-TimeSubtractDTD-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple testing involving operator '-' between xs:time and xs:dayTimeDuration. * ******************************************************* * . */ @org.junit.Test public void kTimeSubtractDTD1() { final XQuery query = new XQuery( "xs:time(\"08:12:32\") - xs:dayTimeDuration(\"P23DT09H32M59S\") eq xs:time(\"22:39:33\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-TimeSubtractDTD-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The '+' operator is not available between xs:yearMonthDuration and xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeSubtractDTD2() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y\") + xs:time(\"08:01:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-TimeSubtractDTD-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The '+' operator is not available between xs:time and xs:yearMonthDuration. * ******************************************************* * . */ @org.junit.Test public void kTimeSubtractDTD3() { final XQuery query = new XQuery( "xs:time(\"08:01:23\") + xs:yearMonthDuration(\"P1Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-TimeSubtractDTD-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The '-' operator is not available between xs:yearMonthDuration and xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeSubtractDTD4() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y\") - xs:time(\"08:01:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-TimeSubtractDTD-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The '-' operator is not available between xs:time and xs:yearMonthDuration. * ******************************************************* * . */ @org.junit.Test public void kTimeSubtractDTD5() { final XQuery query = new XQuery( "xs:time(\"08:01:23\") - xs:yearMonthDuration(\"P1Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test subtraction of zero duration from time . */ @org.junit.Test public void cbclSubtractDayTimeDurationFromTime001() { final XQuery query = new XQuery( "\n" + " declare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string };\n" + " declare function local:time($hour as xs:integer, $mins as xs:integer) { let $h := local:two-digit($hour), $m := local:two-digit($mins) return xs:time(concat($h, ':', $m, ':00')) };\n" + " local:time(12, 59) - xs:dayTimeDuration(\"P0D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12:59:00") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-time-1 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "subtract-dayTimeDuration-from-time" operator * As per example 1 (for this function)of the F&O specs. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromTime1() { final XQuery query = new XQuery( "xs:time(\"11:12:00\") - xs:dayTimeDuration(\"P3DT1H15M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "09:57:00") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-time-10 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of "subtract-dayTimeDuration-from-time" operator used * together with an "or" expression. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromTime10() { final XQuery query = new XQuery( "fn:string((xs:time(\"23:45:50Z\") - xs:dayTimeDuration(\"P03DT01H04M\"))) or fn:string((xs:time(\"23:45:50Z\") + xs:dayTimeDuration(\"P01DT01H03M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-time-12 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of "subtract-dayTimeDuration-from-time" operator used * with a boolean expression and the "fn:true" function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromTime12() { final XQuery query = new XQuery( "fn:string((xs:time(\"02:02:02Z\") - xs:dayTimeDuration(\"P05DT08H11M\"))) and (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-time-13 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "subtract-dayTimeDuration-from-time" operator used * together with the numeric-equal-operator "eq". * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromTime13() { final XQuery query = new XQuery( "(xs:time(\"01:03:03Z\") - xs:dayTimeDuration(\"P23DT11H11M\")) eq xs:time(\"04:03:05Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-time-14 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "subtract-dayTimeDuration-from-time" operator used * together with the numeric-equal operator "ne". * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromTime14() { final XQuery query = new XQuery( "(xs:time(\"04:04:05Z\") - xs:dayTimeDuration(\"P08DT08H05M\")) ne xs:time(\"05:08:02Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-time-15 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of "subtract-dayTimeDuration-from-time" operator used * together with the numeric-equal operator "le". * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromTime15() { final XQuery query = new XQuery( "fn:string((xs:time(\"08:09:09Z\") - xs:dayTimeDuration(\"P17DT10H02M\"))) le fn:string(xs:time(\"09:08:10Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-time-16 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of the "subtract-dayTimeDuration-from-time" operator used * together with the numeric-equal operator "ge". * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromTime16() { final XQuery query = new XQuery( "fn:string((xs:time(\"09:06:07Z\") - xs:dayTimeDuration(\"P18DT02H02M\"))) ge fn:string(xs:time(\"01:01:01Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-time-17 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "subtract-dayTimeDuration-from-time" operator * used as part of a boolean expression (and operator) and the "fn:false" function. * Should raise a type error. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromTime17() { final XQuery query = new XQuery( "fn:string(xs:time(\"12:07:08Z\") - xs:dayTimeDuration(\"P12DT10H07M\")) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-time-2 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "subtract-dayTimeDuration-from-time" operator * as per example 2 (for this function) from the F&O specs. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromTime2() { final XQuery query = new XQuery( "xs:time(\"08:20:00-05:00\") - xs:dayTimeDuration(\"P23DT10H10M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "22:10:00-05:00") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-time-3 * Date: July 1, 2005 * Purpose: Evaluates The string value "subtract-dayTimeDuration-from-time" operator as * part of a boolean expression (or operator) and the "fn:boolean" function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromTime3() { final XQuery query = new XQuery( "fn:string((xs:time(\"12:12:01Z\") - xs:dayTimeDuration(\"P19DT13H10M\"))) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-time-4 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of "subtract-dayTimeDuration-from-time" operator that * return true and used together with fn:not. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromTime4() { final XQuery query = new XQuery( "fn:not(fn:string(xs:time(\"20:50:50Z\") - xs:dayTimeDuration(\"P02DT07H01M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-time-5 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value of "subtract-dayTimeDuration-from-time" operator that * is used as an argument to the fn:boolean function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromTime5() { final XQuery query = new XQuery( "fn:boolean(fn:string(xs:time(\"23:55:55Z\") - xs:dayTimeDuration(\"P03DT08H06M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-time-6 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "subtract-dayTimeDuration-from-time" operator that * is used as an argument to the fn:number function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromTime6() { final XQuery query = new XQuery( "fn:number(xs:time(\"10:11:45Z\") - xs:dayTimeDuration(\"P10DT08H01M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-time-7 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "subtract-dayTimeDuration-from-time" operator used * as an argument to the "fn:string" function). * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromTime7() { final XQuery query = new XQuery( "fn:string(xs:time(\"19:45:55Z\") - xs:dayTimeDuration(\"P01DT09H02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10:43:55Z") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-time-8 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The "subtract-dayTimeDuration-from-time" operator that * returns a negative value. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromTime8() { final XQuery query = new XQuery( "(xs:time(\"01:01:01\") - xs:dayTimeDuration(\"-P11DT02H02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "03:03:01") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-time-9 * Written By: Carmelo Montanez * Date: July 1, 2005 * Purpose: Evaluates The string value "subtract-dayTimeDuration-from-time" subtract used * together with and "and" expression. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromTime9() { final XQuery query = new XQuery( "fn:string((xs:time(\"10:10:10Z\") - xs:dayTimeDuration(\"P02DT09H02M\"))) and fn:string((xs:time(\"09:02:02Z\") - xs:dayTimeDuration(\"P04DT04H04M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-time2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-dayTimeDuration-from-time" operator * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromTime2args1() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") - xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "00:00:00Z") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-time2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-dayTimeDuration-from-time" operator * with the arguments set as follows: * $arg1 = xs:time(mid range) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromTime2args2() { final XQuery query = new XQuery( "xs:time(\"08:03:35Z\") - xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "08:03:35Z") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-time2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-dayTimeDuration-from-time" operator * with the arguments set as follows: * $arg1 = xs:time(upper bound) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromTime2args3() { final XQuery query = new XQuery( "xs:time(\"23:59:59Z\") - xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "23:59:59Z") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-time2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-dayTimeDuration-from-time" operator * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:dayTimeDuration(mid range) * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromTime2args4() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") - xs:dayTimeDuration(\"P15DT11H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12:00:01Z") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDuration-from-time2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-dayTimeDuration-from-time" operator * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:dayTimeDuration(upper bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurationFromTime2args5() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") - xs:dayTimeDuration(\"P31DT23H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "00:00:01Z") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpSubtractDayTimeDurations.java000066400000000000000000001443131222453003200322240ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the subtract-dayTimeDurations() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpSubtractDayTimeDurations extends QT3TestSet { /** * * ******************************************************* * Test: K-DayTimeDurationSubtract-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of substraction an xs:dayTimeDuration with PT0S. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationSubtract1() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT4H3M3.100S\") - xs:dayTimeDuration(\"PT0S\") eq xs:dayTimeDuration(\"P3DT4H3M3.100S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DayTimeDurationSubtract-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of substraction PT0S with an xs:dayTimeDuration. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationSubtract2() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"PT0S\") - xs:dayTimeDuration(\"P3DT4H3M3.100S\") eq xs:dayTimeDuration(\"-P3DT4H3M3.100S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DayTimeDurationSubtract-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of substraction two arbitrary xs:dayTimeDurations. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationSubtract3() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"PT0S\") - xs:dayTimeDuration(\"P3DT4H3M3.100S\") eq xs:dayTimeDuration(\"-P3DT4H3M3.100S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-DayTimeDurationSubtract-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The substraction operator is not available between xs:dayTimeDuration and xs:yearMonthDuration. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationSubtract4() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3D\") - xs:yearMonthDuration(\"P3Y3M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DayTimeDurationSubtract-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The substraction operator is not available between xs:yearMonthDuration and xs:dayTimeDuration. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationSubtract5() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P3Y3M\") - xs:dayTimeDuration(\"P3D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DayTimeDurationSubtract-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The substraction operator is not available between xs:duration and xs:yearMonthDuration. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationSubtract6() { final XQuery query = new XQuery( "xs:duration(\"P3D\") - xs:yearMonthDuration(\"P3Y3M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DayTimeDurationSubtract-7 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The substraction operator is not available between xs:yearMonthDuration and xs:duration. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationSubtract7() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P3Y3M\") - xs:duration(\"P3D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DayTimeDurationSubtract-8 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The substraction operator is not available between xs:dayTimeDuration and xs:duration. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationSubtract8() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3D\") - xs:duration(\"P3Y3M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-DayTimeDurationSubtract-9 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The substraction operator is not available between xs:duration and xs:dayTimeDuration. * ******************************************************* * . */ @org.junit.Test public void kDayTimeDurationSubtract9() { final XQuery query = new XQuery( "xs:duration(\"P3Y3M\") - xs:dayTimeDuration(\"P3D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K2-DayTimeDurationSubtract-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Ensure that a value from current-time() can be extracted. * ******************************************************* * . */ @org.junit.Test public void k2DayTimeDurationSubtract1() { final XQuery query = new XQuery( "(current-time() - xs:dayTimeDuration(\"PT3H\")) ne current-time()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K2-DayTimeDurationSubtract-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Ensure that a value from current-dateTime() can be extracted. * ******************************************************* * . */ @org.junit.Test public void k2DayTimeDurationSubtract2() { final XQuery query = new XQuery( "(current-dateTime() - xs:dayTimeDuration(\"PT3H\")) lt current-dateTime()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus001() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") }; xs:date(\"1997-01-01\") - local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1996-12-31") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus002() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") }; xs:date(\"1997-01-01\") - local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus003() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:yearMonthDuration(\"P1M\") }; xs:date(\"1997-01-01\") - local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1996-12-01") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus004() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:yearMonthDuration(\"P1M\") }; xs:date(\"1997-01-01\") - local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus005() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") }; xs:dateTime(\"1997-01-01T12:00:00\") - local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1996-12-31T12:00:00") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus006() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") }; xs:dateTime(\"1997-01-01T12:00:00\") - local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus007() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:yearMonthDuration(\"P1M\") }; xs:dateTime(\"1997-01-01T12:00:00\") - local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1996-12-01T12:00:00") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus008() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:yearMonthDuration(\"P1M\") }; xs:dateTime(\"1997-01-01T12:00:00\") - local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus009() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"PT1H\") }; xs:time(\"12:00:00\") - local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "11:00:00") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus010() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1H\") }; xs:time(\"12:00:00\") - local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus011() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") }; xs:dayTimeDuration(\"PT1H\") - local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-PT23H") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus012() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") }; xs:dayTimeDuration(\"PT1H\") - local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus013() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") }; xs:yearMonthDuration(\"P1Y\") - local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P11M") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus014() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") }; xs:yearMonthDuration(\"P1Y\") - local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus015() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") }; local:f(false()) - xs:date(\"1997-01-01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus016() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") }; local:f(true()) - xs:date(\"1997-01-01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus017() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:yearMonthDuration(\"P1M\") }; local:f(false()) - xs:date(\"1997-01-01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus018() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:yearMonthDuration(\"P1M\") }; local:f(true()) - xs:date(\"1997-01-01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus019() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") }; local:f(false()) - xs:dateTime(\"1997-01-01T12:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus020() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") }; local:f(true()) - xs:dateTime(\"1997-01-01T12:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus021() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:yearMonthDuration(\"P1M\") }; local:f(false()) - xs:dateTime(\"1997-01-01T12:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus022() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:yearMonthDuration(\"P1M\") }; local:f(true()) - xs:dateTime(\"1997-01-01T12:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus023() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"PT1H\") }; local:f(false()) - xs:time(\"12:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus024() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1H\") }; local:f(true()) - xs:time(\"12:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus025() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") }; local:f(false()) - xs:dayTimeDuration(\"PT1H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT23H") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus026() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") }; local:f(true()) - xs:dayTimeDuration(\"PT1H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus027() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") }; local:f(false()) - xs:yearMonthDuration(\"P1Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P11M") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus028() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") }; local:f(true()) - xs:yearMonthDuration(\"P1Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus029() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") }; local:f(false()) - local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P0M") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus030() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") }; local:f(true()) - local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus031() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") }; local:f(false()) - local:f(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus032() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") }; local:f(true()) - local:f(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus033() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") }; declare function local:g($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") }; local:f(false()) - local:g(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test behaviour of minus operator when presented with an expression with static type duration . */ @org.junit.Test public void cbclMinus034() { final XQuery query = new XQuery( "declare function local:f($x) { if ($x) then xs:duration(\"P1D\") else xs:dayTimeDuration(\"P1D\") }; declare function local:g($x) { if ($x) then xs:duration(\"P1M\") else xs:yearMonthDuration(\"P1M\") }; local:f(true()) - local:g(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test subtraction of zero duration from dayTimeDuration . */ @org.junit.Test public void cbclSubtractDayTimeDurations001() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($days as xs:integer, $hours as xs:integer ) { xs:dayTimeDuration(concat('P', $days, 'DT', $hours, 'H')) }; local:dayTimeDuration(1, 1) - xs:dayTimeDuration(\"P0D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1DT1H") ); } /** * test subtraction of dayTimeDurations . */ @org.junit.Test public void cbclSubtractDayTimeDurations002() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($days as xs:integer, $hours as xs:integer ) { xs:dayTimeDuration(concat('P', $days, 'DT', $hours, 'H')) }; local:dayTimeDuration(1, 1) - local:dayTimeDuration(1, 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * test subtraction of large dayTimeDuration . */ @org.junit.Test public void cbclSubtractDayTimeDurations003() { final XQuery query = new XQuery( "declare function local:dayTimeDuration($days as xs:integer, $hours as xs:integer ) { xs:dayTimeDuration(concat('P', $days, 'DT', $hours, 'H')) }; xs:dayTimeDuration(\"-P5000000000000000000D\") - local:dayTimeDuration(5000000000000000000, 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDurations-1 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "subtract-dayTimeDurations" function * As per example 1 (for this function)of the F&O specs. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurations1() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P2DT12H\") - xs:dayTimeDuration(\"P1DT10H30M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1DT1H30M") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDurations-10 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "subtract-dayTimeDurations" function used * together with an "or" expression. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurations10() { final XQuery query = new XQuery( "fn:string((xs:dayTimeDuration(\"P05DT09H02M\") - xs:dayTimeDuration(\"P03DT01H04M\"))) or fn:string((xs:dayTimeDuration(\"P05DT05H03M\") - xs:dayTimeDuration(\"P01DT01H03M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDurations-11 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "subtract-dayTimeDurations" function used * together with a "div" expression. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurations11() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P42DT10H10M\") - xs:dayTimeDuration(\"P10DT10H10M\")) div (xs:dayTimeDuration(\"P20DT10H10M\") - xs:dayTimeDuration(\"P18DT10H10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "16") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDurations-12 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "subtract-dayTimeDurations" operators used * with a boolean expression and the "fn:true" function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurations12() { final XQuery query = new XQuery( "fn:string((xs:dayTimeDuration(\"P10DT08H11M\") - xs:dayTimeDuration(\"P05DT08H11M\"))) and (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDurations-13 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "subtract-dayTimeDurations" function used * together with the numeric-equal-operator "eq". * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurations13() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P23DT11H11M\") - xs:dayTimeDuration(\"P23DT11H11M\")) eq xs:dayTimeDuration(\"P23DT11H11M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDurations-14 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "subtract-dayTimeDurations" function used * together with the numeric-equal operator "ne". * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurations14() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P21DT08H12M\") - xs:dayTimeDuration(\"P08DT08H05M\")) ne xs:dayTimeDuration(\"P08DT08H05M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDurations-15 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "subtract-dayTimeDurations" function used * together with the numeric-equal operator "le". * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurations15() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P10DT10H01M\") - xs:dayTimeDuration(\"P17DT10H02M\")) le xs:dayTimeDuration(\"P17DT10H02M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDurations-16 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "subtract-dayTimeDurations" function used * together with the numeric-equal operator "ge". * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurations16() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P13DT09H09M\") - xs:dayTimeDuration(\"P18DT02H02M\")) ge xs:dayTimeDuration(\"P18DT02H02M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDurations-2 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The string value of "subtract-dayTimeDurations" function * used as part of a boolean expression (and operator) and the "fn:false" function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurations2() { final XQuery query = new XQuery( "fn:string(xs:dayTimeDuration(\"P10DT10H11M\") - xs:dayTimeDuration(\"P12DT10H07M\")) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDurations-3 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "subtract-dayTimeDurations" function as * part of a boolean expression (or operator) and the "fn:boolean" function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurations3() { final XQuery query = new XQuery( "fn:string(xs:dayTimeDuration(\"P20DT20H10M\") - xs:dayTimeDuration(\"P19DT13H10M\")) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDurations-4 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "subtract-dayTimeDurations" function that * return true and used together with fn:not. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurations4() { final XQuery query = new XQuery( "fn:not(fn:string(xs:dayTimeDuration(\"P11DT12H04M\") - xs:dayTimeDuration(\"P02DT07H01M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDurations-5 * Written By: Carmelo Montanez * Date: June 29 2005 * Purpose: Evaluates The "subtract-dayTimeDurations" function that * is used as an argument to the fn:boolean function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurations5() { final XQuery query = new XQuery( "fn:boolean(fn:string(xs:dayTimeDuration(\"P05DT09H08M\") - xs:dayTimeDuration(\"P03DT08H06M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDurations-6 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "subtract-dayTimeDurations" operator that * is used as an argument to the fn:number function. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurations6() { final XQuery query = new XQuery( "fn:number(xs:dayTimeDuration(\"P02DT06H09M\") - xs:dayTimeDuration(\"P10DT08H01M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDurations-7 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "subtract-dayTimeDurations" function used * as an argument to the "fn:string" function). * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurations7() { final XQuery query = new XQuery( "fn:string(xs:dayTimeDuration(\"P03DT04H08M\") - xs:dayTimeDuration(\"P01DT09H02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1DT19H6M") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDurations-8 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "subtract-dayTimeDurations" function that * returns a negative value. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurations8() { final XQuery query = new XQuery( "(xs:dayTimeDuration(\"P10DT01H01M\") - xs:dayTimeDuration(\"P11DT02H02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P1DT1H1M") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDurations-9 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "subtract-dayTimeDurations" function used * together with and "and" expression. * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurations9() { final XQuery query = new XQuery( "fn:string((xs:dayTimeDuration(\"P01DT02H01M\") - xs:dayTimeDuration(\"P02DT09H02M\"))) and fn:string((xs:dayTimeDuration(\"P02DT03H03M\") - xs:dayTimeDuration(\"P04DT04H04M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDurations2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-dayTimeDurations" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(lower bound) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurations2args1() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") - xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDurations2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-dayTimeDurations" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(mid range) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurations2args2() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P15DT11H59M59S\") - xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P15DT11H59M59S") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDurations2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-dayTimeDurations" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(upper bound) * $arg2 = xs:dayTimeDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurations2args3() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P31DT23H59M59S\") - xs:dayTimeDuration(\"P0DT0H0M0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P31DT23H59M59S") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDurations2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-dayTimeDurations" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(lower bound) * $arg2 = xs:dayTimeDuration(mid range) * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurations2args4() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") - xs:dayTimeDuration(\"P15DT11H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P15DT11H59M59S") ); } /** * * ******************************************************* * Test: op-subtract-dayTimeDurations2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-dayTimeDurations" operator * with the arguments set as follows: * $arg1 = xs:dayTimeDuration(lower bound) * $arg2 = xs:dayTimeDuration(upper bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractDayTimeDurations2args5() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P0DT0H0M0S\") - xs:dayTimeDuration(\"P31DT23H59M59S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P31DT23H59M59S") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpSubtractTimes.java000066400000000000000000000662531222453003200300660ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the subtract-times() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpSubtractTimes extends QT3TestSet { /** * * ******************************************************* * Test: K-TimeSubtract-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple testing involving operator '-' between xs:time and xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeSubtract1() { final XQuery query = new XQuery( "xs:time(\"08:12:32\") - xs:time(\"18:12:32\") eq xs:dayTimeDuration(\"-PT10H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-TimeSubtract-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple testing involving operator '-' between xs:time and xs:time, that evaluates to zero. * ******************************************************* * . */ @org.junit.Test public void kTimeSubtract2() { final XQuery query = new XQuery( "xs:time(\"08:12:32\") - xs:time(\"08:12:32\") eq xs:dayTimeDuration(\"PT0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-TimeSubtract-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The '-' operator is not available between xs:yearMonthDuration and xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeSubtract3() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3D\") - xs:time(\"08:01:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-TimeSubtract-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The '-' operator is not available between xs:yearMonthDuration and xs:date. * ******************************************************* * . */ @org.junit.Test public void kTimeSubtract4() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3D\") - xs:date(\"1999-08-12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-TimeSubtract-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The '+' operator is not available between xs:time and xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeSubtract5() { final XQuery query = new XQuery( "xs:time(\"08:01:23\") + xs:time(\"08:01:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-TimeSubtract-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The '+' operator is not available between xs:time and xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeSubtract6() { final XQuery query = new XQuery( "xs:time(\"08:01:23\") * xs:time(\"08:01:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-TimeSubtract-7 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The '-' operator is not available between xs:time and xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeSubtract7() { final XQuery query = new XQuery( "xs:time(\"08:01:23\") div xs:time(\"08:01:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-TimeSubtract-8 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The 'mod' operator is not available between xs:time and xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeSubtract8() { final XQuery query = new XQuery( "xs:time(\"08:01:23\") mod xs:time(\"08:01:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test subtraction of times . */ @org.junit.Test public void cbclSubtractTimes001() { final XQuery query = new XQuery( "xs:time(\"12:00:00+01:00\") - xs:time(\"12:00:00\") - implicit-timezone()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-PT1H") ); } /** * test subtraction of times . */ @org.junit.Test public void cbclSubtractTimes002() { final XQuery query = new XQuery( "xs:time(\"12:00:00\") - xs:time(\"12:00:00+01:00\") + implicit-timezone()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT1H") ); } /** * test subtraction of times . */ @org.junit.Test public void cbclSubtractTimes003() { final XQuery query = new XQuery( "\n" + " fn:adjust-time-to-timezone(xs:time(\"12:00:00\")) - fn:adjust-time-to-timezone(xs:time(\"08:00:00+05:00\"), xs:dayTimeDuration(\"PT1H\")) + implicit-timezone()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT9H") ); } /** * test subtraction of times . */ @org.junit.Test public void cbclSubtractTimes004() { final XQuery query = new XQuery( "\n" + " fn:adjust-time-to-timezone(xs:time(\"08:00:00+05:00\"), xs:dayTimeDuration(\"PT1H\")) - fn:adjust-time-to-timezone(xs:time(\"12:00:00\")) - implicit-timezone()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-PT9H") ); } /** * * ******************************************************* * Test: op-subtract-times-1 * Written By: Carmelo Montanez * Date: June 26, 2005 * Purpose: Evaluates The "subtract-times" function * As per example 1 (for this function)of the F&O specs * ******************************************************* * . */ @org.junit.Test public void opSubtractTimes1() { final XQuery query = new XQuery( "xs:time(\"11:12:00Z\") - xs:time(\"04:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT7H12M") ); } /** * * ******************************************************* * Test: op-subtract-times-10 * Written By: Carmelo Montanez * Date: June 27, 2005 * Purpose: Evaluates The "subtract-times" function used * together with an "or" expression. * Uses the "fn:string" function to account for new EBV rules. * ******************************************************* * . */ @org.junit.Test public void opSubtractTimes10() { final XQuery query = new XQuery( "fn:string((xs:time(\"13:00:00Z\") - xs:time(\"17:00:00Z\"))) or fn:string((xs:time(\"13:00:00Z\") - xs:time(\"17:00:00Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-times-11 * Written By: Carmelo Montanez * Date: June 27, 2005 * Purpose: Evaluates The "subtract-times" function used * together with a "div" expression. * ******************************************************* * . */ @org.junit.Test public void opSubtractTimes11() { final XQuery query = new XQuery( "(xs:time(\"23:00:00Z\") - xs:time(\"17:00:00Z\")) div (xs:time(\"13:00:00Z\") - xs:time(\"10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * * ******************************************************* * Test: op-subtract-times-12 * Written By: Carmelo Montanez * Date: June 28, 2005 * Purpose: Evaluates The "subtract-times" operators used * with a boolean expression and the "fn:true" function. * Uses the "fn:string" function to account for new EBV rules. * ******************************************************* * . */ @org.junit.Test public void opSubtractTimes12() { final XQuery query = new XQuery( "fn:string((xs:time(\"17:00:00Z\") - xs:time(\"13:00:00Z\"))) and (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-times-13 * Written By: Carmelo Montanez * Date: June 28, 2005 * Purpose: Evaluates The "subtract-times" function used * together with the numeric-equal- operator "eq". * ******************************************************* * . */ @org.junit.Test public void opSubtractTimes13() { final XQuery query = new XQuery( "(xs:time(\"13:00:00Z\") - xs:time(\"17:00:00Z\")) eq xs:dayTimeDuration(\"P20DT01H02M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-times-14 * Written By: Carmelo Montanez * Date: June 28, 2005 * Purpose: Evaluates The "subtract-times" function used * together with the numeric-equal operator "ne". * ******************************************************* * . */ @org.junit.Test public void opSubtractTimes14() { final XQuery query = new XQuery( "(xs:time(\"13:00:00Z\") - xs:time(\"17:00:00Z\")) ne xs:dayTimeDuration(\"P10DT01H01M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-times-15 * Written By: Carmelo Montanez * Date: June 28, 2005 * Purpose: Evaluates The "subtract-times" function used * together with the numeric-equal operator "le". * ******************************************************* * . */ @org.junit.Test public void opSubtractTimes15() { final XQuery query = new XQuery( "(xs:time(\"13:00:00Z\") - xs:time(\"17:00:00Z\")) le xs:dayTimeDuration(\"P10DT02H10M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-times-16 * Written By: Carmelo Montanez * Date: June 28, 2005 * Purpose: Evaluates The "subtract-times" function used * together with the numeric-equal operator "ge". * ******************************************************* * . */ @org.junit.Test public void opSubtractTimes16() { final XQuery query = new XQuery( "(xs:time(\"13:00:00Z\") - xs:time(\"17:00:00Z\")) ge xs:dayTimeDuration(\"P17DT10H02M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-times-2 * Written By: Carmelo Montanez * Date: June 27, 2005 * Purpose: Evaluates The "subtract-times" function * As per example 2 (for this function) of the F&O specs * ******************************************************* * . */ @org.junit.Test public void opSubtractTimes2() { final XQuery query = new XQuery( "xs:time(\"11:00:00-05:00\") - xs:time(\"21:30:00+05:30\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * * ******************************************************* * Test: op-subtract-times-3 * Written By: Carmelo Montanez * Date: June 27, 2005 * Purpose: Evaluates The "subtract-times" function as * per example 3 (for this function) from the F&O specs. * ******************************************************* * . */ @org.junit.Test public void opSubtractTimes3() { final XQuery query = new XQuery( "xs:time(\"17:00:00-06:00\") - xs:time(\"08:00:00+09:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1D") ); } /** * * ******************************************************* * Test: op-subtract-times-4 * Written By: Carmelo Montanez * Date: June 27, 2005 * Purpose: Evaluates The "subtract-times" function that * return true and used together with fn:not. * Uses the "fn:string" function to account for new EBV rules. * ******************************************************* * . */ @org.junit.Test public void opSubtractTimes4() { final XQuery query = new XQuery( "fn:not(fn:string(xs:time(\"13:00:00Z\") - xs:time(\"14:00:00Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-times-5 * Written By: Carmelo Montanez * Date: June 27 2005 * Purpose: Evaluates The "subtract-times" function that * is used as an argument to the fn:boolean function. * Uses the "fn:string" function to account for new EBV rules. * ******************************************************* * . */ @org.junit.Test public void opSubtractTimes5() { final XQuery query = new XQuery( "fn:boolean(fn:string(xs:time(\"13:00:00Z\") - xs:time(\"10:00:00Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-times-6 * Written By: Carmelo Montanez * Date: June 27, 2005 * Purpose: Evaluates The "subtract-times" operator that * is used as an argument to the fn:number function. * ******************************************************* * . */ @org.junit.Test public void opSubtractTimes6() { final XQuery query = new XQuery( "fn:number(xs:time(\"13:00:00Z\") - xs:time(\"12:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * * ******************************************************* * Test: op-subtract-times-7 * Written By: Carmelo Montanez * Date: June 27, 2005 * Purpose: Evaluates The "subtract-times" function used * as an argument to the "fn:string" function). * ******************************************************* * . */ @org.junit.Test public void opSubtractTimes7() { final XQuery query = new XQuery( "fn:string(xs:time(\"13:00:00Z\") - xs:time(\"17:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-PT4H") ); } /** * * ******************************************************* * Test: op-subtract-times-8 * Written By: Carmelo Montanez * Date: June 27, 2005 * Purpose: Evaluates The "subtract-times" function that * returns a negative value. * ******************************************************* * . */ @org.junit.Test public void opSubtractTimes8() { final XQuery query = new XQuery( "(xs:time(\"13:00:00Z\") - xs:time(\"17:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-PT4H") ); } /** * * ******************************************************* * Test: op-subtract-times-9 * Written By: Carmelo Montanez * Date: June 27, 2005 * Purpose: Evaluates The "subtract-times" function used * together with and "and" expression. * Uses the "fn:string" function to account for new EBV rules. * ******************************************************* * . */ @org.junit.Test public void opSubtractTimes9() { final XQuery query = new XQuery( "fn:string((xs:time(\"13:00:00Z\") - xs:time(\"12:00:00Z\"))) and fn:string((xs:time(\"13:00:00Z\") - xs:time(\"10:00:00Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-times2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-times" operator * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:time(lower bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractTimes2args1() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") - xs:time(\"00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * * ******************************************************* * Test: op-subtract-times2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-times" operator * with the arguments set as follows: * $arg1 = xs:time(mid range) * $arg2 = xs:time(lower bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractTimes2args2() { final XQuery query = new XQuery( "xs:time(\"08:03:35Z\") - xs:time(\"00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT8H3M35S") ); } /** * * ******************************************************* * Test: op-subtract-times2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-times" operator * with the arguments set as follows: * $arg1 = xs:time(upper bound) * $arg2 = xs:time(lower bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractTimes2args3() { final XQuery query = new XQuery( "xs:time(\"23:59:59Z\") - xs:time(\"00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT23H59M59S") ); } /** * * ******************************************************* * Test: op-subtract-times2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-times" operator * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:time(mid range) * ******************************************************* * . */ @org.junit.Test public void opSubtractTimes2args4() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") - xs:time(\"08:03:35Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-PT8H3M35S") ); } /** * * ******************************************************* * Test: op-subtract-times2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-times" operator * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:time(upper bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractTimes2args5() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") - xs:time(\"23:59:59Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-PT23H59M59S") ); } } OpSubtractYearMonthDurationFromDate.java000066400000000000000000000571661222453003200337670ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/oppackage org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the subtract-yearMonthDuration-from-date() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpSubtractYearMonthDurationFromDate extends QT3TestSet { /** * * ******************************************************* * Test: K-DateSubtractYMD-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple testing involving operator '-' between xs:date and xs:yearMonthDuration. * ******************************************************* * . */ @org.junit.Test public void kDateSubtractYMD1() { final XQuery query = new XQuery( "xs:date(\"1999-08-12\") - xs:yearMonthDuration(\"P3Y7M\") eq xs:date(\"1996-01-12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test subtraction of zero duration to date . */ @org.junit.Test public void cbclSubtractYearMonthDurationFromDate001() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:two-digit($number as xs:integer) { \n" + " \t\tlet $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string \n" + " \t}; \n" + " \tdeclare function local:date($year as xs:integer, $month as xs:integer, $day as xs:integer) { \n" + " \t\tlet $m := local:two-digit($month), $d := local:two-digit($day) return xs:date(concat($year, '-', $m, '-', $d)) \n" + " \t}; \n" + " \tlocal:date(2008, 05, 12) - xs:dayTimeDuration(\"P0D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2008-05-12") ); } /** * test subtraction of large duration from date . */ @org.junit.Test public void cbclSubtractYearMonthDurationFromDate002() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:two-digit($number as xs:integer) { \n" + " \t\tlet $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string \n" + " \t}; \n" + " \tdeclare function local:date($year as xs:integer, $month as xs:integer, $day as xs:integer) { \n" + " \t\tlet $m := local:two-digit($month), $d := local:two-digit($day) return xs:date(concat($year, '-', $m, '-', $d)) \n" + " \t}; \n" + " \tlocal:date(-25252734927766554, 05, 12) - xs:yearMonthDuration(\"-P3214267297Y\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FODT0001") || assertStringValue(false, "-25252731713499257-05-12") ) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-date-1 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-yearMonthDuration-from-date" operator * As per example 1 (for this function)of the F&O specs. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDate1() { final XQuery query = new XQuery( "xs:date(\"2000-10-30\") - xs:yearMonthDuration(\"P1Y2M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-08-30") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-date-10 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The string value of "subtract-yearMonthDuration-from-date" operator used * together with an "or" expression. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDate10() { final XQuery query = new XQuery( "fn:string((xs:date(\"1985-07-05Z\") - xs:yearMonthDuration(\"P02Y02M\"))) or fn:string((xs:date(\"1985-07-05Z\") - xs:yearMonthDuration(\"P02Y02M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-date-12 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The string value of "subtract-yearMonthDuration-from-date" operator used * with a boolean expression and the "fn:true" function. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDate12() { final XQuery query = new XQuery( "fn:string((xs:date(\"1980-03-02Z\") - xs:yearMonthDuration(\"P05Y05M\"))) and (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-date-13 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-yearMonthDuration-from-date" operator used * together with the numeric-equal-operator "eq". * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDate13() { final XQuery query = new XQuery( "(xs:date(\"1980-05-05Z\") - xs:yearMonthDuration(\"P23Y11M\")) eq xs:date(\"1980-05-05Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-date-14 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-yearMonthDuration-from-date" operator used * together with the numeric-equal operator "ne". * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDate14() { final XQuery query = new XQuery( "(xs:date(\"1979-12-12Z\") - xs:yearMonthDuration(\"P08Y08M\")) ne xs:date(\"1979-12-12Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-date-15 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-yearMonthDuration-from-date" operator used * together with the numeric-equal operator "le". * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDate15() { final XQuery query = new XQuery( "(xs:date(\"1978-12-12Z\") - xs:yearMonthDuration(\"P17Y12M\")) le xs:date(\"1978-12-12Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-date-16 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-yearMonthDuration-from-date" operator used * together with the numeric-equal operator "ge". * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDate16() { final XQuery query = new XQuery( "(xs:date(\"1977-12-12Z\") - xs:yearMonthDuration(\"P18Y02M\")) ge xs:date(\"1977-12-12Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-date-17 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The string value of "subtract-yearMonthDuration-from-date" operator * used as part of a boolean expression (and operator) and the "fn:false" function. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDate17() { final XQuery query = new XQuery( "fn:string(xs:date(\"2000-12-12Z\") - xs:yearMonthDuration(\"P18Y11M\")) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-date-18 * Date: July 6, 2005 * Purpose: Evaluates The string value of "subtract-yearMonthDuration-from-date" operator as * part of a boolean expression (or operator) and the "fn:boolean" function. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDate18() { final XQuery query = new XQuery( "fn:string((xs:date(\"1999-10-23Z\") - xs:yearMonthDuration(\"P19Y12M\"))) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-date-2 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-yearMonthDuration-from-date" operator * As per example 2 (for this function)of the F&O specs. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDate2() { final XQuery query = new XQuery( "xs:date(\"2000-02-29Z\") - xs:yearMonthDuration(\"P1Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-02-28Z") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-date-3 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-yearMonthDuration-from-date" operator * As per example 3 (for this function)of the F&O specs. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDate3() { final XQuery query = new XQuery( "xs:date(\"2000-10-31-05:00\") - xs:yearMonthDuration(\"P1Y1M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-09-30-05:00") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-date-4 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The string value of "subtract-yearMonthDuration-from-date" operator that * return true and used together with fn:not. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDate4() { final XQuery query = new XQuery( "fn:not(fn:string(xs:date(\"1998-09-12Z\") - xs:yearMonthDuration(\"P20Y03M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-date-5 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The string value of "subtract-yearMonthDuration-from-date" operator that * is used as an argument to the fn:boolean function. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDate5() { final XQuery query = new XQuery( "fn:boolean(fn:string(xs:date(\"1962-03-12Z\") - xs:yearMonthDuration(\"P10Y01M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-date-6 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-yearMonthDuration-from-date" operator that * is used as an argument to the fn:number function. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDate6() { final XQuery query = new XQuery( "fn:number(xs:date(\"1988-01-28Z\") - xs:yearMonthDuration(\"P09Y02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-date-7 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-yearMonthDuration-from-date" operator used * as an argument to the "fn:string" function). * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDate7() { final XQuery query = new XQuery( "fn:string(xs:date(\"1989-07-05Z\") - xs:yearMonthDuration(\"P08Y04M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1981-03-05Z") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-date-8 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The "subtract-yearMonthDuration-from-date" operator that * returns a negative value. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDate8() { final XQuery query = new XQuery( "(xs:date(\"0001-01-01Z\") - xs:yearMonthDuration(\"-P20Y07M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0021-08-01Z") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-date-9 * Written By: Carmelo Montanez * Date: July 6, 2005 * Purpose: Evaluates The string value of "subtract-yearMonthDuration-from-date" operator used * together with an "and" expression. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDate9() { final XQuery query = new XQuery( "fn:string((xs:date(\"1993-12-09Z\") - xs:yearMonthDuration(\"P03Y03M\"))) and fn:string((xs:date(\"1993-12-09Z\") - xs:yearMonthDuration(\"P03Y03M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-date2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-yearMonthDuration-from-date" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDate2args1() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") - xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1970-01-01Z") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-date2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-yearMonthDuration-from-date" operator * with the arguments set as follows: * $arg1 = xs:date(mid range) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDate2args2() { final XQuery query = new XQuery( "xs:date(\"1983-11-17Z\") - xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1983-11-17Z") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-date2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-yearMonthDuration-from-date" operator * with the arguments set as follows: * $arg1 = xs:date(upper bound) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDate2args3() { final XQuery query = new XQuery( "xs:date(\"2030-12-31Z\") - xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2030-12-31Z") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-date2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-yearMonthDuration-from-date" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:yearMonthDuration(mid range) * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDate2args4() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") - xs:yearMonthDuration(\"P1000Y6M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0969-07-01Z") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-date2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-yearMonthDuration-from-date" operator * with the arguments set as follows: * $arg1 = xs:date(lower bound) * $arg2 = xs:yearMonthDuration(upper bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDate2args5() { final XQuery query = new XQuery( "xs:date(\"1970-01-01Z\") - xs:yearMonthDuration(\"P2030Y12M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "-0062-01-01Z") || assertStringValue(false, "-0061-01-01Z") ) ); } } OpSubtractYearMonthDurationFromDateTime.java000066400000000000000000000545761222453003200346100ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/oppackage org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the subtract-yearMonthDuration-from-dateTime() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpSubtractYearMonthDurationFromDateTime extends QT3TestSet { /** * * ******************************************************* * Test: K-DateTimeSubtractYMD-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple testing involving operator '-' between xs:dateTime and xs:yearMonthDuration that evaluates to zero. * ******************************************************* * . */ @org.junit.Test public void kDateTimeSubtractYMD1() { final XQuery query = new XQuery( "xs:dateTime(\"1999-07-19T08:23:01.765\") - xs:yearMonthDuration(\"P3Y35M\") eq xs:dateTime(\"1993-08-19T08:23:01.765\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test subtraction of zero duration to dateTime . */ @org.junit.Test public void cbclSubtractYearMonthDurationFromDateTime001() { final XQuery query = new XQuery( "declare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string }; declare function local:dateTime($year as xs:integer, $month as xs:integer, $day as xs:integer, $hour as xs:integer, $mins as xs:integer) { let $m := local:two-digit($month), $d := local:two-digit($day), $h := local:two-digit($hour), $n := local:two-digit($mins) return xs:dateTime(concat($year, '-', $m, '-', $d, 'T', $h, ':', $n, ':00')) }; local:dateTime(2008, 05, 12, 12, 59) - xs:yearMonthDuration(\"P0Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2008-05-12T12:59:00") ); } /** * test subtraction of large duration from dateTime . */ @org.junit.Test public void cbclSubtractYearMonthDurationFromDateTime002() { final XQuery query = new XQuery( "declare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string }; declare function local:dateTime($year as xs:integer, $month as xs:integer, $day as xs:integer, $hour as xs:integer, $mins as xs:integer) { let $m := local:two-digit($month), $d := local:two-digit($day), $h := local:two-digit($hour), $n := local:two-digit($mins) return xs:dateTime(concat($year, '-', $m, '-', $d, 'T', $h, ':', $n, ':00')) }; local:dateTime(-25252734927766554, 05, 12, 12, 59) + xs:yearMonthDuration(\"-P3214267297Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-dateTime-1 * Written By: Carmelo Montanez * date: July 5, 2005 * Purpose: Evaluates The "subtract-yearMonthDuration-from-dateTime" operator * As per example 1 (for this function)of the F&O specs. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDateTime1() { final XQuery query = new XQuery( "xs:dateTime(\"2000-10-30T11:12:00\") - xs:yearMonthDuration(\"P1Y2M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-08-30T11:12:00") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-dateTime-10 * Written By: Carmelo Montanez * date: July 5, 2005 * Purpose: Evaluates The string value of "subtract-yearMonthDuration-from-dateTime" * operator used together with an "or" expression. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDateTime10() { final XQuery query = new XQuery( "fn:string((xs:dateTime(\"1985-07-05T09:09:09Z\") - xs:yearMonthDuration(\"P02Y02M\"))) or fn:string((xs:dateTime(\"1985-07-05T09:09:09Z\") - xs:yearMonthDuration(\"P02Y02M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-dateTime-12 * Written By: Carmelo Montanez * date: July 5, 2005 * Purpose: Evaluates The string value of "subtract-yearMonthDuration-from-dateTime" * operator used with a boolean expression and the "fn:true" function. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDateTime12() { final XQuery query = new XQuery( "fn:string((xs:dateTime(\"1980-03-02T02:02:02Z\") - xs:yearMonthDuration(\"P05Y05M\"))) and (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-dateTime-13 * Written By: Carmelo Montanez * date: July 5, 2005 * Purpose: Evaluates The "subtract-yearMonthDuration-from-dateTime" operator used * together with the numeric-equal-operator "eq". * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDateTime13() { final XQuery query = new XQuery( "(xs:dateTime(\"1980-05-05T05:05:05Z\") - xs:yearMonthDuration(\"P23Y11M\")) eq xs:dateTime(\"1980-05-05T05:05:05Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-dateTime-14 * Written By: Carmelo Montanez * date: July 5, 2005 * Purpose: Evaluates The "subtract-yearMonthDuration-from-dateTime" operator used * together with the numeric-equal operator "ne". * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDateTime14() { final XQuery query = new XQuery( "(xs:dateTime(\"1979-12-12T09:09:09Z\") - xs:yearMonthDuration(\"P08Y08M\")) ne xs:dateTime(\"1979-12-12T09:09:09Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-dateTime-15 * Written By: Carmelo Montanez * date: July 5, 2005 * Purpose: Evaluates The "subtract-yearMonthDuration-from-dateTime" operator used * together with the numeric-equal operator "le". * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDateTime15() { final XQuery query = new XQuery( "(xs:dateTime(\"1978-12-12T07:07:07Z\") - xs:yearMonthDuration(\"P17Y12M\")) le xs:dateTime(\"1978-12-12T07:07:07Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-dateTime-16 * Written By: Carmelo Montanez * Date: July 5, 2005 * Purpose: Evaluates The "subtract-yearMonthDuration-from-dateTime" operator used * together with the numeric-equal operator "ge". * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDateTime16() { final XQuery query = new XQuery( "(xs:dateTime(\"1977-12-12T03:03:03Z\") - xs:yearMonthDuration(\"P18Y02M\")) ge xs:dateTime(\"1977-12-12T03:03:03Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-dateTime-2 * Written By: Carmelo Montanez * date: July 5, 2005 * Purpose: Evaluates The string value of "subtract-yearMonthDuration-from-dateTime" * operator used as part of a boolean expression (and operator) and the "fn:false" function. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDateTime2() { final XQuery query = new XQuery( "fn:string(xs:dateTime(\"2000-12-12T12:12:12Z\") - xs:dayTimeDuration(\"P12DT10H07M\")) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-dateTime-3 * date: July 5, 2005 * Purpose: Evaluates The string value of "subtract-yearMonthDuration-from-dateTime" * operator as part of a boolean expression (or operator) and the "fn:boolean" function. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDateTime3() { final XQuery query = new XQuery( "fn:string((xs:dateTime(\"1999-10-23T13:45:45Z\") - xs:yearMonthDuration(\"P19Y12M\"))) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-dateTime-4 * Written By: Carmelo Montanez * date: July 5, 2005 * Purpose: Evaluates The string value of "subtract-yearMonthDuration-from-dateTime" * operator that return true and used together with fn:not. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDateTime4() { final XQuery query = new XQuery( "fn:not(fn:string(xs:dateTime(\"1998-09-12T13:56:12Z\") - xs:yearMonthDuration(\"P20Y03M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-dateTime-5 * Written By: Carmelo Montanez * date: July 5, 2005 * Purpose: Evaluates The string value of "subtract-yearMonthDuration-from-dateTime" * operator that is used as an argument to the fn:boolean function. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDateTime5() { final XQuery query = new XQuery( "fn:boolean(fn:string(xs:dateTime(\"1962-03-12T10:12:34Z\") - xs:yearMonthDuration(\"P10Y01M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-dateTime-6 * Written By: Carmelo Montanez * date: July 5, 2005 * Purpose: Evaluates The "subtract-yearMonthDuration-from-dateTime" operator that * is used as an argument to the fn:number function. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDateTime6() { final XQuery query = new XQuery( "fn:number(xs:dateTime(\"1988-01-28T13:45:23Z\") - xs:yearMonthDuration(\"P09Y02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-dateTime-7 * Written By: Carmelo Montanez * date: July 5, 2005 * Purpose: Evaluates The "subtract-yearMonthDuration-from-dateTime" operator used * as an argument to the "fn:string" function). * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDateTime7() { final XQuery query = new XQuery( "fn:string(xs:dateTime(\"1989-07-05T14:34:36Z\") - xs:yearMonthDuration(\"P08Y04M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1981-03-05T14:34:36Z") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-dateTime-8 * Written By: Carmelo Montanez * date: July 8, 2005 * Purpose: Evaluates The "subtract-yearMonthDuration-from-dateTime" operator that * returns a negative value. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDateTime8() { final XQuery query = new XQuery( "(xs:dateTime(\"0001-01-01T01:01:01Z\") - xs:yearMonthDuration(\"-P20Y07M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0021-08-01T01:01:01Z") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-dateTime-9 * Written By: Carmelo Montanez * date: July 5, 2005 * Purpose: Evaluates string value of the "subtract-yearMonthDuration-from-dateTime" * operator used together with an "and" expression. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDateTime9() { final XQuery query = new XQuery( "fn:string((xs:dateTime(\"1993-12-09T10:10:10Z\") - xs:yearMonthDuration(\"P03Y03M\"))) and fn:string((xs:dateTime(\"1993-12-09T10:10:10Z\") - xs:yearMonthDuration(\"P03Y03M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-dateTime2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-yearMonthDuration-from-dateTime" operator * with the arguments set as follows: * arg1 = xs:dateTime(lower bound) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDateTime2args1() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") - xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1970-01-01T00:00:00Z") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-dateTime2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-yearMonthDuration-from-dateTime" operator * with the arguments set as follows: * arg1 = xs:dateTime(mid range) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDateTime2args2() { final XQuery query = new XQuery( "xs:dateTime(\"1996-04-07T01:40:52Z\") - xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1996-04-07T01:40:52Z") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-dateTime2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-yearMonthDuration-from-dateTime" operator * with the arguments set as follows: * arg1 = xs:dateTime(upper bound) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDateTime2args3() { final XQuery query = new XQuery( "xs:dateTime(\"2030-12-31T23:59:59Z\") - xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2030-12-31T23:59:59Z") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-dateTime2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-yearMonthDuration-from-dateTime" operator * with the arguments set as follows: * arg1 = xs:dateTime(lower bound) * $arg2 = xs:yearMonthDuration(mid range) * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDateTime2args4() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") - xs:yearMonthDuration(\"P1000Y6M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0969-07-01T00:00:00Z") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDuration-from-dateTime2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-yearMonthDuration-from-dateTime" operator * with the arguments set as follows: * arg1 = xs:dateTime(lower bound) * $arg2 = xs:yearMonthDuration(upper bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurationFromDateTime2args5() { final XQuery query = new XQuery( "xs:dateTime(\"1970-01-01T00:00:00Z\") - xs:yearMonthDuration(\"P2030Y12M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "-0062-01-01T00:00:00Z") || assertStringValue(false, "-0061-01-01T00:00:00Z") ) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpSubtractYearMonthDurations.java000066400000000000000000000726001222453003200325750ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the subtract-yearMonthDurations() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpSubtractYearMonthDurations extends QT3TestSet { /** * * ******************************************************* * Test: K-YearMonthDurationSubtract-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of substraction an xs:yearMonthDuration with P0M. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationSubtract1() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P3Y3M\") - xs:yearMonthDuration(\"P0M\") eq xs:yearMonthDuration(\"P3Y3M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-YearMonthDurationSubtract-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of substraction P0M with an xs:yearMonthDuration. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationSubtract2() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0M\") - xs:yearMonthDuration(\"P3Y3M\") eq xs:yearMonthDuration(\"-P3Y3M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-YearMonthDurationSubtract-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of substraction two arbitrary xs:yearMonthDurations. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationSubtract3() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P32Y43M\") - xs:yearMonthDuration(\"P12Y13M\") eq xs:yearMonthDuration(\"P22Y6M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-YearMonthDurationSubtract-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The addition operator is not available between xs:dayTimeDuration and xs:yearMonthDuration. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationSubtract4() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3D\") + xs:yearMonthDuration(\"P3Y3M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-YearMonthDurationSubtract-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The addition operator is not available between xs:yearMonthDuration and xs:dayTimeDuration. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationSubtract5() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P3Y3M\") + xs:dayTimeDuration(\"P3D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-YearMonthDurationSubtract-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The addition operator is not available between xs:duration and xs:yearMonthDuration. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationSubtract6() { final XQuery query = new XQuery( "xs:duration(\"P3D\") + xs:yearMonthDuration(\"P3Y3M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-YearMonthDurationSubtract-7 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The addition operator is not available between xs:yearMonthDuration and xs:duration. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationSubtract7() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P3Y3M\") + xs:duration(\"P3D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-YearMonthDurationSubtract-8 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The addition operator is not available between xs:dayTimeDuration and xs:duration. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationSubtract8() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3D\") + xs:duration(\"P3Y3M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-YearMonthDurationSubtract-9 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The addition operator is not available between xs:duration and xs:dayTimeDuration. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationSubtract9() { final XQuery query = new XQuery( "xs:duration(\"P3Y3M\") + xs:dayTimeDuration(\"P3D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * test subtraction of zero duration from yearMonthDurations . */ @org.junit.Test public void cbclSubtractYearMonthDurations001() { final XQuery query = new XQuery( "\n" + " declare function local:yearMonthDuration($years as xs:integer, $months as xs:integer ) { xs:yearMonthDuration(concat('P', $years, 'Y', $months, 'M')) };\n" + " local:yearMonthDuration(1, 1) - xs:yearMonthDuration(\"P0Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1Y1M") ); } /** * test subtraction of yearMonthDurations . */ @org.junit.Test public void cbclSubtractYearMonthDurations002() { final XQuery query = new XQuery( "\n" + " declare function local:yearMonthDuration($years as xs:integer, $months as xs:integer ) { xs:yearMonthDuration(concat('P', $years, 'Y', $months, 'M')) };\n" + " local:yearMonthDuration(1, 1) - local:yearMonthDuration(1, 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P0M") ); } /** * test subtraction of large yearMonthDuration . */ @org.junit.Test public void cbclSubtractYearMonthDurations003() { final XQuery query = new XQuery( "\n" + " declare function local:yearMonthDuration($years as xs:integer, $months as xs:integer ) { xs:yearMonthDuration(concat('P', $years, 'Y', $months, 'M')) };\n" + " xs:yearMonthDuration(\"-P768614336404564650Y\") - local:yearMonthDuration(768614336404564650, 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDurations-1 * Written By: Carmelo Montanez * Date: June 28, 2005 * Purpose: Evaluates The "subtract-yearMonthDurations" function * As per example 1 (for this function)of the F&O specs. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurations1() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P2Y11M\") - xs:yearMonthDuration(\"P3Y3M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P4M") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDurations-10 * Written By: Carmelo Montanez * Date: June 28, 2005 * Purpose: Evaluates The "subtract-yearMonthDurations" function used * together with an "or" expression. * Apply "fn:string" function to account for new EBV. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurations10() { final XQuery query = new XQuery( "fn:string((xs:yearMonthDuration(\"P05Y02M\") - xs:yearMonthDuration(\"P03Y04M\"))) or fn:string((xs:yearMonthDuration(\"P05Y03M\") - xs:yearMonthDuration(\"P01Y03M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDurations-11 * Written By: Carmelo Montanez * Date: June 28, 2005 * Purpose: Evaluates The "subtract-yearMonthDurations" function used * together with a "div" expression. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurations11() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P42Y10M\") - xs:yearMonthDuration(\"P20Y10M\")) div (xs:yearMonthDuration(\"P20Y11M\") - xs:yearMonthDuration(\"P18Y11M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "11") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDurations-12 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "subtract-yearMonthDurations" operators used * with a boolean expression and the "fn:true" function. * Apply "fn:string" function to account for new EBV. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurations12() { final XQuery query = new XQuery( "fn:string((xs:yearMonthDuration(\"P10Y11M\") - xs:yearMonthDuration(\"P05Y07M\"))) and (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDurations-13 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "subtract-yearMonthDurations" function used * together with the numeric-equal- operator "eq". * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurations13() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P23Y11M\") - xs:yearMonthDuration(\"P23Y11M\")) eq xs:yearMonthDuration(\"P23Y11M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDurations-14 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "subtract-yearMonthDurations" function used * together with the numeric-equal operator "ne". * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurations14() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P21Y12M\") - xs:yearMonthDuration(\"P08Y05M\")) ne xs:yearMonthDuration(\"P08Y05M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDurations-15 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "subtract-yearMonthDurations" function used * together with the numeric-equal operator "le". * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurations15() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P10Y01M\") - xs:yearMonthDuration(\"P17Y02M\")) le xs:yearMonthDuration(\"P17Y02M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDurations-16 * Written By: Carmelo Montanez * Date: June 29, 2005 * Purpose: Evaluates The "subtract-yearMonthDurations" function used * together with the numeric-equal operator "ge". * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurations16() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P13Y09M\") - xs:yearMonthDuration(\"P18Y02M\")) ge xs:yearMonthDuration(\"P18Y02M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDurations-2 * Written By: Carmelo Montanez * Date: June 28, 2005 * Purpose: Evaluates The "subtract-yearMonthDurations" function * used as part of a boolean expression (and operator) and the "fn:false" function. * Apply "fn:string" function to account for new EBV. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurations2() { final XQuery query = new XQuery( "fn:string(xs:yearMonthDuration(\"P10Y11M\") - xs:yearMonthDuration(\"P12Y07M\")) and fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDurations-3 * Written By: Carmelo Montanez * Date: June 28, 2005 * Purpose: Evaluates The "subtract-yearMonthDurations" function as * part of a boolean expression (or operator) and the "fn:boolean" function. * Apply "fn:string" function to account for new EBV. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurations3() { final XQuery query = new XQuery( "fn:string(xs:yearMonthDuration(\"P20Y10M\") - xs:yearMonthDuration(\"P19Y10M\")) or fn:false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDurations-4 * Written By: Carmelo Montanez * Date: June 28, 2005 * Purpose: Evaluates The "subtract-yearMonthDurations" function that * return true and used together with fn:not. * Apply "fn:string" function to account for new EBV. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurations4() { final XQuery query = new XQuery( "fn:not(fn:string(xs:yearMonthDuration(\"P11Y04M\") - xs:yearMonthDuration(\"P02Y11M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDurations-5 * Written By: Carmelo Montanez * Date: June 28 2005 * Purpose: Evaluates The "subtract-yearMonthDurations" function that * is used as an argument to the fn:boolean function. * Apply "fn:string" function to account for new EBV. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurations5() { final XQuery query = new XQuery( "fn:boolean(fn:string(xs:yearMonthDuration(\"P05Y08M\") - xs:yearMonthDuration(\"P03Y06M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDurations-6 * Written By: Carmelo Montanez * Date: June 28, 2005 * Purpose: Evaluates The "subtract-yearMonthDurations" operator that * is used as an argument to the fn:number function. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurations6() { final XQuery query = new XQuery( "fn:number(xs:yearMonthDuration(\"P02Y09M\") - xs:yearMonthDuration(\"P10Y01M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDurations-7 * Written By: Carmelo Montanez * Date: June 28, 2005 * Purpose: Evaluates The "subtract-yearMonthDurations" function used * as an argument to the "fn:string" function). * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurations7() { final XQuery query = new XQuery( "fn:string(xs:yearMonthDuration(\"P03Y08M\") - xs:yearMonthDuration(\"P01Y02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P2Y6M") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDurations-8 * Written By: Carmelo Montanez * Date: June 28, 2005 * Purpose: Evaluates The "subtract-yearMonthDurations" function that * returns a negative value. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurations8() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P10Y01M\") - xs:yearMonthDuration(\"P11Y02M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P1Y1M") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDurations-9 * Written By: Carmelo Montanez * Date: June 28, 2005 * Purpose: Evaluates The "subtract-yearMonthDurations" function used * together with and "and" expression. * Apply "fn:string" function to account for new EBV. * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurations9() { final XQuery query = new XQuery( "fn:string((xs:yearMonthDuration(\"P01Y01M\") - xs:yearMonthDuration(\"P02Y02M\"))) and fn:string((xs:yearMonthDuration(\"P02Y03M\") - xs:yearMonthDuration(\"P04Y04M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDurations2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-yearMonthDurations" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(lower bound) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurations2args1() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") - xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P0M") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDurations2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-yearMonthDurations" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(mid range) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurations2args2() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1000Y6M\") - xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1000Y6M") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDurations2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-yearMonthDurations" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(upper bound) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurations2args3() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P2030Y12M\") - xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P2031Y") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDurations2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-yearMonthDurations" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(lower bound) * $arg2 = xs:yearMonthDuration(mid range) * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurations2args4() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") - xs:yearMonthDuration(\"P1000Y6M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P1000Y6M") ); } /** * * ******************************************************* * Test: op-subtract-yearMonthDurations2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:08 GMT-05:00 2005 * Purpose: Evaluates The "op:subtract-yearMonthDurations" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(lower bound) * $arg2 = xs:yearMonthDuration(upper bound) * ******************************************************* * . */ @org.junit.Test public void opSubtractYearMonthDurations2args5() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") - xs:yearMonthDuration(\"P2030Y12M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P2031Y") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpTimeEqual.java000066400000000000000000001271711222453003200271600ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the time-equal() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpTimeEqual extends QT3TestSet { /** * * ******************************************************* * Test: K-TimeEQ-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'eq' for xs:time, returning positive. * ******************************************************* * . */ @org.junit.Test public void kTimeEQ1() { final XQuery query = new XQuery( "xs:time(\"23:01:04.12\") eq xs:time(\"23:01:04.12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-TimeEQ-10 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'ne' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kTimeEQ10() { final XQuery query = new XQuery( "xs:time(\"12:12:23\") ne xs:date(\"1999-12-04\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-TimeEQ-11 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'le' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kTimeEQ11() { final XQuery query = new XQuery( "xs:time(\"12:12:23\") le xs:date(\"1999-12-04\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-TimeEQ-12 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'lt' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kTimeEQ12() { final XQuery query = new XQuery( "xs:time(\"12:12:23\") lt xs:date(\"1999-12-04\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-TimeEQ-13 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'ge' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kTimeEQ13() { final XQuery query = new XQuery( "xs:time(\"12:12:23\") ge xs:date(\"1999-12-04\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-TimeEQ-14 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'gt' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kTimeEQ14() { final XQuery query = new XQuery( "xs:time(\"12:12:23\") gt xs:date(\"1999-12-04\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-TimeEQ-15 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'eq' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kTimeEQ15() { final XQuery query = new XQuery( "xs:date(\"1999-12-04\") eq xs:time(\"12:12:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-TimeEQ-16 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'ne' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kTimeEQ16() { final XQuery query = new XQuery( "xs:date(\"1999-12-04\") ne xs:time(\"12:12:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-TimeEQ-17 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'le' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kTimeEQ17() { final XQuery query = new XQuery( "xs:date(\"1999-12-04\") le xs:time(\"12:12:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-TimeEQ-18 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'lt' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kTimeEQ18() { final XQuery query = new XQuery( "xs:date(\"1999-12-04\") lt xs:time(\"12:12:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-TimeEQ-19 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'ge' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kTimeEQ19() { final XQuery query = new XQuery( "xs:date(\"1999-12-04\") ge xs:time(\"12:12:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-TimeEQ-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'eq' for xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeEQ2() { final XQuery query = new XQuery( "not(xs:time(\"23:01:04.12\") eq xs:time(\"23:01:04.13\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-TimeEQ-20 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'gt' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kTimeEQ20() { final XQuery query = new XQuery( "xs:date(\"1999-12-04\") gt xs:time(\"12:12:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K-TimeEQ-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ne' for xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeEQ3() { final XQuery query = new XQuery( "xs:time(\"23:01:05.12\") ne xs:time(\"23:01:04.12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-TimeEQ-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ne' for xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeEQ4() { final XQuery query = new XQuery( "not(xs:time(\"23:01:04.12\") ne xs:time(\"23:01:04.12\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-TimeEQ-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset -00:00 is equal to Z, in xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeEQ5() { final XQuery query = new XQuery( "xs:time(\"16:00:12.345-00:00\") eq xs:time(\"16:00:12.345Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-TimeEQ-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset +00:00 is equal to Z, in xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeEQ6() { final XQuery query = new XQuery( "xs:time(\"16:00:12.345+00:00\") eq xs:time(\"16:00:12.345Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-TimeEQ-7 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset Z is equal to Z, in xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeEQ7() { final XQuery query = new XQuery( "xs:time(\"16:00:12.345Z\") eq xs:time(\"16:00:12.345Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-TimeEQ-8 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Test that zone offset -00:00 is equal to +00:00, in xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeEQ8() { final XQuery query = new XQuery( "xs:time(\"16:00:12.345-00:00\") eq xs:time(\"16:00:12.345+00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-TimeEQ-9 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: The operator 'eq' is not available between xs:dateTime and xs:date . * ******************************************************* * . */ @org.junit.Test public void kTimeEQ9() { final XQuery query = new XQuery( "xs:time(\"12:12:23\") eq xs:date(\"1999-12-04\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * * ******************************************************* * Test: K2-TimeEQ-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Basic negative equalness test for xs:time. * ******************************************************* * . */ @org.junit.Test public void k2TimeEQ1() { final XQuery query = new XQuery( "xs:time(\"01:01:01-03:00\") ne xs:time(\"01:01:01+03:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeEqual001() { final XQuery query = new XQuery( "\n" + " declare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string };\n" + " declare function local:time($hours as xs:integer, $mins as xs:integer, $seconds as xs:decimal) { let $h := local:two-digit($hours), $m := local:two-digit($mins) return xs:time(concat($h, ':', $m, ':', $seconds)) };\n" + " not(local:time(12, 59, 30) eq xs:time(\"12:32:05\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeEqual002() { final XQuery query = new XQuery( "xs:time(\"14:00:00-12:00\") eq xs:time(\"02:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeEqual003() { final XQuery query = new XQuery( "xs:time(\"02:00:00\") eq xs:time(\"14:00:00-12:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeEqual004() { final XQuery query = new XQuery( "xs:time(\"00:00:01+01:00\") eq xs:time(\"00:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeEqual005() { final XQuery query = new XQuery( "xs:time(\"00:00:00\") eq xs:time(\"00:00:01+01:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeEqual006() { final XQuery query = new XQuery( "\n" + " declare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string };\n" + " declare function local:time($hours as xs:integer, $mins as xs:integer, $seconds as xs:decimal) { let $h := local:two-digit($hours), $m := local:two-digit($mins) return xs:time(concat($h, ':', $m, ':', $seconds)) };\n" + " not(local:time(12, 59, 30) ne xs:time(\"12:32:05\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeEqual007() { final XQuery query = new XQuery( "xs:time(\"14:00:00-12:00\") ne xs:time(\"02:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeEqual008() { final XQuery query = new XQuery( "xs:time(\"02:00:00\") ne xs:time(\"14:00:00-12:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeEqual009() { final XQuery query = new XQuery( "xs:time(\"00:00:01+01:00\") ne xs:time(\"00:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeEqual010() { final XQuery query = new XQuery( "xs:time(\"00:00:00\") ne xs:time(\"00:00:01+01:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeEqual011() { final XQuery query = new XQuery( "\n" + " declare function local:time($time as xs:time, $null as xs:boolean) { if ($null) then () else $time };\n" + " exists(local:time(xs:time(\"23:58:00\"), fn:true()) eq xs:time(\"23:58:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeEqual012() { final XQuery query = new XQuery( "\n" + " declare function local:time($time as xs:time, $null as xs:boolean) { if ($null) then () else $time };\n" + " local:time(xs:time(\"23:58:00\"), fn:false()) eq xs:time(\"23:58:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeEqual013() { final XQuery query = new XQuery( "\n" + " declare function local:time($time as xs:time, $null as xs:boolean) { if ($null) then () else $time };\n" + " exists(local:time(xs:time(\"23:58:00\"), fn:true()) ne xs:time(\"23:58:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeEqual014() { final XQuery query = new XQuery( "\n" + " declare function local:time($time as xs:time, $null as xs:boolean) { if ($null) then () else $time };\n" + " local:time(xs:time(\"23:58:00\"), fn:false()) ne xs:time(\"23:58:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeEqual017() { final XQuery query = new XQuery( "xs:time(\"00:00:00+12:00\") eq xs:time(\"00:00:01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeEqual018() { final XQuery query = new XQuery( "xs:time(\"00:00:00+12:00\") ne xs:time(\"00:00:01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeEqual019() { final XQuery query = new XQuery( "if (implicit-timezone() eq xs:dayTimeDuration('PT1H'))\n" + " then xs:time(\"12:00:00+02:00\") eq xs:time(\"12:00:00\")\n" + " else xs:time(\"12:00:00+01:00\") eq xs:time(\"12:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-equal2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-equal" operator * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:time(lower bound) * ******************************************************* * . */ @org.junit.Test public void opTimeEqual2args1() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") eq xs:time(\"00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-equal2args-10 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-equal" operator * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:time(upper bound) * ******************************************************* * . */ @org.junit.Test public void opTimeEqual2args10() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") ne xs:time(\"23:59:59Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-equal2args-11 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:time-equal" operator (le) * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:time(lower bound) * ******************************************************* * . */ @org.junit.Test public void opTimeEqual2args11() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") le xs:time(\"00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-equal2args-12 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:time-equal" operator (le) * with the arguments set as follows: * $arg1 = xs:time(mid range) * $arg2 = xs:time(lower bound) * ******************************************************* * . */ @org.junit.Test public void opTimeEqual2args12() { final XQuery query = new XQuery( "xs:time(\"08:03:35Z\") le xs:time(\"00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-equal2args-13 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:time-equal" operator (le) * with the arguments set as follows: * $arg1 = xs:time(upper bound) * $arg2 = xs:time(lower bound) * ******************************************************* * . */ @org.junit.Test public void opTimeEqual2args13() { final XQuery query = new XQuery( "xs:time(\"23:59:59Z\") le xs:time(\"00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-equal2args-14 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:time-equal" operator (le) * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:time(mid range) * ******************************************************* * . */ @org.junit.Test public void opTimeEqual2args14() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") le xs:time(\"08:03:35Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-equal2args-15 * Written By: Carmelo Montanez * Date: June 3 2005 * Purpose: Evaluates The "op:time-equal" operator (le) * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:time(upper bound) * ******************************************************* * . */ @org.junit.Test public void opTimeEqual2args15() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") le xs:time(\"23:59:59Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-equal2args-16 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:time-equal" operator (ge) * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:time(lower bound) * ******************************************************* * . */ @org.junit.Test public void opTimeEqual2args16() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") ge xs:time(\"00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-equal2args-17 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:time-equal" operator (ge) * with the arguments set as follows: * $arg1 = xs:time(mid range) * $arg2 = xs:time(lower bound) * ******************************************************* * . */ @org.junit.Test public void opTimeEqual2args17() { final XQuery query = new XQuery( "xs:time(\"08:03:35Z\") ge xs:time(\"00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-equal2args-q8 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:time-equal" operator (ge) * with the arguments set as follows: * $arg1 = xs:time(upper bound) * $arg2 = xs:time(lower bound) * ******************************************************* * . */ @org.junit.Test public void opTimeEqual2args18() { final XQuery query = new XQuery( "xs:time(\"23:59:59Z\") ge xs:time(\"00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-equal2args-19 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:time-equal" operator (ge) * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:time(mid range) * ******************************************************* * . */ @org.junit.Test public void opTimeEqual2args19() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") ge xs:time(\"08:03:35Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-equal2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-equal" operator * with the arguments set as follows: * $arg1 = xs:time(mid range) * $arg2 = xs:time(lower bound) * ******************************************************* * . */ @org.junit.Test public void opTimeEqual2args2() { final XQuery query = new XQuery( "xs:time(\"08:03:35Z\") eq xs:time(\"00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-equal2args-20 * Written By: Carmelo Montanez * Date: June 3, 2005 * Purpose: Evaluates The "op:time-equal" operator (ge) * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:time(upper bound) * ******************************************************* * . */ @org.junit.Test public void opTimeEqual2args20() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") ge xs:time(\"23:59:59Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-equal2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-equal" operator * with the arguments set as follows: * $arg1 = xs:time(upper bound) * $arg2 = xs:time(lower bound) * ******************************************************* * . */ @org.junit.Test public void opTimeEqual2args3() { final XQuery query = new XQuery( "xs:time(\"23:59:59Z\") eq xs:time(\"00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-equal2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-equal" operator * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:time(mid range) * ******************************************************* * . */ @org.junit.Test public void opTimeEqual2args4() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") eq xs:time(\"08:03:35Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-equal2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-equal" operator * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:time(upper bound) * ******************************************************* * . */ @org.junit.Test public void opTimeEqual2args5() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") eq xs:time(\"23:59:59Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-equal2args-6 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-equal" operator * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:time(lower bound) * ******************************************************* * . */ @org.junit.Test public void opTimeEqual2args6() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") ne xs:time(\"00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-equal2args-7 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-equal" operator * with the arguments set as follows: * $arg1 = xs:time(mid range) * $arg2 = xs:time(lower bound) * ******************************************************* * . */ @org.junit.Test public void opTimeEqual2args7() { final XQuery query = new XQuery( "xs:time(\"08:03:35Z\") ne xs:time(\"00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-equal2args-8 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-equal" operator * with the arguments set as follows: * $arg1 = xs:time(upper bound) * $arg2 = xs:time(lower bound) * ******************************************************* * . */ @org.junit.Test public void opTimeEqual2args8() { final XQuery query = new XQuery( "xs:time(\"23:59:59Z\") ne xs:time(\"00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-equal2args-9 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-equal" operator * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:time(mid range) * ******************************************************* * . */ @org.junit.Test public void opTimeEqual2args9() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") ne xs:time(\"08:03:35Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpTimeGreaterThan.java000066400000000000000000001041021222453003200303020ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the time-greater-than() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpTimeGreaterThan extends QT3TestSet { /** * * ******************************************************* * Test: K-TimeGT-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'lt' for xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeGT1() { final XQuery query = new XQuery( "xs:time(\"23:01:03.12\") lt xs:time(\"23:01:04.12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-TimeGT-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'lt' for xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeGT2() { final XQuery query = new XQuery( "not(xs:time(\"23:01:04.12\") lt xs:time(\"23:01:04.12\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-TimeGT-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'lt' for xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeGT3() { final XQuery query = new XQuery( "not(xs:time(\"23:01:05.12\") lt xs:time(\"23:01:04.12\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-TimeGT-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'le' for xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeGT4() { final XQuery query = new XQuery( "xs:time(\"23:01:04.12\") le xs:time(\"23:01:04.12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-TimeGT-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'le' for xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeGT5() { final XQuery query = new XQuery( "xs:time(\"23:01:03.12\") le xs:time(\"23:01:04.12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-TimeGT-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'le' for xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeGT6() { final XQuery query = new XQuery( "not(xs:time(\"23:01:05.12\") le xs:time(\"23:01:04.12\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeGreaterThan001() { final XQuery query = new XQuery( "\n" + " declare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string };\n" + " declare function local:time($hours as xs:integer, $mins as xs:integer, $seconds as xs:decimal) { let $h := local:two-digit($hours), $m := local:two-digit($mins) return xs:time(concat($h, ':', $m, ':', $seconds)) };\n" + " not(local:time(12, 59, 30) gt xs:time(\"12:32:05\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeGreaterThan002() { final XQuery query = new XQuery( "xs:time(\"14:00:00-12:00\") gt xs:time(\"02:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeGreaterThan003() { final XQuery query = new XQuery( "xs:time(\"02:00:00\") gt xs:time(\"14:00:00-12:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeGreaterThan004() { final XQuery query = new XQuery( "if (implicit-timezone() gt xs:dayTimeDuration('PT1H'))\n" + " then xs:time(\"00:00:00\") gt xs:time(\"00:00:00+01:00\")\n" + " else xs:time(\"00:00:00+01:01\") gt xs:time(\"00:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeGreaterThan005() { final XQuery query = new XQuery( "if (implicit-timezone() gt xs:dayTimeDuration('PT1H'))\n" + " then xs:time(\"00:00:01+01:00\") gt xs:time(\"00:00:00\")\n" + " else xs:time(\"00:00:00\") gt xs:time(\"00:00:00+01:01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeGreaterThan006() { final XQuery query = new XQuery( "\n" + " declare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string };\n" + " declare function local:time($hours as xs:integer, $mins as xs:integer, $seconds as xs:decimal) { let $h := local:two-digit($hours), $m := local:two-digit($mins) return xs:time(concat($h, ':', $m, ':', $seconds)) };\n" + " not(local:time(12, 59, 30) le xs:time(\"12:32:05\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeGreaterThan007() { final XQuery query = new XQuery( "xs:time(\"14:00:00-12:00\") le xs:time(\"02:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeGreaterThan008() { final XQuery query = new XQuery( "xs:time(\"02:00:00\") le xs:time(\"14:00:00-12:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeGreaterThan009() { final XQuery query = new XQuery( "if (implicit-timezone() gt xs:dayTimeDuration('PT1H'))\n" + " then xs:time(\"00:00:00\") le xs:time(\"00:00:00+01:00\")\n" + " else xs:time(\"00:00:00+01:01\") le xs:time(\"00:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeGreaterThan010() { final XQuery query = new XQuery( "if (implicit-timezone() gt xs:dayTimeDuration('PT1H'))\n" + " then xs:time(\"00:00:01+01:00\") le xs:time(\"00:00:00\")\n" + " else xs:time(\"00:00:00\") le xs:time(\"00:00:00+01:01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeGreaterThan011() { final XQuery query = new XQuery( "\n" + " declare function local:time($time as xs:time, $null as xs:boolean) { if ($null) then () else $time };\n" + " exists(local:time(xs:time(\"23:58:00\"), fn:true()) gt xs:time(\"23:58:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeGreaterThan012() { final XQuery query = new XQuery( "\n" + " declare function local:time($time as xs:time, $null as xs:boolean) { if ($null) then () else $time };\n" + " local:time(xs:time(\"23:58:00\"), fn:false()) gt xs:time(\"23:58:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeGreaterThan013() { final XQuery query = new XQuery( "\n" + " declare function local:time($time as xs:time, $null as xs:boolean) { if ($null) then () else $time };\n" + " exists(local:time(xs:time(\"23:58:00\"), fn:true()) le xs:time(\"23:58:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeGreaterThan014() { final XQuery query = new XQuery( "\n" + " declare function local:time($time as xs:time, $null as xs:boolean) { if ($null) then () else $time };\n" + " local:time(xs:time(\"23:58:00\"), fn:false()) le xs:time(\"23:58:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-greater-than-1 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-greater-than" function * As per example 1 (for this function)of the F&O specs * (gt operator). * ******************************************************* * . */ @org.junit.Test public void opTimeGreaterThan1() { final XQuery query = new XQuery( "(xs:time(\"08:00:00+09:00\") gt xs:time(\"17:00:00-06:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-greater-than-10 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-greater-than" function used * together with "or" expression (ge operator). * ******************************************************* * . */ @org.junit.Test public void opTimeGreaterThan10() { final XQuery query = new XQuery( "(xs:time(\"13:00:00Z\") ge xs:time(\"17:00:00Z\")) or (xs:time(\"13:00:00Z\") ge xs:time(\"17:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-greater-than-11 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-greater-than" function used * together with "fn:true"/or expression (gt operator). * ******************************************************* * . */ @org.junit.Test public void opTimeGreaterThan11() { final XQuery query = new XQuery( "(xs:time(\"13:00:00Z\") gt xs:time(\"17:00:00Z\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-greater-than-12 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-greater-than" function used * together with "fn:true"/or expression (ge operator). * ******************************************************* * . */ @org.junit.Test public void opTimeGreaterThan12() { final XQuery query = new XQuery( "(xs:time(\"13:00:00Z\") ge xs:time(\"17:00:00Z\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-greater-than-13 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-greater-than" function used * together with "fn:false"/or expression (gt operator). * ******************************************************* * . */ @org.junit.Test public void opTimeGreaterThan13() { final XQuery query = new XQuery( "(xs:time(\"13:00:00Z\") gt xs:time(\"17:00:00Z\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-greater-than-14 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-greater-than" function used * together with "fn:false"/or expression (ge operator). * ******************************************************* * . */ @org.junit.Test public void opTimeGreaterThan14() { final XQuery query = new XQuery( "(xs:time(\"13:00:00Z\") ge xs:time(\"17:00:00Z\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-greater-than-2 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-greater-than" function * As per example 1 (for this function)of the F&O specs * (ge operator). * ******************************************************* * . */ @org.junit.Test public void opTimeGreaterThan2() { final XQuery query = new XQuery( "(xs:time(\"08:00:00+09:00\") ge xs:time(\"17:00:00-06:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-greater-than-3 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-greater-than" function that * return true and used together with fn:not (gt operator) * ******************************************************* * . */ @org.junit.Test public void opTimeGreaterThan3() { final XQuery query = new XQuery( "fn:not((xs:time(\"14:00:00Z\") gt xs:time(\"13:00:00Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-greater-than-4 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-greater-than" function that * return true and used together with fn:not (ge operator) * ******************************************************* * . */ @org.junit.Test public void opTimeGreaterThan4() { final XQuery query = new XQuery( "fn:not(xs:time(\"13:00:00Z\") ge xs:time(\"10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-greater-than-5 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-greater-than" function that * return false and used together with fn:not (gt operator) * ******************************************************* * . */ @org.junit.Test public void opTimeGreaterThan5() { final XQuery query = new XQuery( "fn:not(xs:time(\"13:00:00Z\") gt xs:time(\"14:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-greater-than-6 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-greater-than" function that * return false and used together with fn:not(ge operator) * ******************************************************* * . */ @org.junit.Test public void opTimeGreaterThan6() { final XQuery query = new XQuery( "fn:not(xs:time(\"13:00:00Z\") ge xs:time(\"17:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-greater-than-7 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-greater-than" function used * together with "and" expression (gt operator). * ******************************************************* * . */ @org.junit.Test public void opTimeGreaterThan7() { final XQuery query = new XQuery( "(xs:time(\"13:00:00Z\") gt xs:time(\"17:00:00Z\")) and (xs:time(\"13:00:00Z\") gt xs:time(\"17:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-greater-than-8 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-greater-than" function used * together with "and" expression (ge operator). * ******************************************************* * . */ @org.junit.Test public void opTimeGreaterThan8() { final XQuery query = new XQuery( "(xs:time(\"13:00:00Z\") ge xs:time(\"17:00:00Z\")) and (xs:time(\"13:00:00Z\") ge xs:time(\"17:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-greater-than-9 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-greater-than" function used * together with "or" expression (gt operator). * ******************************************************* * . */ @org.junit.Test public void opTimeGreaterThan9() { final XQuery query = new XQuery( "(xs:time(\"13:00:00Z\") gt xs:time(\"17:00:00Z\")) or (xs:time(\"13:00:00Z\") gt xs:time(\"17:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-greater-than2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-greater-than" operator * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:time(lower bound) * ******************************************************* * . */ @org.junit.Test public void opTimeGreaterThan2args1() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") gt xs:time(\"00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-greater-than2args-10 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-greater-than" operator * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:time(upper bound) * ******************************************************* * . */ @org.junit.Test public void opTimeGreaterThan2args10() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") le xs:time(\"23:59:59Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-greater-than2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-greater-than" operator * with the arguments set as follows: * $arg1 = xs:time(mid range) * $arg2 = xs:time(lower bound) * ******************************************************* * . */ @org.junit.Test public void opTimeGreaterThan2args2() { final XQuery query = new XQuery( "xs:time(\"08:03:35Z\") gt xs:time(\"00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-greater-than2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-greater-than" operator * with the arguments set as follows: * $arg1 = xs:time(upper bound) * $arg2 = xs:time(lower bound) * ******************************************************* * . */ @org.junit.Test public void opTimeGreaterThan2args3() { final XQuery query = new XQuery( "xs:time(\"23:59:59Z\") gt xs:time(\"00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-greater-than2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-greater-than" operator * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:time(mid range) * ******************************************************* * . */ @org.junit.Test public void opTimeGreaterThan2args4() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") gt xs:time(\"08:03:35Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-greater-than2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-greater-than" operator * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:time(upper bound) * ******************************************************* * . */ @org.junit.Test public void opTimeGreaterThan2args5() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") gt xs:time(\"23:59:59Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-greater-than2args-6 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-greater-than" operator * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:time(lower bound) * ******************************************************* * . */ @org.junit.Test public void opTimeGreaterThan2args6() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") le xs:time(\"00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-greater-than2args-7 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-greater-than" operator * with the arguments set as follows: * $arg1 = xs:time(mid range) * $arg2 = xs:time(lower bound) * ******************************************************* * . */ @org.junit.Test public void opTimeGreaterThan2args7() { final XQuery query = new XQuery( "xs:time(\"08:03:35Z\") le xs:time(\"00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-greater-than2args-8 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-greater-than" operator * with the arguments set as follows: * $arg1 = xs:time(upper bound) * $arg2 = xs:time(lower bound) * ******************************************************* * . */ @org.junit.Test public void opTimeGreaterThan2args8() { final XQuery query = new XQuery( "xs:time(\"23:59:59Z\") le xs:time(\"00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-greater-than2args-9 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-greater-than" operator * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:time(mid range) * ******************************************************* * . */ @org.junit.Test public void opTimeGreaterThan2args9() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") le xs:time(\"08:03:35Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpTimeLessThan.java000066400000000000000000001034701222453003200276260ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the time-less-than() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpTimeLessThan extends QT3TestSet { /** * * ******************************************************* * Test: K-TimeLT-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'gt' for xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeLT1() { final XQuery query = new XQuery( "xs:time(\"23:01:05.12\") gt xs:time(\"23:01:04.12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-TimeLT-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'gt' for xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeLT2() { final XQuery query = new XQuery( "not(xs:time(\"23:01:03.12\") gt xs:time(\"23:01:04.12\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-TimeLT-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'gt' for xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeLT3() { final XQuery query = new XQuery( "not(xs:time(\"23:01:04.12\") gt xs:time(\"23:01:04.12\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-TimeLT-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ge' for xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeLT4() { final XQuery query = new XQuery( "xs:time(\"23:01:04.12\") ge xs:time(\"23:01:04.12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-TimeLT-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ge' for xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeLT5() { final XQuery query = new XQuery( "xs:time(\"23:01:05.12\") ge xs:time(\"23:01:04.12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-TimeLT-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ge' for xs:time. * ******************************************************* * . */ @org.junit.Test public void kTimeLT6() { final XQuery query = new XQuery( "not(xs:time(\"23:01:03.12\") ge xs:time(\"23:01:04.12\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeLessThan001() { final XQuery query = new XQuery( "\n" + " declare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string };\n" + " declare function local:time($hours as xs:integer, $mins as xs:integer, $seconds as xs:decimal) { let $h := local:two-digit($hours), $m := local:two-digit($mins) return xs:time(concat($h, ':', $m, ':', $seconds)) };\n" + " not(local:time(12, 59, 30) lt xs:time(\"12:32:05\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeLessThan002() { final XQuery query = new XQuery( "xs:time(\"14:00:00-12:00\") lt xs:time(\"02:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeLessThan003() { final XQuery query = new XQuery( "xs:time(\"02:00:00\") lt xs:time(\"14:00:00-12:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeLessThan004() { final XQuery query = new XQuery( "if (implicit-timezone() gt xs:dayTimeDuration('PT1H'))\n" + " then xs:time(\"00:00:00\") lt xs:time(\"00:00:00+01:00\")\n" + " else xs:time(\"00:00:00+01:01\") lt xs:time(\"00:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeLessThan005() { final XQuery query = new XQuery( "if (implicit-timezone() gt xs:dayTimeDuration('PT1H'))\n" + " then xs:time(\"00:00:00+01:00\") lt xs:time(\"00:00:00\")\n" + " else xs:time(\"00:00:00\") lt xs:time(\"00:00:00+01:01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeLessThan006() { final XQuery query = new XQuery( "\n" + " declare function local:two-digit($number as xs:integer) { let $string := string($number) return if (string-length($string) lt 2) then concat('0', $string) else $string };\n" + " declare function local:time($hours as xs:integer, $mins as xs:integer, $seconds as xs:decimal) { let $h := local:two-digit($hours), $m := local:two-digit($mins) return xs:time(concat($h, ':', $m, ':', $seconds)) };\n" + " not(local:time(12, 59, 30) ge xs:time(\"12:32:05\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeLessThan007() { final XQuery query = new XQuery( "xs:time(\"14:00:00-12:00\") ge xs:time(\"02:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeLessThan008() { final XQuery query = new XQuery( "xs:time(\"02:00:00\") ge xs:time(\"14:00:00-12:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeLessThan009() { final XQuery query = new XQuery( "if (implicit-timezone() gt xs:dayTimeDuration('PT1H'))\n" + " then xs:time(\"00:00:00\") ge xs:time(\"00:00:01+01:00\") \n" + " else xs:time(\"00:00:00+01:01\") ge xs:time(\"00:00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeLessThan010() { final XQuery query = new XQuery( "if (implicit-timezone() gt xs:dayTimeDuration('PT1H'))\n" + " then xs:time(\"00:00:01+01:00\") ge xs:time(\"00:00:00\")\n" + " else xs:time(\"00:00:00\") ge xs:time(\"00:00:00+01:01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeLessThan011() { final XQuery query = new XQuery( "\n" + " declare function local:time($time as xs:time, $null as xs:boolean) { if ($null) then () else $time };\n" + " exists(local:time(xs:time(\"23:58:00\"), fn:true()) lt xs:time(\"23:58:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeLessThan012() { final XQuery query = new XQuery( "\n" + " declare function local:time($time as xs:time, $null as xs:boolean) { if ($null) then () else $time };\n" + " local:time(xs:time(\"23:58:00\"), fn:false()) lt xs:time(\"23:58:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeLessThan013() { final XQuery query = new XQuery( "\n" + " declare function local:time($time as xs:time, $null as xs:boolean) { if ($null) then () else $time };\n" + " exists(local:time(xs:time(\"23:58:00\"), fn:true()) ge xs:time(\"23:58:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of time . */ @org.junit.Test public void cbclTimeLessThan014() { final XQuery query = new XQuery( "\n" + " declare function local:time($time as xs:time, $null as xs:boolean) { if ($null) then () else $time };\n" + " local:time(xs:time(\"23:58:00\"), fn:false()) ge xs:time(\"23:58:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-less-than-1 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-less-than" function * As per example 1 (for this function)of the F&O specs * ******************************************************* * . */ @org.junit.Test public void opTimeLessThan1() { final XQuery query = new XQuery( "(xs:time(\"12:00:00-05:00\") lt xs:time(\"23:00:00+06:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-less-than-10 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-less-than" function used * together with "or" expression (le operator). * ******************************************************* * . */ @org.junit.Test public void opTimeLessThan10() { final XQuery query = new XQuery( "(xs:time(\"13:00:00Z\") le xs:time(\"17:00:00Z\")) or (xs:time(\"13:00:00Z\") le xs:time(\"17:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-less-than-11 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-less-than" function used * together with "fn:true"/or expression (lt operator). * ******************************************************* * . */ @org.junit.Test public void opTimeLessThan11() { final XQuery query = new XQuery( "(xs:time(\"13:00:00Z\") lt xs:time(\"17:00:00Z\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-less-than-12 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-less-than" function used * together with "fn:true"/or expression (le operator). * ******************************************************* * . */ @org.junit.Test public void opTimeLessThan12() { final XQuery query = new XQuery( "(xs:time(\"13:00:00Z\") le xs:time(\"17:00:00Z\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-less-than-13 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-less-than" function used * together with "fn:false"/or expression (lt operator). * ******************************************************* * . */ @org.junit.Test public void opTimeLessThan13() { final XQuery query = new XQuery( "(xs:time(\"13:00:00Z\") lt xs:time(\"17:00:00Z\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-less-than-14 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-less-than" function used * together with "fn:false"/or expression (le operator). * ******************************************************* * . */ @org.junit.Test public void opTimeLessThan14() { final XQuery query = new XQuery( "(xs:time(\"13:00:00Z\") le xs:time(\"17:00:00Z\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-less-than-2 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-less-than" function * As per example 2 (for this function) of the F&O specs * ******************************************************* * . */ @org.junit.Test public void opTimeLessThan2() { final XQuery query = new XQuery( "xs:time(\"11:00:00-05:00\") lt xs:time(\"17:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-less-than-3 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-less-than" function that * return true and used together with fn:not (lt operator) * ******************************************************* * . */ @org.junit.Test public void opTimeLessThan3() { final XQuery query = new XQuery( "fn:not((xs:time(\"13:00:00Z\") lt xs:time(\"14:00:00Z\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-less-than-4 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-less-than" function that * return true and used together with fn:not (le operator) * ******************************************************* * . */ @org.junit.Test public void opTimeLessThan4() { final XQuery query = new XQuery( "fn:not(xs:time(\"13:00:00Z\") le xs:time(\"14:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-less-than-5 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-less-than" function that * return false and used together with fn:not (lt operator) * ******************************************************* * . */ @org.junit.Test public void opTimeLessThan5() { final XQuery query = new XQuery( "fn:not(xs:time(\"13:00:00Z\") lt xs:time(\"10:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-less-than-6 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-less-than" function that * return false and used together with fn:not(le operator) * ******************************************************* * . */ @org.junit.Test public void opTimeLessThan6() { final XQuery query = new XQuery( "fn:not(xs:time(\"13:00:00Z\") le xs:time(\"12:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-less-than-7 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-less-than" function used * together with "and" expression (lt operator). * ******************************************************* * . */ @org.junit.Test public void opTimeLessThan7() { final XQuery query = new XQuery( "(xs:time(\"13:00:00Z\") lt xs:time(\"17:00:00Z\")) and (xs:time(\"13:00:00Z\") lt xs:time(\"17:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-less-than-8 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-less-than" function used * together with "and" expression (le operator). * ******************************************************* * . */ @org.junit.Test public void opTimeLessThan8() { final XQuery query = new XQuery( "(xs:time(\"13:00:00Z\") le xs:time(\"17:00:00Z\")) and (xs:time(\"13:00:00Z\") le xs:time(\"17:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-less-than-9 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "time-less-than" function used * together with "or" expression (lt operator). * ******************************************************* * . */ @org.junit.Test public void opTimeLessThan9() { final XQuery query = new XQuery( "(xs:time(\"13:00:00Z\") lt xs:time(\"17:00:00Z\")) or (xs:time(\"13:00:00Z\") lt xs:time(\"17:00:00Z\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-less-than2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-less-than" operator * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:time(lower bound) * ******************************************************* * . */ @org.junit.Test public void opTimeLessThan2args1() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") lt xs:time(\"00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-less-than2args-10 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-less-than" operator * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:time(upper bound) * ******************************************************* * . */ @org.junit.Test public void opTimeLessThan2args10() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") ge xs:time(\"23:59:59Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-less-than2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-less-than" operator * with the arguments set as follows: * $arg1 = xs:time(mid range) * $arg2 = xs:time(lower bound) * ******************************************************* * . */ @org.junit.Test public void opTimeLessThan2args2() { final XQuery query = new XQuery( "xs:time(\"08:03:35Z\") lt xs:time(\"00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-less-than2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-less-than" operator * with the arguments set as follows: * $arg1 = xs:time(upper bound) * $arg2 = xs:time(lower bound) * ******************************************************* * . */ @org.junit.Test public void opTimeLessThan2args3() { final XQuery query = new XQuery( "xs:time(\"23:59:59Z\") lt xs:time(\"00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-time-less-than2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-less-than" operator * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:time(mid range) * ******************************************************* * . */ @org.junit.Test public void opTimeLessThan2args4() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") lt xs:time(\"08:03:35Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-less-than2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-less-than" operator * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:time(upper bound) * ******************************************************* * . */ @org.junit.Test public void opTimeLessThan2args5() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") lt xs:time(\"23:59:59Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-less-than2args-6 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-less-than" operator * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:time(lower bound) * ******************************************************* * . */ @org.junit.Test public void opTimeLessThan2args6() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") ge xs:time(\"00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-less-than2args-7 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-less-than" operator * with the arguments set as follows: * $arg1 = xs:time(mid range) * $arg2 = xs:time(lower bound) * ******************************************************* * . */ @org.junit.Test public void opTimeLessThan2args7() { final XQuery query = new XQuery( "xs:time(\"08:03:35Z\") ge xs:time(\"00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-less-than2args-8 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-less-than" operator * with the arguments set as follows: * $arg1 = xs:time(upper bound) * $arg2 = xs:time(lower bound) * ******************************************************* * . */ @org.junit.Test public void opTimeLessThan2args8() { final XQuery query = new XQuery( "xs:time(\"23:59:59Z\") ge xs:time(\"00:00:00Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-time-less-than2args-9 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:07 GMT-05:00 2005 * Purpose: Evaluates The "op:time-less-than" operator * with the arguments set as follows: * $arg1 = xs:time(lower bound) * $arg2 = xs:time(mid range) * ******************************************************* * . */ @org.junit.Test public void opTimeLessThan2args9() { final XQuery query = new XQuery( "xs:time(\"00:00:00Z\") ge xs:time(\"08:03:35Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpTo.java000066400000000000000000001001721222453003200256440ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the to() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpTo extends QT3TestSet { /** * Since the left operand has the static cardinality zero-or-more, implementations using the static typing feature may raise XPTY0004. . */ @org.junit.Test public void kRangeExpr1() { final XQuery query = new XQuery( "1 to 1 eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * A test whose essence is: `count((10, 1 to 4)) eq 5`. . */ @org.junit.Test public void kRangeExpr10() { final XQuery query = new XQuery( "count((10, 1 to 4)) eq 5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `subsequence(-3 to -1, 1, 1) eq -3`. . */ @org.junit.Test public void kRangeExpr11() { final XQuery query = new XQuery( "subsequence(-3 to -1, 1, 1) eq -3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `subsequence(-3 to -1, 3, 1) eq -1`. . */ @org.junit.Test public void kRangeExpr12() { final XQuery query = new XQuery( "subsequence(-3 to -1, 3, 1) eq -1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(reverse(4 to 1))`. . */ @org.junit.Test public void kRangeExpr13() { final XQuery query = new XQuery( "empty(reverse(4 to 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `subsequence(reverse(1 to 3), 1, 1) eq 3`. . */ @org.junit.Test public void kRangeExpr14() { final XQuery query = new XQuery( "subsequence(reverse(1 to 3), 1, 1) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `subsequence(reverse(1 to 3), 3, 1) eq 1`. . */ @org.junit.Test public void kRangeExpr15() { final XQuery query = new XQuery( "subsequence(reverse(1 to 3), 3, 1) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `subsequence(reverse(1 to 4), 2, 1) eq 3`. . */ @org.junit.Test public void kRangeExpr16() { final XQuery query = new XQuery( "subsequence(reverse(1 to 4), 2, 1) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `subsequence(reverse(1 to 4), 3, 1) eq 2`. . */ @org.junit.Test public void kRangeExpr17() { final XQuery query = new XQuery( "subsequence(reverse(1 to 4), 3, 1) eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `subsequence(reverse(-4 to -1), 2, 1) eq -2`. . */ @org.junit.Test public void kRangeExpr18() { final XQuery query = new XQuery( "subsequence(reverse(-4 to -1), 2, 1) eq -2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal((-1, -2, -3, -4), reverse(-4 to -1))`. . */ @org.junit.Test public void kRangeExpr19() { final XQuery query = new XQuery( "deep-equal((-1, -2, -3, -4), reverse(-4 to -1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(30 to 3)`. . */ @org.junit.Test public void kRangeExpr2() { final XQuery query = new XQuery( "empty(30 to 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal((), reverse(0 to -5))`. . */ @org.junit.Test public void kRangeExpr20() { final XQuery query = new XQuery( "deep-equal((), reverse(0 to -5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal((0, -1, -2, -3, -4, -5), reverse(-5 to 0))`. . */ @org.junit.Test public void kRangeExpr21() { final XQuery query = new XQuery( "deep-equal((0, -1, -2, -3, -4, -5), reverse(-5 to 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(reverse(-5 to -2)) eq 4`. . */ @org.junit.Test public void kRangeExpr22() { final XQuery query = new XQuery( "count(reverse(-5 to -2)) eq 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(reverse(-5 to -0)) eq 6`. . */ @org.junit.Test public void kRangeExpr23() { final XQuery query = new XQuery( "count(reverse(-5 to -0)) eq 6", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(reverse(1 to 4)) eq 4`. . */ @org.junit.Test public void kRangeExpr24() { final XQuery query = new XQuery( "count(reverse(1 to 4)) eq 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(1 to 0)`. . */ @org.junit.Test public void kRangeExpr25() { final XQuery query = new XQuery( "empty(1 to 0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(0 to -5)`. . */ @org.junit.Test public void kRangeExpr26() { final XQuery query = new XQuery( "empty(0 to -5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(-4 to -5)`. . */ @org.junit.Test public void kRangeExpr27() { final XQuery query = new XQuery( "empty(-4 to -5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(reverse(1 to 0))`. . */ @org.junit.Test public void kRangeExpr28() { final XQuery query = new XQuery( "empty(reverse(1 to 0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(reverse(0 to -5))`. . */ @org.junit.Test public void kRangeExpr29() { final XQuery query = new XQuery( "empty(reverse(0 to -5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(0 to -3)`. . */ @org.junit.Test public void kRangeExpr3() { final XQuery query = new XQuery( "empty(0 to -3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `empty(reverse(-4 to -5))`. . */ @org.junit.Test public void kRangeExpr30() { final XQuery query = new XQuery( "empty(reverse(-4 to -5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(remove((2.e0, 4), 1) treat as xs:integer to 4)`. . */ @org.junit.Test public void kRangeExpr31() { final XQuery query = new XQuery( "(remove((2.e0, 4), 1) treat as xs:integer to 4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4") ); } /** * A test whose essence is: `(4 to remove((2e0, 4), 1) treat as xs:integer)`. . */ @org.junit.Test public void kRangeExpr32() { final XQuery query = new XQuery( "(4 to remove((2e0, 4), 1) treat as xs:integer)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4") ); } /** * A test whose essence is: `1.1 to 3`. . */ @org.junit.Test public void kRangeExpr33() { final XQuery query = new XQuery( "1.1 to 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A test whose essence is: `3 to 1.1`. . */ @org.junit.Test public void kRangeExpr34() { final XQuery query = new XQuery( "3 to 1.1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A test whose essence is: `1.1 to 3.3`. . */ @org.junit.Test public void kRangeExpr35() { final XQuery query = new XQuery( "1.1 to 3.3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A test whose essence is: `1 + 1.1 to 5`. . */ @org.junit.Test public void kRangeExpr36() { final XQuery query = new XQuery( "1 + 1.1 to 5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A test whose essence is: `empty(1 to ())`. . */ @org.junit.Test public void kRangeExpr4() { final XQuery query = new XQuery( "empty(1 to ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * A test whose essence is: `empty(() to 1)`. . */ @org.junit.Test public void kRangeExpr5() { final XQuery query = new XQuery( "empty(() to 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * A test whose essence is: `empty(-1 to -3)`. . */ @org.junit.Test public void kRangeExpr6() { final XQuery query = new XQuery( "empty(-1 to -3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(1 to 4) eq 4`. . */ @org.junit.Test public void kRangeExpr7() { final XQuery query = new XQuery( "count(1 to 4) eq 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(0 to 4) eq 5`. . */ @org.junit.Test public void kRangeExpr8() { final XQuery query = new XQuery( "count(0 to 4) eq 5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(-5 to -0) eq 6`. . */ @org.junit.Test public void kRangeExpr9() { final XQuery query = new XQuery( "count(-5 to -0) eq 6", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The range expression doesn't accept xs:double as operand. . */ @org.junit.Test public void k2RangeExpr1() { final XQuery query = new XQuery( "1e3 to 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The range expression doesn't accept xs:double as operand. . */ @org.junit.Test public void k2RangeExpr2() { final XQuery query = new XQuery( "3 to 1e3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Combine with a for expression. . */ @org.junit.Test public void k2RangeExpr3() { final XQuery query = new XQuery( "for $i in 1 to 3 return $i", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3") ); } /** * Expressions that are tricky for local rewrites. . */ @org.junit.Test public void k2RangeExpr4() { final XQuery query = new XQuery( "1 to 5, 5 to 5, 1 to 5, 1 to 5, let $i := 5 return $i to $i, count(5 to 10), count(1000 to 2000), count(5 to 10), count(3 to 10), count(3 to 10), count(5 to 10), count(3 to 10), count(3 to 10), count(4294967295 to 4294967298)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 4 5 5 1 2 3 4 5 1 2 3 4 5 5 6 1001 6 8 8 6 8 8 4") ); } /** * Evaluation of a single range expression using positive integers. . */ @org.junit.Test public void rangeExpr1() { final XQuery query = new XQuery( "(10, 1 to 4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10 1 2 3 4") ); } /** * Evaluation of a range expression, where the second operand is "xs:integer" function. . */ @org.junit.Test public void rangeExpr10() { final XQuery query = new XQuery( "(1 to xs:integer(5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 4 5") ); } /** * Evaluation of a range expression, where both operands are "xs:integer" functions. . */ @org.junit.Test public void rangeExpr11() { final XQuery query = new XQuery( "(xs:integer(1) to xs:integer(5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 4 5") ); } /** * Evaluation of a range expression, using the "fn:min" function . */ @org.junit.Test public void rangeExpr12() { final XQuery query = new XQuery( "(fn:min((1,2)) to 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 4 5") ); } /** * Evaluation of a range expression, using the "fn:max" function . */ @org.junit.Test public void rangeExpr13() { final XQuery query = new XQuery( "(fn:max((1,2)) to 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2 3 4 5") ); } /** * Evaluation of a range expression, using the "fn:min" and "fn:max" functions . */ @org.junit.Test public void rangeExpr14() { final XQuery query = new XQuery( "(fn:min((1,2)) to fn:max((6,7)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 4 5 6 7") ); } /** * Evaluation of a range expression as an argument to a "fn:min" function) . */ @org.junit.Test public void rangeExpr15() { final XQuery query = new XQuery( "fn:min((1 to 5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluation of a range expression as an argument to a "fn:max" function) . */ @org.junit.Test public void rangeExpr16() { final XQuery query = new XQuery( "fn:max((1 to 5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5") ); } /** * Evaluation of a range expression as an argument to an "fn:avg" function) . */ @org.junit.Test public void rangeExpr17() { final XQuery query = new XQuery( "fn:avg((1 to 5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Evaluation of a range expression as an argument to an "fn:count" function) . */ @org.junit.Test public void rangeExpr18() { final XQuery query = new XQuery( "fn:count((1 to 5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5") ); } /** * Evaluation of a range expression, where the first operand is a multiplication operation. . */ @org.junit.Test public void rangeExpr19() { final XQuery query = new XQuery( "((3*2) to 10)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "6 7 8 9 10") ); } /** * Evaluation of a range expression of length one containing the single integer 10. . */ @org.junit.Test public void rangeExpr2() { final XQuery query = new XQuery( "10 to 10", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10") ); } /** * Evaluation of a range expression, where the second operand is a multiplication operation. . */ @org.junit.Test public void rangeExpr20() { final XQuery query = new XQuery( "(1 to (3*2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 4 5 6") ); } /** * Evaluation of a range expression, where both operands are multiplication operations. . */ @org.junit.Test public void rangeExpr21() { final XQuery query = new XQuery( "((1*2) to (3*2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2 3 4 5 6") ); } /** * Evaluation of a range expression, where the first operand is a subtraction operation. . */ @org.junit.Test public void rangeExpr22() { final XQuery query = new XQuery( "((3 - 2) to 10)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 4 5 6 7 8 9 10") ); } /** * Evaluation of a range expression, where the second operand is a subtraction operation. . */ @org.junit.Test public void rangeExpr23() { final XQuery query = new XQuery( "(1 to (3 - 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Evaluation of a range expression, where both operands are subtraction operations. . */ @org.junit.Test public void rangeExpr24() { final XQuery query = new XQuery( "((2 - 1) to (7 - 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 4 5 6") ); } /** * Evaluation of a range expression, where the first operand is a division operation. . */ @org.junit.Test public void rangeExpr25() { final XQuery query = new XQuery( "((6 idiv 2) to 10)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3 4 5 6 7 8 9 10") ); } /** * Evaluation of a range expression, where the second operand is a division operation. . */ @org.junit.Test public void rangeExpr26() { final XQuery query = new XQuery( "(1 to (10 idiv 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 4 5") ); } /** * Evaluation of a range expression, where both operands are division operations. . */ @org.junit.Test public void rangeExpr27() { final XQuery query = new XQuery( "((5 idiv 5) to (8 idiv 2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 4") ); } /** * test op:to with large numbers . */ @org.junit.Test public void rangeExpr28() { final XQuery query = new XQuery( "18446744073709551616 to 18446744073709551620", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "18446744073709551616 18446744073709551617 18446744073709551618 18446744073709551619 18446744073709551620") || error("FOAR0002") ) ); } /** * test op:to with large numbers . */ @org.junit.Test public void rangeExpr29() { final XQuery query = new XQuery( "count(18446744073709551616 to 18446744073709551620)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("5") || error("FOAR0002") ) ); } /** * Evaluation of a range expression that results in a sequence of length 0. Uses "fn:count" to avoid empty file. . */ @org.junit.Test public void rangeExpr3() { final XQuery query = new XQuery( "fn:count(15 to 10)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * test op:to with large numbers . */ @org.junit.Test public void rangeExpr30() { final XQuery query = new XQuery( "(28446744073709551616 to 28446744073709551620)!position()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "1 2 3 4 5") || error("FOAR0002") ) ); } /** * test op:to with large numbers . */ @org.junit.Test public void rangeExpr31() { final XQuery query = new XQuery( "((28446744073709551616 to 28446744073709551620)!last())[1]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("5") || error("FOAR0002") ) ); } /** * test op:to with large numbers . */ @org.junit.Test public void rangeExpr32() { final XQuery query = new XQuery( "reverse(28446744073709551616 to 28446744073709551620)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "28446744073709551620 28446744073709551619 28446744073709551618 28446744073709551617 28446744073709551616") || error("FOAR0002") ) ); } /** * Evaluation of a range expression that uses the "reverse" function. . */ @org.junit.Test public void rangeExpr4() { final XQuery query = new XQuery( "fn:reverse(10 to 15)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "15 14 13 12 11 10") ); } /** * Evaluation of a range expression that uses the empty sequence function. Uses the count function to avoid empty file. . */ @org.junit.Test public void rangeExpr5() { final XQuery query = new XQuery( "fn:count((1, 2 to ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "1") || error("XPST0005") ) ); } /** * Evaluation of a range expression, where both operands are addition operations. . */ @org.junit.Test public void rangeExpr6() { final XQuery query = new XQuery( "((1+2) to (2+2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3 4") ); } /** * Evaluation of a range expression, where the first operand are negative number. . */ @org.junit.Test public void rangeExpr7() { final XQuery query = new XQuery( "(-4,-3 to 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-4 -3 -2 -1 0 1 2") ); } /** * Evaluation of a range expression, where both operands are negative integers. . */ @org.junit.Test public void rangeExpr8() { final XQuery query = new XQuery( "(-4, -3 to -1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-4 -3 -2 -1") ); } /** * Evaluation of a range expression, where the first operand is "xs:integer" function. . */ @org.junit.Test public void rangeExpr9() { final XQuery query = new XQuery( "(xs:integer(1) to 5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 4 5") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpUnion.java000066400000000000000000001215101222453003200263510ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the union() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpUnion extends QT3TestSet { /** * Ensure nodes are deduplicated and sorted even though one of the operands is the empty sequence. . */ @org.junit.Test public void k2SeqUnion1() { final XQuery query = new XQuery( " { let $i := return ($i/b, $i/a, $i/b, $i/a) | () } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Use a node kind keyword, document-node, to test query parsing. . */ @org.junit.Test public void k2SeqUnion10() { final XQuery query = new XQuery( "empty(/(author union document-node))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, comment, to test query parsing. . */ @org.junit.Test public void k2SeqUnion11() { final XQuery query = new XQuery( "empty(/(author union comment))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, processing-instruction, to test query parsing. . */ @org.junit.Test public void k2SeqUnion12() { final XQuery query = new XQuery( "empty(/(author union processing-instruction))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, item, to test query parsing. . */ @org.junit.Test public void k2SeqUnion13() { final XQuery query = new XQuery( "empty(/(author union item))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, document, to test query parsing. . */ @org.junit.Test public void k2SeqUnion14() { final XQuery query = new XQuery( "empty(/(author union document))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, if, to test query parsing. . */ @org.junit.Test public void k2SeqUnion15() { final XQuery query = new XQuery( "empty(/(author union if))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, then, to test query parsing. . */ @org.junit.Test public void k2SeqUnion16() { final XQuery query = new XQuery( "empty(/(author union then))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, mod, to test query parsing. . */ @org.junit.Test public void k2SeqUnion17() { final XQuery query = new XQuery( "empty(/(author union mod))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, div, to test query parsing. . */ @org.junit.Test public void k2SeqUnion18() { final XQuery query = new XQuery( "empty(/(author union div))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, empty-sequence, to test query parsing. . */ @org.junit.Test public void k2SeqUnion19() { final XQuery query = new XQuery( "empty(/(author union empty-sequence))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure nodes are deduplicated and sorted even though one of the operands is the empty sequence(#2). . */ @org.junit.Test public void k2SeqUnion2() { final XQuery query = new XQuery( " { let $i := return () | ($i/b, $i/a, $i/b, $i/a) } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Use a node kind keyword, schema-attribute, to test query parsing. . */ @org.junit.Test public void k2SeqUnion20() { final XQuery query = new XQuery( "empty(/(author union schema-attribute))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, schema-element, to test query parsing. . */ @org.junit.Test public void k2SeqUnion21() { final XQuery query = new XQuery( "empty(/(author union schema-element))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a computed attribute constructor as right operand. . */ @org.junit.Test public void k2SeqUnion22() { final XQuery query = new XQuery( "empty(/(a union attribute {\"name\"} {()}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Use a computed attribute constructor as right operand(#2). . */ @org.junit.Test public void k2SeqUnion23() { final XQuery query = new XQuery( "empty(/(a union attribute name {()}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Use a computed attribute constructor as right operand. . */ @org.junit.Test public void k2SeqUnion24() { final XQuery query = new XQuery( "empty(/(a union element {\"name\"} {()}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || error("XPST0005") ) ); } /** * Use an element constructor as right operand(#2). . */ @org.junit.Test public void k2SeqUnion25() { final XQuery query = new XQuery( "empty(/(a union element name {()}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || error("XPST0005") ) ); } /** * Use a processing instruction constructor as right operand. . */ @org.junit.Test public void k2SeqUnion26() { final XQuery query = new XQuery( "empty(/(a union processing-instruction {\"name\"} {()}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Use a processing instruction constructor as right operand. . */ @org.junit.Test public void k2SeqUnion27() { final XQuery query = new XQuery( "empty(/(a union processing-instruction name {}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Use a comment constructor as right operand. . */ @org.junit.Test public void k2SeqUnion28() { final XQuery query = new XQuery( "empty(/(a union comment {()}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Use a text node constructor as right operand. . */ @org.junit.Test public void k2SeqUnion29() { final XQuery query = new XQuery( "empty(/(a union text {()}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use 'comment' as right operand. . */ @org.junit.Test public void k2SeqUnion3() { final XQuery query = new XQuery( "empty(/(author union comment))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that resembles the descendant axis as right operand. . */ @org.junit.Test public void k2SeqUnion30() { final XQuery query = new XQuery( "empty(/(a union descendant))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that resembles the attribute axis as right operand. . */ @org.junit.Test public void k2SeqUnion31() { final XQuery query = new XQuery( "empty(/(a union attribute))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that resembles the self axis as right operand. . */ @org.junit.Test public void k2SeqUnion32() { final XQuery query = new XQuery( "empty(/(a union self))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that resembles the descendant-or-self axis as right operand. . */ @org.junit.Test public void k2SeqUnion33() { final XQuery query = new XQuery( "empty(/(a union descendant-or-self))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that resembles the following-sibling axis as right operand. . */ @org.junit.Test public void k2SeqUnion34() { final XQuery query = new XQuery( "empty(/(a union following-sibling))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that resembles the following axis as right operand. . */ @org.junit.Test public void k2SeqUnion35() { final XQuery query = new XQuery( "empty(/(a union following))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that resembles the preceding-sibling axis as right operand. . */ @org.junit.Test public void k2SeqUnion36() { final XQuery query = new XQuery( "empty(/(a union preceding-sibling))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that resembles the preceding axis as right operand. . */ @org.junit.Test public void k2SeqUnion37() { final XQuery query = new XQuery( "empty(/(a union preceding))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that resembles the parent axis as right operand. . */ @org.junit.Test public void k2SeqUnion38() { final XQuery query = new XQuery( "empty(/(a union parent))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that resembles the ancestor axis as right operand. . */ @org.junit.Test public void k2SeqUnion39() { final XQuery query = new XQuery( "empty(/(a union ancestor))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure node deduplication is done on the operands. . */ @org.junit.Test public void k2SeqUnion4() { final XQuery query = new XQuery( "let $i := /a , $t := $i/following-sibling::b return (($i union ($i, $i)), (($t, $t) union $t))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Use a name test that resembles the ancestor axis as right operand. . */ @org.junit.Test public void k2SeqUnion40() { final XQuery query = new XQuery( "empty(/(a union ancestor))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a name test that resembles the ancestor-or-self axis as right operand. . */ @org.junit.Test public void k2SeqUnion41() { final XQuery query = new XQuery( "empty(/(a union ancestor-or-self))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use 'declare as right operand. . */ @org.junit.Test public void k2SeqUnion42() { final XQuery query = new XQuery( "empty(/(a union declare))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Extract the boolean value from a union expression. . */ @org.junit.Test public void k2SeqUnion43() { final XQuery query = new XQuery( "boolean(//employee[location = \"Denver\"] union //employee[last()])", ctx); try { query.context(node(file("op/union/acme_corp.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Extract the boolean value from a union expression(different keyword). . */ @org.junit.Test public void k2SeqUnion44() { final XQuery query = new XQuery( "boolean(//employee[location = \"Denver\"] | //employee[last()])", ctx); try { query.context(node(file("op/union/acme_corp.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Explicitly sort the result of a union expression. . */ @org.junit.Test public void k2SeqUnion45() { final XQuery query = new XQuery( " { //(employee[location = \"Denver\"] union //employee[last()])/./location } ", ctx); try { query.context(node(file("op/union/acme_corp.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("DenverDenverDenverBoston", false) ); } /** * Ensure two sequential union operators can be parsed(|). . */ @org.junit.Test public void k2SeqUnion46() { final XQuery query = new XQuery( "1|2|3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Ensure two sequential union operators can be parsed(union). . */ @org.junit.Test public void k2SeqUnion47() { final XQuery query = new XQuery( "1 union 2 union 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Only nodes are allowed. . */ @org.junit.Test public void k2SeqUnion5() { final XQuery query = new XQuery( "(1, 2, 3) union (1, 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Use a node kind keyword, text, to test query parsing. . */ @org.junit.Test public void k2SeqUnion6() { final XQuery query = new XQuery( "empty(/(author union text))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, node, to test query parsing. . */ @org.junit.Test public void k2SeqUnion7() { final XQuery query = new XQuery( "empty(/(author union node))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, element, to test query parsing. . */ @org.junit.Test public void k2SeqUnion8() { final XQuery query = new XQuery( "empty(/(author union element))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use a node kind keyword, attribute, to test query parsing. . */ @org.junit.Test public void k2SeqUnion9() { final XQuery query = new XQuery( "empty(/(author union attribute))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Tests various optimizations on op:union . */ @org.junit.Test public void cbclFnUnion001() { final XQuery query = new XQuery( "\n" + " declare variable $x := ;\n" + " declare variable $y := ;\n" + " ($x union $y) union $x, ($x intersect $y) union $x, ($x except $y) union $x, ($y except $x) union $x, $x union ($x union $y), $x union ($x intersect $y), $x union ($x except $y), $x union ($y except $x)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("", false) || assertSerialization("", false) ) ); } /** * Tests optimization of union of path expressions . */ @org.junit.Test public void cbclFnUnion002() { final XQuery query = new XQuery( "\n" + " declare variable $doc := ;\n" + " $doc/test[x] union $doc/test[y]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Simple combination of node sequences involving integers. uses "|" operator . */ @org.junit.Test public void combiningnodeseqhc1() { final XQuery query = new XQuery( "for $h in ( (0,1) | //hours) order by number($h) return $h", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("0112202020202020404040808080", false) ); } /** * Simple combination of node sequences involving multiple xml data sources. Uses "union" operator . */ @org.junit.Test public void combiningnodeseqhc10() { final XQuery query = new XQuery( "for $h in ( ($works//hours) union ($staff//grade[xs:integer(.) gt 12])) order by number($h) return $h", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("121313202020202020404040808080", false) ); } /** * Simple combination of node sequences involving integers. uses "union" operator . */ @org.junit.Test public void combiningnodeseqhc2() { final XQuery query = new XQuery( "for $h in ( (0,1) union (//hours)) order by number($h) return $h", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("0112202020202020404040808080", false) ); } /** * Simple combination of node sequences involving integers and repetition. uses "|" operator . */ @org.junit.Test public void combiningnodeseqhc3() { final XQuery query = new XQuery( "for $h in ( (0,40) | (//hours)) order by number($h) return $h", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("01220202020202040404040808080", false) ); } /** * Simple combination of node sequences involving integers and repetition. uses "union" operator . */ @org.junit.Test public void combiningnodeseqhc4() { final XQuery query = new XQuery( "for $h in ( (0,40) union (//hours)) order by number($h) return $h", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("01220202020202040404040808080", false) ); } /** * Simple combination of node sequences involving integers and the empty sequence. Uses "|" operator . */ @org.junit.Test public void combiningnodeseqhc5() { final XQuery query = new XQuery( "for $h in ( () | (//hours)) order by number($h) return $h", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("12202020202020404040808080", false) ); } /** * Simple combination of node sequences involving integers and the empty sequence. Uses "union" operator . */ @org.junit.Test public void combiningnodeseqhc6() { final XQuery query = new XQuery( "for $h in ( () union (//hours)) order by number($h) return $h", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("12202020202020404040808080", false) ); } /** * Simple combination of node sequences involving different children of xml data source. Uses "|" operator . */ @org.junit.Test public void combiningnodeseqhc7() { final XQuery query = new XQuery( "for $h in ( (//hours[xs:integer(.) le 20]) | (//hours[xs:integer(.) gt 20])) order by number($h) return $h", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("12202020202020404040808080", false) ); } /** * Simple combination of node sequences involving xml data source. Uses "union" operator . */ @org.junit.Test public void combiningnodeseqhc8() { final XQuery query = new XQuery( "for $h in ( (//hours[xs:integer(.) le 20]) union (//hours[xs:integer(.) gt 20])) order by number($h) return $h", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("12202020202020404040808080", false) ); } /** * Simple combination of node sequences involving multiple xml data sources. Uses "|" operator . */ @org.junit.Test public void combiningnodeseqhc9() { final XQuery query = new XQuery( "for $h in ( ($works//hours) | ($staff//grade[xs:integer(.) gt 12])) order by number($h) return $h", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("121313202020202020404040808080", false) ); } /** * arg: node . */ @org.junit.Test public void fnUnionNodeArgs001() { final XQuery query = new XQuery( "/bib/book[3]/title union /bib/book[1]/title", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("TCP/IP IllustratedData on the Web", false) ); } /** * arg: incorrect nodes . */ @org.junit.Test public void fnUnionNodeArgs002() { final XQuery query = new XQuery( "(/bib/book/title | /bib/book)/local-name()", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "book title book title book title book title") ); } /** * arg: node . */ @org.junit.Test public void fnUnionNodeArgs003() { final XQuery query = new XQuery( "/bib/book[3]/title | root(fn:exactly-one(/bib/book[3]/title))", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n \n TCP/IP Illustrated\n StevensW.\n Addison-Wesley\n 65.95\n \n \n \n Advanced Programming in the Unix environment\n StevensW.\n Addison-Wesley\n 65.95\n \n \n \n Data on the Web\n AbiteboulSerge\n BunemanPeter\n SuciuDan\n Morgan Kaufmann Publishers\n 39.95\n \n \n \n The Economics of Technology and Content for Digital TV\n \n GerbargDarcy\n CITI\n \n Kluwer Academic Publishers\n 129.95\n \nData on the Web", false) ); } /** * arg: text node & node . */ @org.junit.Test public void fnUnionNodeArgs004() { final XQuery query = new XQuery( "/bib/book[3]/title/text() union /bib/book[1]/title", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("TCP/IP IllustratedData on the Web", false) ); } /** * arg: processing-instruction node & node . */ @org.junit.Test public void fnUnionNodeArgs005() { final XQuery query = new XQuery( "/processing-instruction() union /bib/book[2]/title", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Advanced Programming in the Unix environment", false) ); } /** * arg: processing-instruction node & node . */ @org.junit.Test public void fnUnionNodeArgs006() { final XQuery query = new XQuery( "/processing-instruction(PI1) union /bib/book[3]/title", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Data on the Web", false) ); } /** * arg: comment node & node . */ @org.junit.Test public void fnUnionNodeArgs007() { final XQuery query = new XQuery( "/comment() union /bib/book[1]/title", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("TCP/IP Illustrated", false) ); } /** * arg: text node & node . */ @org.junit.Test public void fnUnionNodeArgs008() { final XQuery query = new XQuery( "/bib/book[3]/title/text() | /bib/book[1]/title", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("TCP/IP IllustratedData on the Web", false) ); } /** * arg: processing-instruction node & node . */ @org.junit.Test public void fnUnionNodeArgs009() { final XQuery query = new XQuery( "/processing-instruction() | /bib/book[2]/title", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Advanced Programming in the Unix environment", false) ); } /** * arg: processing-instruction node & node . */ @org.junit.Test public void fnUnionNodeArgs010() { final XQuery query = new XQuery( "/processing-instruction(PI1) | /bib/book[3]/title", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Data on the Web", false) ); } /** * arg: comment node & node . */ @org.junit.Test public void fnUnionNodeArgs011() { final XQuery query = new XQuery( "/comment() | /bib/book[1]/title", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("TCP/IP Illustrated", false) ); } /** * arg: node & non existing node . */ @org.junit.Test public void fnUnionNodeArgs012() { final XQuery query = new XQuery( "//author union //nonexisting", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("StevensW.StevensW.AbiteboulSergeBunemanPeterSuciuDan", false) ); } /** * arg: node & empty sequence . */ @org.junit.Test public void fnUnionNodeArgs013() { final XQuery query = new XQuery( "//author | ()", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("StevensW.StevensW.AbiteboulSergeBunemanPeterSuciuDan", false) ); } /** * arg: empty sequence & empty sequence . */ @org.junit.Test public void fnUnionNodeArgs014() { final XQuery query = new XQuery( "() | ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "") || error("XPST0005") ) ); } /** * arg: node & node . */ @org.junit.Test public void fnUnionNodeArgs023() { final XQuery query = new XQuery( "string-join(for $node in ((//price/text()) , (//price/text())) union ((//price/text()) , (//price/text())) return $node, \"|\")", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, " 65.95|65.95| 39.95|129.95") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpYearMonthDurationGreaterThan.java000066400000000000000000000733121222453003200330300ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the yearMonthDuration-greater-than() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpYearMonthDurationGreaterThan extends QT3TestSet { /** * * ******************************************************* * Test: K-YearMonthDurationGT-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'gt' for xs:yearMonthDuration. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationGT1() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1999Y10M\") gt xs:yearMonthDuration(\"P1999Y9M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-YearMonthDurationGT-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'gt' for xs:yearMonthDuration, evaluating to false. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationGT2() { final XQuery query = new XQuery( "not(xs:yearMonthDuration(\"P1999Y10M\") gt xs:yearMonthDuration(\"P1999Y10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-YearMonthDurationGT-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'gt' for xs:yearMonthDuration, evaluating to false. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationGT3() { final XQuery query = new XQuery( "not(xs:yearMonthDuration(\"P1999Y10M\") gt xs:yearMonthDuration(\"P1999Y11M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-YearMonthDurationGT-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ge' for xs:yearMonthDuration. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationGT4() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1999Y11M\") ge xs:yearMonthDuration(\"P1999Y10M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-YearMonthDurationGT-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ge' for xs:yearMonthDuration. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationGT5() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1999Y10M\") ge xs:yearMonthDuration(\"P1999Y10M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-YearMonthDurationGT-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'ge' for xs:yearMonthDuration, evaluating to false. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationGT6() { final XQuery query = new XQuery( "not(xs:yearMonthDuration(\"P1999Y9M\") ge xs:yearMonthDuration(\"P1999Y10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of xs:yearMonthDuration . */ @org.junit.Test public void cbclYearMonthDurationGreaterThan001() { final XQuery query = new XQuery( "\n" + " declare function local:yearMonthDuration($years as xs:integer, $months as xs:integer ) { xs:yearMonthDuration(concat('P', $years, 'Y', $months, 'M')) };\n" + " not(local:yearMonthDuration(1, 1) gt xs:yearMonthDuration(\"P0Y\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:yearMonthDuration . */ @org.junit.Test public void cbclYearMonthDurationGreaterThan002() { final XQuery query = new XQuery( "\n" + " declare function local:yearMonthDuration($years as xs:integer, $months as xs:integer ) { xs:yearMonthDuration(concat('P', $years, 'Y', $months, 'M')) };\n" + " not(local:yearMonthDuration(1, 1) ge xs:yearMonthDuration(\"P0Y\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:yearMonthDuration . */ @org.junit.Test public void cbclYearMonthDurationGreaterThan003() { final XQuery query = new XQuery( "\n" + " declare function local:yearMonthDuration($yearMonthDuration as xs:yearMonthDuration, $null as xs:boolean) { if ($null) then () else $yearMonthDuration };\n" + " exists(local:yearMonthDuration(xs:yearMonthDuration(\"P0Y\"), fn:true()) gt xs:yearMonthDuration(\"P0Y\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:yearMonthDuration . */ @org.junit.Test public void cbclYearMonthDurationGreaterThan004() { final XQuery query = new XQuery( "\n" + " declare function local:yearMonthDuration($yearMonthDuration as xs:yearMonthDuration, $null as xs:boolean) { if ($null) then () else $yearMonthDuration };\n" + " local:yearMonthDuration(xs:yearMonthDuration(\"P0Y\"), fn:false()) gt xs:yearMonthDuration(\"P0Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:yearMonthDuration . */ @org.junit.Test public void cbclYearMonthDurationGreaterThan005() { final XQuery query = new XQuery( "\n" + " declare function local:yearMonthDuration($yearMonthDuration as xs:yearMonthDuration, $null as xs:boolean) { if ($null) then () else $yearMonthDuration };\n" + " exists(local:yearMonthDuration(xs:yearMonthDuration(\"P0Y\"), fn:true()) le xs:yearMonthDuration(\"P0Y\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:yearMonthDuration . */ @org.junit.Test public void cbclYearMonthDurationGreaterThan006() { final XQuery query = new XQuery( "\n" + " declare function local:yearMonthDuration($yearMonthDuration as xs:yearMonthDuration, $null as xs:boolean) { if ($null) then () else $yearMonthDuration };\n" + " local:yearMonthDuration(xs:yearMonthDuration(\"P0Y\"), fn:false()) le xs:yearMonthDuration(\"P0Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-greater-than-10 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "yearMonthDuration-greater-than" function used * together with "or" expression (ge operator). * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationGreaterThan10() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P10Y01M\") ge xs:yearMonthDuration(\"P09Y06M\")) or (xs:yearMonthDuration(\"P15Y01M\") ge xs:yearMonthDuration(\"P02Y04M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-greater-than-11 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "yearMonthDuration-greater-than" function used * together with "fn:true"/or expression (gt operator). * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationGreaterThan11() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P10Y02M\") gt xs:yearMonthDuration(\"P01Y10M\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-greater-than-12 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "yearMonthDuration-greater-than" function used * together with "fn:true"/or expression (ge operator). * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationGreaterThan12() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P10Y01M\") ge xs:yearMonthDuration(\"P09Y05M\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-greater-than-13 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "yearMonthDuration-greater-than" function used * together with "fn:false"/or expression (gt operator). * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationGreaterThan13() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P30Y10M\") gt xs:yearMonthDuration(\"P01Y02M\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-greater-than-14 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "yearMonthDuration-greater-than" function used * together with "fn:false"/or expression (ge operator). * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationGreaterThan14() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P10Y05M\") ge xs:yearMonthDuration(\"P20Y10M\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-greater-than-3 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "yearMonthDuration-greater-than" function that * return true and used together with fn:not (gt operator) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationGreaterThan3() { final XQuery query = new XQuery( "fn:not((xs:yearMonthDuration(\"P20Y123M\") gt xs:yearMonthDuration(\"P20Y11M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-greater-than-4 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "yearMonthDuration-greater-than" function that * return true and used together with fn:not (ge operator) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationGreaterThan4() { final XQuery query = new XQuery( "fn:not(xs:yearMonthDuration(\"P20Y10M\") ge xs:yearMonthDuration(\"P20Y10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-greater-than-5 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "yearMonthDuration-greater-than" function that * return false and used together with fn:not (gt operator) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationGreaterThan5() { final XQuery query = new XQuery( "fn:not(xs:yearMonthDuration(\"P20Y09M\") gt xs:yearMonthDuration(\"P20Y10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-greater-than-6 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "yearMonthDuration-greater-than" function that * return false and used together with fn:not(ge operator) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationGreaterThan6() { final XQuery query = new XQuery( "fn:not(xs:yearMonthDuration(\"P10Y07M\") ge xs:yearMonthDuration(\"P10Y09M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-greater-than-7 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "yearMonthDuration-greater-than" function used * together with "and" expression (gt operator). * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationGreaterThan7() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P10Y09M\") gt xs:yearMonthDuration(\"P09Y10M\")) and (xs:yearMonthDuration(\"P10Y01M\") gt xs:yearMonthDuration(\"P08Y06M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-greater-than-8 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "yearMonthDuration-greater-than" function used * together with "and" expression (ge operator). * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationGreaterThan8() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P10Y09M\") ge xs:yearMonthDuration(\"P10Y01M\")) and (xs:yearMonthDuration(\"P02Y04M\") ge xs:yearMonthDuration(\"P09Y07M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-greater-than-9 * Written By: Carmelo Montanez * Date: June 15, 2005 * Purpose: Evaluates The "yearMonthDuration-greater-than" function used * together with "or" expression (gt operator). * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationGreaterThan9() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P10Y08M\") gt xs:yearMonthDuration(\"P10Y07M\")) or (xs:yearMonthDuration(\"P10Y09M\") gt xs:yearMonthDuration(\"P10Y09M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-greater-than2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:yearMonthDuration-greater-than" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(lower bound) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationGreaterThan2args1() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") gt xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-greater-than2args-10 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:yearMonthDuration-greater-than" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(lower bound) * $arg2 = xs:yearMonthDuration(upper bound) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationGreaterThan2args10() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") le xs:yearMonthDuration(\"P2030Y12M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-greater-than2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:yearMonthDuration-greater-than" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(mid range) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationGreaterThan2args2() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1000Y6M\") gt xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-greater-than2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:yearMonthDuration-greater-than" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(upper bound) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationGreaterThan2args3() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P2030Y12M\") gt xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-greater-than2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:yearMonthDuration-greater-than" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(lower bound) * $arg2 = xs:yearMonthDuration(mid range) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationGreaterThan2args4() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") gt xs:yearMonthDuration(\"P1000Y6M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-greater-than2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:yearMonthDuration-greater-than" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(lower bound) * $arg2 = xs:yearMonthDuration(upper bound) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationGreaterThan2args5() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") gt xs:yearMonthDuration(\"P2030Y12M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-greater-than2args-6 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:yearMonthDuration-greater-than" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(lower bound) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationGreaterThan2args6() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") le xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-greater-than2args-7 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:yearMonthDuration-greater-than" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(mid range) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationGreaterThan2args7() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1000Y6M\") le xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-greater-than2args-8 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:yearMonthDuration-greater-than" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(upper bound) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationGreaterThan2args8() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P2030Y12M\") le xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-greater-than2args-9 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:yearMonthDuration-greater-than" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(lower bound) * $arg2 = xs:yearMonthDuration(mid range) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationGreaterThan2args9() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") le xs:yearMonthDuration(\"P1000Y6M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/op/OpYearMonthDurationLessThan.java000066400000000000000000000730671222453003200323540ustar00rootroot00000000000000package org.basex.test.qt3ts.op; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the yearMonthDuration-less-than() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class OpYearMonthDurationLessThan extends QT3TestSet { /** * * ******************************************************* * Test: K-YearMonthDurationLT-1 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'lt' for xs:yearMonthDuration. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationLT1() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1999Y9M\") lt xs:yearMonthDuration(\"P1999Y10M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-YearMonthDurationLT-2 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'lt' for xs:yearMonthDuration, evaluating to false. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationLT2() { final XQuery query = new XQuery( "not(xs:yearMonthDuration(\"P1999Y10M\") lt xs:yearMonthDuration(\"P1999Y10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-YearMonthDurationLT-3 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'lt' for xs:yearMonthDuration, evaluating to false. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationLT3() { final XQuery query = new XQuery( "not(xs:yearMonthDuration(\"P1999Y10M\") lt xs:yearMonthDuration(\"P1999Y9M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-YearMonthDurationLT-4 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'le' for xs:yearMonthDuration. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationLT4() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1999Y10M\") le xs:yearMonthDuration(\"P1999Y10M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-YearMonthDurationLT-5 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'le' for xs:yearMonthDuration. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationLT5() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1999Y9M\") le xs:yearMonthDuration(\"P1999Y10M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: K-YearMonthDurationLT-6 * Written by: Frans Englich * Date: 2007-11-22T11:31:21+01:00 * Purpose: Simple test of 'le' for xs:yearMonthDuration, evaluating to false. * ******************************************************* * . */ @org.junit.Test public void kYearMonthDurationLT6() { final XQuery query = new XQuery( "not(xs:yearMonthDuration(\"P1999Y10M\") le xs:yearMonthDuration(\"P1999Y9M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of xs:yearMonthDuration . */ @org.junit.Test public void cbclYearMonthDurationLessThan001() { final XQuery query = new XQuery( "\n" + " declare function local:yearMonthDuration($years as xs:integer, $months as xs:integer ) { xs:yearMonthDuration(concat('P', $years, 'Y', $months, 'M')) };\n" + " not(local:yearMonthDuration(1, 1) lt xs:yearMonthDuration(\"P0Y\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of xs:yearMonthDuration . */ @org.junit.Test public void cbclYearMonthDurationLessThan002() { final XQuery query = new XQuery( "\n" + " declare function local:yearMonthDuration($years as xs:integer, $months as xs:integer ) { xs:yearMonthDuration(concat('P', $years, 'Y', $months, 'M')) };\n" + " not(local:yearMonthDuration(1, 1) le xs:yearMonthDuration(\"P0Y\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test comparison of xs:yearMonthDuration . */ @org.junit.Test public void cbclYearMonthDurationLessThan003() { final XQuery query = new XQuery( "\n" + " declare function local:yearMonthDuration($yearMonthDuration as xs:yearMonthDuration, $null as xs:boolean) { if ($null) then () else $yearMonthDuration };\n" + " exists(local:yearMonthDuration(xs:yearMonthDuration(\"P0Y\"), fn:true()) lt xs:yearMonthDuration(\"P0Y\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:yearMonthDuration . */ @org.junit.Test public void cbclYearMonthDurationLessThan004() { final XQuery query = new XQuery( "\n" + " declare function local:yearMonthDuration($yearMonthDuration as xs:yearMonthDuration, $null as xs:boolean) { if ($null) then () else $yearMonthDuration };\n" + " local:yearMonthDuration(xs:yearMonthDuration(\"P0Y\"), fn:false()) lt xs:yearMonthDuration(\"P0Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:yearMonthDuration . */ @org.junit.Test public void cbclYearMonthDurationLessThan005() { final XQuery query = new XQuery( "\n" + " declare function local:yearMonthDuration($yearMonthDuration as xs:yearMonthDuration, $null as xs:boolean) { if ($null) then () else $yearMonthDuration };\n" + " exists(local:yearMonthDuration(xs:yearMonthDuration(\"P0Y\"), fn:true()) ge xs:yearMonthDuration(\"P0Y\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test comparison of xs:yearMonthDuration . */ @org.junit.Test public void cbclYearMonthDurationLessThan006() { final XQuery query = new XQuery( "\n" + " declare function local:yearMonthDuration($yearMonthDuration as xs:yearMonthDuration, $null as xs:boolean) { if ($null) then () else $yearMonthDuration };\n" + " local:yearMonthDuration(xs:yearMonthDuration(\"P0Y\"), fn:false()) ge xs:yearMonthDuration(\"P0Y\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-less-than-10 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "yearMonthDuration-less-than" function used * together with "or" expression (le operator). * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationLessThan10() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P10Y01M\") le xs:yearMonthDuration(\"P09Y06M\")) or (xs:yearMonthDuration(\"P15Y01M\") le xs:yearMonthDuration(\"P02Y04M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-less-than-11 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "yearMonthDuration-less-than" function used * together with "fn:true"/or expression (lt operator). * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationLessThan11() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P10Y02M\") lt xs:yearMonthDuration(\"P01Y10M\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-less-than-12 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "yearMonthDuration-less-than" function used * together with "fn:true"/or expression (le operator). * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationLessThan12() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P10Y01M\") le xs:yearMonthDuration(\"P09Y05M\")) or (fn:true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-less-than-13 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "yearMonthDuration-less-than" function used * together with "fn:false"/or expression (lt operator). * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationLessThan13() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P30Y10M\") lt xs:yearMonthDuration(\"P01Y02M\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-less-than-14 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "yearMonthDuration-less-than" function used * together with "fn:false"/or expression (le operator). * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationLessThan14() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P10Y05M\") le xs:yearMonthDuration(\"P20Y10M\")) or (fn:false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-less-than-3 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "yearMonthDuration-less-than" function that * return true and used together with fn:not (lt operator) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationLessThan3() { final XQuery query = new XQuery( "fn:not((xs:yearMonthDuration(\"P20Y10M\") lt xs:yearMonthDuration(\"P20Y11M\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-less-than-4 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "yearMonthDuration-less-than" function that * return true and used together with fn:not (le operator) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationLessThan4() { final XQuery query = new XQuery( "fn:not(xs:yearMonthDuration(\"P20Y10M\") le xs:yearMonthDuration(\"P20Y10M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-less-than-5 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "yearMonthDuration-less-than" function that * return false and used together with fn:not (lt operator) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationLessThan5() { final XQuery query = new XQuery( "fn:not(xs:yearMonthDuration(\"P20Y10M\") lt xs:yearMonthDuration(\"P20Y09M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-less-than-6 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "yearMonthDuration-less-than" function that * return false and used together with fn:not(le operator) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationLessThan6() { final XQuery query = new XQuery( "fn:not(xs:yearMonthDuration(\"P10Y09M\") le xs:yearMonthDuration(\"P10Y07M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-less-than-8 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "yearMonthDuration-less-than" function used * together with "and" expression (le operator). * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationLessThan8() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P10Y09M\") le xs:yearMonthDuration(\"P10Y01M\")) and (xs:yearMonthDuration(\"P02Y04M\") le xs:yearMonthDuration(\"P09Y07M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-less-than-9 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "yearMonthDuration-less-than" function used * together with "or" expression (lt operator). * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationLessThan9() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P10Y08M\") lt xs:yearMonthDuration(\"P10Y07M\")) or (xs:yearMonthDuration(\"P10Y09M\") lt xs:yearMonthDuration(\"P10Y09M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-less-than2args-1 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:yearMonthDuration-less-than" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(lower bound) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationLessThan2args1() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") lt xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-less-than2args-10 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:yearMonthDuration-less-than" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(lower bound) * $arg2 = xs:yearMonthDuration(upper bound) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationLessThan2args10() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") ge xs:yearMonthDuration(\"P2030Y12M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-less-than2args-2 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:yearMonthDuration-less-than" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(mid range) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationLessThan2args2() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1000Y6M\") lt xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-less-than2args-3 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:yearMonthDuration-less-than" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(upper bound) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationLessThan2args3() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P2030Y12M\") lt xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-less-than2args-4 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:yearMonthDuration-less-than" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(lower bound) * $arg2 = xs:yearMonthDuration(mid range) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationLessThan2args4() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") lt xs:yearMonthDuration(\"P1000Y6M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-less-than2args-5 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:yearMonthDuration-less-than" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(lower bound) * $arg2 = xs:yearMonthDuration(upper bound) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationLessThan2args5() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") lt xs:yearMonthDuration(\"P2030Y12M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-less-than2args-6 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:yearMonthDuration-less-than" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(lower bound) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationLessThan2args6() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") ge xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-less-than2args-8 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:yearMonthDuration-less-than" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(upper bound) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationLessThan2args8() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P2030Y12M\") ge xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-less-than2args-9 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:yearMonthDuration-less-than" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(lower bound) * $arg2 = xs:yearMonthDuration(mid range) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationLessThan2args9() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P0Y0M\") ge xs:yearMonthDuration(\"P1000Y6M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-less-than2args-7 * Written By: Carmelo Montanez * Date: Tue Apr 12 16:29:06 GMT-05:00 2005 * Purpose: Evaluates The "op:yearMonthDuration-less-than" operator * with the arguments set as follows: * $arg1 = xs:yearMonthDuration(mid range) * $arg2 = xs:yearMonthDuration(lower bound) * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationLessThan2argsNew7() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1000Y6M\") ge xs:yearMonthDuration(\"P0Y0M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * ******************************************************* * Test: op-yearMonthDuration-less-than-7 * Written By: Carmelo Montanez * Date: June 13, 2005 * Purpose: Evaluates The "yearMonthDuration-less-than" function used * together with "and" expression (lt operator). * ******************************************************* * . */ @org.junit.Test public void opYearMonthDurationLessThanNew7() { final XQuery query = new XQuery( "(xs:yearMonthDuration(\"P10Y09M\") lt xs:yearMonthDuration(\"P09Y10M\")) and (xs:yearMonthDuration(\"P10Y01M\") lt xs:yearMonthDuration(\"P08Y06M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/000077500000000000000000000000001222453003200244455ustar00rootroot00000000000000basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdAllowingEmpty.java000066400000000000000000000363161222453003200307410ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the "outer for" clause - "for $x allowing empty". * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdAllowingEmpty extends QT3TestSet { /** * outer for clause . */ @org.junit.Test public void outer001() { final XQuery query = new XQuery( "\n" + " declare variable $n as xs:integer external := 10; \n" + " { for $x allowing empty in 1 to $n return {$x} }
    \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("12345678910", false) ); } /** * outer for clause . */ @org.junit.Test public void outer002() { final XQuery query = new XQuery( "\n" + " declare variable $n as xs:integer external := 0; \n" + " { for $x allowing empty in 1 to $n return {$x} }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * outer for clause with position variable . */ @org.junit.Test public void outer003() { final XQuery query = new XQuery( "\n" + " declare variable $n as xs:integer external := 10; \n" + " { for $x allowing empty at $p in 1 to $n return {$x} }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("12345678910", false) ); } /** * outer for clause with position variable . */ @org.junit.Test public void outer004() { final XQuery query = new XQuery( "\n" + " declare variable $n as xs:integer external := 0; \n" + " { for $x allowing empty at $p in 1 to $n return {$x} }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * outer for clause, pull mode . */ @org.junit.Test public void outer005() { final XQuery query = new XQuery( "\n" + " declare variable $n as xs:integer external := 10;\n" + " { string-join(for $x allowing empty in 1 to $n return concat('[',$x,']'), '|') }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("[1]|[2]|[3]|[4]|[5]|[6]|[7]|[8]|[9]|[10]", false) ); } /** * outer for clause, pull mode . */ @org.junit.Test public void outer006() { final XQuery query = new XQuery( "\n" + " declare variable $n as xs:integer external := 0; \n" + " { string-join(for $x allowing empty in 1 to $n return concat('[',$x,']'), '|') }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("[]", false) ); } /** * outer for clause, nested . */ @org.junit.Test public void outer007() { final XQuery query = new XQuery( "\n" + " declare variable $m as xs:integer external := 5; \n" + " declare variable $n as xs:integer external := 5;\n" + " { for $x allowing empty at $p in 1 to $m, $y at $q in 1 to $n return {$x},{$y} }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1,11,21,31,41,52,12,22,32,42,53,13,23,33,43,54,14,24,34,44,55,15,25,35,45,5", false) ); } /** * outer for clause, nested . */ @org.junit.Test public void outer008() { final XQuery query = new XQuery( "\n" + " declare variable $m as xs:integer external := 5; \n" + " declare variable $n as xs:integer external := 0; \n" + " { for $x allowing empty at $p in 1 to $m, $y allowing empty at $q in 1 to $n return {$x},{$y} }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1,2,3,4,5,", false) ); } /** * outer for clause, nested . */ @org.junit.Test public void outer009() { final XQuery query = new XQuery( "\n" + " declare variable $m as xs:integer external := 0; \n" + " declare variable $n as xs:integer external := 5; \n" + " { for $x allowing empty at $p in 1 to $m, $y at $q in 1 to $n return {$x},{$y} }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(",1,2,3,4,5", false) ); } /** * outer for clause, nested . */ @org.junit.Test public void outer010() { final XQuery query = new XQuery( "\n" + " declare variable $m as xs:integer external := 0; \n" + " declare variable $n as xs:integer external := 0; \n" + " { for $x allowing empty at $p in 1 to $m, \n" + " $y allowing empty at $q in 1 to $n return {$x},{$y} }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(",", false) ); } /** * outer for clause, nested, one loop depends on the other . */ @org.junit.Test public void outer011() { final XQuery query = new XQuery( "\n" + " declare variable $n as xs:integer external := 5; \n" + " { for $x allowing empty at $p in 1 to $n, $y allowing empty at $q in ($x+1) to $n return {$x},{$y} }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1,21,31,41,52,32,42,53,43,54,55,", false) ); } /** * outer for clause, nested, one loop depends on the other . */ @org.junit.Test public void outer012() { final XQuery query = new XQuery( "\n" + " declare variable $n as xs:integer external := 5; \n" + " { \n" + " for $x as xs:integer allowing empty at $p in 1 to $n, \n" + " $y as xs:integer? allowing empty at $q in ($x+1) to $n \n" + " return {$x},{$y} }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1,21,31,41,52,32,42,53,43,54,55,", false) ); } /** * outer for clause, nested, one loop depends on the other. * Type error because $y does not allow an empty sequence . */ @org.junit.Test public void outer013() { final XQuery query = new XQuery( "\n" + " declare variable $n as xs:integer external := 5; \n" + " { for $x as xs:integer allowing empty at $p in 1 to $n, \n" + " $y as xs:integer allowing empty at $q in ($x+1) to $n \n" + " return {$x},{$y} }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * outer for clause, nested, mixed with "non-outer" for . */ @org.junit.Test public void outer014() { final XQuery query = new XQuery( "\n" + " declare variable $n as xs:integer external := 5; \n" + " { for $x as xs:integer at $p in 1 to $n \n" + " for $y as xs:integer? allowing empty at $q in ($x+1) to $n \n" + " return {$x},{$y} }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1,21,31,41,52,32,42,53,43,54,55,", false) ); } /** * outer for clause, nested, mixed with "non-outer" for . */ @org.junit.Test public void outer015() { final XQuery query = new XQuery( "\n" + " declare variable $n as xs:integer external := 5; \n" + " { for $x as xs:integer? allowing empty at $p in 1 to $n \n" + " for $y as xs:integer at $q in (if (empty($x)) then 0 else (1 to $x)) \n" + " return {$x},{$y} }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1,12,12,23,13,23,34,14,24,34,45,15,25,35,45,5", false) ); } /** * outer for clause, nested, mixed with "non-outer" for . */ @org.junit.Test public void outer016() { final XQuery query = new XQuery( "\n" + " declare variable $n as xs:integer external := 0; \n" + " { for $x as xs:integer? allowing empty at $p in 1 to $n \n" + " for $y as xs:integer at $q in (if (empty($x)) then 0 else (1 to $x)) \n" + " return {$x},{$y} }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(",0", false) ); } /** * outer for clause, nested, with where clause . */ @org.junit.Test public void outer017() { final XQuery query = new XQuery( "\n" + " declare variable $n as xs:integer external := 5; \n" + " { for $x as xs:integer? allowing empty at $p in 1 to $n \n" + " for $y as xs:integer? allowing empty at $q in (if (empty($x)) then () else (1 to $x)) \n" + " where deep-equal($x,$y) \n" + " return {$x},{$y} }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1,12,23,34,45,5", false) ); } /** * outer for clause, nested, with where clause . */ @org.junit.Test public void outer018() { final XQuery query = new XQuery( "\n" + " declare variable $n as xs:integer external := 0; \n" + " { for $x as xs:integer? allowing empty at $p in 1 to $n \n" + " for $y as xs:integer? allowing empty at $q in (if (empty($x)) then () else (1 to $x)) \n" + " where deep-equal($x,$y) return {$x},{$y} }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(",", false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdAnnotation.java000066400000000000000000000746401222453003200302620ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for function and variable annotations. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdAnnotation extends QT3TestSet { /** * A function annotation. */ @org.junit.Test public void annotation1() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.com\";\n" + " declare %eg:sequential function local:foo() {\n" + " \"bar\"\n" + " };\n" + " local:foo()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("bar", false) ); } /** * Annotations with expanded QNames. */ @org.junit.Test public void annotation10() { final XQuery query = new XQuery( "\n" + " declare %Q{http://example.com}bar variable $foo := 0;\n" + "\n" + " declare %Q{http://example.com}bar function local:foo($arg) { $arg }; \n" + "\n" + " local:foo($foo)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("0", false) ); } /** * Multiple annotations. */ @org.junit.Test public void annotation11() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.com\";\n" + "\n" + " declare %eg:one %eg:two %eg:three variable $foo := 0;\n" + "\n" + " declare %eg:one %eg:two %eg:three function local:foo($arg) { $arg }; \n" + "\n" + " local:foo($foo)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("0", false) ); } /** * Multiple annotations without whitespace ("%" is a delimiting terminal symbol). */ @org.junit.Test public void annotation12() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.com\";\n" + "\n" + " declare %eg:one%eg:two%eg:three(1)%eg:four variable $foo := 0;\n" + "\n" + " declare %eg:one%eg:two%eg:three(1)%eg:four function local:foo($arg) { $arg }; \n" + "\n" + " local:foo($foo)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("0", false) ); } /** * Multiple annotations with extra whitespace . */ @org.junit.Test public void annotation13() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.com\";\n" + "\n" + " declare \n" + " %eg:one\n" + " %eg:two\n" + " (: Lorem ipsum dolor sit amet. :)\n" + " %eg:three(1)\n" + " %Q{http://example.com}four\n" + " variable $foo := 0;\n" + "\n" + " declare \n" + " %eg:one\n" + " %eg:two\n" + " (: Lorem ipsum dolor sit amet. :)\n" + " %eg:three(1)\n" + " %Q{http://example.com}four\n" + " function local:foo($arg) { $arg }; \n" + "\n" + " local:foo($foo)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("0", false) ); } /** * Multiple annotations, multiple parameters. */ @org.junit.Test public void annotation14() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.com\";\n" + "\n" + " declare %eg:one(1, 2, 3) %eg:two(\"a\", \"b\") %eg:three(1.234) variable $foo := 0;\n" + "\n" + " declare %eg:one(1, 2, 3) %eg:two(\"a\", \"b\") %eg:three(1.234) function local:foo($arg) { $arg }; \n" + "\n" + " local:foo($foo)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("0", false) ); } /** * Annotation in a reserved namespace. */ @org.junit.Test public void annotation15() { final XQuery query = new XQuery( "\n" + " declare %xml:x function local:foo() {\n" + " \"bar\"\n" + " };\n" + " local:foo()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * Annotation in a reserved namespace. */ @org.junit.Test public void annotation16() { final XQuery query = new XQuery( "\n" + " declare %Q{http://www.w3.org/XML/1998/namespace}x variable $foo := \"bar\";\n" + " $foo\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * Annotation in a reserved namespace. */ @org.junit.Test public void annotation17() { final XQuery query = new XQuery( "\n" + " declare %xs:x function local:foo() {\n" + " \"bar\"\n" + " };\n" + " local:foo()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * Annotation in a reserved namespace. */ @org.junit.Test public void annotation18() { final XQuery query = new XQuery( "\n" + " declare %Q{http://www.w3.org/2001/XMLSchema}x variable $foo := \"bar\";\n" + " $foo\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * Annotation in a reserved namespace. */ @org.junit.Test public void annotation19() { final XQuery query = new XQuery( "\n" + " declare %xsi:x function local:foo() {\n" + " \"bar\"\n" + " };\n" + " local:foo()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * A variable annotation. */ @org.junit.Test public void annotation2() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.com\";\n" + " declare %eg:sequential variable $foo := \"bar\";\n" + " $foo\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("bar", false) ); } /** * Annotation in a reserved namespace. */ @org.junit.Test public void annotation20() { final XQuery query = new XQuery( "\n" + " declare %Q{http://www.w3.org/2001/XMLSchema-instance}x variable $foo := \"bar\";\n" + " $foo\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * Annotation in a reserved namespace. */ @org.junit.Test public void annotation21() { final XQuery query = new XQuery( "\n" + " declare %fn:x function local:foo() {\n" + " \"bar\"\n" + " };\n" + " local:foo()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * Annotation in a reserved namespace. */ @org.junit.Test public void annotation22() { final XQuery query = new XQuery( "\n" + " declare %Q{http://www.w3.org/2005/xpath-functions}x variable $foo := \"bar\";\n" + " $foo\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * Annotation in no namespace. */ @org.junit.Test public void annotation23() { final XQuery query = new XQuery( "\n" + " declare %x variable $foo := \"bar\";\n" + " $foo\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * Annotation in a reserved namespace. */ @org.junit.Test public void annotation24() { final XQuery query = new XQuery( "\n" + " declare namespace math = \"http://www.w3.org/2005/xpath-functions/math\";\n" + " declare %math:x function local:foo() {\n" + " \"bar\"\n" + " };\n" + " local:foo()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * Annotation in a reserved namespace. */ @org.junit.Test public void annotation25() { final XQuery query = new XQuery( "\n" + " declare %Q{http://www.w3.org/2005/xpath-functions/math}x variable $foo := \"bar\";\n" + " $foo\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * Annotation in a reserved namespace. */ @org.junit.Test public void annotation26() { final XQuery query = new XQuery( "\n" + " declare namespace opts = \"http://www.w3.org/2012/xquery\";\n" + " declare %opts:x function local:foo() {\n" + " \"bar\"\n" + " };\n" + " local:foo()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * Annotation in a reserved namespace. */ @org.junit.Test public void annotation27() { final XQuery query = new XQuery( "\n" + " declare %Q{http://www.w3.org/2012/xquery}x variable $foo := \"bar\";\n" + " $foo\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * A function annotation (default function namespace does not affect annotations). */ @org.junit.Test public void annotation28() { final XQuery query = new XQuery( "\n" + " declare default function namespace \"http://example.com\";\n" + " declare %x variable $foo := \"bar\";\n" + " $foo\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * A variable annotation (per bug 16199). */ @org.junit.Test public void annotation29() { final XQuery query = new XQuery( "\n" + " declare %local:x variable $foo := \"bar\";\n" + " $foo\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"bar\"") ); } /** * An inline function annotation. */ @org.junit.Test public void annotation3() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.com\";\n" + " %eg:sequential function () { \"bar\" } ()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("bar", false) ); } /** * An inline function annotation with parameters. */ @org.junit.Test public void annotation30() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.com\";\n" + " %eg:sequential(\"abc\", 3) function () { \"bar\" } ()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("bar", false) ); } /** * An inline function annotation using an EQName. */ @org.junit.Test public void annotation31() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.com\";\n" + " % Q{http://example.com}sequential(\"abc\", 3) function () { \"bar\" } ()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("bar", false) ); } /** * An inline function with multiple annotations . */ @org.junit.Test public void annotation32() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.com\";\n" + " %eg:sequential(\"abc\", 3) %eg:memo-function function () { \"bar\" } ()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("bar", false) ); } /** * An inline function using true() as an annotation parameter . */ @org.junit.Test public void annotation33() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.com\";\n" + " %eg:sequential(true()) function () { \"bar\" } ()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * String literal annotation parameter. */ @org.junit.Test public void annotation4() { final XQuery query = new XQuery( "\n" + " declare namespace java = \"http://example.com\";\n" + "\n" + " declare %java:variable(\"java.lang.Integer.MAX_VALUE\") variable $max := 0;\n" + "\n" + " declare %java:method(\"java.lang.Math.sin\") function local:sin($arg) { 0 }; \n" + "\n" + " local:sin($max)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("0", false) ); } /** * Integer literal annotation parameter. */ @org.junit.Test public void annotation5() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.com\";\n" + "\n" + " declare %eg:integer(1234) variable $foo := 0;\n" + "\n" + " declare %eg:integer(1234) function local:foo($arg) { $arg }; \n" + "\n" + " local:foo($foo)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("0", false) ); } /** * Decimal literal annotation parameter. */ @org.junit.Test public void annotation6() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.com\";\n" + "\n" + " declare %eg:integer(12.34) variable $foo := 0;\n" + "\n" + " declare %eg:integer(12.34) function local:foo($arg) { $arg }; \n" + "\n" + " local:foo($foo)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("0", false) ); } /** * Double literal annotation parameter. */ @org.junit.Test public void annotation7() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.com\";\n" + "\n" + " declare %eg:integer(12e34) variable $foo := 0;\n" + "\n" + " declare %eg:integer(12e34) function local:foo($arg) { $arg }; \n" + "\n" + " local:foo($foo)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("0", false) ); } /** * Non-literal annotation parameter. */ @org.junit.Test public void annotation8() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.com\";\n" + "\n" + " declare %eg:integer(1+2) function local:foo() { 0 }; \n" + "\n" + " local:foo()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Multiple annotation parameters. */ @org.junit.Test public void annotation9() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.com\";\n" + "\n" + " declare %eg:many(12e34,\"abc\",1234) variable $foo := 0;\n" + "\n" + " declare %eg:many(\"xyz\", 987, 12.3) function local:foo($arg) { $arg }; \n" + "\n" + " local:foo($foo)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("0", false) ); } /** * * Tests that a function test with an annotation assertion * parses. The behavior of annotation assertions is * implementation defined. Annotation assertions can only * further restrict the set of functions matched by a function * test. * . */ @org.junit.Test public void annotationAssertion1() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.com\";\n" + " () instance of %eg:x function(*)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * An annotation assertion on a typed function test. * Tests the parsing of annotation assertions. * . */ @org.junit.Test public void annotationAssertion10() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.com\";\n" + " () instance of %eg:x function(xs:integer) as xs:string\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * An annotation assertion in a reserved namespace.. */ @org.junit.Test public void annotationAssertion11() { final XQuery query = new XQuery( "\n" + " () instance of %xml:x function(*) \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * An annotation assertion in a reserved namespace.. */ @org.junit.Test public void annotationAssertion12() { final XQuery query = new XQuery( "\n" + " () instance of %Q{http://www.w3.org/XML/1998/namespace}x function(*) \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * An annotation assertion in a reserved namespace.. */ @org.junit.Test public void annotationAssertion13() { final XQuery query = new XQuery( "\n" + " () instance of %xs:x function(*) \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * An annotation assertion in a reserved namespace.. */ @org.junit.Test public void annotationAssertion14() { final XQuery query = new XQuery( "\n" + " () instance of %Q{http://www.w3.org/2001/XMLSchema}x function(*) \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * An annotation assertion in a reserved namespace.. */ @org.junit.Test public void annotationAssertion15() { final XQuery query = new XQuery( "\n" + " () instance of %xsi:x function(*) \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * An annotation assertion in a reserved namespace.. */ @org.junit.Test public void annotationAssertion16() { final XQuery query = new XQuery( "\n" + " () instance of %fn:x function(*) \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * An annotation assertion in a reserved namespace.. */ @org.junit.Test public void annotationAssertion17() { final XQuery query = new XQuery( "\n" + " declare namespace math = \"http://www.w3.org/2005/xpath-functions/math\";\n" + " () instance of %math:x function(*) \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * An annotation assertion in a reserved namespace.. */ @org.junit.Test public void annotationAssertion18() { final XQuery query = new XQuery( "\n" + " declare namespace opts = \"http://www.w3.org/2012/xquery\";\n" + " () instance of %opts:x function(*) \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * * An annotation assertion with a string literal parameter. * Tests the parsing of annotation assertions. * . */ @org.junit.Test public void annotationAssertion2() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.com\";\n" + " () instance of %eg:x(\"foo\") function(*)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * An annotation assertion with an integer literal parameter. * Tests the parsing of annotation assertions. * . */ @org.junit.Test public void annotationAssertion3() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.com\";\n" + " () instance of %eg:x(1234) function(*)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * An annotation assertion with a decimal literal parameter. * Tests the parsing of annotation assertions. * . */ @org.junit.Test public void annotationAssertion4() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.com\";\n" + " () instance of %eg:x(12.34) function(*)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * An annotation assertion with a double literal parameter * Tests the parsing of annotation assertions. * . */ @org.junit.Test public void annotationAssertion5() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.com\";\n" + " () instance of %eg:x(12e34) function(*)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * An annotation assertion with multiple parameters * Tests the parsing of annotation assertions. * . */ @org.junit.Test public void annotationAssertion6() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.com\";\n" + " () instance of %eg:x(\"abc\", 12e34, 567) function(*)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * An annotation assertion with an expanded QName * Tests the parsing of annotation assertions. * . */ @org.junit.Test public void annotationAssertion7() { final XQuery query = new XQuery( "\n" + " () instance of %Q{http://example.com}x function(*)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * An annotation assertion with an expanded QName. * Tests the parsing of annotation assertions. * . */ @org.junit.Test public void annotationAssertion8() { final XQuery query = new XQuery( "\n" + " () instance of %Q{http://example.com}x function(*)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * * Multiple annotation assertions. * Tests the parsing of annotation assertions. * . */ @org.junit.Test public void annotationAssertion9() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.com\";\n" + " () instance of %eg:x %eg:y%eg:z %eg:w(1) function(*)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdAxisStep.java000066400000000000000000006675241222453003200277210ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the expr-AxisStep() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdAxisStep extends QT3TestSet { /** * Path 'child::*' from an element.. */ @org.junit.Test public void axes0011() { final XQuery query = new XQuery( "fn:count(//center/child::*)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path 'child::*' from an element.. */ @org.junit.Test public void axes0012() { final XQuery query = new XQuery( "fn:count(//center/child::*)", ctx); try { query.context(node(file("prod/AxisStep/Tree1Child.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path 'child::*' from an element.. */ @org.junit.Test public void axes0013() { final XQuery query = new XQuery( "fn:count(//center/child::*)", ctx); try { query.context(node(file("prod/AxisStep/TreeRepeat.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("6") ); } /** * Path 'child::' with element name from an element.. */ @org.junit.Test public void axes0021() { final XQuery query = new XQuery( "fn:count(//center/child::south-east)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path 'child::' with element name from an element.. */ @org.junit.Test public void axes0022() { final XQuery query = new XQuery( "fn:count(//center/child::south-east)", ctx); try { query.context(node(file("prod/AxisStep/Tree1Child.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path 'child::' with element name from an element.. */ @org.junit.Test public void axes0023() { final XQuery query = new XQuery( "fn:count(//center/child::south-east)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path 'child::' with element name from an element.. */ @org.junit.Test public void axes0024() { final XQuery query = new XQuery( "fn:count(//center/child::south-east)", ctx); try { query.context(node(file("prod/AxisStep/TreeRepeat.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Path 'child::node()' from an element.. */ @org.junit.Test public void axes0031() { final XQuery query = new XQuery( "fn:count(//center/child::node())", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path 'child::node()' from an element.. */ @org.junit.Test public void axes0032() { final XQuery query = new XQuery( "fn:count(//center/child::node())", ctx); try { query.context(node(file("prod/AxisStep/Tree1Text.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path 'child::node()' from an element.. */ @org.junit.Test public void axes0033() { final XQuery query = new XQuery( "fn:count(//center/child::node())", ctx); try { query.context(node(file("prod/AxisStep/Tree1Child.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path 'child::node()' from an element.. */ @org.junit.Test public void axes0034() { final XQuery query = new XQuery( "fn:count(//center/child::node())", ctx); try { query.context(node(file("prod/AxisStep/TreeRepeat.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("19") ); } /** * Test implied child axis in '*' from an element.. */ @org.junit.Test public void axes0041() { final XQuery query = new XQuery( "fn:count(//center/*)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Test implied child axis in '*' from an element.. */ @org.junit.Test public void axes0042() { final XQuery query = new XQuery( "fn:count(//center/*)", ctx); try { query.context(node(file("prod/AxisStep/Tree1Child.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test implied child axis in '*' from an element.. */ @org.junit.Test public void axes0043() { final XQuery query = new XQuery( "fn:count(//center/*)", ctx); try { query.context(node(file("prod/AxisStep/TreeRepeat.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("6") ); } /** * Test implied child axis with element name, from an element.. */ @org.junit.Test public void axes0051() { final XQuery query = new XQuery( "fn:count(//center/south-east)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Test implied child axis with element name, from an element.. */ @org.junit.Test public void axes0052() { final XQuery query = new XQuery( "fn:count(//center/south-east)", ctx); try { query.context(node(file("prod/AxisStep/Tree1Child.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Test implied child axis with element name, from an element.. */ @org.junit.Test public void axes0053() { final XQuery query = new XQuery( "fn:count(//center/south-east)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test implied child axis with element name, from an element.. */ @org.junit.Test public void axes0054() { final XQuery query = new XQuery( "fn:count(//center/south-east)", ctx); try { query.context(node(file("prod/AxisStep/TreeRepeat.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Test implied child axis in 'node()' from an element.. */ @org.junit.Test public void axes0061() { final XQuery query = new XQuery( "fn:count(//center/node())", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Test implied child axis in 'node()' from an element.. */ @org.junit.Test public void axes0062() { final XQuery query = new XQuery( "fn:count(//center/node())", ctx); try { query.context(node(file("prod/AxisStep/Tree1Text.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test implied child axis in 'node()' from an element.. */ @org.junit.Test public void axes0063() { final XQuery query = new XQuery( "fn:count(//center/node())", ctx); try { query.context(node(file("prod/AxisStep/Tree1Child.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test implied child axis in 'node()' from an element.. */ @org.junit.Test public void axes0064() { final XQuery query = new XQuery( "fn:count(//center/node())", ctx); try { query.context(node(file("prod/AxisStep/TreeRepeat.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("19") ); } /** * Path 'attribute::*' from an element.. */ @org.junit.Test public void axes0071() { final XQuery query = new XQuery( "fn:count(//west/attribute::*)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path 'attribute::*' from an element.. */ @org.junit.Test public void axes0072() { final XQuery query = new XQuery( "fn:count(//west/attribute::*)", ctx); try { query.context(node(file("prod/AxisStep/Tree1Child.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path 'attribute::*' from an element.. */ @org.junit.Test public void axes0073() { final XQuery query = new XQuery( "fn:count(//west/attribute::*)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("4") ); } /** * Path 'attribute::' with name of attribute, from an element.. */ @org.junit.Test public void axes0081() { final XQuery query = new XQuery( "fn:count(//west/attribute::west-attr-2)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path 'attribute::' with name of attribute, from an element.. */ @org.junit.Test public void axes0082() { final XQuery query = new XQuery( "fn:count(//west/attribute::west-attr-2)", ctx); try { query.context(node(file("prod/AxisStep/Tree1Child.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path 'attribute::' with name of attribute, from an element.. */ @org.junit.Test public void axes0083() { final XQuery query = new XQuery( "fn:count(//west/attribute::west-attr-2)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path 'attribute::node()' from an element.. */ @org.junit.Test public void axes0091() { final XQuery query = new XQuery( "fn:count(//west/attribute::node())", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path 'attribute::node()' from an element.. */ @org.junit.Test public void axes0092() { final XQuery query = new XQuery( "fn:count(//west/attribute::node())", ctx); try { query.context(node(file("prod/AxisStep/Tree1Child.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path 'attribute::node()' from an element.. */ @org.junit.Test public void axes0093() { final XQuery query = new XQuery( "fn:count(//west/attribute::node())", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("4") ); } /** * Path '@*' (abbreviated syntax) from an element.. */ @org.junit.Test public void axes0101() { final XQuery query = new XQuery( "fn:count(//west/@*)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path '@*' (abbreviated syntax) from an element.. */ @org.junit.Test public void axes0102() { final XQuery query = new XQuery( "fn:count(//west/@*)", ctx); try { query.context(node(file("prod/AxisStep/Tree1Child.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path '@*' (abbreviated syntax) from an element.. */ @org.junit.Test public void axes0103() { final XQuery query = new XQuery( "fn:count(//west/@*)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("4") ); } /** * Path '@' with name of attribute, from an element.. */ @org.junit.Test public void axes0111() { final XQuery query = new XQuery( "fn:count(//west/@west-attr-2)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path '@' with name of attribute, from an element.. */ @org.junit.Test public void axes0112() { final XQuery query = new XQuery( "fn:count(//west/@west-attr-2)", ctx); try { query.context(node(file("prod/AxisStep/Tree1Child.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path '@' with name of attribute, from an element.. */ @org.junit.Test public void axes0113() { final XQuery query = new XQuery( "fn:count(//west/@west-attr-2)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test '/' alone.. */ @org.junit.Test public void axes0121() { final XQuery query = new XQuery( "fn:count( / )", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path 'parent::*' from an element.. */ @org.junit.Test public void axes0131() { final XQuery query = new XQuery( "fn:count(//center/parent::*)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path 'parent::*' from document element.. */ @org.junit.Test public void axes0141() { final XQuery query = new XQuery( "fn:count(/far-north/parent::*)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path 'parent::' with specified element name, from an element.. */ @org.junit.Test public void axes0151() { final XQuery query = new XQuery( "fn:count(//center/parent::near-north)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path 'parent::' with specified element name that is not found, from an element.. */ @org.junit.Test public void axes0161() { final XQuery query = new XQuery( "fn:count(//center/parent::nowhere)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path 'parent::node()' from an element.. */ @org.junit.Test public void axes0171() { final XQuery query = new XQuery( "fn:count(//center/parent::node())", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path 'parent::node()' from document element.. */ @org.junit.Test public void axes0181() { final XQuery query = new XQuery( "fn:count(/far-north/parent::node())", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test abbreviated '..' syntax from an element.. */ @org.junit.Test public void axes0191() { final XQuery query = new XQuery( "fn:count(//center/..)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path 'self::*' from an element.. */ @org.junit.Test public void axes0201() { final XQuery query = new XQuery( "fn:count(//center/self::*)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path 'self::' with specified element name, from an element.. */ @org.junit.Test public void axes0211() { final XQuery query = new XQuery( "fn:count(//center/self::center)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path 'self::node()' from an element.. */ @org.junit.Test public void axes0231() { final XQuery query = new XQuery( "fn:count(//center/self::node())", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path 'self::node()' axis from an attribute.. */ @org.junit.Test public void axes0271() { final XQuery query = new XQuery( "fn:count(//center/@center-attr-3/self::node())", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path 'self::node()' from a text node.. */ @org.junit.Test public void axes0301() { final XQuery query = new XQuery( "fn:count(//center/text()/self::node())", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path 'self::node()' from a text node.. */ @org.junit.Test public void axes0302() { final XQuery query = new XQuery( "fn:count(//center/text()/self::node())", ctx); try { query.context(node(file("prod/AxisStep/Tree1Text.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path 'descendant::*' from an element.. */ @org.junit.Test public void axes0311() { final XQuery query = new XQuery( "fn:count(//center/descendant::*)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path 'descendant::*' from an element.. */ @org.junit.Test public void axes0312() { final XQuery query = new XQuery( "fn:count(//center/descendant::*)", ctx); try { query.context(node(file("prod/AxisStep/Tree1Text.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path 'descendant::*' from an element.. */ @org.junit.Test public void axes0313() { final XQuery query = new XQuery( "fn:count(//center/descendant::*)", ctx); try { query.context(node(file("prod/AxisStep/Tree1Child.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path 'descendant::*' from an element.. */ @org.junit.Test public void axes0314() { final XQuery query = new XQuery( "fn:count(//center/descendant::*)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** * Path 'descendant::' with specified element name, from an element.. */ @org.junit.Test public void axes0321() { final XQuery query = new XQuery( "fn:count(//center/descendant::south)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path 'descendant::' with specified element name, from an element.. */ @org.junit.Test public void axes0322() { final XQuery query = new XQuery( "fn:count(//center/descendant::south)", ctx); try { query.context(node(file("prod/AxisStep/Tree1Child.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path 'descendant::' with specified element name, from an element.. */ @org.junit.Test public void axes0323() { final XQuery query = new XQuery( "fn:count(//center/descendant::south)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path 'descendant::' with specified element name, from an element.. */ @org.junit.Test public void axes0324() { final XQuery query = new XQuery( "fn:count(//center/descendant::south)", ctx); try { query.context(node(file("prod/AxisStep/TreeStack.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("8") ); } /** * Path 'descendant::node()' from an element.. */ @org.junit.Test public void axes0331() { final XQuery query = new XQuery( "fn:count(//center/descendant::node())", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path 'descendant::node()' from an element.. */ @org.junit.Test public void axes0332() { final XQuery query = new XQuery( "fn:count(//center/descendant::node())", ctx); try { query.context(node(file("prod/AxisStep/Tree1Text.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path 'descendant::node()' from an element.. */ @org.junit.Test public void axes0333() { final XQuery query = new XQuery( "fn:count(//center/descendant::node())", ctx); try { query.context(node(file("prod/AxisStep/Tree1Child.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path 'descendant::node()' from an element.. */ @org.junit.Test public void axes0334() { final XQuery query = new XQuery( "fn:count(//center/descendant::node())", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("21") ); } /** * Path 'descendant-or-self::*' from an element.. */ @org.junit.Test public void axes0341() { final XQuery query = new XQuery( "fn:count(//center/descendant-or-self::*)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path 'descendant-or-self::*' from an element.. */ @org.junit.Test public void axes0342() { final XQuery query = new XQuery( "fn:count(//center/descendant-or-self::*)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("6") ); } /** * Path 'descendant-or-self::' with specified element name, from an element.. */ @org.junit.Test public void axes0351() { final XQuery query = new XQuery( "fn:count(//center/descendant-or-self::south)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path 'descendant-or-self::' with specified element name, from an element.. */ @org.junit.Test public void axes0352() { final XQuery query = new XQuery( "fn:count(//center/descendant-or-self::south)", ctx); try { query.context(node(file("prod/AxisStep/Tree1Child.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path 'descendant-or-self::' with specified element name, from an element.. */ @org.junit.Test public void axes0353() { final XQuery query = new XQuery( "fn:count(//center/descendant-or-self::south)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path 'descendant-or-self::' with specified element name, from an element.. */ @org.junit.Test public void axes0354() { final XQuery query = new XQuery( "fn:count(//center/descendant-or-self::south)", ctx); try { query.context(node(file("prod/AxisStep/TreeStack.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("8") ); } /** * Path 'descendant-or-self::' with name of self specified.. */ @org.junit.Test public void axes0361() { final XQuery query = new XQuery( "fn:count(//center/descendant-or-self::center)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path 'descendant-or-self::' with name of self specified.. */ @org.junit.Test public void axes0362() { final XQuery query = new XQuery( "fn:count(//center/descendant-or-self::center)", ctx); try { query.context(node(file("prod/AxisStep/TreeRepeat.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("9") ); } /** * Path 'descendant-or-self::node()' from an element.. */ @org.junit.Test public void axes0371() { final XQuery query = new XQuery( "fn:count(//center/descendant-or-self::node())", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path 'descendant-or-self::node()' from an element.. */ @org.junit.Test public void axes0372() { final XQuery query = new XQuery( "fn:count(//center/descendant-or-self::node())", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("22") ); } /** * Path 'descendant-or-self::node()' from an attribute.. */ @org.junit.Test public void axes0411() { final XQuery query = new XQuery( "fn:count(//center/@center-attr-3/descendant-or-self::node())", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path 'descendant-or-self::node()' from a text node.. */ @org.junit.Test public void axes0431() { final XQuery query = new XQuery( "fn:count(//center/text()/descendant-or-self::node())", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path 'descendant-or-self::node()' from a text node.. */ @org.junit.Test public void axes0432() { final XQuery query = new XQuery( "fn:count(//center/text()/descendant-or-self::node())", ctx); try { query.context(node(file("prod/AxisStep/Tree1Text.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test '/child::*' absolute path.. */ @org.junit.Test public void axes0441() { final XQuery query = new XQuery( "fn:count(/child::*)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test '/child::*' absolute path.. */ @org.junit.Test public void axes0442() { final XQuery query = new XQuery( "fn:count(/child::*)", ctx); try { query.context(node(file("prod/AxisStep/TopMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Absolute path '/child::' with element name.. */ @org.junit.Test public void axes0451() { final XQuery query = new XQuery( "fn:count(/child::far-north)", ctx); try { query.context(node(file("prod/AxisStep/TreeEmpty.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Absolute path '/child::' with element name.. */ @org.junit.Test public void axes0452() { final XQuery query = new XQuery( "fn:count(/child::far-north)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test '/child::node()' absolute path.. */ @org.junit.Test public void axes0461() { final XQuery query = new XQuery( "fn:count(/child::node())", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test '/child::node()' absolute path.. */ @org.junit.Test public void axes0462() { final XQuery query = new XQuery( "fn:count(/child::node())", ctx); try { query.context(node(file("prod/AxisStep/TopMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("7") ); } /** * Test implied child axis in '/*' absolute path.. */ @org.junit.Test public void axes0471() { final XQuery query = new XQuery( "fn:count(/*)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test implied child axis in '/*' absolute path.. */ @org.junit.Test public void axes0472() { final XQuery query = new XQuery( "fn:count(/*)", ctx); try { query.context(node(file("prod/AxisStep/TopMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test implied child axis with element name after /.. */ @org.junit.Test public void axes0481() { final XQuery query = new XQuery( "fn:count(/far-north)", ctx); try { query.context(node(file("prod/AxisStep/TreeEmpty.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Test implied child axis with element name after /.. */ @org.junit.Test public void axes0482() { final XQuery query = new XQuery( "fn:count(/far-north)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test implied child axis in '/node()' absolute path.. */ @org.junit.Test public void axes0491() { final XQuery query = new XQuery( "fn:count(/node())", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test implied child axis in '/node()' absolute path.. */ @org.junit.Test public void axes0492() { final XQuery query = new XQuery( "fn:count(/node())", ctx); try { query.context(node(file("prod/AxisStep/TopMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("7") ); } /** * Test '/self::node()' absolute path.. */ @org.junit.Test public void axes0551() { final XQuery query = new XQuery( "fn:count(/self::node())", ctx); try { query.context(node(file("prod/AxisStep/TopMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test '/descendant::*' absolute path.. */ @org.junit.Test public void axes0561() { final XQuery query = new XQuery( "fn:count(/descendant::*)", ctx); try { query.context(node(file("prod/AxisStep/TreeEmpty.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test '/descendant::*' absolute path.. */ @org.junit.Test public void axes0562() { final XQuery query = new XQuery( "fn:count(/descendant::*)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("15") ); } /** * Test '/descendant::*' absolute path.. */ @org.junit.Test public void axes0563() { final XQuery query = new XQuery( "fn:count(/descendant::*)", ctx); try { query.context(node(file("prod/AxisStep/TopMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("16") ); } /** * Absolute path '/descendant::' with specified element name.. */ @org.junit.Test public void axes0571() { final XQuery query = new XQuery( "fn:count(/descendant::south)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Absolute path '/descendant::' with specified element name.. */ @org.junit.Test public void axes0572() { final XQuery query = new XQuery( "fn:count(/descendant::south)", ctx); try { query.context(node(file("prod/AxisStep/TreeEmpty.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Absolute path '/descendant::' with specified element name.. */ @org.junit.Test public void axes0573() { final XQuery query = new XQuery( "fn:count(/descendant::south)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Absolute path '/descendant::' with specified element name.. */ @org.junit.Test public void axes0574() { final XQuery query = new XQuery( "fn:count(/descendant::south)", ctx); try { query.context(node(file("prod/AxisStep/TreeStack.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("8") ); } /** * Test '/descendant::node()' absolute path.. */ @org.junit.Test public void axes0581() { final XQuery query = new XQuery( "fn:count(/descendant::node())", ctx); try { query.context(node(file("prod/AxisStep/TreeEmpty.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test '/descendant::node()' absolute path.. */ @org.junit.Test public void axes0582() { final XQuery query = new XQuery( "fn:count(/descendant::node())", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("56") ); } /** * Test '/descendant::node()' absolute path.. */ @org.junit.Test public void axes0583() { final XQuery query = new XQuery( "fn:count(/descendant::node())", ctx); try { query.context(node(file("prod/AxisStep/TopMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("58") ); } /** * Test '/descendant-or-self::*' absolute path.. */ @org.junit.Test public void axes0591() { final XQuery query = new XQuery( "fn:count(/descendant-or-self::*)", ctx); try { query.context(node(file("prod/AxisStep/TreeEmpty.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test '/descendant-or-self::*' absolute path.. */ @org.junit.Test public void axes0592() { final XQuery query = new XQuery( "fn:count(/descendant-or-self::*)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("15") ); } /** * Absolute path '/descendant-or-self::' with specified element name.. */ @org.junit.Test public void axes0601() { final XQuery query = new XQuery( "fn:count(/descendant-or-self::south)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Absolute path '/descendant-or-self::' with specified element name.. */ @org.junit.Test public void axes0602() { final XQuery query = new XQuery( "fn:count(/descendant-or-self::south)", ctx); try { query.context(node(file("prod/AxisStep/TreeEmpty.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Absolute path '/descendant-or-self::' with specified element name.. */ @org.junit.Test public void axes0603() { final XQuery query = new XQuery( "fn:count(/descendant-or-self::south)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Absolute path '/descendant-or-self::' with specified element name.. */ @org.junit.Test public void axes0604() { final XQuery query = new XQuery( "fn:count(/descendant-or-self::south)", ctx); try { query.context(node(file("prod/AxisStep/TreeStack.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("8") ); } /** * Test '/descendant-or-self::node()' absolute path.. */ @org.junit.Test public void axes0611() { final XQuery query = new XQuery( "fn:count(/descendant-or-self::node())", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("57") ); } /** * Test '/descendant-or-self::node()' absolute path.. */ @org.junit.Test public void axes0612() { final XQuery query = new XQuery( "fn:count(/descendant-or-self::node())", ctx); try { query.context(node(file("prod/AxisStep/TopMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("59") ); } /** * Test '//child::*' absolute path.. */ @org.junit.Test public void axes0621() { final XQuery query = new XQuery( "fn:count(//child::*)", ctx); try { query.context(node(file("prod/AxisStep/TreeEmpty.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test '//child::*' absolute path.. */ @org.junit.Test public void axes0622() { final XQuery query = new XQuery( "fn:count(//child::*)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("15") ); } /** * Absolute path '//child::' with specified element name.. */ @org.junit.Test public void axes0631() { final XQuery query = new XQuery( "fn:count(//child::south)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Absolute path '//child::' with specified element name.. */ @org.junit.Test public void axes0632() { final XQuery query = new XQuery( "fn:count(//child::south)", ctx); try { query.context(node(file("prod/AxisStep/TreeEmpty.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Absolute path '//child::' with specified element name.. */ @org.junit.Test public void axes0633() { final XQuery query = new XQuery( "fn:count(//child::south)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Absolute path '//child::' with specified element name.. */ @org.junit.Test public void axes0634() { final XQuery query = new XQuery( "fn:count(//child::south)", ctx); try { query.context(node(file("prod/AxisStep/TreeStack.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("8") ); } /** * Test '//child::node()' absolute path.. */ @org.junit.Test public void axes0641() { final XQuery query = new XQuery( "fn:count(//child::node())", ctx); try { query.context(node(file("prod/AxisStep/TreeEmpty.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test '//child::node()' absolute path.. */ @org.junit.Test public void axes0642() { final XQuery query = new XQuery( "fn:count(//child::node())", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("56") ); } /** * Test '//child::node()' absolute path.. */ @org.junit.Test public void axes0643() { final XQuery query = new XQuery( "fn:count(//child::node())", ctx); try { query.context(node(file("prod/AxisStep/TopMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("58") ); } /** * Test implied child axis in '//*' absolute path.. */ @org.junit.Test public void axes0651() { final XQuery query = new XQuery( "fn:count(//*)", ctx); try { query.context(node(file("prod/AxisStep/TreeEmpty.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test implied child axis in '//*' absolute path.. */ @org.junit.Test public void axes0652() { final XQuery query = new XQuery( "fn:count(//*)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("15") ); } /** * Absolute path with element name after // implies child axis.. */ @org.junit.Test public void axes0661() { final XQuery query = new XQuery( "fn:count(//south)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Absolute path with element name after // implies child axis.. */ @org.junit.Test public void axes0662() { final XQuery query = new XQuery( "fn:count(//south)", ctx); try { query.context(node(file("prod/AxisStep/TreeEmpty.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Absolute path with element name after // implies child axis.. */ @org.junit.Test public void axes0663() { final XQuery query = new XQuery( "fn:count(//south)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Absolute path with element name after // implies child axis.. */ @org.junit.Test public void axes0664() { final XQuery query = new XQuery( "fn:count(//south)", ctx); try { query.context(node(file("prod/AxisStep/TreeStack.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("8") ); } /** * Test implied child axis in '//node()' absolute path.. */ @org.junit.Test public void axes0671() { final XQuery query = new XQuery( "fn:count(//node())", ctx); try { query.context(node(file("prod/AxisStep/TreeEmpty.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test implied child axis in '//node()' absolute path.. */ @org.junit.Test public void axes0672() { final XQuery query = new XQuery( "fn:count(//node())", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("56") ); } /** * Test implied child axis in '//node()' absolute path.. */ @org.junit.Test public void axes0673() { final XQuery query = new XQuery( "fn:count(//node())", ctx); try { query.context(node(file("prod/AxisStep/TopMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("58") ); } /** * Test '//attribute::*' absolute path.. */ @org.junit.Test public void axes0681() { final XQuery query = new XQuery( "fn:count(//attribute::*)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Test '//attribute::*' absolute path.. */ @org.junit.Test public void axes0682() { final XQuery query = new XQuery( "fn:count(//attribute::*)", ctx); try { query.context(node(file("prod/AxisStep/TreeEmpty.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test '//attribute::*' absolute path.. */ @org.junit.Test public void axes0683() { final XQuery query = new XQuery( "fn:count(//attribute::*)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("14") ); } /** * Absolute path '//attribute::' with specified name.. */ @org.junit.Test public void axes0691() { final XQuery query = new XQuery( "fn:count(//attribute::mark)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Absolute path '//attribute::' with specified name.. */ @org.junit.Test public void axes0692() { final XQuery query = new XQuery( "fn:count(//attribute::mark)", ctx); try { query.context(node(file("prod/AxisStep/TreeEmpty.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Absolute path '//attribute::' with specified name.. */ @org.junit.Test public void axes0693() { final XQuery query = new XQuery( "fn:count(//attribute::mark)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("6") ); } /** * Absolute path '//@*' has abbreviated syntax.. */ @org.junit.Test public void axes0701() { final XQuery query = new XQuery( "fn:count(//@*)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Absolute path '//@*' has abbreviated syntax.. */ @org.junit.Test public void axes0702() { final XQuery query = new XQuery( "fn:count(//@*)", ctx); try { query.context(node(file("prod/AxisStep/TreeEmpty.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Absolute path '//@*' has abbreviated syntax.. */ @org.junit.Test public void axes0703() { final XQuery query = new XQuery( "fn:count(//@*)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("14") ); } /** * Absolute path '//@' with specified name.. */ @org.junit.Test public void axes0711() { final XQuery query = new XQuery( "fn:count(//@mark)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Absolute path '//@' with specified name.. */ @org.junit.Test public void axes0712() { final XQuery query = new XQuery( "fn:count(//@mark)", ctx); try { query.context(node(file("prod/AxisStep/TreeEmpty.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Absolute path '//@' with specified name.. */ @org.junit.Test public void axes0713() { final XQuery query = new XQuery( "fn:count(//@mark)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("6") ); } /** * Test '//self::*' absolute path.. */ @org.junit.Test public void axes0721() { final XQuery query = new XQuery( "fn:count(//self::*)", ctx); try { query.context(node(file("prod/AxisStep/TreeEmpty.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test '//self::*' absolute path.. */ @org.junit.Test public void axes0722() { final XQuery query = new XQuery( "fn:count(//self::*)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("15") ); } /** * Test '//self::node()' absolute path.. */ @org.junit.Test public void axes0731() { final XQuery query = new XQuery( "fn:count(//self::node())", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("57") ); } /** * Test '//self::node()' absolute path.. */ @org.junit.Test public void axes0732() { final XQuery query = new XQuery( "fn:count(//self::node())", ctx); try { query.context(node(file("prod/AxisStep/TopMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("59") ); } /** * Path '//child::*' from an element.. */ @org.junit.Test public void axes0741() { final XQuery query = new XQuery( "fn:count(//center//child::*)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path '//child::*' from an element.. */ @org.junit.Test public void axes0742() { final XQuery query = new XQuery( "fn:count(//center//child::*)", ctx); try { query.context(node(file("prod/AxisStep/Tree1Text.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path '//child::*' from an element.. */ @org.junit.Test public void axes0743() { final XQuery query = new XQuery( "fn:count(//center//child::*)", ctx); try { query.context(node(file("prod/AxisStep/Tree1Child.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path '//child::*' from an element.. */ @org.junit.Test public void axes0744() { final XQuery query = new XQuery( "fn:count(//center//child::*)", ctx); try { query.context(node(file("prod/AxisStep/TreeRepeat.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("12") ); } /** * Path '//child::' with element name, from an element.. */ @org.junit.Test public void axes0751() { final XQuery query = new XQuery( "fn:count(//center//child::south)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path '//child::' with element name, from an element.. */ @org.junit.Test public void axes0752() { final XQuery query = new XQuery( "fn:count(//center//child::south)", ctx); try { query.context(node(file("prod/AxisStep/Tree1Child.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path '//child::' with element name, from an element.. */ @org.junit.Test public void axes0753() { final XQuery query = new XQuery( "fn:count(//center//child::south)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path '//child::' with element name, from an element.. */ @org.junit.Test public void axes0754() { final XQuery query = new XQuery( "fn:count(//center//child::south)", ctx); try { query.context(node(file("prod/AxisStep/TreeStack.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("8") ); } /** * Path '//child::node()' from an element.. */ @org.junit.Test public void axes0761() { final XQuery query = new XQuery( "fn:count(//center//child::node())", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path '//child::node()' from an element.. */ @org.junit.Test public void axes0762() { final XQuery query = new XQuery( "fn:count(//center//child::node())", ctx); try { query.context(node(file("prod/AxisStep/Tree1Child.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path '//child::node()' from an element.. */ @org.junit.Test public void axes0763() { final XQuery query = new XQuery( "fn:count(//center//child::node())", ctx); try { query.context(node(file("prod/AxisStep/Tree1Text.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path '//child::node()' from an element.. */ @org.junit.Test public void axes0764() { final XQuery query = new XQuery( "fn:count(//center//child::node())", ctx); try { query.context(node(file("prod/AxisStep/TreeRepeat.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("37") ); } /** * Test implied child axis in '//*' after an element.. */ @org.junit.Test public void axes0771() { final XQuery query = new XQuery( "fn:count(//center//*)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Test implied child axis in '//*' after an element.. */ @org.junit.Test public void axes0772() { final XQuery query = new XQuery( "fn:count(//center//*)", ctx); try { query.context(node(file("prod/AxisStep/Tree1Child.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test implied child axis in '//*' after an element.. */ @org.junit.Test public void axes0773() { final XQuery query = new XQuery( "fn:count(//center//*)", ctx); try { query.context(node(file("prod/AxisStep/TreeRepeat.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("12") ); } /** * Test implied child axis in element//element.. */ @org.junit.Test public void axes0781() { final XQuery query = new XQuery( "fn:count(//center//south)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Test implied child axis in element//element.. */ @org.junit.Test public void axes0782() { final XQuery query = new XQuery( "fn:count(//center//south)", ctx); try { query.context(node(file("prod/AxisStep/Tree1Child.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Test implied child axis in element//element.. */ @org.junit.Test public void axes0783() { final XQuery query = new XQuery( "fn:count(//center//south)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test implied child axis in element//element.. */ @org.junit.Test public void axes0784() { final XQuery query = new XQuery( "fn:count(//center//south)", ctx); try { query.context(node(file("prod/AxisStep/TreeStack.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("8") ); } /** * Test implied child axis in '//node()' from an element.. */ @org.junit.Test public void axes0791() { final XQuery query = new XQuery( "fn:count(//center//node())", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Test implied child axis in '//node()' from an element.. */ @org.junit.Test public void axes0792() { final XQuery query = new XQuery( "fn:count(//center//node())", ctx); try { query.context(node(file("prod/AxisStep/Tree1Child.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test implied child axis in '//node()' from an element.. */ @org.junit.Test public void axes0793() { final XQuery query = new XQuery( "fn:count(//center//node())", ctx); try { query.context(node(file("prod/AxisStep/Tree1Text.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test implied child axis in '//node()' from an element.. */ @org.junit.Test public void axes0794() { final XQuery query = new XQuery( "fn:count(//center//node())", ctx); try { query.context(node(file("prod/AxisStep/TreeRepeat.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("37") ); } /** * Path '//attribute::*' after an element.. */ @org.junit.Test public void axes0801() { final XQuery query = new XQuery( "fn:count(//west//attribute::*)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path '//attribute::*' after an element.. */ @org.junit.Test public void axes0802() { final XQuery query = new XQuery( "fn:count(//west//attribute::*)", ctx); try { query.context(node(file("prod/AxisStep/Tree1Child.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path '//attribute::*' after an element.. */ @org.junit.Test public void axes0803() { final XQuery query = new XQuery( "fn:count(//west//attribute::*)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("4") ); } /** * Path '//attribute::' with name of attribute, after an element.. */ @org.junit.Test public void axes0811() { final XQuery query = new XQuery( "fn:count(//center//attribute::center-attr-2)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path '//attribute::' with name of attribute, after an element.. */ @org.junit.Test public void axes0812() { final XQuery query = new XQuery( "fn:count(//center//attribute::center-attr-2)", ctx); try { query.context(node(file("prod/AxisStep/Tree1Child.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path '//attribute::' with name of attribute, after an element.. */ @org.junit.Test public void axes0813() { final XQuery query = new XQuery( "fn:count(//center//attribute::center-attr-2)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path '//attribute::' with name of attribute, after an element.. */ @org.junit.Test public void axes0814() { final XQuery query = new XQuery( "fn:count(//center//attribute::center-attr-2)", ctx); try { query.context(node(file("prod/AxisStep/TreeRepeat.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("4") ); } /** * Path '//attribute::node()' after an element.. */ @org.junit.Test public void axes0821() { final XQuery query = new XQuery( "fn:count(//west//attribute::node())", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path '//attribute::node()' after an element.. */ @org.junit.Test public void axes0822() { final XQuery query = new XQuery( "fn:count(//west//attribute::node())", ctx); try { query.context(node(file("prod/AxisStep/Tree1Child.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path '//attribute::node()' after an element.. */ @org.junit.Test public void axes0823() { final XQuery query = new XQuery( "fn:count(//west//attribute::node())", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("4") ); } /** * Path '//@*' (abbreviated syntax) after an element.. */ @org.junit.Test public void axes0831() { final XQuery query = new XQuery( "fn:count(//west//@*)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path '//@*' (abbreviated syntax) after an element.. */ @org.junit.Test public void axes0832() { final XQuery query = new XQuery( "fn:count(//west//@*)", ctx); try { query.context(node(file("prod/AxisStep/Tree1Child.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path '//@*' (abbreviated syntax) after an element.. */ @org.junit.Test public void axes0833() { final XQuery query = new XQuery( "fn:count(//west//@*)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("4") ); } /** * Path '//@' with name of attribute, after an element.. */ @org.junit.Test public void axes0841() { final XQuery query = new XQuery( "fn:count(//center//@center-attr-2)", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path '//@' with name of attribute, after an element.. */ @org.junit.Test public void axes0842() { final XQuery query = new XQuery( "fn:count(//center//@center-attr-2)", ctx); try { query.context(node(file("prod/AxisStep/Tree1Child.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Path '//@' with name of attribute, after an element.. */ @org.junit.Test public void axes0843() { final XQuery query = new XQuery( "fn:count(//center//@center-attr-2)", ctx); try { query.context(node(file("prod/AxisStep/TreeCompass.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Path '//@' with name of attribute, after an element.. */ @org.junit.Test public void axes0844() { final XQuery query = new XQuery( "fn:count(//center//@center-attr-2)", ctx); try { query.context(node(file("prod/AxisStep/TreeRepeat.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("4") ); } /** * Use of // to get all elements of a given name. */ @org.junit.Test public void axes085() { final XQuery query = new XQuery( " {//Customers} ", ctx); try { query.context(node(file("prod/AxisStep/nw_Customers.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n\t\tAlfreds Futterkiste\n\t\tMaria Anders\n\t\tSales Representative\n\t\t030-0074321\n\t\t030-0076545\n\t\t\n\t\t\t
    Obere Str. 57
    \n\t\t\tBerlin\n\t\t\t12209\n\t\t\tGermany\n\t\t
    \n\t
    \n\t\tAna Trujillo Emparedados y helados\n\t\tAna Trujillo\n\t\tOwner\n\t\t(5) 555-4729\n\t\t(5) 555-3745\n\t\t\n\t\t\t
    Avda. de la Constitución 2222
    \n\t\t\tMéxico D.F.\n\t\t\t05021\n\t\t\tMexico\n\t\t
    \n\t
    \n\t\tAntonio Moreno Taquería\n\t\tAntonio Moreno\n\t\tOwner\n\t\t(5) 555-3932\n\t\t\n\t\t\t
    Mataderos 2312
    \n\t\t\tMéxico D.F.\n\t\t\t05023\n\t\t\tMexico\n\t\t
    \n\t
    \n\t\tAround the Horn\n\t\tThomas Hardy\n\t\tSales Representative\n\t\t(171) 555-7788\n\t\t(171) 555-6750\n\t\t\n\t\t\t
    120 Hanover Sq.
    \n\t\t\tLondon\n\t\t\tWA1 1DP\n\t\t\tUK\n\t\t
    \n\t
    \n\t\tBerglunds snabbköp\n\t\tChristina Berglund\n\t\tOrder Administrator\n\t\t0921-12 34 65\n\t\t0921-12 34 67\n\t\t\n\t\t\t
    Berguvsvägen 8
    \n\t\t\tLuleå\n\t\t\tS-958 22\n\t\t\tSweden\n\t\t
    \n\t
    \n\t\tBlauer See Delikatessen\n\t\tHanna Moos\n\t\tSales Representative\n\t\t0621-08460\n\t\t0621-08924\n\t\t\n\t\t\t
    Forsterstr. 57
    \n\t\t\tMannheim\n\t\t\t68306\n\t\t\tGermany\n\t\t
    \n\t
    \n\t\tBlondesddsl père et fils\n\t\tFrédérique Citeaux\n\t\tMarketing Manager\n\t\t88.60.15.31\n\t\t88.60.15.32\n\t\t\n\t\t\t
    24, place Kléber
    \n\t\t\tStrasbourg\n\t\t\t67000\n\t\t\tFrance\n\t\t
    \n\t
    \n\t\tBólido Comidas preparadas\n\t\tMartín Sommer\n\t\tOwner\n\t\t(91) 555 22 82\n\t\t(91) 555 91 99\n\t\t\n\t\t\t
    C/ Araquil, 67
    \n\t\t\tMadrid\n\t\t\t28023\n\t\t\tSpain\n\t\t
    \n\t
    \n\t\tBon app'\n\t\tLaurence Lebihan\n\t\tOwner\n\t\t91.24.45.40\n\t\t91.24.45.41\n\t\t\n\t\t\t
    12, rue des Bouchers
    \n\t\t\tMarseille\n\t\t\t13008\n\t\t\tFrance\n\t\t
    \n\t
    \n\t\tBottom-Dollar Markets\n\t\tElizabeth Lincoln\n\t\tAccounting Manager\n\t\t(604) 555-4729\n\t\t(604) 555-3745\n\t\t\n\t\t\t
    23 Tsawassen Blvd.
    \n\t\t\tTsawassen\n\t\t\tBC\n\t\t\tT2F 8M4\n\t\t\tCanada\n\t\t
    \n\t
    \n\t\tB's Beverages\n\t\tVictoria Ashworth\n\t\tSales Representative\n\t\t(171) 555-1212\n\t\t\n\t\t\t
    Fauntleroy Circus
    \n\t\t\tLondon\n\t\t\tEC2 5NT\n\t\t\tUK\n\t\t
    \n\t
    \n\t\tCactus Comidas para llevar\n\t\tPatricio Simpson\n\t\tSales Agent\n\t\t(1) 135-5555\n\t\t(1) 135-4892\n\t\t\n\t\t\t
    Cerrito 333
    \n\t\t\tBuenos Aires\n\t\t\t1010\n\t\t\tArgentina\n\t\t
    \n\t
    \n\t\tCentro comercial Moctezuma\n\t\tFrancisco Chang\n\t\tMarketing Manager\n\t\t(5) 555-3392\n\t\t(5) 555-7293\n\t\t\n\t\t\t
    Sierras de Granada 9993
    \n\t\t\tMéxico D.F.\n\t\t\t05022\n\t\t\tMexico\n\t\t
    \n\t
    \n\t\tChop-suey Chinese\n\t\tYang Wang\n\t\tOwner\n\t\t0452-076545\n\t\t\n\t\t\t
    Hauptstr. 29
    \n\t\t\tBern\n\t\t\t3012\n\t\t\tSwitzerland\n\t\t
    \n\t
    \n\t\tComércio Mineiro\n\t\tPedro Afonso\n\t\tSales Associate\n\t\t(11) 555-7647\n\t\t\n\t\t\t
    Av. dos Lusíadas, 23
    \n\t\t\tSao Paulo\n\t\t\tSP\n\t\t\t05432-043\n\t\t\tBrazil\n\t\t
    \n\t
    \n\t\tConsolidated Holdings\n\t\tElizabeth Brown\n\t\tSales Representative\n\t\t(171) 555-2282\n\t\t(171) 555-9199\n\t\t\n\t\t\t
    Berkeley Gardens 12 Brewery
    \n\t\t\tLondon\n\t\t\tWX1 6LT\n\t\t\tUK\n\t\t
    \n\t
    \n\t\tDrachenblut Delikatessen\n\t\tSven Ottlieb\n\t\tOrder Administrator\n\t\t0241-039123\n\t\t0241-059428\n\t\t\n\t\t\t
    Walserweg 21
    \n\t\t\tAachen\n\t\t\t52066\n\t\t\tGermany\n\t\t
    \n\t
    \n\t\tDu monde entier\n\t\tJanine Labrune\n\t\tOwner\n\t\t40.67.88.88\n\t\t40.67.89.89\n\t\t\n\t\t\t
    67, rue des Cinquante Otages
    \n\t\t\tNantes\n\t\t\t44000\n\t\t\tFrance\n\t\t
    \n\t
    \n\t\tEastern Connection\n\t\tAnn Devon\n\t\tSales Agent\n\t\t(171) 555-0297\n\t\t(171) 555-3373\n\t\t\n\t\t\t
    35 King George
    \n\t\t\tLondon\n\t\t\tWX3 6FW\n\t\t\tUK\n\t\t
    \n\t
    \n\t\tErnst Handel\n\t\tRoland Mendel\n\t\tSales Manager\n\t\t7675-3425\n\t\t7675-3426\n\t\t\n\t\t\t
    Kirchgasse 6
    \n\t\t\tGraz\n\t\t\t8010\n\t\t\tAustria\n\t\t
    \n\t
    \n\t\tFamilia Arquibaldo\n\t\tAria Cruz\n\t\tMarketing Assistant\n\t\t(11) 555-9857\n\t\t\n\t\t\t
    Rua Orós, 92
    \n\t\t\tSao Paulo\n\t\t\tSP\n\t\t\t05442-030\n\t\t\tBrazil\n\t\t
    \n\t
    \n\t\tFISSA Fabrica Inter. Salchichas S.A.\n\t\tDiego Roel\n\t\tAccounting Manager\n\t\t(91) 555 94 44\n\t\t(91) 555 55 93\n\t\t\n\t\t\t
    C/ Moralzarzal, 86
    \n\t\t\tMadrid\n\t\t\t28034\n\t\t\tSpain\n\t\t
    \n\t
    \n\t\tFolies gourmandes\n\t\tMartine Rancé\n\t\tAssistant Sales Agent\n\t\t20.16.10.16\n\t\t20.16.10.17\n\t\t\n\t\t\t
    184, chaussée de Tournai
    \n\t\t\tLille\n\t\t\t59000\n\t\t\tFrance\n\t\t
    \n\t
    \n\t\tFolk och fä HB\n\t\tMaria Larsson\n\t\tOwner\n\t\t0695-34 67 21\n\t\t\n\t\t\t
    Åkergatan 24
    \n\t\t\tBräcke\n\t\t\tS-844 67\n\t\t\tSweden\n\t\t
    \n\t
    \n\t\tFrankenversand\n\t\tPeter Franken\n\t\tMarketing Manager\n\t\t089-0877310\n\t\t089-0877451\n\t\t\n\t\t\t
    Berliner Platz 43
    \n\t\t\tMünchen\n\t\t\t80805\n\t\t\tGermany\n\t\t
    \n\t
    \n\t\tFrance restauration\n\t\tCarine Schmitt\n\t\tMarketing Manager\n\t\t40.32.21.21\n\t\t40.32.21.20\n\t\t\n\t\t\t
    54, rue Royale
    \n\t\t\tNantes\n\t\t\t44000\n\t\t\tFrance\n\t\t
    \n\t
    \n\t\tFranchi S.p.A.\n\t\tPaolo Accorti\n\t\tSales Representative\n\t\t011-4988260\n\t\t011-4988261\n\t\t\n\t\t\t
    Via Monte Bianco 34
    \n\t\t\tTorino\n\t\t\t10100\n\t\t\tItaly\n\t\t
    \n\t
    \n\t\tFuria Bacalhau e Frutos do Mar\n\t\tLino Rodriguez\n\t\tSales Manager\n\t\t(1) 354-2534\n\t\t(1) 354-2535\n\t\t\n\t\t\t
    Jardim das rosas n. 32
    \n\t\t\tLisboa\n\t\t\t1675\n\t\t\tPortugal\n\t\t
    \n\t
    \n\t\tGalería del gastrónomo\n\t\tEduardo Saavedra\n\t\tMarketing Manager\n\t\t(93) 203 4560\n\t\t(93) 203 4561\n\t\t\n\t\t\t
    Rambla de Cataluña, 23
    \n\t\t\tBarcelona\n\t\t\t08022\n\t\t\tSpain\n\t\t
    \n\t
    \n\t\tGodos Cocina Típica\n\t\tJosé Pedro Freyre\n\t\tSales Manager\n\t\t(95) 555 82 82\n\t\t\n\t\t\t
    C/ Romero, 33
    \n\t\t\tSevilla\n\t\t\t41101\n\t\t\tSpain\n\t\t
    \n\t
    \n\t\tGourmet Lanchonetes\n\t\tAndré Fonseca\n\t\tSales Associate\n\t\t(11) 555-9482\n\t\t\n\t\t\t
    Av. Brasil, 442
    \n\t\t\tCampinas\n\t\t\tSP\n\t\t\t04876-786\n\t\t\tBrazil\n\t\t
    \n\t
    \n\t\tGreat Lakes Food Market\n\t\tHoward Snyder\n\t\tMarketing Manager\n\t\t(503) 555-7555\n\t\t\n\t\t\t
    2732 Baker Blvd.
    \n\t\t\tEugene\n\t\t\tOR\n\t\t\t97403\n\t\t\tUSA\n\t\t
    \n\t
    \n\t\tGROSELLA-Restaurante\n\t\tManuel Pereira\n\t\tOwner\n\t\t(2) 283-2951\n\t\t(2) 283-3397\n\t\t\n\t\t\t
    5ª Ave. Los Palos Grandes
    \n\t\t\tCaracas\n\t\t\tDF\n\t\t\t1081\n\t\t\tVenezuela\n\t\t
    \n\t
    \n\t\tHanari Carnes\n\t\tMario Pontes\n\t\tAccounting Manager\n\t\t(21) 555-0091\n\t\t(21) 555-8765\n\t\t\n\t\t\t
    Rua do Paço, 67
    \n\t\t\tRio de Janeiro\n\t\t\tRJ\n\t\t\t05454-876\n\t\t\tBrazil\n\t\t
    \n\t
    \n\t\tHILARION-Abastos\n\t\tCarlos Hernández\n\t\tSales Representative\n\t\t(5) 555-1340\n\t\t(5) 555-1948\n\t\t\n\t\t\t
    Carrera 22 con Ave. Carlos Soublette #8-35
    \n\t\t\tSan Cristóbal\n\t\t\tTáchira\n\t\t\t5022\n\t\t\tVenezuela\n\t\t
    \n\t
    \n\t\tHungry Coyote Import Store\n\t\tYoshi Latimer\n\t\tSales Representative\n\t\t(503) 555-6874\n\t\t(503) 555-2376\n\t\t\n\t\t\t
    City Center Plaza 516 Main St.
    \n\t\t\tElgin\n\t\t\tOR\n\t\t\t97827\n\t\t\tUSA\n\t\t
    \n\t
    \n\t\tHungry Owl All-Night Grocers\n\t\tPatricia McKenna\n\t\tSales Associate\n\t\t2967 542\n\t\t2967 3333\n\t\t\n\t\t\t
    8 Johnstown Road
    \n\t\t\tCork\n\t\t\tCo. Cork\n\t\t\tIreland\n\t\t
    \n\t
    \n\t\tIsland Trading\n\t\tHelen Bennett\n\t\tMarketing Manager\n\t\t(198) 555-8888\n\t\t\n\t\t\t
    Garden House Crowther Way
    \n\t\t\tCowes\n\t\t\tIsle of Wight\n\t\t\tPO31 7PJ\n\t\t\tUK\n\t\t
    \n\t
    \n\t\tKöniglich Essen\n\t\tPhilip Cramer\n\t\tSales Associate\n\t\t0555-09876\n\t\t\n\t\t\t
    Maubelstr. 90
    \n\t\t\tBrandenburg\n\t\t\t14776\n\t\t\tGermany\n\t\t
    \n\t
    \n\t\tLa corne d'abondance\n\t\tDaniel Tonini\n\t\tSales Representative\n\t\t30.59.84.10\n\t\t30.59.85.11\n\t\t\n\t\t\t
    67, avenue de l'Europe
    \n\t\t\tVersailles\n\t\t\t78000\n\t\t\tFrance\n\t\t
    \n\t
    \n\t\tLa maison d'Asie\n\t\tAnnette Roulet\n\t\tSales Manager\n\t\t61.77.61.10\n\t\t61.77.61.11\n\t\t\n\t\t\t
    1 rue Alsace-Lorraine
    \n\t\t\tToulouse\n\t\t\t31000\n\t\t\tFrance\n\t\t
    \n\t
    \n\t\tLaughing Bacchus Wine Cellars\n\t\tYoshi Tannamuri\n\t\tMarketing Assistant\n\t\t(604) 555-3392\n\t\t(604) 555-7293\n\t\t\n\t\t\t
    1900 Oak St.
    \n\t\t\tVancouver\n\t\t\tBC\n\t\t\tV3F 2K1\n\t\t\tCanada\n\t\t
    \n\t
    \n\t\tLazy K Kountry Store\n\t\tJohn Steel\n\t\tMarketing Manager\n\t\t(509) 555-7969\n\t\t(509) 555-6221\n\t\t\n\t\t\t
    12 Orchestra Terrace
    \n\t\t\tWalla Walla\n\t\t\tWA\n\t\t\t99362\n\t\t\tUSA\n\t\t
    \n\t
    \n\t\tLehmanns Marktstand\n\t\tRenate Messner\n\t\tSales Representative\n\t\t069-0245984\n\t\t069-0245874\n\t\t\n\t\t\t
    Magazinweg 7
    \n\t\t\tFrankfurt a.M.\n\t\t\t60528\n\t\t\tGermany\n\t\t
    \n\t
    \n\t\tLet's Stop N Shop\n\t\tJaime Yorres\n\t\tOwner\n\t\t(415) 555-5938\n\t\t\n\t\t\t
    87 Polk St. Suite 5
    \n\t\t\tSan Francisco\n\t\t\tCA\n\t\t\t94117\n\t\t\tUSA\n\t\t
    \n\t
    \n\t\tLILA-Supermercado\n\t\tCarlos González\n\t\tAccounting Manager\n\t\t(9) 331-6954\n\t\t(9) 331-7256\n\t\t\n\t\t\t
    Carrera 52 con Ave. Bolívar #65-98 Llano Largo
    \n\t\t\tBarquisimeto\n\t\t\tLara\n\t\t\t3508\n\t\t\tVenezuela\n\t\t
    \n\t
    \n\t\tLINO-Delicateses\n\t\tFelipe Izquierdo\n\t\tOwner\n\t\t(8) 34-56-12\n\t\t(8) 34-93-93\n\t\t\n\t\t\t
    Ave. 5 de Mayo Porlamar
    \n\t\t\tI. de Margarita\n\t\t\tNueva Esparta\n\t\t\t4980\n\t\t\tVenezuela\n\t\t
    \n\t
    \n\t\tLonesome Pine Restaurant\n\t\tFran Wilson\n\t\tSales Manager\n\t\t(503) 555-9573\n\t\t(503) 555-9646\n\t\t\n\t\t\t
    89 Chiaroscuro Rd.
    \n\t\t\tPortland\n\t\t\tOR\n\t\t\t97219\n\t\t\tUSA\n\t\t
    \n\t
    \n\t\tMagazzini Alimentari Riuniti\n\t\tGiovanni Rovelli\n\t\tMarketing Manager\n\t\t035-640230\n\t\t035-640231\n\t\t\n\t\t\t
    Via Ludovico il Moro 22
    \n\t\t\tBergamo\n\t\t\t24100\n\t\t\tItaly\n\t\t
    \n\t
    \n\t\tMaison Dewey\n\t\tCatherine Dewey\n\t\tSales Agent\n\t\t(02) 201 24 67\n\t\t(02) 201 24 68\n\t\t\n\t\t\t
    Rue Joseph-Bens 532
    \n\t\t\tBruxelles\n\t\t\tB-1180\n\t\t\tBelgium\n\t\t
    \n\t
    \n\t\tMère Paillarde\n\t\tJean Fresnière\n\t\tMarketing Assistant\n\t\t(514) 555-8054\n\t\t(514) 555-8055\n\t\t\n\t\t\t
    43 rue St. Laurent
    \n\t\t\tMontréal\n\t\t\tQuébec\n\t\t\tH1J 1C3\n\t\t\tCanada\n\t\t
    \n\t
    \n\t\tMorgenstern Gesundkost\n\t\tAlexander Feuer\n\t\tMarketing Assistant\n\t\t0342-023176\n\t\t\n\t\t\t
    Heerstr. 22
    \n\t\t\tLeipzig\n\t\t\t04179\n\t\t\tGermany\n\t\t
    \n\t
    \n\t\tNorth/South\n\t\tSimon Crowther\n\t\tSales Associate\n\t\t(171) 555-7733\n\t\t(171) 555-2530\n\t\t\n\t\t\t
    South House 300 Queensbridge
    \n\t\t\tLondon\n\t\t\tSW7 1RZ\n\t\t\tUK\n\t\t
    \n\t
    \n\t\tOcéano Atlántico Ltda.\n\t\tYvonne Moncada\n\t\tSales Agent\n\t\t(1) 135-5333\n\t\t(1) 135-5535\n\t\t\n\t\t\t
    Ing. Gustavo Moncada 8585 Piso 20-A
    \n\t\t\tBuenos Aires\n\t\t\t1010\n\t\t\tArgentina\n\t\t
    \n\t
    \n\t\tOld World Delicatessen\n\t\tRene Phillips\n\t\tSales Representative\n\t\t(907) 555-7584\n\t\t(907) 555-2880\n\t\t\n\t\t\t
    2743 Bering St.
    \n\t\t\tAnchorage\n\t\t\tAK\n\t\t\t99508\n\t\t\tUSA\n\t\t
    \n\t
    \n\t\tOttilies Käseladen\n\t\tHenriette Pfalzheim\n\t\tOwner\n\t\t0221-0644327\n\t\t0221-0765721\n\t\t\n\t\t\t
    Mehrheimerstr. 369
    \n\t\t\tKöln\n\t\t\t50739\n\t\t\tGermany\n\t\t
    \n\t
    \n\t\tParis spécialités\n\t\tMarie Bertrand\n\t\tOwner\n\t\t(1) 42.34.22.66\n\t\t(1) 42.34.22.77\n\t\t\n\t\t\t
    265, boulevard Charonne
    \n\t\t\tParis\n\t\t\t75012\n\t\t\tFrance\n\t\t
    \n\t
    \n\t\tPericles Comidas clásicas\n\t\tGuillermo Fernández\n\t\tSales Representative\n\t\t(5) 552-3745\n\t\t(5) 545-3745\n\t\t\n\t\t\t
    Calle Dr. Jorge Cash 321
    \n\t\t\tMéxico D.F.\n\t\t\t05033\n\t\t\tMexico\n\t\t
    \n\t
    \n\t\tPiccolo und mehr\n\t\tGeorg Pipps\n\t\tSales Manager\n\t\t6562-9722\n\t\t6562-9723\n\t\t\n\t\t\t
    Geislweg 14
    \n\t\t\tSalzburg\n\t\t\t5020\n\t\t\tAustria\n\t\t
    \n\t
    \n\t\tPrincesa Isabel Vinhos\n\t\tIsabel de Castro\n\t\tSales Representative\n\t\t(1) 356-5634\n\t\t\n\t\t\t
    Estrada da saúde n. 58
    \n\t\t\tLisboa\n\t\t\t1756\n\t\t\tPortugal\n\t\t
    \n\t
    \n\t\tQue Delícia\n\t\tBernardo Batista\n\t\tAccounting Manager\n\t\t(21) 555-4252\n\t\t(21) 555-4545\n\t\t\n\t\t\t
    Rua da Panificadora, 12
    \n\t\t\tRio de Janeiro\n\t\t\tRJ\n\t\t\t02389-673\n\t\t\tBrazil\n\t\t
    \n\t
    \n\t\tQueen Cozinha\n\t\tLúcia Carvalho\n\t\tMarketing Assistant\n\t\t(11) 555-1189\n\t\t\n\t\t\t
    Alameda dos Canàrios, 891
    \n\t\t\tSao Paulo\n\t\t\tSP\n\t\t\t05487-020\n\t\t\tBrazil\n\t\t
    \n\t
    \n\t\tQUICK-Stop\n\t\tHorst Kloss\n\t\tAccounting Manager\n\t\t0372-035188\n\t\t\n\t\t\t
    Taucherstraße 10
    \n\t\t\tCunewalde\n\t\t\t01307\n\t\t\tGermany\n\t\t
    \n\t
    \n\t\tRancho grande\n\t\tSergio Gutiérrez\n\t\tSales Representative\n\t\t(1) 123-5555\n\t\t(1) 123-5556\n\t\t\n\t\t\t
    Av. del Libertador 900
    \n\t\t\tBuenos Aires\n\t\t\t1010\n\t\t\tArgentina\n\t\t
    \n\t
    \n\t\tRattlesnake Canyon Grocery\n\t\tPaula Wilson\n\t\tAssistant Sales Representative\n\t\t(505) 555-5939\n\t\t(505) 555-3620\n\t\t\n\t\t\t
    2817 Milton Dr.
    \n\t\t\tAlbuquerque\n\t\t\tNM\n\t\t\t87110\n\t\t\tUSA\n\t\t
    \n\t
    \n\t\tReggiani Caseifici\n\t\tMaurizio Moroni\n\t\tSales Associate\n\t\t0522-556721\n\t\t0522-556722\n\t\t\n\t\t\t
    Strada Provinciale 124
    \n\t\t\tReggio Emilia\n\t\t\t42100\n\t\t\tItaly\n\t\t
    \n\t
    \n\t\tRicardo Adocicados\n\t\tJanete Limeira\n\t\tAssistant Sales Agent\n\t\t(21) 555-3412\n\t\t\n\t\t\t
    Av. Copacabana, 267
    \n\t\t\tRio de Janeiro\n\t\t\tRJ\n\t\t\t02389-890\n\t\t\tBrazil\n\t\t
    \n\t
    \n\t\tRichter Supermarkt\n\t\tMichael Holz\n\t\tSales Manager\n\t\t0897-034214\n\t\t\n\t\t\t
    Grenzacherweg 237
    \n\t\t\tGenève\n\t\t\t1203\n\t\t\tSwitzerland\n\t\t
    \n\t
    \n\t\tRomero y tomillo\n\t\tAlejandra Camino\n\t\tAccounting Manager\n\t\t(91) 745 6200\n\t\t(91) 745 6210\n\t\t\n\t\t\t
    Gran Vía, 1
    \n\t\t\tMadrid\n\t\t\t28001\n\t\t\tSpain\n\t\t
    \n\t
    \n\t\tSanté Gourmet\n\t\tJonas Bergulfsen\n\t\tOwner\n\t\t07-98 92 35\n\t\t07-98 92 47\n\t\t\n\t\t\t
    Erling Skakkes gate 78
    \n\t\t\tStavern\n\t\t\t4110\n\t\t\tNorway\n\t\t
    \n\t
    \n\t\tSave-a-lot Markets\n\t\tJose Pavarotti\n\t\tSales Representative\n\t\t(208) 555-8097\n\t\t\n\t\t\t
    187 Suffolk Ln.
    \n\t\t\tBoise\n\t\t\tID\n\t\t\t83720\n\t\t\tUSA\n\t\t
    \n\t
    \n\t\tSeven Seas Imports\n\t\tHari Kumar\n\t\tSales Manager\n\t\t(171) 555-1717\n\t\t(171) 555-5646\n\t\t\n\t\t\t
    90 Wadhurst Rd.
    \n\t\t\tLondon\n\t\t\tOX15 4NB\n\t\t\tUK\n\t\t
    \n\t
    \n\t\tSimons bistro\n\t\tJytte Petersen\n\t\tOwner\n\t\t31 12 34 56\n\t\t31 13 35 57\n\t\t\n\t\t\t
    Vinbæltet 34
    \n\t\t\tKobenhavn\n\t\t\t1734\n\t\t\tDenmark\n\t\t
    \n\t
    \n\t\tSpécialités du monde\n\t\tDominique Perrier\n\t\tMarketing Manager\n\t\t(1) 47.55.60.10\n\t\t(1) 47.55.60.20\n\t\t\n\t\t\t
    25, rue Lauriston
    \n\t\t\tParis\n\t\t\t75016\n\t\t\tFrance\n\t\t
    \n\t
    \n\t\tSplit Rail Beer & Ale\n\t\tArt Braunschweiger\n\t\tSales Manager\n\t\t(307) 555-4680\n\t\t(307) 555-6525\n\t\t\n\t\t\t
    P.O. Box 555
    \n\t\t\tLander\n\t\t\tWY\n\t\t\t82520\n\t\t\tUSA\n\t\t
    \n\t
    \n\t\tSuprêmes délices\n\t\tPascale Cartrain\n\t\tAccounting Manager\n\t\t(071) 23 67 22 20\n\t\t(071) 23 67 22 21\n\t\t\n\t\t\t
    Boulevard Tirou, 255
    \n\t\t\tCharleroi\n\t\t\tB-6000\n\t\t\tBelgium\n\t\t
    \n\t
    \n\t\tThe Big Cheese\n\t\tLiz Nixon\n\t\tMarketing Manager\n\t\t(503) 555-3612\n\t\t\n\t\t\t
    89 Jefferson Way Suite 2
    \n\t\t\tPortland\n\t\t\tOR\n\t\t\t97201\n\t\t\tUSA\n\t\t
    \n\t
    \n\t\tThe Cracker Box\n\t\tLiu Wong\n\t\tMarketing Assistant\n\t\t(406) 555-5834\n\t\t(406) 555-8083\n\t\t\n\t\t\t
    55 Grizzly Peak Rd.
    \n\t\t\tButte\n\t\t\tMT\n\t\t\t59801\n\t\t\tUSA\n\t\t
    \n\t
    \n\t\tToms Spezialitäten\n\t\tKarin Josephs\n\t\tMarketing Manager\n\t\t0251-031259\n\t\t0251-035695\n\t\t\n\t\t\t
    Luisenstr. 48
    \n\t\t\tMünster\n\t\t\t44087\n\t\t\tGermany\n\t\t
    \n\t
    \n\t\tTortuga Restaurante\n\t\tMiguel Angel Paolino\n\t\tOwner\n\t\t(5) 555-2933\n\t\t\n\t\t\t
    Avda. Azteca 123
    \n\t\t\tMéxico D.F.\n\t\t\t05033\n\t\t\tMexico\n\t\t
    \n\t
    \n\t\tTradição Hipermercados\n\t\tAnabela Domingues\n\t\tSales Representative\n\t\t(11) 555-2167\n\t\t(11) 555-2168\n\t\t\n\t\t\t
    Av. Inês de Castro, 414
    \n\t\t\tSao Paulo\n\t\t\tSP\n\t\t\t05634-030\n\t\t\tBrazil\n\t\t
    \n\t
    \n\t\tTrail's Head Gourmet Provisioners\n\t\tHelvetius Nagy\n\t\tSales Associate\n\t\t(206) 555-8257\n\t\t(206) 555-2174\n\t\t\n\t\t\t
    722 DaVinci Blvd.
    \n\t\t\tKirkland\n\t\t\tWA\n\t\t\t98034\n\t\t\tUSA\n\t\t
    \n\t
    \n\t\tVaffeljernet\n\t\tPalle Ibsen\n\t\tSales Manager\n\t\t86 21 32 43\n\t\t86 22 33 44\n\t\t\n\t\t\t
    Smagsloget 45
    \n\t\t\tÅrhus\n\t\t\t8200\n\t\t\tDenmark\n\t\t
    \n\t
    \n\t\tVictuailles en stock\n\t\tMary Saveley\n\t\tSales Agent\n\t\t78.32.54.86\n\t\t78.32.54.87\n\t\t\n\t\t\t
    2, rue du Commerce
    \n\t\t\tLyon\n\t\t\t69004\n\t\t\tFrance\n\t\t
    \n\t
    \n\t\tVins et alcools Chevalier\n\t\tPaul Henriot\n\t\tAccounting Manager\n\t\t26.47.15.10\n\t\t26.47.15.11\n\t\t\n\t\t\t
    59 rue de l'Abbaye
    \n\t\t\tReims\n\t\t\t51100\n\t\t\tFrance\n\t\t
    \n\t
    \n\t\tDie Wandernde Kuh\n\t\tRita Müller\n\t\tSales Representative\n\t\t0711-020361\n\t\t0711-035428\n\t\t\n\t\t\t
    Adenauerallee 900
    \n\t\t\tStuttgart\n\t\t\t70563\n\t\t\tGermany\n\t\t
    \n\t
    \n\t\tWartian Herkku\n\t\tPirkko Koskitalo\n\t\tAccounting Manager\n\t\t981-443655\n\t\t981-443655\n\t\t\n\t\t\t
    Torikatu 38
    \n\t\t\tOulu\n\t\t\t90110\n\t\t\tFinland\n\t\t
    \n\t
    \n\t\tWellington Importadora\n\t\tPaula Parente\n\t\tSales Manager\n\t\t(14) 555-8122\n\t\t\n\t\t\t
    Rua do Mercado, 12
    \n\t\t\tResende\n\t\t\tSP\n\t\t\t08737-363\n\t\t\tBrazil\n\t\t
    \n\t
    \n\t\tWhite Clover Markets\n\t\tKarl Jablonski\n\t\tOwner\n\t\t(206) 555-4112\n\t\t(206) 555-4115\n\t\t\n\t\t\t
    305 - 14th Ave. S. Suite 3B
    \n\t\t\tSeattle\n\t\t\tWA\n\t\t\t98128\n\t\t\tUSA\n\t\t
    \n\t
    \n\t\tWilman Kala\n\t\tMatti Karttunen\n\t\tOwner/Marketing Assistant\n\t\t90-224 8858\n\t\t90-224 8858\n\t\t\n\t\t\t
    Keskuskatu 45
    \n\t\t\tHelsinki\n\t\t\t21240\n\t\t\tFinland\n\t\t
    \n\t
    \n\t\tWolski Zajazd\n\t\tZbyszek Piestrzeniewicz\n\t\tOwner\n\t\t(26) 642-7012\n\t\t(26) 642-7012\n\t\t\n\t\t\t
    ul. Filtrowa 68
    \n\t\t\tWarszawa\n\t\t\t01-012\n\t\t\tPoland\n\t\t
    \n\t
    ", false) ); } /** * Parent of attribute node. */ @org.junit.Test public void axes086() { final XQuery query = new XQuery( " {//@*/..} ", ctx); try { query.context(node(file("prod/AxisStep/Tree1Text.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("
    Text in center
    Text in east
    ", false) ); } /** * Parent of text nodes. */ @org.junit.Test public void axes087() { final XQuery query = new XQuery( " {/doc/part/*/text()/..} ", ctx); try { query.context(node(file("prod/AxisStep/xq311B.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("62.50 USD55.00 USD31.25 USD", false) ); } /** * Empty step, should result in parse error. */ @org.junit.Test public void axes088() { final XQuery query = new XQuery( "/*/", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * XQuery program to perform a knight's tour of the chessboard.Author: Michael H. KayThis version modified to use XQuery 1.0, with sequences and functions.This query does not use a source document.There is an optional parameter, start, which can be set to any square on thechessboard, e.g. a3 or h5. XQuery does not allow parameters to be given adefault value, so the parameter is mandatory.There is a second optional parameter, end, which indicates that the processing should stopafter a given number of steps. This can be used to animate the display of the tour. Thisworks especially well when the query is compiled into a Java servlet.The output is an HTML display of the completed tour.Internally, the following data representations are used:* A square on the chessboard: represented as a number in the range 0 to 63* A state of the chessboard: a sequence of 64 integers, each containing a move number.A square that has not been visited yet is represented by a zero.* A set of possible moves: represented as a sequence of integers,* each integer representing the number of the destination squarestart-column is an integer in the range 0-7start-row is an integer in the range 0-7, with zero at the topThis function controls the processing. It does not access the source document.Validate the input parameterSet up the empty boardPlace the knight on the board at the chosen starting positionEvaluate the knight's tourproduce the HTML outputrange 0 to 63This function places a knight on the board at a given square. The returned value isthe supplied board, modified to indicate that the knight reached a given square at a givenmoverange 0 to 63This function takes the board in a given state, decides on the next move to make,and then calls itself recursively to make further moves, until the knight has completedhis tour of the board. It returns the board in its final state.determine the possible moves that the knight can maketry these moves in turn until one is found that worksrange 0 to 63This function tries a set of possible moves that the knight can makefrom a given position. It determines the best move as the one to the square withfewest exits. If this is unsuccessful then it can backtrack andtry another move; however this turns out rarely to be necessary.The function makes the selected move, and then calls make-moves() to makesubsequent moves, returning the final state of the board.if there is no possible move, we return the special value () as the final stateof the board, to indicate to the caller that we got stuckrange 0 to 63this function, given the state of the board and a set of possible moves,determines which of the moves is the best one. It then makes this move,and proceeds recursively to make further moves, eventually returning thefinal state of the board.if at least one move is possible, find the best onefind the list of possible moves excluding the best oneupdate the board to make the move chosen as the best onenow make further moves using a recursive call, until the board is completecount($next-board[.=0])!=0if the final board has the special value '()', we got stuck, and have to choosethe next best of the possible moves. This is done by a recursive call. I thoughtthat the knight never did get stuck, but it does: if the starting square is f1,the wrong choice is made at move 58, and needs to be reversed.This function finds from among the possible moves, the one with fewest exits.It calls itself recursively.split the list of possible moves into the first move and the rest of the movestry making the first movesee how many moves would be possible the next timedetermine whether this trial move has fewer exits than those considered up till nowdetermine which is the best move (the one with fewest exits) so farif there are other possible moves, consider them too, using a recursive call.Otherwise return the best move found.This function, given the knight's position on the board, returns the set of squareshe can move to. The squares will be ones that have not been visited beforeOutput the board in HTML format. */ @org.junit.Test public void axes089() { final XQuery query = new XQuery( "xquery version \"1.0\"; declare namespace saxon=\"http://example.com/VendorNamespace\"; declare namespace tour=\"http://example.com/Knight'sTour\"; (: XQuery program to perform a knight's tour of the chessboard. Author: Michael H. Kay Date: 26 June 2003 This version modified to use XQuery 1.0, with sequences and functions. This query does not use a source document. There is an optional parameter, start, which can be set to any square on the chessboard, e.g. a3 or h5. XQuery does not allow parameters to be given a default value, so the parameter is mandatory. There is a second optional parameter, end, which indicates that the processing should stop after a given number of steps. This can be used to animate the display of the tour. This works especially well when the query is compiled into a Java servlet. The output is an HTML display of the completed tour. Internally, the following data representations are used: * A square on the chessboard: represented as a number in the range 0 to 63 * A state of the chessboard: a sequence of 64 integers, each containing a move number. A square that has not been visited yet is represented by a zero. * A set of possible moves: represented as a sequence of integers, * each integer representing the number of the destination square :) declare option saxon:default \"'a1'\"; declare variable $start as xs:string := 'a1'; declare option saxon:default \"'64'\"; declare variable $end as xs:string := '64'; declare variable $endd as xs:integer := xs:integer($end); declare variable $start-column as xs:integer := xs:integer(translate(substring($start, 1, 1), 'abcdefgh', '01234567')); declare variable $start-row as xs:integer := 8 - xs:integer(substring($start, 2, 1)); declare function tour:main () as element() { if (not(string-length($start)=2) or not(translate(substring($start,1,1), 'abcdefgh', 'aaaaaaaa')='a') or not(translate(substring($start,2,1), '12345678', '11111111')='1')) then error((), \"Invalid start parameter: try say 'a1' or 'g6'\") else if (not($endd = 1 to 64)) then error((), \"Invalid end parameter: must be in range 1 to 64\") else let $empty-board as xs:integer* := for $i in (1 to 64) return 0 let $initial-board as xs:integer* := tour:place-knight(1, $empty-board, $start-row * 8 + $start-column) let $final-board as xs:integer* := tour:make-moves(2, $initial-board, $start-row * 8 + $start-column) return tour:print-board($final-board) }; declare function tour:place-knight ( $move as xs:integer, $board as xs:integer*, $square as xs:integer ) as xs:integer* { (: This function places a knight on the board at a given square. The returned value is the supplied board, modified to indicate that the knight reached a given square at a given move :) for $i in 1 to 64 return if ($i = $square + 1) then $move else $board[$i] }; declare function tour:make-moves ( $move as xs:integer, $board as xs:integer*, $square as xs:integer ) as xs:integer* { (: This function takes the board in a given state, decides on the next move to make, and then calls itself recursively to make further moves, until the knight has completed his tour of the board. It returns the board in its final state. :) let $possible-move-list as xs:integer* := tour:list-possible-moves($board, $square) return tour:try-possible-moves($move, $board, $square, $possible-move-list) }; declare function tour:try-possible-moves ( $move as xs:integer, $board as xs:integer*, $square as xs:integer, $possible-moves as xs:integer* ) as xs:integer* { (: This function tries a set of possible moves that the knight can make from a given position. It determines the best move as the one to the square with fewest exits. If this is unsuccessful then it can backtrack and try another move; however this turns out rarely to be necessary. The function makes the selected move, and then calls make-moves() to make subsequent moves, returning the final state of the board. :) if (count($possible-moves)!=0) then tour:make-best-move($move, $board, $square, one-or-more($possible-moves)) else () (: if there is no possible move, we return the special value () as the final state of the board, to indicate to the caller that we got stuck :) }; declare function tour:make-best-move ( $move as xs:integer, $board as xs:integer*, $square as xs:integer, $possible-moves as xs:integer+ ) as xs:integer* { (: this function, given the state of the board and a set of possible moves, determines which of the moves is the best one. It then makes this move, and proceeds recursively to make further moves, eventually returning the final state of the board. :) let $best-move as xs:integer := tour:find-best-move($board, $possible-moves, 9, 999) let $other-possible-moves as xs:integer* := $possible-moves[. != $best-move] let $next-board as xs:integer* := tour:place-knight($move, $board, $best-move) let $final-board as xs:integer* := if ($move < $endd) then tour:make-moves($move+1, $next-board, $best-move) else $next-board (: if the final board has the special value '()', we got stuck, and have to choose the next best of the possible moves. This is done by a recursive call. I thought that the knight never did get stuck, but it does: if the starting square is f1, the wrong choice is made at move 58, and needs to be reversed. :) return if (empty($final-board)) then tour:try-possible-moves($move, $board, $square, $other-possible-moves) else $final-board }; declare function tour:find-best-move ( $board as xs:integer*, $possible-moves as xs:integer+, $fewest-exits as xs:integer, $best-so-far as xs:integer ) as xs:integer { (: This function finds from among the possible moves, the one with fewest exits. It calls itself recursively. :) let $trial-move as xs:integer := $possible-moves[1] let $other-possible-moves as xs:integer* := $possible-moves[position() > 1] let $trial-board as xs:integer* := tour:place-knight(99, $board, $trial-move) let $trial-move-exit-list as xs:integer* := tour:list-possible-moves($trial-board, $trial-move) let $number-of-exits as xs:integer := count($trial-move-exit-list) let $minimum-exits as xs:integer := min(($number-of-exits, $fewest-exits)) let $new-best-so-far as xs:integer := if ($number-of-exits < $fewest-exits) then $trial-move else $best-so-far (: if there are other possible moves, consider them too, using a recursive call. Otherwise return the best move found. :) return if (count($other-possible-moves)!=0) then tour:find-best-move($board, one-or-more($other-possible-moves), $minimum-exits, $new-best-so-far) else $new-best-so-far }; declare function tour:list-possible-moves ( $board as xs:integer*, $square as xs:integer ) as xs:integer* { (: This function, given the knight's position on the board, returns the set of squares he can move to. The squares will be ones that have not been visited before :) let $row as xs:integer := $square idiv 8 let $column as xs:integer := $square mod 8 return (if ($row > 1 and $column > 0 and $board[($square - 17) + 1]=0) then $square - 17 else (), if ($row > 1 and $column < 7 and $board[($square - 15) + 1]=0) then $square - 15 else (), if ($row > 0 and $column > 1 and $board[($square - 10) + 1]=0) then $square - 10 else (), if ($row > 0 and $column < 6 and $board[($square - 6) + 1]=0) then $square - 6 else (), if ($row < 6 and $column > 0 and $board[($square + 15) + 1]=0) then $square + 15 else (), if ($row < 6 and $column < 7 and $board[($square + 17) + 1]=0) then $square + 17 else (), if ($row < 7 and $column > 1 and $board[($square + 6) + 1]=0) then $square + 6 else (), if ($row < 7 and $column < 6 and $board[($square + 10) + 1]=0) then $square + 10 else () ) }; declare function tour:print-board ( $board as xs:integer* ) as element() { Knight's tour

    Knight's tour starting at {$start}

    {for $row in 0 to 7 return {for $column in 0 to 7 let $color := if ((($row + $column) mod 2)=1) then 'xffff44' else 'white' return } }
    { let $n := $board[$row * 8 + $column + 1] return if ($endd != 64 and $n = $endd) then {$n} else if ($n = 0) then \" \" else $n }

    { if ($endd != 64) then Step else () }

    }; tour:main()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Knight's tour

    Knight's tour starting at a1

    3619225389247
    21437422363910
    183520494441825
    350434655621140
    3417545948452663
    512475661582912
    1633605314316427
    152153257281330

    ", false) ); } /** * Self axis on exactly one element node with name test that does not match.. */ @org.junit.Test public void axes090() { final XQuery query = new XQuery( "let $element as element(foo) := return count($element/self::bar)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Self axis on exactly one element node with local name test that does not match.. */ @org.junit.Test public void axes091() { final XQuery query = new XQuery( "let $element as element(foo) := return count($element/self::*:bar)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Self axis on exactly one element node with namespace test that does not match.. */ @org.junit.Test public void axes092() { final XQuery query = new XQuery( "declare namespace ns1 = \"http://www.example.org/ns1\"; declare namespace ns2 = \"http://www.example.org/ns2\"; let $element as element(ns1:foo) := return count($element/self::ns2:*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Self axis on exactly one attribute node with name test that does not match.. */ @org.junit.Test public void axes093() { final XQuery query = new XQuery( "let $attribute as attribute(foo) := attribute foo { } return count($attribute/self::bar)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Self axis on exactly one attribute node with local name test that does not match.. */ @org.junit.Test public void axes094() { final XQuery query = new XQuery( "let $attribute as attribute(foo) := attribute foo { } \n" + " return count($attribute/self::*:bar)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Self axis on exactly one attribute node with namespace test that does not match.. */ @org.junit.Test public void axes095() { final XQuery query = new XQuery( "\n" + " declare namespace ns1 = \"http://www.example.org/ns1\"; \n" + " declare namespace ns2 = \"http://www.example.org/ns2\"; \n" + " let $attribute as attribute(ns1:foo) := attribute ns1:foo { } \n" + " return count($attribute/self::ns2:*)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Self axis on exactly one element node with name test that does not match.. */ @org.junit.Test public void axes096() { final XQuery query = new XQuery( "let $element as element(*) := return count($element/self::bar)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Self axis on exactly one element node with local name test that does not match.. */ @org.junit.Test public void axes097() { final XQuery query = new XQuery( "let $element as element(*) := return count($element/self::*:bar)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Self axis on exactly one element node with namespace test that does not match.. */ @org.junit.Test public void axes098() { final XQuery query = new XQuery( "\n" + " declare namespace ns1 = \"http://www.example.org/ns1\"; \n" + " declare namespace ns2 = \"http://www.example.org/ns2\"; \n" + " let $element as element(*) := \n" + " return count($element/self::ns2:*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Self axis on exactly one attribute node with name test that does not match.. */ @org.junit.Test public void axes099() { final XQuery query = new XQuery( "let $attribute as attribute(*) := attribute foo { } return count($attribute/self::bar)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Self axis on exactly one attribute node with local name test that does not match.. */ @org.junit.Test public void axes100() { final XQuery query = new XQuery( "let $attribute as attribute(*) := attribute foo { } return count($attribute/self::*:bar)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Self axis on exactly one attribute node with namespace test that does not match.. */ @org.junit.Test public void axes101() { final XQuery query = new XQuery( "\n" + " declare namespace ns1 = \"http://www.example.org/ns1\"; \n" + " declare namespace ns2 = \"http://www.example.org/ns2\"; \n" + " let $attribute as attribute(*) := attribute ns1:foo { } \n" + " return count($attribute/self::ns2:*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Assert that the static type of a wild name test on an element with a type annotation is computed correctly.. */ @org.junit.Test public void axes102() { final XQuery query = new XQuery( "\n" + " declare namespace ns1 = \"http://www.example.org/ns1\"; \n" + " declare namespace ns2 = \"http://www.example.org/ns2\"; \n" + " declare construction strip; \n" + " let $element as element(*, xs:untyped) := test \n" + " let $element as element(*, xs:untyped) := $element/self::* \n" + " return count($element)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Wild name test on a comment node.. */ @org.junit.Test public void axes103() { final XQuery query = new XQuery( "let $comment as comment() := return count($comment/self::*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Name test on a comment node.. */ @org.junit.Test public void axes104() { final XQuery query = new XQuery( "let $comment as comment() := return count($comment/self::foo)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Local name test on a comment node.. */ @org.junit.Test public void axes105() { final XQuery query = new XQuery( "let $comment as comment() := return count($comment/self::*:foo)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Namespace test on a comment node.. */ @org.junit.Test public void axes106() { final XQuery query = new XQuery( "\n" + " declare namespace ns1 = \"http://www.example.org/ns1\"; \n" + " let $comment as comment() := \n" + " return count($comment/self::ns1:*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Wild name test on a processing instruction node.. */ @org.junit.Test public void axes107() { final XQuery query = new XQuery( "\n" + " let $processing-instruction as processing-instruction() := \n" + " return count($processing-instruction/self::*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Name test on a processing instruction node.. */ @org.junit.Test public void axes108() { final XQuery query = new XQuery( "\n" + " let $processing-instruction as processing-instruction() := \n" + " return count($processing-instruction/self::processing)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Local name test on a processing instruction node.. */ @org.junit.Test public void axes109() { final XQuery query = new XQuery( "\n" + " let $processing-instruction as processing-instruction() := \n" + " return count($processing-instruction/self::*:processing)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * namespacs test on a processing instruction node.. */ @org.junit.Test public void axes110() { final XQuery query = new XQuery( "\n" + " declare namespace ns1 = \"http://www.example.org/ns1\"; \n" + " let $processing-instruction as processing-instruction() := \n" + " return count($processing-instruction/self::ns1:*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Assert that the static type of a wild name test on an attribute with a type annotation is computed correctly.. */ @org.junit.Test public void axes111() { final XQuery query = new XQuery( "\n" + " declare namespace ns1 = \"http://www.example.org/ns1\"; \n" + " declare namespace ns2 = \"http://www.example.org/ns2\"; declare construction strip; \n" + " let $element as element(*, xs:untyped) := \n" + " let $attribute as attribute(*, xs:untypedAtomic)* := $element/attribute::* \n" + " return count($attribute)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * The namespace axis is not recognized in XQuery.. */ @org.junit.Test public void axes112() { final XQuery query = new XQuery( "/*/namespace-node()", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Use kind-test namespace-node() in an axis step for the attribute axis. Note: applies to both XPath and XQuery.. */ @org.junit.Test public void axes115() { final XQuery query = new XQuery( "/*/attribute::namespace-node()", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Use kind-test namespace-node() with the self axis. */ @org.junit.Test public void axes117() { final XQuery query = new XQuery( "namespace {\"xsl\"}{\"http://www.w3.org/1999/XSL/Transform\"} / self::namespace-node()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertCount(1) && assertType("namespace-node()") && assertStringValue(false, "http://www.w3.org/1999/XSL/Transform") && assertQuery("name($result) = \"xsl\"") ) ); } /** * The namespace axis is not recognized in XQuery. The namespace-node() kind test is new in XQuery 3.0.. */ @org.junit.Test public void axes127() { xquery10(); final XQuery query = new XQuery( "/*/namespace-node()", ctx); try { query.context(node(file("prod/AxisStep/TreeTrunc.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A complex set of root path expressions.. */ @org.junit.Test public void k2Axes1() { final XQuery query = new XQuery( "declare variable $var := document{f's value}; $var/(/)/(/)//f", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("f's value", false) ); } /** * A comment can't appear between the ncname and the colon.a comment. */ @org.junit.Test public void k2Axes10() { final XQuery query = new XQuery( "name(:hey:):*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Do a peculiar combination between axis self and last().. */ @org.junit.Test public void k2Axes100() { final XQuery query = new XQuery( "empty( [self::b][last()])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Do a peculiar combination between axis self and last().. */ @org.junit.Test public void k2Axes101() { final XQuery query = new XQuery( "[self::b][last()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("", false) || error("XPST0005") ) ); } /** * Execute a query in several different ways.. */ @org.junit.Test public void k2Axes102() { final XQuery query = new XQuery( "\n" + " for $a in (/) return \n" + " for $b in $a/child::site return \n" + " for $c in $b/child::people return \n" + " for $d in $c/child::person return \n" + " if ((some $id in $d/attribute::id satisfies \n" + " typeswitch ($id)\n" + " case $n as node() return $id = \"person0\"\n" + " default $d return ())) \n" + " then $d/child::name \n" + " else (), \n" + " for $b in /site/people/person where $b/@id=\"person0\" return $b/name, \n" + " /site/people/person[@id eq \"person0\"]/name", ctx); try { query.context(node(file("app/XMark/XMarkAuction.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Seongtaek MatternSeongtaek MatternSeongtaek Mattern", false) ); } /** * Combine a function call with paths that requires sorting.. */ @org.junit.Test public void k2Axes103() { final XQuery query = new XQuery( "\n" + " declare function local:isComplexType($typeID) { string($typeID) }; \n" + " \"|\", //*/local:isComplexType(@type), \"|\"", ctx); try { query.context(node(file("prod/AxisStep/CPPGlobals.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "| _17 _17 _11c _11c _11 _11 _17c _17c _17 _17 _11 _23 _17 _11c |") ); } /** * Use the focus from within an element constructor.. */ @org.junit.Test public void k2Axes104() { final XQuery query = new XQuery( "/{.}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Whitespace can't appear between the wildcard and the colon.. */ @org.junit.Test public void k2Axes11() { final XQuery query = new XQuery( "* :ncname", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Whitespace can't appear between the wildcard and the colon.. */ @org.junit.Test public void k2Axes12() { final XQuery query = new XQuery( "ncname: *", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A comment can't appear between the wildcard and the colon.a comment. */ @org.junit.Test public void k2Axes13() { final XQuery query = new XQuery( "*(:hey:):ncname", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A comment can't appear between the wildcard and the colon.a comment. */ @org.junit.Test public void k2Axes14() { final XQuery query = new XQuery( "ncname:(:hey:)*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Whitespace can't appear between the wildcard, colon and ncname.. */ @org.junit.Test public void k2Axes15() { final XQuery query = new XQuery( "*(:hey:):(:hey:) ncname", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Comments can't appear between wildcards and ncnames.a commenta comment. */ @org.junit.Test public void k2Axes16() { final XQuery query = new XQuery( "*:(:hey:)ncname", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A nametest cannot with a colon.. */ @org.junit.Test public void k2Axes17() { final XQuery query = new XQuery( "*:", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Apply the parent axis to a computed text constructor.. */ @org.junit.Test public void k2Axes18() { final XQuery query = new XQuery( "empty(text {\"some text\"}/..)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Apply the parent axis to a computed processing instruction constructor.. */ @org.junit.Test public void k2Axes19() { final XQuery query = new XQuery( "empty(processing-instruction theName {\"some text\"}/..)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A complex set of root path expressions for where the context item is not a document node.. */ @org.junit.Test public void k2Axes2() { final XQuery query = new XQuery( "declare variable $var := f's value; $var/(/)/(/)//f", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0050") ); } /** * Apply the parent axis to a computed attribute constructor.. */ @org.junit.Test public void k2Axes20() { final XQuery query = new XQuery( "empty(attribute theName {\"some text\"}/..)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Apply the parent axis to a computed attribute constructor.. */ @org.junit.Test public void k2Axes21() { final XQuery query = new XQuery( "empty(element theName {\"some text\"}/..)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Apply the parent axis to a computed comment constructor.. */ @org.junit.Test public void k2Axes22() { final XQuery query = new XQuery( "empty(comment {\"some text\"}/..)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Apply the parent axis to a direct element constructor.. */ @org.junit.Test public void k2Axes23() { final XQuery query = new XQuery( "empty(/..)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Apply the parent axis to a direct element constructor's text-child.. */ @org.junit.Test public void k2Axes24() { final XQuery query = new XQuery( "some text/text()/..", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("some text", false) ); } /** * Apply the parent axis to a direct element constructor's text-child.. */ @org.junit.Test public void k2Axes25() { final XQuery query = new XQuery( "/b/..", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Apply the parent axis to a direct element constructor's attribute.. */ @org.junit.Test public void k2Axes26() { final XQuery query = new XQuery( "/@attr/..", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Apply the parent axis to a direct element constructor's processing-instruction-child.. */ @org.junit.Test public void k2Axes27() { final XQuery query = new XQuery( "/processing-instruction()/..", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Apply the parent axis to a direct element constructor's comment-child.. */ @org.junit.Test public void k2Axes28() { final XQuery query = new XQuery( "/comment()/..", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * No axis by name preceding-or-ancestor exists.. */ @org.junit.Test public void k2Axes29() { final XQuery query = new XQuery( "preceding-or-ancestor::*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Path expression where the last step in an xs:integer.. */ @org.junit.Test public void k2Axes3() { final XQuery query = new XQuery( "declare variable $v := ; deep-equal($v//45, (45, 45, 45, 45))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Apply axis '..' to the return value of fn:root().. */ @org.junit.Test public void k2Axes30() { final XQuery query = new XQuery( "empty(fn:root()/..)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Apply axis '..' to a directly constructed element.. */ @org.junit.Test public void k2Axes31() { final XQuery query = new XQuery( "empty(/..)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Apply axis '..' to the return value of fn:root().. */ @org.junit.Test public void k2Axes32() { final XQuery query = new XQuery( "declare variable $myVar := ; empty(fn:root($myVar/(/)/..))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") || error("XPDY0050") ) ); } /** * Apply axis '..' to a '/' step.. */ @org.junit.Test public void k2Axes33() { final XQuery query = new XQuery( "declare variable $myVar := document { }; empty($myVar/(/)/..)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * '//' at the end of a path expression is a syntax error.. */ @org.junit.Test public void k2Axes34() { final XQuery query = new XQuery( "nametest//", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XPDY0002") ) ); } /** * '/' at the end of a path expression is a syntax error.. */ @org.junit.Test public void k2Axes35() { final XQuery query = new XQuery( "nametest/", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XPDY0002") ) ); } /** * '/' at the end of a path expression is a syntax error(#2).. */ @org.junit.Test public void k2Axes36() { final XQuery query = new XQuery( "declare variable $myVar := ; $myVar/(/)/", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * 'self()' is an invalid note test.. */ @org.junit.Test public void k2Axes37() { final XQuery query = new XQuery( "parent::self()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * '..' inside a predicate where the context item is of wrong type.. */ @org.junit.Test public void k2Axes38() { final XQuery query = new XQuery( "123[..]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0020") ); } /** * 'element()' inside a predicate where the context item is of wrong type.. */ @org.junit.Test public void k2Axes39() { final XQuery query = new XQuery( "1[element()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0020") ); } /** * Path expression where the last step in an xs:integer(#2).. */ @org.junit.Test public void k2Axes4() { final XQuery query = new XQuery( "declare variable $v := ; $v//45", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "45 45 45 45") ); } /** * '..' inside a predicate where the context item is of wrong type(#2).. */ @org.junit.Test public void k2Axes40() { final XQuery query = new XQuery( "(1, )[..]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0020") ); } /** * '..' inside a predicate where the context item is of wrong type(#3).. */ @org.junit.Test public void k2Axes41() { final XQuery query = new XQuery( "(, 1)[..]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0020") ); } /** * Ensure a parent axis inside a predicate where the source is a direct element constructor, evaluate to the empty sequence.. */ @org.junit.Test public void k2Axes42() { final XQuery query = new XQuery( "empty([parent::node()])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure '5 * /' is parsed properly.. */ @org.junit.Test public void k2Axes43() { final XQuery query = new XQuery( "(1, 5 * /)[1]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1") || error("XPDY0002") ) ); } /** * Ensure '/' is parsed properly.. */ @org.junit.Test public void k2Axes44() { final XQuery query = new XQuery( "(1, /)[1]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1") || error("XPDY0002") ) ); } /** * Ensure '/' is parsed properly(#2).. */ @org.junit.Test public void k2Axes45() { final XQuery query = new XQuery( "(/, 1)[2]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1") || error("XPDY0002") ) ); } /** * '//' by itself is not a valid expression.. */ @org.junit.Test public void k2Axes46() { final XQuery query = new XQuery( "//", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Apply '/' to a variable.. */ @org.junit.Test public void k2Axes47() { final XQuery query = new XQuery( "declare variable $myVar := ; empty($myVar/descendant-or-self::text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Apply '/' to a variable, with an xs:integer at the end.. */ @org.junit.Test public void k2Axes48() { final XQuery query = new XQuery( "declare variable $myVar := ; $myVar/(, , , , attribute name {}, document {()})/3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3 3 3 3 3 3") ); } /** * Apply '/' to a variable, with fn:number() at the end. That is, an implicit dependency on the next-last step.. */ @org.junit.Test public void k2Axes49() { final XQuery query = new XQuery( "declare variable $myVar := ; $myVar/(, , , , attribute name {}, document {()})/number()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN NaN NaN NaN NaN NaN") ); } /** * Whitespace: comment can't appear between the ncname and the colon.. */ @org.junit.Test public void k2Axes5() { final XQuery query = new XQuery( "*:(:hey:)ncname", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * '1/3' is a type error.. */ @org.junit.Test public void k2Axes50() { final XQuery query = new XQuery( "1/3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0019") ); } /** * 'xs:string/3' is a type error.. */ @org.junit.Test public void k2Axes51() { final XQuery query = new XQuery( "string()/3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0019") ); } /** * A type error in a complex path expression. Some implementations may optimize away the error.. */ @org.junit.Test public void k2Axes52() { final XQuery query = new XQuery( "\n" + " declare variable $myVar := ; \n" + " empty($myVar/preceding-sibling::comment()/a/b/c/1/@*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") || error("XPTY0019") || error("XPTY0020") ) ); } /** * Many atomic values with predicates in a path expression.. */ @org.junit.Test public void k2Axes53() { final XQuery query = new XQuery( "(1, 2, 3)[1]/(1, 2)[last()]/\"a string\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0019") ); } /** * The namespace axis is not recognized in XQuery.. */ @org.junit.Test public void k2Axes54() { final XQuery query = new XQuery( "namespace::*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Apply the attribute axis to the empty sequence.. */ @org.junit.Test public void k2Axes55() { final XQuery query = new XQuery( "empty(()/@attr)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Apply the child axis to the empty sequence.. */ @org.junit.Test public void k2Axes56() { final XQuery query = new XQuery( "empty(()/name)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * The context item invokes sorting and duplicate elimination.. */ @org.junit.Test public void k2Axes57() { final XQuery query = new XQuery( "declare variable $var := ; ($var/*, $var/*)/.", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Content being duplicated with the comma operator... */ @org.junit.Test public void k2Axes58() { final XQuery query = new XQuery( "declare variable $var := ; ($var/*, $var/*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Evaluate the child node from the last node in a tree.. */ @org.junit.Test public void k2Axes59() { final XQuery query = new XQuery( "declare variable $i := ; 1, root($i)//leaf/child::node(), 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "1 1") || error("XPST0005") ) ); } /** * A comment can't appear between the ncname and the colon.a comment. */ @org.junit.Test public void k2Axes6() { final XQuery query = new XQuery( "*(:hey:):ncname", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Apply the child axis on a document whose last nodes are attributes.. */ @org.junit.Test public void k2Axes60() { final XQuery query = new XQuery( "empty(/*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Apply the child axis on an element that has attributes only.. */ @org.junit.Test public void k2Axes61() { final XQuery query = new XQuery( "empty(/*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Apply descendant-or-self to a node set constructed with element constructors.. */ @org.junit.Test public void k2Axes62() { final XQuery query = new XQuery( " /descendant-or-self::node()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Apply the child axis to an element who has one attribute, combined with the sequence iterator.. */ @org.junit.Test public void k2Axes63() { final XQuery query = new XQuery( "1, /child::node(), 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 1") ); } /** * Invoke the child axis on two elements with one attribute.. */ @org.junit.Test public void k2Axes64() { final XQuery query = new XQuery( " /b", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Invoke the child axis on two elements with one attribute.. */ @org.junit.Test public void k2Axes65() { final XQuery query = new XQuery( " /b", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Invoke the child axis on mixed content.. */ @org.junit.Test public void k2Axes66() { final XQuery query = new XQuery( " text /child::node()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("text", false) ); } /** * Apply the descendant axis on an element, as operand to the comma operator.. */ @org.junit.Test public void k2Axes67() { final XQuery query = new XQuery( "1, /descendant::node(), 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 1") ); } /** * Apply the descendant-or-self axis on an element, as operand to the comma operator.. */ @org.junit.Test public void k2Axes68() { final XQuery query = new XQuery( "1, /descendant-or-self::node(), 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("11", false) ); } /** * Apply the descendant axis on an element that has an attribute, as operand to the comma operator.. */ @org.junit.Test public void k2Axes69() { final XQuery query = new XQuery( "1, /descendant::node(), 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 1") ); } /** * Whitespace can't appear between the wildcard and the colon.. */ @org.junit.Test public void k2Axes7() { final XQuery query = new XQuery( "* :ncname", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Apply the descendant-or-self axis on an element that has an attribute, as operand to the comma operator.. */ @org.junit.Test public void k2Axes70() { final XQuery query = new XQuery( "1, /descendant-or-self::node(), 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("11", false) ); } /** * Apply function fn:empty() on the descendant axis applied on an element constructor.. */ @org.junit.Test public void k2Axes71() { final XQuery query = new XQuery( "empty(/descendant::node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Apply function fn:empty() on the descendant-or-self axis applied on an element constructor.. */ @org.junit.Test public void k2Axes72() { final XQuery query = new XQuery( "empty(/descendant-or-self::node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Apply function fn:empty() on the descendant axis applied on an element constructor that has an attribute.. */ @org.junit.Test public void k2Axes73() { final XQuery query = new XQuery( "empty(/descendant::node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Apply function fn:empty() on the descendant-or-self axis applied on an element constructor that has an attribute.. */ @org.junit.Test public void k2Axes74() { final XQuery query = new XQuery( "empty(/descendant-or-self::node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Combine axis descendant-or-self, function last() and axis ancestor.. */ @org.junit.Test public void k2Axes75() { final XQuery query = new XQuery( " /descendant-or-self::node()[last()]/ancestor::*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Combine axis descendant-or-self and function last().. */ @org.junit.Test public void k2Axes76() { final XQuery query = new XQuery( " /descendant-or-self::node()[last()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * There is no axis by name 'preceeding'.. */ @org.junit.Test public void k2Axes77() { final XQuery query = new XQuery( "preceeding::node()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Apply fn:count() to a set of nodes involving the parent axis.. */ @org.junit.Test public void k2Axes78() { final XQuery query = new XQuery( " //node()/../count(.)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Apply fn:count() to a set of nodes involving the descendant axis.. */ @org.junit.Test public void k2Axes79() { final XQuery query = new XQuery( "count( //node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * A comment can't appear between the wildcard and the colon.a comment. */ @org.junit.Test public void k2Axes8() { final XQuery query = new XQuery( "*(:hey:):ncname", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Apply fn:count() to a set of nodes involving the descendant axis.. */ @org.junit.Test public void k2Axes80() { final XQuery query = new XQuery( "count( /descendant-or-self::node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Ensure that an element name test after an attribute test matches.. */ @org.junit.Test public void k2Axes81() { final XQuery query = new XQuery( " /*[attribute::id eq \"person0\"]/c", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Ensure that an element name test after an attribute with abbreviated syntax test matches.. */ @org.junit.Test public void k2Axes82() { final XQuery query = new XQuery( " /*[@id eq \"person0\"]/c", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Simple parser test of the attribute() test appearing after the attribute axis.. */ @org.junit.Test public void k2Axes83() { final XQuery query = new XQuery( "empty(/attribute::attribute())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple parser test of the schema-attribute() test appearing after the attribute axis.. */ @org.junit.Test public void k2Axes84() { final XQuery query = new XQuery( "/attribute::schema-attribute(foo)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * The attribute name isn't optional.. */ @org.junit.Test public void k2Axes85() { final XQuery query = new XQuery( "/attribute::schema-attribute()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A significant set of path expressions with different combinations of source values, axes and node tests, * that always evaluate to the empty sequence, no matter what document structure that is being walked. * The list is not guaranteed to be exhaustive. Some implementations detect this and rewrite away such * combinations or warn the user about such constructs. Since static typing implementations may infer * these expressions to the empty sequence, they may raise XPST0005.attribute axis, and all other axes * that inference can assert might produce attributes. * . */ @org.junit.Test public void k2Axes86() { final XQuery query = new XQuery( "\n" + " declare variable $root as document-node() := . treat as document-node(); \n" + " { (: attribute axis, and all other axes that inference can assert might produce attributes. \n" + " These are placed first, so we don't raise XQTY0024. :) \n" + " $root/foo/child::attribute(foo), \n" + " $root//element()/self::attribute(), \n" + " $root//text()/self::attribute(), \n" + " $root/self::attribute(), \n" + " $root/foo/descendant::attribute(foo), \n" + " $root//processing-instruction()/self::attribute(), \n" + " $root/attribute(foo), $root/attribute(), \n" + " $root/attribute::attribute(), \n" + " $root//parent::attribute(), \n" + " $root//document-node()/self::attribute(), \n" + " $root/@*, $root/*/@*[self::*], \n" + " $root//comment()/descendant-or-self::attribute(), \n" + " $root//processing-instruction()/descendant-or-self::attribute(), \n" + " $root//text()/descendant-or-self::attribute(), \n" + " $root//document-node()/descendant-or-self::attribute(), \n" + " $root//parent::attribute(), \n" + " $root//ancestor::attribute(), \n" + " $root//ancestor-or-self::attribute(), \n" + " $root/self::attribute(), \n" + " $root//attribute()/child::node(), \n" + " $root//attribute::text(), \n" + " $root//attribute::comment(), \n" + " $root//attribute::processing-instruction(), \n" + " $root//attribute::document-node(), \n" + " $root//attribute::document-node(element(foo)),\n" + " $root//attribute()/self::text(),\n" + " $root//attribute()/self::processing-instruction(), \n" + " $root//attribute()/self::element(), \n" + " $root//attribute()/self::document-node(), \n" + " $root//attribute()/self::comment(), \n" + " $root//*/attribute()//node(), \n" + " $root//*/attribute()/descendant::node(), \n" + " $root//attribute::element(), \n" + " $root//comment()/child::node(), \n" + " $root//processing-instruction()/child::node(), \n" + " $root//text()/child::node(),\n" + " $root//attribute()/descendant::node(), \n" + " $root//comment()/descendant::node(), \n" + " $root//text()/descendant::node(), \n" + " $root//processing-instruction()/descendant::node(), \n" + " $root//comment()/descendant-or-self::text(), \n" + " $root//comment()/descendant-or-self::processing-instruction(), \n" + " $root//comment()/descendant-or-self::element(), \n" + " $root//comment()/descendant-or-self::document-node(), \n" + " $root//processing-instruction()/descendant-or-self::text(), \n" + " $root//processing-instruction()/descendant-or-self::comment(), \n" + " $root//processing-instruction()/descendant-or-self::element(), \n" + " $root//processing-instruction()/descendant-or-self::document-node(), \n" + " $root//text()/descendant-or-self::processing-instruction(), \n" + " $root//text()/descendant-or-self::comment(), \n" + " $root//text()/descendant-or-self::element(), \n" + " $root//text()/descendant-or-self::document-node(), \n" + " $root//attribute()/descendant-or-self::processing-instruction(), \n" + " $root//attribute()/descendant-or-self::text(), \n" + " $root//attribute()/descendant-or-self::comment(), \n" + " $root//attribute()/descendant-or-self::element(), \n" + " $root//attribute()/descendant-or-self::document-node(), \n" + " $root/.., $root//parent::comment(), \n" + " $root//parent::processing-instruction(), \n" + " $root//parent::text(), \n" + " $root//ancestor::comment(), \n" + " $root//ancestor::processing-instruction(), \n" + " $root//ancestor::text(), \n" + " $root/self::comment(), \n" + " $root/self::processing-instruction(), \n" + " $root/self::text(), \n" + " $root/self::element(), \n" + " $root//element()/self::text(), \n" + " $root//element()/self::processing-instruction(), \n" + " $root//element()/self::document-node(), \n" + " $root//element()/self::comment(), \n" + " $root//processing-instruction()/self::text(), \n" + " $root//processing-instruction()/self::element(), \n" + " $root//processing-instruction()/self::document-node(), \n" + " $root//processing-instruction()/self::comment(), \n" + " $root//text()/self::processing-instruction(), \n" + " $root//text()/self::element(), \n" + " $root//text()/self::document-node(), \n" + " $root//text()/self::comment(), \n" + " $root//document-node()/self::processing-instruction(), \n" + " $root//document-node()/self::element(), \n" + " $root//document-node()/self::text(), \n" + " $root//document-node()/self::comment() } , \n" + " exists($root//*/attribute()/descendant-or-self::node())", ctx); try { query.context(node(file("prod/AxisStep/TopMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("true", false) || error("XPST0005") ) ); } /** * Ensure node sorting is applied when the left operand is the result of the comma operator.. */ @org.junit.Test public void k2Axes87() { final XQuery query = new XQuery( " { 1 2 /(b, a)/. } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("12", false) ); } /** * Ensure node sorting is applied when the left operand is the result of the comma operator, while using variable references.. */ @org.junit.Test public void k2Axes88() { final XQuery query = new XQuery( "declare variable $i := 1 2 ; { ($i/b, $i/a)/. } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("12", false) ); } /** * Ensure attribute tests match, and that attributes are properly copied when combined with a default element namespace declaration.. */ @org.junit.Test public void k2Axes89() { final XQuery query = new XQuery( "declare default element namespace \"http://typedecl\"; { /@attr } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Whitespace can't appear between the ncname and the colon.. */ @org.junit.Test public void k2Axes9() { final XQuery query = new XQuery( "ncname :*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * An incorrectly ending QName.. */ @org.junit.Test public void k2Axes90() { final XQuery query = new XQuery( "prefix:", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * An incorrectly ending QName, with space.. */ @org.junit.Test public void k2Axes91() { final XQuery query = new XQuery( "prefix:", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Test parsing of 'gt'.. */ @org.junit.Test public void k2Axes92() { final XQuery query = new XQuery( "empty(/(gt gt gt))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPDY0002") ) ); } /** * Space is disallowed after the first angle bracket in a direct element constructor.. */ @org.junit.Test public void k2Axes93() { final XQuery query = new XQuery( "< asd />", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Use a single 'declare' nametest.. */ @org.junit.Test public void k2Axes94() { final XQuery query = new XQuery( "declare", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Use an invalid function declaration.. */ @org.junit.Test public void k2Axes95() { final XQuery query = new XQuery( "eclare function", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Use an invalid function declaration(#2).. */ @org.junit.Test public void k2Axes96() { final XQuery query = new XQuery( "declare function name", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Use an invalid function declaration(#3).. */ @org.junit.Test public void k2Axes97() { final XQuery query = new XQuery( "declare function local:foo() external;", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XPST0017") ) ); } /** * Use a set of reserved keywords as nametests.. */ @org.junit.Test public void k2Axes98() { final XQuery query = new XQuery( "xquery, version, encoding, default, declare, function, option, collation, schema, import", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Use an invalid function declaration(#3).. */ @org.junit.Test public void k2Axes99() { final XQuery query = new XQuery( "declare function foo() external; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQST0045") || error("XPST0017") ) ); } /** * Evaluation of a step axis, which operates on a non node context item.. */ @org.junit.Test public void axisErr1() { final XQuery query = new XQuery( "let $var := Some content return $var/20[child::text()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0020") ); } /** * Tests to child::attribute(b) . */ @org.junit.Test public void cbclChildAxis001() { final XQuery query = new XQuery( "count(/child::attribute(b))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Tests Equals method on NodeOperator tests . */ @org.junit.Test public void cbclExcept001() { final XQuery query = new XQuery( "\n" + " let $x := return count(($x/(node() except b) | $x/(node() except b)))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Tests for following-sibling::* . */ @org.junit.Test public void cbclFollowingAxis001() { final XQuery query = new XQuery( "count(/b[1]/following-sibling::*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * A test with both nodes and atomics appearing in a (not last) step . */ @org.junit.Test public void cbclPathNodesAndAtomics() { final XQuery query = new XQuery( "\n" + " declare function local:f($x) { if ($x mod 2 = 1) then else \"a\" };\n" + " let $y := for $x in (1 to 10) return {$x} return $y/local:f(.)/a", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0019") ); } /** * Tests for preceding-sibling::* . */ @org.junit.Test public void cbclPrecedingAxis001() { final XQuery query = new XQuery( "count(/b[2]/preceding-sibling::*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Test for preceding-sibling::b . */ @org.junit.Test public void cbclPrecedingAxis002() { final XQuery query = new XQuery( "count(/b[2]/preceding-sibling::b)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Test for preceding-sibling::b . */ @org.junit.Test public void cbclPrecedingAxis003() { final XQuery query = new XQuery( "count(/b[1]/preceding-sibling::b)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Tests self attribute test . */ @org.junit.Test public void cbclSelfAxis001() { final XQuery query = new XQuery( " { /@*/self::attribute(b) } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Tests Equals function on wild localname tests . */ @org.junit.Test public void cbclWild001() { final XQuery query = new XQuery( "\n" + " declare namespace foo=\"test\";\n" + " let $x := return count($x/foo:* | $x/foo:*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Tests the typing of a test foo:bar/foo:* . */ @org.junit.Test public void cbclWild002() { final XQuery query = new XQuery( "\n" + " declare namespace foo=\"http://localhost/\";\n" + " /foo:b/self::foo:*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Evaluation of static typing feature for the child axes. Context item not a node . */ @org.junit.Test public void statictypingaxis1() { final XQuery query = new XQuery( "(10)/child::*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0019") ); } /** * Evaluation of static typing feature for the self axes. Context item not a node . */ @org.junit.Test public void statictypingaxis2() { final XQuery query = new XQuery( "(10)/self::*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0019") ); } /** * Evaluation of static typing feature for the attribute axes. Context item not a node . */ @org.junit.Test public void statictypingaxis3() { final XQuery query = new XQuery( "(10)/attribute::*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0019") ); } /** * Evaluation of static typing feature for the parent axes. Context item not a node . */ @org.junit.Test public void statictypingaxis4() { final XQuery query = new XQuery( "(10)/parent::*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0019") ); } /** * Evaluation of static typing feature for the descendant axes. Context item not a node . */ @org.junit.Test public void statictypingaxis5() { final XQuery query = new XQuery( "(10)/descendant::*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0019") ); } /** * Evaluation of static typing feature for the descendant-or-self axes. Context item not a node . */ @org.junit.Test public void statictypingaxis6() { final XQuery query = new XQuery( "(10)/descendant-or-self::*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0019") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdAxisStepAbbr.java000066400000000000000000000337051222453003200304740ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Abbreviated axes: tests for the AxisStep production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdAxisStepAbbr extends QT3TestSet { /** * Focus is undefined inside user functions; '..' axis.. */ @org.junit.Test public void k2AbbrAxes1() { final XQuery query = new XQuery( "declare function local:myFunc() { .. }; local:myFunc()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Evaluates "hours". Selects the "hours" element children of the context node.. */ @org.junit.Test public void abbreviatedSyntax1() { final XQuery query = new XQuery( "for $h in (/works/employee[4]) return $h/hours/string()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "20 40") ); } /** * Evaluates "//hours". Selects all the hours descendants of the root document node and thus selects all hours elements in the same document as the context node.. */ @org.junit.Test public void abbreviatedSyntax10() { final XQuery query = new XQuery( "for $h in (/works) return $h//hours/string()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "40 70 20 80 20 40 20 30 12 40 80 20 20 20 40 80") ); } /** * Evaluates "//overtime/day". Selects all the day elements in the same document as the context node that have an overtime parent.. */ @org.junit.Test public void abbreviatedSyntax12() { final XQuery query = new XQuery( "for $h in (/works) return $h//overtime/day/string()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Monday Tuesday") ); } /** * Evaluates ".//day". Selects the day element descendants of the context node.. */ @org.junit.Test public void abbreviatedSyntax13() { final XQuery query = new XQuery( "for $h in (/works) return $h/.//day/string()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Monday Tuesday") ); } /** * Evaluates "..". Selects the parent of the context node.. */ @org.junit.Test public void abbreviatedSyntax14() { final XQuery query = new XQuery( "for $h in (/works/employee[12]/overtime) return $h/../@name", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "John Doe 12") ); } /** * Evaluates "employee[@name="Jane Doe 11"]". Selects all employee children of the context node that have a name attribute with a value "Jane Doe 11".. */ @org.junit.Test public void abbreviatedSyntax16() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[@name=\"Jane Doe 11\"]/@name", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 11") ); } /** * Evaluates "employee[@gender="female"][5]". Selects the fifth element child of the context node that has a gender attribute with value "female".. */ @org.junit.Test public void abbreviatedSyntax17() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[@gender=\"female\"][5]/@name", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 9") ); } /** * Evaluates "employee[5][@gender="female"]". Selects the fifth employee child of the context node if that child has a gender attribute with value "female".. */ @org.junit.Test public void abbreviatedSyntax18() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[5][@gender=\"female\"]/@name", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 5") ); } /** * Evaluates "employee[status="active"]". Selects the employee children of the context node that have one or more status children whose typed value is equal to the string "active".. */ @org.junit.Test public void abbreviatedSyntax19() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[status=\"active\"]/@name", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 13") ); } /** * Evaluates "text()". Selects all text node children of the context node.. */ @org.junit.Test public void abbreviatedSyntax2() { final XQuery query = new XQuery( "for $h in (/works/employee[2]) return $h/text()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "Text data from Employee[2]") ); } /** * Evaluates "employee[overtime]". Selects the employee children of the context node that have one or more overtime children.. */ @org.junit.Test public void abbreviatedSyntax20() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[overtime]/@name", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "John Doe 12") ); } /** * Evaluates "employee[@name and @type]". Selects all the employee children of the context node that have both a name attribute and a type attribute.. */ @org.junit.Test public void abbreviatedSyntax21() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[@name and @type]/@name", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 13") ); } /** * Evaluates "employee/(status|overtime)/day". Selects every day element that has a parent that is either a status or an overime element, that in turn is a child of an employee element that is a child of the context node.. */ @org.junit.Test public void abbreviatedSyntax22() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee/(status|overtime)/day/string()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Monday Tuesday") ); } /** * Evaluates "employee/(status|overtime)/day". * Selects every day element that has a parent that is either a status or an overime element, * that in turn is a child of an employee element that is a child of the context node. * Uses "union" Operator. */ @org.junit.Test public void abbreviatedSyntax24() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee/(status union overtime)/day/string()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Monday Tuesday") ); } /** * Evaluates "employee[@name = condition @type=condition]". * Selects all the employee children of the context node that have both a name attribute and a type attribute. * Uses "or" operator.. */ @org.junit.Test public void abbreviatedSyntax25() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[@name = \"Jane Doe 13\" or @type=\"FT\"]/@name", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 13") ); } /** * Use an expression that returns atomic values after "//". */ @org.junit.Test public void abbreviatedSyntax26() { final XQuery query = new XQuery( "let $in := ABCXYZ return $in//string-to-codepoints(.)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "65 66 67 88 89 90 65 66 67 65 66 67 88 89 90 88 89 90") ); } /** * Evaluates "@name". Selects the name attribute of the context node.. */ @org.junit.Test public void abbreviatedSyntax3() { final XQuery query = new XQuery( "for $h in (/works/employee[10]) return $h/@name", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "John Doe 10") ); } /** * Evaluates "employee[1]". Selects the first employee child of the context node.. */ @org.junit.Test public void abbreviatedSyntax5() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[1]/@name", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 1") ); } /** * Evaluates "para[fn:last()]". Selects the last employee child of the context node.. */ @org.junit.Test public void abbreviatedSyntax6() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee[fn:last()]/@name", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 13") ); } /** * Evaluates "* /hours". Selects all hours grandchildren of the context node.. */ @org.junit.Test public void abbreviatedSyntax7() { final XQuery query = new XQuery( "for $h in (/works) return $h/*/hours/string()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "40 70 20 80 20 40 20 30 12 40 80 20 20 20 40 80") ); } /** * Evaluates "/works/employee[5]/hours[2]" selects the second hours of the fifth employee of the book whose parent is the document node that contains the context node.. */ @org.junit.Test public void abbreviatedSyntax8() { final XQuery query = new XQuery( "/works/employee[5]/hours[2]", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "30") ); } /** * Evaluates "employee//hours". Selects the hours element descendants of the employee element children of the context node.. */ @org.junit.Test public void abbreviatedSyntax9() { final XQuery query = new XQuery( "for $h in (/works) return $h/employee//hours/string()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "40 70 20 80 20 40 20 30 12 40 80 20 20 20 40 80") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdAxisStepAncestor.java000066400000000000000000000570011222453003200313770ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the AxisStep production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdAxisStepAncestor extends QT3TestSet { /** * Apply the ancestor axis to a single processing instruction. . */ @org.junit.Test public void k2AncestorAxis1() { final XQuery query = new XQuery( "empty(/ancestor::node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Apply axis ancestor on a single root node. . */ @org.junit.Test public void k2AncestorAxis10() { final XQuery query = new XQuery( "empty(/ancestor::node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Apply the ancestor axis to a simple tree constructed with constructors, combined with fn:last(). . */ @org.junit.Test public void k2AncestorAxis11() { final XQuery query = new XQuery( " /b/c/ancestor::*[fn:last()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Apply the ancestor axis to a simple tree constructed with constructors, combined with fn:last(). Paranteses are added to ensure that the result of the axis step is delivered in document order. . */ @org.junit.Test public void k2AncestorAxis12() { final XQuery query = new XQuery( " /b/c/(ancestor::*)[last()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Apply axis ancestor on a single element. . */ @org.junit.Test public void k2AncestorAxis13() { final XQuery query = new XQuery( "1, /ancestor::node(), 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 1") ); } /** * Apply axis ancestor to a single processing instruction. . */ @org.junit.Test public void k2AncestorAxis14() { final XQuery query = new XQuery( "1, /ancestor::node(), 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 1") ); } /** * Apply axis ancestor to a single attribute. . */ @org.junit.Test public void k2AncestorAxis15() { final XQuery query = new XQuery( "1, attribute name {\"content\"}/ancestor::node(), 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 1") ); } /** * Apply axis ancestor to a single comment. . */ @org.junit.Test public void k2AncestorAxis16() { final XQuery query = new XQuery( "1, /ancestor::node(), 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 1") ); } /** * Apply axis ancestor to a single document node. . */ @org.junit.Test public void k2AncestorAxis17() { final XQuery query = new XQuery( "document {()}/ancestor::node(), count(document {()}/ancestor::node()), 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "0 1") || error("XPST0005") ) ); } /** * Apply axis ancestor to a single text node. . */ @org.junit.Test public void k2AncestorAxis18() { final XQuery query = new XQuery( "1, text {\"\"}/ancestor::node(), 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 1") ); } /** * Apply fn:count() to the result of axis ancestor. . */ @org.junit.Test public void k2AncestorAxis19() { final XQuery query = new XQuery( "count( /b/c/(ancestor::*))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Apply the ancestor axis to a single comment. . */ @org.junit.Test public void k2AncestorAxis2() { final XQuery query = new XQuery( "empty(/ancestor::node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Apply fn:count() to the result of axis ancestor(#2). . */ @org.junit.Test public void k2AncestorAxis20() { final XQuery query = new XQuery( " //count(ancestor::*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0 1 2 1") ); } /** * Use positional predicates. . */ @org.junit.Test public void k2AncestorAxis21() { final XQuery query = new XQuery( " /a/b/c/(ancestor::*[1], ancestor::*[2], ancestor::*[last()], ancestor::*[10])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Apply the ancestor axis to a single element. . */ @org.junit.Test public void k2AncestorAxis3() { final XQuery query = new XQuery( "empty(/ancestor::node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Apply the ancestor axis to a single attribute. . */ @org.junit.Test public void k2AncestorAxis4() { final XQuery query = new XQuery( "empty(attribute name {\"content\"}/ancestor::node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Apply the ancestor axis to a single document node. . */ @org.junit.Test public void k2AncestorAxis5() { final XQuery query = new XQuery( "empty(document {()}/ancestor::node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Apply the ancestor axis to a single document node with content. . */ @org.junit.Test public void k2AncestorAxis6() { final XQuery query = new XQuery( "empty(document {text}/ancestor::node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Apply the ancestor axis to a simple tree constructed with constructors. . */ @org.junit.Test public void k2AncestorAxis7() { final XQuery query = new XQuery( " /b/c/ancestor::*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Apply the ancestor axis to a simple tree constructed with constructors, combined with a [1]-predicate. . */ @org.junit.Test public void k2AncestorAxis8() { final XQuery query = new XQuery( " /b/c/ancestor::*[1]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Apply the ancestor axis to a simple tree constructed with constructors, combined with a [1]-predicate. Paranteses are added to ensure that the result of the axis step is delivered in document order. . */ @org.junit.Test public void k2AncestorAxis9() { final XQuery query = new XQuery( " /b/c/(ancestor::*)[1]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Evaluation of the ancestor axis for which the context node is not a node. . */ @org.junit.Test public void ancestor1() { final XQuery query = new XQuery( "(200)/ancestor::*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0019") ); } /** * Evaluation of the ancestor axis that is part of an "node after" expression with both operands the same (returns false). . */ @org.junit.Test public void ancestor10() { final XQuery query = new XQuery( "exactly-one(/works/employee[1]/ancestor::works) >> exactly-one(/works/employee[1]/hours)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the ancestor axis that is part of an "union " operation. Both operands are the same. . */ @org.junit.Test public void ancestor11() { final XQuery query = new XQuery( "(/works/employee[12]/*/day/ancestor::overtime) | (/works/employee[12]/*/day/ancestor::overtime)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n Monday\n Tuesday\n ", false) ); } /** * Evaluation of the ancestor axis that is part of an "union" operation. Both operands are different . */ @org.junit.Test public void ancestor12() { final XQuery query = new XQuery( "(/works/employee[12]/*/day[1]/ancestor::overtime) | (/works/employee[12]/*/day[2]/ancestor::overtime)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n Monday\n Tuesday\n ", false) ); } /** * Evaluation of the ancestor axis that is part of an "intersect" operation. Both operands are the same. Uses fn:count to avoid empty file . */ @org.junit.Test public void ancestor13() { final XQuery query = new XQuery( "(/works/employee[12]/overtime/day/ancestor::employee) intersect (/works/employee[12]/overtime/day/ancestor::employee)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n E4\n P4\n 40\n \n Monday\n Tuesday\n \n ", false) ); } /** * Evaluation of the ancestor axis that is part of an "except" operation. Both operands are the same. Uses fn:count to avoid empty file . */ @org.junit.Test public void ancestor14() { final XQuery query = new XQuery( "fn:count((/works/employee[12]/overtime/day[ancestor::overtime]) except (/works/employee[12]/overtime/day[ancestor::overtime]))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of the ancestor axis that is part of an "except" operation. Both operands are different. Uses fn:count to avoid empty file . */ @org.junit.Test public void ancestor15() { final XQuery query = new XQuery( "(/works/employee[12]/overtime/day[ancestor::overtime]) except (/works/employee[12]/overtime/day[1])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Tuesday") ); } /** * Evaluation of the ancestor axis that is part of a boolean expression ("and" and fn:true(). . */ @org.junit.Test public void ancestor16() { final XQuery query = new XQuery( "(/works/employee[12]/overtime/day[ancestor::overtime]) and fn:true()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the ancestor axis that is part of a boolean expression ("and" and fn:false()). . */ @org.junit.Test public void ancestor17() { final XQuery query = new XQuery( "(/works/employee[12]/overtime/day[ancestor::overtime]) and fn:false()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the ancestor axis that is part of a boolean expression ("or" and fn:true()). . */ @org.junit.Test public void ancestor18() { final XQuery query = new XQuery( "(/works/employee[12]/overtime/day[ancestor::overtime]) or fn:true()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the ancestor axis that is part of a boolean expression ("or" and fn:false()). . */ @org.junit.Test public void ancestor19() { final XQuery query = new XQuery( "(/works/employee[12]/overtime/day[ancestor::overtime]) or fn:false()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the ancestor axis for which the given node does not exists. Uses fn:count to avoid empty file. . */ @org.junit.Test public void ancestor2() { final XQuery query = new XQuery( "fn:count(/works/employee[1]/ancestor::noSuchNode)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of the ancestor axis that used as part of the deep-equal-function. . */ @org.junit.Test public void ancestor20() { final XQuery query = new XQuery( "fn:deep-equal(/works/employee[12]/overtime/ancestor::works,/works/employee[12]/overtime/ancestor::works)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the ancestor axis used together with a newly constructed element. Uses fn:count to avoid empty file. . */ @org.junit.Test public void ancestor21() { final XQuery query = new XQuery( "let $var := Some Content return fn:count($var/ancestor::*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of the ancestor axis that is part of an "is" expression (return true). . */ @org.junit.Test public void ancestor3() { final XQuery query = new XQuery( "exactly-one(/works/employee[1]/ancestor::works) is exactly-one(/works)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the ancestor axis that is part of an "is" expression (return false). . */ @org.junit.Test public void ancestor4() { final XQuery query = new XQuery( "exactly-one(/works/employee[1]/ancestor::works) is exactly-one(/works/employee[1])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the ancestor axis that is part of an "node before" expression (return true). . */ @org.junit.Test public void ancestor5() { final XQuery query = new XQuery( "exactly-one(/works/employee[1]/ancestor::works) << exactly-one(/works/employee[1])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the ancestor axis that is part of an "node before" expression and both operands are the same (return false). . */ @org.junit.Test public void ancestor6() { final XQuery query = new XQuery( "exactly-one(/works/employee[1]/ancestor::works) << exactly-one(/works/employee[1]/ancestor::works)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the ancestor axis that is part of an "node before" expression both operands are differents (return false). . */ @org.junit.Test public void ancestor7() { final XQuery query = new XQuery( "exactly-one(/works/employee[1]/ancestor::works) << exactly-one(/works/employee[1])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the ancestor axis that is part of an "node after" expression (returns true). . */ @org.junit.Test public void ancestor8() { final XQuery query = new XQuery( "exactly-one(/works/employee[1]) >> exactly-one(/works/employee[1]/ancestor::works)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the ancestor axis that is part of an "node after" expression with both operands the same (returns false). . */ @org.junit.Test public void ancestor9() { final XQuery query = new XQuery( "exactly-one(/works/employee[1]/ancestor::works) >> exactly-one(/works/employee[1]/ancestor::works)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluate selecting an ancestor (ancestor::employee)- Select the "employee" ancestors of the context node . */ @org.junit.Test public void unabbreviatedSyntax10() { final XQuery query = new XQuery( "for $h in (/works/employee[1]/hours) return $h/ancestor::employee", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n E1\n P1\n 40\n ", false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdAxisStepAncestorOrSelf.java000066400000000000000000000430651222453003200325170ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the AxisStep production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdAxisStepAncestorOrSelf extends QT3TestSet { /** * Apply axis ancestor on a single element. . */ @org.junit.Test public void k2AncestorOrSelfAxis1() { final XQuery query = new XQuery( "1, /ancestor-or-self::node(), 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("11", false) ); } /** * Apply axis ancestor to a single processing instruction. . */ @org.junit.Test public void k2AncestorOrSelfAxis2() { final XQuery query = new XQuery( "1, /ancestor-or-self::node(), 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("11", false) ); } /** * Apply axis ancestor to a single attribute. . */ @org.junit.Test public void k2AncestorOrSelfAxis3() { final XQuery query = new XQuery( "1, (attribute name {\"content\"}/ancestor-or-self::node() instance of attribute(name)), 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertDeepEq("1, true(), 1") ); } /** * Apply axis ancestor to a single comment. . */ @org.junit.Test public void k2AncestorOrSelfAxis4() { final XQuery query = new XQuery( "1, /ancestor-or-self::node(), 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("11", false) ); } /** * Apply axis ancestor-or-self to a single document node. . */ @org.junit.Test public void k2AncestorOrSelfAxis5() { final XQuery query = new XQuery( "1, document {()}/ancestor-or-self::node(), 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("11", false) ); } /** * Apply axis ancestor to a single text node. . */ @org.junit.Test public void k2AncestorOrSelfAxis6() { final XQuery query = new XQuery( "1, text {\"\"}/ancestor-or-self::node(), 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("11", false) ); } /** * Apply fn:count() to the result of axis ancestor-or-self. . */ @org.junit.Test public void k2AncestorOrSelfAxis7() { final XQuery query = new XQuery( "count( /b/c/(ancestor-or-self::*))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Apply fn:count() to the result of axis ancestor-or-self(#2). . */ @org.junit.Test public void k2AncestorOrSelfAxis8() { final XQuery query = new XQuery( " //count(ancestor-or-self::*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 2") ); } /** * Use positional predicates. . */ @org.junit.Test public void k2AncestorOrSelfAxis9() { final XQuery query = new XQuery( " /a/b/c/(ancestor-or-self::*[1], ancestor-or-self::*[2], ancestor-or-self::*[last()], ancestor-or-self::*[10])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Evaluation of the ancestor-or-self axis for which the context node is not a node. . */ @org.junit.Test public void ancestorself1() { final XQuery query = new XQuery( "(200)/ancestor-or-self::*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0019") ); } /** * Evaluation of the ancestor-or-self axis that is part of an "node after" expression with both operands the same (returns false). . */ @org.junit.Test public void ancestorself10() { final XQuery query = new XQuery( "exactly-one(/works/employee[1]/ancestor-or-self::works) >> exactly-one(/works/employee[1]/hours)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the ancestor-or-self axis that is part of an "union " operation. Both operands are the same. . */ @org.junit.Test public void ancestorself11() { final XQuery query = new XQuery( "((/works/employee[12]/*/day/ancestor-or-self::overtime) | (/works/employee[12]/*/day/ancestor-or-self::overtime))/count(*)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Evaluation of the ancestor-or-self axis that is part of an "union" operation. Both operands are different . */ @org.junit.Test public void ancestorself12() { final XQuery query = new XQuery( "((/works/employee[12]/*/day[1]/ancestor-or-self::overtime) | (/works/employee[12]/*/day[2]/ancestor-or-self::overtime))/count(*)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Evaluation of the ancestor-or-self axis that is part of an "intersect" operation. Both operands are the same. . */ @org.junit.Test public void ancestorself13() { final XQuery query = new XQuery( "((/works/employee[12]/overtime/day/ancestor-or-self::employee) intersect (/works/employee[12]/overtime/day/ancestor-or-self::employee))/@name", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "John Doe 12") ); } /** * Evaluation of the ancestor-self axis that is part of an "except" operation. Both operands are the same. Uses fn:count to avoid empty file . */ @org.junit.Test public void ancestorself14() { final XQuery query = new XQuery( "fn:count((/works/employee[12]/overtime/day[ancestor-or-self::overtime]) except (/works/employee[12]/overtime/day[ancestor-or-self::overtime]))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of the ancestor-or-self axis that is part of an "except" operation. Both operands are different. . */ @org.junit.Test public void ancestorself15() { final XQuery query = new XQuery( "(/works/employee[12]/overtime/day[ancestor-or-self::overtime]) except (/works/employee[12]/overtime/day[1])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Tuesday") ); } /** * Evaluation of the ancestor-or-self axis that is part of a boolean expression ("and" and fn:true(). . */ @org.junit.Test public void ancestorself16() { final XQuery query = new XQuery( "(/works/employee[12]/overtime/day[ancestor-or-self::overtime]) and fn:true()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the ancestor-or-self axis that is part of a boolean expression ("and" and fn:false()). . */ @org.junit.Test public void ancestorself17() { final XQuery query = new XQuery( "(/works/employee[12]/overtime/day[ancestor-or-self::overtime]) and fn:false()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the ancestor-or-self axis that is part of a boolean expression ("or" and fn:true()). . */ @org.junit.Test public void ancestorself18() { final XQuery query = new XQuery( "(/works/employee[12]/overtime/day[ancestor-or-self::overtime]) or fn:true()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the ancestor-or-self axis that is part of a boolean expression ("or" and fn:false()). . */ @org.junit.Test public void ancestorself19() { final XQuery query = new XQuery( "(/works/employee[12]/overtime/day[ancestor-or-self::overtime]) or fn:false()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the ancestor-or-self axis for which the given node does not exists. Uses fn:count to avoid empty file. . */ @org.junit.Test public void ancestorself2() { final XQuery query = new XQuery( "fn:count(/works/employee[1]/ancestor-or-self::noSuchNode)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of the ancestor-or-self axis that used as part of the deep-equal-function. . */ @org.junit.Test public void ancestorself20() { final XQuery query = new XQuery( "fn:deep-equal(/works/employee[12]/overtime/ancestor-or-self::works,/works/employee[12]/overtime/ancestor-or-self::works)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the ancestor-or-self axis used together with a newly constructed element. . */ @org.junit.Test public void ancestorself21() { final XQuery query = new XQuery( "let $var := Some Content return $var/ancestor-or-self::*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Some Content", false) ); } /** * Evaluation of the ancestor-or-self axis that is part of an "is" expression (return true). . */ @org.junit.Test public void ancestorself3() { final XQuery query = new XQuery( "exactly-one(/works/employee[1]/ancestor-or-self::works) is exactly-one(/works)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the ancestor-or-self axis that is part of an "is" expression (return false). . */ @org.junit.Test public void ancestorself4() { final XQuery query = new XQuery( "exactly-one(/works/employee[1]/ancestor-or-self::works) is exactly-one(/works/employee[1])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the ancestor-or-self axis that is part of an "node before" expression (return true). . */ @org.junit.Test public void ancestorself5() { final XQuery query = new XQuery( "exactly-one(/works/employee[1]/ancestor-or-self::works) << exactly-one(/works/employee[1])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the ancestor-or-self axis that is part of an "node before" expression and both operands are the same (return false). . */ @org.junit.Test public void ancestorself6() { final XQuery query = new XQuery( "exactly-one(/works/employee[1]/ancestor-or-self::works) << exactly-one(/works/employee[1]/ancestor-or-self::works)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the ancestor-or-self axis that is part of an "node before" expression both operands are differents (return false). . */ @org.junit.Test public void ancestorself7() { final XQuery query = new XQuery( "exactly-one(/works/employee[1]/ancestor-or-self::works) << exactly-one(/works/employee[1])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the ancestor-or-self axis that is part of an "node after" expression (returns true). . */ @org.junit.Test public void ancestorself8() { final XQuery query = new XQuery( "exactly-one(/works/employee[1]) >> exactly-one(/works/employee[1]/ancestor-or-self::works)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the ancestor-or-self axis that is part of an "node after" expression with both operands the same (returns false). . */ @org.junit.Test public void ancestorself9() { final XQuery query = new XQuery( "exactly-one(/works/employee[1]/ancestor-or-self::works) >> exactly-one(/works/employee[1]/ancestor-or-self::works)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluate selecting an ancestor or self (ancestor-or-self::employee)- Select the "employee" ancestors of the context node and if the context is "employee" select it as well. . */ @org.junit.Test public void unabbreviatedSyntax11() { final XQuery query = new XQuery( "(for $h in (/works/employee[1]/hours) return $h/ancestor-or-self::employee)/@name", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Jane Doe 1") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdAxisStepFollowing.java000066400000000000000000000354071222453003200315670ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the following axis. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdAxisStepFollowing extends QT3TestSet { /** * Evaluate the 'following' axis on a html document. . */ @org.junit.Test public void k2FollowingAxis1() { final XQuery query = new XQuery( "\n" + " let $i :=

    \n" + " return $i//p[1]/following::*\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("

    ", false) ); } /** * Evaluate the child node from the last node in a tree. . */ @org.junit.Test public void k2FollowingAxis2() { final XQuery query = new XQuery( "\n" + " declare variable $i := ;\n" + " 1, root($i)//leaf/following::node(), 1\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 1") ); } /** * Evaluate the child node from root of a tree. . */ @org.junit.Test public void k2FollowingAxis3() { final XQuery query = new XQuery( "\n" + " declare variable $i := ; \n" + " empty(root($i)/following::node())\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluate fn:count() on a range of nodes, navigated with axis following. . */ @org.junit.Test public void k2FollowingAxis4() { final XQuery query = new XQuery( "\n" + " declare variable $i := ; \n" + " root($i)//count(following::node())\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0 5 4 0 0 0 0") ); } /** * Evaluation of the following axis for which the context node is not a node. . */ @org.junit.Test public void following1() { final XQuery query = new XQuery( "(200)/following::*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0019") ); } /** * Evaluation of the following axis that is part of an "node after" expression with different operands (returns false). . */ @org.junit.Test public void following10() { final XQuery query = new XQuery( "exactly-one(/works[1]/employee[12]) >> exactly-one(/works[1]/employee[12]/following::employee)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the following axis that is part of an "union " operation. Both operands are the same. . */ @org.junit.Test public void following11() { final XQuery query = new XQuery( "(/works/employee[12]/*/day[1]/following::day) | (/works/employee[12]/*/day[1]/following::day)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Tuesday", false) ); } /** * Evaluation of the following axis that is part of an "union" operation. Both operands are different . */ @org.junit.Test public void following12() { final XQuery query = new XQuery( "(/works/employee[12]/*/day[1]/following::day) | (/works/employee[12]/*/day[1])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("MondayTuesday", false) ); } /** * Evaluation of the following axis that is part of an "intersect" operation. Both operands are the same. . */ @org.junit.Test public void following13() { final XQuery query = new XQuery( "(/works[1]/employee[12]/overtime[1]/day[1]/following::day) intersect (/works[1]/employee[12]/overtime[1]/day[1]/following::day)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Tuesday", false) ); } /** * Evaluation of the following axis that is part of an "except" operation. Both operands are the same. Uses fn:count to avoid empty file . */ @org.junit.Test public void following14() { final XQuery query = new XQuery( "fn:count((/works[1]/employee[12]/following::employee) except (/works[1]/employee[12]/following::employee))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of the following axis that is part of an "except" operation. Both operands are different. . */ @org.junit.Test public void following15() { final XQuery query = new XQuery( "(/works[1]/employee[12]/overtime/day) except (/works[1]/employee[12]/overtime/day[1]/following::day)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Monday", false) ); } /** * Evaluation of the following axis that is part of a boolean expression ("and" and fn:true(). . */ @org.junit.Test public void following16() { final XQuery query = new XQuery( "(/works[1]/employee[12]/following::employee) and fn:true()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the following axis that is part of a boolean expression ("and" and fn:false()). . */ @org.junit.Test public void following17() { final XQuery query = new XQuery( "(/works[1]/employee[12]/following::employee) and fn:false()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the following axis that is part of a boolean expression ("or" and fn:true()). . */ @org.junit.Test public void following18() { final XQuery query = new XQuery( "(/works[1]/employee[12]/following::employee) or fn:true()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the following axis that is part of a boolean expression ("or" and fn:false()). . */ @org.junit.Test public void following19() { final XQuery query = new XQuery( "(/works[1]/employee[12]/following::employee) or fn:false()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the following axis for which the given node does not exists. Uses fn:count to avoid empty file. . */ @org.junit.Test public void following2() { final XQuery query = new XQuery( "fn:count(/works/employee[1]/following::noSuchNode)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of the following axis that used as part of the deep-equal-function. . */ @org.junit.Test public void following20() { final XQuery query = new XQuery( "fn:deep-equal(/works[1]/employee[12]/following::employee,/works[1]/employee[12]/following::employee)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the following axis used together with a newly constructed element. Uses fn:count to avoid empty file. . */ @org.junit.Test public void following21() { final XQuery query = new XQuery( "let $var := Some Content return fn:count($var/following::*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of the following axis that is part of an "is" expression (return true). . */ @org.junit.Test public void following3() { final XQuery query = new XQuery( "exactly-one(/works/employee[12]/following::employee) is exactly-one(/works/employee[13])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the following axis that is part of an "is" expression (return false). . */ @org.junit.Test public void following4() { final XQuery query = new XQuery( "exactly-one(/works[1]/employee[12]/following::employee) is exactly-one(/works[1]/employee[12])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the following axis that is part of an "node before" expression (return true). . */ @org.junit.Test public void following5() { final XQuery query = new XQuery( "(/works[1]/employee[11]/following::employee[1]) << (/works[1]/employee[13])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the following axis that is part of an "node before" expression and both operands are the same (return false). . */ @org.junit.Test public void following6() { final XQuery query = new XQuery( "exactly-one(/works[1]/employee[12]/following::employee) << exactly-one(/works[1]/employee[12]/following::employee)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the following axis that is part of an "node before" expression both operands are differents (return false). . */ @org.junit.Test public void following7() { final XQuery query = new XQuery( "exactly-one(/works[1]/employee[12]/following::employee) << exactly-one(/works[1]/employee[12]/overtime[1])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the following axis that is part of an "node after" expression (returns true). . */ @org.junit.Test public void following8() { final XQuery query = new XQuery( "exactly-one(/works[1]/employee[13]) >> exactly-one(/works[1]/employee[12]/overtime[1]/day[1]/following::day)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the following axis that is part of an "node after" expression with both operands the same (returns false). . */ @org.junit.Test public void following9() { final XQuery query = new XQuery( "exactly-one(/works[1]/employee[12]/following::employee) >> exactly-one(/works[1]/employee[12]/following::employee)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdAxisStepFollowingSibling.java000066400000000000000000000467211222453003200331000ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the following-sibling axis. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdAxisStepFollowingSibling extends QT3TestSet { /** * Apply following-sibling to a child whose siblings are the last in a document. . */ @org.junit.Test public void k2FollowingSiblingAxis1() { final XQuery query = new XQuery( " /child[1]/following-sibling::node()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Use a positional predicate beyond the output. . */ @org.junit.Test public void k2FollowingSiblingAxis10() { final XQuery query = new XQuery( " { /*/following::*[2] } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Apply following-sibling to a child whose last nodes in document order are attributes. . */ @org.junit.Test public void k2FollowingSiblingAxis2() { final XQuery query = new XQuery( " /child[1]/following-sibling::node()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Apply fn:count() to the result of axis following-sibling. . */ @org.junit.Test public void k2FollowingSiblingAxis3() { final XQuery query = new XQuery( "count( /child[1]/following-sibling::node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Evaluate fn:count() on a range of nodes, navigated with axis following. . */ @org.junit.Test public void k2FollowingSiblingAxis4() { final XQuery query = new XQuery( "\n" + " declare variable $i := ; \n" + " root($i)//count(following-sibling::node())\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0 2 1 0 0 0 0") ); } /** * Evaluate on a small tree. . */ @org.junit.Test public void k2FollowingSiblingAxis5() { final XQuery query = new XQuery( "\n" + " declare variable $i := ; \n" + " root($i)//following-sibling::node()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * A type error with the following-sibling axis. . */ @org.junit.Test public void k2FollowingSiblingAxis6() { final XQuery query = new XQuery( "\n" + " declare variable $i := ; \n" + " root($i)//(following-sibling::node(), \"BOO\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0018") ); } /** * Apply count to axis following-sibling. . */ @org.junit.Test public void k2FollowingSiblingAxis7() { final XQuery query = new XQuery( "count( /following-sibling::node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Apply count to axis following-sibling, combined with the comma operator. . */ @org.junit.Test public void k2FollowingSiblingAxis8() { final XQuery query = new XQuery( "1, /following-sibling::node(), 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 1") ); } /** * Apply count to axis following-sibling to a single node, combined with the comma operator. . */ @org.junit.Test public void k2FollowingSiblingAxis9() { final XQuery query = new XQuery( "1, /following-sibling::node(), 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 1") ); } /** * Apply the following-sibling axis to an attribute node. . */ @org.junit.Test public void followingSiblingAttr() { final XQuery query = new XQuery( " 4 5 6 /@a/following-sibling::node()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * Evaluation of the following-sibling axis for which the context node is not a node. . */ @org.junit.Test public void followingsibling1() { final XQuery query = new XQuery( "(200)/following-sibling::*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0019") ); } /** * Evaluation of the following-sibling axis that is part of an "node after" expression with different operands (returns false). . */ @org.junit.Test public void followingsibling10() { final XQuery query = new XQuery( "exactly-one(/works[1]/employee[12]) >> exactly-one(/works[1]/employee[12]/following-sibling::employee)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the following-sibling axis that is part of an "union " operation. Both operands are the same. . */ @org.junit.Test public void followingsibling11() { final XQuery query = new XQuery( "(/works/employee[12]/*/day[1]/following-sibling::day) | (/works/employee[12]/*/day[1]/following-sibling::day)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Tuesday", false) ); } /** * Evaluation of the following-sibling axis that is part of an "union" operation. Both operands are different . */ @org.junit.Test public void followingsibling12() { final XQuery query = new XQuery( "(/works/employee[12]/*/day[1]/following-sibling::day) | (/works/employee[12]/*/day[1])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("MondayTuesday", false) ); } /** * Evaluation of the following-sibling axis that is part of an "intersect" operation. Both operands are the same. . */ @org.junit.Test public void followingsibling13() { final XQuery query = new XQuery( "(/works[1]/employee[12]/overtime[1]/day[1]/following-sibling::day) intersect (/works[1]/employee[12]/overtime[1]/day[1]/following-sibling::day)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Tuesday", false) ); } /** * Evaluation of the following-sibling axis that is part of an "except" operation. Both operands are the same. Uses fn:count to avoid empty file . */ @org.junit.Test public void followingsibling14() { final XQuery query = new XQuery( "fn:count((/works[1]/employee[12]/following-sibling::employee) except (/works[1]/employee[12]/following-sibling::employee))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of the following-sibling axis that is part of an "except" operation. Both operands are different. . */ @org.junit.Test public void followingsibling15() { final XQuery query = new XQuery( "(/works[1]/employee[12]/overtime/day) except (/works[1]/employee[12]/overtime/day[1]/following-sibling::day)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Monday", false) ); } /** * Evaluation of the following-sibling axis that is part of a boolean expression ("and" and fn:true(). . */ @org.junit.Test public void followingsibling16() { final XQuery query = new XQuery( "(/works[1]/employee[12]/following-sibling::employee) and fn:true()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the following-sibling axis that is part of a boolean expression ("and" and fn:false()). . */ @org.junit.Test public void followingsibling17() { final XQuery query = new XQuery( "(/works[1]/employee[12]/following-sibling::employee) and fn:false()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the following-sibling axis that is part of a boolean expression ("or" and fn:true()). . */ @org.junit.Test public void followingsibling18() { final XQuery query = new XQuery( "(/works[1]/employee[12]/following-sibling::employee) or fn:true()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the following-sibling axis that is part of a boolean expression ("or" and fn:false()). . */ @org.junit.Test public void followingsibling19() { final XQuery query = new XQuery( "(/works[1]/employee[12]/following-sibling::employee) or fn:false()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the following-sibling axis for which the given node does not exists. Uses fn:count to avoid empty file. . */ @org.junit.Test public void followingsibling2() { final XQuery query = new XQuery( "fn:count(/works/employee[1]/following-sibling::noSuchNode)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of the following-sibling axis that used as part of the deep-equal-function. . */ @org.junit.Test public void followingsibling20() { final XQuery query = new XQuery( "fn:deep-equal(/works[1]/employee[12]/following-sibling::employee,/works[1]/employee[12]/following-sibling::employee)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the following axis used together with a newly constructed element. Uses fn:count to avoid empty file. . */ @org.junit.Test public void followingsibling21() { final XQuery query = new XQuery( "let $var := Some Content return fn:count($var/following::*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of the following-sibling axis that is part of an "is" expression (return true). . */ @org.junit.Test public void followingsibling3() { final XQuery query = new XQuery( "exactly-one(/works/employee[12]/following-sibling::employee) is exactly-one(/works/employee[13])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the following-sibling axis that is part of an "is" expression (return false). . */ @org.junit.Test public void followingsibling4() { final XQuery query = new XQuery( "exactly-one(/works[1]/employee[12]/following-sibling::employee) is exactly-one(/works[1]/employee[12])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the following-sibling axis that is part of an "node before" expression (return true). . */ @org.junit.Test public void followingsibling5() { final XQuery query = new XQuery( "exactly-one(/works[1]/employee[12]/overtime/day[1]/following-sibling::day) << exactly-one(/works[1]/employee[13])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the following-sibling axis that is part of an "node before" expression and both operands are the same (return false). . */ @org.junit.Test public void followingsibling6() { final XQuery query = new XQuery( "exactly-one(/works[1]/employee[12]/following-sibling::employee) << exactly-one(/works[1]/employee[12]/following-sibling::employee)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the following-sibling axis that is part of an "node before" expression both operands are differents (return false). . */ @org.junit.Test public void followingsibling7() { final XQuery query = new XQuery( "exactly-one(/works[1]/employee[12]/following-sibling::employee) << exactly-one(/works[1]/employee[12]/overtime[1])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the following-sibling axis that is part of an "node after" expression (returns true). . */ @org.junit.Test public void followingsibling8() { final XQuery query = new XQuery( "exactly-one(/works[1]/employee[13]) >> exactly-one(/works[1]/employee[12]/overtime[1]/day[1]/following-sibling::day)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the following-sibling axis that is part of an "node after" expression with both operands the same (returns false). . */ @org.junit.Test public void followingsibling9() { final XQuery query = new XQuery( "exactly-one(/works[1]/employee[12]/following-sibling::employee) >> exactly-one(/works[1]/employee[12]/following-sibling::employee)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluate "following-sibling::employee[fn:position() = 1]". Selects the next employee sibling of the context node. . */ @org.junit.Test public void unabbreviatedSyntax24() { final XQuery query = new XQuery( "for $h in (/works/employee[2]) return $h/following-sibling::employee[fn:position() = 1]", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n E1\n P3\n 80\n ", false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdAxisStepPreceding.java000066400000000000000000000456251222453003200315320ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the preceding axis. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdAxisStepPreceding extends QT3TestSet { /** * Evaluate the child node from the last node in a tree. . */ @org.junit.Test public void k2PrecedingAxis1() { final XQuery query = new XQuery( "declare variable $i := ; empty(root($i)/preceding::node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluate from a node that has no preceding nodes. . */ @org.junit.Test public void k2PrecedingAxis2() { final XQuery query = new XQuery( "declare variable $i := ; empty(root($i)//leaf/preceding::node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Apply a numeric predicate to axis preceding. . */ @org.junit.Test public void k2PrecedingAxis3() { final XQuery query = new XQuery( "declare variable $i := ; root($i)//leaf/preceding::node()[1]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Apply a numeric predicate to axis preceding, combined with a numeric predicate. The paranteses ensures the step is parsed as a primary expression, and hence is in document order, not reversed. . */ @org.junit.Test public void k2PrecedingAxis4() { final XQuery query = new XQuery( "declare variable $i := ; root($i)//leaf/(preceding::node())[1]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Apply a numeric predicate to axis preceding, combined with fn:last(). The paranteses ensures the step is parsed as a primary expression, and hence is in document order, not reversed. . */ @org.junit.Test public void k2PrecedingAxis5() { final XQuery query = new XQuery( "declare variable $i := ; root($i)//leaf/(preceding::node())[last()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Apply fn:last() to axis preceding. . */ @org.junit.Test public void k2PrecedingAxis6() { final XQuery query = new XQuery( "declare variable $i := ; root($i)//leaf/preceding::node()[last()]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Apply fn:count() to axis preceding. . */ @org.junit.Test public void k2PrecedingAxis7() { final XQuery query = new XQuery( "declare variable $i := ; count(root($i)//leaf/preceding::node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Apply fn:count() to axis preceding. . */ @org.junit.Test public void k2PrecedingAxis8() { final XQuery query = new XQuery( "declare variable $i := ; root($i)//count(preceding::*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0 0 0 1 1 2 2 4 6 8") ); } /** * Evaluation of the preceding axis for which the context node is not a node. . */ @org.junit.Test public void preceding1() { final XQuery query = new XQuery( "(200)/preceding::*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0019") ); } /** * Evaluation of the preceding axis that is part of an "node after" expression with different operands (returns false). . */ @org.junit.Test public void preceding10() { final XQuery query = new XQuery( "exactly-one(/works[1]/employee[13]) >> exactly-one(/works[1]/employee[2]/preceding::employee)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the preceding axis that is part of an "union " operation. Both operands are the same. . */ @org.junit.Test public void preceding11() { final XQuery query = new XQuery( "(/works/employee[12]/*/day[2]/preceding::day) | (/works/employee[12]/*/day[2]/preceding::day)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Monday", false) ); } /** * Evaluation of the preceding axis that is part of an "union" operation. Both operands are different . */ @org.junit.Test public void preceding12() { final XQuery query = new XQuery( "(/works/employee[12]/*/day[2]/preceding::day) | (/works/employee[12]/*/day[2])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("MondayTuesday", false) ); } /** * Evaluation of the preceding axis that is part of an "intersect" operation. Both operands are the same. . */ @org.junit.Test public void preceding13() { final XQuery query = new XQuery( "(/works[1]/employee[12]/overtime[1]/day[2]/preceding::day) intersect (/works[1]/employee[12]/overtime[1]/day[2]/preceding::day)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Monday", false) ); } /** * Evaluation of the preceding axis that is part of an "except" operation. Both operands are the same. Uses fn:count to avoid empty file . */ @org.junit.Test public void preceding14() { final XQuery query = new XQuery( "fn:count((/works[1]/employee[12]/preceding::employee) except (/works[1]/employee[12]/preceding::employee))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of the preceding axis that is part of an "except" operation. Both operands are different. . */ @org.junit.Test public void preceding15() { final XQuery query = new XQuery( "(/works[1]/employee[12]/overtime/day) except (/works[1]/employee[12]/overtime/day[2]/preceding::day)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Tuesday", false) ); } /** * Evaluation of the preceding axis that is part of a boolean expression ("and" and fn:true(). . */ @org.junit.Test public void preceding16() { final XQuery query = new XQuery( "(/works[1]/employee[12]/preceding::employee) and fn:true()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the preceding axis that is part of a boolean expression ("and" and fn:false()). . */ @org.junit.Test public void preceding17() { final XQuery query = new XQuery( "(/works[1]/employee[12]/preceding::employee) and fn:false()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the preceding axis that is part of a boolean expression ("or" and fn:true()). . */ @org.junit.Test public void preceding18() { final XQuery query = new XQuery( "(/works[1]/employee[12]/preceding::employee) or fn:true()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the preceding axis that is part of a boolean expression ("or" and fn:false()). . */ @org.junit.Test public void preceding19() { final XQuery query = new XQuery( "(/works[1]/employee[12]/preceding::employee) or fn:false()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the preceding axis for which the given node does not exists. Uses fn:count to avoid empty file. . */ @org.junit.Test public void preceding2() { final XQuery query = new XQuery( "fn:count(/works/employee[1]/preceding::noSuchNode)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of the preceding axis that used as part of the deep-equal-function. . */ @org.junit.Test public void preceding20() { final XQuery query = new XQuery( "fn:deep-equal(/works[1]/employee[12]/preceding::employee,/works[1]/employee[12]/preceding::employee)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the preceding axis used together with a newly constructed element. Uses fn:count to avoid empty file. . */ @org.junit.Test public void preceding21() { final XQuery query = new XQuery( "let $var := Some Content return fn:count($var/preceding::*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of the preceding axis from the last node in the document. . */ @org.junit.Test public void preceding22() { final XQuery query = new XQuery( " { (//node())[last()]/preceding::node() } ", ctx); try { query.context(node(file("prod/AxisStep.preceding/SmallTree.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n \n text1\n \n \n \n \n text1\n \n \n \n \n \n \n \n \n \n \n theTextChild2theTextChild2", false) ); } /** * Evaluation of the preceding axis from the last node in the document, containing only attributes and elements. . */ @org.junit.Test public void preceding23() { final XQuery query = new XQuery( " { (//node())[last()]/preceding::node(), empty((//node())[last()]/preceding::node()) } ", ctx); try { query.context(node(file("prod/AxisStep.preceding/AttributesAndElements.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("true", false) ); } /** * Evaluation of the preceding axis that is part of an "is" expression (return true). . */ @org.junit.Test public void preceding3() { final XQuery query = new XQuery( "exactly-one(/works/employee[2]/preceding::employee) is exactly-one(/works/employee[1])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the preceding axis that is part of an "is" expression (return false). . */ @org.junit.Test public void preceding4() { final XQuery query = new XQuery( "exactly-one(/works[1]/employee[2]/preceding::employee) is exactly-one(/works[1]/employee[2])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the preceding axis that is part of an "node before" expression (return true). . */ @org.junit.Test public void preceding5() { final XQuery query = new XQuery( "exactly-one(/works[1]/employee[2]/preceding::employee) << exactly-one(/works[1]/employee[2])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the preceding axis that is part of an "node before" expression and both operands are the same (return false). . */ @org.junit.Test public void preceding6() { final XQuery query = new XQuery( "exactly-one(/works[1]/employee[2]/preceding::employee) << exactly-one(/works[1]/employee[2]/preceding::employee)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the preceding axis that is part of an "node before" expression both operands are differents (return false). . */ @org.junit.Test public void preceding7() { final XQuery query = new XQuery( "exactly-one(/works[1]/employee[2]/preceding::employee) << exactly-one(/works[1])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the preceding axis that is part of a "node after" expression (returns true). . */ @org.junit.Test public void preceding8() { final XQuery query = new XQuery( "exactly-one(/works[1]/employee[13]) >> exactly-one(/works[1]/employee[12]/overtime[1]/day[2]/preceding::day)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the preceding axis that is part of an "node after" expression with both operands the same (returns false). . */ @org.junit.Test public void preceding9() { final XQuery query = new XQuery( "exactly-one(/works[1]/employee[2]/preceding::employee) >> exactly-one(/works[1]/employee[2]/preceding::employee)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdAxisStepPrecedingSibling.java000066400000000000000000000417621222453003200330400ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the AxisStep.preceding-sibling production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdAxisStepPrecedingSibling extends QT3TestSet { /** * Iterate from the root node. . */ @org.junit.Test public void k2PrecedingSiblingAxis1() { final XQuery query = new XQuery( "declare variable $i := ; empty(root($i)/preceding-sibling::node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Iterate from the root node. . */ @org.junit.Test public void k2PrecedingSiblingAxis2() { final XQuery query = new XQuery( "declare variable $i := ; empty(root($i)/preceding::node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Apply fn:count() to the result of axis preceding. . */ @org.junit.Test public void k2PrecedingSiblingAxis3() { final XQuery query = new XQuery( "declare variable $i := ; count(root($i)/preceding::node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Apply fn:count() to the result of axis preceding. . */ @org.junit.Test public void k2PrecedingSiblingAxis4() { final XQuery query = new XQuery( "declare variable $i := ; count(root($i)//leaf/preceding::node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Apply fn:count() to the result of axis preceding. . */ @org.junit.Test public void k2PrecedingSiblingAxis5() { final XQuery query = new XQuery( "declare variable $i := ; root($i)//count(preceding-sibling::node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0 0 0 1 0 1 0 2 2 1") ); } /** * Evaluation of the preceding-sibling axis for which the context node is not a node. . */ @org.junit.Test public void precedingSibling1() { final XQuery query = new XQuery( "(200)/preceding-sibling::*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0019") ); } /** * Evaluation of the preceding-sibling axis that is part of an "node after" expression with different operands (returns false). . */ @org.junit.Test public void precedingSibling10() { final XQuery query = new XQuery( "exactly-one(/works[1]/employee[13]) >> exactly-one(/works[1]/employee[2]/preceding-sibling::employee)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the preceding-sibling axis that is part of an "union " operation. Both operands are the same. . */ @org.junit.Test public void precedingSibling11() { final XQuery query = new XQuery( "(/works/employee[12]/*/day[2]/preceding-sibling::day) | (/works/employee[12]/*/day[2]/preceding-sibling::day)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Monday", false) ); } /** * Evaluation of the preceding-sibling axis that is part of an "union" operation. Both operands are different . */ @org.junit.Test public void precedingSibling12() { final XQuery query = new XQuery( "(/works/employee[12]/*/day[2]/preceding-sibling::day) | (/works/employee[12]/*/day[2])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("MondayTuesday", false) ); } /** * Evaluation of the preceding-sibling axis that is part of an "intersect" operation. Both operands are the same. . */ @org.junit.Test public void precedingSibling13() { final XQuery query = new XQuery( "(/works[1]/employee[12]/overtime[1]/day[2]/preceding-sibling::day) intersect (/works[1]/employee[12]/overtime[1]/day[2]/preceding-sibling::day)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Monday", false) ); } /** * Evaluation of the preceding-sibling axis that is part of an "except" operation. Both operands are the same. Uses fn:count to avoid empty file . */ @org.junit.Test public void precedingSibling14() { final XQuery query = new XQuery( "fn:count((/works[1]/employee[12]/preceding-sibling::employee) except (/works[1]/employee[12]/preceding-sibling::employee))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of the preceding-sibling axis that is part of an "except" operation. Both operands are different. . */ @org.junit.Test public void precedingSibling15() { final XQuery query = new XQuery( "(/works[1]/employee[12]/overtime/day) except (/works[1]/employee[12]/overtime/day[2]/preceding-sibling::day)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Tuesday", false) ); } /** * Evaluation of the preceding-sibling axis that is part of a boolean expression ("and" and fn:true(). . */ @org.junit.Test public void precedingSibling16() { final XQuery query = new XQuery( "(/works[1]/employee[12]/preceding-sibling::employee) and fn:true()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the preceding-sibling axis that is part of a boolean expression ("and" and fn:false()). . */ @org.junit.Test public void precedingSibling17() { final XQuery query = new XQuery( "(/works[1]/employee[12]/preceding-sibling::employee) and fn:false()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the preceding-sibling axis that is part of a boolean expression ("or" and fn:true()). . */ @org.junit.Test public void precedingSibling18() { final XQuery query = new XQuery( "(/works[1]/employee[12]/preceding-sibling::employee) or fn:true()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the preceding-sibling axis that is part of a boolean expression ("or" and fn:false()). . */ @org.junit.Test public void precedingSibling19() { final XQuery query = new XQuery( "(/works[1]/employee[12]/preceding-sibling::employee) or fn:false()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the preceding-sibling axis for which the given node does not exists. Uses fn:count to avoid empty file. . */ @org.junit.Test public void precedingSibling2() { final XQuery query = new XQuery( "fn:count(/works/employee[1]/preceding-sibling::noSuchNode)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of the preceding-sibling axis that used as part of the deep-equal-function. . */ @org.junit.Test public void precedingSibling20() { final XQuery query = new XQuery( "fn:deep-equal(/works[1]/employee[12]/preceding-sibling::employee,/works[1]/employee[12]/preceding-sibling::employee)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the preceding-sibling axis used together with a newly constructed element. Uses fn:count to avoid empty file. . */ @org.junit.Test public void precedingSibling21() { final XQuery query = new XQuery( "let $var := Some Content return fn:count($var/preceding-sibling::*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluation of the preceding-sibling axis that is part of an "is" expression (return true). . */ @org.junit.Test public void precedingSibling3() { final XQuery query = new XQuery( "exactly-one(/works/employee[2]/preceding-sibling::employee) is exactly-one(/works/employee[1])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the preceding-sibling axis that is part of an "is" expression (return false). . */ @org.junit.Test public void precedingSibling4() { final XQuery query = new XQuery( "exactly-one(/works[1]/employee[2]/preceding-sibling::employee) is exactly-one(/works[1]/employee[2])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the preceding-sibling axis that is part of an "node before" expression (return true). . */ @org.junit.Test public void precedingSibling5() { final XQuery query = new XQuery( "exactly-one(/works[1]/employee[2]/preceding-sibling::employee) << exactly-one(/works[1]/employee[2])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the preceding-sibling axis that is part of an "node before" expression and both operands are the same (return false). . */ @org.junit.Test public void precedingSibling6() { final XQuery query = new XQuery( "exactly-one(/works[1]/employee[2]/preceding-sibling::employee) << exactly-one(/works[1]/employee[2]/preceding-sibling::employee)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the preceding-sibling axis that is part of an "node before" expression both operands are differents (return false). . */ @org.junit.Test public void precedingSibling7() { final XQuery query = new XQuery( "exactly-one(/works[1]/employee[2]/preceding-sibling::employee) << exactly-one(/works[1])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of the preceding-sibling axis that is part of a "node after" expression (returns true). . */ @org.junit.Test public void precedingSibling8() { final XQuery query = new XQuery( "exactly-one(/works[1]/employee[13]) >> exactly-one(/works[1]/employee[12]/preceding-sibling::employee[1])", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of the preceding-sibling axis that is part of an "node after" expression with both operands the same (returns false). . */ @org.junit.Test public void precedingSibling9() { final XQuery query = new XQuery( "exactly-one(/works[1]/employee[2]/preceding-sibling::employee) >> exactly-one(/works[1]/employee[2]/preceding-sibling::employee)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Apply the preceding-sibling axis to an attribute node. . */ @org.junit.Test public void precedingSiblingAttr() { final XQuery query = new XQuery( " 4 5 6 /@c/preceding-sibling::node()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * Evaluate "preceding-sibling::employee[fn:position() = 1]". Selects the previous employee sibling of the context node. . */ @org.junit.Test public void unabbreviatedSyntax25() { final XQuery query = new XQuery( "for $h in (/works/employee[2]) return $h/preceding-sibling::employee[fn:position() = 1]", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n E1\n P1\n 40\n ", false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdAxisStepUnabbr.java000066400000000000000000000462171222453003200310410ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the AxisStep production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdAxisStepUnabbr extends QT3TestSet { /** * Evaluate the child axis of the context node (child::empnum) . */ @org.junit.Test public void unabbreviatedSyntax1() { final XQuery query = new XQuery( "for $h in (/works/employee) return $h/child::empnum", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("E1E1E1E1E1E1E2E2E3E3E4E4E4", false) ); } /** * Evaluate selecting an descendant or self (descendant-or-self::employee)- Select the "employee" descendants of the context node and if the context is "employee" select it as well. . */ @org.junit.Test public void unabbreviatedSyntax12() { final XQuery query = new XQuery( "for $h in (/works/employee[1]) return $h/descendant-or-self::employee", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n E1\n P1\n 40\n ", false) ); } /** * Evaluate self (self::employee)- Select the context node, if it is an "employee", otherwise return empty sequence This test selects an "employee" element . */ @org.junit.Test public void unabbreviatedSyntax13() { final XQuery query = new XQuery( "for $h in (/works/employee[1]) return $h/self::employee", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n E1\n P1\n 40\n ", false) ); } /** * Evaluate self (self::hours)- Select the context node, if it is an "employee", otherwise return empty sequence This test selects an empty sequence. . */ @org.junit.Test public void unabbreviatedSyntax14() { final XQuery query = new XQuery( "for $h in (/works[1]/employee[1]) return fn:count(($h/self::employee[1000]))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Evaluate more on child/descendant (child::employee/descendant:empnum)- selects the empnum element descendants of the employee element children of the context node . */ @org.junit.Test public void unabbreviatedSyntax15() { final XQuery query = new XQuery( "for $h in (/works) return $h/child::employee/descendant::empnum", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("E1E1E1E1E1E1E2E2E3E3E4E4E4", false) ); } /** * Evaluate child::* /child::pnum - Selects the "pnum" grandchildren of the context node . */ @org.junit.Test public void unabbreviatedSyntax16() { final XQuery query = new XQuery( "for $h in (/works) return $h/child::*/child::pnum", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("P1P2P3P4P5P6P1P2P2P2P2P4P5", false) ); } /** * Evaluate /descendant::pnum selects all the pnum elements in the same document as the context node. . */ @org.junit.Test public void unabbreviatedSyntax18() { final XQuery query = new XQuery( "for $h in (/works) return $h/descendant::pnum", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("P1P2P3P4P5P6P1P2P2P2P2P4P5", false) ); } /** * Evaluate "/descendant::employee/child::pnum" - Selects all the pnum elements that have an "employee" parent and that are in the same document as the context node. . */ @org.junit.Test public void unabbreviatedSyntax19() { final XQuery query = new XQuery( "for $h in (/works) return $h/descendant::employee/child::pnum", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("P1P2P3P4P5P6P1P2P2P2P2P4P5", false) ); } /** * Evaluate selecting all element children of the context node . */ @org.junit.Test public void unabbreviatedSyntax2() { final XQuery query = new XQuery( "for $h in (/works/employee[1]) return $h/child::*", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("E1P140", false) ); } /** * Evaluate "child::employee[fn:position() = 1]". Selects the first employee child of the context node. . */ @org.junit.Test public void unabbreviatedSyntax20() { final XQuery query = new XQuery( "for $h in (/works) return $h/child::employee[fn:position() = 1]", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n E1\n P1\n 40\n ", false) ); } /** * Evaluate "child::employee[fn:position() = fn:last()]" selects the previous to the one "employee" child of the context node. . */ @org.junit.Test public void unabbreviatedSyntax21() { final XQuery query = new XQuery( "for $h in (/works) return $h/child::employee[fn:position() = fn:last()]", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n E4\n P5\n 80\n active\n ", false) ); } /** * Evaluate "child::employee[fn:position() = fn:last()-1]" Selects the last but one "employee" child of the context node. . */ @org.junit.Test public void unabbreviatedSyntax22() { final XQuery query = new XQuery( "for $h in (/works) return $h/child::employee[fn:position() = fn:last()-1]", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n E4\n P4\n 40\n \n Monday\n Tuesday\n \n ", false) ); } /** * Evaluate "child::hours[fn:position() > 1]". Selects all the hours children of the context node other than the first hours child of the context node. . */ @org.junit.Test public void unabbreviatedSyntax23() { final XQuery query = new XQuery( "for $h in (/works/employee) return $h/child::hours[fn:position() > 1]", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("204030", false) ); } /** * Evaluate "/descendant::employee[fn:position() = 12]". Selects the twelfth employee element in the document containing the context node. . */ @org.junit.Test public void unabbreviatedSyntax26() { final XQuery query = new XQuery( "for $h in (/works) return $h/descendant::employee[fn:position() = 12]", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n E4\n P4\n 40\n \n Monday\n Tuesday\n \n ", false) ); } /** * Evaluate "/child::works/child::employee[fn:position() = 5]/child::hours[fn:position() = 2]". Selects the second hour of the fifth employee of the works whose parent is the document node that contains the context node. . */ @org.junit.Test public void unabbreviatedSyntax27() { final XQuery query = new XQuery( "/child::works/child::employee[fn:position() = 5]/child::hours[fn:position() = 2]", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("30", false) ); } /** * Evaluate "child::employee[attribute::name eq "Jane Doe 11"]". Selects all "employee" children of the context node that have a "name" attribute with value "Jane Doe 11". . */ @org.junit.Test public void unabbreviatedSyntax28() { final XQuery query = new XQuery( "for $h in (/works) return $h/child::employee[attribute::name eq \"Jane Doe 11\"]", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n E4\n P2\n 20\n ", false) ); } /** * Evaluate "child::employee[attribute::gender eq 'female'][fn:position() = 5]". Selects the fifth employee child of the context node that has a gender attribute with value "female". . */ @org.junit.Test public void unabbreviatedSyntax29() { final XQuery query = new XQuery( "for $h in (/works) return $h/child::employee[attribute::gender eq 'female'][fn:position() = 5]", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n E3\n P2\n 20\n ", false) ); } /** * Evaluate selecting all text node children of the context node . */ @org.junit.Test public void unabbreviatedSyntax3() { final XQuery query = new XQuery( "for $h in (/works[1]/employee[2]) return $h/child::text()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "Text data from Employee[2]") ); } /** * Evaluate "child::employee[child::empnum = 'E3']". Selects the employee children of the context node that have one or more empnum children whose typed value is equal to the string "E3". . */ @org.junit.Test public void unabbreviatedSyntax30() { final XQuery query = new XQuery( "for $h in (/works) return $h/child::employee[child::empnum = 'E3']", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n E3\n P2\n 20\n \n E3\n P2\n 20\n ", false) ); } /** * Evaluate "child::employee[child::status]". Selects the employee children of the context node that have one or more status children. . */ @org.junit.Test public void unabbreviatedSyntax31() { final XQuery query = new XQuery( "for $h in (/works) return $h/child::employee[child::status]", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n E4\n P5\n 80\n active\n ", false) ); } /** * Evaluate "child::*[self::pnum or self::empnum]". Selects the pnum and empnum children of the context node. . */ @org.junit.Test public void unabbreviatedSyntax32() { final XQuery query = new XQuery( "for $h in (/works/employee[7]) return $h/child::*[self::pnum or self::empnum]", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("E2P1", false) ); } /** * Evaluate "child::*[self::empnum or self::pnum][fn:position() = fn:last()]". Selects the last empnum or pnum child of the context node. . */ @org.junit.Test public void unabbreviatedSyntax33() { final XQuery query = new XQuery( "for $h in (/works/employee[6]) return $h/child::*[self::empnum or self::pnum][fn:position() = fn:last()]", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("P6", false) ); } /** * Evaluate selecting all children of the context node . */ @org.junit.Test public void unabbreviatedSyntax4() { final XQuery query = new XQuery( "for $h in (/works/employee[1]) return $h/child::node()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n E1\n P1\n 40\n ", false) ); } /** * Evaluate selecting all the children the context node (child::node). . */ @org.junit.Test public void unabbreviatedSyntax5() { final XQuery query = new XQuery( "for $h in (/works/employee[2]) return $h/child::node()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n E1\n P2\n 70\n 20Text data from Employee[2]\n ", false) ); } /** * Evaluate selecting the parent (parent::node()) of the context node . */ @org.junit.Test public void unabbreviatedSyntax8() { final XQuery query = new XQuery( "for $h in (/works/employee[1]/hours) return $h/parent::node()", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n E1\n P1\n 40\n ", false) ); } /** * Evaluate selecting a descendant (descendant::empnum)- Select the "empnum" descendants of the context node . */ @org.junit.Test public void unabbreviatedSyntax9() { final XQuery query = new XQuery( "for $h in (/works/employee) return $h/descendant::empnum", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("E1E1E1E1E1E1E2E2E3E3E4E4E4", false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdBaseURIDecl.java000066400000000000000000000525151222453003200301670ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the BaseURIDecl production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdBaseURIDecl extends QT3TestSet { /** * Test 'declare base-uri' with fn:static-base-uri(). . */ @org.junit.Test public void kBaseURIProlog1() { final XQuery query = new XQuery( "\n" + " declare(::)base-uri(::)\"http://example.com/declareBaseURITest\"; \n" + " static-base-uri() eq 'http://example.com/declareBaseURITest'\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Two 'declare base-uri' expressions, where the URIs differs. . */ @org.junit.Test public void kBaseURIProlog2() { final XQuery query = new XQuery( "\n" + " declare(::)base-uri(::)\"http://example.com/declareBaseURITest\"; \n" + " declare(::)base-uri(::)\"http://example.com/declareBaseURITest2\"; 1 eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0032") ); } /** * Two 'declare base-uri' expressions, where the URIs are equal. . */ @org.junit.Test public void kBaseURIProlog3() { final XQuery query = new XQuery( "\n" + " declare(::)base-uri(::)\"http://example.com/declareBaseURITest\"(::); \n" + " declare(::)base-uri(::)\"http://example.com/declareBaseURITest\"(::); 1 eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0032") ); } /** * Specify an invalid URI. . */ @org.junit.Test public void k2BaseURIProlog1() { final XQuery query = new XQuery( "declare base-uri \"http:\\\\invalid>URI\\someURI\"; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1") || error("XQST0046") ) ); } /** * A base-uri declaration with a Windows file path which is invalid. . */ @org.junit.Test public void k2BaseURIProlog2() { final XQuery query = new XQuery( "declare base-uri \"c:\\windows\"; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1") || error("XQST0046") ) ); } /** * A base-uri declaration with a Windows file path which is invalid, and which is being used by a call to fn:doc(). . */ @org.junit.Test public void k2BaseURIProlog3() { final XQuery query = new XQuery( "declare base-uri \"c:\\windows\"; fn:doc(\"example.com.xml\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQST0046") || error("FODC0005") || error("FODC0002") ) ); } /** * The static base-uri must be absolute. Since the declaration supplies a relative URI, * an implementation may fail with computing an absolute URI, hence XPST0001 is allowed. * The test checks that the static base-uri is absolute. . */ @org.junit.Test public void k2BaseURIProlog4() { final XQuery query = new XQuery( "declare base-uri \"abc\"; declare function local:isAbsolute($uri as xs:string?) as xs:boolean { fn:matches($uri, \"[a-zA-Z0-9\\-.]*:/\") }; local:isAbsolute(fn:static-base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0001") ) ); } /** * Use an empty use as base-uri. Since the implementation may fail with determining the base-uri, XPST0001 is allowed. . */ @org.junit.Test public void k2BaseURIProlog5() { final XQuery query = new XQuery( "declare base-uri \"\"; ends-with(fn:static-base-uri(), \"prod/BaseURIDecl.xml\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0001") ) ); } /** * The static base-uri is not affected by xml:base declarations on direct element constructors. . */ @org.junit.Test public void k2BaseURIProlog6() { final XQuery query = new XQuery( "declare base-uri \"http://example.com/BASEURI\"; {fn:static-base-uri()} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("http://example.com/BASEURI", false) ); } /** * Ensure the 'base-uri' keyword is parsed correctly. . */ @org.junit.Test public void k2BaseURIProlog7() { final XQuery query = new XQuery( "base-uri lt base-uri", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Test for declaration of base-uri twice. . */ @org.junit.Test public void baseURI1() { final XQuery query = new XQuery( "declare base-uri \"http://example.org\"; declare base-uri \"http://example.org\"; \"aaa\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0032") ); } /** * Evaluates base-uri with the fn:static-base-uri function. base-uri not defined Use fn:count to avoid empty file . */ @org.junit.Test public void baseURI10() { final XQuery query = new XQuery( "fn:count(fn:static-base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || assertEq("1") ) ); } /** * Evaluates base-uri property can contain numbers. Used with static-base--uri function. . */ @org.junit.Test public void baseURI11() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com/abc123\"; fn:string(fn:static-base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/abc123") ); } /** * Evaluates base-uri property can contain an escape quote. Used with static-base--uri function. . */ @org.junit.Test public void baseURI12() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com/abc\"\"\"; fn:string(fn:static-base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "http://www.example.com/abc\"") || error("XQST0046") ) ); } /** * Evaluates base-uri property can contain an escape apostrophe. Used with static-base--uri function. . */ @org.junit.Test public void baseURI13() { final XQuery query = new XQuery( "declare base-uri 'http://www.example.com/abc'''; fn:string(fn:static-base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/abc'") ); } /** * Evaluates base-uri property can contain "##0;". Used with static-base--uri function. . */ @org.junit.Test public void baseURI14() { final XQuery query = new XQuery( "declare base-uri 'http://www.example.com/abc##0;'; fn:string(fn:static-base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "http://www.example.com/abc##0;") || error("XQST0046") ) ); } /** * Evaluates base-uri property can contain a single character (after the "http://"section). Used with static-base-uri function. . */ @org.junit.Test public void baseURI15() { final XQuery query = new XQuery( "declare base-uri \"http://A\"; fn:string(fn:static-base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://A") ); } /** * Evaluates base-uri property can contain the string " (newline)". Used with static-base--uri function. . */ @org.junit.Test public void baseURI18() { final XQuery query = new XQuery( "declare base-uri \"http:/www.abc .com\"; fn:string(fn:static-base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "http:/www.abc .com") || error("XQST0046") ) ); } /** * Evaluates base-uri property can contain "declarebase-uri". Used with static-base--uri function. . */ @org.junit.Test public void baseURI19() { final XQuery query = new XQuery( "declare base-uri \"http://declarebase-uri.com\"; fn:string(fn:static-base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "http://declarebase-uri.com") || error("XQST0046") ) ); } /** * Verify that a base uri declaration containing "abc<" is a valid base-uri declaration. . */ @org.junit.Test public void baseURI2() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com/abc<\"; \"aaa\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "aaa") || error("XQST0046") ) ); } /** * Evaluates that base-uri property can contain "base-uri". Used with static-base--uri function. . */ @org.junit.Test public void baseURI20() { final XQuery query = new XQuery( "declare base-uri \"http://www.base-uri.com\"; fn:string(fn:static-base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.base-uri.com") ); } /** * Evaluates that base-uri property can contain "BASE-URI". Used with static-base-uri function. . */ @org.junit.Test public void baseURI21() { final XQuery query = new XQuery( "declare base-uri \"http://www.BASE-URI.com\"; fn:string(fn:static-base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.BASE-URI.com") ); } /** * Verify normalization of xs:anyURI (leading spaces). Used with static-base--uri function. . */ @org.junit.Test public void baseURI22() { final XQuery query = new XQuery( "declare base-uri \" http://www.example.org/examples\"; fn:string(fn:static-base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.org/examples") ); } /** * Verify normalization of xs:anyURI (trailing spaces). Used with static-base--uri function. . */ @org.junit.Test public void baseURI23() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.org/examples \"; fn:string(fn:static-base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.org/examples") ); } /** * Verify normalization of xs:anyURI (whitespaces in the middle). Used with static-base--uri function. . */ @org.junit.Test public void baseURI24() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.org/ examples\"; fn:string(fn:static-base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "http://www.example.org/ examples") || error("XQST0046") ) ); } /** * Verify that a base-uri declaration containing "abc>" is a valid base-uri declaration. . */ @org.junit.Test public void baseURI3() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com/abc>\"; \"aaa\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "aaa") || error("XQST0046") ) ); } /** * Verify that a base-uri declaration containing "abc&" is a valid base-uri declaration. . */ @org.junit.Test public void baseURI4() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com/abc&\"; \"aaa\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "aaa") ); } /** * Verify that a base-uri declaration containing "abc"" is a valid base-uri declaration. . */ @org.junit.Test public void baseURI5() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com/abc"\"; \"aaa\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "aaa") || error("XQST0046") ) ); } /** * Verify that a base-uri declaration containing "abc'" is a valid base-uri declaration. . */ @org.junit.Test public void baseURI6() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com/abc'\"; \"aaa\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "aaa") ); } /** * Evaluates base-uri with the fn:resolve-uri function. Typical usage . */ @org.junit.Test public void baseURI7() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com/\"; fn:string(fn:resolve-uri(\"examples\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/examples") ); } /** * Evaluates base-uri with the fn:resolve-uri function. Base URI not initialized . */ @org.junit.Test public void baseURI8() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.org\"; \n" + " declare function eg:noContextFunction() { \n" + " if (fn:static-base-uri() eq fn:resolve-uri(\"examples\")) then \"true\" else \"true\" \n" + " }; \n" + " eg:noContextFunction()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "true") || error("FONS0005") ) ); } /** * Evaluates base-uri with the fn:static-base-uri function. Typical usage . */ @org.junit.Test public void baseURI9() { final XQuery query = new XQuery( "declare base-uri \"http://example.org\"; fn:string(fn:static-base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.org") ); } /** * Test the base uri declaration in an imported module.. */ @org.junit.Test public void baseURIModules001() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.org/base1\";\n" + " import module namespace m =\"http://www.w3.org/TestModules/module-001\";\n" + " static-base-uri() eq m:static-base-uri()\n" + " ", ctx); try { query.addModule("http://www.w3.org/TestModules/module-001", file("prod/BaseURIDecl/module-001.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Verify normalization of xs:anyURI (encoded whitespaces in the middle). Used with static-base--uri function. . */ @org.junit.Test public void baseUri25() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.org/%20%20examples\"; fn:string(fn:static-base-uri())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.org/%20%20examples") ); } /** * Evaluation of base-uri set to a relative value. . */ @org.junit.Test public void baseUri26() { final XQuery query = new XQuery( "declare base-uri \"abc\"; fn:ends-with(fn:string(fn:static-base-uri()),\"abc\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * relative base-uri . */ @org.junit.Test public void baseUri27() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com/\"; fn:base-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/fluster") ); } /** * relative base-uri through parent . */ @org.junit.Test public void baseUri28() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com/\"; fn:base-uri(exactly-one(()/a))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/fluster") ); } /** * relative base-uri through parent . */ @org.junit.Test public void baseUri29() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com/\"; fn:base-uri(exactly-one(()/a))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/fluster/now") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdBoundarySpaceDecl.java000066400000000000000000000362401222453003200314710ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the BoundarySpaceDecl production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdBoundarySpaceDecl extends QT3TestSet { /** * A simple 'declare boundary-space' declaration, specifying 'preserve'. . */ @org.junit.Test public void kBoundarySpaceProlog1() { final XQuery query = new XQuery( "(::)declare(::)boundary-space(::)strip(::); 1 eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A simple 'declare boundary-space' declaration, specifying 'strip'. . */ @org.junit.Test public void kBoundarySpaceProlog2() { final XQuery query = new XQuery( "(::)declare(::)boundary-space(::)strip(::); 1 eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Two 'declare boundary-space' declarations are invalid. . */ @org.junit.Test public void kBoundarySpaceProlog3() { final XQuery query = new XQuery( "(::)declare(::)boundary-space(::)strip(::); (::)declare(::)boundary-space(::)preserve(::); 1 eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0068") ); } /** * The expression 'declare boundary space' is invalid. . */ @org.junit.Test public void kBoundarySpaceProlog4() { final XQuery query = new XQuery( "(::)declare(::)boundary space(::)strip(::); 1 eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Ensure the 'boundary-space' keyword is parsed correctly. . */ @org.junit.Test public void k2BoundarySpaceProlog1() { final XQuery query = new XQuery( "boundary-space ne boundary-space", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Demonstrates stripping/preserving of boundary spaces by element constructors during processing of the query . */ @org.junit.Test public void boundarySpace001() { final XQuery query = new XQuery( "declare boundary-space strip; {\"abc\"} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("abc", false) ); } /** * Demonstrates stripping/preserving of boundary spaces by element constructors during processing of the query . */ @org.junit.Test public void boundarySpace002() { final XQuery query = new XQuery( "declare boundary-space preserve; {\"abc\"} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" abc ", false) ); } /** * Demonstrates stripping/preserving of boundary spaces by element constructors during processing of the query . */ @org.junit.Test public void boundarySpace003() { final XQuery query = new XQuery( "declare boundary-space strip; z {\"abc\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" z abc", false) ); } /** * Demonstrates stripping/preserving of boundary spaces by element constructors during processing of the query . */ @org.junit.Test public void boundarySpace004() { final XQuery query = new XQuery( "declare boundary-space preserve; z {\"abc\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" z abc", false) ); } /** * Demonstrates stripping/preserving of boundary spaces by element constructors during processing of the query . */ @org.junit.Test public void boundarySpace005() { final XQuery query = new XQuery( "declare boundary-space strip; {\"abc\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" abc", false) ); } /** * Demonstrates stripping/preserving of boundary spaces by element constructors during processing of the query . */ @org.junit.Test public void boundarySpace006() { final XQuery query = new XQuery( "declare boundary-space preserve; {\"abc\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" abc", false) ); } /** * Demonstrates stripping/preserving of boundary spaces by element constructors during processing of the query . */ @org.junit.Test public void boundarySpace007() { final XQuery query = new XQuery( "declare boundary-space strip; {\"abc\"}{' '}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" abc ", false) ); } /** * Demonstrates stripping/preserving of boundary spaces by element constructors during processing of the query . */ @org.junit.Test public void boundarySpace008() { final XQuery query = new XQuery( "declare boundary-space preserve; {\"abc\"}{' '}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" abc ", false) ); } /** * Demonstrates stripping/preserving of boundary spaces by element constructors during processing of the query . */ @org.junit.Test public void boundarySpace009() { final XQuery query = new XQuery( "declare boundary-space strip; {\"abc\"}{\" \"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" abc ", false) ); } /** * Demonstrates stripping/preserving of boundary spaces by element constructors during processing of the query . */ @org.junit.Test public void boundarySpace010() { final XQuery query = new XQuery( "declare boundary-space preserve; {\"abc\"}{\" \"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" abc ", false) ); } /** * Demonstrates stripping/preserving of boundary spaces by element constructors during processing of the query . */ @org.junit.Test public void boundarySpace011() { final XQuery query = new XQuery( "\n" + "declare boundary-space strip;\n" + "\n" + "a\n" + "b\n" + "c\n" + "\n" + "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\na\nb\nc\n", false) ); } /** * Demonstrates stripping/preserving of boundary spaces by element constructors during processing of the query . */ @org.junit.Test public void boundarySpace012() { final XQuery query = new XQuery( "\n" + "declare boundary-space preserve;\n" + "\n" + "a\n" + "b\n" + "c\n" + "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\na\nb\nc\n", false) ); } /** * Demonstrates stripping/preserving of boundary spaces by element constructors during processing of the query . */ @org.junit.Test public void boundarySpace013() { final XQuery query = new XQuery( "\n" + "declare boundary-space strip;\n" + "\n" + " a\n" + " b\n" + " c\n" + "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n a\n b\n c\n", false) ); } /** * Demonstrates stripping/preserving of boundary spaces by element constructors during processing of the query . */ @org.junit.Test public void boundarySpace014() { final XQuery query = new XQuery( "\n" + "declare boundary-space preserve;\n" + "\n" + " a\n" + " b\n" + " c\n" + "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n a\n b\n c\n", false) ); } /** * Demonstrates stripping/preserving of boundary spaces by element constructors during processing of the query . */ @org.junit.Test public void boundarySpace015() { final XQuery query = new XQuery( "\n" + "declare boundary-space strip;\n" + " A {\"B\"} C {\"D\"} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" A B C D", false) ); } /** * Demonstrates stripping/preserving of boundary spaces by element constructors during processing of the query . */ @org.junit.Test public void boundarySpace016() { final XQuery query = new XQuery( "\n" + "declare boundary-space preserve;\n" + " A {\"B\"} C {\"D\"} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" A B C D ", false) ); } /** * Demonstrates stripping/preserving of boundary spaces by element constructors during processing of the query . */ @org.junit.Test public void boundarySpace017() { final XQuery query = new XQuery( "\n" + "declare boundary-space strip;\n" + " A {\"B\"} C {\"D \"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" A B C D ", false) ); } /** * Demonstrates stripping/preserving of boundary spaces by element constructors during processing of the query . */ @org.junit.Test public void boundarySpace018() { final XQuery query = new XQuery( "\n" + "declare boundary-space preserve;\n" + " A {\"B\"} C {\"D \"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" A B C D ", false) ); } /** * Demonstrates stripping/preserving of boundary spaces by element constructors during processing of the query . */ @org.junit.Test public void boundarySpace019() { final XQuery query = new XQuery( "\n" + "declare boundary-space strip;\n" + " (a), (b), (c) ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" (a), (b), (c) ", false) ); } /** * Demonstrates stripping/preserving of boundary spaces by element constructors during processing of the query . */ @org.junit.Test public void boundarySpace020() { final XQuery query = new XQuery( "\n" + "declare boundary-space preserve;\n" + " (a), (b), (c) ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" (a), (b), (c) ", false) ); } /** * Demonstrates stripping/preserving of boundary spaces by element constructors during processing of the query . */ @org.junit.Test public void boundarySpace021() { final XQuery query = new XQuery( "declare boundary-space strip; (\" \",10, 20, 30, 40,\" \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, " 10 20 30 40 ") ); } /** * Demonstrates stripping/preserving of boundary spaces by element constructors during processing of the query . */ @org.junit.Test public void boundarySpace022() { final XQuery query = new XQuery( "declare boundary-space preserve; (\" \",10, 20, 30, 40,\" \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, " 10 20 30 40 ") ); } /** * Evaluation of the of a query prolog with two boundary space declarations. . */ @org.junit.Test public void boundaryspacedeclerr1() { final XQuery query = new XQuery( "declare boundary-space preserve; declare boundary-space strip; \"abc\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0068") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdCastExpr.java000066400000000000000000046605361222453003200277120ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the cast expression. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdCastExpr extends QT3TestSet { /** * Try casting xs:untypedAtomic(INF) to xs:untypedAtomic. */ @org.junit.Test public void castAs001() { final XQuery query = new XQuery( "xs:untypedAtomic(\"INF\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** * Try casting xs:untypedAtomic(0.0E0) to xs:untypedAtomic. */ @org.junit.Test public void castAs002() { final XQuery query = new XQuery( "xs:untypedAtomic(\"0.0E0\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0.0E0") ); } /** * Try casting xs:untypedAtomic(true) to xs:untypedAtomic. */ @org.junit.Test public void castAs003() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true") ); } /** * Try casting xs:untypedAtomic(INF) to xs:string. */ @org.junit.Test public void castAs004() { final XQuery query = new XQuery( "xs:untypedAtomic(\"INF\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** * Try casting xs:untypedAtomic(0.0E0) to xs:string. */ @org.junit.Test public void castAs005() { final XQuery query = new XQuery( "xs:untypedAtomic(\"0.0E0\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0.0E0") ); } /** * Try casting xs:untypedAtomic(true) to xs:string. */ @org.junit.Test public void castAs006() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true") ); } /** * Try casting xs:untypedAtomic(-0.0E0) to xs:float. */ @org.junit.Test public void castAs007() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-0.0E0\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Try casting xs:untypedAtomic(NaN) to xs:float. */ @org.junit.Test public void castAs008() { final XQuery query = new XQuery( "xs:untypedAtomic(\"NaN\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Try casting xs:untypedAtomic(1e-5) to xs:float. */ @org.junit.Test public void castAs009() { final XQuery query = new XQuery( "xs:untypedAtomic(\"1e-5\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0.00001") ); } /** * Try casting xs:untypedAtomic(-10000000) to xs:float. */ @org.junit.Test public void castAs010() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-10000000\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.0E7") ); } /** * Try casting xs:untypedAtomic(true) to xs:float. */ @org.junit.Test public void castAs011() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:untypedAtomic(-0.0E0) to xs:double. */ @org.junit.Test public void castAs012() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-0.0E0\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Try casting xs:untypedAtomic(NaN) to xs:double. */ @org.junit.Test public void castAs013() { final XQuery query = new XQuery( "xs:untypedAtomic(\"NaN\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Try casting xs:untypedAtomic(1e-5) to xs:double. */ @org.junit.Test public void castAs014() { final XQuery query = new XQuery( "xs:untypedAtomic(\"1e-5\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0.00001") ); } /** * Try casting xs:untypedAtomic(-10000000) to xs:double. */ @org.junit.Test public void castAs015() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-10000000\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.0E7") ); } /** * Try casting xs:untypedAtomic(true) to xs:double. */ @org.junit.Test public void castAs016() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:untypedAtomic(-0.0E0) to xs:decimal. */ @org.junit.Test public void castAs017() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-0.0E0\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:untypedAtomic(NaN) to xs:decimal. */ @org.junit.Test public void castAs018() { final XQuery query = new XQuery( "xs:untypedAtomic(\"NaN\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:untypedAtomic(1e-5) to xs:decimal. */ @org.junit.Test public void castAs019() { final XQuery query = new XQuery( "xs:untypedAtomic(\"1e-5\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:untypedAtomic(5.5432) to xs:decimal. */ @org.junit.Test public void castAs020() { final XQuery query = new XQuery( "xs:untypedAtomic(\"5.5432\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5.5432") ); } /** * Try casting xs:untypedAtomic(true) to xs:decimal. */ @org.junit.Test public void castAs021() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:untypedAtomic(-0.0E0) to xs:integer. */ @org.junit.Test public void castAs022() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-0.0E0\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:untypedAtomic(NaN) to xs:integer. */ @org.junit.Test public void castAs023() { final XQuery query = new XQuery( "xs:untypedAtomic(\"NaN\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:untypedAtomic(1e-5) to xs:integer. */ @org.junit.Test public void castAs024() { final XQuery query = new XQuery( "xs:untypedAtomic(\"1e-5\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:untypedAtomic(-1.1234) to xs:integer. */ @org.junit.Test public void castAs025() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-1.1234\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:untypedAtomic(true) to xs:integer. */ @org.junit.Test public void castAs026() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:untypedAtomic(P1Y2M3DT10H30M23S) to xs:duration. */ @org.junit.Test public void castAs027() { final XQuery query = new XQuery( "xs:untypedAtomic(\"P1Y2M3DT10H30M23S\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1Y2M3DT10H30M23S") ); } /** * Try casting xs:untypedAtomic(-P1Y1M1DT1H1M1.123S) to xs:duration. */ @org.junit.Test public void castAs028() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-P1Y1M1DT1H1M1.123S\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P1Y1M1DT1H1M1.123S") ); } /** * Try casting xs:untypedAtomic(true) to xs:duration. */ @org.junit.Test public void castAs029() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:untypedAtomic(-P1Y1M1DT1H1M1.123S) to xs:yearMonthDuration. */ @org.junit.Test public void castAs030() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-P1Y1M1DT1H1M1.123S\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:untypedAtomic(P24M) to xs:yearMonthDuration. */ @org.junit.Test public void castAs031() { final XQuery query = new XQuery( "xs:untypedAtomic(\"P24M\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P2Y") ); } /** * Try casting xs:untypedAtomic(-P21M) to xs:yearMonthDuration. */ @org.junit.Test public void castAs032() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-P21M\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P1Y9M") ); } /** * Try casting xs:untypedAtomic(true) to xs:yearMonthDuration. */ @org.junit.Test public void castAs033() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:untypedAtomic(-P1Y1M1DT1H1M1.123S) to xs:dayTimeDuration. */ @org.junit.Test public void castAs034() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-P1Y1M1DT1H1M1.123S\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:untypedAtomic(P3DT10H30M) to xs:dayTimeDuration. */ @org.junit.Test public void castAs035() { final XQuery query = new XQuery( "xs:untypedAtomic(\"P3DT10H30M\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P3DT10H30M") ); } /** * Try casting xs:untypedAtomic(-PT100M) to xs:dayTimeDuration. */ @org.junit.Test public void castAs036() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-PT100M\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-PT1H40M") ); } /** * Try casting xs:untypedAtomic(true) to xs:dayTimeDuration. */ @org.junit.Test public void castAs037() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:untypedAtomic(1999-05-31T13:20:00) to xs:dateTime. */ @org.junit.Test public void castAs038() { final XQuery query = new XQuery( "xs:untypedAtomic(\"1999-05-31T13:20:00\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05-31T13:20:00") ); } /** * Try casting xs:untypedAtomic(-1999-05-31T13:20:00+14:00) to xs:dateTime. */ @org.junit.Test public void castAs039() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-1999-05-31T13:20:00+14:00\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1999-05-31T13:20:00+14:00") ); } /** * Try casting xs:untypedAtomic(2000-01-16T00:00:00Z) to xs:dateTime. */ @org.junit.Test public void castAs040() { final XQuery query = new XQuery( "xs:untypedAtomic(\"2000-01-16T00:00:00Z\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2000-01-16T00:00:00Z") ); } /** * Try casting xs:untypedAtomic(true) to xs:dateTime. */ @org.junit.Test public void castAs041() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:untypedAtomic(13:20:00-05:00) to xs:time. */ @org.junit.Test public void castAs042() { final XQuery query = new XQuery( "xs:untypedAtomic(\"13:20:00-05:00\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "13:20:00-05:00") ); } /** * Try casting xs:untypedAtomic(13:20:02.123) to xs:time. */ @org.junit.Test public void castAs043() { final XQuery query = new XQuery( "xs:untypedAtomic(\"13:20:02.123\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "13:20:02.123") ); } /** * Try casting xs:untypedAtomic(13:20:00Z) to xs:time. */ @org.junit.Test public void castAs044() { final XQuery query = new XQuery( "xs:untypedAtomic(\"13:20:00Z\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "13:20:00Z") ); } /** * Try casting xs:untypedAtomic(true) to xs:time. */ @org.junit.Test public void castAs045() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:untypedAtomic(1999-05-31) to xs:date. */ @org.junit.Test public void castAs046() { final XQuery query = new XQuery( "xs:untypedAtomic(\"1999-05-31\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05-31") ); } /** * Try casting xs:untypedAtomic(-0012-12-03-05:00) to xs:date. */ @org.junit.Test public void castAs047() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-0012-12-03-05:00\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0012-12-03-05:00") ); } /** * Try casting xs:untypedAtomic(1999-05-31Z) to xs:date. */ @org.junit.Test public void castAs048() { final XQuery query = new XQuery( "xs:untypedAtomic(\"1999-05-31Z\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05-31Z") ); } /** * Try casting xs:untypedAtomic(true) to xs:date. */ @org.junit.Test public void castAs049() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:untypedAtomic(1999-05) to xs:gYearMonth. */ @org.junit.Test public void castAs050() { final XQuery query = new XQuery( "xs:untypedAtomic(\"1999-05\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05") ); } /** * Try casting xs:untypedAtomic(-0012-12-05:00) to xs:gYearMonth. */ @org.junit.Test public void castAs051() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-0012-12-05:00\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0012-12-05:00") ); } /** * Try casting xs:untypedAtomic(1999-05Z) to xs:gYearMonth. */ @org.junit.Test public void castAs052() { final XQuery query = new XQuery( "xs:untypedAtomic(\"1999-05Z\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05Z") ); } /** * Try casting xs:untypedAtomic(true) to xs:gYearMonth. */ @org.junit.Test public void castAs053() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:untypedAtomic(1999) to xs:gYear. */ @org.junit.Test public void castAs054() { final XQuery query = new XQuery( "xs:untypedAtomic(\"1999\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999") ); } /** * Try casting xs:untypedAtomic(-0012-05:00) to xs:gYear. */ @org.junit.Test public void castAs055() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-0012-05:00\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0012-05:00") ); } /** * Try casting xs:untypedAtomic(1999Z) to xs:gYear. */ @org.junit.Test public void castAs056() { final XQuery query = new XQuery( "xs:untypedAtomic(\"1999Z\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999Z") ); } /** * Try casting xs:untypedAtomic(true) to xs:gYear. */ @org.junit.Test public void castAs057() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:untypedAtomic(--05-31) to xs:gMonthDay. */ @org.junit.Test public void castAs058() { final XQuery query = new XQuery( "xs:untypedAtomic(\"--05-31\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--05-31") ); } /** * Try casting xs:untypedAtomic(--05-31+14:00) to xs:gMonthDay. */ @org.junit.Test public void castAs059() { final XQuery query = new XQuery( "xs:untypedAtomic(\"--05-31+14:00\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--05-31+14:00") ); } /** * Try casting xs:untypedAtomic(--05-31Z) to xs:gMonthDay. */ @org.junit.Test public void castAs060() { final XQuery query = new XQuery( "xs:untypedAtomic(\"--05-31Z\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--05-31Z") ); } /** * Try casting xs:untypedAtomic(true) to xs:gMonthDay. */ @org.junit.Test public void castAs061() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:untypedAtomic(---31) to xs:gDay. */ @org.junit.Test public void castAs062() { final XQuery query = new XQuery( "xs:untypedAtomic(\"---31\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "---31") ); } /** * Try casting xs:untypedAtomic(---03-05:00) to xs:gDay. */ @org.junit.Test public void castAs063() { final XQuery query = new XQuery( "xs:untypedAtomic(\"---03-05:00\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "---03-05:00") ); } /** * Try casting xs:untypedAtomic(---31Z) to xs:gDay. */ @org.junit.Test public void castAs064() { final XQuery query = new XQuery( "xs:untypedAtomic(\"---31Z\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "---31Z") ); } /** * Try casting xs:untypedAtomic(true) to xs:gDay. */ @org.junit.Test public void castAs065() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:untypedAtomic(--05) to xs:gMonth. */ @org.junit.Test public void castAs066() { final XQuery query = new XQuery( "xs:untypedAtomic(\"--05\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--05") ); } /** * Try casting xs:untypedAtomic(--12-05:00) to xs:gMonth. */ @org.junit.Test public void castAs067() { final XQuery query = new XQuery( "xs:untypedAtomic(\"--12-05:00\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--12-05:00") ); } /** * Try casting xs:untypedAtomic(--05Z) to xs:gMonth. */ @org.junit.Test public void castAs068() { final XQuery query = new XQuery( "xs:untypedAtomic(\"--05Z\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--05Z") ); } /** * Try casting xs:untypedAtomic(true) to xs:gMonth. */ @org.junit.Test public void castAs069() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:untypedAtomic(0.0) to xs:boolean. */ @org.junit.Test public void castAs070() { final XQuery query = new XQuery( "xs:untypedAtomic(\"0.0\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:untypedAtomic(0) to xs:boolean. */ @org.junit.Test public void castAs071() { final XQuery query = new XQuery( "xs:untypedAtomic(\"0\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try casting xs:untypedAtomic(true) to xs:boolean. */ @org.junit.Test public void castAs072() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try casting xs:untypedAtomic(true) to xs:base64Binary. */ @org.junit.Test public void castAs073() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true") ); } /** * Try casting xs:untypedAtomic(00000000) to xs:base64Binary. */ @org.junit.Test public void castAs074() { final XQuery query = new XQuery( "xs:untypedAtomic(\"00000000\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "00000000") ); } /** * Try casting xs:untypedAtomic(D74D35D35D35) to xs:base64Binary. */ @org.junit.Test public void castAs075() { final XQuery query = new XQuery( "xs:untypedAtomic(\"D74D35D35D35\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "D74D35D35D35") ); } /** * Try casting xs:untypedAtomic(true) to xs:hexBinary. */ @org.junit.Test public void castAs076() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:untypedAtomic(010010101) to xs:hexBinary. */ @org.junit.Test public void castAs077() { final XQuery query = new XQuery( "xs:untypedAtomic(\"010010101\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:untypedAtomic(0fb7) to xs:hexBinary. */ @org.junit.Test public void castAs078() { final XQuery query = new XQuery( "xs:untypedAtomic(\"0fb7\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0FB7") ); } /** * Try casting xs:untypedAtomic(D74D35D35D35) to xs:hexBinary. */ @org.junit.Test public void castAs079() { final XQuery query = new XQuery( "xs:untypedAtomic(\"D74D35D35D35\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "D74D35D35D35") ); } /** * Try casting xs:untypedAtomic(-0012-05:00) to xs:anyURI. */ @org.junit.Test public void castAs080() { final XQuery query = new XQuery( "xs:untypedAtomic(\"http://www.example.com/~b%C3%A9b%C3%A9\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/~b%C3%A9b%C3%A9") ); } /** * Try casting xs:untypedAtomic(true) to xs:anyURI. */ @org.junit.Test public void castAs081() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true") ); } /** * Try casting xs:untypedAtomic(http://www.ietf.org/rfc/rfc2396.txt) to xs:anyURI. */ @org.junit.Test public void castAs082() { final XQuery query = new XQuery( "xs:untypedAtomic(\"http://www.ietf.org/rfc/rfc2396.txt\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.ietf.org/rfc/rfc2396.txt") ); } /** * Try casting xs:string(INF) to xs:untypedAtomic. */ @org.junit.Test public void castAs083() { final XQuery query = new XQuery( "xs:string(\"INF\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** * Try casting xs:string(0.0E0) to xs:untypedAtomic. */ @org.junit.Test public void castAs084() { final XQuery query = new XQuery( "xs:string(\"0.0E0\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0.0E0") ); } /** * Try casting xs:string(true) to xs:untypedAtomic. */ @org.junit.Test public void castAs085() { final XQuery query = new XQuery( "xs:string(\"true\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true") ); } /** * Try casting xs:string(INF) to xs:string. */ @org.junit.Test public void castAs086() { final XQuery query = new XQuery( "xs:string(\"INF\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** * Try casting xs:string(0.0E0) to xs:string. */ @org.junit.Test public void castAs087() { final XQuery query = new XQuery( "xs:string(\"0.0E0\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0.0E0") ); } /** * Try casting xs:string(true) to xs:string. */ @org.junit.Test public void castAs088() { final XQuery query = new XQuery( "xs:string(\"true\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true") ); } /** * Try casting xs:string(-0.0E0) to xs:float. */ @org.junit.Test public void castAs089() { final XQuery query = new XQuery( "xs:string(\"-0.0E0\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Try casting xs:string(NaN) to xs:float. */ @org.junit.Test public void castAs090() { final XQuery query = new XQuery( "xs:string(\"NaN\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Try casting xs:string(1e-5) to xs:float. */ @org.junit.Test public void castAs091() { final XQuery query = new XQuery( "xs:string(\"1e-5\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0.00001") ); } /** * Try casting xs:string(-10000000) to xs:float. */ @org.junit.Test public void castAs092() { final XQuery query = new XQuery( "xs:string(\"-10000000\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.0E7") ); } /** * Try casting xs:string(true) to xs:float. */ @org.junit.Test public void castAs093() { final XQuery query = new XQuery( "xs:string(\"true\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:string(-0.0E0) to xs:double. */ @org.junit.Test public void castAs094() { final XQuery query = new XQuery( "xs:string(\"-0.0E0\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Try casting xs:string(NaN) to xs:double. */ @org.junit.Test public void castAs095() { final XQuery query = new XQuery( "xs:string(\"NaN\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Try casting xs:string(1e-5) to xs:double. */ @org.junit.Test public void castAs096() { final XQuery query = new XQuery( "xs:string(\"1e-5\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0.00001") ); } /** * Try casting xs:string(-10000000) to xs:double. */ @org.junit.Test public void castAs097() { final XQuery query = new XQuery( "xs:string(\"-10000000\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.0E7") ); } /** * Try casting xs:string(true) to xs:double. */ @org.junit.Test public void castAs098() { final XQuery query = new XQuery( "xs:string(\"true\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:string(-0.0E0) to xs:decimal. */ @org.junit.Test public void castAs099() { final XQuery query = new XQuery( "xs:string(\"-0.0E0\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:string(NaN) to xs:decimal. */ @org.junit.Test public void castAs100() { final XQuery query = new XQuery( "xs:string(\"NaN\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:string(1e-5) to xs:decimal. */ @org.junit.Test public void castAs101() { final XQuery query = new XQuery( "xs:string(\"1e-5\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:string(5.5432) to xs:decimal. */ @org.junit.Test public void castAs102() { final XQuery query = new XQuery( "xs:string(\"5.5432\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5.5432") ); } /** * Try casting xs:string(true) to xs:decimal. */ @org.junit.Test public void castAs103() { final XQuery query = new XQuery( "xs:string(\"true\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:string(-0.0E0) to xs:integer. */ @org.junit.Test public void castAs104() { final XQuery query = new XQuery( "xs:string(\"-0.0E0\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:string(NaN) to xs:integer. */ @org.junit.Test public void castAs105() { final XQuery query = new XQuery( "xs:string(\"NaN\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:string(1e-5) to xs:integer. */ @org.junit.Test public void castAs106() { final XQuery query = new XQuery( "xs:string(\"1e-5\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:string(-1.1234) to xs:integer. */ @org.junit.Test public void castAs107() { final XQuery query = new XQuery( "xs:string(\"-1.1234\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:string(true) to xs:integer. */ @org.junit.Test public void castAs108() { final XQuery query = new XQuery( "xs:string(\"true\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:string(P1Y2M3DT10H30M23S) to xs:duration. */ @org.junit.Test public void castAs109() { final XQuery query = new XQuery( "xs:string(\"P1Y2M3DT10H30M23S\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1Y2M3DT10H30M23S") ); } /** * Try casting xs:string(-P1Y1M1DT1H1M1.123S) to xs:duration. */ @org.junit.Test public void castAs110() { final XQuery query = new XQuery( "xs:string(\"-P1Y1M1DT1H1M1.123S\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P1Y1M1DT1H1M1.123S") ); } /** * Try casting xs:string(true) to xs:duration. */ @org.junit.Test public void castAs111() { final XQuery query = new XQuery( "xs:string(\"true\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:string(-P1Y1M1DT1H1M1.123S) to xs:yearMonthDuration. */ @org.junit.Test public void castAs112() { final XQuery query = new XQuery( "xs:string(\"-P1Y1M1DT1H1M1.123S\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:string(P24M) to xs:yearMonthDuration. */ @org.junit.Test public void castAs113() { final XQuery query = new XQuery( "xs:string(\"P24M\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P2Y") ); } /** * Try casting xs:string(-P21M) to xs:yearMonthDuration. */ @org.junit.Test public void castAs114() { final XQuery query = new XQuery( "xs:string(\"-P21M\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P1Y9M") ); } /** * Try casting xs:string(true) to xs:yearMonthDuration. */ @org.junit.Test public void castAs115() { final XQuery query = new XQuery( "xs:string(\"true\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:string(-P1Y1M1DT1H1M1.123S) to xs:dayTimeDuration. */ @org.junit.Test public void castAs116() { final XQuery query = new XQuery( "xs:string(\"-P1Y1M1DT1H1M1.123S\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:string(P3DT10H30M) to xs:dayTimeDuration. */ @org.junit.Test public void castAs117() { final XQuery query = new XQuery( "xs:string(\"P3DT10H30M\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P3DT10H30M") ); } /** * Try casting xs:string(-PT100M) to xs:dayTimeDuration. */ @org.junit.Test public void castAs118() { final XQuery query = new XQuery( "xs:string(\"-PT100M\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-PT1H40M") ); } /** * Try casting xs:string(true) to xs:dayTimeDuration. */ @org.junit.Test public void castAs119() { final XQuery query = new XQuery( "xs:string(\"true\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:string(1999-05-31T13:20:00) to xs:dateTime. */ @org.junit.Test public void castAs120() { final XQuery query = new XQuery( "xs:string(\"1999-05-31T13:20:00\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05-31T13:20:00") ); } /** * Try casting xs:string(-1999-05-31T13:20:00+14:00) to xs:dateTime. */ @org.junit.Test public void castAs121() { final XQuery query = new XQuery( "xs:string(\"-1999-05-31T13:20:00+14:00\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1999-05-31T13:20:00+14:00") ); } /** * Try casting xs:string(2000-01-16T00:00:00Z) to xs:dateTime. */ @org.junit.Test public void castAs122() { final XQuery query = new XQuery( "xs:string(\"2000-01-16T00:00:00Z\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2000-01-16T00:00:00Z") ); } /** * Try casting xs:string(true) to xs:dateTime. */ @org.junit.Test public void castAs123() { final XQuery query = new XQuery( "xs:string(\"true\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:string(13:20:00-05:00) to xs:time. */ @org.junit.Test public void castAs124() { final XQuery query = new XQuery( "xs:string(\"13:20:00-05:00\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "13:20:00-05:00") ); } /** * Try casting xs:string(13:20:02.123) to xs:time. */ @org.junit.Test public void castAs125() { final XQuery query = new XQuery( "xs:string(\"13:20:02.123\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "13:20:02.123") ); } /** * Try casting xs:string(13:20:00Z) to xs:time. */ @org.junit.Test public void castAs126() { final XQuery query = new XQuery( "xs:string(\"13:20:00Z\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "13:20:00Z") ); } /** * Try casting xs:string(true) to xs:time. */ @org.junit.Test public void castAs127() { final XQuery query = new XQuery( "xs:string(\"true\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:string(1999-05-31) to xs:date. */ @org.junit.Test public void castAs128() { final XQuery query = new XQuery( "xs:string(\"1999-05-31\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05-31") ); } /** * Try casting xs:string(-0012-12-03-05:00) to xs:date. */ @org.junit.Test public void castAs129() { final XQuery query = new XQuery( "xs:string(\"-0012-12-03-05:00\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0012-12-03-05:00") ); } /** * Try casting xs:string(1999-05-31Z) to xs:date. */ @org.junit.Test public void castAs130() { final XQuery query = new XQuery( "xs:string(\"1999-05-31Z\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05-31Z") ); } /** * Try casting xs:string(true) to xs:date. */ @org.junit.Test public void castAs131() { final XQuery query = new XQuery( "xs:string(\"true\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:string(1999-05) to xs:gYearMonth. */ @org.junit.Test public void castAs132() { final XQuery query = new XQuery( "xs:string(\"1999-05\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05") ); } /** * Try casting xs:string(-0012-12-05:00) to xs:gYearMonth. */ @org.junit.Test public void castAs133() { final XQuery query = new XQuery( "xs:string(\"-0012-12-05:00\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0012-12-05:00") ); } /** * Try casting xs:string(1999-05Z) to xs:gYearMonth. */ @org.junit.Test public void castAs134() { final XQuery query = new XQuery( "xs:string(\"1999-05Z\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05Z") ); } /** * Try casting xs:string(true) to xs:gYearMonth. */ @org.junit.Test public void castAs135() { final XQuery query = new XQuery( "xs:string(\"true\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:string(1999) to xs:gYear. */ @org.junit.Test public void castAs136() { final XQuery query = new XQuery( "xs:string(\"1999\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999") ); } /** * Try casting xs:string(-0012-05:00) to xs:gYear. */ @org.junit.Test public void castAs137() { final XQuery query = new XQuery( "xs:string(\"-0012-05:00\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0012-05:00") ); } /** * Try casting xs:string(1999Z) to xs:gYear. */ @org.junit.Test public void castAs138() { final XQuery query = new XQuery( "xs:string(\"1999Z\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999Z") ); } /** * Try casting xs:string(true) to xs:gYear. */ @org.junit.Test public void castAs139() { final XQuery query = new XQuery( "xs:string(\"true\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:string(--05-31) to xs:gMonthDay. */ @org.junit.Test public void castAs140() { final XQuery query = new XQuery( "xs:string(\"--05-31\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--05-31") ); } /** * Try casting xs:string(--05-31+14:00) to xs:gMonthDay. */ @org.junit.Test public void castAs141() { final XQuery query = new XQuery( "xs:string(\"--05-31+14:00\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--05-31+14:00") ); } /** * Try casting xs:string(--05-31Z) to xs:gMonthDay. */ @org.junit.Test public void castAs142() { final XQuery query = new XQuery( "xs:string(\"--05-31Z\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--05-31Z") ); } /** * Try casting xs:string(true) to xs:gMonthDay. */ @org.junit.Test public void castAs143() { final XQuery query = new XQuery( "xs:string(\"true\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:string(---31) to xs:gDay. */ @org.junit.Test public void castAs144() { final XQuery query = new XQuery( "xs:string(\"---31\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "---31") ); } /** * Try casting xs:string(---03-05:00) to xs:gDay. */ @org.junit.Test public void castAs145() { final XQuery query = new XQuery( "xs:string(\"---03-05:00\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "---03-05:00") ); } /** * Try casting xs:string(---31Z) to xs:gDay. */ @org.junit.Test public void castAs146() { final XQuery query = new XQuery( "xs:string(\"---31Z\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "---31Z") ); } /** * Try casting xs:string(true) to xs:gDay. */ @org.junit.Test public void castAs147() { final XQuery query = new XQuery( "xs:string(\"true\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:string(--05) to xs:gMonth. */ @org.junit.Test public void castAs148() { final XQuery query = new XQuery( "xs:string(\"--05\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--05") ); } /** * Try casting xs:string(--12-05:00) to xs:gMonth. */ @org.junit.Test public void castAs149() { final XQuery query = new XQuery( "xs:string(\"--12-05:00\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--12-05:00") ); } /** * Try casting xs:string(--05Z) to xs:gMonth. */ @org.junit.Test public void castAs150() { final XQuery query = new XQuery( "xs:string(\"--05Z\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--05Z") ); } /** * Try casting xs:string(true) to xs:gMonth. */ @org.junit.Test public void castAs151() { final XQuery query = new XQuery( "xs:string(\"true\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:string(0.0) to xs:boolean. */ @org.junit.Test public void castAs152() { final XQuery query = new XQuery( "xs:string(\"0.0\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:string(0) to xs:boolean. */ @org.junit.Test public void castAs153() { final XQuery query = new XQuery( "xs:string(\"0\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try casting xs:string(true) to xs:boolean. */ @org.junit.Test public void castAs154() { final XQuery query = new XQuery( "xs:string(\"true\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try casting xs:string(true) to xs:base64Binary. */ @org.junit.Test public void castAs155() { final XQuery query = new XQuery( "xs:string(\"true\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true") ); } /** * Try casting xs:string(00000000) to xs:base64Binary. */ @org.junit.Test public void castAs156() { final XQuery query = new XQuery( "xs:string(\"00000000\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "00000000") ); } /** * Try casting xs:string(D74D35D35D35) to xs:base64Binary. */ @org.junit.Test public void castAs157() { final XQuery query = new XQuery( "xs:string(\"D74D35D35D35\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "D74D35D35D35") ); } /** * Try casting xs:string(true) to xs:hexBinary. */ @org.junit.Test public void castAs158() { final XQuery query = new XQuery( "xs:string(\"true\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:string(010010101) to xs:hexBinary. */ @org.junit.Test public void castAs159() { final XQuery query = new XQuery( "xs:string(\"010010101\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try casting xs:string(0fb7) to xs:hexBinary. */ @org.junit.Test public void castAs160() { final XQuery query = new XQuery( "xs:string(\"0fb7\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0FB7") ); } /** * Try casting xs:string(D74D35D35D35) to xs:hexBinary. */ @org.junit.Test public void castAs161() { final XQuery query = new XQuery( "xs:string(\"D74D35D35D35\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "D74D35D35D35") ); } /** * Try casting xs:string(-0012-05:00) to xs:anyURI. */ @org.junit.Test public void castAs162() { final XQuery query = new XQuery( "xs:string(\"http://www.example.com/~b%C3%A9b%C3%A9\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/~b%C3%A9b%C3%A9") ); } /** * Try casting xs:string(true) to xs:anyURI. */ @org.junit.Test public void castAs163() { final XQuery query = new XQuery( "xs:string(\"true\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true") ); } /** * Try casting xs:string(http://www.ietf.org/rfc/rfc2396.txt) to xs:anyURI. */ @org.junit.Test public void castAs164() { final XQuery query = new XQuery( "xs:string(\"http://www.ietf.org/rfc/rfc2396.txt\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.ietf.org/rfc/rfc2396.txt") ); } /** * Try casting xs:float(1e5) to xs:untypedAtomic. */ @org.junit.Test public void castAs165() { final XQuery query = new XQuery( "xs:float(\"1e5\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "100000") ); } /** * Try casting xs:float(-INF) to xs:untypedAtomic. */ @org.junit.Test public void castAs166() { final XQuery query = new XQuery( "xs:float(\"-INF\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-INF") ); } /** * Try casting xs:float(-0.0E0) to xs:string. */ @org.junit.Test public void castAs167() { final XQuery query = new XQuery( "xs:float(\"-0.0E0\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0") ); } /** * Try casting xs:float(NaN) to xs:string. */ @org.junit.Test public void castAs168() { final XQuery query = new XQuery( "xs:float(\"NaN\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Try casting xs:float(5.4321E-100) to xs:float. */ @org.junit.Test public void castAs169() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("FOAR0002") ) ); } /** * Try casting xs:float(-1.75e-3) to xs:float. */ @org.junit.Test public void castAs170() { final XQuery query = new XQuery( "xs:float(\"-1.75e-3\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0.00175") ); } /** * Try casting xs:float(INF) to xs:float. */ @org.junit.Test public void castAs171() { final XQuery query = new XQuery( "xs:float(\"INF\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** * Try casting xs:float(-0.0E0) to xs:double. */ @org.junit.Test public void castAs172() { final XQuery query = new XQuery( "xs:float(\"-0.0E0\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Try casting xs:float(-INF) to xs:double. */ @org.junit.Test public void castAs173() { final XQuery query = new XQuery( "xs:float(\"-INF\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-INF") ); } /** * Try casting xs:float(-0.0E0) to xs:decimal. */ @org.junit.Test public void castAs174() { final XQuery query = new XQuery( "xs:float(\"-0.0E0\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Try casting xs:float(5.4321E-100) to xs:decimal. */ @org.junit.Test public void castAs175() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Try casting xs:float(1e5) to xs:decimal. */ @org.junit.Test public void castAs176() { final XQuery query = new XQuery( "xs:float(\"1e5\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("100000") ); } /** * Try casting xs:float(-1.75e-3) to xs:decimal. */ @org.junit.Test public void castAs177() { final XQuery query = new XQuery( "round-half-to-even(xs:float(\"-1.75e-3\") cast as xs:decimal,5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0.00175") ); } /** * Try casting xs:float(-0.0E0) to xs:integer. */ @org.junit.Test public void castAs178() { final XQuery query = new XQuery( "xs:float(\"-0.0E0\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Try casting xs:float(1e5) to xs:integer. */ @org.junit.Test public void castAs179() { final XQuery query = new XQuery( "xs:float(\"1e5\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("100000") ); } /** * Try casting xs:float(INF) to xs:integer. */ @org.junit.Test public void castAs180() { final XQuery query = new XQuery( "xs:float(\"INF\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Try casting xs:float(-1.75e-3) to xs:duration. */ @org.junit.Test public void castAs181() { final XQuery query = new XQuery( "xs:float(\"-1.75e-3\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:float(5.4321E-100) to xs:yearMonthDuration. */ @org.junit.Test public void castAs182() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || error("FOAR0002") ) ); } /** * Try casting xs:float(5.4321E-100) to xs:dayTimeDuration. */ @org.junit.Test public void castAs183() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || error("FOAR0002") ) ); } /** * Try casting xs:float(5.4321E-100) to xs:dateTime. */ @org.junit.Test public void castAs184() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || error("FOAR0002") ) ); } /** * Try casting xs:float(5.4321E-100) to xs:time. */ @org.junit.Test public void castAs185() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || error("FOAR0002") ) ); } /** * Try casting xs:float(5.4321E-100) to xs:date. */ @org.junit.Test public void castAs186() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || error("FOAR0002") ) ); } /** * Try casting xs:float(5.4321E-100) to xs:gYearMonth. */ @org.junit.Test public void castAs187() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || error("FOAR0002") ) ); } /** * Try casting xs:float(5.4321E-100) to xs:gYear. */ @org.junit.Test public void castAs188() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || error("FOAR0002") ) ); } /** * Try casting xs:float(5.4321E-100) to xs:gMonthDay. */ @org.junit.Test public void castAs189() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || error("FOAR0002") ) ); } /** * Try casting xs:float(5.4321E-100) to xs:gDay. */ @org.junit.Test public void castAs190() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || error("FOAR0002") ) ); } /** * Try casting xs:float(5.4321E-100) to xs:gMonth. */ @org.junit.Test public void castAs191() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || error("FOAR0002") ) ); } /** * Try casting xs:float(-0.0E0) to xs:boolean. */ @org.junit.Test public void castAs192() { final XQuery query = new XQuery( "xs:float(\"-0.0E0\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try casting xs:float(1e5) to xs:boolean. */ @org.junit.Test public void castAs193() { final XQuery query = new XQuery( "xs:float(\"1e5\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try casting xs:float(-INF) to xs:boolean. */ @org.junit.Test public void castAs194() { final XQuery query = new XQuery( "xs:float(\"-INF\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try casting xs:float(NaN) to xs:boolean. */ @org.junit.Test public void castAs195() { final XQuery query = new XQuery( "xs:float(\"NaN\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try casting xs:float(5.4321E-100) to xs:base64Binary. */ @org.junit.Test public void castAs196() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || error("FOAR0002") ) ); } /** * Try casting xs:float(5.4321E-100) to xs:hexBinary. */ @org.junit.Test public void castAs197() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || error("FOAR0002") ) ); } /** * Try casting xs:float(5.4321E-100) to xs:anyURI. */ @org.junit.Test public void castAs198() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || error("FOAR0002") ) ); } /** * Try casting xs:double(1e5) to xs:untypedAtomic. */ @org.junit.Test public void castAs199() { final XQuery query = new XQuery( "xs:double(\"1e5\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "100000") ); } /** * Try casting xs:double(INF) to xs:untypedAtomic. */ @org.junit.Test public void castAs200() { final XQuery query = new XQuery( "xs:double(\"INF\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** * Try casting xs:double(1e8) to xs:string. */ @org.junit.Test public void castAs201() { final XQuery query = new XQuery( "xs:double(\"1e8\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.0E8") ); } /** * Try casting xs:double(INF) to xs:string. */ @org.junit.Test public void castAs202() { final XQuery query = new XQuery( "xs:double(\"INF\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** * Try casting xs:double(-0.0E0) to xs:float. */ @org.junit.Test public void castAs203() { final XQuery query = new XQuery( "xs:double(\"-0.0E0\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-0") ); } /** * Try casting xs:double(5.4321E-1001) to xs:float. */ @org.junit.Test public void castAs204() { final XQuery query = new XQuery( "xs:double(\"5.4321E-1001\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("FOAR0002") ) ); } /** * Try casting xs:double(1e5) to xs:float. */ @org.junit.Test public void castAs205() { final XQuery query = new XQuery( "xs:double(\"1e5\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("100000") ); } /** * Try casting xs:double(-1.75e-3) to xs:float. */ @org.junit.Test public void castAs206() { final XQuery query = new XQuery( "xs:double(\"-1.75e-3\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0.00175") ); } /** * Try casting xs:double(NaN) to xs:float. */ @org.junit.Test public void castAs207() { final XQuery query = new XQuery( "xs:double(\"NaN\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Try casting xs:double(1e5) to xs:double. */ @org.junit.Test public void castAs208() { final XQuery query = new XQuery( "xs:double(\"1e5\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("100000") ); } /** * Try casting xs:double(INF) to xs:double. */ @org.junit.Test public void castAs209() { final XQuery query = new XQuery( "xs:double(\"INF\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** * Try casting xs:double(-0.0E0) to xs:decimal. */ @org.junit.Test public void castAs210() { final XQuery query = new XQuery( "xs:double(\"-0.0E0\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Try casting xs:double(5.4321E-1001) to xs:decimal. */ @org.junit.Test public void castAs211() { final XQuery query = new XQuery( "xs:double(\"5.4321E-1001\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Try casting xs:double(-1.75e-3) to xs:decimal. */ @org.junit.Test public void castAs212() { final XQuery query = new XQuery( "round-half-to-even(xs:double(\"-1.75e-3\") cast as xs:decimal,5)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0.00175") ); } /** * Try casting xs:double(INF) to xs:decimal. */ @org.junit.Test public void castAs213() { final XQuery query = new XQuery( "xs:double(\"INF\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FOCA0002") || error("FORG0001") ) ); } /** * Try casting xs:double(-0.0E0) to xs:integer. */ @org.junit.Test public void castAs214() { final XQuery query = new XQuery( "xs:double(\"-0.0E0\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Try casting xs:double(1e5) to xs:integer. */ @org.junit.Test public void castAs215() { final XQuery query = new XQuery( "xs:double(\"1e5\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("100000") ); } /** * Try casting xs:double(-1.75e-3) to xs:integer. */ @org.junit.Test public void castAs216() { final XQuery query = new XQuery( "xs:double(\"-1.75e-3\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Try casting xs:double(INF) to xs:integer. */ @org.junit.Test public void castAs217() { final XQuery query = new XQuery( "xs:double(\"INF\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Try casting xs:double(NaN) to xs:integer. */ @org.junit.Test public void castAs218() { final XQuery query = new XQuery( "xs:double(\"NaN\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Try casting xs:double(1e5) to xs:duration. */ @org.junit.Test public void castAs219() { final XQuery query = new XQuery( "xs:double(\"1e5\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:double(1e5) to xs:yearMonthDuration. */ @org.junit.Test public void castAs220() { final XQuery query = new XQuery( "xs:double(\"1e5\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:double(1e5) to xs:dayTimeDuration. */ @org.junit.Test public void castAs221() { final XQuery query = new XQuery( "xs:double(\"1e5\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:double(1e5) to xs:dateTime. */ @org.junit.Test public void castAs222() { final XQuery query = new XQuery( "xs:double(\"1e5\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:double(1e5) to xs:time. */ @org.junit.Test public void castAs223() { final XQuery query = new XQuery( "xs:double(\"1e5\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:double(1e5) to xs:date. */ @org.junit.Test public void castAs224() { final XQuery query = new XQuery( "xs:double(\"1e5\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:double(1e5) to xs:gYearMonth. */ @org.junit.Test public void castAs225() { final XQuery query = new XQuery( "xs:double(\"1e5\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:double(1e5) to xs:gYear. */ @org.junit.Test public void castAs226() { final XQuery query = new XQuery( "xs:double(\"1e5\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:double(1e5) to xs:gMonthDay. */ @org.junit.Test public void castAs227() { final XQuery query = new XQuery( "xs:double(\"1e5\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:double(1e5) to xs:gDay. */ @org.junit.Test public void castAs228() { final XQuery query = new XQuery( "xs:double(\"1e5\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:double(1e5) to xs:gMonth. */ @org.junit.Test public void castAs229() { final XQuery query = new XQuery( "xs:double(\"1e5\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:double(1e5) to xs:boolean. */ @org.junit.Test public void castAs230() { final XQuery query = new XQuery( "xs:double(\"1e5\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try casting xs:double(1e5) to xs:base64Binary. */ @org.junit.Test public void castAs231() { final XQuery query = new XQuery( "xs:double(\"1e5\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:double(1e5) to xs:hexBinary. */ @org.junit.Test public void castAs232() { final XQuery query = new XQuery( "xs:double(\"1e5\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:double(1e5) to xs:anyURI. */ @org.junit.Test public void castAs233() { final XQuery query = new XQuery( "xs:double(\"1e5\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:decimal(-1.1234) to xs:untypedAtomic. */ @org.junit.Test public void castAs234() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.1234") ); } /** * Try casting xs:decimal(-1.1234) to xs:string. */ @org.junit.Test public void castAs235() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.1234") ); } /** * Try casting xs:decimal(-1.1234) to xs:float. */ @org.junit.Test public void castAs236() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.1234") ); } /** * Try casting xs:decimal(-1.1234) to xs:double. */ @org.junit.Test public void castAs237() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.1234") ); } /** * Try casting xs:decimal(-1.1234) to xs:decimal. */ @org.junit.Test public void castAs238() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.1234") ); } /** * Try casting xs:decimal(-1.1234) to xs:integer. */ @org.junit.Test public void castAs239() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Try casting xs:decimal(5.5432) to xs:integer. */ @org.junit.Test public void castAs240() { final XQuery query = new XQuery( "xs:decimal(\"5.5432\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** * Try casting xs:decimal(-1.1234) to xs:duration. */ @org.junit.Test public void castAs241() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:decimal(-1.1234) to xs:yearMonthDuration. */ @org.junit.Test public void castAs242() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:decimal(-1.1234) to xs:dayTimeDuration. */ @org.junit.Test public void castAs243() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:decimal(-1.1234) to xs:dateTime. */ @org.junit.Test public void castAs244() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:decimal(-1.1234) to xs:time. */ @org.junit.Test public void castAs245() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:decimal(-1.1234) to xs:date. */ @org.junit.Test public void castAs246() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:decimal(-1.1234) to xs:gYearMonth. */ @org.junit.Test public void castAs247() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:decimal(-1.1234) to xs:gYear. */ @org.junit.Test public void castAs248() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:decimal(-1.1234) to xs:gMonthDay. */ @org.junit.Test public void castAs249() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:decimal(-1.1234) to xs:gDay. */ @org.junit.Test public void castAs250() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:decimal(-1.1234) to xs:gMonth. */ @org.junit.Test public void castAs251() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:decimal(-1.1234) to xs:boolean. */ @org.junit.Test public void castAs252() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try casting xs:decimal(-1.1234) to xs:base64Binary. */ @org.junit.Test public void castAs253() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:decimal(-1.1234) to xs:hexBinary. */ @org.junit.Test public void castAs254() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:decimal(-1.1234) to xs:anyURI. */ @org.junit.Test public void castAs255() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:integer(1) to xs:untypedAtomic. */ @org.junit.Test public void castAs256() { final XQuery query = new XQuery( "xs:integer(\"1\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Try casting xs:integer(-100) to xs:string. */ @org.junit.Test public void castAs257() { final XQuery query = new XQuery( "xs:integer(\"-100\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-100") ); } /** * Try casting xs:integer(-100) to xs:float. */ @org.junit.Test public void castAs258() { final XQuery query = new XQuery( "xs:integer(\"-100\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-100") ); } /** * Try casting xs:integer(-100) to xs:double. */ @org.junit.Test public void castAs259() { final XQuery query = new XQuery( "xs:integer(\"-100\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-100") ); } /** * Try casting xs:integer(-100) to xs:decimal. */ @org.junit.Test public void castAs260() { final XQuery query = new XQuery( "xs:integer(\"-100\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-100") ); } /** * Try casting xs:integer(-100) to xs:integer. */ @org.junit.Test public void castAs261() { final XQuery query = new XQuery( "xs:integer(\"-100\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-100") ); } /** * Try casting xs:integer(-100) to xs:duration. */ @org.junit.Test public void castAs262() { final XQuery query = new XQuery( "xs:integer(\"-100\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:integer(-100) to xs:yearMonthDuration. */ @org.junit.Test public void castAs263() { final XQuery query = new XQuery( "xs:integer(\"-100\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:integer(-100) to xs:dayTimeDuration. */ @org.junit.Test public void castAs264() { final XQuery query = new XQuery( "xs:integer(\"-100\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:integer(-100) to xs:dateTime. */ @org.junit.Test public void castAs265() { final XQuery query = new XQuery( "xs:integer(\"-100\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:integer(-100) to xs:time. */ @org.junit.Test public void castAs266() { final XQuery query = new XQuery( "xs:integer(\"-100\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:integer(-100) to xs:date. */ @org.junit.Test public void castAs267() { final XQuery query = new XQuery( "xs:integer(\"-100\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:integer(-100) to xs:gYearMonth. */ @org.junit.Test public void castAs268() { final XQuery query = new XQuery( "xs:integer(\"-100\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:integer(-100) to xs:gYear. */ @org.junit.Test public void castAs269() { final XQuery query = new XQuery( "xs:integer(\"-100\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:integer(-100) to xs:gMonthDay. */ @org.junit.Test public void castAs270() { final XQuery query = new XQuery( "xs:integer(\"-100\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:integer(-100) to xs:gDay. */ @org.junit.Test public void castAs271() { final XQuery query = new XQuery( "xs:integer(\"-100\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:integer(-100) to xs:gMonth. */ @org.junit.Test public void castAs272() { final XQuery query = new XQuery( "xs:integer(\"-100\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:integer(-100) to xs:boolean. */ @org.junit.Test public void castAs273() { final XQuery query = new XQuery( "xs:integer(\"-100\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try casting xs:integer(-100) to xs:base64Binary. */ @org.junit.Test public void castAs274() { final XQuery query = new XQuery( "xs:integer(\"-100\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:integer(-100) to xs:hexBinary. */ @org.junit.Test public void castAs275() { final XQuery query = new XQuery( "xs:integer(\"-100\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:integer(-100) to xs:anyURI. */ @org.junit.Test public void castAs276() { final XQuery query = new XQuery( "xs:integer(\"-100\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:duration(P1Y2M3DT10H30M23S) to xs:untypedAtomic. */ @org.junit.Test public void castAs277() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1Y2M3DT10H30M23S") ); } /** * Try casting xs:duration(P1Y2M3DT10H30M23S) to xs:string. */ @org.junit.Test public void castAs278() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1Y2M3DT10H30M23S") ); } /** * Try casting xs:duration(P1Y2M3DT10H30M23S) to xs:float. */ @org.junit.Test public void castAs279() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:duration(P1Y2M3DT10H30M23S) to xs:double. */ @org.junit.Test public void castAs280() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:duration(P1Y2M3DT10H30M23S) to xs:decimal. */ @org.junit.Test public void castAs281() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:duration(P1Y2M3DT10H30M23S) to xs:integer. */ @org.junit.Test public void castAs282() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:duration(P1Y2M3DT10H30M23S) to xs:duration. */ @org.junit.Test public void castAs283() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1Y2M3DT10H30M23S") ); } /** * Try casting xs:duration(PT10H) to xs:duration. */ @org.junit.Test public void castAs284() { final XQuery query = new XQuery( "xs:duration(\"PT10H\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT10H") ); } /** * Try casting xs:duration(P1Y2M3DT10H30M23S) to xs:yearMonthDuration. */ @org.junit.Test public void castAs285() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1Y2M") ); } /** * Try casting xs:duration(PT10H) to xs:yearMonthDuration. */ @org.junit.Test public void castAs286() { final XQuery query = new XQuery( "xs:duration(\"PT10H\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P0M") ); } /** * Try casting xs:duration(P24M) to xs:yearMonthDuration. */ @org.junit.Test public void castAs287() { final XQuery query = new XQuery( "xs:duration(\"P24M\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P2Y") ); } /** * Try casting xs:duration(P1Y2M3DT10H30M23S) to xs:dayTimeDuration. */ @org.junit.Test public void castAs288() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P3DT10H30M23S") ); } /** * Try casting xs:duration(PT10H) to xs:dayTimeDuration. */ @org.junit.Test public void castAs289() { final XQuery query = new XQuery( "xs:duration(\"PT10H\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT10H") ); } /** * Try casting xs:duration(P24M) to xs:dayTimeDuration. */ @org.junit.Test public void castAs290() { final XQuery query = new XQuery( "xs:duration(\"P24M\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Try casting xs:duration(P1Y2M3DT10H30M23S) to xs:dateTime. */ @org.junit.Test public void castAs291() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:duration(P1Y2M3DT10H30M23S) to xs:time. */ @org.junit.Test public void castAs292() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:duration(P1Y2M3DT10H30M23S) to xs:date. */ @org.junit.Test public void castAs293() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:duration(P1Y2M3DT10H30M23S) to xs:gYearMonth. */ @org.junit.Test public void castAs294() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:duration(P1Y2M3DT10H30M23S) to xs:gYear. */ @org.junit.Test public void castAs295() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:duration(P1Y2M3DT10H30M23S) to xs:gMonthDay. */ @org.junit.Test public void castAs296() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:duration(P1Y2M3DT10H30M23S) to xs:gDay. */ @org.junit.Test public void castAs297() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:duration(P1Y2M3DT10H30M23S) to xs:gMonth. */ @org.junit.Test public void castAs298() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:duration(P1Y2M3DT10H30M23S) to xs:boolean. */ @org.junit.Test public void castAs299() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:duration(P1Y2M3DT10H30M23S) to xs:base64Binary. */ @org.junit.Test public void castAs300() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:duration(P1Y2M3DT10H30M23S) to xs:hexBinary. */ @org.junit.Test public void castAs301() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:duration(P1Y2M3DT10H30M23S) to xs:anyURI. */ @org.junit.Test public void castAs302() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:yearMonthDuration(P1Y2M) to xs:untypedAtomic. */ @org.junit.Test public void castAs303() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1Y2M") ); } /** * Try casting xs:yearMonthDuration(P1Y2M) to xs:string. */ @org.junit.Test public void castAs304() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1Y2M") ); } /** * Try casting xs:yearMonthDuration(P1Y2M) to xs:float. */ @org.junit.Test public void castAs305() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:yearMonthDuration(P1Y2M) to xs:double. */ @org.junit.Test public void castAs306() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:yearMonthDuration(P1Y2M) to xs:decimal. */ @org.junit.Test public void castAs307() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:yearMonthDuration(P1Y2M) to xs:integer. */ @org.junit.Test public void castAs308() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:yearMonthDuration(P1Y2M) to xs:duration. */ @org.junit.Test public void castAs309() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1Y2M") ); } /** * Try casting xs:yearMonthDuration(P1Y2M) to xs:yearMonthDuration. */ @org.junit.Test public void castAs310() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1Y2M") ); } /** * Try casting xs:yearMonthDuration(-P21M) to xs:yearMonthDuration. */ @org.junit.Test public void castAs311() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"-P21M\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-P1Y9M") ); } /** * Try casting xs:yearMonthDuration(P1Y2M) to xs:dayTimeDuration. */ @org.junit.Test public void castAs312() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PT0S") ); } /** * Try casting xs:yearMonthDuration(P1Y2M) to xs:dateTime. */ @org.junit.Test public void castAs313() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:yearMonthDuration(P1Y2M) to xs:time. */ @org.junit.Test public void castAs314() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:yearMonthDuration(P1Y2M) to xs:date. */ @org.junit.Test public void castAs315() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:yearMonthDuration(P1Y2M) to xs:gYearMonth. */ @org.junit.Test public void castAs316() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:yearMonthDuration(P1Y2M) to xs:gYear. */ @org.junit.Test public void castAs317() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:yearMonthDuration(P1Y2M) to xs:gMonthDay. */ @org.junit.Test public void castAs318() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:yearMonthDuration(P1Y2M) to xs:gDay. */ @org.junit.Test public void castAs319() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:yearMonthDuration(P1Y2M) to xs:gMonth. */ @org.junit.Test public void castAs320() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:yearMonthDuration(P1Y2M) to xs:boolean. */ @org.junit.Test public void castAs321() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:yearMonthDuration(P1Y2M) to xs:base64Binary. */ @org.junit.Test public void castAs322() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:yearMonthDuration(P1Y2M) to xs:hexBinary. */ @org.junit.Test public void castAs323() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:yearMonthDuration(P1Y2M) to xs:anyURI. */ @org.junit.Test public void castAs324() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:dayTimeDuration(P3DT10H30M) to xs:untypedAtomic. */ @org.junit.Test public void castAs325() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P3DT10H30M") ); } /** * Try casting xs:dayTimeDuration(-PT100M) to xs:untypedAtomic. */ @org.junit.Test public void castAs326() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"-PT100M\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-PT1H40M") ); } /** * Try casting xs:dayTimeDuration(P3DT10H30M) to xs:string. */ @org.junit.Test public void castAs327() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P3DT10H30M") ); } /** * Try casting xs:dayTimeDuration(-PT100M) to xs:string. */ @org.junit.Test public void castAs328() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"-PT100M\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-PT1H40M") ); } /** * Try casting xs:dayTimeDuration(P3DT10H30M) to xs:float. */ @org.junit.Test public void castAs329() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:dayTimeDuration(P3DT10H30M) to xs:double. */ @org.junit.Test public void castAs330() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:dayTimeDuration(P3DT10H30M) to xs:decimal. */ @org.junit.Test public void castAs331() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:dayTimeDuration(P3DT10H30M) to xs:integer. */ @org.junit.Test public void castAs332() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:dayTimeDuration(P3DT10H30M) to xs:duration. */ @org.junit.Test public void castAs333() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P3DT10H30M") ); } /** * Try casting xs:dayTimeDuration(PT24H) to xs:duration. */ @org.junit.Test public void castAs334() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"PT24H\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P1D") ); } /** * Try casting xs:dayTimeDuration(-PT100M) to xs:duration. */ @org.junit.Test public void castAs335() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"-PT100M\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-PT1H40M") ); } /** * Try casting xs:dayTimeDuration(P3DT10H30M) to xs:yearMonthDuration. */ @org.junit.Test public void castAs336() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P0M") ); } /** * Try casting xs:dayTimeDuration(P3DT10H30M) to xs:dayTimeDuration. */ @org.junit.Test public void castAs337() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P3DT10H30M") ); } /** * Try casting xs:dayTimeDuration(P14D) to xs:dayTimeDuration. */ @org.junit.Test public void castAs338() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P14D\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P14D") ); } /** * Try casting xs:dayTimeDuration(-PT100M) to xs:dayTimeDuration. */ @org.junit.Test public void castAs339() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"-PT100M\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-PT1H40M") ); } /** * Try casting xs:dayTimeDuration(P3DT10H30M) to xs:dateTime. */ @org.junit.Test public void castAs340() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:dayTimeDuration(P3DT10H30M) to xs:time. */ @org.junit.Test public void castAs341() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:dayTimeDuration(P3DT10H30M) to xs:date. */ @org.junit.Test public void castAs342() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:dayTimeDuration(P3DT10H30M) to xs:gYearMonth. */ @org.junit.Test public void castAs343() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:dayTimeDuration(P3DT10H30M) to xs:gYear. */ @org.junit.Test public void castAs344() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:dayTimeDuration(P3DT10H30M) to xs:gMonthDay. */ @org.junit.Test public void castAs345() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:dayTimeDuration(P3DT10H30M) to xs:gDay. */ @org.junit.Test public void castAs346() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:dayTimeDuration(P3DT10H30M) to xs:gMonth. */ @org.junit.Test public void castAs347() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:dayTimeDuration(P3DT10H30M) to xs:boolean. */ @org.junit.Test public void castAs348() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:dayTimeDuration(P3DT10H30M) to xs:base64Binary. */ @org.junit.Test public void castAs349() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:dayTimeDuration(P3DT10H30M) to xs:hexBinary. */ @org.junit.Test public void castAs350() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:dayTimeDuration(P3DT10H30M) to xs:anyURI. */ @org.junit.Test public void castAs351() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:dateTime(1999-05-31T13:20:00) to xs:untypedAtomic. */ @org.junit.Test public void castAs352() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05-31T13:20:00") ); } /** * Try casting xs:dateTime(-1999-05-31T13:20:00+14:00) to xs:untypedAtomic. */ @org.junit.Test public void castAs353() { final XQuery query = new XQuery( "xs:dateTime(\"-1999-05-31T13:20:00+14:00\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1999-05-31T13:20:00+14:00") ); } /** * Try casting xs:dateTime(1999-05-31T13:20:00) to xs:string. */ @org.junit.Test public void castAs354() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05-31T13:20:00") ); } /** * Try casting xs:dateTime(-1999-05-31T13:20:00+14:00) to xs:string. */ @org.junit.Test public void castAs355() { final XQuery query = new XQuery( "xs:dateTime(\"-1999-05-31T13:20:00+14:00\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1999-05-31T13:20:00+14:00") ); } /** * Try casting xs:dateTime(1999-05-31T13:20:00) to xs:float. */ @org.junit.Test public void castAs356() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:dateTime(2000-01-16T00:00:00Z) to xs:float. */ @org.junit.Test public void castAs357() { final XQuery query = new XQuery( "xs:dateTime(\"2000-01-16T00:00:00Z\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:dateTime(1999-05-31T13:20:00) to xs:decimal. */ @org.junit.Test public void castAs358() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:dateTime(1999-05-31T13:20:00) to xs:integer. */ @org.junit.Test public void castAs359() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:dateTime(1999-05-31T13:20:00) to xs:duration. */ @org.junit.Test public void castAs360() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:dateTime(1999-05-31T13:20:00) to xs:yearMonthDuration. */ @org.junit.Test public void castAs361() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:dateTime(1999-05-31T13:20:00) to xs:dayTimeDuration. */ @org.junit.Test public void castAs362() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:dateTime(1999-05-31T13:20:00) to xs:dateTime. */ @org.junit.Test public void castAs363() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05-31T13:20:00") ); } /** * Try casting xs:dateTime(1999-05-31T13:20:00) to xs:time. */ @org.junit.Test public void castAs364() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "13:20:00") ); } /** * Try casting xs:dateTime(-1999-05-31T13:20:00+14:00) to xs:time. */ @org.junit.Test public void castAs365() { final XQuery query = new XQuery( "xs:dateTime(\"-1999-05-31T13:20:00+14:00\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "13:20:00+14:00") ); } /** * Try casting xs:dateTime(1999-05-31T13:20:00) to xs:date. */ @org.junit.Test public void castAs366() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05-31") ); } /** * Try casting xs:dateTime(-1999-05-31T13:20:00+14:00) to xs:date. */ @org.junit.Test public void castAs367() { final XQuery query = new XQuery( "xs:dateTime(\"-1999-05-31T13:20:00+14:00\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1999-05-31+14:00") ); } /** * Try casting xs:dateTime(1999-05-31T13:20:00) to xs:gYearMonth. */ @org.junit.Test public void castAs368() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05") ); } /** * Try casting xs:dateTime(-1999-05-31T13:20:00+14:00) to xs:gYearMonth. */ @org.junit.Test public void castAs369() { final XQuery query = new XQuery( "xs:dateTime(\"-1999-05-31T13:20:00+14:00\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1999-05+14:00") ); } /** * Try casting xs:dateTime(1999-05-31T13:20:00) to xs:gYear. */ @org.junit.Test public void castAs370() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999") ); } /** * Try casting xs:dateTime(-1999-05-31T13:20:00+14:00) to xs:gYear. */ @org.junit.Test public void castAs371() { final XQuery query = new XQuery( "xs:dateTime(\"-1999-05-31T13:20:00+14:00\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1999+14:00") ); } /** * Try casting xs:dateTime(1999-05-31T13:20:00) to xs:gMonthDay. */ @org.junit.Test public void castAs372() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--05-31") ); } /** * Try casting xs:dateTime(-1999-05-31T13:20:00+14:00) to xs:gMonthDay. */ @org.junit.Test public void castAs373() { final XQuery query = new XQuery( "xs:dateTime(\"-1999-05-31T13:20:00+14:00\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--05-31+14:00") ); } /** * Try casting xs:dateTime(1999-05-31T13:20:00) to xs:gDay. */ @org.junit.Test public void castAs374() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "---31") ); } /** * Try casting xs:dateTime(-1999-05-31T13:20:00+14:00) to xs:gDay. */ @org.junit.Test public void castAs375() { final XQuery query = new XQuery( "xs:dateTime(\"-1999-05-31T13:20:00+14:00\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "---31+14:00") ); } /** * Try casting xs:dateTime(1999-05-31T13:20:00) to xs:gMonth. */ @org.junit.Test public void castAs376() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--05") ); } /** * Try casting xs:dateTime(-1999-05-31T13:20:00+14:00) to xs:gMonth. */ @org.junit.Test public void castAs377() { final XQuery query = new XQuery( "xs:dateTime(\"-1999-05-31T13:20:00+14:00\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--05+14:00") ); } /** * Try casting xs:dateTime(1999-05-31T13:20:00) to xs:boolean. */ @org.junit.Test public void castAs378() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:dateTime(1999-05-31T13:20:00) to xs:base64Binary. */ @org.junit.Test public void castAs379() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:dateTime(1999-05-31T13:20:00) to xs:hexBinary. */ @org.junit.Test public void castAs380() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:dateTime(1999-05-31T13:20:00) to xs:anyURI. */ @org.junit.Test public void castAs381() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:time(13:20:00-05:00) to xs:untypedAtomic. */ @org.junit.Test public void castAs382() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "13:20:00-05:00") ); } /** * Try casting xs:time(13:20:00-05:00) to xs:string. */ @org.junit.Test public void castAs383() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "13:20:00-05:00") ); } /** * Try casting xs:time(13:20:00-05:00) to xs:float. */ @org.junit.Test public void castAs384() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:time(13:20:00-05:00) to xs:double. */ @org.junit.Test public void castAs385() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:time(13:20:00-05:00) to xs:decimal. */ @org.junit.Test public void castAs386() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:time(13:20:00-05:00) to xs:integer. */ @org.junit.Test public void castAs387() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:time(13:20:00-05:00) to xs:duration. */ @org.junit.Test public void castAs388() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:time(13:20:00-05:00) to xs:yearMonthDuration. */ @org.junit.Test public void castAs389() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:time(13:20:00-05:00) to xs:dayTimeDuration. */ @org.junit.Test public void castAs390() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:time(13:20:00-05:00) to xs:dateTime. */ @org.junit.Test public void castAs391() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:time(13:20:00-05:00) to xs:time. */ @org.junit.Test public void castAs392() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "13:20:00-05:00") ); } /** * Try casting xs:time(13:20:02.123) to xs:time. */ @org.junit.Test public void castAs393() { final XQuery query = new XQuery( "xs:time(\"13:20:02.123\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "13:20:02.123") ); } /** * Try casting xs:time(13:20:00Z) to xs:time. */ @org.junit.Test public void castAs394() { final XQuery query = new XQuery( "xs:time(\"13:20:00Z\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "13:20:00Z") ); } /** * Try casting xs:time(13:20:00-05:00) to xs:date. */ @org.junit.Test public void castAs395() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:time(13:20:00-05:00) to xs:gYearMonth. */ @org.junit.Test public void castAs396() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:time(13:20:00-05:00) to xs:gYear. */ @org.junit.Test public void castAs397() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:time(13:20:00-05:00) to xs:gMonthDay. */ @org.junit.Test public void castAs398() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:time(13:20:00-05:00) to xs:gDay. */ @org.junit.Test public void castAs399() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:time(13:20:00-05:00) to xs:gMonth. */ @org.junit.Test public void castAs400() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:time(13:20:00-05:00) to xs:boolean. */ @org.junit.Test public void castAs401() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:time(13:20:00-05:00) to xs:base64Binary. */ @org.junit.Test public void castAs402() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:time(13:20:00-05:00) to xs:hexBinary. */ @org.junit.Test public void castAs403() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:time(13:20:00-05:00) to xs:anyURI. */ @org.junit.Test public void castAs404() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:date(1999-05-31) to xs:untypedAtomic. */ @org.junit.Test public void castAs405() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05-31") ); } /** * Try casting xs:date(-0012-12-03-05:00) to xs:untypedAtomic. */ @org.junit.Test public void castAs406() { final XQuery query = new XQuery( "xs:date(\"-0012-12-03-05:00\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0012-12-03-05:00") ); } /** * Try casting xs:date(1999-05-31) to xs:string. */ @org.junit.Test public void castAs407() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05-31") ); } /** * Try casting xs:date(-0012-12-03-05:00) to xs:string. */ @org.junit.Test public void castAs408() { final XQuery query = new XQuery( "xs:date(\"-0012-12-03-05:00\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0012-12-03-05:00") ); } /** * Try casting xs:date(1999-05-31) to xs:float. */ @org.junit.Test public void castAs409() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:date(1999-05-31) to xs:double. */ @org.junit.Test public void castAs410() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:date(1999-05-31Z) to xs:double. */ @org.junit.Test public void castAs411() { final XQuery query = new XQuery( "xs:date(\"1999-05-31Z\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:date(1999-05-31) to xs:integer. */ @org.junit.Test public void castAs412() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:date(1999-05-31) to xs:duration. */ @org.junit.Test public void castAs413() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:date(1999-05-31) to xs:yearMonthDuration. */ @org.junit.Test public void castAs414() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:date(1999-05-31) to xs:dayTimeDuration. */ @org.junit.Test public void castAs415() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:date(1999-05-31) to xs:dateTime. */ @org.junit.Test public void castAs416() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05-31T00:00:00") ); } /** * Try casting xs:date(1999-05-31) to xs:time. */ @org.junit.Test public void castAs417() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:date(1999-05-31) to xs:date. */ @org.junit.Test public void castAs418() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05-31") ); } /** * Try casting xs:date(-0012-12-03-05:00) to xs:date. */ @org.junit.Test public void castAs419() { final XQuery query = new XQuery( "xs:date(\"-0012-12-03-05:00\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0012-12-03-05:00") ); } /** * Try casting xs:date(1999-05-31Z) to xs:date. */ @org.junit.Test public void castAs420() { final XQuery query = new XQuery( "xs:date(\"1999-05-31Z\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05-31Z") ); } /** * Try casting xs:date(1999-05-31) to xs:gYearMonth. */ @org.junit.Test public void castAs421() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05") ); } /** * Try casting xs:date(1999-05-31) to xs:gYear. */ @org.junit.Test public void castAs422() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999") ); } /** * Try casting xs:date(-0012-12-03-05:00) to xs:gYear. */ @org.junit.Test public void castAs423() { final XQuery query = new XQuery( "xs:date(\"-0012-12-03-05:00\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0012-05:00") ); } /** * Try casting xs:date(1999-05-31Z) to xs:gYear. */ @org.junit.Test public void castAs424() { final XQuery query = new XQuery( "xs:date(\"1999-05-31Z\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999Z") ); } /** * Try casting xs:date(1999-05-31) to xs:gMonthDay. */ @org.junit.Test public void castAs425() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--05-31") ); } /** * Try casting xs:date(-0012-12-03-05:00) to xs:gMonthDay. */ @org.junit.Test public void castAs426() { final XQuery query = new XQuery( "xs:date(\"-0012-12-03-05:00\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--12-03-05:00") ); } /** * Try casting xs:date(1999-05-31Z) to xs:gMonthDay. */ @org.junit.Test public void castAs427() { final XQuery query = new XQuery( "xs:date(\"1999-05-31Z\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--05-31Z") ); } /** * Try casting xs:date(1999-05-31Z) to xs:gDay. */ @org.junit.Test public void castAs428() { final XQuery query = new XQuery( "xs:date(\"1999-05-31Z\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "---31Z") ); } /** * Try casting xs:date(-0012-12-03-05:00) to xs:gMonth. */ @org.junit.Test public void castAs429() { final XQuery query = new XQuery( "xs:date(\"-0012-12-03-05:00\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--12-05:00") ); } /** * Try casting xs:date(1999-05-31Z) to xs:gMonth. */ @org.junit.Test public void castAs430() { final XQuery query = new XQuery( "xs:date(\"1999-05-31Z\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--05Z") ); } /** * Try casting xs:date(1999-05-31) to xs:boolean. */ @org.junit.Test public void castAs431() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:date(1999-05-31) to xs:base64Binary. */ @org.junit.Test public void castAs432() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:date(1999-05-31) to xs:hexBinary. */ @org.junit.Test public void castAs433() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:date(1999-05-31) to xs:anyURI. */ @org.junit.Test public void castAs434() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYearMonth(1999-05) to xs:untypedAtomic. */ @org.junit.Test public void castAs435() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05") ); } /** * Try casting xs:gYearMonth(1999-05) to xs:string. */ @org.junit.Test public void castAs436() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05") ); } /** * Try casting xs:gYearMonth(1999-05) to xs:float. */ @org.junit.Test public void castAs437() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYearMonth(1999-05) to xs:double. */ @org.junit.Test public void castAs438() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYearMonth(1999-05Z) to xs:double. */ @org.junit.Test public void castAs439() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYearMonth(1999-05Z) to xs:decimal. */ @org.junit.Test public void castAs440() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYearMonth(1999-05Z) to xs:integer. */ @org.junit.Test public void castAs441() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYearMonth(1999-05Z) to xs:duration. */ @org.junit.Test public void castAs442() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYearMonth(1999-05Z) to xs:yearMonthDuration. */ @org.junit.Test public void castAs443() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYearMonth(1999-05Z) to xs:dayTimeDuration. */ @org.junit.Test public void castAs444() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYearMonth(1999-05Z) to xs:dateTime. */ @org.junit.Test public void castAs445() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYearMonth(1999-05Z) to xs:time. */ @org.junit.Test public void castAs446() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYearMonth(1999-05Z) to xs:date. */ @org.junit.Test public void castAs447() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYearMonth(1999-05) to xs:gYearMonth. */ @org.junit.Test public void castAs448() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05") ); } /** * Try casting xs:gYearMonth(-0012-12-05:00) to xs:gYearMonth. */ @org.junit.Test public void castAs449() { final XQuery query = new XQuery( "xs:gYearMonth(\"-0012-12-05:00\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0012-12-05:00") ); } /** * Try casting xs:gYearMonth(1999-05Z) to xs:gYearMonth. */ @org.junit.Test public void castAs450() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05Z") ); } /** * Try casting xs:gYearMonth(1999-05Z) to xs:gYear. */ @org.junit.Test public void castAs451() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYearMonth(1999-05Z) to xs:gMonthDay. */ @org.junit.Test public void castAs452() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYearMonth(1999-05Z) to xs:gDay. */ @org.junit.Test public void castAs453() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYearMonth(1999-05Z) to xs:gMonth. */ @org.junit.Test public void castAs454() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYearMonth(1999-05Z) to xs:boolean. */ @org.junit.Test public void castAs455() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYearMonth(1999-05Z) to xs:base64Binary. */ @org.junit.Test public void castAs456() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYearMonth(1999-05Z) to xs:hexBinary. */ @org.junit.Test public void castAs457() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYearMonth(1999-05Z) to xs:anyURI. */ @org.junit.Test public void castAs458() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYear(1999) to xs:untypedAtomic. */ @org.junit.Test public void castAs459() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999") ); } /** * Try casting xs:gYear(1999) to xs:string. */ @org.junit.Test public void castAs460() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999") ); } /** * Try casting xs:gYear(1999) to xs:float. */ @org.junit.Test public void castAs461() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYear(1999) to xs:double. */ @org.junit.Test public void castAs462() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYear(1999) to xs:decimal. */ @org.junit.Test public void castAs463() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYear(1999) to xs:integer. */ @org.junit.Test public void castAs464() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYear(1999) to xs:duration. */ @org.junit.Test public void castAs465() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYear(1999) to xs:yearMonthDuration. */ @org.junit.Test public void castAs466() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYear(1999) to xs:dateTime. */ @org.junit.Test public void castAs467() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYear(1999) to xs:time. */ @org.junit.Test public void castAs468() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYear(1999) to xs:date. */ @org.junit.Test public void castAs469() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYear(1999) to xs:gYearMonth. */ @org.junit.Test public void castAs470() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYear(1999) to xs:gYear. */ @org.junit.Test public void castAs471() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999") ); } /** * Try casting xs:gYear(-0012-05:00) to xs:gYear. */ @org.junit.Test public void castAs472() { final XQuery query = new XQuery( "xs:gYear(\"-0012-05:00\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-0012-05:00") ); } /** * Try casting xs:gYear(1999Z) to xs:gYear. */ @org.junit.Test public void castAs473() { final XQuery query = new XQuery( "xs:gYear(\"1999Z\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999Z") ); } /** * Try casting xs:gYear(1999) to xs:gMonthDay. */ @org.junit.Test public void castAs474() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYear(1999) to xs:gDay. */ @org.junit.Test public void castAs475() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYear(1999) to xs:gMonth. */ @org.junit.Test public void castAs476() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYear(1999) to xs:boolean. */ @org.junit.Test public void castAs477() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYear(1999) to xs:base64Binary. */ @org.junit.Test public void castAs478() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYear(1999) to xs:hexBinary. */ @org.junit.Test public void castAs479() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gYear(1999) to xs:anyURI. */ @org.junit.Test public void castAs480() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonthDay(--05-31) to xs:untypedAtomic. */ @org.junit.Test public void castAs481() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--05-31") ); } /** * Try casting xs:gMonthDay(--05-31) to xs:string. */ @org.junit.Test public void castAs482() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--05-31") ); } /** * Try casting xs:gMonthDay(--05-31) to xs:float. */ @org.junit.Test public void castAs483() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonthDay(--05-31) to xs:double. */ @org.junit.Test public void castAs484() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonthDay(--05-31) to xs:decimal. */ @org.junit.Test public void castAs485() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonthDay(--05-31) to xs:integer. */ @org.junit.Test public void castAs486() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonthDay(--05-31) to xs:duration. */ @org.junit.Test public void castAs487() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonthDay(--05-31) to xs:yearMonthDuration. */ @org.junit.Test public void castAs488() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonthDay(--05-31) to xs:dayTimeDuration. */ @org.junit.Test public void castAs489() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonthDay(--05-31) to xs:dateTime. */ @org.junit.Test public void castAs490() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonthDay(--05-31) to xs:time. */ @org.junit.Test public void castAs491() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonthDay(--05-31) to xs:date. */ @org.junit.Test public void castAs492() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonthDay(--05-31) to xs:gYearMonth. */ @org.junit.Test public void castAs493() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonthDay(--05-31) to xs:gYear. */ @org.junit.Test public void castAs494() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonthDay(--05-31) to xs:gMonthDay. */ @org.junit.Test public void castAs495() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--05-31") ); } /** * Try casting xs:gMonthDay(--12-03-05:00) to xs:gMonthDay. */ @org.junit.Test public void castAs496() { final XQuery query = new XQuery( "xs:gMonthDay(\"--12-03-05:00\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--12-03-05:00") ); } /** * Try casting xs:gMonthDay(--05-31Z) to xs:gMonthDay. */ @org.junit.Test public void castAs497() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31Z\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--05-31Z") ); } /** * Try casting xs:gMonthDay(--05-31) to xs:gDay. */ @org.junit.Test public void castAs498() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonthDay(--05-31) to xs:gMonth. */ @org.junit.Test public void castAs499() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonthDay(--05-31) to xs:boolean. */ @org.junit.Test public void castAs500() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonthDay(--05-31) to xs:base64Binary. */ @org.junit.Test public void castAs501() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonthDay(--05-31) to xs:hexBinary. */ @org.junit.Test public void castAs502() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonthDay(--05-31) to xs:anyURI. */ @org.junit.Test public void castAs503() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gDay(---31) to xs:untypedAtomic. */ @org.junit.Test public void castAs504() { final XQuery query = new XQuery( "xs:gDay(\"---31\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "---31") ); } /** * Try casting xs:gDay(---31) to xs:string. */ @org.junit.Test public void castAs505() { final XQuery query = new XQuery( "xs:gDay(\"---31\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "---31") ); } /** * Try casting xs:gDay(---31) to xs:float. */ @org.junit.Test public void castAs506() { final XQuery query = new XQuery( "xs:gDay(\"---31\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gDay(---31) to xs:double. */ @org.junit.Test public void castAs507() { final XQuery query = new XQuery( "xs:gDay(\"---31\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gDay(---31) to xs:decimal. */ @org.junit.Test public void castAs508() { final XQuery query = new XQuery( "xs:gDay(\"---31\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gDay(---31) to xs:integer. */ @org.junit.Test public void castAs509() { final XQuery query = new XQuery( "xs:gDay(\"---31\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gDay(---31) to xs:duration. */ @org.junit.Test public void castAs510() { final XQuery query = new XQuery( "xs:gDay(\"---31\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gDay(---31) to xs:yearMonthDuration. */ @org.junit.Test public void castAs511() { final XQuery query = new XQuery( "xs:gDay(\"---31\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gDay(---31) to xs:dayTimeDuration. */ @org.junit.Test public void castAs512() { final XQuery query = new XQuery( "xs:gDay(\"---31\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gDay(---31) to xs:dateTime. */ @org.junit.Test public void castAs513() { final XQuery query = new XQuery( "xs:gDay(\"---31\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gDay(---31) to xs:time. */ @org.junit.Test public void castAs514() { final XQuery query = new XQuery( "xs:gDay(\"---31\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gDay(---31) to xs:date. */ @org.junit.Test public void castAs515() { final XQuery query = new XQuery( "xs:gDay(\"---31\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gDay(---31) to xs:gYearMonth. */ @org.junit.Test public void castAs516() { final XQuery query = new XQuery( "xs:gDay(\"---31\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gDay(---31) to xs:gYear. */ @org.junit.Test public void castAs517() { final XQuery query = new XQuery( "xs:gDay(\"---31\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gDay(---31) to xs:gMonthDay. */ @org.junit.Test public void castAs518() { final XQuery query = new XQuery( "xs:gDay(\"---31\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gDay(---31) to xs:gDay. */ @org.junit.Test public void castAs519() { final XQuery query = new XQuery( "xs:gDay(\"---31\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "---31") ); } /** * Try casting xs:gDay(---03-05:00) to xs:gDay. */ @org.junit.Test public void castAs520() { final XQuery query = new XQuery( "xs:gDay(\"---03-05:00\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "---03-05:00") ); } /** * Try casting xs:gDay(---31Z) to xs:gDay. */ @org.junit.Test public void castAs521() { final XQuery query = new XQuery( "xs:gDay(\"---31Z\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "---31Z") ); } /** * Try casting xs:gDay(---31) to xs:gMonth. */ @org.junit.Test public void castAs522() { final XQuery query = new XQuery( "xs:gDay(\"---31\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gDay(---31) to xs:boolean. */ @org.junit.Test public void castAs523() { final XQuery query = new XQuery( "xs:gDay(\"---31\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gDay(---31) to xs:base64Binary. */ @org.junit.Test public void castAs524() { final XQuery query = new XQuery( "xs:gDay(\"---31\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gDay(---31) to xs:hexBinary. */ @org.junit.Test public void castAs525() { final XQuery query = new XQuery( "xs:gDay(\"---31\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gDay(---31) to xs:anyURI. */ @org.junit.Test public void castAs526() { final XQuery query = new XQuery( "xs:gDay(\"---31\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonth(--05) to xs:untypedAtomic. */ @org.junit.Test public void castAs527() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--05") ); } /** * Try casting xs:gMonth(--05) to xs:string. */ @org.junit.Test public void castAs528() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--05") ); } /** * Try casting xs:gMonth(--05) to xs:float. */ @org.junit.Test public void castAs529() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonth(--05) to xs:double. */ @org.junit.Test public void castAs530() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonth(--05) to xs:decimal. */ @org.junit.Test public void castAs531() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonth(--05) to xs:integer. */ @org.junit.Test public void castAs532() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonth(--05) to xs:duration. */ @org.junit.Test public void castAs533() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonth(--05) to xs:yearMonthDuration. */ @org.junit.Test public void castAs534() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonth(--05) to xs:dayTimeDuration. */ @org.junit.Test public void castAs535() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonth(--05) to xs:dateTime. */ @org.junit.Test public void castAs536() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonth(--05) to xs:time. */ @org.junit.Test public void castAs537() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonth(--05) to xs:date. */ @org.junit.Test public void castAs538() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonth(--05) to xs:gYearMonth. */ @org.junit.Test public void castAs539() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonth(--05) to xs:gYear. */ @org.junit.Test public void castAs540() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonth(--05) to xs:gMonthDay. */ @org.junit.Test public void castAs541() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonth(--05) to xs:gDay. */ @org.junit.Test public void castAs542() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonth(--05) to xs:gMonth. */ @org.junit.Test public void castAs543() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--05") ); } /** * Try casting xs:gMonth(--12-05:00) to xs:gMonth. */ @org.junit.Test public void castAs544() { final XQuery query = new XQuery( "xs:gMonth(\"--12-05:00\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--12-05:00") ); } /** * Try casting xs:gMonth(--05Z) to xs:gMonth. */ @org.junit.Test public void castAs545() { final XQuery query = new XQuery( "xs:gMonth(\"--05Z\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "--05Z") ); } /** * Try casting xs:gMonth(--05) to xs:boolean. */ @org.junit.Test public void castAs546() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonth(--05) to xs:base64Binary. */ @org.junit.Test public void castAs547() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonth(--05) to xs:hexBinary. */ @org.junit.Test public void castAs548() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:gMonth(--05) to xs:anyURI. */ @org.junit.Test public void castAs549() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:boolean(true) to xs:untypedAtomic. */ @org.junit.Test public void castAs550() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true") ); } /** * Try casting xs:boolean(true) to xs:string. */ @org.junit.Test public void castAs551() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true") ); } /** * Try casting xs:boolean(true) to xs:float. */ @org.junit.Test public void castAs552() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Try casting xs:boolean(false) to xs:float. */ @org.junit.Test public void castAs553() { final XQuery query = new XQuery( "xs:boolean(\"false\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Try casting xs:boolean(true) to xs:double. */ @org.junit.Test public void castAs554() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Try casting xs:boolean(false) to xs:double. */ @org.junit.Test public void castAs555() { final XQuery query = new XQuery( "xs:boolean(\"false\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Try casting xs:boolean(true) to xs:decimal. */ @org.junit.Test public void castAs556() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Try casting xs:boolean(false) to xs:decimal. */ @org.junit.Test public void castAs557() { final XQuery query = new XQuery( "xs:boolean(\"false\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Try casting xs:boolean(true) to xs:integer. */ @org.junit.Test public void castAs558() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Try casting xs:boolean(false) to xs:integer. */ @org.junit.Test public void castAs559() { final XQuery query = new XQuery( "xs:boolean(\"false\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Try casting xs:boolean(true) to xs:duration. */ @org.junit.Test public void castAs560() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:boolean(true) to xs:yearMonthDuration. */ @org.junit.Test public void castAs561() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:boolean(true) to xs:dayTimeDuration. */ @org.junit.Test public void castAs562() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:boolean(true) to xs:dateTime. */ @org.junit.Test public void castAs563() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:boolean(true) to xs:time. */ @org.junit.Test public void castAs564() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:boolean(true) to xs:date. */ @org.junit.Test public void castAs565() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:boolean(true) to xs:gYearMonth. */ @org.junit.Test public void castAs566() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:boolean(true) to xs:gYear. */ @org.junit.Test public void castAs567() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:boolean(true) to xs:gMonthDay. */ @org.junit.Test public void castAs568() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:boolean(true) to xs:gDay. */ @org.junit.Test public void castAs569() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:boolean(true) to xs:gMonth. */ @org.junit.Test public void castAs570() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:boolean(true) to xs:boolean. */ @org.junit.Test public void castAs571() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try casting xs:boolean(false) to xs:boolean. */ @org.junit.Test public void castAs572() { final XQuery query = new XQuery( "xs:boolean(\"false\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try casting xs:boolean(true) to xs:base64Binary. */ @org.junit.Test public void castAs573() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:boolean(true) to xs:hexBinary. */ @org.junit.Test public void castAs574() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:boolean(true) to xs:anyURI. */ @org.junit.Test public void castAs575() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:base64Binary(01001010) to xs:untypedAtomic. */ @org.junit.Test public void castAs576() { final XQuery query = new XQuery( "xs:base64Binary(\"01001010\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "01001010") ); } /** * Try casting xs:base64Binary(0FB7) to xs:untypedAtomic. */ @org.junit.Test public void castAs577() { final XQuery query = new XQuery( "xs:base64Binary(\"0FB7\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0FB7") ); } /** * Try casting xs:base64Binary(01001010) to xs:string. */ @org.junit.Test public void castAs578() { final XQuery query = new XQuery( "xs:base64Binary(\"01001010\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "01001010") ); } /** * Try casting xs:base64Binary(0FB7) to xs:string. */ @org.junit.Test public void castAs579() { final XQuery query = new XQuery( "xs:base64Binary(\"0FB7\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0FB7") ); } /** * Try casting xs:base64Binary(10010101) to xs:float. */ @org.junit.Test public void castAs580() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:base64Binary(10010101) to xs:double. */ @org.junit.Test public void castAs581() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:base64Binary(10010101) to xs:decimal. */ @org.junit.Test public void castAs582() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:base64Binary(10010101) to xs:integer. */ @org.junit.Test public void castAs583() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:base64Binary(10010101) to xs:duration. */ @org.junit.Test public void castAs584() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:base64Binary(10010101) to xs:yearMonthDuration. */ @org.junit.Test public void castAs585() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:base64Binary(10010101) to xs:dayTimeDuration. */ @org.junit.Test public void castAs586() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:base64Binary(10010101) to xs:dateTime. */ @org.junit.Test public void castAs587() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:base64Binary(10010101) to xs:time. */ @org.junit.Test public void castAs588() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:base64Binary(10010101) to xs:date. */ @org.junit.Test public void castAs589() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:base64Binary(10010101) to xs:gYearMonth. */ @org.junit.Test public void castAs590() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:base64Binary(10010101) to xs:gYear. */ @org.junit.Test public void castAs591() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:base64Binary(10010101) to xs:gMonthDay. */ @org.junit.Test public void castAs592() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:base64Binary(10010101) to xs:gDay. */ @org.junit.Test public void castAs593() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:base64Binary(10010101) to xs:gMonth. */ @org.junit.Test public void castAs594() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:base64Binary(10010101) to xs:boolean. */ @org.junit.Test public void castAs595() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:base64Binary(01001010) to xs:base64Binary. */ @org.junit.Test public void castAs596() { final XQuery query = new XQuery( "xs:base64Binary(\"01001010\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "01001010") ); } /** * Try casting xs:base64Binary(0FB7) to xs:base64Binary. */ @org.junit.Test public void castAs597() { final XQuery query = new XQuery( "xs:base64Binary(\"0FB7\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0FB7") ); } /** * Try casting xs:base64Binary(00000000) to xs:hexBinary. */ @org.junit.Test public void castAs598() { final XQuery query = new XQuery( "xs:base64Binary(\"00000000\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "D34D34D34D34") ); } /** * Try casting xs:base64Binary(10010101) to xs:hexBinary. */ @org.junit.Test public void castAs599() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "D74D35D35D35") ); } /** * Try casting xs:base64Binary(aA+zZ/09) to xs:hexBinary. */ @org.junit.Test public void castAs600() { final XQuery query = new XQuery( "xs:base64Binary(\"aA+zZ/09\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "680FB367FD3D") ); } /** * Try casting xs:base64Binary(0FB7) to xs:hexBinary. */ @org.junit.Test public void castAs601() { final XQuery query = new XQuery( "xs:base64Binary(\"0FB7\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "D0507B") ); } /** * Try casting xs:base64Binary(10010101) to xs:anyURI. */ @org.junit.Test public void castAs602() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:hexBinary(D74D35D35D35) to xs:untypedAtomic. */ @org.junit.Test public void castAs603() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "D74D35D35D35") ); } /** * Try casting xs:hexBinary(D74D35D35D35) to xs:string. */ @org.junit.Test public void castAs604() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "D74D35D35D35") ); } /** * Try casting xs:hexBinary(D74D35D35D35) to xs:float. */ @org.junit.Test public void castAs605() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:hexBinary(D74D35D35D35) to xs:double. */ @org.junit.Test public void castAs606() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:hexBinary(D74D35D35D35) to xs:decimal. */ @org.junit.Test public void castAs607() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:hexBinary(D74D35D35D35) to xs:integer. */ @org.junit.Test public void castAs608() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:hexBinary(D74D35D35D35) to xs:duration. */ @org.junit.Test public void castAs609() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:hexBinary(D74D35D35D35) to xs:yearMonthDuration. */ @org.junit.Test public void castAs610() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:hexBinary(D74D35D35D35) to xs:dayTimeDuration. */ @org.junit.Test public void castAs611() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:hexBinary(D74D35D35D35) to xs:dateTime. */ @org.junit.Test public void castAs612() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:hexBinary(D74D35D35D35) to xs:time. */ @org.junit.Test public void castAs613() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:hexBinary(D74D35D35D35) to xs:date. */ @org.junit.Test public void castAs614() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:hexBinary(D74D35D35D35) to xs:gYearMonth. */ @org.junit.Test public void castAs615() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:hexBinary(D74D35D35D35) to xs:gYear. */ @org.junit.Test public void castAs616() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:hexBinary(D74D35D35D35) to xs:gMonthDay. */ @org.junit.Test public void castAs617() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:hexBinary(D74D35D35D35) to xs:gDay. */ @org.junit.Test public void castAs618() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:hexBinary(D74D35D35D35) to xs:gMonth. */ @org.junit.Test public void castAs619() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:hexBinary(D74D35D35D35) to xs:boolean. */ @org.junit.Test public void castAs620() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:hexBinary(D74D35D35D35) to xs:base64Binary. */ @org.junit.Test public void castAs621() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10010101") ); } /** * Try casting xs:hexBinary(0fb7) to xs:base64Binary. */ @org.junit.Test public void castAs622() { final XQuery query = new XQuery( "xs:hexBinary(\"0fb7\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "D7c=") ); } /** * Try casting xs:hexBinary(D74D35D35D35) to xs:hexBinary. */ @org.junit.Test public void castAs623() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "D74D35D35D35") ); } /** * Try casting xs:hexBinary(d74d35d35d35) to xs:hexBinary. */ @org.junit.Test public void castAs624() { final XQuery query = new XQuery( "xs:hexBinary(\"d74d35d35d35\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "D74D35D35D35") ); } /** * Try casting xs:hexBinary(D74D35D35D35) to xs:anyURI. */ @org.junit.Test public void castAs625() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) to xs:untypedAtomic. */ @org.junit.Test public void castAs626() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") cast as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.ietf.org/rfc/rfc2396.txt") ); } /** * Try casting xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) to xs:string. */ @org.junit.Test public void castAs627() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.ietf.org/rfc/rfc2396.txt") ); } /** * Try casting xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) to xs:float. */ @org.junit.Test public void castAs628() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) to xs:double. */ @org.junit.Test public void castAs629() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) to xs:decimal. */ @org.junit.Test public void castAs630() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) to xs:integer. */ @org.junit.Test public void castAs631() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) to xs:duration. */ @org.junit.Test public void castAs632() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) to xs:yearMonthDuration. */ @org.junit.Test public void castAs633() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) to xs:dayTimeDuration. */ @org.junit.Test public void castAs634() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) to xs:dateTime. */ @org.junit.Test public void castAs635() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) to xs:time. */ @org.junit.Test public void castAs636() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) to xs:date. */ @org.junit.Test public void castAs637() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) to xs:gYearMonth. */ @org.junit.Test public void castAs638() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) to xs:gYear. */ @org.junit.Test public void castAs639() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) to xs:gMonthDay. */ @org.junit.Test public void castAs640() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) to xs:gDay. */ @org.junit.Test public void castAs641() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) to xs:gMonth. */ @org.junit.Test public void castAs642() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) to xs:boolean. */ @org.junit.Test public void castAs643() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) to xs:base64Binary. */ @org.junit.Test public void castAs644() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) to xs:hexBinary. */ @org.junit.Test public void castAs645() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try casting xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) to xs:anyURI. */ @org.junit.Test public void castAs646() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.ietf.org/rfc/rfc2396.txt") ); } /** * Evaluates casting a string into a decimal.may process casting or raise error. This test may have differentoutcomes.. */ @org.junit.Test public void castAs647() { final XQuery query = new XQuery( "xs:string(2.123456789123456789) cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "2.123456789123456789") || error("FOCA0006") ) ); } /** * Evaluates casting a string into a nonPositiveInteger.. */ @org.junit.Test public void castAs648() { final XQuery query = new XQuery( "xs:string(-20) cast as xs:nonPositiveInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-20") ); } /** * Evaluates casting a string into an xs:long.. */ @org.junit.Test public void castAs649() { final XQuery query = new XQuery( "xs:string(20) cast as xs:long", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("20") ); } /** * Evaluates casting a string into an xs:nonNegativeInteger. */ @org.junit.Test public void castAs650() { final XQuery query = new XQuery( "xs:string(200) cast as xs:nonNegativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("200") ); } /** * Evaluates casting a string into an xs:negativeInteger. */ @org.junit.Test public void castAs651() { final XQuery query = new XQuery( "xs:string(-201) cast as xs:negativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-201") ); } /** * Evaluates casting a string into an xs:int. */ @org.junit.Test public void castAs652() { final XQuery query = new XQuery( "xs:string(20) cast as xs:int", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("20") ); } /** * Evaluates casting a string into an xs:unsignedLong. */ @org.junit.Test public void castAs653() { final XQuery query = new XQuery( "xs:string(20) cast as xs:unsignedLong", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("20") ); } /** * Evaluates casting a string into an xs:positiveInteger. */ @org.junit.Test public void castAs654() { final XQuery query = new XQuery( "xs:string(300) cast as xs:positiveInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("300") ); } /** * Evaluates casting a string into an xs:short. */ @org.junit.Test public void castAs655() { final XQuery query = new XQuery( "xs:string(30) cast as xs:short", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("30") ); } /** * Evaluates casting a string into an xs:unsignedInt. */ @org.junit.Test public void castAs656() { final XQuery query = new XQuery( "xs:string(300) cast as xs:unsignedInt", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("300") ); } /** * Evaluates casting a string into an xs:byte. */ @org.junit.Test public void castAs657() { final XQuery query = new XQuery( "xs:string(120) cast as xs:byte", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("120") ); } /** * Evaluates casting a string into an xs:unsignedShort. */ @org.junit.Test public void castAs658() { final XQuery query = new XQuery( "xs:string(12) cast as xs:unsignedShort", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("12") ); } /** * Evaluates casting a string into an xs:unsignedByte. */ @org.junit.Test public void castAs659() { final XQuery query = new XQuery( "xs:string(12) cast as xs:unsignedByte", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("12") ); } /** * Evaluates casting a long into an xs:short. */ @org.junit.Test public void castAs660() { final XQuery query = new XQuery( "let $var := xs:long(120) cast as xs:short return $var instance of xs:short", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates casting a short into an xs:long. */ @org.junit.Test public void castAs661() { final XQuery query = new XQuery( "let $var := xs:short(120) cast as xs:long return $var instance of xs:long", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates casting a xs:nonPositiveInteger into an xs:negativeInteger. */ @org.junit.Test public void castAs662() { final XQuery query = new XQuery( "let $var := xs:nonPositiveInteger(-120) cast as xs:negativeInteger return $var instance of xs:negativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates casting a xs:nonNegativeInteger into an xs:positiveInteger. */ @org.junit.Test public void castAs663() { final XQuery query = new XQuery( "let $var := xs:nonNegativeInteger(120) cast as xs:positiveInteger return $var instance of xs:positiveInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates casting a xs:short into an xs:unsignedShort. */ @org.junit.Test public void castAs664() { final XQuery query = new XQuery( "let $var := xs:short(120) cast as xs:unsignedShort return $var instance of xs:unsignedShort", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates casting a xs:int into an xs:long. */ @org.junit.Test public void castAs665() { final XQuery query = new XQuery( "let $var := xs:int(120) cast as xs:long return $var instance of xs:long", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates casting a xs:long into an xs:int. */ @org.junit.Test public void castAs666() { final XQuery query = new XQuery( "let $var := xs:long(120) cast as xs:int return $var instance of xs:int", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates casting a xs:unsignedShort into an xs:unsignedInt. */ @org.junit.Test public void castAs667() { final XQuery query = new XQuery( "let $var := xs:unsignedShort(120) cast as xs:unsignedInt return $var instance of xs:unsignedInt", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates casting a xs:unsignedInt into an xs:unsignedShort. */ @org.junit.Test public void castAs668() { final XQuery query = new XQuery( "let $var := xs:unsignedInt(120) cast as xs:unsignedShort return $var instance of xs:unsignedShort", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates casting a xs:byte into an xs:unsignedByte. */ @org.junit.Test public void castAs669() { final XQuery query = new XQuery( "let $var := xs:byte(120) cast as xs:unsignedByte return $var instance of xs:unsignedByte", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates overflow of an xs:date time (error FODT0001)It adds 9,000 years to a date created in 2006.. */ @org.junit.Test public void castAs670() { final XQuery query = new XQuery( "let $d1 := '2006-07-12' cast as xs:date let $oneky := xs:yearMonthDuration('P1000Y') let $d2 := $d1 + $oneky let $d3 := $d2 + $oneky let $d4 := $d3 + $oneky let $d5 := $d4 + $oneky let $d6 := $d5 + $oneky let $d7 := $d6 + $oneky let $d8 := $d7 + $oneky let $d9 := $d8 + $oneky let $d10 := $d9 + $oneky return $d10", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "11006-07-12") || error("FODT0001") ) ); } /** * Evaluates casting a string as an xs:ENTITY. */ @org.junit.Test public void castAs671() { final XQuery query = new XQuery( "let $var := \"abc\" cast as xs:ENTITY return $var instance of xs:ENTITY", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluates casting a sequence of strings as an xs:ENTITY. */ @org.junit.Test public void castAs672() { final XQuery query = new XQuery( "let $var := (\"a\",\"b\",\"c\") cast as xs:ENTITY return count($var) lt 10", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try to cast a variable to xs:QName. */ @org.junit.Test public void castAs673a() { xquery10(); final XQuery query = new XQuery( "let $var := \"ABC\" return $var cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try to cast a variable to xs:QName. */ @org.junit.Test public void castAs673b() { final XQuery query = new XQuery( "let $var := \"ABC\" return $var cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ABC") ); } /** * Try to cast an element to xs:QName. * Fails in 1.0 because only a string literal can be cast to xs:QName * Fails in 3.0 because atomization of the argument is not allowed - see bug 11964. */ @org.junit.Test public void castAs674() { xquery10(); final XQuery query = new XQuery( "let $var := xml:space return $var cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try to cast an element to xs:QName. * Fails in 1.0 because only a string literal can be cast to xs:QName * Fails in 3.0 because atomization of the argument is not allowed - see bug 11964. */ @org.junit.Test public void castAs674a() { final XQuery query = new XQuery( "let $var := xml:space return $var cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "xml:space") && assertType("xs:QName") ) ); } /** * Try to do an implicit cast from untypedAtomic to xs:QName as part of a function call * Fails in 1.0 because only a string literal can be cast to xs:QName * Fails in 3.0 because implicit cast to xs:QName during a function call is not allowed - see bug 11964. */ @org.junit.Test public void castAs675() { xquery10(); final XQuery query = new XQuery( "\n" + " declare function local:clarkname($q as xs:QName) as xs:string { \n" + " concat('{', namespace-uri-from-QName($q), '}', local-name-from-QName($q)) \n" + " }; \n" + " let $var := xml:space \n" + " return (local:clarkname(node-name($var)), local:clarkname(xs:untypedAtomic($var)))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Try to do an implicit cast from untypedAtomic to xs:QName as part of a function call * Fails in 1.0 because only a string literal can be cast to xs:QName * Fails in 3.0 because implicit cast to xs:QName during a function call is not allowed - see bug 11964. */ @org.junit.Test public void castAs675a() { final XQuery query = new XQuery( "\n" + " declare function local:clarkname($q as xs:QName) as xs:string { \n" + " concat('{', namespace-uri-from-QName($q), '}', local-name-from-QName($q)) \n" + " }; \n" + " let $var := xml:space \n" + " return (local:clarkname(node-name($var)), local:clarkname(xs:untypedAtomic($var)))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0117") ); } /** * Implicit cast to a namespace-sensitive type during a function call is not allowed.. */ @org.junit.Test public void castAsNamespaceSensitiveType1() { final XQuery query = new XQuery( "\n" + " declare function local:clarkname($q as xs:QName) as xs:string { \n" + " concat('{', namespace-uri-from-QName($q), '}', local-name-from-QName($q)) \n" + " }; \n" + " local:clarkname(xs:untypedAtomic(\"xs:integer\"))\n" + " \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0117") ); } /** * Implicit cast to a namespace-sensitive type during a function call is not allowed.. */ @org.junit.Test public void castAsNamespaceSensitiveType2() { final XQuery query = new XQuery( "\n" + " declare function local:clarkname($q as xs:QName) as xs:string { \n" + " concat('{', namespace-uri-from-QName($q), '}', local-name-from-QName($q)) \n" + " }; \n" + " local:clarkname(xs:integer)\n" + " \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0117") ); } /** * Namespace-sensitive type during a function call (without cast) is allowed.. */ @org.junit.Test public void castAsNamespaceSensitiveType3() { final XQuery query = new XQuery( "\n" + " declare function local:clarkname($q as xs:QName) as xs:string { \n" + " concat('{', namespace-uri-from-QName($q), '}', local-name-from-QName($q)) \n" + " }; \n" + " local:clarkname(xs:QName(\"xs:integer\"))\n" + " \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "{http://www.w3.org/2001/XMLSchema}integer") ); } /** * Implicit cast to a namespace-sensitive type during a function call is not allowed.. */ @org.junit.Test public void castAsNamespaceSensitiveType4() { final XQuery query = new XQuery( "\n" + " declare function local:clarkname($q as xs:NOTATION) as xs:string { \n" + " $q cast as xs:string\n" + " }; \n" + " local:clarkname(xs:untypedAtomic(\"xs:integer\"))\n" + " \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0117") ); } /** * Implicit cast to a namespace-sensitive type during a function call is not allowed.. */ @org.junit.Test public void castAsNamespaceSensitiveType5() { final XQuery query = new XQuery( "\n" + " declare function local:clarkname($q as xs:NOTATION) as xs:string { \n" + " $q cast as xs:string\n" + " }; \n" + " local:clarkname(xs:integer)\n" + " \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0117") ); } /** * casting an xs:decimal with a value to big for that type.. */ @org.junit.Test public void castFOCA00011() { final XQuery query = new XQuery( "xs:decimal(99e100)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertQuery("abs($result - 989999999999999971062477677470550235220096190889648004812994130017827049653182301025734968880029237248) lt 9e99") || error("FOCA0001") ) ); } /** * casting an xs:integer with a value to big for that type.. */ @org.junit.Test public void castFOCA00031() { final XQuery query = new XQuery( "xs:integer(99e100)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertQuery("abs($result - 989999999999999971062477677470550235220096190889648004812994130017827049653182301025734968880029237248) lt 9e99") || error("FOCA0003") ) ); } /** * Syntax: only ? is allowed as occurence indicator in 'cast as' expressions.. */ @org.junit.Test public void kSeqExprCast1() { final XQuery query = new XQuery( "'string' cast as xs:string*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A non-atomic type is referenced, leading to a syntax error.. */ @org.junit.Test public void kSeqExprCast10() { xquery10(); final XQuery query = new XQuery( "'string' cast as item()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XPST0051") ) ); } /** * A test whose essence is: `exists(xs:hexBinary("aa"))`.. */ @org.junit.Test public void kSeqExprCast100() { final XQuery query = new XQuery( "exists(xs:hexBinary(\"aa\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:gYearMonth as sourceType and xs:NOTATION should fail due to it involving xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1000() { final XQuery query = new XQuery( "not(xs:gYearMonth(\"1999-11\") castable as xs:NOTATION)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * The xs:gYear constructor function must be passed exactly one argument, not zero.. */ @org.junit.Test public void kSeqExprCast1001() { final XQuery query = new XQuery( "xs:gYear()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * The xs:gYear constructor function must be passed exactly one argument, not two.. */ @org.junit.Test public void kSeqExprCast1002() { final XQuery query = new XQuery( "xs:gYear( \"1999\" , \"1999\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Verify with 'instance of' that the xs:gYear constructor function produces values of the correct type. * The subsequence() function makes it more difficult for optimizers to take short cuts based on static type information.. */ @org.junit.Test public void kSeqExprCast1003() { final XQuery query = new XQuery( "subsequence((\"dummy\", 1.1, xs:gYear(\"1999\")), 3, 1) instance of xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A simple test exercising the whitespace facet for type xs:gYear.. */ @org.junit.Test public void kSeqExprCast1004() { final XQuery query = new XQuery( "xs:gYear(\" 1999 \") eq xs:gYear(\" 1999 \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An empty string is not a valid lexical representation of xs:gYear.. */ @org.junit.Test public void kSeqExprCast1005() { final XQuery query = new XQuery( "xs:gYear(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a simple xs:untypedAtomic value to "1999" .. */ @org.junit.Test public void kSeqExprCast1006() { final XQuery query = new XQuery( "xs:gYear(xs:untypedAtomic( \"1999\" )) eq xs:gYear(\"1999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * It is not possible to extract an Effective Boolean Value from the type xs:gYear, with the boolean() function.. */ @org.junit.Test public void kSeqExprCast1007() { final XQuery query = new XQuery( "boolean(xs:gYear(\"1999\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Casting from xs:gYear to xs:untypedAtomic is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1008() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:untypedAtomic ne xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:gYear as source type and xs:untypedAtomic as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1009() { final XQuery query = new XQuery( "xs:gYear(\"1999\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `count(xs:hexBinary(xs:hexBinary("03"))) eq 1`.. */ @org.junit.Test public void kSeqExprCast101() { final XQuery query = new XQuery( "count(xs:hexBinary(xs:hexBinary(\"03\"))) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYear to xs:string is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1010() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:string ne xs:string(\"an arbitrary string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:gYear as source type and xs:string as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1011() { final XQuery query = new XQuery( "xs:gYear(\"1999\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYear to xs:float isn't allowed.. */ @org.junit.Test public void kSeqExprCast1012() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYear as source type and xs:float as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1013() { final XQuery query = new XQuery( "not(xs:gYear(\"1999\") castable as xs:float)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYear to xs:double isn't allowed.. */ @org.junit.Test public void kSeqExprCast1014() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYear as source type and xs:double as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1015() { final XQuery query = new XQuery( "not(xs:gYear(\"1999\") castable as xs:double)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYear to xs:decimal isn't allowed.. */ @org.junit.Test public void kSeqExprCast1016() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYear as source type and xs:decimal as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1017() { final XQuery query = new XQuery( "not(xs:gYear(\"1999\") castable as xs:decimal)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYear to xs:integer isn't allowed.. */ @org.junit.Test public void kSeqExprCast1018() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYear as source type and xs:integer as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1019() { final XQuery query = new XQuery( "not(xs:gYear(\"1999\") castable as xs:integer)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:hexBinary("aa")) eq "AA"`.. */ @org.junit.Test public void kSeqExprCast102() { final XQuery query = new XQuery( "xs:string(xs:hexBinary(\"aa\")) eq \"AA\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYear to xs:duration isn't allowed.. */ @org.junit.Test public void kSeqExprCast1020() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYear as source type and xs:duration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1021() { final XQuery query = new XQuery( "not(xs:gYear(\"1999\") castable as xs:duration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYear to xs:yearMonthDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast1022() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYear as source type and xs:yearMonthDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1023() { final XQuery query = new XQuery( "not(xs:gYear(\"1999\") castable as xs:yearMonthDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYear to xs:dayTimeDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast1024() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYear as source type and xs:dayTimeDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1025() { final XQuery query = new XQuery( "not(xs:gYear(\"1999\") castable as xs:dayTimeDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYear to xs:dateTime isn't allowed.. */ @org.junit.Test public void kSeqExprCast1026() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYear as source type and xs:dateTime as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1027() { final XQuery query = new XQuery( "not(xs:gYear(\"1999\") castable as xs:dateTime)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYear to xs:time isn't allowed.. */ @org.junit.Test public void kSeqExprCast1028() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYear as source type and xs:time as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1029() { final XQuery query = new XQuery( "not(xs:gYear(\"1999\") castable as xs:time)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:hexBinary("0a")) eq "0A"`.. */ @org.junit.Test public void kSeqExprCast103() { final XQuery query = new XQuery( "xs:string(xs:hexBinary(\"0a\")) eq \"0A\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYear to xs:date isn't allowed.. */ @org.junit.Test public void kSeqExprCast1030() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYear as source type and xs:date as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1031() { final XQuery query = new XQuery( "not(xs:gYear(\"1999\") castable as xs:date)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYear to xs:gYearMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast1032() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYear as source type and xs:gYearMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1033() { final XQuery query = new XQuery( "not(xs:gYear(\"1999\") castable as xs:gYearMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYear to xs:gYear is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1034() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:gYear eq xs:gYear(\"1999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:gYear as source type and xs:gYear as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1035() { final XQuery query = new XQuery( "xs:gYear(\"1999\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYear to xs:gMonthDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast1036() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYear as source type and xs:gMonthDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1037() { final XQuery query = new XQuery( "not(xs:gYear(\"1999\") castable as xs:gMonthDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYear to xs:gDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast1038() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYear as source type and xs:gDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1039() { final XQuery query = new XQuery( "not(xs:gYear(\"1999\") castable as xs:gDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:hexBinary("a0")) eq "A0"`.. */ @org.junit.Test public void kSeqExprCast104() { final XQuery query = new XQuery( "xs:string(xs:hexBinary(\"a0\")) eq \"A0\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYear to xs:gMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast1040() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYear as source type and xs:gMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1041() { final XQuery query = new XQuery( "not(xs:gYear(\"1999\") castable as xs:gMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYear to xs:boolean isn't allowed.. */ @org.junit.Test public void kSeqExprCast1042() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYear as source type and xs:boolean as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1043() { final XQuery query = new XQuery( "not(xs:gYear(\"1999\") castable as xs:boolean)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYear to xs:base64Binary isn't allowed.. */ @org.junit.Test public void kSeqExprCast1044() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYear as source type and xs:base64Binary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1045() { final XQuery query = new XQuery( "not(xs:gYear(\"1999\") castable as xs:base64Binary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYear to xs:hexBinary isn't allowed.. */ @org.junit.Test public void kSeqExprCast1046() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYear as source type and xs:hexBinary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1047() { final XQuery query = new XQuery( "not(xs:gYear(\"1999\") castable as xs:hexBinary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYear to xs:anyURI isn't allowed.. */ @org.junit.Test public void kSeqExprCast1048() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYear as source type and xs:anyURI as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1049() { final XQuery query = new XQuery( "not(xs:gYear(\"1999\") castable as xs:anyURI)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:hexBinary("a4")) eq "A4"`.. */ @org.junit.Test public void kSeqExprCast105() { final XQuery query = new XQuery( "xs:string(xs:hexBinary(\"a4\")) eq \"A4\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYear to xs:QName isn't allowed.. */ @org.junit.Test public void kSeqExprCast1050() { final XQuery query = new XQuery( "xs:gYear(\"1999\") cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYear as source type and xs:QName as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1051() { final XQuery query = new XQuery( "not(xs:gYear(\"1999\") castable as xs:QName)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:gYear as sourceType and xs:NOTATION should fail due to it involving xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1052() { final XQuery query = new XQuery( "not(xs:gYear(\"1999\") castable as xs:NOTATION)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * The xs:gMonthDay constructor function must be passed exactly one argument, not zero.. */ @org.junit.Test public void kSeqExprCast1053() { final XQuery query = new XQuery( "xs:gMonthDay()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * The xs:gMonthDay constructor function must be passed exactly one argument, not two.. */ @org.junit.Test public void kSeqExprCast1054() { final XQuery query = new XQuery( "xs:gMonthDay( \"--11-13\" , \"--11-13\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Verify with 'instance of' that the xs:gMonthDay constructor function produces values of the correct type. * The subsequence() function makes it more difficult for optimizers to take short cuts based on static type information.. */ @org.junit.Test public void kSeqExprCast1055() { final XQuery query = new XQuery( "subsequence((\"dummy\", 1.1, xs:gMonthDay(\"--11-13\")), 3, 1) instance of xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A simple test exercising the whitespace facet for type xs:gMonthDay.. */ @org.junit.Test public void kSeqExprCast1056() { final XQuery query = new XQuery( "xs:gMonthDay(\" --11-13 \") eq xs:gMonthDay(\" --11-13 \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An empty string is not a valid lexical representation of xs:gMonthDay.. */ @org.junit.Test public void kSeqExprCast1057() { final XQuery query = new XQuery( "xs:gMonthDay(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a simple xs:untypedAtomic value to "--11-13" .. */ @org.junit.Test public void kSeqExprCast1058() { final XQuery query = new XQuery( "xs:gMonthDay(xs:untypedAtomic( \"--11-13\" )) eq xs:gMonthDay(\"--11-13\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * It is not possible to extract an Effective Boolean Value from the type xs:gMonthDay, with the boolean() function.. */ @org.junit.Test public void kSeqExprCast1059() { final XQuery query = new XQuery( "boolean(xs:gMonthDay(\"--11-13\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A test whose essence is: `xs:string(xs:hexBinary("c0")) eq "C0"`.. */ @org.junit.Test public void kSeqExprCast106() { final XQuery query = new XQuery( "xs:string(xs:hexBinary(\"c0\")) eq \"C0\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonthDay to xs:untypedAtomic is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1060() { final XQuery query = new XQuery( "xs:gMonthDay(\"--11-13\") cast as xs:untypedAtomic ne xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:gMonthDay as source type and xs:untypedAtomic as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1061() { final XQuery query = new XQuery( "xs:gMonthDay(\"--11-13\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonthDay to xs:string is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1062() { final XQuery query = new XQuery( "xs:gMonthDay(\"--11-13\") cast as xs:string ne xs:string(\"an arbitrary string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:gMonthDay as source type and xs:string as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1063() { final XQuery query = new XQuery( "xs:gMonthDay(\"--11-13\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonthDay to xs:float isn't allowed.. */ @org.junit.Test public void kSeqExprCast1064() { final XQuery query = new XQuery( "xs:gMonthDay(\"--11-13\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonthDay as source type and xs:float as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1065() { final XQuery query = new XQuery( "not(xs:gMonthDay(\"--11-13\") castable as xs:float)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonthDay to xs:double isn't allowed.. */ @org.junit.Test public void kSeqExprCast1066() { final XQuery query = new XQuery( "xs:gMonthDay(\"--11-13\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonthDay as source type and xs:double as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1067() { final XQuery query = new XQuery( "not(xs:gMonthDay(\"--11-13\") castable as xs:double)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonthDay to xs:decimal isn't allowed.. */ @org.junit.Test public void kSeqExprCast1068() { final XQuery query = new XQuery( "xs:gMonthDay(\"--11-13\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonthDay as source type and xs:decimal as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1069() { final XQuery query = new XQuery( "not(xs:gMonthDay(\"--11-13\") castable as xs:decimal)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:hexBinary("fA")) eq "FA"`.. */ @org.junit.Test public void kSeqExprCast107() { final XQuery query = new XQuery( "xs:string(xs:hexBinary(\"fA\")) eq \"FA\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonthDay to xs:integer isn't allowed.. */ @org.junit.Test public void kSeqExprCast1070() { final XQuery query = new XQuery( "xs:gMonthDay(\"--11-13\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonthDay as source type and xs:integer as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1071() { final XQuery query = new XQuery( "not(xs:gMonthDay(\"--11-13\") castable as xs:integer)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonthDay to xs:duration isn't allowed.. */ @org.junit.Test public void kSeqExprCast1072() { final XQuery query = new XQuery( "xs:gMonthDay(\"--11-13\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonthDay as source type and xs:duration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1073() { final XQuery query = new XQuery( "not(xs:gMonthDay(\"--11-13\") castable as xs:duration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonthDay to xs:yearMonthDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast1074() { final XQuery query = new XQuery( "xs:gMonthDay(\"--11-13\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonthDay as source type and xs:yearMonthDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1075() { final XQuery query = new XQuery( "not(xs:gMonthDay(\"--11-13\") castable as xs:yearMonthDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonthDay to xs:dayTimeDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast1076() { final XQuery query = new XQuery( "xs:gMonthDay(\"--11-13\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonthDay as source type and xs:dayTimeDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1077() { final XQuery query = new XQuery( "not(xs:gMonthDay(\"--11-13\") castable as xs:dayTimeDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonthDay to xs:dateTime isn't allowed.. */ @org.junit.Test public void kSeqExprCast1078() { final XQuery query = new XQuery( "xs:gMonthDay(\"--11-13\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonthDay as source type and xs:dateTime as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1079() { final XQuery query = new XQuery( "not(xs:gMonthDay(\"--11-13\") castable as xs:dateTime)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:hexBinary("10")) eq "10"`.. */ @org.junit.Test public void kSeqExprCast108() { final XQuery query = new XQuery( "xs:string(xs:hexBinary(\"10\")) eq \"10\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonthDay to xs:time isn't allowed.. */ @org.junit.Test public void kSeqExprCast1080() { final XQuery query = new XQuery( "xs:gMonthDay(\"--11-13\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonthDay as source type and xs:time as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1081() { final XQuery query = new XQuery( "not(xs:gMonthDay(\"--11-13\") castable as xs:time)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonthDay to xs:date isn't allowed.. */ @org.junit.Test public void kSeqExprCast1082() { final XQuery query = new XQuery( "xs:gMonthDay(\"--11-13\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonthDay as source type and xs:date as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1083() { final XQuery query = new XQuery( "not(xs:gMonthDay(\"--11-13\") castable as xs:date)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonthDay to xs:gYearMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast1084() { final XQuery query = new XQuery( "xs:gMonthDay(\"--11-13\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonthDay as source type and xs:gYearMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1085() { final XQuery query = new XQuery( "not(xs:gMonthDay(\"--11-13\") castable as xs:gYearMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonthDay to xs:gYear isn't allowed.. */ @org.junit.Test public void kSeqExprCast1086() { final XQuery query = new XQuery( "xs:gMonthDay(\"--11-13\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonthDay as source type and xs:gYear as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1087() { final XQuery query = new XQuery( "not(xs:gMonthDay(\"--11-13\") castable as xs:gYear)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonthDay to xs:gMonthDay is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1088() { final XQuery query = new XQuery( "xs:gMonthDay(\"--11-13\") cast as xs:gMonthDay eq xs:gMonthDay(\"--11-13\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:gMonthDay as source type and xs:gMonthDay as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1089() { final XQuery query = new XQuery( "xs:gMonthDay(\"--11-13\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:hexBinary("031a34123b")) eq "031A34123B"`.. */ @org.junit.Test public void kSeqExprCast109() { final XQuery query = new XQuery( "xs:string(xs:hexBinary(\"031a34123b\")) eq \"031A34123B\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonthDay to xs:gDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast1090() { final XQuery query = new XQuery( "xs:gMonthDay(\"--11-13\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonthDay as source type and xs:gDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1091() { final XQuery query = new XQuery( "not(xs:gMonthDay(\"--11-13\") castable as xs:gDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonthDay to xs:gMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast1092() { final XQuery query = new XQuery( "xs:gMonthDay(\"--11-13\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonthDay as source type and xs:gMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1093() { final XQuery query = new XQuery( "not(xs:gMonthDay(\"--11-13\") castable as xs:gMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonthDay to xs:boolean isn't allowed.. */ @org.junit.Test public void kSeqExprCast1094() { final XQuery query = new XQuery( "xs:gMonthDay(\"--11-13\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonthDay as source type and xs:boolean as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1095() { final XQuery query = new XQuery( "not(xs:gMonthDay(\"--11-13\") castable as xs:boolean)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonthDay to xs:base64Binary isn't allowed.. */ @org.junit.Test public void kSeqExprCast1096() { final XQuery query = new XQuery( "xs:gMonthDay(\"--11-13\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonthDay as source type and xs:base64Binary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1097() { final XQuery query = new XQuery( "not(xs:gMonthDay(\"--11-13\") castable as xs:base64Binary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonthDay to xs:hexBinary isn't allowed.. */ @org.junit.Test public void kSeqExprCast1098() { final XQuery query = new XQuery( "xs:gMonthDay(\"--11-13\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonthDay as source type and xs:hexBinary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1099() { final XQuery query = new XQuery( "not(xs:gMonthDay(\"--11-13\") castable as xs:hexBinary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A non-atomic type is referenced, leading to a syntax error.. */ @org.junit.Test public void kSeqExprCast10a() { final XQuery query = new XQuery( "'string' cast as item()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XQST0052") ) ); } /** * A non-atomic type is referenced, leading to a syntax error.. */ @org.junit.Test public void kSeqExprCast11() { xquery10(); final XQuery query = new XQuery( "'string' cast as node()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XPST0051") ) ); } /** * A test whose essence is: `xs:string(xs:hexBinary("03")) eq "03"`.. */ @org.junit.Test public void kSeqExprCast110() { final XQuery query = new XQuery( "xs:string(xs:hexBinary(\"03\")) eq \"03\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonthDay to xs:anyURI isn't allowed.. */ @org.junit.Test public void kSeqExprCast1100() { final XQuery query = new XQuery( "xs:gMonthDay(\"--11-13\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonthDay as source type and xs:anyURI as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1101() { final XQuery query = new XQuery( "not(xs:gMonthDay(\"--11-13\") castable as xs:anyURI)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonthDay to xs:QName isn't allowed.. */ @org.junit.Test public void kSeqExprCast1102() { final XQuery query = new XQuery( "xs:gMonthDay(\"--11-13\") cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonthDay as source type and xs:QName as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1103() { final XQuery query = new XQuery( "not(xs:gMonthDay(\"--11-13\") castable as xs:QName)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:gMonthDay as sourceType and xs:NOTATION should fail due to it involving xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1104() { final XQuery query = new XQuery( "not(xs:gMonthDay(\"--11-13\") castable as xs:NOTATION)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * The xs:gDay constructor function must be passed exactly one argument, not zero.. */ @org.junit.Test public void kSeqExprCast1105() { final XQuery query = new XQuery( "xs:gDay()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * The xs:gDay constructor function must be passed exactly one argument, not two.. */ @org.junit.Test public void kSeqExprCast1106() { final XQuery query = new XQuery( "xs:gDay( \"---03\" , \"---03\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Verify with 'instance of' that the xs:gDay constructor function produces values of the correct type. * The subsequence() function makes it more difficult for optimizers to take short cuts based on static type information.. */ @org.junit.Test public void kSeqExprCast1107() { final XQuery query = new XQuery( "subsequence((\"dummy\", 1.1, xs:gDay(\"---03\")), 3, 1) instance of xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A simple test exercising the whitespace facet for type xs:gDay.. */ @org.junit.Test public void kSeqExprCast1108() { final XQuery query = new XQuery( "xs:gDay(\" ---03 \") eq xs:gDay(\" ---03 \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An empty string is not a valid lexical representation of xs:gDay.. */ @org.junit.Test public void kSeqExprCast1109() { final XQuery query = new XQuery( "xs:gDay(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `xs:string(xs:hexBinary("0c")) eq "0C"`.. */ @org.junit.Test public void kSeqExprCast111() { final XQuery query = new XQuery( "xs:string(xs:hexBinary(\"0c\")) eq \"0C\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Cast a simple xs:untypedAtomic value to "---03" .. */ @org.junit.Test public void kSeqExprCast1110() { final XQuery query = new XQuery( "xs:gDay(xs:untypedAtomic( \"---03\" )) eq xs:gDay(\"---03\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * It is not possible to extract an Effective Boolean Value from the type xs:gDay, with the boolean() function.. */ @org.junit.Test public void kSeqExprCast1111() { final XQuery query = new XQuery( "boolean(xs:gDay(\"---03\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Casting from xs:gDay to xs:untypedAtomic is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1112() { final XQuery query = new XQuery( "xs:gDay(\"---03\") cast as xs:untypedAtomic ne xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:gDay as source type and xs:untypedAtomic as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1113() { final XQuery query = new XQuery( "xs:gDay(\"---03\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gDay to xs:string is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1114() { final XQuery query = new XQuery( "xs:gDay(\"---03\") cast as xs:string ne xs:string(\"an arbitrary string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:gDay as source type and xs:string as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1115() { final XQuery query = new XQuery( "xs:gDay(\"---03\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gDay to xs:float isn't allowed.. */ @org.junit.Test public void kSeqExprCast1116() { final XQuery query = new XQuery( "xs:gDay(\"---03\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gDay as source type and xs:float as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1117() { final XQuery query = new XQuery( "not(xs:gDay(\"---03\") castable as xs:float)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gDay to xs:double isn't allowed.. */ @org.junit.Test public void kSeqExprCast1118() { final XQuery query = new XQuery( "xs:gDay(\"---03\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gDay as source type and xs:double as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1119() { final XQuery query = new XQuery( "not(xs:gDay(\"---03\") castable as xs:double)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:hexBinary("0b")) eq "0B"`.. */ @org.junit.Test public void kSeqExprCast112() { final XQuery query = new XQuery( "xs:string(xs:hexBinary(\"0b\")) eq \"0B\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gDay to xs:decimal isn't allowed.. */ @org.junit.Test public void kSeqExprCast1120() { final XQuery query = new XQuery( "xs:gDay(\"---03\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gDay as source type and xs:decimal as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1121() { final XQuery query = new XQuery( "not(xs:gDay(\"---03\") castable as xs:decimal)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gDay to xs:integer isn't allowed.. */ @org.junit.Test public void kSeqExprCast1122() { final XQuery query = new XQuery( "xs:gDay(\"---03\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gDay as source type and xs:integer as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1123() { final XQuery query = new XQuery( "not(xs:gDay(\"---03\") castable as xs:integer)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gDay to xs:duration isn't allowed.. */ @org.junit.Test public void kSeqExprCast1124() { final XQuery query = new XQuery( "xs:gDay(\"---03\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gDay as source type and xs:duration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1125() { final XQuery query = new XQuery( "not(xs:gDay(\"---03\") castable as xs:duration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gDay to xs:yearMonthDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast1126() { final XQuery query = new XQuery( "xs:gDay(\"---03\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gDay as source type and xs:yearMonthDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1127() { final XQuery query = new XQuery( "not(xs:gDay(\"---03\") castable as xs:yearMonthDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gDay to xs:dayTimeDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast1128() { final XQuery query = new XQuery( "xs:gDay(\"---03\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gDay as source type and xs:dayTimeDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1129() { final XQuery query = new XQuery( "not(xs:gDay(\"---03\") castable as xs:dayTimeDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:hexBinary("3a")) eq "3A"`.. */ @org.junit.Test public void kSeqExprCast113() { final XQuery query = new XQuery( "xs:string(xs:hexBinary(\"3a\")) eq \"3A\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gDay to xs:dateTime isn't allowed.. */ @org.junit.Test public void kSeqExprCast1130() { final XQuery query = new XQuery( "xs:gDay(\"---03\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gDay as source type and xs:dateTime as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1131() { final XQuery query = new XQuery( "not(xs:gDay(\"---03\") castable as xs:dateTime)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gDay to xs:time isn't allowed.. */ @org.junit.Test public void kSeqExprCast1132() { final XQuery query = new XQuery( "xs:gDay(\"---03\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gDay as source type and xs:time as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1133() { final XQuery query = new XQuery( "not(xs:gDay(\"---03\") castable as xs:time)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gDay to xs:date isn't allowed.. */ @org.junit.Test public void kSeqExprCast1134() { final XQuery query = new XQuery( "xs:gDay(\"---03\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gDay as source type and xs:date as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1135() { final XQuery query = new XQuery( "not(xs:gDay(\"---03\") castable as xs:date)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gDay to xs:gYearMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast1136() { final XQuery query = new XQuery( "xs:gDay(\"---03\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gDay as source type and xs:gYearMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1137() { final XQuery query = new XQuery( "not(xs:gDay(\"---03\") castable as xs:gYearMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gDay to xs:gYear isn't allowed.. */ @org.junit.Test public void kSeqExprCast1138() { final XQuery query = new XQuery( "xs:gDay(\"---03\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gDay as source type and xs:gYear as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1139() { final XQuery query = new XQuery( "not(xs:gDay(\"---03\") castable as xs:gYear)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An empty string is a valid lexical representation for xs:hexBinary, and means 'no data.. */ @org.junit.Test public void kSeqExprCast114() { final XQuery query = new XQuery( "xs:string(xs:hexBinary(\"\")) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gDay to xs:gMonthDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast1140() { final XQuery query = new XQuery( "xs:gDay(\"---03\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gDay as source type and xs:gMonthDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1141() { final XQuery query = new XQuery( "not(xs:gDay(\"---03\") castable as xs:gMonthDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gDay to xs:gDay is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1142() { final XQuery query = new XQuery( "xs:gDay(\"---03\") cast as xs:gDay eq xs:gDay(\"---03\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:gDay as source type and xs:gDay as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1143() { final XQuery query = new XQuery( "xs:gDay(\"---03\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gDay to xs:gMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast1144() { final XQuery query = new XQuery( "xs:gDay(\"---03\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gDay as source type and xs:gMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1145() { final XQuery query = new XQuery( "not(xs:gDay(\"---03\") castable as xs:gMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gDay to xs:boolean isn't allowed.. */ @org.junit.Test public void kSeqExprCast1146() { final XQuery query = new XQuery( "xs:gDay(\"---03\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gDay as source type and xs:boolean as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1147() { final XQuery query = new XQuery( "not(xs:gDay(\"---03\") castable as xs:boolean)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gDay to xs:base64Binary isn't allowed.. */ @org.junit.Test public void kSeqExprCast1148() { final XQuery query = new XQuery( "xs:gDay(\"---03\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gDay as source type and xs:base64Binary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1149() { final XQuery query = new XQuery( "not(xs:gDay(\"---03\") castable as xs:base64Binary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An invalid lexical representation for xs:base64Binary.. */ @org.junit.Test public void kSeqExprCast115() { final XQuery query = new XQuery( "xs:string(xs:base64Binary(\"=aaabbcd\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Casting from xs:gDay to xs:hexBinary isn't allowed.. */ @org.junit.Test public void kSeqExprCast1150() { final XQuery query = new XQuery( "xs:gDay(\"---03\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gDay as source type and xs:hexBinary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1151() { final XQuery query = new XQuery( "not(xs:gDay(\"---03\") castable as xs:hexBinary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gDay to xs:anyURI isn't allowed.. */ @org.junit.Test public void kSeqExprCast1152() { final XQuery query = new XQuery( "xs:gDay(\"---03\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gDay as source type and xs:anyURI as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1153() { final XQuery query = new XQuery( "not(xs:gDay(\"---03\") castable as xs:anyURI)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gDay to xs:QName isn't allowed.. */ @org.junit.Test public void kSeqExprCast1154() { final XQuery query = new XQuery( "xs:gDay(\"---03\") cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gDay as source type and xs:QName as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1155() { final XQuery query = new XQuery( "not(xs:gDay(\"---03\") castable as xs:QName)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:gDay as sourceType and xs:NOTATION should fail due to it involving xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1156() { final XQuery query = new XQuery( "not(xs:gDay(\"---03\") castable as xs:NOTATION)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * The xs:gMonth constructor function must be passed exactly one argument, not zero.. */ @org.junit.Test public void kSeqExprCast1157() { final XQuery query = new XQuery( "xs:gMonth()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * The xs:gMonth constructor function must be passed exactly one argument, not two.. */ @org.junit.Test public void kSeqExprCast1158() { final XQuery query = new XQuery( "xs:gMonth( \"--11\" , \"--11\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Verify with 'instance of' that the xs:gMonth constructor function produces values of the correct type. * The subsequence() function makes it more difficult for optimizers to take short cuts based on static type information.. */ @org.junit.Test public void kSeqExprCast1159() { final XQuery query = new XQuery( "subsequence((\"dummy\", 1.1, xs:gMonth(\"--11\")), 3, 1) instance of xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An invalid lexical representation for xs:base64Binary.. */ @org.junit.Test public void kSeqExprCast116() { final XQuery query = new XQuery( "xs:string(xs:base64Binary(\"F===\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A simple test exercising the whitespace facet for type xs:gMonth.. */ @org.junit.Test public void kSeqExprCast1160() { final XQuery query = new XQuery( "xs:gMonth(\" --11 \") eq xs:gMonth(\" --11 \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An empty string is not a valid lexical representation of xs:gMonth.. */ @org.junit.Test public void kSeqExprCast1161() { final XQuery query = new XQuery( "xs:gMonth(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a simple xs:untypedAtomic value to "--11" .. */ @org.junit.Test public void kSeqExprCast1162() { final XQuery query = new XQuery( "xs:gMonth(xs:untypedAtomic( \"--11\" )) eq xs:gMonth(\"--11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * It is not possible to extract an Effective Boolean Value from the type xs:gMonth, with the boolean() function.. */ @org.junit.Test public void kSeqExprCast1163() { final XQuery query = new XQuery( "boolean(xs:gMonth(\"--11\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Casting from xs:gMonth to xs:untypedAtomic is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1164() { final XQuery query = new XQuery( "xs:gMonth(\"--11\") cast as xs:untypedAtomic ne xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:gMonth as source type and xs:untypedAtomic as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1165() { final XQuery query = new XQuery( "xs:gMonth(\"--11\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonth to xs:string is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1166() { final XQuery query = new XQuery( "xs:gMonth(\"--11\") cast as xs:string ne xs:string(\"an arbitrary string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:gMonth as source type and xs:string as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1167() { final XQuery query = new XQuery( "xs:gMonth(\"--11\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonth to xs:float isn't allowed.. */ @org.junit.Test public void kSeqExprCast1168() { final XQuery query = new XQuery( "xs:gMonth(\"--11\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonth as source type and xs:float as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1169() { final XQuery query = new XQuery( "not(xs:gMonth(\"--11\") castable as xs:float)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An invalid lexical representation for xs:base64Binary.. */ @org.junit.Test public void kSeqExprCast117() { final XQuery query = new XQuery( "xs:string(xs:base64Binary(\"a\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Casting from xs:gMonth to xs:double isn't allowed.. */ @org.junit.Test public void kSeqExprCast1170() { final XQuery query = new XQuery( "xs:gMonth(\"--11\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonth as source type and xs:double as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1171() { final XQuery query = new XQuery( "not(xs:gMonth(\"--11\") castable as xs:double)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonth to xs:decimal isn't allowed.. */ @org.junit.Test public void kSeqExprCast1172() { final XQuery query = new XQuery( "xs:gMonth(\"--11\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonth as source type and xs:decimal as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1173() { final XQuery query = new XQuery( "not(xs:gMonth(\"--11\") castable as xs:decimal)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonth to xs:integer isn't allowed.. */ @org.junit.Test public void kSeqExprCast1174() { final XQuery query = new XQuery( "xs:gMonth(\"--11\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonth as source type and xs:integer as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1175() { final XQuery query = new XQuery( "not(xs:gMonth(\"--11\") castable as xs:integer)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonth to xs:duration isn't allowed.. */ @org.junit.Test public void kSeqExprCast1176() { final XQuery query = new XQuery( "xs:gMonth(\"--11\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonth as source type and xs:duration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1177() { final XQuery query = new XQuery( "not(xs:gMonth(\"--11\") castable as xs:duration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonth to xs:yearMonthDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast1178() { final XQuery query = new XQuery( "xs:gMonth(\"--11\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonth as source type and xs:yearMonthDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1179() { final XQuery query = new XQuery( "not(xs:gMonth(\"--11\") castable as xs:yearMonthDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An invalid lexical representation for xs:base64Binary.. */ @org.junit.Test public void kSeqExprCast118() { final XQuery query = new XQuery( "xs:string(xs:base64Binary(\"aaaa====\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Casting from xs:gMonth to xs:dayTimeDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast1180() { final XQuery query = new XQuery( "xs:gMonth(\"--11\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonth as source type and xs:dayTimeDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1181() { final XQuery query = new XQuery( "not(xs:gMonth(\"--11\") castable as xs:dayTimeDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonth to xs:dateTime isn't allowed.. */ @org.junit.Test public void kSeqExprCast1182() { final XQuery query = new XQuery( "xs:gMonth(\"--11\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonth as source type and xs:dateTime as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1183() { final XQuery query = new XQuery( "not(xs:gMonth(\"--11\") castable as xs:dateTime)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonth to xs:time isn't allowed.. */ @org.junit.Test public void kSeqExprCast1184() { final XQuery query = new XQuery( "xs:gMonth(\"--11\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonth as source type and xs:time as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1185() { final XQuery query = new XQuery( "not(xs:gMonth(\"--11\") castable as xs:time)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonth to xs:date isn't allowed.. */ @org.junit.Test public void kSeqExprCast1186() { final XQuery query = new XQuery( "xs:gMonth(\"--11\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonth as source type and xs:date as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1187() { final XQuery query = new XQuery( "not(xs:gMonth(\"--11\") castable as xs:date)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonth to xs:gYearMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast1188() { final XQuery query = new XQuery( "xs:gMonth(\"--11\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonth as source type and xs:gYearMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1189() { final XQuery query = new XQuery( "not(xs:gMonth(\"--11\") castable as xs:gYearMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An invalid lexical representation for xs:base64Binary.. */ @org.junit.Test public void kSeqExprCast119() { final XQuery query = new XQuery( "xs:string(xs:base64Binary(\"aaaa=bcd\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Casting from xs:gMonth to xs:gYear isn't allowed.. */ @org.junit.Test public void kSeqExprCast1190() { final XQuery query = new XQuery( "xs:gMonth(\"--11\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonth as source type and xs:gYear as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1191() { final XQuery query = new XQuery( "not(xs:gMonth(\"--11\") castable as xs:gYear)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonth to xs:gMonthDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast1192() { final XQuery query = new XQuery( "xs:gMonth(\"--11\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonth as source type and xs:gMonthDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1193() { final XQuery query = new XQuery( "not(xs:gMonth(\"--11\") castable as xs:gMonthDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonth to xs:gDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast1194() { final XQuery query = new XQuery( "xs:gMonth(\"--11\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonth as source type and xs:gDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1195() { final XQuery query = new XQuery( "not(xs:gMonth(\"--11\") castable as xs:gDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonth to xs:gMonth is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1196() { final XQuery query = new XQuery( "xs:gMonth(\"--11\") cast as xs:gMonth eq xs:gMonth(\"--11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:gMonth as source type and xs:gMonth as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1197() { final XQuery query = new XQuery( "xs:gMonth(\"--11\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonth to xs:boolean isn't allowed.. */ @org.junit.Test public void kSeqExprCast1198() { final XQuery query = new XQuery( "xs:gMonth(\"--11\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonth as source type and xs:boolean as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1199() { final XQuery query = new XQuery( "not(xs:gMonth(\"--11\") castable as xs:boolean)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A non-atomic type is referenced, leading to a syntax error.. */ @org.junit.Test public void kSeqExprCast11a() { final XQuery query = new XQuery( "'string' cast as node()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XQST0052") ) ); } /** * A non-atomic type is referenced, leading to a syntax error.. */ @org.junit.Test public void kSeqExprCast12() { xquery10(); final XQuery query = new XQuery( "'string' cast as attribute()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XPST0051") ) ); } /** * An invalid lexical representation for xs:base64Binary.. */ @org.junit.Test public void kSeqExprCast120() { final XQuery query = new XQuery( "xs:string(xs:base64Binary(\"aaaaa=======\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Casting from xs:gMonth to xs:base64Binary isn't allowed.. */ @org.junit.Test public void kSeqExprCast1200() { final XQuery query = new XQuery( "xs:gMonth(\"--11\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonth as source type and xs:base64Binary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1201() { final XQuery query = new XQuery( "not(xs:gMonth(\"--11\") castable as xs:base64Binary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonth to xs:hexBinary isn't allowed.. */ @org.junit.Test public void kSeqExprCast1202() { final XQuery query = new XQuery( "xs:gMonth(\"--11\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonth as source type and xs:hexBinary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1203() { final XQuery query = new XQuery( "not(xs:gMonth(\"--11\") castable as xs:hexBinary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonth to xs:anyURI isn't allowed.. */ @org.junit.Test public void kSeqExprCast1204() { final XQuery query = new XQuery( "xs:gMonth(\"--11\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonth as source type and xs:anyURI as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1205() { final XQuery query = new XQuery( "not(xs:gMonth(\"--11\") castable as xs:anyURI)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gMonth to xs:QName isn't allowed.. */ @org.junit.Test public void kSeqExprCast1206() { final XQuery query = new XQuery( "xs:gMonth(\"--11\") cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gMonth as source type and xs:QName as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1207() { final XQuery query = new XQuery( "not(xs:gMonth(\"--11\") castable as xs:QName)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:gMonth as sourceType and xs:NOTATION should fail due to it involving xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1208() { final XQuery query = new XQuery( "not(xs:gMonth(\"--11\") castable as xs:NOTATION)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * The xs:boolean constructor function must be passed exactly one argument, not zero.. */ @org.junit.Test public void kSeqExprCast1209() { final XQuery query = new XQuery( "xs:boolean()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * An invalid lexical representation for xs:base64Binary.. */ @org.junit.Test public void kSeqExprCast121() { final XQuery query = new XQuery( "xs:string(xs:base64Binary(\"aaaabcd\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * The xs:boolean constructor function must be passed exactly one argument, not two.. */ @org.junit.Test public void kSeqExprCast1210() { final XQuery query = new XQuery( "xs:boolean( \"true\" , \"true\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Verify with 'instance of' that the xs:boolean constructor function produces values of the correct type. * The subsequence() function makes it more difficult for optimizers to take short cuts based on static type information.. */ @org.junit.Test public void kSeqExprCast1211() { final XQuery query = new XQuery( "subsequence((\"dummy\", 1.1, xs:boolean(\"true\")), 3, 1) instance of xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A simple test exercising the whitespace facet for type xs:boolean.. */ @org.junit.Test public void kSeqExprCast1212() { final XQuery query = new XQuery( "xs:boolean(\" true \") eq xs:boolean(\" true \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An empty string is not a valid lexical representation of xs:boolean.. */ @org.junit.Test public void kSeqExprCast1213() { final XQuery query = new XQuery( "xs:boolean(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a simple xs:untypedAtomic value to "true" .. */ @org.junit.Test public void kSeqExprCast1214() { final XQuery query = new XQuery( "xs:boolean(xs:untypedAtomic( \"true\" )) eq xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Applying fn:boolean() to a value of type xs:boolean that has the lexical value ' "true" ' * should result in the boolean value true.. */ @org.junit.Test public void kSeqExprCast1215() { final XQuery query = new XQuery( "boolean(xs:boolean(\"true\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:boolean to xs:untypedAtomic is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1216() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:untypedAtomic ne xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:boolean as source type and xs:untypedAtomic as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1217() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:boolean to xs:string is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1218() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:string ne xs:string(\"an arbitrary string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:boolean as source type and xs:string as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1219() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An invalid lexical representation for xs:base64Binary.. */ @org.junit.Test public void kSeqExprCast122() { final XQuery query = new XQuery( "xs:string(xs:base64Binary(\"aaaabcd|\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Casting from xs:boolean to xs:float is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1220() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:float ne xs:float(\"3.4e5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:boolean as source type and xs:float as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1221() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:boolean to xs:double is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1222() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:double ne xs:double(\"3.3e3\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:boolean as source type and xs:double as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1223() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:boolean to xs:decimal is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1224() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:decimal ne xs:decimal(\"10.01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:boolean as source type and xs:decimal as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1225() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:boolean to xs:integer is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1226() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:integer ne xs:integer(\"6789\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:boolean as source type and xs:integer as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1227() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:boolean to xs:duration isn't allowed.. */ @org.junit.Test public void kSeqExprCast1228() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:boolean as source type and xs:duration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1229() { final XQuery query = new XQuery( "not(xs:boolean(\"true\") castable as xs:duration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An invalid lexical representation for xs:base64Binary.. */ @org.junit.Test public void kSeqExprCast123() { final XQuery query = new XQuery( "xs:string(xs:base64Binary(\"aabb=d==\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Casting from xs:boolean to xs:yearMonthDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast1230() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:boolean as source type and xs:yearMonthDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1231() { final XQuery query = new XQuery( "not(xs:boolean(\"true\") castable as xs:yearMonthDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:boolean to xs:dayTimeDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast1232() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:boolean as source type and xs:dayTimeDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1233() { final XQuery query = new XQuery( "not(xs:boolean(\"true\") castable as xs:dayTimeDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:boolean to xs:dateTime isn't allowed.. */ @org.junit.Test public void kSeqExprCast1234() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:boolean as source type and xs:dateTime as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1235() { final XQuery query = new XQuery( "not(xs:boolean(\"true\") castable as xs:dateTime)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:boolean to xs:time isn't allowed.. */ @org.junit.Test public void kSeqExprCast1236() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:boolean as source type and xs:time as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1237() { final XQuery query = new XQuery( "not(xs:boolean(\"true\") castable as xs:time)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:boolean to xs:date isn't allowed.. */ @org.junit.Test public void kSeqExprCast1238() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:boolean as source type and xs:date as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1239() { final XQuery query = new XQuery( "not(xs:boolean(\"true\") castable as xs:date)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An invalid lexical representation for xs:base64Binary.. */ @org.junit.Test public void kSeqExprCast124() { final XQuery query = new XQuery( "xs:string(xs:base64Binary(\"aabbcd=a\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Casting from xs:boolean to xs:gYearMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast1240() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:boolean as source type and xs:gYearMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1241() { final XQuery query = new XQuery( "not(xs:boolean(\"true\") castable as xs:gYearMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:boolean to xs:gYear isn't allowed.. */ @org.junit.Test public void kSeqExprCast1242() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:boolean as source type and xs:gYear as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1243() { final XQuery query = new XQuery( "not(xs:boolean(\"true\") castable as xs:gYear)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:boolean to xs:gMonthDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast1244() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:boolean as source type and xs:gMonthDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1245() { final XQuery query = new XQuery( "not(xs:boolean(\"true\") castable as xs:gMonthDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:boolean to xs:gDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast1246() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:boolean as source type and xs:gDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1247() { final XQuery query = new XQuery( "not(xs:boolean(\"true\") castable as xs:gDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:boolean to xs:gMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast1248() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:boolean as source type and xs:gMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1249() { final XQuery query = new XQuery( "not(xs:boolean(\"true\") castable as xs:gMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An invalid lexical representation for xs:base64Binary.. */ @org.junit.Test public void kSeqExprCast125() { final XQuery query = new XQuery( "xs:string(xs:base64Binary(\"abcdefghi\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Casting from xs:boolean to xs:boolean is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1250() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:boolean eq xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:boolean as source type and xs:boolean as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1251() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:boolean to xs:base64Binary isn't allowed.. */ @org.junit.Test public void kSeqExprCast1252() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:boolean as source type and xs:base64Binary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1253() { final XQuery query = new XQuery( "not(xs:boolean(\"true\") castable as xs:base64Binary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:boolean to xs:hexBinary isn't allowed.. */ @org.junit.Test public void kSeqExprCast1254() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:boolean as source type and xs:hexBinary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1255() { final XQuery query = new XQuery( "not(xs:boolean(\"true\") castable as xs:hexBinary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:boolean to xs:anyURI isn't allowed.. */ @org.junit.Test public void kSeqExprCast1256() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:boolean as source type and xs:anyURI as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1257() { final XQuery query = new XQuery( "not(xs:boolean(\"true\") castable as xs:anyURI)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:boolean to xs:QName isn't allowed.. */ @org.junit.Test public void kSeqExprCast1258() { final XQuery query = new XQuery( "xs:boolean(\"true\") cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:boolean as source type and xs:QName as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1259() { final XQuery query = new XQuery( "not(xs:boolean(\"true\") castable as xs:QName)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:base64Binary("0w==")) eq "0w=="`.. */ @org.junit.Test public void kSeqExprCast126() { final XQuery query = new XQuery( "xs:string(xs:base64Binary(\"0w==\")) eq \"0w==\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:boolean as sourceType and xs:NOTATION should fail due to it involving xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1260() { final XQuery query = new XQuery( "not(xs:boolean(\"true\") castable as xs:NOTATION)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * The xs:base64Binary constructor function must be passed exactly one argument, not zero.. */ @org.junit.Test public void kSeqExprCast1261() { final XQuery query = new XQuery( "xs:base64Binary()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * The xs:base64Binary constructor function must be passed exactly one argument, not two.. */ @org.junit.Test public void kSeqExprCast1262() { final XQuery query = new XQuery( "xs:base64Binary( \"aaaa\" , \"aaaa\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Verify with 'instance of' that the xs:base64Binary constructor function produces values of the correct type. * The subsequence() function makes it more difficult for optimizers to take short cuts based on static type information.. */ @org.junit.Test public void kSeqExprCast1263() { final XQuery query = new XQuery( "subsequence((\"dummy\", 1.1, xs:base64Binary(\"aaaa\")), 3, 1) instance of xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A simple test exercising the whitespace facet for type xs:base64Binary.. */ @org.junit.Test public void kSeqExprCast1264() { final XQuery query = new XQuery( "xs:base64Binary(\" aaaa \") eq xs:base64Binary(\" aaaa \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An empty string is a valid lexical representation of xs:base64Binary.. */ @org.junit.Test public void kSeqExprCast1265() { final XQuery query = new XQuery( "xs:base64Binary(\"\") eq xs:base64Binary(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Cast a simple xs:untypedAtomic value to "aaaa" .. */ @org.junit.Test public void kSeqExprCast1266() { final XQuery query = new XQuery( "xs:base64Binary(xs:untypedAtomic( \"aaaa\" )) eq xs:base64Binary(\"aaaa\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * It is not possible to extract an Effective Boolean Value from the type xs:base64Binary, with the boolean() function.. */ @org.junit.Test public void kSeqExprCast1267() { final XQuery query = new XQuery( "boolean(xs:base64Binary(\"aaaa\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Casting from xs:base64Binary to xs:untypedAtomic is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1268() { final XQuery query = new XQuery( "xs:base64Binary(\"aaaa\") cast as xs:untypedAtomic ne xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:base64Binary as source type and xs:untypedAtomic as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1269() { final XQuery query = new XQuery( "xs:base64Binary(\"aaaa\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:base64Binary("aaa a")) eq "aaaa"`.. */ @org.junit.Test public void kSeqExprCast127() { final XQuery query = new XQuery( "xs:string(xs:base64Binary(\"aaa a\")) eq \"aaaa\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:base64Binary to xs:string is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1270() { final XQuery query = new XQuery( "xs:base64Binary(\"aaaa\") cast as xs:string ne xs:string(\"an arbitrary string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:base64Binary as source type and xs:string as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1271() { final XQuery query = new XQuery( "xs:base64Binary(\"aaaa\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:base64Binary to xs:float isn't allowed.. */ @org.junit.Test public void kSeqExprCast1272() { final XQuery query = new XQuery( "xs:base64Binary(\"aaaa\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:base64Binary as source type and xs:float as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1273() { final XQuery query = new XQuery( "not(xs:base64Binary(\"aaaa\") castable as xs:float)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:base64Binary to xs:double isn't allowed.. */ @org.junit.Test public void kSeqExprCast1274() { final XQuery query = new XQuery( "xs:base64Binary(\"aaaa\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:base64Binary as source type and xs:double as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1275() { final XQuery query = new XQuery( "not(xs:base64Binary(\"aaaa\") castable as xs:double)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:base64Binary to xs:decimal isn't allowed.. */ @org.junit.Test public void kSeqExprCast1276() { final XQuery query = new XQuery( "xs:base64Binary(\"aaaa\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:base64Binary as source type and xs:decimal as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1277() { final XQuery query = new XQuery( "not(xs:base64Binary(\"aaaa\") castable as xs:decimal)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:base64Binary to xs:integer isn't allowed.. */ @org.junit.Test public void kSeqExprCast1278() { final XQuery query = new XQuery( "xs:base64Binary(\"aaaa\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:base64Binary as source type and xs:integer as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1279() { final XQuery query = new XQuery( "not(xs:base64Binary(\"aaaa\") castable as xs:integer)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:base64Binary("frfhforlksid7453")) eq "frfhforlksid7453"`.. */ @org.junit.Test public void kSeqExprCast128() { final XQuery query = new XQuery( "xs:string(xs:base64Binary(\"frfhforlksid7453\")) eq \"frfhforlksid7453\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:base64Binary to xs:duration isn't allowed.. */ @org.junit.Test public void kSeqExprCast1280() { final XQuery query = new XQuery( "xs:base64Binary(\"aaaa\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:base64Binary as source type and xs:duration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1281() { final XQuery query = new XQuery( "not(xs:base64Binary(\"aaaa\") castable as xs:duration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:base64Binary to xs:yearMonthDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast1282() { final XQuery query = new XQuery( "xs:base64Binary(\"aaaa\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:base64Binary as source type and xs:yearMonthDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1283() { final XQuery query = new XQuery( "not(xs:base64Binary(\"aaaa\") castable as xs:yearMonthDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:base64Binary to xs:dayTimeDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast1284() { final XQuery query = new XQuery( "xs:base64Binary(\"aaaa\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:base64Binary as source type and xs:dayTimeDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1285() { final XQuery query = new XQuery( "not(xs:base64Binary(\"aaaa\") castable as xs:dayTimeDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:base64Binary to xs:dateTime isn't allowed.. */ @org.junit.Test public void kSeqExprCast1286() { final XQuery query = new XQuery( "xs:base64Binary(\"aaaa\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:base64Binary as source type and xs:dateTime as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1287() { final XQuery query = new XQuery( "not(xs:base64Binary(\"aaaa\") castable as xs:dateTime)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:base64Binary to xs:time isn't allowed.. */ @org.junit.Test public void kSeqExprCast1288() { final XQuery query = new XQuery( "xs:base64Binary(\"aaaa\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:base64Binary as source type and xs:time as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1289() { final XQuery query = new XQuery( "not(xs:base64Binary(\"aaaa\") castable as xs:time)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * If the last tetragram ends in '==' then the previous character must be one of [AQgw].. */ @org.junit.Test public void kSeqExprCast129() { final XQuery query = new XQuery( "xs:base64Binary(\"frfhforlksid745323==\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Casting from xs:base64Binary to xs:date isn't allowed.. */ @org.junit.Test public void kSeqExprCast1290() { final XQuery query = new XQuery( "xs:base64Binary(\"aaaa\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:base64Binary as source type and xs:date as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1291() { final XQuery query = new XQuery( "not(xs:base64Binary(\"aaaa\") castable as xs:date)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:base64Binary to xs:gYearMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast1292() { final XQuery query = new XQuery( "xs:base64Binary(\"aaaa\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:base64Binary as source type and xs:gYearMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1293() { final XQuery query = new XQuery( "not(xs:base64Binary(\"aaaa\") castable as xs:gYearMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:base64Binary to xs:gYear isn't allowed.. */ @org.junit.Test public void kSeqExprCast1294() { final XQuery query = new XQuery( "xs:base64Binary(\"aaaa\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:base64Binary as source type and xs:gYear as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1295() { final XQuery query = new XQuery( "not(xs:base64Binary(\"aaaa\") castable as xs:gYear)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:base64Binary to xs:gMonthDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast1296() { final XQuery query = new XQuery( "xs:base64Binary(\"aaaa\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:base64Binary as source type and xs:gMonthDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1297() { final XQuery query = new XQuery( "not(xs:base64Binary(\"aaaa\") castable as xs:gMonthDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:base64Binary to xs:gDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast1298() { final XQuery query = new XQuery( "xs:base64Binary(\"aaaa\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:base64Binary as source type and xs:gDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1299() { final XQuery query = new XQuery( "not(xs:base64Binary(\"aaaa\") castable as xs:gDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A non-atomic type is referenced, leading to a syntax error.. */ @org.junit.Test public void kSeqExprCast12a() { final XQuery query = new XQuery( "'string' cast as attribute()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XQST0052") ) ); } /** * A non-atomic type is referenced, leading to a syntax error.. */ @org.junit.Test public void kSeqExprCast13() { xquery10(); final XQuery query = new XQuery( "'string' cast as empty-sequence()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XPST0051") ) ); } /** * A test whose essence is: `xs:string(xs:base64Binary(xs:hexBinary("03"))) eq "Aw=="`.. */ @org.junit.Test public void kSeqExprCast130() { final XQuery query = new XQuery( "xs:string(xs:base64Binary(xs:hexBinary(\"03\"))) eq \"Aw==\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:base64Binary to xs:gMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast1300() { final XQuery query = new XQuery( "xs:base64Binary(\"aaaa\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:base64Binary as source type and xs:gMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1301() { final XQuery query = new XQuery( "not(xs:base64Binary(\"aaaa\") castable as xs:gMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:base64Binary to xs:boolean isn't allowed.. */ @org.junit.Test public void kSeqExprCast1302() { final XQuery query = new XQuery( "xs:base64Binary(\"aaaa\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:base64Binary as source type and xs:boolean as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1303() { final XQuery query = new XQuery( "not(xs:base64Binary(\"aaaa\") castable as xs:boolean)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:base64Binary to xs:base64Binary is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1304() { final XQuery query = new XQuery( "xs:base64Binary(\"aaaa\") cast as xs:base64Binary eq xs:base64Binary(\"aaaa\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:base64Binary as source type and xs:base64Binary as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1305() { final XQuery query = new XQuery( "xs:base64Binary(\"aaaa\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:base64Binary to xs:hexBinary is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1306() { final XQuery query = new XQuery( "xs:base64Binary(\"aaaa\") cast as xs:hexBinary ne xs:hexBinary(\"0FB7\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:base64Binary as source type and xs:hexBinary as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1307() { final XQuery query = new XQuery( "xs:base64Binary(\"aaaa\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:base64Binary to xs:anyURI isn't allowed.. */ @org.junit.Test public void kSeqExprCast1308() { final XQuery query = new XQuery( "xs:base64Binary(\"aaaa\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:base64Binary as source type and xs:anyURI as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1309() { final XQuery query = new XQuery( "not(xs:base64Binary(\"aaaa\") castable as xs:anyURI)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:base64Binary(xs:hexBinary("0f3c"))) eq "Dzw="`.. */ @org.junit.Test public void kSeqExprCast131() { final XQuery query = new XQuery( "xs:string(xs:base64Binary(xs:hexBinary(\"0f3c\"))) eq \"Dzw=\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:base64Binary to xs:QName isn't allowed.. */ @org.junit.Test public void kSeqExprCast1310() { final XQuery query = new XQuery( "xs:base64Binary(\"aaaa\") cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:base64Binary as source type and xs:QName as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1311() { final XQuery query = new XQuery( "not(xs:base64Binary(\"aaaa\") castable as xs:QName)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:base64Binary as sourceType and xs:NOTATION should fail due to it involving xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1312() { final XQuery query = new XQuery( "not(xs:base64Binary(\"aaaa\") castable as xs:NOTATION)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * The xs:hexBinary constructor function must be passed exactly one argument, not zero.. */ @org.junit.Test public void kSeqExprCast1313() { final XQuery query = new XQuery( "xs:hexBinary()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * The xs:hexBinary constructor function must be passed exactly one argument, not two.. */ @org.junit.Test public void kSeqExprCast1314() { final XQuery query = new XQuery( "xs:hexBinary( \"0FB7\" , \"0FB7\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Verify with 'instance of' that the xs:hexBinary constructor function produces values of the correct type. * The subsequence() function makes it more difficult for optimizers to take short cuts based on static type information.. */ @org.junit.Test public void kSeqExprCast1315() { final XQuery query = new XQuery( "subsequence((\"dummy\", 1.1, xs:hexBinary(\"0FB7\")), 3, 1) instance of xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A simple test exercising the whitespace facet for type xs:hexBinary.. */ @org.junit.Test public void kSeqExprCast1316() { final XQuery query = new XQuery( "xs:hexBinary(\" 0FB7 \") eq xs:hexBinary(\" 0FB7 \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An empty string is a valid lexical representation of xs:hexBinary.. */ @org.junit.Test public void kSeqExprCast1317() { final XQuery query = new XQuery( "xs:hexBinary(\"\") eq xs:hexBinary(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Cast a simple xs:untypedAtomic value to "0FB7" .. */ @org.junit.Test public void kSeqExprCast1318() { final XQuery query = new XQuery( "xs:hexBinary(xs:untypedAtomic( \"0FB7\" )) eq xs:hexBinary(\"0FB7\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * It is not possible to extract an Effective Boolean Value from the type xs:hexBinary, with the boolean() function.. */ @org.junit.Test public void kSeqExprCast1319() { final XQuery query = new XQuery( "boolean(xs:hexBinary(\"0FB7\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * A test whose essence is: `xs:string(xs:base64Binary(xs:hexBinary("12"))) eq "Eg=="`.. */ @org.junit.Test public void kSeqExprCast132() { final XQuery query = new XQuery( "xs:string(xs:base64Binary(xs:hexBinary(\"12\"))) eq \"Eg==\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:hexBinary to xs:untypedAtomic is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1320() { final XQuery query = new XQuery( "xs:hexBinary(\"0FB7\") cast as xs:untypedAtomic ne xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:hexBinary as source type and xs:untypedAtomic as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1321() { final XQuery query = new XQuery( "xs:hexBinary(\"0FB7\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:hexBinary to xs:string is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1322() { final XQuery query = new XQuery( "xs:hexBinary(\"0FB7\") cast as xs:string ne xs:string(\"an arbitrary string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:hexBinary as source type and xs:string as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1323() { final XQuery query = new XQuery( "xs:hexBinary(\"0FB7\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:hexBinary to xs:float isn't allowed.. */ @org.junit.Test public void kSeqExprCast1324() { final XQuery query = new XQuery( "xs:hexBinary(\"0FB7\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:hexBinary as source type and xs:float as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1325() { final XQuery query = new XQuery( "not(xs:hexBinary(\"0FB7\") castable as xs:float)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:hexBinary to xs:double isn't allowed.. */ @org.junit.Test public void kSeqExprCast1326() { final XQuery query = new XQuery( "xs:hexBinary(\"0FB7\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:hexBinary as source type and xs:double as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1327() { final XQuery query = new XQuery( "not(xs:hexBinary(\"0FB7\") castable as xs:double)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:hexBinary to xs:decimal isn't allowed.. */ @org.junit.Test public void kSeqExprCast1328() { final XQuery query = new XQuery( "xs:hexBinary(\"0FB7\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:hexBinary as source type and xs:decimal as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1329() { final XQuery query = new XQuery( "not(xs:hexBinary(\"0FB7\") castable as xs:decimal)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:base64Binary(xs:hexBinary("3B"))) eq "Ow=="`.. */ @org.junit.Test public void kSeqExprCast133() { final XQuery query = new XQuery( "xs:string(xs:base64Binary(xs:hexBinary(\"3B\"))) eq \"Ow==\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:hexBinary to xs:integer isn't allowed.. */ @org.junit.Test public void kSeqExprCast1330() { final XQuery query = new XQuery( "xs:hexBinary(\"0FB7\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:hexBinary as source type and xs:integer as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1331() { final XQuery query = new XQuery( "not(xs:hexBinary(\"0FB7\") castable as xs:integer)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:hexBinary to xs:duration isn't allowed.. */ @org.junit.Test public void kSeqExprCast1332() { final XQuery query = new XQuery( "xs:hexBinary(\"0FB7\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:hexBinary as source type and xs:duration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1333() { final XQuery query = new XQuery( "not(xs:hexBinary(\"0FB7\") castable as xs:duration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:hexBinary to xs:yearMonthDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast1334() { final XQuery query = new XQuery( "xs:hexBinary(\"0FB7\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:hexBinary as source type and xs:yearMonthDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1335() { final XQuery query = new XQuery( "not(xs:hexBinary(\"0FB7\") castable as xs:yearMonthDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:hexBinary to xs:dayTimeDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast1336() { final XQuery query = new XQuery( "xs:hexBinary(\"0FB7\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:hexBinary as source type and xs:dayTimeDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1337() { final XQuery query = new XQuery( "not(xs:hexBinary(\"0FB7\") castable as xs:dayTimeDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:hexBinary to xs:dateTime isn't allowed.. */ @org.junit.Test public void kSeqExprCast1338() { final XQuery query = new XQuery( "xs:hexBinary(\"0FB7\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:hexBinary as source type and xs:dateTime as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1339() { final XQuery query = new XQuery( "not(xs:hexBinary(\"0FB7\") castable as xs:dateTime)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:base64Binary(xs:hexBinary("69A69A"))) eq "aaaa"`.. */ @org.junit.Test public void kSeqExprCast134() { final XQuery query = new XQuery( "xs:string(xs:base64Binary(xs:hexBinary(\"69A69A\"))) eq \"aaaa\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:hexBinary to xs:time isn't allowed.. */ @org.junit.Test public void kSeqExprCast1340() { final XQuery query = new XQuery( "xs:hexBinary(\"0FB7\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:hexBinary as source type and xs:time as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1341() { final XQuery query = new XQuery( "not(xs:hexBinary(\"0FB7\") castable as xs:time)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:hexBinary to xs:date isn't allowed.. */ @org.junit.Test public void kSeqExprCast1342() { final XQuery query = new XQuery( "xs:hexBinary(\"0FB7\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:hexBinary as source type and xs:date as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1343() { final XQuery query = new XQuery( "not(xs:hexBinary(\"0FB7\") castable as xs:date)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:hexBinary to xs:gYearMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast1344() { final XQuery query = new XQuery( "xs:hexBinary(\"0FB7\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:hexBinary as source type and xs:gYearMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1345() { final XQuery query = new XQuery( "not(xs:hexBinary(\"0FB7\") castable as xs:gYearMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:hexBinary to xs:gYear isn't allowed.. */ @org.junit.Test public void kSeqExprCast1346() { final XQuery query = new XQuery( "xs:hexBinary(\"0FB7\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:hexBinary as source type and xs:gYear as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1347() { final XQuery query = new XQuery( "not(xs:hexBinary(\"0FB7\") castable as xs:gYear)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:hexBinary to xs:gMonthDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast1348() { final XQuery query = new XQuery( "xs:hexBinary(\"0FB7\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:hexBinary as source type and xs:gMonthDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1349() { final XQuery query = new XQuery( "not(xs:hexBinary(\"0FB7\") castable as xs:gMonthDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:base64Binary(xs:hexBinary("F43D1234ce8f"))) eq "9D0SNM6P"`.. */ @org.junit.Test public void kSeqExprCast135() { final XQuery query = new XQuery( "xs:string(xs:base64Binary(xs:hexBinary(\"F43D1234ce8f\"))) eq \"9D0SNM6P\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:hexBinary to xs:gDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast1350() { final XQuery query = new XQuery( "xs:hexBinary(\"0FB7\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:hexBinary as source type and xs:gDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1351() { final XQuery query = new XQuery( "not(xs:hexBinary(\"0FB7\") castable as xs:gDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:hexBinary to xs:gMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast1352() { final XQuery query = new XQuery( "xs:hexBinary(\"0FB7\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:hexBinary as source type and xs:gMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1353() { final XQuery query = new XQuery( "not(xs:hexBinary(\"0FB7\") castable as xs:gMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:hexBinary to xs:boolean isn't allowed.. */ @org.junit.Test public void kSeqExprCast1354() { final XQuery query = new XQuery( "xs:hexBinary(\"0FB7\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:hexBinary as source type and xs:boolean as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1355() { final XQuery query = new XQuery( "not(xs:hexBinary(\"0FB7\") castable as xs:boolean)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:hexBinary to xs:base64Binary is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1356() { final XQuery query = new XQuery( "xs:hexBinary(\"0FB7\") cast as xs:base64Binary ne xs:base64Binary(\"aaaa\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:hexBinary as source type and xs:base64Binary as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1357() { final XQuery query = new XQuery( "xs:hexBinary(\"0FB7\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:hexBinary to xs:hexBinary is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1358() { final XQuery query = new XQuery( "xs:hexBinary(\"0FB7\") cast as xs:hexBinary eq xs:hexBinary(\"0FB7\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:hexBinary as source type and xs:hexBinary as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1359() { final XQuery query = new XQuery( "xs:hexBinary(\"0FB7\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:base64Binary(xs:hexBinary("f0"))) eq "8A=="`.. */ @org.junit.Test public void kSeqExprCast136() { final XQuery query = new XQuery( "xs:string(xs:base64Binary(xs:hexBinary(\"f0\"))) eq \"8A==\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:hexBinary to xs:anyURI isn't allowed.. */ @org.junit.Test public void kSeqExprCast1360() { final XQuery query = new XQuery( "xs:hexBinary(\"0FB7\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:hexBinary as source type and xs:anyURI as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1361() { final XQuery query = new XQuery( "not(xs:hexBinary(\"0FB7\") castable as xs:anyURI)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:hexBinary to xs:QName isn't allowed.. */ @org.junit.Test public void kSeqExprCast1362() { final XQuery query = new XQuery( "xs:hexBinary(\"0FB7\") cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:hexBinary as source type and xs:QName as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1363() { final XQuery query = new XQuery( "not(xs:hexBinary(\"0FB7\") castable as xs:QName)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:hexBinary as sourceType and xs:NOTATION should fail due to it involving xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1364() { final XQuery query = new XQuery( "not(xs:hexBinary(\"0FB7\") castable as xs:NOTATION)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * The xs:anyURI constructor function must be passed exactly one argument, not zero.. */ @org.junit.Test public void kSeqExprCast1365() { final XQuery query = new XQuery( "xs:anyURI()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * The xs:anyURI constructor function must be passed exactly one argument, not two.. */ @org.junit.Test public void kSeqExprCast1366() { final XQuery query = new XQuery( "xs:anyURI( \"http://www.example.com/an/arbitrary/URI.ext\" , \"http://www.example.com/an/arbitrary/URI.ext\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Verify with 'instance of' that the xs:anyURI constructor function produces values of the correct type. * The subsequence() function makes it more difficult for optimizers to take short cuts based on static type information.. */ @org.junit.Test public void kSeqExprCast1367() { final XQuery query = new XQuery( "subsequence((\"dummy\", 1.1, xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\")), 3, 1) instance of xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A simple test exercising the whitespace facet for type xs:anyURI.. */ @org.junit.Test public void kSeqExprCast1368() { final XQuery query = new XQuery( "xs:anyURI(\" http://www.example.com/an/arbitrary/URI.ext \") eq xs:anyURI(\" http://www.example.com/an/arbitrary/URI.ext \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An empty string is a valid lexical representation of xs:anyURI.. */ @org.junit.Test public void kSeqExprCast1369() { final XQuery query = new XQuery( "xs:anyURI(\"\") eq xs:anyURI(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:base64Binary(xs:hexBinary("ffaabbddcceeff0134f001d8ca9bc77899c83e6f7d"))) eq "/6q73czu/wE08AHYypvHeJnIPm99"`.. */ @org.junit.Test public void kSeqExprCast137() { final XQuery query = new XQuery( "xs:string(xs:base64Binary(xs:hexBinary(\"ffaabbddcceeff0134f001d8ca9bc77899c83e6f7d\"))) eq \"/6q73czu/wE08AHYypvHeJnIPm99\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Cast a simple xs:untypedAtomic value to "http://www.example.com/an/arbitrary/URI.ext" .. */ @org.junit.Test public void kSeqExprCast1370() { final XQuery query = new XQuery( "xs:anyURI(xs:untypedAtomic( \"http://www.example.com/an/arbitrary/URI.ext\" )) \n" + " eq xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Applying fn:boolean() to a value of type xs:anyURI that has the lexical value * ' "http://www.example.com/an/arbitrary/URI.ext" ' should result in the boolean value true.. */ @org.junit.Test public void kSeqExprCast1371() { final XQuery query = new XQuery( "boolean(xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:anyURI to xs:untypedAtomic is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1372() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") cast as xs:untypedAtomic\n" + " ne xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:anyURI as source type and xs:untypedAtomic as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1373() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:anyURI to xs:string is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1374() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") cast as xs:string ne xs:string(\"an arbitrary string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:anyURI as source type and xs:string as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1375() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:anyURI to xs:float isn't allowed.. */ @org.junit.Test public void kSeqExprCast1376() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:anyURI as source type and xs:float as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1377() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") castable as xs:float)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:anyURI to xs:double isn't allowed.. */ @org.junit.Test public void kSeqExprCast1378() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:anyURI as source type and xs:double as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1379() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") castable as xs:double)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:base64Binary(xs:hexBinary("ffff"))) eq "//8="`.. */ @org.junit.Test public void kSeqExprCast138() { final XQuery query = new XQuery( "xs:string(xs:base64Binary(xs:hexBinary(\"ffff\"))) eq \"//8=\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:anyURI to xs:decimal isn't allowed.. */ @org.junit.Test public void kSeqExprCast1380() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:anyURI as source type and xs:decimal as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1381() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") castable as xs:decimal)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:anyURI to xs:integer isn't allowed.. */ @org.junit.Test public void kSeqExprCast1382() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:anyURI as source type and xs:integer as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1383() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") castable as xs:integer)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:anyURI to xs:duration isn't allowed.. */ @org.junit.Test public void kSeqExprCast1384() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:anyURI as source type and xs:duration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1385() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") castable as xs:duration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:anyURI to xs:yearMonthDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast1386() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:anyURI as source type and xs:yearMonthDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1387() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") castable as xs:yearMonthDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:anyURI to xs:dayTimeDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast1388() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:anyURI as source type and xs:dayTimeDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1389() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") castable as xs:dayTimeDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:base64Binary(xs:hexBinary("ffff34564321deac9876"))) eq "//80VkMh3qyYdg=="`.. */ @org.junit.Test public void kSeqExprCast139() { final XQuery query = new XQuery( "xs:string(xs:base64Binary(xs:hexBinary(\"ffff34564321deac9876\"))) eq \"//80VkMh3qyYdg==\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:anyURI to xs:dateTime isn't allowed.. */ @org.junit.Test public void kSeqExprCast1390() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:anyURI as source type and xs:dateTime as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1391() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") castable as xs:dateTime)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:anyURI to xs:time isn't allowed.. */ @org.junit.Test public void kSeqExprCast1392() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:anyURI as source type and xs:time as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1393() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") castable as xs:time)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:anyURI to xs:date isn't allowed.. */ @org.junit.Test public void kSeqExprCast1394() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:anyURI as source type and xs:date as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1395() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") castable as xs:date)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:anyURI to xs:gYearMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast1396() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:anyURI as source type and xs:gYearMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1397() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") castable as xs:gYearMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:anyURI to xs:gYear isn't allowed.. */ @org.junit.Test public void kSeqExprCast1398() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:anyURI as source type and xs:gYear as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1399() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") castable as xs:gYear)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A non-atomic type is referenced, leading to a syntax error.. */ @org.junit.Test public void kSeqExprCast13a() { final XQuery query = new XQuery( "'string' cast as empty-sequence()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XQST0052") ) ); } /** * A test whose essence is: `'1' cast as xs:boolean eq true()`.. */ @org.junit.Test public void kSeqExprCast14() { final XQuery query = new XQuery( "'1' cast as xs:boolean eq true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:hexBinary(xs:base64Binary("Ow=="))) eq "3B"`.. */ @org.junit.Test public void kSeqExprCast140() { final XQuery query = new XQuery( "xs:string(xs:hexBinary(xs:base64Binary(\"Ow==\"))) eq \"3B\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:anyURI to xs:gMonthDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast1400() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:anyURI as source type and xs:gMonthDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1401() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") castable as xs:gMonthDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:anyURI to xs:gDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast1402() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:anyURI as source type and xs:gDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1403() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") castable as xs:gDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:anyURI to xs:gMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast1404() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:anyURI as source type and xs:gMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1405() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") castable as xs:gMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:anyURI to xs:boolean isn't allowed.. */ @org.junit.Test public void kSeqExprCast1406() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:anyURI as source type and xs:boolean as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1407() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") castable as xs:boolean)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:anyURI to xs:base64Binary isn't allowed.. */ @org.junit.Test public void kSeqExprCast1408() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:anyURI as source type and xs:base64Binary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1409() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") castable as xs:base64Binary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:hexBinary(xs:base64Binary("aaa a"))) eq "69A69A"`.. */ @org.junit.Test public void kSeqExprCast141() { final XQuery query = new XQuery( "xs:string(xs:hexBinary(xs:base64Binary(\"aaa a\"))) eq \"69A69A\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:anyURI to xs:hexBinary isn't allowed.. */ @org.junit.Test public void kSeqExprCast1410() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:anyURI as source type and xs:hexBinary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1411() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") castable as xs:hexBinary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:anyURI to xs:anyURI is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1412() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") cast as xs:anyURI eq xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:anyURI as source type and xs:anyURI as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1413() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:anyURI to xs:QName isn't allowed.. */ @org.junit.Test public void kSeqExprCast1414() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:anyURI as source type and xs:QName as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1415() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") castable as xs:QName)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:anyURI as sourceType and xs:NOTATION should fail due to it involving xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1416() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://www.example.com/an/arbitrary/URI.ext\") castable as xs:NOTATION)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * The xs:QName constructor function must be passed exactly one argument, not zero.. */ @org.junit.Test public void kSeqExprCast1417() { final XQuery query = new XQuery( "xs:QName()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * The xs:QName constructor function must be passed exactly one argument, not two.. */ @org.junit.Test public void kSeqExprCast1418() { final XQuery query = new XQuery( "xs:QName( \"ncname\" , \"ncname\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Verify with 'instance of' that the xs:QName constructor function produces values * of the correct type. The subsequence() function makes it more difficult for optimizers to take * short cuts based on static type information.. */ @org.junit.Test public void kSeqExprCast1419() { final XQuery query = new XQuery( "subsequence((\"dummy\", 1.1, xs:QName(\"ncname\")), 3, 1) instance of xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An empty string is a valid lexical representation for xs:base64Binary, and means 'no data.. */ @org.junit.Test public void kSeqExprCast142() { final XQuery query = new XQuery( "xs:string(xs:base64Binary(\"\")) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A simple test exercising the whitespace facet for type xs:QName.. */ @org.junit.Test public void kSeqExprCast1420() { final XQuery query = new XQuery( "xs:QName(\" ncname \") eq xs:QName(\" ncname \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An empty string is not a valid lexical representation of xs:QName.. */ @org.junit.Test public void kSeqExprCast1421() { final XQuery query = new XQuery( "xs:QName(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * It is not possible to extract an Effective Boolean Value from the type xs:QName, with the boolean() function.. */ @org.junit.Test public void kSeqExprCast1422() { final XQuery query = new XQuery( "boolean(xs:QName(\"ncname\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Casting from xs:QName to xs:untypedAtomic is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1423() { final XQuery query = new XQuery( "xs:QName(\"ncname\") cast as xs:untypedAtomic ne xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:QName as source type and xs:untypedAtomic as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1424() { final XQuery query = new XQuery( "xs:QName(\"ncname\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:QName to xs:string is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast1425() { final XQuery query = new XQuery( "xs:QName(\"ncname\") cast as xs:string ne xs:string(\"an arbitrary string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:QName as source type and xs:string as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1426() { final XQuery query = new XQuery( "xs:QName(\"ncname\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:QName to xs:float isn't allowed.. */ @org.junit.Test public void kSeqExprCast1427() { final XQuery query = new XQuery( "xs:QName(\"ncname\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:QName as source type and xs:float as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1428() { final XQuery query = new XQuery( "not(xs:QName(\"ncname\") castable as xs:float)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:QName to xs:double isn't allowed.. */ @org.junit.Test public void kSeqExprCast1429() { final XQuery query = new XQuery( "xs:QName(\"ncname\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Casting where the source type typically cannot be determined statically.. */ @org.junit.Test public void kSeqExprCast143() { final XQuery query = new XQuery( "xs:hexBinary(remove((\"3B\", 1.1), 2) treat as xs:string)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3B") ); } /** * 'castable as' involving xs:QName as source type and xs:double as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1430() { final XQuery query = new XQuery( "not(xs:QName(\"ncname\") castable as xs:double)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:QName to xs:decimal isn't allowed.. */ @org.junit.Test public void kSeqExprCast1431() { final XQuery query = new XQuery( "xs:QName(\"ncname\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:QName as source type and xs:decimal as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1432() { final XQuery query = new XQuery( "not(xs:QName(\"ncname\") castable as xs:decimal)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:QName to xs:integer isn't allowed.. */ @org.junit.Test public void kSeqExprCast1433() { final XQuery query = new XQuery( "xs:QName(\"ncname\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:QName as source type and xs:integer as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1434() { final XQuery query = new XQuery( "not(xs:QName(\"ncname\") castable as xs:integer)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:QName to xs:duration isn't allowed.. */ @org.junit.Test public void kSeqExprCast1435() { final XQuery query = new XQuery( "xs:QName(\"ncname\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:QName as source type and xs:duration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1436() { final XQuery query = new XQuery( "not(xs:QName(\"ncname\") castable as xs:duration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:QName to xs:yearMonthDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast1437() { final XQuery query = new XQuery( "xs:QName(\"ncname\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:QName as source type and xs:yearMonthDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1438() { final XQuery query = new XQuery( "not(xs:QName(\"ncname\") castable as xs:yearMonthDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:QName to xs:dayTimeDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast1439() { final XQuery query = new XQuery( "xs:QName(\"ncname\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A test whose essence is: `(xs:decimal(remove((3e3, 1.1), 1))) eq 1.1`.. */ @org.junit.Test public void kSeqExprCast144() { final XQuery query = new XQuery( "(xs:decimal(remove((3e3, 1.1), 1))) eq 1.1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * 'castable as' involving xs:QName as source type and xs:dayTimeDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1440() { final XQuery query = new XQuery( "not(xs:QName(\"ncname\") castable as xs:dayTimeDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:QName to xs:dateTime isn't allowed.. */ @org.junit.Test public void kSeqExprCast1441() { final XQuery query = new XQuery( "xs:QName(\"ncname\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:QName as source type and xs:dateTime as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1442() { final XQuery query = new XQuery( "not(xs:QName(\"ncname\") castable as xs:dateTime)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:QName to xs:time isn't allowed.. */ @org.junit.Test public void kSeqExprCast1443() { final XQuery query = new XQuery( "xs:QName(\"ncname\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:QName as source type and xs:time as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1444() { final XQuery query = new XQuery( "not(xs:QName(\"ncname\") castable as xs:time)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:QName to xs:date isn't allowed.. */ @org.junit.Test public void kSeqExprCast1445() { final XQuery query = new XQuery( "xs:QName(\"ncname\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:QName as source type and xs:date as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1446() { final XQuery query = new XQuery( "not(xs:QName(\"ncname\") castable as xs:date)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:QName to xs:gYearMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast1447() { final XQuery query = new XQuery( "xs:QName(\"ncname\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:QName as source type and xs:gYearMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1448() { final XQuery query = new XQuery( "not(xs:QName(\"ncname\") castable as xs:gYearMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:QName to xs:gYear isn't allowed.. */ @org.junit.Test public void kSeqExprCast1449() { final XQuery query = new XQuery( "xs:QName(\"ncname\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Casting where the cardinality of the source value is wrong.. */ @org.junit.Test public void kSeqExprCast145() { final XQuery query = new XQuery( "xs:decimal(remove((1, 2, 3), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:QName as source type and xs:gYear as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1450() { final XQuery query = new XQuery( "not(xs:QName(\"ncname\") castable as xs:gYear)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:QName to xs:gMonthDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast1451() { final XQuery query = new XQuery( "xs:QName(\"ncname\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:QName as source type and xs:gMonthDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1452() { final XQuery query = new XQuery( "not(xs:QName(\"ncname\") castable as xs:gMonthDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:QName to xs:gDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast1453() { final XQuery query = new XQuery( "xs:QName(\"ncname\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:QName as source type and xs:gDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1454() { final XQuery query = new XQuery( "not(xs:QName(\"ncname\") castable as xs:gDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:QName to xs:gMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast1455() { final XQuery query = new XQuery( "xs:QName(\"ncname\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:QName as source type and xs:gMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1456() { final XQuery query = new XQuery( "not(xs:QName(\"ncname\") castable as xs:gMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:QName to xs:boolean isn't allowed.. */ @org.junit.Test public void kSeqExprCast1457() { final XQuery query = new XQuery( "xs:QName(\"ncname\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:QName as source type and xs:boolean as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1458() { final XQuery query = new XQuery( "not(xs:QName(\"ncname\") castable as xs:boolean)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:QName to xs:base64Binary isn't allowed.. */ @org.junit.Test public void kSeqExprCast1459() { final XQuery query = new XQuery( "xs:QName(\"ncname\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:QName as source type and xs:base64Binary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1460() { final XQuery query = new XQuery( "not(xs:QName(\"ncname\") castable as xs:base64Binary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:QName to xs:hexBinary isn't allowed.. */ @org.junit.Test public void kSeqExprCast1461() { final XQuery query = new XQuery( "xs:QName(\"ncname\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:QName as source type and xs:hexBinary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1462() { final XQuery query = new XQuery( "not(xs:QName(\"ncname\") castable as xs:hexBinary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:QName to xs:anyURI isn't allowed.. */ @org.junit.Test public void kSeqExprCast1463() { final XQuery query = new XQuery( "xs:QName(\"ncname\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:QName as source type and xs:anyURI as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast1464() { final XQuery query = new XQuery( "not(xs:QName(\"ncname\") castable as xs:anyURI)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:QName as source type and xs:QName as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast1465() { final XQuery query = new XQuery( "xs:QName(\"ncname\") castable as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:QName as sourceType and xs:NOTATION should fail due to it involving xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1466() { final XQuery query = new XQuery( "not(xs:QName(\"ncname\") castable as xs:NOTATION)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * The xs:NOTATION constructor function must be passed exactly one argument, not zero.. */ @org.junit.Test public void kSeqExprCast1467() { final XQuery query = new XQuery( "xs:NOTATION()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * The xs:NOTATION constructor function must be passed exactly one argument, not two.. */ @org.junit.Test public void kSeqExprCast1468() { final XQuery query = new XQuery( "xs:NOTATION( \"prefix:local\" , \"prefix:local\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No constructor function exists for xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1469() { final XQuery query = new XQuery( "not(xs:NOTATION(\"prefix:local\") castable as xs:untypedAtomic)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A preceding plus sign('+') is disallowed for xs:duration.. */ @org.junit.Test public void kSeqExprCast147() { final XQuery query = new XQuery( "xs:duration(\"+P1Y2M123DT10H30M99S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * No constructor function exists for xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1470() { final XQuery query = new XQuery( "not(xs:NOTATION(\"prefix:local\") castable as xs:string)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No constructor function exists for xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1471() { final XQuery query = new XQuery( "not(xs:NOTATION(\"prefix:local\") castable as xs:float)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No constructor function exists for xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1472() { final XQuery query = new XQuery( "not(xs:NOTATION(\"prefix:local\") castable as xs:double)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No constructor function exists for xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1473() { final XQuery query = new XQuery( "not(xs:NOTATION(\"prefix:local\") castable as xs:decimal)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No constructor function exists for xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1474() { final XQuery query = new XQuery( "not(xs:NOTATION(\"prefix:local\") castable as xs:integer)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No constructor function exists for xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1475() { final XQuery query = new XQuery( "not(xs:NOTATION(\"prefix:local\") castable as xs:duration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No constructor function exists for xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1476() { final XQuery query = new XQuery( "not(xs:NOTATION(\"prefix:local\") castable as xs:yearMonthDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No constructor function exists for xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1477() { final XQuery query = new XQuery( "not(xs:NOTATION(\"prefix:local\") castable as xs:dayTimeDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No constructor function exists for xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1478() { final XQuery query = new XQuery( "not(xs:NOTATION(\"prefix:local\") castable as xs:dateTime)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No constructor function exists for xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1479() { final XQuery query = new XQuery( "not(xs:NOTATION(\"prefix:local\") castable as xs:time)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No zone offset is allowed for xs:duration.. */ @org.junit.Test public void kSeqExprCast148() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M123DT10H30M99S+08:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * No constructor function exists for xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1480() { final XQuery query = new XQuery( "not(xs:NOTATION(\"prefix:local\") castable as xs:date)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No constructor function exists for xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1481() { final XQuery query = new XQuery( "not(xs:NOTATION(\"prefix:local\") castable as xs:gYearMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No constructor function exists for xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1482() { final XQuery query = new XQuery( "not(xs:NOTATION(\"prefix:local\") castable as xs:gYear)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No constructor function exists for xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1483() { final XQuery query = new XQuery( "not(xs:NOTATION(\"prefix:local\") castable as xs:gMonthDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No constructor function exists for xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1484() { final XQuery query = new XQuery( "not(xs:NOTATION(\"prefix:local\") castable as xs:gDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No constructor function exists for xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1485() { final XQuery query = new XQuery( "not(xs:NOTATION(\"prefix:local\") castable as xs:gMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No constructor function exists for xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1486() { final XQuery query = new XQuery( "not(xs:NOTATION(\"prefix:local\") castable as xs:boolean)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No constructor function exists for xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1487() { final XQuery query = new XQuery( "not(xs:NOTATION(\"prefix:local\") castable as xs:base64Binary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No constructor function exists for xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1488() { final XQuery query = new XQuery( "not(xs:NOTATION(\"prefix:local\") castable as xs:hexBinary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No constructor function exists for xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1489() { final XQuery query = new XQuery( "not(xs:NOTATION(\"prefix:local\") castable as xs:anyURI)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A preceding 'P' must always exist in a xs:duration value.. */ @org.junit.Test public void kSeqExprCast149() { final XQuery query = new XQuery( "xs:duration(\"1Y2M123DT10H30M99S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * No constructor function exists for xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1490() { final XQuery query = new XQuery( "not(xs:NOTATION(\"prefix:local\") castable as xs:QName)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No constructor function exists for xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast1491() { final XQuery query = new XQuery( "not(xs:NOTATION(\"prefix:local\") castable as xs:NOTATION)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0017") || error("XPST0080") ) ); } /** * A test whose essence is: `'true' cast as xs:boolean eq true()`.. */ @org.junit.Test public void kSeqExprCast15() { final XQuery query = new XQuery( "'true' cast as xs:boolean eq true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * At least one number and its designator must be present in a xs:duration value.. */ @org.junit.Test public void kSeqExprCast150() { final XQuery query = new XQuery( "xs:duration(\"P\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * At least one number and its designator must be present in a xs:duration value, a minus sign is insufficient.. */ @org.junit.Test public void kSeqExprCast151() { final XQuery query = new XQuery( "xs:duration(\"-P\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A 'T' separator in a xs:duration must be followed by time components.. */ @org.junit.Test public void kSeqExprCast152() { final XQuery query = new XQuery( "xs:duration(\"P1Y24MT\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * 'P24H' is an invalid lexical representation for xs:duration.. */ @org.junit.Test public void kSeqExprCast153() { final XQuery query = new XQuery( "xs:duration(\"P24H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Ensure that when casting xs:duration to xs:string, preceding zeros are handled properly.. */ @org.junit.Test public void kSeqExprCast154() { final XQuery query = new XQuery( "xs:string(xs:duration(\"P0010Y0010M0010DT0010H0010M0010S\")) eq \"P10Y10M10DT10H10M10S\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that a negative xs:duration is properly serialized when cast to xs:string.. */ @org.junit.Test public void kSeqExprCast155() { final XQuery query = new XQuery( "xs:string(xs:duration(\"-P0010DT0010H0010M0010S\")) eq \"-P10DT10H10M10S\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that when casting xs:duration to xs:string, that empty fields are properly serialized.. */ @org.junit.Test public void kSeqExprCast156() { final XQuery query = new XQuery( "xs:string(xs:duration(\"P0Y0M0DT00H00M00.000S\")) eq \"PT0S\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that when casting xs:duration to xs:string, that empty components are handled properly.. */ @org.junit.Test public void kSeqExprCast157() { final XQuery query = new XQuery( "xs:string(xs:duration(\"-PT8H23M0S\")) eq \"-PT8H23M\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting a xs:duration with zeroed time components to xs:string.. */ @org.junit.Test public void kSeqExprCast158() { final XQuery query = new XQuery( "xs:string(xs:duration(\"-P2000Y11M5DT0H0M0.000S\")) eq \"-P2000Y11M5D\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The canonical lexical representation for the xs:duration value P365D is 'P365D'.. */ @org.junit.Test public void kSeqExprCast159() { final XQuery query = new XQuery( "xs:string(xs:duration(\"P365D\")) eq \"P365D\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `'false' cast as xs:boolean eq false()`.. */ @org.junit.Test public void kSeqExprCast16() { final XQuery query = new XQuery( "'false' cast as xs:boolean eq false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The canonical lexical representation for the xs:duration value P12M is 'P1Y'.. */ @org.junit.Test public void kSeqExprCast160() { final XQuery query = new XQuery( "xs:string(xs:duration(\"P12M\")) eq \"P1Y\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The canonical lexical representation for the xs:duration value P31D is 'P31D'.. */ @org.junit.Test public void kSeqExprCast161() { final XQuery query = new XQuery( "xs:string(xs:duration(\"P31D\")) eq \"P31D\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The canonical lexical representation for the xs:duration value P3Y0M is 'P3Y'.. */ @org.junit.Test public void kSeqExprCast162() { final XQuery query = new XQuery( "xs:string(xs:yearMonthDuration(\"P3Y0M\")) eq \"P3Y\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that a xs:duration value with a small second component is serialized properly.. */ @org.junit.Test public void kSeqExprCast163() { final XQuery query = new XQuery( "xs:string(xs:duration(\"P31DT3H2M10.001S\")) eq \"P31DT3H2M10.001S\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The canonical form of the xs:duration value -PT0S is PT0S.. */ @org.junit.Test public void kSeqExprCast164() { final XQuery query = new XQuery( "xs:string(xs:duration(\"-PT0S\")) eq \"PT0S\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting xs:dayTimeDuration to xs:duration.. */ @org.junit.Test public void kSeqExprCast165() { final XQuery query = new XQuery( "xs:string(xs:duration(xs:dayTimeDuration(\"P31DT3H2M10.001S\"))) eq \"P31DT3H2M10.001S\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting xs:yearMonthDuration to xs:duration.. */ @org.junit.Test public void kSeqExprCast166() { final XQuery query = new XQuery( "xs:string(xs:duration(xs:yearMonthDuration(\"P543Y456M\"))) eq \"P581Y\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a negative xs:dayTimeDuration to xs:duration.. */ @org.junit.Test public void kSeqExprCast167() { final XQuery query = new XQuery( "xs:string(xs:duration(xs:dayTimeDuration(\"-P31DT3H2M10.001S\"))) eq \"-P31DT3H2M10.001S\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a negative xs:yearMonthDuration to xs:duration.. */ @org.junit.Test public void kSeqExprCast168() { final XQuery query = new XQuery( "xs:string(xs:duration(xs:yearMonthDuration(\"-P543Y456M\"))) eq \"-P581Y\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A preceding plus sign('+') is disallowed for xs:dayTimeDuration.. */ @org.junit.Test public void kSeqExprCast169() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"+P3DT10H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `'0' cast as xs:boolean eq false()`.. */ @org.junit.Test public void kSeqExprCast17() { final XQuery query = new XQuery( "'0' cast as xs:boolean eq false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * No zone offset is allowed for xs:dayTimeDuration.. */ @org.junit.Test public void kSeqExprCast170() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H+08:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A preceding 'P' must always exist in a xs:dayTimeDuration value.. */ @org.junit.Test public void kSeqExprCast171() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"3DT10H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * At least one number and its designator must be present in a xs:dayTimeDuration value.. */ @org.junit.Test public void kSeqExprCast172() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * At least one number and its designator must be present in a xs:dayTimeDuration value, a minus sign is insufficient.. */ @org.junit.Test public void kSeqExprCast173() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"-P\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A 'T' separator in a xs:dayTimeDuration must be followed by time components.. */ @org.junit.Test public void kSeqExprCast174() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P1DT\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Ensure that when casting xs:dayTimeDuration to xs:string, that empty fields are properly serialized.. */ @org.junit.Test public void kSeqExprCast175() { final XQuery query = new XQuery( "xs:string(xs:dayTimeDuration(\"P0DT00H00M00.000S\")) eq \"PT0S\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'P1Y12M1D' is an invalid lexical representation for xs:dayTimeDuration.. */ @org.junit.Test public void kSeqExprCast176() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P1Y12M1D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * 'P24M1D' is an invalid lexical representation for xs:dayTimeDuration.. */ @org.junit.Test public void kSeqExprCast177() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P24M1D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * 'PDT3H2M10.001S' is an invalid lexical representation for xs:dayTimeDuration.. */ @org.junit.Test public void kSeqExprCast178() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"PDT3H2M10.001S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Ensure that when casting xs:dayTimeDuration to xs:string, that preceding zeros are handled properly.. */ @org.junit.Test public void kSeqExprCast179() { final XQuery query = new XQuery( "xs:string(xs:dayTimeDuration(\"P0010DT0010H0010M0010S\")) eq \"P10DT10H10M10S\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `false() cast as xs:boolean eq false()`.. */ @org.junit.Test public void kSeqExprCast18() { final XQuery query = new XQuery( "false() cast as xs:boolean eq false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that a negative xs:dayTimeDuration is properly serialized when cast to xs:string.. */ @org.junit.Test public void kSeqExprCast180() { final XQuery query = new XQuery( "xs:string(xs:dayTimeDuration(\"-P0010DT0010H0010M0010S\")) eq \"-P10DT10H10M10S\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that when casting xs:dayTimeDuration to xs:string, that empty components are handled properly.. */ @org.junit.Test public void kSeqExprCast181() { final XQuery query = new XQuery( "xs:string(xs:dayTimeDuration(\"-PT8H23M0S\")) eq \"-PT8H23M\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting a xs:duration with zeroed time components to xs:string.. */ @org.junit.Test public void kSeqExprCast182() { final XQuery query = new XQuery( "xs:string(xs:dayTimeDuration(\"-P5DT0H0M0.000S\")) eq \"-P5D\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that a xs:dayTimeDuration value with a large day component is serialized properly.. */ @org.junit.Test public void kSeqExprCast183() { final XQuery query = new XQuery( "xs:string(xs:dayTimeDuration(\"P9876DT1M\")) eq \"P9876DT1M\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that a xs:dayTimeDuration value with a large hour component is serialized properly.. */ @org.junit.Test public void kSeqExprCast184() { final XQuery query = new XQuery( "xs:string(xs:dayTimeDuration(\"PT9876H1M\")) eq \"P411DT12H1M\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that a xs:dayTimeDuration value with a large minute component is serialized properly.. */ @org.junit.Test public void kSeqExprCast185() { final XQuery query = new XQuery( "xs:string(xs:dayTimeDuration(\"PT6000M\")) eq \"P4DT4H\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that a xs:dayTimeDuration value with a large second component is serialized properly.. */ @org.junit.Test public void kSeqExprCast186() { final XQuery query = new XQuery( "xs:string(xs:dayTimeDuration(\"PT1M1231.432S\")) eq \"PT21M31.432S\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that a xs:dayTimeDuration value with a small second component is serialized properly.. */ @org.junit.Test public void kSeqExprCast187() { final XQuery query = new XQuery( "xs:string(xs:dayTimeDuration(\"P31DT3H2M10.001S\")) eq \"P31DT3H2M10.001S\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The canonical form of the xs:dayTimeDuration value -PT0S is PT0S.. */ @org.junit.Test public void kSeqExprCast188() { final XQuery query = new XQuery( "xs:string(xs:dayTimeDuration(\"-PT0S\")) eq \"PT0S\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting xs:duration to xs:dayTimeDuration.. */ @org.junit.Test public void kSeqExprCast189() { final XQuery query = new XQuery( "xs:string(xs:dayTimeDuration(xs:duration(\"P3Y0M31DT3H2M10.001S\"))) eq \"P31DT3H2M10.001S\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(true() cast as xs:boolean eq false())`.. */ @org.junit.Test public void kSeqExprCast19() { final XQuery query = new XQuery( "not(true() cast as xs:boolean eq false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting xs:yearMonthDuration to xs:dayTimeDuration.. */ @org.junit.Test public void kSeqExprCast190() { final XQuery query = new XQuery( "xs:string(xs:dayTimeDuration(xs:yearMonthDuration(\"P543Y456M\"))) eq \"PT0S\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a negative xs:duration to xs:dayTimeDuration.. */ @org.junit.Test public void kSeqExprCast191() { final XQuery query = new XQuery( "xs:string(xs:dayTimeDuration(xs:duration(\"-P3Y0M31DT3H2M10.001S\"))) eq \"-P31DT3H2M10.001S\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a negative xs:yearMonthDuration to xs:dayTimeDuration.. */ @org.junit.Test public void kSeqExprCast192() { final XQuery query = new XQuery( "xs:string(xs:dayTimeDuration(xs:yearMonthDuration(\"-P543Y456M\"))) eq \"PT0S\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The canonical lexical representation for the xs:dayTimeDuration value P3D is 'P3D'.. */ @org.junit.Test public void kSeqExprCast193() { final XQuery query = new XQuery( "xs:string(xs:dayTimeDuration(\"P3D\")) eq \"P3D\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A preceding plus sign('+') is disallowed for xs:yearMonthDuration.. */ @org.junit.Test public void kSeqExprCast194() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"+P20Y15M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * No zone offset is allowed for xs:yearMonthDuration.. */ @org.junit.Test public void kSeqExprCast195() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P20Y15M+08:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A preceding 'P' must always exist in a xs:yearMonthDuration value.. */ @org.junit.Test public void kSeqExprCast196() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"20Y15M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * At least one number and its designator must be present in a xs:yearMonthDuration value.. */ @org.junit.Test public void kSeqExprCast197() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * At least one number and its designator must be present in a xs:yearMonthDuration value, a minus sign is insufficient.. */ @org.junit.Test public void kSeqExprCast198() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"-P\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A 'T' separator in a xs:yearMonthDuration is not allowed.. */ @org.junit.Test public void kSeqExprCast199() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y24MT\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Syntax: only ? is allowed as occurence indicator in 'cast as' expressions.. */ @org.junit.Test public void kSeqExprCast2() { final XQuery query = new XQuery( "'string' cast as xs:string+", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A test whose essence is: `xs:boolean(xs:double(3)) eq true()`.. */ @org.junit.Test public void kSeqExprCast20() { final XQuery query = new XQuery( "xs:boolean(xs:double(3)) eq true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'P731D' is an invalid lexical representation for xs:yearMonthDuration.. */ @org.junit.Test public void kSeqExprCast200() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P731D\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '-P3' is an invalid lexical representation for xs:yearMonthDuration.. */ @org.junit.Test public void kSeqExprCast201() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"-P3\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Ensure that when casting xs:yearMonthDuration to xs:string, that preceding zeros are handled properly.. */ @org.junit.Test public void kSeqExprCast202() { final XQuery query = new XQuery( "xs:string(xs:yearMonthDuration(\"P0010Y0010M\")) eq \"P10Y10M\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that a negative xs:yearMonthDuration is properly serialized when cast to xs:string.. */ @org.junit.Test public void kSeqExprCast203() { final XQuery query = new XQuery( "xs:string(xs:yearMonthDuration(\"-P0010Y0010M\")) eq \"-P10Y10M\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that when casting xs:yearMonthDuration to xs:string, that empty fields are properly serialized.. */ @org.junit.Test public void kSeqExprCast204() { final XQuery query = new XQuery( "xs:string(xs:yearMonthDuration(\"P0Y0M\")) eq \"P0M\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that a xs:yearMonthDuration value with a large year component is serialized properly.. */ @org.junit.Test public void kSeqExprCast205() { final XQuery query = new XQuery( "xs:string(xs:yearMonthDuration(\"P2Y323M\")) eq \"P28Y11M\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that a xs:yearMonthDuration value with a large year and month component is serialized properly.. */ @org.junit.Test public void kSeqExprCast206() { final XQuery query = new XQuery( "xs:string(xs:yearMonthDuration(\"-P543Y456M\")) eq \"-P581Y\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The canonical form of the xs:yearMonthDuration value -P0M is P0M.. */ @org.junit.Test public void kSeqExprCast207() { final XQuery query = new XQuery( "xs:string(xs:yearMonthDuration(\"-P0M\")) eq \"P0M\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting xs:duration to xs:yearMonthDuration.. */ @org.junit.Test public void kSeqExprCast208() { final XQuery query = new XQuery( "xs:string(xs:yearMonthDuration(xs:duration(\"P3Y0M31DT3H2M10.001S\"))) eq \"P3Y\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting xs:dayTimeDuration to xs:yearMonthDuration.. */ @org.junit.Test public void kSeqExprCast209() { final XQuery query = new XQuery( "xs:string(xs:yearMonthDuration(xs:dayTimeDuration(\"P31DT3H2M10.001S\"))) eq \"P0M\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:boolean(xs:string(1)) eq true()`.. */ @org.junit.Test public void kSeqExprCast21() { final XQuery query = new XQuery( "xs:boolean(xs:string(1)) eq true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a negative xs:duration to xs:yearMonthDuration.. */ @org.junit.Test public void kSeqExprCast210() { final XQuery query = new XQuery( "xs:string(xs:yearMonthDuration(xs:duration(\"-P3Y0M31DT3H2M10.001S\"))) eq \"-P3Y\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a negative xs:dayTimeDuration to xs:yearMonthDuration.. */ @org.junit.Test public void kSeqExprCast211() { final XQuery query = new XQuery( "xs:string(xs:yearMonthDuration(xs:dayTimeDuration(\"-P31DT3H2M10.001S\"))) eq \"P0M\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:gYear("1")`.. */ @org.junit.Test public void kSeqExprCast213() { final XQuery query = new XQuery( "xs:gYear(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `xs:gYear("12")`.. */ @org.junit.Test public void kSeqExprCast214() { final XQuery query = new XQuery( "xs:gYear(\"12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `xs:gYear("867")`.. */ @org.junit.Test public void kSeqExprCast215() { final XQuery query = new XQuery( "xs:gYear(\"867\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `xs:gYear("+1999")`.. */ @org.junit.Test public void kSeqExprCast216() { final XQuery query = new XQuery( "xs:gYear(\"+1999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `xs:gYear("+1999")`.. */ @org.junit.Test public void kSeqExprCast217() { final XQuery query = new XQuery( "xs:gYear(\"+1999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `xs:gYear("+0000")`.. */ @org.junit.Test public void kSeqExprCast218() { final XQuery query = new XQuery( "xs:gYear(\"+0000\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `xs:gYear("1111-")`.. */ @org.junit.Test public void kSeqExprCast219() { final XQuery query = new XQuery( "xs:gYear(\"1111-\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `xs:boolean(xs:integer(3)) eq true()`.. */ @org.junit.Test public void kSeqExprCast22() { final XQuery query = new XQuery( "xs:boolean(xs:integer(3)) eq true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:gYear("1111a")`.. */ @org.junit.Test public void kSeqExprCast220() { final XQuery query = new XQuery( "xs:gYear(\"1111a\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `xs:gYear("a1111")`.. */ @org.junit.Test public void kSeqExprCast221() { final XQuery query = new XQuery( "xs:gYear(\"a1111\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `xs:gYear("1 111")`.. */ @org.junit.Test public void kSeqExprCast222() { final XQuery query = new XQuery( "xs:gYear(\"1 111\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `xs:gYear("1111 Z")`.. */ @org.junit.Test public void kSeqExprCast223() { final XQuery query = new XQuery( "xs:gYear(\"1111 Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `xs:gYear("1111 Z")`.. */ @org.junit.Test public void kSeqExprCast224() { final XQuery query = new XQuery( "xs:gYear(\"1111 Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:gYear: the hour component cannot be -15.. */ @org.junit.Test public void kSeqExprCast225() { final XQuery query = new XQuery( "xs:gYear(\"1956-15:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:gYear: the hour component cannot be +15.. */ @org.junit.Test public void kSeqExprCast226() { final XQuery query = new XQuery( "xs:gYear(\"1956+15:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:gYear: the minute component cannot be +60.. */ @org.junit.Test public void kSeqExprCast227() { final XQuery query = new XQuery( "xs:gYear(\"1956+10:60\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:gYear: the minute component cannot be -60.. */ @org.junit.Test public void kSeqExprCast228() { final XQuery query = new XQuery( "xs:gYear(\"1956-10:60\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '02004' is an invalid lexical representation for xs:gYear.. */ @org.junit.Test public void kSeqExprCast229() { final XQuery query = new XQuery( "xs:gYear(\"02004\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `xs:boolean(xs:decimal(3)) eq true()`.. */ @org.junit.Test public void kSeqExprCast23() { final XQuery query = new XQuery( "xs:boolean(xs:decimal(3)) eq true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Testing timezone field in xs:gYear: the minute field must always be present.. */ @org.junit.Test public void kSeqExprCast230() { final XQuery query = new XQuery( "xs:gYear(\"1956-10\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Ensure casting xs:gYear to xs:string, with timezone '-00:00' is properly handled.. */ @org.junit.Test public void kSeqExprCast231() { final XQuery query = new XQuery( "xs:string(xs:gYear(\"1999-00:00\")) eq \"1999Z\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure casting xs:gYear to xs:string, with timezone '+00:00' is properly handled.. */ @org.junit.Test public void kSeqExprCast232() { final XQuery query = new XQuery( "xs:string(xs:gYear(\"1999+00:00\")) eq \"1999Z\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure casting xs:gYear to xs:string, with timezone 'Z' is properly handled.. */ @org.junit.Test public void kSeqExprCast233() { final XQuery query = new XQuery( "xs:string(xs:gYear(\"1999Z\")) eq \"1999Z\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * '10' is an invalid lexical representation for xs:gDay.. */ @org.junit.Test public void kSeqExprCast234() { final XQuery query = new XQuery( "xs:gDay(\"10\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '-01' is an invalid lexical representation for xs:gDay.. */ @org.junit.Test public void kSeqExprCast235() { final XQuery query = new XQuery( "xs:gDay(\"-01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '---321' is an invalid lexical representation for xs:gDay.. */ @org.junit.Test public void kSeqExprCast236() { final XQuery query = new XQuery( "xs:gDay(\"---321\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '--01' is an invalid lexical representation for xs:gDay.. */ @org.junit.Test public void kSeqExprCast237() { final XQuery query = new XQuery( "xs:gDay(\"--01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * 'E---01' is an invalid lexical representation for xs:gDay.. */ @org.junit.Test public void kSeqExprCast238() { final XQuery query = new XQuery( "xs:gDay(\"E---01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '---01E' is an invalid lexical representation for xs:gDay.. */ @org.junit.Test public void kSeqExprCast239() { final XQuery query = new XQuery( "xs:gDay(\"---01E\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `xs:boolean(xs:double(0)) eq false()`.. */ @org.junit.Test public void kSeqExprCast24() { final XQuery query = new XQuery( "xs:boolean(xs:double(0)) eq false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * '---01-' is an invalid lexical representation for xs:gDay.. */ @org.junit.Test public void kSeqExprCast240() { final XQuery query = new XQuery( "xs:gDay(\"---01-\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '---001' is an invalid lexical representation for xs:gDay.. */ @org.junit.Test public void kSeqExprCast241() { final XQuery query = new XQuery( "xs:gDay(\"---001\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '---32' is an invalid lexical representation for xs:gDay.. */ @org.junit.Test public void kSeqExprCast242() { final XQuery query = new XQuery( "xs:gDay(\"---32\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '---00' is an invalid lexical representation for xs:gDay.. */ @org.junit.Test public void kSeqExprCast243() { final XQuery query = new XQuery( "xs:gDay(\"---00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '---8' is an invalid lexical representation for xs:gDay.. */ @org.junit.Test public void kSeqExprCast244() { final XQuery query = new XQuery( "xs:gDay(\"+--08\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '+--08' is an invalid lexical representation for xs:gDay.. */ @org.junit.Test public void kSeqExprCast245() { final XQuery query = new XQuery( "xs:gDay(\"+--08\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '+---08' is an invalid lexical representation for xs:gDay.. */ @org.junit.Test public void kSeqExprCast246() { final XQuery query = new XQuery( "xs:gDay(\"+---08\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '---08 Z' is an invalid lexical representation for xs:gDay.. */ @org.junit.Test public void kSeqExprCast247() { final XQuery query = new XQuery( "xs:gDay(\"---08 Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:gDay: the hour component cannot be -15.. */ @org.junit.Test public void kSeqExprCast248() { final XQuery query = new XQuery( "xs:gDay(\"---08-15:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:gDay: the hour component cannot be +15.. */ @org.junit.Test public void kSeqExprCast249() { final XQuery query = new XQuery( "xs:gDay(\"---08+15:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `xs:boolean(xs:string(0)) eq false()`.. */ @org.junit.Test public void kSeqExprCast25() { final XQuery query = new XQuery( "xs:boolean(xs:string(0)) eq false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Testing timezone field in xs:gDay: the minute component cannot be +60.. */ @org.junit.Test public void kSeqExprCast250() { final XQuery query = new XQuery( "xs:gDay(\"---08+10:60\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:gDay: the minute component cannot be -60.. */ @org.junit.Test public void kSeqExprCast251() { final XQuery query = new XQuery( "xs:gDay(\"---08-10:60\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:gDay: the minute field must always be present.. */ @org.junit.Test public void kSeqExprCast252() { final XQuery query = new XQuery( "xs:gDay(\"---08-10\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Ensure casting xs:gDay to xs:string, with timezone '-00:00' is properly handled.. */ @org.junit.Test public void kSeqExprCast253() { final XQuery query = new XQuery( "xs:string(xs:gDay(\"---01-00:00\")) eq \"---01Z\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure casting xs:gDay to xs:string, with timezone '+00:00' is properly handled.. */ @org.junit.Test public void kSeqExprCast254() { final XQuery query = new XQuery( "xs:string(xs:gDay(\"---01+00:00\")) eq \"---01Z\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure casting xs:gDay to xs:string, with timezone 'Z' is properly handled.. */ @org.junit.Test public void kSeqExprCast255() { final XQuery query = new XQuery( "xs:string(xs:gDay(\"---01Z\")) eq \"---01Z\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * '-01' is an invalid lexical representation for xs:gMonth.. */ @org.junit.Test public void kSeqExprCast256() { final XQuery query = new XQuery( "xs:gMonth(\"-01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '---01' is an invalid lexical representation for xs:gMonth.. */ @org.junit.Test public void kSeqExprCast257() { final XQuery query = new XQuery( "xs:gMonth(\"---01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '+--01' is an invalid lexical representation for xs:gMonth.. */ @org.junit.Test public void kSeqExprCast258() { final XQuery query = new XQuery( "xs:gMonth(\"+--01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '--13' is an invalid lexical representation for xs:gMonth.. */ @org.junit.Test public void kSeqExprCast259() { final XQuery query = new XQuery( "xs:gMonth(\"--13\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `xs:boolean(xs:integer(0)) eq false()`.. */ @org.junit.Test public void kSeqExprCast26() { final XQuery query = new XQuery( "xs:boolean(xs:integer(0)) eq false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * '--431' is an invalid lexical representation for xs:gMonth.. */ @org.junit.Test public void kSeqExprCast260() { final XQuery query = new XQuery( "xs:gMonth(\"--431\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '--11-' is an invalid lexical representation for xs:gMonth.. */ @org.junit.Test public void kSeqExprCast261() { final XQuery query = new XQuery( "xs:gMonth(\"--11-\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '--00' is an invalid lexical representation for xs:gMonth.. */ @org.junit.Test public void kSeqExprCast262() { final XQuery query = new XQuery( "xs:gMonth(\"--00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:gMonth: the hour component cannot be -15.. */ @org.junit.Test public void kSeqExprCast263() { final XQuery query = new XQuery( "xs:gMonth(\"--08-15:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:gMonth: the hour component cannot be +15.. */ @org.junit.Test public void kSeqExprCast264() { final XQuery query = new XQuery( "xs:gMonth(\"--08+15:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:gMonth: the minute component cannot be +60.. */ @org.junit.Test public void kSeqExprCast265() { final XQuery query = new XQuery( "xs:gMonth(\"--08+10:60\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:gMonth: the minute component cannot be -60.. */ @org.junit.Test public void kSeqExprCast266() { final XQuery query = new XQuery( "xs:gMonth(\"--08-10:60\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:gMonth: the minute field must always be present.. */ @org.junit.Test public void kSeqExprCast267() { final XQuery query = new XQuery( "xs:gMonth(\"--08-10\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Ensure casting xs:gMonth to xs:string, with timezone '-00:00' is properly handled.. */ @org.junit.Test public void kSeqExprCast268() { final XQuery query = new XQuery( "xs:string(xs:gMonth(\"--01-00:00\")) eq \"--01Z\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure casting xs:gMonth to xs:string, with timezone '+00:00' is properly handled.. */ @org.junit.Test public void kSeqExprCast269() { final XQuery query = new XQuery( "xs:string(xs:gMonth(\"--01+00:00\")) eq \"--01Z\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:boolean(xs:decimal(0)) eq false()`.. */ @org.junit.Test public void kSeqExprCast27() { final XQuery query = new XQuery( "xs:boolean(xs:decimal(0)) eq false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure casting xs:gMonth to xs:string, with timezone 'Z' is properly handled.. */ @org.junit.Test public void kSeqExprCast270() { final XQuery query = new XQuery( "xs:string(xs:gMonth(\"--01Z\")) eq \"--01Z\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * '--1999-12' is an invalid lexical representation for xs:gYearMonth.. */ @org.junit.Test public void kSeqExprCast271() { final XQuery query = new XQuery( "xs:gYearMonth(\"--1999-12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '+1999-12' is an invalid lexical representation for xs:gYearMonth.. */ @org.junit.Test public void kSeqExprCast272() { final XQuery query = new XQuery( "xs:gYearMonth(\"+1999-12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '1999-12-' is an invalid lexical representation for xs:gYearMonth.. */ @org.junit.Test public void kSeqExprCast273() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-12-\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '1999--12' is an invalid lexical representation for xs:gYearMonth.. */ @org.junit.Test public void kSeqExprCast274() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999--12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '1999-13' is an invalid lexical representation for xs:gYearMonth.. */ @org.junit.Test public void kSeqExprCast275() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-13\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '1999-00' is an invalid lexical representation for xs:gYearMonth.. */ @org.junit.Test public void kSeqExprCast276() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '02004-08' is an invalid lexical representation for xs:gYearMonth.. */ @org.junit.Test public void kSeqExprCast277() { final XQuery query = new XQuery( "xs:gYearMonth(\"02004-08\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:gYearMonth: the minute field must always be present.. */ @org.junit.Test public void kSeqExprCast278() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-08-10\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:gYearMonth: the hour component cannot be -15.. */ @org.junit.Test public void kSeqExprCast279() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-01-15:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `xs:boolean(xs:decimal(0.0)) eq false()`.. */ @org.junit.Test public void kSeqExprCast28() { final XQuery query = new XQuery( "xs:boolean(xs:decimal(0.0)) eq false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Testing timezone field in xs:gYearMonth: the hour component cannot be +15.. */ @org.junit.Test public void kSeqExprCast280() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-01+15:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:gYearMonth: the minute component cannot be +60.. */ @org.junit.Test public void kSeqExprCast281() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-01+10:60\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:gYearMonth: the minute component cannot be -60.. */ @org.junit.Test public void kSeqExprCast282() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-01-10:60\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Ensure casting xs:gYearMonth to xs:string, with timezone '-00:00' is properly handled.. */ @org.junit.Test public void kSeqExprCast283() { final XQuery query = new XQuery( "xs:string(xs:gYearMonth(\"1999-01-00:00\")) eq \"1999-01Z\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure casting xs:gYearMonth to xs:string, with timezone '+00:00' is properly handled.. */ @org.junit.Test public void kSeqExprCast284() { final XQuery query = new XQuery( "xs:string(xs:gYearMonth(\"1999-01+00:00\")) eq \"1999-01Z\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure casting xs:gYearMonth to xs:string, with timezone 'Z' is properly handled.. */ @org.junit.Test public void kSeqExprCast285() { final XQuery query = new XQuery( "xs:string(xs:gYearMonth(\"1999-01Z\")) eq \"1999-01Z\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * '-01-12' is an invalid lexical representation for xs:gMonthDay.. */ @org.junit.Test public void kSeqExprCast286() { final XQuery query = new XQuery( "xs:gMonthDay(\"-01-12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '+--01-12' is an invalid lexical representation for xs:gMonthDay.. */ @org.junit.Test public void kSeqExprCast287() { final XQuery query = new XQuery( "xs:gMonthDay(\"+--01-12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '01-12-' is an invalid lexical representation for xs:gMonthDay.. */ @org.junit.Test public void kSeqExprCast288() { final XQuery query = new XQuery( "xs:gMonthDay(\"01-12-\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '--01--12' is an invalid lexical representation for xs:gMonthDay.. */ @org.junit.Test public void kSeqExprCast289() { final XQuery query = new XQuery( "xs:gMonthDay(\"--01--12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `xs:boolean(+0) eq false()`.. */ @org.junit.Test public void kSeqExprCast29() { final XQuery query = new XQuery( "xs:boolean(+0) eq false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * '--01-00' is an invalid lexical representation for xs:gMonthDay.. */ @org.junit.Test public void kSeqExprCast290() { final XQuery query = new XQuery( "xs:gMonthDay(\"--01-00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '--00-01' is an invalid lexical representation for xs:gMonthDay.. */ @org.junit.Test public void kSeqExprCast291() { final XQuery query = new XQuery( "xs:gMonthDay(\"--00-01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '--13-01' is an invalid lexical representation for xs:gMonthDay.. */ @org.junit.Test public void kSeqExprCast292() { final XQuery query = new XQuery( "xs:gMonthDay(\"--13-01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '--111-01' is an invalid lexical representation for xs:gMonthDay.. */ @org.junit.Test public void kSeqExprCast293() { final XQuery query = new XQuery( "xs:gMonthDay(\"--111-01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '--1967-01' is an invalid lexical representation for xs:gMonthDay.. */ @org.junit.Test public void kSeqExprCast294() { final XQuery query = new XQuery( "xs:gMonthDay(\"--1967-01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '--02-31' is an invalid lexical representation for xs:gMonthDay.. */ @org.junit.Test public void kSeqExprCast295() { final XQuery query = new XQuery( "xs:gMonthDay(\"--02-31\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:gMonthDay: the minute field must always be present.. */ @org.junit.Test public void kSeqExprCast296() { final XQuery query = new XQuery( "xs:gMonthDay(\"--11-08-10\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * The xs:gMonthDay value '--02-30' represents a non-existent date.. */ @org.junit.Test public void kSeqExprCast297() { final XQuery query = new XQuery( "xs:gMonthDay(\"--02-30\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * The xs:gMonthDay value '--04-31' represents a non-existent date.. */ @org.junit.Test public void kSeqExprCast298() { final XQuery query = new XQuery( "xs:gMonthDay(\"--04-31\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * The xs:gMonthDay value '--11-31' represents a non-existent date.. */ @org.junit.Test public void kSeqExprCast299() { final XQuery query = new XQuery( "xs:gMonthDay(\"--11-31\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Syntax: only ? is allowed as occurence indicator in 'cast as' expressions.. */ @org.junit.Test public void kSeqExprCast3() { xquery10(); final XQuery query = new XQuery( "'string' cast as xs:anyType*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XPST0051") ) ); } /** * A test whose essence is: `xs:boolean(-0) eq false()`.. */ @org.junit.Test public void kSeqExprCast30() { final XQuery query = new XQuery( "xs:boolean(-0) eq false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Testing timezone field in xs:gMonthDay: the hour component cannot be -15.. */ @org.junit.Test public void kSeqExprCast300() { final XQuery query = new XQuery( "xs:gMonthDay(\"--01-01-15:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:gMonthDay: the hour component cannot be +15.. */ @org.junit.Test public void kSeqExprCast301() { final XQuery query = new XQuery( "xs:gMonthDay(\"--01-01+15:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:gMonthDay: the minute component cannot be +60.. */ @org.junit.Test public void kSeqExprCast302() { final XQuery query = new XQuery( "xs:gMonthDay(\"--01-01+10:60\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:gMonthDay: the minute component cannot be -60.. */ @org.junit.Test public void kSeqExprCast303() { final XQuery query = new XQuery( "xs:gMonthDay(\"--01-01-10:60\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Ensure casting xs:gMonthDay to xs:string, with timezone '-00:00' is properly handled.. */ @org.junit.Test public void kSeqExprCast304() { final XQuery query = new XQuery( "xs:string(xs:gMonthDay(\"--01-01-00:00\")) eq \"--01-01Z\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure casting xs:gMonthDay to xs:string, with timezone '+00:00' is properly handled.. */ @org.junit.Test public void kSeqExprCast305() { final XQuery query = new XQuery( "xs:string(xs:gMonthDay(\"--01-01+00:00\")) eq \"--01-01Z\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure casting xs:gMonthDay to xs:string, with timezone 'Z' is properly handled.. */ @org.junit.Test public void kSeqExprCast306() { final XQuery query = new XQuery( "xs:string(xs:gMonthDay(\"--01-01Z\")) eq \"--01-01Z\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple xs:gMonthDay test involving --02-29.. */ @org.junit.Test public void kSeqExprCast307() { final XQuery query = new XQuery( "xs:gMonthDay(\"--02-29+00:00\") eq xs:gMonthDay(\"--02-29+00:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * '+2004-08-01T12:44:05' is an invalid lexical representation, a preceding '+' sign is not allowed for xs:dateTime.. */ @org.junit.Test public void kSeqExprCast308() { final XQuery query = new XQuery( "xs:dateTime(\"+2004-08-01T12:44:05\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '02004-08-01T12:44:05' is an invalid lexical representation for xs:dateTime; if the year part has more than four digits, leading zeros are prohibited.. */ @org.junit.Test public void kSeqExprCast309() { final XQuery query = new XQuery( "xs:dateTime(\"02004-08-01T12:44:05\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `xs:boolean(xs:double(+0)) eq false()`.. */ @org.junit.Test public void kSeqExprCast31() { final XQuery query = new XQuery( "xs:boolean(xs:double(+0)) eq false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * '00004-08-01T12:44:05' is an invalid lexical representation for xs:dateTime; if the year part has more than four digits, leading zeros are prohibited.. */ @org.junit.Test public void kSeqExprCast310() { final XQuery query = new XQuery( "xs:dateTime(\"00004-08-01T12:44:05\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '2004-32-01T12:44:05' is an invalid lexical representation for xs:dateTime; the month part cannot be larger than 32.. */ @org.junit.Test public void kSeqExprCast311() { final XQuery query = new XQuery( "xs:dateTime(\"2004-32-01T12:44:05\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '2002-02-30T12:44:05' is a non-existent xs:dateTime date.. */ @org.junit.Test public void kSeqExprCast312() { final XQuery query = new XQuery( "xs:dateTime(\"2002-02-30T12:44:05\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '2002-002-15T12:44:05' is an invalid lexical representation for xs:dateTime.. */ @org.junit.Test public void kSeqExprCast313() { final XQuery query = new XQuery( "xs:dateTime(\"2002-002-15T12:44:05\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '2002-02-150T12:44:05' is an invalid lexical representation for xs:dateTime.. */ @org.junit.Test public void kSeqExprCast314() { final XQuery query = new XQuery( "xs:dateTime(\"2002-02-150T12:44:05\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '2002-02-15T24:00:00.001' is an invalid lexical representation for xs:dateTime; if hour is 24, seconds part must be 00.. */ @org.junit.Test public void kSeqExprCast315() { final XQuery query = new XQuery( "xs:dateTime(\"2002-02-15T24:00:00.001\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '2002-02-15T24:01:00' is an invalid lexical representation for xs:dateTime; if hour is 24, minutes part must be 00.. */ @org.junit.Test public void kSeqExprCast316() { final XQuery query = new XQuery( "xs:dateTime(\"2002-02-15T24:01:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '2002-02-15T25:00:00' is an invalid lexical representation for xs:dateTime; hour part can never be larger than 24.. */ @org.junit.Test public void kSeqExprCast317() { final XQuery query = new XQuery( "xs:dateTime(\"2002-02-15T25:01:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '2002-02-15T21:60:00' is an invalid lexical representation for xs:dateTime; minute part can never be larger than 59.. */ @org.junit.Test public void kSeqExprCast318() { final XQuery query = new XQuery( "xs:dateTime(\"2002-02-15T21:60:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '2002-02-15T21:01:60' is an invalid lexical representation for xs:dateTime; seconds part can never be larger than 59.. */ @org.junit.Test public void kSeqExprCast319() { final XQuery query = new XQuery( "xs:dateTime(\"2002-02-15T21:01:60\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `xs:boolean(xs:double(-0)) eq false()`.. */ @org.junit.Test public void kSeqExprCast32() { final XQuery query = new XQuery( "xs:boolean(xs:double(-0)) eq false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * '--2002-02-15T21:01:23' is an invalid lexical representation for xs:dateTime.. */ @org.junit.Test public void kSeqExprCast320() { final XQuery query = new XQuery( "xs:dateTime(\"--2002-02-15T21:01:23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:dateTime: the hour component cannot be -15.. */ @org.junit.Test public void kSeqExprCast321() { final XQuery query = new XQuery( "xs:dateTime(\"1999-12-01T23:59:12.432-15:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:dateTime: the hour component cannot be +15.. */ @org.junit.Test public void kSeqExprCast322() { final XQuery query = new XQuery( "xs:dateTime(\"1999-12-01T23:59:12.432+15:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:dateTime: the minute component cannot be +60.. */ @org.junit.Test public void kSeqExprCast323() { final XQuery query = new XQuery( "xs:dateTime(\"1999-12-01T23:59:12.432+10:60\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:dateTime: the minute component cannot be -60.. */ @org.junit.Test public void kSeqExprCast324() { final XQuery query = new XQuery( "xs:dateTime(\"1999-12-01T23:59:12.432-10:60\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:dateTime: the minute field must always be present.. */ @org.junit.Test public void kSeqExprCast325() { final XQuery query = new XQuery( "xs:dateTime(\"1999-12-01T23:59:12.999-00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Simple test of casting a xs:dateTime with UTC timezone to xs:gYear.. */ @org.junit.Test public void kSeqExprCast326() { final XQuery query = new XQuery( "xs:gYear(xs:dateTime(\"2002-11-23T23:12:23.867-00:00\")) eq xs:gYear(\"2002Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a xs:dateTime with UTC offset to xs:gYear.. */ @org.junit.Test public void kSeqExprCast327() { final XQuery query = new XQuery( "xs:gYear(xs:dateTime(\"2002-11-23T23:12:23.867-13:37\")) eq xs:gYear(\"2002-13:37\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a xs:dateTime with UTC timezone to xs:gYearMonth.. */ @org.junit.Test public void kSeqExprCast328() { final XQuery query = new XQuery( "xs:gYearMonth(xs:dateTime(\"2002-11-23T23:12:23.867-00:00\")) eq xs:gYearMonth(\"2002-11Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a xs:dateTime with UTC offset to xs:gYearMonth.. */ @org.junit.Test public void kSeqExprCast329() { final XQuery query = new XQuery( "xs:gYearMonth(xs:dateTime(\"2002-11-23T23:12:23.867-13:37\")) eq xs:gYearMonth(\"2002-11-13:37\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:boolean(0.0E0) eq false()`.. */ @org.junit.Test public void kSeqExprCast33() { final XQuery query = new XQuery( "xs:boolean(0.0E0) eq false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a xs:dateTime with UTC timezone to xs:gMonth.. */ @org.junit.Test public void kSeqExprCast330() { final XQuery query = new XQuery( "xs:gMonth(xs:dateTime(\"2002-11-23T22:12:23.867-00:00\")) eq xs:gMonth(\"--11Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a xs:dateTime with UTC offset to xs:gMonth.. */ @org.junit.Test public void kSeqExprCast331() { final XQuery query = new XQuery( "xs:gMonth(xs:dateTime(\"2002-11-23T22:12:23.867-13:37\")) eq xs:gMonth(\"--11-13:37\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a xs:dateTime with UTC timezone to xs:gMonthDay.. */ @org.junit.Test public void kSeqExprCast332() { final XQuery query = new XQuery( "xs:gMonthDay(xs:dateTime(\"2002-11-23T22:12:23.867-00:00\")) eq xs:gMonthDay(\"--11-23Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a xs:dateTime with UTC offset to xs:gMonthDay.. */ @org.junit.Test public void kSeqExprCast333() { final XQuery query = new XQuery( "xs:gMonthDay(xs:dateTime(\"2002-11-23T22:12:23.867-13:37\")) eq xs:gMonthDay(\"--11-23-13:37\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a xs:dateTime with UTC timezone to xs:gDay.. */ @org.junit.Test public void kSeqExprCast334() { final XQuery query = new XQuery( "xs:gDay(xs:dateTime(\"2002-11-23T22:12:23.867-00:00\")) eq xs:gDay(\"---23Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a xs:dateTime with UTC offset to xs:gDay.. */ @org.junit.Test public void kSeqExprCast335() { final XQuery query = new XQuery( "xs:gDay(xs:dateTime(\"2002-11-23T22:12:23.867-13:37\")) eq xs:gDay(\"---23-13:37\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a xs:dateTime with UTC timezone to xs:date.. */ @org.junit.Test public void kSeqExprCast336() { final XQuery query = new XQuery( "xs:date(xs:dateTime(\"2002-11-23T22:12:23.867-00:00\")) eq xs:date(\"2002-11-23Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a xs:dateTime with UTC offset to xs:date.. */ @org.junit.Test public void kSeqExprCast337() { final XQuery query = new XQuery( "xs:date(xs:dateTime(\"2002-11-23T22:12:23.867-13:37\")) eq xs:date(\"2002-11-23-13:37\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a xs:dateTime with UTC timezone to xs:time.. */ @org.junit.Test public void kSeqExprCast338() { final XQuery query = new XQuery( "xs:time(xs:dateTime(\"2002-11-23T22:12:23.867-00:00\")) eq xs:time(\"22:12:23.867Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a xs:dateTime with UTC offset to xs:time.. */ @org.junit.Test public void kSeqExprCast339() { final XQuery query = new XQuery( "xs:time(xs:dateTime(\"2002-11-23T22:12:23.867-13:37\")) eq xs:time(\"22:12:23.867-13:37\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:boolean(xs:double("NaN")) eq false()`.. */ @org.junit.Test public void kSeqExprCast34() { final XQuery query = new XQuery( "xs:boolean(xs:double(\"NaN\")) eq false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure casting xs:dateTime to xs:string, with timezone '-00:00' is properly handled.. */ @org.junit.Test public void kSeqExprCast340() { final XQuery query = new XQuery( "xs:string(xs:dateTime(\"1999-12-01T23:59:12.999-00:00\")) eq \"1999-12-01T23:59:12.999Z\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure casting xs:dateTime to xs:string, with timezone '+00:00' is properly handled.. */ @org.junit.Test public void kSeqExprCast341() { final XQuery query = new XQuery( "xs:string(xs:dateTime(\"1999-12-01T23:59:12.432+00:00\")) eq \"1999-12-01T23:59:12.432Z\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure when casting xs:dateTime to xs:string that an empty milli seconds part is not serialized.. */ @org.junit.Test public void kSeqExprCast342() { final XQuery query = new XQuery( "xs:string(xs:dateTime(\"2002-02-15T21:01:23.000\")) eq \"2002-02-15T21:01:23\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure when casting xs:dateTime to xs:string that milli seconds have no trailing zeros.. */ @org.junit.Test public void kSeqExprCast343() { final XQuery query = new XQuery( "xs:string(xs:dateTime(\"2002-02-15T21:01:23.100\")) eq \"2002-02-15T21:01:23.1\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure when casting xs:dateTime to xs:string that milli seconds are properly padded with zeros.. */ @org.junit.Test public void kSeqExprCast344() { final XQuery query = new XQuery( "xs:string(xs:dateTime(\"2002-02-15T21:01:23.001\")) eq \"2002-02-15T21:01:23.001\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure when casting xs:dateTime to xs:string that milli seconds are properly padded with zeros.. */ @org.junit.Test public void kSeqExprCast345() { final XQuery query = new XQuery( "xs:string(xs:dateTime(\"2002-02-15T21:01:23.010\")) eq \"2002-02-15T21:01:23.01\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure when casting xs:dateTime to xs:string that a milli seconds part of '435' is handled properly.. */ @org.junit.Test public void kSeqExprCast346() { final XQuery query = new XQuery( "xs:string(xs:dateTime(\"2002-02-15T21:01:23.435\")) eq \"2002-02-15T21:01:23.435\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure when casting xs:dateTime to xs:string that a milli seconds part of '11' is handled properly.. */ @org.junit.Test public void kSeqExprCast347() { final XQuery query = new XQuery( "xs:string(xs:dateTime(\"2002-02-15T21:01:23.11\")) eq \"2002-02-15T21:01:23.11\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure when casting xs:dateTime to xs:string that a milli seconds part of '110' is handled properly.. */ @org.junit.Test public void kSeqExprCast348() { final XQuery query = new XQuery( "xs:string(xs:dateTime(\"2002-02-15T21:01:23.110\")) eq \"2002-02-15T21:01:23.11\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple xs:dateTime involving time with no milli seconds.. */ @org.junit.Test public void kSeqExprCast349() { final XQuery query = new XQuery( "string(xs:dateTime(\"2000-08-01T12:44:05\")) eq \"2000-08-01T12:44:05\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:boolean(xs:float("NaN")) eq false()`.. */ @org.junit.Test public void kSeqExprCast35() { final XQuery query = new XQuery( "xs:boolean(xs:float(\"NaN\")) eq false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The canonical form of an xs:dateTime containing 24:00:00 is the following day at 00:00:00.. */ @org.junit.Test public void kSeqExprCast350() { final XQuery query = new XQuery( "string(xs:dateTime(\"2004-03-31T24:00:00\")) eq \"2004-04-01T00:00:00\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * '24:00:00.001' is an invalid lexical representation for xs:time; if hour is 24, seconds part must be 00.. */ @org.junit.Test public void kSeqExprCast351() { final XQuery query = new XQuery( "xs:time(\"24:00:00.001\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '24:01:00' is an invalid lexical representation for xs:time; if hour is 24, minutes part must be 00.. */ @org.junit.Test public void kSeqExprCast352() { final XQuery query = new XQuery( "xs:time(\"24:01:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '25:00:00' is an invalid lexical representation for xs:time; hour part can never be larger than 24.. */ @org.junit.Test public void kSeqExprCast353() { final XQuery query = new XQuery( "xs:time(\"25:01:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '21:60:00' is an invalid lexical representation for xs:time; minute part can never be larger than 59.. */ @org.junit.Test public void kSeqExprCast354() { final XQuery query = new XQuery( "xs:time(\"21:60:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '21:01:60' is an invalid lexical representation for xs:time; seconds part can never be larger than 59.. */ @org.junit.Test public void kSeqExprCast355() { final XQuery query = new XQuery( "xs:time(\"21:01:60\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '+21:01:50' is an invalid lexical representation for xs:time.. */ @org.junit.Test public void kSeqExprCast356() { final XQuery query = new XQuery( "xs:time(\"+21:01:50\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '-21:01:50' is an invalid lexical representation for xs:time.. */ @org.junit.Test public void kSeqExprCast357() { final XQuery query = new XQuery( "xs:time(\"-21:01:50\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A valid xs:dateTime is an invalid xs:time.. */ @org.junit.Test public void kSeqExprCast358() { final XQuery query = new XQuery( "xs:time(\"2002-02-15T08:12:12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:time: the hour component cannot be -15.. */ @org.junit.Test public void kSeqExprCast359() { final XQuery query = new XQuery( "xs:time(\"23:59:12.432-15:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Invalid casting combination, combined with value comparison.. */ @org.junit.Test public void kSeqExprCast36() { final XQuery query = new XQuery( "'12312' cast as xs:boolean eq false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:time: the hour component cannot be +15.. */ @org.junit.Test public void kSeqExprCast360() { final XQuery query = new XQuery( "xs:time(\"23:59:12.432+15:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:time: the minute component cannot be +60.. */ @org.junit.Test public void kSeqExprCast361() { final XQuery query = new XQuery( "xs:time(\"23:59:12.432+10:60\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:time: the minute component cannot be -60.. */ @org.junit.Test public void kSeqExprCast362() { final XQuery query = new XQuery( "xs:time(\"23:59:12.432-10:60\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:time: the minute field must always be present.. */ @org.junit.Test public void kSeqExprCast363() { final XQuery query = new XQuery( "xs:dateTime(\"T23:59:12.999-03\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Simple xs:time involving time with no milli seconds.. */ @org.junit.Test public void kSeqExprCast364() { final XQuery query = new XQuery( "string(xs:time(\"12:44:05\")) eq \"12:44:05\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure casting xs:time to xs:string, with timezone '-00:00' is properly handled.. */ @org.junit.Test public void kSeqExprCast365() { final XQuery query = new XQuery( "xs:string(xs:time(\"23:59:12.999-00:00\")) eq \"23:59:12.999Z\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure casting xs:time to xs:string, with timezone '+00:00' is properly handled.. */ @org.junit.Test public void kSeqExprCast366() { final XQuery query = new XQuery( "xs:string(xs:time(\"23:59:12.432+00:00\")) eq \"23:59:12.432Z\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure when casting xs:time to xs:string that an empty milli seconds part is not serialized.. */ @org.junit.Test public void kSeqExprCast367() { final XQuery query = new XQuery( "xs:string(xs:time(\"21:01:23.000\")) eq \"21:01:23\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure when casting xs:time to xs:string that milli seconds have no trailing zeros.. */ @org.junit.Test public void kSeqExprCast368() { final XQuery query = new XQuery( "xs:string(xs:time(\"21:01:23.100\")) eq \"21:01:23.1\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure when casting xs:time to xs:string that milli seconds are properly padded with zeros.. */ @org.junit.Test public void kSeqExprCast369() { final XQuery query = new XQuery( "xs:string(xs:time(\"21:01:23.001\")) eq \"21:01:23.001\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `false() cast as xs:string eq "false"`.. */ @org.junit.Test public void kSeqExprCast37() { final XQuery query = new XQuery( "false() cast as xs:string eq \"false\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure when casting xs:time to xs:string that milli seconds are properly padded with zeros.. */ @org.junit.Test public void kSeqExprCast370() { final XQuery query = new XQuery( "xs:string(xs:time(\"21:01:23.010\")) eq \"21:01:23.01\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure when casting xs:time to xs:string that a milli seconds part of '435' is handled properly.. */ @org.junit.Test public void kSeqExprCast371() { final XQuery query = new XQuery( "xs:string(xs:time(\"21:01:23.435\")) eq \"21:01:23.435\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure when casting xs:time to xs:string that a milli seconds part of '11' is handled properly.. */ @org.junit.Test public void kSeqExprCast372() { final XQuery query = new XQuery( "xs:string(xs:time(\"21:01:23.11\")) eq \"21:01:23.11\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure when casting xs:time to xs:string that a milli seconds part of '110' is handled properly.. */ @org.junit.Test public void kSeqExprCast373() { final XQuery query = new XQuery( "xs:string(xs:time(\"21:01:23.110\")) eq \"21:01:23.11\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The canonical form of an xs:time containing 24:00:00 is 00:00:00.. */ @org.junit.Test public void kSeqExprCast374() { final XQuery query = new XQuery( "string(xs:time(\"24:00:00\")) eq \"00:00:00\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * '+2004-08-01' is an invalid lexical representation, a preceding '+' sign is not allowed for xs:date.. */ @org.junit.Test public void kSeqExprCast375() { final XQuery query = new XQuery( "xs:date(\"+2004-08-01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '02004-08-01' is an invalid lexical representation for xs:date; if the year part has more than four digits, leading zeros are prohibited.. */ @org.junit.Test public void kSeqExprCast376() { final XQuery query = new XQuery( "xs:date(\"02004-08-01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '00004-08-01' is an invalid lexical representation for xs:date; if the year part has more than four digits, leading zeros are prohibited.. */ @org.junit.Test public void kSeqExprCast377() { final XQuery query = new XQuery( "xs:date(\"00004-08-01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '2004-32-01' is an invalid lexical representation for xs:date; the month part cannot be larger than 32.. */ @org.junit.Test public void kSeqExprCast378() { final XQuery query = new XQuery( "xs:date(\"2004-32-01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '2002-02-30' is a non-existent xs:date date.. */ @org.junit.Test public void kSeqExprCast379() { final XQuery query = new XQuery( "xs:date(\"2002-02-30\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `true() cast as xs:string eq "true"`.. */ @org.junit.Test public void kSeqExprCast38() { final XQuery query = new XQuery( "true() cast as xs:string eq \"true\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * '2002-002-15' is an invalid lexical representation for xs:date.. */ @org.junit.Test public void kSeqExprCast380() { final XQuery query = new XQuery( "xs:date(\"2002-002-15\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '2002-02-150' is an invalid lexical representation for xs:date.. */ @org.junit.Test public void kSeqExprCast381() { final XQuery query = new XQuery( "xs:date(\"2002-02-150\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '--2002-02-15' is an invalid lexical representation for xs:date.. */ @org.junit.Test public void kSeqExprCast382() { final XQuery query = new XQuery( "xs:date(\"--2002-02-15\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A valid xs:dateTime is an invalid xs:date.. */ @org.junit.Test public void kSeqExprCast383() { final XQuery query = new XQuery( "xs:date(\"2002-02-15T08:12:12\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:date: the hour component cannot be -15.. */ @org.junit.Test public void kSeqExprCast384() { final XQuery query = new XQuery( "xs:date(\"1999-12-01-15:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:date: the hour component cannot be +15.. */ @org.junit.Test public void kSeqExprCast385() { final XQuery query = new XQuery( "xs:date(\"1999-12-01+15:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:date: the minute component cannot be +60.. */ @org.junit.Test public void kSeqExprCast386() { final XQuery query = new XQuery( "xs:date(\"1999-12-01+10:60\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing timezone field in xs:date: the minute component cannot be -60.. */ @org.junit.Test public void kSeqExprCast387() { final XQuery query = new XQuery( "xs:date(\"1999-12-01-10:60\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Testing datezone field in xs:date: the minute field must always be present.. */ @org.junit.Test public void kSeqExprCast388() { final XQuery query = new XQuery( "xs:dateTime(\"1999-12-01-03\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Simple test of casting a xs:date with UTC timezone to xs:gYear.. */ @org.junit.Test public void kSeqExprCast389() { final XQuery query = new XQuery( "xs:gYear(xs:date(\"2002-11-23Z\")) eq xs:gYear(\"2002Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `('1' cast as xs:boolean) cast as xs:string eq 'true'`.. */ @org.junit.Test public void kSeqExprCast39() { final XQuery query = new XQuery( "('1' cast as xs:boolean) cast as xs:string eq 'true'", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a xs:date with UTC offset to xs:gYear.. */ @org.junit.Test public void kSeqExprCast390() { final XQuery query = new XQuery( "xs:gYear(xs:date(\"2002-11-23-13:37\")) eq xs:gYear(\"2002-13:37\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a xs:date with UTC timezone to xs:gYearMonth.. */ @org.junit.Test public void kSeqExprCast391() { final XQuery query = new XQuery( "xs:gYearMonth(xs:date(\"2002-11-23Z\")) eq xs:gYearMonth(\"2002-11Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a xs:date with UTC offset to xs:gYearMonth.. */ @org.junit.Test public void kSeqExprCast392() { final XQuery query = new XQuery( "xs:gYearMonth(xs:date(\"2002-11-23-13:37\")) eq xs:gYearMonth(\"2002-11-13:37\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a xs:date with UTC timezone to xs:gMonth.. */ @org.junit.Test public void kSeqExprCast393() { final XQuery query = new XQuery( "xs:gMonth(xs:date(\"2002-11-23-00:00\")) eq xs:gMonth(\"--11Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a xs:date with UTC offset to xs:gMonth.. */ @org.junit.Test public void kSeqExprCast394() { final XQuery query = new XQuery( "xs:gMonth(xs:date(\"2002-11-23-13:37\")) eq xs:gMonth(\"--11-13:37\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a xs:date with UTC timezone to xs:gMonthDay.. */ @org.junit.Test public void kSeqExprCast395() { final XQuery query = new XQuery( "xs:gMonthDay(xs:date(\"2002-11-23-00:00\")) eq xs:gMonthDay(\"--11-23Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a xs:date with UTC offset to xs:gMonthDay.. */ @org.junit.Test public void kSeqExprCast396() { final XQuery query = new XQuery( "xs:gMonthDay(xs:date(\"2002-11-23-13:37\")) eq xs:gMonthDay(\"--11-23-13:37\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a xs:date with UTC timezone to xs:gDay.. */ @org.junit.Test public void kSeqExprCast397() { final XQuery query = new XQuery( "xs:gDay(xs:date(\"2002-11-23-00:00\")) eq xs:gDay(\"---23Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a xs:date with UTC offset to xs:gDay.. */ @org.junit.Test public void kSeqExprCast398() { final XQuery query = new XQuery( "xs:gDay(xs:date(\"2002-11-23-13:37\")) eq xs:gDay(\"---23-13:37\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a xs:date with UTC timezone to xs:time.. */ @org.junit.Test public void kSeqExprCast399() { final XQuery query = new XQuery( "xs:dateTime(xs:date(\"2002-11-23-00:00\")) eq xs:dateTime(\"2002-11-23T00:00:00.000Z\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Syntax: only ? is allowed as occurence indicator in 'cast as' expressions.. */ @org.junit.Test public void kSeqExprCast3a() { final XQuery query = new XQuery( "'string' cast as xs:anyType*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XQST0052") ) ); } /** * 'cast as' where the type is invalid.. */ @org.junit.Test public void kSeqExprCast4() { xquery10(); final XQuery query = new XQuery( "'string' cast as xs:anySimpleType", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0051") ); } /** * A test whose essence is: `xs:boolean('0') cast as xs:string eq 'false'`.. */ @org.junit.Test public void kSeqExprCast40() { final XQuery query = new XQuery( "xs:boolean('0') cast as xs:string eq 'false'", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test of casting a xs:date with UTC offset to xs:dateTime.. */ @org.junit.Test public void kSeqExprCast400() { final XQuery query = new XQuery( "xs:dateTime(xs:date(\"2002-11-23-13:37\")) eq xs:dateTime(\"2002-11-23T00:00:00.000-13:37\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure casting xs:date to xs:string, with timezone '-00:00' is properly handled.. */ @org.junit.Test public void kSeqExprCast401() { final XQuery query = new XQuery( "xs:string(xs:date(\"1999-12-01-00:00\")) eq \"1999-12-01Z\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure casting xs:date to xs:string, with timezone '+00:00' is properly handled.. */ @org.junit.Test public void kSeqExprCast402() { final XQuery query = new XQuery( "xs:string(xs:date(\"1999-12-01+00:00\")) eq \"1999-12-01Z\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure when casting xs:date to xs:string that an empty milli seconds part is not serialized.. */ @org.junit.Test public void kSeqExprCast403() { final XQuery query = new XQuery( "xs:string(xs:date(\"2002-02-15\")) eq \"2002-02-15\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure when casting xs:date to xs:string that milli seconds have no trailing zeros.. */ @org.junit.Test public void kSeqExprCast404() { final XQuery query = new XQuery( "xs:string(xs:date(\"2002-02-15\")) eq \"2002-02-15\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure when casting xs:date to xs:string that milli seconds are properly padded with zeros.. */ @org.junit.Test public void kSeqExprCast405() { final XQuery query = new XQuery( "xs:string(xs:date(\"2002-02-15\")) eq \"2002-02-15\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure when casting xs:date to xs:string that milli seconds are properly padded with zeros.. */ @org.junit.Test public void kSeqExprCast406() { final XQuery query = new XQuery( "xs:string(xs:date(\"2002-02-15\")) eq \"2002-02-15\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure when casting xs:date to xs:string that a milli seconds part of '435' is handled properly.. */ @org.junit.Test public void kSeqExprCast407() { final XQuery query = new XQuery( "xs:string(xs:date(\"2002-02-15\")) eq \"2002-02-15\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure when casting xs:date to xs:string that a milli seconds part of '11' is handled properly.. */ @org.junit.Test public void kSeqExprCast408() { final XQuery query = new XQuery( "xs:string(xs:date(\"2002-02-15\")) eq \"2002-02-15\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure when casting xs:date to xs:string that a milli seconds part of '110' is handled properly.. */ @org.junit.Test public void kSeqExprCast409() { final XQuery query = new XQuery( "xs:string(xs:date(\"2002-02-15\")) eq \"2002-02-15\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `" white space left alone" cast as xs:string eq xs:string(" white space left alone")`.. */ @org.junit.Test public void kSeqExprCast41() { final XQuery query = new XQuery( "\" white space left alone\" cast as xs:string eq xs:string(\" white space left alone\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The xs:untypedAtomic constructor function must be passed exactly one argument, not zero.. */ @org.junit.Test public void kSeqExprCast411() { final XQuery query = new XQuery( "xs:untypedAtomic()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * The xs:untypedAtomic constructor function must be passed exactly one argument, not two.. */ @org.junit.Test public void kSeqExprCast412() { final XQuery query = new XQuery( "xs:untypedAtomic( \"an arbitrary string(untypedAtomic source)\" , \"an arbitrary string(untypedAtomic source)\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Verify with 'instance of' that the xs:untypedAtomic constructor function produces values of the correct type. * The subsequence() function makes it more difficult for optimizers to take short cuts based on static type information.. */ @org.junit.Test public void kSeqExprCast413() { final XQuery query = new XQuery( "subsequence((\"dummy\", 1.1, xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\")), 3, 1) instance of xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A simple test exercising the whitespace facet for type xs:untypedAtomic.. */ @org.junit.Test public void kSeqExprCast414() { final XQuery query = new XQuery( "xs:untypedAtomic(\" an arbitrary string(untypedAtomic source) \") eq xs:untypedAtomic(\" an arbitrary string(untypedAtomic source) \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An empty string is a valid lexical representation of xs:untypedAtomic.. */ @org.junit.Test public void kSeqExprCast415() { final XQuery query = new XQuery( "xs:untypedAtomic(\"\") eq xs:untypedAtomic(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Cast a simple xs:untypedAtomic value to "an arbitrary string(untypedAtomic source)" .. */ @org.junit.Test public void kSeqExprCast416() { final XQuery query = new XQuery( "xs:untypedAtomic(xs:untypedAtomic( \"an arbitrary string(untypedAtomic source)\" )) eq xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Applying fn:boolean() to a value of type xs:untypedAtomic that has the lexical value ' "an arbitrary string(untypedAtomic source)" ' should result in the boolean value true.. */ @org.junit.Test public void kSeqExprCast417() { final XQuery query = new XQuery( "boolean(xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:untypedAtomic to xs:untypedAtomic is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast418() { final XQuery query = new XQuery( "xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\") cast as xs:untypedAtomic eq xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:untypedAtomic as source type and xs:untypedAtomic as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast419() { final XQuery query = new XQuery( "xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:QName("fn:local-name") cast as xs:string) eq "fn:local-name"`.. */ @org.junit.Test public void kSeqExprCast42() { final XQuery query = new XQuery( "(xs:QName(\"fn:local-name\") cast as xs:string) eq \"fn:local-name\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:untypedAtomic to xs:string is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast420() { final XQuery query = new XQuery( "xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\") cast as xs:string ne xs:string(\"an arbitrary string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:untypedAtomic as source type and xs:string as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast421() { final XQuery query = new XQuery( "xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:untypedAtomic to xs:QName isn't allowed.. */ @org.junit.Test public void kSeqExprCast422() { xquery10(); final XQuery query = new XQuery( "xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\") cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Casting from xs:untypedAtomic to xs:QName isn't allowed.. */ @org.junit.Test public void kSeqExprCast422a() { final XQuery query = new XQuery( "xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\") cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * 'castable as' involving xs:untypedAtomic as source type and xs:QName as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast423() { final XQuery query = new XQuery( "not(xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\") castable as xs:QName)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:untypedAtomic as sourceType and xs:NOTATION should fail due to it involving xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast424() { final XQuery query = new XQuery( "not(xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\") castable as xs:NOTATION)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * The xs:string constructor function must be passed exactly one argument, not zero.. */ @org.junit.Test public void kSeqExprCast425() { final XQuery query = new XQuery( "xs:string()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * The xs:string constructor function must be passed exactly one argument, not two.. */ @org.junit.Test public void kSeqExprCast426() { final XQuery query = new XQuery( "xs:string( \"an arbitrary string\" , \"an arbitrary string\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Verify with 'instance of' that the xs:string constructor function produces values of the correct type. * The subsequence() function makes it more difficult for optimizers to take short cuts based on static type information.. */ @org.junit.Test public void kSeqExprCast427() { final XQuery query = new XQuery( "subsequence((\"dummy\", 1.1, xs:string(\"an arbitrary string\")), 3, 1) instance of xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A simple test exercising the whitespace facet for type xs:string.. */ @org.junit.Test public void kSeqExprCast428() { final XQuery query = new XQuery( "xs:string(\" an arbitrary string \") eq xs:string(\" an arbitrary string \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An empty string is a valid lexical representation of xs:string.. */ @org.junit.Test public void kSeqExprCast429() { final XQuery query = new XQuery( "xs:string(\"\") eq xs:string(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:QName("local-name") cast as xs:string) eq "local-name"`.. */ @org.junit.Test public void kSeqExprCast43() { final XQuery query = new XQuery( "(xs:QName(\"local-name\") cast as xs:string) eq \"local-name\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Cast a simple xs:untypedAtomic value to "an arbitrary string" .. */ @org.junit.Test public void kSeqExprCast430() { final XQuery query = new XQuery( "xs:string(xs:untypedAtomic( \"an arbitrary string\" )) eq xs:string(\"an arbitrary string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Applying fn:boolean() to a value of type xs:string that has the lexical value ' "an arbitrary string" ' should result in the boolean value true.. */ @org.junit.Test public void kSeqExprCast431() { final XQuery query = new XQuery( "boolean(xs:string(\"an arbitrary string\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:string to xs:untypedAtomic is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast432() { final XQuery query = new XQuery( "xs:string(\"an arbitrary string\") cast as xs:untypedAtomic ne xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:string as source type and xs:untypedAtomic as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast433() { final XQuery query = new XQuery( "xs:string(\"an arbitrary string\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:string to xs:string is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast434() { final XQuery query = new XQuery( "xs:string(\"an arbitrary string\") cast as xs:string eq xs:string(\"an arbitrary string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:string as source type and xs:string as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast435() { final XQuery query = new XQuery( "xs:string(\"an arbitrary string\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:string as sourceType and xs:NOTATION should fail due to it involving xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast436() { final XQuery query = new XQuery( "not(xs:string(\"an arbitrary string\") castable as xs:NOTATION)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * The xs:float constructor function must be passed exactly one argument, not zero.. */ @org.junit.Test public void kSeqExprCast437() { final XQuery query = new XQuery( "xs:float()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * The xs:float constructor function must be passed exactly one argument, not two.. */ @org.junit.Test public void kSeqExprCast438() { final XQuery query = new XQuery( "xs:float( \"3.4e5\" , \"3.4e5\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Verify with 'instance of' that the xs:float constructor function produces values of the correct type. * The subsequence() function makes it more difficult for optimizers to take short cuts based on static type information.. */ @org.junit.Test public void kSeqExprCast439() { final XQuery query = new XQuery( "subsequence((\"dummy\", 1.1, xs:float(\"3.4e5\")), 3, 1) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:anyURI('example.com/')) eq 'example.com/'`.. */ @org.junit.Test public void kSeqExprCast44() { final XQuery query = new XQuery( "xs:string(xs:anyURI('example.com/')) eq 'example.com/'", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A simple test exercising the whitespace facet for type xs:float.. */ @org.junit.Test public void kSeqExprCast440() { final XQuery query = new XQuery( "xs:float(\" 3.4e5 \") eq xs:float(\" 3.4e5 \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An empty string is not a valid lexical representation of xs:float.. */ @org.junit.Test public void kSeqExprCast441() { final XQuery query = new XQuery( "xs:float(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a simple xs:untypedAtomic value to "3.4e5" .. */ @org.junit.Test public void kSeqExprCast442() { final XQuery query = new XQuery( "xs:float(xs:untypedAtomic( \"3.4e5\" )) eq xs:float(\"3.4e5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Applying fn:boolean() to a value of type xs:float that has the lexical value ' "3.4e5" ' should result in the boolean value true.. */ @org.junit.Test public void kSeqExprCast443() { final XQuery query = new XQuery( "boolean(xs:float(\"3.4e5\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:float to xs:untypedAtomic is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast444() { final XQuery query = new XQuery( "xs:float(\"3.4e5\") cast as xs:untypedAtomic ne xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:float as source type and xs:untypedAtomic as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast445() { final XQuery query = new XQuery( "xs:float(\"3.4e5\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:float to xs:string is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast446() { final XQuery query = new XQuery( "xs:float(\"3.4e5\") cast as xs:string ne xs:string(\"an arbitrary string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:float as source type and xs:string as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast447() { final XQuery query = new XQuery( "xs:float(\"3.4e5\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:float to xs:float is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast448() { final XQuery query = new XQuery( "xs:float(\"3.4e5\") cast as xs:float eq xs:float(\"3.4e5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:float as source type and xs:float as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast449() { final XQuery query = new XQuery( "xs:float(\"3.4e5\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:double(3)) eq '3'`.. */ @org.junit.Test public void kSeqExprCast45() { final XQuery query = new XQuery( "xs:string(xs:double(3)) eq '3'", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:float to xs:double is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast450() { final XQuery query = new XQuery( "xs:float(\"3.4e5\") cast as xs:double ne xs:double(\"3.3e3\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:float as source type and xs:double as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast451() { final XQuery query = new XQuery( "xs:float(\"3.4e5\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:float to xs:duration isn't allowed.. */ @org.junit.Test public void kSeqExprCast452() { final XQuery query = new XQuery( "xs:float(\"3.4e5\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:float as source type and xs:duration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast453() { final XQuery query = new XQuery( "not(xs:float(\"3.4e5\") castable as xs:duration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:float to xs:yearMonthDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast454() { final XQuery query = new XQuery( "xs:float(\"3.4e5\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:float as source type and xs:yearMonthDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast455() { final XQuery query = new XQuery( "not(xs:float(\"3.4e5\") castable as xs:yearMonthDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:float to xs:dayTimeDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast456() { final XQuery query = new XQuery( "xs:float(\"3.4e5\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:float as source type and xs:dayTimeDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast457() { final XQuery query = new XQuery( "not(xs:float(\"3.4e5\") castable as xs:dayTimeDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:float to xs:dateTime isn't allowed.. */ @org.junit.Test public void kSeqExprCast458() { final XQuery query = new XQuery( "xs:float(\"3.4e5\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:float as source type and xs:dateTime as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast459() { final XQuery query = new XQuery( "not(xs:float(\"3.4e5\") castable as xs:dateTime)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:string(3)) eq '3'`.. */ @org.junit.Test public void kSeqExprCast46() { final XQuery query = new XQuery( "xs:string(xs:string(3)) eq '3'", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:float to xs:time isn't allowed.. */ @org.junit.Test public void kSeqExprCast460() { final XQuery query = new XQuery( "xs:float(\"3.4e5\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:float as source type and xs:time as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast461() { final XQuery query = new XQuery( "not(xs:float(\"3.4e5\") castable as xs:time)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:float to xs:date isn't allowed.. */ @org.junit.Test public void kSeqExprCast462() { final XQuery query = new XQuery( "xs:float(\"3.4e5\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:float as source type and xs:date as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast463() { final XQuery query = new XQuery( "not(xs:float(\"3.4e5\") castable as xs:date)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:float to xs:gYearMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast464() { final XQuery query = new XQuery( "xs:float(\"3.4e5\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:float as source type and xs:gYearMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast465() { final XQuery query = new XQuery( "not(xs:float(\"3.4e5\") castable as xs:gYearMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:float to xs:gYear isn't allowed.. */ @org.junit.Test public void kSeqExprCast466() { final XQuery query = new XQuery( "xs:float(\"3.4e5\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:float as source type and xs:gYear as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast467() { final XQuery query = new XQuery( "not(xs:float(\"3.4e5\") castable as xs:gYear)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:float to xs:gMonthDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast468() { final XQuery query = new XQuery( "xs:float(\"3.4e5\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:float as source type and xs:gMonthDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast469() { final XQuery query = new XQuery( "not(xs:float(\"3.4e5\") castable as xs:gMonthDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:integer(3)) eq '3'`.. */ @org.junit.Test public void kSeqExprCast47() { final XQuery query = new XQuery( "xs:string(xs:integer(3)) eq '3'", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:float to xs:gDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast470() { final XQuery query = new XQuery( "xs:float(\"3.4e5\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:float as source type and xs:gDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast471() { final XQuery query = new XQuery( "not(xs:float(\"3.4e5\") castable as xs:gDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:float to xs:gMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast472() { final XQuery query = new XQuery( "xs:float(\"3.4e5\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:float as source type and xs:gMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast473() { final XQuery query = new XQuery( "not(xs:float(\"3.4e5\") castable as xs:gMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:float to xs:boolean is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast474() { final XQuery query = new XQuery( "xs:float(\"3.4e5\") cast as xs:boolean eq xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:float as source type and xs:boolean as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast475() { final XQuery query = new XQuery( "xs:float(\"3.4e5\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:float to xs:base64Binary isn't allowed.. */ @org.junit.Test public void kSeqExprCast476() { final XQuery query = new XQuery( "xs:float(\"3.4e5\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:float as source type and xs:base64Binary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast477() { final XQuery query = new XQuery( "not(xs:float(\"3.4e5\") castable as xs:base64Binary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:float to xs:hexBinary isn't allowed.. */ @org.junit.Test public void kSeqExprCast478() { final XQuery query = new XQuery( "xs:float(\"3.4e5\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:float as source type and xs:hexBinary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast479() { final XQuery query = new XQuery( "not(xs:float(\"3.4e5\") castable as xs:hexBinary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:decimal(3)) eq '3'`.. */ @org.junit.Test public void kSeqExprCast48() { final XQuery query = new XQuery( "xs:string(xs:decimal(3)) eq '3'", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:float to xs:anyURI isn't allowed.. */ @org.junit.Test public void kSeqExprCast480() { final XQuery query = new XQuery( "xs:float(\"3.4e5\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:float as source type and xs:anyURI as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast481() { final XQuery query = new XQuery( "not(xs:float(\"3.4e5\") castable as xs:anyURI)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:float to xs:QName isn't allowed.. */ @org.junit.Test public void kSeqExprCast482() { final XQuery query = new XQuery( "xs:float(\"3.4e5\") cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:float as source type and xs:QName as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast483() { final XQuery query = new XQuery( "not(xs:float(\"3.4e5\") castable as xs:QName)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:float as sourceType and xs:NOTATION should fail due to it involving xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast484() { final XQuery query = new XQuery( "not(xs:float(\"3.4e5\") castable as xs:NOTATION)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * The xs:double constructor function must be passed exactly one argument, not zero.. */ @org.junit.Test public void kSeqExprCast485() { final XQuery query = new XQuery( "xs:double()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * The xs:double constructor function must be passed exactly one argument, not two.. */ @org.junit.Test public void kSeqExprCast486() { final XQuery query = new XQuery( "xs:double( \"3.3e3\" , \"3.3e3\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Verify with 'instance of' that the xs:double constructor function produces values of the correct type. * The subsequence() function makes it more difficult for optimizers to take short cuts based on static type information.. */ @org.junit.Test public void kSeqExprCast487() { final XQuery query = new XQuery( "subsequence((\"dummy\", 1.1, xs:double(\"3.3e3\")), 3, 1) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A simple test exercising the whitespace facet for type xs:double.. */ @org.junit.Test public void kSeqExprCast488() { final XQuery query = new XQuery( "xs:double(\" 3.3e3 \") eq xs:double(\" 3.3e3 \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An empty string is not a valid lexical representation of xs:double.. */ @org.junit.Test public void kSeqExprCast489() { final XQuery query = new XQuery( "xs:double(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `"untyped a " cast as xs:untypedAtomic eq xs:untypedAtomic("untyped a ")`.. */ @org.junit.Test public void kSeqExprCast49() { final XQuery query = new XQuery( "\"untyped a \" cast as xs:untypedAtomic eq xs:untypedAtomic(\"untyped a \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Cast a simple xs:untypedAtomic value to "3.3e3" .. */ @org.junit.Test public void kSeqExprCast490() { final XQuery query = new XQuery( "xs:double(xs:untypedAtomic( \"3.3e3\" )) eq xs:double(\"3.3e3\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Applying fn:boolean() to a value of type xs:double that has the lexical value ' "3.3e3" ' should result in the boolean value true.. */ @org.junit.Test public void kSeqExprCast491() { final XQuery query = new XQuery( "boolean(xs:double(\"3.3e3\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:double to xs:untypedAtomic is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast492() { final XQuery query = new XQuery( "xs:double(\"3.3e3\") cast as xs:untypedAtomic ne xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:double as source type and xs:untypedAtomic as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast493() { final XQuery query = new XQuery( "xs:double(\"3.3e3\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:double to xs:string is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast494() { final XQuery query = new XQuery( "xs:double(\"3.3e3\") cast as xs:string ne xs:string(\"an arbitrary string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:double as source type and xs:string as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast495() { final XQuery query = new XQuery( "xs:double(\"3.3e3\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:double to xs:float is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast496() { final XQuery query = new XQuery( "xs:double(\"3.3e3\") cast as xs:float ne xs:float(\"3.4e5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:double as source type and xs:float as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast497() { final XQuery query = new XQuery( "xs:double(\"3.3e3\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:double to xs:double is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast498() { final XQuery query = new XQuery( "xs:double(\"3.3e3\") cast as xs:double eq xs:double(\"3.3e3\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:double as source type and xs:double as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast499() { final XQuery query = new XQuery( "xs:double(\"3.3e3\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'cast as' where the type is invalid.. */ @org.junit.Test public void kSeqExprCast4a() { final XQuery query = new XQuery( "'string' cast as xs:anySimpleType", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * 'cast as' where the type is invalid.. */ @org.junit.Test public void kSeqExprCast5() { xquery10(); final XQuery query = new XQuery( "'string' cast as xs:untyped", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0051") ); } /** * A test whose essence is: `false() cast as xs:untypedAtomic eq xs:untypedAtomic("false")`.. */ @org.junit.Test public void kSeqExprCast50() { final XQuery query = new XQuery( "false() cast as xs:untypedAtomic eq xs:untypedAtomic(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:double to xs:duration isn't allowed.. */ @org.junit.Test public void kSeqExprCast500() { final XQuery query = new XQuery( "xs:double(\"3.3e3\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:double as source type and xs:duration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast501() { final XQuery query = new XQuery( "not(xs:double(\"3.3e3\") castable as xs:duration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:double to xs:yearMonthDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast502() { final XQuery query = new XQuery( "xs:double(\"3.3e3\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:double as source type and xs:yearMonthDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast503() { final XQuery query = new XQuery( "not(xs:double(\"3.3e3\") castable as xs:yearMonthDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:double to xs:dayTimeDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast504() { final XQuery query = new XQuery( "xs:double(\"3.3e3\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:double as source type and xs:dayTimeDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast505() { final XQuery query = new XQuery( "not(xs:double(\"3.3e3\") castable as xs:dayTimeDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:double to xs:dateTime isn't allowed.. */ @org.junit.Test public void kSeqExprCast506() { final XQuery query = new XQuery( "xs:double(\"3.3e3\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:double as source type and xs:dateTime as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast507() { final XQuery query = new XQuery( "not(xs:double(\"3.3e3\") castable as xs:dateTime)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:double to xs:time isn't allowed.. */ @org.junit.Test public void kSeqExprCast508() { final XQuery query = new XQuery( "xs:double(\"3.3e3\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:double as source type and xs:time as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast509() { final XQuery query = new XQuery( "not(xs:double(\"3.3e3\") castable as xs:time)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `true() cast as xs:untypedAtomic eq xs:untypedAtomic("true")`.. */ @org.junit.Test public void kSeqExprCast51() { final XQuery query = new XQuery( "true() cast as xs:untypedAtomic eq xs:untypedAtomic(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:double to xs:date isn't allowed.. */ @org.junit.Test public void kSeqExprCast510() { final XQuery query = new XQuery( "xs:double(\"3.3e3\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:double as source type and xs:date as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast511() { final XQuery query = new XQuery( "not(xs:double(\"3.3e3\") castable as xs:date)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:double to xs:gYearMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast512() { final XQuery query = new XQuery( "xs:double(\"3.3e3\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:double as source type and xs:gYearMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast513() { final XQuery query = new XQuery( "not(xs:double(\"3.3e3\") castable as xs:gYearMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:double to xs:gYear isn't allowed.. */ @org.junit.Test public void kSeqExprCast514() { final XQuery query = new XQuery( "xs:double(\"3.3e3\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:double as source type and xs:gYear as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast515() { final XQuery query = new XQuery( "not(xs:double(\"3.3e3\") castable as xs:gYear)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:double to xs:gMonthDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast516() { final XQuery query = new XQuery( "xs:double(\"3.3e3\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:double as source type and xs:gMonthDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast517() { final XQuery query = new XQuery( "not(xs:double(\"3.3e3\") castable as xs:gMonthDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:double to xs:gDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast518() { final XQuery query = new XQuery( "xs:double(\"3.3e3\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:double as source type and xs:gDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast519() { final XQuery query = new XQuery( "not(xs:double(\"3.3e3\") castable as xs:gDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `false() cast as xs:untypedAtomic instance of xs:untypedAtomic`.. */ @org.junit.Test public void kSeqExprCast52() { final XQuery query = new XQuery( "false() cast as xs:untypedAtomic instance of xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:double to xs:gMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast520() { final XQuery query = new XQuery( "xs:double(\"3.3e3\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:double as source type and xs:gMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast521() { final XQuery query = new XQuery( "not(xs:double(\"3.3e3\") castable as xs:gMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:double to xs:boolean is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast522() { final XQuery query = new XQuery( "xs:double(\"3.3e3\") cast as xs:boolean eq xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:double as source type and xs:boolean as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast523() { final XQuery query = new XQuery( "xs:double(\"3.3e3\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:double to xs:base64Binary isn't allowed.. */ @org.junit.Test public void kSeqExprCast524() { final XQuery query = new XQuery( "xs:double(\"3.3e3\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:double as source type and xs:base64Binary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast525() { final XQuery query = new XQuery( "not(xs:double(\"3.3e3\") castable as xs:base64Binary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:double to xs:hexBinary isn't allowed.. */ @org.junit.Test public void kSeqExprCast526() { final XQuery query = new XQuery( "xs:double(\"3.3e3\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:double as source type and xs:hexBinary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast527() { final XQuery query = new XQuery( "not(xs:double(\"3.3e3\") castable as xs:hexBinary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:double to xs:anyURI isn't allowed.. */ @org.junit.Test public void kSeqExprCast528() { final XQuery query = new XQuery( "xs:double(\"3.3e3\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:double as source type and xs:anyURI as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast529() { final XQuery query = new XQuery( "not(xs:double(\"3.3e3\") castable as xs:anyURI)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `true() cast as xs:untypedAtomic instance of xs:untypedAtomic`.. */ @org.junit.Test public void kSeqExprCast53() { final XQuery query = new XQuery( "true() cast as xs:untypedAtomic instance of xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:double to xs:QName isn't allowed.. */ @org.junit.Test public void kSeqExprCast530() { final XQuery query = new XQuery( "xs:double(\"3.3e3\") cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:double as source type and xs:QName as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast531() { final XQuery query = new XQuery( "not(xs:double(\"3.3e3\") castable as xs:QName)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:double as sourceType and xs:NOTATION should fail due to it involving xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast532() { final XQuery query = new XQuery( "not(xs:double(\"3.3e3\") castable as xs:NOTATION)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * The xs:decimal constructor function must be passed exactly one argument, not zero.. */ @org.junit.Test public void kSeqExprCast533() { final XQuery query = new XQuery( "xs:decimal()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * The xs:decimal constructor function must be passed exactly one argument, not two.. */ @org.junit.Test public void kSeqExprCast534() { final XQuery query = new XQuery( "xs:decimal( \"10.01\" , \"10.01\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Verify with 'instance of' that the xs:decimal constructor function produces values of the correct type. * The subsequence() function makes it more difficult for optimizers to take short cuts based on static type information.. */ @org.junit.Test public void kSeqExprCast535() { final XQuery query = new XQuery( "subsequence((\"dummy\", 1.1, xs:decimal(\"10.01\")), 3, 1) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A simple test exercising the whitespace facet for type xs:decimal.. */ @org.junit.Test public void kSeqExprCast536() { final XQuery query = new XQuery( "xs:decimal(\" 10.01 \") eq xs:decimal(\" 10.01 \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An empty string is not a valid lexical representation of xs:decimal.. */ @org.junit.Test public void kSeqExprCast537() { final XQuery query = new XQuery( "xs:decimal(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a simple xs:untypedAtomic value to "10.01" .. */ @org.junit.Test public void kSeqExprCast538() { final XQuery query = new XQuery( "xs:decimal(xs:untypedAtomic( \"10.01\" )) eq xs:decimal(\"10.01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Applying fn:boolean() to a value of type xs:decimal that has the lexical value ' "10.01" ' should result in the boolean value true.. */ @org.junit.Test public void kSeqExprCast539() { final XQuery query = new XQuery( "boolean(xs:decimal(\"10.01\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:QName("local-name") cast as xs:untypedAtomic) eq xs:untypedAtomic("local-name")`.. */ @org.junit.Test public void kSeqExprCast54() { final XQuery query = new XQuery( "(xs:QName(\"local-name\") cast as xs:untypedAtomic) eq xs:untypedAtomic(\"local-name\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:decimal to xs:untypedAtomic is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast540() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") cast as xs:untypedAtomic ne xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:decimal as source type and xs:untypedAtomic as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast541() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:decimal to xs:string is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast542() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") cast as xs:string ne xs:string(\"an arbitrary string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:decimal as source type and xs:string as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast543() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:decimal to xs:float is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast544() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") cast as xs:float ne xs:float(\"3.4e5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:decimal as source type and xs:float as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast545() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:decimal to xs:double is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast546() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") cast as xs:double ne xs:double(\"3.3e3\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:decimal as source type and xs:double as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast547() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:decimal to xs:decimal is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast548() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") cast as xs:decimal eq xs:decimal(\"10.01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:decimal as source type and xs:decimal as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast549() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(xs:QName("fn:local-name") cast as xs:untypedAtomic) eq xs:untypedAtomic("fn:local-name")`.. */ @org.junit.Test public void kSeqExprCast55() { final XQuery query = new XQuery( "(xs:QName(\"fn:local-name\") cast as xs:untypedAtomic) eq xs:untypedAtomic(\"fn:local-name\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:decimal to xs:integer is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast550() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") cast as xs:integer ne xs:integer(\"6789\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:decimal as source type and xs:integer as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast551() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:decimal to xs:duration isn't allowed.. */ @org.junit.Test public void kSeqExprCast552() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:decimal as source type and xs:duration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast553() { final XQuery query = new XQuery( "not(xs:decimal(\"10.01\") castable as xs:duration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:decimal to xs:yearMonthDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast554() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:decimal as source type and xs:yearMonthDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast555() { final XQuery query = new XQuery( "not(xs:decimal(\"10.01\") castable as xs:yearMonthDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:decimal to xs:dayTimeDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast556() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:decimal as source type and xs:dayTimeDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast557() { final XQuery query = new XQuery( "not(xs:decimal(\"10.01\") castable as xs:dayTimeDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:decimal to xs:dateTime isn't allowed.. */ @org.junit.Test public void kSeqExprCast558() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:decimal as source type and xs:dateTime as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast559() { final XQuery query = new XQuery( "not(xs:decimal(\"10.01\") castable as xs:dateTime)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:untypedAtomic(xs:anyURI('example.com/')) eq 'example.com/'`.. */ @org.junit.Test public void kSeqExprCast56() { final XQuery query = new XQuery( "xs:untypedAtomic(xs:anyURI('example.com/')) eq 'example.com/'", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:decimal to xs:time isn't allowed.. */ @org.junit.Test public void kSeqExprCast560() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:decimal as source type and xs:time as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast561() { final XQuery query = new XQuery( "not(xs:decimal(\"10.01\") castable as xs:time)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:decimal to xs:date isn't allowed.. */ @org.junit.Test public void kSeqExprCast562() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:decimal as source type and xs:date as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast563() { final XQuery query = new XQuery( "not(xs:decimal(\"10.01\") castable as xs:date)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:decimal to xs:gYearMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast564() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:decimal as source type and xs:gYearMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast565() { final XQuery query = new XQuery( "not(xs:decimal(\"10.01\") castable as xs:gYearMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:decimal to xs:gYear isn't allowed.. */ @org.junit.Test public void kSeqExprCast566() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:decimal as source type and xs:gYear as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast567() { final XQuery query = new XQuery( "not(xs:decimal(\"10.01\") castable as xs:gYear)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:decimal to xs:gMonthDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast568() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:decimal as source type and xs:gMonthDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast569() { final XQuery query = new XQuery( "not(xs:decimal(\"10.01\") castable as xs:gMonthDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:untypedAtomic(xs:double(3)) eq '3'`.. */ @org.junit.Test public void kSeqExprCast57() { final XQuery query = new XQuery( "xs:untypedAtomic(xs:double(3)) eq '3'", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:decimal to xs:gDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast570() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:decimal as source type and xs:gDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast571() { final XQuery query = new XQuery( "not(xs:decimal(\"10.01\") castable as xs:gDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:decimal to xs:gMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast572() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:decimal as source type and xs:gMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast573() { final XQuery query = new XQuery( "not(xs:decimal(\"10.01\") castable as xs:gMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:decimal to xs:boolean is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast574() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") cast as xs:boolean eq xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:decimal as source type and xs:boolean as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast575() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:decimal to xs:base64Binary isn't allowed.. */ @org.junit.Test public void kSeqExprCast576() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:decimal as source type and xs:base64Binary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast577() { final XQuery query = new XQuery( "not(xs:decimal(\"10.01\") castable as xs:base64Binary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:decimal to xs:hexBinary isn't allowed.. */ @org.junit.Test public void kSeqExprCast578() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:decimal as source type and xs:hexBinary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast579() { final XQuery query = new XQuery( "not(xs:decimal(\"10.01\") castable as xs:hexBinary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:untypedAtomic(xs:string(3)) eq '3'`.. */ @org.junit.Test public void kSeqExprCast58() { final XQuery query = new XQuery( "xs:untypedAtomic(xs:string(3)) eq '3'", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:decimal to xs:anyURI isn't allowed.. */ @org.junit.Test public void kSeqExprCast580() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:decimal as source type and xs:anyURI as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast581() { final XQuery query = new XQuery( "not(xs:decimal(\"10.01\") castable as xs:anyURI)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:decimal to xs:QName isn't allowed.. */ @org.junit.Test public void kSeqExprCast582() { final XQuery query = new XQuery( "xs:decimal(\"10.01\") cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:decimal as source type and xs:QName as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast583() { final XQuery query = new XQuery( "not(xs:decimal(\"10.01\") castable as xs:QName)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:decimal as sourceType and xs:NOTATION should fail due to it involving xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast584() { final XQuery query = new XQuery( "not(xs:decimal(\"10.01\") castable as xs:NOTATION)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * The xs:integer constructor function must be passed exactly one argument, not zero.. */ @org.junit.Test public void kSeqExprCast585() { final XQuery query = new XQuery( "xs:integer()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * The xs:integer constructor function must be passed exactly one argument, not two.. */ @org.junit.Test public void kSeqExprCast586() { final XQuery query = new XQuery( "xs:integer( \"6789\" , \"6789\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Verify with 'instance of' that the xs:integer constructor function produces values of the correct type. * The subsequence() function makes it more difficult for optimizers to take short cuts based on static type information.. */ @org.junit.Test public void kSeqExprCast587() { final XQuery query = new XQuery( "subsequence((\"dummy\", 1.1, xs:integer(\"6789\")), 3, 1) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A simple test exercising the whitespace facet for type xs:integer.. */ @org.junit.Test public void kSeqExprCast588() { final XQuery query = new XQuery( "xs:integer(\" 6789 \") eq xs:integer(\" 6789 \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An empty string is not a valid lexical representation of xs:integer.. */ @org.junit.Test public void kSeqExprCast589() { final XQuery query = new XQuery( "xs:integer(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `xs:untypedAtomic(xs:integer(3)) eq '3'`.. */ @org.junit.Test public void kSeqExprCast59() { final XQuery query = new XQuery( "xs:untypedAtomic(xs:integer(3)) eq '3'", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Cast a simple xs:untypedAtomic value to "6789" .. */ @org.junit.Test public void kSeqExprCast590() { final XQuery query = new XQuery( "xs:integer(xs:untypedAtomic( \"6789\" )) eq xs:integer(\"6789\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Applying fn:boolean() to a value of type xs:integer that has the lexical value ' "6789" ' should result in the boolean value true.. */ @org.junit.Test public void kSeqExprCast591() { final XQuery query = new XQuery( "boolean(xs:integer(\"6789\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:integer to xs:untypedAtomic is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast592() { final XQuery query = new XQuery( "xs:integer(\"6789\") cast as xs:untypedAtomic ne xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:integer as source type and xs:untypedAtomic as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast593() { final XQuery query = new XQuery( "xs:integer(\"6789\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:integer to xs:string is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast594() { final XQuery query = new XQuery( "xs:integer(\"6789\") cast as xs:string ne xs:string(\"an arbitrary string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:integer as source type and xs:string as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast595() { final XQuery query = new XQuery( "xs:integer(\"6789\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:integer to xs:float is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast596() { final XQuery query = new XQuery( "xs:integer(\"6789\") cast as xs:float ne xs:float(\"3.4e5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:integer as source type and xs:float as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast597() { final XQuery query = new XQuery( "xs:integer(\"6789\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:integer to xs:double is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast598() { final XQuery query = new XQuery( "xs:integer(\"6789\") cast as xs:double ne xs:double(\"3.3e3\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:integer as source type and xs:double as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast599() { final XQuery query = new XQuery( "xs:integer(\"6789\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'cast as' where the type is invalid.. */ @org.junit.Test public void kSeqExprCast5a() { final XQuery query = new XQuery( "'string' cast as xs:untyped", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0052") ); } /** * 'cast as' where the type is invalid.. */ @org.junit.Test public void kSeqExprCast6() { final XQuery query = new XQuery( "'string' cast as xs:anyAtomicType", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * A test whose essence is: `xs:untypedAtomic(xs:decimal(3)) eq '3'`.. */ @org.junit.Test public void kSeqExprCast60() { final XQuery query = new XQuery( "xs:untypedAtomic(xs:decimal(3)) eq '3'", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:integer to xs:decimal is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast600() { final XQuery query = new XQuery( "xs:integer(\"6789\") cast as xs:decimal ne xs:decimal(\"10.01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:integer as source type and xs:decimal as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast601() { final XQuery query = new XQuery( "xs:integer(\"6789\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:integer to xs:integer is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast602() { final XQuery query = new XQuery( "xs:integer(\"6789\") cast as xs:integer eq xs:integer(\"6789\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:integer as source type and xs:integer as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast603() { final XQuery query = new XQuery( "xs:integer(\"6789\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:integer to xs:duration isn't allowed.. */ @org.junit.Test public void kSeqExprCast604() { final XQuery query = new XQuery( "xs:integer(\"6789\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:integer as source type and xs:duration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast605() { final XQuery query = new XQuery( "not(xs:integer(\"6789\") castable as xs:duration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:integer to xs:yearMonthDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast606() { final XQuery query = new XQuery( "xs:integer(\"6789\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:integer as source type and xs:yearMonthDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast607() { final XQuery query = new XQuery( "not(xs:integer(\"6789\") castable as xs:yearMonthDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:integer to xs:dayTimeDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast608() { final XQuery query = new XQuery( "xs:integer(\"6789\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:integer as source type and xs:dayTimeDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast609() { final XQuery query = new XQuery( "not(xs:integer(\"6789\") castable as xs:dayTimeDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting to xs:notation is not allowed.. */ @org.junit.Test public void kSeqExprCast61() { final XQuery query = new XQuery( "\"notation is abstract\" cast as xs:NOTATION", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * Casting from xs:integer to xs:dateTime isn't allowed.. */ @org.junit.Test public void kSeqExprCast610() { final XQuery query = new XQuery( "xs:integer(\"6789\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:integer as source type and xs:dateTime as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast611() { final XQuery query = new XQuery( "not(xs:integer(\"6789\") castable as xs:dateTime)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:integer to xs:time isn't allowed.. */ @org.junit.Test public void kSeqExprCast612() { final XQuery query = new XQuery( "xs:integer(\"6789\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:integer as source type and xs:time as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast613() { final XQuery query = new XQuery( "not(xs:integer(\"6789\") castable as xs:time)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:integer to xs:date isn't allowed.. */ @org.junit.Test public void kSeqExprCast614() { final XQuery query = new XQuery( "xs:integer(\"6789\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:integer as source type and xs:date as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast615() { final XQuery query = new XQuery( "not(xs:integer(\"6789\") castable as xs:date)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:integer to xs:gYearMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast616() { final XQuery query = new XQuery( "xs:integer(\"6789\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:integer as source type and xs:gYearMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast617() { final XQuery query = new XQuery( "not(xs:integer(\"6789\") castable as xs:gYearMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:integer to xs:gYear isn't allowed.. */ @org.junit.Test public void kSeqExprCast618() { final XQuery query = new XQuery( "xs:integer(\"6789\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:integer as source type and xs:gYear as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast619() { final XQuery query = new XQuery( "not(xs:integer(\"6789\") castable as xs:gYear)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting to xs:notation is not allowed.. */ @org.junit.Test public void kSeqExprCast62() { final XQuery query = new XQuery( "\"notation is abstract\" cast as xs:NOTATION?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * Casting from xs:integer to xs:gMonthDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast620() { final XQuery query = new XQuery( "xs:integer(\"6789\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:integer as source type and xs:gMonthDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast621() { final XQuery query = new XQuery( "not(xs:integer(\"6789\") castable as xs:gMonthDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:integer to xs:gDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast622() { final XQuery query = new XQuery( "xs:integer(\"6789\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:integer as source type and xs:gDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast623() { final XQuery query = new XQuery( "not(xs:integer(\"6789\") castable as xs:gDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:integer to xs:gMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast624() { final XQuery query = new XQuery( "xs:integer(\"6789\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:integer as source type and xs:gMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast625() { final XQuery query = new XQuery( "not(xs:integer(\"6789\") castable as xs:gMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:integer to xs:boolean is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast626() { final XQuery query = new XQuery( "xs:integer(\"6789\") cast as xs:boolean eq xs:boolean(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:integer as source type and xs:boolean as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast627() { final XQuery query = new XQuery( "xs:integer(\"6789\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:integer to xs:base64Binary isn't allowed.. */ @org.junit.Test public void kSeqExprCast628() { final XQuery query = new XQuery( "xs:integer(\"6789\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:integer as source type and xs:base64Binary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast629() { final XQuery query = new XQuery( "not(xs:integer(\"6789\") castable as xs:base64Binary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting to xs:notation is not allowed.. */ @org.junit.Test public void kSeqExprCast63() { final XQuery query = new XQuery( "() cast as xs:NOTATION?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0080") || error("XPST0005") ) ); } /** * Casting from xs:integer to xs:hexBinary isn't allowed.. */ @org.junit.Test public void kSeqExprCast630() { final XQuery query = new XQuery( "xs:integer(\"6789\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:integer as source type and xs:hexBinary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast631() { final XQuery query = new XQuery( "not(xs:integer(\"6789\") castable as xs:hexBinary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:integer to xs:anyURI isn't allowed.. */ @org.junit.Test public void kSeqExprCast632() { final XQuery query = new XQuery( "xs:integer(\"6789\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:integer as source type and xs:anyURI as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast633() { final XQuery query = new XQuery( "not(xs:integer(\"6789\") castable as xs:anyURI)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:integer to xs:QName isn't allowed.. */ @org.junit.Test public void kSeqExprCast634() { final XQuery query = new XQuery( "xs:integer(\"6789\") cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:integer as source type and xs:QName as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast635() { final XQuery query = new XQuery( "not(xs:integer(\"6789\") castable as xs:QName)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:integer as sourceType and xs:NOTATION should fail due to it involving xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast636() { final XQuery query = new XQuery( "not(xs:integer(\"6789\") castable as xs:NOTATION)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * The xs:duration constructor function must be passed exactly one argument, not zero.. */ @org.junit.Test public void kSeqExprCast637() { final XQuery query = new XQuery( "xs:duration()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * The xs:duration constructor function must be passed exactly one argument, not two.. */ @org.junit.Test public void kSeqExprCast638() { final XQuery query = new XQuery( "xs:duration( \"P1Y2M3DT10H30M\" , \"P1Y2M3DT10H30M\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Verify with 'instance of' that the xs:duration constructor function produces values of the correct type. * The subsequence() function makes it more difficult for optimizers to take short cuts based on static type information.. */ @org.junit.Test public void kSeqExprCast639() { final XQuery query = new XQuery( "subsequence((\"dummy\", 1.1, xs:duration(\"P1Y2M3DT10H30M\")), 3, 1) instance of xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting to xs:notation is not allowed.. */ @org.junit.Test public void kSeqExprCast64() { final XQuery query = new XQuery( "() cast as xs:NOTATION", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0080") || error("XPST0005") || error("XPTY0004") ) ); } /** * A simple test exercising the whitespace facet for type xs:duration.. */ @org.junit.Test public void kSeqExprCast640() { final XQuery query = new XQuery( "xs:duration(\" P1Y2M3DT10H30M \") eq xs:duration(\" P1Y2M3DT10H30M \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An empty string is not a valid lexical representation of xs:duration.. */ @org.junit.Test public void kSeqExprCast641() { final XQuery query = new XQuery( "xs:duration(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a simple xs:untypedAtomic value to "P1Y2M3DT10H30M" .. */ @org.junit.Test public void kSeqExprCast642() { final XQuery query = new XQuery( "xs:duration(xs:untypedAtomic( \"P1Y2M3DT10H30M\" )) eq xs:duration(\"P1Y2M3DT10H30M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * It is not possible to extract an Effective Boolean Value from the type xs:duration, with the boolean() function.. */ @org.junit.Test public void kSeqExprCast643() { final XQuery query = new XQuery( "boolean(xs:duration(\"P1Y2M3DT10H30M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Casting from xs:duration to xs:untypedAtomic is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast644() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M\") cast as xs:untypedAtomic ne xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:duration as source type and xs:untypedAtomic as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast645() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:duration to xs:string is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast646() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M\") cast as xs:string ne xs:string(\"an arbitrary string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:duration as source type and xs:string as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast647() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:duration to xs:float isn't allowed.. */ @org.junit.Test public void kSeqExprCast648() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:duration as source type and xs:float as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast649() { final XQuery query = new XQuery( "not(xs:duration(\"P1Y2M3DT10H30M\") castable as xs:float)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting to xs:notation is not allowed.. */ @org.junit.Test public void kSeqExprCast65() { final XQuery query = new XQuery( "xs:NOTATION(xs:anyURI('example.com/'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Casting from xs:duration to xs:double isn't allowed.. */ @org.junit.Test public void kSeqExprCast650() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:duration as source type and xs:double as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast651() { final XQuery query = new XQuery( "not(xs:duration(\"P1Y2M3DT10H30M\") castable as xs:double)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:duration to xs:decimal isn't allowed.. */ @org.junit.Test public void kSeqExprCast652() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:duration as source type and xs:decimal as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast653() { final XQuery query = new XQuery( "not(xs:duration(\"P1Y2M3DT10H30M\") castable as xs:decimal)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:duration to xs:integer isn't allowed.. */ @org.junit.Test public void kSeqExprCast654() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:duration as source type and xs:integer as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast655() { final XQuery query = new XQuery( "not(xs:duration(\"P1Y2M3DT10H30M\") castable as xs:integer)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:duration to xs:duration is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast656() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M\") cast as xs:duration eq xs:duration(\"P1Y2M3DT10H30M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:duration as source type and xs:duration as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast657() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:duration to xs:yearMonthDuration is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast658() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M\") cast as xs:yearMonthDuration ne xs:yearMonthDuration(\"P1Y12M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:duration as source type and xs:yearMonthDuration as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast659() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting to xs:notation is not allowed.. */ @org.junit.Test public void kSeqExprCast66() { final XQuery query = new XQuery( "xs:NOTATION(QName('example.com', 'p:foo'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Casting from xs:duration to xs:dayTimeDuration is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast660() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M\") cast as xs:dayTimeDuration ne xs:dayTimeDuration(\"P3DT2H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:duration as source type and xs:dayTimeDuration as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast661() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:duration to xs:dateTime isn't allowed.. */ @org.junit.Test public void kSeqExprCast662() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:duration as source type and xs:dateTime as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast663() { final XQuery query = new XQuery( "not(xs:duration(\"P1Y2M3DT10H30M\") castable as xs:dateTime)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:duration to xs:time isn't allowed.. */ @org.junit.Test public void kSeqExprCast664() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:duration as source type and xs:time as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast665() { final XQuery query = new XQuery( "not(xs:duration(\"P1Y2M3DT10H30M\") castable as xs:time)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:duration to xs:date isn't allowed.. */ @org.junit.Test public void kSeqExprCast666() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:duration as source type and xs:date as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast667() { final XQuery query = new XQuery( "not(xs:duration(\"P1Y2M3DT10H30M\") castable as xs:date)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:duration to xs:gYearMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast668() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:duration as source type and xs:gYearMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast669() { final XQuery query = new XQuery( "not(xs:duration(\"P1Y2M3DT10H30M\") castable as xs:gYearMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting to xs:QName where the cardinality is wrong.. */ @org.junit.Test public void kSeqExprCast67() { final XQuery query = new XQuery( "() cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || error("XPST0005") ) ); } /** * Casting from xs:duration to xs:gYear isn't allowed.. */ @org.junit.Test public void kSeqExprCast670() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:duration as source type and xs:gYear as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast671() { final XQuery query = new XQuery( "not(xs:duration(\"P1Y2M3DT10H30M\") castable as xs:gYear)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:duration to xs:gMonthDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast672() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:duration as source type and xs:gMonthDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast673() { final XQuery query = new XQuery( "not(xs:duration(\"P1Y2M3DT10H30M\") castable as xs:gMonthDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:duration to xs:gDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast674() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:duration as source type and xs:gDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast675() { final XQuery query = new XQuery( "not(xs:duration(\"P1Y2M3DT10H30M\") castable as xs:gDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:duration to xs:gMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast676() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:duration as source type and xs:gMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast677() { final XQuery query = new XQuery( "not(xs:duration(\"P1Y2M3DT10H30M\") castable as xs:gMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:duration to xs:boolean isn't allowed.. */ @org.junit.Test public void kSeqExprCast678() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:duration as source type and xs:boolean as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast679() { final XQuery query = new XQuery( "not(xs:duration(\"P1Y2M3DT10H30M\") castable as xs:boolean)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Input when casting to xs:QName must be a string literal.. */ @org.junit.Test public void kSeqExprCast68() { final XQuery query = new XQuery( "3 cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Casting from xs:duration to xs:base64Binary isn't allowed.. */ @org.junit.Test public void kSeqExprCast680() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:duration as source type and xs:base64Binary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast681() { final XQuery query = new XQuery( "not(xs:duration(\"P1Y2M3DT10H30M\") castable as xs:base64Binary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:duration to xs:hexBinary isn't allowed.. */ @org.junit.Test public void kSeqExprCast682() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:duration as source type and xs:hexBinary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast683() { final XQuery query = new XQuery( "not(xs:duration(\"P1Y2M3DT10H30M\") castable as xs:hexBinary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:duration to xs:anyURI isn't allowed.. */ @org.junit.Test public void kSeqExprCast684() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:duration as source type and xs:anyURI as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast685() { final XQuery query = new XQuery( "not(xs:duration(\"P1Y2M3DT10H30M\") castable as xs:anyURI)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:duration to xs:QName isn't allowed.. */ @org.junit.Test public void kSeqExprCast686() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M\") cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:duration as source type and xs:QName as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast687() { final XQuery query = new XQuery( "not(xs:duration(\"P1Y2M3DT10H30M\") castable as xs:QName)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:duration as sourceType and xs:NOTATION should fail due to it involving xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast688() { final XQuery query = new XQuery( "not(xs:duration(\"P1Y2M3DT10H30M\") castable as xs:NOTATION)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * The xs:yearMonthDuration constructor function must be passed exactly one argument, not zero.. */ @org.junit.Test public void kSeqExprCast689() { final XQuery query = new XQuery( "xs:yearMonthDuration()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Input when casting to xs:QName must be a string literal.. */ @org.junit.Test public void kSeqExprCast69() { final XQuery query = new XQuery( ". cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || error("XPDY0002") ) ); } /** * The xs:yearMonthDuration constructor function must be passed exactly one argument, not two.. */ @org.junit.Test public void kSeqExprCast690() { final XQuery query = new XQuery( "xs:yearMonthDuration( \"P1Y12M\" , \"P1Y12M\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Verify with 'instance of' that the xs:yearMonthDuration constructor function produces values of the correct type. * The subsequence() function makes it more difficult for optimizers to take short cuts based on static type information.. */ @org.junit.Test public void kSeqExprCast691() { final XQuery query = new XQuery( "subsequence((\"dummy\", 1.1, xs:yearMonthDuration(\"P1Y12M\")), 3, 1) instance of xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A simple test exercising the whitespace facet for type xs:yearMonthDuration.. */ @org.junit.Test public void kSeqExprCast692() { final XQuery query = new XQuery( "xs:yearMonthDuration(\" P1Y12M \") eq xs:yearMonthDuration(\" P1Y12M \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An empty string is not a valid lexical representation of xs:yearMonthDuration.. */ @org.junit.Test public void kSeqExprCast693() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a simple xs:untypedAtomic value to "P1Y12M" .. */ @org.junit.Test public void kSeqExprCast694() { final XQuery query = new XQuery( "xs:yearMonthDuration(xs:untypedAtomic( \"P1Y12M\" )) eq xs:yearMonthDuration(\"P1Y12M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * It is not possible to extract an Effective Boolean Value from the type xs:yearMonthDuration, with the boolean() function.. */ @org.junit.Test public void kSeqExprCast695() { final XQuery query = new XQuery( "boolean(xs:yearMonthDuration(\"P1Y12M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Casting from xs:yearMonthDuration to xs:untypedAtomic is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast696() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") cast as xs:untypedAtomic ne xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:yearMonthDuration as source type and xs:untypedAtomic as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast697() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:yearMonthDuration to xs:string is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast698() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") cast as xs:string ne xs:string(\"an arbitrary string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:yearMonthDuration as source type and xs:string as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast699() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'cast as' where the type is invalid.. */ @org.junit.Test public void kSeqExprCast7() { xquery10(); final XQuery query = new XQuery( "'string' cast as xs:anyType", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0051") ); } /** * Casting a xs:QName value to xs:QName is possible.. */ @org.junit.Test public void kSeqExprCast70() { final XQuery query = new XQuery( "(xs:QName(\"local-name\") cast as xs:QName) eq xs:QName(\"local-name\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:yearMonthDuration to xs:float isn't allowed.. */ @org.junit.Test public void kSeqExprCast700() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:yearMonthDuration as source type and xs:float as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast701() { final XQuery query = new XQuery( "not(xs:yearMonthDuration(\"P1Y12M\") castable as xs:float)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:yearMonthDuration to xs:double isn't allowed.. */ @org.junit.Test public void kSeqExprCast702() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:yearMonthDuration as source type and xs:double as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast703() { final XQuery query = new XQuery( "not(xs:yearMonthDuration(\"P1Y12M\") castable as xs:double)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:yearMonthDuration to xs:decimal isn't allowed.. */ @org.junit.Test public void kSeqExprCast704() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:yearMonthDuration as source type and xs:decimal as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast705() { final XQuery query = new XQuery( "not(xs:yearMonthDuration(\"P1Y12M\") castable as xs:decimal)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:yearMonthDuration to xs:integer isn't allowed.. */ @org.junit.Test public void kSeqExprCast706() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:yearMonthDuration as source type and xs:integer as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast707() { final XQuery query = new XQuery( "not(xs:yearMonthDuration(\"P1Y12M\") castable as xs:integer)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:yearMonthDuration to xs:duration is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast708() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") cast as xs:duration ne xs:duration(\"P1Y2M3DT10H30M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:yearMonthDuration as source type and xs:duration as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast709() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:yearMonthDuration to xs:yearMonthDuration is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast710() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") cast as xs:yearMonthDuration eq xs:yearMonthDuration(\"P1Y12M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:yearMonthDuration as source type and xs:yearMonthDuration as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast711() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:yearMonthDuration to xs:dayTimeDuration is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast712() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") cast as xs:dayTimeDuration ne xs:dayTimeDuration(\"P3DT2H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:yearMonthDuration as source type and xs:dayTimeDuration as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast713() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:yearMonthDuration to xs:dateTime isn't allowed.. */ @org.junit.Test public void kSeqExprCast714() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:yearMonthDuration as source type and xs:dateTime as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast715() { final XQuery query = new XQuery( "not(xs:yearMonthDuration(\"P1Y12M\") castable as xs:dateTime)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:yearMonthDuration to xs:time isn't allowed.. */ @org.junit.Test public void kSeqExprCast716() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:yearMonthDuration as source type and xs:time as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast717() { final XQuery query = new XQuery( "not(xs:yearMonthDuration(\"P1Y12M\") castable as xs:time)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:yearMonthDuration to xs:date isn't allowed.. */ @org.junit.Test public void kSeqExprCast718() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:yearMonthDuration as source type and xs:date as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast719() { final XQuery query = new XQuery( "not(xs:yearMonthDuration(\"P1Y12M\") castable as xs:date)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting xs:untypedAtomic to xs:QName is an error.. */ @org.junit.Test public void kSeqExprCast71a() { xquery10(); final XQuery query = new XQuery( "xs:untypedAtomic(\"ncname\") cast as xs:QName?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Casting xs:untypedAtomic to xs:QName is an error.. */ @org.junit.Test public void kSeqExprCast71b() { final XQuery query = new XQuery( "xs:untypedAtomic(\"ncname\") cast as xs:QName?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ncname") ); } /** * A test whose essence is: `"example.com/" cast as xs:anyURI eq xs:anyURI('example.com/')`.. */ @org.junit.Test public void kSeqExprCast72() { final XQuery query = new XQuery( "\"example.com/\" cast as xs:anyURI eq xs:anyURI('example.com/')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:yearMonthDuration to xs:gYearMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast720() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:yearMonthDuration as source type and xs:gYearMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast721() { final XQuery query = new XQuery( "not(xs:yearMonthDuration(\"P1Y12M\") castable as xs:gYearMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:yearMonthDuration to xs:gYear isn't allowed.. */ @org.junit.Test public void kSeqExprCast722() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:yearMonthDuration as source type and xs:gYear as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast723() { final XQuery query = new XQuery( "not(xs:yearMonthDuration(\"P1Y12M\") castable as xs:gYear)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:yearMonthDuration to xs:gMonthDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast724() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:yearMonthDuration as source type and xs:gMonthDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast725() { final XQuery query = new XQuery( "not(xs:yearMonthDuration(\"P1Y12M\") castable as xs:gMonthDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:yearMonthDuration to xs:gDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast726() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:yearMonthDuration as source type and xs:gDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast727() { final XQuery query = new XQuery( "not(xs:yearMonthDuration(\"P1Y12M\") castable as xs:gDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:yearMonthDuration to xs:gMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast728() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:yearMonthDuration as source type and xs:gMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast729() { final XQuery query = new XQuery( "not(xs:yearMonthDuration(\"P1Y12M\") castable as xs:gMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:untypedAtomic("example.com/") cast as xs:anyURI eq xs:anyURI('example.com/')`.. */ @org.junit.Test public void kSeqExprCast73() { final XQuery query = new XQuery( "xs:untypedAtomic(\"example.com/\") cast as xs:anyURI eq xs:anyURI('example.com/')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:yearMonthDuration to xs:boolean isn't allowed.. */ @org.junit.Test public void kSeqExprCast730() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:yearMonthDuration as source type and xs:boolean as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast731() { final XQuery query = new XQuery( "not(xs:yearMonthDuration(\"P1Y12M\") castable as xs:boolean)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:yearMonthDuration to xs:base64Binary isn't allowed.. */ @org.junit.Test public void kSeqExprCast732() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:yearMonthDuration as source type and xs:base64Binary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast733() { final XQuery query = new XQuery( "not(xs:yearMonthDuration(\"P1Y12M\") castable as xs:base64Binary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:yearMonthDuration to xs:hexBinary isn't allowed.. */ @org.junit.Test public void kSeqExprCast734() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:yearMonthDuration as source type and xs:hexBinary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast735() { final XQuery query = new XQuery( "not(xs:yearMonthDuration(\"P1Y12M\") castable as xs:hexBinary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:yearMonthDuration to xs:anyURI isn't allowed.. */ @org.junit.Test public void kSeqExprCast736() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:yearMonthDuration as source type and xs:anyURI as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast737() { final XQuery query = new XQuery( "not(xs:yearMonthDuration(\"P1Y12M\") castable as xs:anyURI)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:yearMonthDuration to xs:QName isn't allowed.. */ @org.junit.Test public void kSeqExprCast738() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y12M\") cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:yearMonthDuration as source type and xs:QName as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast739() { final XQuery query = new XQuery( "not(xs:yearMonthDuration(\"P1Y12M\") castable as xs:QName)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:anyURI("example.com/") cast as xs:anyURI eq xs:anyURI('example.com/')`.. */ @org.junit.Test public void kSeqExprCast74() { final XQuery query = new XQuery( "xs:anyURI(\"example.com/\") cast as xs:anyURI eq xs:anyURI('example.com/')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:yearMonthDuration as sourceType and xs:NOTATION should fail due to it involving xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast740() { final XQuery query = new XQuery( "not(xs:yearMonthDuration(\"P1Y12M\") castable as xs:NOTATION)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * The xs:dayTimeDuration constructor function must be passed exactly one argument, not zero.. */ @org.junit.Test public void kSeqExprCast741() { final XQuery query = new XQuery( "xs:dayTimeDuration()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * The xs:dayTimeDuration constructor function must be passed exactly one argument, not two.. */ @org.junit.Test public void kSeqExprCast742() { final XQuery query = new XQuery( "xs:dayTimeDuration( \"P3DT2H\" , \"P3DT2H\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Verify with 'instance of' that the xs:dayTimeDuration constructor function produces values of the correct type. * The subsequence() function makes it more difficult for optimizers to take short cuts based on static type information.. */ @org.junit.Test public void kSeqExprCast743() { final XQuery query = new XQuery( "subsequence((\"dummy\", 1.1, xs:dayTimeDuration(\"P3DT2H\")), 3, 1) instance of xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A simple test exercising the whitespace facet for type xs:dayTimeDuration.. */ @org.junit.Test public void kSeqExprCast744() { final XQuery query = new XQuery( "xs:dayTimeDuration(\" P3DT2H \") eq xs:dayTimeDuration(\" P3DT2H \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An empty string is not a valid lexical representation of xs:dayTimeDuration.. */ @org.junit.Test public void kSeqExprCast745() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a simple xs:untypedAtomic value to "P3DT2H" .. */ @org.junit.Test public void kSeqExprCast746() { final XQuery query = new XQuery( "xs:dayTimeDuration(xs:untypedAtomic( \"P3DT2H\" )) eq xs:dayTimeDuration(\"P3DT2H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * It is not possible to extract an Effective Boolean Value from the type xs:dayTimeDuration, with the boolean() function.. */ @org.junit.Test public void kSeqExprCast747() { final XQuery query = new XQuery( "boolean(xs:dayTimeDuration(\"P3DT2H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Casting from xs:dayTimeDuration to xs:untypedAtomic is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast748() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT2H\") cast as xs:untypedAtomic ne xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:dayTimeDuration as source type and xs:untypedAtomic as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast749() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT2H\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:double(3) eq 3`.. */ @org.junit.Test public void kSeqExprCast75() { final XQuery query = new XQuery( "xs:double(3) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dayTimeDuration to xs:string is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast750() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT2H\") cast as xs:string ne xs:string(\"an arbitrary string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:dayTimeDuration as source type and xs:string as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast751() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT2H\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dayTimeDuration to xs:float isn't allowed.. */ @org.junit.Test public void kSeqExprCast752() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT2H\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dayTimeDuration as source type and xs:float as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast753() { final XQuery query = new XQuery( "not(xs:dayTimeDuration(\"P3DT2H\") castable as xs:float)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dayTimeDuration to xs:double isn't allowed.. */ @org.junit.Test public void kSeqExprCast754() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT2H\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dayTimeDuration as source type and xs:double as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast755() { final XQuery query = new XQuery( "not(xs:dayTimeDuration(\"P3DT2H\") castable as xs:double)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dayTimeDuration to xs:decimal isn't allowed.. */ @org.junit.Test public void kSeqExprCast756() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT2H\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dayTimeDuration as source type and xs:decimal as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast757() { final XQuery query = new XQuery( "not(xs:dayTimeDuration(\"P3DT2H\") castable as xs:decimal)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dayTimeDuration to xs:integer isn't allowed.. */ @org.junit.Test public void kSeqExprCast758() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT2H\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dayTimeDuration as source type and xs:integer as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast759() { final XQuery query = new XQuery( "not(xs:dayTimeDuration(\"P3DT2H\") castable as xs:integer)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:double(3.1) eq 3.1`.. */ @org.junit.Test public void kSeqExprCast76() { final XQuery query = new XQuery( "xs:double(3.1) eq 3.1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dayTimeDuration to xs:duration is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast760() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT2H\") cast as xs:duration ne xs:duration(\"P1Y2M3DT10H30M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:dayTimeDuration as source type and xs:duration as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast761() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT2H\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dayTimeDuration to xs:yearMonthDuration is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast762() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT2H\") cast as xs:yearMonthDuration ne xs:yearMonthDuration(\"P1Y12M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:dayTimeDuration as source type and xs:yearMonthDuration as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast763() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT2H\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dayTimeDuration to xs:dayTimeDuration is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast764() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT2H\") cast as xs:dayTimeDuration eq xs:dayTimeDuration(\"P3DT2H\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:dayTimeDuration as source type and xs:dayTimeDuration as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast765() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT2H\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dayTimeDuration to xs:dateTime isn't allowed.. */ @org.junit.Test public void kSeqExprCast766() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT2H\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dayTimeDuration as source type and xs:dateTime as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast767() { final XQuery query = new XQuery( "not(xs:dayTimeDuration(\"P3DT2H\") castable as xs:dateTime)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dayTimeDuration to xs:time isn't allowed.. */ @org.junit.Test public void kSeqExprCast768() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT2H\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dayTimeDuration as source type and xs:time as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast769() { final XQuery query = new XQuery( "not(xs:dayTimeDuration(\"P3DT2H\") castable as xs:time)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:double(6) instance of xs:double`.. */ @org.junit.Test public void kSeqExprCast77() { final XQuery query = new XQuery( "xs:double(6) instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dayTimeDuration to xs:date isn't allowed.. */ @org.junit.Test public void kSeqExprCast770() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT2H\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dayTimeDuration as source type and xs:date as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast771() { final XQuery query = new XQuery( "not(xs:dayTimeDuration(\"P3DT2H\") castable as xs:date)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dayTimeDuration to xs:gYearMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast772() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT2H\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dayTimeDuration as source type and xs:gYearMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast773() { final XQuery query = new XQuery( "not(xs:dayTimeDuration(\"P3DT2H\") castable as xs:gYearMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dayTimeDuration to xs:gYear isn't allowed.. */ @org.junit.Test public void kSeqExprCast774() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT2H\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dayTimeDuration as source type and xs:gYear as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast775() { final XQuery query = new XQuery( "not(xs:dayTimeDuration(\"P3DT2H\") castable as xs:gYear)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dayTimeDuration to xs:gMonthDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast776() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT2H\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dayTimeDuration as source type and xs:gMonthDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast777() { final XQuery query = new XQuery( "not(xs:dayTimeDuration(\"P3DT2H\") castable as xs:gMonthDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dayTimeDuration to xs:gDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast778() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT2H\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dayTimeDuration as source type and xs:gDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast779() { final XQuery query = new XQuery( "not(xs:dayTimeDuration(\"P3DT2H\") castable as xs:gDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:double("INF")) eq "INF"`.. */ @org.junit.Test public void kSeqExprCast78() { final XQuery query = new XQuery( "xs:string(xs:double(\"INF\")) eq \"INF\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dayTimeDuration to xs:gMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast780() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT2H\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dayTimeDuration as source type and xs:gMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast781() { final XQuery query = new XQuery( "not(xs:dayTimeDuration(\"P3DT2H\") castable as xs:gMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dayTimeDuration to xs:boolean isn't allowed.. */ @org.junit.Test public void kSeqExprCast782() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT2H\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dayTimeDuration as source type and xs:boolean as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast783() { final XQuery query = new XQuery( "not(xs:dayTimeDuration(\"P3DT2H\") castable as xs:boolean)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dayTimeDuration to xs:base64Binary isn't allowed.. */ @org.junit.Test public void kSeqExprCast784() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT2H\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dayTimeDuration as source type and xs:base64Binary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast785() { final XQuery query = new XQuery( "not(xs:dayTimeDuration(\"P3DT2H\") castable as xs:base64Binary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dayTimeDuration to xs:hexBinary isn't allowed.. */ @org.junit.Test public void kSeqExprCast786() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT2H\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dayTimeDuration as source type and xs:hexBinary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast787() { final XQuery query = new XQuery( "not(xs:dayTimeDuration(\"P3DT2H\") castable as xs:hexBinary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dayTimeDuration to xs:anyURI isn't allowed.. */ @org.junit.Test public void kSeqExprCast788() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT2H\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dayTimeDuration as source type and xs:anyURI as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast789() { final XQuery query = new XQuery( "not(xs:dayTimeDuration(\"P3DT2H\") castable as xs:anyURI)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:double("-INF")) eq "-INF"`.. */ @org.junit.Test public void kSeqExprCast79() { final XQuery query = new XQuery( "xs:string(xs:double(\"-INF\")) eq \"-INF\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dayTimeDuration to xs:QName isn't allowed.. */ @org.junit.Test public void kSeqExprCast790() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT2H\") cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dayTimeDuration as source type and xs:QName as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast791() { final XQuery query = new XQuery( "not(xs:dayTimeDuration(\"P3DT2H\") castable as xs:QName)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:dayTimeDuration as sourceType and xs:NOTATION should fail due to it involving xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast792() { final XQuery query = new XQuery( "not(xs:dayTimeDuration(\"P3DT2H\") castable as xs:NOTATION)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * The xs:dateTime constructor function must be passed exactly one argument, not zero.. */ @org.junit.Test public void kSeqExprCast793() { final XQuery query = new XQuery( "xs:dateTime()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * The xs:dateTime constructor function must be passed exactly one argument, not two.. */ @org.junit.Test public void kSeqExprCast794() { final XQuery query = new XQuery( "xs:dateTime( \"2002-10-10T12:00:00-05:00\" , \"2002-10-10T12:00:00-05:00\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Verify with 'instance of' that the xs:dateTime constructor function produces values of the correct type. * The subsequence() function makes it more difficult for optimizers to take short cuts based on static type information.. */ @org.junit.Test public void kSeqExprCast795() { final XQuery query = new XQuery( "subsequence((\"dummy\", 1.1, xs:dateTime(\"2002-10-10T12:00:00-05:00\")), 3, 1) instance of xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A simple test exercising the whitespace facet for type xs:dateTime.. */ @org.junit.Test public void kSeqExprCast796() { final XQuery query = new XQuery( "xs:dateTime(\" 2002-10-10T12:00:00-05:00 \") eq xs:dateTime(\" 2002-10-10T12:00:00-05:00 \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An empty string is not a valid lexical representation of xs:dateTime.. */ @org.junit.Test public void kSeqExprCast797() { final XQuery query = new XQuery( "xs:dateTime(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a simple xs:untypedAtomic value to "2002-10-10T12:00:00-05:00" .. */ @org.junit.Test public void kSeqExprCast798() { final XQuery query = new XQuery( "xs:dateTime(xs:untypedAtomic( \"2002-10-10T12:00:00-05:00\" )) eq xs:dateTime(\"2002-10-10T12:00:00-05:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * It is not possible to extract an Effective Boolean Value from the type xs:dateTime, with the boolean() function.. */ @org.junit.Test public void kSeqExprCast799() { final XQuery query = new XQuery( "boolean(xs:dateTime(\"2002-10-10T12:00:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * 'cast as' where the type is invalid.. */ @org.junit.Test public void kSeqExprCast7a() { final XQuery query = new XQuery( "'string' cast as xs:anyType", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0052") ); } /** * A prefix is used which isn't declared.. */ @org.junit.Test public void kSeqExprCast8() { final XQuery query = new XQuery( "3 cast as prefixDoesNotExist:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0081") ); } /** * A test whose essence is: `xs:float(3) eq 3`.. */ @org.junit.Test public void kSeqExprCast80() { final XQuery query = new XQuery( "xs:float(3) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dateTime to xs:untypedAtomic is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast800() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") cast as xs:untypedAtomic ne xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:dateTime as source type and xs:untypedAtomic as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast801() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dateTime to xs:string is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast802() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") cast as xs:string ne xs:string(\"an arbitrary string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:dateTime as source type and xs:string as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast803() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dateTime to xs:float isn't allowed.. */ @org.junit.Test public void kSeqExprCast804() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dateTime as source type and xs:float as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast805() { final XQuery query = new XQuery( "not(xs:dateTime(\"2002-10-10T12:00:00-05:00\") castable as xs:float)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dateTime to xs:double isn't allowed.. */ @org.junit.Test public void kSeqExprCast806() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dateTime as source type and xs:double as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast807() { final XQuery query = new XQuery( "not(xs:dateTime(\"2002-10-10T12:00:00-05:00\") castable as xs:double)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dateTime to xs:decimal isn't allowed.. */ @org.junit.Test public void kSeqExprCast808() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dateTime as source type and xs:decimal as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast809() { final XQuery query = new XQuery( "not(xs:dateTime(\"2002-10-10T12:00:00-05:00\") castable as xs:decimal)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:float(3.1) eq 3.1`.. */ @org.junit.Test public void kSeqExprCast81() { final XQuery query = new XQuery( "xs:float(3.1) eq 3.1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dateTime to xs:integer isn't allowed.. */ @org.junit.Test public void kSeqExprCast810() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dateTime as source type and xs:integer as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast811() { final XQuery query = new XQuery( "not(xs:dateTime(\"2002-10-10T12:00:00-05:00\") castable as xs:integer)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dateTime to xs:duration isn't allowed.. */ @org.junit.Test public void kSeqExprCast812() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dateTime as source type and xs:duration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast813() { final XQuery query = new XQuery( "not(xs:dateTime(\"2002-10-10T12:00:00-05:00\") castable as xs:duration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dateTime to xs:yearMonthDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast814() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dateTime as source type and xs:yearMonthDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast815() { final XQuery query = new XQuery( "not(xs:dateTime(\"2002-10-10T12:00:00-05:00\") castable as xs:yearMonthDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dateTime to xs:dayTimeDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast816() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dateTime as source type and xs:dayTimeDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast817() { final XQuery query = new XQuery( "not(xs:dateTime(\"2002-10-10T12:00:00-05:00\") castable as xs:dayTimeDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dateTime to xs:dateTime is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast818() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") cast as xs:dateTime eq xs:dateTime(\"2002-10-10T12:00:00-05:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:dateTime as source type and xs:dateTime as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast819() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:float(6) instance of xs:float`.. */ @org.junit.Test public void kSeqExprCast82() { final XQuery query = new XQuery( "xs:float(6) instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dateTime to xs:time is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast820() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") cast as xs:time ne xs:time(\"03:20:00-05:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:dateTime as source type and xs:time as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast821() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dateTime to xs:date is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast822() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") cast as xs:date ne xs:date(\"2004-10-13\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:dateTime as source type and xs:date as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast823() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dateTime to xs:gYearMonth is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast824() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") cast as xs:gYearMonth ne xs:gYearMonth(\"1999-11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:dateTime as source type and xs:gYearMonth as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast825() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dateTime to xs:gYear is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast826() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") cast as xs:gYear ne xs:gYear(\"1999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:dateTime as source type and xs:gYear as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast827() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dateTime to xs:gMonthDay is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast828() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") cast as xs:gMonthDay ne xs:gMonthDay(\"--11-13\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:dateTime as source type and xs:gMonthDay as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast829() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:float("INF")) eq "INF"`.. */ @org.junit.Test public void kSeqExprCast83() { final XQuery query = new XQuery( "xs:string(xs:float(\"INF\")) eq \"INF\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dateTime to xs:gDay is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast830() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") cast as xs:gDay ne xs:gDay(\"---03\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:dateTime as source type and xs:gDay as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast831() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dateTime to xs:gMonth is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast832() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") cast as xs:gMonth ne xs:gMonth(\"--11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:dateTime as source type and xs:gMonth as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast833() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dateTime to xs:boolean isn't allowed.. */ @org.junit.Test public void kSeqExprCast834() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dateTime as source type and xs:boolean as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast835() { final XQuery query = new XQuery( "not(xs:dateTime(\"2002-10-10T12:00:00-05:00\") castable as xs:boolean)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dateTime to xs:base64Binary isn't allowed.. */ @org.junit.Test public void kSeqExprCast836() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dateTime as source type and xs:base64Binary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast837() { final XQuery query = new XQuery( "not(xs:dateTime(\"2002-10-10T12:00:00-05:00\") castable as xs:base64Binary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dateTime to xs:hexBinary isn't allowed.. */ @org.junit.Test public void kSeqExprCast838() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dateTime as source type and xs:hexBinary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast839() { final XQuery query = new XQuery( "not(xs:dateTime(\"2002-10-10T12:00:00-05:00\") castable as xs:hexBinary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:string(xs:float("-INF")) eq "-INF"`.. */ @org.junit.Test public void kSeqExprCast84() { final XQuery query = new XQuery( "xs:string(xs:float(\"-INF\")) eq \"-INF\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dateTime to xs:anyURI isn't allowed.. */ @org.junit.Test public void kSeqExprCast840() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dateTime as source type and xs:anyURI as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast841() { final XQuery query = new XQuery( "not(xs:dateTime(\"2002-10-10T12:00:00-05:00\") castable as xs:anyURI)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:dateTime to xs:QName isn't allowed.. */ @org.junit.Test public void kSeqExprCast842() { final XQuery query = new XQuery( "xs:dateTime(\"2002-10-10T12:00:00-05:00\") cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:dateTime as source type and xs:QName as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast843() { final XQuery query = new XQuery( "not(xs:dateTime(\"2002-10-10T12:00:00-05:00\") castable as xs:QName)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:dateTime as sourceType and xs:NOTATION should fail due to it involving xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast844() { final XQuery query = new XQuery( "not(xs:dateTime(\"2002-10-10T12:00:00-05:00\") castable as xs:NOTATION)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * The xs:time constructor function must be passed exactly one argument, not zero.. */ @org.junit.Test public void kSeqExprCast845() { final XQuery query = new XQuery( "xs:time()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * The xs:time constructor function must be passed exactly one argument, not two.. */ @org.junit.Test public void kSeqExprCast846() { final XQuery query = new XQuery( "xs:time( \"03:20:00-05:00\" , \"03:20:00-05:00\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Verify with 'instance of' that the xs:time constructor function produces values of the correct type. * The subsequence() function makes it more difficult for optimizers to take short cuts based on static type information.. */ @org.junit.Test public void kSeqExprCast847() { final XQuery query = new XQuery( "subsequence((\"dummy\", 1.1, xs:time(\"03:20:00-05:00\")), 3, 1) instance of xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A simple test exercising the whitespace facet for type xs:time.. */ @org.junit.Test public void kSeqExprCast848() { final XQuery query = new XQuery( "xs:time(\" 03:20:00-05:00 \") eq xs:time(\" 03:20:00-05:00 \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An empty string is not a valid lexical representation of xs:time.. */ @org.junit.Test public void kSeqExprCast849() { final XQuery query = new XQuery( "xs:time(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A test whose essence is: `xs:decimal(3) eq 3`.. */ @org.junit.Test public void kSeqExprCast85() { final XQuery query = new XQuery( "xs:decimal(3) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Cast a simple xs:untypedAtomic value to "03:20:00-05:00" .. */ @org.junit.Test public void kSeqExprCast850() { final XQuery query = new XQuery( "xs:time(xs:untypedAtomic( \"03:20:00-05:00\" )) eq xs:time(\"03:20:00-05:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * It is not possible to extract an Effective Boolean Value from the type xs:time, with the boolean() function.. */ @org.junit.Test public void kSeqExprCast851() { final XQuery query = new XQuery( "boolean(xs:time(\"03:20:00-05:00\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Casting from xs:time to xs:untypedAtomic is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast852() { final XQuery query = new XQuery( "xs:time(\"03:20:00-05:00\") cast as xs:untypedAtomic ne xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:time as source type and xs:untypedAtomic as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast853() { final XQuery query = new XQuery( "xs:time(\"03:20:00-05:00\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:time to xs:string is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast854() { final XQuery query = new XQuery( "xs:time(\"03:20:00-05:00\") cast as xs:string ne xs:string(\"an arbitrary string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:time as source type and xs:string as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast855() { final XQuery query = new XQuery( "xs:time(\"03:20:00-05:00\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:time to xs:float isn't allowed.. */ @org.junit.Test public void kSeqExprCast856() { final XQuery query = new XQuery( "xs:time(\"03:20:00-05:00\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:time as source type and xs:float as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast857() { final XQuery query = new XQuery( "not(xs:time(\"03:20:00-05:00\") castable as xs:float)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:time to xs:double isn't allowed.. */ @org.junit.Test public void kSeqExprCast858() { final XQuery query = new XQuery( "xs:time(\"03:20:00-05:00\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:time as source type and xs:double as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast859() { final XQuery query = new XQuery( "not(xs:time(\"03:20:00-05:00\") castable as xs:double)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:decimal(3.1) eq 3.1`.. */ @org.junit.Test public void kSeqExprCast86() { final XQuery query = new XQuery( "xs:decimal(3.1) eq 3.1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:time to xs:decimal isn't allowed.. */ @org.junit.Test public void kSeqExprCast860() { final XQuery query = new XQuery( "xs:time(\"03:20:00-05:00\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:time as source type and xs:decimal as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast861() { final XQuery query = new XQuery( "not(xs:time(\"03:20:00-05:00\") castable as xs:decimal)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:time to xs:integer isn't allowed.. */ @org.junit.Test public void kSeqExprCast862() { final XQuery query = new XQuery( "xs:time(\"03:20:00-05:00\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:time as source type and xs:integer as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast863() { final XQuery query = new XQuery( "not(xs:time(\"03:20:00-05:00\") castable as xs:integer)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:time to xs:duration isn't allowed.. */ @org.junit.Test public void kSeqExprCast864() { final XQuery query = new XQuery( "xs:time(\"03:20:00-05:00\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:time as source type and xs:duration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast865() { final XQuery query = new XQuery( "not(xs:time(\"03:20:00-05:00\") castable as xs:duration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:time to xs:yearMonthDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast866() { final XQuery query = new XQuery( "xs:time(\"03:20:00-05:00\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:time as source type and xs:yearMonthDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast867() { final XQuery query = new XQuery( "not(xs:time(\"03:20:00-05:00\") castable as xs:yearMonthDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:time to xs:dayTimeDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast868() { final XQuery query = new XQuery( "xs:time(\"03:20:00-05:00\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:time as source type and xs:dayTimeDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast869() { final XQuery query = new XQuery( "not(xs:time(\"03:20:00-05:00\") castable as xs:dayTimeDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:decimal(6) instance of xs:decimal`.. */ @org.junit.Test public void kSeqExprCast87() { final XQuery query = new XQuery( "xs:decimal(6) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:time to xs:dateTime isn't allowed.. */ @org.junit.Test public void kSeqExprCast870() { final XQuery query = new XQuery( "xs:time(\"03:20:00-05:00\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:time as source type and xs:dateTime as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast871() { final XQuery query = new XQuery( "not(xs:time(\"03:20:00-05:00\") castable as xs:dateTime)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:time to xs:time is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast872() { final XQuery query = new XQuery( "xs:time(\"03:20:00-05:00\") cast as xs:time eq xs:time(\"03:20:00-05:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:time as source type and xs:time as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast873() { final XQuery query = new XQuery( "xs:time(\"03:20:00-05:00\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:time to xs:date isn't allowed.. */ @org.junit.Test public void kSeqExprCast874() { final XQuery query = new XQuery( "xs:time(\"03:20:00-05:00\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:time as source type and xs:date as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast875() { final XQuery query = new XQuery( "not(xs:time(\"03:20:00-05:00\") castable as xs:date)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:time to xs:gYearMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast876() { final XQuery query = new XQuery( "xs:time(\"03:20:00-05:00\") cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:time as source type and xs:gYearMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast877() { final XQuery query = new XQuery( "not(xs:time(\"03:20:00-05:00\") castable as xs:gYearMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:time to xs:gYear isn't allowed.. */ @org.junit.Test public void kSeqExprCast878() { final XQuery query = new XQuery( "xs:time(\"03:20:00-05:00\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:time as source type and xs:gYear as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast879() { final XQuery query = new XQuery( "not(xs:time(\"03:20:00-05:00\") castable as xs:gYear)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:integer(3) eq 3`.. */ @org.junit.Test public void kSeqExprCast88() { final XQuery query = new XQuery( "xs:integer(3) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:time to xs:gMonthDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast880() { final XQuery query = new XQuery( "xs:time(\"03:20:00-05:00\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:time as source type and xs:gMonthDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast881() { final XQuery query = new XQuery( "not(xs:time(\"03:20:00-05:00\") castable as xs:gMonthDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:time to xs:gDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast882() { final XQuery query = new XQuery( "xs:time(\"03:20:00-05:00\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:time as source type and xs:gDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast883() { final XQuery query = new XQuery( "not(xs:time(\"03:20:00-05:00\") castable as xs:gDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:time to xs:gMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast884() { final XQuery query = new XQuery( "xs:time(\"03:20:00-05:00\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:time as source type and xs:gMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast885() { final XQuery query = new XQuery( "not(xs:time(\"03:20:00-05:00\") castable as xs:gMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:time to xs:boolean isn't allowed.. */ @org.junit.Test public void kSeqExprCast886() { final XQuery query = new XQuery( "xs:time(\"03:20:00-05:00\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:time as source type and xs:boolean as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast887() { final XQuery query = new XQuery( "not(xs:time(\"03:20:00-05:00\") castable as xs:boolean)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:time to xs:base64Binary isn't allowed.. */ @org.junit.Test public void kSeqExprCast888() { final XQuery query = new XQuery( "xs:time(\"03:20:00-05:00\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:time as source type and xs:base64Binary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast889() { final XQuery query = new XQuery( "not(xs:time(\"03:20:00-05:00\") castable as xs:base64Binary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:integer(3.1) eq 3`.. */ @org.junit.Test public void kSeqExprCast89() { final XQuery query = new XQuery( "xs:integer(3.1) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:time to xs:hexBinary isn't allowed.. */ @org.junit.Test public void kSeqExprCast890() { final XQuery query = new XQuery( "xs:time(\"03:20:00-05:00\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:time as source type and xs:hexBinary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast891() { final XQuery query = new XQuery( "not(xs:time(\"03:20:00-05:00\") castable as xs:hexBinary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:time to xs:anyURI isn't allowed.. */ @org.junit.Test public void kSeqExprCast892() { final XQuery query = new XQuery( "xs:time(\"03:20:00-05:00\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:time as source type and xs:anyURI as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast893() { final XQuery query = new XQuery( "not(xs:time(\"03:20:00-05:00\") castable as xs:anyURI)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:time to xs:QName isn't allowed.. */ @org.junit.Test public void kSeqExprCast894() { final XQuery query = new XQuery( "xs:time(\"03:20:00-05:00\") cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:time as source type and xs:QName as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast895() { final XQuery query = new XQuery( "not(xs:time(\"03:20:00-05:00\") castable as xs:QName)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:time as sourceType and xs:NOTATION should fail due to it involving xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast896() { final XQuery query = new XQuery( "not(xs:time(\"03:20:00-05:00\") castable as xs:NOTATION)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * The xs:date constructor function must be passed exactly one argument, not zero.. */ @org.junit.Test public void kSeqExprCast897() { final XQuery query = new XQuery( "xs:date()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * The xs:date constructor function must be passed exactly one argument, not two.. */ @org.junit.Test public void kSeqExprCast898() { final XQuery query = new XQuery( "xs:date( \"2004-10-13\" , \"2004-10-13\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Verify with 'instance of' that the xs:date constructor function produces values of the correct type. * The subsequence() function makes it more difficult for optimizers to take short cuts based on static type information.. */ @org.junit.Test public void kSeqExprCast899() { final XQuery query = new XQuery( "subsequence((\"dummy\", 1.1, xs:date(\"2004-10-13\")), 3, 1) instance of xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A type is specified which doesn't exist.. */ @org.junit.Test public void kSeqExprCast9() { xquery10(); final XQuery query = new XQuery( "3 cast as xs:doesNotExist", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0051") ); } /** * Test that when casting xs:decimal to xs:integer that conversion happens.. */ @org.junit.Test public void kSeqExprCast90() { final XQuery query = new XQuery( "xs:integer(3.1) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A simple test exercising the whitespace facet for type xs:date.. */ @org.junit.Test public void kSeqExprCast900() { final XQuery query = new XQuery( "xs:date(\" 2004-10-13 \") eq xs:date(\" 2004-10-13 \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An empty string is not a valid lexical representation of xs:date.. */ @org.junit.Test public void kSeqExprCast901() { final XQuery query = new XQuery( "xs:date(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a simple xs:untypedAtomic value to "2004-10-13" .. */ @org.junit.Test public void kSeqExprCast902() { final XQuery query = new XQuery( "xs:date(xs:untypedAtomic( \"2004-10-13\" )) eq xs:date(\"2004-10-13\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * It is not possible to extract an Effective Boolean Value from the type xs:date, with the boolean() function.. */ @org.junit.Test public void kSeqExprCast903() { final XQuery query = new XQuery( "boolean(xs:date(\"2004-10-13\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Casting from xs:date to xs:untypedAtomic is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast904() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") cast as xs:untypedAtomic ne xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:date as source type and xs:untypedAtomic as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast905() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:date to xs:string is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast906() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") cast as xs:string ne xs:string(\"an arbitrary string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:date as source type and xs:string as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast907() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:date to xs:float isn't allowed.. */ @org.junit.Test public void kSeqExprCast908() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:date as source type and xs:float as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast909() { final XQuery query = new XQuery( "not(xs:date(\"2004-10-13\") castable as xs:float)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:integer(6) instance of xs:integer`.. */ @org.junit.Test public void kSeqExprCast91() { final XQuery query = new XQuery( "xs:integer(6) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:date to xs:double isn't allowed.. */ @org.junit.Test public void kSeqExprCast910() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:date as source type and xs:double as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast911() { final XQuery query = new XQuery( "not(xs:date(\"2004-10-13\") castable as xs:double)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:date to xs:decimal isn't allowed.. */ @org.junit.Test public void kSeqExprCast912() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:date as source type and xs:decimal as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast913() { final XQuery query = new XQuery( "not(xs:date(\"2004-10-13\") castable as xs:decimal)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:date to xs:integer isn't allowed.. */ @org.junit.Test public void kSeqExprCast914() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:date as source type and xs:integer as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast915() { final XQuery query = new XQuery( "not(xs:date(\"2004-10-13\") castable as xs:integer)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:date to xs:duration isn't allowed.. */ @org.junit.Test public void kSeqExprCast916() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:date as source type and xs:duration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast917() { final XQuery query = new XQuery( "not(xs:date(\"2004-10-13\") castable as xs:duration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:date to xs:yearMonthDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast918() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:date as source type and xs:yearMonthDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast919() { final XQuery query = new XQuery( "not(xs:date(\"2004-10-13\") castable as xs:yearMonthDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:integer(6) instance of xs:decimal`.. */ @org.junit.Test public void kSeqExprCast92() { final XQuery query = new XQuery( "xs:integer(6) instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:date to xs:dayTimeDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast920() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:date as source type and xs:dayTimeDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast921() { final XQuery query = new XQuery( "not(xs:date(\"2004-10-13\") castable as xs:dayTimeDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:date to xs:dateTime is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast922() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") cast as xs:dateTime ne xs:dateTime(\"2002-10-10T12:00:00-05:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:date as source type and xs:dateTime as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast923() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:date to xs:time isn't allowed.. */ @org.junit.Test public void kSeqExprCast924() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:date as source type and xs:time as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast925() { final XQuery query = new XQuery( "not(xs:date(\"2004-10-13\") castable as xs:time)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:date to xs:date is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast926() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") cast as xs:date eq xs:date(\"2004-10-13\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:date as source type and xs:date as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast927() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:date to xs:gYearMonth is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast928() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") cast as xs:gYearMonth ne xs:gYearMonth(\"1999-11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:date as source type and xs:gYearMonth as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast929() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:hexBinary("FFF")`.. */ @org.junit.Test public void kSeqExprCast93() { final XQuery query = new XQuery( "xs:hexBinary(\"FFF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Casting from xs:date to xs:gYear is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast930() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") cast as xs:gYear ne xs:gYear(\"1999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:date as source type and xs:gYear as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast931() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:date to xs:gMonthDay is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast932() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") cast as xs:gMonthDay ne xs:gMonthDay(\"--11-13\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:date as source type and xs:gMonthDay as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast933() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:date to xs:gDay is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast934() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") cast as xs:gDay ne xs:gDay(\"---03\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:date as source type and xs:gDay as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast935() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:date to xs:gMonth is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast936() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") cast as xs:gMonth ne xs:gMonth(\"--11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:date as source type and xs:gMonth as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast937() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:date to xs:boolean isn't allowed.. */ @org.junit.Test public void kSeqExprCast938() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:date as source type and xs:boolean as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast939() { final XQuery query = new XQuery( "not(xs:date(\"2004-10-13\") castable as xs:boolean)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:hexBinary("FFxF")`.. */ @org.junit.Test public void kSeqExprCast94() { final XQuery query = new XQuery( "xs:hexBinary(\"FFxF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Casting from xs:date to xs:base64Binary isn't allowed.. */ @org.junit.Test public void kSeqExprCast940() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:date as source type and xs:base64Binary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast941() { final XQuery query = new XQuery( "not(xs:date(\"2004-10-13\") castable as xs:base64Binary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:date to xs:hexBinary isn't allowed.. */ @org.junit.Test public void kSeqExprCast942() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:date as source type and xs:hexBinary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast943() { final XQuery query = new XQuery( "not(xs:date(\"2004-10-13\") castable as xs:hexBinary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:date to xs:anyURI isn't allowed.. */ @org.junit.Test public void kSeqExprCast944() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:date as source type and xs:anyURI as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast945() { final XQuery query = new XQuery( "not(xs:date(\"2004-10-13\") castable as xs:anyURI)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:date to xs:QName isn't allowed.. */ @org.junit.Test public void kSeqExprCast946() { final XQuery query = new XQuery( "xs:date(\"2004-10-13\") cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:date as source type and xs:QName as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast947() { final XQuery query = new XQuery( "not(xs:date(\"2004-10-13\") castable as xs:QName)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:date as sourceType and xs:NOTATION should fail due to it involving xs:NOTATION.. */ @org.junit.Test public void kSeqExprCast948() { final XQuery query = new XQuery( "not(xs:date(\"2004-10-13\") castable as xs:NOTATION)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * The xs:gYearMonth constructor function must be passed exactly one argument, not zero.. */ @org.junit.Test public void kSeqExprCast949() { final XQuery query = new XQuery( "xs:gYearMonth()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `xs:hexBinary("0xFF")`.. */ @org.junit.Test public void kSeqExprCast95() { final XQuery query = new XQuery( "xs:hexBinary(\"0xFF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * The xs:gYearMonth constructor function must be passed exactly one argument, not two.. */ @org.junit.Test public void kSeqExprCast950() { final XQuery query = new XQuery( "xs:gYearMonth( \"1999-11\" , \"1999-11\" )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Verify with 'instance of' that the xs:gYearMonth constructor function produces values of the correct type. * The subsequence() function makes it more difficult for optimizers to take short cuts based on static type information.. */ @org.junit.Test public void kSeqExprCast951() { final XQuery query = new XQuery( "subsequence((\"dummy\", 1.1, xs:gYearMonth(\"1999-11\")), 3, 1) instance of xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A simple test exercising the whitespace facet for type xs:gYearMonth.. */ @org.junit.Test public void kSeqExprCast952() { final XQuery query = new XQuery( "xs:gYearMonth(\" 1999-11 \") eq xs:gYearMonth(\" 1999-11 \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An empty string is not a valid lexical representation of xs:gYearMonth.. */ @org.junit.Test public void kSeqExprCast953() { final XQuery query = new XQuery( "xs:gYearMonth(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a simple xs:untypedAtomic value to "1999-11" .. */ @org.junit.Test public void kSeqExprCast954() { final XQuery query = new XQuery( "xs:gYearMonth(xs:untypedAtomic( \"1999-11\" )) eq xs:gYearMonth(\"1999-11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * It is not possible to extract an Effective Boolean Value from the type xs:gYearMonth, with the boolean() function.. */ @org.junit.Test public void kSeqExprCast955() { final XQuery query = new XQuery( "boolean(xs:gYearMonth(\"1999-11\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * Casting from xs:gYearMonth to xs:untypedAtomic is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast956() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-11\") cast as xs:untypedAtomic ne xs:untypedAtomic(\"an arbitrary string(untypedAtomic source)\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:gYearMonth as source type and xs:untypedAtomic as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast957() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-11\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYearMonth to xs:string is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast958() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-11\") cast as xs:string ne xs:string(\"an arbitrary string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:gYearMonth as source type and xs:string as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast959() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-11\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:hexBinary("F")`.. */ @org.junit.Test public void kSeqExprCast96() { final XQuery query = new XQuery( "xs:hexBinary(\"F\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Casting from xs:gYearMonth to xs:float isn't allowed.. */ @org.junit.Test public void kSeqExprCast960() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-11\") cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYearMonth as source type and xs:float as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast961() { final XQuery query = new XQuery( "not(xs:gYearMonth(\"1999-11\") castable as xs:float)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYearMonth to xs:double isn't allowed.. */ @org.junit.Test public void kSeqExprCast962() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-11\") cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYearMonth as source type and xs:double as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast963() { final XQuery query = new XQuery( "not(xs:gYearMonth(\"1999-11\") castable as xs:double)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYearMonth to xs:decimal isn't allowed.. */ @org.junit.Test public void kSeqExprCast964() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-11\") cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYearMonth as source type and xs:decimal as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast965() { final XQuery query = new XQuery( "not(xs:gYearMonth(\"1999-11\") castable as xs:decimal)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYearMonth to xs:integer isn't allowed.. */ @org.junit.Test public void kSeqExprCast966() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-11\") cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYearMonth as source type and xs:integer as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast967() { final XQuery query = new XQuery( "not(xs:gYearMonth(\"1999-11\") castable as xs:integer)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYearMonth to xs:duration isn't allowed.. */ @org.junit.Test public void kSeqExprCast968() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-11\") cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYearMonth as source type and xs:duration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast969() { final XQuery query = new XQuery( "not(xs:gYearMonth(\"1999-11\") castable as xs:duration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:hexBinary("x")`.. */ @org.junit.Test public void kSeqExprCast97() { final XQuery query = new XQuery( "xs:hexBinary(\"x\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Casting from xs:gYearMonth to xs:yearMonthDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast970() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-11\") cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYearMonth as source type and xs:yearMonthDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast971() { final XQuery query = new XQuery( "not(xs:gYearMonth(\"1999-11\") castable as xs:yearMonthDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYearMonth to xs:dayTimeDuration isn't allowed.. */ @org.junit.Test public void kSeqExprCast972() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-11\") cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYearMonth as source type and xs:dayTimeDuration as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast973() { final XQuery query = new XQuery( "not(xs:gYearMonth(\"1999-11\") castable as xs:dayTimeDuration)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYearMonth to xs:dateTime isn't allowed.. */ @org.junit.Test public void kSeqExprCast974() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-11\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYearMonth as source type and xs:dateTime as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast975() { final XQuery query = new XQuery( "not(xs:gYearMonth(\"1999-11\") castable as xs:dateTime)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYearMonth to xs:time isn't allowed.. */ @org.junit.Test public void kSeqExprCast976() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-11\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYearMonth as source type and xs:time as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast977() { final XQuery query = new XQuery( "not(xs:gYearMonth(\"1999-11\") castable as xs:time)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYearMonth to xs:date isn't allowed.. */ @org.junit.Test public void kSeqExprCast978() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-11\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYearMonth as source type and xs:date as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast979() { final XQuery query = new XQuery( "not(xs:gYearMonth(\"1999-11\") castable as xs:date)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `exists(xs:hexBinary("Ab08bcFFAA08b6"))`.. */ @org.junit.Test public void kSeqExprCast98() { final XQuery query = new XQuery( "exists(xs:hexBinary(\"Ab08bcFFAA08b6\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYearMonth to xs:gYearMonth is allowed and should always succeed.. */ @org.junit.Test public void kSeqExprCast980() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-11\") cast as xs:gYearMonth eq xs:gYearMonth(\"1999-11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'castable as' involving xs:gYearMonth as source type and xs:gYearMonth as target type should always evaluate to true.. */ @org.junit.Test public void kSeqExprCast981() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-11\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYearMonth to xs:gYear isn't allowed.. */ @org.junit.Test public void kSeqExprCast982() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-11\") cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYearMonth as source type and xs:gYear as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast983() { final XQuery query = new XQuery( "not(xs:gYearMonth(\"1999-11\") castable as xs:gYear)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYearMonth to xs:gMonthDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast984() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-11\") cast as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYearMonth as source type and xs:gMonthDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast985() { final XQuery query = new XQuery( "not(xs:gYearMonth(\"1999-11\") castable as xs:gMonthDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYearMonth to xs:gDay isn't allowed.. */ @org.junit.Test public void kSeqExprCast986() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-11\") cast as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYearMonth as source type and xs:gDay as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast987() { final XQuery query = new XQuery( "not(xs:gYearMonth(\"1999-11\") castable as xs:gDay)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYearMonth to xs:gMonth isn't allowed.. */ @org.junit.Test public void kSeqExprCast988() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-11\") cast as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYearMonth as source type and xs:gMonth as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast989() { final XQuery query = new XQuery( "not(xs:gYearMonth(\"1999-11\") castable as xs:gMonth)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `exists(xs:hexBinary("FF"))`.. */ @org.junit.Test public void kSeqExprCast99() { final XQuery query = new XQuery( "exists(xs:hexBinary(\"FF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYearMonth to xs:boolean isn't allowed.. */ @org.junit.Test public void kSeqExprCast990() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-11\") cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYearMonth as source type and xs:boolean as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast991() { final XQuery query = new XQuery( "not(xs:gYearMonth(\"1999-11\") castable as xs:boolean)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYearMonth to xs:base64Binary isn't allowed.. */ @org.junit.Test public void kSeqExprCast992() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-11\") cast as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYearMonth as source type and xs:base64Binary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast993() { final XQuery query = new XQuery( "not(xs:gYearMonth(\"1999-11\") castable as xs:base64Binary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYearMonth to xs:hexBinary isn't allowed.. */ @org.junit.Test public void kSeqExprCast994() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-11\") cast as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYearMonth as source type and xs:hexBinary as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast995() { final XQuery query = new XQuery( "not(xs:gYearMonth(\"1999-11\") castable as xs:hexBinary)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYearMonth to xs:anyURI isn't allowed.. */ @org.junit.Test public void kSeqExprCast996() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-11\") cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYearMonth as source type and xs:anyURI as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast997() { final XQuery query = new XQuery( "not(xs:gYearMonth(\"1999-11\") castable as xs:anyURI)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting from xs:gYearMonth to xs:QName isn't allowed.. */ @org.junit.Test public void kSeqExprCast998() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-11\") cast as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * 'castable as' involving xs:gYearMonth as source type and xs:QName as target type should always evaluate to false.. */ @org.junit.Test public void kSeqExprCast999() { final XQuery query = new XQuery( "not(xs:gYearMonth(\"1999-11\") castable as xs:QName)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A type is specified which doesn't exist.. */ @org.junit.Test public void kSeqExprCast9a() { final XQuery query = new XQuery( "3 cast as xs:doesNotExist", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0052") ); } /** * Cast to xs:QName where the prefix is declared in the prolog.. */ @org.junit.Test public void k2SeqExprCast1() { final XQuery query = new XQuery( "\"myPrefix:ncname\" cast as xs:QName eq QName(\"http://example.com/\", \"anotherPrefix:ncname\")", ctx); try { query.namespace("myPrefix", "http://example.com/"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Pass a small, the smallest if such a limit exists, to unsignedLong.. */ @org.junit.Test public void k2SeqExprCast10() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Pass an empty string to nonNegativeInteger.. */ @org.junit.Test public void k2SeqExprCast100() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass an empty string to unsignedLong.. */ @org.junit.Test public void k2SeqExprCast101() { final XQuery query = new XQuery( "xs:unsignedLong(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass an empty string to unsignedInt.. */ @org.junit.Test public void k2SeqExprCast102() { final XQuery query = new XQuery( "xs:unsignedInt(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass an empty string to unsignedByte.. */ @org.junit.Test public void k2SeqExprCast103() { final XQuery query = new XQuery( "xs:unsignedByte(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass an empty string to unsignedShort.. */ @org.junit.Test public void k2SeqExprCast104() { final XQuery query = new XQuery( "xs:unsignedShort(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass an empty string to positiveInteger.. */ @org.junit.Test public void k2SeqExprCast105() { final XQuery query = new XQuery( "xs:positiveInteger(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Fractions are disallowed in nonPositiveInteger.. */ @org.junit.Test public void k2SeqExprCast106() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-3.0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Fractions are disallowed in negativeInteger.. */ @org.junit.Test public void k2SeqExprCast107() { final XQuery query = new XQuery( "xs:negativeInteger(\"-3.0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Fractions are disallowed in long.. */ @org.junit.Test public void k2SeqExprCast108() { final XQuery query = new XQuery( "xs:long(\"3.0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Fractions are disallowed in int.. */ @org.junit.Test public void k2SeqExprCast109() { final XQuery query = new XQuery( "xs:int(\"3.0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass a small, the smallest if such a limit exists, to unsignedInt.. */ @org.junit.Test public void k2SeqExprCast11() { final XQuery query = new XQuery( "xs:unsignedInt(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Fractions are disallowed in short.. */ @org.junit.Test public void k2SeqExprCast110() { final XQuery query = new XQuery( "xs:short(\"3.0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Fractions are disallowed in byte.. */ @org.junit.Test public void k2SeqExprCast111() { final XQuery query = new XQuery( "xs:byte(\"3.0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Fractions are disallowed in nonNegativeInteger.. */ @org.junit.Test public void k2SeqExprCast112() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"3.0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Fractions are disallowed in unsignedLong.. */ @org.junit.Test public void k2SeqExprCast113() { final XQuery query = new XQuery( "xs:unsignedLong(\"3.0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Fractions are disallowed in unsignedInt.. */ @org.junit.Test public void k2SeqExprCast114() { final XQuery query = new XQuery( "xs:unsignedInt(\"3.0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Fractions are disallowed in unsignedByte.. */ @org.junit.Test public void k2SeqExprCast115() { final XQuery query = new XQuery( "xs:unsignedByte(\"3.0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Fractions are disallowed in unsignedShort.. */ @org.junit.Test public void k2SeqExprCast116() { final XQuery query = new XQuery( "xs:unsignedShort(\"3.0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Fractions are disallowed in positiveInteger.. */ @org.junit.Test public void k2SeqExprCast117() { final XQuery query = new XQuery( "xs:positiveInteger(\"3.0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Space between the sign and the digits is disallowed for nonPositiveInteger.. */ @org.junit.Test public void k2SeqExprCast118() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"- 0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Space between the sign and the digits is disallowed for nonPositiveInteger(#2).. */ @org.junit.Test public void k2SeqExprCast119() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"+ 0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass a small, the smallest if such a limit exists, to unsignedByte.. */ @org.junit.Test public void k2SeqExprCast12() { final XQuery query = new XQuery( "xs:unsignedByte(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Space between the sign and the digits is disallowed for negativeInteger.. */ @org.junit.Test public void k2SeqExprCast120() { final XQuery query = new XQuery( "xs:negativeInteger(\"- 3\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Space between the sign and the digits is disallowed for long.. */ @org.junit.Test public void k2SeqExprCast121() { final XQuery query = new XQuery( "xs:long(\"+ 5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Space between the sign and the digits is disallowed for int.. */ @org.junit.Test public void k2SeqExprCast122() { final XQuery query = new XQuery( "xs:int(\"+ 5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Space between the sign and the digits is disallowed for short.. */ @org.junit.Test public void k2SeqExprCast123() { final XQuery query = new XQuery( "xs:short(\"+ 5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Space between the sign and the digits is disallowed for byte.. */ @org.junit.Test public void k2SeqExprCast124() { final XQuery query = new XQuery( "xs:byte(\"+ 5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Space between the sign and the digits is disallowed for long.. */ @org.junit.Test public void k2SeqExprCast125() { final XQuery query = new XQuery( "xs:long(\"- 5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Space between the sign and the digits is disallowed for int.. */ @org.junit.Test public void k2SeqExprCast126() { final XQuery query = new XQuery( "xs:int(\"- 5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Space between the sign and the digits is disallowed for short.. */ @org.junit.Test public void k2SeqExprCast127() { final XQuery query = new XQuery( "xs:short(\"- 5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Space between the sign and the digits is disallowed for byte.. */ @org.junit.Test public void k2SeqExprCast128() { final XQuery query = new XQuery( "xs:byte(\"- 5\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Space between the sign and the digits is disallowed for nonNegativeInteger.. */ @org.junit.Test public void k2SeqExprCast129() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"+ 0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass a small, the smallest if such a limit exists, to unsignedShort.. */ @org.junit.Test public void k2SeqExprCast13() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Space between the sign and the digits is disallowed for nonNegativeInteger(#2).. */ @org.junit.Test public void k2SeqExprCast130() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"- 0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Space between the sign and the digits is disallowed for positiveInteger.. */ @org.junit.Test public void k2SeqExprCast131() { final XQuery query = new XQuery( "xs:positiveInteger(\"+ 3\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass preceding zeros to nonPositiveInteger.. */ @org.junit.Test public void k2SeqExprCast132() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-000000001\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Pass preceding zeros to nonPositiveInteger.. */ @org.junit.Test public void k2SeqExprCast133() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-000000000\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Pass preceding zeros to negativeInteger.. */ @org.junit.Test public void k2SeqExprCast134() { final XQuery query = new XQuery( "xs:negativeInteger(\"-000000001\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Pass preceding zeros to long.. */ @org.junit.Test public void k2SeqExprCast135() { final XQuery query = new XQuery( "xs:long(\"000000001\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Pass preceding zeros to int.. */ @org.junit.Test public void k2SeqExprCast136() { final XQuery query = new XQuery( "xs:int(\"000000001\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Pass preceding zeros to short.. */ @org.junit.Test public void k2SeqExprCast137() { final XQuery query = new XQuery( "xs:short(\"000000001\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Pass preceding zeros to byte.. */ @org.junit.Test public void k2SeqExprCast138() { final XQuery query = new XQuery( "xs:byte(\"000000001\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Pass preceding zeros to nonNegativeInteger.. */ @org.junit.Test public void k2SeqExprCast139() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"000000001\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Pass a small, the smallest if such a limit exists, to positiveInteger.. */ @org.junit.Test public void k2SeqExprCast14() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Pass preceding zeros to unsignedLong.. */ @org.junit.Test public void k2SeqExprCast140() { final XQuery query = new XQuery( "xs:unsignedLong(\"000000001\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Pass preceding zeros to unsignedInt.. */ @org.junit.Test public void k2SeqExprCast141() { final XQuery query = new XQuery( "xs:unsignedInt(\"000000001\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Pass preceding zeros to unsignedByte.. */ @org.junit.Test public void k2SeqExprCast142() { final XQuery query = new XQuery( "xs:unsignedByte(\"000000001\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Pass preceding zeros to unsignedShort.. */ @org.junit.Test public void k2SeqExprCast143() { final XQuery query = new XQuery( "xs:unsignedShort(\"000000001\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Pass preceding zeros to positiveInteger.. */ @org.junit.Test public void k2SeqExprCast144() { final XQuery query = new XQuery( "xs:positiveInteger(\"000000001\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Hexa-decimal notation isn't allowed in nonPositiveInteger.. */ @org.junit.Test public void k2SeqExprCast145() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"0x0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Hexa-decimal notation isn't allowed in negativeInteger.. */ @org.junit.Test public void k2SeqExprCast146() { final XQuery query = new XQuery( "xs:negativeInteger(\"-0x1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Hexa-decimal notation isn't allowed in long.. */ @org.junit.Test public void k2SeqExprCast147() { final XQuery query = new XQuery( "xs:long(\"0x9223372036854775807\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Hexa-decimal notation isn't allowed in int.. */ @org.junit.Test public void k2SeqExprCast148() { final XQuery query = new XQuery( "xs:int(\"0x2147483647\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Hexa-decimal notation isn't allowed in short.. */ @org.junit.Test public void k2SeqExprCast149() { final XQuery query = new XQuery( "xs:short(\"-0x32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass a large, the largest if such a limit exists, to nonPositiveInteger.. */ @org.junit.Test public void k2SeqExprCast15() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Hexa-decimal notation isn't allowed in byte.. */ @org.junit.Test public void k2SeqExprCast150() { final XQuery query = new XQuery( "xs:byte(\"-0x128\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Hexa-decimal notation isn't allowed in nonNegativeInteger.. */ @org.junit.Test public void k2SeqExprCast151() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0x0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Hexa-decimal notation isn't allowed in unsignedLong.. */ @org.junit.Test public void k2SeqExprCast152() { final XQuery query = new XQuery( "xs:unsignedLong(\"0x0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Hexa-decimal notation isn't allowed in unsignedInt.. */ @org.junit.Test public void k2SeqExprCast153() { final XQuery query = new XQuery( "xs:unsignedInt(\"0x0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Hexa-decimal notation isn't allowed in unsignedByte.. */ @org.junit.Test public void k2SeqExprCast154() { final XQuery query = new XQuery( "xs:unsignedByte(\"0x0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Hexa-decimal notation isn't allowed in unsignedShort.. */ @org.junit.Test public void k2SeqExprCast155() { final XQuery query = new XQuery( "xs:unsignedShort(\"0x0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Hexa-decimal notation isn't allowed in positiveInteger.. */ @org.junit.Test public void k2SeqExprCast156() { final XQuery query = new XQuery( "xs:positiveInteger(\"0x1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast fn:false() to xs:language.. */ @org.junit.Test public void k2SeqExprCast157() { final XQuery query = new XQuery( "xs:language(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "false") ); } /** * Cast fn:true() to xs:language.. */ @org.junit.Test public void k2SeqExprCast158() { final XQuery query = new XQuery( "xs:language(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true") ); } /** * Cast an empty string to xs:language.. */ @org.junit.Test public void k2SeqExprCast159() { final XQuery query = new XQuery( "xs:language(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass a large, the largest if such a limit exists, to negativeInteger.. */ @org.junit.Test public void k2SeqExprCast16() { final XQuery query = new XQuery( "xs:negativeInteger(\"-999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-999999999999999999") ); } /** * Cast a too long string to xs:language.. */ @org.junit.Test public void k2SeqExprCast160() { final XQuery query = new XQuery( "xs:language(\"abcdefjhl\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast string with invalid characters to xs:language.. */ @org.junit.Test public void k2SeqExprCast161() { final XQuery query = new XQuery( "xs:language(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast string with invalid characters to xs:language.. */ @org.junit.Test public void k2SeqExprCast162() { final XQuery query = new XQuery( "xs:language(\"a1a\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast string with invalid characters to xs:language.. */ @org.junit.Test public void k2SeqExprCast163() { final XQuery query = new XQuery( "xs:language(\"a.a\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast string with invalid characters to xs:language.. */ @org.junit.Test public void k2SeqExprCast164() { final XQuery query = new XQuery( "xs:language(\"a*a\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast string with invalid characters to xs:language.. */ @org.junit.Test public void k2SeqExprCast165() { final XQuery query = new XQuery( "xs:language(\"abc-\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast string with invalid characters to xs:language.. */ @org.junit.Test public void k2SeqExprCast166() { final XQuery query = new XQuery( "xs:language(\"abc--ab\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast string with invalid characters to xs:language.. */ @org.junit.Test public void k2SeqExprCast167() { final XQuery query = new XQuery( "xs:language(\"abc-ab-\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast string with invalid characters to xs:language.. */ @org.junit.Test public void k2SeqExprCast168() { final XQuery query = new XQuery( "xs:language(\"abc-\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast string with invalid characters to xs:language.. */ @org.junit.Test public void k2SeqExprCast169() { final XQuery query = new XQuery( "xs:language(\"abc-abcdefikl\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass a large, the largest if such a limit exists, to long.. */ @org.junit.Test public void k2SeqExprCast17() { final XQuery query = new XQuery( "xs:long(\"-9223372036854775808\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("-9223372036854775808") || error("FOAR0002") ) ); } /** * Cast string with invalid characters to xs:language.. */ @org.junit.Test public void k2SeqExprCast170() { final XQuery query = new XQuery( "xs:language(\"abc-abcdef.k\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast string with invalid characters to xs:language.. */ @org.junit.Test public void k2SeqExprCast171() { final XQuery query = new XQuery( "xs:language(\"abc-ab1efikl\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc-ab1efikl") ); } /** * Cast string with invalid characters to xs:language.. */ @org.junit.Test public void k2SeqExprCast172() { final XQuery query = new XQuery( "xs:language(\"abc-a-1b1efikl\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc-a-1b1efikl") ); } /** * Cast string with invalid characters to xs:language.. */ @org.junit.Test public void k2SeqExprCast173() { final XQuery query = new XQuery( "xs:language(\"abc-a-1-1b1efil\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc-a-1-1b1efil") ); } /** * Cast string with invalid characters to xs:language.. */ @org.junit.Test public void k2SeqExprCast174() { final XQuery query = new XQuery( "xs:language(\"abc-a-1-1b01efil\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc-a-1-1b01efil") ); } /** * Cast an integer to xs:language.. */ @org.junit.Test public void k2SeqExprCast175() { final XQuery query = new XQuery( "xs:language(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a short to xs:language.. */ @org.junit.Test public void k2SeqExprCast176() { final XQuery query = new XQuery( "xs:language(xs:short(\"1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a xs:date to xs:language.. */ @org.junit.Test public void k2SeqExprCast177() { final XQuery query = new XQuery( "xs:language(current-date())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a xs:time to xs:language.. */ @org.junit.Test public void k2SeqExprCast178() { final XQuery query = new XQuery( "xs:language(current-time())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a xs:dateTime to xs:language.. */ @org.junit.Test public void k2SeqExprCast179() { final XQuery query = new XQuery( "xs:language(current-dateTime())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass a large, the largest if such a limit exists, to int.. */ @org.junit.Test public void k2SeqExprCast18() { final XQuery query = new XQuery( "xs:int(\"-2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-2147483648") ); } /** * No function by name xs:name exists.. */ @org.junit.Test public void k2SeqExprCast180() { final XQuery query = new XQuery( "xs:name(\"input\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Pass invalid input to xs:Name.. */ @org.junit.Test public void k2SeqExprCast181() { final XQuery query = new XQuery( "xs:Name(\"1abc\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass invalid input to xs:Name.. */ @org.junit.Test public void k2SeqExprCast182() { final XQuery query = new XQuery( "xs:Name(\"ab\\c\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass invalid input to xs:Name.. */ @org.junit.Test public void k2SeqExprCast183() { final XQuery query = new XQuery( "xs:Name(\"ab|\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass invalid input to xs:Name.. */ @org.junit.Test public void k2SeqExprCast184() { final XQuery query = new XQuery( "xs:Name(\"a c\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass invalid input to xs:Name.. */ @org.junit.Test public void k2SeqExprCast185() { final XQuery query = new XQuery( "xs:Name(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass tricky, valid input to xs:Name.. */ @org.junit.Test public void k2SeqExprCast186() { final XQuery query = new XQuery( "xs:Name(\"::::\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "::::") ); } /** * Pass tricky, valid input to xs:Name.. */ @org.junit.Test public void k2SeqExprCast187() { final XQuery query = new XQuery( "xs:Name(\"_\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "_") ); } /** * Pass tricky, valid input to xs:Name.. */ @org.junit.Test public void k2SeqExprCast188() { final XQuery query = new XQuery( "xs:Name(\":\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, ":") ); } /** * Pass tricky, valid input to xs:Name.. */ @org.junit.Test public void k2SeqExprCast189() { final XQuery query = new XQuery( "xs:Name(\"a\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a") ); } /** * Pass a large, the largest if such a limit exists, to short.. */ @org.junit.Test public void k2SeqExprCast19() { final XQuery query = new XQuery( "xs:short(\"32767\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("32767") ); } /** * Pass tricky, valid input to xs:Name.. */ @org.junit.Test public void k2SeqExprCast190() { final XQuery query = new XQuery( "xs:Name(\" a \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a") ); } /** * Pass tricky, valid input to xs:Name.. */ @org.junit.Test public void k2SeqExprCast191() { final XQuery query = new XQuery( "xs:Name(\"a1123-_--__-__--....-.--.-..12309asd\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a1123-_--__-__--....-.--.-..12309asd") ); } /** * Pass an empty string to normalizedString.. */ @org.junit.Test public void k2SeqExprCast192() { final XQuery query = new XQuery( "xs:normalizedString(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * Pass an empty string to token.. */ @org.junit.Test public void k2SeqExprCast193() { final XQuery query = new XQuery( "xs:token(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * Pass an empty string to language.. */ @org.junit.Test public void k2SeqExprCast194() { final XQuery query = new XQuery( "xs:language(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass an empty string to NMTOKEN.. */ @org.junit.Test public void k2SeqExprCast195() { final XQuery query = new XQuery( "xs:NMTOKEN(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass an empty string to Name.. */ @org.junit.Test public void k2SeqExprCast196() { final XQuery query = new XQuery( "xs:Name(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass an empty string to NCName.. */ @org.junit.Test public void k2SeqExprCast197() { final XQuery query = new XQuery( "xs:NCName(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass an empty string to ID.. */ @org.junit.Test public void k2SeqExprCast198() { final XQuery query = new XQuery( "xs:ID(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass an empty string to IDREF.. */ @org.junit.Test public void k2SeqExprCast199() { final XQuery query = new XQuery( "xs:IDREF(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Casting the empty sequence to xs:QName? is ok.. */ @org.junit.Test public void k2SeqExprCast2() { final XQuery query = new XQuery( "empty(() cast as xs:QName?)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Pass a large, the largest if such a limit exists, to byte.. */ @org.junit.Test public void k2SeqExprCast20() { final XQuery query = new XQuery( "xs:byte(\"127\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("127") ); } /** * Pass an empty string to ENTITY.. */ @org.junit.Test public void k2SeqExprCast200() { final XQuery query = new XQuery( "xs:ENTITY(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * When casting to xs:QName, the declared default element namespace is considered.. */ @org.junit.Test public void k2SeqExprCast201() { final XQuery query = new XQuery( "namespace-uri-from-QName(xs:QName(\"ncname\"))", ctx); try { query.namespace("", "http://example.com/defelementns"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.com/defelementns") ); } /** * Use complex input to xs:NMTOKEN.. */ @org.junit.Test public void k2SeqExprCast202() { final XQuery query = new XQuery( "xs:NMTOKEN(\" ::::...:SDA21455313 \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "::::...:SDA21455313") ); } /** * Whitespace is disallowed inside NMOKEN.. */ @org.junit.Test public void k2SeqExprCast203() { final XQuery query = new XQuery( "xs:NMTOKEN(\" f f\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * The empty string is invalid in xs:NMTOKEN.. */ @org.junit.Test public void k2SeqExprCast204() { final XQuery query = new XQuery( "xs:NMTOKEN(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * The empty string is invalid in xs:NMTOKEN(#2).. */ @org.junit.Test public void k2SeqExprCast205() { final XQuery query = new XQuery( "xs:NMTOKEN(\" \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass a single semi colon to xs:NMTOKEN.. */ @org.junit.Test public void k2SeqExprCast206() { final XQuery query = new XQuery( "xs:NMTOKEN(\";\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Construct an xs:anyURI from an invalid string. * However, in F&O 17.1.1, it is said that "For xs:anyURI, the extent to which an * implementation validates the lexical form of xs:anyURI is implementation dependent.".. */ @org.junit.Test public void k2SeqExprCast207() { final XQuery query = new XQuery( "xs:anyURI(\"http:\\\\invalid>URI\\someURI\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "http:\\\\invalid>URI\\someURI") || error("FORG0001") ) ); } /** * Use a large chunk of whitespace in an xs:anyURI.. */ @org.junit.Test public void k2SeqExprCast208() { final XQuery query = new XQuery( "concat(\"b\", xs:anyURI(\" \"), \"b\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "bb") ); } /** * Ensure that a large Unicode codepoint is handled correctly in xs:anyURI.. */ @org.junit.Test public void k2SeqExprCast209() { final XQuery query = new XQuery( "xs:anyURI(\"\u301c\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "\u301c") ); } /** * Pass a large, the largest if such a limit exists, to nonNegativeInteger.. */ @org.junit.Test public void k2SeqExprCast21() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * '%' is not a disallowed character and therefore it's not encoded * before being considered for RFC 2396 validness.. */ @org.junit.Test public void k2SeqExprCast210() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com/file%GF.html\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * No type by name xs:anyAtomic exists.. */ @org.junit.Test public void k2SeqExprCast211() { final XQuery query = new XQuery( "xs:anyAtomic(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No type by name xs:anyAtomic exists(2).. */ @org.junit.Test public void k2SeqExprCast212() { final XQuery query = new XQuery( "xs:anyAtomic(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Cast an xs:positiveInteger value to xs:double.. */ @org.junit.Test public void k2SeqExprCast213() { final XQuery query = new XQuery( "xs:double(xs:positiveInteger(\"52\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("52") ); } /** * Cast an xs:int value to xs:double.. */ @org.junit.Test public void k2SeqExprCast214() { final XQuery query = new XQuery( "xs:double(xs:int(\"-1873914410\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-1.87391441E9") ); } /** * 'Inf' is not a valid value for xs:double.. */ @org.junit.Test public void k2SeqExprCast215() { final XQuery query = new XQuery( "xs:double(\"Inf\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * 'Inf' is not a valid value for xs:float.. */ @org.junit.Test public void k2SeqExprCast216() { final XQuery query = new XQuery( "xs:float(\"Inf\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '-Inf' is not a valid value for xs:double.. */ @org.junit.Test public void k2SeqExprCast217() { final XQuery query = new XQuery( "xs:double(\"-Inf\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '-Inf' is not a valid value for xs:float.. */ @org.junit.Test public void k2SeqExprCast218() { final XQuery query = new XQuery( "xs:float(\"-Inf\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '+Inf' is not a valid value for xs:double.. */ @org.junit.Test public void k2SeqExprCast219() { final XQuery query = new XQuery( "xs:double(\"+Inf\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass a large, the largest if such a limit exists, to unsignedLong.. */ @org.junit.Test public void k2SeqExprCast22() { final XQuery query = new XQuery( "xs:unsignedLong(\"18446744073709551615\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("18446744073709551615") || error("FOAR0002") ) ); } /** * '+Inf' is not a valid value for xs:float.. */ @org.junit.Test public void k2SeqExprCast220() { final XQuery query = new XQuery( "xs:float(\"+Inf\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Whitespace is ignored for xs:float's lexical space.. */ @org.junit.Test public void k2SeqExprCast221() { final XQuery query = new XQuery( "xs:float(\" NaN \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Whitespace is ignored for xs:double's lexical space.. */ @org.junit.Test public void k2SeqExprCast222() { final XQuery query = new XQuery( "xs:double(\" NaN \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NaN") ); } /** * Whitespace is ignored for xs:float's lexical space(#2).. */ @org.junit.Test public void k2SeqExprCast223() { final XQuery query = new XQuery( "xs:float(\" INF \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** * Whitespace is ignored for xs:double's lexical space(#2).. */ @org.junit.Test public void k2SeqExprCast224() { final XQuery query = new XQuery( "xs:double(\" INF \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "INF") ); } /** * 'nan' is not a valid value for xs:double.. */ @org.junit.Test public void k2SeqExprCast225() { final XQuery query = new XQuery( "xs:double(\"nan\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * 'nan' is not a valid value for xs:float.. */ @org.junit.Test public void k2SeqExprCast226() { final XQuery query = new XQuery( "xs:float(\"nan\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '- INF' is not a valid value for xs:double.. */ @org.junit.Test public void k2SeqExprCast227() { final XQuery query = new XQuery( "xs:double(\"- INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '- INF' is not a valid value for xs:float.. */ @org.junit.Test public void k2SeqExprCast228() { final XQuery query = new XQuery( "xs:float(\"- INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '+ INF' is not a valid value for xs:double.. */ @org.junit.Test public void k2SeqExprCast229() { final XQuery query = new XQuery( "xs:double(\"+ INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass a large, the largest if such a limit exists, to unsignedInt.. */ @org.junit.Test public void k2SeqExprCast23() { final XQuery query = new XQuery( "xs:unsignedInt(\"4294967295\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("4294967295") ); } /** * '+ INF' is not a valid value for xs:float.. */ @org.junit.Test public void k2SeqExprCast230() { final XQuery query = new XQuery( "xs:float(\"+ INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '+INF' is not a valid value for xs:double.. */ @org.junit.Test public void k2SeqExprCast231() { final XQuery query = new XQuery( "xs:double(\"+INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '+INF' is not a valid value for xs:float.. */ @org.junit.Test public void k2SeqExprCast232() { final XQuery query = new XQuery( "xs:float(\"+INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * 'Inf' is not a valid value for xs:decimal.. */ @org.junit.Test public void k2SeqExprCast233() { final XQuery query = new XQuery( "xs:decimal(\"Inf\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '-Inf' is not a valid value for xs:decimal.. */ @org.junit.Test public void k2SeqExprCast234() { final XQuery query = new XQuery( "xs:decimal(\"-Inf\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '+Inf' is not a valid value for xs:decimal.. */ @org.junit.Test public void k2SeqExprCast235() { final XQuery query = new XQuery( "xs:decimal(\"+Inf\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * 'nan' is not a valid value for xs:decimal.. */ @org.junit.Test public void k2SeqExprCast236() { final XQuery query = new XQuery( "xs:decimal(\"nan\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '- INF' is not a valid value for xs:decimal.. */ @org.junit.Test public void k2SeqExprCast237() { final XQuery query = new XQuery( "xs:decimal(\"- INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '+ INF' is not a valid value for xs:decimal.. */ @org.junit.Test public void k2SeqExprCast238() { final XQuery query = new XQuery( "xs:decimal(\"+ INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * '+INF' is not a valid value for xs:decimal.. */ @org.junit.Test public void k2SeqExprCast239() { final XQuery query = new XQuery( "xs:decimal(\"+INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass a large, the largest if such a limit exists, to unsignedShort.. */ @org.junit.Test public void k2SeqExprCast24() { final XQuery query = new XQuery( "xs:unsignedShort(\"65535\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("65535") ); } /** * 'INF' is not a valid value for xs:decimal.. */ @org.junit.Test public void k2SeqExprCast240() { final XQuery query = new XQuery( "xs:decimal(\"INF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * 'NaN' is not a valid value for xs:decimal.. */ @org.junit.Test public void k2SeqExprCast241() { final XQuery query = new XQuery( "xs:decimal(\"NaN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:float(NaN) to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast242() { final XQuery query = new XQuery( "xs:decimal(xs:float(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(NaN) to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast243() { final XQuery query = new XQuery( "xs:decimal(xs:double(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(NaN) to xs:integer.. */ @org.junit.Test public void k2SeqExprCast244() { final XQuery query = new XQuery( "xs:integer(xs:float(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(NaN) to xs:integer.. */ @org.junit.Test public void k2SeqExprCast245() { final XQuery query = new XQuery( "xs:integer(xs:double(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(INF) to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast246() { final XQuery query = new XQuery( "xs:decimal(xs:float(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(INF) to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast247() { final XQuery query = new XQuery( "xs:decimal(xs:double(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(INF) to xs:integer.. */ @org.junit.Test public void k2SeqExprCast248() { final XQuery query = new XQuery( "xs:integer(xs:float(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(INF) to xs:integer.. */ @org.junit.Test public void k2SeqExprCast249() { final XQuery query = new XQuery( "xs:integer(xs:double(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Pass a large, the largest if such a limit exists, to unsignedByte.. */ @org.junit.Test public void k2SeqExprCast25() { final XQuery query = new XQuery( "xs:unsignedByte(\"255\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("255") ); } /** * Cast xs:float(-INF) to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast250() { final XQuery query = new XQuery( "xs:decimal(xs:float(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(-INF) to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast251() { final XQuery query = new XQuery( "xs:decimal(xs:double(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(-INF) to xs:integer.. */ @org.junit.Test public void k2SeqExprCast252() { final XQuery query = new XQuery( "xs:integer(xs:float(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(-INF) to xs:integer.. */ @org.junit.Test public void k2SeqExprCast253() { final XQuery query = new XQuery( "xs:integer(xs:double(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(-INF) to xs:byte.. */ @org.junit.Test public void k2SeqExprCast254() { final XQuery query = new XQuery( "xs:byte(xs:float(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(-INF) to xs:byte.. */ @org.junit.Test public void k2SeqExprCast255() { final XQuery query = new XQuery( "xs:byte(xs:double(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(INF) to xs:byte.. */ @org.junit.Test public void k2SeqExprCast256() { final XQuery query = new XQuery( "xs:byte(xs:float(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(INF) to xs:byte.. */ @org.junit.Test public void k2SeqExprCast257() { final XQuery query = new XQuery( "xs:byte(xs:double(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(NaN) to xs:byte.. */ @org.junit.Test public void k2SeqExprCast258() { final XQuery query = new XQuery( "xs:byte(xs:float(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(NaN) to xs:byte.. */ @org.junit.Test public void k2SeqExprCast259() { final XQuery query = new XQuery( "xs:byte(xs:double(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Pass a large, the largest if such a limit exists, to positiveInteger.. */ @org.junit.Test public void k2SeqExprCast26() { final XQuery query = new XQuery( "xs:positiveInteger(\"999999999999999999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("999999999999999999") ); } /** * Cast xs:float(-INF) to xs:nonPositiveInteger.. */ @org.junit.Test public void k2SeqExprCast260() { final XQuery query = new XQuery( "xs:nonPositiveInteger(xs:float(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(-INF) to xs:nonPositiveInteger.. */ @org.junit.Test public void k2SeqExprCast261() { final XQuery query = new XQuery( "xs:nonPositiveInteger(xs:double(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(INF) to xs:nonPositiveInteger.. */ @org.junit.Test public void k2SeqExprCast262() { final XQuery query = new XQuery( "xs:nonPositiveInteger(xs:float(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(INF) to xs:nonPositiveInteger.. */ @org.junit.Test public void k2SeqExprCast263() { final XQuery query = new XQuery( "xs:nonPositiveInteger(xs:double(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(NaN) to xs:nonPositiveInteger.. */ @org.junit.Test public void k2SeqExprCast264() { final XQuery query = new XQuery( "xs:nonPositiveInteger(xs:float(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(NaN) to xs:nonPositiveInteger.. */ @org.junit.Test public void k2SeqExprCast265() { final XQuery query = new XQuery( "xs:nonPositiveInteger(xs:double(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(-INF) to xs:negativeInteger.. */ @org.junit.Test public void k2SeqExprCast266() { final XQuery query = new XQuery( "xs:negativeInteger(xs:float(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(-INF) to xs:negativeInteger.. */ @org.junit.Test public void k2SeqExprCast267() { final XQuery query = new XQuery( "xs:negativeInteger(xs:double(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(INF) to xs:negativeInteger.. */ @org.junit.Test public void k2SeqExprCast268() { final XQuery query = new XQuery( "xs:negativeInteger(xs:float(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(INF) to xs:negativeInteger.. */ @org.junit.Test public void k2SeqExprCast269() { final XQuery query = new XQuery( "xs:negativeInteger(xs:double(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast fn:false() to nonPositiveInteger.. */ @org.junit.Test public void k2SeqExprCast27() { final XQuery query = new XQuery( "xs:nonPositiveInteger(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Cast xs:float(NaN) to xs:negativeInteger.. */ @org.junit.Test public void k2SeqExprCast270() { final XQuery query = new XQuery( "xs:negativeInteger(xs:float(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(NaN) to xs:negativeInteger.. */ @org.junit.Test public void k2SeqExprCast271() { final XQuery query = new XQuery( "xs:negativeInteger(xs:double(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(-INF) to xs:long.. */ @org.junit.Test public void k2SeqExprCast272() { final XQuery query = new XQuery( "xs:long(xs:float(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(-INF) to xs:long.. */ @org.junit.Test public void k2SeqExprCast273() { final XQuery query = new XQuery( "xs:long(xs:double(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(INF) to xs:long.. */ @org.junit.Test public void k2SeqExprCast274() { final XQuery query = new XQuery( "xs:long(xs:float(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(INF) to xs:long.. */ @org.junit.Test public void k2SeqExprCast275() { final XQuery query = new XQuery( "xs:long(xs:double(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(NaN) to xs:long.. */ @org.junit.Test public void k2SeqExprCast276() { final XQuery query = new XQuery( "xs:long(xs:float(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(NaN) to xs:long.. */ @org.junit.Test public void k2SeqExprCast277() { final XQuery query = new XQuery( "xs:long(xs:double(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(-INF) to xs:int.. */ @org.junit.Test public void k2SeqExprCast278() { final XQuery query = new XQuery( "xs:int(xs:float(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(-INF) to xs:int.. */ @org.junit.Test public void k2SeqExprCast279() { final XQuery query = new XQuery( "xs:int(xs:double(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast fn:true() to nonPositiveInteger.. */ @org.junit.Test public void k2SeqExprCast28() { final XQuery query = new XQuery( "xs:nonPositiveInteger(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:float(INF) to xs:int.. */ @org.junit.Test public void k2SeqExprCast280() { final XQuery query = new XQuery( "xs:int(xs:float(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(INF) to xs:int.. */ @org.junit.Test public void k2SeqExprCast281() { final XQuery query = new XQuery( "xs:int(xs:double(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(NaN) to xs:int.. */ @org.junit.Test public void k2SeqExprCast282() { final XQuery query = new XQuery( "xs:int(xs:float(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(NaN) to xs:int.. */ @org.junit.Test public void k2SeqExprCast283() { final XQuery query = new XQuery( "xs:int(xs:double(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(-INF) to xs:short.. */ @org.junit.Test public void k2SeqExprCast284() { final XQuery query = new XQuery( "xs:short(xs:float(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(-INF) to xs:short.. */ @org.junit.Test public void k2SeqExprCast285() { final XQuery query = new XQuery( "xs:short(xs:double(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(INF) to xs:short.. */ @org.junit.Test public void k2SeqExprCast286() { final XQuery query = new XQuery( "xs:short(xs:float(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(INF) to xs:short.. */ @org.junit.Test public void k2SeqExprCast287() { final XQuery query = new XQuery( "xs:short(xs:double(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(NaN) to xs:short.. */ @org.junit.Test public void k2SeqExprCast288() { final XQuery query = new XQuery( "xs:short(xs:float(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(NaN) to xs:short.. */ @org.junit.Test public void k2SeqExprCast289() { final XQuery query = new XQuery( "xs:short(xs:double(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast fn:false() to negativeInteger.. */ @org.junit.Test public void k2SeqExprCast29() { final XQuery query = new XQuery( "xs:negativeInteger(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:float(-INF) to xs:byte.. */ @org.junit.Test public void k2SeqExprCast290() { final XQuery query = new XQuery( "xs:byte(xs:float(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(-INF) to xs:byte.. */ @org.junit.Test public void k2SeqExprCast291() { final XQuery query = new XQuery( "xs:byte(xs:double(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(INF) to xs:byte.. */ @org.junit.Test public void k2SeqExprCast292() { final XQuery query = new XQuery( "xs:byte(xs:float(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(INF) to xs:byte.. */ @org.junit.Test public void k2SeqExprCast293() { final XQuery query = new XQuery( "xs:byte(xs:double(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(NaN) to xs:byte.. */ @org.junit.Test public void k2SeqExprCast294() { final XQuery query = new XQuery( "xs:byte(xs:float(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(NaN) to xs:byte.. */ @org.junit.Test public void k2SeqExprCast295() { final XQuery query = new XQuery( "xs:byte(xs:double(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(-INF) to xs:nonNegativeInteger.. */ @org.junit.Test public void k2SeqExprCast296() { final XQuery query = new XQuery( "xs:nonNegativeInteger(xs:float(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(-INF) to xs:nonNegativeInteger.. */ @org.junit.Test public void k2SeqExprCast297() { final XQuery query = new XQuery( "xs:nonNegativeInteger(xs:double(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(INF) to xs:nonNegativeInteger.. */ @org.junit.Test public void k2SeqExprCast298() { final XQuery query = new XQuery( "xs:nonNegativeInteger(xs:float(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(INF) to xs:nonNegativeInteger.. */ @org.junit.Test public void k2SeqExprCast299() { final XQuery query = new XQuery( "xs:nonNegativeInteger(xs:double(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FOCA0002") || error("XPST0005") ) ); } /** * Pass a small, the smallest if such a limit exists, to nonPositiveInteger.. */ @org.junit.Test public void k2SeqExprCast3() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Cast fn:true() to negativeInteger.. */ @org.junit.Test public void k2SeqExprCast30() { final XQuery query = new XQuery( "xs:negativeInteger(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:float(NaN) to xs:nonNegativeInteger.. */ @org.junit.Test public void k2SeqExprCast300() { final XQuery query = new XQuery( "xs:nonNegativeInteger(xs:float(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(NaN) to xs:nonNegativeInteger.. */ @org.junit.Test public void k2SeqExprCast301() { final XQuery query = new XQuery( "xs:nonNegativeInteger(xs:double(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(-INF) to xs:unsignedLong.. */ @org.junit.Test public void k2SeqExprCast302() { final XQuery query = new XQuery( "xs:unsignedLong(xs:float(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(-INF) to xs:unsignedLong.. */ @org.junit.Test public void k2SeqExprCast303() { final XQuery query = new XQuery( "xs:unsignedLong(xs:double(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(INF) to xs:unsignedLong.. */ @org.junit.Test public void k2SeqExprCast304() { final XQuery query = new XQuery( "xs:unsignedLong(xs:float(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(INF) to xs:unsignedLong.. */ @org.junit.Test public void k2SeqExprCast305() { final XQuery query = new XQuery( "xs:unsignedLong(xs:double(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(NaN) to xs:unsignedLong.. */ @org.junit.Test public void k2SeqExprCast306() { final XQuery query = new XQuery( "xs:unsignedLong(xs:float(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(NaN) to xs:unsignedLong.. */ @org.junit.Test public void k2SeqExprCast307() { final XQuery query = new XQuery( "xs:unsignedLong(xs:double(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(-INF) to xs:unsignedInt.. */ @org.junit.Test public void k2SeqExprCast308() { final XQuery query = new XQuery( "xs:unsignedInt(xs:float(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(-INF) to xs:unsignedInt.. */ @org.junit.Test public void k2SeqExprCast309() { final XQuery query = new XQuery( "xs:unsignedInt(xs:double(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast fn:false() to long.. */ @org.junit.Test public void k2SeqExprCast31() { final XQuery query = new XQuery( "xs:long(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Cast xs:float(INF) to xs:unsignedInt.. */ @org.junit.Test public void k2SeqExprCast310() { final XQuery query = new XQuery( "xs:unsignedInt(xs:float(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(INF) to xs:unsignedInt.. */ @org.junit.Test public void k2SeqExprCast311() { final XQuery query = new XQuery( "xs:unsignedInt(xs:double(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(NaN) to xs:unsignedInt.. */ @org.junit.Test public void k2SeqExprCast312() { final XQuery query = new XQuery( "xs:unsignedInt(xs:float(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(NaN) to xs:unsignedInt.. */ @org.junit.Test public void k2SeqExprCast313() { final XQuery query = new XQuery( "xs:unsignedInt(xs:double(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(-INF) to xs:unsignedShort.. */ @org.junit.Test public void k2SeqExprCast314() { final XQuery query = new XQuery( "xs:unsignedShort(xs:float(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(-INF) to xs:unsignedShort.. */ @org.junit.Test public void k2SeqExprCast315() { final XQuery query = new XQuery( "xs:unsignedShort(xs:double(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(INF) to xs:unsignedShort.. */ @org.junit.Test public void k2SeqExprCast316() { final XQuery query = new XQuery( "xs:unsignedShort(xs:float(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(INF) to xs:unsignedShort.. */ @org.junit.Test public void k2SeqExprCast317() { final XQuery query = new XQuery( "xs:unsignedShort(xs:double(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(NaN) to xs:unsignedShort.. */ @org.junit.Test public void k2SeqExprCast318() { final XQuery query = new XQuery( "xs:unsignedShort(xs:float(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(NaN) to xs:unsignedShort.. */ @org.junit.Test public void k2SeqExprCast319() { final XQuery query = new XQuery( "xs:unsignedShort(xs:double(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast fn:true() to long.. */ @org.junit.Test public void k2SeqExprCast32() { final XQuery query = new XQuery( "xs:long(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Cast xs:float(-INF) to xs:unsignedByte.. */ @org.junit.Test public void k2SeqExprCast320() { final XQuery query = new XQuery( "xs:unsignedByte(xs:float(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(-INF) to xs:unsignedByte.. */ @org.junit.Test public void k2SeqExprCast321() { final XQuery query = new XQuery( "xs:unsignedByte(xs:double(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(INF) to xs:unsignedByte.. */ @org.junit.Test public void k2SeqExprCast322() { final XQuery query = new XQuery( "xs:unsignedByte(xs:float(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(INF) to xs:unsignedByte.. */ @org.junit.Test public void k2SeqExprCast323() { final XQuery query = new XQuery( "xs:unsignedByte(xs:double(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(NaN) to xs:unsignedByte.. */ @org.junit.Test public void k2SeqExprCast324() { final XQuery query = new XQuery( "xs:unsignedByte(xs:float(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(NaN) to xs:unsignedByte.. */ @org.junit.Test public void k2SeqExprCast325() { final XQuery query = new XQuery( "xs:unsignedByte(xs:double(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(-INF) to xs:unsignedInt.. */ @org.junit.Test public void k2SeqExprCast326() { final XQuery query = new XQuery( "xs:unsignedInt(xs:float(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(-INF) to xs:unsignedInt.. */ @org.junit.Test public void k2SeqExprCast327() { final XQuery query = new XQuery( "xs:unsignedInt(xs:double(\"-INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:float(INF) to xs:unsignedInt.. */ @org.junit.Test public void k2SeqExprCast328() { final XQuery query = new XQuery( "xs:unsignedInt(xs:float(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(INF) to xs:unsignedInt.. */ @org.junit.Test public void k2SeqExprCast329() { final XQuery query = new XQuery( "xs:unsignedInt(xs:double(\"INF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast fn:false() to int.. */ @org.junit.Test public void k2SeqExprCast33() { final XQuery query = new XQuery( "xs:int(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Cast xs:float(NaN) to xs:unsignedInt.. */ @org.junit.Test public void k2SeqExprCast330() { final XQuery query = new XQuery( "xs:unsignedInt(xs:float(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * Cast xs:double(NaN) to xs:unsignedInt.. */ @org.junit.Test public void k2SeqExprCast331() { final XQuery query = new XQuery( "xs:unsignedInt(xs:double(\"NaN\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOCA0002") ); } /** * No function by name xs:unsignedInteger exists.. */ @org.junit.Test public void k2SeqExprCast332() { final XQuery query = new XQuery( "xs:unsignedInteger(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Cast xs:byte to xs:double.. */ @org.junit.Test public void k2SeqExprCast333() { final XQuery query = new XQuery( "xs:double(xs:byte(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast xs:int to xs:double.. */ @org.junit.Test public void k2SeqExprCast334() { final XQuery query = new XQuery( "xs:double(xs:int(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast xs:long to xs:double.. */ @org.junit.Test public void k2SeqExprCast335() { final XQuery query = new XQuery( "xs:double(xs:long(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast xs:negativeInteger to xs:double.. */ @org.junit.Test public void k2SeqExprCast336() { final XQuery query = new XQuery( "xs:double(xs:negativeInteger(-3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-3") ); } /** * Cast xs:nonNegativeInteger to xs:double.. */ @org.junit.Test public void k2SeqExprCast337() { final XQuery query = new XQuery( "xs:double(xs:nonNegativeInteger(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast xs:nonPositiveInteger to xs:double.. */ @org.junit.Test public void k2SeqExprCast338() { final XQuery query = new XQuery( "xs:double(xs:nonPositiveInteger(0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Cast xs:short to xs:double.. */ @org.junit.Test public void k2SeqExprCast339() { final XQuery query = new XQuery( "xs:double(xs:short(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast fn:true() to int.. */ @org.junit.Test public void k2SeqExprCast34() { final XQuery query = new XQuery( "xs:int(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Cast xs:unsignedByte to xs:double.. */ @org.junit.Test public void k2SeqExprCast340() { final XQuery query = new XQuery( "xs:double(xs:unsignedByte(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast xs:unsignedInt to xs:double.. */ @org.junit.Test public void k2SeqExprCast341() { final XQuery query = new XQuery( "xs:double(xs:unsignedInt(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast xs:unsignedInt to xs:double.. */ @org.junit.Test public void k2SeqExprCast342() { final XQuery query = new XQuery( "xs:double(xs:unsignedInt(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast xs:unsignedLong to xs:double.. */ @org.junit.Test public void k2SeqExprCast343() { final XQuery query = new XQuery( "xs:double(xs:unsignedLong(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast xs:unsignedShort to xs:double.. */ @org.junit.Test public void k2SeqExprCast344() { final XQuery query = new XQuery( "xs:double(xs:unsignedShort(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast xs:byte to xs:float.. */ @org.junit.Test public void k2SeqExprCast345() { final XQuery query = new XQuery( "xs:float(xs:byte(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast xs:int to xs:float.. */ @org.junit.Test public void k2SeqExprCast346() { final XQuery query = new XQuery( "xs:float(xs:int(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast xs:long to xs:float.. */ @org.junit.Test public void k2SeqExprCast347() { final XQuery query = new XQuery( "xs:float(xs:long(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast xs:negativeInteger to xs:float.. */ @org.junit.Test public void k2SeqExprCast348() { final XQuery query = new XQuery( "xs:float(xs:negativeInteger(-3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-3") ); } /** * Cast xs:nonNegativeInteger to xs:float.. */ @org.junit.Test public void k2SeqExprCast349() { final XQuery query = new XQuery( "xs:float(xs:nonNegativeInteger(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast fn:false() to short.. */ @org.junit.Test public void k2SeqExprCast35() { final XQuery query = new XQuery( "xs:short(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Cast xs:nonPositiveInteger to xs:float.. */ @org.junit.Test public void k2SeqExprCast350() { final XQuery query = new XQuery( "xs:float(xs:nonPositiveInteger(0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Cast xs:short to xs:float.. */ @org.junit.Test public void k2SeqExprCast351() { final XQuery query = new XQuery( "xs:float(xs:short(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast xs:unsignedByte to xs:float.. */ @org.junit.Test public void k2SeqExprCast352() { final XQuery query = new XQuery( "xs:float(xs:unsignedByte(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast xs:unsignedInt to xs:float.. */ @org.junit.Test public void k2SeqExprCast353() { final XQuery query = new XQuery( "xs:float(xs:unsignedInt(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast xs:unsignedInt to xs:float.. */ @org.junit.Test public void k2SeqExprCast354() { final XQuery query = new XQuery( "xs:float(xs:unsignedInt(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast xs:unsignedLong to xs:float.. */ @org.junit.Test public void k2SeqExprCast355() { final XQuery query = new XQuery( "xs:float(xs:unsignedLong(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast xs:unsignedShort to xs:float.. */ @org.junit.Test public void k2SeqExprCast356() { final XQuery query = new XQuery( "xs:float(xs:unsignedShort(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast xs:byte to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast357() { final XQuery query = new XQuery( "xs:decimal(xs:byte(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast xs:int to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast358() { final XQuery query = new XQuery( "xs:decimal(xs:int(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast xs:long to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast359() { final XQuery query = new XQuery( "xs:decimal(xs:long(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast fn:true() to short.. */ @org.junit.Test public void k2SeqExprCast36() { final XQuery query = new XQuery( "xs:short(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Cast xs:negativeInteger to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast360() { final XQuery query = new XQuery( "xs:decimal(xs:negativeInteger(-3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-3") ); } /** * Cast xs:nonNegativeInteger to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast361() { final XQuery query = new XQuery( "xs:decimal(xs:nonNegativeInteger(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast xs:nonPositiveInteger to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast362() { final XQuery query = new XQuery( "xs:decimal(xs:nonPositiveInteger(0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Cast xs:short to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast363() { final XQuery query = new XQuery( "xs:decimal(xs:short(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast xs:unsignedByte to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast364() { final XQuery query = new XQuery( "xs:decimal(xs:unsignedByte(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast xs:unsignedInt to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast365() { final XQuery query = new XQuery( "xs:decimal(xs:unsignedInt(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast xs:unsignedInt to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast366() { final XQuery query = new XQuery( "xs:decimal(xs:unsignedInt(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast xs:unsignedLong to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast367() { final XQuery query = new XQuery( "xs:decimal(xs:unsignedLong(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast xs:unsignedShort to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast368() { final XQuery query = new XQuery( "xs:decimal(xs:unsignedShort(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Cast xs:byte to xs:string.. */ @org.junit.Test public void k2SeqExprCast369() { final XQuery query = new XQuery( "xs:string(xs:byte(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Cast fn:false() to byte.. */ @org.junit.Test public void k2SeqExprCast37() { final XQuery query = new XQuery( "xs:byte(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Cast xs:int to xs:string.. */ @org.junit.Test public void k2SeqExprCast370() { final XQuery query = new XQuery( "xs:string(xs:int(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Cast xs:long to xs:string.. */ @org.junit.Test public void k2SeqExprCast371() { final XQuery query = new XQuery( "xs:string(xs:long(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Cast xs:negativeInteger to xs:string.. */ @org.junit.Test public void k2SeqExprCast372() { final XQuery query = new XQuery( "xs:string(xs:negativeInteger(-3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-3") ); } /** * Cast xs:nonNegativeInteger to xs:string.. */ @org.junit.Test public void k2SeqExprCast373() { final XQuery query = new XQuery( "xs:string(xs:nonNegativeInteger(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Cast xs:nonPositiveInteger to xs:string.. */ @org.junit.Test public void k2SeqExprCast374() { final XQuery query = new XQuery( "xs:string(xs:nonPositiveInteger(0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Cast xs:short to xs:string.. */ @org.junit.Test public void k2SeqExprCast375() { final XQuery query = new XQuery( "xs:string(xs:short(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Cast xs:unsignedByte to xs:string.. */ @org.junit.Test public void k2SeqExprCast376() { final XQuery query = new XQuery( "xs:string(xs:unsignedByte(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Cast xs:unsignedInt to xs:string.. */ @org.junit.Test public void k2SeqExprCast377() { final XQuery query = new XQuery( "xs:string(xs:unsignedInt(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Cast xs:unsignedInt to xs:string.. */ @org.junit.Test public void k2SeqExprCast378() { final XQuery query = new XQuery( "xs:string(xs:unsignedInt(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Cast xs:unsignedLong to xs:string.. */ @org.junit.Test public void k2SeqExprCast379() { final XQuery query = new XQuery( "xs:string(xs:unsignedLong(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Cast fn:true() to byte.. */ @org.junit.Test public void k2SeqExprCast38() { final XQuery query = new XQuery( "xs:byte(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Cast xs:unsignedShort to xs:string.. */ @org.junit.Test public void k2SeqExprCast380() { final XQuery query = new XQuery( "xs:string(xs:unsignedShort(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Cast xs:byte to xs:untypedAtomic.. */ @org.junit.Test public void k2SeqExprCast381() { final XQuery query = new XQuery( "xs:untypedAtomic(xs:byte(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Cast xs:int to xs:untypedAtomic.. */ @org.junit.Test public void k2SeqExprCast382() { final XQuery query = new XQuery( "xs:untypedAtomic(xs:int(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Cast xs:long to xs:untypedAtomic.. */ @org.junit.Test public void k2SeqExprCast383() { final XQuery query = new XQuery( "xs:untypedAtomic(xs:long(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Cast xs:negativeInteger to xs:untypedAtomic.. */ @org.junit.Test public void k2SeqExprCast384() { final XQuery query = new XQuery( "xs:untypedAtomic(xs:negativeInteger(-3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-3") ); } /** * Cast xs:nonNegativeInteger to xs:untypedAtomic.. */ @org.junit.Test public void k2SeqExprCast385() { final XQuery query = new XQuery( "xs:untypedAtomic(xs:nonNegativeInteger(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Cast xs:nonPositiveInteger to xs:untypedAtomic.. */ @org.junit.Test public void k2SeqExprCast386() { final XQuery query = new XQuery( "xs:untypedAtomic(xs:nonPositiveInteger(0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * Cast xs:short to xs:untypedAtomic.. */ @org.junit.Test public void k2SeqExprCast387() { final XQuery query = new XQuery( "xs:untypedAtomic(xs:short(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Cast xs:unsignedByte to xs:untypedAtomic.. */ @org.junit.Test public void k2SeqExprCast388() { final XQuery query = new XQuery( "xs:untypedAtomic(xs:unsignedByte(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Cast xs:unsignedInt to xs:untypedAtomic.. */ @org.junit.Test public void k2SeqExprCast389() { final XQuery query = new XQuery( "xs:untypedAtomic(xs:unsignedInt(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Cast fn:false() to nonNegativeInteger.. */ @org.junit.Test public void k2SeqExprCast39() { final XQuery query = new XQuery( "xs:nonNegativeInteger(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Cast xs:unsignedInt to xs:untypedAtomic.. */ @org.junit.Test public void k2SeqExprCast390() { final XQuery query = new XQuery( "xs:untypedAtomic(xs:unsignedInt(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Cast xs:unsignedLong to xs:untypedAtomic.. */ @org.junit.Test public void k2SeqExprCast391() { final XQuery query = new XQuery( "xs:untypedAtomic(xs:unsignedLong(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Cast xs:unsignedShort to xs:untypedAtomic.. */ @org.junit.Test public void k2SeqExprCast392() { final XQuery query = new XQuery( "xs:untypedAtomic(xs:unsignedShort(3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Cast xs:unsignedShort to xs:untypedAtomic.. */ @org.junit.Test public void k2SeqExprCast393() { final XQuery query = new XQuery( "xs:untypedAtomic(xs:normalizedString(\"foo\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "foo") ); } /** * Cast xs:token to xs:untypedAtomic.. */ @org.junit.Test public void k2SeqExprCast394() { final XQuery query = new XQuery( "xs:untypedAtomic(xs:token(\"foo\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "foo") ); } /** * Cast xs:language to xs:untypedAtomic.. */ @org.junit.Test public void k2SeqExprCast395() { final XQuery query = new XQuery( "xs:untypedAtomic(xs:language(\"foo\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "foo") ); } /** * Cast xs:NMTOKEN to xs:untypedAtomic.. */ @org.junit.Test public void k2SeqExprCast396() { final XQuery query = new XQuery( "xs:untypedAtomic(xs:NMTOKEN(\"foo\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "foo") ); } /** * Cast xs:Name to xs:untypedAtomic.. */ @org.junit.Test public void k2SeqExprCast397() { final XQuery query = new XQuery( "xs:untypedAtomic(xs:Name(\"foo\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "foo") ); } /** * Cast xs:NCName to xs:untypedAtomic.. */ @org.junit.Test public void k2SeqExprCast398() { final XQuery query = new XQuery( "xs:untypedAtomic(xs:NCName(\"foo\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "foo") ); } /** * Cast xs:ID to xs:untypedAtomic.. */ @org.junit.Test public void k2SeqExprCast399() { final XQuery query = new XQuery( "xs:untypedAtomic(xs:ID(\"foo\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "foo") ); } /** * Pass a small, the smallest if such a limit exists, to negativeInteger.. */ @org.junit.Test public void k2SeqExprCast4() { final XQuery query = new XQuery( "xs:negativeInteger(\"-1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Cast fn:true() to nonNegativeInteger.. */ @org.junit.Test public void k2SeqExprCast40() { final XQuery query = new XQuery( "xs:nonNegativeInteger(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Cast xs:IDREF to xs:untypedAtomic.. */ @org.junit.Test public void k2SeqExprCast400() { final XQuery query = new XQuery( "xs:untypedAtomic(xs:IDREF(\"foo\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "foo") ); } /** * Cast xs:ENTITY to xs:untypedAtomic.. */ @org.junit.Test public void k2SeqExprCast401() { final XQuery query = new XQuery( "xs:untypedAtomic(xs:ENTITY(\"foo\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "foo") ); } /** * Cast xs:unsignedShort to xs:string.. */ @org.junit.Test public void k2SeqExprCast402() { final XQuery query = new XQuery( "xs:string(xs:normalizedString(\"foo\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "foo") ); } /** * Cast xs:token to xs:string.. */ @org.junit.Test public void k2SeqExprCast403() { final XQuery query = new XQuery( "xs:string(xs:token(\"foo\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "foo") ); } /** * Cast xs:language to xs:string.. */ @org.junit.Test public void k2SeqExprCast404() { final XQuery query = new XQuery( "xs:string(xs:language(\"foo\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "foo") ); } /** * Cast xs:NMTOKEN to xs:string.. */ @org.junit.Test public void k2SeqExprCast405() { final XQuery query = new XQuery( "xs:string(xs:NMTOKEN(\"foo\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "foo") ); } /** * Cast xs:Name to xs:string.. */ @org.junit.Test public void k2SeqExprCast406() { final XQuery query = new XQuery( "xs:string(xs:Name(\"foo\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "foo") ); } /** * Cast xs:NCName to xs:string.. */ @org.junit.Test public void k2SeqExprCast407() { final XQuery query = new XQuery( "xs:string(xs:NCName(\"foo\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "foo") ); } /** * Cast xs:ID to xs:string.. */ @org.junit.Test public void k2SeqExprCast408() { final XQuery query = new XQuery( "xs:string(xs:ID(\"foo\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "foo") ); } /** * Cast xs:IDREF to xs:string.. */ @org.junit.Test public void k2SeqExprCast409() { final XQuery query = new XQuery( "xs:string(xs:IDREF(\"foo\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "foo") ); } /** * Cast fn:false() to unsignedLong.. */ @org.junit.Test public void k2SeqExprCast41() { final XQuery query = new XQuery( "xs:unsignedLong(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Cast xs:ENTITY to xs:string.. */ @org.junit.Test public void k2SeqExprCast410() { final XQuery query = new XQuery( "xs:string(xs:ENTITY(\"foo\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "foo") ); } /** * Cast "a" to xs:language.. */ @org.junit.Test public void k2SeqExprCast411() { final XQuery query = new XQuery( "xs:language(\"a\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a") ); } /** * Cast "ab" to xs:language.. */ @org.junit.Test public void k2SeqExprCast412() { final XQuery query = new XQuery( "xs:language(\"ab\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ab") ); } /** * Cast "abc" to xs:language.. */ @org.junit.Test public void k2SeqExprCast413() { final XQuery query = new XQuery( "xs:language(\"abc\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc") ); } /** * Cast "abcd" to xs:language.. */ @org.junit.Test public void k2SeqExprCast414() { final XQuery query = new XQuery( "xs:language(\"abcd\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcd") ); } /** * Cast "abcde" to xs:language.. */ @org.junit.Test public void k2SeqExprCast415() { final XQuery query = new XQuery( "xs:language(\"abcde\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcde") ); } /** * Cast "abcdef" to xs:language.. */ @org.junit.Test public void k2SeqExprCast416() { final XQuery query = new XQuery( "xs:language(\"abcdef\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcdef") ); } /** * Cast "abcdefg" to xs:language.. */ @org.junit.Test public void k2SeqExprCast417() { final XQuery query = new XQuery( "xs:language(\"abcdefg\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcdefg") ); } /** * Cast "abcdefgh" to xs:language.. */ @org.junit.Test public void k2SeqExprCast418() { final XQuery query = new XQuery( "xs:language(\"abcdefgh\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcdefgh") ); } /** * Cast "abcdefgh-abcdefgh" to xs:language.. */ @org.junit.Test public void k2SeqExprCast419() { final XQuery query = new XQuery( "xs:language(\"abcdefgh-abcdefgh\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abcdefgh-abcdefgh") ); } /** * Cast fn:true() to unsignedLong.. */ @org.junit.Test public void k2SeqExprCast42() { final XQuery query = new XQuery( "xs:unsignedLong(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * The whitespace facet for xs:anyURI is collapse.. */ @org.junit.Test public void k2SeqExprCast420() { final XQuery query = new XQuery( "xs:anyURI(\" http://example.com/ foo.xml \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.com/ foo.xml") ); } /** * Pass an invalid anyURI.. */ @org.junit.Test public void k2SeqExprCast421() { final XQuery query = new XQuery( "xs:anyURI(\"foo://\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "foo://") || assertStringValue(false, "foo:") || error("FORG0001") ) ); } /** * Pass an invalid anyURI(#2).. */ @org.junit.Test public void k2SeqExprCast422() { final XQuery query = new XQuery( "xs:anyURI(\"%gg\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * An URI without scheme.. */ @org.junit.Test public void k2SeqExprCast423() { final XQuery query = new XQuery( "xs:anyURI(\":/cut.jpg\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * An URI without scheme, combined with a relative directory.. */ @org.junit.Test public void k2SeqExprCast424() { final XQuery query = new XQuery( "xs:anyURI(\":/images/cut.png\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Serialize a set of xs:QName instances.. */ @org.junit.Test public void k2SeqExprCast425() { final XQuery query = new XQuery( "\"START\", \n" + " \t\tQName(\"http://example.com\", \"prefix:localName\"), \n" + " \t\tQName(\"http://example.com\", \"localName\"), \n" + " \t\tQName(\"http://example.com\", \"localName\"), \n" + " \t\tQName(\"\", \"localName\"), QName((), \"localName\"), \n" + " \t\t\"END\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("START prefix:localName localName localName localName localName END", false) ); } /** * Cast a set of QName to xs:string.. */ @org.junit.Test public void k2SeqExprCast426() { final XQuery query = new XQuery( "\"START\", \n" + " \tstring(QName(\"http://example.com\", \n" + " \t\"prefix:localName\")), \n" + " \tstring(QName(\"http://example.com\", \"localName\")), \n" + " \tstring(QName(\"http://example.com\", \"localName\")), \n" + " \tstring(QName(\"\", \"localName\")), \n" + " \tstring(QName((), \"localName\")), \n" + " \t\"END\" ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("START prefix:localName localName localName localName localName END", false) ); } /** * Use a relative URI with double slashes.. */ @org.junit.Test public void k2SeqExprCast427() { final XQuery query = new XQuery( "xs:anyURI(\"//server/share/dir1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "//server/share/dir1") ); } /** * A relatively large negative number, fed to xs:unsignedLong.. */ @org.junit.Test public void k2SeqExprCast428() { final XQuery query = new XQuery( "xs:unsignedLong(\"-9876\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("11:-1:11"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast429() { final XQuery query = new XQuery( "xs:time(\"11:-1:11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast fn:false() to unsignedInt.. */ @org.junit.Test public void k2SeqExprCast43() { final XQuery query = new XQuery( "xs:unsignedInt(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Cast xs:time("11:+1:11"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast430() { final XQuery query = new XQuery( "xs:time(\"11:+1:11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("11: 1:11"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast431() { final XQuery query = new XQuery( "xs:time(\"11: 1:11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("11:11:-1"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast432() { final XQuery query = new XQuery( "xs:time(\"11:11:-1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("11:11:-1"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast433() { final XQuery query = new XQuery( "xs:time(\"11:11:-1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("11:11:+1"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast434() { final XQuery query = new XQuery( "xs:time(\"11:11:+1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("11:11: 1"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast435() { final XQuery query = new XQuery( "xs:time(\"11:11: 1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("-1:11:11"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast436() { final XQuery query = new XQuery( "xs:time(\"-1:11:11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("+1:11:11"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast437() { final XQuery query = new XQuery( "xs:time(\"+1:11:11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("+1:11:11"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast438() { final XQuery query = new XQuery( "xs:time(\"+1:11:11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("11:11:1e0"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast439() { final XQuery query = new XQuery( "xs:time(\"11:11:1e0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast fn:true() to unsignedInt.. */ @org.junit.Test public void k2SeqExprCast44() { final XQuery query = new XQuery( "xs:unsignedInt(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Cast xs:time("11:11:1E0"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast440() { final XQuery query = new XQuery( "xs:time(\"11:11:1E0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("11:11:1b0"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast441() { final XQuery query = new XQuery( "xs:time(\"11:11:1b0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("11:11: 10"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast442() { final XQuery query = new XQuery( "xs:time(\"11:11: 10\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("11:11:11b33"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast443() { final XQuery query = new XQuery( "xs:time(\"11:11:11b33\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("11:11:111"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast444() { final XQuery query = new XQuery( "xs:time(\"11:11:111\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("11:11:11.+11"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast445() { final XQuery query = new XQuery( "xs:time(\"11:11:11.+11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("11:11:11.-11"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast446() { final XQuery query = new XQuery( "xs:time(\"11:11:11.-11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("11:11:11. 11"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast447() { final XQuery query = new XQuery( "xs:time(\"11:11:11. 11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("24:00:00.1"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast448() { final XQuery query = new XQuery( "xs:time(\"24:00:00.1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("24:01:00"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast449() { final XQuery query = new XQuery( "xs:time(\"24:01:00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast fn:false() to unsignedShort.. */ @org.junit.Test public void k2SeqExprCast45() { final XQuery query = new XQuery( "xs:unsignedShort(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Cast xs:time("24:00:01"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast450() { final XQuery query = new XQuery( "xs:time(\"24:00:01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("11:11:11++1:11"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast451() { final XQuery query = new XQuery( "xs:time(\"11:11:11++1:11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("11:11:11+-1:11"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast452() { final XQuery query = new XQuery( "xs:time(\"11:11:11+-1:11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("11:11:11+ 1:11"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast453() { final XQuery query = new XQuery( "xs:time(\"11:11:11+ 1:11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("11:11:11+11:+1"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast454() { final XQuery query = new XQuery( "xs:time(\"11:11:11+11:+1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("11:11:11+11:-1"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast455() { final XQuery query = new XQuery( "xs:time(\"11:11:11+11:-1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("11:11:11+11: 1"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast456() { final XQuery query = new XQuery( "xs:time(\"11:11:11+11: 1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("11"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast457() { final XQuery query = new XQuery( "xs:time(\"11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("1 :11:11"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast458() { final XQuery query = new XQuery( "xs:time(\"1 :11:11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time("11:11:1 "), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast459() { final XQuery query = new XQuery( "xs:time(\"11:11:1 \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast fn:true() to unsignedShort.. */ @org.junit.Test public void k2SeqExprCast46() { final XQuery query = new XQuery( "xs:unsignedShort(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Cast xs:date("+2002-12-11"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast460() { final XQuery query = new XQuery( "xs:date(\"+2002-12-11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:date(" 111-11-11"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast461() { final XQuery query = new XQuery( "xs:date(\" 111-11-11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:date(" +11-11-11"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast462() { final XQuery query = new XQuery( "xs:date(\" +11-11-11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:date("1111- 1-11"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast463() { final XQuery query = new XQuery( "xs:date(\"1111- 1-11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:date("-111-11-11"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast464() { final XQuery query = new XQuery( "xs:date(\"-111-11-11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:date("+111-11-11"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast465() { final XQuery query = new XQuery( "xs:date(\"+111-11-11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:date("1111-11- 1"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast466() { final XQuery query = new XQuery( "xs:date(\"1111-11- 1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:date("1111-+1-11"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast467() { final XQuery query = new XQuery( "xs:date(\"1111-+1-11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:date("1111-11-+1"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast468() { final XQuery query = new XQuery( "xs:date(\"1111-11-+1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:date("1111--1-11"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast469() { final XQuery query = new XQuery( "xs:date(\"1111--1-11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast fn:false() to unsignedByte.. */ @org.junit.Test public void k2SeqExprCast47() { final XQuery query = new XQuery( "xs:unsignedByte(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Cast xs:date("1111-11--1"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast470() { final XQuery query = new XQuery( "xs:date(\"1111-11--1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:date("1111-11-1F"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast471() { final XQuery query = new XQuery( "xs:date(\"1111-11-1F\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:date("0x10-11-11"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast472() { final XQuery query = new XQuery( "xs:date(\"0x10-11-11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:date("111 -11-11"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast473() { final XQuery query = new XQuery( "xs:date(\"111 -11-11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:date("1111-1 -11"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast474() { final XQuery query = new XQuery( "xs:date(\"1111-1 -11\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:date("1111-11-1 "), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast475() { final XQuery query = new XQuery( "xs:date(\"1111-11-1 \")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:dateTime("2002-11-23"), which is an invalid lexical representation.. */ @org.junit.Test public void k2SeqExprCast476() { final XQuery query = new XQuery( "xs:dateTime(\"2002-11-23\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Serialize xs:gYear("0040").. */ @org.junit.Test public void k2SeqExprCast477() { final XQuery query = new XQuery( "xs:gYear(\"0040\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0040") ); } /** * Serialize xs:gYearMonth("0040-01").. */ @org.junit.Test public void k2SeqExprCast478() { final XQuery query = new XQuery( "xs:gYearMonth(\"0040-01\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0040-01") ); } /** * Cast to xs:QName, using a namespace from an element constructor.. */ @org.junit.Test public void k2SeqExprCast479() { final XQuery query = new XQuery( " { xs:QName(\"prefix:localName\") } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("prefix:localName", false) ); } /** * Cast fn:true() to unsignedByte.. */ @org.junit.Test public void k2SeqExprCast48() { final XQuery query = new XQuery( "xs:unsignedByte(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * All primitives in one query. Sub-types of xs:decimal. Sub-types of xs:decimal. Sub-types of xs:string. */ @org.junit.Test public void k2SeqExprCast480() { final XQuery query = new XQuery( "xs:untypedAtomic(\"xs:untypedAtomic\"), xs:dateTime(\"2002-10-10T23:02:12Z\"), xs:date(\"2002-10-10Z\"), xs:time(\"23:02:12Z\"),\n" + " xs:duration(\"P12M\"), xs:dayTimeDuration(\"PT1S\"), xs:yearMonthDuration(\"P1M\"), xs:float(\"3e3\"), xs:double(\"4e4\"),\n" + " xs:decimal(\"2.0\"), xs:integer(\"16\"), xs:nonPositiveInteger(\"0\"), xs:negativeInteger(\"-4\"), xs:long(\"5\"),\n" + " xs:int(\"6\"), xs:short(\"7\"), xs:byte(\"8\"), xs:nonNegativeInteger(\"9\"), xs:unsignedLong(\"10\"),\n" + " xs:unsignedInt(\"11\"), xs:unsignedShort(\"12\"), xs:unsignedByte(\"13\"), xs:positiveInteger(\"14\"),\n" + " xs:gYearMonth(\"1976-02Z\"), xs:gYear(\"2005-12:00\"), xs:gMonthDay(\"--12-25-14:00\"),\n" + " xs:gDay(\"---25-14:00\"), xs:gMonth(\"--12-14:00\"), xs:boolean(\"true\"), xs:base64Binary(\"aaaa\"),\n" + " xs:hexBinary(\"FFFF\"), xs:anyURI(\"http://example.com/\"), xs:QName(\"localName\"),\n" + " xs:string(\"An xs:string\"), xs:normalizedString(\"normalizedString\"), xs:token(\"token\"),\n" + " xs:language(\"language\"), xs:NMTOKEN(\"NMTOKEN\"), xs:Name(\"Name\"), xs:NCName(\"NCName\"),\n" + " xs:ID(\"ID\"), xs:IDREF(\"IDREF\"), xs:ENTITY(\"ENTITY\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(true, "\n xs:untypedAtomic 2002-10-10T23:02:12Z 2002-10-10Z 23:02:12Z P1Y PT1S P1M 3000 40000 2 16 0\n -4 5 6 7 8 9 10 11 12 13 14 1976-02Z 2005-12:00 --12-25-14:00 ---25-14:00 --12-14:00 true\n aaaa FFFF http://example.com/ localName An xs:string normalizedString token language\n NMTOKEN Name NCName ID IDREF ENTITY") ); } /** * Try to cast inf to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast481() { final XQuery query = new XQuery( "\"inf\" cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try to cast 'inF' to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast482() { final XQuery query = new XQuery( "\"inF\" cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try to cast '-inF' to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast483() { final XQuery query = new XQuery( "\"-inF\" cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try to cast 'inF ' to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast484() { final XQuery query = new XQuery( "\"inF \" cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try to cast '-inF(space)' to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast485() { final XQuery query = new XQuery( "\"-inF \" cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try to cast 'naN' to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast486() { final XQuery query = new XQuery( "\"naN\" cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Try to cast ' naN' to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast487() { final XQuery query = new XQuery( "\" naN\" cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:QName to xs:language.. */ @org.junit.Test public void k2SeqExprCast488() { final XQuery query = new XQuery( "xs:language(QName(\"http://example.com/\", \"p:localName\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:base64Binary to xs:language.. */ @org.junit.Test public void k2SeqExprCast489() { final XQuery query = new XQuery( "xs:language(xs:base64Binary(\"1111\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast fn:false() to positiveInteger.. */ @org.junit.Test public void k2SeqExprCast49() { final XQuery query = new XQuery( "xs:positiveInteger(false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:hexBinary to xs:language.. */ @org.junit.Test public void k2SeqExprCast490() { final XQuery query = new XQuery( "xs:language(xs:hexBinary(\"11\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:gMonth to xs:language.. */ @org.junit.Test public void k2SeqExprCast491() { final XQuery query = new XQuery( "xs:language(xs:gMonth(\"--10\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:gDay to xs:language.. */ @org.junit.Test public void k2SeqExprCast492() { final XQuery query = new XQuery( "xs:language(xs:gDay(\"---11\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:gMonthDay to xs:language.. */ @org.junit.Test public void k2SeqExprCast493() { final XQuery query = new XQuery( "xs:language(xs:gMonthDay(\"--10-15\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:gYear to xs:language.. */ @org.junit.Test public void k2SeqExprCast494() { final XQuery query = new XQuery( "xs:language(xs:gYear(\"4004\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:integer to xs:language.. */ @org.junit.Test public void k2SeqExprCast495() { final XQuery query = new XQuery( "xs:language(xs:integer(\"543\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:decimal to xs:language.. */ @org.junit.Test public void k2SeqExprCast496() { final XQuery query = new XQuery( "xs:language(xs:decimal(\"543\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:double to xs:language.. */ @org.junit.Test public void k2SeqExprCast497() { final XQuery query = new XQuery( "xs:language(xs:double(\"543\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:float to xs:language.. */ @org.junit.Test public void k2SeqExprCast498() { final XQuery query = new XQuery( "xs:language(xs:float(\"543\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:time to xs:language.. */ @org.junit.Test public void k2SeqExprCast499() { final XQuery query = new XQuery( "xs:language(current-time())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass a small, the smallest if such a limit exists, to long.. */ @org.junit.Test public void k2SeqExprCast5() { final XQuery query = new XQuery( "xs:long(\"9223372036854775807\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("9223372036854775807") ); } /** * Cast fn:true() to positiveInteger.. */ @org.junit.Test public void k2SeqExprCast50() { final XQuery query = new XQuery( "xs:positiveInteger(true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Cast xs:date to xs:language.. */ @org.junit.Test public void k2SeqExprCast500() { final XQuery query = new XQuery( "xs:language(current-date())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:duration to xs:language.. */ @org.junit.Test public void k2SeqExprCast501() { final XQuery query = new XQuery( "xs:language(xs:duration(\"P1M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:dayTimeDuration to xs:language.. */ @org.junit.Test public void k2SeqExprCast502() { final XQuery query = new XQuery( "xs:language(xs:dayTimeDuration(\"P1DT4H\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast xs:yearMonthDuration to xs:language.. */ @org.junit.Test public void k2SeqExprCast503() { final XQuery query = new XQuery( "xs:language(xs:yearMonthDuration(\"P4Y5M\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Use a series of corner case Unicode codepoints.. */ @org.junit.Test public void k2SeqExprCast504() { final XQuery query = new XQuery( "xs:NCName(codepoints-to-string((3648, 3592, 3617, 3626, 3660)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "เจมส์") ); } /** * ':/' is an invalid URI, no scheme.. */ @org.junit.Test public void k2SeqExprCast505() { final XQuery query = new XQuery( "xs:anyURI(\":/\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast invalid gMonth.. */ @org.junit.Test public void k2SeqExprCast506() { final XQuery query = new XQuery( "xs:gMonth(\"--02--\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast inF to xs:float.. */ @org.junit.Test public void k2SeqExprCast507() { final XQuery query = new XQuery( "xs:float(\"inF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast inF to xs:double.. */ @org.junit.Test public void k2SeqExprCast508() { final XQuery query = new XQuery( "xs:double(\"inF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast inF to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast509() { final XQuery query = new XQuery( "xs:decimal(\"inF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * -0 is an invalid value for xs:negativeInteger.. */ @org.junit.Test public void k2SeqExprCast51() { final XQuery query = new XQuery( "xs:negativeInteger(\"-0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast inf to xs:float.. */ @org.junit.Test public void k2SeqExprCast510() { final XQuery query = new XQuery( "xs:float(\"inf\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast inf to xs:double.. */ @org.junit.Test public void k2SeqExprCast511() { final XQuery query = new XQuery( "xs:double(\"inf\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast inf to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast512() { final XQuery query = new XQuery( "xs:decimal(\"inf\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast InF to xs:float.. */ @org.junit.Test public void k2SeqExprCast513() { final XQuery query = new XQuery( "xs:float(\"InF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast InF to xs:double.. */ @org.junit.Test public void k2SeqExprCast514() { final XQuery query = new XQuery( "xs:double(\"InF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast InF to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast515() { final XQuery query = new XQuery( "xs:decimal(\"InF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast -InF to xs:float.. */ @org.junit.Test public void k2SeqExprCast516() { final XQuery query = new XQuery( "xs:float(\"-InF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast -InF to xs:double.. */ @org.junit.Test public void k2SeqExprCast517() { final XQuery query = new XQuery( "xs:double(\"-InF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast -InF to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast518() { final XQuery query = new XQuery( "xs:decimal(\"-InF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast +InF to xs:float.. */ @org.junit.Test public void k2SeqExprCast519() { final XQuery query = new XQuery( "xs:float(\"+InF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * The minus sign is allowed unsignedLong. * S4S is considered normative, and XSD 1.1 adjusted the prose to say the same.. */ @org.junit.Test public void k2SeqExprCast52() { final XQuery query = new XQuery( "xs:unsignedLong(\"-0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Cast +InF to xs:double.. */ @org.junit.Test public void k2SeqExprCast520() { final XQuery query = new XQuery( "xs:double(\"+InF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast +InF to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast521() { final XQuery query = new XQuery( "xs:decimal(\"+InF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast naN to xs:float.. */ @org.junit.Test public void k2SeqExprCast522() { final XQuery query = new XQuery( "xs:float(\"naN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast naN to xs:double.. */ @org.junit.Test public void k2SeqExprCast523() { final XQuery query = new XQuery( "xs:double(\"naN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast naN to xs:decimal.. */ @org.junit.Test public void k2SeqExprCast524() { final XQuery query = new XQuery( "xs:decimal(\"naN\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * The minus sign is allowed unsignedInt. * S4S is considered normative, and XSD 1.1 adjusted the prose to say the same.. */ @org.junit.Test public void k2SeqExprCast53() { final XQuery query = new XQuery( "xs:unsignedInt(\"-0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * The minus sign is allowed unsignedShort. * S4S is considered normative, and XSD 1.1 adjusted the prose to say the same.. */ @org.junit.Test public void k2SeqExprCast54() { final XQuery query = new XQuery( "xs:unsignedShort(\"-0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * The minus sign is allowed in unsignedByte. * S4S is considered normative, and XSD 1.1 adjusted the prose to say the same.. */ @org.junit.Test public void k2SeqExprCast55() { final XQuery query = new XQuery( "xs:unsignedByte(\"-0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * The minus sign is prohibited in positiveInteger.. */ @org.junit.Test public void k2SeqExprCast56() { final XQuery query = new XQuery( "xs:positiveInteger(\"-0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * The minus sign is prohibited in positiveInteger.. */ @org.junit.Test public void k2SeqExprCast57() { final XQuery query = new XQuery( "xs:positiveInteger(\"-1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * The plus sign is allowed in unsignedLong. * S4S is considered normative, and XSD 1.1 adjusted the prose to say the same.. */ @org.junit.Test public void k2SeqExprCast58() { final XQuery query = new XQuery( "xs:unsignedLong(\"+0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * The plus sign is allowed in unsignedInt. * S4S is considered normative, and XSD 1.1 adjusted the prose to say the same.. */ @org.junit.Test public void k2SeqExprCast59() { final XQuery query = new XQuery( "xs:unsignedInt(\"+0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Pass a small, the smallest if such a limit exists, to int.. */ @org.junit.Test public void k2SeqExprCast6() { final XQuery query = new XQuery( "xs:int(\"2147483647\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2147483647") ); } /** * The plus sign is allowed in unsignedShort. * S4S is considered normative, and XSD 1.1 adjusted the prose to say the same.. */ @org.junit.Test public void k2SeqExprCast60() { final XQuery query = new XQuery( "xs:unsignedShort(\"+0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * The plus sign is allowed in unsignedByte. * S4S is considered normative, and XSD 1.1 adjusted the prose to say the same.. */ @org.junit.Test public void k2SeqExprCast61() { final XQuery query = new XQuery( "xs:unsignedByte(\"+0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * The plus sign is prohibited in negativeInteger.. */ @org.junit.Test public void k2SeqExprCast62() { final XQuery query = new XQuery( "xs:negativeInteger(\"+0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * The plus sign is prohibited in nonPositiveInteger.. */ @org.junit.Test public void k2SeqExprCast63() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"+1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * The minus sign is allowed in nonNegativeInteger.. */ @org.junit.Test public void k2SeqExprCast64() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"-0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * The minus sign is allowed in negativeInteger.. */ @org.junit.Test public void k2SeqExprCast65() { final XQuery query = new XQuery( "xs:negativeInteger(\"-1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * The minus sign is allowed in nonPositiveInteger.. */ @org.junit.Test public void k2SeqExprCast66() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * The minus sign is allowed in nonPositiveInteger(#2).. */ @org.junit.Test public void k2SeqExprCast67() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"-1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-1") ); } /** * Ensure a plus sign is accepted for positiveInteger.. */ @org.junit.Test public void k2SeqExprCast68() { final XQuery query = new XQuery( "xs:positiveInteger(\"+1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Ensure a plus sign is accepted for nonNegativeInteger.. */ @org.junit.Test public void k2SeqExprCast69() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"+1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Pass a small, the smallest if such a limit exists, to short.. */ @org.junit.Test public void k2SeqExprCast7() { final XQuery query = new XQuery( "xs:short(\"-32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-32768") ); } /** * Ensure a plus sign is accepted for nonPositiveInteger.. */ @org.junit.Test public void k2SeqExprCast70() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"+0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Multiple minus signs is disallowed in nonNegativeInteger.. */ @org.junit.Test public void k2SeqExprCast71() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"--0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Multiple minus signs is disallowed in negativeInteger.. */ @org.junit.Test public void k2SeqExprCast72() { final XQuery query = new XQuery( "xs:negativeInteger(\"--1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Multiple minus signs is disallowed in nonPositiveInteger.. */ @org.junit.Test public void k2SeqExprCast73() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"--0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Multiple minus signs is disallowed in nonPositiveInteger(#2).. */ @org.junit.Test public void k2SeqExprCast74() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"--1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Multiple plus signs is allowed in positiveInteger.. */ @org.junit.Test public void k2SeqExprCast75() { final XQuery query = new XQuery( "xs:positiveInteger(\"++1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Multiple plus signs is allowed in nonNegativeInteger.. */ @org.junit.Test public void k2SeqExprCast76() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"++1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Multiple plus signs is allowed in nonPositiveInteger.. */ @org.junit.Test public void k2SeqExprCast77() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"++0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a too small value to long.. */ @org.junit.Test public void k2SeqExprCast78() { final XQuery query = new XQuery( "xs:long(\"-9223372036854775809\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FORG0001") || error("FOAR0002") ) ); } /** * Cast a too small value to int.. */ @org.junit.Test public void k2SeqExprCast79() { final XQuery query = new XQuery( "xs:int(\"-2147483649\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass a small, the smallest if such a limit exists, to byte.. */ @org.junit.Test public void k2SeqExprCast8() { final XQuery query = new XQuery( "xs:byte(\"-128\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-128") ); } /** * Cast a too small value to short.. */ @org.junit.Test public void k2SeqExprCast80() { final XQuery query = new XQuery( "xs:short(\"-32769\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a too small value to byte.. */ @org.junit.Test public void k2SeqExprCast81() { final XQuery query = new XQuery( "xs:byte(\"-129\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a too small value to nonNegativeInteger.. */ @org.junit.Test public void k2SeqExprCast82() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"-1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a too small value to unsignedLong.. */ @org.junit.Test public void k2SeqExprCast83() { final XQuery query = new XQuery( "xs:unsignedLong(\"-1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a too small value to unsignedInt.. */ @org.junit.Test public void k2SeqExprCast84() { final XQuery query = new XQuery( "xs:unsignedInt(\"-1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a too small value to unsignedShort.. */ @org.junit.Test public void k2SeqExprCast85() { final XQuery query = new XQuery( "xs:unsignedShort(\"-1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a too small value to unsignedByte.. */ @org.junit.Test public void k2SeqExprCast86() { final XQuery query = new XQuery( "xs:unsignedByte(\"-1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a too small value to positiveInteger.. */ @org.junit.Test public void k2SeqExprCast87() { final XQuery query = new XQuery( "xs:positiveInteger(\"-1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a too large value to nonPositiveInteger.. */ @org.junit.Test public void k2SeqExprCast88() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a too large value to negativeInteger.. */ @org.junit.Test public void k2SeqExprCast89() { final XQuery query = new XQuery( "xs:negativeInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass a small, the smallest if such a limit exists, to nonNegativeInteger.. */ @org.junit.Test public void k2SeqExprCast9() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Cast a too large value to long.. */ @org.junit.Test public void k2SeqExprCast90() { final XQuery query = new XQuery( "xs:long(\"9223372036854775808\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FORG0001") || error("FOAR0002") ) ); } /** * Cast a too large value to int.. */ @org.junit.Test public void k2SeqExprCast91() { final XQuery query = new XQuery( "xs:int(\"2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a too large value to short.. */ @org.junit.Test public void k2SeqExprCast92() { final XQuery query = new XQuery( "xs:short(\"32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Cast a too large value to byte.. */ @org.junit.Test public void k2SeqExprCast93() { final XQuery query = new XQuery( "xs:byte(\"128\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass an empty string to nonPositiveInteger.. */ @org.junit.Test public void k2SeqExprCast94() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass an empty string to negativeInteger.. */ @org.junit.Test public void k2SeqExprCast95() { final XQuery query = new XQuery( "xs:negativeInteger(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass an empty string to long.. */ @org.junit.Test public void k2SeqExprCast96() { final XQuery query = new XQuery( "xs:long(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass an empty string to int.. */ @org.junit.Test public void k2SeqExprCast97() { final XQuery query = new XQuery( "xs:int(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass an empty string to short.. */ @org.junit.Test public void k2SeqExprCast98() { final XQuery query = new XQuery( "xs:short(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Pass an empty string to byte.. */ @org.junit.Test public void k2SeqExprCast99() { final XQuery query = new XQuery( "xs:byte(\"\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Simple test for evaluation of a simple expression casted as xs:integer. */ @org.junit.Test public void casthc1() { final XQuery query = new XQuery( "(5 + 5) cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Simple test for casting a float as a double. */ @org.junit.Test public void casthc10() { final XQuery query = new XQuery( "xs:float(2.1E3) cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2100") ); } /** * Simple test for casting a float as a boolean. */ @org.junit.Test public void casthc11() { final XQuery query = new XQuery( "xs:float(2.1E3) cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test for casting a double as a double. */ @org.junit.Test public void casthc12() { final XQuery query = new XQuery( "xs:double(1267.43233E12) cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.26743233E15") ); } /** * Simple test for casting a double as a string. */ @org.junit.Test public void casthc13() { final XQuery query = new XQuery( "xs:double(1267.43233E12) cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.26743233E15") ); } /** * Simple test for casting a double as a float. */ @org.junit.Test public void casthc14() { final XQuery query = new XQuery( "(xs:double(1267.43233E12) cast as xs:float) eq xs:float(1267.43233E12)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test for casting a double as a boolean. */ @org.junit.Test public void casthc15() { final XQuery query = new XQuery( "xs:double(1267.43233E12) cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test for casting a decimal as a string. */ @org.junit.Test public void casthc16() { final XQuery query = new XQuery( "xs:decimal(12678967.543233) cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12678967.543233") ); } /** * Simple test for casting a decimal as a float. */ @org.junit.Test public void casthc17() { final XQuery query = new XQuery( "xs:decimal(12678967.543233) cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.2678968E7") ); } /** * Simple test for casting a decimal as a double. */ @org.junit.Test public void casthc18() { final XQuery query = new XQuery( "xs:decimal(12678967.543233) cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.2678967543233E7") ); } /** * Simple test for casting a decimal as a decimal. */ @org.junit.Test public void casthc19() { final XQuery query = new XQuery( "xs:decimal(12678967.543233) cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12678967.543233") ); } /** * Simple test for evaluation of a simple expression casted as xs:float. */ @org.junit.Test public void casthc2() { final XQuery query = new XQuery( "(5 + 5) cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Simple test for casting a decimal as a integer. */ @org.junit.Test public void casthc20() { final XQuery query = new XQuery( "xs:decimal(12678967.543233) cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("12678967") ); } /** * Simple test for casting a decimal as a boolean. */ @org.junit.Test public void casthc21() { final XQuery query = new XQuery( "xs:decimal(12678967.543233) cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test for casting an integer as a string. */ @org.junit.Test public void casthc22() { final XQuery query = new XQuery( "xs:integer(12678967543233) cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12678967543233") ); } /** * Simple test for casting an integer as a float. */ @org.junit.Test public void casthc23() { final XQuery query = new XQuery( "(xs:integer(12678967543233) cast as xs:float) eq xs:float(12678967543233)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test for casting an integer as a double. */ @org.junit.Test public void casthc24() { final XQuery query = new XQuery( "xs:integer(12678967543233) cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.2678967543233E13") ); } /** * Simple test for casting an integer as a decimal. */ @org.junit.Test public void casthc25() { final XQuery query = new XQuery( "xs:integer(12678967543233) cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("12678967543233") ); } /** * Simple test for casting an integer as an integer. */ @org.junit.Test public void casthc26() { final XQuery query = new XQuery( "xs:integer(12678967543233) cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("12678967543233") ); } /** * Simple test for casting an integer as a boolean. */ @org.junit.Test public void casthc27() { final XQuery query = new XQuery( "xs:integer(12678967543233) cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test for casting an dateTime as a string. */ @org.junit.Test public void casthc28() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00-05:00\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05-31T13:20:00-05:00") ); } /** * Simple test for casting an dateTime as a dateTime. */ @org.junit.Test public void casthc29() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00-05:00\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05-31T13:20:00-05:00") ); } /** * Simple test for evaluation of a simple expression casted as xs:boolean. */ @org.junit.Test public void casthc3() { final XQuery query = new XQuery( "(5 + 5) cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Simple test for casting an dateTime as a time. */ @org.junit.Test public void casthc30() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00-05:00\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "13:20:00-05:00") ); } /** * Simple test for casting an dateTime as a date. */ @org.junit.Test public void casthc31() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00-05:00\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05-31-05:00") ); } /** * Simple test for casting an date as a string. */ @org.junit.Test public void casthc32() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05-31") ); } /** * Simple test for casting an date as a dateTime. */ @org.junit.Test public void casthc33() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05-31T00:00:00") ); } /** * Simple test for casting an date as a date. */ @org.junit.Test public void casthc34() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05-31") ); } /** * Simple test for casting an xs:time as a string. */ @org.junit.Test public void casthc35() { final XQuery query = new XQuery( "xs:time(\"12:00:00\") cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12:00:00") ); } /** * Simple test for casting an xs:time as an xs:time. */ @org.junit.Test public void casthc36() { final XQuery query = new XQuery( "xs:time(\"12:00:00\") cast as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12:00:00") ); } /** * Simple test for casting a boolean as string. */ @org.junit.Test public void casthc37() { final XQuery query = new XQuery( "fn:true() cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true") ); } /** * Simple test for casting a boolean as float. */ @org.junit.Test public void casthc38() { final XQuery query = new XQuery( "fn:true() cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Simple test for casting a boolean as double. */ @org.junit.Test public void casthc39() { final XQuery query = new XQuery( "fn:true() cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Simple test for evaluation of a simple expression casted as xs:double. */ @org.junit.Test public void casthc4() { final XQuery query = new XQuery( "(5 + 5) cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Simple test for casting a boolean as decimal. */ @org.junit.Test public void casthc40() { final XQuery query = new XQuery( "fn:true() cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Simple test for casting a boolean as integer. */ @org.junit.Test public void casthc41() { final XQuery query = new XQuery( "fn:true() cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Simple test for casting a boolean as boolean. */ @org.junit.Test public void casthc42() { final XQuery query = new XQuery( "fn:true() cast as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * casting a string into an xs:NOTATION. */ @org.junit.Test public void casthc43() { final XQuery query = new XQuery( "xs:string(\"A String\") cast as xs:NOTATION", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * Simple test for evaluation of a simple expression casted as xs:decimal. */ @org.junit.Test public void casthc5() { final XQuery query = new XQuery( "(5 + 5) cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Simple test for evaluation of a simple expression casted as xs:string. */ @org.junit.Test public void casthc6() { final XQuery query = new XQuery( "(5 + 5) cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10") ); } /** * Simple test for evaluation a string casted as xs:string. */ @org.junit.Test public void casthc7() { final XQuery query = new XQuery( "\"A String\" cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "A String") ); } /** * Simple test for casting a float as a float. */ @org.junit.Test public void casthc8() { final XQuery query = new XQuery( "xs:float(2.1E3) cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2100") ); } /** * Simple test for casting a float as a string. */ @org.junit.Test public void casthc9() { final XQuery query = new XQuery( "xs:float(2.1E3) cast as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2100") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdCastExprDerived.java000066400000000000000000002065421222453003200312020ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the CastExpr production: cast expressions casting to/from built-in derived types. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdCastExprDerived extends QT3TestSet { /** * Casting from float to decimal. . */ @org.junit.Test public void castDerived1() { final XQuery query = new XQuery( "let $value := xs:float(10.0) return $value cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from float to a short. . */ @org.junit.Test public void castDerived10() { final XQuery query = new XQuery( "let $value := xs:float(10.0) return $value cast as xs:short", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from float to an unsignedInt. . */ @org.junit.Test public void castDerived11() { final XQuery query = new XQuery( "let $value := xs:float(10.0) return $value cast as xs:unsignedInt", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from float to an unsignedShort. . */ @org.junit.Test public void castDerived12() { final XQuery query = new XQuery( "let $value := xs:float(10.0) return $value cast as xs:unsignedShort", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from float to an unsignedByte. . */ @org.junit.Test public void castDerived13() { final XQuery query = new XQuery( "let $value := xs:float(10.0) return $value cast as xs:unsignedByte", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from float to a byte. . */ @org.junit.Test public void castDerived14() { final XQuery query = new XQuery( "let $value := xs:float(10.0) return $value cast as xs:byte", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from double to a decimal. . */ @org.junit.Test public void castDerived15() { final XQuery query = new XQuery( "let $value := xs:double(10E2) return $value cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1000") ); } /** * Casting from double to an integer. . */ @org.junit.Test public void castDerived16() { final XQuery query = new XQuery( "let $value := xs:double(10E2) return $value cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1000") ); } /** * Casting from double to an positiveInteger. . */ @org.junit.Test public void castDerived17() { final XQuery query = new XQuery( "let $value := xs:double(10E2) return $value cast as xs:positiveInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1000") ); } /** * Casting from double to a long. . */ @org.junit.Test public void castDerived18() { final XQuery query = new XQuery( "let $value := xs:double(10E2) return $value cast as xs:long", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1000") ); } /** * Casting from double to an int. . */ @org.junit.Test public void castDerived19() { final XQuery query = new XQuery( "let $value := xs:double(10E2) return $value cast as xs:int", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1000") ); } /** * Casting from float to integer. . */ @org.junit.Test public void castDerived2() { final XQuery query = new XQuery( "let $value := xs:float(10.0) return $value cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from double to an unsignedLong. . */ @org.junit.Test public void castDerived20() { final XQuery query = new XQuery( "let $value := xs:double(10E2) return $value cast as xs:unsignedLong", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1000") ); } /** * Casting from double to a short. . */ @org.junit.Test public void castDerived21() { final XQuery query = new XQuery( "let $value := xs:double(10E2) return $value cast as xs:short", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1000") ); } /** * Casting from float to nonPositiveInteger. . */ @org.junit.Test public void castDerived3() { final XQuery query = new XQuery( "let $value := xs:float(-10.0) return $value cast as xs:nonPositiveInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-10") ); } /** * Casting from float to a long. . */ @org.junit.Test public void castDerived4() { final XQuery query = new XQuery( "let $value := xs:float(10.0) return $value cast as xs:long", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from float to a nonNegativeInteger. . */ @org.junit.Test public void castDerived5() { final XQuery query = new XQuery( "let $value := xs:float(10.0) return $value cast as xs:nonNegativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from float to a negativeInteger. . */ @org.junit.Test public void castDerived6() { final XQuery query = new XQuery( "let $value := xs:float(-10.0) return $value cast as xs:negativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-10") ); } /** * Casting from float to an int. . */ @org.junit.Test public void castDerived7() { final XQuery query = new XQuery( "let $value := xs:float(10.0) return $value cast as xs:int", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from float to an unsignedLong. . */ @org.junit.Test public void castDerived8() { final XQuery query = new XQuery( "let $value := xs:float(10.0) return $value cast as xs:unsignedLong", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from float to a positiveInteger. . */ @org.junit.Test public void castDerived9() { final XQuery query = new XQuery( "let $value := xs:float(10.0) return $value cast as xs:positiveInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from decimal to float. . */ @org.junit.Test public void castToParent1() { final XQuery query = new XQuery( "let $value := xs:decimal(10.0) return $value cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from a shortto a float. . */ @org.junit.Test public void castToParent10() { final XQuery query = new XQuery( "let $value := xs:short(10.0) return $value cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from an unsignedInt to a float. . */ @org.junit.Test public void castToParent11() { final XQuery query = new XQuery( "let $value := xs:unsignedInt(10.0) return $value cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from an unsignedShort to a float. . */ @org.junit.Test public void castToParent12() { final XQuery query = new XQuery( "let $value := xs:unsignedShort(10.0) return $value cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from an unsignedByte to a float. . */ @org.junit.Test public void castToParent13() { final XQuery query = new XQuery( "let $value := xs:unsignedByte(10.0) return $value cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from a byte to a float. . */ @org.junit.Test public void castToParent14() { final XQuery query = new XQuery( "let $value := xs:byte(10.0) return $value cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from a decimal to a double. . */ @org.junit.Test public void castToParent15() { final XQuery query = new XQuery( "let $value := xs:decimal(10E2) return $value cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1000") ); } /** * Casting from an integer to a double. . */ @org.junit.Test public void castToParent16() { final XQuery query = new XQuery( "let $value := xs:integer(10E2) return $value cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1000") ); } /** * Casting from a positiveInteger to a double. . */ @org.junit.Test public void castToParent17() { final XQuery query = new XQuery( "let $value := xs:positiveInteger(10E2) return $value cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1000") ); } /** * Casting from a long to a double. . */ @org.junit.Test public void castToParent18() { final XQuery query = new XQuery( "let $value := xs:long(10E2) return $value cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1000") ); } /** * Casting from an int to a double. . */ @org.junit.Test public void castToParent19() { final XQuery query = new XQuery( "let $value := xs:int(10E2) return $value cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1000") ); } /** * Casting from intger to float. . */ @org.junit.Test public void castToParent2() { final XQuery query = new XQuery( "let $value := xs:integer(10.0) return $value cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from an unsignedLong to a double. . */ @org.junit.Test public void castToParent20() { final XQuery query = new XQuery( "let $value := xs:unsignedLong(10E2) return $value cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1000") ); } /** * Casting from a short to a double. . */ @org.junit.Test public void castToParent21() { final XQuery query = new XQuery( "let $value := xs:short(10E2) return $value cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1000") ); } /** * Casting from nonPositiveInteger to float. . */ @org.junit.Test public void castToParent3() { final XQuery query = new XQuery( "let $value := xs:nonPositiveInteger(-10.0) return $value cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-10") ); } /** * Casting from long to float. . */ @org.junit.Test public void castToParent4() { final XQuery query = new XQuery( "let $value := xs:long(10.0) return $value cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from nonNegativeInteger to float. . */ @org.junit.Test public void castToParent5() { final XQuery query = new XQuery( "let $value := xs:nonNegativeInteger(10.0) return $value cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from a negativeInteger to a float. . */ @org.junit.Test public void castToParent6() { final XQuery query = new XQuery( "let $value := xs:negativeInteger(-10.0) return $value cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-10") ); } /** * Casting from an int to a float. . */ @org.junit.Test public void castToParent7() { final XQuery query = new XQuery( "let $value := xs:int(10.0) return $value cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from an unsignedLong to a float. . */ @org.junit.Test public void castToParent8() { final XQuery query = new XQuery( "let $value := xs:unsignedLong(10.0) return $value cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from a positiveInteger to a float. . */ @org.junit.Test public void castToParent9() { final XQuery query = new XQuery( "let $value := xs:positiveInteger(10.0) return $value cast as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from integer to nonPositiveInteger. . */ @org.junit.Test public void castWithin1() { final XQuery query = new XQuery( "let $value := xs:integer(-10.0) return $value cast as xs:nonPositiveInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-10") ); } /** * Casting from integer to byte. . */ @org.junit.Test public void castWithin10() { final XQuery query = new XQuery( "let $value := xs:integer(10.0) return $value cast as xs:byte", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from integer to unsignedShort. . */ @org.junit.Test public void castWithin11() { final XQuery query = new XQuery( "let $value := xs:integer(10.0) return $value cast as xs:unsignedShort", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from integer to an unsignedByte. . */ @org.junit.Test public void castWithin12() { final XQuery query = new XQuery( "let $value := xs:integer(10.0) return $value cast as xs:unsignedByte", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from a long to an integer. . */ @org.junit.Test public void castWithin13() { final XQuery query = new XQuery( "let $value := xs:long(10.0) return $value cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from long to a nonNegativeInteger. . */ @org.junit.Test public void castWithin14() { final XQuery query = new XQuery( "let $value := xs:long(10.0) return $value cast as xs:nonNegativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from long to a negativeInteger. . */ @org.junit.Test public void castWithin15() { final XQuery query = new XQuery( "let $value := xs:long(-10) return $value cast as xs:negativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-10") ); } /** * Casting from long to an int. . */ @org.junit.Test public void castWithin16() { final XQuery query = new XQuery( "let $value := xs:long(10) return $value cast as xs:int", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from long to an unsignedLong. . */ @org.junit.Test public void castWithin17() { final XQuery query = new XQuery( "let $value := xs:long(10) return $value cast as xs:unsignedLong", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from long to a positiveInteger. . */ @org.junit.Test public void castWithin18() { final XQuery query = new XQuery( "let $value := xs:long(10) return $value cast as xs:positiveInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from long to a short. . */ @org.junit.Test public void castWithin19() { final XQuery query = new XQuery( "let $value := xs:long(10) return $value cast as xs:short", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from integer to long. . */ @org.junit.Test public void castWithin2() { final XQuery query = new XQuery( "let $value := xs:integer(10.0) return $value cast as xs:long", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from long to unsignedInt. . */ @org.junit.Test public void castWithin20() { final XQuery query = new XQuery( "let $value := xs:long(10) return $value cast as xs:unsignedInt", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from long to a byte. . */ @org.junit.Test public void castWithin21() { final XQuery query = new XQuery( "let $value := xs:long(10) return $value cast as xs:byte", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from integer to nonNegativeInteger. . */ @org.junit.Test public void castWithin3() { final XQuery query = new XQuery( "let $value := xs:integer(10.0) return $value cast as xs:nonNegativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from integer to negativeInteger. . */ @org.junit.Test public void castWithin4() { final XQuery query = new XQuery( "let $value := xs:integer(-10.0) return $value cast as xs:negativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-10") ); } /** * Casting from integer to int. . */ @org.junit.Test public void castWithin5() { final XQuery query = new XQuery( "let $value := xs:integer(10.0) return $value cast as xs:int", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from integer to unsignedLong. . */ @org.junit.Test public void castWithin6() { final XQuery query = new XQuery( "let $value := xs:integer(10.0) return $value cast as xs:unsignedLong", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from integer to positiveInteger. . */ @org.junit.Test public void castWithin7() { final XQuery query = new XQuery( "let $value := xs:integer(10.0) return $value cast as xs:positiveInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from integer to short. . */ @org.junit.Test public void castWithin8() { final XQuery query = new XQuery( "let $value := xs:integer(10.0) return $value cast as xs:short", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Casting from integer to unsignedInt. . */ @org.junit.Test public void castWithin9() { final XQuery query = new XQuery( "let $value := xs:integer(10.0) return $value cast as xs:unsignedInt", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Test a uri with an empty path, but with a valid query . */ @org.junit.Test public void cbclCaseAnyUri001() { final XQuery query = new XQuery( "\"http://example.com?query=\" cast as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.com?query=") ); } /** * test cast to xs:byte of out-of-range value . */ @org.junit.Test public void cbclCastByte001() { final XQuery query = new XQuery( "xs:byte(128)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:byte of out-of-range value . */ @org.junit.Test public void cbclCastByte002() { final XQuery query = new XQuery( "xs:byte(-129)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:byte of out-of-range value . */ @org.junit.Test public void cbclCastByte003() { final XQuery query = new XQuery( "xs:byte(\"128\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:byte of out-of-range value . */ @org.junit.Test public void cbclCastByte004() { final XQuery query = new XQuery( "xs:byte(\"-129\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:date with overflow . */ @org.junit.Test public void cbclCastDate001() { final XQuery query = new XQuery( "\"-25252734927766555-06-06\" cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * test cast to xs:date with overflow . */ @org.junit.Test public void cbclCastDate002() { final XQuery query = new XQuery( "\"25252734927766555-07-29\" cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * test cast to xs:date with overflow . */ @org.junit.Test public void cbclCastDate003() { final XQuery query = new XQuery( "\"18446744073709551616-05-15\" cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * test cast to xs:date with invalid format . */ @org.junit.Test public void cbclCastDate004() { final XQuery query = new XQuery( "\"18446744073709551616-QQ-15\" cast as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:dateTime with overflow . */ @org.junit.Test public void cbclCastDateTime001() { final XQuery query = new XQuery( "\"-25252734927766555-06-06T00:00:00Z\" cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * test cast to xs:dateTime with overflow . */ @org.junit.Test public void cbclCastDateTime002() { final XQuery query = new XQuery( "\"25252734927766555-07-29T00:00:00Z\" cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * test cast to xs:dateTime with overflow . */ @org.junit.Test public void cbclCastDateTime003() { final XQuery query = new XQuery( "\"18446744073709551616-05-15T16:15:00\" cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * test cast to xs:dateTime with invalid format . */ @org.junit.Test public void cbclCastDateTime004() { final XQuery query = new XQuery( "\"18446744073709551616-QQ-15T16:15:00\" cast as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:dayTimeDuration with overflow . */ @org.junit.Test public void cbclCastDayTimeDuration001() { final XQuery query = new XQuery( "\"P11768614336404564651D\" cast as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * test cast to xs:dayTimeDuration with overflow . */ @org.junit.Test public void cbclCastDayTimeDuration002() { final XQuery query = new XQuery( "\"-P11768614336404564651D\" cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * test cast to xs:decimal of large double value . */ @org.junit.Test public void cbclCastDecimal001() { final XQuery query = new XQuery( "1.7976931348623157E+308 cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FOCA0001") || assertQuery("string-length(string($result)) gt 300") ) ); } /** * test cast to xs:decimal of large negative double value . */ @org.junit.Test public void cbclCastDecimal002() { final XQuery query = new XQuery( "-1.7976931348623157E+308 cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FOCA0001") || assertQuery("string-length(string($result)) gt 300") ) ); } /** * test cast to xs:decimal of large float value . */ @org.junit.Test public void cbclCastDecimal003() { final XQuery query = new XQuery( "xs:float('3.402823e38') cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FOCA0001") || assertQuery("string-length(string($result)) gt 36") ) ); } /** * test cast to xs:decimal of large negative float value . */ @org.junit.Test public void cbclCastDecimal004() { final XQuery query = new XQuery( "xs:float('-3.402823e38') cast as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FOCA0001") || assertQuery("string-length(string($result)) gt 36") ) ); } /** * test cast to xs:duration with overflow . */ @org.junit.Test public void cbclCastDuration001() { final XQuery query = new XQuery( "\"-P768614336404564651Y\" cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * test cast to xs:duration with overflow . */ @org.junit.Test public void cbclCastDuration002() { final XQuery query = new XQuery( "\"P768614336404564651Y\" cast as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * test cast to xs:ENTITY from a subtype of xs:NCName . */ @org.junit.Test public void cbclCastEntity001() { final XQuery query = new XQuery( "xs:NCName('entity') cast as xs:ENTITY", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "entity") ); } /** * test cast to xs:ENTITY from a type which will always fail . */ @org.junit.Test public void cbclCastEntity002() { final XQuery query = new XQuery( "fn:current-time() cast as xs:ENTITY", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:gYear with overflow . */ @org.junit.Test public void cbclCastGYear001() { final XQuery query = new XQuery( "\"99999999999999999999999999999\" cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * test casting 0000 to xs:gYear . */ @org.junit.Test public void cbclCastGYear002() { final XQuery query = new XQuery( "\"0000\" cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test casting -0000 to xs:gYear . */ @org.junit.Test public void cbclCastGYear003() { final XQuery query = new XQuery( "\"-0000\" cast as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:gYearMonth with overflow . */ @org.junit.Test public void cbclCastGYearMonth001() { final XQuery query = new XQuery( "\"99999999999999999999999999999-01\" cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0001") ); } /** * test cast to xs:gYearMonth with overflow . */ @org.junit.Test public void cbclCastGYearMonth002() { final XQuery query = new XQuery( "\"99999999999999999999999999999-XX\" cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast year 0000 xs:gYearMonth . */ @org.junit.Test public void cbclCastGYearMonth003() { final XQuery query = new XQuery( "\"0000-05\" cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast year 0000 xs:gYearMonth . */ @org.junit.Test public void cbclCastGYearMonth004() { final XQuery query = new XQuery( "\"-0000-05\" cast as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:ID from a subtype of xs:NCName . */ @org.junit.Test public void cbclCastId001() { final XQuery query = new XQuery( "xs:NCName('id') cast as xs:ID", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "id") ); } /** * test cast to xs:ID from a type which will always fail . */ @org.junit.Test public void cbclCastId002() { final XQuery query = new XQuery( "fn:current-time() cast as xs:ID", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:IDREF from a subtype of xs:NCName . */ @org.junit.Test public void cbclCastIdref001() { final XQuery query = new XQuery( "xs:NCName('idref') cast as xs:IDREF", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "idref") ); } /** * test cast to xs:IDREF from a type which will always fail . */ @org.junit.Test public void cbclCastIdref002() { final XQuery query = new XQuery( "fn:current-time() cast as xs:IDREF", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:int of out-of-range value . */ @org.junit.Test public void cbclCastInt001() { final XQuery query = new XQuery( "xs:int(2147483648)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:int of out-of-range value . */ @org.junit.Test public void cbclCastInt002() { final XQuery query = new XQuery( "xs:int(-2147483649)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:int of out-of-range value . */ @org.junit.Test public void cbclCastInt003() { final XQuery query = new XQuery( "xs:int(\"2147483648\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:int of out-of-range value . */ @org.junit.Test public void cbclCastInt004() { final XQuery query = new XQuery( "xs:int(\"-2147483649\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:integer of large double value . */ @org.junit.Test public void cbclCastInteger001() { final XQuery query = new XQuery( "1.7976931348623157E+308 cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FOCA0003") || assertQuery("string-length(string($result)) gt 300") ) ); } /** * test cast to xs:integer of large negative double value . */ @org.junit.Test public void cbclCastInteger002() { final XQuery query = new XQuery( "-1.7976931348623157E+308 cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FOCA0003") || assertQuery("string-length(string($result)) gt 300") ) ); } /** * test cast to xs:integer of large float value . */ @org.junit.Test public void cbclCastInteger003() { final XQuery query = new XQuery( "xs:float('3.402823e38') cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FOCA0003") || assertQuery("string-length(string($result)) gt 36") ) ); } /** * test cast to xs:integer of large negative float value . */ @org.junit.Test public void cbclCastInteger004() { final XQuery query = new XQuery( "xs:float('-3.402823e38') cast as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FOCA0003") || assertQuery("string-length(string($result)) gt 36") ) ); } /** * test cast to xs:language . */ @org.junit.Test public void cbclCastLanguage001() { final XQuery query = new XQuery( "xs:language('en-gb') cast as xs:language", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "en-gb") ); } /** * test cast to xs:long of out-of-range value . */ @org.junit.Test public void cbclCastLong001() { final XQuery query = new XQuery( "xs:long(9223372036854775808)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:long of out-of-range value . */ @org.junit.Test public void cbclCastLong002() { final XQuery query = new XQuery( "xs:long(-9223372036854775809)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:long of out-of-range value . */ @org.junit.Test public void cbclCastLong003() { final XQuery query = new XQuery( "xs:long(\"9223372036854775808\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:long of out-of-range value . */ @org.junit.Test public void cbclCastLong004() { final XQuery query = new XQuery( "xs:long(\"-9223372036854775809\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:Name from a subtype of xs:Name . */ @org.junit.Test public void cbclCastName001() { final XQuery query = new XQuery( "xs:NCName('NCName') cast as xs:Name", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NCName") ); } /** * test cast to xs:Name from a type which will always fail . */ @org.junit.Test public void cbclCastName002() { final XQuery query = new XQuery( "fn:current-time() cast as xs:Name", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:NCName from a subtype of xs:NCName . */ @org.junit.Test public void cbclCastNcname001() { final XQuery query = new XQuery( "xs:ID('id') cast as xs:NCName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "id") ); } /** * test cast to xs:NCName from a type which will always fail . */ @org.junit.Test public void cbclCastNcname002() { final XQuery query = new XQuery( "fn:current-time() cast as xs:NCName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:negativeInteger of out-of-range value . */ @org.junit.Test public void cbclCastNegativeInteger001() { final XQuery query = new XQuery( "xs:negativeInteger(0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:negativeInteger of out-of-range value . */ @org.junit.Test public void cbclCastNegativeInteger002() { final XQuery query = new XQuery( "xs:negativeInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:NMTOKEN . */ @org.junit.Test public void cbclCastNmtoken001() { final XQuery query = new XQuery( "\n" + " let $string := (\" foobar \" cast as xs:NMTOKEN) return not(contains($string, ' ') or contains($string, ' ') or contains($string, ' ') or string-length($string) ne 6)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test cast to xs:NMTOKEN from a subtype of xs:NMTOKEN . */ @org.junit.Test public void cbclCastNmtoken002() { final XQuery query = new XQuery( "xs:NMTOKEN('NMTOKEN') cast as xs:NMTOKEN", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "NMTOKEN") ); } /** * test cast to xs:nonNegativeInteger of out-of-range value . */ @org.junit.Test public void cbclCastNonNegativeInteger001() { final XQuery query = new XQuery( "xs:nonNegativeInteger(-1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:nonNegativeInteger of out-of-range value . */ @org.junit.Test public void cbclCastNonNegativeInteger002() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"-1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Ensure that "-00" is a valid lexical value for xs:nonNegativeInteger . */ @org.junit.Test public void cbclCastNonNegativeInteger003() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"-00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * test cast to xs:nonPositiveInteger of out-of-range value . */ @org.junit.Test public void cbclCastNonPositiveInteger001() { final XQuery query = new XQuery( "xs:nonPositiveInteger(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:nonPositiveInteger of out-of-range value . */ @org.junit.Test public void cbclCastNonPositiveInteger002() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Ensure that "+00" is a valid lexical value for xs:nonPositiveInteger . */ @org.junit.Test public void cbclCastNonPositiveInteger003() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"+00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * test cast to xs:normalizedString . */ @org.junit.Test public void cbclCastNormalizedString001() { final XQuery query = new XQuery( "\n" + " for $string in (\" foo bar \" cast as xs:normalizedString)\n" + " return not(contains($string, ' ') or \n" + " contains($string, ' ') or \n" + " contains($string, ' ') or \n" + " string-length($string) ne 13)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test cast to xs:positiveInteger of out-of-range value . */ @org.junit.Test public void cbclCastPositiveInteger001() { final XQuery query = new XQuery( "xs:positiveInteger(0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:positiveInteger of out-of-range value . */ @org.junit.Test public void cbclCastPositiveInteger002() { final XQuery query = new XQuery( "xs:positiveInteger(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:short of out-of-range value . */ @org.junit.Test public void cbclCastShort001() { final XQuery query = new XQuery( "xs:short(32768)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:short of out-of-range value . */ @org.junit.Test public void cbclCastShort002() { final XQuery query = new XQuery( "xs:short(-32769)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:short of out-of-range value . */ @org.junit.Test public void cbclCastShort003() { final XQuery query = new XQuery( "xs:short(\"32768\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:short of out-of-range value . */ @org.junit.Test public void cbclCastShort004() { final XQuery query = new XQuery( "xs:short(\"-32769\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:token . */ @org.junit.Test public void cbclCastToken001() { final XQuery query = new XQuery( "\n" + " for $string in (\" foo bar \" cast as xs:token) \n" + " return not(contains($string, ' ') or \n" + " contains($string, ' ') or \n" + " contains($string, ' ') or \n" + " string-length($string) ne 7)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test cast to xs:unsignedByte of out-of-range value . */ @org.junit.Test public void cbclCastUnsignedByte001() { final XQuery query = new XQuery( "xs:unsignedByte(256)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:unsignedByte of out-of-range value . */ @org.junit.Test public void cbclCastUnsignedByte002() { final XQuery query = new XQuery( "xs:unsignedByte(-1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:unsignedByte of out-of-range value . */ @org.junit.Test public void cbclCastUnsignedByte003() { final XQuery query = new XQuery( "xs:unsignedByte(\"256\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:unsignedByte of out-of-range value . */ @org.junit.Test public void cbclCastUnsignedByte004() { final XQuery query = new XQuery( "xs:unsignedByte(\"-1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Ensure that "-00" is a valid lexical value for xs:unsignedByte . */ @org.junit.Test public void cbclCastUnsignedByte005() { final XQuery query = new XQuery( "xs:unsignedByte(\"-00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * test cast to xs:unsignedInt of out-of-range value . */ @org.junit.Test public void cbclCastUnsignedInt001() { final XQuery query = new XQuery( "xs:unsignedInt(4294967296)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:unsignedInt of out-of-range value . */ @org.junit.Test public void cbclCastUnsignedInt002() { final XQuery query = new XQuery( "xs:unsignedInt(-1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:unsignedInt of out-of-range value . */ @org.junit.Test public void cbclCastUnsignedInt003() { final XQuery query = new XQuery( "xs:unsignedInt(\"4294967296\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:unsignedInt of out-of-range value . */ @org.junit.Test public void cbclCastUnsignedInt004() { final XQuery query = new XQuery( "xs:unsignedInt(\"-1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Ensure that "-00" is a valid lexical value for xs:unsignedInt . */ @org.junit.Test public void cbclCastUnsignedInt005() { final XQuery query = new XQuery( "xs:unsignedInt(\"-00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * test cast to xs:unsignedLong of out-of-range value . */ @org.junit.Test public void cbclCastUnsignedLong001() { final XQuery query = new XQuery( "xs:unsignedLong(18446744073709551616)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:unsignedLong of out-of-range value . */ @org.junit.Test public void cbclCastUnsignedLong002() { final XQuery query = new XQuery( "xs:unsignedLong(-1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:unsignedLong of out-of-range value . */ @org.junit.Test public void cbclCastUnsignedLong003() { final XQuery query = new XQuery( "xs:unsignedLong(\"18446744073709551616\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:unsignedLong of out-of-range value . */ @org.junit.Test public void cbclCastUnsignedLong004() { final XQuery query = new XQuery( "xs:unsignedLong(\"-1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Ensure that "-00" is a valid lexical value for xs:unsignedLong . */ @org.junit.Test public void cbclCastUnsignedLong005() { final XQuery query = new XQuery( "xs:unsignedLong(\"-00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * test cast to xs:unsignedShort of out-of-range value . */ @org.junit.Test public void cbclCastUnsignedShort001() { final XQuery query = new XQuery( "xs:unsignedShort(65536)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:unsignedShort of out-of-range value . */ @org.junit.Test public void cbclCastUnsignedShort002() { final XQuery query = new XQuery( "xs:unsignedShort(-1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:unsignedShort of out-of-range value . */ @org.junit.Test public void cbclCastUnsignedShort003() { final XQuery query = new XQuery( "xs:unsignedShort(\"65536\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * test cast to xs:unsignedShort of out-of-range value . */ @org.junit.Test public void cbclCastUnsignedShort004() { final XQuery query = new XQuery( "xs:unsignedShort(\"-1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * Ensure that "-00" is a valid lexical value for xs:unsignedShort . */ @org.junit.Test public void cbclCastUnsignedShort005() { final XQuery query = new XQuery( "xs:unsignedShort(\"-00\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0") ); } /** * test cast to xs:yearMonthDuration with overflow . */ @org.junit.Test public void cbclCastYearMonthDuration001() { final XQuery query = new XQuery( "\"-P768614336404564651Y\" cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } /** * test cast to xs:yearMonthDuration with overflow . */ @org.junit.Test public void cbclCastYearMonthDuration002() { final XQuery query = new XQuery( "\"P768614336404564651Y\" cast as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODT0002") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdCastableExpr.java000066400000000000000000012666761222453003200305420ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the CastableExpr production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdCastableExpr extends QT3TestSet { /** * Try xs:untypedAtomic(INF) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs001() { final XQuery query = new XQuery( "xs:untypedAtomic(\"INF\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(0.0E0) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs002() { final XQuery query = new XQuery( "xs:untypedAtomic(\"0.0E0\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(true) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs003() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(INF) castable as xs:string . */ @org.junit.Test public void castableAs004() { final XQuery query = new XQuery( "xs:untypedAtomic(\"INF\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(0.0E0) castable as xs:string . */ @org.junit.Test public void castableAs005() { final XQuery query = new XQuery( "xs:untypedAtomic(\"0.0E0\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(true) castable as xs:string . */ @org.junit.Test public void castableAs006() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(-0.0E0) castable as xs:float . */ @org.junit.Test public void castableAs007() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-0.0E0\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(NaN) castable as xs:float . */ @org.junit.Test public void castableAs008() { final XQuery query = new XQuery( "xs:untypedAtomic(\"NaN\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(1e-5) castable as xs:float . */ @org.junit.Test public void castableAs009() { final XQuery query = new XQuery( "xs:untypedAtomic(\"1e-5\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(-10000000) castable as xs:float . */ @org.junit.Test public void castableAs010() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-10000000\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(true) castable as xs:float . */ @org.junit.Test public void castableAs011() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:untypedAtomic(-0.0E0) castable as xs:double . */ @org.junit.Test public void castableAs012() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-0.0E0\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(NaN) castable as xs:double . */ @org.junit.Test public void castableAs013() { final XQuery query = new XQuery( "xs:untypedAtomic(\"NaN\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(1e-5) castable as xs:double . */ @org.junit.Test public void castableAs014() { final XQuery query = new XQuery( "xs:untypedAtomic(\"1e-5\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(-10000000) castable as xs:double . */ @org.junit.Test public void castableAs015() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-10000000\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(true) castable as xs:double . */ @org.junit.Test public void castableAs016() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:untypedAtomic(-0.0E0) castable as xs:decimal . */ @org.junit.Test public void castableAs017() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-0.0E0\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:untypedAtomic(NaN) castable as xs:decimal . */ @org.junit.Test public void castableAs018() { final XQuery query = new XQuery( "xs:untypedAtomic(\"NaN\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:untypedAtomic(1e-5) castable as xs:decimal . */ @org.junit.Test public void castableAs019() { final XQuery query = new XQuery( "xs:untypedAtomic(\"1e-5\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:untypedAtomic(5.5432) castable as xs:decimal . */ @org.junit.Test public void castableAs020() { final XQuery query = new XQuery( "xs:untypedAtomic(\"5.5432\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(true) castable as xs:decimal . */ @org.junit.Test public void castableAs021() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:untypedAtomic(-0.0E0) castable as xs:integer . */ @org.junit.Test public void castableAs022() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-0.0E0\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:untypedAtomic(NaN) castable as xs:integer . */ @org.junit.Test public void castableAs023() { final XQuery query = new XQuery( "xs:untypedAtomic(\"NaN\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:untypedAtomic(1e-5) castable as xs:integer . */ @org.junit.Test public void castableAs024() { final XQuery query = new XQuery( "xs:untypedAtomic(\"1e-5\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:untypedAtomic(-1.1234) castable as xs:integer . */ @org.junit.Test public void castableAs025() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-1.1234\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:untypedAtomic(true) castable as xs:integer . */ @org.junit.Test public void castableAs026() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:untypedAtomic(P1Y2M3DT10H30M23S) castable as xs:duration . */ @org.junit.Test public void castableAs027() { final XQuery query = new XQuery( "xs:untypedAtomic(\"P1Y2M3DT10H30M23S\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(-P1Y1M1DT1H1M1.123S) castable as xs:duration . */ @org.junit.Test public void castableAs028() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-P1Y1M1DT1H1M1.123S\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(true) castable as xs:duration . */ @org.junit.Test public void castableAs029() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:untypedAtomic(-P1Y1M1DT1H1M1.123S) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs030() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-P1Y1M1DT1H1M1.123S\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:untypedAtomic(P24M) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs031() { final XQuery query = new XQuery( "xs:untypedAtomic(\"P24M\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(-P21M) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs032() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-P21M\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(true) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs033() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:untypedAtomic(-P1Y1M1DT1H1M1.123S) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs034() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-P1Y1M1DT1H1M1.123S\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:untypedAtomic(P3DT10H30M) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs035() { final XQuery query = new XQuery( "xs:untypedAtomic(\"P3DT10H30M\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(-PT100M) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs036() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-PT100M\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(true) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs037() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:untypedAtomic(1999-05-31T13:20:00) castable as xs:dateTime . */ @org.junit.Test public void castableAs038() { final XQuery query = new XQuery( "xs:untypedAtomic(\"1999-05-31T13:20:00\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(-1999-05-31T13:20:00+14:00) castable as xs:dateTime . */ @org.junit.Test public void castableAs039() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-1999-05-31T13:20:00+14:00\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(2000-01-16T00:00:00Z) castable as xs:dateTime . */ @org.junit.Test public void castableAs040() { final XQuery query = new XQuery( "xs:untypedAtomic(\"2000-01-16T00:00:00Z\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(true) castable as xs:dateTime . */ @org.junit.Test public void castableAs041() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:untypedAtomic(13:20:00-05:00) castable as xs:time . */ @org.junit.Test public void castableAs042() { final XQuery query = new XQuery( "xs:untypedAtomic(\"13:20:00-05:00\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(13:20:02.123) castable as xs:time . */ @org.junit.Test public void castableAs043() { final XQuery query = new XQuery( "xs:untypedAtomic(\"13:20:02.123\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(13:20:00Z) castable as xs:time . */ @org.junit.Test public void castableAs044() { final XQuery query = new XQuery( "xs:untypedAtomic(\"13:20:00Z\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(true) castable as xs:time . */ @org.junit.Test public void castableAs045() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:untypedAtomic(1999-05-31) castable as xs:date . */ @org.junit.Test public void castableAs046() { final XQuery query = new XQuery( "xs:untypedAtomic(\"1999-05-31\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(-0012-12-03-05:00) castable as xs:date . */ @org.junit.Test public void castableAs047() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-0012-12-03-05:00\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(1999-05-31Z) castable as xs:date . */ @org.junit.Test public void castableAs048() { final XQuery query = new XQuery( "xs:untypedAtomic(\"1999-05-31Z\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(true) castable as xs:date . */ @org.junit.Test public void castableAs049() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:untypedAtomic(1999-05) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs050() { final XQuery query = new XQuery( "xs:untypedAtomic(\"1999-05\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(-0012-12-05:00) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs051() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-0012-12-05:00\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(1999-05Z) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs052() { final XQuery query = new XQuery( "xs:untypedAtomic(\"1999-05Z\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(true) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs053() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:untypedAtomic(1999) castable as xs:gYear . */ @org.junit.Test public void castableAs054() { final XQuery query = new XQuery( "xs:untypedAtomic(\"1999\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(-0012-05:00) castable as xs:gYear . */ @org.junit.Test public void castableAs055() { final XQuery query = new XQuery( "xs:untypedAtomic(\"-0012-05:00\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(1999Z) castable as xs:gYear . */ @org.junit.Test public void castableAs056() { final XQuery query = new XQuery( "xs:untypedAtomic(\"1999Z\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(true) castable as xs:gYear . */ @org.junit.Test public void castableAs057() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:untypedAtomic(--05-31) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs058() { final XQuery query = new XQuery( "xs:untypedAtomic(\"--05-31\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(--05-31+14:00) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs059() { final XQuery query = new XQuery( "xs:untypedAtomic(\"--05-31+14:00\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(--05-31Z) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs060() { final XQuery query = new XQuery( "xs:untypedAtomic(\"--05-31Z\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(true) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs061() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:untypedAtomic(---31) castable as xs:gDay . */ @org.junit.Test public void castableAs062() { final XQuery query = new XQuery( "xs:untypedAtomic(\"---31\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(---03-05:00) castable as xs:gDay . */ @org.junit.Test public void castableAs063() { final XQuery query = new XQuery( "xs:untypedAtomic(\"---03-05:00\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(---31Z) castable as xs:gDay . */ @org.junit.Test public void castableAs064() { final XQuery query = new XQuery( "xs:untypedAtomic(\"---31Z\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(true) castable as xs:gDay . */ @org.junit.Test public void castableAs065() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:untypedAtomic(--05) castable as xs:gMonth . */ @org.junit.Test public void castableAs066() { final XQuery query = new XQuery( "xs:untypedAtomic(\"--05\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(--12-05:00) castable as xs:gMonth . */ @org.junit.Test public void castableAs067() { final XQuery query = new XQuery( "xs:untypedAtomic(\"--12-05:00\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(--05Z) castable as xs:gMonth . */ @org.junit.Test public void castableAs068() { final XQuery query = new XQuery( "xs:untypedAtomic(\"--05Z\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(true) castable as xs:gMonth . */ @org.junit.Test public void castableAs069() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:untypedAtomic(0.0) castable as xs:boolean . */ @org.junit.Test public void castableAs070() { final XQuery query = new XQuery( "xs:untypedAtomic(\"0.0\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:untypedAtomic(0) castable as xs:boolean . */ @org.junit.Test public void castableAs071() { final XQuery query = new XQuery( "xs:untypedAtomic(\"0\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(true) castable as xs:boolean . */ @org.junit.Test public void castableAs072() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(true) castable as xs:base64Binary . */ @org.junit.Test public void castableAs073() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(00000000) castable as xs:base64Binary . */ @org.junit.Test public void castableAs074() { final XQuery query = new XQuery( "xs:untypedAtomic(\"00000000\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(D74D35D35D35) castable as xs:base64Binary . */ @org.junit.Test public void castableAs075() { final XQuery query = new XQuery( "xs:untypedAtomic(\"D74D35D35D35\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(true) castable as xs:hexBinary . */ @org.junit.Test public void castableAs076() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:untypedAtomic(010010101) castable as xs:hexBinary . */ @org.junit.Test public void castableAs077() { final XQuery query = new XQuery( "xs:untypedAtomic(\"010010101\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:untypedAtomic(0fb7) castable as xs:hexBinary . */ @org.junit.Test public void castableAs078() { final XQuery query = new XQuery( "xs:untypedAtomic(\"0fb7\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(D74D35D35D35) castable as xs:hexBinary . */ @org.junit.Test public void castableAs079() { final XQuery query = new XQuery( "xs:untypedAtomic(\"D74D35D35D35\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(-0012-05:00) castable as xs:anyURI . */ @org.junit.Test public void castableAs080() { final XQuery query = new XQuery( "xs:untypedAtomic(\"http://www.example.com/~b%C3%A9b%C3%A9\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(true) castable as xs:anyURI . */ @org.junit.Test public void castableAs081() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:untypedAtomic(http://www.ietf.org/rfc/rfc2396.txt) castable as xs:anyURI . */ @org.junit.Test public void castableAs082() { final XQuery query = new XQuery( "xs:untypedAtomic(\"http://www.ietf.org/rfc/rfc2396.txt\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(INF) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs083() { final XQuery query = new XQuery( "xs:string(\"INF\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(0.0E0) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs084() { final XQuery query = new XQuery( "xs:string(\"0.0E0\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(true) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs085() { final XQuery query = new XQuery( "xs:string(\"true\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(INF) castable as xs:string . */ @org.junit.Test public void castableAs086() { final XQuery query = new XQuery( "xs:string(\"INF\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(0.0E0) castable as xs:string . */ @org.junit.Test public void castableAs087() { final XQuery query = new XQuery( "xs:string(\"0.0E0\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(true) castable as xs:string . */ @org.junit.Test public void castableAs088() { final XQuery query = new XQuery( "xs:string(\"true\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(-0.0E0) castable as xs:float . */ @org.junit.Test public void castableAs089() { final XQuery query = new XQuery( "xs:string(\"-0.0E0\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(NaN) castable as xs:float . */ @org.junit.Test public void castableAs090() { final XQuery query = new XQuery( "xs:string(\"NaN\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(1e-5) castable as xs:float . */ @org.junit.Test public void castableAs091() { final XQuery query = new XQuery( "xs:string(\"1e-5\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(-10000000) castable as xs:float . */ @org.junit.Test public void castableAs092() { final XQuery query = new XQuery( "xs:string(\"-10000000\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(true) castable as xs:float . */ @org.junit.Test public void castableAs093() { final XQuery query = new XQuery( "xs:string(\"true\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:string(-0.0E0) castable as xs:double . */ @org.junit.Test public void castableAs094() { final XQuery query = new XQuery( "xs:string(\"-0.0E0\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(NaN) castable as xs:double . */ @org.junit.Test public void castableAs095() { final XQuery query = new XQuery( "xs:string(\"NaN\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(1e-5) castable as xs:double . */ @org.junit.Test public void castableAs096() { final XQuery query = new XQuery( "xs:string(\"1e-5\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(-10000000) castable as xs:double . */ @org.junit.Test public void castableAs097() { final XQuery query = new XQuery( "xs:string(\"-10000000\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(true) castable as xs:double . */ @org.junit.Test public void castableAs098() { final XQuery query = new XQuery( "xs:string(\"true\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:string(-0.0E0) castable as xs:decimal . */ @org.junit.Test public void castableAs099() { final XQuery query = new XQuery( "xs:string(\"-0.0E0\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:string(NaN) castable as xs:decimal . */ @org.junit.Test public void castableAs100() { final XQuery query = new XQuery( "xs:string(\"NaN\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:string(1e-5) castable as xs:decimal . */ @org.junit.Test public void castableAs101() { final XQuery query = new XQuery( "xs:string(\"1e-5\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:string(5.5432) castable as xs:decimal . */ @org.junit.Test public void castableAs102() { final XQuery query = new XQuery( "xs:string(\"5.5432\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(true) castable as xs:decimal . */ @org.junit.Test public void castableAs103() { final XQuery query = new XQuery( "xs:string(\"true\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:string(-0.0E0) castable as xs:integer . */ @org.junit.Test public void castableAs104() { final XQuery query = new XQuery( "xs:string(\"-0.0E0\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:string(NaN) castable as xs:integer . */ @org.junit.Test public void castableAs105() { final XQuery query = new XQuery( "xs:string(\"NaN\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:string(1e-5) castable as xs:integer . */ @org.junit.Test public void castableAs106() { final XQuery query = new XQuery( "xs:string(\"1e-5\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:string(-1.1234) castable as xs:integer . */ @org.junit.Test public void castableAs107() { final XQuery query = new XQuery( "xs:string(\"-1.1234\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:string(true) castable as xs:integer . */ @org.junit.Test public void castableAs108() { final XQuery query = new XQuery( "xs:string(\"true\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:string(P1Y2M3DT10H30M23S) castable as xs:duration . */ @org.junit.Test public void castableAs109() { final XQuery query = new XQuery( "xs:string(\"P1Y2M3DT10H30M23S\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(-P1Y1M1DT1H1M1.123S) castable as xs:duration . */ @org.junit.Test public void castableAs110() { final XQuery query = new XQuery( "xs:string(\"-P1Y1M1DT1H1M1.123S\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(true) castable as xs:duration . */ @org.junit.Test public void castableAs111() { final XQuery query = new XQuery( "xs:string(\"true\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:string(-P1Y1M1DT1H1M1.123S) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs112() { final XQuery query = new XQuery( "xs:string(\"-P1Y1M1DT1H1M1.123S\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:string(P24M) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs113() { final XQuery query = new XQuery( "xs:string(\"P24M\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(-P21M) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs114() { final XQuery query = new XQuery( "xs:string(\"-P21M\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(true) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs115() { final XQuery query = new XQuery( "xs:string(\"true\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:string(-P1Y1M1DT1H1M1.123S) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs116() { final XQuery query = new XQuery( "xs:string(\"-P1Y1M1DT1H1M1.123S\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:string(P3DT10H30M) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs117() { final XQuery query = new XQuery( "xs:string(\"P3DT10H30M\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(-PT100M) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs118() { final XQuery query = new XQuery( "xs:string(\"-PT100M\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(true) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs119() { final XQuery query = new XQuery( "xs:string(\"true\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:string(1999-05-31T13:20:00) castable as xs:dateTime . */ @org.junit.Test public void castableAs120() { final XQuery query = new XQuery( "xs:string(\"1999-05-31T13:20:00\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(-1999-05-31T13:20:00+14:00) castable as xs:dateTime . */ @org.junit.Test public void castableAs121() { final XQuery query = new XQuery( "xs:string(\"-1999-05-31T13:20:00+14:00\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(2000-01-16T00:00:00Z) castable as xs:dateTime . */ @org.junit.Test public void castableAs122() { final XQuery query = new XQuery( "xs:string(\"2000-01-16T00:00:00Z\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(true) castable as xs:dateTime . */ @org.junit.Test public void castableAs123() { final XQuery query = new XQuery( "xs:string(\"true\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:string(13:20:00-05:00) castable as xs:time . */ @org.junit.Test public void castableAs124() { final XQuery query = new XQuery( "xs:string(\"13:20:00-05:00\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(13:20:02.123) castable as xs:time . */ @org.junit.Test public void castableAs125() { final XQuery query = new XQuery( "xs:string(\"13:20:02.123\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(13:20:00Z) castable as xs:time . */ @org.junit.Test public void castableAs126() { final XQuery query = new XQuery( "xs:string(\"13:20:00Z\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(true) castable as xs:time . */ @org.junit.Test public void castableAs127() { final XQuery query = new XQuery( "xs:string(\"true\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:string(1999-05-31) castable as xs:date . */ @org.junit.Test public void castableAs128() { final XQuery query = new XQuery( "xs:string(\"1999-05-31\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(-0012-12-03-05:00) castable as xs:date . */ @org.junit.Test public void castableAs129() { final XQuery query = new XQuery( "xs:string(\"-0012-12-03-05:00\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(1999-05-31Z) castable as xs:date . */ @org.junit.Test public void castableAs130() { final XQuery query = new XQuery( "xs:string(\"1999-05-31Z\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(true) castable as xs:date . */ @org.junit.Test public void castableAs131() { final XQuery query = new XQuery( "xs:string(\"true\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:string(1999-05) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs132() { final XQuery query = new XQuery( "xs:string(\"1999-05\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(-0012-12-05:00) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs133() { final XQuery query = new XQuery( "xs:string(\"-0012-12-05:00\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(1999-05Z) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs134() { final XQuery query = new XQuery( "xs:string(\"1999-05Z\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(true) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs135() { final XQuery query = new XQuery( "xs:string(\"true\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:string(1999) castable as xs:gYear . */ @org.junit.Test public void castableAs136() { final XQuery query = new XQuery( "xs:string(\"1999\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(-0012-05:00) castable as xs:gYear . */ @org.junit.Test public void castableAs137() { final XQuery query = new XQuery( "xs:string(\"-0012-05:00\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(1999Z) castable as xs:gYear . */ @org.junit.Test public void castableAs138() { final XQuery query = new XQuery( "xs:string(\"1999Z\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(true) castable as xs:gYear . */ @org.junit.Test public void castableAs139() { final XQuery query = new XQuery( "xs:string(\"true\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:string(--05-31) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs140() { final XQuery query = new XQuery( "xs:string(\"--05-31\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(--05-31+14:00) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs141() { final XQuery query = new XQuery( "xs:string(\"--05-31+14:00\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(--05-31Z) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs142() { final XQuery query = new XQuery( "xs:string(\"--05-31Z\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(true) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs143() { final XQuery query = new XQuery( "xs:string(\"true\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:string(---31) castable as xs:gDay . */ @org.junit.Test public void castableAs144() { final XQuery query = new XQuery( "xs:string(\"---31\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(---03-05:00) castable as xs:gDay . */ @org.junit.Test public void castableAs145() { final XQuery query = new XQuery( "xs:string(\"---03-05:00\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(---31Z) castable as xs:gDay . */ @org.junit.Test public void castableAs146() { final XQuery query = new XQuery( "xs:string(\"---31Z\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(true) castable as xs:gDay . */ @org.junit.Test public void castableAs147() { final XQuery query = new XQuery( "xs:string(\"true\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:string(--05) castable as xs:gMonth . */ @org.junit.Test public void castableAs148() { final XQuery query = new XQuery( "xs:string(\"--05\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(--12-05:00) castable as xs:gMonth . */ @org.junit.Test public void castableAs149() { final XQuery query = new XQuery( "xs:string(\"--12-05:00\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(--05Z) castable as xs:gMonth . */ @org.junit.Test public void castableAs150() { final XQuery query = new XQuery( "xs:string(\"--05Z\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(true) castable as xs:gMonth . */ @org.junit.Test public void castableAs151() { final XQuery query = new XQuery( "xs:string(\"true\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:string(0.0) castable as xs:boolean . */ @org.junit.Test public void castableAs152() { final XQuery query = new XQuery( "xs:string(\"0.0\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:string(0) castable as xs:boolean . */ @org.junit.Test public void castableAs153() { final XQuery query = new XQuery( "xs:string(\"0\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(true) castable as xs:boolean . */ @org.junit.Test public void castableAs154() { final XQuery query = new XQuery( "xs:string(\"true\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(true) castable as xs:base64Binary . */ @org.junit.Test public void castableAs155() { final XQuery query = new XQuery( "xs:string(\"true\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(00000000) castable as xs:base64Binary . */ @org.junit.Test public void castableAs156() { final XQuery query = new XQuery( "xs:string(\"00000000\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(D74D35D35D35) castable as xs:base64Binary . */ @org.junit.Test public void castableAs157() { final XQuery query = new XQuery( "xs:string(\"D74D35D35D35\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(true) castable as xs:hexBinary . */ @org.junit.Test public void castableAs158() { final XQuery query = new XQuery( "xs:string(\"true\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:string(010010101) castable as xs:hexBinary . */ @org.junit.Test public void castableAs159() { final XQuery query = new XQuery( "xs:string(\"010010101\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:string(0fb7) castable as xs:hexBinary . */ @org.junit.Test public void castableAs160() { final XQuery query = new XQuery( "xs:string(\"0fb7\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(D74D35D35D35) castable as xs:hexBinary . */ @org.junit.Test public void castableAs161() { final XQuery query = new XQuery( "xs:string(\"D74D35D35D35\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(-0012-05:00) castable as xs:anyURI . */ @org.junit.Test public void castableAs162() { final XQuery query = new XQuery( "xs:string(\"http://www.example.com/~b%C3%A9b%C3%A9\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(true) castable as xs:anyURI . */ @org.junit.Test public void castableAs163() { final XQuery query = new XQuery( "xs:string(\"true\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:string(http://www.ietf.org/rfc/rfc2396.txt) castable as xs:anyURI . */ @org.junit.Test public void castableAs164() { final XQuery query = new XQuery( "xs:string(\"http://www.ietf.org/rfc/rfc2396.txt\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:float(1e5) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs165() { final XQuery query = new XQuery( "xs:float(\"1e5\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:float(-INF) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs166() { final XQuery query = new XQuery( "xs:float(\"-INF\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:float(-0.0E0) castable as xs:string . */ @org.junit.Test public void castableAs167() { final XQuery query = new XQuery( "xs:float(\"-0.0E0\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:float(NaN) castable as xs:string . */ @org.junit.Test public void castableAs168() { final XQuery query = new XQuery( "xs:float(\"NaN\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:float(5.4321E-100) castable as xs:float . */ @org.junit.Test public void castableAs169() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:float(-1.75e-3) castable as xs:float . */ @org.junit.Test public void castableAs170() { final XQuery query = new XQuery( "xs:float(\"-1.75e-3\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:float(INF) castable as xs:float . */ @org.junit.Test public void castableAs171() { final XQuery query = new XQuery( "xs:float(\"INF\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:float(-0.0E0) castable as xs:double . */ @org.junit.Test public void castableAs172() { final XQuery query = new XQuery( "xs:float(\"-0.0E0\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:float(-INF) castable as xs:double . */ @org.junit.Test public void castableAs173() { final XQuery query = new XQuery( "xs:float(\"-INF\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:float(-0.0E0) castable as xs:decimal . */ @org.junit.Test public void castableAs174() { final XQuery query = new XQuery( "xs:float(\"-0.0E0\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:float(5.4321E-100) castable as xs:decimal . */ @org.junit.Test public void castableAs175() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:float(1e5) castable as xs:decimal . */ @org.junit.Test public void castableAs176() { final XQuery query = new XQuery( "xs:float(\"1e5\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:float(-1.75e-3) castable as xs:decimal . */ @org.junit.Test public void castableAs177() { final XQuery query = new XQuery( "xs:float(\"-1.75e-3\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:float(-0.0E0) castable as xs:integer . */ @org.junit.Test public void castableAs178() { final XQuery query = new XQuery( "xs:float(\"-0.0E0\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:float(1e5) castable as xs:integer . */ @org.junit.Test public void castableAs179() { final XQuery query = new XQuery( "xs:float(\"1e5\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:float(INF) castable as xs:integer . */ @org.junit.Test public void castableAs180() { final XQuery query = new XQuery( "xs:float(\"INF\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:float(-1.75e-3) castable as xs:duration . */ @org.junit.Test public void castableAs181() { final XQuery query = new XQuery( "xs:float(\"-1.75e-3\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:float(5.4321E-100) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs182() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:float(5.4321E-100) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs183() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:float(5.4321E-100) castable as xs:dateTime . */ @org.junit.Test public void castableAs184() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:float(5.4321E-100) castable as xs:time . */ @org.junit.Test public void castableAs185() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:float(5.4321E-100) castable as xs:date . */ @org.junit.Test public void castableAs186() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:float(5.4321E-100) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs187() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:float(5.4321E-100) castable as xs:gYear . */ @org.junit.Test public void castableAs188() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:float(5.4321E-100) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs189() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:float(5.4321E-100) castable as xs:gDay . */ @org.junit.Test public void castableAs190() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:float(5.4321E-100) castable as xs:gMonth . */ @org.junit.Test public void castableAs191() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:float(-0.0E0) castable as xs:boolean . */ @org.junit.Test public void castableAs192() { final XQuery query = new XQuery( "xs:float(\"-0.0E0\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:float(1e5) castable as xs:boolean . */ @org.junit.Test public void castableAs193() { final XQuery query = new XQuery( "xs:float(\"1e5\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:float(-INF) castable as xs:boolean . */ @org.junit.Test public void castableAs194() { final XQuery query = new XQuery( "xs:float(\"-INF\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:float(NaN) castable as xs:boolean . */ @org.junit.Test public void castableAs195() { final XQuery query = new XQuery( "xs:float(\"NaN\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:float(5.4321E-100) castable as xs:base64Binary . */ @org.junit.Test public void castableAs196() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:float(5.4321E-100) castable as xs:hexBinary . */ @org.junit.Test public void castableAs197() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:float(5.4321E-100) castable as xs:anyURI . */ @org.junit.Test public void castableAs198() { final XQuery query = new XQuery( "xs:float(\"5.4321E-100\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:double(1e5) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs199() { final XQuery query = new XQuery( "xs:double(\"1e5\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:double(INF) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs200() { final XQuery query = new XQuery( "xs:double(\"INF\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:double(1e8) castable as xs:string . */ @org.junit.Test public void castableAs201() { final XQuery query = new XQuery( "xs:double(\"1e8\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:double(INF) castable as xs:string . */ @org.junit.Test public void castableAs202() { final XQuery query = new XQuery( "xs:double(\"INF\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:double(-0.0E0) castable as xs:float . */ @org.junit.Test public void castableAs203() { final XQuery query = new XQuery( "xs:double(\"-0.0E0\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:double(5.4321E-1001) castable as xs:float . */ @org.junit.Test public void castableAs204() { final XQuery query = new XQuery( "xs:double(\"5.4321E-1001\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:double(1e5) castable as xs:float . */ @org.junit.Test public void castableAs205() { final XQuery query = new XQuery( "xs:double(\"1e5\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:double(-1.75e-3) castable as xs:float . */ @org.junit.Test public void castableAs206() { final XQuery query = new XQuery( "xs:double(\"-1.75e-3\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:double(NaN) castable as xs:float . */ @org.junit.Test public void castableAs207() { final XQuery query = new XQuery( "xs:double(\"NaN\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:double(1e5) castable as xs:double . */ @org.junit.Test public void castableAs208() { final XQuery query = new XQuery( "xs:double(\"1e5\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:double(INF) castable as xs:double . */ @org.junit.Test public void castableAs209() { final XQuery query = new XQuery( "xs:double(\"INF\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:double(-0.0E0) castable as xs:decimal . */ @org.junit.Test public void castableAs210() { final XQuery query = new XQuery( "xs:double(\"-0.0E0\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:double(5.4321E-1001) castable as xs:decimal . */ @org.junit.Test public void castableAs211() { final XQuery query = new XQuery( "xs:double(\"5.4321E-1001\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:double(-1.75e-3) castable as xs:decimal . */ @org.junit.Test public void castableAs212() { final XQuery query = new XQuery( "xs:double(\"-1.75e-3\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:double(INF) castable as xs:decimal . */ @org.junit.Test public void castableAs213() { final XQuery query = new XQuery( "xs:double(\"INF\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:double(-0.0E0) castable as xs:integer . */ @org.junit.Test public void castableAs214() { final XQuery query = new XQuery( "xs:double(\"-0.0E0\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:double(1e5) castable as xs:integer . */ @org.junit.Test public void castableAs215() { final XQuery query = new XQuery( "xs:double(\"1e5\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:double(-1.75e-3) castable as xs:integer . */ @org.junit.Test public void castableAs216() { final XQuery query = new XQuery( "xs:double(\"-1.75e-3\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:double(INF) castable as xs:integer . */ @org.junit.Test public void castableAs217() { final XQuery query = new XQuery( "xs:double(\"INF\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:double(NaN) castable as xs:integer . */ @org.junit.Test public void castableAs218() { final XQuery query = new XQuery( "xs:double(\"NaN\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:double(1e5) castable as xs:duration . */ @org.junit.Test public void castableAs219() { final XQuery query = new XQuery( "xs:double(\"1e5\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:double(1e5) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs220() { final XQuery query = new XQuery( "xs:double(\"1e5\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:double(1e5) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs221() { final XQuery query = new XQuery( "xs:double(\"1e5\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:double(1e5) castable as xs:dateTime . */ @org.junit.Test public void castableAs222() { final XQuery query = new XQuery( "xs:double(\"1e5\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:double(1e5) castable as xs:time . */ @org.junit.Test public void castableAs223() { final XQuery query = new XQuery( "xs:double(\"1e5\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:double(1e5) castable as xs:date . */ @org.junit.Test public void castableAs224() { final XQuery query = new XQuery( "xs:double(\"1e5\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:double(1e5) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs225() { final XQuery query = new XQuery( "xs:double(\"1e5\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:double(1e5) castable as xs:gYear . */ @org.junit.Test public void castableAs226() { final XQuery query = new XQuery( "xs:double(\"1e5\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:double(1e5) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs227() { final XQuery query = new XQuery( "xs:double(\"1e5\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:double(1e5) castable as xs:gDay . */ @org.junit.Test public void castableAs228() { final XQuery query = new XQuery( "xs:double(\"1e5\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:double(1e5) castable as xs:gMonth . */ @org.junit.Test public void castableAs229() { final XQuery query = new XQuery( "xs:double(\"1e5\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:double(1e5) castable as xs:boolean . */ @org.junit.Test public void castableAs230() { final XQuery query = new XQuery( "xs:double(\"1e5\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:double(1e5) castable as xs:base64Binary . */ @org.junit.Test public void castableAs231() { final XQuery query = new XQuery( "xs:double(\"1e5\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:double(1e5) castable as xs:hexBinary . */ @org.junit.Test public void castableAs232() { final XQuery query = new XQuery( "xs:double(\"1e5\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:double(1e5) castable as xs:anyURI . */ @org.junit.Test public void castableAs233() { final XQuery query = new XQuery( "xs:double(\"1e5\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:decimal(-1.1234) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs234() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:decimal(-1.1234) castable as xs:string . */ @org.junit.Test public void castableAs235() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:decimal(-1.1234) castable as xs:float . */ @org.junit.Test public void castableAs236() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:decimal(-1.1234) castable as xs:double . */ @org.junit.Test public void castableAs237() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:decimal(-1.1234) castable as xs:decimal . */ @org.junit.Test public void castableAs238() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:decimal(-1.1234) castable as xs:integer . */ @org.junit.Test public void castableAs239() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:decimal(5.5432) castable as xs:integer . */ @org.junit.Test public void castableAs240() { final XQuery query = new XQuery( "xs:decimal(\"5.5432\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:decimal(-1.1234) castable as xs:duration . */ @org.junit.Test public void castableAs241() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:decimal(-1.1234) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs242() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:decimal(-1.1234) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs243() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:decimal(-1.1234) castable as xs:dateTime . */ @org.junit.Test public void castableAs244() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:decimal(-1.1234) castable as xs:time . */ @org.junit.Test public void castableAs245() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:decimal(-1.1234) castable as xs:date . */ @org.junit.Test public void castableAs246() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:decimal(-1.1234) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs247() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:decimal(-1.1234) castable as xs:gYear . */ @org.junit.Test public void castableAs248() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:decimal(-1.1234) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs249() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:decimal(-1.1234) castable as xs:gDay . */ @org.junit.Test public void castableAs250() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:decimal(-1.1234) castable as xs:gMonth . */ @org.junit.Test public void castableAs251() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:decimal(-1.1234) castable as xs:boolean . */ @org.junit.Test public void castableAs252() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:decimal(-1.1234) castable as xs:base64Binary . */ @org.junit.Test public void castableAs253() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:decimal(-1.1234) castable as xs:hexBinary . */ @org.junit.Test public void castableAs254() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:decimal(-1.1234) castable as xs:anyURI . */ @org.junit.Test public void castableAs255() { final XQuery query = new XQuery( "xs:decimal(\"-1.1234\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:integer(1) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs256() { final XQuery query = new XQuery( "xs:integer(\"1\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:integer(-100) castable as xs:string . */ @org.junit.Test public void castableAs257() { final XQuery query = new XQuery( "xs:integer(\"-100\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:integer(-100) castable as xs:float . */ @org.junit.Test public void castableAs258() { final XQuery query = new XQuery( "xs:integer(\"-100\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:integer(-100) castable as xs:double . */ @org.junit.Test public void castableAs259() { final XQuery query = new XQuery( "xs:integer(\"-100\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:integer(-100) castable as xs:decimal . */ @org.junit.Test public void castableAs260() { final XQuery query = new XQuery( "xs:integer(\"-100\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:integer(-100) castable as xs:integer . */ @org.junit.Test public void castableAs261() { final XQuery query = new XQuery( "xs:integer(\"-100\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:integer(-100) castable as xs:duration . */ @org.junit.Test public void castableAs262() { final XQuery query = new XQuery( "xs:integer(\"-100\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:integer(-100) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs263() { final XQuery query = new XQuery( "xs:integer(\"-100\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:integer(-100) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs264() { final XQuery query = new XQuery( "xs:integer(\"-100\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:integer(-100) castable as xs:dateTime . */ @org.junit.Test public void castableAs265() { final XQuery query = new XQuery( "xs:integer(\"-100\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:integer(-100) castable as xs:time . */ @org.junit.Test public void castableAs266() { final XQuery query = new XQuery( "xs:integer(\"-100\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:integer(-100) castable as xs:date . */ @org.junit.Test public void castableAs267() { final XQuery query = new XQuery( "xs:integer(\"-100\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:integer(-100) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs268() { final XQuery query = new XQuery( "xs:integer(\"-100\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:integer(-100) castable as xs:gYear . */ @org.junit.Test public void castableAs269() { final XQuery query = new XQuery( "xs:integer(\"-100\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:integer(-100) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs270() { final XQuery query = new XQuery( "xs:integer(\"-100\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:integer(-100) castable as xs:gDay . */ @org.junit.Test public void castableAs271() { final XQuery query = new XQuery( "xs:integer(\"-100\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:integer(-100) castable as xs:gMonth . */ @org.junit.Test public void castableAs272() { final XQuery query = new XQuery( "xs:integer(\"-100\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:integer(-100) castable as xs:boolean . */ @org.junit.Test public void castableAs273() { final XQuery query = new XQuery( "xs:integer(\"-100\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:integer(-100) castable as xs:base64Binary . */ @org.junit.Test public void castableAs274() { final XQuery query = new XQuery( "xs:integer(\"-100\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:integer(-100) castable as xs:hexBinary . */ @org.junit.Test public void castableAs275() { final XQuery query = new XQuery( "xs:integer(\"-100\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:integer(-100) castable as xs:anyURI . */ @org.junit.Test public void castableAs276() { final XQuery query = new XQuery( "xs:integer(\"-100\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:duration(P1Y2M3DT10H30M23S) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs277() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:duration(P1Y2M3DT10H30M23S) castable as xs:string . */ @org.junit.Test public void castableAs278() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:duration(P1Y2M3DT10H30M23S) castable as xs:float . */ @org.junit.Test public void castableAs279() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:duration(P1Y2M3DT10H30M23S) castable as xs:double . */ @org.junit.Test public void castableAs280() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:duration(P1Y2M3DT10H30M23S) castable as xs:decimal . */ @org.junit.Test public void castableAs281() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:duration(P1Y2M3DT10H30M23S) castable as xs:integer . */ @org.junit.Test public void castableAs282() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:duration(P1Y2M3DT10H30M23S) castable as xs:duration . */ @org.junit.Test public void castableAs283() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:duration(PT10H) castable as xs:duration . */ @org.junit.Test public void castableAs284() { final XQuery query = new XQuery( "xs:duration(\"PT10H\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:duration(P1Y2M3DT10H30M23S) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs285() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:duration(PT10H) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs286() { final XQuery query = new XQuery( "xs:duration(\"PT10H\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:duration(P24M) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs287() { final XQuery query = new XQuery( "xs:duration(\"P24M\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:duration(P1Y2M3DT10H30M23S) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs288() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:duration(PT10H) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs289() { final XQuery query = new XQuery( "xs:duration(\"PT10H\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:duration(P24M) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs290() { final XQuery query = new XQuery( "xs:duration(\"P24M\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:duration(P1Y2M3DT10H30M23S) castable as xs:dateTime . */ @org.junit.Test public void castableAs291() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:duration(P1Y2M3DT10H30M23S) castable as xs:time . */ @org.junit.Test public void castableAs292() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:duration(P1Y2M3DT10H30M23S) castable as xs:date . */ @org.junit.Test public void castableAs293() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:duration(P1Y2M3DT10H30M23S) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs294() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:duration(P1Y2M3DT10H30M23S) castable as xs:gYear . */ @org.junit.Test public void castableAs295() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:duration(P1Y2M3DT10H30M23S) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs296() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:duration(P1Y2M3DT10H30M23S) castable as xs:gDay . */ @org.junit.Test public void castableAs297() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:duration(P1Y2M3DT10H30M23S) castable as xs:gMonth . */ @org.junit.Test public void castableAs298() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:duration(P1Y2M3DT10H30M23S) castable as xs:boolean . */ @org.junit.Test public void castableAs299() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:duration(P1Y2M3DT10H30M23S) castable as xs:base64Binary . */ @org.junit.Test public void castableAs300() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:duration(P1Y2M3DT10H30M23S) castable as xs:hexBinary . */ @org.junit.Test public void castableAs301() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:duration(P1Y2M3DT10H30M23S) castable as xs:anyURI . */ @org.junit.Test public void castableAs302() { final XQuery query = new XQuery( "xs:duration(\"P1Y2M3DT10H30M23S\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:yearMonthDuration(P1Y2M) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs303() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:yearMonthDuration(P1Y2M) castable as xs:string . */ @org.junit.Test public void castableAs304() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:yearMonthDuration(P1Y2M) castable as xs:float . */ @org.junit.Test public void castableAs305() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:yearMonthDuration(P1Y2M) castable as xs:double . */ @org.junit.Test public void castableAs306() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:yearMonthDuration(P1Y2M) castable as xs:decimal . */ @org.junit.Test public void castableAs307() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:yearMonthDuration(P1Y2M) castable as xs:integer . */ @org.junit.Test public void castableAs308() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:yearMonthDuration(P1Y2M) castable as xs:duration . */ @org.junit.Test public void castableAs309() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:yearMonthDuration(P1Y2M) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs310() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:yearMonthDuration(-P21M) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs311() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"-P21M\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:yearMonthDuration(P1Y2M) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs312() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:yearMonthDuration(P1Y2M) castable as xs:dateTime . */ @org.junit.Test public void castableAs313() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:yearMonthDuration(P1Y2M) castable as xs:time . */ @org.junit.Test public void castableAs314() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:yearMonthDuration(P1Y2M) castable as xs:date . */ @org.junit.Test public void castableAs315() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:yearMonthDuration(P1Y2M) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs316() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:yearMonthDuration(P1Y2M) castable as xs:gYear . */ @org.junit.Test public void castableAs317() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:yearMonthDuration(P1Y2M) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs318() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:yearMonthDuration(P1Y2M) castable as xs:gDay . */ @org.junit.Test public void castableAs319() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:yearMonthDuration(P1Y2M) castable as xs:gMonth . */ @org.junit.Test public void castableAs320() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:yearMonthDuration(P1Y2M) castable as xs:boolean . */ @org.junit.Test public void castableAs321() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:yearMonthDuration(P1Y2M) castable as xs:base64Binary . */ @org.junit.Test public void castableAs322() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:yearMonthDuration(P1Y2M) castable as xs:hexBinary . */ @org.junit.Test public void castableAs323() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:yearMonthDuration(P1Y2M) castable as xs:anyURI . */ @org.junit.Test public void castableAs324() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1Y2M\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:dayTimeDuration(P3DT10H30M) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs325() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dayTimeDuration(-PT100M) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs326() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"-PT100M\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dayTimeDuration(P3DT10H30M) castable as xs:string . */ @org.junit.Test public void castableAs327() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dayTimeDuration(-PT100M) castable as xs:string . */ @org.junit.Test public void castableAs328() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"-PT100M\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dayTimeDuration(P3DT10H30M) castable as xs:float . */ @org.junit.Test public void castableAs329() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:dayTimeDuration(P3DT10H30M) castable as xs:double . */ @org.junit.Test public void castableAs330() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:dayTimeDuration(P3DT10H30M) castable as xs:decimal . */ @org.junit.Test public void castableAs331() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:dayTimeDuration(P3DT10H30M) castable as xs:integer . */ @org.junit.Test public void castableAs332() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:dayTimeDuration(P3DT10H30M) castable as xs:duration . */ @org.junit.Test public void castableAs333() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dayTimeDuration(PT24H) castable as xs:duration . */ @org.junit.Test public void castableAs334() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"PT24H\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dayTimeDuration(-PT100M) castable as xs:duration . */ @org.junit.Test public void castableAs335() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"-PT100M\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dayTimeDuration(P3DT10H30M) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs336() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dayTimeDuration(P3DT10H30M) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs337() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dayTimeDuration(P14D) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs338() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P14D\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dayTimeDuration(-PT100M) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs339() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"-PT100M\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dayTimeDuration(P3DT10H30M) castable as xs:dateTime . */ @org.junit.Test public void castableAs340() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:dayTimeDuration(P3DT10H30M) castable as xs:time . */ @org.junit.Test public void castableAs341() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:dayTimeDuration(P3DT10H30M) castable as xs:date . */ @org.junit.Test public void castableAs342() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:dayTimeDuration(P3DT10H30M) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs343() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:dayTimeDuration(P3DT10H30M) castable as xs:gYear . */ @org.junit.Test public void castableAs344() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:dayTimeDuration(P3DT10H30M) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs345() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:dayTimeDuration(P3DT10H30M) castable as xs:gDay . */ @org.junit.Test public void castableAs346() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:dayTimeDuration(P3DT10H30M) castable as xs:gMonth . */ @org.junit.Test public void castableAs347() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:dayTimeDuration(P3DT10H30M) castable as xs:boolean . */ @org.junit.Test public void castableAs348() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:dayTimeDuration(P3DT10H30M) castable as xs:base64Binary . */ @org.junit.Test public void castableAs349() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:dayTimeDuration(P3DT10H30M) castable as xs:hexBinary . */ @org.junit.Test public void castableAs350() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:dayTimeDuration(P3DT10H30M) castable as xs:anyURI . */ @org.junit.Test public void castableAs351() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT10H30M\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:dateTime(1999-05-31T13:20:00) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs352() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dateTime(-1999-05-31T13:20:00+14:00) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs353() { final XQuery query = new XQuery( "xs:dateTime(\"-1999-05-31T13:20:00+14:00\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dateTime(1999-05-31T13:20:00) castable as xs:string . */ @org.junit.Test public void castableAs354() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dateTime(-1999-05-31T13:20:00+14:00) castable as xs:string . */ @org.junit.Test public void castableAs355() { final XQuery query = new XQuery( "xs:dateTime(\"-1999-05-31T13:20:00+14:00\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dateTime(1999-05-31T13:20:00) castable as xs:float . */ @org.junit.Test public void castableAs356() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:dateTime(2000-01-16T00:00:00Z) castable as xs:float . */ @org.junit.Test public void castableAs357() { final XQuery query = new XQuery( "xs:dateTime(\"2000-01-16T00:00:00Z\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:dateTime(1999-05-31T13:20:00) castable as xs:decimal . */ @org.junit.Test public void castableAs358() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:dateTime(1999-05-31T13:20:00) castable as xs:integer . */ @org.junit.Test public void castableAs359() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:dateTime(1999-05-31T13:20:00) castable as xs:duration . */ @org.junit.Test public void castableAs360() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:dateTime(1999-05-31T13:20:00) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs361() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:dateTime(1999-05-31T13:20:00) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs362() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:dateTime(1999-05-31T13:20:00) castable as xs:dateTime . */ @org.junit.Test public void castableAs363() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dateTime(1999-05-31T13:20:00) castable as xs:time . */ @org.junit.Test public void castableAs364() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dateTime(-1999-05-31T13:20:00+14:00) castable as xs:time . */ @org.junit.Test public void castableAs365() { final XQuery query = new XQuery( "xs:dateTime(\"-1999-05-31T13:20:00+14:00\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dateTime(1999-05-31T13:20:00) castable as xs:date . */ @org.junit.Test public void castableAs366() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dateTime(-1999-05-31T13:20:00+14:00) castable as xs:date . */ @org.junit.Test public void castableAs367() { final XQuery query = new XQuery( "xs:dateTime(\"-1999-05-31T13:20:00+14:00\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dateTime(1999-05-31T13:20:00) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs368() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dateTime(-1999-05-31T13:20:00+14:00) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs369() { final XQuery query = new XQuery( "xs:dateTime(\"-1999-05-31T13:20:00+14:00\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dateTime(1999-05-31T13:20:00) castable as xs:gYear . */ @org.junit.Test public void castableAs370() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dateTime(-1999-05-31T13:20:00+14:00) castable as xs:gYear . */ @org.junit.Test public void castableAs371() { final XQuery query = new XQuery( "xs:dateTime(\"-1999-05-31T13:20:00+14:00\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dateTime(1999-05-31T13:20:00) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs372() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dateTime(-1999-05-31T13:20:00+14:00) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs373() { final XQuery query = new XQuery( "xs:dateTime(\"-1999-05-31T13:20:00+14:00\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dateTime(1999-05-31T13:20:00) castable as xs:gDay . */ @org.junit.Test public void castableAs374() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dateTime(-1999-05-31T13:20:00+14:00) castable as xs:gDay . */ @org.junit.Test public void castableAs375() { final XQuery query = new XQuery( "xs:dateTime(\"-1999-05-31T13:20:00+14:00\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dateTime(1999-05-31T13:20:00) castable as xs:gMonth . */ @org.junit.Test public void castableAs376() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dateTime(-1999-05-31T13:20:00+14:00) castable as xs:gMonth . */ @org.junit.Test public void castableAs377() { final XQuery query = new XQuery( "xs:dateTime(\"-1999-05-31T13:20:00+14:00\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:dateTime(1999-05-31T13:20:00) castable as xs:boolean . */ @org.junit.Test public void castableAs378() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:dateTime(1999-05-31T13:20:00) castable as xs:base64Binary . */ @org.junit.Test public void castableAs379() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:dateTime(1999-05-31T13:20:00) castable as xs:hexBinary . */ @org.junit.Test public void castableAs380() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:dateTime(1999-05-31T13:20:00) castable as xs:anyURI . */ @org.junit.Test public void castableAs381() { final XQuery query = new XQuery( "xs:dateTime(\"1999-05-31T13:20:00\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:time(13:20:00-05:00) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs382() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:time(13:20:00-05:00) castable as xs:string . */ @org.junit.Test public void castableAs383() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:time(13:20:00-05:00) castable as xs:float . */ @org.junit.Test public void castableAs384() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:time(13:20:00-05:00) castable as xs:double . */ @org.junit.Test public void castableAs385() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:time(13:20:00-05:00) castable as xs:decimal . */ @org.junit.Test public void castableAs386() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:time(13:20:00-05:00) castable as xs:integer . */ @org.junit.Test public void castableAs387() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:time(13:20:00-05:00) castable as xs:duration . */ @org.junit.Test public void castableAs388() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:time(13:20:00-05:00) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs389() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:time(13:20:00-05:00) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs390() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:time(13:20:00-05:00) castable as xs:dateTime . */ @org.junit.Test public void castableAs391() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:time(13:20:00-05:00) castable as xs:time . */ @org.junit.Test public void castableAs392() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:time(13:20:02.123) castable as xs:time . */ @org.junit.Test public void castableAs393() { final XQuery query = new XQuery( "xs:time(\"13:20:02.123\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:time(13:20:00Z) castable as xs:time . */ @org.junit.Test public void castableAs394() { final XQuery query = new XQuery( "xs:time(\"13:20:00Z\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:time(13:20:00-05:00) castable as xs:date . */ @org.junit.Test public void castableAs395() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:time(13:20:00-05:00) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs396() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:time(13:20:00-05:00) castable as xs:gYear . */ @org.junit.Test public void castableAs397() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:time(13:20:00-05:00) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs398() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:time(13:20:00-05:00) castable as xs:gDay . */ @org.junit.Test public void castableAs399() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:time(13:20:00-05:00) castable as xs:gMonth . */ @org.junit.Test public void castableAs400() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:time(13:20:00-05:00) castable as xs:boolean . */ @org.junit.Test public void castableAs401() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:time(13:20:00-05:00) castable as xs:base64Binary . */ @org.junit.Test public void castableAs402() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:time(13:20:00-05:00) castable as xs:hexBinary . */ @org.junit.Test public void castableAs403() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:time(13:20:00-05:00) castable as xs:anyURI . */ @org.junit.Test public void castableAs404() { final XQuery query = new XQuery( "xs:time(\"13:20:00-05:00\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:date(1999-05-31) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs405() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:date(-0012-12-03-05:00) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs406() { final XQuery query = new XQuery( "xs:date(\"-0012-12-03-05:00\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:date(1999-05-31) castable as xs:string . */ @org.junit.Test public void castableAs407() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:date(-0012-12-03-05:00) castable as xs:string . */ @org.junit.Test public void castableAs408() { final XQuery query = new XQuery( "xs:date(\"-0012-12-03-05:00\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:date(1999-05-31) castable as xs:float . */ @org.junit.Test public void castableAs409() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:date(1999-05-31) castable as xs:double . */ @org.junit.Test public void castableAs410() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:date(1999-05-31Z) castable as xs:double . */ @org.junit.Test public void castableAs411() { final XQuery query = new XQuery( "xs:date(\"1999-05-31Z\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:date(1999-05-31) castable as xs:integer . */ @org.junit.Test public void castableAs412() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:date(1999-05-31) castable as xs:duration . */ @org.junit.Test public void castableAs413() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:date(1999-05-31) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs414() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:date(1999-05-31) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs415() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:date(1999-05-31) castable as xs:dateTime . */ @org.junit.Test public void castableAs416() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:date(1999-05-31) castable as xs:time . */ @org.junit.Test public void castableAs417() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:date(1999-05-31) castable as xs:date . */ @org.junit.Test public void castableAs418() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:date(-0012-12-03-05:00) castable as xs:date . */ @org.junit.Test public void castableAs419() { final XQuery query = new XQuery( "xs:date(\"-0012-12-03-05:00\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:date(1999-05-31Z) castable as xs:date . */ @org.junit.Test public void castableAs420() { final XQuery query = new XQuery( "xs:date(\"1999-05-31Z\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:date(1999-05-31) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs421() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:date(1999-05-31) castable as xs:gYear . */ @org.junit.Test public void castableAs422() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:date(-0012-12-03-05:00) castable as xs:gYear . */ @org.junit.Test public void castableAs423() { final XQuery query = new XQuery( "xs:date(\"-0012-12-03-05:00\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:date(1999-05-31Z) castable as xs:gYear . */ @org.junit.Test public void castableAs424() { final XQuery query = new XQuery( "xs:date(\"1999-05-31Z\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:date(1999-05-31) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs425() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:date(-0012-12-03-05:00) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs426() { final XQuery query = new XQuery( "xs:date(\"-0012-12-03-05:00\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:date(1999-05-31Z) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs427() { final XQuery query = new XQuery( "xs:date(\"1999-05-31Z\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:date(1999-05-31Z) castable as xs:gDay . */ @org.junit.Test public void castableAs428() { final XQuery query = new XQuery( "xs:date(\"1999-05-31Z\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:date(-0012-12-03-05:00) castable as xs:gMonth . */ @org.junit.Test public void castableAs429() { final XQuery query = new XQuery( "xs:date(\"-0012-12-03-05:00\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:date(1999-05-31Z) castable as xs:gMonth . */ @org.junit.Test public void castableAs430() { final XQuery query = new XQuery( "xs:date(\"1999-05-31Z\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:date(1999-05-31) castable as xs:boolean . */ @org.junit.Test public void castableAs431() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:date(1999-05-31) castable as xs:base64Binary . */ @org.junit.Test public void castableAs432() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:date(1999-05-31) castable as xs:hexBinary . */ @org.junit.Test public void castableAs433() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:date(1999-05-31) castable as xs:anyURI . */ @org.junit.Test public void castableAs434() { final XQuery query = new XQuery( "xs:date(\"1999-05-31\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYearMonth(1999-05) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs435() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:gYearMonth(1999-05) castable as xs:string . */ @org.junit.Test public void castableAs436() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:gYearMonth(1999-05) castable as xs:float . */ @org.junit.Test public void castableAs437() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYearMonth(1999-05) castable as xs:double . */ @org.junit.Test public void castableAs438() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYearMonth(1999-05Z) castable as xs:double . */ @org.junit.Test public void castableAs439() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYearMonth(1999-05Z) castable as xs:decimal . */ @org.junit.Test public void castableAs440() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYearMonth(1999-05Z) castable as xs:integer . */ @org.junit.Test public void castableAs441() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYearMonth(1999-05Z) castable as xs:duration . */ @org.junit.Test public void castableAs442() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYearMonth(1999-05Z) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs443() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYearMonth(1999-05Z) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs444() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYearMonth(1999-05Z) castable as xs:dateTime . */ @org.junit.Test public void castableAs445() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYearMonth(1999-05Z) castable as xs:time . */ @org.junit.Test public void castableAs446() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYearMonth(1999-05Z) castable as xs:date . */ @org.junit.Test public void castableAs447() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYearMonth(1999-05) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs448() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:gYearMonth(-0012-12-05:00) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs449() { final XQuery query = new XQuery( "xs:gYearMonth(\"-0012-12-05:00\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:gYearMonth(1999-05Z) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs450() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:gYearMonth(1999-05Z) castable as xs:gYear . */ @org.junit.Test public void castableAs451() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYearMonth(1999-05Z) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs452() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYearMonth(1999-05Z) castable as xs:gDay . */ @org.junit.Test public void castableAs453() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYearMonth(1999-05Z) castable as xs:gMonth . */ @org.junit.Test public void castableAs454() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYearMonth(1999-05Z) castable as xs:boolean . */ @org.junit.Test public void castableAs455() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYearMonth(1999-05Z) castable as xs:base64Binary . */ @org.junit.Test public void castableAs456() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYearMonth(1999-05Z) castable as xs:hexBinary . */ @org.junit.Test public void castableAs457() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYearMonth(1999-05Z) castable as xs:anyURI . */ @org.junit.Test public void castableAs458() { final XQuery query = new XQuery( "xs:gYearMonth(\"1999-05Z\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYear(1999) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs459() { final XQuery query = new XQuery( "xs:gYear(\"1999\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:gYear(1999) castable as xs:string . */ @org.junit.Test public void castableAs460() { final XQuery query = new XQuery( "xs:gYear(\"1999\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:gYear(1999) castable as xs:float . */ @org.junit.Test public void castableAs461() { final XQuery query = new XQuery( "xs:gYear(\"1999\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYear(1999) castable as xs:double . */ @org.junit.Test public void castableAs462() { final XQuery query = new XQuery( "xs:gYear(\"1999\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYear(1999) castable as xs:decimal . */ @org.junit.Test public void castableAs463() { final XQuery query = new XQuery( "xs:gYear(\"1999\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYear(1999) castable as xs:integer . */ @org.junit.Test public void castableAs464() { final XQuery query = new XQuery( "xs:gYear(\"1999\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYear(1999) castable as xs:duration . */ @org.junit.Test public void castableAs465() { final XQuery query = new XQuery( "xs:gYear(\"1999\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYear(1999) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs466() { final XQuery query = new XQuery( "xs:gYear(\"1999\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYear(1999) castable as xs:dateTime . */ @org.junit.Test public void castableAs467() { final XQuery query = new XQuery( "xs:gYear(\"1999\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYear(1999) castable as xs:time . */ @org.junit.Test public void castableAs468() { final XQuery query = new XQuery( "xs:gYear(\"1999\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYear(1999) castable as xs:date . */ @org.junit.Test public void castableAs469() { final XQuery query = new XQuery( "xs:gYear(\"1999\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYear(1999) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs470() { final XQuery query = new XQuery( "xs:gYear(\"1999\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYear(1999) castable as xs:gYear . */ @org.junit.Test public void castableAs471() { final XQuery query = new XQuery( "xs:gYear(\"1999\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:gYear(-0012-05:00) castable as xs:gYear . */ @org.junit.Test public void castableAs472() { final XQuery query = new XQuery( "xs:gYear(\"-0012-05:00\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:gYear(1999Z) castable as xs:gYear . */ @org.junit.Test public void castableAs473() { final XQuery query = new XQuery( "xs:gYear(\"1999Z\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:gYear(1999) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs474() { final XQuery query = new XQuery( "xs:gYear(\"1999\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYear(1999) castable as xs:gDay . */ @org.junit.Test public void castableAs475() { final XQuery query = new XQuery( "xs:gYear(\"1999\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYear(1999) castable as xs:gMonth . */ @org.junit.Test public void castableAs476() { final XQuery query = new XQuery( "xs:gYear(\"1999\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYear(1999) castable as xs:boolean . */ @org.junit.Test public void castableAs477() { final XQuery query = new XQuery( "xs:gYear(\"1999\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYear(1999) castable as xs:base64Binary . */ @org.junit.Test public void castableAs478() { final XQuery query = new XQuery( "xs:gYear(\"1999\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYear(1999) castable as xs:hexBinary . */ @org.junit.Test public void castableAs479() { final XQuery query = new XQuery( "xs:gYear(\"1999\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gYear(1999) castable as xs:anyURI . */ @org.junit.Test public void castableAs480() { final XQuery query = new XQuery( "xs:gYear(\"1999\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonthDay(--05-31) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs481() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:gMonthDay(--05-31) castable as xs:string . */ @org.junit.Test public void castableAs482() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:gMonthDay(--05-31) castable as xs:float . */ @org.junit.Test public void castableAs483() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonthDay(--05-31) castable as xs:double . */ @org.junit.Test public void castableAs484() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonthDay(--05-31) castable as xs:decimal . */ @org.junit.Test public void castableAs485() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonthDay(--05-31) castable as xs:integer . */ @org.junit.Test public void castableAs486() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonthDay(--05-31) castable as xs:duration . */ @org.junit.Test public void castableAs487() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonthDay(--05-31) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs488() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonthDay(--05-31) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs489() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonthDay(--05-31) castable as xs:dateTime . */ @org.junit.Test public void castableAs490() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonthDay(--05-31) castable as xs:time . */ @org.junit.Test public void castableAs491() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonthDay(--05-31) castable as xs:date . */ @org.junit.Test public void castableAs492() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonthDay(--05-31) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs493() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonthDay(--05-31) castable as xs:gYear . */ @org.junit.Test public void castableAs494() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonthDay(--05-31) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs495() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:gMonthDay(--12-03-05:00) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs496() { final XQuery query = new XQuery( "xs:gMonthDay(\"--12-03-05:00\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:gMonthDay(--05-31Z) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs497() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31Z\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:gMonthDay(--05-31) castable as xs:gDay . */ @org.junit.Test public void castableAs498() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonthDay(--05-31) castable as xs:gMonth . */ @org.junit.Test public void castableAs499() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonthDay(--05-31) castable as xs:boolean . */ @org.junit.Test public void castableAs500() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonthDay(--05-31) castable as xs:base64Binary . */ @org.junit.Test public void castableAs501() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonthDay(--05-31) castable as xs:hexBinary . */ @org.junit.Test public void castableAs502() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonthDay(--05-31) castable as xs:anyURI . */ @org.junit.Test public void castableAs503() { final XQuery query = new XQuery( "xs:gMonthDay(\"--05-31\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gDay(---31) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs504() { final XQuery query = new XQuery( "xs:gDay(\"---31\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:gDay(---31) castable as xs:string . */ @org.junit.Test public void castableAs505() { final XQuery query = new XQuery( "xs:gDay(\"---31\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:gDay(---31) castable as xs:float . */ @org.junit.Test public void castableAs506() { final XQuery query = new XQuery( "xs:gDay(\"---31\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gDay(---31) castable as xs:double . */ @org.junit.Test public void castableAs507() { final XQuery query = new XQuery( "xs:gDay(\"---31\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gDay(---31) castable as xs:decimal . */ @org.junit.Test public void castableAs508() { final XQuery query = new XQuery( "xs:gDay(\"---31\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gDay(---31) castable as xs:integer . */ @org.junit.Test public void castableAs509() { final XQuery query = new XQuery( "xs:gDay(\"---31\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gDay(---31) castable as xs:duration . */ @org.junit.Test public void castableAs510() { final XQuery query = new XQuery( "xs:gDay(\"---31\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gDay(---31) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs511() { final XQuery query = new XQuery( "xs:gDay(\"---31\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gDay(---31) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs512() { final XQuery query = new XQuery( "xs:gDay(\"---31\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gDay(---31) castable as xs:dateTime . */ @org.junit.Test public void castableAs513() { final XQuery query = new XQuery( "xs:gDay(\"---31\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gDay(---31) castable as xs:time . */ @org.junit.Test public void castableAs514() { final XQuery query = new XQuery( "xs:gDay(\"---31\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gDay(---31) castable as xs:date . */ @org.junit.Test public void castableAs515() { final XQuery query = new XQuery( "xs:gDay(\"---31\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gDay(---31) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs516() { final XQuery query = new XQuery( "xs:gDay(\"---31\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gDay(---31) castable as xs:gYear . */ @org.junit.Test public void castableAs517() { final XQuery query = new XQuery( "xs:gDay(\"---31\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gDay(---31) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs518() { final XQuery query = new XQuery( "xs:gDay(\"---31\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gDay(---31) castable as xs:gDay . */ @org.junit.Test public void castableAs519() { final XQuery query = new XQuery( "xs:gDay(\"---31\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:gDay(---03-05:00) castable as xs:gDay . */ @org.junit.Test public void castableAs520() { final XQuery query = new XQuery( "xs:gDay(\"---03-05:00\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:gDay(---31Z) castable as xs:gDay . */ @org.junit.Test public void castableAs521() { final XQuery query = new XQuery( "xs:gDay(\"---31Z\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:gDay(---31) castable as xs:gMonth . */ @org.junit.Test public void castableAs522() { final XQuery query = new XQuery( "xs:gDay(\"---31\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gDay(---31) castable as xs:boolean . */ @org.junit.Test public void castableAs523() { final XQuery query = new XQuery( "xs:gDay(\"---31\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gDay(---31) castable as xs:base64Binary . */ @org.junit.Test public void castableAs524() { final XQuery query = new XQuery( "xs:gDay(\"---31\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gDay(---31) castable as xs:hexBinary . */ @org.junit.Test public void castableAs525() { final XQuery query = new XQuery( "xs:gDay(\"---31\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gDay(---31) castable as xs:anyURI . */ @org.junit.Test public void castableAs526() { final XQuery query = new XQuery( "xs:gDay(\"---31\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonth(--05) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs527() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:gMonth(--05) castable as xs:string . */ @org.junit.Test public void castableAs528() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:gMonth(--05) castable as xs:float . */ @org.junit.Test public void castableAs529() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonth(--05) castable as xs:double . */ @org.junit.Test public void castableAs530() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonth(--05) castable as xs:decimal . */ @org.junit.Test public void castableAs531() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonth(--05) castable as xs:integer . */ @org.junit.Test public void castableAs532() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonth(--05) castable as xs:duration . */ @org.junit.Test public void castableAs533() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonth(--05) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs534() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonth(--05) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs535() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonth(--05) castable as xs:dateTime . */ @org.junit.Test public void castableAs536() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonth(--05) castable as xs:time . */ @org.junit.Test public void castableAs537() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonth(--05) castable as xs:date . */ @org.junit.Test public void castableAs538() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonth(--05) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs539() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonth(--05) castable as xs:gYear . */ @org.junit.Test public void castableAs540() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonth(--05) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs541() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonth(--05) castable as xs:gDay . */ @org.junit.Test public void castableAs542() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonth(--05) castable as xs:gMonth . */ @org.junit.Test public void castableAs543() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:gMonth(--12-05:00) castable as xs:gMonth . */ @org.junit.Test public void castableAs544() { final XQuery query = new XQuery( "xs:gMonth(\"--12-05:00\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:gMonth(--05Z) castable as xs:gMonth . */ @org.junit.Test public void castableAs545() { final XQuery query = new XQuery( "xs:gMonth(\"--05Z\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:gMonth(--05) castable as xs:boolean . */ @org.junit.Test public void castableAs546() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonth(--05) castable as xs:base64Binary . */ @org.junit.Test public void castableAs547() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonth(--05) castable as xs:hexBinary . */ @org.junit.Test public void castableAs548() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:gMonth(--05) castable as xs:anyURI . */ @org.junit.Test public void castableAs549() { final XQuery query = new XQuery( "xs:gMonth(\"--05\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:boolean(true) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs550() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:boolean(true) castable as xs:string . */ @org.junit.Test public void castableAs551() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:boolean(true) castable as xs:float . */ @org.junit.Test public void castableAs552() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:boolean(false) castable as xs:float . */ @org.junit.Test public void castableAs553() { final XQuery query = new XQuery( "xs:boolean(\"false\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:boolean(true) castable as xs:double . */ @org.junit.Test public void castableAs554() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:boolean(false) castable as xs:double . */ @org.junit.Test public void castableAs555() { final XQuery query = new XQuery( "xs:boolean(\"false\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:boolean(true) castable as xs:decimal . */ @org.junit.Test public void castableAs556() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:boolean(false) castable as xs:decimal . */ @org.junit.Test public void castableAs557() { final XQuery query = new XQuery( "xs:boolean(\"false\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:boolean(true) castable as xs:integer . */ @org.junit.Test public void castableAs558() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:boolean(false) castable as xs:integer . */ @org.junit.Test public void castableAs559() { final XQuery query = new XQuery( "xs:boolean(\"false\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:boolean(true) castable as xs:duration . */ @org.junit.Test public void castableAs560() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:boolean(true) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs561() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:boolean(true) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs562() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:boolean(true) castable as xs:dateTime . */ @org.junit.Test public void castableAs563() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:boolean(true) castable as xs:time . */ @org.junit.Test public void castableAs564() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:boolean(true) castable as xs:date . */ @org.junit.Test public void castableAs565() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:boolean(true) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs566() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:boolean(true) castable as xs:gYear . */ @org.junit.Test public void castableAs567() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:boolean(true) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs568() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:boolean(true) castable as xs:gDay . */ @org.junit.Test public void castableAs569() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:boolean(true) castable as xs:gMonth . */ @org.junit.Test public void castableAs570() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:boolean(true) castable as xs:boolean . */ @org.junit.Test public void castableAs571() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:boolean(false) castable as xs:boolean . */ @org.junit.Test public void castableAs572() { final XQuery query = new XQuery( "xs:boolean(\"false\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:boolean(true) castable as xs:base64Binary . */ @org.junit.Test public void castableAs573() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:boolean(true) castable as xs:hexBinary . */ @org.junit.Test public void castableAs574() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:boolean(true) castable as xs:anyURI . */ @org.junit.Test public void castableAs575() { final XQuery query = new XQuery( "xs:boolean(\"true\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:base64Binary(01001010) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs576() { final XQuery query = new XQuery( "xs:base64Binary(\"01001010\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:base64Binary(0FB7) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs577() { final XQuery query = new XQuery( "xs:base64Binary(\"0FB7\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:base64Binary(01001010) castable as xs:string . */ @org.junit.Test public void castableAs578() { final XQuery query = new XQuery( "xs:base64Binary(\"01001010\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:base64Binary(0FB7) castable as xs:string . */ @org.junit.Test public void castableAs579() { final XQuery query = new XQuery( "xs:base64Binary(\"0FB7\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:base64Binary(10010101) castable as xs:float . */ @org.junit.Test public void castableAs580() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:base64Binary(10010101) castable as xs:double . */ @org.junit.Test public void castableAs581() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:base64Binary(10010101) castable as xs:decimal . */ @org.junit.Test public void castableAs582() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:base64Binary(10010101) castable as xs:integer . */ @org.junit.Test public void castableAs583() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:base64Binary(10010101) castable as xs:duration . */ @org.junit.Test public void castableAs584() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:base64Binary(10010101) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs585() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:base64Binary(10010101) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs586() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:base64Binary(10010101) castable as xs:dateTime . */ @org.junit.Test public void castableAs587() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:base64Binary(10010101) castable as xs:time . */ @org.junit.Test public void castableAs588() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:base64Binary(10010101) castable as xs:date . */ @org.junit.Test public void castableAs589() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:base64Binary(10010101) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs590() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:base64Binary(10010101) castable as xs:gYear . */ @org.junit.Test public void castableAs591() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:base64Binary(10010101) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs592() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:base64Binary(10010101) castable as xs:gDay . */ @org.junit.Test public void castableAs593() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:base64Binary(10010101) castable as xs:gMonth . */ @org.junit.Test public void castableAs594() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:base64Binary(10010101) castable as xs:boolean . */ @org.junit.Test public void castableAs595() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:base64Binary(01001010) castable as xs:base64Binary . */ @org.junit.Test public void castableAs596() { final XQuery query = new XQuery( "xs:base64Binary(\"01001010\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:base64Binary(0FB7) castable as xs:base64Binary . */ @org.junit.Test public void castableAs597() { final XQuery query = new XQuery( "xs:base64Binary(\"0FB7\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:base64Binary(00000000) castable as xs:hexBinary . */ @org.junit.Test public void castableAs598() { final XQuery query = new XQuery( "xs:base64Binary(\"00000000\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:base64Binary(10010101) castable as xs:hexBinary . */ @org.junit.Test public void castableAs599() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:base64Binary(aA+zZ/09) castable as xs:hexBinary . */ @org.junit.Test public void castableAs600() { final XQuery query = new XQuery( "xs:base64Binary(\"aA+zZ/09\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:base64Binary(0FB7) castable as xs:hexBinary . */ @org.junit.Test public void castableAs601() { final XQuery query = new XQuery( "xs:base64Binary(\"0FB7\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:base64Binary(10010101) castable as xs:anyURI . */ @org.junit.Test public void castableAs602() { final XQuery query = new XQuery( "xs:base64Binary(\"10010101\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:hexBinary(D74D35D35D35) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs603() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:hexBinary(D74D35D35D35) castable as xs:string . */ @org.junit.Test public void castableAs604() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:hexBinary(D74D35D35D35) castable as xs:float . */ @org.junit.Test public void castableAs605() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:hexBinary(D74D35D35D35) castable as xs:double . */ @org.junit.Test public void castableAs606() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:hexBinary(D74D35D35D35) castable as xs:decimal . */ @org.junit.Test public void castableAs607() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:hexBinary(D74D35D35D35) castable as xs:integer . */ @org.junit.Test public void castableAs608() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:hexBinary(D74D35D35D35) castable as xs:duration . */ @org.junit.Test public void castableAs609() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:hexBinary(D74D35D35D35) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs610() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:hexBinary(D74D35D35D35) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs611() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:hexBinary(D74D35D35D35) castable as xs:dateTime . */ @org.junit.Test public void castableAs612() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:hexBinary(D74D35D35D35) castable as xs:time . */ @org.junit.Test public void castableAs613() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:hexBinary(D74D35D35D35) castable as xs:date . */ @org.junit.Test public void castableAs614() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:hexBinary(D74D35D35D35) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs615() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:hexBinary(D74D35D35D35) castable as xs:gYear . */ @org.junit.Test public void castableAs616() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:hexBinary(D74D35D35D35) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs617() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:hexBinary(D74D35D35D35) castable as xs:gDay . */ @org.junit.Test public void castableAs618() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:hexBinary(D74D35D35D35) castable as xs:gMonth . */ @org.junit.Test public void castableAs619() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:hexBinary(D74D35D35D35) castable as xs:boolean . */ @org.junit.Test public void castableAs620() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:hexBinary(D74D35D35D35) castable as xs:base64Binary . */ @org.junit.Test public void castableAs621() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:hexBinary(0fb7) castable as xs:base64Binary . */ @org.junit.Test public void castableAs622() { final XQuery query = new XQuery( "xs:hexBinary(\"0fb7\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:hexBinary(D74D35D35D35) castable as xs:hexBinary . */ @org.junit.Test public void castableAs623() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:hexBinary(d74d35d35d35) castable as xs:hexBinary . */ @org.junit.Test public void castableAs624() { final XQuery query = new XQuery( "xs:hexBinary(\"d74d35d35d35\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:hexBinary(D74D35D35D35) castable as xs:anyURI . */ @org.junit.Test public void castableAs625() { final XQuery query = new XQuery( "xs:hexBinary(\"D74D35D35D35\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) castable as xs:untypedAtomic . */ @org.junit.Test public void castableAs626() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) castable as xs:string . */ @org.junit.Test public void castableAs627() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) castable as xs:float . */ @org.junit.Test public void castableAs628() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) castable as xs:double . */ @org.junit.Test public void castableAs629() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) castable as xs:decimal . */ @org.junit.Test public void castableAs630() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) castable as xs:integer . */ @org.junit.Test public void castableAs631() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) castable as xs:duration . */ @org.junit.Test public void castableAs632() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) castable as xs:yearMonthDuration . */ @org.junit.Test public void castableAs633() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) castable as xs:dayTimeDuration . */ @org.junit.Test public void castableAs634() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) castable as xs:dateTime . */ @org.junit.Test public void castableAs635() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) castable as xs:time . */ @org.junit.Test public void castableAs636() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") castable as xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) castable as xs:date . */ @org.junit.Test public void castableAs637() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) castable as xs:gYearMonth . */ @org.junit.Test public void castableAs638() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) castable as xs:gYear . */ @org.junit.Test public void castableAs639() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) castable as xs:gMonthDay . */ @org.junit.Test public void castableAs640() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") castable as xs:gMonthDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) castable as xs:gDay . */ @org.junit.Test public void castableAs641() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") castable as xs:gDay", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) castable as xs:gMonth . */ @org.junit.Test public void castableAs642() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") castable as xs:gMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) castable as xs:boolean . */ @org.junit.Test public void castableAs643() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) castable as xs:base64Binary . */ @org.junit.Test public void castableAs644() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") castable as xs:base64Binary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) castable as xs:hexBinary . */ @org.junit.Test public void castableAs645() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") castable as xs:hexBinary", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try xs:anyURI(http://www.ietf.org/rfc/rfc2396.txt) castable as xs:anyURI . */ @org.junit.Test public void castableAs646() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.ietf.org/rfc/rfc2396.txt\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try string literal castable as xs:QName . */ @org.junit.Test public void castableAs647() { final XQuery query = new XQuery( "\"ABC\" castable as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Try variable castable as xs:QName . */ @org.junit.Test public void castableAs648() { xquery10(); final XQuery query = new XQuery( "for $var in \"ABC\" return $var castable as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Try variable castable as xs:QName . */ @org.junit.Test public void castableAs648a() { final XQuery query = new XQuery( "let $var := \"ABC\" return $var castable as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Reordering the predicates should not cause the expression to raise an error . */ @org.junit.Test public void castableAs649() { final XQuery query = new XQuery( "count(//employee[salary castable as xs:integer][xs:integer(salary) gt 65000])", ctx); try { query.context(node(file("op/union/acme_corp.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * The expression should not raise a dynamic error . */ @org.junit.Test public void castableAs650() { final XQuery query = new XQuery( "count(//employee[if (salary castable as xs:integer) then xs:integer(salary) gt 65000 else false()])", ctx); try { query.context(node(file("op/union/acme_corp.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * '+' nor '?' is allowed as a cardinality specifier in 'castable as'. . */ @org.junit.Test public void kSeqExprCastable1() { final XQuery query = new XQuery( "'string' castable as xs:string*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * An invalid type for 'castable as' is specified. . */ @org.junit.Test public void kSeqExprCastable10() { final XQuery query = new XQuery( "\"notation is abstract\" castable as xs:NOTATION", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * An invalid type for 'castable as' is specified. . */ @org.junit.Test public void kSeqExprCastable11() { final XQuery query = new XQuery( "() castable as xs:NOTATION", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * An invalid type for 'castable as' is specified. . */ @org.junit.Test public void kSeqExprCastable12() { xquery10(); final XQuery query = new XQuery( "(xs:double(1), xs:double(2), xs:double(3)) castable as xs:double*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XQST0052") ) ); } /** * An invalid type for 'castable as' is specified. . */ @org.junit.Test public void kSeqExprCastable12a() { final XQuery query = new XQuery( "(xs:double(1), xs:double(2), xs:double(3)) castable as xs:double*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XPST0051") ) ); } /** * An invalid type for 'castable as' is specified, leading to a syntax error. . */ @org.junit.Test public void kSeqExprCastable13() { xquery10(); final XQuery query = new XQuery( "'string' castable as item()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XPST0051") ) ); } /** * An invalid type for 'castable as' is specified, leading to a syntax error. . */ @org.junit.Test public void kSeqExprCastable13a() { final XQuery query = new XQuery( "'string' castable as item()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XQST0052") ) ); } /** * An invalid type for 'castable as' is specified, leading to a syntax error. . */ @org.junit.Test public void kSeqExprCastable14() { final XQuery query = new XQuery( "'string' castable as node()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XPST0051") ) ); } /** * An invalid type for 'castable as' is specified, leading to a syntax error. . */ @org.junit.Test public void kSeqExprCastable15() { final XQuery query = new XQuery( "'string' castable as attribute()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XPST0051") ) ); } /** * An invalid type for 'castable as' is specified, leading to a syntax error. . */ @org.junit.Test public void kSeqExprCastable16() { final XQuery query = new XQuery( "'string' castable as empty-sequence()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XPST0051") ) ); } /** * A test whose essence is: `not(QName("", "lname") castable as xs:integer)`. . */ @org.junit.Test public void kSeqExprCastable17() { final XQuery query = new XQuery( "not(QName(\"\", \"lname\") castable as xs:integer)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * When casting to xs:QName the source value can be a xs:QName value. . */ @org.junit.Test public void kSeqExprCastable18() { final XQuery query = new XQuery( "QName(\"\", \"lname\") castable as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting an xs:string to xs:QName works. . */ @org.junit.Test public void kSeqExprCastable19() { final XQuery query = new XQuery( "\"ncname\" castable as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * '+' nor '?' is allowed as a cardinality specifier in 'castable as'. . */ @org.junit.Test public void kSeqExprCastable2() { final XQuery query = new XQuery( "'string' castable as xs:string+", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Casting an empty sequence to xs:QName does not work. . */ @org.junit.Test public void kSeqExprCastable20() { final XQuery query = new XQuery( "not(() castable as xs:QName)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting an empty sequence to xs:QName? works. . */ @org.junit.Test public void kSeqExprCastable21() { final XQuery query = new XQuery( "() castable as xs:QName?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Casting an xs:untypedAtomic to xs:QName does not work. . */ @org.junit.Test public void kSeqExprCastable22() { final XQuery query = new XQuery( "not(xs:untypedAtomic(\"ncname\") castable as xs:QName)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || assertBoolean(false) ) ); } /** * A test whose essence is: `not(("one", "two") castable as xs:string?)`. . */ @org.junit.Test public void kSeqExprCastable23() { final XQuery query = new XQuery( "not((\"one\", \"two\") castable as xs:string?)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not('string' castable as xs:boolean)`. . */ @org.junit.Test public void kSeqExprCastable24() { final XQuery query = new XQuery( "not('string' castable as xs:boolean)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `'true' castable as xs:boolean`. . */ @org.junit.Test public void kSeqExprCastable25() { final XQuery query = new XQuery( "'true' castable as xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:float(1) castable as xs:float`. . */ @org.junit.Test public void kSeqExprCastable26() { final XQuery query = new XQuery( "xs:float(1) castable as xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:float(1) castable as xs:untypedAtomic`. . */ @org.junit.Test public void kSeqExprCastable27() { final XQuery query = new XQuery( "xs:float(1) castable as xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:float(1) castable as xs:string`. . */ @org.junit.Test public void kSeqExprCastable28() { final XQuery query = new XQuery( "xs:float(1) castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(xs:anyURI("example.com/") castable as xs:integer)`. . */ @org.junit.Test public void kSeqExprCastable29() { final XQuery query = new XQuery( "not(xs:anyURI(\"example.com/\") castable as xs:integer)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * '+' nor '?' is allowed as a cardinality specifier in 'castable as'. . */ @org.junit.Test public void kSeqExprCastable3() { final XQuery query = new XQuery( "(\"one\", \"two\") castable as xs:string+", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A test whose essence is: `not("three" castable as xs:float)`. . */ @org.junit.Test public void kSeqExprCastable30() { final XQuery query = new XQuery( "not(\"three\" castable as xs:float)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not("three" castable as xs:integer)`. . */ @org.junit.Test public void kSeqExprCastable31() { final XQuery query = new XQuery( "not(\"three\" castable as xs:integer)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not("three" castable as xs:decimal)`. . */ @org.junit.Test public void kSeqExprCastable32() { final XQuery query = new XQuery( "not(\"three\" castable as xs:decimal)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not("three" castable as xs:double)`. . */ @org.junit.Test public void kSeqExprCastable33() { final XQuery query = new XQuery( "not(\"three\" castable as xs:double)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not((1, 2, 3) castable as xs:integer)`. . */ @org.junit.Test public void kSeqExprCastable34() { final XQuery query = new XQuery( "not((1, 2, 3) castable as xs:integer)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(() castable as xs:integer)`. . */ @org.junit.Test public void kSeqExprCastable35() { final XQuery query = new XQuery( "not(() castable as xs:integer)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `() castable as xs:integer?`. . */ @org.junit.Test public void kSeqExprCastable36() { final XQuery query = new XQuery( "() castable as xs:integer?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(1) castable as xs:integer?`. . */ @org.junit.Test public void kSeqExprCastable37() { final XQuery query = new XQuery( "(1) castable as xs:integer?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(("one", "two") castable as xs:string?)`. . */ @org.junit.Test public void kSeqExprCastable38() { final XQuery query = new XQuery( "not((\"one\", \"two\") castable as xs:string?)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * '+' nor '?' is allowed as a cardinality specifier in 'castable as'. . */ @org.junit.Test public void kSeqExprCastable4() { xquery10(); final XQuery query = new XQuery( "'string' castable as xs:anyType*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XPST0051") ) ); } /** * '+' nor '?' is allowed as a cardinality specifier in 'castable as'. . */ @org.junit.Test public void kSeqExprCastable4a() { final XQuery query = new XQuery( "'string' castable as xs:anyType*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XQST0052") ) ); } /** * An invalid type for 'castable as' is specified. . */ @org.junit.Test public void kSeqExprCastable5() { xquery10(); final XQuery query = new XQuery( "'string' castable as xs:anySimpleType", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0051") ); } /** * An invalid type for 'castable as' is specified. . */ @org.junit.Test public void kSeqExprCastable5a() { final XQuery query = new XQuery( "'string' castable as xs:anySimpleType", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * An invalid type for 'castable as' is specified. . */ @org.junit.Test public void kSeqExprCastable6() { xquery10(); final XQuery query = new XQuery( "'string' castable as xs:untyped", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0051") ); } /** * An invalid type for 'castable as' is specified. . */ @org.junit.Test public void kSeqExprCastable6a() { final XQuery query = new XQuery( "'string' castable as xs:untyped", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0052") ); } /** * An invalid type for 'castable as' is specified. . */ @org.junit.Test public void kSeqExprCastable7() { final XQuery query = new XQuery( "'string' castable as xs:anyAtomicType", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * An invalid type for 'castable as' is specified. . */ @org.junit.Test public void kSeqExprCastable8() { final XQuery query = new XQuery( "\"notation is abstract\" castable as xs:NOTATION?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * An invalid type for 'castable as' is specified. . */ @org.junit.Test public void kSeqExprCastable9() { final XQuery query = new XQuery( "() castable as xs:NOTATION?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0080") ); } /** * Testing castability to xs:QName where the cardinality is wrong. . */ @org.junit.Test public void k2SeqExprCastable1() { final XQuery query = new XQuery( "(QName(\"http://example.com/ANamespace\", \"ncname\"), QName(\"http://example.com/ANamespace\", \"ncname2\"), QName(\"http://example.com/ANamespace\", \"ncname3\")) castable as xs:QName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Testing castability to xs:QName where the cardinality is wrong(#2). . */ @org.junit.Test public void k2SeqExprCastable2() { final XQuery query = new XQuery( "(QName(\"http://example.com/ANamespace\", \"ncname\"), QName(\"http://example.com/ANamespace\", \"ncname2\"), QName(\"http://example.com/ANamespace\", \"ncname3\")) castable as xs:QName?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Combine operator div with castable as. . */ @org.junit.Test public void k2SeqExprCastable3() { final XQuery query = new XQuery( "(1 div 0) castable as xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOAR0001") ) ); } /** * Combine operator div with castable as(#2). . */ @org.junit.Test public void k2SeqExprCastable4() { final XQuery query = new XQuery( "concat(\"2007-01-3\", 1 div 0) castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOAR0001") ); } /** * Check casting an xs:positiveInteger value to xs:double. . */ @org.junit.Test public void k2SeqExprCastable5() { final XQuery query = new XQuery( "xs:positiveInteger(\"52\") castable as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that an invalid xs:anyURI gets flagged as not being castable. . */ @org.junit.Test public void k2SeqExprCastable6() { final XQuery query = new XQuery( "\"%\" castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Check that an invalid xs:anyURI gets flagged as not being castable. . */ @org.junit.Test public void k2SeqExprCastable7() { final XQuery query = new XQuery( "xs:untypedAtomic(\"%\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Check castability of an invalid xs:anyURI. . */ @org.junit.Test public void k2SeqExprCastable8() { final XQuery query = new XQuery( "(\"http:\\\\invalid>URI\\someURI\") castable as xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * test castable to xs:byte of out-of-range value . */ @org.junit.Test public void cbclCastableByte001() { final XQuery query = new XQuery( "128 castable as xs:byte", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:byte of out-of-range value . */ @org.junit.Test public void cbclCastableByte002() { final XQuery query = new XQuery( "-129 castable as xs:byte", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:byte of out-of-range value . */ @org.junit.Test public void cbclCastableByte003() { final XQuery query = new XQuery( "\"128\" castable as xs:byte", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:byte of out-of-range value . */ @org.junit.Test public void cbclCastableByte004() { final XQuery query = new XQuery( "\"-129\" castable as xs:byte", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:date with overflow . */ @org.junit.Test public void cbclCastableDate001() { final XQuery query = new XQuery( "\"-25252734927766555-06-06\" castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:date with overflow . */ @org.junit.Test public void cbclCastableDate002() { final XQuery query = new XQuery( "\"25252734927766555-07-29\" castable as xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:dateTime with overflow . */ @org.junit.Test public void cbclCastableDateTime001() { final XQuery query = new XQuery( "\"-25252734927766555-06-06T00:00:00Z\" castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:dateTime with overflow . */ @org.junit.Test public void cbclCastableDateTime002() { final XQuery query = new XQuery( "\"25252734927766555-07-29T00:00:00Z\" castable as xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:dayTimeDuration with overflow . */ @org.junit.Test public void cbclCastableDayTimeDuration001() { final XQuery query = new XQuery( "\"P11768614336404564651D\" castable as xs:dayTimeDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:dayTimeDuration with overflow . */ @org.junit.Test public void cbclCastableDayTimeDuration002() { final XQuery query = new XQuery( "\"-P11768614336404564651D\" castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castability of xs:float('NaN') as xs:decimal . */ @org.junit.Test public void cbclCastableDecimal001() { final XQuery query = new XQuery( "xs:float('NaN') castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castability of xs:float('-INF') as xs:decimal . */ @org.junit.Test public void cbclCastableDecimal002() { final XQuery query = new XQuery( "xs:float('-INF') castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castability of xs:float('INF') as xs:decimal . */ @org.junit.Test public void cbclCastableDecimal003() { final XQuery query = new XQuery( "xs:float('INF') castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castability of xs:double('NaN') as xs:double . */ @org.junit.Test public void cbclCastableDecimal004() { final XQuery query = new XQuery( "xs:double('NaN') castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castability of xs:double('-INF') as xs:decimal . */ @org.junit.Test public void cbclCastableDecimal005() { final XQuery query = new XQuery( "xs:double('-INF') castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castability of xs:double('INF') as xs:decimal . */ @org.junit.Test public void cbclCastableDecimal006() { final XQuery query = new XQuery( "xs:double('INF') castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable as xs:decimal of large double value . */ @org.junit.Test public void cbclCastableDecimal007() { final XQuery query = new XQuery( "1.7976931348623157E+308 castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * test castable as xs:decimal of large negative double value . */ @org.junit.Test public void cbclCastableDecimal008() { final XQuery query = new XQuery( "-1.7976931348623157E+308 castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * test castable as xs:decimal of large float value . */ @org.junit.Test public void cbclCastableDecimal009() { final XQuery query = new XQuery( "xs:float('3.402823e38') castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * test castable to xs:decimal of large negative float value . */ @org.junit.Test public void cbclCastableDecimal010() { final XQuery query = new XQuery( "xs:float('-3.402823e38') castable as xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * test castable to xs:duration with overflow . */ @org.junit.Test public void cbclCastableDuration001() { final XQuery query = new XQuery( "\"-P768614336404564651Y\" castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:duration with overflow . */ @org.junit.Test public void cbclCastableDuration002() { final XQuery query = new XQuery( "\"P768614336404564651Y\" castable as xs:duration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test cast to xs:gYear with overflow . */ @org.junit.Test public void cbclCastableGYear001() { final XQuery query = new XQuery( "\"99999999999999999999999999999\" castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test casting 0000 to xs:gYear . */ @org.junit.Test public void cbclCastableGYear002() { final XQuery query = new XQuery( "\"0000\" castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test casting -0000 to xs:gYear . */ @org.junit.Test public void cbclCastableGYear003() { final XQuery query = new XQuery( "\"-0000\" castable as xs:gYear", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test cast to xs:gYearMonth with overflow . */ @org.junit.Test public void cbclCastableGYearMonth001() { final XQuery query = new XQuery( "\"99999999999999999999999999999-01\" castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test cast to xs:gYearMonth with overflow . */ @org.junit.Test public void cbclCastableGYearMonth002() { final XQuery query = new XQuery( "\"99999999999999999999999999999-XX\" castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test cast year 0000 xs:gYearMonth . */ @org.junit.Test public void cbclCastableGYearMonth003() { final XQuery query = new XQuery( "\"0000-05\" castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test cast year 0000 xs:gYearMonth . */ @org.junit.Test public void cbclCastableGYearMonth004() { final XQuery query = new XQuery( "\"-0000-05\" castable as xs:gYearMonth", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:int of out-of-range value . */ @org.junit.Test public void cbclCastableInt001() { final XQuery query = new XQuery( "2147483648 castable as xs:int", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:int of out-of-range value . */ @org.junit.Test public void cbclCastableInt002() { final XQuery query = new XQuery( "-2147483649 castable as xs:int", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:int of out-of-range value . */ @org.junit.Test public void cbclCastableInt003() { final XQuery query = new XQuery( "\"2147483648\" castable as xs:int", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:int of out-of-range value . */ @org.junit.Test public void cbclCastableInt004() { final XQuery query = new XQuery( "\"-2147483649\" castable as xs:int", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable as xs:integer of large double value . */ @org.junit.Test public void cbclCastableInteger001() { final XQuery query = new XQuery( "1.7976931348623157E+308 castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * test castable as xs:integer of large negative double value . */ @org.junit.Test public void cbclCastableInteger002() { final XQuery query = new XQuery( "-1.7976931348623157E+308 castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * test castable as xs:integer of large float value . */ @org.junit.Test public void cbclCastableInteger003() { final XQuery query = new XQuery( "xs:float('3.402823e38') castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * test castable to xs:integer of large negative float value . */ @org.junit.Test public void cbclCastableInteger004() { final XQuery query = new XQuery( "xs:float('-3.402823e38') castable as xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * test castable to xs:language . */ @org.junit.Test public void cbclCastableLanguage001() { final XQuery query = new XQuery( "xs:language('en-gb') castable as xs:language", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test castable to xs:language from a type which can only fail . */ @org.junit.Test public void cbclCastableLanguage002() { final XQuery query = new XQuery( "1.0 castable as xs:language", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:language . */ @org.junit.Test public void cbclCastableLanguage003() { final XQuery query = new XQuery( "'en-gb' castable as xs:language", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test castable to xs:language . */ @org.junit.Test public void cbclCastableLanguage004() { final XQuery query = new XQuery( "\"gobbledygook\" castable as xs:language", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:long of out-of-range value . */ @org.junit.Test public void cbclCastableLong001() { final XQuery query = new XQuery( "9223372036854775808 castable as xs:long", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:long of out-of-range value . */ @org.junit.Test public void cbclCastableLong002() { final XQuery query = new XQuery( "-9223372036854775809 castable as xs:long", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:long of out-of-range value . */ @org.junit.Test public void cbclCastableLong003() { final XQuery query = new XQuery( "\"9223372036854775808\" castable as xs:long", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:long of out-of-range value . */ @org.junit.Test public void cbclCastableLong004() { final XQuery query = new XQuery( "\"-9223372036854775809\" castable as xs:long", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable as xs:Name from a subtype of xs:Name . */ @org.junit.Test public void cbclCastableName001() { final XQuery query = new XQuery( "xs:NCName('NCName') castable as xs:Name", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test castable as xs:Name from a type which will always fail . */ @org.junit.Test public void cbclCastableName002() { final XQuery query = new XQuery( "fn:current-time() castable as xs:Name", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable as xs:Name . */ @org.junit.Test public void cbclCastableName003() { final XQuery query = new XQuery( "'NCName' castable as xs:Name", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test castable as xs:Name . */ @org.junit.Test public void cbclCastableName004() { final XQuery query = new XQuery( "'N A M E' castable as xs:Name", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable as xs:NCName from a subtype of xs:NCName . */ @org.junit.Test public void cbclCastableNcname001() { final XQuery query = new XQuery( "xs:ID('id') castable as xs:NCName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test castable as xs:NCName from a type which will always fail . */ @org.junit.Test public void cbclCastableNcname002() { final XQuery query = new XQuery( "fn:current-time() castable as xs:NCName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable as xs:NCName . */ @org.junit.Test public void cbclCastableNcname003() { final XQuery query = new XQuery( "'NCName' castable as xs:NCName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test castable as xs:NCName . */ @org.junit.Test public void cbclCastableNcname004() { final XQuery query = new XQuery( "'NC:Name' castable as xs:NCName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:negativeInteger of out-of-range value . */ @org.junit.Test public void cbclCastableNegativeInteger001() { final XQuery query = new XQuery( "0 castable as xs:negativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:negativeInteger of out-of-range value . */ @org.junit.Test public void cbclCastableNegativeInteger002() { final XQuery query = new XQuery( "\"0\" castable as xs:negativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable as xs:NMTOKEN from a subtype of xs:NMTOKEN . */ @org.junit.Test public void cbclCastableNmtoken001() { final XQuery query = new XQuery( "xs:NMTOKEN('NMTOKEN') castable as xs:NMTOKEN", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test cast to xs:NMTOKEN . */ @org.junit.Test public void cbclCastableNmtoken002() { final XQuery query = new XQuery( "\n" + " \" foobar \" castable as xs:NMTOKEN", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test castable to xs:nonNegativeInteger of out-of-range value . */ @org.junit.Test public void cbclCastableNonNegativeInteger001() { final XQuery query = new XQuery( "-1 castable as xs:nonNegativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:nonNegativeInteger of out-of-range value . */ @org.junit.Test public void cbclCastableNonNegativeInteger002() { final XQuery query = new XQuery( "\"-1\" castable as xs:nonNegativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Ensure that "-00" is a valid lexical value for xs:nonNegativeInteger . */ @org.junit.Test public void cbclCastableNonNegativeInteger003() { final XQuery query = new XQuery( "\"-00\" castable as xs:nonNegativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test castable to xs:nonPositiveInteger of out-of-range value . */ @org.junit.Test public void cbclCastableNonPositiveInteger001() { final XQuery query = new XQuery( "1 castable as xs:nonPositiveInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:nonPositiveInteger of out-of-range value . */ @org.junit.Test public void cbclCastableNonPositiveInteger002() { final XQuery query = new XQuery( "\"1\" castable as xs:nonPositiveInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Ensure that "+00" is a valid lexical value for xs:nonPositiveInteger . */ @org.junit.Test public void cbclCastableNonPositiveInteger003() { final XQuery query = new XQuery( "\"+00\" castable as xs:nonPositiveInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test castable to xs:positiveInteger of out-of-range value . */ @org.junit.Test public void cbclCastablePositiveInteger001() { final XQuery query = new XQuery( "0 castable as xs:positiveInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:positiveInteger of out-of-range value . */ @org.junit.Test public void cbclCastablePositiveInteger002() { final XQuery query = new XQuery( "\"0\" castable as xs:positiveInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:short of out-of-range value . */ @org.junit.Test public void cbclCastableShort001() { final XQuery query = new XQuery( "32768 castable as xs:short", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:short of out-of-range value . */ @org.junit.Test public void cbclCastableShort002() { final XQuery query = new XQuery( "-32769 castable as xs:short", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:short of out-of-range value . */ @org.junit.Test public void cbclCastableShort003() { final XQuery query = new XQuery( "\"32769\" castable as xs:short", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:short of out-of-range value . */ @org.junit.Test public void cbclCastableShort004() { final XQuery query = new XQuery( "\"-32769\" castable as xs:short", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:unsignedByte of out-of-range value . */ @org.junit.Test public void cbclCastableUnsignedByte001() { final XQuery query = new XQuery( "256 castable as xs:unsignedByte", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:unsignedByte of out-of-range value . */ @org.junit.Test public void cbclCastableUnsignedByte002() { final XQuery query = new XQuery( "-1 castable as xs:unsignedByte", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:unsignedByte of out-of-range value . */ @org.junit.Test public void cbclCastableUnsignedByte003() { final XQuery query = new XQuery( "\"256\" castable as xs:unsignedByte", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:unsignedByte of out-of-range value . */ @org.junit.Test public void cbclCastableUnsignedByte004() { final XQuery query = new XQuery( "\"-1\" castable as xs:unsignedByte", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Ensure that "-00" is a valid lexical value for xs:unsignedByte . */ @org.junit.Test public void cbclCastableUnsignedByte005() { final XQuery query = new XQuery( "\"-00\" castable as xs:unsignedByte", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test castable to xs:unsignedInt of out-of-range value . */ @org.junit.Test public void cbclCastableUnsignedInt001() { final XQuery query = new XQuery( "4294967296 castable as xs:unsignedInt", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:unsignedInt of out-of-range value . */ @org.junit.Test public void cbclCastableUnsignedInt002() { final XQuery query = new XQuery( "-1 castable as xs:unsignedInt", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:unsignedInt of out-of-range value . */ @org.junit.Test public void cbclCastableUnsignedInt003() { final XQuery query = new XQuery( "\"4294967296\" castable as xs:unsignedInt", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:unsignedInt of out-of-range value . */ @org.junit.Test public void cbclCastableUnsignedInt004() { final XQuery query = new XQuery( "\"-1\" castable as xs:unsignedInt", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Ensure that "-00" is a valid lexical value for xs:unsignedInt . */ @org.junit.Test public void cbclCastableUnsignedInt005() { final XQuery query = new XQuery( "\"-00\" castable as xs:unsignedInt", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test castable to xs:unsignedLong of out-of-range value . */ @org.junit.Test public void cbclCastableUnsignedLong001() { final XQuery query = new XQuery( "18446744073709551616 castable as xs:unsignedLong", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:unsignedLong of out-of-range value . */ @org.junit.Test public void cbclCastableUnsignedLong002() { final XQuery query = new XQuery( "-1 castable as xs:unsignedLong", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:unsignedLong of out-of-range value . */ @org.junit.Test public void cbclCastableUnsignedLong003() { final XQuery query = new XQuery( "\"18446744073709551616\" castable as xs:unsignedLong", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:unsignedLong of out-of-range value . */ @org.junit.Test public void cbclCastableUnsignedLong004() { final XQuery query = new XQuery( "\"-1\" castable as xs:unsignedLong", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Ensure that "-00" is a valid lexical value for xs:unsignedLong . */ @org.junit.Test public void cbclCastableUnsignedLong005() { final XQuery query = new XQuery( "\"-00\" castable as xs:unsignedLong", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test castable to xs:unsignedShort of out-of-range value . */ @org.junit.Test public void cbclCastableUnsignedShort001() { final XQuery query = new XQuery( "65536 castable as xs:unsignedShort", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:unsignedShort of out-of-range value . */ @org.junit.Test public void cbclCastableUnsignedShort002() { final XQuery query = new XQuery( "-1 castable as xs:unsignedShort", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:unsignedShort of out-of-range value . */ @org.junit.Test public void cbclCastableUnsignedShort003() { final XQuery query = new XQuery( "\"65536\" castable as xs:unsignedShort", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:unsignedShort of out-of-range value . */ @org.junit.Test public void cbclCastableUnsignedShort004() { final XQuery query = new XQuery( "\"-1\" castable as xs:unsignedShort", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Ensure that "-00" is a valid lexical value for xs:unsignedShort . */ @org.junit.Test public void cbclCastableUnsignedShort005() { final XQuery query = new XQuery( "\"-00\" castable as xs:unsignedShort", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test castable to xs:yearMonthDuration with overflow . */ @org.junit.Test public void cbclCastableYearMonthDuration001() { final XQuery query = new XQuery( "\"-P768614336404564651Y\" castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * test castable to xs:yearMonthDuration with overflow . */ @org.junit.Test public void cbclCastableYearMonthDuration002() { final XQuery query = new XQuery( "\"P768614336404564651Y\" castable as xs:yearMonthDuration", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdComment.java000066400000000000000000001111111222453003200275330ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the Comment production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdComment extends QT3TestSet { /** * A test whose essence is: `(3(: comment inbetween comment inbetween . */ @org.junit.Test public void kXQueryComment1() { final XQuery query = new XQuery( "(:*******************************************************:)\n" + "(: Test: K-XQueryComment-1 :)\n" + "(: Written by: Frans Englich :)\n" + "(: Date: 2007-11-22T11:31:22+01:00 :)\n" + "(: Purpose: A test whose essence is: `(3(: comment inbetween :)- 1) eq 2`. :)\n" + "(:*******************************************************:)\n" + "(3(: comment inbetween :)- 1) eq 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An empty comment at the very beginning of an expression. . */ @org.junit.Test public void kXQueryComment10() { final XQuery query = new XQuery( "(:*******************************************************:)\n" + "(: Test: K-XQueryComment-10 :)\n" + "(: Written by: Frans Englich :)\n" + "(: Date: 2007-11-22T11:31:22+01:00 :)\n" + "(: Purpose: An empty comment at the very beginning of an expression. :)\n" + "(:*******************************************************:)\n" + "(::) 1 eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An empty comment after a function's paranteses. . */ @org.junit.Test public void kXQueryComment11() { final XQuery query = new XQuery( "(:*******************************************************:)\n" + "(: Test: K-XQueryComment-11 :)\n" + "(: Written by: Frans Englich :)\n" + "(: Date: 2007-11-22T11:31:22+01:00 :)\n" + "(: Purpose: An empty comment after a function's paranteses. :)\n" + "(:*******************************************************:)\n" + "true()(::)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A for loop with a comment inbetween. set up loop . */ @org.junit.Test public void kXQueryComment12() { final XQuery query = new XQuery( "(:*******************************************************:)\n" + "(: Test: K-XQueryComment-12 :)\n" + "(: Written by: Frans Englich :)\n" + "(: Date: 2007-11-22T11:31:22+01:00 :)\n" + "(: Purpose: A for loop with a comment inbetween. :)\n" + "(:*******************************************************:)\n" + "for (: set up loop :) $i in 3 return $i eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `if((: comment inbetween comment inbetween . */ @org.junit.Test public void kXQueryComment13() { final XQuery query = new XQuery( "(:*******************************************************:)\n" + "(: Test: K-XQueryComment-13 :)\n" + "(: Written by: Frans Englich :)\n" + "(: Date: 2007-11-22T11:31:22+01:00 :)\n" + "(: Purpose: A test whose essence is: `if((: comment inbetween :)) then 1 else 1`. :)\n" + "(:*******************************************************:)\n" + "if((: comment inbetween :)) then 1 else 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A syntactically invalid comment that never ends. . */ @org.junit.Test public void kXQueryComment14() { final XQuery query = new XQuery( "(:*******************************************************:)\n" + "(: Test: K-XQueryComment-14 :)\n" + "(: Written by: Frans Englich :)\n" + "(: Date: 2007-11-22T11:31:22+01:00 :)\n" + "(: Purpose: A syntactically invalid comment that never ends. :)\n" + "(:*******************************************************:)\n" + "1(: this comment does not end:", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A comment inside a comment that isn't terminated. content (: this comment does not end . */ @org.junit.Test public void kXQueryComment15() { final XQuery query = new XQuery( "(:*******************************************************:)\n" + "(: Test: K-XQueryComment-15 :)\n" + "(: Written by: Frans Englich :)\n" + "(: Date: 2007-11-22T11:31:22+01:00 :)\n" + "(: Purpose: A comment inside a comment that isn't terminated. :)\n" + "(:*******************************************************:)\n" + "1(: content (: this comment does not end :)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A comment inside a comment that does not start properly. content this comment does not start properly . */ @org.junit.Test public void kXQueryComment16() { final XQuery query = new XQuery( "(:*******************************************************:)\n" + "(: Test: K-XQueryComment-16 :)\n" + "(: Written by: Frans Englich :)\n" + "(: Date: 2007-11-22T11:31:22+01:00 :)\n" + "(: Purpose: A comment inside a comment that does not start properly. :)\n" + "(:*******************************************************:)\n" + "1(: content this comment does not start properly :) :)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Colons and paranteses appearing freely in comment content. ((( : )) ))ladl: :(): ()()(dahsi ()()( dad: ) . */ @org.junit.Test public void kXQueryComment17() { final XQuery query = new XQuery( "(:*******************************************************:)\n" + "(: Test: K-XQueryComment-17 :)\n" + "(: Written by: Frans Englich :)\n" + "(: Date: 2007-11-22T11:31:22+01:00 :)\n" + "(: Purpose: Colons and paranteses appearing freely in comment content. :)\n" + "(:*******************************************************:)\n" + "1(: ((( : )) ))ladl: :(): ()()(dahsi ()()( dad: ) :) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Three comments appearing serially inside a comment. (:one comment another comment a third . */ @org.junit.Test public void kXQueryComment18() { final XQuery query = new XQuery( "(:*******************************************************:)\n" + "(: Test: K-XQueryComment-18 :)\n" + "(: Written by: Frans Englich :)\n" + "(: Date: 2007-11-22T11:31:22+01:00 :)\n" + "(: Purpose: Three comments appearing serially inside a comment. :)\n" + "(:*******************************************************:)\n" + "1(: (:one comment:) content (:another comment:) content (:a third:):)\n" + "\t\t\t eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test stressing many nested comments. (:(:(:(:(:(:(: . */ @org.junit.Test public void kXQueryComment19() { final XQuery query = new XQuery( "(:*******************************************************:)\n" + "(: Test: K-XQueryComment-19 :)\n" + "(: Written by: Frans Englich :)\n" + "(: Date: 2007-11-22T11:31:22+01:00 :)\n" + "(: Purpose: A test stressing many nested comments. :)\n" + "(:*******************************************************:)\n" + "1(:(:(:(:(:(:(:(::):):):):):):):) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `1 (: a (: nested a (: nested . */ @org.junit.Test public void kXQueryComment2() { final XQuery query = new XQuery( "(:*******************************************************:)\n" + "(: Test: K-XQueryComment-2 :)\n" + "(: Written by: Frans Englich :)\n" + "(: Date: 2007-11-22T11:31:22+01:00 :)\n" + "(: Purpose: A test whose essence is: `1 (: a (: nested :) comment :) eq 1`. :)\n" + "(:*******************************************************:)\n" + "1 (: a (: nested :) comment :) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A syntactically invalid comment that doesn't properly start. . */ @org.junit.Test public void kXQueryComment20() { final XQuery query = new XQuery( "(:*******************************************************:)\n" + "(: Test: K-XQueryComment-20 :)\n" + "(: Written by: Frans Englich :)\n" + "(: Date: 2007-11-22T11:31:22+01:00 :)\n" + "(: Purpose: A syntactically invalid comment that doesn't properly start. :)\n" + "(:*******************************************************:)\n" + ": :) 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A test whose essence is: `1 (: comment (: inside comment (: inside . */ @org.junit.Test public void kXQueryComment3() { final XQuery query = new XQuery( "(:*******************************************************:)\n" + "(: Test: K-XQueryComment-3 :)\n" + "(: Written by: Frans Englich :)\n" + "(: Date: 2007-11-22T11:31:22+01:00 :)\n" + "(: Purpose: A test whose essence is: `1 (: comment (: inside :) comment :) eq 1`. :)\n" + "(:*******************************************************:)\n" + "1 (: comment (: inside :) comment :) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Comparison of two string literals, whose content reminds of comments. . */ @org.junit.Test public void kXQueryComment4() { final XQuery query = new XQuery( "(:*******************************************************:)\n" + "(: Test: K-XQueryComment-4 :)\n" + "(: Written by: Frans Englich :)\n" + "(: Date: 2007-11-22T11:31:22+01:00 :)\n" + "(: Purpose: Comparison of two string literals, whose content reminds of comments. :)\n" + "(:*******************************************************:)\n" + "\"reminds of a comment :)\" eq\n" + "\t\t \"reminds of a comment :)\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `5 instance (: strange place for a comment strange place for a comment . */ @org.junit.Test public void kXQueryComment5() { final XQuery query = new XQuery( "(:*******************************************************:)\n" + "(: Test: K-XQueryComment-5 :)\n" + "(: Written by: Frans Englich :)\n" + "(: Date: 2007-11-22T11:31:22+01:00 :)\n" + "(: Purpose: A test whose essence is: `5 instance (: strange place for a comment :) of item()`. :)\n" + "(:*******************************************************:)\n" + "5 instance (: strange place for a comment :) of item()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `1 (: simple comment simple comment . */ @org.junit.Test public void kXQueryComment6() { final XQuery query = new XQuery( "(:*******************************************************:)\n" + "(: Test: K-XQueryComment-6 :)\n" + "(: Written by: Frans Englich :)\n" + "(: Date: 2007-11-22T11:31:22+01:00 :)\n" + "(: Purpose: A test whose essence is: `1 (: simple comment :) eq 1`. :)\n" + "(:*******************************************************:)\n" + "1 (: simple comment :) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `1 (: comment (: inside comment (: inside . */ @org.junit.Test public void kXQueryComment7() { final XQuery query = new XQuery( "(:*******************************************************:)\n" + "(: Test: K-XQueryComment-7 :)\n" + "(: Written by: Frans Englich :)\n" + "(: Date: 2007-11-22T11:31:22+01:00 :)\n" + "(: Purpose: A test whose essence is: `1 (: comment (: inside :) NEW LINE comment :) eq 1`. :)\n" + "(:*******************************************************:)\n" + "1 (: comment (: inside :)\n" + "\t\t\t\tNEW LINE comment :) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(: "recursive comments must be balanced, this one is not "recursive comments must be balanced, this one is not . */ @org.junit.Test public void kXQueryComment8() { final XQuery query = new XQuery( "(:*******************************************************:)\n" + "(: Test: K-XQueryComment-8 :)\n" + "(: Written by: Frans Englich :)\n" + "(: Date: 2007-11-22T11:31:22+01:00 :)\n" + "(: Purpose: A test whose essence is: `(: \"recursive comments must be balanced, this one is not :)\" :)`. :)\n" + "(:*******************************************************:)\n" + "(: \"recursive comments must be \n" + "\tbalanced, this one is not :)\" :)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * An empty comment inbetween the 'eq' operator and a number literal. . */ @org.junit.Test public void kXQueryComment9() { final XQuery query = new XQuery( "(:*******************************************************:)\n" + "(: Test: K-XQueryComment-9 :)\n" + "(: Written by: Frans Englich :)\n" + "(: Date: 2007-11-22T11:31:22+01:00 :)\n" + "(: Purpose: An empty comment inbetween the 'eq' operator and a number literal. :)\n" + "(:*******************************************************:)\n" + "1 eq (::)1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An invalid comment after a name test. . */ @org.junit.Test public void k2XQueryComment1() { final XQuery query = new XQuery( "(:*******************************************************:)\n" + "(: Test: K2-XQueryComment-1 :)\n" + "(: Written by: Frans Englich :)\n" + "(: Date: 2007-11-22T11:31:21+01:00 :)\n" + "(: Purpose: An invalid comment after a name test. :)\n" + "(:*******************************************************:)\n" + "let $i := \n" + " \n" + " \n" + " \n" + " \n" + " return $i/b(: ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * An invalid comment after a name test(#2). . */ @org.junit.Test public void k2XQueryComment2() { final XQuery query = new XQuery( "(:*******************************************************:)\n" + "(: Test: K2-XQueryComment-2 :)\n" + "(: Written by: Frans Englich :)\n" + "(: Date: 2007-11-22T11:31:21+01:00 :)\n" + "(: Purpose: An invalid comment after a name test(#2). :)\n" + "(:*******************************************************:)\n" + "let $i := \n" + " \n" + " \n" + " \n" + " \n" + " return $i/b(: some : content (:some content ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Have a computed comment constructor as a last step. some : content (:some content . */ @org.junit.Test public void k2XQueryComment3() { final XQuery query = new XQuery( "(:*******************************************************:)\n" + "(: Test: K2-XQueryComment-3 :)\n" + "(: Written by: Frans Englich :)\n" + "(: Date: 2007-11-22T11:31:21+01:00 :)\n" + "(: Purpose: Have a computed comment constructor as a last step. :)\n" + "(:*******************************************************:)\n" + "let $i := \n" + " \n" + " \n" + " \n" + " \n" + " return $i/b/comment(: some : content (:some content:):){\"content\"} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Have a direct comment constructor as a last step. some : content (:some content . */ @org.junit.Test public void k2XQueryComment4() { final XQuery query = new XQuery( "(:*******************************************************:)\n" + "(: Test: K2-XQueryComment-4 :)\n" + "(: Written by: Frans Englich :)\n" + "(: Date: 2007-11-22T11:31:21+01:00 :)\n" + "(: Purpose: Have a direct comment constructor as a last step. :)\n" + "(:*******************************************************:)\n" + "let $i := \n" + " \n" + " \n" + " \n" + " \n" + " return $i/(: some : content (:some content:):) ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Have a direct comment constructor as a last step(#2). some : content (:some content . */ @org.junit.Test public void k2XQueryComment5() { final XQuery query = new XQuery( "(:*******************************************************:)\n" + "(: Test: K2-XQueryComment-5 :)\n" + "(: Written by: Frans Englich :)\n" + "(: Date: 2007-11-22T11:31:21+01:00 :)\n" + "(: Purpose: Have a direct comment constructor as a last step(#2). :)\n" + "(:*******************************************************:)\n" + "let $i := \n" + " \n" + " \n" + " \n" + " \n" + " return $i/b/(: some : content (:some content:):) ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Simple use case for XQuery comments This is a comment . */ @org.junit.Test public void xQueryComment001() { final XQuery query = new XQuery( "(: Name: XQueryComment001 :)\n" + "(: Description: Simple use case for XQuery comments :)\n" + "\n" + "\n" + "(: This is a comment :)\n" + "\n" + "\n" + "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Simple use case for XQuery comments This is a comment . */ @org.junit.Test public void xQueryComment002() { final XQuery query = new XQuery( "(: Name: XQueryComment002 :)\n" + "(: Description: Simple use case for XQuery comments :)\n" + "\n" + "\n" + "\n" + "\n" + "(: This is a comment :)\n" + "(//fs:Folder)[1]/fs:File[1]/fs:FileName\n" + "", ctx); try { query.context(node(file("prod/ForClause/fsx_NS.xml"))); query.namespace("fs", "http://www.example.com/filesystem"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("File00000000000", false) ); } /** * Simple use case for XQuery comment containing '-' This is a comment- . */ @org.junit.Test public void xQueryComment003() { final XQuery query = new XQuery( "(: Name: XQueryComment003 :)\n" + "(: Description: Simple use case for XQuery comment containing '-' :)\n" + "\n" + "\n" + "(:This is a comment-:)\n" + "\n" + "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Empty comment . */ @org.junit.Test public void xQueryComment004() { final XQuery query = new XQuery( "(: Name: XQueryComment004 :)\n" + "(: Description: Empty comment :)\n" + "\n" + "\n" + "(::)\n" + "\n" + "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Comment containing only '-' - . */ @org.junit.Test public void xQueryComment005() { final XQuery query = new XQuery( "(: Name: XQueryComment004 :)\n" + "(: Description: Comment containing only '-' :)\n" + "\n" + "\n" + "(:-:)\n" + "\n" + "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Comment containing ':' this is a comment : . */ @org.junit.Test public void xQueryComment006() { final XQuery query = new XQuery( "(: Name: XQueryComment006 :)\n" + "(: Description: Comment containing ':' :)\n" + "\n" + "\n" + "(: this is a comment ::)\n" + "\n" + "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Comment containing ')' this is a comment ) . */ @org.junit.Test public void xQueryComment007() { final XQuery query = new XQuery( "(: Name: XQueryComment007 :)\n" + "(: Description: Comment containing ')' :)\n" + "\n" + "\n" + "(: this is a comment ):)\n" + "\n" + "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Simple example of embedded comments this is a comment (: this is an embedded comment . */ @org.junit.Test public void xQueryComment008() { final XQuery query = new XQuery( "(: Name: XQueryComment008 :)\n" + "(: Description: Simple example of embedded comments :)\n" + "\n" + "\n" + "(: this is a comment (: this is an embedded comment :):)\n" + "\n" + "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Comments inside a conditional expression test (: yada (: neato yada yada yada . */ @org.junit.Test public void xQueryComment009() { final XQuery query = new XQuery( "(: Name: XQueryComment009 :)\n" + "(: Description: Comments inside a conditional expression :)\n" + "\n" + "\n" + "\n" + "if (:test (: yada (: neato :) :) :) (/fs:MyComputer) \n" + "\tthen (: yada :) \"true\"\n" + "\telse \"false\"\n" + "", ctx); try { query.context(node(file("prod/ForClause/fsx_NS.xml"))); query.namespace("fs", "http://www.example.com/filesystem"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true") ); } /** * Comments inside a conditional expression comment this is the then case this is the else case . */ @org.junit.Test public void xQueryComment010() { final XQuery query = new XQuery( "\n" + "(: Name: XQueryComment010 :)\n" + "(: Description: Comments inside a conditional expression :)\n" + "if (: comment :) \n" + " ( //fs:Folder[1]/fs:FolderName/text() = \"Folder00000000000\" ) \n" + "then (: this is the then case :) ( true() )\n" + "else (: this is the else case :) ( false() )\n" + "\n" + "", ctx); try { query.context(node(file("prod/ForClause/fsx_NS.xml"))); query.namespace("fs", "http://www.example.com/filesystem"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Comments inside a conditional expression test t2 t3 . */ @org.junit.Test public void xQueryComment011() { final XQuery query = new XQuery( "(: Name: XQueryComment011 :)\n" + "(: Description: Comments inside a conditional expression :)\n" + "\n" + "\n" + "\n" + "if (:test:)(:t2:)(:t3:) (/fs:MyComputer) \n" + "\tthen \"true\"\n" + "\telse \"false\"\n" + "\n" + "", ctx); try { query.context(node(file("prod/ForClause/fsx_NS.xml"))); query.namespace("fs", "http://www.example.com/filesystem"); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true") ); } /** * Comments that looks like a function call test . */ @org.junit.Test public void xQueryComment012() { final XQuery query = new XQuery( "(: Name: XQueryComment012 :)\n" + "(: Description: Comments that looks like a function call :)\n" + "\n" + "\n" + "/south(: test :)\n" + "\n" + "", ctx); try { query.context(node(file("prod/AxisStep/TreeEmpty.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Comments inside a sequence expression comment . */ @org.junit.Test public void xQueryComment013() { final XQuery query = new XQuery( "(: Name: XQueryComment013 :)\n" + "(: Description: Comments inside a sequence expression :)\n" + "\n" + "\n" + "(1, 2, (: comment :) 3, 4)\n" + "\n" + "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 4") ); } /** * Comments inside a cast expression type comment . */ @org.junit.Test public void xQueryComment014() { final XQuery query = new XQuery( "(: Name: XQueryComment014 :)\n" + "(: Description: Comments inside a cast expression :)\n" + "\n" + "\n" + "\"10\" cast as (: type comment :) xs:integer ?\n" + "\n" + "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Incorrect comment syntax . */ @org.junit.Test public void xQueryComment015() { final XQuery query = new XQuery( "(: Name: XQueryComment015 :)\n" + "(: Description: Incorrect comment syntax :)\n" + "\n" + "\n" + "(! Wrong syntax :)\n" + "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Invalid comment . */ @org.junit.Test public void xQueryComment016() { final XQuery query = new XQuery( "(: Name: XQueryComment016 :)\n" + "(: Description: Invalid comment :)\n" + "\n" + "\n" + "(:)\n" + "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Invalid comment . */ @org.junit.Test public void xQueryComment017() { final XQuery query = new XQuery( "(: Name: XQueryComment017 :)\n" + "(: Description: Invalid comment :)\n" + "\n" + "\n" + "(:: )\n" + "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Invalid comment . */ @org.junit.Test public void xQueryComment018() { final XQuery query = new XQuery( "(: Name: XQueryComment018 :)\n" + "(: Description: Invalid comment :)\n" + "\n" + "\n" + "-- Wrong comment format\n" + "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Old style comment syntax . */ @org.junit.Test public void xQueryComment019() { final XQuery query = new XQuery( "(: Name: XQueryComment019 :)\n" + "(: Description: Old style comment syntax :)\n" + "\n" + "\n" + "{-- Wrong comment format --}\n" + "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Comment containing an enclosed expression { "comment" } . */ @org.junit.Test public void xQueryComment020() { final XQuery query = new XQuery( "(: Name: XQueryComment020 :)\n" + "(: Description: Comment containing an enclosed expression :)\n" + "\n" + "\n" + "(: { \"comment\" } :)\n" + "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdCompAttrConstructor.java000066400000000000000000001612131222453003200321400ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the CompAttrConstructor (computed attribute constructor) production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdCompAttrConstructor extends QT3TestSet { /** * empty computed name . */ @org.junit.Test public void constrCompattrCompname1() { final XQuery query = new XQuery( "element elem {attribute {()} {'text'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * string as name . */ @org.junit.Test public void constrCompattrCompname10() { final XQuery query = new XQuery( "element elem {attribute {'attr'} {'text'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * string as name . */ @org.junit.Test public void constrCompattrCompname11() { final XQuery query = new XQuery( "element elem {attribute {'attr', ()} {'text'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * string as name . */ @org.junit.Test public void constrCompattrCompname12() { final XQuery query = new XQuery( "element elem {attribute {(), 'attr'} {'text'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * string with prefix as name . */ @org.junit.Test public void constrCompattrCompname13() { final XQuery query = new XQuery( "{element elem {attribute {'foo:attr'} {}}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * string with undeclared prefix as name . */ @org.junit.Test public void constrCompattrCompname14() { final XQuery query = new XQuery( "element elem {attribute {'foo:attr'} {}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0074") ); } /** * untyped atomic as name . */ @org.junit.Test public void constrCompattrCompname15() { final XQuery query = new XQuery( "element elem {attribute {xs:untypedAtomic('attr')} {'text'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * untyped atomic with prefix as name . */ @org.junit.Test public void constrCompattrCompname16() { final XQuery query = new XQuery( "{attribute {xs:untypedAtomic('foo:attr')} {'text'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * untyped atomic with undeclared prefix as name . */ @org.junit.Test public void constrCompattrCompname17() { final XQuery query = new XQuery( "element elem {attribute {xs:untypedAtomic('foo:elem')} {'text'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0074") ); } /** * non-ncname string as name . */ @org.junit.Test public void constrCompattrCompname18() { final XQuery query = new XQuery( "element elem {attribute {'el em'} {'text'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0074") ); } /** * non-ncname untyped atomic as name . */ @org.junit.Test public void constrCompattrCompname19() { final XQuery query = new XQuery( "element elem {attribute {xs:untypedAtomic('el em')} {'text'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0074") ); } /** * two strings as name . */ @org.junit.Test public void constrCompattrCompname2() { final XQuery query = new XQuery( "element elem {attribute {'one', 'two'} {'text'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * two untypedAtomic values as name . */ @org.junit.Test public void constrCompattrCompname3() { final XQuery query = new XQuery( "element elem {attribute {xs:untypedAtomic('one'), xs:untypedAtomic('two')} {'text'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * content of two nodes as name . */ @org.junit.Test public void constrCompattrCompname4() { final XQuery query = new XQuery( "element elem {attribute {//a} {'text'}}", ctx); try { query.context(node(file("prod/CompAttrConstructor/DupNode.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * two numeric values as name . */ @org.junit.Test public void constrCompattrCompname5() { final XQuery query = new XQuery( "element elem {attribute {1,2} {'text'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * numeric value as name . */ @org.junit.Test public void constrCompattrCompname6() { final XQuery query = new XQuery( "element elem {attribute {123} {'text'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * dataTime value as name . */ @org.junit.Test public void constrCompattrCompname7() { final XQuery query = new XQuery( "element elem {attribute {xs:dateTime(\"1999-05-31T13:20:00\")} {'text'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * QName as name . */ @org.junit.Test public void constrCompattrCompname9() { final XQuery query = new XQuery( "element elem {attribute {xs:QName('aQname')} {'text'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * typed value of element . */ @org.junit.Test public void constrCompattrData1() { final XQuery query = new XQuery( "fn:data(attribute attr {'a', element a {}, 'b'})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b") ); } /** * strip document nodes . */ @org.junit.Test public void constrCompattrDoc1() { final XQuery query = new XQuery( "element elem {attribute attr {., .}}", ctx); try { query.context(node(file("prod/CompAttrConstructor/DupNode.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * enclosed expression in attribute content - atomic values . */ @org.junit.Test public void constrCompattrEnclexpr1() { final XQuery query = new XQuery( "element elem {attribute attr {1,'string',3.14,xs:float('1.2345e-2'),xs:dateTime('2002-04-02T12:00:00-01:00')}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * enclosed expression in attribute content - nodes . */ @org.junit.Test public void constrCompattrEnclexpr2() { final XQuery query = new XQuery( "element elem {attribute attr {123, ()/@attr, (789)/text()}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * enclosed expression in attribute content - empty string . */ @org.junit.Test public void constrCompattrEnclexpr3() { final XQuery query = new XQuery( "element elem {attribute attr {1,'',2}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * enclosed expression in attribute content - empty node . */ @org.junit.Test public void constrCompattrEnclexpr4() { final XQuery query = new XQuery( "element elem {attribute attr {1,,2}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * attribute xml:id - content is ncname . */ @org.junit.Test public void constrCompattrId1() { final XQuery query = new XQuery( "element elem {attribute xml:id {\"ncname\"}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * attribute xml:id - content is to be further normalized . */ @org.junit.Test public void constrCompattrId2() { final XQuery query = new XQuery( "element elem {attribute xml:id {\" ab c d \"}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("", false) || error("XQDY0091") ) ); } /** * NCName for computed attribute constructor . */ @org.junit.Test public void constrCompattrName1() { final XQuery query = new XQuery( "element elem {attribute attr {'text'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * QName for computed attribute constructor . */ @org.junit.Test public void constrCompattrName2() { final XQuery query = new XQuery( "declare namespace foo=\"http://www.example.com/foo\"; element elem {attribute foo:attr {'text'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * QName with undeclared prefix for computed attribute constructor . */ @org.junit.Test public void constrCompattrName3() { final XQuery query = new XQuery( "element elem {attribute foo:attr {'text'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0081") ); } /** * empty parent . */ @org.junit.Test public void constrCompattrParent1() { final XQuery query = new XQuery( "count((attribute attr {})/..)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * string value of attribute . */ @org.junit.Test public void constrCompattrString1() { final XQuery query = new XQuery( "fn:string(attribute attr {'a', element a {}, 'b'})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b") ); } /** * The name can't be specified as a string literal. . */ @org.junit.Test public void k2ComputeConAttr1() { final XQuery query = new XQuery( "attribute \"name\" {\"content\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Ensure XQTY0024 is not issued when appearing nested. . */ @org.junit.Test public void k2ComputeConAttr10() { final XQuery query = new XQuery( " {{attribute name{\"content\"}}} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Ensure XQTY0024 is not issued when a predicate is used to filter the children. . */ @org.junit.Test public void k2ComputeConAttr11() { final XQuery query = new XQuery( "{(, attribute name{\"content\"})[2]} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Ensure XQTY0024 is issued when content appears before computed attributes. . */ @org.junit.Test public void k2ComputeConAttr12() { final XQuery query = new XQuery( " {attribute name{\"content\"}} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * Ensure XQTY0024 is issued when content appears before computed attributes. . */ @org.junit.Test public void k2ComputeConAttr13() { final XQuery query = new XQuery( " {attribute name {\"content\"}} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * Ensure XQTY0024 is issued when content, set via a user declared function, appears before computed attributes. . */ @org.junit.Test public void k2ComputeConAttr14() { final XQuery query = new XQuery( "declare function local:myFunc() { }; {local:myFunc()} {attribute name {\"content\"}} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * Ensure XQTY0024 is issued when content, set via a user declared function, appears before computed attributes. . */ @org.junit.Test public void k2ComputeConAttr15() { final XQuery query = new XQuery( "declare function local:myFunc() { comment {\"content\"} }; {local:myFunc()} {attribute name {\"content\"}} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * Ensure XQTY0024 is issued when content, set via a user declared function, appears before computed attributes. . */ @org.junit.Test public void k2ComputeConAttr16() { final XQuery query = new XQuery( "declare function local:myFunc() as element()+ { }; {local:myFunc()} {attribute name {\"content\"}} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * Ensure XQTY0024 is issued when content, set via a user declared function, appears before computed attributes. . */ @org.junit.Test public void k2ComputeConAttr17() { final XQuery query = new XQuery( "declare function local:myFunc() as item() { }; {local:myFunc()} {attribute name {\"content\"}} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * Ensure XQTY0024 is issued when content, set via a user declared function, appears before computed attributes. . */ @org.junit.Test public void k2ComputeConAttr18() { final XQuery query = new XQuery( "declare function local:myFunc() as item() { }; {local:myFunc()} {attribute name {\"content\"}} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * Ensure XQTY0024 is issued when content, set via a user declared, recursive function, appears before computed attributes. . */ @org.junit.Test public void k2ComputeConAttr19() { final XQuery query = new XQuery( "declare function local:myFunc($recurse as xs:integer) { { if ($recurse = 0) then () else local:myFunc($recurse - 1) } }; {local:myFunc(3)} {attribute name {\"content\"}} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * Ensure XQTY0024 is issued when content appears before computed attributes. . */ @org.junit.Test public void k2ComputeConAttr2() { final XQuery query = new XQuery( " {attribute name {\"content\"}} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * Ensure XQTY0024 is issued when content, set via a user declared, recursive function, appears before computed attributes. . */ @org.junit.Test public void k2ComputeConAttr20() { final XQuery query = new XQuery( "declare function local:myFunc($recurse as xs:integer) as item() { { if ($recurse = 0) then () else local:myFunc($recurse - 1) } }; {local:myFunc(3)} {attribute name {\"content\"}} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * Ensure XQTY0024 is issued when content, set via a user declared, recursive function, appears before computed attributes. . */ @org.junit.Test public void k2ComputeConAttr21() { final XQuery query = new XQuery( "declare function local:myFunc() { , attribute name {\"content\"} }; {local:myFunc()} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * Ensure XQTY0024 is issued when content, set via a user declared variable, appears before computed attributes. . */ @org.junit.Test public void k2ComputeConAttr22() { final XQuery query = new XQuery( "declare variable $myVar := (, attribute name {\"content\"}); {$myVar} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * Ensure XQTY0024 is not issued when a predicate avoid the condition. . */ @org.junit.Test public void k2ComputeConAttr23() { final XQuery query = new XQuery( "declare variable $myVar := (, attribute name {\"content\"}); {$myVar[2]} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Ensure XQTY0024 is issued when content, set via a user declared variable, appears before computed attributes. . */ @org.junit.Test public void k2ComputeConAttr24() { final XQuery query = new XQuery( "declare variable $myVar := (attribute name {\"content\"}, ); {$myVar[2]} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Add many attributes with a recursive user function. . */ @org.junit.Test public void k2ComputeConAttr25() { final XQuery query = new XQuery( "declare function local:myFunc($recurse as xs:integer) { attribute {concat(\"name\", $recurse)} {\"content\"} , if ($recurse = 0) then () else local:myFunc($recurse - 1) }; {local:myFunc(2)} {attribute name {\"content\"}} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Add many attributes with a recursive user function. . */ @org.junit.Test public void k2ComputeConAttr26() { final XQuery query = new XQuery( "declare function local:myFunc() { attribute name {\"content\"}, }; {local:myFunc()} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Add many attributes with a recursive user function. . */ @org.junit.Test public void k2ComputeConAttr27() { final XQuery query = new XQuery( "declare function local:myFunc() { , attribute name {\"content\"} }; {local:myFunc()[2]} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Ensure XQTY0024 is issued when content, set via a user declared variable, appears before computed attributes. . */ @org.junit.Test public void k2ComputeConAttr28() { final XQuery query = new XQuery( "declare variable $local:myVar := ; {$local:myVar} {attribute name {\"content\"}} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * Ensure XQTY0024 is issued when content, set via a user declared variable, appears before computed attributes. . */ @org.junit.Test public void k2ComputeConAttr29() { final XQuery query = new XQuery( "declare variable $local:myVar as item() := ; {$local:myVar} {attribute name {\"content\"}} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * Ensure XQTY0024 is issued when content appears before computed attributes. . */ @org.junit.Test public void k2ComputeConAttr3() { final XQuery query = new XQuery( " {\"a string\", attribute name {\"content\"}} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * Add an attribute from a variable to an element. . */ @org.junit.Test public void k2ComputeConAttr30() { final XQuery query = new XQuery( "declare variable $local:myVar := attribute n2 {\"content\"}; {$local:myVar} {attribute name {\"content\"}} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Add an attribute from a function to an element. . */ @org.junit.Test public void k2ComputeConAttr31() { final XQuery query = new XQuery( "declare function local:myFunc() { attribute n2 {\"content\"} }; {local:myFunc()} {attribute name {\"content\"}} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Add two computed attributes, where one gets it content from an element. . */ @org.junit.Test public void k2ComputeConAttr32() { final XQuery query = new XQuery( " { attribute name {}, attribute name2 {\"content\"} } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Add two computed attributes, where one gets it content from an atomic value. . */ @org.junit.Test public void k2ComputeConAttr33() { final XQuery query = new XQuery( " { attribute name {\"content\"}, attribute name2 {\"content\"} } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Add two computed attributes, where one gets it content from an atomic value. . */ @org.junit.Test public void k2ComputeConAttr34() { final XQuery query = new XQuery( " { attribute name {xs:hexBinary(\"ff\")}, attribute name2 {\"content\"} } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Empty CDATA sections generate no text nodes. . */ @org.junit.Test public void k2ComputeConAttr35() { final XQuery query = new XQuery( "{attribute name {\"content\"}} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Empty CDATA sections generate no text nodes(#2). . */ @org.junit.Test public void k2ComputeConAttr36() { final XQuery query = new XQuery( "count(/text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * This query yields XPST0081 because the prefix 'xmlns' is unbound. . */ @org.junit.Test public void k2ComputeConAttr37() { final XQuery query = new XQuery( "attribute xmlns:localName {\"content\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0081") ); } /** * This query yields XPST0081 because the prefix 'xmlns' is unbound(#2). . */ @org.junit.Test public void k2ComputeConAttr38() { final XQuery query = new XQuery( "attribute {\"xmlns:localName\"} {\"content\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQDY0044") || error("XQDY0074") ) ); } /** * This query yields XPST0081 because the prefix 'aPrefix' is unbound. . */ @org.junit.Test public void k2ComputeConAttr39() { final XQuery query = new XQuery( "attribute aPrefix:localName {\"content\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0081") ); } /** * Ensure XQTY0024 is issued when content appears before computed attributes. . */ @org.junit.Test public void k2ComputeConAttr4() { final XQuery query = new XQuery( " {\"a string\", attribute name {\"content\"}} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * An unbound prefix in a lexical QName yields QDY0074. . */ @org.junit.Test public void k2ComputeConAttr40() { final XQuery query = new XQuery( "attribute {\"aPrefix:localName\"} {\"content\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0074") ); } /** * An unbound prefix in a lexical QName yields QDY0074. . */ @org.junit.Test public void k2ComputeConAttr41() { final XQuery query = new XQuery( "attribute {xs:untypedAtomic(\"aPrefix::localName\")} {\"content\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0074") ); } /** * It's not allowed to bind the xmlns namespace to any prefix with computed attribute constructors. . */ @org.junit.Test public void k2ComputeConAttr42() { final XQuery query = new XQuery( "\n" + " declare namespace prefix = \"http://www.w3.org/2000/xmlns/\"; \n" + " {attribute prefix:localName {\"content\"}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0070") ); } /** * It's not allowed to bind the xmlns namespace to any prefix(#2). . */ @org.junit.Test public void k2ComputeConAttr43() { final XQuery query = new XQuery( "declare namespace prefix = \"http://www.w3.org/2000/xmlns/\"; {attribute {\"prefix:localName\"} {\"content\"}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0070") ); } /** * One cannot create namespace declarations with computed attribute constructors. . */ @org.junit.Test public void k2ComputeConAttr44() { final XQuery query = new XQuery( "attribute {\"xmlns\"} {\"content\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0044") ); } /** * One cannot create namespace declarations with computed attribute constructors(#2). . */ @org.junit.Test public void k2ComputeConAttr45() { final XQuery query = new XQuery( "attribute xmlns {\"content\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0044") ); } /** * The default element namespace declaration doesn't affect attribute declarations. . */ @org.junit.Test public void k2ComputeConAttr46() { final XQuery query = new XQuery( "declare default element namespace \"http://www.example.com/\"; {attribute xmlns {\"content\"}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0044") ); } /** * Ensure the typed value of computed, constructed attributes has the correct type. . */ @org.junit.Test public void k2ComputeConAttr47() { final XQuery query = new XQuery( "data(attribute foo {\"content\"}) instance of xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure xml:id is properly normalized, and not done at the serialization stage. . */ @org.junit.Test public void k2ComputeConAttr48() { final XQuery query = new XQuery( "string(attribute xml:id {\" ab c d \"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "ab c d") || error("XQDY0091") ) ); } /** * Ensure XQDY0025 is issued when triggered by computed constructors. . */ @org.junit.Test public void k2ComputeConAttr49() { final XQuery query = new XQuery( "declare namespace a = \"http://example.com/A\"; declare namespace b = \"http://example.com/A\"; { attribute a:localName {()}, attribute b:localName {()} } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0025") ); } /** * Ensure XQTY0024 is issued when content appears before computed attributes. . */ @org.junit.Test public void k2ComputeConAttr5() { final XQuery query = new XQuery( " {attribute name {\"content\"}} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * Duplicate attributes whose names are non-prefixed while non-empty namespace URIs. . */ @org.junit.Test public void k2ComputeConAttr50() { final XQuery query = new XQuery( " { attribute {QName(\"http://example.com/\", \"attr\")} {()}, attribute {QName(\"http://example.com/\", \"attr\")} {()} } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0025") ); } /** * Construct an attribute with no prefix and a non-empty namespace URI. The specification is currently unclear on this area, http://www.w3.org/Bugs/Public/show_bug.cgi?id=4443 . . */ @org.junit.Test public void k2ComputeConAttr51() { final XQuery query = new XQuery( " { attribute {QName(\"http://example.com/\", \"attr\")} {()} } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Duplicated attributes, but constructed from different kinds of constructors. . */ @org.junit.Test public void k2ComputeConAttr52() { final XQuery query = new XQuery( " { attribute {QName(\"http://example.com/\", \"p:attr\")} {()} } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0025") ); } /** * Serialize an attribute that has a namespace URI but no prefix. The implementation invents a prefix in this case. . */ @org.junit.Test public void k2ComputeConAttr53() { final XQuery query = new XQuery( " { attribute {QName(\"http://example.com/\", \"attr\")} {()} } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Ensure that a valid prefix has been constructed for a QName which the implementation is supposed to create a prefix for. . */ @org.junit.Test public void k2ComputeConAttr54() { final XQuery query = new XQuery( "string-length(xs:NCName(prefix-from-QName(node-name(attribute {QName(\"http://example.com/\", \"attr\")} {()})))) > 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that the 'xml' prefix has been constructed for a QName which has the XML namespace. . */ @org.junit.Test public void k2ComputeConAttr55() { final XQuery query = new XQuery( "prefix-from-QName(node-name(attribute {QName(\"http://www.w3.org/XML/1998/namespace\", \"attr\")} {()}))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xml") ); } /** * Ensure that the 'xml' prefix is used for the XML namespace when no prefix is supplied. . */ @org.junit.Test public void k2ComputeConAttr56() { final XQuery query = new XQuery( " { attribute {QName(\"http://www.w3.org/XML/1998/namespace\", \"space\")} {\"default\"} } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Ensure the xmlns namespace is flagged as invalid even though no prefix is supplied. . */ @org.junit.Test public void k2ComputeConAttr57() { final XQuery query = new XQuery( " { attribute {QName(\"http://www.w3.org/2000/xmlns/\", \"space\")} {\"default\"} } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0044") ); } /** * Serialize an attribute that has a namespace URI but no prefix, and whose namespace URI is already in scope. . */ @org.junit.Test public void k2ComputeConAttr58() { final XQuery query = new XQuery( " { attribute {QName(\"http://example.com/\", \"attr2\")} {()} } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", true) ); } /** * '1' is an invalid value for xml:id. . */ @org.junit.Test public void k2ComputeConAttr59() { final XQuery query = new XQuery( " { attribute xml:id {\"1\"} } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("", false) || error("XQDY0091") ) ); } /** * Ensure XQTY0024 is issued when content appears before computed attributes. . */ @org.junit.Test public void k2ComputeConAttr6() { final XQuery query = new XQuery( " {attribute name {\"content\"}} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * 'DEFAULT' is an invalid value for xml:space. . */ @org.junit.Test public void k2ComputeConAttr60() { final XQuery query = new XQuery( " { attribute xml:space {\"DEFAULT\"} } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("", false) || error("XQDY0092") ) ); } /** * Trigger XQTY0024 in a query with a bit of complexity. . */ @org.junit.Test public void k2ComputeConAttr61() { final XQuery query = new XQuery( "let $x := ( attribute a { \"a\" }, element b { \"b\" }, attribute c { \"c\" } ) return { $x } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * Ensure XQTY0024 is issued when content appears before computed attributes. . */ @org.junit.Test public void k2ComputeConAttr7() { final XQuery query = new XQuery( " {attribute name {\"content\"}} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * Ensure XQTY0024 is issued when content appears before computed attributes. . */ @org.junit.Test public void k2ComputeConAttr8() { final XQuery query = new XQuery( " { \"a string\", 999, attribute name {\"content\"}, xs:hexBinary(\"FF\") } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * Ensure XQTY0024 is issued when content appears before computed attributes. . */ @org.junit.Test public void k2ComputeConAttr9() { final XQuery query = new XQuery( " { \"a string\", 999, (\"another string\", attribute name {\"content\"}, 383), xs:hexBinary(\"FF\") } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * test XQDY0044 in attribute construction . */ @org.junit.Test public void cbclConstrCompattr001() { final XQuery query = new XQuery( "for $a in attribute { fn:QName(\"http://www.w3.org/2000/xmlns/\", \"namespace:foo\") } { \"bar\" } return name($a)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0044") ); } /** * test XQDY0044 in attribute construction . */ @org.junit.Test public void cbclConstrCompattr002() { final XQuery query = new XQuery( "for $a in attribute { fn:QName(\"http://www.example.com/\", \"xmlns:foo\") } { \"bar\" } return name($a)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0044") ); } /** * test XQDY0044 in attribute construction . */ @org.junit.Test public void cbclConstrCompattr003() { final XQuery query = new XQuery( "for $a in attribute { \"xmlns\" } { \"bar\" } return name($a)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0044") ); } /** * test XQDY0044 in attribute construction . */ @org.junit.Test public void cbclConstrCompattr005() { final XQuery query = new XQuery( "\n" + " \tfor $a in attribute { fn:QName(\"http://www.example.com/\", \"xml:foo\") } { \"bar\" } \n" + " \treturn name($a)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0044") ); } /** * test XQDY0044 in attribute construction . */ @org.junit.Test public void cbclConstrCompattr006() { final XQuery query = new XQuery( "\n" + " \tfor $a in attribute { fn:QName(\"http://www.w3.org/XML/1998/namespace\", \"sgml:foo\") } { \"bar\" } \n" + " \treturn name($a)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0044") ); } /** * test attribute constructionn . */ @org.junit.Test public void cbclConstrCompattr007() { final XQuery query = new XQuery( "\n" + " \t { \n" + " \t\tfor $a in attribute { fn:QName(\"http://www.example.com/\", \"sgml:foo\") } { } \n" + " \t\treturn concat(name($a), \"=\", namespace-uri($a)) } \n" + " \t\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("sgml:foo=http://www.example.com/", false) ); } /** * test attribute constructionn . */ @org.junit.Test public void cbclConstrCompattr008() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:factorial($arg as xs:integer) as xs:integer { \n" + " \t\tif ($arg le 1) then 1 else $arg * local:factorial($arg - 1) \n" + " \t}; \n" + " \t { attribute { fn:QName(\"http://www.example.com/\", \"sgml:foo\") } { local:factorial(5) } } \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * test attribute construction with empty content . */ @org.junit.Test public void cbclConstrCompattr009() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:even-range($arg as xs:integer) as xs:integer* { (1 to $arg)[. mod 2 = 9] }; \n" + " \t { attribute { 'attr' } { local:even-range(0) } } \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * 3.7.3.2 Computed Attribute Constructor per XQ.E19 XQDY0044 if namespace prefix is 'xmlns' Mary Holstege . */ @org.junit.Test public void compAttrBadName1() { final XQuery query = new XQuery( "(: 3.7.3.2 Computed Attribute Constructor per XQ.E19 XQDY0044 if namespace prefix is 'xmlns' Mary Holstege :) {attribute {\"xmlns:error\"} {}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQDY0044") || error("XQDY0074") ) ); } /** * 3.7.3.2 Computed Attribute Constructor per XQ.E19 XQDY0044 if no namespace prefix and local name is 'xmlns' Mary Holstege . */ @org.junit.Test public void compAttrBadName2() { final XQuery query = new XQuery( "(: 3.7.3.2 Computed Attribute Constructor per XQ.E19 XQDY0044 if no namespace prefix and local name is 'xmlns' Mary Holstege :) {attribute {\"xmlns\"} {}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0044") ); } /** * 3.7.3.2 Computed Attribute Constructor per XQ.E19 XQDY0044 if namespace URI is 'http://www.w3.org/2000/xmlns/' Mary Holstege . */ @org.junit.Test public void compAttrBadName3() { final XQuery query = new XQuery( "(: 3.7.3.2 Computed Attribute Constructor per XQ.E19 XQDY0044 if namespace URI is 'http://www.w3.org/2000/xmlns/' Mary Holstege :) { attribute { fn:QName(\"http://www.w3.org/2000/xmlns/\",\"error\")} {} }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0044") ); } /** * 3.7.3.2 Computed Attribute Constructor per XQ.E19 XQDY0044 if namespace URI is 'http://www.w3.org/2000/xmlns/' Mary Holstege . */ @org.junit.Test public void compAttrBadName4() { final XQuery query = new XQuery( "(: 3.7.3.2 Computed Attribute Constructor per XQ.E19 XQDY0044 if namespace URI is 'http://www.w3.org/2000/xmlns/' Mary Holstege :) { attribute { fn:QName(\"http://www.w3.org/2000/xmlns/\",\"foo:error\")} {} }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0044") ); } /** * 3.7.3.2 Computed Attribute Constructor per XQ.E19 XQDY0044 if namespace prefix is 'xml' and namespace URI is not 'http://www.w3.org/XML/1998/namespace' Mary Holstege . */ @org.junit.Test public void compAttrBadName5() { final XQuery query = new XQuery( "(: 3.7.3.2 Computed Attribute Constructor per XQ.E19 XQDY0044 if namespace prefix is 'xml' and namespace URI is not 'http://www.w3.org/XML/1998/namespace' Mary Holstege :) { attribute { fn:QName(\"http://example.com/not-XML-uri\",\"xml:error\") } {} }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0044") ); } /** * 3.7.3.2 Computed Attribute Constructor per XQ.E19 XQDY0044 if namespace prefix is not 'xml' and namespace URI is 'http://www.w3.org/XML/1998/namespace' Mary Holstege . */ @org.junit.Test public void compAttrBadName6() { final XQuery query = new XQuery( "(: 3.7.3.2 Computed Attribute Constructor per XQ.E19 XQDY0044 if namespace prefix is not 'xml' and namespace URI is 'http://www.w3.org/XML/1998/namespace' Mary Holstege :) { attribute { fn:QName(\"http://www.w3.org/XML/1998/namespace\",\"foo:error\")} {} }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0044") ); } /** * 3.7.3.2 Computed Attribute Constructor per XQ.E19 XQDY0044 if namespace prefix is 'xmlns' Mary Holstege . */ @org.junit.Test public void compAttrBadName7() { final XQuery query = new XQuery( "(: 3.7.3.2 Computed Attribute Constructor per XQ.E19 XQDY0044 if namespace prefix is 'xmlns' Mary Holstege :) {attribute {fn:QName(\"http://example.com/some-uri\",\"xmlns:error\")} {}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0044") ); } /** * Evaluation of constructor function xs:QName for which the argument is not a literal. . */ @org.junit.Test public void constattrerr1() { final XQuery query = new XQuery( "declare variable $input-context1 external; attribute xmlns {}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0044") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdCompCommentConstructor.java000066400000000000000000000320241222453003200326250ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the CompCommentConstructor (computed comment constructor) production . * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdCompCommentConstructor extends QT3TestSet { /** * dash as comment . */ @org.junit.Test public void constrCompcommentDash1() { final XQuery query = new XQuery( "comment {'-'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0072") ); } /** * comment ends with a dash . */ @org.junit.Test public void constrCompcommentDash2() { final XQuery query = new XQuery( "comment {'comment-'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0072") ); } /** * character ref as dash . */ @org.junit.Test public void constrCompcommentDash3() { final XQuery query = new XQuery( "comment {'comment-'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0072") ); } /** * dash at the end of content -. */ @org.junit.Test public void constrCompcommentDash4() { final XQuery query = new XQuery( "comment {//*:test-case[@name=\"Constr-compcomment-dash-4\"]/*:description}", ctx); try { query.context(node(file("prod/CompCommentConstructor.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0072") ); } /** * typed value of computed comment node . */ @org.junit.Test public void constrCompcommentData1() { final XQuery query = new XQuery( "fn:data(comment {'a', element a {}, 'b'})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b") ); } /** * strip document nodes . */ @org.junit.Test public void constrCompcommentDoc1() { final XQuery query = new XQuery( "comment {., .}", ctx); try { query.context(node(file("prod/CompAttrConstructor/DupNode.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * double dash as comment . */ @org.junit.Test public void constrCompcommentDoubledash1() { final XQuery query = new XQuery( "comment {'--'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0072") ); } /** * comment contains double dash . */ @org.junit.Test public void constrCompcommentDoubledash2() { final XQuery query = new XQuery( "comment {'com--ment'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0072") ); } /** * character ref as double dash . */ @org.junit.Test public void constrCompcommentDoubledash3() { final XQuery query = new XQuery( "comment {'com--ment'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0072") ); } /** * double dash -- in content . */ @org.junit.Test public void constrCompcommentDoubledash4() { final XQuery query = new XQuery( "comment {//*:test-case[@name=\"Constr-compcomment-doubledash-4\"]/*:description}", ctx); try { query.context(node(file("prod/CompCommentConstructor.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0072") ); } /** * adjacent dashes in seperate expressions . */ @org.junit.Test public void constrCompcommentDoubledash5() { final XQuery query = new XQuery( "comment {'com','-','-','ment'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * enclosed expression in computed comment node - atomic values . */ @org.junit.Test public void constrCompcommentEnclexpr1() { final XQuery query = new XQuery( "comment {1,'string',3.14,xs:float('1.2345e-2'),xs:dateTime('2002-04-02T12:00:00-01:00')}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * enclosed expression in computed comment node - nodes . */ @org.junit.Test public void constrCompcommentEnclexpr2() { final XQuery query = new XQuery( "comment {123, ()/@attr, (789)/text()}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * enclosed expression in computed comment node - empty string . */ @org.junit.Test public void constrCompcommentEnclexpr3() { final XQuery query = new XQuery( "comment {1,'',2}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * enclosed expression in computed comment node - empty node . */ @org.junit.Test public void constrCompcommentEnclexpr4() { final XQuery query = new XQuery( "comment {1,,2}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * enclosed expression in computed comment node - nodes . */ @org.junit.Test public void constrCompcommentEnclexpr5() { final XQuery query = new XQuery( "comment {/root}", ctx); try { query.context(node(file("prod/CompAttrConstructor/DupNode.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * nested computed comment node constructor . */ @org.junit.Test public void constrCompcommentNested1() { final XQuery query = new XQuery( "comment {comment {'one', comment {'two'}}, 'three', comment {'four'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * nested computed comment nodes in element constructor . */ @org.junit.Test public void constrCompcommentNested2() { final XQuery query = new XQuery( "{comment {'one'}}{comment {'two'}}{comment {'three'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * nested computed comment nodes in element constructor . */ @org.junit.Test public void constrCompcommentNested3() { final XQuery query = new XQuery( "document {comment {'one'}, , comment {'two'}, , comment {'three'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * empty parent . */ @org.junit.Test public void constrCompcommentParent1() { final XQuery query = new XQuery( "count((comment {'comment'})/..)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * string value of computed comment node . */ @org.junit.Test public void constrCompcommentString1() { final XQuery query = new XQuery( "fn:string(comment {'a', element a {}, 'b'})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b") ); } /** * Comment constructors cannot specify a name. . */ @org.junit.Test public void k2ComputeConComment1() { final XQuery query = new XQuery( "comment {\"name\"} {\"content\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Comment constructors cannot specify a name. . */ @org.junit.Test public void k2ComputeConComment2() { final XQuery query = new XQuery( "comment name {\"content\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A computed comment constructor having an empty sequence as input. . */ @org.junit.Test public void k2ComputeConComment3() { final XQuery query = new XQuery( "comment {()}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * The enclosed expression isn't optional. . */ @org.junit.Test public void k2ComputeConComment4() { final XQuery query = new XQuery( "comment{}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Test the atomized type. . */ @org.junit.Test public void k2ComputeConComment5() { final XQuery query = new XQuery( "data(comment {\"content\"}) instance of xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * test detection of '--' in computed comment . */ @org.junit.Test public void cbclConstrCompcomment001() { final XQuery query = new XQuery( " { comment { '-', '-' } } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0072") ); } /** * test detection of '--' in computed comment . */ @org.junit.Test public void cbclConstrCompcomment002() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:tag($arg) as element() { element { 'tag' } { $arg } }; \n" + " \t { comment { 'comment', local:tag('--') } } \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0072") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdCompDocConstructor.java000066400000000000000000000641011222453003200317310ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the CompDocConstructor (Document node constructor) production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdCompDocConstructor extends QT3TestSet { /** * merge adjacent atomic values to text node . */ @org.junit.Test public void constrDocnodeAdjtext1() { final XQuery query = new XQuery( "count((document {1, 'string', 1,2e3})/text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * merge adjacent atomic values and text nodes to text node . */ @org.junit.Test public void constrDocnodeAdjtext2() { final XQuery query = new XQuery( "count((document {1, //text(), 'string'})/text())", ctx); try { query.context(node(file("prod/CompAttrConstructor/DupNode.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * merge adjacent atomic values between other nodes to text node . */ @org.junit.Test public void constrDocnodeAdjtext3() { final XQuery query = new XQuery( "count((document {1, 2, , 3, 4, , 5, 6})/text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * attribute in document constructor . */ @org.junit.Test public void constrDocnodeAttr1() { final XQuery query = new XQuery( "document {//@mark}", ctx); try { query.context(node(file("prod/AxisStep/TreeEmpty.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * attribute in document constructor . */ @org.junit.Test public void constrDocnodeAttr2() { final XQuery query = new XQuery( "document {, //@mark}", ctx); try { query.context(node(file("prod/AxisStep/TreeEmpty.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * attribute in document constructor . */ @org.junit.Test public void constrDocnodeAttr3() { final XQuery query = new XQuery( "document {, //@mark, }", ctx); try { query.context(node(file("prod/AxisStep/TreeEmpty.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * typed value of element . */ @org.junit.Test public void constrDocnodeData1() { final XQuery query = new XQuery( "fn:data(document {'a', element a {}, 'b'})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ab") ); } /** * strip document nodes . */ @org.junit.Test public void constrDocnodeDoc1() { final XQuery query = new XQuery( "document {., .}", ctx); try { query.context(node(file("prod/CompAttrConstructor/DupNode.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("texttexttexttext", false) || error("XPST0005") ) ); } /** * empty computed element content . */ @org.junit.Test public void constrDocnodeEnclexpr1() { final XQuery query = new XQuery( "document {()}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "") ); } /** * atomic values in computed element content . */ @org.junit.Test public void constrDocnodeEnclexpr2() { final XQuery query = new XQuery( "document {1,'a',3.5,4e2}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 a 3.5 400") ); } /** * atomic values and nodes in computed element content . */ @org.junit.Test public void constrDocnodeEnclexpr3() { final XQuery query = new XQuery( "document {1,//a,2,3,//comment(),4,5,//processing-instruction(),6,7,//text(),8}", ctx); try { query.context(node(file("prod/CompAttrConstructor/DupNode.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1texttext2 34 56 7texttext8", false) ); } /** * empty string in element content . */ @org.junit.Test public void constrDocnodeEnclexpr4() { final XQuery query = new XQuery( "document {1, '', 2}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2") ); } /** * nested computed element constructors . */ @org.junit.Test public void constrDocnodeNested1() { final XQuery query = new XQuery( "document {1, document {2, document {document {()}, document {3}}, 4}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1234") ); } /** * copy node tree into computed element constructor . */ @org.junit.Test public void constrDocnodeNested2() { final XQuery query = new XQuery( "document {/root}", ctx); try { query.context(node(file("prod/CompAttrConstructor/DupNode.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("texttext", false) ); } /** * Check that text nodes are merged in nested document constructors. . */ @org.junit.Test public void constrDocnodeNested3() { final XQuery query = new XQuery( "count(document {1, document{2}, document { document {()}, document {3}}, 4}/text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Check that empty text nodes are stripped in nested document constructors. . */ @org.junit.Test public void constrDocnodeNested4() { final XQuery query = new XQuery( "count(document {\"\", document{\"\"}, document { document {()}, document {\"\"}}, \"\"}/text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Copied element node has new node identity . */ @org.junit.Test public void constrDocnodeNodeid1() { final XQuery query = new XQuery( "for $x in , $y in document {$x} return exactly-one($y/a) is $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Copied comment node has new node identity . */ @org.junit.Test public void constrDocnodeNodeid3() { final XQuery query = new XQuery( "for $x in , $y in document {$x} return exactly-one($y/comment()) is $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Copied pi node has new node identity . */ @org.junit.Test public void constrDocnodeNodeid4() { final XQuery query = new XQuery( "for $x in , $y in document {$x} return exactly-one($y/processing-instruction()) is $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Copied text node has new node identity . */ @org.junit.Test public void constrDocnodeNodeid5() { final XQuery query = new XQuery( "for $x in text, $y in document {$x/text()} return exactly-one($y/text()) is exactly-one($x/text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * empty parent . */ @org.junit.Test public void constrDocnodeParent1() { final XQuery query = new XQuery( "count((document {()})/..)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * string value of element . */ @org.junit.Test public void constrDocnodeString1() { final XQuery query = new XQuery( "fn:string(document {'a', element a {}, 'b'})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ab") ); } /** * No node constructor by name document-node exists. . */ @org.junit.Test public void k2ConDocNode1() { final XQuery query = new XQuery( "document-node{\"content\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Document nodes may have several elements as children. . */ @org.junit.Test public void k2ConDocNode10() { final XQuery query = new XQuery( "document{, , }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Extract the typed value from a document node. . */ @org.junit.Test public void k2ConDocNode11() { final XQuery query = new XQuery( "{data(document{, , })}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Extract the string value from a document node. . */ @org.junit.Test public void k2ConDocNode12() { final XQuery query = new XQuery( "{string(document{, , })}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Extract the string value from a document node. . */ @org.junit.Test public void k2ConDocNode13() { final XQuery query = new XQuery( "{string(document{, , })}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Extract the string value from a document node. . */ @org.junit.Test public void k2ConDocNode14() { final XQuery query = new XQuery( "string(document{\"abc\"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc") ); } /** * Test the atomized type. . */ @org.junit.Test public void k2ConDocNode15() { final XQuery query = new XQuery( "data(document {\"content\"}) instance of xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test node identity of two document nodes. . */ @org.junit.Test public void k2ConDocNode16() { final XQuery query = new XQuery( "document {\"content\"} is document{\"content\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Extract the string value from a complex document node. . */ @org.junit.Test public void k2ConDocNode17() { final XQuery query = new XQuery( "string(document{\"string\", moreeven more content})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "stringmoreeven moreButNotThis content") ); } /** * Ensure processing instructions and comments are ignored when extracting the string value from a document node. . */ @org.junit.Test public void k2ConDocNode18() { final XQuery query = new XQuery( "string(document{ text {\"data\"}, processing-instruction name {\"data\"}, processing-instruction name {\"data\"}, text {\"data\"}, processing-instruction name {\"data\"}, processing-instruction name1 {\"data\"}, comment {\"content\"}, comment {\"content\"}, text {\"data\"}, processing-instruction name2 {\"data\"}, comment {\"content\"}, text {\"data\"} })", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "datadatadatadata") ); } /** * A recursive construction of document nodes. . */ @org.junit.Test public void k2ConDocNode19() { final XQuery query = new XQuery( "count(document{document{document{document{()}}}}/child::node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * A semi-colon can't follow document{}. . */ @org.junit.Test public void k2ConDocNode2() { final XQuery query = new XQuery( "document{\"content\"};", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A recursive construction of document nodes, combined with the comma operator. . */ @org.junit.Test public void k2ConDocNode20() { final XQuery query = new XQuery( "1, document{document{document{document{()}}}}/child::node(), 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 1") ); } /** * A recursive construction of document nodes, with one child element. . */ @org.junit.Test public void k2ConDocNode21() { final XQuery query = new XQuery( "document{document{document{document{}}}}/child::node()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * A recursive construction of document nodes, combined with elements. . */ @org.junit.Test public void k2ConDocNode22() { final XQuery query = new XQuery( "document{document{document{document{, document{()}, {document{()}}}}}}//child::node()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Extract the string value from a document node with four computed text nodes. . */ @org.junit.Test public void k2ConDocNode23() { final XQuery query = new XQuery( "string(document{ text {\"data\"}, text {\"data\"}, text {\"data\"}, text {\"data\"} })", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "datadatadatadata") ); } /** * Ensure text nodes gets merged. . */ @org.junit.Test public void k2ConDocNode24() { final XQuery query = new XQuery( "count(document{ text {\"data\"}, text {\"data\"}, , text {\"data\"}, text {\"data\"} }/child::node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Ensure text nodes gets merged(#2). . */ @org.junit.Test public void k2ConDocNode25() { final XQuery query = new XQuery( "count(document{ text {\"data\"}, text {\"data\"}, text {\"data\"}, text {\"data\"} }/child::node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Attributes cannot be children of document nodes. . */ @org.junit.Test public void k2ConDocNode26() { final XQuery query = new XQuery( " { document { attribute name {\"content\"} } } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Attributes cannot be children of document nodes(#2). . */ @org.junit.Test public void k2ConDocNode27() { final XQuery query = new XQuery( " { document { , attribute name {\"content\"} } } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Attributes cannot be children of document nodes(#3). . */ @org.junit.Test public void k2ConDocNode28() { final XQuery query = new XQuery( " { document { , attribute name {\"content\"} } } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * An invalid attribute constructor as child to the document constructor. . */ @org.junit.Test public void k2ConDocNode29() { final XQuery query = new XQuery( " { document { { , attribute name {\"content\"} } } } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * A document constructor can't receive attribute nodes. . */ @org.junit.Test public void k2ConDocNode3() { final XQuery query = new XQuery( "document{\"some text\", , attribute name {\"content\"}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Ensure two text nodes appearing after a document constructor are merged properly. . */ @org.junit.Test public void k2ConDocNode30() { final XQuery query = new XQuery( "count({document {text{'a'}}}b/node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Ensure a text node is properly constructed with nested document constructors, when extracting the string-value. . */ @org.junit.Test public void k2ConDocNode31() { final XQuery query = new XQuery( "string(document {1, document {2, document {document {()}, 3, document {4}}, 5}, 6})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "123456") ); } /** * Ensure a text node is properly constructed with nested document constructors, when serializing. . */ @org.junit.Test public void k2ConDocNode32() { final XQuery query = new XQuery( "document {1, document {2, document {document {()}, 3, document {4}}, 5}, 6}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "123456") ); } /** * A document constructor can't receive attribute nodes(#2). . */ @org.junit.Test public void k2ConDocNode4() { final XQuery query = new XQuery( "document{, attribute name {\"content\"}, \"some text\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A document constructor can't receive attribute nodes(#3). . */ @org.junit.Test public void k2ConDocNode5() { final XQuery query = new XQuery( "document{attribute name {\"content\"}, , \"some text\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A document constructor can't receive attribute nodes(#4). . */ @org.junit.Test public void k2ConDocNode6() { final XQuery query = new XQuery( "string(document{\"some text\", , attribute name {\"content\"}})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A document constructor can't receive attribute nodes(#5). . */ @org.junit.Test public void k2ConDocNode7() { final XQuery query = new XQuery( "string(document{, attribute name {\"content\"}, \"some text\"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A document constructor can't receive attribute nodes(#7). . */ @org.junit.Test public void k2ConDocNode8() { final XQuery query = new XQuery( "string(document{attribute name {\"content\"}, , \"some text\"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Document nodes may have several elements as children(#8). . */ @org.junit.Test public void k2ConDocNode9() { final XQuery query = new XQuery( "document{, , }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdCompElemConstructor.java000066400000000000000000001063401222453003200321100ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the CompElemConstructor (Computed Element Constructor) production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdCompElemConstructor extends QT3TestSet { /** * merge adjacent atomic values to text node . */ @org.junit.Test public void constrCompelemAdjtext1() { final XQuery query = new XQuery( "count((element elem {1, 'string', 1,2e3})/text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * merge adjacent atomic values and text nodes to text node . */ @org.junit.Test public void constrCompelemAdjtext2() { final XQuery query = new XQuery( "count((element elem {1, //text(), 'string'})/text())", ctx); try { query.context(node(file("prod/CompAttrConstructor/DupNode.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * merge adjacent atomic values between other nodes to text node . */ @org.junit.Test public void constrCompelemAdjtext3() { final XQuery query = new XQuery( "count((element elem {1, 2, , 3, 4, , 5, 6})/text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * attribute node following atomic value . */ @org.junit.Test public void constrCompelemAttr1() { final XQuery query = new XQuery( "element elem {1, //west/@mark}", ctx); try { query.context(node(file("prod/AxisStep/TopMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * attribute node following node . */ @org.junit.Test public void constrCompelemAttr2() { final XQuery query = new XQuery( "element elem {element a {}, //west/@mark}", ctx); try { query.context(node(file("prod/AxisStep/TopMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * attributes in content . */ @org.junit.Test public void constrCompelemAttr3() { final XQuery query = new XQuery( "element elem {//west/@mark, //west/@west-attr-1}", ctx); try { query.context(node(file("prod/AxisStep/TopMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * attribute in content with same name . */ @org.junit.Test public void constrCompelemAttr4() { final XQuery query = new XQuery( "element elem {//west/@mark, //center/@mark}", ctx); try { query.context(node(file("prod/AxisStep/TopMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0025") ); } /** * base-uri through xml:base attribute . */ @org.junit.Test public void constrCompelemBaseuri1() { final XQuery query = new XQuery( "fn:base-uri(element elem {attribute xml:base {\"http://www.example.com\"}})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com") ); } /** * base-uri through parent . */ @org.junit.Test public void constrCompelemBaseuri2() { final XQuery query = new XQuery( "fn:base-uri(exactly-one(({element a {}})/a))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com") ); } /** * base-uri through declaration . */ @org.junit.Test public void constrCompelemBaseuri3() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com\"; fn:base-uri(element elem {})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com") ); } /** * empty computed name . */ @org.junit.Test public void constrCompelemCompname1() { final XQuery query = new XQuery( "element {()} {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * string as name . */ @org.junit.Test public void constrCompelemCompname10() { final XQuery query = new XQuery( "element {'elem'} {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("text", false) ); } /** * string as name . */ @org.junit.Test public void constrCompelemCompname11() { final XQuery query = new XQuery( "element {'elem', ()} {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("text", false) ); } /** * string as name . */ @org.junit.Test public void constrCompelemCompname12() { final XQuery query = new XQuery( "element {(), 'elem'} {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("text", false) ); } /** * string with prefix as name . */ @org.junit.Test public void constrCompelemCompname13() { final XQuery query = new XQuery( "{element {'foo:elem'} {'text'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("text", false) ); } /** * string with undeclared prefix as name . */ @org.junit.Test public void constrCompelemCompname14() { final XQuery query = new XQuery( "element {'foo:elem'} {}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0074") ); } /** * untyped atomic as name . */ @org.junit.Test public void constrCompelemCompname15() { final XQuery query = new XQuery( "element {xs:untypedAtomic('elem')} {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("text", false) ); } /** * untyped atomic with prefix as name . */ @org.junit.Test public void constrCompelemCompname16() { final XQuery query = new XQuery( "{element {xs:untypedAtomic('foo:elem')} {'text'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("text", false) ); } /** * untyped atomic with undeclared prefix as name . */ @org.junit.Test public void constrCompelemCompname17() { final XQuery query = new XQuery( "element {xs:untypedAtomic('foo:elem')} {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0074") ); } /** * non-ncname string as name . */ @org.junit.Test public void constrCompelemCompname18() { final XQuery query = new XQuery( "element {'el em'} {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0074") ); } /** * non-ncname untyped atomic as name . */ @org.junit.Test public void constrCompelemCompname19() { final XQuery query = new XQuery( "element {xs:untypedAtomic('el em')} {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0074") ); } /** * two strings as name . */ @org.junit.Test public void constrCompelemCompname2() { final XQuery query = new XQuery( "element {'one', 'two'} {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * two untypedAtomic values as name . */ @org.junit.Test public void constrCompelemCompname3() { final XQuery query = new XQuery( "element {xs:untypedAtomic('one'), xs:untypedAtomic('two')} {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * content of two nodes as name . */ @org.junit.Test public void constrCompelemCompname4() { final XQuery query = new XQuery( "element {//a} {'text'}", ctx); try { query.context(node(file("prod/CompAttrConstructor/DupNode.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * two numeric values as name . */ @org.junit.Test public void constrCompelemCompname5() { final XQuery query = new XQuery( "element {1,2} {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * numeric value as name . */ @org.junit.Test public void constrCompelemCompname6() { final XQuery query = new XQuery( "element {123} {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * dataTime value as name . */ @org.junit.Test public void constrCompelemCompname7() { final XQuery query = new XQuery( "element {xs:dateTime(\"1999-05-31T13:20:00\")} {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * QName as name . */ @org.junit.Test public void constrCompelemCompname9() { final XQuery query = new XQuery( "element {xs:QName('aQname')} {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("text", false) ); } /** * strip decimal type . */ @org.junit.Test public void constrCompelemConstrmod3() { final XQuery query = new XQuery( "declare construction strip; (element elem {xs:decimal((//decimal[1]))}) cast as xs:integer", ctx); try { query.context(node(file("docs/atomicns.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * preserve decimal type . */ @org.junit.Test public void constrCompelemConstrmod4() { final XQuery query = new XQuery( "declare construction preserve; (element elem {xs:decimal((//decimal[1]))}) cast as xs:integer", ctx); try { query.context(node(file("docs/atomicns.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("12678967") || error("FORG0001") ) ); } /** * strip decimal type in attribute . */ @org.junit.Test public void constrCompelemConstrmod7() { final XQuery query = new XQuery( "declare construction strip; (element elem {//*:decimal/@*:attr})/@*:attr cast as xs:integer", ctx); try { query.context(node(file("docs/atomicns.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * preserve decimal type in attribute . */ @org.junit.Test public void constrCompelemConstrmod8() { final XQuery query = new XQuery( "declare construction preserve; (element elem {xs:decimal(//*:decimal[1]/@*:attr)}) cast as xs:integer", ctx); try { query.context(node(file("docs/atomicns.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("12678967") || error("FORG0001") || error("XPTY0004") ) ); } /** * typed value of element . */ @org.junit.Test public void constrCompelemData1() { final XQuery query = new XQuery( "fn:data(element elem {'a', element a {}, 'b'})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ab") ); } /** * strip document nodes . */ @org.junit.Test public void constrCompelemDoc1() { final XQuery query = new XQuery( "element elem {., .}", ctx); try { query.context(node(file("prod/CompAttrConstructor/DupNode.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("texttexttexttext", false) ); } /** * empty computed element content . */ @org.junit.Test public void constrCompelemEnclexpr1() { final XQuery query = new XQuery( "element elem {}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * atomic values in computed element content . */ @org.junit.Test public void constrCompelemEnclexpr2() { final XQuery query = new XQuery( "element elem {1,'a',3.5,4e2}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1 a 3.5 400", false) ); } /** * atomic values and nodes in computed element content . */ @org.junit.Test public void constrCompelemEnclexpr3() { final XQuery query = new XQuery( "element elem {1,//a,2,3,//comment(),4,5,//processing-instruction(),6,7,//text(),8}", ctx); try { query.context(node(file("prod/CompAttrConstructor/DupNode.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1texttext2 34 56 7texttext8", false) ); } /** * empty string in element content . */ @org.junit.Test public void constrCompelemEnclexpr4() { final XQuery query = new XQuery( "element elem {1, '', 2}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1 2", false) ); } /** * NCName for computed element constructor . */ @org.junit.Test public void constrCompelemName1() { final XQuery query = new XQuery( "element elem {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("text", false) ); } /** * QName for computed element constructor . */ @org.junit.Test public void constrCompelemName2() { final XQuery query = new XQuery( "declare namespace foo=\"http://www.example.com/foo\"; element foo:elem {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("text", false) ); } /** * QName with undeclared prefix for computed element constructor . */ @org.junit.Test public void constrCompelemName3() { final XQuery query = new XQuery( "element foo:elem {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0081") ); } /** * nested computed element constructors . */ @org.junit.Test public void constrCompelemNested1() { final XQuery query = new XQuery( "element elem {1, element a {2, element b {element c {}, element d {3}}, 4}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1234", false) ); } /** * copy node tree into computed element constructor . */ @org.junit.Test public void constrCompelemNested2() { final XQuery query = new XQuery( "element elem {}", ctx); try { query.context(node(file("prod/CompAttrConstructor/DupNode.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Copied element node has new node identity . */ @org.junit.Test public void constrCompelemNodeid1() { final XQuery query = new XQuery( "for $x in , $y in element elem {$x} return exactly-one($y/a) is $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Copied attribute node has new node identity . */ @org.junit.Test public void constrCompelemNodeid2() { final XQuery query = new XQuery( "for $x in , $y in element elem {$x/@b} return $y/@b is $x/@b", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Copied comment node has new node identity . */ @org.junit.Test public void constrCompelemNodeid3() { final XQuery query = new XQuery( "for $x in , $y in element elem {$x} return exactly-one($y/comment()) is $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Copied pi node has new node identity . */ @org.junit.Test public void constrCompelemNodeid4() { final XQuery query = new XQuery( "for $x in , $y in element elem {$x} return exactly-one($y/processing-instruction()) is $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Copied text node has new node identity . */ @org.junit.Test public void constrCompelemNodeid5() { final XQuery query = new XQuery( "for $x in text, $y in element elem {$x/text()} return exactly-one($y/text()) is exactly-one($x/text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * empty parent . */ @org.junit.Test public void constrCompelemParent1() { final XQuery query = new XQuery( "count((element elem {})/..)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * string value of element . */ @org.junit.Test public void constrCompelemString1() { final XQuery query = new XQuery( "fn:string(element elem {'a', element a {}, 'b'})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ab") ); } /** * The name can't be specified as a string literal. . */ @org.junit.Test public void k2ComputeConElem1() { final XQuery query = new XQuery( "element \"name\" {\"content\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that a directly constructed element gets the right type(#3). . */ @org.junit.Test public void k2ComputeConElem10() { final XQuery query = new XQuery( "declare construction strip; element e {\"content\"} instance of element(*, xs:untyped)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that a directly constructed element gets the right type, and that the name test fails. . */ @org.junit.Test public void k2ComputeConElem11() { final XQuery query = new XQuery( "element e {\"content\"} instance of element(a, xs:anyType)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Check that a directly constructed element gets the right type, and that the name test fails(#2). . */ @org.junit.Test public void k2ComputeConElem12() { final XQuery query = new XQuery( "declare construction strip; element e {\"content\"} instance of element(b, xs:untyped)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Two simple nested constructors. . */ @org.junit.Test public void k2ComputeConElem13() { final XQuery query = new XQuery( "element e {element b{()}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Use a technique that sometimes is used for adding namespace nodes. . */ @org.junit.Test public void k2ComputeConElem14() { final XQuery query = new XQuery( "\n" + " declare function local:addNamespace($argElement as element(), $argPrefix as xs:string, $namespaceURI as xs:string) as element() { \n" + " element { QName($namespaceURI, concat($argPrefix, \":x\")) }{$argElement}/* \n" + " }; \n" + " local:addNamespace(, \"prefix\", \"http://example.com/\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Use the default element, where the name is computed dynamically. . */ @org.junit.Test public void k2ComputeConElem15() { final XQuery query = new XQuery( "\n" + " declare default element namespace \"http://example.com/NS\"; \n" + " element {exactly-one((//*)[3])} {}", ctx); try { query.context(node(file("op/union/acme_corp.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Simple content that only is empty string in an element constructor. . */ @org.junit.Test public void k2ComputeConElem2() { final XQuery query = new XQuery( "{\"\", \"\", , }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" ", false) ); } /** * Simple content that only is empty string in an element constructor(#2). . */ @org.junit.Test public void k2ComputeConElem3() { final XQuery query = new XQuery( "{, , \"\", \"\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" ", false) ); } /** * An unbound prefix in a lexical QName yields QDY0074. . */ @org.junit.Test public void k2ComputeConElem4() { final XQuery query = new XQuery( "element {\"aPrefix:localName\"} {\"content\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0074") ); } /** * An unbound prefix in a lexical QName yields QDY0074. . */ @org.junit.Test public void k2ComputeConElem5() { final XQuery query = new XQuery( "element {xs:untypedAtomic(\"aPrefix::localName\")} {\"content\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0074") ); } /** * Test the type of the typed value of a computationally constructed element node. . */ @org.junit.Test public void k2ComputeConElem6() { final XQuery query = new XQuery( "data(element foo {\"dsa\"}) instance of xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test the data of the typed value of a computationally constructed element node. . */ @org.junit.Test public void k2ComputeConElem7() { final XQuery query = new XQuery( "data(element foo {\"dsa\"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "dsa") ); } /** * Check that a directly constructed element gets the right type. . */ @org.junit.Test public void k2ComputeConElem8() { final XQuery query = new XQuery( "element e {\"content\"} instance of element(*, xs:anyType)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that a directly constructed element gets the right type(#2). . */ @org.junit.Test public void k2ComputeConElem9() { final XQuery query = new XQuery( "element e {\"content\"} instance of element(*, xs:untyped)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || assertBoolean(true) ) ); } /** * 3.7.3.1 Computed Element Constructor per XQ.E19 XQDY0096 if namespace prefix is 'xmlns' Mary Holstege . */ @org.junit.Test public void compElemBadName1() { final XQuery query = new XQuery( "element {\"xmlns:error\"} {}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0096") ); } /** * 3.7.3.1 Computed Element Constructor per XQ.E19 XQDY0096 if namespace URI is 'http://www.w3.org/2000/xmlns/' Mary Holstege . */ @org.junit.Test public void compElemBadName2() { final XQuery query = new XQuery( "(: 3.7.3.1 Computed Element Constructor per XQ.E19 XQDY0096 if namespace URI is 'http://www.w3.org/2000/xmlns/' Mary Holstege :) element { fn:QName(\"http://www.w3.org/2000/xmlns/\",\"error\")} {}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0096") ); } /** * 3.7.3.1 Computed Element Constructor per XQ.E19 XQDY0096 if namespace URI is 'http://www.w3.org/2000/xmlns/' Mary Holstege . */ @org.junit.Test public void compElemBadName3() { final XQuery query = new XQuery( "(: 3.7.3.1 Computed Element Constructor per XQ.E19 XQDY0096 if namespace URI is 'http://www.w3.org/2000/xmlns/' Mary Holstege :) element { fn:QName(\"http://www.w3.org/2000/xmlns/\",\"foo:error\")} {}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0096") ); } /** * 3.7.3.1 Computed Element Constructor per XQ.E19 XQDY0096 if namespace prefix is 'xml' and namespace URI is not 'http://www.w3.org/XML/1998/namespace' Mary Holstege . */ @org.junit.Test public void compElemBadName4() { final XQuery query = new XQuery( "(: 3.7.3.1 Computed Element Constructor per XQ.E19 XQDY0096 if namespace prefix is 'xml' and namespace URI is not 'http://www.w3.org/XML/1998/namespace' Mary Holstege :) element { fn:QName(\"http://example.com/not-XML-uri\",\"xml:error\") } {}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0096") ); } /** * 3.7.3.1 Computed Element Constructor per XQ.E19 XQDY0096 if namespace prefix is not 'xml' and its namespace URI is 'http://www.w3.org/XML/1998/namespace' Mary Holstege . */ @org.junit.Test public void compElemBadName5() { final XQuery query = new XQuery( "(: 3.7.3.1 Computed Element Constructor per XQ.E19 XQDY0096 if namespace prefix is not 'xml' and its namespace URI is 'http://www.w3.org/XML/1998/namespace' Mary Holstege :) element { fn:QName(\"http://www.w3.org/XML/1998/namespace\",\"foo:error\") } {}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0096") ); } /** * 3.7.3.1 Computed Element Constructor per XQ.E19 XQDY0096 if namespace prefix is 'xmlns' Mary Holstege . */ @org.junit.Test public void compElemBadName6() { final XQuery query = new XQuery( "(: 3.7.3.1 Computed Element Constructor per XQ.E19 XQDY0096 if namespace prefix is 'xmlns' Mary Holstege :) element { fn:QName(\"http://example.com/some-uri\",\"xmlns:error\") } {}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0096") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdCompNamespaceConstructor.java000066400000000000000000001002301222453003200331120ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the computed namespace constructor expression added in XQuery 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdCompNamespaceConstructor extends QT3TestSet { /** * nscons-001 - dynamic namespace constructor - variable content . */ @org.junit.Test public void nscons001() { final XQuery query = new XQuery( "\n" + " declare variable $s := \"http://saxon.sf.net/\"; \n" + " declare variable $xsl := \"http://www.w3.org/1999/XSL/Transform\"; \n" + " { namespace saxon {$s}, attribute a {23}, namespace xsl {$xsl} }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * nscons-002 - dynamic namespace constructor - variable name . */ @org.junit.Test public void nscons002() { final XQuery query = new XQuery( "\n" + " declare variable $s := \"saxon\"; \n" + " declare variable $xsl := \"xsl\"; \n" + " { namespace {$s} {\"http://saxon.sf.net/\"}, \n" + " attribute a {23}, \n" + " namespace {$xsl} {\"http://www.w3.org/1999/XSL/Transform\"} }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * nscons-003 - dynamic namespace constructor - default namespace . */ @org.junit.Test public void nscons003() { final XQuery query = new XQuery( "\n" + " declare variable $s := \"saxon\"; \n" + " declare variable $xsl := \"xsl\"; \n" + " { \n" + " namespace {\"\"} {\"http://saxon.sf.net/\"}, \n" + " attribute a {23}, \n" + " namespace {$xsl} {\"http://www.w3.org/1999/XSL/Transform\"}, } \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * nscons-004 - dynamic namespace constructor - xml namespace . */ @org.junit.Test public void nscons004() { final XQuery query = new XQuery( "\n" + " declare variable $s := \"saxon\"; \n" + " declare variable $xml := \"http://www.w3.org/XML/1998/namespace\"; \n" + " { \n" + " namespace xml {\"http://www.w3.org/XML/1998/namespace\"}, \n" + " attribute a {23}, } \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * nscons-005 - dynamic namespace constructor - with dynamic element constructor . */ @org.junit.Test public void nscons005() { final XQuery query = new XQuery( "\n" + " declare variable $s := \"http://saxon.sf.net/\"; \n" + " declare variable $xsl := \"http://www.w3.org/1999/XSL/Transform\"; \n" + " element {QName(\"http://saxon.sf.net/\", \"saxon:extension\")} { namespace saxon {$s}, attribute a {23}, namespace xsl {$xsl}, element f {42} }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("42", false) ); } /** * nscons-006 - dynamic namespace constructor - duplicates are OK . */ @org.junit.Test public void nscons006() { final XQuery query = new XQuery( "\n" + " declare variable $s := \"http://saxon.sf.net/\"; \n" + " declare variable $xsl := \"http://www.w3.org/1999/XSL/Transform\"; \n" + " element {QName(\"http://saxon.sf.net/\", \"saxon:extension\")} \n" + " { namespace saxon {$s}, attribute a {23}, namespace xsl {$xsl}, namespace saxon {$s}, element f {42} }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("42", false) ); } /** * nscons-007 - dynamic namespace constructor - error, misuse of xmlns . */ @org.junit.Test public void nscons007() { final XQuery query = new XQuery( "\n" + " declare variable $s := \"http://saxon.sf.net/\"; \n" + " declare variable $xsl := \"http://www.w3.org/1999/XSL/Transform\"; \n" + " declare variable $xmlns := \"xmlns\"; \n" + " { namespace saxon {$s}, attribute a {23}, namespace xsl {$xsl}, namespace xmlns {$s}, element f {42} }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0101") ); } /** * nscons-008 - dynamic namespace constructor - error, misuse of xml . */ @org.junit.Test public void nscons008() { final XQuery query = new XQuery( "\n" + " declare variable $s := \"http://saxon.sf.net/\"; \n" + " declare variable $xsl := \"http://www.w3.org/1999/XSL/Transform\"; \n" + " declare variable $xmlns := \"xml\"; \n" + " { namespace saxon {$s}, attribute a {23}, namespace xsl {$xsl}, namespace {$xmlns} {$s}, element f {42} }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0101") ); } /** * nscons-009 - dynamic namespace constructor - error, two bindings of same prefix . */ @org.junit.Test public void nscons009() { final XQuery query = new XQuery( "\n" + " declare variable $p1 := \"http://example.com/one\"; \n" + " declare variable $p2 := \"http://example.com/two\"; \n" + " { namespace p {$p1}, namespace p {$p2}, element f {42} }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0102") ); } /** * nscons-010 - dynamic namespace constructor - requires renaming of attribute node creates an arbitrary prefix for the attribute, so this test is designed to remove the arbitrariness . */ @org.junit.Test public void nscons010() { final XQuery query = new XQuery( "\n" + " declare variable $p1 := \"http://example.com/one\"; \n" + " declare variable $p2 := \"http://example.com/two\"; \n" + " declare variable $r := { namespace p {$p1}, attribute {QName($p2, \"p:att\")} {93.7}, element f {42} }; \n" + " { exists($r/@*:att[prefix-from-QName(node-name(.))!='p']), exists(in-scope-prefixes($r)[.='p']) }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("true true", false) ); } /** * nscons-010 - dynamic namespace constructor - requires renaming of element node creates an arbitrary prefix * for the attribute, so this test is designed to remove the arbitrariness . */ @org.junit.Test public void nscons011() { final XQuery query = new XQuery( "\n" + " declare variable $p1 := \"http://example.com/one\"; \n" + " declare variable $p2 := \"http://example.com/two\"; \n" + " declare variable $r := element {QName($p2, 'p:e')} { namespace p {$p1}, element f {42} }; \n" + " { exists($r[prefix-from-QName(node-name(.))!='p']), exists(in-scope-prefixes($r)[.='p']) }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("true true", false) ); } /** * nscons-012 - dynamic namespace constructor - show some properties of the namespace node . */ @org.junit.Test public void nscons012() { final XQuery query = new XQuery( "\n" + " declare variable $p1 := \"http://example.com/one\"; \n" + " declare variable $p2 := \"http://example.com/two\"; \n" + " declare function local:f($ns as namespace-node()) as element() { \n" + " \n" + " }; \n" + " { \n" + " local:f(namespace p {\"http://example.com/one\"}), \n" + " local:f(namespace {\"\"} {\"http://example.com/two\"}) }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * nscons-013 - dynamic namespace constructor - atomization of prefix expression. */ @org.junit.Test public void nscons013() { final XQuery query = new XQuery( "\n" + " let $pre := z,\n" + " $uri := \"http://www.zorba-xquery.com/\"\n" + " return\n" + " { namespace { $pre } { $uri } }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * nscons-014 - dynamic namespace constructor - prefix from string. */ @org.junit.Test public void nscons014() { final XQuery query = new XQuery( "\n" + " let $pre := \"z\",\n" + " $uri := \"http://www.zorba-xquery.com/\"\n" + " return\n" + " { namespace { $pre } { $uri } }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * nscons-015 - dynamic namespace constructor - prefix expression is empty. */ @org.junit.Test public void nscons015() { final XQuery query = new XQuery( "\n" + " declare namespace z=\"http://www.zorba-xquery.com/\";\n" + " { namespace { /* } { \"http://www.w3.org/\" } }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * nscons-016 - dynamic namespace constructor - untypedAtomic prefix expression can not be cast to ncname. */ @org.junit.Test public void nscons016() { final XQuery query = new XQuery( "\n" + " let $pre := z:z,\n" + " $uri := \"http://www.zorba-xquery.com/\"\n" + " return\n" + " { namespace { $pre } { $uri } }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0074") ); } /** * nscons-017 - dynamic namespace constructor - string prefix expression can not be cast to ncname. */ @org.junit.Test public void nscons017() { final XQuery query = new XQuery( "\n" + " let $pre := \"z z\",\n" + " $uri := \"http://www.zorba-xquery.com/\"\n" + " return\n" + " { namespace { $pre } { $uri } }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0074") ); } /** * nscons-018 - dynamic namespace constructor - prefix expression is not string/untypedAtomic. */ @org.junit.Test public void nscons018() { final XQuery query = new XQuery( "\n" + " let $pre := 1,\n" + " $uri := \"http://www.zorba-xquery.com/\"\n" + " return\n" + " { namespace { $pre } { $uri } }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * nscons-019 - dynamic namespace constructor - bind a prefix other than xml to the namespace URI http://www.w3.org/XML/1998/namespace. */ @org.junit.Test public void nscons019() { final XQuery query = new XQuery( "\n" + " let $uri := \"http://www.w3.org/XML/1998/namespace\"\n" + " return\n" + " { namespace x { $uri } }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0101") ); } /** * nscons-020 - dynamic namespace constructor - bind a prefix to the namespace URI http://www.w3.org/2000/xmlns/. */ @org.junit.Test public void nscons020() { final XQuery query = new XQuery( "\n" + " let $uri := \"http://www.w3.org/2000/xmlns/\"\n" + " return\n" + " { namespace x { $uri } }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0101") ); } /** * nscons-021 - dynamic namespace constructor - bind any prefix to a zero-length namespace URI. */ @org.junit.Test public void nscons021() { final XQuery query = new XQuery( "\n" + " { namespace x { \"\" } }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0101") ); } /** * nscons-022 - dynamic namespace constructor - added to the element's in-scope namespaces. */ @org.junit.Test public void nscons022() { final XQuery query = new XQuery( "\n" + " let $elem := { namespace z { \"http://www.zorba-xquery.com/\" } }\n" + " return\n" + " element { resolve-QName(\"z:f\", $elem) } {}\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * nscons-023 - dynamic namespace constructor - no effect on the statically known namespaces. */ @org.junit.Test public void nscons023() { final XQuery query = new XQuery( "\n" + " { namespace z { \"http://www.zorba-xquery.com/\" } }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0081") ); } /** * nscons-024 - dynamic namespace constructor - no effect on the statically known namespaces. */ @org.junit.Test public void nscons024() { final XQuery query = new XQuery( "\n" + " { namespace z { \"http://www.zorba-xquery.com/\" }, element z:e {} }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0081") ); } /** * nscons-025 - dynamic namespace constructor - no effect on the statically known namespaces. */ @org.junit.Test public void nscons025() { final XQuery query = new XQuery( "\n" + " element e { attribute z:a {}, namespace z { \"http://www.zorba-xquery.com/\" } }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0081") ); } /** * nscons-026 - dynamic namespace constructor - no effect on the statically known namespaces. */ @org.junit.Test public void nscons026() { final XQuery query = new XQuery( "\n" + " { namespace z { \"http://www.zorba-xquery.com/\" }, element { xs:QName(\"z:e\") } { } }\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FONS0004") ); } /** * nscons-027 - dynamic namespace constructor - return namespace node from module. */ @org.junit.Test public void nscons027() { final XQuery query = new XQuery( "\n" + " import module namespace mod1=\"http://www.w3.org/TestModules/cnc-module\";\n" + " let $elem := { mod1:one() }\n" + " return\n" + " element { resolve-QName(\"z:f\", $elem) } {}\n" + " ", ctx); try { query.addModule("http://www.w3.org/TestModules/cnc-module", file("prod/CompNamespaceConstructor/cnc-module.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * nscons-028 - dynamic namespace constructor - node equality and modules. */ @org.junit.Test public void nscons028() { final XQuery query = new XQuery( "\n" + " import module namespace mod1=\"http://www.w3.org/TestModules/cnc-module\";\n" + " let $ns := mod1:one()\n" + " return ($ns is $ns, $ns is mod1:one())\n" + " ", ctx); try { query.addModule("http://www.w3.org/TestModules/cnc-module", file("prod/CompNamespaceConstructor/cnc-module.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true false") ); } /** * nscons-029 - dynamic namespace constructor - serialization of namespace node. */ @org.junit.Test public void nscons029() { final XQuery query = new XQuery( "\n" + " serialize( namespace z { \"http://www.zorba-xquery.com/\" } )\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("SENR0001") ); } /** * nscons-030 - dynamic namespace constructor - serialization of element with namespace node. */ @org.junit.Test public void nscons030() { final XQuery query = new XQuery( "\n" + " serialize( element e { namespace z { \"http://www.zorba-xquery.com/\" } } )\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertQuery("contains($result,'xmlns:z')") && assertQuery("contains($result,'\"http://www.zorba-xquery.com/\"')") ) ); } /** * nscons-031 - dynamic namespace constructor - copy namespaces mode. */ @org.junit.Test public void nscons031() { final XQuery query = new XQuery( "\n" + " declare copy-namespaces preserve, inherit;\n" + " let $nested := \n" + " element outer { \n" + " namespace out { \"http://out.zorba-xquery.com/\" },\n" + " element inner {\n" + " namespace in { \"http://in.zorba-xquery.com/\" }\n" + " } \n" + " },\n" + " $elem := element e { namespace new { \"http://new.zorba-xquery.com/\" }, $nested }\n" + " return\n" + " $elem/outer/inner\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * nscons-032 - dynamic namespace constructor - copy namespaces mode. */ @org.junit.Test public void nscons032() { final XQuery query = new XQuery( "\n" + " declare copy-namespaces preserve, no-inherit;\n" + " let $nested := \n" + " element outer { \n" + " namespace out { \"http://out.zorba-xquery.com/\" },\n" + " element inner { namespace in { \"http://in.zorba-xquery.com/\" } } \n" + " },\n" + " $elem := element e { namespace new { \"http://new.zorba-xquery.com/\" }, $nested }\n" + " return\n" + " $elem/outer/inner\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * nscons-033 - dynamic namespace constructor - copy namespaces mode. */ @org.junit.Test public void nscons033() { final XQuery query = new XQuery( "\n" + " declare copy-namespaces no-preserve, inherit;\n" + " let $nested := \n" + " element outer { \n" + " namespace out { \"http://out.zorba-xquery.com/\" },\n" + " element inner { namespace in { \"http://in.zorba-xquery.com/\" } } \n" + " },\n" + " $elem := element e { namespace new { \"http://new.zorba-xquery.com/\" }, $nested }\n" + " return\n" + " $elem/outer/inner\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * nscons-034 - dynamic namespace constructor - copy namespaces mode. */ @org.junit.Test public void nscons034() { final XQuery query = new XQuery( "\n" + " declare copy-namespaces no-preserve, no-inherit;\n" + " let $nested := \n" + " element outer { \n" + " namespace out { \"http://out.zorba-xquery.com/\" },\n" + " element inner { namespace in { \"http://in.zorba-xquery.com/\" } } \n" + " },\n" + " $elem := element e { namespace new { \"http://new.zorba-xquery.com/\" }, $nested }\n" + " return\n" + " $elem/outer/inner\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * nscons-035 - dynamic namespace constructor - copy namespaces mode and modules. */ @org.junit.Test public void nscons035() { final XQuery query = new XQuery( "\n" + " import module namespace mod1=\"http://www.w3.org/TestModules/cnc-module\";\n" + " declare copy-namespaces preserve, inherit;\n" + " let $nested := mod1:nested(),\n" + " $elem := element e { namespace new { \"http://new.zorba-xquery.com/\" }, $nested }\n" + " return\n" + " $elem/outer/inner\n" + " ", ctx); try { query.addModule("http://www.w3.org/TestModules/cnc-module", file("prod/CompNamespaceConstructor/cnc-module.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * nscons-036 - dynamic namespace constructor - copy namespaces mode and modules. */ @org.junit.Test public void nscons036() { final XQuery query = new XQuery( "\n" + " import module namespace mod1=\"http://www.w3.org/TestModules/cnc-module\";\n" + " declare copy-namespaces preserve, no-inherit;\n" + " let $nested := mod1:nested(),\n" + " $elem := element e { namespace new { \"http://new.zorba-xquery.com/\" }, $nested }\n" + " return\n" + " $elem/outer/inner\n" + " ", ctx); try { query.addModule("http://www.w3.org/TestModules/cnc-module", file("prod/CompNamespaceConstructor/cnc-module.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * nscons-037 - dynamic namespace constructor - copy namespaces mode and modules. */ @org.junit.Test public void nscons037() { final XQuery query = new XQuery( "\n" + " import module namespace mod1=\"http://www.w3.org/TestModules/cnc-module\";\n" + " declare copy-namespaces no-preserve, inherit;\n" + " let $nested := mod1:nested(),\n" + " $elem := element e { namespace new { \"http://new.zorba-xquery.com/\" }, $nested }\n" + " return\n" + " $elem/outer/inner\n" + " ", ctx); try { query.addModule("http://www.w3.org/TestModules/cnc-module", file("prod/CompNamespaceConstructor/cnc-module.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * nscons-038 - dynamic namespace constructor - copy namespaces mode and modules. */ @org.junit.Test public void nscons038() { final XQuery query = new XQuery( "\n" + " import module namespace mod1=\"http://www.w3.org/TestModules/cnc-module\";\n" + " declare copy-namespaces no-preserve, no-inherit;\n" + " let $nested := mod1:nested(),\n" + " $elem := element e { namespace new { \"http://new.zorba-xquery.com/\" }, $nested }\n" + " return\n" + " $elem/outer/inner\n" + " ", ctx); try { query.addModule("http://www.w3.org/TestModules/cnc-module", file("prod/CompNamespaceConstructor/cnc-module.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * nscons-039 - dynamic namespace constructor - recursively inherit namespaces. */ @org.junit.Test public void nscons039() { final XQuery query = new XQuery( "\n" + " declare copy-namespaces preserve, inherit;\n" + " \n" + " declare function local:rec-add($level as xs:integer) as element() {\n" + " if ($level > 0) then\n" + " element { concat(\"e\", $level) } { \n" + " namespace { concat(\"pre\", $level) } { concat(\"uri\", $level) },\n" + " local:rec-add($level - 1)\n" + " }\n" + " else\n" + " element e0 {} \n" + " };\n" + "\n" + " local:rec-add(2)/e1/e0\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdCompPIConstructor.java000066400000000000000000000565531222453003200315500ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the CompPIConstructor (Computed Processing Instruction Constructor) production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdCompPIConstructor extends QT3TestSet { /** * empty computed name . */ @org.junit.Test public void constrComppiCompname1() { final XQuery query = new XQuery( "processing-instruction {()} {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * string as name . */ @org.junit.Test public void constrComppiCompname10() { final XQuery query = new XQuery( "processing-instruction {'pi'} {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * string as name . */ @org.junit.Test public void constrComppiCompname11() { final XQuery query = new XQuery( "processing-instruction {'pi', ()} {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * string as name . */ @org.junit.Test public void constrComppiCompname12() { final XQuery query = new XQuery( "processing-instruction {(), 'pi'} {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * string with prefix as name . */ @org.junit.Test public void constrComppiCompname13() { final XQuery query = new XQuery( "{processing-instruction {'foo:attr'} {}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0041") ); } /** * untyped atomic as name . */ @org.junit.Test public void constrComppiCompname15() { final XQuery query = new XQuery( "processing-instruction {xs:untypedAtomic('pi')} {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * untyped atomic with prefix as name . */ @org.junit.Test public void constrComppiCompname16() { final XQuery query = new XQuery( "{processing-instruction {xs:untypedAtomic('foo:pi')} {'text'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0041") ); } /** * non-ncname string as name . */ @org.junit.Test public void constrComppiCompname18() { final XQuery query = new XQuery( "processing-instruction {'p i'} {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0041") ); } /** * non-ncname untyped atomic as name . */ @org.junit.Test public void constrComppiCompname19() { final XQuery query = new XQuery( "processing-instruction {xs:untypedAtomic('p i')} {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0041") ); } /** * two strings as name . */ @org.junit.Test public void constrComppiCompname2() { final XQuery query = new XQuery( "processing-instruction {'one', 'two'} {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * two untypedAtomic values as name . */ @org.junit.Test public void constrComppiCompname3() { final XQuery query = new XQuery( "processing-instruction {xs:untypedAtomic('one'), xs:untypedAtomic('two')} {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * content of two nodes as name . */ @org.junit.Test public void constrComppiCompname4() { final XQuery query = new XQuery( "processing-instruction {//a} {'text'}", ctx); try { query.context(node(file("prod/CompAttrConstructor/DupNode.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * two numeric values as name . */ @org.junit.Test public void constrComppiCompname5() { final XQuery query = new XQuery( "processing-instruction {1,2} {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * numeric value as name . */ @org.junit.Test public void constrComppiCompname6() { final XQuery query = new XQuery( "processing-instruction {123} {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * dataTime value as name . */ @org.junit.Test public void constrComppiCompname7() { final XQuery query = new XQuery( "processing-instruction {xs:dateTime(\"1999-05-31T13:20:00\")} {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * typed value of PI . */ @org.junit.Test public void constrComppiData1() { final XQuery query = new XQuery( "fn:data(processing-instruction pi {'a', element a {}, 'b'})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b") ); } /** * strip document nodes . */ @org.junit.Test public void constrComppiDoc1() { final XQuery query = new XQuery( "processing-instruction pi {., .}", ctx); try { query.context(node(file("prod/CompAttrConstructor/DupNode.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Empty PI node . */ @org.junit.Test public void constrComppiEmpty1() { final XQuery query = new XQuery( "processing-instruction pi {()}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Empty PI node . */ @org.junit.Test public void constrComppiEmpty2() { final XQuery query = new XQuery( "processing-instruction pi {''}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * enclosed expression in computed processing-instruction node - atomic values . */ @org.junit.Test public void constrComppiEnclexpr1() { final XQuery query = new XQuery( "processing-instruction pi {1,'string',3.14,xs:float('1.2345e-2'),xs:dateTime('2002-04-02T12:00:00-01:00')}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * enclosed expression in computed processing-instruction node - nodes . */ @org.junit.Test public void constrComppiEnclexpr2() { final XQuery query = new XQuery( "processing-instruction pi {123, ()/@attr, (789)/text()}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * enclosed expression in computed processing-instruction node - empty string . */ @org.junit.Test public void constrComppiEnclexpr3() { final XQuery query = new XQuery( "processing-instruction pi {1,'',2}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * enclosed expression in computed processing-instruction node - empty node . */ @org.junit.Test public void constrComppiEnclexpr4() { final XQuery query = new XQuery( "processing-instruction pi {1,,2}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * enclosed expression in computed processing-instruction node - nodes . */ @org.junit.Test public void constrComppiEnclexpr5() { final XQuery query = new XQuery( "processing-instruction pi {/root}", ctx); try { query.context(node(file("prod/CompAttrConstructor/DupNode.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * invalid PI content . */ @org.junit.Test public void constrComppiInvalid1() { final XQuery query = new XQuery( "processing-instruction pi {'?>'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0026") ); } /** * invalid PI content . */ @org.junit.Test public void constrComppiInvalid2() { final XQuery query = new XQuery( "processing-instruction pi {'?>text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0026") ); } /** * invalid PI content . */ @org.junit.Test public void constrComppiInvalid3() { final XQuery query = new XQuery( "processing-instruction pi {'text?>text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0026") ); } /** * NCName for computed PI constructor . */ @org.junit.Test public void constrComppiName1() { final XQuery query = new XQuery( "processing-instruction pi {'text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * QName for computed PI constructor . */ @org.junit.Test public void constrComppiName2() { final XQuery query = new XQuery( "{processing-instruction foo:pi {'text'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * invalid PI target xml . */ @org.junit.Test public void constrComppiNamexml1() { final XQuery query = new XQuery( "processing-instruction xml {'pi'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0064") ); } /** * invalid PI target xml . */ @org.junit.Test public void constrComppiNamexml2() { final XQuery query = new XQuery( "processing-instruction XmL {'pi'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0064") ); } /** * invalid PI target xml . */ @org.junit.Test public void constrComppiNamexml3() { final XQuery query = new XQuery( "processing-instruction {'xml'} {'pi'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0064") ); } /** * invalid PI target xml . */ @org.junit.Test public void constrComppiNamexml4() { final XQuery query = new XQuery( "processing-instruction {'XmL'} {'pi'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0064") ); } /** * empty parent . */ @org.junit.Test public void constrComppiParent1() { final XQuery query = new XQuery( "count((processing-instruction pi {()})/..)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * leading whitespace in PI content . */ @org.junit.Test public void constrComppiSpace1() { final XQuery query = new XQuery( "processing-instruction pi {' text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * leading whitespace in PI content . */ @org.junit.Test public void constrComppiSpace2() { final XQuery query = new XQuery( "processing-instruction pi {' text'}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * leading whitespace in PI content . */ @org.junit.Test public void constrComppiSpace3() { final XQuery query = new XQuery( "string-to-codepoints(processing-instruction pi {' text'})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "116 101 120 116") ); } /** * leading whitespace in PI content . */ @org.junit.Test public void constrComppiSpace4() { final XQuery query = new XQuery( "string-to-codepoints(processing-instruction pi {' text'})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "116 101 120 116") ); } /** * string value of PI . */ @org.junit.Test public void constrComppiString1() { final XQuery query = new XQuery( "fn:string(processing-instruction pi {'a', element a {}, 'b'})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b") ); } /** * The name can't be specified as a string literal. . */ @org.junit.Test public void k2ComputeConPI1() { final XQuery query = new XQuery( "processing-instruction \"name\" {\"content\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Data that only is whitespace. . */ @org.junit.Test public void k2ComputeConPI10() { final XQuery query = new XQuery( "processing-instruction name {\" \"} eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test the atomized type. . */ @org.junit.Test public void k2ComputeConPI11() { final XQuery query = new XQuery( "data(processing-instruction name {\"content\"}) instance of xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An invalid name for a processing-instruction. . */ @org.junit.Test public void k2ComputeConPI2() { final XQuery query = new XQuery( "processing-instruction {\"xml\"} {\"content\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0064") ); } /** * An invalid name for a processing-instruction. . */ @org.junit.Test public void k2ComputeConPI3() { final XQuery query = new XQuery( "processing-instruction {\" xmL \"} {\"content\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0064") ); } /** * Extract the name from a computed PI. . */ @org.junit.Test public void k2ComputeConPI4() { final XQuery query = new XQuery( "local-name(processing-instruction {\" name \"} {\"content\"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "name") ); } /** * Extract the name from a computed PI. . */ @org.junit.Test public void k2ComputeConPI5() { final XQuery query = new XQuery( "local-name(processing-instruction {\" XmLnaMe \"} {\"content\"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "XmLnaMe") ); } /** * Invalid target name. . */ @org.junit.Test public void k2ComputeConPI6() { final XQuery query = new XQuery( "processing-instruction {\"1.das \"} {\"content\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0041") ); } /** * PI data containing '?>'. . */ @org.junit.Test public void k2ComputeConPI7() { final XQuery query = new XQuery( "processing-instruction {\"thename\"} {\"asdas?>\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0026") ); } /** * Extract the data from a computed PI. . */ @org.junit.Test public void k2ComputeConPI8() { final XQuery query = new XQuery( "string(processing-instruction {\"thename\"} {\"asdas? >\"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "asdas? >") ); } /** * Extract (possible parser-confusing) PI data. . */ @org.junit.Test public void k2ComputeConPI9() { final XQuery query = new XQuery( "string(processing-instruction {\"thename\"} {\"content {1+ } {\"})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "content {1+ } {") ); } /** * test detection of '?>' in computed comment . */ @org.junit.Test public void cbclConstrComppi001() { final XQuery query = new XQuery( "\n" + " \t { processing-instruction { 'pi' } { ?> } } \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0026") ); } /** * test detection of '?>' in computed comment . */ @org.junit.Test public void cbclConstrComppi002() { final XQuery query = new XQuery( "\n" + " \tdeclare function local:tag($arg) as element() { element { 'tag' } { $arg } }; \n" + " \t { processing-instruction { 'pi' } { \"content\", local:tag('?>') } } \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0026") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdCompTextConstructor.java000066400000000000000000000364151222453003200321570ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the CompTextConstructor (text node constructor) production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdCompTextConstructor extends QT3TestSet { /** * merge adjacent text nodes . */ @org.junit.Test public void constrTextAdjtext1() { final XQuery query = new XQuery( "count({text {'te'}, text {'xt'}}/text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * merge adjacent text nodes . */ @org.junit.Test public void constrTextAdjtext2() { final XQuery query = new XQuery( "count(document {text {'te'}, text {'xt'}}/text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * count text nodes . */ @org.junit.Test public void constrTextCount1() { final XQuery query = new XQuery( "count(text {''})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * count text nodes . */ @org.junit.Test public void constrTextCount2() { final XQuery query = new XQuery( "count(text {()})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * count text nodes . */ @org.junit.Test public void constrTextCount3() { final XQuery query = new XQuery( "count(element elem {text {''}}/text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * count text nodes . */ @org.junit.Test public void constrTextCount4() { final XQuery query = new XQuery( "count(document {text {''}}/text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * count text nodes . */ @org.junit.Test public void constrTextCount5() { final XQuery query = new XQuery( "count({text {''}}{text {''}}{text {''}}/text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * count text nodes . */ @org.junit.Test public void constrTextCount6() { final XQuery query = new XQuery( "count(document {text {''},,text {''},,text {''}}/text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * typed value of text node . */ @org.junit.Test public void constrTextData1() { final XQuery query = new XQuery( "fn:data(text {'a', element a {}, 'b'})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b") ); } /** * strip document nodes . */ @org.junit.Test public void constrTextDoc1() { final XQuery query = new XQuery( "text {., .}", ctx); try { query.context(node(file("prod/CompAttrConstructor/DupNode.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "texttext texttext") ); } /** * enclosed expression in text node - atomic values . */ @org.junit.Test public void constrTextEnclexpr1() { final XQuery query = new XQuery( "text {1,'string',3.14,xs:float('1.2345e-2'),xs:dateTime('2002-04-02T12:00:00-01:00')}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 string 3.14 0.012345 2002-04-02T12:00:00-01:00") ); } /** * enclosed expression in text node - nodes . */ @org.junit.Test public void constrTextEnclexpr2() { final XQuery query = new XQuery( "text {123, ()/@attr, (789)/text()}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "123 456 789") ); } /** * enclosed expression in text node - empty string . */ @org.junit.Test public void constrTextEnclexpr3() { final XQuery query = new XQuery( "text {1,'',2}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2") ); } /** * enclosed expression in text node - empty node . */ @org.junit.Test public void constrTextEnclexpr4() { final XQuery query = new XQuery( "text {1,,2}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2") ); } /** * enclosed expression in text node - nodes . */ @org.junit.Test public void constrTextEnclexpr5() { final XQuery query = new XQuery( "text {/root}", ctx); try { query.context(node(file("prod/CompAttrConstructor/DupNode.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "texttext") ); } /** * nested text node constructor . */ @org.junit.Test public void constrTextNested1() { final XQuery query = new XQuery( "text {text {'one', text {'two'}}, 'three', text {'four'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "one two three four") ); } /** * nested text nodes in element constructor . */ @org.junit.Test public void constrTextNested2() { final XQuery query = new XQuery( "{text {'one'}}{text {'two'}}{text {'three'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("onetwothree", false) ); } /** * nested text nodes in element constructor . */ @org.junit.Test public void constrTextNested3() { final XQuery query = new XQuery( "document {text {'one'}, , text {'two'}, , text {'three'}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("onetwothree", false) ); } /** * empty parent . */ @org.junit.Test public void constrTextParent1() { final XQuery query = new XQuery( "count((text {'text'})/..)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * string value of text node . */ @org.junit.Test public void constrTextString1() { final XQuery query = new XQuery( "fn:string(text {'a', element a {}, 'b'})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "a b") ); } /** * Text constructors cannot specify a name. . */ @org.junit.Test public void k2ConText1() { final XQuery query = new XQuery( "text {\"name\"} {\"content\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * The end of content in a CDATA section may end with many ']'(#4). . */ @org.junit.Test public void k2ConText10() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("]]]]", false) ); } /** * A CDATA section ending incorrectly. . */ @org.junit.Test public void k2ConText11() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Ensure that an empty text node between two atomic values are serialized correctly. . */ @org.junit.Test public void k2ConText14() { final XQuery query = new XQuery( "{1}{text{\"\"}}{2}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("12", false) ); } /** * Ensure that an empty text node between two atomic values are serialized correctly(#2). . */ @org.junit.Test public void k2ConText15() { final XQuery query = new XQuery( "string({1}{text{\"\"}}{2})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "12") ); } /** * Text constructors cannot specify a name(#2). . */ @org.junit.Test public void k2ConText2() { final XQuery query = new XQuery( "text name {\"content\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * An empty text node is nevertheless a text node, not the empty sequence. . */ @org.junit.Test public void k2ConText3() { final XQuery query = new XQuery( "string(text {\"\"}) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Construct from an empty sequence. . */ @org.junit.Test public void k2ConText4() { final XQuery query = new XQuery( "{text{()}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * The enclosed expression isn't optional. . */ @org.junit.Test public void k2ConText5() { final XQuery query = new XQuery( "text{}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Test the atomized type. . */ @org.junit.Test public void k2ConText6() { final XQuery query = new XQuery( "data(text {\"content\"}) instance of xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The end of content in a CDATA section may end with ']'. . */ @org.junit.Test public void k2ConText7() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("content]", false) ); } /** * The end of content in a CDATA section may end with many ']'(#2). . */ @org.junit.Test public void k2ConText8() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("content]]]]", false) ); } /** * The end of content in a CDATA section may end with ']'(#3). . */ @org.junit.Test public void k2ConText9() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("]", false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdConstructionDecl.java000066400000000000000000000413111222453003200314170ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the ConstructionDecl production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdConstructionDecl extends QT3TestSet { /** * Test that 'declare construction' with the preserve keyword is parsed properly. . */ @org.junit.Test public void kConstructionProlog1() { final XQuery query = new XQuery( "(::)declare(::)construction(::)preserve(::);(::)1(::)eq(::)1(::)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * 'declare construction Preserve' is syntactically invalid. . */ @org.junit.Test public void kConstructionProlog2() { final XQuery query = new XQuery( "declare(::)construction(::)Preserve;(::)1(::)eq(::)1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Test that 'declare construction' with the strip keyword is parsed properly. . */ @org.junit.Test public void kConstructionProlog3() { final XQuery query = new XQuery( "declare(::)construction(::)strip;(::)1(::)eq(::)1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Two 'declare construction' expressions is invalid. . */ @org.junit.Test public void kConstructionProlog4() { final XQuery query = new XQuery( "declare(::)construction(::)strip; declare(::)construction(::)strip;1(::)eq(::)1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0067") ); } /** * Ensure the 'construction' keyword is parsed correctly. . */ @org.junit.Test public void k2ConstructionProlog1() { final XQuery query = new XQuery( "construction gt construction", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Evaluation of a prolog with two construction declarations. . */ @org.junit.Test public void constprolog1() { final XQuery query = new XQuery( "\n" + " declare construction strip; \n" + " declare construction strip; \n" + " \"abc\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0067") ); } /** * Evaluation of a prolog with construction declaration set to "preserve" for a directly constructed element and used as argument to fn:not. . */ @org.junit.Test public void constprolog10() { final XQuery query = new XQuery( "\n" + " declare construction preserve; \n" + " let $anElement := some content \n" + " return fn:not($anElement instance of element(*,xs:anyType))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of a prolog with construction declaration set to "preserve" for a computed element and used as argument to fn:not. . */ @org.junit.Test public void constprolog11() { final XQuery query = new XQuery( "\n" + " declare construction preserve; \n" + " let $anElement := element someElement{\"some content\"} \n" + " return fn:not($anElement instance of element(*,xs:anyType))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of a prolog with construction declaration set to "strip" for a directly constructed element (inside of instance expression) and used as argument to fn:not() . . */ @org.junit.Test public void constprolog12() { final XQuery query = new XQuery( "\n" + " declare construction strip; \n" + " fn:not(some content instance of element(*,xs:untyped))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of a prolog with construction declaration set to "preserve" for a computed element (inside of instance of expression) and used as argument to fn:not. . */ @org.junit.Test public void constprolog13() { final XQuery query = new XQuery( "\n" + " declare construction preserve; \n" + " fn:not(element someElement{\"some content\"} instance of element(*,xs:anyType))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of a prolog with construction declaration set to "strip" for direct and used in boolean expression ("and" and "fn:true()") . */ @org.junit.Test public void constprolog14() { final XQuery query = new XQuery( "\n" + " declare construction strip; \n" + " let $var := Some content \n" + " return ($var instance of element(*,xs:untyped)) and fn:true()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of a prolog with construction declaration set to "strip" for computed element and used in boolean expression ("and" and "fn:true()") . */ @org.junit.Test public void constprolog15() { final XQuery query = new XQuery( "\n" + " declare construction strip; \n" + " let $anElement := element someElement{\"some content\"} \n" + " return ($anElement instance of element(*,xs:untyped)) and fn:true()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of a prolog with construction declaration set to "preserve" for direct element and used in boolean expression ("and" and "fn:true()") . */ @org.junit.Test public void constprolog16() { final XQuery query = new XQuery( "\n" + " declare construction preserve; \n" + " let $anElement := content \n" + " return ($anElement instance of element(*,xs:anyType)) and fn:true()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of a prolog with construction declaration set to "preserve" for computed element and used in boolean expression ("and" and "fn:true()") . */ @org.junit.Test public void constprolog17() { final XQuery query = new XQuery( "\n" + " declare construction preserve; \n" + " let $anElement := element someElement{\"some content\"} \n" + " return ($anElement instance of element(*,xs:anyType)) and fn:true()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of a prolog with construction declaration set to "strip" for direct and used in boolean expression ("or" and "fn:false()") . */ @org.junit.Test public void constprolog18() { final XQuery query = new XQuery( "\n" + " declare construction strip; \n" + " let $var := Some content \n" + " return ($var instance of element(*,xs:untyped)) or fn:false()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of a prolog with construction declaration set to "strip" for computed element and used in boolean expression ("or" and "fn:false()") . */ @org.junit.Test public void constprolog19() { final XQuery query = new XQuery( "\n" + " declare construction strip; \n" + " let $anElement := element someElement{\"some content\"} \n" + " return ($anElement instance of element(*,xs:untyped)) or fn:false()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of a prolog with construction declaration set to "strip" and used with directly construted element. . */ @org.junit.Test public void constprolog2() { final XQuery query = new XQuery( "\n" + " declare construction strip; \n" + " let $anElement := some content \n" + " return $anElement instance of element(*,xs:untyped)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of a prolog with construction declaration set to "preserve" for direct element and used in boolean expression ("or" and "fn:false()") . */ @org.junit.Test public void constprolog20() { final XQuery query = new XQuery( "\n" + " declare construction preserve; \n" + " let $anElement := content \n" + " return ($anElement instance of element(*,xs:anyType)) or fn:false()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of a prolog with construction declaration set to "preserve" for computed element and used in boolean expression ("or" and "fn:false()") . */ @org.junit.Test public void constprolog21() { final XQuery query = new XQuery( "\n" + " declare construction preserve; \n" + " let $anElement := element someElement{\"some content\"} \n" + " return ($anElement instance of element(*,xs:anyType)) or fn:false()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of a prolog with construction declaration set to "strip" and used with computed delement. . */ @org.junit.Test public void constprolog3() { final XQuery query = new XQuery( "\n" + " declare construction strip; \n" + " let $anElement := element anElement {\"someContent\"} \n" + " return $anElement instance of element(*,xs:untyped)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of a prolog with construction declaration set to "preserve" and used with directly construted element. . */ @org.junit.Test public void constprolog4() { final XQuery query = new XQuery( "\n" + " declare construction preserve; \n" + " let $anElement := some content \n" + " return $anElement instance of element(*,xs:anyType)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of a prolog with construction declaration set to "preserve" and used with computed delement. . */ @org.junit.Test public void constprolog5() { final XQuery query = new XQuery( "\n" + " declare construction strip; \n" + " let $anElement := element anElement {\"someContent\"} \n" + " return $anElement instance of element(*,xs:anyType)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of a prolog with construction declaration set to "strip" and used with directly construted element. Compare against wrong type . */ @org.junit.Test public void constprolog6() { final XQuery query = new XQuery( "\n" + " declare construction strip; \n" + " let $anElement := some content \n" + " return $anElement instance of element(*,xs:anyType)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of a prolog with construction declaration set to "strip" and used with computed element, it compares agaisnt "xs:anyType". . */ @org.junit.Test public void constprolog7() { final XQuery query = new XQuery( "\n" + " declare construction strip; \n" + " let $anElement := element anElement {\"someContent\"} \n" + " return $anElement instance of element(*,xs:anyType)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Evaluation of a prolog with construction declaration set to "strip" for a directly constructed element and used as argument to fn:not. . */ @org.junit.Test public void constprolog8() { final XQuery query = new XQuery( "\n" + " declare construction strip; \n" + " let $anElement := some content \n" + " return fn:not($anElement instance of element(*,xs:untyped))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Evaluation of a prolog with construction declaration set to "strip" for a computed element and used as argument to fn:not. . */ @org.junit.Test public void constprolog9() { final XQuery query = new XQuery( "\n" + " declare construction strip; \n" + " let $anElement := element someElement{\"some content\"} \n" + " return fn:not($anElement instance of element(*,xs:untyped))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdContextItemDecl.java000066400000000000000000000523711222453003200312000ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the prod-ContextItemDecl production introduced in XQuery 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdContextItemDecl extends QT3TestSet { /** * Forwards reference to context item. . */ @org.junit.Test public void contextDecl014() { final XQuery query = new XQuery( "\n" + " declare variable $x := . + 5;\n" + " declare context item := 17;\n" + " $x\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("22") ); } /** * It is a static error if the initializer of the context item depends on the context item. . */ @org.junit.Test public void contextDecl015() { final XQuery query = new XQuery( "\n" + " declare variable $y := /works/employee;\n" + " declare context item := $y[9];\n" + " declare variable $x external := if (./*) then fn:position() else 0;\n" + " ($x, $y)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0054") ); } /** * Context position in default value for external variable. . */ @org.junit.Test public void contextDecl016() { final XQuery query = new XQuery( "\n" + " declare variable $y := (1,2,3,4,5,6,7,8,9,10);\n" + " declare context item := $y[3];\n" + " declare variable $x external := fn:position();\n" + " $x\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Context last in default value for external variable. . */ @org.junit.Test public void contextDecl017() { final XQuery query = new XQuery( "\n" + " declare variable $y := 1,2,3,4,5,6,7,8,9,10;\n" + " declare context item := $y;\n" + " declare variable $x external := fn:last();\n" + " $x\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Context last in default value for context item. (Debatable!). */ @org.junit.Test public void contextDecl018() { final XQuery query = new XQuery( " declare context item := last() + 1; .", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("2") || error("XPDY0002") ) ); } /** * Context position in default value for context item. (Debatable!). */ @org.junit.Test public void contextDecl019() { final XQuery query = new XQuery( " declare context item := position() + 1; .", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("2") || error("XPDY0002") ) ); } /** * External context item has wrong type . */ @org.junit.Test public void contextDecl020() { final XQuery query = new XQuery( " declare context item as xs:integer external; . ", ctx); try { query.context(new XQuery("'London'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Internal context item has wrong type . */ @org.junit.Test public void contextDecl021() { final XQuery query = new XQuery( " declare context item as xs:integer := 'London'; . ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Default context item has wrong type; error is optional? . */ @org.junit.Test public void contextDecl022() { final XQuery query = new XQuery( " declare context item as xs:string := 2; . ", ctx); try { query.context(new XQuery("'London'", ctx).value()); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || assertEq("'London'") ) ); } /** * Context item type must be an item type (no occurrence indicator). */ @org.junit.Test public void contextDecl023() { final XQuery query = new XQuery( "\n" + " declare context item as xs:integer+ := (1 to 17)[position() = 5];\n" + " .\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Context item bound to an atomic value . */ @org.junit.Test public void contextDecl028() { final XQuery query = new XQuery( " declare context item := 3; . + 4 ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("7") ); } /** * Context item bound to a node . */ @org.junit.Test public void contextDecl029() { final XQuery query = new XQuery( "\n" + " declare context item := bananas;\n" + " string-length()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("7") ); } /** * Context item bound to a node . */ @org.junit.Test public void contextDecl030() { final XQuery query = new XQuery( "\n" + " declare context item := bananas;\n" + " string-length(@id)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("6") ); } /** * Context item bound to a function item . */ @org.junit.Test public void contextDecl031() { final XQuery query = new XQuery( "\n" + " declare context item := contains(?, \"e\");\n" + " .(\"raspberry\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Context item bound to an empty sequence. Spec unclear, see bug 19257. */ @org.junit.Test public void contextDecl032() { final XQuery query = new XQuery( "declare context item := (1 to 17)[20]; .", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Context item bound to a non-singleton sequence. Spec unclear, see bug 19257. */ @org.junit.Test public void contextDecl033() { final XQuery query = new XQuery( "declare context item := (1 to 17)[position() gt 5]; .", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Context item successfully matches its type. */ @org.junit.Test public void contextDecl034() { final XQuery query = new XQuery( "declare context item as xs:integer := (1 to 17)[position() = 5]; .", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** * Context item successfully matches its type. */ @org.junit.Test public void contextDecl035() { final XQuery query = new XQuery( "\n" + " declare context item as xs:integer := (1 to 17)[position() = 5];\n" + " .\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** * Context item fails to match its type. */ @org.junit.Test public void contextDecl036() { final XQuery query = new XQuery( "\n" + " declare context item as xs:integer := current-date();\n" + " .\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Function conversion rules not applied to context item. */ @org.junit.Test public void contextDecl037() { final XQuery query = new XQuery( "\n" + " declare context item as xs:integer := 23;\n" + " .\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Function conversion rules not applied to context item. */ @org.junit.Test public void contextDecl038() { final XQuery query = new XQuery( "\n" + " declare context item as xs:anyURI := \"http://www.w3.org/\";\n" + " .\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Function conversion rules not applied to context item. */ @org.junit.Test public void contextDecl039() { final XQuery query = new XQuery( "\n" + " declare context item as xs:double := 1.234;\n" + " .\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Require an external context item, no required type. */ @org.junit.Test public void contextDecl040() { final XQuery query = new XQuery( "\n" + " declare context item external;\n" + " . instance of document-node()\n" + " ", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Require an external context item, with required type. */ @org.junit.Test public void contextDecl041() { final XQuery query = new XQuery( "\n" + " declare context item as document-node() external;\n" + " name(/*)\n" + " ", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"works\"") ); } /** * Require an external context item, with default (no type). */ @org.junit.Test public void contextDecl042() { final XQuery query = new XQuery( "\n" + " declare context item external := 17;\n" + " . = 17\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Require an external context item, with default (with type). */ @org.junit.Test public void contextDecl043() { final XQuery query = new XQuery( "\n" + " declare context item as xs:integer external := 17;\n" + " . = 17\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Require an external context item, with default (with wrong type). */ @org.junit.Test public void contextDecl044() { final XQuery query = new XQuery( " declare context item as xs:double external := 17; . = 17", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Require an external context item but none supplied. */ @org.junit.Test public void contextDecl045() { final XQuery query = new XQuery( " declare context item as xs:double external; . = 17", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * More than one context item declaration. */ @org.junit.Test public void contextDecl046() { final XQuery query = new XQuery( "\n" + " declare context item as xs:double external;\n" + " declare context item as xs:integer := 15;\n" + " . = 17\n" + " ", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0099") ); } /** * Context item declaration constraining type appears in library module. */ @org.junit.Test public void contextDecl047() { final XQuery query = new XQuery( "\n" + " \timport module namespace m=\"http://www.w3.org/TestModules/libmodule2\"; \n" + " . gt xs:date('1900-01-01')\n" + " ", ctx); try { query.context(new XQuery("current-date()", ctx).value()); query.addModule("http://www.w3.org/TestModules/libmodule2", file("prod/ContextItemDecl/libmodule-2.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Context item declaration with default value appears in library module. */ @org.junit.Test public void contextDecl048() { final XQuery query = new XQuery( "\n" + " \timport module namespace m=\"http://www.w3.org/TestModules/libmodule1\"; \n" + " \t. = 17\n" + " ", ctx); try { query.addModule("http://www.w3.org/TestModules/libmodule1", file("prod/ContextItemDecl/libmodule-1.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0113") ); } /** * Context item declaration with type appears in library module. */ @org.junit.Test public void contextDecl049() { final XQuery query = new XQuery( "\n" + " import module namespace m=\"http://www.w3.org/TestModules/libmodule2\"; \n" + " declare context item as xs:date := current-date();\n" + " . gt xs:date('1900-01-01')\n" + " ", ctx); try { query.addModule("http://www.w3.org/TestModules/libmodule2", file("prod/ContextItemDecl/libmodule-2.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Context item declaration with different type appears in library module. */ @org.junit.Test public void contextDecl050() { final XQuery query = new XQuery( "\n" + " \timport module namespace m=\"http://www.w3.org/TestModules/libmodule2\"; \n" + " declare context item as xs:integer := 23;\n" + " . eq 23\n" + " ", ctx); try { query.addModule("http://www.w3.org/TestModules/libmodule2", file("prod/ContextItemDecl/libmodule-2.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Context item declaration with different type appears in library module. */ @org.junit.Test public void contextDecl051() { final XQuery query = new XQuery( "\n" + " import module namespace m=\"http://www.w3.org/TestModules/libmodule2\"; \n" + " declare context item as node() external;\n" + " . instance of element()\n" + " ", ctx); try { query.context(node(file("docs/works-mod.xml"))); query.addModule("http://www.w3.org/TestModules/libmodule2", file("prod/ContextItemDecl/libmodule-2.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Context item declaration in library module with initial value. */ @org.junit.Test public void contextDecl052() { final XQuery query = new XQuery( "\n" + " import module namespace m=\"http://www.w3.org/TestModules/libmodule3\"; \n" + " . eq 23\n" + " ", ctx); try { query.addModule("http://www.w3.org/TestModules/libmodule3", file("prod/ContextItemDecl/libmodule-3.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0113") ); } /** * Dynamic circularity involving function lookup. */ @org.junit.Test public void contextDecl053() { final XQuery query = new XQuery( "\n" + " declare variable $p := \"base-uri\";\n" + " declare variable $f := function-lookup(xs:QName(\"fn:\"||$p), 0);\n" + " declare context item := $f();\n" + " .\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0054") ); } /** * Context item declaration constraining type appears in library module. */ @org.junit.Test public void contextDecl054() { final XQuery query = new XQuery( "\n" + " \timport module namespace m=\"http://www.w3.org/TestModules/libmodule2\"; \n" + " xs:date(.) gt xs:date('1900-01-01')\n" + " ", ctx); try { query.context(new XQuery("current-dateTime()", ctx).value()); query.addModule("http://www.w3.org/TestModules/libmodule2", file("prod/ContextItemDecl/libmodule-2.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Forwards reference to context item involving function lookup. */ @org.junit.Test public void contextDecl055() { final XQuery query = new XQuery( "\n" + " declare variable $f := function-lookup(xs:QName(\"fn:\"||$p), 0);\n" + " declare context item := ;\n" + " declare variable $p := \"local-name\";\n" + " $f()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"e\"") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdContextItemExpr.java000066400000000000000000000564351222453003200312540ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the ContextItemExpr production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdContextItemExpr extends QT3TestSet { /** * Simple context item test (uses just "name" . */ @org.junit.Test public void externalcontextitem1() { final XQuery query = new XQuery( "\n" + " declare namespace eg = \"http://example.org\"; \n" + " declare function eg:noContextFunction() { name }; \n" + " eg:noContextFunction()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * context item expression where context item used in addition operation. . */ @org.junit.Test public void externalcontextitem10() { final XQuery query = new XQuery( "for $var in (/works/employee[1]) return $var/(exactly-one(hours) + exactly-one(hours))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("80") ); } /** * context item expression where context item used in subtraction operation. . */ @org.junit.Test public void externalcontextitem11() { final XQuery query = new XQuery( "for $var in (/works/employee[1]) return $var/(exactly-one(hours) - exactly-one(hours))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * context item expression where context item used in multiplication operation. . */ @org.junit.Test public void externalcontextitem12() { final XQuery query = new XQuery( "for $var in (/works/employee[1]) return $var/(exactly-one(hours) * exactly-one(hours))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1600") ); } /** * context item expression where context item used in mod operation. . */ @org.junit.Test public void externalcontextitem13() { final XQuery query = new XQuery( "for $var in (/works/employee[1]) return $var/(exactly-one(hours) mod exactly-one(hours))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * context item expression where context item used in division (div operator) operation. . */ @org.junit.Test public void externalcontextitem14() { final XQuery query = new XQuery( "for $var in (/works/employee[1]) return $var/(exactly-one(hours) div exactly-one(hours))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * context item expression where context item used in division (idiv operator) operation. . */ @org.junit.Test public void externalcontextitem15() { final XQuery query = new XQuery( "for $var in (/works/employee[1]) return $var/(exactly-one(hours) idiv exactly-one(hours))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * context item expression where context item used in a boolean (and operator)expression. . */ @org.junit.Test public void externalcontextitem16() { final XQuery query = new XQuery( "for $var in (/works/employee[1]) return $var/(xs:boolean(exactly-one(hours) - 39) and xs:boolean(exactly-one(hours) - 39))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * context item expression where context item used in a boolean (or operator)expression. . */ @org.junit.Test public void externalcontextitem17() { final XQuery query = new XQuery( "for $var in (/works/employee[1]) return $var/(xs:boolean(exactly-one(hours) - 39) or xs:boolean(exactly-one(hours) - 39))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * context item expression where context item used with string-length function. . */ @org.junit.Test public void externalcontextitem18() { final XQuery query = new XQuery( "for $var in (/works/employee[1]) return $var/fn:string-length(exactly-one(hours))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * context item expression where context item used with "avg" function. . */ @org.junit.Test public void externalcontextitem19() { final XQuery query = new XQuery( "for $var in (/works/employee[1]) return $var/fn:avg((hours,hours,hours))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("40") ); } /** * context item expression where context item is used as string. . */ @org.junit.Test public void externalcontextitem2() { final XQuery query = new XQuery( "for $var in /works/employee[1] return $var/xs:string(exactly-one(empnum))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "E1") ); } /** * context item expression where context item used with "min" function. . */ @org.junit.Test public void externalcontextitem20() { final XQuery query = new XQuery( "for $var in (/works/employee[1]) return $var/fn:min((hours,hours,22))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("22") ); } /** * context item expression where context item used with "max" function. . */ @org.junit.Test public void externalcontextitem21() { final XQuery query = new XQuery( "for $var in (/works/employee[1]) return $var/fn:max((hours,exactly-one(hours) + 1,22))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("41") ); } /** * context item expression . */ @org.junit.Test public void externalcontextitem22() { final XQuery query = new XQuery( "./works/employee[1]", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n E1\n P1\n 40\n ", false) ); } /** * Reference to a context item that has not been bound. . */ @org.junit.Test public void externalcontextitem23() { final XQuery query = new XQuery( "./works/employee[1]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPDY0002") || error("XPST0005") ) ); } /** * Reference to a context item that has not been bound. . */ @org.junit.Test public void externalcontextitem24() { final XQuery query = new XQuery( "works/employee[1]", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n E1\n P1\n 40\n ", false) ); } /** * context item expression where context item is used as an integer. . */ @org.junit.Test public void externalcontextitem3() { final XQuery query = new XQuery( "for $var in (/works/employee[1]) return $var/xs:integer(exactly-one(hours))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("40") ); } /** * context item expression where context item is used as a decimal. . */ @org.junit.Test public void externalcontextitem4() { final XQuery query = new XQuery( "for $var in (/works/employee[1]) return $var/xs:decimal(exactly-one(hours))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("40") ); } /** * context item expression where context item isused as a float. . */ @org.junit.Test public void externalcontextitem5() { final XQuery query = new XQuery( "for $var in /works/employee[1] return $var/xs:float(exactly-one(hours))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("40") ); } /** * context item expression where context item is used sa a double. . */ @org.junit.Test public void externalcontextitem6() { final XQuery query = new XQuery( "for $var in (/works/employee[1]) return $var/xs:double(exactly-one(hours))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("40") ); } /** * context item expression where context item is used as an xs:boolean. . */ @org.junit.Test public void externalcontextitem7() { final XQuery query = new XQuery( "for $var in (/works/employee[1]) return $var/xs:boolean(exactly-one(hours) - 39)", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * context item expression where context item is an xs:boolean used with fn:not(). . */ @org.junit.Test public void externalcontextitem8() { final XQuery query = new XQuery( "for $var in (/works/employee[1]) return $var/fn:not(xs:boolean(exactly-one(hours) - 39))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * context item expression where context item used as argumet to fn:sum. . */ @org.junit.Test public void externalcontextitem9() { final XQuery query = new XQuery( "for $var in (/works/employee[1]) return $var/fn:sum((hours,hours))", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("80") ); } /** * Simple context item test (uses just "." . */ @org.junit.Test public void internalcontextitem1() { final XQuery query = new XQuery( "declare namespace eg = \"http://example.org\"; declare function eg:noContextFunction() { . }; eg:noContextFunction()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * context item expression where context item used in addition operation. . */ @org.junit.Test public void internalcontextitem10() { final XQuery query = new XQuery( "(1,2,3)[(. + .) gt 1]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3") ); } /** * context item expression where context item used in subtraction operation. . */ @org.junit.Test public void internalcontextitem11() { final XQuery query = new XQuery( "(3,4,5)[(xs:integer(5) - xs:integer(.)) gt 1]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * context item expression where context item used in multiplication operation. . */ @org.junit.Test public void internalcontextitem12() { final XQuery query = new XQuery( "(3,4,5)[(xs:integer(.) * xs:integer(.)) gt 2]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3 4 5") ); } /** * context item expression where context item used in mod operation. . */ @org.junit.Test public void internalcontextitem13() { final XQuery query = new XQuery( "(6,10,14)[(xs:integer(.) mod xs:integer(3)) gt 1]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("14") ); } /** * context item expression where context item used in division (div operator) operation. . */ @org.junit.Test public void internalcontextitem14() { final XQuery query = new XQuery( "(6,10,14)[(xs:integer(.) div xs:integer(3)) gt 2]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10 14") ); } /** * context item expression where context item used in division (idiv operator) operation. . */ @org.junit.Test public void internalcontextitem15() { final XQuery query = new XQuery( "(6,10,14)[(xs:integer(.) idiv xs:integer(3)) gt 2]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10 14") ); } /** * context item expression where context item used in a boolean (and operator)expression. . */ @org.junit.Test public void internalcontextitem16() { final XQuery query = new XQuery( "(fn:true(),fn:false(),fn:true())[xs:boolean(.) and xs:boolean(.)]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true") ); } /** * context item expression where context item used in a boolean (or operator)expression. . */ @org.junit.Test public void internalcontextitem17() { final XQuery query = new XQuery( "(fn:true(),fn:false(),fn:true())[xs:boolean(.) or xs:boolean(.)]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true") ); } /** * context item expression where context item used with string-length function. . */ @org.junit.Test public void internalcontextitem18() { final XQuery query = new XQuery( "(\"ABC\", \"DEF\",\"A\")[fn:string-length(.) gt 2]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ABC DEF") ); } /** * context item expression where context item used with "avg" function. . */ @org.junit.Test public void internalcontextitem19() { final XQuery query = new XQuery( "(1,2,3)[fn:avg((.,2,3)) gt 2]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2 3") ); } /** * context item expression wher context item is string. . */ @org.junit.Test public void internalcontextitem2() { final XQuery query = new XQuery( "(\"A\",\"B\",\"C\")[xs:string(.)]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "A B C") ); } /** * context item expression where context item used with "min" function. . */ @org.junit.Test public void internalcontextitem20() { final XQuery query = new XQuery( "(1,2,3)[fn:min((.,2)) eq 2]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2 3") ); } /** * context item expression where context item used with "max" function. . */ @org.junit.Test public void internalcontextitem21() { final XQuery query = new XQuery( "(1,2,3)[fn:min((.,3)) eq 3]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * context item expression wher context item is an integer. . */ @org.junit.Test public void internalcontextitem3() { final XQuery query = new XQuery( "(1,2,3)[xs:integer(.)]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3") ); } /** * context item expression wher context item is a decimal. . */ @org.junit.Test public void internalcontextitem4() { final XQuery query = new XQuery( "(1,2,3)[xs:decimal(.)]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3") ); } /** * context item expression where context item is a float. . */ @org.junit.Test public void internalcontextitem5() { final XQuery query = new XQuery( "(1,2,3)[xs:float(.)]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3") ); } /** * context item expression where context item is a double. . */ @org.junit.Test public void internalcontextitem6() { final XQuery query = new XQuery( "(1,2,3)[xs:double(.)]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3") ); } /** * context item expression where context item is an xs:boolean. . */ @org.junit.Test public void internalcontextitem7() { final XQuery query = new XQuery( "(fn:true(),fn:false(),fn:true())[xs:boolean(.)]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true") ); } /** * context item expression where context item is an xs:boolean used with fn:not(). . */ @org.junit.Test public void internalcontextitem8() { final XQuery query = new XQuery( "(fn:false(),fn:true(),fn:false())[fn:not(xs:boolean(.))]", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "false false") ); } /** * context item expression where context item is an empty sequence. uses fn:count to avoid empty file. . */ @org.junit.Test public void internalcontextitem9() { final XQuery query = new XQuery( "fn:count(((),(),())[xs:string(.)])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdCopyNamespacesDecl.java000066400000000000000000000711471222453003200316510ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the CopyNamespacesDecl production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdCopyNamespacesDecl extends QT3TestSet { /** * A prolog may not contain two copy-namespaces declarations. . */ @org.junit.Test public void kCopyNamespacesProlog1() { final XQuery query = new XQuery( "declare copy-namespaces preserve, no-inherit; declare copy-namespaces no-preserve, no-inherit; 1 eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0055") ); } /** * A 'declare copy-namespaces' declaration specifying no-preserve and no-inherit. . */ @org.junit.Test public void kCopyNamespacesProlog2() { final XQuery query = new XQuery( "declare copy-namespaces no-preserve, no-inherit; 1 eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A 'declare copy-namespaces' declaration specifying no-preserve and no-inherit. . */ @org.junit.Test public void kCopyNamespacesProlog3() { final XQuery query = new XQuery( "declare copy-namespaces preserve, inherit; 1 eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A 'declare copy-namespaces' declaration specifying no-preserve and no-inherit in a wrong order . . */ @org.junit.Test public void kCopyNamespacesProlog4() { final XQuery query = new XQuery( "declare copy-namespaces no-inherit, no-preserve; 1 eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A 'declare copy-namespaces' declaration specifying preserve and inherit in a wrong order . . */ @org.junit.Test public void kCopyNamespacesProlog5() { final XQuery query = new XQuery( "declare copy-namespaces inherit, preserve; 1 eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Use no-preserve, inherit with the default namespace. . */ @org.junit.Test public void k2CopyNamespacesProlog1() { final XQuery query = new XQuery( "declare copy-namespaces no-preserve, inherit; {} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Ensure the 'copy-namespaces' keyword is parsed correctly. . */ @org.junit.Test public void k2CopyNamespacesProlog2() { final XQuery query = new XQuery( "copy-namespaces lt copy-namespaces", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Ensure the 'namespace' keyword is parsed correctly. . */ @org.junit.Test public void k2CopyNamespacesProlog3() { final XQuery query = new XQuery( "namespace lt namespace", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Verify that the default element namespace is not touched when using no-inherit. . */ @org.junit.Test public void k2CopyNamespacesProlog4() { final XQuery query = new XQuery( "declare copy-namespaces preserve, no-inherit; { } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Have a namespace which is used further down. . */ @org.junit.Test public void k2CopyNamespacesProlog5() { final XQuery query = new XQuery( "declare copy-namespaces no-preserve, no-inherit; { } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Check in-scope bindings of constructed nodes. . */ @org.junit.Test public void k2CopyNamespacesProlog6() { final XQuery query = new XQuery( "declare namespace ns = \"http://example.com/\"; { } /(for $n in (., b, b/ns:c), $i in in-scope-prefixes($n) order by $i return ($i, '|'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "appearsUnused | appearsUnused | appearsUnused | xml | xml | xml |") ); } /** * Have an unused prefix further down the hierarchy. . */ @org.junit.Test public void k2CopyNamespacesProlog7() { final XQuery query = new XQuery( "declare copy-namespaces no-preserve, no-inherit; { } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Copy an element with no children. . */ @org.junit.Test public void k2CopyNamespacesProlog8() { final XQuery query = new XQuery( "declare copy-namespaces no-preserve,inherit; { {()} } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Use direct element constructors inside enclosed expressions. . */ @org.junit.Test public void k2CopyNamespacesProlog9() { final XQuery query = new XQuery( "declare copy-namespaces preserve, no-inherit; declare variable $e1 := ; declare variable $e2 := {$e1}; for $n in {$e2}/e2/e1, $ps in in-scope-prefixes($n) order by $ps return $ps, '|', for $n in {{}}/e2/e1, $ps in in-scope-prefixes($n) order by $ps return $ps", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "namespace1 xml | namespace1 namespace2 namespace3 xml") ); } /** * Evaluation of a prolog with more than one copy-namespace declaration. . */ @org.junit.Test public void copynamespace1() { final XQuery query = new XQuery( "declare copy-namespaces preserve, no-inherit; declare copy-namespaces no-preserve, no-inherit; declare variable $input-context1 external; \"aaa\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0055") ); } /** * Evaluates copy namespace declaration with value set to "preserve inherit" . Use global variables and namespaces with prefixes. . */ @org.junit.Test public void copynamespace10() { final XQuery query = new XQuery( "declare copy-namespaces preserve,inherit; declare variable $existingElement := {\"Existing Content\"}; declare variable $new := {$existingElement}; declare variable $input-context1 external; for $var in (in-scope-prefixes($new/existingElement)) order by exactly-one($var) ascending return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "existingNamespace newNamespace xml") ); } /** * Evaluates copy namespace declaration with value set to "preserve inherit" . Use global variables and namespaces with prefixes. Same prefix different namespace URI. . */ @org.junit.Test public void copynamespace11() { final XQuery query = new XQuery( "declare copy-namespaces preserve,inherit; declare variable $existingElement := {\"Existing Content\"}; declare variable $new := {$existingElement}; declare variable $input-context1 external; for $var in (in-scope-prefixes($new/existingElement)) order by exactly-one($var) ascending return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "existingNamespace xml") ); } /** * Evaluates copy namespace declaration with value set to "preserve inherit" . Use global variables and namespaces with prefixes. diferent prefix same namespace URI. . */ @org.junit.Test public void copynamespace12() { final XQuery query = new XQuery( "declare copy-namespaces preserve,inherit; declare variable $existingElement := {\"Existing Content\"}; declare variable $new := {$existingElement}; declare variable $input-context1 external; for $var in (in-scope-prefixes($new/existingElement)) order by exactly-one($var) ascending return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "existingNamespace newNamespace xml") ); } /** * Evaluates copy namespace declaration with value set to "preserve inherit" . Use global variables. only the XML prefix is used. . */ @org.junit.Test public void copynamespace13() { final XQuery query = new XQuery( "declare copy-namespaces preserve,inherit; declare variable $existingElement := {\"Existing Content\"}; declare variable $new := {$existingElement}; declare variable $input-context1 external; for $var in (in-scope-prefixes(exactly-one($new/existingElement))) return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xml") ); } /** * Evaluates copy namespace declaration with value set to "preserve inherit" . Use global variables where prefix differes in case. . */ @org.junit.Test public void copynamespace14() { final XQuery query = new XQuery( "declare copy-namespaces preserve,inherit; declare variable $existingElement := {\"Existing Content\"}; declare variable $new := {$existingElement}; declare variable $input-context1 external; for $var in (in-scope-prefixes($new/existingElement)) order by exactly-one($var) ascending return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "SOMESPACE somespace xml") ); } /** * Evaluates copy namespace declaration with value set to "preserve inherit" . with multiple inclusions. Examines last element in subtree. . */ @org.junit.Test public void copynamespace15() { final XQuery query = new XQuery( "declare copy-namespaces preserve,inherit; declare variable $element1 := ; declare variable $element2 := {$element1}; declare variable $element3 := {$element2}; declare variable $input-context1 external; for $var in (in-scope-prefixes($element3/element2/element1)) order by exactly-one($var) ascending return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "namespace1 namespace2 namespace3 xml") ); } /** * Evaluates copy namespace declaration with value set to "no-preserve inherit" . with multiple inclusions. Examines last element in subtree. . */ @org.junit.Test public void copynamespace16() { final XQuery query = new XQuery( "declare copy-namespaces no-preserve,inherit; declare variable $element1 := ; declare variable $element2 := {$element1}; declare variable $element3 := {$element2}; declare variable $input-context1 external; for $var in (in-scope-prefixes($element3/element2/element1)) order by exactly-one($var) ascending return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "namespace3 xml") ); } /** * Evaluates copy namespace declaration with value set to "no-preserve no-inherit" . with multiple inclusions. Examines last element in subtree. . */ @org.junit.Test public void copynamespace17() { final XQuery query = new XQuery( "declare copy-namespaces no-preserve,no-inherit; declare variable $element1 := ; declare variable $element2 := {$element1}; declare variable $element3 := {$element2}; declare variable $input-context1 external; for $var in (in-scope-prefixes($element3/element2/element1)) order by exactly-one($var) ascending return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xml") ); } /** * Evaluates copy namespace declaration with value set to "preserve no-inherit" . with multiple inclusions. Examines last element in subtree. . */ @org.junit.Test public void copynamespace18() { final XQuery query = new XQuery( "declare copy-namespaces preserve,no-inherit; declare variable $element1 := ; declare variable $element2 := {$element1}; declare variable $element3 := {$element2}; declare variable $input-context1 external; for $var in (in-scope-prefixes($element3/element2/element1)) order by exactly-one($var) ascending return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "namespace1 xml") ); } /** * Evaluates copy namespace declaration with value set to "preserve inherit" . with multiple inclusions. Examines mid element in subtree. . */ @org.junit.Test public void copynamespace19() { final XQuery query = new XQuery( "declare copy-namespaces preserve,inherit; declare variable $element1 := ; declare variable $element2 := {$element1}; declare variable $element3 := {$element2}; declare variable $input-context1 external; for $var in (in-scope-prefixes($element3/element2)) order by exactly-one($var) ascending return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "namespace2 namespace3 xml") ); } /** * Evaluates that default namespace is overriden by local namespace. . */ @org.junit.Test public void copynamespace2() { final XQuery query = new XQuery( "declare copy-namespaces preserve,no-inherit; declare default element namespace \"http://example.org/names\"; declare variable $input-context1 external; let $new := {element original {\"Original Content\"}} return $new//*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Original Content", false) ); } /** * Evaluates copy namespace declaration with value set to "no-preserve inherit" . with multiple inclusions. Examines mid element in subtree. . */ @org.junit.Test public void copynamespace20() { final XQuery query = new XQuery( "declare copy-namespaces no-preserve,inherit; declare variable $element1 := ; declare variable $element2 := {$element1}; declare variable $element3 := {$element2}; declare variable $input-context1 external; for $var in (in-scope-prefixes($element3/element2)) order by exactly-one($var) ascending return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "namespace3 xml") ); } /** * Evaluates copy namespace declaration with value set to "no-preserve no-inherit" . with multiple inclusions. Examines mid element in subtree. . */ @org.junit.Test public void copynamespace21() { final XQuery query = new XQuery( "declare copy-namespaces no-preserve,no-inherit; declare variable $element1 := ; declare variable $element2 := {$element1}; declare variable $element3 := {$element2}; declare variable $input-context1 external; for $var in (in-scope-prefixes($element3/element2)) order by exactly-one($var) ascending return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xml") ); } /** * Evaluates copy namespace declaration with value set to "preserve no-inherit" . with multiple inclusions. Examines mid element in subtree. . */ @org.junit.Test public void copynamespace22() { final XQuery query = new XQuery( "declare copy-namespaces preserve,no-inherit; declare variable $element1 := ; declare variable $element2 := {$element1}; declare variable $element3 := {$element2}; declare variable $input-context1 external; for $var in (in-scope-prefixes($element3/element2)) order by exactly-one($var) ascending return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "namespace2 xml") ); } /** * Evaluates copy namespace declaration with value set to "preserve no-inherit". . */ @org.junit.Test public void copynamespace3() { final XQuery query = new XQuery( "\n" + " declare namespace foo = \"http://example.org\"; \n" + " declare copy-namespaces preserve,no-inherit; \n" + " let $existingElement := {\"Existing Content\"} \n" + " let $new := {$existingElement} \n" + " return in-scope-prefixes(exactly-one($new/child::node()))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"\", \"xml\"") ); } /** * Evaluates copy namespace declaration with value set to "preserve inherit". . */ @org.junit.Test public void copynamespace4() { final XQuery query = new XQuery( "declare namespace foo = \"http://example.org\"; declare copy-namespaces preserve,inherit; declare variable $input-context1 external; let $existingElement := {\"Existing Content\"} let $new := {$existingElement} for $var in (in-scope-prefixes($new//child::*)) order by exactly-one($var) ascending return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, " foo xml") ); } /** * Evaluates copy namespace declaration with value set to "preserve no-inherit" . The copies element use the same prefix. . */ @org.junit.Test public void copynamespace5() { final XQuery query = new XQuery( "declare namespace foo = \"http://example.org\"; declare copy-namespaces preserve,no-inherit; declare variable $input-context1 external; let $existingElement := {\"Existing Content\"} let $new := {$existingElement} for $var in (in-scope-prefixes($new//child::*)) order by exactly-one($var) ascending return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, " foo xml") ); } /** * Evaluates copy namespace declaration with value set to "preserve inherit" . The copies element use the same prefix. . */ @org.junit.Test public void copynamespace6() { final XQuery query = new XQuery( "declare namespace foo = \"http://example.org\"; declare copy-namespaces preserve,inherit; declare variable $input-context1 external; let $existingElement := {\"Existing Content\"} let $new := {$existingElement} for $var in (in-scope-prefixes($new//child::*)) order by exactly-one($var) ascending return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, " foo xml") ); } /** * Evaluates copy namespace declaration with value set to "no-preserve no-inherit" . Use global variables and namespaces with prefixes. . */ @org.junit.Test public void copynamespace7() { final XQuery query = new XQuery( "declare copy-namespaces no-preserve,no-inherit; declare variable $existingElement := {\"Existing Content\"}; declare variable $new := {$existingElement}; declare variable $input-context1 external; for $var in (in-scope-prefixes($new/existingElement)) order by exactly-one($var )ascending return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xml") ); } /** * Evaluates copy namespace declaration with value set to "preserve no-inherit" . Use global variables and namespaces with prefixes. . */ @org.junit.Test public void copynamespace8() { final XQuery query = new XQuery( "declare copy-namespaces preserve,no-inherit; declare variable $existingElement := {\"Existing Content\"}; declare variable $new := {$existingElement}; declare variable $input-context1 external; for $var in (in-scope-prefixes($new/existingElement)) order by exactly-one($var) ascending return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "existingNamespace xml") ); } /** * Evaluates copy namespace declaration with value set to "no-preserve inherit" . Use global variables and namespaces with prefixes. . */ @org.junit.Test public void copynamespace9() { final XQuery query = new XQuery( "declare copy-namespaces no-preserve,inherit; declare variable $existingElement := {\"Existing Content\"}; declare variable $new := {$existingElement}; declare variable $input-context1 external; for $var in (in-scope-prefixes($new/existingElement)) order by exactly-one($var) ascending return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "newNamespace xml") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdCountClause.java000066400000000000000000000254141222453003200303700ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the CountClause production in XQuery 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdCountClause extends QT3TestSet { /** * simple count clause. */ @org.junit.Test public void count001() { final XQuery query = new XQuery( "\n" + " { \n" + "\t\t for $x in 1 to 10 \n" + "\t\t count $j\n" + "\t\t return \n" + "\t\t {$x}{$j} \n" + "\t\t}\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1122334455667788991010", false) ); } /** * count clause . */ @org.junit.Test public void count002() { final XQuery query = new XQuery( "\n" + " { \n" + "\t\t for $x at $j in 1 to 10 \n" + "\t\t return \n" + "\t\t {$x}{$j} \n" + "\t\t}\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1122334455667788991010", false) ); } /** * count clauses in a nested for loop. */ @org.junit.Test public void count003() { final XQuery query = new XQuery( "\n" + " { \n" + "\t\t for $x in 1 to 4\n" + "\t\t count $ix\n" + "\t\t for $y in $x to 3\n" + "\t\t count $iy \n" + "\t\t return \n" + "\t\t {$x}{$ix}{$y}{$iy} \n" + "\t\t}\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("111111221133222422353336", false) ); } /** * count clauses in a nested for loop with allowing empty. */ @org.junit.Test public void count004() { final XQuery query = new XQuery( "\n" + " { \n" + "\t\t for $x in 1 to 4\n" + "\t\t count $ix\n" + "\t\t for $y allowing empty in $x to 3\n" + "\t\t count $iy \n" + "\t\t return \n" + "\t\t {$x}{$ix}{$y}{$iy} \n" + "\t\t}\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("111111221133222422353336447", false) ); } /** * Use of a count clause in a filter. */ @org.junit.Test public void count005() { final XQuery query = new XQuery( "\n" + " { \n" + "\t\t for $x in 1 to 5\n" + "\t\t for $y in 1 to 5\n" + "\t\t count $index\n" + "\t\t where $index mod 3 = 0\n" + "\t\t return \n" + "\t\t {$x}{$y}{$index} \n" + "\t\t}\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("13321624932123515431851215424", false) ); } /** * Use of a count clause in a filter. */ @org.junit.Test public void count006() { final XQuery query = new XQuery( "\n" + " { \n" + "\t\t for $x in 1 to 5\n" + "\t\t for $y in 1 to 5\n" + "\t\t count $index\n" + "\t\t where $index mod 3 = 0\n" + "\t\t count $index2\n" + "\t\t return \n" + "\t\t {$x}{$y}{$index2} \n" + "\t\t}\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("131212243324355436517548", false) ); } /** * Re-assigning a count variable name. */ @org.junit.Test public void count007() { final XQuery query = new XQuery( "\n" + " { \n" + "\t\t for $x in 1 to 5\n" + "\t\t for $y in 1 to 5\n" + "\t\t count $index\n" + "\t\t where $index mod 3 = 0\n" + "\t\t count $index\n" + "\t\t return \n" + "\t\t {$x}{$y}{$index} \n" + "\t\t}\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("131212243324355436517548", false) ); } /** * Re-assigning a count variable name. */ @org.junit.Test public void count008() { final XQuery query = new XQuery( "\n" + " { \n" + "\t\t for $x in 1 to 2\n" + "\t\t for $y in 1 to 3\n" + "\t\t let $index := $y\n" + "\t\t count $index\n" + "\t\t return \n" + "\t\t {$x}{$y}{$index} \n" + "\t\t}\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("111122133214225236", false) ); } /** * Using a count clause with order-by. */ @org.junit.Test public void count009() { final XQuery query = new XQuery( "\n" + " { \n" + "\t\t for $x in 1 to 4\n" + "\t\t for $y in 1 to 4\n" + "\t\t count $index\n" + "\t\t let $remainder := $index mod 3\n" + "\t\t order by $remainder, $index\n" + "\t\t count $index2\n" + "\t\t return \n" + "\t\t {$x}{$y}{$remainder}{$index2} \n" + "\t\t}\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("13012202310334044305111614172318321941110441111221221213242143321542216", false) ); } /** * Count is reset on each execution of a FLWOR expression. */ @org.junit.Test public void count010() { final XQuery query = new XQuery( "\n" + "\t\t for $x in 1 to 4 return\n" + "\t\t for $y in 1 to 4\n" + "\t\t count $index\n" + "\t\t return $index\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdDecimalFormatDecl.java000066400000000000000000000455151222453003200314460ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the XQuery 3.0 decimal format declaration, controlling the format-number() function. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdDecimalFormatDecl extends QT3TestSet { /** * * Purpose: Test of format-number with 2 arguments, showing zeroes. . */ @org.junit.Test public void decimalFormat01() { final XQuery query = new XQuery( "\n" + " declare default decimal-format zero-digit=\"0\" grouping-separator=\",\" decimal-separator=\".\";\n" + " \tformat-number(2392.14*36.58,'000,000.000000')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "087,504.481200") ); } /** * * Purpose: Test of format-number and # and 0 in format string. . */ @org.junit.Test public void decimalFormat02() { final XQuery query = new XQuery( "\n" + " declare default decimal-format digit=\"#\" grouping-separator=\",\" decimal-separator=\".\";\n" + " \tformat-number(12792.14*96.58,'##,###,000.000###')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1,235,464.8812") ); } /** * * Purpose: Test of format-number on a negative number. . */ @org.junit.Test public void decimalFormat03() { final XQuery query = new XQuery( "\n" + " declare default decimal-format minus-sign=\"-\" grouping-separator=\",\" decimal-separator=\".\";\n" + " \tformat-number(2792.14*(-36.58),'000,000.000###')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-102,136.4812") ); } /** * * Purpose: Test of format-number on a negative number; should choose second pattern. . */ @org.junit.Test public void decimalFormat04() { final XQuery query = new XQuery( "\n" + " declare default decimal-format minus-sign=\"-\" pattern-separator=\";\" grouping-separator=\",\" decimal-separator=\".\";\n" + " \tformat-number(2392.14*(-36.58),'000,000.000###;###,###.000###')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "87,504.4812") ); } /** * * Purpose: Test of format-number percentage format. . */ @org.junit.Test public void decimalFormat05() { final XQuery query = new XQuery( "\n" + " declare decimal-format local:df minus-sign=\"-\" percent=\"%\" decimal-separator=\".\";\n" + " \tformat-number(0.4857,'###.###%', 'local:df')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "48.57%") ); } /** * * Purpose: Test of format-number per-mille format. . */ @org.junit.Test public void decimalFormat06() { final XQuery query = new XQuery( "\n" + " declare decimal-format local:df minus-sign=\"-\" per-mille=\"\u2030\" decimal-separator=\".\";\n" + " \tformat-number(0.4857,'###.###\u2030')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "485.7\u2030") ); } /** * * Purpose: Test of format-number currency symbol, which is not supposed to be there. . */ @org.junit.Test public void decimalFormat07() { final XQuery query = new XQuery( "\n" + " declare decimal-format local:df minus-sign=\"-\" currency-symbol=\"¤\" decimal-separator=\".\";\n" + " \tformat-number(95.4857,'¤###.####', \"local:df\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * * Purpose: Test non-default decimal-format on separator characters, changing both. . */ @org.junit.Test public void decimalFormat09() { final XQuery query = new XQuery( "\n" + " declare default decimal-format decimal-separator=\"|\" grouping-separator=\".\"; \n" + " format-number(931.4857,'000.000|###')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "000.931|486") ); } /** * * Purpose: Test default decimal-format on pattern-only characters, positive number. . */ @org.junit.Test public void decimalFormat11() { final XQuery query = new XQuery( "\n" + " declare default decimal-format digit=\"!\" pattern-separator=\"\\\";\n" + " format-number(26931.4,'+!!!,!!!.!!!\\-!!,!!!.!!!')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "+26,931.4") ); } /** * * Purpose: Test default decimal-format on pattern-only characters, negative number. . */ @org.junit.Test public void decimalFormat12() { final XQuery query = new XQuery( "\n" + " declare default decimal-format digit=\"!\" pattern-separator=\"\\\";\n" + " format-number(-26931.4,'+!!,!!!.!!!\\-!!!,!!!.!!!')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-26,931.4") ); } /** * * Purpose: Test default decimal-format on pattern-only characters, negative number and one pattern. . */ @org.junit.Test public void decimalFormat13() { final XQuery query = new XQuery( "\n" + " declare default decimal-format digit=\"!\" pattern-separator=\"\\\";\n" + " format-number(-26931.4,'!!!,!!!.!!!')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-26,931.4") ); } /** * * Purpose: Test specified result pattern for infinity. . */ @org.junit.Test public void decimalFormat14() { final XQuery query = new XQuery( "\n" + " declare decimal-format local:df2 infinity=\"off-the-scale\";\n" + " format-number(1 div 0e0,'###############################', 'local:df2')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "off-the-scale") ); } /** * * Purpose: Test specified result pattern for not-a-number. . */ @org.junit.Test public void decimalFormat15() { final XQuery query = new XQuery( "\n" + " declare decimal-format local:df2 NaN=\"non-numeric\";\n" + " format-number(number('none'), '#############', 'local:df2')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "non-numeric") ); } /** * * Purpose: Test of decimal-format per-mille format with character being changed. . */ @org.junit.Test public void decimalFormat16() { final XQuery query = new XQuery( "\n" + " declare default decimal-format per-mille=\"m\";\n" + " format-number(0.4857,'###.###m')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "485.7m") ); } /** * * Purpose: Test decimal-format output character for negative, 2 patterns. . */ @org.junit.Test public void decimalFormat17() { final XQuery query = new XQuery( "\n" + " declare default decimal-format minus-sign=\"_\";\n" + " format-number(-26931.4,'+###,###.###;-###,###.###')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "-26,931.4") ); } /** * * Purpose: Test decimal-format output character for negative, one pattern. . */ @org.junit.Test public void decimalFormat18() { final XQuery query = new XQuery( "\n" + " declare default decimal-format minus-sign=\"_\";\n" + " format-number(-26931.4,'###,###.###')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "_26,931.4") ); } /** * * Purpose: Test decimal-format declaration with an unprefixed name. . */ @org.junit.Test public void decimalFormat19() { final XQuery query = new XQuery( "\n" + " declare decimal-format myminus minus-sign=\"_\"; \n" + " concat(format-number(-26931.4,'###,###.###','myminus'), '/',\n" + " format-number(-42857.1,'###,###.###'))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "_26,931.4/-42,857.1") ); } /** * * Purpose: Test of decimal-format with qualified name. Unqualified name provided as a trap. . */ @org.junit.Test public void decimalFormat20() { final XQuery query = new XQuery( "\n" + " declare namespace foo=\"http://foo.ns\";\n" + " declare decimal-format foo:decimal1 decimal-separator=\"!\" grouping-separator=\"*\";\n" + " declare decimal-format decimal1 decimal-separator=\"*\" grouping-separator=\"!\";\n" + " format-number(1234.567,'#*###*###!###','foo:decimal1')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1*234!567") ); } /** * * Purpose: Decimal formats apply only within their own module. . */ @org.junit.Test public void decimalFormat21() { final XQuery query = new XQuery( "\n" + " import module namespace m=\"http://www.w3.org/TestModules/dfd-module-001\";\n" + " declare decimal-format df001 grouping-separator=\"!\";\n" + " format-number(123456.789,'#!###!###.###','df001')||'-'||m:do()\n" + " ", ctx); try { query.addModule("http://www.w3.org/TestModules/dfd-module-001", file("prod/DecimalFormatDecl/dfd-module-001.xq")); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "123!456.789-123'456.789") ); } /** * * Purpose: Create a conflict in the use of the '!' character. * . */ @org.junit.Test public void decimalFormat901err() { final XQuery query = new XQuery( "\n" + " declare default decimal-format decimal-separator=\"!\" grouping-separator=\"!\";\n" + " format-number(931.4857,'###!###!###')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0098") ); } /** * * Creator: Michael Kay (bug report from doerschlein) * Purpose: Test use of an illegal picture. . */ @org.junit.Test public void decimalFormat902err() { final XQuery query = new XQuery( "\n" + " declare default decimal-format digit='$';\n" + " format-number(931.4857,'000.$$0')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODF1310") ); } /** * * Purpose: Two default decimal declarations. . */ @org.junit.Test public void decimalFormat903err() { final XQuery query = new XQuery( "\n" + " declare default decimal-format digit='$';\n" + " declare default decimal-format minus-sign='_';\n" + " format-number(931.4857,'000.$$0')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0111") ); } /** * * Purpose: Two decimal format declarations with same name. . */ @org.junit.Test public void decimalFormat904err() { final XQuery query = new XQuery( "\n" + " declare namespace a=\"http://a.com/\";\n" + " declare namespace b=\"http://a.com/\";\n" + " declare decimal-format a:one digit='$';\n" + " declare decimal-format two digit='$';\n" + " declare decimal-format three digit='$';\n" + " declare decimal-format four digit='$';\n" + " declare decimal-format five digit='$';\n" + " declare decimal-format b:one minus-sign=\"_\";\n" + " declare default decimal-format minus-sign='_';\n" + " format-number(931.4857,'000.$$0')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0111") ); } /** * * Purpose: test error condition: no digit or zero-digit in picture. . */ @org.junit.Test public void decimalFormat905err() { final XQuery query = new XQuery( "\n" + " declare decimal-format q decimal-separator=\".\" grouping-separator=\",\";\n" + " format-number(931.4857,'fred.ginger', 'q')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODF1310") ); } /** * * Purpose: Test raising error FODF1280. . */ @org.junit.Test public void decimalFormat906err() { final XQuery query = new XQuery( "format-number(931.45, '000.##0', 'foo:bar')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FODF1280") ); } /** * * Purpose: Decimal format declaration declares the same property twice. . */ @org.junit.Test public void decimalFormat907err() { final XQuery query = new XQuery( "\n" + " declare namespace a=\"http://a.com/\";\n" + " declare namespace b=\"http://a.com/\";\n" + " declare decimal-format a:one digit='$' zero-digit=\"0\" minus-sign=\"_\" digit=\"#\";\n" + " format-number(931.4857,'000.$$0', 'a:one')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0114") ); } /** * * Purpose: Decimal format declaration declares invalid property value. . */ @org.junit.Test public void decimalFormat908err() { final XQuery query = new XQuery( "\n" + " declare default decimal-format digit=\"one\";\n" + " format-number(931.4857,'000.$$0')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0097") ); } /** * * Purpose: Decimal format declaration declares invalid property value. . */ @org.junit.Test public void decimalFormat909err() { final XQuery query = new XQuery( "\n" + " declare default decimal-format zero-digit=\"1\";\n" + " format-number(931.4857,'000.$$0')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0097") ); } /** * * Purpose: Decimal format declaration declares invalid property value. . */ @org.junit.Test public void decimalFormat910err() { final XQuery query = new XQuery( "\n" + " declare default decimal-format zero-digit=\"a\";\n" + " format-number(931.4857,'aaa.$$a')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0097") ); } /** * * Purpose: Decimal format declaration declares invalid property value. . */ @org.junit.Test public void decimalFormat911err() { final XQuery query = new XQuery( "\n" + " declare default decimal-format minus-sign=\"--\";\n" + " format-number(931.4857,'000.$$0')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0097") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdDefaultCollationDecl.java000066400000000000000000000122301222453003200321540ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the DefaultCollationDecl production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdDefaultCollationDecl extends QT3TestSet { /** * A 'declare default collation' that uses a relative URI combined with setting the base-uri, to specify the Unicode Codepoint collation. . */ @org.junit.Test public void kCollationProlog1() { final XQuery query = new XQuery( "declare base-uri \"http://www.w3.org/2005/xpath-functions/\"; declare default collation \"collation/codepoint\"; default-collation() eq \"http://www.w3.org/2005/xpath-functions/collation/codepoint\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A 'declare default collation' that uses a relative URI combined with setting the base-uri, to specify an invalid collation. . */ @org.junit.Test public void kCollationProlog2() { final XQuery query = new XQuery( "declare base-uri \"http://example.com/\"; declare default collation \"collation/codepoint/DOESNOTEXIT/Testing\"; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0038") ); } /** * Any implementation must support setting the default collation to the Unicode Codepoint collation with 'declare default collation'. . */ @org.junit.Test public void kCollationProlog3() { final XQuery query = new XQuery( "declare default collation \"http://www.w3.org/2005/xpath-functions/collation/codepoint\"; default-collation() eq \"http://www.w3.org/2005/xpath-functions/collation/codepoint\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A 'declare default collation' expression may occur only once. . */ @org.junit.Test public void kCollationProlog4() { final XQuery query = new XQuery( "declare default collation \"http://www.w3.org/2005/xpath-functions/collation/codepoint\"; declare default collation \"http://www.w3.org/2005/xpath-functions/collation/codepoint\"; default-collation() eq \"http://www.w3.org/2005/xpath-functions/collation/codepoint\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0038") ); } /** * Two 'declare default collation' declarations where the collations differs. . */ @org.junit.Test public void kCollationProlog5() { final XQuery query = new XQuery( "declare default collation \"http://www.w3.org/2005/xpath-functions/collation/codepoint\"; declare default collation \"http://www.w3.org/2005/xpath-functions/collation/codepoint2\"; default-collation() eq \"http://www.w3.org/2005/xpath-functions/collation/codepoint\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0038") ); } /** * Invalid URI literal in prolog. . */ @org.junit.Test public void k2CollationProlog1() { final XQuery query = new XQuery( "declare default collation \"&\"; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Evaluation of a prolog with two default collation delarations. . */ @org.junit.Test public void defaultcolldecl1() { final XQuery query = new XQuery( "declare default collation \"http://www.w3.org/2005/xpath-functions/collation/codepoint\"; declare default collation \"http://www.w3.org/2005/xpath-functions/collation/codepoint\"; declare variable $input-context1 external; \"aaa\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0038") ); } /** * Evaluation of a prolog with default collation delarations that should raise an error. . */ @org.junit.Test public void defaultcolldecl2() { final XQuery query = new XQuery( "declare default collation \"http://nonexistentcollition.org/ifsupportedwoooayouarethebestQueryimplementation/makeitharder\"; declare variable $input-context1 external; \"aaa\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0038") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdDefaultNamespaceDecl.java000066400000000000000000001161311222453003200321310ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the DefaultNamespaceDecl production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdDefaultNamespaceDecl extends QT3TestSet { /** * A 'declare default element namespace' expression containing many comments, using apostrophes for the URILiteral. . */ @org.junit.Test public void kDefaultNamespaceProlog1() { final XQuery query = new XQuery( "declare(:..:)default(:..:)element(:..:)namespace(:..:)'http://example.com/'(:..:);(:..:)1(:..:)eq(:..:)1(:..:)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * ':=' cannot be used in a 'declare namespace' declaration. . */ @org.junit.Test public void kDefaultNamespaceProlog10() { final XQuery query = new XQuery( "declare default element namespace := \"http://example.com/\";1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * ':=' cannot be used in a 'declare namespace' declaration. . */ @org.junit.Test public void kDefaultNamespaceProlog11() { final XQuery query = new XQuery( "declare default function namespace := \"http://example.com/\";1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A 'declare default element namespace' expression containing many comments, using quotes for the URILiteral. . */ @org.junit.Test public void kDefaultNamespaceProlog2() { final XQuery query = new XQuery( "declare(:..:)default(:..:)element(:..:)namespace(:..:)\"http://example.com/\"(:..:);(:..:)1(:..:)eq(:..:)1(:..:)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A 'declare default function namespace' expression containing many comments, using apostrophes for the URILiteral. . */ @org.junit.Test public void kDefaultNamespaceProlog3() { final XQuery query = new XQuery( "declare(:..:)default(:..:)function(:..:)namespace(:..:)'http://example.com/'(:..:);(:..:)1(:..:)eq(:..:)1(:..:)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A 'declare default function namespace' expression containing many comments, using quotes for the URILiteral. . */ @org.junit.Test public void kDefaultNamespaceProlog4() { final XQuery query = new XQuery( "declare(:..:)default(:..:)function(:..:)namespace(:..:)\"http://example.com/\"(:..:);(:..:)1(:..:)eq(:..:)1(:..:)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * No function named boolean is available in the namespace 'example.com' set via 'declare default function namespace'. . */ @org.junit.Test public void kDefaultNamespaceProlog5() { final XQuery query = new XQuery( "declare(:..:)default(:..:)function(:..:)namespace(:..:)\"http://example.com/\"(:..:);(:..:)boolean(1)(:..:)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * 'declare function namespace' is a syntactically invalid declaration. . */ @org.junit.Test public void kDefaultNamespaceProlog6() { final XQuery query = new XQuery( "declare function namespace \"http://example.com/\";1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * 'declare function namespace' is a syntactically invalid declaration. . */ @org.junit.Test public void kDefaultNamespaceProlog7() { final XQuery query = new XQuery( "declare element namespace \"http://example.com/\";1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * '=' cannot be used in a 'declare namespace' declaration. . */ @org.junit.Test public void kDefaultNamespaceProlog8() { final XQuery query = new XQuery( "declare default element namespace = \"http://example.com/\";1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * '=' cannot be used in a 'declare namespace' declaration. . */ @org.junit.Test public void kDefaultNamespaceProlog9() { final XQuery query = new XQuery( "declare default function namespace = \"http://example.com/\";1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * In direct element constructors, the declared default element namespace is respected. . */ @org.junit.Test public void k2DefaultNamespaceProlog1() { final XQuery query = new XQuery( "declare default element namespace \"http://example.com/defelementns\"; namespace-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.com/defelementns") ); } /** * Two attributes that have identical expanded names, but indifferent lexical names. . */ @org.junit.Test public void k2DefaultNamespaceProlog10() { final XQuery query = new XQuery( "declare namespace a = \"http://www.example.com/\"; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0040") ); } /** * Ensure the default namespaces are correctly set. . */ @org.junit.Test public void k2DefaultNamespaceProlog11() { final XQuery query = new XQuery( " {1 cast as byte} {count(1)} {2 cast as byte} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("112", false) ); } /** * Ensure that default namespaces override each other properly. . */ @org.junit.Test public void k2DefaultNamespaceProlog12() { xquery10(); final XQuery query = new XQuery( " {1 cast as byte} {count(1), 2 cast as byte} {2 cast as byte} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0051") ); } /** * Ensure that default namespaces override each other properly. . */ @org.junit.Test public void k2DefaultNamespaceProlog12a() { final XQuery query = new XQuery( " {1 cast as byte} {count(1), 2 cast as byte} {2 cast as byte} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0052") ); } /** * Variables cannot occur before namespace declarations. . */ @org.junit.Test public void k2DefaultNamespaceProlog13() { final XQuery query = new XQuery( "declare variable $variable := 1; declare default element namespace \"http://example.com\"; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Variables cannot occur before namespace declarations. . */ @org.junit.Test public void k2DefaultNamespaceProlog14() { final XQuery query = new XQuery( "declare variable $variable := 1; declare default element namespace \"http://example.com\"; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Functions cannot occur before namespace declarations. . */ @org.junit.Test public void k2DefaultNamespaceProlog15() { final XQuery query = new XQuery( "declare function local:myFunc() { 1 }; declare default element namespace \"http://example.com\"; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Options cannot occur before namespace declarations. . */ @org.junit.Test public void k2DefaultNamespaceProlog16() { final XQuery query = new XQuery( "declare option local:myOption \"foo\"; declare default element namespace \"http://example.com\"; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Ensure that the right namespace binding is picked up. . */ @org.junit.Test public void k2DefaultNamespaceProlog17() { final XQuery query = new XQuery( "\n" + " declare default element namespace \"http://example.com/\"; \n" + " for $test as attribute(integer, xs:anyAtomicType) in (/@integer) \n" + " return data($test)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1") ); } /** * Ensure the 'default' keyword is parsed correctly. . */ @org.junit.Test public void k2DefaultNamespaceProlog18() { final XQuery query = new XQuery( "default eq default", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * 'xmlns' declarations on direct element constructors override the declared default element namespace. . */ @org.junit.Test public void k2DefaultNamespaceProlog2() { final XQuery query = new XQuery( "declare default element namespace \"http://example.com/defelementns\"; namespace-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://example.com/overriden") ); } /** * Syntax error in the keywords. . */ @org.junit.Test public void k2DefaultNamespaceProlog3() { final XQuery query = new XQuery( "default declare default element namespace b = \"http://www.example.com/\"; empty(/b:d/b:b)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntax error in the keywords(#2). . */ @org.junit.Test public void k2DefaultNamespaceProlog4() { final XQuery query = new XQuery( "declare default element namespace b = \"http://www.example.com/\"; empty(/b:d/b:b)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XPST0081") ) ); } /** * Syntax error in the keywords(#3). . */ @org.junit.Test public void k2DefaultNamespaceProlog5() { final XQuery query = new XQuery( "declare default element namespace b = \"http://www.example.com/\"; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Ensure the default element namespace is properly handled with default namespace attribute declarations. . */ @org.junit.Test public void k2DefaultNamespaceProlog6() { final XQuery query = new XQuery( "declare default element namespace \"http://example.com/\"; namespace-uri-from-QName(xs:QName(\"localName\")), { \" | \", namespace-uri-from-QName(xs:QName(\"localName\")) } , namespace-uri-from-QName(xs:QName(\"localName\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("http://example.com/ | http://example.com/", false) ); } /** * Use two default namespace declarations on the same element. . */ @org.junit.Test public void k2DefaultNamespaceProlog7() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0071") ); } /** * Use two default namespace declarations on the same element, but with different namespace URIs. . */ @org.junit.Test public void k2DefaultNamespaceProlog8() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0071") ); } /** * Use two namespace declarations on the same element, but with different namespace URIs. . */ @org.junit.Test public void k2DefaultNamespaceProlog9() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0071") ); } /** * Demonstrates Default namespace declaration, facilitates the use of unprefixed QNames . */ @org.junit.Test public void defaultNamespace001() { final XQuery query = new XQuery( "declare default function namespace \"http://www..oracle.com/xquery/test\"; declare function price ($b as element()) as element()* { $b/price }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Demonstrates Default namespace declaration, facilitates the use of unprefixed QNames . */ @org.junit.Test public void defaultNamespace002() { final XQuery query = new XQuery( "\n" + " declare default function namespace \"http://www..oracle.com/xquery/test\"; \n" + " declare function foo($n as xs:integer) { {$n} }; \n" + " foo(4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("4", false) ); } /** * Demonstrates Default namespace declaration, facilitates the use of unprefixed QNames . */ @org.junit.Test public void defaultNamespace003() { final XQuery query = new XQuery( "\n" + " declare default function namespace \"http://www..oracle.com/xquery/test\"; \n" + " declare function price ($i as element()) as element()? { $i/price }; \n" + " for $j in /bib/book return price($j)\n" + " ", ctx); try { query.context(node(file("docs/bib.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("65.9565.9539.95129.95", false) ); } /** * Demonstrates Default namespace declaration, facilitates the use of unprefixed QNames . */ @org.junit.Test public void defaultNamespace004() { final XQuery query = new XQuery( "\n" + " declare default function namespace \"http://example.org\"; \n" + " declare function summary($emps as element(employee)*) as element(dept)* { \n" + " for $d in fn:distinct-values($emps/deptno) \n" + " let $e := $emps[deptno = $d] \n" + " return {$d} {fn:count($e)} {fn:sum($e/salary)} \n" + " }; \n" + " summary(//employee[location = \"Denver\"])", ctx); try { query.context(node(file("op/union/acme_corp.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("121300002180000", false) ); } /** * Demonstrates Default namespace declaration, facilitates the use of unprefixed QNames . */ @org.junit.Test public void defaultNamespace005() { final XQuery query = new XQuery( "\n" + " \tdeclare default function namespace \"http://example.org\"; \n" + " \tdeclare function mysum($i as xs:integer, $j as xs:integer) { let $j := $i + $j return $j }; \n" + " \tdeclare function invoke_mysum() { let $s := 1 for $d in (1,2,3,4,5) let $s := mysum($s, $d) return $s }; \n" + " \tinvoke_mysum()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2 3 4 5 6") ); } /** * Demonstrates Default namespace declaration, facilitates the use of unprefixed QNames . */ @org.junit.Test public void defaultNamespace006() { final XQuery query = new XQuery( "\n" + " \tdeclare default function namespace \"http://example.org\"; \n" + " \tdeclare function mysum($i as xs:integer, $j as xs:integer) { let $j := $i + $j return $j }; \n" + " \tdeclare function invoke_mysum($st) { for $d in (1,2,3,4,5) let $st := mysum($d, $st) return $st }; \n" + " \tinvoke_mysum(0)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 4 5") ); } /** * Demonstrates Default namespace declaration, facilitates the use of unprefixed QNames . */ @org.junit.Test public void defaultNamespace007() { final XQuery query = new XQuery( "\n" + " \tdeclare default function namespace \"http://example.org\"; \n" + " \tdeclare variable $a := 1; \n" + " \tdeclare function foo($a as xs:integer) { if ($a > 100) then $a else let $a := $a + 1 return foo($a) }; \n" + " \tfoo($a)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("101") ); } /** * Demonstrates Default namespace declaration, facilitates the use of unprefixed QNames . */ @org.junit.Test public void defaultNamespace008() { final XQuery query = new XQuery( "\n" + " \tdeclare default function namespace \"http://example.org\"; \n" + " \tdeclare function fact($n as xs:integer) as xs:integer { if ($n < 2) then 1 else $n * fact($n - 1) }; \n" + " \tdeclare variable $ten := fact(10); \n" + " \t { for $i in 1 to 10 return }
    10!/{$i}! = {$ten div fact($i)}
    \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("
    10!/1! = 3628800
    10!/2! = 1814400
    10!/3! = 604800
    10!/4! = 151200
    10!/5! = 30240
    10!/6! = 5040
    10!/7! = 720
    10!/8! = 90
    10!/9! = 10
    10!/10! = 1
    ", false) ); } /** * Demonstrates Default namespace declaration, facilitates the use of unprefixed QNames . */ @org.junit.Test public void defaultNamespace009() { final XQuery query = new XQuery( "\n" + " \tdeclare default function namespace \"http://example.org\"; \n" + " \tdeclare function fact($n as xs:integer) as xs:integer { if ($n < 2) then 1 else $n * fact(($n)-1) }; \n" + " \t { for $i in 1 to 10 return }
    {$i}! = {fact($i)}
    \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("
    1! = 1
    2! = 2
    3! = 6
    4! = 24
    5! = 120
    6! = 720
    7! = 5040
    8! = 40320
    9! = 362880
    10! = 3628800
    ", false) ); } /** * Demonstrates Default namespace declaration, facilitates the use of unprefixed QNames . */ @org.junit.Test public void defaultNamespace010() { final XQuery query = new XQuery( "\n" + " declare default function namespace \"http://example.org\"; \n" + " declare function prnt($n as xs:integer,$n2 as xs:string, $n3 as xs:date, $n4 as xs:long, $n5 as xs:string, $n6 as xs:decimal) {\n" + " if ($n < 2) then 1 else fn:concat($n, \" \",$n2,\" \",$n3,\" \",$n4,\" \",$n5,\" \",$n6) \n" + " }; \n" + " { }
    Value is = {prnt(4,xs:string(\"hello\"),xs:date(\"2005-02-22\"), xs:long(5),xs:string(\"well\"),xs:decimal(1.2))}
    \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("
    Value is = 4 hello 2005-02-22 5 well 1.2
    ", false) ); } /** * Demonstrates Default namespace declaration, facilitates the use of unprefixed QNames . */ @org.junit.Test public void defaultNamespace011() { final XQuery query = new XQuery( "\n" + " \tdeclare default function namespace \"http://example.org\"; \n" + " \tdeclare function fn1 ($n as xs:integer) as xs:integer { fn2($n) }; \n" + " \tdeclare function fn2 ($n as xs:integer) as xs:integer { if ($n = 1) then 1 else $n + fn1($n - 1) }; \n" + " \tfn1(4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Demonstrates Default namespace declaration, facilitates the use of unprefixed QNames . */ @org.junit.Test public void defaultNamespace012() { final XQuery query = new XQuery( "\n" + " \tdeclare default function namespace \"http://example.org\"; \n" + " \tdeclare function fn1 ($n as xs:integer) as xs:integer { fn2($n) }; \n" + " \tdeclare function fn2 ($n as xs:integer) as xs:integer { if ($n = 1) then 1 else $n + fn1($n - 1) }; \n" + " \tfn1(4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Demonstrates Default namespace declaration, facilitates the use of unprefixed QNames . */ @org.junit.Test public void defaultNamespace013() { final XQuery query = new XQuery( "\n" + " \tdeclare default function namespace \"http://example.org\"; \n" + " \tdeclare function foo2($i as xs:string) as xs:string {foo($i)}; \n" + " \tdeclare function foo($i as xs:string) as xs:string {$i}; \n" + " \tfoo2(\"abc\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc") ); } /** * Demonstrates Default namespace declaration, facilitates the use of unprefixed QNames . */ @org.junit.Test public void defaultNamespace014() { final XQuery query = new XQuery( "\n" + " \tdeclare default function namespace \"http://example.org\"; \n" + " \tdeclare function odd($x as xs:integer) as xs:boolean {if ($x = 0) then fn:false() else even($x - 1)}; \n" + " \tdeclare function even($x as xs:integer) as xs:boolean {if ($x = 0) then fn:true() else odd($x - 1)}; \n" + " \teven(4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Demonstrates Default namespace declaration, facilitates the use of unprefixed QNames . */ @org.junit.Test public void defaultNamespace015() { final XQuery query = new XQuery( "\n" + " \tdeclare default function namespace \"http://example.org\"; \n" + " \tdeclare function odd($x as xs:integer) as xs:boolean {if ($x = 0) then fn:false() else even($x - 1)}; \n" + " \tdeclare function even($x as xs:integer) as xs:boolean {if ($x = 0) then fn:true() else odd($x - 1)}; \n" + " \teven(3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Demonstrates Default namespace declaration, facilitates the use of unprefixed QNames . */ @org.junit.Test public void defaultNamespace016() { final XQuery query = new XQuery( "\n" + " declare default function namespace \"http://example.org\"; \n" + " declare function title($a_book as element()) as element()* { for $i in $a_book return $i/title }; \n" + " /bib/book/(title(.))", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("TCP/IP IllustratedAdvanced Programming in the Unix environmentData on the WebThe Economics of Technology and Content for Digital TV", false) ); } /** * Demonstrates Default namespace declaration, facilitates the use of unprefixed QNames . */ @org.junit.Test public void defaultNamespace017() { final XQuery query = new XQuery( "\n" + " declare default function namespace \"http://example.org\"; \n" + " declare default element namespace \"http://www.example.com/filesystem\"; \n" + " declare variable $v as xs:integer := 100; \n" + " declare function udf1 ($CUSTNO as xs:integer) { {$CUSTNO*$v} }; \n" + " udf1(10)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1000", false) ); } /** * Demonstrates Default namespace declaration, facilitates the use of unprefixed QNames . */ @org.junit.Test public void defaultNamespace018() { final XQuery query = new XQuery( "\n" + " declare default function namespace \"http://example.org\"; \n" + " declare default element namespace \"http://www.example.com/filesystem\"; \n" + " declare function udf1 () { {10*10} }; \n" + " udf1 ()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("100", false) ); } /** * Demonstrates Default namespace declaration, facilitates the use of unprefixed QNames . */ @org.junit.Test public void defaultNamespace019() { final XQuery query = new XQuery( "\n" + " declare default function namespace \"http://example.org\"; \n" + " declare default element namespace \"http://www.example.com/def\"; \n" + " declare namespace test=\"http://www.example.com/test\"; \n" + " declare namespace test2=\"http://www.example.com/test2\"; \n" + " declare function test:udf1() { {10*10} }; \n" + " declare function test2:udf1() { }; \n" + " {test:udf1()} {test2:udf1()} \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("100", false) ); } /** * Demonstrates Default namespace declaration, facilitates the use of unprefixed QNames . */ @org.junit.Test public void defaultNamespace020() { final XQuery query = new XQuery( "\n" + " \tdeclare default function namespace \"http://example.org\"; \n" + " \tdeclare function price () as xs:integer+ { 100 }; \n" + " \tdeclare function price ($z as xs:integer) as xs:integer+ { $z }; \n" + " \tdeclare function price ($x as xs:integer, $y as xs:integer) as xs:integer+ { $x, $y }; \n" + " \tdeclare function price ($x as xs:integer, $y as xs:integer, $z as xs:integer) as xs:integer+ { $x+$y+$z }; \n" + " \tprice(), price(1), price(2,3), price(4,5,6)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "100 1 2 3 15") ); } /** * Demonstrates Default namespace declaration, facilitates the use of unprefixed QNames . */ @org.junit.Test public void defaultNamespace021() { final XQuery query = new XQuery( "\n" + " declare default element namespace \"http:/www.oracle.com/xquery\"; \n" + " declare variable $x := 7.5; \n" + " $x + 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "9.5") ); } /** * Demonstrates Default namespace declaration, facilitates the use of unprefixed QNames . */ @org.junit.Test public void defaultNamespace022() { final XQuery query = new XQuery( "\n" + " declare default element namespace \"http://www.example.com/test\"; \n" + " \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Evaluation of the of a query prolog with two default namespace declarations. . */ @org.junit.Test public void defaultnamespacedeclerr1() { final XQuery query = new XQuery( "\n" + " declare default element namespace \"http://example.org/names\"; \n" + " declare default element namespace \"http://someexample.org/names\"; \n" + " \"abc\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0066") ); } /** * Evaluation of the of a query prolog with two default namespace declarations. . */ @org.junit.Test public void defaultnamespacedeclerr2() { final XQuery query = new XQuery( "\n" + " declare default function namespace \"http://example.org/names\"; \n" + " declare default function namespace \"http://someexample.org/names\"; \n" + " \"abc\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0066") ); } /** * Invalid use of XML namespace as default. See bug 14930. . */ @org.junit.Test public void defaultnamespacedeclerr3() { final XQuery query = new XQuery( "\n" + " declare default element namespace \"http://www.w3.org/XML/1998/namespace\";\n" + " \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0070") ); } /** * Invalid use of XML namespace as default. See bug 14930. . */ @org.junit.Test public void defaultnamespacedeclerr4() { final XQuery query = new XQuery( "\n" + " declare default function namespace \"http://www.w3.org/XML/1998/namespace\";\n" + " declare function go() {3};\n" + " go()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0070") ); } /** * Invalid use of XMLNS namespace as default. See bug 14930. . */ @org.junit.Test public void defaultnamespacedeclerr5() { final XQuery query = new XQuery( "\n" + " declare default element namespace \"http://www.w3.org/2000/xmlns/\";\n" + " \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0070") ); } /** * Invalid use of XMLNS namespace as default. See bug 14930. . */ @org.junit.Test public void defaultnamespacedeclerr6() { final XQuery query = new XQuery( "\n" + " declare default function namespace \"http://www.w3.org/2000/xmlns/\";\n" + " declare function go() {3};\n" + " go()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0070") ); } /** * Invalid use of XMLNS namespace as default, with escaping. See bug 14930. . */ @org.junit.Test public void defaultnamespacedeclerr7() { final XQuery query = new XQuery( "\n" + " declare default element namespace \"http://www.w3.org/2000/xmlns/\";\n" + " \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0070") ); } /** * Invalid use of XMLNS namespace as default, with escaping. See bug 14930. . */ @org.junit.Test public void defaultnamespacedeclerr8() { final XQuery query = new XQuery( "\n" + " declare default function namespace \"http://www.w3.org/2000/xmlns/\";\n" + " declare function go() {3};\n" + " go()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0070") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdDirAttributeList.java000066400000000000000000001651761222453003200314130ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the DirAttributeList production (the list of attributes in a direct element constructor). * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdDirAttributeList extends QT3TestSet { /** * character references in attribute content . */ @org.junit.Test public void constrAttrCharref1() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Direct attribute content characters . */ @org.junit.Test public void constrAttrContent1() { final XQuery query = new XQuery( ":;\"/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("", false) || assertSerialization(":;\"/>", false) ) ); } /** * Illegal attribute content "{" . */ @org.junit.Test public void constrAttrContent2() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Illegal attribute content "}" . */ @org.junit.Test public void constrAttrContent3() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Illegal attribute content "<" . */ @org.junit.Test public void constrAttrContent4() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Illegal attribute content "&" . */ @org.junit.Test public void constrAttrContent5() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * attributes with identical local names . */ @org.junit.Test public void constrAttrDistnames1() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0040") ); } /** * attributes with identical local names . */ @org.junit.Test public void constrAttrDistnames2() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0040") ); } /** * attributes with identical local names . */ @org.junit.Test public void constrAttrDistnames3() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0040") ); } /** * attributes with identical local name and URI . */ @org.junit.Test public void constrAttrDistnames4() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0040") ); } /** * enclosed expression in attribute content - atomic values . */ @org.junit.Test public void constrAttrEnclexpr1() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * enclosed expression in attribute content - nodes . */ @org.junit.Test public void constrAttrEnclexpr2() { final XQuery query = new XQuery( "123, ()/@attr, (789)/text()}\"/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * enclosed expression in attribute content - empty string . */ @org.junit.Test public void constrAttrEnclexpr3() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * enclosed expression in attribute content - empty node . */ @org.junit.Test public void constrAttrEnclexpr4() { final XQuery query = new XQuery( ",2}\"/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * enclosed expression in attribute content - mix direct content and enclosed expressions . */ @org.junit.Test public void constrAttrEnclexpr5() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * enclosed expression in attribute content - mix direct content and enclosed expressions . */ @org.junit.Test public void constrAttrEnclexpr6() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * enclosed expression in attribute content - mix direct content and enclosed expressions . */ @org.junit.Test public void constrAttrEnclexpr7() { final XQuery query = new XQuery( "7}{8}9\"/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Author: Oliver Hallam Multiple content units in attribute content. . */ @org.junit.Test public void constrAttrEnclexpr8() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * entity references in attribute content . */ @org.junit.Test public void constrAttrEntref1() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * entity references in attribute content . */ @org.junit.Test public void constrAttrEntref2() { final XQuery query = new XQuery( "fn:string-length(string(()/@attr))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * attribute xml:id - content is ncname . */ @org.junit.Test public void constrAttrId1() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * attribute xml:id - content is to be further normalized . */ @org.junit.Test public void constrAttrId2() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("", false) || error("XQDY0091") ) ); } /** * namespace declaration does not count as attribute . */ @org.junit.Test public void constrAttrNsdecl1() { final XQuery query = new XQuery( "fn:count(()/@*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * namespace default declaration does not count as attribute . */ @org.junit.Test public void constrAttrNsdecl2() { final XQuery query = new XQuery( "fn:count(()/@*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * attribute prefix declared in prolog . */ @org.junit.Test public void constrAttrNspre1() { final XQuery query = new XQuery( "declare namespace foo=\"http://www.w3.org/XQueryTest/Construct\"; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * attribute prefix declared in parent element . */ @org.junit.Test public void constrAttrNspre2() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * attribute prefix declared in same element before . */ @org.junit.Test public void constrAttrNsprein1() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * attribute prefix declared in same element after . */ @org.junit.Test public void constrAttrNsprein2() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * namespace prefix used in content before it is declared . */ @org.junit.Test public void constrAttrNsprein3() { final XQuery query = new XQuery( "/namespace-uri()}\" xmlns:p=\"http://ns.example.com/uri\"/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * namespace prefix used deeply nested in content before it is declared . */ @org.junit.Test public void constrAttrNsprein4() { final XQuery query = new XQuery( "/namespace-uri()}\">/@a3}\">/@a2}\" \n" + " xmlns:p=\"http://ns.example.com/uri\"/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Attribute parent element . */ @org.junit.Test public void constrAttrParent1() { final XQuery query = new XQuery( "for $x in return $x is $x/@attr/..", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Single attribute . */ @org.junit.Test public void constrAttrSyntax1() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Whitespace after last attribute . */ @org.junit.Test public void constrAttrSyntax10() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Multiple attributes . */ @org.junit.Test public void constrAttrSyntax2() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Single quotes for attribute . */ @org.junit.Test public void constrAttrSyntax3() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Escaped single quote . */ @org.junit.Test public void constrAttrSyntax4() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Escaped double quote . */ @org.junit.Test public void constrAttrSyntax5() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Mismatched quotes . */ @org.junit.Test public void constrAttrSyntax6() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Whitespace between attributes . */ @org.junit.Test public void constrAttrSyntax8() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Whitespace in attribute definition . */ @org.junit.Test public void constrAttrSyntax9() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Attribute normalization line feed . */ @org.junit.Test public void constrAttrWs1() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Attribute normalization tab . */ @org.junit.Test public void constrAttrWs2() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Attribute normalization char ref . */ @org.junit.Test public void constrAttrWs3() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Attribute normalization char ref . */ @org.junit.Test public void constrAttrWs4() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Attribute normalization char ref . */ @org.junit.Test public void constrAttrWs5() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Namespace declaration attributes in direct element constructors. . */ @org.junit.Test public void directConElemAttr1() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Namespace declaration attributes in direct element constructors. . */ @org.junit.Test public void directConElemAttr2() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Comments cannot appear inside direct element constructors. a misplaced comment . */ @org.junit.Test public void k2DirectConElemAttr1() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntax error in direct attribute constructor. . */ @org.junit.Test public void k2DirectConElemAttr10() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntax error in direct attribute constructor. . */ @org.junit.Test public void k2DirectConElemAttr11() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntax error in direct attribute constructor. . */ @org.junit.Test public void k2DirectConElemAttr12() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntax error in direct attribute constructor. . */ @org.junit.Test public void k2DirectConElemAttr13() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntax error in direct attribute constructor. . */ @org.junit.Test public void k2DirectConElemAttr17() { final XQuery query = new XQuery( "\"/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntax error in direct attribute constructor. . */ @org.junit.Test public void k2DirectConElemAttr19() { final XQuery query = new XQuery( "\"/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Comments cannot appear inside direct element constructors. a misplaced comment . */ @org.junit.Test public void k2DirectConElemAttr2() { final XQuery query = new XQuery( "<(:a misplaced comment:)ncname/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntax error in direct attribute constructor. . */ @org.junit.Test public void k2DirectConElemAttr20() { final XQuery query = new XQuery( "\"/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntax error in direct attribute constructor. . */ @org.junit.Test public void k2DirectConElemAttr21() { final XQuery query = new XQuery( "\"/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntax error in direct attribute constructor. . */ @org.junit.Test public void k2DirectConElemAttr22() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntax error in direct attribute constructor. . */ @org.junit.Test public void k2DirectConElemAttr24() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Attribute containing two quotes(#2). . */ @org.junit.Test public void k2DirectConElemAttr30() { final XQuery query = new XQuery( "string(/@attr)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "\"\"") ); } /** * Attribute containing two apostrophes. . */ @org.junit.Test public void k2DirectConElemAttr31() { final XQuery query = new XQuery( "string(/@attr)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "''") ); } /** * Attribute containing two apostrophes(#2). . */ @org.junit.Test public void k2DirectConElemAttr32() { final XQuery query = new XQuery( "string(/@attr)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "'") ); } /** * Test that simple content computation is done properly with complex input sequence. . */ @org.junit.Test public void k2DirectConElemAttr33() { final XQuery query = new XQuery( "a, b, c, 1, 2, 3}y\"/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Extract the string value from a directly constructed attribute whose content consists of a computed comment constructor. . */ @org.junit.Test public void k2DirectConElemAttr34() { final XQuery query = new XQuery( "string(/@attr)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, " content ") ); } /** * Extract the string value from a directly constructed attribute whose content consists of a computed comment constructor. . */ @org.junit.Test public void k2DirectConElemAttr35() { final XQuery query = new XQuery( "local-name(/@attr)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "attr") ); } /** * Extract the string value from a directly constructed attribute whose content consists of a computed processing-instruction constructor. . */ @org.junit.Test public void k2DirectConElemAttr36() { final XQuery query = new XQuery( "string(/@attr)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "content ") ); } /** * Extract the local-name from a directly constructed attribute whose content consists of a computed processing-instruction constructor. . */ @org.junit.Test public void k2DirectConElemAttr37() { final XQuery query = new XQuery( "local-name(/@attr)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "attr") ); } /** * Extract the string value from a directly constructed attribute whose content consists of a computed attribute constructor. . */ @org.junit.Test public void k2DirectConElemAttr38() { final XQuery query = new XQuery( "local-name(/@attr)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "attr") ); } /** * Extract the string value from a directly constructed attribute whose content consists of a computed attribute constructor. . */ @org.junit.Test public void k2DirectConElemAttr39() { final XQuery query = new XQuery( "string(/@attr)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, " content ") ); } /** * Comments are not allowed where whitespace is, in direct element constructors. . */ @org.junit.Test public void k2DirectConElemAttr4() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XQST0118") ) ); } /** * Attributes with many apostrophes and quotes. . */ @org.junit.Test public void k2DirectConElemAttr40() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * A direct attribute constructor taking a direct element constructor as input. . */ @org.junit.Test public void k2DirectConElemAttr41() { final XQuery query = new XQuery( "}\"/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * A direct attribute constructor taking a direct comment constructor as input. . */ @org.junit.Test public void k2DirectConElemAttr42() { final XQuery query = new XQuery( "}\"/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * A direct attribute constructor taking a direct PI constructor as input. . */ @org.junit.Test public void k2DirectConElemAttr43() { final XQuery query = new XQuery( "}\"/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * xml:base attributes do not affect the static base-uri. . */ @org.junit.Test public void k2DirectConElemAttr44() { final XQuery query = new XQuery( "declare base-uri \"http://example.com/level/file.ext\"; { static-base-uri()}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("http://example.com/level/file.ext", false) ); } /** * xml:base attributes do not affect the static base-uri(#2). . */ @org.junit.Test public void k2DirectConElemAttr45() { final XQuery query = new XQuery( "declare base-uri \"http://example.com/level/file.ext\"; { static-base-uri()}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("http://example.com/level/file.ext", false) ); } /** * Copy attributes from one element to another. . */ @org.junit.Test public void k2DirectConElemAttr46() { final XQuery query = new XQuery( " { /@* } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Ensure the typed value of directly constructed attributes has the correct type. . */ @org.junit.Test public void k2DirectConElemAttr47() { final XQuery query = new XQuery( "data(/@*) instance of xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * There must be space between attributes. . */ @org.junit.Test public void k2DirectConElemAttr48() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A newline is a valid separator between two attributes. . */ @org.junit.Test public void k2DirectConElemAttr49() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Whitespace is allowed in the end tag after the QName. . */ @org.junit.Test public void k2DirectConElemAttr5() { final XQuery query = new XQuery( "content = 'content'", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A tab is a valid separator between two attributes. . */ @org.junit.Test public void k2DirectConElemAttr50() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * There must be space between attributes(using apostrophes). . */ @org.junit.Test public void k2DirectConElemAttr51() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A tab is a valid separator between two attributes(using apostrophes). . */ @org.junit.Test public void k2DirectConElemAttr52() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * '/' is an invalid separator between two attributes. . */ @org.junit.Test public void k2DirectConElemAttr53() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * '/' is an invalid separator between two attributes(using apostrophes). . */ @org.junit.Test public void k2DirectConElemAttr54() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * '/' is an invalid separator between two attributes. . */ @org.junit.Test public void k2DirectConElemAttr55() { final XQuery query = new XQuery( "a=\"1\"/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * '/' is an invalid separator between two attributes(using apostrophes). . */ @org.junit.Test public void k2DirectConElemAttr56() { final XQuery query = new XQuery( "a='1'/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * End unexpectedly inside a direct element constructor. . */ @org.junit.Test public void k2DirectConElemAttr57() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0118") ); } /** * End unexpectedly inside a direct element constructor(#4). . */ @org.junit.Test public void k2DirectConElemAttr60() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0071") ); } /** * Use two namespace declarations with the same name, in addition to doing invalid bindings. . */ @org.junit.Test public void k2DirectConElemAttr69() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0071") ); } /** * CDATA sections can only appear inside element constructors. . */ @org.junit.Test public void k2DirectConElemAttr7() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Ensure that attributes constructed with direct constructors doesn't pick up the default namespace. . */ @org.junit.Test public void k2DirectConElemAttr70() { final XQuery query = new XQuery( "declare default element namespace \"http://typedecl\"; namespace-uri-from-QName(node-name(exactly-one(/@attr))) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that attributes constructed with computed constructors doesn't pick up the default namespace. . */ @org.junit.Test public void k2DirectConElemAttr71() { final XQuery query = new XQuery( "declare default element namespace \"http://typedecl\"; namespace-uri-from-QName(node-name(exactly-one({attribute attr {()} }//@attr))) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that attributes constructed with computed constructors doesn't pick up the default namespace. . */ @org.junit.Test public void k2DirectConElemAttr72() { final XQuery query = new XQuery( "namespace-uri-from-QName(node-name(exactly-one({attribute attr {()} }//@attr))) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that attributes constructed with computed constructors doesn't pick up the default namespace(#2). . */ @org.junit.Test public void k2DirectConElemAttr73() { final XQuery query = new XQuery( "declare default element namespace \"http://example.com/\"; namespace-uri-from-QName(node-name(attribute e {()})) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that character references next to embedded expressions are parsed correctly. . */ @org.junit.Test public void k2DirectConElemAttr74() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Mix several ways for creating text for various kinds of nodes. This test is useful if an implementation is performing normalization of such constructors. . */ @org.junit.Test public void k2DirectConElemAttr75() { final XQuery query = new XQuery( queryFile( file( "prod/DirAttributeList/K2-DirectConElemAttr-75.xq" ) ), ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("a text nodea text nodeabc defa text nodeghi 1 2a text node3 abca text nodedef ghi FF abc def ghi\ntextNode\nxs:string\ntextNode\nxs:string\ntextNode\nxs:stringxs:stringxs:string\ntext a text node,\ntext a text node,\ntext a text node,\ntext a text node,\n\na text node a text node a text node a text node abc def ghi 1 2 a text node 3 abc a text node def ghi FF abc def ghi xs:string xs:string ghi xs:string xs:string ghi xs:string a text node", false) ); } /** * Pass text nodes through a function and variable, into AVTs. . */ @org.junit.Test public void k2DirectConElemAttr76() { final XQuery query = new XQuery( "\n" + " declare function local:t() { text{\"\"}, text{\"[\"}, text{\"3\"}, text{\"]\"}, text{\"\"} }; \n" + " declare variable $var := (text{\"\"}, text{\"[\"}, text{\"3\"}, text{\"]\"}, text{\"\"}); \n" + " \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Syntax error in direct attribute constructor. . */ @org.junit.Test public void k2DirectConElemAttr8() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntax error in direct attribute constructor. . */ @org.junit.Test public void k2DirectConElemAttr9() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdDirElemConstructor.java000066400000000000000000000741701222453003200317350ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the DirElemConstructor (Direct Element Constructor) production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdDirElemConstructor extends QT3TestSet { /** * Element constructor with open curly brace . */ @org.junit.Test public void constrElemCurlybr1() { final XQuery query = new XQuery( "{{", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("{", false) ); } /** * Element constructor with closing curly brace . */ @org.junit.Test public void constrElemCurlybr2() { final XQuery query = new XQuery( "}}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("}", false) ); } /** * Character reference for open curly brace . */ @org.junit.Test public void constrElemCurlybr3() { final XQuery query = new XQuery( "{", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("{", false) ); } /** * Character reference for closing curly brace . */ @org.junit.Test public void constrElemCurlybr4() { final XQuery query = new XQuery( "}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("}", false) ); } /** * Single open curly brace . */ @org.junit.Test public void constrElemCurlybr5() { final XQuery query = new XQuery( "{", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Single closing curly brace . */ @org.junit.Test public void constrElemCurlybr6() { final XQuery query = new XQuery( "}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Empty element constructor . */ @org.junit.Test public void constrElemEmpty1() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Empty element constructor with closing tag . */ @org.junit.Test public void constrElemEmpty2() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Number of child nodes for empty element . */ @org.junit.Test public void constrElemEmpty3() { final XQuery query = new XQuery( "fn:count(()/node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Number of child nodes for empty element . */ @org.junit.Test public void constrElemEmpty4() { final XQuery query = new XQuery( "fn:count(()/node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("0") || error("XPST0005") ) ); } /** * Whitespace in element constructor . */ @org.junit.Test public void constrElemEmpty5() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Begin tag matches end tag . */ @org.junit.Test public void constrElemMatchtag1() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0118") ); } /** * Begin tag matches end tag with namespace prefix . */ @org.junit.Test public void constrElemMatchtag2() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0118") ); } /** * Ensure processing-instructions aren't included when extracting the string-value from elements. . */ @org.junit.Test public void k2DirectConElem1() { final XQuery query = new XQuery( "string({}) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Syntax error in direct element constructor. . */ @org.junit.Test public void k2DirectConElem10() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntax error in direct element constructor. . */ @org.junit.Test public void k2DirectConElem12() { final XQuery query = new XQuery( "<<<\"/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntax error in direct element constructor. . */ @org.junit.Test public void k2DirectConElem13() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntactically invalid direct element constructor. . */ @org.junit.Test public void k2DirectConElem14() { final XQuery query = new XQuery( " content}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntactically invalid direct element constructor. . */ @org.junit.Test public void k2DirectConElem15() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0118") ); } /** * Syntactically invalid direct element constructor. . */ @org.junit.Test public void k2DirectConElem16() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntactically invalid direct element constructor. . */ @org.junit.Test public void k2DirectConElem17() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntactically invalid direct element constructor. . */ @org.junit.Test public void k2DirectConElem18() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntactically invalid direct element constructor. . */ @org.junit.Test public void k2DirectConElem19() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Ensure comments aren't included when extracting the string-value from elements. . */ @org.junit.Test public void k2DirectConElem2() { final XQuery query = new XQuery( "string(1234567) eq \"1234567\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Syntactically invalid direct element constructor. . */ @org.junit.Test public void k2DirectConElem20() { final XQuery query = new XQuery( "<", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntactically invalid direct element constructor. . */ @org.junit.Test public void k2DirectConElem21() { final XQuery query = new XQuery( "<[", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntactically invalid direct element constructor. . */ @org.junit.Test public void k2DirectConElem22() { final XQuery query = new XQuery( "&", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Enclosed expressions aren't allowed inside element constructors. . */ @org.junit.Test public void k2DirectConElem25() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Enclosed expressions aren't allowed inside element constructors.(#2). . */ @org.junit.Test public void k2DirectConElem26() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Enclosed expressions aren't allowed inside element constructors.(#3). . */ @org.junit.Test public void k2DirectConElem27() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A simple direct element constructor. . */ @org.junit.Test public void k2DirectConElem28() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Serialize a sequence of direct element constructors. . */ @org.junit.Test public void k2DirectConElem29() { final XQuery query = new XQuery( "a, b, c", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("abc", false) ); } /** * Syntax error in direct element constructor. . */ @org.junit.Test public void k2DirectConElem3() { final XQuery query = new XQuery( "<", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Serialize a couple of element constructors. . */ @org.junit.Test public void k2DirectConElem30() { final XQuery query = new XQuery( "some textsome text", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("some textsome text", false) ); } /** * A couple of simple elements. . */ @org.junit.Test public void k2DirectConElem31() { final XQuery query = new XQuery( " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * A couple of simple elements(#2). . */ @org.junit.Test public void k2DirectConElem32() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * A couple of simple elements(#3). . */ @org.junit.Test public void k2DirectConElem33() { final XQuery query = new XQuery( " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * An element with a computed attribute and element. . */ @org.junit.Test public void k2DirectConElem34() { final XQuery query = new XQuery( " {attribute name {\"content\"}} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Bind the 'xml' namespace URI to an invalid prefix. . */ @org.junit.Test public void k2DirectConElem35() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0070") ); } /** * Bind the 'xml' namespace URI to an invalid prefix(#2). . */ @org.junit.Test public void k2DirectConElem36() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0070") ); } /** * Bind the 'xml' namespace URI to an invalid prefix(#3). . */ @org.junit.Test public void k2DirectConElem37() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0070") ); } /** * Bind the 'xml' namespace URI to a valid prefix. The output doesn't expect the declaration because the c14n specification ignores declarations of the xml prefix if it binds to the XML namespace(see section 2.3). In either case, serializing this declaration is redundant. See the public report #4217 in W3C's Bugzilla database. . */ @org.junit.Test public void k2DirectConElem38() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Bind the 'xmlns' namespace URI to an invalid prefix(#3). . */ @org.junit.Test public void k2DirectConElem39() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0070") ); } /** * Syntax error in direct element constructor. . */ @org.junit.Test public void k2DirectConElem4() { final XQuery query = new XQuery( "< foo/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Bind the 'xmlns' namespace URI to an invalid prefix(#3). . */ @org.junit.Test public void k2DirectConElem40() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0070") ); } /** * Bind the 'xmlns' namespace URI to an invalid prefix(#3). . */ @org.junit.Test public void k2DirectConElem41() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0070") ); } /** * Use a content sequence that is a strange combination of a computed document constructor and a path. . */ @org.junit.Test public void k2DirectConElem42() { final XQuery query = new XQuery( " { document{()}/(/) } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Use a content sequence that is a computed document constructor. . */ @org.junit.Test public void k2DirectConElem43() { final XQuery query = new XQuery( " { document{()} } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Extract the string value of a single element node. . */ @org.junit.Test public void k2DirectConElem44() { final XQuery query = new XQuery( "string(text)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "text") ); } /** * Extract the typed value of a single element node. . */ @org.junit.Test public void k2DirectConElem45() { final XQuery query = new XQuery( "data(text)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "text") ); } /** * Use an element constructor that use a namespace declare in a prolog declaration. . */ @org.junit.Test public void k2DirectConElem46() { final XQuery query = new XQuery( "declare namespace p = \"http://www.example.com/\"; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Use content that needs to be escaped, inside namespace declaration attributes. . */ @org.junit.Test public void k2DirectConElem47() { final XQuery query = new XQuery( "let $in := return {for $n in $in/*/namespace-uri(.) return }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("", false) || error("XQST0046") || error("XQST0022") ) ); } /** * In XQuery, as opposed to XML, the sequence ]]< is allowed in element content. . */ @org.junit.Test public void k2DirectConElem48() { final XQuery query = new XQuery( "]]>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "]]>") ); } /** * In XQuery, as opposed to XML, the sequence ]]< is allowed in attribute content. . */ @org.junit.Test public void k2DirectConElem49() { final XQuery query = new XQuery( "\"/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\"/>", false) ); } /** * Syntax error in direct element constructor. . */ @org.junit.Test public void k2DirectConElem5() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Character < cannot appear in attributes. . */ @org.junit.Test public void k2DirectConElem50() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Ensure that whitespace normalization of xml:id is performed. . */ @org.junit.Test public void k2DirectConElem51() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Output sharp S. . */ @org.junit.Test public void k2DirectConElem52() { final XQuery query = new XQuery( "ß", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("ß", false) ); } /** * There is no 'namespace' constructor in XQuery 1.0. . */ @org.junit.Test public void k2DirectConElem53() { xquery10(); final XQuery query = new XQuery( "namespace {\"p\"} {\"abc\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * There is a 'namespace' constructor in XQuery 3.0. . */ @org.junit.Test public void k2DirectConElem53a() { final XQuery query = new XQuery( "namespace {\"p\"} {\"abc\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertType("namespace-node()") && assertStringValue(false, "abc") ) ); } /** * There is no 'namespace-node' constructor in XQuery. . */ @org.junit.Test public void k2DirectConElem54() { final XQuery query = new XQuery( "namespace-node {\"p\"} {\"abc\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntax error in direct element constructor. . */ @org.junit.Test public void k2DirectConElem6() { final XQuery query = new XQuery( "< foo>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntax error in direct element constructor. . */ @org.junit.Test public void k2DirectConElem7() { final XQuery query = new XQuery( "< /foo>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntax error in direct element constructor. . */ @org.junit.Test public void k2DirectConElem8() { final XQuery query = new XQuery( "a{1,2,3}b)/text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * two text nodes in element content . */ @org.junit.Test public void constrContAdjtext2() { final XQuery query = new XQuery( "count((a{1,,3}b)/text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * strip empty text node . */ @org.junit.Test public void constrContAdjtext3() { final XQuery query = new XQuery( "count(({''})/text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * no text node for empty sequence constructed . */ @org.junit.Test public void constrContAdjtext4() { final XQuery query = new XQuery( "count(({()})/text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * attribute node following atomic value . */ @org.junit.Test public void constrContAttr1() { final XQuery query = new XQuery( "{1, //west/@mark}", ctx); try { query.context(node(file("prod/AxisStep/TopMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * attribute node following node . */ @org.junit.Test public void constrContAttr2() { final XQuery query = new XQuery( "{//west/@mark}", ctx); try { query.context(node(file("prod/AxisStep/TopMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * attribute node following empty sequence . */ @org.junit.Test public void constrContAttr3() { final XQuery query = new XQuery( "{()}{//west/@mark}", ctx); try { query.context(node(file("prod/AxisStep/TopMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * attribute node following direct content . */ @org.junit.Test public void constrContAttr4() { final XQuery query = new XQuery( "{//west/@mark}x{//west/@west-attr-1}", ctx); try { query.context(node(file("prod/AxisStep/TopMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQTY0024") ); } /** * attributes in content . */ @org.junit.Test public void constrContAttr5() { final XQuery query = new XQuery( "{//west/@mark, //west/@west-attr-1}", ctx); try { query.context(node(file("prod/AxisStep/TopMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * attributes direct and in content . */ @org.junit.Test public void constrContAttr6() { final XQuery query = new XQuery( "{//west/@west-attr-1, //west/@west-attr-2}", ctx); try { query.context(node(file("prod/AxisStep/TopMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * attribute in content with same name . */ @org.junit.Test public void constrContAttr7() { final XQuery query = new XQuery( "{//west/@mark, //center/@mark}", ctx); try { query.context(node(file("prod/AxisStep/TopMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0025") ); } /** * attributes direct and in content with same name . */ @org.junit.Test public void constrContAttr8() { final XQuery query = new XQuery( "{//west/@west-attr-1, //west/@mark}", ctx); try { query.context(node(file("prod/AxisStep/TopMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQDY0025") ); } /** * Attributes in seperate content units . */ @org.junit.Test public void constrContAttr9() { final XQuery query = new XQuery( "{//west/@west-attr-1}{//west/@west-attr-2}", ctx); try { query.context(node(file("prod/AxisStep/TopMany.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * base-uri through xml:base attribute . */ @org.junit.Test public void constrContBaseuri1() { final XQuery query = new XQuery( "fn:base-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com") ); } /** * base-uri through parent . */ @org.junit.Test public void constrContBaseuri2() { final XQuery query = new XQuery( "fn:base-uri(exactly-one(()/a))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com") ); } /** * base-uri through declaration . */ @org.junit.Test public void constrContBaseuri3() { final XQuery query = new XQuery( "declare base-uri \"http://www.example.com\"; fn:base-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com") ); } /** * CDATA section in element constructor . */ @org.junit.Test public void constrContCdata1() { final XQuery query = new XQuery( "'\"< ]]>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("cdata&<>'\"&lt;&#x20;", false) ); } /** * character reference . */ @org.junit.Test public void constrContCharref1() { final XQuery query = new XQuery( "0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("0", false) ); } /** * invalid character reference . */ @org.junit.Test public void constrContCharref2() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0090") ); } /** * typed value of element . */ @org.junit.Test public void constrContData1() { final XQuery query = new XQuery( "fn:data(ab)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ab") ); } /** * strip document nodes . */ @org.junit.Test public void constrContDoc1() { final XQuery query = new XQuery( "{(/), (/)}", ctx); try { query.context(node(file("prod/CompAttrConstructor/DupNode.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("texttexttexttext", false) ); } /** * Check the merging of text nodes introduced by the contents of a document node This test case was motivated by the resolution of Bug Report 3637 . */ @org.junit.Test public void constrContDocument1() { final XQuery query = new XQuery( "count( {'abc', document {'def', , 'ghi'}, 'jkl'} /node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Check the merging of text nodes introduced by the contents of a document node This test case was motivated by the resolution of Bug Report 3637 . */ @org.junit.Test public void constrContDocument2() { final XQuery query = new XQuery( "count( abc {document {'def', , 'ghi'}} jkl /node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] . */ @org.junit.Test public void constrContDocument3() { final XQuery query = new XQuery( "\n" + " declare variable $codepoints as xs:integer+ := (9, 10, 13, 32 to 55295, 57344 to 65532, 65536 to 1114111 ); \n" + " declare variable $count as xs:integer := count($codepoints); \n" + " declare variable $lineWidth as xs:integer := 70;\n" + " {codepoints-to-string($codepoints)} \n" + " (:{ \n" + " for $i in (1 to $count idiv $lineWidth) \n" + " let $startOffset := (($i - 1) * $lineWidth) + 1 \n" + " return ( { \n" + " codepoints-to-string(subsequence($codepoints, $startOffset, $lineWidth)) } , \" \") \n" + " } :)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertQuery("sum($result//r/text()/string-length()) = count((9, 10, 13, 32 to 55295, 57344 to 65532, 65536 to 1114111 ))") && assertQuery("starts-with(($result//r/text())[1], '\t')") && assertQuery("ends-with(($result//r/text())[last()], 'ô¿¿')") ) ); } /** * Check the merging of text nodes introduced by the contents of a document node. This test case was motivated by the resolution of Bug Report #3637 . */ @org.junit.Test public void constrContDocument4() { final XQuery query = new XQuery( "count( document {'abc', 'def', document {'ghi', , 'jkl'}, 'mno' } /node() )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Check the merging of text nodes introduced by the contents of a document node. This test case was motivated by the resolution of Bug Report #3637 . */ @org.junit.Test public void constrContDocument5() { final XQuery query = new XQuery( "count( document {'abc', 'def', document {'ghi', 'jkl'}, 'mno' } /node() )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * 1 text node for enclosed expression with atomic values . */ @org.junit.Test public void constrContEnclexpr1() { final XQuery query = new XQuery( "count(({1,'a',3.5,4e2})/text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * 1 text node for enclosed expression with atomic values . */ @org.junit.Test public void constrContEnclexpr2() { final XQuery query = new XQuery( "count(({1,'a',,3.5,4e2})/text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * space between atomic values in enclosed expression . */ @org.junit.Test public void constrContEnclexpr3() { final XQuery query = new XQuery( "{1,'a',3.5,4e2}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1 a 3.5 400", false) ); } /** * enclosed expression with mix of atomic values and nodes . */ @org.junit.Test public void constrContEnclexpr4() { final XQuery query = new XQuery( "{1,//a,2,3,//comment(),4,5,//processing-instruction(),6,7,//text(),8}", ctx); try { query.context(node(file("prod/CompAttrConstructor/DupNode.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1texttext2 34 56 7texttext8", false) ); } /** * space between atomic values and empty string . */ @org.junit.Test public void constrContEnclexpr5() { final XQuery query = new XQuery( "{1, '', 2}", ctx); try { query.context(node(file("prod/CompAttrConstructor/DupNode.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1 2", false) ); } /** * Pre-defined entity reference in element content . */ @org.junit.Test public void constrContEntref1() { final XQuery query = new XQuery( "string-to-codepoints(<)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("60") ); } /** * Pre-defined entity reference in element content . */ @org.junit.Test public void constrContEntref2() { final XQuery query = new XQuery( "string-to-codepoints(>)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("62") ); } /** * Pre-defined entity reference in element content . */ @org.junit.Test public void constrContEntref3() { final XQuery query = new XQuery( "string-to-codepoints(&)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("38") ); } /** * Pre-defined entity reference in element content . */ @org.junit.Test public void constrContEntref4() { final XQuery query = new XQuery( "string-to-codepoints(")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("34") ); } /** * Pre-defined entity reference in element content . */ @org.junit.Test public void constrContEntref5() { final XQuery query = new XQuery( "string-to-codepoints(')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("39") ); } /** * end-of-line handling . */ @org.junit.Test public void constrContEol1() { final XQuery query = new XQuery( "{string-to-codepoints(1\n" + "2)}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("49 10 50", false) ); } /** * end-of-line handling . */ @org.junit.Test public void constrContEol2() { final XQuery query = new XQuery( "{string-to-codepoints(1 2) }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("49 10 50", false) ); } /** * end-of-line handling with character reference . */ @org.junit.Test public void constrContEol3() { final XQuery query = new XQuery( "{string-to-codepoints( )}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("13 10", false) ); } /** * end-of-line handling with character reference . */ @org.junit.Test public void constrContEol4() { final XQuery query = new XQuery( "{string-to-codepoints( )}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("13", false) ); } /** * invalid character '{' in element content . */ @org.junit.Test public void constrContInvalid1() { final XQuery query = new XQuery( "{", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * invalid character '}' in element content . */ @org.junit.Test public void constrContInvalid2() { final XQuery query = new XQuery( "}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * invalid character '<' in element content . */ @org.junit.Test public void constrContInvalid3() { final XQuery query = new XQuery( "<", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * invalid character '&' in element content . */ @org.junit.Test public void constrContInvalid4() { final XQuery query = new XQuery( "&", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * nested element nodes . */ @org.junit.Test public void constrContNested1() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * nested pi nodes . */ @org.junit.Test public void constrContNested2() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * nested comment nodes . */ @org.junit.Test public void constrContNested3() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * nested mix of nodes . */ @org.junit.Test public void constrContNested4() { final XQuery query = new XQuery( "ABCDEFGHIJ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("ABCDEFGHIJ", false) ); } /** * Copied node structure in element content . */ @org.junit.Test public void constrContNested5() { final XQuery query = new XQuery( "{/root}", ctx); try { query.context(node(file("prod/CompAttrConstructor/DupNode.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("texttext", false) ); } /** * Copied element node has new node identity . */ @org.junit.Test public void constrContNodeid1() { final XQuery query = new XQuery( "for $x in , $y in {$x} return exactly-one($y/a) is $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Copied attribute node has new node identity . */ @org.junit.Test public void constrContNodeid2() { final XQuery query = new XQuery( "for $x in , $y in {$x/@b} return $y/@b is $x/@b", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Copied comment node has new node identity . */ @org.junit.Test public void constrContNodeid3() { final XQuery query = new XQuery( "for $x in , $y in {$x} return exactly-one($y/comment()) is $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Copied pi node has new node identity . */ @org.junit.Test public void constrContNodeid4() { final XQuery query = new XQuery( "for $x in , $y in {$x} return exactly-one($y/processing-instruction()) is $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Copied text node has new node identity . */ @org.junit.Test public void constrContNodeid5() { final XQuery query = new XQuery( "for $x in text, $y in {$x/text()} return exactly-one($y/text()) is exactly-one($x/text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Copy-namespace mode preserve, inherit . */ @org.junit.Test public void constrContNsmode1() { final XQuery query = new XQuery( "declare copy-namespaces preserve, inherit; {(/)}/x/z", ctx); try { query.context(node(file("prod/DirElemContent/nsmode.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Copy-namespace mode no-preserve, inherit . */ @org.junit.Test public void constrContNsmode2() { final XQuery query = new XQuery( "declare copy-namespaces no-preserve, inherit; {(/)}/x/z", ctx); try { query.context(node(file("prod/DirElemContent/nsmode.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Copy-namespace mode preserve, no-inherit . */ @org.junit.Test public void constrContNsmode3() { final XQuery query = new XQuery( "declare copy-namespaces preserve, no-inherit; {(/)}/x/z", ctx); try { query.context(node(file("prod/DirElemContent/nsmode.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Copy-namespace mode no-preserve, no-inherit . */ @org.junit.Test public void constrContNsmode4() { final XQuery query = new XQuery( "declare copy-namespaces no-preserve, no-inherit; {(/)}/x/z", ctx); try { query.context(node(file("prod/DirElemContent/nsmode.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * empty parent . */ @org.junit.Test public void constrContParent1() { final XQuery query = new XQuery( "count(()/..)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * string value of element . */ @org.junit.Test public void constrContString1() { final XQuery query = new XQuery( "fn:string(ab)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ab") ); } /** * count text nodes for direct element content . */ @org.junit.Test public void constrContText1() { final XQuery query = new XQuery( "count((text)/text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * count text nodes for direct element content and CDATA section . */ @org.junit.Test public void constrContText2() { final XQuery query = new XQuery( "count((text)/text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Preserve base uri for copied element nodes . */ @org.junit.Test public void constrContUripres1() { final XQuery query = new XQuery( "\n" + " for $x in , \n" + " $y in {$x/b} \n" + " return fn:base-uri(exactly-one($y/b))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.example.com/base2") ); } /** * An astray '}'. . */ @org.junit.Test public void k2DirectConElemContent1() { final XQuery query = new XQuery( "3}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Test that the typed value of comment nodes is correct. . */ @org.junit.Test public void k2DirectConElemContent10() { final XQuery query = new XQuery( "not(data() instance of xs:untypedAtomic)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that the typed value of comment nodes is correct. . */ @org.junit.Test public void k2DirectConElemContent11() { final XQuery query = new XQuery( " instance of comment()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that the typed value of comment nodes is correct. . */ @org.junit.Test public void k2DirectConElemContent12() { final XQuery query = new XQuery( "not( instance of xs:untypedAtomic)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that the typed value of comment nodes is correct. . */ @org.junit.Test public void k2DirectConElemContent13() { final XQuery query = new XQuery( "not( instance of xs:string)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that the typed value of PI nodes is correct. . */ @org.junit.Test public void k2DirectConElemContent14() { final XQuery query = new XQuery( "data() instance of xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that the typed value of PI nodes is correct. . */ @org.junit.Test public void k2DirectConElemContent15() { final XQuery query = new XQuery( "not(data() instance of xs:untypedAtomic)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that the typed value of PI nodes is correct. . */ @org.junit.Test public void k2DirectConElemContent16() { final XQuery query = new XQuery( " instance of processing-instruction()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that the typed value of PI nodes is correct. . */ @org.junit.Test public void k2DirectConElemContent17() { final XQuery query = new XQuery( "not( instance of xs:untypedAtomic)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Syntactically invalid CDATA section. . */ @org.junit.Test public void k2DirectConElemContent18() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntactically invalid CDATA section. . */ @org.junit.Test public void k2DirectConElemContent19() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * An astray '}'. . */ @org.junit.Test public void k2DirectConElemContent2() { final XQuery query = new XQuery( "\"a string\" }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntactically invalid CDATA section. . */ @org.junit.Test public void k2DirectConElemContent20() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntactically invalid CDATA section. . */ @org.junit.Test public void k2DirectConElemContent22() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * XQuery comments inside elements are not recognized.. */ @org.junit.Test public void k2DirectConElemContent25() { final XQuery query = new XQuery( "string( (: an (:example:) )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, " (: an (:example:) ") ); } /** * Enclosed expressions in element content must have expressions. . */ @org.junit.Test public void k2DirectConElemContent26() { final XQuery query = new XQuery( "content{}content", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Many CDATA sections. . */ @org.junit.Test public void k2DirectConElemContent27() { final XQuery query = new XQuery( "string(strstrstr{ \"str\", \"str\", \"strstr\", \"str\"}strstrstr) eq \"strstrstrstrstrstrstrstr str strstr strstrstrstrstr\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure CDATA doesn't receive special attention. . */ @org.junit.Test public void k2DirectConElemContent28() { final XQuery query = new XQuery( "string(\"\"'*\"*\">>tent]]�&"¬recognized;&apos]]>) eq \"con<<< ]] >\"\"\"\"'*\"\"*\"\">>tent]]&#00;&#x12;&amp;&quot;&notrecognized;&apos\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that the type annotation of text nodes is correct. . */ @org.junit.Test public void k2DirectConElemContent29() { final XQuery query = new XQuery( "data(text{\"content\"}) instance of xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An astray '}'. . */ @org.junit.Test public void k2DirectConElemContent3() { final XQuery query = new XQuery( "}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Two atomic values with a text node inbetween. . */ @org.junit.Test public void k2DirectConElemContent30() { final XQuery query = new XQuery( "{1}A{1}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1A1", false) ); } /** * Two atomic values with a text node inbetween(#2). . */ @org.junit.Test public void k2DirectConElemContent31() { final XQuery query = new XQuery( "string({1}A{1})", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1A1") ); } /** * Tests the type of the typed value of a directly constructed element node. . */ @org.junit.Test public void k2DirectConElemContent32() { final XQuery query = new XQuery( "data(dsa) instance of xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Tests the typed value of a directly constructed element node. . */ @org.junit.Test public void k2DirectConElemContent33() { final XQuery query = new XQuery( "data(dsa)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "dsa") ); } /** * Check that a directly constructed element gets the right type. . */ @org.junit.Test public void k2DirectConElemContent34() { final XQuery query = new XQuery( " instance of element(*, xs:anyType)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * * Check that a directly constructed element gets the right type(#2). * Note: see bug 11585, especially comment 9. * . */ @org.junit.Test public void k2DirectConElemContent35() { final XQuery query = new XQuery( " instance of element(*, xs:untyped)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Check that a directly constructed element gets the right type(#3). . */ @org.junit.Test public void k2DirectConElemContent36() { final XQuery query = new XQuery( "declare construction strip; instance of element(*, xs:untyped)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that a directly constructed element gets the right type, and that the name test fails. . */ @org.junit.Test public void k2DirectConElemContent37() { final XQuery query = new XQuery( " instance of element(a, xs:anyType)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Check that a directly constructed element gets the right type, and that the name test fails(#2). . */ @org.junit.Test public void k2DirectConElemContent38() { final XQuery query = new XQuery( "declare construction strip; instance of element(b, xs:untyped)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Use many enclosed expressions. . */ @org.junit.Test public void k2DirectConElemContent39() { final XQuery query = new XQuery( "{1}{2}{3}{4}{5}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("12345", false) ); } /** * An astray '}'. . */ @org.junit.Test public void k2DirectConElemContent4() { final XQuery query = new XQuery( "}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Use many enclosed expressions(#2). . */ @org.junit.Test public void k2DirectConElemContent40() { final XQuery query = new XQuery( "{1}{2}{3}{4}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1234", false) ); } /** * Use many enclosed expressions(#3). . */ @org.junit.Test public void k2DirectConElemContent41() { final XQuery query = new XQuery( "{1}{2}{3}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("123", false) ); } /** * Use many enclosed expressions(#4). . */ @org.junit.Test public void k2DirectConElemContent42() { final XQuery query = new XQuery( "{1}{2}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("12", false) ); } /** * Tricky whitespace case. . */ @org.junit.Test public void k2DirectConElemContent43() { final XQuery query = new XQuery( " {\"abc\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" abc", false) ); } /** * Inproperly balanced attribute quotes. . */ @org.junit.Test public void k2DirectConElemContent44() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Have an empty text node constructor between two atomic values. . */ @org.junit.Test public void k2DirectConElemContent46() { final XQuery query = new XQuery( "{1}{text{()}}{2}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("12", false) ); } /** * Have an text node constructor that constructs an empty string, between two atomic values. . */ @org.junit.Test public void k2DirectConElemContent47() { final XQuery query = new XQuery( "{1}{text{\"\"}}{2}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("12", false) ); } /** * Serialize an undeclaration. . */ @org.junit.Test public void k2DirectConElemContent48() { final XQuery query = new XQuery( "\n" + " \t , \n" + " \t /count(in-scope-prefixes(a)), \n" + " \t \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1", false) ); } /** * Test that the typed value of element nodes is correct. . */ @org.junit.Test public void k2DirectConElemContent5() { final XQuery query = new XQuery( "data(some text) instance of xs:untypedAtomic", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that the typed value of element nodes is correct. . */ @org.junit.Test public void k2DirectConElemContent6() { final XQuery query = new XQuery( "not(data(some text) instance of xs:string)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that the typed value of element nodes is correct. . */ @org.junit.Test public void k2DirectConElemContent7() { final XQuery query = new XQuery( "some, if(1) then else instance of element()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that the typed of element nodes is correct. . */ @org.junit.Test public void k2DirectConElemContent8() { final XQuery query = new XQuery( "not(some text instance of xs:untypedAtomic)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that the typed value of comment nodes is correct. . */ @org.junit.Test public void k2DirectConElemContent9() { final XQuery query = new XQuery( "data() instance of xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that namespace fixup occurs when namespace prefix names clash . */ @org.junit.Test public void cbclNsFixup1() { final XQuery query = new XQuery( " \n" + " \tlet $x := \n" + " \treturn let $y := \n" + " \treturn let $z := { $x/@*, $y/@* } \n" + " \treturn count(distinct-values(in-scope-prefixes($z)))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdDirElemContentNamespace.java000066400000000000000000002212441222453003200326330ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the DirElemContent.namespace production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdDirElemContentNamespace extends QT3TestSet { /** * Rename inscope namespace . */ @org.junit.Test public void constrInscope1() { final XQuery query = new XQuery( "{//@*:attr1}", ctx); try { query.context(node(file("prod/DirElemContent.namespace/inscope.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", true) ); } /** * copy element node with namespace . */ @org.junit.Test public void constrInscope10() { final XQuery query = new XQuery( "{//*:child2}", ctx); try { query.context(node(file("prod/DirElemContent.namespace/inscope.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * copy element node with namespace . */ @org.junit.Test public void constrInscope11() { final XQuery query = new XQuery( "for $x in return {$x//*:child1}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * copy element node with namespace . */ @org.junit.Test public void constrInscope12() { final XQuery query = new XQuery( "for $x in return {$x//*:child2}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * declared element namespace . */ @org.junit.Test public void constrInscope13() { final XQuery query = new XQuery( "declare namespace foo = \"http://example.com\"; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * declared element namespace . */ @org.junit.Test public void constrInscope14() { final XQuery query = new XQuery( "declare namespace foo = \"http://example.com\"; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * element with prefix xml . */ @org.junit.Test public void constrInscope15() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * attribute with prefix xml . */ @org.junit.Test public void constrInscope16() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * copy element with same prefix . */ @org.junit.Test public void constrInscope17() { final XQuery query = new XQuery( "{//*:child1}", ctx); try { query.context(node(file("prod/DirElemContent.namespace/inscope.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * copy element with same prefix . */ @org.junit.Test public void constrInscope18() { final XQuery query = new XQuery( "{//*:child1}", ctx); try { query.context(node(file("prod/DirElemContent.namespace/inscope.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * copy element with different default namespace . */ @org.junit.Test public void constrInscope19() { final XQuery query = new XQuery( "{//*:child4}", ctx); try { query.context(node(file("prod/DirElemContent.namespace/inscope.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Rename inscope namespace . */ @org.junit.Test public void constrInscope2() { final XQuery query = new XQuery( "{//@*:attr1, //@*:attr2}", ctx); try { query.context(node(file("prod/DirElemContent.namespace/inscope.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", true) ); } /** * copy element with same default namespace . */ @org.junit.Test public void constrInscope20() { final XQuery query = new XQuery( "{//*:child4}", ctx); try { query.context(node(file("prod/DirElemContent.namespace/inscope.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * namespace not declared: see bug 17040 (cezar.andrei@gmail.com). */ @org.junit.Test public void constrInscope21() { final XQuery query = new XQuery( "\n" + " declare namespace cat ='mycat'; \n" + " 42\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("42", false) ); } /** * namespace not declared: see bug 17040 (cezar.andrei@gmail.com). */ @org.junit.Test public void constrInscope22() { final XQuery query = new XQuery( "\n" + " 42\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("42", false) ); } /** * Rename inscope namespace . */ @org.junit.Test public void constrInscope3() { final XQuery query = new XQuery( "for $x in return {$x//@*:attr1}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", true) ); } /** * Rename inscope namespace . */ @org.junit.Test public void constrInscope4() { final XQuery query = new XQuery( "for $x in return {$x//@*:attr1, $x//@*:attr2}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", true) ); } /** * copy element node with namespace . */ @org.junit.Test public void constrInscope5() { final XQuery query = new XQuery( "{//*:child3}", ctx); try { query.context(node(file("prod/DirElemContent.namespace/inscope.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * copy element node with namespace . */ @org.junit.Test public void constrInscope6() { final XQuery query = new XQuery( "{//*:child4}", ctx); try { query.context(node(file("prod/DirElemContent.namespace/inscope.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * copy element node with namespace . */ @org.junit.Test public void constrInscope7() { final XQuery query = new XQuery( "for $x in return {$x//*:child3}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * copy element node with namespace . */ @org.junit.Test public void constrInscope8() { final XQuery query = new XQuery( "for $x in return {$x//*:child4}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * copy element node with namespace . */ @org.junit.Test public void constrInscope9() { final XQuery query = new XQuery( "{//*:child1}", ctx); try { query.context(node(file("prod/DirElemContent.namespace/inscope.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Namespace Declarations - Use undeclared namespace prefix . */ @org.junit.Test public void constrNamespace1() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0081") ); } /** * Namespace Declarations - overriding prolog namespace prefix . */ @org.junit.Test public void constrNamespace10() { final XQuery query = new XQuery( "declare namespace foo=\"http://www.example.com/prolog\"; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Namespace Declarations - select child of element overriding parent namespace prefix . */ @org.junit.Test public void constrNamespace11() { final XQuery query = new XQuery( "()//*:grand-child", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Namespace Declarations - select child of element overriding prolog namespace prefix . */ @org.junit.Test public void constrNamespace12() { final XQuery query = new XQuery( "declare namespace foo=\"http://www.example.com/prolog\"; ()//*:child", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Namespace Declarations - undeclare namespace prefix . */ @org.junit.Test public void constrNamespace13() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("", false) || error("XQST0085") ) ); } /** * Namespace Declarations - use undeclared parent prefix in child . */ @org.junit.Test public void constrNamespace14() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0081") || error("XQST0085") ) ); } /** * Namespace Declarations - use undeclared prolog prefix in child . */ @org.junit.Test public void constrNamespace15() { final XQuery query = new XQuery( "declare namespace foo=\"http://www.example.com/prolog\"; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0081") || error("XQST0085") ) ); } /** * Namespace Declarations - select child of element overriding namespace prefix . */ @org.junit.Test public void constrNamespace16() { final XQuery query = new XQuery( "()//grand-child", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("", false) || error("XQST0085") ) ); } /** * Namespace Declarations - child inherits default namespace . */ @org.junit.Test public void constrNamespace17() { final XQuery query = new XQuery( "()/*:child", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Namespace Declarations - override parents default namespace . */ @org.junit.Test public void constrNamespace18() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Namespace Declarations - override prologs default namespace . */ @org.junit.Test public void constrNamespace19() { final XQuery query = new XQuery( "declare default element namespace \"http://www.example.com/prolog\"; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Namespace Declarations - declare namespace with prefix . */ @org.junit.Test public void constrNamespace2() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Namespace Declarations - child inherits overridden parents default namespace . */ @org.junit.Test public void constrNamespace20() { final XQuery query = new XQuery( "()//*:grand-child", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Namespace Declarations - child inherits overridden prologs default namespace . */ @org.junit.Test public void constrNamespace21() { final XQuery query = new XQuery( "declare default element namespace \"http://www.example.com/prolog\"; ()/*:child", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Namespace Declarations - undeclare default namespace . */ @org.junit.Test public void constrNamespace22() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Namespace Declarations - child inherits undeclared default namespace . */ @org.junit.Test public void constrNamespace23() { final XQuery query = new XQuery( "()//*:grand-child", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Namespace Declarations - namespace URI is not string literal . */ @org.junit.Test public void constrNamespace24() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0022") ); } /** * Namespace Declarations - namespace URI is not string literal . */ @org.junit.Test public void constrNamespace25() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0022") ); } /** * Namespace Declarations - test namespace added to statically known namespaces: element content . */ @org.junit.Test public void constrNamespace26() { final XQuery query = new XQuery( "{count(//cm:b)}", ctx); try { query.context(node(file("prod/DirElemContent.namespace/MixNS.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1", false) ); } /** * Namespace Declarations - test namespace added to statically known namespaces: attribute content . */ @org.junit.Test public void constrNamespace27() { final XQuery query = new XQuery( "", ctx); try { query.context(node(file("prod/DirElemContent.namespace/MixNS.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Namespace Declarations - test namespace removed from statically known namespaces after end of element . */ @org.junit.Test public void constrNamespace29() { final XQuery query = new XQuery( "{count(//cm:b)}", ctx); try { query.context(node(file("prod/DirElemContent.namespace/MixNS.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0081") ); } /** * Namespace Declarations - declare default namespace . */ @org.junit.Test public void constrNamespace3() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Namespace Declarations - duplicate namespace prefix . */ @org.junit.Test public void constrNamespace4() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0071") ); } /** * Namespace Declarations - duplicate default namespace . */ @org.junit.Test public void constrNamespace5() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0071") ); } /** * Namespace Declarations - local part of declaration is xml . */ @org.junit.Test public void constrNamespace6() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0070") ); } /** * Namespace Declarations - local part of declaration is xmlns . */ @org.junit.Test public void constrNamespace7() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0070") ); } /** * Namespace Declarations - child inherits namespace prefix . */ @org.junit.Test public void constrNamespace8() { final XQuery query = new XQuery( "()/*:child", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Namespace Declarations - overriding parents namespace prefix . */ @org.junit.Test public void constrNamespace9() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Use the ""-escape mechanism. Modified by MHK to avoid generating output that won't canonicalize - bug 6868 . */ @org.junit.Test public void directConElemNamespace3() { final XQuery query = new XQuery( "namespace-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "http://ns.example.com/ns?val=\"\"\"asd") || error("XQST0046") || error("XQST0022") ) ); } /** * Use the ""-escape mechanism. Modified by MHK to avoid generating output that won't canonicalize - bug 6868 . */ @org.junit.Test public void directConElemNamespace4() { final XQuery query = new XQuery( "namespace-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "http://ns.example.com/ns?val=\"asd") || error("XQST0046") || error("XQST0022") ) ); } /** * Use the ''-escape mechanism. Modified by MHK to avoid generating output that won't canonicalize - bug 6868 . */ @org.junit.Test public void directConElemNamespace5() { final XQuery query = new XQuery( "namespace-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://ns.example.com/ns?val='''asd") ); } /** * Use the ''-escape mechanism. Modified by MHK to avoid generating output that won't canonicalize - bug 6868 . */ @org.junit.Test public void directConElemNamespace6() { final XQuery query = new XQuery( "namespace-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://ns.example.com/ns?val='asd") ); } /** * Ensure the in-scope prefixes are correct for all top-level elements. . */ @org.junit.Test public void k2ConInScopeNamespace1() { final XQuery query = new XQuery( "let $i := document{, , , } return (in-scope-prefixes($i/e1), in-scope-prefixes($i/e2), in-scope-prefixes($i/e3), in-scope-prefixes($i/e4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xml xml xml xml") ); } /** * A namespace declaration inside a direct element constructor is not in-scope for the next operand of the comma operator. . */ @org.junit.Test public void k2DirectConElemNamespace1() { final XQuery query = new XQuery( ", ns:nametest", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0081") ); } /** * Default namespace declarations does not affect the default function namespace(#4). . */ @org.junit.Test public void k2DirectConElemNamespace10() { final XQuery query = new XQuery( "declare default function namespace \"http://example.com\"; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A name test whose namespace is declared with a default namespace attribute. . */ @org.junit.Test public void k2DirectConElemNamespace11() { final XQuery query = new XQuery( "declare default function namespace \"http://example.com\"; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * A name test whose namespace is declared with a default namespace attribute(#2). . */ @org.junit.Test public void k2DirectConElemNamespace12() { final XQuery query = new XQuery( "declare default function namespace \"http://example.com\"; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * A name test whose namespace is declared with a prefixed namespace attribute. . */ @org.junit.Test public void k2DirectConElemNamespace13() { final XQuery query = new XQuery( "declare default function namespace \"http://example.com\"; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * A name test whose namespace is declared with a prefixed namespace attribute(#2). . */ @org.junit.Test public void k2DirectConElemNamespace14() { final XQuery query = new XQuery( "declare default function namespace \"http://example.com\"; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * A namespace must be a literal. . */ @org.junit.Test public void k2DirectConElemNamespace15() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0022") ); } /** * A namespace must be a literal(#2). . */ @org.junit.Test public void k2DirectConElemNamespace16() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0022") ); } /** * A namespace must be a literal, for which bracket-escapes are invalid. . */ @org.junit.Test public void k2DirectConElemNamespace17() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0022") ); } /** * A namespace must be a literal, for which bracket-escapes are invalid(#2). . */ @org.junit.Test public void k2DirectConElemNamespace18() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0022") ); } /** * Ensure that the correct default element namespace is used, with 'instance of'. . */ @org.junit.Test public void k2DirectConElemNamespace19() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Element constructors aren't well-formed despite the namespace declarations. . */ @org.junit.Test public void k2DirectConElemNamespace2() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0118") ); } /** * Ensure that the correct default element namespace is used, with 'treat as'. . */ @org.junit.Test public void k2DirectConElemNamespace20() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Ensure that the correct default element namespace is used, with 'cast as'. . */ @org.junit.Test public void k2DirectConElemNamespace21() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Ensure that the correct default element namespace is used, with 'cast as'. . */ @org.junit.Test public void k2DirectConElemNamespace22() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Ensure that the correct default element namespace is used, with an element name test. . */ @org.junit.Test public void k2DirectConElemNamespace23() { final XQuery query = new XQuery( "data/b}\" xmlns=\"http://www.example.com/\"/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Ensure that the correct default element namespace is used, with an attribute name test. . */ @org.junit.Test public void k2DirectConElemNamespace24() { final XQuery query = new XQuery( "/@b}\" xmlns=\"http://www.example.com/\"/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Test that an empty namespace declaration is handled correctly. . */ @org.junit.Test public void k2DirectConElemNamespace25() { final XQuery query = new XQuery( "declare namespace b = \"http://www.example.com/\"; empty(/b:d/b:b)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Ensure that a declaration is only in-scope for the element constructor. . */ @org.junit.Test public void k2DirectConElemNamespace26() { final XQuery query = new XQuery( ", d:d", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0081") ); } /** * Ensure that when one namespace declaration goes out of scope, that the one above doesn't dissapear. . */ @org.junit.Test public void k2DirectConElemNamespace27() { final XQuery query = new XQuery( " {p:integer(1)} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1", false) ); } /** * Ensure that when one namespace declaration goes out of scope, that the one above persists. . */ @org.junit.Test public void k2DirectConElemNamespace28() { final XQuery query = new XQuery( " {fn:count(0)} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1", false) ); } /** * Ensure that the correct namespace is used, with 'instance of'. . */ @org.junit.Test public void k2DirectConElemNamespace29() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Element constructors aren't well-formed despite the namespace declarations. . */ @org.junit.Test public void k2DirectConElemNamespace3() { final XQuery query = new XQuery( " declare default element namespace \"http://example.com/NS\";", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0118") ); } /** * Ensure that the correct namespace is used, with 'treat as'. . */ @org.junit.Test public void k2DirectConElemNamespace30() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Ensure that the correct namespace is used, with 'cast as'. . */ @org.junit.Test public void k2DirectConElemNamespace31() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Ensure that the correct namespace is used, with 'cast as'. . */ @org.junit.Test public void k2DirectConElemNamespace32() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Use a namespace binding in range variables that appears after them in query order. . */ @org.junit.Test public void k2DirectConElemNamespace33() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Use an enclosed expression inside an namespace declaration. . */ @org.junit.Test public void k2DirectConElemNamespace34() { final XQuery query = new XQuery( "/@xmlns", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0022") ); } /** * Use an enclosed expression inside an namespace declaration(#2). . */ @org.junit.Test public void k2DirectConElemNamespace35() { final XQuery query = new XQuery( "/@xmlns", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0022") ); } /** * Use an enclosed expression inside an namespace declaration(#3). . */ @org.junit.Test public void k2DirectConElemNamespace36() { final XQuery query = new XQuery( "/@xmlns", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0022") ); } /** * Use an enclosed expression inside an namespace declaration(#3). . */ @org.junit.Test public void k2DirectConElemNamespace37() { final XQuery query = new XQuery( "/@xmlns", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0022") ); } /** * Use an inproperly enclosed expression inside an namespace declaration. . */ @org.junit.Test public void k2DirectConElemNamespace38() { final XQuery query = new XQuery( "/@xmlns", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Combine an empty default namespace, with a full namespace. . */ @org.junit.Test public void k2DirectConElemNamespace39() { final XQuery query = new XQuery( "declare namespace p = \"http://example.com/\"; , count(in-scope-prefixes())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("2", false) ); } /** * A namespace declaration binding to a a one-letter NCName. . */ @org.junit.Test public void k2DirectConElemNamespace4() { final XQuery query = new XQuery( "declare namespace p = \"http://example.com/QuiteWeirdNamespace\"; empty(p:e[1])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPDY0002") ) ); } /** * Ensure the namespaces in-scope are outputted. . */ @org.junit.Test public void k2DirectConElemNamespace40() { final XQuery query = new XQuery( "declare namespace p = \"http://www.example.com/A\"; /p:b", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Ensure all namespaces in-scope, through a couple of elements, are found by in-scope-prefixes(). . */ @org.junit.Test public void k2DirectConElemNamespace41() { final XQuery query = new XQuery( "declare namespace p = \"http://www.example.com/A\"; \"START\", for $i in in-scope-prefixes( /p:b) order by $i return $i, \"END\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "START A B xml END") ); } /** * A direct element constructor with a redundant, prefixed namespace declaration. . */ @org.junit.Test public void k2DirectConElemNamespace42() { final XQuery query = new XQuery( " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * A direct element constructor with a redundant namespace declaration. . */ @org.junit.Test public void k2DirectConElemNamespace43() { final XQuery query = new XQuery( " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Use an inproperly enclosed expression inside an namespace declaration(#2). . */ @org.junit.Test public void k2DirectConElemNamespace44() { final XQuery query = new XQuery( "/@xmlns", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XQST0022") ) ); } /** * Ensure the namespace declaration is output for a copied attribute. . */ @org.junit.Test public void k2DirectConElemNamespace45() { final XQuery query = new XQuery( "let $i := return {$i/@*}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Ensure no declaration is output for the XML namespace. . */ @org.junit.Test public void k2DirectConElemNamespace46() { final XQuery query = new XQuery( "let $i := return {$i/@*}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Use an empty-string namespace declaration. . */ @org.junit.Test public void k2DirectConElemNamespace47() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Declare a prefix that isn't used. . */ @org.junit.Test public void k2DirectConElemNamespace48() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Use a 'declare default element namespace' in addition to binding to the empty prefix. . */ @org.junit.Test public void k2DirectConElemNamespace49() { final XQuery query = new XQuery( "declare default element namespace \"http://www.example.com/A\"; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Verify the 'xml' prefix is in scope in a direct constructor. . */ @org.junit.Test public void k2DirectConElemNamespace5() { final XQuery query = new XQuery( "count(in-scope-prefixes()[. eq \"xml\"])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Ensure undeclarations affect path expressions correctly. . */ @org.junit.Test public void k2DirectConElemNamespace50() { final XQuery query = new XQuery( " /b", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("", false) || assertSerialization("", false) ) ); } /** * Use an empty-string namespace declaration(#2). . */ @org.junit.Test public void k2DirectConElemNamespace51() { final XQuery query = new XQuery( "declare default element namespace \"http://example.com\"; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Use an empty-string namespace declaration(#3). . */ @org.junit.Test public void k2DirectConElemNamespace52() { final XQuery query = new XQuery( "declare default element namespace \"http://example.com/\"; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Ensure a namespace undeclaration aren't counted as a namespace binding. . */ @org.junit.Test public void k2DirectConElemNamespace53() { final XQuery query = new XQuery( "count(in-scope-prefixes( /e))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Ensure an undeclaration is treated properly. . */ @org.junit.Test public void k2DirectConElemNamespace54() { final XQuery query = new XQuery( "count(/namespace-uri(exactly-one(*)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * A combination of computed and direct constructors with namespace undeclarations. . */ @org.junit.Test public void k2DirectConElemNamespace55() { final XQuery query = new XQuery( " { attribute {QName(\"http://example.com/2\", \"p:attr\")} {()} } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Check that an attribute name tests properly interact with namespace declarations. . */ @org.junit.Test public void k2DirectConElemNamespace56() { final XQuery query = new XQuery( "declare default element namespace \"http://example.com/\"; { /(@att, attribute::att) } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Attempt an attribute node copy that never will happen. . */ @org.junit.Test public void k2DirectConElemNamespace57() { final XQuery query = new XQuery( "declare default element namespace \"http://example.com/\"; declare namespace p = \"http://example.com/\"; { /(@att) } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Use the pre-declared prefixes in element constructors. . */ @org.junit.Test public void k2DirectConElemNamespace58() { final XQuery query = new XQuery( " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Use the {}-escape mechanism. . */ @org.junit.Test public void k2DirectConElemNamespace59() { final XQuery query = new XQuery( "namespace-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "http://example.com/{{{}}}asd") || error("XQST0046") || error("XQST0022") ) ); } /** * Verify the 'xml' prefix is in scope in a computed constructor. . */ @org.junit.Test public void k2DirectConElemNamespace6() { final XQuery query = new XQuery( "count(in-scope-prefixes(element e{})[. eq \"xml\"])", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * An non-matched { inside a namespace constructor. . */ @org.junit.Test public void k2DirectConElemNamespace61() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XQST0022") ) ); } /** * An non-matched } inside a namespace constructor(#2). . */ @org.junit.Test public void k2DirectConElemNamespace62() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * An non-matched { inside a namespace constructor(#3). . */ @org.junit.Test public void k2DirectConElemNamespace63() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XQST0022") ) ); } /** * An non-matched } inside a namespace constructor(#4). . */ @org.junit.Test public void k2DirectConElemNamespace64() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Extract an escaped namespace with fn:namespace-for-prefix(). . */ @org.junit.Test public void k2DirectConElemNamespace65() { final XQuery query = new XQuery( "namespace-uri-for-prefix(\"p\", )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "http://example.com/{}{{}}") || error("XQST0046") || error("XQST0022") ) ); } /** * An non-matched { inside a namespace constructor with content afterwards. . */ @org.junit.Test public void k2DirectConElemNamespace67() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XQST0022") ) ); } /** * An non-matched } inside a namespace constructor with content afterwards(#2). . */ @org.junit.Test public void k2DirectConElemNamespace68() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * An non-matched { inside a namespace constructor with content afterwards(#3). . */ @org.junit.Test public void k2DirectConElemNamespace69() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XPST0022") ) ); } /** * Default namespace declarations does not affect the default function namespace. . */ @org.junit.Test public void k2DirectConElemNamespace7() { final XQuery query = new XQuery( "declare default function namespace \"http://example.com\"; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * An non-matched } inside a namespace constructor with content afterwards(#4). . */ @org.junit.Test public void k2DirectConElemNamespace70() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Enclosed expressions cannot be used. . */ @org.junit.Test public void k2DirectConElemNamespace71() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0022") ); } /** * Enclosed expressions cannot be used(#2). . */ @org.junit.Test public void k2DirectConElemNamespace72() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0022") ); } /** * Enclosed expressions containing the empty sequence cannot be used. . */ @org.junit.Test public void k2DirectConElemNamespace73() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0022") ); } /** * Enclosed expressions containing the empty sequence cannot be used(#2). . */ @org.junit.Test public void k2DirectConElemNamespace74() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0022") ); } /** * Serialize a namespace that has braces. Changed by MHK to avoid problems canonicalizing an invalid namespace URI . */ @org.junit.Test public void k2DirectConElemNamespace75() { final XQuery query = new XQuery( "namespace-uri()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "http://example.com/{1}") || error("XQST0046") || error("XQST0022") ) ); } /** * Serialize a prefixed namespace that has braces. . */ @org.junit.Test public void k2DirectConElemNamespace76() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("", false) || error("XQST0046") || error("XQST0022") ) ); } /** * Pull out a namespace prefix that shadows another. . */ @org.junit.Test public void k2DirectConElemNamespace77() { final XQuery query = new XQuery( "declare namespace t = \"http://example.com/2\"; //t:e", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Ensure that namespaces are expanded in the correct places(positive test). . */ @org.junit.Test public void k2DirectConElemNamespace78() { final XQuery query = new XQuery( "let $e := document{(1, 2)} return { let $outer as element(P:L) := $e/element(P:L) return { let $inner as element(P:L) := $e/element(P:L) return ($outer, $inner) } } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("12", false) ); } /** * Ensure that namespaces are expanded in the correct places(negative test). . */ @org.junit.Test public void k2DirectConElemNamespace79() { final XQuery query = new XQuery( "let $e := document{(1, 2)} return { let $outer as element(P:L) := $e/element(P:L) return { let $inner as element(P:L) := $outer return $inner } } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Default namespace declarations does not affect the default function namespace(#2). . */ @org.junit.Test public void k2DirectConElemNamespace8() { final XQuery query = new XQuery( "declare default function namespace \"http://example.com\"; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Default namespace declarations does not affect the default function namespace(#3). . */ @org.junit.Test public void k2DirectConElemNamespace9() { final XQuery query = new XQuery( "declare default function namespace \"http://example.com\"; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdDirElemContentWhitespace.java000066400000000000000000001217731222453003200330410ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the DirElemContent.whitespace production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdDirElemContentWhitespace extends QT3TestSet { /** * preserve space adjacent to cdata section . */ @org.junit.Test public void constrWsAdjcdata1() { final XQuery query = new XQuery( queryFile( file( "prod/DirElemContent.whitespace/Constr-ws-adjcdata-1.xq" ) ), ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" ", false) ); } /** * preserve line feed adjacent to cdata section . */ @org.junit.Test public void constrWsAdjcdata2() { final XQuery query = new XQuery( queryFile( file( "prod/DirElemContent.whitespace/Constr-ws-adjcdata-2.xq" ) ), ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("deep-equal(string-to-codepoints(string($result)), (10, 10))") ); } /** * preserve tab adjacent to cdata section . */ @org.junit.Test public void constrWsAdjcdata3() { final XQuery query = new XQuery( queryFile( file( "prod/DirElemContent.whitespace/Constr-ws-adjcdata-3.xq" ) ), ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("deep-equal(string-to-codepoints(string($result)), (9, 9))") ); } /** * preserve space adjacent to character reference . */ @org.junit.Test public void constrWsAdjchref1() { final XQuery query = new XQuery( "declare boundary-space strip; 0 ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" 0 ", false) ); } /** * preserve line feed adjacent to character reference . */ @org.junit.Test public void constrWsAdjchref2() { final XQuery query = new XQuery( queryFile( file( "prod/DirElemContent.whitespace/Constr-ws-adjchref-2.xq" ) ), ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("deep-equal(string-to-codepoints(string($result)), (10, 48, 10))") ); } /** * preserve tab adjacent to character reference . */ @org.junit.Test public void constrWsAdjchref3() { final XQuery query = new XQuery( queryFile( file( "prod/DirElemContent.whitespace/Constr-ws-adjchref-3.xq" ) ), ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("deep-equal(string-to-codepoints(string($result)), (9, 48, 9))") ); } /** * strip whitespace space between open tag and enclosed expression . */ @org.junit.Test public void constrWsEnclexpr1() { final XQuery query = new XQuery( "declare boundary-space strip; {1}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1", false) ); } /** * strip whitespace space between child elements . */ @org.junit.Test public void constrWsEnclexpr10() { final XQuery query = new XQuery( "declare boundary-space strip; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * strip whitespace line feed between child elements . */ @org.junit.Test public void constrWsEnclexpr11() { final XQuery query = new XQuery( "declare boundary-space strip; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * strip whitespace tab between child elements . */ @org.junit.Test public void constrWsEnclexpr12() { final XQuery query = new XQuery( "declare boundary-space strip; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * preserve whitespace space between open tag and enclosed expression . */ @org.junit.Test public void constrWsEnclexpr13() { final XQuery query = new XQuery( "declare boundary-space preserve; {1}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" 1", false) ); } /** * preserve whitespace line feed between open tag and enclosed expression . */ @org.junit.Test public void constrWsEnclexpr14() { final XQuery query = new XQuery( "declare boundary-space preserve; \n" + "\n" + "\n" + "{1}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n\n\n1", false) ); } /** * preserve whitespace tab between open tag and enclosed expression . */ @org.junit.Test public void constrWsEnclexpr15() { final XQuery query = new XQuery( queryFile( file( "prod/DirElemContent.whitespace/Constr-ws-enclexpr-15.xq" ) ), ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\t\t\t1", false) ); } /** * preserve whitespace space between enclosed expressions . */ @org.junit.Test public void constrWsEnclexpr16() { final XQuery query = new XQuery( queryFile( file( "prod/DirElemContent.whitespace/Constr-ws-enclexpr-16.xq" ) ), ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1 2", false) ); } /** * preserve whitespace line feed between enclosed expressions . */ @org.junit.Test public void constrWsEnclexpr17() { final XQuery query = new XQuery( queryFile( file( "prod/DirElemContent.whitespace/Constr-ws-enclexpr-17.xq" ) ), ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1\r\n\r\n\r\n2", false) ); } /** * preserve whitespace tab between enclosed expressions . */ @org.junit.Test public void constrWsEnclexpr18() { final XQuery query = new XQuery( queryFile( file( "prod/DirElemContent.whitespace/Constr-ws-enclexpr-18.xq" ) ), ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1\t\t\t2", false) ); } /** * preserve whitespace space between enclosed expression and close tag . */ @org.junit.Test public void constrWsEnclexpr19() { final XQuery query = new XQuery( queryFile( file( "prod/DirElemContent.whitespace/Constr-ws-enclexpr-19.xq" ) ), ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1 ", false) ); } /** * strip whitespace line feed between open tag and enclosed expression . */ @org.junit.Test public void constrWsEnclexpr2() { final XQuery query = new XQuery( "declare boundary-space strip; {1}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1", false) ); } /** * preserve whitespace line feed between enclosed expression and close tag . */ @org.junit.Test public void constrWsEnclexpr20() { final XQuery query = new XQuery( queryFile( file( "prod/DirElemContent.whitespace/Constr-ws-enclexpr-20.xq" ) ), ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1\r\n\r\n\r\n", false) ); } /** * preserve whitespace tab between enclosed expression and close tag . */ @org.junit.Test public void constrWsEnclexpr21() { final XQuery query = new XQuery( queryFile( file( "prod/DirElemContent.whitespace/Constr-ws-enclexpr-21.xq" ) ), ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1\t\t\t", false) ); } /** * preserve whitespace space between child elements . */ @org.junit.Test public void constrWsEnclexpr22() { final XQuery query = new XQuery( queryFile( file( "prod/DirElemContent.whitespace/Constr-ws-enclexpr-22.xq" ) ), ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" ", false) ); } /** * preserve whitespace line feed between child elements . */ @org.junit.Test public void constrWsEnclexpr23() { final XQuery query = new XQuery( queryFile( file( "prod/DirElemContent.whitespace/Constr-ws-enclexpr-23.xq" ) ), ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n", false) ); } /** * preserve whitespace tab between child elements . */ @org.junit.Test public void constrWsEnclexpr24() { final XQuery query = new XQuery( queryFile( file( "prod/DirElemContent.whitespace/Constr-ws-enclexpr-24.xq" ) ), ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\t\t\t\t\t\t\t\t\t", false) ); } /** * strip whitespace tab between open tag and enclosed expression . */ @org.junit.Test public void constrWsEnclexpr3() { final XQuery query = new XQuery( "declare boundary-space strip; {1}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1", false) ); } /** * strip whitespace space between enclosed expressions . */ @org.junit.Test public void constrWsEnclexpr4() { final XQuery query = new XQuery( "declare boundary-space strip; {1} {2}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("12", false) ); } /** * strip whitespace line feed between enclosed expressions . */ @org.junit.Test public void constrWsEnclexpr5() { final XQuery query = new XQuery( "declare boundary-space strip; {1} {2}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("12", false) ); } /** * strip whitespace tab between enclosed expressions . */ @org.junit.Test public void constrWsEnclexpr6() { final XQuery query = new XQuery( "declare boundary-space strip; {1} {2}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("12", false) ); } /** * strip whitespace space between enclosed expression and close tag . */ @org.junit.Test public void constrWsEnclexpr7() { final XQuery query = new XQuery( "declare boundary-space strip; {1} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1", false) ); } /** * strip whitespace line feed between enclosed expression and close tag . */ @org.junit.Test public void constrWsEnclexpr8() { final XQuery query = new XQuery( "declare boundary-space strip; {1} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1", false) ); } /** * strip whitespace tab between enclosed expression and close tag . */ @org.junit.Test public void constrWsEnclexpr9() { final XQuery query = new XQuery( "declare boundary-space strip; {1} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1", false) ); } /** * preserve cdata space . */ @org.junit.Test public void constrWsGencdata1() { final XQuery query = new XQuery( "declare boundary-space strip; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" ", false) ); } /** * preserve cdata tab . */ @org.junit.Test public void constrWsGencdata3() { final XQuery query = new XQuery( queryFile( file( "prod/DirElemContent.whitespace/Constr-ws-gencdata-3.xq" ) ), ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("deep-equal(string-to-codepoints(string($result)), (9))") ); } /** * preserve character reference x20 . */ @org.junit.Test public void constrWsGenchref1() { final XQuery query = new XQuery( "declare boundary-space strip; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" ", false) ); } /** * preserve character reference xA . */ @org.junit.Test public void constrWsGenchref2() { final XQuery query = new XQuery( "declare boundary-space strip; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("deep-equal(string-to-codepoints(string($result)), (10))") ); } /** * preserve character reference xD . */ @org.junit.Test public void constrWsGenchref3() { final XQuery query = new XQuery( "declare boundary-space strip; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" ", false) ); } /** * preserve character reference x9 . */ @org.junit.Test public void constrWsGenchref4() { final XQuery query = new XQuery( "declare boundary-space strip; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\t", false) ); } /** * preserve enclosed exp space . */ @org.junit.Test public void constrWsGenenclexpr1() { final XQuery query = new XQuery( "declare boundary-space strip; {\" \"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" ", false) ); } /** * preserve enclosed exp line feed . */ @org.junit.Test public void constrWsGenenclexpr2() { final XQuery query = new XQuery( queryFile( file( "prod/DirElemContent.whitespace/Constr-ws-genenclexpr-2.xq" ) ), ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("deep-equal(string-to-codepoints(string($result)), (10))") ); } /** * preserve enclosed exp tab . */ @org.junit.Test public void constrWsGenenclexpr3() { final XQuery query = new XQuery( queryFile( file( "prod/DirElemContent.whitespace/Constr-ws-genenclexpr-3.xq" ) ), ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("deep-equal(string-to-codepoints(string($result)), (9))") ); } /** * preserve leading space . */ @org.junit.Test public void constrWsNobound1() { final XQuery query = new XQuery( "declare boundary-space strip; x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" x", false) ); } /** * preserve leading CRLF (as newline). */ @org.junit.Test public void constrWsNobound2() { final XQuery query = new XQuery( queryFile( file( "prod/DirElemContent.whitespace/Constr-ws-nobound-2.xq" ) ), ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("string-to-codepoints(string($result))[1] = 10") ); } /** * preserve leading tab . */ @org.junit.Test public void constrWsNobound3() { final XQuery query = new XQuery( queryFile( file( "prod/DirElemContent.whitespace/Constr-ws-nobound-3.xq" ) ), ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("string-to-codepoints(string($result))[1] = 9") ); } /** * preserve trailing space . */ @org.junit.Test public void constrWsNobound4() { final XQuery query = new XQuery( "declare boundary-space strip; x ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("x ", false) ); } /** * preserve trailing CRLF (as newline) . */ @org.junit.Test public void constrWsNobound5() { final XQuery query = new XQuery( queryFile( file( "prod/DirElemContent.whitespace/Constr-ws-nobound-5.xq" ) ), ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("deep-equal(string-to-codepoints(string($result)), (120, 10))") ); } /** * preserve trailing tab . */ @org.junit.Test public void constrWsNobound6() { final XQuery query = new XQuery( queryFile( file( "prod/DirElemContent.whitespace/Constr-ws-nobound-6.xq" ) ), ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertQuery("deep-equal(string-to-codepoints(string($result)), (120, 9))") ); } /** * strip whitespace space . */ @org.junit.Test public void constrWsTag1() { final XQuery query = new XQuery( "declare boundary-space strip; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * count text nodes when preserving whitespace . */ @org.junit.Test public void constrWsTag10() { final XQuery query = new XQuery( "declare boundary-space preserve; fn:count(( )//text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("9") ); } /** * strip whitespace line feed . */ @org.junit.Test public void constrWsTag2() { final XQuery query = new XQuery( "declare boundary-space strip; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * strip whitespace tab . */ @org.junit.Test public void constrWsTag3() { final XQuery query = new XQuery( "declare boundary-space strip; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * strip mixed whitespace . */ @org.junit.Test public void constrWsTag4() { final XQuery query = new XQuery( "declare boundary-space strip; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * count text nodes when stripping whitespace . */ @org.junit.Test public void constrWsTag5() { final XQuery query = new XQuery( "declare boundary-space strip; fn:count(( )//text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * preserve whitespace space . */ @org.junit.Test public void constrWsTag6() { final XQuery query = new XQuery( "declare boundary-space preserve; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" ", false) ); } /** * preserve whitespace line feed . */ @org.junit.Test public void constrWsTag7() { final XQuery query = new XQuery( "declare boundary-space preserve; \n" + "\n" + "\n" + "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\n\n\n", false) ); } /** * preserve whitespace tab . */ @org.junit.Test public void constrWsTag8() { final XQuery query = new XQuery( "declare boundary-space preserve; \t\t\t", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("\t\t\t", false) ); } /** * preserve mixed whitespace . */ @org.junit.Test public void constrWsTag9() { final XQuery query = new XQuery( "declare boundary-space preserve; \t\n" + " \t \t \n" + "\t\t\n" + "\t\n" + " \t\n" + " \t \t \n" + "\n" + " \t \n" + "\n" + " \t\n" + "\n" + "\t\t\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" \t\n \t \t \n\t\t\n\t\n \t\n \t \t \n\n \t \n\n \t\n\n\t\t\n ", false) ); } /** * ignore xml:space attribute preserve . */ @org.junit.Test public void constrWsXmlspace1() { final XQuery query = new XQuery( "declare boundary-space strip; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * ignore xml:space attribute strip . */ @org.junit.Test public void constrWsXmlspace2() { final XQuery query = new XQuery( "declare boundary-space preserve; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization(" ", false) || error("XQDY0092") ) ); } /** * Apply fn:string() on a direct element constructor with preserved whitespace. . */ @org.junit.Test public void k2DirectConElemWhitespace1() { final XQuery query = new XQuery( "declare boundary-space preserve; string( )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, " ") ); } /** * Ensure non-boundary characters, a character reference, are handled properly. . */ @org.junit.Test public void k2DirectConElemWhitespace10() { final XQuery query = new XQuery( "string( )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, " ") ); } /** * Ensure non-boundary characters, CDATA, are handled properly. . */ @org.junit.Test public void k2DirectConElemWhitespace11() { final XQuery query = new XQuery( "string( )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, " ") ); } /** * Ensure extracting the string value from mixed content involving elements is properly done. . */ @org.junit.Test public void k2DirectConElemWhitespace12() { final XQuery query = new XQuery( "string(123XXabc)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "123XXabc") ); } /** * Ensure extracting the string value from mixed content involving comments is properly done. . */ @org.junit.Test public void k2DirectConElemWhitespace13() { final XQuery query = new XQuery( "string(123abc)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "123abc") ); } /** * Ensure extracting the string value from mixed content involving processing instructions is properly done. . */ @org.junit.Test public void k2DirectConElemWhitespace14() { final XQuery query = new XQuery( "string(123abc)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "123abc") ); } /** * Ensure only one text node is constructed for contiguous data. . */ @org.junit.Test public void k2DirectConElemWhitespace15() { final XQuery query = new XQuery( "count(str{\"\"}asdas{\"asd\", \"asd\", \"''\", \"\"}{''}asd{''}{''}/text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Test empty element content result in an element with no children. . */ @org.junit.Test public void k2DirectConElemWhitespace16() { final XQuery query = new XQuery( "count(/node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Test empty element content result in an element with no children(#2). . */ @org.junit.Test public void k2DirectConElemWhitespace17() { final XQuery query = new XQuery( "count(/node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("0") ); } /** * Empty CDATA sections nevertheless causes whitespace to be preserved. . */ @org.junit.Test public void k2DirectConElemWhitespace18() { final XQuery query = new XQuery( "string( )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, " ") ); } /** * Extract the string value of nested elements. . */ @org.junit.Test public void k2DirectConElemWhitespace19() { final XQuery query = new XQuery( "string(eddd)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "eddd") ); } /** * Element constructor with no content. . */ @org.junit.Test public void k2DirectConElemWhitespace2() { final XQuery query = new XQuery( "{\"\"}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Extract the string value of nested elements with adjacent enclosed expressions. . */ @org.junit.Test public void k2DirectConElemWhitespace20() { final XQuery query = new XQuery( "{1}{1}{1}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("111", false) ); } /** * Extract the string value of nested elements with adjacent enclosed expressions(#2). . */ @org.junit.Test public void k2DirectConElemWhitespace21() { final XQuery query = new XQuery( "{1}{1}{1}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("111", false) ); } /** * It is valid to put ']]>' in element content. . */ @org.junit.Test public void k2DirectConElemWhitespace22() { final XQuery query = new XQuery( "string(]]>)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "]]>") ); } /** * Extract the string value of mixed content. . */ @org.junit.Test public void k2DirectConElemWhitespace23() { final XQuery query = new XQuery( "string()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "cdat") ); } /** * Extract the string value of mixed content(#2). . */ @org.junit.Test public void k2DirectConElemWhitespace24() { final XQuery query = new XQuery( "string( content content )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, " content content content ") ); } /** * Extract the string value of mixed content(#3). . */ @org.junit.Test public void k2DirectConElemWhitespace25() { final XQuery query = new XQuery( "string('\"< ]]>asda asdad) eq \"cdata&<>'\"\"< asda asdad\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Extract the string value of a couple of nested elements. . */ @org.junit.Test public void k2DirectConElemWhitespace26() { final XQuery query = new XQuery( "string( {1} {1} )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "11") ); } /** * Apply fn:string to an element constructor with two text nodes. . */ @org.junit.Test public void k2DirectConElemWhitespace3() { final XQuery query = new XQuery( "string(aaaaaaaa)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "aaaaaaaa") ); } /** * Serialize a direct element constructor with preserved whitespace. . */ @org.junit.Test public void k2DirectConElemWhitespace4() { final XQuery query = new XQuery( "declare boundary-space preserve; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" ", false) ); } /** * xml:space declarations are ignored. . */ @org.junit.Test public void k2DirectConElemWhitespace5() { final XQuery query = new XQuery( "declare boundary-space strip; string( ) eq \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * xml:space declarations are ignored(#2). . */ @org.junit.Test public void k2DirectConElemWhitespace6() { final XQuery query = new XQuery( "declare boundary-space strip; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * xml:space declarations are ignored(#3). . */ @org.junit.Test public void k2DirectConElemWhitespace7() { final XQuery query = new XQuery( "declare boundary-space preserve; string( ) eq \" \"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * xml:space declarations are ignored(#4). . */ @org.junit.Test public void k2DirectConElemWhitespace8() { final XQuery query = new XQuery( "declare boundary-space preserve; ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" ", false) ); } /** * No escaping mechanism applies for quotes/apostrophes inside element content. . */ @org.junit.Test public void k2DirectConElemWhitespace9() { final XQuery query = new XQuery( "string('a''a'''a\"a\"\"a\"\"\"a\") eq \"'a''a'''a\"\"a\"\"\"\"a\"\"\"\"\"\"a\"\"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdDirectConstructor.java000066400000000000000000001212141222453003200316160ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the DirectConstructor production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdDirectConstructor extends QT3TestSet { /** * comment constructor - regular . */ @org.junit.Test public void constrComment1() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * comment constructor - regular content . */ @org.junit.Test public void constrComment2() { final XQuery query = new XQuery( "fn:data() = \"comment\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * comment constructor - empty . */ @org.junit.Test public void constrComment3() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * comment constructor - empty content . */ @org.junit.Test public void constrComment4() { final XQuery query = new XQuery( "fn:data() = \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * comment constructor - special characters . */ @org.junit.Test public void constrComment5() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * comment constructor - single dash . */ @org.junit.Test public void constrComment6() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * comment constructor - trailing dash . */ @org.junit.Test public void constrComment7() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * comment constructor - double dash . */ @org.junit.Test public void constrComment8() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * PI constructor - regular . */ @org.junit.Test public void constrPiContent1() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * PI constructor - regular content . */ @org.junit.Test public void constrPiContent2() { final XQuery query = new XQuery( "fn:data() = \"content\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * PI constructor - empty . */ @org.junit.Test public void constrPiContent3() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * PI constructor - empty content . */ @org.junit.Test public void constrPiContent4() { final XQuery query = new XQuery( "fn:data() = \"\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * PI constructor - special characters . */ @org.junit.Test public void constrPiContent5() { final XQuery query = new XQuery( " ?>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" ?>", false) ); } /** * PI constructor - leading whitespace . */ @org.junit.Test public void constrPiContent6() { final XQuery query = new XQuery( "{string-to-codepoints()}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("120", false) ); } /** * PI constructor - trailing whitespace . */ @org.junit.Test public void constrPiContent7() { final XQuery query = new XQuery( "{string-to-codepoints()}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("120 32", false) ); } /** * PI constructor - syntax error . */ @org.junit.Test public void constrPiContent8() { final XQuery query = new XQuery( "?>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * PI constructor - target name xml . */ @org.junit.Test public void constrPiTarget1() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * PI constructor - target name xml . */ @org.junit.Test public void constrPiTarget2() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * PI constructor - target name xml . */ @org.junit.Test public void constrPiTarget3() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * PI constructor - target name xml . */ @org.junit.Test public void constrPiTarget4() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Test that processing-instruction data does not receive any special treatment. . */ @org.junit.Test public void k2DirectConOther1() { final XQuery query = new XQuery( "string() eq \"\"\"\"\"''content&amp;amp;ss&amp;#00; &amp;#x2014;\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Syntax error in comment. . */ @org.junit.Test public void k2DirectConOther10() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Space is not allowed between '", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * '|' is not allowed in PI target names. . */ @org.junit.Test public void k2DirectConOther21() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * ':' is not allowed in PI target names. . */ @org.junit.Test public void k2DirectConOther22() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntax error in processing instruction. . */ @org.junit.Test public void k2DirectConOther23() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntax error in processing instruction. . */ @org.junit.Test public void k2DirectConOther24() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntax error in processing instruction. . */ @org.junit.Test public void k2DirectConOther27() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Syntax error in processing instruction. . */ @org.junit.Test public void k2DirectConOther28() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Extract the name from a PI. . */ @org.junit.Test public void k2DirectConOther29() { final XQuery query = new XQuery( "local-name()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "xmlSUFFIX") ); } /** * Syntax error in comment. . */ @org.junit.Test public void k2DirectConOther3() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Extract the name from a PI. . */ @org.junit.Test public void k2DirectConOther30() { final XQuery query = new XQuery( "local-name()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PREFIXxml") ); } /** * Extract the name from a PI. . */ @org.junit.Test public void k2DirectConOther31() { final XQuery query = new XQuery( "local-name()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "PREFIXxmlSUFFIX") ); } /** * Extract the data from a directly constructed PI. . */ @org.junit.Test public void k2DirectConOther32() { final XQuery query = new XQuery( "?hm???> eq \"???<?hm??\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Extract the data from a directly constructed PI. . */ @org.junit.Test public void k2DirectConOther33() { final XQuery query = new XQuery( " eq \"content \"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Extract the data from a directly constructed PI. . */ @org.junit.Test public void k2DirectConOther34() { final XQuery query = new XQuery( " eq \"content a b c asdada dad \"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Extract the content from a comment. . */ @org.junit.Test public void k2DirectConOther35() { final XQuery query = new XQuery( " eq \" some - - - - content - - - >>>>> << >>><>& ;& \"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Extract the content from a comment. . */ @org.junit.Test public void k2DirectConOther36() { final XQuery query = new XQuery( " eq \" - - - - - - - - - - - - - - - - \"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Enclosed expressions aren't recognized inside processing instructions. . */ @org.junit.Test public void k2DirectConOther37() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Space after PI data isn't stripped. . */ @org.junit.Test public void k2DirectConOther38() { final XQuery query = new XQuery( "string() eq \"content \"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Mixed content involving two text nodes and one comment node. . */ @org.junit.Test public void k2DirectConOther39() { final XQuery query = new XQuery( "ab", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("ab", false) ); } /** * Syntax error in comment. . */ @org.junit.Test public void k2DirectConOther4() { final XQuery query = new XQuery( "b)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "ab") ); } /** * Ensure comment content doesn't receive special interpretation. . */ @org.junit.Test public void k2DirectConOther41() { final XQuery query = new XQuery( "string() eq \" content&amp;amp;ss&amp;amp;#00; &amp;#x2014;\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A PI target must be specified. . */ @org.junit.Test public void k2DirectConOther42() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Two subsequent processing instructions as a primary expression is a syntax error. . */ @org.junit.Test public void k2DirectConOther43() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Test the atomized type of a PI. . */ @org.junit.Test public void k2DirectConOther44() { final XQuery query = new XQuery( "data() instance of xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test the atomized type of a comment. . */ @org.junit.Test public void k2DirectConOther45() { final XQuery query = new XQuery( "data() instance of xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test serialization of tricky comment content. . */ @org.junit.Test public void k2DirectConOther46() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Use an ending ']]>' string inside a processing instruction. . */ @org.junit.Test public void k2DirectConOther47() { final XQuery query = new XQuery( "?>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("?>", false) ); } /** * Ensure xml:id is properly normalized, when using a direct constructor. The value is also an invalid xs:ID value, hence the allowed error code. . */ @org.junit.Test public void k2DirectConOther48() { final XQuery query = new XQuery( "string(exactly-one(/@*))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "ab c d") || error("XQDY0091") ) ); } /** * Check that an attribute value's value is properly read and serialized. Since the whitespace * is expressed with character references they are preserved and hence aren't subject to for * instance end-of-line handling. Subsequently, the serialization process must escape such characters * in order to not have the parser normalize the values when being read back in. . */ @org.junit.Test public void k2DirectConOther49() { final XQuery query = new XQuery( queryFile( file( "prod/DirectConstructor/K2-DirectConOther-49.xq" ) ), ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Syntax error in comment. . */ @org.junit.Test public void k2DirectConOther5() { final XQuery query = new XQuery( "", false) ); } /** * Ensure that EOLs are normalized in processing instructions. . */ @org.junit.Test public void k2DirectConOther54() { final XQuery query = new XQuery( queryFile( file( "prod/DirectConstructor/K2-DirectConOther-54.xq" ) ), ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * A single '>'. . */ @org.junit.Test public void k2DirectConOther55() { final XQuery query = new XQuery( ">", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A single '<'. . */ @org.junit.Test public void k2DirectConOther56() { final XQuery query = new XQuery( "<", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * '/>' is a syntax error. . */ @org.junit.Test public void k2DirectConOther57() { final XQuery query = new XQuery( "/>", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Ensure whitespace at the beginning of attributes, isn't stripped. . */ @org.junit.Test public void k2DirectConOther58() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Check attribute normalization, with apostrophes. . */ @org.junit.Test public void k2DirectConOther59() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Syntax error in comment. . */ @org.junit.Test public void k2DirectConOther6() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check normalization of attributes. . */ @org.junit.Test public void k2DirectConOther60() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * An unmatched curly in an attribute value template(quotes). . */ @org.junit.Test public void k2DirectConOther61() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * An unmatched curly in an attribute value template(apostrophes). . */ @org.junit.Test public void k2DirectConOther62() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * '1' is an invalid value for xml:id. . */ @org.junit.Test public void k2DirectConOther63() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("", false) || error("XQDY0091") ) ); } /** * 'PRESERVE' is an invalid value for xml:space. . */ @org.junit.Test public void k2DirectConOther64() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("", false) || error("XQDY0092") ) ); } /** * ' preserve' is an invalid value for xml:space. . */ @org.junit.Test public void k2DirectConOther65() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("", false) || error("XQDY0092") ) ); } /** * Ensure direct element constructors makes namespaces in scope for other node constructors. . */ @org.junit.Test public void k2DirectConOther66() { final XQuery query = new XQuery( "declare namespace a=\"http://example.com/NotThis\"; declare namespace g=\"http://example.com/NotThis2\"; { for $i in in-scope-prefixes() order by $i return $i, \"|\", for $i in in-scope-prefixes(element e {()}) order by $i return $i } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("a b c xml | a b c xml", false) ); } /** * Ensure the default namespace is picked up by independent child constructors. . */ @org.junit.Test public void k2DirectConOther67() { final XQuery query = new XQuery( "{namespace-uri-from-QName(node-name()), namespace-uri-from-QName(node-name(element e2 {()}))}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("http://example.com/3 http://example.com/3", false) ); } /** * Ensure that EOLs are normalized in attributes surrounded with quotes. . */ @org.junit.Test public void k2DirectConOther68() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Ensure that EOLs are normalized in attributes surrounded with apostrophes. . */ @org.junit.Test public void k2DirectConOther69() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Syntax error in comment. . */ @org.junit.Test public void k2DirectConOther7() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Ensure that EOLs are normalized in text nodes, but not when specified with character references. . */ @org.junit.Test public void k2DirectConOther70() { final XQuery query = new XQuery( "string-to-codepoints(\n" + "\n" + "\n" + " \n" + "| )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10 10 10 32 10 124 13 32 13 10") ); } /** * A small fragment using namespaces. . */ @org.junit.Test public void k2DirectConOther71() { final XQuery query = new XQuery( "", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Syntax error in comment. . */ @org.junit.Test public void k2DirectConOther8() { final XQuery query = new XQuery( "", false) ); } /** * FLWOR expressions with type declaration (simple type) . */ @org.junit.Test public void forExprType005() { final XQuery query = new XQuery( "for $int as xs:int in (xs:int(1), xs:int(2)) return $int", ctx); try { query.context(node(file("prod/ForClause/fsx.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2") ); } /** * Wrong type in type declaration . */ @org.junit.Test public void forExprType006() { final XQuery query = new XQuery( "for $int as xs:string in (xs:int(1), xs:int(2)) return $int", ctx); try { query.context(node(file("prod/ForClause/fsx.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Wrong order for type declaration . */ @org.junit.Test public void forExprType007() { final XQuery query = new XQuery( "for $file in (//Folder)[1]/File as element(Folder,xs:untypedAny) return $file/FileName", ctx); try { query.context(node(file("prod/ForClause/fsx.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Wrong order for positional and typing parts of FLWOR expression . */ @org.junit.Test public void forExprType008() { final XQuery query = new XQuery( "for $file at $pos as element(Folder,xs:untyped) in (//Folder)[1]/File return (string($file/FileName[1]), $pos)", ctx); try { query.context(node(file("prod/ForClause/fsx.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Missing type declaration on type expression . */ @org.junit.Test public void forExprType012() { final XQuery query = new XQuery( "for $file as in (//Folder)[1]/File return $file", ctx); try { query.context(node(file("prod/ForClause/fsx.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Type declaration is a super type . */ @org.junit.Test public void forExprType015() { final XQuery query = new XQuery( "for $num as xs:decimal in (xs:integer(1), xs:integer(2), xs:integer(3)) return $num", ctx); try { query.context(node(file("prod/ForClause/fsx.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3") ); } /** * Type declaration is a super type of the union type bound to the variable . */ @org.junit.Test public void forExprType016() { final XQuery query = new XQuery( "for $num as xs:decimal in (xs:integer(1), xs:decimal(2), xs:integer(3)) return $num", ctx); try { query.context(node(file("prod/ForClause/fsx.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3") ); } /** * Bound sequence is a union type containing a single instance that does not match the type declaration . */ @org.junit.Test public void forExprType017() { final XQuery query = new XQuery( "for $num as xs:double in (xs:int(\"1\"), xs:integer(\"2\"), xs:string(\"3\")) return $num", ctx); try { query.context(node(file("prod/ForClause/fsx.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Match a 'node' type . */ @org.junit.Test public void forExprType018() { final XQuery query = new XQuery( "for $file as node() in (//Folder)[1]/File return $file/FileName", ctx); try { query.context(node(file("prod/ForClause/fsx.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("File00000000000File00000000001File00000000002File00000000003File00000000004File00000000005File00000000006File00000000007File00000000008File00000000009File00000000010File00000000011File00000000012File00000000013File00000000014File00000000015File00000000016File00000000017File00000000018File00000000019File00000000020File00000000021File00000000022File00000000023File00000000024File00000000025File00000000026File00000000027File00000000028File00000000029File00000000030", false) ); } /** * Match a text node type . */ @org.junit.Test public void forExprType019() { final XQuery query = new XQuery( "for $fileName as text() in (//Folder)[1]/File/FileName/text() return string( $fileName )", ctx); try { query.context(node(file("prod/ForClause/fsx.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "File00000000000 File00000000001 File00000000002 File00000000003 File00000000004 File00000000005 File00000000006 File00000000007 File00000000008 File00000000009 File00000000010 File00000000011 File00000000012 File00000000013 File00000000014 File00000000015 File00000000016 File00000000017 File00000000018 File00000000019 File00000000020 File00000000021 File00000000022 File00000000023 File00000000024 File00000000025 File00000000026 File00000000027 File00000000028 File00000000029 File00000000030") ); } /** * Match a 'item' type . */ @org.junit.Test public void forExprType020() { final XQuery query = new XQuery( "for $fileName as item() in data( (//Folder)[1]/File/FileName ) return $fileName", ctx); try { query.context(node(file("prod/ForClause/fsx.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "File00000000000 File00000000001 File00000000002 File00000000003 File00000000004 File00000000005 File00000000006 File00000000007 File00000000008 File00000000009 File00000000010 File00000000011 File00000000012 File00000000013 File00000000014 File00000000015 File00000000016 File00000000017 File00000000018 File00000000019 File00000000020 File00000000021 File00000000022 File00000000023 File00000000024 File00000000025 File00000000026 File00000000027 File00000000028 File00000000029 File00000000030") ); } /** * Match a 'document' type . */ @org.junit.Test public void forExprType021() { final XQuery query = new XQuery( "for $doc as document-node() in (/) return count( $doc )", ctx); try { query.context(node(file("prod/ForClause/fsx.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * FLWOR expressions with type declaration. Value subtype promotion: Numeric based types -> integer . */ @org.junit.Test public void forExprType028() { final XQuery query = new XQuery( "\n" + " for $test as xs:integer in ( xs:byte(\"1\"), xs:long(\"10000\"), xs:negativeInteger(\"-10\"), \n" + " xs:short(\"100\"), xs:positiveInteger(\"100\"), xs:nonNegativeInteger(\"100\") ) \n" + " return $test\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 10000 -10 100 100 100") ); } /** * FLWOR expressions with type declaration. Value subtype promotion: Numeric based types -> decimal . */ @org.junit.Test public void forExprType029() { final XQuery query = new XQuery( "\n" + " for $test as xs:decimal in ( xs:integer(\"100\"), xs:short(\"1\"), xs:int(\"10000\"), \n" + " xs:nonPositiveInteger(\"-10\"), xs:unsignedShort(\"100\"), xs:positiveInteger(\"100\"), xs:nonNegativeInteger(\"100\") ) \n" + " return $test\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "100 1 10000 -10 100 100 100") ); } /** * FLWOR expressions with type declaration. Value subtype promotion: String based types -> normalizedString . */ @org.junit.Test public void forExprType030() { final XQuery query = new XQuery( "\n" + " for $test as xs:normalizedString in ( xs:language(\"en-US\"), xs:NCName(\"foobar\"), \n" + " xs:NMTOKEN(\"token1\"), xs:ENTITY(\"entity1\") ) \n" + " return $test\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "en-US foobar token1 entity1") ); } /** * FLWOR expressions with type declaration. Value subtype promotion: Time based types -> anyAtomicType . */ @org.junit.Test public void forExprType031() { final XQuery query = new XQuery( "\n" + " for $test as xs:anyAtomicType in ( xs:duration(\"P0Y1347M0D\"), xs:dateTime(\"1999-05-31T13:20:00-05:00\"), \n" + " xs:time(\"13:00:00-05:00\"), xs:date(\"1999-05-10Z\"), xs:gYearMonth(\"2002-03\"), xs:gYear(\"1999\"), \n" + " xs:gMonthDay(\"--05-10\"), xs:gDay(\"---10\"), xs:gMonth(\"--05\") ) \n" + " return $test\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "P112Y3M 1999-05-31T13:20:00-05:00 13:00:00-05:00 1999-05-10Z 2002-03 1999 --05-10 ---10 --05") ); } /** * FLWOR expressions with type declaration. Value based subtype promotion: 2nd level derived types . */ @org.junit.Test public void forExprType032() { final XQuery query = new XQuery( "\n" + " for $test as xs:anyAtomicType in ( xs:boolean(\"true\"), xs:base64Binary(\"abcd\"), xs:hexBinary(\"1234\"),\n" + " xs:float(\"5.7\"), xs:double(\"7.5\"), xs:anyURI(\"http://foo\") ) \n" + " return $test\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true abcd 1234 5.7 7.5 http://foo") ); } /** * FLWOR expressions with type declaration. Value based subtype promotion: Types from all levels . */ @org.junit.Test public void forExprType033() { final XQuery query = new XQuery( "\n" + " for $test as xs:anyAtomicType in ( xs:unsignedByte(\"10\"), xs:short(\"20\"), xs:positiveInteger(\"30\"), \n" + " xs:nonPositiveInteger(\"-40\"), xs:decimal(\"5.5\"), xs:ENTITY(\"entity1\"), xs:NCName(\"foobar\"), \n" + " xs:language(\"en-US\"), xs:string(\"foobar\"), xs:hexBinary(\"ffff\"), xs:gYear(\"1999\") ) \n" + " return $test\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10 20 30 -40 5.5 entity1 foobar en-US foobar FFFF 1999") ); } /** * FLWOR expressions with type declaration. Value based subtype promotion: numeric literal values -> double . */ @org.junit.Test public void forExprType034() { final XQuery query = new XQuery( "for $test as xs:decimal in ( 1, 0.3 ) return $test", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 0.3") ); } /** * FLWOR expressions with type declaration. Value based subtype promotion: string and numeric literal values -> anyAtomicType . */ @org.junit.Test public void forExprType035() { final XQuery query = new XQuery( "for $test as xs:anyAtomicType in ( 1, \"string\", 1e2, 0.3 ) return $test", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 string 100 0.3") ); } /** * FLWOR expressions with type declaration. Type declaration matching item() values . */ @org.junit.Test public void forExprType054() { final XQuery query = new XQuery( "\n" + " declare namespace fs=\"http://www.example.com/filesystem\"; \n" + " for $test as item() in data( (//fs:Folder)[1]/fs:File/fs:FileName ) return $test\n" + " ", ctx); try { query.context(node(file("prod/ForClause/fsx_NS.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "File00000000000 File00000000001 File00000000002") ); } /** * FLWOR expressions with type declaration. Type declaration matching node() values . */ @org.junit.Test public void forExprType055() { final XQuery query = new XQuery( "\n" + " declare namespace fs=\"http://www.example.com/filesystem\"; \n" + " for $test as node() in (//fs:Folder)[1]/fs:File return $test/fs:FileName\n" + " ", ctx); try { query.context(node(file("prod/ForClause/fsx_NS.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("File00000000000File00000000001File00000000002", false) ); } /** * FLWOR expressions with type declaration. Type declaration matching a document node . */ @org.junit.Test public void forExprType056() { final XQuery query = new XQuery( "\n" + " declare namespace fs=\"http://www.example.com/filesystem\"; \n" + " for $test as document-node() in (/) return ($test//fs:Folder)[1]/fs:FolderName\n" + " ", ctx); try { query.context(node(file("prod/ForClause/fsx_NS.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Folder00000000000", false) ); } /** * FLWOR expressions with type declaration. Type declaration matcing text nodes . */ @org.junit.Test public void forExprType057() { final XQuery query = new XQuery( "\n" + " declare namespace fs=\"http://www.example.com/filesystem\"; \n" + " for $test as text() in (//fs:Folder)[1]/fs:File/fs:FileName/text() return $test\n" + " ", ctx); try { query.context(node(file("prod/ForClause/fsx_NS.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("File00000000000File00000000001File00000000002", false) ); } /** * FLWOR expressions with type declaration. Type declaration matcing XML comment nodes . */ @org.junit.Test public void forExprType058() { final XQuery query = new XQuery( "\n" + " declare namespace fs=\"http://www.example.com/filesystem\"; \n" + " for $test as comment() in (//fs:Folder)[1]/comment() return $test\n" + " ", ctx); try { query.context(node(file("prod/ForClause/fsx_NS.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * FLWOR expressions with type declaration. Type declaration matcing PI nodes . */ @org.junit.Test public void forExprType059() { final XQuery query = new XQuery( "\n" + " declare namespace fs=\"http://www.example.com/filesystem\"; \n" + " for $test as processing-instruction() in (//fs:Folder)[1]//processing-instruction() return $test\n" + " ", ctx); try { query.context(node(file("prod/ForClause/fsx_NS.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * FLWOR expressions with type declaration. Type declaration matcing named PI nodes . */ @org.junit.Test public void forExprType060() { final XQuery query = new XQuery( "declare namespace fs=\"http://www.example.com/filesystem\"; for $test as processing-instruction() in (//fs:Folder)[1]//processing-instruction() return $test", ctx); try { query.context(node(file("prod/ForClause/fsx_NS.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * FLWOR expressions with type declaration. Type declaration matcing PI nodes - no matching PI found . */ @org.junit.Test public void forExprType061() { final XQuery query = new XQuery( "\n" + " declare namespace fs=\"http://www.example.com/filesystem\"; \n" + " for $test as processing-instruction(\"unknown\") in (//fs:Folder)[1]//processing-instruction() return $test\n" + " ", ctx); try { query.context(node(file("prod/ForClause/fsx_NS.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * FLWOR expressions with type declaration. Attempt type declaration of item() on a set of nodes . */ @org.junit.Test public void forExprType062() { final XQuery query = new XQuery( "\n" + " declare namespace fs=\"http://www.example.com/filesystem\"; \n" + " for $test as item() in (//fs:Folder)[1]/fs:File/fs:FileName return $test\n" + " ", ctx); try { query.context(node(file("prod/ForClause/fsx_NS.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("File00000000000File00000000001File00000000002", false) ); } /** * FLWOR expressions with type declaration. Attempt type declaration of node() on a set of items . */ @org.junit.Test public void forExprType063() { final XQuery query = new XQuery( "\n" + " declare namespace fs=\"http://www.example.com/filesystem\"; \n" + " for $test as node() in data( (//fs:Folder)[1]/fs:File/fs:FileName ) return $test\n" + " ", ctx); try { query.context(node(file("prod/ForClause/fsx_NS.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * FLWOR expressions with type declaration. Attempt type declaration of text() on a set of element nodes . */ @org.junit.Test public void forExprType064() { final XQuery query = new XQuery( "\n" + " declare namespace fs=\"http://www.example.com/filesystem\"; \n" + " for $test as text() in (//fs:Folder)[1]/fs:File/fs:FileName return $test\n" + " ", ctx); try { query.context(node(file("prod/ForClause/fsx_NS.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * FLWOR expressions with type declaration. Attempt type declaration of text() on a set of values . */ @org.junit.Test public void forExprType065() { final XQuery query = new XQuery( "\n" + " declare namespace fs=\"http://www.example.com/filesystem\"; \n" + " for $test as text() in data( (//fs:Folder)[1]/fs:File/fs:FileName ) return $test\n" + " ", ctx); try { query.context(node(file("prod/ForClause/fsx_NS.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * FLWOR expressions with type declaration. Attempt type declaration of comment() on a set of element nodes . */ @org.junit.Test public void forExprType066() { final XQuery query = new XQuery( "\n" + " declare namespace fs=\"http://www.example.com/filesystem\"; \n" + " for $test as comment() in (//fs:Folder)[1]/fs:File/fs:FileName return $test\n" + " ", ctx); try { query.context(node(file("prod/ForClause/fsx_NS.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * FLWOR expressions with type declaration. Attempt type declaration of comment() on a set of values . */ @org.junit.Test public void forExprType067() { final XQuery query = new XQuery( "\n" + " declare namespace fs=\"http://www.example.com/filesystem\"; \n" + " for $test as comment() in data( (//fs:Folder)[1]/fs:File/fs:FileName ) return $test\n" + " ", ctx); try { query.context(node(file("prod/ForClause/fsx_NS.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * FLWOR expressions with type declaration. Attempt type declaration of processing-instruction() on a set of element nodes . */ @org.junit.Test public void forExprType068() { final XQuery query = new XQuery( "\n" + " declare namespace fs=\"http://www.example.com/filesystem\"; \n" + " for $test as processing-instruction() in (//fs:Folder)[1]/fs:File/fs:FileName return $test\n" + " ", ctx); try { query.context(node(file("prod/ForClause/fsx_NS.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * FLWOR expressions with type declaration. Attempt type declaration of processing-instruction() on a set of values . */ @org.junit.Test public void forExprType069() { final XQuery query = new XQuery( "\n" + " declare namespace fs=\"http://www.example.com/filesystem\"; \n" + " for $test as processing-instruction() in data( (//fs:Folder)[1]/fs:File/fs:FileName ) return $test\n" + " ", ctx); try { query.context(node(file("prod/ForClause/fsx_NS.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * FLWOR expressions with type declaration. Attempt type declaration of processing-instruction() with name specifier, on a set of element nodes . */ @org.junit.Test public void forExprType070() { final XQuery query = new XQuery( "\n" + " declare namespace fs=\"http://www.example.com/filesystem\"; \n" + " for $test as processing-instruction(\"foo\") in (//fs:Folder)[1]/fs:File/fs:FileName return $test\n" + " ", ctx); try { query.context(node(file("prod/ForClause/fsx_NS.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * FLWOR expressions with type declaration. Attempt type declaration of processing-instruction() with name specifier, on a set of values . */ @org.junit.Test public void forExprType071() { final XQuery query = new XQuery( "\n" + " declare namespace fs=\"http://www.example.com/filesystem\"; \n" + " for $test as processing-instruction(\"foo\") in data( (//fs:Folder)[1]/fs:File/fs:FileName ) return $test\n" + " ", ctx); try { query.context(node(file("prod/ForClause/fsx_NS.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * FLWOR expressions with type declaration. Attempt type declaration of document-node() on a set of element nodes . */ @org.junit.Test public void forExprType072() { final XQuery query = new XQuery( "\n" + " declare namespace fs=\"http://www.example.com/filesystem\"; \n" + " for $test as document-node() in (//fs:Folder)[1]/fs:File/fs:FileName return $test\n" + " ", ctx); try { query.context(node(file("prod/ForClause/fsx_NS.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * FLWOR expressions with type declaration. Attempt type declaration of document-node() on a set of values . */ @org.junit.Test public void forExprType073() { final XQuery query = new XQuery( "\n" + " declare namespace fs=\"http://www.example.com/filesystem\"; \n" + " for $test as document-node() in data( (//fs:Folder)[1]/fs:File/fs:FileName ) return $test\n" + " ", ctx); try { query.context(node(file("prod/ForClause/fsx_NS.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Syntactically invalid for-expression. . */ @org.junit.Test public void kForExprWithout1() { final XQuery query = new XQuery( "for $foo in 1, $bar in 2, $moo in 3, return 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A test whose essence is: `deep-equal((for $var in (1, 2, 3) return $var), (1, 2, 3))`. . */ @org.junit.Test public void kForExprWithout10() { final XQuery query = new XQuery( "deep-equal((for $var in (1, 2, 3) return $var), (1, 2, 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal((2, 2), (for $foo in (1, 1) return 1 + $foo))`. . */ @org.junit.Test public void kForExprWithout11() { final XQuery query = new XQuery( "deep-equal((2, 2), (for $foo in (1, 1) return 1 + $foo))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `4 eq (for $foo in 1, $bar in 2, $moo in 3 return 4)`. . */ @org.junit.Test public void kForExprWithout12() { final XQuery query = new XQuery( "4 eq (for $foo in 1, $bar in 2, $moo in 3 return 4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `3 eq (for $foo in 1 return for $bar in 2 return $bar + $foo)`. . */ @org.junit.Test public void kForExprWithout13() { final XQuery query = new XQuery( "3 eq (for $foo in 1 return for $bar in 2 return $bar + $foo)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `3 eq (for $foo in 1 return for $bar in 2 return $bar + $foo)`. . */ @org.junit.Test public void kForExprWithout14() { final XQuery query = new XQuery( "3 eq (for $foo in 1 return for $bar in 2 return $bar + $foo)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `3 eq (for $foo in 1, $foo in 3 return $foo)`. . */ @org.junit.Test public void kForExprWithout15() { final XQuery query = new XQuery( "3 eq (for $foo in 1, $foo in 3 return $foo)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `8 eq (for $foo in 1, $foo in 3, $moo in 5 return $moo + $foo)`. . */ @org.junit.Test public void kForExprWithout16() { final XQuery query = new XQuery( "8 eq (for $foo in 1, $foo in 3, $moo in 5 return $moo + $foo)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `6 eq (for $foo in 1, $foo in 3 return $foo + $foo)`. . */ @org.junit.Test public void kForExprWithout17() { final XQuery query = new XQuery( "6 eq (for $foo in 1, $foo in 3 return $foo + $foo)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A for variable binding to the empty sequence. . */ @org.junit.Test public void kForExprWithout18() { final XQuery query = new XQuery( "empty(for $var in () return current-time())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * A for variable binding to the empty sequence. . */ @org.junit.Test public void kForExprWithout19() { final XQuery query = new XQuery( "empty(for $var in () return 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Syntactically invalid for-expression. . */ @org.junit.Test public void kForExprWithout2() { final XQuery query = new XQuery( "for in 1 return 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A for variable binding to the empty sequence, combined with value comparison. . */ @org.junit.Test public void kForExprWithout20() { final XQuery query = new XQuery( "empty((for $var in () return current-time()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * A for variable binding to the empty sequence, combined with value comparison. . */ @org.junit.Test public void kForExprWithout21() { final XQuery query = new XQuery( "empty((for $var in () return 1) eq 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * A for variable binding to the empty sequence, combined with value comparison. . */ @org.junit.Test public void kForExprWithout22() { final XQuery query = new XQuery( "empty(for $var in subsequence((current-time(), 1), 4) return 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An for-return expression which only is the binding variable. . */ @org.junit.Test public void kForExprWithout23() { final XQuery query = new XQuery( "deep-equal(remove(for $var in (current-time(), 2, 3, 4) return $var, 1), (2, 3, 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(for $fn:name in (1, 1) return $fn:name) instance of xs:integer+`. . */ @org.junit.Test public void kForExprWithout24() { final XQuery query = new XQuery( "(for $fn:name in (1, 1) return $fn:name) instance of xs:integer+", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(for $xs:name in (1, 1) return $xs:name) instance of xs:integer+`. . */ @org.junit.Test public void kForExprWithout25() { final XQuery query = new XQuery( "(for $xs:name in (1, 1) return $xs:name) instance of xs:integer+", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Variable which is not in scope. . */ @org.junit.Test public void kForExprWithout26() { final XQuery query = new XQuery( "$NOTEXIST", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * Variable which is not in scope. . */ @org.junit.Test public void kForExprWithout27() { final XQuery query = new XQuery( "$PREFIXNOTEXIST:NOTEXIST", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0081") ); } /** * Variable which is not in scope. . */ @org.junit.Test public void kForExprWithout28() { final XQuery query = new XQuery( "$xs:NOTEXIST", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * Variable which is not in scope. . */ @org.junit.Test public void kForExprWithout29() { final XQuery query = new XQuery( "1 + $NOTEXIST", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * Syntactically invalid for-expression. . */ @org.junit.Test public void kForExprWithout3() { final XQuery query = new XQuery( "for return 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Variable which is not in scope. . */ @org.junit.Test public void kForExprWithout30() { final XQuery query = new XQuery( "1 + $prefix:NOTEXIST", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0081") ); } /** * Variable which is not in scope. . */ @org.junit.Test public void kForExprWithout31() { final XQuery query = new XQuery( "1 + $xs:NOTEXIST", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * Variable which is not in scope. . */ @org.junit.Test public void kForExprWithout32() { final XQuery query = new XQuery( "$NOTEXIST + 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * Variable which is not in scope. . */ @org.junit.Test public void kForExprWithout33() { final XQuery query = new XQuery( "$PREFIXNOTEXIST:NOTEXIST + 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0081") ); } /** * Variable which is not in scope. . */ @org.junit.Test public void kForExprWithout34() { final XQuery query = new XQuery( "$xs:NOTEXIST + 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * Variable which is not in scope. . */ @org.junit.Test public void kForExprWithout35() { final XQuery query = new XQuery( "for $foo in 1 return $NOTEXIST", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * Variable which is not in scope. . */ @org.junit.Test public void kForExprWithout36() { final XQuery query = new XQuery( "for $foo in (1, 2, $foo) return 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * Variable which is not in scope. . */ @org.junit.Test public void kForExprWithout37() { final XQuery query = new XQuery( "for $foo in (1, $foo, 3) return 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * Variable which is not in scope. . */ @org.junit.Test public void kForExprWithout38() { final XQuery query = new XQuery( "for $foo in ($foo, 2, 3) return 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * Variable which is not in scope. . */ @org.junit.Test public void kForExprWithout39() { final XQuery query = new XQuery( "for $foo in $foo return 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * Syntactically invalid for-expression. . */ @org.junit.Test public void kForExprWithout4() { final XQuery query = new XQuery( "for $a in 1 satisfies 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Variable which is not in scope. . */ @org.junit.Test public void kForExprWithout40() { final XQuery query = new XQuery( "for $foo in 1 return $bar + (for $bar in 2 return $bar)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * Variable which is not in scope. . */ @org.junit.Test public void kForExprWithout41() { final XQuery query = new XQuery( "for $a in (1, 2, 3), $b in (1, 2, 3, $b) return $a, $b", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * Variable which is not in scope. . */ @org.junit.Test public void kForExprWithout42() { final XQuery query = new XQuery( "for $a in (1, 2), $b in (1, 2), $c in (1, 2) return 1, $a", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * Variable which is not in scope. . */ @org.junit.Test public void kForExprWithout43() { final XQuery query = new XQuery( "for $a in (1, 2) return 1, $a", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * Variable which is not in scope. . */ @org.junit.Test public void kForExprWithout44() { final XQuery query = new XQuery( "for $a in (1, 2), $b in (1, 2), $c in (1, 2) return 1, $b", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * Variable which is not in scope. . */ @org.junit.Test public void kForExprWithout45() { final XQuery query = new XQuery( "for $a in (1, 2), $b in (1, 2), $c in (1, 2) return 1, $c", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * Type check: $foo is of type xs:string, which cannot be added to xs:integer 1. . */ @org.junit.Test public void kForExprWithout46() { final XQuery query = new XQuery( "for $foo in \"foo\" return 1 + $foo", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A variable's for expression causes type error in a value comparison. . */ @org.junit.Test public void kForExprWithout47() { final XQuery query = new XQuery( "for $foo in (\"a string\", \"another one\") return 1 + subsequence($foo, 1, 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Parser test: variable names in a for expression that only exist of one character are valid. . */ @org.junit.Test public void kForExprWithout48() { final XQuery query = new XQuery( "1 eq (for $a in 1 return $a)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * For-expression involving a simple return statement that in some implementations trigger optimization paths. . */ @org.junit.Test public void kForExprWithout49() { final XQuery query = new XQuery( "deep-equal((for $fo in trace((1, 2, 3), \"msg\") return $fo), (1, 2, 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `deep-equal(1 to 5, (for $i in (1,2,3,4,5) return $i))`. . */ @org.junit.Test public void kForExprWithout5() { final XQuery query = new XQuery( "deep-equal(1 to 5, (for $i in (1,2,3,4,5) return $i))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure scanners/parsers accept small QNames in for-expressions. . */ @org.junit.Test public void kForExprWithout50() { final XQuery query = new XQuery( "1 eq (for $a in 1 return $a)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure scanners/parsers accept small QNames in for-expressions(#2). . */ @org.junit.Test public void kForExprWithout51() { final XQuery query = new XQuery( "1 eq (for $xs:a in 1 return $xs:a)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A binding in a for-expression shadows global variables. . */ @org.junit.Test public void kForExprWithout52() { final XQuery query = new XQuery( "\n" + " declare variable $i := false(); \n" + " declare variable $t := false(); \n" + " deep-equal( for $i in (true(), true()), $t in (true(), true()) \n" + " return ($i, $t), (true(), true(), true(), true(), true(), true(), true(), true()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the correct variable is used in an for-expression whose return sequence is only a variable reference. . */ @org.junit.Test public void kForExprWithout53() { final XQuery query = new XQuery( "declare variable $my := 3; (for $i in 1 return $my) eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure the correct variable is used in an for-expression whose return sequence is only a variable reference(#2). . */ @org.junit.Test public void kForExprWithout54() { final XQuery query = new XQuery( "declare variable $i := 3; (for $i in 1 return $i) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Apply fn:count() to a for-expression. . */ @org.junit.Test public void kForExprWithout55() { final XQuery query = new XQuery( "count(for $i in (1, 2, current-time()) return ($i, $i)) eq 6", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Apply fn:count() to a for-expression(#2). . */ @org.junit.Test public void kForExprWithout56() { final XQuery query = new XQuery( "count(for $i in (1, 2, timezone-from-time(current-time())) return ($i, $i)) eq 6 or count(for $i in (1, 2, timezone-from-time(current-time())) return ($i, $i)) eq 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `3 eq (for $foo in 1 return 3)`. . */ @org.junit.Test public void kForExprWithout6() { final XQuery query = new XQuery( "3 eq (for $foo in 1 return 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `1 eq (for $foo in 1 return $foo)`. . */ @org.junit.Test public void kForExprWithout7() { final XQuery query = new XQuery( "1 eq (for $foo in 1 return $foo)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `2 eq (for $foo in 1 return $foo + 1)`. . */ @org.junit.Test public void kForExprWithout8() { final XQuery query = new XQuery( "2 eq (for $foo in 1 return $foo + 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `3 eq (for $foo in 1 return for $foo in 3 return $foo)`. . */ @org.junit.Test public void kForExprWithout9() { final XQuery query = new XQuery( "3 eq (for $foo in 1 return for $foo in 3 return $foo)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * For declarations does not cause type promotions to apply. . */ @org.junit.Test public void k2ForExprWith1() { final XQuery query = new XQuery( "for $i as xs:string in xs:untypedAtomic(\"input\") return $i", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Keywords are case sensitive. . */ @org.junit.Test public void k2ForExprWithout1() { final XQuery query = new XQuery( "FOR $i IN (1, 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Make use of many syntactical combinations. . */ @org.junit.Test public void k2ForExprWithout10() { final XQuery query = new XQuery( "\n" + " for $a in (3, 2, 1) \n" + " for $b in (6, 5, 4) \n" + " let $c := $a + $b \n" + " let $d := $a - $b \n" + " let $e := () stable order by $a ascending, $b descending, $d empty greatest, $e empty least, $c descending empty greatest, $d ascending empty greatest, $e descending empty least, $b ascending empty least \n" + " return $a", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertStringValue(false, "1 1 1 2 2 2 3 3 3") || error("XPST0005") ) ); } /** * The return expression does not depend on the for iteration. . */ @org.junit.Test public void k2ForExprWithout11() { final XQuery query = new XQuery( "for $a in (3, 2, 1, 1) stable order by $a return 5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5 5 5 5") ); } /** * The order by expression does not depend on the for iteration. . */ @org.junit.Test public void k2ForExprWithout12() { final XQuery query = new XQuery( "for $a in (3, 2, 1, 1) stable order by 1 return $a", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3 2 1 1") ); } /** * Use the focus from within a for-expression. . */ @org.junit.Test public void k2ForExprWithout13() { final XQuery query = new XQuery( "/(for $i in self::node() return $i)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Use the focus from within a for tail-expression. . */ @org.junit.Test public void k2ForExprWithout14() { final XQuery query = new XQuery( "/(for $i in 1, $b in self::node() return $b)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Use a name test named 'node' inside a for loop, inside a user function. . */ @org.junit.Test public void k2ForExprWithout15() { final XQuery query = new XQuery( "declare function local:func($arg as element()* ) as element()* { for $n in $arg/element return $n }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Use a name test named 'document' inside a for loop, inside a user function. . */ @org.junit.Test public void k2ForExprWithout16() { final XQuery query = new XQuery( "declare function local:func($arg as element()* ) as element()* { for $n in $arg/document return $n }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Use a name test named 'document' inside a for loop, inside a user function. . */ @org.junit.Test public void k2ForExprWithout17() { final XQuery query = new XQuery( "declare function local:func($arg as element()* ) as element()* { for $n in $arg/document-node return $n }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Use a name test named 'attribute' inside a for loop, inside a user function. . */ @org.junit.Test public void k2ForExprWithout18() { final XQuery query = new XQuery( "declare function local:func($arg as element()* ) as element()* { for $n in $arg/attribute return $n }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Use a name test named 'comment' inside a for loop, inside a user function. . */ @org.junit.Test public void k2ForExprWithout19() { final XQuery query = new XQuery( "declare function local:func($arg as element()* ) as element()* { for $n in $arg/comment return $n }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * A for-expression doesn't create a focus. . */ @org.junit.Test public void k2ForExprWithout2() { final XQuery query = new XQuery( "\n" + " declare function local:myFunc() { for $i in (1, 2, 3) return position() }; \n" + " local:myFunc()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Use a name test named 'processing-instruction' inside a for loop, inside a user function. . */ @org.junit.Test public void k2ForExprWithout20() { final XQuery query = new XQuery( "declare function local:func($arg as element()* ) as element()* { for $n in $arg/processing-instruction return $n }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Use a name test named 'processing-instruction' inside a for loop, inside a user function. . */ @org.junit.Test public void k2ForExprWithout21() { final XQuery query = new XQuery( "declare function local:func($arg as element()* ) as element()* { for $n in $arg/processing-instruction return $n }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Use a name test named 'text' inside a for loop, inside a user function. . */ @org.junit.Test public void k2ForExprWithout22() { final XQuery query = new XQuery( "declare function local:func($arg as element()* ) as element()* { for $n in $arg/text return $n }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Use a name test named 'typeswitch' inside a for loop, inside a user function. . */ @org.junit.Test public void k2ForExprWithout23() { final XQuery query = new XQuery( "declare function local:func($arg as element()* ) as element()* { for $n in $arg/typeswitch return $n }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Use a name test named 'if' inside a for loop, inside a user function. . */ @org.junit.Test public void k2ForExprWithout24() { final XQuery query = new XQuery( "declare function local:func($arg as element()* ) as element()* { for $n in $arg/if return $n }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Use a name test named 'for' inside a for loop, inside a user function. . */ @org.junit.Test public void k2ForExprWithout25() { final XQuery query = new XQuery( "declare function local:func($arg as element()* ) as element()* { for $n in $arg/for return $n }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Use a name test named 'let' inside a for loop, inside a user function. . */ @org.junit.Test public void k2ForExprWithout26() { final XQuery query = new XQuery( "declare function local:func($arg as element()* ) as element()* { for $n in $arg/let return $n }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Use a name test named 'declare' inside a for loop, inside a user function. . */ @org.junit.Test public void k2ForExprWithout27() { final XQuery query = new XQuery( "declare function local:func($arg as element()* ) as element()* { for $n in $arg/declare return $n }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Use a name test named 'some' inside a for loop, inside a user function. . */ @org.junit.Test public void k2ForExprWithout28() { final XQuery query = new XQuery( "declare function local:func($arg as element()* ) as element()* { for $n in $arg/some return $n }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Use a name test named 'child' inside a for loop, inside a user function. . */ @org.junit.Test public void k2ForExprWithout29() { final XQuery query = new XQuery( "declare function local:func($arg as element()* ) as element()* { for $n in $arg/child return $n }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * A for-expression doesn't create a focus(#2). . */ @org.junit.Test public void k2ForExprWithout3() { final XQuery query = new XQuery( "declare function local:myFunc() { for $i in (1, 2, 3) return position() }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1") || error("XPDY0002") ) ); } /** * Use a name test named 'ordered' inside a for loop, inside a user function. . */ @org.junit.Test public void k2ForExprWithout30() { final XQuery query = new XQuery( "declare function local:func($arg as element()* ) as element()* { for $n in $arg/ordered return $n }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Use a name test named 'unordered' inside a for loop, inside a user function. . */ @org.junit.Test public void k2ForExprWithout31() { final XQuery query = new XQuery( "declare function local:func($arg as element()* ) as element()* { for $n in $arg/unordered return $n }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Use a name test named 'schema-attribute' inside a for loop, inside a user function. . */ @org.junit.Test public void k2ForExprWithout32() { final XQuery query = new XQuery( "declare function local:func($arg as element()* ) as element()* { for $n in $arg/schema-attribute return $n }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Use a name test named 'schema-attribute' inside a for loop, inside a user function. . */ @org.junit.Test public void k2ForExprWithout33() { final XQuery query = new XQuery( "declare function local:func($arg as element()* ) as element()* { for $n in $arg/schema-element return $n }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Use a name test named 'item' inside a for loop, inside a user function. . */ @org.junit.Test public void k2ForExprWithout34() { final XQuery query = new XQuery( "declare function local:func($arg as element()* ) as element()* { for $n in $arg/item return $n }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Use a name test named 'following-sibling' inside a for loop, inside a user function. . */ @org.junit.Test public void k2ForExprWithout35() { final XQuery query = new XQuery( "declare function local:func($arg as element()* ) as element()* { for $n in $arg/following-sibling return $n }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Use a name test named 'validate' inside a for loop, inside a user function. . */ @org.junit.Test public void k2ForExprWithout36() { final XQuery query = new XQuery( "declare function local:func($arg as element()* ) as element()* { for $n in $arg/validate return $n }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Use a name test named 'instance' inside a for loop, inside a user function. . */ @org.junit.Test public void k2ForExprWithout37() { final XQuery query = new XQuery( "declare function local:func($arg as element()* ) as element()* { for $n in $arg/instance return $n }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Use a name test named 'castable' inside a for loop, inside a user function. . */ @org.junit.Test public void k2ForExprWithout38() { final XQuery query = new XQuery( "declare function local:func($arg as element()* ) as element()* { for $n in $arg/castable return $n }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Use a name test named 'import' inside a for loop, inside a user function. . */ @org.junit.Test public void k2ForExprWithout39() { final XQuery query = new XQuery( "declare function local:func($arg as element()* ) as element()* { for $n in $arg/import return $n }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * A for-expression with a positional variable doesn't create a focus. . */ @org.junit.Test public void k2ForExprWithout4() { final XQuery query = new XQuery( "declare function local:myFunc() { for $i at $p in (1, 2, 3) return position() }; local:myFunc()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Use a name test named 'node' inside a for loop. . */ @org.junit.Test public void k2ForExprWithout40() { final XQuery query = new XQuery( "for $n in node return 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Use a name test named 'document' inside a for loop. . */ @org.junit.Test public void k2ForExprWithout41() { final XQuery query = new XQuery( "for $n in document return 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Use a computed attribute constructor with name return, inside a for loop. . */ @org.junit.Test public void k2ForExprWithout42() { final XQuery query = new XQuery( "for $n in attribute return {()} return 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Use a computed element constructor with name return, inside a for loop. . */ @org.junit.Test public void k2ForExprWithout43() { final XQuery query = new XQuery( "for $n in element return {()} return 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Use a computed processing-instruction constructor with name return, inside a for loop. . */ @org.junit.Test public void k2ForExprWithout44() { final XQuery query = new XQuery( "for $n in processing-instruction return {()} return 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Use name test 'attribute' constructor with name return, inside a for loop. . */ @org.junit.Test public void k2ForExprWithout45() { final XQuery query = new XQuery( "for $n in attribute return 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1") || error("XPDY0002") ) ); } /** * A for-expression with a positional variable doesn't create a focus(#2). . */ @org.junit.Test public void k2ForExprWithout5() { final XQuery query = new XQuery( "declare function local:myFunc() { for $i at $p in (1, 2, 3) return position() }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1") || error("XPDY0002") ) ); } /** * A query that performs up-transformation of dates. . */ @org.junit.Test public void k2ForExprWithout6() { final XQuery query = new XQuery( "for $ti in 1788050519550505 return { fn:min(if ($ti/singleDate) then let $tmp:=$ti/singleDate/compute return xs:date(fn:concat(fn:substring($tmp, 1, 4), \"-\", fn:substring($tmp, 5, 2), \"-\", fn:substring($tmp, 7, 2))) else let $tmp:=$ti/rangeDate/initDate return xs:date(fn:concat(fn:substring($tmp, 1, 4), \"-\", fn:substring($tmp, 5, 2), \"-\", fn:substring($tmp, 7, 2)))) } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1788-05-05", false) ); } /** * Ensure use of the undefined focus gets flagged. . */ @org.junit.Test public void k2ForExprWithout7() { final XQuery query = new XQuery( "for $d in person return $d", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Wrap a path expression. . */ @org.junit.Test public void k2ForExprWithout8() { final XQuery query = new XQuery( "(for $d in First Second /person return if (some $id in 1 satisfies typeswitch ($d/@id) case $n as node() return $d/@id = \"person0\" default $d return ()) then $d/name else ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("First", false) ); } /** * Ensure positional variables and bindings handles nesting. . */ @org.junit.Test public void k2ForExprWithout9() { final XQuery query = new XQuery( "for $a at $pos1 in (1, 2, 3) return for $b at $pos2 in (4, 5, 6) return for $c at $pos3 in (7, 8, 9) return ($a, $pos1, $b, $pos2, $c, $pos2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 1 4 1 7 1 1 1 4 1 8 1 1 1 4 1 9 1 1 1 5 2 7 2 1 1 5 2 8 2 1 1 5 2 9 2 1 1 6 3 7 3 1 1 6 3 8 3 1 1 6 3 9 3 2 2 4 1 7 1 2 2 4 1 8 1 2 2 4 1 9 1 2 2 5 2 7 2 2 2 5 2 8 2 2 2 5 2 9 2 2 2 6 3 7 3 2 2 6 3 8 3 2 2 6 3 9 3 3 3 4 1 7 1 3 3 4 1 8 1 3 3 4 1 9 1 3 3 5 2 7 2 3 3 5 2 8 2 3 3 5 2 9 2 3 3 6 3 7 3 3 3 6 3 8 3 3 3 6 3 9 3") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdFunctionCall.java000066400000000000000000001274771222453003200305400ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the FunctionCall production. * Contains tests verifying the function calling mechanism; not a particular function implementation.. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdFunctionCall extends QT3TestSet { /** * Test that arguments are atomized - built in function. */ @org.junit.Test public void functionCall001() { final XQuery query = new XQuery( "concat(X, Y)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "XY") ); } /** * Test that arguments are atomized - constructor function. */ @org.junit.Test public void functionCall002() { final XQuery query = new XQuery( "xs:boolean(0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test that arguments are atomized - user-defined function. */ @org.junit.Test public void functionCall004() { final XQuery query = new XQuery( "\n" + " declare function local:f($in as xs:boolean) as xs:boolean { $in };\n" + " local:f(0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test that arguments are atomized - anonymous inline function. */ @org.junit.Test public void functionCall006() { final XQuery query = new XQuery( "\n" + " let $f := function ($in as xs:boolean) as xs:boolean { $in }\n" + " return $f(0)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test that a sequence of untypedAtomic values is cast to the target type: user-defined function. * Also tests XPath 3.0 casting to list, and bang operator.. */ @org.junit.Test public void functionCall009() { final XQuery query = new XQuery( "\n" + " declare function local:f($in as xs:decimal*) as xs:decimal {sum($in, 0.0)};\n" + " local:f(xs:NMTOKENS('1 1.2 1.3 1.4')!xs:untypedAtomic(.))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertType("xs:decimal") && assertEq("4.9") ) ); } /** * Test that the untypedAtomic result of a user-defined function is cast to the declared type.. */ @org.junit.Test public void functionCall013() { final XQuery query = new XQuery( "\n" + " declare function local:f($a as xs:integer, $b as xs:integer) as xs:integer {\n" + " data({$a}{$b})\n" + " };\n" + " local:f(12, 34)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertType("xs:integer") && assertEq("1234") ) ); } /** * Test that the untypedAtomic result of an inline function is cast to the declared type.. */ @org.junit.Test public void functionCall014() { final XQuery query = new XQuery( "\n" + " let $f := function($a as xs:integer, $b as xs:integer) as xs:integer {\n" + " data({$a}{$b})\n" + " }\n" + " return $f(12, 34)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertType("xs:integer") && assertEq("1234") ) ); } /** * Test that a sequence of arguments is atomized. */ @org.junit.Test public void functionCall023() { final XQuery query = new XQuery( "string-join((X, Y, Z), '')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "XYZ") ); } /** * A test whose essence is: `func-does-not-exist(1, 2, 3)`. . */ @org.junit.Test public void kFunctionCallExpr1() { final XQuery query = new XQuery( "func-does-not-exist(1, 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A function call containing an invalid QName as name. . */ @org.junit.Test public void kFunctionCallExpr10() { final XQuery query = new XQuery( "p:f:lname()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XPST0081") ) ); } /** * No function by name fn:document() exists(although one does in XSL-T). . */ @org.junit.Test public void kFunctionCallExpr11() { final XQuery query = new XQuery( "document(\"example.com/file.ext\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No function by name fn:unparsed-text() exists(although one does in XSL-T). . */ @org.junit.Test public void kFunctionCallExpr12() { xquery10(); final XQuery query = new XQuery( "unparsed-text(\"example.com/file.ext\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No function by name fn:unparsed-text() exists(although one does in XSL-T). . */ @org.junit.Test public void kFunctionCallExpr13() { xquery10(); final XQuery query = new XQuery( "unparsed-text-available(\"example.com/file.ext\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No function by name fn:key() exists(although one does in XSL-T). . */ @org.junit.Test public void kFunctionCallExpr14() { final XQuery query = new XQuery( "key('func', \"a value\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No function by name fn:format-number() exists in XQuery 1.0 (although one does in XSLT and in XQuery 3.0). . */ @org.junit.Test public void kFunctionCallExpr15() { xquery10(); final XQuery query = new XQuery( "format-number(3, \"0000\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No function by name fn:format-number() exists in XQuery 1.0 (although one does in XSLT and in XQuery 3.0). . */ @org.junit.Test public void kFunctionCallExpr15a() { final XQuery query = new XQuery( "format-number(3, \"0000\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("\"0003\"") ); } /** * No function by name fn:format-time() exists in XQuery 1.0 (although one does in XSLT). . */ @org.junit.Test public void kFunctionCallExpr16() { xquery10(); final XQuery query = new XQuery( "matches(format-time(current-time(), \"[H01]:[m01]\"), \"[0-2][0-9]:[0-5][0-9]\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No function by name fn:format-time() exists in XQuery 1.0 (although one does in XSLT). . */ @org.junit.Test public void kFunctionCallExpr16a() { final XQuery query = new XQuery( "matches(format-time(current-time(), \"[H01]:[m01]\"), \"[0-2][0-9]:[0-5][0-9]\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * No function by name fn:format-time() exists in XQuery 1.0 (although one does in XSLT). . */ @org.junit.Test public void kFunctionCallExpr17() { xquery10(); final XQuery query = new XQuery( "matches(format-time(current-time(), \"[H01]:[m01]\", (), (), ()), \"..:..\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No function by name fn:format-time() exists in XQuery 1.0 (although one does in XSLT). . */ @org.junit.Test public void kFunctionCallExpr17a() { final XQuery query = new XQuery( "matches(format-time(current-time(), \"[H01]:[m01]\", (), (), ()), \"..:..\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * No function by name fn:format-date() exists in XQuery 1.0 (although one does in XSLT and XQuery 1.1). . */ @org.junit.Test public void kFunctionCallExpr18() { final XQuery query = new XQuery( "matches(format-dateTime(current-dateTime(), \"[Y0001]-[M01]-[D01]\"), \"[0-9]{4}-[0-9]{2}-[0-9]{2}\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0017") ) ); } /** * No function by name fn:format-dateTime() exists in XQuery 1.0 (although one does in XSLT and XQuery 1.1). . */ @org.junit.Test public void kFunctionCallExpr19() { final XQuery query = new XQuery( "matches(format-dateTime(current-dateTime(), \"[Y0001]-[M01]-[D01]\", (), (), ()), \"....-..-..\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0017") ) ); } /** * A test whose essence is: `fn:func-does-not-exist(1, 2, 3)`. . */ @org.junit.Test public void kFunctionCallExpr2() { final XQuery query = new XQuery( "fn:func-does-not-exist(1, 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No function by name fn:format-dateTime() exists in XQuery 1.0 (although one does in XSLT and XQuery 1.1). . */ @org.junit.Test public void kFunctionCallExpr20() { final XQuery query = new XQuery( "matches(format-dateTime(current-dateTime(), \"[M01]/[D01]/[Y0001] at [H01]:[m01]:[s01]\"), \"[0-1][0-9]/[0-3][0-9]/[0-9]{4} at [0-9]{2}:[0-9]{2}:[0-9]{2}\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0017") ) ); } /** * No function by name fn:format-dateTime() exists in XQuery 1.0 (although it does exist in XSLT and XQuery 1.1). . */ @org.junit.Test public void kFunctionCallExpr21() { final XQuery query = new XQuery( "matches(format-dateTime(current-dateTime(), \"[M01]/[D01]/[Y0001] at [H01]:[m01]:[s01]\", (), (), ()), \"../../.... at ..:..:..\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0017") ) ); } /** * No function by name fn:current() exists(although one does in XSLT). . */ @org.junit.Test public void kFunctionCallExpr22() { final XQuery query = new XQuery( "current()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No function by name fn:unparsed-entity-uri() exists(although one does in XSLT). . */ @org.junit.Test public void kFunctionCallExpr23() { final XQuery query = new XQuery( "unparsed-entity-uri(\"example.com/file.ext\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No function by name fn:unparsed-entity-public-id() exists(although one does in XSL-T). . */ @org.junit.Test public void kFunctionCallExpr24() { final XQuery query = new XQuery( "unparsed-entity-public-id(\"entity\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No function by name fn:generate-id() exists(although one does in XSLT). . */ @org.junit.Test public void kFunctionCallExpr25() { xquery10(); final XQuery query = new XQuery( "generate-id() castable as xs:NCName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Function by name fn:generate-id() does exist in XQuery 3.0. . */ @org.junit.Test public void kFunctionCallExpr25a() { final XQuery query = new XQuery( "generate-id() castable as xs:NCName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * No function by name fn:system-property() exists(although one does in XSL-T). . */ @org.junit.Test public void kFunctionCallExpr26() { final XQuery query = new XQuery( "system-property(\"xsl:vendor\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No function by name fn:escape-uri() exists(although one did in older 'Functions & Operators' drafts). . */ @org.junit.Test public void kFunctionCallExpr27() { final XQuery query = new XQuery( "fn:escape-uri(\"http:/example.com/\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * No function by name fn:sub-sequence() exists(although one by name fn:subsequence does). . */ @org.junit.Test public void kFunctionCallExpr28() { final XQuery query = new XQuery( "fn:sub-sequence(\"http:/example.com/\", 1, 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `xs:func-does-not-exist(1, 2, 3)`. . */ @org.junit.Test public void kFunctionCallExpr3() { final XQuery query = new XQuery( "xs:func-does-not-exist(1, 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `local:func-does-not-exist(1, 2, 3)`. . */ @org.junit.Test public void kFunctionCallExpr4() { final XQuery query = new XQuery( "local:func-does-not-exist(1, 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A test whose essence is: `prefix-does-not-exist:func-does-not-exist(1, 2, 3)`. . */ @org.junit.Test public void kFunctionCallExpr5() { final XQuery query = new XQuery( "prefix-does-not-exist:func-does-not-exist(1, 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0081") ); } /** * A function call containing an invalid QName as name. . */ @org.junit.Test public void kFunctionCallExpr6() { final XQuery query = new XQuery( "f:f:()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XPST0081") ) ); } /** * A function call containing an invalid QName as name. . */ @org.junit.Test public void kFunctionCallExpr7() { final XQuery query = new XQuery( ":f()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A function call containing an invalid QName as name. . */ @org.junit.Test public void kFunctionCallExpr8() { final XQuery query = new XQuery( ":f()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A function call containing an invalid QName as name. . */ @org.junit.Test public void kFunctionCallExpr9() { final XQuery query = new XQuery( "1fd()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Two user functions with many arguments. . */ @org.junit.Test public void k2FunctionCallExpr1() { final XQuery query = new XQuery( "\n" + " declare function local:bar($c, $d, $e, $f, $g, $h, $i, $j, $a, $b) { 1 }; \n" + " declare function local:moo($k) { $k }; \n" + " local:moo(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Check that nodes, when passed through function arguments, have proper node identities. . */ @org.junit.Test public void k2FunctionCallExpr10() { final XQuery query = new XQuery( "\n" + " declare variable $a := ; \n" + " declare function local:testSingleNodeIdentity($node as node()) { $node is $node }; \n" + " declare function local:testDoubleNodeIdentity($a as node(), $b as node()) { $a is $b }; \n" + " local:testSingleNodeIdentity(), local:testDoubleNodeIdentity(, ), local:testDoubleNodeIdentity($a, $a)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true false true") ); } /** * A very simple string-difference function. . */ @org.junit.Test public void k2FunctionCallExpr11() { final XQuery query = new XQuery( "\n" + " declare function local:compare($arg1 as xs:string, $arg2 as xs:string) { \n" + " let $cps1 := string-to-codepoints($arg1), \n" + " $cps2 := string-to-codepoints($arg2) \n" + " return abs(count($cps1) - count($cps2)) + sum(for $x in 1 to min((count($cps1), count($cps2))) \n" + " return if ($cps1[$x] ne $cps2[$x]) then 1 else ()) }; \n" + " local:compare(\"\", \"\"), \n" + " local:compare(\"a\", \"\"), \n" + " local:compare(\"\", \"a\"), \n" + " local:compare(\"a\", \"a\"), \n" + " local:compare(\"\", \"aa\"), \n" + " local:compare(\"aa\", \"ab\"), \n" + " local:compare(\"ba\", \"ba\"), \n" + " local:compare(\"bab\", \"bbb\"), \n" + " local:compare(\"aba\", \"bab\")\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0 1 1 0 2 1 0 1 3") ); } /** * Trigger an infinite recursion in one implementation. . */ @org.junit.Test public void k2FunctionCallExpr12() { final XQuery query = new XQuery( "\n" + " declare function local:func1() { if(local:func2('b')) then 3 else local:func1() }; \n" + " declare function local:func2($a) { if(matches(\"\",$a)) then () else 4 }; \n" + " local:func1()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Have a function which recurses infintely, but which never is called. . */ @org.junit.Test public void k2FunctionCallExpr13() { final XQuery query = new XQuery( "declare function local:foo($arg) { local:foo(local:foo(1)) }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Function current-grouping-key() is not available in XQuery. . */ @org.junit.Test public void k2FunctionCallExpr2() { final XQuery query = new XQuery( "current-grouping-key()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Function current() is not available in XQuery. . */ @org.junit.Test public void k2FunctionCallExpr3() { final XQuery query = new XQuery( "current()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Function unparsed-entity-uri() is not available in XQuery. . */ @org.junit.Test public void k2FunctionCallExpr4() { final XQuery query = new XQuery( "unparsed-entity-uri(\"str\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Function unparsed-entity-public-id() is not available in XQuery. . */ @org.junit.Test public void k2FunctionCallExpr5() { final XQuery query = new XQuery( "unparsed-entity-public-id(\"str\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Function generate-id() is not available in XQuery. . */ @org.junit.Test public void k2FunctionCallExpr6() { xquery10(); final XQuery query = new XQuery( "generate-id(\"str\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Function generate-id() is not available in XQuery(#2). . */ @org.junit.Test public void k2FunctionCallExpr7() { xquery10(); final XQuery query = new XQuery( "generate-id()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Function system-property() is not available in XQuery(#2). . */ @org.junit.Test public void k2FunctionCallExpr8() { final XQuery query = new XQuery( "system-property(\"property\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Function key() is not available in XQuery. . */ @org.junit.Test public void k2FunctionCallExpr9() { final XQuery query = new XQuery( "key(\"id\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Ensure sequence types are promoted correctly . */ @org.junit.Test public void cbclPromotion001() { final XQuery query = new XQuery( "\n" + " string-join( (xs:anyURI('http://www.microsoft.com'), xs:anyURI('http://www.google.com/')), ' ')\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "http://www.microsoft.com http://www.google.com/") ); } /** * Test that type promotion occurs correctly for values passed to user-defined functions . */ @org.junit.Test public void cbclPromotion002() { final XQuery query = new XQuery( "\n" + " declare function local:index-of($seq as xs:double*, $item as xs:double) { for $x at $p in $seq return if ($x eq $item) then $p else () };\n" + " declare function local:sequence($x as xs:integer) { (\"string\", 1, 2.0, xs:float(3))[$x] };\n" + " local:index-of(for $x in (2,3,4) return local:sequence($x), 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2") ); } /** * Test that type promotion occurs correctly for values returned from user-defined functions . */ @org.junit.Test public void cbclPromotion003() { final XQuery query = new XQuery( "\n" + " declare function local:index-of($seq as xs:integer*, $item as xs:integer?) as xs:float* { \n" + " if (empty($item)) \n" + " then -1\n" + " else for $x at $p in $seq return if ($x eq $item) then $p else () \n" + " };\n" + " local:index-of(1 to 10, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "3") ); } /** * Test that type promotion occurs correctly for sequence values returned from user-defined functions . */ @org.junit.Test public void cbclPromotion004() { final XQuery query = new XQuery( "\n" + " declare function local:f() as xs:double* { \n" + " if (day-from-date(current-date()) < 32) then xs:integer(3) else -1\n" + " };\n" + " local:f() + 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4") ); } /** * Test a function declared to return optional returning more than one value . */ @org.junit.Test public void cbclPromotion005() { final XQuery query = new XQuery( "\n" + " declare function local:index-of($seq, $item) as xs:double? { for $x at $p in $seq return if ($x eq $item) then $p else () };\n" + " local:index-of((1, 2.0, xs:float(3), 2), 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Test a function taking optional argument being passed more than one . */ @org.junit.Test public void cbclPromotion006() { final XQuery query = new XQuery( "\n" + " declare function local:f($arg as xs:anyAtomicType?) { $arg };\n" + " local:f(index-of((1,2,3,2),2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Check that correct type constraint is inserted. . */ @org.junit.Test public void cbclPromotion007() { final XQuery query = new XQuery( "\n" + " declare function local:f($v as xs:double*) as xs:double+ { if (empty($v)) then 0 else $v };\n" + " declare function local:g($v as xs:double*) as xs:double+ { local:f($v) };\n" + " local:g((1,2,3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3") ); } /** * Check that reserved function name attribute is handled correctly. . */ @org.junit.Test public void functionCallReservedFunctionNames001() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function local:attribute($arg) { fn:true() };\n" + "\tattribute(1)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name comment is handled correctly. . */ @org.junit.Test public void functionCallReservedFunctionNames002() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function local:comment($arg) { fn:true() };\n" + "\tcomment(1)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name document-node is handled correctly. . */ @org.junit.Test public void functionCallReservedFunctionNames003() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function local:document-node($arg) { fn:true() };\n" + "\tdocument-node(1)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name element is handled correctly. . */ @org.junit.Test public void functionCallReservedFunctionNames004() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function local:element($arg) { fn:true() };\n" + "\telement(1)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name empty-sequence is handled correctly. . */ @org.junit.Test public void functionCallReservedFunctionNames005() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function local:empty-sequence() { fn:true() };\n" + "\tempty-sequence()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name if is handled correctly. . */ @org.junit.Test public void functionCallReservedFunctionNames006() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function local:if() { fn:true() };\n" + "\tif()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name item is handled correctly. . */ @org.junit.Test public void functionCallReservedFunctionNames007() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function local:item($arg) { fn:true() };\n" + "\titem(1)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name node is handled correctly. . */ @org.junit.Test public void functionCallReservedFunctionNames008() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function local:node($arg) { fn:true() };\n" + "\tnode(1)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name processing-instruction is handled correctly. . */ @org.junit.Test public void functionCallReservedFunctionNames009() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function local:processing-instruction($arg) { fn:true() };\n" + "\tprocessing-instruction(1)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name schema-attribute is handled correctly. . */ @org.junit.Test public void functionCallReservedFunctionNames010() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function local:schema-attribute() { fn:true() };\n" + "\tschema-attribute()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name schema-element is handled correctly. . */ @org.junit.Test public void functionCallReservedFunctionNames011() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function local:schema-element() { fn:true() };\n" + "\tschema-element()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name text is handled correctly. . */ @org.junit.Test public void functionCallReservedFunctionNames012() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function local:text($arg) { fn:true() };\n" + "\ttext(1)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name typeswitch is handled correctly. . */ @org.junit.Test public void functionCallReservedFunctionNames013() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function local:typeswitch() { fn:true() };\n" + "\ttypeswitch()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name function is handled correctly. . */ @org.junit.Test public void functionCallReservedFunctionNames014() { xquery10(); final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function local:function() { fn:true() };\n" + "\tfunction()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that reserved function name namespace-node is handled correctly. . */ @org.junit.Test public void functionCallReservedFunctionNames015() { xquery10(); final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function namespace-node($arg) { fn:true() };\n" + "\tnamespace-node(1)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that reserved function name switch is handled correctly. . */ @org.junit.Test public void functionCallReservedFunctionNames016() { xquery10(); final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function local:switch() { fn:true() };\n" + "\tswitch()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that reserved function name function is handled correctly. . */ @org.junit.Test public void functionCallReservedFunctionNames017() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function local:function() { fn:true() };\n" + "\tfunction()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name namespace-node is handled correctly. . */ @org.junit.Test public void functionCallReservedFunctionNames018() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function local:namespace-node($arg) { fn:true() };\n" + "\tnamespace-node(1)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name switch is handled correctly. . */ @org.junit.Test public void functionCallReservedFunctionNames019() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function local:switch() { fn:true() };\n" + "\tswitch()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdFunctionDecl.java000066400000000000000000003171211222453003200305170ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the FunctionDecl production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdFunctionDecl extends QT3TestSet { /** * The 'XPath Data Types' namespace is not reserved anymore, although it was in older drafts. . */ @org.junit.Test public void kFunctionProlog1() { final XQuery query = new XQuery( "declare namespace test = \"http://www.w3.org/2005/xpath-datatypes\";\n" + " declare function test:myFunction() { 1};\n" + " 1 eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A user declared function whose return value simply doesn't match the return type. . */ @org.junit.Test public void kFunctionProlog10() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction() as xs:double { \"This is not a double, it's an xs:string.\" };\n" + " local:myFunction()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A user declared function whose return value simply doesn't match the return type(#2). . */ @org.junit.Test public void kFunctionProlog11() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction() as item() { () };\n" + " local:myFunction()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * XQuery 1.0: Variable appearing after a function declaration is not in scope inside the function. . */ @org.junit.Test public void kFunctionProlog12a() { xquery10(); final XQuery query = new XQuery( "\n" + " declare function local:computeSum() { $myVariable };\n" + " declare variable $myVariable := 1;\n" + " 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * XQuery 3.0: Variable appearing after a function declaration is in scope inside the function. . */ @org.junit.Test public void kFunctionProlog12b() { final XQuery query = new XQuery( "\n" + " declare function local:computeSum() { $myVariable };\n" + " declare variable $myVariable := 1;\n" + " 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Namespaces declarations appearing after a function declaration are not in scope inside the function. . */ @org.junit.Test public void kFunctionProlog13() { final XQuery query = new XQuery( "\n" + " declare function local:computeSum() { $prefix:myVariable };\n" + " declare namespaces prefix = \"example.com/Anamespace\";\n" + " 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0081") || error("XPST0003") ) ); } /** * A user function which when run doesn't match the declared returned type. . */ @org.junit.Test public void kFunctionProlog14() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction() as xs:integer { subsequence((1, 2, \"a string\"), 3 ,1) };\n" + " fn:boolean(local:myFunction())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A user function whose return type doesn't match the body, which can be statically inferred. . */ @org.junit.Test public void kFunctionProlog15() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction() as xs:anyURI { 1 };\n" + " true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * When declaring a function, the paranteses must be present even though it doesn't have any arguments. . */ @org.junit.Test public void kFunctionProlog16() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction as xs:integer { 1 };\n" + " true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * When declaring a function, the paranteses must be present even though it doesn't have any arguments. . */ @org.junit.Test public void kFunctionProlog17() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction { 1 };\n" + " true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Two user functions using global variables. . */ @org.junit.Test public void kFunctionProlog18() { final XQuery query = new XQuery( "declare variable $var1 := 1;\n" + " declare function local:func1() as xs:integer { $var1 };\n" + " declare variable $var2 := 2;\n" + " declare function local:func2() as xs:integer { $var2 };\n" + " 1 eq local:func1() and 2 eq local:func2()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A user function where all its arguments are unused. . */ @org.junit.Test public void kFunctionProlog19() { final XQuery query = new XQuery( "\n" + " declare function local:func1($a1, $a2, $a3) { 1 };\n" + " local:func1(1, 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * A function cannot be declared in the 'http://www.w3.org/2005/xpath-functions' namespace. . */ @org.junit.Test public void kFunctionProlog2() { final XQuery query = new XQuery( "\n" + " declare function wrongNS() { 1 };\n" + " 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * User functions which in some implementations causes constant propagation combined with function versioning. . */ @org.junit.Test public void kFunctionProlog20() { final XQuery query = new XQuery( "\n" + " declare function local:func($choose, $whenTrue, $whenFalse) { if($choose) then $whenTrue else $whenFalse };\n" + " local:func(true(), current-time(), current-date()) instance of xs:time and local:func(false(), current-time(), current-date()) instance of xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * User functions where the middle argument of three arguments is unused. . */ @org.junit.Test public void kFunctionProlog21() { final XQuery query = new XQuery( "\n" + " declare function local:func($a as xs:integer, $unused, $c as xs:integer) { $a + $c };\n" + " local:func(1, 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("4") ); } /** * User functions where the first argument of three arguments is unused. . */ @org.junit.Test public void kFunctionProlog22() { final XQuery query = new XQuery( "\n" + " declare function local:func($unused, $b as xs:integer, $c as xs:integer) { $b + $c };\n" + " local:func(1, 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("5") ); } /** * User functions where the last argument of three arguments is unused. . */ @org.junit.Test public void kFunctionProlog23() { final XQuery query = new XQuery( "\n" + " declare function local:func($a as xs:integer, $b as xs:integer, $unused) { $a + $b };\n" + " local:func(1, 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * A function cannot be declared in the 'http://www.w3.org/2005/xpath-functions' namespace. . */ @org.junit.Test public void kFunctionProlog24() { final XQuery query = new XQuery( "\n" + " declare function wrongNS() { 1 };\n" + " 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * A function and a variable can have the same name. . */ @org.junit.Test public void kFunctionProlog25() { final XQuery query = new XQuery( "declare variable $local:myName := 1;\n" + " declare function local:myName() as xs:integer { 1 };\n" + " $local:myName eq local:myName()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A function declaration duplicated. . */ @org.junit.Test public void kFunctionProlog26() { final XQuery query = new XQuery( "\n" + " declare function local:myName() { 1 };\n" + " declare function local:myName() { 1 };\n" + " 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0034") ); } /** * A function declaration duplicated; difference in return types is insignificant. . */ @org.junit.Test public void kFunctionProlog27() { final XQuery query = new XQuery( "\n" + " declare function local:myName() as xs:integer { 1 };\n" + " declare function local:myName() as xs:nonPositiveInteger { 1 };\n" + " 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0034") ); } /** * A function declaration duplicated; difference in arguments types is insignificant. . */ @org.junit.Test public void kFunctionProlog28() { final XQuery query = new XQuery( "\n" + " declare function local:myName($myvar as xs:integer) { 1 };\n" + " declare function local:myName($myvar as xs:nonPositiveInteger) { 1 };\n" + " 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0034") ); } /** * A function declaration duplicated; difference in arguments name is insignificant. . */ @org.junit.Test public void kFunctionProlog29() { final XQuery query = new XQuery( "\n" + " declare function local:myName($myvar) { 1 };\n" + " declare function local:myName($myvar2) { 1 };\n" + " 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0034") ); } /** * A function cannot be declared in the 'http://www.w3.org/XML/1998/namespace' namespace. . */ @org.junit.Test public void kFunctionProlog3() { final XQuery query = new XQuery( "\n" + " declare function xml:wrongNS() { 1 };\n" + " 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * Overloading user functions based on arity. . */ @org.junit.Test public void kFunctionProlog30() { final XQuery query = new XQuery( "\n" + " declare function local:myName($var as xs:integer) as xs:integer { $var };\n" + " declare function local:myName() as xs:integer { 1 };\n" + " (local:myName(4) - 3) eq local:myName()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * One cannot declare a user function as fn:count. . */ @org.junit.Test public void kFunctionProlog31() { final XQuery query = new XQuery( "\n" + " declare function fn:count($var) { fn:count($var) };\n" + " 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * One cannot declare a user function as xs:gYear. . */ @org.junit.Test public void kFunctionProlog32() { final XQuery query = new XQuery( "\n" + " declare function xs:gYear($arg as xs:anyAtomicType?) as xs:gYear? { xs:gYear($arg) };\n" + " 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * A type error inside a function. . */ @org.junit.Test public void kFunctionProlog33() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction() { \"a string\" + 1 };\n" + " true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * A call to a user declared function which almost is spelled correctly(capitalization wrong). . */ @org.junit.Test public void kFunctionProlog34() { final XQuery query = new XQuery( "\n" + " declare function local:MyFunction() { 1 };\n" + " local:myFunction()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A call to a user declared function which almost is spelled correctly(#2). . */ @org.junit.Test public void kFunctionProlog35() { final XQuery query = new XQuery( "\n" + " declare function local:MyFunction() { 1 };\n" + " local:myFunctionn()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * The variable '$myArg' is in scope inside the function, but not in the query body. . */ @org.junit.Test public void kFunctionProlog36() { final XQuery query = new XQuery( "\n" + " declare function local:MyFunction($myArg) { 0 };\n" + " $myArg", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * The variable '$myArg' is in scope inside one function, but not the other function. . */ @org.junit.Test public void kFunctionProlog37() { final XQuery query = new XQuery( "\n" + " declare function local:MyFunction($myArg) { 0 };\n" + " declare function local:MyFunction2($myArg2) { $myArg };\n" + " 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * The variable '$myArg2' is in scope inside one function, but not the other function. . */ @org.junit.Test public void kFunctionProlog38() { final XQuery query = new XQuery( "\n" + " declare function local:MyFunction($myArg) { $myArg2 };\n" + " declare function local:MyFunction2($myArg2) { 0 };\n" + " 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * Function arguments shadows global variables. . */ @org.junit.Test public void kFunctionProlog39() { final XQuery query = new XQuery( "declare variable $local:myVar := 1;\n" + " declare function local:myFunction($local:myVar) { $local:myVar };\n" + " $local:myVar, local:myFunction(2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2") ); } /** * A function cannot be declared in the 'http://www.w3.org/2001/XMLSchema-instance' namespace. . */ @org.junit.Test public void kFunctionProlog4() { final XQuery query = new XQuery( "declare namespace my = \"http://www.w3.org/2001/XMLSchema-instance\";\n" + " declare function my:wrongNS() { 1 };\n" + " 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * Variables declared inside functions shadow function arguments. . */ @org.junit.Test public void kFunctionProlog40() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction($local:myVar as xs:integer) { for $local:myVar in ($local:myVar, 3) return $local:myVar };\n" + " deep-equal(local:myFunction(1), (1, 3))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Type error in body of user function caused by the argument value. . */ @org.junit.Test public void kFunctionProlog41() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction($local:myVar) { $local:myVar + 1 };\n" + " local:myFunction(1), local:myFunction(\"this will fail\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Type error(cardinality) in return value of user function caused by the argument value. . */ @org.junit.Test public void kFunctionProlog42() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction($local:arg) as item() { 1, $local:arg };\n" + " local:myFunction(()), local:myFunction(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Item type error in argument value. . */ @org.junit.Test public void kFunctionProlog43() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction($arg as item(), $arg2 as xs:integer) { $arg, $arg2 };\n" + " local:myFunction(\"3\", \"3\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Cardinality error in argument value. . */ @org.junit.Test public void kFunctionProlog44() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction($arg as item(), $arg2 as xs:integer) { $arg, $arg2 };\n" + " local:myFunction(\"3\", ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Item type error in argument value. xs:decimal doesn't match xs:integer. . */ @org.junit.Test public void kFunctionProlog45() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction($arg as item()?, $arg2 as xs:integer) { $arg, $arg2 };\n" + " local:myFunction((), 4.1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * '1' doesn't match the empty-sequence(). . */ @org.junit.Test public void kFunctionProlog46() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction($arg as empty-sequence()) { $arg };\n" + " local:myFunction(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || error("XPST0005") ) ); } /** * 'empty-sequence()+' is syntactically invalid. . */ @org.junit.Test public void kFunctionProlog47() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction($arg as empty-sequence()+) { $arg };\n" + " local:myFunction(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * 'empty-sequence()? is syntactically invalid. . */ @org.junit.Test public void kFunctionProlog48() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction($arg as empty-sequence()?) { $arg };\n" + " local:myFunction(())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * It is valid to declare an argument to be of type empty-sequence(). . */ @org.junit.Test public void kFunctionProlog49() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction($arg as empty-sequence()) { $arg };\n" + " empty(local:myFunction(()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * A function cannot be declared in the 'http://www.w3.org/2001/XMLSchema' namespace. . */ @org.junit.Test public void kFunctionProlog5() { final XQuery query = new XQuery( "declare namespace my = \"http://www.w3.org/2001/XMLSchema\";\n" + " declare function my:wrongNS() { 1 };\n" + " 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0045") ); } /** * empty-sequence() as return type, but body doesn't match when run. . */ @org.junit.Test public void kFunctionProlog50() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction($arg) as empty-sequence() { $arg };\n" + " local:myFunction(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Too few arguments passed to a user function. . */ @org.junit.Test public void kFunctionProlog51() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction($arg) { $arg };\n" + " local:myFunction()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * empty-sequence() as return type, and a body containing fn:error(). . */ @org.junit.Test public void kFunctionProlog52() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction() as empty-sequence() { fn:error() };\n" + " local:myFunction()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * A global variable referenced from inside a function. . */ @org.junit.Test public void kFunctionProlog53() { final XQuery query = new XQuery( "declare namespace my = \"http://example.com/MyNamespace/\";\n" + " declare variable $my:error-qname := QName(\"http:example.org/\", \"prefix:ncname\");\n" + " declare function my:error($choice, $msg as xs:string) as empty-sequence() { if($choice) then error($my:error-qname, concat('No luck: ', $msg)) else () };\n" + " empty((my:error(false(), \"msg\"), my:error(false(), \"The message\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * A more realistic case involving fn:error(). . */ @org.junit.Test public void kFunctionProlog54() { final XQuery query = new XQuery( "declare namespace my = \"http://example.com/MyNamespace/\";\n" + " declare variable $my:error-qname := QName(\"http://example.com/MyErrorNS\", \"my:qName\");\n" + " declare function my:error($msg as xs:string) as empty-sequence() { error($my:error-qname, concat('No luck: ', $msg)) };\n" + " my:error(\"The message\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("*") ); } /** * A more realistic case involving fn:error(), #2. . */ @org.junit.Test public void kFunctionProlog55() { final XQuery query = new XQuery( "declare namespace my = \"http://example.com/MyNamespace/\";\n" + " declare variable $my:error-qname := QName(\"http://example.com/MyErrorNS\", \"my:qName\");\n" + " declare function my:error($choice, $msg as xs:string) as empty-sequence() { if($choice) then error($my:error-qname, concat('No luck: ', $msg)) else () };\n" + " my:error(false(), \"msg\"), my:error(true(), \"The message\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("*") ); } /** * A more realistic case involving fn:error(), #3. . */ @org.junit.Test public void kFunctionProlog56() { final XQuery query = new XQuery( "declare namespace my = \"http://example.com/MyNamespace/\";\n" + " declare variable $my:error-qname := QName(\"http://example.com/MyErrorNS\", \"my:qName\");\n" + " declare function my:error($choice, $msg as xs:string) as empty-sequence() { if($choice) then error($my:error-qname, concat('No luck: ', $msg)) else () };\n" + " empty((my:error(false(), \"msg\"), my:error(false(), \"The message\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * The type 'none' isn't available to users. . */ @org.junit.Test public void kFunctionProlog57() { final XQuery query = new XQuery( "\n" + " declare function local:error() as none { 1 };\n" + " local:error()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0051") ); } /** * The type 'none()' isn't available to users. . */ @org.junit.Test public void kFunctionProlog58() { final XQuery query = new XQuery( "\n" + " declare function local:error() as none() { 1 };\n" + " local:error()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0003") || error("XPST0051") ) ); } /** * A call to a user function where the argument in the callsite corresponding to an unused argument contains a type error. . */ @org.junit.Test public void kFunctionProlog59() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction($unusedArg) { true() };\n" + " local:myFunction(1 + \"a string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * Arguments in functions cannot have default values initialized with '='(or in any other way). . */ @org.junit.Test public void kFunctionProlog6() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction($arg = 1) {1};\n" + " true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * An argument in a user function is not in scope in the query body. . */ @org.junit.Test public void kFunctionProlog60() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction($arg) { 1 };\n" + " $arg", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * An argument in a user function is not in scope in the query body. . */ @org.junit.Test public void kFunctionProlog61() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction($arg, $arg2, $arg3) { 1 };\n" + " $arg3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * Check that a global variable is in scope despite an unused function being declared. . */ @org.junit.Test public void kFunctionProlog62() { final XQuery query = new XQuery( "declare variable $my := 3;\n" + " declare function local:myFunction($my, $arg2, $arg4) { 1 };\n" + " $my eq 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A function call that could be a call to a hypotehical user function. . */ @org.junit.Test public void kFunctionProlog63() { final XQuery query = new XQuery( "local:myFunction(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * A function call that could be a call to a hypothetical user function(#2). . */ @org.junit.Test public void kFunctionProlog64() { final XQuery query = new XQuery( "declare namespace my = \"http://example.com/ANamespace\";\n" + " my:function(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Since the return type is empty-sequence() it is a type error(XPTY0004) to pass its return value to anything which requires cardinality exactly-one. That the function's body is of type 'none', doesn't affect that, it only adapts to the declared return type. However, there's no constraints on what is reported first, so FOER0000 can also be issued. . */ @org.junit.Test public void kFunctionProlog65() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction() as empty-sequence() { fn:error() };\n" + " QName(\"http://example.com/ANamespace\", local:myFunction())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPTY0004") || error("FOER0000") ) ); } /** * If static typing is in use, XPTY004 is issued since local:myFunction() has static type item()*. However, if the function is invoked FOER0000 is issued. . */ @org.junit.Test public void kFunctionProlog66() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction() { fn:error() };\n" + " QName(\"http://example.com/ANamespace\", local:myFunction())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FOER0000") || error("XPTY0004") ) ); } /** * A function call that reminds of the range expression. . */ @org.junit.Test public void kFunctionProlog67() { final XQuery query = new XQuery( "declare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + " declare function local:is() as xs:integer { 1 };\n" + " is() eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A call to a user function where the argument in the callsite corresponding to a used argument contains a type error. . */ @org.junit.Test public void kFunctionProlog68() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction($usedArg) { $usedArg };\n" + " local:myFunction(1 + \"a string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Arguments in functions cannot have default values initialized with '='(or in any other way). . */ @org.junit.Test public void kFunctionProlog7() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction($arg = 1 as xs:integer) {1};\n" + " true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Arguments in functions cannot have default values initialized with ':='(or in any other way). . */ @org.junit.Test public void kFunctionProlog8() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction($arg := 1) {1};\n" + " true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Arguments in functions cannot have default values initialized with ':='(or in any other way). . */ @org.junit.Test public void kFunctionProlog9() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction($arg := 1 as xs:integer) {1};\n" + " true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Have two function callsites as arguments to 'eq'. . */ @org.junit.Test public void k2FunctionProlog1() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction($arg as xs:integer) as xs:integer { ((if($arg eq 1) then 1 else $arg - 1), current-time())[1] treat as xs:integer };\n" + " local:myFunction(1) eq local:myFunction(2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A function whose name is only '_' and is declared in the default namespace. . */ @org.junit.Test public void k2FunctionProlog10() { final XQuery query = new XQuery( "declare default function namespace \"http://example.com\";\n" + " declare function _() { 1 };\n" + " _()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * A function whose name is only '_'. . */ @org.junit.Test public void k2FunctionProlog11() { final XQuery query = new XQuery( "\n" + " declare function local:_() { 1 };\n" + " local:_()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * An argument requiring a node, but is passed an integer. . */ @org.junit.Test public void k2FunctionProlog12() { final XQuery query = new XQuery( "\n" + " declare function local:_($arg as node()) { $arg };\n" + " local:_(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * An argument requiring a node, but is passed an integer(#2). . */ @org.junit.Test public void k2FunctionProlog13() { final XQuery query = new XQuery( "\n" + " declare function local:_($arg as attribute()?) { 1 };\n" + " local:_(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1") || error("XPTY0004") ) ); } /** * A focus doesn't propagate into function. . */ @org.junit.Test public void k2FunctionProlog14() { final XQuery query = new XQuery( " declare function local:myFunc() { e };\n" + " /local:myFunc()/1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPDY0002") || error("XPST0005") ) ); } /** * Use a range variable inside the assignment expression of a global variable. . */ @org.junit.Test public void k2FunctionProlog15() { final XQuery query = new XQuery( "declare variable $var1 := let $var1 := 1 return 1;\n" + " $var1 eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure three subsequent stars are parsed. . */ @org.junit.Test public void k2FunctionProlog16() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction() as item()* {***};\n" + " 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1") || error("XPDY0002") ) ); } /** * Conversions are invoked when an element is returned from a function with declared return type xs:integer. . */ @org.junit.Test public void k2FunctionProlog17() { final XQuery query = new XQuery( " declare function local:func() as xs:integer { 1 };\n" + " local:func()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Conversions are invoked when an attribute is returned from a function with declared return type xs:integer. . */ @org.junit.Test public void k2FunctionProlog18() { final XQuery query = new XQuery( "\n" + " declare function local:func() as xs:integer { attribute name {\"1\"} };\n" + " local:func()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Conversions are invoked when a document is returned from a function with declared return type xs:integer. . */ @org.junit.Test public void k2FunctionProlog19() { final XQuery query = new XQuery( "\n" + " declare function local:func() as xs:integer { document {\"1\"} };\n" + " local:func()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Have two function callsites as arguments to 'ne'. . */ @org.junit.Test public void k2FunctionProlog2() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction($arg as xs:integer) as xs:integer { ((if($arg eq 1) then 1 else $arg - 1), current-time())[1] treat as xs:integer };\n" + " not(local:myFunction(1) ne local:myFunction(2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Comments cannot be converted into xs:integer. . */ @org.junit.Test public void k2FunctionProlog20() { final XQuery query = new XQuery( " declare function local:func() as xs:integer { };\n" + " local:func()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Processing instructions cannot be converted into xs:integer. . */ @org.junit.Test public void k2FunctionProlog21() { final XQuery query = new XQuery( " declare function local:func() as xs:integer { };\n" + " local:func()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Conversions are invoked when a text node is returned from a function with declared return type xs:integer. . */ @org.junit.Test public void k2FunctionProlog22() { final XQuery query = new XQuery( "\n" + " declare function local:func() as xs:integer? { text {\"1\"} };\n" + " local:func()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Call a function that subsequently calls a recursive function. . */ @org.junit.Test public void k2FunctionProlog23() { final XQuery query = new XQuery( "\n" + " declare function local:recursiveFunction($i as xs:integer) as xs:integer { if($i eq 5) then $i else local:recursiveFunction($i + 1) };\n" + " declare function local:proxy() as xs:integer { local:recursiveFunction(0) + 3 };\n" + " local:proxy()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("8") ); } /** * The empty string cannot be cast to an xs:boolean. . */ @org.junit.Test public void k2FunctionProlog24() { final XQuery query = new XQuery( " declare function local:distinct-nodes-stable ($arg as node()*) as xs:boolean* { for $a in $arg return $a };\n" + " local:distinct-nodes-stable((,))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * A call site that has an operand that gets treated as an xs:integer. . */ @org.junit.Test public void k2FunctionProlog25() { final XQuery query = new XQuery( " declare function local:myFunc($recurse as xs:integer) { attribute {concat(\"name\", $recurse)} {()} , if ($recurse = 0) then () else local:myFunc($recurse - 1) };\n" + " { local:myFunc((2, current-time())[1] treat as xs:integer) } ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * A type declaration whose body doesn't match. . */ @org.junit.Test public void k2FunctionProlog26() { final XQuery query = new XQuery( " declare function local:myFunc() as element(foo) { };\n" + " local:myFunc()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A type declaration whose body doesn't match(#2). . */ @org.junit.Test public void k2FunctionProlog27() { final XQuery query = new XQuery( " declare function local:myFunc() as attribute(foo) { };\n" + " local:myFunc()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Compute the levenshtein distance between strings. . */ @org.junit.Test public void k2FunctionProlog28() { final XQuery query = new XQuery( "\n" + " declare function local:levenshtein($arg1 as xs:string, $arg2 as xs:string) as xs:decimal { if(string-length($arg1) = 0) then string-length($arg2) else if(string-length($arg2) = 0) then string-length($arg1) else min((local:levenshtein(substring($arg1, 2), $arg2) + 1, local:levenshtein($arg1, substring($arg2, 2)) + 1, local:levenshtein(substring($arg1, 2), substring($arg2, 2)) + (if(substring($arg1, 1, 1) = substring($arg2, 1, 1)) then 0 else 1))) };\n" + " local:levenshtein(\"a\", \"a\"), local:levenshtein(\"aa\", \"aa\"), local:levenshtein(\"aaa\", \"aaa\"), local:levenshtein(\"aa a\", \"aa a\"), local:levenshtein(\"a a a\", \"aaa\"), local:levenshtein(\"aaa\", \"a a a\"), local:levenshtein(\"aaa\", \"aaab\"), local:levenshtein(\"978\", \"abc\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0 0 0 0 2 2 1 3") ); } /** * Ensure the 'function' keyword is parsed correctly. . */ @org.junit.Test public void k2FunctionProlog29() { final XQuery query = new XQuery( "function gt function", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * Have two function callsites as arguments to '='. . */ @org.junit.Test public void k2FunctionProlog3() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction($arg as xs:integer) as xs:integer { ((if($arg eq 1) then 1 else $arg - 1), current-time())[1] treat as xs:integer };\n" + " local:myFunction(1) = local:myFunction(2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure an invalid value, reached through conversions, is reported as invalid. . */ @org.junit.Test public void k2FunctionProlog30() { final XQuery query = new XQuery( " declare function local:foo($arg) as xs:boolean { $arg };\n" + " local:foo()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("FORG0001") || error("XPTY0004") ) ); } /** * Pass a sequence of mixed atomic values and nodes to an argument which has no type declared. . */ @org.junit.Test public void k2FunctionProlog31() { final XQuery query = new XQuery( " declare function local:foo($arg) as xs:boolean* { $arg };\n" + " local:foo((true, true(), xs:untypedAtomic(\"false\"), false(), true ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true false false true") ); } /** * Pass a value which cannot be converted to the expected type. $arg doesn't have a type declared. . */ @org.junit.Test public void k2FunctionProlog32() { final XQuery query = new XQuery( "\n" + " declare function local:foo($arg ) as xs:boolean* { $arg };\n" + " local:foo(current-date())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Mix in an atomic value which matches the type it's being converted to. $arg doesn't have a type declared. . */ @org.junit.Test public void k2FunctionProlog33() { final XQuery query = new XQuery( " declare function local:foo($arg ) as xs:boolean* { $arg };\n" + " local:foo((true, true(), xs:untypedAtomic(\"false\"), false(), true ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true false false true") ); } /** * Call fn:true() and fn:false() and pass to a user function. . */ @org.junit.Test public void k2FunctionProlog34() { final XQuery query = new XQuery( "\n" + " declare function local:foo($arg) as xs:boolean* { $arg };\n" + " local:foo((true(), xs:untypedAtomic(\"false\"))), local:foo((false(), xs:untypedAtomic(\"false\")))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true false false false") ); } /** * Pass an untyped value. . */ @org.junit.Test public void k2FunctionProlog35() { final XQuery query = new XQuery( "\n" + " declare function local:foo($arg) as xs:boolean* { $arg };\n" + " local:foo(xs:untypedAtomic(\"false\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Pass an untyped value(different cardinality). . */ @org.junit.Test public void k2FunctionProlog36() { final XQuery query = new XQuery( "\n" + " declare function local:foo($arg) as xs:boolean { $arg };\n" + " local:foo(xs:untypedAtomic(\"false\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Mix in an atomic value which matches the type it's being converted to. $arg doesn't have a type declared. . */ @org.junit.Test public void k2FunctionProlog37() { final XQuery query = new XQuery( " declare function local:foo($arg ) as xs:boolean* { $arg };\n" + " local:foo((true, true(), xs:untypedAtomic(\"false\"), false(), true ))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true false false true") ); } /** * Trigger a crash in an implementation by having a user declared function with type, that has a text node constructor containing a call to a nonexisting function. . */ @org.junit.Test public void k2FunctionProlog38() { final XQuery query = new XQuery( "\n" + " declare function local:foo() as xs:boolean { text {local:doesNotExist()} };\n" + " 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0017") ); } /** * Use complex real-world case for function calls, with automatic conversion not needed. . */ @org.junit.Test public void k2FunctionProlog39() { final XQuery query = new XQuery( "\n" + " declare variable $A:=({local:functionA()});\n" + " declare function local:functionA() as element() { testing ... };\n" + " declare function local:functionB ( ) as xs:string { xs:string($A) };\n" + " local:functionB()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "testing ...") ); } /** * Have two function callsites as arguments to '!='. . */ @org.junit.Test public void k2FunctionProlog4() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction($arg as xs:integer) as xs:integer { ((if($arg eq 1) then 1 else $arg - 1), current-time())[1] treat as xs:integer };\n" + " not(local:myFunction(1) != local:myFunction(2))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Use complex real-world case for function calls, with automatic conversion. . */ @org.junit.Test public void k2FunctionProlog40() { final XQuery query = new XQuery( "\n" + " declare variable $A:=({local:functionA()});\n" + " declare function local:functionA() as element() { testing ... };\n" + " declare function local:functionB ( ) as xs:string { $A };\n" + " local:functionB()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "testing ...") ); } /** * A function requiring xs:integer but is passed an xs:decimal. . */ @org.junit.Test public void k2FunctionProlog5() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction($arg as xs:integer) { $arg };\n" + " local:myFunction(1.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A function requiring xs:integer as return value, but is passed xs:decimal. . */ @org.junit.Test public void k2FunctionProlog6() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction() as xs:integer { 1.0 };\n" + " local:myFunction()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A declared return value invokes numeric promotion. . */ @org.junit.Test public void k2FunctionProlog7() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction() as xs:float { 4.0 };\n" + " (current-time(), 1, 2, \"a string\", local:myFunction(), 4.0, xs:double(\"NaN\"), current-date())[5] instance of xs:float\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A recursive function stretching through several function calls. . */ @org.junit.Test public void k2FunctionProlog8() { final XQuery query = new XQuery( "\n" + " declare function local:myFunction($arg as xs:integer) as xs:integer { if($arg eq 1) then $arg else local:myFunction3($arg - 1) };\n" + " declare function local:myFunction2($arg as xs:integer) as xs:integer { local:myFunction($arg) };\n" + " declare function local:myFunction3($arg as xs:integer) as xs:integer { local:myFunction2($arg) };\n" + " local:myFunction3(3) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A recursive function multiplying a sequence. . */ @org.junit.Test public void k2FunctionProlog9() { final XQuery query = new XQuery( "\n" + " declare function local:multiplySequence($input as xs:integer*) as xs:integer { if (empty($input)) then 1 else $input[1] * local:multiplySequence($input[position() != 1]) };\n" + " local:multiplySequence((1, 2, 3, 4, 5))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("120") ); } /** * check that XPST0005 is NOT a valid response . */ @org.junit.Test public void cbclFunctionDecl001() { final XQuery query = new XQuery( "declare function local:nothing() as empty-sequence() { () }; empty(local:nothing())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test passing a large sequence to a function. . */ @org.junit.Test public void cbclFunctionDeclaration002() { final XQuery query = new XQuery( "declare function local:count($x) { count($x) }; local:count((1 to 100000, 1 to 100000))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "200000") ); } /** * Check that reserved function name attribute is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames001() { xquery10(); final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function attribute() { fn:true() };\n" + "\tlocal:attribute()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that reserved function name attribute is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames002() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function attribute() { fn:true() };\n" + "\tlocal:attribute()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name comment is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames003() { xquery10(); final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function comment() { fn:true() };\n" + "\tlocal:comment()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that reserved function name comment is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames004() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function comment() { fn:true() };\n" + "\tlocal:comment()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name document-node is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames005() { xquery10(); final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function document-node() { fn:true() };\n" + "\tlocal:document-node()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that reserved function name document-node is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames006() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function document-node() { fn:true() };\n" + "\tlocal:document-node()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name element is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames007() { xquery10(); final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function element() { fn:true() };\n" + "\tlocal:element()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that reserved function name element is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames008() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function element() { fn:true() };\n" + "\tlocal:element()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name empty-sequence is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames009() { xquery10(); final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function empty-sequence() { fn:true() };\n" + "\tlocal:empty-sequence()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that reserved function name empty-sequence is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames010() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function empty-sequence() { fn:true() };\n" + "\tlocal:empty-sequence()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name function is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames011() { xquery10(); final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function function() { fn:true() };\n" + "\tlocal:function()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that reserved function name function is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames012() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function function() { fn:true() };\n" + "\tlocal:function()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name if is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames013() { xquery10(); final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function if() { fn:true() };\n" + "\tlocal:if()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that reserved function name if is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames014() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function if() { fn:true() };\n" + "\tlocal:if()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name item is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames015() { xquery10(); final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function item() { fn:true() };\n" + "\tlocal:item()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that reserved function name item is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames016() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function item() { fn:true() };\n" + "\tlocal:item()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name namespace-node is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames017() { xquery10(); final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function namespace-node() { fn:true() };\n" + "\tlocal:namespace-node()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that reserved function name namespace-node is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames018() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function namespace-node() { fn:true() };\n" + "\tlocal:namespace-node()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name node is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames019() { xquery10(); final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function node() { fn:true() };\n" + "\tlocal:node()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that reserved function name node is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames020() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function node() { fn:true() };\n" + "\tlocal:node()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name processing-instruction is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames021() { xquery10(); final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function processing-instruction() { fn:true() };\n" + "\tlocal:processing-instruction()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that reserved function name processing-instruction is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames022() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function processing-instruction() { fn:true() };\n" + "\tlocal:processing-instruction()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name schema-attribute is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames023() { xquery10(); final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function schema-attribute() { fn:true() };\n" + "\tlocal:schema-attribute()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that reserved function name schema-attribute is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames024() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function schema-attribute() { fn:true() };\n" + "\tlocal:schema-attribute()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name schema-element is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames025() { xquery10(); final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function schema-element() { fn:true() };\n" + "\tlocal:schema-element()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that reserved function name schema-element is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames026() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function schema-element() { fn:true() };\n" + "\tlocal:schema-element()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name switch is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames027() { xquery10(); final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function switch() { fn:true() };\n" + "\tlocal:switch()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that reserved function name switch is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames028() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function switch() { fn:true() };\n" + "\tlocal:switch()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name text is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames029() { xquery10(); final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function text() { fn:true() };\n" + "\tlocal:text()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that reserved function name text is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames030() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function text() { fn:true() };\n" + "\tlocal:text()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Check that reserved function name typeswitch is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames031() { xquery10(); final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function typeswitch() { fn:true() };\n" + "\tlocal:typeswitch()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that reserved function name typeswitch is handled correctly. . */ @org.junit.Test public void functionDeclReservedFunctionNames032() { final XQuery query = new XQuery( "\n" + "\tdeclare default function namespace \"http://www.w3.org/2005/xquery-local-functions\";\n" + "\tdeclare function typeswitch() { fn:true() };\n" + "\tlocal:typeswitch()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Demonstrate function declaration in different combination . */ @org.junit.Test public void functionDeclaration001() { final XQuery query = new XQuery( "\n" + " declare namespace foo = \"http://www..oracle.com/xquery/test\";\n" + " declare function foo:price ($b as element()) as element()* { $b/price };\n" + " 1\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Demonstrate function declaration in different combination . */ @org.junit.Test public void functionDeclaration002() { final XQuery query = new XQuery( " \n" + " declare function local:foo($n as xs:integer) { {$n} };\n" + " local:foo(4)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("4", false) ); } /** * Demonstrate function declaration in different combination . */ @org.junit.Test public void functionDeclaration003() { final XQuery query = new XQuery( "\n" + " declare function local:price ($i as element()) as element()? { $i/price };\n" + " for $j in /bib/book return local:price($j)", ctx); try { query.context(node(file("docs/bib.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("65.9565.9539.95129.95", false) ); } /** * Demonstrate function declaration in different combination . */ @org.junit.Test public void functionDeclaration004() { final XQuery query = new XQuery( "\n" + " declare function local:summary($emps as element(employee)*) as element(dept)* { \n" + " for $d in distinct-values($emps/deptno) \n" + " let $e := $emps[deptno = $d] \n" + " return \n" + " {$d} \n" + " {count($e)} \n" + " {sum($e/salary)} \n" + " \n" + " };\n" + " local:summary(//employee[location = \"Denver\"])\n" + " ", ctx); try { query.context(node(file("op/union/acme_corp.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("121300002180000", false) ); } /** * Demonstrate function declaration in different combination . */ @org.junit.Test public void functionDeclaration005() { final XQuery query = new XQuery( "\n" + " declare function local:mysum($i as xs:integer, $j as xs:integer) { let $j := $i + $j return $j };\n" + " declare function local:invoke_mysum() { let $s := 1 for $d in (1,2,3,4,5) let $s := local:mysum($s, $d) return $s };\n" + " local:invoke_mysum()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "2 3 4 5 6") ); } /** * Demonstrate function declaration in different combination . */ @org.junit.Test public void functionDeclaration006() { final XQuery query = new XQuery( "\n" + " declare function local:mysum($i as xs:integer, $j as xs:integer) { let $j := $i + $j return $j };\n" + " declare function local:invoke_mysum($st as xs:integer) { for $d in (1,2,3,4,5) let $st := local:mysum($d, $st) return $st };\n" + " local:invoke_mysum(0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1 2 3 4 5") ); } /** * Demonstrate function declaration in different combination . */ @org.junit.Test public void functionDeclaration007() { final XQuery query = new XQuery( "\n" + " declare variable $a := 1;\n" + " declare function local:foo($a as xs:integer) { \n" + " if ($a > 100) then $a else let $a := $a + 1 return local:foo($a) };\n" + " local:foo($a)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("101") ); } /** * Demonstrate function declaration in different combination . */ @org.junit.Test public void functionDeclaration008() { final XQuery query = new XQuery( "\n" + " declare namespace my = \"urn:foo\";\n" + " declare function my:fact($n as xs:integer) as xs:integer { if ($n < 2) then 1 else $n * my:fact($n - 1) };\n" + " declare variable $my:ten := my:fact(10);\n" + " { for $i in 1 to 10 return }
    10!/{$i}! = {$my:ten div my:fact($i)}
    ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("
    10!/1! = 3628800
    10!/2! = 1814400
    10!/3! = 604800
    10!/4! = 151200
    10!/5! = 30240
    10!/6! = 5040
    10!/7! = 720
    10!/8! = 90
    10!/9! = 10
    10!/10! = 1
    ", false) ); } /** * Demonstrate function declaration in different combination . */ @org.junit.Test public void functionDeclaration009() { final XQuery query = new XQuery( " \n" + " declare function local:fact($n as xs:integer) as xs:integer { if ($n < 2) then 1 else $n * local:fact(($n)-1) };\n" + " { for $i in 1 to 10 return }
    {$i}! = {local:fact($i)}
    ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("
    1! = 1
    2! = 2
    3! = 6
    4! = 24
    5! = 120
    6! = 720
    7! = 5040
    8! = 40320
    9! = 362880
    10! = 3628800
    ", false) ); } /** * Demonstrate function declaration in different combination . */ @org.junit.Test public void functionDeclaration010() { final XQuery query = new XQuery( " \n" + " declare function local:prnt($n as xs:integer,$n2 as xs:string, $n3 as xs:date, $n4 as xs:long, $n5 as xs:string, $n6 as xs:decimal) { if ($n < 2) then 1 else concat($n, \" \",$n2,\" \",$n3,\" \",$n4,\" \",$n5,\" \",$n6) };\n" + " { }
    Value is = {local:prnt(4,xs:string(\"hello\"),xs:date(\"2005-02-22\"), xs:long(5),xs:string(\"well\"),xs:decimal(1.2))}
    ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("
    Value is = 4 hello 2005-02-22 5 well 1.2
    ", false) ); } /** * Demonstrate function declaration - forward declaration . */ @org.junit.Test public void functionDeclaration011() { final XQuery query = new XQuery( " \n" + " declare function local:fn1 ($n as xs:integer) as xs:integer { local:fn2($n) };\n" + " declare function local:fn2 ($n as xs:integer) as xs:integer { if ($n = 1) then 1 else $n + local:fn1($n - 1) };\n" + " local:fn1(4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Demonstrate function declaration in different combination . */ @org.junit.Test public void functionDeclaration012() { final XQuery query = new XQuery( " \n" + " declare function local:fn1 ($n as xs:integer) as xs:integer { local:fn2($n) };\n" + " declare function local:fn2 ($n as xs:integer) as xs:integer { if ($n = 1) then 1 else $n + local:fn1($n - 1) };\n" + " local:fn1(4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * Demonstrate function declaration in different combination . */ @org.junit.Test public void functionDeclaration013() { final XQuery query = new XQuery( " \n" + " declare function local:foo2($i as xs:string) as xs:string {local:foo($i)};\n" + " declare function local:foo($i as xs:string) as xs:string {$i};\n" + " local:foo2(\"abc\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "abc") ); } /** * Demonstrate function declaration in different combination . */ @org.junit.Test public void functionDeclaration014() { final XQuery query = new XQuery( "\n" + " declare function local:odd($x as xs:integer) as xs:boolean {if ($x = 0) then false() else local:even($x - 1)};\n" + " declare function local:even($x as xs:integer) as xs:boolean {if ($x = 0) then true() else local:odd($x - 1)};\n" + " local:even(4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Demonstrate function declaration in different combination . */ @org.junit.Test public void functionDeclaration015() { final XQuery query = new XQuery( "\n" + " declare function local:odd($x as xs:integer) as xs:boolean {if ($x = 0) then false() else local:even($x - 1)};\n" + " declare function local:even($x as xs:integer) as xs:boolean {if ($x = 0) then true() else local:odd($x - 1)};\n" + " local:even(3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Demonstrate function declaration in different combination . */ @org.junit.Test public void functionDeclaration016() { final XQuery query = new XQuery( "\n" + " declare function local:title($a_book as element()) { for $i in $a_book return $i/title };\n" + " /bib/book/(local:title(.))", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("TCP/IP IllustratedAdvanced Programming in the Unix environmentData on the WebThe Economics of Technology and Content for Digital TV", false) ); } /** * Demonstrate function declaration in different combination . */ @org.junit.Test public void functionDeclaration017() { final XQuery query = new XQuery( "\n" + " declare default element namespace \"http://www.example.com/filesystem\";\n" + " declare variable $v as xs:integer := 100;\n" + " declare function local:udf1 ($CUSTNO as xs:integer) { {$CUSTNO*$v} };\n" + " local:udf1(10)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1000", false) ); } /** * Demonstrate function declaration in different combination . */ @org.junit.Test public void functionDeclaration018() { final XQuery query = new XQuery( "\n" + " declare default element namespace \"http://www.example.com/filesystem\";\n" + " declare function local:udf1 () { {10*10} };\n" + " local:udf1 ()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("100", false) ); } /** * Demonstrate function declaration in different combination . */ @org.junit.Test public void functionDeclaration019() { final XQuery query = new XQuery( "\n" + " declare default element namespace \"http://www.example.com/def\";\n" + " declare namespace test=\"http://www.example.com/test\";\n" + " declare namespace test2=\"http://www.example.com/test2\";\n" + " declare function test:udf1() { {10*10} };\n" + " declare function test2:udf1() { };\n" + " {test:udf1()} {test2:udf1()} ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("100", false) ); } /** * Demonstrate function declaration - overloading . */ @org.junit.Test public void functionDeclaration020() { final XQuery query = new XQuery( "declare namespace foo = \"http://www..oracle.com/xquery/test\";\n" + " declare function foo:price () as xs:integer+ { 100 };\n" + " declare function foo:price ($z as xs:integer) as xs:integer+ { $z };\n" + " declare function foo:price ($x as xs:integer, $y as xs:integer) as xs:integer+ { $x, $y };\n" + " declare function foo:price ($x as xs:integer, $y as xs:integer, $z as xs:integer) as xs:integer+ { $x+$y+$z };\n" + " foo:price(), foo:price(1), foo:price(2,3), foo:price(4,5,6)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "100 1 2 3 15") ); } /** * Demonstrate function declaration - negative tests . */ @org.junit.Test public void functionDeclaration021() { final XQuery query = new XQuery( "\n" + " declare function local:foo ($n as xs:integer) as xs:string { $n };\n" + " local:foo(4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Demonstrate function declaration - negative tests . */ @org.junit.Test public void functionDeclaration022() { final XQuery query = new XQuery( "\n" + " declare function local:foo ($m as xs:integer) { $m };\n" + " declare function local:foo ($n as xs:integer) { $n };\n" + " local:foo(4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0034") ); } /** * Demonstrate function declaration - negative tests . */ @org.junit.Test public void functionDeclaration023() { final XQuery query = new XQuery( "\n" + " declare function foo ($n as xs:integer) { $n };\n" + " foo(4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XQST0045") || error("XPST0017") ) ); } /** * Demonstrate function declaration - negative tests . */ @org.junit.Test public void functionDeclaration024() { final XQuery query = new XQuery( "\n" + " declare function local:foo ($n as xs:integer, $n as xs:integer) { $n };\n" + " local:foo(4, 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0039") ); } /** * Function Declaration with no namespace. . */ @org.junit.Test public void functionDeclaration025() { final XQuery query = new XQuery( "declare default function namespace \"\";\n" + " declare function foo ($n as xs:integer, $m as xs:integer) { $n };\n" + " foo(4, 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0060") ); } /** * Function Declaration using global variable. A global node test, which uses the focus in the dynamic context. . */ @org.junit.Test public void functionDeclaration026() { final XQuery query = new XQuery( "\n" + " declare variable $global := node();\n" + " declare function local:function() { exists($global) };\n" + " local:function()", ctx); try { query.context(node(file("op/union/bib2.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdGeneralCompEq.java000066400000000000000000002725331222453003200306330ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the GeneralComp production using the "=" operator. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdGeneralCompEq extends QT3TestSet { /** * General comparison where both types are instances of xs:untypedAtomic. . */ @org.junit.Test public void genCompEq1() { final XQuery query = new XQuery( "xs:untypedAtomic(\"a string\") = xs:untypedAtomic(\"a stringDIFF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * General comparison where one of the types is xs:untypedAtomic and the other xs:NCName. Expected error FORG0001. . */ @org.junit.Test public void genCompEq2() { final XQuery query = new XQuery( "xs:untypedAtomic(\"1\") = xs:NCName(\"string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * General comparison where one of the types is xs:untypedAtomic and the other xs:dayTimeDuration . */ @org.junit.Test public void genCompEq3() { final XQuery query = new XQuery( "xs:dayTimeDuration(\"P3DT08H34M12.143S\") = xs:untypedAtomic(\"P3DT08H34M12.143S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where one of the types is xs:untypedAtomic and the other xs:dayTimeDuration Expected error FORG0001. . */ @org.junit.Test public void genCompEq4() { final XQuery query = new XQuery( "xs:untypedAtomic(\"0\") = xs:dayTimeDuration(\"PT0S\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * General comparison where one of the types is xs:untypedAtomic and the other xs:yearMonthDuration . */ @org.junit.Test public void genCompEq5() { final XQuery query = new XQuery( "xs:untypedAtomic(\"P1999Y10M\") = xs:yearMonthDuration(\"P1999Y10M\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where one of the types is xs:untypedAtomic and the other xs:yearMonthDuration Expected error FORG0001. . */ @org.junit.Test public void genCompEq6() { final XQuery query = new XQuery( "xs:yearMonthDuration(\"P1999Y\") = xs:untypedAtomic(\"1999\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * General comparisons involving the empty sequence. . */ @org.junit.Test public void kGenCompEq1() { final XQuery query = new XQuery( "not(() = ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Example from the XPath 2.0 specification. . */ @org.junit.Test public void kGenCompEq10() { final XQuery query = new XQuery( "not((xs:untypedAtomic(\"1\"), xs:untypedAtomic(\"2\")) = (xs:untypedAtomic(\"2.0\"), 3.0))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * General comparison causing numeric promotion from xs:untypedAtomic. . */ @org.junit.Test public void kGenCompEq11() { final XQuery query = new XQuery( "xs:untypedAtomic(\"1\") = 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing numeric promotion from xs:untypedAtomic. . */ @org.junit.Test public void kGenCompEq12() { final XQuery query = new XQuery( "not(xs:untypedAtomic(\"2\") = 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing numeric promotion from xs:untypedAtomic. . */ @org.junit.Test public void kGenCompEq13() { final XQuery query = new XQuery( "xs:untypedAtomic(\"1\") = 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing numeric promotion from xs:untypedAtomic. . */ @org.junit.Test public void kGenCompEq14() { final XQuery query = new XQuery( "1 = xs:untypedAtomic(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing numeric promotion from xs:untypedAtomic. . */ @org.junit.Test public void kGenCompEq15() { final XQuery query = new XQuery( "1 = xs:untypedAtomic(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A general comparison involving the error() function. . */ @org.junit.Test public void kGenCompEq16() { final XQuery query = new XQuery( "error() = 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * A general comparison involving the error() function. . */ @org.junit.Test public void kGenCompEq17() { final XQuery query = new XQuery( "(error(), 3) = 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * A general comparison involving the error() function. . */ @org.junit.Test public void kGenCompEq18() { final XQuery query = new XQuery( "3 = error()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * A general comparison involving the error() function. . */ @org.junit.Test public void kGenCompEq19() { final XQuery query = new XQuery( "3 = (error(), 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * General comparisons involving the empty sequence. . */ @org.junit.Test public void kGenCompEq2() { final XQuery query = new XQuery( "not((() = ()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An expression involving the '=' operator that trigger certain optimization paths in some implementations. . */ @org.junit.Test public void kGenCompEq20() { final XQuery query = new XQuery( "count(remove(remove((current-time(), 1), 1), 1)) = 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that fn:count combined with expressions that might disable compile time evaluations(optimization) as well as the '=' operator, is conformant. . */ @org.junit.Test public void kGenCompEq21() { final XQuery query = new XQuery( "not(0 = count((1, 2, timezone-from-time(current-time()))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test that fn:count combined with expressions that might disable compile time evaluations(optimization) as well as the '=' operator, is conformant. . */ @org.junit.Test public void kGenCompEq22() { final XQuery query = new XQuery( "0 != count((1, 2, timezone-from-time(current-time())))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Comparison where type of operands are incompatible. . */ @org.junit.Test public void kGenCompEq23() { final XQuery query = new XQuery( "(xs:anyURI(\"example.com/\"), 1, QName(\"example.com\", \"ncname\"), false(), xs:hexBinary(\"FF\")) = (xs:anyURI(\"example.com/NOT\"), 0, QName(\"example.com\", \"p:ncname\"), true(), xs:hexBinary(\"EF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * General comparison involving xs:untypedAtomic/xs:string. . */ @org.junit.Test public void kGenCompEq24() { final XQuery query = new XQuery( "\"a string\" = \"a string\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison involving xs:untypedAtomic/xs:string. . */ @org.junit.Test public void kGenCompEq25() { final XQuery query = new XQuery( "xs:untypedAtomic(\"a string\") = \"a string\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison involving xs:untypedAtomic/xs:string. . */ @org.junit.Test public void kGenCompEq26() { final XQuery query = new XQuery( "\"a string\" = xs:untypedAtomic(\"a string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison involving xs:untypedAtomic/xs:string. . */ @org.junit.Test public void kGenCompEq27() { final XQuery query = new XQuery( "not(xs:untypedAtomic(\"a string\") = \"a stringDIFF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison involving xs:untypedAtomic/xs:string. . */ @org.junit.Test public void kGenCompEq28() { final XQuery query = new XQuery( "not(\"a string\" = xs:untypedAtomic(\"a stringDIFF\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison involving xs:untypedAtomic/xs:string. . */ @org.junit.Test public void kGenCompEq29() { final XQuery query = new XQuery( "not(\"a string\" = \"a stringDIFF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparisons involving the empty sequence. . */ @org.junit.Test public void kGenCompEq3() { final XQuery query = new XQuery( "not((() = 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison with remove() as operand, resulting in incompatible operand types. . */ @org.junit.Test public void kGenCompEq30() { final XQuery query = new XQuery( "remove((6, \"a string\"), 1) = 6", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * General comparison with remove() as operand, resulting in incompatible operand types. . */ @org.junit.Test public void kGenCompEq31() { final XQuery query = new XQuery( "6 = remove((\"a string\", 6), 2)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * General comparison involving remove(), resulting in operands that require conversion to numeric from xs:untypedAtomic. . */ @org.junit.Test public void kGenCompEq32() { final XQuery query = new XQuery( "remove((6, \"a string\"), 2) = xs:untypedAtomic(\"6\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * General comparison involving remove(), resulting in operands that require conversion to numeric from xs:untypedAtomic. . */ @org.junit.Test public void kGenCompEq33() { final XQuery query = new XQuery( "xs:untypedAtomic(\"6\") = remove((\"a string\", 6), 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * General comparison involving remove(), resulting in operands that require conversion to numeric from xs:untypedAtomic. Implementations supporting the static typing feature may raise XPTY0004. . */ @org.junit.Test public void kGenCompEq34() { final XQuery query = new XQuery( "(remove((xs:untypedAtomic(\"6\"), \"a string\"), 2)) = 6", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * General comparison involving remove(), resulting in operands that require conversion to numeric from xs:untypedAtomic. Implementations supporting the static typing feature may raise XPTY0004. . */ @org.junit.Test public void kGenCompEq35() { final XQuery query = new XQuery( "6 = (remove((\"a string\", xs:untypedAtomic(\"6\")), 1))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompEq36() { final XQuery query = new XQuery( "1 = 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompEq37() { final XQuery query = new XQuery( "(1, 2, 3) = 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompEq38() { final XQuery query = new XQuery( "(1, 2, 3) = 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompEq39() { final XQuery query = new XQuery( "(1, 2, 3) = 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparisons involving the empty sequence. . */ @org.junit.Test public void kGenCompEq4() { final XQuery query = new XQuery( "not(1 = ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompEq40() { final XQuery query = new XQuery( "2 = (1, 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompEq41() { final XQuery query = new XQuery( "1 = (1, 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompEq42() { final XQuery query = new XQuery( "3 = (1, 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing a xs:untypedAtomic value to be cast to xs:boolean, and then compared. . */ @org.junit.Test public void kGenCompEq43() { final XQuery query = new XQuery( "xs:untypedAtomic(\"false\") = false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing a xs:untypedAtomic value to be cast to xs:boolean, and then compared. . */ @org.junit.Test public void kGenCompEq44() { final XQuery query = new XQuery( "false() = xs:untypedAtomic(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing a xs:untypedAtomic value to be cast to xs:boolean, and then compared. . */ @org.junit.Test public void kGenCompEq45() { final XQuery query = new XQuery( "not(xs:untypedAtomic(\"true\") = false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing a xs:untypedAtomic value to be cast to xs:boolean, and then compared. . */ @org.junit.Test public void kGenCompEq46() { final XQuery query = new XQuery( "(true() = xs:untypedAtomic(\"true\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompEq47() { final XQuery query = new XQuery( "\"1\" = 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompEq48() { final XQuery query = new XQuery( "1 = \"1\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompEq49() { final XQuery query = new XQuery( "false() = 5", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A syntactically invalid expression that reminds of a general comparison operator. . */ @org.junit.Test public void kGenCompEq5() { final XQuery query = new XQuery( "1 == 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompEq50() { final XQuery query = new XQuery( "5 = false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompEq51() { final XQuery query = new XQuery( "xs:untypedAtomic(\"three\") = 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompEq52() { final XQuery query = new XQuery( "xs:string(\"false\") = false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompEq53() { final XQuery query = new XQuery( "false() = xs:string(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompEq54() { final XQuery query = new XQuery( "xs:untypedAtomic(\"falseERR\") = false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompEq55() { final XQuery query = new XQuery( "(xs:untypedAtomic(\"1\"), xs:anyURI(\"example.com\")) = (xs:untypedAtomic(\"2.0\"), 3.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompEq56() { final XQuery query = new XQuery( "false() = xs:untypedAtomic(\"falseERR\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompEq57() { final XQuery query = new XQuery( "3 = xs:untypedAtomic(\"three\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompEq58() { final XQuery query = new XQuery( "xs:anyURI(\"example.com/\") = false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompEq59() { final XQuery query = new XQuery( "false() = xs:anyURI(\"example.com/\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Example from the XPath 2.0 specification. . */ @org.junit.Test public void kGenCompEq6() { final XQuery query = new XQuery( "(1, 2) = (2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Example from the XPath 2.0 specification. . */ @org.junit.Test public void kGenCompEq7() { final XQuery query = new XQuery( "(2, 3) = (3, 4)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Example from the XPath 2.0 specification. . */ @org.junit.Test public void kGenCompEq8() { final XQuery query = new XQuery( "not((1, 2) = (3, 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Example from the XPath 2.0 specification. . */ @org.junit.Test public void kGenCompEq9() { final XQuery query = new XQuery( "(xs:untypedAtomic(\"1\"), xs:untypedAtomic(\"2\")) = (xs:untypedAtomic(\"2.0\"), 2.0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPTY0004") ) ); } /** * Compare two values returned from fn:lower-case(). . */ @org.junit.Test public void k2GenCompEq1() { final XQuery query = new XQuery( "declare variable $vA as xs:string := (\"B STRING\", current-time(), string(content))[1] treat as xs:string; declare variable $vB as xs:string := (\"b string\", current-time(), string(content))[1] treat as xs:string; (lower-case($vA) = lower-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Compare two values returned from fn:upper-case(). . */ @org.junit.Test public void k2GenCompEq2() { final XQuery query = new XQuery( "declare variable $vA as xs:string := (\"B STRING\", current-time(), string(content))[1] treat as xs:string; declare variable $vB as xs:string := (\"b string\", current-time(), string(content))[1] treat as xs:string; (upper-case($vA) = upper-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Compare two non-matching values returned from fn:lower-case(). . */ @org.junit.Test public void k2GenCompEq3() { final XQuery query = new XQuery( "declare variable $vA as xs:string := (\"B STRING\", current-time(), string(content))[1] treat as xs:string; declare variable $vB as xs:string := (\"no match\", current-time(), string(content))[1] treat as xs:string; (lower-case($vA) = lower-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Compare two non-matching values returned from fn:upper-case(). . */ @org.junit.Test public void k2GenCompEq4() { final XQuery query = new XQuery( "declare variable $vA as xs:string := (\"B STRING\", current-time(), string(content))[1] treat as xs:string; declare variable $vB as xs:string := (\"no match\", current-time(), string(content))[1] treat as xs:string; (upper-case($vA) = upper-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Compare two non-matching values returned from fn:lower-case() and fn:upper-case(). . */ @org.junit.Test public void k2GenCompEq5() { final XQuery query = new XQuery( "declare variable $vA as xs:string := (\"B STRING\", current-time(), string(content))[1] treat as xs:string; declare variable $vB as xs:string := (\"b string\", current-time(), string(content))[1] treat as xs:string; (upper-case($vA) = lower-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Compare two non-matching values returned from fn:lower-case() and fn:upper-case(). . */ @org.junit.Test public void k2GenCompEq6() { final XQuery query = new XQuery( "declare variable $vA as xs:string := (\"B STRING\", current-time(), string(content))[1] treat as xs:string; declare variable $vB as xs:string := (\"b string\", current-time(), string(content))[1] treat as xs:string; (lower-case($vA) = upper-case($vB))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * A failing call to a codepoints-to-string(), that may be written to true. See section 2.3.4. . */ @org.junit.Test public void k2GenCompEq7() { final XQuery query = new XQuery( "let $x := codepoints-to-string(12) return ($x = $x)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOCH0001") ) ); } /** * The operator causes atomization. . */ @org.junit.Test public void k2GenCompEq8() { final XQuery query = new XQuery( "empty(for $b in where $b/@id=\"person0\" return ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = = operand2 = Empty sequence . */ @org.junit.Test public void generalexpression1() { final XQuery query = new XQuery( "() = ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = = operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression10() { final XQuery query = new XQuery( "() = ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = = operand2 = Empty sequence . */ @org.junit.Test public void generalexpression11() { final XQuery query = new XQuery( "10000 = ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = "=" operand2 = empty sequence . */ @org.junit.Test public void generalexpression12() { final XQuery query = new XQuery( "10000 = ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = = operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression13() { final XQuery query = new XQuery( "10000 = (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = = operand2 = Element Constructor . */ @org.junit.Test public void generalexpression14() { final XQuery query = new XQuery( "10000 = 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = = operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression15() { final XQuery query = new XQuery( "10000 = (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = = operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression16() { final XQuery query = new XQuery( "10000 = (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = = operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression17() { final XQuery query = new XQuery( "10000 = (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = = operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression18() { final XQuery query = new XQuery( "10000 = (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = = operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression19() { final XQuery query = new XQuery( "10000 = ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = = operand2 = Atomic Value . */ @org.junit.Test public void generalexpression2() { final XQuery query = new XQuery( "() = 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = = operand2 = Empty sequence . */ @org.junit.Test public void generalexpression20() { final XQuery query = new XQuery( "(50000) = ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = = operand2 = Atomic Value . */ @org.junit.Test public void generalexpression21() { final XQuery query = new XQuery( "(50000) = 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = = operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression22() { final XQuery query = new XQuery( "(50000) = (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = = operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression23() { final XQuery query = new XQuery( "(50000) = (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = = operand2 = Element Constructor . */ @org.junit.Test public void generalexpression24() { final XQuery query = new XQuery( "(50000) = 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = = operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression25() { final XQuery query = new XQuery( "(50000) = (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = = operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression26() { final XQuery query = new XQuery( "(50000) = (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = = operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression27() { final XQuery query = new XQuery( "(50000) = (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = = operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression28() { final XQuery query = new XQuery( "(50000) = (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = = operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression29() { final XQuery query = new XQuery( "(50000) = ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = = operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression3() { final XQuery query = new XQuery( "() = (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = = operand2 = Empty sequence . */ @org.junit.Test public void generalexpression30() { final XQuery query = new XQuery( "(10000,50000) = ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = = operand2 = Atomic Value . */ @org.junit.Test public void generalexpression31() { final XQuery query = new XQuery( "(10000,50000) = 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = = operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression32() { final XQuery query = new XQuery( "(10000,50000) = (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = = operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression33() { final XQuery query = new XQuery( "(10000,50000) = (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = = operand2 = Element Constructor . */ @org.junit.Test public void generalexpression34() { final XQuery query = new XQuery( "(10000,50000) = 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = = operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression35() { final XQuery query = new XQuery( "(10000,50000) = (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = = operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression36() { final XQuery query = new XQuery( "(10000,50000) = (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = = operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression37() { final XQuery query = new XQuery( "(10000,50000) = (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = = operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression38() { final XQuery query = new XQuery( "(10000,50000) = (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = = operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression39() { final XQuery query = new XQuery( "(10000,50000) = ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = = operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression4() { final XQuery query = new XQuery( "() = (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = = operand2 = Empty sequence . */ @org.junit.Test public void generalexpression40() { final XQuery query = new XQuery( "10000 = ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = = operand2 = Atomic Value . */ @org.junit.Test public void generalexpression41() { final XQuery query = new XQuery( "10000 = 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = = operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression42() { final XQuery query = new XQuery( "10000 = (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = = operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression43() { final XQuery query = new XQuery( "10000 = (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = = operand2 = Element Constructor . */ @org.junit.Test public void generalexpression44() { final XQuery query = new XQuery( "10000 = 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = = operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression45() { final XQuery query = new XQuery( "10000 = (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = = operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression46() { final XQuery query = new XQuery( "10000 = (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = = operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression47() { final XQuery query = new XQuery( "10000 = (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = = operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression48() { final XQuery query = new XQuery( "10000 = (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = = operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression49() { final XQuery query = new XQuery( "10000 = ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = = operand2 = Element Constructor . */ @org.junit.Test public void generalexpression5() { final XQuery query = new XQuery( "() = 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = = operand2 = Empty sequence . */ @org.junit.Test public void generalexpression50() { final XQuery query = new XQuery( "(10000) = ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = = operand2 = Atomic Value . */ @org.junit.Test public void generalexpression51() { final XQuery query = new XQuery( "(10000) = 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = = operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression52() { final XQuery query = new XQuery( "(10000) = (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = = operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression53() { final XQuery query = new XQuery( "(10000) = (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = = operand2 = Element Constructor . */ @org.junit.Test public void generalexpression54() { final XQuery query = new XQuery( "(10000) = 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = = operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression55() { final XQuery query = new XQuery( "(10000) = (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = = operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression56() { final XQuery query = new XQuery( "(10000) = (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = = operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression57() { final XQuery query = new XQuery( "(10000) = (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = = operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression58() { final XQuery query = new XQuery( "(10000) = (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = = operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression59() { final XQuery query = new XQuery( "(10000) = ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = = operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression6() { final XQuery query = new XQuery( "() = (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = = operand2 = Empty sequence . */ @org.junit.Test public void generalexpression60() { final XQuery query = new XQuery( "(10000,50000) = ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = = operand2 = Atomic Value . */ @org.junit.Test public void generalexpression61() { final XQuery query = new XQuery( "(10000,50000) = 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = = operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression62() { final XQuery query = new XQuery( "(10000,50000) = (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = = operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression63() { final XQuery query = new XQuery( "(10000,50000) = (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = = operand2 = Element Constructor . */ @org.junit.Test public void generalexpression64() { final XQuery query = new XQuery( "(10000,50000) = 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = = operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression65() { final XQuery query = new XQuery( "(10000,50000) = (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = = operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression66() { final XQuery query = new XQuery( "(10000,50000) = (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = = operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression67() { final XQuery query = new XQuery( "(10000,50000) = (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = = operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression68() { final XQuery query = new XQuery( "(10000,50000) = (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = = operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression69() { final XQuery query = new XQuery( "(10000,50000) = ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = = operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression7() { final XQuery query = new XQuery( "() = (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = = operand2 = Empty sequence . */ @org.junit.Test public void generalexpression70() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) = ()", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = = operand2 = Atomic Value . */ @org.junit.Test public void generalexpression71() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) = 10000", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = = operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression72() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) = (50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = = operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression73() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) = (10000,50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = = operand2 = Element Constructor . */ @org.junit.Test public void generalexpression74() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) = 10000", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = = operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression75() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) = (10000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = = operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression76() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) = (10000,50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = = operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression77() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) = (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = = operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression78() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) = (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = = operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression79() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1]) = ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = = operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression8() { final XQuery query = new XQuery( "() = (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = = operand2 = Empty sequence . */ @org.junit.Test public void generalexpression80() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) = ()", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = = operand2 = Atomic Value . */ @org.junit.Test public void generalexpression81() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) = 10000", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = = operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression82() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) = (50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = = operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression83() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) = (10000,50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = = operand2 = Element Constructor . */ @org.junit.Test public void generalexpression84() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) = 10000", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = = operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression85() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) = (10000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = = operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression86() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) = (10000,50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = = operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression87() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) = (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = = operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression88() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) = (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = = operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression89() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$works/works/employee[6]/hours[1]) = \n" + " ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = = operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression9() { final XQuery query = new XQuery( "() = (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = = operand2 = Empty sequence . */ @org.junit.Test public void generalexpression90() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) = ()", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = = operand2 = Atomic Value . */ @org.junit.Test public void generalexpression91() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) = 10000", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = = operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression92() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) = (50000)", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = = operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression93() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) = (10000,50000)", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = = operand2 = Element Constructor . */ @org.junit.Test public void generalexpression94() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) = 10000", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = = operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression95() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) = (10000)", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = = operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression96() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) = (10000,50000)", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = = operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression97() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) =\n" + " ($works/works/employee[1]/hours[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = = operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression98() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) = ($works/works/employee[1]/hours[1],$works/works/employee[6]/hours[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = = operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression99() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) = ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdGeneralCompGe.java000066400000000000000000002000311222453003200306010ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the GeneralComp.ge production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdGeneralCompGe extends QT3TestSet { /** * General comparison where one or more operands is the empty sequence. . */ @org.junit.Test public void kGenCompGTEQ1() { final XQuery query = new XQuery( "not(() >= () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * <= combined with count(). . */ @org.junit.Test public void kGenCompGTEQ10() { final XQuery query = new XQuery( "1 <= count((1, 2, 3, timezone-from-time(current-time()), 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where one or more operands is the empty sequence. . */ @org.junit.Test public void kGenCompGTEQ2() { final XQuery query = new XQuery( "not(1 >= () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where one or more operands is the empty sequence. . */ @org.junit.Test public void kGenCompGTEQ3() { final XQuery query = new XQuery( "not(() >= 1 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A syntactically invalid expression that reminds of a general comparison operator. . */ @org.junit.Test public void kGenCompGTEQ4() { final XQuery query = new XQuery( "1 =>; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * An expression involving the '>=' operator that trigger certain optimization paths in some implementations. . */ @org.junit.Test public void kGenCompGTEQ5() { final XQuery query = new XQuery( "count((0, timezone-from-time(current-time()))) >= 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing a xs:untypedAtomic value to be cast to xs:boolean, and then compared. . */ @org.junit.Test public void kGenCompGTEQ6() { final XQuery query = new XQuery( "xs:untypedAtomic(\"false\") >= false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing a xs:untypedAtomic value to be cast to xs:boolean, and then compared. . */ @org.junit.Test public void kGenCompGTEQ7() { final XQuery query = new XQuery( "true() >= xs:untypedAtomic(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing a xs:untypedAtomic value to be cast to xs:boolean, and then compared. . */ @org.junit.Test public void kGenCompGTEQ8() { final XQuery query = new XQuery( "false() >= xs:untypedAtomic(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing a xs:untypedAtomic value to be cast to xs:boolean, and then compared. . */ @org.junit.Test public void kGenCompGTEQ9() { final XQuery query = new XQuery( "xs:untypedAtomic(\"false\") >= false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = >= operand2 = Empty sequence . */ @org.junit.Test public void generalexpression496() { final XQuery query = new XQuery( "() >= ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = >= operand2 = Atomic Value . */ @org.junit.Test public void generalexpression497() { final XQuery query = new XQuery( "() >= 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = >= operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression498() { final XQuery query = new XQuery( "() >= (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = >= operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression499() { final XQuery query = new XQuery( "() >= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = >= operand2 = Element Constructor . */ @org.junit.Test public void generalexpression500() { final XQuery query = new XQuery( "() >= 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = >= operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression501() { final XQuery query = new XQuery( "() >= (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = >= operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression502() { final XQuery query = new XQuery( "() >= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = >= operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression503() { final XQuery query = new XQuery( "() >= (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = >= operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression504() { final XQuery query = new XQuery( "() >= (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = >= operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression505() { final XQuery query = new XQuery( "() >= ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = >= operand2 = Empty sequence . */ @org.junit.Test public void generalexpression506() { final XQuery query = new XQuery( "10000 >= ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = >= operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression507() { final XQuery query = new XQuery( "10000 >= (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = >= operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression508() { final XQuery query = new XQuery( "10000 >= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = >= operand2 = Element Constructor . */ @org.junit.Test public void generalexpression509() { final XQuery query = new XQuery( "10000 >= 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = >= operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression510() { final XQuery query = new XQuery( "10000 >= (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = >= operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression511() { final XQuery query = new XQuery( "10000 >= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = >= operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression512() { final XQuery query = new XQuery( "10000 >= (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = >= operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression513() { final XQuery query = new XQuery( "10000 >= (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = >= operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression514() { final XQuery query = new XQuery( "10000 >= ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = >= operand2 = Empty sequence . */ @org.junit.Test public void generalexpression515() { final XQuery query = new XQuery( "(50000) >= ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = >= operand2 = Atomic Value . */ @org.junit.Test public void generalexpression516() { final XQuery query = new XQuery( "(50000) >= 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = >= operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression517() { final XQuery query = new XQuery( "(50000) >= (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = >= operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression518() { final XQuery query = new XQuery( "(50000) >= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = >= operand2 = Element Constructor . */ @org.junit.Test public void generalexpression519() { final XQuery query = new XQuery( "(50000) >= 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = >= operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression520() { final XQuery query = new XQuery( "(50000) >= (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = >= operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression521() { final XQuery query = new XQuery( "(50000) >= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = >= operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression522() { final XQuery query = new XQuery( "(50000) >= (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = >= operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression523() { final XQuery query = new XQuery( "(50000) >= (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = >= operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression524() { final XQuery query = new XQuery( "(50000) >= ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = >= operand2 = Empty sequence . */ @org.junit.Test public void generalexpression525() { final XQuery query = new XQuery( "(10000,50000) >= ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = >= operand2 = Atomic Value . */ @org.junit.Test public void generalexpression526() { final XQuery query = new XQuery( "(10000,50000) >= 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = >= operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression527() { final XQuery query = new XQuery( "(10000,50000) >= (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = >= operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression528() { final XQuery query = new XQuery( "(10000,50000) >= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = >= operand2 = Element Constructor . */ @org.junit.Test public void generalexpression529() { final XQuery query = new XQuery( "(10000,50000) >= 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = >= operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression530() { final XQuery query = new XQuery( "(10000,50000) >= (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = >= operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression531() { final XQuery query = new XQuery( "(10000,50000) >= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = >= operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression532() { final XQuery query = new XQuery( "(10000,50000) >= (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = >= operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression533() { final XQuery query = new XQuery( "(10000,50000) >= (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = >= operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression534() { final XQuery query = new XQuery( "(10000,50000) >= ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = >= operand2 = Empty sequence . */ @org.junit.Test public void generalexpression535() { final XQuery query = new XQuery( "10000 >= ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = >= operand2 = Atomic Value . */ @org.junit.Test public void generalexpression536() { final XQuery query = new XQuery( "10000 >= 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = >= operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression537() { final XQuery query = new XQuery( "10000 >= (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = >= operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression538() { final XQuery query = new XQuery( "10000 >= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = >= operand2 = Element Constructor . */ @org.junit.Test public void generalexpression539() { final XQuery query = new XQuery( "10000 >= 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = >= operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression540() { final XQuery query = new XQuery( "10000 >= (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = >= operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression541() { final XQuery query = new XQuery( "10000 >= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = >= operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression542() { final XQuery query = new XQuery( "10000 >= (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = >= operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression543() { final XQuery query = new XQuery( "10000 >= (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = >= operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression544() { final XQuery query = new XQuery( "10000 >= ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = >= operand2 = Empty sequence . */ @org.junit.Test public void generalexpression545() { final XQuery query = new XQuery( "(10000) >= ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = >= operand2 = Atomic Value . */ @org.junit.Test public void generalexpression546() { final XQuery query = new XQuery( "(10000) >= 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = >= operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression547() { final XQuery query = new XQuery( "(10000) >= (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = >= operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression548() { final XQuery query = new XQuery( "(10000) >= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = >= operand2 = Element Constructor . */ @org.junit.Test public void generalexpression549() { final XQuery query = new XQuery( "(10000) >= 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = >= operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression550() { final XQuery query = new XQuery( "(10000) >= (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = >= operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression551() { final XQuery query = new XQuery( "(10000) >= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = >= operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression552() { final XQuery query = new XQuery( "(10000) >= (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = >= operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression553() { final XQuery query = new XQuery( "(10000) >= (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = >= operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression554() { final XQuery query = new XQuery( "(10000) >= ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = >= operand2 = Empty sequence . */ @org.junit.Test public void generalexpression555() { final XQuery query = new XQuery( "(10000,50000) >= ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = >= operand2 = Atomic Value . */ @org.junit.Test public void generalexpression556() { final XQuery query = new XQuery( "(10000,50000) >= 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = >= operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression557() { final XQuery query = new XQuery( "(10000,50000) >= (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = >= operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression558() { final XQuery query = new XQuery( "(10000,50000) >= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = >= operand2 = Element Constructor . */ @org.junit.Test public void generalexpression559() { final XQuery query = new XQuery( "(10000,50000) >= 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = >= operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression560() { final XQuery query = new XQuery( "(10000,50000) >= (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = >= operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression561() { final XQuery query = new XQuery( "(10000,50000) >= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = >= operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression562() { final XQuery query = new XQuery( "(10000,50000) >= (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = >= operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression563() { final XQuery query = new XQuery( "(10000,50000) >= (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = >= operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression564() { final XQuery query = new XQuery( "(10000,50000) >= ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = >= operand2 = Empty sequence . */ @org.junit.Test public void generalexpression565() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) >= ()", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = >= operand2 = Atomic Value . */ @org.junit.Test public void generalexpression566() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) >= 10000", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = >= operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression567() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) >= (50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = >= operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression568() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) >= (10000,50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = >= operand2 = Element Constructor . */ @org.junit.Test public void generalexpression569() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) >= 10000", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = >= operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression570() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) >= (10000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = >= operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression571() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) >= (10000,50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = >= operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression572() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) >= (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = >= operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression573() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) >= (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = >= operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression574() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1]) >= ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = >= operand2 = Empty sequence . */ @org.junit.Test public void generalexpression575() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) >= ()", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = >= operand2 = Atomic Value . */ @org.junit.Test public void generalexpression576() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) >= 10000", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = >= operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression577() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) >= (50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = >= operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression578() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) >= (10000,50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = >= operand2 = Element Constructor . */ @org.junit.Test public void generalexpression579() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) >= 10000", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = >= operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression580() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) >= (10000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = >= operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression581() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) >= (10000,50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = >= operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression582() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) >= (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = >= operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression583() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) >= (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = >= operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression584() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$works/works/employee[6]/hours[1]) >= ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = >= operand2 = Empty sequence . */ @org.junit.Test public void generalexpression585() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) >= ()", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = >= operand2 = Atomic Value . */ @org.junit.Test public void generalexpression586() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) >= 10000", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = >= operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression587() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) >= (50000)", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = >= operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression588() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) >= (10000,50000)", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = >= operand2 = Element Constructor . */ @org.junit.Test public void generalexpression589() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) >= 10000", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = >= operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression590() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) >= (10000)", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = >= operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression591() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) >= (10000,50000)", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = >= operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression592() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) >= ($works/works/employee[1]/hours[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = >= operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression593() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) >= ($works/works/employee[1]/hours[1],$works/works/employee[6]/hours[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = >= operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression594() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) >= ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test - greaterthaneqonanyuri-1 Evaluation of "ge" operator on xs:anyURI datatype. . */ @org.junit.Test public void greaterthaneqonanyuri1() { final XQuery query = new XQuery( "(xs:anyURI(\"http://www.example/com\")) >= (xs:anyURI(\"http://www.example/com\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdGeneralCompGt.java000066400000000000000000002055151222453003200306340ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the GeneralComp.gt production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdGeneralCompGt extends QT3TestSet { /** * General comparison where one or more operands is the empty sequence. . */ @org.junit.Test public void kGenCompGT1() { final XQuery query = new XQuery( "not(() > () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompGT10() { final XQuery query = new XQuery( "2 > 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompGT11() { final XQuery query = new XQuery( "1 >= 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing a xs:untypedAtomic value to be cast to xs:boolean, and then compared. . */ @org.junit.Test public void kGenCompGT12() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") > false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing a xs:untypedAtomic value to be cast to xs:boolean, and then compared. . */ @org.junit.Test public void kGenCompGT13() { final XQuery query = new XQuery( "true() > xs:untypedAtomic(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing a xs:untypedAtomic value to be cast to xs:boolean, and then compared. . */ @org.junit.Test public void kGenCompGT14() { final XQuery query = new XQuery( "not(xs:untypedAtomic(\"false\") > true())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing a xs:untypedAtomic value to be cast to xs:boolean, and then compared. . */ @org.junit.Test public void kGenCompGT15() { final XQuery query = new XQuery( "not(false() > xs:untypedAtomic(\"true\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompGT16() { final XQuery query = new XQuery( "1 > xs:anyURI(\"2\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompGT17() { final XQuery query = new XQuery( "xs:anyURI(\"2\") > 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * > combined with count(). . */ @org.junit.Test public void kGenCompGT18() { final XQuery query = new XQuery( "count((1, 2, 3, timezone-from-time(current-time()), 4)) > 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * >= combined with count(). . */ @org.junit.Test public void kGenCompGT19() { final XQuery query = new XQuery( "count((1, 2, 3, timezone-from-time(current-time()), 4)) >= 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where one or more operands is the empty sequence. . */ @org.junit.Test public void kGenCompGT2() { final XQuery query = new XQuery( "not(1 > () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where one or more operands is the empty sequence. . */ @org.junit.Test public void kGenCompGT3() { final XQuery query = new XQuery( "not(() > 1 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompGT4() { final XQuery query = new XQuery( "(1, 2, 3) > 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompGT5() { final XQuery query = new XQuery( "(1, 2, 3) > 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompGT6() { final XQuery query = new XQuery( "(1, 2, 3) > 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompGT7() { final XQuery query = new XQuery( "4 > (1, 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompGT8() { final XQuery query = new XQuery( "2 > (1, 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompGT9() { final XQuery query = new XQuery( "3 > (1, 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = > operand2 = Empty sequence . */ @org.junit.Test public void generalexpression397() { final XQuery query = new XQuery( "() > ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = > operand2 = Atomic Value . */ @org.junit.Test public void generalexpression398() { final XQuery query = new XQuery( "() > 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = > operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression399() { final XQuery query = new XQuery( "() > (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = > operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression400() { final XQuery query = new XQuery( "() > (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = > operand2 = Element Constructor . */ @org.junit.Test public void generalexpression401() { final XQuery query = new XQuery( "() > 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = > operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression402() { final XQuery query = new XQuery( "() > (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = > operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression403() { final XQuery query = new XQuery( "() > (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = > operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression404() { final XQuery query = new XQuery( "() > (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = > operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression405() { final XQuery query = new XQuery( "() > (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = > operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression406() { final XQuery query = new XQuery( "() > ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = > operand2 = Empty sequence . */ @org.junit.Test public void generalexpression407() { final XQuery query = new XQuery( "10000 > ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = > operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression408() { final XQuery query = new XQuery( "10000 > (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = > operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression409() { final XQuery query = new XQuery( "10000 > (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = > operand2 = Element Constructor . */ @org.junit.Test public void generalexpression410() { final XQuery query = new XQuery( "10000 > 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = > operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression411() { final XQuery query = new XQuery( "10000 > (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = > operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression412() { final XQuery query = new XQuery( "10000 > (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = > operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression413() { final XQuery query = new XQuery( "10000 > (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = > operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression414() { final XQuery query = new XQuery( "10000 > (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = > operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression415() { final XQuery query = new XQuery( "10000 > ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = > operand2 = Empty sequence . */ @org.junit.Test public void generalexpression416() { final XQuery query = new XQuery( "(50000) > ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = > operand2 = Atomic Value . */ @org.junit.Test public void generalexpression417() { final XQuery query = new XQuery( "(50000) > 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = > operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression418() { final XQuery query = new XQuery( "(50000) > (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = > operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression419() { final XQuery query = new XQuery( "(50000) > (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = > operand2 = Element Constructor . */ @org.junit.Test public void generalexpression420() { final XQuery query = new XQuery( "(50000) > 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = > operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression421() { final XQuery query = new XQuery( "(50000) > (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = > operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression422() { final XQuery query = new XQuery( "(50000) > (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = > operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression423() { final XQuery query = new XQuery( "(50000) > (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = > operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression424() { final XQuery query = new XQuery( "(50000) > (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = > operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression425() { final XQuery query = new XQuery( "(50000) > ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = > operand2 = Empty sequence . */ @org.junit.Test public void generalexpression426() { final XQuery query = new XQuery( "(10000,50000) > ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = > operand2 = Atomic Value . */ @org.junit.Test public void generalexpression427() { final XQuery query = new XQuery( "(10000,50000) > 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = > operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression428() { final XQuery query = new XQuery( "(10000,50000) > (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = > operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression429() { final XQuery query = new XQuery( "(10000,50000) > (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = > operand2 = Element Constructor . */ @org.junit.Test public void generalexpression430() { final XQuery query = new XQuery( "(10000,50000) > 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = > operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression431() { final XQuery query = new XQuery( "(10000,50000) > (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = > operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression432() { final XQuery query = new XQuery( "(10000,50000) > (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = > operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression433() { final XQuery query = new XQuery( "(10000,50000) > (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = > operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression434() { final XQuery query = new XQuery( "(10000,50000) > (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = > operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression435() { final XQuery query = new XQuery( "(10000,50000) > ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = > operand2 = Empty sequence . */ @org.junit.Test public void generalexpression436() { final XQuery query = new XQuery( "10000 > ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = > operand2 = Atomic Value . */ @org.junit.Test public void generalexpression437() { final XQuery query = new XQuery( "10000 > 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = > operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression438() { final XQuery query = new XQuery( "10000 > (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = > operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression439() { final XQuery query = new XQuery( "10000 > (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = > operand2 = Element Constructor . */ @org.junit.Test public void generalexpression440() { final XQuery query = new XQuery( "10000 > 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = > operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression441() { final XQuery query = new XQuery( "10000 > (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = > operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression442() { final XQuery query = new XQuery( "10000 > (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = > operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression443() { final XQuery query = new XQuery( "10000 > (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = > operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression444() { final XQuery query = new XQuery( "10000 > (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = > operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression445() { final XQuery query = new XQuery( "10000 > ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = > operand2 = Empty sequence . */ @org.junit.Test public void generalexpression446() { final XQuery query = new XQuery( "(10000) > ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = > operand2 = Atomic Value . */ @org.junit.Test public void generalexpression447() { final XQuery query = new XQuery( "(10000) > 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = > operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression448() { final XQuery query = new XQuery( "(10000) > (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = > operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression449() { final XQuery query = new XQuery( "(10000) > (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = > operand2 = Element Constructor . */ @org.junit.Test public void generalexpression450() { final XQuery query = new XQuery( "(10000) > 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = > operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression451() { final XQuery query = new XQuery( "(10000) > (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = > operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression452() { final XQuery query = new XQuery( "(10000) > (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = > operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression453() { final XQuery query = new XQuery( "(10000) > (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = > operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression454() { final XQuery query = new XQuery( "(10000) > (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = > operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression455() { final XQuery query = new XQuery( "(10000) > ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = > operand2 = Empty sequence . */ @org.junit.Test public void generalexpression456() { final XQuery query = new XQuery( "(10000,50000) > ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = > operand2 = Atomic Value . */ @org.junit.Test public void generalexpression457() { final XQuery query = new XQuery( "(10000,50000) > 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = > operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression458() { final XQuery query = new XQuery( "(10000,50000) > (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = > operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression459() { final XQuery query = new XQuery( "(10000,50000) > (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = > operand2 = Element Constructor . */ @org.junit.Test public void generalexpression460() { final XQuery query = new XQuery( "(10000,50000) > 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = > operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression461() { final XQuery query = new XQuery( "(10000,50000) > (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = > operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression462() { final XQuery query = new XQuery( "(10000,50000) > (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = > operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression463() { final XQuery query = new XQuery( "(10000,50000) > (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = > operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression464() { final XQuery query = new XQuery( "(10000,50000) > (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = > operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression465() { final XQuery query = new XQuery( "(10000,50000) > ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = > operand2 = Empty sequence . */ @org.junit.Test public void generalexpression466() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) > ()", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = > operand2 = Atomic Value . */ @org.junit.Test public void generalexpression467() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) > 10000", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = > operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression468() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) > (50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = > operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression469() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) > (10000,50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = > operand2 = Element Constructor . */ @org.junit.Test public void generalexpression470() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) > 10000", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = > operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression471() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) > (10000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = > operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression472() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) > (10000,50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = > operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression473() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) > (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = > operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression474() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) > (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = > operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression475() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1]) > ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = > operand2 = Empty sequence . */ @org.junit.Test public void generalexpression476() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) > ()", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = > operand2 = Atomic Value . */ @org.junit.Test public void generalexpression477() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) > 10000", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = > operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression478() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) > (50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = > operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression479() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) > (10000,50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = > operand2 = Element Constructor . */ @org.junit.Test public void generalexpression480() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) > 10000", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = > operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression481() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) > (10000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = > operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression482() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) > (10000,50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = > operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression483() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) > (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = > operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression484() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) > (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = > operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression485() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$works/works/employee[6]/hours[1]) > ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = > operand2 = Empty sequence . */ @org.junit.Test public void generalexpression486() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) > ()", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = > operand2 = Atomic Value . */ @org.junit.Test public void generalexpression487() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) > 10000", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = > operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression488() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) > (50000)", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = > operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression489() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) > (10000,50000)", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = > operand2 = Element Constructor . */ @org.junit.Test public void generalexpression490() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) > 10000", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = > operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression491() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) > (10000)", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = > operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression492() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) > (10000,50000)", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = > operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression493() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) > ($works/works/employee[1]/hours[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = > operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression494() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) > ($works/works/employee[1]/hours[1],$works/works/employee[6]/hours[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test - greaterthanonanyuri-1 Evaluation of "gt" operator on xs:anyURI datatype. . */ @org.junit.Test public void greaterthanonanyuri1() { final XQuery query = new XQuery( "(xs:anyURI(\"http://www.example/com\")) > (xs:anyURI(\"http://www.example/com\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdGeneralCompLe.java000066400000000000000000001761551222453003200306310ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the GeneralComp.le production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdGeneralCompLe extends QT3TestSet { /** * General comparison where one or more operands is the empty sequence. . */ @org.junit.Test public void kGenCompLTEQ1() { final XQuery query = new XQuery( "not(() <= () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where one or more operands is the empty sequence. . */ @org.junit.Test public void kGenCompLTEQ2() { final XQuery query = new XQuery( "not(1 <= () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where one or more operands is the empty sequence. . */ @org.junit.Test public void kGenCompLTEQ3() { final XQuery query = new XQuery( "not(() <= 1 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompLTEQ4() { final XQuery query = new XQuery( "1 <= 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing a xs:untypedAtomic value to be cast to xs:boolean, and then compared. . */ @org.junit.Test public void kGenCompLTEQ5() { final XQuery query = new XQuery( "xs:untypedAtomic(\"false\") <= false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing a xs:untypedAtomic value to be cast to xs:boolean, and then compared. . */ @org.junit.Test public void kGenCompLTEQ6() { final XQuery query = new XQuery( "false() <= xs:untypedAtomic(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing a xs:untypedAtomic value to be cast to xs:boolean, and then compared. . */ @org.junit.Test public void kGenCompLTEQ7() { final XQuery query = new XQuery( "xs:untypedAtomic(\"false\") <= false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing a xs:untypedAtomic value to be cast to xs:boolean, and then compared. . */ @org.junit.Test public void kGenCompLTEQ8() { final XQuery query = new XQuery( "true() <= xs:untypedAtomic(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = <= operand2 = Empty sequence . */ @org.junit.Test public void generalexpression298() { final XQuery query = new XQuery( "() <= ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = <= operand2 = Atomic Value . */ @org.junit.Test public void generalexpression299() { final XQuery query = new XQuery( "() <= 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = <= operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression300() { final XQuery query = new XQuery( "() <= (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = <= operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression301() { final XQuery query = new XQuery( "() <= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = <= operand2 = Element Constructor . */ @org.junit.Test public void generalexpression302() { final XQuery query = new XQuery( "() <= 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = <= operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression303() { final XQuery query = new XQuery( "() <= (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = <= operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression304() { final XQuery query = new XQuery( "() <= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = <= operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression305() { final XQuery query = new XQuery( "() <= (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = <= operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression306() { final XQuery query = new XQuery( "() <= (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = <= operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression307() { final XQuery query = new XQuery( "() <= ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = <= operand2 = Empty sequence . */ @org.junit.Test public void generalexpression308() { final XQuery query = new XQuery( "10000 <= ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = <= operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression309() { final XQuery query = new XQuery( "10000 <= (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = <= operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression310() { final XQuery query = new XQuery( "10000 <= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = <= operand2 = Element Constructor . */ @org.junit.Test public void generalexpression311() { final XQuery query = new XQuery( "10000 <= 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = <= operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression312() { final XQuery query = new XQuery( "10000 <= (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = <= operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression313() { final XQuery query = new XQuery( "10000 <= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = <= operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression314() { final XQuery query = new XQuery( "10000 <= (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = <= operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression315() { final XQuery query = new XQuery( "10000 <= (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = <= operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression316() { final XQuery query = new XQuery( "10000 <= ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = <= operand2 = Empty sequence . */ @org.junit.Test public void generalexpression317() { final XQuery query = new XQuery( "(50000) <= ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = <= operand2 = Atomic Value . */ @org.junit.Test public void generalexpression318() { final XQuery query = new XQuery( "(50000) <= 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = <= operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression319() { final XQuery query = new XQuery( "(50000) <= (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = <= operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression320() { final XQuery query = new XQuery( "(50000) <= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = <= operand2 = Element Constructor . */ @org.junit.Test public void generalexpression321() { final XQuery query = new XQuery( "(50000) <= 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = <= operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression322() { final XQuery query = new XQuery( "(50000) <= (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = <= operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression323() { final XQuery query = new XQuery( "(50000) <= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = <= operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression324() { final XQuery query = new XQuery( "(50000) <= (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = <= operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression325() { final XQuery query = new XQuery( "(50000) <= (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = <= operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression326() { final XQuery query = new XQuery( "(50000) <= ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = <= operand2 = Empty sequence . */ @org.junit.Test public void generalexpression327() { final XQuery query = new XQuery( "(10000,50000) <= ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = <= operand2 = Atomic Value . */ @org.junit.Test public void generalexpression328() { final XQuery query = new XQuery( "(10000,50000) <= 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = <= operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression329() { final XQuery query = new XQuery( "(10000,50000) <= (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = <= operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression330() { final XQuery query = new XQuery( "(10000,50000) <= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = <= operand2 = Element Constructor . */ @org.junit.Test public void generalexpression331() { final XQuery query = new XQuery( "(10000,50000) <= 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = <= operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression332() { final XQuery query = new XQuery( "(10000,50000) <= (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = <= operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression333() { final XQuery query = new XQuery( "(10000,50000) <= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = <= operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression334() { final XQuery query = new XQuery( "(10000,50000) <= (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = <= operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression335() { final XQuery query = new XQuery( "(10000,50000) <= (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = <= operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression336() { final XQuery query = new XQuery( "(10000,50000) <= ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = <= operand2 = Empty sequence . */ @org.junit.Test public void generalexpression337() { final XQuery query = new XQuery( "10000 <= ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = <= operand2 = Atomic Value . */ @org.junit.Test public void generalexpression338() { final XQuery query = new XQuery( "10000 <= 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = <= operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression339() { final XQuery query = new XQuery( "10000 <= (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = <= operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression340() { final XQuery query = new XQuery( "10000 <= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = <= operand2 = Element Constructor . */ @org.junit.Test public void generalexpression341() { final XQuery query = new XQuery( "10000 <= 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = <= operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression342() { final XQuery query = new XQuery( "10000 <= (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = <= operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression343() { final XQuery query = new XQuery( "10000 <= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = <= operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression344() { final XQuery query = new XQuery( "10000 <= (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = <= operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression345() { final XQuery query = new XQuery( "10000 <= (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = <= operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression346() { final XQuery query = new XQuery( "10000 <= ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = <= operand2 = Empty sequence . */ @org.junit.Test public void generalexpression347() { final XQuery query = new XQuery( "(10000) <= ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = <= operand2 = Atomic Value . */ @org.junit.Test public void generalexpression348() { final XQuery query = new XQuery( "(10000) <= 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = <= operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression349() { final XQuery query = new XQuery( "(10000) <= (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = <= operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression350() { final XQuery query = new XQuery( "(10000) <= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = <= operand2 = Element Constructor . */ @org.junit.Test public void generalexpression351() { final XQuery query = new XQuery( "(10000) <= 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = <= operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression352() { final XQuery query = new XQuery( "(10000) <= (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = <= operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression353() { final XQuery query = new XQuery( "(10000) <= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = <= operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression354() { final XQuery query = new XQuery( "(10000) <= (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = <= operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression355() { final XQuery query = new XQuery( "(10000) <= (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = <= operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression356() { final XQuery query = new XQuery( "(10000) <= ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = <= operand2 = Empty sequence . */ @org.junit.Test public void generalexpression357() { final XQuery query = new XQuery( "(10000,50000) <= ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = <= operand2 = Atomic Value . */ @org.junit.Test public void generalexpression358() { final XQuery query = new XQuery( "(10000,50000) <= 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = <= operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression359() { final XQuery query = new XQuery( "(10000,50000) <= (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = <= operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression360() { final XQuery query = new XQuery( "(10000,50000) <= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = <= operand2 = Element Constructor . */ @org.junit.Test public void generalexpression361() { final XQuery query = new XQuery( "(10000,50000) <= 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = <= operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression362() { final XQuery query = new XQuery( "(10000,50000) <= (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = <= operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression363() { final XQuery query = new XQuery( "(10000,50000) <= (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = <= operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression364() { final XQuery query = new XQuery( "(10000,50000) <= (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = <= operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression365() { final XQuery query = new XQuery( "(10000,50000) <= (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = <= operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression366() { final XQuery query = new XQuery( "(10000,50000) <= ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = <= operand2 = Empty sequence . */ @org.junit.Test public void generalexpression367() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) <= ()", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = <= operand2 = Atomic Value . */ @org.junit.Test public void generalexpression368() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) <= 10000", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = <= operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression369() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) <= (50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = <= operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression370() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) <= (10000,50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = <= operand2 = Element Constructor . */ @org.junit.Test public void generalexpression371() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) <= 10000", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = <= operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression372() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) <= (10000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = <= operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression373() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) <= (10000,50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = <= operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression374() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) <= (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = <= operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression375() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) <= (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = <= operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression376() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1]) <= ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = <= operand2 = Empty sequence . */ @org.junit.Test public void generalexpression377() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) <= ()", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = <= operand2 = Atomic Value . */ @org.junit.Test public void generalexpression378() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) <= 10000", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = <= operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression379() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) <= (50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = <= operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression380() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) <= (10000,50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = <= operand2 = Element Constructor . */ @org.junit.Test public void generalexpression381() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) <= 10000", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = <= operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression382() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) <= (10000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = <= operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression383() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) <= (10000,50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = <= operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression384() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) <= (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = <= operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression385() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) <= (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = <= operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression386() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$works/works/employee[6]/hours[1]) <= ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = <= operand2 = Empty sequence . */ @org.junit.Test public void generalexpression387() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) <= ()", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = <= operand2 = Atomic Value . */ @org.junit.Test public void generalexpression388() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) <= 10000", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = <= operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression389() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) <= (50000)", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = <= operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression390() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) <= (10000,50000)", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = <= operand2 = Element Constructor . */ @org.junit.Test public void generalexpression391() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) <= 10000", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = <= operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression392() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) <= (10000)", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = <= operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression393() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) <= (10000,50000)", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = <= operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression394() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) <= ($works/works/employee[1]/hours[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = <= operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression395() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) <= ($works/works/employee[1]/hours[1],$works/works/employee[6]/hours[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = <= operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression396() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) <= ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test - lessthaneqonanyuri-1 Evaluation of "le" operator on xs:anyURI datatype. . */ @org.junit.Test public void lessthaneqonanyuri1() { final XQuery query = new XQuery( "(xs:anyURI(\"http://www.example/com\")) <= (xs:anyURI(\"http://www.example/com\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdGeneralCompLt.java000066400000000000000000002170661222453003200306450ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the GeneralComp.lt production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdGeneralCompLt extends QT3TestSet { /** * General comparison where one or more operands is the empty sequence. . */ @org.junit.Test public void kGenCompLT1() { final XQuery query = new XQuery( "not(() < () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompLT10() { final XQuery query = new XQuery( "0 < (1, 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompLT11() { final XQuery query = new XQuery( "1 < 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing a xs:untypedAtomic value to be cast to xs:boolean, and then compared. . */ @org.junit.Test public void kGenCompLT12() { final XQuery query = new XQuery( "xs:untypedAtomic(\"false\") < true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing a xs:untypedAtomic value to be cast to xs:boolean, and then compared. . */ @org.junit.Test public void kGenCompLT13() { final XQuery query = new XQuery( "false() < xs:untypedAtomic(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing a xs:untypedAtomic value to be cast to xs:boolean, and then compared. . */ @org.junit.Test public void kGenCompLT14() { final XQuery query = new XQuery( "not(xs:untypedAtomic(\"true\") < false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing a xs:untypedAtomic value to be cast to xs:boolean, and then compared. . */ @org.junit.Test public void kGenCompLT15() { final XQuery query = new XQuery( "not(true() < xs:untypedAtomic(\"false\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompLT16() { final XQuery query = new XQuery( "1 < xs:anyURI(\"0\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompLT17() { final XQuery query = new XQuery( "xs:anyURI(\"0\") < 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * <= combined with count(). . */ @org.junit.Test public void kGenCompLT18() { final XQuery query = new XQuery( "1 <= count((1, 2, 3, timezone-from-time(current-time()), 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * < combined with count(). . */ @org.junit.Test public void kGenCompLT19() { final XQuery query = new XQuery( "0 < count((1, 2, 3, timezone-from-time(current-time()), 4))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where one or more operands is the empty sequence. . */ @org.junit.Test public void kGenCompLT2() { final XQuery query = new XQuery( "not(1 < () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where one or more operands is the empty sequence. . */ @org.junit.Test public void kGenCompLT3() { final XQuery query = new XQuery( "not(() < 1 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A syntactically invalid expression that reminds of a general comparison operator. . */ @org.junit.Test public void kGenCompLT4() { final XQuery query = new XQuery( "1 =< 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompLT5() { final XQuery query = new XQuery( "(1, 2, 3) < 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompLT6() { final XQuery query = new XQuery( "(1, 2, 3) < 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompLT7() { final XQuery query = new XQuery( "(1, 2, 3) < 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompLT8() { final XQuery query = new XQuery( "1 < (1, 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompLT9() { final XQuery query = new XQuery( "2 < (1, 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Do a comparison that requires conversion via element()->xs:untypedAtomic->xs:double(LHS), triggered by xs:integer. . */ @org.junit.Test public void k2GenCompLT1() { final XQuery query = new XQuery( "1.1 < 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Do a comparison that requires conversion via element()->xs:untypedAtomic->xs:double(RHS), triggered by xs:integer. . */ @org.junit.Test public void k2GenCompLT2() { final XQuery query = new XQuery( "3. < 1.1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Do a comparison that requires conversion via element()->xs:untypedAtomic->xs:double(LHS), triggered by xs:integer. . */ @org.junit.Test public void k2GenCompLT3() { final XQuery query = new XQuery( "1.1 < 3.", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Do a comparison that requires conversion via element()->xs:untypedAtomic->xs:double(RHS), triggered by xs:integer. . */ @org.junit.Test public void k2GenCompLT4() { final XQuery query = new XQuery( "3 < 1.1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Do a comparison that requires conversion via element()->xs:untypedAtomic->xs:double(LHS), triggered by xs:double. . */ @org.junit.Test public void k2GenCompLT5() { final XQuery query = new XQuery( "1.1 < 3e3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Do a comparison that requires conversion via element()->xs:untypedAtomic->xs:double(RHS), triggered by xs:double. . */ @org.junit.Test public void k2GenCompLT6() { final XQuery query = new XQuery( "3e3 < 1.1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Do a comparison that requires conversion via element()->xs:untypedAtomic->xs:double(LHS), triggered by xs:double. . */ @org.junit.Test public void k2GenCompLT7() { final XQuery query = new XQuery( "1.1 < xs:float(3e3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Do a comparison that requires conversion via element()->xs:untypedAtomic->xs:double(RHS), triggered by xs:double. . */ @org.junit.Test public void k2GenCompLT8() { final XQuery query = new XQuery( "xs:float(3e3) < 1.1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = < operand2 = Empty sequence . */ @org.junit.Test public void generalexpression199() { final XQuery query = new XQuery( "() < ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = < operand2 = Atomic Value . */ @org.junit.Test public void generalexpression200() { final XQuery query = new XQuery( "() < 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = < operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression201() { final XQuery query = new XQuery( "() < (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = < operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression202() { final XQuery query = new XQuery( "() < (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = < operand2 = Element Constructor . */ @org.junit.Test public void generalexpression203() { final XQuery query = new XQuery( "() < 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = < operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression204() { final XQuery query = new XQuery( "() < (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = < operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression205() { final XQuery query = new XQuery( "() < (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = < operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression206() { final XQuery query = new XQuery( "() < (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = < operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression207() { final XQuery query = new XQuery( "() < (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = < operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression208() { final XQuery query = new XQuery( "\n" + " () < ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = < operand2 = Empty sequence . */ @org.junit.Test public void generalexpression209() { final XQuery query = new XQuery( "10000 < ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = < operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression210() { final XQuery query = new XQuery( "10000 < (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = < operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression211() { final XQuery query = new XQuery( "10000 < (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = < operand2 = Element Constructor . */ @org.junit.Test public void generalexpression212() { final XQuery query = new XQuery( "10000 < 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = < operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression213() { final XQuery query = new XQuery( "10000 < (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = < operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression214() { final XQuery query = new XQuery( "10000 < (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = < operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression215() { final XQuery query = new XQuery( "10000 < (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = < operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression216() { final XQuery query = new XQuery( "10000 < (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = < operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression217() { final XQuery query = new XQuery( "\n" + " 10000 < ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = < operand2 = Empty sequence . */ @org.junit.Test public void generalexpression218() { final XQuery query = new XQuery( "(50000) < ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = < operand2 = Atomic Value . */ @org.junit.Test public void generalexpression219() { final XQuery query = new XQuery( "(50000) < 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = < operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression220() { final XQuery query = new XQuery( "(50000) < (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = < operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression221() { final XQuery query = new XQuery( "(50000) < (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = < operand2 = Element Constructor . */ @org.junit.Test public void generalexpression222() { final XQuery query = new XQuery( "(50000) < 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = < operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression223() { final XQuery query = new XQuery( "(50000) < (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = < operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression224() { final XQuery query = new XQuery( "(50000) < (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = < operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression225() { final XQuery query = new XQuery( "(50000) < (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = < operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression226() { final XQuery query = new XQuery( "(50000) < (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = < operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression227() { final XQuery query = new XQuery( "\n" + " (50000) < ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = < operand2 = Empty sequence . */ @org.junit.Test public void generalexpression228() { final XQuery query = new XQuery( "(10000,50000) < ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = < operand2 = Atomic Value . */ @org.junit.Test public void generalexpression229() { final XQuery query = new XQuery( "(10000,50000) < 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = < operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression230() { final XQuery query = new XQuery( "(10000,50000) < (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = < operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression231() { final XQuery query = new XQuery( "(10000,50000) < (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = < operand2 = Element Constructor . */ @org.junit.Test public void generalexpression232() { final XQuery query = new XQuery( "(10000,50000) < 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = < operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression233() { final XQuery query = new XQuery( "(10000,50000) < (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = < operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression234() { final XQuery query = new XQuery( "(10000,50000) < (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = < operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression235() { final XQuery query = new XQuery( "(10000,50000) < (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = < operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression236() { final XQuery query = new XQuery( "(10000,50000) < (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = < operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression237() { final XQuery query = new XQuery( "\n" + " (10000,50000) < ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = < operand2 = Empty sequence . */ @org.junit.Test public void generalexpression238() { final XQuery query = new XQuery( "10000 < ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = < operand2 = Atomic Value . */ @org.junit.Test public void generalexpression239() { final XQuery query = new XQuery( "10000 < 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = < operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression240() { final XQuery query = new XQuery( "10000 < (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = < operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression241() { final XQuery query = new XQuery( "10000 < (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = < operand2 = Element Constructor . */ @org.junit.Test public void generalexpression242() { final XQuery query = new XQuery( "10000 < 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = < operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression243() { final XQuery query = new XQuery( "10000 < (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = < operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression244() { final XQuery query = new XQuery( "10000 < (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = < operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression245() { final XQuery query = new XQuery( "10000 < (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = < operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression246() { final XQuery query = new XQuery( "10000 < (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = < operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression247() { final XQuery query = new XQuery( "\n" + " 10000 < ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = < operand2 = Empty sequence . */ @org.junit.Test public void generalexpression248() { final XQuery query = new XQuery( "(10000) < ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = < operand2 = Atomic Value . */ @org.junit.Test public void generalexpression249() { final XQuery query = new XQuery( "(10000) < 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = < operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression250() { final XQuery query = new XQuery( "(10000) < (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = < operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression251() { final XQuery query = new XQuery( "(10000) < (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = < operand2 = Element Constructor . */ @org.junit.Test public void generalexpression252() { final XQuery query = new XQuery( "(10000) < 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = < operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression253() { final XQuery query = new XQuery( "(10000) < (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = < operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression254() { final XQuery query = new XQuery( "(10000) < (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = < operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression255() { final XQuery query = new XQuery( "(10000) < (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = < operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression256() { final XQuery query = new XQuery( "(10000) < (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = < operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression257() { final XQuery query = new XQuery( "\n" + " (10000) < ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = < operand2 = Empty sequence . */ @org.junit.Test public void generalexpression258() { final XQuery query = new XQuery( "(10000,50000) < ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = < operand2 = Atomic Value . */ @org.junit.Test public void generalexpression259() { final XQuery query = new XQuery( "(10000,50000) < 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = < operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression260() { final XQuery query = new XQuery( "(10000,50000) < (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = < operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression261() { final XQuery query = new XQuery( "(10000,50000) < (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = < operand2 = Element Constructor . */ @org.junit.Test public void generalexpression262() { final XQuery query = new XQuery( "(10000,50000) < 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = < operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression263() { final XQuery query = new XQuery( "(10000,50000) < (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = < operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression264() { final XQuery query = new XQuery( "(10000,50000) < (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = < operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression265() { final XQuery query = new XQuery( "(10000,50000) < (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = < operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression266() { final XQuery query = new XQuery( "(10000,50000) < (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = < operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression267() { final XQuery query = new XQuery( "(\n" + " 10000,50000) < ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = < operand2 = Empty sequence . */ @org.junit.Test public void generalexpression268() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) < ()", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = < operand2 = Atomic Value . */ @org.junit.Test public void generalexpression269() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) < 10000", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = < operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression270() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) < (50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = < operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression271() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) < (10000,50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = < operand2 = Element Constructor . */ @org.junit.Test public void generalexpression272() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) < 10000", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = < operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression273() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) < (10000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = < operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression274() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) < (10000,50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = < operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression275() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) < (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = < operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression276() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) < (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = < operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression277() { final XQuery query = new XQuery( "\n" + " ($works/works/employee[1]/hours[1]) < ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = < operand2 = Empty sequence . */ @org.junit.Test public void generalexpression278() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) < ()", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = < operand2 = Atomic Value . */ @org.junit.Test public void generalexpression279() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) < 10000", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = < operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression280() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) < (50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = < operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression281() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) < (10000,50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = < operand2 = Element Constructor . */ @org.junit.Test public void generalexpression282() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) < 10000", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = < operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression283() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) < (10000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = < operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression284() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) < (10000,50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = < operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression285() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) < (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = < operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression286() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) < (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = < operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression287() { final XQuery query = new XQuery( "\n" + " ($works/works/employee[1]/hours[1],$works/works/employee[6]/hours[1]) < ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = < operand2 = Empty sequence . */ @org.junit.Test public void generalexpression288() { final XQuery query = new XQuery( "\n" + " ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) < ()", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = < operand2 = Atomic Value . */ @org.junit.Test public void generalexpression289() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) < 10000", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = < operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression290() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) < (50000)", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = < operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression291() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) < (10000,50000)", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = < operand2 = Element Constructor . */ @org.junit.Test public void generalexpression292() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) < 10000", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = < operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression293() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) < (10000)", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = < operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression294() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) < (10000,50000)", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = < operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression295() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) < ($works/works/employee[1]/hours[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = < operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression296() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) < ($works/works/employee[1]/hours[1],$works/works/employee[6]/hours[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = < operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression297() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) < ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test - lessthanonanyuri-1 Evaluation of "lt" operator on xs:anyURI datatype. . */ @org.junit.Test public void lessthanonanyuri1() { final XQuery query = new XQuery( "(xs:anyURI(\"http://www.example/com\")) < (xs:anyURI(\"http://www.example/com\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdGeneralCompNe.java000066400000000000000000002316641222453003200306300ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the GeneralComp.ne production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdGeneralCompNe extends QT3TestSet { /** * General comparison where one or more operands is the empty sequence. . */ @org.junit.Test public void kGenCompNE1() { final XQuery query = new XQuery( "(() != ()) eq false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing numeric promotion from xs:untypedAtomic. . */ @org.junit.Test public void kGenCompNE10() { final XQuery query = new XQuery( "not(\"2\" = xs:untypedAtomic(\"1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing numeric promotion from xs:untypedAtomic. . */ @org.junit.Test public void kGenCompNE11() { final XQuery query = new XQuery( "2 != xs:untypedAtomic(\"1\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing numeric promotion from xs:untypedAtomic. . */ @org.junit.Test public void kGenCompNE12() { final XQuery query = new XQuery( "not(1 != xs:untypedAtomic(\"1\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An expression involving the '!=' operator that trigger certain optimization paths in some implementations. . */ @org.junit.Test public void kGenCompNE13() { final XQuery query = new XQuery( "count((0, timezone-from-time(current-time()))) != 0", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison involving xs:untypedAtomic/xs:string. . */ @org.junit.Test public void kGenCompNE14() { final XQuery query = new XQuery( "\"a string\" != \"a stringDIFF\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison involving xs:untypedAtomic/xs:string. . */ @org.junit.Test public void kGenCompNE15() { final XQuery query = new XQuery( "not(\"a string\" != \"a string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison involving xs:untypedAtomic/xs:string. . */ @org.junit.Test public void kGenCompNE16() { final XQuery query = new XQuery( "xs:untypedAtomic(\"a string\") != \"a stringDIFF\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison involving xs:untypedAtomic/xs:string. . */ @org.junit.Test public void kGenCompNE17() { final XQuery query = new XQuery( "\"a string\" != xs:untypedAtomic(\"a stringDIFF\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison involving xs:untypedAtomic/xs:string. . */ @org.junit.Test public void kGenCompNE18() { final XQuery query = new XQuery( "not(\"a string\" != xs:untypedAtomic(\"a string\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison involving xs:untypedAtomic/xs:string. . */ @org.junit.Test public void kGenCompNE19() { final XQuery query = new XQuery( "not(xs:untypedAtomic(\"a string\") != \"a string\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where one or more operands is the empty sequence. . */ @org.junit.Test public void kGenCompNE2() { final XQuery query = new XQuery( "not(() = 1 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing a xs:untypedAtomic value to be cast to xs:boolean, and then compared. . */ @org.junit.Test public void kGenCompNE20() { final XQuery query = new XQuery( "xs:untypedAtomic(\"true\") != false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing a xs:untypedAtomic value to be cast to xs:boolean, and then compared. . */ @org.junit.Test public void kGenCompNE21() { final XQuery query = new XQuery( "false() != xs:untypedAtomic(\"true\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing a xs:untypedAtomic value to be cast to xs:boolean, and then compared. . */ @org.junit.Test public void kGenCompNE22() { final XQuery query = new XQuery( "not(xs:untypedAtomic(\"false\") != false())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing a xs:untypedAtomic value to be cast to xs:boolean, and then compared. . */ @org.junit.Test public void kGenCompNE23() { final XQuery query = new XQuery( "not(false() != xs:untypedAtomic(\"false\"))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompNE24() { final XQuery query = new XQuery( "(1, 2, 3) != 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompNE25() { final XQuery query = new XQuery( "(1, 2, 3) != 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompNE26() { final XQuery query = new XQuery( "(1, 2, 3) != 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompNE27() { final XQuery query = new XQuery( "1 != 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompNE28() { final XQuery query = new XQuery( "1 != (1, 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompNE29() { final XQuery query = new XQuery( "2 != (1, 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where one or more operands is the empty sequence. . */ @org.junit.Test public void kGenCompNE3() { final XQuery query = new XQuery( "not(() != () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison where the operands are various various sequence of xs:integers. . */ @org.junit.Test public void kGenCompNE30() { final XQuery query = new XQuery( "3 != (1, 2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompNE31() { final XQuery query = new XQuery( "xs:untypedAtomic(\"three\") != 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompNE32() { final XQuery query = new XQuery( "3 != xs:untypedAtomic(\"three\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompNE33() { final XQuery query = new XQuery( "\"2\" != 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompNE34() { final XQuery query = new XQuery( "1 != \"2\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompNE35() { final XQuery query = new XQuery( "xs:untypedAtomic(\"falseERR\") != false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompNE36() { final XQuery query = new XQuery( "1 != \"1\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompNE37() { final XQuery query = new XQuery( "xs:string(\"false\") != false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompNE38() { final XQuery query = new XQuery( "false() != xs:string(\"false\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompNE39() { final XQuery query = new XQuery( "false() != xs:untypedAtomic(\"falseERR\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0001") ); } /** * General comparison where one or more operands is the empty sequence. . */ @org.junit.Test public void kGenCompNE4() { final XQuery query = new XQuery( "not(1 != () )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompNE40() { final XQuery query = new XQuery( "false() != xs:anyURI(\"example.com/\")", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * General comparison which fails due to invalid operator combination or casting. . */ @org.junit.Test public void kGenCompNE41() { final XQuery query = new XQuery( "xs:anyURI(\"example.com/\") != false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * General comparison where one or more operands is the empty sequence. . */ @org.junit.Test public void kGenCompNE5() { final XQuery query = new XQuery( "not(() != 1 )", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A syntactically invalid expression that reminds of a general comparison operator. . */ @org.junit.Test public void kGenCompNE6() { final XQuery query = new XQuery( "1 !! 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Example from the XPath 2.0 specification. . */ @org.junit.Test public void kGenCompNE7() { final XQuery query = new XQuery( "(1, 2) != (2, 3)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing numeric promotion from xs:untypedAtomic. . */ @org.junit.Test public void kGenCompNE8() { final XQuery query = new XQuery( "xs:untypedAtomic(\"2\") != 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * General comparison causing numeric promotion from xs:untypedAtomic. . */ @org.junit.Test public void kGenCompNE9() { final XQuery query = new XQuery( "not(xs:untypedAtomic(\"1\") != 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = != operand2 = Empty sequence . */ @org.junit.Test public void generalexpression100() { final XQuery query = new XQuery( "() != ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = != operand2 = Atomic Value . */ @org.junit.Test public void generalexpression101() { final XQuery query = new XQuery( "() != 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = != operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression102() { final XQuery query = new XQuery( "() != (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = != operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression103() { final XQuery query = new XQuery( "() != (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = != operand2 = Element Constructor . */ @org.junit.Test public void generalexpression104() { final XQuery query = new XQuery( "() != 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = != operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression105() { final XQuery query = new XQuery( "() != (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = != operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression106() { final XQuery query = new XQuery( "() != (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = != operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression107() { final XQuery query = new XQuery( "() != (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = != operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression108() { final XQuery query = new XQuery( "() != (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Empty sequence operator = != operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression109() { final XQuery query = new XQuery( "() != ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = != operand2 = Empty sequence . */ @org.junit.Test public void generalexpression110() { final XQuery query = new XQuery( "10000 != ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = != operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression111() { final XQuery query = new XQuery( "10000 != (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = != operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression112() { final XQuery query = new XQuery( "10000 != (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = != operand2 = Element Constructor . */ @org.junit.Test public void generalexpression113() { final XQuery query = new XQuery( "10000 != 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = != operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression114() { final XQuery query = new XQuery( "10000 != (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = != operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression115() { final XQuery query = new XQuery( "10000 != (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = != operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression116() { final XQuery query = new XQuery( "10000 != (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = != operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression117() { final XQuery query = new XQuery( "10000 != (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Atomic Value operator = != operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression118() { final XQuery query = new XQuery( "10000 != ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = != operand2 = Empty sequence . */ @org.junit.Test public void generalexpression119() { final XQuery query = new XQuery( "(50000) != ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = != operand2 = Atomic Value . */ @org.junit.Test public void generalexpression120() { final XQuery query = new XQuery( "(50000) != 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = != operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression121() { final XQuery query = new XQuery( "(50000) != (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = != operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression122() { final XQuery query = new XQuery( "(50000) != (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = != operand2 = Element Constructor . */ @org.junit.Test public void generalexpression123() { final XQuery query = new XQuery( "(50000) != 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = != operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression124() { final XQuery query = new XQuery( "(50000) != (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = != operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression125() { final XQuery query = new XQuery( "(50000) != (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = != operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression126() { final XQuery query = new XQuery( "(50000) != (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = != operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression127() { final XQuery query = new XQuery( "(50000) != (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic value operator = != operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression128() { final XQuery query = new XQuery( "(50000) != ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = != operand2 = Empty sequence . */ @org.junit.Test public void generalexpression129() { final XQuery query = new XQuery( "(10000,50000) != ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = != operand2 = Atomic Value . */ @org.junit.Test public void generalexpression130() { final XQuery query = new XQuery( "(10000,50000) != 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = != operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression131() { final XQuery query = new XQuery( "(10000,50000) != (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = != operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression132() { final XQuery query = new XQuery( "(10000,50000) != (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = != operand2 = Element Constructor . */ @org.junit.Test public void generalexpression133() { final XQuery query = new XQuery( "(10000,50000) != 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = != operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression134() { final XQuery query = new XQuery( "(10000,50000) != (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = != operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression135() { final XQuery query = new XQuery( "(10000,50000) != (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = != operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression136() { final XQuery query = new XQuery( "(10000,50000) != (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = != operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression137() { final XQuery query = new XQuery( "(10000,50000) != (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single atomic values operator = != operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression138() { final XQuery query = new XQuery( "(10000,50000) != ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = != operand2 = Empty sequence . */ @org.junit.Test public void generalexpression139() { final XQuery query = new XQuery( "10000 != ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = != operand2 = Atomic Value . */ @org.junit.Test public void generalexpression140() { final XQuery query = new XQuery( "10000 != 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = != operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression141() { final XQuery query = new XQuery( "10000 != (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = != operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression142() { final XQuery query = new XQuery( "10000 != (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = != operand2 = Element Constructor . */ @org.junit.Test public void generalexpression143() { final XQuery query = new XQuery( "10000 != 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = != operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression144() { final XQuery query = new XQuery( "10000 != (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = != operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression145() { final XQuery query = new XQuery( "10000 != (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = != operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression146() { final XQuery query = new XQuery( "10000 != (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = != operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression147() { final XQuery query = new XQuery( "10000 != (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Element Constructor operator = != operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression148() { final XQuery query = new XQuery( "10000 != ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = != operand2 = Empty sequence . */ @org.junit.Test public void generalexpression149() { final XQuery query = new XQuery( "(10000) != ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = != operand2 = Atomic Value . */ @org.junit.Test public void generalexpression150() { final XQuery query = new XQuery( "(10000) != 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = != operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression151() { final XQuery query = new XQuery( "(10000) != (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = != operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression152() { final XQuery query = new XQuery( "(10000) != (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = != operand2 = Element Constructor . */ @org.junit.Test public void generalexpression153() { final XQuery query = new XQuery( "(10000) != 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = != operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression154() { final XQuery query = new XQuery( "(10000) != (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = != operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression155() { final XQuery query = new XQuery( "(10000) != (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = != operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression156() { final XQuery query = new XQuery( "(10000) != (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = != operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression157() { final XQuery query = new XQuery( "(10000) != (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element constructor operator = != operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression158() { final XQuery query = new XQuery( "(10000) != ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = != operand2 = Empty sequence . */ @org.junit.Test public void generalexpression159() { final XQuery query = new XQuery( "(10000,50000) != ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = != operand2 = Atomic Value . */ @org.junit.Test public void generalexpression160() { final XQuery query = new XQuery( "(10000,50000) != 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = != operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression161() { final XQuery query = new XQuery( "(10000,50000) != (50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = != operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression162() { final XQuery query = new XQuery( "(10000,50000) != (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = != operand2 = Element Constructor . */ @org.junit.Test public void generalexpression163() { final XQuery query = new XQuery( "(10000,50000) != 10000", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = != operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression164() { final XQuery query = new XQuery( "(10000,50000) != (10000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = != operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression165() { final XQuery query = new XQuery( "(10000,50000) != (10000,50000)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = != operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression166() { final XQuery query = new XQuery( "(10000,50000) != (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = != operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression167() { final XQuery query = new XQuery( "(10000,50000) != (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element constructors operator = != operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression168() { final XQuery query = new XQuery( "(10000,50000) != ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = != operand2 = Empty sequence . */ @org.junit.Test public void generalexpression169() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) != ()", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = != operand2 = Atomic Value . */ @org.junit.Test public void generalexpression170() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) != 10000", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = != operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression171() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) != (50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = != operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression172() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) != (10000,50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = != operand2 = Element Constructor . */ @org.junit.Test public void generalexpression173() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) != 10000", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = != operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression174() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) != (10000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = != operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression175() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) != (10000,50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = != operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression176() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) != (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = != operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression177() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1]) != (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of single element nodes operator = != operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression178() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1]) != ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = != operand2 = Empty sequence . */ @org.junit.Test public void generalexpression179() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) != ()", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = != operand2 = Atomic Value . */ @org.junit.Test public void generalexpression180() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) != 10000", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = != operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression181() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) != (50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = != operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression182() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) != (10000,50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = != operand2 = Element Constructor . */ @org.junit.Test public void generalexpression183() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) != 10000", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = != operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression184() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) != (10000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = != operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression185() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) != (10000,50000)", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = != operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression186() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) != (/works/employee[1]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = != operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression187() { final XQuery query = new XQuery( "(/works/employee[1]/hours[1],/works/employee[6]/hours[1]) != (/works/employee[1]/hours[1],/works/employee[6]/hours[1])", ctx); try { query.context(node(file("docs/works.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (single source) operator = != operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression188() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$works/works/employee[6]/hours[1]) != ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = != operand2 = Empty sequence . */ @org.junit.Test public void generalexpression189() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) != ()", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = != operand2 = Atomic Value . */ @org.junit.Test public void generalexpression190() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) != 10000", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = != operand2 = Sequence of single atomic value . */ @org.junit.Test public void generalexpression191() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) != (50000)", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = != operand2 = Sequence of single atomic values . */ @org.junit.Test public void generalexpression192() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) != (10000,50000)", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = != operand2 = Element Constructor . */ @org.junit.Test public void generalexpression193() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) != 10000", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = != operand2 = Sequence of single element constructor . */ @org.junit.Test public void generalexpression194() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) != (10000)", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = != operand2 = Sequence of multiple element constructors . */ @org.junit.Test public void generalexpression195() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) != (10000,50000)", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = != operand2 = Sequence of single element nodes . */ @org.junit.Test public void generalexpression196() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) != ($works/works/employee[1]/hours[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = != operand2 = Sequence of multiple element nodes (single source) . */ @org.junit.Test public void generalexpression197() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) != ($works/works/employee[1]/hours[1],$works/works/employee[6]/hours[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test of a General Expression with the operands set as follows operand1 = Sequence of multiple element nodes (multiple sources) operator = != operand2 = Sequence of multiple element nodes (multiple sources) . */ @org.junit.Test public void generalexpression198() { final XQuery query = new XQuery( "($works/works/employee[1]/hours[1],$staff/staff/employee[6]/hours[1]) != ($works/works/employee[1]/hours[1],$staff/staff/employee[6]/grade[1])", ctx); try { query.bind("$works", node(file("docs/works.xml"))); query.bind("$staff", node(file("docs/staff.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdGroupByClause.java000066400000000000000000001001371222453003200306630ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the GroupByClause production in XQuery 3.0. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdGroupByClause extends QT3TestSet { /** * Group atomic values. */ @org.junit.Test public void group001() { final XQuery query = new XQuery( " \n" + " for $x in 1 to 100 \n" + " let $key := $x mod 10 \n" + " group by $key \n" + " return string(text{$x})\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"1 11 21 31 41 51 61 71 81 91\", \"2 12 22 32 42 52 62 72 82 92\", \"3 13 23 33 43 53 63 73 83 93\", \n \"4 14 24 34 44 54 64 74 84 94\", \"5 15 25 35 45 55 65 75 85 95\", \"6 16 26 36 46 56 66 76 86 96\", \n \"7 17 27 37 47 57 67 77 87 97\", \"8 18 28 38 48 58 68 78 88 98\", \"9 19 29 39 49 59 69 79 89 99\", \n \"10 20 30 40 50 60 70 80 90 100\"") ); } /** * Group atomic values using new syntax agreed Sept 2011. */ @org.junit.Test public void group001a() { final XQuery query = new XQuery( " \n" + " for $x in 1 to 100 \n" + " group by $key := $x mod 10 \n" + " return string(text{$x})\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"1 11 21 31 41 51 61 71 81 91\", \"2 12 22 32 42 52 62 72 82 92\", \"3 13 23 33 43 53 63 73 83 93\", \n \"4 14 24 34 44 54 64 74 84 94\", \"5 15 25 35 45 55 65 75 85 95\", \"6 16 26 36 46 56 66 76 86 96\", \n \"7 17 27 37 47 57 67 77 87 97\", \"8 18 28 38 48 58 68 78 88 98\", \"9 19 29 39 49 59 69 79 89 99\", \n \"10 20 30 40 50 60 70 80 90 100\"") ); } /** * Basic grouping test, using nodes as input . */ @org.junit.Test public void group002() { final XQuery query = new XQuery( " \n" + " for $x in //employee \n" + " let $key := $x/@gender \n" + " group by $key \n" + " return concat($key, ':', \n" + " string-join(for $e in $x return $e/@name/string(), ',')) \n" + " ", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\n \"female:Jane Doe 1,Jane Doe 3,Jane Doe 5,Jane Doe 7,Jane Doe 9,Jane Doe 11,Jane Doe 13\",\n \"male:John Doe 2,John Doe 4,John Doe 6,John Doe 8,John Doe 10,John Doe 12\"\n ") ); } /** * Basic grouping test, using nodes as input, using new Sept 2011 syntax . */ @org.junit.Test public void group002a() { final XQuery query = new XQuery( " \n" + " for $x in //employee \n" + " group by $key := $x/@gender \n" + " return concat($key, ':', \n" + " string-join(for $e in $x return $e/@name/string(), ',')) \n" + " ", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\n \"female:Jane Doe 1,Jane Doe 3,Jane Doe 5,Jane Doe 7,Jane Doe 9,Jane Doe 11,Jane Doe 13\",\n \"male:John Doe 2,John Doe 4,John Doe 6,John Doe 8,John Doe 10,John Doe 12\"\n ") ); } /** * Basic grouping test, using nodes as input, boolean grouping key . */ @org.junit.Test public void group003() { final XQuery query = new XQuery( " \n" + " for $x in //employee \n" + " let $key := ($x/@gender = 'male') \n" + " group by $key \n" + " return concat($key, ':', \n" + " string-join(for $e in $x return $e/@name/string(), ',')) \n" + " ", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\n \"false:Jane Doe 1,Jane Doe 3,Jane Doe 5,Jane Doe 7,Jane Doe 9,Jane Doe 11,Jane Doe 13\",\n \"true:John Doe 2,John Doe 4,John Doe 6,John Doe 8,John Doe 10,John Doe 12\"\n ") ); } /** * Basic grouping test, using nodes as input, boolean grouping key; * using new Sept 2011 syntax. */ @org.junit.Test public void group003a() { final XQuery query = new XQuery( " \n" + " for $x in //employee \n" + " group by $key := ($x/@gender = 'male') \n" + " return concat($key, ':', \n" + " string-join(for $e in $x return $e/@name/string(), ',')) \n" + " ", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\n \"false:Jane Doe 1,Jane Doe 3,Jane Doe 5,Jane Doe 7,Jane Doe 9,Jane Doe 11,Jane Doe 13\",\n \"true:John Doe 2,John Doe 4,John Doe 6,John Doe 8,John Doe 10,John Doe 12\"\n ") ); } /** * Basic grouping test, using nodes as input, aggregate over a group . */ @org.junit.Test public void group004() { final XQuery query = new XQuery( " \n" + " for $x in //employee \n" + " let $key := $x/@gender \n" + " group by $key \n" + " return concat($key, ':', avg($x/hours)) \n" + " ", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"female:41.25\", \"male:37.75\"") ); } /** * Basic grouping test, multivalued grouping key, currently an error . */ @org.junit.Test public void group005() { final XQuery query = new XQuery( "\n" + " for $x in //employee \n" + " let $key := $x/hours \n" + " group by $key \n" + " return \n" + " ", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A grouping key can be empty . */ @org.junit.Test public void group006() { final XQuery query = new XQuery( "\n" + " { \n" + " for $x in //employee \n" + " group by $key := $x/status \n" + " return \n" + " }\n" + " ", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("", false) || assertSerialization("", false) ) ); } /** * Group by with a where clause . */ @org.junit.Test public void group007() { final XQuery query = new XQuery( " \n" + " for $x in //employee \n" + " let $key := $x/hours[1] \n" + " group by $key \n" + " where count($x) gt 2 \n" + " return concat($key, ':', count($x)) \n" + " ", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"40:3\", \"80:3\", \"20:5\"") ); } /** * Group by with an order-by clause . */ @org.junit.Test public void group008() { final XQuery query = new XQuery( "\n" + " { \n" + " for $x in //employee \n" + " let $key := $x/empnum \n" + " group by $key \n" + " order by count($x), $key \n" + " return {string-join($x/@name, '|')} \n" + " }\n" + " ", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Jane Doe 7|John Doe 8Jane Doe 9|John Doe 10Jane Doe 11|John Doe 12|Jane Doe 13Jane Doe 1|John Doe 2|Jane Doe 3|John Doe 4|Jane Doe 5|John Doe 6", false) ); } /** * Group by with a collation, and with sorting . */ @org.junit.Test public void group009() { final XQuery query = new XQuery( "\n" + " { \n" + " for $x in //employee \n" + " let $key := $x/empnum \n" + " group by $key collation \"http://www.w3.org/2005/xpath-functions/collation/codepoint\" \n" + " order by $key \n" + " return {string-join($x/pnum, '|')} \n" + " }\n" + " ", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("P1|P2|P3|P4|P5|P6P1|P2P2|P2P2|P4|P5", false) ); } /** * Group by with a collation, and with sorting; using new (Sept 2011) syntax . */ @org.junit.Test public void group009a() { final XQuery query = new XQuery( "\n" + " { \n" + " for $x in //employee \n" + " group by $key := $x/empnum collation \"http://www.w3.org/2005/xpath-functions/collation/codepoint\" \n" + " order by $key \n" + " return {string-join($x/pnum, '|')} \n" + " }\n" + " ", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("P1|P2|P3|P4|P5|P6P1|P2P2|P2P2|P4|P5", false) ); } /** * NaN values go in the same group . */ @org.junit.Test public void group010() { final XQuery query = new XQuery( "\n" + " { \n" + " for $x in //employee \n" + " let $key := if ($x/@gender='male') then number('NaN') else 42 \n" + " group by $key \n" + " return \n" + " }\n" + " ", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("", false) || assertSerialization("", false) ) ); } /** * Group by with position variable (Bug report on Saxon submitted by Leo Wörteler of BaseX). */ @org.junit.Test public void group011() { final XQuery query = new XQuery( "\n" + " for $a at $p in 1 to 10\n" + " let $g := $p mod 2\n" + " group by $g\n" + " return string-join($p!string(), ' ') \n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertPermutation("\"1 3 5 7 9\", \"2 4 6 8 10\"") ); } /** * Grouping of an empty sequence . */ @org.junit.Test public void group012() { final XQuery query = new XQuery( "\n" + " { \n" + " for $x in //employee[age > 300] \n" + " let $key := @gender \n" + " group by $key \n" + " return { \n" + " for $e in $x return {$e/@name/string()} \n" + " } \n" + " }\n" + " ", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Grouping by already existing variable. */ @org.junit.Test public void group013() { final XQuery query = new XQuery( "\n" + " for $x in 1 to 10, $y in 1 to 4\n" + " let $org_y := $y\n" + " group by $y, $y := $x mod 2\n" + " return {$x}\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertSerialization("1 1 1 1 3 3 3 3 5 5 5 5 7 7 7 7 9 9 9 92 2 2 2 4 4 4 4 6 6 6 6 8 8 8 8 10 10 10 10", false) || assertSerialization("2 2 2 2 4 4 4 4 6 6 6 6 8 8 8 8 10 10 10 101 1 1 1 3 3 3 3 5 5 5 5 7 7 7 7 9 9 9 9", false) ) ); } /** * Referenced grouping variable is not in the tuple stream. . */ @org.junit.Test public void group014() { final XQuery query = new XQuery( "\n" + " let $x := 1\n" + " return\n" + " for $i in (\"a\", \"b\")\n" + " group by $x\n" + " return\n" + " ($x, count($i))\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XQST0094") ); } /** * No value comparisons are available to compare the grouping keys.. */ @org.junit.Test public void group015() { final XQuery query = new XQuery( "\n" + " for $x in (true(), \"true\", xs:QName(\"true\"))\n" + " group by $x\n" + " return $x\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("true true true", false) ); } /** * In the first grouping spec, the grouping variable does not reference the generated let binding. See also group-013 . */ @org.junit.Test public void group016() { final XQuery query = new XQuery( "\n" + " count(\n" + " for $y in 1 to 10\n" + " group by $y := $y, $y := $y mod 2\n" + " return $y\n" + " )\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Use Case "Group By" - Q1. */ @org.junit.Test public void useCaseGroupbyQ1() { final XQuery query = new XQuery( "\n" + " {\n" + " for $sales in $sales-records-doc/*/record\n" + " let $pname := $sales/product-name\n" + " group by $pname\n" + " order by $pname\n" + " return\n" + " {\n" + " sum($sales/qty)\n" + " }\n" + " } \n" + " ", ctx); try { query.bind("$products-doc", node(file("prod/GroupByClause/products.xml"))); query.bind("$sales-records-doc", node(file("prod/GroupByClause/sales-records.xml"))); query.bind("$stores-doc", node(file("prod/GroupByClause/stores.xml"))); query.bind("$books-doc", node(file("prod/GroupByClause/books.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("2502010510200", false) ); } /** * Use Case "Group By" - Q2. */ @org.junit.Test public void useCaseGroupbyQ2() { final XQuery query = new XQuery( "\n" + " {\n" + " for $sales in $sales-records-doc/*/record\n" + " let $state := $stores-doc/*/store[store-number = $sales/store-number]/state\n" + " let $category := $products-doc/*/product[name = $sales/product-name]/category\n" + " group by $state, $category\n" + " order by $state, $category\n" + " return\n" + " \n" + " {$state}\n" + " {$category}\n" + " {sum($sales/qty)}\n" + " \n" + " }\n" + " ", ctx); try { query.bind("$products-doc", node(file("prod/GroupByClause/products.xml"))); query.bind("$sales-records-doc", node(file("prod/GroupByClause/sales-records.xml"))); query.bind("$stores-doc", node(file("prod/GroupByClause/stores.xml"))); query.bind("$books-doc", node(file("prod/GroupByClause/books.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("CAclothes510CAkitchen170MAclothes10MAkitchen300", false) ); } /** * Use Case "Group By" - Q3. */ @org.junit.Test public void useCaseGroupbyQ3() { final XQuery query = new XQuery( "\n" + " {\n" + " for $sales in $sales-records-doc/*/record\n" + " let $state := $stores-doc/*/store[store-number = $sales/store-number]/state,\n" + " $product := $products-doc/*/product[name = $sales/product-name],\n" + " $category := $product/category,\n" + " $revenue := $sales/qty * $product/price\n" + " group by $state, $category\n" + " order by $state, $category\n" + " return\n" + " \n" + " {$state}\n" + " {$category}\n" + " {sum($revenue)}\n" + " \n" + " }\n" + " ", ctx); try { query.bind("$products-doc", node(file("prod/GroupByClause/products.xml"))); query.bind("$sales-records-doc", node(file("prod/GroupByClause/sales-records.xml"))); query.bind("$stores-doc", node(file("prod/GroupByClause/stores.xml"))); query.bind("$books-doc", node(file("prod/GroupByClause/books.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("CAclothes2550CAkitchen6500MAclothes100MAkitchen14000", false) ); } /** * Use Case "Group By" - Q4. */ @org.junit.Test public void useCaseGroupbyQ4() { final XQuery query = new XQuery( "\n" + " {\n" + " for $store in $stores-doc/*/store\n" + " let $state := $store/state\n" + " group by $state\n" + " order by $state\n" + " return\n" + " {\n" + " for $product in $products-doc/*/product\n" + " let $category := $product/category\n" + " group by $category\n" + " order by $category\n" + " return\n" + " {\n" + " for $sales in $sales-records-doc/*/record[store-number = $store/store-number\n" + " and product-name = $product/name]\n" + " let $pname := $sales/product-name\n" + " group by $pname\n" + " order by $pname\n" + " return\n" + " \n" + " }\n" + " }\n" + " }\n" + " ", ctx); try { query.bind("$products-doc", node(file("prod/GroupByClause/products.xml"))); query.bind("$sales-records-doc", node(file("prod/GroupByClause/sales-records.xml"))); query.bind("$stores-doc", node(file("prod/GroupByClause/stores.xml"))); query.bind("$books-doc", node(file("prod/GroupByClause/books.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Use Case "Group By" - Q5. */ @org.junit.Test public void useCaseGroupbyQ5() { final XQuery query = new XQuery( "\n" + " {\n" + " for $sales in $sales-records-doc/*/record\n" + " let $storeno := $sales/store-number\n" + " group by $storeno\n" + " order by $storeno\n" + " return\n" + " {\n" + " for $s in $sales\n" + " order by xs:int($s/qty) descending\n" + " return\n" + " \n" + " }\n" + " }\n" + " ", ctx); try { query.bind("$products-doc", node(file("prod/GroupByClause/products.xml"))); query.bind("$sales-records-doc", node(file("prod/GroupByClause/sales-records.xml"))); query.bind("$stores-doc", node(file("prod/GroupByClause/stores.xml"))); query.bind("$books-doc", node(file("prod/GroupByClause/books.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Use Case "Group By" - Q6. */ @org.junit.Test public void useCaseGroupbyQ6() { final XQuery query = new XQuery( "\n" + " {\n" + " for $sales in $sales-records-doc/*/record\n" + " let $storeno := $sales/store-number,\n" + " $product := $products-doc/*/product[name = $sales/product-name],\n" + " $prd := $product,\n" + " $profit := $sales/qty * ($prd/price - $prd/cost)\n" + " group by $storeno\n" + " let $total-store-profit := sum($profit)\n" + " where $total-store-profit > 100\n" + " order by $total-store-profit descending\n" + " return\n" + " \n" + " }\n" + " ", ctx); try { query.bind("$products-doc", node(file("prod/GroupByClause/products.xml"))); query.bind("$sales-records-doc", node(file("prod/GroupByClause/sales-records.xml"))); query.bind("$stores-doc", node(file("prod/GroupByClause/stores.xml"))); query.bind("$books-doc", node(file("prod/GroupByClause/books.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Use Case "Group By" - Q7. */ @org.junit.Test public void useCaseGroupbyQ7() { final XQuery query = new XQuery( "\n" + " {\n" + " for $book in $books-doc/*/book\n" + " for $author in $book/author\n" + " group by $author\n" + " order by $author\n" + " return\n" + " {\n" + " for $b in $book\n" + " order by $b/title\n" + " return\n" + " {fn:data($b/title)} \n" + " }\n" + " }\n" + " ", ctx); try { query.bind("$products-doc", node(file("prod/GroupByClause/products.xml"))); query.bind("$sales-records-doc", node(file("prod/GroupByClause/sales-records.xml"))); query.bind("$stores-doc", node(file("prod/GroupByClause/stores.xml"))); query.bind("$books-doc", node(file("prod/GroupByClause/books.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("SQL:1999Strategic Database TechnologyUnderstanding SQL and Java TogetherAdvanced SQL:1999Querying XMLSQL:1999Understanding SQL and Java TogetherQuerying XML", false) ); } /** * Use Case "Group By" - Q8. */ @org.junit.Test public void useCaseGroupbyQ8() { final XQuery query = new XQuery( "\n" + " {\n" + " for $book in $books-doc/*/book\n" + " let $author-list := fn:string-join($book/author, ', ')\n" + " group by $author-list\n" + " order by $author-list\n" + " return\n" + " {\n" + " for $b in $book\n" + " order by $b/title\n" + " return\n" + " {fn:data($b/title)} \n" + " }\n" + " }\n" + " ", ctx); try { query.bind("$products-doc", node(file("prod/GroupByClause/products.xml"))); query.bind("$sales-records-doc", node(file("prod/GroupByClause/sales-records.xml"))); query.bind("$stores-doc", node(file("prod/GroupByClause/stores.xml"))); query.bind("$books-doc", node(file("prod/GroupByClause/books.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("Strategic Database TechnologyAdvanced SQL:1999SQL:1999Understanding SQL and Java TogetherQuerying XML", false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdIfExpr.java000066400000000000000000000575301222453003200273440ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the IfExpr production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdIfExpr extends QT3TestSet { /** * Simple if expression where boolean is a constant true . */ @org.junit.Test public void condExpr002() { final XQuery query = new XQuery( "if (fn:true()) then else ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Simple if expression where boolean is a constant false . */ @org.junit.Test public void condExpr003() { final XQuery query = new XQuery( "if (fn:false()) then else ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Node set from a path expression as test condition . */ @org.junit.Test public void condExpr004() { final XQuery query = new XQuery( "if (//CompanyName) then else ", ctx); try { query.context(node(file("prod/AxisStep/nw_Customers.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Empty node set from a path expression as test condition . */ @org.junit.Test public void condExpr005() { final XQuery query = new XQuery( "if (//NodeDoesNotExist) then else ", ctx); try { query.context(node(file("prod/AxisStep/nw_Customers.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * FileName: CondExpr006 then-expression has another if expression . */ @org.junit.Test public void condExpr006() { final XQuery query = new XQuery( "{ if (1 != 0) then if (4 != 5) then 1 else 2 else 3 }", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("1", false) ); } /** * else-expr has another if expression . */ @org.junit.Test public void condExpr007() { final XQuery query = new XQuery( "if (//MissingNode) then else if (/Root/Customers[@CustomerID='ALFKI']//Country = \"Germany\") then else ", ctx); try { query.context(node(file("prod/AxisStep/nw_Customers.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * and-expression in test expression . */ @org.junit.Test public void condExpr008() { final XQuery query = new XQuery( "if ( /Root/Customers[1]/@CustomerID = 'ALFKI' and /Root/Customers[1]/FullAddress/City = 'Berlin') then \"pass\" else \"fail\"", ctx); try { query.context(node(file("prod/AxisStep/nw_Customers.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "pass") ); } /** * or-expression in test expression . */ @org.junit.Test public void condExpr009() { final XQuery query = new XQuery( "if (/Root/Customers[1]/@CustomerID = 'ALFKI' or /Root/Customers[1]/FullAddress/City = 'Non-Existent') then \"pass\" else \"fail\"", ctx); try { query.context(node(file("prod/AxisStep/nw_Customers.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "pass") ); } /** * FileName: CondExpr010 a true expression in if expression . */ @org.junit.Test public void condExpr010() { final XQuery query = new XQuery( " if (2 != 4) then 1 else 0 ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * FileName: CondExpr011 If expression as argument to a function . */ @org.junit.Test public void condExpr011() { final XQuery query = new XQuery( "fn:string-length(if (2 != 3) then 'foo' else 'expanded-foo')", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * FileName: CondExpr012 Adapted from example in spec; test expression is a relational expression . */ @org.junit.Test public void condExpr012() { final XQuery query = new XQuery( "if (/doc/widget1/@unit-cost = /doc/widget2/@unit-cost) then /doc/widget1/@name else /doc/widget2/@name", ctx); try { query.context(node(file("prod/IfExpr/xq311A.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "axolotl") ); } /** * FileName: CondExpr013 test expression has another if expression . */ @org.junit.Test public void condExpr013() { final XQuery query = new XQuery( " if (if (5 != 3) then fn:true() else fn:empty(/doc/widget1)) then \"search\" else \"assume\" ", ctx); try { query.context(node(file("prod/IfExpr/xq311A.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "search") ); } /** * FileName: CondExpr014 Two if expressions at same depth in larger expression . */ @org.junit.Test public void condExpr014() { final XQuery query = new XQuery( " ( if (3 != 2) then 16 else 0 ) + ( if (8 = 7) then 4 else 1 ) ", ctx); try { query.context(node(file("prod/IfExpr/xq311A.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("17") ); } /** * FileName: CondExpr015 Two if expressions at same depth in larger expression, each parenthesized . */ @org.junit.Test public void condExpr015() { final XQuery query = new XQuery( " (if (3 != 2) then 16 else 0) + (if (8 = 7) then 4 else 1) ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("17") ); } /** * FileName: CondExpr016 if where branches return different valid types . */ @org.junit.Test public void condExpr016() { final XQuery query = new XQuery( "(//Folder)[1]/File[ if ( ./@name='File00000000000' ) then 2 else true() ]/FileName", ctx); try { query.context(node(file("prod/ForClause/fsx.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("File00000000001File00000000002File00000000003File00000000004File00000000005File00000000006File00000000007File00000000008File00000000009File00000000010File00000000011File00000000012File00000000013File00000000014File00000000015File00000000016File00000000017File00000000018File00000000019File00000000020File00000000021File00000000022File00000000023File00000000024File00000000025File00000000026File00000000027File00000000028File00000000029File00000000030", false) ); } /** * FileName: CondExpr017 if where branches return different valid types . */ @org.junit.Test public void condExpr017() { final XQuery query = new XQuery( "for $file in (//Folder)[1]/File return if( $file/FileName='File00000000000' ) then $file/FileName else data( $file/FileName )", ctx); try { query.context(node(file("prod/ForClause/fsx.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("File00000000000File00000000001 File00000000002 File00000000003 File00000000004 File00000000005 File00000000006 File00000000007 File00000000008 File00000000009 File00000000010 File00000000011 File00000000012 File00000000013 File00000000014 File00000000015 File00000000016 File00000000017 File00000000018 File00000000019 File00000000020 File00000000021 File00000000022 File00000000023 File00000000024 File00000000025 File00000000026 File00000000027 File00000000028 File00000000029 File00000000030", false) ); } /** * FileName: CondExpr018 if where branches return different valid types . */ @org.junit.Test public void condExpr018() { final XQuery query = new XQuery( "for $file in (//Folder)[1]/File return if( $file/FileName='File00000000004' ) then 1 else data( $file/FileName )", ctx); try { query.context(node(file("prod/ForClause/fsx.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "File00000000000 File00000000001 File00000000002 File00000000003 1 File00000000005 File00000000006 File00000000007 File00000000008 File00000000009 File00000000010 File00000000011 File00000000012 File00000000013 File00000000014 File00000000015 File00000000016 File00000000017 File00000000018 File00000000019 File00000000020 File00000000021 File00000000022 File00000000023 File00000000024 File00000000025 File00000000026 File00000000027 File00000000028 File00000000029 File00000000030") ); } /** * FileName: CondExpr019 Test with test expression not contained in ( ... ) . */ @org.junit.Test public void condExpr019() { final XQuery query = new XQuery( "if //File[1] then \"true\" else \"false\"", ctx); try { query.context(node(file("prod/ForClause/fsx.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Test case where then-expression raises a dynamic error, but test-expression selects else-expression so no error is raised . */ @org.junit.Test public void condExpr022() { final XQuery query = new XQuery( "if (doc-available('nodocument.xml')) then doc('nodocument.xml') else 10 cast as xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * FileName: CondExpr020 Test case where then-expression raises a dynamic error, but test-expression selects else-expression so no error is raised . */ @org.junit.Test public void condExpr20() { final XQuery query = new XQuery( "if( false() ) then /Folder[1] cast as xs:double ? else 10 cast as xs:double ?", ctx); try { query.context(node(file("prod/ForClause/fsx.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * FileName: CondExpr021 Test case where else-expression raises a dynamic error, but test-expression selects then-expression so no error is raised . */ @org.junit.Test public void condExpr21() { final XQuery query = new XQuery( "if( true() ) then 10 cast as xs:double ? else /Folder[1] cast as xs:double ?", ctx); try { query.context(node(file("prod/ForClause/fsx.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("10") ); } /** * A test whose essence is: `(if(2) then 1 else 0) eq 1`. . */ @org.junit.Test public void kCondExpr1() { final XQuery query = new XQuery( "(if(2) then 1 else 0) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An if-test applied on fn:count(). . */ @org.junit.Test public void kCondExpr10() { final XQuery query = new XQuery( "if(count((1, 2, 3, current-time(), 4))) then true() else 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An if-test applied on fn:count() combined with fn:not(). . */ @org.junit.Test public void kCondExpr11() { final XQuery query = new XQuery( "if(not(count(remove((1, 2, 3, current-time()), 1)))) then 3 else true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * if-then clause combined with fn:boolean(). . */ @org.junit.Test public void kCondExpr12() { final XQuery query = new XQuery( "if(boolean((1, 2, 3, current-time())[1] treat as xs:integer)) then true() else 4", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `if(()) then false() else true()`. . */ @org.junit.Test public void kCondExpr2() { final XQuery query = new XQuery( "if(()) then false() else true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An expression involving the if expression that trigger certain optimization paths in some implementations. . */ @org.junit.Test public void kCondExpr3() { final XQuery query = new XQuery( "(if((1, current-time())[1] treat as xs:integer) then true() else false()) eq true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An expression involving the if expression that trigger certain optimization paths in some implementations(#2). . */ @org.junit.Test public void kCondExpr4() { final XQuery query = new XQuery( "(if(boolean((1, current-time())[1] treat as xs:integer)) then true() else false()) eq true()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An expression involving the if expression that trigger certain optimization paths in some implementations(#2). . */ @org.junit.Test public void kCondExpr5() { final XQuery query = new XQuery( "if((1, 2, 3, hours-from-time(current-time()))[1]) then true() else false()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An expression involving the if expression that trigger certain optimization paths in some implementations(#3). . */ @org.junit.Test public void kCondExpr6() { final XQuery query = new XQuery( "string(if(boolean((1, current-time())[1] treat as xs:integer)) then true() else false()) eq \"true\"", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An if-test which EBV cannot be extracted from. . */ @org.junit.Test public void kCondExpr7() { final XQuery query = new XQuery( "(if(current-time()) then 1 else 0) eq 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FORG0006") ); } /** * An if-test which EBV cannot be extracted from. . */ @org.junit.Test public void kCondExpr8() { final XQuery query = new XQuery( "1 eq (if(xs:anyURI(\"example.com/\")) then 1 else 0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An if-test which EBV cannot be extracted from. . */ @org.junit.Test public void kCondExpr9() { final XQuery query = new XQuery( "0 eq (if(xs:anyURI(\"\")) then 1 else 0)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * An expression that can be rewritten to the empty sequence, no matter the test branch. . */ @org.junit.Test public void k2CondExpr1() { final XQuery query = new XQuery( "empty(if({current-time()}) then () else ())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPST0005") ) ); } /** * An expression that can be simplified to any of the result branches, no matter the test branch. . */ @org.junit.Test public void k2CondExpr2() { final XQuery query = new XQuery( "empty(if({current-time()}) then 1 else 1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * It is ok to name a function 'unordered'. . */ @org.junit.Test public void k2CondExpr3() { final XQuery query = new XQuery( "declare default function namespace \"http://www.example.com/\"; declare function unordered() { 1 }; unordered()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Extract the EBV from a node sequence. Sorting and deduplication isn't necessary in that case. . */ @org.junit.Test public void k2CondExpr4() { final XQuery query = new XQuery( "if(//(employee[location = \"Denver\"]/ancestor::*)) then 1 else 3", ctx); try { query.context(node(file("op/union/acme_corp.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * There is no exclamation mark operator in XQuery. . */ @org.junit.Test public void k2CondExpr5() { final XQuery query = new XQuery( "if(!true()) then 2 else 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * An if expression cannot directly be an axis step. . */ @org.junit.Test public void k2CondExpr6() { final XQuery query = new XQuery( "/if(true()) then 1 else 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * Use a set of expressions that trigger a bug in some parsers. . */ @org.junit.Test public void k2CondExpr7() { final XQuery query = new XQuery( "if (1) then 1 else if (1) then 1 else if (1) then 1 else if (1) then 1 else if (1) then 1 else if (1) then 1 else if (1) then 1 else if (1) then 1 else if (1) then 1 else if (1) then 1 else if (1) then 1 else if (1) then 1 else if (1) then 1 else if (1) then 1 else if (1) then 1 else if (1) then 1 else if (1) then 1 else if (1) then 1 else if (1) then 1 else if (1) then 1 else if (1) then 1 else if (1) then 1 else if (1) then 1 else if (1) then 1 else if (1) then 1 else if (1) then 1 else if (1) then 1 else if (1) then 1 else ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Tests if(exists($x)) then f($x) else () optimization . */ @org.junit.Test public void cbclCondexpr001() { final XQuery query = new XQuery( "\n" + " \tlet $x := zero-or-one((1 to 10)[. div 2 = 2]) \n" + " \treturn if(exists($x)) then xs:string($x) else ()\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4") ); } /** * tests if(empty($x)) then () else f($x) optimization . */ @org.junit.Test public void cbclCondexpr002() { final XQuery query = new XQuery( "\n" + " \tlet $x := zero-or-one((1 to 10)[. div 2 = 2]) \n" + " \treturn if(empty($x)) then () else xs:string($x)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "4") ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdInstanceofExpr.java000066400000000000000000004131331222453003200310720ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the InstanceofExpr production. * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdInstanceofExpr extends QT3TestSet { /** * A test whose essence is: `1 instance of item()`. . */ @org.junit.Test public void kSeqExprInstanceOf1() { final XQuery query = new XQuery( "1 instance of item()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `"a string" instance of xs:string`. . */ @org.junit.Test public void kSeqExprInstanceOf10() { final XQuery query = new XQuery( "\"a string\" instance of xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not("false" instance of xs:boolean)`. . */ @org.junit.Test public void kSeqExprInstanceOf11() { final XQuery query = new XQuery( "not(\"false\" instance of xs:boolean)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `1.1 instance of xs:decimal`. . */ @org.junit.Test public void kSeqExprInstanceOf12() { final XQuery query = new XQuery( "1.1 instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(1.1 instance of xs:integer)`. . */ @org.junit.Test public void kSeqExprInstanceOf13() { final XQuery query = new XQuery( "not(1.1 instance of xs:integer)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `xs:anyURI("http://www.example.com/") instance of xs:anyURI`. . */ @org.junit.Test public void kSeqExprInstanceOf14() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com/\") instance of xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(xs:anyURI("http://www.example.com/") instance of xs:string)`. . */ @org.junit.Test public void kSeqExprInstanceOf15() { final XQuery query = new XQuery( "not(xs:anyURI(\"http://www.example.com/\") instance of xs:string)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not("a string" instance of xs:untypedAtomic)`. . */ @org.junit.Test public void kSeqExprInstanceOf16() { final XQuery query = new XQuery( "not(\"a string\" instance of xs:untypedAtomic)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(1, 2, 3, 4, 5) instance of xs:integer+`. . */ @org.junit.Test public void kSeqExprInstanceOf17() { final XQuery query = new XQuery( "(1, 2, 3, 4, 5) instance of xs:integer+", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not((1, 2, 3, 4, 5) instance of xs:integer)`. . */ @org.junit.Test public void kSeqExprInstanceOf18() { final XQuery query = new XQuery( "not((1, 2, 3, 4, 5) instance of xs:integer)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not((1, 2, 3, 4, 5) instance of xs:integer?)`. . */ @org.junit.Test public void kSeqExprInstanceOf19() { final XQuery query = new XQuery( "not((1, 2, 3, 4, 5) instance of xs:integer?)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * item() type with comment appearing inside the paranteses. comment . */ @org.junit.Test public void kSeqExprInstanceOf2() { final XQuery query = new XQuery( "1 instance of item()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(1, 2, 3, 4, 5) instance of xs:integer*`. . */ @org.junit.Test public void kSeqExprInstanceOf20() { final XQuery query = new XQuery( "(1, 2, 3, 4, 5) instance of xs:integer*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(1, 2, 3, 4, 5) instance of item()+`. . */ @org.junit.Test public void kSeqExprInstanceOf21() { final XQuery query = new XQuery( "(1, 2, 3, 4, 5) instance of item()+", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not((1, 2, "a string", 4, 5) instance of xs:integer*)`. . */ @org.junit.Test public void kSeqExprInstanceOf22() { final XQuery query = new XQuery( "not((1, 2, \"a string\", 4, 5) instance of xs:integer*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not((1, 2, 1.1, 4, 5) instance of xs:integer*)`. . */ @org.junit.Test public void kSeqExprInstanceOf23() { final XQuery query = new XQuery( "not((1, 2, 1.1, 4, 5) instance of xs:integer*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not((1, 2, "a string", 4, 5) instance of xs:string*)`. . */ @org.junit.Test public void kSeqExprInstanceOf24() { final XQuery query = new XQuery( "not((1, 2, \"a string\", 4, 5) instance of xs:string*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(1, 2, "a string", 4, 5) instance of xs:anyAtomicType*`. . */ @org.junit.Test public void kSeqExprInstanceOf25() { final XQuery query = new XQuery( "(1, 2, \"a string\", 4, 5) instance of xs:anyAtomicType*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(1, 2, count("one"), 4, 5) instance of xs:integer+`. . */ @org.junit.Test public void kSeqExprInstanceOf26() { final XQuery query = new XQuery( "(1, 2, count(\"one\"), 4, 5) instance of xs:integer+", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(1 instance of text())`. . */ @org.junit.Test public void kSeqExprInstanceOf27() { final XQuery query = new XQuery( "not(1 instance of text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(1 instance of node())`. . */ @org.junit.Test public void kSeqExprInstanceOf28() { final XQuery query = new XQuery( "not(1 instance of node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(1 instance of element())`. . */ @org.junit.Test public void kSeqExprInstanceOf29() { final XQuery query = new XQuery( "not(1 instance of element())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `1 instance of xs:integer`. . */ @org.junit.Test public void kSeqExprInstanceOf3() { final XQuery query = new XQuery( "1 instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(1 instance of processing-instruction())`. . */ @org.junit.Test public void kSeqExprInstanceOf30() { final XQuery query = new XQuery( "not(1 instance of processing-instruction())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(1 instance of comment())`. . */ @org.junit.Test public void kSeqExprInstanceOf31() { final XQuery query = new XQuery( "not(1 instance of comment())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A comment appearing inside the paranteses of the sequence type text(). comment . */ @org.junit.Test public void kSeqExprInstanceOf32() { final XQuery query = new XQuery( "not(1 instance of text())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A comment appearing inside the paranteses of the sequence type node(). comment . */ @org.junit.Test public void kSeqExprInstanceOf33() { final XQuery query = new XQuery( "not(1 instance of node())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A comment appearing inside the paranteses of the sequence type element(). comment . */ @org.junit.Test public void kSeqExprInstanceOf34() { final XQuery query = new XQuery( "not(1 instance of element())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A comment appearing inside the paranteses of the sequence type processing-instruction(). comment . */ @org.junit.Test public void kSeqExprInstanceOf35() { final XQuery query = new XQuery( "not(1 instance of processing-instruction())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A comment appearing inside the paranteses of the sequence type comment(). comment . */ @org.junit.Test public void kSeqExprInstanceOf36() { final XQuery query = new XQuery( "not(1 instance of comment())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not(1 instance of empty-sequence())`. . */ @org.junit.Test public void kSeqExprInstanceOf37() { final XQuery query = new XQuery( "not(1 instance of empty-sequence())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not( (1, 2, 3) instance of empty-sequence())`. . */ @org.junit.Test public void kSeqExprInstanceOf38() { final XQuery query = new XQuery( "not( (1, 2, 3) instance of empty-sequence())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `() instance of empty-sequence()`. . */ @org.junit.Test public void kSeqExprInstanceOf39() { final XQuery query = new XQuery( "() instance of empty-sequence()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `1 instance of xs:decimal`. . */ @org.junit.Test public void kSeqExprInstanceOf4() { final XQuery query = new XQuery( "1 instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Comment appearing inside the paranteses of empty-sequence(). comment . */ @org.junit.Test public void kSeqExprInstanceOf40() { final XQuery query = new XQuery( "() instance of empty-sequence()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(((()))) instance of empty-sequence()`. . */ @org.junit.Test public void kSeqExprInstanceOf41() { final XQuery query = new XQuery( "(((()))) instance of empty-sequence()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `((), (), ()) instance of empty-sequence()`. . */ @org.junit.Test public void kSeqExprInstanceOf42() { final XQuery query = new XQuery( "((), (), ()) instance of empty-sequence()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `((), "xs:string") instance of xs:string`. . */ @org.junit.Test public void kSeqExprInstanceOf43() { final XQuery query = new XQuery( "((), \"xs:string\") instance of xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `("xs:string", (), "xs:string") instance of xs:string+`. . */ @org.junit.Test public void kSeqExprInstanceOf44() { final XQuery query = new XQuery( "(\"xs:string\", (), \"xs:string\") instance of xs:string+", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `(1.1, (), 1) instance of xs:decimal+`. . */ @org.junit.Test public void kSeqExprInstanceOf45() { final XQuery query = new XQuery( "(1.1, (), 1) instance of xs:decimal+", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not("a string" instance of xs:NOTATION)`. . */ @org.junit.Test public void kSeqExprInstanceOf46() { final XQuery query = new XQuery( "not(\"a string\" instance of xs:NOTATION)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `not("a string" instance of xs:QName)`. . */ @org.junit.Test public void kSeqExprInstanceOf47() { final XQuery query = new XQuery( "not(\"a string\" instance of xs:QName)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `1.1 instance of xs:decimal and not(1.1 instance of xs:integer)`. . */ @org.junit.Test public void kSeqExprInstanceOf48() { final XQuery query = new XQuery( "1.1 instance of xs:decimal and not(1.1 instance of xs:integer)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A type is referenced which doesn't exist. . */ @org.junit.Test public void kSeqExprInstanceOf49() { final XQuery query = new XQuery( "3 instance of prefixDoesNotExist:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0081") ); } /** * A test whose essence is: `1 instance of xs:integer?`. . */ @org.junit.Test public void kSeqExprInstanceOf5() { final XQuery query = new XQuery( "1 instance of xs:integer?", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A type is referenced which doesn't exist. . */ @org.junit.Test public void kSeqExprInstanceOf50() { final XQuery query = new XQuery( "3 instance of xs:doesNotExist", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0051") ); } /** * A type is referenced which doesn't exist. . */ @org.junit.Test public void kSeqExprInstanceOf51() { final XQuery query = new XQuery( "3 instance of xs:qname", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0051") ); } /** * A type is referenced which doesn't exist. . */ @org.junit.Test public void kSeqExprInstanceOf52() { final XQuery query = new XQuery( "3 instance of none", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0051") ); } /** * A type is referenced which doesn't exist. . */ @org.junit.Test public void kSeqExprInstanceOf53() { final XQuery query = new XQuery( "3 instance of void", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0051") ); } /** * A type is referenced which doesn't exist. . */ @org.junit.Test public void kSeqExprInstanceOf54() { final XQuery query = new XQuery( "3 instance of none()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0051") || error("XPST0003") ) ); } /** * A type is referenced which doesn't exist. . */ @org.junit.Test public void kSeqExprInstanceOf55() { final XQuery query = new XQuery( "3 instance of void()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( error("XPST0051") || error("XPST0003") ) ); } /** * The fn:error() function in combination with 'instance of'. . */ @org.junit.Test public void kSeqExprInstanceOf56() { final XQuery query = new XQuery( "error() instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * The fn:error() function in combination with 'instance of'. . */ @org.junit.Test public void kSeqExprInstanceOf57() { final XQuery query = new XQuery( "error() instance of xs:integer*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * The fn:error() function in combination with 'instance of'. . */ @org.junit.Test public void kSeqExprInstanceOf58() { final XQuery query = new XQuery( "error() instance of empty-sequence()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * The fn:error() function in combination with 'instance of'. . */ @org.junit.Test public void kSeqExprInstanceOf59() { final XQuery query = new XQuery( "(error(), 1) instance of empty-sequence()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(false) || error("FOER0000") ) ); } /** * A test whose essence is: `1 instance of xs:integer+`. . */ @org.junit.Test public void kSeqExprInstanceOf6() { final XQuery query = new XQuery( "1 instance of xs:integer+", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * The fn:error() function in combination with 'instance of'. . */ @org.junit.Test public void kSeqExprInstanceOf60() { final XQuery query = new XQuery( "(1, error()) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * The fn:error() function in combination with 'instance of'. . */ @org.junit.Test public void kSeqExprInstanceOf61() { final XQuery query = new XQuery( "(error(), 1) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("FOER0000") ); } /** * The fn:error() function in combination with 'instance of'. . */ @org.junit.Test public void kSeqExprInstanceOf62() { final XQuery query = new XQuery( "(1, error()) instance of xs:integer*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * The fn:error() function in combination with 'instance of'. . */ @org.junit.Test public void kSeqExprInstanceOf63() { final XQuery query = new XQuery( "(error(), 1) instance of xs:integer*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("FOER0000") ) ); } /** * A test whose essence is: `not(((10)div(3)) instance of xs:integer)`. . */ @org.junit.Test public void kSeqExprInstanceOf64() { final XQuery query = new XQuery( "not(((10)div(3)) instance of xs:integer)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `((10)idiv(3)) instance of xs:integer`. . */ @org.junit.Test public void kSeqExprInstanceOf65() { final XQuery query = new XQuery( "((10)idiv(3)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `((10)mod(3)) instance of xs:integer`. . */ @org.junit.Test public void kSeqExprInstanceOf66() { final XQuery query = new XQuery( "((10)mod(3)) instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `1 instance of xs:integer*`. . */ @org.junit.Test public void kSeqExprInstanceOf7() { final XQuery query = new XQuery( "1 instance of xs:integer*", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `false() instance of xs:boolean`. . */ @org.junit.Test public void kSeqExprInstanceOf8() { final XQuery query = new XQuery( "false() instance of xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * A test whose essence is: `false() instance of xs:anyAtomicType`. . */ @org.junit.Test public void kSeqExprInstanceOf9() { final XQuery query = new XQuery( "false() instance of xs:anyAtomicType", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test an element node against type element(). . */ @org.junit.Test public void k2SeqExprInstanceOf1() { final XQuery query = new XQuery( " instance of element()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test an attribute node against type attribute(*). . */ @org.junit.Test public void k2SeqExprInstanceOf10() { final XQuery query = new XQuery( "attribute e{\"content\"} instance of attribute(*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test using element(). . */ @org.junit.Test public void k2SeqExprInstanceOf100() { final XQuery query = new XQuery( "/(b instance of element(), * instance of element())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true") ); } /** * Test an attribute node against type element(e). . */ @org.junit.Test public void k2SeqExprInstanceOf11() { final XQuery query = new XQuery( "attribute e{\"content\"} instance of element(e)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test an attribute node against type element(). . */ @org.junit.Test public void k2SeqExprInstanceOf12() { final XQuery query = new XQuery( "attribute e{\"content\"} instance of element()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test an attribute node against type element(*). . */ @org.junit.Test public void k2SeqExprInstanceOf13() { final XQuery query = new XQuery( "attribute e{\"content\"} instance of element(*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test an attribute node against type element(name). . */ @org.junit.Test public void k2SeqExprInstanceOf14() { final XQuery query = new XQuery( "attribute e{\"content\"} instance of attribute(name)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Check the return type of xs:nonPositiveInteger in a simple way. . */ @org.junit.Test public void k2SeqExprInstanceOf15() { final XQuery query = new XQuery( "xs:nonPositiveInteger(0) instance of xs:nonPositiveInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check the return type of xs:negativeInteger in a simple way. . */ @org.junit.Test public void k2SeqExprInstanceOf16() { final XQuery query = new XQuery( "xs:negativeInteger(-1) instance of xs:negativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check the return type of xs:long in a simple way. . */ @org.junit.Test public void k2SeqExprInstanceOf17() { final XQuery query = new XQuery( "xs:long(0) instance of xs:long", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check the return type of xs:int in a simple way. . */ @org.junit.Test public void k2SeqExprInstanceOf18() { final XQuery query = new XQuery( "xs:int(0) instance of xs:int", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check the return type of xs:short in a simple way. . */ @org.junit.Test public void k2SeqExprInstanceOf19() { final XQuery query = new XQuery( "xs:short(0) instance of xs:short", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test an element node against type element(*). . */ @org.junit.Test public void k2SeqExprInstanceOf2() { final XQuery query = new XQuery( " instance of element(*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check the return type of xs:byte in a simple way. . */ @org.junit.Test public void k2SeqExprInstanceOf20() { final XQuery query = new XQuery( "xs:byte(0) instance of xs:byte", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check the return type of xs:nonNegativeInteger in a simple way. . */ @org.junit.Test public void k2SeqExprInstanceOf21() { final XQuery query = new XQuery( "xs:nonNegativeInteger(0) instance of xs:nonNegativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check the return type of xs:nonNegativeInteger in a simple way. . */ @org.junit.Test public void k2SeqExprInstanceOf22() { final XQuery query = new XQuery( "xs:nonNegativeInteger(0) instance of xs:nonNegativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check the return type of xs:unsignedLong in a simple way. . */ @org.junit.Test public void k2SeqExprInstanceOf23() { final XQuery query = new XQuery( "xs:unsignedLong(0) instance of xs:unsignedLong", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check the return type of xs:unsignedInt in a simple way. . */ @org.junit.Test public void k2SeqExprInstanceOf24() { final XQuery query = new XQuery( "xs:unsignedInt(0) instance of xs:unsignedInt", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check the return type of xs:unsignedShort in a simple way. . */ @org.junit.Test public void k2SeqExprInstanceOf25() { final XQuery query = new XQuery( "xs:unsignedShort(0) instance of xs:unsignedShort", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check the return type of xs:unsignedByte in a simple way. . */ @org.junit.Test public void k2SeqExprInstanceOf26() { final XQuery query = new XQuery( "xs:unsignedByte(0) instance of xs:unsignedByte", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check the return type of xs:positiveInteger in a simple way. . */ @org.junit.Test public void k2SeqExprInstanceOf27() { final XQuery query = new XQuery( "xs:positiveInteger(1) instance of xs:positiveInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check the return type of xs:normalizedString in a simple way. . */ @org.junit.Test public void k2SeqExprInstanceOf28() { final XQuery query = new XQuery( "xs:normalizedString(\"NCName\") instance of xs:normalizedString", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check the return type of xs:token in a simple way. . */ @org.junit.Test public void k2SeqExprInstanceOf29() { final XQuery query = new XQuery( "xs:token(\"NCName\") instance of xs:token", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test an element node against type element(*). . */ @org.junit.Test public void k2SeqExprInstanceOf3() { final XQuery query = new XQuery( " instance of element(e)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check the return type of xs:language in a simple way. . */ @org.junit.Test public void k2SeqExprInstanceOf30() { final XQuery query = new XQuery( "xs:language(\"NCName\") instance of xs:language", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check the return type of xs:NMTOKEN in a simple way. . */ @org.junit.Test public void k2SeqExprInstanceOf31() { final XQuery query = new XQuery( "xs:NMTOKEN(\"NCName\") instance of xs:NMTOKEN", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check the return type of xs:Name in a simple way. . */ @org.junit.Test public void k2SeqExprInstanceOf32() { final XQuery query = new XQuery( "xs:Name(\"NCName\") instance of xs:Name", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check the return type of xs:NCName in a simple way. . */ @org.junit.Test public void k2SeqExprInstanceOf33() { final XQuery query = new XQuery( "xs:NCName(\"NCName\") instance of xs:NCName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check the return type of xs:ID in a simple way. . */ @org.junit.Test public void k2SeqExprInstanceOf34() { final XQuery query = new XQuery( "xs:ID(\"NCName\") instance of xs:ID", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check the return type of xs:IDREF in a simple way. . */ @org.junit.Test public void k2SeqExprInstanceOf35() { final XQuery query = new XQuery( "xs:IDREF(\"NCName\") instance of xs:IDREF", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check the return type of xs:ENTITY in a simple way. . */ @org.junit.Test public void k2SeqExprInstanceOf36() { final XQuery query = new XQuery( "xs:ENTITY(\"NCName\") instance of xs:ENTITY", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that xs:normalizedString has the correct parent type. . */ @org.junit.Test public void k2SeqExprInstanceOf37() { final XQuery query = new XQuery( "xs:normalizedString(\"ncname\") instance of xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that xs:token has the correct parent type. . */ @org.junit.Test public void k2SeqExprInstanceOf38() { final XQuery query = new XQuery( "xs:token(\"ncname\") instance of xs:normalizedString", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that xs:language has the correct parent type. . */ @org.junit.Test public void k2SeqExprInstanceOf39() { final XQuery query = new XQuery( "xs:language(\"ncname\") instance of xs:token", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test an element node against type element(name). . */ @org.junit.Test public void k2SeqExprInstanceOf4() { final XQuery query = new XQuery( " instance of element(name)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Check that xs:NMTOKEN has the correct parent type. . */ @org.junit.Test public void k2SeqExprInstanceOf40() { final XQuery query = new XQuery( "xs:NMTOKEN(\"ncname\") instance of xs:token", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that xs:Name has the correct parent type. . */ @org.junit.Test public void k2SeqExprInstanceOf41() { final XQuery query = new XQuery( "xs:Name(\"ncname\") instance of xs:token", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that xs:NCName has the correct parent type. . */ @org.junit.Test public void k2SeqExprInstanceOf42() { final XQuery query = new XQuery( "xs:NCName(\"ncname\") instance of xs:Name", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that xs:ID has the correct parent type. . */ @org.junit.Test public void k2SeqExprInstanceOf43() { final XQuery query = new XQuery( "xs:ID(\"ncname\") instance of xs:NCName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that xs:IDREF has the correct parent type. . */ @org.junit.Test public void k2SeqExprInstanceOf44() { final XQuery query = new XQuery( "xs:IDREF(\"ncname\") instance of xs:NCName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that xs:ENTITY has the correct parent type. . */ @org.junit.Test public void k2SeqExprInstanceOf45() { final XQuery query = new XQuery( "xs:ENTITY(\"ncname\") instance of xs:NCName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that xs:nonPositiveInteger has the correct parent type. . */ @org.junit.Test public void k2SeqExprInstanceOf46() { final XQuery query = new XQuery( "xs:nonPositiveInteger(\"0\") instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that xs:negativeInteger has the correct parent type. . */ @org.junit.Test public void k2SeqExprInstanceOf47() { final XQuery query = new XQuery( "xs:negativeInteger(\"-1\") instance of xs:nonPositiveInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that xs:long has the correct parent type. . */ @org.junit.Test public void k2SeqExprInstanceOf48() { final XQuery query = new XQuery( "xs:long(\"0\") instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that xs:int has the correct parent type. . */ @org.junit.Test public void k2SeqExprInstanceOf49() { final XQuery query = new XQuery( "xs:int(\"0\") instance of xs:long", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test an element node against type attribute(). . */ @org.junit.Test public void k2SeqExprInstanceOf5() { final XQuery query = new XQuery( " instance of attribute()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Check that xs:short has the correct parent type. . */ @org.junit.Test public void k2SeqExprInstanceOf50() { final XQuery query = new XQuery( "xs:short(\"0\") instance of xs:int", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that xs:byte has the correct parent type. . */ @org.junit.Test public void k2SeqExprInstanceOf51() { final XQuery query = new XQuery( "xs:byte(\"0\") instance of xs:short", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that xs:nonNegativeInteger has the correct parent type. . */ @org.junit.Test public void k2SeqExprInstanceOf52() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"0\") instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that xs:unsignedLong has the correct parent type. . */ @org.junit.Test public void k2SeqExprInstanceOf53() { final XQuery query = new XQuery( "xs:unsignedLong(\"0\") instance of xs:nonNegativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that xs:unsignedInt has the correct parent type. . */ @org.junit.Test public void k2SeqExprInstanceOf54() { final XQuery query = new XQuery( "xs:unsignedInt(\"0\") instance of xs:unsignedLong", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that xs:unsignedShort has the correct parent type. . */ @org.junit.Test public void k2SeqExprInstanceOf55() { final XQuery query = new XQuery( "xs:unsignedShort(\"0\") instance of xs:unsignedInt", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that xs:unsignedByte has the correct parent type. . */ @org.junit.Test public void k2SeqExprInstanceOf56() { final XQuery query = new XQuery( "xs:unsignedByte(\"0\") instance of xs:unsignedShort", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that xs:positiveInteger has the correct parent type. . */ @org.junit.Test public void k2SeqExprInstanceOf57() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") instance of xs:nonNegativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Check that xs:nonNegativeInteger is not a child of nonPositiveInteger. . */ @org.junit.Test public void k2SeqExprInstanceOf58() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"1\") instance of xs:nonPositiveInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Check that xs:nonNegativeInteger is not a child of negativeInteger. . */ @org.junit.Test public void k2SeqExprInstanceOf59() { final XQuery query = new XQuery( "xs:nonNegativeInteger(\"1\") instance of xs:negativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test an element node against type attribute(*). . */ @org.junit.Test public void k2SeqExprInstanceOf6() { final XQuery query = new XQuery( " instance of attribute(*)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Check that xs:positiveInteger is not a child of negativeInteger. . */ @org.junit.Test public void k2SeqExprInstanceOf60() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") instance of xs:negativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Check that xs:positiveInteger is not a child of nonPositiveInteger. . */ @org.junit.Test public void k2SeqExprInstanceOf61() { final XQuery query = new XQuery( "xs:positiveInteger(\"1\") instance of xs:nonPositiveInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Check that xs:long is not a child of negativeInteger. . */ @org.junit.Test public void k2SeqExprInstanceOf62() { final XQuery query = new XQuery( "xs:long(\"1\") instance of xs:negativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Check that xs:long is not a child of nonPositiveInteger. . */ @org.junit.Test public void k2SeqExprInstanceOf63() { final XQuery query = new XQuery( "xs:long(\"1\") instance of xs:nonPositiveInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Check that xs:long is not a child of nonNegativeInteger. . */ @org.junit.Test public void k2SeqExprInstanceOf64() { final XQuery query = new XQuery( "xs:long(\"1\") instance of xs:nonNegativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Check that xs:long is not a child of positiveInteger. . */ @org.junit.Test public void k2SeqExprInstanceOf65() { final XQuery query = new XQuery( "xs:long(\"1\") instance of xs:positiveInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Check that xs:token is not a child of xs:NCName. . */ @org.junit.Test public void k2SeqExprInstanceOf66() { final XQuery query = new XQuery( "xs:token(\"ncname\") instance of xs:NCName", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Check that xs:ID is not a child of xs:NCName. . */ @org.junit.Test public void k2SeqExprInstanceOf67() { final XQuery query = new XQuery( "xs:ID(\"ncname\") instance of xs:IDREF", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Check that xs:ENTITY is not a child of xs:NCName. . */ @org.junit.Test public void k2SeqExprInstanceOf68() { final XQuery query = new XQuery( "xs:ENTITY(\"ncname\") instance of xs:IDREF", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Check that xs:language is not a child of xs:NMTOKEN. . */ @org.junit.Test public void k2SeqExprInstanceOf69() { final XQuery query = new XQuery( "xs:language(\"ncname\") instance of xs:NMTOKEN", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Test an element node against type attribute(e). . */ @org.junit.Test public void k2SeqExprInstanceOf7() { final XQuery query = new XQuery( " instance of attribute(e)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Check that xs:Name is not a child of xs:language. . */ @org.junit.Test public void k2SeqExprInstanceOf70() { final XQuery query = new XQuery( "xs:Name(\"ncname\") instance of xs:language", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Check that xs:normalizedString is not a child of xs:token. . */ @org.junit.Test public void k2SeqExprInstanceOf71() { final XQuery query = new XQuery( "xs:normalizedString(\"ncname\") instance of xs:token", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Ensure a name test with the attribute axis gets the correct type. . */ @org.junit.Test public void k2SeqExprInstanceOf72() { final XQuery query = new XQuery( "/attribute::a instance of attribute(a)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure a name test with the abbreviated attribute axis gets the correct type. . */ @org.junit.Test public void k2SeqExprInstanceOf73() { final XQuery query = new XQuery( "/@a instance of attribute(a)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that a cast to xs:byte is of the right type, when casting from xs:double. . */ @org.junit.Test public void k2SeqExprInstanceOf74() { final XQuery query = new XQuery( "xs:byte(xs:double(\"1\")) instance of xs:byte", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that a cast to xs:nonPositiveInteger is of the right type, when casting from xs:double. . */ @org.junit.Test public void k2SeqExprInstanceOf75() { final XQuery query = new XQuery( "xs:nonPositiveInteger(xs:double(\"0\")) instance of xs:nonPositiveInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that a cast to xs:negativeInteger is of the right type, when casting from xs:double. . */ @org.junit.Test public void k2SeqExprInstanceOf76() { final XQuery query = new XQuery( "xs:negativeInteger(xs:double(\"-4\")) instance of xs:negativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that a cast to xs:long is of the right type, when casting from xs:double. . */ @org.junit.Test public void k2SeqExprInstanceOf77() { final XQuery query = new XQuery( "xs:long(xs:double(\"-4\")) instance of xs:long", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that a cast to xs:int is of the right type, when casting from xs:double. . */ @org.junit.Test public void k2SeqExprInstanceOf78() { final XQuery query = new XQuery( "xs:int(xs:double(\"-4\")) instance of xs:int", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that a cast to xs:short is of the right type, when casting from xs:double. . */ @org.junit.Test public void k2SeqExprInstanceOf79() { final XQuery query = new XQuery( "xs:short(xs:double(\"-4\")) instance of xs:short", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test an attribute node against type element(name). . */ @org.junit.Test public void k2SeqExprInstanceOf8() { final XQuery query = new XQuery( "attribute e{\"content\"} instance of attribute(e)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that a cast to xs:nonNegativeInteger is of the right type, when casting from xs:double. . */ @org.junit.Test public void k2SeqExprInstanceOf80() { final XQuery query = new XQuery( "xs:nonNegativeInteger(xs:double(\"4\")) instance of xs:nonNegativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that a cast to xs:unsignedLong is of the right type, when casting from xs:double. . */ @org.junit.Test public void k2SeqExprInstanceOf81() { final XQuery query = new XQuery( "xs:unsignedLong(xs:double(\"4\")) instance of xs:unsignedLong", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that a cast to xs:unsignedInt is of the right type, when casting from xs:double. . */ @org.junit.Test public void k2SeqExprInstanceOf82() { final XQuery query = new XQuery( "xs:unsignedInt(xs:double(\"4\")) instance of xs:unsignedInt", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that a cast to xs:unsignedShort is of the right type, when casting from xs:double. . */ @org.junit.Test public void k2SeqExprInstanceOf83() { final XQuery query = new XQuery( "xs:unsignedShort(xs:double(\"4\")) instance of xs:unsignedShort", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that a cast to xs:unsignedByte is of the right type, when casting from xs:double. . */ @org.junit.Test public void k2SeqExprInstanceOf84() { final XQuery query = new XQuery( "xs:unsignedByte(xs:double(\"4\")) instance of xs:unsignedByte", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that a cast to xs:positiveInteger is of the right type, when casting from xs:double. . */ @org.junit.Test public void k2SeqExprInstanceOf85() { final XQuery query = new XQuery( "xs:positiveInteger(xs:double(\"4\")) instance of xs:positiveInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that a cast to xs:byte is of the right type, when casting from xs:float. . */ @org.junit.Test public void k2SeqExprInstanceOf86() { final XQuery query = new XQuery( "xs:byte(xs:float(\"1\")) instance of xs:byte", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that a cast to xs:nonPositiveInteger is of the right type, when casting from xs:float. . */ @org.junit.Test public void k2SeqExprInstanceOf87() { final XQuery query = new XQuery( "xs:nonPositiveInteger(xs:float(\"0\")) instance of xs:nonPositiveInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that a cast to xs:negativeInteger is of the right type, when casting from xs:float. . */ @org.junit.Test public void k2SeqExprInstanceOf88() { final XQuery query = new XQuery( "xs:negativeInteger(xs:float(\"-4\")) instance of xs:negativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that a cast to xs:long is of the right type, when casting from xs:float. . */ @org.junit.Test public void k2SeqExprInstanceOf89() { final XQuery query = new XQuery( "xs:long(xs:float(\"-4\")) instance of xs:long", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test an attribute node against type attribute(). . */ @org.junit.Test public void k2SeqExprInstanceOf9() { final XQuery query = new XQuery( "attribute e{\"content\"} instance of attribute()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that a cast to xs:int is of the right type, when casting from xs:float. . */ @org.junit.Test public void k2SeqExprInstanceOf90() { final XQuery query = new XQuery( "xs:int(xs:float(\"-4\")) instance of xs:int", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that a cast to xs:short is of the right type, when casting from xs:float. . */ @org.junit.Test public void k2SeqExprInstanceOf91() { final XQuery query = new XQuery( "xs:short(xs:float(\"-4\")) instance of xs:short", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that a cast to xs:nonNegativeInteger is of the right type, when casting from xs:float. . */ @org.junit.Test public void k2SeqExprInstanceOf92() { final XQuery query = new XQuery( "xs:nonNegativeInteger(xs:float(\"4\")) instance of xs:nonNegativeInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that a cast to xs:unsignedLong is of the right type, when casting from xs:float. . */ @org.junit.Test public void k2SeqExprInstanceOf93() { final XQuery query = new XQuery( "xs:unsignedLong(xs:float(\"4\")) instance of xs:unsignedLong", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that a cast to xs:unsignedInt is of the right type, when casting from xs:float. . */ @org.junit.Test public void k2SeqExprInstanceOf94() { final XQuery query = new XQuery( "xs:unsignedInt(xs:float(\"4\")) instance of xs:unsignedInt", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that a cast to xs:unsignedShort is of the right type, when casting from xs:float. . */ @org.junit.Test public void k2SeqExprInstanceOf95() { final XQuery query = new XQuery( "xs:unsignedShort(xs:float(\"4\")) instance of xs:unsignedShort", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that a cast to xs:unsignedByte is of the right type, when casting from xs:float. . */ @org.junit.Test public void k2SeqExprInstanceOf96() { final XQuery query = new XQuery( "xs:unsignedByte(xs:float(\"4\")) instance of xs:unsignedByte", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Ensure that a cast to xs:positiveInteger is of the right type, when casting from xs:float. . */ @org.junit.Test public void k2SeqExprInstanceOf97() { final XQuery query = new XQuery( "xs:positiveInteger(xs:float(\"4\")) instance of xs:positiveInteger", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Instance of involving empty-sequence(). . */ @org.junit.Test public void k2SeqExprInstanceOf98() { final XQuery query = new XQuery( "node-name(text {\"\"}) instance of empty-sequence()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Test using attribute(). . */ @org.junit.Test public void k2SeqExprInstanceOf99() { final XQuery query = new XQuery( "/(@attr instance of attribute(), @* instance of attribute())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true true") ); } /** * Test that the types of variables are correctly preserved on the stack. . */ @org.junit.Test public void cbclInstanceOf001() { final XQuery query = new XQuery( "\n" + " for $x in (xs:integer(1), xs:decimal(1)) return (((($x + 1) * 2) - 1) instance of xs:integer)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true false") ); } /** * purpose: Evaluation of "instance of" expression for pattern "dateTime instance of xs:dateTime". . */ @org.junit.Test public void instanceof1() { final XQuery query = new XQuery( "xs:dateTime(\"2002-04-02T12:00:00Z\") instance of xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * purpose: Evaluation of "instance of" expression for pattern "dateTime instance of xs:integer". . */ @org.junit.Test public void instanceof10() { final XQuery query = new XQuery( "xs:dateTime(\"2002-04-02T12:00:00Z\") instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "integer instance of xs:dateTime". . */ @org.junit.Test public void instanceof100() { final XQuery query = new XQuery( "12678967543233 instance of xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "integer instance of xs:time". . */ @org.junit.Test public void instanceof101() { final XQuery query = new XQuery( "12678967543233 instance of xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "integer instance of xs:date". . */ @org.junit.Test public void instanceof102() { final XQuery query = new XQuery( "12678967543233 instance of xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "integer instance of xs:boolean". . */ @org.junit.Test public void instanceof103() { final XQuery query = new XQuery( "12678967543233 instance of xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "integer instance of xs:float". . */ @org.junit.Test public void instanceof104() { final XQuery query = new XQuery( "12678967543233 instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "integer instance of xs:double". . */ @org.junit.Test public void instanceof105() { final XQuery query = new XQuery( "12678967543233 instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "integer instance of xs:anyURI". . */ @org.junit.Test public void instanceof106() { final XQuery query = new XQuery( "12678967543233 instance of xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "integer instance of xs:string". . */ @org.junit.Test public void instanceof107() { final XQuery query = new XQuery( "12678967543233 instance of xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "integer instance of xs:decimal". . */ @org.junit.Test public void instanceof108() { final XQuery query = new XQuery( "12678967543233 instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * purpose: Evaluation of "instance of" expression for pattern "integer instance of xs:integer". . */ @org.junit.Test public void instanceof109() { final XQuery query = new XQuery( "12678967543233 instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * purpose: Evaluation of "instance of" expression for pattern "dateTime instance of xs:int". . */ @org.junit.Test public void instanceof11() { final XQuery query = new XQuery( "xs:dateTime(\"2002-04-02T12:00:00Z\") instance of xs:int", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "integer instance of xs:int". . */ @org.junit.Test public void instanceof110() { final XQuery query = new XQuery( "12678967543233 instance of xs:int", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Test that a value is not testable as an instance of a list type. . */ @org.junit.Test public void instanceof111() { final XQuery query = new XQuery( "xs:NMTOKEN('abc') instance of xs:NMTOKENS", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0051") ); } /** * purpose: Evaluation of "instance of" expression for pattern "time instance of xs:dateTime". . */ @org.junit.Test public void instanceof12() { final XQuery query = new XQuery( "xs:time(\"13:20:10.5Z\") instance of xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Instance of with function types. */ @org.junit.Test public void instanceof121() { final XQuery query = new XQuery( "\n" + " name#1 instance of function(*)\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Instance of with function types. */ @org.junit.Test public void instanceof122() { final XQuery query = new XQuery( "\n" + " name#1 instance of function(node()?) as xs:string\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Instance of with function types. */ @org.junit.Test public void instanceof123() { final XQuery query = new XQuery( "\n" + " name#1 instance of function(node()) as xs:string\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Instance of with function types. */ @org.junit.Test public void instanceof124() { final XQuery query = new XQuery( "\n" + " name#1 instance of function(element(A)?) as xs:string\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Instance of with function types. */ @org.junit.Test public void instanceof125() { final XQuery query = new XQuery( "\n" + " name#1 instance of function(element(A)) as xs:string\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Instance of with function types. */ @org.junit.Test public void instanceof126() { final XQuery query = new XQuery( "\n" + " name#1 instance of function(element(A)) as xs:anyAtomicType\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Instance of with function types. */ @org.junit.Test public void instanceof127() { final XQuery query = new XQuery( "\n" + " name#1 instance of function(element(A)) as xs:string+\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Instance of with function types. */ @org.junit.Test public void instanceof128() { final XQuery query = new XQuery( "\n" + " name#1 instance of function(element(A)) as xs:NCName\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Instance of with function types. */ @org.junit.Test public void instanceof129() { final XQuery query = new XQuery( "\n" + " name#1 instance of function(node()*) as xs:string\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "time instance of xs:time". . */ @org.junit.Test public void instanceof13() { final XQuery query = new XQuery( "xs:time(\"13:20:10.5Z\") instance of xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Instance of with function types. */ @org.junit.Test public void instanceof130() { final XQuery query = new XQuery( "\n" + " name#1 instance of function(item()) as xs:string\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Instance of with function types. */ @org.junit.Test public void instanceof131() { final XQuery query = new XQuery( "\n" + " name#0 instance of function(item()) as xs:string\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Instance of with function types. */ @org.junit.Test public void instanceof132() { final XQuery query = new XQuery( "\n" + " filter#2 instance of function(function(item()) as xs:boolean, item()*) as item()*\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Instance of with function types. */ @org.junit.Test public void instanceof133() { final XQuery query = new XQuery( "\n" + " filter#2 instance of function(function(item()*) as xs:boolean, item()*) as item()*\n" + " ", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * purpose: Evaluation of "instance of" expression for pattern "time instance of xs:date". . */ @org.junit.Test public void instanceof14() { final XQuery query = new XQuery( "xs:time(\"13:20:10.5Z\") instance of xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "time instance of xs:boolean". . */ @org.junit.Test public void instanceof15() { final XQuery query = new XQuery( "xs:time(\"13:20:10.5Z\") instance of xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "time instance of xs:float". . */ @org.junit.Test public void instanceof16() { final XQuery query = new XQuery( "xs:time(\"13:20:10.5Z\") instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "time instance of xs:double". . */ @org.junit.Test public void instanceof17() { final XQuery query = new XQuery( "xs:time(\"13:20:10.5Z\") instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "time instance of xs:anyURI". . */ @org.junit.Test public void instanceof18() { final XQuery query = new XQuery( "xs:time(\"13:20:10.5Z\") instance of xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "time instance of xs:string". . */ @org.junit.Test public void instanceof19() { final XQuery query = new XQuery( "xs:time(\"13:20:10.5Z\") instance of xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "dateTime instance of xs:time". . */ @org.junit.Test public void instanceof2() { final XQuery query = new XQuery( "xs:dateTime(\"2002-04-02T12:00:00Z\") instance of xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "time instance of xs:decimal". . */ @org.junit.Test public void instanceof20() { final XQuery query = new XQuery( "xs:time(\"13:20:10.5Z\") instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "time instance of xs:integer". . */ @org.junit.Test public void instanceof21() { final XQuery query = new XQuery( "xs:time(\"13:20:10.5Z\") instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "time instance of xs:int". . */ @org.junit.Test public void instanceof22() { final XQuery query = new XQuery( "xs:time(\"13:20:10.5Z\") instance of xs:int", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "date instance of xs:dateTime". . */ @org.junit.Test public void instanceof23() { final XQuery query = new XQuery( "xs:date(\"2000-01-01+05:00\") instance of xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "date instance of xs:time". . */ @org.junit.Test public void instanceof24() { final XQuery query = new XQuery( "xs:date(\"2000-01-01+05:00\") instance of xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "date instance of xs:date". . */ @org.junit.Test public void instanceof25() { final XQuery query = new XQuery( "xs:date(\"2000-01-01+05:00\") instance of xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * purpose: Evaluation of "instance of" expression for pattern "date instance of xs:boolean". . */ @org.junit.Test public void instanceof26() { final XQuery query = new XQuery( "xs:date(\"2000-01-01+05:00\") instance of xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "date instance of xs:float". . */ @org.junit.Test public void instanceof27() { final XQuery query = new XQuery( "xs:date(\"2000-01-01+05:00\") instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "date instance of xs:double". . */ @org.junit.Test public void instanceof28() { final XQuery query = new XQuery( "xs:date(\"2000-01-01+05:00\") instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "date instance of xs:anyURI". . */ @org.junit.Test public void instanceof29() { final XQuery query = new XQuery( "xs:date(\"2000-01-01+05:00\") instance of xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "dateTime instance of xs:date". . */ @org.junit.Test public void instanceof3() { final XQuery query = new XQuery( "xs:dateTime(\"2002-04-02T12:00:00Z\") instance of xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "date instance of xs:string". . */ @org.junit.Test public void instanceof30() { final XQuery query = new XQuery( "xs:date(\"2000-01-01+05:00\") instance of xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "date instance of xs:decimal". . */ @org.junit.Test public void instanceof31() { final XQuery query = new XQuery( "xs:date(\"2000-01-01+05:00\") instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "date instance of xs:integer". . */ @org.junit.Test public void instanceof32() { final XQuery query = new XQuery( "xs:date(\"2000-01-01+05:00\") instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "date instance of xs:int". . */ @org.junit.Test public void instanceof33() { final XQuery query = new XQuery( "xs:date(\"2000-01-01+05:00\") instance of xs:int", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "boolean instance of xs:dateTime". . */ @org.junit.Test public void instanceof34() { final XQuery query = new XQuery( "xs:boolean(\"true\") instance of xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "boolean instance of xs:time". . */ @org.junit.Test public void instanceof35() { final XQuery query = new XQuery( "xs:boolean(\"true\") instance of xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "boolean instance of xs:date". . */ @org.junit.Test public void instanceof36() { final XQuery query = new XQuery( "xs:boolean(\"true\") instance of xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "boolean instance of xs:boolean". . */ @org.junit.Test public void instanceof37() { final XQuery query = new XQuery( "xs:boolean(\"true\") instance of xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * purpose: Evaluation of "instance of" expression for pattern "boolean instance of xs:float". . */ @org.junit.Test public void instanceof38() { final XQuery query = new XQuery( "xs:boolean(\"true\") instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "boolean instance of xs:double". . */ @org.junit.Test public void instanceof39() { final XQuery query = new XQuery( "xs:boolean(\"true\") instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "dateTime instance of xs:boolean". . */ @org.junit.Test public void instanceof4() { final XQuery query = new XQuery( "xs:dateTime(\"2002-04-02T12:00:00Z\") instance of xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "boolean instance of xs:anyURI". . */ @org.junit.Test public void instanceof40() { final XQuery query = new XQuery( "xs:boolean(\"true\") instance of xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "boolean instance of xs:string". . */ @org.junit.Test public void instanceof41() { final XQuery query = new XQuery( "xs:boolean(\"true\") instance of xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "boolean instance of xs:decimal". . */ @org.junit.Test public void instanceof42() { final XQuery query = new XQuery( "xs:boolean(\"true\") instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "boolean instance of xs:integer". . */ @org.junit.Test public void instanceof43() { final XQuery query = new XQuery( "xs:boolean(\"true\") instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "boolean instance of xs:int". . */ @org.junit.Test public void instanceof44() { final XQuery query = new XQuery( "xs:boolean(\"true\") instance of xs:int", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "float instance of xs:dateTime". . */ @org.junit.Test public void instanceof45() { final XQuery query = new XQuery( "1267.43233E12 instance of xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "float instance of xs:time". . */ @org.junit.Test public void instanceof46() { final XQuery query = new XQuery( "1267.43233E12 instance of xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "float instance of xs:date". . */ @org.junit.Test public void instanceof47() { final XQuery query = new XQuery( "1267.43233E12 instance of xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "float instance of xs:boolean". . */ @org.junit.Test public void instanceof48() { final XQuery query = new XQuery( "1267.43233E12 instance of xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "float instance of xs:float". . */ @org.junit.Test public void instanceof49() { final XQuery query = new XQuery( "1267.43233E12 instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "dateTime instance of xs:float". . */ @org.junit.Test public void instanceof5() { final XQuery query = new XQuery( "xs:dateTime(\"2002-04-02T12:00:00Z\") instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "float instance of xs:double". . */ @org.junit.Test public void instanceof50() { final XQuery query = new XQuery( "1267.43233E12 instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * purpose: Evaluation of "instance of" expression for pattern "float instance of xs:anyURI". . */ @org.junit.Test public void instanceof51() { final XQuery query = new XQuery( "1267.43233E12 instance of xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "float instance of xs:string". . */ @org.junit.Test public void instanceof52() { final XQuery query = new XQuery( "1267.43233E12 instance of xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "float instance of xs:decimal". . */ @org.junit.Test public void instanceof53() { final XQuery query = new XQuery( "1267.43233E12 instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "float instance of xs:integer". . */ @org.junit.Test public void instanceof54() { final XQuery query = new XQuery( "1267.43233E12 instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "float instance of xs:int". . */ @org.junit.Test public void instanceof55() { final XQuery query = new XQuery( "1267.43233E12 instance of xs:int", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "double instance of xs:dateTime". . */ @org.junit.Test public void instanceof56() { final XQuery query = new XQuery( "1267.43233E12 instance of xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "double instance of xs:time". . */ @org.junit.Test public void instanceof57() { final XQuery query = new XQuery( "1267.43233E12 instance of xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "double instance of xs:date". . */ @org.junit.Test public void instanceof58() { final XQuery query = new XQuery( "1267.43233E12 instance of xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "double instance of xs:boolean". . */ @org.junit.Test public void instanceof59() { final XQuery query = new XQuery( "1267.43233E12 instance of xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "dateTime instance of xs:double". . */ @org.junit.Test public void instanceof6() { final XQuery query = new XQuery( "xs:dateTime(\"2002-04-02T12:00:00Z\") instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "double instance of xs:float". . */ @org.junit.Test public void instanceof60() { final XQuery query = new XQuery( "1267.43233E12 instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "double instance of xs:double". . */ @org.junit.Test public void instanceof61() { final XQuery query = new XQuery( "1267.43233E12 instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * purpose: Evaluation of "instance of" expression for pattern "double instance of xs:anyURI". . */ @org.junit.Test public void instanceof62() { final XQuery query = new XQuery( "1267.43233E12 instance of xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "double instance of xs:string". . */ @org.junit.Test public void instanceof63() { final XQuery query = new XQuery( "1267.43233E12 instance of xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "double instance of xs:decimal". . */ @org.junit.Test public void instanceof64() { final XQuery query = new XQuery( "1267.43233E12 instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "double instance of xs:integer". . */ @org.junit.Test public void instanceof65() { final XQuery query = new XQuery( "1267.43233E12 instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "double instance of xs:int". . */ @org.junit.Test public void instanceof66() { final XQuery query = new XQuery( "1267.43233E12 instance of xs:int", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "anyURI instance of xs:dateTime". . */ @org.junit.Test public void instanceof67() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com\") instance of xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "anyURI instance of xs:time". . */ @org.junit.Test public void instanceof68() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com\") instance of xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "anyURI instance of xs:date". . */ @org.junit.Test public void instanceof69() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com\") instance of xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "dateTime instance of xs:anyURI". . */ @org.junit.Test public void instanceof7() { final XQuery query = new XQuery( "xs:dateTime(\"2002-04-02T12:00:00Z\") instance of xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "anyURI instance of xs:boolean". . */ @org.junit.Test public void instanceof70() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com\") instance of xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "anyURI instance of xs:float". . */ @org.junit.Test public void instanceof71() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com\") instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "anyURI instance of xs:double". . */ @org.junit.Test public void instanceof72() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com\") instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "anyURI instance of xs:anyURI". . */ @org.junit.Test public void instanceof73() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com\") instance of xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * purpose: Evaluation of "instance of" expression for pattern "anyURI instance of xs:string". . */ @org.junit.Test public void instanceof74() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com\") instance of xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "anyURI instance of xs:decimal". . */ @org.junit.Test public void instanceof75() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com\") instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "anyURI instance of xs:integer". . */ @org.junit.Test public void instanceof76() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com\") instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "anyURI instance of xs:int". . */ @org.junit.Test public void instanceof77() { final XQuery query = new XQuery( "xs:anyURI(\"http://www.example.com\") instance of xs:int", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "string instance of xs:dateTime". . */ @org.junit.Test public void instanceof78() { final XQuery query = new XQuery( "\"A String Function\" instance of xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "string instance of xs:time". . */ @org.junit.Test public void instanceof79() { final XQuery query = new XQuery( "\"A String Function\" instance of xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "dateTime instance of xs:string". . */ @org.junit.Test public void instanceof8() { final XQuery query = new XQuery( "xs:dateTime(\"2002-04-02T12:00:00Z\") instance of xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "string instance of xs:date". . */ @org.junit.Test public void instanceof80() { final XQuery query = new XQuery( "\"A String Function\" instance of xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "string instance of xs:boolean". . */ @org.junit.Test public void instanceof81() { final XQuery query = new XQuery( "\"A String Function\" instance of xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "string instance of xs:float". . */ @org.junit.Test public void instanceof82() { final XQuery query = new XQuery( "\"A String Function\" instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "string instance of xs:double". . */ @org.junit.Test public void instanceof83() { final XQuery query = new XQuery( "\"A String Function\" instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "string instance of xs:anyURI". . */ @org.junit.Test public void instanceof84() { final XQuery query = new XQuery( "\"A String Function\" instance of xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "string instance of xs:string". . */ @org.junit.Test public void instanceof85() { final XQuery query = new XQuery( "\"A String Function\" instance of xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * purpose: Evaluation of "instance of" expression for pattern "string instance of xs:decimal". . */ @org.junit.Test public void instanceof86() { final XQuery query = new XQuery( "\"A String Function\" instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "string instance of xs:integer". . */ @org.junit.Test public void instanceof87() { final XQuery query = new XQuery( "\"A String Function\" instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "string instance of xs:int". . */ @org.junit.Test public void instanceof88() { final XQuery query = new XQuery( "\"A String Function\" instance of xs:int", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "decimal instance of xs:dateTime". . */ @org.junit.Test public void instanceof89() { final XQuery query = new XQuery( "12678967.543233 instance of xs:dateTime", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "dateTime instance of xs:decimal". . */ @org.junit.Test public void instanceof9() { final XQuery query = new XQuery( "xs:dateTime(\"2002-04-02T12:00:00Z\") instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "decimal instance of xs:time". . */ @org.junit.Test public void instanceof90() { final XQuery query = new XQuery( "12678967.543233 instance of xs:time", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "decimal instance of xs:date". . */ @org.junit.Test public void instanceof91() { final XQuery query = new XQuery( "12678967.543233 instance of xs:date", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "decimal instance of xs:boolean". . */ @org.junit.Test public void instanceof92() { final XQuery query = new XQuery( "12678967.543233 instance of xs:boolean", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "decimal instance of xs:float". . */ @org.junit.Test public void instanceof93() { final XQuery query = new XQuery( "12678967.543233 instance of xs:float", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "decimal instance of xs:double". . */ @org.junit.Test public void instanceof94() { final XQuery query = new XQuery( "12678967.543233 instance of xs:double", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "decimal instance of xs:anyURI". . */ @org.junit.Test public void instanceof95() { final XQuery query = new XQuery( "12678967.543233 instance of xs:anyURI", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "decimal instance of xs:string". . */ @org.junit.Test public void instanceof96() { final XQuery query = new XQuery( "12678967.543233 instance of xs:string", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "decimal instance of xs:decimal". . */ @org.junit.Test public void instanceof97() { final XQuery query = new XQuery( "12678967.543233 instance of xs:decimal", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * purpose: Evaluation of "instance of" expression for pattern "decimal instance of xs:integer". . */ @org.junit.Test public void instanceof98() { final XQuery query = new XQuery( "12678967.543233 instance of xs:integer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * purpose: Evaluation of "instance of" expression for pattern "decimal instance of xs:int". . */ @org.junit.Test public void instanceof99() { final XQuery query = new XQuery( "12678967.543233 instance of xs:int", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } } basex-7.7.2/basex-tests/src/test/java/org/basex/test/qt3ts/prod/ProdLetClause.java000066400000000000000000001615011222453003200300220ustar00rootroot00000000000000package org.basex.test.qt3ts.prod; import org.basex.tests.bxapi.XQuery; import org.basex.test.qt3ts.QT3TestSet; /** * Tests for the LetClause production (or the LetExpr in XPath 3.0). * * @author BaseX Team 2005-12, BSD License * @author Leo Woerteler */ @SuppressWarnings("all") public class ProdLetClause extends QT3TestSet { /** * A 'let' variable is out-of-scope due to FLWOR has higher precendence than the comma operator. . */ @org.junit.Test public void kLetExprWithout1() { final XQuery query = new XQuery( "let $i := 5, $j := 20 * $i return $i, $j", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * A value in a 'let' variable cannot be assigned to with '=', it must be ':='. . */ @org.junit.Test public void kLetExprWithout2() { final XQuery query = new XQuery( "let $i = 5 return 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A value in a 'let' variable cannot be assigned to with 'in', it must be ':='. . */ @org.junit.Test public void kLetExprWithout3() { final XQuery query = new XQuery( "let $i in 5 return 3", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * A binding in a let-expression shadows global variables. . */ @org.junit.Test public void kLetExprWithout4() { final XQuery query = new XQuery( "\n" + " declare variable $i := false(); \n" + " declare variable $t := false(); \n" + " deep-equal((let $i := true(), $t := true() return ($i, $t)), (true(), true()))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * fn:deep-equal combined with a for/let expression. . */ @org.junit.Test public void k2LetExprWithout1() { final XQuery query = new XQuery( "deep-equal((, , , ), (for $v1 in (1, 2, 3, 4) let $v2 := return ($v2))/.)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * let-declarations doesn't cause numeric promotion(#2). . */ @org.junit.Test public void k2LetExprWithout10() { final XQuery query = new XQuery( "let $i as xs:double := 1.1 return $i", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * let-declarations doesn't cause numeric promotion(#3). . */ @org.junit.Test public void k2LetExprWithout11() { final XQuery query = new XQuery( "let $i as xs:float := 1 return $i", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * let-declarations doesn't cause numeric promotion(#4). . */ @org.junit.Test public void k2LetExprWithout12() { final XQuery query = new XQuery( "let $i as xs:double := 1 return $i", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * let-declarations doesn't cause numeric promotion(#5). . */ @org.junit.Test public void k2LetExprWithout13() { final XQuery query = new XQuery( "let $i as xs:double := xs:float(3) return $i", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * let-declarations doesn't cause string promotion conversion. . */ @org.junit.Test public void k2LetExprWithout14() { final XQuery query = new XQuery( "let $i as xs:string := xs:untypedAtomic(\"a string\") return $i", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * let-declarations doesn't cause URI promotion conversion. . */ @org.junit.Test public void k2LetExprWithout15() { final XQuery query = new XQuery( "let $i as xs:string := xs:anyURI(\"http://www.example.com/\") return $i", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Ensure node identity is properly handled through a for binding. . */ @org.junit.Test public void k2LetExprWithout16() { final XQuery query = new XQuery( "declare variable $e := ; for $i in (, $e, ) return $i is $e", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "false true false") ); } /** * Ensure a name test is reported for using the undefined focus, when appearing as a child of a let binding. However, since the let body is the empty sequence, it does not have to be evaluated. . */ @org.junit.Test public void k2LetExprWithout17() { final XQuery query = new XQuery( "declare function local:function() { let $b := (i/a) return () }; empty(local:function())", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertBoolean(true) || error("XPDY0002") || error("XPST0005") ) ); } /** * Use a let-variable that acts as an alias for a function argument. . */ @org.junit.Test public void k2LetExprWithout18() { final XQuery query = new XQuery( "declare function local:foo($a as xs:integer) { if($a = 3) then $a else let $a := $a return local:foo($a + 1) }; local:foo(1)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("3") ); } /** * Use an undefined focus in a let binding. . */ @org.junit.Test public void k2LetExprWithout19() { final XQuery query = new XQuery( "let $v := . return 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1") || error("XPDY0002") ) ); } /** * fn:deep-equal combined with a for/let expression(#2). . */ @org.junit.Test public void k2LetExprWithout2() { final XQuery query = new XQuery( "deep-equal((, , , ), (for $v1 in (1, 2, 3, 4) let $v2 := return ($v2)))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Bind to let and subsequently use the for expression. . */ @org.junit.Test public void k2LetExprWithout20() { final XQuery query = new XQuery( "\n" + " let $emps := //employee[location = \"Denver\"] \n" + " for $d in distinct-values($emps/deptno) \n" + " let $e := $emps[deptno = $d] \n" + " return {$d} {count($e)} {sum($e/salary)} \n" + " ", ctx); try { query.context(node(file("op/union/acme_corp.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("121300002180000", false) ); } /** * Use a focus within a LET tail expression. . */ @org.junit.Test public void k2LetExprWithout21() { final XQuery query = new XQuery( "/(for $b in 1, $i in self::node() return $i)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Use a focus within a LET expression. . */ @org.junit.Test public void k2LetExprWithout22() { final XQuery query = new XQuery( "/(for $i in self::node() return $i)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Bind the context item to a variable. . */ @org.junit.Test public void k2LetExprWithout23() { final XQuery query = new XQuery( "count(/(let $i := . return (string($i), data($i))))", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Ensure a name test is reported for using the undefined focus, when appearing as a child of a let binding. . */ @org.junit.Test public void k2LetExprWithout24() { final XQuery query = new XQuery( "declare function local:function() { let $b := (i/a) return 1 }; local:function()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1") || error("XPDY0002") ) ); } /** * A combination of expressions that triggers a bug in some parsers. . */ @org.junit.Test public void k2LetExprWithout25() { final XQuery query = new XQuery( "let $a := 1 return \n" + " for $b in 1 return \n" + " if ($b) then 1 \n" + " else if ($b) then 1 \n" + " else if ($b) then 1 \n" + " else if ($b) then 1 \n" + " else if ($b) then 1 \n" + " else if ($b) then 1 \n" + " else if ($b) then 1 \n" + " else if ($b) then 1 \n" + " else if ($b) then 1 \n" + " else if ($b) then 1 \n" + " else if ($b) then 1 \n" + " else if ($b) then 1 \n" + " else if ($b) then 1 \n" + " else if ($b) then 1 \n" + " else if ($b) then 1 \n" + " else if ($b) then 1 \n" + " else if ($b) then 1 \n" + " else if ($b) then 1 \n" + " else if ($b) then 1 \n" + " else if ($b) then 1 \n" + " else if ($b) then 1 \n" + " else if ($b) then 1 \n" + " else if ($b) then 1 \n" + " else if ($b) then 1 \n" + " else if ($b) then 1 \n" + " else ()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * An element() test whose cardinality doesn't match. . */ @org.junit.Test public void k2LetExprWithout26() { final XQuery query = new XQuery( "let $e := , $outer as element() := $e/element() return $outer", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * The focus is undefined inside the initializing expression for a 'let' variable. . */ @org.junit.Test public void k2LetExprWithout3() { final XQuery query = new XQuery( "declare function local:myFunc() { let $v := . return $v }; local:myFunc()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * The focus is undefined inside the initializing expression for a 'let' variable(#2). . */ @org.junit.Test public void k2LetExprWithout4() { final XQuery query = new XQuery( "declare function local:myFunc($arg as node()) { let $v := . return $arg/$v }; local:myFunc()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * The focus is undefined inside the initializing expression for a 'let' variable(#3). . */ @org.junit.Test public void k2LetExprWithout5() { final XQuery query = new XQuery( "declare function local:myFunc($arg as node()) { let $v := aNameTest return $arg/$v }; local:myFunc()", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPDY0002") ); } /** * The focus is undefined inside the initializing expression for a 'let' variable(#4). . */ @org.junit.Test public void k2LetExprWithout6() { final XQuery query = new XQuery( "declare function local:myFunc($arg as node()) { let $v := aNameTest return $arg/$v }; 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( ( assertEq("1") || error("XPDY0002") ) ); } /** * let-declarations doesn't cause type conversion. . */ @org.junit.Test public void k2LetExprWithout7() { final XQuery query = new XQuery( "let $i as xs:integer := xs:untypedAtomic(\"1\") return $i", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * A single return statement is syntactically incorrect. . */ @org.junit.Test public void k2LetExprWithout8() { final XQuery query = new XQuery( "return 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0003") ); } /** * let-declarations doesn't cause numeric promotion. . */ @org.junit.Test public void k2LetExprWithout9() { final XQuery query = new XQuery( "let $i as xs:float := 1.1 return $i", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Purpose : Assign a simple string using let . */ @org.junit.Test public void letExpr001() { final XQuery query = new XQuery( "let $x := \"92233720368547758\" return $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "92233720368547758") ); } /** * Purpose : Assign a simple integer using let . */ @org.junit.Test public void letExpr002() { final XQuery query = new XQuery( "let $x := 92233720368547758 return $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("92233720368547758") ); } /** * Purpose : Use an arithmetic operator with let . */ @org.junit.Test public void letExpr003() { final XQuery query = new XQuery( "let $x := 92233720368547758+1 return $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("92233720368547759") ); } /** * Purpose : Use xs:long(upper bound) . */ @org.junit.Test public void letExpr004() { final XQuery query = new XQuery( "let $x := xs:long(\"92233720368547758\") return $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("92233720368547758") ); } /** * Purpose : Use xs:long(lower bound) +1 . */ @org.junit.Test public void letExpr005() { final XQuery query = new XQuery( "let $x := xs:long(\"-92233720368547758\")+1 return $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("-92233720368547757") ); } /** * Purpose : Use xs:double(upper bound) . */ @org.junit.Test public void letExpr006() { final XQuery query = new XQuery( "let $x := xs:double(\"1.7976931348623157E308\") return $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1.7976931348623157E308") ); } /** * Purpose : A node with an expression in curly braces . */ @org.junit.Test public void letExpr007() { final XQuery query = new XQuery( "let $x:={1+1} return $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("2", false) ); } /** * Purpose : More than one variable cross referencing compatible values . */ @org.junit.Test public void letExpr008() { final XQuery query = new XQuery( "let $x:=1, $y:=$x+1 return $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1") ); } /** * Purpose : More than one variable cross referencing compatible values . */ @org.junit.Test public void letExpr009() { final XQuery query = new XQuery( "let $x:=1, $y:={$x+1} return $y", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("2", false) ); } /** * Purpose : More than one variable cross referencing incompatible values . */ @org.junit.Test public void letExpr010() { final XQuery query = new XQuery( "let $x:=(1,2,3), $y:=$x+1 return $y", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Purpose : Use sequences with filter expressions . */ @org.junit.Test public void letExpr011() { final XQuery query = new XQuery( "let $x :=(1 to 100)[. mod 5 eq 0] return $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100") ); } /** * Purpose : Use sequences with filter expressions with more than one variable . */ @org.junit.Test public void letExpr012() { final XQuery query = new XQuery( "let $x :=(1 to 100)[. mod 5 eq 0], $y := $x[. mod 10 eq 0] return $y", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10 20 30 40 50 60 70 80 90 100") ); } /** * Purpose : Use a function in the let . */ @org.junit.Test public void letExpr013() { final XQuery query = new XQuery( "let $x:=\"hello\", $y:=concat($x,\" there\") return $y", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "hello there") ); } /** * Purpose : Use incompatible types in let . */ @org.junit.Test public void letExpr014() { final XQuery query = new XQuery( "let $x := \"1\", $y := $x+1 return $y", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Purpose : Use a sequence of different types of scalars . */ @org.junit.Test public void letExpr015() { final XQuery query = new XQuery( "let $x := (0,0.1e-1,2.0,'a',\"cat\",'',true()) return $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "0 0.01 2 a cat true") ); } /** * Purpose : Use a sequence of nodes . */ @org.junit.Test public void letExpr016() { final XQuery query = new XQuery( "let $a := (, , ) return {$a}", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Purpose : Use a sequence with step . */ @org.junit.Test public void letExpr017() { final XQuery query = new XQuery( "let $x := ( 123 ) return $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization(" 123 ", false) ); } /** * Purpose : Use a sequence of different values . */ @org.junit.Test public void letExpr018() { final XQuery query = new XQuery( "let $x := (0,0.1e-1,2.0,'a',\"cat\",'',true(), (' 123 ')/a/b) return $x", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0019") ); } /** * Purpose : combine two 'Let' exprs in one 'Return' . */ @org.junit.Test public void letExpr019() { final XQuery query = new XQuery( "let $a := let $b := return ($a,$b)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertSerialization("", false) ); } /** * Purpose : Use three variables . */ @org.junit.Test public void letExpr020() { final XQuery query = new XQuery( "let $a := 1 let $b := $a let $c := $a+$b return ($c)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Purpose : Refer to an undefined variable . */ @org.junit.Test public void letExpr021() { final XQuery query = new XQuery( "let $a := $b return ($a)", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPST0008") ); } /** * Evaluation of let clause bound to variable used in expression that raises error. . */ @org.junit.Test public void letexprwith1() { final XQuery query = new XQuery( "let $salary as xs:decimal := \"cat\" return $salary * 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( error("XPTY0004") ); } /** * Let clause using dateTime type. . */ @org.junit.Test public void letexprwith10() { final XQuery query = new XQuery( "let $var as xs:dateTime := xs:dateTime(\"1999-05-31T13:20:00Z\") return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05-31T13:20:00Z") ); } /** * Let clause using float type. . */ @org.junit.Test public void letexprwith11() { final XQuery query = new XQuery( "let $var as xs:float := xs:float(100) return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("100") ); } /** * Let clause using an ineteger expression type. . */ @org.junit.Test public void letexprwith12() { final XQuery query = new XQuery( "let $var as xs:integer := 100+200 return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("300") ); } /** * Let clause using the fn:count function. . */ @org.junit.Test public void letexprwith13() { final XQuery query = new XQuery( "let $var as xs:integer := fn:count((100,200)) return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Let clause using the fn:not function. . */ @org.junit.Test public void letexprwith14() { final XQuery query = new XQuery( "let $var as xs:boolean := fn:not(fn:true()) return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Let clause using the "and" operator function. . */ @org.junit.Test public void letexprwith15() { final XQuery query = new XQuery( "let $var as xs:boolean := fn:true() and fn:true() return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Let clause using the "or" operator function. . */ @org.junit.Test public void letexprwith16() { final XQuery query = new XQuery( "let $var as xs:boolean := fn:true() and fn:true() return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Let clause using the "string-length" function. . */ @org.junit.Test public void letexprwith17() { final XQuery query = new XQuery( "let $var as xs:integer := fn:string-length(\"A String\") return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("8") ); } /** * Let clause using a casting from integer to string . */ @org.junit.Test public void letexprwith18() { final XQuery query = new XQuery( "let $var as xs:string := xs:string((xs:integer(100))) return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "100") ); } /** * Let clause using a casting from decimal to string . */ @org.junit.Test public void letexprwith19() { final XQuery query = new XQuery( "let $var as xs:string := xs:string((xs:decimal(100))) return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "100") ); } /** * Let clause used decimal type. . */ @org.junit.Test public void letexprwith2() { final XQuery query = new XQuery( "let $var as xs:decimal := 100 return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("100") ); } /** * Let clause using a casting from double to string . */ @org.junit.Test public void letexprwith20() { final XQuery query = new XQuery( "let $var as xs:string := xs:string((xs:double(100E2))) return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "10000") ); } /** * Let clause using a casting from boolean to string . */ @org.junit.Test public void letexprwith21() { final XQuery query = new XQuery( "let $var as xs:string := xs:string(fn:true()) return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "true") ); } /** * Let clause using a integer type and addition expression on return clause . */ @org.junit.Test public void letexprwith22() { final XQuery query = new XQuery( "let $var as xs:integer := 100 return $var + 1", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("101") ); } /** * Let clause using an "if" expression . */ @org.junit.Test public void letexprwith23() { final XQuery query = new XQuery( "let $var as xs:boolean := if (fn:true()) then fn:true() else fn:false() return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Let clause using a "typeswitch" expression . */ @org.junit.Test public void letexprwith24() { final XQuery query = new XQuery( "let $var as xs:string := typeswitch(fn:true()) case $i as xs:boolean return \"Test Passed\" default return \"Test failed\" return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "Test Passed") ); } /** * Let clause using integer type. . */ @org.junit.Test public void letexprwith3() { final XQuery query = new XQuery( "let $var as xs:integer := 100 return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("100") ); } /** * Let clause using double type. . */ @org.junit.Test public void letexprwith4() { final XQuery query = new XQuery( "let $var as xs:double := 100E1 return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("1000") ); } /** * Let clause using double type. . */ @org.junit.Test public void letexprwith5() { final XQuery query = new XQuery( "let $var as xs:string := \"A String\" return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "A String") ); } /** * Let clause using boolean (true) type. . */ @org.junit.Test public void letexprwith6() { final XQuery query = new XQuery( "let $var as xs:boolean := fn:true() return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(true) ); } /** * Let clause using boolean (false) type. . */ @org.junit.Test public void letexprwith7() { final XQuery query = new XQuery( "let $var as xs:boolean := fn:false() return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertBoolean(false) ); } /** * Let clause using date type. . */ @org.junit.Test public void letexprwith8() { final XQuery query = new XQuery( "let $var as xs:date := xs:date(\"1999-05-31Z\") return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "1999-05-31Z") ); } /** * Let clause using time type. . */ @org.junit.Test public void letexprwith9() { final XQuery query = new XQuery( "let $var as xs:time := xs:time(\"21:23:00Z\") return $var", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertStringValue(false, "21:23:00Z") ); } /** * Purpose : keywords can be used as variable names . */ @org.junit.Test public void xquery10keywords() { final XQuery query = new XQuery( "let $ancestor-or-self := 1 \n" + " let $ancestor := 1 \n" + " let $and := 1 \n" + " let $as := 1 \n" + " let $ascending := 1 \n" + " let $at := 1 \n" + " let $attribute := 1 \n" + " let $base-uri := 1 \n" + " let $boundary-space := 1 \n" + " let $by := 1 \n" + " let $case := 1 \n" + " let $cast := 1 \n" + " let $castable := 1 \n" + " let $child := 1 \n" + " let $collation := 1 \n" + " let $comment := 1 \n" + " let $construction := 1 \n" + " let $copy-namespaces := 1 \n" + " let $declare := 1 \n" + " let $default := 1 \n" + " let $descendant-or-self := 1 \n" + " let $descendant := 1 \n" + " let $descending := 1 \n" + " let $div := 1 \n" + " let $document-node := 1 \n" + " let $document := 1 \n" + " let $element := 1 \n" + " let $else := 1 \n" + " let $empty-sequence := 1 \n" + " let $empty := 1 \n" + " let $encoding := 1 \n" + " let $eq := 1 let $every := 1 let $except := 1 let $external := 1 let $following-sibling := 1 \n" + " let $following := 1 let $for := 1 let $function := 1 let $ge := 1 let $greatest := 1 \n" + " let $gt := 1 let $idiv := 1 let $if := 1 let $import := 1 let $in := 1 let $inherit := 1 \n" + " let $instance := 1 let $intersect := 1 let $is := 1 let $item := 1 let $lax := 1 \n" + " let $le := 1 let $least := 1 let $let := 1 let $lt := 1 let $mod := 1 let $module := 1 \n" + " let $module := 1 let $namespace := 1 let $ne := 1 let $no-inherit := 1 \n" + " let $no-preserve := 1 let $node := 1 let $of := 1 let $option := 1 let $or := 1 \n" + " let $order := 1 let $ordered := 1 let $ordering := 1 let $parent := 1 let $preceding-sibling := 1 \n" + " let $preceding := 1 let $preserve := 1 let $processing-instruction := 1 let $return := 1 \n" + " let $satisfies := 1 let $schema-attribute := 1 let $schema-element := 1 let $schema := 1 \n" + " let $self := 1 let $some := 1 let $stable := 1 let $strict := 1 let $strip := 1 \n" + " let $text := 1 let $then := 1 let $to := 1 let $treat := 1 let $typeswitch := 1 \n" + " let $union := 1 let $unordered := 1 let $validate := 1 let $variable := 1 let $version := 1 \n" + " let $where := 1 let $xquery := 1 return 2", ctx); try { result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEq("2") ); } /** * Purpose : keywords can be used as element name tests . */ @org.junit.Test public void xquery10keywords2() { final XQuery query = new XQuery( "\n" + " let $x := (/) \n" + " return $x /ancestor-or-self /ancestor /and /as /ascending /at /attribute \n" + " /base-uri /boundary-space /by \n" + " /case /cast /castable /child /collation /comment /construction /copy-namespaces \n" + " /declare /default /descendant-or-self /descendant /descending /div /document-node /document \n" + " /element /else /empty-sequence /empty /encoding /eq /every /except /external \n" + " /following-sibling /following /for /function \n" + " /ge /greatest /gt \n" + " /idiv /if /import /in /inherit /instance /intersect /is /item\n" + " /lax /le /least /let /lt \n" + " /mod /module /module \n" + " /namespace /ne /no-inherit /no-preserve /node \n" + " /of /option /or /order /ordered /ordering \n" + " /parent /preceding-sibling /preceding /preserve /processing-instruction \n" + " /return \n" + " /satisfies /schema-attribute /schema-element /schema /self /some /stable /strict /strip \n" + " /text /then /to /treat /typeswitch \n" + " /union /unordered \n" + " /validate /variable /version \n" + " /where\n" + " /xquery", ctx); try { query.context(node(file("docs/works-mod.xml"))); result = new QT3Result(query.value()); } catch(final Throwable trw) { result = new QT3Result(trw); } finally { query.close(); } test( assertEmpty() ); } /** * Purpose : keywords can be used as element names . */ @org.junit.Test public void xquery10keywords3() { final XQuery query = new XQuery( "\n" + " \n" + " \n" + " \n" + "

    \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "